<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
    <title>Ethereum Improvement Proposals - Standards Track</title>
    <subtitle>Ethereum Improvement Proposals (EIPs &amp; ERCs) describe standards for the Ethereum platform, such as core protocol changes and application-level standards.</subtitle>
    <link href="https://wg-eips.ritovision.com/type/standards-track/atom.xml" rel="self" type="application/atom+xml"/>
    <link rel="alternate" type="text/html" href="https://wg-eips.ritovision.com/type/standards-track/"/>
    <generator uri="https://www.getzola.org/">Zola</generator>
    <updated>2026-04-25T12:06:20+00:00</updated>
    <id>https://wg-eips.ritovision.com/type/standards-track/atom.xml</id>
    <entry xml:lang="en">
        <title>Multi KZG Point Evaluation Precompile</title>
        <published>2026-02-06T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Chris Mata</name><uri>https://github.com/protocolwhisper</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8149/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8149-multi-kzg-point-evaluation-precompile/27671" />
        

        <id>https://wg-eips.ritovision.com/8149/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:8149"
            label="EIP-8149" />
        

        
        

        
        <summary type="html">Verify multiple (z, y) evaluations against a single EIP-4844 blob commitment in one precompile call.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8149/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Add a precompile that verifies multiple KZG openings &lt;code&gt;(z_i, y_i)&lt;&#x2F;code&gt; for a single &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt; blob commitment, returning the same 64-byte output as the existing point-evaluation precompile.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt; provides a point-evaluation precompile at &lt;code&gt;0x0A&lt;&#x2F;code&gt; costing 50,000 gas per opening. Contracts needing multiple blob values (e.g., fraud proofs) must pay this cost repeatedly. A batch interface verifies &lt;em&gt;k&lt;&#x2F;em&gt; openings in one call, reducing overhead.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc2119&quot;&gt;RFC 2119&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc8174&quot;&gt;RFC 8174&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Comment&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MULTI_POINT_EVALUATION_PRECOMPILE_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;TBD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;precompile address&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_MULTI_POINTS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;128&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;maximum number of evaluation points&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MULTI_POINT_EVALUATION_BASE_GAS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;TBD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;base gas cost&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MULTI_POINT_EVALUATION_PER_POINT_GAS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;TBD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;gas cost per evaluation point&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;We introduce a precompile to perform multi KZG point evaluation:&lt;&#x2F;p&gt;
&lt;p&gt;It verifies multiple KZG openings &lt;code&gt;(z_i, y_i)&lt;&#x2F;code&gt; for a single EIP-4844 blob commitment in one call. The verification uses BLS12-381 pairing operations internally to check the multi-point opening proof. Gas cost is defined by &lt;code&gt;MULTI_POINT_EVALUATION_BASE_GAS + MULTI_POINT_EVALUATION_PER_POINT_GAS * n&lt;&#x2F;code&gt; where &lt;code&gt;n&lt;&#x2F;code&gt; is the number of evaluation points.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;input&quot;&gt;Input&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;versioned_hash  : Bytes32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;commitment      : Bytes48&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;n               : uint32 (big-endian)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pairs           : n × (z: Bytes32, y: Bytes32)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;proof           : Bytes48&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Total length: &lt;code&gt;132 + (n × 64)&lt;&#x2F;code&gt; bytes. All &lt;code&gt;z&lt;&#x2F;code&gt; and &lt;code&gt;y&lt;&#x2F;code&gt; MUST be strictly less than &lt;code&gt;BLS_MODULUS&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;output&quot;&gt;Output&lt;&#x2F;h3&gt;
&lt;p&gt;On success, return 64 bytes identical to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;FIELD_ELEMENTS_PER_BLOB  : uint256 (big-endian)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;BLS_MODULUS              : uint256 (big-endian)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;multi-point-evaluation-precompile&quot;&gt;Multi-point evaluation precompile&lt;&#x2F;h3&gt;
&lt;p&gt;Add a precompile at &lt;code&gt;MULTI_POINT_EVALUATION_PRECOMPILE_ADDRESS&lt;&#x2F;code&gt; that verifies multiple KZG openings &lt;code&gt;(z_i, y_i)&lt;&#x2F;code&gt; for a single EIP-4844 blob commitment.&lt;&#x2F;p&gt;
&lt;p&gt;The precompile executes the following logic:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; multi_point_evaluation_precompile&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;input&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    versioned_hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    commitment&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;80&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;80&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;84&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;big&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_MULTI_POINTS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;input&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 132&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    z_values&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; y_values&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        offset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 84&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        z_i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;offset&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;offset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;big&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        y_i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;offset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;offset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;64&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;big&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span&gt; z_i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BLS_MODULUS&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span&gt; y_i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BLS_MODULUS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        z_values&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;z_i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        y_values&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;y_i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    proof&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;84&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;64&lt;&#x2F;span&gt;&lt;span&gt; :&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 84&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;64&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 48&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; kzg_to_versioned_hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;commitment&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; versioned_hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; verify_kzg_proof_multi&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;commitment&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; z_values&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; y_values&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; proof&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; U256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;FIELD_ELEMENTS_PER_BLOB&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;to_be_bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; U256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;BLS_MODULUS&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;to_be_bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;verify_kzg_proof_multi&lt;&#x2F;code&gt; function performs multi-point opening verification using the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt; trusted setup and BLS12-381 pairing operations. Implementations typically use Lagrange interpolation to construct a polynomial through all &lt;code&gt;(z_i, y_i)&lt;&#x2F;code&gt; pairs, which has O(n²) complexity. When evaluation points align with roots of unity, FFT-based methods reduce this to O(n log n). The final verification step uses a single pairing check to verify all openings simultaneously.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-cost&quot;&gt;Gas Cost&lt;&#x2F;h3&gt;
&lt;p&gt;The gas cost for multi point evaluation is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; gas_cost&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MULTI_POINT_EVALUATION_BASE_GAS&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MULTI_POINT_EVALUATION_PER_POINT_GAS&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; n&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Gas constants SHOULD ensure batching is cheaper than &lt;code&gt;n&lt;&#x2F;code&gt; separate &lt;code&gt;0x0A&lt;&#x2F;code&gt; calls for &lt;code&gt;n &amp;gt; 1&lt;&#x2F;code&gt;. The verification internally uses BLS12-381 pairing operations, which are computationally expensive but enable efficient batch verification of multiple openings.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Preserves &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt; versioned-hash model and return format.&lt;&#x2F;li&gt;
&lt;li&gt;Adds a new precompile rather than modifying &lt;code&gt;0x0A&lt;&#x2F;code&gt; to avoid compatibility risks.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;MAX_MULTI_POINTS = 128&lt;&#x2F;code&gt; bounds input size while enabling meaningful savings.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No changes to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt; transactions, &lt;code&gt;BLOBHASH&lt;&#x2F;code&gt;, or the existing precompile at &lt;code&gt;0x0A&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Reject non-canonical field elements (&lt;code&gt;&amp;gt;= BLS_MODULUS&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;Implementations MUST use the same trusted setup and subgroup checks as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Gas pricing MUST reflect actual computational cost.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Custom sweep threshold for validators</title>
        <published>2026-02-05T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Dmitry Gusakov</name><uri>https://github.com/dgusakov</uri>
	</author>
	
	<author>
		<name>Dmitry Chernukhin</name><uri>https://github.com/madlabman</uri>
	</author>
	
	<author>
		<name>Greg Koumoutsos</name><uri>https://github.com/gkoumout</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8148/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8148-custom-sweep-threshold-for-validators/27669" />
        

        <id>https://wg-eips.ritovision.com/8148/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:8148"
            label="EIP-8148" />
        

        
        

        
        <summary type="html">Allow setting custom balance thresholds for sweep withdrawals for validators with compounding withdrawal credentials (`0x02, 0x03`).</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8148/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes an optional mechanism to set custom balance thresholds for sweep withdrawals for compounding withdrawal credentials (&lt;code&gt;0x02, 0x03&lt;&#x2F;code&gt;) validators. This mechanism allows validators to specify above which balance they want their rewards to be swept to their withdrawal address, providing greater flexibility and control over their staking rewards.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The current default sweep threshold (2,048 ETH) for validators using compounding withdrawal credentials (&lt;code&gt;0x02, 0x03&lt;&#x2F;code&gt;) may not meet the needs of all validators. Some validators may prefer to accumulate rewards on the validator balance, while others may want to sweep before reaching the current threshold of 2,048 ETH. By allowing optional custom sweep thresholds, validators can optimize their reward management according to their individual strategies and preferences.&lt;&#x2F;p&gt;
&lt;p&gt;Since the introduction of the &lt;code&gt;0x02&lt;&#x2F;code&gt; compounding withdrawal credentials type, we have observed a very low rate of validators transitioning to &lt;code&gt;0x02&lt;&#x2F;code&gt;. One reason is that many validators do not want to wait until they accumulate 2048 ETH in rewards before being able to participate in the automatic sweep of withdrawals. While partial withdrawals were considered a viable method for manually withdrawing portions of the validator balance, this approach was not widely adopted by staking protocols, node operators, and solo stakers for several reasons. First, it requires a user-initiated transaction to perform a withdrawal. Second, partial withdrawals utilize the general exit queue, which makes the time between partial withdrawal initiation and fulfillment unpredictable and heavily dependent on network conditions (see the recent spike in exit queue size in October 2025). This EIP aims to address this issue by allowing validators to set a custom threshold for sweep withdrawals.&lt;&#x2F;p&gt;
&lt;p&gt;A simple example illustrates the utility of this feature. Consider a validator who wishes to accumulate rewards on their validator balance until reaching 128 ETH, at which point they want to sweep the rewards to their withdrawal address. Without this feature, the validator would have to initiate partial withdrawals at certain intervals manually and wait in the partial withdrawals queue, which can be time-consuming and inconvenient. The first inconvenience is that if staking protocols widely adopt partial withdrawals at some point, the queue for these withdrawals might become long and unpredictable, similar to the exit queue. The second inconvenience is that the user must monitor the validator&#x27;s balance and manually initiate partial withdrawals, which adds complexity and overhead to the staking process. The third inconvenience is the frequency with which the validator can request partial withdrawals. A 128-ETH validator will receive approximately 0.07 ETH in rewards each week. Initiating partial withdrawals TX, for such a low amount might be considered unreasonable. At the same time, the sweep cycle will likely drop to a weekly cycle relatively soon, allowing the validator to automatically receive these 0.07 ETH of rewards on their withdrawal credentials. In general, with this EIP, the validator can set their desired sweep threshold and automatically benefit from sweep withdrawals.&lt;&#x2F;p&gt;
&lt;p&gt;The proposed mechanism is completely optional and does not change anything in the default registration &#x2F; withdrawal &#x2F; exit process for validators. It&#x27;s just an additional feature that could be ignored if not interesting, but provides a useful feature for many validators incentivizing switching to compounding validators.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc2119&quot;&gt;RFC 2119&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc8174&quot;&gt;RFC 8174&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;execution-layer&quot;&gt;Execution layer&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Comment&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SET_SWEEP_THRESHOLD_REQUEST_TYPE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x03&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7685&#x2F;&quot;&gt;EIP-7685&lt;&#x2F;a&gt; type prefix for set sweep threshold request&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SET_SWEEP_THRESHOLD_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;TBD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Where to call and store relevant details about set sweep threshold request mechanism&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SYSTEM_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xfffffffffffffffffffffffffffffffffffffffe&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Address used to invoke system operation on contract&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;EXCESS_SET_SWEEP_THRESHOLD_REQUESTS_STORAGE_SLOT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SET_SWEEP_THRESHOLD_REQUEST_COUNT_STORAGE_SLOT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SET_SWEEP_THRESHOLD_REQUEST_QUEUE_HEAD_STORAGE_SLOT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Pointer to the head of the set sweep threshold request message queue&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SET_SWEEP_THRESHOLD_REQUEST_QUEUE_TAIL_STORAGE_SLOT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;3&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Pointer to the tail of the set sweep threshold request message queue&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SET_SWEEP_THRESHOLD_REQUEST_QUEUE_STORAGE_OFFSET&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;4&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The start storage slot of the in-state set sweep threshold request message queue&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_SET_SWEEP_THRESHOLD_REQUESTS_PER_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;16&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Maximum number of set sweep threshold requests that can be dequeued into a block&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TARGET_SET_SWEEP_THRESHOLD_REQUESTS_PER_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MIN_SET_SWEEP_THRESHOLD_REQUEST_FEE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SET_SWEEP_THRESHOLD_REQUEST_FEE_UPDATE_FRACTION&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;17&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;EXCESS_INHIBITOR&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2**256-1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Excess value used to compute the fee before the first system call&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;consensus-layer&quot;&gt;Consensus layer&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MIN_SWEEP_THRESHOLD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;MIN_ACTIVATION_BALANCE + Gwei(1 * 10**9)&lt;&#x2F;code&gt; (33 ETH)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;execution-layer-1&quot;&gt;Execution layer&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;FORK_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; -- the first block in a blockchain after this EIP has been activated.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;set-sweep-threshold-request&quot;&gt;Set sweep threshold request&lt;&#x2F;h4&gt;
&lt;p&gt;The new set sweep threshold request is an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7685&#x2F;&quot;&gt;EIP-7685&lt;&#x2F;a&gt; request with type &lt;code&gt;SET_SWEEP_THRESHOLD_REQUEST_TYPE&lt;&#x2F;code&gt; consisting of the following fields:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;source_address&lt;&#x2F;code&gt;: &lt;code&gt;Bytes20&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;validator_pubkey&lt;&#x2F;code&gt;: &lt;code&gt;Bytes48&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;threshold&lt;&#x2F;code&gt;: &lt;code&gt;uint64&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7685&#x2F;&quot;&gt;EIP-7685&lt;&#x2F;a&gt; encoding of a set sweep threshold request is computed as follows.
Note that &lt;code&gt;threshold&lt;&#x2F;code&gt; is returned by the contract little-endian, and must be encoded as such.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;request_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SET_SWEEP_THRESHOLD_REQUEST_TYPE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;request_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; read_set_sweep_threshold_requests&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;set-sweep-threshold-request-contract&quot;&gt;Set sweep threshold request contract&lt;&#x2F;h4&gt;
&lt;p&gt;The contract has three different code paths, which can be summarized at a high level as follows:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Add set sweep threshold request - requires a 56-byte input: validator public key concatenated with a big-endian &lt;code&gt;uint64&lt;&#x2F;code&gt; threshold value.&lt;&#x2F;li&gt;
&lt;li&gt;Fee getter - if the input length is zero, return the current fee required to add a set sweep threshold request.&lt;&#x2F;li&gt;
&lt;li&gt;System process - if called by the system address, pop off the set sweep threshold requests for the current block from the queue.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h5 id=&quot;add-set-sweep-threshold-request&quot;&gt;Add Set Sweep Threshold Request&lt;&#x2F;h5&gt;
&lt;p&gt;If call data input to the contract is exactly &lt;code&gt;56&lt;&#x2F;code&gt; bytes, perform the following:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Ensure enough ETH was sent to cover the current set sweep threshold request fee (&lt;code&gt;msg.value &amp;gt;= get_fee()&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;Increase set sweep threshold request count by 1 for the current block.&lt;&#x2F;li&gt;
&lt;li&gt;Insert a set sweep threshold request into the queue for the source address, validator public key, and the threshold.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Specifically, the functionality is defined in pseudocode as the function &lt;code&gt;add_set_sweep_threshold_request()&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; add_set_sweep_threshold_request&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;validator_pubkey&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes48&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; threshold&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Add a new request to the set sweep threshold request queue, provided a sufficient value to cover the fee was sent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify sufficient value was provided.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_fee&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span&gt; fee&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Insufficient value for fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Increment the request count.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    count&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SET_SWEEP_THRESHOLD_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SET_SWEEP_THRESHOLD_REQUEST_COUNT_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SET_SWEEP_THRESHOLD_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SET_SWEEP_THRESHOLD_REQUEST_COUNT_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; count&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Insert into the queue.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    queue_tail_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SET_SWEEP_THRESHOLD_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SET_SWEEP_THRESHOLD_REQUEST_QUEUE_TAIL_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    queue_storage_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SET_SWEEP_THRESHOLD_REQUEST_QUEUE_STORAGE_OFFSET&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; queue_tail_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SET_SWEEP_THRESHOLD_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; queue_storage_slot&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SET_SWEEP_THRESHOLD_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; queue_storage_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; validator_pubkey&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SET_SWEEP_THRESHOLD_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; queue_storage_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; validator_pubkey&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;48&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; ++&lt;&#x2F;span&gt;&lt;span&gt; threshold&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SET_SWEEP_THRESHOLD_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SET_SWEEP_THRESHOLD_REQUEST_QUEUE_TAIL_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; queue_tail_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h6 id=&quot;fee-calculation&quot;&gt;Fee calculation&lt;&#x2F;h6&gt;
&lt;p&gt;The following pseudocode can compute the cost of an individual set sweep threshold request, given a certain number of excess set sweep threshold requests.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_fee&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SET_SWEEP_THRESHOLD_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EXCESS_SET_SWEEP_THRESHOLD_REQUESTS_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EXCESS_INHIBITOR&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Inhibitor still active&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; fake_exponential&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        MIN_SET_SWEEP_THRESHOLD_REQUEST_FEE&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        excess&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        SET_SWEEP_THRESHOLD_REQUEST_FEE_UPDATE_FRACTION&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fake_exponential&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;factor&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; numerator&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; denominator&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    output&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    numerator_accum&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; factor&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; denominator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    while&lt;&#x2F;span&gt;&lt;span&gt; numerator_accum&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        output&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; numerator_accum&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        numerator_accum&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;numerator_accum&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; numerator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;denominator&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; output&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; denominator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;fee-getter&quot;&gt;Fee Getter&lt;&#x2F;h5&gt;
&lt;p&gt;When the input to the contract has zero-length, interpret this as a get request for the current fee, i.e. the contract returns the result of &lt;code&gt;get_fee()&lt;&#x2F;code&gt;. The contract reverts if any value is sent to prevent loss of funds.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;system-call&quot;&gt;System Call&lt;&#x2F;h5&gt;
&lt;p&gt;At the end of processing any execution block starting from the &lt;code&gt;FORK_BLOCK&lt;&#x2F;code&gt; (i.e. after processing all transactions), call &lt;code&gt;SET_SWEEP_THRESHOLD_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;code&gt; as &lt;code&gt;SYSTEM_ADDRESS&lt;&#x2F;code&gt; with no calldata. The invocation triggers the following:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The contract&#x27;s queue is updated based on set sweep threshold requests dequeued and the set sweep threshold requests queue head&#x2F;tail are reset if the queue has been cleared (&lt;code&gt;dequeue_set_sweep_threshold_requests()&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;The contract&#x27;s excess set sweep threshold requests are updated based on usage in the current block (&lt;code&gt;update_excess_set_sweep_threshold_requests()&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;The contract&#x27;s set sweep threshold requests count is reset to 0 (&lt;code&gt;reset_set_sweep_threshold_requests_count()&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In response to the system call, the contract returns an opaque byte array of concatenated SSZ-serialized dequeued requests. There&#x27;s no specific reasoning behind it, except aligning with the existing behaviour of the similar EIP, see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7002&#x2F;&quot;&gt;EIP-7002&lt;&#x2F;a&gt;, and possible simplification of the processing flow for client teams.
Each set sweep threshold request must appear in the EIP-7685 requests list in the exact order returned by &lt;code&gt;dequeue_set_sweep_threshold_requests()&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, the system call and the processing of that block must conform to the following:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The call has a dedicated gas limit of &lt;code&gt;30_000_000&lt;&#x2F;code&gt; (&lt;code&gt;SYSTEM_TRANSACTION_GAS&lt;&#x2F;code&gt;) and is not subject to the transaction limit cap introduced in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7825&#x2F;&quot;&gt;EIP-7825&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Gas consumed by this call does not count against the block’s overall gas usage.&lt;&#x2F;li&gt;
&lt;li&gt;Both the gas limit assigned to the call and the gas consumed are excluded from any checks against the block’s gas limit.&lt;&#x2F;li&gt;
&lt;li&gt;The call does not follow &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; fee burn semantics — no value should be transferred as part of this call.&lt;&#x2F;li&gt;
&lt;li&gt;If there is no code at &lt;code&gt;SET_SWEEP_THRESHOLD_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;code&gt;, the corresponding block &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be marked invalid.&lt;&#x2F;li&gt;
&lt;li&gt;If the call to the contract fails or returns an error, the block &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be invalidated.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The functionality triggered by the system call is defined in pseudocode as the function &lt;code&gt;read_set_sweep_threshold_requests()&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;##################&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Public function #&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;##################&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; read_set_sweep_threshold_requests&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    reqs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; dequeue_set_sweep_threshold_requests&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    update_excess_set_sweep_threshold_requests&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    reset_set_sweep_threshold_requests_count&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;join&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ssz&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;serialize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;r&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; reqs&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;##########&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Helpers #&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;##########&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ValidatorSetSweepThresholdRequest&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    source_address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    validator_pubkey&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes48&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    threshold&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; dequeue_set_sweep_threshold_requests&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    queue_head_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SET_SWEEP_THRESHOLD_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SET_SWEEP_THRESHOLD_REQUEST_QUEUE_HEAD_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    queue_tail_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SET_SWEEP_THRESHOLD_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SET_SWEEP_THRESHOLD_REQUEST_QUEUE_TAIL_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    num_in_queue&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; queue_tail_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; queue_head_index&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    num_dequeued&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;num_in_queue&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_SET_SWEEP_THRESHOLD_REQUESTS_PER_BLOCK&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    reqs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;num_dequeued&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        queue_storage_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SET_SWEEP_THRESHOLD_REQUEST_QUEUE_STORAGE_OFFSET&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;queue_head_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        source_address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SET_SWEEP_THRESHOLD_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; queue_storage_slot&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;20&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        validator_pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SET_SWEEP_THRESHOLD_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; queue_storage_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SET_SWEEP_THRESHOLD_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; queue_storage_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;16&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        threshold&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SET_SWEEP_THRESHOLD_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; queue_storage_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;16&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;24&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        req&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; ValidatorSetSweepThresholdRequest&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            source_address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;Bytes20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;source_address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            validator_pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;Bytes48&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;validator_pubkey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            threshold&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;uint64&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;threshold&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        reqs&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;req&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    new_queue_head_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; queue_head_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; num_dequeued&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; new_queue_head_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; queue_tail_index&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Queue is empty, reset queue pointers&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SET_SWEEP_THRESHOLD_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SET_SWEEP_THRESHOLD_REQUEST_QUEUE_HEAD_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SET_SWEEP_THRESHOLD_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SET_SWEEP_THRESHOLD_REQUEST_QUEUE_TAIL_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SET_SWEEP_THRESHOLD_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SET_SWEEP_THRESHOLD_REQUEST_QUEUE_HEAD_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; new_queue_head_index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; reqs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; update_excess_set_sweep_threshold_requests&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    previous_excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SET_SWEEP_THRESHOLD_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EXCESS_SET_SWEEP_THRESHOLD_REQUESTS_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; previous_excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EXCESS_INHIBITOR&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        previous_excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    count&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SET_SWEEP_THRESHOLD_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SET_SWEEP_THRESHOLD_REQUEST_COUNT_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    new_excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; previous_excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; count&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TARGET_SET_SWEEP_THRESHOLD_REQUESTS_PER_BLOCK&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        new_excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; previous_excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; count&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TARGET_SET_SWEEP_THRESHOLD_REQUESTS_PER_BLOCK&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SET_SWEEP_THRESHOLD_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EXCESS_SET_SWEEP_THRESHOLD_REQUESTS_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; new_excess&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; reset_set_sweep_threshold_requests_count&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SET_SWEEP_THRESHOLD_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SET_SWEEP_THRESHOLD_REQUEST_COUNT_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;bytecode&quot;&gt;Bytecode&lt;&#x2F;h5&gt;
&lt;p&gt;The following bytecode is produced by the geas compiler from the source code in the sys-asm repository.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;asm&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;caller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push20 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xfffffffffffffffffffffffffffffffffffffffe&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;eq&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xcb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x11&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push32 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;eq&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x01f4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;mul&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;iszero&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x68&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;mul&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;mul&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;div&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x4d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jump&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;div&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;calldatasize&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x38&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;eq&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x88&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;calldatasize&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x01f4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;callvalue&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x01f4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;callvalue&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;lt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x01f4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x03&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x03&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;mul&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x04&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;caller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;caller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x60&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;shl&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x38&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x14&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;calldatacopy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x4c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;log0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x03&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;stop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x03&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x02&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;sub&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x02&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xdf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x02&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;eq&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x0183&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x03&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;mul&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x04&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x4c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;mul&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x60&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;shl&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x14&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x02&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push32 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xffffffffffffffffffffffffffffffff00000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;and&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x10&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x40&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;shr&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x38&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;shr&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x07&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x30&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;shr&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x06&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x28&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;shr&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x05&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;shr&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x04&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x18&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;shr&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x03&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x10&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;shr&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x02&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x08&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;shr&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xe1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jump&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;eq&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x0195&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x02&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x01a0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jump&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x02&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x03&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push32 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;eq&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;iszero&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x01cd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x01e2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x01e8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jump&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;sub&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x4c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;mul&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;revert&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;deployment&quot;&gt;Deployment&lt;&#x2F;h5&gt;
&lt;p&gt;The set sweep threshold requests contract is deployed like any other smart contract. A special synthetic address is generated by working backwards from the desired deployment transaction:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;TBD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Sender: TBD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Address: TBD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;consensus-layer-1&quot;&gt;Consensus layer&lt;&#x2F;h3&gt;
&lt;p&gt;The defining feature of this EIP is &lt;em&gt;&lt;strong&gt;allowing validators to set custom sweep thresholds for their withdrawals when using compounding withdrawal credentials (&lt;code&gt;0x02, 0x03&lt;&#x2F;code&gt;)&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8148&#x2F;#rationale&quot;&gt;Rationale&lt;&#x2F;a&gt; section contains an explanation for this proposed core feature. A sketch of the resulting changes to the consensus layer is included below.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Update the &lt;code&gt;BeaconState&lt;&#x2F;code&gt; container to include a &lt;code&gt;validator_sweep_thresholds&lt;&#x2F;code&gt; mapping.&lt;&#x2F;li&gt;
&lt;li&gt;Add &lt;code&gt;SetSweepThresholdRequest&lt;&#x2F;code&gt; container to represent the set sweep threshold requests dequeued from the execution layer contract.&lt;&#x2F;li&gt;
&lt;li&gt;Update the &lt;code&gt;ExecutionRequests&lt;&#x2F;code&gt; container to include a list of &lt;code&gt;SetSweepThresholdRequest&lt;&#x2F;code&gt; items.&lt;&#x2F;li&gt;
&lt;li&gt;Add &lt;code&gt;process_set_sweep_threshold_request&lt;&#x2F;code&gt; function to handle the processing of set sweep threshold requests from the execution layer.&lt;&#x2F;li&gt;
&lt;li&gt;Modify the &lt;code&gt;process_execution_payload&lt;&#x2F;code&gt; function to include the processing of set sweep threshold requests.&lt;&#x2F;li&gt;
&lt;li&gt;Modify the &lt;code&gt;is_partially_withdrawable_validator&lt;&#x2F;code&gt; predicate to take into account the custom sweep threshold.&lt;&#x2F;li&gt;
&lt;li&gt;Add &lt;code&gt;get_effective_sweep_threshold&lt;&#x2F;code&gt; helper function to compute the effective sweep threshold for a validator.&lt;&#x2F;li&gt;
&lt;li&gt;Modify the &lt;code&gt;get_expected_withdrawals&lt;&#x2F;code&gt; function to use the custom sweep threshold when determining partial withdrawals.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;By default, all validators will have their sweep thresholds set to the current default &lt;code&gt;MAX_EFFECTIVE_BALANCE&lt;&#x2F;code&gt;, both for existing validators and new ones. Validators can choose to set a custom threshold above their current balance by submitting a set sweep threshold request through the execution layer contract.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;overview&quot;&gt;Overview&lt;&#x2F;h3&gt;
&lt;p&gt;Most of the considerations regarding the messaging format, queue, and rate-limiting are similar to those discussed in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7002&#x2F;&quot;&gt;EIP-7002&lt;&#x2F;a&gt; for withdrawal requests, and so we refer the reader to that EIP for more details.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;custom-sweep-thresholds&quot;&gt;Custom Sweep Thresholds&lt;&#x2F;h3&gt;
&lt;p&gt;The primary motivation for this EIP is to allow validators to set custom sweep thresholds for their withdrawals when using compounding withdrawal credentials (&lt;code&gt;0x02, 0x03&lt;&#x2F;code&gt;). This feature provides greater flexibility and control over how and when validators can access their staking rewards.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;validator-sweep-thresholds-mapping-in-beaconstate&quot;&gt;&lt;code&gt;validator_sweep_thresholds&lt;&#x2F;code&gt; mapping in &lt;code&gt;BeaconState&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;To store the custom sweep thresholds for each validator, we introduce a new mapping in the &lt;code&gt;BeaconState&lt;&#x2F;code&gt; container called &lt;code&gt;validator_sweep_thresholds&lt;&#x2F;code&gt;. This mapping associates each validator index with its corresponding sweep threshold. This approach was chosen instead of adding a new field to the &lt;code&gt;Validator&lt;&#x2F;code&gt; container to avoid modification of this type, which had not been changed since phase-0. Modification of the &lt;code&gt;Validator&lt;&#x2F;code&gt; container would have required more extensive changes to the consensus layer and potentially affected existing implementations of the applications using this container. Also, this is the standard way of adding info about validators into the state (e.g., validator balance is stored in &lt;code&gt;balances&lt;&#x2F;code&gt; field of &lt;code&gt;BeaconState&lt;&#x2F;code&gt; and several other PoS-related info have their own lists where each item corresponds to validators&#x27; data)&lt;&#x2F;p&gt;
&lt;h3 id=&quot;only-allowing-threshold-to-be-set-above-current-balance&quot;&gt;Only allowing threshold to be set above current balance&lt;&#x2F;h3&gt;
&lt;p&gt;This design decision is made to prevent usage of the custom sweep threshold mechanism to trigger immediate withdrawals. By enforcing that the threshold must be set above the current balance, we ensure that validators cannot use this feature to bypass the standard withdrawal process. Should a validator wish to set sweep threshold below current balance, they can first withdraw down to the desired level using partial withdrawals, and then set the sweep threshold accordingly.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;immediate-requests-processing-instead-of-queuing-on-consensus-layer&quot;&gt;Immediate requests processing instead of queuing on consensus layer&lt;&#x2F;h3&gt;
&lt;p&gt;Unlike partial withdrawal requests, which are queued on the consensus layer, set sweep threshold requests are processed immediately upon being dequeued from the execution layer contract. This design choice simplifies the implementation and reduces the complexity of managing a separate queue on the consensus layer.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;min-sweep-threshold-of-33-eth&quot;&gt;&lt;code&gt;MIN_SWEEP_THRESHOLD&lt;&#x2F;code&gt; of 33 ETH&lt;&#x2F;h3&gt;
&lt;p&gt;To ensure that validators do not set sweep threshold equal to &lt;code&gt;MIN_ACTIVATION_BALANCE&lt;&#x2F;code&gt;, we introduce a minimum sweep threshold of &lt;code&gt;MIN_ACTIVATION_BALANCE + 1&lt;&#x2F;code&gt; ETH (33 ETH). This ensures that people will opt-in to compounding withdrawal credentials only if they really want to accumulate rewards on the validator balance.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces backwards incompatible changes to the block structure and block validation rule set. But neither of these changes break anything related to the current user activity and experience.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Most of the security considerations regarding fee overpayment, system call failure, and empty code failure are similar to those discussed in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7002&#x2F;&quot;&gt;EIP-7002&lt;&#x2F;a&gt; for withdrawal requests, and so we refer the reader to that EIP for more details.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Frame Transaction</title>
        <published>2026-01-29T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	<author>
		<name>lightclient</name><uri>https://github.com/lightclient</uri>
	</author>
	
	<author>
		<name>Felix Lange</name><uri>https://github.com/fjl</uri>
	</author>
	
	<author>
		<name>Yoav Weiss</name><uri>https://github.com/yoavw</uri>
	</author>
	
	<author>
		<name>Alex Forshtat</name><uri>https://github.com/forshtat</uri>
	</author>
	
	<author>
		<name>Dror Tirosh</name><uri>https://github.com/drortirosh</uri>
	</author>
	
	<author>
		<name>Shahaf Nacson</name><uri>https://github.com/shahafn</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8141/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/frame-transaction/27617" />
        

        <id>https://wg-eips.ritovision.com/8141/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:8141"
            label="EIP-8141" />
        

        
        

        
        <summary type="html">Add frame abstraction for transaction validation, execution, and gas payment</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8141/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Add a new transaction whose validity and gas payment can be defined abstractly. Instead of relying solely on a single ECDSA signature, accounts may freely define and interpret their signature scheme using any cryptographic system.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This new transaction provides a native off-ramp from the elliptic curve based cryptographic system used to authenticate transactions today, to post-quantum (PQ) secure systems.&lt;&#x2F;p&gt;
&lt;p&gt;In doing so, it realizes the original vision of account abstraction: unlinking accounts from a prescribed ECDSA key and support alternative fee payment schemes. The assumption of an account simply becomes an address with code. It leverages the EVM to support arbitrary &lt;em&gt;user-defined&lt;&#x2F;em&gt; definitions of validation and gas payment.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FRAME_TX_TYPE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x06&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FRAME_TX_INTRINSIC_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;15000&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ENTRY_POINT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;address(0xaa)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_FRAMES&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;10^3&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;opcodes&quot;&gt;Opcodes&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;APPROVE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xaa&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TXPARAMLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xb0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TXPARAMSIZE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xb1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TXPARAMCOPY&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xb2&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;new-transaction-type&quot;&gt;New Transaction Type&lt;&#x2F;h3&gt;
&lt;p&gt;A new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; transaction with type &lt;code&gt;FRAME_TX_TYPE&lt;&#x2F;code&gt; is introduced. Transactions of this type are referred to as &quot;Frame transactions&quot;.&lt;&#x2F;p&gt;
&lt;p&gt;The payload is defined as the RLP serialization of the following:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[chain_id, nonce, sender, frames, max_priority_fee_per_gas, max_fee_per_gas, max_fee_per_blob_gas, blob_versioned_hashes]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;frames = [[mode, target, gas_limit, data], ...]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;If no blobs are included, &lt;code&gt;blob_versioned_hashes&lt;&#x2F;code&gt; must be an empty list and &lt;code&gt;max_fee_per_blob_gas&lt;&#x2F;code&gt; must be &lt;code&gt;0&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;modes&quot;&gt;Modes&lt;&#x2F;h4&gt;
&lt;p&gt;There are three modes:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Mode&lt;&#x2F;th&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Summary&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;DEFAULT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Execute frame as &lt;code&gt;ENTRY_POINT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;VERIFY&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Frame identifies as transaction validation&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;SENDER&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Execute frame as &lt;code&gt;sender&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h5 id=&quot;default-mode&quot;&gt;&lt;code&gt;DEFAULT&lt;&#x2F;code&gt; Mode&lt;&#x2F;h5&gt;
&lt;p&gt;Frame executes as regular call where the caller address is &lt;code&gt;ENTRY_POINT&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;verify-mode&quot;&gt;&lt;code&gt;VERIFY&lt;&#x2F;code&gt; Mode&lt;&#x2F;h5&gt;
&lt;p&gt;Identifies the frame as a validation frame. Its purpose is to &lt;em&gt;verify&lt;&#x2F;em&gt; that a sender and&#x2F;or payer authorized the transaction. It must call &lt;code&gt;APPROVE&lt;&#x2F;code&gt; during execution. Failure to do so will result in the whole transaction being invalid.&lt;&#x2F;p&gt;
&lt;p&gt;The execution behaves the same as &lt;code&gt;STATICCALL&lt;&#x2F;code&gt;, state cannot be modified.&lt;&#x2F;p&gt;
&lt;p&gt;Frames in this mode will have their data elided from signature hash calculation and from introspection by other frames.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;sender-mode&quot;&gt;&lt;code&gt;SENDER&lt;&#x2F;code&gt; Mode&lt;&#x2F;h5&gt;
&lt;p&gt;Frame executes as regular call where the caller address is &lt;code&gt;sender&lt;&#x2F;code&gt;. This mode effectively acts on behalf of the transaction sender and can only be used after explicitly approved.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;constraints&quot;&gt;Constraints&lt;&#x2F;h4&gt;
&lt;p&gt;Some validity constraints can be determined statically. They are outlined below:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;chain_id&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;frames&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;frames&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_FRAMES&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;frames&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;n&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;mode&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;frames&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;n&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;target&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 20&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; or&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;frames&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;n&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;target&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;receipt&quot;&gt;Receipt&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;ReceiptPayload&lt;&#x2F;code&gt; is defined as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[cumulative_gas_used, payer, [frame_receipt, ...]]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;frame_receipt = [status, gas_used, logs]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;payer&lt;&#x2F;code&gt; is the address of the account that paid the fees for the transaction. &lt;code&gt;status&lt;&#x2F;code&gt; is the return code of the top-level call.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;signature-hash&quot;&gt;Signature Hash&lt;&#x2F;h4&gt;
&lt;p&gt;With the frame transaction, the signature may be at an arbitrary location in the frame list. In the canonical signature hash any frame with mode &lt;code&gt;VERIFY&lt;&#x2F;code&gt; will have its data elided:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; compute_sig_hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; FrameTx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; frame&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; enumerate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;frames&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; frame&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;mode&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; VERIFY&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;frames&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; keccak&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;rlp&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;new-opcodes&quot;&gt;New Opcodes&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;approve-opcode-0xaa&quot;&gt;&lt;code&gt;APPROVE&lt;&#x2F;code&gt; opcode (&lt;code&gt;0xaa&lt;&#x2F;code&gt;)&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;APPROVE&lt;&#x2F;code&gt; opcode is like &lt;code&gt;RETURN (0xf3)&lt;&#x2F;code&gt;. It exits the current context successfully and updates the transaction-scoped approval context based on the &lt;code&gt;scope&lt;&#x2F;code&gt; operand. It can only be called when &lt;code&gt;CALLER == frame.target&lt;&#x2F;code&gt;, otherwise it results in an exceptional halt.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;stack&quot;&gt;Stack&lt;&#x2F;h5&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Stack&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;top - 0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;offset&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;top - 1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;length&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;top - 2&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;scope&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h5 id=&quot;scope-operand&quot;&gt;Scope Operand&lt;&#x2F;h5&gt;
&lt;p&gt;The scope operand must be one of the following values:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;0x0&lt;&#x2F;code&gt;: Approval of execution - the sender contract approves future frames calling on its behalf. Only valid when &lt;code&gt;frame.target&lt;&#x2F;code&gt; equals &lt;code&gt;tx.sender&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;0x1&lt;&#x2F;code&gt;: Approval of payment - the contract approves paying the total gas cost for the transaction.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;0x2&lt;&#x2F;code&gt;: Approval of execution and payment - combines both &lt;code&gt;0x0&lt;&#x2F;code&gt; and &lt;code&gt;0x1&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Any other value results in an exceptional halt.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;behavior&quot;&gt;Behavior&lt;&#x2F;h5&gt;
&lt;p&gt;The behavior of &lt;code&gt;APPROVE&lt;&#x2F;code&gt; is defined as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If &lt;code&gt;APPROVE&lt;&#x2F;code&gt; is called when &lt;code&gt;CALLER != frame.target&lt;&#x2F;code&gt;, revert.&lt;&#x2F;li&gt;
&lt;li&gt;For scopes &lt;code&gt;0&lt;&#x2F;code&gt;,&lt;code&gt;1&lt;&#x2F;code&gt;, and &lt;code&gt;2&lt;&#x2F;code&gt;, execute the following:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;0x0&lt;&#x2F;code&gt;: Set &lt;code&gt;sender_approved = true&lt;&#x2F;code&gt;.
&lt;ul&gt;
&lt;li&gt;If &lt;code&gt;sender_approved&lt;&#x2F;code&gt; was already set, revert the frame.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;CALLER&lt;&#x2F;code&gt; != &lt;code&gt;tx.sender&lt;&#x2F;code&gt;, revert the frame.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;0x1&lt;&#x2F;code&gt;: Increment the sender&#x27;s nonce, collect the total gas cost of the transaction from the account, and set &lt;code&gt;payer_approved = true&lt;&#x2F;code&gt;.
&lt;ul&gt;
&lt;li&gt;If payer_approved` was already set, revert the frame.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;frame.target&lt;&#x2F;code&gt; has insufficient balance, revert the frame.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;sender_approved == false&lt;&#x2F;code&gt;, revert the frame.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;0x2&lt;&#x2F;code&gt;: &lt;code&gt;sender_approved = true&lt;&#x2F;code&gt;, increment the sender&#x27;s nonce, collect the total gas cost of the transaction from &lt;code&gt;frame.target&lt;&#x2F;code&gt;, and set &lt;code&gt;payer_approved = true&lt;&#x2F;code&gt;.
&lt;ul&gt;
&lt;li&gt;If &lt;code&gt;sender_approved&lt;&#x2F;code&gt; or &lt;code&gt;payer_approved&lt;&#x2F;code&gt; was already set, revert the frame.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;CALLER&lt;&#x2F;code&gt; != &lt;code&gt;tx.sender&lt;&#x2F;code&gt;, revert the frame.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;frame.target&lt;&#x2F;code&gt; has insufficient balance, revert the frame.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;txparam-opcodes&quot;&gt;&lt;code&gt;TXPARAM*&lt;&#x2F;code&gt; opcodes&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;TXPARAMLOAD&lt;&#x2F;code&gt; (&lt;code&gt;0xb0&lt;&#x2F;code&gt;), &lt;code&gt;TXPARAMSIZE&lt;&#x2F;code&gt; (&lt;code&gt;0xb1&lt;&#x2F;code&gt;), and &lt;code&gt;TXPARAMCOPY&lt;&#x2F;code&gt; (&lt;code&gt;0xb2&lt;&#x2F;code&gt;) opcodes follow the pattern of &lt;code&gt;CALLDATA*&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;RETURNDATA*&lt;&#x2F;code&gt; opcode families. Gas cost follows standard EVM memory expansion costs.&lt;&#x2F;p&gt;
&lt;p&gt;Each &lt;code&gt;TXPARAM*&lt;&#x2F;code&gt; opcode takes two extra stack input values before the &lt;code&gt;CALLDATA*&lt;&#x2F;code&gt; equivalent inputs. The values of these inputs are as follows:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;code&gt;in1&lt;&#x2F;code&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;code&gt;in2&lt;&#x2F;code&gt;&lt;&#x2F;th&gt;&lt;th&gt;Return value&lt;&#x2F;th&gt;&lt;th&gt;Size&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;0x00&lt;&#x2F;td&gt;&lt;td&gt;must be 0&lt;&#x2F;td&gt;&lt;td&gt;current transaction type&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x01&lt;&#x2F;td&gt;&lt;td&gt;must be 0&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;nonce&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x02&lt;&#x2F;td&gt;&lt;td&gt;must be 0&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;sender&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x03&lt;&#x2F;td&gt;&lt;td&gt;must be 0&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;max_priority_fee_per_gas&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x04&lt;&#x2F;td&gt;&lt;td&gt;must be 0&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;max_fee_per_gas&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x05&lt;&#x2F;td&gt;&lt;td&gt;must be 0&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;max_fee_per_blob_gas&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x06&lt;&#x2F;td&gt;&lt;td&gt;must be 0&lt;&#x2F;td&gt;&lt;td&gt;max cost (basefee=max, all gas used, includes blob cost and intrinsic cost)&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x07&lt;&#x2F;td&gt;&lt;td&gt;must be 0&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;len(blob_versioned_hashes)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x08&lt;&#x2F;td&gt;&lt;td&gt;must be 0&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;compute_sig_hash(tx)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x09&lt;&#x2F;td&gt;&lt;td&gt;must be 0&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;len(frames)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x10&lt;&#x2F;td&gt;&lt;td&gt;must be 0&lt;&#x2F;td&gt;&lt;td&gt;currently executing frame index&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x11&lt;&#x2F;td&gt;&lt;td&gt;frame index&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;target&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x12&lt;&#x2F;td&gt;&lt;td&gt;frame index&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;data&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;dynamic&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x13&lt;&#x2F;td&gt;&lt;td&gt;frame index&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;gas_limit&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x14&lt;&#x2F;td&gt;&lt;td&gt;frame index&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;mode&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x15&lt;&#x2F;td&gt;&lt;td&gt;frame index&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;status&lt;&#x2F;code&gt; (exceptional halt if current&#x2F;future)&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Notes:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;0x03 and 0x04 have a possible future extension to allow indices for multidimensional gas.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;status&lt;&#x2F;code&gt; field (0x15) returns &lt;code&gt;0&lt;&#x2F;code&gt; for failure or &lt;code&gt;1&lt;&#x2F;code&gt; for success.&lt;&#x2F;li&gt;
&lt;li&gt;Out-of-bounds access for frame index (&lt;code&gt;&amp;gt;= len(frames)&lt;&#x2F;code&gt;) and blob index results in an exceptional halt.&lt;&#x2F;li&gt;
&lt;li&gt;Invalid &lt;code&gt;in1&lt;&#x2F;code&gt; values (not defined in the table above) result in an exceptional halt.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;data&lt;&#x2F;code&gt; field (0x12) returns size 0 value when called on a frame with &lt;code&gt;VERIFY&lt;&#x2F;code&gt; set.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;behavior-1&quot;&gt;Behavior&lt;&#x2F;h3&gt;
&lt;p&gt;When processing a frame transaction, perform the following steps.&lt;&#x2F;p&gt;
&lt;p&gt;Perform stateful validation check:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Ensure &lt;code&gt;tx.nonce == state[tx.sender].nonce&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Initialize with transaction-scoped variables:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;payer_approved = false&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;sender_approved = false&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Then for each call frame:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Execute a call with the specified &lt;code&gt;mode&lt;&#x2F;code&gt;, &lt;code&gt;target&lt;&#x2F;code&gt;, &lt;code&gt;gas_limit&lt;&#x2F;code&gt;, and &lt;code&gt;data&lt;&#x2F;code&gt;.
&lt;ul&gt;
&lt;li&gt;If &lt;code&gt;target&lt;&#x2F;code&gt; is null, set the call target to &lt;code&gt;tx.sender&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If mode is &lt;code&gt;SENDER&lt;&#x2F;code&gt;:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;sender_approved&lt;&#x2F;code&gt; must be &lt;code&gt;true&lt;&#x2F;code&gt;. If not, the transaction is invalid.&lt;&#x2F;li&gt;
&lt;li&gt;Set &lt;code&gt;caller&lt;&#x2F;code&gt; as &lt;code&gt;tx.sender&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;If mode is &lt;code&gt;DEFAULT&lt;&#x2F;code&gt; or &lt;code&gt;VERIFY&lt;&#x2F;code&gt;:
&lt;ul&gt;
&lt;li&gt;Set the &lt;code&gt;caller&lt;&#x2F;code&gt; to &lt;code&gt;ENTRY_POINT&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;ORIGIN&lt;&#x2F;code&gt; opcode returns frame &lt;code&gt;caller&lt;&#x2F;code&gt; throughout all call depths.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;If frame has mode &lt;code&gt;VERIFY&lt;&#x2F;code&gt; and the frame did successfully call &lt;code&gt;APPROVE&lt;&#x2F;code&gt;, the transaction is invalid.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;After executing all frames, verify that &lt;code&gt;payer_approved == true&lt;&#x2F;code&gt;. If it is, refund any unpaid gas to the gas payer. If it is not, the whole transaction is invalid.&lt;&#x2F;p&gt;
&lt;p&gt;Note: it is implied by the handling that the sender must approve the transaction &lt;em&gt;before&lt;&#x2F;em&gt; the payer and that once &lt;code&gt;sender_approved&lt;&#x2F;code&gt; or &lt;code&gt;payer_approved&lt;&#x2F;code&gt; become &lt;code&gt;true&lt;&#x2F;code&gt; they cannot be re-approved or reverted.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;frame-interactions&quot;&gt;Frame interactions&lt;&#x2F;h4&gt;
&lt;p&gt;A few cross-frame interactions to note:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;For the purposes of gas accounting of warm &#x2F; cold state status, the journal of such touches is shared across frames.&lt;&#x2F;li&gt;
&lt;li&gt;Discard the &lt;code&gt;TSTORE&lt;&#x2F;code&gt; and &lt;code&gt;TLOAD&lt;&#x2F;code&gt; transient storage between frames.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;gas-accounting&quot;&gt;Gas Accounting&lt;&#x2F;h4&gt;
&lt;p&gt;The total gas limit of the transaction is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tx_gas_limit = FRAME_TX_INTRINSIC_COST + calldata_cost(rlp(tx.frames)) + sum(frame.gas_limit for all frames)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Where &lt;code&gt;calldata_cost&lt;&#x2F;code&gt; is calculated per standard EVM rules (4 gas per zero byte, 16 gas per non-zero byte).&lt;&#x2F;p&gt;
&lt;p&gt;The total fee is defined as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tx_fee = tx_gas_limit * effective_gas_price + blob_fees&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;blob_fees = len(blob_versioned_hashes) * GAS_PER_BLOB * blob_base_fee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;effective_gas_price&lt;&#x2F;code&gt; is calculated per EIP-1559 and &lt;code&gt;blob_fees&lt;&#x2F;code&gt; is calculated as per EIP-4844.&lt;&#x2F;p&gt;
&lt;p&gt;Each frame has its own &lt;code&gt;gas_limit&lt;&#x2F;code&gt; allocation. Unused gas from a frame is &lt;strong&gt;not&lt;&#x2F;strong&gt; available to subsequent frames. After all frames execute, the gas refund is calculated as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;refund = sum(frame.gas_limit for all frames) - total_gas_used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This refund is returned to the gas payer (the &lt;code&gt;target&lt;&#x2F;code&gt; that called &lt;code&gt;APPROVE(0x1)&lt;&#x2F;code&gt; or &lt;code&gt;APPROVE(0x2)&lt;&#x2F;code&gt;) and added back to the block gas pool. &lt;em&gt;Note: This refund mechanism is separate from EIP-3529 storage refunds.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;canonical-signature-hash&quot;&gt;Canonical signature hash&lt;&#x2F;h3&gt;
&lt;p&gt;The canonical signature hash is provided in &lt;code&gt;TXPARAMLOAD&lt;&#x2F;code&gt; to simplify the development of smart accounts.&lt;&#x2F;p&gt;
&lt;p&gt;Computing the signature hash in EVM is complicated and expensive. While using the canonical signature hash is not mandatory, it is strongly recommended. Creating a bespoke signature requires precise commitment to the underlying transaction data. Without this, it&#x27;s possible that some elements can be manipulated in-the-air while the transaction is pending and have unexpected effects. This is known as transaction malleability. Using the canonical signature hash avoids malleability of the frames other than &lt;code&gt;VERIFY&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;frame.data&lt;&#x2F;code&gt; of &lt;code&gt;VERIFY&lt;&#x2F;code&gt; frames is elided from the signature hash. This is done for two reasons:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;It contains the signature so by definition it cannot be part of the signature hash.&lt;&#x2F;li&gt;
&lt;li&gt;In the future it may be desired to aggregate the cryptographic operations for data and compute efficiency reasons. If the data was introspectable, it would not be possible to aggregate the verify frames in the future.&lt;&#x2F;li&gt;
&lt;li&gt;For gas sponsoring workflows, we also recommend using a &lt;code&gt;VERIFY&lt;&#x2F;code&gt; frame to approve the gas payment. Here, the input data to the sponsor is intentionally left malleable so it can be added onto the transaction after the &lt;code&gt;sender&lt;&#x2F;code&gt; has made its signature. Notably, the &lt;code&gt;frame.target&lt;&#x2F;code&gt; of &lt;code&gt;VERIFY&lt;&#x2F;code&gt; frames is covered by the signature hash, i.e. the &lt;code&gt;sender&lt;&#x2F;code&gt; chooses the sponsor address explicitly.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;approve-calling-convention&quot;&gt;&lt;code&gt;APPROVE&lt;&#x2F;code&gt; calling convention&lt;&#x2F;h3&gt;
&lt;p&gt;Originally &lt;code&gt;APPROVE&lt;&#x2F;code&gt; was meant to extend the space of return statuses from 0 and j 1 today to 0 to 4. However, this would mean smart accounts deployed today would not beable to modify their contract code to return with a different value at the top level. For this reason, we&#x27;ve chosen behavior above: &lt;code&gt;APPROVE&lt;&#x2F;code&gt; terminates the executing frame successfully like &lt;code&gt;RETURN&lt;&#x2F;code&gt;, but it actually updates the transaction scoped values &lt;code&gt;sender_approved&lt;&#x2F;code&gt; and &lt;code&gt;payer_approved&lt;&#x2F;code&gt; during execution. It is still required that only the sender can toggle the &lt;code&gt;sender_approved&lt;&#x2F;code&gt; to &lt;code&gt;true&lt;&#x2F;code&gt;. Only the &lt;code&gt;frame.target&lt;&#x2F;code&gt; can call &lt;code&gt;APPROVE&lt;&#x2F;code&gt; generally, because it can allow the transaction pool and other frames to better reason about &lt;code&gt;VERIFY&lt;&#x2F;code&gt; mode frames.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;payer-in-receipt&quot;&gt;Payer in receipt&lt;&#x2F;h3&gt;
&lt;p&gt;The payer cannot be determined statically from a frame transaction and is relevant to users. The only way to provide this information safely and efficiently over the JSON-RPC is to record this data in the receipt object.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;no-authorization-list&quot;&gt;No authorization list&lt;&#x2F;h3&gt;
&lt;p&gt;The EIP-7702 authorization list heavily relies on ECDSA cryptography to determine the authority of accounts to delegate code. While delegations could be used in other manners later, it does not satisfy the PQ goals of the frame transaction.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;no-access-list&quot;&gt;No access list&lt;&#x2F;h3&gt;
&lt;p&gt;The access list was introduced to address a particular backwards compatibility issue that was caused by EIP-2929. The risk-reward of using an access list successfully is high. A single miss, paying to warm a storage slot that does not end up getting used, causes the overall transaction cost to be greater than had it not been included at all.&lt;&#x2F;p&gt;
&lt;p&gt;Future optimizations based on pre-announcing state elements a transaction will touch will be covered by block level access lists.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;no-value-in-frame&quot;&gt;No value in frame&lt;&#x2F;h3&gt;
&lt;p&gt;It is not required because the account code can send value.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;examples&quot;&gt;Examples&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;example-1-simple-transaction&quot;&gt;Example 1: Simple Transaction&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Frame&lt;&#x2F;th&gt;&lt;th&gt;Caller&lt;&#x2F;th&gt;&lt;th&gt;Target&lt;&#x2F;th&gt;&lt;th&gt;Data&lt;&#x2F;th&gt;&lt;th&gt;Mode&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;ENTRY_POINT&lt;&#x2F;td&gt;&lt;td&gt;Null (sender)&lt;&#x2F;td&gt;&lt;td&gt;Signature&lt;&#x2F;td&gt;&lt;td&gt;VERIFY&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;Sender&lt;&#x2F;td&gt;&lt;td&gt;Target&lt;&#x2F;td&gt;&lt;td&gt;Call data&lt;&#x2F;td&gt;&lt;td&gt;SENDER&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Frame 0 verifies the signature and calls &lt;code&gt;APPROVE(0x2)&lt;&#x2F;code&gt; to approve both execution and payment. Frame 1 executes and exits normally via &lt;code&gt;RETURN&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The mempool can process this transaction with the following static validation and call:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Verify that the first frame is a &lt;code&gt;VERIFY&lt;&#x2F;code&gt; frame.&lt;&#x2F;li&gt;
&lt;li&gt;Verify that the call of frame 0 succeeds, and does not violate the mempool rules (similar to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7562&#x2F;&quot;&gt;ERC-7562&lt;&#x2F;a&gt;).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;example-1a-simple-eth-transfer&quot;&gt;Example 1a: Simple ETH transfer&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Frame&lt;&#x2F;th&gt;&lt;th&gt;Caller&lt;&#x2F;th&gt;&lt;th&gt;Target&lt;&#x2F;th&gt;&lt;th&gt;Data&lt;&#x2F;th&gt;&lt;th&gt;Mode&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;ENTRY_POINT&lt;&#x2F;td&gt;&lt;td&gt;Null (sender)&lt;&#x2F;td&gt;&lt;td&gt;Signature&lt;&#x2F;td&gt;&lt;td&gt;VERIFY&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;Sender&lt;&#x2F;td&gt;&lt;td&gt;Null (sender)&lt;&#x2F;td&gt;&lt;td&gt;Destination&#x2F;Amount&lt;&#x2F;td&gt;&lt;td&gt;SENDER&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;A simple transfer is performed by instructing the account to send ETH to the destination account. This requires two frames for mempool compatibility, since the validation phase of the transaction has to be static.&lt;&#x2F;p&gt;
&lt;p&gt;This is listed here to illustrate why the transaction type has no built-in value field.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;example-1b-simple-account-deployment&quot;&gt;Example 1b: Simple account deployment&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Frame&lt;&#x2F;th&gt;&lt;th&gt;Caller&lt;&#x2F;th&gt;&lt;th&gt;Target&lt;&#x2F;th&gt;&lt;th&gt;Data&lt;&#x2F;th&gt;&lt;th&gt;Mode&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;ENTRY_POINT&lt;&#x2F;td&gt;&lt;td&gt;Deployer&lt;&#x2F;td&gt;&lt;td&gt;Initcode, Salt&lt;&#x2F;td&gt;&lt;td&gt;DEFAULT&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;ENTRY_POINT&lt;&#x2F;td&gt;&lt;td&gt;Null (sender)&lt;&#x2F;td&gt;&lt;td&gt;Signature&lt;&#x2F;td&gt;&lt;td&gt;VERIFY&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;Sender&lt;&#x2F;td&gt;&lt;td&gt;Null (sender)&lt;&#x2F;td&gt;&lt;td&gt;Destination&#x2F;Amount&lt;&#x2F;td&gt;&lt;td&gt;SENDER&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;This example illustrates the initial deployment flow for a smart account at the &lt;code&gt;sender&lt;&#x2F;code&gt; address. Since the address needs to have code in order to validate the transaction, the transaction must deploy the code before verification.&lt;&#x2F;p&gt;
&lt;p&gt;The first frame would call a deployer contract, like EIP-7997. The deployer determines the address in a deterministic way, such as by hashing the initcode and salt. However, since the transaction sender is not authenticated at this point, the user must choose an initcode which is safe to deploy by anyone.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;example-2-sponsored-transaction-fee-payment-in-erc-20&quot;&gt;Example 2: Sponsored Transaction (Fee Payment in ERC-20)&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Frame&lt;&#x2F;th&gt;&lt;th&gt;Caller&lt;&#x2F;th&gt;&lt;th&gt;Target&lt;&#x2F;th&gt;&lt;th&gt;Data&lt;&#x2F;th&gt;&lt;th&gt;Mode&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;ENTRY_POINT&lt;&#x2F;td&gt;&lt;td&gt;Null (sender)&lt;&#x2F;td&gt;&lt;td&gt;Signature&lt;&#x2F;td&gt;&lt;td&gt;VERIFY&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;ENTRY_POINT&lt;&#x2F;td&gt;&lt;td&gt;Sponsor&lt;&#x2F;td&gt;&lt;td&gt;Sponsor data&lt;&#x2F;td&gt;&lt;td&gt;VERIFY&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;Sender&lt;&#x2F;td&gt;&lt;td&gt;ERC-20&lt;&#x2F;td&gt;&lt;td&gt;transfer(Sponsor,fees)&lt;&#x2F;td&gt;&lt;td&gt;SENDER&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;Sender&lt;&#x2F;td&gt;&lt;td&gt;Target addr&lt;&#x2F;td&gt;&lt;td&gt;Call data&lt;&#x2F;td&gt;&lt;td&gt;SENDER&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;4&lt;&#x2F;td&gt;&lt;td&gt;ENTRY_POINT&lt;&#x2F;td&gt;&lt;td&gt;Sponsor&lt;&#x2F;td&gt;&lt;td&gt;Post op call&lt;&#x2F;td&gt;&lt;td&gt;DEFAULT&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;ul&gt;
&lt;li&gt;Frame 0: Verifies signature and calls &lt;code&gt;APPROVE(0x0)&lt;&#x2F;code&gt; to authorize execution from sender.&lt;&#x2F;li&gt;
&lt;li&gt;Frame 1: Checks that the user has enough ERC-20 tokens, and that the next frame is an ERC-20 send of the right size to the sponsor. Calls &lt;code&gt;APPROVE(0x1)&lt;&#x2F;code&gt; to authorize payment.&lt;&#x2F;li&gt;
&lt;li&gt;Frame 2: Sends tokens to sponsor.&lt;&#x2F;li&gt;
&lt;li&gt;Frame 3: User&#x27;s intended call.&lt;&#x2F;li&gt;
&lt;li&gt;Frame 4 (optional): Check unpaid gas, refund tokens, possibly convert tokens to ETH on an AMM.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;data-efficiency&quot;&gt;Data Efficiency&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;Basic transaction sending ETH from a smart account:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Field&lt;&#x2F;th&gt;&lt;th&gt;Bytes&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Tx wrapper&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Chain ID&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Nonce&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Sender&lt;&#x2F;td&gt;&lt;td&gt;20&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Max priority fee&lt;&#x2F;td&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Max fee&lt;&#x2F;td&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Max fee per blob gas&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Blob versioned hashes (empty)&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Frames wrapper&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Sender validation frame: target&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Sender validation frame: gas&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Sender validation frame: data&lt;&#x2F;td&gt;&lt;td&gt;65&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Sender validation frame: mode&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Execution frame: target&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Execution frame: gas&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Execution frame: data&lt;&#x2F;td&gt;&lt;td&gt;20+5&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Execution frame: mode&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Total&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;134&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Notes: Nonce assumes &amp;lt; 65536 prior sends. Fees assume &amp;lt; 1099 gwei. Validation frame target is 1 byte because target is &lt;code&gt;tx.sender&lt;&#x2F;code&gt;. Validation gas assumes &amp;lt;= 65,536 gas. Calldata is 65 bytes for ECDSA signature. Blob fields assume no blobs (empty list, zero max fee).&lt;&#x2F;p&gt;
&lt;p&gt;This is not much larger than an EIP-1559 transaction; the extra overhead is the need to specify the sender and amount in calldata explicitly.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;First transaction from an account (add deployment frame):&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Field&lt;&#x2F;th&gt;&lt;th&gt;Bytes&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Deployment frame: target&lt;&#x2F;td&gt;&lt;td&gt;20&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Deployment frame: gas&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Deployment frame: data&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Deployment frame: mode&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Total additional&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;124&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Notes: Gas assumes cost &amp;lt; 2^24. Calldata assumes small proxy.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Trustless pay-with-ERC-20 sponsor (add these frames):&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Field&lt;&#x2F;th&gt;&lt;th&gt;Bytes&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Sponsor validation frame: target&lt;&#x2F;td&gt;&lt;td&gt;20&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Sponsor validation frame: gas&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Sponsor validation frame: calldata&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Sponsor validation frame: mode&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Send to sponsor frame: target&lt;&#x2F;td&gt;&lt;td&gt;20&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Send to sponsor frame: gas&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Send to sponsor frame: calldata&lt;&#x2F;td&gt;&lt;td&gt;68&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Send to sponsor frame: mode&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Sponsor post op frame: target&lt;&#x2F;td&gt;&lt;td&gt;20&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Sponsor post op frame: gas&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Sponsor post op frame: calldata&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Sponsor post op frame: mode&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Total additional&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;140&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Notes: Sponsor can read info from other fields. ERC-20 transfer call is 68 bytes.&lt;&#x2F;p&gt;
&lt;p&gt;There is some inefficiency in the sponsor case, because the same sponsor address must appear in three places (sponsor validation, send to sponsor inside ERC-20 calldata, post op frame), and the ABI is inefficient (~12 + 24 bytes wasted on zeroes). This is difficult to mitigate in a &quot;clean&quot; way, because one of the duplicates is inside the ERC-20 call, &quot;opaque&quot; to the protocol. However, it is much less inefficient than ERC-4337, because not all of the data takes the hit of the 32-byte-per-field ABI overhead.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;ORIGIN&lt;&#x2F;code&gt; opcode behavior changes for frame transactions, returning the frame&#x27;s caller rather than the traditional transaction origin. This is consistent with the precedent set by EIP-7702, which already modified &lt;code&gt;ORIGIN&lt;&#x2F;code&gt; semantics. Contracts that rely on &lt;code&gt;ORIGIN = CALLER&lt;&#x2F;code&gt; for security checks (a discouraged pattern) may behave differently under frame transactions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;transaction-propagation&quot;&gt;Transaction Propagation&lt;&#x2F;h3&gt;
&lt;p&gt;Frame transactions introduce new denial-of-service vectors for transaction pools that node operators must mitigate. Because validation logic is arbitrary EVM code, attackers can craft transactions that appear valid during initial validation but become invalid later. Without any additional policies, an attacker could submit many transactions whose validity depends on some shared state, then submit one transaction that modifies that state, and cause all other transactions to become invalid simultaneously. This wastes the computational resources nodes spent validating and storing these transactions.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;example-attack&quot;&gt;Example Attack&lt;&#x2F;h4&gt;
&lt;p&gt;A simple example is transactions that check &lt;code&gt;block.timestamp&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validateTransaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; SOME_DEADLINE&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;expired&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ... rest of validation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    APPROVE&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Such transactions are valid when submitted but become invalid once the deadline passes, without any on-chain action required from the attacker.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;mitigations&quot;&gt;Mitigations&lt;&#x2F;h5&gt;
&lt;p&gt;Node implementations should consider restricting which opcodes and storage slots validation frames can access, similar to ERC-7562. This isolates transactions from each other and limits mass invalidation vectors.&lt;&#x2F;p&gt;
&lt;p&gt;It&#x27;s recommended that to &lt;em&gt;validate&lt;&#x2F;em&gt; the transaction, a specific frame structure is enforced and the amount of gas that is expended executing the validation phase must be limited. Once the frame calls &lt;code&gt;APPROVE(0x2)&lt;&#x2F;code&gt;, it can be included in the mempool and propagated to peers safely.&lt;&#x2F;p&gt;
&lt;p&gt;For deployment of the sender account in the first frame, the mempool must only allow specific and known deployer factory  contracts to be used as &lt;code&gt;frame.target&lt;&#x2F;code&gt;, to ensure deployment is deterministic and independent of chain state.&lt;&#x2F;p&gt;
&lt;p&gt;In general, it can be assumed that handling of frame transactions imposes similar restrictions as EIP-7702 on mempool relay, i.e. only a single transaction can be pending for an account that uses frame transactions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Block-in-Blobs (BiB)</title>
        <published>2026-01-29T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Kevaundray Wedderburn</name><uri>https://github.com/kevaundray</uri>
	</author>
	
	<author>
		<name>Ignacio Hagopian</name><uri>https://github.com/jsign</uri>
	</author>
	
	<author>
		<name>Jihoon Song</name><email>jihoon.song@ethereum.org</email>
	</author>
	
	<author>
		<name>Francesco Risitano</name><uri>https://github.com/frisitano</uri>
	</author>
	
	<author>
		<name>Thomas Thiery</name><uri>https://github.com/soispoke</uri><email>thomas.thiery@ethereum.org</email>
	</author>
	
	<author>
		<name>Toni Wahrstätter</name><uri>https://github.com/nerolation</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8142/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8142-block-in-blobs-bib/27621" />
        

        <id>https://wg-eips.ritovision.com/8142/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:8142"
            label="EIP-8142" />
        

        
        

        
        <summary type="html">Ensures execution payload data availability via blobs</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8142/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;zkEVMs allow validators to verify the correctness of an execution payload using a proof, without downloading or executing the payload itself. However, removing the requirement to download the execution payload, also removes the implicit data availability (DA) guarantee; a block producer can publish a valid proof and withhold the execution-payload data since attesters no longer need them for consensus.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP introduces Block-in-Blobs (BiB), a mechanism that requires the execution-payload data (transactions and BALs) to be published in blob data, in the same beacon block that carries the corresponding execution payload&#x27;s header. This ensures that execution payloads and their associated data are always published even when validators no longer require them to verify the state transition function (STF).&lt;&#x2F;p&gt;
&lt;p&gt;In short, BiB works by having the block producer encode the execution-payload data into blobs as part of the execution layer&#x27;s STF, requiring the beacon block’s blob KZG commitments to commit to those payload-blobs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;Validation via re-execution&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Today, validators verify execution payloads by:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Downloading the execution payload&lt;&#x2F;li&gt;
&lt;li&gt;Executing the payload locally&lt;&#x2F;li&gt;
&lt;li&gt;Checking the resulting state root and other fields against the fields in the header&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Implicitly this guarantees execution payload availability because the payload cannot be verified unless the node downloads it.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Validation with zkEVMs&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;With zkEVMs, validators instead:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Download a proof attesting to the correctness of the execution payload&lt;&#x2F;li&gt;
&lt;li&gt;Download the execution payload header&lt;&#x2F;li&gt;
&lt;li&gt;Verify the proof with respects to the payload header (and other commitments)&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;In this model, validators no longer require access to the full execution payload data itself in order to verify its correctness.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;The DA problem&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Removing the re-execution requirement in consensus removes the implicit requirement that consensus clients download the execution payload.&lt;&#x2F;p&gt;
&lt;p&gt;A malicious or rational builder could:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Publish a valid proof for a valid execution payload&lt;&#x2F;li&gt;
&lt;li&gt;Withhold the execution-payload data entirely&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;Builders&lt;&#x2F;em&gt;: Since builders will always need to re-execute in order to build blocks, a malicious builder would not publish the execution payload ensuring that they are the only ones that can build on top of the current chain.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;RPC and indexers&lt;&#x2F;em&gt;: Many nodes such as RPC providers and indexers cannot solely rely on execution proofs and must re-execute the execution payload.&lt;&#x2F;p&gt;
&lt;p&gt;BiB addresses this by making the execution payload available via blobs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;terminology&quot;&gt;Terminology&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;Type-3 transaction:&lt;&#x2F;strong&gt; Refers to EIP-4844 blob-carrying transactions (transaction type 0x03). These transactions include blob versioned hashes that commit to blobs carrying user data.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;overview-and-invariants&quot;&gt;Overview and Invariants&lt;&#x2F;h3&gt;
&lt;p&gt;BiB ensures the proven payload is published:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The beacon block references a list of blob KZG commitments (via 4844&#x2F;PeerDas)&lt;&#x2F;li&gt;
&lt;li&gt;A prefix of those commitments is reserved for the execution-payload data encoded into blobs&lt;&#x2F;li&gt;
&lt;li&gt;A zkEVM proof for the block must bind the proven execution payload to those prefixed blob commitments.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Payload availability invariant:&lt;&#x2F;strong&gt; A valid block implies there exists an ordered list of blobs whose bytes decode to the canonical execution-payload data, and the KZG commitments for these blobs match the first &lt;code&gt;payload_blob_count&lt;&#x2F;code&gt; blob commitments referenced by the block. The existing DAS mechanism will ensure that those blobs are available.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;referenced-parameters&quot;&gt;Referenced Parameters&lt;&#x2F;h4&gt;
&lt;p&gt;These parameters are defined in EIP-4844 and related specs:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Source&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FIELD_ELEMENTS_PER_BLOB&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;4096&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;EIP-4844&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;BYTES_PER_FIELD_ELEMENT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;32&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;EIP-4844&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;GAS_PER_BLOB&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2**17&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;EIP-4844&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_BLOBS_PER_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Network-specific&lt;&#x2F;td&gt;&lt;td&gt;EIP-7892&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;&lt;strong&gt;Note on &lt;code&gt;MAX_BLOBS_PER_BLOCK&lt;&#x2F;code&gt;:&lt;&#x2F;strong&gt; This constant represents the maximum number of blobs (both payload-blobs and type-3 transaction blobs) that can be included in a block. Per EIP-7892, the execution layer&#x27;s &lt;code&gt;blobSchedule.max&lt;&#x2F;code&gt; MUST equal the consensus layer&#x27;s &lt;code&gt;MAX_BLOBS_PER_BLOCK&lt;&#x2F;code&gt; configuration value at any given time. This value may change across forks (e.g., initially 6 in EIP-4844, potentially increased in subsequent blob throughput increase proposals).&lt;&#x2F;p&gt;
&lt;h4 id=&quot;derived-constants&quot;&gt;Derived Constants&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;USABLE_BYTES_PER_FIELD_ELEMENT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;BYTES_PER_FIELD_ELEMENT - 1&lt;&#x2F;code&gt; (31)&lt;&#x2F;td&gt;&lt;td&gt;Usable bytes per field element (final byte must be zero to stay under BLS modulus)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;USABLE_BYTES_PER_BLOB&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;FIELD_ELEMENTS_PER_BLOB * USABLE_BYTES_PER_FIELD_ELEMENT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Total usable bytes per blob&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;execution-layer&quot;&gt;Execution Layer&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;Summary:&lt;&#x2F;strong&gt; The execution layer is modified in the following ways:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The ExecutionPayloadHeader now has a &lt;code&gt;payload_blob_count&lt;&#x2F;code&gt; field to track how many blobs are used for the execution payload data, enabling verification of the correct number of payload-blobs at the Engine API boundary.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;engine_getPayload&lt;&#x2F;code&gt; computes the payload-blobs when building a block, sets &lt;code&gt;payload_blob_count&lt;&#x2F;code&gt; in the ExecutionPayloadHeader, and returns the payload blobs (with their commitments and proofs) alongside type-3 transaction blobs in the response.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;engine_newPayload&lt;&#x2F;code&gt; takes the ExecutionPayload and before passing it to the EL STF, it computes the payload-blobs, checks that the amount of blobs needed is equal to the &lt;code&gt;payload_blob_count&lt;&#x2F;code&gt; value in the ExecutionPayloadHeader and verifies that the expected version hashes match.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;referenced-helpers&quot;&gt;Referenced Helpers&lt;&#x2F;h4&gt;
&lt;p&gt;The execution layer uses methods and classes defined in the corresponding consensus 4844&#x2F;7594 specs.&lt;&#x2F;p&gt;
&lt;p&gt;Specifically, we use the following methods from &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;46c1199d6b4584ba484dec807f03b8e6211dd725&#x2F;specs&#x2F;deneb&#x2F;polynomial-commitments.md?#introduction&quot;&gt;polynomial-commitments.md&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;46c1199d6b4584ba484dec807f03b8e6211dd725&#x2F;specs&#x2F;deneb&#x2F;polynomial-commitments.md#L578&quot;&gt;verify_blob_kzg_proof_batch&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;86fb82b221474cc89387fa6436806507b3849d88&#x2F;specs&#x2F;deneb&#x2F;polynomial-commitments.md#blob_to_kzg_commitment&quot;&gt;blob_to_kzg_commitment&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;86fb82b221474cc89387fa6436806507b3849d88&#x2F;specs&#x2F;deneb&#x2F;polynomial-commitments.md#compute_blob_kzg_proof&quot;&gt;compute_blob_kzg_proof&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;And the following methods from &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;2938e1ad74cea54f1a24508a85704d5bd87837ad&#x2F;specs&#x2F;fulu&#x2F;polynomial-commitments-sampling.md&quot;&gt;polynomial-commitments-sampling.md&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;2938e1ad74cea54f1a24508a85704d5bd87837ad&#x2F;specs&#x2F;fulu&#x2F;polynomial-commitments-sampling.md#compute_cells_and_kzg_proofs&quot;&gt;compute_cells_and_kzg_proofs&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;And the following methods from &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;86fb82b221474cc89387fa6436806507b3849d88&#x2F;specs&#x2F;deneb&#x2F;beacon-chain.md#introduction&quot;&gt;beacon-chain.md&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;86fb82b221474cc89387fa6436806507b3849d88&#x2F;specs&#x2F;deneb&#x2F;beacon-chain.md#kzg_commitment_to_versioned_hash&quot;&gt;kzg_commitment_to_versioned_hash&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;helpers&quot;&gt;Helpers&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;bytes-to-blobs&quot;&gt;bytes_to_blobs&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; bytes_to_blobs&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Blob&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Pack arbitrary bytes into one or more blobs.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Remaining space in final blob is zero-padded.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    blobs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    offset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    while&lt;&#x2F;span&gt;&lt;span&gt; offset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        chunk&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;offset&lt;&#x2F;span&gt;&lt;span&gt; :&lt;&#x2F;span&gt;&lt;span&gt; offset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; USABLE_BYTES_PER_BLOB&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        blob&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; chunk_to_blob&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;chunk&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        blobs&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;blob&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        offset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; USABLE_BYTES_PER_BLOB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; blobs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; chunk_to_blob&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Blob&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Pack up to USABLE_BYTES_PER_BLOB bytes into a single blob.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    If data is shorter than USABLE_BYTES_PER_BLOB, it is zero-padded.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Each 31-byte chunk is stored in bytes [0:31] of a field element,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    with byte [31] (the final byte) set to zero to ensure value &amp;lt; BLS modulus.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; USABLE_BYTES_PER_BLOB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Pad to exactly USABLE_BYTES_PER_BLOB if needed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; USABLE_BYTES_PER_BLOB&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;USABLE_BYTES_PER_BLOB&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    blob&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytearray&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;FIELD_ELEMENTS_PER_BLOB&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BYTES_PER_FIELD_ELEMENT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;FIELD_ELEMENTS_PER_BLOB&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        chunk_start&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; USABLE_BYTES_PER_FIELD_ELEMENT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        chunk&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;chunk_start&lt;&#x2F;span&gt;&lt;span&gt; :&lt;&#x2F;span&gt;&lt;span&gt; chunk_start&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; USABLE_BYTES_PER_FIELD_ELEMENT&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Store 31 data bytes in [0:31], the final byte [31] stays zero&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        blob&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BYTES_PER_FIELD_ELEMENT&lt;&#x2F;span&gt;&lt;span&gt; :&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BYTES_PER_FIELD_ELEMENT&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; USABLE_BYTES_PER_FIELD_ELEMENT&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; chunk&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; Blob&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;blob&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;blobs-to-bytes&quot;&gt;blobs_to_bytes&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; blobs_to_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;blobs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Blob&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Unpack blobs back to bytes.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Returns all usable bytes from all blobs (including any padding).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    raw&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytearray&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; blob&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; blobs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        raw&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;extend&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;blob_to_chunk&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;blob&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;raw&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; blob_to_chunk&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;blob&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Blob&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Extract the 31 usable bytes from each field element.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Validates that the final byte is zero for each field element.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    result&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytearray&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;FIELD_ELEMENTS_PER_BLOB&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Validate final byte is zero&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span&gt; blob&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BYTES_PER_FIELD_ELEMENT&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; USABLE_BYTES_PER_FIELD_ELEMENT&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;00&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Invalid blob: final byte must be zero&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Extract usable data bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        result&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;extend&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;blob&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BYTES_PER_FIELD_ELEMENT&lt;&#x2F;span&gt;&lt;span&gt; :&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BYTES_PER_FIELD_ELEMENT&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; USABLE_BYTES_PER_FIELD_ELEMENT&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;get-execution-payload-data&quot;&gt;get_execution_payload_data&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_execution_payload_data&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionPayload&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; ExecutionPayloadData&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Extract the data from an ExecutionPayload that must be made available via blobs.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; ExecutionPayloadData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        blockAccessList&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;blockAccessList&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        transactions&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;transactions&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;execution-payload-data-to-blobs&quot;&gt;execution_payload_data_to_blobs&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; execution_payload_data_to_blobs&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionPayloadData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Blob&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Canonically encode the execution-payload data into an ordered list of blobs.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Encoding steps:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;      1. bal_bytes = data.blockAccessList&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;      2. transactions_bytes = RLP.encode(data.transactions)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;      3. Create 10-byte header: [2 bytes version][4 bytes BAL length][4 bytes tx length]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;      4. payload_bytes = header + bal_bytes + transactions_bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;      5. return bytes_to_blobs(payload_bytes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    The first blob will contain (in order):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;      - [2 bytes] Payload encoding version (currently 0)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;      - [4 bytes] BAL data length&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;      - [4 bytes] Transaction data length&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;      - [variable] BAL data (may span multiple blobs)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;      - [variable] Transaction data (may span multiple blobs)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    This allows extracting just the BAL data without transactions.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Note: blockAccessList is already RLP-encoded per EIP-7928. Transactions are RLP-encoded as a list.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bal_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;blockAccessList&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    transactions_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; RLP&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;transactions&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Create 10-byte header: [2 bytes version][4 bytes BAL length][4 bytes tx length]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    version&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;to_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;little&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bal_length&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;bal_bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;to_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;little&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    txs_length&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;transactions_bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;to_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;little&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    header&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; version&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; bal_length&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; txs_length&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Combine header + data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; header&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; bal_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; transactions_bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; bytes_to_blobs&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;payload_bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;blobs-to-execution-payload-data&quot;&gt;blobs_to_execution_payload_data&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; blobs_to_execution_payload_data&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;blobs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Blob&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; ExecutionPayloadData&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Canonically decode an ordered list of blobs into execution-payload data.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Decoding steps:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;      1. raw = blobs_to_bytes(blobs)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;      2. Read 10-byte header: [2 bytes version][4 bytes BAL length][4 bytes tx length]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;      3. Validate version is 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;      4. Split into bal_bytes and transactions_bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;      5. return ExecutionPayloadData(blockAccessList, transactions)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Extract raw bytes from blobs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    raw&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; blobs_to_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;blobs&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Read 10-byte header&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    version&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;raw&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;little&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; version&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Unsupported payload encoding version: &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;{&lt;&#x2F;span&gt;&lt;span&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bal_length&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;raw&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;6&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;little&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    txs_length&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;raw&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;6&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;little&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Extract data portions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bal_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; raw&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10&lt;&#x2F;span&gt;&lt;span&gt; :&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; bal_length&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    transactions_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; raw&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; bal_length&lt;&#x2F;span&gt;&lt;span&gt; :&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; bal_length&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; txs_length&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Decode transactions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    transactions&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; RLP&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;decode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;transactions_bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; ExecutionPayloadData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;blockAccessList&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;bal_bytes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; transactions&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;transactions&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;extract-data-from-type-3-tx&quot;&gt;extract_data_from_type_3_tx&lt;&#x2F;h5&gt;
&lt;p&gt;This method will be used to implement the modified logic in engine_getPayload.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; extract_data_from_type_3_tx&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;transactions&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Transaction&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Tuple&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Blob&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;KZGCommitment&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;KZGProof&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Extract blobs, KZG commitments, and cell proofs from type-3 (blob) transactions.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Returns a tuple of (blobs, commitments, cell_proofs) in the order they appear&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    in the transaction list.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Implementation note: This is not new logic - a function(s) like this should already be available in your existing getPayload&#x2F;blob bundle implementation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Invertibility invariant:&lt;&#x2F;strong&gt; &lt;code&gt;execution_payload_data_to_blobs&lt;&#x2F;code&gt; and &lt;code&gt;blobs_to_execution_payload_data&lt;&#x2F;code&gt; are mutual inverses on valid execution-payload data.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;data-structures&quot;&gt;Data structures&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;executionpayloaddata&quot;&gt;ExecutionPayloadData&lt;&#x2F;h5&gt;
&lt;p&gt;&lt;strong&gt;Execution-payload data&lt;&#x2F;strong&gt; refers to the subset of the ExecutionPayload that must be made available via blobs. This includes:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;bals&lt;&#x2F;code&gt; (Block Access List added in EIP-7928)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;transactions&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8142&#x2F;#what-is-included-in-execution-payload-data&quot;&gt;What is included in execution-payload data?&lt;&#x2F;a&gt; in the Rationale for details.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ExecutionPayloadData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Block Access List (BAL) from EIP-7928, RLP-encoded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    blockAccessList&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; List of transactions, each transaction is RLP-encoded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    transactions&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Transaction&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_TRANSACTIONS_PER_PAYLOAD&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;&#x2F;strong&gt; This is not an SSZ Container - fields are RLP-encoded as described in the encoding functions. The &lt;code&gt;MAX_TRANSACTIONS_PER_PAYLOAD&lt;&#x2F;code&gt; bound is inherited from the ExecutionPayload field limit defined in the consensus specification.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;executionpayloadheader&quot;&gt;ExecutionPayloadHeader&lt;&#x2F;h5&gt;
&lt;p&gt;This EIP adds a new field to the &lt;code&gt;ExecutionPayloadHeader&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;payload_blob_count : uint64&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Semantics:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Let &lt;code&gt;blob_kzg_commitments&lt;&#x2F;code&gt; be the ordered list of kzg commitments referenced by the beacon block&lt;&#x2F;li&gt;
&lt;li&gt;The first &lt;code&gt;payload_blob_count&lt;&#x2F;code&gt; entries of &lt;code&gt;blob_kzg_commitments&lt;&#x2F;code&gt; are the payload-blob commitments (i.e. commitments to the blobs that correspond to the payload data)&lt;&#x2F;li&gt;
&lt;li&gt;The remaining entries (if any) are for type-3 blob transactions.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;blobsbundle&quot;&gt;BlobsBundle&lt;&#x2F;h5&gt;
&lt;p&gt;For the zkEVM-optimized variant of &lt;code&gt;engine_getPayload&lt;&#x2F;code&gt;, this EIP extends &lt;code&gt;BlobsBundle&lt;&#x2F;code&gt; with an additional field:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;payload_kzg_proofs&lt;&#x2F;code&gt;: List[KZGProof]&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Semantics:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Contains random point KZG proofs for payload blobs only (not type-3 transaction blobs)&lt;&#x2F;li&gt;
&lt;li&gt;Used as private inputs to the zkEVM circuit for payload consistency verification via &lt;code&gt;verify_blob_kzg_proof_batch&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;The length of this list equals &lt;code&gt;payload_blob_count&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;engine-api&quot;&gt;Engine API&lt;&#x2F;h4&gt;
&lt;p&gt;This section specifies two equivalent formulations of &lt;code&gt;new_payload&lt;&#x2F;code&gt;. Implementers choose one based on their execution context:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Native execution variant&lt;&#x2F;strong&gt;: Uses &lt;code&gt;blob_to_kzg_commitment&lt;&#x2F;code&gt; directly. Suitable for pre mandatory proofs implementations.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;zkEVM-optimized variant&lt;&#x2F;strong&gt;: Uses polynomial openings via &lt;code&gt;verify_blob_kzg_proof_batch&lt;&#x2F;code&gt;. Avoids the multiscalar multiplication (MSM) which is expensive to prove in a zkEVM circuit.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Both variants enforce identical validity conditions. A block valid under one is valid under the other.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;engine-getpayload-native-variant&quot;&gt;engine_getPayload - Native Variant&lt;&#x2F;h5&gt;
&lt;p&gt;The builder must compute the payload blob count when constructing the block:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_payload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;payload_id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; PayloadId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; GetPayloadResponse&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 1. Build the block (select transactions, etc.)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; build_execution_payload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;payload_id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 2. Compute payload blobs to determine count&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_execution_payload_data&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_blobs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; execution_payload_data_to_blobs&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;payload_data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_blob_count&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;payload_blobs&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 4. Set the count in the header&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;payload_blob_count&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; payload_blob_count&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 5. Compute blob commitments and cell proofs for payload blobs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_commitments&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;blob_to_kzg_commitment&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;b&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; payload_blobs&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_versioned_hashes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;kzg_commitment_to_versioned_hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;c&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; payload_commitments&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Compute cells and cell proofs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_cells_and_proofs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;compute_cells_and_kzg_proofs&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;b&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; payload_blobs&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_cell_proofs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;proofs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; _&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; proofs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; payload_cells_and_proofs&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 6. Extract type-3 transaction blobs, commitments, and cell proofs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    type3_blobs&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type3_commitments&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type3_cell_proofs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; extract_data_from_type_3_tx&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;transactions&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    type3_versioned_hashes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;transactions&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BLOB_TX_TYPE&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            type3_versioned_hashes&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;extend&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;blob_versioned_hashes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 7. Combine: payload blobs first, then type-3 blobs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    all_blobs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; payload_blobs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; type3_blobs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    all_commitments&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; payload_commitments&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; type3_commitments&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    all_cell_proofs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; payload_cell_proofs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; type3_cell_proofs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    all_blob_versioned_hashes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; payload_versioned_hashes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; type3_versioned_hashes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; GetPayloadResponse&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        execution_payload&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        blobs_bundle&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;BlobsBundle&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            commitments&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;all_commitments&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            blobs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;all_blobs&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            proofs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;all_cell_proofs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        block_value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;calculate_block_value&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note: The builder must account for payload blob usage when selecting type-3 transactions to ensure the total blob count does not exceed &lt;code&gt;MAX_BLOBS_PER_BLOCK&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;engine-getpayload-zkevm-optimized-variant&quot;&gt;engine_getPayload - zkEVM-Optimized Variant&lt;&#x2F;h5&gt;
&lt;p&gt;For the zkEVM-optimized variant, the builder must additionally compute random point KZG proofs for the payload blobs, which will be used as private inputs in the zkEVM circuit for payload consistency verification.&lt;&#x2F;p&gt;
&lt;p&gt;This variant extends &lt;code&gt;BlobsBundle&lt;&#x2F;code&gt; with an additional &lt;code&gt;payload_kzg_proofs&lt;&#x2F;code&gt; field containing random point KZG proofs for payload blobs.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_payload_zk&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;payload_id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; PayloadId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; GetPayloadResponse&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 1. Build the block (select transactions, etc.)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; build_execution_payload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;payload_id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 2. Compute payload blobs to determine count&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_execution_payload_data&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_blobs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; execution_payload_data_to_blobs&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;payload_data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_blob_count&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;payload_blobs&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 4. Set the count in the header&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;payload_blob_count&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; payload_blob_count&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 5. Compute commitments, cell proofs, and random point proofs for payload blobs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_commitments&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;blob_to_kzg_commitment&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;b&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; payload_blobs&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_versioned_hashes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;kzg_commitment_to_versioned_hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;c&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; payload_commitments&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Cell proofs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_cells_and_proofs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;compute_cells_and_kzg_proofs&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;b&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; payload_blobs&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_cell_proofs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;proofs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; _&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; proofs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; payload_cells_and_proofs&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Random point proofs for payload consistency verification&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_random_point_proofs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;compute_blob_kzg_proof&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;b&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; c&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; b&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; zip&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;payload_blobs&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; payload_commitments&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 6. Extract type-3 transaction blobs, commitments, and cell proofs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    type3_blobs&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type3_commitments&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type3_cell_proofs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; extract_data_from_type_3_tx&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;transactions&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    type3_versioned_hashes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;transactions&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BLOB_TX_TYPE&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            type3_versioned_hashes&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;extend&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;blob_versioned_hashes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 7. Combine: payload blobs first, then type-3 blobs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    all_blobs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; payload_blobs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; type3_blobs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    all_commitments&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; payload_commitments&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; type3_commitments&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    all_cell_proofs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; payload_cell_proofs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; type3_cell_proofs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; GetPayloadResponse&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        execution_payload&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        blobs_bundle&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;BlobsBundle&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            commitments&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;all_commitments&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            blobs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;all_blobs&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            proofs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;all_cell_proofs&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            payload_kzg_proofs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;payload_random_point_proofs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        block_value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;calculate_block_value&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Note for implementors:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;payload_kzg_proofs&lt;&#x2F;code&gt; field contains KZG opening proofs for payload blobs only. It is used for payload consistency verification via &lt;code&gt;verify_blob_kzg_proof_batch&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The builder&#x2F;prover should extract the first &lt;code&gt;payload_blob_count&lt;&#x2F;code&gt; commitments from &lt;code&gt;all_commitments&lt;&#x2F;code&gt; (i.e., &lt;code&gt;all_commitments[:payload_blob_count]&lt;&#x2F;code&gt;). This corresponds to the &lt;code&gt;payload_kzg_commitments&lt;&#x2F;code&gt; parameter in the zkEVM variant of &lt;code&gt;engine_newPayload&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;engine-newpayload-native-execution-variant&quot;&gt;engine_newPayload - Native Execution Variant&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; new_payload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;    payload&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;    expected_blob_versioned_hashes&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;VersionedHash&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; PayloadStatus&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 1. Derive payload blobs and commitments&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_execution_payload_data&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_blobs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; execution_payload_data_to_blobs&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;payload_data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_blob_count&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;payload_blobs&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_commitments&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;blob_to_kzg_commitment&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;b&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; payload_blobs&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_versioned_hashes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;kzg_commitment_to_versioned_hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;c&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; payload_commitments&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 2. Verify payload_blob_count matches header&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; payload_blob_count&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;payload_blob_count&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 3. Extract type-3 tx versioned hashes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    type3_versioned_hashes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;transactions&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BLOB_TX_TYPE&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            type3_versioned_hashes&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;extend&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;blob_versioned_hashes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 4. Verify versioned hashes: payload blobs first, then type-3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; expected_blob_versioned_hashes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; payload_versioned_hashes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; type3_versioned_hashes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 5. Run EL STF&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; execute_payload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;engine-newpayload-zkevm-optimized-variant&quot;&gt;engine_newPayload - zkEVM-Optimized Variant&lt;&#x2F;h5&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;&#x2F;strong&gt; Once zkEVM proofs are required for consensus, &lt;code&gt;newPayload&lt;&#x2F;code&gt; will be executed inside a zkEVM to generate a proof, rather than being executed natively by validators. This variant is designed to be cheaper in that context.&lt;&#x2F;p&gt;
&lt;p&gt;This variant replaces the MSM in &lt;code&gt;blob_to_kzg_commitment&lt;&#x2F;code&gt; with polynomial opening proofs, which are cheaper to verify inside a zkEVM. The payload, commitments and KZG proofs are private inputs to the zkEVM circuit, while the corresponding versioned hashes (and payload header) are public inputs.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; new_payload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;    payload&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;    expected_blob_versioned_hashes&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;VersionedHash&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; public input&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; BiB additions: prefix metadata for payload blobs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;    payload_kzg_commitments&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;KZGCommitment&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; private input&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;    payload_kzg_proofs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;KZGProof&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; private input&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; PayloadStatus&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0. Declared payload blob count from the header&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;payload_blob_count&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;payload_kzg_commitments&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; n&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;payload_kzg_proofs&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; n&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 1. Construct payload blobs from execution-payload data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_execution_payload_data&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_blobs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; execution_payload_data_to_blobs&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;payload_data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;payload_blobs&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; n&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 2. Check the commitments correspond to the expected versioned hash prefix&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_versioned_hashes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        kzg_commitment_to_versioned_hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;c&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; payload_kzg_commitments&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; expected_blob_versioned_hashes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;n&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; payload_versioned_hashes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 3. Verify blob–commitment consistency using batch KZG proof verification&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; verify_blob_kzg_proof_batch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        blobs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;payload_blobs&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        commitments&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;payload_kzg_commitments&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        proofs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;payload_kzg_proofs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 4. Proceed with standard EL payload validation &#x2F; execution&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; execute_payload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;consensus-layer&quot;&gt;Consensus Layer&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;validation&quot;&gt;Validation&lt;&#x2F;h4&gt;
&lt;p&gt;The consensus layer does not introduce new blob specific validation rules for payload-blobs beyond what we have for EIP-4844&#x2F;EIP-7594.&lt;&#x2F;p&gt;
&lt;p&gt;The Consensus Layer relies on &lt;code&gt;payload_blob_count&lt;&#x2F;code&gt; in the ExecutionPayloadHeader to interpret the ordering of blob commitments, but otherwise treats payload blobs identically to other blobs for availability and networking.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;networking&quot;&gt;Networking&lt;&#x2F;h3&gt;
&lt;p&gt;BiB reuses the existing blob networking mechanism.&lt;&#x2F;p&gt;
&lt;p&gt;We note the following for consideration:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Once proofs are made mandatory, a mechanism will be needed for execution payload retrieval.  &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7732&#x2F;&quot;&gt;EIP-7732&lt;&#x2F;a&gt; introduces an &lt;code&gt;execution_payload&lt;&#x2F;code&gt; gossip topic that we can use for this purpose. However, in the context of mandatory proofs where a super majority of stake operates zk validators (which only listen to header topics), a malicious builder could publish only the payload in blobs and gossip the execution payload header without gossiping on the &lt;code&gt;execution_payload&lt;&#x2F;code&gt; topic. This would allow zk validators to attest, but other nodes depending on the full payload from the gossip topic would be unable to progress.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;To mitigate this, nodes can implement a fallback mechanism: if they don&#x27;t receive the payload on the &lt;code&gt;execution_payload&lt;&#x2F;code&gt; topic, they reconstruct it from the first &lt;code&gt;payload_blob_count&lt;&#x2F;code&gt; blobs and then seed the &lt;code&gt;execution_payload&lt;&#x2F;code&gt; topic themselves. This creates a resilient system where every node acts as a &quot;bridge node&quot; when needed, similar to how rollups use L2 gossip as a fast path but fall back to L1 data availability.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Unlike most type-3 blob transactions, payload-blobs will not have been propagated to the network before a block is built. Depending on the deadlines imposed by ePBS, this may imply higher bandwidth requirements from block builders.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;fee-accounting&quot;&gt;Fee Accounting&lt;&#x2F;h3&gt;
&lt;p&gt;BiB introduces protocol mandated blob usage, rather than user initiated via type-3 transactions. Fee accounting for payload-blobs differ in nature from transaction blob fees as a result.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;who-pays&quot;&gt;Who pays?&lt;&#x2F;h4&gt;
&lt;p&gt;This EIP does not mandate that payload-blobs pay a per-blob fee like transaction blobs.&lt;&#x2F;p&gt;
&lt;p&gt;Instead payload-blobs are treated as a protocol-accepted cost when constructing the block. In particular:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Payload-blobs do not correspond to a user transaction and therefore do not naturally map to a user-paid blob fee.&lt;&#x2F;li&gt;
&lt;li&gt;The cost of including payload-blobs, in terms of blob gas usage, is accepted by the protocol as a necessary cost for maintaining data availability.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;do-payload-blobs-compete-with-transaction-blobs-for-capacity&quot;&gt;Do payload-blobs compete with transaction blobs for capacity?&lt;&#x2F;h4&gt;
&lt;p&gt;Because payload blobs consume blob gas, they directly influence blob congestion and the blob base fee.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;can-a-builder-artificially-inflate-blob-gas-usage&quot;&gt;Can a builder artificially inflate blob gas usage?&lt;&#x2F;h4&gt;
&lt;p&gt;A potential concern is whether a malicious builder could create artificially large execution payloads to inflate blob gas usage.&lt;&#x2F;p&gt;
&lt;p&gt;This attack is economically constrained: to increase the size of the execution payload, a builder must include additional transactions with calldata. Since calldata costs execution gas, the builder would need to pay for this additional data through the normal gas mechanism. The cost of including extra calldata makes it economically unfavorable to artificially inflate payload size solely to manipulate blob fees.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;open-questions-and-future-considerations&quot;&gt;Open questions and future considerations&lt;&#x2F;h4&gt;
&lt;!-- TODO --&gt;
&lt;ul&gt;
&lt;li&gt;Networking related: Payload-blobs require higher bandwidth due to the fact that they will not have been in the public mempool&lt;&#x2F;li&gt;
&lt;li&gt;Explicit protocol level pricing for payload blobs&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;what-is-included-in-execution-payload-data&quot;&gt;What is included in execution-payload data?&lt;&#x2F;h3&gt;
&lt;p&gt;Execution-payload data includes &lt;code&gt;bals&lt;&#x2F;code&gt; (Block Access Lists from EIP-7928) and &lt;code&gt;transactions&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Why transactions?&lt;&#x2F;strong&gt; Transaction data is the only component of the execution payload that cannot be derived from other components and is not provided by the consensus layer.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Why BALs?&lt;&#x2F;strong&gt; While BALs are technically the output of executing transactions and could be recomputed, once zkEVM proofs become mandatory for consensus, validators no longer execute payloads. A malicious builder could publish a valid proof and withhold both the execution payload data and the BALs. This would prevent other builders from constructing subsequent blocks and prevent RPC providers from serving the full state. Including BALs in payload-blobs ensures they remain available.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Why not withdrawals?&lt;&#x2F;strong&gt; Withdrawals can be derived on the consensus layer.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Why not execution requests?&lt;&#x2F;strong&gt; Execution requests can be recomputed from transactions and do not suffer from the same withholding attack as BALs because they are required by the consensus layer for validation.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Why not the header?&lt;&#x2F;strong&gt; The header cannot be put into blobs because it contains &lt;code&gt;payload_blob_count&lt;&#x2F;code&gt;, which depends on the number of blobs; causing a circular dependency.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Encoding optimization:&lt;&#x2F;strong&gt; The encoding includes an 8-byte header: &lt;code&gt;[4 bytes BAL length] [4 bytes transaction length]&lt;&#x2F;code&gt;. This allows extracting just the tx data after fetching the first blob.&lt;&#x2F;p&gt;
&lt;!-- TODO --&gt;
&lt;p&gt;TODO: We could also put the number of blobs that the BAL occupies in the execution payload header.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;builder-discretion-vs-reserving-k-blobs&quot;&gt;Builder discretion vs reserving &lt;code&gt;k&lt;&#x2F;code&gt; blobs&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP specifies that the block builder choose &lt;code&gt;payload_blob_count&lt;&#x2F;code&gt;, subject to the constraint imposed by &lt;code&gt;MAX_BLOBS_PER_BLOCK&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;An alternative would have been to always reserve &lt;code&gt;k&lt;&#x2F;code&gt; blobs, where &lt;code&gt;k&lt;&#x2F;code&gt; corresponds to the worst case execution payload size. While this provides better predictability, it reduces flexibility under blob congestion.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-not-encode-execution-payload-data-inside-the-core-el-execution-logic&quot;&gt;Why not encode execution-payload data inside the core EL execution logic?&lt;&#x2F;h3&gt;
&lt;p&gt;Doing it in the EL STF would require payload-blob commitments or versioned hashes to be made visible inside the core execution logic, rather than being handled at the Engine API boundary.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;when-zkevm-proofs-become-mandatory-why-can-t-zk-attestors-download-the-full-execution-payload&quot;&gt;When zkEVM proofs become mandatory, why can&#x27;t zk-attestors download the full execution payload?&lt;&#x2F;h3&gt;
&lt;p&gt;The execution payload grows linearly with the gas limit. Requiring attesters to download the payload for DA would create an increasing bandwidth burden as the gas limit grows.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;compression-algorithm-for-encoding-execution-payload-data&quot;&gt;Compression algorithm for encoding execution-payload data&lt;&#x2F;h3&gt;
&lt;p&gt;Compression can be used on the serialized execution-payload data. This (in theory) should allow the usage of less payload-blobs, depending on the compression ratio. The tradeoffs being:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;That we will use more CPU&#x2F;proving cycles for decompression&lt;&#x2F;li&gt;
&lt;li&gt;A breaking change since we want to decompress on the hot-path. What this means is that the transactions would need to be compressed in the payload, and then decompressed when we attempt to validate it.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Whether we should use a compression algorithm and which one requires more investigation, in particular we need to investigate:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The average compression ratios achieved&lt;&#x2F;li&gt;
&lt;li&gt;The proving cycle overhead&lt;&#x2F;li&gt;
&lt;li&gt;The invasiveness of now requiring consensus aware objects to be compressed when passed for validation.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;For now we recommend using no compression algorithm and operating on uncompressed data.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;serialization-algorithm-for-encoding-execution-payload-data&quot;&gt;Serialization algorithm for encoding execution-payload data&lt;&#x2F;h3&gt;
&lt;p&gt;Serialization of the execution-payload data uses RLP. Since transactions in the ExecutionPayload are already RLP-encoded, we simply RLP-encode the list of transaction bytes without any additional transformation.&lt;&#x2F;p&gt;
&lt;p&gt;While a more zk-friendly serialization algorithm could be beneficial in the future, this EIP uses RLP for simplicity. Once EIP-7807 (SSZ execution blocks) is implemented, the encoding can be updated to SSZ-serialize the list of SSZ-encoded transaction bytes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This requires changes to the execution payload header and the EL STF; so requires a fork. Nodes that do not implement BiB will not be able to validate blocks after activation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;!-- TODO --&gt;
&lt;p&gt;TODO&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;!-- TODO --&gt;
&lt;p&gt;TODO&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;Interaction with blob congestion and denial-of-service&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Payload-blobs consume blob gas and therefore are subject to the same congestion control mechanisms and blob limits as transaction blobs.&lt;&#x2F;p&gt;
&lt;p&gt;As a byproduct, this ensures that a malicious block producer cannot make arbitrarily large execution payloads without accounting for blob gas limits. While a block producer could theoretically drive up the blob base fee by creating large payloads, this attack is economically constrained by calldata costs (see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8142&#x2F;#fee-accounting&quot;&gt;Fee Accounting&lt;&#x2F;a&gt; for details).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Data withholding&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;An attacker cannot withhold execution payload data without also withholding blob data, which would violate existing DAS guarantees and cause the block to be rejected by the consensus layer.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Temporary Contract Storage</title>
        <published>2026-01-14T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Wei Han Ng</name><uri>https://github.com/weiihann</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8125/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip8125-temporary-contract-storage/27440" />
        

        <id>https://wg-eips.ritovision.com/8125/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:8125"
            label="EIP-8125" />
        

        
        

        
        <summary type="html">Adds bounded-lifetime contract storage via TMPLOAD&#x2F;TMPSTORE opcodes that is automatically cleared on a fixed schedule.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8125/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces &lt;em&gt;temporary storage&lt;&#x2F;em&gt;: a new contract-accessible key-value store that persists across transactions and blocks, but is automatically cleared at a protocol-defined schedule. Two new opcodes are added:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;TMPSTORE(key, value)&lt;&#x2F;code&gt; to write temporary storage for the executing contract.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TMPLOAD(key)&lt;&#x2F;code&gt; to read temporary storage for the executing contract.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Temporary storage is intended for data that does not need indefinite retention, providing a safer alternative to using permanent state for ephemeral data and enabling bounded growth of this class of state.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8125&#x2F;.&#x2F;assets&#x2F;1.png&quot; alt=&quot;&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Figure 1: Over 60% of the storage slots are written once and never accessed again onchain.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Permanent contract storage is costly because it increases long-term node resource requirements (disk, I&#x2F;O, state maintenance). However, many applications write data that is only valuable for a bounded time window.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP provides:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Bounded lifetime semantics&lt;&#x2F;strong&gt; without requiring explicit deletes.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Predictable clearing&lt;&#x2F;strong&gt; that can be relied upon at the application layer.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;A building block&lt;&#x2F;strong&gt; for reducing state growth created by ephemeral use cases.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc2119&quot;&gt;RFC 2119&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc8174&quot;&gt;RFC 8174&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;constants-and-parameters&quot;&gt;Constants and parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FORK_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td&gt;Activation block of this EIP&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TEMP_STORAGE_PERIOD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td&gt;The number of blocks that the temporary storage holds for a given period&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TEMP_STORAGE_SYSTEM_ADDRESS_0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td&gt;First reserved address used to store temporary storage&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TEMP_STORAGE_SYSTEM_ADDRESS_1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td&gt;Second reserved address used to store temporary storage&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TMPLOAD_GAS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td&gt;The gas cost of a warm read at temporary storage slot&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;COLD_TMPLOAD_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td&gt;The gas cost surchage of a cold access at the temporary storage&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TMPSTORE_SET_GAS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td&gt;The gas cost of setting a slot from zero to non-zero at the temporary storage&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TMPSTORE_RESET_GAS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td&gt;The gas cost of changing a non-zero slot to another value at the temporary storage&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;temporary-storage-data-model&quot;&gt;Temporary storage data model&lt;&#x2F;h3&gt;
&lt;p&gt;Temporary storage is backed by &lt;strong&gt;two reserved system accounts&lt;&#x2F;strong&gt; at &lt;code&gt;TEMP_STORAGE_SYSTEM_ADDRESS_0&lt;&#x2F;code&gt; and &lt;code&gt;TEMP_STORAGE_SYSTEM_ADDRESS_1&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The temporary storage keyspace is a mapping of &lt;code&gt;(contract_address, key) -&amp;gt; value&lt;&#x2F;code&gt;, where:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;derived_slot_key = keccak256(contract_address || key)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Temporary storage values are stored in the regular storage tries of the system accounts using &lt;code&gt;derived_slot_key&lt;&#x2F;code&gt; as the slot key.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;periodic-rollover-storage-reset&quot;&gt;Periodic rollover (storage reset)&lt;&#x2F;h3&gt;
&lt;p&gt;Temporary storage is organized into periods, each of length &lt;code&gt;TEMP_STORAGE_PERIOD&lt;&#x2F;code&gt; blocks after activation.&lt;&#x2F;p&gt;
&lt;p&gt;For blocks with &lt;code&gt;block.number &amp;gt;= FORK_BLOCK&lt;&#x2F;code&gt;, define:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;period_index(block_number) = floor((block_number - FORK_BLOCK) &#x2F; TEMP_STORAGE_PERIOD)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Define the current and previous system accounts for a block &lt;code&gt;B&lt;&#x2F;code&gt; (where &lt;code&gt;B.number &amp;gt;= FORK_BLOCK&lt;&#x2F;code&gt;) as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;current_index = period_index(B.number) % 2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;if current_index == 0:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    CURRENT_SYSADDR = TEMP_STORAGE_SYSTEM_ADDRESS_0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    PREVIOUS_SYSADDR = TEMP_STORAGE_SYSTEM_ADDRESS_1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;else if current_index == 1:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    CURRENT_SYSADDR = TEMP_STORAGE_SYSTEM_ADDRESS_1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    PREVIOUS_SYSADDR = TEMP_STORAGE_SYSTEM_ADDRESS_0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;At the first block of each new period, the protocol MUST clear the storage of the system account that becomes the current.&lt;&#x2F;p&gt;
&lt;p&gt;When processing a block &lt;code&gt;B&lt;&#x2F;code&gt; (with parent &lt;code&gt;P&lt;&#x2F;code&gt;) where both are &lt;code&gt;&amp;gt;= FORK_BLOCK&lt;&#x2F;code&gt;, if &lt;code&gt;period_index(B.number) &amp;gt; period_index(P.number)&lt;&#x2F;code&gt;, then before executing transactions in &lt;code&gt;B&lt;&#x2F;code&gt;, the protocol MUST perform:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;CURRENT_SYSADDR.storageRoot = EMPTY_TRIE_ROOT&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;where &lt;code&gt;CURRENT_SYSADDR&lt;&#x2F;code&gt; is computed from &lt;code&gt;B.number&lt;&#x2F;code&gt; as specified above.&lt;&#x2F;p&gt;
&lt;p&gt;No other accounts are modified by the rollover.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Effect:&lt;&#x2F;strong&gt; After rollover, entries written in the immediately previous period remain readable via &lt;code&gt;PREVIOUS_SYSADDR&lt;&#x2F;code&gt; for one additional period, while entries older than one period are removed.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;new-opcodes&quot;&gt;New opcodes&lt;&#x2F;h3&gt;
&lt;p&gt;Add 2 new opcodes as follows:&lt;&#x2F;p&gt;
&lt;h4 id=&quot;tmpload-key&quot;&gt;&lt;code&gt;TMPLOAD(key)&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Compute &lt;code&gt;derived_slot_key&lt;&#x2F;code&gt; from &lt;code&gt;(contract_address, key)&lt;&#x2F;code&gt;. Then load &lt;code&gt;derived_slot_key&lt;&#x2F;code&gt; from &lt;code&gt;CURRENT_SYSADDR&lt;&#x2F;code&gt; first. If it doesn&#x27;t exist (i.e. &lt;code&gt;value == 0&lt;&#x2F;code&gt; ), then load &lt;code&gt;derived_slot_key&lt;&#x2F;code&gt; from &lt;code&gt;PREV_SYSADDR&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;tmpstore-key-value&quot;&gt;&lt;code&gt;TMPSTORE(key,value)&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Compute &lt;code&gt;derived_slot_key&lt;&#x2F;code&gt; from &lt;code&gt;(contract_address, key)&lt;&#x2F;code&gt;. Then:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If &lt;code&gt;value != 0&lt;&#x2F;code&gt;, store in the storage of &lt;code&gt;CURRENT_SYSADDR&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;value == 0&lt;&#x2F;code&gt;, delete slot from both &lt;code&gt;CURRENT_SYSADDR&lt;&#x2F;code&gt; and &lt;code&gt;PREV_SYSADDR&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Rationale:&lt;&#x2F;strong&gt; Because reads fall back from current to previous, clearing only the current store would allow an older previous-period value to be returned. Clearing both ensures &lt;code&gt;TMPSTORE(key,0)&lt;&#x2F;code&gt; makes subsequent &lt;code&gt;TMPLOAD(key)&lt;&#x2F;code&gt; return &lt;code&gt;0&lt;&#x2F;code&gt; (until a new non-zero is written).&lt;&#x2F;p&gt;
&lt;p&gt;The call rules should follow &lt;code&gt;SSTORE&lt;&#x2F;code&gt; and &lt;code&gt;SLOAD&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The gas rules should follow the conventions in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2200&#x2F;&quot;&gt;EIP-2200&lt;&#x2F;a&gt; referencing &lt;code&gt;SSTORE&lt;&#x2F;code&gt; and &lt;code&gt;SLOAD&lt;&#x2F;code&gt;, except that:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The gas costs should be much lower than &lt;code&gt;SSTORE&lt;&#x2F;code&gt; and &lt;code&gt;SLOAD&lt;&#x2F;code&gt;, but higher than &lt;code&gt;TSLOAD&lt;&#x2F;code&gt; and &lt;code&gt;TSTORE&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;No refunds are given for clearing temporary storage&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TMPLOAD&lt;&#x2F;code&gt; MAY perform up to 2 storage reads (current then previous). Gas MUST account for this behaviour.&lt;&#x2F;li&gt;
&lt;li&gt;Deletion in &lt;code&gt;TMPSTORE&lt;&#x2F;code&gt; is more expensive than creation&#x2F;modification as the storage root of both system accounts are updated. Gas MUST account for this behaviour.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;activation-and-reserved-address&quot;&gt;Activation and reserved address&lt;&#x2F;h3&gt;
&lt;p&gt;At &lt;code&gt;FORK_BLOCK&lt;&#x2F;code&gt;, the chain MUST treat &lt;code&gt;TEMP_STORAGE_SYSTEM_ADDRESS_0&lt;&#x2F;code&gt; and &lt;code&gt;TEMP_STORAGE_SYSTEM_ADDRESS_1&lt;&#x2F;code&gt; as reserved addresses:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If either does not exist in the state trie, it is created with:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;nonce = 1&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;balance = 0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;codeHash = EMPTY_CODE_HASH&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;storageRoot = EMPTY_TRIE_ROOT&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;No contract code is deployed at this address.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-not-just-use-transient-storage-eip-1153&quot;&gt;Why not just use transient storage (EIP-1153)?&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1153&#x2F;&quot;&gt;EIP-1153&lt;&#x2F;a&gt; (transient storage) is discarded after every transaction, which is ideal for intra-tx operations. This EIP targets a different class of use cases where data must persist across multiple transactions&#x2F;blocks, but does not need indefinite retention.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-two-period-rollover&quot;&gt;Why two-period rollover?&lt;&#x2F;h3&gt;
&lt;p&gt;Two-period rollover provides a stronger usability guarantee:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;An entry is retained for &lt;strong&gt;at least&lt;&#x2F;strong&gt; one full &lt;code&gt;TEMP_STORAGE_PERIOD&lt;&#x2F;code&gt; after it is written (it will be readable in the next period via the previous-period system account).&lt;&#x2F;li&gt;
&lt;li&gt;An entry is retained for &lt;strong&gt;at most&lt;&#x2F;strong&gt; two periods (once the current-period system account is cleared and reused).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This provides a simple mental model for contract developers. That is, if an entry is stored in temporary storage, it will at least last for &lt;code&gt;TEMP_STORAGE_PERIOD&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;In contrast, a single global rollover makes effective lifetime depend on when data is written within the period: a write near the end of a period could be cleared almost immediately, which may not be developer-friendly.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-two-system-accounts&quot;&gt;Why two system accounts?&lt;&#x2F;h3&gt;
&lt;p&gt;Using two reserved system accounts allows constant-time rollover:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;At each period boundary, only the &lt;strong&gt;current-period&lt;&#x2F;strong&gt; system account is reset by setting a single &lt;code&gt;storageRoot = EMPTY_TRIE_ROOT&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The previous-period system account remains intact for one more period.&lt;&#x2F;li&gt;
&lt;li&gt;Storage older than one period becomes unreachable and can be pruned.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP requires a hard fork to implement.&lt;&#x2F;p&gt;
&lt;p&gt;It does not change behavior of any existing opcodes. Therefore, it is backward compatible with all existing contract accounts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;DoS surface&lt;&#x2F;strong&gt;: Temporary storage writes still create state that must be processed and stored for at least 1 period. Gas costs should be calibrated so that worst-case temp writes do not create new per-block disk I&#x2F;O DoS attack vectors beyond existing storage writes.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Reorg safety&lt;&#x2F;strong&gt;: Clients should retain sufficient history to handle plausible reorg depths.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Application safety&lt;&#x2F;strong&gt;: Contracts MUST treat temp storage as ephemeral and handle the case where entries are unexpectedly missing.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>RPC Method for Transaction Gas Limit Cap</title>
        <published>2026-01-11T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Paul Razvan Berg</name><uri>https://github.com/PaulRBerg</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8123/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8123-json-rpc-method-for-transaction-gas-limit-cap/27417" />
        

        <id>https://wg-eips.ritovision.com/8123/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="interface"
                label="Interface" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:8123"
            label="EIP-8123" />
        

        
        

        
        <summary type="html">Add an RPC method to query the EIP-7825 transaction gas limit cap</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8123/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP specifies a new Ethereum JSON-RPC method, &lt;code&gt;eth_txGasLimitCap&lt;&#x2F;code&gt;, which returns the maximum transaction gas limit
(&lt;code&gt;tx.gas&lt;&#x2F;code&gt;) that the node will accept under the current fork rules (and any stricter local policy). This enables wallets,
SDKs, bundlers, and tooling to discover the effective per-transaction gas limit cap without simulation or out-of-band
knowledge.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7825&#x2F;&quot;&gt;EIP-7825&lt;&#x2F;a&gt; introduces a protocol-level per-transaction gas limit cap (e.g. &lt;code&gt;2^24 = 16,777,216&lt;&#x2F;code&gt; on Ethereum) to bound
worst-case single-transaction work. However, it does not specify any way to query this cap.&lt;&#x2F;p&gt;
&lt;p&gt;As a consequence, users and tools must:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;infer it from failed transaction submissions,&lt;&#x2F;li&gt;
&lt;li&gt;hardcode network assumptions,&lt;&#x2F;li&gt;
&lt;li&gt;read client source code,&lt;&#x2F;li&gt;
&lt;li&gt;or rely on Internet documentation.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This is brittle because:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;the cap may change in future upgrades,&lt;&#x2F;li&gt;
&lt;li&gt;different chains intentionally set different cap values (e.g. Arbitrum and Polygon both use &lt;code&gt;32,000,000&lt;&#x2F;code&gt;),&lt;&#x2F;li&gt;
&lt;li&gt;and there already are some proposals to make the transaction gas limit cap dynamic, rather than hardcoded, based on new
fee calculation rules&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST&quot;, “MUST NOT&quot;, “SHOULD&quot;, and “MAY&quot; are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;new-method-eth-txgaslimitcap&quot;&gt;New method: &lt;code&gt;eth_txGasLimitCap&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;request&quot;&gt;Request&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Method&lt;&#x2F;strong&gt;: &lt;code&gt;eth_txGasLimitCap&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Params&lt;&#x2F;strong&gt;: &lt;code&gt;[]&lt;&#x2F;code&gt; (no parameters)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;response&quot;&gt;Response&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Result&lt;&#x2F;strong&gt;: &lt;code&gt;QUANTITY&lt;&#x2F;code&gt; or &lt;code&gt;null&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;If the node enforces a finite transaction gas limit cap, it &lt;strong&gt;MUST&lt;&#x2F;strong&gt; return that cap as a &lt;code&gt;QUANTITY&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If the node does not enforce a finite cap, it &lt;strong&gt;MUST&lt;&#x2F;strong&gt; return &lt;code&gt;null&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Returning &lt;code&gt;null&lt;&#x2F;code&gt; indicates that no finite per-transaction gas limit is enforced by the node.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;semantics&quot;&gt;Semantics&lt;&#x2F;h4&gt;
&lt;p&gt;Let:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;protocolCap&lt;&#x2F;code&gt; be the maximum &lt;code&gt;tx.gas&lt;&#x2F;code&gt; permitted by the active protocol rules at the node&#x27;s current head (e.g. from
EIP-7825 when enabled).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;policyCap&lt;&#x2F;code&gt; be any stricter local cap applied by the node to transaction acceptance (e.g. txpool admission), if
configured; otherwise, unbounded.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Then the node &lt;strong&gt;MUST&lt;&#x2F;strong&gt; return:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;min(protocolCap, policyCap)&lt;&#x2F;code&gt; if finite, else &lt;code&gt;null&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;A node &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; return a value higher than the protocol cap when the protocol cap is finite.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;example&quot;&gt;Example&lt;&#x2F;h4&gt;
&lt;p&gt;Ethereum (EIP-7825 cap = &lt;code&gt;2^24&lt;&#x2F;code&gt;):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;method&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_txGasLimitCap&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;A chain with a &lt;code&gt;32,000,000&lt;&#x2F;code&gt; cap:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1e84800&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;A dedicated method is needed because there is currently no way to query the maximum allowed &lt;code&gt;tx.gas&lt;&#x2F;code&gt; without simulation
or out-of-band knowledge.&lt;&#x2F;p&gt;
&lt;p&gt;Returning the &lt;em&gt;effective&lt;&#x2F;em&gt; cap (&lt;code&gt;min(protocolCap, policyCap)&lt;&#x2F;code&gt;) matches what users need when constructing transactions to
submit.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP adds a new JSON-RPC method and does not modify existing methods. Existing clients and applications remain
compatible.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Pseudo code:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;if protocol has finite tx gas cap at head:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  protocolCap = that value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;else:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  protocolCap = +infinity&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;if protocol has policy cap:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  policyCap = that value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;else:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  policyCap = +infinity&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cap = min(protocolCap, policyCap)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;if cap is finite:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  return cap&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;else:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  return null&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP only exposes information that is already public or otherwise observable by probing. It does not expose secrets
or user data.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via CC0.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>MLOAD8 and CALLDATALOAD8 Opcodes</title>
        <published>2026-01-07T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Helkomine</name><uri>https://github.com/Helkomine</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8120/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8120-mload8-and-calldataload8-opcodes/27396" />
        

        <id>https://wg-eips.ritovision.com/8120/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:8120"
            label="EIP-8120" />
        

        
        

        
        <summary type="html">Adds EVM opcodes for efficient single-byte memory and calldata loads.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8120/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces new EVM opcodes that allow loading a single byte from memory or calldata in a single operation, reducing gas cost and bytecode size compared to existing patterns based on &lt;code&gt;MLOAD (0x51)&lt;&#x2F;code&gt; or &lt;code&gt;CALLDATALOAD (0x35)&lt;&#x2F;code&gt; followed by bit shifting.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, the only way to read a single byte from calldata or memory is to use &lt;code&gt;CALLDATALOAD&lt;&#x2F;code&gt; or &lt;code&gt;MLOAD&lt;&#x2F;code&gt; and then shift the loaded 32-byte word.
For example, reading the byte at offset x from calldata requires:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH x&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CALLDATALOAD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH1 248&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SHR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This pattern increases runtime gas cost and adds three extra bytes to the deployed bytecode for each single-byte access. Contracts that frequently parse byte-oriented calldata or instruction streams incur unnecessary overhead.
This EIP proposes two new opcodes that allow loading a single byte directly in one operation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;mload8-tbd&quot;&gt;MLOAD8 (TBD)&lt;&#x2F;h3&gt;
&lt;!-- TODO: Replace TBD with assigned opcode value --&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Stack input&lt;&#x2F;strong&gt;: &lt;code&gt;offset&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Stack output&lt;&#x2F;strong&gt;: &lt;code&gt;value&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Reads one byte from memory at position offset and pushes it onto the stack as a 32-byte word, with the byte placed in the least significant position.
Memory expansion occurs prior to the load, after which the loaded byte is read.
If the accessed byte lies beyond the previously allocated memory, the returned value is 0 due to zero-initialization.
Memory expansion rules apply in the same way as for &lt;code&gt;MSTORE8&lt;&#x2F;code&gt; (extending memory to at least &lt;code&gt;offset + 1&lt;&#x2F;code&gt; bytes).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;calldataload8-tbd&quot;&gt;CALLDATALOAD8 (TBD)&lt;&#x2F;h3&gt;
&lt;!-- TODO: Replace TBD with assigned opcode value --&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Stack input&lt;&#x2F;strong&gt;: &lt;code&gt;offset&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Stack output&lt;&#x2F;strong&gt;: &lt;code&gt;value&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Reads one byte from calldata at position offset and pushes it onto the stack as a 32-byte word, with the byte placed in the least significant position.
If offset is greater than or equal to &lt;code&gt;CALLDATASIZE (0x36)&lt;&#x2F;code&gt;, the returned value is 0.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-cost&quot;&gt;Gas Cost&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Base cost: 3 gas&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;MLOAD8&lt;&#x2F;code&gt; additionally incurs memory expansion cost as defined by existing memory access rules.
The base gas cost matches &lt;code&gt;MLOAD&lt;&#x2F;code&gt;, &lt;code&gt;MSTORE8&lt;&#x2F;code&gt;, and &lt;code&gt;CALLDATALOAD&lt;&#x2F;code&gt;, ensuring consistency with existing EVM pricing.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;exceptional-conditions&quot;&gt;Exceptional Conditions&lt;&#x2F;h3&gt;
&lt;p&gt;Execution results in an exceptional halt if:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;There is insufficient gas to execute the instruction&lt;&#x2F;li&gt;
&lt;li&gt;There are insufficient stack items (stack underflow)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In both cases, execution halts and the current call frame is reverted, consistent with existing EVM behavior.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;opcode-symmetry&quot;&gt;Opcode Symmetry&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;MLOAD8&lt;&#x2F;code&gt; serves as a natural counterpart to &lt;code&gt;MSTORE8 (0x53)&lt;&#x2F;code&gt;: one stores exactly one byte from the stack to memory, while the other loads exactly one byte from memory to the stack. This symmetry improves conceptual clarity and developer ergonomics.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;efficiency-for-byte-oriented-contracts&quot;&gt;Efficiency for Byte-Oriented Contracts&lt;&#x2F;h3&gt;
&lt;p&gt;Instruction-based architectures that interpret calldata as a sequence of byte-level commands benefit from reduced gas usage and smaller bytecode size when parsing instruction streams.
A common pattern for reading a single byte from calldata today consists of the following instruction sequence:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;CALLDATALOAD&lt;&#x2F;code&gt; (3 gas)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;PUSH1&lt;&#x2F;code&gt; (3 gas)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SHR&lt;&#x2F;code&gt; (3 gas)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This results in a total cost of 9 gas per byte read, excluding additional stack manipulation overhead, and increases deployed bytecode size due to the extra instructions.
Replacing this sequence with a single &lt;code&gt;CALLDATALOAD8&lt;&#x2F;code&gt; instruction priced at 3 gas saves 6 gas per byte read and reduces deployed bytecode size by approximately 3 bytes per occurrence. These savings compound in contracts that repeatedly parse byte-oriented calldata or instruction streams.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;opcode-assignment&quot;&gt;Opcode Assignment&lt;&#x2F;h3&gt;
&lt;p&gt;While the final opcode values are subject to allocation during review, this proposal suggests placing &lt;code&gt;MLOAD8&lt;&#x2F;code&gt; and &lt;code&gt;CALLDATALOAD8&lt;&#x2F;code&gt; in the &lt;code&gt;0x4X&lt;&#x2F;code&gt; opcode range. The &lt;code&gt;0x5X&lt;&#x2F;code&gt; range, which primarily contains stack, memory, storage, and control flow operations, is largely exhausted.
Tentative values of &lt;code&gt;0x4e&lt;&#x2F;code&gt; for &lt;code&gt;MLOAD8&lt;&#x2F;code&gt; and &lt;code&gt;0x4f&lt;&#x2F;code&gt; for &lt;code&gt;CALLDATALOAD8&lt;&#x2F;code&gt; are suggested to group these instructions near existing data access operations while minimizing the risk of opcode collisions. These assignments are intended to facilitate early client prototyping and collision checking and may be adjusted during the standardization process.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces new opcodes and does not modify the semantics of existing instructions. No backwards compatibility issues are introduced beyond those inherent to any opcode-adding hard fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Assume:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;calldata = 0x0123456789abcdef&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;memory = 0xfedcba9876543210&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Bytecode&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;th&gt;Result&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;5f &amp;lt;CALLDATALOAD8&amp;gt;&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;PUSH0; CALLDATALOAD8&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;pushes &lt;code&gt;0x01&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;6002 &amp;lt;MLOAD8&amp;gt;&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;PUSH1 0x02; MLOAD8&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;pushes &lt;code&gt;0xba&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;&amp;lt;CALLDATALOAD8&amp;gt;&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;missing stack operand&lt;&#x2F;td&gt;&lt;td&gt;exceptional halt&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;&amp;lt;MLOAD8&amp;gt;&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;missing stack operand&lt;&#x2F;td&gt;&lt;td&gt;exceptional halt&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;No new security considerations are introduced beyond those already known for memory and calldata access.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Batch priority fees at end of block</title>
        <published>2025-12-30T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Etan Kissling</name><uri>https://github.com/etan-status</uri>
	</author>
	
	<author>
		<name>Gajinder Singh</name><uri>https://github.com/g11tech</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8115/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8115-batch-priority-fees-at-end-of-block/27358" />
        

        <id>https://wg-eips.ritovision.com/8115/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:8115"
            label="EIP-8115" />
        

        
        

        
        <summary type="html">Delay all priority fee credits from transactions to end of block</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8115/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP defines how to optimize processing of priority fees from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; fee market transactions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Priority fees are credited at the end of each transaction, leading to these complications:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Limited parallelization:&lt;&#x2F;strong&gt; Each transaction writes to the fee recipient account balance.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Mempool complexities:&lt;&#x2F;strong&gt; A transaction sender may become solvent only after prior transactions in a block have been processed.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Accounting complexities:&lt;&#x2F;strong&gt; The fee recipient gets hundreds of micropayments for what could logically be a single credit.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Inaccurate logs:&lt;&#x2F;strong&gt; Proposals to emit logs on ETH transfers either have to omit priority fees, limiting their usefulness due to inaccuracies, or have to emit an extra entry for each individual fee, making them expensive.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc2119&quot;&gt;RFC 2119&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc8174&quot;&gt;RFC 8174&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;priority-fee-processing&quot;&gt;Priority fee processing&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; priority fees SHALL no longer be credited after each individual transaction. Instead, they SHALL be summed up and credited after all transactions of a block are processed but before &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4895&#x2F;&quot;&gt;EIP-4895&lt;&#x2F;a&gt; withdrawals are processed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is one step towards fully accurate ETH balance logs. Batched crediting of priority fees improves parallel execution of transactions, as a transaction can no longer start with insufficient fees and only become eligible for execution after incremental priority fees have been credited.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The fee recipient now receives priority fees at the end of the block rather than incrementally after each transaction, making it only possible to spend them in the next block. This may require updates to block builder infrastructure and change liquidity requirements for MEV use cases.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;No security impact.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Replace cumulative receipt fields</title>
        <published>2025-12-30T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Etan Kissling</name><uri>https://github.com/etan-status</uri>
	</author>
	
	<author>
		<name>Gajinder Singh</name><uri>https://github.com/g11tech</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8116/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8116-replace-cumulative-receipt-fields/27359" />
        

        <id>https://wg-eips.ritovision.com/8116/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:8116"
            label="EIP-8116" />
        

        
        

        
        <summary type="html">Replace cumulativeGasUsed with gasUsed in on-chain receipt</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8116/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP describes how to change the on-chain receipt data to track gas per transaction instead of cumulatively.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, on-chain receipts track a &lt;code&gt;cumulativeGasUsed&lt;&#x2F;code&gt; field which contains the running sum of all gas spent for all transactions in the block so far. This has a number of shortcomings:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Inefficient verification:&lt;&#x2F;strong&gt; RPC clients that want to verify individual transaction &lt;code&gt;gasUsed&lt;&#x2F;code&gt; requires computation based on &lt;code&gt;cumulativeGasUsed&lt;&#x2F;code&gt; across consecutive receipts.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Limited parallelism:&lt;&#x2F;strong&gt; Receipt contents are stateful, even for transactions accessing mutually exclusive state.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The &lt;code&gt;logIndex&lt;&#x2F;code&gt; field exposed via JSON-RPC is currently also tracking an incremental block level index instead of a per-receipt index, with similar shortcomings.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc2119&quot;&gt;RFC 2119&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc8174&quot;&gt;RFC 8174&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;receipt-construction&quot;&gt;&lt;code&gt;Receipt&lt;&#x2F;code&gt; construction&lt;&#x2F;h3&gt;
&lt;p&gt;All receipts emitted after this EIP activates track the individual transaction&#x27;s &lt;code&gt;gasUsed&lt;&#x2F;code&gt; instead of the incremental &lt;code&gt;cumulativeGasUsed&lt;&#x2F;code&gt; value.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;json-rpc-api&quot;&gt;JSON-RPC API&lt;&#x2F;h3&gt;
&lt;p&gt;Within &lt;code&gt;logs&lt;&#x2F;code&gt;, the &lt;code&gt;logIndex&lt;&#x2F;code&gt; field is changed to indicate the log index position in the individual receipt, rather than in the entire block.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is a step towards aligning on-chain data with the RPC data actually being consumed by client applications. Stateful components of receipts (&lt;code&gt;cumulativeGasUsed&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;logIndex&lt;&#x2F;code&gt;) are replaced with per-transaction equivalents.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Applications using verified &lt;code&gt;gasUsed&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;cumulativeGasUsed&lt;&#x2F;code&gt; values need to adapt to the new on-chain data semantics.&lt;&#x2F;p&gt;
&lt;p&gt;Applications relying on the per block &lt;code&gt;logIndex&lt;&#x2F;code&gt; need adaptation, as &lt;code&gt;logIndex&lt;&#x2F;code&gt; now refers to an index per receipt. Note that this is solely an RPC change. Relative log ordering can be emulated by estimating &lt;code&gt;logIndex&lt;&#x2F;code&gt; as &lt;code&gt;transactionIndex * 4 + logIndex&lt;&#x2F;code&gt; (guaranteed to have same order as before, but absolute index values may be higher than before).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;None&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Compressed Display Format for Addresses</title>
        <published>2025-12-30T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Zainan Victor Zhou</name><uri>https://github.com/xinbenlv</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8117/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-8117-compressed-display-format-for-evm-addresses/27360" />
        

        <id>https://wg-eips.ritovision.com/8117/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:8117"
            label="ERC-8117" />
        

        
        

        
        <summary type="html">A display format for abbreviating consecutive identical hex characters in EVM addresses using run-length encoding for UI and logging.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8117/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC proposes a standard presentation layer transformation for Ethereum addresses containing long sequences of identical hexadecimal digits. It defines two representation formats: a Unicode-based format using superscripts for graphical user interfaces (UI), and an ASCII-safe fallback format using bracket notation for logs and terminals. This standard aims to improve human readability and safety verification without altering the underlying address data.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;As the Ethereum ecosystem matures, addresses with long repeating sequences are becoming increasingly common due to several factors:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Vanity Addresses &amp;amp; CREATE2:&lt;&#x2F;strong&gt; Factories and developers frequently generate &quot;vanity&quot; addresses with specific prefixes or suffixes for branding or identification.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Gas Optimization (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7939&#x2F;&quot;&gt;EIP-7939&lt;&#x2F;a&gt;):&lt;&#x2F;strong&gt; With proposals like EIP-7939 aiming to reduce gas costs for zero bytes in calldata, there is an economic incentive to deploy contracts at addresses containing large sequences of zeros to optimize cross-contract call costs.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Security Risks:&lt;&#x2F;strong&gt; The human eye struggles to distinguish between long sequences of identical characters (e.g., counting 10 zeros vs. 11 zeros). This creates a &quot;homoglyph-like&quot; vulnerability where users may skim over the middle of an address, missing subtle differences in a phishing scam.&lt;&#x2F;p&gt;
&lt;p&gt;Current truncation methods (e.g., &lt;code&gt;0x1234...5678&lt;&#x2F;code&gt;) obscure the internal structure of the address. A standardized compression format allows users to verify the magnitude of the repeated sequence (e.g., &quot;exactly 11 zeros&quot;) at a glance.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;The compression transformation applies only to the visual representation of the address.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;1-trigger-condition&quot;&gt;1. Trigger Condition&lt;&#x2F;h3&gt;
&lt;p&gt;Compression SHOULD be applied if a sequence of identical hexadecimal nibbles has a length $L$, where $L \geq 6$.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;2-formatting-rules&quot;&gt;2. Formatting Rules&lt;&#x2F;h3&gt;
&lt;p&gt;The standard defines two modes of display. Implementations must preserve the first character of the repeating sequence to indicate which character is being repeated, followed by a count of the total length of the sequence.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;mode-a-unicode-display-ui-frontend&quot;&gt;Mode A: Unicode Display (UI&#x2F;Frontend)&lt;&#x2F;h4&gt;
&lt;p&gt;Recommended for Wallets, Block Explorers, and Mobile Apps.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Syntax:&lt;&#x2F;strong&gt; &lt;code&gt;0x&lt;&#x2F;code&gt; + &lt;code&gt;[repeating_char]&lt;&#x2F;code&gt; + &lt;code&gt;[superscript_count]&lt;&#x2F;code&gt; + &lt;code&gt;[remainder]&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Encoding:&lt;&#x2F;strong&gt; The count integer is converted to Unicode Superscript characters (U+2070 to U+2079).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Example:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Raw: &lt;code&gt;0x00000000000000000044...&lt;&#x2F;code&gt; (Eighteen 0s)&lt;&#x2F;li&gt;
&lt;li&gt;Display: &lt;code&gt;0x0¹⁸44...&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;mode-b-ascii-fallback-cli-logs&quot;&gt;Mode B: ASCII Fallback (CLI&#x2F;Logs)&lt;&#x2F;h4&gt;
&lt;p&gt;Recommended for Developer Consoles, Logs, and Copy-Paste operations.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Syntax:&lt;&#x2F;strong&gt; &lt;code&gt;0x&lt;&#x2F;code&gt; + &lt;code&gt;[repeating_char]&lt;&#x2F;code&gt; + &lt;code&gt;{&lt;&#x2F;code&gt; + &lt;code&gt;[count]&lt;&#x2F;code&gt; + &lt;code&gt;}&lt;&#x2F;code&gt; + &lt;code&gt;[remainder]&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Example:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Raw: &lt;code&gt;0x00000000000000000044...&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Display: &lt;code&gt;0x0{18}44...&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;3-case-sensitivity-and-eip-55&quot;&gt;3. Case Sensitivity and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;55&#x2F;&quot;&gt;EIP-55&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;To preserve the checksum integrity defined in EIP-55 and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1191&#x2F;&quot;&gt;EIP-1191&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The compression MUST strictly match identical ASCII characters.&lt;&#x2F;li&gt;
&lt;li&gt;The compression MUST NOT be applied to mixed-case sequences (e.g., &lt;code&gt;aAaA&lt;&#x2F;code&gt; cannot be compressed).&lt;&#x2F;li&gt;
&lt;li&gt;All non-compressed characters MUST retain their original casing.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;industry-precedents-alignment&quot;&gt;Industry Precedents &amp;amp; Alignment&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;Regex Alignment (ASCII Mode):&lt;&#x2F;strong&gt; We selected the curly brace syntax &lt;code&gt;Byte{n}&lt;&#x2F;code&gt; (e.g., &lt;code&gt;0{8}&lt;&#x2F;code&gt;) because it aligns with the universal Regular Expression standard for quantification. Developers intuitively understand &lt;code&gt;{n}&lt;&#x2F;code&gt; as &quot;repeat n times.&quot;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Divergence from IPv6:&lt;&#x2F;strong&gt; Unlike IPv6, which uses &lt;code&gt;::&lt;&#x2F;code&gt; to represent &quot;fill the gap with zeros,&quot; EVM vanity addresses rely on the specific count of characters for identity. Therefore, an explicit count (&lt;code&gt;{8}&lt;&#x2F;code&gt;) is safer than an implicit gap (&lt;code&gt;::&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;superscript-vs-subscript-ui-mode&quot;&gt;Superscript vs. Subscript (UI Mode)&lt;&#x2F;h3&gt;
&lt;p&gt;While subscript notation (e.g., $H_2O$) implies component count in chemistry, this ERC selects Superscript (&lt;code&gt;0⁸&lt;&#x2F;code&gt;) for the following reasons:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Legibility:&lt;&#x2F;strong&gt; Superscripts generally render more clearly on digital displays and do not conflict with text underlines (hyperlinks) or font baselines.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Metaphor:&lt;&#x2F;strong&gt; Superscripts serve as a visual metaphor for Scientific Notation, indicating the magnitude or length of the sequence, rather than a mathematical power operation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-optimization-context&quot;&gt;Gas Optimization Context&lt;&#x2F;h3&gt;
&lt;p&gt;With the introduction of logic similar to EIP-7939 (scaling gas costs based on calldata zeros), the ecosystem will see a proliferation of addresses engineered to have maximum zero bytes. A display format that handles these specific addresses gracefully is a necessary proactive measure for user experience.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC is strictly a presentation layer standard.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Wallets:&lt;&#x2F;strong&gt; Must strip the compression formatting (convert back to full hex) before signing or broadcasting transactions.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Safety:&lt;&#x2F;strong&gt; The characters &lt;code&gt;{&lt;&#x2F;code&gt;, &lt;code&gt;}&lt;&#x2F;code&gt;, and Unicode superscripts are not valid hexadecimal characters. If a user blindly copies a compressed address into a legacy system, the system will reject the input as invalid rather than processing a wrong address. This acts as a fail-safe mechanism.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The following Python implementation demonstrates the logic for both Unicode and ASCII modes, covering full display and truncated variations.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; re&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AddressCompressor&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    SUPERSCRIPTS&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\u2070&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\u00B9&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\u00B2&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;3&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\u00B3&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;4&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\u2074&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;5&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\u2075&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;6&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\u2076&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;7&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\u2077&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;8&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\u2078&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;9&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\u2079&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; __init__&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;full_address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Remove 0x for processing&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;clean_address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt; address&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;startswith&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _to_superscript&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; number&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Converts an integer to a string of unicode superscripts.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;join&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SUPERSCRIPTS&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;digit&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; digit&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; digit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; str&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; format&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; mode&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unicode&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; truncate&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;False&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        Modes: &amp;#39;unicode&amp;#39; (0⁸) or &amp;#39;ascii&amp;#39; (0{8})&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        Truncate: If True, keeps start&#x2F;end context only.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; replacer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;match&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            seq&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; match&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;group&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            length&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;seq&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            char&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; seq&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Trigger threshold &amp;gt;= 6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; length&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 6&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                return&lt;&#x2F;span&gt;&lt;span&gt; seq&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; mode&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unicode&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                count_str&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_to_superscript&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                return&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;{&lt;&#x2F;span&gt;&lt;span&gt;char&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;{&lt;&#x2F;span&gt;&lt;span&gt;count_str&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                return&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;{&lt;&#x2F;span&gt;&lt;span&gt;char&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;{{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;{&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;}}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Find sequences of identical characters&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; (?:(\w)\1+) matches a char followed by itself one or more times&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        compressed_body&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; re&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sub&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;\1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; replacer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;clean_address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        prefix&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; truncate&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;{&lt;&#x2F;span&gt;&lt;span&gt;prefix&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;{&lt;&#x2F;span&gt;&lt;span&gt;compressed_body&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Simple Logic for Truncation with Compression&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If the compression happened at the start (common for vanity)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;clean_address&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;startswith&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Find where the first compression block ends in the visual string&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This is a simplified example. Production logic needs to handle&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; multiple compression blocks carefully.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;{&lt;&#x2F;span&gt;&lt;span&gt;prefix&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;{&lt;&#x2F;span&gt;&lt;span&gt;compressed_body&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;5&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;...&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;{&lt;&#x2F;span&gt;&lt;span&gt;compressed_body&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;{&lt;&#x2F;span&gt;&lt;span&gt;prefix&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;{&lt;&#x2F;span&gt;&lt;span&gt;compressed_body&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;6&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;...&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;{&lt;&#x2F;span&gt;&lt;span&gt;compressed_body&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; --- Test Cases ---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 1. Standard Vanity (7 zeros)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;addr1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x000000095a03eb9fa26c0d71136a8daa8ea239ce&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;c1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; AddressCompressor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addr1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;print&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Unicode Full:  &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;{&lt;&#x2F;span&gt;&lt;span&gt;c1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;format&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;mode&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unicode&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Output: 0x0⁷95a03eb9fa26c0d71136a8daa8ea239ce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;print&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ASCII Full:    &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;{&lt;&#x2F;span&gt;&lt;span&gt;c1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;format&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;mode&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ascii&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Output: 0x0{7}95a03eb9fa26c0d71136a8daa8ea239ce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 2. Uniswap V4 Style (11 zeros)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;addr2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x000000000004444c5dc75cB358380D2e3dE08A90&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;c2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; AddressCompressor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addr2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;print&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Unicode Smart: &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;{&lt;&#x2F;span&gt;&lt;span&gt;c2&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;format&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;mode&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unicode&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; truncate&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;True&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Output: 0x0¹¹44...8A90&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;print&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ASCII Smart:   &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;{&lt;&#x2F;span&gt;&lt;span&gt;c2&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;format&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;mode&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ascii&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; truncate&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;True&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Output: 0x0{11}44...8A90&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 3. Precompile (39 zeros)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;addr3&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;c3&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; AddressCompressor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addr3&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;print&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Precompile UI: &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;{&lt;&#x2F;span&gt;&lt;span&gt;c3&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;format&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;mode&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unicode&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Output: 0x0³⁹1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 4. Mixed Case (Safety Check - Should NOT compress)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;addr4&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000aAaAaAaA1234&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; aAaA... is mixed case&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;c4&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; AddressCompressor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addr4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;print&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Safety Check:  &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;{&lt;&#x2F;span&gt;&lt;span&gt;c4&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;format&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;mode&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ascii&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Output: 0x0{7}aAaAaAaA1234 (Only the zeros are compressed)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;Homoglyph Attacks:&lt;&#x2F;strong&gt; While this standard aims to reduce visual confusion, developers must ensure that the font used for superscripts is distinct enough that &lt;code&gt;0⁷&lt;&#x2F;code&gt; is not misread as &lt;code&gt;07&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Copy-Paste Validation:&lt;&#x2F;strong&gt; Applications accepting address input MUST prioritize standard hexadecimal parsing. If an input contains &lt;code&gt;{}&lt;&#x2F;code&gt; or superscripts, the application should strictly reject the input or explicitly offer to decompress it, rather than attempting to hash invalid characters.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Preservation of Entropy:&lt;&#x2F;strong&gt; This standard does not compress distinct characters. It only compresses low-entropy sequences (repeats), ensuring that the visually distinct part of the address (the high-entropy suffix) remains prominent.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Series Accounting for Incentivized Vaults</title>
        <published>2025-12-25T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Yash Saraswat</name><uri>https://github.com/0xpanicError</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8113/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-8113-series-accounting-for-incentivized-vaults/27306" />
        

        <id>https://wg-eips.ritovision.com/8113/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:8113"
            label="ERC-8113" />
        

        
        

        
        <summary type="html">Series Accounting method for collecting performance fees in ERC-7540 type vaults.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8113/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The following standard formalizes the Series Accounting Method for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7540&#x2F;&quot;&gt;ERC-7540&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4626&#x2F;&quot;&gt;ERC-4626&lt;&#x2F;a&gt; type vaults, enabling them to collect performance fees on yields without introducing the free-rider problem.&lt;&#x2F;p&gt;
&lt;p&gt;It defines the necessary architectural specification for implementing Series Accounting by requiring an independent Series to track each batch of claimed deposit requests within the vault with its unique &lt;code&gt;totalAssets&lt;&#x2F;code&gt;, &lt;code&gt;totalShares&lt;&#x2F;code&gt;,  &lt;code&gt;sharesOf&lt;&#x2F;code&gt; and &lt;code&gt;highwaterMark&lt;&#x2F;code&gt; values.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Current vault implementations typically implement a Highwater Mark based on the highest recorded price-per-share (the ratio of total assets to total shares of the vault) to ensure performance fees are not collected for recovering losses. But relying on a single vault-wide highwater mark introduces the free-rider problem.&lt;&#x2F;p&gt;
&lt;p&gt;A free-rider occurs when a user&#x27;s deposit is claimed at a price-per-share below the vault&#x27;s current highwater mark. When the vault later reaches a new highwater mark, the user doesn’t pay a performance fee on all yield accrued between their initial entry price and the new highwater mark, effectively diminishing returns for existing users.&lt;&#x2F;p&gt;
&lt;p&gt;This standard implements the series accounting method where all batches of deposit requests are claimed in a series which maintains a unique highwater mark for those deposits. This allows for the protocol to accurately account for performance fees across all user deposits fairly. The “free-ride” problem is prevalent in vaults that derive their yields from RWAs. Reflecting performance from off-chain assets like hedge or liquid fund portfolios can vary drastically from each rebalancing&#x2F;settlement cycle.&lt;&#x2F;p&gt;
&lt;p&gt;This can cause large fluctuations in exchange rates (price-per-share) of a vault resulting in inaccurate performance fee collection from users. Series Accounting is a very common and standard method of accounting portfolios in traditional funds but lacks any formal implementation in DeFi.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc2119&quot;&gt;RFC 2119&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc8174&quot;&gt;RFC 8174&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The general architecture of a vault remains the same. This standard can be used with both rebalancing type and async type vaults. For ERC-4626 type vaults which rebalances price-per-share periodically, all deposits made within a rebalancing period can be considered as a batch (all &quot;settled&quot; with same price-per-share). For ERC-7540 async type vaults, the user flows remain the same:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;users requiring to submit a request to enter or exit the vault&lt;&#x2F;li&gt;
&lt;li&gt;vault implementing a method to move request from “pending” to “claimable” state&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;However, the structure in which &lt;code&gt;assets&lt;&#x2F;code&gt; and &lt;code&gt;shares&lt;&#x2F;code&gt; are maintained in the vault is altered to accommodate for series accounting. Traditionally, the vault will store a global value for &lt;code&gt;totalAssets&lt;&#x2F;code&gt; and &lt;code&gt;totalShares&lt;&#x2F;code&gt;, but to follow this specification, the following state variables MUST be maintained individually for each series:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;total assets&lt;&#x2F;li&gt;
&lt;li&gt;total shares&lt;&#x2F;li&gt;
&lt;li&gt;shares of users&lt;&#x2F;li&gt;
&lt;li&gt;list of users&lt;&#x2F;li&gt;
&lt;li&gt;highwater mark&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;series: a series is like a sub-vault where a set of all deposit requests that are claimed together are accounted for.&lt;&#x2F;li&gt;
&lt;li&gt;price-per-share: ratio of total assets to total shares in a series.&lt;&#x2F;li&gt;
&lt;li&gt;highwater mark: the highest price-per-share (also referred as exchange price) of a given series.&lt;&#x2F;li&gt;
&lt;li&gt;oracle: the entity responsible for setting the price-per-share of the vault.&lt;&#x2F;li&gt;
&lt;li&gt;settle: the act of rebalancing the vault or claiming the deposit requests performed by the oracle in a series id, determined by the logic specified in this standard.&lt;&#x2F;li&gt;
&lt;li&gt;lead series: each vault has a default series called the lead series where the first set of deposit requests will be claimed.&lt;&#x2F;li&gt;
&lt;li&gt;outstanding series: a series apart from the lead series which contains user shares.&lt;&#x2F;li&gt;
&lt;li&gt;consolidation: the process where all user shares are transferred from outstanding series to the lead series.&lt;&#x2F;li&gt;
&lt;li&gt;consolidated series: an empty series from which user shares were transferred during consolidation.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;deposit-flow&quot;&gt;Deposit Flow&lt;&#x2F;h4&gt;
&lt;p&gt;For ERC-4626 type vaults, when the &lt;code&gt;oracle&lt;&#x2F;code&gt; provides the price-per-share for rebalancing, all deposits that will follow in that rebalancing period will be considered as a batch and MUST &lt;code&gt;settle&lt;&#x2F;code&gt; in the same series id. For ERC-7540 type vaults, when the &lt;code&gt;oracle&lt;&#x2F;code&gt; provides the price-per-share at which the deposits are to be claimed, all deposits MUST &lt;code&gt;settle&lt;&#x2F;code&gt; in the same series id. The standard defines in which series id the deposits SHOULD be &lt;code&gt;settled&lt;&#x2F;code&gt; as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;if the current highwater mark of the lead series is greater than the price-per-share of the lead series&lt;&#x2F;strong&gt;
&lt;ul&gt;
&lt;li&gt;MUST create a new series with a unique series ID.&lt;&#x2F;li&gt;
&lt;li&gt;MUST settle all pending deposit requests in this new series.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;else (if the highwater mark is less than or equal to the price-per-share):&lt;&#x2F;strong&gt;
&lt;ul&gt;
&lt;li&gt;MUST settle all pending deposit requests in the lead series.&lt;&#x2F;li&gt;
&lt;li&gt;If the number of outstanding series is greater than zero:
&lt;ul&gt;
&lt;li&gt;MUST consolidate all outstanding series into the lead series.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;redeem-flow&quot;&gt;Redeem Flow&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8113&#x2F;&quot;&gt;ERC-8113&lt;&#x2F;a&gt; vaults MUST allow users to redeem (or request a redeem) by providing &lt;code&gt;assets&lt;&#x2F;code&gt; instead of &lt;code&gt;shares&lt;&#x2F;code&gt; as input.&lt;&#x2F;p&gt;
&lt;p&gt;The vault is RECOMMENDED to store the proportion of total &lt;code&gt;assets&lt;&#x2F;code&gt; for that user in the redeem request.&lt;&#x2F;p&gt;
&lt;p&gt;When the request is to be settled, the redemption MAY follow the FIFO method. At the time of settling a redeem request for a given price-per-share, the amount is to be redeemed from the lead series first. If the total user assets in lead series is not sufficient to fulfill the request, the remaining amount should be redeemed from the outstanding series with the lowest series Id. This process must be continued until the entire request is fulfilled. The portion of redemption that takes place in a given series is called a Redeem Slice.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;using-assets-instead-of-shares-for-redemption&quot;&gt;Using “assets” instead of “shares” for redemption&lt;&#x2F;h3&gt;
&lt;p&gt;We cannot use &lt;code&gt;shares&lt;&#x2F;code&gt; to specify the amount a user wishes to redeem because shares are non-fungible across series. A user who can have assets across multiple series cannot specify a single share value in the request to represent all user assets.&lt;&#x2F;p&gt;
&lt;p&gt;If requests are made for a given series, &lt;code&gt;shares&lt;&#x2F;code&gt; can be used but then:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;user must make multiple requests if they wish to redeem more than what they own in a given series&lt;&#x2F;li&gt;
&lt;li&gt;if the series gets consolidated (in case of async vaults), the redemption may take place from lead series but price-per-share information must be stored which makes implementation very complicated and can introduce security risks&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The best solution presented to be users specifying &lt;code&gt;assets&lt;&#x2F;code&gt; instead of &lt;code&gt;shares&lt;&#x2F;code&gt; when making a redeem request. While processing the request, the implementation can store the proportion of total user assets across all series that they wish to redeem.&lt;&#x2F;p&gt;
&lt;p&gt;This solves the issues of non-fungible shares and accounting across multiple series.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;consolidating-series&quot;&gt;Consolidating Series&lt;&#x2F;h3&gt;
&lt;p&gt;Each new set of deposit requests may require its own series. This can cause the number of outstanding series to increase in number drastically if vault periodically has periods of poor performance.&lt;&#x2F;p&gt;
&lt;p&gt;This can cause following problems:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;having many outstanding series may result in any implementation processing them to exceed the block gas limit eventually which can render the vault unusable.&lt;&#x2F;li&gt;
&lt;li&gt;traditional fund managers that expect to fetch vault data for their accounting reports are not pleased with having bloated Net Asset Vaule (NAV)&#x2F;Assets Under Management (AUM) sheets with multiple series.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;After the lead series reaches a new highwater mark, all subsequent outstanding series also reach new highwater marks. When this happens, each existing user has paid their fair share of performance and there no longer exists a need to maintain these deposits separately.&lt;&#x2F;p&gt;
&lt;p&gt;Hence, consolidating all outstanding series during this point can help a vault never exceed block gas limit and also keeps accounting reports for traditional managers clean and concise.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Note that ERC-8113 is not backwards compatible with ERC-7540 or ERC-4626.&lt;&#x2F;p&gt;
&lt;p&gt;The incompatibilties with ERC-4626 are as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;totalAssets&lt;&#x2F;code&gt; would require additional input &lt;code&gt;seriesId&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;convertToShares&lt;&#x2F;code&gt; would require additional input &lt;code&gt;seriesId&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;convertToAssets&lt;&#x2F;code&gt; would require additional input &lt;code&gt;seriesId&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;redeem&lt;&#x2F;code&gt; would need to replace input &lt;code&gt;shares&lt;&#x2F;code&gt; with &lt;code&gt;assets&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The incompatibilities with ERC-7540 are as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;requestRedeem&lt;&#x2F;code&gt; would need to replace input &lt;code&gt;shares&lt;&#x2F;code&gt; with &lt;code&gt;assets&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The fee calculation for yield bearing vaults can be complex as there can be multiple fixed and variable charges applied before performance fee. This can cause mismatch from expected and realised fee collections.&lt;&#x2F;p&gt;
&lt;p&gt;Protocols must be careful and thoroughly analyze the accounting resulting from their implementations to ensure they match expectations, and should provide clear documentation of all fee calculations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Bound Signatures</title>
        <published>2025-12-23T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>William Morriss</name><uri>https://github.com/wjmelements</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8111/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-8111-bound-signatures/27308" />
        

        <id>https://wg-eips.ritovision.com/8111/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        

        
        <category
            term="tag:eip:8111"
            label="ERC-8111" />
        

        
        

        
        <summary type="html">Binding y-parity compresses ECDSA signatures</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8111/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Recoverable ECDSA signatures can flip &lt;code&gt;s&lt;&#x2F;code&gt; and &lt;code&gt;v&lt;&#x2F;code&gt; while remaining valid, so they can be compressed to 64 bytes by restricting &lt;code&gt;v&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;ECDSA signatures are often encoded with three parameters: &lt;code&gt;v&lt;&#x2F;code&gt;, &lt;code&gt;r&lt;&#x2F;code&gt;, and &lt;code&gt;s&lt;&#x2F;code&gt;.
In the Solidity ABI encoding, this is 96 bytes.
By eliminating the degree of freedom, &lt;code&gt;v&lt;&#x2F;code&gt;, the encoded size of a recoverable signature can be reduced to 64 bytes.
Additionally, such signatures are not malleable.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Smart contracts accepting bound signatures MUST supply &lt;code&gt;27&lt;&#x2F;code&gt; for &lt;code&gt;v&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; signer &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; ecrecover&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;digest&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 27&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; s&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signer &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;ECDSA signatures MUST be bound before supplied to such contracts.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; SECP256K1_N&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bigint&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;n&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; bind&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;sig&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 27&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 28&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 27&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Signature&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sig&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;v&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ===&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; v&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sig&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; SECP256K1_N&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sig&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Signature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sig&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; s&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; v&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Another signature compression approach, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2098&#x2F;&quot;&gt;ERC-2098&lt;&#x2F;a&gt;, stores the y-parity bit in the most-significant bit of the low &lt;code&gt;s&lt;&#x2F;code&gt;.
Bound signatures are preferable because they are valid inputs to the &lt;code&gt;ecrecover&lt;&#x2F;code&gt; precompile.
They require less gas because they do not need to be unpacked by the smart contract.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;27&lt;&#x2F;code&gt; was chosen over &lt;code&gt;28&lt;&#x2F;code&gt; to make the y-parity falsy.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Bound signatures are compatible with &lt;code&gt;ecrecover&lt;&#x2F;code&gt; if 27 is supplied for the &lt;code&gt;v&lt;&#x2F;code&gt; parameter.
They cannot be used for transaction signatures because they permit high &lt;code&gt;s&lt;&#x2F;code&gt;, in violation of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2&#x2F;&quot;&gt;EIP-2&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Signer&lt;&#x2F;th&gt;&lt;th&gt;Digest&lt;&#x2F;th&gt;&lt;th&gt;&lt;code&gt;r&lt;&#x2F;code&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;code&gt;s&lt;&#x2F;code&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x4a6f6B9fF1fc974096f9063a45Fd12bD5B928AD1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xb0922c37cafd247fe3ada4eb1d1e3735b7d2837437c1178e9af120d535214270&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xdb7f75635124c807ec1f8b03e34cd76b633dc3a189e3c85fc5aee7e7d71df38c&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x5f1e6c6edf21cacfc2acba2815b253b9048b894eec5aaf70343389bb596c48bc&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x4a6f6B9fF1fc974096f9063a45Fd12bD5B928AD1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xd92ff06caae7253883627416a425414d79e9003b91d6208add30e73735ef13c3&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xaa40efd534ac7f96b85babd7df9228fa131e8523115ca1ebc025698c37f3867d&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xa4b8d3c650fe62e46a563aed681bfdd44d50452fa7712bd139f2bfba3aed59c9&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x6B93E3bB9C0780C0f9042346Ffc379530a5882c1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xfa75eba87f076cf22489da7c53a651bb3869473f78d09d4814afb7ab2d54ed45&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xaf4a877600ab6d14ebac626830cf1063d624487932b3cc73a7cd98ae7fbf337f&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xbc41d29acfcd3a1e7b5cb2dde1b85fe8882739312639b5f16d476a87584c040f&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.30&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;library&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BoundSignatures&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; recover&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; digest&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; s&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        signer &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; ecrecover&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;digest&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 27&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; s&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signer &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Bound signatures are recoverable and not malleable.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Diamonds, Simplified</title>
        <published>2025-12-21T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Nick Mudge</name><uri>https://github.com/mudgen</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8109/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-8109-diamonds-simplified/27119" />
        

        <id>https://wg-eips.ritovision.com/8109/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:8109"
            label="ERC-8109" />
        

        
        

        
        <summary type="html">A simplified diamond architecture for modular smart contract systems.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8109/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;A diamond is a proxy contract that &lt;code&gt;delegatecall&lt;&#x2F;code&gt;s to multiple implementation contracts called facets.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8109&#x2F;.&#x2F;assets&#x2F;basic-diamond-diagram.svg&quot; alt=&quot;Diagram showing how a diamond contract works&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Diamond contracts were originally standardized by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2535&#x2F;&quot;&gt;ERC-2535&lt;&#x2F;a&gt;. This standard refines that specification by simplifying terminology, reducing the implementation complexity of introspection functions, and standardizing specific events.&lt;&#x2F;p&gt;
&lt;p&gt;This standard preserves the full capabilities of diamond contracts while reducing complexity. It also specifies an optional upgrade path for existing ERC-2535 diamonds.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;motivation-for-diamond-contracts&quot;&gt;Motivation for Diamond Contracts&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;img alt=&quot;Obligatory diamond&quot; src=&quot;.&#x2F;assets&#x2F;diamond.svg&quot; width=&quot;17%&quot; align=&quot;right&quot;&gt;Through a single contract address, a diamond provides functionality from multiple implementation contracts (facets). Each facet is independent, yet facets can share internal functions and storage. This architecture allows large smart-contract systems to be composed from separate facets and presented as a single contract, simplifying deployment, testing, and integration with other contracts, off-chain software, and user interfaces.&lt;&#x2F;p&gt;
&lt;p&gt;By decomposing large smart contracts into facets, diamonds can reduce complexity and make systems easier to reason about. Distinct areas of functionality can be isolated, organized, tested, and managed independently.&lt;&#x2F;p&gt;
&lt;p&gt;Diamonds combine the single-address convenience of a monolithic contract with the modular flexibility of distinct, integrated contracts.&lt;&#x2F;p&gt;
&lt;p&gt;This architecture is well suited to &lt;strong&gt;immutable&lt;&#x2F;strong&gt; smart-contract systems, where all functionality is composed from multiple facets at deployment time and permanently fixed thereafter.&lt;&#x2F;p&gt;
&lt;p&gt;For upgradeable systems, diamonds enable incremental development: new functionality can be added, and existing functionality modified, without redeploying unaffected facets.&lt;&#x2F;p&gt;
&lt;p&gt;Additional motivation and background for diamond-based smart-contract systems can be found in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1538&#x2F;&quot;&gt;ERC-1538&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2535&#x2F;&quot;&gt;ERC-2535&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;motivation-for-this-standard&quot;&gt;Motivation for this Standard&lt;&#x2F;h3&gt;
&lt;p&gt;Unlike monolithic contracts, a diamond&#x27;s external functions are commonly determined by runtime routing (selector → facet mapping) rather than being wholly represented in the diamond&#x27;s source code or bytecode. To accurately determine or display the full set of functionality a diamond has, tooling must rely on standardized introspection functions and events.&lt;&#x2F;p&gt;
&lt;p&gt;Block explorers, indexers, development tools, and user interfaces need a standard way to inspect which functions and facets a diamond possesses. Additionally, tooling can be built to reconstruct and display the full development or upgrade history of diamond contracts using event logs.&lt;&#x2F;p&gt;
&lt;p&gt;ERC-2535 standardized introspection functions and events. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8109&#x2F;&quot;&gt;ERC-8109&lt;&#x2F;a&gt; re-standardizes these to make diamond contracts easier to implement and easier to understand.&lt;&#x2F;p&gt;
&lt;p&gt;ERC-8109 improves upon ERC-2535 Diamonds in the following ways:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Simplified terminology.&lt;&#x2F;li&gt;
&lt;li&gt;Fewer and simpler to implement introspection functions.&lt;&#x2F;li&gt;
&lt;li&gt;Replaces a single monolithic event, with per-function events. This makes it easier to implement a variety of functions that add, replace and remove functions in a diamond. It also makes it easier for tools to search for and process events.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;terms&quot;&gt;Terms&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;A &lt;strong&gt;diamond&lt;&#x2F;strong&gt; is a smart contract that routes external function calls to one or more implementation contracts, referred to as facets. A diamond is stateful: all persistent data is stored in the diamond’s contract storage. A diamond implements the requirements in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8109&#x2F;#implementation-requirements&quot;&gt;Implementation Requirements&lt;&#x2F;a&gt; section.&lt;&#x2F;li&gt;
&lt;li&gt;A &lt;strong&gt;facet&lt;&#x2F;strong&gt; is a smart contract that defines one or more external functions. A facet is deployed independently, and one or more of its functions are added to one or more diamonds. A facet’s functions are executed in the diamond’s context via &lt;code&gt;delegatecall&lt;&#x2F;code&gt;, so reads&#x2F;writes affect the diamond’s storage. The term facet is derived from the diamond industry, referring to a flat surface of a diamond.&lt;&#x2F;li&gt;
&lt;li&gt;An &lt;strong&gt;introspection function&lt;&#x2F;strong&gt; is a function that returns information about the facets and functions used by a diamond.&lt;&#x2F;li&gt;
&lt;li&gt;For the purposes of this specification, a &lt;strong&gt;mapping&lt;&#x2F;strong&gt; refers to a conceptual association between two items and does not refer to a specific implementation.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;diamond-diagram&quot;&gt;Diamond Diagram&lt;&#x2F;h3&gt;
&lt;p&gt;This diagram shows the structure of a diamond.&lt;&#x2F;p&gt;
&lt;p&gt;It shows that a diamond has a mapping from function to facet and that facets can access the storage inside a diamond.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8109&#x2F;.&#x2F;assets&#x2F;functionFacetMapping.svg&quot; alt=&quot;Diagram showing structure of a diamond&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;fallback&quot;&gt;Fallback&lt;&#x2F;h3&gt;
&lt;p&gt;When an external function is called on a diamond, its fallback function is executed. The fallback function determines which facet to call based on the first four bytes of the calldata (known as the function selector) and executes the function from the facet using &lt;code&gt;delegatecall&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;A diamond’s fallback function and &lt;code&gt;delegatecall&lt;&#x2F;code&gt; enable a diamond to execute a facet’s function as if it was implemented by the diamond itself. The &lt;code&gt;msg.sender&lt;&#x2F;code&gt; and &lt;code&gt;msg.value&lt;&#x2F;code&gt; values do not change and only the diamond’s storage is read and written to.&lt;&#x2F;p&gt;
&lt;p&gt;Here is an example of how a diamond’s fallback function might be implemented:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FunctionNotFound&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span&gt; _selector&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Executes function call on facet using `delegatecall`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns function call return data or revert data.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;fallback&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get facet address from function selector&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; facet &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; selectorToFacet&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sig&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;facet &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FunctionNotFound&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sig&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Execute external function on facet using `delegatecall` and return any value.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Copy function selector and any arguments from calldata to memory.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        calldatacopy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calldatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Execute function call using the facet.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        let&lt;&#x2F;span&gt;&lt;span&gt; result &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; delegatecall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; facet&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calldatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Copy all return data from the previous call into memory.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        returndatacopy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returndatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Return any return value or error back to the caller.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        switch result&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        case &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;revert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returndatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        default &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returndatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;function-not-found&quot;&gt;Function Not Found&lt;&#x2F;h4&gt;
&lt;p&gt;If the fallback function cannot find a facet for a function selector, and there is no default function or other mechanism to handle the call, the fallback MUST revert with the error &lt;code&gt;FunctionNotFound(bytes4 _selector)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;events&quot;&gt;Events&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;adding-replacing-removing-functions&quot;&gt;Adding&#x2F;Replacing&#x2F;Removing Functions&lt;&#x2F;h4&gt;
&lt;p&gt;These events are REQUIRED.&lt;&#x2F;p&gt;
&lt;p&gt;For each function selector that is added, replaced, or removed, the corresponding event MUST be emitted.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a function is added to a diamond.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _selector&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The function selector being added.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _facet&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    The facet address that will handle calls to `_selector`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DiamondFunctionAdded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _selector&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _facet&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when changing the facet that will handle calls to a function.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _selector&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The function selector being affected.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _oldFacet&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The facet address previously responsible for `_selector`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _newFacet&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The facet address that will now handle calls to `_selector`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DiamondFunctionReplaced&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _selector&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _oldFacet&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _newFacet&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a function is removed from a diamond.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _selector&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The function selector being removed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _oldFacet&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The facet address that previously handled `_selector`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DiamondFunctionRemoved&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _selector&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _oldFacet&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;recording-non-fallback-delegatecalls&quot;&gt;Recording Non-Fallback &lt;code&gt;delegatecall&lt;&#x2F;code&gt;s&lt;&#x2F;h4&gt;
&lt;p&gt;This event is OPTIONAL.&lt;&#x2F;p&gt;
&lt;p&gt;This event can be used to record &lt;code&gt;delegatecall&lt;&#x2F;code&gt;s made by a diamond.&lt;&#x2F;p&gt;
&lt;p&gt;This event MUST NOT be emitted for &lt;code&gt;delegatecall&lt;&#x2F;code&gt;s made by a diamond’s fallback function when routing calls to facets. It is only intended for &lt;code&gt;delegatecall&lt;&#x2F;code&gt;s made by functions in facets or a diamond’s constructor.&lt;&#x2F;p&gt;
&lt;p&gt;This event enables tracking of changes to a diamond’s contract storage caused by &lt;code&gt;delegatecall&lt;&#x2F;code&gt; execution.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a diamond&amp;#39;s constructor function or function from a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*         facet makes a `delegatecall`. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _delegate&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         The contract that was the target of the `delegatecall`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _delegateCalldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The function call, including function selector and &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*                          any arguments.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DiamondDelegateCall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _delegate&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _delegateCalldata&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;diamond-metadata&quot;&gt;Diamond Metadata&lt;&#x2F;h4&gt;
&lt;p&gt;This event is OPTIONAL.&lt;&#x2F;p&gt;
&lt;p&gt;This event can be used to record versioning or other information about diamonds.&lt;&#x2F;p&gt;
&lt;p&gt;It can be used to record information about diamond upgrades.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted to record information about a diamond.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    This event records any arbitrary metadata. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*         The format of `_tag` and `_data` are not specified by the &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*         standard.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tag&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   Arbitrary metadata, such as a release version.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  Arbitrary metadata.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DiamondMetadata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tag&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;inspecting-diamonds&quot;&gt;Inspecting Diamonds&lt;&#x2F;h3&gt;
&lt;p&gt;Diamond introspection functions return information about what functions and facets are used in a diamond.&lt;&#x2F;p&gt;
&lt;p&gt;These functions MUST be implemented and are required by the standard:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Gets the facet that handles the given selector.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *  &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If facet is not found return address(0).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *  &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _functionSelector&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The function selector.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *  &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; facet address associated with the function selector.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; facetAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _functionSelector&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FunctionFacetPair&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes4&lt;&#x2F;span&gt;&lt;span&gt; selector&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; facet&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns an array of all function selectors and their &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*         corresponding facet addresses.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    Iterates through the diamond&amp;#39;s stored selectors and pairs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*         each with its facet.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; pairs&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of `FunctionFacetPair` structs, each containing&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*         a selector and its facet address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; functionFacetPairs&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;FunctionFacetPair&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; pairs&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The essence of a diamond is its &lt;code&gt;function -&amp;gt; facet&lt;&#x2F;code&gt; mapping. &lt;code&gt;functionFacetPairs()&lt;&#x2F;code&gt; returns that mapping as an array of &lt;code&gt;(selector, facet)&lt;&#x2F;code&gt; pairs.&lt;&#x2F;p&gt;
&lt;p&gt;These functions were chosen because they provide all necessary facet and function data about a diamond. They are very simple to implement and are computationally efficient.&lt;&#x2F;p&gt;
&lt;p&gt;Block explorers, GUIs, tests, and other tools may rely on their presence.&lt;&#x2F;p&gt;
&lt;p&gt;A reference implementation exists for these introspection functions here: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8109&#x2F;.&#x2F;assets&#x2F;DiamondInspectFacet.sol&quot;&gt;DiamondInspectFacet.sol&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Other introspection functions may be added to a diamond. The above two functions are the only ones required by this standard.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;implementation-requirements&quot;&gt;Implementation Requirements&lt;&#x2F;h3&gt;
&lt;p&gt;A diamond MUST implement the following:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Diamond Structure&lt;&#x2F;strong&gt;
&lt;ul&gt;
&lt;li&gt;A diamond MUST implement a &lt;code&gt;fallback()&lt;&#x2F;code&gt; function.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Function Association&lt;&#x2F;strong&gt;
&lt;ul&gt;
&lt;li&gt;A diamond MUST associate function selectors with facet addresses.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Function Execution&lt;&#x2F;strong&gt;
&lt;ul&gt;
&lt;li&gt;When an external function is called on a diamond:
&lt;ul&gt;
&lt;li&gt;The diamond’s fallback function is executed.&lt;&#x2F;li&gt;
&lt;li&gt;The fallback function MUST find the facet associated with the function selector.&lt;&#x2F;li&gt;
&lt;li&gt;The fallback function MUST execute the function on the facet using &lt;code&gt;delegatecall&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If no facet is associated with the function selector, the diamond MAY execute a default function or apply another handling mechanism.&lt;&#x2F;li&gt;
&lt;li&gt;If no facet, default function, or other handling mechanism exists, execution MUST revert with the error &lt;code&gt;FunctionNotFound(bytes4 _selector)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Events&lt;&#x2F;strong&gt;
&lt;ul&gt;
&lt;li&gt;The following events MUST be emitted:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;DiamondFunctionAdded&lt;&#x2F;code&gt; — when a function is added to a diamond.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;DiamondFunctionReplaced&lt;&#x2F;code&gt; — when a function is replaced in a diamond.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;DiamondFunctionRemoved&lt;&#x2F;code&gt; — when a function is removed from a diamond.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Introspection&lt;&#x2F;strong&gt;
&lt;ul&gt;
&lt;li&gt;A diamond MUST implement the following introspection functions:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;facetAddress(bytes4 _functionSelector)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;functionFacetPairs()&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;receive-function&quot;&gt;&lt;code&gt;receive()&lt;&#x2F;code&gt; function&lt;&#x2F;h3&gt;
&lt;p&gt;A diamond MAY have a &lt;code&gt;receive()&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;immutable-functions&quot;&gt;Immutable Functions&lt;&#x2F;h3&gt;
&lt;p&gt;Definition:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;An immutable function is an external or public function defined directly in a diamond contract, not in a facet.&lt;br &#x2F;&gt;
This definition does not apply to a diamond&#x27;s constructor or the special &lt;code&gt;fallback()&lt;&#x2F;code&gt; and &lt;code&gt;receive()&lt;&#x2F;code&gt; functions.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;A diamond can have zero or more immutable functions.&lt;&#x2F;p&gt;
&lt;p&gt;A diamond with immutable functions has the following additional requirements that MUST be followed:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The &lt;code&gt;DiamondFunctionAdded&lt;&#x2F;code&gt; event MUST be emitted for each immutable function.&lt;&#x2F;li&gt;
&lt;li&gt;Immutable functions MUST be returned by the introspection functions &lt;code&gt;facetAddress(bytes4 _functionSelector)&lt;&#x2F;code&gt; and &lt;code&gt;functionFacetPairs()&lt;&#x2F;code&gt;, where the facet address is the diamond’s own address.&lt;&#x2F;li&gt;
&lt;li&gt;Any upgrade function MUST revert on an attempt to replace or remove an immutable function.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This standard provides standard events and introspection functions so that GUIs, block explorers, command line programs, and other tools and software can detect and interoperate with diamond contracts.&lt;&#x2F;p&gt;
&lt;p&gt;Software can retrieve function selectors and facet addresses from a diamond in order to use and show what functions a diamond has. Function selectors and facet addresses, combined with contract ABIs and verified source code, provide sufficient information for tooling and user interfaces.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;erc-8109-diamonds-vs-erc-2535-diamonds&quot;&gt;ERC-8109 Diamonds vs ERC-2535 Diamonds&lt;&#x2F;h3&gt;
&lt;p&gt;This standard is a simplification and refinement of ERC-2535 Diamonds.&lt;&#x2F;p&gt;
&lt;p&gt;A diamond compliant with ERC-8109 is NOT required to implement ERC-2535.&lt;&#x2F;p&gt;
&lt;p&gt;Here are changes in ERC-8109 Diamonds:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Simplified terminology.&lt;&#x2F;li&gt;
&lt;li&gt;Simplified introspection functions.&lt;&#x2F;li&gt;
&lt;li&gt;Standardized events that are simpler to use and consume.&lt;&#x2F;li&gt;
&lt;li&gt;Optional upgrade path for existing ERC-2535 diamonds.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;diamond-upgrades&quot;&gt;Diamond Upgrades&lt;&#x2F;h3&gt;
&lt;p&gt;This standard does not specify an upgrade function.&lt;&#x2F;p&gt;
&lt;p&gt;This means several things:&lt;&#x2F;p&gt;
&lt;h4 id=&quot;1-diamonds-can-be-immutable&quot;&gt;1. Diamonds Can Be Immutable&lt;&#x2F;h4&gt;
&lt;p&gt;A Diamond does not have to have an upgrade function.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;A diamond can be fully constructed within its constructor function without adding any upgrade function, making it immutable upon deployment.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;A large immutable diamond can be built using well organized facets.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;A diamond can initially be upgradeable, and later made immutable by removing its upgrade function.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;2-other-standards-can-build-on-erc-8109&quot;&gt;2. Other Standards Can Build on ERC-8109&lt;&#x2F;h4&gt;
&lt;p&gt;Other standards can build on ERC-8109 by specifying an upgrade function(s), while remaining compliant with this standard.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;3-you-can-create-your-own-upgrade-functions&quot;&gt;3. You Can Create Your Own Upgrade Functions&lt;&#x2F;h4&gt;
&lt;p&gt;You can design and create your own upgrade functions and remain compliant with this standard. All that is required is that you emit the appropriate add&#x2F;replace&#x2F;remove required events specified in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8109&#x2F;#events&quot;&gt;events section&lt;&#x2F;a&gt;, and that the introspection functions defined in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8109&#x2F;#inspecting-diamonds&quot;&gt;Inspecting Diamonds section&lt;&#x2F;a&gt; continue to accurately return function and facet information.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-considerations&quot;&gt;Gas Considerations&lt;&#x2F;h3&gt;
&lt;p&gt;Routing calls via &lt;code&gt;delegatecall&lt;&#x2F;code&gt; introduces a small amount of gas overhead. In practice, this cost is mitigated by several architectural and tooling advantages enabled by diamonds:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Optional, gas-optimized functionality&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
By structuring functionality across multiple facets, diamonds make it straightforward to include specialized, gas-optimized features without increasing the complexity of core logic.&lt;br &#x2F;&gt;
For example, an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; diamond may implement batch transfer functions in a dedicated facet, improving both gas efficiency and usability while keeping the base ERC-721 implementation simple and well-scoped.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Reduced external call overhead&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
Some contract architectures require multiple external calls within a single transaction. By consolidating related functionality behind a single diamond address, these interactions can execute internally with shared storage and shared authorization, reducing gas costs from external calls and repeated access-control checks.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Selective optimization per facet&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
Because facets are compiled and deployed independently, they may be built with different compiler optimizer settings. This allows gas-critical facets to use aggressive optimization configurations to reduce execution costs, without increasing bytecode size or compilation complexity for unrelated functionality.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;functionfacetpairs-gas-usage&quot;&gt;&lt;code&gt;functionFacetPairs()&lt;&#x2F;code&gt; Gas Usage&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;functionFacetPairs()&lt;&#x2F;code&gt; function is meant to be called off-chain. At this time major RPC providers have a maximum gas limit of about 550 million gas. Gas benchmark tests show that the &lt;code&gt;functionFacetPairs()&lt;&#x2F;code&gt; function can return 60,000 &lt;code&gt;(selector, facet)&lt;&#x2F;code&gt; pairs using less gas than that.&lt;&#x2F;p&gt;
&lt;p&gt;ERC-8109 implementations are free to add iteration or pagination-based introspection functions, but they are not required by this standard.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;storage-layout&quot;&gt;Storage Layout&lt;&#x2F;h3&gt;
&lt;p&gt;Diamonds and facets need to use a storage layout organizational pattern because Solidity’s default storage layout doesn’t support proxy contracts or diamonds. The storage layout technique or pattern to use is not specified in this ERC. However, examples of storage layout patterns that work with diamonds are &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8042&#x2F;&quot;&gt;ERC-8042 Diamond Storage&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7201&#x2F;&quot;&gt;ERC-7201 Namespaced Storage Layout&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;facets-sharing-storage-functionality&quot;&gt;Facets Sharing Storage &amp;amp; Functionality&lt;&#x2F;h3&gt;
&lt;p&gt;Facets are separately deployed, independent units, but can share state and functionality in the following ways:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Facets can share state variables by using the same structs at the same storage positions.&lt;&#x2F;li&gt;
&lt;li&gt;Facets can share internal functions by importing them or inheriting contracts.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;on-chain-facets-can-be-reused-and-composed&quot;&gt;On-chain Facets can be Reused and Composed&lt;&#x2F;h3&gt;
&lt;p&gt;A deployed facet can be used by many diamonds.&lt;&#x2F;p&gt;
&lt;p&gt;It is possible to create and deploy a set of facets that are reused by different diamonds.&lt;&#x2F;p&gt;
&lt;p&gt;The ability to use the same deployed facets for many diamonds has the potential to reduce development time, increase reliability and security, and reduce deployment costs.&lt;&#x2F;p&gt;
&lt;p&gt;It is possible to implement facets in a way that makes them usable&#x2F;composable&#x2F;compatible with other facets.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;function-signature-limitation&quot;&gt;Function Signature Limitation&lt;&#x2F;h3&gt;
&lt;p&gt;A function signature is the name of a function and its parameter types. Example function signature: &lt;code&gt;myfunction(uint256)&lt;&#x2F;code&gt;. A limitation is that two external functions with the same function signature can’t be added to the same diamond at the same time because a diamond, or any contract, cannot have two external functions with the same function signature.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;immutable-functions-considerations&quot;&gt;Immutable Functions Considerations&lt;&#x2F;h3&gt;
&lt;p&gt;Immutable functions offer minor gas savings by avoiding fallback logic and a &lt;code&gt;delegatecall&lt;&#x2F;code&gt;. However, they introduce a second implementation alongside facets, resulting in two ways to provide similar functionality. This increases implementation complexity and cognitive overhead.&lt;&#x2F;p&gt;
&lt;p&gt;A diamond is simpler to implement and understand without immutable functions.&lt;&#x2F;p&gt;
&lt;p&gt;In upgradeable diamonds, immutable functions reduce flexibility, as they cannot be replaced or removed. This limits the ability to evolve, fix, or improve functionality over time.&lt;&#x2F;p&gt;
&lt;p&gt;Immutable functions that read from or write to storage are not isolated from upgrades. Other functions, including upgrade logic, may modify the same storage relied upon by immutable functions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Existing, deployed ERC-2535 Diamonds implementations MAY upgrade to this standard by performing an upgrade that does the following:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Removes the existing upgrade function and adds a new upgrade function that uses the new events.&lt;&#x2F;li&gt;
&lt;li&gt;Adds the new &lt;code&gt;functionFacetPairs()&lt;&#x2F;code&gt; introspection function.&lt;&#x2F;li&gt;
&lt;li&gt;Emits a &lt;code&gt;DiamondFunctionAdded&lt;&#x2F;code&gt; event for every function currently in the diamond, including the new upgrade function and the new &lt;code&gt;functionFacetPairs()&lt;&#x2F;code&gt; function.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Any other upgrade details are implementation specific.&lt;&#x2F;p&gt;
&lt;p&gt;After this upgrade, the diamond is considered compliant with this standard and SHOULD be indexed and treated as a diamond of this standard going forward.&lt;&#x2F;p&gt;
&lt;p&gt;This upgrade acts as a &#x27;state snapshot&#x27;. Indexers only interested in the current state of the diamond can start indexing from this transaction onwards, without needing to parse the legacy &lt;code&gt;DiamondCut&lt;&#x2F;code&gt; history.&lt;&#x2F;p&gt;
&lt;p&gt;To reconstruct the complete upgrade history requires retrieving all the past &lt;code&gt;DiamondCut&lt;&#x2F;code&gt; events as well as all new events defined in this standard.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;erc-2535-diamonds-with-immutable-functions&quot;&gt;ERC-2535 Diamonds with Immutable Functions&lt;&#x2F;h3&gt;
&lt;p&gt;An ERC-2535 diamond that upgrades to this standard and has immutable functions MUST comply with the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8109&#x2F;#immutable-functions&quot;&gt;Immutable Functions&lt;&#x2F;a&gt; section of the Specification.&lt;&#x2F;p&gt;
&lt;p&gt;If the ERC-2535 diamond upgrade function is immutable, then it can&#x27;t be removed. If possible, disable the upgrade function by making its authentication always fail.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;The reference implementation for the &lt;code&gt;facetAddress(bytes4 _functionSelector)&lt;&#x2F;code&gt; and &lt;code&gt;functionFacetPairs()&lt;&#x2F;code&gt; introspection functions is here: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8109&#x2F;.&#x2F;assets&#x2F;DiamondInspectFacet.sol&quot;&gt;DiamondInspectFacet.sol&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;An example implementation of an ERC-8109 diamond is here: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8109&#x2F;.&#x2F;assets&#x2F;DiamondExample.sol&quot;&gt;DiamondExample.sol&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;ownership-and-authentication&quot;&gt;Ownership and Authentication&lt;&#x2F;h3&gt;
&lt;p&gt;The design and implementation of diamond ownership&#x2F;authentication is not part of this standard.&lt;&#x2F;p&gt;
&lt;p&gt;It is possible to create many different authentication or ownership schemes with diamonds. Authentication schemes can be very simple or complex, fine grained or coarse. This proposal does not limit it in any way. For example ownership&#x2F;authentication could be as simple as a single account address having the authority to add&#x2F;replace&#x2F;remove functions. Or a decentralized autonomous organization could have the authority to add&#x2F;replace&#x2F;remove certain functions.&lt;&#x2F;p&gt;
&lt;p&gt;The development of standards and implementations of ownership, control and authentication of diamonds is encouraged.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;transparency&quot;&gt;Transparency&lt;&#x2F;h3&gt;
&lt;p&gt;A diamond emits an event every time a function is added, replaced or removed. Source code can be verified. This enables people and software to monitor changes to a diamond.&lt;&#x2F;p&gt;
&lt;p&gt;Security and domain experts can review a diamond&#x27;s upgrade history.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Domain Architecture for Diamonds</title>
        <published>2025-12-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Hoang</name><uri>https://github.com/0x76agabond</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8110/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-8110-domain-centric-architecture-for-diamonds/27250" />
        

        <id>https://wg-eips.ritovision.com/8110/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:8110"
            label="ERC-8110" />
        

        
        

        
        <summary type="html">An architectural pattern that organizes Diamond storage by domain using ERC-8042 identifiers.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8110/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard introduces a &lt;strong&gt;domain-based architectural pattern&lt;&#x2F;strong&gt; for contracts implementing the Diamond execution model defined by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2535&#x2F;&quot;&gt;ERC-2535 (Diamond Standard)&lt;&#x2F;a&gt; or
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8109&#x2F;&quot;&gt;ERC-8109 (Diamond, Simplified)&lt;&#x2F;a&gt;, together with the storage identifier mechanism defined by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8042&#x2F;&quot;&gt;ERC-8042 (Diamond Storage Identifier)&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;It defines a domain-centric storage management architecture, providing consistent storage identifiers and a structured directory model that decouples storage ownership from facet logic.&lt;&#x2F;p&gt;
&lt;p&gt;This pattern helps reduce storage collisions and human error while enabling better tooling for multi-facet systems.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;ERC-2535 provides a flexible foundation for modular smart contracts through facets, but it intentionally leaves storage organization and architectural conventions open to implementation.&lt;br &#x2F;&gt;
While this flexibility encourages creativity, it can sometimes lead to inconsistency.&lt;br &#x2F;&gt;
Each developer or team may structure storage differently, making it harder to design robust and easy-to-use tooling for storage management.&lt;&#x2F;p&gt;
&lt;p&gt;Without a shared structural framework, storage identifiers may be inconsistently verified or reused across facets, which can result in unexpected collisions or subtle upgrade issues between facets sharing the same state.&lt;&#x2F;p&gt;
&lt;p&gt;ERC-8042 introduced human-readable storage identifiers to improve clarity, but it does not define how those identifiers should be structured or grouped in larger projects.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP proposes a domain-centric architectural pattern that establishes a consistent framework for managing storage independently of facet implementation.&lt;&#x2F;p&gt;
&lt;p&gt;By introducing clear domain boundaries and deterministic naming rules for storage identifiers, the pattern maintains the openness of the Diamond Standard while providing a shared foundation for collaboration, tooling support, and long-term upgrade safety across complex systems.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;1-domain-definition&quot;&gt;1. Domain Definition&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;A &lt;strong&gt;domain&lt;&#x2F;strong&gt; represents the conceptual ownership of a storage space.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Each &lt;strong&gt;domain&lt;&#x2F;strong&gt; corresponds to exactly one storage struct and one identifier.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;A &lt;strong&gt;domain&lt;&#x2F;strong&gt; has a one-to-many relationship with the group of function selectors that access it.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;A &lt;strong&gt;domain&lt;&#x2F;strong&gt; is independent of facets, multiple facets MAY read or modify the same domain.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Domains&lt;&#x2F;strong&gt; SHOULD be defined according to business or system responsibility, not by facet name.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;2-storage-identifier-naming-convention&quot;&gt;2. Storage Identifier Naming Convention&lt;&#x2F;h3&gt;
&lt;p&gt;A storage identifier is the human-readable string whose keccak256 hash defines a Diamond Storage position.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; STORAGE_POSITION &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;meaningful.string&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;It represents the domain that owns and manages a specific storage layout.&lt;br &#x2F;&gt;
To ensure uniqueness and clarity, at a minimum, a storage identifier SHOULD include the following components:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {project}.{domain-name}.{version}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;To improve readability, namespace separation, and tooling support, additional contextual components MAY be included, resulting in the following extended format:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {org}.{project}.{domain-type}.{domain-name}.{version}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;identifier-components&quot;&gt;Identifier Components&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;org&lt;&#x2F;code&gt;&lt;br &#x2F;&gt;
Optional organization or author prefix (e.g., &lt;code&gt;eth&lt;&#x2F;code&gt;, &lt;code&gt;vag&lt;&#x2F;code&gt;, &lt;code&gt;safe&lt;&#x2F;code&gt;)&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;project&lt;&#x2F;code&gt;&lt;br &#x2F;&gt;
Project or protocol name&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;domain-type&lt;&#x2F;code&gt;&lt;br &#x2F;&gt;
Optional classification of the domain. If present, it SHOULD be one of:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;diamond&lt;&#x2F;code&gt; — core Diamond protocol domains, such as upgrade, introspection, and ownership.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;system&lt;&#x2F;code&gt; — shared system-level domains providing cross-cutting functionality. (e.g.,  reentrancy, pause, access control)&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;business&lt;&#x2F;code&gt; — application-specific domains. (tokens, guards, modules)&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;domain-name&lt;&#x2F;code&gt;&lt;br &#x2F;&gt;
Lowercase keyword identifying the storage domain&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;version&lt;&#x2F;code&gt;&lt;br &#x2F;&gt;
Optional storage layout version identifier&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The initial storage layout is conceptually treated as &lt;code&gt;v1&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;If omitted, the identifier refers to this initial (&lt;code&gt;v1&lt;&#x2F;code&gt;) storage layout for backward compatibility.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;v2&lt;&#x2F;code&gt;, &lt;code&gt;v3&lt;&#x2F;code&gt;, … MUST be used for layout-breaking changes.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The version MUST be incremented only when the storage layout is no longer append-only.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Each domain:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;MUST have &lt;strong&gt;one&lt;&#x2F;strong&gt; storage struct and &lt;strong&gt;one&lt;&#x2F;strong&gt; identifier.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;SHOULD be implemented in a dedicated directory named after the domain.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;If new fields are added to a storage struct, they MUST be added only at the end, and the struct MUST remain append-only.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;sub-domain-components&quot;&gt;Sub-domain Components&lt;&#x2F;h3&gt;
&lt;p&gt;A sub-domain represents a storage-isolated vertical extension of an existing domain.&lt;&#x2F;p&gt;
&lt;p&gt;A sub-domain is used when new functionality belongs conceptually to an existing domain, but its required state can be cleanly isolated without modifying or appending to the original domain’s storage layout.&lt;&#x2F;p&gt;
&lt;p&gt;If present, the sub-domain&#x27;s identifier format becomes:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {project}.{domain-name}.{version}.{sub-domain}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;or, when using the extended format:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {org}.{project}.{domain-type}.{domain-name}.{version}.{sub-domain}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The version component indicates the domain version in which the sub-domain was introduced.&lt;br &#x2F;&gt;
It serves as a historical and organizational reference, not as an independent versioning lifecycle for the sub-domain.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Definition and Rules&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;A sub-domain:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;MUST define its own ERC-8042 storage identifier.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;MUST define its own storage layout&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;MUST NOT modify or append to the parent domain’s storage.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;MUST remain conceptually subordinate to the parent domain.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;MUST share the same version context as the parent domain.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;SHOULD be placed alongside the parent domain’s storage definitions.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Sub-domains exist as a safety-oriented design choice to isolate newly introduced state, while preserving the original domain layout unchanged.&lt;&#x2F;p&gt;
&lt;p&gt;Choosing between evolving the existing domain storage or introducing a sub-domain depends on the project’s complexity, the team’s discipline, and long-term maintenance goals.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;3-storage-declaration-requirements&quot;&gt;3. Storage Declaration Requirements&lt;&#x2F;h3&gt;
&lt;p&gt;To support reliable tooling and explicit storage ownership, each domain defined by this proposal MUST declare its storage location using the ERC-8042 NatSpec annotation.&lt;&#x2F;p&gt;
&lt;p&gt;Specifically, the domain-owned storage struct MUST be annotated with:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@custom:storage&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;-location erc8042:&amp;lt;NAMESPACE_ID&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This proposal does not redefine the storage location formula, but requires the use of this annotation to ensure that domain storage is discoverable, unambiguous, and machine-readable.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;example-identifiers&quot;&gt;Example Identifiers&lt;&#x2F;h3&gt;
&lt;p&gt;The extended identifier format is recommended for global uniqueness.
It is especially useful when integrating shared libraries, predefined facets, or other standards, where namespace collisions are more likely.&lt;&#x2F;p&gt;
&lt;p&gt;For application-specific systems, teams may choose a minimal identifier format to reduce naming complexity, as long as the identifier remains stable and unique within the project.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Equipment Identifier&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Represents a business domain responsible for equipment state.
This domain has undergone a layout-breaking change, therefore uses an explicit v2 identifier.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @custom:storage&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;-location erc8042:org.project.business.equipment.v2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Minimal form: project.equipment.v2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; EQUIPMENT_STORAGE_POSITION &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;org.project.business.equipment.v2&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Character Identifier&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Represents a business domain responsible for character state and progression.
This example also demonstrates how a domain can be extended using a storage-isolated sub-domain.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @custom:storage&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;-location erc8042:org.project.business.character.v1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Minimal form: project.character.v1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Main character domain.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; CHARACTER_STORAGE_POSITION &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;org.project.business.character.v1&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @custom:storage&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;-location erc8042:org.project.business.character.v1.mounted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Minimal form: project.character.v1.mounted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sub-domain for global character mounted state.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; CHARACTER_MOUNTED_STORAGE_POSITION &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;org.project.business.character.v1.mounted&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Game Setting Identifier&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Defines a system-level domain for game-wide configuration shared across multiple facets.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @custom:storage&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;-location erc8042:org.project.system.gamesettings&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Minimal form: project.gamesettings&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; GAME_SETTING_STORAGE_POSITION &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;org.project.system.gamesettings&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;4-directory-convention&quot;&gt;4. Directory Convention&lt;&#x2F;h3&gt;
&lt;p&gt;In line with Domain-Driven Design principles, the directory layout SHOULD reflect domain ownership.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Each domain defines a logical namespace for storage ownership&lt;&#x2F;strong&gt;.&lt;br &#x2F;&gt;
Directories are named after this namespace and serve as its physical representation in the codebase.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Facets act as logic containers and do not own storage&lt;&#x2F;strong&gt;.&lt;br &#x2F;&gt;
They MAY reside alongside domain directories or reference domain-owned logic.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Both directory names and storage identifiers SHOULD include domain information&lt;&#x2F;strong&gt;.&lt;br &#x2F;&gt;
This consistency allows tooling and precompilers to automatically associate selectors, domains, and storage layouts.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Each domain SHOULD be represented by a dedicated directory&lt;&#x2F;strong&gt;.&lt;br &#x2F;&gt;
Within this directory, domain-owned logic such as storage layout definitions, internal helper logic, and any facets primarily associated with the domain MAY be organized under subdirectories as needed.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;This structure reduces the risk of storage collisions by design&lt;&#x2F;strong&gt;.&lt;br &#x2F;&gt;
The alignment of domain namespaces, directory layout, and storage identifiers allows file system constraints and static analysis tools to surface conflicts early and reason about upgrades proactively.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;example-directory&quot;&gt;Example Directory&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;em&gt;This directory structure is illustrative and does not mandate a specific naming convention.&lt;&#x2F;em&gt;&lt;br &#x2F;&gt;
&lt;em&gt;Subdirectory names such as &lt;code&gt;storage&#x2F;&lt;&#x2F;code&gt; are illustrative and may contain both storage layout definitions and internal domain logic.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;contracts&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;├── diamond&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│   └── Diamond.sol&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;├── character&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│   ├── storage&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│   │   └── CharacterStorage.sol&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│   └── facets&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│       └── CharacterFacet.sol&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;├── equipment&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│   ├── storage&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│   │   └── EquipmentStorage.sol&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│   └── facets&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│       └── EquipmentFacet.sol&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;└── gamesettings&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ├── storage&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    │   └── GameSettingsStorage.sol&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    └── facets&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        └── GameSettingsFacet.sol&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;5-upgrade-scenarios&quot;&gt;5. Upgrade Scenarios&lt;&#x2F;h3&gt;
&lt;p&gt;This architecture defines upgrade behavior based on &lt;strong&gt;the effect new selectors introduce to domains and storage&lt;&#x2F;strong&gt;, rather than on facets themselves.&lt;&#x2F;p&gt;
&lt;p&gt;Upgrades fall into one of the following cases.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Case 1: No new storage required&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;If new selectors do not require any additional storage:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The selectors MAY be added to existing facets or new facets&lt;&#x2F;li&gt;
&lt;li&gt;The facet SHOULD be placed under an appropriate existing domain&lt;&#x2F;li&gt;
&lt;li&gt;No storage changes are required&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This is the simplest and safest upgrade path, as it introduces no new state and does not affect existing storage layouts.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Case 2: New domain required (horizontal upgrade)&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;If new functionality introduces state that does not logically belong to any existing domain:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A new domain MUST be defined&lt;&#x2F;li&gt;
&lt;li&gt;A new ERC-8042 storage identifier MUST be introduced&lt;&#x2F;li&gt;
&lt;li&gt;A new storage layout MUST be defined for that domain&lt;&#x2F;li&gt;
&lt;li&gt;The facet implementing this functionality SHOULD be placed under the new domain&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This represents a horizontal expansion of the system, allowing new features to be introduced without impacting existing domains or storage layouts.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Case 3: New variables within an existing domain (vertical upgrade)&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;If new selectors require additional state that logically belongs to an existing domain, and the existing storage layout is not broken, this becomes a design trade-off.&lt;&#x2F;p&gt;
&lt;p&gt;Two common approaches MAY be used:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Option A — Evolve the existing domain&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Append new variables to the end of the existing storage layout&lt;&#x2F;li&gt;
&lt;li&gt;Add new selectors to interact with the evolved domain&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This keeps the domain unified and works well for tightly coupled or complex business logic.&lt;br &#x2F;&gt;
It requires strict discipline when managing storage layout.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Option B — Introduce a sub-domain&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Define a sub-domain under the existing domain&lt;&#x2F;li&gt;
&lt;li&gt;Introduce a new storage identifier and layout for the new variables&lt;&#x2F;li&gt;
&lt;li&gt;Leave the original domain storage unchanged&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This approach reduces risk and cognitive load by isolating newly introduced state, while keeping the original domain layout stable.&lt;&#x2F;p&gt;
&lt;p&gt;The choice between these approaches depends on project complexity, team discipline, and long-term maintenance goals.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Case 4: Layout-breaking change&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;If new selectors require a change that breaks the existing storage layout of a domain&lt;br &#x2F;&gt;
(&lt;em&gt;for example, changing the inner structure of nested structs or struct arrays&lt;&#x2F;em&gt;)&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A new, versioned storage identifier MUST be introduced&lt;&#x2F;li&gt;
&lt;li&gt;A new storage layout MUST be defined under that identifier&lt;&#x2F;li&gt;
&lt;li&gt;Any required data migration MUST be handled explicitly by the project&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This architecture does not attempt to automate or abstract storage migration.&lt;br &#x2F;&gt;
The goal is to keep schema changes intentional, visible, and auditable.&lt;&#x2F;p&gt;
&lt;p&gt;If the layout-breaking change is &lt;strong&gt;partial&lt;&#x2F;strong&gt;, and the newly required state can be cleanly isolated and defined independently, developers MAY also consider introducing a &lt;strong&gt;sub-domain&lt;&#x2F;strong&gt; instead of versioning the entire domain.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;From the beginning, the Diamond Standard (ERC-2535) was designed around the relationship between &lt;strong&gt;function selectors&lt;&#x2F;strong&gt; and &lt;strong&gt;storage positions&lt;&#x2F;strong&gt;, not around facets themselves.&lt;br &#x2F;&gt;
Facets are replaceable units of logic — the &lt;code&gt;diamondCut&lt;&#x2F;code&gt; operation only replaces, removes or adds code — but the &lt;strong&gt;storage layout persists&lt;&#x2F;strong&gt; and defines the actual state continuity of the contract.&lt;&#x2F;p&gt;
&lt;p&gt;ERC-8109 itself only defines introspection mechanisms for querying the Diamond and deliberately leaves the upgrade mechanism to implementations or to other standards.&lt;br &#x2F;&gt;
This flexibility is achieved because both introspection facets and upgrade facets interact with the same underlying domain (&lt;code&gt;8109.diamond&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;This demonstrates that &lt;strong&gt;storage belongs to the domain&lt;&#x2F;strong&gt;, not the facet, facets merely provide interfaces for logic to read or mutate that domain.&lt;&#x2F;p&gt;
&lt;p&gt;Over time, many implementations have treated facets as the primary boundary of responsibility, grouping logic and storage together without recognizing that &lt;strong&gt;storage domains&lt;&#x2F;strong&gt; are the true architectural anchors.&lt;br &#x2F;&gt;
This misunderstanding leads to inconsistent storage management, overlapping identifiers and fragile upgrade paths where one facet unintentionally corrupts another’s state.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;strong&gt;domain-centric approach&lt;&#x2F;strong&gt; restores the original intent of the Diamond:&lt;br &#x2F;&gt;
Selectors (facets) operate &lt;em&gt;through&lt;&#x2F;em&gt; domains, not &lt;em&gt;as&lt;&#x2F;em&gt; domains.&lt;br &#x2F;&gt;
Each domain defines its own persistent storage struct and identifier, while facets merely act as interfaces that execute logic against it.&lt;&#x2F;p&gt;
&lt;p&gt;This shift decouples storage from logic when separation is desired, while still allowing tightly coupled designs when intentional.&lt;br &#x2F;&gt;
It enables:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Independent evolution of business logic without rewriting storage.&lt;&#x2F;li&gt;
&lt;li&gt;Clear separation between reusable system components and app-specific domains.&lt;&#x2F;li&gt;
&lt;li&gt;A deterministic mapping between identifiers and state.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;By formalizing this pattern, Diamond Architecture becomes safer, more transparent and easier to extend — re-aligning practice with its original design philosophy.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;special-case-domain-facet-overlap&quot;&gt;Special Case: Domain–Facet Overlap&lt;&#x2F;h3&gt;
&lt;p&gt;There is a special case within the separation principle where a domain (or sub-domain) and its facet are intentionally designed to represent the same logical entity.&lt;&#x2F;p&gt;
&lt;p&gt;In this scenario, the facet implements all functions belonging to its domain.
This reduces flexibility, but improves encapsulation and self-containment, making the facet behave like a reusable application module rather than a low-level primitive.&lt;&#x2F;p&gt;
&lt;p&gt;A concrete example of this approach can be found in the &lt;code&gt;Compose project&lt;&#x2F;code&gt;.&lt;br &#x2F;&gt;
In Compose, a facet and its associated sub-domain are explicitly mapped into a single entity, enabling the creation of predefined, plug-and-play standard facets.&lt;&#x2F;p&gt;
&lt;p&gt;This approach is suitable for systems that prioritize modular composition and standardized functionality, allowing developers to safely integrate common features with predictable behavior.&lt;br &#x2F;&gt;
However, when implementing custom or project-specific logic, domains and facets SHOULD still be treated as separate entities.&lt;&#x2F;p&gt;
&lt;p&gt;Maintaining this separation preserves clarity of ownership, supports future upgrades, and supports the long-term evolution of application-level Diamond architectures.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;sub-domains-and-layout-sensitive-state&quot;&gt;Sub-domains and Layout-Sensitive State&lt;&#x2F;h3&gt;
&lt;p&gt;Sub-domains can also serve as a practical way to isolate layout-sensitive state.&lt;&#x2F;p&gt;
&lt;p&gt;Projects that need to move quickly may choose to place complex or layout-unstable data (such as mappings or dynamic arrays) in a primary domain, while isolating smaller or more compact state in sub-domains.&lt;&#x2F;p&gt;
&lt;p&gt;As development progresses, additional state can either be appended to an existing domain or introduced via a sub-domain, depending on data shape and evolution needs.&lt;&#x2F;p&gt;
&lt;p&gt;This allows projects to start with a simple structure while preserving flexibility to refine storage organization as the system scales.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;isolated-domain&quot;&gt;Isolated Domain&lt;&#x2F;h3&gt;
&lt;p&gt;An isolated domain describes a conceptual separation between a domain and function- or facet-level logic.&lt;&#x2F;p&gt;
&lt;p&gt;In this model, a domain defines its own storage access helpers.
Facets and their functions interact with domain-owned state through these helpers, rather than accessing storage layouts directly.&lt;&#x2F;p&gt;
&lt;p&gt;This approach makes data access logic explicit at the domain level, while allowing facets to focus on business logic and coordination.&lt;&#x2F;p&gt;
&lt;p&gt;A domain may be fully isolated, partially isolated, or not isolated, depending on project needs.&lt;&#x2F;p&gt;
&lt;p&gt;This concept is particularly useful when functions or facets need to coordinate state across multiple domains or sub-domains, as it helps keep cross-domain interactions consistent and easier to reason about.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal is fully backward-compatible with ERC-2535 (Diamond Standard), ERC-8042 (Diamond Storage Identifier) and ERC-8109 (Diamond, Simplified).
It introduces no breaking changes, no new opcodes, and no modifications to existing protocol mechanics.&lt;&#x2F;p&gt;
&lt;p&gt;It does not alter the execution model defined by ERC-2535 or ERC-8109.
The relationships between facets, selectors, and shared storage remain unchanged and fully compatible across all three standards.&lt;&#x2F;p&gt;
&lt;p&gt;Instead, this proposal defines an architectural convention that complements existing Diamond standards by:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Reinforcing modularity and upgrade safety established by ERC-2535 and ERC-8109&lt;&#x2F;li&gt;
&lt;li&gt;Extending the human-readable storage identifier design introduced by ERC-8042&lt;&#x2F;li&gt;
&lt;li&gt;Providing a domain-based approach to storage ownership and organization&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This architecture may be applied to contracts implementing either ERC-2535 or ERC-8109, as both share the same fundamental facet and selector architecture.&lt;&#x2F;p&gt;
&lt;p&gt;Developers are encouraged to continue following all applicable standards to maintain interoperability while benefiting from clearer state ownership, reduced storage collision risk, and lower architectural complexity.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;adoption-for-deployed-systems&quot;&gt;Adoption for Deployed Systems&lt;&#x2F;h3&gt;
&lt;p&gt;For already deployed systems, adoption can be done incrementally.&lt;&#x2F;p&gt;
&lt;p&gt;The Domain Architecture does not require projects to modify, rename, or refactor existing libraries or other standards in order to adopt it.
If a library or standard already follows ERC-2535, ERC-8042, or uses its own established storage identifiers, that code SHOULD remain unchanged.&lt;&#x2F;p&gt;
&lt;p&gt;Adoption MAY begin at the application layer, without touching shared libraries or standardized components.
Existing storage identifiers MAY be treated conceptually as pre-v1 domains.&lt;&#x2F;p&gt;
&lt;p&gt;In practice, projects typically start by:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Defining clear domain boundaries&lt;&#x2F;li&gt;
&lt;li&gt;Organizing directories around domain responsibility&lt;&#x2F;li&gt;
&lt;li&gt;Grouping facets and their related storage by domain&lt;&#x2F;li&gt;
&lt;li&gt;Explicitly declaring storage ownership using the ERC-8042 &lt;code&gt;@custom:storage-location&lt;&#x2F;code&gt; annotation&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Adopting the Domain Architecture does not require migrating existing state.
It primarily affects how new storage is introduced and how future upgrades are structured.&lt;&#x2F;p&gt;
&lt;p&gt;When a layout-breaking change is required, a new versioned storage identifier can be introduced explicitly,
allowing existing storage layouts to remain untouched.
Any data migration, if needed, MUST be handled explicitly by the project.&lt;&#x2F;p&gt;
&lt;p&gt;The primary consideration during adoption is identifier uniqueness.
New storage identifiers MUST NOT collide with existing identifiers from shared libraries or from within the project itself.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Minimal implementation examples demonstrating the convention:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Business Domain (Equipment)&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @custom:storage&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;-location erc8042:org.project.business.equipment.v2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Minimal form: project.equipment.v2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; EQUIPMENT_STORAGE_POSITION &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;org.project.business.equipment.v2&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Equipment&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint8&lt;&#x2F;span&gt;&lt;span&gt; itemType&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint16&lt;&#x2F;span&gt;&lt;span&gt; power&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint8&lt;&#x2F;span&gt;&lt;span&gt; rarity&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; effectOwner&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;   &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EquipmentStorage&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Equipment&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; items&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; itemId =&amp;gt; Equipment&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; equipmentStorage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;EquipmentStorage&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; storage&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; s&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; position &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; EQUIPMENT_STORAGE_POSITION&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            s&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span&gt; position&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Business Domain (Character)&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @custom:storage&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;-location erc8042:org.project.business.character.v1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Minimal form: project.character.v1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Main character domain.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; CHARACTER_STORAGE_POSITION &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;org.project.business.character.v1&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Character&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint32&lt;&#x2F;span&gt;&lt;span&gt; level&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; hp&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; equipment slot =&amp;gt; itemId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; e.g. slot: head, chest, weapon, boots...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; equippedItemId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CharacterStorage&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Character&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; characters&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; characterStorage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;CharacterStorage&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; storage&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; s&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; position &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; CHARACTER_STORAGE_POSITION&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            s&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span&gt; position&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @custom:storage&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;-location erc8042:org.project.business.character.v1.mounted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Minimal form: project.character.v1.mounted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sub-domain for global character mounted state.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; CHARACTER_MOUNTED_STORAGE_POSITION &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;org.project.business.character.v1.mounted&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CharacterMountedStorage&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Global character state, persists across character switches&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span&gt; isMounted&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; characterMountedStorage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;CharacterMountedStorage&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; storage&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; s&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; position &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;  CHARACTER_MOUNTED_STORAGE_POSITION&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            s&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span&gt; position&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;System Domain (Game Settings)&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @custom:storage&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;-location erc8042:org.project.system.gamesettings&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Minimal form: project.gamesettings&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; GAME_SETTING_STORAGE_POSITION &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;org.project.system.gamesettings&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; GameSettingStorage&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; balancePatchBlock&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; rulesetHash&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint32&lt;&#x2F;span&gt;&lt;span&gt; gameVersion&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint32&lt;&#x2F;span&gt;&lt;span&gt; seasonId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span&gt; tradingEnabled&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span&gt; craftingEnabled&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span&gt; pvpEnabled&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; gameSettingsStorage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;GameSettingStorage&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; storage&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; s&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; position &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; GAME_SETTING_STORAGE_POSITION&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            s&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span&gt; position&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Each domain defines and owns its storage independently.
Facets interact with domain-owned storage definitions, supporting safe upgrades and avoiding unintended storage overlap.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This pattern strengthens the security model of Diamond-based systems by introducing explicit and deterministic storage identifiers.&lt;&#x2F;p&gt;
&lt;p&gt;By separating domains and enforcing consistent naming rules, it reduces the risk of:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Storage collisions between unrelated facets or upgrades.&lt;&#x2F;li&gt;
&lt;li&gt;Human errors caused by inconsistent or reused identifiers.&lt;&#x2F;li&gt;
&lt;li&gt;State corruption during upgrades or extensions.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Each domain owns its ERC-8042 storage identifier.
When combined with append-only storage layout upgrades, this allows storage evolution without interfering with existing state.&lt;&#x2F;p&gt;
&lt;p&gt;This clarity also improves auditability and supports static analysis tooling when analyzing storage safety across upgrades.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Call and Return Opcodes for the EVM</title>
        <published>2025-12-17T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Greg Colvin</name><uri>https://github.com/gcolvin</uri>
	</author>
	
	<author>
		<name>Martin Holst Swende</name><uri>https://github.com/holiman</uri>
	</author>
	
	<author>
		<name>Brooklyn Zelenka</name><uri>https://github.com/expede</uri>
	</author>
	
	<author>
		<name>John Max Skaller</name><email>skaller@internode.on.net</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7979/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7951-call-and-return-opcodes-for-the-evm/24615" />
        

        <id>https://wg-eips.ritovision.com/7979/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7979"
            label="EIP-7979" />
        

        
        

        
        <summary type="html">Three new instructions to support calls and returns, with optional validated control flow.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7979/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This is the smallest possible change to the EVM to support calls and returns.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal introduces three new control-flow instructions to the EVM:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;CALLSUB&lt;&#x2F;code&gt; transfers control to the &lt;code&gt;destination&lt;&#x2F;code&gt; on the &lt;code&gt;stack&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ENTERSUB&lt;&#x2F;code&gt; marks a &lt;code&gt;CALLSUB&lt;&#x2F;code&gt; destination.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RETURNSUB&lt;&#x2F;code&gt; returns to the &lt;code&gt;PC&lt;&#x2F;code&gt; after the most recent &lt;code&gt;CALLSUB&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Code can also be prefixed with &lt;code&gt;MAGIC&lt;&#x2F;code&gt; bytes.  The complete control flow of &lt;code&gt;MAGIC&lt;&#x2F;code&gt; code can be traversed in time and space linear in the size of the code, enabling tools for validation, static analysis, and AOT and JIT compilers.  On-chain, &lt;code&gt;MAGIC&lt;&#x2F;code&gt; code is validated at &lt;code&gt;CREATE&lt;&#x2F;code&gt; time to ensure that it cannot execute invalid instructions, jump to invalid locations, underflow stack, or, in the absence of recursion, overflow stack.&lt;&#x2F;p&gt;
&lt;p&gt;These changes are backwards-compatible: all instructions behave as specified whether or not they appear in &lt;code&gt;MAGIC&lt;&#x2F;code&gt; code.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;In 2016 the lead author set out to write a compiler from the EVM to code for virtual or real register machines.  The design was simple -- traverse the EVM stack code in one pass, emitting register code for the target machine.  I was immediately stymied by the presence of dynamic jumps, which demand, worst case, a quadratic number of passes. &lt;em&gt;Dynamic jumps must die.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;How to kill them?  First, some history.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;babbage-1833-jumps-and-conditional-jumps&quot;&gt;Babbage, 1833: Jumps and conditional jumps&lt;&#x2F;h3&gt;
&lt;p&gt;In 1833 Charles Babbage began the design of a steam-powered, mechanical, Turing-complete computer.  Programs were to be encoded on punched cards which controlled a system of rods, gears and other machinery to implement storage, arithmetic, jumps, and conditional jumps.  Jumps were supported by a mechanism for shuffling forwards or backwards through the cards.  Its first published description was by L. F. Menabre, 1842&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-1-1&quot;&gt;&lt;a href=&quot;#fn-1&quot;&gt;1&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;.  The translator, Ada Augusta, Countess of Lovelace, made extensive notes.  The notes include her famous program for recursively computing Bernoulli numbers — arguably the world&#x27;s first complete computer program — which used conditional jumps to implement the required nested loops.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;turing-1945-calls-and-returns&quot;&gt;Turing, 1945: Calls and returns&lt;&#x2F;h3&gt;
&lt;p&gt;In 1945 Turing proposed his Automatic Computing Engine&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-3-1&quot;&gt;&lt;a href=&quot;#fn-3&quot;&gt;2&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;, where he introduced the concept of calls and returns:  &lt;em&gt;&quot;To start on a subsidiary operation we need only make a note of where we left off the major operation and then apply the first instruction of the subsidiary. When the subsidiary is over we look up the note and continue with the major operation.&quot;&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The ACE supported calls directly with a stack of mercury-filled memory crystals holding return addresses.  Turing&#x27;s design was for a 32-bit RISC machine with vacuum tube integer hardware, floating point microcode, 32 registers, a 1024-entry return stack, and 32K of RAM on a 1 MHz bus.  The smaller Pilot ACE was for a while the world&#x27;s fastest computer.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;lovelace-turing-an-aside-on-machine-intelligence&quot;&gt;Lovelace &amp;amp; Turing: An aside on machine intelligence&lt;&#x2F;h4&gt;
&lt;p&gt;In Lady Lovelace&#x27;s notes we find her prescient recognition of the Analytic Engine&#x27;s power:  &quot;In enabling mechanism to combine together general symbols in successions of unlimited variety and extent, a uniting link is established between the operations of matter and the abstract mental processes of the most abstract branch of mathematical science.&quot;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-1-2&quot;&gt;&lt;a href=&quot;#fn-1&quot;&gt;1&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;  Here also we find her recognition of its limits:  &quot;It can do whatever we know how to order it to perform. It can follow analysis; but it has no power of anticipating any analytical relations or truths. Its province is to assist us in making available what we are already acquainted with.&quot;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-1-3&quot;&gt;&lt;a href=&quot;#fn-1&quot;&gt;1&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;&lt;&#x2F;p&gt;
&lt;p&gt;In 1950 Alan Turing answered &quot;Lady Lovelace&#x27;s Objection&quot; with a question of his own:  &quot;The majority of minds seem to be &#x27;subcritical&#x27; ... an idea presented to such a mind will on average give rise to less than one idea in reply. A smallish proportion are supercritical. An idea presented to such a mind that may give rise to a whole &#x27;theory&#x27; consisting of secondary, tertiary and more remote ideas... we ask, &#x27;Can a machine be made to be supercritical?&#x27;&quot;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-2-1&quot;&gt;&lt;a href=&quot;#fn-2&quot;&gt;3&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;industry-practice-1945-2025&quot;&gt;Industry practice: 1945 - 2025&lt;&#x2F;h3&gt;
&lt;p&gt;Call and return facilities of various levels of complexity have proven their worth across a long line of important machines over the last 80 years:  Burroughs&#x27; baroque ALGOL support, Intel&#x27;s simple &lt;code&gt;CALL&lt;&#x2F;code&gt; and &lt;code&gt;RET&lt;&#x2F;code&gt;, RISC-V&#x27;s subtly dynamic &lt;code&gt;JAL&lt;&#x2F;code&gt; and &lt;code&gt;JALR&lt;&#x2F;code&gt;, ARM&#x27;s bare mimimum &lt;code&gt;BL&lt;&#x2F;code&gt;, and some such facility on most every other machine we have programmed or implemented: physical machines including the, CDC 7600, IBM 360, PDP-11, VAX, Motorola 68000, and others, as well as virtual machines for Scheme, Forth, Pascal, Java, Wasm, .NET and others.&lt;&#x2F;p&gt;
&lt;p&gt;Especially relevant to the EVM&#x27;s design are the Java, Wasm, and .NET VMs.  They share some important features: their programs are all&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;represented with a portable bytecode that&lt;&#x2F;li&gt;
&lt;li&gt;can be directly interpreted and&lt;&#x2F;li&gt;
&lt;li&gt;can be validated before runtime&lt;&#x2F;li&gt;
&lt;li&gt;to have static control flow that&lt;&#x2F;li&gt;
&lt;li&gt;can be compiled to machine code&lt;&#x2F;li&gt;
&lt;li&gt;with a one-pass JIT.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;We propose that the EVM should share these features.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;the-evm-control-flow-facility&quot;&gt;The EVM control-flow facility&lt;&#x2F;h3&gt;
&lt;p&gt;Unlike these machines, the Ethereum Virtual Machine &lt;em&gt;does not&lt;&#x2F;em&gt; provide facilities for calls and returns. Instead, they must be synthesized using the dynamic &lt;code&gt;JUMP&lt;&#x2F;code&gt; instruction, which takes its argument on the stack. Further, the EVM provides &lt;em&gt;only&lt;&#x2F;em&gt; this jump.  The EVM&#x27;s dynamic jump causes problems. First, the need to synthesize static jumps and calls with dynamic jumps wastes some space and gas.  The much bigger problem is this: jumps that can dynamically branch to any destination in the program can cause quadratic &quot;path explosions&quot; when traversing the program&#x27;s flow of control.  We will give more detailed explanations in the Rationale.&lt;&#x2F;p&gt;
&lt;p&gt;Dynamic jumps are common enough in physical machines, whose instruction sets are of course optimized for physical performance, but less so in virtual machines, whose code is often the source for JIT compilers and other downstream tools — a JIT compiler that can take quadratic time is less than useful.  For this reason the Java, Wasm, and .NET VMs do not support dynamic jumps.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-dynamic-jumps-must-die&quot;&gt;Why dynamic jumps must die&lt;&#x2F;h3&gt;
&lt;p&gt;For Ethereum, quadratic traversal times are a denial-of-service vulnerability for any online static analysis, including validating EVM bytecode and translating its virtual stack code to other representations such as virtual register code and machine code -- whether AOT at initialization time, or JIT at runtime.&lt;&#x2F;p&gt;
&lt;p&gt;Even offline, dynamic jumps (and the lack of calls and returns) can cause static analyses of many contracts to become impractical, intractable or even impossible.  The following are quotes from the abstracts for just a few recent papers on the problem:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&quot;Ethereum smart contracts are distributed programs running on top of the Ethereum blockchain. Since program flaws can cause significant monetary losses and can hardly be fixed due to the immutable nature of the blockchain, there is a strong need of automated analysis tools which provide formal security guarantees. Designing such analyzers, however, proved to be challenging and error-prone.&quot;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-4-1&quot;&gt;&lt;a href=&quot;#fn-4&quot;&gt;4&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&quot;The EVM language is a simple stack-based language ... with one significant difference between the EVM and other virtual machine languages (like Java Bytecode or CLI for .Net programs): the use of the stack for saving the jump addresses instead of having it explicit in the code of the jumping instructions. Static analyzers need the complete control-flow graph (CFG) of the EVM program in order to be able to represent all its execution paths.&quot;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-5-1&quot;&gt;&lt;a href=&quot;#fn-5&quot;&gt;5&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&quot;Static analysis approaches mostly face the challenge of analyzing compiled Ethereum bytecode... However, due to the intrinsic complexity of Ethereum bytecode (especially in jump resolution), static analysis encounters significant obstacles.&quot;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-6-1&quot;&gt;&lt;a href=&quot;#fn-6&quot;&gt;6&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&quot;Analyzing contract binaries is vital ... comprising function entry identification and detecting its boundaries... Unfortunately, it is challenging to identify functions ... due to the lack of internal function call statements.&quot;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-7-1&quot;&gt;&lt;a href=&quot;#fn-7&quot;&gt;7&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;There is an entire academic literature of complex, incomplete solutions to problems like these that this proposal, others before it, and the design of other VMs render trivial.&lt;&#x2F;p&gt;
&lt;p&gt;With so much at stake on the blockchain -- currently valued at over 6000 metric tonnes of gold -- deploying correct contracts is imperative — there is no reason for the EVM to make that job any more difficult than necessary.  Especially when it is so easy to fix.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;taming-the-evm&quot;&gt;Taming the EVM&lt;&#x2F;h3&gt;
&lt;p&gt;To prevent control-flow traversal from &quot;going quadratic&quot; we must prevent the dynamic use of jumps.  On-chain, most uses of &lt;code&gt;JUMP&lt;&#x2F;code&gt; and &lt;code&gt;JUMPI&lt;&#x2F;code&gt; are preceded by a &lt;code&gt;PUSH&lt;&#x2F;code&gt; — that is, they are effectively static.  So not quite dead, but provably paralyzed.  This proposal &lt;em&gt;requires&lt;&#x2F;em&gt; that in &lt;code&gt;valid&lt;&#x2F;code&gt; code &lt;code&gt;JUMP&lt;&#x2F;code&gt; and &lt;code&gt;JUMPI&lt;&#x2F;code&gt; are &lt;em&gt;always&lt;&#x2F;em&gt; used statically.  Currently, the only places that jumps &lt;em&gt;must&lt;&#x2F;em&gt; be used dynamically are to support calls and returns.  For that purpose we propose &lt;code&gt;CALLSUB&lt;&#x2F;code&gt; and &lt;code&gt;RETURNSUB&lt;&#x2F;code&gt; opcodes as replacements.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;The key words MUST and MUST NOT in this Specification are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h3 id=&quot;callsub-0x&quot;&gt;&lt;code&gt;CALLSUB (0x..)&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Transfers control to a subsidiary operation.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Pop the &lt;code&gt;destination&lt;&#x2F;code&gt; on top on the &lt;code&gt;stack&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Push the current &lt;code&gt;PC + 1&lt;&#x2F;code&gt; to the &lt;code&gt;return stack&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Set &lt;code&gt;PC&lt;&#x2F;code&gt; to &lt;code&gt;destination&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The gas cost is &lt;em&gt;mid&lt;&#x2F;em&gt; (&lt;code&gt;8&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;entersub-0x&quot;&gt;&lt;code&gt;ENTERSUB (0x..)&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;destination&lt;&#x2F;code&gt; of every &lt;code&gt;CALLSUB&lt;&#x2F;code&gt; MUST be an &lt;code&gt;ENTERSUB&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;returnsub-0x&quot;&gt;&lt;code&gt;RETURNSUB (0x..)&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Returns control to the caller of a subsidiary operation.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Pop the &lt;code&gt;return stack&lt;&#x2F;code&gt; to &lt;code&gt;PC&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The gas cost is &lt;em&gt;low&lt;&#x2F;em&gt; (&lt;code&gt;5&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;magic-0xef&quot;&gt;&lt;code&gt;MAGIC (0xEF....)&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;After this EIP has been activated code beginning with the &lt;code&gt;MAGIC&lt;&#x2F;code&gt; bytes MUST be a &lt;code&gt;valid&lt;&#x2F;code&gt; program.  Execution begins immediately after the &lt;code&gt;MAGIC&lt;&#x2F;code&gt; bytes.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Notes:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Values popped off the &lt;code&gt;return stack&lt;&#x2F;code&gt; do not need to be validated, since they are alterable only by &lt;code&gt;CALLSUB&lt;&#x2F;code&gt; and &lt;code&gt;RETURNSUB&lt;&#x2F;code&gt;.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;The description above lays out the semantics of these instructions in terms of a &lt;code&gt;return stack&lt;&#x2F;code&gt;.  But the actual state of the &lt;code&gt;return stack&lt;&#x2F;code&gt; is not observable by EVM code or consensus-critical to the protocol.  (For example, a node implementer may code &lt;code&gt;CALLSUB&lt;&#x2F;code&gt; to unobservably push &lt;code&gt;PC&lt;&#x2F;code&gt; on the &lt;code&gt;return stack&lt;&#x2F;code&gt; rather than &lt;code&gt;PC + 1&lt;&#x2F;code&gt;, which is allowed so long as &lt;code&gt;RETURNSUB&lt;&#x2F;code&gt; observably returns control to the &lt;code&gt;PC + 1&lt;&#x2F;code&gt; location.)&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;Opcode and &lt;code&gt;MAGIC&lt;&#x2F;code&gt; values are still to be determined.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;costs&quot;&gt;Costs&lt;&#x2F;h3&gt;
&lt;p&gt;A &lt;em&gt;mid&lt;&#x2F;em&gt; cost for &lt;code&gt;CALLSUB&lt;&#x2F;code&gt; is justified by it taking very little more work than the &lt;em&gt;mid&lt;&#x2F;em&gt; cost of &lt;code&gt;JUMP&lt;&#x2F;code&gt; — just pushing an integer to the &lt;code&gt;return stack&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;A &lt;em&gt;jumpdest&lt;&#x2F;em&gt; cost for &lt;code&gt;ENTERSUB&lt;&#x2F;code&gt; is justified by it being, like &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt;, a mere label.&lt;&#x2F;p&gt;
&lt;p&gt;A &lt;em&gt;low&lt;&#x2F;em&gt; cost for &lt;code&gt;RETURNSUB&lt;&#x2F;code&gt; is justified by needing only to pop the &lt;code&gt;return stack&lt;&#x2F;code&gt; into the &lt;code&gt;PC&lt;&#x2F;code&gt; — less work than a jump.&lt;&#x2F;p&gt;
&lt;p&gt;Benchmarking will be needed to tell if the costs are well-balanced.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;validity&quot;&gt;Validity&lt;&#x2F;h3&gt;
&lt;p&gt;Execution is defined in the Yellow Paper as a sequence of changes to the EVM state. The conditions on &lt;code&gt;valid&lt;&#x2F;code&gt; code are preserved by state changes. At runtime, if execution of an instruction would violate a condition the execution is in an exceptional halting state and cannot continue. The Yellow Paper defines six such states.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;State modification during a static call&lt;&#x2F;li&gt;
&lt;li&gt;Insufficient gas&lt;&#x2F;li&gt;
&lt;li&gt;More than 1024 stack items&lt;&#x2F;li&gt;
&lt;li&gt;Insufficient stack items&lt;&#x2F;li&gt;
&lt;li&gt;Invalid jump destination&lt;&#x2F;li&gt;
&lt;li&gt;Invalid instruction&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;We would like to consider EVM code &lt;code&gt;valid&lt;&#x2F;code&gt; iff no execution of the program can lead to an exceptional halting state. In practice, we must test at runtime for the first three conditions.  We don&#x27;t know whether we will be called statically.  We don&#x27;t know how much gas there will be, and we don&#x27;t know how deep a recursion may go.  (However, we can validate that non-recursive programs do not overflow stack.)  All of the remaining conditions MUST be validated statically.  To allow for efficient algorithms our validation does not consider the codes data and computations, only its control flow and stack use. This means we will reject programs with invalid code paths, even if those paths are not reachable.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;constraints-on-valid-code&quot;&gt;Constraints on &lt;code&gt;valid&lt;&#x2F;code&gt; code&lt;&#x2F;h4&gt;
&lt;p&gt;Code beginning with &lt;code&gt;MAGIC&lt;&#x2F;code&gt; MUST be &lt;code&gt;valid&lt;&#x2F;code&gt;.  Constraints on &lt;code&gt;valid&lt;&#x2F;code&gt; code MUST be validated at &lt;code&gt;CREATE&lt;&#x2F;code&gt; time, in time and space linear in the size of the code.  The constraints on &lt;code&gt;valid&lt;&#x2F;code&gt; code are as follows.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;All executable opcodes must be &lt;code&gt;valid&lt;&#x2F;code&gt;:
&lt;ul&gt;
&lt;li&gt;They MUST have been defined in the Yellow Paper or a deployed EIP and&lt;&#x2F;li&gt;
&lt;li&gt;MUST NOT have been deprecated in a subsequent deployed EIP.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;INVALID&lt;&#x2F;code&gt; opcode is &lt;code&gt;valid&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;JUMP&lt;&#x2F;code&gt; and &lt;code&gt;JUMPI&lt;&#x2F;code&gt; instructions MUST be preceded by a &lt;code&gt;PUSH&lt;&#x2F;code&gt; instruction.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;JUMP&lt;&#x2F;code&gt; and &lt;code&gt;JUMPI&lt;&#x2F;code&gt; instructions MUST NOT address immediate data, and MUST address a &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;CALLSUB&lt;&#x2F;code&gt; instruction MUST be preceded by a &lt;code&gt;PUSH&lt;&#x2F;code&gt; instruction.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;CALLSUB&lt;&#x2F;code&gt; instruction MUST NOT address immediate data, and MUST address an &lt;code&gt;ENTERSUB&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The number of items on the &lt;code&gt;data stack&lt;&#x2F;code&gt; MUST always be positive and less than or equal to 1024.&lt;&#x2F;li&gt;
&lt;li&gt;The number of items on the &lt;code&gt;return stack&lt;&#x2F;code&gt; MUST always be positive and less than or equal to 1024.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;stack height&lt;&#x2F;code&gt; is the absolute difference between the current &lt;code&gt;stack pointer&lt;&#x2F;code&gt; and the &lt;code&gt;stack pointer&lt;&#x2F;code&gt; at the most recent &lt;code&gt;ENTERSUB&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;ul&gt;
&lt;li&gt;During execution the &lt;code&gt;stack height&lt;&#x2F;code&gt; MUST be &lt;em&gt;the same&lt;&#x2F;em&gt; for every &lt;code&gt;PC&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The guarantee of constant stack height prevents stack underflow, breaks cycles in the control flow, ensures finite stack use for non-recursive programs, enables one-pass recovery of control-flow, and allows virtual stack code to be directly serialized into virtual register code for faster interpretation and compilation to machine code.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Note: The JVM, Wasm and .NET VMs enforce similar constraints for similar reasons.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;validation&quot;&gt;Validation&lt;&#x2F;h4&gt;
&lt;p&gt;The above is a purely semantic specification, placing no constraints on the syntax of bytecode beyond being an array of opcodes and immediate data.  &quot;Subsidiary operations&quot; here are not contiguous sequences of bytecode: they are subgraphs of the bytecode&#x27;s full control-flow graph.  The EVM is a simple state machine, and the control-flow graph for a program represents every possible change of state.  Each instruction simply advances the state machine one more step, and state has no syntactic structure.  We only promise that &lt;code&gt;valid&lt;&#x2F;code&gt; code will not, as it were, jam up the gears of the machine.&lt;&#x2F;p&gt;
&lt;p&gt;Rather than enforce semantic constraints via syntax — as is done by higher-level languages — this proposal enforces them via validation: &lt;code&gt;MAGIC&lt;&#x2F;code&gt; code is proven &lt;code&gt;valid&lt;&#x2F;code&gt; at &lt;code&gt;CREATE&lt;&#x2F;code&gt; time. The constraints above MUST be proven true in time and space linear in the size of the code.  We provide a simple algorithm below for doing so -- there are better ones.&lt;&#x2F;p&gt;
&lt;p&gt;With no syntactic constraints and minimal semantic constraints we maximize opportunities for optimizations, including tail call elimination, multiple-entry calls, efficient register allocation, and inter-procedural optimizations.  Since we want to support online compilation of EVM code to native code it is crucial that the EVM code be as well optimized as possible by our HLL compilers — upfront and offline.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;how-can-dynamic-jumps-cause-quadratic-control-flow&quot;&gt;How can dynamic jumps cause quadratic control flow?&lt;&#x2F;h3&gt;
&lt;p&gt;Static analysis amounts to most anything you can do with a program without actually running it.  And traversing the flow of control — in a way that follows every possible path only once — is a fundamental first step for many static analyses, especially for recovering control-flow graphs.  When all jumps are static the number of steps is linear in the number of instructions: a fixed number of paths must be explored for each jump.  But with dynamic jumps every possible destination must be explored at every jump: at worst, the number of steps can be quadratic in the number of instructions.&lt;&#x2F;p&gt;
&lt;p&gt;Consider these three programs.  They make for nice exploits, especially as they get longer.  It&#x27;s not important that at runtime &lt;code&gt;gas&lt;&#x2F;code&gt; isn&#x27;t random or that the &lt;code&gt;jump&lt;&#x2F;code&gt; will most often fail -- what matters is that it is impossible to know at static analysis time where the jumps go, so every destination must be explored.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   jumpdest           jumpdest          jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   gas                gas               gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   jump               jump              jump&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   jumpdest           jumpdest          jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   gas                gas               gas      &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   jump               jump              jump&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   jumpdest           jumpdest          jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   stop               gas               gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                      jump              jump&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                      jumpdest          jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                      stop              gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                        jump&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                        jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                        stop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;And consider the control-flow graphs for these programs.  Each block of instructions in a graph is a sequence from the above programs with one entry (a &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt;) and one exit (a &lt;code&gt;JUMP&lt;&#x2F;code&gt;), and each arc is a transfer of control.  Arcs on the left are backwards branches, arcs on the right are forwards branches.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7979&#x2F;.&#x2F;assets&#x2F;control-flow.png&quot; alt=&quot;Control-Flow Graphs&quot; &#x2F;&gt;
&lt;em&gt;Graph may be outdated&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Note that the number of arcs in a graph is equal to the number of blocks minus one, squared.  That is, the number of possible paths of control flow, and thus the time needed to traverse them all, is quadratic in the size of the program.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;do-we-save-on-code-size-and-gas&quot;&gt;Do we save on code size and gas?&lt;&#x2F;h3&gt;
&lt;p&gt;The difference these instructions make can be seen in this very simple code for calling a routine that squares a number.  The distinct opcodes make it easier for both people and tools to understand the code, and there are modest savings in code size and gas costs as well.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SQUARE:                           |       SQUARE:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    jumpdest       ; 1 gas        |           entersub       ; 1 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    dup            ; 3 gas        |           dup            : 5 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    mul            ; 5 gas        |           mul            ; 5 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    swap1          ; 3 gas        |           returnsub      ; 5 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    jump           ; 8 gas        |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                  |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CALL_SQUARE:                      |       CALL_SQUARE:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    jumpdest       ; 1 gas        |           entersub       ; 1 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    push RTN_CALL  ; 3 gas        |           push 2         ; 3 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    push 2         ; 3 gas        |           push SQUARE    ; 3 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    push SQUARE    ; 3 gas        |           callsub        ; 8 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    jump           ; 8 gas        |           returnsub      ; 5 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;RTN_CALL:                         |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    swap1          ; 3 gas        |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    jump           ; 8 gas        |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                  |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Size in bytes: 18                 |      Size in bytes: 13&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Consumed gas:  49                 |      Consumed gas:  38&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;That&#x27;s 32% fewer bytes and 30% less gas using &lt;code&gt;CALLSUB&lt;&#x2F;code&gt; versus using &lt;code&gt;JUMP&lt;&#x2F;code&gt;.  So we can see that these instructions provide a simpler, more efficient mechanism. As code becomes larger and better optimized the gains become smaller, but code using &lt;code&gt;CALLSUB&lt;&#x2F;code&gt; always takes less space and gas than equivalent code without it.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;do-we-improve-real-time-performance&quot;&gt;Do we improve real-time performance?&lt;&#x2F;h3&gt;
&lt;p&gt;Some real-time interpreter performance gains will be had, as reflected in the lower gas costs.  But large real-time gains will come from AOT and JIT compilers.  Crucially, the constraint that stack depths be constant means that in &lt;code&gt;MAGIC&lt;&#x2F;code&gt; code a very fast streaming JIT can traverse the control flow of the EVM code in one pass -- as it is executed -- generating machine code as it goes. &lt;em&gt;(Note again: the Wasm, JVM and .NET VMs share that property.)&lt;&#x2F;em&gt;  The EVM is a stack machine, but real machines are register machines.  So generating virtual register code for a faster interpreter is a win, (I have seen 4X speedups on JVM code) and generating good machine code gives orders of magnitude gains. But for most transactions storage dominates execution time, and gas counting and other overhead always take their toll.  So these gains would be most visible in contexts where this overhead is absent, such as for L1 precompiles, on some L2s, and on some EVM-compatible chains.  Code can also be compiled to a better instruction set for on-chain ZK work, such as RISC-V.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-no-immediate-arguments&quot;&gt;Why no immediate arguments?&lt;&#x2F;h3&gt;
&lt;p&gt;This would of course break the promise of &quot;the smallest possible change.&quot;  &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8013&#x2F;&quot;&gt;EIP-8013: Static relative jumps and calls for the EVM&lt;&#x2F;a&gt; is available if we want its size and performance advantages. It proposes five new EVM jump instructions (&lt;code&gt;RJUMP&lt;&#x2F;code&gt;, &lt;code&gt;RJUMPI&lt;&#x2F;code&gt;, &lt;code&gt;RJUMPV&lt;&#x2F;code&gt;, &lt;code&gt;RJUMPSUB&lt;&#x2F;code&gt;, and &lt;code&gt;RJUMPSUBV&lt;&#x2F;code&gt;) which encode destinations as signed immediate values. These can be useful for almost all &lt;code&gt;JUMP&lt;&#x2F;code&gt; and &lt;code&gt;JUMPI&lt;&#x2F;code&gt; use cases and offer improvements in cost, performance, and static analysis.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-no-code-sections&quot;&gt;Why no code sections?&lt;&#x2F;h3&gt;
&lt;p&gt;Again, this would break the promise of &quot;the smallest possible change,&quot; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3540&#x2F;&quot;&gt;EIP-3540: EOF - EVM Object Format&lt;&#x2F;a&gt; remains available. But note that restricting jumps to code sections impedes important optimizations, which EOF supported by adding special opcodes.  So if we want restricted code sections this becomes a much bigger change, and we should consider &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4750&#x2F;&quot;&gt;EOF - Functions&lt;&#x2F;a&gt; and related EIPs separately.  This proposal uses the same return-stack mechanism and poses no forwards compatability issues with EOF.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-the-return-stack-mechanism&quot;&gt;Why the return-stack mechanism?&lt;&#x2F;h3&gt;
&lt;p&gt;In our experience most stack machines have separate stacks for data and for returns from calls, whereas most register machines have one stack for both data and return addresses, registers for computation, and instructions to support returns from calls in coordination with registers and the stack.  The EVM is of course a stack machine, not a register machine.  As an industry and a team we have substantial experience with the return-stack mechanism proposed here.  It has been effectively used in many machines over the last eight decades since Turing invented it, and has been implemented, tested, and even ready to ship in many of our clients over the last nine years.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;These changes are backwards compatible.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;There are &lt;em&gt;no changes&lt;&#x2F;em&gt; to the semantics of existing EVM code.
&lt;ul&gt;
&lt;li&gt;With the caveat that code with unspecified behavior might behave in different, unspecified ways.  Such code was always broken.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Opcode semantics &lt;em&gt;are not&lt;&#x2F;em&gt; affected by whether the code begins with &lt;code&gt;MAGIC&lt;&#x2F;code&gt;.
&lt;ul&gt;
&lt;li&gt;What is affected is the &lt;em&gt;validity&lt;&#x2F;em&gt; of code.  &lt;code&gt;valid&lt;&#x2F;code&gt; code MUST execute identically in any contracts, but in &lt;code&gt;MAGIC&lt;&#x2F;code&gt; contracts the code MUST be &lt;code&gt;valid&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;This proposal &lt;em&gt;does not&lt;&#x2F;em&gt; require maintaining two interpreters.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;These changes do not foreclose EOF, RISC-V, or other changes; new &lt;code&gt;MAGIC&lt;&#x2F;code&gt; numbers would mark future EVMs.  Neither do these changes preclude running the EVM in zero knowledge; they would more likely help.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;em&gt;(Note: these tests are known to be outdated and incorrect.)&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;simple-routine&quot;&gt;Simple routine&lt;&#x2F;h3&gt;
&lt;p&gt;This should jump into a subroutine, back out and stop.&lt;&#x2F;p&gt;
&lt;p&gt;Bytecode: &lt;code&gt;0x60045e005c5d&lt;&#x2F;code&gt; (&lt;code&gt;PUSH1 0x04, CALLSUB, STOP, BEGINSUB, RETURNSUB&lt;&#x2F;code&gt;)&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Pc&lt;&#x2F;th&gt;&lt;th&gt;Op&lt;&#x2F;th&gt;&lt;th&gt;Cost&lt;&#x2F;th&gt;&lt;th&gt;Stack&lt;&#x2F;th&gt;&lt;th&gt;RStack&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;PUSH1&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;CALLSUB&lt;&#x2F;td&gt;&lt;td&gt;10&lt;&#x2F;td&gt;&lt;td&gt;[4]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;td&gt;RETURNSUB&lt;&#x2F;td&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[ 2]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;STOP&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Output: 0x
Consumed gas: &lt;code&gt;18&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;two-levels-of-subroutines&quot;&gt;Two levels of subroutines&lt;&#x2F;h3&gt;
&lt;p&gt;This should execute fine, going into one two depths of subroutines&lt;&#x2F;p&gt;
&lt;p&gt;Bytecode: &lt;code&gt;0x6800000000000000000c5e005c60115e5d5c5d&lt;&#x2F;code&gt; (&lt;code&gt;PUSH9 0x00000000000000000c, CALLSUB, STOP, BEGINSUB, PUSH1 0x11, CALLSUB, RETURNSUB, BEGINSUB, RETURNSUB&lt;&#x2F;code&gt;)&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Pc&lt;&#x2F;th&gt;&lt;th&gt;Op&lt;&#x2F;th&gt;&lt;th&gt;Cost&lt;&#x2F;th&gt;&lt;th&gt;Stack&lt;&#x2F;th&gt;&lt;th&gt;RStack&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;PUSH9&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;10&lt;&#x2F;td&gt;&lt;td&gt;CALLSUB&lt;&#x2F;td&gt;&lt;td&gt;10&lt;&#x2F;td&gt;&lt;td&gt;[12]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;13&lt;&#x2F;td&gt;&lt;td&gt;PUSH1&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[10]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;15&lt;&#x2F;td&gt;&lt;td&gt;CALLSUB&lt;&#x2F;td&gt;&lt;td&gt;10&lt;&#x2F;td&gt;&lt;td&gt;[17]&lt;&#x2F;td&gt;&lt;td&gt;[10]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;18&lt;&#x2F;td&gt;&lt;td&gt;RETURNSUB&lt;&#x2F;td&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[10,15]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;16&lt;&#x2F;td&gt;&lt;td&gt;RETURNSUB&lt;&#x2F;td&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[10]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;11&lt;&#x2F;td&gt;&lt;td&gt;STOP&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Consumed gas: &lt;code&gt;36&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;failure-1-invalid-jump&quot;&gt;Failure 1: invalid jump&lt;&#x2F;h3&gt;
&lt;p&gt;This should fail, since the given location is outside of the code-range. The code is the same as previous example,
except that the pushed location is &lt;code&gt;0x01000000000000000c&lt;&#x2F;code&gt; instead of &lt;code&gt;0x0c&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Bytecode: &lt;code&gt;0x6801000000000000000c5e005c60115e5d5c5d&lt;&#x2F;code&gt; (&lt;code&gt;PUSH9 0x01000000000000000c, CALLSUB, STOP, BEGINSUB, PUSH1 0x11, CALLSUB, RETURNSUB, BEGINSUB, RETURNSUB&lt;&#x2F;code&gt;)&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Pc&lt;&#x2F;th&gt;&lt;th&gt;Op&lt;&#x2F;th&gt;&lt;th&gt;Cost&lt;&#x2F;th&gt;&lt;th&gt;Stack&lt;&#x2F;th&gt;&lt;th&gt;RStack&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;PUSH9&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;10&lt;&#x2F;td&gt;&lt;td&gt;CALLSUB&lt;&#x2F;td&gt;&lt;td&gt;10&lt;&#x2F;td&gt;&lt;td&gt;[18446744073709551628]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Error: at pc=10, op=CALLSUB: invalid jump destination&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;failure-2-shallow-return-stack&quot;&gt;Failure 2: shallow &lt;code&gt;return stack&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;This should fail at first opcode, due to shallow &lt;code&gt;return_stack&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Bytecode: &lt;code&gt;0x5d5858&lt;&#x2F;code&gt; (&lt;code&gt;RETURNSUB, PC, PC&lt;&#x2F;code&gt;)&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Pc&lt;&#x2F;th&gt;&lt;th&gt;Op&lt;&#x2F;th&gt;&lt;th&gt;Cost&lt;&#x2F;th&gt;&lt;th&gt;Stack&lt;&#x2F;th&gt;&lt;th&gt;RStack&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;RETURNSUB&lt;&#x2F;td&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Error: at pc=0, op=RETURNSUB: invalid retsub&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;subroutine-at-end-of-code&quot;&gt;Subroutine at end of code&lt;&#x2F;h3&gt;
&lt;p&gt;In this example. the CALLSUB is on the last byte of code. When the subroutine returns, it should hit the &#x27;virtual stop&#x27; &lt;em&gt;after&lt;&#x2F;em&gt; the bytecode, and not exit with error&lt;&#x2F;p&gt;
&lt;p&gt;Bytecode: &lt;code&gt;0x6005565c5d5b60035e&lt;&#x2F;code&gt; (&lt;code&gt;PUSH1 0x05, JUMP, BEGINSUB, RETURNSUB, JUMPDEST, PUSH1 0x03, CALLSUB&lt;&#x2F;code&gt;)&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Pc&lt;&#x2F;th&gt;&lt;th&gt;Op&lt;&#x2F;th&gt;&lt;th&gt;Cost&lt;&#x2F;th&gt;&lt;th&gt;Stack&lt;&#x2F;th&gt;&lt;th&gt;RStack&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;PUSH1&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;JUMP&lt;&#x2F;td&gt;&lt;td&gt;8&lt;&#x2F;td&gt;&lt;td&gt;[5]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;td&gt;JUMPDEST&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;6&lt;&#x2F;td&gt;&lt;td&gt;PUSH1&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;8&lt;&#x2F;td&gt;&lt;td&gt;CALLSUB&lt;&#x2F;td&gt;&lt;td&gt;10&lt;&#x2F;td&gt;&lt;td&gt;[3]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;4&lt;&#x2F;td&gt;&lt;td&gt;RETURNSUB&lt;&#x2F;td&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[ 8]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;9&lt;&#x2F;td&gt;&lt;td&gt;STOP&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Consumed gas: &lt;code&gt;30&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;em&gt;(Note: this implementation is known to be incomplete and incorrect.)&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The following is a pseudo-Python implementation of an algorithm for predicating code validity.  An equivalent algorithm MUST be run at &lt;code&gt;CREATE&lt;&#x2F;code&gt; time in space and time linear in the size of the code.  The following algorithm recursively traces the &lt;em&gt;code&lt;&#x2F;em&gt;, emulating its control flow and stack use and checking for violations of the rules above.  It runs in time proportional to the size of the code, and the possible depth of recursion is proportional to the size of the code.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;validation-function&quot;&gt;Validation Function&lt;&#x2F;h3&gt;
&lt;p&gt;We assume that instruction validation and destination analysis has been done, and that we have some constant-time helper functions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;is_terminator(opcode)  returns true iff opcode is a terminator.&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;previous_data(pc)      returns the immediate data for the instruction before pc (usually a PUSH.)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;immediate_size(opcode) returns the size of the immediate data for an opcode.&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;removed_items(opcode)  returns the number of items removed from the data_stack by the opcode.&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;added_items(opcode)    returns the number of items added to the data_stack by the opcode.&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # returns true iff code is valid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    int []stack_depths&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    int []max_depths&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    def validate_code(code: bytes, pc: int, sp: int, bp: int, max: int) -&amp;gt; int, boolean:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        while pc &amp;lt; len(code):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            # check stack height and return if we have been here before&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            stack_depth = sp - bp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            max_depth = max + stack_depth&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if max_depth &amp;gt; 1024&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                return max_depth, false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if stack_depths[pc] {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                if stack_depth != stack_depths[pc]:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    return 0, false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                if opcode == ENTERSUB:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    return max_depths[pc], true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                else&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    return max_depth, true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                else:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    stack_depths[pc] = stack_depth&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if is_terminator(opcode):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                return max_depth, true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            elif opcode == CALLSUB:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                # push return address and set pc to destination&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                jumpdest = previous_data(pc)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                push(return_stack, pc)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                # validate and track maximum height&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                max_depth, valid = validate_code(jumpdest, 0, sp - bp, max)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                if !valid:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                   return max_depth, false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                max_depths[jumpdest] = max_depth;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            elif opcode == RETURNSUB:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                # pop return address and check for preceding call&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                pc = pop(return_stack)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                max_depth = max + stack_depth&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                return max_depth, true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if opcode == JUMP:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                # set pc to destination of jump&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                pc = previous_data(pc)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            elif opcode == JUMPI:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                jumpdest = previous_data(pc)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                # recurse to validate true side of conditional&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                max_depth, valid = validate_code(jumpdest, sp, bp)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                if !valid:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    return max_depth, false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            # apply instructions to stack&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            sp -= removed_items(opcode)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if sp &amp;lt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                return so, false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            sp += added_items(opcode)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            # Skip opcode and any immediate data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            pc += 1 + immediate_size(opcode)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        max_depth = max + stack_depth&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        if (max_depth &amp;gt; 1024)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            return max_depth, false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return max_depth, true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;These changes introduce new flow control instructions.  They do not introduce any new security considerations. This EIP is intended to improve security by validating a higher level of safety for EVM code deployed on the blockchain.  The validation algorithm must use time and space linear in the size of the code so as not be a denial of service vulnerability.  The algorithm here makes one linear-time, recursive pass of the bytecode, whose depth cannot exceed the number of &lt;code&gt;CALLSUB&lt;&#x2F;code&gt; and &lt;code&gt;JUMPI&lt;&#x2F;code&gt; instructions in the code.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;!--

``` csl-json
   {
     &quot;type&quot;: &quot;article&quot;,
     &quot;id&quot;: 4,
     &quot;author&quot;: [
       {
         &quot;family&quot;: &quot;Schneidewind&quot;,
         &quot;given&quot;: &quot;Clara&quot;
       }
     ],
     &quot;DOI&quot;: &quot;arXiv:2101.05735&quot;,
     &quot;title&quot;: &quot;The Good, the Bad and the Ugly: Pitfalls and Best Practices in Automated Sound Static Analysis of Ethereum Smart Contracts.,
     &quot;original-date&quot;: {
       &quot;date-parts&quot;: [
         [2021, 1, 14]
       ]
     },
     &quot;URL&quot;: &quot;https:&#x2F;&#x2F;arxiv.org&#x2F;abs&#x2F;2101.05735&quot;
   }
   ```

   ``` csl-json
   {
     &quot;type&quot;: &quot;article&quot;,
     &quot;id&quot;: 5,
     &quot;author&quot;: [
       {
         &quot;family&quot;: &quot;Albert&quot;,
         &quot;given&quot;: &quot;Elvira&quot;
       }
     ],
     &quot;DOI&quot;: &quot;arXiv:2004.14437&quot;,
     &quot;title&quot;: &quot;Analyzing Smart Contracts: From EVM to a sound Control-Flow Graph.,
     &quot;original-date&quot;: {
       &quot;date-parts&quot;: [
         [2020, 4, 29]
       ]
     },
     &quot;URL&quot;: &quot;https:&#x2F;&#x2F;arxiv.org&#x2F;abs&#x2F;2004.14437&quot;
   }
   ```
   ``` csl-json
   {
     &quot;type&quot;: &quot;article&quot;,
     &quot;id&quot;: 6,
     &quot;author&quot;: [
       {
         &quot;family&quot;: &quot;Contro&quot;,
         &quot;given&quot;: &quot;Filippo&quot;
       }
     ],
     &quot;DOI&quot;: &quot;arXiv:2103.09113&quot;,
     &quot;title&quot;: &quot;EtherSolve: Computing an Accurate Control-Flow Graph from Ethereum Bytecode.&quot;,
     &quot;original-date&quot;: {
       &quot;date-parts&quot;: [
         [2021, 3, 16]
       ]
     },
     &quot;URL&quot;: &quot;https:&#x2F;&#x2F;arxiv.org&#x2F;abs&#x2F;2103.09113&quot;
   }
   ```

   ``` csl-json
   {
     &quot;type&quot;: &quot;article&quot;,
     &quot;id&quot;: 7,
     &quot;author&quot;: [
       {
         &quot;family&quot;: &quot;He&quot;,
         &quot;given&quot;: &quot;Jiahao&quot;
       }
     ],
     &quot;DOI&quot;: &quot;arXiv:2301.12695&quot;,
     &quot;title&quot;: &quot;Neural-FEBI: Accurate Function Identification in Ethereum Virtual Machine Bytecode.&quot;,
     &quot;original-date&quot;: {
       &quot;date-parts&quot;: [
         [2023, 1, 30]
       ]
     },
     &quot;URL&quot;: &quot;https:&#x2F;&#x2F;arxiv.org&#x2F;abs&#x2F;2301.12695&quot;
   }
   ```
--&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;section class=&quot;footnotes&quot;&gt;
&lt;ol class=&quot;footnotes-list&quot;&gt;
&lt;li id=&quot;fn-1&quot;&gt;
&lt;p&gt;Menabre, L.F. Sketch of The Analytical Engine Invented by Charles Babbage. Bibliothque Universelle de Genve, No. 82, October 1842 &lt;a href=&quot;#fr-1-1&quot;&gt;↩&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-1-2&quot;&gt;↩2&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-1-3&quot;&gt;↩3&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li id=&quot;fn-3&quot;&gt;
&lt;p&gt;Carpenter, B.E. et al. The other Turing machine. The Computer Journal, Volume 20, Issue 3, January 1977 &lt;a href=&quot;#fr-3-1&quot;&gt;↩&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li id=&quot;fn-2&quot;&gt;
&lt;p&gt;Turing, A.M. Computing Machinery and Intelligence. Mind, Volume LIX, Issue 236, October 1950 &lt;a href=&quot;#fr-2-1&quot;&gt;↩&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li id=&quot;fn-4&quot;&gt;
&lt;p&gt;Schneidewind, Clara et al. The Good, the Bad and the Ugly: Pitfalls and Best Practices in Automated Sound Static Analysis of Ethereum Smart Contracts. DOI: 10.48550&#x2F;arXiv.2101.05735 &lt;a href=&quot;#fr-4-1&quot;&gt;↩&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li id=&quot;fn-5&quot;&gt;
&lt;p&gt;Albert, Elvira et al. Analyzing Smart Contracts: From EVM to a sound Control-Flow Graph. DOI: 10.48550&#x2F;arXiv.2004.14437 &lt;a href=&quot;#fr-5-1&quot;&gt;↩&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li id=&quot;fn-6&quot;&gt;
&lt;p&gt;Contro, Fillipo et al. EtherSolve: Computing an Accurate Control-Flow Graph from Ethereum Bytecode. DOI: 10.48550&#x2F;arXiv.2103.09113 &lt;a href=&quot;#fr-6-1&quot;&gt;↩&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li id=&quot;fn-7&quot;&gt;
&lt;p&gt;He, Jiahao et al. Neural-FEBI: Accurate Function Identification in Ethereum Virtual Machine Bytecode. DOI: 10.48550&#x2F;arxiv.2301.12695&quot; &lt;a href=&quot;#fr-7-1&quot;&gt;↩&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;section&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>RWA Event-based Compliance Framework</title>
        <published>2025-12-16T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Andrew Wang</name><uri>https://github.com/wz14</uri><email>zhuowangy2k@outlook.com</email>
	</author>
	
	<author>
		<name>Jack Yin</name><uri>https://github.com/0xjackey</uri><email>0xjackey@gmail.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8106/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-8106-rwa-event-based-compliance-framework/27219" />
        

        <id>https://wg-eips.ritovision.com/8106/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:8106"
            label="ERC-8106" />
        

        
        

        
        <summary type="html">Event-driven compliance framework for Real World Asset tokens with entity classification and audit events</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8106/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard defines an event-based compliance framework for Real World Asset (RWA) tokens on &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;, providing:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;A standardized entity classification system distinguishing between Compliance Entities (CE) and Decentralized Entities (DE)&lt;&#x2F;li&gt;
&lt;li&gt;Event-driven compliance observation enabling auditability through standardized events and actual value flows, without enforcing hard transaction reverts&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;This standard is intentionally minimal and does not prescribe business-specific RWA workflows, off-chain settlement mechanisms, minting policies, or specific transfer patterns.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Real World Asset tokenization requires compliance observability that existing &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens do not provide:&lt;&#x2F;p&gt;
&lt;h3 id=&quot;missing-capabilities&quot;&gt;Missing Capabilities&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Entity Classification&lt;&#x2F;strong&gt;: No standardized way to distinguish regulated corporate entities from decentralized participants&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Compliance Observability&lt;&#x2F;strong&gt;: No uniform event semantics for tracking compliance-relevant transfers&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Flexible Enforcement&lt;&#x2F;strong&gt;: Existing standards use hard reverts, making them incompatible with diverse regulatory frameworks&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;why-event-based&quot;&gt;Why Event-Based?&lt;&#x2F;h3&gt;
&lt;p&gt;This standard adopts an event-driven approach rather than enforcement through reverts:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Regulatory Flexibility&lt;&#x2F;strong&gt;: Different jurisdictions can interpret the same events differently&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Adaptability&lt;&#x2F;strong&gt;: Compliance rules can evolve without contract upgrades&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Lower Costs&lt;&#x2F;strong&gt;: Events are cheaper than state-based enforcement&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Compliance Entity (CE)&lt;&#x2F;strong&gt;: An address representing a regulated legal entity (e.g., corporate treasury, custody account)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Decentralized Entity (DE)&lt;&#x2F;strong&gt;: An address representing a decentralized participant (e.g., end users, routers, settlement contracts)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;BizID&lt;&#x2F;strong&gt;: A business correlation identifier (hash) linking related transfers to a single workflow&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Soft Policy&lt;&#x2F;strong&gt;: Compliance policy expressed through event labeling, not transaction reversion&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;entity-registry&quot;&gt;Entity Registry&lt;&#x2F;h3&gt;
&lt;p&gt;Compliant implementations MUST provide an entity classification registry that assigns each address to one of three categories.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC8106EntityRegistry&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EntityType&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt; DECENTRALIZED_ENTITY&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt; COMPLIANCE_ENTITY&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EntityTypeUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; entity&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        EntityType&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; entityType&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; reasonHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the entity type of an address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST return DECENTRALIZED_ENTITY for addresses not explicitly registered as COMPLIANCE_ENTITY&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; entityTypeOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; entity&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;EntityType&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;registry-requirements&quot;&gt;Registry Requirements&lt;&#x2F;h4&gt;
&lt;p&gt;Implementations MUST satisfy the following requirements:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Default Classification&lt;&#x2F;strong&gt;: The &lt;code&gt;entityTypeOf&lt;&#x2F;code&gt; function MUST return &lt;code&gt;DECENTRALIZED_ENTITY&lt;&#x2F;code&gt; for any address not explicitly registered as &lt;code&gt;COMPLIANCE_ENTITY&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Explicit Registration&lt;&#x2F;strong&gt;: Only addresses explicitly registered SHOULD return &lt;code&gt;COMPLIANCE_ENTITY&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Update Events&lt;&#x2F;strong&gt;: Entity type changes MUST emit &lt;code&gt;EntityTypeUpdated&lt;&#x2F;code&gt; events&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Reason Tracking&lt;&#x2F;strong&gt;: The &lt;code&gt;reasonHash&lt;&#x2F;code&gt; parameter MUST reference off-chain documentation (e.g., KYC records, legal entity registration)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Operator Accountability&lt;&#x2F;strong&gt;: The &lt;code&gt;operator&lt;&#x2F;code&gt; parameter MUST identify the address that authorized the update&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h4 id=&quot;implementation-note&quot;&gt;Implementation Note&lt;&#x2F;h4&gt;
&lt;p&gt;The registry MAY be:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Embedded within the token contract itself&lt;&#x2F;li&gt;
&lt;li&gt;Implemented as a separate contract referenced by the token&lt;&#x2F;li&gt;
&lt;li&gt;Shared across multiple tokens within an ecosystem&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;compliance-events&quot;&gt;Compliance Events&lt;&#x2F;h3&gt;
&lt;p&gt;Compliant implementations MUST emit standardized events that capture compliance-relevant transfer information, including entity classifications, compliance flags, and business correlation identifiers.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC8106ComplianceEvents&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC8106EntityRegistry&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ComplianceFlag&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        OK&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        DIRECT_DE_TO_CE&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;           &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; DE -&amp;gt; CE observed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        DIRECT_CE_TO_DE&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;           &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; CE -&amp;gt; DE observed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        POLICY_CUSTOM&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;              &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; project-defined policy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ComplianceObserved&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bizId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,     &lt;&#x2F;span&gt;&lt;span&gt;&#x2F;&#x2F; &lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;the&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ERC&lt;&#x2F;span&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;20&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        EntityType&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; fromType&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        EntityType&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; toType&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        ComplianceFlag&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; flag&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; policyTag&lt;&#x2F;span&gt;&lt;span&gt;          &#x2F;&#x2F; &lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;project&lt;&#x2F;span&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;defined&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; categorization&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tag&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;event-requirements&quot;&gt;Event Requirements&lt;&#x2F;h4&gt;
&lt;p&gt;Implementations MUST satisfy the following requirements:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Complete Information&lt;&#x2F;strong&gt;: Each &lt;code&gt;ComplianceObserved&lt;&#x2F;code&gt; event MUST include all specified parameters&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Accurate Classification&lt;&#x2F;strong&gt;: The &lt;code&gt;fromType&lt;&#x2F;code&gt; and &lt;code&gt;toType&lt;&#x2F;code&gt; MUST reflect the actual entity types at the time of the transfer&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Consistent BizID&lt;&#x2F;strong&gt;: All legs of a multi-leg transfer MUST use the same &lt;code&gt;bizId&lt;&#x2F;code&gt; value&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Token Identification&lt;&#x2F;strong&gt;: The &lt;code&gt;token&lt;&#x2F;code&gt; parameter MUST be the address of the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; token contract&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h4 id=&quot;recommended-flagging-policy-non-normative&quot;&gt;Recommended Flagging Policy (Non-normative)&lt;&#x2F;h4&gt;
&lt;p&gt;Implementations SHOULD apply the following flagging heuristics:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;DIRECT_DE_TO_CE&lt;&#x2F;code&gt;: When &lt;code&gt;fromType == DECENTRALIZED_ENTITY&lt;&#x2F;code&gt; and &lt;code&gt;toType == COMPLIANCE_ENTITY&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;DIRECT_CE_TO_DE&lt;&#x2F;code&gt;: When &lt;code&gt;fromType == COMPLIANCE_ENTITY&lt;&#x2F;code&gt; and &lt;code&gt;toType == DECENTRALIZED_ENTITY&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;OK&lt;&#x2F;code&gt;: When transfer does not cross compliance boundaries (DE↔DE or CE↔CE)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;POLICY_CUSTOM&lt;&#x2F;code&gt;: For project-specific compliance scenarios&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;event-based-compliance&quot;&gt;Event-Based Compliance&lt;&#x2F;h4&gt;
&lt;p&gt;Implementations SHOULD NOT revert transactions solely based on compliance flags. This event-based approach enables:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Off-chain compliance review and decision-making&lt;&#x2F;li&gt;
&lt;li&gt;Flexible interpretation across different regulatory jurisdictions&lt;&#x2F;li&gt;
&lt;li&gt;Time-delayed enforcement where appropriate (e.g., 24-hour review periods)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Compliance actions (transaction reversals, account freezes, regulatory reporting) SHOULD be handled through separate mechanisms such as:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Off-chain monitoring systems&lt;&#x2F;li&gt;
&lt;li&gt;On-chain governance modules&lt;&#x2F;li&gt;
&lt;li&gt;Dedicated compliance management contracts&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;event-driven-model&quot;&gt;Event-Driven Model&lt;&#x2F;h3&gt;
&lt;p&gt;Events rather than reverts because:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Different jurisdictions can interpret events differently&lt;&#x2F;li&gt;
&lt;li&gt;Cheaper than state-based enforcement (~2000 gas per event vs state writes)&lt;&#x2F;li&gt;
&lt;li&gt;Enables time-delayed enforcement where appropriate&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;soft-policy-flags&quot;&gt;Soft Policy Flags&lt;&#x2F;h3&gt;
&lt;p&gt;Compliance flags are informational, not enforced:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Projects decide whether to revert based on flags&lt;&#x2F;li&gt;
&lt;li&gt;Off-chain systems can alert, review, or freeze post-transaction&lt;&#x2F;li&gt;
&lt;li&gt;Supports evolving regulations without contract changes&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;auditability-design&quot;&gt;Auditability Design&lt;&#x2F;h3&gt;
&lt;p&gt;Auditors reconstruct transaction flows using:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Value Flows&lt;&#x2F;strong&gt;: Every &lt;code&gt;ComplianceObserved&lt;&#x2F;code&gt; event corresponds to a real &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; balance change&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Standardized Events&lt;&#x2F;strong&gt;: Uniform event structure for machine-readable compliance data&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;BizID Correlation&lt;&#x2F;strong&gt;: Link multiple transfers to a single business transaction&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;For a given &lt;code&gt;bizId&lt;&#x2F;code&gt;, auditors can query all &lt;code&gt;ComplianceObserved&lt;&#x2F;code&gt; events, build directed graphs from &lt;code&gt;from&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;to&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;amount&lt;&#x2F;code&gt; fields, check for direct CE&#x2F;DE transfers using the &lt;code&gt;flag&lt;&#x2F;code&gt; field, and cross-reference &lt;code&gt;reasonHash&lt;&#x2F;code&gt; with off-chain KYC&#x2F;AML systems.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;implementation-patterns&quot;&gt;Implementation Patterns&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;Embedded Registry&lt;&#x2F;strong&gt;: Store entity types in the token contract itself&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RWAToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC20&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC8106ComplianceEvents&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _isComplianceEntity&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; entityTypeOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; entity&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;EntityType&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _isComplianceEntity&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;entity&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            ?&lt;&#x2F;span&gt;&lt;span&gt; EntityType&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;COMPLIANCE_ENTITY &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            :&lt;&#x2F;span&gt;&lt;span&gt; EntityType&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;DECENTRALIZED_ENTITY&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Separate Registry&lt;&#x2F;strong&gt;: Share registry across multiple tokens&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EntityRegistry&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC8106EntityRegistry&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _isComplianceEntity&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; entityTypeOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; entity&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;EntityType&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _isComplianceEntity&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;entity&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            ?&lt;&#x2F;span&gt;&lt;span&gt; EntityType&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;COMPLIANCE_ENTITY&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            :&lt;&#x2F;span&gt;&lt;span&gt; EntityType&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;DECENTRALIZED_ENTITY&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; registerComplianceEntity&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; entity&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; reasonHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyAdmin&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _isComplianceEntity&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;entity&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EntityTypeUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;entity&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; EntityType&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;COMPLIANCE_ENTITY&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; reasonHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Policy Tag Conventions&lt;&#x2F;strong&gt;: Use consistent hashes for interoperability&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; TAG_PAYMENT &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;PAYMENT&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; TAG_TREASURY &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;TREASURY&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; TAG_REFUND &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;REFUND&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;example-use-cases&quot;&gt;Example Use Cases&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;Compliance Monitoring:&lt;&#x2F;strong&gt; A regulated stablecoin tracks all CE↔DE flows for monthly regulatory reports without blocking transactions.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Atomic Multi-Leg Transfers:&lt;&#x2F;strong&gt; While not part of this standard, projects can build on these primitives to implement atomic multi-hop transfers:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; User pays → Treasury → Operational account (single transaction)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; purchaseRWA&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; orderId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Leg 1: DE → CE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    token&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; treasury&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ComplianceObserved&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;orderId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; treasury&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                           DE&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; CE&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; DIRECT_DE_TO_CE&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; TAG_PAYMENT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Leg 2: CE → CE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    token&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;treasury&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; operational&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ComplianceObserved&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;orderId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; treasury&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; operational&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                           CE&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; CE&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; OK&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; TAG_TREASURY&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This pattern enables single user-facing transactions, unified &lt;code&gt;bizId&lt;&#x2F;code&gt; for audit correlation, and per-leg compliance events.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Time-Delayed Enforcement:&lt;&#x2F;strong&gt; Detect suspicious patterns in events, then freeze accounts off-chain or via governance after review.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;Event Integrity:&lt;&#x2F;strong&gt; Implementations MUST emit &lt;code&gt;ComplianceObserved&lt;&#x2F;code&gt; events only after actual &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; balance changes. Emitting events without value movement compromises auditability.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>ENS Trust Registry for Agent Coordination</title>
        <published>2025-12-16T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Kwame Bryan</name><uri>https://github.com/KBryan</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8107/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-ens-trust-registry-for-agent-coordination/27200" />
        

        <id>https://wg-eips.ritovision.com/8107/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:8107"
            label="ERC-8107" />
        

        
        

        
        <summary type="html">Web of trust validation using ENS names for ERC-8001 multi-party coordination</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8107/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC defines a &lt;strong&gt;Trust Registry&lt;&#x2F;strong&gt; that enables agents to establish and query transitive trust relationships using ENS names as identifiers. Trust is expressed at four levels (Unknown, None, Marginal, Full) and propagates through signature chains following the GNU Privacy Guard (GnuPG) web of trust model.&lt;&#x2F;p&gt;
&lt;p&gt;The registry serves as the &lt;strong&gt;trust and delegation module&lt;&#x2F;strong&gt; anticipated by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8001&#x2F;&quot;&gt;ERC-8001&lt;&#x2F;a&gt;, enabling coordinators to gate participation based on trust graph proximity. An agent is considered valid from a coordinator&#x27;s perspective if sufficient trust paths exist between them.&lt;&#x2F;p&gt;
&lt;p&gt;This standard specifies trust attestation structures, the path verification algorithm, ENS integration semantics, and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8001&#x2F;&quot;&gt;ERC-8001&lt;&#x2F;a&gt; coordination hooks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8001&#x2F;&quot;&gt;ERC-8001&lt;&#x2F;a&gt; defines minimal primitives for multi-party agent coordination but explicitly defers trust to modules:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&quot;Privacy, thresholds, bonding, and cross-chain are left to modules.&quot;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;And in Security Considerations:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&quot;Equivocation: A participant can sign conflicting intents. Mitigate with module-level slashing or reputation.&quot;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;This ERC provides that trust and delegation module. Before coordinating, agents need answers to:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;&quot;Should I include this agent in my coordination?&quot;&lt;&#x2F;strong&gt; — Participant selection&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&quot;Can I trust this agent&#x27;s judgment about other agents?&quot;&lt;&#x2F;strong&gt; — Transitive trust&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&quot;How do I update trust based on coordination outcomes?&quot;&lt;&#x2F;strong&gt; — Trust maintenance&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;why-web-of-trust&quot;&gt;Why Web of Trust?&lt;&#x2F;h3&gt;
&lt;p&gt;The web of trust model, proven over 25+ years in GnuPG, solves the bootstrap problem: how do you establish trust with unknown agents without a centralised registrar?&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;GnuPG Concept&lt;&#x2F;th&gt;&lt;th&gt;This Standard&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Public key&lt;&#x2F;td&gt;&lt;td&gt;ENS name&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Key signing&lt;&#x2F;td&gt;&lt;td&gt;Trust attestation&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Owner trust levels&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;TrustLevel&lt;&#x2F;code&gt; enum&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Key validity&lt;&#x2F;td&gt;&lt;td&gt;Agent validity for coordination&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Certification path&lt;&#x2F;td&gt;&lt;td&gt;Trust chain through agents&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;why-ens&quot;&gt;Why ENS?&lt;&#x2F;h3&gt;
&lt;p&gt;ENS provides a battle-tested, finalized identity layer:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Stable identifiers&lt;&#x2F;strong&gt; that survive key rotation&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Ownership semantics&lt;&#x2F;strong&gt; via &lt;code&gt;owner()&lt;&#x2F;code&gt; and &lt;code&gt;isApprovedForAll()&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Human readable&lt;&#x2F;strong&gt; names (&lt;code&gt;alice.agents.eth&lt;&#x2F;code&gt; not &lt;code&gt;0x742d...&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Subdomain delegation&lt;&#x2F;strong&gt; for protocol-issued agent identities&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Using ENS avoids dependency on draft identity standards while remaining compatible with future standards through adapter patterns.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Deployment note&lt;&#x2F;strong&gt;: This standard requires access to an ENS registry. On Ethereum mainnet, use the canonical ENS deployment. On other networks, use network-specific ENS deployments or bridges. CCIP-Read is a client-side mechanism and cannot be used for on-chain validation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;identity-continuity&quot;&gt;Identity Continuity&lt;&#x2F;h3&gt;
&lt;p&gt;ENS names are the identity. When an ENS name is transferred, the new owner inherits existing trust relationships where that name is the trustee. The new owner can manage trust where they are the trustor.&lt;&#x2F;p&gt;
&lt;p&gt;Implementations SHOULD use short expiries (RECOMMENDED: 90 days maximum) for high-stakes scopes to limit exposure from name transfers. Agents SHOULD monitor &lt;code&gt;Transfer&lt;&#x2F;code&gt; events on ENS names they trust and re-evaluate trust accordingly.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;overview&quot;&gt;Overview&lt;&#x2F;h3&gt;
&lt;p&gt;This ERC specifies:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Trust levels and their semantics&lt;&#x2F;li&gt;
&lt;li&gt;ENS-indexed trust attestation structures with scope as key&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; typed data for signing attestations&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;EIP-1271&lt;&#x2F;a&gt; support for contract controllers&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;ITrustRegistry&lt;&#x2F;code&gt; interface&lt;&#x2F;li&gt;
&lt;li&gt;Path verification algorithm&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8001&#x2F;&quot;&gt;ERC-8001&lt;&#x2F;a&gt; integration hooks&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;trust-levels&quot;&gt;Trust Levels&lt;&#x2F;h3&gt;
&lt;p&gt;Implementations MUST use the canonical enum:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TrustLevel&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;   Unknown&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0: No trust relationship established&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;   None&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 1: Explicitly distrusted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;   Marginal&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 2: Partial trust — multiple required for validation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;   Full&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;       &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 3: Complete trust — single attestation sufficient&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Semantic definitions:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Level&lt;&#x2F;th&gt;&lt;th&gt;Meaning&lt;&#x2F;th&gt;&lt;th&gt;Validation Contribution&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;Unknown&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Default state; no data about agent&lt;&#x2F;td&gt;&lt;td&gt;Cannot contribute to validation&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;None&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Agent known to behave improperly&lt;&#x2F;td&gt;&lt;td&gt;Explicitly excluded; voids trust paths containing this agent&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;Marginal&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Agent generally trustworthy&lt;&#x2F;td&gt;&lt;td&gt;Contributes to validation when &lt;code&gt;minEdgeTrust &amp;lt;= Marginal&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;Full&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Agent&#x27;s judgment equals own verification&lt;&#x2F;td&gt;&lt;td&gt;Always contributes to validation&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;&lt;strong&gt;Level transitions:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Any level MAY transition to any other level via a valid attestation with a higher nonce&lt;&#x2F;li&gt;
&lt;li&gt;Transitioning from &lt;code&gt;None&lt;&#x2F;code&gt; to &lt;code&gt;Marginal&lt;&#x2F;code&gt; or &lt;code&gt;Full&lt;&#x2F;code&gt; requires a new attestation (revocation is not permanent)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;ens-integration&quot;&gt;ENS Integration&lt;&#x2F;h3&gt;
&lt;p&gt;The Trust Registry uses ENS namehashes as agent identifiers.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ENS namehash computation (per ERC-137)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt; node &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;   keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;eth&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;   keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;alice&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; node = namehash(&amp;quot;alice.eth&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;signature-authority&quot;&gt;Signature Authority&lt;&#x2F;h3&gt;
&lt;p&gt;Trust attestations MUST be signed by an address with signing authority for the ENS name.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Signing authority&lt;&#x2F;strong&gt; is limited to:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The ENS name owner (&lt;code&gt;ens.owner(node)&lt;&#x2F;code&gt;), OR&lt;&#x2F;li&gt;
&lt;li&gt;For contract owners: any signer the contract validates via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;EIP-1271&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Transaction submission&lt;&#x2F;strong&gt; (calling &lt;code&gt;setTrust&lt;&#x2F;code&gt;, &lt;code&gt;revokeTrust&lt;&#x2F;code&gt;, etc.) MAY be performed by:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Any address holding a valid signature&lt;&#x2F;li&gt;
&lt;li&gt;An approved operator (&lt;code&gt;ens.isApprovedForAll(owner, operator)&lt;&#x2F;code&gt;) for &lt;code&gt;revokeTrust&lt;&#x2F;code&gt; only&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This separation ensures:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Attestations are cryptographically bound to the ENS owner&#x2F;controller&lt;&#x2F;li&gt;
&lt;li&gt;Transaction submission can be delegated (relayers, operators)&lt;&#x2F;li&gt;
&lt;li&gt;Approvals cannot be used to forge signatures&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify signature - signing authority is ENS owner only&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verifySignature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; digest&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      address&lt;&#x2F;span&gt;&lt;span&gt; owner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; ens&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;owner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; EOA owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;         return&lt;&#x2F;span&gt;&lt;span&gt; ECDSA&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;recover&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;digest&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Contract owner - delegate to EIP-1271&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      try&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC1271&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isValidSignature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;digest&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; magic&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;         return&lt;&#x2F;span&gt;&lt;span&gt; magic &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; IERC1271&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;isValidSignature&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; catch&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;         return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check if caller can submit revokeTrust transaction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; canSubmitRevocation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; caller&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      address&lt;&#x2F;span&gt;&lt;span&gt; owner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; ens&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      return&lt;&#x2F;span&gt;&lt;span&gt; caller &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; owner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span&gt; ens&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isApprovedForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; caller&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;eip-712-domain&quot;&gt;EIP-712 Domain&lt;&#x2F;h3&gt;
&lt;p&gt;Implementations MUST use the following &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; domain:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;EIP712Domain&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   name&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;TrustRegistry&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   version&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;1&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;chainid&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   verifyingContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Implementations SHOULD expose the domain via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5267&#x2F;&quot;&gt;EIP-5267&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;primary-types&quot;&gt;Primary Types&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TrustAttestation&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;   bytes32&lt;&#x2F;span&gt;&lt;span&gt; trustorNode&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;       &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ENS namehash of trustor&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;   bytes32&lt;&#x2F;span&gt;&lt;span&gt; trusteeNode&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;       &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ENS namehash of trustee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   TrustLevel level&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;          &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Trust level assigned&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;   bytes32&lt;&#x2F;span&gt;&lt;span&gt; scope&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;             &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Scope restriction; bytes32(0) = universal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;   uint64&lt;&#x2F;span&gt;&lt;span&gt; expiry&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;             &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Unix timestamp; 0 = no expiry&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;   uint64&lt;&#x2F;span&gt;&lt;span&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;              &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Per-trustor monotonic nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ValidationParams&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      uint8&lt;&#x2F;span&gt;&lt;span&gt; maxPathLength&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;       &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Maximum trust chain depth (1-10)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      TrustLevel minEdgeTrust&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Minimum trust level required on each edge&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      bytes32&lt;&#x2F;span&gt;&lt;span&gt; scope&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;             &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Required scope; bytes32(0) = any&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      bool&lt;&#x2F;span&gt;&lt;span&gt; enforceExpiry&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check expiry on all chain elements&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; requiredAnchors&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Path MUST traverse at least one anchor; empty = no requirement&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TrustPath&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; nodes&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;           &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; [validator, ...intermediaries..., target]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Path length definition&lt;&#x2F;strong&gt;: Path length is the number of edges (trust relationships) in the path. A direct trust relationship has path length 1. A path &lt;code&gt;[A, B, C]&lt;&#x2F;code&gt; has length 2.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;default-validation-parameters&quot;&gt;Default Validation Parameters&lt;&#x2F;h4&gt;
&lt;p&gt;When not specified, implementations SHOULD use:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ValidationParams&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   maxPathLength&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 5&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   minEdgeTrust&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; TrustLevel&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;Marginal&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   scope&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   enforceExpiry&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   requiredAnchors&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;[](&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;validation-parameters-constraints&quot;&gt;Validation Parameters Constraints&lt;&#x2F;h4&gt;
&lt;p&gt;Implementations MUST reject &lt;code&gt;ValidationParams&lt;&#x2F;code&gt; where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;maxPathLength == 0&lt;&#x2F;code&gt; or &lt;code&gt;maxPathLength &amp;gt; 10&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;minEdgeTrust == TrustLevel.Unknown&lt;&#x2F;code&gt; or &lt;code&gt;minEdgeTrust == TrustLevel.None&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;requiredAnchors.length &amp;gt; 10&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;typed-data-hashes&quot;&gt;Typed Data Hashes&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; TRUST_ATTESTATION_TYPEHASH &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;   &amp;quot;TrustAttestation(bytes32 trustorNode,bytes32 trusteeNode,uint8 level,bytes32 scope,uint64 expiry,uint64 nonce)&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; hashAttestation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;TrustAttestation&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; att&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         TRUST_ATTESTATION_TYPEHASH&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         att&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;trustorNode&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         att&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;trusteeNode&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;         uint8&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;att&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;level&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         att&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;scope&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         att&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;expiry&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         att&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      )&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;interface&quot;&gt;Interface&lt;&#x2F;h3&gt;
&lt;p&gt;Implementations MUST expose the following interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ITrustRegistry&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ═══════════════════════════════════════════════════════════════════&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Events&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ═══════════════════════════════════════════════════════════════════&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when trust is set or updated&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TrustSet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trustorNode&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trusteeNode&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;      TrustLevel&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; level&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; scope&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expiry&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when trust is explicitly revoked&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TrustRevoked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trustorNode&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trusteeNode&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; scope&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; reasonCode&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when an identity gate is configured&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IdentityGateSet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; coordinationType&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; gatekeeperNode&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; maxPathLength&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;      TrustLevel&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; minEdgeTrust&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when an identity gate is removed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IdentityGateRemoved&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; coordinationType&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ═══════════════════════════════════════════════════════════════════&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Trust Management&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ═══════════════════════════════════════════════════════════════════&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Set trust level for another agent in a specific scope&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Signature MUST be from ENS owner (EOA) or validate via EIP-1271 (contract)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; attestation&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The trust attestation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; EIP-712 signature from trustor&amp;#39;s ENS owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setTrust&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      TrustAttestation&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attestation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Batch set multiple trust relationships&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; All attestations MUST share the same trustorNode&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; attestations&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Array of trust attestations&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; signatures&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Corresponding signatures&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setTrustBatch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      TrustAttestation&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attestations&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signatures&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Revoke trust (sets level to None)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Caller MUST be ENS owner or approved operator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; trustorNode&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The trustor&amp;#39;s ENS namehash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; trusteeNode&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The agent to revoke trust from&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; scope&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The scope to revoke trust in&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; reasonCode&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Reason code for revocation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revokeTrust&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trustorNode&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trusteeNode&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; scope&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; reasonCode&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get trust record between two agents in a specific scope&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; trustorNode&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The trusting agent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; trusteeNode&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The trusted agent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; scope&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The trust scope (bytes32(0) for universal)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; level&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Current trust level&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; expiry&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Expiration timestamp (0 = never)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getTrust&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trustorNode&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trusteeNode&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; scope&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;TrustLevel&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; level&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expiry&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get current nonce for a trustor&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; trustorNode&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The agent&amp;#39;s ENS namehash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Current&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; nonce value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getNonce&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trustorNode&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ═══════════════════════════════════════════════════════════════════&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Path Verification&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ═══════════════════════════════════════════════════════════════════&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify a pre-computed trust path&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; path&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The trust path to verify&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; params&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Validation parameters&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; valid&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Whether the path satisfies validation requirements&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; anchorSatisfied&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Whether requiredAnchors constraint is met&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verifyPath&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      TrustPath&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; path&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      ValidationParams&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; params&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; valid&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; anchorSatisfied&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ═══════════════════════════════════════════════════════════════════&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-8001 Integration&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ═══════════════════════════════════════════════════════════════════&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Set identity gate for a coordination type&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; coordinationType&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ERC-8001 coordination type&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; gatekeeperNode&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Agent whose trust graph gates entry&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; params&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Validation parameters for the gate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setIdentityGate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; coordinationType&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; gatekeeperNode&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      ValidationParams&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; params&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Remove identity gate for a coordination type&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; coordinationType&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ERC-8001 coordination type&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; removeIdentityGate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; coordinationType&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get identity gate configuration&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; coordinationType&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ERC-8001 coordination type&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; gatekeeperNode&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The gatekeeper agent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; params&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Validation parameters&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; enabled&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Whether the gate is active&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getIdentityGate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; coordinationType&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; gatekeeperNode&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      ValidationParams&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; params&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; enabled&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Validate participant using pre-computed path&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; coordinationType&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ERC-8001 coordination type&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; path&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Pre-computed trust path from gatekeeper to participant&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; isValid&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Whether participant passes the gate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validateParticipantWithPath&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; coordinationType&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      TrustPath&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; path&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; isValid&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;optional-interface-extensions&quot;&gt;OPTIONAL Interface Extensions&lt;&#x2F;h3&gt;
&lt;p&gt;The following functions are OPTIONAL. Implementations MAY include them but they are not required for compliance:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ITrustRegistryExtended&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ITrustRegistry&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get agents trusted by a given agent (paginated)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; OPTIONAL - useful for indexing but not required&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getTrustees&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trustorNode&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      TrustLevel&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; minLevel&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; scope&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; offset&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; limit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trustees&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; total&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get agents that trust a given agent (paginated)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; OPTIONAL - useful for indexing but not required&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getTrustors&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trusteeNode&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      TrustLevel&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; minLevel&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; scope&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; offset&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; limit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trustors&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; total&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Validate an agent through on-chain graph traversal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; OPTIONAL - expensive, prefer off-chain computation with verifyPath&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; validatorNode&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The validating agent&amp;#39;s perspective&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; targetNode&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The agent to validate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; params&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Validation parameters&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; marginalThreshold&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Number of marginal attestations required (for accumulation)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; fullThreshold&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Number of full attestations required&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validateAgent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; validatorNode&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; targetNode&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      ValidationParams&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; params&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; marginalThreshold&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; fullThreshold&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; isValid&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; pathLength&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; marginalCount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; fullCount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check if any trust path exists&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; OPTIONAL - expensive, prefer off-chain computation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; pathExists&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; fromNode&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; toNode&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; maxDepth&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; exists&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; depth&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Validate participant without pre-computed path&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; OPTIONAL - expensive, prefer validateParticipantWithPath&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validateParticipant&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; coordinationType&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; participantNode&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; marginalThreshold&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; fullThreshold&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; isValid&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;semantics&quot;&gt;Semantics&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;settrust&quot;&gt;&lt;code&gt;setTrust&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;setTrust&lt;&#x2F;code&gt; MUST revert if:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;attestation.trustorNode == attestation.trusteeNode&lt;&#x2F;code&gt; (self-trust prohibited)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;attestation.nonce &amp;lt;= getNonce(attestation.trustorNode)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;attestation.expiry != 0 &amp;amp;&amp;amp; attestation.expiry &amp;lt;= block.timestamp&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;The signature does not verify per the Signature Authority section&lt;&#x2F;li&gt;
&lt;li&gt;The ENS name for &lt;code&gt;trustorNode&lt;&#x2F;code&gt; does not exist (owner is zero address)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;If valid:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The trust record MUST be stored, keyed by &lt;code&gt;(trustorNode, trusteeNode, scope)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;getNonce(trustorNode)&lt;&#x2F;code&gt; MUST return the attestation&#x27;s nonce&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TrustSet&lt;&#x2F;code&gt; MUST be emitted&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;settrustbatch&quot;&gt;&lt;code&gt;setTrustBatch&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;setTrustBatch&lt;&#x2F;code&gt; MUST revert if:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;attestations.length != signatures.length&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Any attestation has a different &lt;code&gt;trustorNode&lt;&#x2F;code&gt; than the first attestation&lt;&#x2F;li&gt;
&lt;li&gt;Any individual attestation would fail &lt;code&gt;setTrust&lt;&#x2F;code&gt; validation&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Nonces within the batch MUST be strictly increasing.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;revoketrust&quot;&gt;&lt;code&gt;revokeTrust&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;revokeTrust&lt;&#x2F;code&gt; MUST revert if:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Caller is not the ENS owner or an approved operator for &lt;code&gt;trustorNode&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;No existing trust relationship exists for &lt;code&gt;(trustorNode, trusteeNode, scope)&lt;&#x2F;code&gt; (level is &lt;code&gt;Unknown&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;If valid:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Trust level MUST be set to &lt;code&gt;None&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TrustRevoked&lt;&#x2F;code&gt; MUST be emitted&lt;&#x2F;li&gt;
&lt;li&gt;The relationship MUST remain in storage (not deleted) to preserve the explicit distrust&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;verifypath-path-verification-algorithm&quot;&gt;&lt;code&gt;verifyPath&lt;&#x2F;code&gt; — Path Verification Algorithm&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;verifyPath&lt;&#x2F;code&gt; validates a pre-computed trust path.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Algorithm:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verifyPath&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   TrustPath&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; path&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   ValidationParams&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; params&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; valid&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; anchorSatisfied&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Path must have at least 2 nodes (validator and target)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;   if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;path&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;nodes&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Path length constraint (edges = nodes - 1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;   if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;path&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;nodes&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; params&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;maxPathLength&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Track anchor satisfaction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;   bool&lt;&#x2F;span&gt;&lt;span&gt; foundAnchor &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; params&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;requiredAnchors&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify each edge&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;   for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; path&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;nodes&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Try scoped trust first, fall back to universal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      (&lt;&#x2F;span&gt;&lt;span&gt;TrustLevel level&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span&gt; expiry&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getTrust&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         path&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;nodes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         path&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;nodes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         params&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;scope&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Fall back to universal scope if scoped trust not found&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;level &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; TrustLevel&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;Unknown &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; params&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;scope &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         (&lt;&#x2F;span&gt;&lt;span&gt;level&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; expiry&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getTrust&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            path&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;nodes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            path&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;nodes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Edge must meet minimum trust level&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;level &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; params&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;minEdgeTrust&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; foundAnchor&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; None explicitly voids (even if minEdgeTrust is somehow None)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;level &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; TrustLevel&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;None&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; foundAnchor&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Expiry check&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;params&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;enforceExpiry &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; expiry &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; expiry &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;         return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; foundAnchor&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Anchor check (intermediate nodes only, not first or last)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;foundAnchor &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;         for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; j &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; j &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; params&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;requiredAnchors&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; j&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;path&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;nodes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; params&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;requiredAnchors&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;j&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;               foundAnchor &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;               break&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;   return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; foundAnchor&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Scope fallback semantics:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;When validating an edge, implementations MUST:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;First check for trust at the specified &lt;code&gt;params.scope&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;If not found and &lt;code&gt;params.scope != bytes32(0)&lt;&#x2F;code&gt;, check for trust at universal scope &lt;code&gt;bytes32(0)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Universal trust applies to all scopes&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h4 id=&quot;validateparticipantwithpath&quot;&gt;&lt;code&gt;validateParticipantWithPath&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;This function gates &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8001&#x2F;&quot;&gt;ERC-8001&lt;&#x2F;a&gt; coordination participation.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validateParticipantWithPath&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;   bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; coordinationType&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   TrustPath&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; path&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; isValid&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt; gatekeeperNode&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; ValidationParams &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;memory&lt;&#x2F;span&gt;&lt;span&gt; params&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt; enabled&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;               getIdentityGate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;coordinationType&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;   if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;enabled&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; No gate = open participation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify path starts at gatekeeper and ends at participant&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;   if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;path&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;nodes&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;   if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;path&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;nodes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; gatekeeperNode&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt; valid&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt; anchorOk&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verifyPath&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;path&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; params&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;   return&lt;&#x2F;span&gt;&lt;span&gt; valid &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; anchorOk&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;errors&quot;&gt;Errors&lt;&#x2F;h3&gt;
&lt;p&gt;Implementations MUST revert with these errors:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SelfTrustProhibited&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NonceTooLow&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span&gt; provided&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span&gt; required&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AttestationExpired&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span&gt; expiry&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span&gt; currentTime&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InvalidSignature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NotAuthorized&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt; node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt; actor&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ENSNameNotFound&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt; node&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TrustNotFound&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt; trustorNode&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt; trusteeNode&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt; scope&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; GateNotFound&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt; coordinationType&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InvalidValidationParams&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt; reason&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BatchTrustorMismatch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BatchNonceNotIncreasing&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;recommended-reason-codes&quot;&gt;Recommended Reason Codes&lt;&#x2F;h3&gt;
&lt;p&gt;For &lt;code&gt;TrustRevoked&lt;&#x2F;code&gt; events, the following reason codes are RECOMMENDED:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Reason Code&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Meaning&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Unspecified&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;bytes32(0)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;No specific reason&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Misbehavior&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;keccak256(&quot;MISBEHAVIOR&quot;)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Agent acted improperly&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Compromised&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;keccak256(&quot;COMPROMISED&quot;)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Key or account compromised&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Inactive&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;keccak256(&quot;INACTIVE&quot;)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Agent no longer active&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Transfer&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;keccak256(&quot;TRANSFER&quot;)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;ENS name transferred&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;recommended-scopes&quot;&gt;Recommended Scopes&lt;&#x2F;h3&gt;
&lt;p&gt;For interoperability, the following scope values are RECOMMENDED:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Scope&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Use Case&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Universal&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;bytes32(0)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Trust applies to all contexts&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;DeFi&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;keccak256(&quot;DEFI&quot;)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;DeFi coordination&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Gaming&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;keccak256(&quot;GAMING&quot;)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Gaming&#x2F;metaverse&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;MEV&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;keccak256(&quot;MEV&quot;)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;MEV protection&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Commerce&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;keccak256(&quot;COMMERCE&quot;)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Agentic commerce&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;recommended-coordination-types&quot;&gt;Recommended Coordination Types&lt;&#x2F;h3&gt;
&lt;p&gt;For &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8001&#x2F;&quot;&gt;ERC-8001&lt;&#x2F;a&gt; identity gates:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Coordination Type&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;MEV Coordination&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;keccak256(&quot;MEV_COORDINATION&quot;)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;DeFi Yield&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;keccak256(&quot;DEFI_YIELD&quot;)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Gaming Match&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;keccak256(&quot;GAMING_MATCH&quot;)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Commerce Escrow&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;keccak256(&quot;COMMERCE_ESCROW&quot;)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-ens-instead-of-a-new-identity-system&quot;&gt;Why ENS Instead of a New Identity System?&lt;&#x2F;h3&gt;
&lt;p&gt;ENS is finalised &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;137&#x2F;&quot;&gt;EIP-137&lt;&#x2F;a&gt;, battle-tested, and widely adopted. Creating a new identity system would:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Add dependency on draft standards&lt;&#x2F;li&gt;
&lt;li&gt;Fragment the identity ecosystem&lt;&#x2F;li&gt;
&lt;li&gt;Require new adoption efforts&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;ENS provides everything needed: stable identifiers, ownership semantics, and extensibility.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-scope-as-storage-key&quot;&gt;Why Scope as Storage Key?&lt;&#x2F;h3&gt;
&lt;p&gt;A trustor may have different trust levels for the same trustee in different contexts. For example:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Trust &lt;code&gt;bob.eth&lt;&#x2F;code&gt; fully for DeFi coordination&lt;&#x2F;li&gt;
&lt;li&gt;Trust &lt;code&gt;bob.eth&lt;&#x2F;code&gt; marginally for gaming&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Making scope part of the storage key &lt;code&gt;(trustorNode, trusteeNode, scope)&lt;&#x2F;code&gt; enables this naturally. Universal trust &lt;code&gt;bytes32(0)&lt;&#x2F;code&gt; serves as a fallback when scoped trust is not specified.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-minedgetrust-instead-of-marginal-full-thresholds&quot;&gt;Why minEdgeTrust Instead of Marginal&#x2F;Full Thresholds?&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;marginalThreshold&lt;&#x2F;code&gt; and &lt;code&gt;fullThreshold&lt;&#x2F;code&gt; parameters were designed for on-chain graph traversal with marginal accumulation logic. Since on-chain traversal is OPTIONAL (expensive, DoS-prone), and the core primitive is &lt;code&gt;verifyPath&lt;&#x2F;code&gt;, we need only specify the minimum trust level each edge must have.&lt;&#x2F;p&gt;
&lt;p&gt;This simplification:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Reduces parameter complexity&lt;&#x2F;li&gt;
&lt;li&gt;Makes path verification straightforward&lt;&#x2F;li&gt;
&lt;li&gt;Leaves accumulation semantics to OPTIONAL extensions&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;For use cases requiring marginal accumulation, the OPTIONAL &lt;code&gt;validateAgent&lt;&#x2F;code&gt; extension accepts threshold parameters.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-separate-signing-authority-from-transaction-submission&quot;&gt;Why Separate Signing Authority from Transaction Submission?&lt;&#x2F;h3&gt;
&lt;p&gt;ENS approvals (&lt;code&gt;isApprovedForAll&lt;&#x2F;code&gt;) are designed for operators to manage names on behalf of owners. However, allowing approved operators to forge attestation signatures would break the cryptographic binding between attestations and ENS owners.&lt;&#x2F;p&gt;
&lt;p&gt;By restricting signing authority to the ENS owner (or EIP-1271 for contract owners) while allowing operators to submit transactions like &lt;code&gt;revokeTrust&lt;&#x2F;code&gt;, we preserve:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Cryptographic integrity of attestations&lt;&#x2F;li&gt;
&lt;li&gt;Operational flexibility for name management&lt;&#x2F;li&gt;
&lt;li&gt;Clear security boundaries&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;why-verifypath-only-no-on-chain-search&quot;&gt;Why verifyPath Only (No On-Chain Search)?&lt;&#x2F;h3&gt;
&lt;p&gt;On-chain graph traversal is expensive and creates DoS vectors:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Branching factor can explode with user-controlled adjacency lists&lt;&#x2F;li&gt;
&lt;li&gt;Gas costs are unpredictable&lt;&#x2F;li&gt;
&lt;li&gt;Attackers can bloat trustee lists&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;By requiring pre-computed paths, this standard:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Keeps on-chain verification O(path length)&lt;&#x2F;li&gt;
&lt;li&gt;Pushes search complexity to off-chain indexers where it belongs&lt;&#x2F;li&gt;
&lt;li&gt;Enables predictable gas costs&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Implementations MAY add &lt;code&gt;validateAgent&lt;&#x2F;code&gt; and &lt;code&gt;pathExists&lt;&#x2F;code&gt; as OPTIONAL extensions, but these are not required for compliance.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-four-trust-levels&quot;&gt;Why Four Trust Levels?&lt;&#x2F;h3&gt;
&lt;p&gt;The four-level model (Unknown, None, Marginal, Full) is proven by GnuPG&#x27;s 25+ years of use. Finer granularity adds complexity without clear benefit; coarser granularity loses important distinctions.&lt;&#x2F;p&gt;
&lt;p&gt;With &lt;code&gt;minEdgeTrust&lt;&#x2F;code&gt;, applications can choose their security posture:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;minEdgeTrust: Full&lt;&#x2F;code&gt; — Only fully trusted paths&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;minEdgeTrust: Marginal&lt;&#x2F;code&gt; — Accept marginal trust (default)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;why-required-anchors&quot;&gt;Why Required Anchors?&lt;&#x2F;h3&gt;
&lt;p&gt;Sybil attacks are the primary threat to web of trust systems. Required anchors force trust paths to traverse established community nodes (DAOs, protocols, auditors), transforming Sybil resistance from application-layer advice into protocol-level enforcement.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC introduces new functionality and does not modify existing standards.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;ENS Compatibility&lt;&#x2F;strong&gt;: Uses standard ENS interfaces (&lt;code&gt;owner&lt;&#x2F;code&gt;, &lt;code&gt;isApprovedForAll&lt;&#x2F;code&gt;). Works with any ENS deployment. Does not rely on CCIP-Read or other off-chain mechanisms.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;ERC-8001 Compatibility&lt;&#x2F;strong&gt;: Designed as a module. ERC-8001 coordinators can optionally integrate identity gates.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Wallet Compatibility&lt;&#x2F;strong&gt;: Uses &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; signatures, compatible with all major wallets. Supports &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;EIP-1271&lt;&#x2F;a&gt; for contract wallets and smart accounts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8107&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;TrustRegistry.sol&quot;&gt;&lt;code&gt;contracts&#x2F;TrustRegistry.sol&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; for the complete implementation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;sybil-attacks&quot;&gt;Sybil Attacks&lt;&#x2F;h3&gt;
&lt;p&gt;An attacker can create many ENS names and establish mutual trust between them.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Protocol-level mitigations:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Required anchors&lt;&#x2F;strong&gt;: &lt;code&gt;ValidationParams.requiredAnchors&lt;&#x2F;code&gt; forces paths through established community nodes&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Short path limits&lt;&#x2F;strong&gt;: &lt;code&gt;maxPathLength: 2&lt;&#x2F;code&gt; requires close proximity to validators&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;High trust requirement&lt;&#x2F;strong&gt;: &lt;code&gt;minEdgeTrust: Full&lt;&#x2F;code&gt; rejects marginal trust paths&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Application-level mitigations:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Weight trust by ENS name age or registration cost&lt;&#x2F;li&gt;
&lt;li&gt;Implement additional stake requirements&lt;&#x2F;li&gt;
&lt;li&gt;Monitor trust graphs for anomalous patterns off-chain&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;trust-graph-manipulation&quot;&gt;Trust Graph Manipulation&lt;&#x2F;h3&gt;
&lt;p&gt;Attackers may attempt to position themselves in many trust paths.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Mitigations:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Monitor trust graphs for anomalous patterns off-chain&lt;&#x2F;li&gt;
&lt;li&gt;Use &lt;code&gt;minEdgeTrust: Full&lt;&#x2F;code&gt; for high-value coordination&lt;&#x2F;li&gt;
&lt;li&gt;Require multiple independent paths via OPTIONAL extensions&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;key-compromise&quot;&gt;Key Compromise&lt;&#x2F;h3&gt;
&lt;p&gt;If an ENS name&#x27;s controller is compromised:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Mitigations:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Agents SHOULD monitor for unexpected trust changes via &lt;code&gt;TrustSet&lt;&#x2F;code&gt; events&lt;&#x2F;li&gt;
&lt;li&gt;Use short expiries (90 days maximum recommended for high-stakes)&lt;&#x2F;li&gt;
&lt;li&gt;ENS name owners can rotate controllers&lt;&#x2F;li&gt;
&lt;li&gt;Affected agents can issue &lt;code&gt;TrustRevoked&lt;&#x2F;code&gt; to quarantine compromised nodes&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;ens-name-transfer&quot;&gt;ENS Name Transfer&lt;&#x2F;h3&gt;
&lt;p&gt;When an ENS name is transferred:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;New owner inherits trust where they are the trustee&lt;&#x2F;li&gt;
&lt;li&gt;New owner can manage trust where they are the trustor&lt;&#x2F;li&gt;
&lt;li&gt;Old attestations signed by old owner remain valid until expiry&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Mitigations:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Use short expiries for high-stakes trust&lt;&#x2F;li&gt;
&lt;li&gt;Monitor ENS &lt;code&gt;Transfer&lt;&#x2F;code&gt; events&lt;&#x2F;li&gt;
&lt;li&gt;Re-evaluate trust after transfers&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;replay-protection&quot;&gt;Replay Protection&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; domain binding prevents cross-contract replay. Monotonic nonces prevent replay within the same contract. The &lt;code&gt;chainId&lt;&#x2F;code&gt; in the domain prevents cross-chain replay.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;stale-trust&quot;&gt;Stale Trust&lt;&#x2F;h3&gt;
&lt;p&gt;Trust relationships may become stale if agents don&#x27;t update them.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Mitigations:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Use &lt;code&gt;enforceExpiry: true&lt;&#x2F;code&gt; in validation parameters&lt;&#x2F;li&gt;
&lt;li&gt;Set reasonable &lt;code&gt;expiry&lt;&#x2F;code&gt; values on attestations (RECOMMENDED: 90 days maximum for high-stakes)&lt;&#x2F;li&gt;
&lt;li&gt;Monitor &lt;code&gt;TrustSet&lt;&#x2F;code&gt; event timestamps off-chain&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;off-chain-path-computation&quot;&gt;Off-Chain Path Computation&lt;&#x2F;h3&gt;
&lt;p&gt;This standard assumes off-chain indexers compute trust paths. Malicious indexers could:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Return suboptimal paths&lt;&#x2F;li&gt;
&lt;li&gt;Omit valid paths&lt;&#x2F;li&gt;
&lt;li&gt;Return invalid paths (caught by &lt;code&gt;verifyPath&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Mitigations:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Users can run their own indexers&lt;&#x2F;li&gt;
&lt;li&gt;Multiple independent indexers provide redundancy&lt;&#x2F;li&gt;
&lt;li&gt;Invalid paths are always rejected on-chain&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Cross-Chain Function Calls via Hooks</title>
        <published>2025-12-12T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Prem Makeig</name><uri>https://github.com/nxt3d</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8121/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-8121-delegated-metadata-resolution-via-hooks/27424" />
        

        <id>https://wg-eips.ritovision.com/8121/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:8121"
            label="ERC-8121" />
        

        
        

        
        <summary type="html">A specification for cross-chain function calls using hooks with ERC-7930 interoperable addresses.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8121/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC introduces hooks for cross-chain function calls. A hook fully specifies what function to call, with what parameters, on which contract, on which chain. Hooks require clients to use &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3668&#x2F;&quot;&gt;ERC-3668&lt;&#x2F;a&gt; to resolve, enabling cross-chain and off-chain verifiable data resolution. Hooks are particularly useful for redirecting metadata to known contracts with verifiable security properties, such as credential registries for Proof-of-Personhood (PoP) or Know-Your-Agent (KYA) for AI agent identity.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;There is a need to resolve data cross-chain, such as credentials like Proof-of-Personhood (PoP), for example from a dedicated identity chain. There is also a need to save these cross-chain function calls onchain, and there is currently no existing standard for saving this type of function call as a string or bytes value onchain, in a maximally human-readable way. It should also be possible for a hook to be included in plain text, for example a markdown file intended to be consumed by AI agents. Hooks allow for a specific function, contract, and chain to be specified in a human-readable way. One of the most important features of hooks is that it allows clients to evaluate whether or not they trust the target contract, for example to resolve a PoP or KYC credential, before calling the function.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;use-cases&quot;&gt;Use Cases&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Cross-Chain Metadata&lt;&#x2F;strong&gt;: Resolve metadata from contracts on other chains&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Credential Resolution&lt;&#x2F;strong&gt;: Redirect a Proof-of-Person (PoP) or Know-Your-Customer (KYC) record to a trusted credential registry&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Singleton Registries&lt;&#x2F;strong&gt;: Point to canonical registries with known security properties on any chain&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Shared Metadata&lt;&#x2F;strong&gt;: Multiple contracts can reference the same metadata source across chains&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;overview&quot;&gt;Overview&lt;&#x2F;h3&gt;
&lt;p&gt;A hook is a fully specified function call containing an optional function selector, function signature with explicit types, human-readable function call with values, return type, and an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7930&#x2F;&quot;&gt;ERC-7930&lt;&#x2F;a&gt; interoperable address specifying both the target contract and chain. The function selector acts as a checksum to verify the function signature, ensuring type safety and preventing ambiguity. This makes hooks completely self-describing - any client can resolve them without external documentation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;hook-function-signature&quot;&gt;Hook Function Signature&lt;&#x2F;h3&gt;
&lt;p&gt;Hooks can be encoded with or without an optional function selector. When the selector is omitted, &lt;code&gt;functionSignature&lt;&#x2F;code&gt; is the first parameter.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;With optional function selector:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; hook&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; functionSelector&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; functionSignature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; functionCall&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; returnType&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; target&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Without function selector:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; hook&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; functionSignature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; functionCall&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; returnType&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; target&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; HOOK_SELECTOR_WITH_SELECTOR &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x037f43ed&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; When functionSelector is included&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; HOOK_SELECTOR_WITHOUT_SELECTOR &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x6113bfa3&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; When functionSelector is omitted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;functionSelector&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: (OPTIONAL) The 4-byte selector of the function to call. When provided, this acts as a checksum to verify the &lt;code&gt;functionSignature&lt;&#x2F;code&gt;. If omitted, the hook structure starts with &lt;code&gt;functionSignature&lt;&#x2F;code&gt; as the first parameter. Clients can always derive the selector from &lt;code&gt;functionSignature&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;functionSignature&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: The full function signature with explicit parameter types (e.g., &lt;code&gt;&quot;getData((string,uint256))&quot;&lt;&#x2F;code&gt;, &lt;code&gt;&quot;getCredential(string)&quot;&lt;&#x2F;code&gt;). This MUST match the function selector when hashed, if a selector is provided. When the selector is omitted, this is the first parameter in the hook structure.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;functionCall&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: A string representation of the function to call with its parameter values (human-readable, e.g., &lt;code&gt;&quot;getData((&#x27;alice&#x27;, 42))&quot;&lt;&#x2F;code&gt;, &lt;code&gt;&quot;getCredential(&#x27;kyc: 0x76F1Ff...123&#x27;)&quot;&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;returnType&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: The return type in Solidity tuple notation for ABI decoding (e.g., &lt;code&gt;(string)&lt;&#x2F;code&gt;, &lt;code&gt;(uint256, bytes32)&lt;&#x2F;code&gt;, &lt;code&gt;((string, uint256[], bytes32))&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;target&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: An &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7930&#x2F;&quot;&gt;ERC-7930&lt;&#x2F;a&gt; interoperable address specifying both the target contract and chain&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;function-call-format&quot;&gt;Function Call Format&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;functionCall&lt;&#x2F;code&gt; parameter uses a Solidity-style syntax:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;String parameters are enclosed in single quotes: &lt;code&gt;&#x27;value&#x27;&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Bytes&#x2F;hex parameters use the &lt;code&gt;0x&lt;&#x2F;code&gt; prefix: &lt;code&gt;0x1234abcd&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Numbers are written as literals: &lt;code&gt;42&lt;&#x2F;code&gt; or &lt;code&gt;1000000&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Arrays use square brackets: &lt;code&gt;[1, 2, 3]&lt;&#x2F;code&gt; or &lt;code&gt;[&#x27;a&#x27;, &#x27;b&#x27;, &#x27;c&#x27;]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Structs&#x2F;tuples use parentheses: &lt;code&gt;(&#x27;alice&#x27;, 42, true)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Examples:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; Example with optional function selector (acts as checksum)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;hook(0xc41a360a, &amp;quot;getOwner(uint256)&amp;quot;, &amp;quot;getOwner(42)&amp;quot;, &amp;quot;(address)&amp;quot;, 0x000100000101141234567890abcdef1234567890abcdef12345678)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; Example with function selector omitted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;hook(&amp;quot;getOwner(uint256)&amp;quot;, &amp;quot;getOwner(42)&amp;quot;, &amp;quot;(address)&amp;quot;, 0x000100000101141234567890abcdef1234567890abcdef12345678)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;hook-encoding&quot;&gt;Hook Encoding&lt;&#x2F;h3&gt;
&lt;p&gt;Hooks can be encoded in two formats depending on the storage type:&lt;&#x2F;p&gt;
&lt;h4 id=&quot;bytes-format&quot;&gt;Bytes Format&lt;&#x2F;h4&gt;
&lt;p&gt;For systems that store &lt;code&gt;bytes&lt;&#x2F;code&gt; values, hooks MUST be ABI-encoded. Use different hook selectors depending on whether the optional function selector is included:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;With optional function selector:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Hook selector: first 4 bytes of keccak256(&amp;quot;hook(bytes4,string,string,string,bytes)&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; HOOK_SELECTOR_WITH_SELECTOR &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x037f43ed&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Function signature with explicit types&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; functionSignature &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;getContractMetadata(string)&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Optional function selector as checksum (computed from signature)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span&gt; functionSelector &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes4&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;functionSignature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0x1837de7f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Function call with values&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; functionCall &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;getContractMetadata(&amp;#39;kyc&amp;#39;)&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-7930 address: Ethereum mainnet (chain 1) contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; target &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;000100000101141234567890abcdef1234567890abcdef12345678&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; hookData &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodeWithSelector&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    HOOK_SELECTOR_WITH_SELECTOR&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    functionSelector&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    functionSignature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    functionCall&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;(bytes)&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; return type&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    target&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Store the hook as the value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;originatingContract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;setContractMetadata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;kyc&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; hookData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Without function selector:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Hook selector: first 4 bytes of keccak256(&amp;quot;hook(string,string,string,bytes)&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; HOOK_SELECTOR_WITHOUT_SELECTOR &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x6113bfa3&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Function signature with explicit types&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; functionSignature &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;getContractMetadata(string)&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Function call with values&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; functionCall &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;getContractMetadata(&amp;#39;kyc&amp;#39;)&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-7930 address: Ethereum mainnet (chain 1) contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; target &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;000100000101141234567890abcdef1234567890abcdef12345678&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; hookData &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodeWithSelector&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    HOOK_SELECTOR_WITHOUT_SELECTOR&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    functionSignature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; First parameter when selector is omitted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    functionCall&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;(bytes)&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; return type&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    target&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Store the hook as the value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;originatingContract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;setContractMetadata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;kyc&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; hookData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Target function: function getContractMetadata(string) external view returns (bytes memory)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;string-format&quot;&gt;String Format&lt;&#x2F;h4&gt;
&lt;p&gt;For systems that store &lt;code&gt;string&lt;&#x2F;code&gt; values, hooks MUST be formatted as shown below. The target is an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7930&#x2F;&quot;&gt;ERC-7930&lt;&#x2F;a&gt; interoperable address.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;With optional function selector:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;hook(0x9e574b14, &amp;quot;getContractMetadata(string)&amp;quot;, &amp;quot;getContractMetadata(&amp;#39;kyc&amp;#39;)&amp;quot;, &amp;quot;(bytes)&amp;quot;, 0x000100000101141234567890abcdef1234567890abcdef12345678)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Without function selector:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;hook(&amp;quot;getContractMetadata(string)&amp;quot;, &amp;quot;getContractMetadata(&amp;#39;kyc&amp;#39;)&amp;quot;, &amp;quot;(bytes)&amp;quot;, 0x000100000101141234567890abcdef1234567890abcdef12345678)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Parsers MUST detect the format by checking if the first parameter after &lt;code&gt;hook(&lt;&#x2F;code&gt; starts with &lt;code&gt;0x&lt;&#x2F;code&gt; followed by 8 hexadecimal characters (an optional function selector) or not.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Examples:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; Example 1: simple struct parameter&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;hook(0xabcdef12, &amp;quot;getData((string,uint256))&amp;quot;, &amp;quot;getData((&amp;#39;alice&amp;#39;, 42))&amp;quot;, &amp;quot;(bytes)&amp;quot;, 0x000100000101141234567890abcdef1234567890abcdef12345678)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; Example 2: struct parameter returning struct&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;hook(0x12345678, &amp;quot;getCredential((string,uint256,bytes32))&amp;quot;, &amp;quot;getCredential((&amp;#39;kyc&amp;#39;, 12345, 0xabcd1234...))&amp;quot;, &amp;quot;((string,address,uint256))&amp;quot;, 0x000100000101141234567890abcdef1234567890abcdef12345678)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; Example 3: nested struct (struct containing a struct)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;hook(0x9abcdef0, &amp;quot;getAgent((string,uint256,(address,bool,string)))&amp;quot;, &amp;quot;getAgent((&amp;#39;alice&amp;#39;, 42, (0x1234..., true, &amp;#39;verified&amp;#39;)))&amp;quot;, &amp;quot;((string,uint256,(address,bool)))&amp;quot;, 0x000100000101141234567890abcdef1234567890abcdef12345678)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;detecting-hooks&quot;&gt;Detecting Hooks&lt;&#x2F;h3&gt;
&lt;p&gt;Clients SHOULD be aware in advance which metadata keys may contain hooks. It is intentional that hook-enabled keys are known by clients beforehand, similar to how clients know to look for keys like &lt;code&gt;&quot;image&quot;&lt;&#x2F;code&gt; or &lt;code&gt;&quot;description&quot;&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;For bytes values, hooks can be detected by checking if the value starts with either hook selector &lt;code&gt;0x037f43ed&lt;&#x2F;code&gt; (with optional function selector) or &lt;code&gt;0x6113bfa3&lt;&#x2F;code&gt; (without function selector). For string values, hooks can be detected by checking if the value starts with &lt;code&gt;hook(&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;resolving-hooks-read-operations&quot;&gt;Resolving Hooks (Read Operations)&lt;&#x2F;h3&gt;
&lt;p&gt;When a client encounters a hook that it wants to use for a read operation:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Detect hook format&lt;&#x2F;strong&gt;: For bytes format, check if the value starts with &lt;code&gt;0x037f43ed&lt;&#x2F;code&gt; (with selector) or &lt;code&gt;0x6113bfa3&lt;&#x2F;code&gt; (without selector). For string format, parse the first parameter after &lt;code&gt;hook(&lt;&#x2F;code&gt; to determine if it&#x27;s a selector (starts with &lt;code&gt;0x&lt;&#x2F;code&gt; + 8 hex chars) or not.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Parse the hook&lt;&#x2F;strong&gt;: Extract the &lt;code&gt;functionSelector&lt;&#x2F;code&gt; (if present), &lt;code&gt;functionSignature&lt;&#x2F;code&gt;, &lt;code&gt;functionCall&lt;&#x2F;code&gt;, &lt;code&gt;returnType&lt;&#x2F;code&gt;, and &lt;code&gt;target&lt;&#x2F;code&gt; (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7930&#x2F;&quot;&gt;ERC-7930&lt;&#x2F;a&gt; address). If the selector is omitted, &lt;code&gt;functionSignature&lt;&#x2F;code&gt; is the first parameter.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Verify the selector&lt;&#x2F;strong&gt; (if provided): If &lt;code&gt;functionSelector&lt;&#x2F;code&gt; is present, compute the expected selector from &lt;code&gt;functionSignature&lt;&#x2F;code&gt; as &lt;code&gt;bytes4(keccak256(functionSignature))&lt;&#x2F;code&gt; and verify it matches &lt;code&gt;functionSelector&lt;&#x2F;code&gt;. Reject the hook if they don&#x27;t match. This verification ensures type safety and prevents ambiguity with structs or overloaded functions. If the selector is omitted, compute it from &lt;code&gt;functionSignature&lt;&#x2F;code&gt; for use in the function call.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Parse the target&lt;&#x2F;strong&gt;: Decode the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7930&#x2F;&quot;&gt;ERC-7930&lt;&#x2F;a&gt; address to extract the chain and contract address&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Verify the target&lt;&#x2F;strong&gt; (RECOMMENDED): Check that the target contract is known and trusted&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Parse the function call&lt;&#x2F;strong&gt;: Extract the function name and parameter values from &lt;code&gt;functionCall&lt;&#x2F;code&gt;. Use &lt;code&gt;functionSignature&lt;&#x2F;code&gt; to determine the parameter types for ABI encoding.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Enable &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3668&#x2F;&quot;&gt;ERC-3668&lt;&#x2F;a&gt;&lt;&#x2F;strong&gt;: Clients MUST enable &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3668&#x2F;&quot;&gt;ERC-3668&lt;&#x2F;a&gt; offchain data retrieval before calling the target&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Call the target&lt;&#x2F;strong&gt;: Execute the function on the target contract and chain. Use the provided &lt;code&gt;functionSelector&lt;&#x2F;code&gt; if available, otherwise compute it from &lt;code&gt;functionSignature&lt;&#x2F;code&gt; as &lt;code&gt;bytes4(keccak256(functionSignature))&lt;&#x2F;code&gt;. ABI-encode the parameters according to &lt;code&gt;functionSignature&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Get the result&lt;&#x2F;strong&gt;: Retrieve the return value from the function call.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Clients MAY choose NOT to resolve hooks if the target contract is not known to be secure and trustworthy. Some clients have &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3668&#x2F;&quot;&gt;ERC-3668&lt;&#x2F;a&gt; disabled by default, but clients MUST enable it before resolving the hook.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;write-operations&quot;&gt;Write Operations&lt;&#x2F;h3&gt;
&lt;p&gt;Write operations are also possible with hooks and follow the same flow as read operations, except that the transaction needs to be signed and submitted to the blockchain. The hook specifies the function to call, parameters, target contract, and chain, but instead of reading the result, the transaction is signed and broadcast to the network for inclusion in a block.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;example-cross-chain-kyc-credential-resolution&quot;&gt;Example: Cross-Chain KYC Credential Resolution&lt;&#x2F;h3&gt;
&lt;p&gt;A contract on Optimism can redirect its &lt;code&gt;&quot;kyc&quot;&lt;&#x2F;code&gt; metadata key to a trusted KYC provider contract on Ethereum mainnet:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Step 1: Store the hook in the originating contract (on Optimism)&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; HOOK_SELECTOR_WITHOUT_SELECTOR &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x6113bfa3&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Function signature with explicit types&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; functionSignature &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;getCredential(string)&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Function call with values&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; functionCall &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;getCredential(&amp;#39;kyc: 0x76F1Ff0186DDb9461890bdb3094AF74A5F24a162&amp;#39;)&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; KYCProvider on Ethereum mainnet (ERC-7930 format)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Chain: Ethereum mainnet (chain 1), Address: 0x1234...5678&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; target &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;000100000101141234567890abcdef1234567890abcdef12345678&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Create hook that calls getCredential(&amp;#39;kyc: 0x76F1Ff...&amp;#39;) on the KYC provider&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; hookData &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodeWithSelector&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    HOOK_SELECTOR_WITHOUT_SELECTOR&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    functionSignature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; First parameter when selector is omitted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    functionCall&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;(string)&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; return type&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    target&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Store the hook&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;originatingContract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;setContractMetadata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;kyc&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; hookData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Step 2: Client resolves the hook&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Client reads metadata from originating contract (on Optimism)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; originatingContract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getContractMetadata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;kyc&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Client detects this is a hook (starts with HOOK_SELECTOR)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; hasSelector&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;startsWith&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x037f43ed&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;value&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;startsWith&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x037f43ed&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;startsWith&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x6113bfa3&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Parse the hook (ABI decode after 4-byte selector)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; functionSelector&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; functionSignature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; functionCall&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; returnType&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; target&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;hasSelector&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; functionSelector&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; functionSignature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; functionCall&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; returnType&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; target&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; decodeHook&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; functionSignature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; functionCall&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; returnType&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; target&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; decodeHook&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        functionSelector&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; null&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify selector matches the function signature (checksum verification, if provided)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; computedSelector&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;functionSignature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;slice&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;functionSelector&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;functionSelector&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; computedSelector&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            throw&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Error&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Selector mismatch - function signature verification failed&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Use computed selector if not provided&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; selectorToUse&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; functionSelector&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; computedSelector&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Decode ERC-7930 address to get chain and contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; chainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; decodeERC7930&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;target&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; chainId = 1 (Ethereum mainnet)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address = 0x1234567890abcdef1234567890abcdef12345678&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify target is trusted (implementation-specific)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isTrustedResolver&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        throw&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Error&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Untrusted resolver&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Parse the function call string to get function name and parameter values&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; functionName&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; args&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; parseFunctionCall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;functionCall&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; functionName = &amp;quot;getCredential&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; args = [&amp;quot;kyc: 0x76F1Ff0186DDb9461890bdb3094AF74A5F24a162&amp;quot;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Use functionSignature to determine parameter types for ABI encoding&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; functionSignature = &amp;quot;getCredential(string)&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get provider for target chain and enable ERC-3668 (CCIP-Read)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; targetProvider&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getProviderForChain&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; targetContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ethers&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Contract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;function &lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;functionSignature&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; view returns (bytes)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        targetProvider&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ccipReadEnabled&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;true&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Enable CCIP-Read&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Resolve from target contract on Ethereum mainnet&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ABI-encode parameters according to functionSignature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; resultBytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; targetContract&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;functionName&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;...&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;args&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ABI-decode using returnType: &amp;quot;(string)&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; credential&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ethers&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;utils&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;defaultAbiCoder&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;decode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;returnType&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; resultBytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; credential = &amp;quot;Maria Garcia &#x2F;0x76F1Ff...&#x2F; ID: 146-DJH-6346-25294&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Hooks provide a complete specification for cross-chain function calls, including &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7930&#x2F;&quot;&gt;ERC-7930&lt;&#x2F;a&gt; interoperable address. This makes hooks entirely self-describing - any client can resolve them without external documentation or ABI files. For use cases including resolving credentials from known registries including PoP (Proof of Personhood) and KYC (Know Your Customer) credentials, the client needs to make sure the source of the credential is trustworthy and verified. Hooks allow clients to jump from a user&#x27;s metadata record, for example, to a KYC credential from a known credential issuer.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-include-both-function-selector-and-function-string&quot;&gt;Why Include Both Function Selector and Function String?&lt;&#x2F;h3&gt;
&lt;p&gt;Hooks include both an optional 4-byte function selector and a human-readable function call string. The selector provides type disambiguation (e.g., &lt;code&gt;getData(bytes32)&lt;&#x2F;code&gt; and &lt;code&gt;getData(bytes)&lt;&#x2F;code&gt; have different selectors, but &lt;code&gt;0x1234...&lt;&#x2F;code&gt; in the string is ambiguous), while the string provides human readability. Clients can verify the selector matches the function signature, rejecting mismatches as errors or tampering.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-use-erc-7930-interoperable-addresses&quot;&gt;Why Use ERC-7930 Interoperable Addresses?&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7930&#x2F;&quot;&gt;ERC-7930&lt;&#x2F;a&gt; addresses include chain information, making hooks a complete cross-chain function call specification. A hook specifies exactly what function to call, with what parameters, on which contract, on which chain. This eliminates ambiguity and enables secure cross-chain reads when combined with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3668&#x2F;&quot;&gt;ERC-3668&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-include-the-return-type&quot;&gt;Why Include the Return Type?&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;returnType&lt;&#x2F;code&gt; parameter allows clients to predict the return values without consulting documentation. It is also possible to predict if the return data is compatible with intended metadata. For example, if a bytes value redirects using hooks, that return value may need to also be bytes, according to the specific metadata standard (not specified here). Applications can impose their own constraints (e.g., requiring &lt;code&gt;(string)&lt;&#x2F;code&gt; for metadata hooks), but hooks themselves support any return type.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-mandate-erc-3668&quot;&gt;Why Mandate &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3668&#x2F;&quot;&gt;ERC-3668&lt;&#x2F;a&gt;?&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3668&#x2F;&quot;&gt;ERC-3668&lt;&#x2F;a&gt; (CCIP-Read) is a powerful technology that enables both cross-chain and verified offchain resolution of metadata. However, because some clients disable &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3668&#x2F;&quot;&gt;ERC-3668&lt;&#x2F;a&gt; by default due to security considerations, hooks explicitly mandate &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3668&#x2F;&quot;&gt;ERC-3668&lt;&#x2F;a&gt; support. This gives clients the opportunity to enable &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3668&#x2F;&quot;&gt;ERC-3668&lt;&#x2F;a&gt; specifically for hook resolution without needing to have it enabled globally. By tying &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3668&#x2F;&quot;&gt;ERC-3668&lt;&#x2F;a&gt; to hooks, clients can make a deliberate choice to enable it when resolving from known, trusted contracts, while keeping it disabled for general use.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Hooks are backwards compatible; clients that are not aware of hooks will simply return the hook encoding as the raw value.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;target-trust&quot;&gt;Target Trust&lt;&#x2F;h3&gt;
&lt;p&gt;The primary use of hooks is to resolve data from known contracts with verifiable security properties. Clients SHOULD:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Maintain a list of trusted target contract addresses or use a third-party registry&lt;&#x2F;li&gt;
&lt;li&gt;Fail when resolving from untrusted targets&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;recursive-hooks&quot;&gt;Recursive Hooks&lt;&#x2F;h3&gt;
&lt;p&gt;Implementations SHOULD limit the depth of hook resolution to prevent infinite loops where a hook resolves to another hook. A reasonable limit is 3-5 levels of indirection.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Increase Gas Cost of Point Evaluation</title>
        <published>2025-12-02T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Marcin Sobczak</name><uri>https://github.com/marcindsobczak</uri>
	</author>
	
	<author>
		<name>Kamil Chodoła</name><uri>https://github.com/kamilchodola</uri>
	</author>
	
	<author>
		<name>Marek Moraczyński</name><uri>https://github.com/MarekM25</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8096/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8096-point-evaluation-precompile-gas-cost-increase/26867" />
        

        <id>https://wg-eips.ritovision.com/8096/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:8096"
            label="EIP-8096" />
        

        
        

        
        <summary type="html">Increases cost of point evaluation precompile</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8096/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP modifies the gas cost of &lt;code&gt;point evaluation&lt;&#x2F;code&gt; precompile introduced in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently the &lt;code&gt;point evaluation&lt;&#x2F;code&gt; precompile is underpriced relative to its resource consumption. This EIP aims to address these discrepancies by adjusting the gas cost and making &lt;code&gt;point evaluation&lt;&#x2F;code&gt; precompile sufficiently efficient to enable potential further increases in the block gas limit.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Upon activation of this EIP, the gas cost of calling the precompile at address &lt;code&gt;0x000000000000000000000000000000000000000A&lt;&#x2F;code&gt; will be doubled from &lt;code&gt;50_000&lt;&#x2F;code&gt; gas to &lt;code&gt;100_000&lt;&#x2F;code&gt; gas.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Benchmarking the &lt;code&gt;point evaluation&lt;&#x2F;code&gt; precompile revealed that its gas cost is significantly underestimated. This modification aim to ensure that the &lt;code&gt;point evaluation&lt;&#x2F;code&gt; precompile&#x27;s performance no longer impedes potential increases to the block gas limit.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a backwards-incompatible change. However, similar gas repricings have occurred multiple times in the Ethereum ecosystem, and their effects are well understood.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP does not introduce any new functionality or make existing operations cheaper, therefore there are no direct security concerns related to new attack vectors or reduced cost.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>eth&#x2F;vhash - Blob-Aware Mempool</title>
        <published>2025-11-29T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Csaba Kiraly</name><uri>https://github.com/cskiraly</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8094/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8094-eth-vhash-blob-aware-mempool/26834" />
        

        <id>https://wg-eips.ritovision.com/8094/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="networking"
                label="Networking" />
            
        

        
        <category
            term="tag:eip:8094"
            label="EIP-8094" />
        

        
        

        
        <summary type="html">Make mempool messaging vhash aware</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8094/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP eliminates the need to redistribute blob content in the mempool if only the metadata (fees) of a transaction are updated, making RBF (replace-by-fee) more efficient and cheaper for the network. It achieves this modifying the devp2p ‘eth’ protocol to address blobs in type 3 transaction sidecars by content (vhash).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;In the current version of devp2p eth&#x2F;69, when a transaction is replaced, it must be redistributed in the mempool like any new transaction. Even if the actual content is largely the same, protocol participants have no means to figure this out before getting the full content, making a replacement use the same amount of network resources as a new transaction would.&lt;&#x2F;p&gt;
&lt;p&gt;What is especially problematic is that RBF is used most in periods of fee volatility, and a network overload is the typical case of such a situation. Thus, when there is already high demand, we make the situation worse by adding
extra traffic redistributing blob content that was already distributed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;transactions-0x02-changes&quot;&gt;Transactions (0x02) changes&lt;&#x2F;h3&gt;
&lt;p&gt;Type 3 transaction should be sent without sidecar&lt;&#x2F;p&gt;
&lt;h3 id=&quot;pooledtransactions-0x0a-changes&quot;&gt;PooledTransactions (0x0a) changes&lt;&#x2F;h3&gt;
&lt;p&gt;Type 3 transaction should be sent without sidecar&lt;&#x2F;p&gt;
&lt;h3 id=&quot;getpooledblobs-msg-code-to-be-assigned-todo&quot;&gt;GetPooledBlobs (msg code to be assigned &amp;lt;-- TODO --&amp;gt;)&lt;&#x2F;h3&gt;
&lt;p&gt;[request-id: P, [vhash₁: B_32, vhash₂: B_32, ...]]&lt;&#x2F;p&gt;
&lt;p&gt;This message requests blobs from the recipient&#x27;s transaction pool by vhash.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;pooledblobs-msg-code-to-be-assigned-todo&quot;&gt;PooledBlobs (msg code to be assigned &amp;lt;-- TODO --&amp;gt;)&lt;&#x2F;h3&gt;
&lt;p&gt;[request-id: P, [blob₁, blob₂...]]&lt;&#x2F;p&gt;
&lt;p&gt;This is the response to GetPooledBlobs, returning the requested blobs. The items in the list are blobs in the format described in the main Ethereum specification.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Note: optionally, we might prefix the blob format with the blob version number&lt;&#x2F;p&gt;
&lt;p&gt;Note: optionally, we might decide to improve the blob format allowing nodes to reconstruct RS encoding instead of using extra bandwidth, by sending the following fields per blob:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;blob version&lt;&#x2F;li&gt;
&lt;li&gt;blob content, &lt;strong&gt;excluding&lt;&#x2F;strong&gt; the erasure coding extension in case of version 1&lt;&#x2F;li&gt;
&lt;li&gt;blob commitment&lt;&#x2F;li&gt;
&lt;li&gt;blob proof(s), &lt;strong&gt;including&lt;&#x2F;strong&gt; cell proofs of the erasure coded piece in case of version 1&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;It is important to include all cell proofs to keep reconstruction CPU-efficient.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;The blobs must be in the same order as in the request, but it is OK to skip blobs which are not available. Since the recipient have to check that transmitted blob hashes correspond to the requested vhashes anyway, we can avoid sending the list of vhashes as part of this message.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Note: Optionally, we could extend this message with a bitmap of sent&#x2F;unsent blobs from the request, or with the list of vhashes sent. This information is redundant, but it can simplify processing on the receiver side.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h3 id=&quot;other-spec-changes&quot;&gt;Other spec changes&lt;&#x2F;h3&gt;
&lt;p&gt;EIP-4844 introduced the following:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Nodes MUST NOT automatically broadcast blob transactions to their peers. Instead, those transactions are only announced using NewPooledTransactionHashes messages, and can then be manually requested via GetPooledTransactions.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The above should be changed as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Nodes MUST send (broadcast or send in NewPooledTransactionHashes) blob transaction **without** sidecars to their peers. Peers can then request blob content using `GetPooledBlobs` messages. Nodes MUST NOT forward blob transactions before receiving and validating all blobs&amp;quot;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;A typical blob transaction RBF changes the fees only, while the sidecar (blob content) remains the same. If a node that has the previous version would know this, it could avoid pulling the sidecar, largely reducing bandwidth consumption. However, this is not possible with the current messaging. To make this happen, we have to expose blob (or at least sidecar) identifiers in mempool messaging.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;should-we-use-blob-identifiers-or-a-sidecar-identifier&quot;&gt;Should we use blob identifiers or a sidecar identifier?&lt;&#x2F;h3&gt;
&lt;p&gt;We can either use vhashes, or a sidecar level hash. The latter has the slight advantage of being a single element, thus simplifying message format, but it has several disadvantages:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;It would be a new identifier, while the blob level vhash is already well established (just not in devp2p)&lt;&#x2F;li&gt;
&lt;li&gt;It would not allow restructuring the message, sending e.g. less blobs under a fee surge&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Thus, we use vhashes.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;implementation-options&quot;&gt;Implementation options&lt;&#x2F;h3&gt;
&lt;p&gt;There are several options to bring vhashes to devp2p messaging:&lt;&#x2F;p&gt;
&lt;h4 id=&quot;option-1&quot;&gt;Option 1&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Extend announcements with vhashes&lt;&#x2F;li&gt;
&lt;li&gt;Allow nodes to request transaction with&#x2F;without sidecar content, or even selecting which parts are needed (bitmap or vhash list)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;option-2&quot;&gt;Option 2&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Extend announcements with nonce (see EIP-8077)&lt;&#x2F;li&gt;
&lt;li&gt;If hash differs from what we have, request with&#x2F;without sidecar content based on whether we already have the sidecars for the same nonce, assuming this is a simple replacement&lt;&#x2F;li&gt;
&lt;li&gt;Request again with sidecar if vhashes differ&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;option-3-selected&quot;&gt;Option 3 (selected)&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Push (or announce and then pull) type 3 transaction &lt;strong&gt;without sidecar&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Allow to &lt;strong&gt;request sidecar separately&lt;&#x2F;strong&gt; (new message type)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;At first it might seem that Option 3 is slowing down distribution, adding one more RTT latency per hop. However, since most type 3 transactions are small without a sidecar, we could change the protocol behaviour to allow pushing these transactions without the sidecar, leaving it to the receiver of the push to ask for the blobs if needed. Forwarding of type 3 transactions without sidecar should be prohibited until sidecars are fetched and the content can be verified.&lt;&#x2F;p&gt;
&lt;p&gt;After considering the above options, we chose to propose Option 3, introducing a new message type.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;relation-to-other-eips-in-draft-state&quot;&gt;Relation to other EIPs in draft state&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;EIP-8077 (announce source and nonce): the changes can be simply combined.&lt;&#x2F;li&gt;
&lt;li&gt;EIP-8070 (Sparse blobpool): both EIPs change how blob transactions are propagated over the network. The goal of the two EIPs are different. EIP-8070 is about a proportional bandwidth reduction in the normal case without dealing with specifics of RBF. This EIP is about enabling RBF without using extra bandwidth. The two EIPs can be combined, but the combination depends on the order of introduction, hence we leave this for later &amp;lt;-- TODO --&amp;gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP changes the eth protocol and requires rolling out a new version. Supporting multiple versions of a wire protocol is routine practice. Rolling out this new version does not break older clients, since they can keep using the previous protocol version.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP does not change consensus rules of the EVM and does not require a hard fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via CC0.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Associated Accounts</title>
        <published>2025-11-25T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Steve Katzman</name><uri>https://github.com/stevieraykatz</uri>
	</author>
	
	<author>
		<name>Amie Corso</name><uri>https://github.com/amiecorso</uri>
	</author>
	
	<author>
		<name>Stephan Cilliers</name><uri>https://github.com/stephancill</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8092/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-8092-associated-accounts/26858" />
        

        <id>https://wg-eips.ritovision.com/8092/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:8092"
            label="ERC-8092" />
        

        
        

        
        <summary type="html">A way to publicly associate two accounts with arbitrary contextual data</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8092/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This specification defines a standard for establishing and verifying associations between blockchain accounts. This allows addresses to publicly declare, prove and revoke a relationship with other addresses by sharing a standardized payload. For onchain applications, this payload may be signed by both parties for third-party authentication. This enables use cases like sub-account identity inheritance, authorization delegation, and reputation collation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;A key motivation is the simplification of multi-address resolution, which is essential for managing complex digital identities across multiple platforms and accounts. This simplification aims to streamline the process of locating and verifying individuals or entities by efficiently handling multiple addresses linked by Associations.
By providing a standard mechanism for signaling an association between two accounts, this standard unlocks the capability to link the activities or details of these accounts.&lt;&#x2F;p&gt;
&lt;p&gt;The inclusion of arbitrary data into the specified payload ensures flexibility for various use cases such as delegation, hierarchical relationships, and authentication. By maintaining a flexible architecture that accepts an interface identifier paired with arbitrary data bytes, accounts that associate can do so with application-specific context.&lt;&#x2F;p&gt;
&lt;p&gt;The system outlined in this document describes a way for two accounts to be linked by a specified data struct which describes the relationship between them. It offers the mechanism by which these parties can sign over the contents to prove validity. It focuses on the structure and process for generating, validating and revoking such records while maintaining an implementation agnostic approach.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “NOT RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;core-concepts&quot;&gt;Core Concepts&lt;&#x2F;h3&gt;
&lt;p&gt;Each Association between two accounts denotes the participating addresses as &lt;code&gt;initiator&lt;&#x2F;code&gt; and &lt;code&gt;approver&lt;&#x2F;code&gt;. These accounts can be on disparate chains with different architectures made possible by a combination of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7930&#x2F;&quot;&gt;ERC-7930&lt;&#x2F;a&gt; Interoperable Addresses and an enumeration of signature key types. To accommodate non-EVM account types, addresses are recorded in the association as raw bytes.&lt;&#x2F;p&gt;
&lt;p&gt;The specification outlines a nested structure for recording Associations:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;An underlying Associated Account Record (AAR) for storing accounts, timestamps and association context&lt;&#x2F;li&gt;
&lt;li&gt;A wrapper Signed Association Record (SAR) structure for storing signature and validation data&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;associated-account-record&quot;&gt;Associated Account Record&lt;&#x2F;h3&gt;
&lt;p&gt;The following is a Solidity implementation of an &lt;code&gt;AssociatedAccountRecord&lt;&#x2F;code&gt; which contains the shared payload describing the association.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Represents an association between two accounts.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AssociatedAccountRecord&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ERC-7930 binary representation of the initiating account&amp;#39;s address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span&gt; initiator&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ERC-7930 binary representation of the approving account&amp;#39;s address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span&gt; approver&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The timestamp from which the association is valid.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint40&lt;&#x2F;span&gt;&lt;span&gt; validAt&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The timestamp when the association expires.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint40&lt;&#x2F;span&gt;&lt;span&gt; validUntil&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Optional 4-byte selector for interfacing with the `data` field.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes4&lt;&#x2F;span&gt;&lt;span&gt; interfaceId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Optional additional data.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Where the AssociatedAccountRecord contains:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;initiator&lt;&#x2F;code&gt; is the binary representation of an ERC-7930 address for the initiating account.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;approver&lt;&#x2F;code&gt; is the binary representation of an ERC-7930 address for the approving account.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;validAt&lt;&#x2F;code&gt; is the timestamp from which the association is valid.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;validUntil&lt;&#x2F;code&gt; is the timestamp at which the association expires (optional).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;interfaceId&lt;&#x2F;code&gt; is the 4-byte interface or method selector for the &lt;code&gt;data&lt;&#x2F;code&gt; field (optional).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;data&lt;&#x2F;code&gt; is the arbitrary context data payload (optional).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;signed-association-record&quot;&gt;Signed Association Record&lt;&#x2F;h3&gt;
&lt;p&gt;When &lt;code&gt;AssociatedAccountRecord&lt;&#x2F;code&gt;s will be consumed in a trustless context, integrators SHOULD require that both parties sign over the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; hash of the &lt;code&gt;AssociatedAccountRecord&lt;&#x2F;code&gt; (see Support for EIP-712 below). The resulting signatures MUST be included in a &lt;code&gt;SignedAssociationRecord&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Complete payload containing a finalized association.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SignedAssociationRecord&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The timestamp the association was revoked.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint40&lt;&#x2F;span&gt;&lt;span&gt; revokedAt&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The initiator key type specifier.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes2&lt;&#x2F;span&gt;&lt;span&gt; initiatorKeyType&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The approver key type specifier.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes2&lt;&#x2F;span&gt;&lt;span&gt; approverKeyType&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The signature of the initiator.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span&gt; initiatorSignature&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The signature of the approver.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span&gt; approverSignature&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The underlying AssociatedAccountRecord.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        AssociatedAccountRecord record&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Where the SignedAssociationRecord contains:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;revokedAt&lt;&#x2F;code&gt; is the timestamp when the association was revoked, which is &lt;code&gt;0&lt;&#x2F;code&gt; unless the association has been revoked by either party.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;initiatorSignature&lt;&#x2F;code&gt; is the signature bytes generated by the &lt;code&gt;initiator&lt;&#x2F;code&gt; by signing the EIP-712 compliant hash of the AssociatedAccountRecord.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;initiatorKeyType&lt;&#x2F;code&gt; is the key type designator for the initiator&#x27;s signature (see Key Types below).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;approverSignature&lt;&#x2F;code&gt; is the signature bytes generated by the &lt;code&gt;approver&lt;&#x2F;code&gt; by signing the EIP-712 compliant hash of the AssociatedAccountRecord.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;approverKeyType&lt;&#x2F;code&gt; is the key type designator for the approver&#x27;s signature (see Key Types below).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;record&lt;&#x2F;code&gt; is the AssociatedAccountRecord that was signed by both parties.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;key-types&quot;&gt;Key Types&lt;&#x2F;h3&gt;
&lt;p&gt;To accommodate known curves and signing protocols while providing future extensibility, this specification relies on the enumeration of cryptographic curves and signing protocols. Each signature MUST be paired with a valid &quot;Key ID&quot; designator.&lt;&#x2F;p&gt;
&lt;p&gt;The Key IDs SHALL be identified as a 2-byte integer according to the following extensible table. We accommodate two types of keys:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Applied cryptographic curves (i.e. secp256k1)&lt;&#x2F;li&gt;
&lt;li&gt;Protocol integrations (i.e. WebAuthn, contract validation)&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;To distinguish these key types, the most significant bit in the 2-byte identifier SHALL be used as a bit flag. As such, key type protocols are constructed by bitwise OR:
&lt;code&gt;0x8000 | PROTOCOL_ID&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The resulting table enumerates the known keys and distinguishes between the two types:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Key ID&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Curve&#x2F;Standard&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;0x0000&lt;&#x2F;td&gt;&lt;td&gt;Delegated&lt;&#x2F;td&gt;&lt;td&gt;Delegated auth&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x0001&lt;&#x2F;td&gt;&lt;td&gt;K1&lt;&#x2F;td&gt;&lt;td&gt;secp256k1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x0002&lt;&#x2F;td&gt;&lt;td&gt;R1&lt;&#x2F;td&gt;&lt;td&gt;secp256r1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x0003&lt;&#x2F;td&gt;&lt;td&gt;BLS&lt;&#x2F;td&gt;&lt;td&gt;BLS12-381&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x0004&lt;&#x2F;td&gt;&lt;td&gt;EdDSA&lt;&#x2F;td&gt;&lt;td&gt;Ed25519&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x8001&lt;&#x2F;td&gt;&lt;td&gt;WebAuthn&lt;&#x2F;td&gt;&lt;td&gt;WebAuthn&#x2F;Passkey&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x8002&lt;&#x2F;td&gt;&lt;td&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;ERC-1271&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Contract validation&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x8003&lt;&#x2F;td&gt;&lt;td&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6492&#x2F;&quot;&gt;ERC-6492&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Predeploy contract validation&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;delegated-auth&quot;&gt;Delegated Auth&lt;&#x2F;h4&gt;
&lt;p&gt;In some contexts it might be ergonomic to delegate authorization to another account, access control mechanism, or external protocol. Implementers leveraging the &lt;code&gt;Delegated&lt;&#x2F;code&gt; key type MUST also publish how consumers can parse the application-specific delegation schema.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;support-for-eip-712&quot;&gt;Support for EIP-712&lt;&#x2F;h3&gt;
&lt;p&gt;All signatures contained in this specification MUST comply with EIP-712 wherein the signature preimage can be generated from:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;1901&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   DOMAIN_SEPARATOR&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;   keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;AssociatedAccountRecord(bytes initiator,bytes approver,uint40 validAt,uint40 validUntil,bytes4 interfaceId,bytes data)&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;initiator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;approver&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    validAt&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    validUntil&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    interfaceId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Where &lt;code&gt;DOMAIN_SEPARATOR&lt;&#x2F;code&gt; is defined according to EIP-712. The &lt;code&gt;DOMAIN_SEPARATOR&lt;&#x2F;code&gt; for this ERC SHALL be defined as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;EIP712Domain(string name,string version)&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;AssociatedAccounts&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;1&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;onchain-storage&quot;&gt;Onchain Storage&lt;&#x2F;h3&gt;
&lt;p&gt;If desired, a &lt;code&gt;SignedAssociationRecord&lt;&#x2F;code&gt; MAY be stored onchain in a context-specific storage contract.&lt;&#x2F;p&gt;
&lt;p&gt;An onchain storage contract SHALL comply with the following steps:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The SAR MUST be validated according to the steps detailed in the Validation section.&lt;&#x2F;li&gt;
&lt;li&gt;The contract MUST emit the &lt;code&gt;AssociationCreated&lt;&#x2F;code&gt; event:&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AssociationCreated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; initiator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approver&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;SignedAssociationRecord&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sar&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;hash&lt;&#x2F;code&gt; is the indexed hash for the SignedAssociationRecord, equivalent to the EIP-712 hash of the underlying AAR.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;initiator&lt;&#x2F;code&gt; is the keccak256 hash of the ERC-7930 address of the account that initiated the association.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;approver&lt;&#x2F;code&gt; is the keccak256 hash of the ERC-7930 address of the account that accepted and completed the association.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;sar&lt;&#x2F;code&gt; is the completed SignedAssociationRecord.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;If a SignedAssociationRecord is stored onchain, it MUST also be revokable onchain (see Revocation section below).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;offchain-storage&quot;&gt;Offchain Storage&lt;&#x2F;h3&gt;
&lt;p&gt;In some contexts, it might be desirable for Signed Association Records to be stored in an offchain store. While the implementation will differ from application-to-application, the following considerations SHOULD be taken into account:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Access to this data store MUST be made available to all expected consumers through publicly accessible endpoints&lt;&#x2F;li&gt;
&lt;li&gt;The store MUST perform validation on incoming Associations before storage&lt;&#x2F;li&gt;
&lt;li&gt;The location of this offchain store SHOULD be searchable by some standard fetching mechanism, e.g. a text record on an ENS name&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;validation&quot;&gt;Validation&lt;&#x2F;h3&gt;
&lt;p&gt;Clients or contracts determining whether a SignedAssociationRecord is valid at the time of consumption MUST check all of the following validation steps:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The current timestamp MUST be greater than or equal to the &lt;code&gt;validAt&lt;&#x2F;code&gt; timestamp.&lt;&#x2F;li&gt;
&lt;li&gt;If the &lt;code&gt;validUntil&lt;&#x2F;code&gt; timestamp is nonzero, the current timestamp MUST be less than the &lt;code&gt;validUntil&lt;&#x2F;code&gt; timestamp.&lt;&#x2F;li&gt;
&lt;li&gt;If the &lt;code&gt;revokedAt&lt;&#x2F;code&gt; timestamp is nonzero, the current timestamp MUST be less than the &lt;code&gt;revokedAt&lt;&#x2F;code&gt; timestamp.&lt;&#x2F;li&gt;
&lt;li&gt;If the &lt;code&gt;initiatorSignature&lt;&#x2F;code&gt; field is populated, the signature MUST be valid for the EIP-712 preimage of the underlying &lt;code&gt;AssociatedAccountRecord&lt;&#x2F;code&gt; using an appropriate &lt;code&gt;initiatorKeyType&lt;&#x2F;code&gt; validation mechanism.&lt;&#x2F;li&gt;
&lt;li&gt;If the &lt;code&gt;approverSignature&lt;&#x2F;code&gt; field is populated, the signature MUST be valid for the EIP-712 preimage of the underlying &lt;code&gt;AssociatedAccountRecord&lt;&#x2F;code&gt; using an appropriate &lt;code&gt;approverKeyType&lt;&#x2F;code&gt; validation mechanism.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Onchain validation is possible as long as there are sufficient validation mechanisms for the various key types used by the two accounts. In the case that validation occurs onchain, implementations MUST replace &quot;current timestamp&quot; with &lt;code&gt;block.timestamp&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;revocation&quot;&gt;Revocation&lt;&#x2F;h3&gt;
&lt;p&gt;Onchain Association stores MUST implement a revocation method. This method MUST allow either party of an Association to revoke a valid, active association by submitting a revocation request.&lt;&#x2F;p&gt;
&lt;p&gt;In such contexts, storage contracts MUST update the &lt;code&gt;revokedAt&lt;&#x2F;code&gt; field of the SAR to &lt;code&gt;block.timestamp&lt;&#x2F;code&gt; OR the account-specified revocation timestamp, whichever is greater. Then the implementation contract MUST emit the following event upon accepting a valid revocation request:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AssociationRevoked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; revokedBy&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; revokedAt&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;hash&lt;&#x2F;code&gt; is the indexed unique identifier for the association, equivalent to the EIP-712 hash of the underlying AAR.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;revokedBy&lt;&#x2F;code&gt; is the indexed keccak256 hash of the ERC-7930 address of the revoking account.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;revokedAt&lt;&#x2F;code&gt; is the timestamp at which the association is revoked.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Offchain stores MUST allow either account to revoke a stored association and MUST update the &lt;code&gt;revokedAt&lt;&#x2F;code&gt; timestamp accordingly.&lt;&#x2F;p&gt;
&lt;p&gt;If a previously revoked association is revoked again with an earlier timestamp, the earlier timestamp MUST take precedence.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;nested-structure-design&quot;&gt;Nested Structure Design&lt;&#x2F;h3&gt;
&lt;p&gt;The separation of &lt;code&gt;AssociatedAccountRecord&lt;&#x2F;code&gt; and &lt;code&gt;SignedAssociationRecord&lt;&#x2F;code&gt; into distinct structures serves a critical functional purpose. The inner &lt;code&gt;AssociatedAccountRecord&lt;&#x2F;code&gt; contains the immutable association payload that both parties must agree upon. This record can be shared, reviewed, and prepared while signatures are collected asynchronously from each party. The outer &lt;code&gt;SignedAssociationRecord&lt;&#x2F;code&gt; wrapper accumulates these signatures and metadata without modifying the underlying record.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;lack-of-existing-standards&quot;&gt;Lack of Existing Standards&lt;&#x2F;h3&gt;
&lt;p&gt;Currently, no standardized mechanism exists for establishing verifiable associations between blockchain accounts. Existing approaches are either application-specific or rely on proprietary schemas that limit interoperability. This specification addresses that gap by providing a common format that can be adopted across applications, enabling portability and composability of identity relationships.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;supporting-app-scoped-sub-accounts&quot;&gt;Supporting App-Scoped Sub Accounts&lt;&#x2F;h3&gt;
&lt;p&gt;Today&#x27;s blockchain ecosystem enforces a rigid one-to-one relationship between onchain identities and addresses, limiting users to a single address per identity. This specification breaks that constraint by enabling users to maintain a unified identity across multiple addresses. Users benefit from maintaining separate accounts for different contexts or applications while preserving the ability to verifiably link them to a primary identity when desired. This standard provides the mechanism for establishing these connections, enabling app-scoped sub accounts that can be provably associated with a root identity without sacrificing the flexibility and security benefits of address separation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;storage-agnosticism&quot;&gt;Storage Agnosticism&lt;&#x2F;h3&gt;
&lt;p&gt;Different association types have varying requirements for accessibility, cost, and decentralization. High-value associations requiring maximum trust minimization may warrant onchain storage despite higher costs, while frequent or ephemeral associations may be better suited for offchain stores. By remaining agnostic to storage location and requiring only that validation rules be consistently applied, this specification allows implementers to choose the appropriate tradeoffs for their use case without fragmenting the standard itself.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;For onchain applications, the validation mechanisms for some key types might be gas-cost prohibitive or entirely unavailable. It is the responsibility of the integrator to ensure that unsupported key types are appropriately handled given these constraints.&lt;&#x2F;p&gt;
&lt;p&gt;Offchain stores expose a trust vector to consumers. Integrators and consumers MUST take into account this centralization vector and expose the risk to users or offer mechanisms for minimizing the trust assumptions (i.e. storing some state onchain).&lt;&#x2F;p&gt;
&lt;p&gt;Associations SHOULD have a canonical storage location given an application. However, in the event that the same Association data is stored both on and offchain, precedence SHOULD be given to the onchain data.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Native rollups</title>
        <published>2025-11-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Luca Donno</name><uri>https://github.com/lucadonnoh</uri><email>donnoh@l2beat.com</email>
	</author>
	
	<author>
		<name>Justin Drake</name><uri>https://github.com/JustinDrake</uri><email>justin@ethereum.org</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8079/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8079-native-rollups/26565" />
        

        <id>https://wg-eips.ritovision.com/8079/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:8079"
            label="EIP-8079" />
        

        
        

        
        <summary type="html">Expose Ethereum&#x27;s STF as a precompile for rollups to use</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8079/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Expose the state transition function to the execution layer via a new &lt;code&gt;EXECUTE&lt;&#x2F;code&gt; precompile.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Today, EVM-equivalent rollups need to implement and maintain complex proof systems just to be able to replicate what Ethereum already provides on L1. Such complexity significantly increases the probability of encountering bugs and prevents projects from getting rid of security councils and from moving to Stage 2. EVM-equivalent projects are not similar enough and lack the proper incentives to benefit from each other efforts, significantly delaying multi-proof systems.&lt;&#x2F;p&gt;
&lt;p&gt;Moreover, to maintain feature parity with Ethereum, rollups need to implement bespoke governance systems that can&#x27;t be forced to follow Ethereum&#x27;s governance decisions, and thus are free to arbitrarily diverge from it. Because of this, the best that an EVM-equivalent rollup can do is to provide long exit windows for their users, to protect them from its governance going rogue. No finite (and reasonable) exit window can protect all use-cases, especially those that rely on timelocks (governance, staking contracts, vesting contracts). Longer exit windows protect more use-cases, at the cost of increase un-equivalence time.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP provides a way for rollups to reuse Ethereum&#x27;s state transition verification infrastructure, and as a consequence massively simplify their infrastructure and upgrade processes. This enables projects to better redirect resources towards user-facing features and products.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;!-- TODO --&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;PROOF_TX_TYPE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;Bytes1(TBD)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;EXECUTE_PRECOMPILE_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;TBD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ANCHOR_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;TBD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;execute-precompile&quot;&gt;&lt;code&gt;EXECUTE&lt;&#x2F;code&gt; precompile&lt;&#x2F;h3&gt;
&lt;p&gt;Add a precompile at &lt;code&gt;EXECUTE_PRECOMPILE_ADDRESS&lt;&#x2F;code&gt; that verifies a state transition function with the provided inputs.&lt;&#x2F;p&gt;
&lt;p&gt;The precompile executes the following logic:&lt;&#x2F;p&gt;
&lt;!-- TODO --&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; execute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;input&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Verify a `state_transition(chain: BlockChain, block: Block)`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Disable blob transactions and perform anchoring to enable L1-&amp;gt;L2 messaging.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    chain&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; TBD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; TBD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    anchor&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; TBD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    transactions&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_transactions&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Blob-carrying transactions are not supported&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; map&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;decode_transaction&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; transactions&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; isinstance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; BlobTransaction&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            raise&lt;&#x2F;span&gt;&lt;span&gt; ExecuteError&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block_env&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_block_env&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;chain&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Perform anchoring&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    process_unchecked_system_transaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        block_env&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;     =&lt;&#x2F;span&gt;&lt;span&gt;block_env&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        target_address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;ANCHOR_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;          =&lt;&#x2F;span&gt;&lt;span&gt;anchor&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state_transition&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;chain&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; TBD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;header-extension&quot;&gt;Header extension&lt;&#x2F;h3&gt;
&lt;p&gt;The current header encoding is extended with a new 64-bit unsigned integer field representing the total amount of native tokens burned in the current block as part of the base fee.&lt;&#x2F;p&gt;
&lt;p&gt;The resulting RLP encoding of the header is therefore:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;execution_payload_header_rlp = RLP([&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  parent_hash,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347, # ommers hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  coinbase,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  state_root,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  txs_root,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  receipts_root,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  logs_bloom,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  0, # difficulty&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  number,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  gas_limit,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  gas_used,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  timestamp,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  extradata,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  prev_randao,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  0x0000000000000000, # nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  base_fee_per_gas,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  withdrawals_root,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  burned_fees&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The cumulative value of &lt;code&gt;burned_fees&lt;&#x2F;code&gt; can be calculated as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;burned_fees&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; effective_gas_fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; gas_refund_amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; transaction_fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; blob_gas_fee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;By making the value available for L1, it is also automatically made available for native rollups too.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;proof-carrying-transactions&quot;&gt;Proof-carrying transactions&lt;&#x2F;h3&gt;
&lt;!-- TODO --&gt;
&lt;p&gt;TBD: heavily depends on the ZK L1 design.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;programmable-consensus-layer&quot;&gt;Programmable &quot;consensus layer&quot;&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;EXECUTE&lt;&#x2F;code&gt; precompile allows rollups to define their own inputs and constrained their behaviour through smart contract. For example, in contrast to Ethereum&#x27;s own consensus layer, a rollup can decide to:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Restrict the use of transactions that are sequenced by a permissioned entity, allowing for centralized sequencing and fast pre-confirmations, or leaving it open to everyone (based sequencing), or restrict it to a staked sequencer network;&lt;&#x2F;li&gt;
&lt;li&gt;Fix the &lt;code&gt;coinbase&lt;&#x2F;code&gt; address to be a DAO-controlled treasury, independent from the proposer address;&lt;&#x2F;li&gt;
&lt;li&gt;Tweak gas limits or prices based on specific needs;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This allows projects to preserve most of their configurations they already benefits from.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-tokens&quot;&gt;Gas tokens&lt;&#x2F;h3&gt;
&lt;p&gt;Several rollups implement new transaction types to be able to mint the rollup gas token when depositing funds on L1. We decide not to introduce complexity and instead rely on general L1-&amp;gt;L2 messaging to unlock pre-minted tokens, as other existing projects already do. As a consequence, projects are free to decide what type of L1 interaction triggers the release of the rollup gas token, trivially enabling custom gas tokens without the need to modify the EVM behaviour at all.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;anchoring&quot;&gt;Anchoring&lt;&#x2F;h3&gt;
&lt;p&gt;To support L1-&amp;gt;L2 messages, rollups need to be able to &quot;anchor&quot; information from L1 to the L2. Inspired by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4788&#x2F;&quot;&gt;EIP-4788&lt;&#x2F;a&gt; and existing implementations, we make use of a system transaction to inject a &lt;code&gt;bytes32 anchor&lt;&#x2F;code&gt; in the rollup state in a predeploy. This &lt;code&gt;anchor&lt;&#x2F;code&gt; can be used to relay L1&#x27;s state root, a message root, or a rolling hash, or something completely different, based on design preferences.&lt;&#x2F;p&gt;
&lt;p&gt;The trade-off of this approach, compared to some existing ones based on custom transaction types, is that the L2 side of an L1-&amp;gt;L2 message cannot have the &lt;code&gt;msg.sender&lt;&#x2F;code&gt; derived from the sender on L1, and therefore L1 access control-based smart contracts need to be adapted when deployed on L2 and used with cross-chain permissions. We believe this trade-off to be acceptable as the same scenario already exists when supporting L2-&amp;gt;L1 access controls, as Ethereum is already not natively aware of the L2 sender.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;basefee-collection&quot;&gt;Basefee collection&lt;&#x2F;h3&gt;
&lt;p&gt;While Ethereum burns the base fee, most rollups collect it for themselves, which enables opinionated funding models that are not possible on L1. To enable this use-case, and to minimize the code changes, we simply expose the amount of fees burned through the &lt;code&gt;burned_fees&lt;&#x2F;code&gt; block header value. Projects can now decide to ignore the value, burning the L2 base fee too, or credit the amount to some address, allowing for base fee collection from the L1-&amp;gt;L2 token escrow.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;re-execution-vs-zk-proofs&quot;&gt;Re-execution vs ZK proofs&lt;&#x2F;h3&gt;
&lt;!-- TODO --&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Existing rollups can more or less easily migrate to being native based on their degree of equivalency, as native rollups do not support custom opcodes, custom precompiles or custom transaction types within the exposed state transition function.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;!-- TODO --&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;!-- TODO --&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;!-- TODO --&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Let exits use the consolidation queue</title>
        <published>2025-11-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Francesco D&#x27;Amato</name><uri>https://github.com/fradamt</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8080/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8080-let-exits-use-the-consolidation-queue/26552" />
        

        <id>https://wg-eips.ritovision.com/8080/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:8080"
            label="EIP-8080" />
        

        
        

        
        <summary type="html">Allows exits to use consolidation queue, democratizing access to an unintended feature, improving liquidity while preserving security.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8080/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP allows exits to be routed through the consolidation queue when it is shorter than the exit queue, consuming churn that is allocated to consolidations. This democratizes access to a feature that is currently only available to validators with at least 2048 ETH through a loophole in the consolidation logic. The protocol then makes more efficient usage of the churn that its security parameters (weak subjectivity period) allow, and is able to process more exits without any security reduction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The existing design of consolidation mechanism allows validators with at least 2048 ETH to use the consolidation queue for exits through a loophole in the consolidation logic. When there is an imbalance between exit and consolidation queues favoring the latter, as has been the case since the introduction of the consolidation feature, this becomes an appealing way to speed up withdrawals. However, this feature is only available to a subset of validators, creating an unfair advantage.&lt;&#x2F;p&gt;
&lt;p&gt;Rather than removing this unintended feature, this EIP democratizes it by making it available to all exits. This approach preserves fairness by ensuring equal access to this efficiency improvement, while also providing concrete benefits to the network. When consolidation activity is low, the consolidation churn would otherwise go unused. By allowing exits to use this churn, we ensure it is not wasted and can be put to productive use. This is particularly important given the current state of exit queue congestion, as the exit queue has been longer than forty days for an extended period of time. Long queues degrade user experience, slow operator response to market or operational events, and reduce the network&#x27;s ability to reconfigure stake more quickly after adverse events. Besides, solo stakers are arguably the participants that suffer the most from a lack of liquidity today, as they do not have the ability to issue a liquid staking token or maintain liquidity reserves.&lt;&#x2F;p&gt;
&lt;p&gt;By allowing exits to use consolidation churn when available, the maximum exit throughput increases significantly, without any security reduction since we are only reallocating churn that the protocol has already accounted for. In particular, the maximum exit churn that can be processed becomes &lt;code&gt;get_activation_exit_churn_limit(state) + 3 * get_consolidation_churn_limit(state) &#x2F;&#x2F; 2&lt;&#x2F;code&gt;, where the &lt;code&gt;3 &#x2F;&#x2F; 2&lt;&#x2F;code&gt; factor comes from the fact that one unit of exit churn corresponds to 2&#x2F;3 of a unit of consolidation churn. With current parameters and with the current total stake approximately 35.7M ETH, this results in 256 (the capped exit churn) + (544 - 256) * 3&#x2F;2 (the consolidation churn adjusted by the 3&#x2F;2 factor) = 688 ETH per epoch, representing approximately a 2.5x increase over the current maximum exit churn of 256 ETH per epoch.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc2119&quot;&gt;RFC 2119&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc8174&quot;&gt;RFC 8174&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Starting from the beginning of the epoch when this EIP is activated, Consensus Layer clients &lt;strong&gt;MUST&lt;&#x2F;strong&gt; use the modified &lt;code&gt;compute_exit_epoch_and_update_churn&lt;&#x2F;code&gt; function which routes exits through the consolidation queue when it is shorter than the exit queue.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;modified-compute-exit-epoch-and-update-churn&quot;&gt;Modified &lt;code&gt;compute_exit_epoch_and_update_churn&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The only modification is this addition at the start of &lt;code&gt;compute_exit_epoch_and_update_churn&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;earliest_exit_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;earliest_consolidation_epoch&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; compute_consolidation_epoch_and_update_churn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; exit_balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In particular, we route exits through the consolidation queue whenever &lt;code&gt;state.earliest_exit_epoch &amp;gt; state.earliest_consolidation_epoch&lt;&#x2F;code&gt;, by using &lt;code&gt;compute_consolidation_epoch_and_update_churn&lt;&#x2F;code&gt;. Note that the &lt;code&gt;exit_balance&lt;&#x2F;code&gt; passed to the latter is only &lt;code&gt;2 * exit_balance &#x2F;&#x2F; 3&lt;&#x2F;code&gt;, because each unit of exit churn corresponds to 2&#x2F;3 units of consolidation churn from a weak subjectivity perspective. This way, we keep the weak subjectivity impact of the consolidation queue the same regardless of whether it is used by consolidations or by exits, maximizing the amount of operations we can process while keeping the same security guarantees.&lt;&#x2F;p&gt;
&lt;p&gt;The full function is as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; compute_exit_epoch_and_update_churn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; exit_balance&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Gwei&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Epoch&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    activation_exit_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; compute_activation_exit_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;get_current_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    earliest_exit_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;earliest_exit_epoch&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; activation_exit_epoch&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; NEW in this EIP&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    earliest_consolidation_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;earliest_consolidation_epoch&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; activation_exit_epoch&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; earliest_exit_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; earliest_consolidation_epoch&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; compute_consolidation_epoch_and_update_churn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; exit_balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; UNCHANGED FROM HERE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    per_epoch_churn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_exit_churn_limit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; New epoch for exits.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;earliest_exit_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; earliest_exit_epoch&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        exit_balance_to_consume&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; per_epoch_churn&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        exit_balance_to_consume&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;exit_balance_to_consume&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Exit doesn&amp;#39;t fit in the current earliest epoch.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; exit_balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; exit_balance_to_consume&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        balance_to_process&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; exit_balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; exit_balance_to_consume&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        additional_epochs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;balance_to_process&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; per_epoch_churn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        earliest_exit_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; additional_epochs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        exit_balance_to_consume&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; additional_epochs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; per_epoch_churn&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Consume the balance and update state variables.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;exit_balance_to_consume&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; exit_balance_to_consume&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; exit_balance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;earliest_exit_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; earliest_exit_epoch&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;earliest_exit_epoch&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The decision to democratize access to this unintended feature, rather than removing it or keeping it as is, is driven by:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Fairness&lt;&#x2F;strong&gt;: All validators gain equal access to this efficiency improvement, rather than it being restricted to those with at least 2048 ETH who can exploit the loophole.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Efficiency&lt;&#x2F;strong&gt;: When consolidation activity is low, the consolidation churn would otherwise go unused. By allowing exits to use this churn, we ensure it is not wasted and can be put to productive use, improving staking liquidity with unchanged security guarantees.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;To summarize, fairness is a strong motivation to either remove the feature or democratize it, and democratizing it is preferable to removing because we get a lot of efficiency benefits from it without any security cost.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces backwards-incompatible changes to the Consensus Layer and must be activated via scheduled network upgrade.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;&amp;lt;-- TODO --&amp;gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;weak-subjectivity-period&quot;&gt;Weak subjectivity period&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP does not impact the weak subjectivity period at all. The total churn remains the same, it is just allocated differently. In particular, the conversion factor (&lt;code&gt;exit_balance * 2 &#x2F;&#x2F; 3&lt;&#x2F;code&gt;) preserves the same weak subjectivity impact regardless of whether consolidation churn is allocated to exits or to consolidations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>eth&#x2F;XX - announce transactions with nonce</title>
        <published>2025-11-07T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Csaba Kiraly</name><uri>https://github.com/cskiraly</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8077/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8077-eth-xx-add-nonce-and-source-to-transactions-announcement/26505" />
        

        <id>https://wg-eips.ritovision.com/8077/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="networking"
                label="Networking" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:8077"
            label="EIP-8077" />
        

        
        

        
        <summary type="html">Adds source and nonce to transaction announcements</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8077/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP improves mempool propagation, extending the devp2p &#x27;eth&#x27; protocol&#x27;s &lt;code&gt;NewPooledTransactionHashes&lt;&#x2F;code&gt; message to also announce each transaction&#x27;s source address and nonce together with the already announced hash, type, and size.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Transactions are propagated in the Mempool using the devp2p protocol in two modalities. Eager push is only used for small transactions, and only towards a few nodes, while the rest of nodes receive only announcements. For large transactions and for type 3 transactions, only announcements are sent. This announcement is made using the &lt;code&gt;NewPooledTransactionHashes&lt;&#x2F;code&gt; message, which only contains the hash, the type and the size of each transaction. As it is now, the receiver of the announcement does not have enough information to make intelligent scheduling choices. This crates several issues:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;the receiver of the announcement can only base its logic on the order of announcements, but if it schedules requests to different peers, it can easily end up pulling transactions that leave a nonce gap in it&#x27;s own view of the mempool, making the pulled transaction non-includable,&lt;&#x2F;li&gt;
&lt;li&gt;filling existing gaps is hard, since in the absence of sender&#x2F;nonce information it can only be done with trial and error, requesting more transactions of missing hashes,&lt;&#x2F;li&gt;
&lt;li&gt;to filter out old transaction announcements, the node has to keep a cache of all transaction hashes on chain, instead of simply checking the nonce against current chain state,&lt;&#x2F;li&gt;
&lt;li&gt;receivers have no way to selectively request transactions with specific source addresses, which would be important UX and L2s.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Moreover, as we are increasing the throughput of block building, it is more and more probable that we end up in a state where nodes can&#x27;t fetch all transactions. This extension allows nodes to do selective fetching and gap filling while keeping a consistent state of their own view of the mempool without nonce gaps.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;newpooledtransactionhashes-message-changes&quot;&gt;NewPooledTransactionHashes message changes&lt;&#x2F;h3&gt;
&lt;p&gt;Modify the NewPooledTransactionHashes (0x08) message as follows:&lt;&#x2F;p&gt;
&lt;p&gt;(eth&#x2F;69): [txtypes: B, [txsize₁: P, txsize₂: P, ...], [txhash₁: B_32, txhash₂: B_32, ...]]&lt;&#x2F;p&gt;
&lt;p&gt;(eth&#x2F;XX): [txtypes: B, [txsize₁: P, txsize₂: P, ...], [txhash₁: B_32, txhash₂: B_32, ...], [txsource₁: B_20, txsource₂: B_20, ...], [txnonce₁: P, txnonce₂: P, ...]]&lt;&#x2F;p&gt;
&lt;h3 id=&quot;changes-to-message-handling&quot;&gt;Changes to message handling&lt;&#x2F;h3&gt;
&lt;p&gt;Changes on the sender side of &lt;code&gt;NewPooledTransactionHashes&lt;&#x2F;code&gt; messages are trivial. Only the transmitted data changes. Since the size of announcements is increased, implementations MAY revisit the condition (typically transaction size) to select between eager push and announcement.&lt;&#x2F;p&gt;
&lt;p&gt;At the receiver side of &lt;code&gt;NewPooledTransactionHashes&lt;&#x2F;code&gt; messages the extra information can be used to improve scheduling choices, however these are not mandated by the protocol and thus we leave it to implementations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;To solve the transaction propagation issues mentioned in the Motivation section, nodes require more information about a transaction then its hash, size, and type. By adding the source and the nonce, the receiver has enough information to make better fetch decisions.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;overhead&quot;&gt;Overhead&lt;&#x2F;h3&gt;
&lt;p&gt;The modification adds a significant overhead to announcements by adding a B_20 and a variable size filed to the current B_32, size, and type fields. We think this overhead is worth
the additional gain in protocol efficiency. Details TBD &amp;lt;-- TODO --&amp;gt; .&lt;&#x2F;p&gt;
&lt;h3 id=&quot;alternatives&quot;&gt;Alternatives&lt;&#x2F;h3&gt;
&lt;p&gt;While the modification is relatively straightforward, there are several design variants to
consider. First of all, small transactions are mostly propagating by the push mechanism, while
announcement based pull is only used as recovery. We could choose to avoid the extra announcement overhead for these, however it would mean that filling nonce gaps remains difficult, only possible by trial-and-error.&lt;&#x2F;p&gt;
&lt;p&gt;Another possibility similar to the previous one is to restrict the mechanism to blob transactions only. We choose not to restrict it in the proposal for the same reasons as in the previous point.&lt;&#x2F;p&gt;
&lt;p&gt;If the traffic overhead from notifications is a concern, it is also worth considering how many nodes should announcements be sent to. While this is not mandated by the protocol, a typical implementation is to send announcements to all neighbors (except the ones that already signaled having it, and the ones to which the message is pushed). Should nodes send announcements to all peers, or only part of their peer set (e.g. proportional, or to a fixed number of peers)? The protocol allows to only part, and in case of bandwidth constraints it seems better to send more metadata (addresses and nonces) to fewer peers.&lt;&#x2F;p&gt;
&lt;p&gt;Currently, for any given transaction, nodes receive announcements from many peers. About half of their peers, on average. Having the whole metadata (txhash, type, size, source, nonce) in all these is highly redundant. We could remove some of this overhead, e.g. by having a probabilistic choice between a simple announcement and a detailed announcement. The gain however seems marginal compared to the added complexity.&lt;&#x2F;p&gt;
&lt;p&gt;Sending the source and the nonce opens up the possibility of a design variant where the transaction identifier in the announcements is based on these values, and not on the txhash. More specifically, a transaction could be identified by the source, the nonce, and an extra version number signaling the RBF (replace-by-fee) version in the given source&#x2F;nonce scope. This variant would require deeper changes since the RBF version would need to be signed.&lt;&#x2F;p&gt;
&lt;p&gt;As an alternative to the above, fee values can be used as a proxy for the RBF version. Since the RBF requirement is anyway fee based, and the fee is already signed, adding the fee information to the announcement allows the receiver to compare different versions and pull the newer one. Moreover, having the fee information already in the announcement also allows nodes to anticipate their transaction ordering decisions and avoid pulling transactions that would be dropped, providing further traffic reduction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP changes the eth protocol and requires rolling out a new version. Supporting multiple versions of a wire protocol is routine practice. Rolling out this new version does not break older clients, since they can keep using the previous protocol version.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP does not change consensus rules of the EVM and does not require a hard fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The announced source address and nonce cannot be verified by the recipient until the transaction is actually fetched (or received through eager push). Therefore, it should not be handled as trusted information. This does not compromise the security of the protocol.&lt;&#x2F;p&gt;
&lt;p&gt;A mismatch between the announced &amp;lt;txhash,type,size,address,nonce&amp;gt; tuple and a received transaction should be handled as a protocol violation. More in detail, after the verification of the transaction hash, it becomes clear that the sender of the announcement was either malicious, or it sent an announcement without verifying its content. Thus, the sender of the offending announcement can be treated as a node that violated the protocol.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via CC0.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Transaction Inclusion Subscription</title>
        <published>2025-10-31T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Łukasz Rozmej</name><uri>https://github.com/LukaszRozmej</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8072/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8072-transaction-inclusion-subscription/26431" />
        

        <id>https://wg-eips.ritovision.com/8072/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="interface"
                label="Interface" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:8072"
            label="EIP-8072" />
        

        
        

        
        <summary type="html">Submit transactions and subscribe to transaction inclusion events using eth_subscribe</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8072/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP extends the existing &lt;code&gt;eth_subscribe&lt;&#x2F;code&gt; JSON-RPC method with a new subscription type &lt;code&gt;transactionInclusion&lt;&#x2F;code&gt; that enables clients to receive real-time notifications when transactions are included in blocks. This subscription-based approach provides efficient transaction confirmation monitoring without blocking connections, supporting both combined transaction submission and monitoring in a single call, as well as monitoring of already-submitted transactions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Current transaction submission workflows require separate calls to &lt;code&gt;eth_sendRawTransaction&lt;&#x2F;code&gt; followed by repeated polling of &lt;code&gt;eth_getTransactionReceipt&lt;&#x2F;code&gt;, creating unnecessary latency and network overhead. While &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7966&#x2F;&quot;&gt;EIP-7966&lt;&#x2F;a&gt; proposes &lt;code&gt;eth_sendRawTransactionSync&lt;&#x2F;code&gt; to address this through a synchronous blocking approach, blocking HTTP connections presents significant drawbacks:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Connection hogging&lt;&#x2F;strong&gt;: Each transaction blocks one HTTP connection until confirmation or timeout&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Limited scalability&lt;&#x2F;strong&gt;: Cannot efficiently monitor multiple transactions over a single connection&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Timeout complexity&lt;&#x2F;strong&gt;: Requires careful tuning of timeout parameters for different blockchain slot times&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Resource inefficiency&lt;&#x2F;strong&gt;: Repeated polling consumes bandwidth and server resources&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The subscription-based approach leverages the battle-tested &lt;code&gt;eth_subscribe&lt;&#x2F;code&gt; mechanism already implemented across all major Ethereum clients, providing superior resource efficiency and scalability while maintaining feature parity with synchronous approaches.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc2119&quot;&gt;RFC 2119&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc8174&quot;&gt;RFC 8174&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;new-subscription-type&quot;&gt;New Subscription Type&lt;&#x2F;h3&gt;
&lt;p&gt;A new subscription type &lt;code&gt;transactionInclusion&lt;&#x2F;code&gt; is added to the &lt;code&gt;eth_subscribe&lt;&#x2F;code&gt; method.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;subscription-request&quot;&gt;Subscription Request&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;method&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_subscribe&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;transactionInclusion&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;transaction&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;includeReorgs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Or for monitoring an already-submitted transaction:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;method&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_subscribe&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;transactionInclusion&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;includeReorgs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;p&gt;The subscription parameters object accepts the following fields:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;transaction&lt;&#x2F;code&gt; (DATA, optional): Signed transaction data to submit and monitor. When provided, the node MUST immediately submit this transaction to the network.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;hash&lt;&#x2F;code&gt; (DATA, 32 bytes, optional): Transaction hash to monitor for already-submitted transactions.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;includeReorgs&lt;&#x2F;code&gt; (boolean, optional, default: &lt;code&gt;false&lt;&#x2F;code&gt;): Controls reorg monitoring behavior.
&lt;ul&gt;
&lt;li&gt;If &lt;code&gt;false&lt;&#x2F;code&gt;: Subscription auto-unsubscribes immediately after first inclusion notification. Reorgs are not monitored.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;true&lt;&#x2F;code&gt;: Subscription actively monitors for reorgs and sends notifications for reorgs, re-inclusions, and finalization.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Exactly one&lt;&#x2F;strong&gt; of &lt;code&gt;transaction&lt;&#x2F;code&gt; or &lt;code&gt;hash&lt;&#x2F;code&gt; MUST be provided. If both or neither are provided, the node MUST return a JSON-RPC error with code &lt;code&gt;-32602&lt;&#x2F;code&gt; (Invalid params).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;subscription-response&quot;&gt;Subscription Response&lt;&#x2F;h3&gt;
&lt;p&gt;Upon successful subscription, the node MUST return a subscription ID:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1234567890abcdef&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;notification-format&quot;&gt;Notification Format&lt;&#x2F;h3&gt;
&lt;p&gt;When the transaction status changes, the node MUST send a notification:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;method&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_subscription&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;subscription&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1234567890abcdef&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;status&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;included&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;blockHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;blockNumber&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;transactionIndex&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;receipt&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;transactionHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;transactionIndex&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;blockHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;blockNumber&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;from&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;cumulativeGasUsed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gasUsed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;contractAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; null&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;logs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;logsBloom&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;status&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;status&lt;&#x2F;code&gt; field MAY be one of:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;&quot;included&quot;&lt;&#x2F;code&gt;: Transaction has been included in a block&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;&quot;finalized&quot;&lt;&#x2F;code&gt;: Transaction&#x27;s block has reached finality (only sent when &lt;code&gt;includeReorgs&lt;&#x2F;code&gt; is &lt;code&gt;true&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;&quot;reorged&quot;&lt;&#x2F;code&gt;: Transaction was removed from the canonical chain (only sent if &lt;code&gt;includeReorgs&lt;&#x2F;code&gt; is &lt;code&gt;true&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;code&gt;receipt&lt;&#x2F;code&gt; field MUST contain the complete transaction receipt object as defined by &lt;code&gt;eth_getTransactionReceipt&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;behavior&quot;&gt;Behavior&lt;&#x2F;h3&gt;
&lt;p&gt;The node MUST implement the following behavior:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;When &lt;code&gt;transaction&lt;&#x2F;code&gt; is provided&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The node MUST immediately submit the transaction to the network using the same semantics as &lt;code&gt;eth_sendRawTransaction&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;The node MUST derive the transaction hash and begin monitoring for inclusion&lt;&#x2F;li&gt;
&lt;li&gt;If submission fails, the node MUST return a JSON-RPC error and MUST NOT create the subscription&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Transaction Already Included&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If the monitored transaction is already included in a block at subscription time:
&lt;ul&gt;
&lt;li&gt;If &lt;code&gt;includeReorgs&lt;&#x2F;code&gt; is &lt;code&gt;false&lt;&#x2F;code&gt;: The node MUST immediately send an inclusion notification and automatically unsubscribe&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;includeReorgs&lt;&#x2F;code&gt; is &lt;code&gt;true&lt;&#x2F;code&gt;: The node MUST immediately send an inclusion notification and continue monitoring until finalization&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Pending Transaction&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The node MUST monitor the transaction pool and canonical chain&lt;&#x2F;li&gt;
&lt;li&gt;When the transaction is included in a block, the node MUST send an inclusion notification&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;includeReorgs&lt;&#x2F;code&gt; is &lt;code&gt;false&lt;&#x2F;code&gt;, the node MUST then automatically unsubscribe&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;includeReorgs&lt;&#x2F;code&gt; is &lt;code&gt;true&lt;&#x2F;code&gt;, the node MUST continue monitoring&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Reorg Monitoring&lt;&#x2F;strong&gt; (when &lt;code&gt;includeReorgs&lt;&#x2F;code&gt; is &lt;code&gt;true&lt;&#x2F;code&gt;):&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The node MUST continue monitoring the transaction after initial inclusion&lt;&#x2F;li&gt;
&lt;li&gt;If the transaction is removed from the canonical chain due to a reorg, the node MUST send a notification with &lt;code&gt;&quot;status&quot;: &quot;reorged&quot;&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;If the transaction is re-included in a different block, the node MUST send a new inclusion notification with &lt;code&gt;&quot;status&quot;: &quot;included&quot;&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;When the block containing the transaction reaches finality, the node MUST send a finalization notification with &lt;code&gt;&quot;status&quot;: &quot;finalized&quot;&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;The node MUST automatically unsubscribe after sending the finalization notification&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Auto-unsubscribe&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If &lt;code&gt;includeReorgs&lt;&#x2F;code&gt; is &lt;code&gt;false&lt;&#x2F;code&gt;, the node MUST automatically unsubscribe after sending the first inclusion notification&lt;&#x2F;li&gt;
&lt;li&gt;The node SHOULD send an &lt;code&gt;eth_subscription&lt;&#x2F;code&gt; unsubscribe confirmation&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Transaction Not Found&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If monitoring a transaction by &lt;code&gt;hash&lt;&#x2F;code&gt; that doesn&#x27;t exist in the mempool or chain, the subscription remains active&lt;&#x2F;li&gt;
&lt;li&gt;The node SHOULD monitor for the transaction appearing in the future&lt;&#x2F;li&gt;
&lt;li&gt;Clients MAY manually unsubscribe if desired&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-subscription-over-synchronous&quot;&gt;Why Subscription Over Synchronous?&lt;&#x2F;h3&gt;
&lt;p&gt;Subscriptions provide several advantages over the synchronous approach proposed in EIP-7966:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Non-blocking&lt;&#x2F;strong&gt;: Clients can perform other operations while waiting for confirmation&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Multiplexing&lt;&#x2F;strong&gt;: Multiple transactions can be monitored over a single WebSocket connection&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;No timeout complexity&lt;&#x2F;strong&gt;: Subscriptions naturally handle varying confirmation times without timeout parameters&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Proven infrastructure&lt;&#x2F;strong&gt;: Leverages existing &lt;code&gt;eth_subscribe&lt;&#x2F;code&gt; implementation present in all major clients&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The addition of the &lt;code&gt;transaction&lt;&#x2F;code&gt; parameter provides complete feature parity with &lt;code&gt;eth_sendRawTransactionSync&lt;&#x2F;code&gt; by enabling submission and monitoring in a single call.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-extend-eth-subscribe&quot;&gt;Why Extend &lt;code&gt;eth_subscribe&lt;&#x2F;code&gt;?&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;eth_subscribe&lt;&#x2F;code&gt; mechanism is battle-tested and already implemented across all major Ethereum clients. Extending it with a new subscription type requires minimal implementation effort compared to introducing entirely new RPC methods.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-support-both-transaction-and-hash&quot;&gt;Why Support Both &lt;code&gt;transaction&lt;&#x2F;code&gt; and &lt;code&gt;hash&lt;&#x2F;code&gt;?&lt;&#x2F;h3&gt;
&lt;p&gt;Supporting both parameters provides maximum flexibility:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;transaction&lt;&#x2F;code&gt;: Optimal for new transactions, matching the convenience of synchronous methods&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;hash&lt;&#x2F;code&gt;: Enables monitoring of transactions submitted through other means or by other parties&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;why-support-reorg-monitoring&quot;&gt;Why Support Reorg Monitoring?&lt;&#x2F;h3&gt;
&lt;p&gt;Applications requiring high confidence in transaction finality benefit from reorg notifications. This is particularly important on chains with faster block times where reorgs may be more common. The optional nature of this feature allows applications to choose the appropriate trade-off between functionality and resource usage.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;resource-efficiency&quot;&gt;Resource Efficiency&lt;&#x2F;h3&gt;
&lt;p&gt;A single WebSocket connection can support unlimited concurrent transaction subscriptions, whereas synchronous approaches require one blocking HTTP connection per transaction. This represents a significant improvement in resource utilization for applications monitoring multiple transactions.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-always-auto-unsubscribe&quot;&gt;Why Always Auto-unsubscribe?&lt;&#x2F;h3&gt;
&lt;p&gt;Both modes auto-unsubscribe to prevent unbounded subscription accumulation and provide clear lifecycle management:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;includeReorgs: false&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: Unsubscribes immediately after first inclusion for fast feedback with minimal resource usage. Users accepting this mode understand the transaction may still be reorged and can manually monitor if needed.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;includeReorgs: true&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: Unsubscribes after finalization when reorgs are no longer possible, providing complete transaction lifecycle monitoring.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The key difference is the level of guarantee:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;includeReorgs: false&lt;&#x2F;code&gt;: Fast notification, transaction is included (may still reorg)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;includeReorgs: true&lt;&#x2F;code&gt;: Complete lifecycle tracking until finality (cannot reorg)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is fully backwards compatible. It extends the existing &lt;code&gt;eth_subscribe&lt;&#x2F;code&gt; method with a new subscription type. Clients that have not implemented this feature will return a standard JSON-RPC error indicating the subscription type is not supported. Existing applications continue to function unchanged.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;test-case-1-submit-and-monitor&quot;&gt;Test Case 1: Submit and Monitor&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;Request:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;method&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_subscribe&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;transactionInclusion&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;transaction&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xf86c098504a817c800825208943535353535353535353535353535353535353535880de0b6b3a76400008025a028ef61340bd939bc2195fe537567866003e1a15d3c71ff63e1590620aa636276a067cbe9d8997f761aecb703304b3800ccf555c9f3dc64214b297fb1966a3b6d83&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Expected Behavior:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Node submits transaction to network&lt;&#x2F;li&gt;
&lt;li&gt;Node returns subscription ID&lt;&#x2F;li&gt;
&lt;li&gt;When transaction is included, node sends notification with &lt;code&gt;&quot;status&quot;: &quot;included&quot;&lt;&#x2F;code&gt; and receipt&lt;&#x2F;li&gt;
&lt;li&gt;Subscription automatically closes immediately&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;test-case-2-monitor-existing-transaction&quot;&gt;Test Case 2: Monitor Existing Transaction&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;Request:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;method&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_subscribe&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;transactionInclusion&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;includeReorgs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Expected Behavior:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;If transaction already included, immediately send notification with &lt;code&gt;&quot;status&quot;: &quot;included&quot;&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;If transaction pending, wait and send notification upon inclusion&lt;&#x2F;li&gt;
&lt;li&gt;Subscription automatically closes immediately after notification&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;test-case-3-reorg-monitoring&quot;&gt;Test Case 3: Reorg Monitoring&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;Request:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;method&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_subscribe&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;transactionInclusion&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;includeReorgs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Expected Behavior:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Send inclusion notification when transaction is included (with &lt;code&gt;&quot;status&quot;: &quot;included&quot;&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;Continue monitoring for reorgs&lt;&#x2F;li&gt;
&lt;li&gt;If reorg occurs, send reorg notification (with &lt;code&gt;&quot;status&quot;: &quot;reorged&quot;&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;If re-included, send new inclusion notification (with &lt;code&gt;&quot;status&quot;: &quot;included&quot;&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;When block is finalized, send finalization notification (with &lt;code&gt;&quot;status&quot;: &quot;finalized&quot;&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;Subscription automatically closes after finalization&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;test-case-4-invalid-parameters&quot;&gt;Test Case 4: Invalid Parameters&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;Request:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;method&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_subscribe&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;transactionInclusion&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;includeReorgs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Expected Response:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;code&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -32602&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;message&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Invalid params: exactly one of transaction or hash must be provided&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;A minimal reference implementation can be realized by:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;For &lt;code&gt;transaction&lt;&#x2F;code&gt; parameter: Call internal &lt;code&gt;eth_sendRawTransaction&lt;&#x2F;code&gt; logic and capture the transaction hash&lt;&#x2F;li&gt;
&lt;li&gt;Register the transaction hash in a subscription manager&lt;&#x2F;li&gt;
&lt;li&gt;Monitor the transaction pool and canonical chain for the transaction&lt;&#x2F;li&gt;
&lt;li&gt;When the transaction is included in a block, query the receipt and send notification&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;includeReorgs&lt;&#x2F;code&gt; is false, automatically unsubscribe after first inclusion&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;includeReorgs&lt;&#x2F;code&gt; is true, continue monitoring for chain reorganizations&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Implementation pseudo-code:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; handle_transaction_inclusion_subscription&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;params&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;transaction&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; params&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        tx_hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; submit_transaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;params&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;transaction&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    elif&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; params&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        tx_hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; params&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        raise&lt;&#x2F;span&gt;&lt;span&gt; InvalidParamsError&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    include_reorgs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; params&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;includeReorgs&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    subscription_id&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; generate_subscription_id&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    register_subscription&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;subscription_id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tx_hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; include_reorgs&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; subscription_id&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; on_block_added&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;transactions&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        subscriptions&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_subscriptions_for_tx&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;hash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; sub&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; subscriptions&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            receipt&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_transaction_receipt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;hash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            send_notification&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sub&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;included&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; receipt&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; sub&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;include_reorgs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                unsubscribe&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sub&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; on_chain_reorg&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;old_blocks&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; new_blocks&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    removed_txs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_transactions_from_blocks&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;old_blocks&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; tx_hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; removed_txs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        subscriptions&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_subscriptions_for_tx&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx_hash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; sub&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; subscriptions&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; sub&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;include_reorgs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                send_notification&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sub&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;reorged&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; on_block_finalized&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;transactions&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        subscriptions&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_subscriptions_for_tx&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;hash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; sub&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; subscriptions&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            receipt&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_transaction_receipt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;hash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            send_notification&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sub&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;finalized&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; receipt&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            unsubscribe&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sub&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;transaction-submission-validation&quot;&gt;Transaction Submission Validation&lt;&#x2F;h3&gt;
&lt;p&gt;When &lt;code&gt;transaction&lt;&#x2F;code&gt; is provided, nodes MUST perform the same validation as &lt;code&gt;eth_sendRawTransaction&lt;&#x2F;code&gt; before creating the subscription. Invalid transactions MUST result in an error response without creating a subscription.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;privacy-considerations&quot;&gt;Privacy Considerations&lt;&#x2F;h3&gt;
&lt;p&gt;Monitoring transactions by hash does not introduce new privacy concerns beyond existing &lt;code&gt;eth_getTransactionReceipt&lt;&#x2F;code&gt; polling. However, applications should be aware that subscribing to transaction hashes reveals interest in those transactions to the node operator.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;reorg-attack-considerations&quot;&gt;Reorg Attack Considerations&lt;&#x2F;h3&gt;
&lt;p&gt;Applications using &lt;code&gt;includeReorgs: true&lt;&#x2F;code&gt; should implement appropriate logic to handle reorg notifications, particularly on chains where reorgs may be used maliciously. The notification mechanism provides transparency but does not prevent reorg-based attacks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Self-Describing Bytes via EIP-712 Selectors</title>
        <published>2025-10-30T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Andrew Richardson</name><uri>https://github.com/awrichar</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8074/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-8074-self-describing-bytes-via-eip-712-selectors/25649" />
        

        <id>https://wg-eips.ritovision.com/8074/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:8074"
            label="ERC-8074" />
        

        
        

        
        <summary type="html">Defines a convention for self-describing structured data in `bytes` parameters using 4-byte selectors derived from EIP-712 type strings.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8074/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC standardizes a convention for tagging ABI-encoded structures placed inside &lt;code&gt;bytes&lt;&#x2F;code&gt; parameters with a compact type selector derived from the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; type string.
It also defines a canonical multi-payload wrapper, allowing multiple typed payloads to be carried in a single &lt;code&gt;bytes&lt;&#x2F;code&gt; parameter.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Many smart contract methods use a &lt;code&gt;bytes&lt;&#x2F;code&gt; parameter to support future extensibility—including common standards such as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt;.
The convention of carrying extra data in a &lt;code&gt;bytes&lt;&#x2F;code&gt; parameter was also codified further in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5750&#x2F;&quot;&gt;ERC-5750&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;In many practical cases, the &lt;code&gt;bytes&lt;&#x2F;code&gt; payload may encode a structured type that must be ABI-decoded before it can be processed. However:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Different contracts use different, ad-hoc conventions for distinguishing among possible payloads.&lt;&#x2F;li&gt;
&lt;li&gt;A single contract may need to support multiple encodings.&lt;&#x2F;li&gt;
&lt;li&gt;In more complex workflows, a payload may be propagated across multiple contracts, each of which may need to parse it differently.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Currently, there is no standardized convention for identifying the &quot;type&quot; of an encoded payload, nor for supporting multiple data items in a single bytes parameter.
This ERC defines a minimal, interoperable convention for self-describing payloads that remain compatible with existing ABI tooling.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;terms&quot;&gt;Terms&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Type string&lt;&#x2F;strong&gt; — the canonical EIP-712 type string, e.g.
&lt;code&gt;TransferNote(bytes32 reference,string comment,uint256 deadline)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Type selector (&lt;code&gt;bytes4&lt;&#x2F;code&gt;)&lt;&#x2F;strong&gt; — &lt;code&gt;keccak256(typeString)[0:4]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Single-payload&lt;&#x2F;strong&gt; — a selector followed by &lt;code&gt;abi.encode&lt;&#x2F;code&gt; of that struct’s fields&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Multi-payload wrapper&lt;&#x2F;strong&gt; — &lt;code&gt;DataList(bytes[] items)&lt;&#x2F;code&gt;; each &lt;code&gt;items[i]&lt;&#x2F;code&gt; is a valid single-payload&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;single-payload-encoding&quot;&gt;Single-payload encoding&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;An ABI-encoded struct is prefixed with a 4-byte selector.&lt;&#x2F;li&gt;
&lt;li&gt;The selector is defined as the first 4 bytes of the keccak256 hash of its EIP-712 type string.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;typeSelector(T) = bytes4(keccak256(bytes(T)))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;encoding = typeSelector(T) ++ abi.encode(&amp;lt;fields of T&amp;gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Example:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;T = &amp;quot;TransferNote(bytes32 reference,string comment,uint256 deadline)&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;keccak256(T) = 0xf91f3a243a886588394dfd70af07dce0ca18c55e402d76152d4cb300349c9e9d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;selector = 0xf91f3a24&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;encoding = 0xf91f3a24 ++ abi.encode(reference, comment, deadline)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;A consumer may look for a known selector before attempting to decode the data, and can easily distinguish between multiple different payloads that it knows how to accept.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;multi-payload-wrapper&quot;&gt;Multi-payload wrapper&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Uses a canonical wrapper type &lt;code&gt;DataList(bytes[] items)&lt;&#x2F;code&gt; with selector &lt;code&gt;0xae74f986&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Each element in the items array is itself a single-struct payload (with its own selector).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;DataList(bytes[] items)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;selector(DataList) = bytes4(keccak256(&amp;quot;DataList(bytes[] items)&amp;quot;)) = 0xae74f986&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;encoding = 0xae74f986 ++ abi.encode(items)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Each &lt;code&gt;items[i]&lt;&#x2F;code&gt; MUST be a valid single-payload as above.
Consumers can look for this well-known selector, and can then decode the list to be scanned recursively for recognized items.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;decoding&quot;&gt;Decoding&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Read the first 4 bytes as the &lt;strong&gt;selector&lt;&#x2F;strong&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If the selector is &lt;code&gt;0xae74f986&lt;&#x2F;code&gt;, decode the remainder as &lt;code&gt;(bytes[] items)&lt;&#x2F;code&gt; and parse each item recursively.&lt;&#x2F;li&gt;
&lt;li&gt;If the selector is another recognized selector, the remainder should be parsed accordingly.&lt;&#x2F;li&gt;
&lt;li&gt;Unknown selectors MUST be ignored.&lt;&#x2F;li&gt;
&lt;li&gt;Order is not significant; producers SHOULD avoid duplicates.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;EIP-712 reuse:&lt;&#x2F;strong&gt; avoids new schema syntax and aligns with the signing ecosystem.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;4-byte selectors:&lt;&#x2F;strong&gt; mirror Solidity’s function selector convention for compactness.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Simple wrapper:&lt;&#x2F;strong&gt; &lt;code&gt;DataList&lt;&#x2F;code&gt; provides multiplexing without special parsing or new ABI rules.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Existing contracts that already accept arbitrary &lt;code&gt;bytes&lt;&#x2F;code&gt; remain compatible. Contracts unaware of this ERC can continue to treat the payload as opaque.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Payload bounds:&lt;&#x2F;strong&gt; When parsing &lt;code&gt;DataList&lt;&#x2F;code&gt;, consumers should limit &lt;code&gt;items.length&lt;&#x2F;code&gt; and total payload size (for example ≤ 8 items and ≤ 8 KB).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Early exit:&lt;&#x2F;strong&gt; Consumers should stop scanning once all expected selectors are found.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Unknown data:&lt;&#x2F;strong&gt; Unrecognized items must be ignored safely.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Sparse Blobpool</title>
        <published>2025-10-29T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Raúl Kripalani</name><uri>https://github.com/raulk</uri>
	</author>
	
	<author>
		<name>Bosul Mun</name><uri>https://github.com/healthykim</uri>
	</author>
	
	<author>
		<name>Francesco D&#x27;Amato</name><uri>https://github.com/fradamt</uri>
	</author>
	
	<author>
		<name>Csaba Kiraly</name><uri>https://github.com/cskiraly</uri>
	</author>
	
	<author>
		<name>Felix Lange</name><uri>https://github.com/fjl</uri>
	</author>
	
	<author>
		<name>Marios Ioannou</name><uri>https://github.com/mariosioannou-create</uri>
	</author>
	
	<author>
		<name>Alex Stokes</name><uri>https://github.com/ralexstokes</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8070/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8070-sparse-blobpool/26023" />
        

        <id>https://wg-eips.ritovision.com/8070/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="networking"
                label="Networking" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:8070"
            label="EIP-8070" />
        

        
        

        
        <summary type="html">Introduce custody-aligned sampling in the EL blobpool to vacate bandwidth</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8070/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal introduces the sparse blobpool, a construction that brings cell-level, custody-aligned sampling in the Execution Layer (EL). For every new type 3 (blob-carrying) transaction, an EL node fetches full blob payloads only with probability p = 0.15, and otherwise it merely samples the blobs, using the same custody assignment as its Consensus Layer (CL) counterpart. For full nodes, this means downloading as little as 1&#x2F;8 of the data (8 out of 128 cells), so that the average bandwidth consumption compared to the (current) full blobpool is 0.15 + 0.85&#x2F;8 ~ 0.25, a ~4x reduction. The choice of p = 0.15 balances reducing bandwidth consumption with guaranteeing the full propagation of txs, by ensuring that for each blob tx there exists a large connected backbone of nodes that have the full blob payload. At an individual node level, p = 0.15 translates to 98.6% probability of least 3&#x2F;50 neighbours holding the full blob payload, only 0.03% chance of total unavailability. The sampling performed with probability 1 - p = 0.85 enables streamlined data availability checks during block validation, as well as enhancing the availability of the data.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;As Blob Parameter Only (BPO) forks progressively increase throughput, the full-replication nature of today&#x27;s EL blobpool will begin dominating bandwidth utilization, causing us to hit &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7870&#x2F;&quot;&gt;EIP-7870&lt;&#x2F;a&gt; limits. Furthermore, this traffic will compete, and potentially starve, block and attestation propagation, risking instability and liveness issues. This behavior has already been observed in Fusaka devnets, where the average bandwidth consumption &lt;em&gt;of a full node&lt;&#x2F;em&gt; is dominated by the EL blobpool, since column propagation on the CL benefits from sampling.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8070&#x2F;.&#x2F;assets&#x2F;bandwidth-breakdown-fusaka-devnets.png&quot; alt=&quot;&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Figure 1.&lt;&#x2F;strong&gt; &lt;em&gt;Breakdown of the average bandwidth consumption (download) of full nodes in Fusaka Devnet 5, for blob count target&#x2F;max of 22&#x2F;33 (left) and 48&#x2F;72 (right). The average bandwidth consumption of the EL is ~4-5x that of the CL.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;While the average bandwidth consumption does not reflect that the load on the EL is spread out over time rather than concentrated in a small time window as it is in the CL, the gap between the EL and CL is quite large (~4-5x), and future upgrades will enable the CL to better spread out data propagation in the slot, leaving the EL blobpool as even more of a bottleneck.&lt;&#x2F;p&gt;
&lt;p&gt;The sparse blobpool mechanism brings sampling to the EL as well, with an anticipated ~4x reduction in average bandwidth consumption for a given blobpool load. In doing so, it preserves the unstructured, stochastic nature of the current blobpool rather than introducing complex sharding architectures, prioritizing simplicity and resilience. Moreover, it preserves the CL&#x27;s ability to satisfy its own sampling needs with the pre-propagated data in the EL blobpool (through the &lt;code&gt;getBlobs&lt;&#x2F;code&gt; Engine API). This is achieved by aligning the EL and CL sampling, in particular by having the EL fetch the cells corresponding to the CL custody set. This preserves a key feature of the blobpool, as it stretches the time window for blob data propagation, offloading this work from the critical path of block validation and leading to smoother and less bursty bandwidth utilization patterns over time.&lt;&#x2F;p&gt;
&lt;p&gt;While the scalability gain may be more modest than with other solutions, we believe this design balances between simplicity, security, and scalability, in order to unlock the next tier of blob throughput without requiring user-facing changes, or deeper architectural redesigns.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc2119&quot;&gt;RFC 2119&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc8174&quot;&gt;RFC 8174&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;execution-clients-devp2p-changes&quot;&gt;Execution clients :: devp2p changes&lt;&#x2F;h3&gt;
&lt;p&gt;We introduce a new devp2p protocol version, &lt;code&gt;eth&#x2F;71&lt;&#x2F;code&gt; extending the existing &lt;code&gt;eth&#x2F;70&lt;&#x2F;code&gt; protocol (TODO: spec for eth&#x2F;70 missing).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Modify &lt;code&gt;NewPooledTransactionHashes&lt;&#x2F;code&gt; (&lt;code&gt;0x08&lt;&#x2F;code&gt;) message.&lt;&#x2F;strong&gt;
Add a new field &lt;code&gt;cell_mask&lt;&#x2F;code&gt; of type &lt;code&gt;B_16&lt;&#x2F;code&gt; (&lt;code&gt;uint128&lt;&#x2F;code&gt;). This field MUST be interpreted as a bitarray of length &lt;code&gt;CELLS_PER_EXT_BLOB&lt;&#x2F;code&gt;, carrying &lt;code&gt;1&lt;&#x2F;code&gt; in the indices of colums the announcer has available for &lt;strong&gt;all type 3 txs announced within the message&lt;&#x2F;strong&gt;. This field MUST be set to &lt;code&gt;nil&lt;&#x2F;code&gt; when no transactions of such type are announced. (TODO: this approach is not expressive enough if the node wants to offer randomly sampled columns, nor if it wants to announce transactions with full and partial availability in a single message).&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;old schema (&lt;code&gt;eth&#x2F;70&lt;&#x2F;code&gt;): &lt;code&gt;[types: B, [size_0: P, size_1: P, ...], [hash_0: B_32, hash_1: B_32, ...]]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;new schema (&lt;code&gt;eth&#x2F;71&lt;&#x2F;code&gt;): &lt;code&gt;[types: B, [size_0: P, size_1: P, ...], [hash_0: B_32, hash_1: B_32, ...], cell_mask: B_16]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Modify &lt;code&gt;GetPooledTransactions&lt;&#x2F;code&gt; (&lt;code&gt;0x09&lt;&#x2F;code&gt;) &#x2F; &lt;code&gt;PooledTransactions&lt;&#x2F;code&gt; (&lt;code&gt;0x10&lt;&#x2F;code&gt;) behaviour.&lt;&#x2F;strong&gt;
Responses now elide blob payloads for type 3 transactions requested via this RPC. This is performed by setting an RLP &lt;code&gt;nil&lt;&#x2F;code&gt; literal in the list position corresponding to the transaction&#x27;s blob data. Cell proofs and commitments are unaffected and continue to be sent.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;New message type &lt;code&gt;GetCells&lt;&#x2F;code&gt; (&lt;code&gt;0x12&lt;&#x2F;code&gt;).&lt;&#x2F;strong&gt; Used to request cells for type 3 transactions. It specifies the transaction hashes being requested, along with a &lt;code&gt;cell_mask&lt;&#x2F;code&gt; specifying which cell indices are needed, with syntax identical as &lt;code&gt;cell_mask&lt;&#x2F;code&gt; in &lt;code&gt;NewPooledTransactionHashes&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;eth&#x2F;71&lt;&#x2F;code&gt;: &lt;code&gt;[[hash_0: B_32, hash_1: B_32, ...], cell_mask: B_16]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;New message type &lt;code&gt;Cells&lt;&#x2F;code&gt; (&lt;code&gt;0x13&lt;&#x2F;code&gt;).&lt;&#x2F;strong&gt; Used to respond to a &lt;code&gt;GetCells&lt;&#x2F;code&gt; requests.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;eth&#x2F;71&lt;&#x2F;code&gt;: &lt;code&gt;[[hash_0: B_32, hash_1: B_32, ...], cells: [[cell_0_0: B_2048, cell_0_1: B_2048, ...], [cell_1_0: B_2048, cell_1_1: B_2048, ...]], cell_mask: B_16]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;execution-clients-blobpool-behavior&quot;&gt;Execution clients :: Blobpool behavior&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;New transaction hash.&lt;&#x2F;strong&gt;
Upon receiving a &lt;code&gt;NewPooledTransactionHashes&lt;&#x2F;code&gt; announcement containing a previously unknown type 3 transaction hash, the node makes a probabilistic decision about fetching the blob payload: it decides to fetch the full blob payload with probability p = 0.15 (provider role), or simply sample otherwise (sampler role). This decision MAY be remembered for some period chosen by the implementer, in which case stateless heuristics are RECOMMENDED (e.g. calculating a hash by appending some time-bound value mixed in with stable transaction properties, and applying p to it).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Provider role.&lt;&#x2F;strong&gt;
If the node is a provider, and the announcing peer signaled full availability, the node MUST request the signed transaction and full blob data from that peer via &lt;code&gt;GetPooledTransactions&lt;&#x2F;code&gt; and &lt;code&gt;GetCells&lt;&#x2F;code&gt; with an all-ones &lt;code&gt;cell_mask&lt;&#x2F;code&gt; bitmap. Upon successful retrieval and validation (as per &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7594&#x2F;&quot;&gt;EIP-7594&lt;&#x2F;a&gt;), the node MUST in turn announce the transaction hash to its peers via &lt;code&gt;NewPooledTransactionHashes&lt;&#x2F;code&gt;, also with an all-ones &lt;code&gt;cell_mask&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Sampler role.&lt;&#x2F;strong&gt;
If the node is a sampler, the node MUST only request the transaction payload via &lt;code&gt;GetPooledTransactions&lt;&#x2F;code&gt;. It SHOULD await to observe at least 2 distinct provider announcements, and to successfully receive and validate the signed transaction, before acting further. It then MUST request custody-aligned cells from peers that announced overlapping availability, including providers. When fetching from a provider, the node MUST request &lt;code&gt;C_extra&lt;&#x2F;code&gt; random columns in addition to its custody set (see &quot;Sampling noise&quot; in Rationale). The node MUST request no more than &lt;code&gt;C_req&lt;&#x2F;code&gt; columns per request, at all times.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Ensuring fairness.&lt;&#x2F;strong&gt;
Nodes MAY keep a record of the frequency of full payload fetches made by each peer, relative to their sampling requests. Nodes MAY elect to disconnect peers who exceed some locally-determined fairness heuristic. Such heuristics are not object of standardization.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Supernode behaviour.&lt;&#x2F;strong&gt;
Supernodes (nodes intending to fetch every blob payload in full) MUST load balance requests across samplers and providers. Furthermore, supernodes SHOULD prioritize reconstructing blobs and proofs from 64 columns. Supernodes SHOULD maintain a larger peerset in order to satisfy their increased blob fetching needs without over-stressing a small set of neighbours and violating fairness.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Sampler eviction&lt;&#x2F;strong&gt;
A sampler MAY drop a transaction if it has not observed sufficient network saturation (i.e., announcements from other peers for the same blob) within a defined period.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Continued sampling&lt;&#x2F;strong&gt;
Tenured transactions MAY be subject to resampling in other to test for liveness and confirm confidence of continued network-wide availability.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;execution-clients-local-block-builders&quot;&gt;Execution clients :: Local block builders&lt;&#x2F;h3&gt;
&lt;blockquote&gt;
&lt;p&gt;TODO: config specification needed.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;Client implementations MUST provide configuration options for local block builders to specify a blob inclusion policy when proposing a block. Implementations SHOULD support at least these policies:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Conservative: include only blob transactions for which all blob data is fully available locally (equivalent to today&#x27;s behaviour).&lt;&#x2F;li&gt;
&lt;li&gt;Optimistic: also include blob transactions that have been successfully sampled.&lt;&#x2F;li&gt;
&lt;li&gt;Proactive: resample prior to blob proposal time in order to assess network-wide confidence of blobs potentially selected for inclusion. This requires an additional Engine API extension for the CL to notify the EL of upcoming proposer duty (TODO).&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;engine-api-extensions&quot;&gt;Engine API extensions&lt;&#x2F;h3&gt;
&lt;blockquote&gt;
&lt;p&gt;TODO: This specification will be moved out to the Execution APIs repo and linked to from here.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Method &lt;code&gt;engine_blobCustodyUpdatedV1&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Called by the Consensus layer client to inform the Execution layer of the indices of their current blob column custody set at startup, as well as subsequent changes during live operation.&lt;&#x2F;p&gt;
&lt;p&gt;Request:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;method: &lt;code&gt;engine_blobCustodyUpdatedV1&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;params:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;indices_bitarray&lt;&#x2F;code&gt;: uint128, interpreted as a bitarray of length &lt;code&gt;CELLS_PER_EXT_BLOB&lt;&#x2F;code&gt; indicating which column indices form the custody set.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;timeout: 150ms&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Response:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;result: no payload&lt;&#x2F;li&gt;
&lt;li&gt;error: code and message set in case an error occurs during processing of the request.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Specification:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The Consensus client MUST call this method whenever its custody set changes. Additionally, it MUST call it on start, on restart, and when an Engine API interruption is detected.&lt;&#x2F;li&gt;
&lt;li&gt;The Execution client MUST return an Ok response if the request is well-formed. All subsequent sampling requests MUST adopt the new custody set. Queued sampling requests MAY be patched to reflect the new custody set.&lt;&#x2F;li&gt;
&lt;li&gt;For type 3 transactions pending in the blobpool:
&lt;ol&gt;
&lt;li&gt;If the custody set has expanded, the Execution client MUST issue new sampling requests for the delta. It SHOULD broadcast updated &lt;code&gt;NewPooledTransactionHashes&lt;&#x2F;code&gt; announcement with the new available set.&lt;&#x2F;li&gt;
&lt;li&gt;If the custody set has contracted, the Execution client MAY prune dropped cells from local storage, but only AFTER it has broadcast an updated &lt;code&gt;NewPooledTransactionHashes&lt;&#x2F;code&gt; announcement with the reduced available set. This is to avoid peers from perceiving an availability fault if they happen to request those previously announced cells.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The Execution client MUST treat a request to update the custody set to the current value as a no-op operation returning an Ok.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;strong&gt;Method &lt;code&gt;engine_getBlobsV4&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Called by the Consensus layer client to retrieve blob cells from the Execution layer blobpool.&lt;&#x2F;p&gt;
&lt;p&gt;Request:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;method: &lt;code&gt;engine_getBlobsV4&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;params:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;versioned_blob_hashes&lt;&#x2F;code&gt;: []bytes32, an array of blob versioned hashes.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;indices_bitarray&lt;&#x2F;code&gt;: uint128, a bitarray denoting the indices of the cells to retrieve.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;timeout: 500ms&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Response:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;result: &lt;code&gt;[]BlobCellsAndProofsV1&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;error: code and message set in case an error occurs during processing of the request.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Data structure &lt;code&gt;BlobCellsAndProofsV1&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;blob_cells&lt;&#x2F;code&gt;: a sequence of byte arrays &lt;code&gt;[]bytes&lt;&#x2F;code&gt; representing the partial matrix of the requested blobs, with &lt;code&gt;nil&lt;&#x2F;code&gt; entries for missing cells.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;proofs&lt;&#x2F;code&gt;: &lt;code&gt;Array of DATA&lt;&#x2F;code&gt; - Array of &lt;code&gt;KZGProof&lt;&#x2F;code&gt; as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt;, 48 bytes each (&lt;code&gt;DATA&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Fetching probability&lt;&#x2F;strong&gt;: p = 0.15&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Mesh degree&lt;&#x2F;strong&gt;: D = 50 (default peerset size)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Sampling requirement&lt;&#x2F;strong&gt;: Minimum &lt;code&gt;SAMPLES_PER_SLOT = 8&lt;&#x2F;code&gt; columns per node as per PeerDAS specification&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Reconstruction threshold&lt;&#x2F;strong&gt;: 64 cells required for Reed-Solomon decoding&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Minimum providers to sample&lt;&#x2F;strong&gt;: minimum 2 providers should be observed before sampling&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Extra random columns per request&lt;&#x2F;strong&gt;: &lt;code&gt;C_extra = 1&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Maximum columns per request&lt;&#x2F;strong&gt;: &lt;code&gt;C_req = 8&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameter-selection&quot;&gt;Parameter selection&lt;&#x2F;h3&gt;
&lt;p&gt;The choice of p = 0.15 balances bandwidth reduction with availability guarantees. Mathematical analysis for a mesh degree D = 50 shows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Primary reliability&lt;&#x2F;strong&gt;: Probability of having at least 3 peers with complete blob payload is 98.6%&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Secondary reliability&lt;&#x2F;strong&gt;: Via reconstruction from partial availability, recovery probability exceeds 80% when 6+ provider peers exist.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Total unavailability&lt;&#x2F;strong&gt;: Only 0.03% chance with these parameters.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;reliability-framework&quot;&gt;Reliability framework&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;Primary reliability.&lt;&#x2F;strong&gt; Let $X$ be the number of direct peers with the full payload. With $X∼Binomial(D,p)$, the probability that at least $k$ honest peers hold the full blob payload for a type 3 tx is:&lt;&#x2F;p&gt;
&lt;p&gt;$$
P(X \geq k) = 1 - \sum_{i=0}^{k-1} \binom{D}{i} p^i (1-p)^{D-i}
$$&lt;&#x2F;p&gt;
&lt;p&gt;Evaluating for sensible values of $p$ and $k$ yields, where $D=50$ (Geth&#x27;s default mesh degree):&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;$p$&lt;&#x2F;th&gt;&lt;th&gt;$k = 6$&lt;&#x2F;th&gt;&lt;th&gt;$k = 5$&lt;&#x2F;th&gt;&lt;th&gt;$k = 4$&lt;&#x2F;th&gt;&lt;th&gt;$k = 3$&lt;&#x2F;th&gt;&lt;th&gt;$k = 2$&lt;&#x2F;th&gt;&lt;th&gt;$k = 1$&lt;&#x2F;th&gt;&lt;th&gt;$P(0)$&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;0.05&lt;&#x2F;td&gt;&lt;td&gt;0.037776&lt;&#x2F;td&gt;&lt;td&gt;0.103617&lt;&#x2F;td&gt;&lt;td&gt;0.239592&lt;&#x2F;td&gt;&lt;td&gt;0.459467&lt;&#x2F;td&gt;&lt;td&gt;0.720568&lt;&#x2F;td&gt;&lt;td&gt;0.923055&lt;&#x2F;td&gt;&lt;td&gt;0.076945&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0.08&lt;&#x2F;td&gt;&lt;td&gt;0.208126&lt;&#x2F;td&gt;&lt;td&gt;0.371050&lt;&#x2F;td&gt;&lt;td&gt;0.574704&lt;&#x2F;td&gt;&lt;td&gt;0.774026&lt;&#x2F;td&gt;&lt;td&gt;0.917288&lt;&#x2F;td&gt;&lt;td&gt;0.984534&lt;&#x2F;td&gt;&lt;td&gt;0.015466&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0.10&lt;&#x2F;td&gt;&lt;td&gt;0.383877&lt;&#x2F;td&gt;&lt;td&gt;0.568802&lt;&#x2F;td&gt;&lt;td&gt;0.749706&lt;&#x2F;td&gt;&lt;td&gt;0.888271&lt;&#x2F;td&gt;&lt;td&gt;0.966214&lt;&#x2F;td&gt;&lt;td&gt;0.994846&lt;&#x2F;td&gt;&lt;td&gt;0.005154&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0.125&lt;&#x2F;td&gt;&lt;td&gt;0.606513&lt;&#x2F;td&gt;&lt;td&gt;0.765366&lt;&#x2F;td&gt;&lt;td&gt;0.886232&lt;&#x2F;td&gt;&lt;td&gt;0.958237&lt;&#x2F;td&gt;&lt;td&gt;0.989739&lt;&#x2F;td&gt;&lt;td&gt;0.998740&lt;&#x2F;td&gt;&lt;td&gt;0.001260&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;0.15&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;strong&gt;0.780647&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;strong&gt;0.887895&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;strong&gt;0.953953&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;strong&gt;0.985811&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;strong&gt;0.997095&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;strong&gt;0.999704&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;strong&gt;0.000296&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0.20&lt;&#x2F;td&gt;&lt;td&gt;0.951973&lt;&#x2F;td&gt;&lt;td&gt;0.981504&lt;&#x2F;td&gt;&lt;td&gt;0.994344&lt;&#x2F;td&gt;&lt;td&gt;0.998715&lt;&#x2F;td&gt;&lt;td&gt;0.999807&lt;&#x2F;td&gt;&lt;td&gt;0.999986&lt;&#x2F;td&gt;&lt;td&gt;0.000014&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;&lt;strong&gt;Secondary reliability.&lt;&#x2F;strong&gt; Probability that a payload can be reconstructed from partial availability when primary reliability fails. Let $Y$ be the number of distinct columns available from sampler peers. Given $k$ provider peers that failed to serve the full payload, a node with $D - k$ sampler peers (each holding 8 random columns, assuming they&#x27;re all minimal custody full nodes) can reconstruct with probability $P(Y \geq 64 \mid n = D - k)$. For the adversarial scenario where we attained $k = 3$, yet all failed to serve the blob data, with $D = 50$, secondary reliability exceeds 99.9% as samplers provide an expected 124 distinct columns from 47 peers.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Providers ($k$)&lt;&#x2F;th&gt;&lt;th&gt;Samplers ($n=D-k$)&lt;&#x2F;th&gt;&lt;th&gt;$E[Distinct Columns]$&lt;&#x2F;th&gt;&lt;th&gt;$P(Y ≥ 64)$&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;50&lt;&#x2F;td&gt;&lt;td&gt;125.1&lt;&#x2F;td&gt;&lt;td&gt;&amp;gt;99.99%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;49&lt;&#x2F;td&gt;&lt;td&gt;124.9&lt;&#x2F;td&gt;&lt;td&gt;&amp;gt;99.99%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;48&lt;&#x2F;td&gt;&lt;td&gt;124.6&lt;&#x2F;td&gt;&lt;td&gt;&amp;gt;99.99%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;47&lt;&#x2F;td&gt;&lt;td&gt;124.3&lt;&#x2F;td&gt;&lt;td&gt;&amp;gt;99.99%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;4&lt;&#x2F;td&gt;&lt;td&gt;46&lt;&#x2F;td&gt;&lt;td&gt;124.0&lt;&#x2F;td&gt;&lt;td&gt;&amp;gt;99.99%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;...&lt;&#x2F;td&gt;&lt;td&gt;...&lt;&#x2F;td&gt;&lt;td&gt;...&lt;&#x2F;td&gt;&lt;td&gt;...&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;~40&lt;&#x2F;td&gt;&lt;td&gt;~10&lt;&#x2F;td&gt;&lt;td&gt;~68&lt;&#x2F;td&gt;&lt;td&gt;~80%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;&lt;strong&gt;Minimum threshold&lt;&#x2F;strong&gt;: Approximately $n_{\min} \approx 10$ samplers needed for reasonable reconstruction probability (&amp;gt;80%).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP changes the &lt;code&gt;eth&lt;&#x2F;code&gt; protocol and requires rolling out a new version, &lt;code&gt;eth&#x2F;71&lt;&#x2F;code&gt;. Supporting multiple versions of a wire protocol is possible. Rolling out a new version does not break older clients immediately, since they can keep using protocol version &lt;code&gt;eth&#x2F;70&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP does not change consensus rules and does not strictly require a hard fork. We are assessing the gradual rollout possibilities. In the meantime, it is RECOMMENDED that this EIP be deployed within the context of a hard fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;attack-scenarios-and-threat-model&quot;&gt;Attack scenarios and threat model&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;DoS attacks.&lt;&#x2F;strong&gt; An important consideration in all mempool sharding mechanisms is the possibility of DoS attacks. This refers to the case where a malicious sender posts a transaction to the mempool disclosing only part of it, which makes the transaction impossible to be included in any future block, while still consuming mempool resources. In this system, such a sender can be detected by nodes that request the full payload of the transaction.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Selective withholding attacks.&lt;&#x2F;strong&gt; TODO&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Eclipse attacks.&lt;&#x2F;strong&gt; TODO&lt;&#x2F;p&gt;
&lt;h3 id=&quot;peer-disconnection-policies&quot;&gt;Peer disconnection policies&lt;&#x2F;h3&gt;
&lt;p&gt;Nodes MAY keep a record of the frequency of full payload and column requests made by each peer. If a frequency exceeds some quota or the probabilistic expectation by some tolerance threshold, the node MAY decide to disconnect the offending peer alleging abuse as a reason. This prevents nodes from spending too much upload bandwidth on peers that fetch full payloads much more often that the expected p = 0.15.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;the-need-for-sampling-noise&quot;&gt;The need for sampling noise&lt;&#x2F;h3&gt;
&lt;p&gt;Custody-aligned sampling generates in stable and predictable request patterns that attackers could game. For example, a malicious node may trick a victim by pretending to be a provider when in reality it only stores the few, predictable columns the victim is expected to sample. To defend against this, this EIP introduces the simple mechanism of &quot;sampling noise.&quot;&lt;&#x2F;p&gt;
&lt;p&gt;When a peer requests its custody columns from a provider, it must also request at least ONE randomly selected column. A failure to serve this extra column can be interpreted as a strong sign of misbehavior. The attacker could choose to timeout, but after a number of repetitions, the victim would likely disconnect anyway due to high failure rates.&lt;&#x2F;p&gt;
&lt;p&gt;This simple mechanism reinforces key model assumptions (a provider is truly a provider) in exchange for negligible overhead per request (MAX_BLOBS_PER_TX x CELL_SIZE + proofs = ~12KiB).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;no-normative-peer-scoring&quot;&gt;No normative peer scoring&lt;&#x2F;h3&gt;
&lt;p&gt;An earlier design considered a peer scoring system to grade peers by tracking their statistical ratio of requests to announcements (leechiness vs. helpfulness). After careful consideration, we deemed this approached brittle and dropped the feature. Our rationale was that such mechanism would strongly encode assumptions and confine the system to conform to some modellic behaviour, thus reducing flexibility and resilience in the face of environmental changes, shocks, or unexpected&#x2F;improbable events (properties that are crucial in open and permissionless systems). Instead, we defer to implementations to define their own local heuristics for peer disconnection, if any.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;devp2p-message-schema-choices&quot;&gt;devp2p message schema choices&lt;&#x2F;h3&gt;
&lt;p&gt;We note that &lt;code&gt;cell_mask&lt;&#x2F;code&gt; field in &lt;code&gt;NewPooledTransactionHashes&lt;&#x2F;code&gt; is not expressive enough to signal different local availability for type 3 txs announced within the same message. This limitation implies that (a) fully and partially available txs cannot be announced together, and (b) availability of randomly sampled columns cannot be signaled in practice (because indices vary per tx), only custody columns can be consistently announced (they&#x27;re shared across all sampled transactions).&lt;&#x2F;p&gt;
&lt;p&gt;Nevertheless, the sender can efficiently split and group announcements: fully-available txs can be bundled together, and partially-available txs can be announced in separate messages. Per-message dispatch overhead is minimal (one uint64 request_id and one uint8 message_type), and more expressive designs are likely to incur in higher overhead. Furthermore, from a protocol flow perspective, devp2p supports concurrent requests and unordered responses (via &lt;code&gt;request_id&lt;&#x2F;code&gt; correlation), so this approach is not affected by head-of-line blocking either (at least from a protocol perspective).&lt;&#x2F;p&gt;
&lt;p&gt;We considered more expressive designs, ranging from simple arrays of &lt;code&gt;cell_mask&lt;&#x2F;code&gt;s (one per tx), to union types express full availability more compactly, to more complex schemes involving run-length encoding and compression. But we concluded that the added complexity was not justified at this time.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;open-points&quot;&gt;Open points&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Further threat modelling and security hardening.&lt;&#x2F;li&gt;
&lt;li&gt;RBF (replace-by-fee) impact.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Prevent using consolidations as withdrawals</title>
        <published>2025-10-29T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Mikhail Kalinin</name><uri>https://github.com/mkalinin</uri>
	</author>
	
	<author>
		<name>Francesco D&#x27;Amato</name><uri>https://github.com/fradamt</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8071/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8071-prevent-using-consolidations-as-withdrawals/26037" />
        

        <id>https://wg-eips.ritovision.com/8071/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:8071"
            label="EIP-8071" />
        

        
        

        
        <summary type="html">Cancels consolidation if the max effective balance of the target validator will be exceeded, preventing the withdrawal of the unused balance</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8071/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Cancels a consolidation request if the effective balance of the target validator would exceed the max effective balance after processing it, which would result in the excess balance being withdrawn. This is an unintended way to speed up withdrawals when the consolidation queue is faster than the exit queue.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The existing design of consolidation mechanism leaves an opportunity to use consolidation queue for exits which becomes appealing to be abused when there is an imbalance between exit and consolidation queues favoring the latter.&lt;&#x2F;p&gt;
&lt;p&gt;At the date of writing this EIP, the consolidation flaw is being heavily exploited. There are public write ups on how to speed up withdrawals by using this vulnerability.&lt;&#x2F;p&gt;
&lt;p&gt;Even though this is a UX rather than security issue, consolidation queue was never meant to be used for withdrawals, which makes the fix introduced by this EIP an important modification.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc2119&quot;&gt;RFC 2119&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc8174&quot;&gt;RFC 8174&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Starting from the beginning of the epoch when this EIP is activated, Consensus Layer client &lt;strong&gt;MUST&lt;&#x2F;strong&gt; use the modified &lt;code&gt;process_consolidation_request&lt;&#x2F;code&gt; function which code is outlined below.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;new-get-pending-balance-to-consolidate&quot;&gt;New &lt;code&gt;get_pending_balance_to_consolidate&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_pending_balance_to_consolidate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; target_index&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ValidatorIndex&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Gwei&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    pending_balance_to_consolidate&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Gwei&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; pending_consolidation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pending_consolidations&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; pending_consolidation&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;target_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; target_index&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            source_validator&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validators&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;pending_consolidation&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;source_index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            pending_balance_to_consolidate&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; source_validator&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;effective_balance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; pending_balance_to_consolidate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;modified-process-consolidation-request&quot;&gt;Modified &lt;code&gt;process_consolidation_request&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;em&gt;Note&lt;&#x2F;em&gt;: This function is extended with the check of the target&#x27;s balance after consolidation and cancels consolidation request if the balance exceeds the max effective balance.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; process_consolidation_request&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;    state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; consolidation_request&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ConsolidationRequest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; is_valid_switch_to_compounding_request&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; consolidation_request&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        validator_pubkeys&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validators&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        request_source_pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; consolidation_request&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;source_pubkey&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        source_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; ValidatorIndex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;validator_pubkeys&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;request_source_pubkey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        switch_to_compounding_validator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; source_index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify that source != target, so a consolidation cannot be used as an exit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; consolidation_request&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;source_pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; consolidation_request&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;target_pubkey&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If the pending consolidations queue is full, consolidation requests are ignored&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pending_consolidations&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; PENDING_CONSOLIDATIONS_LIMIT&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If there is too little available consolidation churn limit, consolidation requests are ignored&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; get_consolidation_churn_limit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MIN_ACTIVATION_BALANCE&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    validator_pubkeys&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validators&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify pubkeys exist&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    request_source_pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; consolidation_request&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;source_pubkey&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    request_target_pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; consolidation_request&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;target_pubkey&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; request_source_pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; validator_pubkeys&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; request_target_pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; validator_pubkeys&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    source_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; ValidatorIndex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;validator_pubkeys&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;request_source_pubkey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    target_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; ValidatorIndex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;validator_pubkeys&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;request_target_pubkey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    source_validator&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validators&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;source_index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    target_validator&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validators&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;target_index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify source withdrawal credentials&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    has_correct_credential&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; has_execution_withdrawal_credential&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;source_validator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    is_correct_source_address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        source_validator&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;withdrawal_credentials&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;12&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; consolidation_request&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;source_address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;has_correct_credential&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span&gt; is_correct_source_address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify that target has compounding withdrawal credentials&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; has_compounding_withdrawal_credential&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;target_validator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify the source and the target are active&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    current_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_current_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; is_active_validator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;source_validator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; current_epoch&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; is_active_validator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;target_validator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; current_epoch&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify exits for source and target have not been initiated&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; source_validator&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;exit_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; FAR_FUTURE_EPOCH&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; target_validator&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;exit_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; FAR_FUTURE_EPOCH&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify the source has been active long enough&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; current_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; source_validator&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;activation_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SHARD_COMMITTEE_PERIOD&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify the source has no pending withdrawals in the queue&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; get_pending_balance_to_withdraw&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; source_index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; [New in EIPXXXX]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify that the consolidating balance will&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; end up as active balance, not as excess balance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    target_balance_after_consolidation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        get_pending_balance_to_consolidate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; target_index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        +&lt;&#x2F;span&gt;&lt;span&gt; source_validator&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;effective_balance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        +&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;target_index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; target_balance_after_consolidation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; get_max_effective_balance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;target_validator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Initiate source validator exit and append pending consolidation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    source_validator&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;exit_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; compute_consolidation_epoch_and_update_churn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; source_validator&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;effective_balance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    source_validator&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;withdrawable_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        source_validator&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;exit_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MIN_VALIDATOR_WITHDRAWABILITY_DELAY&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pending_consolidations&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        PendingConsolidation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;source_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;source_index&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; target_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;target_index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;iterating-over-pending-consolidations&quot;&gt;Iterating over pending consolidations&lt;&#x2F;h3&gt;
&lt;p&gt;The new design introduces an iteration over pending consolidations which increases complexity of consolidation processing.&lt;&#x2F;p&gt;
&lt;p&gt;This is done to handle the case when there are multiple consolidations with the same target and each of them doesn&#x27;t exceed the max effective balance while all of them together do.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces backwards-incompatible changes to the Consensus Layer and must be activated via scheduled network upgrade.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;test_single_consolidation_request_at_max_eb&lt;&#x2F;li&gt;
&lt;li&gt;test_no_pending_consolidations_exceeding_max_eb&lt;&#x2F;li&gt;
&lt;li&gt;test_single_pending_consolidation_exceeding_max_eb&lt;&#x2F;li&gt;
&lt;li&gt;test_multiple_pending_consolidations_at_max_eb&lt;&#x2F;li&gt;
&lt;li&gt;test_multiple_pending_consolidations_exceeding_max_eb&lt;&#x2F;li&gt;
&lt;li&gt;test_exceeding_max_eb_with_the_target_balance_but_not_eb&lt;&#x2F;li&gt;
&lt;li&gt;test_exceeding_max_eb_with_the_source_eb_but_not_the_balance&lt;&#x2F;li&gt;
&lt;li&gt;test_multiple_pending_consolidations_exceeding_max_eb_with_the_source_eb_but_not_the_balance&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;All of the above test cases are implemented &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8071&#x2F;.&#x2F;assets&#x2F;test_process_consolidation_request.py&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;When consolidation request results in max effective balance exceeded, it is cancelled on the Consensus Layer,
neither request fee nor transaction gas cost are refunded in this case.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Add sweep withdrawal fee for 0x01 validators</title>
        <published>2025-10-28T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Anders Elowsson</name><uri>https://github.com/anderselowsson</uri>
	</author>
	
	<author>
		<name>Toni Wahrstätter</name><uri>https://github.com/nerolation</uri>
	</author>
	
	<author>
		<name>Francesco D&#x27;Amato</name><uri>https://github.com/fradamt</uri>
	</author>
	
	<author>
		<name>Ben Adams</name><uri>https://github.com/benaadams</uri>
	</author>
	
	<author>
		<name>Maria Inês Silva</name><uri>https://github.com/misilva73</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8062/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8062-add-sweep-withdrawal-fee-for-0x01-validators/26003" />
        

        <id>https://wg-eips.ritovision.com/8062/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:8062"
            label="EIP-8062" />
        

        
        

        
        <summary type="html">Improve stake consolidation and fairness by imposing a &quot;sweep&quot; withdrawal fee for `0x01` validators set to 0.05% of the withdrawn amount.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8062/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;A fee is proposed on the partial &quot;sweep&quot; withdrawal of validators using &lt;code&gt;0x01&lt;&#x2F;code&gt; credentials, to improve stake consolidation and fairness. Ethereum&#x27;s fast finality roadmap hinges on staking service providers migrating from &lt;code&gt;0x01&lt;&#x2F;code&gt; validators to &lt;code&gt;0x02&lt;&#x2F;code&gt; compounding validators. One roadblock is that &lt;code&gt;0x01&lt;&#x2F;code&gt; validators receive free-of-charge partial skimming withdrawals for balances exceeding 32 ETH, which consume protocol resources that are not accounted for. To address this, a 0.05% fee is imposed on the partial &lt;code&gt;0x01&lt;&#x2F;code&gt; sweep using a minimal modification to &lt;code&gt;process_withdrawals()&lt;&#x2F;code&gt;, applying the new constant &lt;code&gt;WITHDRAWAL_FEE_FRACTION = 2000&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The roadmap for fast finality hinges on stake consolidation, where staking service providers (SSPs) transition from running 32-ETH validators with &lt;code&gt;0x01&lt;&#x2F;code&gt; credentials to compounding validators with &lt;code&gt;0x02&lt;&#x2F;code&gt; credentials. A roadblock to this transition is that &lt;code&gt;0x01&lt;&#x2F;code&gt; validators have been designed with close-to-ideal capital efficiency and free-of-charge partial withdrawals for balances exceeding 32 ETH (the &quot;sweep&quot; function). When factoring in switching costs, the incentives do not favor stake consolidation. At the same time, sweep withdrawals take up resources on both the consensus layer (CL) and execution layer (EL) that are not paid for. It is unsuitable to give &lt;code&gt;0x01&lt;&#x2F;code&gt; validators an accounting advantage over &lt;code&gt;0x02&lt;&#x2F;code&gt; validators when Ethereum&#x27;s roadmap hinges on stakers consolidating their stake in &lt;code&gt;0x02&lt;&#x2F;code&gt; validators.&lt;&#x2F;p&gt;
&lt;p&gt;To improve consolidation while upholding fairness, this EIP accounts for the resource load of the &lt;code&gt;0x01&lt;&#x2F;code&gt; partial withdrawal sweep by imposing a small withdrawal fee for it. The proposed fee is 0.05% of the withdrawn amount, imposed via &lt;code&gt;WITHDRAWAL_FEE_FRACTION = 2000&lt;&#x2F;code&gt;. Since the average sweep withdrawal credits around 0.0235 ETH, the average expected fee per withdrawal is $0.0235;\mathrm{ETH} \times 0.0005 = 11,750;\mathrm{Gwei}$. The total expected fee over one year for a validator is 0.00048 ETH, corresponding to around $2 at the current ETH price. An SSP running 50,000 &lt;code&gt;0x01&lt;&#x2F;code&gt; validators (slightly below 5% of the stake) would thus need to pay around $100,000 per year in withdrawal fees.&lt;&#x2F;p&gt;
&lt;p&gt;The fee approximates the EL workload imposed by the sweep, calibrated against the average base fee over the last year (4.53 gwei). The withdrawal incurs equivalent to around 2204 gas (not accounting for CL work), implying a fee of $2204 \times 4.53 = 9,984;\mathrm{Gwei}$ (albeit, the base fee has been lower in recent months).&lt;&#x2F;p&gt;
&lt;p&gt;The fee is taken out on the CL as a percentage, since a fixed fee could produce extreme outcomes if the number of &lt;code&gt;0x01&lt;&#x2F;code&gt; validators were to be drastically reduced due to consolidation. In such a scenario, the sweep will hit validators more frequently, and the fee will thus be taken out more frequently. Since validators then would also withdraw a lower balance each time, a percentage fee on the withdrawal keeps the burden on stakers fixed. The existing logic is kept intact to minimize complexity. As a result, a validator&#x27;s balance will dip just below 32 ETH after skimming (as also happens when receiving a penalty just after skimming).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;WITHDRAWAL_FEE_FRACTION&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2000&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;functions&quot;&gt;Functions&lt;&#x2F;h3&gt;
&lt;p&gt;In &lt;code&gt;process_withdrawals()&lt;&#x2F;code&gt;, take out a fee for skimmed &lt;code&gt;0x01&lt;&#x2F;code&gt; validators that did not perform a full exit, burning it on the CL:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; process_withdrawals&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; payload&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionPayload&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; In this existing for-loop, calculate a fee before decreasing the balance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; w&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; expected_withdrawals&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        vi&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; w&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validator_index&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; has_compounding_withdrawal_credential&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validators&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;vi&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span&gt; w&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;vi&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; w&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; WITHDRAWAL_FEE_FRACTION&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        decrease_balance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; vi&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; w&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; fee&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;fast-finality&quot;&gt;Fast finality&lt;&#x2F;h3&gt;
&lt;p&gt;Fast finality is best realized through a reduction to the active validator set voting each round. Two paths have been envisioned. In one path referred to as Orbit SSF, the active set rotates in a weighted fashion, such that large consolidated validators always are active, and smaller validators are active less frequently. In another path, there is a fixed number of validator seats, with only the largest validators (e.g., the top 8,192) granted a seat. Both paths require consolidation to achieve a desirable stake weight and optimal performance.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;level-of-the-proposed-fee&quot;&gt;Level of the proposed fee&lt;&#x2F;h3&gt;
&lt;p&gt;The cost per validator per year under 3% CL yield becomes $32 \times 0.03 &#x2F; 2000 = 0.00048$ ETH, corresponding to around $2 at a price of $4,167 per ETH. Table 1 summarizes outcomes under different numbers of validators. A solo staker running one &lt;code&gt;0x01&lt;&#x2F;code&gt; is unlikely to consider the $2 fee enough to tip the scale either way. A staking service provider (SSP) running 50,000 &lt;code&gt;0x01&lt;&#x2F;code&gt; validators (slightly below 5% of the stake) has at least a moderate incentive since the cost then is $100,000. Under perfect competition, the SSP will not be able to pass on this cost to their customers. The outcome under a higher fee is outlined in the Alternative specifications section.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Validators (stake %)&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Cost (ETH&#x2F;year)&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Cost (USD&#x2F;year)&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;1 (~0.0001%)&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;0.00048&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;$2&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;100 (~0.01%)&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;0.048&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;$200&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;10,000 (~1%)&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;4.8&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;$20,000&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;50,000 (~5%)&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;24&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;$100,000&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;100,000 (~10%)&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;48&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;$200,000&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;&lt;strong&gt;Table 1.&lt;&#x2F;strong&gt; Cost to stakers under the proposed withdrawal fee.&lt;&#x2F;p&gt;
&lt;p&gt;The switching cost may still be greater than the yearly fee for an SSP. Some smart contracts requiring &lt;code&gt;0x01&lt;&#x2F;code&gt; credentials may be frozen and others may require a full exit and entry, with associated opportunity costs. However, once the recurring fee is in place and there is a commitment from the protocol to phase out &lt;code&gt;0x01&lt;&#x2F;code&gt; validators for SSPs—potentially even raising the fee until such an outcome has been realized—then the switch will have to be done &lt;em&gt;eventually&lt;&#x2F;em&gt;. Ignoring other potential benefits of &lt;code&gt;0x01&lt;&#x2F;code&gt; validators, a more accurate comparison is thus between the recurring fee and the capital cost for financing the switch, which of course is lower.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-accounting&quot;&gt;Gas accounting&lt;&#x2F;h3&gt;
&lt;p&gt;The gas cost accounting is as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;500 gas – cold touch of an account known to have no code (as specified in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2780&#x2F;&quot;&gt;EIP-2780&lt;&#x2F;a&gt;),&lt;&#x2F;li&gt;
&lt;li&gt;1000 gas – one account-leaf write in the account trie (as specified in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2780&#x2F;&quot;&gt;EIP-2780&lt;&#x2F;a&gt;),&lt;&#x2F;li&gt;
&lt;li&gt;704 gas – an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4895&#x2F;&quot;&gt;EIP-4895&lt;&#x2F;a&gt; withdrawal {index: uint64, validator_index: uint64, address: bytes20, amount: uint64}, consisting of $8 + 8 + 20 + 8 = 44$ bytes, priced analogously to calldata at 16 gas&#x2F;byte.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;It can be noted that we are not with this accounting charging for the CL work that &lt;code&gt;0x01&lt;&#x2F;code&gt; validators impose due to the sweep. We are neither charging &lt;code&gt;0x02&lt;&#x2F;code&gt; validators for the CL work of EL-triggered partial withdrawals via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7002&#x2F;&quot;&gt;EIP-7002&lt;&#x2F;a&gt;, but they are charged more extensively on the EL for triggering the withdrawal. Further note that &lt;code&gt;2048&lt;&#x2F;code&gt;-ETH validators are exempted in the specification from the sweep withdrawal fee, to avoid harming consolidation, and as an acknowledgement that &lt;code&gt;2048&lt;&#x2F;code&gt; ETH is the maximum stake that the protocol currently is designed to handle.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;capital-efficiency-and-opportunity-cost&quot;&gt;Capital efficiency and opportunity cost&lt;&#x2F;h3&gt;
&lt;p&gt;Besides free withdrawals, another benefit of &lt;code&gt;0x01&lt;&#x2F;code&gt; validators is the capital efficiency. A compounding &lt;code&gt;0x02&lt;&#x2F;code&gt; validator will on average have 0.75 ETH sitting idle, not counting toward the effective balance (EB). This is due to the current hysteresis design, where a validator that gradually increases its balance will hold between 0.25 to 1.25 more ETH than their EB. A &lt;code&gt;0x01&lt;&#x2F;code&gt; validator will on average have just $0.0235&#x2F;2 = 0.01175$ ETH idle, and are thus much more capital-efficient, particularly when the compounding &lt;code&gt;0x02&lt;&#x2F;code&gt; validator holds a moderate balance overall.&lt;&#x2F;p&gt;
&lt;p&gt;Figure 1 illustrates the change in yield relative to a baseline with a neutral EB design, where, as the balance compounds, it is on average equal to the EB. The blue line is the yield of compounding &lt;code&gt;0x02&lt;&#x2F;code&gt; validators, which receive a lower yield due to the on average 0.75 ETH lower EB than the balance. The green circles are the yield that skimming 32-ETH and 2048-ETH validators receive. The orange line is the fee imposed on &lt;code&gt;0x01&lt;&#x2F;code&gt; validators proposed in the main specification. As evident, this fee does not fully offset the loss due to yield drag for &lt;code&gt;0x02&lt;&#x2F;code&gt; validators at validator balances below around 1,000 ETH.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8062&#x2F;.&#x2F;assets&#x2F;1.png&quot; alt=&quot;Figure 1&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Figure 1.&lt;&#x2F;strong&gt; Relative change in staking yield due to differences in capital efficiency of different validator configurations. The proposed fee is shown in orange.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8068&#x2F;&quot;&gt;EIP-8068&lt;&#x2F;a&gt; addresses differences in capital efficiency between &lt;code&gt;0x01&lt;&#x2F;code&gt; and &lt;code&gt;0x02&lt;&#x2F;code&gt; validators with a neutral EB design, where the hysteresis threshold raises the EB at +0.5. This effectively shifts the blue line, positioning all compounding validators at the black line.&lt;&#x2F;p&gt;
&lt;p&gt;If EIP-8068 is not included in the same hardfork as this EIP, we could instead raise the withdrawal fee to compensate. The alternative specification below therefore outlines a higher fee. This will however not address the other concern addressed by EIP-8068: a &lt;code&gt;0x02&lt;&#x2F;code&gt; validator can leverage the hysteresis and make a partial withdrawal once having reached 33 ETH EB, such that they only need to hold 32.75 ETH while keeping 33 ETH EB. This concern can, on the other hand, also be addressed on its own for minimal complexity, as outlined in the alternative specification of EIP-8068.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;alternative-specification&quot;&gt;Alternative specification&lt;&#x2F;h3&gt;
&lt;p&gt;If EIP-8068 is not included in the same hardfork as this EIP, it is reasonable to compensate for the lower capital efficiency of &lt;code&gt;0x02&lt;&#x2F;code&gt; validators by setting a higher withdrawal fee. This way, stakers will be less likely to remain on their &lt;code&gt;0x01&lt;&#x2F;code&gt; validators just for the better capital efficiency. Figure 2 shows three different alternative fees with red lines. The white squares illustrate equal capital efficiency between a &lt;code&gt;0x01&lt;&#x2F;code&gt; validator under the proposed fee and a &lt;code&gt;0x02&lt;&#x2F;code&gt; validator at some specific validator balance.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8062&#x2F;.&#x2F;assets&#x2F;2.png&quot; alt=&quot;Figure 2&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Figure 2.&lt;&#x2F;strong&gt; Relative change in staking yield due to differences in capital efficiency of different validator configurations. The main proposed fee is shown in orange, and alternative fees are shown in red.&lt;&#x2F;p&gt;
&lt;p&gt;The main option shown by the full red line is to raise the fee from 0.05% to 0.5%, setting &lt;code&gt;WITHDRAWAL_FEE_FRACTION = 200&lt;&#x2F;code&gt;. This means that a 32-ETH &lt;code&gt;0x01&lt;&#x2F;code&gt; validator will have approximately the same capital efficiency as a 128-ETH &lt;code&gt;0x02&lt;&#x2F;code&gt; validator. A stronger option is to impose a 1% fee as shown by the dashed red line, setting &lt;code&gt;WITHDRAWAL_FEE_FRACTION = 100&lt;&#x2F;code&gt;. Under this option, consolidating to a &lt;code&gt;0x02&lt;&#x2F;code&gt; validator will always at least be neutral, if the staker runs more than one &lt;code&gt;0x01&lt;&#x2F;code&gt; validator. A less forceful option is shown by the red dotted line, instead setting &lt;code&gt;WITHDRAWAL_FEE_FRACTION = 400&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Table 2 outlines the cost to stakers under the primary alternative specification with &lt;code&gt;WITHDRAWAL_FEE_FRACTION = 200&lt;&#x2F;code&gt;. Stakers then pay an additional $20 per validator. That means that an SSP running 5% of the stake would take a loss of around one million dollars per year, representing a much stronger incentive to consolidate.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Validators (stake %)&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Cost (ETH&#x2F;year)&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Cost (USD&#x2F;year)&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;1 (~0.0001%)&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;0.0048&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;$20&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;100 (~0.01%)&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;0.48&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;$2k&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;10k (~1%)&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;48&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;$200k&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;50k (~5%)&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;240&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;$1M&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;100k (~10%)&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;480&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;$2M&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;&lt;strong&gt;Table 2.&lt;&#x2F;strong&gt; Cost to stakers under the alternative higher withdrawal fee of 0.5% (&lt;code&gt;WITHDRAWAL_FEE_FRACTION = 200&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;To the best of the authors&#x27; knowledge, there are no security risks associated with the proposed fee.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Groups - Membership Tokens</title>
        <published>2025-10-28T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Cheng Qian</name><uri>https://github.com/jamesavechives</uri><email>support@deakee.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8063/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-8063-groups-multi-member-onchain-containers-for-shared-resources/25999" />
        

        <id>https://wg-eips.ritovision.com/8063/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        

        
        <category
            term="tag:eip:8063"
            label="ERC-8063" />
        

        
        

        
        <summary type="html">ERC-20 tokens representing group membership with threshold-based access control.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8063/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal defines a &quot;Group&quot; as an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; token where token balance represents membership level. Groups are standard ERC-20 tokens with the semantic interpretation that holding tokens means membership in the group. Unlike binary membership, this supports threshold-based membership: holding more tokens grants higher membership tiers or privileges. By being pure ERC-20, Groups inherit full compatibility with existing wallets, explorers, and tooling with no additional implementation burden.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Many applications need addressable groups of accounts with controlled membership and tiered access:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;DAOs&lt;&#x2F;strong&gt;: Voting power proportional to token holdings&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Loyalty programs&lt;&#x2F;strong&gt;: Bronze&#x2F;Silver&#x2F;Gold tiers based on token balance&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Access control&lt;&#x2F;strong&gt;: Different features unlocked at different balance thresholds&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Partner networks&lt;&#x2F;strong&gt;: Minimum token requirements for partnership benefits&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The key insight is that &lt;strong&gt;any ERC-20 token can represent group membership&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;balanceOf(account) == 0&lt;&#x2F;code&gt; → Not a member&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;balanceOf(account) &amp;gt;= threshold&lt;&#x2F;code&gt; → Member at that tier&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This approach provides:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Zero implementation overhead&lt;&#x2F;strong&gt;: Any ERC-20 token can be a Group&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Instant tooling compatibility&lt;&#x2F;strong&gt;: Wallets, explorers, DEXs work out of the box&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Tiered membership&lt;&#x2F;strong&gt;: Different balance thresholds unlock different privileges&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Transferable membership&lt;&#x2F;strong&gt;: Standard ERC-20 transfers allow membership trading&#x2F;delegation&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;requirements&quot;&gt;Requirements&lt;&#x2F;h3&gt;
&lt;p&gt;A compliant Group contract:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;MUST&lt;&#x2F;strong&gt; implement &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;MUST&lt;&#x2F;strong&gt; implement &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; implement the optional interface defined below for membership introspection&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;membership-semantics&quot;&gt;Membership Semantics&lt;&#x2F;h3&gt;
&lt;p&gt;Token balance represents membership level:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;balanceOf(account) == 0&lt;&#x2F;code&gt; → Account is &lt;strong&gt;not&lt;&#x2F;strong&gt; a member&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;balanceOf(account) &amp;gt; 0&lt;&#x2F;code&gt; → Account &lt;strong&gt;is&lt;&#x2F;strong&gt; a member&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;balanceOf(account) &amp;gt;= threshold&lt;&#x2F;code&gt; → Account qualifies for that membership tier&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Applications define their own thresholds. For example:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Basic membership: &lt;code&gt;balanceOf(account) &amp;gt;= 1&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Silver tier: &lt;code&gt;balanceOf(account) &amp;gt;= 100 * 10**decimals&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Gold tier: &lt;code&gt;balanceOf(account) &amp;gt;= 500 * 10**decimals&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Platinum tier: &lt;code&gt;balanceOf(account) &amp;gt;= 1000 * 10**decimals&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;interface-optional&quot;&gt;Interface (Optional)&lt;&#x2F;h3&gt;
&lt;p&gt;Implementations MAY expose a convenience interface for membership checks:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.20&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; IERC8063 — Optional membership introspection for ERC-20 tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC8063&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns true if `account` holds at least `threshold` tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to check&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; threshold&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Minimum balance required for membership at this tier&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isMember&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; threshold&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;If implemented:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;isMember(account, threshold)&lt;&#x2F;code&gt; MUST return &lt;code&gt;true&lt;&#x2F;code&gt; if and only if &lt;code&gt;balanceOf(account) &amp;gt;= threshold&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;isMember(account, 0)&lt;&#x2F;code&gt; MUST return &lt;code&gt;true&lt;&#x2F;code&gt; for any account.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;erc-165-introspection&quot;&gt;ERC-165 Introspection&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;supportsInterface(0x36372b07)&lt;&#x2F;code&gt; (ERC-20) SHOULD return &lt;code&gt;true&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;If the optional interface is implemented, &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; for it SHOULD return &lt;code&gt;true&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;deployment-model&quot;&gt;Deployment Model&lt;&#x2F;h3&gt;
&lt;p&gt;Following the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; pattern, each group is its own contract deployment:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Group identity&lt;&#x2F;strong&gt;: A group is uniquely identified by its contract address.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Deployment&lt;&#x2F;strong&gt;: Deploy any ERC-20 token. The token IS the group.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Discovery&lt;&#x2F;strong&gt;: Applications can discover groups through Transfer events, registries, or direct address references.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Naming&lt;&#x2F;strong&gt;: &lt;code&gt;name()&lt;&#x2F;code&gt; and &lt;code&gt;symbol()&lt;&#x2F;code&gt; follow standard ERC-20 conventions.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;minting-and-burning&quot;&gt;Minting and Burning&lt;&#x2F;h3&gt;
&lt;p&gt;Minting and burning are &lt;strong&gt;implementation-defined&lt;&#x2F;strong&gt;. Groups MAY implement minting&#x2F;burning using any approach:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Standard &lt;code&gt;mint(address, uint256)&lt;&#x2F;code&gt; function&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5679&#x2F;&quot;&gt;ERC-5679&lt;&#x2F;a&gt; compliant &lt;code&gt;mint(address, uint256, bytes)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;No minting after initial supply (fixed membership)&lt;&#x2F;li&gt;
&lt;li&gt;Governance-controlled minting&lt;&#x2F;li&gt;
&lt;li&gt;Open minting (anyone can join by minting)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The standard does not mandate any specific minting&#x2F;burning interface.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;tiered-benefits-example&quot;&gt;Tiered Benefits Example&lt;&#x2F;h3&gt;
&lt;p&gt;Applications define membership tiers externally:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Example: Partner contract checking membership tiers&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PartnerBenefits&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    IERC20 &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;public&lt;&#x2F;span&gt;&lt;span&gt; membershipToken&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; BRONZE &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 100&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;18&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; SILVER &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 500&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;18&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; GOLD &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1000&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;18&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getDiscount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; balance &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; membershipToken&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;user&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;balance &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; GOLD&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 30&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 30% off&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;balance &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; SILVER&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 20&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 20% off&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;balance &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; BRONZE&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 10% off&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isMember&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; membershipToken&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;user&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;optional-extensions&quot;&gt;Optional Extensions&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;ownership-via-erc-173&quot;&gt;Ownership (via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;173&#x2F;&quot;&gt;ERC-173&lt;&#x2F;a&gt;)&lt;&#x2F;h4&gt;
&lt;p&gt;Implementations that want a single-owner governance model MAY use &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;173&#x2F;&quot;&gt;ERC-173&lt;&#x2F;a&gt; or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8023&#x2F;&quot;&gt;ERC-8023&lt;&#x2F;a&gt; for standardized ownership.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;capped-membership-balance-1&quot;&gt;Capped Membership (Balance ≤ 1)&lt;&#x2F;h4&gt;
&lt;p&gt;For use cases requiring binary membership (member&#x2F;non-member with no tiers), implementations MAY enforce &lt;code&gt;balanceOf(account) &amp;lt;= 1&lt;&#x2F;code&gt; for all accounts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Pure ERC-20&lt;&#x2F;strong&gt;: A Group is simply an ERC-20 token with membership semantics. No new token standard needed.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;No minting&#x2F;burning mandate&lt;&#x2F;strong&gt;: Different use cases need different minting policies. The standard doesn&#x27;t prescribe one.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Threshold-based membership&lt;&#x2F;strong&gt;: More flexible than binary membership; supports tiered access, loyalty programs, and proportional voting naturally.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Optional interface&lt;&#x2F;strong&gt;: The &lt;code&gt;isMember&lt;&#x2F;code&gt; function is a convenience; applications can directly call &lt;code&gt;balanceOf&lt;&#x2F;code&gt; if preferred.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Maximum compatibility&lt;&#x2F;strong&gt;: Any existing ERC-20 token can be interpreted as a Group by applications.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is fully backwards compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;. In fact, &lt;strong&gt;any existing ERC-20 token can be used as a Group&lt;&#x2F;strong&gt; — the standard simply defines how to interpret token balance as membership.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Reference contracts are provided in the &lt;code&gt;assets&#x2F;&lt;&#x2F;code&gt; directory:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8063&#x2F;.&#x2F;assets&#x2F;IERC8063.sol&quot;&gt;&lt;code&gt;IERC8063.sol&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; — Interface definition&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8063&#x2F;.&#x2F;assets&#x2F;ERC8063.sol&quot;&gt;&lt;code&gt;ERC8063.sol&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; — Reference implementation with membership helpers&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Token economics&lt;&#x2F;strong&gt;: Membership is tied to token balance. Consider the implications of token transfers, trading, and price volatility on membership.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Threshold manipulation&lt;&#x2F;strong&gt;: If thresholds are stored onchain, ensure they cannot be manipulated by unauthorized parties.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Transfer implications&lt;&#x2F;strong&gt;: Token transfers change membership. Consider whether this is desirable for your use case.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Approval risks&lt;&#x2F;strong&gt;: Standard ERC-20 approval risks apply. Approving another address grants them ability to transfer your membership tokens.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Decimal handling&lt;&#x2F;strong&gt;: Ensure thresholds account for the token&#x27;s decimals.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Minting security&lt;&#x2F;strong&gt;: If minting is permitted, carefully control who can mint to prevent unauthorized membership grants.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Neutral effective balance design</title>
        <published>2025-10-28T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Anders Elowsson</name><uri>https://github.com/anderselowsson</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8068/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8068-neutral-effective-balance-design/26015" />
        

        <id>https://wg-eips.ritovision.com/8068/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:8068"
            label="EIP-8068" />
        

        
        

        
        <summary type="html">Make the effective balance calculation neutral so that 0x01 and 0x02 validators receive the same yield, thus facilitating consolidation.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8068/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes a neutral effective balance (EB) design to ensure &lt;code&gt;0x01&lt;&#x2F;code&gt; (skimming) and &lt;code&gt;0x02&lt;&#x2F;code&gt; (compounding) validators receive equal yields. Currently, validators that compound their balance have poor capital efficiency and lower yields as their idle balance (not contributing to EB) is 0.75 ETH, significantly higher than that of skimming validators at near-zero. This disincentivizes stake consolidation critical to Ethereum&#x27;s fast finality roadmap. Additionally, the current hysteresis rules allow &lt;code&gt;0x02&lt;&#x2F;code&gt; validators to game the hysteresis by keeping their balance below the EB. The increased profitability at lower balances could further harm consolidation. This proposal sets the EB hysteresis upward threshold to the neutral +0.5 and the downward threshold to +0.25. To prevent gaming after operations like partial withdrawals, the EB is reset to the floor of the balance, and a one-time &lt;code&gt;temporary_upward_threshold&lt;&#x2F;code&gt; set. This threshold is derived from an integral equation that ensures the average idle balance is zero as the validator&#x27;s balance compounds up to the next integer.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The roadmap for fast finality hinges on stake consolidation, where staking service providers (SSPs) transition from running 32-ETH validators with &lt;code&gt;0x01&lt;&#x2F;code&gt; credentials to compounding validators with &lt;code&gt;0x02&lt;&#x2F;code&gt; credentials. A roadblock to this transition is that &lt;code&gt;0x01&lt;&#x2F;code&gt; validators have close-to-ideal capital efficiency, whereas &lt;code&gt;0x02&lt;&#x2F;code&gt; validators have poor capital efficiency during compounding. Furthermore, the optimal configuration for a &lt;code&gt;0x02&lt;&#x2F;code&gt; validator is to reduce its balance to 32.75 ETH and prevent it from compounding further. These incentives may lead Ethereum&#x27;s fast-finality roadmap to be delayed. To prevent this, a neutral effective balance calculation is proposed, that sees all validator configurations earn the same CL yield.&lt;&#x2F;p&gt;
&lt;p&gt;A &lt;code&gt;0x02&lt;&#x2F;code&gt; validator that compounds its balance $b$ as intended will on average have 0.75 ETH of its balance not counting toward its effective balance (EB, or $E$ in equations). Specifically, with the current EB step bands, the idle remainder $r=b-E \in[0.25, 1.25)$ and $\bar{r}=(0.25+1.25)&#x2F;2=0.75$. A &lt;code&gt;0x01&lt;&#x2F;code&gt; validator operating at 32 ETH has a much lower idle remainder, on average half the withdrawal sweep of $0.0235&#x2F;2 = 0.01175$ ETH. A 32-ETH &lt;code&gt;0x01&lt;&#x2F;code&gt; validator will therefore earn around 2.3% more CL yield than a compounding &lt;code&gt;0x02&lt;&#x2F;code&gt; validator that grows from 32.25 ETH to 34.25 ETH over around two years.&lt;&#x2F;p&gt;
&lt;p&gt;A separate issue is that &lt;code&gt;0x02&lt;&#x2F;code&gt; validators can make a partial withdrawal down to 32.75 ETH when having any EB &amp;gt;33 ETH, leveraging the hysteresis to retain a 33 ETH EB. The surplus capital can then be deployed to increase the staking yield, running multiple 32.75-ETH validators. Assuming a 3% CL yield, recurring partial withdrawals deployed at 33 ETH to bring down the balance to 32.75 ETH, and ignoring the exit queue capital drag, the approach is more profitable than running skimming 2048-ETH validators under current base fees.&lt;&#x2F;p&gt;
&lt;p&gt;To uphold fairness while not disrupting the current operation of &lt;code&gt;0x01&lt;&#x2F;code&gt; validators, the following changes are made:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The upward EB step from $E$ to $E+1$ is imposed at $E + 0.5$. During regular upward compounding, the EB is thus set as the balance rounded to the nearest integer. This leads a compounding &lt;code&gt;0x02&lt;&#x2F;code&gt; validator to on average have a $E=b$, just like a 32-ETH &lt;code&gt;0x01&lt;&#x2F;code&gt; validator.&lt;&#x2F;li&gt;
&lt;li&gt;The downward step to $E$ is imposed at $E+0.25$ ($E_{+1}-0.75$).&lt;&#x2F;li&gt;
&lt;li&gt;Partial withdrawals are prevented from gaming the protocol. The EB calculation is designed such that each partial withdrawal is treated neutrally: $E=b$. To achieve this, the following takes place after every partial withdrawal at epoch boundaries:
&lt;ul&gt;
&lt;li&gt;The EB is initiated to the integer floor of the balance: $E = \text{EB}(b_0) = \lfloor b_0 \rfloor$.&lt;&#x2F;li&gt;
&lt;li&gt;A new field &lt;code&gt;temporary_upward_threshold&lt;&#x2F;code&gt; ($t$) is stored in the beacon state.&lt;&#x2F;li&gt;
&lt;li&gt;This threshold is computed as $t = E + \frac{1+(b_0-E)^2}{2}$, derived from the integral equation that stipulates that the validator will on average have $E=b$ when it smoothly grows its balance up until the next integer (see the Rationale).&lt;&#x2F;li&gt;
&lt;li&gt;To increase the EB, the balance must satisfy both the regular upward threshold &lt;em&gt;and&lt;&#x2F;em&gt; the &lt;code&gt;temporary_upward_threshold&lt;&#x2F;code&gt;, after which &lt;code&gt;temporary_upward_threshold&lt;&#x2F;code&gt; is reset to &lt;code&gt;0&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;p&gt;Change two existing constants:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;HYSTERESIS_DOWNWARD_MULTIPLIER&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;3&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;HYSTERESIS_UPWARD_MULTIPLIER&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;containers&quot;&gt;Containers&lt;&#x2F;h3&gt;
&lt;p&gt;Two new fields are added to the state:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    temporary_upward_threshold&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Gwei&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; VALIDATOR_REGISTRY_LIMIT&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    reset_eb_flags&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;boolean&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; VALIDATOR_REGISTRY_LIMIT&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;On upgrade, both lists are initialized to length &lt;code&gt;len(state.validators)&lt;&#x2F;code&gt; with &lt;code&gt;0&lt;&#x2F;code&gt; and &lt;code&gt;False&lt;&#x2F;code&gt; respectively.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;functions&quot;&gt;Functions&lt;&#x2F;h3&gt;
&lt;p&gt;A new helper is added for re-initializing EB and the &lt;code&gt;temporary_upward_threshold&lt;&#x2F;code&gt; for validators that have been marked for EB reset; this helper is invoked during epoch processing.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; initiate_effective_balance_and_threshold&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; index&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ValidatorIndex&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    v&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validators&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;effective_balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EFFECTIVE_BALANCE_INCREMENT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; get_max_effective_balance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;v&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    offset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;EFFECTIVE_BALANCE_INCREMENT&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;effective_balance&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EFFECTIVE_BALANCE_INCREMENT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;temporary_upward_threshold&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;effective_balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; offset&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;reset_eb_flags&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The existing &lt;code&gt;process_effective_balance_updates()&lt;&#x2F;code&gt; is modified to call the new helper before updating the EB, and so that the EB update accounts for the &lt;code&gt;temporary_upward_threshold&lt;&#x2F;code&gt;. We show here the whole function for completeness:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; process_effective_balance_updates&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Update effective balances with hysteresis&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; index&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; validator&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; enumerate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validators&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        HYSTERESIS_INCREMENT&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;EFFECTIVE_BALANCE_INCREMENT&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; HYSTERESIS_QUOTIENT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        DOWNWARD_THRESHOLD&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; HYSTERESIS_INCREMENT&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; HYSTERESIS_DOWNWARD_MULTIPLIER&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        UPWARD_THRESHOLD&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; HYSTERESIS_INCREMENT&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; HYSTERESIS_UPWARD_MULTIPLIER&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; New&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;reset_eb_flags&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            initiate_effective_balance_and_threshold&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; ValidatorIndex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            continue&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Then, adjust the existing if-clause to account for the temporary_upward_threshold&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        max_effective_balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_max_effective_balance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;validator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        balance_floor&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EFFECTIVE_BALANCE_INCREMENT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; DOWNWARD_THRESHOLD&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; validator&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;effective_balance&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            validator&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;effective_balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;balance_floor&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; max_effective_balance&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;temporary_upward_threshold&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        elif&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;validator&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;effective_balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; UPWARD_THRESHOLD&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; balance&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            and&lt;&#x2F;span&gt;&lt;span&gt; balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;temporary_upward_threshold&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            new_eb&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; balance_floor&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; balance_floor&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EFFECTIVE_BALANCE_INCREMENT&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                new_eb&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; balance_floor&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EFFECTIVE_BALANCE_INCREMENT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            validator&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;effective_balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;new_eb&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; max_effective_balance&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;temporary_upward_threshold&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;When processing partial withdrawal, the flag for reseting the EB is set.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; process_withdrawals&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; payload&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionPayload&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; withdrawal&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; expected_withdrawals&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; After this existing line&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        decrease_balance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; withdrawal&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validator_index&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; withdrawal&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Add a new if-clause and append withdrawals for which we reset the EB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        v&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validators&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;withdrawal&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validator_index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;exit_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; FAR_FUTURE_EPOCH&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span&gt; has_compounding_withdrawal_credential&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;v&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;reset_eb_flags&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;withdrawal&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validator_index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; True&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;relative-change-in-staking-yield&quot;&gt;Relative change in staking yield&lt;&#x2F;h3&gt;
&lt;p&gt;The figure shows the impact of the current EB bands and hysteresis design on validator yields for different validator configuations. The relative change in staking yield is plotted against a baseline 0 which corresponds to what compounding &lt;code&gt;0x02&lt;&#x2F;code&gt; validators would earn if $E=b$, as in the neutral effective balance design. Note that these are relative changes, so a validator at -0.01 under a CL yield of 3% would earn $0.99 \times 3 = 2.97$% in yield.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8068&#x2F;.&#x2F;assets&#x2F;1.png&quot; alt=&quot;Figure 1&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The blue line is compounding &lt;code&gt;0x02&lt;&#x2F;code&gt; validators, which on average will have 0.75 ETH not counting against their EB. A staker that runs a &lt;code&gt;0x02&lt;&#x2F;code&gt; validator instead of a &lt;code&gt;0x01&lt;&#x2F;code&gt; validator then earns $100\times0.75&#x2F;b$% lower staking yield. For example, at 32.25 ETH, that difference works out to 2.33%.&lt;&#x2F;p&gt;
&lt;p&gt;The red lines capture &lt;code&gt;0x02&lt;&#x2F;code&gt; validators that repeatedly withdraw down to the downward hysteresis threshold at $-0.25$ relative to an integer EB, thus achieving a surplus 0.25 EB relative to their actual balance. They let the balance grow until it is optimal to withdraw it, accounting for a partial withdrawal costing 84500 gas. So for example, starting at 32.75 ETH and with a 0.5 gwei base fee, that works out to making the withdrawal at around 32.80 ETH. The staker then earns 0.56% more staking yield than the baseline, factoring in a 4.5 days delay between when the withdrawn ETH stops earning yield and when it is available at the EL (dashed red line). This delay accounts for a 256 epoch withdrawal eligibility period and an average wait time until the sweep hits of 3.4 days (at a hypothetical future 770 000 active validators). Without the delay, that figure is 0.60%. When the base is 0 and there is a 4.5 days delay, the validator instead earns 0.72% more staking yield (full red line).&lt;&#x2F;p&gt;
&lt;p&gt;The green circles are sweeped &lt;code&gt;0x01&lt;&#x2F;code&gt; validators. They earn slightly less than the baseline due to the accruing balance in excess of 32 ETH and 2048 ETH not counting toward the EB, and being delayed by around 3.4 days.  (in this specific example where the delay )&lt;&#x2F;p&gt;
&lt;p&gt;This comparison could be nuanced further by potentially accounting for a deposit delay, but the ETH does not necessarily need to be deposited directly into the staking contract to bring value to its holder. Another nuance is that a slashing is driven by EB and not validator balance.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;equation-for-the-temporary-upward-threshold&quot;&gt;Equation for the temporary upward threshold&lt;&#x2F;h3&gt;
&lt;p&gt;To prevent gaming after a partial withdrawal, the EB is first reset to $E = \lfloor b_0 \rfloor$, where $b_0$ is the new balance. This creates an initial idle remainder $r_0 = b_0 - E$.&lt;&#x2F;p&gt;
&lt;p&gt;A &lt;code&gt;temporary_upward_threshold&lt;&#x2F;code&gt; ($t$) is then set to ensure the &lt;em&gt;average&lt;&#x2F;em&gt; idle balance is zero as the validator&#x27;s balance compounds from $b_0$ to the next integer, $E+1$.&lt;&#x2F;p&gt;
&lt;p&gt;This threshold $t$ is calculated to solve the &quot;zero-area&quot; problem: the positive idle balance accumulated while $\text{EB}=E$ (from $b_0$ to $t$) must exactly cancel the negative idle balance accumulated while $\text{EB}=E+1$ (from $t$ to $E+1$). This is expressed by the integral equation:&lt;&#x2F;p&gt;
&lt;p&gt;$\int_{b_0}^{t}(b-E) db + \int_{t}^{E+1}(b-(E+1)) db = 0.$&lt;&#x2F;p&gt;
&lt;p&gt;Solving for $t$ yields the formula used in the specification:&lt;&#x2F;p&gt;
&lt;p&gt;$t = E + \frac{1+r_0^2}{2},$&lt;&#x2F;p&gt;
&lt;p&gt;where $r_0 = b_0 - E$.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;alternative-specifications&quot;&gt;Alternative specifications&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;simple-fix-of-eb-gaming-under-current-bands&quot;&gt;Simple fix of EB gaming under current bands&lt;&#x2F;h4&gt;
&lt;p&gt;An alternative minimal specification is to only fix the gaming incentive, and instead compensate for the lower yield of &lt;code&gt;0x02&lt;&#x2F;code&gt; validators by increasing the withdrawal fee in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8062&#x2F;&quot;&gt;EIP-8062&lt;&#x2F;a&gt;. Only the partial withdrawal is adjusted. For this specification, only the &lt;code&gt;pending_eb_resets&lt;&#x2F;code&gt; need to be stored in the &lt;code&gt;BeaconState&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    pending_eb_resets&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;ValidatorIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; PENDING_PARTIAL_WITHDRAWALS_LIMIT&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Append the validator index to &lt;code&gt;pending_eb_resets&lt;&#x2F;code&gt; in &lt;code&gt;process_withdrawals()&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; process_withdrawals&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; payload&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionPayload&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; withdrawal&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; expected_withdrawals&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; After this existing line&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        decrease_balance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; withdrawal&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validator_index&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; withdrawal&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Add a new if-clause and append withdrawals for which we reset the EB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        v&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validators&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;withdrawal&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validator_index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;exit_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; FAR_FUTURE_EPOCH&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span&gt; has_compounding_withdrawal_credential&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;v&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pending_eb_resets&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;withdrawal&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validator_index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Modify &lt;code&gt;process_effective_balance_updates()&lt;&#x2F;code&gt; to reset the effective balance upon a partial withdrawal. The balance is never allowed to increase during the reset.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; process_effective_balance_updates&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Apply EB resets for executed withdrawals&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pending_eb_resets&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validators&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;effective_balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EFFECTIVE_BALANCE_INCREMENT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            get_max_effective_balance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validators&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validators&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;effective_balance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pending_eb_resets&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP would trigger a mass upward change of EBs at the specific hardfork boundary. The effect of this should be analyzed furher.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Contract Bytecode Deduplication Discount</title>
        <published>2025-10-22T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Carlos Perez</name><uri>https://github.com/CPerezz</uri>
	</author>
	
	<author>
		<name>Wei Han Ng</name><uri>https://github.com/weiihann</uri>
	</author>
	
	<author>
		<name>Guillaume Ballet</name><uri>https://github.com/gballet</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8058/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8058-contract-bytecode-deduplication-discount/25933" />
        

        <id>https://wg-eips.ritovision.com/8058/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:8058"
            label="EIP-8058" />
        

        
        

        
        <summary type="html">Reduces gas costs for deploying duplicate contract bytecode via access-list based mechanism</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8058/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal introduces a gas discount for contract deployments when the bytecode being deployed already exists in the state. By leveraging EIP-2930 access lists, any contract address included in the access list automatically contributes its code hash to a deduplication check. When the deployed bytecode matches an existing code hash from the access list, the deployment avoids paying &lt;code&gt;GAS_CODE_DEPOSIT * L&lt;&#x2F;code&gt; costs since clients already store the bytecode and only need to link the new account to the existing code hash.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP becomes particularly relevant with the adoption of EIP-8037, which increases &lt;code&gt;GAS_CODE_DEPOSIT&lt;&#x2F;code&gt; from 200 to 1,900 gas per byte. Under EIP-8037, deploying a 24kB contract would cost approximately 46.6M gas for code deposit alone, making the deduplication discount economically significant for applications that deploy identical bytecode multiple times.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, deploying duplicate bytecode costs the same as deploying new bytecode, even though execution clients don&#x27;t store duplicated code in their databases. When the same bytecode is deployed multiple times, clients store only one copy and have multiple accounts point to the same code hash. Under EIP-8037&#x27;s proposed gas costs, deploying a 24kB contract costs approximately 46.6M gas for code deposit alone (&lt;code&gt;1,900 × 24,576&lt;&#x2F;code&gt;). This charge is unfair for duplicate deployments where no additional storage is consumed.&lt;&#x2F;p&gt;
&lt;p&gt;A naive &quot;check if code exists in database&quot; approach would break consensus because different nodes have different database contents due to mostly Sync-mode differences:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Full-sync nodes: Retain all historical code, including from reverted&#x2F;reorged transactions&lt;&#x2F;li&gt;
&lt;li&gt;Snap-sync nodes: initially, only store code referenced in the pivot state tries, and those accumulated past the start of the sync&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Empirical analysis reveals that approximately 27,869 bytecodes existed in full-synced node databases with no live account pointing to them (as of the Cancun fork). A database lookup &lt;code&gt;CodeExists(hash)&lt;&#x2F;code&gt; would yield different results on different nodes, causing different gas costs and breaking consensus.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal solves the problem by making deduplication checks implicit and deterministic through access lists, ensuring all nodes compute identical gas costs regardless of their database state. (Notice here that even if fully-synced clients have more codes, there are no accounts whose codeHash actually is referencing them. Thus, users can&#x27;t profit from such discounts which keeps consensus safe).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;implicit-deduplication-via-access-lists&quot;&gt;Implicit Deduplication via Access Lists&lt;&#x2F;h3&gt;
&lt;p&gt;This proposal leverages the existing EIP-2930 access list structure without any modifications. No new fields or protocol changes are required.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;codehash-access-set-construction&quot;&gt;CodeHash Access-Set Construction&lt;&#x2F;h3&gt;
&lt;p&gt;Before transaction execution begins, build a set &lt;code&gt;W&lt;&#x2F;code&gt; (the &quot;CodeHash Access-Set&quot;) as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;W = { codeHash(a) | a ∈ accessList, a exists in state, a has code }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;W&lt;&#x2F;code&gt; is built from state at the &lt;strong&gt;start&lt;&#x2F;strong&gt; of transaction execution (before any state changes)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;All&lt;&#x2F;strong&gt; addresses in the access list are checked - if they exist in state and have deployed code, their code hash is added to &lt;code&gt;W&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Empty accounts or accounts with no code do not contribute to &lt;code&gt;W&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;contract-creation-gas-accounting&quot;&gt;Contract Creation Gas Accounting&lt;&#x2F;h3&gt;
&lt;p&gt;When a contract creation transaction or opcode (&lt;code&gt;CREATE&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;CREATE2&lt;&#x2F;code&gt;) successfully completes and returns bytecode &lt;code&gt;B&lt;&#x2F;code&gt; of length &lt;code&gt;L&lt;&#x2F;code&gt;, compute &lt;code&gt;H = keccak256(B)&lt;&#x2F;code&gt; and apply the following gas charges:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Deduplication check:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If &lt;code&gt;H ∉ W&lt;&#x2F;code&gt;: Bytecode is new
&lt;ul&gt;
&lt;li&gt;Charge &lt;code&gt;GAS_CODE_DEPOSIT * L&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Persist bytecode &lt;code&gt;B&lt;&#x2F;code&gt; under hash &lt;code&gt;H&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Link the new account&#x27;s &lt;code&gt;codeHash&lt;&#x2F;code&gt; to &lt;code&gt;H&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Otherwise, link the new account&#x27;s &lt;code&gt;codeHash&lt;&#x2F;code&gt; to the existing code hash &lt;code&gt;H&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Gas costs:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The cost of reading &lt;code&gt;codeHash&lt;&#x2F;code&gt; for access-listed addresses is already covered by EIP-2929&#x2F;2930 access costs (intrinsic access-list cost and cold→warm state access charges).&lt;&#x2F;li&gt;
&lt;li&gt;No additional gas cost is introduced for the deduplication check itself.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;implementation-pseudocode&quot;&gt;Implementation Pseudocode&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Before transaction execution:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;W&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; set&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; tuple&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;access_list&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    warm&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;tuple&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; per EIP-2930&#x2F;EIP-2929 rules&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    acc&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; load_account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;tuple&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; acc&lt;&#x2F;span&gt;&lt;span&gt; exists&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span&gt; acc&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; empty&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        W&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;acc&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;codeHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; On successful CREATE&#x2F;CREATE2:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;H&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;B&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt; H&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; W&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Duplicate: no deposit gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    link_codehash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;new_account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; H&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; New bytecode: charge and persist&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    charge&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;GAS_CODE_DEPOSIT&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;B&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    persist_code&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;H&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; B&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    link_codehash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;new_account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; H&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;same-block-deployments&quot;&gt;Same-Block Deployments&lt;&#x2F;h3&gt;
&lt;p&gt;Sequential transaction execution ensures that a deployment storing new code makes it visible to later transactions in the same block:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Transaction &lt;code&gt;T_A&lt;&#x2F;code&gt; deploys bytecode &lt;code&gt;B&lt;&#x2F;code&gt; at address &lt;code&gt;X&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Pays full &lt;code&gt;GAS_CODE_DEPOSIT * L&lt;&#x2F;code&gt; (no prior contract has this bytecode)&lt;&#x2F;li&gt;
&lt;li&gt;Code is stored under hash &lt;code&gt;H = keccak256(B)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Later transaction &lt;code&gt;T_B&lt;&#x2F;code&gt; in the same block deploys the same bytecode &lt;code&gt;B&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;T_B&lt;&#x2F;code&gt; includes address &lt;code&gt;X&lt;&#x2F;code&gt; in its access list&lt;&#x2F;li&gt;
&lt;li&gt;When &lt;code&gt;T_B&lt;&#x2F;code&gt; executes, &lt;code&gt;W&lt;&#x2F;code&gt; is built from the current state (including &lt;code&gt;T_A&lt;&#x2F;code&gt;&#x27;s changes)&lt;&#x2F;li&gt;
&lt;li&gt;Since &lt;code&gt;X&lt;&#x2F;code&gt; now exists and is in the access list, &lt;code&gt;W&lt;&#x2F;code&gt; contains &lt;code&gt;H&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;T_B&lt;&#x2F;code&gt;&#x27;s deployment gets the discount&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;blockquote&gt;
&lt;p&gt;While this only tries to formalize the behavior, it&#x27;s important to remark that this kind of behavior is complex. As it requires control over tx ordering in order to abuse. Builders can&#x27;t modify the access list as it is already signed with the transaction. Nevertheless, this could happen, thus is formalized here.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h3 id=&quot;edge-case-simultaneous-new-deployments&quot;&gt;Edge Case: Simultaneous New Deployments&lt;&#x2F;h3&gt;
&lt;p&gt;If two transactions in the same block both deploy identical new bytecode and neither references an existing contract with that bytecode in their access lists, both will pay full &lt;code&gt;GAS_CODE_DEPOSIT * L&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Example:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Transaction &lt;code&gt;T_A&lt;&#x2F;code&gt; deploys bytecode &lt;code&gt;B&lt;&#x2F;code&gt; producing code hash &lt;code&gt;0xCA&lt;&#x2F;code&gt; at address &lt;code&gt;X&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Transaction &lt;code&gt;T_B&lt;&#x2F;code&gt; (later in same block) also deploys bytecode &lt;code&gt;B&lt;&#x2F;code&gt; producing code hash &lt;code&gt;0xCA&lt;&#x2F;code&gt; at address &lt;code&gt;Y&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;T_B&lt;&#x2F;code&gt;&#x27;s access list does NOT include address &lt;code&gt;X&lt;&#x2F;code&gt;, then &lt;code&gt;T_B&lt;&#x2F;code&gt; pays full deposit cost&lt;&#x2F;li&gt;
&lt;li&gt;Deduplication only occurs when the deploying address is included in the access list&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This is acceptable because:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The first deployment cannot be known at transaction construction time&lt;&#x2F;li&gt;
&lt;li&gt;Deduplication requires implicit opt-in via access list&lt;&#x2F;li&gt;
&lt;li&gt;This scenario is extremely rare in practice&lt;&#x2F;li&gt;
&lt;li&gt;The complexity of special handling is not worth the minimal benefit&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-access-list-based-deduplication&quot;&gt;Why Access-List Based Deduplication?&lt;&#x2F;h3&gt;
&lt;p&gt;The access-list approach provides several critical properties:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Deterministic behavior:
The result depends only on the transaction&#x27;s access list and current state, not on local database contents. All nodes compute the same gas cost.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;No reverse index requirement:
Unlike other approaches, this doesn&#x27;t require maintaining a &lt;code&gt;codeHash → [accounts]&lt;&#x2F;code&gt; reverse index, which would add significant complexity and storage overhead.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Leverages existing infrastructure:
Builds on EIP-2930 access lists and EIP-2929 access costs, requiring minimal protocol changes.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Implicit optimization:
Any address included in the access list automatically contributes to deduplication. This provides automatic gas optimization without requiring explicit flags or special handling.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Avoids chain split risks:
Since no new transaction structure is introduced, there&#x27;s no risk of nodes rejecting transactions with unknown fields. The same transaction format works before and after the fork, with only the gas accounting rules changing at fork activation.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Forward compatibility:
All nodes enforce identical behavior. Wallets can add addresses to access lists to optimize gas, but this doesn&#x27;t change transaction validity.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Avoid having a code-root for state:
At this point, clients handle code storage on their own ways. They don&#x27;t have any consensus on the deployed existing codes (besides that all of the ones referenced in account&#x27;s codehash fields exist).
Changing this seems a lot more complex and unnecessary.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal requires a scheduled network upgrade but is designed to be forward-compatible with existing transactions.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Transaction compatibility:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;No changes to transaction structure - uses existing EIP-2930 access lists&lt;&#x2F;li&gt;
&lt;li&gt;Existing transactions with access lists automatically benefit from deduplication post-fork&lt;&#x2F;li&gt;
&lt;li&gt;Transactions without access lists behave identically to current behavior (no deduplication discount)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Wallet and tooling updates:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;RPC methods like &lt;code&gt;eth_estimateGas&lt;&#x2F;code&gt; SHOULD account for potential deduplication discounts when access lists are present&lt;&#x2F;li&gt;
&lt;li&gt;Wallets MAY provide UI for users to add addresses to access lists for deduplication&lt;&#x2F;li&gt;
&lt;li&gt;Transaction builders MAY automatically detect duplicate deployments and include relevant addresses in access lists&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Node implementation:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;No changes to state trie structure or database schema required&lt;&#x2F;li&gt;
&lt;li&gt;No changes to transaction parsing or RLP encoding&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;example-transaction&quot;&gt;Example Transaction&lt;&#x2F;h3&gt;
&lt;p&gt;Deploying a contract with the same bytecode as the contract at &lt;code&gt;0x1234...5678&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;from&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xabcd...ef00&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; null&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x608060405234801561001...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;accessList&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1234567890123456789012345678901234567890&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;storageKeys&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;If the deployed bytecode hash matches &lt;code&gt;codeHash(0x1234...5678)&lt;&#x2F;code&gt; (which is automatically checked because the address is in the access list), the deployment receives the deduplication discount.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;gas-cost-accuracy&quot;&gt;Gas Cost Accuracy&lt;&#x2F;h3&gt;
&lt;p&gt;The deduplication mechanism ensures that gas costs accurately reflect actual resource consumption. Duplicate deployments don&#x27;t consume additional storage, so they shouldn&#x27;t pay storage costs.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;denial-of-service&quot;&gt;Denial of Service&lt;&#x2F;h3&gt;
&lt;p&gt;The access-list mechanism prevents DoS attacks because:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The cost of reading &lt;code&gt;codeHash&lt;&#x2F;code&gt; is already covered by EIP-2929&#x2F;2930&lt;&#x2F;li&gt;
&lt;li&gt;No additional state lookups or database queries are required&lt;&#x2F;li&gt;
&lt;li&gt;The deduplication check is O(1) (set membership test)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Gas Units Rebase for High-precision Metering</title>
        <published>2025-10-22T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Maria Silva</name><uri>https://github.com/misilva73</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8059/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8059-gas-rebase-for-high-precision-gas-metering/25945" />
        

        <id>https://wg-eips.ritovision.com/8059/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:8059"
            label="EIP-8059" />
        

        
        

        
        <summary type="html">Gas parameters and variables are increased to a factor of `REBASE_FACTOR` to reduce rounding errors without major changes to the EVM</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8059/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal rebases Ethereum’s gas unit to a factor of &lt;code&gt;REBASE_FACTOR&lt;&#x2F;code&gt; to enable high-precision metering without introducing fractional gas. All gas-related parameters and variables are increased to a factor of &lt;code&gt;REBASE_FACTOR&lt;&#x2F;code&gt;. This reduces rounding errors that arise when repricing EVM operations and future-proofs gas costs as hardware improves and state access remains costly, while avoiding major changes in the internal logic of the EVM.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, most EVM compute operations (&lt;code&gt;ADD&lt;&#x2F;code&gt;, &lt;code&gt;SUB&lt;&#x2F;code&gt;, &lt;code&gt;MUL&lt;&#x2F;code&gt;, etc.) are significantly underpriced when compared with state operations (&lt;code&gt;SSTORE&lt;&#x2F;code&gt;, &lt;code&gt;SLOAD&lt;&#x2F;code&gt;, &lt;code&gt;CREATE&lt;&#x2F;code&gt;, etc.). There are two factors contributing to this mismatch. On one hand, client optimizations and hardware improvements have made pure compute operations more efficient. On the other hand, with the growing size of the Ethereum state, the performance of I&#x2F;O operations touching this larger state has been deteriorating. Both of these trends are expected to continue, further worsening this mismatch.&lt;&#x2F;p&gt;
&lt;p&gt;There are a couple of proposals to reduce the cost of compute operations (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7904&#x2F;&quot;&gt;EIP-7904&lt;&#x2F;a&gt;) and increase the cost of state operations (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8032&#x2F;&quot;&gt;EIP-8032&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8037&#x2F;&quot;&gt;EIP-8037&lt;&#x2F;a&gt;, and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8038&#x2F;&quot;&gt;EIP-8038&lt;&#x2F;a&gt;). However, given the current level of mismatch between these operations, there is an inherent trade-off in the anchor we use to reprice these operations.&lt;&#x2F;p&gt;
&lt;p&gt;If we make compute operations cheaper, we will introduce rounding errors, with most compute operations costing 1, when they should cost a fraction of that. These rounding errors impact scalability because we can now fit fewer of these cheaper operations in any given block. However, if we price all operations so that the fastest opcode is assigned 1 gas, we would need to make all other operations significantly more expensive, including both compute and state operations. Such a level of price increases would severely reduce throughput at current block limits.&lt;&#x2F;p&gt;
&lt;p&gt;To illustrate this point, let&#x27;s focus on the pure compute operations. As compute operations impact only block execution time, the chosen anchor will induce a specific million gas per second rate on all compute opcodes. For instance, if we anchor on &lt;code&gt;EcRecover&lt;&#x2F;code&gt; at the current price (3000 gas units), this induces a rate of 175Mgas&#x2F;s, based on the execution time estimated for this opcode on &lt;a href=&quot;..&#x2F;07904&#x2F;assets&#x2F;gas-cost-estimator-report.pdf&quot;&gt;EIP-7904&#x27;s empirical analysis&lt;&#x2F;a&gt;. The following plot shows the average rounding errors of compute operations for different anchors, using the same execution time estimates from EIP-7904.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8059&#x2F;.&#x2F;assets&#x2F;round_error_by_anchor.png&quot; alt=&quot;round_error_by_anchor&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;As we can see, with an anchor of 50Mgas&#x2F;s (which would result in a gas limit of 100Mgas, assuming a 2-second block execution limit), we would get an average rounding error of 59.3%. This means that we could be 59.3% cheaper on average per opcode if we didn&#x27;t have to round to integer gas units. Only after a 400Mgas&#x2F;s anchor do we get to reasonably low rounding errors. Without fractional gas, which would introduce further complexity to the EVM gas calculation, this level of Mgas&#x2F;s anchor requires a major rebase of the gas model, where all opcodes become significantly more expensive, and both the transaction-level and block-level gas limits increase by the same factor.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&quot;text-align: center&quot;&gt;&lt;strong&gt;Parameter&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;&lt;strong&gt;Value&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;REBASE_FACTOR&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;1000&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;This proposal introduces a gas rebase such that all gas-related parameters and variables are increased by a factor of &lt;code&gt;REBASE_FACTOR&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;At fork boundary, &lt;code&gt;calculate_base_fee_per_gas&lt;&#x2F;code&gt; is updated so that both &lt;code&gt;parent_gas_used&lt;&#x2F;code&gt; and &lt;code&gt;parent_base_fee_per_gas&lt;&#x2F;code&gt; are also scaled by a factor of &lt;code&gt;REBASE_FACTOR&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;A rebase factor of 1000 has two advantages:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;It is large enough to completely remove rounding errors for compute operations now and to be future-proof. As we can see from the motivation, an anchor of 400Mgas&#x2F;s would be enough to reduce these errors. Assuming a 2-second block execution time, this results in a block limit of 800M gas units, which requires an increase of 22x over the current 36M block limit.&lt;&#x2F;li&gt;
&lt;li&gt;It makes reasoning about the new gas unit simpler. Block limits and targets move from million units to billion units, while gas costs move from units to thousand units.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This is a backwards incompatible gas repricing that requires a scheduled network upgrade.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Increasing the cost of state access operations could impact the usability of certain applications. More analysis is needed to understand the potential effects on various dApps and user behaviors.&lt;&#x2F;p&gt;
&lt;p&gt;In addition, the increase in units in &lt;code&gt;gasLimit&lt;&#x2F;code&gt; and &lt;code&gt;gasUsed&lt;&#x2F;code&gt; will increase the size of the RLP representation the block header by 2 bytes. More analysis is needed to assess the bandwidth impacts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Scaled UI Amount Extension for ERC-20 Tokens</title>
        <published>2025-10-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Chris Ridmann</name><uri>https://github.com/cridmann</uri><email>chris@superstate.co</email>
	</author>
	
	<author>
		<name>Daniel Gretzke</name><uri>https://github.com/gretzke</uri>
	</author>
	
	<author>
		<name>Gilbert Shih</name><email>chung.shih@robinhood.com</email>
	</author>
	
	<author>
		<name>Tino Martinez Molina</name><uri>https://github.com/tinom9</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8056/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-8056-scaled-ui-amount-extension-for-erc-20-tokens/25899" />
        

        <id>https://wg-eips.ritovision.com/8056/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:8056"
            label="ERC-8056" />
        

        
        

        
        <summary type="html">Equity Token support for Stock Splits</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8056/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes a standard extension to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens that enables issuers to apply an updatable multiplier to the UI (user interface) amount of tokens. This allows for efficient representation of stock splits, without requiring actual token minting or transfers. The extension provides a cosmetic layer that modifies how token balances are displayed to users while maintaining the underlying token economics.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Current ERC-20 implementations lack an efficient mechanism to handle real-world asset scenarios such as stock splits: When a company performs a 2-for-1 stock split, all shareholders should see their holdings double. Currently, this requires minting new tokens to all holders, which is gas-intensive and operationally complex. Moreover, the internal accounting in DeFi protocols would break from such a split.&lt;&#x2F;p&gt;
&lt;p&gt;The inability to efficiently handle this scenario limits the adoption of tokenized real-world assets (RWAs) on Ethereum. This EIP addresses these limitations by introducing a multiplier mechanism that adjusts the displayed balance without altering the actual token supply.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;core-interface&quot;&gt;Core Interface&lt;&#x2F;h3&gt;
&lt;p&gt;Compliant contracts MUST implement the &lt;code&gt;IScaledUIAmount&lt;&#x2F;code&gt; interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IScaledUIAmount&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when the UI multiplier is updated&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UIMultiplierUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; oldMultiplier&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newMultiplier&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; effectiveAtTimestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; OPTIONAL: Emitted during a token transfer with the UI-adjusted amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransferWithUIAmount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uiAmount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the current UI multiplier&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Multiplier is represented with 18 decimals (1e18 = 1.0)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; uiMultiplier&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note: How the multiplier is updated is an implementation detail left to the token issuer. The reference implementation below shows one approach using a &lt;code&gt;setUIMultiplier&lt;&#x2F;code&gt; function with delayed effectiveness.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;optional-extension-conversion&quot;&gt;Optional Extension: Conversion&lt;&#x2F;h3&gt;
&lt;p&gt;Contracts MAY implement the &lt;code&gt;IScaledUIAmountConversion&lt;&#x2F;code&gt; extension for on-chain conversion helpers:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IScaledUIAmountConversion&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Converts a raw token amount to UI amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; toUIAmount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; rawAmount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Converts a UI amount to raw token amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fromUIAmount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uiAmount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;optional-extension-balances&quot;&gt;Optional Extension: Balances&lt;&#x2F;h3&gt;
&lt;p&gt;Contracts MAY implement the &lt;code&gt;IScaledUIAmountBalances&lt;&#x2F;code&gt; extension for on-chain UI balance queries:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IScaledUIAmountBalances&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the UI-adjusted balance of an account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOfUI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the UI-adjusted total supply&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalSupplyUI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;interface-detection&quot;&gt;Interface Detection&lt;&#x2F;h3&gt;
&lt;p&gt;Compliant contracts MUST implement &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; and return &lt;code&gt;true&lt;&#x2F;code&gt; when queried for the &lt;code&gt;IScaledUIAmount&lt;&#x2F;code&gt; interface ID.&lt;&#x2F;p&gt;
&lt;p&gt;Contracts implementing optional extensions MUST also return &lt;code&gt;true&lt;&#x2F;code&gt; for their respective interface IDs.&lt;&#x2F;p&gt;
&lt;p&gt;The interface identifiers are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;IScaledUIAmount&lt;&#x2F;code&gt;: &lt;code&gt;0xa60bf13d&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;IScaledUIAmountConversion&lt;&#x2F;code&gt;: &lt;code&gt;0xTBD&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;IScaledUIAmountBalances&lt;&#x2F;code&gt;: &lt;code&gt;0xd890fd71&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;implementation-requirements&quot;&gt;Implementation Requirements:&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;ERC-165 Support: Compliant contracts MUST implement &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; interface detection.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Multiplier Precision: The UI multiplier MUST use 18 decimal places for precision (1e18 represents a multiplier of 1.0).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Backwards Compatibility: The standard ERC-20 functions (balanceOf, transfer, transferFrom, etc.) MUST continue to work with raw amounts.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Event Emission: The UIMultiplierUpdated event MUST be emitted whenever the multiplier is changed.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h3&gt;
&lt;p&gt;The following implementation includes the core interface and all optional extensions:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ScaledUIToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    ERC20&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    ERC165&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    IScaledUIAmount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    IScaledUIAmountConversion&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    IScaledUIAmountBalances&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    Ownable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; MULTIPLIER_DECIMALS &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1e18&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _uiMultiplier &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; MULTIPLIER_DECIMALS&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Initially 1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; _nextUiMultiplier &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; MULTIPLIER_DECIMALS&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; _nextUiMultiplierEffectiveAt &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; symbol&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;name, symbol) &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-165 interface detection&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;IScaledUIAmount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;IScaledUIAmountConversion&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;IScaledUIAmountBalances&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ============ Core Interface ============&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; uiMultiplier&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; currentTime &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;currentTime &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _nextUiMultiplierEffectiveAt&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; _nextUiMultiplier&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; _uiMultiplier&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Implementation-specific: How the multiplier is updated&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setUIMultiplier&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newMultiplier&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; effectiveAtTimestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;newMultiplier &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Multiplier must be positive&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; currentTime &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;effectiveAtTimestamp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; currentTime&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Effective At must be in the future&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;currentTime &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; _nextUiMultiplierEffectiveAt&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            uint256&lt;&#x2F;span&gt;&lt;span&gt; oldMultiplier &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _nextUiMultiplier&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            _uiMultiplier &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; oldMultiplier&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            _nextUiMultiplier &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; newMultiplier&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            _nextUiMultiplierEffectiveAt &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; effectiveAtTimestamp&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UIMultiplierUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;oldMultiplier&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; newMultiplier&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; effectiveAtTimestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            uint256&lt;&#x2F;span&gt;&lt;span&gt; oldMultiplier &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _uiMultiplier&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            _nextUiMultiplier &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; newMultiplier&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            _nextUiMultiplierEffectiveAt &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; effectiveAtTimestamp&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UIMultiplierUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;oldMultiplier&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; newMultiplier&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; effectiveAtTimestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ============ Optional: Conversion Extension ============&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; toUIAmount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; rawAmount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; currentTime &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;currentTime &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _nextUiMultiplierEffectiveAt&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;rawAmount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; _nextUiMultiplier&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span&gt; MULTIPLIER_DECIMALS&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;rawAmount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; _uiMultiplier&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span&gt; MULTIPLIER_DECIMALS&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fromUIAmount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uiAmount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; currentTime &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;currentTime &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _nextUiMultiplierEffectiveAt&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;uiAmount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; MULTIPLIER_DECIMALS&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span&gt; _nextUiMultiplier&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;uiAmount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; MULTIPLIER_DECIMALS&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span&gt; _uiMultiplier&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ============ Optional: Balances Extension ============&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOfUI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; toUIAmount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalSupplyUI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; toUIAmount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;totalSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ============ Optional: TransferWithUIAmount Event ============&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _update&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_update&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; uiAmount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; toUIAmount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransferWithUIAmount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; uiAmount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Design Decisions:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Separate UI Functions: Rather than modifying the core ERC-20 functions, we provide separate UI-specific functions. This ensures backward compatibility and allows integrators to opt-in to the UI scaling feature.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;18 Decimal Precision: Using 18 decimals for the multiplier provides sufficient precision for most use cases while aligning with Ethereum&#x27;s standard decimal representation.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;No Automatic Updates: The multiplier must be explicitly set by authorized parties, giving issuers full control over when and how adjustments are made.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Raw Amount Preservation: All actual token operations continue to use raw amounts, ensuring that the multiplier is purely a display feature and doesn&#x27;t affect the underlying token economics.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Optional Extensions: Following the pattern established by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt;, helper functions like &lt;code&gt;toUIAmount&lt;&#x2F;code&gt;, &lt;code&gt;fromUIAmount&lt;&#x2F;code&gt;, &lt;code&gt;balanceOfUI&lt;&#x2F;code&gt;, and &lt;code&gt;totalSupplyUI&lt;&#x2F;code&gt; are defined in separate optional interfaces. The &lt;code&gt;TransferWithUIAmount&lt;&#x2F;code&gt; event is defined in the core interface as optional since events do not affect interface IDs. This keeps the core interface minimal while allowing contracts to opt-in to additional on-chain functionality. Integrators can detect support for these extensions using &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; interface detection.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Alternative Approaches Considered:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Rebasing Tokens: While rebasing tokens adjust supply automatically, they create complexity for integrators and can break composability with DeFi protocols.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Wrapper Tokens: Creating wrapper tokens for each adjustment event adds unnecessary complexity and gas costs.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Index&#x2F;Exchange Rate Tokens confer similar advantages to the proposed Scaled UI approach, but is ultimately less intuitive and requires more calculations on the UI layers.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Off-chain Solutions: Purely off-chain solutions lack standardization and require trust in centralized providers.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8056&#x2F;.&#x2F;assets&#x2F;token_value_repr.jpeg&quot; alt=&quot;Token Value Representation Approaches&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8056&#x2F;.&#x2F;assets&#x2F;token_arch_layers.jpeg&quot; alt=&quot;Token Architecture Layers&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP is fully backwards compatible with ERC-20. Existing ERC-20 functions continue to work as expected, and the UI scaling features are opt-in through additional functions.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h3&gt;
&lt;p&gt;Example test scenarios:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Initial Multiplier Test:&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Verify that initial multiplier is 1.0 (1e18)&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Confirm balanceOf equals balanceOfUI initially&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;ol start=&quot;2&quot;&gt;
&lt;li&gt;Stock Split Test:&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Set multiplier to 2.0 (2e18) for 2-for-1 split&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Verify UI balance is double the raw balance&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Confirm conversion functions work correctly&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;Multiplier Manipulation&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Unauthorized changes to the UI multiplier could mislead users about their holdings&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Implementations MUST use robust access control mechanisms&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The setUIMultiplier function MUST be restricted to authorized addresses (e.g., contract owner or a designated role).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;ol start=&quot;2&quot;&gt;
&lt;li&gt;Integer Overflow&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Risk of overflow when applying the multiplier&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Use SafeMath or Solidity 0.8.0+ automatic overflow protection&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;ol start=&quot;3&quot;&gt;
&lt;li&gt;User Confusion&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Clear communication is essential when UI amounts differ from raw amounts&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Integrators MUST clearly indicate when displaying UI-adjusted balances&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;ol start=&quot;4&quot;&gt;
&lt;li&gt;Oracle Dependency&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;For automated multiplier updates, the system may depend on oracles&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Oracle failures or manipulations could affect displayed balances&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;ol start=&quot;5&quot;&gt;
&lt;li&gt;Overflow Protection: Implementations MUST handle potential overflow when applying the multiplier.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;implementation-guide-for-integrators&quot;&gt;Implementation Guide for Integrators&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;wallet-integration&quot;&gt;Wallet Integration&lt;&#x2F;h4&gt;
&lt;p&gt;Wallets supporting this standard should:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Check if a token implements &lt;code&gt;IScaledUIAmount&lt;&#x2F;code&gt; interface using ERC-165&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Optionally check for &lt;code&gt;IScaledUIAmountBalances&lt;&#x2F;code&gt; extension for on-chain balance queries&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Display both raw and UI amounts, clearly labeled&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Compute UI balance off-chain using &lt;code&gt;balanceOf()&lt;&#x2F;code&gt; and &lt;code&gt;uiMultiplier()&lt;&#x2F;code&gt;, or use &lt;code&gt;balanceOfUI()&lt;&#x2F;code&gt; if the extension is supported&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Handle transfers using raw amounts (standard ERC-20 functions)&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;strong&gt;Example JavaScript integration:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; MULTIPLIER_DECIMALS&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BigInt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1e18&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Interface IDs for ERC-165 detection&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; ISCALED_UI_AMOUNT_ID&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xa60bf13d&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; ISCALED_UI_BALANCES_ID&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xd890fd71&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Off-chain conversion functions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; toUIAmount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;rawAmount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; multiplier&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;BigInt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;rawAmount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BigInt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;multiplier&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; MULTIPLIER_DECIMALS&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fromUIAmount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uiAmount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; multiplier&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;BigInt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;uiAmount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; MULTIPLIER_DECIMALS&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BigInt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;multiplier&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;async&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; displayBalance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; userAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; token&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ethers&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Contract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ScaledUIAmountABI&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; provider&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check if core scaled UI is supported&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; supportsScaledUI&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;ISCALED_UI_AMOUNT_ID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;supportsScaledUI&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Fall back to standard ERC-20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;userAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            display&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; formatUnits&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;balance&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; decimals&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            raw&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; formatUnits&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;balance&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; decimals&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            multiplier&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check if optional balances extension is supported&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; supportsBalancesExt&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;ISCALED_UI_BALANCES_ID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; rawBalance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;userAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; multiplier&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;uiMultiplier&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Use on-chain balanceOfUI if available, otherwise compute off-chain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; uiBalance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; supportsBalancesExt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        ?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;balanceOfUI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;userAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        :&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; toUIAmount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;rawBalance&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; multiplier&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        display&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; formatUnits&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;uiBalance&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; decimals&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        raw&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; formatUnits&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;rawBalance&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; decimals&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        multiplier&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; formatUnits&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;multiplier&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 18&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;exchange-integration&quot;&gt;Exchange Integration&lt;&#x2F;h4&gt;
&lt;p&gt;Exchanges should:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Store and track the multiplier for each supported token&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Display UI amounts in user interfaces&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Use raw amounts for all internal accounting&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Provide clear documentation about the scaling mechanism&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Example implementation:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; MULTIPLIER_DECIMALS&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BigInt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1e18&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ScaledTokenHandler&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Off-chain conversion functions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    toUIAmount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;rawAmount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; multiplier&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;BigInt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;rawAmount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BigInt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;multiplier&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; MULTIPLIER_DECIMALS&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    fromUIAmount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uiAmount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; multiplier&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;BigInt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;uiAmount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; MULTIPLIER_DECIMALS&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BigInt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;multiplier&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;    async&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; processDeposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; isUIAmount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; token&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ethers&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Contract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ScaledUIAmountABI&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; provider&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; rawAmount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;isUIAmount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportsScaledUI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; multiplier&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;uiMultiplier&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;            rawAmount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;fromUIAmount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; multiplier&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;            rawAmount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Process deposit with raw amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;recordDeposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; rawAmount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;    async&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getDisplayBalance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; userAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; token&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ethers&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Contract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ScaledUIAmountABI&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; provider&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; rawBalance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getInternalBalance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;userAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportsScaledUI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; multiplier&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;uiMultiplier&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;toUIAmount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;rawBalance&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; multiplier&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; rawBalance&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;defi-protocol-integration&quot;&gt;DeFi Protocol Integration&lt;&#x2F;h4&gt;
&lt;p&gt;DeFi protocols should:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Continue using raw amounts for all protocol operations&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Provide UI helpers for displaying adjusted amounts&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Emit events with both raw and UI amounts where relevant&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Document clearly which amounts are used in calculations&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Inter-Block Temporal Locality Gas Discounts</title>
        <published>2025-10-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Ben Adams</name><uri>https://github.com/benaadams</uri>
	</author>
	
	<author>
		<name>Toni Wahrstätter</name><uri>https://github.com/nerolation</uri>
	</author>
	
	<author>
		<name>Maria Inês Silva</name><uri>https://github.com/misilva73</uri>
	</author>
	
	<author>
		<name>Amirul Ashraf</name><uri>https://github.com/asdacap</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8057/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8057-block-temporal-locality-gas-discounts/25912" />
        

        <id>https://wg-eips.ritovision.com/8057/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:8057"
            label="EIP-8057" />
        

        
        

        
        <summary type="html">Multi‑block temporal locality discounts for state and account access</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8057/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal introduces a deterministic, multi-block discount for the first access to accounts and storage keys in a transaction. The discount depends on how many blocks have passed since the item was last accessed, decaying smoothly to zero over a fixed recent window. Intra-block warming semantics are unchanged - there is no warming across transactions within a block.&lt;&#x2F;p&gt;
&lt;p&gt;The mechanism builds on block-level access lists (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7928&#x2F;&quot;&gt;EIP-7928&lt;&#x2F;a&gt;), which are committed in prior blocks. This allows a newly synced node to correctly price the first block it validates without replaying historical execution.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Current warm and cold access pricing correctly models client state costs in the &lt;em&gt;worst case&lt;&#x2F;em&gt; but leaves a predictable efficiency gap in the &lt;em&gt;common case&lt;&#x2F;em&gt;. Clients maintain short-lived in-memory caches of recently accessed accounts and storage slots to handle short reorgs and pipeline execution across blocks. These caches make accesses from recent blocks materially cheaper than fully cold loads, yet the gas model does not reflect this.&lt;&#x2F;p&gt;
&lt;p&gt;As a result, Ethereum&#x27;s gas schedule is conservative: it prices every &quot;first access&quot; as if it were completely cold, even though for most active contracts those lookups are served from hot caches or SSD pages still in memory. The gap between average and worst-case cost limits how far the block gas limit can safely rise-clients must size for the worst case even if most blocks are far cheaper in practice.&lt;&#x2F;p&gt;
&lt;p&gt;We can adjust gas prices to surface this mechanical sympathy, rewarding patterns that align naturally with how hardware and clients already behave.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal narrows that gap in a deterministic and consensus-safe way. It introduces a smoothly decaying, per-item discount based solely on &lt;em&gt;publicly observable prior-block activity&lt;&#x2F;em&gt; recorded in block-level access lists (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7928&#x2F;&quot;&gt;EIP-7928&lt;&#x2F;a&gt;). That achieves three effects:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Predictability at submission time&lt;&#x2F;strong&gt; - Unlike same-block or cross-transaction warming, discounts depend only on past blocks, so users, builders, and wallets can compute exact costs deterministically from on-chain data.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Behavioural alignment&lt;&#x2F;strong&gt; - The mechanism encourages natural temporal locality: dapps and operators who reuse state within a few blocks save gas, reflecting the real cost profile of client caching.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Improved L1 scalability&lt;&#x2F;strong&gt; - By reducing the &lt;em&gt;average&lt;&#x2F;em&gt; gas cost of realistic workloads without changing the &lt;em&gt;worst case&lt;&#x2F;em&gt;, 8057 effectively raises real execution throughput per gas, helping move toward the &quot;Scale L1&quot; goal of larger blocks and better hardware utilisation.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Empirically, traces show that most hot contracts are touched repeatedly within a few blocks. A 32-block (≈6-minute) window captures the majority of these recurrences. In this regime, total gas usage per block can fall by several percent in steady state, freeing execution capacity without altering consensus rules or transaction semantics.&lt;&#x2F;p&gt;
&lt;p&gt;In short, 8057 aligns Ethereum&#x27;s gas economics with real execution cost, using already-available data (BALs) to make temporal locality explicit, deterministic, and beneficial.&lt;&#x2F;p&gt;
&lt;p&gt;As the saving depends only on publicly observable prior-block activity, it is knowable at submission time. Unlike same-block effects, it is therefore behaviour-shaping rather than incidental. It nudges workloads that naturally cluster accesses to keep doing so, matching how clients amortise repeated recent accesses.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal is intentionally scoped to per-transaction warming and does not apply intra-block warming across transactions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;terminology-and-constants&quot;&gt;Terminology and constants&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;th&gt;Default&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;WINDOW_SIZE_BLOCKS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Number of recent blocks over which a discount may apply.&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;32&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CURRENT_BLOCK_NUMBER&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The block number of the transaction being executed.&lt;&#x2F;td&gt;&lt;td&gt;-&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;LAST_ACCESS_BLOCK_NUMBER(item)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The most recent block number strictly less than &lt;code&gt;CURRENT_BLOCK_NUMBER&lt;&#x2F;code&gt; in which &lt;code&gt;item&lt;&#x2F;code&gt; was accessed by an executed transaction. If unknown or older than &lt;code&gt;WINDOW_SIZE_BLOCKS&lt;&#x2F;code&gt;, it is treated as not found.&lt;&#x2F;td&gt;&lt;td&gt;-&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;BLOCK_DISTANCE_IN_BLOCKS(item)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Defined as &lt;code&gt;CURRENT_BLOCK_NUMBER - LAST_ACCESS_BLOCK_NUMBER(item)&lt;&#x2F;code&gt; when the latter is found, else a value greater than &lt;code&gt;WINDOW_SIZE_BLOCKS&lt;&#x2F;code&gt;.&lt;&#x2F;td&gt;&lt;td&gt;-&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Gas constants from existing behaviour:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SLOAD_WARM_GAS_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;100&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SLOAD_COLD_SURCHARGE_GAS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;2100&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ACCOUNT_WARM_GAS_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;100&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ACCOUNT_COLD_SURCHARGE_GAS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;2600&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Discount caps (this EIP treats maximum as full cold surcharge, minimum as zero):&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;DISCOUNT_MAX_SLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;SLOAD_COLD_SURCHARGE_GAS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;DISCOUNT_MIN_SLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;DISCOUNT_MAX_ACCOUNT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;ACCOUNT_COLD_SURCHARGE_GAS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;DISCOUNT_MIN_ACCOUNT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;This means the closest prior-block usage allows the first access in a transaction to be charged at warm cost, and the far edge of the window trends to the normal cold-plus-warm cost.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;scope-of-operations&quot;&gt;Scope of operations&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP applies the discount to the &lt;strong&gt;first access in a transaction&lt;&#x2F;strong&gt; of:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Storage keys accessed by &lt;code&gt;SLOAD&lt;&#x2F;code&gt; and by any operation that first reads a slot as part of its semantics (for example, &lt;code&gt;SSTORE&lt;&#x2F;code&gt;&#x27;s read step).&lt;&#x2F;li&gt;
&lt;li&gt;Account touches that incur the cold account access surcharge under the current gas schedule, including but not limited to: &lt;code&gt;BALANCE&lt;&#x2F;code&gt;, &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt;, &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt;, &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt;, and the target account of &lt;code&gt;CALL&lt;&#x2F;code&gt;, &lt;code&gt;CALLCODE&lt;&#x2F;code&gt;, &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;, &lt;code&gt;STATICCALL&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Writes are affected &lt;strong&gt;only&lt;&#x2F;strong&gt; to the extent they perform an initial read or account touch that would have been charged as cold. Write-specific costs and any refund semantics are unchanged.&lt;&#x2F;p&gt;
&lt;p&gt;Precompiles remain unchanged and are always warm. Because they do not pay a cold surcharge, no discount is applied to precompile calls.&lt;&#x2F;p&gt;
&lt;p&gt;Access lists per &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930&lt;&#x2F;a&gt; remain effective and, when present, pre-warm the listed addresses and storage keys at the start of the transaction. For items that are pre-warmed by an access list, this temporal discount does not apply.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;discount-function&quot;&gt;Discount function&lt;&#x2F;h3&gt;
&lt;p&gt;The discount decays smoothly with block distance, using a &lt;strong&gt;reversed Hermite smoothstep&lt;&#x2F;strong&gt; interpolation over the discount window.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8057&#x2F;.&#x2F;assets&#x2F;gas_discount_percentage.png&quot; alt=&quot;Gas discount percentage graph&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Mathematically:&lt;&#x2F;p&gt;
&lt;p&gt;$x = \mathrm{clamp}\left( \frac{D - 1}{W - 1}, 0, 1 \right)$&lt;&#x2F;p&gt;
&lt;p&gt;$f(D, W) = d_{\text{min}} + (d_{\text{max}} - d_{\text{min}})
\cdot \left( 1 - \left( 3x^2 - 2x^3 \right) \right)$&lt;&#x2F;p&gt;
&lt;p&gt;where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;$D$ = block distance in blocks&lt;&#x2F;li&gt;
&lt;li&gt;$W$ = window size in blocks&lt;&#x2F;li&gt;
&lt;li&gt;$d_{\text{min}}$, $d_{\text{max}}$ = minimum and maximum discounts&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This form maps:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;$D = 1$ → full discount $(f = d_{\text{max}})$&lt;&#x2F;li&gt;
&lt;li&gt;$D = W$ → no discount $(f = d_{\text{min}})$&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Programmatic form&lt;&#x2F;p&gt;
&lt;p&gt;Reference smoothstep helper:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; smoothstep&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;edge0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; float&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; edge1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; float&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; x&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; float&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; float&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Scale and clamp x to [0, 1], then apply cubic Hermite smoothstep.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0.0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1.0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; edge0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;edge1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; edge0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Calculation steps:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;NORMALIZED_DISTANCE = (BLOCK_DISTANCE_IN_BLOCKS - 1) &#x2F; (WINDOW_SIZE_BLOCKS - 1)&lt;&#x2F;code&gt; clamped to &lt;code&gt;[0, 1]&lt;&#x2F;code&gt;.  This maps distance &lt;code&gt;1&lt;&#x2F;code&gt; → &lt;code&gt;0&lt;&#x2F;code&gt; and distance &lt;code&gt;WINDOW_SIZE_BLOCKS&lt;&#x2F;code&gt; → &lt;code&gt;1&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SMOOTHSTEP_VALUE = smoothstep(0.0, 1.0, NORMALIZED_DISTANCE)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;DISCOUNT_FACTOR = 1.0 - SMOOTHSTEP_VALUE&lt;&#x2F;code&gt; (equals &lt;code&gt;1.0&lt;&#x2F;code&gt; at distance &lt;code&gt;1&lt;&#x2F;code&gt;, and &lt;code&gt;0.0&lt;&#x2F;code&gt; at distance &lt;code&gt;WINDOW_SIZE_BLOCKS&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;For a given opcode family with parameters &lt;code&gt;DISCOUNT_MAX&lt;&#x2F;code&gt; and &lt;code&gt;DISCOUNT_MIN&lt;&#x2F;code&gt;, the integer discount applied to the &lt;strong&gt;cold surcharge&lt;&#x2F;strong&gt; is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BLOCK_DISTANCE_IN_BLOCKS&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; or&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BLOCK_DISTANCE_IN_BLOCKS&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; WINDOW_SIZE_BLOCKS&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    DISCOUNT_GAS&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    NORMALIZED_DISTANCE&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        0.0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1.0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;BLOCK_DISTANCE_IN_BLOCKS&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1.0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;WINDOW_SIZE_BLOCKS&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1.0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    SMOOTHSTEP_VALUE&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; smoothstep&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0.0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1.0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; NORMALIZED_DISTANCE&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    DISCOUNT_FACTOR&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SMOOTHSTEP_VALUE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    DISCOUNT_GAS&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; DISCOUNT_MIN&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; round&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;DISCOUNT_MAX&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; DISCOUNT_MIN&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; DISCOUNT_FACTOR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;All arithmetic must be implemented in &lt;strong&gt;integer space&lt;&#x2F;strong&gt; in consensus-critical code; floating point is shown here only for clarity. &lt;code&gt;round()&lt;&#x2F;code&gt; follows &lt;em&gt;round half up&lt;&#x2F;em&gt; semantics; any deterministic rule is acceptable if consistently applied across clients.&lt;&#x2F;p&gt;
&lt;p&gt;This mechanism is a &lt;strong&gt;discount&lt;&#x2F;strong&gt;, not a refund. It reduces gas charged upfront for a cold surcharge; it does not emit a rebate and does not affect refund accounting or receipts.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;charging-rules-per-transaction&quot;&gt;Charging rules (per transaction)&lt;&#x2F;h3&gt;
&lt;p&gt;For the first access to an &lt;code&gt;ITEM&lt;&#x2F;code&gt; &lt;strong&gt;within a transaction&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;If &lt;code&gt;ITEM&lt;&#x2F;code&gt; is already warm in this transaction due to same-transaction rules or pre-warmed via a transaction access list, charge the warm cost defined today. No temporal discount applies.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Otherwise compute &lt;code&gt;BLOCK_DISTANCE_IN_BLOCKS(ITEM)&lt;&#x2F;code&gt;. If &lt;code&gt;1 &amp;lt;= BLOCK_DISTANCE_IN_BLOCKS(ITEM) &amp;lt;= WINDOW_SIZE_BLOCKS&lt;&#x2F;code&gt;, apply the discount to the cold surcharge:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Storage read first access cost:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;SLOAD_FIRST_ACCESS_COST = SLOAD_WARM_GAS_COST + max(0, SLOAD_COLD_SURCHARGE_GAS - DISCOUNT_SLOAD(BLOCK_DISTANCE_IN_BLOCKS))&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Account-touch first access cost:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ACCOUNT_FIRST_ACCESS_COST = ACCOUNT_WARM_GAS_COST + max(0, ACCOUNT_COLD_SURCHARGE_GAS - DISCOUNT_ACCOUNT(BLOCK_DISTANCE_IN_BLOCKS))&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;If &lt;code&gt;BLOCK_DISTANCE_IN_BLOCKS(ITEM) &amp;gt; WINDOW_SIZE_BLOCKS&lt;&#x2F;code&gt; or not found, charge the unmodified cold surcharge plus the warm component as today.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Subsequent accesses to the same &lt;code&gt;ITEM&lt;&#x2F;code&gt; within the &lt;strong&gt;same transaction&lt;&#x2F;strong&gt; are warm as per existing rules. This EIP does not introduce block-level warming across transactions.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;initial-sync-and-pricing-with-block-level-access-lists&quot;&gt;Initial sync and pricing with block-level access lists&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP requires block-level access lists in blocks. Each block carries commitments to the sets of accounts and storage keys accessed during that block.&lt;&#x2F;p&gt;
&lt;p&gt;A newly synced node can price the very first block it validates as follows:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;For a block to validate at &lt;code&gt;CURRENT_BLOCK_NUMBER&lt;&#x2F;code&gt;, gather the BALs for the previous &lt;code&gt;WINDOW_SIZE_BLOCKS&lt;&#x2F;code&gt; blocks.&lt;&#x2F;li&gt;
&lt;li&gt;For each of those blocks, obtain the committed sets of accessed accounts and storage keys from the block body.&lt;&#x2F;li&gt;
&lt;li&gt;Build a local index mapping each seen &lt;code&gt;ITEM&lt;&#x2F;code&gt; to the most recent block number in which it appears within that window. This becomes &lt;code&gt;LAST_ACCESS_BLOCK_NUMBER(ITEM)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;When validating &lt;code&gt;CURRENT_BLOCK_NUMBER&lt;&#x2F;code&gt;, for each first access to &lt;code&gt;ITEM&lt;&#x2F;code&gt;, compute
&lt;code&gt;BLOCK_DISTANCE_IN_BLOCKS(ITEM) = CURRENT_BLOCK_NUMBER - LAST_ACCESS_BLOCK_NUMBER(ITEM)&lt;&#x2F;code&gt;
when present, else treat as out-of-window. Apply the discount rules above.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Reorgs longer than &lt;code&gt;WINDOW_SIZE_BLOCKS&lt;&#x2F;code&gt; fall back to the same procedure as initial resync. Items not present in the new canonical window are treated as cold.&lt;&#x2F;p&gt;
&lt;p&gt;No execution of historical transactions is required to compute the discount at validation time. Stateless verifiers can price gas using the current block plus compact proofs that an item appears in one of the previous &lt;code&gt;WINDOW_SIZE_BLOCKS&lt;&#x2F;code&gt; access lists.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;wallet-gas-estimation-guidance&quot;&gt;Wallet gas estimation guidance&lt;&#x2F;h3&gt;
&lt;p&gt;Wallets and RPC endpoints should not assume that a temporal discount will apply at submission, because the exact landing block is uncertain. General-purpose estimators should price as if no temporal discount applies.&lt;&#x2F;p&gt;
&lt;p&gt;Operators who can predict landing with high confidence - for example via priority fees and private order flow - may account for the exact discount, but this is an advanced path and not the default.&lt;&#x2F;p&gt;
&lt;p&gt;Motivated operators who can reliably land transactions in a specific block - for example via private order flow and appropriately set priority fees - may account for the exact discount. This is an advanced use case and should not be the default behaviour for general-purpose wallets.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;implementation-guidance&quot;&gt;Implementation guidance&lt;&#x2F;h3&gt;
&lt;p&gt;Clients are expected to maintain a rolling in-memory index to avoid rescanning prior blocks for each block:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Keep a ring buffer of &lt;code&gt;WINDOW_SIZE_BLOCKS&lt;&#x2F;code&gt; buckets, one per recent block. Each bucket stores first-touched accounts and first-touched storage keys for that block.&lt;&#x2F;li&gt;
&lt;li&gt;Maintain two maps, &lt;code&gt;LAST_SEEN_ACCOUNT&lt;&#x2F;code&gt; and &lt;code&gt;LAST_SEEN_STORAGE_KEY&lt;&#x2F;code&gt;, which track the most recent block index within the window where each item was present. On block advance, drop the oldest bucket and delete items that only appeared there, or mark them as out-of-window.&lt;&#x2F;li&gt;
&lt;li&gt;During execution, when an opcode is about to charge a cold surcharge for an item not yet warm in the current transaction, look up &lt;code&gt;BLOCK_DISTANCE_IN_BLOCKS&lt;&#x2F;code&gt; from the &lt;code&gt;LAST_SEEN_*&lt;&#x2F;code&gt; map and charge using the rules above. Then record first touches for the current block in the current bucket and update the maps.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This design keeps memory bounded by &lt;code&gt;WINDOW_SIZE_BLOCKS&lt;&#x2F;code&gt; multiplied by the number of distinct first touches per block, which is itself bounded by the block gas limit divided by the minimum per-item cost.&lt;&#x2F;p&gt;
&lt;p&gt;This is one practical approach; clients may also implement this via existing caches or by embedding and pruning block-distance hints in their state trie.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;test-cases&quot;&gt;Test cases&lt;&#x2F;h3&gt;
&lt;h3 id=&quot;example-parameters-and-results&quot;&gt;Example parameters and results&lt;&#x2F;h3&gt;
&lt;p&gt;Assume the following defaults:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;WINDOW_SIZE_BLOCKS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;32&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SLOAD_WARM_GAS_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;100&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SLOAD_COLD_SURCHARGE_GAS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;2100&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ACCOUNT_WARM_GAS_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;100&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ACCOUNT_COLD_SURCHARGE_GAS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;2600&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;DISCOUNT_MAX_SLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;2100&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;DISCOUNT_MIN_SLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;DISCOUNT_MAX_ACCOUNT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;2600&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;DISCOUNT_MIN_ACCOUNT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;example-first-storage-read-in-a-transaction&quot;&gt;Example: first storage read in a transaction&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;code&gt;BLOCK_DISTANCE_IN_BLOCKS&lt;&#x2F;code&gt;&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Discount&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Charge&lt;&#x2F;th&gt;&lt;th&gt;Notes&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;2100&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;100&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Equal to warm&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;8&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;1827&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;373&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;-&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;16&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;1101&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;1099&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Mid-window&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;24&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;347&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;1853&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;-&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;32&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;2200&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Window edge&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;&amp;gt;32&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;2200&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Fully cold&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;example-first-account-touch-in-a-transaction&quot;&gt;Example: first account touch in a transaction&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;code&gt;BLOCK_DISTANCE_IN_BLOCKS&lt;&#x2F;code&gt;&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Discount&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Charge&lt;&#x2F;th&gt;&lt;th&gt;Notes&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;2600&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;100&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Equal to warm&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;8&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;2262&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;438&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;-&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;16&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;1363&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;1337&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Mid-window&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;24&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;430&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;2270&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;-&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;32&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;2700&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Window edge&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;&amp;gt;32&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;2700&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Fully cold&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Exact integer results are determined by the reference implementation&#x27;s rounding rule (&lt;code&gt;round_to_nearest&lt;&#x2F;code&gt;, half-up).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;reference-implementation-python-integer-only&quot;&gt;Reference implementation (Python, integer only)&lt;&#x2F;h3&gt;
&lt;p&gt;This implementation is normative for rounding and scaling. It uses a power-of-two fixed-point scale so divisions by the scale are exact shifts in low-level implementations. All intermediates fit below 2**53 so a JavaScript client can mirror these steps without a big number library.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Gas constants&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;SLOAD_WARM_GAS_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 100&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;SLOAD_COLD_SURCHARGE_GAS&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2100&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;ACCOUNT_WARM_GAS_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 100&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;ACCOUNT_COLD_SURCHARGE_GAS&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2600&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Temporal discount parameters&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;WINDOW_SIZE_BLOCKS&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;DISCOUNT_MAX_SLOAD&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SLOAD_COLD_SURCHARGE_GAS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;DISCOUNT_MIN_SLOAD&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;DISCOUNT_MAX_ACCOUNT&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ACCOUNT_COLD_SURCHARGE_GAS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;DISCOUNT_MIN_ACCOUNT&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Fixed-point scale (2^25 = 33,554,432)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;SCALE_FACTOR&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 25&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;HALF_SCALE&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SCALE_FACTOR&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; smooth_factor_scaled&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;block_distance_in_blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;                         window_blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; WINDOW_SIZE_BLOCKS&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Returns round_to_nearest(SCALE_FACTOR * DISCOUNT_FACTOR) where:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;      normalized_distance = (block_distance_in_blocks - 1) &#x2F; (window_blocks - 1),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;      clamped to [0, 1]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;      smoothstep_value = normalized_distance^2 * (3 - 2 * normalized_distance)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;      discount_factor = 1 - smoothstep_value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    The result is in [0, SCALE_FACTOR].&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; block_distance_in_blocks&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; or&lt;&#x2F;span&gt;&lt;span&gt; block_distance_in_blocks&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; window_blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Use exact rational form to minimize scaling multiplications:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Let t = block_distance_in_blocks - 1, d = window_blocks - 1.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; discount_factor = (d^3 - 3*d*t^2 + 2*t^3) &#x2F; d^3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; block_distance_in_blocks&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    d&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; window_blocks&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    d3&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; d&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; d&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    t2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; t&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    t3&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; t2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; t&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    numerator&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; d3&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; d&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; t2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; t3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Round half up&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SCALE_FACTOR&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; numerator&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;d3&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; d3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; discount_gas_units&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;block_distance_in_blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;                       discount_max&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;                       discount_min&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Integer discount within the window using the smooth falloff.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Returns an integer number of gas units to subtract from the cold surcharge.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; block_distance_in_blocks&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; or&lt;&#x2F;span&gt;&lt;span&gt; block_distance_in_blocks&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; WINDOW_SIZE_BLOCKS&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    factor_scaled&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; smooth_factor_scaled&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block_distance_in_blocks&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; WINDOW_SIZE_BLOCKS&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    span&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; discount_max&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; discount_min&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    scaled&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;span&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; factor_scaled&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; HALF_SCALE&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SCALE_FACTOR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; discount_min&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; scaled&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; sload_first_access_cost&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;block_distance_in_blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    disc&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; discount_gas_units&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block_distance_in_blocks&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;                              DISCOUNT_MAX_SLOAD&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;                              DISCOUNT_MIN_SLOAD&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    cold_part&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SLOAD_COLD_SURCHARGE_GAS&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; disc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; cold_part&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        cold_part&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SLOAD_WARM_GAS_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; cold_part&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; account_first_access_cost&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;block_distance_in_blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    disc&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; discount_gas_units&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block_distance_in_blocks&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;                              DISCOUNT_MAX_ACCOUNT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;                              DISCOUNT_MIN_ACCOUNT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    cold_part&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ACCOUNT_COLD_SURCHARGE_GAS&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; disc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; cold_part&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        cold_part&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ACCOUNT_WARM_GAS_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; cold_part&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Using lookup tables&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SLOAD first access cost per block distance (1-32)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; WINDOW_SIZE_BLOCKS = 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;SLOAD_FIRST_ACCESS_COST_LUT&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    100&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 106&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 125&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 155&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 196&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 246&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 306&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 373&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    447&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 528&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 615&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 706&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 800&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 898&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 998&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1099&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    1201&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1302&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1402&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1500&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1594&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1685&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1772&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1853&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    1927&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1994&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2054&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2104&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2145&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2175&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2194&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2200&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Account first access cost per block distance (1-32)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; WINDOW_SIZE_BLOCKS = 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;ACCOUNT_FIRST_ACCESS_COST_LUT&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    100&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 108&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 131&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 168&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 219&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 281&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 354&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 438&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    530&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 630&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 737&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 850&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 967&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1088&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1212&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1337&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    1463&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1588&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1712&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1833&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1950&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2063&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2170&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2270&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    2362&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2446&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2519&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2581&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2632&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2669&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2692&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2700&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; sload_first_access_cost&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;block_distance_in_blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span&gt; block_distance_in_blocks&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SLOAD_FIRST_ACCESS_COST_LUT&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;block_distance_in_blocks&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2200&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; fully cold&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; account_first_access_cost&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;block_distance_in_blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span&gt; block_distance_in_blocks&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ACCOUNT_FIRST_ACCESS_COST_LUT&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;block_distance_in_blocks&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2700&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; fully cold&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Determinism: discounts depend only on prior blocks, so users can predict costs at submission time. The block-level access lists in headers remove bootstrap ambiguity for new nodes. Intra-block dependent savings are inherently unknowable and non-actionable at submission, so they do not change behaviour; prior-block based savings do.&lt;&#x2F;li&gt;
&lt;li&gt;Smooth curve: the chosen polynomial keeps strong incentive for very recent history and eases toward zero, aligning with how caches deliver benefit for temporal locality. Linear ramps are simpler but produce harsher edges.&lt;&#x2F;li&gt;
&lt;li&gt;Window of 32: this captures longer-lived temporal locality without turning the feature into a long-term subsidy, and keeps proof and index sizes small.&lt;&#x2F;li&gt;
&lt;li&gt;Discount not refund: reduces upfront charge only; does not change refund semantics or receipts.&lt;&#x2F;li&gt;
&lt;li&gt;No correlation: simple to implement and reason about. The model is explicitly about last-access distance, not frequency.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Builder rotation and similar operational concerns are out of scope for this EIP.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;behavioural-effects&quot;&gt;Behavioural effects&lt;&#x2F;h3&gt;
&lt;p&gt;The smoothstep curve over 32 blocks is gentle. Discount remains close to maximum for roughly the first 12 to 16 blocks and decays toward zero near the far edge of the window.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;storage-slot-sload-first-access-pricing&quot;&gt;Storage slot (SLOAD) first-access pricing&lt;&#x2F;h4&gt;
&lt;p&gt;(warm = 100, cold surcharge = 2100, window = 32)&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;code&gt;BLOCK_DISTANCE_IN_BLOCKS&lt;&#x2F;code&gt;&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Discount&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Charge&lt;&#x2F;th&gt;&lt;th&gt;Notes&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;2100&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;100&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;fully warm equivalent&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;4&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;2045&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;155&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;almost full discount&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;8&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;1827&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;373&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;12&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;1494&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;706&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;16&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;1101&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;1099&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;midpoint of window&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;18&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;898&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;1302&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;20&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;700&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;1500&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;24&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;347&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;1853&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;28&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;96&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;2104&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;near-cold&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;32&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;2200&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;window edge&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;&amp;gt;32&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;2200&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;fully cold access&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;account-access-first-access-pricing&quot;&gt;Account access first-access pricing&lt;&#x2F;h4&gt;
&lt;p&gt;(warm = 100, cold surcharge = 2600, window = 32)&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;code&gt;BLOCK_DISTANCE_IN_BLOCKS&lt;&#x2F;code&gt;&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Discount&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Charge&lt;&#x2F;th&gt;&lt;th&gt;Notes&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;2600&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;100&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;fully warm equivalent&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;4&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;2532&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;168&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;almost full discount&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;8&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;2262&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;438&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;12&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;1850&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;850&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;16&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;1363&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;1337&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;midpoint of window&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;18&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;1112&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;1588&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;20&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;867&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;1833&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;24&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;430&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;2270&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;28&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;119&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;2581&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;near-cold&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;32&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;2700&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;window edge&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;&amp;gt;32&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;2700&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;fully cold access&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;observations&quot;&gt;Observations&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Accesses 1-6 blocks apart remain effectively warm, typically under 300-400 gas total.&lt;&#x2F;li&gt;
&lt;li&gt;Around 16 blocks (≈3.2 minutes), costs reach roughly half the cold surcharge.&lt;&#x2F;li&gt;
&lt;li&gt;By 28-32 blocks (≈5.5-6.4 minutes, one finalisation epoch), costs are nearly cold again.&lt;&#x2F;li&gt;
&lt;li&gt;The transition is smooth and monotone; there are no cliffs or discontinuities to game.&lt;&#x2F;li&gt;
&lt;li&gt;Both account and storage families charge exactly the warm rate for items accessed in the immediately preceding block.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;As the discount depends only on &lt;strong&gt;prior blocks&lt;&#x2F;strong&gt;, users and dapps can plan around it. Unlike same-block effects, these savings are predictable: they are visible before submission and can be incorporated into automation or fee-scheduling logic.&lt;&#x2F;p&gt;
&lt;p&gt;If an operator wants to maintain most of the discount while sending as few transactions as possible, a practical cadence for items touched repeatedly is:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Maintain about &lt;strong&gt;80 percent&lt;&#x2F;strong&gt; of the maximum discount by ensuring the item is touched again within &lt;strong&gt;8-9 blocks&lt;&#x2F;strong&gt; (around two minutes).&lt;&#x2F;li&gt;
&lt;li&gt;Maintain about &lt;strong&gt;50 percent&lt;&#x2F;strong&gt; of the maximum discount by touching again within &lt;strong&gt;16 blocks&lt;&#x2F;strong&gt; (half an epoch).&lt;&#x2F;li&gt;
&lt;li&gt;Beyond roughly &lt;strong&gt;28 blocks&lt;&#x2F;strong&gt;, the discount fades almost entirely; by &lt;strong&gt;32 blocks&lt;&#x2F;strong&gt;, the access is fully cold again.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In short, a &lt;strong&gt;maintenance touch every 8-12 blocks&lt;&#x2F;strong&gt; is an efficient balance: high retained discount with modest transaction frequency. Applications seeking tighter control-such as bridges, keepers, or batching relayers-can choose shorter cadences, while ordinary usage patterns will keep frequently accessed state warm naturally.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;strong&gt;smooth decay curve&lt;&#x2F;strong&gt; is important. It means missing the ideal block due to a temporary spike in gas prices or unexpected congestion doesn&#x27;t abruptly forfeit the entire discount-costs rise gradually, not cliff-edge. This avoids brittle strategies that depend on exact timing and makes the mechanism more forgiving in volatile network conditions.&lt;&#x2F;p&gt;
&lt;p&gt;From a UX standpoint, humans are unlikely to act precisely within these timeframes, but automated systems can. Many popular contract surfaces-AMM reserves, token balances, or oracle feeds-stay warm simply through organic activity, letting users benefit indirectly.&lt;&#x2F;p&gt;
&lt;p&gt;Each account or storage key&#x27;s discount remains &lt;strong&gt;independent&lt;&#x2F;strong&gt;. Repeated touches within the window only update the item&#x27;s last-access block; they do not stack or correlate across different items.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;coordinated-multi-eoa-warm-up-behaviour&quot;&gt;Coordinated multi-EOA warm-up behaviour&lt;&#x2F;h4&gt;
&lt;p&gt;Because the temporal discount depends only on &lt;strong&gt;prior-block access&lt;&#x2F;strong&gt;, a coordinated actor controlling multiple EOAs or contracts can sequence transactions to capture the maximum discount. For example, a lightweight &quot;warm-up&quot; transaction from one EOA in block &lt;code&gt;N&lt;&#x2F;code&gt; can touch a set of storage keys or accounts, allowing one or more follow-up transactions in block &lt;code&gt;N+1&lt;&#x2F;code&gt; to execute those same accesses at &lt;strong&gt;warm-equivalent cost&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This &lt;strong&gt;inter-block pipelining&lt;&#x2F;strong&gt; remains predictable, verifiable, and legitimate. It does not distort consensus or introduce hidden state; it simply rewards actors who cluster related work in adjacent blocks. The discount gained is bounded by the cold surcharge itself, while the overhead of coordination, additional priority fees, and builder inclusion uncertainty all limit how aggressively this pattern can be used. In practice, it is most relevant for highly automated systems-keepers, rollup bridges, or arbitrage bundles-that already coordinate sequencing across blocks.&lt;&#x2F;p&gt;
&lt;p&gt;With the &lt;strong&gt;32-block window&lt;&#x2F;strong&gt;, the value of pipelining falls off much faster. Missing a single block only slightly reduces the discount because of the smooth decay curve, but missing several in a row quickly erodes it. That makes warm-ups more predictable yet self-limiting: actors can&#x27;t cheaply &quot;bank&quot; state heat far ahead, only maintain it across a short epoch-length horizon.&lt;&#x2F;p&gt;
&lt;p&gt;Builders and MEV searchers may still find minor advantage in chaining related operations across consecutive blocks, but this behaviour is &lt;strong&gt;constructive&lt;&#x2F;strong&gt;: it improves temporal locality in state access and lowers aggregate load on clients. The overall effect is a gentle nudge toward efficient state reuse, not a new coordination game.&lt;&#x2F;p&gt;
&lt;p&gt;If desired, protocol parameters could trim the incentive surface further-for example, by setting &lt;code&gt;DISCOUNT_MAX_*&lt;&#x2F;code&gt; slightly below the full cold surcharge so that even &lt;code&gt;D = 1&lt;&#x2F;code&gt; accesses remain marginally above the intra-transaction warm price. This specification treats that as optional tuning rather than a security necessity, accepting the small and predictable incentive as a reasonable trade-off for encouraging block-to-block efficiency.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;relationship-to-block-level-warming-proposals&quot;&gt;Relationship to block-level warming proposals&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP does not introduce intra-block warming across transactions. If a block-level warming proposal is active, its semantics are unchanged. The temporal discount defined here applies only to the first access to an item in a transaction based on prior-block history.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP changes gas charging and therefore requires a hard fork. It only decreases or equalises costs for affected opcodes and does not introduce new failure modes for existing contracts. Warm and cold cost upper bounds do not increase.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Determinism and consensus safety:&lt;&#x2F;strong&gt;
All discounts are derived from &lt;em&gt;previously committed block data&lt;&#x2F;em&gt;. No client-local or probabilistic state (like caches or heuristics) affects consensus. Any node-stateless or fully synced-can price gas deterministically using the current block and the prior &lt;code&gt;WINDOW_SIZE_BLOCKS&lt;&#x2F;code&gt; access-list commitments. This preserves verifiability and supports stateless validation with compact proofs referencing recent blocks only.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Index growth and memory bounds:&lt;&#x2F;strong&gt;
Clients must maintain a rolling index of recently accessed items. With a 32-block window, memory use scales with the number of distinct first-accessed items per block-bounded by the block gas limit divided by the minimum per-item cost. This fits comfortably within existing cache budgets, and entries naturally expire as blocks advance.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Reorg handling:&lt;&#x2F;strong&gt; Reorgs shorter than the window are cheap to recompute: nodes rebuild the index from the new canonical access lists. Longer reorgs fall back to initial resync behaviour. No historical transaction replay is required. Because discounts depend on committed data only, there is no ambiguity or consensus divergence across reorgs.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Abuse and incentive surface:&lt;&#x2F;strong&gt; The design intentionally makes &quot;warm-up&quot; transactions unprofitable. Since the maximum discount equals the cold surcharge, warming a slot in block &lt;em&gt;N&lt;&#x2F;em&gt; and using it in &lt;em&gt;N+1&lt;&#x2F;em&gt; costs slightly &lt;em&gt;more&lt;&#x2F;em&gt; than a single cold access (e.g. &lt;code&gt;2200 + 100 &amp;gt; 2200&lt;&#x2F;code&gt;). Thus there is no economic gain from spamming to maintain heat. The smooth decay curve further discourages exact-block timing games: adjacent blocks differ by only a handful of gas units at small distances.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Economic neutrality:&lt;&#x2F;strong&gt; The mechanism reduces &lt;em&gt;average&lt;&#x2F;em&gt; per-access cost but leaves &lt;em&gt;worst-case&lt;&#x2F;em&gt; costs unchanged. Builders and block producers still target the same gas limit under EIP-1559, so total basefee burn and priority-fee dynamics remain stable. The network simply fits more real execution into the same gas target, improving efficiency without altering incentives for congestion or inclusion.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Stateless compatibility:&lt;&#x2F;strong&gt;
Earlier multi-block warming ideas were considered incompatible with stateless validation because pricing depended on uncommitted or ephemeral state. By tying discounts to BAL commitments, this proposal makes the pricing rule provable and verifiable. Stateless verifiers need only one compact proof of inclusion in a recent BAL-no historical execution replay, no private cache dependency.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Zero Knowledge Token Wrapper</title>
        <published>2025-10-18T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Jiahui Cui</name><uri>https://github.com/doublespending</uri>
	</author>
	
	<author>
		<name>0xZPL</name><uri>https://github.com/0xZPL</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8065/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-8065-zero-knowledge-token-wrapper/26006" />
        

        <id>https://wg-eips.ritovision.com/8065/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:8065"
            label="ERC-8065" />
        

        
        

        
        <summary type="html">Enables any token to be wrapped, allowing secretly burnt tokens to be reminted — making privacy a native feature of every token.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8065/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC defines a standard for the Zero Knowledge Token Wrapper, a wrapper that adds privacy to tokens — including &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6909&#x2F;&quot;&gt;ERC-6909&lt;&#x2F;a&gt; — while preserving all of the tokens&#x27; original properties, such as transferability, tradability, and composability. It specifies &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7503&#x2F;&quot;&gt;EIP-7503&lt;&#x2F;a&gt;-style provable burn-and-remint flows, enabling users to break on-chain traceability and making privacy a native feature of all tokens on Ethereum.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Most existing tokens lack native privacy due to regulatory, technical, and issuer-side neglect. Users seeking privacy must rely on dedicated privacy blockchains or privacy-focused dApps, which restrict token usability, reduce composability, limit supported token types, impose whitelists, and constrain privacy schemes.&lt;&#x2F;p&gt;
&lt;p&gt;This ERC takes a different approach by introducing a zero knowledge token wrapper that preserves the underlying token’s properties while adding privacy. Its primary goals are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Pluggable privacy: the wrapper preserves all properties of the underlying token while adding privacy.&lt;&#x2F;li&gt;
&lt;li&gt;Permissionless privacy: any user can wrap any token into a Zero Knowledge Wrapped Token (ZWToken).&lt;&#x2F;li&gt;
&lt;li&gt;Broad token support: compatible with both fungible tokens (e.g., ETH, ERC-20) and non-fungible tokens (e.g., ERC-721).&lt;&#x2F;li&gt;
&lt;li&gt;EIP-7503-style privacy: supports provable burn-and-remint flows to achieve high-level privacy.&lt;&#x2F;li&gt;
&lt;li&gt;Compatibility with multiple EIP-7503 schemes: supports different provable burn address generation methods and commitment schemes (e.g., Ethereum-native MPT state tree or contract-managed commitments).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &lt;strong&gt;MUST&lt;&#x2F;strong&gt;, &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt;, &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt;, &lt;strong&gt;SHOULD NOT&lt;&#x2F;strong&gt;, and &lt;strong&gt;MAY&lt;&#x2F;strong&gt; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;overview&quot;&gt;Overview&lt;&#x2F;h3&gt;
&lt;p&gt;A Zero Knowledge Wrapped Token (ZWToken) is a wrapped token minted by a Zero Knowledge Token Wrapper. It adds a commitment-based privacy layer to existing tokens, including ERC-20, ERC-721, ERC-1155, ERC-6909. This privacy layer allows private transfers without modifying the underlying token standard, while preserving full composability with existing Ethereum infrastructure.&lt;&#x2F;p&gt;
&lt;p&gt;The commitment mechanism underlying this privacy layer may be implemented using Merkle trees, cryptographic accumulators, or any other verifiable cryptographic structure.&lt;&#x2F;p&gt;
&lt;p&gt;A Zero Knowledge Wrapped Token (ZWToken) provides the following core functionalities:&lt;&#x2F;p&gt;
&lt;p&gt;The ZWToken recipient can be a provable burn address, from which the tokens can later be reminted.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Deposit: Wraps an existing token and mints ZWToken to the specified recipient.&lt;&#x2F;li&gt;
&lt;li&gt;Transfer: Transfers ZWToken to the specified recipient.&lt;&#x2F;li&gt;
&lt;li&gt;Remint: Mints new ZWTokens to the specified recipient after verifying a zero-knowledge proof demonstrating ownership of previously burnt tokens, without revealing the link between them.&lt;&#x2F;li&gt;
&lt;li&gt;Withdraw: Burns ZWTokens to redeem the underlying tokens to the specified recipient.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;privacy-features-by-token-type&quot;&gt;Privacy Features by Token Type&lt;&#x2F;h4&gt;
&lt;p&gt;For fungible tokens (FTs), e.g., ERC-20:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;This ERC enables breaking the traceability of fund flows through the burn and remint processes.&lt;&#x2F;li&gt;
&lt;li&gt;The use of provable burn addresses hides the true holder of fungible tokens until the holder performs a withdraw operation of ZWToken.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;For non-fungible tokens (NFTs), e.g., ERC-721:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;This ERC &lt;strong&gt;cannot&lt;&#x2F;strong&gt; break the traceability of fund flows through burn and remint, since each NFT is unique and cannot participate in coin-mixing.&lt;&#x2F;li&gt;
&lt;li&gt;However, the use of provable burn addresses can still conceal the true holder of the NFT until the holder performs a withdraw operation of ZWToken.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;zwtoken-aware-workflow&quot;&gt;ZWToken-aware Workflow&lt;&#x2F;h4&gt;
&lt;p&gt;In the ZWToken-aware workflow, both the user and the system explicitly recognize and interact with ZWToken. ZWToken inherits all functional properties of the underlying token.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8065&#x2F;.&#x2F;assets&#x2F;flow1.svg&quot; alt=&quot;&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;For example, if the underlying token is ERC-20, ZWToken can be traded on DEXs, used for swaps, liquidity provision, or standard transfers. Similar to how holding WETH provides additional benefits over holding ETH directly, users may prefer to hold ZWToken rather than the underlying token.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;zwtoken-unaware-workflow&quot;&gt;ZWToken-unaware Workflow&lt;&#x2F;h4&gt;
&lt;p&gt;This ERC also supports a ZWToken-unaware workflow. In this mode, all transfers are internally handled through ZWToken, but users remain unaware of its existence.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8065&#x2F;.&#x2F;assets&#x2F;flow2.svg&quot; alt=&quot;&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;ZWToken functions transparently beneath the user interface, reducing the number of required contract interactions and improving overall user experience for those who prefer not to hold ZWToken directly.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;alternative-workflows&quot;&gt;Alternative Workflows&lt;&#x2F;h4&gt;
&lt;p&gt;The two workflows described above represent only a subset of the interaction patterns supported by this ERC. Additional workflows are also possible, including:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Reminting by the recipient:&lt;&#x2F;strong&gt;
Alice may &lt;code&gt;transfer&lt;&#x2F;code&gt; (in the ZWToken-aware workflow) or &lt;code&gt;deposit&lt;&#x2F;code&gt; (in the ZWToken-unaware workflow) ZWToken to &lt;strong&gt;Bob’s provable burn address&lt;&#x2F;strong&gt; instead of her own. In this case, the &lt;strong&gt;remint operation is initiated and proven by Bob rather than Alice&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Recursive reminting:&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
A reminted ZWToken may also be sent to &lt;strong&gt;another provable burn address&lt;&#x2F;strong&gt; controlled by Bob instead of his public address, allowing the privacy state to persist across multiple remint cycles.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC8065&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC165&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RemintData&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; commitment&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; nullifiers&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span&gt; proverData&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span&gt; relayerData&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span&gt; redeem&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span&gt; proof&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Optional&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CommitmentUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; commitment&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Deposited&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Withdrawn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Reminted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; redeem&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; deposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; withdraw&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; remint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        RemintData&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Optional&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; previewDeposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Optional&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; previewWithdraw&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Optional&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; previewRemint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; RemintData&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getLatestCommitment&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; hasCommitment&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; commitment&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Optional&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getCommitLeafCount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Optional&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getCommitLeaves&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; startIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; length&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; commitHashes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recipients&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amounts&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getUnderlying&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;deposit-wrap&quot;&gt;Deposit &#x2F; Wrap&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Deposits a specified amount of the underlying asset and mints the corresponding amount of ZWToken to the given address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If the underlying asset is an ERC-20&#x2F;ERC-721&#x2F;ERC-1155&#x2F;ERC-6909 token, the caller must approve this contract to transfer the specified `amount` beforehand.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If the underlying asset is ETH, the caller should send the deposit value along with the transaction (`msg.value`), and `msg.value` MUST be equal to `amount`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address that will receive the minted ZWTokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token identifier. For fungible tokens that do not have `id`, such as ERC-20, this value MUST be set to `0`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of the underlying asset to deposit.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Additional data for extensibility, such as fee information, callback data, or metadata.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; deposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Depositor SHOULD be &lt;code&gt;msg.sender&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The function MUST transfer the specified &lt;code&gt;amount&lt;&#x2F;code&gt; of the underlying asset from &lt;code&gt;depositor&lt;&#x2F;code&gt; to the ZWToken contract.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If the underlying asset is an ERC-20, ERC-721, ERC-1155 or ERC-6909 token, the caller MUST approve this contract to transfer the specified &lt;code&gt;amount&lt;&#x2F;code&gt; beforehand.&lt;&#x2F;li&gt;
&lt;li&gt;If the underlying asset is ETH, the caller MUST send the deposit value along with the transaction (&lt;code&gt;msg.value&lt;&#x2F;code&gt;), and &lt;code&gt;msg.value&lt;&#x2F;code&gt; MUST be equal to &lt;code&gt;amount&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The function SHOULD mint ZWToken to the recipient &lt;code&gt;to&lt;&#x2F;code&gt;. The amount minted MAY be reduced by fees as defined by the implementation.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Commitment Update:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;For contract-level commitment schemes, since to may be a provable burn address, the implementation SHOULD update the corresponding commitment.
&lt;ul&gt;
&lt;li&gt;However, this MAY be optimized: if &lt;code&gt;to&lt;&#x2F;code&gt; == &lt;code&gt;depositor&lt;&#x2F;code&gt;, the implementation MAY skip updating the commitment, as &lt;code&gt;depositor&lt;&#x2F;code&gt; cannot be a provable burn address (otherwise the transaction could not be initiated).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;For protocol-level commitment schemes (e.g., Ethereum’s native Merkle Patricia Trie), the commitment (e.g., state root or block hash) is automatically updated by the protocol.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The function MUST emit a &lt;code&gt;Deposited(depositor, to, id, amount)&lt;&#x2F;code&gt; event upon successful deposit.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;amount&lt;&#x2F;code&gt; parameter in the &lt;code&gt;Deposited&lt;&#x2F;code&gt; event represents the net amount of ZWToken received by &lt;code&gt;to&lt;&#x2F;code&gt; after deducting applicable fees, rather than the amount of underlying tokens deposited.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;data&lt;&#x2F;code&gt; parameter is reserved for future extensibility and MAY be used to pass additional information such as fee configurations, callback data, or metadata. Implementations MAY ignore this parameter if not needed.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;withdraw-unwrap&quot;&gt;Withdraw &#x2F; Unwrap&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Withdraw underlying tokens by burning ZWToken&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The recipient address that will receive the underlying token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token identifier. For fungible tokens that do not have `id`, such as ERC-20, this value MUST be set to `0`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of ZWToken to burn and redeem for the underlying token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Additional data for extensibility, such as fee information, callback data, or metadata.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; withdraw&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;Withdrawer SHOULD be &lt;code&gt;msg.sender&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The function MUST burn the specified &lt;code&gt;amount&lt;&#x2F;code&gt; of ZWToken from withdrawer.&lt;&#x2F;li&gt;
&lt;li&gt;The function SHOULD transfer underlying token to the recipient &lt;code&gt;to&lt;&#x2F;code&gt;. The amount transferred MAY be reduced by fees as defined by the implementation.&lt;&#x2F;li&gt;
&lt;li&gt;The function MUST emit a &lt;code&gt;Withdrawn(withdrawer, to, id, amount)&lt;&#x2F;code&gt; event upon successful withdrawal.
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;amount&lt;&#x2F;code&gt; parameter in the &lt;code&gt;Withdrawn&lt;&#x2F;code&gt; event represents the net amount of underlying tokens received by &lt;code&gt;to&lt;&#x2F;code&gt; after deducting applicable fees, rather than the amount of ZWToken burned.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;data&lt;&#x2F;code&gt; parameter is reserved for future extensibility and MAY be used to pass additional information such as fee configurations, callback data, or metadata. Implementations MAY ignore this parameter if not needed.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;transfer-and-update-commitment&quot;&gt;Transfer and Update Commitment&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;The Zero Knowledge Wrapped Token (ZWToken) remains fully compatible with the underlying token’s transfer interface, while extending it to support privacy-preserving operations.
&lt;ul&gt;
&lt;li&gt;When a ZWToken is transferred to a provable burn address, those tokens MUST be eligible for reminting through the remint interface, effectively breaking the traceability of the fund flow.&lt;&#x2F;li&gt;
&lt;li&gt;A provable burn address MAY take various forms (e.g., as defined in EIP-7503). Its essential properties are:
&lt;ul&gt;
&lt;li&gt;Such addresses MUST NOT be operable by any user and MUST be provably non-correspondent to any externally owned account (EOA) or smart contract.&lt;&#x2F;li&gt;
&lt;li&gt;Only the entity that generates the burn address MAY derive it, for example, through a signature-derived or deterministic generation scheme.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Commitment Update:
&lt;ul&gt;
&lt;li&gt;For commitment schemes maintained at the contract level:
&lt;ul&gt;
&lt;li&gt;If the recipient is identified as a provable burn address, the contract MUST update the commitment.
&lt;ul&gt;
&lt;li&gt;Example — a recipient that has previously sent any ZWToken MUST NOT be a provable burn address, since such addresses are incapable of initiating outgoing transfers. In this case, commitment update is not required.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;For protocol-level commitment schemes (e.g., Ethereum’s native MPT tree), the contract does not need to manage any commitment state, since the protocol layer already provides verifiable commitment structures.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;remint&quot;&gt;Remint&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Encapsulates all data required for remint operations&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; commitment&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The commitment (Merkle root) corresponding to the provided proof&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; nullifiers&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Array of unique nullifiers used to prevent double-remint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; proverData&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Generic data for the prover. The meaning and encoding are implementation-specific (e.g., a circuit identifier&#x2F;version).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; relayerData&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Generic data for the relayer. The meaning and encoding are implementation-specific (e.g., fee information).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; redeem&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If true, withdraws the equivalent underlying token instead of reminting ZWToken&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; proof&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Zero-knowledge proof bytes verifying ownership of the provable burn address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RemintData&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; commitment&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; nullifiers&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span&gt; proverData&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span&gt; relayerData&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bool&lt;&#x2F;span&gt;&lt;span&gt; redeem&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span&gt; proof&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Remint ZWToken using a zero-knowledge proof to unlink the source of funds&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Recipient address that will receive the reminted ZWToken or the underlying token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token identifier. For fungible tokens that do not have `id`, such as ERC-20, this value MUST be set to `0`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Amount of ZWToken burned from the provable burn address for reminting&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Encapsulated remint data including commitment, nullifiers, redeem flag, proof, and relayer information&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; remint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    RemintData&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The function MUST verify the zero-knowledge proof proof against the provided commitment to ensure:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Ownership of the provable burn address.&lt;&#x2F;li&gt;
&lt;li&gt;Correctness parameters of &lt;code&gt;remint&lt;&#x2F;code&gt;, i.e., the zk proof public inputs.&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  RemintData &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;calldata&lt;&#x2F;span&gt;&lt;span&gt; data &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; All fields except data.proof are used as public inputs for zk proof verification&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Reminter SHOULD be &lt;code&gt;msg.sender&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The function MUST validate the input &lt;code&gt;data.commitment&lt;&#x2F;code&gt; to ensure it exists.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The function MUST ensure that none of the &lt;code&gt;data.nullifiers&lt;&#x2F;code&gt; have been used previously. Reuse of any nullifier MUST revert the transaction.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;This supports batch reminting in a single proof by allowing multiple nullifiers to be provided and consumed atomically.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Upon successful verification:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If &lt;code&gt;data.redeem&lt;&#x2F;code&gt; is false, the function MUST mint ZWToken to the recipient &lt;code&gt;to&lt;&#x2F;code&gt;. The amount minted MAY be reduced by fees as defined by the implementation.
&lt;ul&gt;
&lt;li&gt;In this case, the function MUST emit the &lt;code&gt;Reminted&lt;&#x2F;code&gt; event after a successful remint of ZWToken.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;data.redeem&lt;&#x2F;code&gt; is true, the function MUST transfer underlying token to the recipient &lt;code&gt;to&lt;&#x2F;code&gt;. The amount transferred MAY be reduced by fees as defined by the implementation.
&lt;ul&gt;
&lt;li&gt;In this case, the function MUST emit the &lt;code&gt;Reminted&lt;&#x2F;code&gt; event after a successful withdrawal of the underlying token.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The net tokens received by the recipient &lt;code&gt;to&lt;&#x2F;code&gt; MAY be reduced by relayer fees if the relayer charges a fee (as specified in &lt;code&gt;data.relayerData&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;The function MUST mark &lt;strong&gt;each&lt;&#x2F;strong&gt; nullifier in &lt;code&gt;data.nullifiers&lt;&#x2F;code&gt; as spent to prevent double-spending.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The function MUST emit a &lt;code&gt;Reminted(reminter, to, id, amount, data.redeem)&lt;&#x2F;code&gt; event upon successful remint.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;amount&lt;&#x2F;code&gt; parameter in the &lt;code&gt;Reminted&lt;&#x2F;code&gt; event represents the net amount of underlying tokens or ZWToken received by &lt;code&gt;to&lt;&#x2F;code&gt; after all applicable fees have been deducted.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;preview-functions-optional&quot;&gt;Preview Functions (Optional)&lt;&#x2F;h3&gt;
&lt;p&gt;Since the actual token amounts received may differ from the input amounts due to implementation-specific factors (e.g., fees), users need a standardized way to determine the exact amounts they will receive. Following the design pattern established by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4626&#x2F;&quot;&gt;ERC-4626&lt;&#x2F;a&gt;, the preview functions allow users to simulate the effects of their operations at the current block, returning values as close to and no more than the exact amounts that would result from the corresponding mutable operations if called in the same transaction.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; OPTIONAL: Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST return as close to and no more than the exact amount of ZWToken that would be minted in a `deposit` call in the same transaction.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address that will receive the minted ZWTokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token identifier. For fungible tokens that do not have `id`, such as ERC-20, this value MUST be set to `0`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of underlying tokens to deposit.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Additional data for extensibility, such as fee information.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; amount of ZWToken that would be minted to the recipient after deducting applicable fees.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; previewDeposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;previewDeposit(address to, uint256 id, uint256 amount, bytes calldata data)&lt;&#x2F;code&gt;: OPTIONAL. Returns the exact amount of ZWToken that would be minted for the specified amount of underlying tokens.
&lt;ul&gt;
&lt;li&gt;MUST be inclusive of deposit fees. Integrators SHOULD be aware of the existence of deposit fees.&lt;&#x2F;li&gt;
&lt;li&gt;MUST NOT revert due to implementation-specific user&#x2F;global limits.&lt;&#x2F;li&gt;
&lt;li&gt;MAY revert due to other conditions that would also cause &lt;code&gt;deposit&lt;&#x2F;code&gt; to revert.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; OPTIONAL: Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST return as close to and no more than the exact amount of underlying tokens that would be received in a `withdraw` call in the same transaction.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The recipient address that will receive the underlying token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token identifier. For fungible tokens that do not have `id`, such as ERC-20, this value MUST be set to `0`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of ZWToken to burn.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Additional data for extensibility, such as fee information.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; amount of underlying tokens that would be received by the recipient after deducting applicable fees.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; previewWithdraw&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;previewWithdraw(address to, uint256 id, uint256 amount, bytes calldata data)&lt;&#x2F;code&gt;: OPTIONAL. Returns the exact amount of underlying tokens that would be received for burning the specified amount of ZWToken.
&lt;ul&gt;
&lt;li&gt;MUST be inclusive of withdrawal fees. Integrators SHOULD be aware of the existence of withdrawal fees.&lt;&#x2F;li&gt;
&lt;li&gt;MUST NOT revert due to implementation-specific user&#x2F;global limits.&lt;&#x2F;li&gt;
&lt;li&gt;MAY revert due to other conditions that would also cause &lt;code&gt;withdraw&lt;&#x2F;code&gt; to revert.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; OPTIONAL: Allows an on-chain or off-chain user to simulate the effects of their remint at the current block.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST return as close to and no more than the exact amount of ZWToken or underlying tokens that would be received in a `remint` call in the same transaction.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Recipient address that will receive the reminted ZWToken or the underlying token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token identifier. For fungible tokens that do not have `id`, such as ERC-20, this value MUST be set to `0`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of ZWToken burned from the provable burn address for reminting.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Encapsulated remint data including commitment, nullifiers, redeem flag, proof, and relayer information.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; amount of ZWToken or underlying tokens that would be received by the recipient after all applicable fees have been deducted.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; previewRemint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; RemintData&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;previewRemint(address to, uint256 id, uint256 amount, RemintData calldata data)&lt;&#x2F;code&gt;: OPTIONAL. Returns the exact amount of ZWToken (or underlying tokens if &lt;code&gt;data.redeem&lt;&#x2F;code&gt; is true) that would be received for a remint operation.
&lt;ul&gt;
&lt;li&gt;MUST be inclusive of all applicable fees, including remint fees and relayer fees (as specified in &lt;code&gt;data.relayerData&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;MUST NOT revert due to implementation-specific user&#x2F;global limits.&lt;&#x2F;li&gt;
&lt;li&gt;MAY revert due to other conditions that would also cause &lt;code&gt;remint&lt;&#x2F;code&gt; to revert.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;query-interfaces&quot;&gt;Query Interfaces&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the current top-level commitment representing the privacy state&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token identifier. For fungible tokens that do not have `id`, such as ERC-20, this value MUST be set to `0`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; latest root hash of the commitment tree&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getLatestCommitment&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Checks if a specific top-level commitment exists&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token identifier. For fungible tokens that do not have `id`, such as ERC-20, this value MUST be set to `0`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; commitment&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The root hash to verify&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; True&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if the commitment exists, false otherwise&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; hasCommitment&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; commitment&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; OPTIONAL: Returns the total number of commitment leaves stored&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token identifier. For fungible tokens that do not have `id`, such as ERC-20, this value MUST be set to `0`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; total count of commitment leaves&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getCommitLeafCount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; OPTIONAL: Retrieves leaf-level commit data and their hashes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token identifier. For fungible tokens that do not have `id`, such as ERC-20, this value MUST be set to `0`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; startIndex&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Index of the first leaf to fetch&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; length&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Number of leaves to fetch&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; commitHashes&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Hashes of the leaf data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; recipients&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Recipient addresses of each leaf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amounts&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Token amounts of each leaf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getCommitLeaves&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; startIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; length&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; commitHashes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recipients&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amounts&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the address of the underlying token wrapped by this ZWToken&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; underlying token contract address, or address(0) if the underlying asset is ETH.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getUnderlying&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;getLatestCommitment(uint256 id)&lt;&#x2F;code&gt;: MUST return the most recent top-level commitment associated with the specified token identifier, representing the current state of the ZWToken system.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;For protocol-level commitments, the block number can be used as the commitment, as it can directly map to the block hash.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;hasCommitment(uint256 id, bytes32 commitment)&lt;&#x2F;code&gt;: MUST check whether a specific top-level commitment associated with the specified token identifier exists in the contract.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;For proving ownership of a provable burn address, it does not require the latest commitment.&lt;&#x2F;li&gt;
&lt;li&gt;For protocol-level commitments, the block number can be used as the commitment, as it can directly map to the block hash.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;getCommitLeafCount(uint256 id)&lt;&#x2F;code&gt;: OPTIONAL. Returns the total number of leaf-level commitments, which helps &lt;code&gt;getCommitLeaves&lt;&#x2F;code&gt; retrieve the leaves. The returned value also represents the current size of the privacy pool.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;getCommitLeaves(uint256 id, uint256 startIndex, uint256 length)&lt;&#x2F;code&gt;: OPTIONAL. Retrieves leaf-level commitment data from the commitment tree associated with the specified token identifier.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;On-chain storage of commit data can be used to improve privacy and decentralization but will incur higher gas costs.&lt;&#x2F;li&gt;
&lt;li&gt;Event-based reconstruction can be used as an alternative, though it introduces potential centralization risks.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;getUnderlying()&lt;&#x2F;code&gt;: MUST return the address of the underlying token that this ZWToken wraps.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If the underlying asset is ETH, MUST return &lt;code&gt;address(0)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;erc-165-support&quot;&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; Support&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Implementations of this ERC MUST implement ERC-165 interface detection.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;supportsInterface(bytes4)&lt;&#x2F;code&gt; MUST return &lt;code&gt;true&lt;&#x2F;code&gt; for &lt;code&gt;type(IERC8065).interfaceId&lt;&#x2F;code&gt; (in addition to any other supported interfaces), allowing other contracts to reliably detect whether a token is a ZWToken wrapper.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;events&quot;&gt;Events&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Optional: Emitted when a contract-maintained commitment is updated&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; OPTIONAL event emitted when a commitment is updated in the contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token identifier. For fungible tokens that do not have `id`, such as ERC-20, this value MUST be set to `0`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; commitment&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The new top-level commitment hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The recipient address associated with the commitment&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount related to this commitment update&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CommitmentUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; commitment&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when underlying tokens are deposited and ZWToken is minted to the recipient&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address sending the underlying tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address receiving the minted ZWToken (after fees)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token identifier. For fungible tokens that do not have `id`, such as ERC-20, this value MUST be set to `0`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The net amount of ZWToken minted to `to` after deducting applicable fees&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Deposited&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when ZWToken is burned to redeem underlying tokens to the recipient&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address burning the ZWToken&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address receiving the redeemed underlying tokens (after fees)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token identifier. For fungible tokens that do not have `id`, such as ERC-20, this value MUST be set to `0`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The net amount of underlying tokens received by `to` after deducting applicable fees&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Withdrawn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted upon successful reminting of ZWToken or withdrawal of underlying tokens via a zero-knowledge proof&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address initiating the remint operation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address receiving the reminted ZWToken or withdrawn underlying tokens (after fees)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token identifier. For fungible tokens that do not have `id`, such as ERC-20, this value MUST be set to `0`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The net amount of ZWToken or underlying tokens received by `to` after all applicable fees have been deducted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; redeem&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If true, withdraws the equivalent underlying tokens instead of reminting ZWToken&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Reminted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; redeem&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;CommitmentUpdated(uint256 indexed id, bytes32 indexed commitment, address indexed to, uint256 amount)&lt;&#x2F;code&gt; is OPTIONAL and may be emitted when a contract-maintained commitment is updated, such as when ZWToken is sent to a potential provable burn address. It allows users to reconstruct commitments and generate zero-knowledge proofs, where &lt;code&gt;id&lt;&#x2F;code&gt; is the token identifier, &lt;code&gt;commitment&lt;&#x2F;code&gt; is the new commitment, &lt;code&gt;to&lt;&#x2F;code&gt; is the recipient, and &lt;code&gt;amount&lt;&#x2F;code&gt; is the committed token amount.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;Deposited(address indexed from, address indexed to, uint256 indexed id, uint256 amount)&lt;&#x2F;code&gt; signals that underlying tokens have been deposited and ZWToken minted to the recipient, where &lt;code&gt;from&lt;&#x2F;code&gt; is the sender, &lt;code&gt;to&lt;&#x2F;code&gt; is the recipient, &lt;code&gt;id&lt;&#x2F;code&gt; is the token identifier and &lt;code&gt;amount&lt;&#x2F;code&gt; is the net amount of ZWToken minted to &lt;code&gt;to&lt;&#x2F;code&gt; after deducting applicable fees.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;Withdrawn(address indexed from, address indexed to, uint256 indexed id, uint256 amount)&lt;&#x2F;code&gt; signals that ZWToken has been burned to redeem underlying tokens to the recipient, where &lt;code&gt;from&lt;&#x2F;code&gt; is the burner, &lt;code&gt;to&lt;&#x2F;code&gt; is the receiver, &lt;code&gt;id&lt;&#x2F;code&gt; is the token identifier and &lt;code&gt;amount&lt;&#x2F;code&gt; is the net amount of underlying tokens received by &lt;code&gt;to&lt;&#x2F;code&gt; after deducting applicable fees.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;Reminted(address indexed from, address indexed to, uint256 indexed id, uint256 amount, bool redeem)&lt;&#x2F;code&gt; MUST be emitted upon successful reminting of ZWToken or withdrawal of underlying tokens via a zero-knowledge proof, where &lt;code&gt;from&lt;&#x2F;code&gt; is the reminter, &lt;code&gt;to&lt;&#x2F;code&gt; is the recipient, &lt;code&gt;id&lt;&#x2F;code&gt; is the token identifier and &lt;code&gt;amount&lt;&#x2F;code&gt; is the net amount of ZWToken or underlying tokens received by &lt;code&gt;to&lt;&#x2F;code&gt; after all applicable fees have been deducted.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Permissionless Wrapping: Launching a new zk-native token is unlikely to achieve sufficient liquidity or adoption, and major token issuers are unlikely to deploy zk variants due to regulatory and operational constraints. A permissionless wrapper makes privacy a native feature for existing tokens. ZWToken does not require issuer consent—any existing token can be wrapped, ensuring openness and equal accessibility regardless of issuer policies.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Composable Privacy: Wrapped tokens remain fully compatible with their underlying token standards, preserving interoperability across the Ethereum ecosystem. Users and dApps can treat ZWToken as the underlying token when privacy is not required, making privacy an optional and composable extension rather than a separate system.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Awareness of ZWToken: This ERC supports both ZWToken-aware and ZWToken-unaware workflows, each with distinct advantages. In the ZWToken-aware workflow, ZWToken inherits all functional properties of the underlying token and can interact seamlessly with existing DeFi protocols. In the ZWToken-unaware workflow, ZWToken operates transparently beneath the user interface, reducing the number of required contract interactions and improving user experience for those who prefer not to hold ZWToken directly.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Multiple Token Standard Support: This ERC only depends on the transferability of the underlying token, enabling broad compatibility with token standards such as ERC-20, ERC-721, ERC-1155, and ERC-6909. Non-transferable tokens (e.g., Soulbound Tokens, SBTs) are out of scope. Implementations may require extra care for:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Fee-on-transfer tokens.&lt;&#x2F;li&gt;
&lt;li&gt;Rebasing tokens (consider wrapping an existing non-rebasing wrapper to avoid rebase-handling complexity).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Fee Mechanisms: Fee structures are implementation-specific and not defined by this ERC. Implementations MAY apply fees during deposit, remint, or withdraw phases, and MAY support various fee models (e.g., fixed fees, percentage-based fees, or no fees).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Relayer-Enabled Remint: This ERC supports relayer functionality, allowing third parties to submit remint transactions on behalf of users while receiving a fee. This design mitigates privacy leakage caused by revealing the original sender&#x27;s address when paying gas fees.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Data Extensibility:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The meaning and encoding of &lt;code&gt;proverData&lt;&#x2F;code&gt; and &lt;code&gt;relayerData&lt;&#x2F;code&gt; are implementation-specific.&lt;&#x2F;li&gt;
&lt;li&gt;Implementations MAY encode prover-specific metadata in &lt;code&gt;data.proverData&lt;&#x2F;code&gt; (e.g., a circuit identifier&#x2F;version, a proving key identifier, or packed auxiliary public inputs).&lt;&#x2F;li&gt;
&lt;li&gt;Implementations MAY encode relayer-specific metadata in &lt;code&gt;data.relayerData&lt;&#x2F;code&gt; (e.g., fee information, a fee token, or other fee model parameters).&lt;&#x2F;li&gt;
&lt;li&gt;A single universal encoding is impractical because proving schemes and relayer compensation models can vary significantly.&lt;&#x2F;li&gt;
&lt;li&gt;If cross-implementation interoperability is desired, a separate ERC (or profile) SHOULD standardize encoding(s) for &lt;code&gt;proverData&lt;&#x2F;code&gt; and&#x2F;or &lt;code&gt;relayerData&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Commitment Generalization: The ERC adopts a generic commitment abstraction, supporting various schemes such as Merkle trees or other verifiable cryptographic accumulators. This flexibility enables developers to adapt the standard to different privacy or scalability trade-offs.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Proof System Generalization: Proofs are passed as bytes calldata, allowing the use of SNARKs, STARKs, or any other zero-knowledge proof system, ensuring future-proof interoperability across cryptographic frameworks.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Provable Burn Address Generalization: This ERC does not prescribe a specific method for generating Provable Burn Addresses, as long as the following conditions are met. One example is adopting zk-friendly hash functions such as Poseidon to replace keccak256 in the address generation algorithm.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Such addresses MUST NOT be operable by any user and MUST be provably non-correspondent to any externally owned account (EOA) or smart contract.&lt;&#x2F;li&gt;
&lt;li&gt;Only the entity that generates the burn address MAY derive it, for example through a signature-derived or deterministic generation scheme.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Dual Commitment Options: The ERC supports both contract-maintained commitments and protocol-level commitments (using blockhash as the commitment).&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Contract-maintained commitments reduce proof complexity, allowing smaller ZK circuits and enabling proof generation directly in browsers or mobile devices, at the cost of higher gas consumption during transfers.&lt;&#x2F;li&gt;
&lt;li&gt;Using blockhash as the commitment eliminates on-chain maintenance overhead but increases the complexity of off-chain proof generation.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Preview Functions: Following the design pattern established by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4626&#x2F;&quot;&gt;ERC-4626&lt;&#x2F;a&gt;, this ERC includes optional preview functions (&lt;code&gt;previewDeposit&lt;&#x2F;code&gt;, &lt;code&gt;previewWithdraw&lt;&#x2F;code&gt;, &lt;code&gt;previewRemint&lt;&#x2F;code&gt;) that simulate the exact outcomes of their corresponding mutable operations.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Since the actual token amounts received may differ from the input amounts due to implementation-specific factors (e.g., fees), users and integrators need a standardized way to determine the exact amounts.&lt;&#x2F;li&gt;
&lt;li&gt;These functions provide a standardized interface for querying the net token amounts, enabling accurate UX displays and informed decision-making before executing transactions.&lt;&#x2F;li&gt;
&lt;li&gt;Each preview function mirrors the parameters of its corresponding mutable operation to ensure accurate calculations that may depend on any of these parameters.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC introduces no breaking changes. It extends the functionality of the underlying token without modifying or overriding its base interfaces.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: MIT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.20&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC20&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC20&#x2F;ERC20.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC20&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC20&#x2F;IERC20.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;SafeERC20&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC20&#x2F;utils&#x2F;SafeERC20.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC165&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;utils&#x2F;introspection&#x2F;ERC165.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC165&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;utils&#x2F;introspection&#x2F;IERC165.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IVerifier&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verifyProof&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; proof&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; input&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ZWToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC8065&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC20&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC165&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    using&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SafeERC20&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC20&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    IERC20 &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; immutable&lt;&#x2F;span&gt;&lt;span&gt; underlying&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    IVerifier &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; immutable&lt;&#x2F;span&gt;&lt;span&gt; verifier&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; usedNullifier&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Deposited&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Withdrawn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Reminted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; redeem&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; symbol_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; underlying_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; verifier_&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;name_, symbol_) &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;underlying_ &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Invalid underlying&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;verifier_ &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Invalid verifier&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        underlying &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;underlying_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        verifier &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IVerifier&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;verifier_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; deposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;amount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;amount must &amp;gt; 0&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;id &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;id must be 0 for ERC20&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        underlying&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;safeTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Deposited&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; withdraw&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;amount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;amount must &amp;gt; 0&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;id &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;id must be 0 for ERC20&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _burn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        underlying&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;safeTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Withdrawn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; remint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        IERC8065&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;RemintData&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;id &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;id must be 0 for ERC20&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; NOTE&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: This reference implementation uses a verifier circuit that consumes a single nullifier as a public input.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ERC-8065 specification allows `data.nullifiers` to contain multiple nullifiers so implementations can&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; support batch reminting (consuming multiple nullifiers atomically within one proof).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;nullifiers&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Only single nullifier supported&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; nullifier &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;nullifiers&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;usedNullifier&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;nullifier&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;nullifier used&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; headerHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; blockhash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;commitment&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;headerHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;commitment not found&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Example encoding (implementation-specific):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if relayerData.length &amp;gt;= 32, first 32 bytes are interpreted as relayerFee (uint256)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; relayerFee &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;relayerData&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                relayerFee &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calldataload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;relayerData&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;offset&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Replay protection by chain id and contract address is handled externally––&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; they MUST be included as parameters when generating the provable burn address and proof.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; (For example, the Poseidon hash that defines the burn address should incorporate these values.)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; No contract-side enforcement is implemented here.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; input &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[](&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;headerHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;nullifier&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint160&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;5&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;redeem &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; :&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;6&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;relayerFee&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;verifier&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;verifyProof&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;proof&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; input&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;bad proof&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        usedNullifier&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;nullifier&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Fee handling is implementation-specific&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This example implementation applies only relayer fees (parsed from relayerData above)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; In this example, relayerFee is interpreted as a percentage with denominator 10000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; remain &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;relayerFee &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            uint256&lt;&#x2F;span&gt;&lt;span&gt; feeDenominator &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10000&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;relayerFee &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; feeDenominator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;invalid relayer fee&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            remain &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; amount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt; amount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; relayerFee &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; feeDenominator&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;remain &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;invalid remain&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;redeem&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            underlying&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;safeTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; remain&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;relayerFee &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                underlying&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;safeTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt; remain&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            _mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; remain&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;relayerFee &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;                _mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt; remain&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Reminted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; remain&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;redeem&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getLatestCommitment&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;id &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;id must be 0 for ERC20&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; hasCommitment&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; commitment&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;id &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;id must be 0 for ERC20&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; headerHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; blockhash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;commitment&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; headerHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getUnderlying&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;underlying&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Optional preview functions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; previewDeposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;id &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;id must be 0 for ERC20&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This example implementation has no deposit fees, so the output equals the input.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Implementations with fees SHOULD deduct them here.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; previewWithdraw&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;id &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;id must be 0 for ERC20&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This example implementation has no withdrawal fees, so the output equals the input.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Implementations with fees SHOULD deduct them here.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; previewRemint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; IERC8065&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;RemintData&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;id &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;id must be 0 for ERC20&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Example encoding (implementation-specific):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Parse relayerFee from relayerData (if provided)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; relayerFee &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;relayerData&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            relayerFee &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;decode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;relayerData&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Apply relayer fee (percentage with denominator 10000)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; remain &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;relayerFee &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            uint256&lt;&#x2F;span&gt;&lt;span&gt; feeDenominator &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10000&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;relayerFee &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; feeDenominator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;invalid relayer fee&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            remain &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; amount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt; amount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; relayerFee &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; feeDenominator&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; remain&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        public&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        virtual&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        override&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC165&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC165&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;IERC8065&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Double-Remint Prevention: Each remint operation MUST include one or more unique nullifiers (&lt;code&gt;data.nullifiers&lt;&#x2F;code&gt;) to prevent double-remint attacks.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Reusing any nullifier MUST revert.&lt;&#x2F;li&gt;
&lt;li&gt;On success, all provided nullifiers MUST be marked as spent.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Over-Minting Protection: The total supply of ZWToken MAY temporarily exceed the supply of the underlying token. However, the surplus represents provably burnt tokens, which are permanently removed from circulation and cannot be redeemed.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Local Proof Generation: Circuits SHOULD remain as small and efficient as possible to enable users to generate zero-knowledge proofs locally (e.g., within browsers or mobile devices). This minimizes reliance on third-party provers that may introduce privacy leakage risks.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Provable Burn Address Security: Provable burn addresses MAY follow different generation schemes (e.g., as proposed in EIP-7503). The essential properties are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;These addresses MUST be non-operable and provably non-correspondent to any externally owned account (EOA) or smart contract.&lt;&#x2F;li&gt;
&lt;li&gt;Only the generator of the burn address MAY deterministically derive it, for instance, through a signature-derived scheme.&lt;&#x2F;li&gt;
&lt;li&gt;Implementations SHOULD prefer zk-friendly hash functions (e.g., Poseidon) in place of keccak256 to improve proof efficiency and reduce circuit size.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Burn and Remint Process Privacy:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Burn amounts SHOULD appear indistinguishable from ordinary transfers to prevent correlation with remint amounts.&lt;&#x2F;li&gt;
&lt;li&gt;Burn and remint events SHOULD be separated in time to reduce linkability.&lt;&#x2F;li&gt;
&lt;li&gt;Each burn operation MUST use a unique Provable Burn Address that can be used only once.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Fully On-Chain Operation: The protocol operates entirely on-chain and requires no trusted backend. It can be directly integrated into wallets or dApps without introducing custodial or centralized dependencies.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Commit Data Privacy: When generating proofs, users SHOULD retrieve as much commitment data as possible to maximize anonymity. Relying on selective or limited data sources may allow inference of the specific commit path being proven, weakening privacy guarantees.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Precompile for Falcon support</title>
        <published>2025-10-17T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Renaud Dubois</name><uri>https://github.com/rdubois-crypto</uri>
	</author>
	
	<author>
		<name>Simon Masson</name><uri>https://github.com/simonmasson</uri>
	</author>
	
	<author>
		<name>Antonio Sanso</name><uri>https://github.com/asanso</uri>
	</author>
	
	<author>
		<name>Marius van der Wijden</name><uri>https://github.com/mariusvanderwijden</uri>
	</author>
	
	<author>
		<name>Kevaundray Wedderburn</name><uri>https://github.com/kevaundray</uri>
	</author>
	
	<author>
		<name>Zhenfei Zhang</name><uri>https://github.com/zhenfeizhang</uri>
	</author>
	
	<author>
		<name>Nicolas Consigny</name><uri>https://github.com/nconsigny</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8052/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8052-precompile-for-falcon-support/25860" />
        

        <id>https://wg-eips.ritovision.com/8052/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:8052"
            label="EIP-8052" />
        

        
        

        
        <summary type="html">Proposal to add a precompiled contract that performs signature verifications using the Falcon signature scheme.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8052/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal creates a precompiled contract that performs signature verifications using the Falcon-512 signature scheme by given parameters of the message hash, signature, and public key. This allows any EVM chain -- principally Ethereum roll-ups -- to integrate this precompiled contract easily.&lt;&#x2F;p&gt;
&lt;p&gt;The signature scheme can be instantiated in two version:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Falcon, the standard signature scheme, fully compliant with the algorithm recommended by the NIST,&lt;&#x2F;li&gt;
&lt;li&gt;An EVM-friendly version where the hash function is efficiently computed in the Ethereum Virtual Machine.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Three precompiled contracts are specified (formerly called &lt;code&gt;ETH_HASH_TO_POINT&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;HASH_TO_POINT_ETH&lt;&#x2F;code&gt; in drafts):&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;FALCON_HASH_TO_POINT_SHAKE256&lt;&#x2F;code&gt; — NIST-compliant Hash-to-Point using SHAKE256.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;FALCON_HASH_TO_POINT_KECCAKPRNG&lt;&#x2F;code&gt; — EVM-friendly Hash-to-Point using a Keccak-based XOF&#x2F;PRNG.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;FALCON_CORE&lt;&#x2F;code&gt; — the core algorithm of Falcon, that verifies the signature from the obtained (HashToPoint) challenge.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Quantum computers pose a long-term risk to classical cryptographic algorithms. In particular, signature algorithms based on the hardness of the Elliptic Curve Discrete Logarithm Problem (ECDLP) such as secp256k1, are widely used in Ethereum and threaten by quantum algorithms. This exposes potentially on-chain assets and critical infrastructure to quantum adversaries.&lt;&#x2F;p&gt;
&lt;p&gt;Integrating post-quantum signature schemes is crucial to future-proof Ethereum and other EVM-based environments. It shall be noted that infrastructure for post-quantum signatures should be deployed &lt;em&gt;before&lt;&#x2F;em&gt; quantum adversaries are known to be practical because it takes on the order of years for existing applications to integrate.&lt;&#x2F;p&gt;
&lt;p&gt;Falcon, a lattice-based scheme standardized by NIST, offers high security against both classical and quantum adversaries. Its compact signature size (666 bytes for Falcon-512) and its efficient verification algorithm make it well-suited for blockchain applications, where gas usage and transaction throughput are critical considerations.&lt;&#x2F;p&gt;
&lt;!-- When the public key is also stored together with the signature, it leads to 666 + 896 = 1562 bytes.
Using the recovery mode, it can be reduced to 1292 + 32 = 1324 bytes. --&gt;
&lt;!--
For Falcon,
    σ=666 (40 bytes of salt, ~626 bytes for s2)
    pk = 896,
    TOTAL=1562
For FalconRec,
    σ=1292 (40 bytes of salt, ~626 bytes for s1, ~626 bytes for s2),
    pk = 32,
    TOTAL=1324
--&gt;
&lt;p&gt;In the context of the Ethereum Virtual Machine, a precompile for Keccak256 hash function is already available, making Falcon verification much faster when instantiated with an extendable output function derived from Keccak than with SHAKE256, as specified in NIST submission. This EIP specifies a split of the signature verification into two sub procedures:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;FALCON_HASH_TO_POINT_SHAKE256&lt;&#x2F;code&gt; or &lt;code&gt;FALCON_HASH_TO_POINT_KECCAKPRNG&lt;&#x2F;code&gt;, instantiated with a different extendable Output Function: the first with SHAKE256 (as recommended by NIST), the second with Keccak-PRNG (a version that is more efficient when computed in the EVM). In the future, it is possible to define it for SNARK&#x2F;STARK circuits. An appropriated hash function choice reduces drastically the circuit size and the proving time in the context of ZK applications.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;FALCON_CORE&lt;&#x2F;code&gt;, that does not require any hash computation. This sub-algorithm follows the NIST recommendation so that:
&lt;ul&gt;
&lt;li&gt;using the SHAKE256 &lt;code&gt;FALCON_HASH_TO_POINT_SHAKE256&lt;&#x2F;code&gt;, the signature is fully compliant with the NIST standard,&lt;&#x2F;li&gt;
&lt;li&gt;using the KeccakPRNG &lt;code&gt;FALCON_HASH_TO_POINT_KECCAKPRNG&lt;&#x2F;code&gt;, the verification can be efficient even in the EVM.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Using this separation, two important features are provided: one version being fully compliant with the NIST specification, the other deviating from the standard in order to reduce the gas cost, and opening up to possible computations of Falcon signature ZK proofs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;Falcon can be instantiated with polynomials of degree $512$ or $1024$, leading to a different security level.  Falcon-512 is chosen, leading to a security level equivalent to RSA2048.
This setting leads to the following size for signatures and keys:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Falcon&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;n&lt;&#x2F;strong&gt; (lattice dimension)&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;512&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;q&lt;&#x2F;strong&gt; (modulus)&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;12289&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Padded signature size&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;666&lt;&#x2F;code&gt; bytes&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Public Key size&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;896&lt;&#x2F;code&gt; bytes&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Private key size&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;1281&lt;&#x2F;code&gt; bytes&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;From a high level, a signature verification can be decomposed in two steps:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;strong&gt;challenge computation&lt;&#x2F;strong&gt;, that involves the message and the salt, and computes a challenge polynomial using a XOF (instantiated with SHAKE256 and a Keccak-base PRNG here),&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;strong&gt;core algorithm&lt;&#x2F;strong&gt;, that compute polynomial arithmetic (with the challenge, the public key and the signature), and finally verify the shortness of the full signature $(s_1,s_2)$.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The following pseudo-code highlights how these two algorithms are involved in a Falcon verification, and how the modularity of the challenge computation opens up to two version of Falcon:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; falcon512_verify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;message&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; pubkey&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Verify a Falcon Signature following NIST standard&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Args:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        message (bytes): The message to sign.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        signature (666 bytes): The signature containing 40 bytes of salt and 626 bytes of compressed signature.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        pubkey (bytes): The Falcon public key.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Returns:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        bool: True if the signature is valid, False otherwise.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 1. Compute the Hash To Point Challenge (see 3.1.)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    challenge&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; HASH_TO_POINT&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;message&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 2. Verify Falcon Core Algorithm (see 3.2.)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; FALCON_CORE&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; pubkey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; challenge&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ethfalcon512_verify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;message&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; pubkey&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Verify a Falcon Signature (EVM-friendly mode)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Args:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        message (bytes): The message to sign.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        signature (666 bytes): The signature containing 40 bytes of salt and 626 bytes of compressed signature.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        pubkey (bytes): The Falcon public key.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Returns:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        bool: True if the signature is valid, False otherwise.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 1. Compute the Hash To Point Challenge (see 3.1.)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    challenge&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; ETH_HASH_TO_POINT&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;message&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 2. Verify Falcon Core Algorithm (see 3.2.)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; FALCON_CORE&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; pubkey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; challenge&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The functions &lt;code&gt;falcon512_verify&lt;&#x2F;code&gt; and &lt;code&gt;ethfalcon512_verify&lt;&#x2F;code&gt; call the precompiles specified in the next sections: &lt;code&gt;FALCON_HASH_TO_POINT_SHAKE256&lt;&#x2F;code&gt;, &lt;code&gt;FALCON_HASH_TO_POINT_KECCAKPRNG&lt;&#x2F;code&gt; and &lt;code&gt;FALCON_CORE&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;hash-to-point-challenge-normative&quot;&gt;Hash-to-Point challenge (normative)&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Parse Input Data:&lt;&#x2F;strong&gt; Check the byte sizes and then extract the message and the signature. The parsed signature is a tuple of values $(r, s_2)$. $r$ is denoted as the salt and contains bytes, and $s_2$ is denoted as the signature vector, a vector of elements mod $q$.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Verify Well-formedness:&lt;&#x2F;strong&gt; Verify that the signature contains a 40-byte salt $r$.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;!-- See the `Required Checks in Verification` section for more details. --&gt;
&lt;ol start=&quot;3&quot;&gt;
&lt;li&gt;&lt;strong&gt;Compute the challenge $c$:&lt;&#x2F;strong&gt; the challenge is obtained from hash-to-point on the salt $r$ of the signature and the message. The output $c$ is a polynomial of degree 512, stored in 896 bytes.
The hash-to-point function computes extendable Output from a hash Function (XOF). This EIP provides two instantiations of a XOF:
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;SHAKE256 is the XOF provided in NIST submission, a sponge construction derived from SHA256. Extracting bytes using SHAKE256 calls the &lt;code&gt;Keccak_f&lt;&#x2F;code&gt; permutation:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SHAKE256_init&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    create&lt;&#x2F;span&gt;&lt;span&gt; an&lt;&#x2F;span&gt;&lt;span&gt; empty&lt;&#x2F;span&gt;&lt;span&gt; sponge&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SHAKE256_inject&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    absorb&lt;&#x2F;span&gt;&lt;span&gt; into&lt;&#x2F;span&gt;&lt;span&gt; Keccak&lt;&#x2F;span&gt;&lt;span&gt; sponge&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SHAKE256_flip&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    pad&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; input&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span&gt; finalize&lt;&#x2F;span&gt;&lt;span&gt; sponge&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (&lt;&#x2F;span&gt;&lt;span&gt;no&lt;&#x2F;span&gt;&lt;span&gt; fixed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt; digest&lt;&#x2F;span&gt;&lt;span&gt; yet&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SHAKE256_extract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; length&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    output&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    while&lt;&#x2F;span&gt;&lt;span&gt; output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;size&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; length&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        block&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Keccak_f&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; apply permutation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state_part&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; take r-bit &amp;quot;rate&amp;quot; portion&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; first&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;length&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt; of&lt;&#x2F;span&gt;&lt;span&gt; output&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;While this construction is standardized, it is expensive when computed in the Ethereum Virtual Machine because &lt;code&gt;Keccak_f&lt;&#x2F;code&gt; has no EVM opcode.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Keccak-PRNG is a XOF that is build from a counter-mode PRNG based on Keccak256. Generating new chunks of bytes requires an incrementing counter.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; KeccakPRNG_init&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    create&lt;&#x2F;span&gt;&lt;span&gt; an&lt;&#x2F;span&gt;&lt;span&gt; empty&lt;&#x2F;span&gt;&lt;span&gt; buffer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; KeccakPRNG_inject&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    buffer&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; KeccakPRNG_flip&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;buffer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; fixed 32-byte state&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    counter&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; KeccakPRNG_extract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; length&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    output&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    counter&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    while&lt;&#x2F;span&gt;&lt;span&gt; output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;size&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; length&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        block&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span&gt; counter&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        counter&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; counter&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; first&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;length&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt; of&lt;&#x2F;span&gt;&lt;span&gt; output&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Precompile of &lt;code&gt;Keccak256&lt;&#x2F;code&gt; are available in the Ethereum Virtual Machine, making this XOF very efficient in the EVM.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Using one of the XOFs above (SHAKE256 or Keccak-PRNG), it is possible to instantiate two (precompiles) algorithms for hashing into points:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FALCON_HASH_TO_POINT_SHAKE256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;message&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Compute the Hash To Point Falcon Challenge.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Args:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        message (bytes32): The original message (hash).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        signature (666 bytes): containing:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            - r (40 bytes): The salt.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            - s (626 bytes): The compressed signature vector.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Returns:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        c: The Hash To Point polynomial challenge as a vector.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Constants&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    q&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 12289&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Falcon modulus&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Step 1: Parse Input Data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; s2_compressed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;40&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;40&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Extract salt and compressed signature vector&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Step 2: Verify Well-formedness&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; is_valid_signature_format&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;s2_compressed&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; pubkey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Step 3: Compute the challenge vector HashToPoint(r || message)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    SHAKE256_init&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    SHAKE256_inject&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;message&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    while&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; n&lt;&#x2F;span&gt;&lt;span&gt; do&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; SHAKE256_extract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 61445&lt;&#x2F;span&gt;&lt;span&gt; then&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            c_i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; t&lt;&#x2F;span&gt;&lt;span&gt; mod&lt;&#x2F;span&gt;&lt;span&gt; q&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FALCON_HASH_TO_POINT_KECCAKPRNG&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;message&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Compute the Hash To Point Falcon Challenge using Keccak-PRNG.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Args:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        message (bytes32): The original message (hash).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        signature (666 bytes): containing:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            - r (40 bytes): The salt.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            - s (626 bytes): The compressed signature vector.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Returns:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        c: The Hash To Point polynomial challenge as a vector.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Constants&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    q&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 12289&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Falcon modulus&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Step 1: Parse Input Data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; s2_compressed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;40&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;40&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Extract salt and compressed signature vector&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Step 2: Verify Well-formedness&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; is_valid_signature_format&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;s2_compressed&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; pubkey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Step 3: Compute the challenge vector HashToPoint(r || message)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    KeccakPRNG_init&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    KeccakPRNG_inject&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;message&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    while&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; n&lt;&#x2F;span&gt;&lt;span&gt; do&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; KeccakPRNG_extract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 61445&lt;&#x2F;span&gt;&lt;span&gt; then&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            c_i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; t&lt;&#x2F;span&gt;&lt;span&gt; mod&lt;&#x2F;span&gt;&lt;span&gt; q&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;encoding-of-the-challenge-polynomial-c-896-bytes-normative&quot;&gt;Encoding of the challenge polynomial &lt;code&gt;c&lt;&#x2F;code&gt; (896 bytes, normative)&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Domain: degree-512 polynomial with coefficients in &lt;code&gt;[0, q)&lt;&#x2F;code&gt;, &lt;code&gt;q = 12289&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Order: coefficients are serialized in index order &lt;code&gt;c[0], c[1], …, c[511]&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Bit-packing: each coefficient is a 14-bit &lt;strong&gt;big-endian&lt;&#x2F;strong&gt; unsigned integer. Concatenate all 512 encodings into a bitstring of exactly &lt;strong&gt;896 bytes&lt;&#x2F;strong&gt;. Consumers MUST reject encodings that are not exactly 896 bytes.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;core-algorithm&quot;&gt;Core algorithm&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Parse Input Data:&lt;&#x2F;strong&gt; Check the byte sizes and then extract the public key, the Hash To Point Challenge and the signature.
&lt;ul&gt;
&lt;li&gt;The parsed public key  $h$, interpreted as a vector of elements mod $q$,&lt;&#x2F;li&gt;
&lt;li&gt;The parsed signature  $(r, s_2)$. $r$ is denoted as the salt and $s_2$ is denoted as the signature vector, made of elements mod $q$.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Verify Well-formedness:&lt;&#x2F;strong&gt; Verify that the signature, Hash To Point Challenge and public key have the correct number of elements and is canonical.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;!-- See the `Required Checks in Verification` section for more details. --&gt;
&lt;ol start=&quot;3&quot;&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Compute $s_1$ from $s_2$ and $h$.&lt;&#x2F;strong&gt; $s_1 = c - h * s_2$ where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;$c$ is the Hash To Point challenge,&lt;&#x2F;li&gt;
&lt;li&gt;$h$ is the public key, represented in the ntt domain&lt;&#x2F;li&gt;
&lt;li&gt;$s_2$ is the signature vector.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;blockquote&gt;
&lt;p&gt;Note: since $h$ and $s_2$ are polynomials, the operation $*$ is the polynomial multiplication and can be sped up using the Number Theoretic Transform (NTT).&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Check $L^2$ norm Bound:&lt;&#x2F;strong&gt; Verify that the signature is &lt;em&gt;short&lt;&#x2F;em&gt; by checking the following equation:
$$ ||(s_1, s_2) ||_2^2 &amp;lt; \lfloor\beta^2\rfloor$$
where $\beta^2$ is the acceptance bound. For Falcon-512, it is $\lfloor\beta^2\rfloor = 34034726$.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The following code illustrates Falcon core algorithm:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FALCON_CORE&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; h&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; challenge&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Verify Falcon Core Algorithm&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Args:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        - signature (666 bytes): containing:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            - r (40 bytes): The salt.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            - s (626 bytes): The compressed signature vector.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        - h (bytes): The Falcon public key in the ntt domain, computed as h=ntt(pubkey) externally.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        - challenge (bytes): The Falcon Hash To Point Challenge.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Returns:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        bool: True if the signature is valid, False otherwise.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Constants&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    q&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 12289&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Falcon modulus&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ACCEPTANCE_BOUND&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 34034726&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Falcon-512 acceptance bound&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Step 1: Parse Input Data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; s2_compressed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;40&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;40&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Extract salt and compressed signature vector&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Step 2: Verify Well-formedness&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; is_valid_signature_format&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;s2_compressed&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; pubkey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Step 3: Decompress Signature Vector&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    s2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; decompress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;s2_compressed&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Convert compressed signature to full form&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; s2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Reject invalid encodings &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Step 4: Convert to Evaluation domain (NTT)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    s2_ntt&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; ntt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;s2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Step 5: Compute the Verification Equation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    tmp_ntt&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; hadamard_product&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;s2_ntt&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; h&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Element-wise product&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    tmp&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; intt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tmp_ntt&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Convert back to coefficient form (INTT)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    s1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; challenge&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; tmp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Step 6: Normalize s1 coefficients to be in the range [-q&#x2F;2, q&#x2F;2]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    s1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; normalize_coefficients&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;s1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; q&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Step 7: Compute Norm Bound Check&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    s1_squared&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; square_each_element&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;s1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    s2_squared&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; square_each_element&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;s2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    total_norm&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; sum&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;s1_squared&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; sum&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;s2_squared&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Step 8: Compare with Acceptance Bound&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; To ensure signature is short&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; total_norm&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ACCEPTANCE_BOUND&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Falcon-512: β² = 34,034,726&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;required-checks-in-falcon-verification&quot;&gt;Required Checks in Falcon Verification&lt;&#x2F;h3&gt;
&lt;p&gt;The following requirements MUST be checked by the precompiled contract to verify signature components are valid:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Raw Input data&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Verify that the message is 32-bytes long,&lt;&#x2F;li&gt;
&lt;li&gt;Verify that the public key is 896-bytes long,&lt;&#x2F;li&gt;
&lt;li&gt;Verify that the signature is 666-bytes long.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Parsed Input data&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Verify that the public key consists of 512 elements, where each element is between $[0, q-1]$,&lt;&#x2F;li&gt;
&lt;li&gt;Verify that the signature vector in the signature consists of 512 elements, where each element is between $[0, q-1]$,&lt;&#x2F;li&gt;
&lt;li&gt;Verify that the salt in the signature is 40-bytes long.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Gas burning on error&lt;&#x2F;strong&gt;
if one of the above condition is not met then all the gas supplied along with a CALL or STATICCALL is burned.
it shall also be burned if an error happens during decompression (incorrect encodings).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;precompiled-contract-specification&quot;&gt;Precompiled Contract Specification&lt;&#x2F;h3&gt;
&lt;p&gt;The precompiled contracts are proposed with the following input and outputs, which are big-endian values:&lt;&#x2F;p&gt;
&lt;h4 id=&quot;falcon-hash-to-point-shake256&quot;&gt;&lt;code&gt;FALCON_HASH_TO_POINT_SHAKE256&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;Input&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;32 bytes: message hash &lt;code&gt;m&lt;&#x2F;code&gt;,&lt;&#x2F;li&gt;
&lt;li&gt;666 bytes: salt &lt;code&gt;r&lt;&#x2F;code&gt; (40 bytes), Falcon-512 compressed signature &lt;code&gt;s2_compressed&lt;&#x2F;code&gt; (626 bytes) concatenated: &lt;code&gt;r || s2_compressed&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Output&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;896 bytes: packed challenge polynomial &lt;code&gt;c&lt;&#x2F;code&gt; (see §3.1 encoding)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;falcon-hash-to-point-keccakprng&quot;&gt;&lt;code&gt;FALCON_HASH_TO_POINT_KECCAKPRNG&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Same I&#x2F;O as §4.1, but the XOF is Keccak-PRNG. The construction is normative and MUST define: state initialization, domain-separation (if any), counter width and endianness, and block concatenation order.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;falcon-core&quot;&gt;&lt;code&gt;FALCON_CORE&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Input data&lt;&#x2F;strong&gt;
&lt;ul&gt;
&lt;li&gt;666 bytes for Falcon-512 signature&lt;&#x2F;li&gt;
&lt;li&gt;896 bytes for Falcon-512 public key&lt;&#x2F;li&gt;
&lt;li&gt;896 bytes for the Hash To Point Challenge&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Output data&lt;&#x2F;strong&gt;:
&lt;ul&gt;
&lt;li&gt;If the core algorithm process succeeds, it returns 1 in 32 bytes format.&lt;&#x2F;li&gt;
&lt;li&gt;If the core algorithm process fails, it does not return any output data.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;error-cases&quot;&gt;Error Cases&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Invalid input length (not compliant to described input)&lt;&#x2F;li&gt;
&lt;li&gt;Invalid field element encoding (≥ q)&lt;&#x2F;li&gt;
&lt;li&gt;Invalid signature decompression&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note that a well-formed but invalid signature does not produce an error, but &lt;code&gt;FALCON_CORE&lt;&#x2F;code&gt; invalidates the signature (and it does not return any output data).&lt;&#x2F;p&gt;
&lt;h4 id=&quot;precompiled-contract-gas-usage&quot;&gt;Precompiled Contract Gas Usage&lt;&#x2F;h4&gt;
&lt;p&gt;The cost of the &lt;strong&gt;FALCON_HASH_TO_POINT_SHAKE256&lt;&#x2F;strong&gt; and &lt;strong&gt;FALCON_HASH_TO_POINT_KECCAKPRNG&lt;&#x2F;strong&gt; is set to 1000 gas.&lt;&#x2F;p&gt;
&lt;p&gt;The cost of &lt;strong&gt;FALCON_CORE&lt;&#x2F;strong&gt; is set to 2000 gas.&lt;&#x2F;p&gt;
&lt;p&gt;Thus, the total cost of the signature is 3000 gas.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The Falcon signature scheme was selected as a NIST-standardized post-quantum cryptographic algorithm due to its strong security guarantees and efficiency.&lt;&#x2F;p&gt;
&lt;p&gt;Falcon is a signature algorithm build from lattice-based cryptography. Specifically, its hardness relies on the Short Integer Solution (SIS) problem over NTRU lattices, which is believed to be hard for both classical and quantum computers.&lt;&#x2F;p&gt;
&lt;p&gt;Falcon offers several advantages over traditional cryptographic signatures such as secp256k1 and secp256r1:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Efficiency&lt;&#x2F;strong&gt;: Falcon is highly optimized for constrained environments, offering small signature sizes (666 bytes for Falcon-512) and fast verification time. This makes it well-suited for Ethereum, where gas costs and computational efficiency are critical factors.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;NIST Standardization&lt;&#x2F;strong&gt;: Falcon was selected as part of NIST Post-Quantum Cryptography Standardization process, ensuring that it meets rigorous security and performance criteria.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Enabling Future-Proof Smart Contracts&lt;&#x2F;strong&gt;: With the integration of Falcon, Ethereum roll-ups and smart contract applications can start adopting quantum-secure schemes that remain secure even when we have quantum computers.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Compatibility with Existing EVM Designs&lt;&#x2F;strong&gt;: While Falcon operates on fundamentally different cryptographic assumptions than elliptic curves, its verification process can be efficiently implemented as a precompiled contract with similar APIs to classical signature schemes like secp256r1.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Given the increasing urgency of transitioning to quantum-resistant cryptographic primitives or even having them ready in the event that research into quantum computers speeds up.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-cost-explanations&quot;&gt;Gas cost explanations&lt;&#x2F;h3&gt;
&lt;p&gt;The cost of the &lt;strong&gt;HASH_TO_POINT&lt;&#x2F;strong&gt; and &lt;strong&gt;HASH_TO_POINT_ETH&lt;&#x2F;strong&gt; functions is dominated by the call to the underlying hash function. It represents in average 35 calls to the hash function. Taking linearly the cost of keccak256, and avoiding the context switching it represents 1000 gas.&lt;&#x2F;p&gt;
&lt;p&gt;The cost of &lt;strong&gt;FALCON_CORE&lt;&#x2F;strong&gt; function is dominated by performing 2 NTTs and 1 inverse NTT. One of these NTTs is for the public key and can be precomputed so that the contract requires to perform only 1 NTT and 1 inverse NTT. An estimation of the cost is given by 2000 gas.&lt;&#x2F;p&gt;
&lt;p&gt;The cost is interpolated using rule of thumb from SUPERCOPS signatures benchmark results.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;In compliance with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7932&#x2F;&quot;&gt;EIP-7932&lt;&#x2F;a&gt;,  the necessary parameters and structure for its integration are provided. &lt;code&gt;ALG_TYPE = 0xFA&lt;&#x2F;code&gt;  uniquely identifies Falcon-512 transactions, set MAX_SIZE = 667 bytes to accommodate the fixed-length signature_info container (comprising a 1-byte version tag and a 666-byte Falcon signature), and recommend a &lt;code&gt;GAS_PENALTY&lt;&#x2F;code&gt; of approximately &lt;code&gt;3000&lt;&#x2F;code&gt; gas subject to benchmarking. The verification function follows the EIP-7932 model, parsing the signature_info, recovering the corresponding Falcon public key, verifying the signature against the transaction payload hash, and deriving the signer&#x27;s Ethereum address as the last 20 bytes of keccak256(pubkey). This definition ensures that Falcon-512 can be cleanly adopted within the &lt;code&gt;AlgorithmicTransaction&lt;&#x2F;code&gt; container specified by EIP-7932.&lt;&#x2F;p&gt;
&lt;p&gt;As per &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7932&#x2F;&quot;&gt;EIP-7932&lt;&#x2F;a&gt;, this EIP defines two Falcon algorithm types:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ALG_TYPE = 0xFA&lt;&#x2F;code&gt; — Falcon-512 with SHAKE256 H2P&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ALG_TYPE = 0xFB&lt;&#x2F;code&gt; — Falcon-512 with Keccak-PRNG H2P&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Container and sizes.&lt;&#x2F;strong&gt; The &lt;code&gt;signature_info&lt;&#x2F;code&gt; container omits any pubkey hash; the public key is recovered by &lt;code&gt;verify(...)&lt;&#x2F;code&gt; and the 7932 sig-recover precompile derives the address as &lt;code&gt;keccak(ALG_TYPE || pubkey)[12:]&lt;&#x2F;code&gt;. Therefore:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;MAX_SIZE = 667&lt;&#x2F;code&gt; bytes (1-byte &lt;code&gt;ALG_TYPE&lt;&#x2F;code&gt; + 666-byte Falcon compressed signature).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;signature_info&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Container&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0xFA Falcon-512 (SHAKE H2P), 0xFB Falcon-512 (Keccak H2P)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    version&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint8&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Falcon-512 signature (compressed). If an implementation produces a shorter form, it MUST be left-padded to 666 bytes.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ByteVector&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;666&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In the format of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7932&#x2F;&quot;&gt;EIP-7932&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;For the NIST-compliant version:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;verify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature_info&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; payload_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature_info&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 699&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    version&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;      =&lt;&#x2F;span&gt;&lt;span&gt; signature_info&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;    =&lt;&#x2F;span&gt;&lt;span&gt; signature_info&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;667&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; version&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;FA&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; lookup_pubkey&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;pubkey_hash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; falcon512_verify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;pubkey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; payload_hash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;pubkey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;12&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;For the EVM-friendly version:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;verify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature_info&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; payload_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature_info&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 699&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    version&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;      =&lt;&#x2F;span&gt;&lt;span&gt; signature_info&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;    =&lt;&#x2F;span&gt;&lt;span&gt; signature_info&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;667&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; version&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;FB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; lookup_pubkey&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;pubkey_hash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; ethfalcon512_verify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;pubkey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; payload_hash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;pubkey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;12&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;addresses&quot;&gt;Addresses&lt;&#x2F;h3&gt;
&lt;!-- TODO: backward compatibility --&gt;
&lt;p&gt;&lt;strong&gt;TBD by ACD.&lt;&#x2F;strong&gt; Final precompile addresses will be selected within the EIP-managed range of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1352&#x2F;&quot;&gt;EIP-1352&lt;&#x2F;a&gt;, explicitly &lt;strong&gt;avoiding &lt;code&gt;0x0100–0x01FF&lt;&#x2F;code&gt; reserved for RIPs&lt;&#x2F;strong&gt; by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7587&#x2F;&quot;&gt;EIP-7587&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;A set of test vectors for verifying implementations is located in a separate file (to be provided for each opcode). For the NIST compliant version, KATs are reproduced for HashToPoint (with a provided salt &lt;code&gt;r&lt;&#x2F;code&gt;) as well as for the compressed signature vector s2 (with a provided &lt;code&gt;HashToPoint&lt;&#x2F;code&gt; input). Note that &lt;code&gt;s2&lt;&#x2F;code&gt; is not padded with zeroes, leading to a maximum size of 626 bytes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;An implementation is provided by the NIST. An implementation of the EVM-friendly version ETHFALCON is provided by ZKNOX.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;TODO: We can modify geth to include falcon-512 as a reference. (Similar to secp256r1 signature verification)&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The derivation path to obtain the private key from the seed is (tbd). Hash-to-Point functions MUST follow the specified XOFs byte-for-byte; domain separation and padding are normative.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Milli-gas for High-precision Gas Metering</title>
        <published>2025-10-17T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Maria Silva</name><uri>https://github.com/misilva73</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8053/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8053-milli-gas-counter-for-high-precision-gas-metering/25946" />
        

        <id>https://wg-eips.ritovision.com/8053/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:8053"
            label="EIP-8053" />
        

        
        

        
        <summary type="html">Adds `milli-gas` as the EVM’s internal gas accounting unit, reducing rounding errors without impacting UX</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8053/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal introduces the &lt;code&gt;milli-gas&lt;&#x2F;code&gt; counter as the EVM&#x27;s internal gas accounting. Gas costs are defined in &lt;code&gt;milli_gas&lt;&#x2F;code&gt; and internal EVM gas accounting is entirely carried out in &lt;code&gt;milli_gas&lt;&#x2F;code&gt;. At the end of transaction execution, &lt;code&gt;milli_gas&lt;&#x2F;code&gt; is rounded up to &lt;code&gt;gas&lt;&#x2F;code&gt;. Gas limits and transaction fees are still computed and verified using the current &lt;code&gt;gas_used&lt;&#x2F;code&gt; counter. This new counter enables a more precise accounting of cheap compute without impacting UX.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, most EVM compute operations (&lt;code&gt;ADD&lt;&#x2F;code&gt;, &lt;code&gt;SUB&lt;&#x2F;code&gt;, &lt;code&gt;MUL&lt;&#x2F;code&gt;, etc.) are significantly underpriced when compared with state operations (&lt;code&gt;SSTORE&lt;&#x2F;code&gt;, &lt;code&gt;SLOAD&lt;&#x2F;code&gt;, &lt;code&gt;CREATE&lt;&#x2F;code&gt;, etc.). There are two factors contributing to this mismatch. On one hand, client optimizations and hardware improvements have made pure compute operations more efficient. On the other hand, with the growing size of the Ethereum state, the performance of I&#x2F;O operations touching this larger state has been deteriorating. Both of these trends are expected to continue, further worsening this mismatch.&lt;&#x2F;p&gt;
&lt;p&gt;There are a couple of proposals to reduce the cost of compute operations (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7904&#x2F;&quot;&gt;EIP-7904&lt;&#x2F;a&gt;) and increase the cost of state operations (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8032&#x2F;&quot;&gt;EIP-8032&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8037&#x2F;&quot;&gt;EIP-8037&lt;&#x2F;a&gt;, and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8038&#x2F;&quot;&gt;EIP-8038&lt;&#x2F;a&gt;). However, given the current level of mismatch between these operations, there is an inherent trade-off in the anchor we use to reprice these operations.&lt;&#x2F;p&gt;
&lt;p&gt;If we make compute operations cheaper, we will introduce rounding errors, with most compute operations costing 1, when they should cost a fraction of that. These rounding errors impact scalability because we can now fit fewer of these cheaper operations in any given block. However, if we price all operations so that the fastest opcode is assigned 1 gas, we would need to make all other operations significantly more expensive, including both compute and state operations. Making everything more expensive would require a rebase on the concept of gas units to users, thus impacting UX.&lt;&#x2F;p&gt;
&lt;p&gt;To illustrate this point, let&#x27;s focus on the pure compute operations. As compute operations impact only block execution time, the chosen anchor will induce a specific million gas per second rate on all compute opcodes. For instance, if we anchor on &lt;code&gt;EcRecover&lt;&#x2F;code&gt; at the current price (3000 gas units), this induces a rate of 175Mgas&#x2F;s, based on the execution time estimated for this opcode on &lt;a href=&quot;..&#x2F;07904&#x2F;assets&#x2F;gas-cost-estimator-report.pdf&quot;&gt;EIP-7904&#x27;s empirical analysis&lt;&#x2F;a&gt;. The following plot shows the average rounding errors of compute operations for different anchors, using the same execution time estimates from EIP-7904.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8053&#x2F;.&#x2F;assets&#x2F;round_error_by_anchor.png&quot; alt=&quot;round_error_by_anchor&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;As we can see, with an anchor of 50Mgas&#x2F;s (which would result in a gas limit of 100Mgas, assuming a 2-second block execution limit), we would get an average rounding error of 59.3%. This means that we could be 59.3% cheaper on average per opcode if we didn&#x27;t have to round to integer gas units. Only after a 400Mgas&#x2F;s anchor do we get to reasonably low rounding errors. However, this level of Mgas&#x2F;s would require a major rebase of the gas model, where all opcodes become significantly more expensive, and both the transaction-level and block-level gas limits increase by a factor of 100.&lt;&#x2F;p&gt;
&lt;p&gt;The way around this trade-off is to allow cheap opcodes to have fractional gas costs, thus avoiding both the scalability limits introduced by rounding errors and the significant UX change of increasing gas costs and limits 100x.&lt;&#x2F;p&gt;
&lt;p&gt;A similar argument was made in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2045&#x2F;&quot;&gt;EIP-2045&lt;&#x2F;a&gt;, which served as inspiration to this proposal.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal introduces a new &lt;code&gt;Uint&lt;&#x2F;code&gt; counter to the EVM, &lt;code&gt;milli_gas_left&lt;&#x2F;code&gt;. Gas costs are defined in &lt;code&gt;milli_gas&lt;&#x2F;code&gt; and internal EVM gas accounting is entirely carried out in &lt;code&gt;milli_gas&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Transaction fees, transaction gas limits, and block gas limits are still computed and verified using the current &lt;code&gt;gas_used&lt;&#x2F;code&gt; counter. There are no changes to blob gas accounting, refunds, or call data gas accounting.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;evm-environment&quot;&gt;EVM environment&lt;&#x2F;h3&gt;
&lt;p&gt;The current &lt;code&gt;gas_left&lt;&#x2F;code&gt; variable from the internal state of the EVM is replaced by &lt;code&gt;milli_gas_left&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;dataclass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Evm&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The internal state of the virtual machine.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    pc&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    stack&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;U256&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    memory&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytearray&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    code&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    milli_gas_left&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    valid_jump_destinations&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Set&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Uint&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    logs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Tuple&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Log&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ...&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    refund_counter&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    running&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    message&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Message&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    output&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    accounts_to_delete&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Set&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Address&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return_data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    error&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Optional&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;EthereumException&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    accessed_addresses&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Set&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Address&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    accessed_storage_keys&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Set&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Tuple&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Bytes32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;All references to &lt;code&gt;evm.gas_left&lt;&#x2F;code&gt; are replaced by &lt;code&gt;evm.milli_gas_left&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;end-of-transaction-conversion&quot;&gt;End-of-transaction conversion&lt;&#x2F;h3&gt;
&lt;p&gt;At the end of each transaction execution, the gas left in the transaction output is updated to&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tx_output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_left&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; ceil&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;milli_gas_left&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;At the same time, after the transaction is executed, &lt;code&gt;evm.milli_gas_used&lt;&#x2F;code&gt; is rounded up to &lt;code&gt;evm.gas_used = ceil(evm.milli_gas_used &#x2F; 1000)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;opcode-costs&quot;&gt;Opcode costs&lt;&#x2F;h3&gt;
&lt;p&gt;Opcode gas parameters as defined in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;execution-specs&#x2F;blob&#x2F;abd7612d2f4d6fcd9f628330f38884b300f0d89f&#x2F;src&#x2F;ethereum&#x2F;forks&#x2F;osaka&#x2F;vm&#x2F;gas.py&quot;&gt;Ethereum Execution Client Specifications&lt;&#x2F;a&gt; that are not updated at the same time or after the introduction of this proposal, are increased by 1000x:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;GAS_PARAM = GAS_PARAM * 1000&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-opcode&quot;&gt;&lt;code&gt;GAS&lt;&#x2F;code&gt; opcode&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;GAS&lt;&#x2F;code&gt; opcode reports the available gas in &lt;code&gt;milli-gas&lt;&#x2F;code&gt; units.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;call-opcodes&quot;&gt;&lt;code&gt;*CALL&lt;&#x2F;code&gt; opcodes&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;*CALL&lt;&#x2F;code&gt; opcodes receive the amount of gas to send to the sub context to execute in &lt;code&gt;gas&lt;&#x2F;code&gt;. &lt;code&gt;gas&lt;&#x2F;code&gt; is converted to &lt;code&gt;milli-gas&lt;&#x2F;code&gt; at the start of the call&#x27;s execution:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; STACK&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;pop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;stack&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;new-counter-vs-new-variable-type&quot;&gt;New counter vs. new variable type&lt;&#x2F;h3&gt;
&lt;p&gt;A possible approach to allow for fractional gas would be to change the variable type of all gas-related variables from an integer to a float or a base fractional. Although simple in concept, the implementation of such a change in the EVM is not trivial. In addition, introducing fractional variables would make moving to a zkEVM significantly more complex.&lt;&#x2F;p&gt;
&lt;p&gt;Thus, introducing a new counter is the option that least disrupts the current EVM implementation, while allowing for expressive gas costs.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;rounding-at-transaction-level&quot;&gt;Rounding at transaction-level&lt;&#x2F;h3&gt;
&lt;p&gt;With the introduction of a new counter, there are two levels at which we could convert &lt;code&gt;milli_gas&lt;&#x2F;code&gt; to &lt;code&gt;gas&lt;&#x2F;code&gt;: at the transaction level or the block level. Conversion at the block level results in the fewest rounding errors in block utilization. However, it requires a bigger change to implement, as &lt;code&gt;milli_gas&lt;&#x2F;code&gt; will need to be used when computing transaction fees and limits, and &lt;code&gt;milli_gas&lt;&#x2F;code&gt; will need to be incorporated in the block environment.&lt;&#x2F;p&gt;
&lt;p&gt;The question is whether a conversion at the transaction level is sufficient to reduce rounding errors. To estimate this, we extracted the opcode counts per transaction for 1000 mainnet blocks and computed the new gas prices of all compute operations assuming an anchor of 50Mgas&#x2F;s and the estimated execution times from &lt;a href=&quot;..&#x2F;07904&#x2F;assets&#x2F;gas-cost-estimator-report.pdf&quot;&gt;EIP-7904&#x27;s empirical analysis&lt;&#x2F;a&gt;. With this repricing, the fastest opcode (&lt;code&gt;JUMPDEST&lt;&#x2F;code&gt;) would be priced at 90 milli-gas units (i.e., 0.09 gas units). We also assumed that the non-compute operations and precompiles would have the same price, and we excluded any other transaction costs, such as intrinsic costs and calldata.&lt;&#x2F;p&gt;
&lt;p&gt;Then, we computed the rounding error of each transaction, assuming a conversion at both the transaction and opcode levels. The opcode-level conversion is equivalent to not using fractional gas and rounding all opcodes to an integer. The following plot shows the distribution for both errors. The x-axis is on a logarithmic scale.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8053&#x2F;.&#x2F;assets&#x2F;round_err_tx.png&quot; alt=&quot;round_error_by_anchor&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;In this sample of 1000 blocks, a transaction-level conversion has already successfully reduced the rounding errors from an average of 4% to 0.05% per transaction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This is a backwards incompatible gas repricing that requires a scheduled network upgrade.&lt;&#x2F;p&gt;
&lt;p&gt;Deployed bytecode that compares &lt;code&gt;gas_left&lt;&#x2F;code&gt; to constants or that uses explicit gas-limited calls will suddenly forward 1000× less gas, causing unexpected reverts or logic flip. Further analysis on how widespread this behavior is required.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;&amp;lt;-- TODO --&amp;gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Increase exit and consolidation churn</title>
        <published>2025-10-17T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Francesco D&#x27;Amato</name><uri>https://github.com/fradamt</uri>
	</author>
	
	<author>
		<name>Anders Elowsson</name><uri>https://github.com/anderselowsson</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8061/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8061-increase-churn-limits/25991" />
        

        <id>https://wg-eips.ritovision.com/8061/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:8061"
            label="EIP-8061" />
        

        
        

        
        <summary type="html">Increase the exit and consolidation churn and create a separate consolidation churn limit parameter.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8061/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP roughly doubles the consolidation churn, as well as quadrupling the exit churn and restoring its proportionality to total stake (though maintaining the existing cap on activations). The choice of parameters balances maintaining a sufficiently long weak subjectivity period (~7 days, roughly halving the current period) with achieving two goals: allowing for faster consolidation of the validator set, in turn accelerating the timeline to faster finality, and relieving exit queue congestion, improving staking liquidity.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7514&#x2F;&quot;&gt;EIP-7514&lt;&#x2F;a&gt; introduced an activation cap of 8 validators per epoch (now 256 ETH per epoch) to prevent overly rapid validator set growth. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7251&#x2F;&quot;&gt;EIP-7251&lt;&#x2F;a&gt; extended this cap to exits, to make room for the newly introduced consolidation operations, without increasing the weak subjectivity period. However, the fixed cap prevents the exit churn limit from being proportional to total stake, which, all else being equal, leads to longer queues as stake grows. Moreover, the
&lt;code&gt;CHURN_LIMIT_QUOTIENT&lt;&#x2F;code&gt; is set quite conservatively in the first place, requiring more than 3 months for 1&#x2F;3 of the validator set to exit, a time which is now be more than doubled due to the cap. Recent episodes have stressed for more headroom to improve liquidity and staking user experience, as the exit queue has stretched beyond forty days as a consequence of the mass exit of Kiln validators. Long queues degrade user experience, and slow operator response to market or operational events. They also reduce the network’s ability to reconfigure stake more quickly after adverse events, for example to regain finality by having a large amount of stake exit (a double-edged sword, as preventing double finality is the reason these queues exist in the first place, as discussed in the security section). Finally, centralized forms of staking are those that (in relative terms) benefit the most from a lack of liquidity today, as they have the ability to issue a liquid staking token, maintain liquidity reserves or more generally build products that get around the limitations of the protocol.&lt;&#x2F;p&gt;
&lt;p&gt;The conservative setting of the &lt;code&gt;CHURN_LIMIT_QUOTIENT&lt;&#x2F;code&gt; affects consolidations as well. Increasing the consolidation churn limit can shorten the path to a smaller validator set and, in turn, the path to a protocol with much faster finality. Under today’s parameters, even the best-case timelines are long: using only activations and exits, fully saturated around the clock, shrinking the roughly 32M ETH of 0x01 stake would take on the order of ~1.5 years; a fully saturated consolidation queue would still take ~1.3 years. Moreover, deposit capacity is also needed for new stake and is thus far from guaranteed to be available for consolidations, as evidenced by the recent inflow of &amp;gt; 1M ETH, fully occupying the queue for ~20 days.&lt;&#x2F;p&gt;
&lt;p&gt;The EIP proposes to address these issues by:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;removing the cap on exits, restoring the proportionality of exit churn limit to total stake&lt;&#x2F;li&gt;
&lt;li&gt;increasing the churn limit on exits&lt;&#x2F;li&gt;
&lt;li&gt;introducing a separate consolidation churn limit, since there is no more &quot;excess churn&quot; from having an exit cap, and increase it compared to the current (implicitly defined) one. This also lets us more independently adjust it in the future, for example to increase it if we want to allow for faster consolidation of the validator set or decrease it when this process has already run its course.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The EIP does &lt;em&gt;not&lt;&#x2F;em&gt; propose to lift the cap on the deposit churn, as part of the motivation for introducing it in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7514&#x2F;&quot;&gt;EIP-7514&lt;&#x2F;a&gt; still holds today: though &lt;em&gt;active validator set&lt;&#x2F;em&gt; growth is mostly solved by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7251&#x2F;&quot;&gt;EIP-7251&lt;&#x2F;a&gt;, the &lt;em&gt;validator array in the BeaconState&lt;&#x2F;em&gt; (including inactive validators) is very large and still growing, and too rapid &lt;em&gt;stake&lt;&#x2F;em&gt; growth continues to be a concern as well.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;CHURN_LIMIT_QUOTIENT&lt;&#x2F;code&gt; is halved, from &lt;code&gt;2**16&lt;&#x2F;code&gt; to &lt;code&gt;2**15&lt;&#x2F;code&gt;, and fully dedicated to activations and exits. However, the cap on activations introduced in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7514&#x2F;&quot;&gt;EIP-7514&lt;&#x2F;a&gt; is maintained via &lt;code&gt;MAX_PER_EPOCH_ACTIVATION_CHURN_LIMIT&lt;&#x2F;code&gt;, while exits are freed from this cap. Consolidations now have their own dedicated churn, determined by &lt;code&gt;CONSOLIDATION_CHURN_LIMIT_QUOTIENT&lt;&#x2F;code&gt;. This is set here to &lt;code&gt;2**16&lt;&#x2F;code&gt;, so that consolidations are allocated half as much churn as activations and exits combined, and a third of the total churn. Finally, &lt;code&gt;compute_weak_subjectivity_period&lt;&#x2F;code&gt; is adjusted to account for the asymmetry between exit and activation churn: a unit of exit churn has twice the weak subjectivity effect ($\frac{4}{3}$) of a unit of activation churn $\frac{2}{3}$, and a unit of consolidation churn has an effect equivalent to the sum of the other two ($2$).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;configuration&quot;&gt;Configuration&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;MAX_PER_EPOCH_ACTIVATION_CHURN_LIMIT&lt;&#x2F;code&gt; replaces the existing &lt;code&gt;MAX_PER_EPOCH_ACTIVATION_EXIT_CHURN_LIMIT&lt;&#x2F;code&gt;, also &lt;code&gt;256&lt;&#x2F;code&gt;, as the cap now only applies to activations. We introduce the new &lt;code&gt;CONSOLIDATION_CHURN_LIMIT_QUOTIENT&lt;&#x2F;code&gt; and update the &lt;code&gt;CHURN_LIMIT_QUOTIENT&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CHURN_LIMIT_QUOTIENT_GLOAS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint64(2**15)&lt;&#x2F;code&gt; (= 32,768)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CONSOLIDATION_CHURN_LIMIT_QUOTIENT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint64(2**16)&lt;&#x2F;code&gt; (= 65,536)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_PER_EPOCH_ACTIVATION_CHURN_LIMIT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint64(2**8)&lt;&#x2F;code&gt;  (=256)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;churn-computations&quot;&gt;Churn computations&lt;&#x2F;h3&gt;
&lt;p&gt;Due to the intended asymmetry in activation and exit churn, we replace &lt;code&gt;get_activation_exit_churn_limit&lt;&#x2F;code&gt; with &lt;code&gt;get_activation_churn_limit&lt;&#x2F;code&gt;, capped at  &lt;code&gt;MAX_PER_EPOCH_ACTIVATION_CHURN_LIMIT&lt;&#x2F;code&gt;, and &lt;code&gt;get_exit_churn_limit&lt;&#x2F;code&gt;, uncapped. &lt;code&gt;get_consolidation_churn_limit&lt;&#x2F;code&gt; uses the new &lt;code&gt;CONSOLIDATION_CHURN_LIMIT_QUOTIENT&lt;&#x2F;code&gt;, without either a minimum or a maximum value.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_activation_churn_limit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Gwei&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Per-epoch churn limit for activations, rounded to EFFECTIVE_BALANCE_INCREMENT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    churn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        MIN_PER_EPOCH_CHURN_LIMIT_ELECTRA&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        get_total_active_balance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CHURN_LIMIT_QUOTIENT_GLOAS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    churn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; churn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; churn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EFFECTIVE_BALANCE_INCREMENT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;MAX_PER_EPOCH_ACTIVATION_CHURN_LIMIT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; churn&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_exit_churn_limit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Gwei&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Per-epoch churn limit for activations, rounded to EFFECTIVE_BALANCE_INCREMENT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    churn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        MIN_PER_EPOCH_CHURN_LIMIT_ELECTRA&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        get_total_active_balance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CHURN_LIMIT_QUOTIENT_GLOAS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; churn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; churn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EFFECTIVE_BALANCE_INCREMENT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_consolidation_churn_limit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Gwei&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Per-epoch churn limit for consolidations (EIP-7521), rounded to EFFECTIVE_BALANCE_INCREMENT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    churn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_total_active_balance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CONSOLIDATION_CHURN_LIMIT_QUOTIENT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; churn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; churn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EFFECTIVE_BALANCE_INCREMENT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In &lt;code&gt;compute_weak_subjectivity_period&lt;&#x2F;code&gt; we only replace &lt;code&gt;delta = get_balance_churn_limit(state)&lt;&#x2F;code&gt; with an explicit calculation taking into account the different weak subjectivity effect of each type of operation.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; compute_weak_subjectivity_period&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Returns the weak subjectivity period for the current ``state``.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    This computation takes into account the effect of validator set churn, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    bounded by the three churn_limit functions used below.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_total_active_balance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    delta&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; get_exit_churn_limit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; effect of exit churn&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        +&lt;&#x2F;span&gt;&lt;span&gt; get_activation_churn_limit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; effect of activation churn&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        +&lt;&#x2F;span&gt;&lt;span&gt; get_consolidation_churn_limit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; effect of consolidation churn&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    epochs_for_validator_set_churn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SAFETY_DECAY&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; delta&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 100&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MIN_VALIDATOR_WITHDRAWABILITY_DELAY&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; epochs_for_validator_set_churn&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;deposit-processing&quot;&gt;Deposit processing&lt;&#x2F;h3&gt;
&lt;p&gt;The only modification is replacing &lt;code&gt;get_activation_exit_churn_limit&lt;&#x2F;code&gt; with &lt;code&gt;get_activation_churn_limit&lt;&#x2F;code&gt;, maintaing the current cap on deposit churn respects, while removing the cap from exits. This reverts to the pre-Electra status quo, when activations were capped but exits were not.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; process_pending_deposits&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    next_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;get_current_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; [Modified in Gloas:EIP-8061]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    available_for_processing&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;deposit_balance_to_consume&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; get_activation_churn_limit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        state&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    processed_amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    next_deposit_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    deposits_to_postpone&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    is_churn_limit_reached&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    finalized_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; compute_start_slot_at_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;finalized_checkpoint&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;epoch&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; deposit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pending_deposits&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Do not process deposit requests if Eth1 bridge deposits are not yet applied.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Is deposit request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            deposit&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GENESIS_SLOT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            and&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; There are pending Eth1 bridge deposits&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;eth1_deposit_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;deposit_requests_start_index&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            break&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check if deposit has been finalized, otherwise, stop processing.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; deposit&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; finalized_slot&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            break&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check if number of processed deposits has not reached the limit, otherwise, stop processing.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; next_deposit_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_PENDING_DEPOSITS_PER_EPOCH&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            break&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Read validator state&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        is_validator_exited&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        is_validator_withdrawn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        validator_pubkeys&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validators&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; deposit&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; validator_pubkeys&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            validator&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validators&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;ValidatorIndex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;validator_pubkeys&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;deposit&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pubkey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            is_validator_exited&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; validator&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;exit_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; FAR_FUTURE_EPOCH&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            is_validator_withdrawn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; validator&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;withdrawable_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; next_epoch&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; is_validator_withdrawn&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Deposited balance will never become active. Increase balance but do not consume churn&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            apply_pending_deposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; deposit&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        elif&lt;&#x2F;span&gt;&lt;span&gt; is_validator_exited&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Validator is exiting, postpone the deposit until after withdrawable epoch&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            deposits_to_postpone&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;deposit&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check if deposit fits in the churn, otherwise, do no more deposit processing in this epoch.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            is_churn_limit_reached&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; processed_amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; deposit&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; available_for_processing&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; is_churn_limit_reached&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                break&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Consume churn and apply deposit.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            processed_amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; deposit&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            apply_pending_deposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; deposit&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Regardless of how the deposit was handled, we move on in the queue.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        next_deposit_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pending_deposits&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pending_deposits&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;next_deposit_index&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; deposits_to_postpone&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Accumulate churn only if the churn limit has been hit.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; is_churn_limit_reached&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;deposit_balance_to_consume&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; available_for_processing&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; processed_amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;deposit_balance_to_consume&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Gwei&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;exit-processing&quot;&gt;Exit processing&lt;&#x2F;h3&gt;
&lt;p&gt;We replace &lt;code&gt;get_activation_exit_churn_limit&lt;&#x2F;code&gt; with &lt;code&gt;get_exit_churn_limit&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; compute_exit_epoch_and_update_churn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; exit_balance&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Gwei&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Epoch&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    earliest_exit_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;earliest_exit_epoch&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        compute_activation_exit_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;get_current_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; [Modified in Gloas:EIP-8061]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    per_epoch_churn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_exit_churn_limit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; New epoch for exits.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;earliest_exit_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; earliest_exit_epoch&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        exit_balance_to_consume&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; per_epoch_churn&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        exit_balance_to_consume&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;exit_balance_to_consume&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Exit doesn&amp;#39;t fit in the current earliest epoch.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; exit_balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; exit_balance_to_consume&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        balance_to_process&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; exit_balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; exit_balance_to_consume&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        additional_epochs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;balance_to_process&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; per_epoch_churn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        earliest_exit_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; additional_epochs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        exit_balance_to_consume&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; additional_epochs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; per_epoch_churn&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Consume the balance and update state variables.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;exit_balance_to_consume&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; exit_balance_to_consume&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; exit_balance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;earliest_exit_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; earliest_exit_epoch&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;earliest_exit_epoch&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Independent parameters:&lt;&#x2F;strong&gt; a separate churn consolidation is easy to independently tune, in particular adjusted upward if we want to speed up the consolidation process further, and later downward, when the primary wave of validator set consolidation has already happened and the consolidation operation becomes less crucial.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Scaling with stake&lt;&#x2F;strong&gt;: the exit churn regains proportionality to the total stake, and the consolidation churn maintains it.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Preserving the activation cap&lt;&#x2F;strong&gt;: the activation churn limit maintains the cap from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7514&#x2F;&quot;&gt;EIP-7514&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Balancing security and functionality&lt;&#x2F;strong&gt;: the exit churn limit is increased by ~4x compared to the current cap, and exactly 2x compared to previous uncapped version, while the consolidation churn limit is increased by ~2x. Activations remain capped at the existing limit. As we see later in more detail, accounting for the asymmetric impact of exits and activations on safety degradation, this results in a decrease of the weak subjectivity period from ~15.7 days to ~7 days (see detailed calculations below), or ~6 days if we were to later remove the activation cap, in either case still on the order of a week. Moreover, were consolidations to be removed later, the weak subjectivity period would go up to ~11 days, or ~8.4 days without the activation cap.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a backwards-incompatible change to the consensus rules and MUST be activated as part of a scheduled network upgrade.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TODO&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;weak-subjectivity-period&quot;&gt;Weak subjectivity period&lt;&#x2F;h3&gt;
&lt;p&gt;Let &lt;code&gt;MIN_VALIDATOR_WITHDRAWABILITY_DELAY = 256&lt;&#x2F;code&gt; epochs, and let $S$ denote the total stake, $E$ the exit churn per epoch, $A$ the activation churn per epoch, and $C$ the consolidation churn per epoch. Each unit of exit churn contributes to a safety degradation (measured in ETH, as the churn) of $\frac{4}{3}$, whereas the safety degradation from activations is only $\frac{2}{3}$ per unit. Finally, it is $2$ per unit for consolidations, as a consolidation is the equivalent of an exit and an activation.&lt;&#x2F;p&gt;
&lt;p&gt;The formula to compute the weak subjectivity period (in epochs) for a 10% safety decay target (exactly corresponding to &lt;code&gt;compute_weak_subjectivity_period&lt;&#x2F;code&gt;) then is:&lt;&#x2F;p&gt;
&lt;p&gt;$\text{WS}_{\text{epochs}} = 256 +
\frac{0.1 \cdot S}{\frac{4}{3} \cdot E + \frac{2}{3} \cdot A + 2 \cdot C}$&lt;&#x2F;p&gt;
&lt;p&gt;The churn limits of the current protocol, assuming a total stake $S = 36M$ ETH (approximately the stake at the time of writing) are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;$A = E = \min(256, S&#x2F;2^{16}) = 256$ ETH (capped)&lt;&#x2F;li&gt;
&lt;li&gt;$C = S&#x2F;2^{16} - A \approx 293$ ETH&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The weak subjectivity period is then:&lt;&#x2F;p&gt;
&lt;p&gt;$\text{WS}_{\text{epochs}} \approx 3533$&lt;&#x2F;p&gt;
&lt;p&gt;$\Rightarrow\ \textbf{WS} \approx \mathbf{15.7\ \text{days}}$&lt;&#x2F;p&gt;
&lt;p&gt;In days, it is $\text{WS}_{\text{epochs}} &#x2F; 225$.&lt;&#x2F;p&gt;
&lt;p&gt;Under this EIP, and assuming a total stake $S = 36M$ ETH:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;$E = S&#x2F;2^{15} \approx 1098$ ETH&lt;&#x2F;li&gt;
&lt;li&gt;$A = \min(256, S&#x2F;2^{15}) = 256$ ETH (capped)&lt;&#x2F;li&gt;
&lt;li&gt;$C = S&#x2F;2^{16} \approx 549$ ETH&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The weak subjectivity period is then:&lt;&#x2F;p&gt;
&lt;p&gt;$\text{WS}_{\text{epochs}} \approx 1573$&lt;&#x2F;p&gt;
&lt;p&gt;$\Rightarrow\ \textbf{WS} \approx \mathbf{7.0\ \text{days}}$&lt;&#x2F;p&gt;
&lt;p&gt;Other possible future scenarios are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Activation cap removed: $\textbf{WS} \approx \mathbf{6.0\ \text{days}}$ ($\text{WS}_{\text{epochs}} \approx 1348$)&lt;&#x2F;li&gt;
&lt;li&gt;Consolidations disabled: $\textbf{WS} \approx \mathbf{10.9\ \text{days}}$ ($\text{WS}_{\text{epochs}} \approx 2457$)&lt;&#x2F;li&gt;
&lt;li&gt;Consolidations disabled and activation cap removed: $\textbf{WS} \approx \mathbf{8.4\ \text{days}}$ ($\text{WS}_{\text{epochs}} \approx 1894$)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note that removing the activation cap only reduces the weak subjectivity period by one day, and leaves it on the order of a week. The current parameters might then also be considered acceptable in a future where it is decided to remove the activation cap.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Exclude slashed validators from proposing</title>
        <published>2025-10-16T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Francesco D&#x27;Amato</name><uri>https://github.com/fradamt</uri>
	</author>
	
	<author>
		<name>Barnabas Busa</name><uri>https://github.com/barnabasbusa</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8045/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8045-exclude-slashed-validators-from-proposing/25850" />
        

        <id>https://wg-eips.ritovision.com/8045/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:8045"
            label="EIP-8045" />
        

        
        

        
        <summary type="html">Modify proposer selection to exclude slashed validators, improving network resilience and performance after mass slashings</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8045/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes a modification to the beacon chain proposer selection process to exclude slashed validators from being selected as proposers.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, slashed validators can still be selected as proposers, though their blocks are considered invalid by the state transition function, resulting in missed slots. This is in particular problematic after a mass slashing event, at which point there can be a long period with degraded chain performance, until all slashed validators are exited. If mass slashing also comes with general network disruption, the missed slots can also significantly complicate the recovery process. This change filters out slashed validators during proposer selection, reducing disruption and increasing resilience in such scenarios.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc2119&quot;&gt;RFC 2119&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc8174&quot;&gt;RFC 8174&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;get_beacon_proposer_indices&lt;&#x2F;code&gt; function in the consensus specifications is modified to exclude slashed validators from the proposer selection process, effectively going from considering all
active validators to all active and unslashed validators.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_beacon_proposer_indices&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;    state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; epoch&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Epoch&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Vector&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;ValidatorIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SLOTS_PER_EPOCH&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Return the proposer indices for the given ``epoch``.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Modified to exclude slashed validators&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    indices&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; get_active_validator_indices&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; epoch&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validators&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slashed&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    seed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_seed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; epoch&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; DOMAIN_BEACON_PROPOSER&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; compute_proposer_indices&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; epoch&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; seed&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; indices&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-exclude-slashed-validators&quot;&gt;Why exclude slashed validators?&lt;&#x2F;h3&gt;
&lt;p&gt;Slashed validators are already prevented from successfully proposing blocks through the state transition validation. The &lt;code&gt;process_block&lt;&#x2F;code&gt; function checks that the proposer is not slashed, and blocks from slashed proposers are considered invalid. Therefore, selecting slashed validators as proposers serves no purpose and only results in missed slots.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;design-decision-upfront-filtering&quot;&gt;Design decision: upfront filtering&lt;&#x2F;h3&gt;
&lt;p&gt;The chosen approach is to simply filter out slashed validators from the candidate pool, before doing any shuffling computation. An alternative design would be to still use the whole active validator set as the candidate pool, and then only filter out slashed validators once their index has been selected by the shuffle. The exact selection is not identical, but it achieves the same goal, i.e., a balance-weighted selection from the set of active-and-unslashed validators. The complexity is low in either design.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a backwards-incompatible change to the consensus rules and MUST be activated as part of a scheduled network upgrade.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases should verify that:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Slashed validators are not selected as proposers&lt;&#x2F;li&gt;
&lt;li&gt;A complete &lt;code&gt;proposer_lookahead&lt;&#x2F;code&gt; is generated even in the presence of slashed validators&lt;&#x2F;li&gt;
&lt;li&gt;Slashings do not affect the existing &lt;code&gt;proposer_lookahead&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Slashed validators are already prevented from successfully proposing blocks through the state transition validation, for good reason, as they are considered to be unreliable participants (malicious or faulty). However, they have historically still been eligible to be selected as proposers in order to ensure stability of the proposer selection mechanism, because excluding them would have severely impacted the stability of the proposer selection mechanism. In fact, any slashing processed on chain would have caused the sequence of future proposers to completely change, even within the lookahead window. However, with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7917&#x2F;&quot;&gt;EIP-7917&lt;&#x2F;a&gt;, the proposer selection is fixed in advance by storing in the Beacon state, so it would not be affected by slashings processed after the fact.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;impact-on-proposer-selection-distribution&quot;&gt;Impact on proposer selection distribution&lt;&#x2F;h3&gt;
&lt;p&gt;This change does not affect the randomness or fairness of proposer selection among non-slashed validators. The selection algorithm remains the same, with the only difference being that slashed validators are excluded from the candidate pool.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;mass-slashing-scenarios&quot;&gt;Mass slashing scenarios&lt;&#x2F;h3&gt;
&lt;p&gt;During mass slashing events, this change is purely beneficial to the resilience of the network, as well as to general quality of service. Instead of having many slashed validators selected as proposers (resulting in many missed slots), the network will continue to operate normally with only non-slashed validators being selected.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Uniform price auction over inclusion lists</title>
        <published>2025-10-16T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Anders Elowsson</name><uri>https://github.com/anderselowsson</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8046/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8046-uniform-price-auction-over-inclusion-lists/25844" />
        

        <id>https://wg-eips.ritovision.com/8046/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:8046"
            label="EIP-8046" />
        

        
        

        
        <summary type="html">Ensure IL transactions that offer a higher ranking fee than competing transactions are included in the block. Burn the marginal ranking fee.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8046/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes a uniform price auction over inclusion lists (UPIL), which ranks transactions by their offered ranking fee per gas. When the block is full, no transaction is allowed to displace an inclusion-list (IL) transaction that passes regular inclusion criteria and offers a higher ranking fee per gas. All included transactions pay a uniform inclusion price, equal to the highest ranking fee offered by any valid IL transaction excluded from the block, and this fee is burned. UPIL achieves strong censorship resistance by not allowing builders to circumvent propagated ILs when the block is full. This is particularly valuable for time-sensitive transactions and promotes fairness while preventing cheap block-stuffing under a multidimensional fee market. UPIL is specified to run on top of FOCIL (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7805&#x2F;&quot;&gt;EIP-7805&lt;&#x2F;a&gt;), but can be deployed on top of any IL mechanism.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Censorship resistance (CR) is a key property of decentralized blockchains. To ensure that transactions cannot be censored by the entity building the block (denoted &quot;builder&quot; in this EIP, which may sometimes be the proposer), a mechanism called fork-choice enforced inclusion lists (FOCIL) has been proposed in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7805&#x2F;&quot;&gt;EIP-7805&lt;&#x2F;a&gt;. A set of includers propagate inclusion lists (ILs), and the attesters uphold that the transactions in the ILs are included in the block via the fork-choice. There is no mechanism for ranking transactions in the ILs, and therefore not viable to uphold CR when the block is full. If IL transactions must be prioritized under full blocks, the builder could simply integrate with includers to propagate ILs containing the transactions it wishes to include in the block.&lt;&#x2F;p&gt;
&lt;p&gt;To uphold CR also under full blocks, it is necessary to have a framework for which transactions to include and exclude. This EIP specifies a uniform price auction over inclusion lists (UPIL), which ranks transactions by their offered &lt;code&gt;ranking_fee_per_gas&lt;&#x2F;code&gt;, derived from their specified &lt;code&gt;max_ranking_fee_per_gas&lt;&#x2F;code&gt;. If a block is full, no transaction is allowed to displace an IL transaction with a higher &lt;code&gt;ranking_fee_per_gas&lt;&#x2F;code&gt;, as long as the displaced IL transaction passes regular inclusion criteria. All included transactions pay the &quot;marginal&quot; ranking fee, corresponding to the highest ranking fee offered by a valid IL transaction excluded from the block, and this fee is burned. If no IL transaction was excluded, the marginal ranking fee is &lt;code&gt;0&lt;&#x2F;code&gt;. In essence, the existing base fee prices inter-block contention, while UPIL is an auction mechanism that relies on ILs to impose a secondary base fee that prices intra-block contention.&lt;&#x2F;p&gt;
&lt;p&gt;Ethereum is currently pursuing scaling by tracking gas consumption across separate resources, allowing each resource to be consumed at its maximum capacity. With a multidimensional approach, it can become cheaper to &quot;stuff the block&quot; such that it is full in any dimension by creating &quot;dummy transactions&quot; that only consume one specific resource. This degrades the CR of FOCIL, since builders can ignore ILs in full blocks. In the multidimensional &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7706&#x2F;&quot;&gt;EIP-7706&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7999&#x2F;&quot;&gt;EIP-7999&lt;&#x2F;a&gt;, the degradation of CR can become rather pronounced. Base fees are set individually per resource and may become very low, depending on whether reserve prices in the style of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7918&#x2F;&quot;&gt;EIP-7918&lt;&#x2F;a&gt; are adopted or not. Furthermore, if the builder varies which resource that is full across blocks, there is no longer an exponentially increasing cost to keep a transaction censored block after block.&lt;&#x2F;p&gt;
&lt;p&gt;The strong CR of UPIL is particularly suitable under a multidimensional fee market, but can be beneficial under any fee market. Some transactions are time-sensitive: what matters is inclusion within a set time frame. Sometimes, that time frame consists of just a few or a single block. UPIL guarantees inclusion in the next block for a transaction offering a sufficient ranking fee, assuming includers and attesters do their duties. This puts includers and the builder on a more equal footing. Furthermore, the lack of ranking in FOCIL gives builders an incentive to amass private transactions to facilitate low-cost temporary censorship, which could negatively affect the public mempool. However, both FOCIL and UPIL also have properties that strengthen the public mempool.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;new-transaction-format-and-ranking-fee&quot;&gt;New transaction format and ranking fee&lt;&#x2F;h3&gt;
&lt;p&gt;A new field &lt;code&gt;max_ranking_fee_per_gas&lt;&#x2F;code&gt; is added to a new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; transaction with &lt;code&gt;TransactionType&lt;&#x2F;code&gt; = &lt;code&gt;RANK_TX_TYPE&lt;&#x2F;code&gt;. The &lt;code&gt;TransactionPayload&lt;&#x2F;code&gt; for this transaction is:&lt;&#x2F;p&gt;
&lt;p&gt;&amp;lt;-- TODO --&amp;gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; TODO&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: To be defined after scheduling this EIP relative to EIP-7999 and EIP-8011, etc.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The ranking is performed on the &lt;code&gt;ranking_fee_per_gas&lt;&#x2F;code&gt;, corresponding to the maximum ranking fee that the transactor was willing to pay under the current base fee. Older transaction formats use their entire headroom for their offered ranking fee, whereas the new format can cap the ranking fee using the &lt;code&gt;max_ranking_fee_per_gas&lt;&#x2F;code&gt; field.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_max_fee&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Transaction&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; is_legacy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;type&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_price&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_fee_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_ranking_fee&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Transaction&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ranking_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_max_fee&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;base_fee_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The new RANK_TX_TYPE can set a cap to the offered ranking fee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; RANK_TX_TYPE&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_ranking_fee_per_gas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; ranking_fee_per_gas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; ranking_fee_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The ranking fee does not impose ordering constraints within the block, and only governs inclusion. The alternative specifications section discusses the options that exist for computing the &lt;code&gt;ranking_fee_per_gas&lt;&#x2F;code&gt; in various transaction formats, including the option to not implement a new transaction format at all.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;transaction-processing&quot;&gt;Transaction processing&lt;&#x2F;h3&gt;
&lt;p&gt;The builder specifies in the block body the &lt;code&gt;marginal_ranking_fee_per_gas&lt;&#x2F;code&gt; that all transactions must pay. The full &lt;code&gt;inclusion_fee_per_gas&lt;&#x2F;code&gt; corresponding to &lt;code&gt;base_fee_per_gas + marginal_ranking_fee_per_gas&lt;&#x2F;code&gt; is covered before the priority fee. A valid transaction must have &lt;code&gt;max_fee_per_gas &amp;gt;= inclusion_fee_per_gas&lt;&#x2F;code&gt; and &lt;code&gt;RANK_TX_TYPE&lt;&#x2F;code&gt; transactions must also have &lt;code&gt;max_ranking_fee_per_gas &amp;gt;= marginal_ranking_fee_per_gas&lt;&#x2F;code&gt;. Thus, under &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt;, transaction processing is changed as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt; unnormalized_transaction&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; transactions&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; After this existing check...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_priority_fee_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ..check that the transactor is willing to pay the marginal ranking fee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; RANK_TX_TYPE&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;marginal_ranking_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_ranking_fee_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ..derive the inclusion fee per gas and perform checks&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    inclusion_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;base_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;marginal_ranking_fee_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span&gt; inclusion_fee_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ..cap the priority fee by the inclusion fee instead of the base fee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    priority_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_priority_fee_per_gas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; inclusion_fee_per_gas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ..and adjust the line calculating the effective gas price&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    effective_gas_price&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; priority_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; inclusion_fee_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The inclusion fee is never distributed and thus burned. Note that legacy transactions are assigned &lt;code&gt;max_fee_per_gas = gas_price&lt;&#x2F;code&gt; and &lt;code&gt;max_priority_fee_per_gas = gas_price&lt;&#x2F;code&gt; as part of a prior normalization step. The existing assert statement&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;base_fee_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;is redundant and is removed.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;altered-focil-post-execution-inclusion-check&quot;&gt;Altered FOCIL post-execution inclusion check&lt;&#x2F;h3&gt;
&lt;p&gt;The post-execution inclusion check of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7805&#x2F;&quot;&gt;EIP-7805&lt;&#x2F;a&gt; is altered as outlined in the figure. Orange squares represent the original FOCIL checks, where &quot;No&quot; always leads to jumping to the next transaction. Blue squares are the checks added in UPIL that account for ranking. The first black square of step (1) contains only peripheral modifications that do not alter the intended outcome of the inclusion check.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8046&#x2F;.&#x2F;assets&#x2F;1.png&quot; alt=&quot;Figure 1&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;ranking_fee_per_gas&lt;&#x2F;code&gt; is first computed for each transaction &lt;code&gt;X&lt;&#x2F;code&gt; in the block via &lt;code&gt;get_ranking_fee(X, B)&lt;&#x2F;code&gt;. Then, for each transaction &lt;code&gt;T&lt;&#x2F;code&gt; in ILs, the check performs three steps.&lt;&#x2F;p&gt;
&lt;hr &#x2F;&gt;
&lt;p&gt;The original step (1)&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;(1) Check whether &lt;code&gt;T&lt;&#x2F;code&gt; is present in &lt;code&gt;B&lt;&#x2F;code&gt;. If &lt;code&gt;T&lt;&#x2F;code&gt; is present, then jump to the next transaction, else continue with next step.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;is replaced with the following:&lt;&#x2F;p&gt;
&lt;p&gt;(1) If &lt;code&gt;T&lt;&#x2F;code&gt; is present in &lt;code&gt;B&lt;&#x2F;code&gt;, or &lt;code&gt;get_max_fee(T) &amp;lt; block.base_fee_per_gas&lt;&#x2F;code&gt;, or &lt;code&gt;T&lt;&#x2F;code&gt; fails static validity, then skip &lt;code&gt;T&lt;&#x2F;code&gt; and jump to the next IL transaction, else continue to the next step.&lt;&#x2F;p&gt;
&lt;hr &#x2F;&gt;
&lt;p&gt;The original step (2):&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;(2) Check whether &lt;code&gt;B&lt;&#x2F;code&gt; has enough remaining gas to execute &lt;code&gt;T&lt;&#x2F;code&gt;. If &lt;code&gt;T.gas&lt;&#x2F;code&gt; &amp;gt; &lt;code&gt;gas_left&lt;&#x2F;code&gt;, then jump to the next transaction, else continue with next step.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;is replaced with the following:&lt;&#x2F;p&gt;
&lt;p&gt;(2a) Check whether &lt;code&gt;B&lt;&#x2F;code&gt; has enough remaining gas to execute &lt;code&gt;T&lt;&#x2F;code&gt;: &lt;code&gt;gas_left &amp;gt;= T.gas_limit&lt;&#x2F;code&gt;. If so, continue to (3a); otherwise, continue to (2b) potentially followed by (3b).&lt;&#x2F;p&gt;
&lt;p&gt;(2b) Check whether &lt;code&gt;B&lt;&#x2F;code&gt; would have had enough remaining gas to execute &lt;code&gt;T&lt;&#x2F;code&gt;, if &lt;code&gt;T&lt;&#x2F;code&gt; was included together with only higher-ranked transactions in &lt;code&gt;B&lt;&#x2F;code&gt;. First compute &lt;code&gt;T.ranking_fee_per_gas = get_ranking_fee(T, B)&lt;&#x2F;code&gt; and then compute &lt;code&gt;gas_ranked_left(T)&lt;&#x2F;code&gt; as the remaining gas after subtracting the &lt;code&gt;gas_used&lt;&#x2F;code&gt; of all transactions of the block with a higher &lt;code&gt;ranking_fee_per_gas&lt;&#x2F;code&gt; than &lt;code&gt;T&lt;&#x2F;code&gt; from &lt;code&gt;B.gas_limit&lt;&#x2F;code&gt;. For transactions with the same &lt;code&gt;ranking_fee_per_gas&lt;&#x2F;code&gt;, included transactions in &lt;code&gt;B&lt;&#x2F;code&gt; are considered higher-ranked than not-included IL transactions. If &lt;code&gt;gas_ranked_left(T) &amp;gt;= T.gas_limit&lt;&#x2F;code&gt;, continue to (3b); otherwise jump to the next IL transaction.&lt;&#x2F;p&gt;
&lt;hr &#x2F;&gt;
&lt;p&gt;The original step (3):&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;(3) Validate &lt;code&gt;T&lt;&#x2F;code&gt; against &lt;code&gt;S&lt;&#x2F;code&gt; by checking the nonce and balance of &lt;code&gt;T.origin&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;is replaced with the following:&lt;&#x2F;p&gt;
&lt;p&gt;(3a) Validate &lt;code&gt;T&lt;&#x2F;code&gt; against &lt;code&gt;S&lt;&#x2F;code&gt; by checking the nonce and balance of &lt;code&gt;T.origin&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;(3b) Validate &lt;code&gt;T&lt;&#x2F;code&gt; against &lt;code&gt;S&lt;&#x2F;code&gt; by checking the nonce of &lt;code&gt;T.origin&lt;&#x2F;code&gt;. Further validate &lt;code&gt;T&lt;&#x2F;code&gt; against the balance of the origin account by applying the standard pre-execution fundability check to a conservative balance that ignores all increases and counts all decreases to &lt;code&gt;T.origin&lt;&#x2F;code&gt; at the completion of each executed transaction of the block. Intermediate increases or decreases during the execution of a transaction are not tracked in isolation.&lt;&#x2F;p&gt;
&lt;p&gt;Step (3a) and (3b) conclude as previously:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;If &lt;code&gt;T&lt;&#x2F;code&gt; is invalid, then continue to the next transaction.&lt;&#x2F;p&gt;
&lt;p&gt;If &lt;code&gt;T&lt;&#x2F;code&gt; is valid, terminate process and return an &lt;code&gt;INCLUSION_LIST_UNSATISFIED&lt;&#x2F;code&gt; error.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h3 id=&quot;check-on-the-marginal-ranking-fee&quot;&gt;Check on the marginal ranking fee&lt;&#x2F;h3&gt;
&lt;p&gt;Attesters review excluded IL transactions to confirm that the &lt;code&gt;marginal_ranking_fee_per_gas&lt;&#x2F;code&gt; was set correctly by the builder. If step (2b) indicates that the transaction was outranked, then, before continuing with the next transaction, the transaction is also checked against step (3b), as indicated by a dashed line in the figure. The highest &lt;code&gt;ranking_fee_per_gas&lt;&#x2F;code&gt; among outranked IL transactions from (2b) that pass the valid inclusion check of (3b) must equal &lt;code&gt;marginal_ranking_fee_per_gas&lt;&#x2F;code&gt;. If no outranked IL transaction passes (3b), the &lt;code&gt;marginal_ranking_fee_per_gas&lt;&#x2F;code&gt; must be &lt;code&gt;0&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;updated-inclusion-check&quot;&gt;Updated inclusion check&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;conservative-balance&quot;&gt;Conservative balance&lt;&#x2F;h4&gt;
&lt;p&gt;The reason for using a conservative balance in (3b) when validating &lt;code&gt;T&lt;&#x2F;code&gt; is to avoid the circular dependencies that can emerge when a transaction is made executable by a lower-ranked transaction. Consider three transactions &lt;code&gt;A&lt;&#x2F;code&gt;, &lt;code&gt;B&lt;&#x2F;code&gt;, and &lt;code&gt;C&lt;&#x2F;code&gt; ranked as &lt;code&gt;A&amp;gt;B&amp;gt;C&lt;&#x2F;code&gt;. Without a conservative balance, &lt;code&gt;A&lt;&#x2F;code&gt; might be funded only if &lt;code&gt;B&lt;&#x2F;code&gt; is included in the block. For example, transaction &lt;code&gt;B&lt;&#x2F;code&gt; might fund &lt;code&gt;A&lt;&#x2F;code&gt;, so without &lt;code&gt;B&lt;&#x2F;code&gt;, &lt;code&gt;A&lt;&#x2F;code&gt; cannot be included, and without &lt;code&gt;A&lt;&#x2F;code&gt;, &lt;code&gt;B&lt;&#x2F;code&gt; cannot be included due to having a lower ranking. There is not enough gas to include both &lt;code&gt;A&lt;&#x2F;code&gt; and &lt;code&gt;B&lt;&#x2F;code&gt;. Including neither and instead including &lt;code&gt;C&lt;&#x2F;code&gt; also fails because the left out &lt;code&gt;B&lt;&#x2F;code&gt; was higher ranked.&lt;&#x2F;p&gt;
&lt;p&gt;It is not necessary that &lt;code&gt;B&lt;&#x2F;code&gt; directly funds &lt;code&gt;A&lt;&#x2F;code&gt;. It might very well be the case that &lt;code&gt;B&lt;&#x2F;code&gt; just changes the state such that a higher-ranked transaction &lt;code&gt;X&lt;&#x2F;code&gt; funds &lt;code&gt;A&lt;&#x2F;code&gt;, something that &lt;code&gt;X&lt;&#x2F;code&gt; would not do unless &lt;code&gt;B&lt;&#x2F;code&gt; was run beforehand.&lt;&#x2F;p&gt;
&lt;p&gt;It should be noted in (3b) that the transactor is in control of decreases to its ETH balance. Within a block, ETH leaves &lt;code&gt;T.origin&lt;&#x2F;code&gt; only via the transactor’s own signed transactions (value transfers and gas payments) or contracts it has explicitly authorized; the builder cannot manufacture debits. If the transactor’s own debits make &lt;code&gt;T&lt;&#x2F;code&gt; unfundable, and these are included in the block—even if lower-ranked—exclusion is acceptable as a consequence of choices made. After all, the transactor controls the relative order of its own transactions via nonces. Thus, ranking is neither considered for debits nor for credits: debits count regardless of rank, and credits do not count at all.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;retained-focil-check-in-non-full-blocks&quot;&gt;Retained FOCIL check in non-full blocks&lt;&#x2F;h4&gt;
&lt;p&gt;The regular FOCIL check is retained in non-full blocks to take advantage of its operational simplicity and since the conservative balance check of UPIL is unnecessarily lenient to the builder whenever an excluded IL transaction would have fit and is funded during processing of the prior transactions in the block. The circular dependencies from the previous subsection do not apply in FOCIL since there is no requirement for transactions in the IL to be included in the block if a transaction outside of the IL uses up the gas. Once (2a) confirms slack, the builder was clearly able to include any existing funding transaction in the block and still include &lt;code&gt;T&lt;&#x2F;code&gt;, so skipping &lt;code&gt;T&lt;&#x2F;code&gt; is an IL violation. UPIL could otherwise also be implemented completely without the old FOCIL checks, to reduce code surface. This corresponds to removing the orange boxes in the figure, retaining the blue boxes.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;compute-requirements-for-2b-and-3b&quot;&gt;Compute requirements for (2b) and (3b)&lt;&#x2F;h4&gt;
&lt;p&gt;The new conditions can be checked efficiently by clients.&lt;&#x2F;p&gt;
&lt;p&gt;In step (2b), validators can generate a list of the transactions in the block post-execution, sorted according to &lt;code&gt;ranking_fee_per_gas&lt;&#x2F;code&gt;, with an associated list of the cumulative gas consumption. The check for each transaction then only requires keying into the list and extracting the associated gas consumption.&lt;&#x2F;p&gt;
&lt;p&gt;For step (3b), the preprocessing consists of tracking a limited set of account-balance-changes during transaction processing. Before processing the block, the client builds an observation set &lt;code&gt;E&lt;&#x2F;code&gt; of &lt;code&gt;T.origin&lt;&#x2F;code&gt; balances for excluded IL transactions. After processing each transaction, it updates &lt;code&gt;E&lt;&#x2F;code&gt;, accounting for all decreases to &lt;code&gt;T.origin&lt;&#x2F;code&gt; balances but ignoring increases. If a block-level access list (BAL) is available that tracks all balance changes, the overall task is further simplified.&lt;&#x2F;p&gt;
&lt;p&gt;The check on the &lt;code&gt;marginal_ranking_fee_per_gas&lt;&#x2F;code&gt; (dashed line in the figure) is also trivial. For example, all outranked IL transactions that are otherwise validly includable can have their &lt;code&gt;ranking_fee_per_gas&lt;&#x2F;code&gt; added to an array. After all IL transactions have been reviewed, the maximum entry of this array must equal the specified &lt;code&gt;marginal_ranking_fee_per_gas&lt;&#x2F;code&gt;. If the array is empty, the &lt;code&gt;marginal_ranking_fee_per_gas&lt;&#x2F;code&gt; must instead be &lt;code&gt;0&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;auction-design&quot;&gt;Auction design&lt;&#x2F;h3&gt;
&lt;p&gt;The uniform price auction design allows transactors to signal intent (to overcome censorship if the block is full), without actually having to pay more than necessary. A transactor may not know beforehand if they will be censored, and may not wish to pay a very high fee for no reason. There are similarities to the current base fee model. Everyone specifies their willingness to pay, but pays the same minimum fee for inclusion, and this fee is burned. The combination of intents and fairness is attractive. A key difference is that the base fee is a clearing fee tracking contention for blockspace at the inter-block level, whereas the marginal ranking fee is a clearing fee tracking contention for blockspace at the intra-block level (locally for each block).&lt;&#x2F;p&gt;
&lt;p&gt;In essence, Ethereum’s current fee mechanism combines a uniform-price base fee that clears congestion across blocks with a first-price priority fee allocating space within each block. What UPIL does is to expand the uniform-price component to the intra-block level by introducing a marginal ranking fee that all included transactions pay equally. Inclusion will thus be governed primarily by protocol-defined uniform clearing (assuming transactions are surfaced in ILs).&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;max_ranking_fee_per_gas&lt;&#x2F;code&gt; is expected to be set rather low under normal circumstances. Most transactors will not be willing to pay excessively to be included in full blocks, and can instead wait for the next block. However, since the next block will have a 12.5% higher base fee, most transactors will at a minimum set &lt;code&gt;max_ranking_fee_per_gas&lt;&#x2F;code&gt; to 12.5% of the current base fee. The increase in burned fees extracted from transactors in full blocks will be offset by a decrease in priority fees, since the builder no longer controls which transactions that are included (furthermore, includers may also receive other fees, as discussed in the section on includer rewards). The ranking fee will also help with clearing in a fair manner under congestion during sudden spikes in transaction demand. All transactions included in the same block will pay the same ranking fee, with transactions willing to pay the most during a sudden spike included in the first available block. This is arguably an improvement to the UX for Ethereum&#x27;s users.&lt;&#x2F;p&gt;
&lt;p&gt;The reason for burning the marginal ranking fee instead of paying it out to includers is that includers otherwise could have an incentive to engineer artificial congestion in order to raise the fee. This is not trivial, requiring many separate entities to agree to withhold transaction inclusion for consecutive blocks. Various configurations for how to reward includers for their work are outlined in a subsequent section, including the option to distribute the marginal ranking fee to them.&lt;&#x2F;p&gt;
&lt;p&gt;The builder may sometimes, via its private orderflow or late-arriving transactions, have some ability to raise the &lt;code&gt;marginal_ranking_fee_per_gas&lt;&#x2F;code&gt; by including transactions that outrank IL transactions. But a builder that raises the marginal ranking fee will also inadvertently reduce the priority-fee headroom for all transactions, since the inclusion fee is subtracted from the max fee before calculating the capped priority fee for all transactions in the block.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;multidimensional-upil&quot;&gt;Multidimensional UPIL&lt;&#x2F;h3&gt;
&lt;p&gt;If there are multiple resources, &lt;code&gt;gas_ranked_left(T)&lt;&#x2F;code&gt; is a vector. Using the notation of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7999&#x2F;&quot;&gt;EIP-7999&lt;&#x2F;a&gt;, all &lt;em&gt;conditional&lt;&#x2F;em&gt; resources must then be checked against the corresponding gas limits specified by the analyzed transaction. Transactions that consume any &lt;em&gt;deconditional&lt;&#x2F;em&gt; resource are not subject to the UPIL post-execution check, and insufficient capacity in an &lt;em&gt;unconditional&lt;&#x2F;em&gt; resource is never a valid reason to exclude an IL transaction.&lt;&#x2F;p&gt;
&lt;p&gt;Thus, under multidimensional UPIL, the transaction is checked against &lt;code&gt;gas_ranked_left(T)&lt;&#x2F;code&gt; over the conditional resources only, in both (2a) and (2b). However, given the strong CR of UPIL, it would be perfectly feasible to classify calldata as conditional instead of using the unconditional classification of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7999&#x2F;&quot;&gt;EIP-7999&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;censorship-resistance-under-focil-and-upil&quot;&gt;Censorship resistance under FOCIL and UPIL&lt;&#x2F;h3&gt;
&lt;p&gt;This subsection offers a comparison of the censorship resistance achieved under FOCIL and UPIL. The premise is a builder seeking to censor a transaction under different fee market designs. We begin by rudimentarily quantifying the cost $C_i$ of censoring a transaction in block $i$ ($i=0$ for the first censored block) as:&lt;&#x2F;p&gt;
&lt;p&gt;$C_i = g_df_b  (1+r)^i  + g_df_r +  m(i, f_r).$&lt;&#x2F;p&gt;
&lt;p&gt;In this equation, $g_d$ is the gas that the builder must pay by creating so-called &quot;dummy transactions&quot; to fill the block, $f_b$ is the base fee for that gas, $r$ is the rate by which the base fee increases in full blocks (i.e., 12.5%), $f_r$ is the &lt;code&gt;ranking_fee_per_gas&lt;&#x2F;code&gt; of the censored transaction, and $m(i, f_r)$ is the MEV (including priority fees) forgone when forced to exclude pending transactions with a lower ranking than the censored transaction for block $i$ (the opportunity cost).&lt;&#x2F;p&gt;
&lt;h4 id=&quot;multidimensional-fee-market&quot;&gt;Multidimensional fee market&lt;&#x2F;h4&gt;
&lt;p&gt;Under a multidimensional fee market envisioned in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7706&#x2F;&quot;&gt;EIP-7706&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7999&#x2F;&quot;&gt;EIP-7999&lt;&#x2F;a&gt;, the base fee is set individually per resource to maximize utilization of blockspace. As noted in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7999&#x2F;&quot;&gt;EIP-7999&lt;&#x2F;a&gt;, the base fee may therefore sometimes become very low for a resource, meaning that the cost of generating dummy transactions to fill the block also becomes very low. In a potential multidimensional FOCIL, it is then only necessary that one resource used by a transaction is filled to censor that transaction. Furthermore, while the base fee will increase for the resource that was filled with dummy transactions, the base fees of all other resources will not. These base fees will instead vary based on gas consumed by regular transactions included in the block. The builder can potentially vary which resource it fills the block for, to keep any base fee from exploding during prolonged censorship. Define $\mathbf{f_b}$ as the vector of base fees. The outcome for FOCIL and UPIL respectively is:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;FOCIL:&lt;&#x2F;strong&gt; The cost of censorship for the first block is $C_0 = g_d\min(\mathbf{f_b})$, and thus $C_0 \to 0$ if $\min(\mathbf{f_b}) \to 0$. The cost can potentially be kept close to 0 even under continued censorship, depending on the distribution of the equilibrium base fees under no censorship and the fee elasticities of demand.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;There is no ranking fee (thus $g_df_r \to 0$) and there is no opportunity cost because the builder can always include lower-ranked transactions when it fills the block (thus $m(i, f_r) \to 0$).&lt;&#x2F;li&gt;
&lt;li&gt;The builder can switch between resources it fills, thus potentially keeping its overall costs contained even under continued censorship. This depends on prevailing fee elasticities and equilibrium base fees under no censorship.&lt;&#x2F;li&gt;
&lt;li&gt;If there is just one base fee that is low initially, then that base fee will rise (albeit from a low starting point), if the builder does not assume the opportunity cost $m(i, f_r)$ of excluding other transactions. Fee elasticities are relevant also in this case, because the rise in a single base fee should moderately reduce demand for all other resources as the transactor reviews the total cost.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;UPIL:&lt;&#x2F;strong&gt; The cost of censorship for the first block is $C_0 = g_d\min(\mathbf{f_b}) + g_df_r + m(i, f_r)$, and thus $C_0 = g_df_r + m(i, f_r)$ if $\min(\mathbf{f_b}) \to 0$. This cost can be hundreds or thousands of times higher than whatever ranking fee the censored transaction specifies, and it rises with continued censorship due to the opportunity cost of keeping all pending transactions with a lower ranking fee that consume the filled resource out of the block.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If the transactor specifies a ranking fee $f_r$ that exceeds the ranking fee of existing transactions in the mempool, the censoring builder will need to create dummy transactions up to the entire gas limit of the resource it is targeting. This can be specified as $g_d = g_l-g_r(T)$, where $g_r(T)$ is the gas already consumed by the censored transaction. Thus, the censoring builder must pay $f_r(g_l-g_r(T))$. To censor a transaction consuming 100k gas when the gas limit is 60M in the filled resource, the builder must pay $(60-0.1)&#x2F;0.1 = 599$ times more than what the transactor was willing to pay for inclusion. As the gas limit expands, the relative cost of censorship increases. It should here be noted that the transactor will not need to pay its high offered ranking fee if it is indeed censored, and would after censorship concludes only pay according to the &lt;code&gt;marginal_ranking_fee_per_gas&lt;&#x2F;code&gt; of the subsequent block.&lt;&#x2F;li&gt;
&lt;li&gt;The opportunity cost from censorship is also higher under UPIL than FOCIL, since no pending transaction with a ranking fee $f&#x27;_r&amp;lt;f_r$ that consumes the filled resource can be included if the censored transaction is excluded.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;current-fee-market&quot;&gt;Current fee market&lt;&#x2F;h4&gt;
&lt;p&gt;We now discuss the situation under the current fee market with a single base fee (ignoring the blob resource). In this case, the base fee term of the previous equation does not vanish. If the builder does not use the &quot;slow transaction&quot; strategies outlined in the next subsection, the outcome for FOCIL and UPIL respectively is:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;FOCIL:&lt;&#x2F;strong&gt; The builder must cover the base fees: $g_df_b(1+r)^i$ of block $i$. The required amount of purchased gas $g_d$ will in the average case be $g_d=g_l&#x2F;2$. However, there will be many instances where pending transactions in the public mempool or via private orderflow consume more than $g_l&#x2F;2$. Censorship for one or two blocks can therefore be inexpensive even if pending transactions do not completely fill the block. The $(1+r)^i$ term grows by 12.5% per block, doubling in six blocks, and pending transactions are quickly depleted. Therefore, censorship becomes costly rather quickly: FOCIL ensures that transactions are included within a limited number of blocks if includers do their duties, but not in the first few blocks.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;UPIL:&lt;&#x2F;strong&gt; The builder must cover the base fee, the ranking fee, and forego pending transactions, thus suffering a cost of $g_df_b(1+r)^i + g_df_r + m(i, f_r)$. The required gas $g_d$ is higher than in FOCIL, and—just as for the multidimensional fee market—potentially the full gas limit, because the builder cannot rely on pending transactions with a lower ranking fee for block stuffing. Due to the $g_df_r$ term, the cost for censoring a transaction for a single block can easily become a thousand times higher than whatever the transactor was willing to pay for inclusion, just as under the multidimensional fee market.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;current-fee-market-with-slow-transactions&quot;&gt;Current fee market with &quot;slow transactions&quot;&lt;&#x2F;h4&gt;
&lt;p&gt;Note the importance of pending transactions for sidestepping the ILs in FOCIL: the cost for covering base fees when filling the block provides the CR. A strategy the builder could use to reduce the cost of censorship over a few blocks is to amass &quot;slow transactions&quot; through private orderflow—transactions that do not have to execute immediately. These are transactions for which the transactor is willing to substitute speed for some other benefit, predominantly rebated fees, but potentially also convenience or MEV protection. The builder (or realistically a MEV-protecting RPC endpoint) guarantees (trustfully) inclusion within some set time frame, and that the total cost for the transactor will be below the cost that would have been incurred given the base fee at the time that the tx is sent to the builder. The concept can be integrated as:&lt;&#x2F;p&gt;
&lt;p&gt;$C_i = g_df_b  ((1+r)^i-s)  + g_df_r +  m(i, f_r).$&lt;&#x2F;p&gt;
&lt;p&gt;Here, $s$ represents the cost reduction factor relative to the initial base fee. This models a scenario where the builder has stored and promised to include blockspace-filling transactions at a fixed discount. If the rebate to transactors for slow transactions is 10%, then $s=0.9$, with the cost of censoring the first block in FOCIL reduced by 90%. Such a strategy can thus be useful for censoring a couple of blocks in a row. After around 5 blocks or less, $(1+r)^i - s &amp;gt; 1$, meaning that the cost is the same as the cost of censoring the first block without slow transactions. Since the supply of slow transactions would likely be limited, the strategy cannot be applied too often.&lt;&#x2F;p&gt;
&lt;p&gt;Slow transactions must be propagated privately to remain useful, and reach their full economic potential by contributing to censorship. When the value in sidestepping ILs exceeds the costs of facilitating slow transactions, the proportion of transactions propagated p2p may thus fall. On the other hand, the transactions that indeed are propagated p2p are upon IL listing guaranteed inclusion in non-full blocks, and therefore do not need to pay priority fees. The effect of FOCIL on the public mempool may therefore be negative or positive depending on the demand for censorship from builders. Alternatively, the protocol could facilitate &quot;trustless slow transactions&quot; by letting builders sponsor transactions offering a max fee below the prevailing base fee, for example by charging the base fee jointly for all transactions at the end of the block.&lt;&#x2F;p&gt;
&lt;p&gt;Under UPIL, slow transactions do not contribute meaningfully to censorship due to the $g_df_r +  m(i, f_r)$ terms, and there is furthermore no rationale for paying a priority fee upon listing, further strengthening the public mempool.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;multidimensional-gas-metering&quot;&gt;Multidimensional gas metering&lt;&#x2F;h4&gt;
&lt;p&gt;Under multidimensional gas metering in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8011&#x2F;&quot;&gt;EIP-8011&lt;&#x2F;a&gt;, the situation is closer to the current fee market than the multidimensional fee market. There is still just one base fee, so the cost of censoring a transaction for a sustained period rises exponentially. Censorship may become slightly cheaper than currently, due to the equilibrium reduction in the base fee with a maintained slack in the block relative to the most consumed resource. On the other hand, utilization of slow transactions may become slightly less efficient.&lt;&#x2F;p&gt;
&lt;p&gt;In the current fee market, half the gas limit $g_l&#x2F;2$ is consumed in the average block. Transactors spend $f_bg_l&#x2F;2$ on average and the cost of censoring a block via dummy transactions is also $f_bg_l&#x2F;2$. Under multidimensional gas metering, $g_l&#x2F;2$ is consumed on average individually for the most used resource. Transactors however consume the higher $xg_l&#x2F;2$ amount of gas on average over all resources, while the gas required for censorship remains at $g_l&#x2F;2$ (filling up the most consumed resource). Here $x$ corresponds to the scaling factor achieved when gas of different resources can be consumed in parallel, a scaling factor that might end up in the range 2-4. Keeping demand and $g_l$ fixed, the base fee $f_b$ will fall, reducing the cost $f_bg_l&#x2F;2$ of censoring a block in the average case. Had we instead simply increased the gas limit, CR would have been affected differently, because then the cost of censorship would also have increased according to the increase in $g_l$, such that the censoring builder would have needed to purchase more dummy transactions in the average case.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;transaction-inclusion-and-mev&quot;&gt;Transaction inclusion and MEV&lt;&#x2F;h4&gt;
&lt;p&gt;In FOCIL, including an existing transaction is always possible without raising the inclusion fee, regardless of whether this means that an IL transaction must be excluded or not. In UPIL, if the block is full, including an existing transaction over an IL transaction willing to pay more is treated as censorship. Ostensibly, MEV and censorship are not separate topics: in many scenarios, censorship is also MEV. To displace the IL transaction offering the lowest ranking fee among IL transactions in the block, the new transaction must pay at least the ranking fee offered by that IL transaction.&lt;&#x2F;p&gt;
&lt;p&gt;Since the builder cannot freely decide which of the pending transactions to include in UPIL, it might not be able to extract all MEV from pending transactions that it could have in FOCIL. It lacks the ability to exclude IL transactions at will from full blocks. Once a transaction is in an IL, its inclusion is guaranteed if it is willing to pay at least the same as the smallest offer by other transactions that go into the block. This levels the playing field between includers and the builder, giving the includer the opportunity to offer real inclusion guarantees to transactors. In FOCIL, the &lt;em&gt;protocol&lt;&#x2F;em&gt; offers real inclusion guarantees, &lt;em&gt;eventually&lt;&#x2F;em&gt;. In UPIL, the &lt;em&gt;includer&lt;&#x2F;em&gt; offers real inclusion guarantees, &lt;em&gt;immediately&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Some includers might charge transactors for their services in FOCIL, but the value of the provided services is further strengthened in UPIL. MEV might thus shift from the builder to includers in the form of fees for listing the transaction. A transaction listed by an IL has no need to pay a priority fee for inclusion. Indeed, we may even see &quot;IL-builders&quot; that collate full ILs as a service both in FOCIL and UPIL. Some MEV will also shift to the protocol in the form of burned ranking fees. It is natural to then consider what options the builder has, to retain some power over transaction inclusion. It may of course try to bribe includers to not list transactions. A problem for a builder trying to stay competitive is that this requires bribing all includers, and that any includer remaining faithful to its duties can earn a greater reward from transactors when others take the bribe, particularly in UPIL.&lt;&#x2F;p&gt;
&lt;p&gt;There are nuances to the design that need careful consideration before adoption. Something to be attentive to is the effect of burning the marginal ranking fee, given that avoiding the burn is not a zero-sum outcome for builders and includers. This is further discussed in the next section.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;alternative-specifications-for-rewarding-includers&quot;&gt;Alternative specifications for rewarding includers&lt;&#x2F;h3&gt;
&lt;p&gt;Transactors might wish to reward includers in both FOCIL and UPIL for surfacing their transaction in an IL. They may recognize that the space in each IL is limited, meaning includers sometimes need to prioritize between available transactions. They might also fear that builders could bribe includers to not fulfill their duties, so that the builder can exclude unwanted transactions. As discussed previously, UPIL strengthens the position of includers, giving them in some sense equal power to the builder in deciding which transactions enter the block. For this reason, the case for rewarding includers is also stronger: an IL transaction does not require a priority fee to be included, even in full blocks—it must be included if it offers a higher ranking fee than competing transactions.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;out-of-protocol-inclusion-fees&quot;&gt;Out-of-protocol inclusion fees&lt;&#x2F;h4&gt;
&lt;p&gt;If there is no in-protocol reward mechanism, individual staking service providers might start offering (trustfully) to list transactions in their next assigned IL slot, against a small fee. We might also see public orderflow of includable transactions offering a certain reward for inclusion, with includers and transactors coming to agreement via a third-party software. This can improve the UX, but also has the potential to become a centralization vector.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;in-protocol-inclusion-fee-sources&quot;&gt;In-protocol inclusion fee sources&lt;&#x2F;h4&gt;
&lt;p&gt;It is possible that the protocol can be of direct assistance. Three fee sources will first be reviewed, and relevant distribution mechanisms then explored.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Includer fee:&lt;&#x2F;strong&gt; One example is to allow transactions to specify an includer fee via a new field &lt;code&gt;max_includer_fee_per_gas&lt;&#x2F;code&gt;. To split the &lt;code&gt;max_includer_fee_per_gas&lt;&#x2F;code&gt; and the &lt;code&gt;max_priority_fee_per_gas&lt;&#x2F;code&gt; when they are capped by the &lt;code&gt;max_fee_per_gas&lt;&#x2F;code&gt;, the &quot;aggregate-cap-divide&quot; method outlined in the &quot;pay-as-you-bid&quot; subsection is the recommended approach. Alternatively, it is possible to distribute only the includer fee or the priority fee, depending on if the transaction was listed in an IL or not, and never both. The builder must then specify whether each transaction originated from an IL or not (at the transaction or IL level), and attesters vote against the block if the builder fails to make such an assignment when they observed the transaction in a timely IL.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Priority fee:&lt;&#x2F;strong&gt; It is possible to instead let the includers receive the priority fee if they list a transaction. The builder will have no choice but to include a transaction once it is listed by an includer, and the priority fee then serves little purpose. From the transactor&#x27;s perspective, giving a priority fee to the builder for an IL transaction is a wasteful expenditure. Once again, with this option the builder must specify whether each transaction originated from an IL or not.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Marginal ranking fee:&lt;&#x2F;strong&gt; The marginal ranking fee can be distributed to includers instead of being burned. As discussed previously, one potential downside of this is the increase in rewards for engineering contention—in collaboration with builders—by first withholding transactions, and then releasing all transactions in the same block.&lt;&#x2F;p&gt;
&lt;p&gt;The question is whether includers will be able to engineer such contention, given the coordination problem at hand: withholding transactions over several slots, with several slots&#x27; includers working together, where anyone breaking the cartel could reap higher rewards from transactors paying includers for their services. Transactors might also end up setting lower ranking fees if such an approach becomes systematic, and most ranking fees will likely anyway be in the region of 12.5% of the base fee. Finally, we do not see builders coordinating to bring down the base fee in order to reap higher priority fees today (at the same time, the control over the priority fee is indirect, and they do not directly attain the base fee).&lt;&#x2F;p&gt;
&lt;p&gt;A potential benefit of distributing the marginal ranking fee to includers is that if the builder wishes to bribe includers to avoid contention (in order to bring up priority fees), then includers taking such a bribe would miss out on rewards for that contention (in addition to any rewards they may already miss out on from includer priority fees).&lt;&#x2F;p&gt;
&lt;h4 id=&quot;mechanisms-for-distributing-inclusion-fees-in-protocol&quot;&gt;Mechanisms for distributing inclusion fees in-protocol&lt;&#x2F;h4&gt;
&lt;p&gt;Four options for how to distribute the fee from any of the three in-protocol inclusion fee sources listed in the previous section will now be reviewed:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;(1) Keyed distribution:&lt;&#x2F;strong&gt; Let transactors set one or several keys, with each key linking to one includer (i.e., validator ID) or to many includers (e.g., enabling all validators of an SSP to associate one key to all its validators). The protocol can then ensure that the rewards are distributed only to validators represented by a key, if it listed the transaction. This means that transactions shared with an includer privately still can use an in-protocol fee distribution without risking dilution. Options (2)-(4) below can be applied when the transactor does not provide a key or when the keyed includer(s) failed to list the transaction.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;(2) Individual distribution:&lt;&#x2F;strong&gt; Split the fee between all includers listing a transaction. All includers then have an incentive to list a transaction, with the incentive being stronger if other includers have ignored it. It may however lead to unnecessary duplicate listings, since there is an incentive to list transactions even after they have been observed in another IL. It may also lead includers to integrate with builders to propagate the optimal IL by leveraging the builder&#x27;s last look.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;(3) Seniority distribution:&lt;&#x2F;strong&gt; Use a &quot;seniority waterfall&quot; rule. The transaction hash is combined with includer validator IDs to assign an order of seniority by which each includer has the right to the full includer fee. If a transaction&#x27;s senior includer lists it, there is no purpose for a less senior includer to also list it. The idea is to promote a broader coverage while maintaining fairness. The mechanism will however not remove all duplicates, as a more senior includer will still list a transaction already listed by a less senior includer. It is straightforward to combine (1) with (3), by giving keyed includers the highest seniority, with remaining includers assigned a seniority based on the transaction hash. This could also prevent transaction hash grinding in the case when some senior includers are more reliable than others. Under the priority fee redistribution rule, the builder is in essence appended to the waterfall, having the lowest seniority.&lt;&#x2F;p&gt;
&lt;p&gt;To further reduce duplicates, a potential extension could allow includers to stagger their inclusion list so that they first broadcast transactions they are the most senior includer for, and then append the list with transactions they are less senior for or that arrive late. This can also increase the includer&#x27;s expected value (EV) since an early broadcast increases margins and the late broadcast allows for better coverage. Another way to increase EV under this rule is to combine it with (4) below. Each partial list must have timeliness observed in isolation, and the rules for IL equivocation must be amended to allow append operations.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;(4) Collective distribution:&lt;&#x2F;strong&gt; Distribute the includer fee collectively to all includers. There is then no need to keep track of who propagated which transaction in which IL. It also serves to promote independence of includers. Builders cannot help includers to extract a relatively higher proportion of the ranking fee by constructing an optimal IL for them from their last look. Includers are further encouraged to facilitate as broad coverage as possible, given that there are no incentives to propagate a (high-paying) transaction if one of the other includers already propagates it. This means that some includers can pivot to propagating their ILs early, while others observe and select late or missed transactions.&lt;&#x2F;p&gt;
&lt;p&gt;A downside is that includers are not incentivized individually to do a good job, and gain individually only 1&#x2F;&lt;code&gt;IL_COMMITTEE_SIZE&lt;&#x2F;code&gt; of any ranking fee of a transaction they uniquely include. The point however is that the collective distribution alters the meaning of &quot;doing a good job&quot;, aligning protocol design goals with includer incentives.&lt;&#x2F;p&gt;
&lt;p&gt;Builders may try to bribe includers to not include transactions. If an includer will receive 1&#x2F;&lt;code&gt;IL_COMMITTEE_SIZE&lt;&#x2F;code&gt; of any collective rewards for &lt;em&gt;not&lt;&#x2F;em&gt; including a transaction that eventually is not surfaced by any IL, then they may elect to leave it out to preserve space for other transactions. However, the builder would then also forego a sum corresponding to the entire collective rewards by paying out such bribes to the includers. In the setup where the priority fee is distributed to includers if they surface a transaction, the builder would thus need to forego the entire priority fee it stands to receive.&lt;&#x2F;p&gt;
&lt;p&gt;However, due to the gradual construction of the aggregate IL, the builder can offer higher bribes than 1&#x2F;&lt;code&gt;IL_COMMITTEE_SIZE&lt;&#x2F;code&gt; to the last remaining includers, to keep some transactions not yet included out of the IL aggregate. The last remaining includer that spots a late transaction might be able to choose between including it to receive 1&#x2F;&lt;code&gt;IL_COMMITTEE_SIZE&lt;&#x2F;code&gt; of the priority fee, or to receive 1&#x2F;2 of a conditional priority fee as a bribe to not include it.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;alternative-specifications-for-the-auction-and-transaction-format&quot;&gt;Alternative specifications for the auction and transaction format&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;omit-the-new-transaction-format-with-its-added-ranking-fee-field&quot;&gt;Omit the new transaction format with its added ranking fee field&lt;&#x2F;h4&gt;
&lt;p&gt;Existing transaction formats are ranked using &lt;code&gt;max_fee_per_gas&lt;&#x2F;code&gt;. This may be sufficiently expressive, with the new transaction type omitted. The benefit is that it simplifies the UX. Transactors may not care about how much they have to pay to specifically cover the &lt;code&gt;marginal_ranking_fee_per_gas&lt;&#x2F;code&gt;—they have already specified how much they are willing to pay for inclusion in total with the &lt;code&gt;max_fee_per_gas&lt;&#x2F;code&gt;. It also simplifies the developer experience, since we do not need to change the transaction format.&lt;&#x2F;p&gt;
&lt;p&gt;A potential downside is that transactors cannot differentiate between how high contention fees they are willing to pay to cover the base fee and to cover the marginal ranking fee in full blocks. The builder has some control over the marginal ranking fee: if there are transactions outside of the ILs that are willing to pay a higher fee for inclusion than the IL transactions, then it may or may not elect to include those transactions. This influences the marginal ranking fee which is determined by the highest offered ranking fee of an excluded IL transaction. It is more difficult for the builder to control the base fee. Transactors wishing to limit their ranking fees, while at the same time giving ample room for the base fee to rise before inclusion, may therefore find that older transaction formats do not offer sufficient expressiveness.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;pay-as-you-bid-auction&quot;&gt;Pay-as-you-bid auction&lt;&#x2F;h4&gt;
&lt;p&gt;Two alternative pay-as-you-bid auction designs will now be highlighted. The first is that transactors always pay their offered ranking fee upon inclusion. In this case, there is no risk that the includers or the builder engineer contention for blockspace to drive up the price, and the full ranking fee is distributed to includers instead of being burned, using the collective method previously described. The post-execution check stays the same as in the main specification, with the only difference that the check on outranked IL transactions concerning the &lt;code&gt;marginal_ranking_fee_per_gas&lt;&#x2F;code&gt; (dashed line in the figure) is removed.&lt;&#x2F;p&gt;
&lt;p&gt;Transaction processing is altered to, e.g., facilitate payment to includers. The split between the specified &lt;code&gt;max_ranking_fee_per_gas&lt;&#x2F;code&gt; and &lt;code&gt;max_priority_fee_per_gas&lt;&#x2F;code&gt; can be done in two ways. Either the ranking fee takes precedence over the priority fee as previously, or the two are given equal precedence. In the first case, the same strategy as in the main specification can be used. In the second case, the two fees can first be summed into a single &lt;code&gt;max_payout_fee_per_gas&lt;&#x2F;code&gt;, and the capped &lt;code&gt;payout_fee_per_gas&lt;&#x2F;code&gt; then distributed proportionally to the size of the original max ranking&#x2F;priority fees.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, the builder is given the ability to set a &lt;code&gt;priority_fee_shift_per_gas&lt;&#x2F;code&gt; parameter for each transaction to allow transactions without a sufficient &lt;code&gt;ranking_fee_per_gas&lt;&#x2F;code&gt; to become eligible for inclusion in the block. We can envision a scenario where the builder otherwise integrates deeper with transactors to help them set the optimal ranking fee anyway. Such an integration could have detrimental effects on the builder competitive landscape, and it is therefore desirable to allow the builder—who has the last look when building blocks—to raise the ranking fee as it sees fit in a trustless manner. This means that many transactors will elect to just provide a priority fee, and that there is limited downside for transactors using older transaction types.&lt;&#x2F;p&gt;
&lt;p&gt;If a transactor believes that the builder may leave their transactions out of the block, then it is still well served by providing a ranking fee and propagating the transaction publicly so that it can be surfaced by an IL. The builder needs to boost all transactions up to the ranking fee of the transaction it wishes to exclude from the block, and a modest ranking fee can therefore be sufficient to ensure inclusion. The spec shows the ranking fee taking precedence and omits some overflow checks:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; unnormalized_transaction&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; enumerate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;transactions&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; After this existing check...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_priority_fee_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ..Optionally shift a proportion of the priority fee over to the ranking fee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;priority_fee_shift_per_gas&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_priority_fee_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_priority_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_priority_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;priority_fee_shift_per_gas&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ..then fill in order of: base fee, ranking fee, priority fee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_shifted_ranking_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_ranking_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;priority_fee_shift_per_gas&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ranking_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;max_shifted_ranking_fee_per_gas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;base_fee_per_gas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    inclusion_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;base_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; ranking_fee_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    priority_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;max_priority_fee_per_gas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; inclusion_fee_per_gas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    effective_gas_price&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; inclusion_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; priority_fee_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ..after refunding the transactor as normal, the includer fee is computed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    includer_fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; ranking_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; IL_COMMITTEE_SIZE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ..balances of the `IL_COMMITTEE_SIZE` includers increased&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; j&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;IL_COMMITTEE_SIZE&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;includer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;j&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; includer_fee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ..and the priority fee is distributed to the builder just as in EIP-1559&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;    self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;author&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; priority_fee_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The consensus layer (CL) constructs a list of execution-layer (EL) payout addresses for the slot, ordered by IL committee index, and provides it to the EL via a new engine API call: &lt;code&gt;engine_setIncluderPayoutsV1&lt;&#x2F;code&gt;. For committee members with &lt;code&gt;0x00&lt;&#x2F;code&gt; credentials, the CL inserts the zero address &lt;code&gt;0x000...&lt;&#x2F;code&gt;, thus burning these rewards.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;pay-as-you-bid-auction-using-only-priority-fee&quot;&gt;Pay-as-you-bid auction using only priority fee&lt;&#x2F;h4&gt;
&lt;p&gt;A second alternative is to let the priority fee act as a ranking fee in a pay-as-you-bid auction. The priority fee is distributed collectively to includers if it was surfaced by at least one inclusion list. Otherwise it is distributed to the builder. &lt;em&gt;Only&lt;&#x2F;em&gt; priority fees distributed to the includers count towards the transaction&#x27;s ranking.&lt;&#x2F;p&gt;
&lt;p&gt;The builder specifies whether an included transaction was surfaced by an IL via a bitfield &lt;code&gt;IL_transaction&lt;&#x2F;code&gt; in the payload body, of equal length to the number of transactions. For all transactions where &lt;code&gt;IL_transaction[i]=FALSE&lt;&#x2F;code&gt;, the attesters check that they are not in any observed timely ILs, and otherwise return &lt;code&gt;INCLUSION_LIST_UNSATISFIED&lt;&#x2F;code&gt;. For these transactions, the builder can also apply the &lt;code&gt;priority_fee_shift_per_gas&lt;&#x2F;code&gt; described in the previous subsection, which however here is the same for all transactions since none have an initial ranking fee. Under &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt;, transaction processing is changed as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; unnormalized_transaction&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; enumerate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;transactions&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;  ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Processing begins after this existing line&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signer&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; gas_refund&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; effective_gas_price&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Redistribute priority fee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;IL_transaction&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;TRUE&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ranking_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; priority_fee_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        priority_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;priority_fee_shift_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span&gt; priority_fee_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ranking_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;priority_fee_shift_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        priority_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -=&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;priority_fee_shift_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The fee given to each includer (small division remainder burned)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    includer_fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; ranking_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; IL_COMMITTEE_SIZE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Increase the balances of the `IL_COMMITTEE_SIZE` includers &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; j&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;IL_COMMITTEE_SIZE&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;includer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;j&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; includer_fee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Proposer receives the priority fee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;    self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;author&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; priority_fee_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Payout to includers uses the same CL construction as in the previous subsection and the check on the &lt;code&gt;marginal_ranking_fee_per_gas&lt;&#x2F;code&gt; (dashed line in the figure) is once again removed.&lt;&#x2F;p&gt;
&lt;p&gt;If the ranking was based on the priority fee paid to the builder, the builder could offer kickbacks, allowing transactors to achieve a high ranking for free. To prevent this, the ranking portion of the fee must be distributed to a wider set of validators or be burned. Any arbitrary fee split between the builder and includers when &lt;code&gt;IL_transaction[i]=FALSE&lt;&#x2F;code&gt; would likely prove suboptimal and encourage off-chain agreements and builder–includer integration to circumvent the intended mechanism.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;allow-builder-to-shift-priority-fee-under-upil&quot;&gt;Allow builder to shift priority fee under UPIL&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;priority_fee_shift_per_gas&lt;&#x2F;code&gt; could be used also in the main UPIL specification. The primary rationale is that transactions using older formats then also can be included when &lt;code&gt;marginal_ranking_fee_per_gas&amp;gt;0&lt;&#x2F;code&gt;, by having the builder reallocate the priority fee. Another option is to simply charge all base fees and ranking fees jointly for all transactions at the end of the block, as previously discussed.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;upil-batch-auctions&quot;&gt;UPIL batch auctions&lt;&#x2F;h4&gt;
&lt;p&gt;A more extensive modification of the protocol is to make use of the improved CR and pricing of intra-block contention to eliminate the slack in the block, targeting 100% of the gas limit to facilitate scaling. The base fee can in such an implementation either be removed entirely, or the price information obtained via the marginal ranking fee can be relied upon for appropriate increases to the base fee.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Transactions using the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt; transaction formats can with this change spend up to their entire &lt;code&gt;max_fee_per_gas&lt;&#x2F;code&gt; to cover the &lt;code&gt;marginal_ranking_fee_per_gas&lt;&#x2F;code&gt; in blocks with high contention. Previously, the &lt;code&gt;max_fee_per_gas&lt;&#x2F;code&gt; could only be consumed by the &lt;code&gt;base_fee_per_gas&lt;&#x2F;code&gt; (which grows slowly each block) or the &lt;code&gt;priority_fee_per_gas&lt;&#x2F;code&gt; (which can be explicitly capped). A user setting &lt;code&gt;max_fee_per_gas&lt;&#x2F;code&gt; to twice the current &lt;code&gt;base_fee_per_gas&lt;&#x2F;code&gt;, while using a negligible &lt;code&gt;priority_fee_per_gas&lt;&#x2F;code&gt;, may be surprised to see the entire &lt;code&gt;max_fee_per_gas&lt;&#x2F;code&gt; consumed directly in the next block. However, this also implies that contention was high, and that they may have needed to spend the entire &lt;code&gt;max_fee_per_gas&lt;&#x2F;code&gt; for inclusion a few blocks later anyway. Importantly, the total fee paid will never exceed the &lt;code&gt;max_fee_per_gas&lt;&#x2F;code&gt; the user originally authorized.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP does not allow the builder to control which transactions that go into the block, with implications on CR and MEV. To retain full control over the block&#x27;s content, the builder would have to bribe includers to not surface unwanted transactions. A concern then is that the builder bribes includers to not surface transactions, such that it can build the most profitable block, by excluding unwanted transactions. However, even if all includers were to be willing to forgo their duty to uphold CR if there is a profit to be made, the profit from surfacing transactions in the IL against a fee would reasonably be higher than whatever bribe a competitive builder is able to pay; especially if some includers have already taken the bribe, making remaining IL space more valuable. The option otherwise remains to distribute the marginal ranking fee to includers.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Precompile for ML-DSA signature verification</title>
        <published>2025-10-15T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Renaud Dubois</name><uri>https://github.com/rdubois-crypto</uri>
	</author>
	
	<author>
		<name>Simon Masson</name><uri>https://github.com/simonmasson</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8051/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8051-ml-dsa-verification/25857" />
        

        <id>https://wg-eips.ritovision.com/8051/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:8051"
            label="EIP-8051" />
        

        
        

        
        <summary type="html">Precompiled contracts for FIPS-204 ML-DSA signature verification and an EVM-optimized variant</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8051/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal adds precompiled contracts that perform signature verifications using the NIST module-lattice signature scheme. Two instantiations are supported:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;ML-DSA&lt;&#x2F;strong&gt; — NIST-compliant version using SHAKE256 (FIPS-204),&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;ML-DSA-ETH&lt;&#x2F;strong&gt; — EVM-optimized version for cheaper on-chain verification:
&lt;ul&gt;
&lt;li&gt;Uses Keccak-based PRNG instead of SHAKE256 (leverages native KECCAK256 precompile)&lt;&#x2F;li&gt;
&lt;li&gt;Stores public-key polynomial &lt;code&gt;t1&lt;&#x2F;code&gt; in the NTT domain to skip one NTT during verification (convertible to regular encoding offline)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Two precompile contracts are specified:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;VERIFY_MLDSA&lt;&#x2F;code&gt; — verifies a ML-DSA signature compliant to FIPS-204.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;VERIFY_MLDSA_ETH&lt;&#x2F;code&gt; — verifies a ML-DSA-ETH signature replacing SHAKE256 with a more efficient hash function, deviating from FIPS-204.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Quantum computers pose a long-term risk to classical cryptographic algorithms. In particular, signature algorithms based on the hardness of the Elliptic Curve Discrete Logarithm Problem (ECDLP) such as secp256k1, are widely used in Ethereum and threatened by quantum algorithms. This exposes potentially on-chain assets and critical infrastructure to quantum adversaries.&lt;&#x2F;p&gt;
&lt;p&gt;Integrating post-quantum signature schemes is crucial to future-proof Ethereum and other EVM-based environments. It shall be noted that infrastructure for post-quantum signatures should be deployed before quantum adversaries are known to be practical because it takes on the order of years for existing applications to integrate.&lt;&#x2F;p&gt;
&lt;p&gt;Dilithium, a lattice-based scheme standardized by NIST as FIPS-204, offers high security against both classical and quantum adversaries. As the main winner of the standardization, the scheme has been selected as the main alternative to elliptic curve signature algorithms, making it a serious option for Ethereum.&lt;&#x2F;p&gt;
&lt;p&gt;While the signature size (2.4kB) and public key size (1.3kB) are larger than other post-quantum candidates such as Falcon FN-DSA, this scheme is more flexible in terms of parameters. It is thus possible to derive a zero-knowledge version of Dilithium, keeping the security of the scheme together with an efficient in-circuit verification. This EIP does not dig into the details of this instance.&lt;&#x2F;p&gt;
&lt;p&gt;ML-DSA has a simpler signer algorithm than FN-DSA, making hardware implementation easier.
Finally, ML-DSA is based on the same mathematical construction as Kyber, the Post-Quantum Key Exchange algorithm standardized by NIST as FIPS-203.
All these properties make ML-DSA well-suited for blockchain applications.&lt;&#x2F;p&gt;
&lt;p&gt;In the context of the Ethereum Virtual Machine, a precompile for Keccak256 hash function is already available, making ML-DSA verification much faster when instantiated with an extendable output function derived from Keccak than with SHAKE256, as specified in NIST submission. This EIP specifies two versions of ML-DSA enabling two important features: one version being fully compliant with the NIST specification, the other deviating in encodings to reduce the gas cost.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;The following specification provides two precompiled contracts:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;strong&gt;Precompiled contract&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;strong&gt;1&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;strong&gt;2&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Name&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;VERIFY_MLDSA&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;VERIFY_MLDSA_ETH&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Address&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;0x12&lt;&#x2F;td&gt;&lt;td&gt;0x13&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Gas cost&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;4500&lt;&#x2F;td&gt;&lt;td&gt;4500&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;While ML-DSA can be instantiated for three security levels: NIST level II, III and IV, this EIP only covers NIST level II, corresponding to 128 bits of security.&lt;&#x2F;p&gt;
&lt;p&gt;For the two variants of ML-DSA of this EIP, the following parameters are fixed:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Polynomial degree: &lt;code&gt;n = 256&lt;&#x2F;code&gt;,&lt;&#x2F;li&gt;
&lt;li&gt;Field modulus: &lt;code&gt;q = 8380417&lt;&#x2F;code&gt;,&lt;&#x2F;li&gt;
&lt;li&gt;Matrix dimensions: &lt;code&gt;k=4&lt;&#x2F;code&gt;, &lt;code&gt;l=4&lt;&#x2F;code&gt;,&lt;&#x2F;li&gt;
&lt;li&gt;Bounds of rejection: &lt;code&gt;γ_1 = 2¹⁷&lt;&#x2F;code&gt;, &lt;code&gt;γ_2 = (q-1)&#x2F;88&lt;&#x2F;code&gt;, &lt;code&gt;β = 78&lt;&#x2F;code&gt;,&lt;&#x2F;li&gt;
&lt;li&gt;Additional parameters: &lt;code&gt;η = 2&lt;&#x2F;code&gt;, &lt;code&gt;τ = 39&lt;&#x2F;code&gt;, &lt;code&gt;d = 13&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;These parameters strictly follow NIST. More precisely, &lt;code&gt;q&lt;&#x2F;code&gt;, &lt;code&gt;n&lt;&#x2F;code&gt;, &lt;code&gt;k&lt;&#x2F;code&gt;, &lt;code&gt;l&lt;&#x2F;code&gt; and &lt;code&gt;η&lt;&#x2F;code&gt; are chosen in order to ensure a hard MLWE related problem, and the remaining parameters are chosen for the hardness of MSIS as well as for the efficiency of the scheme. The parameter &lt;code&gt;β = τ * η = 78&lt;&#x2F;code&gt; is the norm bound used in the rejection condition &lt;code&gt;||z||_∞ &amp;lt; γ_1 - β&lt;&#x2F;code&gt; for the ML-DSA-44 parameter set in FIPS-204.&lt;&#x2F;p&gt;
&lt;p&gt;In terms of storage, ML-DSA public key can be derived by the verifier, making the overall public key of 1312 bytes. However, this increases the verifier cost, making the on-chain verification too expensive from a practical point of view. In this EIP, the verification algorithm takes the public key in raw format, meaning that the storage for the public key is:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The full matrix &lt;code&gt;A_hat&lt;&#x2F;code&gt; of 16 384 bytes,&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;tr&lt;&#x2F;code&gt; is stored in order to save one hash, with 32 bytes,&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;t1&lt;&#x2F;code&gt; is stored in the NTT domain in order to save one NTT, with 4096 bytes.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The overall storage for the &lt;strong&gt;public key&lt;&#x2F;strong&gt; is &lt;strong&gt;20512 bytes&lt;&#x2F;strong&gt;. The signature follows the same format as specified in FIPS-204: 32 bytes for &lt;code&gt;c_tilde&lt;&#x2F;code&gt;, 2304 bytes for the coefficients of &lt;code&gt;z&lt;&#x2F;code&gt;, and 84 bytes for &lt;code&gt;h&lt;&#x2F;code&gt;. In total, a &lt;strong&gt;signature&lt;&#x2F;strong&gt; requires &lt;strong&gt;2420 bytes&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;sub-algorithms-of-ml-dsa&quot;&gt;Sub-algorithms of ML-DSA&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;number-theoretic-transform&quot;&gt;Number Theoretic Transform&lt;&#x2F;h4&gt;
&lt;p&gt;Polynomial arithmetic is computed efficiently using Number Theoretic Transform (NTT). Efficient polynomial multiplication can be implemented following the draft NTT EIP. NTT inverse cost is roughly the same as an NTT: $n\log(n)$ additions and $n&#x2F;2 \log(n)$ multiplications over the field $\mathbb F_q$, where $q=8380417$ and $n=256$.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;extendable-output-function&quot;&gt;EXtendable Output Function&lt;&#x2F;h4&gt;
&lt;p&gt;The verification algorithm requires an eXtendable Output Function (XOF) made from a hash function.
This EIP provides two instantiations of a XOF:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;SHAKE256 is the XOF provided in NIST submission, a sponge construction derived from SHA256. Extracting bytes using SHAKE256 calls the &lt;code&gt;Keccak_f&lt;&#x2F;code&gt; permutation as described in Section 3.7 of FIPS-204. While this construction is standardized, it is expensive when computed in the Ethereum Virtual Machine because &lt;code&gt;Keccak_f&lt;&#x2F;code&gt; has no EVM opcode.&lt;&#x2F;li&gt;
&lt;li&gt;Keccak-PRNG is a XOF that is build from a counter-mode PRNG based on Keccak256. Generating new chunks of bytes requires an incrementing counter, as described in NIST SP800-90A revision 1. This XOF has the same interface as SHAKE256, but requires a &lt;code&gt;flip()&lt;&#x2F;code&gt; function that initiate a counter to &lt;code&gt;0&lt;&#x2F;code&gt;. Then, the &lt;code&gt;squeeze&lt;&#x2F;code&gt; function outputs as many bytes as needed using a counter mode as specified in SP800-90A revision 1. A precompile of &lt;code&gt;Keccak256&lt;&#x2F;code&gt; is available in the Ethereum Virtual Machine, making this XOF very efficient in the EVM.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;hints-in-ml-dsa&quot;&gt;Hints in ML-DSA&lt;&#x2F;h4&gt;
&lt;p&gt;ML-DSA requires some hint computation. More precisely, the function &lt;code&gt;use_hint&lt;&#x2F;code&gt; must be implemented following Algorithm 40 of FIPS-204. The output hint is a polynomial with coefficients in {0,1}. Another function &lt;code&gt;sum_hint&lt;&#x2F;code&gt; is required, and counts the number of non-zero values of the hint.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;sample-in-ball-challenge&quot;&gt;Sample In Ball Challenge&lt;&#x2F;h4&gt;
&lt;p&gt;In ML-DSA, a challenge is computed using a XOF.
This algorithm &lt;code&gt;sample_in_ball&lt;&#x2F;code&gt; outputs a polynomial with τ small coefficients (in {-1,1}).
The values of the coefficients as well as the position in the coefficients list is obtained using the XOF, as specified in Algorithm 29 of FIPS-204.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;ml-dsa-verification-algorithm&quot;&gt;ML-DSA verification algorithm&lt;&#x2F;h3&gt;
&lt;p&gt;Verifying a ML-DSA signature follows Algorithm 8 of FIPS-204, with &lt;code&gt;A_hat&lt;&#x2F;code&gt; of the public key stored in expanded format, and &lt;code&gt;t1&lt;&#x2F;code&gt; stored in the NTT domain.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; VERIFY_MLDSA&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;public_key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; message&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    A_hat&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; t1&lt;&#x2F;span&gt;&lt;span&gt; are&lt;&#x2F;span&gt;&lt;span&gt; decoded&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt; public_key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    c_tilde&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; z&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; h&lt;&#x2F;span&gt;&lt;span&gt; are&lt;&#x2F;span&gt;&lt;span&gt; decoded&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; h&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; properly&lt;&#x2F;span&gt;&lt;span&gt; encoded&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    μ&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; shake_256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tr&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;message&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;extract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;64&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sample_in_ball&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;c_tilde&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; τ&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; computed in the NTT domain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; three NTTs for c and z, and t1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; one final inverse NTT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Az_minus_ct1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; A_hat&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; z&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;^&lt;&#x2F;span&gt;&lt;span&gt;d&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; t1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    w_prime&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; h&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;use_hint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;Az_minus_ct1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt;γ_2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; check_norm_bound&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;z&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; γ_1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; β&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span&gt; c_tilde&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; shake_256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;μ&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; w_prime&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;extract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;ml-dsa-eth-verification-algorithm&quot;&gt;ML-DSA-ETH verification algorithm&lt;&#x2F;h3&gt;
&lt;p&gt;The verification of ML-DSA-ETH signatures follows the same algorithm with another hash function, with two differences:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;t1&lt;&#x2F;code&gt; from the public key is stored in the NTT domain in order to save one NTT. The multiplication by &lt;code&gt;2^d&lt;&#x2F;code&gt; is also precomputed. Note that this change can be seen as a change of representation.&lt;&#x2F;li&gt;
&lt;li&gt;A variant of &lt;code&gt;sample_in_ball&lt;&#x2F;code&gt; is defined using KeccakPRNG. The only difference from Algorithm 29 of FIPS-204 is that it requires a &lt;code&gt;flip()&lt;&#x2F;code&gt; between lines 3 and 4 so that it initializes the counter to &lt;code&gt;0&lt;&#x2F;code&gt; before starting squeezing. Note that this can be implemented in &lt;code&gt;absorb()&lt;&#x2F;code&gt; and &lt;code&gt;squeeze()&lt;&#x2F;code&gt; so that the same interface can be used as in SHAKE256.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; VERIFY_MLDSA_ETH&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;public_key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; message&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    A_hat&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; t1&lt;&#x2F;span&gt;&lt;span&gt; are&lt;&#x2F;span&gt;&lt;span&gt; decoded&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt; public_key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    c_tilde&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; z&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; h&lt;&#x2F;span&gt;&lt;span&gt; are&lt;&#x2F;span&gt;&lt;span&gt; decoded&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; h&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; properly&lt;&#x2F;span&gt;&lt;span&gt; encoded&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    μ&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; keccak_prng&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tr&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;message&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;extract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;64&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sample_in_ball_keccak_prng&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;c_tilde&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; τ&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; computed in the NTT domain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; two NTTs for c and z&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; one final inverse NTT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Az_minus_ct1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; A_hat&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; z&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; t1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    w_prime&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; h&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;use_hint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;Az_minus_ct1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt;γ_2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; check_norm_bound&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;z&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; γ_1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; β&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span&gt; c_tilde&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; keccak_prng&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;μ&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; w_prime&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;extract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;required-checks-in-ml-dsa-eth-verification&quot;&gt;Required checks in ML-DSA(-ETH) verification&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;The hint &lt;code&gt;h&lt;&#x2F;code&gt; needs to be properly encoded. The malformation of the hint is specified in Algorithm 21 of FIPS-204.&lt;&#x2F;li&gt;
&lt;li&gt;The element &lt;code&gt;z&lt;&#x2F;code&gt; must have a norm satisfying &lt;code&gt;||z||_∞ &amp;lt; γ_1 - β&lt;&#x2F;code&gt;. The norm &lt;code&gt;||.||_∞&lt;&#x2F;code&gt; is defined page 6 of FIPS-204.&lt;&#x2F;li&gt;
&lt;li&gt;The final hash output must be equal to the signature bytes &lt;code&gt;c_tilde&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;precompiled-contract-specification&quot;&gt;Precompiled contract specification&lt;&#x2F;h3&gt;
&lt;h3 id=&quot;ml-dsa-precompiled-contract&quot;&gt;ML-DSA precompiled contract&lt;&#x2F;h3&gt;
&lt;p&gt;The precompiled contract VERIFY_MLDSA is proposed with the following input and outputs, which are big-endian values:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Input data&lt;&#x2F;strong&gt;
&lt;ul&gt;
&lt;li&gt;32 bytes for the message&lt;&#x2F;li&gt;
&lt;li&gt;2420 bytes for ML-DSA signature&lt;&#x2F;li&gt;
&lt;li&gt;20512 bytes for the ML-DSA expanded public key&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Output data&lt;&#x2F;strong&gt;:
&lt;ul&gt;
&lt;li&gt;If the algorithm process succeeds, it returns 1 in 32 bytes format.&lt;&#x2F;li&gt;
&lt;li&gt;If the algorithm process fails, it returns 0 in 32 bytes format.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;error-cases&quot;&gt;Error Cases&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Insufficient gas has been provided.&lt;&#x2F;li&gt;
&lt;li&gt;Invalid input length (not compliant to described input)&lt;&#x2F;li&gt;
&lt;li&gt;Invalid field element encoding (≥ q)&lt;&#x2F;li&gt;
&lt;li&gt;Invalid norm  bound&lt;&#x2F;li&gt;
&lt;li&gt;Invalid hint check&lt;&#x2F;li&gt;
&lt;li&gt;Signature verification failure&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;ml-dsa-eth-precompiled-contract&quot;&gt;ML-DSA-ETH precompiled contract&lt;&#x2F;h3&gt;
&lt;p&gt;The precompiled contract VERIFY_MLDSA_ETH is proposed with the following input and outputs, which are big-endian values:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Input data&lt;&#x2F;strong&gt;
&lt;ul&gt;
&lt;li&gt;32 bytes for the message&lt;&#x2F;li&gt;
&lt;li&gt;2420 bytes for ML-DSA-ETH signature&lt;&#x2F;li&gt;
&lt;li&gt;20512 bytes for the ML-DSA-ETH expanded public key&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Output data&lt;&#x2F;strong&gt;:
&lt;ul&gt;
&lt;li&gt;If the algorithm process succeeds, it returns 1 in 32 bytes format.&lt;&#x2F;li&gt;
&lt;li&gt;If the algorithm process fails, it returns 0 in 32 bytes format.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;error-cases-1&quot;&gt;Error Cases&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Insufficient gas has been provided.&lt;&#x2F;li&gt;
&lt;li&gt;Invalid input length (not compliant to described input)&lt;&#x2F;li&gt;
&lt;li&gt;Invalid field element encoding (≥ q)&lt;&#x2F;li&gt;
&lt;li&gt;Invalid norm  bound&lt;&#x2F;li&gt;
&lt;li&gt;Invalid hint check&lt;&#x2F;li&gt;
&lt;li&gt;Signature verification failure&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;precompiled-contract-gas-usage&quot;&gt;Precompiled contract gas usage&lt;&#x2F;h3&gt;
&lt;p&gt;The cost of the &lt;strong&gt;VERIFY_MLDSA&lt;&#x2F;strong&gt; and &lt;strong&gt;VERIFY_MLDSA_ETH&lt;&#x2F;strong&gt; functions is dominated by the call to the NTTs, and the required hash calls for sampling in the ball (and for μ and the final check).
It represents in average 5 calls to the hash function. Taking linearly the cost of keccak256, and avoiding the context switching it represents 4500 gas.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;compliance-with-eip-7932&quot;&gt;Compliance with EIP-7932&lt;&#x2F;h3&gt;
&lt;p&gt;In compliance with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7932&#x2F;&quot;&gt;EIP-7932&lt;&#x2F;a&gt;,  the necessary parameters and structure for its integration are provided. &lt;code&gt;ALG_TYPE = 0xD1&lt;&#x2F;code&gt;  uniquely identifies ML-DSA transactions, set MAX_SIZE = 2441 bytes to accommodate the fixed-length signature_info container, and recommend a &lt;code&gt;GAS_PENALTY&lt;&#x2F;code&gt; of approximately &lt;code&gt;3000&lt;&#x2F;code&gt; gas subject to benchmarking. The verification function follows the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7932&#x2F;&quot;&gt;EIP-7932&lt;&#x2F;a&gt; model, parsing the signature_info, recovering the corresponding Dilithium public key, verifying the signature against the transaction payload hash, and deriving the signer&#x27;s Ethereum address as the last 20 bytes of keccak256(pubkey). This definition ensures that ML-DSA can be cleanly adopted within the &lt;code&gt;AlgorithmicTransaction&lt;&#x2F;code&gt; container specified by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7932&#x2F;&quot;&gt;EIP-7932&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;signature_info&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Container&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0xD1 for ML-DSA (NIST-compliant version),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0xD2 for ML-DSA-ETH (EVM-friendly version),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    version&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ML-DSA signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ByteVector&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2420&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; keccak256(pubkey)[12:]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    pubkey_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ByteVector&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;20&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In the format of EIP-7932:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;For the NIST-compliant version:&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;verify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature_info&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; payload_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature_info&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2441&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    version&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;      =&lt;&#x2F;span&gt;&lt;span&gt; signature_info&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;    =&lt;&#x2F;span&gt;&lt;span&gt; signature_info&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2421&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    pubkey_hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;  =&lt;&#x2F;span&gt;&lt;span&gt; signature_info&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2421&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2441&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; version&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;D1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; lookup_pubkey&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;pubkey_hash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; VERIFY_MLDSA&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;pubkey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; payload_hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; pubkey&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;For the EVM-friendly version:&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;verify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature_info&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; payload_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature_info&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2441&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    version&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;      =&lt;&#x2F;span&gt;&lt;span&gt; signature_info&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;    =&lt;&#x2F;span&gt;&lt;span&gt; signature_info&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2421&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    pubkey_hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;  =&lt;&#x2F;span&gt;&lt;span&gt; signature_info&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2421&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2441&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; version&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;D2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; lookup_pubkey&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;pubkey_hash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; VERIFY_MLDSA_ETH&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;pubkey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; payload_hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; pubkey&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The ML-DSA scheme was selected as a NIST-standardized post-quantum cryptographic algorithm due to its strong security guarantees and efficiency.&lt;&#x2F;p&gt;
&lt;p&gt;ML-DSA is a signature algorithm build from lattice-based cryptography. Specifically, its hardness relies on the Short Integer Solution (SIS) problem and the Learning With Errors (LWE) problem, which is believed to be hard for both classical and quantum computers.&lt;&#x2F;p&gt;
&lt;p&gt;ML-DSA (based on CRYSTALS-Dilithium) offers a strong balance between security, efficiency, and practicality compared to classical ECC and other post-quantum schemes. Its signature and key sizes remain reasonably small, making it practical for real-world deployments such as Ethereum blockchain. As the main winner of the NIST PQC standardization process, it benefits from a broad community consensus on its security, which is not yet the case for many alternatives. Moreover, its lattice-based structure allows flexible parameter tuning, making it easier to adapt for specialized contexts like zero-knowledge proofs. Schemes like Falcon (FN-DSA, another signature scheme built on top of lattice-based assumptions) have a more rigid parameterization, making zero-knowledge circuits larger, and thus proof computation more expensive.&lt;&#x2F;p&gt;
&lt;p&gt;Given the increasing urgency of transitioning to quantum-resistant cryptographic primitives or even having them ready in the event that research into quantum computers speeds up.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;A set of test vectors for verifying implementations is located in a separate file (see explanations in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8051&#x2F;assets&#x2F;README&#x2F;&quot;&gt;this file&lt;&#x2F;a&gt;):&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The file &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8051&#x2F;.&#x2F;assets&#x2F;mldsa_nist.rsp&quot;&gt;&lt;code&gt;mldsa_nist.rsp&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; containing the NIST submission KAT file for security level II.&lt;&#x2F;li&gt;
&lt;li&gt;The file &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8051&#x2F;.&#x2F;assets&#x2F;mldsa_evm.rsp&quot;&gt;&lt;code&gt;mldsa_evm.rsp&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; containing test vectors for the EVM-friendly version with the same format as NIST.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The reference implementation is the NIST submission code for ML-DSA. A reference implementation is provided by ZKNOX for the EVM-friendly version ML-DSA-ETH.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The derivation path to obtain the private key from the seed is (tbd).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Diamond Storage</title>
        <published>2025-10-11T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Nick Mudge</name><uri>https://github.com/mudgen</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8042/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-8042-diamond-storage/25718" />
        

        <id>https://wg-eips.ritovision.com/8042/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:8042"
            label="ERC-8042" />
        

        
        

        
        <summary type="html">Define storage locations for structs using human-readable, meaningful strings.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8042/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard formalizes the diamond storage pattern originally introduced by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2535&#x2F;&quot;&gt;ERC-2535 Diamonds&lt;&#x2F;a&gt; and widely adopted across smart contracts.&lt;&#x2F;p&gt;
&lt;p&gt;Though originally created for proxy contracts, diamond storage can be used to organize storage and data access within &lt;em&gt;any&lt;&#x2F;em&gt; smart contract.&lt;&#x2F;p&gt;
&lt;p&gt;Diamond storage defines the location of structs in contract storage using the &lt;code&gt;keccak256&lt;&#x2F;code&gt; hash of human-readable identifiers.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8042&#x2F;&quot;&gt;ERC-8042&lt;&#x2F;a&gt; standardizes this simple and production-proven approach, offering a lightweight alternative to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7201&#x2F;&quot;&gt;ERC-7201&lt;&#x2F;a&gt; for new and existing projects.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;On March 10, 2020, a change to the Solidity compiler introduced the ability to assign structs to any storage location. This enabled a new pattern for using separate areas of storage. The pattern became known as diamond storage, as it was first popularized by ERC-2535 Diamonds and has since been widely used.&lt;&#x2F;p&gt;
&lt;p&gt;Later, on June 20, 2023, ERC-7201 was introduced to standardize this general storage pattern. However, the formula that ERC-7201 proposed for generating storage locations differed from the one already established and in active use by diamond storage.&lt;&#x2F;p&gt;
&lt;p&gt;ERC-8042 standardizes diamond storage for new projects and validates past diamond storage implementations.&lt;&#x2F;p&gt;
&lt;p&gt;While ERC-7201 defines a generalized mechanism for storage namespaces, ERC-8042 preserves the simplicity and backward compatibility of the diamond storage convention already deployed in production across many projects.&lt;&#x2F;p&gt;
&lt;p&gt;Developers may prefer diamond storage for its simplicity, restricted ASCII identifiers, and direct hash-based computation of storage locations.&lt;&#x2F;p&gt;
&lt;p&gt;This standard can be used by tools to find and access data within smart contract storage.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Diamond storage defines where structs are located in contract storage.&lt;&#x2F;p&gt;
&lt;p&gt;A diamond storage identifier is defined as a string containing only printable ASCII characters. That is characters &lt;code&gt;0x20&lt;&#x2F;code&gt; through &lt;code&gt;0x7E&lt;&#x2F;code&gt; inclusive.&lt;&#x2F;p&gt;
&lt;p&gt;The location of a diamond storage struct is determined by the &lt;code&gt;keccak256&lt;&#x2F;code&gt; hash of a diamond storage identifier.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;recommendations&quot;&gt;Recommendations&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;&lt;h4 id=&quot;use-solidity-s-string-literals&quot;&gt;Use Solidity&#x27;s string literals&lt;&#x2F;h4&gt;
&lt;p&gt;A string literal is an ASCII string type that is literally written between quotes, for example: &lt;code&gt;&quot;this is a string literal&quot;&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;It is recommended to use Solidity&#x27;s string literals to create diamond storage identifiers because the Solidity compiler enforces that they only contain printable ASCII characters, characters &lt;code&gt;0x20&lt;&#x2F;code&gt; through &lt;code&gt;0x7E&lt;&#x2F;code&gt; inclusive. Hex (&lt;code&gt;\xNN&lt;&#x2F;code&gt;) and Unicode (&lt;code&gt;\uNNNN&lt;&#x2F;code&gt;) escape sequences should &lt;strong&gt;NOT&lt;&#x2F;strong&gt; be used in diamond storage identifiers.&lt;&#x2F;p&gt;
&lt;p&gt;It is recommended to use compile-time constant string literals. Here is an example:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;bytes32 constant STORAGE_POSITION = keccak256(&quot;myproject.erc721.registry&quot;);&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;h4 id=&quot;use-unique-human-readable-meaningful-strings&quot;&gt;Use unique, human-readable, meaningful strings&lt;&#x2F;h4&gt;
&lt;p&gt;A human-readable string is a string that humans can normally read and understand, like &quot;Transaction successful&quot;.&lt;&#x2F;p&gt;
&lt;p&gt;A meaningful string in this context is a string that appropriately names or describes a storage space, or uses a pattern to do so. For example, &lt;code&gt;&quot;myproject.erc721.registry&quot;&lt;&#x2F;code&gt; is a hierarchical pattern that specifies &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; related storage for a registry. The string &lt;code&gt;&quot;car.fish.piano.run&quot;&lt;&#x2F;code&gt; is not a meaningful string because it is random and does not appropriately name or describe something.&lt;&#x2F;p&gt;
&lt;p&gt;Diamond storage identifiers should be unique, human-readable, meaningful strings.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;h4 id=&quot;do-not-use-unicode-literals&quot;&gt;Do NOT use Unicode literals&lt;&#x2F;h4&gt;
&lt;p&gt;Unicode literals can contain invisible characters and other non-ASCII characters which violates the specification of this standard.&lt;&#x2F;p&gt;
&lt;p&gt;Here is an example of a Unicode literal in Solidity: &lt;code&gt;string memory a = unicode&quot;Hello 😃&quot;;&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Unicode literals should &lt;strong&gt;NOT&lt;&#x2F;strong&gt; be used to create diamond storage identifiers.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;h4 id=&quot;do-not-use-the-space-0x20-character&quot;&gt;Do not use the space &lt;code&gt;0x20&lt;&#x2F;code&gt; character&lt;&#x2F;h4&gt;
&lt;p&gt;Including the space (&lt;code&gt;0x20&lt;&#x2F;code&gt;) character in diamond storage identifiers is not recommended, as it may interfere with tooling such as the NatSpec tag described next.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;erc-8042-natspec-tag&quot;&gt;ERC-8042 NatSpec tag&lt;&#x2F;h3&gt;
&lt;p&gt;ERC-7201 defines the NatSpec tag &lt;code&gt;@custom:storage-location &amp;lt;FORMULA_ID&amp;gt;:&amp;lt;NAMESPACE_ID&amp;gt;&lt;&#x2F;code&gt;, where &lt;code&gt;&amp;lt;FORMULA_ID&amp;gt;&lt;&#x2F;code&gt; identifies a formula used to compute the storage location of a struct based on the namespace id.&lt;&#x2F;p&gt;
&lt;p&gt;The formula identified by &lt;code&gt;erc8042&lt;&#x2F;code&gt; is defined as &lt;code&gt;erc8042(id: string literal) = keccak256(id)&lt;&#x2F;code&gt;. In Solidity, this corresponds to the expression &lt;code&gt;keccak256(id)&lt;&#x2F;code&gt;. When using this formula the annotation becomes &lt;code&gt;@custom:storage-location erc8042:&amp;lt;NAMESPACE_ID&amp;gt;&lt;&#x2F;code&gt;. For example, &lt;code&gt;@custom:storage-location erc8042:myproject.erc721.registry&lt;&#x2F;code&gt; annotates diamond storage with id &lt;code&gt;&quot;myproject.erc721.registry&quot;&lt;&#x2F;code&gt; rooted at &lt;code&gt;erc8042(&quot;myproject.erc721.registry&quot;)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Proxy contracts and contracts that use &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; need a reliable and secure way to define, document, and manage separate areas of smart contract storage.&lt;&#x2F;p&gt;
&lt;p&gt;In March 2020, diamond storage established a way to do this and has been in use since then. However, diamond storage wasn&#x27;t formalized as a standard, which is important to clarify its mechanics, usage and precise specification.&lt;&#x2F;p&gt;
&lt;p&gt;In June 2023, ERC-7201 Namespaced Storage Layout standardized the general pattern but has looser restrictions on namespace ids and a more complicated formula for calculating storage locations. Some people may prefer using ERC-7201, especially if they may auto-generate machine-readable or random strings for their namespace ids.&lt;&#x2F;p&gt;
&lt;p&gt;Some people may prefer ERC-8042 Diamond Storage for its ASCII-enforced, human-readable, meaningful strings and simple calculation of storage locations.&lt;&#x2F;p&gt;
&lt;p&gt;ERC-2535 Diamonds first introduced the pattern of distinct storage areas for smart contracts. ERC-7201 later standardized the idea. ERC-8042 standardizes the original, simpler diamond storage variant for new projects and legacy compatibility.&lt;&#x2F;p&gt;
&lt;p&gt;Though originally created for proxy contracts, diamond storage can be used to organize storage and data access within &lt;em&gt;any&lt;&#x2F;em&gt; smart contract.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;comparing-erc-8042-and-erc-7201&quot;&gt;Comparing ERC-8042 and ERC-7201&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;erc-7201&quot;&gt;ERC-7201&lt;&#x2F;h4&gt;
&lt;p&gt;ERC-7201 applies a formula to a namespace id to generate a storage location. Per the ERC-7201 specification a namespace id is a string that should not contain any whitespace characters. A namespace id has no other restrictions. So a namespace id could be something meaningful like &lt;code&gt;mycompany.projectA.erc721&lt;&#x2F;code&gt; or it could be a series of random bytes, characters or words, etc.&lt;&#x2F;p&gt;
&lt;p&gt;ERC-7201 uses the following formula, given in Solidity, to generate a storage location: &lt;code&gt;keccak256(abi.encode(uint256(keccak256(bytes(namespace id))) - 1)) &amp;amp; ~bytes32(uint256(0xff))&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;The first part of the ERC-7201 formula &lt;code&gt;keccak256(abi.encode(uint256(keccak256(bytes(namespace id))) - 1))&lt;&#x2F;code&gt; ensures that the input bytes to the second call to &lt;code&gt;keccak256&lt;&#x2F;code&gt; will not match any input bytes used by Solidity&#x27;s types that also use &lt;code&gt;keccak256&lt;&#x2F;code&gt; to determine storage locations. This makes it possible to use any sequence of bytes for the namespace id.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The last part of ERC-7201, &lt;code&gt;&amp;amp; ~bytes32(uint256(0xff))&lt;&#x2F;code&gt; ensures that the final storage location is a multiple of 256 which may provide a gas optimization in the future.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h4 id=&quot;erc-8042&quot;&gt;ERC-8042&lt;&#x2F;h4&gt;
&lt;p&gt;ERC-8042 identifiers can only contain printable ASCII characters and recommends using Solidity&#x27;s string literals which enforces this constraint.&lt;&#x2F;p&gt;
&lt;p&gt;ERC-8042 recommends human-readable, meaningful strings for diamond storage identifiers.&lt;&#x2F;p&gt;
&lt;p&gt;ERC-8042 uses the following formula, given in Solidity, to generate a storage location: &lt;code&gt;keccak256(string literal)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Diamond storage as described by this standard has been in use for 5 years. This standard recognizes and standardizes all previous uses of diamond storage that conform to the specification.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;This is a simple example of a contract that uses diamond storage:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC721Registry&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A registry contract for tracking ERC721 contracts.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *         Allows adding ERC721 contract addresses up to a configurable limit.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; EIP-8042 Diamond Storage is used to organize and manage access to storage.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721Registry&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Reverts when the registry reaches its configured capacity.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721RegistryFull&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Struct storage position defined by keccak256 hash &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         of diamond storage identifier.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; STORAGE_POSITION &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;myproject.erc721.registry&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Storage layout for the ERC721 registry, following EIP-8042.  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - `erc721Contracts`: Dynamic array of registered ERC721 contract addresses.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      - `registryLimit`: Maximum allowed entries.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @custom:storage&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;-location erc8042:myproject.erc721.registry&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721RegistryStorage&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; erc721Contracts&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; registryLimit&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns a pointer to the ERC721RegistryStorage struct in storage.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Uses inline assembly to access the storage slot defined by STORAGE_POSITION.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ERC173Storage struct in storage.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getStorage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;  returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;ERC721RegistryStorage&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; storage&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; s&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; position &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; STORAGE_POSITION&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      s&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span&gt; position&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sets the maximum number of ERC721 contracts the registry can hold.  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _newLimit&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; New registry capacity limit.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setRegistryLimit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _newLimit&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    getStorage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;registryLimit &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _newLimit&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Adds an ERC721 contract address to the registry.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Reverts with `ERC721RegistryFull` if the registry is full.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _erc721Contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the ERC721 contract to register.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addERC721Contract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _erc721Contract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ERC721RegistryStorage &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;storage&lt;&#x2F;span&gt;&lt;span&gt; s &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getStorage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;s&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;erc721Contracts&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; s&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;registryLimit&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721RegistryFull&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    s&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;erc721Contracts&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;push&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_erc721Contract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns a list of all registered ERC721 contract addresses.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Array&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; of registered ERC721 contract addresses.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getERC721Registry&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getStorage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;erc721Contracts&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;uniqueness-of-identifiers&quot;&gt;Uniqueness of identifiers&lt;&#x2F;h3&gt;
&lt;p&gt;Two independent contracts or libraries using the same human-readable string will map to the same storage slot. Developers must ensure that diamond storage identifiers are unique within a contract system to prevent unintentional data overlap or corruption. A common practice is to prefix identifiers with a project, organization, or standard name (for example, &lt;code&gt;&quot;myproject.erc721.registry&quot;&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;ascii-input-restriction-to-prevent-storage-collisions&quot;&gt;ASCII Input Restriction to Prevent Storage Collisions&lt;&#x2F;h3&gt;
&lt;p&gt;To prevent storage collisions, diamond storage identifiers must consist only of printable ASCII characters, specifically the range &lt;code&gt;0x20&lt;&#x2F;code&gt; to &lt;code&gt;0x7E&lt;&#x2F;code&gt; inclusive. Identifiers must not include Unicode escape sequences (&lt;code&gt;\uNNNN&lt;&#x2F;code&gt;) or hexadecimal escape sequences (&lt;code&gt;\xNN&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;Solidity’s storage slot encoding, as produced by &lt;code&gt;abi.encode(p)&lt;&#x2F;code&gt;, contains non-printable bytes, particularly null bytes (&lt;code&gt;0x00&lt;&#x2F;code&gt;), due to Solidity’s default storage layout and padding rules.&lt;&#x2F;p&gt;
&lt;p&gt;Allowing identifiers to include such bytes could enable a malicious developer to craft an identifier like &lt;code&gt;&quot;config\x00\x00...&quot;&lt;&#x2F;code&gt;. The bytes of such an identifier could collide with the storage encoded input of mappings, dynamic arrays, strings and bytes which use &lt;code&gt;keccak256&lt;&#x2F;code&gt; to compute storage locations. Such collisions could result in overwrites, corruption of contract state, or security vulnerabilities.&lt;&#x2F;p&gt;
&lt;p&gt;Restricting identifiers to printable ASCII removes this exploitable source of collision. While this restriction does not provide a mathematical guarantee that collisions are impossible — because, in theory, a sufficiently large storage layout position (&lt;code&gt;p&lt;&#x2F;code&gt;) could accidentally contain all printable ASCII bytes — the probability of this occurring is extremely small, and impractical.&lt;&#x2F;p&gt;
&lt;p&gt;By using human-readable, meaningful strings for identifiers, the practical likelihood of any collision is virtually zero, providing strong protection for the integrity and safety of contract storage.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;string-literals&quot;&gt;String Literals&lt;&#x2F;h3&gt;
&lt;p&gt;The specification recommends using string literals to create diamond storage identifiers because the Solidity compiler enforces that only printable ASCII characters are used. However, string literals should not use Unicode escape sequences (&lt;code&gt;\uNNNN&lt;&#x2F;code&gt; ) or hexadecimal escape sequences (&lt;code&gt;\xNN&lt;&#x2F;code&gt; ).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;unicode-literals&quot;&gt;Unicode Literals&lt;&#x2F;h3&gt;
&lt;p&gt;Unicode literals (e.g. &lt;code&gt;unicode&quot;Hello 😃&quot;&lt;&#x2F;code&gt;) should not be used to create diamond storage identifiers because they can contain non-printable bytes and characters, and they can be used to obfuscate identifiers by using characters that look like other characters. For example, the Cyrillic character &lt;code&gt;а&lt;&#x2F;code&gt; (&lt;code&gt;\u0430&lt;&#x2F;code&gt;) looks identical to the ASCII character &lt;code&gt;a&lt;&#x2F;code&gt; (&lt;code&gt;\u0061&lt;&#x2F;code&gt;).” In addition Unicode has control characters that change the direction text is displayed.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;keccak256-hash-collision-resistance&quot;&gt;&lt;code&gt;keccak256&lt;&#x2F;code&gt; Hash Collision Resistance&lt;&#x2F;h3&gt;
&lt;p&gt;The location of a diamond storage struct is determined by the output of the &lt;code&gt;keccak256&lt;&#x2F;code&gt; hash function. Some developers may wonder about the likelihood that a diamond storage struct lands at an address where it will accidentally overwrite existing storage data. The 256-bit address space of contract storage is so vast that the likelihood of data overlap is statistically improbable.&lt;&#x2F;p&gt;
&lt;p&gt;Solidity mappings, dynamic arrays, strings and bytes also use &lt;code&gt;keccak256&lt;&#x2F;code&gt; to determine their location in contract storage.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Contract-Level Onchain Metadata</title>
        <published>2025-10-10T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Prem Makeig</name><uri>https://github.com/nxt3d</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8049/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-8049-contract-level-metadata-with-diamond-storage/25819" />
        

        <id>https://wg-eips.ritovision.com/8049/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:8049"
            label="ERC-8049" />
        

        
        

        
        <summary type="html">Onchain metadata for arbitrary contracts with optional Diamond Storage for predictable data storage locations.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8049/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC defines a standard for storing contract-level metadata onchain. It extends &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7572&#x2F;&quot;&gt;ERC-7572&lt;&#x2F;a&gt;&#x27;s contract-level metadata concept by providing onchain storage. Contracts MAY optionally use &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8042&#x2F;&quot;&gt;ERC-8042&lt;&#x2F;a&gt;&#x27;s Diamond Storage pattern for predictable storage locations, enabling cross-chain compatibility and supporting upgradable contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Contract metadata today typically relies on offchain storage such as URLs or IPFS, creating trust and availability risks—servers go down, domains expire, and malicious actors can modify data without onchain record. Storing metadata onchain makes contract identity censorship-resistant and enables wallets and block explorers to display verifiable information without trusting external services.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;required-metadata-function-and-event&quot;&gt;Required Metadata Function and Event&lt;&#x2F;h3&gt;
&lt;p&gt;Contracts implementing this ERC MUST implement the following interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC8049&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get contract metadata value for a key.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getContractMetadata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when contract metadata is updated.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ContractMetadataUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; indexedKey&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Contracts implementing this ERC MAY also expose a &lt;code&gt;setContractMetadata(string calldata key, bytes calldata value)&lt;&#x2F;code&gt; function to allow metadata updates, with write policy determined by the contract.&lt;&#x2F;p&gt;
&lt;p&gt;Contracts implementing this ERC MUST emit the following event when metadata is set:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ContractMetadataUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; indexedKey&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;key-value-pairs&quot;&gt;Key&#x2F;Value Pairs&lt;&#x2F;h3&gt;
&lt;p&gt;This ERC specifies that the key is a string type and the value is bytes type. This provides flexibility for storing any type of data while maintaining an intuitive string-based key interface.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;optional-key-parameters&quot;&gt;Optional Key Parameters&lt;&#x2F;h3&gt;
&lt;p&gt;Keys MAY include parameters to represent variations or instances of a metadata type, such as &lt;code&gt;&quot;registration: 1&quot;&lt;&#x2F;code&gt; or &lt;code&gt;&quot;name: Maria&quot;&lt;&#x2F;code&gt;; see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8119&#x2F;&quot;&gt;ERC-8119&lt;&#x2F;a&gt;: Key Parameters.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;optional-diamond-storage&quot;&gt;Optional Diamond Storage&lt;&#x2F;h3&gt;
&lt;p&gt;Contracts implementing this ERC MAY use Diamond Storage pattern for predictable storage locations. If implemented, contracts MUST use the namespace ID &lt;code&gt;&quot;erc8049.contract.metadata.storage&quot;&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The Diamond Storage pattern provides predictable storage locations for data, which is useful for cross-chain applications using inclusion proofs and for upgradable contracts. For more details on Diamond Storage, see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8042&#x2F;&quot;&gt;ERC-8042&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;value-interpretation&quot;&gt;Value Interpretation&lt;&#x2F;h3&gt;
&lt;p&gt;If no standard is specified for a metadata value, clients MAY assume the value is a UTF-8 encoded string (bytes(string)) unless otherwise specified by the implementing contract or protocol.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;examples&quot;&gt;Examples&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;example-basic-contract-information&quot;&gt;Example: Basic Contract Information&lt;&#x2F;h4&gt;
&lt;p&gt;A contract can store basic information about itself:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Key: &lt;code&gt;&quot;name&quot;&lt;&#x2F;code&gt; → Value: &lt;code&gt;bytes(&quot;MyToken&quot;)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Key: &lt;code&gt;&quot;description&quot;&lt;&#x2F;code&gt; → Value: &lt;code&gt;bytes(&quot;A decentralized exchange&quot;)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Key: &lt;code&gt;&quot;collaborators&quot;&lt;&#x2F;code&gt; → Value: &lt;code&gt;bytes(abi.encodePacked(address1, address2, address3))&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;example-ens-name-for-contract&quot;&gt;Example: ENS Name for Contract&lt;&#x2F;h4&gt;
&lt;p&gt;A contract can specify its ENS name using this standard:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Key: &lt;code&gt;&quot;ens_name&quot;&lt;&#x2F;code&gt; → Value: &lt;code&gt;bytes(&quot;mycontract.eth&quot;)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This allows clients to discover the contract&#x27;s ENS name and resolve it to get additional information about the contract.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;optional-metadata-hooks&quot;&gt;Optional Metadata Hooks&lt;&#x2F;h3&gt;
&lt;p&gt;Contracts implementing this ERC MAY use hooks to redirect metadata resolution to a different contract. For the full specification, see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8121&#x2F;&quot;&gt;ERC-8121&lt;&#x2F;a&gt;. When using hooks with contract metadata, the target function MUST be &lt;code&gt;getContractMetadata(string)&lt;&#x2F;code&gt; returning &lt;code&gt;bytes&lt;&#x2F;code&gt;. The hook selector is &lt;code&gt;0x9e574b14&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This design prioritizes simplicity and flexibility by using a string-key, bytes-value store that provides an intuitive interface for any type of contract metadata. The minimal interface with a single &lt;code&gt;getContractMetadata&lt;&#x2F;code&gt; function provides all necessary functionality. The optional &lt;code&gt;setContractMetadata&lt;&#x2F;code&gt; function enables flexible access control for metadata updates. The required &lt;code&gt;ContractMetadataUpdated&lt;&#x2F;code&gt; event provides transparent audit trails with indexed key for efficient filtering. Contracts that need predictable storage locations can optionally use Diamond Storage pattern. This makes the standard suitable for diverse use cases including contract identification, collaboration tracking, and custom metadata storage.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Fully compatible with existing smart contracts.&lt;&#x2F;li&gt;
&lt;li&gt;Non-supporting clients can ignore the scheme.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The interface is defined in the Required Metadata Function and Event section above. Here are reference implementations:&lt;&#x2F;p&gt;
&lt;h3 id=&quot;basic-implementation&quot;&gt;Basic Implementation&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.25&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERC8049.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BasicContractMetadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC8049&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Simple mapping for contract-level metadata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt; key &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _metadata&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getContractMetadata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _metadata&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;key&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setContractMetadata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _metadata&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;key&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ContractMetadataUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;diamond-storage-implementation&quot;&gt;Diamond Storage Implementation&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.25&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERC8049.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DiamondContractMetadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC8049&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ContractMetadataStorage&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt; key &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; metadata&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; keccak256(&amp;quot;erc8049.contract.metadata.storage&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; CONTRACT_METADATA_STORAGE_LOCATION &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;erc8049.contract.metadata.storage&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _getContractMetadataStorage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;ContractMetadataStorage&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; storage&lt;&#x2F;span&gt;&lt;span&gt; $&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; location &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; CONTRACT_METADATA_STORAGE_LOCATION&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            $&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span&gt; location&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getContractMetadata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ContractMetadataStorage &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;storage&lt;&#x2F;span&gt;&lt;span&gt; $ &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _getContractMetadataStorage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; $&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;metadata&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;key&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setContractMetadata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ContractMetadataStorage &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;storage&lt;&#x2F;span&gt;&lt;span&gt; $ &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _getContractMetadataStorage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        $&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;metadata&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;key&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ContractMetadataUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC is designed to put metadata onchain, providing security benefits through onchain storage.&lt;&#x2F;p&gt;
&lt;p&gt;Implementations that choose to use the optional Diamond Storage pattern should consider the security considerations of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8042&#x2F;&quot;&gt;ERC-8042&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>State-access gas cost update</title>
        <published>2025-10-03T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Maria Silva</name><uri>https://github.com/misilva73</uri>
	</author>
	
	<author>
		<name>Wei Han Ng</name><uri>https://github.com/weiihann</uri>
	</author>
	
	<author>
		<name>Ansgar Dietrichs</name><uri>https://github.com/adietrichs</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8038/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8038-state-access-gas-cost-update/25693" />
        

        <id>https://wg-eips.ritovision.com/8038/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:8038"
            label="EIP-8038" />
        

        
        

        
        <summary type="html">Increases the gas cost of state-access operations to reflect Ethereum’s larger state</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8038/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP updates the gas cost of state-access operations to reflect Ethereum&#x27;s larger state and the consequent slowdown of these operations. It raises the base costs for &lt;code&gt;GAS_STORAGE_UPDATE&lt;&#x2F;code&gt;, &lt;code&gt;GAS_COLD_SLOAD&lt;&#x2F;code&gt;, and &lt;code&gt;GAS_COLD_ACCOUNT_ACCESS&lt;&#x2F;code&gt; and updates the access cost for &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; and &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt;. The design coordinates with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8032&#x2F;&quot;&gt;EIP-8032&lt;&#x2F;a&gt;: before EIP-8032, parameters assume worst-case contract size; after EIP-8032, they assume worst-case up to &lt;code&gt;ACTIVATION_THRESHOLD&lt;&#x2F;code&gt;, with additional depth-based scaling beyond.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The gas price of accessing state has not been updated for quite some time. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt; was included in the Berlin fork in March 2021 and raised the costs of state-accessing opcodes. Yet, since then, Ethereum&#x27;s state has grown significantly, thus deteriorating the performance of these operations. This proposal further raises state access costs to better align them with the current performance of state access operations, in relation to other operations.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; and &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt; have the same access cost as &lt;code&gt;BALANCE&lt;&#x2F;code&gt; and &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt;. However, &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; and &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt; require two database reads - first to load the account object (which includes the &lt;code&gt;nonce&lt;&#x2F;code&gt;, &lt;code&gt;balance&lt;&#x2F;code&gt;, &lt;code&gt;codeHash&lt;&#x2F;code&gt; and &lt;code&gt;storageRoot&lt;&#x2F;code&gt;), and second to collect the required information (the code size and bytecode respectively). Therefore, the access cost of &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; and &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt; should be higher when compared with the other account read operations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;p&gt;Upon activation of this EIP, the following parameters of the gas model are renamed:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&quot;text-align: center&quot;&gt;&lt;strong&gt;Parameter&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;&lt;strong&gt;New name&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;GAS_STORAGE_UPDATE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;GAS_COLD_STORAGE_WRITE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;GAS_COLD_SLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;GAS_COLD_STORAGE_ACCESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The following parameters of the gas model are updated:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&quot;text-align: center&quot;&gt;&lt;strong&gt;Parameter&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;&lt;strong&gt;Current value&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;&lt;strong&gt;New value&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;&lt;strong&gt;Increase&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;&lt;strong&gt;Operations affected&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;GAS_COLD_STORAGE_WRITE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;5,000&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;SSTORE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;GAS_COLD_STORAGE_ACCESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;2,100&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;SSTORE&lt;&#x2F;code&gt; and &lt;code&gt;SLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;GAS_COLD_ACCOUNT_ACCESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;2,600&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;*CALL&lt;&#x2F;code&gt; opcodes, &lt;code&gt;BALANCE&lt;&#x2F;code&gt;, &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; and &lt;code&gt;EXT*&lt;&#x2F;code&gt; opcodes&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;GAS_WARM_ACCESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;100&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;SSTORE&lt;&#x2F;code&gt;, &lt;code&gt;SLOAD&lt;&#x2F;code&gt;, &lt;code&gt;*CALL&lt;&#x2F;code&gt; opcodes, &lt;code&gt;BALANCE&lt;&#x2F;code&gt; and &lt;code&gt;EXT*&lt;&#x2F;code&gt; opcodes&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;GAS_STORAGE_CLEAR_REFUND&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;4,800&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;SSTORE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;ACCESS_LIST_STORAGE_KEY_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;1,900&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;SSTORE&lt;&#x2F;code&gt; and &lt;code&gt;SLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;ACCESS_LIST_ADDRESS_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;2,400&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;*CALL&lt;&#x2F;code&gt; opcodes, &lt;code&gt;BALANCE&lt;&#x2F;code&gt;, &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; and &lt;code&gt;EXT*&lt;&#x2F;code&gt; opcodes&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;&amp;lt;-- TODO --&amp;gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;ext-family-update&quot;&gt;&lt;code&gt;EXT*&lt;&#x2F;code&gt; family update&lt;&#x2F;h3&gt;
&lt;p&gt;Besides these parameter changes, the gas cost formula for &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; and &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt; is updated to include an additional &lt;code&gt;GAS_WARM_ACCESS&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;accessed_addresses&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    access_gas_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GAS_WARM_ACCESS&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;accessed_addresses&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    access_gas_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GAS_COLD_ACCOUNT_ACCESS&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GAS_WARM_ACCESS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;benchmarking&quot;&gt;Benchmarking&lt;&#x2F;h3&gt;
&lt;p&gt;This proposal does not yet have finalized numbers. To achieve this, we require stateful benchmarks, which are currently in development. Once we collect that data, we will set the final numbers.&lt;&#x2F;p&gt;
&lt;p&gt;&amp;lt;-- TODO --&amp;gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;special-case-for-extcodesize-and-extcodecopy&quot;&gt;Special case for &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; and &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Differently from other account read operations, &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; and &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt; make two reads to the database. The first read is the same, where the object of the target account is loaded. This object includes the account&#x27;s &lt;code&gt;nonce&lt;&#x2F;code&gt;, &lt;code&gt;balance&lt;&#x2F;code&gt;, &lt;code&gt;codeHash&lt;&#x2F;code&gt; and &lt;code&gt;storageRoot&lt;&#x2F;code&gt;. Then, these operations do another read to collect either the code size or the bytecode of the account. This second read is to an already warmed account, and thus we propose to price it as &lt;code&gt;GAS_WARM_ACCESS&lt;&#x2F;code&gt; for consistency.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;interaction-with-eip-8032&quot;&gt;Interaction with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8032&#x2F;&quot;&gt;EIP-8032&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8032&#x2F;&quot;&gt;EIP-8032&lt;&#x2F;a&gt; proposes modifying the &lt;code&gt;SSTORE&lt;&#x2F;code&gt; cost formula to account for the storage size of a contract. This is a more accurate method for pricing storage writes. It allows writes to smaller contracts to be cheaper than writes to large contracts, which helps with scaling and is fairer to users. However, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8032&#x2F;&quot;&gt;EIP-8032&lt;&#x2F;a&gt; is not yet scheduled for inclusion in a fork, and, as such, this proposal considers two cases for setting the values of &lt;code&gt;GAS_COLD_STORAGE_WRITE&lt;&#x2F;code&gt; and &lt;code&gt;GAS_COLD_STORAGE_ACCESS&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Before &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8032&#x2F;&quot;&gt;EIP-8032&lt;&#x2F;a&gt;. In this case, we set the parameters assuming a worst-case contract size, which makes state-accessing operations more expensive, independently of the contract size.&lt;&#x2F;li&gt;
&lt;li&gt;After &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8032&#x2F;&quot;&gt;EIP-8032&lt;&#x2F;a&gt;. In this case, we set the parameters assuming the worst-case until &lt;code&gt;ACTIVATION_THRESHOLD&lt;&#x2F;code&gt;, which is the parameter in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8032&#x2F;&quot;&gt;EIP-8032&lt;&#x2F;a&gt; that triggers the depth-based cost. This means that contract sizes below the threshold have the same access costs, while contracts above the threshold get exponentially more expensive with increasing size.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;interaction-with-eip-2926&quot;&gt;Interaction with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2926&#x2F;&quot;&gt;EIP-2926&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2926&#x2F;&quot;&gt;EIP-2926&lt;&#x2F;a&gt; proposes to change how code is store in the state trie. One of the changes of this proposal is to include the code size as a new field in the account object (&lt;code&gt;codeSize&lt;&#x2F;code&gt;). With this change, the code size can be directly accessed with a single read to the database and thus &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; should maintain its previous cost formula, without including the additional &lt;code&gt;GAS_WARM_ACCESS&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;interaction-with-eip-7928&quot;&gt;Interaction with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7928&#x2F;&quot;&gt;EIP-7928&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7928&#x2F;&quot;&gt;EIP-7928&lt;&#x2F;a&gt; introduces Block-Level Access Lists, which enable parallel disk reads, parallel transaction validation, and executionless state updates through client optimizations. The initial benchmarks won&#x27;t take into consideration these optimizations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This is a backwards-incompatible gas repricing that requires a scheduled network upgrade.&lt;&#x2F;p&gt;
&lt;p&gt;Wallet developers and node operators MUST update gas estimation handling to accommodate the new state access cost rules. Specifically:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Wallets: Wallets using &lt;code&gt;eth_estimateGas&lt;&#x2F;code&gt; MUST be updated to ensure that they correctly account for the updated gas parameters. Failure to do so could result in underestimating gas, leading to failed transactions.&lt;&#x2F;li&gt;
&lt;li&gt;Node Software: RPC methods such as &lt;code&gt;eth_estimateGas&lt;&#x2F;code&gt; MUST incorporate the updated formula for gas calculation with the new state access cost values.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Users can maintain their usual workflows without modification, as wallet and RPC updates will handle these changes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Changing the cost of state access operations could impact the usability of certain applications. More analysis is needed to understand the potential effects on various dApps and user behaviors.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Referable NFT Royalties</title>
        <published>2025-10-02T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Ruiqiang Li</name><uri>https://github.com/richard-620</uri><email>richard.620.research@gmail.com</email>
	</author>
	
	<author>
		<name>Qin Wang</name><email>qin.wang@data61.csiro.au</email>
	</author>
	
	<author>
		<name>Shiping Chen</name><email>shiping.chen@data61.csiro.au</email>
	</author>
	
	<author>
		<name>Saber Yu</name><uri>https://github.com/OniReimu</uri>
	</author>
	
	<author>
		<name>Brian Yecies</name><email>byecies@uow.edu.au</email>
	</author>
	
	<author>
		<name>John Le</name><email>johnle@uow.edu.au</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8034/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-8034-referable-nft-royalties/25643" />
        

        <id>https://wg-eips.ritovision.com/8034/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="last-call"
                label="Last Call" />
            
        

        
        <category
            term="tag:eip:8034"
            label="ERC-8034" />
        

        
        

        
        <summary type="html">A standalone royalty distribution for Referable NFTs, supporting multiple recipients, reference-based royalty distribution.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8034/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC proposes Royalty Distribution, a standalone royalty distribution for Referable Non-Fungible Tokens (rNFTs). It enables royalty distribution to multiple recipients at the primary level and referenced NFTs in the directed acyclic graph (DAG), with a single depth limit to control propagation. The standard is independent of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2981&#x2F;&quot;&gt;ERC-2981&lt;&#x2F;a&gt;. and token-standard-agnostic, but expects &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5521&#x2F;&quot;&gt;ERC-5521&lt;&#x2F;a&gt; rNFTs, which in practice build on &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; ownership semantics. It includes a function to query fixed royalty amounts (in basis points) for transparency. Royalties are voluntary, transparent, and configurable on-chain, supporting collaborative ecosystems and fair compensation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5521&#x2F;&quot;&gt;ERC-5521&lt;&#x2F;a&gt; introduces Referable NFTs (rNFTs), which form a DAG through &quot;referring&quot; and &quot;referred&quot; relationships. Existing royalty standards like &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2981&#x2F;&quot;&gt;ERC-2981&lt;&#x2F;a&gt; do not account for this structure or support multiple recipients per level. This EIP addresses the need for a royalty mechanism that:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Supports multiple recipients per royalty level (e.g., creators and collaborators).&lt;&#x2F;li&gt;
&lt;li&gt;Distributes royalties to referenced NFTs in the DAG.&lt;&#x2F;li&gt;
&lt;li&gt;Limits royalty propagation with a single reference depth.&lt;&#x2F;li&gt;
&lt;li&gt;Provides a function to query fixed royalty amounts without a sale price.&lt;&#x2F;li&gt;
&lt;li&gt;Provides a function to query fixed royalty amounts with a sale price.&lt;&#x2F;li&gt;
&lt;li&gt;Operates independently of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2981&#x2F;&quot;&gt;ERC-2981&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Ensures transparency for marketplaces and users.&lt;&#x2F;li&gt;
&lt;li&gt;Is discoverable via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; supportsInterface.&lt;&#x2F;li&gt;
&lt;li&gt;Supports optional &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; signature-based configuration to streamline marketplace or owner-driven updates.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;interface&quot;&gt;Interface&lt;&#x2F;h3&gt;
&lt;p&gt;The IRNFTRoyalty interface defines the royalty distribution for rNFTs and MUST inherit &lt;code&gt;ERC165&lt;&#x2F;code&gt; so that supporting contracts can advertise compliance via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IRNFTRoyalty&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC165&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RoyaltyInfo&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address to receive royalty&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; royaltyAmount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Royalty amount (in wei for sale-based queries, basis points for fixed queries)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ReferenceRoyalty&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        RoyaltyInfo&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; royaltyInfos&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Array of recipients and their royalty amounts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; referenceDepth&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Maximum depth in the reference DAG for royalty distribution&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ReferenceRoyaltiesPaid&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; rNFTContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; buyer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; marketplace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        ReferenceRoyalty&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; royalties&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getReferenceRoyaltyInfo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; rNFTContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; salePrice&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;ReferenceRoyalty&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; royalties&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getReferenceRoyaltyInfo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; rNFTContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;ReferenceRoyalty&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; royalties&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setReferenceRoyalty&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; rNFTContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recipients&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; royaltyFractions&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; referenceDepth&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setReferenceRoyalty&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; rNFTContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recipients&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; royaltyFractions&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; referenceDepth&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; deadline&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsReferenceRoyalties&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; royaltyNonce&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; rNFTContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;erc-165-requirement&quot;&gt;ERC-165 requirement&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Implementations MUST return true for &lt;code&gt;supportsInterface(type(IRNFTRoyalty).interfaceId)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Additional interfaces (e.g., AccessControl) SHOULD be forwarded via &lt;code&gt;super.supportsInterface(interfaceId)&lt;&#x2F;code&gt; when using inheritance.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;signature-based-configuration&quot;&gt;Signature-Based Configuration&lt;&#x2F;h3&gt;
&lt;p&gt;To support gas-efficient and flexible configuration, implementations MUST support the following semantics for the signature overload:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Authorization: The recovered EIP-712 signer MUST satisfy one of:
&lt;ol&gt;
&lt;li&gt;Has CONFIGURATOR_ROLE, or&lt;&#x2F;li&gt;
&lt;li&gt;Is &lt;code&gt;IERC721(rNFTContract).ownerOf(tokenId)&lt;&#x2F;code&gt; at verification time.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Anti-replay: The message MUST include a nonce; the contract MUST track, verify, and increment a nonce to prevent replay.&lt;&#x2F;li&gt;
&lt;li&gt;Typed Data: Use EIP-712 domain and struct as below (reference implementation provided).&lt;&#x2F;li&gt;
&lt;li&gt;Deadline MUST be compared against block.timestamp; signatures with block.timestamp &amp;gt; deadline MUST be rejected.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;RECOMMENDED EIP-712 Domain&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;name = &quot;RNFTRoyalty&quot;, version = &quot;2&quot;, chainId, verifyingContract = address(this)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;RECOMMENDED Typed Struct&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SetReferenceRoyalty(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  address rNFTContract,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  uint256 tokenId,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  bytes32 recipientsHash,        &#x2F;&#x2F; keccak256(abi.encode(recipients))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  bytes32 royaltyFractionsHash,  &#x2F;&#x2F; keccak256(abi.encode(royaltyFractions))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  uint256 referenceDepth,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  address signer,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  uint256 deadline,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  uint256 nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;key-components&quot;&gt;Key Components&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;structs&quot;&gt;Structs&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;RoyaltyInfo&lt;&#x2F;code&gt;:
&lt;ul&gt;
&lt;li&gt;recipient: The address to receive the royalty payment.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;royaltyAmount&lt;&#x2F;code&gt;: The royalty amount, in wei for &lt;code&gt;getReferenceRoyaltyInfo&lt;&#x2F;code&gt; with salePrice, or basis points (e.g., 100 = 1%) for &lt;code&gt;getReferenceRoyaltyInfo&lt;&#x2F;code&gt; without salePrice.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ReferenceRoyalty&lt;&#x2F;code&gt;:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;royaltyInfos&lt;&#x2F;code&gt;: An array of &lt;code&gt;RoyaltyInfo&lt;&#x2F;code&gt; for multiple recipients at the primary level and referenced NFTs.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;referenceDepth&lt;&#x2F;code&gt;: A single value limiting royalty distribution to referenced NFTs in the DAG.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;functions&quot;&gt;Functions&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;getReferenceRoyaltyInfo(address rNFTContract, uint256 tokenId, uint256 salePrice)&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Returns a ReferenceRoyalty struct with royalty amounts in wei, calculated from the salePrice.&lt;&#x2F;li&gt;
&lt;li&gt;Includes primary-level royalties and referenced NFT royalties up to &lt;code&gt;referenceDepth&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;MUST return zero amounts if no royalties are configured or if salePrice is zero.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;getReferenceRoyaltyInfo(address rNFTContract, uint256 tokenId)&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Returns a ReferenceRoyalty struct with fixed royalty amounts in basis points (e.g., 100 = 1%).&lt;&#x2F;li&gt;
&lt;li&gt;Includes primary-level royalties and referenced NFT royalties up to referenceDepth.&lt;&#x2F;li&gt;
&lt;li&gt;MUST return the configured royalty fractions without sale price calculations.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;setReferenceRoyalty(address rNFTContract, uint256 tokenId, address[] recipients, uint256[] royaltyFractions, uint256 referenceDepth)&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Configures royalties for the specified rNFT.&lt;&#x2F;li&gt;
&lt;li&gt;recipients and royaltyFractions (in basis points) define primary-level royalties.&lt;&#x2F;li&gt;
&lt;li&gt;referenceDepth limits royalty distribution to referenced NFTs.&lt;&#x2F;li&gt;
&lt;li&gt;MUST be restricted to authorized parties (e.g., rNFT contract owner).&lt;&#x2F;li&gt;
&lt;li&gt;MUST enforce a total primary-level royalty cap of ≤ 1000 basis points (10%).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;setReferenceRoyalty(address rNFTContract, uint256 tokenId, address[] recipients, uint256[] royaltyFractions, uint256 referenceDepth, address signer, uint256 deadline, bytes signature)&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Signature-based configuration per EIP-712.&lt;&#x2F;li&gt;
&lt;li&gt;MUST verify signer authorization, nonce, and enforce deadline to reject expired signatures.&lt;&#x2F;li&gt;
&lt;li&gt;The signer parameter specifies which address is expected to have signed the message, enabling relayer execution.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;supportsReferenceRoyalties()&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Returns true if the contract implements this standard. Discovery MUST rely on ERC-165.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;royaltyNonce(address signer, address rNFTContract, uint256 tokenId) external view returns (uint256)&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Returns the current nonce used for EIP-712 signatures.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;events&quot;&gt;Events&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ReferenceRoyaltiesPaid&lt;&#x2F;code&gt;: Emitted when royalties are paid, logging the rNFT contract, token ID, buyer, marketplace, and &lt;code&gt;ReferenceRoyalty&lt;&#x2F;code&gt; details (with royaltyAmount in wei).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;royalty-distribution-model&quot;&gt;Royalty Distribution Model&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Primary Royalties: The rNFT’s royaltyInfos array specifies multiple recipients and their fractions (e.g., 5% total, split as 3% and 2%).&lt;&#x2F;li&gt;
&lt;li&gt;Reference Royalties: At each hop, a total forwarded share equal to REFERRED_ROYALTY_FRACTION (e.g., 200 bps &#x2F; 2%) is carved out and distributed across all referenced NFTs at that depth proportional to their configured weights (fallback: evenly if all weights are zero).&lt;&#x2F;li&gt;
&lt;li&gt;Total Royalty Cap (Primary Level): The 10% (1000 bps) cap applies to the primary-level configured royaltyFractions. Propagated&#x2F;reference-level flows are governed separately by REFERRED_ROYALTY_FRACTION and referenceDepth.&lt;&#x2F;li&gt;
&lt;li&gt;Depth Limit: Implementations MUST cap &lt;code&gt;referenceDepth&lt;&#x2F;code&gt;; this reference implementation enforces &amp;lt;= 3 (RECOMMENDED).&lt;&#x2F;li&gt;
&lt;li&gt;Fixed Royalties: The &lt;code&gt;getReferenceRoyaltyInfo&lt;&#x2F;code&gt; function without salePrice returns royalty fractions in basis points, enabling transparent inspection.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;example&quot;&gt;Example&lt;&#x2F;h3&gt;
&lt;p&gt;For an rNFT (contract 0xABC, token ID 1) with &lt;code&gt;referenceDepth&lt;&#x2F;code&gt; = 2:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Configuration:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Primary royalties: 5% (3% to creator, 2% to collaborator).&lt;&#x2F;li&gt;
&lt;li&gt;Depth 1: Two referenced NFTs; a total of 2% is forwarded at depth 1 and split equally (1% each) under equal weights.&lt;&#x2F;li&gt;
&lt;li&gt;Depth 2: No royalties (capped by referenceDepth).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;getReferenceRoyaltyInfo(0xABC, 1)&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Returns:&lt;&#x2F;p&gt;
&lt;p&gt;{ royaltyInfos: [ {recipient: creator, royaltyAmount: 300}, {recipient: collaborator, royaltyAmount: 200}, {recipient: tokenA_owner, royaltyAmount: 100}, {recipient: tokenB_owner, royaltyAmount: 100} ], referenceDepth: 2 }.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Sale for 100 ETH:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;getReferenceRoyaltyInfo(0xABC, 1, 100 ether) returns:&lt;&#x2F;p&gt;
&lt;p&gt;{ royaltyInfos: [ {recipient: creator, royaltyAmount: 3 ether}, {recipient: collaborator, royaltyAmount: 2 ether}, {recipient: tokenA_owner, royaltyAmount: 1 ether}, {recipient: tokenB_owner, royaltyAmount: 1 ether} ], referenceDepth: 2 }.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Fixed Royalty Query: The new &lt;code&gt;getReferenceRoyaltyInfo&lt;&#x2F;code&gt; function without salePrice allows users to inspect fixed royalty fractions (in basis points), improving transparency.&lt;&#x2F;li&gt;
&lt;li&gt;Multiple Recipients: The &lt;code&gt;RoyaltyInfo&lt;&#x2F;code&gt; array supports collaborative projects.&lt;&#x2F;li&gt;
&lt;li&gt;Single Depth Limit: Simplifies configuration and reduces gas costs.&lt;&#x2F;li&gt;
&lt;li&gt;Standalone Design: Ensures compatibility with any ERC-5521 contract.&lt;&#x2F;li&gt;
&lt;li&gt;Voluntary Royalties: Aligns with marketplace practices.&lt;&#x2F;li&gt;
&lt;li&gt;Transparency: On-chain storage and fixed-amount queries enable verifiable royalties.&lt;&#x2F;li&gt;
&lt;li&gt;ERC-165 Discoverability: Marketplaces and wallets can reliably detect support via supportsInterface, avoiding ad-hoc feature flags.&lt;&#x2F;li&gt;
&lt;li&gt;EIP-712 Signatures: Off-chain approvals enable safe, gas-efficient configurations.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is independent of ERC-2981 and targets ERC-5521 rNFTs, which in practice build on ERC-721 ownership semantics. Marketplaces can integrate by:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Checking ERC-165: &lt;code&gt;supportsInterface(type(IRNFTRoyalty).interfaceId)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Calling &lt;code&gt;getReferenceRoyaltyInfo&lt;&#x2F;code&gt; (with or without sale price).&lt;&#x2F;li&gt;
&lt;li&gt;Optionally leveraging the signature-based configuration for off-chain workflows.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pragma solidity ^0.8.0;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;import &amp;quot;@openzeppelin&#x2F;contracts&#x2F;access&#x2F;AccessControl.sol&amp;quot;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;import &amp;quot;@openzeppelin&#x2F;contracts&#x2F;utils&#x2F;cryptography&#x2F;EIP712.sol&amp;quot;; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;import &amp;quot;@openzeppelin&#x2F;contracts&#x2F;utils&#x2F;cryptography&#x2F;ECDSA.sol&amp;quot;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;import &amp;quot;@openzeppelin&#x2F;contracts&#x2F;utils&#x2F;introspection&#x2F;IERC165.sol&amp;quot;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;import &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC721&#x2F;IERC721.sol&amp;quot;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;import &amp;quot;@openzeppelin&#x2F;contracts&#x2F;utils&#x2F;ReentrancyGuard.sol&amp;quot;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;import &amp;quot;.&#x2F;IRNFTRoyalty.sol&amp;quot;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;interface IERC_5521 is IERC165 {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function setNode(uint256 tokenId, address[] memory addresses, uint256[][] memory tokenIds) external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function referringOf(address _address, uint256 tokenId) external view returns (address[] memory, uint256[][] memory);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function referredOf(address _address, uint256 tokenId) external view returns (address[] memory, uint256[][] memory);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function supportsInterface(bytes4 interfaceId) external view returns (bool);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;contract RNFTRoyalty is IRNFTRoyalty, AccessControl, EIP712, ReentrancyGuard {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    using ECDSA for bytes32;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytes32 public constant CONFIGURATOR_ROLE = keccak256(&amp;quot;CONFIGURATOR_ROLE&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    uint256 private constant MAX_ROYALTY_FRACTION = 1000; &#x2F;&#x2F; 10%&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    uint256 private constant REFERRED_ROYALTY_FRACTION = 200; &#x2F;&#x2F; 2%&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    uint256 private constant MAX_CHAIN_STEPS = 32;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    uint256 private constant MAX_RECIPIENTS = 64;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; storage&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    mapping(address =&amp;gt; mapping(uint256 =&amp;gt; ReferenceRoyalty)) private _royalties;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    event ReferenceRoyaltyConfigured(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address indexed rNFTContract,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 indexed tokenId,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address indexed setter,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address[] recipients,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256[] royaltyFractions,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 referenceDepth,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bool viaSignature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    );&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; EIP-712 typed data &amp;amp; nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytes32 private constant _SET_TYPEHASH =&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        keccak256(&amp;quot;SetReferenceRoyalty(address rNFTContract,uint256 tokenId,bytes32 recipientsHash,bytes32 royaltyFractionsHash,uint256 referenceDepth,address signer,uint256 deadline,uint256 nonce)&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; (signer =&amp;gt; rNFT =&amp;gt; tokenId =&amp;gt; nonce)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    mapping(address =&amp;gt; mapping(address =&amp;gt; mapping(uint256 =&amp;gt; uint256))) private _sigNonces;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    constructor() EIP712(&amp;quot;RNFTRoyalty&amp;quot;, &amp;quot;2&amp;quot;) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _grantRole(DEFAULT_ADMIN_ROLE, msg.sender);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _grantRole(CONFIGURATOR_ROLE, msg.sender);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; ===== IRNFTRoyalty =====&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; expose nonce for off-chain signing&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function royaltyNonce(address signer, address rNFTContract, uint256 tokenId)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        returns (uint256)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return _sigNonces[signer][rNFTContract][tokenId];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function setReferenceRoyalty(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address rNFTContract,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 tokenId,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address[] calldata recipients,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256[] calldata royaltyFractions,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 referenceDepth&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ) external onlyRole(CONFIGURATOR_ROLE) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _configureRoyalty(rNFTContract, tokenId, recipients, royaltyFractions, referenceDepth);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        emit ReferenceRoyaltyConfigured(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            rNFTContract,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            tokenId,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            msg.sender,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            recipients,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            royaltyFractions,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            referenceDepth,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        );&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @notice Configure reference royalty via EIP-712 signature (supports relayers).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @dev&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; - Uses explicit `signer` for nonce lookup and authorization; caller can be a relayer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; - Includes `deadline` in the signed struct; reverts with &amp;quot;Signature expired&amp;quot; if now &amp;gt; deadline.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; - Non-reentrant to defend against malicious `rNFT.ownerOf` implementations.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; - Authorization: `signer` must have `CONFIGURATOR_ROLE` or be current `ownerOf(tokenId)`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; - Nonce scope: per-signer-per-token; increments on success to prevent replay.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function setReferenceRoyalty(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address rNFTContract,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 tokenId,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address[] calldata recipients,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256[] calldata royaltyFractions,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 referenceDepth,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address signer,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 deadline,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bytes calldata signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ) external nonReentrant {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _checkParams(rNFTContract, recipients, royaltyFractions, referenceDepth);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bytes32 recipientsHash = keccak256(abi.encode(recipients));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bytes32 fractionsHash  = keccak256(abi.encode(royaltyFractions));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &#x2F;&#x2F; Compute expected signer digest and use per-signer-per-token nonce (explicit signer for relaying)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        require(signer != address(0), &amp;quot;Invalid signer&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 nonce = _sigNonces[signer][rNFTContract][tokenId];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        require(block.timestamp &amp;lt;= deadline, &amp;quot;Signature expired&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bytes32 structHash = keccak256(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            abi.encode(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                _SET_TYPEHASH,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                rNFTContract,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                tokenId,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                recipientsHash,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                fractionsHash,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                referenceDepth,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                signer,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                deadline,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        );&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bytes32 digest = _hashTypedDataV4(structHash);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address recovered = ECDSA.recover(digest, signature);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        require(recovered == signer &amp;amp;&amp;amp; signer != address(0), &amp;quot;Invalid signature&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &#x2F;&#x2F; Authorization: CONFIGURATOR_ROLE or current owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bool authorized = hasRole(CONFIGURATOR_ROLE, signer);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        if (!authorized) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            address owner = _safeOwnerOf(IERC721(rNFTContract), tokenId);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            require(signer == owner, &amp;quot;Signer not authorized&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &#x2F;&#x2F; effects: bump nonce to prevent replay&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _sigNonces[signer][rNFTContract][tokenId] = nonce + 1;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &#x2F;&#x2F; configure royalties&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _configureRoyalty(rNFTContract, tokenId, recipients, royaltyFractions, referenceDepth);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        emit ReferenceRoyaltyConfigured(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            rNFTContract,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            tokenId,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            signer,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            recipients,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            royaltyFractions,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            referenceDepth,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        );&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @notice Compute reference royalty distribution for a concrete sale price (values in wei).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @param rNFTContract RNFT contract implementing IERC_5521&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @param tokenId Token id&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @param salePrice Sale price in wei&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function getReferenceRoyaltyInfo(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address rNFTContract,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 tokenId,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 salePrice&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ) external view returns (ReferenceRoyalty memory royalties) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        royalties = _royalties[rNFTContract][tokenId];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        if (salePrice == 0) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            uint256 len = royalties.royaltyInfos.length;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if (len == 0) return royalties;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            RoyaltyInfo[] memory zeroed = new RoyaltyInfo[](len);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            for (uint256 i = 0; i &amp;lt; len; i++) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                zeroed[i] = RoyaltyInfo(royalties.royaltyInfos[i].recipient, 0);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            royalties.royaltyInfos = zeroed;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            return royalties;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        RoyaltyInfo[] memory chainRoyalties = _calculateChainRoyalties(rNFTContract, tokenId, salePrice);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        royalties.royaltyInfos = chainRoyalties;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return royalties;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @notice Compute reference royalty distribution in basis points (bps), i.e. relative amounts.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @param rNFTContract RNFT contract implementing IERC_5521&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @param tokenId Token id&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function getReferenceRoyaltyInfo(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address rNFTContract,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ) external view returns (ReferenceRoyalty memory royalties) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        royalties = _royalties[rNFTContract][tokenId];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        if (royalties.royaltyInfos.length == 0) return royalties;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        RoyaltyInfo[] memory bpsRoyalties = _calculateChainRoyalties(rNFTContract, tokenId, 0);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        royalties.royaltyInfos = bpsRoyalties;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return royalties;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function supportsReferenceRoyalties() external pure returns (bool) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return true;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; ===== ERC-165 =====&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function supportsInterface(bytes4 interfaceId)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        public&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        override(AccessControl, IERC165)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        returns (bool)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            interfaceId == type(IRNFTRoyalty).interfaceId ||&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            super.supportsInterface(interfaceId);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; ===== Internal =====&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function _checkParams(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address rNFTContract,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address[] calldata recipients,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256[] calldata royaltyFractions,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 referenceDepth&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ) internal pure {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        require(rNFTContract != address(0), &amp;quot;Invalid contract&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        require(recipients.length == royaltyFractions.length, &amp;quot;Length mismatch&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        require(recipients.length &amp;lt;= MAX_RECIPIENTS, &amp;quot;Too many recipients&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        require(referenceDepth &amp;lt;= 3, &amp;quot;Depth too high&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        for (uint256 i = 0; i &amp;lt; recipients.length; ++i) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            require(recipients[i] != address(0), &amp;quot;Zero recipient&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function _configureRoyalty(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address rNFTContract,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 tokenId,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address[] calldata recipients,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256[] calldata royaltyFractions,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 referenceDepth&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ) internal {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 totalFraction = 0;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        for (uint256 i = 0; i &amp;lt; royaltyFractions.length; i++) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            totalFraction += royaltyFractions[i];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        require(totalFraction &amp;lt;= MAX_ROYALTY_FRACTION, &amp;quot;Royalty cap exceeded&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ReferenceRoyalty memory config;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        config.referenceDepth = referenceDepth;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        config.royaltyInfos = new RoyaltyInfo[](recipients.length);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        for (uint256 i = 0; i &amp;lt; recipients.length; i++) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            config.royaltyInfos[i] = RoyaltyInfo(recipients[i], royaltyFractions[i]);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _royalties[rNFTContract][tokenId] = config;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function _safeOwnerOf(IERC721 rNFT, uint256 tokenId) internal view returns (address) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address owner = rNFT.ownerOf(tokenId);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        require(owner != address(0), &amp;quot;No owner&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return owner;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function _calculateChainRoyalties(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address rNFTContract,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 tokenId,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 salePrice&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ) internal view returns (RoyaltyInfo[] memory) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ReferenceRoyalty memory currentRoyalty = _royalties[rNFTContract][tokenId];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        if (currentRoyalty.royaltyInfos.length == 0) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            return new RoyaltyInfo[](0);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        RoyaltyInfo[] memory staged = new RoyaltyInfo[](MAX_CHAIN_STEPS * 32 + 32);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 count = 0;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 totalShare = _sumShares(currentRoyalty);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (uint256 netPrimary, uint256 remainder) = _splitRoyalty(totalShare, salePrice, currentRoyalty.referenceDepth &amp;gt; 0);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        count = _appendDistribution(staged, count, currentRoyalty, netPrimary);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        if (remainder == 0) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            return _shrink(staged, count);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &#x2F;&#x2F; Layered aggregation (BFS) to support multi-parent merges&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 maxItems = MAX_CHAIN_STEPS * 32 + 32;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address[] memory curContracts = new address[](maxItems);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256[] memory curIds = new uint256[](maxItems);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256[] memory curAmts = new uint256[](maxItems);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256[] memory curDepths = new uint256[](maxItems);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 curCount = 0;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        if (remainder &amp;gt; 0 &amp;amp;&amp;amp; currentRoyalty.referenceDepth &amp;gt; 0) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            curContracts[0] = rNFTContract;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            curIds[0] = tokenId;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            curAmts[0] = remainder;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            curDepths[0] = currentRoyalty.referenceDepth;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            curCount = 1;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address[] memory processedContracts = new address[](maxItems);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256[] memory processed = new uint256[](maxItems);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 processedCount = 0;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        while (curCount &amp;gt; 0) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            address[] memory nextContracts = new address[](maxItems);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            uint256[] memory nextIds = new uint256[](maxItems);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            uint256[] memory nextAmts = new uint256[](maxItems);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            uint256[] memory nextDepths = new uint256[](maxItems);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            uint256 nextCount = 0;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            for (uint256 iL = 0; iL &amp;lt; curCount; iL++) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                address curContract = curContracts[iL];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                uint256 curId = curIds[iL];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                uint256 amt = curAmts[iL];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                uint256 depth = curDepths[iL];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                if (amt == 0) continue;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                IERC_5521 curRNFT = IERC_5521(curContract);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                IERC721 curRNFT721 = IERC721(curContract);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                bool seen = false;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                for (uint256 p = 0; p &amp;lt; processedCount; p++) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    if (processed[p] == curId &amp;amp;&amp;amp; processedContracts[p] == curContract) { seen = true; break; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                if (seen) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    address cycOwner = _safeOwnerOf(curRNFT721, curId);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    staged[count++] = RoyaltyInfo(cycOwner, amt);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    continue;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                uint256 maxChildren = 32;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                address[] memory childContracts = new address[](maxChildren);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                uint256[] memory childIds = new uint256[](maxChildren);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                uint256 children = _collectReferring(curRNFT, curContract, curId, childContracts, childIds);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                if (depth == 0 || children == 0) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    address fallbackOwner = _safeOwnerOf(curRNFT721, curId);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    staged[count++] = RoyaltyInfo(fallbackOwner, amt);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    processedContracts[processedCount] = curContract;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    processed[processedCount++] = curId;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    continue;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                uint256 keepBase = (amt * (10_000 - REFERRED_ROYALTY_FRACTION)) &#x2F; 10_000;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                uint256 passBase = amt - keepBase;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                uint256[] memory childWeights = new uint256[](maxChildren);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                ReferenceRoyalty[] memory childConfigs = new ReferenceRoyalty[](maxChildren);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                uint256 sumWeights = 0;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                for (uint256 j = 0; j &amp;lt; children; j++) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    address childContract = childContracts[j];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    uint256 cid = childIds[j];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    ReferenceRoyalty memory cfg = _royalties[childContract][cid];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    childConfigs[j] = cfg;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    if (cfg.royaltyInfos.length &amp;gt; 0) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        uint256 w = _sumShares(cfg);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        childWeights[j] = w;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        sumWeights += w;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                if (sumWeights == 0) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    uint256 each = amt &#x2F; children;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    uint256 rem = amt - (each * children);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    for (uint256 j = 0; j &amp;lt; children; j++) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        address ow = _safeOwnerOf(IERC721(childContracts[j]), childIds[j]);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        uint256 share = each + (j == children - 1 ? rem : 0);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        staged[count++] = RoyaltyInfo(ow, share);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    processedContracts[processedCount] = curContract;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    processed[processedCount++] = curId;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    continue;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                uint256 passDistributed = 0;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                uint256 lastWeightedIdx = 0;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                uint256[] memory keepShares = new uint256[](children);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                uint256[] memory passShares = new uint256[](children);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                for (uint256 j = 0; j &amp;lt; children; j++) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    if (childWeights[j] == 0) continue;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    lastWeightedIdx = j;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    uint256 kShare = (keepBase * childWeights[j]) &#x2F; sumWeights;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    uint256 pShare = (passBase * childWeights[j]) &#x2F; sumWeights;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    keepShares[j] = kShare;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    passShares[j] = pShare;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    passDistributed += pShare;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F;&#x2F; Remainders: pass and keep&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                uint256 passRemainder = passBase - passDistributed;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                if (passRemainder &amp;gt; 0) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    passShares[lastWeightedIdx] += passRemainder;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                uint256 keepDistributed = 0;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                for (uint256 j2 = 0; j2 &amp;lt; children; j2++) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    keepDistributed += keepShares[j2];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                uint256 keepRemainder = keepBase - keepDistributed;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                if (keepRemainder &amp;gt; 0) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    keepShares[lastWeightedIdx] += keepRemainder;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                for (uint256 j = 0; j &amp;lt; children; j++) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    if (childWeights[j] == 0) continue;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    uint256 kShare = keepShares[j];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    uint256 pShare = passShares[j];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    ReferenceRoyalty memory cfgj = childConfigs[j];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    uint256 cid2 = childIds[j];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    address childContract = childContracts[j];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    uint256 nextDepth = depth &amp;gt; 0 ? depth - 1 : 0;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    if (nextDepth == 0) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        &#x2F;&#x2F; Depth exhausted: distribute both keep and pass to child&amp;#39;s recipients&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        count = _appendDistribution(staged, count, cfgj, kShare + pShare);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    } else {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        if (kShare &amp;gt; 0) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            count = _appendDistribution(staged, count, cfgj, kShare);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        if (pShare &amp;gt; 0) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            bool merged = false;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            for (uint256 nx = 0; nx &amp;lt; nextCount; nx++) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                if (nextIds[nx] == cid2 &amp;amp;&amp;amp; nextContracts[nx] == childContract) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                    nextAmts[nx] += pShare;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                    if (nextDepth &amp;gt; nextDepths[nx]) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                        nextDepths[nx] = nextDepth;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                    merged = true;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                    break;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            if (!merged) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                nextContracts[nextCount] = childContract;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                nextIds[nextCount] = cid2;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                nextAmts[nextCount] = pShare;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                nextDepths[nextCount] = nextDepth;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                nextCount++;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                processedContracts[processedCount] = curContract;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                processed[processedCount++] = curId;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            for (uint256 k = 0; k &amp;lt; nextCount; k++) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                curContracts[k] = nextContracts[k];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                curIds[k] = nextIds[k];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                curAmts[k] = nextAmts[k];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                curDepths[k] = nextDepths[k];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            curCount = nextCount;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return _shrink(staged, count);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function _splitRoyalty(uint256 totalRate, uint256 salePrice, bool canPropagate)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        internal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        pure&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        returns (uint256 netPrimary, uint256 forwardedAmount)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        if (totalRate == 0) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            return (0, 0);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        if (!canPropagate) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if (salePrice == 0) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                return (totalRate, 0);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            return ((salePrice * totalRate) &#x2F; 10_000, 0);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        if (salePrice == 0) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if (totalRate &amp;lt;= REFERRED_ROYALTY_FRACTION) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                return (0, totalRate);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            return (totalRate - REFERRED_ROYALTY_FRACTION, REFERRED_ROYALTY_FRACTION);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 gross = (salePrice * totalRate) &#x2F; 10_000;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 forwarded = (salePrice * REFERRED_ROYALTY_FRACTION) &#x2F; 10_000;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        if (forwarded &amp;gt; gross) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            forwarded = gross;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return (gross &amp;gt; forwarded ? gross - forwarded : 0, forwarded);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function _sumShares(ReferenceRoyalty memory config) internal pure returns (uint256 total) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        for (uint256 i = 0; i &amp;lt; config.royaltyInfos.length; i++) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            total += config.royaltyInfos[i].royaltyAmount;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function _collectReferring(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        IERC_5521 rNFT,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address rNFTContract,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 tokenId,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address[] memory childContracts,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256[] memory childIds&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ) internal view returns (uint256 childCount) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (address[] memory refContracts, uint256[][] memory refTokenIds) =&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            rNFT.referringOf(rNFTContract, tokenId);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 maxChildren = childIds.length;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 listLen = refContracts.length;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        if (refTokenIds.length &amp;lt; listLen) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            listLen = refTokenIds.length;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        for (uint256 i = 0; i &amp;lt; listLen &amp;amp;&amp;amp; childCount &amp;lt; maxChildren; i++) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            uint256[] memory ids = refTokenIds[i];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            for (uint256 j = 0; j &amp;lt; ids.length &amp;amp;&amp;amp; childCount &amp;lt; maxChildren; j++) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                childContracts[childCount] = refContracts[i];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                childIds[childCount] = ids[j];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                childCount++;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function _appendDistribution(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        RoyaltyInfo[] memory staged,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 count,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ReferenceRoyalty memory config,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ) internal pure returns (uint256) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 len = config.royaltyInfos.length;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        if (len == 0) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            return count;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        require(count + len &amp;lt;= staged.length, &amp;quot;royalty overflow&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        if (amount == 0) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            for (uint256 i = 0; i &amp;lt; len; i++) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                staged[count++] = RoyaltyInfo(config.royaltyInfos[i].recipient, 0);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            return count;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 totalShare = _sumShares(config);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        if (totalShare == 0) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            staged[count++] = RoyaltyInfo(config.royaltyInfos[0].recipient, amount);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            for (uint256 i = 1; i &amp;lt; len; i++) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                staged[count++] = RoyaltyInfo(config.royaltyInfos[i].recipient, 0);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            return count;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 remaining = amount;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        for (uint256 i = 0; i &amp;lt; len; i++) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            uint256 share = config.royaltyInfos[i].royaltyAmount;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if (share == 0) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                staged[count++] = RoyaltyInfo(config.royaltyInfos[i].recipient, 0);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                continue;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            uint256 portion = (amount * share) &#x2F; totalShare;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if (portion &amp;gt; remaining) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                portion = remaining;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            remaining -= portion;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            staged[count++] = RoyaltyInfo(config.royaltyInfos[i].recipient, portion);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        if (remaining &amp;gt; 0) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            staged[count - 1].royaltyAmount += remaining;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return count;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function _shrink(RoyaltyInfo[] memory staged, uint256 count)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        internal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        pure&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        returns (RoyaltyInfo[] memory out)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        out = new RoyaltyInfo[](count);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        for (uint256 i = 0; i &amp;lt; count; i++) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            out[i] = staged[i];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function recordRoyaltyPayment(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address rNFTContract,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 tokenId,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address buyer,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ReferenceRoyalty memory royalties&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ) external {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        emit ReferenceRoyaltiesPaid(rNFTContract, tokenId, buyer, msg.sender, royalties);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Access Control: &lt;code&gt;setReferenceRoyalty&lt;&#x2F;code&gt; MUST be restricted to authorized roles (e.g., via AccessControl).&lt;&#x2F;li&gt;
&lt;li&gt;Total Royalty Cap (Primary Level): The 10% (1000 bps) cap applies to the primary-level configured royaltyFractions. Propagated&#x2F;reference-level flows are governed separately by REFERRED_ROYALTY_FRACTION and referenceDepth.&lt;&#x2F;li&gt;
&lt;li&gt;Gas Limits: &lt;code&gt;referenceDepth&lt;&#x2F;code&gt; MUST be capped (e.g., ≤ 3) to avoid high gas costs.&lt;&#x2F;li&gt;
&lt;li&gt;Input Validation: Ensure non-zero addresses and valid royalty fractions.&lt;&#x2F;li&gt;
&lt;li&gt;Interface Signaling: Ensure supportsInterface forwards properly to parents.&lt;&#x2F;li&gt;
&lt;li&gt;Signature Replay: Use a per-signer-per-(rNFTContract, tokenId) nonce, and increment after successful verification. Implementations MUST document the chosen scope.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Adaptive state cost to cap growth &amp; scale L1</title>
        <published>2025-10-02T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Anders Elowsson</name><uri>https://github.com/anderselowsson</uri>
	</author>
	
	<author>
		<name>Francesco D&#x27;Amato</name><uri>https://github.com/fradamt</uri>
	</author>
	
	<author>
		<name>Maria Silva</name><uri>https://github.com/misilva73</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8075/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8075-adaptive-state-cost-to-cap-growth-scale-l1/26450" />
        

        <id>https://wg-eips.ritovision.com/8075/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:8075"
            label="EIP-8075" />
        

        
        

        
        <summary type="html">Track state bytes and target 250 MiB&#x2F;day by dynamically adjusting the state gas cost. Exempt state from the gas limit to facilitate scaling.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8075/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP precisely caps state growth while at the same time facilitating between 50%-300% more non-state operations per block compared to when solely raising the state gas cost. The cap is achieved by tracking state creation and having a dedicated &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt; style fee market mechanism set the cost, to target 250 MiB per day. To preserve the existing transaction format and EVM execution patterns, state is still priced in gas during transaction processing. The state creation gas cost is updated every block, adjusting slowly so that users can set reasonable gas limits. The byte-level harmonization of state creation operations provided by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8037&#x2F;&quot;&gt;EIP-8037&lt;&#x2F;a&gt; is then still applied. To facilitate scaling, state creation and regular gas have separate limits, but a normalized aggregate gas is used when calculating the base fee.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Ethereum is currently focused on scaling the layer 1, with a rapid expansion of the block gas limit foreseen in the near-term from compute and memory optimization, as well as via headliner proposals &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7732&#x2F;&quot;&gt;EIP-7732&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7928&#x2F;&quot;&gt;EIP-7928&lt;&#x2F;a&gt;. Unfortunately, if the gas cost for state creation is kept fixed, state would likely expand in line with an expanding gas limit. As client database sizes increase, degradation in performance is expected. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8037&#x2F;&quot;&gt;EIP-8037&lt;&#x2F;a&gt; addresses state growth by harmonizing current state creation costs according to how many bytes they add to the state. It also increases the gas cost of state creation significantly, by between 3x and 9.5x per operation.&lt;&#x2F;p&gt;
&lt;p&gt;It can be assumed that increased gas costs will somewhat keep state from expanding in line with the increased gas limit. However, since the price-elasticity of demand for state creation is unknown, it is impossible to say exactly what the effect would be. Users may not be particularly sensitive to the increased state gas costs and still continue to purchase state relative to other resources similar to present usage patterns, given that the overall base fee may also fall from the increased gas limit. This would have two effects:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;State would continue to expand by a higher rate than desired.&lt;&#x2F;li&gt;
&lt;li&gt;Under equilibrium, well over 50% of all consumed gas may be spent on state. As further analyzed in the Rationale, a possible equilibrium outcome is 78.5% under current usage pattern and 64.7% even if users only create half as many state bytes for every gas they spend on other operations, relative to today. This impedes scaling under the current one-dimensional fee market, because state gas crowds out gas that can be used for other resources such as compute.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;To confidently target some specific state growth, it is necessary to dynamically vary the price of state creation according to its usage. The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt; mechanism is then particularly suitable. This proposal tracks &lt;code&gt;state_bytes_created&lt;&#x2F;code&gt; and &lt;code&gt;state_bytes_cleared&lt;&#x2F;code&gt; each block and keep a running counter of &lt;code&gt;excess_state_bytes&lt;&#x2F;code&gt;. When &lt;code&gt;state_bytes_created - state_bytes_cleared&lt;&#x2F;code&gt; exceeds the target, &lt;code&gt;excess_state_bytes&lt;&#x2F;code&gt; increases, resulting in an increase to the gas charged per state byte. Users should not need to attach excessive margins to the transaction gas limit without risking transactions failure, and the gas charged per state byte is thus set to vary very moderately between blocks, at 0.1% at the very most.&lt;&#x2F;p&gt;
&lt;p&gt;To not impede scaling when a higher gas is charged per state byte, it is necessary to exempt state gas from the block gas limit. This is achieved by tracking the &lt;code&gt;regular_gas&lt;&#x2F;code&gt; and &lt;code&gt;state_gas&lt;&#x2F;code&gt; separately, having a separate limit for each. To ensure that the base fee still prices usage across all resources, the base fee update still operates on a normalized aggregate of both. Thus, the smooth shift in the gas charged per state byte can be understood as a separate control mechanism for pricing state &lt;em&gt;relative&lt;&#x2F;em&gt; to all other operations, facilitating good load-balancing over time. It is however not a mechanism that prices state creation in isolation—the base fee still applies to all resources.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The full specification is available &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;execution-specs&#x2F;commit&#x2F;d64f82b18db8c0ae35f3c56e1762ace9d83ba578&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;p&gt;Four constants have a similar role as in EIP-4844.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;STATE_GAS_UPDATE_FRACTION&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;36_418_000&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TARGET_STATE_BYTES_PER_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;36_400&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_STATE_BYTES_PER_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2 * TARGET_STATE_BYTES_PER_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MIN_STATE_GAS_PER_BYTE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;380&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The &lt;code&gt;STATE_GAS_UPDATE_FRACTION&lt;&#x2F;code&gt; is chosen so that a block that uses &lt;code&gt;MAX_STATE_BYTES_PER_BLOCK&lt;&#x2F;code&gt; can increase state_gas_per_byte by at most 0.1%. It was computed as &lt;code&gt;(MAX_STATE_BYTES_PER_BLOCK - TARGET_STATE_BYTES_PER_BLOCK) &#x2F; ln(1.001)&lt;&#x2F;code&gt;, rounded to the nearest thousand.&lt;&#x2F;p&gt;
&lt;p&gt;The number of bytes assigned to each state operation follows EIP-8037.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CREATE_BYTES&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;112&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CODE_DEPOSIT_BYTES&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;NEW_ACCOUNT_BYTES&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;112&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;STORAGE_SET_BYTES&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;32&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;PER_EMPTY_ACCOUNT_BYTES&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;112&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;PER_AUTH_BASE_BYTES&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;23&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;header-extension&quot;&gt;Header extension&lt;&#x2F;h3&gt;
&lt;p&gt;The current header encoding is extended with three new 64-bit unsigned integer fields.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;state_bytes_created&lt;&#x2F;code&gt; is the number of state bytes that were created in the current block.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;state_bytes_cleared&lt;&#x2F;code&gt; is the number of state bytes that were cleared in the current block.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;excess_state_bytes&lt;&#x2F;code&gt; is a running total of state bytes created in excess of the target, prior to the block. Blocks with above-target state bytes creation increase this value, blocks with below-target state bytes creation decrease it (bounded at 0).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The header sequence of the new fields is &lt;code&gt;[..., TBD, state_bytes_created, state_bytes_cleared, excess_state_bytes]&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;We also rename the &lt;code&gt;gas_used&lt;&#x2F;code&gt; field to &lt;code&gt;regular_gas_used&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;regular_gas_used&lt;&#x2F;code&gt; is the regular gas used in the block, ignoring gas spent on state creation.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;evm-gas-accounting&quot;&gt;EVM gas accounting&lt;&#x2F;h3&gt;
&lt;p&gt;During processing, the protocol tracks &lt;code&gt;regular_gas&lt;&#x2F;code&gt; and &lt;code&gt;state_gas&lt;&#x2F;code&gt; separately, and returns the aggregate &lt;code&gt;gas_used&lt;&#x2F;code&gt; accounting for refunds, similar to today. Furthermore, &lt;code&gt;regular_gas_used&lt;&#x2F;code&gt; (without refunds to satisfy &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7778&#x2F;&quot;&gt;EIP-7778&lt;&#x2F;a&gt;) is returned to count against the block limit. Finally, the protocol also tracks &lt;code&gt;state_bytes_created&lt;&#x2F;code&gt; and &lt;code&gt;state_bytes_cleared&lt;&#x2F;code&gt;, allowing for a more accurate tracking of the &lt;code&gt;excess_state_bytes&lt;&#x2F;code&gt;. These are returned in the list &lt;code&gt;state_bytes(created, cleared)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;computing-the-state-gas-per-byte&quot;&gt;Computing the state gas per byte&lt;&#x2F;h3&gt;
&lt;p&gt;The protocol keeps track of &lt;code&gt;excess_state_bytes&lt;&#x2F;code&gt;, and computes the &lt;code&gt;state_gas_per_byte&lt;&#x2F;code&gt; from that variable (referred to as &lt;code&gt;cost_per_state_byte&lt;&#x2F;code&gt; in EIP-8037). The same update mechanism as in EIP-4844 is applied.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_state_gas_per_byte&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;header&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Header&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; fake_exponential&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        MIN_STATE_GAS_PER_BYTE&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;excess_state_bytes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        STATE_GAS_UPDATE_FRACTION&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;STATE_GAS_UPDATE_FRACTION&lt;&#x2F;code&gt; is set so that the maximum increase in &lt;code&gt;state_gas_per_byte&lt;&#x2F;code&gt; is 0.1%, when a block consumes &lt;code&gt;MAX_STATE_BYTES_PER_BLOCK&lt;&#x2F;code&gt;. The &lt;code&gt;state_gas_per_byte&lt;&#x2F;code&gt; has a floor of &lt;code&gt;MIN_STATE_GAS_PER_BYTE&lt;&#x2F;code&gt;, corresponding to EIP-8037 when scaled down to a 60M block gas limit. The &lt;code&gt;excess_state_bytes&lt;&#x2F;code&gt; are updated as in EIP-4844, but accounting for both created and cleared state bytes:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calc_excess_state_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Header&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;excess_state_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state_bytes_created&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    deficit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TARGET_STATE_BYTES_PER_BLOCK&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state_bytes_cleared&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; deficit&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; deficit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;updating-state-gas-costs-for-the-block&quot;&gt;Updating state gas costs for the block&lt;&#x2F;h3&gt;
&lt;p&gt;The block level gas cost for each state operation is computed as &lt;code&gt;GAS_STATE_OPERATION = STATE_OPERATION_BYTES * state_gas_per_byte&lt;&#x2F;code&gt;. For completeness, the function below specifies this for all operations:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; update_state_op_costs&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state_gas_per_byte&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    GAS_CREATE&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;             =&lt;&#x2F;span&gt;&lt;span&gt; state_gas_per_byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CREATE_BYTES&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    GAS_CODE_DEPOSIT&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;       =&lt;&#x2F;span&gt;&lt;span&gt; state_gas_per_byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CODE_DEPOSIT_BYTES&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    GAS_NEW_ACCOUNT&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;        =&lt;&#x2F;span&gt;&lt;span&gt; state_gas_per_byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; NEW_ACCOUNT_BYTES&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    GAS_STORAGE_SET&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;        =&lt;&#x2F;span&gt;&lt;span&gt; state_gas_per_byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; STORAGE_SET_BYTES&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    PER_EMPTY_ACCOUNT_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state_gas_per_byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; PER_EMPTY_ACCOUNT_BYTES&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    PER_AUTH_BASE_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;     =&lt;&#x2F;span&gt;&lt;span&gt; state_gas_per_byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; PER_AUTH_BASE_BYTES&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;base-fee-update-rule&quot;&gt;Base fee update rule&lt;&#x2F;h3&gt;
&lt;p&gt;The base fee is updated by aggregating the regular gas and &quot;normalized state gas&quot;, where a net change of &lt;code&gt;MAX_STATE_BYTES_PER_BLOCK&lt;&#x2F;code&gt; corresponds to the block&#x27;s gas limit, thus giving state gas the same range as regular gas. The change is still restricted to the range ±12.5%. When not conditioning against negative values, the &lt;code&gt;gas_used_delta&lt;&#x2F;code&gt; used in the base fee update can for the EIP-1559 mechanism thus be computed as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    normalized_state_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state_bytes_created&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state_bytes_cleared&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_STATE_BYTES_PER_BLOCK&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_used_delta&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;regular_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; normalized_state_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;block-validation&quot;&gt;Block validation&lt;&#x2F;h3&gt;
&lt;p&gt;The transaction&#x27;s &lt;code&gt;gas_used&lt;&#x2F;code&gt; is computed as the sum of &lt;code&gt;regular_gas&lt;&#x2F;code&gt; and &lt;code&gt;state_gas&lt;&#x2F;code&gt; and includes refunds, similar to how &lt;code&gt;gas_used&lt;&#x2F;code&gt; is applied today. The &lt;code&gt;regular_gas_used&lt;&#x2F;code&gt; is returned without refunds, which the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; cumulative gas at the block level accounts for. We also keep track of the cumulative &lt;code&gt;state_bytes_created&lt;&#x2F;code&gt; and &lt;code&gt;state_bytes_cleared&lt;&#x2F;code&gt; in the vector &lt;code&gt;state_bytes&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validate_block&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check that the excess state bytes was updated correctly&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;excess_state_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; calc_excess_state_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Compute the per-block state_gas_per_byte and update state-op gas costs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state_gas_per_byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_state_gas_per_byte&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    update_state_op_costs&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state_gas_per_byte&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state_bytes_created&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state_bytes_cleared&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;transactions&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transaction execution returns a gas_used vector and refund_vector&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        gas_used&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; regular_gas_used&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; state_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;execute_transaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;transaction&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; effective_gas_price&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The gas refund stays the same, the transaction gas counter only counts regular gas without refunds&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        gas_refund&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; gas_used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        cumulative_transaction_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; regular_gas_used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Update the total state bytes created and cleared in the block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        state_bytes_created&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; state_bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        state_bytes_cleared&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; state_bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Ensure the net state bytes created are within the per-block limit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; state_bytes_created&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_STATE_BYTES_PER_BLOCK&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; state_bytes_cleared&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Ensure state_bytes_created and state_bytes_cleared matches header&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; state_bytes_created&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state_bytes_created&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; state_bytes_cleared&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state_bytes_cleared&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;potential-concerns-with-current-eip-8037&quot;&gt;Potential concerns with current EIP-8037&lt;&#x2F;h3&gt;
&lt;p&gt;EIP-8037 sets a fixed price of 1900 gas per byte, which can lead to a range of outcomes, depending on, e.g., the price-elasticity of demand for state creation. A specific concern is that since EIP-8037 counts state gas against the regular block gas limit, it may impede scaling, when users consume relatively more state gas at the higher gas per byte charged after the change. EIP-8037 assumes that users will spend 30% of all gas on state gas, just as today, even if the state gas per state byte is increased close to tenfold. This assumption may not hold.&lt;&#x2F;p&gt;
&lt;p&gt;Ideally, an increase in the gas cost for state creation will lead users and developers to reduce usage of these operations, relative to other operations. As an example, some may opt to use an existing ETH address instead of creating a new one for each CEX withdrawal. However, given that state creation is a rather fundamental part of interacting with a blockchain, it is reasonable to suspect that many other usage patterns remain as today. Furthermore, an increase in the gas limit as Ethereum scales is associated with a general drop in the base fee. Thus, even if state creation becomes relatively more expensive than other operations, the reduced base fee may mean that users do not take notice to the extent that is desired.&lt;&#x2F;p&gt;
&lt;p&gt;Assume that 30% of all consumed gas is state gas at 60M gas limit, producing 102 GiB in state growth per year (286 MiB&#x2F;day). Then scale the L1 by $5x$ up to a 300M gas limit and increase the gas cost for state creation by $8.5x$ (using account creation in EIP-8037 as a reference point), while usage patterns do not change. The equilibrium outcome is then that $100 \times 0.3 \times 8.5 &#x2F; (0.3 \times 8.5 + 0.7) = 78.5%$ of all gas is spent on state. Even though Ethereum scaled the gas limit by $5x$, the real achieved scaling is only $5 \times (1 - 0.785) &#x2F; 0.7 = 1.54x$, and state growth is 157 GiB per year (440 MiB&#x2F;day).&lt;&#x2F;p&gt;
&lt;p&gt;The first example assumes no change in usage behavior and illustrates a general effect that might take place, but somewhat less pronounced. Assume instead that usage patterns indeed change, and that users create half as many state bytes for every gas they spend on other operations, in comparison to how they interact with Ethereum today. In this case, the equilibrium outcome is that $100 \times (0.3 \times 8.5 \times 0.5) &#x2F; (0.3 \times 8.5 \times 0.5 + 0.7) = 64.7%$ of all gas is spent on state. When scaling the gas limit by $5x$, the real achieved scaling is $5 \times (1 - 0.647) &#x2F; 0.7 = 2.52x$, and state growth is 129 GiB per year (363 MiB&#x2F;day).&lt;&#x2F;p&gt;
&lt;p&gt;Exempting state from the gas limit applied to regular gas—as proposed in this EIP—would produce a $7.14x$ in scaling (for non-state operations). We would thus achieve close to three times as much throughput as achieved in the example where users halve their state purchases relative to other operations (because they would still spend 64.7% of all available gas on state creation).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;alternative-specifications&quot;&gt;Alternative specifications&lt;&#x2F;h3&gt;
&lt;p&gt;Alternative solutions would ideally adhere to the principles outlined in this EIP, specifically:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;It is necessary to exempt state from the aggregated regular gas limit, and assign state its own limit. Otherwise, as the gas cost for state is increased, the reduction in gas remaining for other operations will impede scaling.&lt;&#x2F;li&gt;
&lt;li&gt;It is not possible to guarantee some specific state expansion just by altering gas costs, given that the price-elasticity of demand is unknown. For this reason, it is desirable to set the cost of state independently and according to its usage. At the same time, a fixed increase in the state gas cost will always help in reducing state consumption to some extent, but there is then also always a risk of overshooting.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h4 id=&quot;multidimensional-subfee-market&quot;&gt;Multidimensional subfee market&lt;&#x2F;h4&gt;
&lt;p&gt;One variant is to expand the transaction format, using a separate &lt;code&gt;regular_gas_limit&lt;&#x2F;code&gt; and &lt;code&gt;state_byte_limit&lt;&#x2F;code&gt; while removing the current &lt;code&gt;gas_limit&lt;&#x2F;code&gt;. At the beginning of processing a transaction, the protocol computes:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; regular_gas_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; state_gas_per_byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; state_byte_limit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;All further processing is applied as if the transaction had specified the computed &lt;code&gt;gas_limit&lt;&#x2F;code&gt; in the first place. This ensures that users do not need to risk having a transaction fail if the &lt;code&gt;state_gas_per_byte&lt;&#x2F;code&gt; drifts significantly between submission and execution, if they set a tight &lt;code&gt;gas_limit&lt;&#x2F;code&gt;. They simply specify how much regular gas they will use and how many state-bytes they will add, which then implies a certain &lt;code&gt;gas_limit&lt;&#x2F;code&gt; at execution time. The idea has certain similarities with the &quot;aggregated gas&quot; concept explored in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7999&#x2F;&quot;&gt;EIP-7999&lt;&#x2F;a&gt;, but the separate fee here influences how much gas that a resource consumes, hence the name &quot;Multidimensional subfee market&quot;. A benefit of the approach is that it offers perfect control over state growth while there is no fee-drift that can make a transaction fail. A downside is that the transaction format must be updated. It would be possible to move to a multidimensional subfee market at a later stage, after first implementing this proposal.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;multidimensional-gas-metering&quot;&gt;Multidimensional gas metering&lt;&#x2F;h4&gt;
&lt;p&gt;It is possible to try to achieve the stated goals with multidimensional gas metering of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8011&#x2F;&quot;&gt;EIP-8011&lt;&#x2F;a&gt;. The difference between the proposal and the EIP-8011 mechanism is that the latter would not have a separate price for state. It uses the &lt;code&gt;max&lt;&#x2F;code&gt; of the gas consumption among resources for the base fee update. The base fee update may thus for example be set either from the &lt;code&gt;regular_gas&lt;&#x2F;code&gt; or the &lt;code&gt;state_gas&lt;&#x2F;code&gt;, depending on which that is used the most in the block. This means that there is less control over state growth due to the interaction between resources. When another resource consumes the most gas, it will also set the price for state.  When state is the most consumed resource, it might raise the price for other resources to a level where scaling is impeded. These types of interactions can be optimized by careful tuning of limits, targets and gas costs, although whatever setting that is decided on may never be fully satisfactory. The benefit is that the gas cost set for state can be fixed, while state still is &quot;exempted&quot; from the regular gas limit, since it only influences the base fee in parallel via the &lt;code&gt;max&lt;&#x2F;code&gt; operation. Thus scaling is mostly preserved.&lt;&#x2F;p&gt;
&lt;p&gt;Finally, it is possible to use the &lt;code&gt;max&lt;&#x2F;code&gt; of the gas consumption among resources for the base fee update, while still retaining the separate EIP-4844 mechanism for the &lt;code&gt;state_gas_per_byte&lt;&#x2F;code&gt;. This just represents another way to update the base fee, instead of the aggregation proposed here.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;multidimensional-fee-market-with-aggregate-gas&quot;&gt;Multidimensional fee market with aggregate gas&lt;&#x2F;h4&gt;
&lt;p&gt;The multidimensional fee market with aggregate gas specified in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7999&#x2F;&quot;&gt;EIP-7999&lt;&#x2F;a&gt; could be applied without changing the transaction format. The gas cost for state creation is fixed and users set a single &lt;code&gt;gas_limit&lt;&#x2F;code&gt;. The fee for the gas for state creation is however completely separate in &lt;code&gt;fee_per_state_gas&lt;&#x2F;code&gt;, instead of being folded into the gas cost through conversion. Users set a &lt;code&gt;max_fee_per_gas&lt;&#x2F;code&gt; as today and the total fee they are willing to pay is computed as &lt;code&gt;max_fee = max_fee_per_gas * gas_limit&lt;&#x2F;code&gt;. This fee is compared with the fee determined during execution: &lt;code&gt;fee_per_state_gas * state_gas + base_fee_per_gas * regular_gas&lt;&#x2F;code&gt;. The benefit is that the gas cost cannot drift between transaction submission and execution, while the transaction format still stays the same. The downside is that if a users sets a tight &lt;code&gt;max_fee_per_gas&lt;&#x2F;code&gt;, then the builder cannot be sure before execution whether the fee covers the cost of the transaction. The user would need to set a more permissive &lt;code&gt;max_fee_per_gas&lt;&#x2F;code&gt; that covers the higher of &lt;code&gt;base_fee_per_gas&lt;&#x2F;code&gt; and &lt;code&gt;fee_per_state_gas&lt;&#x2F;code&gt; to provide full guarantees.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;combination-with-multidimensional-gas-metering&quot;&gt;Combination with multidimensional gas metering&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP works well with a broader adoption of full multidimensional gas metering, as proposed in EIP-8011, if we at the same time also adopt the EIP-8011 mechanism for updating the base fee, as suggested previously. We would then expand the &lt;code&gt;gas_used_per_resource&lt;&#x2F;code&gt; vector to track also the other resources in separation. State would still be treated differently in that it has its own &lt;code&gt;state_gas_per_byte&lt;&#x2F;code&gt; cost derived from the &lt;code&gt;excess_state_bytes&lt;&#x2F;code&gt;, whereas other resources are priced directly via the base fee. The metering approach of EIP-8011 is then applied to set the base fee. Given that state is increasingly becoming the major resource contraint (and thus pricing constraint) as we try to limit its usage, it is particularly beneficial that this EIP would allow the EIP-8011 metering to only be applied to the remaining resources. This is likely to benefit scaling further. Note further that the special treatment of the &lt;code&gt;code_deposit_gas&lt;&#x2F;code&gt; proposed in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8037&#x2F;&quot;&gt;EIP-8037&lt;&#x2F;a&gt; would not be necessary with this proposal, because the constraint on state bytes per block is more moderate.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The gas consumed by state creation operations will slowly change so that state growth is maintained at a desirable level. The speed of that drift is tuned by adjusting the &lt;code&gt;STATE_GAS_UPDATE_FRACTION&lt;&#x2F;code&gt;. This constant must be set to a level where UX concerns are mitigated. Specifically, the main concern is that if a transaction sets a very tight &lt;code&gt;gas_limit&lt;&#x2F;code&gt; while consuming state bytes, then that &lt;code&gt;gas_limit&lt;&#x2F;code&gt; may be exceeded, if the &lt;code&gt;state_gas_per_byte&lt;&#x2F;code&gt; cost derived from the &lt;code&gt;excess_state_bytes&lt;&#x2F;code&gt; shifts between submission and execution. The transaction would thus fail. Wallets must first fetch the &lt;code&gt;excess_state_bytes&lt;&#x2F;code&gt; and compute &lt;code&gt;state_gas_per_byte&lt;&#x2F;code&gt;, just as for the &lt;code&gt;blob_base_fee&lt;&#x2F;code&gt; (and &lt;code&gt;base_fee&lt;&#x2F;code&gt;) today. They know how many &lt;code&gt;state_bytes&lt;&#x2F;code&gt; that are created from each op-code of the transaction via the constants inherited from EIP-8037, e.g., &lt;code&gt;NEW_ACCOUNT_BYTES = 112&lt;&#x2F;code&gt;. They then simply add a margin &lt;code&gt;m&lt;&#x2F;code&gt; when computing the &lt;code&gt;gas_limit&lt;&#x2F;code&gt; set for the transaction: &lt;code&gt;gas_limit = regular_gas_limit + state_bytes * state_gas_per_byte * m&lt;&#x2F;code&gt;. The margin is tuned to the variation in &lt;code&gt;state_gas_per_byte&lt;&#x2F;code&gt; that is expected before execution, at the upper limit. The wallet may of course add some margin to their estimate for the &lt;code&gt;regular_gas_limit&lt;&#x2F;code&gt; of other op-codes as well when computing the &lt;code&gt;gas_limit&lt;&#x2F;code&gt;. The difference to the alternative &quot;Multidimensional subfee market&quot; outlined previously is thus that the wallet does not send a &lt;code&gt;regular_gas_limit&lt;&#x2F;code&gt; and &lt;code&gt;state_bytes_limit&lt;&#x2F;code&gt; separately, and instead combine them in order to preserve the current transaction format.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Wallets must have a margin when they set the &lt;code&gt;gas_limit&lt;&#x2F;code&gt; so that the transaction does not fail.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>State Creation Gas Cost Increase</title>
        <published>2025-10-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:29+00:00</updated>
	
	
	<author>
		<name>Maria Silva</name><uri>https://github.com/misilva73</uri>
	</author>
	
	<author>
		<name>Carlos Perez</name><uri>https://github.com/CPerezz</uri>
	</author>
	
	<author>
		<name>Jochem Brouwer</name><uri>https://github.com/jochem-brouwer</uri>
	</author>
	
	<author>
		<name>Ansgar Dietrichs</name><uri>https://github.com/adietrichs</uri>
	</author>
	
	<author>
		<name>Łukasz Rozmej</name><uri>https://github.com/LukaszRozmej</uri>
	</author>
	
	<author>
		<name>Anders Elowsson</name><uri>https://github.com/anderselowsson</uri>
	</author>
	
	<author>
		<name>Francesco D&#x27;Amato</name><uri>https://github.com/fradamt</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8037/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8037-state-creation-gas-cost-increase/25694" />
        

        <id>https://wg-eips.ritovision.com/8037/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:8037"
            label="EIP-8037" />
        

        
        

        
        <summary type="html">Harmonization, increase and separate metering of state creation gas costs to mitigate state growth and unblock scaling</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8037/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal increases the cost of state creation operations, thus avoiding excessive state growth under increased block gas limits. It dynamically sets the unit cost per new state byte at a given block gas limit, by targeting an average state growth of 100 GiB per year based on current network usage. It also introduces an independent metering for state creation costs, thus allowing for increased throughput and for larger contract deployments without being limited by the single transaction gas limit.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;State creation does not have a harmonized cost, with different methods incurring varied costs for creating the same size of new state. For instance, while contract deployment only costs 202 gas units per new byte created, new storage slots cost 625 gas units per new byte created. Also, deploying duplicated bytecode costs the same as deploying new bytecode, even though clients don&#x27;t store duplicated code in the database. This proposal establishes a standard to harmonize all state creation operations.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, state growth will become a bottleneck for scaling under higher block limits. As of May 2025, the current database size in a Geth node dedicated to state is ~340 GiB. After the increase in gas limit from 30M to 36M gas units, the median size of new state created each day doubled, from ~102 MiB to ~205 MiB. This results in an annual growth of ~73 GiB per year.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8037&#x2F;.&#x2F;assets&#x2F;new_state_added.png&quot; alt=&quot;new_state_added&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The relationship we are seeing in this example is not linear as expected. This is likely due to other factors impacting user behavior. However, all else being equal, we expect a proportional increase in the number of new states created as gas limits increase. At a 60M gas limit (and a proportional increase in new state per day of 1.7x), we would see a daily state growth of ~349 MiB and a yearly state growth of ~124 GiB. Similarly, at a 100M gas limit, the state would grow at a rate of ~553 MiB per day and 197 GiB per year. This level of state growth would give us less than 2.5 years until the size of the state database exceeds the threshold of 650 GiB, at which point nodes will begin experiencing a degradation in performance.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;new-parameters&quot;&gt;New parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&quot;text-align: center&quot;&gt;&lt;strong&gt;Parameter&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;&lt;strong&gt;Value&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;TARGET_STATE_GROWTH_PER_YEAR&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;100 × 1024^3 bytes&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;CPSB_SIGNIFICANT_BITS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;5&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;CPSB_OFFSET&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;9578&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Besides these fixed parameters, this EIP introduces a dynamic variable that controls the cost per byte of state created for a given block gas limit. The variable is &lt;code&gt;cost_per_state_byte&lt;&#x2F;code&gt; and is calculated as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;raw&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; ceil&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2_628_000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TARGET_STATE_GROWTH_PER_YEAR&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;shifted&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; raw&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CPSB_OFFSET&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;shift&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;bit_length&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;shifted&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CPSB_SIGNIFICANT_BITS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cost_per_state_byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;shifted&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; shift&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; shift&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CPSB_OFFSET&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The raw value is the unquantized cost derived from targeting &lt;code&gt;TARGET_STATE_GROWTH_PER_YEAR&lt;&#x2F;code&gt; at 50% average gas utilization (see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8037&#x2F;#deriving-the-cost-per-byte&quot;&gt;Deriving the cost per byte&lt;&#x2F;a&gt;). Quantization retains the top &lt;code&gt;CPSB_SIGNIFICANT_BITS&lt;&#x2F;code&gt; significant bits after applying &lt;code&gt;CPSB_OFFSET&lt;&#x2F;code&gt;, producing a stepped function that avoids frequent small changes as the gas limit fluctuates (see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8037&#x2F;#quantization-of-cost-per-state-byte&quot;&gt;Quantization&lt;&#x2F;a&gt;).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parameter-changes&quot;&gt;Parameter changes&lt;&#x2F;h3&gt;
&lt;p&gt;Upon activation of this EIP, the following parameters of the gas model are updated. The &quot;New State Gas&quot; column shows the state gas cost (charged to the &lt;code&gt;state_gas&lt;&#x2F;code&gt; dimension), while the &quot;New Regular Gas&quot; column shows additional regular gas costs that accompany the state gas charge.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;strong&gt;Parameter&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;strong&gt;Current&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;strong&gt;New State Gas&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;strong&gt;New Regular Gas&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;strong&gt;Operations affected&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;GAS_CREATE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;32,000&lt;&#x2F;td&gt;&lt;td&gt;112 × &lt;code&gt;cpsb&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;9,000 (assuming same as &lt;code&gt;GAS_CALL_VALUE&lt;&#x2F;code&gt;)&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;CREATE&lt;&#x2F;code&gt;, &lt;code&gt;CREATE2&lt;&#x2F;code&gt;, contract creation txs&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;GAS_CODE_DEPOSIT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;200&#x2F;byte&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;cpsb&lt;&#x2F;code&gt; per byte&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;6 × ceil(len&#x2F;32)&lt;&#x2F;code&gt; (hash cost)&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;CREATE&lt;&#x2F;code&gt;, &lt;code&gt;CREATE2&lt;&#x2F;code&gt;, contract creation txs&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;GAS_NEW_ACCOUNT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;25,000&lt;&#x2F;td&gt;&lt;td&gt;112 × &lt;code&gt;cpsb&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;0 (already has &lt;code&gt;GAS_CALL_VALUE&lt;&#x2F;code&gt; 9,000)&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;CALL*&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;GAS_STORAGE_SET&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;20,000&lt;&#x2F;td&gt;&lt;td&gt;32 × &lt;code&gt;cpsb&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;2,900 (&lt;code&gt;GAS_STORAGE_UPDATE - GAS_COLD_SLOAD&lt;&#x2F;code&gt;)&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;SSTORE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;PER_EMPTY_ACCOUNT_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;25,000&lt;&#x2F;td&gt;&lt;td&gt;112 × &lt;code&gt;cpsb&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;0 (included in &lt;code&gt;PER_AUTH_BASE_COST&lt;&#x2F;code&gt;)&lt;&#x2F;td&gt;&lt;td&gt;EOA delegation&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;PER_AUTH_BASE_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;12,500&lt;&#x2F;td&gt;&lt;td&gt;23 × &lt;code&gt;cpsb&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;7,500&lt;&#x2F;td&gt;&lt;td&gt;EOA delegation&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Where &lt;code&gt;cpsb&lt;&#x2F;code&gt; = &lt;code&gt;cost_per_state_byte&lt;&#x2F;code&gt;. The values assigned to regular gas will be updated based on &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8038&#x2F;&quot;&gt;EIP-8038&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&amp;lt;-TODO-&amp;gt;&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;PER_AUTH_BASE_COST&lt;&#x2F;code&gt; regular gas of 7,500 is derived from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt;&#x27;s cost analysis, excluding the code deployment cost (now charged as state gas):&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Calldata cost: ~1,616 (101 bytes × 16)&lt;&#x2F;li&gt;
&lt;li&gt;Recovering authority address (ecrecover): 3,000&lt;&#x2F;li&gt;
&lt;li&gt;Reading nonce and code of authority (cold access): 2,600&lt;&#x2F;li&gt;
&lt;li&gt;Storing values in already warm account: 200&lt;&#x2F;li&gt;
&lt;li&gt;&lt;del&gt;Code deployment cost: 4,600 (200 × 23)&lt;&#x2F;del&gt; → now in state gas&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Total regular gas: 1,616 + 3,000 + 2,600 + 200 ≈ 7,500&lt;&#x2F;p&gt;
&lt;p&gt;In addition, &lt;code&gt;GAS_SELF_DESTRUCT_NEW_ACCOUNT&lt;&#x2F;code&gt; is removed and replaced by &lt;code&gt;GAS_NEW_ACCOUNT&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;multidimensional-metering-for-state-creation-costs&quot;&gt;Multidimensional metering for state creation costs&lt;&#x2F;h3&gt;
&lt;p&gt;Besides the parameter changes, this proposal introduces an independent metering for state creation costs. The specification is derived from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8011&#x2F;&quot;&gt;EIP-8011&lt;&#x2F;a&gt;. However, it only requires two dimensions, namely, &lt;code&gt;regular_gas&lt;&#x2F;code&gt; and &lt;code&gt;state_gas&lt;&#x2F;code&gt;. For state creation operations, the &quot;new state costs&quot; are charged to &lt;code&gt;state_gas&lt;&#x2F;code&gt;, while the &quot;new regular costs&quot; are charged to &lt;code&gt;regular_gas&lt;&#x2F;code&gt;. The costs of all other operations are also charged to &lt;code&gt;regular_gas&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;At transaction level, the user pays for both &lt;code&gt;regular_gas&lt;&#x2F;code&gt; and &lt;code&gt;state_gas&lt;&#x2F;code&gt;. The total gas cost of a transaction is the sum of both dimensions. In addition, the transaction gas limit set in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7825&#x2F;&quot;&gt;EIP-7825&lt;&#x2F;a&gt; only applies to &lt;code&gt;regular_gas&lt;&#x2F;code&gt;, while &lt;code&gt;state_gas&lt;&#x2F;code&gt; is only capped by &lt;code&gt;tx.gas&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;At the block level, only the gas used in the bottleneck resource is considered when checking if the block is full and when updating the base fee for the next block. This gives a new meaning to the block’s gas limit and the block’s gas target, which now corresponds to the maximum gas that can be metered in the bottleneck resource.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;transaction-validation&quot;&gt;Transaction validation&lt;&#x2F;h4&gt;
&lt;p&gt;Before transaction execution, &lt;code&gt;calculate_intrinsic_cost&lt;&#x2F;code&gt; returns three values: &lt;code&gt;intrinsic_regular_gas&lt;&#x2F;code&gt;, &lt;code&gt;intrinsic_state_gas&lt;&#x2F;code&gt;, and &lt;code&gt;calldata_floor_gas_cost&lt;&#x2F;code&gt;. State gas components of intrinsic cost (e.g., account creation for contract deployment transactions, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2780&#x2F;&quot;&gt;EIP-2780&lt;&#x2F;a&gt; charges, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; authorization charges) are included in &lt;code&gt;intrinsic_state_gas&lt;&#x2F;code&gt;. All other intrinsic costs (base transaction cost, calldata, access lists, authorization base costs) are included in &lt;code&gt;intrinsic_regular_gas&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;validate_transaction&lt;&#x2F;code&gt; rejects transactions where:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;intrinsic_regular_gas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; calldata_floor_gas_cost&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TX_MAX_GAS_LIMIT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;validate_transaction&lt;&#x2F;code&gt; also returns &lt;code&gt;intrinsic_regular_gas&lt;&#x2F;code&gt;, &lt;code&gt;intrinsic_state_gas&lt;&#x2F;code&gt;, and &lt;code&gt;calldata_floor_gas_cost&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;transaction-level-gas-accounting-reservoir-model&quot;&gt;Transaction-level gas accounting (reservoir model)&lt;&#x2F;h4&gt;
&lt;p&gt;Since transactions have a single gas limit parameter (&lt;code&gt;tx.gas&lt;&#x2F;code&gt;), gas accounting is enforced through a &lt;strong&gt;reservoir model&lt;&#x2F;strong&gt;, in which &lt;code&gt;gas_left&lt;&#x2F;code&gt; and &lt;code&gt;state_gas_reservoir&lt;&#x2F;code&gt; are initialized as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;intrinsic_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; intrinsic_regular_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; intrinsic_state_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;execution_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; intrinsic_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;regular_gas_budget&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TX_MAX_GAS_LIMIT&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; intrinsic_regular_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gas_left&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;regular_gas_budget&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; execution_gas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;state_gas_reservoir&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; execution_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; gas_left&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;state_gas_reservoir&lt;&#x2F;code&gt; holds gas that exceeds the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7825&#x2F;&quot;&gt;EIP-7825&lt;&#x2F;a&gt;&#x27;s budget. The two counters operate as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Regular gas&lt;&#x2F;strong&gt; charges deduct from &lt;code&gt;gas_left&lt;&#x2F;code&gt; only.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;State gas&lt;&#x2F;strong&gt; charges deduct from &lt;code&gt;state_gas_reservoir&lt;&#x2F;code&gt; first; when the reservoir is exhausted, from &lt;code&gt;gas_left&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;GAS&lt;&#x2F;code&gt; opcode returns &lt;code&gt;gas_left&lt;&#x2F;code&gt; only (excluding the reservoir).&lt;&#x2F;li&gt;
&lt;li&gt;The reservoir is passed &lt;strong&gt;in full&lt;&#x2F;strong&gt; to child frames (no 63&#x2F;64 rule). Unused reservoir is returned to the parent on child completion.&lt;&#x2F;li&gt;
&lt;li&gt;On &lt;strong&gt;exceptional halt&lt;&#x2F;strong&gt;, both &lt;code&gt;gas_left&lt;&#x2F;code&gt; and &lt;code&gt;state_gas_reservoir&lt;&#x2F;code&gt; are set to zero (all gas consumed), consistent with existing EVM out-of-gas semantics. This is not applied to system transactions.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The two counters are returned by the transaction output. Besides the two counters, the EVM also keeps track of &lt;code&gt;execution_state_gas_used&lt;&#x2F;code&gt; and &lt;code&gt;execution_regular_gas_used&lt;&#x2F;code&gt; during transaction execution. &lt;code&gt;state_gas&lt;&#x2F;code&gt; costs are added to &lt;code&gt;execution_state_gas_used&lt;&#x2F;code&gt; while &lt;code&gt;regular_gas&lt;&#x2F;code&gt; costs are added to &lt;code&gt;execution_regular_gas_used&lt;&#x2F;code&gt;. These two counters are also returned by the transaction output.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;transaction-gas-used&quot;&gt;Transaction gas used&lt;&#x2F;h4&gt;
&lt;p&gt;At the end of transaction execution, the gas used before and after refunds is defined as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tx_gas_used_before_refund&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; tx_output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_left&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; tx_output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state_gas_reservoir&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tx_gas_refund&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 5&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tx_output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;refund_counter&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tx_gas_used_after_refund&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; tx_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; tx_gas_refund&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The refund cap remains at 20% of gas used.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;block-level-gas-accounting&quot;&gt;Block-level gas accounting&lt;&#x2F;h4&gt;
&lt;p&gt;At block level, instead of tracking a single &lt;code&gt;gas_used&lt;&#x2F;code&gt; counter, we keep track of two counters, one for &lt;code&gt;state_gas&lt;&#x2F;code&gt; and one for &lt;code&gt;regular_gas&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tx_regular_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; intrinsic_regular_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; tx_output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;execution_regular_gas_used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tx_state_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; intrinsic_state_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; tx_output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;execution_state_gas_used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;block_output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;block_regular_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx_regular_gas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; calldata_floor_gas_cost&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;block_output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;block_state_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; tx_state_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The block header &lt;code&gt;gas_used&lt;&#x2F;code&gt; field is set to:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block_output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;block_regular_gas_used&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; block_output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;block_state_gas_used&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The block validity condition uses this value:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span&gt; gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;invalid block: too much gas used&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The base fee update rule is also modified accordingly:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gas_used_delta&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_target&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;sstore-refund-for-slot-restoration&quot;&gt;&lt;code&gt;SSTORE&lt;&#x2F;code&gt; refund for slot restoration&lt;&#x2F;h3&gt;
&lt;p&gt;When a storage slot is set to a non-zero value and then restored to zero within the same transaction (0→X→0 pattern), the following are refunded via &lt;code&gt;refund_counter&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;State gas: &lt;code&gt;32 × cost_per_state_byte&lt;&#x2F;code&gt; (the state creation charge)&lt;&#x2F;li&gt;
&lt;li&gt;Regular gas: &lt;code&gt;GAS_STORAGE_UPDATE - GAS_COLD_SLOAD - GAS_WARM_ACCESS&lt;&#x2F;code&gt; (2,800)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The net cost after refund is &lt;code&gt;GAS_WARM_ACCESS&lt;&#x2F;code&gt; (100), consistent with pre-&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8037&#x2F;&quot;&gt;EIP-8037&lt;&#x2F;a&gt; &lt;code&gt;SSTORE&lt;&#x2F;code&gt; restoration behavior. Refunds use &lt;code&gt;refund_counter&lt;&#x2F;code&gt; rather than direct gas accounting decrements, so that reverted frames do not benefit from the refund.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;revert-behavior-for-state-gas&quot;&gt;Revert behavior for state gas&lt;&#x2F;h3&gt;
&lt;p&gt;State gas charged for account creation (&lt;code&gt;CREATE&lt;&#x2F;code&gt;, &lt;code&gt;CALL&lt;&#x2F;code&gt; to new account, and EOA delegation) is consumed even if the frame reverts — state changes are rolled back but gas is not refunded. This is consistent with pre-&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8037&#x2F;&quot;&gt;EIP-8037&lt;&#x2F;a&gt; behavior where &lt;code&gt;GAS_NEW_ACCOUNT&lt;&#x2F;code&gt; was consumed on revert.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;eip-2780-authorizations&quot;&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2780&#x2F;&quot;&gt;EIP-2780&lt;&#x2F;a&gt; authorizations&lt;&#x2F;h4&gt;
&lt;p&gt;For &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; authorizations, the intrinsic state gas assumes account creation for each authorization: &lt;code&gt;(112 + 23) × cost_per_state_byte&lt;&#x2F;code&gt; per authorization. When an authorization targets an existing account (no account creation needed), the &lt;code&gt;112 × cost_per_state_byte&lt;&#x2F;code&gt; portion is subtracted from &lt;code&gt;intrinsic_state_gas&lt;&#x2F;code&gt; during authorization processing, before state changes begin.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;receipt-semantics&quot;&gt;Receipt semantics&lt;&#x2F;h4&gt;
&lt;p&gt;Receipt &lt;code&gt;cumulative_gas_used&lt;&#x2F;code&gt; tracks the cumulative sum of &lt;code&gt;tx_gas_used_after_refund&lt;&#x2F;code&gt; (post-refund, post-floor) across transactions, instead of the block&#x27;s &lt;code&gt;gas_used&lt;&#x2F;code&gt;. This means &lt;code&gt;receipt[i].cumulative_gas_used - receipt[i-1].cumulative_gas_used&lt;&#x2F;code&gt; equals the gas paid by transaction &lt;code&gt;i&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;contract-deployment-cost-calculation&quot;&gt;Contract deployment cost calculation&lt;&#x2F;h3&gt;
&lt;p&gt;When a contract creation transaction or opcode (&lt;code&gt;CREATE&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;CREATE2&lt;&#x2F;code&gt;) is executed, gas is charged differently based on whether the deployment succeeds or fails. Given bytecode &lt;code&gt;B&lt;&#x2F;code&gt; (length &lt;code&gt;L&lt;&#x2F;code&gt;) returned by initcode and &lt;code&gt;H = keccak256(B)&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;When opcode execution starts:&lt;&#x2F;strong&gt; Always charge &lt;code&gt;GAS_CREATE&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;During initcode execution:&lt;&#x2F;strong&gt; Charge the actual gas consumed by the initcode execution&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Success path&lt;&#x2F;strong&gt; (no error, not reverted, and &lt;code&gt;L ≤ MAX_CODE_SIZE&lt;&#x2F;code&gt;):
&lt;ul&gt;
&lt;li&gt;Charge &lt;code&gt;GAS_CODE_DEPOSIT * L&lt;&#x2F;code&gt; and persist &lt;code&gt;B&lt;&#x2F;code&gt; under &lt;code&gt;H&lt;&#x2F;code&gt;, then link &lt;code&gt;codeHash&lt;&#x2F;code&gt; to &lt;code&gt;H&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Charge &lt;code&gt;HASH_COST(L)&lt;&#x2F;code&gt; where &lt;code&gt;HASH_COST(L) = 6 × ceil(L &#x2F; 32)&lt;&#x2F;code&gt; to compute &lt;code&gt;H&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Failure paths&lt;&#x2F;strong&gt; (REVERT, OOG&#x2F;invalid during initcode, OOG during code deposit, or &lt;code&gt;L &amp;gt; MAX_CODE_SIZE&lt;&#x2F;code&gt;):
&lt;ul&gt;
&lt;li&gt;Do NOT charge &lt;code&gt;GAS_CODE_DEPOSIT * L&lt;&#x2F;code&gt; or &lt;code&gt;HASH_COST(L)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;No code is stored; no &lt;code&gt;codeHash&lt;&#x2F;code&gt; is linked to the account&lt;&#x2F;li&gt;
&lt;li&gt;The account remains unchanged or non-existent&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;strong&gt;Important:&lt;&#x2F;strong&gt; The gas for code deposit (&lt;code&gt;GAS_CODE_DEPOSIT * L&lt;&#x2F;code&gt;) is checked before hash computation. This means that if a deployment runs out of gas, it will fail during the deposit gas check before the hash is computed. This maintains consistency with post-Homestead behavior where any deployment failure (including OOG) reverts all state changes - no account is created, and no gas is charged beyond &lt;code&gt;GAS_CREATE&lt;&#x2F;code&gt; and the actual initcode execution cost consumed.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Total gas formulas:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SUCCESS_PATH_TOTAL_GAS =&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    GAS_CREATE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  + initcode_execution_cost&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  + (GAS_NEW_ACCOUNT if account is new else 0)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  + GAS_CODE_DEPOSIT * L&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  + HASH_COST(L)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;FAILURE_PATH_TOTAL_GAS =&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    GAS_CREATE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  + initcode_execution_cost&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;create-vs-create2&quot;&gt;&lt;code&gt;CREATE&lt;&#x2F;code&gt; vs &lt;code&gt;CREATE2&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;CREATE2&lt;&#x2F;code&gt; already charges for hashing the init code when deriving the address. That cost remains unchanged. The bytecode hash (&lt;code&gt;keccak256(B)&lt;&#x2F;code&gt;) must be computed on success to store the code, incurring &lt;code&gt;HASH_COST(L)&lt;&#x2F;code&gt; as specified above.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;deriving-the-cost-per-byte&quot;&gt;Deriving the cost per byte&lt;&#x2F;h3&gt;
&lt;p&gt;The variable &lt;code&gt;cost_per_state_byte&lt;&#x2F;code&gt; is a dynamic parameter that depends on the block gas limit. The idea is to have a cost that scales as the block gas limit increases, thus avoiding excessive state growth. To compute this variable, we target a specific state growth per year, which we set to 100 GiB. Then, we assume this growth rate is achieved at an average gas utilization.&lt;&#x2F;p&gt;
&lt;p&gt;With multidimensional metering, blocks can be filled up to 50% of the target for both regular gas and state gas. Thus, we consider that on average, blocks can use half of the entire available gas in the block for state creation. This leads to a total of &lt;code&gt;(gas_limit&#x2F;2) * 7200 * 365&lt;&#x2F;code&gt; gas units used for state creation in a year. Dividing this by the target state growth per year gives us the cost per byte of state created.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;quantization-of-cost-per-state-byte&quot;&gt;Quantization of &lt;code&gt;cost_per_state_byte&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Without quantization, &lt;code&gt;cost_per_state_byte&lt;&#x2F;code&gt; changes by 1 for every ~81,715 change in gas limit, which is 0.13% of the current block gas limit of 60M gas units. This creates unnecessary churn for tooling and gas estimation, since the cost can change almost every block even when the gas limit is relatively stable.&lt;&#x2F;p&gt;
&lt;p&gt;The quantization scheme retains the top 5 significant bits of &lt;code&gt;(raw + CPSB_OFFSET)&lt;&#x2F;code&gt;, zeroes the remaining bits, then subtracts &lt;code&gt;CPSB_OFFSET&lt;&#x2F;code&gt;. This is equivalent to binary floating-point rounding: each power-of-2 band has exactly 16 distinct levels, and the step size doubles at each band boundary while remaining perfectly uniform within a band.&lt;&#x2F;p&gt;
&lt;p&gt;The offset (&lt;code&gt;CPSB_OFFSET = 9578&lt;&#x2F;code&gt;) shifts quantization boundaries away from common gas limit targets. It was chosen by brute-force search over 0–10000 to maximize the minimum distance from any quantization boundary to gas limits from 100M to 1000M (in 50M increments). This prevents &lt;code&gt;cost_per_state_byte&lt;&#x2F;code&gt; from flipping between adjacent values due to small gas limit fluctuations near popular targets. The following table shows the resulting boundary distances:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&quot;text-align: center&quot;&gt;Gas Limit&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;&lt;code&gt;cost_per_state_byte&lt;&#x2F;code&gt;&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;Distance to boundary&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;Blocks to boundary&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;100M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;1,174&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;4.15%&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;42.5&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;150M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;1,686&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;8.21%&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;84.0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;200M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;2,198&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;10.24%&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;104.8&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;250M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;2,710&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;5.28%&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;54.1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;300M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;3,222&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;1.68%&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;17.2&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;350M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;4,246&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;0.89%&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;9.1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;400M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;4,758&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;2.82%&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;28.9&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;450M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;5,270&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;4.32%&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;44.2&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;500M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;5,782&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;2.85%&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;29.2&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;550M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;6,294&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;1.10%&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;11.3&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;600M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;6,806&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;6.63%&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;67.8&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;650M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;7,830&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;1.58%&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;16.1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;700M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;7,830&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;3.35%&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;34.3&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;750M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;8,854&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;3.54%&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;36.3&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;800M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;8,854&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;0.89%&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;9.1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;850M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;9,878&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;4.80%&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;49.1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;900M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;10,902&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;1.02%&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;10.5&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;950M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;10,902&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;2.57%&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;26.4&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;1000M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;11,926&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;2.55%&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;26.2&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The worst-case minimum distance is 0.89% of the gas limit (at 350M and 800M). Since the gas limit can deviate from its parent by at most 1&#x2F;1024, &lt;code&gt;cost_per_state_byte&lt;&#x2F;code&gt; remains stable for at least ~9 consecutive blocks of same-direction gas limit changes at any gas limit in the 100M–1000M range (in 50M increments).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;harmonization-across-state-creation&quot;&gt;Harmonization across state creation&lt;&#x2F;h3&gt;
&lt;p&gt;With the current pricing, the gas cost of creating 1 byte of state varies depending on the method used. The following table shows the various methods and their gas cost per byte. The calculation ignores the transaction intrinsic cost (21k gas units) and the costs of additional opcodes and scaffolding needed to execute such a transaction.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Method&lt;&#x2F;th&gt;&lt;th&gt;What is written&lt;&#x2F;th&gt;&lt;th&gt;Intrinsic gas&lt;&#x2F;th&gt;&lt;th&gt;Bytes → state&lt;&#x2F;th&gt;&lt;th&gt;Gas &#x2F; byte&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Deploy 24kB contract (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;170&#x2F;&quot;&gt;EIP-170&lt;&#x2F;a&gt; limit)&lt;&#x2F;td&gt;&lt;td&gt;Runtime code + account trie node&lt;&#x2F;td&gt;&lt;td&gt;32,000 CREATE + 200 × 24,576 code deposit = 4,947,200 gas&lt;&#x2F;td&gt;&lt;td&gt;24,688 B&lt;&#x2F;td&gt;&lt;td&gt;~200 gas&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Fund fresh EOA with 1 wei&lt;&#x2F;td&gt;&lt;td&gt;Updated account leaf&lt;&#x2F;td&gt;&lt;td&gt;25,000 new account&lt;&#x2F;td&gt;&lt;td&gt;~112 B&lt;&#x2F;td&gt;&lt;td&gt;~223 gas&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Add delegate flag to funded EOA (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt;)&lt;&#x2F;td&gt;&lt;td&gt;23 B (0xef0100‖address) + updated account leaf&lt;&#x2F;td&gt;&lt;td&gt;25,000 PER_EMPTY_ACCOUNT + 12,500 PER_AUTH_BASE + 1,616 calldata - 7,823 refund = ~31,300 gas&lt;&#x2F;td&gt;&lt;td&gt;~135 B&lt;&#x2F;td&gt;&lt;td&gt;~232 gas&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; authorization to empty address&lt;&#x2F;td&gt;&lt;td&gt;23 B (0xef0100‖address) + updated account leaf&lt;&#x2F;td&gt;&lt;td&gt;25,000 PER_EMPTY_ACCOUNT + 12,500 PER_AUTH_BASE + 1,616 calldata = 39,116 gas&lt;&#x2F;td&gt;&lt;td&gt;~135 B&lt;&#x2F;td&gt;&lt;td&gt;~289 gas&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Fill new storage slots (SSTORE 0→x)&lt;&#x2F;td&gt;&lt;td&gt;Slot in storage trie&lt;&#x2F;td&gt;&lt;td&gt;20,000 gas&#x2F;slot&lt;&#x2F;td&gt;&lt;td&gt;32 B&lt;&#x2F;td&gt;&lt;td&gt;625 gas&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;To harmonize costs, we first set the gas cost of a single state byte, &lt;code&gt;cost_per_state_byte&lt;&#x2F;code&gt;, as explained above. This is a dynamic parameter that depends on the block gas limit. Now that we have a standardized cost per byte, we can derive the various costs parameters by multiplying the unit cost by the increase in bytes any given operation creates in the database (i.e., 32 bytes per slot, 112 bytes per account and 23 bytes per authorization).&lt;&#x2F;p&gt;
&lt;p&gt;Note that the fixed cost &lt;code&gt;GAS_CREATE&lt;&#x2F;code&gt; for contract deployments assumes the same cost as a new account creation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;multidimensional-metering&quot;&gt;Multidimensional metering&lt;&#x2F;h3&gt;
&lt;p&gt;This proposal is consistent with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8011&#x2F;&quot;&gt;EIP-8011&lt;&#x2F;a&gt;. However, it only requires two dimensions, namely, &lt;code&gt;regular_gas&lt;&#x2F;code&gt; and &lt;code&gt;state_gas&lt;&#x2F;code&gt;. If &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8011&#x2F;&quot;&gt;EIP-8011&lt;&#x2F;a&gt; is not implemented, a two-dimensional version of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8011&#x2F;&quot;&gt;EIP-8011&lt;&#x2F;a&gt; is still required.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;eip-7825-limit-on-contract-size&quot;&gt;EIP-7825 limit on contract size&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7825&#x2F;&quot;&gt;EIP-7825&lt;&#x2F;a&gt; introduces &lt;code&gt;TX_MAX_GAS_LIMIT&lt;&#x2F;code&gt; (16.7M) as the maximum gas for a single transaction, in particular stipulating &lt;code&gt;tx.gas &amp;lt; TX_MAX_GAS_LIMIT&lt;&#x2F;code&gt;as a validity condition. Were we to continue enforcing this validity condition, with a block limit of 100M gas units, this proposal would limit the maximum contract size that can be deployed to roughly 9.9kB ($\frac{16,777,216 - 21,000 - 5,000,000 - 112 \times 1174}{1174} = 9&#x27;902$). This maximum size would only decrease as we increase the gas limit and the &lt;code&gt;cost_per_state_byte&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;To solve this issue, we only apply this gas limit to regular gas, not state gas. Doing so does not weaken the intended scaling effect of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7825&#x2F;&quot;&gt;EIP-7825&lt;&#x2F;a&gt;, because regular gas meters all resources that benefit from parallelization. In particular, state growth does not: growing the state always requires writing to disk, a parallelizable operation, but crucially this part of the cost of a state growth operation has to be metered in regular gas, not state gas. In other words, any operation that grows the state should consume both regular gas and state gas, and the regular gas should fully account for all costs other than the long term effect of growing the state.&lt;&#x2F;p&gt;
&lt;p&gt;However, we cannot statically enforce a regular gas consumption of &lt;code&gt;TX_MAX_GAS_LIMIT&lt;&#x2F;code&gt;, while still allowing a higher state gas consumption, because transactions only have a single gas limit parameter, &lt;code&gt;tx.gas&lt;&#x2F;code&gt;. This is solved through a &lt;strong&gt;reservoir model&lt;&#x2F;strong&gt;: at transaction start, execution gas is split into &lt;code&gt;gas_left&lt;&#x2F;code&gt; (capped at &lt;code&gt;TX_MAX_GAS_LIMIT - intrinsic_regular_gas&lt;&#x2F;code&gt;) and a &lt;code&gt;state_gas_reservoir&lt;&#x2F;code&gt; (the overflow). State gas charges draw from the reservoir first, then from &lt;code&gt;gas_left&lt;&#x2F;code&gt; when the reservoir is empty. Regular gas charges draw from &lt;code&gt;gas_left&lt;&#x2F;code&gt; only. Exceeding the regular gas budget behaves identically to running out of gas — no special error is needed.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;higher-throughput&quot;&gt;Higher throughput&lt;&#x2F;h4&gt;
&lt;p&gt;Another advantage of metering contract creation separately is that increasing the cost of state creation operation in line with the block limit will not affect the available gas for other operations. This allows for higher throughput, as explained in the original multidimensional gas metering introduced in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8011&#x2F;&quot;&gt;EIP-8011&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This is a backwards-incompatible gas repricing that requires a scheduled network upgrade.&lt;&#x2F;p&gt;
&lt;p&gt;Wallet developers and node operators MUST update gas estimation handling to accommodate the new calldata cost rules. Specifically:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Wallets: Wallets using &lt;code&gt;eth_estimateGas&lt;&#x2F;code&gt; MUST be updated to ensure that they correctly account for the updated gas parameters. Failure to do so could result in underestimating gas, leading to failed transactions.&lt;&#x2F;li&gt;
&lt;li&gt;Node Software: RPC methods such as &lt;code&gt;eth_estimateGas&lt;&#x2F;code&gt; MUST incorporate the updated formula for gas calculation with the new floor cost values.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Users can maintain their usual workflows without modification, as wallet and RPC updates will handle these changes.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;estimated-price-impacts-at-various-block-gas-limits&quot;&gt;Estimated price impacts at various block gas limits&lt;&#x2F;h3&gt;
&lt;p&gt;Users and dApp developers will experience an increase in transaction costs associated with creating a new state. The next table summarizes the state creation costs for common operations at different block gas limits.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&quot;text-align: center&quot;&gt;Case&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;cost_per_state_byte&lt;&#x2F;th&gt;&lt;th&gt;Cost of a new account&lt;&#x2F;th&gt;&lt;th&gt;Cost increase&lt;&#x2F;th&gt;&lt;th&gt;Cost of a new slot&lt;&#x2F;th&gt;&lt;th&gt;Cost increase&lt;&#x2F;th&gt;&lt;th&gt;24kB contract deployment&lt;&#x2F;th&gt;&lt;th&gt;Cost increase&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;Current cost&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;NA&lt;&#x2F;td&gt;&lt;td&gt;25,000&lt;&#x2F;td&gt;&lt;td&gt;NA&lt;&#x2F;td&gt;&lt;td&gt;20,000&lt;&#x2F;td&gt;&lt;td&gt;NA&lt;&#x2F;td&gt;&lt;td&gt;4,947,200&lt;&#x2F;td&gt;&lt;td&gt;NA&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;Proposed cost at 60M block limit&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;662&lt;&#x2F;td&gt;&lt;td&gt;74,144&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;24,084&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;16,357,064&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;Proposed cost at 100M block limit&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;1,174&lt;&#x2F;td&gt;&lt;td&gt;131,488&lt;&#x2F;td&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;td&gt;40,468&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;28,997,320&lt;&#x2F;td&gt;&lt;td&gt;6&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;Proposed cost at 200M block limit&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;2,198&lt;&#x2F;td&gt;&lt;td&gt;246,176&lt;&#x2F;td&gt;&lt;td&gt;10&lt;&#x2F;td&gt;&lt;td&gt;73,236&lt;&#x2F;td&gt;&lt;td&gt;4&lt;&#x2F;td&gt;&lt;td&gt;54,277,832&lt;&#x2F;td&gt;&lt;td&gt;11&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;Proposed cost at 300M block limit&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;3,222&lt;&#x2F;td&gt;&lt;td&gt;360,864&lt;&#x2F;td&gt;&lt;td&gt;14&lt;&#x2F;td&gt;&lt;td&gt;106,004&lt;&#x2F;td&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;td&gt;79,558,344&lt;&#x2F;td&gt;&lt;td&gt;16&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;We should note that as the block limit increases, the base fee is expected to reduce due to the higher capacity of the network. This reduction in base fee will offset, in part, the costs from state creation operations. Some analysis is needed to quantify this effect.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Increasing the cost of state creation operations could impact the usability of certain applications. More analysis is needed to understand the potential effects on various dApps and user behaviors.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;mispricing-with-respect-to-eth-transfers&quot;&gt;Mispricing with respect to ETH transfers&lt;&#x2F;h3&gt;
&lt;p&gt;One potential concern is the cost of creating a new account (&lt;code&gt;112 × cost_per_state_byte&lt;&#x2F;code&gt; gas units, e.g., 131,488 at a 100M gas limit), compared to transferring ETH to a fresh account (21,000 gas units). With this mismatch, users wishing to create new account are incentivized to first send a normal transaction (costing 21k) to this account to create it, thus avoiding the &lt;code&gt;GAS_NEW_ACCOUNT&lt;&#x2F;code&gt; charge.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2780&#x2F;&quot;&gt;EIP-2780&lt;&#x2F;a&gt; solves this mispricing by adding a new component to the intrinsic gas cost of transactions. If a non-create transaction has value &amp;gt; 0 and targets a non-existent account, the &lt;code&gt;GAS_NEW_ACCOUNT&lt;&#x2F;code&gt; is added to intrinsic cost.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;added-complexity-in-block-building&quot;&gt;Added complexity in block building&lt;&#x2F;h3&gt;
&lt;p&gt;Optimal block construction becomes more complex, since builders must now balance resource usage across multiple dimensions rather than a single gas metric. Sophisticated builders may gain an advantage by applying advanced optimization techniques, raising concerns about further builder centralization. However, practical heuristics (e.g., greedily filling blocks until one resource dimension saturates) remain effective for most use cases. These heuristics limit centralization pressure by keeping block construction feasible for local and less sophisticated builders.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;testing-requirements-for-increasing-block-limits&quot;&gt;Testing requirements for increasing block limits&lt;&#x2F;h3&gt;
&lt;p&gt;With a dynamic cost per byte, every time the block gas limit is increased, clients and testing frameworks need to test for backward compatibility issues. This changes the testing framework for increasing the block limit. A way to mitigate this is to introduce a max cost per byte and do the analysis once on the impact of this max cost.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Size-Based Storage Gas Pricing</title>
        <published>2025-09-29T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Guillaume Ballet</name><uri>https://github.com/gballet</uri>
	</author>
	
	<author>
		<name>Carlos Perez</name><uri>https://github.com/CPerezz</uri>
	</author>
	
	<author>
		<name>Matan Prasma</name><uri>https://github.com/KanExtension</uri>
	</author>
	
	<author>
		<name>Wei Han Ng</name><uri>https://github.com/weiihann</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8032/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/the-case-for-eip-8032-in-glamsterdam-tree-depth-based-storage-gas-pricing/25619" />
        

        <id>https://wg-eips.ritovision.com/8032/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:8032"
            label="EIP-8032" />
        

        
        

        
        <summary type="html">Makes `SSTORE` gas cost scale with a contract&#x27;s storage size to discourage state bloat.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8032/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a mechanism to dynamically price SSTORE operations based on the storage size of a contract. A new optional &lt;code&gt;storage_count&lt;&#x2F;code&gt; field is added to the account RLP, which tracks the number of storage slots it owns. The gas cost for SSTORE will be augmented by a factor that grows exponentially with this &lt;code&gt;storage_count&lt;&#x2F;code&gt; field, but only after it crosses a predefined activation threshold. This change aims to align the cost of state growth with the long-term burden it places on the network, thereby disincentivizing state bloat.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Ethereum&#x27;s state size is a growing concern, as it directly impacts node synchronization times, hardware requirements, and overall network health. The current gas model for storage operations does not fully account for the long-term cost of maintaining state indefinitely. As a result, it remains economically viable to deploy contracts with large storage footprints (“state bloat”), which can be exploited for low-cost data anchoring or spam. This imposes a negative externality on all network participants, who must store and process this data indefinitely.&lt;&#x2F;p&gt;
&lt;p&gt;In practice, the computational and I&#x2F;O costs of creating and updating storage slots scale with the number of storage slots a contract owns. However, the current gas pricing model does not meaningfully increase with storage size. This discrepancy underprices workloads for contracts with very large state and slows down state root computation.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal aims to address the state growth problem by creating a direct economic link between the size of a contract&#x27;s storage and the cost to expand it further. By progressively increasing the price of SSTORE operations in proportion to how much storage a contract already owns, storage write costs become more aligned with the actual work clients perform. Contracts that contribute disproportionately to state growth will face rising costs for additional writes, while small and medium-sized contracts remain unaffected. This mechanism creates a market-based incentive for developers to use onchain storage efficiently, helping mitigate unsustainable state growth over time.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc2119&quot;&gt;RFC 2119&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc8174&quot;&gt;RFC 8174&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;constants-and-parameters&quot;&gt;Constants and parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FORK_TIMESTAMP&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td&gt;Fork activation timestamp&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;LIN_FACTOR&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td&gt;Linear gas cost factor&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ACTIVATION_THRESHOLD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td&gt;Activation threshold, chosen to be at ~8GB of data.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TRANSITION_REGISTRY_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td&gt;The address of system contract that holds the information of account transition&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TRANSITION_SLOTS_PER_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td&gt;The number of storage slots to iterate per block during the transition process&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TRANSITION_MAX_ACCOUNTS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td&gt;The number of accounts to iterate per block during the transition process&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;&amp;lt;-- TODO --&amp;gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;new-account-field&quot;&gt;New account field&lt;&#x2F;h3&gt;
&lt;p&gt;Account RLP descriptors receive an optional &lt;code&gt;storage_count&lt;&#x2F;code&gt; field, corresponding to the current number of storage slots it contains.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;account-transition&quot;&gt;Account transition&lt;&#x2F;h3&gt;
&lt;p&gt;At &lt;code&gt;FORK_TIMESTAMP&lt;&#x2F;code&gt;, the transition is activated.&lt;&#x2F;p&gt;
&lt;p&gt;The transition process involves reading all accounts and count the number of storage slots for accounts with non-empty storage root hashes, which in turn populates the &lt;code&gt;storage_count&lt;&#x2F;code&gt; field in the account.&lt;&#x2F;p&gt;
&lt;p&gt;The progress of the transition is stored at system contract at &lt;code&gt;TRANSITION_REGISTRY_ADDRESS&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Storage layout at &lt;code&gt;TRANSITION_REGISTRY_ADDRESS&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;slot &lt;code&gt;0x00&lt;&#x2F;code&gt;: &lt;code&gt;cursor_account_hash&lt;&#x2F;code&gt; (32-byte account hash)&lt;&#x2F;li&gt;
&lt;li&gt;slot &lt;code&gt;0x01&lt;&#x2F;code&gt;: &lt;code&gt;cursor_slot_hash&lt;&#x2F;code&gt; (32-byte slot hash)&lt;&#x2F;li&gt;
&lt;li&gt;slot &lt;code&gt;0x02&lt;&#x2F;code&gt;: &lt;code&gt;cursor_accum&lt;&#x2F;code&gt; (uint256 count of non-zero slots seen for the current account)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;At the &lt;strong&gt;end&lt;&#x2F;strong&gt; of each block, the client performs up to &lt;code&gt;TRANSITION_SLOTS_PER_BLOCK&lt;&#x2F;code&gt; storage slot iterations, possibly spanning one account or multiple accounts:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Select account&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
If &lt;code&gt;cursor_account_hash == 0x00…00&lt;&#x2F;code&gt;, set it to the smallest account hash that is present in the state trie. Otherwise, continue with &lt;code&gt;cursor_account_hash&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Iterate storage slots&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
If the current account at &lt;code&gt;cursor_account_hash&lt;&#x2F;code&gt; has a non-empty &lt;code&gt;storageRootHash&lt;&#x2F;code&gt;, visit storage slots of this account in ascending lexicographic order of &lt;code&gt;slot hash&lt;&#x2F;code&gt;, starting &lt;strong&gt;strictly after&lt;&#x2F;strong&gt; &lt;code&gt;cursor_slot_hash&lt;&#x2F;code&gt; (or from the beginning if &lt;code&gt;cursor_slot_hash == 0x00…00&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Increment &lt;code&gt;cursor_accum&lt;&#x2F;code&gt; slot for every slot hash seen&lt;&#x2F;li&gt;
&lt;li&gt;Stop when either:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;TRANSITION_SLOTS_PER_BLOCK&lt;&#x2F;code&gt; slots have been processed, or&lt;&#x2F;li&gt;
&lt;li&gt;there are no more storage slots for the account.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Finalize account (if exhausted)&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
If all storage slots for &lt;code&gt;cursor_account_hash&lt;&#x2F;code&gt; have been visited, set &lt;code&gt;storage_count(cursor_account)&lt;&#x2F;code&gt; to &lt;code&gt;cursor_accum&lt;&#x2F;code&gt; in the account object.&lt;&#x2F;p&gt;
&lt;p&gt;If &lt;code&gt;TRANSITION_MAX_ACCOUNTS&lt;&#x2F;code&gt; accounts are iterated, then stop iterating.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Else:
&lt;ul&gt;
&lt;li&gt;Advance to the next account:&lt;br &#x2F;&gt;
&lt;code&gt;cursor_account_hash&lt;&#x2F;code&gt; = next account hash that is present in the state trie&lt;&#x2F;li&gt;
&lt;li&gt;Reset per-account cursors:&lt;br &#x2F;&gt;
&lt;code&gt;cursor_slot_hash = 0x00…00&lt;&#x2F;code&gt;, &lt;code&gt;cursor_accum = 0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Persist&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
If either &lt;code&gt;TRANSITION_SLOTS_PER_BLOCK&lt;&#x2F;code&gt; or &lt;code&gt;TRANSITION_MAX_ACCOUNTS&lt;&#x2F;code&gt; is reached, write &lt;code&gt;cursor_account_hash&lt;&#x2F;code&gt;, &lt;code&gt;cursor_slot_hash&lt;&#x2F;code&gt;, and &lt;code&gt;cursor_accum&lt;&#x2F;code&gt; to the registry in the post-state of the block.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Completion&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
The transition is complete when there is no further account present in the trie, with an account hash that is lexicographically greater than the current &lt;code&gt;cursor_account_hash&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The account hashes and slot hashes are iterated in ascending lexicographical order.&lt;&#x2F;p&gt;
&lt;p&gt;Transition reference: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7612&#x2F;&quot;&gt;EIP-7612&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;reorg-semantics&quot;&gt;Reorg semantics&lt;&#x2F;h4&gt;
&lt;p&gt;Chain reorganizations require &lt;strong&gt;no special handling&lt;&#x2F;strong&gt; beyond normal block re-execution. The mechanism is reorg-safe.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;storage_count&lt;&#x2F;code&gt; updates and the transition cursors (&lt;code&gt;cursor_account_hash&lt;&#x2F;code&gt;, &lt;code&gt;cursor_slot_hash&lt;&#x2F;code&gt;, &lt;code&gt;cursor_accum&lt;&#x2F;code&gt;) are ordinary state writes committed in the post-state of each block at &lt;code&gt;TRANSITION_REGISTRY_ADDRESS&lt;&#x2F;code&gt;. On a reorg, these values revert to those of the new canonical ancestor and are re-derived by re-executing blocks.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;account-update-rules&quot;&gt;Account update rules&lt;&#x2F;h3&gt;
&lt;p&gt;After executing all transactions in a block, clients MUST update &lt;code&gt;storage_count&lt;&#x2F;code&gt; for affected accounts as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Let &lt;code&gt;old := storage_count(A)&lt;&#x2F;code&gt; in the block-prestate (treat as &lt;code&gt;0&lt;&#x2F;code&gt; if absent).&lt;&#x2F;li&gt;
&lt;li&gt;Let &lt;code&gt;new&lt;&#x2F;code&gt; be the true count of non-zero slots for &lt;code&gt;A&lt;&#x2F;code&gt; in the post-block state.&lt;&#x2F;li&gt;
&lt;li&gt;Set &lt;code&gt;storage_count(A) := new&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;To compute &lt;code&gt;new&lt;&#x2F;code&gt; efficiently without scanning all storage every block, clients MUST apply net deltas derived from slots whose values changed relative to the block-prestate:&lt;&#x2F;p&gt;
&lt;p&gt;For each storage slot &lt;code&gt;k&lt;&#x2F;code&gt; of account &lt;code&gt;A&lt;&#x2F;code&gt; that was written at least once in the block:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calculate_storage_delta&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;prestate_value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; poststate_value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Calculate the storage slot delta based on pre-state and post-state values.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Args:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        prestate_value: Pre-state value of the storage slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        poststate_value: Post-state value of the storage slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Returns:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        int: Delta value (+1, -1, or 0)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; prestate_value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span&gt; poststate_value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Slot created: empty to non-empty&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    elif&lt;&#x2F;span&gt;&lt;span&gt; prestate_value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span&gt; poststate_value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;   #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Slot deleted: non-empty to empty&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; No change in slot occupancy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;During a transition, the transition is advanced &lt;em&gt;first&lt;&#x2F;em&gt; before applying the storage deltas, but &lt;em&gt;after&lt;&#x2F;em&gt; executing all transactions, so the gas costs of a contract that is sweeped by the iterator in this block are only applied for the &lt;em&gt;next&lt;&#x2F;em&gt; block. Update semantics when a transition is occurring:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;For accounts that have been iterated (i.e. &lt;code&gt;cursor_account_hash&lt;&#x2F;code&gt; &amp;gt; &lt;code&gt;acc_hash&lt;&#x2F;code&gt; ), all storage deltas are applied.&lt;&#x2F;li&gt;
&lt;li&gt;For accounts that have not been iterated at all (i.e. &lt;code&gt;acc_hash&lt;&#x2F;code&gt; &amp;gt; &lt;code&gt;cursor_account_hash&lt;&#x2F;code&gt;), none of the storage deltas are applied.&lt;&#x2F;li&gt;
&lt;li&gt;For the account currently being iterated (i.e. &lt;code&gt;cursor_account_hash&lt;&#x2F;code&gt; == &lt;code&gt;acc_hash&lt;&#x2F;code&gt;), storage deltas are applied only to the slots that have already been accounted for (i.e. &lt;code&gt;cursor_slot_hash&lt;&#x2F;code&gt; &amp;gt; &lt;code&gt;slot_hash&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;sstore-gas-cost-changes&quot;&gt;SSTORE gas cost changes&lt;&#x2F;h3&gt;
&lt;p&gt;For each contract account &lt;code&gt;A&lt;&#x2F;code&gt;, define &lt;code&gt;S_pre(A)&lt;&#x2F;code&gt; as the value of &lt;code&gt;storage_count(A)&lt;&#x2F;code&gt; in the parent state of the block being executed (pre-state).&lt;&#x2F;p&gt;
&lt;p&gt;For all &lt;code&gt;SSTORE&lt;&#x2F;code&gt;s in the block, implementations MUST use &lt;code&gt;S_pre(A)&lt;&#x2F;code&gt; when computing the gas cost for &lt;code&gt;SSTORE&lt;&#x2F;code&gt;. This value MUST NOT change within the block, regardless of any writes to &lt;code&gt;A&lt;&#x2F;code&gt; during the block.&lt;&#x2F;p&gt;
&lt;p&gt;If &lt;code&gt;storage_count(A)&lt;&#x2F;code&gt; is absent at block start, clients MUST treat &lt;code&gt;S_pre(A) = 0&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Rationale: holding &lt;code&gt;S_pre(A)&lt;&#x2F;code&gt; constant within the block keeps gas estimation stable and independent of transaction ordering.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;The gas cost of an &lt;code&gt;SSTORE&lt;&#x2F;code&gt; is computed as such:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;constant_sstore_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; slot&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; LIN_FACTOR&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; ceil_log16&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;S_pre&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ACTIVATION_THRESHOLD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;impact-on-state-size&quot;&gt;Impact on state size&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;storage_count&lt;&#x2F;code&gt; is RLP-encoded as a minimal-length big-endian byte string (no leading zeros). The per-account overhead is therefore small and not a fixed 32 byte number. The field is present only for accounts with a non-empty storage root hash. If &lt;code&gt;storage_count == 0&lt;&#x2F;code&gt;, the field may be omitted.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Per-account overhead&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Payload length &lt;code&gt;L = bytes_required(storage_count)&lt;&#x2F;code&gt;:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;L = 0&lt;&#x2F;code&gt; for &lt;code&gt;0&lt;&#x2F;code&gt; (field may be omitted entirely)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;L = 1&lt;&#x2F;code&gt; for &lt;code&gt;1 … 255&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;L = 2&lt;&#x2F;code&gt; for &lt;code&gt;256 … 65,535&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;L = 3&lt;&#x2F;code&gt; for &lt;code&gt;65,536 … 16,777,215&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;L = 4&lt;&#x2F;code&gt; for &lt;code&gt;16,777,216 … 4,294,967,295&lt;&#x2F;code&gt; (≈ 4.29B)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;+1 byte&lt;&#x2F;strong&gt; RLP string prefix (since &lt;code&gt;L ≤ 55&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;+ up to 1 byte&lt;&#x2F;strong&gt; for the account-list prefix growth (only if the list’s total payload crosses a size boundary)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;For context, at block ~23,000,000 the largest contract has about &lt;strong&gt;80M&lt;&#x2F;strong&gt; storage slots. Even at that scale (&lt;code&gt;L = 4&lt;&#x2F;code&gt;), the per-account addition remains &lt;strong&gt;≤ 6 bytes&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;If we pessimistically assume &lt;strong&gt;23,000,000&lt;&#x2F;strong&gt; contract accounts each carry &lt;code&gt;storage_count&lt;&#x2F;code&gt; and each incurs the worst-case &lt;strong&gt;6 bytes&lt;&#x2F;strong&gt;, the upper bound is:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;23,000,000 × 6 = 138,000,000&lt;&#x2F;code&gt; bytes ≈ &lt;strong&gt;138 MB&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This is a conservative upper bound. In practice, most contracts have far fewer slots (&lt;code&gt;L ≤ 1–3&lt;&#x2F;code&gt;), so a typical addition is 2–4 bytes per contract. Therefore, the net impact on state size is negligible.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The intent is to create friction when growing the state size of a contract, thus limiting the number of such contracts. Going over the limit, some contract developers might want to use another contract to start fresh, which comes at the cost of paying for contract creation, and for any call into the previous instance of the contract.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;ACTIVATION_THRESHOLD&lt;&#x2F;code&gt; is chosen to not penalize the contracts that are large, but do provide useful value. The idea is to disincentivize spam contracts that grow larger than useful contracts, the latter being legitimately big due to the value they bring to their users and the wider ecosystem. This means that this constant could be increased as the state grows.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;TRANSITION_MAX_ACCOUNTS&lt;&#x2F;code&gt; bounds how many accounts may be finalized (i.e. have their &lt;code&gt;storage_count&lt;&#x2F;code&gt; written) per block during the transition. This prevents excessive write operations per block, reducing write amplification and avoiding large database compactions and associated performance degradation. It complements &lt;code&gt;TRANSITION_SLOTS_PER_BLOCK&lt;&#x2F;code&gt;, which limits how many &lt;strong&gt;storage slots&lt;&#x2F;strong&gt; are scanned per block in line with the minimal hardware recommendations. In short, &lt;code&gt;TRANSITION_SLOTS_PER_BLOCK&lt;&#x2F;code&gt; bounds read operations, while &lt;code&gt;TRANSITION_MAX_ACCOUNTS&lt;&#x2F;code&gt; bounds write operations.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;comparison-with-depth-based-pricing&quot;&gt;Comparison with depth-based pricing&lt;&#x2F;h3&gt;
&lt;p&gt;The largest contract observed (XEN) sits around depth 9, meaning its relevant storage keys share a 9-nibble (~4.5 bytes) prefix along their MPT paths. Because the storage key into the trie is &lt;code&gt;keccak256(slot_key)&lt;&#x2F;code&gt;, an attacker can easily calculate the inputs offchain to find hashes and populate all contracts such that they pay the same cost as XEN.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-is-a-transition-needed&quot;&gt;Why is a transition needed?&lt;&#x2F;h3&gt;
&lt;p&gt;If counting began only at &lt;code&gt;FORK_TIMESTAMP&lt;&#x2F;code&gt;, every existing contract would start with an implicit &lt;code&gt;storage_count = 0&lt;&#x2F;code&gt; and accrue counts only from &lt;em&gt;new&lt;&#x2F;em&gt; writes. While spammy contracts would quickly accumulate writes and thus incur penalties, this would still misprice the workloads we intend to regulate: large pre-fork contracts would continue paying unscaled base costs until they rewrote a substantial portion of their historical slots. During that period, gas pricing would understate their actual storage footprint.&lt;&#x2F;p&gt;
&lt;p&gt;A deterministic, in-protocol transition avoids this. By iterating existing storage under consensus rules and progressively populating each account’s &lt;code&gt;storage_count&lt;&#x2F;code&gt; in the state, we ensure that storage-size-based pricing reflects reality for &lt;em&gt;all&lt;&#x2F;em&gt; contracts—regardless of whether they write again after the fork. Persisting cursor progress under the state root also makes the process reorg-safe and client-agnostic.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Alternative (pre-fork background counting by clients)&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Idea:&lt;&#x2F;strong&gt; Clients begin counting slots before &lt;code&gt;FORK_TIMESTAMP&lt;&#x2F;code&gt;. At activation, they only need to write the final counts into the state for a fixed number of accounts.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Pros:&lt;&#x2F;strong&gt; Reduces post-fork iteration work, much faster convergence at fork time since iterating all accounts is faster than all storage slots.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Cons:&lt;&#x2F;strong&gt; Late upgraders, snap-syncing nodes, or nodes that were offline cannot reconstruct pre-fork counts deterministically. This approach has to be coordinated so that all users upgrade their nodes and must finish counting prior to the fork activation. Reorgs have to be handled explicitly too.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;compatibility-with-verkle-binary-unified-tree&quot;&gt;Compatibility with Verkle&#x2F;Binary unified tree&lt;&#x2F;h3&gt;
&lt;p&gt;In the current two-layer MPT, a write to contract storage accesses an account path and then a storage path, and the cost a client pays in trie updates and database reads&#x2F;writes correlates with how deep the storage trie becomes over time.&lt;&#x2F;p&gt;
&lt;p&gt;Under a unified tree, the per-write computational and I&#x2F;O cost of &lt;code&gt;SSTORE&lt;&#x2F;code&gt; no longer tracks an account’s total number of storage slots. The path length is set by the global tree’s branching factor and height, and by the overall distribution of state keys, not by a single account’s footprint. As a result, progressive pricing based on an account’s slot count can become misaligned with the actual work once a unified tree ships.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;compatibility-with-eip-2926&quot;&gt;Compatibility with EIP-2926&lt;&#x2F;h3&gt;
&lt;p&gt;Because &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2926&#x2F;&quot;&gt;EIP-2926&lt;&#x2F;a&gt; also requires an account transition to chunkify the bytecode and additional fields, scheduling both EIPs in the same fork enables a single, combined transition. This removes duplicated work, reduces client complexity and the number of tree transitions in the future.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found. Making the &lt;code&gt;storage_count&lt;&#x2F;code&gt; field optional ensures that the default count is 0, which means that contract will not be affected by the gas increase before they have been reached by the iterator sweep.&lt;&#x2F;p&gt;
&lt;p&gt;This is a backwards incompatible gas repricing that requires a scheduled network upgrade.&lt;&#x2F;p&gt;
&lt;p&gt;Node operators MUST update gas estimation handling to accommodate the new calldata cost rules. Specifically, RPC methods such as &lt;code&gt;eth_estimateGas&lt;&#x2F;code&gt; MUST incorporate the updated formula for gas calculation when encountering an &lt;code&gt;SSTORE&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Users and wallets can maintain their usual workflows without modification, as RPC updates will handle these changes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TODO&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TODO&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Agent Council Oracles</title>
        <published>2025-09-28T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Rohan Parikh</name><uri>https://github.com/phiraml</uri>
	</author>
	
	<author>
		<name>Jon Michael Ross</name><uri>https://github.com/jonmross</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8033/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-8033-agent-council-oracles/25638" />
        

        <id>https://wg-eips.ritovision.com/8033/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:8033"
            label="ERC-8033" />
        

        
        

        
        <summary type="html">Multi-agent councils to resolve decentralized information queries</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8033/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC defines a standard interface for oracle contracts that use multi-agent councils to resolve arbitrary information queries. It enables dApps to request resolutions, general information arbitration, and build consensus and validation in a trust-minimized way, with agents submitting answers to the queries on-chain. The ERC works by a requester opening a query to be resolved. The contract then emits the RequestCreated event with parameters specifying the query, number of infoAgents, commit deadline, and reward&#x2F;bond amounts, specifications, and capabilities required. A commit phase is initiated where InfoAgents can participate by staking the required bond and submitting a hash of the answer to the query as a commit. After the quorum of infoAgents have committed, the reveal process is initiated where infoAgents post the key to the commit hash. A judgeAgent is then selected to review the committed hash and answers provided by the infoAgents. The judgeAgent then selects the infoAgents which answered the query correctly and the reward is divided among the winners. The infoAgents which answered incorrectly lose their bond. The interface supports permissionless participation, bond-based incentives, and optional extensions for reputation, disputes, and callbacks, making it suitable for applications like semantic data oracles and prediction markets.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;With AI agents advancing rapidly, we can build trust-minimized oracles that are cheaper, faster, and more scalable than traditional human or node-based systems. Traditional data oracles primarily provide quantitative feeds and are often centralized or expensive for arbitrary, one-off queries. With AI agents becoming reliable for factual resolutions from public sources, this EIP standardizes an interface for agent councils to handle query resolution via commit-reveal-judging flows, fostering interoperability across implementations. It is generalizable for discrete (defined options) or open-ended queries, with hooks for collusion deterrence and verification. Integration with reputation systems (such as that in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8004&#x2F;&quot;&gt;ERC-8004&lt;&#x2F;a&gt;) is recommended but optional to keep the core lightweight.&lt;&#x2F;p&gt;
&lt;p&gt;This is generalizable for any resolvable information, making it useful for both qualitative and quantitative data. Existing examples we see this standard being useful for are, tracing information tasks (off-chain data processing with on-chain validation hooks), resolving prediction markets, and creating verified info feeds for DeFi platforms (aggregating real-time semantic data from multiple sources).&lt;&#x2F;p&gt;
&lt;p&gt;We envision an information market evolving where agents compete to answer queries, exchanging data resolutions for tokenized incentives.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “NOT RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP proposes the &lt;code&gt;IAgentCouncilOracle&lt;&#x2F;code&gt; interface, which defines methods and events for a council-based resolution flow. Implementations MUST support the core flow: request creation, agent commitment, reveal, judging&#x2F;aggregation, and reward distribution. An OPTIONAL dispute resolution extension is also included. Off-chain processing (LLM inference and analysis) is handled by agents, with on-chain elements opened to coordination and verification of information.&lt;&#x2F;p&gt;
&lt;p&gt;The council consists of two agent roles: Info Agents (who submit individual information) and Judge Agents (who aggregate and resolve consensus). We make this distinction to clarify how responsibilities from this standard are assigned.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;main-types&quot;&gt;Main Types&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Struct for query requests&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AgentCapabilities&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; capabilities&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; text, vision, audio etc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; domains&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Expertise areas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Request&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; requester&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; rewardAmount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Total reward (native token or ERC-20)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; rewardToken&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; native or ERC-20 token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; bondAmount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Bond per agent (native token or ERC-20)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; bondToken&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; native or ERC-20 token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; numInfoAgents&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Target number of info agents&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; deadline&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Unix timestamp for commit phase end&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt; query&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The information query&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt; specifications&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Additional miscellaneous instructions (optional in implementations)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        AgentCapabilities requiredCapabilities&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; For filtering agents (optional in implementations)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;interface&quot;&gt;Interface&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IAgentCouncilOracle&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Events for transparency and monitoring&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RequestCreated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; requestId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; requester&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; query&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; rewardAmount&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; numInfoAgents&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bondAmount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AgentCommitted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; requestId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; agent&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; commitment&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AgentRevealed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; requestId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; agent&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; answer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Or bytes for flexibility&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; JudgeSelected&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; requestId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; judge&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ResolutionFinalized&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; requestId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; finalAnswer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Or bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RewardsDistributed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; requestId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; winners&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amounts&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ResolutionFailed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; requestId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; reason&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DisputeInitiated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; requestId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; disputer&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; reason&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DisputeWindowOpened&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; requestId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; endTimestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DisputeResolved&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; requestId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; overturned&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; finalAnswer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Core methods&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; createRequest&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; query&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; numInfoAgents&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; rewardAmount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bondAmount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; deadline&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; rewardToken&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bondToken&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; specifications&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; AgentCapabilities&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; requiredCapabilities&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; requestId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Commit: Permissionless, with bond&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; commit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; requestId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; commitment&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Reveal: Submit answer matching commitment&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; reveal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; requestId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; answer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Judge&#x2F;Aggregate: Called by selected judge or automatic for discrete option queries&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; aggregate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; requestId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; finalAnswer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; winners&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; reasoning&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Winners for reward classification&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Distribute: Auto or manual post-aggregation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; distributeRewards&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; requestId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get final resolution&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getResolution&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; requestId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; finalAnswer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; finalized&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Optional Dispute Methods&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; initiateDispute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; requestId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; reason&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; resolveDispute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; requestId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; overturn&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newAnswer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newWinners&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Getters for oracle flow data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getRequest&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; requestId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Request&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getCommits&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; requestId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; agents&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; commitments&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getReveals&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; requestId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; agents&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; answers&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;We do not enforce limits on the number or size of items in capabilities, domains, queries, or answers to maintain flexibility for evolving agent ecosystems and models. However, it is RECOMMENDED implementations impose reasonable limits on metrics such as the number of items (ex. max 64), bytes per item (ex. max 64), and&#x2F;or total encoded bytes (ex. max 8192) to mitigate gas costs and DoS risks. Implementations MUST document any such limits in their code or README and MUST revert with descriptive errors (ex. CapListTooLong) if exceeded. For high-gas environments, implementations SHOULD use off-chain references (such as an IPFS hash on-chain or some external domain) for verbosity, storing only these references in the struct.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;core-flow&quot;&gt;Core Flow&lt;&#x2F;h3&gt;
&lt;p&gt;Implementations MUST follow this sequence for interoperability:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Request Creation&lt;&#x2F;strong&gt;: Requester calls &lt;code&gt;createRequest&lt;&#x2F;code&gt;, providing query, params (ex. &lt;code&gt;numInfoAgents&lt;&#x2F;code&gt;, &lt;code&gt;bondAmount&lt;&#x2F;code&gt;), and &lt;code&gt;rewardAmount&lt;&#x2F;code&gt; (with &lt;code&gt;msg.value&lt;&#x2F;code&gt; or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; transfer). If &lt;code&gt;rewardToken == address(0)&lt;&#x2F;code&gt;, this is the native asset and createRequest MUST be payable and expect msg.value to fund the reward (and native bonds if used). If &lt;code&gt;rewardToken != address(0)&lt;&#x2F;code&gt;, it MUST be an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; and implementations SHOULD pull funds via &lt;code&gt;transferFrom&lt;&#x2F;code&gt;. Emits &lt;code&gt;RequestCreated&lt;&#x2F;code&gt;. The bond is a slashable stake an agent put in, and be penalized if the submission turns out to be wrong, malicious etc. The amount and token for the bond (specified with &lt;code&gt;bondAmount&lt;&#x2F;code&gt; and &lt;code&gt;bondToken&lt;&#x2F;code&gt;) is implementation-specific and these MAY be different from the values used for the reward.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Commit Process&lt;&#x2F;strong&gt;: Permissionless Info Agents call &lt;code&gt;commit&lt;&#x2F;code&gt; with a hash (RECOMMENDED: &lt;code&gt;keccak256(abi.encode(answer, nonce))&lt;&#x2F;code&gt;) and bond. Caps at &lt;code&gt;numInfoAgents&lt;&#x2F;code&gt;. Phase ends at deadline or when all InfoAgents are committed. Emits &lt;code&gt;AgentCommitted&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Reveal&#x2F;Collection Process&lt;&#x2F;strong&gt;: Committed Info Agents call &lt;code&gt;reveal&lt;&#x2F;code&gt; to submit answers. MUST match commitment. Emits &lt;code&gt;AgentRevealed&lt;&#x2F;code&gt;. Proceed only if quorum (RECOMMENDED:  &amp;gt;50% reveals) otherwise emit &lt;code&gt;ResolutionFailed&lt;&#x2F;code&gt; and refund. This helps reduce coordination&#x2F;collusion of submissions as they aren’t revealed early.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Judging Process&lt;&#x2F;strong&gt;: After reveals, select a Judge Agent (RECOMMENDED: randomly from a separate pool, distinct from Info Agents) and emit JudgeSelected. The Judge Agent calls aggregate to submit the final answer and classify winners (majority agents). For open-ended and discrete queries, the Judge MUST synthesize revealed submissions (semantic consensus via LLM) and provide reasoning as part of the submission. In ties, the Judge MAY provide a tie-breaker with reasoning. Emits ResolutionFinalized&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Reward Distribution Process&lt;&#x2F;strong&gt;: Call &lt;code&gt;distributeRewards&lt;&#x2F;code&gt; to payout correct Info Agents &#x2F; Judge Agent based on config (proportional or equal splits, with implementation specific params for ratios like Judge fee percentage). Refund bonds to correct Info Agents; forfeit others. Emits &lt;code&gt;RewardsDistributed&lt;&#x2F;code&gt;. Implementations MAY forfeit the Judge Agent’s bond and redistribute to correct Info Agents or proposer if the judge fails to resolve within the allotted window.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Off-chain storage (such as IPFS for reveals&#x2F;reasoning) MAY be used, with on-chain hashes for verifiability.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;optional-extensions&quot;&gt;Optional Extensions&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;Dispute Standard&lt;&#x2F;strong&gt;: Implementations MAY add a dispute mechanism post-finalization.&lt;&#x2F;p&gt;
&lt;p&gt;Suggested flow: After finalization, open a dispute window. Any party MAY call &lt;code&gt;initiateDispute&lt;&#x2F;code&gt; with a &lt;code&gt;disputeBond&lt;&#x2F;code&gt; (ex.  1.5-2x original bond) and on-chain reason (such as  a hash of detailed reasoning, optionally on IPFS), emitting &lt;code&gt;DisputeInitiated&lt;&#x2F;code&gt;. Re-select a Judge (randomly, with higher minReputation threshold). Judge reviews and calls &lt;code&gt;resolveDispute&lt;&#x2F;code&gt; to uphold or overturn, submitting new answers&#x2F;winners if overturned. If upheld, the disputer’s bond is forfeited to the correct agents and arbitration creator. If overturned, return the disputer&#x27;s bond, provide reimbursement (ex. a portion of the base fee), slash the original Judge&#x27;s fee&#x2F;bond, and redistribute. Dispute Judge receives reimbursement (ex. some fixed&#x2F;percentage fee). Emits &lt;code&gt;DisputeResolved&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Configurable params: &lt;code&gt;disputeWindow&lt;&#x2F;code&gt; (duration), &lt;code&gt;disputeBond&lt;&#x2F;code&gt;, &lt;code&gt;minDisputeJudgeReputation&lt;&#x2F;code&gt; (higher than original), &lt;code&gt;disputerReimbursement&lt;&#x2F;code&gt;, &lt;code&gt;judgeReimbursement&lt;&#x2F;code&gt;. MAY integrate &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8004&#x2F;&quot;&gt;ERC-8004&lt;&#x2F;a&gt; for re-runs&#x2F;proofs with validation hooks; partial payouts&#x2F;escrow during window for efficiency.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Reputation Hooks&lt;&#x2F;strong&gt;: MAY integrate with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8004&#x2F;&quot;&gt;ERC-8004&lt;&#x2F;a&gt; for filtering (min reputation for agents or judges) or proportional rewards. RECOMMENDED: Set a minimum reputation for Judge Agents, higher than for Info Agents, as they make a final decision. This creates an identifiable on-chain trail for accountability.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Callbacks&lt;&#x2F;strong&gt;: MAY add &lt;code&gt;callback(address target, uint256 requestId)&lt;&#x2F;code&gt; for notifying requester contracts.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; Rewards&lt;&#x2F;strong&gt;: Extend with token transfers instead of the native token.&lt;&#x2F;p&gt;
&lt;p&gt;Configs (such as phase durations, quorums, reward ratios) are implementation-specific parameters.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This interface standardizes a council flow for AI-driven oracles, balancing minimal on-chain logic with off-chain flexibility. Commit-reveal prevents front-running and judging enables consensus on complex queries. Bonds and optional reputation help deter attacks.&lt;&#x2F;p&gt;
&lt;p&gt;Reputation scores provide a rationale for enhanced security: they enable proportional reward distribution, gating participation to experienced agents, and reducing collusion risks by aligning incentives with proven performance. Without reputation, attack vectors may increase, but the core bond system offers baseline protection and we expect this baseline to allow for a self regulating rewards incentive market that drives agents to act in good faith.&lt;&#x2F;p&gt;
&lt;p&gt;We considered a single-round, plaintext submission model. While simpler and cheaper, it is susceptible to (i) copying attacks where later agents replicate early submissions, (ii) MEV&#x2F;front-running of plaintext answers, and (iii) coercion&#x2F;censorship risks when answers must be revealed before full participation. Plain text answers are easily identified and may be delayed, susceptible to being reordered, or unfavorable answers may be censored compromising the integrity of the Info Agents answers. By contrast, a commit-reveal flow keeps content hidden during the commit phase: adversaries cannot cheaply target specific answers.&lt;&#x2F;p&gt;
&lt;p&gt;Weighted voting (a common alternative in oracles like Universal Market Access) was evaluated as a potential replacement for distinct roles where agents could stake bonds or reputation to vote with proportional influence. This could reduce moving parts but weakens explainability and accountability for open-ended queries. Instead, a Judge allows for semantic interpretation of answers. Our role-based approach mitigates this by random Judge selection and optional reputation thresholds, promoting broader participation while maintaining checks (Judge Agents can tie-break with reasoning). &lt;em&gt;This also aligns better with AI agent ecosystems, where specialized agents mirror real-world councils or juries, fostering an &quot;information market&quot;.&lt;&#x2F;em&gt; A lack of a Judge Agent would limit the ERC to only discrete information and make it unclear how non-discrete data is resolved. We standardize the Info&#x2F;Judge split for the core flow (specialization + reasoning from the Judge), while &lt;strong&gt;leaving weighted aggregation as an OPTIONAL extension&lt;&#x2F;strong&gt; for discrete queries.&lt;&#x2F;p&gt;
&lt;p&gt;Using a single agent reduces complexity but mixes retrieval&#x2F;synthesis with adjudication. We determined that explicit role separation enables (a) different capability&#x2F;reputation thresholds, (b) clearer slashing semantics for adjudication failures, and (c) better human-auditable reasoning trails. We intentionally separate roles for specialization and explainability.&lt;&#x2F;p&gt;
&lt;p&gt;The commit-reveal process is more gas-intensive (requiring two transactions per Info Agent: commit and reveal) but provides increased security through ease of verifiability and reduced attack surfaces like front-running. The increased gas is offset by preventing costly disputes from copied or manipulated answers. Other existing commit-reveal mechanisms were considered but were too constrained for our resolution flow and would have increased complexity. For example, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5732&#x2F;&quot;&gt;ERC-5732&lt;&#x2F;a&gt; does not provide a built-in reveal mechanism. The reveal is a critical step in the agent council flow to ensure quorum and prevent collusion. The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;162&#x2F;&quot;&gt;ERC-162&lt;&#x2F;a&gt; commit and reveal process was also considered but is not easily applicable to text fields and resolution flow here.&lt;&#x2F;p&gt;
&lt;p&gt;Longer form responses written directly to the blockchain may be gas-prohibitive for complex queries so off-chain storage like IPFS for larger reveals&#x2F;reasoning is recommended, with on-chain hashes for integrity. This trades some security (IPFS links are not permanent and could be censored) for cost savings, but implementations can mitigate this via decentralized pinning services or agent domains from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8004&#x2F;&quot;&gt;ERC-8004&lt;&#x2F;a&gt;. Creating different schemes for off-chain verifiability significantly increases complexity. To enhance usability, our core interface keeps methods lightweight, and optional extensions like disputes remain modular, allowing simple implementations for low-stakes queries while scaling to high-security ones.&lt;&#x2F;p&gt;
&lt;p&gt;This ERC is meant to be complimentary to recent standards like &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8004&#x2F;&quot;&gt;ERC-8004&lt;&#x2F;a&gt;, which provides a foundational step toward enabling agent-to-agent communication. Features like Identity, Reputation, and Validation can strengthen the verifiability and fidelity of answers from Info Agents and rulings from Judge Agents. For instance, implementations can filter participants via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8004&#x2F;&quot;&gt;ERC-8004&lt;&#x2F;a&gt;&#x27;s reputation scores (minReputation params for agents). They can also use validation hooks to verify off-chain computations cryptographically, reducing reliance on bonds alone. &lt;strong&gt;The framework for Agent Council Oracles differs significantly. It focuses on a standard mechanism for agents to reach consensus without human input, emphasizing on-chain coordination flows (commit-reveal-judge) for query resolution.&lt;&#x2F;strong&gt; While &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8004&#x2F;&quot;&gt;ERC-8004&lt;&#x2F;a&gt; is geared toward trustless agent interoperability and off-chain logic, our EIP builds atop it by standardizing automated information arbitration. This can apply to specific use cases such as data oracles or prediction markets. The integration with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8004&#x2F;&quot;&gt;ERC-8004&lt;&#x2F;a&gt; is optional to keep the core lightweight, but recommended for high-stakes scenarios. Other differentiators unique to our standard include our bond incentives and dispute windows, which add economic security layers otherwise absent in multi-agent coordination layers.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No conflicts with existing standards.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Collusion: Mitigated by bonds (refundable for honest participation, forfeited for failures), random judge selection, and optional reputation. Bonds disincentivize spam and non-reveals by redistributing to participants.&lt;&#x2F;li&gt;
&lt;li&gt;Spam: Prevented by bonds and caps.&lt;&#x2F;li&gt;
&lt;li&gt;Failures: Refunds for low participation or abandonment.&lt;&#x2F;li&gt;
&lt;li&gt;Disputes: Optional for high-stakes, with higher stakes&#x2F;thresholds.&lt;&#x2F;li&gt;
&lt;li&gt;Fairness of random selection of Judge relies on the crypto strength of randomness
Implementations should audit for reentrancy and use verifiable randomness.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>MEVless Protocol</title>
        <published>2025-09-25T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Lawliet Chan</name><uri>https://github.com/lawliet-chan</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8099/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/mevless-an-anti-mev-protocol/26800" />
        

        <id>https://wg-eips.ritovision.com/8099/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:8099"
            label="EIP-8099" />
        

        
        

        
        <summary type="html">A protocol that prevents MEV attacks by constraining transaction ordering through blind sequencing and two-phase block execution.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8099/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal introduces the MEVless protocol, a novel approach to prevent Maximum Extractable Value (MEV) attacks by implementing blind transaction sequencing. The core principle of MEVless is to prevent validators from seeing transaction content during the ordering phase, thereby eliminating the fundamental prerequisite for MEV attacks. The protocol separates block production into two phases: sequencing blocks that order transactions based on transaction hashes without revealing transaction content, and execution blocks that execute transactions in the predetermined order. This design eliminates the ability of miners and validators to perform MEV attacks such as sandwich attacks and front-running by removing their access to transaction content during the critical ordering phase.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;MEV attacks, particularly sandwich attacks and front-running, represent a significant threat to blockchain ecosystems, especially in DeFi applications. The fundamental prerequisite for MEV attacks is that validators can see transaction content before ordering, which allows them to:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Sandwich Attacks&lt;&#x2F;strong&gt;: Insert buy and sell transactions around user transactions to manipulate prices and extract value&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Front-running&lt;&#x2F;strong&gt;: Execute similar transactions before users to capture arbitrage opportunities&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Back-running&lt;&#x2F;strong&gt;: Execute transactions after users to benefit from price movements&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Unlike legitimate arbitrage activities that provide liquidity, these attacks are purely extractive and harmful to the ecosystem. They reduce user confidence, increase transaction costs, and can lead to significant financial losses for users.&lt;&#x2F;p&gt;
&lt;p&gt;Current solutions have limitations:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Encrypted Mempools&lt;&#x2F;strong&gt;: High computational overhead for encryption&#x2F;decryption&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Private Mempools&lt;&#x2F;strong&gt;: Centralized and not fully decentralized, use trustful instead of trustless.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;PBS (Proposer-Builder Separation)&lt;&#x2F;strong&gt;: Still allows builders to see transaction content and becoming more and more centralized.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The MEVless protocol addresses these issues by fundamentally changing how transactions are ordered, making it impossible for miners to perform MEV attacks while maintaining decentralization and efficiency. By eliminating MEV attacks at the protocol level, DeFi developers can focus on building innovative financial products and user experiences without constantly worrying about MEV protection mechanisms, leading to faster development cycles and more robust applications.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;protocol-overview&quot;&gt;Protocol Overview&lt;&#x2F;h3&gt;
&lt;p&gt;The MEVless protocol operates on a two-phase block system:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Sequencing Blocks&lt;&#x2F;strong&gt;: Order transactions based on transaction hashes and prepayment amounts without revealing transaction content. Sequencing blocks interval can be shorter than execution blocks.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Execution Blocks&lt;&#x2F;strong&gt;: Execute transactions in the predetermined order from sequencing blocks&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;block-types&quot;&gt;Block Types&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;sequencing-blocks&quot;&gt;Sequencing Blocks&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Purpose&lt;&#x2F;strong&gt;: Order transactions and collect prepayments&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Frequency&lt;&#x2F;strong&gt;: Every odd-numbered block height&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Operations&lt;&#x2F;strong&gt;:
&lt;ul&gt;
&lt;li&gt;Receive transaction hashes from users&lt;&#x2F;li&gt;
&lt;li&gt;Collect prepayments (gas fees + optional tips)&lt;&#x2F;li&gt;
&lt;li&gt;Order transactions by prepayment amount (highest first)&lt;&#x2F;li&gt;
&lt;li&gt;Publish ordered transaction sequence as commitment&lt;&#x2F;li&gt;
&lt;li&gt;Store transaction hashes in block&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;execution-blocks&quot;&gt;Execution Blocks&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Purpose&lt;&#x2F;strong&gt;: Execute transactions in predetermined order&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Frequency&lt;&#x2F;strong&gt;: Every even-numbered block height&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Operations&lt;&#x2F;strong&gt;:
&lt;ul&gt;
&lt;li&gt;Receive transaction content from users&lt;&#x2F;li&gt;
&lt;li&gt;Verify transaction content matches committed hashes&lt;&#x2F;li&gt;
&lt;li&gt;Execute transactions in predetermined order&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;transaction-flow&quot;&gt;Transaction Flow&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;phase-1-transaction-submission-and-sequencing&quot;&gt;Phase 1: Transaction Submission and Sequencing&lt;&#x2F;h4&gt;
&lt;ol&gt;
&lt;li&gt;User creates transaction and calculates transaction hash&lt;&#x2F;li&gt;
&lt;li&gt;User sends transaction hash to the network with prepayment:
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Base Gas Fee&lt;&#x2F;strong&gt;: Fixed fee for hash storage and sequencing computation&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Optional Tip&lt;&#x2F;strong&gt;: Additional payment for priority in sequencing&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Network validates user has sufficient balance for prepayment&lt;&#x2F;li&gt;
&lt;li&gt;Network orders transaction hashes by total prepayment amount (descending)&lt;&#x2F;li&gt;
&lt;li&gt;Network deducts prepayment from user account&lt;&#x2F;li&gt;
&lt;li&gt;Network publishes ordered transaction sequence as commitment&lt;&#x2F;li&gt;
&lt;li&gt;Network stores transaction hashes in sequencing block&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8099&#x2F;.&#x2F;assets&#x2F;MEVless.png&quot; alt=&quot;MEVless Protocol Flow&quot; &#x2F;&gt;
&lt;em&gt;MEVless Protocol Transaction Flow&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;phase-2-transaction-content-submission-and-execution&quot;&gt;Phase 2: Transaction Content Submission and Execution&lt;&#x2F;h4&gt;
&lt;ol&gt;
&lt;li&gt;User monitors network for their transaction hash commitment&lt;&#x2F;li&gt;
&lt;li&gt;User submits actual transaction content(including the remaining gasfee) to network&lt;&#x2F;li&gt;
&lt;li&gt;Network receives transaction content during execution block&lt;&#x2F;li&gt;
&lt;li&gt;Network verifies transaction content matches committed hash&lt;&#x2F;li&gt;
&lt;li&gt;Network executes transactions in predetermined order, deduct the remaining fee and 50% of the actual difference between gasUsed and gaslimit for tax ( prevent the gasLimit much more than gasUsed so that validators can entire the whole block to get MEV)&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;gas-economics&quot;&gt;Gas Economics&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;prepayment-structure&quot;&gt;Prepayment Structure&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Total Prepayment = Base Gas Fee + Optional Tip&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Base Gas Fee&lt;&#x2F;strong&gt;: Fixed cost for hash storage and sequencing computation&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Optional Tip&lt;&#x2F;strong&gt;: Variable amount for priority in transaction ordering&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;gas-cost-calculation&quot;&gt;Gas Cost Calculation&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Sequencing Phase&lt;&#x2F;strong&gt;: Minimal gas cost for hash operations&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Execution Phase&lt;&#x2F;strong&gt;: Standard gas cost for transaction execution&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-blind-sequencing&quot;&gt;Why Blind Sequencing?&lt;&#x2F;h3&gt;
&lt;p&gt;Blind sequencing eliminates the root cause of MEV attacks by preventing miners from seeing transaction content during the critical ordering phase. This approach is more efficient than encryption-based solutions and more decentralized than private mempool approaches.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-two-phase-blocks&quot;&gt;Why Two-Phase Blocks?&lt;&#x2F;h3&gt;
&lt;p&gt;Separating sequencing and execution allows for:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Efficient Ordering&lt;&#x2F;strong&gt;: Hash-based ordering is computationally lightweight&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Network Efficiency&lt;&#x2F;strong&gt;: Small hash data reduces bandwidth requirements&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Commitment Mechanism&lt;&#x2F;strong&gt;: Public ordering commitment prevents manipulation&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;why-random-block-production-is-critical&quot;&gt;Why Random Block Production is Critical?&lt;&#x2F;h3&gt;
&lt;p&gt;Random block production is essential to prevent speculative MEV attacks. When block producers cannot predict when they will be selected to produce blocks, they cannot reliably perform speculative MEV attacks because:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Unpredictable Selection&lt;&#x2F;strong&gt;: Attackers cannot know if they will be the next block producer&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Economic Risk&lt;&#x2F;strong&gt;: Speculative transactions require prepayments that are lost if the attacker is not selected&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Decentralization Amplification&lt;&#x2F;strong&gt;: More validators mean lower individual selection probability, increasing attack costs exponentially&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This protocol will add some RPC methods to support the two-phase block system:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;eth_sendTxHash&lt;&#x2F;strong&gt;: Users submit transaction hashes instead of full transactions&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;eth_getTxSequence&lt;&#x2F;strong&gt;: Returns the ordered transaction sequence that is committed&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;basic-transaction-flow&quot;&gt;Basic Transaction Flow&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;User submits transaction hash with prepayment&lt;&#x2F;li&gt;
&lt;li&gt;Network orders transaction by prepayment amount&lt;&#x2F;li&gt;
&lt;li&gt;User submits transaction content&lt;&#x2F;li&gt;
&lt;li&gt;Network executes transaction in predetermined order&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;mev-attack-prevention&quot;&gt;MEV Attack Prevention&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;Attacker submits transaction hash for sandwich attack&lt;&#x2F;li&gt;
&lt;li&gt;Network orders transaction without revealing content&lt;&#x2F;li&gt;
&lt;li&gt;Attacker cannot see victim transaction content during ordering&lt;&#x2F;li&gt;
&lt;li&gt;Attack fails due to lack of transaction visibility&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The MEVless protocol requires a consensus mechanism with unpredictable block production to prevent speculative MEV attacks. Without unpredictable block production, block producers can perform cost-free speculative MEV attacks by submitting transaction hashes and then deciding whether to submit their transaction content based on other users&#x27; transaction content, thus performing cost-free speculative MEV attacks. Since the prepayment ultimately goes to the block producer themselves, predictable block production allows them to recover their prepayment costs through block fees, making MEV attacks economically viable. Random block production forces attackers to pay prepayments for speculative transactions without knowing if they will be selected to produce the next block, making the prepayment cost real rather than recoverable through block fees, thus making such attacks economically unviable. The anti-MEV effectiveness increases exponentially with network decentralization - more validators mean lower individual selection probability, making attacks economically unviable.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>P256 algorithm support</title>
        <published>2025-09-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>James Kempton</name><uri>https://github.com/SirSpudlington</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8030/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/discussion-topic-for-eip-8030/25557" />
        

        <id>https://wg-eips.ritovision.com/8030/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:8030"
            label="EIP-8030" />
        

        
        

        
        <summary type="html">Adds an EIP-7932 algorithm type for P256 support of type `0x0`</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8030/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP adds a new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7932&#x2F;&quot;&gt;EIP-7932&lt;&#x2F;a&gt; algorithm of type &lt;code&gt;0x0&lt;&#x2F;code&gt; for supporting P256 signatures.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;P256 (a.k.a secp256r1) is a widely-used NIST standardized algorithm that already has a presence within the Ethereum codebase. This makes it a great algorithm to write test
cases against implementations of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7932&#x2F;&quot;&gt;EIP-7932&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP defines a new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7932&#x2F;&quot;&gt;EIP-7932&lt;&#x2F;a&gt; algorithmic type with the following parameters:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ALG_TYPE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;Bytes1(0x0)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SIZE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;129&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;N&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;ffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; gas_cost&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;signing_data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Uint64&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This is the precompile cost from [EIP-7951](.&#x2F;07951.md) with 3000 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; subtracted (the cost of the secp256k1 precompile)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    BASE_GAS&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Uint64&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3900&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Calculate extra overhead for keccak256 hashing&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signing_data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BASE_GAS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        minimum_word_size&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signing_data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 31&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BASE_GAS&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; Uint64&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;30&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;6&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; minimum_word_size&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span&gt; Error&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function is a noop as there is no&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; exposed function defined in [EIP-7951](.&#x2F;07951.md)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; signing_data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span&gt; Error&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signing_data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Hash if non-standard size&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        signing_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signing_data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Ignore initial alg_type byte&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (&lt;&#x2F;span&gt;&lt;span&gt;r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; s&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; y&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;64&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;64&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;96&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;96&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;128&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This is similar to [EIP-2](.&#x2F;00002.md)&amp;#39;s malleability verification.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span&gt; N&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This is defined in [P256Verify Function](#p256verify-function)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;P256Verify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signing_data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; s&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; y&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;to_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;big&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; y&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;to_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;big&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;p256verify-function&quot;&gt;&lt;code&gt;P256Verify&lt;&#x2F;code&gt; Function&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;P256Verify&lt;&#x2F;code&gt; function is the logic of the precompile defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7951&#x2F;&quot;&gt;EIP-7951&lt;&#x2F;a&gt;, the only exception is that this function MUST NOT charge any gas.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-p256&quot;&gt;Why P256?&lt;&#x2F;h3&gt;
&lt;p&gt;P256 or secp256r1, is used globally but (more importantly) has an existing implementation in all execution clients. This allows easy implementation of a known-safe algorithm, which is perfect for a test algorithm.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;!-- TODO --&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Optional Execution Proofs</title>
        <published>2025-09-17T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Kevaundray Wedderburn</name><uri>https://github.com/kevaundray</uri>
	</author>
	
	<author>
		<name>Justin Drake</name><uri>https://github.com/JustinDrake</uri><email>justin@ethereum.org</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8025/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-optional-execution-proofs/25500" />
        

        <id>https://wg-eips.ritovision.com/8025/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:8025"
            label="EIP-8025" />
        

        
        

        
        <summary type="html">Introducing optional execution proofs on the consensus layer</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8025/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Optional execution proofs allow beacon nodes to verify the validity of the execution payload within a beacon block without running an execution layer client. The execution proofs are sent over the consensus layer&#x27;s peer-to-peer network.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Optional execution proofs reduce the hardware and bandwidth requirements that are needed for an attester to verify a beacon block. Moreover, the cost to verify to a block no longer grows with the gas limit.&lt;&#x2F;p&gt;
&lt;p&gt;Since these are optional, protocol upgrades cannot be based on the improvements in this EIP. This EIP allows us to safely test execution proofs without making it explicitly consensus critical.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;This is a consensus layer change only.&lt;&#x2F;p&gt;
&lt;p&gt;Validators will now be able to enable two new modes:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;zkEVM Proof generating&lt;&#x2F;li&gt;
&lt;li&gt;Stateless validation&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;When a proof generating node receives a beacon block, they will create the necessary proofs for the execution payload in the block and re-propagate them on the specified subnets.&lt;&#x2F;p&gt;
&lt;p&gt;When a stateless validating node receives a beacon block, they will check to see if they have already received a valid execution proof for that execution payload from the specified subnet.&lt;&#x2F;p&gt;
&lt;p&gt;The detailed specifications are in the consensus-specs repository.&lt;&#x2F;p&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;&amp;lt;-- TODO --&amp;gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This is backwards compatible and does not require a hardfork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;&amp;lt;-- TODO --&amp;gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;&amp;lt;-- TODO --&amp;gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;&amp;lt;-- TODO --&amp;gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Multi-step Contract Ownership</title>
        <published>2025-09-16T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>David Kim</name><uri>https://github.com/PowerStream3604</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8023/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-8023-multi-step-contract-ownership/25475" />
        

        <id>https://wg-eips.ritovision.com/8023/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:8023"
            label="ERC-8023" />
        

        
        

        
        <summary type="html">Contract ownership management with multi-step ownership transfer mechanism for secure smart contract ownership</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8023/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;We define a multi-stepped contract ownership interface for more secure contract ownership management. This makes the ownership transfer into 3 distinct steps. With the first 2 steps, performed by the original owner (initiate → confirm) and the remaining 1 step performed by the new owner (accept).&lt;&#x2F;p&gt;
&lt;p&gt;We enforce an optional time window between the initiate and confirm stages to give additional room for review, and make ownership key compromise scenarios less fatal.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Ownership management is crucial in on-chain security and a significant portion of the security assumptions of defi protocols, smart contract wallets and on-chain utilities rely on the contract ownership.&lt;&#x2F;p&gt;
&lt;p&gt;The single-step &lt;code&gt;transferOwnership()&lt;&#x2F;code&gt; style ownership mechanism has been in the industry for a long time, (e.g.,&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;173&#x2F;&quot;&gt;ERC-173&lt;&#x2F;a&gt;), and has been used ubiquitously as an industry standard. As the industry evolves and attacks get more sophisticated there is a strong need for a multi-step, time gated ownership management process to enhance the ecosystem’s contract ownership to be more reviewable, stoppable, thorough and secure.&lt;&#x2F;p&gt;
&lt;p&gt;The main objective of this standard is to make ownership more secure and handled in a multi-stepped approach that enables the operation to be conducted with more caution and lesser operational mistakes, while being immune to potential scam attacks.&lt;&#x2F;p&gt;
&lt;p&gt;Key factors taken into consideration for the standard:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Reduce probability of operational mistakes.&lt;&#x2F;li&gt;
&lt;li&gt;Foster on-chain reviewal practice for ownership transfer.&lt;&#x2F;li&gt;
&lt;li&gt;Ability to rollback ownership transfer, during the transfer process.&lt;&#x2F;li&gt;
&lt;li&gt;Simplicity.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;strong&gt;1. Reduce probability of operational mistakes:&lt;&#x2F;strong&gt; The standard makes the ownership transfer stage into 3 different clear steps. Initiation → Confirmation → Acceptance. The owner will have the enforced ability to review the newOwner address secured by the pre-set buffer time. Also to reduce any operational mistakes or possible scams (e.g., address poisoning) the address is required as the parameter in each Initiation &amp;amp; Confirmation stage.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;2. Foster on-chain reviewal practice for ownership transfer:&lt;&#x2F;strong&gt; We not only targets this as a contract interface and implementation methodology, but also hopes to foster an ecosystem-level awareness and security practice to thoroughly review, confirm the ownership transfer. The standard helps operators of Smart Contract to review newOwner address on-chain, and further confirm again if the address is indeed correct.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;3. Ability to rollback ownership transfer, during the transfer process:&lt;&#x2F;strong&gt; Whether through an operational mistake or private key leak of owner account, or other reasons, the ability to rollback ownership transfer within the time buffer highly increases the security and operational burden.&lt;&#x2F;p&gt;
&lt;p&gt;Even in the extreme case of owner private key leak, if the buffer time is set enough, the original owner can earn time to evacuate the funds from the protocol, and possibly prohibit ownership transfer through DoS of ownership (attack → initiate , original owner(defender) → re initiate. which will reset the time back to 0).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;4. Simplicity:&lt;&#x2F;strong&gt; &lt;code&gt;MultistepOwnable&lt;&#x2F;code&gt; is targeted to be a simple contract given the diverse use cases and scenarios it could be applied. The process for ownership transfer is concise but thorough enough to allow owners review each step. This is the rationale behind making the ownership transfer time buffer and buffer time update capability optional.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;A multi-step ownable contract MUST implement the following interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Multistep Ownership Standard&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MultiStepOwnable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OwnershipTransferInitiated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; prevOwner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newOwner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OwnershipTransferConfirmed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; prevOwner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newOwner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OwnershipTransferred&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; prevOwner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newOwner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; initiate the ownership transfer. First step of ownership transfer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; moves the newOwner to the preConfirmed stage.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; newOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the address of the new owner of the contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; stored as preConfirmedOwner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; initiateOwnershipTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newOwner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; confirm the ownership transfer. Second step of ownership transfer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; confirmation can only be done after the transfer-buffer period from initiation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; newOwner should match with the initiation step&amp;#39;s newOwner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; To initiate ownership transfer to a different newOwner, initiation step should be re-conducted.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; newOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the address of the new owner of the contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; stored as pendingOwner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; confirmOwnershipTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newOwner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; cancels the pending ownership transfer. Before the final step of ownership transfer (acceptOwnershipTransfer()).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function should wipe out the pendingOwner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; By calling this function, ownership transfer process is canceled and should be reinitiated from initiateOwnershipTransfer().&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; cancelPendingOwnershipTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; accepts the ownership transfer. Final step of ownership transfer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function can only be called by the newOwner that was confirmed in step 2.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The contract should perform access control e.g.,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; msg.sender == pendingOwner()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; acceptOwnershipTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; only the address returned by owner() has authority as the owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; pendingOwner() and preConfirmedOwner() should not possess any&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; authority&#x2F;access&#x2F;right.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; returns the owner of the contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; returns the pending owner of the account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; pending owner should not have any authority&#x2F;access&#x2F;right.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; pendingOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; returns the pre-confirmed owner of the account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; pre-confirmed owner should not have any authority&#x2F;access&#x2F;right.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; preConfirmedOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; returns the ownership transfer buffer time (in seconds).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the buffer is enforced between initiation &amp;lt;&amp;gt; confirmation of ownership transfer. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the standard does not enforce the value range. it is highly recommended to be between 2 &amp;lt;&amp;gt; 14 days.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getOwnershipTransferBuffer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;MultiStepOwnable&lt;&#x2F;code&gt; contract MAY implement the &lt;code&gt;UpdateableOwnershipTransferBuffer&lt;&#x2F;code&gt; interface to enable buffer period modification.&lt;&#x2F;p&gt;
&lt;p&gt;The contract MUST update the buffer period with a 2 step approach of initiation (&lt;code&gt;initiateOwnershipBufferUpdate()&lt;&#x2F;code&gt;) and then confirmation (&lt;code&gt;confirmOwnershipBufferUpdate()&lt;&#x2F;code&gt;) after the existing buffer period. The buffer period should be enforced between these 2 function calls.
If this behavior is not enforced, the security of &lt;code&gt;ownershipTransferBuffer&lt;&#x2F;code&gt; could break during owner key compromise scenario.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; UpdateableOwnershipTransferBuffer. Extension of MultiStepOwnable.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UpdateableOwnershipTransferBuffer&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; initiates the update of ownership transfer time buffer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; initiateOwnershipBufferUpdate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newBuffer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; confirms the update of ownership transfer time buffer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; confirmation SHOULD revert if existing time buffer did not pass since&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; initiation of ownership transfer time buffer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; confirmOwnershipBufferUpdate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newBuffer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;A time buffer for ownership transfer is introduced to foster a process of reviewing the new owner address on-chain. However, this remains an optional behavior to allow flexibility in ownership management. Removing the optional time buffer would be similar to the implementation of &lt;code&gt;Ownable2Step&lt;&#x2F;code&gt; with an additional step for confirmation.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Enforcing a time buffer to update the ownership transfer time buffer is crucial for maintaining the security of the &lt;code&gt;MultiStepOwnable&lt;&#x2F;code&gt; contract. When the owner key is compromised, this allows the original owner of the account to be able to DoS and prohibit the ownership transfer to the malicious entity when the ownership transfer buffer is sufficiently long enough.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;For compatibility with existing ownership mechanisms, the standard is designed to be compatible with the existing ownership mechanism for fetching the owner through &lt;code&gt;owner()&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;TBD &lt;!-- TODO --&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;Only owner should be available to call &lt;code&gt;initiateOwnershipTransfer()&lt;&#x2F;code&gt; &amp;amp; &lt;code&gt;confirmOwnershipTransfer()&lt;&#x2F;code&gt; &amp;amp; &lt;code&gt;cancelPendingOwnershipTransfer()&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;OwnershipTransferBuffer&lt;&#x2F;code&gt; should be set together when owner is set. e.g., &lt;code&gt;constructor()&lt;&#x2F;code&gt;, &lt;code&gt;initialize()&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;OwnershipTransferBuffer&lt;&#x2F;code&gt; is set, it should be strictly enforced between initiation and confirmation.&lt;&#x2F;li&gt;
&lt;li&gt;Before the new owner performs &lt;code&gt;acceptOwnership()&lt;&#x2F;code&gt;, the original, existing owner should still hold all rights as the owner. Because the owner is still unchanged.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Minimal Wallet-Managed Auto-Login for SIWE</title>
        <published>2025-09-02T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Ivo Georgiev</name><uri>https://github.com/Ivshti</uri>
	</author>
	
	<author>
		<name>Vijay Krishnavanshi</name><uri>https://github.com/vijaykrishnavanshi</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8019/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-8019-minimal-wallet-managed-auto-login-for-siwe/25348" />
        

        <id>https://wg-eips.ritovision.com/8019/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:8019"
            label="ERC-8019" />
        

        
        

        
        <summary type="html">Defines a wallet-local allowlist for automatic signing of ERC-4361 messages when simple match rules succeed.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8019/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Defines a wallet-local allowlist for automatic signing of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4361&#x2F;&quot;&gt;ERC-4361&lt;&#x2F;a&gt; messages when simple, deterministic match rules succeed. Policies are created and managed only by the wallet&#x2F;user.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Users repeatedly sign identical Sign-In With Ethereum (SIWE) messages for trusted apps. A small, explicit match policy enables zero-prompt login without involving apps.&lt;&#x2F;p&gt;
&lt;p&gt;Users already get prompted by their wallets if they trust a certain app when they initially connect to it - this flow can also authorize auto-login if applicable.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;The term “wallet” refers to wallet user interfaces, regardless of whether mobile, web-based or browser extensions.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;overview&quot;&gt;Overview&lt;&#x2F;h3&gt;
&lt;p&gt;Each allow-policy is defined as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;domain&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;example.com&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;                  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; exact match to SIWE domain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uriPrefix&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;example.com&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SIWE URI MUST start with this&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;allowedChains&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;                     &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; list of allowed chainIds&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;allowedResources&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;example.com&#x2F;login&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; exact set match&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;supportsEIP6492&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;                   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; required for smooth UX when using hardware wallets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;expiresAt&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1700000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; UNIX timestamp when this policy expires, or 0 for no expiry&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;auto-sign-rule&quot;&gt;Auto-sign rule&lt;&#x2F;h3&gt;
&lt;p&gt;Given a parsed &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4361&#x2F;&quot;&gt;ERC-4361&lt;&#x2F;a&gt; message &lt;code&gt;M&lt;&#x2F;code&gt;, the wallet &lt;strong&gt;MAY&lt;&#x2F;strong&gt; auto-sign &lt;strong&gt;if&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;M.domain == policy.domain&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;M.uri&lt;&#x2F;code&gt; &lt;strong&gt;startsWith&lt;&#x2F;strong&gt; &lt;code&gt;policy.uriPrefix&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;If M.chainId present: &lt;code&gt;M.chainId&lt;&#x2F;code&gt; is in &lt;code&gt;policy.allowedChains&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;If policy.allowedResources non-empty:
the set of &lt;code&gt;M.resources&lt;&#x2F;code&gt; is a subset of &lt;code&gt;policy.allowedResources&lt;&#x2F;code&gt; (order does not matter); otherwise no resources will be allowed at all&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;policy.expiresAt&lt;&#x2F;code&gt; is non-zero, the current time is less than &lt;code&gt;policy.expiresAt&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;All other SIWE validations (nonce uniqueness, time validity, signature domain binding) remain as per &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4361&#x2F;&quot;&gt;ERC-4361&lt;&#x2F;a&gt; and MUST be enforced by the wallet.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;management-of-policies&quot;&gt;Management of policies&lt;&#x2F;h3&gt;
&lt;p&gt;Policies are created, listed, updated, and deleted &lt;strong&gt;only&lt;&#x2F;strong&gt; within the wallet UI - wallets decide how much control they want to give to users over this.&lt;&#x2F;p&gt;
&lt;p&gt;It’s recommended that each wallet:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;includes a default list of policies for popular apps&lt;&#x2F;li&gt;
&lt;li&gt;automatically creates policies for apps that it considers safe, after the first SIWE signature, with user consent - this implies a different flow where, upon receiving the SIWE message sign request, the wallet will not go through the regular message signing flow, but prompt the user “App X wants to log-in with your account” with a checkbox to “Automatically sign into &lt;app hostname&gt; in the future”&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;There’s no app-provided hints or headers that influence policy creation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;hardware-wallet-compatibility-and-erc-6492&quot;&gt;Hardware wallet compatibility and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6492&#x2F;&quot;&gt;ERC-6492&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Auto-signing is not viable with hardware wallet accounts, as the user will be prompted without context or expectation to sign the login message.&lt;&#x2F;p&gt;
&lt;p&gt;This is why we include the &lt;code&gt;supportsEIP6492&lt;&#x2F;code&gt; property. If it is set to &lt;code&gt;false&lt;&#x2F;code&gt;, the wallet MUST not auto-login if the account&#x27;s primary signer is a hardware wallet, as the app has no way of verifying a smart contract signature.&lt;&#x2F;p&gt;
&lt;p&gt;However, if it&#x27;s set to &lt;code&gt;true&lt;&#x2F;code&gt;, the wallet MAY perform auto-login as long as 1) it can enable &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; on the account OR the account is a smart account 2) it can authorize a limited-scope session key or delegation just for the auto-login. If said conditions are met, the wallet MAY generate a login signature without prompting the user on their hardware device. That said, enabling EIP-7702 and the session key&#x2F;delegation will require prompting the user, so it&#x27;s up to the wallet to walk the user through it. The exact mechanism of how wallets should manage the session key&#x2F;delegation is out of scope of this ERC, but &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7710&#x2F;&quot;&gt;ERC-7710&lt;&#x2F;a&gt; may be used.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;rpc-method&quot;&gt;RPC method&lt;&#x2F;h3&gt;
&lt;p&gt;Wallets MAY implement an RPC method, &lt;code&gt;wallet_getCurrentAutoLoginPolicy&lt;&#x2F;code&gt;, which has no parameters and returns an object describing the current policy for the calling app.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the object that describes the active policy, or null&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;activePolicy&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;domain&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;example.com&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uriPrefix&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;example.com&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;allowedChains&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;allowedResources&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;example.com&#x2F;login&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;supportsEIP6492&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;expiresAt&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1700000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The response of this method allows apps to determine whether they can self-initiate login requests without user interaction.&lt;&#x2F;p&gt;
&lt;p&gt;If this ERC is disabled in the wallet, or there is no active policy for the calling app, the wallet MUST return &lt;code&gt;null&lt;&#x2F;code&gt; for &lt;code&gt;activePolicy&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;It&#x27;s recommended that the wallet returns &lt;code&gt;null&lt;&#x2F;code&gt; if the policy has expired or the app is connected on a non-allowed chain.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;This ERC is designed with minimal modifications to existing apps in mind&lt;&#x2F;li&gt;
&lt;li&gt;From a security perspective, it&#x27;s much easier to &quot;outsource&quot; the job of determining which apps to enable to this policy for to wallets - most wallets already maintain lists of &quot;trusted&quot; apps&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; (typed data) is out of scope due to SIWE deciding to build on plain text.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Backwards compatibility is one of the main goals of this ERC, and it requires no changes to existing apps, building upon &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4361&#x2F;&quot;&gt;ERC-4361&lt;&#x2F;a&gt; as-is.&lt;&#x2F;p&gt;
&lt;p&gt;To fully take advantage of this ERC, apps need to self-initiate the login request rather than expecting users to press a log-in button (using &lt;code&gt;wallet_getCurrentAutoLoginPolicy&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; shouldAutoSign&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;M&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; P&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;M&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;domain&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; P&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;domain&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;M&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;uri&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;startsWith&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;P&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;uriPrefix&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;P&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;allowedChains&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;includes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;M&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;M&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;resources&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; allowList&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; P&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;allowedResources&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;M&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;resources&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;every&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;resource&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; allowList&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;includes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;resource&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;P&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;expiresAt&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Date&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;now&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; P&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;expiresAt&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Also enforce standard SIWE validations here.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;It’s recommended for Auto login to be OFF by default on wallets’ UIs so that users can explicitly toggle ON for websites they trust.&lt;&#x2F;li&gt;
&lt;li&gt;Managing policies it out of scope of this ERC, as most wallets already manage trusted app lists - however, the recommended best practice is to:
&lt;ul&gt;
&lt;li&gt;Include a default list of policies for popular apps&lt;&#x2F;li&gt;
&lt;li&gt;Auto-create policies for other apps if the user consents to it&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Standard SIWE checks (fresh nonce, correct domain binding, time validity) should still be enforced.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;uriPrefix&lt;&#x2F;code&gt; should be kept specific (e.g., &lt;code&gt;&#x2F;login&lt;&#x2F;code&gt;) to avoid over-broad matches.&lt;&#x2F;li&gt;
&lt;li&gt;It&#x27;s recommended to include a top-level setting in each wallet that can disable this ERC.&lt;&#x2F;li&gt;
&lt;li&gt;Always match &lt;code&gt;M.domain&lt;&#x2F;code&gt; against the top-level origin of each app, to avoid auto-login working in iframes that are included in a malicious top-level origin.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Payout Race</title>
        <published>2025-08-31T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Kyle Thornton</name><uri>https://github.com/kyle</uri><email>kyle@cowrie.io</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8017/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-8017-payout-race/25311" />
        

        <id>https://wg-eips.ritovision.com/8017/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:8017"
            label="ERC-8017" />
        

        
        

        
        <summary type="html">Minimal ERC for a single-asset payout bucket that vends its entire balance for a fixed payment amount.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8017/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC specifies a small contract surface for a &quot;payout race&quot;: a bucket that holds a single payout asset type and transfers the entire bucket to a recipient when a caller pays a fixed &lt;strong&gt;required payment&lt;&#x2F;strong&gt; in a configured desired payment asset. The desired payment asset can be ETH or one &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;. The payout asset can be ETH or one ERC-20.&lt;&#x2F;p&gt;
&lt;p&gt;This ERC is inspired by the Uniswap Foundation&#x27;s &lt;strong&gt;Unistaker&lt;&#x2F;strong&gt; proposal, which introduced the term &lt;strong&gt;Payout Race&lt;&#x2F;strong&gt; and motivated this design.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Many protocols need an ongoing way to convert a continuous stream of value into another asset at or near prevailing market prices. Typical cases include buying back a protocol token using protocol revenue, accumulating a reserve asset, funding incentive budgets, or rebalancing treasuries. Existing patterns have material drawbacks. Integrating an AMM couples outcomes to external liquidity, slippage, and fees, and requires retuning when pool conditions change. General on-chain auctions add operational complexity and higher gas, especially when run continuously.&lt;&#x2F;p&gt;
&lt;p&gt;This ERC defines a deterministic, revenue-driven primitive that is analogous to a Dutch auction. Sources of value flow into this contract, filling a &quot;bucket&quot; of purchasable assets. The first caller that supplies the required payment in the desired payment asset receives the entire current balance of the payout token in the bucket. The interface is small, auditable, and easy to compose with upstream controllers that decide when the exchange is economically sound.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The following interface and rules are normative. The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Conforming contract&lt;&#x2F;strong&gt;: Any smart contract that exposes this interface and claims compliance with this ERC. This includes proxies and clones. Requirements in this document apply to the observable runtime behavior of the deployed contract.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Payout asset&lt;&#x2F;strong&gt;: Asset dispensed from the bucket. &lt;code&gt;payoutAsset == address(0)&lt;&#x2F;code&gt; means ETH payout.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Desired payment asset&lt;&#x2F;strong&gt;: Asset the buyer must pay. Referred to as &lt;code&gt;desiredAsset&lt;&#x2F;code&gt; in the interface. &lt;code&gt;desiredAsset == address(0)&lt;&#x2F;code&gt; means ETH payment.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Required payment&lt;&#x2F;strong&gt;: Fixed amount of the desired payment asset (&lt;code&gt;desiredAsset&lt;&#x2F;code&gt;) or ETH that must be provided by the buyer to trigger the payout.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;interface&quot;&gt;Interface&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.24&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IPayoutRace&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Payout asset. address(0) means ETH payout.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; payoutAsset&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Desired payment asset. address(0) means ETH payment.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; desiredAsset&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Fixed amount required to win the race, denominated in the desired payment asset.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; requiredPayment&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Destination that receives the buyer&amp;#39;s payment.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; paymentSink&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Pay the required amount and receive the entire current balance of the payout token to `to`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Reverts if the computed dispensed amount is zero. Must be safe against reentrancy.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; dispensed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of payout token transferred to `to`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; purchase&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; dispensed&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Admin surface.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setRequiredPayment&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setPaymentSink&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sink&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Events&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Purchased&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; buyer&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; dispensed&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; paid&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PaymentConfigUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; desiredAsset&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; requiredPayment&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sink&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;required-behavior&quot;&gt;Required Behavior&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Exact required payment.&lt;&#x2F;strong&gt; Callers &lt;strong&gt;MUST&lt;&#x2F;strong&gt; provide exactly &lt;code&gt;requiredPayment()&lt;&#x2F;code&gt; in the configured &lt;code&gt;desiredAsset&lt;&#x2F;code&gt; or in ETH to call &lt;code&gt;purchase&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Token pairing.&lt;&#x2F;strong&gt; &lt;code&gt;payoutAsset&lt;&#x2F;code&gt; and &lt;code&gt;desiredAsset&lt;&#x2F;code&gt; &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; both be &lt;code&gt;address(0)&lt;&#x2F;code&gt;. ETH on both sides is disallowed.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Desired payment asset immutability.&lt;&#x2F;strong&gt; &lt;code&gt;desiredAsset&lt;&#x2F;code&gt; &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; change after initialization. A conforming contract &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; expose any callable setter that can change &lt;code&gt;desiredAsset&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Payout asset immutability.&lt;&#x2F;strong&gt; &lt;code&gt;payoutAsset&lt;&#x2F;code&gt; &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; change after initialization. A conforming contract &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; expose any callable setter that can change &lt;code&gt;payoutAsset&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;All-or-nothing dispense.&lt;&#x2F;strong&gt; On &lt;code&gt;purchase&lt;&#x2F;code&gt;, a conforming contract MUST compute the amount to dispense as the live balance of the payout token captured at function entry, before any external calls. The contract MUST transfer exactly this amount to &lt;code&gt;to&lt;&#x2F;code&gt; in a single call and the call MUST revert if this amount is zero.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Payment collection.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If &lt;code&gt;desiredAsset == address(0)&lt;&#x2F;code&gt;, &lt;code&gt;purchase&lt;&#x2F;code&gt; &lt;strong&gt;MUST&lt;&#x2F;strong&gt; require &lt;code&gt;msg.value == requiredPayment()&lt;&#x2F;code&gt; and &lt;strong&gt;MUST&lt;&#x2F;strong&gt; forward that ETH to &lt;code&gt;paymentSink()&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;desiredAsset != address(0)&lt;&#x2F;code&gt;, &lt;code&gt;purchase&lt;&#x2F;code&gt; &lt;strong&gt;MUST&lt;&#x2F;strong&gt; require &lt;code&gt;msg.value == 0&lt;&#x2F;code&gt; and &lt;strong&gt;MUST&lt;&#x2F;strong&gt; call &lt;code&gt;transferFrom(msg.sender, paymentSink(), requiredPayment())&lt;&#x2F;code&gt; on &lt;code&gt;desiredAsset&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Admin changes.&lt;&#x2F;strong&gt; A conforming contract &lt;strong&gt;MUST&lt;&#x2F;strong&gt; restrict the admin setters to an authorized role and &lt;strong&gt;MUST&lt;&#x2F;strong&gt; emit &lt;code&gt;PaymentConfigUpdated&lt;&#x2F;code&gt; when &lt;code&gt;requiredPayment&lt;&#x2F;code&gt; or &lt;code&gt;paymentSink&lt;&#x2F;code&gt; change.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;optional-extensions&quot;&gt;Optional Extensions&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Permit for payment&lt;&#x2F;strong&gt;: A conforming contract &lt;strong&gt;MAY&lt;&#x2F;strong&gt; expose &lt;code&gt;purchaseWithPermit(...)&lt;&#x2F;code&gt; that accepts &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2612&#x2F;&quot;&gt;EIP-2612&lt;&#x2F;a&gt; permit parameters. If implemented, the function &lt;strong&gt;MUST&lt;&#x2F;strong&gt; require &lt;code&gt;desiredAsset != address(0)&lt;&#x2F;code&gt;, &lt;strong&gt;MUST&lt;&#x2F;strong&gt; call &lt;code&gt;permit&lt;&#x2F;code&gt; on &lt;code&gt;desiredAsset&lt;&#x2F;code&gt; with the supplied signature, and &lt;strong&gt;MUST&lt;&#x2F;strong&gt; collect &lt;code&gt;requiredPayment&lt;&#x2F;code&gt; via &lt;code&gt;transferFrom&lt;&#x2F;code&gt; in the same transaction. The call &lt;strong&gt;MUST&lt;&#x2F;strong&gt; revert if &lt;code&gt;desiredAsset&lt;&#x2F;code&gt; does not implement EIP-2612 or if the permit does not yield sufficient allowance.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Rescue for unintended assets&lt;&#x2F;strong&gt;: A conforming contract &lt;strong&gt;MAY&lt;&#x2F;strong&gt; implement an admin-only &lt;code&gt;rescue&lt;&#x2F;code&gt; function to recover assets that are not the &lt;code&gt;payoutAsset&lt;&#x2F;code&gt; (e.g., unsolicited ERC-20s or ETH sent when &lt;code&gt;payoutAsset&lt;&#x2F;code&gt; is an ERC-20). If provided, the function &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; transfer the &lt;code&gt;payoutAsset&lt;&#x2F;code&gt;, &lt;strong&gt;MUST&lt;&#x2F;strong&gt; emit a &lt;code&gt;Rescued(address token, address to, uint256 amount)&lt;&#x2F;code&gt; event, and &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be restricted to an authorized role.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;A single required payment pairs well with controllers that evaluate when the exchange is economically sound and trigger &lt;code&gt;purchase&lt;&#x2F;code&gt; only when conditions justify it. The onchain primitive then validates the payment and atomically transfers the entire bucket.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;paymentSink&lt;&#x2F;code&gt; reduces persistent balances in the contract and simplifies audits. Sinks can be treasuries, splitters, or burns.&lt;&#x2F;li&gt;
&lt;li&gt;Using the live onchain balance as the source of truth automatically captures rebases and fee-on-transfer mechanics, and keeps the onchain tracking minimized. It also implies that unsolicited transfers to the contract will be included in the next payout, which purchasers may want to account for at the integration level.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;admin-considerations&quot;&gt;Admin Considerations&lt;&#x2F;h3&gt;
&lt;p&gt;Access control for admin setters is intentionally unspecified; &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;173&#x2F;&quot;&gt;EIP-173&lt;&#x2F;a&gt; ownership or a role-based pattern is recommended.&lt;&#x2F;p&gt;
&lt;p&gt;Some deployments may renounce or restrict admin rights for policy or compliance reasons (for example, renouncing ownership or disabling roles). This ERC does not prescribe any specific mechanism.&lt;&#x2F;p&gt;
&lt;p&gt;The reference uses &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;173&#x2F;&quot;&gt;EIP-173&lt;&#x2F;a&gt; style ownership for illustration. Any access control that enforces the Required behavior is acceptable. Deployments may assign distinct roles per setter or make one or more parameters immutable. The specification is agnostic to the mechanism.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parameter-selection-and-degenerate-cases&quot;&gt;Parameter Selection and Degenerate Cases&lt;&#x2F;h3&gt;
&lt;p&gt;This mechanism works best when value accrues gradually. Large, lumpy deposits can overshoot the required payment threshold and leak value to the first successful caller. Operators should size &lt;code&gt;requiredPayment&lt;&#x2F;code&gt; relative to observed inflow volatility and adjust conservatively. If the payout asset appreciates against the desired payment asset, purchases may stall. If it depreciates, purchases may trigger so frequently that value is lost whenever a large trade pushes the bucket well above the threshold.&lt;&#x2F;p&gt;
&lt;p&gt;Changing &lt;code&gt;requiredPayment&lt;&#x2F;code&gt; carries risks. Lowering it can leak value at the moment of change if accrued payout already exceeds the new threshold, since searchers can win a bargain. Raising it can disrupt or bankrupt naive searchers and MEV bots that provide rewards by arbitraging fee collection. Mitigations may include timelocked or scheduled parameter changes, announce windows, caps on per-block deposits, cooldowns after changes, and time-weighted average pricing (TWAP)-based or ratcheted adjustments to &lt;code&gt;requiredPayment&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;considered-alternatives-multi-asset-sweep&quot;&gt;Considered Alternatives: Multi-Asset Sweep&lt;&#x2F;h3&gt;
&lt;p&gt;This design could be extended to support multiple payout assets by maintaining an explicit allowlist and, on a successful &lt;code&gt;purchase&lt;&#x2F;code&gt;, sweeping each allowlisted token to the recipient using the same mechanics as the single-asset case.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Compatible with any &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;. Wallets and dApps can integrate using standard allowance flows or optional &lt;code&gt;permit&lt;&#x2F;code&gt; helpers.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.24&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC20&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC20&#x2F;IERC20.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ReentrancyGuard&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;security&#x2F;ReentrancyGuard.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PayoutRace&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ReentrancyGuard&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; immutable&lt;&#x2F;span&gt;&lt;span&gt; payoutAsset&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address(0) for ETH payout&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; immutable&lt;&#x2F;span&gt;&lt;span&gt; desiredAsset&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;       &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address(0) for ETH payment&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; requiredPayment&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;              &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; fixed amount owed by buyer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; paymentSink&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Purchased&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; buyer&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; dispensed&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; paid&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PaymentConfigUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; desiredAsset&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; requiredPayment&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sink&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OwnershipTransferred&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; oldOwner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newOwner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    modifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;not owner&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; _&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _payoutAsset&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _desiredAsset&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _required&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _sink&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_payoutAsset &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; _desiredAsset &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ETH-ETH disallowed&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _owner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        payoutAsset &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _payoutAsset&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;              &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; zero means ETH payout&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        desiredAsset &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _desiredAsset&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; zero means ETH payment&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        requiredPayment &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _required&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        paymentSink &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _sink&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OwnershipTransferred&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PaymentConfigUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;desiredAsset&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; requiredPayment&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; paymentSink&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferOwnership&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt; _owner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; n&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OwnershipTransferred&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Accept ETH only when this instance vends ETH&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    receive&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;payoutToken &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ETH payout disabled&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; desiredAsset is immutable in this reference; no setter is provided.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setRequiredPayment&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt; requiredPayment &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PaymentConfigUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;desiredAsset&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; requiredPayment&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; paymentSink&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setPaymentSink&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sink&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt; paymentSink &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; sink&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PaymentConfigUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;desiredAsset&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; requiredPayment&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; paymentSink&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; purchase&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; nonReentrant&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; dispensed&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; toDispense&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;payoutAsset &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; capture live ETH balance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            toDispense &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balance&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            toDispense &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;payoutAsset&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;toDispense &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;empty&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; collect payment&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;desiredAsset &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;value &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; requiredPayment&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;bad msg.value&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt; ok&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; )&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; paymentSink&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;call&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ok&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;sink transfer failed&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;value &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;unexpected ETH&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;desiredAsset&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; paymentSink&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; requiredPayment&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;payment transfer failed&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; payout&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;payoutAsset &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt; ok2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; )&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;call&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; toDispense&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ok2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ETH payout failed&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;payoutAsset&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; toDispense&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;token payout failed&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Purchased&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; toDispense&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; requiredPayment&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; toDispense&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Payout accounting.&lt;&#x2F;strong&gt; The dispensed amount is computed from the live onchain balance of the payout asset. Because ETH-to-ETH is disallowed, there is no ambiguity about subtracting &lt;code&gt;msg.value&lt;&#x2F;code&gt;. Capture the amount to dispense at function entry and use that value for the transfer.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Reentrancy and external calls.&lt;&#x2F;strong&gt; Use the Checks-Effects-Interactions pattern and a reentrancy guard. Avoid any external calls before you (a) capture the amount to dispense and (b) forward payment to &lt;code&gt;paymentSink&lt;&#x2F;code&gt;. Do not perform callbacks between collecting payment and completing the payout.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Receiver constraints.&lt;&#x2F;strong&gt; The recipient &lt;code&gt;to&lt;&#x2F;code&gt; must be able to receive the asset being dispensed. ETH payouts require a payable fallback; &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; payouts require that &lt;code&gt;to&lt;&#x2F;code&gt; is not a contract that reverts on &lt;code&gt;transfer&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Payment sink constraints.&lt;&#x2F;strong&gt; The &lt;code&gt;paymentSink&lt;&#x2F;code&gt; must be able to receive the desired payment asset. For ETH payments, &lt;code&gt;paymentSink&lt;&#x2F;code&gt; must be payable. For &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; payments, &lt;code&gt;paymentSink&lt;&#x2F;code&gt; must not revert when credited via &lt;code&gt;transferFrom&lt;&#x2F;code&gt;. Using a burn address, splitter, or treasury is acceptable; the specification is agnostic to the mechanism.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Unsolicited transfers.&lt;&#x2F;strong&gt; The next payout will include any assets pushed to the contract (e.g., direct ETH sends or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; transfers). Operators should account for this at the integration layer, or front the contract with filters if needed. An optional admin-only &lt;code&gt;rescue&lt;&#x2F;code&gt; for non-&lt;code&gt;payoutAsset&lt;&#x2F;code&gt; assets can mitigate mistakes without affecting conformance.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Approvals and permits.&lt;&#x2F;strong&gt; When using &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; payments, callers should consider allowance race conditions. If a &lt;code&gt;purchaseWithPermit&lt;&#x2F;code&gt; helper is implemented, verify domain separator, deadline, and nonce handling, and revert on insufficient post‑permit allowance.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Admin changes.&lt;&#x2F;strong&gt; Because setters can change &lt;code&gt;requiredPayment&lt;&#x2F;code&gt; or &lt;code&gt;paymentSink&lt;&#x2F;code&gt;, governance should protect these operations. Common mitigations include timelocks, scheduled changes with announcement windows, and immutability for parameters that should never change.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Proxies and clones.&lt;&#x2F;strong&gt; Constructors do not run per proxy or minimal clone. Implementations should set &lt;code&gt;payoutAsset&lt;&#x2F;code&gt; and &lt;code&gt;desiredAsset&lt;&#x2F;code&gt; once during initialization and ensure they cannot change afterward. Avoid exposing setters and protect initializers against re-entry or multiple calls.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>SSZ CompatibleUnion</title>
        <published>2025-08-28T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Etan Kissling</name><uri>https://github.com/etan-status</uri>
	</author>
	
	<author>
		<name>Cayman</name><uri>https://github.com/wemeetagain</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8016/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8016-ssz-compatibleunion/25275" />
        

        <id>https://wg-eips.ritovision.com/8016/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:8016"
            label="EIP-8016" />
        

        
        

        
        <summary type="html">SSZ type for forward-compatible unions</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8016/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a new &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;ad36024441cf910d428d03f87f331fbbd2b3e5f1&#x2F;ssz&#x2F;simple-serialize.md&quot;&gt;Simple Serialize (SSZ)&lt;&#x2F;a&gt; type to represent unions with forward-compatible Merkleization: A given field is always assigned the same stable &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;ad36024441cf910d428d03f87f331fbbd2b3e5f1&#x2F;ssz&#x2F;merkle-proofs.md#generalized-merkle-tree-index&quot;&gt;generalized index (gindex)&lt;&#x2F;a&gt; across all type options.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Certain types, e.g., transactions, allow multiple variants carving out slightly different feature sets. Merkleization equivalence is still desirable, as it allows verifiers to check common fields across variants. These types should still efficiently deserialize into one of their possible variants corresponding to its known tree shape. In programming languages, this is typically achieved by tagged unions.&lt;&#x2F;p&gt;
&lt;p&gt;If multiple versions of an SSZ container coexist at the same time, for example to represent transaction types, the same field may be assigned to a different gindex in each version. This unnecessarily complicates verifiers and introduces a maintenance burden, as the verifier has to be kept up to date with version specific field to gindex map.&lt;&#x2F;p&gt;
&lt;p&gt;Compatible unions allow only type options to be used that provide stable gindex assignment across all of them.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc2119&quot;&gt;RFC 2119&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc8174&quot;&gt;RFC 8174&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;compatibleunion-selector-type&quot;&gt;&lt;code&gt;CompatibleUnion({selector: type})&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;A new &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;ad36024441cf910d428d03f87f331fbbd2b3e5f1&#x2F;ssz&#x2F;simple-serialize.md#composite-types&quot;&gt;SSZ composite type&lt;&#x2F;a&gt; is defined:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;compatible union&lt;&#x2F;strong&gt;: union type containing one of the given subtypes with compatible Merkleization
&lt;ul&gt;
&lt;li&gt;notation &lt;code&gt;CompatibleUnion({selector: type})&lt;&#x2F;code&gt;, e.g. &lt;code&gt;CompatibleUnion({1: Square, 2: Circle})&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Compatible unions are always considered &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;ad36024441cf910d428d03f87f331fbbd2b3e5f1&#x2F;ssz&#x2F;simple-serialize.md#variable-size-and-fixed-size&quot;&gt;&quot;variable-size&quot;&lt;&#x2F;a&gt;, even when all type options share the same fixed length.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;ad36024441cf910d428d03f87f331fbbd2b3e5f1&#x2F;ssz&#x2F;simple-serialize.md#default-values&quot;&gt;default value&lt;&#x2F;a&gt; is defined as:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Default Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CompatibleUnion({selector: type})&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;n&#x2F;a (error)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The following types are considered &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;ad36024441cf910d428d03f87f331fbbd2b3e5f1&#x2F;ssz&#x2F;simple-serialize.md#illegal-types&quot;&gt;illegal&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;CompatibleUnion({})&lt;&#x2F;code&gt; without any type options are illegal.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CompatibleUnion({selector: type})&lt;&#x2F;code&gt; with a selector outside &lt;code&gt;uint8(1)&lt;&#x2F;code&gt; through &lt;code&gt;uint8(127)&lt;&#x2F;code&gt; are illegal.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CompatibleUnion({selector: type})&lt;&#x2F;code&gt; with a type option that has incompatible Merkleization with another type option are illegal.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;compatible-merkleization&quot;&gt;Compatible Merkleization&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Types are compatible with themselves.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;byte&lt;&#x2F;code&gt; is compatible with &lt;code&gt;uint8&lt;&#x2F;code&gt; and vice versa.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Bitlist[N]&lt;&#x2F;code&gt; are compatible if they share the same capacity &lt;code&gt;N&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Bitvector[N]&lt;&#x2F;code&gt; are compatible if they share the same capacity &lt;code&gt;N&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;List[type, N]&lt;&#x2F;code&gt; are compatible if &lt;code&gt;type&lt;&#x2F;code&gt; is compatible and they share the same capacity &lt;code&gt;N&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Vector[type, N]&lt;&#x2F;code&gt; are compatible if &lt;code&gt;type&lt;&#x2F;code&gt; is compatible and they share the same capacity &lt;code&gt;N&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7916&#x2F;&quot;&gt;&lt;code&gt;ProgressiveList[type]&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; are compatible if &lt;code&gt;type&lt;&#x2F;code&gt; is compatible.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Container&lt;&#x2F;code&gt; are compatible if they share the same field names in the same order, and all field types are compatible.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7495&#x2F;&quot;&gt;&lt;code&gt;ProgressiveContainer(active_fields)&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; are compatible if all &lt;code&gt;1&lt;&#x2F;code&gt; entries in both type&#x27;s &lt;code&gt;active_fields&lt;&#x2F;code&gt; correspond to fields with shared names and compatible types, and no other field name is shared across both types.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CompatibleUnion&lt;&#x2F;code&gt; are compatible with each other if all type options across both &lt;code&gt;CompatibleUnion&lt;&#x2F;code&gt; are compatible.&lt;&#x2F;li&gt;
&lt;li&gt;All other types are incompatible.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;serialization&quot;&gt;Serialization&lt;&#x2F;h4&gt;
&lt;p&gt;A &lt;code&gt;value&lt;&#x2F;code&gt; as &lt;code&gt;CompatibleUnion({selector: type})&lt;&#x2F;code&gt; has properties &lt;code&gt;value.data&lt;&#x2F;code&gt; with the contained value, and &lt;code&gt;value.selector&lt;&#x2F;code&gt; which indexes the selected type option.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;to_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;little&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; serialize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;deserialization&quot;&gt;Deserialization&lt;&#x2F;h4&gt;
&lt;p&gt;The deserialization logic is updated:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;In the case of compatible unions, the first byte of the deserialization scope is deserialized as type selector, the remainder of the scope is deserialized as the selected type.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The following invalid input needs to be hardened against:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;An out-of-bounds type selector in a &lt;code&gt;CompatibleUnion&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Incomplete data (less than 1 byte for selector)&lt;&#x2F;li&gt;
&lt;li&gt;Corrupted or malformed serialized data&lt;&#x2F;li&gt;
&lt;li&gt;Invalid serialization of inner types (delegated to inner type deserialization)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;json-mapping&quot;&gt;JSON mapping&lt;&#x2F;h4&gt;
&lt;p&gt;The canonical &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;ad36024441cf910d428d03f87f331fbbd2b3e5f1&#x2F;ssz&#x2F;simple-serialize.md#json-mapping&quot;&gt;JSON mapping&lt;&#x2F;a&gt; is updated:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;SSZ&lt;&#x2F;th&gt;&lt;th&gt;JSON&lt;&#x2F;th&gt;&lt;th&gt;Example&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CompatibleUnion({selector: type})&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;selector-object&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;{ &quot;selector&quot;: string, &quot;data&quot;: type }&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;&lt;code&gt;CompatibleUnion&lt;&#x2F;code&gt; is encoded as an object with a &lt;code&gt;selector&lt;&#x2F;code&gt; and &lt;code&gt;data&lt;&#x2F;code&gt; field, where the contents of &lt;code&gt;data&lt;&#x2F;code&gt; change according to the selector.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;merkleization&quot;&gt;Merkleization&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;ad36024441cf910d428d03f87f331fbbd2b3e5f1&#x2F;ssz&#x2F;simple-serialize.md#merkleization&quot;&gt;SSZ Merkleization specification&lt;&#x2F;a&gt; is extended with a helper function:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;mix_in_selector&lt;&#x2F;code&gt;: Given a Merkle root &lt;code&gt;root&lt;&#x2F;code&gt; and a type selector &lt;code&gt;selector&lt;&#x2F;code&gt; (&lt;code&gt;&quot;uint8&quot;&lt;&#x2F;code&gt; serialization) return &lt;code&gt;hash(root, selector)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The Merkleization definitions are extended.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;mix_in_selector(hash_tree_root(value.data), value.selector)&lt;&#x2F;code&gt; if &lt;code&gt;value&lt;&#x2F;code&gt; is of compatible union type.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-are-compatibleunion-selectors-limited-to-1-127&quot;&gt;Why are &lt;code&gt;CompatibleUnion&lt;&#x2F;code&gt; selectors limited to &lt;code&gt;1 ... 127&lt;&#x2F;code&gt;?&lt;&#x2F;h3&gt;
&lt;p&gt;Reserving &lt;code&gt;0&lt;&#x2F;code&gt; prevents issues with incomplete initialization, and can possibly be used in a future EIP to denote optionality.&lt;&#x2F;p&gt;
&lt;p&gt;Reserving selectors above &lt;code&gt;127&lt;&#x2F;code&gt; (i.e., highest bit is set) enables future backwards compatible extensions.&lt;&#x2F;p&gt;
&lt;p&gt;The range &lt;code&gt;1 ... 127&lt;&#x2F;code&gt; is sufficient to satisfy current demand.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-not-field-collections&quot;&gt;Why not field collections?&lt;&#x2F;h3&gt;
&lt;p&gt;An alternative design was explored where the &lt;code&gt;active_fields&lt;&#x2F;code&gt; bitvector was emitted. While that works in principle, it becomes very inefficient to parse when &lt;code&gt;ProgressiveContainer&lt;&#x2F;code&gt; are nested, as the parser cannot immediately determine the overall tree shape. Further, the bitvector makes every single nesting layer variable-length, adding a lot of overhead to the serialized format.&lt;&#x2F;p&gt;
&lt;p&gt;With &lt;code&gt;CompatibleUnion&lt;&#x2F;code&gt;, a tag is emitted that tells the parser early on what to expect, including for nested fields.&lt;&#x2F;p&gt;
&lt;p&gt;Note that wrapping a field in a &lt;code&gt;CompatibleUnion&lt;&#x2F;code&gt; is not a backwards compatible operation. However, new options can be introduced, and existing options dropped, without breaking verifiers. Therefore, &lt;code&gt;CompatibleUnion&lt;&#x2F;code&gt; has to be introduced early on wherever future design extensions are anticipated, even when only a single type option is used.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;CompatibleUnion({selector: type})&lt;&#x2F;code&gt; is an alternative to an &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;ad36024441cf910d428d03f87f331fbbd2b3e5f1&#x2F;ssz&#x2F;simple-serialize.md#composite-types&quot;&gt;earlier union proposal&lt;&#x2F;a&gt;. However, it has only been used in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;ad36024441cf910d428d03f87f331fbbd2b3e5f1&#x2F;specs&#x2F;_deprecated&#x2F;sharding&#x2F;beacon-chain.md&quot;&gt;deprecated specifications&lt;&#x2F;a&gt;. Portal network also uses a union concept for network types, but does not use &lt;code&gt;hash_tree_root&lt;&#x2F;code&gt; on them, and could transition to the new compatible union proposal with a new networking version.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ethereum&#x2F;remerkleable&lt;&#x2F;code&gt; contains static tests in &lt;code&gt;test_impl.py&lt;&#x2F;code&gt; and &lt;code&gt;test_typing.py&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ethereum&#x2F;consensus-specs&lt;&#x2F;code&gt; releases contain random tests in &lt;code&gt;tests&#x2F;general&#x2F;phase0&#x2F;ssz_generic&lt;&#x2F;code&gt;, generated according to a format defined in &lt;code&gt;tests&#x2F;format&#x2F;ssz_generic&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;See &lt;code&gt;ethereum&#x2F;remerkleable&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;For &lt;code&gt;CompatibleUnion({selector: type})&lt;&#x2F;code&gt;, the &lt;code&gt;selector&lt;&#x2F;code&gt; mix-in guarantees a unique &lt;code&gt;hash_tree_root&lt;&#x2F;code&gt; if multiple type options refer to the same Merkle tree shape, or also if multiple type options solely differ in the element type of a &lt;code&gt;List[type, N]&lt;&#x2F;code&gt; or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7916&#x2F;&quot;&gt;&lt;code&gt;ProgressiveList[type]&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; field (as the &lt;code&gt;hash_tree_root&lt;&#x2F;code&gt; of any empty list does not depend on the &lt;code&gt;type&lt;&#x2F;code&gt;). Without the &lt;code&gt;selector&lt;&#x2F;code&gt;, such cases would either have to be defined as illegal types, or handled by the application logic (e.g., by mixing it into the signing root, or by encoding the element type into a different field).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Multidimensional Gas Metering</title>
        <published>2025-08-22T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Maria Silva</name><uri>https://github.com/misilva73</uri>
	</author>
	
	<author>
		<name>Davide Crapis</name><uri>https://github.com/dcrapis</uri>
	</author>
	
	<author>
		<name>Anders Elowsson</name><uri>https://github.com/anderselowsson</uri>
	</author>
	
	<author>
		<name>Toni Wahrstätter</name><uri>https://github.com/nerolation</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8011/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8011-multidimensional-gas-metering/25260" />
        

        <id>https://wg-eips.ritovision.com/8011/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:8011"
            label="EIP-8011" />
        

        
        

        
        <summary type="html">Gas accounting by EVM resource, increasing throughput and improving resource usage controls, with minimal changes to the protocol and UX</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8011/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal introduces multidimensional gas metering, changing the way we account for gas used at the block level. This enables Ethereum to increase throughput and better control excessive resource usage, with minimal changes to the protocol and the UX. During transaction execution, gas is metered for each resource dimension, such as compute and state. At the transaction level, everything remains unchanged. A transaction still pays fees according to the sum of gas used across all resources and still has a single gas limit imposed on this same sum. However, at the block level, only the gas used in the bottleneck resource is considered when checking if the block is full and when updating the base fee for the next block. This gives a new meaning to the block&#x27;s gas limit and the block&#x27;s gas target, which now corresponds to the maximum gas that can be metered in the bottleneck resource.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal separates &lt;em&gt;transaction pricing&lt;&#x2F;em&gt; (i.e., the way of measuring consumption of resources by transactions) from &lt;em&gt;block metering&lt;&#x2F;em&gt; (i.e., the way of controlling resource limits and ensure that blocks do not overload the network). More concretely, it introduces a multidimensional metering scheme that accounts for the different EVM resources while keeping the pricing model unchanged.&lt;&#x2F;p&gt;
&lt;p&gt;There are four main benefits of the proposal:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Throughput gains: By decoupling resource limits, blocks can carry transactions that stress distinct resources simultaneously, improving packing efficiency.&lt;&#x2F;li&gt;
&lt;li&gt;Finer-grained control over excessive resource usage: metering gas costs independently for each resource allows us to tailor each operation&#x27;s gas cost to the actual resource limits.&lt;&#x2F;li&gt;
&lt;li&gt;Keeps UX identical: users still specify one &lt;code&gt;gas_limit&lt;&#x2F;code&gt; and see one &lt;code&gt;gas_used&lt;&#x2F;code&gt; value.&lt;&#x2F;li&gt;
&lt;li&gt;Simplicity: This simpler metering change lays the groundwork for eventual multidimensional pricing  (such as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7999&#x2F;&quot;&gt;EIP-7999&lt;&#x2F;a&gt;) without disrupting the current fee market and with minimal protocol changes.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;operation-gas-costs&quot;&gt;Operation gas costs&lt;&#x2F;h3&gt;
&lt;p&gt;Under the multidimensional metering model, EVM operations are assigned a cost vector whose components correspond to their gas cost on each resource dimension. Each cost has 6 dimensions: &lt;code&gt;gas_cost_vector = (compute_cost, access_cost, size_cost, memory_cost, state_cost, history_cost)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;pure-compute-operations&quot;&gt;Pure compute operations&lt;&#x2F;h4&gt;
&lt;p&gt;The operations listed in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8011&#x2F;assets&#x2F;compute_ops&#x2F;&quot;&gt;compute_ops&lt;&#x2F;a&gt; are assigned a &lt;code&gt;gas_cost_vector&lt;&#x2F;code&gt; equal to &lt;code&gt;(gas_cost, 0, 0, 0, 0, 0)&lt;&#x2F;code&gt;, where &lt;code&gt;gas_cost&lt;&#x2F;code&gt; is the operation&#x27;s gas cost.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;compute-and-memory-operations&quot;&gt;Compute and memory operations&lt;&#x2F;h4&gt;
&lt;p&gt;The operations listed in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8011&#x2F;assets&#x2F;compute_mem_ops&#x2F;&quot;&gt;compute_mem_ops&lt;&#x2F;a&gt; are assigned a &lt;code&gt;gas_cost_vector&lt;&#x2F;code&gt; equal to &lt;code&gt;(compute_cost, 0, 0, memory_cost, 0, 0)&lt;&#x2F;code&gt;, where &lt;code&gt;memory_cost&lt;&#x2F;code&gt; is the operation&#x27;s memory expansion cost (as defined by the function &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;execution-specs&#x2F;blob&#x2F;91824145ef62da61803edf9a764fd8f3662794c0&#x2F;src&#x2F;ethereum&#x2F;osaka&#x2F;vm&#x2F;gas.py#L167&quot;&gt;&lt;code&gt;calculate_gas_extend_memory&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;) and &lt;code&gt;compute_cost&lt;&#x2F;code&gt; is the operation&#x27;s gas cost minus its memory expansion cost.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;state-operations&quot;&gt;State operations&lt;&#x2F;h4&gt;
&lt;p&gt;The assignment of a &lt;code&gt;gas_cost_vector&lt;&#x2F;code&gt; to the operations listed in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8011&#x2F;assets&#x2F;state_ops&#x2F;&quot;&gt;state_ops&lt;&#x2F;a&gt; is TBD, pending benchmarks.
&amp;lt;-- TODO --&amp;gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;log-operations&quot;&gt;LOG operations&lt;&#x2F;h4&gt;
&lt;p&gt;The assignment of a &lt;code&gt;gas_cost_vector&lt;&#x2F;code&gt; to the operations listed in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8011&#x2F;assets&#x2F;log_ops&#x2F;&quot;&gt;log_ops&lt;&#x2F;a&gt; is TBD, pending benchmarks.
&amp;lt;-- TODO --&amp;gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;intrinsic-gas-costs&quot;&gt;Intrinsic gas costs&lt;&#x2F;h3&gt;
&lt;p&gt;Under the multidimensional metering model, each transaction&#x27;s intrinsic cost (as defined by the function &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;execution-specs&#x2F;blob&#x2F;91824145ef62da61803edf9a764fd8f3662794c0&#x2F;src&#x2F;ethereum&#x2F;osaka&#x2F;transactions.py#L571&quot;&gt;&lt;code&gt;calculate_intrinsic_cost&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;) is also assigned 6-dimensional &lt;code&gt;gas_cost_vector&lt;&#x2F;code&gt;. The breakdown of cost by resource dimension is TBD, pending benchmarks.&lt;&#x2F;p&gt;
&lt;p&gt;&amp;lt;-- TODO --&amp;gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-accounting&quot;&gt;Gas accounting&lt;&#x2F;h3&gt;
&lt;p&gt;Besides replacing the single gas cost with a 6-dimensional cost vector, the gas accounting during block execution also changes. Instead of keeping track of a single total of gas used, the EVM stores a 6-dimensional vector with how much gas units was spent on each resource until that point in the execution.&lt;&#x2F;p&gt;
&lt;p&gt;After executing the ith EVM operation of a transaction, say &lt;code&gt;OP_i&lt;&#x2F;code&gt;, with a cost vector &lt;code&gt;gas_cost_vector_i = (compute_cost_i, access_cost_i, size_cost_i, memory_cost_i, state_cost_i, history_cost_i)&lt;&#x2F;code&gt;, the following variables are updated:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Remaining available gas for the transaction:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;gas = gas - sum(compute_cost_i, access_cost_i, size_cost_i, memory_cost_i, state_cost_i, history_cost_i)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Total used gas by the transaction so far:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;gas_used = gas_used + sum(compute_cost_i, access_cost_i, size_cost_i, memory_cost_i, state_cost_i, history_cost_i)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Used gas vector by the transaction so far:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;gas_used_vector = (compute_gas_used + compute_cost_i, access_gas_used + access_cost_i, size_gas_used + size_cost_i, memory_gas_used + memory_cost_i, state_gas_used + state_cost_i, history_gas_used + history_cost_i)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;At the transaction level, everything remains the same. A transaction still has the same one-dimensional &lt;code&gt;gas_limit&lt;&#x2F;code&gt;. The transaction&#x27;s out-of-gas condition is still defined as &lt;code&gt;gas_used &amp;lt;= gas_limit&lt;&#x2F;code&gt;. Additionally, the transaction&#x27;s fee is also computed with &lt;code&gt;gas_used&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The key change is the introduction of &lt;code&gt;gas_used_vector&lt;&#x2F;code&gt; as a new variable that tracks the gas used by each resource at the transaction level. This variable is returned by the &lt;code&gt;execute_transaction&lt;&#x2F;code&gt; function, in addition to &lt;code&gt;gas_used&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; execute_transaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; NormalizedTransaction&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; effective_gas_price&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; tuple&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; list&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; pass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;block-header-extension&quot;&gt;Block header extension&lt;&#x2F;h3&gt;
&lt;p&gt;The current header encoding is extended with a new 64-bit unsigned integer field named &lt;code&gt;max_gas_metered&lt;&#x2F;code&gt;. This integer corresponds to the total gas units used by the bottleneck resource, i.e., the resource with the largest used gas in the block. This variable is computed as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; compute_block_max_gas_metered&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    transactions&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;transactions&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block_gas_used_vector&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; array&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; transactions&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        gas_used&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; gas_used_vector&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;execute_transaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;transaction&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; effective_gas_price&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        block_gas_used_vector&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; gas_used_vector&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_gas_metered&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block_gas_used_vector&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; max_gas_metered&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The header sequence with the new field is &lt;code&gt;[..., parent_beacon_block_root, requests_hash, max_gas_metered]&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;block-validity-condition&quot;&gt;Block validity condition&lt;&#x2F;h3&gt;
&lt;p&gt;The block validity conditions are modified to replace &lt;code&gt;block.gas_used&lt;&#x2F;code&gt; with &lt;code&gt;block.max_gas_metered&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_gas_metered&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;invalid block: too much gas used&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;base-fee-update-rule&quot;&gt;Base fee update rule&lt;&#x2F;h3&gt;
&lt;p&gt;The block validity conditions are modified to replace &lt;code&gt;parent.gas_used&lt;&#x2F;code&gt; with &lt;code&gt;parent.max_gas_metered&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gas_used_delta&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_gas_metered&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_target&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This change is compatible with the various transaction variants, such as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt;,  or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7999&#x2F;&quot;&gt;EIP-7999&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-are-we-choosing-this-resource-split&quot;&gt;Why are we choosing this resource split?&lt;&#x2F;h3&gt;
&lt;p&gt;Ethereum’s slot-based structure introduces a strict temporal constraint: all attestations must be processed, aggregated, and propagated within a single slot. This fact makes time a fundamental resource. To maintain network health, validators must execute blocks, validate them, and gossip attestations quickly enough to avoid missed slots and penalties.&lt;&#x2F;p&gt;
&lt;p&gt;Each type of resource contributes differently to this bottleneck:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Execution time affects how quickly validators can process blocks and produce attestations.&lt;&#x2F;li&gt;
&lt;li&gt;Data size influences how long it takes to propagate blocks and blobs across the peer-to-peer network.&lt;&#x2F;li&gt;
&lt;li&gt;Memory usage determines how efficiently nodes can handle concurrent workloads without triggering garbage collection or cache eviction. It also affects the minimum hardware requirements that proposers and attesters must meet to fulfill their responsibilities.&lt;&#x2F;li&gt;
&lt;li&gt;State growth impacts long-term scalability and database performance, especially for archival and full nodes.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In addition, changes in the slot (e.g., Enshrined Proposer-Builder Separation) and changes in the execution model (e.g., Block-level Access Lists) will change how the different resources interact and how they impact the available slot time. Thus, we want to track as many relevant resources as possible in order to allow for future changes to the protocol that may impact resource contribution.&lt;&#x2F;p&gt;
&lt;p&gt;For these reasons, the proposal splits the resources into the following broad categories:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Block Execution Time&lt;&#x2F;strong&gt;: Captures how long it takes to process a block on a single node. This includes:
&lt;ul&gt;
&lt;li&gt;Compute: CPU time spent on each operation.&lt;&#x2F;li&gt;
&lt;li&gt;State Access: Time or count of disk I&#x2F;O operations when accessing the trie (e.g., &lt;code&gt;SLOAD&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;SSTORE&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Block Upload&#x2F;Download Time&lt;&#x2F;strong&gt;: Captures how data size affects network transmission:
&lt;ul&gt;
&lt;li&gt;Block size (call data + transaction &amp;amp; block metadata)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Short-term Memory&lt;&#x2F;strong&gt;: Reflects short-term memory allocation during execution, i.e., RAM usage&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Long-term Storage&lt;&#x2F;strong&gt;: Tracks persistent changes to disk usage. There are two dimensions here:
&lt;ul&gt;
&lt;li&gt;State Growth: Delta in disk size of the state trie before and after execution.&lt;&#x2F;li&gt;
&lt;li&gt;History Growth: Delta in disk space used for historical receipts, logs, etc.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Note that we are not considering the blob resource (which is part of the Block Upload&#x2F;Download Time) as it is already priced independently.&lt;&#x2F;p&gt;
&lt;p&gt;Based on previous empirical analysis, state growth represented a significant portion of the gas used in Ethereum blocks, accounting for 30.2% of all gas consumed between blocks 22000000 and 22005000. The second resource with the most gas used was compute (26.8%), followed by state access (21.9%). History growth and data had a less relevant contribution, accounting for 9.9% and 6.9% of all the gas used, respectively. Note that the data component in this analysis did not consider blobs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change is not backwards-compatible and requires a hard fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;worst-case-blocks-and-excessive-resource-usage&quot;&gt;Worst-case blocks and excessive resource usage&lt;&#x2F;h3&gt;
&lt;p&gt;A concern about metering resources independently is the potential of creating worst-case blocks that put too much pressure on EVM resources. Thus, the cost vectors of each EVM operation need to be carefully set up to avoid this scenario. To this end, we will perform comprehensive benchmarks to measure the resource utilization of each operation and set the gas cost vector accordingly.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, state and history growth are not constrained at the block level, but over longer time frames. Increased aggregate gas usage from this proposal may be associated with increase state-growth, assuming that relative gas consumption across resources is not altered significantly under equilibrium. To keep the long-run consumption in check, the gas cost of operations contributing to state and history growth would thus need to be increased.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;base-fee-manipulation&quot;&gt;Base fee manipulation&lt;&#x2F;h3&gt;
&lt;p&gt;Builders can manipulate the base fee by selectively including or excluding transactions to change the block&#x27;s &lt;code&gt;max_gas_metered&lt;&#x2F;code&gt;. This behavior is already possible with EIP-1559. Yet, multidimensional gas metering compute the base fee on the bottleneck resource instead of the total gas consumed. This allows for blocks that yield the same total fees but with different &lt;code&gt;max_gas_metered&lt;&#x2F;code&gt; values. The extent of this concern is limited by the incentives to maximize fee revenue. While the expected gains of base fee manipulation are smaller than execution rewards, we won&#x27;t observe these attacks.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;added-complexity-in-block-building&quot;&gt;Added complexity in block building&lt;&#x2F;h3&gt;
&lt;p&gt;Optimal block construction becomes more complex, since builders must now balance resource usage across multiple dimensions rather than a single gas metric. Sophisticated builders may gain an advantage by applying advanced optimization techniques, raising concerns about further builder centralization. However, practical heuristics (e.g., greedily filling blocks until one resource dimension saturates) remain effective for most use cases. These heuristics limit centralization pressure by keeping block construction feasible for local and less sophisticated builders.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;censorship-resistance&quot;&gt;Censorship resistance&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP makes it cheaper to fill the block to censor transactions under FOCIL in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7805&#x2F;&quot;&gt;EIP-7805&lt;&#x2F;a&gt; (as also noted in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7999&#x2F;&quot;&gt;EIP-7999&lt;&#x2F;a&gt;). Specifically, it can be cheaper for a builder to create dummy transaction consuming only one resource to fill the block, taking advantage of the lower base fee under equilibrium. However, given that all resources have the same base fee in this proposal, and that the builder must still fill the block up to the gas limit for at least one resource, the degradation in censorship resistance is fairly moderate, and mainly related to the potentially reduced base fee under equilibrium.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Generalized consolidation requests</title>
        <published>2025-08-22T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Potuz</name><uri>https://github.com/potuz</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8012/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8012-generalized-consolidation-requests/25264" />
        

        <id>https://wg-eips.ritovision.com/8012/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:8012"
            label="EIP-8012" />
        

        
        

        
        <summary type="html">Reutilizes the consolidation request contract to pass general messages from the EL to the CL.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8012/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP redefines the field &lt;code&gt;target_pubkey&lt;&#x2F;code&gt; from consolidations requests into a general array of 48 bytes that can be interpreted separately by the consensus layer.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The current contract to send consolidation requests is not optimized in that the exact same contract, with the exact same calldata and engine API, can be used to transmit more general messages from the EL to the CL without changes on the EL side. In particular, avoiding any cross layer coordination in the event of an CL hard fork.&lt;&#x2F;p&gt;
&lt;p&gt;As a possible application, we could use the same contract to allow any existing validator to become a builder as in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7732&#x2F;&quot;&gt;EIP-7732&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;consensus-layer&quot;&gt;Consensus Layer&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;NAME&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Comment&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAGIC_PREFIX&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xEF0A11&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3 byte prefix to all generalized consolidation requests&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;execution-layer&quot;&gt;Execution Layer&lt;&#x2F;h3&gt;
&lt;p&gt;No changes are expected&lt;&#x2F;p&gt;
&lt;h3 id=&quot;consensus-layer-1&quot;&gt;Consensus Layer&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP does not establish any changes on the consensus layer, but rather standardizes how consolidation requests are to be treated in the future. When receiving a &lt;code&gt;ConsolidationRequest&lt;&#x2F;code&gt; type object on the consensus layer, the &lt;code&gt;target_pubkey&lt;&#x2F;code&gt; field is to be treated differently. If it coincides with the BLS publick key of an existing active validator in the beacon chain, then it is to be interpreted as such. Otherwise, the 48 bytes are to be interpreted as a concatenation of the following fields&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|MAGIC_PREFIX | CALL_TYPE | ARG_NUMBER | ARG1 | ARG2 | ARG3 | ARG4 | ARG5 |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Where &lt;code&gt;MAGIC_PREFIX&lt;&#x2F;code&gt; is the 3 byte constant that prefixes all generalized consolidation requests. &lt;code&gt;CALL_TYPE&lt;&#x2F;code&gt; are 4 bytes to be interpretted as a little Endian &lt;code&gt;uint32&lt;&#x2F;code&gt; and identifies the function type. &lt;code&gt;ARG_NUMBER&lt;&#x2F;code&gt; is a 1 byte to be interpretted as a &lt;code&gt;uint8&lt;&#x2F;code&gt; that encodes the number of arguments that are being passed to the generalized consolidation request handler. And each &lt;code&gt;ARG1, ARG2, ARG3, ARG4, ARG5&lt;&#x2F;code&gt; are all interpretted as little Endian &lt;code&gt;uint64&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;For each addition of a new &lt;code&gt;CALL_TYPE&lt;&#x2F;code&gt;, the consensus layer must add a handler appropriately called from within &lt;code&gt;process_consolidation_requests&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;engine-api&quot;&gt;Engine API&lt;&#x2F;h3&gt;
&lt;p&gt;No changes needed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The proposed reinterpretation of the existing contract enables new implementations in the consensus layer without requireing a hard fork in the execution layer.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is fully backwards compatible.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;No known security impacts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Remove `deposit` and `eth1data` fields</title>
        <published>2025-08-22T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Terence</name><uri>https://github.com/terencechain</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8015/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8015-remove-legacy-deposit-and-eth1data-fields/25401" />
        

        <id>https://wg-eips.ritovision.com/8015/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:8015"
            label="EIP-8015" />
        

        
        

        
        <summary type="html">Remove legacy `deposits` and `eth1_data` fields from `BeaconBlockBody` after EIP-6110 finalization</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8015/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP removes the legacy &lt;code&gt;deposits&lt;&#x2F;code&gt; and &lt;code&gt;eth1_data&lt;&#x2F;code&gt; fields from the &lt;code&gt;BeaconBlockBody&lt;&#x2F;code&gt; structure after &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6110&#x2F;&quot;&gt;EIP-6110&lt;&#x2F;a&gt; has been fully finalized. These fields become obsolete once all validators have transitioned to the new in-protocol deposit processing mechanism introduced in EIP-6110.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;EIP-6110 introduced in-protocol deposit processing by moving validator deposits to the execution layer as part of the EIP-7685 request framework. This change eliminated the need for the consensus layer&#x27;s proposer voting mechanism for deposits. However, during the transition period, both the legacy deposit mechanism (using &lt;code&gt;deposits&lt;&#x2F;code&gt; and &lt;code&gt;eth1_data&lt;&#x2F;code&gt; fields) and the new mechanism coexist to ensure smooth migration.&lt;&#x2F;p&gt;
&lt;p&gt;Once EIP-6110 has been fully finalized and the transition period is complete (when &lt;code&gt;state.eth1_deposit_index == state.deposit_requests_start_index&lt;&#x2F;code&gt;), the legacy deposit fields become permanently unused and can be safely removed. This cleanup provides several benefits:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Simplified validation&lt;&#x2F;strong&gt;: Removes deprecated validation logic and code paths&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Improved maintainability&lt;&#x2F;strong&gt;: Eliminates technical debt from the transition period&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc2119&quot;&gt;RFC 2119&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc8174&quot;&gt;RFC 8174&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;consensus-layer&quot;&gt;Consensus Layer&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;activation-conditions&quot;&gt;Activation Conditions&lt;&#x2F;h4&gt;
&lt;p&gt;This EIP SHALL only be activated when both of the following conditions are met:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;EIP-6110 has been fully finalized: &lt;code&gt;state.eth1_deposit_index == state.deposit_requests_start_index&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;EIP-7732 is in effect&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h4 id=&quot;beaconblockbody-modifications&quot;&gt;BeaconBlockBody Modifications&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;BeaconBlockBody&lt;&#x2F;code&gt; container is modified to remove the following fields:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Removed fields:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;deposits: List[Deposit, MAX_DEPOSITS]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;eth1_data: Eth1Data&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The updated &lt;code&gt;BeaconBlockBody&lt;&#x2F;code&gt; structure becomes:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BeaconBlockBody&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    randao_reveal&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BLSSignature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    graffiti&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    proposer_slashings&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;ProposerSlashing&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_PROPOSER_SLASHINGS&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    attester_slashings&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;AttesterSlashing&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_ATTESTER_SLASHINGS_ELECTRA&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    attestations&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Attestation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_ATTESTATIONS_ELECTRA&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    voluntary_exits&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;SignedVoluntaryExit&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_VOLUNTARY_EXITS&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sync_aggregate&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; SyncAggregate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bls_to_execution_changes&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;SignedBLSToExecutionChange&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_BLS_TO_EXECUTION_CHANGES&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; From EIP-7732&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signed_execution_payload_header&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; SignedExecutionPayloadHeader&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_attestations&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;PayloadAttestation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_PAYLOAD_ATTESTATIONS&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;validation-changes&quot;&gt;Validation Changes&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;Block processing modifications:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Remove &lt;code&gt;process_eth1_data()&lt;&#x2F;code&gt; function calls from block processing&lt;&#x2F;li&gt;
&lt;li&gt;Remove &lt;code&gt;process_deposits()&lt;&#x2F;code&gt; function calls from block processing&lt;&#x2F;li&gt;
&lt;li&gt;Remove eth1_data voting validation logic&lt;&#x2F;li&gt;
&lt;li&gt;Remove legacy deposit validation logic&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;strong&gt;State transition modifications:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Remove eth1_data related fields from state transition functions&lt;&#x2F;li&gt;
&lt;li&gt;Remove legacy deposit processing from &lt;code&gt;process_operations()&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h4 id=&quot;beaconstate-cleanup&quot;&gt;BeaconState Cleanup&lt;&#x2F;h4&gt;
&lt;p&gt;The following fields become unused after activation and MAY be removed in future updates:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;eth1_data: Eth1Data&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;eth1_data_votes: List[Eth1Data, EPOCHS_PER_ETH1_VOTING_PERIOD * SLOTS_PER_EPOCH]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;eth1_deposit_index: uint64&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note: These fields are kept for historical state root verification but are no longer actively used.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;timing-of-removal&quot;&gt;Timing of Removal&lt;&#x2F;h3&gt;
&lt;p&gt;The fields are removed after EIP-6110 finalization to ensure:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;All pending deposits from the legacy system have been processed&lt;&#x2F;li&gt;
&lt;li&gt;No validator can be affected by the removal&lt;&#x2F;li&gt;
&lt;li&gt;The transition is complete and irreversible&lt;&#x2F;li&gt;
&lt;li&gt;State consistency is maintained across all honest nodes&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;dependency-on-eip-7732&quot;&gt;Dependency on EIP-7732&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP requires EIP-7732 because:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;EIP-7732 already modified the &lt;code&gt;BeaconBlockBody&lt;&#x2F;code&gt; structure significantly&lt;&#x2F;li&gt;
&lt;li&gt;It provides the architectural foundation for simplified block bodies&lt;&#x2F;li&gt;
&lt;li&gt;The timing aligns with the broader consensus layer improvements&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The removal of legacy fields poses minimal security risk because:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The fields are already unused after EIP-6110 finalization&lt;&#x2F;li&gt;
&lt;li&gt;All deposits are processed through the new EIP-6110 mechanism&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Static relative jumps and calls for the EVM</title>
        <published>2025-08-19T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Greg Colvin</name><uri>https://github.com/gcolvin</uri>
	</author>
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	<author>
		<name>Andrei Maiboroda</name><uri>https://github.com/gumb0</uri>
	</author>
	
	<author>
		<name>Paweł Bylica</name><uri>https://github.com/chfast</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8013/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8013-static-relative-jumps-and-calls-for-the-evm/25222" />
        

        <id>https://wg-eips.ritovision.com/8013/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:8013"
            label="EIP-8013" />
        

        
        

        
        <summary type="html">Relative jump and call instructions with a signed immediate encoding the jump destination</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8013/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Five new EVM jump instructions are introduced (&lt;code&gt;RJUMP&lt;&#x2F;code&gt;, &lt;code&gt;RJUMPI&lt;&#x2F;code&gt;, &lt;code&gt;RJUMPV&lt;&#x2F;code&gt;, &lt;code&gt;RJUMPSUB&lt;&#x2F;code&gt;, and &lt;code&gt;RJUMPSUBV&lt;&#x2F;code&gt;) which encode destinations as signed immediate values. These can be useful in almost all &lt;code&gt;JUMP&lt;&#x2F;code&gt; and &lt;code&gt;JUMPI&lt;&#x2F;code&gt; use cases and offer improvements in cost, performance, and static analysis.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;A recurring discussion topic is that the EVM only has a mechanism for dynamic jumps. They provide a very flexible architecture with only 2 (!) instructions. This flexibility comes at a cost however: it makes analysis of code more complicated, often intractable, and it also (partially) resulted in the need to have the &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; marker.&lt;&#x2F;p&gt;
&lt;p&gt;In a great many cases control flow is actually static and there is no need for any dynamic behaviour, though not every use case can be solved by static jumps.&lt;&#x2F;p&gt;
&lt;p&gt;There are various ways to reduce the need for dynamic jumps, some examples:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;With native support for functions &#x2F; subroutines&lt;&#x2F;li&gt;
&lt;li&gt;A &quot;return to caller&quot; instruction -- a form of subroutine return&lt;&#x2F;li&gt;
&lt;li&gt;A &quot;switch-case&quot; table with dynamic indexing&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;This proposal introduces a minimal feature set - including the above - to allow compilers to use &lt;code&gt;RJUMP&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPSUB&lt;&#x2F;code&gt; exclusively.&lt;&#x2F;p&gt;
&lt;p&gt;This functionality does not preclude the EVM from introducing other forms of control flow later on. &lt;code&gt;RJUMP&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt; can efficiently co-exists with a higher-level declaration of functions, where static relative jumps should be used for intra-function control flow.  This functionality also does not preclude the use of legacy code.&lt;&#x2F;p&gt;
&lt;p&gt;The main benefit of these instruction is reduced gas cost (both at deploy and execution time), better performance and better static analysis properties.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;We introduce five new instructions, each taking either a two-byte relative offset or else a table of offsets as immediate arguments.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;relative jump:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;RJUMP (0xe0) relative_offset&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;sets the &lt;code&gt;PC&lt;&#x2F;code&gt; to &lt;code&gt;PC_post_instruction + relative_offset&lt;&#x2F;code&gt;, where&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;relative_offset&lt;&#x2F;code&gt; is encoded as a 16-bit &lt;strong&gt;signed&lt;&#x2F;strong&gt; (two&#x27;s-complement) big-endian value.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;conditional relative jump:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;RJUMPI (0xe1) relative_offset&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;pops a value (&lt;code&gt;condition&lt;&#x2F;code&gt;) from the stack, and&lt;&#x2F;li&gt;
&lt;li&gt;sets the &lt;code&gt;PC&lt;&#x2F;code&gt; to &lt;code&gt;PC_post_instruction + ((condition == 0) ? 0 : relative_offset)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;relative jump via jump table:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;RJUMPV (0xe2) max_index relative_offset+&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;pops a value (&lt;code&gt;case&lt;&#x2F;code&gt;) from the stack, and&lt;&#x2F;li&gt;
&lt;li&gt;sets the &lt;code&gt;PC&lt;&#x2F;code&gt; to &lt;code&gt;PC_post_instruction + ((case &amp;gt; max_index) ? 0 : relative_offset[case])&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;relative jump to subroutine:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;RJUMPSUB (0xe3) relative_offset&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;pushes &lt;code&gt;PC_post_instruction&lt;&#x2F;code&gt; to the &lt;code&gt;return stack,&lt;&#x2F;code&gt; and&lt;&#x2F;li&gt;
&lt;li&gt;sets the &lt;code&gt;PC&lt;&#x2F;code&gt; to &lt;code&gt;PC_post_instruction + relative_offset&lt;&#x2F;code&gt;, an &lt;code&gt;ENTERSUB&lt;&#x2F;code&gt;, as if with &lt;code&gt;CALLSUB&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;relative jump to subroutine via jump table:
&lt;ul&gt;
&lt;li&gt;`RJUMPSUBV (0xe4) max_index relative_offset+
&lt;ul&gt;
&lt;li&gt;pops a value (&lt;code&gt;case&lt;&#x2F;code&gt;) from the stack,&lt;&#x2F;li&gt;
&lt;li&gt;pushes &lt;code&gt;PC_post_instruction&lt;&#x2F;code&gt; to the &lt;code&gt;return stack&lt;&#x2F;code&gt;, and&lt;&#x2F;li&gt;
&lt;li&gt;sets the &lt;code&gt;PC&lt;&#x2F;code&gt; to &lt;code&gt;PC_post_instruction + ((case &amp;gt; max_index) ? 0 : relative_offset[case])&lt;&#x2F;code&gt;, an &lt;code&gt;ENTERSUB&lt;&#x2F;code&gt;, as if with &lt;code&gt;CALLSUB&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Note that the destination of the &lt;code&gt;RJUMPSUB&lt;&#x2F;code&gt; and &lt;code&gt;RJUMPSUBV&lt;&#x2F;code&gt; opcodes MUST be an &lt;code&gt;ENTERSUB&lt;&#x2F;code&gt; and control is returned to a calling &lt;code&gt;RJUMPSUB&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;RJUMPSUBV&lt;&#x2F;code&gt; via &lt;code&gt;RETURNSUB&lt;&#x2F;code&gt; (See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7979&#x2F;&quot;&gt;EIP-7979&lt;&#x2F;a&gt;) -- these two forms of jump provide immediate access to the underlying &quot;return-to-caller&quot; mechanism of the &lt;code&gt;CALLSUB&lt;&#x2F;code&gt; instruction.&lt;&#x2F;p&gt;
&lt;p&gt;The immediate argument &lt;code&gt;relative_offset&lt;&#x2F;code&gt; is encoded as a 16-bit &lt;strong&gt;signed&lt;&#x2F;strong&gt; (two&#x27;s-complement) big-endian value. Under &lt;code&gt;PC_post_instruction&lt;&#x2F;code&gt; we mean the &lt;code&gt;PC&lt;&#x2F;code&gt; position after the entire immediate value.&lt;&#x2F;p&gt;
&lt;p&gt;The immediate encoding of &lt;code&gt;RJUMPV&lt;&#x2F;code&gt; and &lt;code&gt;RjUMPSUBV&lt;&#x2F;code&gt; are more special: the unsigned 8-bit &lt;code&gt;max_index&lt;&#x2F;code&gt; value determines the maximum index in the jump table. The number of &lt;code&gt;relative_offset&lt;&#x2F;code&gt; values following is &lt;code&gt;max_index+1&lt;&#x2F;code&gt;. This allows table sizes up to 256. The encoding of &lt;code&gt;RJUMPV&lt;&#x2F;code&gt; must have at least one &lt;code&gt;relative_offset&lt;&#x2F;code&gt; and thus it will take at minimum 4 bytes. Furthermore, the &lt;code&gt;case &amp;gt; max_index&lt;&#x2F;code&gt; condition falling through means that in many use cases, one would place the &lt;em&gt;default&lt;&#x2F;em&gt; path following the &lt;code&gt;RJUMPV&lt;&#x2F;code&gt; instruction. An interesting feature is that &lt;code&gt;RJUMPV 0 relative_offset&lt;&#x2F;code&gt; is an inverted-&lt;code&gt;RJUMPI&lt;&#x2F;code&gt;, which can be used in many cases instead of &lt;code&gt;ISZERO RJUMPI relative_offset&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;We also extend the validation algorithm of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7979&#x2F;&quot;&gt;EIP-7979&lt;&#x2F;a&gt; to verify that every &lt;code&gt;RJUMP&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPSUB&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPSUBV&lt;&#x2F;code&gt; has a &lt;code&gt;relative_offset&lt;&#x2F;code&gt; pointing to an instruction. This means it cannot point to an immediate data of &lt;code&gt;PUSHn&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMP&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt; and cannot point outside of code bounds.  Further, &lt;em&gt;all and only&lt;&#x2F;em&gt; &lt;code&gt;RJUMPSUB&lt;&#x2F;code&gt; and &lt;code&gt;RJUMPSUBV&lt;&#x2F;code&gt; MUST have a &lt;code&gt;relative offset&lt;&#x2F;code&gt; pointing to an `ENTERSUB, whereas the others are allowed to point to a JUMPDEST, but are not required to.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;costs&quot;&gt;Costs&lt;&#x2F;h3&gt;
&lt;p&gt;The immediate destinations are checked during jumpdest analysis and need not be checked again, so the cost of these instructions can be less than their dynamic counterparts.  We recommend that&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;RJUMP&lt;&#x2F;code&gt; should be 2,&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt; and &lt;code&gt;RJUMPV&lt;&#x2F;code&gt; should be 4. and&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RJUMPSUB&lt;&#x2F;code&gt; and &lt;code&gt;RJUMPSUBV&lt;&#x2F;code&gt; should be 5.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;relative-addressing&quot;&gt;Relative addressing&lt;&#x2F;h3&gt;
&lt;p&gt;We chose relative addressing in order to support code which is relocatable. This also means a code snippet can be injected. A technique seen used prior to this EIP to achieve the same goal was to inject code like &lt;code&gt;PUSHn PC ADD JUMPI&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;We do not see any significant downside to relative addressing and it allows us to also deprecate the &lt;code&gt;PC&lt;&#x2F;code&gt; instruction.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;immediate-size&quot;&gt;Immediate size&lt;&#x2F;h3&gt;
&lt;p&gt;The signed 16-bit immediate means that the largest jump distance possible is 32767. In the case the bytecode at &lt;code&gt;PC=0&lt;&#x2F;code&gt; starts with an &lt;code&gt;RJUMP&lt;&#x2F;code&gt;, it will be possible to jump as far as &lt;code&gt;PC=32770&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Given &lt;code&gt;MAX_CODE_SIZE = 24576&lt;&#x2F;code&gt; (in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;170&#x2F;&quot;&gt;EIP-170&lt;&#x2F;a&gt;) and &lt;code&gt;MAX_INITCODE_SIZE = 49152&lt;&#x2F;code&gt; (in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3860&#x2F;&quot;&gt;EIP-3860&lt;&#x2F;a&gt;), we think the 16-bit immediate is large enough.&lt;&#x2F;p&gt;
&lt;p&gt;A version with an 8-bit immediate would only allow moving &lt;code&gt;PC&lt;&#x2F;code&gt; backward by 125 or forward by 127 bytes. While that seems to be a good enough distance for many for-loops, it is likely not good enough for cross-function jumps, and since the 16-bit immediate is the same size as what a dynamic jump would take in such cases (3 bytes: &lt;code&gt;JUMP PUSH1 n&lt;&#x2F;code&gt;), we think having less instructions is better.&lt;&#x2F;p&gt;
&lt;p&gt;Should there be a need to have immediate encodings of other size (such as 8-bits, 24-bits or 32-bits), it would be possible to introduce new opcodes, similarly to how multiple &lt;code&gt;PUSH&lt;&#x2F;code&gt; instructions exist.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;pushn-jump-sequences&quot;&gt;&lt;code&gt;PUSHn JUMP&lt;&#x2F;code&gt; sequences&lt;&#x2F;h3&gt;
&lt;p&gt;If we chose absolute addressing, then &lt;code&gt;RJUMP&lt;&#x2F;code&gt; could be viewed similar to the sequence &lt;code&gt;PUSHn JUMP&lt;&#x2F;code&gt; (and &lt;code&gt;RJUMPI&lt;&#x2F;code&gt; similar to &lt;code&gt;PUSHn JUMPI&lt;&#x2F;code&gt;). In that case one could argue that instead of introducing a new instruction, such sequences should get a discount, because EVMs could optimise them.&lt;&#x2F;p&gt;
&lt;p&gt;We think this is a bad direction to go, and we leave defining the semantics of existing &lt;code&gt;PUSHn JUMP&lt;&#x2F;code&gt; sequences to EIP-7979 and do not attempt to optimize their gas cost here.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;It further complicates the already complex rules of gas calculation.&lt;&#x2F;li&gt;
&lt;li&gt;And it either requires a consensus defined internal representation for EVM code, or forces EVM implementations to do optimisations on their own.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Both of these are risky. Furthermore we think that EVM implementations should be free to chose what optimisations they apply, and the savings do not need to be passed down at all cost.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally it requires a potentially significant change to the current implementations which depend on a streaming one-by-one execution without a lookahead.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;lack-of-jumpdest&quot;&gt;Lack of &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; serves two purposes:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;To efficiently partition code -- this can be useful for pre-calculating total gas usage for a given &lt;em&gt;block&lt;&#x2F;em&gt; (i.e. instructions between &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt;s), and for JIT&#x2F;AOT translation.&lt;&#x2F;li&gt;
&lt;li&gt;To explicitly show valid locations (otherwise any non-data location would be valid).&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;This functionality is not needed for static jumps, as the analysers can easily tell destinations from the static jump immediates during jumpdest-analysis.&lt;&#x2F;p&gt;
&lt;p&gt;There are two benefits here:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Not wasting a byte for a &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; also means a saving of 200 gas during deployment, for each jump destination.&lt;&#x2F;li&gt;
&lt;li&gt;Saving an extra 1 gas per jump during execution, given &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; itself cost 1 gas and is &quot;executed&quot; during jumping.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;rjumpv-and-rjumpsubv-fallback-cases&quot;&gt;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt; and &lt;code&gt;RJUMPSUBV&lt;&#x2F;code&gt; fallback cases&lt;&#x2F;h3&gt;
&lt;p&gt;If no match is found (i.e. the &lt;em&gt;default&lt;&#x2F;em&gt; case) in the &lt;code&gt;RJUMPV&lt;&#x2F;code&gt; or &lt;code&gt;RJUMPSUBV&lt;&#x2F;code&gt; instructions execution will continue without branching. This allows for gaps in the arguments to be filled with &lt;code&gt;0&lt;&#x2F;code&gt;s, and a choice of implementation by the programmer. Alternate options would include exceptional aborts in case of no match.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change poses no risk to backwards compatibility.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;validation&quot;&gt;Validation&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;valid-cases&quot;&gt;Valid cases&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;RJUMP&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt; with &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; as target
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;relative_offset&lt;&#x2F;code&gt; is positive&#x2F;negative&#x2F;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RJUMP&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt; with instruction other than &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; as target
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;relative_offset&lt;&#x2F;code&gt; is positive&#x2F;negative&#x2F;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;RJUMPSUBV&lt;&#x2F;code&gt; with various valid table sizes from 1 to 256&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RJUMP&lt;&#x2F;code&gt; as a final instruction in code section&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;invalid-cases&quot;&gt;Invalid cases&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;RJUMP&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt; with truncated immediate&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt; as a final instruction in code section&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RJUMPSUB&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;RJUMPSUBV&lt;&#x2F;code&gt; target not &lt;code&gt;ENTERSUB&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RJUMP&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;RJUMPSUB&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;RJUMPSUBV&lt;&#x2F;code&gt; target outside of code section bounds&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RJUMP&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;RJUMPSUB&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;RJUMPSUBV&lt;&#x2F;code&gt; target push data&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RJUMP&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;RJUMPSUB&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;RJUMPSUBV&lt;&#x2F;code&gt; target another &lt;code&gt;RJUMP&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt; immediate argument&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;execution&quot;&gt;Execution&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;RJUMP&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;relative_offset&lt;&#x2F;code&gt; is positive&#x2F;negative&#x2F;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;relative_offset&lt;&#x2F;code&gt; is positive&#x2F;negative&#x2F;&lt;code&gt;0&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;condition&lt;&#x2F;code&gt; equals &lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;condition&lt;&#x2F;code&gt; does not equal &lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;RJUMPV 0 relative_offset&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;case&lt;&#x2F;code&gt; equals &lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;case&lt;&#x2F;code&gt; does not equal &lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt; with table containing positive, negative, &lt;code&gt;0&lt;&#x2F;code&gt; offsets&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;case&lt;&#x2F;code&gt; equals &lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;case&lt;&#x2F;code&gt; does not equal &lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;case&lt;&#x2F;code&gt; outside of table bounds (&lt;code&gt;case &amp;gt; max_index&lt;&#x2F;code&gt;, fallback case)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;case&lt;&#x2F;code&gt; &amp;gt; 255&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;RJUMPSUB&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;relative_offset&lt;&#x2F;code&gt; is positive&#x2F;negative&#x2F;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;RJUMPSUBV 0 relative_offset&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;case&lt;&#x2F;code&gt; equals &lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;case&lt;&#x2F;code&gt; does not equal &lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;RJUMPSUBV&lt;&#x2F;code&gt; with table containing positive, negative, &lt;code&gt;0&lt;&#x2F;code&gt; offsets&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;case&lt;&#x2F;code&gt; equals &lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;case&lt;&#x2F;code&gt; does not equal &lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;case&lt;&#x2F;code&gt; outside of table bounds (&lt;code&gt;case &amp;gt; max_index&lt;&#x2F;code&gt;, fallback case)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;case&lt;&#x2F;code&gt; &amp;gt; 255&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Adding new instructions with immediate arguments should be carefully considered when implementing the validation algorithm.&lt;&#x2F;p&gt;
&lt;p&gt;Static relative jump execution does not require runtime check of the jump destination. It greatly reduces execution cost. Therefore the gas cost of the new instructions can also be significantly reduced.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;RJUMPV&lt;&#x2F;code&gt;and &lt;code&gt;RJUMPSUBV&lt;&#x2F;code&gt; instruction relative offset tables can have up to 256 one-byte entries, so reading an offset cannot be a potential DoS attack surface.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Backward compatible SWAPN, DUPN, EXCHANGE</title>
        <published>2025-08-16T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Francisco Giordano</name><uri>https://github.com/frangio</uri>
	</author>
	
	<author>
		<name>Charles Cooper</name><uri>https://github.com/charles-cooper</uri>
	</author>
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8024/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8024-backward-compatible-swapn-dupn-exchange/25486" />
        

        <id>https://wg-eips.ritovision.com/8024/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:8024"
            label="EIP-8024" />
        

        
        

        
        <summary type="html">Introduce additional instructions for manipulating the stack which allow accessing the stack at higher depths</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8024/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, &lt;code&gt;SWAP*&lt;&#x2F;code&gt; and &lt;code&gt;DUP*&lt;&#x2F;code&gt; instructions are limited to a stack depth of 16. Introduce three new instructions, &lt;code&gt;SWAPN&lt;&#x2F;code&gt;, &lt;code&gt;DUPN&lt;&#x2F;code&gt; and &lt;code&gt;EXCHANGE&lt;&#x2F;code&gt; which lift this limitation and allow accessing the stack at higher depths.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;While the stack is 1024 items deep, easy access is only possible for the top 16 items. Supporting more local variables is possible via manually keeping them in memory or through a &quot;stack to memory elevation&quot; in a compiler. This can result in complex and inefficient code.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore, implementing higher level constructs, such as functions, on top of EVM will result in a list of input and output parameters as well as an instruction offset to return to.&lt;&#x2F;p&gt;
&lt;p&gt;The number of these arguments (or stack items) can easily exceed 16 and thus will require extra care from a compiler to lay them out in a way that all of them are still accessible.&lt;&#x2F;p&gt;
&lt;p&gt;Lastly, swapping items besides the 1st and Nth items in the stack is very important for compilers implementing stack scheduling algorithms (the analog of register allocation for stack machines), which try to minimize stack traffic given a set of variables and usage analysis.&lt;&#x2F;p&gt;
&lt;p&gt;Introducing &lt;code&gt;SWAPN&lt;&#x2F;code&gt;, &lt;code&gt;DUPN&lt;&#x2F;code&gt;, and &lt;code&gt;EXCHANGE&lt;&#x2F;code&gt; will provide an option to compilers to simplify accessing deep stack items.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;We introduce three new instructions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;DUPN&lt;&#x2F;code&gt;     (&lt;code&gt;0xe6&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SWAPN&lt;&#x2F;code&gt;    (&lt;code&gt;0xe7&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;EXCHANGE&lt;&#x2F;code&gt; (&lt;code&gt;0xe8&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Each instruction carries one or two immediate operands. Informally, using 1-based indexing, the semantics are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;DUPN n&lt;&#x2F;code&gt;: The &lt;code&gt;n&lt;&#x2F;code&gt;&#x27;th stack item is duplicated at the top of the stack.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SWAPN n&lt;&#x2F;code&gt;: The &lt;code&gt;n + 1&lt;&#x2F;code&gt;&#x27;th stack item is swapped with the top of the stack.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;EXCHANGE n m&lt;&#x2F;code&gt;: The &lt;code&gt;n + 1&lt;&#x2F;code&gt;&#x27;th stack item is swapped with the &lt;code&gt;m + 1&lt;&#x2F;code&gt;&#x27;th stack item.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Formally, when &lt;code&gt;code[pc]&lt;&#x2F;code&gt; is one of these opcodes, the VM executes as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;DUPN&lt;&#x2F;code&gt;:
&lt;ol&gt;
&lt;li&gt;Charge 3 gas.&lt;&#x2F;li&gt;
&lt;li&gt;Let &lt;code&gt;x = code[pc + 1]&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;90 &amp;lt; x &amp;lt; 128&lt;&#x2F;code&gt;, halt with exceptional failure.&lt;&#x2F;li&gt;
&lt;li&gt;Let &lt;code&gt;n = decode_single(x)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;n &amp;gt; len(stack)&lt;&#x2F;code&gt;, halt with exceptional failure.&lt;&#x2F;li&gt;
&lt;li&gt;Push &lt;code&gt;stack[top - n + 1]&lt;&#x2F;code&gt; on the stack.&lt;&#x2F;li&gt;
&lt;li&gt;Set &lt;code&gt;pc = pc + 2&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SWAPN&lt;&#x2F;code&gt;:
&lt;ol&gt;
&lt;li&gt;Charge 3 gas.&lt;&#x2F;li&gt;
&lt;li&gt;Let &lt;code&gt;x = code[pc + 1]&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;90 &amp;lt; x &amp;lt; 128&lt;&#x2F;code&gt;, halt with exceptional failure.&lt;&#x2F;li&gt;
&lt;li&gt;Let &lt;code&gt;n = decode_single(x)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;n + 1 &amp;gt; len(stack)&lt;&#x2F;code&gt;, halt with exceptional failure.&lt;&#x2F;li&gt;
&lt;li&gt;Swap &lt;code&gt;stack[top - n]&lt;&#x2F;code&gt; and &lt;code&gt;stack[top]&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Set &lt;code&gt;pc = pc + 2&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;EXCHANGE&lt;&#x2F;code&gt;:
&lt;ol&gt;
&lt;li&gt;Charge 3 gas.&lt;&#x2F;li&gt;
&lt;li&gt;Let &lt;code&gt;x = code[pc + 1]&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;79 &amp;lt; x &amp;lt; 128&lt;&#x2F;code&gt;, halt with exceptional failure.&lt;&#x2F;li&gt;
&lt;li&gt;Let &lt;code&gt;n, m = decode_pair(x)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;m + 1 &amp;gt; len(stack)&lt;&#x2F;code&gt;, halt with exceptional failure.&lt;&#x2F;li&gt;
&lt;li&gt;Swap &lt;code&gt;stack[top - n]&lt;&#x2F;code&gt; and &lt;code&gt;stack[top - m]&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Set &lt;code&gt;pc = pc + 2&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;code&gt;code[pc + 1]&lt;&#x2F;code&gt; evaluates to &lt;code&gt;0&lt;&#x2F;code&gt; if beyond the end of the code, matching &lt;code&gt;PUSH&lt;&#x2F;code&gt; behavior.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;top&lt;&#x2F;code&gt; denotes the index of the value at the top of the stack.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; analysis is unchanged. In particular, if &lt;code&gt;code[i]&lt;&#x2F;code&gt; is at an instruction boundary and is one of these opcodes, and &lt;code&gt;code[i + 1]&lt;&#x2F;code&gt; is &lt;code&gt;0x5b&lt;&#x2F;code&gt; (&lt;code&gt;JUMPDEST&lt;&#x2F;code&gt;), then &lt;code&gt;code[i + 1]&lt;&#x2F;code&gt; is a valid jump target. Note that in this case the execution of &lt;code&gt;code[i]&lt;&#x2F;code&gt; would halt at step 2 above (because &lt;code&gt;x = code[i + 1] = 0x5b = 91&lt;&#x2F;code&gt;). Disassemblers must decode such &lt;code&gt;code[i]&lt;&#x2F;code&gt; as &lt;code&gt;INVALID&lt;&#x2F;code&gt; (or &lt;code&gt;INVALID_DUPN&lt;&#x2F;code&gt;, etc.) and &lt;code&gt;code[i + 1]&lt;&#x2F;code&gt; as &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The auxiliary functions &lt;code&gt;decode_single&lt;&#x2F;code&gt; and &lt;code&gt;decode_pair&lt;&#x2F;code&gt; are defined by the following Python code:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; decode_single&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;x&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 90&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; or&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 128&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 255&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 90&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 17&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; decode_pair&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;x&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; tuple&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 79&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; or&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 128&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 255&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    k&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 79&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 48&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    q&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; divmod&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;k&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 16&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; q&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; r&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; q&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 29&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; q&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Assemblers and compilers must emit a 1-byte immediate after each of these opcodes that decodes to the required &lt;code&gt;n, m&lt;&#x2F;code&gt; operands. For reference, this can be done by &lt;code&gt;encode_single&lt;&#x2F;code&gt; and &lt;code&gt;encode_pair&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; encode_single&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 17&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 235&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 107&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 17&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; encode_pair&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; m&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 13&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; m&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 29&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; m&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 30&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; m&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 16&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        q&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; m&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        q&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 29&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; m&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    k&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 16&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; q&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; r&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; k&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt; k&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 79&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; k&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 48&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;use-of-an-immediate-operand&quot;&gt;Use of an immediate operand&lt;&#x2F;h3&gt;
&lt;p&gt;Allowing dynamic selection of the arguments to swap or dup could be used to prevent static analysis of the contents of the stack. Since static analysis is an important tool for security auditors we want to do what we can to make their jobs easier. Hence, the operands require an immediate operand that is not dynamic in nature.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;disallowed-immediate-range&quot;&gt;Disallowed immediate range&lt;&#x2F;h3&gt;
&lt;p&gt;A property the EVM has is that it&#x27;s not possible to jump to the middle of an instruction. In order to guarantee this property, the immediate operands of &lt;code&gt;PUSH*&lt;&#x2F;code&gt; instructions are masked from jumpdest analysis so that the occurrence of &lt;code&gt;0x5b&lt;&#x2F;code&gt; in them is not mistaken for a &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; instruction, which should be considered a valid jump target elsewhere.&lt;&#x2F;p&gt;
&lt;p&gt;The new instructions in this EIP preserve this property without changing jumpdest analysis by making it invalid for their immediates to contain &lt;code&gt;0x5b&lt;&#x2F;code&gt;, in addition to &lt;code&gt;0x60&lt;&#x2F;code&gt; to &lt;code&gt;0x7f&lt;&#x2F;code&gt; (&lt;code&gt;PUSH1&lt;&#x2F;code&gt; to &lt;code&gt;PUSH32&lt;&#x2F;code&gt;) since those would cause the subsequent instructions to be masked.&lt;&#x2F;p&gt;
&lt;p&gt;The alternative, changing jumpdest analysis to introduce new masked opcodes, would create a backwards incompatibility if done without bytecode versioning (EOF). Consider the bytecode sequence &lt;code&gt;e6 5b&lt;&#x2F;code&gt; that decodes to &lt;code&gt;INVALID JUMPDEST&lt;&#x2F;code&gt; prior to this EIP, and thus contains a valid jump target. If an instruction &lt;code&gt;DUPN x&lt;&#x2F;code&gt; were introduced with encoding &lt;code&gt;e6 {x}&lt;&#x2F;code&gt; (opcode immediately followed by operand), and jumpdest analysis changed to mask the operand to &lt;code&gt;e6&lt;&#x2F;code&gt;, the same bytecode sequence &lt;code&gt;e6 5b&lt;&#x2F;code&gt; would then decode to &lt;code&gt;DUPN 0x5b&lt;&#x2F;code&gt;. As a result of the upgrade, &lt;code&gt;e6&lt;&#x2F;code&gt; would become an invalid jump target, breaking contracts that include this sequence. The opposite can happen with push opcodes, for example, &lt;code&gt;e6 60 5b&lt;&#x2F;code&gt; would transform from &lt;code&gt;INVALID PUSH1 0x5b&lt;&#x2F;code&gt; to &lt;code&gt;DUPN 0x60 JUMPDEST&lt;&#x2F;code&gt;, creating a new valid jump target. Furthermore, this may have a cascading effect on arbitrarily many subsequent instructions.&lt;&#x2F;p&gt;
&lt;p&gt;Since the EVM doesn&#x27;t offer a dedicated section for data, arbitrary data may be embedded in code and serve as immutable data storage accessed via &lt;code&gt;CODECOPY&lt;&#x2F;code&gt;. Therefore, we must assume that arbitrary byte sequences may be found in contracts that have been deployed or are included in transactions yet to be published on chain.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP is designed to uphold the following backwards compatibility guarantee: every possible execution trace on a given bytecode that does not attempt to execute an undefined opcode must continue to produce the same effect after the introduction of an instruction. No new &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt;s must be created in a given bytecode by the introduction of an instruction and none may be removed.&lt;&#x2F;p&gt;
&lt;p&gt;This encoding can be reused in future instructions with immediate operands, although it is not necessary if the range of the operand naturally does not include the bytes &lt;code&gt;0x5b&lt;&#x2F;code&gt; (&lt;code&gt;JUMPDEST&lt;&#x2F;code&gt;) or &lt;code&gt;0x60&lt;&#x2F;code&gt; (&lt;code&gt;PUSH1&lt;&#x2F;code&gt;) to &lt;code&gt;0x7f&lt;&#x2F;code&gt; (&lt;code&gt;PUSH32&lt;&#x2F;code&gt;), in which case masking is not necessary.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;exchange-immediate&quot;&gt;&lt;code&gt;EXCHANGE&lt;&#x2F;code&gt; immediate&lt;&#x2F;h3&gt;
&lt;p&gt;A previous formulation of &lt;code&gt;EXCHANGE&lt;&#x2F;code&gt; allowed swapping stack elements only if they were within some distance. As a result, it would be possible to swap the elements at indices 30 and 29, but not possible to move an element from index 30 to 2 with a single instruction. The current formulation prioritizes the latter, on the assumption that it is more valuable to move elements closer to the top of the stack than it is to rearrange elements deeper in the stack.&lt;&#x2F;p&gt;
&lt;p&gt;In addition, the exact formulation was chosen to make &lt;code&gt;decode_pair&lt;&#x2F;code&gt; a simple function using only basic arithmetic, bitwise operations (division by 16), and few branches. A small trade-off in the number of addressable pairs was made to reduce the number of necessary branches; this implies some of the immediate range is not allocated, and it could be used to add a dozen more addressable pairs at the cost of more decoding complexity, potentially in a future network upgrade.&lt;&#x2F;p&gt;
&lt;p&gt;Finally, note that the operands in the assembly instruction &lt;code&gt;EXCHANGE n m&lt;&#x2F;code&gt; appear &quot;off by one&quot;, i.e. it operates on the stack elements at depths &lt;code&gt;n + 1&lt;&#x2F;code&gt; and &lt;code&gt;m + 1&lt;&#x2F;code&gt;. These offsets were chosen to match the &lt;code&gt;SWAP&lt;&#x2F;code&gt; and &lt;code&gt;SWAPN&lt;&#x2F;code&gt; opcodes such that &lt;code&gt;EXCHANGE n m&lt;&#x2F;code&gt; has an effect equivalent to the sequence &lt;code&gt;SWAP{n} SWAP{m} SWAP{n}&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;size-of-immediate-operand&quot;&gt;Size of immediate operand&lt;&#x2F;h3&gt;
&lt;p&gt;For &lt;code&gt;DUPN&lt;&#x2F;code&gt; and &lt;code&gt;SWAPN&lt;&#x2F;code&gt; a 16-bit size was considered to accommodate the full stack space of 1024 items, however:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;that would require an additional restriction&#x2F;check (&lt;code&gt;n &amp;lt; 1024&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;the 256 depth is a large improvement over the current 16 and the overhead of an extra byte would make it less useful&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Similarly for &lt;code&gt;EXCHANGE&lt;&#x2F;code&gt;, the proposed scheme allows addressing of 30 items.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-cost&quot;&gt;Gas cost&lt;&#x2F;h3&gt;
&lt;p&gt;The gas cost for these operations is the same as for existing &lt;code&gt;DUP*&lt;&#x2F;code&gt; and &lt;code&gt;SWAP*&lt;&#x2F;code&gt; instructions, because they are just implemented as pointer swaps and immediate decoding is negligible.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;exchange-vs-swapn&quot;&gt;&lt;code&gt;EXCHANGE&lt;&#x2F;code&gt; vs &lt;code&gt;SWAPN&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;As mentioned before, &lt;code&gt;EXCHANGE&lt;&#x2F;code&gt; is important to compilers implementing stack scheduling algorithms. Specifically, in the case that a stack item is scheduled to be consumed deeper in the stack (for instance, the 3rd item in the stack needs to be moved into 2nd position in order to be consumed by the next operation), that currently takes three instructions, &lt;code&gt;SWAP2 SWAP3 SWAP2&lt;&#x2F;code&gt;. However, in the EVM implementation, the implementation is just a pointer swap, so it could be implemented in a single instruction at no extra runtime cost to the client.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This has no effect on contracts that would never attempt to execute the opcodes allocated by this EIP. The jump targets of existing contracts are preserved.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;assembly-disassembly&quot;&gt;Assembly&#x2F;Disassembly&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;e600&lt;&#x2F;code&gt; is &lt;code&gt;[DUPN 17]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;e780&lt;&#x2F;code&gt; is &lt;code&gt;[SWAPN 108]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;e6005b&lt;&#x2F;code&gt; is &lt;code&gt;[DUPN 17, JUMPDEST]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;e75b&lt;&#x2F;code&gt; is &lt;code&gt;[INVALID_SWAPN, JUMPDEST]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;e6605b&lt;&#x2F;code&gt; is &lt;code&gt;[INVALID_DUPN, PUSH1 0x5b]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;e7610000&lt;&#x2F;code&gt; is &lt;code&gt;[INVALID_SWAPN, PUSH2 0x0000]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;e65f&lt;&#x2F;code&gt; is &lt;code&gt;[INVALID_DUPN, PUSH0]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;e812&lt;&#x2F;code&gt; is &lt;code&gt;[EXCHANGE 2 3]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;e8d0&lt;&#x2F;code&gt; is &lt;code&gt;[EXCHANGE 1 19]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;e850&lt;&#x2F;code&gt; is &lt;code&gt;[INVALID_EXCHANGE, POP]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;execution&quot;&gt;Execution&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;60016000808080808080808080808080808080e600&lt;&#x2F;code&gt; results in 18 stack items, the top of the stack valued 1, the bottom of the stack valued 1, the rest valued 0
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;60016000808080808080808080808080808080e6&lt;&#x2F;code&gt; at the end of the code is equivalent to above&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;600160008080808080808080808080808080806002e700&lt;&#x2F;code&gt; results in 18 stack items, the top of the stack valued 1, the bottom of the stack valued 2, the rest valued 0
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;600160008080808080808080808080808080806002e7&lt;&#x2F;code&gt; at the end of the code is equivalent to above&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;600060016002e801&lt;&#x2F;code&gt; results in 3 stack items, from top to bottom: [2, 0, 1]&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;600060006000600060006000600060006000600060006000600060006000600060006000600060006000600060006000600060006000600060016002e8&lt;&#x2F;code&gt; results in 30 stack items, the top of the stack valued 2, the bottom of the stack valued 1, the rest valued 0&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;e75b&lt;&#x2F;code&gt; reverts&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;600456e65b&lt;&#x2F;code&gt; executes successfully (&lt;code&gt;PUSH 04 JUMP INVALID_DUPN JUMPDEST&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;600060006000e80115&lt;&#x2F;code&gt; results in 3 stack items, the top of the stack valued 1, the rest valued 0&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;6000808080808080808080808080808080e600&lt;&#x2F;code&gt; results in exceptional halt&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The authors are not aware of any additional risks introduced here. The EVM stack is fixed at 1024 items and most implementations keep that in memory at all times. This change will increase the number of stack items accessible via single instruction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Trustless Agents</title>
        <published>2025-08-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Marco De Rossi</name><uri>https://github.com/MarcoMetaMask</uri>
	</author>
	
	<author>
		<name>Davide Crapis</name><uri>https://github.com/dcrapis</uri><email>davide@ethereum.org</email>
	</author>
	
	<author>
		<name>Jordan Ellis</name><email>jordanellis@google.com</email>
	</author>
	
	<author>
		<name>Erik Reppel</name><email>erik.reppel@coinbase.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8004/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-8004-trustless-agents/25098" />
        

        <id>https://wg-eips.ritovision.com/8004/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:8004"
            label="ERC-8004" />
        

        
        

        
        <summary type="html">Discover agents and establish trust through reputation and validation</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8004/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This protocol proposes to use blockchains to &lt;strong&gt;discover, choose, and interact with agents across organizational boundaries&lt;&#x2F;strong&gt; without pre-existing trust, thus &lt;strong&gt;enabling open-ended agent economies&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Trust models are pluggable and tiered, with security proportional to value at risk, from low-stake tasks like ordering pizza to high-stake tasks like medical diagnosis. Developers can choose from different trust models: reputation systems using client feedback, validation via stake-secured re-execution, zero-knowledge machine learning (zkML) proofs, or trusted execution environment (TEE) oracles.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Model context protocol &lt;!-- TODO: double check that this is the correct abbreviation --&gt;(MCP) allows servers to list and offer their capabilities (prompts, resources, tools, and completions), while Agent2Agent &lt;!-- TODO: double check that this is the correct abbreviation --&gt;(A2A) handles agent authentication, skills advertisement via AgentCards, direct messaging, and complete task-lifecycle orchestration. However, these agent communication protocols don&#x27;t inherently cover agent discovery and trust.&lt;&#x2F;p&gt;
&lt;p&gt;To foster an open, cross-organizational agent economy, we need mechanisms for discovering and trusting agents in untrusted settings. This ERC addresses this need through three lightweight registries, which can be deployed on any L2 or on Mainnet as per-chain singletons:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Identity Registry&lt;&#x2F;strong&gt; - A minimal on-chain handle based on &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; with URIStorage extension &lt;!-- Editor&#x27;s Note: where is URIStorage defined? Is it an OZ thing? If so, you should include the interface here, or make a separate ERC standardizing it. --&gt;that resolves to an agent&#x27;s registration file, providing every agent with a portable, censorship-resistant identifier.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Reputation Registry&lt;&#x2F;strong&gt; - A standard interface for posting and fetching feedback signals. Scoring and aggregation occur both on-chain (for composability) and off-chain (for sophisticated algorithms), enabling an ecosystem of specialized services for agent scoring, auditor networks, and insurance pools.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Validation Registry&lt;&#x2F;strong&gt; - Generic hooks for requesting and recording independent validators checks (e.g. stakers re-running the job, zkML verifiers, TEE oracles, trusted judges).&lt;&#x2F;p&gt;
&lt;p&gt;Payments are orthogonal to this protocol and not covered here. However, examples are provided showing how &lt;strong&gt;x402 payments&lt;&#x2F;strong&gt; &lt;!-- Editor&#x27;s Note: This is a coinbase thing, right? If it isn&#x27;t necessary to your standard, can you omit it? --&gt;can enrich feedback signals.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc2119&quot;&gt;RFC 2119&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc8174&quot;&gt;RFC 8174&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;identity-registry&quot;&gt;Identity Registry&lt;&#x2F;h3&gt;
&lt;p&gt;The Identity Registry uses ERC-721 with the URIStorage extension for agent registration, making &lt;strong&gt;all agents immediately browsable and transferable with NFTs-compliant apps&lt;&#x2F;strong&gt;. Each agent is uniquely identified globally by:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;agentRegistry&lt;&#x2F;em&gt;: A colon-separated string &lt;code&gt;{namespace}:{chainId}:{identityRegistry}&lt;&#x2F;code&gt; (e.g., &lt;code&gt;eip155:1:0x742...&lt;&#x2F;code&gt;) where:
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;namespace&lt;&#x2F;em&gt;: The chain family identifier (&lt;code&gt;eip155&lt;&#x2F;code&gt; for EVM chains)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;chainId&lt;&#x2F;em&gt;: The blockchain network identifier&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;identityRegistry&lt;&#x2F;em&gt;: The address where the ERC-721 registry contract is deployed&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;agentId&lt;&#x2F;em&gt;: The ERC-721 tokenId assigned incrementally by the registry&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Throughout this document, &lt;em&gt;tokenId&lt;&#x2F;em&gt; in ERC-721 is referred to as &lt;em&gt;agentId&lt;&#x2F;em&gt; and &lt;em&gt;tokenURI&lt;&#x2F;em&gt; in ERC-721 is referred to as &lt;em&gt;agentURI&lt;&#x2F;em&gt;. The owner of the ERC-721 token is the owner of the agent and can transfer ownership or delegate management (e.g., updating the registration file) to operators, as supported by &lt;code&gt;ERC721URIStorage&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;agent-uri-and-agent-registration-file&quot;&gt;Agent URI and Agent Registration File&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;em&gt;agentURI&lt;&#x2F;em&gt; MUST resolve to the agent registration file. It MAY use any URI scheme such as &lt;code&gt;ipfs:&#x2F;&#x2F;&lt;&#x2F;code&gt; (e.g., &lt;code&gt;ipfs:&#x2F;&#x2F;cid&lt;&#x2F;code&gt;), &lt;code&gt;https:&#x2F;&#x2F;&lt;&#x2F;code&gt; (e.g., &lt;code&gt;https:&#x2F;&#x2F;example.com&#x2F;agent3.json&lt;&#x2F;code&gt;), or a base64-encoded &lt;code&gt;data:&lt;&#x2F;code&gt; URI (e.g., &lt;code&gt;data:application&#x2F;json;base64,eyJ0eXBlIjoi...&lt;&#x2F;code&gt;) for fully on-chain metadata. When the registration uri changes, it can be updated with &lt;em&gt;setAgentURI()&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The registration file MUST have the following structure:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;jsonc&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-8004#registration-v1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;myAgentName&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A natural language description of the Agent, which MAY include what it does, how it works, pricing, and interaction methods&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;image&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;example.com&#x2F;agentimage.png&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;services&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;web&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;endpoint&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;web.agentxyz.com&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A2A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;endpoint&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;agent.example&#x2F;.well-known&#x2F;agent-card.json&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0.3.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;MCP&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;endpoint&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;mcp.agent.eth&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2025-06-18&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;OASF&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;endpoint&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ipfs:&#x2F;&#x2F;{cid}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0.8&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; https:&#x2F;&#x2F;github.com&#x2F;agntcy&#x2F;oasf&#x2F;tree&#x2F;v0.8.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;skills&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; OPTIONAL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;domains&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; OPTIONAL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ENS&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;endpoint&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;vitalik.eth&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;v1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;DID&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;endpoint&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;did:method:foobar&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;v1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;email&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;endpoint&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;mail@myagent.com&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;x402Support&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;active&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;registrations&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;agentId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 22&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;agentRegistry&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{namespace}:{chainId}:{identityRegistry}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; e.g. eip155:1:0x742...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;supportedTrust&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;reputation&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;crypto-economic&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;tee-attestation&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;em&gt;type&lt;&#x2F;em&gt;, &lt;em&gt;name&lt;&#x2F;em&gt;, &lt;em&gt;description&lt;&#x2F;em&gt;, and &lt;em&gt;image&lt;&#x2F;em&gt; fields at the top SHOULD ensure compatibility with ERC-721 apps. The number and type of &lt;em&gt;endpoints&lt;&#x2F;em&gt; are fully customizable, allowing developers to add as many as they wish. The &lt;em&gt;version&lt;&#x2F;em&gt; field in endpoints is a SHOULD, not a MUST.&lt;&#x2F;p&gt;
&lt;p&gt;Agents MAY advertise their endpoints, which point to an A2A agent card, an MCP endpoint, an ENS agent name, DIDs, or the agent&#x27;s wallets on any chain (even chains where the agent is not registered).&lt;&#x2F;p&gt;
&lt;h4 id=&quot;endpoint-domain-verification-optional&quot;&gt;Endpoint Domain Verification (Optional)&lt;&#x2F;h4&gt;
&lt;p&gt;Since endpoints can point to domains not controlled by the agent owner, an agent MAY optionally prove control of an HTTPS endpoint-domain by publishing &lt;code&gt;https:&#x2F;&#x2F;{endpoint-domain}&#x2F;.well-known&#x2F;agent-registration.json&lt;&#x2F;code&gt; containing at least a &lt;code&gt;registrations&lt;&#x2F;code&gt; list (or the full agent registration file). Users MAY treat the endpoint-domain as verified if the file is reachable over HTTPS and includes a &lt;code&gt;registrations&lt;&#x2F;code&gt; entry whose &lt;code&gt;agentRegistry&lt;&#x2F;code&gt; and &lt;code&gt;agentId&lt;&#x2F;code&gt; match the on-chain agent; if the endpoint-domain is the same domain that serves the agent’s primary registration file referenced by &lt;code&gt;agentURI&lt;&#x2F;code&gt;, this additional check is not needed because domain control is already demonstrated there.&lt;&#x2F;p&gt;
&lt;p&gt;Agents SHOULD have at least one registration (multiple are possible), and all fields in the registration are mandatory.
The &lt;em&gt;supportedTrust&lt;&#x2F;em&gt; field is OPTIONAL. If absent or empty, this ERC is used only for discovery, not for trust.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;on-chain-metadata&quot;&gt;On-chain metadata&lt;&#x2F;h4&gt;
&lt;p&gt;The registry extends ERC-721 by adding &lt;code&gt;getMetadata(uint256 agentId, string metadataKey)&lt;&#x2F;code&gt; and &lt;code&gt;setMetadata(uint256 agentId, string metadataKey, bytes metadataValue)&lt;&#x2F;code&gt; functions for optional extra on-chain agent metadata:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getMetadata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; agentId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; metadataKey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setMetadata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; agentId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; metadataKey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; metadataValue&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;When metadata is set, the following event is emitted:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MetadataSet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; agentId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; indexedMetadataKey&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; metadataKey&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; metadataValue&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The key &lt;code&gt;agentWallet&lt;&#x2F;code&gt; is reserved and cannot be set via &lt;code&gt;setMetadata()&lt;&#x2F;code&gt; or during &lt;code&gt;register()&lt;&#x2F;code&gt; (including the metadata array overload). It represents the address where the agent receives payments and is initially set to the owner&#x27;s address. To change it, the agent owner must prove control of the new wallet by providing a valid &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; signature for EOAs or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;ERC-1271&lt;&#x2F;a&gt; for smart contract wallets—by calling:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setAgentWallet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; agentId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newWallet&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; deadline&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;To read and clear the currently set wallet, the following functions are exposed:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getAgentWallet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; agentId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; unsetAgentWallet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; agentId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;When the agent is transferred, &lt;code&gt;agentWallet&lt;&#x2F;code&gt; is automatically cleared (effectively resetting it to the zero address) and must be re-verified by the new owner.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;registration&quot;&gt;Registration&lt;&#x2F;h4&gt;
&lt;p&gt;New agents can be minted by calling one of these functions:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MetadataEntry&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt; metadataKey&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt; metadataValue&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; register&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; agentURI&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; MetadataEntry&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; metadata&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; agentId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; register&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; agentURI&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; agentId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;agentURI&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; added&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; later&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; with&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setAgentURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; register&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; agentId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This emits one Transfer event, one MetadataSet event for the reserved &lt;code&gt;agentWallet&lt;&#x2F;code&gt; key, one MetadataSet event for each additional metadata entry (if any), and&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Registered&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; agentId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; agentURI&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;update-agenturi&quot;&gt;Update agentURI&lt;&#x2F;h4&gt;
&lt;p&gt;The agentURI can be updated by calling the following function, which emits a URIUpdated event:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setAgentURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; agentId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newURI&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; URIUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; agentId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; newURI&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; updatedBy&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;If the owner wants to store the entire registration file on-chain, the &lt;em&gt;agentURI&lt;&#x2F;em&gt; SHOULD use a base64-encoded data URI rather than a serialized JSON string:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;data:application&#x2F;json;base64,eyJ0eXBlIjoi...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;reputation-registry&quot;&gt;Reputation Registry&lt;&#x2F;h3&gt;
&lt;p&gt;When the Reputation Registry is deployed, the &lt;em&gt;identityRegistry&lt;&#x2F;em&gt; address is set via &lt;code&gt;initialize(address identityRegistry_)&lt;&#x2F;code&gt; and publicly visible by calling:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getIdentityRegistry&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; identityRegistry&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The feedback given by a &lt;em&gt;clientAddress&lt;&#x2F;em&gt; to an agent consists of a signed fixed-point &lt;em&gt;value&lt;&#x2F;em&gt; (&lt;code&gt;int128&lt;&#x2F;code&gt;) and its &lt;em&gt;valueDecimals&lt;&#x2F;em&gt; (&lt;code&gt;uint8&lt;&#x2F;code&gt;, 0-18), plus optional &lt;em&gt;tag1&lt;&#x2F;em&gt; and &lt;em&gt;tag2&lt;&#x2F;em&gt; (left to developers&#x27; discretion to provide maximum on-chain composability and filtering), an &lt;em&gt;endpoint&lt;&#x2F;em&gt; URI, a file URI pointing to an off-chain JSON containing additional information, and its KECCAK-256 file hash to guarantee integrity. We suggest using IPFS or equivalent services to make feedback easily indexed by subgraphs or similar technologies. For IPFS URIs, the hash is not required.
All fields except &lt;em&gt;value&lt;&#x2F;em&gt; and &lt;em&gt;valueDecimals&lt;&#x2F;em&gt; are OPTIONAL, so the off-chain file is not required and can be omitted.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;giving-feedback&quot;&gt;Giving Feedback&lt;&#x2F;h4&gt;
&lt;p&gt;New feedback can be added by any &lt;em&gt;clientAddress&lt;&#x2F;em&gt; calling:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; giveFeedback&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; agentId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int128&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; valueDecimals&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tag1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tag2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; endpoint&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; feedbackURI&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; feedbackHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;em&gt;agentId&lt;&#x2F;em&gt; must be a validly registered agent. The &lt;em&gt;valueDecimals&lt;&#x2F;em&gt; MUST be between 0 and 18. The feedback submitter MUST NOT be the agent owner or an approved operator for &lt;em&gt;agentId&lt;&#x2F;em&gt;. &lt;em&gt;tag1&lt;&#x2F;em&gt;, &lt;em&gt;tag2&lt;&#x2F;em&gt;, &lt;em&gt;endpoint&lt;&#x2F;em&gt;, &lt;em&gt;feedbackURI&lt;&#x2F;em&gt;, and &lt;em&gt;feedbackHash&lt;&#x2F;em&gt; are OPTIONAL.&lt;&#x2F;p&gt;
&lt;p&gt;Where provided, &lt;em&gt;feedbackHash&lt;&#x2F;em&gt; is the KECCAK-256 hash (&lt;code&gt;keccak256&lt;&#x2F;code&gt;) of the content referenced by &lt;em&gt;feedbackURI&lt;&#x2F;em&gt;, enabling verifiable integrity for non-content-addressed URIs. For IPFS (or other content-addressed URIs), &lt;em&gt;feedbackHash&lt;&#x2F;em&gt; is OPTIONAL and can be omitted (e.g., set to &lt;code&gt;bytes32(0)&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;If the procedure succeeds, an event is emitted:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NewFeedback&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; agentId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; clientAddress&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; feedbackIndex&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int128&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; valueDecimals&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; indexedTag1&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tag1&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tag2&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; endpoint&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; feedbackURI&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; feedbackHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The feedback fields &lt;em&gt;value&lt;&#x2F;em&gt;, &lt;em&gt;valueDecimals&lt;&#x2F;em&gt;, &lt;em&gt;tag1&lt;&#x2F;em&gt;, &lt;em&gt;tag2&lt;&#x2F;em&gt;, and &lt;em&gt;isRevoked&lt;&#x2F;em&gt; are stored in the contract storage along with the feedbackIndex (a 1-indexed counter of feedback submissions that &lt;em&gt;clientAddress&lt;&#x2F;em&gt; has given to &lt;em&gt;agentId&lt;&#x2F;em&gt;). The fields &lt;em&gt;endpoint&lt;&#x2F;em&gt;, &lt;em&gt;feedbackURI&lt;&#x2F;em&gt;, and &lt;em&gt;feedbackHash&lt;&#x2F;em&gt; are emitted but are not stored. This exposes reputation signals to any smart contract, enabling on-chain composability.&lt;&#x2F;p&gt;
&lt;p&gt;When the feedback is given by an agent (i.e., the client is an agent), the agent SHOULD use the address set in the on-chain optional &lt;code&gt;agentWallet&lt;&#x2F;code&gt; metadata as the clientAddress, to facilitate reputation aggregation.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;examples-of-value-valuedecimals&quot;&gt;Examples of &lt;code&gt;value&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;valueDecimals&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;tag1&lt;&#x2F;th&gt;&lt;th&gt;What it measures&lt;&#x2F;th&gt;&lt;th&gt;Example human value&lt;&#x2F;th&gt;&lt;th&gt;&lt;code&gt;value&lt;&#x2F;code&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;code&gt;valueDecimals&lt;&#x2F;code&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;starred&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Quality rating (0-100)&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;87&#x2F;100&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;87&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;reachable&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Endpoint reachable (binary)&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;true&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ownerVerified&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Endpoint owned by agent owner (binary)&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;true&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;uptime&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Endpoint uptime (%)&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;99.77%&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;9977&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;successRate&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Endpoint success rate (%)&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;89%&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;89&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;responseTime&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Response time (ms)&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;560ms&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;560&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;blocktimeFreshness&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Avg block delay (blocks)&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;4 blocks&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;4&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;revenues&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Cumulative revenues (e.g., USD)&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;$560&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;560&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;tradingYield&lt;&#x2F;code&gt; (&lt;code&gt;tag2&lt;&#x2F;code&gt; = &lt;code&gt;day, week, month, year&lt;&#x2F;code&gt;)&lt;&#x2F;td&gt;&lt;td&gt;Yield&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;-3,2%&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;-32&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;off-chain-feedback-file-structure&quot;&gt;Off-Chain Feedback File Structure&lt;&#x2F;h4&gt;
&lt;p&gt;The OPTIONAL file at the URI could look like:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;jsonc&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST FIELDS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;agentRegistry&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eip155:1:{identityRegistry}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;agentId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 22&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;clientAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eip155:1:{clientAddress}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;createdAt&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2025-09-23T12:00:00Z&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 100&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;valueDecimals&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ALL OPTIONAL FIELDS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;tag1&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;foo&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;tag2&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bar&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;endpoint&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;agent.example.com&#x2F;GetPrice&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;mcp&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;tool&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ToolName&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; or: { &amp;quot;prompt&amp;quot;: &amp;quot;PromptName&amp;quot; } &#x2F; { &amp;quot;resource&amp;quot;: &amp;quot;ResourceName&amp;quot; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A2A: see &amp;quot;Context Identifier Semantics&amp;quot; and Task model in the A2A specification.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;a2a&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;skills&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;as-defined-by-A2A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; e.g., AgentSkill identifiers&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;contextId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;as-defined-by-A2A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;taskId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;as-defined-by-A2A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;oasf&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;skills&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;as-defined-by-OASF&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;domains&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;as-defined-by-OASF&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;proofOfPayment&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; this can be used for x402 proof of payment&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;fromAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x00...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;toAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x00...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;txHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x00...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Other fields&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; ... &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; ... &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MAY&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;revoking-feedback&quot;&gt;Revoking Feedback&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;em&gt;clientAddress&lt;&#x2F;em&gt; can revoke feedback by calling:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revokeFeedback&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; agentId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; feedbackIndex&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This emits:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FeedbackRevoked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; agentId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; clientAddress&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; feedbackIndex&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;appending-responses&quot;&gt;Appending Responses&lt;&#x2F;h4&gt;
&lt;p&gt;Anyone (e.g., the &lt;em&gt;agentId&lt;&#x2F;em&gt; showing a refund, any off-chain data intelligence aggregator tagging feedback as spam) can call:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; appendResponse&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; agentId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; clientAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; feedbackIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; responseURI&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; responseHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Where &lt;em&gt;responseHash&lt;&#x2F;em&gt; is the KECCAK-256 file hash of the &lt;em&gt;responseURI&lt;&#x2F;em&gt; file content to guarantee integrity. This field is not required for IPFS URIs.&lt;&#x2F;p&gt;
&lt;p&gt;This emits:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ResponseAppended&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; agentId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; clientAddress&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; feedbackIndex&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; responder&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; responseURI&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; responseHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;read-functions&quot;&gt;Read Functions&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getSummary&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; agentId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; clientAddresses&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tag1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tag2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; count&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int128&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; summaryValue&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; summaryValueDecimals&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;agentId&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; and&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; clientAddresses&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; are&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mandatory&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; tag1 and tag2 are optional filters&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; clientAddresses MUST be provided (non-empty); results without filtering by clientAddresses are subject to Sybil&#x2F;spam attacks. See Security Considerations for details&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; readFeedback&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; agentId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; clientAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; feedbackIndex&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int128&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; valueDecimals&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tag1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tag2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; isRevoked&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; readAllFeedback&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; agentId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; clientAddresses&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tag1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tag2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; includeRevoked&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; clients&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; feedbackIndexes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int128&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; values&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint8&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; valueDecimals&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tag1s&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tag2s&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; revokedStatuses&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;agentId&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; only&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mandatory&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; parameter&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; others are optional filters&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt; Revoked feedback are omitted by default&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getResponseCount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; agentId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; clientAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; feedbackIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; responders&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; count&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;agentId&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; only&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mandatory&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; parameter&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; others are optional filters&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getClients&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; agentId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getLastIndex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; agentId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; clientAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;We expect reputation systems around reviewers&#x2F;clientAddresses to emerge. &lt;strong&gt;While simple filtering by reviewer (useful to mitigate spam) and by tag are enabled on-chain, more complex reputation aggregation will happen off-chain&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;validation-registry&quot;&gt;Validation Registry&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;This registry enables agents to request verification of their work and allows validator smart contracts to provide responses that can be tracked on-chain&lt;&#x2F;strong&gt;. Validator smart contracts could use, for example, stake-secured inference re-execution, zkML verifiers or TEE oracles to validate or reject requests.&lt;&#x2F;p&gt;
&lt;p&gt;When the Validation Registry is deployed, the &lt;em&gt;identityRegistry&lt;&#x2F;em&gt; address is set via &lt;code&gt;initialize(address identityRegistry_)&lt;&#x2F;code&gt; and is visible by calling &lt;code&gt;getIdentityRegistry()&lt;&#x2F;code&gt;, as described above.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;validation-request&quot;&gt;Validation Request&lt;&#x2F;h4&gt;
&lt;p&gt;Agents request validation by calling:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validationRequest&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; validatorAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; agentId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; requestURI&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; requestHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This function MUST be called by the owner or operator of &lt;em&gt;agentId&lt;&#x2F;em&gt;. The &lt;em&gt;requestURI&lt;&#x2F;em&gt; points to off-chain data containing all information needed for the validator to validate, including inputs and outputs needed for the verification. The &lt;em&gt;requestHash&lt;&#x2F;em&gt; is a commitment to this data (&lt;code&gt;keccak256&lt;&#x2F;code&gt; of the request payload) and identifies the request. All other fields are mandatory.&lt;&#x2F;p&gt;
&lt;p&gt;A ValidationRequest event is emitted:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ValidationRequest&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; validatorAddress&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; agentId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; requestURI&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; requestHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;validation-response&quot;&gt;Validation Response&lt;&#x2F;h4&gt;
&lt;p&gt;Validators respond by calling:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validationResponse&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; requestHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; response&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; responseURI&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; responseHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tag&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Only &lt;em&gt;requestHash&lt;&#x2F;em&gt; and &lt;em&gt;response&lt;&#x2F;em&gt; are mandatory; &lt;em&gt;responseURI&lt;&#x2F;em&gt;, &lt;em&gt;responseHash&lt;&#x2F;em&gt; and &lt;em&gt;tag&lt;&#x2F;em&gt; are optional. This function MUST be called by the &lt;em&gt;validatorAddress&lt;&#x2F;em&gt; specified in the original request. The &lt;em&gt;response&lt;&#x2F;em&gt; is a value between 0 and 100, which can be used as binary (0 for failed, 100 for passed) or with intermediate values for validations with a spectrum of outcomes. The optional &lt;em&gt;responseURI&lt;&#x2F;em&gt; points to off-chain evidence or audit of the validation, &lt;em&gt;responseHash&lt;&#x2F;em&gt; is its commitment (in case the resource is not on IPFS), while &lt;em&gt;tag&lt;&#x2F;em&gt; allows for custom categorization or additional data.&lt;&#x2F;p&gt;
&lt;p&gt;validationResponse() can be called multiple times for the same &lt;em&gt;requestHash&lt;&#x2F;em&gt;, enabling use cases like progressive validation states (e.g., “soft finality” and “hard finality” using &lt;em&gt;tag&lt;&#x2F;em&gt;) or updates to validation status.&lt;&#x2F;p&gt;
&lt;p&gt;Upon successful execution, a &lt;em&gt;ValidationResponse&lt;&#x2F;em&gt; event is emitted with all function parameters:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ValidationResponse&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; validatorAddress&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; agentId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; requestHash&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; response&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; responseURI&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; responseHash&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tag&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The contract stores &lt;em&gt;requestHash&lt;&#x2F;em&gt;, &lt;em&gt;validatorAddress&lt;&#x2F;em&gt;, &lt;em&gt;agentId&lt;&#x2F;em&gt;, &lt;em&gt;response&lt;&#x2F;em&gt;, &lt;em&gt;responseHash&lt;&#x2F;em&gt;, &lt;em&gt;lastUpdate&lt;&#x2F;em&gt;, and &lt;em&gt;tag&lt;&#x2F;em&gt; for on-chain querying and composability.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;read-functions-1&quot;&gt;Read Functions&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getValidationStatus&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; requestHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; validatorAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; agentId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; response&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; responseHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tag&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; lastUpdate&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Returns&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; aggregated&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validation&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; statistics&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; an&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; agent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; agentId&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; only&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mandatory&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; parameter&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; validatorAddresses and tag are optional filters&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getSummary&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; agentId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; validatorAddresses&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tag&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; count&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; averageResponse&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getAgentValidations&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; agentId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; requestHashes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getValidatorRequests&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validatorAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; requestHashes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Incentives and slashing related to validation are managed by the specific validation protocol and are outside the scope of this registry.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Agent communication protocols&lt;&#x2F;strong&gt;: MCP and A2A are popular, and other protocols could emerge. For this reason, this protocol links from the blockchain to a flexible registration file including a list where endpoints can be added at will, combining AI primitives (MCP, A2A) and Web3 primitives such as wallet addresses, DIDs, and ENS names.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Feedback&lt;&#x2F;strong&gt;: The protocol combines the leverage of nomenclature already established by A2A (such as tasks and skills) and MCP (such as tools and prompts) with complete flexibility in the feedback signal structure.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Gas Sponsorship&lt;&#x2F;strong&gt;: Since clients don&#x27;t need to be registered anymore, any application can implement frictionless feedback leveraging &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Indexing&lt;&#x2F;strong&gt;: Since feedback data is saved on-chain and we suggest using IPFS for full data, it&#x27;s easy to leverage subgraphs to create indexers and improve UX.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Deployment&lt;&#x2F;strong&gt;: We expect the registries to be deployed with singletons per chain. Note that an agent registered and receiving feedback on chain A can still operate and transact on other chains. Agents can also be registered on multiple chains if desired.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;!-- Editor&#x27;s Note: The test cases section should be a list of input&#x2F;output&#x2F;state changes or automated test functions. Simply listing &quot;what to test&quot; is insufficient. --&gt;
&lt;!--

## Test Cases

This protocol enables:

* Crawling all agents starting from a logically centralized endpoint and discover agent information (name, image, services), capabilities, communication endpoints (MCP, A2A, others), ENS names, wallet addresses and which trust models they support (reputation, validation, TEE attestation)
* Building agent explorers and marketplaces using any ERC-721 compatible application to browse, transfer, and manage agents
* Building reputation systems with on-chain aggregation (average scores for smart contract composability) or sophisticated off-chain analysis. All reputation signals are public good.
* Discovering which agents support stake-secured or zkML validation and how to request it through a standardized interface

--&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Sybil attacks are possible, inflating the reputation of fake agents. The protocol&#x27;s contribution is to make signals public and use the same schema. We expect many players to build reputation systems, for example, trusting or giving reputation to reviewers (and therefore filtering by reviewer, as the protocol already enables).&lt;&#x2F;li&gt;
&lt;li&gt;On-chain pointers and hashes cannot be deleted, ensuring audit trail integrity&lt;&#x2F;li&gt;
&lt;li&gt;Validator incentives and slashing are managed by specific validation protocols&lt;&#x2F;li&gt;
&lt;li&gt;While this ERC cryptographically ensures the registration file corresponds to the on-chain agent, it cannot cryptographically guarantee that advertised capabilities are functional and non-malicious. The three trust models (reputation, validation, and TEE attestation) are designed to support this verification need&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Simplified Payment Verification Gateway</title>
        <published>2025-08-07T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Artem Chystiakov</name><uri>https://github.com/arvolear</uri>
	</author>
	
	<author>
		<name>Oleh Komendant</name><uri>https://github.com/Hrom131</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8002/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8002-simplified-payment-verification-gateway/25038" />
        

        <id>https://wg-eips.ritovision.com/8002/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:8002"
            label="ERC-8002" />
        

        
        

        
        <summary type="html">Trustless singleton contract for on-chain verification of Bitcoin transactions through block headers</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8002/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce a singleton contract for on-chain verification of transactions that happened on Bitcoin. The contract is available at &quot;0xTODO&quot; &lt;!-- TODO --&gt;, acting as a trustless Simplified Payment Verification (SPV) gateway where anyone can submit Bitcoin block headers. The gateway maintains the mainchain of blocks and allows the existence of Bitcoin transactions to be verified via Merkle proofs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Ethereum&#x27;s long-term mission has always been to revolutionize the financial world through decentralization, trustlessness, and programmable value enabled by smart contracts. Many great use cases have been discovered so far, including the renaissance of Decentralized Finance (DeFi), emergence of Real-World Assets (RWA), and rise of privacy-preserving protocols.&lt;&#x2F;p&gt;
&lt;p&gt;However, one gem has been unreachable to date -- Bitcoin. Due to its extremely constrained programmability, one can only hold and transfer bitcoins in a trustless manner. This EIP tries to expand its capabilities by laying a solid foundation for bitcoins to be also used in various EVM-based DeFi protocols, unlocking a whole new trillion-dollar market.&lt;&#x2F;p&gt;
&lt;p&gt;The singleton SPV gateway contract defined in this proposal acts as a trustless one-way bridge between Bitcoin and Ethereum, already enabling use cases such as using &lt;em&gt;native&lt;&#x2F;em&gt; BTC as a lending collateral for stablecoin loans. Moreover, with the recent breakthroughs in the BitVM technology, the full-fledged, ownerless two-way bridge may soon become a reality, powering the permissionless and wrapless issuance of BTC on Ethereum.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;general&quot;&gt;General&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;bitcoin-block-header-structure&quot;&gt;Bitcoin Block Header Structure&lt;&#x2F;h4&gt;
&lt;p&gt;In Bitcoin, each block contains a header, which has a fixed size of 80 bytes and follows the following structure:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&quot;text-align: left&quot;&gt;Field&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: left&quot;&gt;Size&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: left&quot;&gt;Format&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: left&quot;&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;Version&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;4 bytes&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;little-endian&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;The version number of the block.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;Previous Block&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;32 bytes&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;natural byte order&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;The block hash of a previous block this block is building on top of.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;Merkle Root&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;32 bytes&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;natural byte order&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;A fingerprint for all of the transactions included in the block.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;Time&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;4 bytes&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;little-endian&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;The current time as a Unix timestamp.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;Bits&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;4 bytes&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;little-endian&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;A compact representation of the current target (difficulty).&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;Nonce&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;4 bytes&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;little-endian&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;A 32-bit number which miners compute to find a valid block hash.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The fields within the block header are sequentially ordered as presented in the table above.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;difficulty-adjustment-mechanism&quot;&gt;Difficulty Adjustment Mechanism&lt;&#x2F;h4&gt;
&lt;p&gt;Bitcoin&#x27;s Proof-of-Work (PoW) consensus mechanism has a probabilistic finality, thus relying on a dynamic &lt;strong&gt;difficulty target&lt;&#x2F;strong&gt; adjustments. The target&#x27;s initial value is set to &lt;code&gt;0x00000000ffff0000000000000000000000000000000000000000000000000000&lt;&#x2F;code&gt;, which also serves as the minimum difficulty threshold.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;target&lt;&#x2F;code&gt; is recalculated every 2016 blocks (approximately every two weeks), a period commonly referred to as a &lt;strong&gt;difficulty adjustment period&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The expected duration for each adjustment period is 1,209,600 seconds (2016 blocks * 10 minutes&#x2F;block). The new &lt;code&gt;target&lt;&#x2F;code&gt; value is derived by multiplying the current &lt;code&gt;target&lt;&#x2F;code&gt; by the ratio of the actual time taken to mine the preceding 2016 blocks to this expected duration.&lt;&#x2F;p&gt;
&lt;p&gt;To prevent drastic difficulty fluctuations, the adjustment multiplier is capped at &lt;code&gt;4x&lt;&#x2F;code&gt; and &lt;code&gt;1&#x2F;4x&lt;&#x2F;code&gt; respectively.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;block-header-validation-rules&quot;&gt;Block Header Validation Rules&lt;&#x2F;h4&gt;
&lt;p&gt;For a Bitcoin block header to be considered valid and accepted into the chain, it MUST adhere to the following consensus rules:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Chain Cohesion&lt;&#x2F;strong&gt;: The &lt;code&gt;Previous Block&lt;&#x2F;code&gt; hash field MUST reference the hash of a valid block that is present in the set of existing block headers.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Timestamp Rules&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;Time&lt;&#x2F;code&gt; field MUST be strictly greater than the &lt;strong&gt;Median Time Past (MTP)&lt;&#x2F;strong&gt; of the previous 11 blocks.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;Time&lt;&#x2F;code&gt; field MUST NOT be more than 2 hours in the future relative to the validating node&#x27;s network-adjusted time.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;PoW Constraint&lt;&#x2F;strong&gt;: When the block header is hashed twice using &lt;code&gt;SHA256&lt;&#x2F;code&gt;, the resulting hash MUST be less than or equal to the current &lt;code&gt;target&lt;&#x2F;code&gt; value, as derived from the difficulty adjustment mechanism.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h4 id=&quot;transaction-inclusion-structure&quot;&gt;Transaction Inclusion Structure&lt;&#x2F;h4&gt;
&lt;p&gt;Every Bitcoin block header has a field &lt;code&gt;Merkle Root&lt;&#x2F;code&gt; that corresponds to a Merkle root of the transactions tree included in this block.&lt;&#x2F;p&gt;
&lt;p&gt;The transactions Merkle tree is built recursively performing double &lt;code&gt;SHA256&lt;&#x2F;code&gt; hash on each pair of sibling nodes, where the tree leaves are the double &lt;code&gt;SHA256&lt;&#x2F;code&gt; hash of the raw transaction bytes. In case the node has no siblings, the hashing is done over the node with itself.&lt;&#x2F;p&gt;
&lt;p&gt;To verify the transaction inclusion into the block, one SHOULD build the Merkle root from the ground up and compare it with the &lt;code&gt;Merkle Root&lt;&#x2F;code&gt; stored in the selected block header. The corresponding Merkle path and hashing direction bits can be obtained and processed by querying a Bitcoin full node.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;mainchain-definition&quot;&gt;Mainchain Definition&lt;&#x2F;h4&gt;
&lt;p&gt;Bitcoin&#x27;s &lt;strong&gt;mainchain&lt;&#x2F;strong&gt; is determined not just by its length, but by the greatest &lt;strong&gt;cumulative PoW&lt;&#x2F;strong&gt; among all valid competing chains. This cumulative work represents the total computational effort expended to mine all blocks within a specific chain.&lt;&#x2F;p&gt;
&lt;p&gt;The work contributed by a single block is inversely proportional to its &lt;code&gt;target&lt;&#x2F;code&gt; value. Specifically, the work of a block can be calculated as &lt;code&gt;(2**256 - 1) &#x2F; (target + 1)&lt;&#x2F;code&gt;. The &lt;code&gt;target&lt;&#x2F;code&gt; value for a block is derived from its &lt;code&gt;Bits&lt;&#x2F;code&gt; field, where the first byte encodes the required left hand bit shift, and the other three bytes the actual target value.&lt;&#x2F;p&gt;
&lt;p&gt;The total cumulative work of a chain is the sum of the work values of all blocks within that chain. A block is considered part of the mainchain if it extends the chain with the greatest cumulative PoW.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;spv-gateway&quot;&gt;SPV Gateway&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;SPVGateway&lt;&#x2F;code&gt; contract MUST provide a permissionless mechanism for its initialization. This mechanism MUST allow for the submission of a valid Bitcoin block header, its corresponding block height, and the cumulative PoW up to that block, without requiring special permissions.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;SPVGateway&lt;&#x2F;code&gt; MUST implement the following interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Interface for a Simplified Payment Verification Gateway contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ISPVGateway&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Represents the essential data contained within a Bitcoin block header&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; prevBlockHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The hash of the previous block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; merkleRoot&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The Merkle root of the transactions in the block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; version&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The block version number&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; time&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The block&amp;#39;s timestamp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The nonce used for mining&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bits&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The encoded difficulty target for the block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BlockHeaderData&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; prevBlockHash&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; merkleRoot&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint32&lt;&#x2F;span&gt;&lt;span&gt; version&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint32&lt;&#x2F;span&gt;&lt;span&gt; time&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint32&lt;&#x2F;span&gt;&lt;span&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes4&lt;&#x2F;span&gt;&lt;span&gt; bits&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST be emitted whenever the mainchain head &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; (e.g. in the `addBlockHeader`, `addBlockHeaderBatch` functions)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MainchainHeadUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newMainchainHeight&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newMainchainHead&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST be emitted whenever the new block header added to the SPV contract state&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * (e.g. in the `addBlockHeader`, `addBlockHeaderBatch` functions)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BlockHeaderAdded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; blockHeight&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; blockHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Adds a single raw block header to the contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * The block header is validated before being added&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; blockHeaderRaw&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The raw block header bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addBlockHeader&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; blockHeaderRaw&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; OPTIONAL Function that adds a batch of the block headers to the contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Each block header is validated and added sequentially&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; blockHeaderRawArray&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of raw block header bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addBlockHeaderBatch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; blockHeaderRawArray&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Checks that given txId is included in the specified block with a minimum number of confirmations.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; merkleProof&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The array of hashes used to build the Merkle root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; blockHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The hash of the block in which to verify the transaction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; txId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The transaction id to verify&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; txIndex&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The index of the transaction in the block&amp;#39;s Merkle tree&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; minConfirmationsCount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The minimum number of confirmations required for the block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; True&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if the txId is present in the block&amp;#39;s Merkle tree and the block has at least minConfirmationsCount confirmations, false otherwise&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checkTxInclusion&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; merkleProof&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; blockHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; txId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; txIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; minConfirmationsCount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the hash of the current mainchain head.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * This represents the highest block on the most accumulated work chain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; hash of the mainchain head&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getMainchainHead&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the height of the current mainchain head.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * This represents the highest block number on the most accumulated work chain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; height of the mainchain head&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getMainchainHeight&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the block header data for a given block hash.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; blockHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The hash of the block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; block header data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getBlockHeader&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; blockHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;BlockHeaderData&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the current status of a given block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; blockHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The hash of the block to check&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; isInMainchain&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; True if the block is in the mainchain, false otherwise&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; confirmationsCount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The number of blocks that have been mined on top of &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * the given block if the block is in the mainchain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getBlockStatus&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; blockHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the Merkle root of a given block hash.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * This function retrieves the Merkle root from the stored block header data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; blockHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The hash of the block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Merkle root of the block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getBlockMerkleRoot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; blockHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the block height for a given block hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * This function retrieves the height at which the block exists in the chain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; blockHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The hash of the block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; height of the block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getBlockHeight&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; blockHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the block hash for a given block height.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * This function retrieves the hash of the block from the mainchain at the specified height&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; blockHeight&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The height of the block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; hash of the block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getBlockHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; blockHeight&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Checks if a block exists in the contract&amp;#39;s storage.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * This function verifies the presence of a block by its hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; blockHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The hash of the block to check&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; True&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if the block exists, false otherwise&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; blockExists&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; blockHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;All fields within the &lt;code&gt;BlockHeaderData&lt;&#x2F;code&gt; struct MUST be converted to big-endian byte order for internal representation and processing within the smart contract.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;addBlockHeader&lt;&#x2F;code&gt; function MUST perform the following checks:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Validate that the submitted raw block header has a fixed size of 80 bytes.&lt;&#x2F;li&gt;
&lt;li&gt;Enforce all block header validation rules as specified in the &quot;Block Header Validation Rules&quot; section.&lt;&#x2F;li&gt;
&lt;li&gt;Integrate the new block header into the known chain by calculating its cumulative PoW and managing potential chain reorganizations as defined in the &quot;Mainchain Definition&quot; section.&lt;&#x2F;li&gt;
&lt;li&gt;Emit a &lt;code&gt;BlockHeaderAdded&lt;&#x2F;code&gt; event upon successful addition of the block header.&lt;&#x2F;li&gt;
&lt;li&gt;Emit a &lt;code&gt;MainchainHeadUpdated&lt;&#x2F;code&gt; event if the mainchain was updated.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;code&gt;checkTxInclusion&lt;&#x2F;code&gt; function MUST perform the following steps:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Check whether the provided &lt;code&gt;blockHash&lt;&#x2F;code&gt; is part of the mainchain and ensure its number of confirmations is at least equal to the &lt;code&gt;minConfirmationsCount&lt;&#x2F;code&gt; parameter. If any of these checks fail, the function MUST return &lt;code&gt;false&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Using the provided &lt;code&gt;merkleProof&lt;&#x2F;code&gt;, &lt;code&gt;txId&lt;&#x2F;code&gt;,  and &lt;code&gt;txIndex&lt;&#x2F;code&gt;, the function MUST compute the Merkle root.&lt;&#x2F;li&gt;
&lt;li&gt;The computed Merkle root MUST be compared against the &lt;code&gt;Merkle Root&lt;&#x2F;code&gt; field stored within the block header identified by &lt;code&gt;blockHash&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If the computed Merkle root matches the stored &lt;code&gt;Merkle Root&lt;&#x2F;code&gt;, the function MUST return &lt;code&gt;true&lt;&#x2F;code&gt;. Otherwise, it MUST return &lt;code&gt;false&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;During the design process of the &lt;code&gt;SPVGateway&lt;&#x2F;code&gt; contract, several decisions have been made that require clarification. The following initialization options of the smart contract were considered:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Hardcoding the Bitcoin genesis block:&lt;&#x2F;strong&gt; This approach is the simplest for contract deployment as it embeds the initial state directly in the code. While offering absolute trustlessness of the starting point, it limits availability, as the full sync of the gateway would cost around ~100 ETH at the gas price of 1 gwei.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Initialization from an arbitrary block height by trusting provided cumulative work and height:&lt;&#x2F;strong&gt; Currently, the gateway adopts this method as its initialization mechanism. While implying trust in the initial submitted values, it&#x27;s a common practice for bootstrapping light clients and can be secured via off-chain mechanisms for initial validation (e.g., community-verified checkpoints).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Initialization with Zero-Knowledge Proof (ZKP) for historical correctness:&lt;&#x2F;strong&gt; This advanced method involves proving the entire history of Bitcoin up to a specific block using ZKP.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Upon submitting the raw block header, the gateway expects the &lt;code&gt;BlockHeaderData&lt;&#x2F;code&gt; fields to be converted to big-endian byte order. This is required to maintain EVM&#x27;s efficiency, which is contrary to Bitcoin&#x27;s native little-endian integer serialization.&lt;&#x2F;p&gt;
&lt;p&gt;There are no &quot;finality&quot; rules in the &lt;code&gt;SPVGateway&lt;&#x2F;code&gt; contract. The determination of such is left to consuming protocols, allowing individual definition to meet required security thresholds.&lt;&#x2F;p&gt;
&lt;p&gt;The inclusion of an OPTIONAL &lt;code&gt;addBlockHeaderBatch&lt;&#x2F;code&gt; function offers significant gas optimizations. For batches exceeding 11 blocks, MTP can be calculated using timestamps from &lt;code&gt;calldata&lt;&#x2F;code&gt;, substantially reducing storage reads and transaction costs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is fully backwards compatible.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;deployment-method&quot;&gt;Deployment Method&lt;&#x2F;h3&gt;
&lt;!-- TODO --&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;!-- TODO --&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;A reference implementation of the &lt;code&gt;SPVGateway&lt;&#x2F;code&gt; contract can be found &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8002&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;SPVGateway.sol&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8002&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;libs&#x2F;TargetsHelper.sol&quot;&gt;&lt;code&gt;TargetsHelper&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; is a supporting library that provides utility functions for working with Bitcoin&#x27;s difficulty targets. It includes methods to convert the &lt;code&gt;Bits&lt;&#x2F;code&gt; field from a block header to the corresponding &lt;code&gt;target&lt;&#x2F;code&gt; value and vice versa, as well as functions to calculate the new difficulty target during adjustment periods.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Please note that the reference implementation depends on the &lt;code&gt;@openzeppelin&#x2F;contracts v5.2.0&lt;&#x2F;code&gt;, &lt;code&gt;@solarity&#x2F;solidity-lib v3.2.0&lt;&#x2F;code&gt; and &lt;code&gt;solady v0.1.23&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Among potential security issues, the following can be noted:&lt;&#x2F;p&gt;
&lt;p&gt;The security of the &lt;code&gt;SPVGateway&lt;&#x2F;code&gt; is directly dependent on the security of Bitcoin&#x27;s underlying PoW consensus. A successful 51% attack on the Bitcoin network would allow an attacker to submit fraudulent block headers that would be accepted by the contract, compromising its state.&lt;&#x2F;p&gt;
&lt;p&gt;The block header validation rules require a Bitcoin node to check that the newly created block is not more than 2 hours ahead of the node&#x27;s network-adjusted time. This check is impossible to implement on the &lt;code&gt;SPVGateway&lt;&#x2F;code&gt; smart contract, hence it is omitted.&lt;&#x2F;p&gt;
&lt;p&gt;Unlike other blockchain systems with deterministic finality, Bitcoin&#x27;s consensus is probabilistic. The &lt;code&gt;SPVGateway&lt;&#x2F;code&gt; contract SHOULD be designed to handle chain reorganizations of arbitrary depth, but it cannot prevent them. As a result, transactions included in a block may not be permanently final. All dApps and protocols relying on this contract MUST implement their own security policies to determine a sufficient number of block confirmations before a transaction is considered &quot;final&quot; for their specific use case.&lt;&#x2F;p&gt;
&lt;p&gt;While the &lt;code&gt;addBlockHeader&lt;&#x2F;code&gt; function is permissionless and validates each new header cryptographically, the contract&#x27;s initial state (its starting block header, height, and cumulative PoW) is a point of trust. The integrity of the entire chain history within the contract is built upon the correctness of this initial data. Although the EIP&#x27;s design allows for flexible bootstrapping, the responsibility for verifying the initial state falls on the community and the dApps that choose to use a specific deployment of the &lt;code&gt;SPVGateway&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Unified multidimensional fee market</title>
        <published>2025-08-04T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Anders Elowsson</name><uri>https://github.com/anderselowsson</uri>
	</author>
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7999/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7999-unified-multidimensional-fee-market/25010" />
        

        <id>https://wg-eips.ritovision.com/7999/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7999"
            label="EIP-7999" />
        

        
        

        
        <summary type="html">Let transactions specify one aggregate `max_fee` budget for all resources, unify fee markets, normalize gas, and generalize EIP-7918.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7999/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;A unified multidimensional fee market is introduced, where each transaction specifies the maximum amount of ETH it is willing to pay for inclusion using a single &lt;code&gt;max_fee&lt;&#x2F;code&gt;. Upon inclusion, the protocol ensures that the transaction is able to pay the gas for all dimensions, treating the &lt;code&gt;max_fee&lt;&#x2F;code&gt; as fungible across resources. This enables a more efficient use of capital, and enshrines the same representation that users have when they interact with Ethereum. The fee market is further unified in terms of a single update fraction under a single fee update mechanism, generalized reserve pricing, and a gas normalization that retains current percentage ranges while keeping the price stable whenever a gas limit changes. Calldata is proposed as the first resource to be added, with avenues for facilitating gas fungibility for EVM resources considered for further expansion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;A multidimensional fee market enables precise control over resource consumption. It allows &lt;em&gt;the market&lt;&#x2F;em&gt; to fairly price resources according to targets and limits deemed safe by developers, and it allows resources to be consumed at maximum capacity within these limits. Directly expanding the current fee market design to the multidimensional setting can however have negative effects on the user experience (UX) and on economic efficiency. Users are forced to set a &lt;code&gt;max_fee_per_gas&lt;&#x2F;code&gt; for each resource, where a too low allocation in any dimension can render the transaction ineligible.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP leverages the natural fungibility of the user&#x27;s fee budget by letting users set a single unified &lt;code&gt;max_fee&lt;&#x2F;code&gt;. Instead of using non-fungible per-resource budgets, the single ETH budget can then be allocated dynamically to cover costs wherever they arise, ensuring a more efficient use of capital. Users will be able to specify a lower &lt;code&gt;max_fee&lt;&#x2F;code&gt; than the implied aggregate maximum unless all base fees are perfectly correlated (which reduces to the current design), because they do not need to buffer for spurious price movements in a single resource dimension.&lt;&#x2F;p&gt;
&lt;p&gt;Ethereum&#x27;s current fee market has &quot;tech debt&quot; in that two separate mechanisms are used: one for regular gas (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt;) and the other for blob gas (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt;). The proposal unifies the fee market under the preferred EIP-4844 design. That design allows for exact control over long-run resource consumption. In a multidimensional setting with individual base fees, we can then for example achieve precise control over state growth, while accommodating temporary spikes. Excess gas of EIP-4844 is further normalized relative to the limit, allowing for a single update fraction across resources that retains current percentage ranges while keeping the price stable if any gas limit changes.&lt;&#x2F;p&gt;
&lt;p&gt;Calldata is added first, to speed up worst-case payload propagation and expand available EVM gas—without compromising gas introspection. A method for facilitating gas aggregation across resources within the EVM is outlined as an avenue for preserving backward compatibility when expanding further. The logic of EIP-7918 is integrated into the multidimensional setting to ensure that calldata has a higher cost per byte than blob data.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The specification inherits its logic from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7706&#x2F;&quot;&gt;EIP-7706&lt;&#x2F;a&gt;, incorporating the changes necessary for facilitating one aggregate fee, a multidimensional &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7918&#x2F;&quot;&gt;EIP-7918&lt;&#x2F;a&gt; logic, a systematic approach to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7805&#x2F;&quot;&gt;EIP-7805&lt;&#x2F;a&gt;, and a stable gas normalization function, etc.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&quot;text-align: left&quot;&gt;Constant&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: left&quot;&gt;Value&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: left&quot;&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;MULTIDIM_TX_TYPE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;TBD&lt;&#x2F;code&gt; &lt;!-- TODO --&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Identifier for the new transaction type&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;EVM_LIMIT_TARGET_RATIO&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;2&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Ratio of EVM gas target to EVM gas limit&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;CALLDATA_GAS_PER_TOKEN&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;4&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Gas cost per token for calldata&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;TOKENS_PER_NONZERO_BYTE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;4&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Tokens per non-zero byte of calldata&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;CALLDATA_GAS_LIMIT_RATIO&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;4&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Ratio of calldata limit to gas limit&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;CALLDATA_LIMIT_TARGET_RATIO&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;4&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Ratio of calldata target to calldata limit&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;GAS_RESERVE_FACTOR&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;[0, 16, 12]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Factor by which the base fee can be below the baseline&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;GAS_RESERVE_INDEX&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;[0, 0, 1]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Index of the base fee to compare against&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;MIN_BASE_FEE_PER_GAS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Minimum base fee per gas unit&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;GAS_NORMALIZATION_FACTOR&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;10**9&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Normalization factor for the delta excess gas&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;BASE_FEE_UPDATE_FRACTION&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;4_245_093_508&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;≈ &lt;code&gt;GAS_NORMALIZATION_FACTOR &#x2F; (2 * ln(1.125))&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;new-transaction-type&quot;&gt;New transaction type&lt;&#x2F;h3&gt;
&lt;p&gt;Upon activation of this EIP via hard fork, a new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; transaction is introduced with &lt;code&gt;TransactionType&lt;&#x2F;code&gt; = &lt;code&gt;MULTIDIM_TX_TYPE&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; &lt;code&gt;TransactionPayload&lt;&#x2F;code&gt; for this transaction is&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[chain_id, nonce, gas_limit, to, value, data, access_list, blob_versioned_hashes, max_fee, max_priority_fee_per_gas, y_parity, r, s]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;We require &lt;code&gt;max_fee&lt;&#x2F;code&gt; to be a scalar integer from &lt;code&gt;0&lt;&#x2F;code&gt; to &lt;code&gt;2**128-1&lt;&#x2F;code&gt; and &lt;code&gt;max_priority_fee_per_gas&lt;&#x2F;code&gt; to be a list of integers from &lt;code&gt;0&lt;&#x2F;code&gt; to &lt;code&gt;2**64-1&lt;&#x2F;code&gt;, either of length 1 or with the same length as the number of resources (initially 3). The &lt;code&gt;gas_limit&lt;&#x2F;code&gt; is initially specified only for the main EVM gas, since other limits can be inferred from the transaction. To facilitate further expansion, the Python spec uses a list with a single element at index 0. Each added integer will range from &lt;code&gt;0&lt;&#x2F;code&gt; to &lt;code&gt;2**64-1&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The intrinsic cost of the new transaction is inherited from EIP-4844, except that the calldata gas cost (16 per non-zero byte, 4 per zero byte) is removed.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;block-processing-and-transaction-fees&quot;&gt;Block processing and transaction fees&lt;&#x2F;h3&gt;
&lt;p&gt;Helpers for vector operations:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; all_less_or_equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;v1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; v2&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; all&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span&gt; y&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; y&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; zip&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;v1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; v2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; vector_add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;v1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; v2&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;y&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; y&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; zip&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;v1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; v2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; vector_mul&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;v1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; v2&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt;y&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; y&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; zip&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;v1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; v2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Helper functions for computing scalar max fees&#x2F;priority fees for all transaction types:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_max_fee&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Transaction&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MULTIDIM_TX_TYPE&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; New tx type already has a max_fee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_fee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    elif&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BLOB_TX_TYPE&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Account for blobs in blob txs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        blob_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;blob_versioned_hashes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GAS_PER_BLOB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_fee_per_blob_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt;blob_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    elif&lt;&#x2F;span&gt;&lt;span&gt; is_eip_1559&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;type&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; EIP-1559 txs have no blobs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Legacy transactions have a gasprice&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gasprice&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_priority_fee&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; list&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; base_fees&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; list&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; remaining_fee&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Precalculate total gas and fees for non-blob resources&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    tip_indices&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    tgas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; sum&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;gas&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; tip_indices&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    tfee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; sum&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;gas&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; base_fees&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; tip_indices&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MULTIDIM_TX_TYPE&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; New tx type: Single tip or full vector of tips&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_priority_fee_per_gas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            tmax_fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; gas&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; base_fees&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Ignore blobs (as now)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            tpriority_fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; tmax_fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; tfee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt; tmax_fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; tfee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            max_priority_fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_priority_fee_per_gas&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; tgas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tpriority_fee&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            max_priority_fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; sum&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;vector_mul&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_priority_fee_per_gas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; gas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;max_priority_fee&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; remaining_fee&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; is_legacy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;type&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Legacy tx: The remainder after base fees paid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        tmax_fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gasprice&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; tgas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; tmax_fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; tfee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt; tmax_fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; tfee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; EIP-1559 or Blob tx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    tmax_fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; tgas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    tpriority_fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; tmax_fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; tfee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt; tmax_fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; tfee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_priority_fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_priority_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; tgas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tpriority_fee&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BLOB_TX_TYPE&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Clamp since blobs reduce the shared max_fee budget&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;max_priority_fee&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; remaining_fee&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; max_priority_fee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The calldata resource pricing under this EIP follows previous gas per byte constants but deprecates the floor pricing specified in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7623&#x2F;&quot;&gt;EIP-7623&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_calldata_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;calldata&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    tokens&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; calldata&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;count&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;calldata&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; calldata&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;count&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TOKENS_PER_NONZERO_BYTE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; tokens&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CALLDATA_GAS_PER_TOKEN&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The helper for calculating gas limits from EIP-7706 is adjusted to subtract calldata gas from the gas limit of old transactions:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_gas_limits&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Transaction&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; list&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    calldata_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_calldata_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    blob_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;getattr&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;blob_versioned_hashes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GAS_PER_BLOB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MULTIDIM_TX_TYPE&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; We use tx.gas_limit as is for new tx type&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; blob_gas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; calldata_gas&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Partition old tx.gas_limit into its execution and calldata components.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span&gt; calldata_gas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        execution_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; calldata_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;execution_gas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; blob_gas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; calldata_gas&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The calculation for the &lt;em&gt;required&lt;&#x2F;em&gt; &lt;code&gt;max_fee&lt;&#x2F;code&gt; to process the transaction is done in a separate function for easy future expansion:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_required_max_fee&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;base_fees&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; list&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; tx_gas_limits&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; list&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; sum&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;vector_mul&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;base_fees&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tx_gas_limits&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;At the start of processing a block&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;initialize a vector &lt;code&gt;gas_used_so_far&lt;&#x2F;code&gt; to &lt;code&gt;[0, 0, 0]&lt;&#x2F;code&gt;,&lt;&#x2F;li&gt;
&lt;li&gt;derive the base fee &lt;code&gt;base_fees = get_block_base_fees(block.parent)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;At the start of processing a transaction&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Derive basic properties of the tx:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;max_fee = get_max_fee(tx)&lt;&#x2F;code&gt;,&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;tx_gas_limits = get_gas_limits(tx)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;max_base = get_required_max_fee(base_fees, tx_gas_limits)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Require that
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;all_less_or_equal(vector_add(gas_used_so_far, tx_gas_limits), gas_limits)&lt;&#x2F;code&gt;. The block&#x27;s &lt;code&gt;gas_limits&lt;&#x2F;code&gt; are defined in the next subsection.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;max_base &amp;lt;= max_fee&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Compute the fees to deduct initially:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;max_priority_fee = get_priority_fee(tx, tx_gas_limits, base_fees, max_fee - max_base)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;fee_to_deduct = max_base + max_priority_fee&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Deduct &lt;code&gt;fee_to_deduct&lt;&#x2F;code&gt; wei from the sender, which we define as the address recovered from the transaction’s signature.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;At the end of processing a transaction&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Compute &lt;code&gt;tx_gas_consumed&lt;&#x2F;code&gt; as a three-item vector, where the first item is the amount of execution gas actually consumed, and the second and third items are the blob and calldata gas amounts, which are equal to their limits from &lt;code&gt;tx_gas_limits&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Burn &lt;code&gt;base_fee_paid = sum(vector_mul(base_fees, tx_gas_consumed))&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Transfer to the coinbase &lt;code&gt;priority_fee_paid = get_priority_fee(tx, tx_gas_consumed, base_fees, fee_to_deduct - base_fee_paid)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Refund the sender &lt;code&gt;fee_to_deduct - base_fee_paid - priority_fee_paid&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Update &lt;code&gt;gas_used_so_far = vector_add(gas_used_so_far, tx_gas_consumed)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;At the end of processing a block&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Require each element of &lt;code&gt;block.gas_used&lt;&#x2F;code&gt; (a vector field in the header) to equal the corresponding element in &lt;code&gt;gas_used_so_far&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;block-structure&quot;&gt;Block structure&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;BlockHeader&lt;&#x2F;code&gt; is updated to remove the &lt;code&gt;blob_gas_used&lt;&#x2F;code&gt;, &lt;code&gt;gas_used&lt;&#x2F;code&gt;, &lt;code&gt;base_fee_per_gas&lt;&#x2F;code&gt;, &lt;code&gt;gas_limit&lt;&#x2F;code&gt; and &lt;code&gt;excess_blob_gas&lt;&#x2F;code&gt; fields, and the following new fields are added, all of the &lt;code&gt;[int, int, int]&lt;&#x2F;code&gt; type: &lt;code&gt;gas_limits&lt;&#x2F;code&gt;, &lt;code&gt;gas_used&lt;&#x2F;code&gt;, &lt;code&gt;excess_gas&lt;&#x2F;code&gt;. The header sequence of the new fields is &lt;code&gt;[..., withdrawals_root, gas_limits, gas_used, excess_gas]&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;We define the &lt;code&gt;gas_limits&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;gas_limits[0]&lt;&#x2F;code&gt; follows the existing adjustment formula based on the parent &lt;code&gt;gas_limits[0]&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;gas_limits[1]&lt;&#x2F;code&gt; must equal &lt;code&gt;blobSchedule.max * GAS_PER_BLOB&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;gas_limits[2]&lt;&#x2F;code&gt; must equal &lt;code&gt;gas_limits[0] &#x2F;&#x2F; CALLDATA_GAS_LIMIT_RATIO&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;and the &lt;code&gt;gas_targets&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;gas_targets[0]&lt;&#x2F;code&gt; must equal &lt;code&gt;gas_limits[0] &#x2F;&#x2F; EVM_LIMIT_TARGET_RATIO&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;gas_targets[1]&lt;&#x2F;code&gt; must equal &lt;code&gt;blobSchedule.target * GAS_PER_BLOB&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;gas_targets[2]&lt;&#x2F;code&gt; must equal &lt;code&gt;gas_limits[2] &#x2F;&#x2F; CALLDATA_LIMIT_TARGET_RATIO&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The blobSchedule for referencing target and max blobs was introduced in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7840&#x2F;&quot;&gt;EIP-7840&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-accounting&quot;&gt;Gas accounting&lt;&#x2F;h3&gt;
&lt;p&gt;We incorporate EIP-7918 to establish a dynamic reserve price for blob and calldata gas. When the market price for a resource drops below its reserve price, the mechanism for reducing its &lt;code&gt;excess_gas&lt;&#x2F;code&gt; (and thus lowering its base fee) is disabled. This leads the base fee to rise with usage until it meets the reserve price.&lt;&#x2F;p&gt;
&lt;p&gt;We normalize the running excess gas so that all resources operate at the same scale with the same &lt;code&gt;BASE_FEE_UPDATE_FRACTION&lt;&#x2F;code&gt;, which also provides a smoother response when any limit is adjusted. Division by &lt;code&gt;gas_limits[i]&lt;&#x2F;code&gt; upholds the same price changes stipulated in EIP-4844 and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7691&#x2F;&quot;&gt;EIP-7691&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calc_excess_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Header&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; list&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    base_fees&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_block_base_fees&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    limits&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limits&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    targets&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_block_gas_targets&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    new_excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;excess_gas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;GAS_RESERVE_FACTOR&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                and&lt;&#x2F;span&gt;&lt;span&gt; base_fees&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GAS_RESERVE_FACTOR&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; base_fees&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;GAS_RESERVE_INDEX&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; EIP-7918 path. Excess gas rises with usage (up to limit), but cannot fall.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            delta&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_used&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;limits&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; targets&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; limits&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;excess_gas&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; delta&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GAS_NORMALIZATION_FACTOR&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; limits&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Regular path. Excess gas rises and falls with usage as normal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_used&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span&gt; targets&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                delta&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_used&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; targets&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;excess_gas&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; delta&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GAS_NORMALIZATION_FACTOR&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; limits&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ..or subtract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                delta&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; targets&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_used&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                deltan&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; delta&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GAS_NORMALIZATION_FACTOR&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; limits&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;excess_gas&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; deltan&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;excess_gas&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; deltan&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        new_excess&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;excess&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; new_excess&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_block_base_fees&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Header&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; list&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        fake_exponential&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;            MIN_BASE_FEE_PER_GAS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            excess&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;            BASE_FEE_UPDATE_FRACTION&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;excess_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;calldatabasefee-instruction&quot;&gt;CALLDATABASEFEE instruction&lt;&#x2F;h3&gt;
&lt;p&gt;We add a &lt;code&gt;CALLDATABASEFEE (0x4b)&lt;&#x2F;code&gt; instruction that returns the calldata base fee of the current block, following the same principles as specified in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7516&#x2F;&quot;&gt;EIP-7516&lt;&#x2F;a&gt; for the blob base fee.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Op&lt;&#x2F;th&gt;&lt;th&gt;Input&lt;&#x2F;th&gt;&lt;th&gt;Output&lt;&#x2F;th&gt;&lt;th&gt;Cost&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;0x4b&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;censorship-resistance&quot;&gt;Censorship resistance&lt;&#x2F;h3&gt;
&lt;p&gt;In EIP-7805, &lt;em&gt;includers&lt;&#x2F;em&gt; propose inclusion-list (IL) transactions that the block builder must include, subject to rules evaluated post-execution once remaining capacity is known. We define three resource types based on these rules:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Conditional resource&lt;&#x2F;em&gt; – An IL transaction consuming this resource &lt;em&gt;must be included&lt;&#x2F;em&gt; if the block has sufficient remaining capacity. If such a transaction is excluded, the block should not be accepted, unless the available space (&lt;code&gt;gas_limit[i] - gas_used[i]&lt;&#x2F;code&gt;) for at least one of its required conditional resources was insufficient to fit the transaction.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;Unconditional resource&lt;&#x2F;em&gt; – An IL transaction consuming this resource &lt;em&gt;must be included&lt;&#x2F;em&gt; as long as sufficient capacity remains for all &lt;em&gt;conditional&lt;&#x2F;em&gt; resources it also uses. A lack of available capacity in the unconditional resource itself is &lt;em&gt;not&lt;&#x2F;em&gt; a valid reason for exclusion.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;Deconditional resource&lt;&#x2F;em&gt; – An IL transaction consuming this resource &lt;em&gt;can always be excluded&lt;&#x2F;em&gt;, regardless of available capacity. For this reason, there is no incentive for includers to list such a transaction.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;If EIP-7805 is implemented, it must: (i) continue to treat EVM gas as a conditional resource; (ii) continue to treat blob gas as a deconditional resource; (iii) treat calldata gas as an unconditional resource. Any transaction listed in an IL that consumes calldata and is excluded from the block, despite there being sufficient capacity in all conditional resources it uses, MUST produce an &lt;code&gt;INVALID_INCLUSION_LIST&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-go-multidimensional&quot;&gt;Why go multidimensional?&lt;&#x2F;h3&gt;
&lt;p&gt;Many Ethereum resources such as blobs, calldata, access, and compute are in limited supply each block, constrained by the need to, e.g., timely propagate data or run computations. Upholding the constraints on all these resources via a single meta-resource—&quot;gas&quot;—limits developers&#x27; ability to control both supply &lt;em&gt;and&lt;&#x2F;em&gt; demand. By going multidimensional, developers gain a more fine-grained control over the supply of each resource, preventing one from encroaching on the allotment for another. Resources can then be consumed at maximum capacity within each specified target and limit. With separate base fees for each resource, the market can come to an agreement on the appropriate price that leads to consumption at maximum capacity, given a specific user demand and aforementioned constraints on its supply. A multidimensional fee market is thus inherently a tool for scaling Ethereum.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;user-experience&quot;&gt;User experience&lt;&#x2F;h3&gt;
&lt;p&gt;Ethereum currently uses &lt;code&gt;max_fee_per_gas&lt;&#x2F;code&gt; for EVM gas and &lt;code&gt;max_fee_per_blob_gas&lt;&#x2F;code&gt; for blob gas. A direct expansion of this approach is proposed in EIP-7706, with a vector of fees per gas for each resource. This may be considered unfortunate from a UX perspective, given that the vector will expand with expanding dimensionality. Our casual users tend to be moderately confused already by a single &lt;code&gt;max_fee_per_gas&lt;&#x2F;code&gt;. Most do not primarily think in terms of the individual prices for the resources that the transaction will consume. They think in terms of how much ETH they need to pay for their transactions (or in terms of dollars&#x2F;fiat). A unified &lt;code&gt;max_fee&lt;&#x2F;code&gt; is in this context an improvement to UX. A unified &lt;code&gt;max_fee_per_gas&lt;&#x2F;code&gt; is possible, but might cause confusion in that the required gas price will differ from the base fees when using several resources—and thus also differ between transactions using different proportions of the resources.&lt;&#x2F;p&gt;
&lt;p&gt;When it comes to the priority fee, the optimal UX between using &lt;code&gt;max_priority_fee&lt;&#x2F;code&gt; and &lt;code&gt;max_priority_fee_per_gas&lt;&#x2F;code&gt; is a bit more nuanced. We decided to use &lt;code&gt;max_priority_fee_per_gas&lt;&#x2F;code&gt;. Ethereum already today unifies the priority fee for blob gas and regular gas under a single &lt;code&gt;max_priority_fee_per_gas&lt;&#x2F;code&gt;. It is thus natural to retain this representation, if only for removing friction for wallets. Furthermore, the priority fee should be determined from actual gas usage and not the gas limit. This is however perfectly possible when using &lt;code&gt;max_priority_fee&lt;&#x2F;code&gt; as well, because the max priority fee can be treated as proportional to the limit during processing, thus falling if less gas is consumed.&lt;&#x2F;p&gt;
&lt;p&gt;Retaining &lt;code&gt;max_priority_fee_per_gas&lt;&#x2F;code&gt; can be considered slightly safer for users, in that they will never risk manually submitting a &lt;code&gt;max_priority_fee&lt;&#x2F;code&gt; for an old transaction type. Advanced users may wish to specify one priority fee per resource, to granularly pay according to usage when consuming below the gas limit. This ability was therefore preserved as an optional vector-based priority fee.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;economic-efficiency&quot;&gt;Economic efficiency&lt;&#x2F;h3&gt;
&lt;p&gt;Besides UX, resource-specific fee limits can also be unfortunate at a deeper economic level. Once a user has specified a &lt;code&gt;gas_limit&lt;&#x2F;code&gt; for any non-deterministic dimension, potentially with the assistance of their wallets, multiple separate &lt;code&gt;max_fee_per_gas&lt;&#x2F;code&gt; could exclude transactions that specify a sufficient aggregate fee, due to a drift in relative levels of the base fees.&lt;&#x2F;p&gt;
&lt;p&gt;Consider a multidimensional transaction with a &lt;code&gt;gas_limit&lt;&#x2F;code&gt; vector $\mathbf{l} = (l_1, l_2,\dots, l_n)$, a &lt;code&gt;max_fee_per_gas&lt;&#x2F;code&gt; vector $\mathbf{f} = (f_1, f_2, \dots, f_n)$, and a &lt;code&gt;max_priority_fee_per_gas&lt;&#x2F;code&gt; vector $\mathbf{p} = (p_1, p_2, \dots, p_n)$. The consumed gas of the transaction is denoted $\mathbf{g} = (g_1, g_2, \dots, g_n)$, and the vector of base fees is denoted $\mathbf{b} = (b_1, b_2, \dots, b_n)$. The realized priority fee, after ensuring a sufficient base fee, is then&lt;&#x2F;p&gt;
&lt;p&gt;$p{\prime}_i = \min(p_i, f_i-b_i)$&lt;&#x2F;p&gt;
&lt;p&gt;for all resources $i$. Assume that when the transaction is submitted, the user specifies a &lt;code&gt;max_fee_per_gas&lt;&#x2F;code&gt; vector $\mathbf{f}$ such that all entries individually satisfy all base fee $\mathbf{b}$  criteria&lt;&#x2F;p&gt;
&lt;p&gt;$f_i \ge b_i \quad \text{for all resources } i.$&lt;&#x2F;p&gt;
&lt;p&gt;The gas limits also satisfy the actual gas consumption&lt;&#x2F;p&gt;
&lt;p&gt;$l_i \ge g_i \quad \text{for all resources } i.$&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;max_priority_fee_per_gas&lt;&#x2F;code&gt; vector $\mathbf{p}$ is also considered sufficient by many proposers, when they jointly weigh the reward against competing transactions using a weight vector $\mathbf{w}$, considering contention across relevant resources:&lt;&#x2F;p&gt;
&lt;p&gt;$\sum p{\prime}_i g_i \ge \sum w_i g_i.$&lt;&#x2F;p&gt;
&lt;p&gt;While not evaluated in the existing EIP, the base fees $\mathbf{b}$ could also be satisfied in aggregate against the max fees:&lt;&#x2F;p&gt;
&lt;p&gt;$\sum f_i l_i \ge \sum b_i l_i.$&lt;&#x2F;p&gt;
&lt;p&gt;Now assume that the base fee for any of the resources rapidly rises before the transaction is included, such that it becomes higher than the &lt;code&gt;max_fee_per_gas&lt;&#x2F;code&gt; in that dimension. In this scenario, the transaction can no longer be included. This may happen, even though the &lt;em&gt;aggregate&lt;&#x2F;em&gt; fees that the user is offering to pay, $\sum f_i l_i$, remain at a level above the aggregate fees that the protocol demands to execute it, $\sum b_i l_i$, just as initially. The aggregate priority fees may still also satisfy the proposer. The welfare loss consists of a user, a proposer, and a protocol willing to process a transaction, hamstrung by rigidity in the protocol design.&lt;&#x2F;p&gt;
&lt;p&gt;The analysis leads to the following conclusions, all of which apply with increasing emphasis the higher the dimensionality:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The UX would be simplified by one aggregate ETH fee.&lt;&#x2F;li&gt;
&lt;li&gt;The protocol would be best served by taking a single aggregate ETH fee from the user.&lt;&#x2F;li&gt;
&lt;li&gt;The proposer already considers the aggregate impact when making its inclusion decision.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Thus, the proposal is that the user specifies a single ETH &lt;code&gt;max_fee&lt;&#x2F;code&gt;. The protocol first ensures that the &lt;code&gt;max_fee&lt;&#x2F;code&gt; $F$ covers the base fee across gas limits in all dimensions, $F &amp;gt; \sum b_i l_i$, and finally charges the minimum aggregate fee possible. The total fee paid to the protocol is thus the same as in the original multidimensional fee market design. The design is future-proof in that additional dimensions easily are incorporated, retaining the single &lt;code&gt;max_fee&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;priority-fee&quot;&gt;Priority fee&lt;&#x2F;h3&gt;
&lt;p&gt;Considerations for the priority fee were already outlined in the UX section. Here, we first expand on why a vector &lt;code&gt;max_priority_fee_per_gas&lt;&#x2F;code&gt; &lt;em&gt;can&lt;&#x2F;em&gt; be beneficial to some users for fine-grained control, but not to most. The user has full control over the priority fee with a single input, as long as gas usage is deterministic across all resources. This input can be either &lt;code&gt;max_priority_fee&lt;&#x2F;code&gt; or &lt;code&gt;max_priority_fee_per_gas&lt;&#x2F;code&gt;—they are equivalent under deterministic gas usage. They are furthermore equivalent under any circumstances if the protocol makes sure to scale the &lt;code&gt;max_priority_fee&lt;&#x2F;code&gt; according to realized gas usage &lt;em&gt;relative&lt;&#x2F;em&gt; to the specified limit. Otherwise, the &lt;code&gt;max_priority_fee&lt;&#x2F;code&gt; will not be reduced when a transaction uses less gas than the limit (this is more often a drawback than a benefit for the user).&lt;&#x2F;p&gt;
&lt;p&gt;The priority fee a user wishes to provide per gas for a resource depends on the (likelihood of) contention across this resource. We can thus expect it to differ between resources. It follows from the principle of degrees of freedom that to gain full control over the transaction&#x27;s priority fee, a user needs a separate parameter for each independent variable. When gas usage is non-deterministic in one resource—as today—the user needs two priority fees to achieve full granularity. When gas usage is non-deterministic in two resources (and their non-deterministic usage is not perfectly correlated), the user needs three priority fees, etc.&lt;&#x2F;p&gt;
&lt;p&gt;It should here be noted that the required priority fee per gas for some resource cannot be directly ascertained from the priority fee per gas that has been stipulated for that resource in recent transactions. Assume that there are 10 resource and each transaction includes a vector stipulating &lt;code&gt;max_priority_fee_per_gas&lt;&#x2F;code&gt; for each. The builder will in its inclusion decision operate on the aggregate, and its requirements across dimensions can thus only be inferred, not observed directly. This means that per-resource estimates of required priority fees are not trivial, and most may still prefer the simplicity of a single one.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;unified-gas-accounting-normalization-and-reserve-pricing-mechanism&quot;&gt;Unified gas accounting, normalization, and reserve pricing mechanism&lt;&#x2F;h3&gt;
&lt;p&gt;Ethereum currently uses two separate fee mechanisms, one for execution gas (EIP-1559) and one for blob gas (EIP-4844). This EIP unifies these mechanisms under the EIP-4844 standard, similar to EIP-7706 but with a few additions. We normalize the excess gas delta by dividing by the gas limit in &lt;code&gt;calc_excess_gas&lt;&#x2F;code&gt;, thus enabling all resources to operate under the same &lt;code&gt;BASE_FEE_UPDATE_FRACTION&lt;&#x2F;code&gt; while also keeping each fee fixed during a hard fork whenever a limit changes.&lt;&#x2F;p&gt;
&lt;p&gt;The reserve pricing mechanism from EIP-7918 is also generalized such that it can be applied to any resource, using another resource as an anchor. The mechanism imposes that if the base fee multiplied by &lt;code&gt;GAS_RESERVE_FACTOR&lt;&#x2F;code&gt; is less than the anchor base fee, the base fee cannot fall any further. Calldata uses blob data as an anchor to ensure that we do not charge less for calldata than blob data (see the separate section on the calldata resource for further details).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;wallet-fee-estimation-logic&quot;&gt;Wallet fee estimation logic&lt;&#x2F;h3&gt;
&lt;p&gt;To suggest a &lt;code&gt;max_fee&lt;&#x2F;code&gt;, the wallet first simulates the transaction to obtain an estimate of the required limit(s) $\mathbf{l}$. It then queries the network for the current vector of base fees $\mathbf{b}$. The expected total fee is $\sum b_i l_i$. The wallet recommends a &lt;code&gt;max_fee&lt;&#x2F;code&gt; that consists of this expected total cost plus a single buffer to account for aggregate volatility in base fees before the transaction is included. To suggest a &lt;code&gt;max_priority_fee_per_gas&lt;&#x2F;code&gt;, the wallet analyzes recent blocks to determine the priority fees that ensure timely inclusion. It focuses on priority fees paid by recently included transactions consuming a similar distribution of resources, as well as overall network contention.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;block-building&quot;&gt;Block building&lt;&#x2F;h3&gt;
&lt;p&gt;Historical data show that around 90% of blocks are below the gas limit. It is only when blocks are full that the builder is constrained in its block construction (disregarding timing games). Furthermore, a multidimensional knapsack problem only manifests in the event that a block is simultaneously full in multiple dimensions. Ignoring blobs, this is expected to be rare with the proposal, since calldata is assigned a limit four times above the target, which is already set higher than current consumption. The calldata limit is thus unlikely to be reached frequently. The blob dimension is a special case, in that this dimension already exists today, and the number of blob-carrying transactions is fairly low. Generally, the impact on revenue from sophisticated packing algorithms will likely be dwarfed by more significant MEV factors such as transaction ordering and private order flow.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;the-calldata-resource&quot;&gt;The calldata resource&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;byte-sizes&quot;&gt;Byte sizes&lt;&#x2F;h4&gt;
&lt;p&gt;Calldata is separated into its own resource. With the proposed constants, at 60M execution gas, each block will on average contain &lt;code&gt;60M&#x2F;(CALLDATA_GAS_LIMIT_RATIO * CALLDATA_LIMIT_TARGET_RATIO) = 3.75M&lt;&#x2F;code&gt; gas of calldata. Focusing on non-zero bytes that cannot be Snappy-compressed, this gas corresponds to around &lt;code&gt;3.75M&#x2F;16 = 234kB&lt;&#x2F;code&gt;. The average block size has been around &lt;code&gt;90kB&lt;&#x2F;code&gt; at a 36M gas limit, which would expand to &lt;code&gt;150kB&lt;&#x2F;code&gt; at a 60M gas limit if the proportion of calldata in the block remains the same. Using basic assumptions, this proposal thus increases the amount of calldata that will be consumed by over 50%, from &lt;code&gt;150kB&lt;&#x2F;code&gt; to &lt;code&gt;234kB&lt;&#x2F;code&gt; at 60M gas. As pointed out in EIP-7706, this will serve to decrease the cost of calldata for our users.&lt;&#x2F;p&gt;
&lt;p&gt;The limit is &lt;code&gt;60M&#x2F;CALLDATA_GAS_LIMIT_RATIO = 15M&lt;&#x2F;code&gt; gas of calldata, corresponding to around &lt;code&gt;15M&#x2F;16 = 938kB&lt;&#x2F;code&gt;. This is well below the limit under the current specification incorporating EIP‑7623, which is &lt;code&gt;60M&#x2F;40 = 1.5MB&lt;&#x2F;code&gt; at 60M gas. Since calldata gas is also no longer accounted for as execution gas, the implied &quot;aggregate&quot; gas limit expands to &lt;code&gt;75M&lt;&#x2F;code&gt; gas, without materially affecting the maximum workload in terms of execution. In conclusion, the separation of calldata into its own resource increases calldata throughput while reducing costs. It furthermore facilitates scaling by allowing for faster payload propagation in the worst case and keeping all EVM gas available for other operations.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;censorship-resistance-1&quot;&gt;Censorship resistance&lt;&#x2F;h4&gt;
&lt;p&gt;For censorship resistance (CR) purposes, under the currently proposed CR implementation EIP-7805, builders must include all transactions surfaced in any of the &lt;code&gt;16&lt;&#x2F;code&gt; inclusion lists (ILs) of each slot (each up to &lt;code&gt;8KiB&lt;&#x2F;code&gt;). However, if the block is full, builders can ignore the ILs, to not incentivize them to influence includers for MEV purposes.&lt;&#x2F;p&gt;
&lt;p&gt;When resources have separate limits, the block is treated as &quot;full&quot; already when any single conditional resource reaches its limit. Transactions that use that resource can then be excluded, even if they were surfaced by an IL. This makes it potentially cheaper to &quot;stuff the block&quot; to censor transactions. Specifically, a builder can create dummy transactions consuming a single resource to fill that dimension, ensuring that the block is treated as &quot;full&quot; when evaluating IL transactions. When resources have separate base fees, the builder may target a resource with a lower base fee, at a cost of roughly $b_i \cdot \Delta g_i$, where $\Delta g_i$ is the additional gas in resource $i$ required to reach its limit.&lt;&#x2F;p&gt;
&lt;p&gt;The good news is that calldata has properties allowing the builder to extract MEV while at the same time unconditionally adhering to its gas limit under EIP-7805. This means that this EIP does not impede censorship resistance. Specifically, in the case where all ILs are filled with disjoint transactions, the aggregate size of included transactions can still be at most &lt;code&gt;8KiB*16 = 131kB&lt;&#x2F;code&gt;. This leaves at the very minimum &lt;code&gt;938kB - 131kB = 807kB&lt;&#x2F;code&gt; of calldata for the builder to use as it sees fit when extracting MEV, which is sufficient according to the usage patterns we know.&lt;&#x2F;p&gt;
&lt;p&gt;Accordingly, calldata is treated as an &quot;unconditional&quot; resource, as defined in the specification. An includer MUST therefore signal &lt;code&gt;INVALID_INCLUSION_LIST&lt;&#x2F;code&gt; if—and only if—a calldata‑using IL transaction is omitted despite sufficient capacity remaining in all conditional resources it uses. When considering expansion into further resources with tighter conditional limits, it may be necessary to adopt a version of FOCIL with ranked transactions (FOCILR).&lt;&#x2F;p&gt;
&lt;h4 id=&quot;reserve-price&quot;&gt;Reserve price&lt;&#x2F;h4&gt;
&lt;p&gt;An EIP-7918 reserve price is used for calldata just as for blobs. This ensures that the equilibrium price does not fall to levels where the fee market update mechanism stops working satisfactorily. Furthermore, the expiry window for blobs is much shorter than the planned rolling expiry window for calldata, making a modest relative reserve price motivated from a resource preservation perspective. Finally, without a reserve price on calldata, it could become cheaper than blob data (particularly below the blob reserve price), and thus a rational choice for L2s.&lt;&#x2F;p&gt;
&lt;p&gt;The latter rationale also motivates the specific parameterization chosen. The EIP-7918 reserve price per byte for calldata is set 1&#x2F;3 above the price per byte for blob data. This is achieved by tying the EIP-7918 if clause to the &lt;em&gt;blob base fee&lt;&#x2F;em&gt;. The gas per byte is 16 for calldata and 1 for blob data, and the price floor is triggered when &lt;code&gt;base_fees[1] &amp;gt; GAS_RESERVE_FACTOR[2] * base_fees[2]&lt;&#x2F;code&gt;. Given &lt;code&gt;GAS_RESERVE_FACTOR[2] = 12&lt;&#x2F;code&gt;, the EIP-7918 condition activates when the blob base fee is more than &lt;code&gt;12&lt;&#x2F;code&gt; times higher than the calldata base fee, at which point calldata costs less than &lt;code&gt;16&#x2F;12 = 1+1&#x2F;3&lt;&#x2F;code&gt; of the blob price per byte. The calldata base fee is then imposed to not fall further.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;relationship-to-previous-eips-and-other-resources&quot;&gt;Relationship to previous EIPs and other resources&lt;&#x2F;h4&gt;
&lt;p&gt;We acknowledge that calldata already has been limited by EIP-7623, with further repricings proposed in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7976&#x2F;&quot;&gt;EIP-7976&lt;&#x2F;a&gt;. These EIPs limit worst-case block sizes by metering and conditionally pricing calldata at the transaction level as opposed to at the block level, having the calldata price vary with a transaction&#x27;s execution usage. This may lead to secondary markets if users wish to combine different transactions to take advantage of the &quot;rebate&quot; on calldata when consumed together with EVM gas. Treating calldata as a separate resource with a price based on block usage would allow for a more precise control over usage, and transactors would not need to interact with a secondary market to achieve the best price.&lt;&#x2F;p&gt;
&lt;p&gt;Given that the EIP-7623 design already achieves calldata moderation, it must be remembered that an individual fee market for calldata would merely be a first step toward a multidimensional fee market. Calldata is not an endgame. It is likely best to transition over several hard forks, and the options available at the present must then be considered, which leads to a focus on calldata. Another present consideration is block level access lists (BALs) and their interaction.&lt;&#x2F;p&gt;
&lt;p&gt;A resource such as state is more attractive to separate than calldata. We could achieve exact control over state growth, while allowing temporary spikes many times above current gas limits. However, an expansion into other resources requires a multidimensional gas repricing, which has currently not yet been completed. The next section will further discuss remaining complexities of multidimensional EVM gas, and the strategies available for overcoming them.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;expansion-paths-for-multiple-evm-resources&quot;&gt;Expansion paths for multiple EVM resources&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP has been designed to facilitate a future expansion into multiple EVM resources. We conclude by outlining the challenges inherent to such an expansion, and the different paths that it can take.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;evm-without-gas-observability&quot;&gt;EVM without gas observability&lt;&#x2F;h4&gt;
&lt;p&gt;One long-term vision for the EVM is to move away from gas observability. This is one of the features of EOF (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7692&#x2F;&quot;&gt;EIP-7692&lt;&#x2F;a&gt;), e.g., through revamped &lt;code&gt;CALL&lt;&#x2F;code&gt; instructions in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7069&#x2F;&quot;&gt;EIP-7069&lt;&#x2F;a&gt; such as &lt;code&gt;EXTCALL&lt;&#x2F;code&gt;. The new calls no longer accept a gas stipend as an input parameter, and the EVM instead makes available some reasonable fraction of all gas across dimensions (e.g., 63&#x2F;64). Legitimate use cases previously handled via gas observability are then instead taken over by, e.g., the &lt;code&gt;PAY&lt;&#x2F;code&gt; opcode &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5920&#x2F;&quot;&gt;EIP-5920&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;For compatibility with legacy code, the EVM can in this scenario reinterpret legacy subcalls with a gas parameter by forwarding the same fraction of the caller’s remaining budget in each resource dimension. Concretely, if the call stipulates $g_c$ and the aggregate remaining EVM-gas budget is $g_a$, the callee receives, for each EVM resource with remaining budget $g_r$, the amount $\bigl\lfloor g_r \cdot \min!\bigl(1,\tfrac{g_c}{g_a}\bigr) \bigr\rfloor$. For completeness, the &lt;code&gt;GAS&lt;&#x2F;code&gt; opcode could likewise return, e.g., $g_a$ (the per-call aggregate remaining budget at this point across all resource dimensions). Note, however, that reinterpreting legacy calls and &lt;code&gt;GAS&lt;&#x2F;code&gt; in this way can still change the behavior of contracts that rely on precise gas observability or gas-capped subcalls, and such contracts may break.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;evm-that-retains-gas-observability&quot;&gt;EVM that retains gas observability&lt;&#x2F;h4&gt;
&lt;p&gt;It is possible to expand into multiple EVM resource dimensions without breaking existing contracts that rely on gas observability. By treating gas as &lt;em&gt;fungible across resources&lt;&#x2F;em&gt; (just as today), a single budget can be forwarded and counted toward any resource that consumes it. It should be noted that old contracts may still break due to repricing of the resources they use; indeed, a gas repricing effort is currently underway in Ethereum that likely will cause such breakage. But this may be treated as a separate concern.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;transaction-types-under-multiple-evm-resources-with-non-deterministic-limits&quot;&gt;Transaction types under multiple EVM resources with non-deterministic limits&lt;&#x2F;h4&gt;
&lt;p&gt;A key difference between the new and old transaction types is that the old transaction types set only one limit, whereas the new can set several. When adding deterministic resources such as calldata, this is not a concern, because consumption of this resource can be deducted from the user-specified limit as a pre-processing step. But once there is more than one non-deterministic resource—as can be the case when EVM gas is separated into several resources—things get slightly more complicated. If we wish to ensure that old transaction types still can function properly under these circumstances, we must apply the single limit to multiple non-deterministic resources. The following subsections will outline how this can be achieved by aggregating the gas of these separate resources during EVM processing.&lt;&#x2F;p&gt;
&lt;p&gt;The new transaction type can supply several limits, making expansion into multiple EVM resources more straightforward. However, it turns out that we may also wish to retain the ability of the new transaction type to set a single limit for EVM gas. The reason is that the single limit and aggregate processing facilitates backward compatibility for contracts that rely on gas observability. As previously noted, these contracts must be able to supply subcalls with an aggregate gas stipend, to be counted against any EVM resource. Furthermore, there is an inherent simplicity of the single limit that is not to be discounted.&lt;&#x2F;p&gt;
&lt;p&gt;In all considered approaches below, the number of non-deterministic EVM resources still increases at the &lt;em&gt;block level&lt;&#x2F;em&gt;. To retain the ability to reject a transaction that may require more gas for a resource than its associated block limit, it becomes necessary to alter the check on &lt;code&gt;gas_used_so_far&lt;&#x2F;code&gt;. Specifically, when a transaction stipulates only the main EVM gas limit, then this limit must be conservatively counted toward all underspecified dimensions of &lt;code&gt;gas_used_so_far&lt;&#x2F;code&gt; before the limit check:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx_gas_limits&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;gas_used_so_far&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Same check as previously&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    all_less_or_equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;vector_add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;gas_used_so_far&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tx_gas_limits&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; gas_limits&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The joint EVM gas limit is expanded to cover all block resources&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    tx_gas_limits_exp&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;tx_gas_limits&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;gas_limits&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    tx_gas_limits_exp&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tx_gas_limits_exp&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; tx_gas_limits&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tx_gas_limits&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    all_less_or_equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;vector_add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;gas_used_so_far&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tx_gas_limits_exp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; gas_limits&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;multidimensional-gas-metering&quot;&gt;Multidimensional gas metering&lt;&#x2F;h4&gt;
&lt;p&gt;An existing proposal by Inês Silva and Crapis is &lt;em&gt;Multidimensional gas metering&lt;&#x2F;em&gt; (not yet submitted as an EIP), which prices gas in one dimension, but applies limits at the block level across several dimensions when updating the (single) EVM base fee. The EVM will thus track multidimensional gas consumption, but perform the limit check on the aggregate, which is also passed on in subcalls. The proposed EIP could be combined with Multidimensional gas metering, for example by using a single EVM gas and calculating metered block gas usage separately, before submitting the outcome as a single resource dimension to the revamped &lt;code&gt;calc_excess_gas()&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;multidimensional-fee-market-with-aggregate-evm-gas&quot;&gt;Multidimensional fee market with aggregate EVM gas&lt;&#x2F;h4&gt;
&lt;p&gt;To promote full resource utilization while maintaining backward compatibility for subcalls and old transaction formats, we could instead use &lt;em&gt;separate&lt;&#x2F;em&gt; gas prices for each EVM resource, while retaining within the EVM the ability to &lt;em&gt;aggregate the gas&lt;&#x2F;em&gt; consumption across resources. We refer to this as a &lt;em&gt;Multidimensional fee market with aggregate gas&lt;&#x2F;em&gt;. In the fully aggregated scenario, the user stipulates a single &lt;code&gt;gas_limit&lt;&#x2F;code&gt; for EVM gas, and the protocol must make sure that the &lt;code&gt;max_fee&lt;&#x2F;code&gt; covers the maximum possible fee, from consuming &lt;code&gt;gas_limit&lt;&#x2F;code&gt; of the EVM resource that has the most expensive base fee. Execution is then fully backward compatible, and the EVM operates the same way as with Multidimensional gas metering.&lt;&#x2F;p&gt;
&lt;p&gt;The downside is that the user must stipulate an unnecessarily high &lt;code&gt;max_fee&lt;&#x2F;code&gt; allocation, if the most expensive resource is not used. We present three options for alleviating this. The first two options transfer to the block producer the responsibility to ensure that the &lt;code&gt;max_fee&lt;&#x2F;code&gt; indeed covers a transaction&#x27;s fees determined post-execution. The third option instead enables the transactor to alternatively provide better guarantees in the form of full gas limits.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Option 1:&lt;&#x2F;em&gt; Invalidate a block when the post-transaction check shows that the total fee for a transaction exceeded &lt;code&gt;max_fee&lt;&#x2F;code&gt;. We could either completely remove the pre-execution check &lt;code&gt;max_fee &amp;gt;= get_required_max_fee(base_fees, tx_gas_limits)&lt;&#x2F;code&gt;, or only check for deterministic resources in addition to EVM gas across the cheapest EVM resource. During processing, there would still be an aggregated check against the transaction&#x27;s gas limit, which is the sender&#x27;s responsibility. In extension, the block&#x27;s gas limit is already safeguarded pre-execution by conservatively counting &lt;code&gt;tx_gas_limits_exp&lt;&#x2F;code&gt; against it, as outlined in the previous subsection.&lt;&#x2F;p&gt;
&lt;p&gt;Note that the inclusion guarantees of EIP-7805 will not apply to the transactions where the &lt;code&gt;max_fee&lt;&#x2F;code&gt; does not cover the worst-case pre-execution check. These transactions are to be ignored when validating the block post-execution.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Option 2:&lt;&#x2F;em&gt; Give the block producer the ability and responsibility to supply any missing funds as part of the post-transaction check. This could potentially rely on staked builders currently envisioned in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7732&#x2F;&quot;&gt;EIP-7732&lt;&#x2F;a&gt;, albeit it would be more intuitive to use execution layer balances for this purpose. Another alternative is to charge a block-based base fee at the end of processing a block rather than per transaction, as has been discussed in the past. This naturally extends to a multidimensional setting. Note that (2) reverts to (1) upon failure of the builder to ensure the base fees are covered.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Option 3:&lt;&#x2F;em&gt; Give the transactor the ability to provide limits for all dimensions, if they so wish. The pre-execution check can then be more fine-grained, inheriting the higher capital efficiency previously outlined. This is a hybrid design, where the transactor can choose the option most suitable to their needs if they use the new transaction type.  This option will be discussed in more detail in the next subsection. Note that (3) can be combined with (1) if desirable.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;multidimensional-fee-market-with-hybrid-evm-gas&quot;&gt;Multidimensional fee market with hybrid EVM gas&lt;&#x2F;h4&gt;
&lt;p&gt;In a &lt;em&gt;Multidimensional fee market with hybrid EVM gas&lt;&#x2F;em&gt;, the user has separate options:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Provide a single gas limit for the EVM resources. The EVM can then operate as in the aggregate gas model, after the initial restrictive fee allocation check.&lt;&#x2F;li&gt;
&lt;li&gt;Provide a gas limit for each EVM resource. Capital efficiency is then preserved. The EVM operates without gas observability as previously outlined, with the gas parameter of old subcalls converted to a multidimensional counterpart. The transaction is during processing checked against its multiple limits, as opposed to the aggregate.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;It is further possible to give the user the freedom to stipulate &lt;em&gt;some&lt;&#x2F;em&gt; EVM gas limits, but not all. The user can for example set the gas limit to 0 for any resource it knows that it will not use, instead of not setting a gas limit for that resource. The aggregation then takes place only across resources without an individual stipulated limit, reducing the required &lt;code&gt;max_fee&lt;&#x2F;code&gt; allocation while preserving full&#x2F;a higher level of backward compatibility. These features come at a cost of somewhat increased complexity.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;specification-for-aggregate-and-hybrid-evm-gas&quot;&gt;Specification for aggregate and hybrid EVM gas&lt;&#x2F;h4&gt;
&lt;p&gt;For the hybrid model, the &lt;code&gt;get_gas_limits()&lt;&#x2F;code&gt; function must be updated to alternatively return multiple EVM gas limits, in the case the user stipulates the full list.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_gas_limits&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Transaction&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; list&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MULTIDIM_TX_TYPE&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; blob_gas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; calldata_gas&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; blob_gas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; calldata_gas&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;For the aggregate model, the &lt;code&gt;get_required_max_fee()&lt;&#x2F;code&gt; must be updated such that the protocol applies the worst-case EVM base fees across the EVM gas. The new constant &lt;code&gt;EVM_INDICES&lt;&#x2F;code&gt; specifies the EVM resource indices. Note that &lt;code&gt;TX_BASE_COST&lt;&#x2F;code&gt; is treated as a deterministic component of the EVM gas to reduce required capital allocation. Note that even when pursuing Options 1-2 for aggregate gas, the aggregation step is still applied in consideration of EIP-7805.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_required_max_fee&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;base_fees&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; list&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; tx_gas_limits&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; list&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Fully specified gas limits, apply baseline pattern&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;base_fees&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx_gas_limits&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; sum&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;vector_mul&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;base_fees&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tx_gas_limits&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Otherwise: 1. TX_BASE_COST is treated deterministically (assumed resource 0)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    determ_evm_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TX_BASE_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; base_fees&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx_gas_limits&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TX_BASE_COST&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;   #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Limit MUST cover TX_BASE_COST.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    variable_evm_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; tx_gas_limits&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TX_BASE_COST&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 2. Determine EVM cost based on most expensive resource&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_evm_base_fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;base_fees&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EVM_INDICES&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    evm_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; determ_evm_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; variable_evm_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; max_evm_base_fee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 3. Return total EVM cost + blob cost + calldata cost&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; evm_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; base_fees&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt;tx_gas_limits&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; base_fees&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt;tx_gas_limits&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;For the hybrid model, the line stipulating &lt;code&gt;tip_indices&lt;&#x2F;code&gt; in &lt;code&gt;get_max_priority_fee()&lt;&#x2F;code&gt; must be updated to include all new EVM resources &lt;code&gt;tip_indices = [2] + EVM_INDICES&lt;&#x2F;code&gt;. It is also feasible to adjust the functioning of legacy transactions, to let them tip only according to the headroom between the EVM resource with the highest base fee and the &lt;code&gt;gasprice&lt;&#x2F;code&gt;. The aim would be to prevent them from having to pay an excessive tip when the &lt;code&gt;gasprice&lt;&#x2F;code&gt; was set high merely to cover for the EVM resource with the highest base fee (of which they use little). The tip would then be calculated as the premium above the highest EVM resource base fee.&lt;&#x2F;p&gt;
&lt;p&gt;To allow transactors to specify &lt;em&gt;some&lt;&#x2F;em&gt; limits, the &lt;code&gt;tx.gas_limit&lt;&#x2F;code&gt; list must instead have a nested format, where &lt;code&gt;gas_limit[0]&lt;&#x2F;code&gt; is the aggregate limit for unspecified EVM resources, and &lt;code&gt;[index, limit]&lt;&#x2F;code&gt; pairs then follow: &lt;code&gt;tx.gas_limit = [aggregate, [[index, limit], [index, limit],...]]&lt;&#x2F;code&gt;. The protocol then computes the required max fee from resources with both specified and unspecified limits. The maximum base fee among the resources with unspecified limits is in this case multiplied with the aggregate, and this fee is summed together with the fees of specified limits.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;max_fee_per_gas&lt;&#x2F;code&gt; of the EIP-1559 and EIP-4844 transaction types are converted to a &lt;code&gt;max_fee&lt;&#x2F;code&gt; by multiplication with the stipulated gas limit(s). The converted EIP-4844 transactions will no longer adhere to the individual &lt;code&gt;max_fee_per_gas&lt;&#x2F;code&gt; and &lt;code&gt;max_fee_per_blob_gas&lt;&#x2F;code&gt;, but instead to the aggregated &lt;code&gt;max_fee&lt;&#x2F;code&gt;. This is a deliberate choice since previous individual checks have lower economic efficiency to no clear benefit, but it should nevertheless be noted by transactors. The priority fee retains the same functionality as previously. The old &lt;code&gt;gasprice&lt;&#x2F;code&gt; can be used both for the &lt;code&gt;max_fee&lt;&#x2F;code&gt; and &lt;code&gt;max_priority_fee_per_gas&lt;&#x2F;code&gt;. The &lt;code&gt;gas_limit&lt;&#x2F;code&gt; is finally derived deterministically. The section on expansion paths outlined how old transactions can retain functionality as we expand into several non-deterministic EVM resources.&lt;&#x2F;p&gt;
&lt;p&gt;Backward compatibility for contracts that rely on gas introspection can be resolved by giving users the ability to rely on aggregated EVM gas, while still potentially pricing EVM resources separately. Wallets must be updated to handle multidimensional gas accounting with several base fees.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;One concern is the risk of increasing builder centralization due to increased revenue from sophisticated packing algorithms. While the builder is constrained in its block construction when blocks are full, it is only when several limits are reached at the same time that packing complexity markedly changes from today. Given that around 90% of blocks are below the gas limit, and the calldata limit is set to be very permissive, we argue that this will happen very rarely.&lt;&#x2F;p&gt;
&lt;p&gt;One reason for using &lt;code&gt;max_priority_fee_per_gas&lt;&#x2F;code&gt; instead of &lt;code&gt;max_priority_fee&lt;&#x2F;code&gt; is to establish the priority fee as always having a non-aggregate representation. We could possibly otherwise imagine a scenario where a user in the old transaction format manually submits an aggregate &lt;code&gt;max_fee&lt;&#x2F;code&gt; and &lt;code&gt;max_priority_fee&lt;&#x2F;code&gt;, causing loss of funds.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Deterministic Factory Predeploy</title>
        <published>2025-08-03T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Francisco Giordano</name><uri>https://github.com/frangio</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7997/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7997-deterministic-factory-predeploy/24998" />
        

        <id>https://wg-eips.ritovision.com/7997/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7997"
            label="EIP-7997" />
        

        
        

        
        <summary type="html">A minimal `CREATE2` factory shared by EVM chains.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7997/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;A minimal &lt;code&gt;CREATE2&lt;&#x2F;code&gt; factory is inserted as a system contract in the precompile range, to enable deterministic deployments at identical addresses across EVM chains. This benefits developer experience, user experience, and security, in particular for multi-chain and cross-chain applications, including account abstraction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;There are now a large number of EVM chains where users want to transact and developers want to deploy applications, and we can expect this number to continue to grow in line with Ethereum&#x27;s rollup-centric roadmap and the general adoption of programmable blockchains.&lt;&#x2F;p&gt;
&lt;p&gt;Most applications support multiple chains and aspire to support as many as possible, and their developers widely prefer to deploy contracts at identical addresses across all chains, a setup which we will call &lt;em&gt;multi-chain deterministic deployment&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This kind of deployment reduces the number of addresses that must be distributed to use the application, so that it no longer scales with the number of supported chains. This simplification has many benefits throughout the stack: interfaces and SDKs need to embed and trust fewer addresses, and other contracts that depend on them can be implemented without chain-specific customization (which in turn makes them amenable to multi-chain deployment).&lt;&#x2F;p&gt;
&lt;p&gt;This kind of deployment is also highly desirable and important for account abstraction. Without it, a user&#x27;s smart contract accounts are deployed at different addresses on different chains, and each account is tied to a single chain. This limitation is difficult to explain to users and has caused loss of funds. If smart contract accounts cannot be multi-chain like EOAs, they offer downgraded UX and are more prone to error.&lt;&#x2F;p&gt;
&lt;p&gt;There is currently no native or fully robust way to perform multi-chain deterministic deployments. While &lt;code&gt;CREATE2&lt;&#x2F;code&gt; enables deterministic deployments, the created address is computed from that of the contract that invokes the instruction, so a &lt;em&gt;factory&lt;&#x2F;em&gt; that is itself multi-chain is required for bootstrapping. Four workarounds are currently known to deploy such a factory, each with their own issues:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;A keyless transaction is crafted using Nick&#x27;s method that can be posted permissionlessly to new chains. For this to work, the chain must support legacy transactions without &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt; replay protection, and the fixed gas price and gas limit must be sufficiently high, but not so high as to exceed the limits of the chain.&lt;&#x2F;li&gt;
&lt;li&gt;Private keys held by some party are used to sign creation transactions for each chain as needed. This creates a dependency on that party, does not provide a hard guarantee that the factory will be available on every chain, and can also irreversibly fail if transactions are not properly parameterized.&lt;&#x2F;li&gt;
&lt;li&gt;A private key is intentionally leaked so that any party can permissionlessly create an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; signed delegation and deploy a factory from the leaked account. While this approach improves on the previous two, its reliance on ECDSA keys makes it non-quantum-resistant, and will fail once chains stop supporting ECDSA keys. Additionally, it requires EIP-7702, an orthogonal feature which is not guaranteed to spread to all chains; for example, those chains that tackle account abstraction through other means have no use for it, and arguably weaker ecosystem pressure to implement it (compared to other EIPs) given that it is a feature not directly used by applications (which instead access AA capabilities through an abstraction like &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5792&#x2F;&quot;&gt;EIP-5792&lt;&#x2F;a&gt;). Lastly, there is a possibility that a future upgrade allows EIP-7702 delegations to become permanent, which breaks this scheme.&lt;&#x2F;li&gt;
&lt;li&gt;Factories already deployed on other chains (by any of the previous methods) are inserted in a new chain at genesis or via a hard fork. This has not been widely adopted by chains, despite the standardization efforts of RIP-7740. Since these factories are applications deployed by users through normal means, this kind of hardcoding of accounts may be seen by chain developers as too intrusive.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;This EIP aims to coordinate a widely available multi-chain &lt;code&gt;CREATE2&lt;&#x2F;code&gt; factory without the above downsides by placing a factory in the precompile range.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;FACTORY_ADDRESS&lt;&#x2F;code&gt; = &lt;code&gt;0x12&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;factory-contract&quot;&gt;Factory Contract&lt;&#x2F;h3&gt;
&lt;p&gt;Upon activation of this EIP, the account at &lt;code&gt;FACTORY_ADDRESS&lt;&#x2F;code&gt; becomes a contract that, when called, invokes the &lt;code&gt;CREATE2&lt;&#x2F;code&gt; instruction (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1014&#x2F;&quot;&gt;EIP-1014&lt;&#x2F;a&gt;) with a salt equal to the first 32 bytes of the call&#x27;s input data, init code equal to the remaining data, and value equal to the call&#x27;s value. If input data is smaller than 32 bytes, the call reverts with empty return data. If creation fails (&lt;code&gt;CREATE2&lt;&#x2F;code&gt; outputs &lt;code&gt;0&lt;&#x2F;code&gt;), the call reverts with return data equal to that of the creation frame.&lt;&#x2F;p&gt;
&lt;p&gt;Specifically, the code of &lt;code&gt;FACTORY_ADDRESS&lt;&#x2F;code&gt; is set to &lt;code&gt;60203610602f5760003560203603806020600037600034f5806026573d600060003e3d6000fd5b60005260206000f35b60006000fd&lt;&#x2F;code&gt;. This code implements the specification above and corresponds to the following assembly:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#pragma target &amp;quot;constantinople&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;;; Input: salt (32 bytes) || initcode (variable size)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;;; Verify input is at least 32 bytes long.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;calldatasize&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;lt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi @throw&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;;; Load salt.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;;; Compute initcodesize = calldatasize - 32.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;calldatasize&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sub&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;;; Copy initcode to memory at position 0.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;calldatacopy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;;; Invoke create2 with salt and initcode, forwarding all callvalue.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;callvalue&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;create2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;;; Check if create2 produced nonzero.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push @success&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;;; Fallthrough if zero, and revert with identical returndata.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;returndatasize&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;returndatacopy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;returndatasize&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;revert&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;;; On success, return the created address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;success:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;throw:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;revert&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;precompile-range-system-contract&quot;&gt;Precompile-range system contract&lt;&#x2F;h3&gt;
&lt;p&gt;Unlike previous system contracts, this factory cannot be deployed using a normal transaction because, as explained in the Motivation section, that transaction could not be guaranteed to be valid on other chains. Since the purpose of this factory is to be available in all EVM chains that a contract could be deployed to, an irregular insertion of the code into a special address seems necessary.&lt;&#x2F;p&gt;
&lt;p&gt;The address &lt;code&gt;0x12&lt;&#x2F;code&gt; (&lt;code&gt;0x0000000000000000000000000000000000000012&lt;&#x2F;code&gt;) is chosen as the next lowest address after currently accepted precompiles, on the assumption that other EVM chains would have reserved this range for future Ethereum precompiles.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;input-validation&quot;&gt;Input validation&lt;&#x2F;h3&gt;
&lt;p&gt;The factory reverts if the input is smaller than 32 bytes, the minimum size that contains the salt, to provide an explicit error when the factory is not correctly invoked.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;no-frontrunning-protection&quot;&gt;No frontrunning protection&lt;&#x2F;h3&gt;
&lt;p&gt;As explained in the Security Considerations, deployments using this factory can potentially be frontrun.&lt;&#x2F;p&gt;
&lt;p&gt;A different factory could avoid this issue if it invokes &lt;code&gt;CREATE2&lt;&#x2F;code&gt; with a salt computed from the caller address in combination with the caller-provided salt input. This prevents frontrunning, but makes deployments permissioned to a deployer account, without the ability to recover permissionless deployments across chains because of the bootstrapping problem this EIP is itself meant to solve.&lt;&#x2F;p&gt;
&lt;p&gt;A factory could also support both permissioned and permissionless deployments by making the mechanism opt-in. However, the addition of this complexity to an otherwise very simple contract was deemed unnecessary, since once the bootstrapping problem is solved, further factories with a more comprehensive set of features and security measures can be deterministically deployed across chains. We expect this to be the case.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;not-a-new-transaction-type&quot;&gt;Not a new transaction type&lt;&#x2F;h3&gt;
&lt;p&gt;An alternative approach would consist of a new creation transaction type where the address of the created contract is computed in a way independent of the transaction origin. A system contract was considered a simpler approach that will be more robust to changes in the base layer in the future or across chains.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;constantinople-target-avoidance-of-push0&quot;&gt;Constantinople target, avoidance of &lt;code&gt;PUSH0&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The system contract is written to avoid the use of newer opcodes such as &lt;code&gt;PUSH0&lt;&#x2F;code&gt; to make it viable to be adopted by chains that don&#x27;t yet support them, decoupling the decision to adopt this EIP from that of adopting other EIPs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;FACTORY_ADDRESS&lt;&#x2F;code&gt; must not be used by other precompiles or predeploys upon activation of this EIP on a chain. The constant must be chosen to minimize likelihood that this happens.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;!-- TODO --&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;frontrunnable-deployments&quot;&gt;Frontrunnable deployments&lt;&#x2F;h3&gt;
&lt;p&gt;The deployment of contracts that read the environment (&lt;code&gt;ORIGIN&lt;&#x2F;code&gt;, &lt;code&gt;NUMBER&lt;&#x2F;code&gt;, etc.) may be frontrun and created with attacker-chosen parameters. It&#x27;s recommended to use this factory to deploy fully deterministic contracts only.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Turn `randao_reveal` into a VRF</title>
        <published>2025-08-03T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alberto La Rocca</name><uri>https://github.com/71104</uri>
	</author>
	
	<author>
		<name>Aryaethn</name><uri>https://github.com/aryaethn</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7998/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7998-turn-randao-reveal-into-a-vrf/24999" />
        

        <id>https://wg-eips.ritovision.com/7998/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7998"
            label="EIP-7998" />
        

        
        

        
        <summary type="html">Transforms Ethereum’s `randao_reveal` into a per-slot BLS-based VRF by signing the previous epoch’s mix and current slot.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7998/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes a modification to the data signed by a block proposer for the &lt;code&gt;randao_reveal&lt;&#x2F;code&gt;. The current &lt;code&gt;randao_reveal&lt;&#x2F;code&gt; is a BLS signature over the current epoch number, which is predictable. This proposal incorporates the RANDAO mix of the previous epoch and the current slot number into the signed data. This change transforms the &lt;code&gt;randao_reveal&lt;&#x2F;code&gt; into a Verifiable Random Function (VRF), making it unpredictable across epochs even for the revealer itself. This enhancement strengthens Ethereum&#x27;s native randomness source and enables protocols such as Single Secret Leader Election (SSLE).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This change creates a secure, per-slot VRF output from the proposer, with several benefits:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;it &lt;strong&gt;paves the way for secret proposer election&lt;&#x2F;strong&gt;, which would in turn reduce MEV and completely eliminate the well-known RANDAO bias attack vector;&lt;&#x2F;li&gt;
&lt;li&gt;it supports other proposals like &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7956&#x2F;&quot;&gt;EIP-7956&lt;&#x2F;a&gt; that rely on a source of verifiable randomness.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Using a BLS signature as a VRF is sound under the Computational Diffie-Hellman (CDH) assumption, rather than Decisional Diffie-Hellman. The BLS verification process inherently proves the correctness of the VRF output without requiring a separate proof.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc2119&quot;&gt;RFC 2119&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc8174&quot;&gt;RFC 8174&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The gist of the change is in &lt;code&gt;process_randao&lt;&#x2F;code&gt;, which now uses the RANDAO mix of the previous epoch and the current slot number to seed the &lt;code&gt;randao_reveal&lt;&#x2F;code&gt; signature. We are introducing a new SSZ-serializable container called &lt;code&gt;RandaoRevealSeed&lt;&#x2F;code&gt; containing that information.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;new-ssz-container&quot;&gt;New SSZ Container&lt;&#x2F;h3&gt;
&lt;p&gt;A new SSZ &lt;code&gt;Container&lt;&#x2F;code&gt; is introduced to serve as the message for the &lt;code&gt;randao_reveal&lt;&#x2F;code&gt; signature post-fork.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RandaoRevealSeed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    previous_mix&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; last RANDAO mix of the previous epoch&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    slot&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;             #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; current slot number&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;modified-process-randao&quot;&gt;Modified &lt;code&gt;process_randao&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The block processing function &lt;code&gt;process_randao&lt;&#x2F;code&gt; in the beacon state transition is modified.&lt;&#x2F;p&gt;
&lt;p&gt;Let &lt;code&gt;FORK_EPOCH&lt;&#x2F;code&gt; be the epoch of the network upgrade.&lt;&#x2F;p&gt;
&lt;p&gt;The logic for verifying &lt;code&gt;body.randao_reveal&lt;&#x2F;code&gt; within &lt;code&gt;process_randao&lt;&#x2F;code&gt; is updated as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; process_randao&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; body&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconBlockBody&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_current_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify RANDAO reveal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    proposer&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validators&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;get_beacon_proposer_index&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; FORK_EPOCH&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        signing_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; compute_signing_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;epoch&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; get_domain&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; DOMAIN_RANDAO&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        previous_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_previous_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        previous_mix&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_randao_mix&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; previous_epoch&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        seed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; RandaoRevealSeed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;previous_mix&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        signing_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; compute_signing_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;seed&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; get_domain&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; DOMAIN_RANDAO&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; bls&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;Verify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;proposer&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pubkey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signing_root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; body&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;randao_reveal&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Mix in RANDAO reveal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    mix&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; xor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;get_randao_mix&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; epoch&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;body&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;randao_reveal&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;randao_mixes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EPOCHS_PER_HISTORICAL_VECTOR&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; mix&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;choice-of-vrf-input&quot;&gt;Choice of VRF Input&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;randao_reveal&lt;&#x2F;code&gt; is effectively transformed into &lt;code&gt;VRF(sk, message)&lt;&#x2F;code&gt; where the &lt;code&gt;message&lt;&#x2F;code&gt; is the SSZ serialization of the &lt;code&gt;RandaoRevealSeed&lt;&#x2F;code&gt; container.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;previous_mix&lt;&#x2F;code&gt;: Including the RANDAO mix from the previous epoch (&lt;code&gt;previous_mix&lt;&#x2F;code&gt;) is the core of this proposal. Since the previous epoch&#x27;s final mix is not known until the end of that epoch, a proposer cannot compute their &lt;code&gt;randao_reveal&lt;&#x2F;code&gt; of future epochs, beforehand.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;slot&lt;&#x2F;code&gt;: Including the current &lt;code&gt;slot&lt;&#x2F;code&gt; number ensures that the &lt;code&gt;randao_reveal&lt;&#x2F;code&gt; is unique for each slot and unpredictable to other validators. Without it, a validator chosen to propose multiple times in an epoch would produce the same reveal, which is undesirable for protocols that require unique randomness per instance, such as SSLE.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;alternatives-considered&quot;&gt;Alternatives Considered&lt;&#x2F;h3&gt;
&lt;p&gt;We considered adding the &lt;em&gt;latest&lt;&#x2F;em&gt; RANDAO mix rather than that from the previous epoch so that we could obtain per-slot unpredictability, but that would cause fork ambiguity in the future if &lt;code&gt;randao_reveal&lt;&#x2F;code&gt; is used to implement SSLE.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a backwards-incompatible change to the consensus rules and MUST be activated as part of a scheduled network upgrade (i.e., a hard fork).&lt;&#x2F;p&gt;
&lt;p&gt;Blocks produced after the &lt;code&gt;FORK_EPOCH&lt;&#x2F;code&gt; that do not use the new &lt;code&gt;RandaoRevealSeed&lt;&#x2F;code&gt; structure for the &lt;code&gt;randao_reveal&lt;&#x2F;code&gt; signature SHALL be considered invalid. Pre-fork blocks remain valid under the old rules.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;vrf-security&quot;&gt;VRF Security&lt;&#x2F;h3&gt;
&lt;p&gt;The security of the BLS signature scheme as a VRF relies on the Computational Diffie-Hellman (CDH) assumption in the target group. This is a standard cryptographic assumption. The output of the signature (a uniformly distributed G2 point in compressed format) can be treated as a pseudorandom number.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;grinding&quot;&gt;Grinding&lt;&#x2F;h3&gt;
&lt;p&gt;The value of &lt;code&gt;randao_reveal&lt;&#x2F;code&gt; is deterministic and cannot be manipulated. It will be verified with the public BLS key of the validator, so it must be calculated using the corresponding private key. There are no grindable elements.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;slot-by-slot-unpredictability&quot;&gt;Slot-by-slot Unpredictability&lt;&#x2F;h3&gt;
&lt;p&gt;Including the slot number is superfluous at the moment because it does not make the VRF slot-by-slot unpredictable to the revealer, only to other validators. But it will become critical in the future if and when we decide to implement secret proposer election and&#x2F;or EIP-7956.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Agent Coordination Framework</title>
        <published>2025-08-02T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Kwame Bryan</name><uri>https://github.com/KBryan</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8001/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-8001-secure-intents-a-cryptographic-framework-for-autonomous-agent-coordination-draft-erc-8001/24989" />
        

        <id>https://wg-eips.ritovision.com/8001/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:8001"
            label="ERC-8001" />
        

        
        

        
        <summary type="html">Minimal, single-chain, multi-party agent coordination using EIP-712 attestations</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8001/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8001&#x2F;&quot;&gt;ERC-8001&lt;&#x2F;a&gt; defines a minimal, single-chain primitive for &lt;strong&gt;multi-party agent coordination&lt;&#x2F;strong&gt;. An initiator posts an intent and each participant provides a verifiable acceptance attestation. Once the required set of acceptances is present and fresh, the intent is executable. The standard specifies typed data, lifecycle, mandatory events, and verification rules compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;ERC-1271&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2098&#x2F;&quot;&gt;EIP-2098&lt;&#x2F;a&gt;, and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5267&#x2F;&quot;&gt;EIP-5267&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8001&#x2F;&quot;&gt;ERC-8001&lt;&#x2F;a&gt; omits privacy, reputation, threshold policies, bonding, and cross-chain semantics. Those are expected as optional modules that reference this specification.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Agents in DeFi&#x2F;MEV&#x2F;Web3 Gaming and Agentic Commerce often need to act together without a trusted coordinator. Existing intent standards (e.g., &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7521&#x2F;&quot;&gt;ERC-7521&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7683&#x2F;&quot;&gt;ERC-7683&lt;&#x2F;a&gt;) define single-initiator flows and do not specify multi-party agreement.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8001&#x2F;&quot;&gt;ERC-8001&lt;&#x2F;a&gt; specifies the smallest on-chain primitive for that gap: an initiator&#x27;s &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; intent plus per-participant &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt;&#x2F;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;EIP-1271&lt;&#x2F;a&gt; acceptances. The intent becomes executable only when the required set of acceptances is present and unexpired. Canonical (sorted-unique) participant lists and standard typed data provide replay safety and wallet compatibility. Privacy, thresholds, bonding, and cross-chain are left to modules.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords “MUST”, “SHOULD”, and “MAY” are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;Implementations MUST expose the following canonical status codes for &lt;code&gt;getCoordinationStatus&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;h3 id=&quot;status-codes&quot;&gt;Status Codes&lt;&#x2F;h3&gt;
&lt;p&gt;Implementations MUST use the canonical enum defined below:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Status&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt; Proposed&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt; Ready&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt; Executed&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt; Cancelled&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt; Expired&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;None&lt;&#x2F;code&gt; = default zero state (intent not found)&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;Proposed&lt;&#x2F;code&gt; = intent proposed, not all acceptances yet&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;Ready&lt;&#x2F;code&gt; = all participants have accepted, intent executable&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;Executed&lt;&#x2F;code&gt; = intent successfully executed&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;Cancelled&lt;&#x2F;code&gt; = intent explicitly cancelled&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;Expired&lt;&#x2F;code&gt; = intent expired before execution&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;overview&quot;&gt;Overview&lt;&#x2F;h3&gt;
&lt;p&gt;This ERC specifies:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A canonicalised EIP-712 domain for agent coordination,&lt;&#x2F;li&gt;
&lt;li&gt;Typed data structures (&lt;code&gt;AgentIntent&lt;&#x2F;code&gt;, &lt;code&gt;CoordinationPayload&lt;&#x2F;code&gt;, &lt;code&gt;AcceptanceAttestation&lt;&#x2F;code&gt;),&lt;&#x2F;li&gt;
&lt;li&gt;Deterministic hashing rules,&lt;&#x2F;li&gt;
&lt;li&gt;A standard interface (&lt;code&gt;IAgentCoordination&lt;&#x2F;code&gt;),&lt;&#x2F;li&gt;
&lt;li&gt;Lifecycle semantics (propose → accept → execute&#x2F;cancel),&lt;&#x2F;li&gt;
&lt;li&gt;Error surface and status codes.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;eip-712-domain&quot;&gt;EIP-712 Domain&lt;&#x2F;h3&gt;
&lt;p&gt;Implementations MUST use the following EIP-712 domain:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{name: &amp;quot;ERC-8001&amp;quot;, version: &amp;quot;1&amp;quot;, chainId, verifyingContract}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Implementations SHOULD expose the domain via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5267&#x2F;&quot;&gt;ERC-5267&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;primary-types&quot;&gt;Primary Types&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AgentIntent&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; payloadHash&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;           &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; keccak256(CoordinationPayload)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint64&lt;&#x2F;span&gt;&lt;span&gt;  expiry&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; unix seconds; MUST be &amp;gt; block.timestamp at propose&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint64&lt;&#x2F;span&gt;&lt;span&gt;  nonce&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                 &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; per-agent nonce; MUST be &amp;gt; agentNonces[agentId]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; agentId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;               &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; initiator and signer of the intent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; coordinationType&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; domain-specific type id, e.g. keccak256(&amp;quot;MEV_SANDWICH_COORD_V1&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; coordinationValue&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; informational in Core; modules MAY bind value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; participants&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; unique, ascending; MUST include agentId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CoordinationPayload&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; version&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;               &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; payload format id&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; coordinationType&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST equal AgentIntent.coordinationType&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span&gt;   coordinationData&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; opaque to Core&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; conditionsHash&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; domain-specific&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; timestamp&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;             &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; creation time (informational)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span&gt;   metadata&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;              &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; optional&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AcceptanceAttestation&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; intentHash&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; getIntentHash(intent)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; participant&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;           &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; signer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint64&lt;&#x2F;span&gt;&lt;span&gt;  nonce&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                 &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; optional in Core; see Nonces&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint64&lt;&#x2F;span&gt;&lt;span&gt;  expiry&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; acceptance validity; MUST be &amp;gt; now at accept and execute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; conditionsHash&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; participant constraints&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span&gt;   signature&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;             &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ECDSA (65 or 64 bytes) or ERC-1271&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;typed-data-hashes&quot;&gt;Typed Data Hashes&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; AGENT_INTENT_TYPEHASH &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;  &amp;quot;AgentIntent(bytes32 payloadHash,uint64 expiry,uint64 nonce,address agentId,bytes32 coordinationType,uint256 coordinationValue,address[] participants)&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; ACCEPTANCE_TYPEHASH &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Field names MUST exactly match the Solidity struct.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;  &amp;quot;AcceptanceAttestation(bytes32 intentHash,address participant,uint64 nonce,uint64 expiry,bytes32 conditionsHash)&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; participants MUST be unique and strictly ascending by uint160(address).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _participantsHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ps&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ps&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _agentIntentStructHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;AgentIntent&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      AGENT_INTENT_TYPEHASH&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      i&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;payloadHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      i&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;expiry&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      i&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      i&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;agentId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      i&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;coordinationType&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      i&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;coordinationValue&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      _participantsHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;participants&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Full EIP-712 digest for the initiator’s signature.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _agentIntentDigest&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; domainSeparator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; AgentIntent&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;\x19\x01&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; domainSeparator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _agentIntentStructHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _acceptanceStructHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;AcceptanceAttestation&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; a&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; a.intentHash MUST be the AgentIntent struct hash, not the digest.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ACCEPTANCE_TYPEHASH&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      a&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;intentHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      a&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;participant&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      a&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      a&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;expiry&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      a&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;conditionsHash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _acceptanceDigest&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; domainSeparator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; AcceptanceAttestation&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; a&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;\x19\x01&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; domainSeparator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _acceptanceStructHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;a&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Computation (normative):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;participantsHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;participants&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; sorted unique&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;intentStructHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  AGENT_INTENT_TYPEHASH&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  payloadHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; expiry&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; agentId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; coordinationType&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; coordinationValue&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; participantsHash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;intentDigest &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;\x19\x01&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span&gt; domainSeparator &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span&gt; intentStructHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Clarifications (normative):&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;getIntentHash(intent)&lt;&#x2F;code&gt; MUST return &lt;code&gt;intentStructHash&lt;&#x2F;code&gt; (struct hash), not the full digest.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;AcceptanceAttestation.intentHash&lt;&#x2F;code&gt; MUST be that struct hash.&lt;&#x2F;li&gt;
&lt;li&gt;Each acceptance is signed over its own EIP-712 digest that includes this field.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;participants&lt;&#x2F;code&gt; MUST be strictly ascending by &lt;code&gt;uint160(address)&lt;&#x2F;code&gt; and deduplicated.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;interface&quot;&gt;Interface&lt;&#x2F;h3&gt;
&lt;p&gt;Implementations &lt;strong&gt;MUST&lt;&#x2F;strong&gt; expose the following interface and events.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IAgentCoordination&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CoordinationProposed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; intentHash&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; proposer&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; coordinationType&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; participantCount&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; coordinationValue&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CoordinationAccepted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; intentHash&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; participant&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; acceptanceHash&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; acceptedCount&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; requiredCount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CoordinationExecuted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; intentHash&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; executor&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; gasUsed&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CoordinationCancelled&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; intentHash&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; canceller&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; reason&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; finalStatus&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; proposeCoordination&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;AgentIntent&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; intent&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; CoordinationPayload&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; payload&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; intentHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; acceptCoordination&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; intentHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; AcceptanceAttestation&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attestation&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; allAccepted&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; executeCoordination&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; intentHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; CoordinationPayload&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; payload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; executionData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; cancelCoordination&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; intentHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; reason&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getCoordinationStatus&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; intentHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Status&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; status&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; proposer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; participants&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; acceptedBy&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expiry&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getRequiredAcceptances&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; intentHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getAgentNonce&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; agent&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;semantics&quot;&gt;Semantics&lt;&#x2F;h3&gt;
&lt;p&gt;The functions defined in this specification MUST exhibit the following externally observable behaviours.&lt;br &#x2F;&gt;
This standard does NOT prescribe storage layout, execution model, or internal mechanisms.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;proposecoordination&quot;&gt;&lt;code&gt;proposeCoordination&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;proposeCoordination&lt;&#x2F;code&gt; MUST revert if:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;the signature does not validate the supplied &lt;code&gt;AgentIntent&lt;&#x2F;code&gt; under the ERC-8001 EIP-712 domain;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;intent.expiry &amp;lt;= block.timestamp&lt;&#x2F;code&gt;;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;intent.nonce&lt;&#x2F;code&gt; is not strictly greater than &lt;code&gt;getAgentNonce(intent.agentId)&lt;&#x2F;code&gt;;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;participants&lt;&#x2F;code&gt; is not strictly ascending and unique;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;intent.agentId&lt;&#x2F;code&gt; is not included in the participants list.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;If valid:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;CoordinationProposed&lt;&#x2F;code&gt; MUST be emitted;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;getCoordinationStatus&lt;&#x2F;code&gt; MUST report &lt;code&gt;Proposed&lt;&#x2F;code&gt;;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;getAgentNonce(intent.agentId)&lt;&#x2F;code&gt; MUST equal the supplied nonce;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;getRequiredAcceptances(intentHash)&lt;&#x2F;code&gt; MUST equal the number of participants.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;acceptcoordination&quot;&gt;&lt;code&gt;acceptCoordination&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;acceptCoordination&lt;&#x2F;code&gt; MUST revert if:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;the intent does not exist or has expired;&lt;&#x2F;li&gt;
&lt;li&gt;the caller is not listed as a participant;&lt;&#x2F;li&gt;
&lt;li&gt;the participant has already accepted;&lt;&#x2F;li&gt;
&lt;li&gt;the attestation signature does not validate under the ERC-8001 domain;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;attestation.expiry &amp;lt;= block.timestamp&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;If valid:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;CoordinationAccepted&lt;&#x2F;code&gt; MUST be emitted;&lt;&#x2F;li&gt;
&lt;li&gt;the participant MUST appear in the &lt;code&gt;acceptedBy&lt;&#x2F;code&gt; list returned by &lt;code&gt;getCoordinationStatus&lt;&#x2F;code&gt;;&lt;&#x2F;li&gt;
&lt;li&gt;if all participants have accepted:
&lt;ul&gt;
&lt;li&gt;the function MUST return &lt;code&gt;true&lt;&#x2F;code&gt;;&lt;&#x2F;li&gt;
&lt;li&gt;status MUST be &lt;code&gt;Ready&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Otherwise the function MUST return &lt;code&gt;false&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;executecoordination&quot;&gt;&lt;code&gt;executeCoordination&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;executeCoordination&lt;&#x2F;code&gt; MUST revert if:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;the intent is not in &lt;code&gt;Ready&lt;&#x2F;code&gt; state;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;intent.expiry &amp;lt;= block.timestamp&lt;&#x2F;code&gt;;&lt;&#x2F;li&gt;
&lt;li&gt;any acceptance has expired;&lt;&#x2F;li&gt;
&lt;li&gt;the supplied payload does not hash to &lt;code&gt;payloadHash&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;If valid:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;the implementation MUST attempt execution of the behaviour represented by &lt;code&gt;executionData&lt;&#x2F;code&gt;;&lt;&#x2F;li&gt;
&lt;li&gt;the function MUST return &lt;code&gt;(success, result)&lt;&#x2F;code&gt;;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CoordinationExecuted&lt;&#x2F;code&gt; MUST be emitted;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;getCoordinationStatus&lt;&#x2F;code&gt; MUST report &lt;code&gt;Executed&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;cancelcoordination&quot;&gt;&lt;code&gt;cancelCoordination&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;If the intent has not expired, only the proposer MUST be permitted to cancel.&lt;&#x2F;li&gt;
&lt;li&gt;After expiry, any caller MUST be permitted to cancel.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;On success:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;CoordinationCancelled&lt;&#x2F;code&gt; MUST be emitted;&lt;&#x2F;li&gt;
&lt;li&gt;status MUST be &lt;code&gt;Cancelled&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;getcoordinationstatus&quot;&gt;&lt;code&gt;getCoordinationStatus&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;getCoordinationStatus(intentHash)&lt;&#x2F;code&gt; MUST return:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;None&lt;&#x2F;code&gt; if the intent does not exist;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Proposed&lt;&#x2F;code&gt; if not all participants have accepted and the intent has not expired;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Ready&lt;&#x2F;code&gt; if all participants have accepted and expiries have not elapsed;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Executed&lt;&#x2F;code&gt; if execution has occurred;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Cancelled&lt;&#x2F;code&gt; if cancellation has occurred;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Expired&lt;&#x2F;code&gt; if the intent has expired and was not executed or cancelled.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;nonces&quot;&gt;Nonces&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;getAgentNonce(agent)&lt;&#x2F;code&gt; MUST increase for every valid new intent.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;proposeCoordination&lt;&#x2F;code&gt; MUST reject nonces not strictly greater than the stored nonce.&lt;&#x2F;li&gt;
&lt;li&gt;Acceptance-level nonces MAY be implemented; if so, they MUST be strictly monotonic per participant.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;errors&quot;&gt;Errors&lt;&#x2F;h3&gt;
&lt;p&gt;Implementations SHOULD revert with descriptive custom errors (or equivalent revert strings) for the following baseline conditions, and MAY define additional errors for domain-specific modules (e.g. slashing, reputation, or privacy conditions):&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Expired intent&lt;&#x2F;li&gt;
&lt;li&gt;Bad signature&lt;&#x2F;li&gt;
&lt;li&gt;Non-participant&lt;&#x2F;li&gt;
&lt;li&gt;Duplicate acceptance&lt;&#x2F;li&gt;
&lt;li&gt;Acceptance expired at execute&lt;&#x2F;li&gt;
&lt;li&gt;Payload hash mismatch&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC8001_NotProposer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC8001_ExpiredIntent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC8001_ExpiredAcceptance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; participant&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC8001_BadSignature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC8001_NotParticipant&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC8001_DuplicateAcceptance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC8001_ParticipantsNotCanonical&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC8001_NonceTooLow&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC8001_PayloadHashMismatch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC8001_NotReady&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Sorted participant lists remove hash malleability and allow off-chain deduplication.&lt;&#x2F;li&gt;
&lt;li&gt;Separation of intent and acceptance allows off-chain collation and a single on-chain check.&lt;&#x2F;li&gt;
&lt;li&gt;Keeping &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8001&#x2F;&quot;&gt;ERC-8001&lt;&#x2F;a&gt; single-chain avoids coupling to bridge semantics and keeps the primitive audit-friendly.&lt;&#x2F;li&gt;
&lt;li&gt;Wallet friendliness: EIP-712 arrays let signers see actual participant addresses.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8001&#x2F;&quot;&gt;ERC-8001&lt;&#x2F;a&gt; introduces a new interface. It is compatible with EOA and contract wallets via ECDSA and ERC-1271. It does not modify existing standards.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;A permissive reference implementation is provided in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8001&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;AgentCoordination.sol&quot;&gt;&lt;code&gt;contracts&#x2F;AgentCoordination.sol&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;. It uses a minimal ECDSA helper and supports ERC-1271 signers. It enforces participant canonicalisation, intent nonces, acceptance freshness, and all-participants policy.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Replay&lt;&#x2F;strong&gt;: EIP-712 domain binding and monotonic nonces prevent cross-contract replay.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Malleability&lt;&#x2F;strong&gt;: Low-s enforcement and 64&#x2F;65-byte signature support are required.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Equivocation&lt;&#x2F;strong&gt;: A participant can sign conflicting intents. Mitigate with module-level slashing or reputation.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Liveness&lt;&#x2F;strong&gt;: Enforce TTL on both intent and acceptances. Executors should ensure enough time remains.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;MEV&lt;&#x2F;strong&gt;: If &lt;code&gt;coordinationData&lt;&#x2F;code&gt; reveals strategy, use a Privacy module with commit-reveal or encryption.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Purpose-Bound ERC-20 with Conditional Unlock</title>
        <published>2025-07-29T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Anushka Yadav</name><uri>https://github.com/64anushka</uri>
	</author>
	
	<author>
		<name>Akash Kothawade</name><uri>https://github.com/akash3927</uri>
	</author>
	
	<author>
		<name>Atishek Singh</name><uri>https://github.com/atisheksingh</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7994/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7994-purpose-bound-erc20-with-multi-condition-unlocking-extension-of-eip-7291/24945" />
        

        <id>https://wg-eips.ritovision.com/7994/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:7994"
            label="ERC-7994" />
        

        
        

        
        <summary type="html">Extends ERC-20 with programmable restrictions, enabling transfers based on multiple unlock conditions as defined in EIP-7291.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7994/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC extends the concept introduced in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7291&#x2F;&quot;&gt;ERC-7291&lt;&#x2F;a&gt; by enabling &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;-compatible tokens to carry multi-condition unlocking constraints, combining temporal, identity, and usage restrictions into a programmable structure. It aims to support controlled disbursement of tokens where funds are only accessible under predefined, auditable, and verifiable conditions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;ERC-7291 introduced purpose-bound money by restricting how and where tokens can be spent. However, many real-world applications require multiple conditions to be satisfied simultaneously before tokens can be used. Examples include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Scholarships requiring the recipient to be KYC-verified, under 25 years of age, and registered at a university.&lt;&#x2F;li&gt;
&lt;li&gt;NGO aid to be used only for food and medicine, after a specific unlock date.&lt;&#x2F;li&gt;
&lt;li&gt;Payroll tokens that unlock monthly and only for whitelisted vendors (e.g., banks, healthcare providers).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This proposal generalizes and formalizes such use cases by layering unlocking conditions on top of the ERC-20 standard.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “NOT RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;interface&quot;&gt;Interface&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;IPurposeBoundERC20&lt;&#x2F;code&gt; interface defines the standard for programmable token transfers that are conditional. Each transfer, referred to as a &lt;em&gt;purpose binding&lt;&#x2F;em&gt;, includes:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A &lt;code&gt;recipient&lt;&#x2F;code&gt; and &lt;code&gt;amount&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;A set of &lt;code&gt;UnlockCondition&lt;&#x2F;code&gt; objects, each consisting of a &lt;code&gt;conditionType&lt;&#x2F;code&gt; (like &lt;code&gt;&quot;TIME&quot;&lt;&#x2F;code&gt;, &lt;code&gt;&quot;KYC&quot;&lt;&#x2F;code&gt;, or &lt;code&gt;&quot;WHITELIST&quot;&lt;&#x2F;code&gt;) and &lt;code&gt;conditionData&lt;&#x2F;code&gt; used to evaluate the condition.&lt;&#x2F;li&gt;
&lt;li&gt;An optional &lt;code&gt;expiry&lt;&#x2F;code&gt; timestamp after which the transfer can no longer be claimed.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The interface provides the following functions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;bindPurpose(...)&lt;&#x2F;code&gt;: Locks a specified amount of tokens to a recipient with defined conditions.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;claim(...)&lt;&#x2F;code&gt;: Allows the recipient to claim the tokens once all conditions are fulfilled.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;isUnlocked(...)&lt;&#x2F;code&gt;: Returns whether all associated conditions have been satisfied.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This enables flexible, composable transfer mechanisms for various use cases including compliance, grants, payroll, and more.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0.8.23&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IPurposeBoundERC20&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UnlockCondition&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; conditionType&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; e.g., &amp;quot;TIME&amp;quot;, &amp;quot;KYC&amp;quot;, &amp;quot;WHITELIST&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span&gt; conditionData&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; e.g., timestamp, Merkle root, etc.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; bindPurpose&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        UnlockCondition&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; conditions&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expiry&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bindingId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; claim&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bindingId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isUnlocked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bindingId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Flexibility: Conditions are modular and extensible.&lt;&#x2F;p&gt;
&lt;p&gt;Composability: Can be integrated into DAOs, payroll, education, and compliance tokens.&lt;&#x2F;p&gt;
&lt;p&gt;Security: Off-chain verification (e.g., KYC) backed by on-chain proofs (e.g., Merkle roots).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0.8.23&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Reference Implementation - Purpose-Bound ERC20 with Multi-Condition Unlocking&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Implements IPurposeBoundERC20 with conditionType mapping to on-chain checkers.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC20&#x2F;ERC20.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IPurposeBoundERC20.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Interface for pluggable condition checker contracts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IConditionChecker&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isConditionMet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; conditionData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; PurposeBoundERC20 Implementation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PurposeBoundERC20&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC20&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IPurposeBoundERC20&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; StoredBinding&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        UnlockCondition&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; conditions&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span&gt; claimed&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; expiry&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Maps conditionType → on-chain checker contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; conditionResolvers&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Maps bindingId → locked transfer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; StoredBinding&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; boundTransfers&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PurposeBound&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bindingId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Claimed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bindingId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; symbol_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;name_, symbol_) &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1_000_000&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ether&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; for demo purposes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Admin can register or update condition checkers for condition types&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setConditionResolver&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; conditionType&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; checker&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; For demo purposes: public function. In production: onlyOwner or AccessControl.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        conditionResolvers&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;conditionType&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; checker&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @inheritdoc&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; IPurposeBoundERC20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; bindPurpose&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        UnlockCondition&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; conditions&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expiry&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bindingId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;recipient &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Invalid recipient&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;amount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Invalid amount&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bindingId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; conditions&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; expiry&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        StoredBinding &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;storage&lt;&#x2F;span&gt;&lt;span&gt; stored &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; boundTransfers&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;bindingId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;stored&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Binding exists&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; conditions&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            stored&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;conditions&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;push&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;conditions&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        stored&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;recipient &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        stored&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        stored&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;expiry &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; expiry&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PurposeBound&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;bindingId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @inheritdoc&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; IPurposeBoundERC20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isUnlocked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bindingId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        StoredBinding &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;storage&lt;&#x2F;span&gt;&lt;span&gt; binding &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; boundTransfers&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;bindingId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;binding&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;claimed&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;binding&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;expiry &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; binding&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;expiry&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; binding&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;conditions&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            UnlockCondition &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;storage&lt;&#x2F;span&gt;&lt;span&gt; cond &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; binding&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;conditions&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            address&lt;&#x2F;span&gt;&lt;span&gt; checker &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; conditionResolvers&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;cond&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;conditionType&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;checker &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Checker not set&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IConditionChecker&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;checker&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isConditionMet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;binding&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;recipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; cond&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;conditionData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @inheritdoc&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; IPurposeBoundERC20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; claim&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bindingId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        StoredBinding &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;storage&lt;&#x2F;span&gt;&lt;span&gt; binding &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; boundTransfers&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;bindingId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; binding&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;recipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Not recipient&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;binding&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;claimed&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Already claimed&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isUnlocked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;bindingId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Conditions not met&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        binding&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;claimed &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; binding&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;recipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; binding&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Claimed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;bindingId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; binding&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;recipient&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Example of Time-Based Condition Checker&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TimeConditionChecker&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IConditionChecker&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isConditionMet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; conditionData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; unlockTime &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;decode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;conditionData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; unlockTime&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Condition-checking mechanisms (e.g., Merkle roots, timestamps) must be secure against tampering.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;claim()&lt;&#x2F;code&gt; function must ensure atomic verification of all conditions.&lt;&#x2F;p&gt;
&lt;p&gt;Replay attacks must be mitigated using unique binding IDs and expiration fields.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Verifiable ML Model Inference (ZKML)</title>
        <published>2025-07-23T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Aryaethn</name><uri>https://github.com/aryaethn</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7992/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7992-verifiable-ml-model-inference-zkml/24896" />
        

        <id>https://wg-eips.ritovision.com/7992/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7992"
            label="ERC-7992" />
        

        
        

        
        <summary type="html">Interfaces for registering ML model commitments and verifying zero-knowledge proofs of their inferences on-chain.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7992/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC standardizes how smart contracts reference machine-learning (ML) models and accept zero-knowledge attestations of their inferences. It defines a registry that issues a &lt;code&gt;modelId&lt;&#x2F;code&gt; for a &lt;code&gt;ModelCommitment&lt;&#x2F;code&gt;, hashes of the model’s weights&#x2F;architecture, proving circuit&#x2F;AIR, and verifying key, along with a &lt;code&gt;proofSystemId&lt;&#x2F;code&gt; for the proving system, and exposes discoverability via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt;. A verifier interface provides &lt;code&gt;verifyInference(modelId, inputCommitment, output, proof)&lt;&#x2F;code&gt;: it retrieves the model commitment, dispatches verification to the declared proof system, and reverts on any mismatch or invalid proof; success implies validity and emits &lt;code&gt;InferenceVerified&lt;&#x2F;code&gt;. Inputs are bound by domain-separated commitments (nonceable for replay protection), outputs are ABI-encoded bytes whose schema can be application-defined or additionally committed on-chain, and proof systems (e.g., Groth16&#x2F;Plonk&#x2F;STARK) are pluggable without ABI changes. An optional extension persists verified inference records to enable auditability and deterministic settlement.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Smart contracts can’t run large ML models, and they can’t trust an oracle’s claim about a model’s output.
Today, projects either (1) trust a centralized server, (2) cripple models to fit on-chain,  or (3) rely on social committees. None provide cryptographic assurance.&lt;&#x2F;p&gt;
&lt;p&gt;Zero-knowledge ML (ZKML) fixes the trust gap by letting a prover show—succinctly and privately—that a specific model, with specific inputs, produced a specific output.
But without a shared interface, every dApp&#x2F;verifier pair is bespoke: different ABIs, different registry schemas, poor composability.&lt;&#x2F;p&gt;
&lt;p&gt;This ERC standardizes that on-chain boundary:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Registry: publish immutable commitments to model weights&#x2F;architecture&#x2F;circuits so callers know exactly which model they’re referencing.&lt;&#x2F;li&gt;
&lt;li&gt;Verifier: a uniform function to validate inference proofs, independent of proof system (Groth16, Plonk, STARKs, …).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Benefits include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Trustless, composable “AI oracles” for DeFi risk, prediction markets, insurance, etc.&lt;&#x2F;li&gt;
&lt;li&gt;Protection of proprietary models and private inputs while still guaranteeing correctness.&lt;&#x2F;li&gt;
&lt;li&gt;Deterministic, dispute-free settlement for complex computations.&lt;&#x2F;li&gt;
&lt;li&gt;Lower integration and audit overhead via consistent events, structs, and revert semantics.&lt;&#x2F;li&gt;
&lt;li&gt;Future-proofing as proving systems evolve—only implementations change, not integrators.&lt;&#x2F;li&gt;
&lt;li&gt;Clear security expectations (e.g., nonce usage to prevent replays) baked into the spec.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In short, this ERC turns verifiable ML inference into a reusable primitive—doing for AI outputs what &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;&#x2F;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; did for assets.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc2119&quot;&gt;RFC 2119&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc8174&quot;&gt;RFC 8174&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;terminology-ids&quot;&gt;Terminology &amp;amp; IDs&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Model Commitment: A bundle of hashes that ties together the model’s weights, architecture, proving circuit&#x2F;Algebraic intermediate representation (AIR), and verifying key.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;modelId&lt;&#x2F;code&gt; (&lt;code&gt;uint256&lt;&#x2F;code&gt;): A unique identifier returned by the registry upon model registration.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;inputCommitment&lt;&#x2F;code&gt; (&lt;code&gt;bytes32&lt;&#x2F;code&gt;): A hash commitment to all private inputs (and any declared public inputs) for an inference. Implementations MUST domain-separate and SHOULD include a nonce&#x2F;salt when single-use or non-deterministic behavior is possible.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;output&lt;&#x2F;code&gt; (&lt;code&gt;bytes&lt;&#x2F;code&gt;): ABI-encoded public outputs of the inference. Consumers MUST agree on its schema and MAY validate it via an outputCommitment (not included in the minimal interface).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;proof&lt;&#x2F;code&gt; (&lt;code&gt;bytes&lt;&#x2F;code&gt;): The ZK proof blob.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;proofSystemId&lt;&#x2F;code&gt; (&lt;code&gt;bytes4&lt;&#x2F;code&gt;): Identifier of the proving system + curve + version used by the circuit.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;code&gt;proofSystemId&lt;&#x2F;code&gt; MUST equal the first four bytes of:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;bytes4(keccak256(abi.encodePacked(&amp;lt;canonical-proof-system-name-and-version&amp;gt;)))&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Where &lt;code&gt;&amp;lt;canonical-proof-system-name-and-version&amp;gt;&lt;&#x2F;code&gt; is a lowercase, hyphen-separated string, e.g.:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&quot;groth16-bn254-v1&quot;&lt;&#x2F;li&gt;
&lt;li&gt;&quot;plonk-bn254-v2&quot;&lt;&#x2F;li&gt;
&lt;li&gt;&quot;stark-airfoo-v1&quot;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This method ensures deterministic, collision-resistant identifiers across implementations.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;interfaces&quot;&gt;Interfaces&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;zkml-registry&quot;&gt;ZKML Registry&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.20&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERCZKMLRegistry&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is IERC165 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ModelCommitment&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; modelHash&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; weights + architecture hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; circuitHash&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; arithmetic circuit &#x2F; AIR hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; vkHash&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; verifying key hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes4&lt;&#x2F;span&gt;&lt;span&gt;  proofSystemId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; keccak-based identifier&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt;  uri&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;           &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; optional off-chain metadata (IPFS&#x2F;HTTP)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ModelRegistered&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; modelId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        ModelCommitment&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; commitment&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ModelUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; modelId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        ModelCommitment&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; oldCommitment&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        ModelCommitment&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newCommitment&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ModelDeprecated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; modelId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ModelNotFound&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; modelId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NotModelOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; modelId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt; caller&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ModelDeprecated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; modelId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; registerModel&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;ModelCommitment&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; commitment&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; modelId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; updateModel&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; modelId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; ModelCommitment&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newCommitment&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; deprecateModel&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; modelId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getModel&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; modelId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;ModelCommitment&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; commitment&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; deprecated&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;registerModel&lt;&#x2F;code&gt; MUST return a unique &lt;code&gt;modelId&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;updateModel&lt;&#x2F;code&gt; and &lt;code&gt;deprecateModel&lt;&#x2F;code&gt; MUST only be callable by the model &lt;code&gt;owner&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;getModel&lt;&#x2F;code&gt; MUST return the current &lt;code&gt;commitment&lt;&#x2F;code&gt;, deprecation status, and &lt;code&gt;owner&lt;&#x2F;code&gt; address.&lt;&#x2F;li&gt;
&lt;li&gt;Implementations MAY allow versioning under one &lt;code&gt;modelId&lt;&#x2F;code&gt; or require a new &lt;code&gt;modelId&lt;&#x2F;code&gt; per change. The chosen policy MUST be documented.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;zkml-verifier&quot;&gt;ZKML Verifier&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.20&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERCZKMLVerifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is IERC165 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InferenceVerified&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; modelId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; inputCommitment&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;   output&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; caller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InvalidProof&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ModelMismatch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; proof verifies but not tied to given modelId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InputCommitmentMismatch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OutputMismatch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;           &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if verifier checks output commitment&#x2F;schema&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UnsupportedProofSystem&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span&gt; proofSystemId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; VerificationRefused_ModelDeprecated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; modelId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verifies a ZK proof for an inference.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST revert on any failure path. Successful execution implies validity.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; modelId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         Registry model identifier&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; inputCommitment&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Commitment to private inputs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; output&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;          ABI-encoded public outputs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; proof&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;           ZK proof bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verifyInference&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; modelId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; inputCommitment&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; output&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; proof&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Optional helper views:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; proofSystemOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; modelId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; registry&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; registryAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;verifyInference&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;MUST fetch the model &lt;code&gt;commitment&lt;&#x2F;code&gt; from the registry and validate the &lt;code&gt;proof&lt;&#x2F;code&gt; against it.&lt;&#x2F;li&gt;
&lt;li&gt;MUST revert on any failure (invalid proof, mismatched commitments, unsupported proof system, deprecated model, etc.).&lt;&#x2F;li&gt;
&lt;li&gt;SHOULD emit  &lt;code&gt;InferenceVerified&lt;&#x2F;code&gt; on success.&lt;&#x2F;li&gt;
&lt;li&gt;SHOULD remain stateless except for emitting events. Statefulness MAY be introduced by extensions.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;optional-storage-extension&quot;&gt;Optional Storage Extension&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.20&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERCZKMLStorageExtension&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InferenceStored&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; inferenceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify and store an inference record.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST revert on invalid proof.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; inferenceId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; keccak256(abi.encodePacked(modelId, inputCommitment, output))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verifyAndStoreInference&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; modelId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; inputCommitment&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; output&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; proof&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; inferenceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getInference&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; inferenceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; modelId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; inputCommitment&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; output&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Replay Protection Note: Implementations that rely on
&lt;code&gt;inferenceId = keccak256(modelId, inputCommitment, output)&lt;&#x2F;code&gt;
MUST ensure that &lt;code&gt;inputCommitment&lt;&#x2F;code&gt; embeds a &lt;code&gt;nonce&#x2F;salt&lt;&#x2F;code&gt; or other uniqueness source
if replays are a concern (e.g., non-deterministic models or single-use inferences).&lt;&#x2F;p&gt;
&lt;p&gt;The registry interface exposes an &lt;code&gt;owner&lt;&#x2F;code&gt; per &lt;code&gt;modelId&lt;&#x2F;code&gt;.
Implementations MUST include some ownership&#x2F;access-control mechanism
(e.g., simple owner storage, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;173&#x2F;&quot;&gt;ERC-173&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;173&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; representation, or role-based control).
The returned &lt;code&gt;owner&lt;&#x2F;code&gt; address SHOULD be treated as the canonical authority to mutate or deprecate that model.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Void Return on &lt;code&gt;verifyInference&lt;&#x2F;code&gt;: Reverting on failure and returning nothing on success removes redundant gas-expensive booleans and matches modern Solidity patterns (e.g., OpenZeppelin’s &lt;code&gt;SafeERC20&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;Separated Registry &amp;amp; Verifier: Encourages modularity—teams can upgrade verifiers or registries independently.&lt;&#x2F;li&gt;
&lt;li&gt;Opaque bytes for Proof&#x2F;Output: Avoids lock-in to a specific proof system or output schema.&lt;&#x2F;li&gt;
&lt;li&gt;Deterministic &lt;code&gt;proofSystemId&lt;&#x2F;code&gt;: Prevents collisions and ambiguity; enables predictable dispatch in mixed-system verifiers.&lt;&#x2F;li&gt;
&lt;li&gt;Nonce in &lt;code&gt;inputCommitment&lt;&#x2F;code&gt;: Explicitly mitigates replay attacks when inference uniqueness matters.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Fully backwards compatible:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Uses &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; like popular &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; for discoverability.&lt;&#x2F;li&gt;
&lt;li&gt;No dependency on token ownership standards; minimal collision with existing protocols.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.20&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERCZKMLRegistry.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERCZKMLVerifier.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ZKMLVerifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERCZKMLVerifier&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    IERCZKMLRegistry &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; immutable&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt; registry&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;IERCZKMLRegistry&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _registry&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        registry &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _registry&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verifyInference&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; modelId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; inputCommitment&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; output&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; proof&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span&gt;IERCZKMLRegistry&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;ModelCommitment &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;memory&lt;&#x2F;span&gt;&lt;span&gt; cm&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt; deprecated&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            registry&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getModel&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;modelId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;deprecated&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ModelDeprecated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;modelId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Dispatch based on proofSystemId. Example only.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; bool ok = VerifierLib.verify(proof, cm.vkHash, inputCommitment, output);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span&gt; ok &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _dummyVerify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;proof&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; cm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;vkHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; inputCommitment&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; output&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;ok&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InvalidProof&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InferenceVerified&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;modelId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; inputCommitment&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; output&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; proofSystemOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; modelId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span&gt;IERCZKMLRegistry&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;ModelCommitment &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;memory&lt;&#x2F;span&gt;&lt;span&gt; cm&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; registry&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getModel&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;modelId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; cm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;proofSystemId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _dummyVerify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;security&quot;&gt;Security&lt;&#x2F;h3&gt;
&lt;!-- Editor&#x27;s Note: any requirements (defined with UPPERCASE keywords) should go in the specification section, but they should be discussed here in more detail. --&gt;
&lt;ul&gt;
&lt;li&gt;Replay Attacks: Inputs must embed a nonce&#x2F;salt where uniqueness matters. Contracts may also track consumed &lt;code&gt;inferenceIds&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Model Commitment Drift: Updating commitments can invalidate proofs; consumers should pin specific &lt;code&gt;modelId&lt;&#x2F;code&gt; + &lt;code&gt;commitment&lt;&#x2F;code&gt; hashes or check deprecated.&lt;&#x2F;li&gt;
&lt;li&gt;Hash Domain Separation: Use distinct prefixes (e.g., &quot;ZKML_MODEL_V1&quot;) to avoid collisions across contexts.&lt;&#x2F;li&gt;
&lt;li&gt;Output Ambiguity: Contracts must validate or commit to output schemas to avoid maliciously crafted bytes.&lt;&#x2F;li&gt;
&lt;li&gt;DoS via Heavy Verification: Consider off-chain verification with on-chain succinct attestations, or batching&#x2F;aggregation.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;gas&quot;&gt;Gas&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Proof verification can dominate gas costs; splitting verification-only calls from storage writes lets integrators choose.&lt;&#x2F;li&gt;
&lt;li&gt;Events are cheaper than persistent storage for audit trails.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Minimal Avatar Smart Wallet (MASW)</title>
        <published>2025-07-08T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>0xMostafas</name><uri>https://github.com/MostafaS</uri><email>0xmostafas@proton.me</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7988/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-tbd-minimal-avatar-smart-wallet-masw-delegate-wallet-for-eip-7702/24761" />
        

        <id>https://wg-eips.ritovision.com/7988/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7988"
            label="ERC-7988" />
        

        
        

        
        <summary type="html">A smart‑wallet interface for EIP‑7702 account‑code delegation.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7988/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Minimal Avatar Smart Wallet (MASW) is an immutable delegate‑wallet that any EOA can designate via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP‑7702&lt;&#x2F;a&gt; (txType &lt;code&gt;0x04&lt;&#x2F;code&gt;). Once designated, the wallet&#x27;s code remains active for every subsequent transaction until the owner sends a new &lt;code&gt;0x04&lt;&#x2F;code&gt; to clear or replace it. During each delegated call the EOA is the avatar and MASW&#x27;s code executes as the delegate at the same address, enabling atomic batched calls (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP‑712&lt;&#x2F;a&gt; signed) and optional sponsor gas reimbursement in ETH or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC‑20&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The contract offers one primary function, &lt;code&gt;executeBatch&lt;&#x2F;code&gt;, plus two plug‑in hooks: a Policy Module for pre&#x2F;post guards and a Recovery Module for alternate signature validation. Replay attacks are prevented by a global metaNonce, an expiry, and a chain‑bound &lt;code&gt;EIP‑712&lt;&#x2F;code&gt; domain separator. Standardising this seven‑parameter ABI removes wallet fragmentation while still allowing custom logic through modules.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;A single‑transaction code‑injection model (EIP‑7702) grants EOAs full implementation freedom, but unconstrained diversity would impose high coordination costs:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Interoperability&lt;&#x2F;strong&gt; – Divergent ABIs and fee‑settlement conventions force dApps and relayers to maintain per‑wallet adapters, increasing integration complexity and failure modes.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Economic alignment&lt;&#x2F;strong&gt; – Gas‑sponsorship relies on deterministic fee‑reimbursement paths; heterogeneity erodes relayer incentives and throttles sponsored‑transaction volume.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Tooling precision&lt;&#x2F;strong&gt; – Indexers, debuggers, and static‑analysis frameworks achieve optimal decoding and gas estimation when targeting a single, fixed byte‑code and seven‑field call schema.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Extensibility focus&lt;&#x2F;strong&gt; – Constraining variability to two module boundaries (Policy, Recovery) localizes complexity, allowing research and hardening efforts to concentrate on higher‑level security primitives rather than re‑engineering core wallet logic.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;By standardising the immutable byte‑code, signature domain, and minimal ABI while exposing clearly defined extension hooks, MASW minimizes fragmentation and maximizes composability across the Ethereum tooling stack.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;overview-of-delegation-flow&quot;&gt;Overview of Delegation Flow&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Deploy&lt;&#x2F;strong&gt; &lt;code&gt;MASW&lt;&#x2F;code&gt; with constructor argument &lt;code&gt;_owner = EOA&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The owner sends an EIP‑7702 transaction (txType &lt;code&gt;0x04&lt;&#x2F;code&gt;) referencing the contract&#x27;s byte‑code hash.&lt;&#x2F;li&gt;
&lt;li&gt;After that transaction the EOA acts as the &lt;strong&gt;avatar wallet&lt;&#x2F;strong&gt; while the MASW logic executes as the &lt;strong&gt;delegate wallet&lt;&#x2F;strong&gt; at the &lt;em&gt;same&lt;&#x2F;em&gt; address.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;public-interface&quot;&gt;Public Interface&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; executeBatch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; targets&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; values&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; calldatas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; fee&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expiry&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setPolicyModule&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newModule&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setRecoveryModule&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newModule&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BatchExecuted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; structHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ModuleChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; kind&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; oldModule&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newModule&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;transaction-type-hash&quot;&gt;Transaction Type Hash&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; BATCH_TYPEHASH &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;  &amp;quot;Batch(address[] targets,uint256[] values,bytes[] calldatas,address token,uint256 fee,uint256 exp,uint256 metaNonce)&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;storage-layout&quot;&gt;Storage Layout&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&quot;text-align: right&quot;&gt;Slot&lt;&#x2F;th&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;metaNonce&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;uint256&lt;&#x2F;td&gt;&lt;td&gt;Monotonically increasing meta‑nonce&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;_entered&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;uint256&lt;&#x2F;td&gt;&lt;td&gt;Re‑entrancy guard flag&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;policyModule&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;address&lt;&#x2F;td&gt;&lt;td&gt;Optional &lt;code&gt;IPolicyModule&lt;&#x2F;code&gt; (zero = none)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;3&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;recoveryModule&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;address&lt;&#x2F;td&gt;&lt;td&gt;Optional &lt;code&gt;IRecoveryModule&lt;&#x2F;code&gt; (zero = none)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;&lt;code&gt;owner&lt;&#x2F;code&gt; and &lt;code&gt;DOMAIN_SEPARATOR&lt;&#x2F;code&gt; are &lt;code&gt;immutable&lt;&#x2F;code&gt; and occupy no storage slots.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;domain-separator-construction&quot;&gt;Domain Separator Construction&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;DOMAIN_SEPARATOR &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;  abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;MASW&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;1&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;    block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;chainid&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST be the live chain‑ID; using 0 is disallowed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    _owner           &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; keeps separator stable before &amp;amp; after delegation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;batch-execution-executebatch&quot;&gt;Batch Execution (&lt;code&gt;executeBatch&lt;&#x2F;code&gt;)&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Stage&lt;&#x2F;th&gt;&lt;th&gt;Behaviour&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Validation&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;‑ &lt;code&gt;targets.length == values.length == calldatas.length &amp;gt; 0&lt;&#x2F;code&gt;&lt;br&gt;‑ &lt;code&gt;block.timestamp ≤ expiry&lt;&#x2F;code&gt;&lt;br&gt;‑ &lt;code&gt;metaNonce&lt;&#x2F;code&gt; matches then increments&lt;br&gt;‑ &lt;code&gt;EIP712&lt;&#x2F;code&gt; digest recovers &lt;code&gt;owner&lt;&#x2F;code&gt; &lt;strong&gt;or&lt;&#x2F;strong&gt; is approved by &lt;code&gt;recoveryModule&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Policy pre‑hook&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;If &lt;code&gt;policyModule != address(0)&lt;&#x2F;code&gt;, &lt;code&gt;preCheck&lt;&#x2F;code&gt; &lt;strong&gt;MUST&lt;&#x2F;strong&gt; return &lt;code&gt;true&lt;&#x2F;code&gt;; a revert or &lt;code&gt;false&lt;&#x2F;code&gt; vetoes the batch&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Calls&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;For each index &lt;em&gt;i&lt;&#x2F;em&gt;: &lt;code&gt;targets[i].call{value:values[i]}(calldatas[i])&lt;&#x2F;code&gt;; revert on first failure&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Policy post‑hook&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;Same semantics as pre‑hook&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Fee reimbursement&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;If &lt;code&gt;fee &amp;gt; 0&lt;&#x2F;code&gt;: native transfer (&lt;code&gt;token == address(0)&lt;&#x2F;code&gt;) or &lt;code&gt;ERC20&lt;&#x2F;code&gt; &lt;code&gt;transfer&lt;&#x2F;code&gt; with OpenZeppelin‑style return‑value check   &lt;!-- TODO --&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Emit&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;BatchExecuted(structHash)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;gas-sponsorship&quot;&gt;Gas Sponsorship&lt;&#x2F;h4&gt;
&lt;p&gt;The relayer and owner agree off‑chain on &lt;code&gt;(token, fee)&lt;&#x2F;code&gt; prior to submission.&lt;br &#x2F;&gt;
Because the fee is part of the signed batch, a relayer cannot unilaterally raise it.&lt;br &#x2F;&gt;
If a rival relayer broadcasts the same signed batch first, they earn the fee and the original relayer&#x27;s transaction reverts—aligning incentives naturally.&lt;br &#x2F;&gt;
Relayers &lt;strong&gt;MUST&lt;&#x2F;strong&gt; confirm the avatar&#x27;s balance up‑front; insufficient funds render the transaction invalid in the mem‑pool.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;modules&quot;&gt;Modules&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;policy-module&quot;&gt;Policy Module&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IPolicyModule&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; preCheck&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; rawData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; postCheck&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; rawData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;A module &lt;strong&gt;MAY&lt;&#x2F;strong&gt; veto by reverting &lt;em&gt;or&lt;&#x2F;em&gt; by returning &lt;code&gt;false&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;value&lt;&#x2F;code&gt; parameter represents the total ETH sent with the transaction (&lt;code&gt;msg.value&lt;&#x2F;code&gt;), allowing the policy module to validate this against the batch requirements contained in &lt;code&gt;rawData&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Aggregator designs are encouraged: forward to child policies and stop on first failure (revert or return &lt;code&gt;false&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;recovery-module&quot;&gt;Recovery Module&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IRecoveryModule&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isValidSignature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sig&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Must return &lt;code&gt;0x1626ba7e&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;nonce-race-consideration&quot;&gt;Nonce‑Race Consideration&lt;&#x2F;h3&gt;
&lt;p&gt;A single global &lt;code&gt;metaNonce&lt;&#x2F;code&gt; is used. Two relayers submitting the same nonce concurrently results in one success and one revert. The &lt;code&gt;expiry&lt;&#x2F;code&gt; field (wallets typically set ≤ 30 s) makes such races low‑impact, but UIs should surface the failure.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Immutable logic&lt;&#x2F;strong&gt; minimizes upgrade risk; a new version requires an explicit 7702 &lt;code&gt;0x04&lt;&#x2F;code&gt; call.&lt;&#x2F;li&gt;
&lt;li&gt;A &lt;strong&gt;two‑module&lt;&#x2F;strong&gt; boundary captures common customizations without growing byte‑code.&lt;&#x2F;li&gt;
&lt;li&gt;No hard &lt;code&gt;maxTargets&lt;&#x2F;code&gt;; advanced users can bundle many calls, while conservative users install a size‑capping Policy module.&lt;&#x2F;li&gt;
&lt;li&gt;Domain separator binds the real &lt;code&gt;chainId&lt;&#x2F;code&gt; to mitigate cross‑chain replays.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Reference implementation can be found here &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7988&#x2F;.&#x2F;assets&#x2F;MASW.sol&quot;&gt;&lt;code&gt;MASW.sol&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Threat&lt;&#x2F;th&gt;&lt;th&gt;Mitigation&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Same‑chain replay&lt;&#x2F;td&gt;&lt;td&gt;Global &lt;code&gt;metaNonce&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Cross‑chain replay&lt;&#x2F;td&gt;&lt;td&gt;Chain‑bound domain separator&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Fee grief &#x2F; over‑charge&lt;&#x2F;td&gt;&lt;td&gt;Fee is part of signed data; front‑running risk sits with relayer&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Batch gas grief&lt;&#x2F;td&gt;&lt;td&gt;Optional Policy can reject oversized batches&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ERC20&lt;&#x2F;code&gt; non‑standard returns&lt;&#x2F;td&gt;&lt;td&gt;OpenZeppelin &lt;code&gt;SafeERC20&lt;&#x2F;code&gt; transfer check&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Re‑entrancy&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;nonReentrant&lt;&#x2F;code&gt; guard; state mutated only before external calls (nonce++) and after (fee transfer)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Malicious Module&lt;&#x2F;td&gt;&lt;td&gt;Core logic immutable; swapping modules needs an owner‑signed tx&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Contract Feature Detection</title>
        <published>2025-07-07T00:00:00+00:00</published>
        <updated>2026-04-25T12:06:20+00:00</updated>
	
	
	<author>
		<name>raffy.eth</name><uri>https://github.com/adraffy</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7996/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7996-contract-feature-detection/24975" />
        

        <id>https://wg-eips.ritovision.com/7996/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7996"
            label="ERC-7996" />
        

        
        

        
        <summary type="html">Method to publish and detect contract features that lack an ERC-165 interface</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7996/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Creates a standard method &lt;code&gt;supportsFeature(bytes4)&lt;&#x2F;code&gt; in the same spirit as &lt;code&gt;supportsInterface(bytes4)&lt;&#x2F;code&gt; to publish and detect what features a smart contract implements that lack a derivable &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; interface.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Ethereum Name Service (ENS) has maintained backwards compatibility with contracts created in 2016 through extensive use of ERC-165.  Unfortunately, not all contract capabilities can be expressed through an unique interface.&lt;&#x2F;p&gt;
&lt;p&gt;Features allow expression of contract capabilities that preserve existing interfaces.  This proposal standardizes the concept of features and standardizes the identification (naming) of features.&lt;&#x2F;p&gt;
&lt;p&gt;Defining a new standard avoids unnecessary pollution of the ERC-165 selector namespace with synthetic interfaces representing features.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc2119&quot;&gt;RFC 2119&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc8174&quot;&gt;RFC 8174&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;how-features-are-identified&quot;&gt;How Features are Identified&lt;&#x2F;h3&gt;
&lt;p&gt;For this standard, a &lt;em&gt;feature&lt;&#x2F;em&gt; is any property of a contract that cannot be expressed via ERC-165.&lt;&#x2F;p&gt;
&lt;p&gt;A feature name SHOULD be a reverse domain name that uniquely defines its implication, eg. &lt;code&gt;eth.ens.resolver.extended.multicall&lt;&#x2F;code&gt; is the multicall feature for an extended ENS resolver contract.&lt;&#x2F;p&gt;
&lt;p&gt;A feature identifier is defined as the first four-bytes of the keccak256-hash of its name, eg. &lt;code&gt;bytes4(keccak256(&quot;eth.ens.resolver.extended.multicall&quot;)) = 0x96b62db8&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;how-a-contract-will-publish-the-features-it-implements&quot;&gt;How a Contract will Publish the Features it Implements&lt;&#x2F;h3&gt;
&lt;p&gt;A contract that is compliant with this specification SHALL implement the following interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7996&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check if a feature is supported.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; featureId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The feature identifier.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `true` if the feature is supported by the contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsFeature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; featureId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The ERC-165 interface identifier for this interface is &lt;code&gt;0x582de3e7&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;how-to-detect-if-a-contract-implements-features&quot;&gt;How to Detect if a Contract Implements Features&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;Check if the contract supports the interface above according to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;#how-to-detect-if-a-contract-implements-erc-165&quot;&gt;ERC-165&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;how-to-detect-if-a-contract-implements-any-given-feature&quot;&gt;How to Detect if a Contract Implements any Given Feature&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;If you are not sure if the contract implements features, use the above procedure to confirm.&lt;&#x2F;li&gt;
&lt;li&gt;If it implements features, then call &lt;code&gt;supportsFeature(featureId)&lt;&#x2F;code&gt; to determine if it implements the desired feature.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Note: a contract that implements features MAY implement no features.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Since feature names cannot be derived from a contract interface, they are derived from a reverse domain name to reduce collisions and permit a human-readable representention that briefly describes its implication.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Callers unaware of features or any specific feature experience no change in behavior.&lt;&#x2F;p&gt;
&lt;p&gt;ENS already implements this ERC.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;As with ERC-165, declaring support for a feature does not guarantee that the contract implements it.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Confidential Fungible Token</title>
        <published>2025-07-03T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Aryeh Greenberg</name><uri>https://github.com/arr00</uri>
	</author>
	
	<author>
		<name>Ernesto García</name><uri>https://github.com/ernestognw</uri>
	</author>
	
	<author>
		<name>Hadrien Croubois</name><uri>https://github.com/Amxx</uri>
	</author>
	
	<author>
		<name>Ghazi Ben Amor</name><uri>https://github.com/GBAZama</uri>
	</author>
	
	<author>
		<name>Clement Danjou</name><uri>https://github.com/immortal-tofu</uri>
	</author>
	
	<author>
		<name>Joseph Andre Turk</name><uri>https://github.com/jatZama</uri>
	</author>
	
	<author>
		<name>Silas Davis</name><uri>https://github.com/silasdavis</uri>
	</author>
	
	<author>
		<name>Nicolas Pasquier</name><uri>https://github.com/npasquie</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7984/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7984-confidential-fungible-token-interface/24735" />
        

        <id>https://wg-eips.ritovision.com/7984/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7984"
            label="ERC-7984" />
        

        
        

        
        <summary type="html">Confidential fungible tokens use an account-based accounting model while maintaining the confidentiality of transfer amounts and balances.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7984/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The following standard describes confidential fungible tokens via pointers. All amounts in this standard are represented by confidential pointers; therefore, balances and transfer amounts are confidential. Pointers refer to data stored elsewhere--onchain or offchain. The logistics of pointer resolution, operation, and location are implementation specific. The interface defines functions to transfer tokens with pointers, as well as approve operators, allowing the token to be transferred by a third party.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Confidential tokens enable private value transfer which is vital for many usecases such as payroll, confidential DeFi, institutional settlement, and more.
A standard interface allows pointer based confidential tokens on Ethereum to be reused by other applications: from privacy-focused wallets to decentralized exchanges, while keeping transaction amounts private from public view.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc2119&quot;&gt;RFC 2119&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc8174&quot;&gt;RFC 8174&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;nomenclature&quot;&gt;Nomenclature&lt;&#x2F;h3&gt;
&lt;p&gt;All amounts in this ERC are pointer based amounts represented by &lt;code&gt;bytes32&lt;&#x2F;code&gt; pointers unless otherwise specified. The resolution and manipulation of these pointers is implementation specific.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;token&quot;&gt;Token&lt;&#x2F;h3&gt;
&lt;p&gt;Compliant tokens MUST implement &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt;. The &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; function MUST return &lt;code&gt;true&lt;&#x2F;code&gt; if &lt;code&gt;0x4958f2a4&lt;&#x2F;code&gt; is passed through the &lt;code&gt;interfaceID&lt;&#x2F;code&gt; argument.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;methods&quot;&gt;Methods&lt;&#x2F;h3&gt;
&lt;p&gt;Compliant tokens MUST implement the following methods, unless otherwise specified:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;h4 id=&quot;name&quot;&gt;&lt;code&gt;name()&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Returns the name of the token - e.g. &lt;code&gt;&quot;MyConfidentialToken&quot;&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;h4 id=&quot;symbol&quot;&gt;&lt;code&gt;symbol()&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Returns the symbol of the token - e.g. &lt;code&gt;&quot;MCT&quot;&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; symbol&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;h4 id=&quot;decimals&quot;&gt;&lt;code&gt;decimals()&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Returns the number of decimals the token uses (e.g. &lt;code&gt;6&lt;&#x2F;code&gt;) as a plaintext &lt;code&gt;uint8&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; decimals&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;h4 id=&quot;contracturi&quot;&gt;&lt;code&gt;contractURI()&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Returns the metadata URI for the token. SHOULD follow the schema defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7572&#x2F;&quot;&gt;ERC-7572&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; contractURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;h4 id=&quot;confidentialtotalsupply&quot;&gt;&lt;code&gt;confidentialTotalSupply()&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Returns the total token supply.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; confidentialTotalSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;h4 id=&quot;confidentialbalanceof-address&quot;&gt;&lt;code&gt;confidentialBalanceOf(address)&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Returns the balance of &lt;code&gt;account&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; confidentialBalanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;h4 id=&quot;isoperator-address-address&quot;&gt;&lt;code&gt;isOperator(address,address)&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Returns &lt;code&gt;true&lt;&#x2F;code&gt; if &lt;code&gt;spender&lt;&#x2F;code&gt; is currently authorized to transfer tokens on behalf of &lt;code&gt;holder&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isOperator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; holder&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;h4 id=&quot;setoperator-address-uint48&quot;&gt;&lt;code&gt;setOperator(address,uint48)&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Authorizes &lt;code&gt;operator&lt;&#x2F;code&gt; to transfer tokens on behalf of the caller until timestamp &lt;code&gt;until&lt;&#x2F;code&gt;--passed as a plaintext &lt;code&gt;uint48&lt;&#x2F;code&gt;. An operator may transfer any amount of tokens on behalf of a holder while approved. Accounts may have multiple simultaneous operators.&lt;&#x2F;p&gt;
&lt;p&gt;MUST emit the &lt;code&gt;OperatorSet&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setOperator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint48&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; until&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;h4 id=&quot;confidentialtransfer-address-bytes32&quot;&gt;&lt;code&gt;confidentialTransfer(address,bytes32)&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Transfers &lt;code&gt;amount&lt;&#x2F;code&gt; of tokens to address &lt;code&gt;to&lt;&#x2F;code&gt;. The function MAY revert if the caller&#x27;s balance does not have enough tokens to spend.&lt;&#x2F;p&gt;
&lt;p&gt;Returns the actual amount that was transferred.&lt;&#x2F;p&gt;
&lt;p&gt;MUST emit the &lt;code&gt;ConfidentialTransfer&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; confidentialTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;h4 id=&quot;confidentialtransfer-address-bytes32-bytes&quot;&gt;&lt;code&gt;confidentialTransfer(address,bytes32,bytes)&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Transfers &lt;code&gt;amount&lt;&#x2F;code&gt; of tokens to address &lt;code&gt;to&lt;&#x2F;code&gt;. The function MAY revert if the caller&#x27;s balance does not have enough tokens to spend.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;data&lt;&#x2F;code&gt; parameter contains implementation-specific information such as cryptographic proofs.&lt;&#x2F;p&gt;
&lt;p&gt;Returns the actual amount that was transferred.&lt;&#x2F;p&gt;
&lt;p&gt;MUST emit the &lt;code&gt;ConfidentialTransfer&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; confidentialTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;h4 id=&quot;confidentialtransferfrom-address-address-bytes32&quot;&gt;&lt;code&gt;confidentialTransferFrom(address,address,bytes32)&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Transfers &lt;code&gt;amount&lt;&#x2F;code&gt; of tokens from address &lt;code&gt;from&lt;&#x2F;code&gt; to address &lt;code&gt;to&lt;&#x2F;code&gt;. The function MAY revert if the &lt;code&gt;from&lt;&#x2F;code&gt;&#x27;s account balance does not have enough tokens to spend.&lt;&#x2F;p&gt;
&lt;p&gt;Returns the actual amount that was transferred.&lt;&#x2F;p&gt;
&lt;p&gt;MUST revert if the caller is not an operator for &lt;code&gt;from&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST emit the &lt;code&gt;ConfidentialTransfer&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; confidentialTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;h4 id=&quot;confidentialtransferfrom-address-address-bytes32-bytes&quot;&gt;&lt;code&gt;confidentialTransferFrom(address,address,bytes32,bytes)&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Transfers &lt;code&gt;amount&lt;&#x2F;code&gt; of tokens from address &lt;code&gt;from&lt;&#x2F;code&gt; to address &lt;code&gt;to&lt;&#x2F;code&gt;. The function MAY revert if the &lt;code&gt;from&lt;&#x2F;code&gt;&#x27;s account balance does not have enough tokens to spend.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;data&lt;&#x2F;code&gt; parameter contains implementation-specific information such as cryptographic proofs.&lt;&#x2F;p&gt;
&lt;p&gt;Returns the actual amount that was transferred.&lt;&#x2F;p&gt;
&lt;p&gt;MUST revert if the caller is not an operator for &lt;code&gt;from&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST emit the &lt;code&gt;ConfidentialTransfer&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; confidentialTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;h4 id=&quot;confidentialtransferandcall-address-bytes32-bytes&quot;&gt;&lt;code&gt;confidentialTransferAndCall(address,bytes32,bytes)&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Transfers &lt;code&gt;amount&lt;&#x2F;code&gt; of tokens to address &lt;code&gt;to&lt;&#x2F;code&gt;. The function MAY revert if the caller&#x27;s balance does not have enough tokens to spend.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;data&lt;&#x2F;code&gt; parameter contains implementation-specific information such as cryptographic proofs.&lt;&#x2F;p&gt;
&lt;p&gt;See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7984&#x2F;#callback-details&quot;&gt;Callback Details&lt;&#x2F;a&gt; below for details on the callback flow.&lt;&#x2F;p&gt;
&lt;p&gt;Returns the actual amount that was transferred.&lt;&#x2F;p&gt;
&lt;p&gt;MUST emit the &lt;code&gt;ConfidentialTransfer&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; confidentialTransferAndCall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; callData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;h4 id=&quot;confidentialtransferandcall-address-bytes32-bytes-bytes&quot;&gt;&lt;code&gt;confidentialTransferAndCall(address,bytes32,bytes,bytes)&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Transfers &lt;code&gt;amount&lt;&#x2F;code&gt; of tokens to address &lt;code&gt;to&lt;&#x2F;code&gt;. The function MAY revert if the caller&#x27;s balance does not have enough tokens to spend.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;data&lt;&#x2F;code&gt; parameter contains implementation-specific information such as cryptographic proofs.&lt;&#x2F;p&gt;
&lt;p&gt;See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7984&#x2F;#callback-details&quot;&gt;Callback Details&lt;&#x2F;a&gt; below for details on the callback flow.&lt;&#x2F;p&gt;
&lt;p&gt;Returns the actual amount that was transferred.&lt;&#x2F;p&gt;
&lt;p&gt;MUST emit the &lt;code&gt;ConfidentialTransfer&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; confidentialTransferAndCall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; callData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;h4 id=&quot;confidentialtransferfromandcall-address-address-bytes32-bytes&quot;&gt;&lt;code&gt;confidentialTransferFromAndCall(address,address,bytes32,bytes)&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Transfers &lt;code&gt;amount&lt;&#x2F;code&gt; of tokens from address &lt;code&gt;from&lt;&#x2F;code&gt; to address &lt;code&gt;to&lt;&#x2F;code&gt;. The function MAY revert if the &lt;code&gt;from&lt;&#x2F;code&gt;&#x27;s account balance does not have enough tokens to spend.&lt;&#x2F;p&gt;
&lt;p&gt;See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7984&#x2F;#callback-details&quot;&gt;Callback Details&lt;&#x2F;a&gt; below for details on the callback flow.&lt;&#x2F;p&gt;
&lt;p&gt;Returns the actual amount that was transferred.&lt;&#x2F;p&gt;
&lt;p&gt;MUST revert if the caller is not an operator for &lt;code&gt;from&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST emit the &lt;code&gt;ConfidentialTransfer&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; confidentialTransferFromAndCall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; callData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;h4 id=&quot;confidentialtransferfromandcall-address-address-bytes32-bytes-bytes&quot;&gt;&lt;code&gt;confidentialTransferFromAndCall(address,address,bytes32,bytes,bytes)&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Transfers &lt;code&gt;amount&lt;&#x2F;code&gt; of tokens from address &lt;code&gt;from&lt;&#x2F;code&gt; to address &lt;code&gt;to&lt;&#x2F;code&gt;. The function MAY revert if the &lt;code&gt;from&lt;&#x2F;code&gt;&#x27;s account balance does not have enough tokens to spend.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;data&lt;&#x2F;code&gt; parameter contains implementation-specific information such as cryptographic proofs.&lt;&#x2F;p&gt;
&lt;p&gt;See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7984&#x2F;#callback-details&quot;&gt;Callback Details&lt;&#x2F;a&gt; below for details on the callback flow.&lt;&#x2F;p&gt;
&lt;p&gt;Returns the actual amount that was transferred.&lt;&#x2F;p&gt;
&lt;p&gt;MUST revert if the caller is not an operator for &lt;code&gt;from&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST emit the &lt;code&gt;ConfidentialTransfer&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; confidentialTransferFromAndCall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; callData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;events&quot;&gt;Events&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;h4 id=&quot;confidentialtransfer&quot;&gt;ConfidentialTransfer&lt;&#x2F;h4&gt;
&lt;p&gt;MUST trigger when confidential tokens are transferred, including zero value transfers.&lt;&#x2F;p&gt;
&lt;p&gt;A token contract which creates new tokens SHOULD trigger a ConfidentialTransfer event with the &lt;code&gt;from&lt;&#x2F;code&gt; address set to &lt;code&gt;0x0&lt;&#x2F;code&gt; when tokens are created.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ConfidentialTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;h4 id=&quot;operatorset&quot;&gt;OperatorSet&lt;&#x2F;h4&gt;
&lt;p&gt;MUST trigger on any successful call to &lt;code&gt;setOperator&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OperatorSet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; holder&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint48&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; until&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;h4 id=&quot;amountdisclosed&quot;&gt;AmountDisclosed&lt;&#x2F;h4&gt;
&lt;p&gt;SHOULD trigger when a pointer amount is publicly disclosed through implementation-specific mechanisms.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AmountDisclosed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; handle&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;callback-details&quot;&gt;Callback Details&lt;&#x2F;h3&gt;
&lt;p&gt;Transfer functions suffixed with &lt;code&gt;andCall&lt;&#x2F;code&gt; execute a callback to the &lt;code&gt;to&lt;&#x2F;code&gt; address AFTER all transfer logic is completed. The callback calls the &lt;code&gt;onConfidentialTransferReceived&lt;&#x2F;code&gt; function with the transfer initiator (operator), from address, actual amount sent, and given &lt;code&gt;callData&lt;&#x2F;code&gt; bytes (the last parameter for &lt;code&gt;andCall&lt;&#x2F;code&gt; functions). The callback flow is as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If &lt;code&gt;address(to).code.length == 0&lt;&#x2F;code&gt; the callback is a no-op and returns successfully.&lt;&#x2F;li&gt;
&lt;li&gt;Call &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7984&#x2F;#onconfidentialtransferreceived&quot;&gt;&lt;code&gt;onConfidentialTransferReceived(address, address, bytes32, bytes)&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; on &lt;code&gt;to&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If the function call reverts, revert.&lt;&#x2F;li&gt;
&lt;li&gt;If the function call returns the false boolean, attempt to transfer back the tokens to the original holder and return.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;contract-receivers&quot;&gt;Contract Receivers&lt;&#x2F;h3&gt;
&lt;p&gt;For a contract to receive a transfer with a callback, it MUST implement the &lt;code&gt;onConfidentialTransferReceived&lt;&#x2F;code&gt; function:&lt;&#x2F;p&gt;
&lt;h4 id=&quot;onconfidentialtransferreceived&quot;&gt;onConfidentialTransferReceived&lt;&#x2F;h4&gt;
&lt;p&gt;If the callback is unsuccessful, the function SHOULD revert or return a pointer to the false boolean.&lt;&#x2F;p&gt;
&lt;p&gt;The token will attempt to return tokens from the receiver to the sender if false is returned. Note that this reversal may fail if the receiver spends tokens as part of the callback.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onConfidentialTransferReceived&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;technology-agnostic-design&quot;&gt;Technology Agnostic Design&lt;&#x2F;h3&gt;
&lt;p&gt;Using &lt;code&gt;bytes32&lt;&#x2F;code&gt; allows implementations using pointer based systems and privacy mechanisms including FHE systems, zero-knowledge proofs, secure enclaves, or future technologies to be compliant.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;operator-model&quot;&gt;Operator Model&lt;&#x2F;h3&gt;
&lt;p&gt;Time-limited operators provide granular control while enabling DeFi protocol integration and natural permission expiration. This approach reduces the load on the external system by removing the need to track approval amounts.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;data-parameter&quot;&gt;Data Parameter&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;bytes calldata data&lt;&#x2F;code&gt; parameter in transfer functions allows implementations to include cryptographic proofs, access permissions, or other privacy-mechanism-specific information.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Security depends on the underlying pointer based mechanism. Implementations must guard against side-channel attacks and ensure proper key management for offchain operations.&lt;&#x2F;p&gt;
&lt;p&gt;Token callbacks are associated with inherent security risks, including reentrancy and gas griefing. When utilizing callbacks, consider using reentrancy protection and setting a gas limit.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Operator contract for non delegated EOAs</title>
        <published>2025-07-02T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Marcelo Morgado</name><uri>https://github.com/marcelomorgado</uri>
	</author>
	
	<author>
		<name>Manoj Patidar</name><uri>https://github.com/patidarmanoj10</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8000/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-8000-operator-contract-for-non-delegated-eoas/25003" />
        

        <id>https://wg-eips.ritovision.com/8000/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:8000"
            label="ERC-8000" />
        

        
        

        
        <summary type="html">Allowing operating batch executions on behalf of non delegated EOAs</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8000/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard defines a contract interface that enables externally owned accounts (EOAs) to perform batch call executions via a standard Operator contract, without requiring them to delegate control or convert into smart contract accounts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;ERC-7702&lt;&#x2F;a&gt; allows EOAs to become powerful smart contract accounts (SCA), which solves many UX issues, like the double &lt;code&gt;approve&lt;&#x2F;code&gt; + &lt;code&gt;transferFrom&lt;&#x2F;code&gt; transactions.&lt;br &#x2F;&gt;
While this new technology is still reaching wider adoption over time, we need a way to improve UX for the users that decide to not have code attached to their EOAs.&lt;br &#x2F;&gt;
This proposal introduces a lightweight, backward-compatible mechanism to enhance UX for such users. By leveraging a standardized Operator contract, EOAs can batch multiple contract calls into a single transaction—assuming the target contracts are compatible (i.e., implement the Operated pattern).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc2119&quot;&gt;RFC 2119&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc8174&quot;&gt;RFC 8174&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Operator: The contract that executes calls on the sender&#x27;s behalf.&lt;&#x2F;li&gt;
&lt;li&gt;Operated: The contract that supports calls through the Operator.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;It&#x27;s OPTIONAL but HIGHLY RECOMMENDED to have the &lt;code&gt;Operator&lt;&#x2F;code&gt; contract as a singleton.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;operator&quot;&gt;Operator&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.29&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IOperator&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Call&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; target&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span&gt; callData&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Execute calls&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; calls&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of Call structs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; returnData&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of bytes containing the responses&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; execute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Call&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; calls&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; returnData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address which initiated the executions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The actual sender of the calls&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onBehalfOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;methods&quot;&gt;Methods&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;execute&lt;&#x2F;code&gt;
Execute the calls sent by the actual sender.&lt;&#x2F;p&gt;
&lt;p&gt;MUST revert if any of the calls fail.&lt;br &#x2F;&gt;
MUST return data from the calls.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;onBehalfOf&lt;&#x2F;code&gt;
Used by the target contract to get the actual caller.&lt;&#x2F;p&gt;
&lt;p&gt;MUST return the actual &lt;code&gt;msg.sender&lt;&#x2F;code&gt; when called in the context of a call.&lt;br &#x2F;&gt;
MUST revert when called outside of the context of a call.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;operated&quot;&gt;Operated&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.29&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; { &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Context&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;utils&#x2F;Context.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; { &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IOperator&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;interfaces&#x2F;IOperator.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Operated contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Supports calls through the Operator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;abstract&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Operated&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Context&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    IOperator &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; immutable&lt;&#x2F;span&gt;&lt;span&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        operator &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IOperator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;operator_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @inheritdoc&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Context&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _msgSender&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;operator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;onBehalfOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Any contract can become compatible to execute the batch call by EOA using operator if it extends the &lt;code&gt;Operated&lt;&#x2F;code&gt; contract. The &lt;code&gt;Operated&lt;&#x2F;code&gt; contract overrides &lt;code&gt;_msgSender()&lt;&#x2F;code&gt; to return &lt;code&gt;operator.onBehalfOf()&lt;&#x2F;code&gt; when the call originates from the Operator. This ensures that the target contract recognizes the EOA initiating the batch execution, preserving correct sender context.&lt;&#x2F;p&gt;
&lt;p&gt;This behavior fits well with the usage of the _msgSender() function from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2771&#x2F;&quot;&gt;ERC-2771&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;methods-1&quot;&gt;Methods&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;_msgSender&lt;&#x2F;code&gt;
Returns &lt;code&gt;msg.sender&lt;&#x2F;code&gt; or &lt;code&gt;operator.onBehalfOf()&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;By having a trusted contract (&lt;code&gt;Operator&lt;&#x2F;code&gt;) that may act on behalf of the EOA wallet, this ERC provides batch call capabilities and keeps the EOA as the caller of the target contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The main limitation of this ERC is that only contracts that implements the &lt;code&gt;Operated&lt;&#x2F;code&gt; logic will be able to receive calls through the &lt;code&gt;Operator&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;operator-1&quot;&gt;Operator&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.29&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;TransientSlot&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;utils&#x2F;TransientSlot.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Address&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;utils&#x2F;Address.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ReentrancyGuardTransient&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;utils&#x2F;ReentrancyGuardTransient.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IOperator&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;interfaces&#x2F;IOperator.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Operator contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Allows standard EOAs to perform batch calls&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IOperator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ReentrancyGuardTransient&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    using&lt;&#x2F;span&gt;&lt;span&gt; TransientSlot &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    using&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; keccak256(abi.encode(uint256(keccak256(&amp;quot;operator.actual.sender&amp;quot;)) - 1)) &amp;amp; ~bytes32(uint256(0xff))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; MSG_SENDER_STORAGE &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x0de195ebe01a7763c35bcc87968c4e65e5a5ea50f2d7c33bed46c98755a66000&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    modifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setMsgSender&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        MSG_SENDER_STORAGE&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;asAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;tstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        _&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        MSG_SENDER_STORAGE&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;asAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;tstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @inheritdoc&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; IOperator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onBehalfOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _actualMsgSender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _actualMsgSender &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; MSG_SENDER_STORAGE&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;asAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;tload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_actualMsgSender &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;outside-call-context&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @inheritdoc&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; IOperator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; execute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        Call&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; calls_&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; nonReentrant&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setMsgSender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _returnData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; _length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; calls_&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _returnData &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;[](&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;_length&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; _sumOfValues&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        Call &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;calldata&lt;&#x2F;span&gt;&lt;span&gt; _call&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; _length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; )&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            _call &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; calls_&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            uint256&lt;&#x2F;span&gt;&lt;span&gt; _value &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _call&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            unchecked&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                _sumOfValues &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            _returnData&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; _call&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;target&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;functionCallWithValue&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_call&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;callData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            unchecked&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                +&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;value &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; _sumOfValues&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;value-mismatch&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Worth noting that the usage of transient storage (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1153&#x2F;&quot;&gt;EIP-1153&lt;&#x2F;a&gt;) for storing the &lt;code&gt;msg.sender&lt;&#x2F;code&gt; is highly RECOMMENDED.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;operated-1&quot;&gt;Operated&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.29&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Context&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;utils&#x2F;Context.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC20&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC20&#x2F;IERC20.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IOperator&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;interfaces&#x2F;IOperator.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Operated&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;Operated.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Operated contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Supports calls through the Operator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OperatorCompatible&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Operated&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InsufficientBalance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; balance&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Operated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;operator_) &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;     function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; deposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;token_ &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InvalidToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; _sender &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _msgSender&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        IERC20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;token_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        balance&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;token_&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; amount_&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; withdraw&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;token_ &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InvalidToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; _sender &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _msgSender&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;balance&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;token_&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; amount_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InsufficientBalance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        balance&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;token_&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; amount_&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        IERC20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;token_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;execute&lt;&#x2F;code&gt; function MUST implement reentracy control to avoid having a callback call overriding the sender&#x27;s storage.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;Operated&lt;&#x2F;code&gt; contract MUST interact with a trusted &lt;code&gt;Operator&lt;&#x2F;code&gt; contract.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Ed25519 transaction support</title>
        <published>2025-06-25T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>James Kempton</name><uri>https://github.com/SirSpudlington</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7980/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7980-adding-ed25519-as-a-signature-scheme-to-test-eip-7932/24663" />
        

        <id>https://wg-eips.ritovision.com/7980/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7980"
            label="EIP-7980" />
        

        
        

        
        <summary type="html">Adds an EIP-7932 algorithm type for Ed25519 support of type `0x0`</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7980/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP adds a new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7932&#x2F;&quot;&gt;EIP-7932&lt;&#x2F;a&gt; algorithm of type &lt;code&gt;0x0&lt;&#x2F;code&gt; for supporting Ed25519 signatures.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Ed25519 is one of the most widely used forms of Elliptic Curve Cryptography and is one of the defaults for SSH keys,
this makes it a good contender to be able to sign transactions with. It also provides an algorithm to write test
cases against during the implementation phase of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7932&#x2F;&quot;&gt;EIP-7932&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP defines a new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7932&#x2F;&quot;&gt;EIP-7932&lt;&#x2F;a&gt; algorithmic type with the following parameters:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ALG_TYPE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;Bytes1(0x0)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;GAS_PENALTY&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;1000&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_SIZE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;96&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;signature_info&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; payload_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  assert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature_info&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 96&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; signature_info&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;64&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  public_key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; signature_info&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;64&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This is the `Verify` function described in [RFC 8032 Section 5.1.7](https:&#x2F;&#x2F;datatracker.ietf.org&#x2F;doc&#x2F;html&#x2F;rfc8032#section-5.1.7),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This MUST be processed as raw `Ed25519` and not `Ed25519ctx` or `Ed25519ph`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  assert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ed25519_verify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; public_key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; payload_hash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  return&lt;&#x2F;span&gt;&lt;span&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;public_key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;20&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;additional-1000-gas-penalty&quot;&gt;Additional 1000 gas penalty&lt;&#x2F;h3&gt;
&lt;p&gt;The gas penalty discourages people from attempting to migrate off current secp256k1 accounts, and also covers the additional overhead (in regards to hashing) that the ed25519 curve applies.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-ed25519&quot;&gt;Why Ed25519?&lt;&#x2F;h3&gt;
&lt;p&gt;Ed25519 has significant tooling backing it, this makes it a good candidate for using as a &quot;dummy&quot; algorithm.
This allows it to be an algorithm for client teams to easily test &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7932&#x2F;&quot;&gt;EIP-7932&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;It may also be useful for signing in Hardware security modules in server environments designed for serving
as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt; bundlers. It may also improve interoperability with other components such as TPM chips.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;appending-the-public-key-to-the-signature&quot;&gt;Appending the public key to the signature&lt;&#x2F;h3&gt;
&lt;p&gt;Currently, without changing the algorithm itself, it is impossible to efficiently recover the public key
from a signature and message.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;!-- TODO --&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Increase Calldata Floor Cost</title>
        <published>2025-06-18T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Toni Wahrstätter</name><uri>https://github.com/nerolation</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7976/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7976-further-increase-calldata-cost/24597" />
        

        <id>https://wg-eips.ritovision.com/7976/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7976"
            label="EIP-7976" />
        

        
        

        
        <summary type="html">Increase the calldata floor cost to 15&#x2F;60 gas per byte to reduce maximum block size</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7976/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes an adjustment to calldata pricing by raising the floor cost from 10&#x2F;40 to 15&#x2F;60 gas per zero&#x2F;non-zero calldata byte. This reduces the worst-case block size by ~33% with minimal impact.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;While &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7623&#x2F;&quot;&gt;EIP-7623&lt;&#x2F;a&gt; successfully reduced the maximum possible block size by introducing a floor cost of 10&#x2F;40 gas per byte for data-heavy transactions, continued increases in gas limit demands further optimization. The current floor cost still permits relatively large data-heavy payloads that contribute to block size variance.&lt;&#x2F;p&gt;
&lt;p&gt;By increasing the floor cost to 15&#x2F;60 gas per byte, this proposal aims to:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Further reduce the maximum possible block size for data-heavy transactions&lt;&#x2F;li&gt;
&lt;li&gt;Create additional headroom for potential block gas limit increases&lt;&#x2F;li&gt;
&lt;li&gt;Maintain the same exemption for transactions with significant EVM computation&lt;&#x2F;li&gt;
&lt;li&gt;Have minimal impact on users&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;STANDARD_TOKEN_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;4&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TOTAL_COST_FLOOR_PER_TOKEN&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;15&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Let &lt;code&gt;tokens_in_calldata = zero_bytes_in_calldata + nonzero_bytes_in_calldata * 4&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Let &lt;code&gt;isContractCreation&lt;&#x2F;code&gt; be a boolean indicating the respective event.&lt;&#x2F;p&gt;
&lt;p&gt;Let &lt;code&gt;execution_gas_used&lt;&#x2F;code&gt; be the gas used for EVM execution with the gas refund subtracted.&lt;&#x2F;p&gt;
&lt;p&gt;Let &lt;code&gt;INITCODE_WORD_COST&lt;&#x2F;code&gt; be 2 as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3860&#x2F;&quot;&gt;EIP-3860&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The formula for determining the gas used per transaction changes from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7623&#x2F;&quot;&gt;EIP-7623&lt;&#x2F;a&gt;&#x27;s implementation to:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gasUsed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    21000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    +&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        STANDARD_TOKEN_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; tokens_in_calldata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        +&lt;&#x2F;span&gt;&lt;span&gt; execution_gas_used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        +&lt;&#x2F;span&gt;&lt;span&gt; isContractCreation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32000&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; INITCODE_WORD_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; words&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;calldata&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        TOTAL_COST_FLOOR_PER_TOKEN&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; tokens_in_calldata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Any transaction with a gas limit below &lt;code&gt;21000 + TOTAL_COST_FLOOR_PER_TOKEN * tokens_in_calldata&lt;&#x2F;code&gt; or below its intrinsic gas cost (take the maximum of these two calculations) is considered invalid. This limitation exists because transactions must cover the floor price of their calldata without relying on the execution of the transaction. There are valid cases where &lt;code&gt;gasUsed&lt;&#x2F;code&gt; will be below this floor price, but the floor price needs to be reserved in the transaction gas limit.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;With &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7623&#x2F;&quot;&gt;EIP-7623&lt;&#x2F;a&gt;&#x27;s implementation, data-heavy transactions cost 10&#x2F;40 gas per zero&#x2F;non-zero byte, reducing the maximum possible EL payload size to approximately 1.07 MB (&lt;code&gt;45s_000_000&#x2F;40&lt;&#x2F;code&gt;). This EIP further reduces this to approximately 0.72 MB (&lt;code&gt;45_000_000&#x2F;60&lt;&#x2F;code&gt;) for non zero bytes and maintains proportional costs for non-zero bytes.&lt;&#x2F;p&gt;
&lt;p&gt;By increasing calldata costs from 10&#x2F;40 to 15&#x2F;60 gas per byte for data-heavy transactions, this EIP provides:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Enhanced block size reduction&lt;&#x2F;strong&gt;: Maximum data-heavy payload size drops by ~33%.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Maintained user experience&lt;&#x2F;strong&gt;: Regular users engaging in DeFi, token transfers, and other EVM-heavy operations remain unaffected&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Better blob incentivization&lt;&#x2F;strong&gt;: Higher calldata costs further encourage migration to blob usage for data availability&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The floor cost mechanism ensures that transactions involving significant EVM computation continue to pay the standard 4&#x2F;16 gas per byte for calldata, preserving the user experience for regular Ethereum operations.&lt;&#x2F;p&gt;
&lt;p&gt;Analyzing the block range 20644414 - 23272414 (Sept. 2024 - Sept. 2025), 1.5% of all transactions would have been affected.&lt;&#x2F;p&gt;
&lt;p&gt;An empirical analysis summarizing the impact of this EIP can be found in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7976&#x2F;assets&#x2F;eip7976_empirical_analysis&#x2F;&quot;&gt;this&lt;&#x2F;a&gt; report.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This is a backwards incompatible gas repricing that requires a scheduled network upgrade.&lt;&#x2F;p&gt;
&lt;p&gt;Wallet developers and node operators MUST update gas estimation handling to accommodate the new calldata cost rules. Specifically:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Wallets&lt;&#x2F;strong&gt;: Wallets using &lt;code&gt;eth_estimateGas&lt;&#x2F;code&gt; MUST be updated to ensure that they correctly account for the updated &lt;code&gt;TOTAL_COST_FLOOR_PER_TOKEN&lt;&#x2F;code&gt; parameter of 15. Failure to do so could result in underestimating gas, leading to failed transactions.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Node Software&lt;&#x2F;strong&gt;: RPC methods such as &lt;code&gt;eth_estimateGas&lt;&#x2F;code&gt; MUST incorporate the updated formula for gas calculation with the new floor cost values.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Users can maintain their usual workflows without modification, as wallet and RPC updates will handle these changes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Testing for this EIP should verify the correct application of the new calldata cost floor of 15&#x2F;60 gas per zero&#x2F;non-zero byte:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Data-heavy transactions&lt;&#x2F;strong&gt;: Verify transactions with minimal EVM execution pay the floor cost of 15 gas per calldata token&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;EVM-heavy transactions&lt;&#x2F;strong&gt;: Confirm transactions with significant computation continue using standard 4&#x2F;16 gas per byte&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Edge cases&lt;&#x2F;strong&gt;: Test transactions at the boundary where execution gas equals or exceeds the floor cost&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Gas estimation&lt;&#x2F;strong&gt;: Validate that &lt;code&gt;eth_estimateGas&lt;&#x2F;code&gt; correctly accounts for the new &lt;code&gt;TOTAL_COST_FLOOR_PER_TOKEN&lt;&#x2F;code&gt; value&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Invalid transactions&lt;&#x2F;strong&gt;: Ensure transactions with insufficient gas limits are properly rejected&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;As the maximum possible block size is further reduced compared to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7623&#x2F;&quot;&gt;EIP-7623&lt;&#x2F;a&gt;, no additional security concerns are introduced beyond those already addressed in the original proposal.&lt;&#x2F;p&gt;
&lt;p&gt;The same transaction bundling considerations from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7623&#x2F;&quot;&gt;EIP-7623&lt;&#x2F;a&gt; apply:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Transaction bundling was already possible and remains so&lt;&#x2F;li&gt;
&lt;li&gt;Bundling does not compromise the block size reduction objectives&lt;&#x2F;li&gt;
&lt;li&gt;Practical limitations (trust, coordination) continue to limit widespread bundling&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The increased floor cost strengthens the incentive structure for appropriate data availability method selection without introducing new attack vectors.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>eth&#x2F;70 - partial block receipt lists</title>
        <published>2025-06-16T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Felix Lange</name><email>fjl@ethereum.org</email>
	</author>
	
	<author>
		<name>Jochem Brouwer</name><uri>https://github.com/jochem-brouwer</uri>
	</author>
	
	<author>
		<name>Giulio Rebuffo</name><uri>https://github.com/Giulio2002</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7975/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7975-eth-70-partial-block-receipt-lists/24658" />
        

        <id>https://wg-eips.ritovision.com/7975/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="networking"
                label="Networking" />
            
        

        
        <category
            term="tag:eip:7975"
            label="EIP-7975" />
        

        
        

        
        <summary type="html">Adds a facility for paginating block receipts in the p2p protocol</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7975/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP modifies the &#x27;eth&#x27; p2p protocol to allow requesting partial block receipt lists.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;As Ethereum moves toward a higher block gas limit on mainnet, the worst-case total size of
a block receipts list also becomes larger, and may eventually exceed the 10MiB message size
limit commonly applied in clients. This can lead to sync failures.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Modify the encoding for receipts in the &lt;code&gt;Receipts (0x10)&lt;&#x2F;code&gt; message as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;(eth&#x2F;69): &lt;code&gt;[request-id: P, [[receipt₁, receipt₂], ...]]&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;(eth&#x2F;70): &lt;code&gt;[request-id: P, lastBlockIncomplete: {0,1}, [[receipt₁, receipt₂], ...]]&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;If the &lt;code&gt;lastBlockIncomplete&lt;&#x2F;code&gt; flag is set to true (&lt;code&gt;1&lt;&#x2F;code&gt;), the last receipt list does not
contain all receipts of the block, and the client will have to request the remaining
receipts of that block in a new request.&lt;&#x2F;p&gt;
&lt;p&gt;To support such partial queries, we also modify the &lt;code&gt;GetReceipts (0x0f)&lt;&#x2F;code&gt; message:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;(eth&#x2F;69): &lt;code&gt;[request-id: P, [blockhash₁: B_32, blockhash₂: B_32, ...]]&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;(eth&#x2F;70): &lt;code&gt;[request-id: P, firstBlockReceiptIndex: P, [blockhash₁: B_32, blockhash₂: B_32, ...]]&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;For the first block in the list of requested block hashes, the server shall omit receipts
up to the &lt;code&gt;firstBlockReceiptIndex&lt;&#x2F;code&gt; from the response.&lt;&#x2F;p&gt;
&lt;p&gt;Downloading block receipts across multiple messages creates new attack surface. Partial
receipt lists cannot be verified against the block header, so in responses with
&lt;code&gt;lastBlockIncomplete = 1&lt;&#x2F;code&gt;, the last receipts list must be validated in a different way:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Verify the total number of delivered receipts matches the count of transactions.&lt;&#x2F;li&gt;
&lt;li&gt;Verify the size of each receipt against the gas limit of the corresponding transaction,
i.e. reject if it is larger than gaslimit&#x2F;8.&lt;&#x2F;li&gt;
&lt;li&gt;Verify the total downloaded receipts size is no larger than allowed by the block gas limit.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;!-- Needs exact formula --&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Since &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7825&#x2F;&quot;&gt;EIP-7825&lt;&#x2F;a&gt; caps the gas limit of a single transaction to ~16.7M gas, a single
transaction receipt will always be limited in size. Specifically, a transaction can
produce at most 16777216&#x2F;8 = 2MiB of log data.&lt;&#x2F;p&gt;
&lt;p&gt;However, a block can contain contain multiple transactions, and thus the entire block
receipts list can be much larger. At a block gas limit of ~83M, the &lt;code&gt;Receipts&lt;&#x2F;code&gt; message
could exceed 10MiB. Clients typically reject messages above this size because their
validity can only be determined after fetching the complete message.&lt;&#x2F;p&gt;
&lt;p&gt;For a &lt;code&gt;Receipts&lt;&#x2F;code&gt; message, each block receipts list is validated by checking the full list
against the tree root stored in the block header. When downloading a paginated list across
multiple requests, the client must potentially buffer more than 10MB of unvalidated input.
This cannot be avoided, since the protocol allows receipt lists of such size at a high
block gas limit. However, we can at least bound the input size by applying sanity checks
as recommended in the specification section.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP changes the eth protocol and requires rolling out a new version, &lt;code&gt;eth&#x2F;70&lt;&#x2F;code&gt;.
Supporting multiple versions of a wire protocol is possible. Rolling out a new version
does not break older clients immediately, since they can keep using protocol version
&lt;code&gt;eth&#x2F;69&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP does not change consensus rules of the EVM and does not require a hard fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;None&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Warm Account Write Metering</title>
        <published>2025-06-14T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Charles Cooper</name><uri>https://github.com/charles-cooper</uri>
	</author>
	
	<author>
		<name>Maria Silva</name><uri>https://github.com/misilva73</uri>
	</author>
	
	<author>
		<name>Ben Adams</name><uri>https://github.com/benaadams</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7973/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7973-warm-account-write-metering/25907" />
        

        <id>https://wg-eips.ritovision.com/7973/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7973"
            label="EIP-7973" />
        

        
        

        
        <summary type="html">Introduce warm account writes, decreasing the cost of writing to an account after the first write.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7973/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces warm metering for account writes. Namely, if one of the account fields (&lt;code&gt;nonce&lt;&#x2F;code&gt;, &lt;code&gt;value&lt;&#x2F;code&gt;, &lt;code&gt;codehash&lt;&#x2F;code&gt;) is changed more than once in a transaction, the later writes are cheaper, since the state root update only happens once.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Updating the state root is one of the most expensive parts of block construction. Currently, multiple writes to storage are subject to a net gas metering, which reduces the cost of a storage write after the first write. However, updates to the account are subject to the same cost every time.&lt;&#x2F;p&gt;
&lt;p&gt;This means that, for example, making multiple WETH transfers to an account in a single transaction gets successfully cheaper as the cold access cost is amortized over the remaining accesses. At the same time, the same discount does not occur when making multiple native ETH transfers. This discourages people from using native ETH transfers, and unfairly penalizes potential future opcodes that involve value transfer, like &lt;code&gt;PAY&lt;&#x2F;code&gt; and &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP brings the gas cost of the account update more in line with the actual execution cost. Multiple writes within a transaction can be batched, meaning that, after the first write, the cost of updating the state root does not need to be charged again.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The parameters &lt;code&gt;GAS_CALL_VALUE&lt;&#x2F;code&gt; and &lt;code&gt;GAS_STORAGE_UPDATE&lt;&#x2F;code&gt; are removed, and the following parameters are introduced:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&quot;text-align: center&quot;&gt;&lt;strong&gt;Parameter&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;&lt;strong&gt;Value&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;&lt;strong&gt;Description&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;GAS_COLD_STORAGE_WRITE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;Cost of a single update to the storage trie&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;GAS_COLD_ACCOUNT_WRITE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;Cost of a single update to the account trie&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;GAS_WARM_WRITE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;Cost of a warm update to a trie (i.e. does not trigger a new state root calculation)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;&amp;lt;-- TODO --&amp;gt;&lt;&#x2F;p&gt;
&lt;p&gt;On the account-updating opcodes &lt;code&gt;CREATE&lt;&#x2F;code&gt;, &lt;code&gt;CREATE2&lt;&#x2F;code&gt;, and &lt;code&gt;*CALL&lt;&#x2F;code&gt;, instead of charging &lt;code&gt;GAS_CALL_VALUE&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;GAS_COLD_ACCOUNT_WRITE&lt;&#x2F;code&gt; is charged if the account fields &lt;strong&gt;are equal&lt;&#x2F;strong&gt; to the transaction start values (i.e., they have not yet been updated by the transaction), or&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;GAS_WARM_WRITE&lt;&#x2F;code&gt; is charged if the account fields &lt;strong&gt;are not equal&lt;&#x2F;strong&gt; to the transaction start values (i.e., they have already been updated before by the transaction).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;code&gt;SSTORE&lt;&#x2F;code&gt; is also subjected to warm account metering. That is, this EIP splits the cost of &lt;code&gt;SSTORE&lt;&#x2F;code&gt; into two components, the cost to update the account tuple, and the cost to update the state trie. Note that if the state trie has already been updated once in a transaction, the account tuple is already dirty, and so we can amortize the cost of updating the account tuple again. Thus, the gas cost of &lt;code&gt;SSTORE&lt;&#x2F;code&gt; and its refund logic is updated to:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; get original_value and current_value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;message&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;block_env&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;original_value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_storage_original&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;message&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;current_target&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;current_value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_storage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;message&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;current_target&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; get account info&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;original_account&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_account_original&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;message&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;block_env&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;message&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;current_target&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;message&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;block_env&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;message&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;current_target&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; initialize gas cost&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gas_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Charge account write cost&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; original_account&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GAS_WARM_WRITE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GAS_COLD_ACCOUNT_WRITE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Charge slot-specific costs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;message&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;current_target&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;accessed_storage_keys&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;accessed_storage_keys&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;message&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;current_target&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GAS_COLD_SLOAD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt; original_value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; current_value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span&gt; current_value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; new_value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; original_value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        gas_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GAS_STORAGE_SET&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        gas_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GAS_COLD_STORAGE_WRITE&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GAS_COLD_SLOAD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GAS_WARM_ACCESS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Refund Counter Calculation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt; current_value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; new_value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; original_value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span&gt; current_value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span&gt; new_value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Storage is cleared for the first time in the transaction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;refund_counter&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;GAS_STORAGE_CLEAR_REFUND&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; original_value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span&gt; current_value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Gas refund issued earlier to be reversed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;refund_counter&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;GAS_STORAGE_CLEAR_REFUND&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; original_value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; new_value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Storage slot being restored to its original value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; original_value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Slot was originally empty and was SET earlier&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;refund_counter&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;GAS_STORAGE_SET&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GAS_WARM_ACCESS&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Slot was originally non-empty and was UPDATED earlier&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;refund_counter&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;                GAS_COLD_STORAGE_WRITE&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GAS_COLD_SLOAD&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GAS_WARM_ACCESS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Refund account writting cost (only if cold)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; original_account&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;refund_counter&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GAS_COLD_ACCOUNT_WRITE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;For compatibility with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7928&#x2F;&quot;&gt;EIP-7928&lt;&#x2F;a&gt; and parallel execution, if the accessed account shows updates in the Block-Level Access List (BAL) in a transaction indexed before the current transaction, then the values to compare against are taken from this entry instead of the account trie.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;An account is represented within Ethereum as a tuple &lt;code&gt;(nonce, balance, storage_root, codehash)&lt;&#x2F;code&gt;. The account is a leaf of a Merkle Patricia Tree (MPT), while the &lt;code&gt;storage_root&lt;&#x2F;code&gt; is itself the root of the account&#x27;s MPT key-value store. An update to the account&#x27;s storage requires updating two MPTs (the account&#x27;s &lt;code&gt;storage_root&lt;&#x2F;code&gt;, as well as the global state root). Meanwhile, updating the other fields in an account requires updating only one MPT.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal clarifies the cost of updating state by introducing the &lt;code&gt;*_WRITE&lt;&#x2F;code&gt; parameters. It also separates the cost of a storage state root update (&lt;code&gt;GAS_COLD_STORAGE_ACCESS&lt;&#x2F;code&gt;) and the cost of an account state root update (&lt;code&gt;GAS_COLD_ACCOUNT_ACCESS&lt;&#x2F;code&gt;). This parametrization allows us to apply warm costing to account updates. When the same account is updated multiple times in the same transaction, the state root calculation can be batched and all updates can be done in the same calculation. Therefore, the cost of making more updates to an already updated account is not the same as the first update.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;benchmarking&quot;&gt;Benchmarking&lt;&#x2F;h3&gt;
&lt;p&gt;This proposal does not yet have finalized numbers. To achieve this, we require stateful benchmarks, which are currently in development. Once we collect that data, we will set the final numbers.&lt;&#x2F;p&gt;
&lt;p&gt;&amp;lt;– TODO –&amp;gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;net-metering&quot;&gt;Net metering&lt;&#x2F;h3&gt;
&lt;p&gt;Net metering (i.e., issuing a refund if the final value at the end of the transaction is equal to the transaction start, à la &lt;code&gt;SSTORE&lt;&#x2F;code&gt;) was considered, but not added for simplicity.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This is a backwards-incompatible gas repricing that requires a scheduled network upgrade.&lt;&#x2F;p&gt;
&lt;p&gt;Wallet developers and node operators MUST update gas estimation handling to accommodate the new account access cost rules. Specifically:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Wallets: Wallets using &lt;code&gt;eth_estimateGas&lt;&#x2F;code&gt; MUST be updated to ensure that they correctly account for the updated gas parameters. Failure to do so could result in overestimating gas, leading to potential attacks vectors.&lt;&#x2F;li&gt;
&lt;li&gt;Node Software: RPC methods such as &lt;code&gt;eth_estimateGas&lt;&#x2F;code&gt; MUST incorporate the updated formula for gas calculation with the new cost values.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Users can maintain their usual workflows without modification, as wallet and RPC updates will handle these changes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Decreasing the cost of account access operations could introduce new attack vectors. More analysis is needed to understand the potential effects on various dApps and user behaviors.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Hard Limits for Transient Storage</title>
        <published>2025-06-12T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Charles Cooper</name><uri>https://github.com/charles-cooper</uri>
	</author>
	
	<author>
		<name>Ben Adams</name><uri>https://github.com/benaadams</uri>
	</author>
	
	<author>
		<name>Maria Silva</name><uri>https://github.com/misilva73</uri>
	</author>
	
	<author>
		<name>Jochem Brouwer</name><uri>https://github.com/jochem-brouwer</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7971/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/add-eip-hard-limit-and-cost-reduction-for-transient-storage-allocation/24542" />
        

        <id>https://wg-eips.ritovision.com/7971/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7971"
            label="EIP-7971" />
        

        
        

        
        <summary type="html">Decrease costs for TLOAD and TSTORE with a transaction-global limit</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7971/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes to reduce the gas costs for transient storage operations (&lt;code&gt;TLOAD&lt;&#x2F;code&gt; and &lt;code&gt;TSTORE&lt;&#x2F;code&gt;) by implementing constant pricing. To prevent denial-of-service attacks through excessive memory allocation, a transaction-global limit on transient storage slots is introduced. This approach provides lower costs for common use cases while maintaining security against resource exhaustion attacks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1153&#x2F;&quot;&gt;EIP-1153&lt;&#x2F;a&gt; introduced transient storage with gas costs equivalent to warm storage operations (100 gas). The current pricing model presents several limitations:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Reentrancy Protection Cost: At 100 gas per operation, implementing reentrancy locks by default remains expensive enough to discourage universal adoption at the language level, leaving contracts vulnerable to one of the most common attack vectors.&lt;&#x2F;li&gt;
&lt;li&gt;Underutilization: The high cost is still punishing to developers who wish to use transient storage for other legitimate use cases such as temporary approvals, callback metadata, and cross-frame communication within transactions.&lt;&#x2F;li&gt;
&lt;li&gt;Pricing Inconsistency: Transient storage fundamentally requires fewer resources than persistent storage (no disk I&#x2F;O, no state root updates), yet is priced identically to warm storage operations.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;This EIP addresses these issues by implementing constant, lower pricing for transient storage operations while introducing a transaction-global limit to prevent denial-of-service attacks. It also makes the cost of warm storage cheaper. This provides lower costs and enables broader adoption of transient storage, while also providing hard resource limits for clients.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP introduces the following parameters:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&quot;text-align: left&quot;&gt;Constant&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: left&quot;&gt;Value&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: left&quot;&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;GAS_TLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;5&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Gas cost of &lt;code&gt;TLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;GAS_TSTORE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;12&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Gas cost of &lt;code&gt;TSTORE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;MAX_TRANSIENT_SLOTS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;131072&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;The maximum number of transient slots allowed in a single transaction&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;GAS_TSTORE_ALLOCATE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;24&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Cost of additional allocated slots&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;gas-cost-changes&quot;&gt;Gas Cost Changes&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;The gas cost for &lt;code&gt;TLOAD&lt;&#x2F;code&gt; (opcode &lt;code&gt;0x5c&lt;&#x2F;code&gt;) is reduced from &lt;code&gt;GAS_WARM_ACCESS&lt;&#x2F;code&gt; (100) to &lt;code&gt;GAS_TLOAD&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The base gas cost for &lt;code&gt;TSTORE&lt;&#x2F;code&gt; (opcode &lt;code&gt;0x5d&lt;&#x2F;code&gt;) is reduced from &lt;code&gt;GAS_WARM_ACCESS&lt;&#x2F;code&gt; (100) to &lt;code&gt;GAS_TSTORE&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;transaction-global-transient-storage-limit&quot;&gt;Transaction-Global Transient Storage Limit&lt;&#x2F;h3&gt;
&lt;p&gt;A transaction-global counter tracks the number of unique transient storage slots written across all contracts during transaction execution:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;At the beginning of each transaction, initialize a counter &lt;code&gt;transient_slots_used&lt;&#x2F;code&gt; to 0.&lt;&#x2F;li&gt;
&lt;li&gt;When &lt;code&gt;TSTORE&lt;&#x2F;code&gt; is executed:
&lt;ul&gt;
&lt;li&gt;If the slot has not been written to during this transaction (across any contract), increment &lt;code&gt;transient_slots_used&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;transient_slots_used&lt;&#x2F;code&gt; exceeds &lt;code&gt;MAX_TRANSIENT_SLOTS&lt;&#x2F;code&gt;, the transaction MUST exceptionally halt.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The counter persists across all message calls in the transaction.&lt;&#x2F;li&gt;
&lt;li&gt;The counter is reset to 0 at the end of the transaction.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;implementation-note&quot;&gt;Implementation Note&lt;&#x2F;h3&gt;
&lt;p&gt;Implementations MUST track transient storage allocated across all contracts. A slot is considered unique based on the tuple &lt;code&gt;(contract_address, storage_key)&lt;&#x2F;code&gt;. Writing to the same slot multiple times within a transaction does not generally increment the counter after the first write (unless the slot gets deallocated with a revert).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;constant-pricing-with-hard-limit&quot;&gt;Constant Pricing with Hard Limit&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP implements constant pricing with a hard limit for several reasons:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;A hard limit provides guarantees on the total resource consumption which are easier to reason about for clients, rather than needing to perform a calculation as a function of current gas limits to find out what total memory consumption could be.&lt;&#x2F;li&gt;
&lt;li&gt;Common use cases (e.g., reentrancy locks using 1-2 slots) are not penalized for worst case resource usage (like in DOS attacks).&lt;&#x2F;li&gt;
&lt;li&gt;Clients can safely pre-reserve all memory which could be used by transient storage up-front at the beginning of a transaction.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;gas-cost-selection&quot;&gt;Gas Cost Selection&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;GAS_TLOAD&lt;&#x2F;code&gt; (5 gas): Transient storage reads require only memory access without disk I&#x2F;O.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;GAS_TSTORE&lt;&#x2F;code&gt; (12 gas): Transient storage writes require memory allocation and journaling for revert support.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;GAS_TSTORE_ALLOCATE&lt;&#x2F;code&gt; (24 gas): Writes to fresh slots require memory allocation, which is more expensive than writing to an existing slot.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;code&gt;TSTORE&lt;&#x2F;code&gt; currently has a fixed cost. However, writing to fresh slots requires memory allocation, which is more expensive than writing to an existing slot. Therefore, we may consider introducing charging more for the first slot allocation through the parameter &lt;code&gt;GAS_TSTORE_ALLOCATE&lt;&#x2F;code&gt;. However, we would also need to introduce a mechanism to check for the first slot allocation versus subsequent allocations.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;benchmarking&quot;&gt;Benchmarking&lt;&#x2F;h4&gt;
&lt;p&gt;This proposal does not yet have finalized numbers. To achieve this, we require benchmarks on the transient memory operations, which are currently in development. Once we collect that data, we will set the final numbers. We will also use this to understand whether the difference in performance justifies pricing new slot allocations differently.&lt;&#x2F;p&gt;
&lt;p&gt;We should note that warm storage loads from cache are expected to have similar performance characteristics to transient storage reads. Therefore, the final parameters should be consistent with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8038&#x2F;&quot;&gt;EIP-8038&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&amp;lt;– TODO –&amp;gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;hard-limit-selection&quot;&gt;Hard Limit Selection&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;MAX_TRANSIENT_SLOTS&lt;&#x2F;code&gt; of 131072 allows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Sufficient slots for typical user applications&lt;&#x2F;li&gt;
&lt;li&gt;Memory usage bounded to approximately 8 MB per transaction (131072 slots * 64 bytes), which prevents OOM-based denial-of-service attacks&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;design-alternatives-considered&quot;&gt;Design Alternatives Considered&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;Per-Contract Limits: Increased complexity in reasoning about resource consumption based on the shape of the call stack.&lt;&#x2F;li&gt;
&lt;li&gt;Superlinear Pricing: Adds complexity, and still punishes &quot;common&quot; (non-DOS) use cases.&lt;&#x2F;li&gt;
&lt;li&gt;No Limit: May allow memory-based DOS attack if transaction-level gas limits change, or if pricing changes in the future.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The benefit of a hard limit is that the resource consumption is bounded predictably even in the presence of other parameter changes in the protocol.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No known issues, besides the gas cost of existing operations being cheaper.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;This reference implementation includes the mechanism to price &lt;code&gt;TSTORE&lt;&#x2F;code&gt; depending on whether the slot was previously allocated.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Pseudo-code for transaction execution with global transient storage limit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;GAS_TLOAD&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;GAS_TSTORE&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 12&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;GAS_TSTORE_ALLOCATE&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 24&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;MAX_TRANSIENT_SLOTS&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 131072&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransactionContext&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; __init__&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;transient_storage&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; (address, key) -&amp;gt; value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;unique_slots&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; set&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; set of (address, key) tuples&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;transient_slots_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Bytes32&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Charge gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;charge_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;GAS_TLOAD&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Return value or zero&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;transient_storage&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Charge gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;charge_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;GAS_TSTORE&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check if this is a new unique slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        slot_id&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; slot_id&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;unique_slots&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;charge_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;GAS_TSTORE_ALLOCATE&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;unique_slots&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;slot_id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check limit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;unique_slots&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_TRANSIENT_SLOTS&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                raise&lt;&#x2F;span&gt;&lt;span&gt; ExceptionalHalt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Transient storage limit exceeded&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Store value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;transient_storage&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;slot_id&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;With &lt;code&gt;MAX_TRANSIENT_SLOTS&lt;&#x2F;code&gt; = 131072, maximum memory allocation is bounded to 8 MB per transaction (131072 * 64 bytes). Compared to limits under current pricing (100 gas), a 60M gas transaction can allocate up to 600,000 slots (38.4 MB). This EIP reduces the maximum allocated amount by 79%.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>eth_sendRawTransactionSync Method</title>
        <published>2025-06-11T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Sam Battenally</name><uri>https://github.com/SmoothBot</uri>
	</author>
	
	<author>
		<name>Hai Nguyen</name><uri>https://github.com/hai-rise</uri>
	</author>
	
	<author>
		<name>Thanh Nguyen</name><uri>https://github.com/LampardNguyen234</uri>
	</author>
	
	<author>
		<name>Loc Nguyen</name><uri>https://github.com/silver-rise</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7966/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7966-eth-sendrawtransactionsync-method/24640" />
        

        <id>https://wg-eips.ritovision.com/7966/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="interface"
                label="Interface" />
            
        

        
        <category
            term="tag:eip:7966"
            label="EIP-7966" />
        

        
        

        
        <summary type="html">A JSON-RPC method to reduce transaction submission latency by allowing synchronous receipt of transaction hash and block inclusion.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7966/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes a new JSON-RPC method, &lt;code&gt;eth_sendRawTransactionSync&lt;&#x2F;code&gt;, which submits a signed raw transaction and waits synchronously for the transaction receipt or a configurable timeout before returning. This method addresses the user experience gap in high-frequency applications by offering stronger delivery guarantees than &lt;code&gt;eth_sendRawTransaction&lt;&#x2F;code&gt;. Additionally, when a transaction cannot be immediately executed due to a nonce gap, it returns the expected nonce as a hex string in the error response, eliminating the need for additional RPC calls to query account state.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, Ethereum clients submit signed transactions asynchronously using &lt;code&gt;eth_sendRawTransaction&lt;&#x2F;code&gt;. Clients receive a transaction hash immediately but must poll repeatedly for the transaction receipt, which increases latency and complicates client-side logic.&lt;&#x2F;p&gt;
&lt;p&gt;This asynchronous approach is not efficient for high-frequency blockchains or Layer 2 solutions with fast block times and low latency, where rapid transaction throughput and quick confirmation feedback are critical. The need to separately poll for receipts results in increased network overhead, slower overall transaction confirmation feedback, and more complex client implementations.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, when transactions cannot be immediately executed (e.g., due to nonce gaps or insufficient funds), existing methods provide generic error messages that don&#x27;t help developers understand or fix the issue. Developers must make additional RPC calls to query account state, creating unnecessary round-trips and delays.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7966&#x2F;.&#x2F;assets&#x2F;sync-vs-async.png&quot; alt=&quot;Sync vs Async Transaction Sending&quot; &#x2F;&gt;
&lt;em&gt;In a low-latency blockchain, transaction receipts are often available right after the transactions land in the block producer’s mempool. Requiring an additional RPC call introduces unnecessary latency.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;eth_sendRawTransactionSync&lt;&#x2F;code&gt; addresses these issues by combining transaction submission and receipt retrieval into a single RPC call. This helps:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;reduce total transaction submission and confirmation latency by approximately 50%;&lt;&#x2F;li&gt;
&lt;li&gt;simplify client implementations by eliminating the need for separate polling loops;&lt;&#x2F;li&gt;
&lt;li&gt;improve user experience by enabling more responsive dApps and wallets;&lt;&#x2F;li&gt;
&lt;li&gt;align blockchain interactions closer to traditional Web2 request-response patterns;&lt;&#x2F;li&gt;
&lt;li&gt;maintain backward compatibility and optionality, preserving existing RPC methods and semantics.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;method-name&quot;&gt;Method Name&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;eth_sendRawTransactionSync&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Position&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;th&gt;Required&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;DATA&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The signed transaction data&lt;&#x2F;td&gt;&lt;td&gt;Yes&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;INT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Maximum wait time in milliseconds&lt;&#x2F;td&gt;&lt;td&gt;No&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;parameter-validation-rules&quot;&gt;Parameter Validation Rules&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Transaction Data&lt;&#x2F;strong&gt;. MUST be a valid hex-encoded, RLP-encoded signed transaction (same as in &lt;code&gt;eth_sendRawTransaction&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Timeout&lt;&#x2F;strong&gt;. MUST be a positive integer not greater than the node-configured maximum timeout.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;returns&quot;&gt;Returns&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;On success&lt;&#x2F;strong&gt;. Node implementations MUST return the transaction receipt object as defined by the &lt;code&gt;eth_getTransactionReceipt&lt;&#x2F;code&gt; method.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;On timeout error&lt;&#x2F;strong&gt;. Node implementations MUST return an error code &lt;code&gt;4&lt;&#x2F;code&gt; with a timeout message.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;On unreadiness error&lt;&#x2F;strong&gt;. Node implementations SHOULD return an error code &lt;code&gt;5&lt;&#x2F;code&gt; with an error message.
&lt;ul&gt;
&lt;li&gt;This happens when the processing node is not ready to accept a new transaction or the transaction is erroneous (DX improvement).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;On standard error&lt;&#x2F;strong&gt;. Node implementations MUST return a JSON-RPC error object consistent with existing RPC error formats.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;error-codes-and-response-structure&quot;&gt;Error Codes and Response Structure&lt;&#x2F;h3&gt;
&lt;p&gt;The following error codes are specific to &lt;code&gt;eth_sendRawTransactionSync&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Code&lt;&#x2F;th&gt;&lt;th&gt;Error Type&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;th&gt;Data Format&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;4&lt;&#x2F;td&gt;&lt;td&gt;Timeout&lt;&#x2F;td&gt;&lt;td&gt;Transaction was added to mempool but not processed within timeout&lt;&#x2F;td&gt;&lt;td&gt;Transaction hash (hex)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;td&gt;Unknown&#x2F;Queued&lt;&#x2F;td&gt;&lt;td&gt;Transaction is NOT added to mempool (not ready for execution)&lt;&#x2F;td&gt;&lt;td&gt;Transaction hash (hex)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;6&lt;&#x2F;td&gt;&lt;td&gt;Nonce Gap&lt;&#x2F;td&gt;&lt;td&gt;Transaction is NOT added to mempool (nonce gap detected)&lt;&#x2F;td&gt;&lt;td&gt;Expected nonce (hex)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;When an error occurs, the response includes:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;code&lt;&#x2F;code&gt;: The error code indicating the error type&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;message&lt;&#x2F;code&gt;: A human-readable error message&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;data&lt;&#x2F;code&gt;: Error-specific data:
&lt;ul&gt;
&lt;li&gt;For error code &lt;code&gt;4&lt;&#x2F;code&gt; (Timeout): Contains the transaction hash as a hex string (e.g., &lt;code&gt;&quot;0x1234abcd...&quot;&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;For error code &lt;code&gt;5&lt;&#x2F;code&gt; (Unknown&#x2F;Queued): Contains the transaction hash as a hex string (e.g., &lt;code&gt;&quot;0x1234abcd...&quot;&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;For error code &lt;code&gt;6&lt;&#x2F;code&gt; (Nonce Gap): Contains the expected nonce as a hex string (e.g., &lt;code&gt;&quot;0x5&quot;&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;node-configured-timeouts&quot;&gt;Node-Configured Timeouts&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;The handler function of this RPC SHOULD incorporate a configurable timeout when waiting for receipts (RECOMMENDED: 2 seconds).&lt;&#x2F;li&gt;
&lt;li&gt;Node implementations SHOULD provide a way to configure the timeout duration.&lt;&#x2F;li&gt;
&lt;li&gt;Node operators MAY implement dynamic timeout adjustment based on real-time network conditions.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;behavior&quot;&gt;Behavior&lt;&#x2F;h3&gt;
&lt;p&gt;Upon receiving an &lt;code&gt;eth_sendRawTransactionSync&lt;&#x2F;code&gt; request, the handler function performs the following tasks.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If timeout parameter is provided, the handler function MUST validate its validity.
&lt;ul&gt;
&lt;li&gt;If the timeout is invalid, the handler function MUST use the default node-configure timeout.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The handler function MUST check if the transaction is ready for immediate execution BEFORE adding it to the mempool:
&lt;ul&gt;
&lt;li&gt;If the transaction has a nonce gap (transaction nonce is higher than the expected nonce), the handler function MUST NOT add the transaction to the mempool and MUST return error code &lt;code&gt;6&lt;&#x2F;code&gt; with the expected nonce as a hex string directly in the &lt;code&gt;data&lt;&#x2F;code&gt; field.&lt;&#x2F;li&gt;
&lt;li&gt;If the transaction is queued for any other reason (not ready for immediate execution), the handler function MUST NOT add the transaction to the mempool and MUST return error code &lt;code&gt;5&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;If the transaction is ready for immediate execution, the handler function MUST submit the signed transaction to the mempool as per the existing &lt;code&gt;eth_sendRawTransaction&lt;&#x2F;code&gt; semantics.&lt;&#x2F;li&gt;
&lt;li&gt;The handler function MUST wait for the transaction receipt until the timeout elapses.&lt;&#x2F;li&gt;
&lt;li&gt;If the receipt is found within the specified timeout, the handler function MUST return it immediately.&lt;&#x2F;li&gt;
&lt;li&gt;If the timeout expires without obtaining a receipt, the handler function MUST return an error code &lt;code&gt;4&lt;&#x2F;code&gt; with a timeout message and the transaction hash.&lt;&#x2F;li&gt;
&lt;li&gt;If the transaction submission fails (e.g., due to invalid transaction data), the handler function MUST return an error (following the &lt;code&gt;eth_sendRawTransaction&lt;&#x2F;code&gt; definition) immediately.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;example-request-no-timeout&quot;&gt;Example Request (No Timeout)&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;method&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_sendRawTransactionSync&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xf86c808504a817c80082520894ab... (signed tx hex)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;example-request-with-timeout&quot;&gt;Example Request (With Timeout)&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;method&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_sendRawTransactionSync&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xf86c808504a817c80082520894ab... (signed tx hex)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    5000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;example-response-success&quot;&gt;Example Response (Success)&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;transactionHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1234abcd...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;blockHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xabcd1234...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;blockNumber&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x10d4f&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;cumulativeGasUsed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x5208&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gasUsed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x5208&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;contractAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; null&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;logs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;status&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;example-response-timeout-error-code-4&quot;&gt;Example Response (Timeout - Error Code 4)&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;code&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;message&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The transaction was added to the mempool but wasn&amp;#39;t processed within the designated timeout interval.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1234abcd...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note: The &lt;code&gt;data&lt;&#x2F;code&gt; field contains the transaction hash as a hex string.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;example-response-nonce-gap-error-code-6&quot;&gt;Example Response (Nonce Gap - Error Code 6)&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;code&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 6&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;message&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The transaction was rejected due to a nonce gap. Please resubmit with the next on-chain nonce.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x5&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note: The &lt;code&gt;data&lt;&#x2F;code&gt; field contains the expected nonce as a hex string. No transaction hash is returned because the transaction was never added to the mempool.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;example-response-rejected-transaction-error-code-5&quot;&gt;Example Response (Rejected Transaction - Error Code 5)&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;code&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 5&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;message&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The transaction was rejected for an unknown reason.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1234abcd...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;example-response-standard-error&quot;&gt;Example Response (Standard Error)&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;code&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -32000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;message&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Invalid transaction&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-not-extend-existing-rpc&quot;&gt;Why Not Extend Existing RPC?&lt;&#x2F;h3&gt;
&lt;p&gt;Modifying &lt;code&gt;eth_sendRawTransaction&lt;&#x2F;code&gt; to support this behavior would risk compatibility issues and ambiguity. A separate method makes the semantics explicit and opt-in.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;node-configured-timeouts-1&quot;&gt;Node-Configured Timeouts&lt;&#x2F;h3&gt;
&lt;p&gt;Node implementations SHOULD allow configuration of the timeout period, defaulting to 2 seconds (depending on the implementation). This balances responsiveness and propagation guarantees without creating excessive overhead in node clients.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;user-configured-timeouts&quot;&gt;User-Configured Timeouts&lt;&#x2F;h3&gt;
&lt;p&gt;The optional timeout parameter allows clients to specify their preferred maximum wait time for transaction processing.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Applications can adjust timeouts based on their specific latency requirements.&lt;&#x2F;li&gt;
&lt;li&gt;The optional timeout prevents the RPC call from blocking indefinitely.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;optionality&quot;&gt;Optionality&lt;&#x2F;h3&gt;
&lt;p&gt;This method is optional and does not replace or change existing asynchronous transaction submission methods. Nodes that do not implement this method will continue to operate normally using the standard asynchronous RPC methods.&lt;&#x2F;p&gt;
&lt;p&gt;This RPC method is particularly suitable for EVM-compatible blockchains or L2 solutions with fast block times and low network latency, where synchronous receipt retrieval can significantly improve responsiveness. On high-latency or slower blockchains (e.g., Ethereum mainnet pre-sharding), the synchronous wait may cause longer RPC call durations or timeouts, making the method less practical.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;improved-ux&quot;&gt;Improved UX&lt;&#x2F;h3&gt;
&lt;p&gt;The synchronous receipt retrieval reduces the complexity of client applications by eliminating the need for separate polling logic.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;returned-nonces-in-error-code-6&quot;&gt;Returned Nonces in Error Code &lt;code&gt;6&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;When a transaction is rejected due to a nonce gap, error code &lt;code&gt;6&lt;&#x2F;code&gt; returns the expected nonce as a hex string in the &lt;code&gt;data&lt;&#x2F;code&gt; field. This design provides several benefits:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Immediate Nonce Recovery&lt;&#x2F;strong&gt;: Applications receive the correct nonce directly in the error response, eliminating the need for a separate &lt;code&gt;eth_getTransactionCount&lt;&#x2F;code&gt; call.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Reduced Latency&lt;&#x2F;strong&gt;: By avoiding additional RPC round-trips to query account state, applications can immediately construct and resubmit the transaction with the correct nonce.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a new RPC method and does not modify or deprecate any existing methods. Nodes that do not implement this method will continue operating normally. Existing applications using &lt;code&gt;eth_sendRawTransaction&lt;&#x2F;code&gt; are unaffected. Node implementations that do not support the method will simply return &lt;code&gt;method not found&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;A minimal reference implementation can be realized by wrapping existing &lt;code&gt;eth_sendRawTransaction&lt;&#x2F;code&gt; submission with logic that waits for the corresponding transaction receipt until a timeout elapses. Implementations MAY either rely on event-driven receipt-availability notifications or poll &lt;code&gt;eth_getTransactionReceipt&lt;&#x2F;code&gt; at short intervals until a receipt is found or a timeout occurs. Polling intervals or notification strategies and timeout values can be tuned by node implementations to optimize performance.&lt;&#x2F;p&gt;
&lt;p&gt;For example, in &lt;code&gt;reth&lt;&#x2F;code&gt;, we can implement the handler for &lt;code&gt;eth_sendRawTransactionSync&lt;&#x2F;code&gt; as follows.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;rust&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;async&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; fn&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; send_raw_transaction_sync&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    &amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    user_timeout_ms&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Option&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;u64&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RpcResult&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;OpTransactionReceipt&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_TIMEOUT_MS&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; u64&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2_000&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ERROR_CODE_TIMEOUT&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; i32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ERROR_CODE_UNKNOWN&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; i32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 5&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ERROR_CODE_NONCE_GAP&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; i32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 6&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ERROR_MSG_TIMEOUT_RECEIPT&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;str&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The transaction was added to the mempool but wasn&amp;#39;t processed within the designated timeout interval.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ERROR_MSG_UNKNOWN&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;str&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The transaction was rejected for an unknown reason.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ERROR_MSG_NONCE_GAP&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;str&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The transaction was rejected due to a nonce gap. Please resubmit with the next on-chain nonce.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; start_time&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Instant&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;::&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;now&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; timeout&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Duration&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;::&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;from_millis&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        user_timeout_ms&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;map_or&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;MAX_TIMEOUT_MS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;ms&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ms&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;MAX_TIMEOUT_MS&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; pool_transaction&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OpPooledTransaction&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;::&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;from_pooled&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;recover_raw_transaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; pool_transaction&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; outcome&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        .&lt;&#x2F;span&gt;&lt;span&gt;pool&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        .&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;add_transaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;TransactionOrigin&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;::&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Local&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; pool_transaction&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        .&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;await&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        .&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;map_err&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;OpEthApiError&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;::&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;from_eth_err&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If transaction is queued (not ready for immediate execution), remove it and return error&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; let&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AddedTransactionState&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;::&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Queued&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;reason&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; outcome&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        self&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pool&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;remove_transaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;outcome&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;hash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        match&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; reason&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            QueuedReason&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;::&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;NonceGap&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;                let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; expected_nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                    .&lt;&#x2F;span&gt;&lt;span&gt;pending_state&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                    .&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;basic_account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                    .&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ok&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                    .&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;flatten&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                    .&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;map&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;acc&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; format!&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;:x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; acc&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;nonce&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Err&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ErrorObject&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;::&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;owned&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;                    ERROR_CODE_NONCE_GAP&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;                    ERROR_MSG_NONCE_GAP&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;                    expected_nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                )&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;            _&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Err&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ErrorObject&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;::&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;owned&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;                    ERROR_CODE_UNKNOWN&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;                    ERROR_MSG_UNKNOWN&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;                    Some&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;hash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                )&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; outcome&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;hash&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    match&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        .&lt;&#x2F;span&gt;&lt;span&gt;pending_state&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        .&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;get_receipt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; timeout&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;saturating_sub&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;start_time&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;elapsed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        .&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;await&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        Some&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;receipt&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Ok&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;receipt&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        None&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Err&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ErrorObject&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;::&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;owned&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;            ERROR_CODE_TIMEOUT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;            ERROR_MSG_TIMEOUT_RECEIPT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            Some&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;hash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Other implementations such as &lt;code&gt;go-ethereum&lt;&#x2F;code&gt; can utilize a channel to signify receipt availability instead of polling.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;This method does not introduce new security risks beyond those inherent in transaction submission.&lt;&#x2F;li&gt;
&lt;li&gt;The node-configured timeout prevents indefinite blocking of RPC calls, protecting nodes from hanging requests.&lt;&#x2F;li&gt;
&lt;li&gt;Node implementations should handle timeout responses gracefully and continue monitoring transaction status as needed.&lt;&#x2F;li&gt;
&lt;li&gt;Nodes must ensure that the implementation does not degrade performance or cause denial-of-service.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Owner-Authorized Token Transfer Protocol</title>
        <published>2025-06-11T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Julius Lauterbach</name><uri>https://github.com/Julius278</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7968/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7951-owner-authorized-token-transfer-protocol/24526" />
        

        <id>https://wg-eips.ritovision.com/7968/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7968"
            label="ERC-7968" />
        

        
        

        
        <summary type="html">Enable third parties to transfer tokens authorized by a signed message.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7968/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal introduces an innovative token transfer processing model designed for third parties, enabling seamless use of Ethereum-based tokens (e.g., &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;) by non-crypto-native actors. The concept allows a third-party payment processor to initiate token transfers on behalf of another party and to cover the associated transaction (gas) fees. The main party (user) always remains the explicit owner of the tokens, which are securely held and referenced under their ownership in the smart contract.&lt;&#x2F;p&gt;
&lt;p&gt;The transfer process is two-phased:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Initiation:&lt;&#x2F;strong&gt; The payment processor proposes a token transfer via the smart contract. This proposal is emitted as an on-chain event, including all relevant transfer details and a unique hash of the transaction (“proposal hash”).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Approval:&lt;&#x2F;strong&gt; The authorized party (owner) reviews the proposal off-chain and, if in agreement, signs the proposal hash with their private key. This signature is sent to the payment processor, who then submits it to the smart contract. There, the contract verifies the signature and, upon approval, carries out the token transfer in the owner’s name.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;To increase security and usability, each proposal includes an explicit expiration time. If the signature is not submitted and verified within the defined validity period, the proposal becomes void and the transfer cannot be executed.&lt;&#x2F;p&gt;
&lt;p&gt;To further enhance user safety, the owner is provided with a function that allows transferring all token balances directly to their own address in case the payment processor becomes unresponsive, acts improperly, or if external conditions such as transaction costs change unfavorably.&lt;&#x2F;p&gt;
&lt;p&gt;This model empowers entities to integrate blockchain-based payments into their workflows without directly holding or managing cryptocurrencies. All token movements require explicit owner approval, ensuring security and retaining full user control. The payment processor is compensated “off-chain” (e.g., in fiat currency) and is responsible for gas costs.&lt;&#x2F;p&gt;
&lt;p&gt;By removing the technical and operational burdens of crypto management from the end user, this approach facilitates broader adoption of tokenized business cases and simplifies enterprise integration.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Adoption of blockchain-based payments and tokenized assets in enterprise and conventional business contexts is still often hindered by the need for end-users or business partners to directly manage cryptocurrencies, wallets, and on-chain transactions. For many organizations, the technical, regulatory, and operational burdens associated with self-custody and on-chain fee management present significant entry barriers.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal aims to lower these barriers by introducing a model in which a trusted third-party payment processor can manage all blockchain transactions on behalf of a token owner, including paying transaction fees. The owner maintains full control and explicit on-chain ownership of the assets, and must approve all outgoing transfers cryptographically. Payment for the processor&#x27;s services (including gas reimbursement) can take place off-chain and in fiat currency, which aligns with existing financial workflows and compliance expectations.&lt;&#x2F;p&gt;
&lt;p&gt;With an explicit fallback function, owners are further protected, ensuring they can always reclaim direct control over their assets if the processor becomes unresponsive or external conditions change.&lt;&#x2F;p&gt;
&lt;p&gt;In summary, this standard facilitates broader and more secure adoption of token-based processes by offloading complexity from end-users, while preserving security, transparency, and user sovereignty.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;methods&quot;&gt;Methods&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;smart-contract-that-holds-the-assets-itokenstorage-sol&quot;&gt;Smart Contract that holds the assets (&lt;code&gt;ITokenStorage.sol&lt;&#x2F;code&gt;)&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;transfer-proposal-proposetransaction&quot;&gt;Transfer proposal: &lt;code&gt;proposeTransaction&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; proposeTransaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amountToSent&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; destinationAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Called from the paymentProcessor&#x2F;transactionProvider of the storage to initiate a token transfer. Emits a &lt;code&gt;TransactionProposed&lt;&#x2F;code&gt; event.
The parameter &lt;code&gt;tokenAddress&lt;&#x2F;code&gt; is the address of the token which should be transferred.
The parameter &lt;code&gt;amountToSent&lt;&#x2F;code&gt; is the amount which should be transferred to the desired destination address.
The parameter &lt;code&gt;destinationAddress&lt;&#x2F;code&gt; defines the receiver of the defined token.
The proposal is stored in the contract and a unique (uint256) hash is generated for it, which is used for the approval process.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;transfer-completion-completetransaction&quot;&gt;Transfer completion: &lt;code&gt;completeTransaction&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; completeTransaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Called from the paymentProcessor&#x2F;transactionProvider of the storage to perform a token transfer. Emits a &lt;code&gt;TransactionCompleted&lt;&#x2F;code&gt; event.
The parameter &lt;code&gt;hash&lt;&#x2F;code&gt; is unique identifier of the transaction.
The parameter &lt;code&gt;signature&lt;&#x2F;code&gt; is a signed message which only includes the hash. This message is signed by the credentials of the owner, which are used to verify that the owner has approved the transaction.
This function includes a verification step to ensure that the signature is valid and corresponds to the owner of the tokens.
If the signature is valid, the contract executes the transfer of tokens from the smart contract to the &lt;code&gt;destinationAddress&lt;&#x2F;code&gt; specified in the proposal.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;fallback-function-sendfundstoowner&quot;&gt;Fallback function: &lt;code&gt;sendFundsToOwner&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; sendFundsToOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This function allows the owner to transfer all tokens held in the contract back to his&#x2F;her own address.
This is a safety measure to ensure that the owner can reclaim their assets if the payment processor becomes unresponsive or if external conditions change unfavorably.
Emits a &lt;code&gt;FallbackScenarioExecuted&lt;&#x2F;code&gt; event.
The parameter &lt;code&gt;tokenAddress&lt;&#x2F;code&gt; is the address of the token which should be transferred to the owner.
In case this method is called, the contract will transfer all tokens of the given type to the owner address.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;verification-of-the-signature-verifysignature&quot;&gt;Verification of the signature: &#x27;verifySignature&#x27;&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verifySignature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _signer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amountToSent&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; destinationAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This function is used to verify the signature of the owner. It checks if the signature corresponds to the provided parameters and the owner&#x27;s address.
The parameter &lt;code&gt;_signer&lt;&#x2F;code&gt; is the address of the owner who signed the proposal.
The parameter &lt;code&gt;tokenAddress&lt;&#x2F;code&gt; is the address of the token which should be transferred.
The parameter &lt;code&gt;amountToSent&lt;&#x2F;code&gt; is the amount which should be transferred to the desired destination address.
The parameter &lt;code&gt;destinationAddress&lt;&#x2F;code&gt; defines the receiver of the defined token.
The parameter &lt;code&gt;signature&lt;&#x2F;code&gt; is the signed message which only includes the hash of the proposal.&lt;&#x2F;p&gt;
&lt;p&gt;This function can be called by the owner to verify the signature before forwarding it to the paymentProcessor &#x2F; transactionProvider.
Also this function should be called within the &lt;code&gt;completeTransaction&lt;&#x2F;code&gt; function to ensure that the signature is valid before executing the transfer.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;summary&quot;&gt;Summary&lt;&#x2F;h5&gt;
&lt;p&gt;The interface &lt;code&gt;ITokenStorage.sol&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ITokenStorage&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransactionProposed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransactionCompleted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FallbackScenarioExecuted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; proposeTransaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amountToSent&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; destinationAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; completeTransaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; sendFundsToOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;tbd &lt;!-- TODO --&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;!-- TODO: Reference implementation --&gt;
&lt;!-- TODO: Test cases --&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion. &lt;!-- TODO --&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>DomainKeys Identified Mail (DKIM) Registry</title>
        <published>2025-06-11T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Mike Fu</name><uri>https://github.com/fumeng00mike</uri>
	</author>
	
	<author>
		<name>Matthew Yu</name><uri>https://github.com/0xknon</uri>
	</author>
	
	<author>
		<name>Ernesto García</name><uri>https://github.com/ernestognw</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7969/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/new-erc-dkim-registry-interface/24530" />
        

        <id>https://wg-eips.ritovision.com/7969/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:7969"
            label="ERC-7969" />
        

        
        

        
        <summary type="html">A registry for DKIM public key hashes, enabling on-chain verification.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7969/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes a standard interface for registering and validating DomainKeys Identified Mail (DKIM) public key hashes on the Ethereum blockchain. The interface allows domain owners to register their DKIM public key hashes and enables third parties to verify the validity of these hashes.&lt;&#x2F;p&gt;
&lt;p&gt;The registry operates by storing hashes of both domain names and DKIM public keys, creating a mapping that enables on-chain verification of DKIM signatures. Domain owners register their DKIM public key hashes by extracting the public key from their DNS TXT records (as specified in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc6376&quot;&gt;RFC 6376&lt;&#x2F;a&gt;), computing the hash, and submitting it to the registry. DKIM clients can then query the registry to verify that a given public key hash is authorized for a specific domain, enabling trustless email ownership verification for applications such as account abstraction and social recovery mechanisms.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;With the growing adoption of Account Abstraction &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt; and the emergence of ZK Email Technology, there is a need for a standardized way to verify email ownership on-chain. This EIP provides a crucial building block for these technologies by enabling the verification of DKIM signatures through on-chain registries.&lt;&#x2F;p&gt;
&lt;p&gt;This standard enables several important use cases:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Account Abstraction&lt;&#x2F;strong&gt;: When combined with zkEmail, this registry enables email-based account abstraction. Users can prove ownership of their email address through DKIM signatures, allowing them to:
&lt;ul&gt;
&lt;li&gt;Create and manage smart contract wallets&lt;&#x2F;li&gt;
&lt;li&gt;Sign transactions using their email credentials&lt;&#x2F;li&gt;
&lt;li&gt;Implement social recovery mechanisms&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Account Recovery&lt;&#x2F;strong&gt;: The registry facilitates secure account recovery mechanisms:
&lt;ul&gt;
&lt;li&gt;Users can recover their wallet access by on-chain proving email ownership&lt;&#x2F;li&gt;
&lt;li&gt;The process is trustless and secure due to the cryptographic nature of DKIM&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;interface&quot;&gt;Interface&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.25&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;XXX&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; DKIM Registry Interface&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;xxx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0xdee3d600.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IDKIMRegistry&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; KeyHashRegistered&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; domainHash&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; keyHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; KeyHashRevoked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; domainHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isKeyHashValid&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; domainHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; keyHash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;domain-hash&quot;&gt;Domain Hash&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;domainHash&lt;&#x2F;code&gt; parameter MUST be the hash of the lowercase domain name or subdomain name. For example:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;For the domain &quot;example.com&quot; using keccak256:&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;domainHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;example.com&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;For the subdomain &quot;mail.example.com&quot; using keccak256:&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;domainHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;mail.example.com&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The registry MUST treat each domain and subdomain as a distinct entity. This means that:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;A key hash registered for &quot;example.com&quot; does not automatically apply to its subdomains&lt;&#x2F;li&gt;
&lt;li&gt;Each subdomain can have its own independent DKIM key hash registration&lt;&#x2F;li&gt;
&lt;li&gt;The full domain name (including subdomain if present) must be hashed as a single string&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;key-hash&quot;&gt;Key Hash&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;keyHash&lt;&#x2F;code&gt; parameter MUST be a cryptographic hash of the DKIM public key. The public key should be in the standard DKIM format as specified in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc6376&quot;&gt;RFC 6376&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Implementations MAY choose any cryptographically secure hash function for computing the key hash. Common choices include keccak256, Poseidon (for zk-friendly applications) or other hash functions.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;dkim-public-key-specification&quot;&gt;DKIM Public Key Specification&lt;&#x2F;h3&gt;
&lt;p&gt;The DKIM public key MUST follow the format specified in RFC 6376. Here are the key requirements:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Key Format&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The public key MUST be in the format specified in the DKIM DNS record (p=PUBLIC_KEY)&lt;&#x2F;li&gt;
&lt;li&gt;The key MUST be base64 encoded&lt;&#x2F;li&gt;
&lt;li&gt;The key MUST NOT include the PEM headers or any other formatting&lt;&#x2F;li&gt;
&lt;li&gt;The key MUST be the raw public key data as specified in the DKIM DNS record&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Key Requirements&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The key MUST be a valid RSA public key&lt;&#x2F;li&gt;
&lt;li&gt;The key MUST be in the format as published in the domain&#x27;s DNS TXT record&lt;&#x2F;li&gt;
&lt;li&gt;The key MUST be the exact value from the p= parameter in the DKIM DNS record&lt;&#x2F;li&gt;
&lt;li&gt;The key MUST NOT include any whitespace or line breaks&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Key Registration Process&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Obtain the DKIM public key from the domain&#x27;s DNS TXT record&lt;&#x2F;li&gt;
&lt;li&gt;Extract the value from the p= parameter&lt;&#x2F;li&gt;
&lt;li&gt;Calculate the hash of the raw public key using the implementation&#x27;s chosen hash function&lt;&#x2F;li&gt;
&lt;li&gt;Register the hash in the DKIM registry&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Key Validation&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The registry MUST verify that the provided key hash corresponds to a valid DKIM public key&lt;&#x2F;li&gt;
&lt;li&gt;The key MUST be in the correct format as specified in RFC 6376&lt;&#x2F;li&gt;
&lt;li&gt;The key MUST be the exact value as published in the domain&#x27;s DNS record&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Example with keccak256&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;p&gt;Given the following DKIM DNS record from RFC 6376:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ORIGIN _domainkey.example.org.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;brisbane IN  TXT  (&amp;quot;v=DKIM1; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQ&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &amp;quot;KBgQDwIRP&#x2F;UC3SBsEmGqZ9ZJW3&#x2F;DkMoGeLnQg1fWn7&#x2F;zYt&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &amp;quot;IxN2SnFCjxOCKG9v3b4jYfcTNh5ijSsq631uBItLa7od+v&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &amp;quot;&#x2F;RtdC2UzJ1lWT947qR+Rcac2gbto&#x2F;NMqJ0fzfVjH4OuKhi&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &amp;quot;tdY9tf6mcwGjaNBcWToIMmPSPDdQPNUYckcQ2QIDAQAB&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                ```&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The process to register this key would be:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Extract the public key value from the p= parameter:&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDwIRP&#x2F;UC3SBsEmGqZ9ZJW3&#x2F;DkMoGeLnQg1fWn7&#x2F;zYtIxN2SnFCjxOCKG9v3b4jYfcTNh5ijSsq631uBItLa7od+v&#x2F;RtdC2UzJ1lWT947qR+Rcac2gbto&#x2F;NMqJ0fzfVjH4OuKhitdY9tf6mcwGjaNBcWToIMmPSPDdQPNUYckcQ2QIDAQAB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Calculate the keccak256 hash of the public key:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt; keyHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDwIRP&#x2F;UC3SBsEmGqZ9ZJW3&#x2F;DkMoGeLnQg1fWn7&#x2F;zYtIxN2SnFCjxOCKG9v3b4jYfcTNh5ijSsq631uBItLa7od+v&#x2F;RtdC2UzJ1lWT947qR+Rcac2gbto&#x2F;NMqJ0fzfVjH4OuKhitdY9tf6mcwGjaNBcWToIMmPSPDdQPNUYckcQ2QIDAQAB&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ol start=&quot;3&quot;&gt;
&lt;li&gt;Calculate the domain hash:&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt; domainHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;example.org&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ol start=&quot;4&quot;&gt;
&lt;li&gt;Register the key hash in the registry:&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;registry&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;setKeyHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;domainHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; keyHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;events&quot;&gt;Events&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;keyhashregistered&quot;&gt;KeyHashRegistered&lt;&#x2F;h4&gt;
&lt;p&gt;This event MUST be emitted when a new DKIM public key hash is registered for a domain.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; KeyHashRegistered&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; domainHash&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; keyHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;keyhashrevoked&quot;&gt;KeyHashRevoked&lt;&#x2F;h4&gt;
&lt;p&gt;This event MUST be emitted when a DKIM public key hash is revoked for a domain.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; KeyHashRevoked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; domainHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;functions&quot;&gt;Functions&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;iskeyhashvalid&quot;&gt;isKeyHashValid&lt;&#x2F;h4&gt;
&lt;p&gt;This function MUST return &lt;code&gt;true&lt;&#x2F;code&gt; if the provided key hash is valid for the given domain hash, and &lt;code&gt;false&lt;&#x2F;code&gt; otherwise.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isKeyHashValid&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; domainHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; keyHash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The interface is designed to be simple and focused on the core functionality of DKIM public key hash registration and validation. The use of keccak256 hashing for both domain names and public keys ensures consistent and secure handling of the data.&lt;&#x2F;p&gt;
&lt;p&gt;The events allow for efficient tracking of key registrations and revocations, which is important for maintaining the integrity of the registry.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a new interface and does not affect existing contracts or standards.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;access&#x2F;Ownable.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;interfaces&#x2F;IDKIMRegistry.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DKIMRegistry&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IDKIMRegistry&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Ownable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Ownable&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_owner) &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Mapping from hashed domain name to DKIM public key hash to enabled&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _keyHashes&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Checks if a DKIM key hash is valid for a given domain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; domainHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The hash of the domain name&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; keyHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The hash of the DKIM public key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; True if the key hash is valid for the domain, false otherwise&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isKeyHashValid&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; domainHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; keyHash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _keyHashes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;domainHash&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;keyHash&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sets a DKIM key hash for a domain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; domainHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The hash of the domain name&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; keyHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The hash of the DKIM public key to register&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Only callable by the contract owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Cannot set zero hash as a valid key hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setKeyHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; domainHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; keyHash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;keyHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;cannot set zero hash&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _keyHashes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;domainHash&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;keyHash&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; KeyHashRegistered&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;domainHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; keyHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sets multiple DKIM key hashes for a domain in a single transaction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; domainHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The hash of the domain name&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; keyHashes&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Array of DKIM public key hashes to register&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Only callable by the contract owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Array must not be empty&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Each key hash must not be zero&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setKeyHashes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; domainHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; keyHashes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;keyHashes&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;empty array&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; keyHashes&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            setKeyHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;domainHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; keyHashes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Revokes a DKIM key hash for a domain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; domainHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The hash of the domain name&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; keyHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The hash of the DKIM public key to revoke&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Only callable by the contract owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sets the key hash mapping to false, effectively revoking it&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revokeKeyHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; domainHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; keyHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        delete&lt;&#x2F;span&gt;&lt;span&gt; _keyHashes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;domainHash&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;keyHash&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; KeyHashRevoked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;domainHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;Domain owners must ensure they have control over their private keys and domain names.&lt;&#x2F;li&gt;
&lt;li&gt;The registry implementation should include proper access control mechanisms to prevent unauthorized registrations.&lt;&#x2F;li&gt;
&lt;li&gt;The registry should implement a mechanism to handle key rotation and revocation.&lt;&#x2F;li&gt;
&lt;li&gt;Implementations should consider rate limiting to prevent spam registrations.&lt;&#x2F;li&gt;
&lt;li&gt;Registries should select the &lt;code&gt;domainHash&lt;&#x2F;code&gt; and &lt;code&gt;keyHash&lt;&#x2F;code&gt; algorithms carefully. Upgrading the hash function must be thoughtfully planned.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>uRWA - Universal Real World Asset Interface</title>
        <published>2025-06-10T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Dario Lo Buglio</name><uri>https://github.com/xaler5</uri>
	</author>
	
	<author>
		<name>Tino Martinez Molina</name><uri>https://github.com/tinom9</uri>
	</author>
	
	<author>
		<name>Mihai Colceriu</name><uri>https://github.com/mihaic195</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7943/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-universal-rwa-interface/23972" />
        

        <id>https://wg-eips.ritovision.com/7943/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="last-call"
                label="Last Call" />
            
        

        
        <category
            term="tag:eip:7943"
            label="ERC-7943" />
        

        
        

        
        <summary type="html">Interfaces for common base tokens defining compliance checks, transfer controls, and enforcement actions for Real World Assets (RWAs).</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7943/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes the Universal RWA (uRWA) standard, a set of interfaces for tokenized Real World Assets (RWAs) such as securities, real estate, commodities, or other physical&#x2F;financial assets on the blockchain.&lt;&#x2F;p&gt;
&lt;p&gt;Real World Assets often require regulatory compliance features not found in standard tokens, including the ability to freeze assets, perform enforcement transfers for legal compliance, and restrict transfers to authorized users. The uRWA standard extends common token standards like &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; by introducing essential compliance functions while remaining minimal and not opinionated about specific implementation details.&lt;&#x2F;p&gt;
&lt;p&gt;This enables DeFi protocols and applications to interact with tokenized real-world assets in a standardized way, knowing they can check transfer permissions, whether users are allowed to interact, handle frozen assets appropriately, and integrate with compliant RWA tokens regardless of the underlying asset type or internal compliance logic. It also adopts &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; for introspection.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Real World Assets (RWAs) represent a significant opportunity to bridge traditional finance and decentralized finance (DeFi). By tokenizing assets like real estate, corporate bonds, commodities, art, or securities, we can unlock benefits such as fractional ownership, programmable compliance, enhanced liquidity through secondary markets for traditionally illiquid assets and integration with decentralized protocols.&lt;&#x2F;p&gt;
&lt;p&gt;However, tokenizing real world assets introduces regulatory requirements often absent in purely digital assets, such as allowlists for users, transfer restrictions, asset freezing, or law enforcement rules. Existing token standards like &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; lack the inherent structure to address these compliance needs directly within the standard itself.&lt;&#x2F;p&gt;
&lt;p&gt;Attempts at defining universal RWA standards historically imposed unnecessary complexity and gas overhead for simpler use cases that do not require the full spectrum of features like granular role-based access control, mandatory on-chain whitelisting, specific on-chain identity solutions, or metadata handling solutions mandated by the standard.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, the broad spectrum of RWA classes inherently suggests the need to move away from a one-size-fits-all solution. This means a minimalistic approach, unopinionated features list, and maximally compatible design have been kept in mind as design goals.&lt;&#x2F;p&gt;
&lt;p&gt;The uRWA standard seeks a more refined balance by defining an essential interface, establishing a common ground for interaction regarding compliance and control, without dictating the underlying implementation mechanisms. This allows core token implementations to remain lean while providing standard functions for RWA-specific interactions.&lt;&#x2F;p&gt;
&lt;p&gt;The final goal is to build composable DeFi around RWAs, providing the same interface when dealing with compliance and regulation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHOULD&quot;, and &quot;MAY&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;The following defines the standard interfaces for an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7943&#x2F;&quot;&gt;ERC-7943&lt;&#x2F;a&gt; token contract, which MUST extend from one base token interface such as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Interface for ERC-20 based implementations.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7943Fungible&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC165&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when tokens are taken from one address and transferred to another.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address from which tokens were taken.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to which seized tokens were transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount seized.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ForcedTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when `setFrozenTokens` is called, changing the frozen `amount` of tokens for `account`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the account whose tokens are being frozen.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of tokens frozen after the change.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Frozen&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Error reverted when an account is not allowed to transact. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the account which is not allowed for transfers.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC7943CannotTransact&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Error reverted when a transfer is not allowed according to internal rules. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address from which tokens are being sent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to which tokens are being sent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount sent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC7943CannotTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Error reverted when a transfer is attempted from `account` with an `amount` less than or equal to its balance, but greater than its unfrozen balance.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address holding the tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount being transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; unfrozen&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of tokens that are unfrozen and available to transfer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC7943InsufficientUnfrozenBalance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt; unfrozen&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Takes tokens from one address and transfers them to another.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Requires specific authorization. Used for regulatory compliance or recovery scenarios.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address from which `amount` is taken.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address that receives `amount`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount to force transfer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; result&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; True if the transfer executed correctly. Reverts on failure.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; forcedTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Changes the frozen status of `amount` tokens belonging to `account`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This overwrites the current value, similar to an `approve` function.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Requires specific authorization. Frozen tokens cannot be transferred by the account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the account whose tokens are to be frozen.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of tokens to freeze. It can be greater than account balance.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; result&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; True if the freezing executed correctly. Reverts on failure.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setFrozenTokens&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Checks if a specific account is allowed to transact according to token rules.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This is often used for allowlist&#x2F;KYC&#x2F;KYB&#x2F;AML checks.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to check.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; allowed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; True if the account is allowed, false otherwise.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; canTransact&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; allowed&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Checks the frozen status&#x2F;amount.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; It could return an amount higher than the account&amp;#39;s balance.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of tokens currently frozen for `account`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getFrozenTokens&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Checks if a transfer is currently possible according to token rules. It enforces validations on the frozen tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This can involve checks like allowlists, blocklists, transfer limits and other policy-defined restrictions.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address sending tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address receiving tokens. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount being transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; allowed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; True if the transfer is allowed, false otherwise.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; canTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; allowed&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Interface for ERC-721 based implementations.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7943NonFungible&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC165&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when `tokenId` is taken from one address and transferred to another.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address from which `tokenId` is taken.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to which seized `tokenId` is transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ID of the token being transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ForcedTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when `setFrozenTokens` is called, changing the frozen status of `tokenId` for `account`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the account whose `tokenId` is subjected to freeze&#x2F;unfreeze.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ID of the token subjected to freeze&#x2F;unfreeze.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; frozenStatus&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Whether `tokenId` has been frozen or unfrozen.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Frozen&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; frozenStatus&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Error reverted when an account is not allowed to transact. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the account which is not allowed for transfers.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC7943CannotTransact&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Error reverted when a transfer is not allowed according to internal rules. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address from which tokens are being sent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to which tokens are being sent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The id of the token being sent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC7943CannotTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Error reverted when a transfer is attempted from `account` with a `tokenId` which has been previously frozen.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address holding the token with `tokenId`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ID of the token being frozen and unavailable to be transferred. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC7943InsufficientUnfrozenBalance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Takes `tokenId` from one address and transfers it to another.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Requires specific authorization. Used for regulatory compliance or recovery scenarios.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address from which `tokenId` is taken.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address that receives `tokenId`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ID of the token being transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; result&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; True if the transfer executed correctly. Reverts on failure.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; forcedTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Changes the frozen status of `tokenId` belonging to an `account`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This overwrites the current value, similar to an `approve` function.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Requires specific authorization. Frozen tokens cannot be transferred by the account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the account whose tokens are to be frozen.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ID of the token to freeze.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; frozenStatus&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Whether `tokenId` is being frozen or not. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; result&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; True if the freezing executed correctly. Reverts on failure.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setFrozenTokens&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; frozenStatus&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Checks if a specific account is allowed to transact according to token rules.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This is often used for allowlist&#x2F;KYC&#x2F;KYB&#x2F;AML checks.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to check.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; allowed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; True if the account is allowed, false otherwise.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; canTransact&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; allowed&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Checks the frozen status of a specific `tokenId`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; It could return true even if account does not hold the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ID of the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; frozenStatus&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Whether `tokenId` is currently frozen for `account`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getFrozenTokens&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; frozenStatus&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Checks if a transfer is currently possible according to token rules. It enforces validations on the frozen tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This can involve checks like allowlists, blocklists, transfer limits and other policy-defined restrictions.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address sending tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address receiving tokens. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ID of the token being transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; allowed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; True if the transfer is allowed, false otherwise.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; canTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; allowed&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Interface for ERC-1155 based implementations.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7943MultiToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC165&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when tokens are taken from one address and transferred to another.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address from which tokens were taken.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to which seized tokens were transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ID of the token being transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount seized.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ForcedTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when `setFrozenTokens` is called, changing the frozen `amount` of `tokenId` tokens for `account`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the account whose tokens are being frozen.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ID of the token being frozen.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of tokens frozen after the change.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Frozen&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Error reverted when an account is not allowed to transact. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the account which is not allowed for transfers.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC7943CannotTransact&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Error reverted when a transfer is not allowed according to internal rules. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address from which tokens are being sent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to which tokens are being sent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The id of the token being sent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount sent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC7943CannotTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Error reverted when a transfer is attempted from `account` with an `amount` of `tokenId` less than or equal to its balance, but greater than its unfrozen balance.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address holding the `amount` of `tokenId` tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ID of the token being transferred. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of `tokenId` tokens being transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; unfrozen&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of tokens that are unfrozen and available to transfer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC7943InsufficientUnfrozenBalance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt; unfrozen&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Takes tokens from one address and transfers them to another.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Requires specific authorization. Used for regulatory compliance or recovery scenarios.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address from which `amount` is taken.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address that receives `amount`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ID of the token being transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount to force transfer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; result&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; True if the transfer executed correctly. Reverts on failure.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; forcedTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Changes the frozen status of `amount` of `tokenId` tokens belonging to an `account`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This overwrites the current value, similar to an `approve` function.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Requires specific authorization. Frozen tokens cannot be transferred by the account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the account whose tokens are to be frozen.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ID of the token to freeze.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of tokens to freeze. It can be greater than account balance.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; result&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; True if the freezing executed correctly. Reverts on failure.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setFrozenTokens&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Checks if a specific account is allowed to transact according to token rules.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This is often used for allowlist&#x2F;KYC&#x2F;KYB&#x2F;AML checks.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to check.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; allowed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; True if the account is allowed, false otherwise.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; canTransact&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; allowed&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Checks the frozen status&#x2F;amount of a specific `tokenId`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; It could return an amount higher than the account&amp;#39;s balance.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ID of the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of `tokenId` tokens currently frozen for `account`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getFrozenTokens&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Checks if a transfer is currently possible according to token rules. It enforces validations on the frozen tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This can involve checks like allowlists, blocklists, transfer limits and other policy-defined restrictions.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address sending tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address receiving tokens. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ID of the token being transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount being transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; allowed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; True if the transfer is allowed, false otherwise.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; canTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; allowed&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;cantransact-cantransfer-and-getfrozentokens&quot;&gt;&lt;code&gt;canTransact&lt;&#x2F;code&gt;, &lt;code&gt;canTransfer&lt;&#x2F;code&gt; and &lt;code&gt;getFrozenTokens&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;These provide views into the implementing contract&#x27;s compliance, transfer policy logic and freezing status. These functions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;MUST NOT revert.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;MUST NOT change the storage of the contract.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;MAY depend on context (e.g., current timestamp, block number or &lt;code&gt;msg.sender&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;canTransfer&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;MUST validate that the &lt;code&gt;amount&lt;&#x2F;code&gt; being transferred doesn&#x27;t exceed the unfrozen amount (which is the difference between the current balance and the frozen balance).&lt;&#x2F;li&gt;
&lt;li&gt;MUST perform a &lt;code&gt;canTransact&lt;&#x2F;code&gt; check on the &lt;code&gt;from&lt;&#x2F;code&gt; and &lt;code&gt;to&lt;&#x2F;code&gt; parameters. An important documentation note is that &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3643&#x2F;&quot;&gt;ERC-3643&lt;&#x2F;a&gt; doesn&#x27;t perform a &lt;code&gt;canTransact&lt;&#x2F;code&gt; check within &lt;code&gt;canTransfer&lt;&#x2F;code&gt; as required.&lt;&#x2F;li&gt;
&lt;li&gt;MUST return false in general, if any permissioned rule would prevent a given transfer from succeeding. A transfer refers to any operation that emits the token’s canonical transfer event. A permissioned check can be a pausing mechanism, a call to &lt;code&gt;canTransact&lt;&#x2F;code&gt; or anything else that requires privileged actors.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;getFrozenTokens&lt;&#x2F;code&gt; will return the absolute frozen amount, which MAY exceed the account&#x27;s current balance. In &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; tokens, it MAY return true even if the account does not hold the token.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;forcedtransfer&quot;&gt;&lt;code&gt;forcedTransfer&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;This function provides a standard mechanism for forcing a transfer from a &lt;code&gt;from&lt;&#x2F;code&gt; to a &lt;code&gt;to&lt;&#x2F;code&gt; address. The function:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;MUST directly manipulate balances or ownership to transfer the asset from &lt;code&gt;from&lt;&#x2F;code&gt; to &lt;code&gt;to&lt;&#x2F;code&gt; either by transferring or burning from &lt;code&gt;from&lt;&#x2F;code&gt; and minting to &lt;code&gt;to&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;MUST be restricted in access.&lt;&#x2F;li&gt;
&lt;li&gt;MUST perform necessary validation checks (e.g., sufficient balance&#x2F;ownership of a specific token).&lt;&#x2F;li&gt;
&lt;li&gt;MUST emit both the standard transfer event (from the base standard) and the &lt;code&gt;ForcedTransfer&lt;&#x2F;code&gt; event.&lt;&#x2F;li&gt;
&lt;li&gt;In single-party permissioned contexts:
&lt;ul&gt;
&lt;li&gt;It MAY bypass the &lt;code&gt;canTransfer&lt;&#x2F;code&gt; checks. If this happens, and the transfer involves tokens that are currently counted as frozen, it MUST unfreeze the assets first and emit a &lt;code&gt;Frozen&lt;&#x2F;code&gt; event before the underlying base token transfer event reflecting the change. Having the unfrozen amount changed before the actual transfer is critical for tokens that might be susceptible to reentrancy attacks doing external checks on recipients as it is the case for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; tokens.&lt;&#x2F;li&gt;
&lt;li&gt;It SHOULD at least perform a &lt;code&gt;canTransact&lt;&#x2F;code&gt; check on the &lt;code&gt;to&lt;&#x2F;code&gt; parameter to ensure compliance.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;In multi-party permissioned contexts:
&lt;ul&gt;
&lt;li&gt;It SHOULD perform the &lt;code&gt;canTransfer&lt;&#x2F;code&gt; checks and SHOULD NOT bypass the frozen constraints.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;MUST revert in cases where validations and&#x2F;or &lt;code&gt;canTransact&lt;&#x2F;code&gt; checks return false or fail.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;setfrozentokens&quot;&gt;&lt;code&gt;setFrozenTokens&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;It provides a way to freeze or unfreeze assets held by a specific account. This is useful for temporary lock mechanisms. This function:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;MUST emit the &lt;code&gt;Frozen&lt;&#x2F;code&gt; event.&lt;&#x2F;li&gt;
&lt;li&gt;MUST be restricted in access.&lt;&#x2F;li&gt;
&lt;li&gt;MUST allow freezing more assets than those held. This allows for future balances withholding.&lt;&#x2F;li&gt;
&lt;li&gt;MUST revert in cases of logical issues or validation checks failure.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;additional-specifications&quot;&gt;Additional Specifications&lt;&#x2F;h3&gt;
&lt;p&gt;The contract MUST implement the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; function and MUST return true for the &lt;code&gt;bytes4&lt;&#x2F;code&gt; value (representing the &lt;code&gt;interfaceId&lt;&#x2F;code&gt;):&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;0x29388973&lt;&#x2F;code&gt; for the fungible interface.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;0xa8fdc849&lt;&#x2F;code&gt; for the non-fungible interface.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;0x5627c61a&lt;&#x2F;code&gt; for the multi token interface.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Implementations of these interfaces MUST implement the necessary functions of their chosen base standard (e.g., &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; for the fungible interface, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; for the non-fungible interface and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; for the multi token interface) and MUST also restrict access to sensitive functions like &lt;code&gt;forcedTransfer&lt;&#x2F;code&gt; and &lt;code&gt;setFrozenTokens&lt;&#x2F;code&gt; using an appropriate access control mechanism (e.g., &lt;code&gt;onlyOwner&lt;&#x2F;code&gt;, Role-Based Access Control). The specific mechanism is NOT mandated by this interface standard.&lt;&#x2F;p&gt;
&lt;p&gt;Implementations MUST ensure their transfer methods exhibit the following behavior:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Public transfers&lt;&#x2F;strong&gt; (&lt;code&gt;transfer&lt;&#x2F;code&gt;, &lt;code&gt;transferFrom&lt;&#x2F;code&gt;, &lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt;, etc.) MUST NOT succeed in cases in which &lt;code&gt;canTransfer&lt;&#x2F;code&gt; or  &lt;code&gt;canTransact&lt;&#x2F;code&gt; would return &lt;code&gt;false&lt;&#x2F;code&gt; for either one or both &lt;code&gt;from&lt;&#x2F;code&gt; and &lt;code&gt;to&lt;&#x2F;code&gt; addresses.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Minting&lt;&#x2F;strong&gt; in permissionless contexts (e.g., public &lt;code&gt;mint&lt;&#x2F;code&gt; functions) MUST NOT succeed for accounts where &lt;code&gt;canTransact&lt;&#x2F;code&gt; on the recipient would return &lt;code&gt;false&lt;&#x2F;code&gt;. In permissioned contexts (e.g., authorized minting by privileged roles), minting SHOULD respect &lt;code&gt;canTransact&lt;&#x2F;code&gt; checks on the recipient, though implementations MAY bypass these checks when necessary for operational or compliance reasons.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Burning&lt;&#x2F;strong&gt; in permissionless contexts (e.g., public &lt;code&gt;burn&lt;&#x2F;code&gt; functions) MUST respect &lt;code&gt;canTransfer&lt;&#x2F;code&gt; check, MUST respect the &lt;code&gt;canTransact&lt;&#x2F;code&gt; check on the token holder and MUST NOT allow burning more assets than the unfrozen amount. In permissioned contexts (e.g., authorized burning by privileged roles), burning MAY succeed for accounts where &lt;code&gt;canTransact&lt;&#x2F;code&gt; on the token holder would return &lt;code&gt;false&lt;&#x2F;code&gt;, and MAY burn more assets than the unfrozen amount, in which case the contract MUST update the frozen status accordingly and emit a &lt;code&gt;Frozen&lt;&#x2F;code&gt; event before the underlying base token transfer event.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;code&gt;ERC7943CannotTransact&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;ERC7943CannotTransfer&lt;&#x2F;code&gt; errors MAY be used as a general revert mechanism whenever internal calls to &lt;code&gt;canTransact&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;canTransfer&lt;&#x2F;code&gt; return false. They MAY be replaced by more specific errors depending on the custom checks performed inside those calls, or simply not used.&lt;&#x2F;p&gt;
&lt;p&gt;In general, the standard prioritizes error specificity, meaning that specific errors such as &lt;code&gt;ERC7943InsufficientUnfrozenBalance&lt;&#x2F;code&gt; SHOULD be thrown when applicable. The &lt;code&gt;ERC7943InsufficientUnfrozenBalance&lt;&#x2F;code&gt; error SHOULD be triggered when a transfer is attempted from &lt;code&gt;account&lt;&#x2F;code&gt; with an &lt;code&gt;amount&lt;&#x2F;code&gt; less than or equal to its balance, but greater than its unfrozen balance or with a &lt;code&gt;tokenId&lt;&#x2F;code&gt; which is currently frozen. If the &lt;code&gt;amount&lt;&#x2F;code&gt; is greater than the whole balance or the &lt;code&gt;tokenId&lt;&#x2F;code&gt; is not owned by the &lt;code&gt;account&lt;&#x2F;code&gt;, unrelated from the frozen amount, more specific errors from the base standard SHOULD be used instead.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Minimalism:&lt;&#x2F;strong&gt; Defines only the essential functions (&lt;code&gt;forcedTransfer&lt;&#x2F;code&gt;, &lt;code&gt;setFrozenTokens&lt;&#x2F;code&gt;, &lt;code&gt;canTransact&lt;&#x2F;code&gt;, &lt;code&gt;canTransfer&lt;&#x2F;code&gt;, &lt;code&gt;getFrozenTokens&lt;&#x2F;code&gt;) and associated events&#x2F;errors needed for common RWA compliance and control patterns, avoiding mandated complexity or opinionated features. The reason to introduce specific errors (&lt;code&gt;ERC7943CannotTransact&lt;&#x2F;code&gt;, &lt;code&gt;ERC7943CannotTransfer&lt;&#x2F;code&gt; and &lt;code&gt;ERC7943InsufficientUnfrozenBalance&lt;&#x2F;code&gt;) is to provide completeness with the introduced functionalities (&lt;code&gt;canTransact&lt;&#x2F;code&gt;, &lt;code&gt;canTransfer&lt;&#x2F;code&gt; and &lt;code&gt;getFrozenTokens&lt;&#x2F;code&gt;). As dictated in the specifications, error specificity is prioritized, leaving space for implementations to accommodate more explicit errors. Regarding the events &lt;code&gt;Frozen&lt;&#x2F;code&gt; and &lt;code&gt;ForcedTransfer&lt;&#x2F;code&gt;, the reason for their existence is to signal &lt;em&gt;uncommon&lt;&#x2F;em&gt; transfers (like in &lt;code&gt;forcedTransfer&lt;&#x2F;code&gt;) but also to help off-chain indexers to correctly keep track and account for asset seizures and freezing. As mentioned in the specifications, the order in which these events are emitted in relation to the base token contract events is important in practice and merits special attention.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Flexible compliance:&lt;&#x2F;strong&gt; Provides standard view functions (&lt;code&gt;canTransact&lt;&#x2F;code&gt;, &lt;code&gt;canTransfer&lt;&#x2F;code&gt;, &lt;code&gt;getFrozenTokens&lt;&#x2F;code&gt;) for compliance checks without dictating &lt;em&gt;how&lt;&#x2F;em&gt; those checks are implemented internally by the token contract. This allows diverse compliance strategies.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Compatibility:&lt;&#x2F;strong&gt; Designed as an interface layer compatible with existing base standards like &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt;. Implementations extend from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7943&#x2F;&quot;&gt;ERC-7943&lt;&#x2F;a&gt; alongside their base standard interface. Additionally, with the adopted naming conventions, automatic backward compatibility is achieved with already existing standards like &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3643&#x2F;&quot;&gt;ERC-3643&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7518&#x2F;&quot;&gt;ERC-7518&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Essential enforcement rules:&lt;&#x2F;strong&gt; Includes &lt;code&gt;forcedTransfer&lt;&#x2F;code&gt; and &lt;code&gt;setFrozenTokens&lt;&#x2F;code&gt; as standard functions, acknowledging their importance for regulatory enforcement in the RWA space, distinct from standard transfers. Mandates access control for this sensitive function. To maintain a lean EIP, a single &lt;code&gt;setFrozenTokens&lt;&#x2F;code&gt; function (which overwrites the frozen asset quantity) and one &lt;code&gt;Frozen&lt;&#x2F;code&gt; event were favored over distinct &lt;code&gt;freeze&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;unfreeze&lt;&#x2F;code&gt; functions and events.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt;:&lt;&#x2F;strong&gt; Ensures implementing contracts can signal support for this interface.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;As an example, an AMM pool or a lending protocol can integrate with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7943&#x2F;&quot;&gt;ERC-7943&lt;&#x2F;a&gt; based &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens by calling &lt;code&gt;canTransact&lt;&#x2F;code&gt; or &lt;code&gt;canTransfer&lt;&#x2F;code&gt; to handle these assets in a compliant manner. Enforcement actions like &lt;code&gt;forcedTransfer&lt;&#x2F;code&gt; and &lt;code&gt;setFrozenTokens&lt;&#x2F;code&gt; can either be called by third party entities or be integrated by external protocols to allow for automated and programmable compliance. Users can then expand these tokens with additional features to fit the specific needs of individual asset types, either with on-chain identity systems, historical balances tracking for dividend distributions, semi-fungibility with token metadata, and other custom functionalities.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;extensibility&quot;&gt;Extensibility&lt;&#x2F;h3&gt;
&lt;p&gt;While this ERC provides the necessary primitives for regulated assets, any additional feature can be added through extensions. Few examples:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;If for any administrative function like &lt;code&gt;setFrozenTokens&lt;&#x2F;code&gt; it is necessary to attach a proof to the call, the contract can have a function that batches operations like:&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TokenWithLegalProofs&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7943MultiToken&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    .&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setFrozenTokensWithProof&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; legalProof&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; do anything with `legalProof`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setFrozenTokens&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ol start=&quot;2&quot;&gt;
&lt;li&gt;Since the &lt;code&gt;setFrozenTokens&lt;&#x2F;code&gt; function overwrites the absolute frozen amount and given the fact that the standard allows for multiple privileged accounts, some race-conditions might happen. If that&#x27;s the case, one can build an extension function that works with expected values of amounts frozen, like:&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setFrozenTokensIf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expectedPrev&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newAmount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;     require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;frozenTokens&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; expectedPrev&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC7943ExpectedValueMismatch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;expectedPrev&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; frozenTokens&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;     return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setFrozenTokens&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;newAmount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Alternatively, another solution can be using delta amounts:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setFrozenTokensDelta&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; deltaAmount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;     uint256&lt;&#x2F;span&gt;&lt;span&gt; actualValue &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; frozenTokens&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;     if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;deltaAmount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; actualValue &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;deltaAmount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;     else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; sub &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt;deltaAmount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sub &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; actualValue&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC7943ExpectedValueMismatch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sub&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; actualValue&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        actualValue &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; sub&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;     return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setFrozenTokens&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; actualValue&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;em&gt;Note&lt;&#x2F;em&gt; These helpers reduce accidental overwrites and expand in functionalities but do not prevent same-block conflicting updates or mempool ordering races by different privileged actors.&lt;&#x2F;p&gt;
&lt;ol start=&quot;3&quot;&gt;
&lt;li&gt;Developers can also perform several operations through the use of &lt;code&gt;multicall&lt;&#x2F;code&gt; patterns similar to the one defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6357&#x2F;&quot;&gt;ERC-6357&lt;&#x2F;a&gt; so that a mix of the given primitives with additional features can be batched in one transaction:&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC7943Fungible&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7943Fungible&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Multicall&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Now any combination of `setFrozenTokens`&#x2F;`forcedTransfer` &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; coupled with other functionalities like the ones to blacklist&#x2F;whitelist users&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; can be submitted in one transaction through the use of `multicall` function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ol start=&quot;4&quot;&gt;
&lt;li&gt;Functionalities like pausability can be added on top, either through the use of modifiers or directly within functions implementations:&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; canTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; allowed&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;paused&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span&gt; allowed&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ... other checks&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;notes-on-naming&quot;&gt;Notes on naming&lt;&#x2F;h3&gt;
&lt;p&gt;The naming conventions in this ERC were carefully chosen to establish clarity and semantic consistency within the broader RWA ecosystem while maintaining neutrality and broad applicability.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;forcedTransfer&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: This term was selected for its neutrality. While names like &lt;em&gt;confiscation&lt;&#x2F;em&gt;, &lt;em&gt;revocation&lt;&#x2F;em&gt;, or &lt;em&gt;recovery&lt;&#x2F;em&gt; describe specific motivations, &lt;code&gt;forcedTransfer&lt;&#x2F;code&gt; purely denotes the direct action of transferring assets, irrespective of the underlying reason. &lt;code&gt;forcedTransfer&lt;&#x2F;code&gt; was preferred over &lt;code&gt;forceTransfer&lt;&#x2F;code&gt; to maintain backward compatibility with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3643&#x2F;&quot;&gt;ERC-3643&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;canTransfer&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: This name was preferred over &lt;code&gt;isTransferAllowed&lt;&#x2F;code&gt; for consistency with established RWA standards including &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3643&#x2F;&quot;&gt;ERC-3643&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7518&#x2F;&quot;&gt;ERC-7518&lt;&#x2F;a&gt;. This alignment promotes interoperability and reduces cognitive overhead when working across different RWA tokens.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;setFrozenTokens&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;getFrozenTokens&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: These names were chosen for managing transfer restrictions and align with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3643&#x2F;&quot;&gt;ERC-3643&lt;&#x2F;a&gt; naming patterns. &lt;em&gt;Frozen&lt;&#x2F;em&gt; was also selected for its general applicability to both fungible (amount-based) and non-fungible (status-based) assets, as terms like &lt;em&gt;amount&lt;&#x2F;em&gt; or &lt;em&gt;asset(s)&lt;&#x2F;em&gt; might not be universally fitting.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;ERC7943InsufficientUnfrozenBalance&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: Discussions around &lt;em&gt;insufficient&lt;&#x2F;em&gt; being similar to &lt;em&gt;unavailable&lt;&#x2F;em&gt; arose, where &lt;em&gt;unavailable&lt;&#x2F;em&gt; might have better suggested a temporal condition like a freezing status. However, the term &lt;em&gt;available&lt;&#x2F;em&gt;&#x2F;&lt;em&gt;unavailable&lt;&#x2F;em&gt; was also overlapping with &lt;em&gt;frozen&lt;&#x2F;em&gt;&#x2F;&lt;em&gt;unfrozen&lt;&#x2F;em&gt; creating more confusion and duality. Finally, coupling &lt;em&gt;insufficient&lt;&#x2F;em&gt; with the specified &lt;em&gt;unfrozen balance&lt;&#x2F;em&gt; better represents the domain, prefix and subject of the error, according to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6093&#x2F;&quot;&gt;ERC-6093&lt;&#x2F;a&gt; guidelines.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP defines a new interface standard and does not alter existing ones like &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt;. Standard wallets and explorers can interact with the base token functionality of implementing contracts, subject to the rules enforced by that contract&#x27;s implementation of &lt;code&gt;canTransact&lt;&#x2F;code&gt;, &lt;code&gt;canTransfer&lt;&#x2F;code&gt; and &lt;code&gt;getFrozenTokens&lt;&#x2F;code&gt; functions. Full support for the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7943&#x2F;&quot;&gt;ERC-7943&lt;&#x2F;a&gt; functions requires explicit integration.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Reference implementations of uRWA for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7943&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;uRWA20.sol&quot;&gt;ERC-20&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7943&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;uRWA721.sol&quot;&gt;ERC-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7943&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;uRWA1155.sol&quot;&gt;ERC-1155&lt;&#x2F;a&gt; token implementations is provided in assets folder. They use the OpenZeppelin library and include an account whitelist and enumerable role-based access control. These examples are provided for educational purposes only and are not audited.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Access Control for &lt;code&gt;forcedTransfer&lt;&#x2F;code&gt; and &lt;code&gt;setFrozenTokens&lt;&#x2F;code&gt;:&lt;&#x2F;strong&gt; The security of the mechanism chosen by the implementer to restrict access to these functions is paramount. Unauthorized access could lead to asset theft. Secure patterns (multisig, timelocks) are highly recommended.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Front-run of the &lt;code&gt;setFrozenTokens&lt;&#x2F;code&gt; function:&lt;&#x2F;strong&gt; The &lt;code&gt;setFrozenTokens&lt;&#x2F;code&gt; function might be susceptible to front-running, similar to the &lt;code&gt;approve&lt;&#x2F;code&gt; function of the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;. If the suggestion of allowing freezing more than what an account owns is not followed, a front-run might be an incentive to an account to avoid any attempt of freezing its balance. Additional features to gradually increment or decrement the frozen status MAY be considered for implementation.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Implementation Logic:&lt;&#x2F;strong&gt; The correctness of the &lt;em&gt;implementation&lt;&#x2F;em&gt; behind all interface functions is critical. Flaws in this logic could bypass intended transfer restrictions or incorrectly block valid transfers.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Standard Contract Security:&lt;&#x2F;strong&gt; Implementations MUST adhere to general smart contract security best practices (reentrancy guards where applicable, checks-effects-interactions, etc.). Specifically in the checks-effects-interactions consideration, implementations need to be aware of tokens having hooks, especially on recipients like in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt;. In such circumstances it might be convenient to adopt reentrancy guards to prevent unwanted executions.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Increase Maximum Contract Size</title>
        <published>2025-06-09T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Giulio Rebuffo</name><uri>https://github.com/Giulio2002</uri>
	</author>
	
	<author>
		<name>Ben Adams</name><uri>https://github.com/benaadams</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7954/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/increase-maximum-contract-size-to-48kb/24509" />
        

        <id>https://wg-eips.ritovision.com/7954/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7954"
            label="EIP-7954" />
        

        
        

        
        <summary type="html">Raise the maximum contract code size from 24KiB to 32KiB and initcode size from 48KiB to 64KiB.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7954/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes to raise the maximum allowed size for contract code deployed on Ethereum from 24,576 bytes to 32,768 bytes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The current 24KiB contract size limit can be restrictive for complex contracts and applications. Increasing the limit to 32KiB allows for more feature-rich contracts while maintaining reasonable constraints on block and state growth.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;Update the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;170&#x2F;&quot;&gt;EIP-170&lt;&#x2F;a&gt; contract code size limit of 24KiB (&lt;code&gt;0x6000&lt;&#x2F;code&gt; bytes) to 32KiB (&lt;code&gt;0x8000&lt;&#x2F;code&gt; bytes).&lt;&#x2F;li&gt;
&lt;li&gt;Update the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3860&#x2F;&quot;&gt;EIP-3860&lt;&#x2F;a&gt; initcode size limit of 48KiB (&lt;code&gt;0xC000&lt;&#x2F;code&gt; bytes) to 64KiB (&lt;code&gt;0x10000&lt;&#x2F;code&gt; bytes).&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Developer Flexibility:&lt;&#x2F;strong&gt; Enables more complex contracts and features.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Backward Compatibility:&lt;&#x2F;strong&gt; Existing contracts are unaffected.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Simplicity:&lt;&#x2F;strong&gt; Only the size limit is changed, with no other protocol modifications.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change is not backwards compatible and must be activated via a network upgrade (hard fork). Contracts larger than 24KiB, up to 32KiB, will be deployable after activation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;A higher contract size limit may marginally increase the risk of denial-of-service attacks via large contracts, but the new limit remains conservative.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Proof-based Broadcast in ERC-7786 Gateways</title>
        <published>2025-06-06T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Ernesto García</name><uri>https://github.com/ernestognw</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7965/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7965-storage-proof-broadcasting-for-cross-chain-messaging-gateways/24477" />
        

        <id>https://wg-eips.ritovision.com/7965/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7965"
            label="ERC-7965" />
        

        
        

        
        <summary type="html">Cross-chain messaging using cryptographic proofs to verify messages between blockchains.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7965/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This document defines standardized broadcasting semantics and attributes for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7786&#x2F;&quot;&gt;ERC-7786&lt;&#x2F;a&gt; cross-chain messaging that enable trustless message verification through cryptographic proofs. Messages are committed on source chains in verifiable ways, then verified on destination chains using cryptographic proofs of the source chain&#x27;s state or transaction history. This approach provides cross-chain communication without relying on external validators or bridge operators.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Cross-chain messaging protocols typically rely on external validators, multisigs, or optimistic mechanisms that introduce trust assumptions and potential points of failure. Cryptographic proofs offer an alternative approach where messages can be verified using the consensus mechanisms and cryptographic commitments of the chains themselves (e.g. storage proofs for EVM chains).&lt;&#x2F;p&gt;
&lt;p&gt;However, cryptographic proof verification requires chain-specific routing information, proof data, and verification parameters that are not addressed by the base &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7786&#x2F;&quot;&gt;ERC-7786&lt;&#x2F;a&gt; interface. Additionally, while &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7786&#x2F;&quot;&gt;ERC-7786&lt;&#x2F;a&gt; defines basic broadcasting through &quot;omitted or zeroed&quot; recipient addresses, it does not specify granular broadcasting patterns that enable targeting specific chains or chain types. Enhanced broadcasting semantics enable messages to be sent with varying levels of specificity, from all addresses on a specific chain to all supported infrastructure.&lt;&#x2F;p&gt;
&lt;p&gt;This document standardizes these requirements as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7786&#x2F;&quot;&gt;ERC-7786&lt;&#x2F;a&gt; attributes, enabling cryptographic proof-based messaging within the established cross-chain messaging framework. The specification supports multi-hop verification paths, allowing messages to traverse through multiple intermediary chains when direct verification is not possible.&lt;&#x2F;p&gt;
&lt;p&gt;The key benefits of this approach include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Trustless verification&lt;&#x2F;strong&gt;: No external validators or multisigs required. Chains trust their own consensus mechanisms.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Universal compatibility&lt;&#x2F;strong&gt;: Works between chains with verifiable state relationships through shared settlement infrastructure or compatible proof systems.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Flexible messaging patterns&lt;&#x2F;strong&gt;: Supports both targeted and granular broadcast messaging through standardized semantics, enabling new classes of applications like oracles and intent settlement systems.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Composability&lt;&#x2F;strong&gt;: Full integration with existing &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7786&#x2F;&quot;&gt;ERC-7786&lt;&#x2F;a&gt; infrastructure and tooling&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;broadcasting-semantics&quot;&gt;Broadcasting Semantics&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7786&#x2F;&quot;&gt;ERC-7786&lt;&#x2F;a&gt; defines broadcasting as using &quot;omitted or zeroed&quot; recipient addresses (containing an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7930&#x2F;&quot;&gt;ERC-7930&lt;&#x2F;a&gt; interoperable address with all fields set to zero). This specification extends that concept to enable granular broadcasting patterns through &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7930&#x2F;&quot;&gt;ERC-7930&lt;&#x2F;a&gt;&#x27;s flexible address structure:&lt;&#x2F;p&gt;
&lt;p&gt;Broadcasting semantics in this specification extend &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7786&#x2F;&quot;&gt;ERC-7786&lt;&#x2F;a&gt; by allowing:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Interoperable addresses with &lt;code&gt;AddressLength&lt;&#x2F;code&gt; set to 0 and specified &lt;code&gt;ChainType&lt;&#x2F;code&gt; and&#x2F;or &lt;code&gt;ChainReference&lt;&#x2F;code&gt; to broadcast messages to all addresses on a given chain&lt;&#x2F;li&gt;
&lt;li&gt;Interoperable addresses with &lt;code&gt;ChainReferenceLength&lt;&#x2F;code&gt; set to 0 and a specified &lt;code&gt;ChainType&lt;&#x2F;code&gt; to broadcast to all chains of a given type&lt;&#x2F;li&gt;
&lt;li&gt;Interoperable addresses with all fields set to zero to indicate universal broadcasting to all supported chains and addresses&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Receivers of broadcast messages SHOULD validate the source and authenticity of messages according to their own security requirements.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;cryptographic-proof-attributes&quot;&gt;Cryptographic Proof Attributes&lt;&#x2F;h3&gt;
&lt;p&gt;This specification defines the following &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7786&#x2F;&quot;&gt;ERC-7786&lt;&#x2F;a&gt; attributes for cryptographic proof messaging. Gateways MUST return true if &lt;code&gt;supportsAttribute&lt;&#x2F;code&gt; is called with the selector for supported attributes.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;route-bytes-bytes-uint256&quot;&gt;&lt;code&gt;route((bytes,bytes,uint256)[])&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Specifies the verification path from destination to source chain with corresponding proofs and version requirements. Each tuple contains a bytes-encoded address that SHOULD be called for verification of the next chain&#x27;s state or transaction history, the cryptographic proof required for that verification step, and the expected version of the verification logic (0 means any version is acceptable). The route address MAY invoke other gateways to resend the message to the next hop.&lt;&#x2F;p&gt;
&lt;p&gt;When a non-zero version is specified, gateways MUST reject messages if the route address does not support the exact required version (unless &lt;code&gt;0&lt;&#x2F;code&gt;). Route addresses SHOULD implement version querying mechanisms to enable compatibility checking.&lt;&#x2F;p&gt;
&lt;p&gt;The route MUST form a valid path where each step represents a direct relationship between chains that enables state or transaction verification. For multi-hop scenarios, the route creates a chain of trust where each step verifies the next, ultimately establishing the authenticity of the source chain&#x27;s state. Gateways MUST reject messages with invalid or incomplete proof data.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodeWithSignature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;route((bytes,bytes,uint256)[])&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; hops&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;inclusionproof-bytes&quot;&gt;&lt;code&gt;inclusionProof(bytes)&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The cryptographic proof demonstrating that a specific message exists in the source chain&#x27;s committed state at a finalized block or transaction. For EVM chains, this would typically be an event inclusion proof or storage proof.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7786&#x2F;&quot;&gt;ERC-7786&lt;&#x2F;a&gt; receivers MUST validate the cryptographic proof according to the source chain&#x27;s proof system.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodeWithSignature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;inclusionProof(bytes)&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; proofData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;targetblock-uint256&quot;&gt;&lt;code&gt;targetBlock(uint256)&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Specifies the block number or height on the source chain where the message was committed. For chains that don&#x27;t use sequential block numbers, this represents the equivalent commitment identifier.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7786&#x2F;&quot;&gt;ERC-7786&lt;&#x2F;a&gt; receivers MAY validate the target block for freshness or finality requirements according to their security policies. Receivers MAY ignore this attribute if not needed for their use case.&lt;&#x2F;p&gt;
&lt;p&gt;When provided, this attribute SHOULD correspond to the block or commitment whose state is proven by the cryptographic proof.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodeWithSignature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;targetBlock(uint256)&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; blockNumber&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;relationship-to-existing-proof-protocols&quot;&gt;Relationship to Existing Proof Protocols&lt;&#x2F;h3&gt;
&lt;p&gt;This ERC provides standard attributes that enable protocols like &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7888&#x2F;&quot;&gt;ERC-7888&lt;&#x2F;a&gt; (for EVM storage proofs) and other proof systems to implement &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7786&#x2F;&quot;&gt;ERC-7786&lt;&#x2F;a&gt; gateways without rebuilding their core verification logic. For example, an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7888&#x2F;&quot;&gt;ERC-7888&lt;&#x2F;a&gt; Broadcaster MAY expose an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7786&#x2F;&quot;&gt;ERC-7786&lt;&#x2F;a&gt; interface using these attributes while maintaining its existing storage proof architecture. Similarly, other proof systems can implement these same attributes using their native proof mechanisms.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;caching&quot;&gt;Caching&lt;&#x2F;h3&gt;
&lt;p&gt;Gateways implementing this specification MAY implement caching mechanisms to optimize repeated proof verifications.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;mutability-of-message-commitments&quot;&gt;Mutability of Message Commitments&lt;&#x2F;h3&gt;
&lt;p&gt;Gateways MAY choose to commit messages in ways that cannot be deleted or modified after being set, providing immutability guarantees. While not required by this standard, implementers can use &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7201&#x2F;&quot;&gt;ERC-7201&lt;&#x2F;a&gt; to calculate namespaces for immutable storage locations on EVM chains, or equivalent immutability mechanisms on other chain architectures.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;verification-process&quot;&gt;Verification Process&lt;&#x2F;h3&gt;
&lt;p&gt;In &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7786&#x2F;&quot;&gt;ERC-7786&lt;&#x2F;a&gt;, the &lt;code&gt;payload&lt;&#x2F;code&gt; contains the actual message data to be delivered, while the &lt;code&gt;attributes&lt;&#x2F;code&gt; contain proof metadata that establishes the payload&#x27;s authenticity. The destination gateway validates the attributes through cryptographic verification, and it MAY cache results for future use.&lt;&#x2F;p&gt;
&lt;p&gt;For multihop scenarios, each route step verifies the next chain&#x27;s state commitment, creating a chain of trust from destination to source. This enables message verification across multiple intermediate chains, similar to systems like &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7888&#x2F;&quot;&gt;ERC-7888&lt;&#x2F;a&gt;&#x27;s BlockHashProver chains.&lt;&#x2F;p&gt;
&lt;p&gt;Message verification follows these steps:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Parse the &lt;code&gt;route&lt;&#x2F;code&gt; and &lt;code&gt;inclusionProof&lt;&#x2F;code&gt; attributes from the message, and optionally &lt;code&gt;targetBlock&lt;&#x2F;code&gt; if provided&lt;&#x2F;li&gt;
&lt;li&gt;Validate all required attributes are present and well-formed&lt;&#x2F;li&gt;
&lt;li&gt;For each route step, verify block hash transition or equivalent state commitment using the paired proof and validate version requirements if specified (non-zero)&lt;&#x2F;li&gt;
&lt;li&gt;Use the &lt;code&gt;inclusionProof&lt;&#x2F;code&gt; to verify that message data exists in the source chain&#x27;s committed state at the target block obtained from the route verification. The source chain SHOULD correspond to the final validated step in the route verification process&lt;&#x2F;li&gt;
&lt;li&gt;Optionally validate the &lt;code&gt;targetBlock&lt;&#x2F;code&gt; for freshness or finality requirements if the attribute is provided and the receiver chooses to validate it&lt;&#x2F;li&gt;
&lt;li&gt;Execute the message if all verifications pass&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This standard extends &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7786&#x2F;&quot;&gt;ERC-7786&lt;&#x2F;a&gt;&#x27;s attribute system to add cryptographic proof capabilities without creating new interfaces. This approach maintains compatibility with existing infrastructure while enabling trustless cross-chain verification, allowing implementations to focus on proof verification logic rather than rebuilding messaging infrastructure.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;broadcasting-and-cryptographic-proofs&quot;&gt;Broadcasting and Cryptographic Proofs&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7786&#x2F;&quot;&gt;ERC-7786&lt;&#x2F;a&gt; natively supports broadcasting through &quot;omitted or zeroed&quot; &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7930&#x2F;&quot;&gt;ERC-7930&lt;&#x2F;a&gt; interoperable addresses. This specification extends that foundation to enable granular broadcasting patterns through &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7930&#x2F;&quot;&gt;ERC-7930&lt;&#x2F;a&gt;&#x27;s flexible address structure. Empty address components (&lt;code&gt;AddressLength&lt;&#x2F;code&gt; = 0) allow broadcasting to all addresses on a specific chain, while empty chain references (&lt;code&gt;ChainReferenceLength&lt;&#x2F;code&gt; = 0) enable broadcasting to all chains of a specific type (e.g., all EVM chains via &lt;code&gt;eip155&lt;&#x2F;code&gt; namespace). Universal broadcasting uses fully zeroed addresses as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7786&#x2F;&quot;&gt;ERC-7786&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This multi-level broadcasting approach leverages &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7930&#x2F;&quot;&gt;ERC-7930&lt;&#x2F;a&gt;&#x27;s inherent address structure and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7786&#x2F;&quot;&gt;ERC-7786&lt;&#x2F;a&gt;&#x27;s existing broadcast semantics rather than introducing new patterns, ensuring consistency with the cross-chain messaging ecosystem. The granularity enables efficient message distribution patterns: oracle feeds can target specific chains, governance messages can address entire chain families, and emergency notifications can reach all supported infrastructure.&lt;&#x2F;p&gt;
&lt;p&gt;Cryptographic proofs provide trustless verification relying only on chain consensus mechanisms. This approach offers universal accessibility, cryptographic guarantees, cost efficiency (gas only on source&#x2F;destination chains), and enables implicit batching through shared state commitments. Multi-hop routing extends this capability to chains without direct verification relationships.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;attribute-design&quot;&gt;Attribute Design&lt;&#x2F;h3&gt;
&lt;p&gt;The two required attributes provide the essential functionality for cryptographic proof verification, while the optional &lt;code&gt;targetBlock&lt;&#x2F;code&gt; attribute enables additional freshness and finality validation when needed. Combining route information into a single tuple maintains type safety while separating proof verification from chain state transitions allows independent optimization. The optional nature of &lt;code&gt;targetBlock&lt;&#x2F;code&gt; provides implementation flexibility without adding unnecessary complexity to basic use cases.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;caching-1&quot;&gt;Caching&lt;&#x2F;h3&gt;
&lt;p&gt;Caching can improve performance by storing verification results for reuse. Since proofs are deterministic, they can be safely cached. This is especially useful for broadcast messages that need multiple verifications. Implementations should cache both block hash transitions and proof verification results, while invalidating the cache when proof infrastructure changes.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;mutability-of-message-commitments-1&quot;&gt;Mutability of Message Commitments&lt;&#x2F;h3&gt;
&lt;p&gt;Proving a commitment that could be deleted or modified may introduce additional security risks. For example, if a message is committed in a way that allows deletion after the message is sent, the proof will still be valid. This is why the specification does not require immutability, but allows gateways to choose to commit messages in immutable ways if they so desire.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC extends &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7786&#x2F;&quot;&gt;ERC-7786&lt;&#x2F;a&gt; through its attribute system and introduces no breaking changes to existing implementations. Gateways that do not support cryptographic proof attributes will simply reject messages containing them, which is the expected behavior for unsupported features.&lt;&#x2F;p&gt;
&lt;p&gt;Existing &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7786&#x2F;&quot;&gt;ERC-7786&lt;&#x2F;a&gt; tooling and infrastructure can immediately leverage cryptographic proof messaging without modification, as the base interface remains unchanged.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;basic-gateway-usage&quot;&gt;Basic Gateway Usage&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Hop&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span&gt; gateway&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; bytes-encoded address of the gateway&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span&gt; proof&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; version&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0 = any version&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Prepare route with proofs and version requirements&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Hop&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; hops &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span&gt; Hop&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;hops&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Hop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;gateway1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; proof1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Require version 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;hops&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Hop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;gateway2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; proof2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Any version acceptable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Example 1: Address Broadcasting - broadcast to all addresses on Arbitrum One (42161)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; addressBroadcast &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint16&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Version&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint16&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x0000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ChainType: eip155&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint8&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ChainReferenceLength: 2 bytes for chain ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint16&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;42161&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ChainReference: Arbitrum One (42161)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint8&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;          &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; AddressLength: 0 (empty address = broadcast to all addresses)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Example 2: Chain Type Broadcasting - broadcast to all EIP-155 chains&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; chainTypeBroadcast &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint16&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Version&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint16&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x0000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ChainType: eip155&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint8&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ChainReferenceLength: 0 (broadcast to all chains of this type)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint8&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;          &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; AddressLength: 0 (empty address)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Example 3: Universal Broadcasting - broadcast to all supported chains and addresses&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; universalBroadcast &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint16&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Version&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint16&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x0000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ChainType: 0 (all chain types)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint8&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ChainReferenceLength: 0 (all chains)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint8&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;          &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; AddressLength: 0 (all addresses)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; attributes &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;[](&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;attributes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodeWithSignature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;route((bytes,bytes,uint256)[])&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; hops&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;attributes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodeWithSignature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;inclusionProof(bytes)&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; proofData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;attributes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodeWithSignature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;targetBlock(uint256)&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; blockNumber&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Optional&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Send message with address broadcasting&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gateway&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;sendMessage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    addressBroadcast&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; broadcast to all addresses on Arbitrum One&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;    abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;priceUpdate&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; asset&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; price&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    attributes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Send message with chain type broadcasting  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gateway&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;sendMessage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    chainTypeBroadcast&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; broadcast to all EIP-155 chains&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;    abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;governanceProposal&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; proposalId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; votingPeriod&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    attributes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Send message with universal broadcasting&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gateway&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;sendMessage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    universalBroadcast&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; broadcast to all supported chains and addresses&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;    abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;pause&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; reason&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    attributes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;validation-requirements&quot;&gt;Validation Requirements&lt;&#x2F;h3&gt;
&lt;p&gt;Gateways must rigorously validate all proof data to prevent message forgery, including proof format, completeness, and cryptographic validity. Route addresses must correspond to legitimate proof infrastructure forming a valid, connected path between chains. Only finalized blocks or equivalent commitment points should be used for proof generation to prevent reorganization attacks.&lt;&#x2F;p&gt;
&lt;p&gt;Consumers of cryptographic proof messages should implement appropriate freshness checks, as proofs can verify messages at any historical block or commitment, potentially including very old messages. This is not required for gateways offering immutable message commitments.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;route-security&quot;&gt;Route Security&lt;&#x2F;h3&gt;
&lt;p&gt;The security of a multi-hop route is only as strong as the weakest proof in the verification path. When multiple route steps are used, the overall security level is determined by the step with the lowest cryptographic guarantees or the least secure consensus mechanism. Implementers should carefully evaluate each hop in their routes and consider the cumulative security implications when designing cross-chain verification paths.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;broadcast-message-security&quot;&gt;Broadcast Message Security&lt;&#x2F;h3&gt;
&lt;p&gt;Since broadcast messages can be executed by any party, receivers should implement robust validation of message sources and contents. This includes verifying the sender&#x27;s authority and the message&#x27;s semantic validity.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Crosschain EIP-712 Signatures</title>
        <published>2025-06-05T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Ernesto García</name><uri>https://github.com/ernestognw</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7964/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/universal-cross-chain-signatures-for-account-abstraction/24452" />
        

        <id>https://wg-eips.ritovision.com/7964/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7964"
            label="ERC-7964" />
        

        
        

        
        <summary type="html">Support EIP-712 signatures for crosschain account operations.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7964/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC defines a standard approach for creating and verifying crosschain signatures using &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt;. By omitting the &lt;code&gt;chainId&lt;&#x2F;code&gt; field from the EIP-712 domain, a signature can be valid across multiple chains. Chain-specific operations are encoded as an array of structured messages, where each chain receives the array of message hashes and only the full message data relevant to that chain. This enables efficient crosschain signature validation using standard EIP-712 encoding without requiring special wallet support.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Current account abstraction solutions require separate signatures for each blockchain network. This creates poor user experience for crosschain operations such as:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Crosschain intents&lt;&#x2F;strong&gt;: Users wanting to trade assets across multiple chains atomically&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Multi-chain DAO governance&lt;&#x2F;strong&gt;: Voting on proposals that affect protocol instances across different networks&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Unified account management&lt;&#x2F;strong&gt;: Managing the same account deployed on multiple chains&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Crosschain social recovery&lt;&#x2F;strong&gt;: Recovery processes that span multiple networks&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Existing proposals either require complex Merkle tree constructions (which need wallet-specific UI to verify all leaves) or non-standard encoding schemes that lack wallet adoption. This ERC provides a simpler approach using only standard EIP-712 encoding with array types, enabling crosschain signatures with minimal on-chain overhead while maintaining full transparency in standard wallet signing interfaces.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;crosschain-domain-semantics&quot;&gt;Crosschain Domain Semantics&lt;&#x2F;h3&gt;
&lt;p&gt;A crosschain &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; signature MUST omit the &lt;code&gt;chainId&lt;&#x2F;code&gt; field from the &lt;code&gt;EIP712Domain&lt;&#x2F;code&gt; type and domain object. Since &lt;code&gt;chainId&lt;&#x2F;code&gt; is optional per &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt;, omitting it signals that the signature is intended for crosschain validity.&lt;&#x2F;p&gt;
&lt;p&gt;Contract addresses and chainIds MUST be validated per-chain, so typically, only &lt;code&gt;name&lt;&#x2F;code&gt; and &lt;code&gt;version&lt;&#x2F;code&gt; are included in the main domain. The &lt;code&gt;verifyingContract&lt;&#x2F;code&gt; field MAY be used to bind the signature to a specific application deployed deterministically on the same address across all chains the signature is intended to be valid on, allowing to omit the contract address from the chain-specific structs.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;message-array-encoding&quot;&gt;Message Array Encoding&lt;&#x2F;h3&gt;
&lt;p&gt;Crosschain operations MUST be encoded as an array of message structs with chain-specific fields. Each struct in the array SHOULD include the target &lt;code&gt;chainId&lt;&#x2F;code&gt; field. When contracts are deployed at different addresses across chains, the struct SHOULD also include the &lt;code&gt;verifyingContract&lt;&#x2F;code&gt; (or equivalent) field to bind each operation to its specific contract address unless the main domain includes the &lt;code&gt;verifyingContract&lt;&#x2F;code&gt; field.&lt;&#x2F;p&gt;
&lt;p&gt;Implementers MAY use the canonical &lt;code&gt;EIP712Domain&lt;&#x2F;code&gt; struct but named to avoid collisions with &lt;code&gt;EIP712Domain&lt;&#x2F;code&gt; (e.g., &lt;code&gt;EIP712ChainDomain&lt;&#x2F;code&gt;) so it can be nested inside the chain-specific structs, allowing to include the &lt;code&gt;chainId&lt;&#x2F;code&gt; and &lt;code&gt;verifyingContract&lt;&#x2F;code&gt; fields.&lt;&#x2F;p&gt;
&lt;p&gt;Per &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt;, arrays are encoded as &lt;code&gt;keccak256(encodeData(element[0]) ‖ encodeData(element[1]) ‖ ... ‖ encodeData(element[n]))&lt;&#x2F;code&gt;, where each element is a struct that is recursively encoded as &lt;code&gt;hashStruct(element[i])&lt;&#x2F;code&gt;, and nested structs are also recursively hashed.&lt;&#x2F;p&gt;
&lt;p&gt;In practice, this means the array of chain-specific operations is represented as an array of pre-computed &lt;code&gt;bytes32&lt;&#x2F;code&gt; struct hashes (one for each chain). The hash of this array is computed as &lt;code&gt;keccak256(abi.encodePacked(structsArray))&lt;&#x2F;code&gt;, which concatenates all 32-byte hashes and produces the array hash that matches the standard &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; array encoding for reference types.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;struct-hash&quot;&gt;Struct Hash&lt;&#x2F;h4&gt;
&lt;p&gt;Per &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt;, the signature is computed over a complete message struct (e.g., &lt;code&gt;CrossChainIntent&lt;&#x2F;code&gt;, &lt;code&gt;MultiChainVote&lt;&#x2F;code&gt;), not just the array of operations. Applications implementing verification MUST define a type hash for the complete message struct that includes the array of operations.&lt;&#x2F;p&gt;
&lt;p&gt;Wrapping the array of operations in a main struct also allows to include other message fields (e.g., &lt;code&gt;nonce&lt;&#x2F;code&gt;, &lt;code&gt;deadline&lt;&#x2F;code&gt;) in the struct hash. For example, for a &lt;code&gt;CrossChainIntent&lt;&#x2F;code&gt; struct would be encoded as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;   bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; CROSSCHAIN_INTENT_TYPEHASH &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;       &amp;quot;CrossChainIntent(ChainOperation[] operations,uint256 nonce,uint256 deadline)ChainOperation(EIP712ChainDomain domain,address target,uint256 value,bytes data)EIP712ChainDomain(uint256 chainId,address verifyingContract)&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   fullStructHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;       CROSSCHAIN_INTENT_TYPEHASH&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;       keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;chainOperationsArray&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;       nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;       deadline&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   )&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Applications implementing verification MUST use the same typehash across all chains where the application is deployed.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;on-chain-verification&quot;&gt;On-Chain Verification&lt;&#x2F;h3&gt;
&lt;p&gt;To enable applications to detect and verify crosschain signatures through standard ECDSA validation or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;ERC-1271&lt;&#x2F;a&gt; &lt;code&gt;isValidSignature&lt;&#x2F;code&gt; calls, crosschain signatures SHOULD be encoded with metadata in the signature parameter. The signature validation flow requires the contract application to detect the encoding of this ERC, parse the signature components, and then verify the signature agains the reconstructed crosschain message hash.&lt;&#x2F;p&gt;
&lt;p&gt;The signature encoding format uses ABI encoding for dynamic types (arrays and bytes) with the following structure:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[0x00:0x09] magic (9 bytes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[0x09:0x0a] fields (1 byte)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[0x0a:0x0c] structIndex (2 bytes, big-endian uint16)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[0x0c:0x20] application (20 bytes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[0x20:0x40] structsArrayOffset (32 bytes, big-endian uint256, offset to structsArray location)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[structsArrayOffset:structsArrayOffset + 32] structsArrayLength (32 bytes, big-endian uint256)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[structsArrayOffset + 32:structsArrayOffset + 32 + structsArrayLength * 32] structsArray (structsArrayLength * 32 bytes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[crossChainSignatureOffset:crossChainSignatureOffset + 32] crossChainSignatureLength (32 bytes, big-endian uint256)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[crossChainSignatureOffset + 32:crossChainSignatureOffset + 32 + crossChainSignatureLength] crossChainSignature (crossChainSignatureLength bytes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Equivalent to the following ABI encoding:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt; header &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;CrossChainSignatureChecker&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;ERC7964_MAGIC&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; fields&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; structIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;application&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; structsArray&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; crossChainSignature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; (bytes32, bytes, bytes32[])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;magic&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: A fixed 9-byte value &lt;code&gt;0x796479647964796479&lt;&#x2F;code&gt; used to detect encoded crosschain signatures&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;fields&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: A single byte encoding which &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; domain fields are present (per &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5267&#x2F;&quot;&gt;ERC-5267&lt;&#x2F;a&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;structIndex&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: The index in the &lt;code&gt;structsArray&lt;&#x2F;code&gt; corresponding to the current chain&#x27;s operation&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;application&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: The address of a contract implementing &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5267&#x2F;&quot;&gt;ERC-5267&lt;&#x2F;a&gt; that provides the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; domain information&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;structsArrayOffset&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: The offset (in bytes) from the start of the signature to where the &lt;code&gt;structsArray&lt;&#x2F;code&gt; begins.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;structsArrayLength&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: The number of elements in the structs array&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;structsArray&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: Array of &lt;code&gt;bytes32&lt;&#x2F;code&gt; hashes, one per chain operation&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;crossChainSignatureOffset&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: The offset (in bytes) from the start of the signature to where the &lt;code&gt;crossChainSignature&lt;&#x2F;code&gt; begins.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;crossChainSignatureLength&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: The length of the crosschain signature in bytes&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;crossChainSignature&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: The actual signature bytes that sign the crosschain message&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This encoding allows applications to identify when a signature is a crosschain signature, rebuild the EIP-712 domain information needed to reconstruct the expected typed hash, and verify the signature against the reconstructed crosschain message hash.&lt;&#x2F;p&gt;
&lt;p&gt;Applications can detect crosschain signatures by checking if the first 9 bytes of the signature equal the magic value &lt;code&gt;0x796479647964796479&lt;&#x2F;code&gt;. If detected, applications MUST:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Parse the encoded metadata from the signature&lt;&#x2F;li&gt;
&lt;li&gt;Verify that &lt;code&gt;structsArray[structIndex]&lt;&#x2F;code&gt; matches the struct hash of the current chain&#x27;s message&lt;&#x2F;li&gt;
&lt;li&gt;Query the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5267&#x2F;&quot;&gt;ERC-5267&lt;&#x2F;a&gt; contract at &lt;code&gt;application&lt;&#x2F;code&gt; to obtain the EIP-712 domain&lt;&#x2F;li&gt;
&lt;li&gt;Reconstruct the full &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; hash using the domain, the main struct hash and the array of chain-specific struct hashes&lt;&#x2F;li&gt;
&lt;li&gt;Verify the &lt;code&gt;crossChainSignature&lt;&#x2F;code&gt; against the reconstructed typed hash&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;wallet-display&quot;&gt;Wallet Display&lt;&#x2F;h3&gt;
&lt;p&gt;Standard &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; wallets will automatically display the array of chain-specific messages in a readable format. Wallets MAY enhance the display by grouping operations by chain and showing chain names instead of chain IDs for better user experience.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;standard-eip-712-compatibility&quot;&gt;Standard EIP-712 Compatibility&lt;&#x2F;h3&gt;
&lt;p&gt;This ERC uses only standard &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; encoding without any extensions or special constructs. All fields in the &lt;code&gt;EIP712Domain&lt;&#x2F;code&gt; are optional per the standard, so omitting &lt;code&gt;chainId&lt;&#x2F;code&gt; is perfectly valid. This means any wallet that supports EIP-712 can sign these messages and any application that supports EIP-712 can verify them.&lt;&#x2F;p&gt;
&lt;p&gt;The main benefit of this approach is that users can achieve a full transparent view of the crosschain message in any wallet provider that supports &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;main-struct-hash&quot;&gt;Main Struct Hash&lt;&#x2F;h3&gt;
&lt;p&gt;For wallet providers to show the crosschain message properly, they need a &lt;code&gt;primaryType&lt;&#x2F;code&gt; to display the message. This specification does not mandate a specific &lt;code&gt;primaryType&lt;&#x2F;code&gt; to allow for flexibility in the implementation, but defines the requirements for the array of operations and the main struct to ensure a secure EIP-712 message.&lt;&#x2F;p&gt;
&lt;p&gt;The specification requires that each of the operations include the &lt;code&gt;chainId&lt;&#x2F;code&gt; field to avoid replaying the same operation on other chains. The &lt;code&gt;verifyingContract&lt;&#x2F;code&gt; field (or equivalent) is used to bind the operation to its specific contract address and is optional if the main &lt;code&gt;EIP712Domain&lt;&#x2F;code&gt; includes the &lt;code&gt;verifyingContract&lt;&#x2F;code&gt; field since the domain hash would include the application&#x27;s address.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;array-encoding-vs-merkle-trees&quot;&gt;Array Encoding vs Merkle Trees&lt;&#x2F;h3&gt;
&lt;p&gt;Alternative approaches use Merkle trees to commit to crosschain operations. While Merkle trees can reduce on-chain overhead for many chains, they have a critical drawback:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Wallet Verification Complexity&lt;&#x2F;strong&gt;: Standard EIP-712 wallets cannot display Merkle tree leaves. Users signing a Merkle root have no way to verify all operations in their wallet UI. Wallets would need to implement custom logic to:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Request all leaves from the application&lt;&#x2F;li&gt;
&lt;li&gt;Verify the Merkle tree construction&lt;&#x2F;li&gt;
&lt;li&gt;Display all operations across all chains&lt;&#x2F;li&gt;
&lt;li&gt;Ensure no malicious operations are hidden&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;This breaks the principle of trustless signing, users must trust the application to correctly provide all leaves, and wallet developers must implement and maintain custom verification logic.&lt;&#x2F;p&gt;
&lt;p&gt;The array-based approach provides &lt;strong&gt;full transparency&lt;&#x2F;strong&gt; using standard EIP-712. Users see all chain-specific operations in any compliant wallet without custom support. No hidden operations are possible since all array elements are displayed as part of the standard EIP-712 message structure.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;On-chain overhead comparison&lt;&#x2F;strong&gt;: For reasonable crosschain operations, the overhead difference is minimal.&lt;&#x2F;p&gt;
&lt;p&gt;With the array approach, each chain receives all N operation hashes (&lt;code&gt;N × 32 bytes&lt;&#x2F;code&gt;). With Merkle trees (assuming a binary tree), each chain receives a Merkle proof of size &lt;code&gt;ceil(log₂(N)) × 32 bytes&lt;&#x2F;code&gt;. Both approaches reconstruct the root&#x2F;array hash on-chain from the provided data and verify it against the signature, no additional calldata for the root is needed. While Merkle proofs grow logarithmically vs. the array&#x27;s linear growth, the practical savings are small for reasonable use cases:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Chains&lt;&#x2F;th&gt;&lt;th&gt;Array (N × 32)&lt;&#x2F;th&gt;&lt;th&gt;Merkle (⌈log₂(N)⌉ × 32)&lt;&#x2F;th&gt;&lt;th&gt;Savings&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;64 bytes (2 × 32)&lt;&#x2F;td&gt;&lt;td&gt;32 bytes (1 × 32)&lt;&#x2F;td&gt;&lt;td&gt;32 bytes (1 hash)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;96 bytes (3 × 32)&lt;&#x2F;td&gt;&lt;td&gt;64 bytes (2 × 32)&lt;&#x2F;td&gt;&lt;td&gt;32 bytes (1 hash)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;4&lt;&#x2F;td&gt;&lt;td&gt;128 bytes (4 × 32)&lt;&#x2F;td&gt;&lt;td&gt;64 bytes (2 × 32)&lt;&#x2F;td&gt;&lt;td&gt;64 bytes (2 hashes)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;td&gt;160 bytes (5 × 32)&lt;&#x2F;td&gt;&lt;td&gt;96 bytes (3 × 32)&lt;&#x2F;td&gt;&lt;td&gt;64 bytes (2 hashes)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;8&lt;&#x2F;td&gt;&lt;td&gt;256 bytes (8 × 32)&lt;&#x2F;td&gt;&lt;td&gt;96 bytes (3 × 32)&lt;&#x2F;td&gt;&lt;td&gt;160 bytes (5 hashes)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;For 2-5 chains (the reasonable case for crosschain operations), Merkle trees save only 32-64 bytes (1-2 hashes) per transaction. This minimal savings doesn&#x27;t justify the complexity and loss of transparency. Merkle trees only become significantly more efficient at 8+ chains, which is an uncommon use case and may indicate the operation should be split into multiple signatures for better user comprehension and failure isolation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;omitting-chainid-vs-using-0&quot;&gt;Omitting chainId vs using &lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Omitting &lt;code&gt;chainId&lt;&#x2F;code&gt; entirely is cleaner than using a special value like &lt;code&gt;0&lt;&#x2F;code&gt; because it explicitly signals that the signature is intended for crosschain validity.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;signature-encoding-format&quot;&gt;Signature Encoding Format&lt;&#x2F;h3&gt;
&lt;p&gt;The custom binary encoding format for crosschain signatures was selected to minimize calldata and memory overhead. The format packs metadata values that can be read to the stack and uses ABI encoding for &lt;code&gt;structsArray&lt;&#x2F;code&gt; and &lt;code&gt;crossChainSignature&lt;&#x2F;code&gt; for easy calldata and memory casting.&lt;&#x2F;p&gt;
&lt;p&gt;The magic value is used to detect crosschain signatures and is designed to be easy to parse and verify. It&#x27;s a fixed 9-byte value that is easy to identify and verify. The length was selected to pack it along with &lt;code&gt;bytes1(fields)&lt;&#x2F;code&gt;, &lt;code&gt;uint16(structIndex)&lt;&#x2F;code&gt; and &lt;code&gt;address(application)&lt;&#x2F;code&gt; into a single 32-byte word. While 9 bytes is shorter than a full 32-byte hash, the collision probability remains negligible in practice—an attacker would need to produce a valid ECDSA or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;ERC-1271&lt;&#x2F;a&gt; signature that randomly begins with these exact 9 bytes, which has probability 2^-72 (approximately 1 in 4.7 × 10^21) assuming a uniform distribution.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;fields&lt;&#x2F;code&gt; byte encodes which EIP-712 domain fields are present in the main domain (per &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5267&#x2F;&quot;&gt;ERC-5267&lt;&#x2F;a&gt;), enabling dynamic field selection. Only &lt;code&gt;name&lt;&#x2F;code&gt; and &lt;code&gt;version&lt;&#x2F;code&gt; are normally set in the main domain, since &lt;code&gt;chainId&lt;&#x2F;code&gt; is omitted for crosschain validity since each chain-specific struct includes its own &lt;code&gt;chainId&lt;&#x2F;code&gt; and optionally &lt;code&gt;verifyingContract&lt;&#x2F;code&gt; (or equivalent), allowing each chain to validate its own contract address as part of the struct hash verification.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;application&lt;&#x2F;code&gt; address refers to any contract that implements &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5267&#x2F;&quot;&gt;ERC-5267&lt;&#x2F;a&gt;&#x27;s &lt;code&gt;eip712Domain()&lt;&#x2F;code&gt; function. This contract provides the domain separator information needed to reconstruct the crosschain message hash. The application contract does not need to be the contract that executes the operation: it serves solely as a source of EIP-712 domain metadata. Applications could either deploy dedicated immutable domain separator contracts to ensure consistent domain information across all chains, or use the executing contract itself if it implements &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5267&#x2F;&quot;&gt;ERC-5267&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC uses standard &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; without modifications. Existing wallets and applications that support EIP-712 can immediately work with crosschain signatures without any changes, though they may not recognize the crosschain semantics.&lt;&#x2F;p&gt;
&lt;p&gt;Applications that verify signatures with a domain that includes a specific &lt;code&gt;chainId&lt;&#x2F;code&gt; will reject crosschain signatures (where &lt;code&gt;chainId&lt;&#x2F;code&gt; is omitted), providing safe failure by default. Applications that wish to support crosschain signatures must explicitly implement the verification pattern described in this ERC.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;To validate a crosschain signature, the application can use the following library:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;SignatureChecker&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;utils&#x2F;cryptography&#x2F;SignatureChecker.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;MessageHashUtils&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;utils&#x2F;cryptography&#x2F;MessageHashUtils.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC5267&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;interfaces&#x2F;IERC5267.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Calldata&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;utils&#x2F;Calldata.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;library&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CrossChainSignatureChecker&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes9&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; ERC7964_MAGIC &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x796479647964796479&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isValidCrossChainSignatureNow&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; erc7964Signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; structHash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bool&lt;&#x2F;span&gt;&lt;span&gt; success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes1&lt;&#x2F;span&gt;&lt;span&gt; fields&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            uint16&lt;&#x2F;span&gt;&lt;span&gt; structIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            address&lt;&#x2F;span&gt;&lt;span&gt; application&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span&gt; structsArray&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span&gt; crossChainSignature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; parseCrossChainSignature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;erc7964Signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;success &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span&gt; structsArray&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;structIndex&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; hash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; version&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; chainId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; verifyingContract&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; domainSalt&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; version&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; chainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; verifyingContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; domainSalt&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; )&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5267&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;application&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;eip712Domain&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; typedHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; MessageHashUtils&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;toTypedDataHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            MessageHashUtils&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;toDomainSeparator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;fields&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; version&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; chainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; verifyingContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; domainSalt&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            structHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;structsArray&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; SignatureChecker&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isValidSignatureNowCalldata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; typedHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; crossChainSignature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; parseCrossChainSignature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; erc7964Signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        internal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        pure&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes1&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; fields&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            uint16&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; structIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; application&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; structsArray&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; crossChainSignature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; magic (9 bytes) + fields (1 byte) + structIndex (2 bytes) + application (20 bytes) + structsArrayOffset (32 bytes) +&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; structsArrayLength (32 bytes) + crossChainSignatureOffset (32 bytes) + crossChainSignatureLength (32 bytes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;erc7964Signature&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x9f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes9&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;erc7964Signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;9&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; ERC7964_MAGIC&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _empty32BytesArrayCalldata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Calldata&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;emptyBytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        fields &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; erc7964Signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;9&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        structIndex &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint16&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;erc7964Signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        application &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;erc7964Signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;12&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; structsArrayOffset &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;erc7964Signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x20&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; structsArrayDataOffset &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; structsArrayOffset &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;structsArrayOffset &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x60&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span&gt; structsArrayDataOffset &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; erc7964Signature&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _empty32BytesArrayCalldata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Calldata&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;emptyBytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; structsArrayLength &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;erc7964Signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;structsArrayOffset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;structsArrayDataOffset &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt; structsArrayLength &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; erc7964Signature&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _empty32BytesArrayCalldata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Calldata&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;emptyBytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; crossChainSignatureOffset &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; structsArrayDataOffset &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt; structsArrayLength &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; crossChainSignatureDataOffset &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; crossChainSignatureOffset &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;crossChainSignatureOffset &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x60&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span&gt; crossChainSignatureDataOffset &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; erc7964Signature&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _empty32BytesArrayCalldata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Calldata&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;emptyBytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; crossChainSignatureLength &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;erc7964Signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;crossChainSignatureOffset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;crossChainSignatureDataOffset &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt; crossChainSignatureLength &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; erc7964Signature&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _empty32BytesArrayCalldata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Calldata&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;emptyBytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;memory-safe&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            structsArray&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;offset &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;erc7964Signature&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;offset&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; structsArrayDataOffset&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            structsArray&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span&gt; structsArrayLength&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        crossChainSignature &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; erc7964Signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            crossChainSignatureDataOffset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt;crossChainSignatureDataOffset &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt; crossChainSignatureLength&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; fields&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; structIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; application&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; structsArray&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; crossChainSignature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _empty32BytesArrayCalldata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;memory-safe&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            result&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;offset &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            result&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;A collection of examples of how to use this ERC to fulfill the &lt;em&gt;Motivation&lt;&#x2F;em&gt; use cases.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;crosschain-intent-example&quot;&gt;Crosschain Intent Example&lt;&#x2F;h3&gt;
&lt;p&gt;A user wants to execute a crosschain trade: sell USDC on Ethereum, receive ETH on Arbitrum:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  types&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    EIP712Domain&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Note: chainId is omitted for crosschain validity&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    CrossChainIntent&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;operations&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ChainOperation[]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;deadline&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    ChainOperation&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;domain&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;EIP712ChainDomain&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;target&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    EIP712ChainDomain&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;verifyingContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  primaryType&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;CrossChainIntent&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  domain&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;CrossChainDEX&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    version&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  message&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    operations&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        domain&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          chainId&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          verifyingContract&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x123321...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; User&amp;#39;s account on Ethereum&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        target&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xA0b86a33E6776885F5Db...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; USDC contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xa9059cbb...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; transfer(settler, 1000 USDC)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        domain&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          chainId&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 42161&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          verifyingContract&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x123321...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; User&amp;#39;s account on Arbitrum&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        target&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xArbitrumSettler...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x3ccfd60b...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; claim(0.5 ETH min)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 42&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    deadline&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1704067200&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;On-chain verification on Ethereum:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Applications can verify crosschain signatures using the encoded format. The signature contains all necessary metadata to reconstruct and verify the crosschain message:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;EIP712&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;utils&#x2F;cryptography&#x2F;EIP712.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Nonces&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;utils&#x2F;Nonces.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;CrossChainSignatureChecker&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;CrossChainSignatureChecker.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CrossChainDEX&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EIP712&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Nonces&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    using&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CrossChainSignatureChecker&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; EIP712_CHAIN_DOMAIN_TYPEHASH &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;EIP712ChainDomain(uint256 chainId,address verifyingContract)&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; CHAIN_OPERATION_TYPEHASH &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;ChainOperation(EIP712ChainDomain domain,address target,uint256 value,bytes data)EIP712ChainDomain(uint256 chainId,address verifyingContract)&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; CROSSCHAIN_INTENT_TYPEHASH &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;CrossChainIntent(ChainOperation[] operations,uint256 nonce,uint256 deadline)ChainOperation(EIP712ChainDomain domain,address target,uint256 value,bytes data)EIP712ChainDomain(uint256 chainId,address verifyingContract)&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt; operationHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _deadlines&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EIP712&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;&amp;quot;CrossChainDEX&amp;quot;, &amp;quot;1&amp;quot;) &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; executeIntent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        ChainOperation&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; currentOp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; deadline&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; currentOpHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _structHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;currentOp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _useCheckedNonce&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _deadlines&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;currentOpHash&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; deadline&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isValidCrossChainSignatureNowCalldata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                currentOpHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                _crossChainStructHash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;Invalid signature&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt; success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; )&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; currentOp&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;target&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;call&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; currentOp&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;currentOp&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Execution failed&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _crossChainStructHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operationsHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;CROSSCHAIN_INTENT_TYPEHASH&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; operationsHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; nonces&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _deadlines&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;operationsHash&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _structHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;ChainOperation&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; op&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                CHAIN_OPERATION_TYPEHASH&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;EIP712_CHAIN_DOMAIN_TYPEHASH&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;chainid&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                op&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;target&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                op&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;op&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The Arbitrum settler would use the same signature with &lt;code&gt;currentIndex: 1&lt;&#x2F;code&gt; and the full data for &lt;code&gt;op[1]&lt;&#x2F;code&gt;. Each chain only receives the full calldata for its own operation, while other operations are represented as 32-byte hashes.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;multi-chain-governance-example&quot;&gt;Multi-Chain Governance Example&lt;&#x2F;h3&gt;
&lt;p&gt;A DAO member votes on a proposal affecting all chain deployments:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  types&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    EIP712Domain&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    MultiChainVote&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;votes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ChainVote[]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    ChainVote&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;domain&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;EIP712ChainDomain&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;proposalId&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;support&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;reason&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    EIP712ChainDomain&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;verifyingContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  primaryType&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;MultiChainVote&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  domain&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;MultiChainDAO&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    version&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  message&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    votes&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        domain&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          chainId&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          verifyingContract&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x123321...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; DAO contract on Ethereum&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        proposalId&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 42&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        support&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; For&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        reason&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;This upgrade improves security&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        domain&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          chainId&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 137&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          verifyingContract&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x321321...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; DAO contract on Polygon&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        proposalId&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 42&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        support&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; For&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        reason&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;This upgrade improves security&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;On-chain verification on each DAO:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;EIP712&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;utils&#x2F;cryptography&#x2F;EIP712.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Nonces&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;utils&#x2F;Nonces.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;CrossChainSignatureChecker&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;CrossChainSignatureChecker.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MultiChainDAO&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EIP712&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Nonces&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    using&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CrossChainSignatureChecker&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; EIP712_CHAIN_DOMAIN_TYPEHASH &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;EIP712ChainDomain(uint256 chainId,address verifyingContract)&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; CHAIN_VOTE_TYPEHASH &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;ChainVote(EIP712ChainDomain domain,uint256 proposalId,uint8 support,string reason)EIP712ChainDomain(uint256 chainId,address verifyingContract)&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; MULTICHAIN_VOTE_TYPEHASH &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;MultiChainVote(ChainVote[] votes,uint256 nonce)ChainVote(EIP712ChainDomain domain,uint256 proposalId,uint8 support,string reason)EIP712ChainDomain(uint256 chainId,address verifyingContract)&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EIP712&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;&amp;quot;MultiChainDAO&amp;quot;, &amp;quot;1&amp;quot;) &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; castVoteWithSignature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        ChainVote&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; currentVote&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; voter&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; erc7964Signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; currentVoteHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _structHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;currentVote&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _useCheckedNonce&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;voter&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            voter&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isValidCrossChainSignatureNowCalldata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                currentVoteHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                erc7964Signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                _crossChainStructHash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;Invalid signature&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _castVote&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;currentVote&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;proposalId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; voter&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; currentVote&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;support&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; currentVote&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;reason&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _crossChainStructHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; votesHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;MULTICHAIN_VOTE_TYPEHASH&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; votesHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; nonces&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;voter&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _structHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;ChainVote&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; vote&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                CHAIN_VOTE_TYPEHASH&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;EIP712_CHAIN_DOMAIN_TYPEHASH&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;chainid&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                vote&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;proposalId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                vote&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;support&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;vote&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;reason&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This vote signature can be submitted to DAO contracts on both Ethereum and Polygon, enabling coordinated multi-chain governance decisions.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;unified-account-management-example&quot;&gt;Unified Account Management Example&lt;&#x2F;h3&gt;
&lt;p&gt;A user wants to add a new signer to their multisig account deployed across multiple chains:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  types&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    EIP712Domain&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    MultiChainAccountUpdate&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;updates&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;AccountUpdate[]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    AccountUpdate&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;domain&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;EIP712ChainDomain&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;operation&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0=addSigner, 1=removeSigner, 2=changeThreshold&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;signerData&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;threshold&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    EIP712ChainDomain&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;verifyingContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  primaryType&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;MultiChainAccountUpdate&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  domain&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;MultiChainMultisig&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    version&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  message&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    updates&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        domain&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          chainId&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          verifyingContract&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x123321...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Account on Ethereum&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        operation&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; addSigner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        signerData&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        threshold&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        domain&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          chainId&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 137&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          verifyingContract&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x123321...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Account on Polygon&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        operation&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; addSigner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        signerData&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        threshold&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        domain&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          chainId&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 42161&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          verifyingContract&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x123321...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Account on Arbitrum&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        operation&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; addSigner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        signerData&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        threshold&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 42&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;On-chain execution:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;EIP712&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;utils&#x2F;cryptography&#x2F;EIP712.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Nonces&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;utils&#x2F;Nonces.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;CrossChainSignatureChecker&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;CrossChainSignatureChecker.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MultiChainMultisig&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EIP712&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Nonces&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    using&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CrossChainSignatureChecker&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; EIP712_CHAIN_DOMAIN_TYPEHASH &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;EIP712ChainDomain(uint256 chainId,address verifyingContract)&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; ACCOUNT_UPDATE_TYPEHASH &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;AccountUpdate(EIP712ChainDomain domain,uint8 operation,bytes signerData,uint256 threshold)EIP712ChainDomain(uint256 chainId,address verifyingContract)&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; MULTICHAIN_ACCOUNT_UPDATE_TYPEHASH &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;MultiChainAccountUpdate(AccountUpdate[] updates,uint256 nonce)AccountUpdate(EIP712ChainDomain domain,uint8 operation,bytes signerData,uint256 threshold)EIP712ChainDomain(uint256 chainId,address verifyingContract)&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EIP712&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;&amp;quot;MultiChainMultisig&amp;quot;, &amp;quot;1&amp;quot;) &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; updateAccountWithSignature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        AccountUpdate&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; currentUpdate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; erc7964Signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; currentUpdateHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _structHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;currentUpdate&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _useCheckedNonce&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isValidCrossChainSignatureNowCalldata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                currentUpdateHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                erc7964Signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                _crossChainStructHash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;Invalid signature&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;currentUpdate&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;operation &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            _addSigner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;currentUpdate&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;signerData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; currentUpdate&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;threshold&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ... other operations&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _crossChainStructHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; updatesHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;MULTICHAIN_ACCOUNT_UPDATE_TYPEHASH&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; updatesHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; nonces&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _structHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;AccountUpdate&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; update&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                ACCOUNT_UPDATE_TYPEHASH&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;EIP712_CHAIN_DOMAIN_TYPEHASH&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;chainid&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                update&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;operation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;update&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;signerData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                update&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;threshold&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _addSigner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signerData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; threshold&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Implementation for adding signer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This signature enables the multisig owners to add a new signer and update the threshold across all chain deployments simultaneously. The same account address exists on Ethereum, Polygon, and Arbitrum, and this single signature authorizes the updates on all three networks.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;crosschain-social-recovery-example&quot;&gt;CrossChain Social Recovery Example&lt;&#x2F;h3&gt;
&lt;p&gt;A user has lost access to their account and guardians need to initiate recovery across multiple networks:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  types&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    EIP712Domain&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Note: verifyingContract is omitted since the recovery module is deployed on different addresses across chains for this example&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    MultiChainRecovery&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;recoveries&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ChainRecovery[]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    ChainRecovery&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;domain&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;EIP712ChainDomain&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;newOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    EIP712ChainDomain&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;verifyingContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  primaryType&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;MultiChainRecovery&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  domain&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;CrossChainSocialRecovery&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    version&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  message&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    recoveries&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        domain&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          chainId&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          verifyingContract&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x123321...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Recovery module on Ethereum&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        newOwner&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x9999999999999999999999999999999999999999&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        domain&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          chainId&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 137&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          verifyingContract&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x321321...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Recovery module on Polygon&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        newOwner&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x9999999999999999999999999999999999999999&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        domain&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          chainId&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 42161&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          verifyingContract&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x432432...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Recovery module on Arbitrum&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        newOwner&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x9999999999999999999999999999999999999999&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;On-chain execution with guardian multisig:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; { &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;CrossChainSignatureChecker&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;CrossChainSignatureChecker.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; EIP712_CHAIN_DOMAIN_TYPEHASH &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;EIP712ChainDomain(uint256 chainId,address verifyingContract)&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; CHAIN_RECOVERY_TYPEHASH &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;ChainRecovery(EIP712ChainDomain domain,address newOwner)EIP712ChainDomain(uint256 chainId,address verifyingContract)&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; MULTICHAIN_RECOVERY_TYPEHASH &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;MultiChainRecovery(ChainRecovery[] recoveries,uint256 nonce)ChainRecovery(EIP712ChainDomain domain,address newOwner)EIP712ChainDomain(uint256 chainId,address verifyingContract)&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _tempNonce&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; initiateRecoveryWithSignature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    ChainRecovery&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; currentRecovery&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; guardians&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; guardianErc7964Signatures&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;guardians&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; guardianErc7964Signatures&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Mismatched arrays&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: chainId and verifyingContract validation is implicit in the struct hash verification&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify the current recovery hash matches all guardian signatures&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; currentRecoveryHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _structHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;currentRecovery&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    _tempNonce &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify all guardian signatures are valid and count valid guardian signatures&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; validSignatures &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; guardians&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            CrossChainSignatureChecker&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isValidCrossChainSignatureNow&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                guardians&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                currentRecoveryHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                guardianErc7964Signatures&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                _computeRecoveryStructHash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isGuardian&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;guardians&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            validSignatures&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;validSignatures &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Insufficient guardian signatures&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Schedule recovery with delay&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    _scheduleRecovery&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;currentRecovery&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;newOwner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt; RECOVERY_DELAY&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _computeRecoveryStructHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recoveriesHash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        MULTICHAIN_RECOVERY_TYPEHASH&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        recoveriesHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _tempNonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _structHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;ChainRecovery&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recovery&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            CHAIN_RECOVERY_TYPEHASH&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;EIP712_CHAIN_DOMAIN_TYPEHASH&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;chainid&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            recovery&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;newOwner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This signature enables guardians to schedule a recovery operation across all chains. The process includes:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Guardian Signatures&lt;&#x2F;strong&gt;: Multiple guardians sign the same crosschain recovery message (3-of-5 threshold)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Schedule Phase&lt;&#x2F;strong&gt;: Once sufficient guardians sign, the recovery is scheduled on all networks with a delay&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Security Window&lt;&#x2F;strong&gt;: Delay period where malicious recovery attempts can be detected and canceled&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Execution Phase&lt;&#x2F;strong&gt;: After the delay, the recovery replaces the account&#x27;s owner&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;CrossChain Consistency&lt;&#x2F;strong&gt;: The same recovery operation is scheduled simultaneously on Ethereum, Polygon, and Arbitrum&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;crosschain-replay&quot;&gt;Crosschain Replay&lt;&#x2F;h3&gt;
&lt;p&gt;This ERC intentionally enables replay across chains, the same signature is designed to be used on multiple chains. The &lt;code&gt;verifyingContract&lt;&#x2F;code&gt; field (set to the user&#x27;s account address) binds the signature to a specific account, preventing unauthorized use. However, applications must implement their own replay protection mechanisms such as including nonces and deadlines in the message.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;account-validation&quot;&gt;Account Validation&lt;&#x2F;h3&gt;
&lt;p&gt;Applications verifying signatures should check that the signing account exists on the current chain. An account that exists on Ethereum but not Polygon should not have signatures accepted on Polygon. For counterfactual accounts that have not been deployed yet, applications should follow &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6492&#x2F;&quot;&gt;ERC-6492&lt;&#x2F;a&gt; to validate signatures.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;code-and-state-differences&quot;&gt;Code and State Differences&lt;&#x2F;h3&gt;
&lt;p&gt;Contract code and state may differ across chains at the same address. Signatures that pass &lt;code&gt;isValidSignature()&lt;&#x2F;code&gt; on one chain may fail on another due to state divergence or chain-specific logic. For example, a crosschain message that has uses a &lt;code&gt;nonce&lt;&#x2F;code&gt; field may find that the nonce is already used on one of the chains. Applications should handle signature validation failures gracefully and should not assume uniform behavior across chains.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;partial-execution-risk&quot;&gt;Partial Execution Risk&lt;&#x2F;h3&gt;
&lt;p&gt;Crosschain signatures do not guarantee atomic execution. A signature may be successfully validated on some chains but not others. This can result in partial fulfillment of the intent. Applications should implement refund mechanisms to allow users to recover from failed partial executions.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, operations may execute in different orders across chains due to varying network conditions, block times, and congestion levels. An operation intended to execute first may complete last on a congested chain, leading to unexpected state changes. For example, in a crosschain trade, a user might sell an asset on one chain before successfully acquiring its replacement on another chain, creating temporary exposure. Applications should design operations to be order-independent where possible, or implement coordination mechanisms to ensure proper sequencing.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;signature-expiration&quot;&gt;Signature Expiration&lt;&#x2F;h3&gt;
&lt;p&gt;Signatures without explicit expiration remain valid indefinitely. If an operation is not executed on some chains, it can be executed later, potentially with unexpected consequences. Applications may include &lt;code&gt;deadline&lt;&#x2F;code&gt; or &lt;code&gt;validUntil&lt;&#x2F;code&gt; fields in messages to prevent stale signature execution.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;wallet-display-considerations&quot;&gt;Wallet Display Considerations&lt;&#x2F;h3&gt;
&lt;p&gt;Since this ERC relies on standard EIP-712 wallet display, users depend on their wallet to correctly show all crosschain operations. Users should:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Review All Operations&lt;&#x2F;strong&gt;: Check every element in the message array&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Verify Chain IDs&lt;&#x2F;strong&gt;: Ensure operations target the expected chains&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Check Amounts&lt;&#x2F;strong&gt;: Verify asset amounts and addresses on each chain&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Understand Atomicity&lt;&#x2F;strong&gt;: Know that operations may execute independently&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Wallet developers should enhance displays to highlight crosschain nature and show warnings about partial execution risks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EOF - Extended types section</title>
        <published>2025-05-28T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Wei Tang</name><uri>https://github.com/sorpaas</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7960/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-series-evm64/23794" />
        

        <id>https://wg-eips.ritovision.com/7960/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7960"
            label="EIP-7960" />
        

        
        

        
        <summary type="html">Extend EOF container&#x27;s types section with an extra type parameter.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7960/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP extends the definition of &lt;code&gt;types_section&lt;&#x2F;code&gt; in EOF format (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3540&#x2F;&quot;&gt;EIP-3540&lt;&#x2F;a&gt;) with an additional &lt;code&gt;type&lt;&#x2F;code&gt; parameter.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;An additional &lt;code&gt;type&lt;&#x2F;code&gt; parameter allows the EOF EVM interpreter to identify the &quot;type&quot; of a code section. This allows the interpreter to &quot;interpret&quot; each code section differently, allowing EOF function calls to, for example, invoke pure EVM64 code or even later support RISC-V.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;types_section&lt;&#x2F;code&gt;, as defined in EIP-3540, is changed to be of the following format &lt;code&gt;(type, reserved, inputs, outputs, max_stack_increase)&lt;&#x2F;code&gt;. &lt;code&gt;type&lt;&#x2F;code&gt; is &lt;code&gt;uint8&lt;&#x2F;code&gt;, &lt;code&gt;reserved&lt;&#x2F;code&gt; is 24 bits, and &lt;code&gt;inputs&lt;&#x2F;code&gt;, &lt;code&gt;outputs&lt;&#x2F;code&gt;, &lt;code&gt;max_stack_increase&lt;&#x2F;code&gt; are defined as &lt;code&gt;uint8&lt;&#x2F;code&gt;, &lt;code&gt;uint8&lt;&#x2F;code&gt;, &lt;code&gt;uint16&lt;&#x2F;code&gt; respectively, the same as before. The only valid &lt;code&gt;type&lt;&#x2F;code&gt; defined in this EIP is &lt;code&gt;0x01&lt;&#x2F;code&gt;. Additional EIPs may be defined for other code section &lt;code&gt;type&lt;&#x2F;code&gt;s.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;version&lt;&#x2F;code&gt;, as defined in EIP-3540, is changed to &lt;code&gt;0x02&lt;&#x2F;code&gt;, to avoid the backward compatibility issue if a third-party chain already deployed EOF in production.&lt;&#x2F;p&gt;
&lt;p&gt;In EOF container, the following validation rules are added:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If a &lt;code&gt;type&lt;&#x2F;code&gt; in &lt;code&gt;types_section&lt;&#x2F;code&gt; is not of a known type, then the validation fails.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;reserved&lt;&#x2F;code&gt; in &lt;code&gt;types_section&lt;&#x2F;code&gt; must be all zeros.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The new &lt;code&gt;type&lt;&#x2F;code&gt; parameter allows a contract to &quot;dispatch&quot; to different variants of the interpreter to better suit its need.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The portion of the code where it mainly interacts with Ethereum addresses, balances, storages may run &quot;normal&quot; EVM.&lt;&#x2F;li&gt;
&lt;li&gt;The portion of the code that is computationally heavy may run faster EVM64, but loses the ability to directly interact with Ethereum addresses and balances.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Allowing this &lt;code&gt;type&lt;&#x2F;code&gt; to be defined for each code section ensures that a contract remains concise -- it can quickly switch between its computational needs and system&#x2F;runtime needs.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;reserved&lt;&#x2F;code&gt; is added to &lt;code&gt;types_section&lt;&#x2F;code&gt; to maintain the proper padding. Each item in &lt;code&gt;types_section&lt;&#x2F;code&gt; is now 64 bits in total.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;As we know, EOF, including EIP-3540, was extremely close to being deployed before it was decided to withdraw from Fusaka. To avoid the issue that some third-party chains have already deployed EOF in production (given the state of EOF we can consider this to be likely), we bump &lt;code&gt;version&lt;&#x2F;code&gt; of EOF to &lt;code&gt;0x02&lt;&#x2F;code&gt;. &lt;code&gt;0x01&lt;&#x2F;code&gt; is now invalid.&lt;&#x2F;p&gt;
&lt;p&gt;No other backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;To be added.&lt;&#x2F;p&gt;
&lt;!-- TODO --&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;To be added.&lt;&#x2F;p&gt;
&lt;!-- TODO --&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EVM64 - EOF code section</title>
        <published>2025-05-28T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Wei Tang</name><uri>https://github.com/sorpaas</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7961/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-series-evm64/23794" />
        

        <id>https://wg-eips.ritovision.com/7961/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7961"
            label="EIP-7961" />
        

        
        

        
        <summary type="html">Define &quot;pure&quot; EVM64 mode, as an EOF code section.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7961/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;An EOF-only specification for EVM64 instruction set. This defines a separate &quot;EVM64&quot; type for EOF code section in addition to &quot;regular EVM&quot;. The interpreter then enters EVM64 mode when entering the code section. This EIP is an alternative to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7937&#x2F;&quot;&gt;EIP-7937&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;EIP-7937 has maximum compatibility with existing EVM. It implements EVM64 simply as a group of additional opcodes (using a prefix opcode). This EIP defines an alternative method, using EOF container&#x27;s code section. It has its pros and cons. The code size will obviously become shorter, due to not needing multibyte opcodes any more. On the other hand, interop with EVM system calls become more difficult because it cannot be done in an EVM64 code section. The advantages and disadvantages are discussed further in the Rationale section.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Define &lt;code&gt;0x02&lt;&#x2F;code&gt; as an allowed &lt;code&gt;type&lt;&#x2F;code&gt; in &lt;code&gt;types_section&lt;&#x2F;code&gt;, as defined in EIP-7960. This denotes an EVM64 code section.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;eof-function-execution&quot;&gt;EOF function execution&lt;&#x2F;h3&gt;
&lt;p&gt;When entering an EOF code section (either at the beginning of the contract call, or through &lt;code&gt;CALLF&lt;&#x2F;code&gt;), it enters &quot;pure EVM64 mode&quot;. Unless defined below, no other opcodes are allowed. Those opcodes all only operate on the least significant 64-bit, in little endian.&lt;&#x2F;p&gt;
&lt;p&gt;During EOF validation, the validation function should enforce that only allowed opcodes exist.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-cost-constants&quot;&gt;Gas cost constants&lt;&#x2F;h3&gt;
&lt;p&gt;We define the following gas cost constants:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;G_BASE64&lt;&#x2F;code&gt;: 1&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;G_VERYLOW64&lt;&#x2F;code&gt;: 2&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;G_LOW64&lt;&#x2F;code&gt;: 3&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;G_MID64&lt;&#x2F;code&gt;: 5&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;G_HIGH64&lt;&#x2F;code&gt;: 7&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;G_EXP64_STATIC&lt;&#x2F;code&gt;: 5&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;G_EXP64_DYNAMIC&lt;&#x2F;code&gt;: 25&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;G_RJUMPIV64&lt;&#x2F;code&gt;: 3&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;arithmetic-opcodes&quot;&gt;Arithmetic opcodes&lt;&#x2F;h3&gt;
&lt;p&gt;The 64-bit mode arithmetic opcodes are defined the same as non-64-bit mode, except that they only operate on the least significant 64-bits. In the below definition, &lt;code&gt;a&lt;&#x2F;code&gt;, &lt;code&gt;b&lt;&#x2F;code&gt;, &lt;code&gt;N&lt;&#x2F;code&gt; is &lt;code&gt;a mod 2^64&lt;&#x2F;code&gt;, &lt;code&gt;b mod 2^64&lt;&#x2F;code&gt; and &lt;code&gt;N mod 2^64&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;ADD (&lt;code&gt;01&lt;&#x2F;code&gt;) and SUB (&lt;code&gt;03&lt;&#x2F;code&gt;): &lt;code&gt;a op b mod 2^64&lt;&#x2F;code&gt;, gas cost &lt;code&gt;G_VERYLOW64&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;MUL (&lt;code&gt;02&lt;&#x2F;code&gt;), DIV (&lt;code&gt;04&lt;&#x2F;code&gt;), SDIV (&lt;code&gt;05&lt;&#x2F;code&gt;), MOD (&lt;code&gt;06&lt;&#x2F;code&gt;), SMOD (&lt;code&gt;07&lt;&#x2F;code&gt;), SIGNEXTEND (&lt;code&gt;0B&lt;&#x2F;code&gt;): &lt;code&gt;a op b mod 2^64&lt;&#x2F;code&gt;, gas cost &lt;code&gt;G_LOW64&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;ADDMOD (&lt;code&gt;08&lt;&#x2F;code&gt;), MULMOD (&lt;code&gt;09&lt;&#x2F;code&gt;): &lt;code&gt;a op b % N mod 2^64&lt;&#x2F;code&gt;, gas cost &lt;code&gt;G_MID64&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;EXP (&lt;code&gt;0A&lt;&#x2F;code&gt;): &lt;code&gt;a EXP b mod 2^64&lt;&#x2F;code&gt;, gas cost &lt;code&gt;static_gas = G_EXP64_STATIC, dynamic_gas = G_EXP64_DYNAMIC * exponent_byte_size&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;comparison-and-bitwise-opcodes&quot;&gt;Comparison and bitwise opcodes&lt;&#x2F;h3&gt;
&lt;p&gt;The 64-bit mode comparison and bitwise opcodes are defined the same as non-64-bit mode, except that they only operate on the least significant 64 bits.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;LT (&lt;code&gt;10&lt;&#x2F;code&gt;), GT (&lt;code&gt;11&lt;&#x2F;code&gt;), SLT (&lt;code&gt;12&lt;&#x2F;code&gt;), SGT (&lt;code&gt;13&lt;&#x2F;code&gt;), EQ (&lt;code&gt;14&lt;&#x2F;code&gt;), AND (&lt;code&gt;16&lt;&#x2F;code&gt;), OR (&lt;code&gt;17&lt;&#x2F;code&gt;), XOR (&lt;code&gt;18&lt;&#x2F;code&gt;): &lt;code&gt;a op b mod 2^64&lt;&#x2F;code&gt;, gas cost &lt;code&gt;G_VERYLOW64&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;ISZERO (&lt;code&gt;15&lt;&#x2F;code&gt;), NOT (&lt;code&gt;19&lt;&#x2F;code&gt;): &lt;code&gt;op a mod 2^64&lt;&#x2F;code&gt;, gas cost &lt;code&gt;G_VERYLOW64&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;SHL (&lt;code&gt;1B&lt;&#x2F;code&gt;), SHR (&lt;code&gt;1C&lt;&#x2F;code&gt;), SAR (&lt;code&gt;1D&lt;&#x2F;code&gt;): &lt;code&gt;a op N mod 2^64&lt;&#x2F;code&gt;, gas cost &lt;code&gt;G_VERYLOW64&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;BYTE (&lt;code&gt;1A&lt;&#x2F;code&gt;) is defined as &lt;code&gt;(x &amp;gt;&amp;gt; i * 8) &amp;amp; 0xFF&lt;&#x2F;code&gt;. Note that the definition is changed from big endian to little endian.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;memory-opcodes&quot;&gt;Memory opcodes&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;MLOAD64&lt;&#x2F;code&gt; (0x51) will load a 64-bits integer in little endian onto the stack. &lt;code&gt;MSTORE64&lt;&#x2F;code&gt; (0x52) will read an 64-bits integer from the stack, and store it to memory in little endian.&lt;&#x2F;p&gt;
&lt;p&gt;The gas cost for both opcodes is &lt;code&gt;G_VERYLOW64&lt;&#x2F;code&gt;. The memory resizing costs count as 8 bytes.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;MSTORE8&lt;&#x2F;code&gt; is available in EVM64 mode, and its gas cost is the same as in &quot;normal&quot; EVM.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;stack-opcodes&quot;&gt;Stack opcodes&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;PUSH0&lt;&#x2F;code&gt; (0x5f) to &lt;code&gt;PUSH8&lt;&#x2F;code&gt; (0x67) follows 0-byte to 8-byte literal. The literal is read little endian and pushed onto the stack. The gas cost for them is &lt;code&gt;G_VERYLOW64&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;POP&lt;&#x2F;code&gt;, &lt;code&gt;SWAPn&lt;&#x2F;code&gt; and &lt;code&gt;DUPn&lt;&#x2F;code&gt; are available in EVM64 mode, and their gas costs are the same as in &quot;normal&quot; EVM.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;other-opcodes&quot;&gt;Other opcodes&lt;&#x2F;h3&gt;
&lt;p&gt;Contract opcodes &lt;code&gt;RETURN&lt;&#x2F;code&gt;, &lt;code&gt;REVERT&lt;&#x2F;code&gt;, &lt;code&gt;INVALID&lt;&#x2F;code&gt; are available in EVM64 mode. Their behaviors, including gas costs, are unchanged. However, for all stack items, only the least significant 64 bits are read.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;CALLF&lt;&#x2F;code&gt;, &lt;code&gt;RETF&lt;&#x2F;code&gt;, &lt;code&gt;RJUMP&lt;&#x2F;code&gt; are available in EVM64 mode. Their behaviors, including gas costs, are unchanged.&lt;&#x2F;p&gt;
&lt;p&gt;For flow operations RJUMPI and RJUMPV, the 64-bit mode has following changes:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;For &lt;code&gt;RJUMPI64&lt;&#x2F;code&gt; (0xe1), the condition popped from stack is only read for the last 64 bits. Gas cost is &lt;code&gt;G_RJUMPIV64&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;For &lt;code&gt;RJUMPV64&lt;&#x2F;code&gt; (0xe2), the case popped from stack is only read for the last 64 bits. Gas cost is &lt;code&gt;G_RJUMPIV64&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;stack-behavior&quot;&gt;Stack behavior&lt;&#x2F;h3&gt;
&lt;p&gt;&quot;Pure&quot; in &quot;pure EVM64&quot; refers to the fact that all opcodes in EVM64 mode only operate on the least significant 64 bits. In this specification, we don&#x27;t specifically define 64-bit stack. As far as this EIP is concerned, stack is still 256-bit. However, because they only operate on the least significant 64 bits. The most significant 192 bits becomes unobservable as long as the interpreter is in an EVM64 code section. Thus an EVM interpreter can optimize EVM64 execution as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;When entering EVM64 code section, truncate &lt;code&gt;inputs&lt;&#x2F;code&gt; to 64 bits.&lt;&#x2F;li&gt;
&lt;li&gt;Use 64-bit stack during EVM64 execution.&lt;&#x2F;li&gt;
&lt;li&gt;When exiting EVM64 code section, prepend &lt;code&gt;0&lt;&#x2F;code&gt; to &lt;code&gt;outputs&lt;&#x2F;code&gt; to make it 256 bits.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;discussions&quot;&gt;Discussions&lt;&#x2F;h3&gt;
&lt;p&gt;This alternative definition (compared with EIP-7937) has the advantage that the code size is now shorter (because no multibyte opcodes are needed). It however will only work with EOF contract but not &quot;legacy&quot; EVM. The interaction between EVM64 and &quot;system calls&quot; (those calls that read Ethereum block values, addresses, balances and storages) will be more difficult. It&#x27;s not &quot;seamless&quot; like EIP-7937 where one can enter&#x2F;exit 64-bit mode at ease. Depending on how the 64-bit optimization works out, this may be an advantage or a disadvantage.&lt;&#x2F;p&gt;
&lt;p&gt;The memory is, as usual, still shared during the entire execution. So in EVM64, the contract can always use the memory to push&#x2F;fetch data.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;!-- TODO: Add test cases and reference implementation --&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion. &lt;!-- TODO --&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Precompile for secp256r1 Curve Support</title>
        <published>2025-05-27T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Carl Beekhuizen</name><uri>https://github.com/carlbeek</uri>
	</author>
	
	<author>
		<name>Ulaş Erdoğan</name><uri>https://github.com/ulerdogan</uri>
	</author>
	
	<author>
		<name>Doğan Alpaslan</name><uri>https://github.com/doganalpaslan</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7951/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7951-precompile-for-secp256r1-curve-support/24360" />
        

        <id>https://wg-eips.ritovision.com/7951/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:7951"
            label="EIP-7951" />
        

        
        

        
        <summary type="html">Add precompiled contract for secp256r1 ECDSA signature verification with proper security checks</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7951/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Add functionality to efficiently perform ECDSA signature verification over the secp256r1 elliptic curve (also known as P-256 or prime256v1). This precompile enables native support for signatures generated by modern secure hardware including Apple Secure Enclave, Android Keystore, and FIDO2&#x2F;WebAuthn devices.&lt;&#x2F;p&gt;
&lt;p&gt;This specification addresses critical security issues discovered in RIP-7212 while maintaining full interface compatibility with existing Layer 2 implementations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The secp256r1 elliptic curve is a NIST-standardized curve widely supported in modern secure hardware and authentication systems. Adding native support for secp256r1 signature verification to Ethereum enables several important use cases that are currently impossible or prohibitively expensive.&lt;&#x2F;p&gt;
&lt;p&gt;Modern secure hardware devices, including Apple Secure Enclave, Android Keystore, HSMs, TEEs, and FIDO2&#x2F;WebAuthn authenticators, use secp256r1 for key storage and signing operations. Native secp256r1 support enables sophisticated account abstraction patterns like device-native signing, multi-factor authentication, and simplified key management - ultimately reducing friction for mainstream adoption through familiar authentication flows.&lt;&#x2F;p&gt;
&lt;p&gt;The secp256r1 curve is already widely supported across blockchain networks and protocols, including Layer 2 networks, enterprise blockchains, and interoperability protocols. This broad compatibility enables seamless integration with existing infrastructure while maintaining security through hardware-backed signing capabilities.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP supersedes RIP-7212 by implementing the same functionality with the same interface, but without the vulnerability.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;precompile&quot;&gt;Precompile&lt;&#x2F;h3&gt;
&lt;p&gt;We introduce &lt;code&gt;P256VERIFY&lt;&#x2F;code&gt; a precompile at the address &lt;code&gt;0x100&lt;&#x2F;code&gt; which performs ECDSA signature verification over the secp256r1 curve with a gas cost of &lt;code&gt;6900&lt;&#x2F;code&gt; gas&lt;&#x2F;p&gt;
&lt;h3 id=&quot;curve-parameters&quot;&gt;Curve Parameters&lt;&#x2F;h3&gt;
&lt;p&gt;The secp256r1 curve is fully defined by the following set of parameters:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Base field modulus = p = 0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Curve equation: y^2 = x^3 + ax + b (mod p)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Curve coefficient a = 0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Curve coefficient b = 0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Base point G:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Gx = 0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Gy = 0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Subgroup order = n = 0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Cofactor = h = 0x1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;These parameters are standardized by NIST in SP 800-186&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-1-1&quot;&gt;&lt;a href=&quot;#fn-1&quot;&gt;1&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;fields-and-groups&quot;&gt;Fields and Groups&lt;&#x2F;h3&gt;
&lt;p&gt;The field Fp is defined as the finite field of size &lt;code&gt;p&lt;&#x2F;code&gt; with elements represented as integers between 0 and p-1 (both inclusive).&lt;&#x2F;p&gt;
&lt;p&gt;The group G is defined as a set of Fp pairs (points) &lt;code&gt;(x,y)&lt;&#x2F;code&gt; such that either &lt;code&gt;(x,y)&lt;&#x2F;code&gt; is &lt;code&gt;(0,0)&lt;&#x2F;code&gt; (representing the point at infinity) or &lt;code&gt;x,y&lt;&#x2F;code&gt; satisfy the curve equation &lt;code&gt;y^2 = x^3 + ax + b (mod p)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;points-and-encoding&quot;&gt;Points and Encoding&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;field-elements-encoding&quot;&gt;Field Elements Encoding&lt;&#x2F;h4&gt;
&lt;p&gt;A base field element (Fp) is encoded as &lt;code&gt;32&lt;&#x2F;code&gt; bytes by performing BigEndian encoding of the corresponding (unsigned) integer. The corresponding integer &lt;strong&gt;must&lt;&#x2F;strong&gt; be less than the field modulus &lt;code&gt;p&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;encoding-of-points-in-g&quot;&gt;Encoding of Points in G&lt;&#x2F;h4&gt;
&lt;p&gt;Points in G are encoded as byte concatenation of the respective encodings of the &lt;code&gt;x&lt;&#x2F;code&gt; and &lt;code&gt;y&lt;&#x2F;code&gt; coordinates. Total encoding length for a G point is thus &lt;code&gt;64&lt;&#x2F;code&gt; bytes.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;point-of-infinity-encoding&quot;&gt;Point of Infinity Encoding&lt;&#x2F;h4&gt;
&lt;p&gt;For secp256r1, the point with coordinates &lt;code&gt;(0, 0)&lt;&#x2F;code&gt; (zeroes in Fp) is &lt;em&gt;not&lt;&#x2F;em&gt; on the curve, so a sequence of &lt;code&gt;64&lt;&#x2F;code&gt; zero bytes is used by convention to encode the point of infinity.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;encoding-of-scalars&quot;&gt;Encoding of Scalars&lt;&#x2F;h4&gt;
&lt;p&gt;A scalar is encoded as &lt;code&gt;32&lt;&#x2F;code&gt; bytes by performing BigEndian encoding of the corresponding (unsigned) integer. The corresponding integer is &lt;strong&gt;not&lt;&#x2F;strong&gt; required to be less than or equal to the subgroup order &lt;code&gt;n&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;behavior-on-invalid-inputs&quot;&gt;Behavior on Invalid Inputs&lt;&#x2F;h4&gt;
&lt;p&gt;On inputs that cannot be valid encodings of field elements or points, the precompile &lt;em&gt;must&lt;&#x2F;em&gt; return `` (failure).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;abi-for-p256verify-operation&quot;&gt;ABI for &lt;code&gt;P256VERIFY&lt;&#x2F;code&gt; Operation&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;input&quot;&gt;Input&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;P256VERIFY&lt;&#x2F;code&gt; call expects &lt;code&gt;160&lt;&#x2F;code&gt; bytes as input that is interpreted as byte concatenation of:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;32&lt;&#x2F;code&gt; bytes: message hash &lt;code&gt;h&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;32&lt;&#x2F;code&gt; bytes: signature component &lt;code&gt;r&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;32&lt;&#x2F;code&gt; bytes: signature component &lt;code&gt;s&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;32&lt;&#x2F;code&gt; bytes: public key x-coordinate &lt;code&gt;qx&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;32&lt;&#x2F;code&gt; bytes: public key y-coordinate &lt;code&gt;qy&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;output&quot;&gt;Output&lt;&#x2F;h4&gt;
&lt;p&gt;Output is &lt;code&gt;32&lt;&#x2F;code&gt; bytes on successful verification and &lt;code&gt;0&lt;&#x2F;code&gt; bytes on failure:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;code&gt; for valid signatures&lt;&#x2F;li&gt;
&lt;li&gt;`` for invalid signatures or invalid inputs&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;input-validation&quot;&gt;Input Validation&lt;&#x2F;h4&gt;
&lt;p&gt;The precompile MUST perform the following validation checks and return `` (failure) if any check fails:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Input length&lt;&#x2F;strong&gt;: Input MUST be exactly &lt;code&gt;160&lt;&#x2F;code&gt; bytes&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Signature component bounds&lt;&#x2F;strong&gt;: Both &lt;code&gt;r&lt;&#x2F;code&gt; and &lt;code&gt;s&lt;&#x2F;code&gt; MUST satisfy &lt;code&gt;0 &amp;lt; r &amp;lt; n&lt;&#x2F;code&gt; and &lt;code&gt;0 &amp;lt; s &amp;lt; n&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Public key bounds&lt;&#x2F;strong&gt;: Both &lt;code&gt;qx&lt;&#x2F;code&gt; and &lt;code&gt;qy&lt;&#x2F;code&gt; MUST satisfy &lt;code&gt;0 ≤ qx &amp;lt; p&lt;&#x2F;code&gt; and &lt;code&gt;0 ≤ qy &amp;lt; p&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Point validity&lt;&#x2F;strong&gt;: The point &lt;code&gt;(qx, qy)&lt;&#x2F;code&gt; MUST satisfy the curve equation &lt;code&gt;qy^2 ≡ qx^3 + a*qx + b (mod p)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Point not at infinity&lt;&#x2F;strong&gt;: The point &lt;code&gt;(qx, qy)&lt;&#x2F;code&gt; MUST NOT be the point at infinity (represented as &lt;code&gt;(0, 0)&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h4 id=&quot;signature-verification-algorithm&quot;&gt;Signature Verification Algorithm&lt;&#x2F;h4&gt;
&lt;p&gt;The verification algorithm follows these steps:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Input validation (as specified above)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;if input_length != 160:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;if not (0 &amp;lt; r &amp;lt; n and 0 &amp;lt; s &amp;lt; n):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;if not (0 ≤ qx &amp;lt; p and 0 ≤ qy &amp;lt; p):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;if qy^2 ≢ qx^3 + a*qx + b (mod p):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;if (qx, qy) == (0, 0):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Signature verification&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;s1 = s^(-1) (mod n)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Recover the random point used during signing&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;R&amp;#39; = (h * s1) * G + (r * s1) * (qx, qy)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Check for point at infinity&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;if R&amp;#39; is the point at infinity:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Extract x-coordinate from r&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;r&amp;#39; = R&amp;#39;.x&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Compare with modular reduction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;if r&amp;#39; ≡ r (mod n):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return 0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;else:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;error-cases&quot;&gt;Error Cases&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Invalid input length (not exactly 160 bytes)&lt;&#x2F;li&gt;
&lt;li&gt;Invalid field element encoding (≥ field modulus)&lt;&#x2F;li&gt;
&lt;li&gt;Invalid signature component bounds (r or s not in range (0, n))&lt;&#x2F;li&gt;
&lt;li&gt;Invalid public key (point at infinity or not on curve)&lt;&#x2F;li&gt;
&lt;li&gt;Signature verification failure&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;gas-schedule&quot;&gt;Gas Schedule&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;p256verify-operation&quot;&gt;&lt;code&gt;P256VERIFY&lt;&#x2F;code&gt; operation&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;6900&lt;&#x2F;code&gt; gas&lt;&#x2F;p&gt;
&lt;p&gt;This cost is based on benchmarking against the existing &lt;code&gt;ECRECOVER&lt;&#x2F;code&gt; precompile (&lt;code&gt;3000&lt;&#x2F;code&gt; gas). During benchmarks we found that the actual cost of R1 verification was significantly slower than the &lt;code&gt;ECRECOVER&lt;&#x2F;code&gt; precompile and the decision was made to increase the gas cost to &lt;code&gt;6900&lt;&#x2F;code&gt; gas.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;gas-burning-on-error&quot;&gt;Gas Burning on Error&lt;&#x2F;h4&gt;
&lt;p&gt;The precompile MUST NOT revert under any circumstances. Invalid inputs or verification failures MUST return `` and consume the same amount of gas had verification succeeded.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;security-fixes&quot;&gt;Security Fixes&lt;&#x2F;h3&gt;
&lt;p&gt;This specification addresses two critical vulnerabilities in RIP-7212:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Point-at-infinity check&lt;&#x2F;strong&gt;: The original RIP-7212 failed to check if the recovered point R&#x27; is the point at infinity. This could lead to non-deterministic behavior where the verification result depends on the underlying implementation&#x27;s handling of infinity points, potentially causing consensus failures.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Modular comparison&lt;&#x2F;strong&gt;: The original comparison &lt;code&gt;r&#x27; == r&lt;&#x2F;code&gt; should be &lt;code&gt;r&#x27; ≡ r (mod n)&lt;&#x2F;code&gt; to handle cases where the x-coordinate of R&#x27; exceeds the curve order n. This ensures mathematically correct verification according to ECDSA standards.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;verification-vs-recovery&quot;&gt;Verification vs Recovery&lt;&#x2F;h3&gt;
&lt;p&gt;This specification uses signature verification rather than public key recovery (like &lt;code&gt;ECRECOVER&lt;&#x2F;code&gt;) because:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Most secp256r1 implementations in hardware and software verify signatures directly&lt;&#x2F;li&gt;
&lt;li&gt;The NIST FIPS 186-5 standard[^2] specifies verification, not recovery&lt;&#x2F;li&gt;
&lt;li&gt;Verification is more efficient than recovery for this curve&lt;&#x2F;li&gt;
&lt;li&gt;Existing hardware implementations provide verification interfaces&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;gas-cost-justification&quot;&gt;Gas Cost Justification&lt;&#x2F;h3&gt;
&lt;p&gt;The 6900 gas cost does not maintain compatibility with L2s, but it matches closer the benchmarks of actual implementations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP maintains full interface compatibility with RIP-7212 implementations deployed on Layer 2 networks. The same contract bytecode that works with RIP-7212 will work with this specification.&lt;&#x2F;p&gt;
&lt;p&gt;The security fixes are transparent to correctly implemented callers - they only affect edge cases that should have failed verification anyway. No existing valid use cases are broken.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;interface-compatibility&quot;&gt;Interface Compatibility&lt;&#x2F;h3&gt;
&lt;p&gt;The precompile maintains a similar interface as RIP-7212 to ensure compatibility with existing Layer 2 deployments:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Same address: &lt;code&gt;0x100&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Same input format: 160 bytes&lt;&#x2F;li&gt;
&lt;li&gt;Same output format: 32 bytes&lt;&#x2F;li&gt;
&lt;li&gt;Different gas cost: 3450 gas vs 6900 gas&lt;&#x2F;li&gt;
&lt;li&gt;Same return values&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;A set of test vectors for verifying implementations is located in a separate &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7951&#x2F;.&#x2F;assets&#x2F;test-vectors.json&quot;&gt;file&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;A reference implementation is not supplied due to the ubiquity of secp256r1, if however a reference is needed, the NIST specification in FIPS 186-5[^2]&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;cryptographic-security&quot;&gt;Cryptographic Security&lt;&#x2F;h3&gt;
&lt;p&gt;The secp256r1 curve provides approximately 128 bits of security, equivalent to secp256k1 already in use in Ethereum. The curve parameters are standardized by NIST SP 800-186&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-1-2&quot;&gt;&lt;a href=&quot;#fn-1&quot;&gt;1&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; and have undergone extensive cryptographic analysis by the wider cryptographic community in addition to this curve being deployed to several L2s in the form of RIP-7212.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;malleability&quot;&gt;Malleability&lt;&#x2F;h3&gt;
&lt;p&gt;Unlike secp256k1 ECDSA signatures, secp256r1 ECDSA signatures are not required to be non-malleable per NIST FIPS 186-5 standard [^2]. Applications requiring non-malleability should implement additional checks at the application layer.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;side-channel-resistance&quot;&gt;Side-Channel Resistance&lt;&#x2F;h3&gt;
&lt;p&gt;We explicitly state that this precompile &lt;strong&gt;IS NOT REQUIRED&lt;&#x2F;strong&gt; to perform all the operations using constant time algorithms.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;section class=&quot;footnotes&quot;&gt;
&lt;ol class=&quot;footnotes-list&quot;&gt;
&lt;li id=&quot;fn-1&quot;&gt;
&lt;p&gt;Chen, L., Moody, D., Regenscheid, A., Randall, K., &amp;amp; Robinson, A. (2023). &lt;span style=&quot;font-style: italic;&quot;&gt;Recommendations for Discrete Logarithm-based Cryptography: Elliptic Curve Domain Parameters&lt;&#x2F;span&gt; (Nos. 800–186). National Institute of Standards and Technology. https:&#x2F;&#x2F;doi.org&#x2F;&lt;a href=&quot;https:&#x2F;&#x2F;doi.org&#x2F;10.6028&#x2F;NIST.SP.800-186&quot;&gt;10.6028&#x2F;NIST.SP.800-186&lt;&#x2F;a&gt;[^2]: National Institute of Standards and Technology. (2023). &lt;span style=&quot;font-style: italic;&quot;&gt;Digital Signature Standard (DSS)&lt;&#x2F;span&gt; (Nos. 186–5). National Institute of Standards and Technology. https:&#x2F;&#x2F;doi.org&#x2F;&lt;a href=&quot;https:&#x2F;&#x2F;doi.org&#x2F;10.6028&#x2F;NIST.FIPS.186-5&quot;&gt;10.6028&#x2F;NIST.FIPS.186-5&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-1-1&quot;&gt;↩&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-1-2&quot;&gt;↩2&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;section&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EVM64 - EOF support</title>
        <published>2025-05-26T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Wei Tang</name><uri>https://github.com/sorpaas</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7957/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7937-64-bit-mode-evm-opcodes-evm64/23794" />
        

        <id>https://wg-eips.ritovision.com/7957/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7957"
            label="EIP-7957" />
        

        
        

        
        <summary type="html">EVM Object Format support for EVM64</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7957/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP defines EOF support for EVM64 with its additional code validation rules and &lt;code&gt;RJUMPI&lt;&#x2F;code&gt;, &lt;code&gt;RJUMPV&lt;&#x2F;code&gt; opcodes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;EOF defines a stricter code validation rule to improve efficiency. Due to EVM64 using multibyte opcode (the mode opcode &lt;code&gt;C0&lt;&#x2F;code&gt;), a small adaptation is needed. This EIP also additionally defines a 64-bit mode &lt;code&gt;RJUMPI&lt;&#x2F;code&gt; and &lt;code&gt;RJUMPV&lt;&#x2F;code&gt; to be 64-bit.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;We define the following gas cost constant:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Gas&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;G_RJUMPIV64&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;3&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;At EOF contract creation time as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3670&#x2F;&quot;&gt;EIP-3670&lt;&#x2F;a&gt;, if the opcode &lt;code&gt;C0&lt;&#x2F;code&gt; is encountered and it is not part of PUSH opcode&#x27;s data, then the interpreter MUST validate that:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The next opcode exists.&lt;&#x2F;li&gt;
&lt;li&gt;The next opcode is &lt;code&gt;RJUMPI64&lt;&#x2F;code&gt;, &lt;code&gt;RJUMPV64&lt;&#x2F;code&gt;, or one of the core 64-bit opcode defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7937&#x2F;&quot;&gt;EIP-7937&lt;&#x2F;a&gt; minus &lt;code&gt;JUMP64&lt;&#x2F;code&gt; and &lt;code&gt;JUMPI64&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;For flow operations RJUMPI and RJUMPV, the 64-bit mode has following changes:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;For &lt;code&gt;RJUMPI64&lt;&#x2F;code&gt; (0xc0e1), the condition popped from stack is only read for the last 64 bits. Gas cost is &lt;code&gt;G_RJUMPIV64&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;For &lt;code&gt;RJUMPV64&lt;&#x2F;code&gt; (0xc0e2), the case popped from stack is only read for the last 64 bits. Gas cost is &lt;code&gt;G_RJUMPIV64&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note that:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;RJUMP&lt;&#x2F;code&gt; is automatically in 64-bit mode because it does not read or write the stack.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;For detailed rationale discussion, please see the core EVM64 definition &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7937&#x2F;&quot;&gt;EIP-7937&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;To be added.&lt;&#x2F;p&gt;
&lt;!-- TODO --&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;To be added.&lt;&#x2F;p&gt;
&lt;!-- TODO --&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EVM64 - Little endian opcodes</title>
        <published>2025-05-26T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Wei Tang</name><uri>https://github.com/sorpaas</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7958/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7937-64-bit-mode-evm-opcodes-evm64/23794" />
        

        <id>https://wg-eips.ritovision.com/7958/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7958"
            label="EIP-7958" />
        

        
        

        
        <summary type="html">Little endian opcodes `BYTE64`, `MLOAD64`, `MSTORE64`, and `PUSH*64` for EVM64</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7958/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP defines additional little endian opcodes that can be deployed alongside &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7937&#x2F;&quot;&gt;EIP-7937&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The core EIP that defines EVM64 (EIP-7937) is endianness-independent. This EIP defines those additional opcodes that must expose endianness. They are the bitwise opcode &lt;code&gt;BYTE64&lt;&#x2F;code&gt;, memory opcodes &lt;code&gt;MLOAD64&lt;&#x2F;code&gt; and &lt;code&gt;MSTORE64&lt;&#x2F;code&gt;, and stack opcodes &lt;code&gt;PUSH*64&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;We define the following gas cost constant:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;G_VERYLOW64&lt;&#x2F;code&gt;: 2&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;byte64&quot;&gt;&lt;code&gt;BYTE64&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;BYTE64&lt;&#x2F;code&gt; (0xc01a) is defined as &lt;code&gt;(x &amp;gt;&amp;gt; i * 8) &amp;amp; 0xFF&lt;&#x2F;code&gt;. Note that the definition is changed from big endian to little endian.&lt;&#x2F;p&gt;
&lt;p&gt;The gas cost is &lt;code&gt;G_VERYLOW64&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;mload64-and-mstore64&quot;&gt;&lt;code&gt;MLOAD64&lt;&#x2F;code&gt; and &lt;code&gt;MSTORE64&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;MLOAD64&lt;&#x2F;code&gt; (0xc051) will load a 64-bit integer in little endian onto the stack. &lt;code&gt;MSTORE64&lt;&#x2F;code&gt; (0xc052) will read an 64-bit integer from the stack, and store it to memory in little endian.&lt;&#x2F;p&gt;
&lt;p&gt;The gas cost for both opcodes is &lt;code&gt;G_VERYLOW64&lt;&#x2F;code&gt;. The memory resizing costs count as 8 bytes.&lt;&#x2F;p&gt;
&lt;p&gt;As an example, &lt;code&gt;[0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08]&lt;&#x2F;code&gt; is an array of 8 bytes (64 bits). Calling &lt;code&gt;MLOAD64&lt;&#x2F;code&gt; to load this 8-byte value to stack will read it in little endian, resulting in 64-bit integer &lt;code&gt;0x0807060504030201&lt;&#x2F;code&gt;. 64-bit mode always operate on only the least significant 64 bits. When another 256-bit opcodes encounter this value on stack, it will be &lt;code&gt;0x00..00 0807060504030201&lt;&#x2F;code&gt;. Calling &lt;code&gt;MSTORE64&lt;&#x2F;code&gt; to store this value to memory will result in the array &lt;code&gt;[0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08]&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;push-64&quot;&gt;&lt;code&gt;PUSH*64&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;PUSH2_64&lt;&#x2F;code&gt; (0xc061) to &lt;code&gt;PUSH8_64&lt;&#x2F;code&gt; (0xc067) follows 2-byte to 8-byte literal. The literal is read little endian and pushed onto the stack.&lt;&#x2F;p&gt;
&lt;p&gt;The gas cost for them is &lt;code&gt;G_VERYLOW64&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;As an example, &lt;code&gt;0xc0 0x67 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08&lt;&#x2F;code&gt; will result in a stack with single value &lt;code&gt;0x00..00 0807060504030201&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;For detailed rationale discussion, please see the core EVM64 definition &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7937&#x2F;&quot;&gt;EIP-7937&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;To be added.&lt;&#x2F;p&gt;
&lt;!-- TODO --&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;To be added.&lt;&#x2F;p&gt;
&lt;!-- TODO --&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Tx Ordering via Block-level Randomness</title>
        <published>2025-05-24T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Aryaethn</name><uri>https://github.com/aryaethn</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7956/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/potential-eip-mev-decrease-by-deterministic-transaction-ordering-via-block-level-randomness/24084" />
        

        <id>https://wg-eips.ritovision.com/7956/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7956"
            label="EIP-7956" />
        

        
        

        
        <summary type="html">Decreasing MEV attacks by forcing a deterministic transaction ordering via block-level randomness.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7956/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Proposers and builders can currently permute pending transactions arbitrarily, enabling reorder‑driven MEV.  This EIP introduces a consensus rule that sorts all transactions inside a block by XOR‑ing each transaction hash with fresh slot randomness.  The randomness is unknown until the slot starts, so the order is deterministic once known but unpredictable beforehand.  The mechanism &lt;strong&gt;significantly reduces reorder‑based MEV&lt;&#x2F;strong&gt;; latency‑driven back‑running, censorship, and other classes of MEV remain and should be mitigated through complementary techniques (encrypted mempools, reputation, PBS marketplaces, etc.).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Unrestricted ordering is the key enabler of sandwich and classic front‑running attacks.  Deterministic ordering collapses these vectors to latency racing and information asymmetry.  Clear candidate‑set and bundle semantics preserve fee markets while removing the need for trusted sequencers.  Academic works shows deterministic ordering drives sandwich profits toward zero.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;references&quot;&gt;References&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Julia Ofoegbu, “Maximal Extractable Value (MEV): A Tale As Old As Time,” Medium (2024).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;J. Qian et al., “Deterministic Transaction Ordering Without Trusted Sequencers,” arXiv:2411.03327 v1 (2024).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;“Shutter Network Introduces Plan for First Encrypted Mempool on Ethereum,” GlobeNewswire, 13 Feb 2025.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;slot-randomness-r&quot;&gt;Slot Randomness &lt;code&gt;R&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;We define our randomness &lt;code&gt;R&lt;&#x2F;code&gt; as the &lt;code&gt;randao_reveal&lt;&#x2F;code&gt; of the each slot, after &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7998&#x2F;&quot;&gt;EIP-7998&lt;&#x2F;a&gt;, since this EIP provides slot-by-slot randomness for &lt;code&gt;randao_reveal&lt;&#x2F;code&gt; (only predictable for the builder). This provides enough randomness for our purpose of reducing MEV attacks by MEV bots.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;R = body.randao_reveal[0:32]     : bytes32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;builder-flow&quot;&gt;Builder Flow&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Candidate‑set selection&lt;&#x2F;strong&gt; – Builders &lt;strong&gt;MAY&lt;&#x2F;strong&gt; choose &lt;strong&gt;any subset&lt;&#x2F;strong&gt; of the mempool based on priority fees, side agreements, or policy.  Transactions not chosen are ignored.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Canonical sorting&lt;&#x2F;strong&gt; – Sort the chosen set by primary key &lt;code&gt;H(tx) ⊕ R&lt;&#x2F;code&gt; ascending, then secondary key &lt;code&gt;H(tx)&lt;&#x2F;code&gt; ascending, in case of collision on the primary key.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Gas‑limit packing&lt;&#x2F;strong&gt; – Append items in order until adding the next would exceed the block gas &lt;strong&gt;limit&lt;&#x2F;strong&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Bundles (optional cross‑address atomicity)&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Definition&lt;&#x2F;strong&gt; – A bundle is a user‑signed list of fully‑signed transactions.  Each &lt;code&gt;child_tx_rlp&lt;&#x2F;code&gt; is the canonical &lt;strong&gt;signed&lt;&#x2F;strong&gt; RLP encoding, including signature fields &lt;code&gt;(v, r, s)&lt;&#x2F;code&gt;.  The bundle begins with a &lt;em&gt;fee‑payment&lt;&#x2F;em&gt; transaction that covers gas and builder tip for the entire bundle.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Hashing &#x2F; sort key&lt;&#x2F;strong&gt; – Treat the bundle as a &lt;em&gt;virtual transaction&lt;&#x2F;em&gt; with key &lt;code&gt;H(concat(child_tx_rlps))&lt;&#x2F;code&gt;, where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;child_tx_rlps[i]&lt;&#x2F;code&gt; &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be the exact bytes that will later appear in the block body for that transaction, i.e. the &lt;em&gt;canonical RLP of the fully‑signed transaction&lt;&#x2F;em&gt; per &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP‑2718&lt;&#x2F;a&gt; &#x2F; &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP‑155&lt;&#x2F;a&gt; rules (for typed transactions the leading &lt;em&gt;type byte&lt;&#x2F;em&gt; and length prefix are included).&lt;&#x2F;li&gt;
&lt;li&gt;Implementations &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; strip or normalise the signature fields &lt;code&gt;(v,r,s)&lt;&#x2F;code&gt;; those 65 bytes are hashed as‑is so every participant derives an identical bundle key.&lt;&#x2F;li&gt;
&lt;li&gt;The concatenation order is the author‑declared execution order of the child transactions.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Gas accounting&lt;&#x2F;strong&gt; – Bundle gas is the &lt;strong&gt;sum of the &lt;code&gt;gasLimit&lt;&#x2F;code&gt; fields&lt;&#x2F;strong&gt; of all child transactions.  Builders use that sum when evaluating step 3.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Fit‑or‑skip rule&lt;&#x2F;strong&gt; – If the bundle (fee‑payment + children) would exceed the remaining gas limit, the bundle is skipped atomically.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;ol start=&quot;5&quot;&gt;
&lt;li&gt;&lt;strong&gt;Fee dynamics&lt;&#x2F;strong&gt; – Priority fees influence membership in the candidate set (step 1) but &lt;strong&gt;never&lt;&#x2F;strong&gt; override the canonical order once a tx or bundle is selected.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Here is a pseudocode for the above flow:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;---------------------------------------------------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; Inputs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;---------------------------------------------------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; mempool          : All pending txs &amp;amp; user-signed bundles visible to the builder&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; R                : 32-byte slot randomness supplied by randao_reveal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; BLOCK_GAS_LIMIT  : Max gas allowed in the block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;---------------------------------------------------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; Helper functions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;---------------------------------------------------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function HASH(obj)           → bytes32       &#x2F;&#x2F; Keccak-256 of the byte sequence&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function PRIMARY_KEY(h, R)   → bytes32       &#x2F;&#x2F; h XOR R (bit-wise)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function bundleGas(bundle):                      &#x2F;&#x2F; sum of gasLimit of children&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    total ← 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    for childTx in bundle.children:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        total ← total + childTx.gasLimit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return total&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;---------------------------------------------------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; 0. Candidate-set selection  (builder policy &#x2F; side deals &#x2F; fee filter)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;---------------------------------------------------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;candidates ← pickSubsetFrom(mempool)            &#x2F;&#x2F;  ANY subset is allowed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;---------------------------------------------------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; 1. Compute canonical keys &amp;amp; gas cost for every candidate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;---------------------------------------------------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;for item in candidates:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if item.type == &amp;quot;single_tx&amp;quot;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        item.gasCost  ← item.gasLimit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        baseHash      ← HASH(item.RLP)          &#x2F;&#x2F; canonical signed RLP (EIP-2718)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    else if item.type == &amp;quot;bundle&amp;quot;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        concatRlps    ← CONCAT(item.child_rlps) &#x2F;&#x2F; fee-tx + children in author order&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        item.gasCost  ← bundleGas(item)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        baseHash      ← HASH(concatRlps)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    item.primaryKey   ← PRIMARY_KEY(baseHash, R)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    item.secondaryKey ← baseHash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;---------------------------------------------------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; 2. Canonical sorting  (primaryKey asc, then secondaryKey asc)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;---------------------------------------------------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sort(candidates, by = (primaryKey ASC, secondaryKey ASC))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;---------------------------------------------------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; 3. Gas-limit packing with fit-or-skip for bundles&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;---------------------------------------------------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;blockList ← empty list&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gasUsed   ← 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;for item in candidates:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if gasUsed + item.gasCost &amp;gt; BLOCK_GAS_LIMIT:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        continue               &#x2F;&#x2F; skip whole tx or bundle atomically&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    append(blockList, item)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gasUsed ← gasUsed + item.gasCost&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;---------------------------------------------------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; 4. Output — assemble block body &amp;amp; header field&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;---------------------------------------------------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;block.randomness          ← R               &#x2F;&#x2F; bytes16 in the payload header&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;block.txOrderingVersion   ← 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;block.body                ← flatten(blockList)   &#x2F;&#x2F; bundles explode into children&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;return block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;consensus-rule&quot;&gt;Consensus Rule&lt;&#x2F;h3&gt;
&lt;p&gt;A block is &lt;strong&gt;invalid&lt;&#x2F;strong&gt; if the executed list deviates from the canonical order derived from its &lt;code&gt;randomness&lt;&#x2F;code&gt; and the included transactions&#x2F;bundles.  Verification is objective; fork‑choice remains unchanged.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;performance&quot;&gt;Performance&lt;&#x2F;h3&gt;
&lt;p&gt;Sorting ≤ 1 500 transactions remains &lt;code&gt;O(n log n)&lt;&#x2F;code&gt; (&amp;lt; 1 ms), on today&#x27;s hardware.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;deployment&quot;&gt;Deployment&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;added-parameters&quot;&gt;Added Parameters&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;randomness&lt;&#x2F;code&gt;: Specified in the specification.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;txOrderingVersion = 1&lt;&#x2F;code&gt; flag: To be compatible with the existing consensus rule and adding compatibility for future rules if needed.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;fork-parameters&quot;&gt;Fork Parameters&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ORDERING_FORK_EPOCH&lt;&#x2F;code&gt;: Beacon‑chain epoch at which execution clients start to recognise the new fields &lt;code&gt;randomness&lt;&#x2F;code&gt; and &lt;code&gt;txOrderingVersion&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ORDERING_TRANSITION_EPOCHS&lt;&#x2F;code&gt; window activate the rule: 64 epochs (~13.6 h). Length of the transition window during which blocks with either ordering version are accepted.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Both parameters are constants in the fork config and may be tuned during test‑net experiments.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;activation-flow&quot;&gt;Activation Flow&lt;&#x2F;h4&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Consensus‑layer upgrade —  Beacon‑chain fork at &lt;code&gt;ORDERING_FORK_EPOCH&lt;&#x2F;code&gt; activates &lt;strong&gt;&lt;code&gt;EL‑VRF‑exposure&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; (companion EIP) and begins populating the &lt;code&gt;vrf_output_proposer&lt;&#x2F;code&gt; field.  Execution clients receiving the &lt;code&gt;ExecutePayload&lt;&#x2F;code&gt; after this epoch expect a non‑zero &lt;code&gt;randomness&lt;&#x2F;code&gt; field.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Execution‑layer handshake —  Builders and proposers include the new &lt;code&gt;randomness&lt;&#x2F;code&gt; and &lt;code&gt;txOrderingVersion&lt;&#x2F;code&gt; fields in Engine API &lt;code&gt;engine_newPayloadV3&lt;&#x2F;code&gt; calls.  Legacy nodes that have not upgraded will reject the payload, causing a natural chain split and economic incentive to upgrade.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Transition window —  For &lt;code&gt;ORDERING_TRANSITION_EPOCHS&lt;&#x2F;code&gt; after &lt;code&gt;ORDERING_FORK_EPOCH&lt;&#x2F;code&gt;, clients accept:&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Version 0 blocks —  &lt;code&gt;txOrderingVersion&lt;&#x2F;code&gt; == 0; no randomness; legacy ordering.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Version 1 blocks —  &lt;code&gt;txOrderingVersion&lt;&#x2F;code&gt; == 1; valid randomness; canonical ordering enforced. During this period proposers are encouraged (but not forced) to adopt version 1 so that fee markets and MEV supply chains have time to adjust.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;ol start=&quot;4&quot;&gt;
&lt;li&gt;Finalisation —  At &lt;code&gt;ORDERING_FORK_EPOCH&lt;&#x2F;code&gt; + &lt;code&gt;ORDERING_TRANSITION_EPOCHS&lt;&#x2F;code&gt; the consensus rule changes: blocks MUST set &lt;code&gt;txOrderingVersion == 1&lt;&#x2F;code&gt; and pass canonical‑order validation.  A version‑0 block after this point is treated as invalid and will not be considered by fork‑choice.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-randomness-driven-ordering&quot;&gt;Why randomness‑driven ordering?&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Objective &amp;amp; Verifiable –  Using a function of on‑chain randomness (R) and a transaction’s own hash gives every validator an identical, cheap check on order validity.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Unpredictable Until Slot Start –  The XOR of slot‑level RANDAO and the proposer’s VRF output ensures that neither users nor builders can know the final sort key before the slot begins, closing the classic front‑run window.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Minimal Surface Area –  A single 16‑byte field in the execution payload plus a hash operation keeps consensus changes small and auditable.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;why-xor-as-the-mixing-function&quot;&gt;Why XOR as the mixing function?&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;XOR is associative, fast, and requires no extra cryptographic assumptions beyond SHA‑2 already used for H(tx).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Any bias in one entropy component (e.g., RANDAO) is negated unless the attacker also controls the VRF output.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;why-allow-builders-to-curate-the-candidate-set-first&quot;&gt;Why allow builders to curate the candidate set first?&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Preserves fee‑market incentives: high‑tip transactions still rise to the top of inclusion competition.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Avoids forced inclusion of low‑value spam that could bloat blocks if the entire mempool were blindly sorted.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;why-a-secondary-key-h-tx-for-tie-breaking&quot;&gt;Why a secondary key H(tx) for tie‑breaking?&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Guarantees total order with negligible extra cost.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Leverages a value already known to every node; no extra field is needed.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;why-optional-bundles-instead-of-implicit-nonce-chain-folding&quot;&gt;Why optional bundles instead of implicit nonce‑chain folding?&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Cross‑address atomicity (e.g., borrower + lender tx pair) cannot be expressed via nonce order alone.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Requiring an explicit fee‑payment transaction embeds pricing for the externality a bundle imposes on ordering neutrality.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;why-the-fit-or-skip-bundle-rule&quot;&gt;Why the &quot;fit‑or‑skip&quot; bundle rule?&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Ensures all clients compute the same gas impact, preventing divergent execution.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Avoids partial bundle execution, which would undermine user intent.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;why-the-version-flag-transition-window&quot;&gt;Why the version flag + transition window?&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Prevents accidental consensus splits by giving node operators a grace period.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Mirrors previous successful hard forks (e.g., London’s BASE_FEE activation sequence).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Old nodes&lt;&#x2F;strong&gt; —  Execution clients that ignore the new fields will treat version‑1 blocks as malformed and fork away.  The short transition window gives operators time to upgrade.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Light clients&lt;&#x2F;strong&gt; —  No additional work; they track headers chosen by upgraded full nodes.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;randomness-bias-randao-manipulation&quot;&gt;Randomness Bias &amp;amp; RANDAO Manipulation&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;Single‑validator bias&lt;&#x2F;em&gt; – A block proposer can not change its &lt;code&gt;randao_reveal&lt;&#x2F;code&gt; output after EIP-7998, only predictable to him.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;Coalition bias&lt;&#x2F;em&gt; – Multiple consecutive‑slot proposers could attempt to influence RANDAO by withholding signatures, but the protocol already slashes equivocation and missed attestations.  The cost rises exponentially with coalition size, and the added VRF entropy further randomizes &lt;code&gt;R&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;Forkable bias&lt;&#x2F;em&gt; – Re‑org attempts longer than depth 1 must overcome the usual consensus finality thresholds.  Because &lt;code&gt;R&lt;&#x2F;code&gt; is embedded in the execution payload, any fork conflicts are objectively detectable by all nodes.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Conclusion: Collusion attacks are economically unattractive; the mixed entropy from RANDAO and VRF provides strong unpredictability guarantees.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;hash-grinding&quot;&gt;Hash Grinding&lt;&#x2F;h3&gt;
&lt;p&gt;New signatures are required only when &lt;code&gt;calldata&lt;&#x2F;code&gt; changes, but attacks must begin &lt;strong&gt;after&lt;&#x2F;strong&gt; block is built.  Propagation delays and inclusion fees sharply limit profitable grinding to high‑value trades.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;tie-collisions&quot;&gt;Tie Collisions&lt;&#x2F;h3&gt;
&lt;p&gt;Secondary key &lt;code&gt;H(tx)&lt;&#x2F;code&gt; guarantees total order; collision probability (&lt;code&gt;2^{-256}&lt;&#x2F;code&gt;) is negligible.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;bundle-gas-consistency&quot;&gt;Bundle Gas Consistency&lt;&#x2F;h3&gt;
&lt;p&gt;Explicit summation rule ensures every client computes identical gas usage for bundles, preventing divergent validation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;residual-mev-vectors&quot;&gt;Residual MEV Vectors&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;Back‑running &amp;amp; latency&lt;&#x2F;em&gt; – Persist.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;Builder discretion&lt;&#x2F;em&gt; – Builders may censor or selectively include transactions while forming the candidate set; exactly like the current status of Ethereum.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Encode chain id with transaction hash</title>
        <published>2025-05-22T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Lauri Peltonen</name><uri>https://github.com/microbecode</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7950/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/a-new-standard-for-encoding-chain-id-transaction-hash/23782" />
        

        <id>https://wg-eips.ritovision.com/7950/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7950"
            label="ERC-7950" />
        

        
        

        
        <summary type="html">Encode a chain ID and transaction hash into a unique string format</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7950/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard proposes a way to encode the combination of a chain ID and a transaction hash into one string.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Looking up a transaction by its hash always requires the context of the chain - a transaction hash alone is not enough to identify the used chain. If the chain information is included in the string itself, finding the right chain for the transaction is easy.&lt;&#x2F;p&gt;
&lt;p&gt;Such strings can then be used, for example, in a forwarder service that forwards to the correct blockchain explorer.&lt;&#x2F;p&gt;
&lt;p&gt;The chain id is included in some object formats, such as the transaction object inside the blockchain itself, but that object has a lot of unneeded data for our purposes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The encoded string has three components:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A chain ID, denoted as &lt;code&gt;chainId&lt;&#x2F;code&gt;. The used chain id MUST be based on &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt; and the chain ID repository stated in that EIP.&lt;&#x2F;li&gt;
&lt;li&gt;A transaction hash, denoted as &lt;code&gt;txHash&lt;&#x2F;code&gt;. The hash MUST include the &lt;code&gt;0x&lt;&#x2F;code&gt; prefix.&lt;&#x2F;li&gt;
&lt;li&gt;A static string &lt;code&gt;tx&lt;&#x2F;code&gt;, acting as a type identifier.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The syntax is: &lt;code&gt;chainId:txHash:tx&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;An example for a transaction with hash &lt;code&gt;0xc55e2b90168af6972193c1f86fa4d7d7b31a29c156665d15b9cd48618b5177ef&lt;&#x2F;code&gt; that was issued on chain ID &lt;code&gt;1&lt;&#x2F;code&gt; is: &lt;code&gt;1:0xc55e2b90168af6972193c1f86fa4d7d7b31a29c156665d15b9cd48618b5177ef:tx&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;All of the characters are case-insensitive.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The chain ID is the most important detail when routing queries based on this standard and is therefore the first element in the string. The transaction hash is the second most important element.&lt;&#x2F;p&gt;
&lt;p&gt;The suffix &lt;code&gt;tx&lt;&#x2F;code&gt; is used to differentiate from, for example, addresses. Without the &lt;code&gt;tx&lt;&#x2F;code&gt; it would remain unclear whether an encoded string refers to an address, a transaction hash or something else.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP does not introduce direct security risks. It is up to the external service providers (such as wallet developers and blockchain explorers) to decide how and if they want to incorporate this EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Key Hash Based Tokens</title>
        <published>2025-05-16T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Alex Tian</name><uri>https://github.com/dugubuyan</uri>
	</author>
	
	<author>
		<name>Zhixiong Pan</name><uri>https://github.com/nake13</uri>
	</author>
	
	<author>
		<name>Geoffrey</name><uri>https://github.com/stbrahms</uri><email>geoffrey@datadance.ai</email>
	</author>
	
	<author>
		<name>liyingxuan</name><uri>https://github.com/LiYingxuan</uri><email>liyingxuan@datadance.ai</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7962/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/key-based-tokens/24422" />
        

        <id>https://wg-eips.ritovision.com/7962/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7962"
            label="ERC-7962" />
        

        
        

        
        <summary type="html">Extends privacy to ERC-721 and ERC-20 tokens.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7962/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes two token interfaces: &lt;strong&gt;ERC-KeyHash721&lt;&#x2F;strong&gt; for non-fungible tokens (NFTs) and &lt;strong&gt;ERC-KeyHash20&lt;&#x2F;strong&gt; for fungible tokens (similar to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;). Both of them utilize cryptographic key hashes (“keyHash”, or &lt;code&gt;keccak256(key)&lt;&#x2F;code&gt;) instead of Ethereum addresses to manage ownership. This enhances privacy by authorizing by the public key’s ECDSA signature (address derived from &lt;code&gt;keccak256(key[1:])&lt;&#x2F;code&gt;) and matching &lt;code&gt;keyHash = keccak256(key)&lt;&#x2F;code&gt;, without storing addresses on‑chain. Consequently, it empowers users to conduct transactions using any address they choose. By separating ownership from transaction initiation, these standards allow gas fees to be paid by third parties without relinquishing token control, making them suitable for batch transactions and gas sponsorship. Security is ensured by implementing robust ECDSA signature verification on key functions (&lt;code&gt;transfer&lt;&#x2F;code&gt;) to prevent message tampering.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Traditional &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens bind ownership to Ethereum addresses, which are publicly visible and may be linked to identities, compromising privacy. The key hash-based ownership model allows owners to prove control without exposing addresses, ideal for anonymous collectibles, private transactions, or decentralized identity use cases. Additionally, separating ownership from gas fee payment enables third-party gas sponsorship, improving user experience in high-gas or batch transaction scenarios. This proposal aligns with the privacy principles of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5564&#x2F;&quot;&gt;ERC-5564&lt;&#x2F;a&gt; (Stealth Addresses) and extends them to token ownership.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;overview&quot;&gt;Overview&lt;&#x2F;h3&gt;
&lt;p&gt;This proposal defines two token interfaces:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;IERCKeyHash721&lt;&#x2F;code&gt;: For non-fungible tokens (NFTs), each identified by a unique &lt;code&gt;tokenId&lt;&#x2F;code&gt;, with ownership managed via &lt;code&gt;keyHash&lt;&#x2F;code&gt; (&lt;code&gt;keccak256(key)&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;IERCKeyHash20&lt;&#x2F;code&gt;: For fungible tokens, with balances associated with &lt;code&gt;keyHash&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Token operations (&lt;code&gt;transfer&lt;&#x2F;code&gt;) require the owner&#x27;s key(an uncompressed secp256k1 public key) and an ECDSA signature produced by the private key corresponding to the key (i.e., the address derived from &lt;code&gt;keccak256(key[1:])&lt;&#x2F;code&gt; excluding the 0x04 prefix) to prove ownership, ensuring only legitimate owners can execute actions. Signatures follow &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; structured data hashing to prevent message tampering, with per-keyHash nonces and deadlines to prevent replay attacks.&lt;&#x2F;p&gt;
&lt;p&gt;Implementers MAY optionally add administrative functions such as &lt;code&gt;mint&lt;&#x2F;code&gt; (create new tokens) and &lt;code&gt;destroy&lt;&#x2F;code&gt; (remove tokens) based on application requirements. These functions are not part of the core interface of this ERC; if provided, they SHOULD enforce strict access control, correct supply accounting, and preserve the key‑hash privacy model without exposing addresses.&lt;&#x2F;p&gt;
&lt;p&gt;Notably, the approve function is intentionally omitted. The key is designed for one-time use and is revealed only during token transfer transactions. Once revealed, holdings are typically migrated to fresh keyHashes; implementations MAY disallow reuse of previously revealed keyHash. Since transactions can be submitted by any address, the signature must be generated by the address derived from the key. This binds authorization to the key while allowing any relayer address to submit and pay gas.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;erc-keyhash721-non-fungible-token-interface&quot;&gt;ERC-KeyHash721: Non-Fungible Token Interface&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;interface&quot;&gt;Interface&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERCKeyHash721&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Events&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; KeyHashTransfer721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; fromKeyHash&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; toKeyHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; KeyHashBurn721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ownerKeyHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; View functions (aligned with ERC-721)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; symbol&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; State-changing functions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; keyHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; toKeyHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; deadline&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; destroy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; deadline&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;function-descriptions&quot;&gt;Function Descriptions&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;transfer&quot;&gt;&lt;code&gt;transfer&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt; toKeyHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt; deadline&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Description&lt;&#x2F;strong&gt;: Transfers the specified token from the current owner&#x27;s &lt;code&gt;keyHash&lt;&#x2F;code&gt; to &lt;code&gt;toKeyHash&lt;&#x2F;code&gt;. The caller provides the owner&#x27;s key to prove ownership. The signature is verified using &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; structured data.&lt;br &#x2F;&gt;
&lt;strong&gt;Parameters&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;tokenId&lt;&#x2F;code&gt;: &lt;code&gt;uint256&lt;&#x2F;code&gt; - The token ID to transfer.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;toKeyHash&lt;&#x2F;code&gt;: &lt;code&gt;bytes32&lt;&#x2F;code&gt; - The new owner&#x27;s key hash.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;key&lt;&#x2F;code&gt;: &lt;code&gt;bytes&lt;&#x2F;code&gt; - MUST be a 65-byte uncompressed secp256k1 public key with prefix 0x04.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;signature&lt;&#x2F;code&gt;: &lt;code&gt;bytes&lt;&#x2F;code&gt; -  ECDSA signature produced by the private key corresponding to the key, verifying ownership and preventing malicious relay attacks.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;deadline&lt;&#x2F;code&gt;: &lt;code&gt;uint256&lt;&#x2F;code&gt; - Signature expiration timestamp (Unix seconds).&lt;br &#x2F;&gt;
&lt;strong&gt;Signature Message&lt;&#x2F;strong&gt;: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; structured data:&lt;br &#x2F;&gt;
&lt;code&gt;solidity     struct Transfer {         uint256 tokenId;         bytes32 toKeyHash;         uint256 nonce;         uint256 deadline;     }     &lt;&#x2F;code&gt;&lt;br &#x2F;&gt;
&lt;strong&gt;Events&lt;&#x2F;strong&gt;: Emits &lt;code&gt;KeyHashTransfer721(tokenId, fromKeyHash, toKeyHash)&lt;&#x2F;code&gt;.&lt;br &#x2F;&gt;
&lt;strong&gt;Requirements&lt;&#x2F;strong&gt;:&lt;&#x2F;li&gt;
&lt;li&gt;Token MUST exist (non-zero &lt;code&gt;fromKeyHash&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;keccak256(key)&lt;&#x2F;code&gt; MUST equal the current &lt;code&gt;fromKeyHash&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Signature MUST be valid.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;block.timestamp&lt;&#x2F;code&gt; MUST be &amp;lt;= &lt;code&gt;deadline&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;toKeyHash&lt;&#x2F;code&gt; MUST NOT be zero.&lt;&#x2F;li&gt;
&lt;li&gt;Updates ownership to &lt;code&gt;toKeyHash&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Other Functions&lt;&#x2F;strong&gt;: &lt;code&gt;name&lt;&#x2F;code&gt;, &lt;code&gt;symbol&lt;&#x2F;code&gt;, &lt;code&gt;tokenURI&lt;&#x2F;code&gt;, and &lt;code&gt;totalSupply&lt;&#x2F;code&gt; align with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; . &lt;code&gt;ownerOf&lt;&#x2F;code&gt; returns &lt;code&gt;bytes32&lt;&#x2F;code&gt; (keyHash) instead of an address.&lt;code&gt;tokenURI&lt;&#x2F;code&gt; is part of the core interface and MAY return an empty string if metadata is not provided.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;key-concepts&quot;&gt;Key Concepts&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Key (&lt;code&gt;key&lt;&#x2F;code&gt;)&lt;&#x2F;strong&gt;: An uncompressed secp256k1 public key (65 bytes, starting with 0x04), used to prove ownership. Implementations MUST validate the key format:&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;key&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 65&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x04&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;BAD_KEY_FMT&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Key Hash (&lt;code&gt;keyHash&lt;&#x2F;code&gt;)&lt;&#x2F;strong&gt;: A &lt;code&gt;bytes32&lt;&#x2F;code&gt; value representing &lt;code&gt;keccak256(key)&lt;&#x2F;code&gt;, identifying ownership without exposing addresses.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Token Existence&lt;&#x2F;strong&gt;: A token exists if its &lt;code&gt;keyHash&lt;&#x2F;code&gt; is non-zero.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Nonce&lt;&#x2F;strong&gt;: Nonces are tracked per keyHash and per contract. Each ERC-KeyHash contract maintains its ownmapping(bytes32 =&amp;gt;uint256)keyNonces. Cross-contract replay is already prevented by the EIP-712 domain (verifyingContract, chainId). Signers MUST serialize operations for the same keyHashwithin the same contract.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;erc-keyhash20-fungible-token-interface&quot;&gt;ERC-KeyHash20: Fungible Token Interface&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;interface-1&quot;&gt;Interface&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERCKeyHash20&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Events&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; KeyHashTransfer20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; fromKeyHash&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; toKeyHash&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; View functions (aligned with ERC-20)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; symbol&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; decimals&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; keyHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; State-changing functions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; keyHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; fromKeyHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; toKeyHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; deadline&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; leftKeyHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;function-descriptions-1&quot;&gt;Function Descriptions&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;transfer-1&quot;&gt;&lt;code&gt;transfer&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt; fromKeyHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt; toKeyHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt; deadline&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt; leftKeyHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Description&lt;&#x2F;strong&gt;: Transfers &lt;code&gt;amount&lt;&#x2F;code&gt; tokens from &lt;code&gt;fromKeyHash&lt;&#x2F;code&gt; to &lt;code&gt;toKeyHash&lt;&#x2F;code&gt;, with remaining balance assigned to &lt;code&gt;leftKeyHash&lt;&#x2F;code&gt; (controlled by the sender). The caller provides the owner&#x27;s key to prove ownership. The signature is verified using &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; structured data. Mimics Bitcoin&#x27;s UTXO model for partial transfers.&lt;br &#x2F;&gt;
&lt;strong&gt;Parameters&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;fromKeyHash&lt;&#x2F;code&gt;: &lt;code&gt;bytes32&lt;&#x2F;code&gt; - Token owner&#x27;s key hash.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;toKeyHash&lt;&#x2F;code&gt;: &lt;code&gt;bytes32&lt;&#x2F;code&gt; - Recipient&#x27;s key hash.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;amount&lt;&#x2F;code&gt;: &lt;code&gt;uint256&lt;&#x2F;code&gt; - Amount to transfer.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;key&lt;&#x2F;code&gt;: &lt;code&gt;bytes&lt;&#x2F;code&gt; - MUST be a 65-byte uncompressed secp256k1 public key with prefix 0x04.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;signature&lt;&#x2F;code&gt;: &lt;code&gt;bytes&lt;&#x2F;code&gt; - ECDSA signature.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;deadline&lt;&#x2F;code&gt;: &lt;code&gt;uint256&lt;&#x2F;code&gt; - Signature expiration timestamp.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;leftKeyHash&lt;&#x2F;code&gt;: &lt;code&gt;bytes32&lt;&#x2F;code&gt; - Key hash for remaining balance (&lt;code&gt;balance - amount&lt;&#x2F;code&gt;). MUST NOT equal &lt;code&gt;toKeyHash&lt;&#x2F;code&gt; or &lt;code&gt;fromKeyHash&lt;&#x2F;code&gt; (strict mode to enforce key rotation and unlinkability).&lt;br &#x2F;&gt;
&lt;strong&gt;Signature Message&lt;&#x2F;strong&gt;: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; structured data:&lt;br &#x2F;&gt;
&lt;code&gt;solidity     struct Transfer {         bytes32 fromKeyHash;         bytes32 toKeyHash;         uint256 amount;         uint256 nonce;         uint256 deadline;         bytes32 leftKeyHash;     }     &lt;&#x2F;code&gt;&lt;br &#x2F;&gt;
&lt;strong&gt;Events&lt;&#x2F;strong&gt;: Emits &lt;code&gt;KeyHashTransfer20(fromKeyHash, toKeyHash, amount)&lt;&#x2F;code&gt;.&lt;br &#x2F;&gt;
&lt;strong&gt;Requirements&lt;&#x2F;strong&gt;:&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;fromKeyHash&lt;&#x2F;code&gt; MUST have sufficient balance (&lt;code&gt;balanceOf[fromKeyHash] &amp;gt;= amount&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;keccak256(key)&lt;&#x2F;code&gt; MUST equal &lt;code&gt;fromKeyHash&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Signature MUST be valid.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;block.timestamp&lt;&#x2F;code&gt; MUST be &amp;lt;= &lt;code&gt;deadline&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;toKeyHash&lt;&#x2F;code&gt; and &lt;code&gt;leftKeyHash&lt;&#x2F;code&gt; MUST NOT be zero.&lt;&#x2F;li&gt;
&lt;li&gt;Updates balances: &lt;code&gt;balanceOf[fromKeyHash] = 0&lt;&#x2F;code&gt;, &lt;code&gt;balanceOf[toKeyHash] += amount&lt;&#x2F;code&gt;, &lt;code&gt;balanceOf[leftKeyHash] += (original balance - amount)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Other Functions&lt;&#x2F;strong&gt;: &lt;code&gt;name&lt;&#x2F;code&gt;, &lt;code&gt;symbol&lt;&#x2F;code&gt;, &lt;code&gt;decimals&lt;&#x2F;code&gt;, and &lt;code&gt;totalSupply&lt;&#x2F;code&gt; align with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;. &lt;code&gt;balanceOf&lt;&#x2F;code&gt; uses &lt;code&gt;bytes32&lt;&#x2F;code&gt; parameter.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;signature-verification&quot;&gt;Signature Verification&lt;&#x2F;h3&gt;
&lt;p&gt;For &lt;code&gt;transfer&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Verify &lt;code&gt;keccak256(key) == current keyHash&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Compute &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; message hash:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt; digest &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;\x19\x01&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    DOMAIN_SEPARATOR&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        TYPE_HASH&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Struct-specific type hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        params &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Struct fields (e.g., tokenId, toKeyHash, nonce, deadline)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Recover signer address using &lt;code&gt;ecrecover(digest, signature)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;REQUIRE signer == address(uint160(uint256(keccak256(key[1:])))), where key is a 65‑byte uncompressed secp256k1 public key (0x04 || X || Y) and key[1:] denotes the 64‑byte XY payload (prefix removed)&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;On successful verification, increment _keyNonces[currentOwnerKeyHash] (i.e., _keyNonces[ownerKeyHash] for ERC‑KeyHash721 and _keyNonces[fromKeyHash] for ERC‑KeyHash20) to prevent replay.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Verify &lt;code&gt;block.timestamp &amp;lt;= deadline&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;requirements&quot;&gt;Requirements&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Contracts MUST maintain mappings:
&lt;ul&gt;
&lt;li&gt;ERC-KeyHash721: &lt;code&gt;tokenId&lt;&#x2F;code&gt; to &lt;code&gt;keyHash&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;ERC-KeyHash20: &lt;code&gt;keyHash&lt;&#x2F;code&gt; to balance.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;MUST use per-keyHash nonces (&lt;code&gt;mapping(bytes32 =&amp;gt; uint256) _keyNonces&lt;&#x2F;code&gt;) for replay protection.&lt;&#x2F;li&gt;
&lt;li&gt;MUST implement &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; for signature hashing.&lt;&#x2F;li&gt;
&lt;li&gt;MUST enforce &lt;code&gt;deadline&lt;&#x2F;code&gt; to limit signature validity.&lt;&#x2F;li&gt;
&lt;li&gt;MUST verify signatures and hash keys in &lt;code&gt;transfer&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;For ERC-KeyHash20, MUST enforce strict mode for &lt;code&gt;leftKeyHash&lt;&#x2F;code&gt; by requiring it to be different from both &lt;code&gt;toKeyHash&lt;&#x2F;code&gt; and &lt;code&gt;fromKeyHash&lt;&#x2F;code&gt;. This prevents change consolidation with the recipient or original account, promoting key rotation and unlinkability.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;advantages-of-key-hash&quot;&gt;Advantages of Key Hash&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Privacy&lt;&#x2F;strong&gt;: &lt;code&gt;ownerOf&lt;&#x2F;code&gt; and &lt;code&gt;balanceOf&lt;&#x2F;code&gt; return &lt;code&gt;keyHash&lt;&#x2F;code&gt;, not addresses. Users can use unique key pairs per token or balance, reducing linkability.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Gas Fee Separation&lt;&#x2F;strong&gt;: Anyone can call &lt;code&gt;transfer&lt;&#x2F;code&gt; with a valid signature, paying gas fees, enabling batch transactions or gas sponsorship.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Flexibility&lt;&#x2F;strong&gt;: Aligns with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5564&#x2F;&quot;&gt;ERC-5564&lt;&#x2F;a&gt; stealth addresses, extending privacy to tokens.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;transfer-design&quot;&gt;Transfer Design&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Open to any caller with valid signatures, ensuring only owners operate while allowing gas sponsorship.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; signatures prevent message tampering by including all critical parameters.&lt;&#x2F;li&gt;
&lt;li&gt;Per-keyHash nonces and deadlines prevent replay attacks.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal is not compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;  or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; due to &lt;code&gt;bytes32&lt;&#x2F;code&gt; key hashes instead of addresses. Adapters can bridge to existing systems for privacy-focused use cases.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;erc-keyhash721-implementation&quot;&gt;ERC-KeyHash721 Implementation&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;utils&#x2F;cryptography&#x2F;ECDSA.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;utils&#x2F;cryptography&#x2F;EIP712.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; KeyHashERC721&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EIP712&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    using&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ECDSA&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; symbol&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _tokenKeyHashes&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _destroyedTokens&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; totalSupply&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _keyNonces&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; KeyHashTransfer721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; fromKeyHash&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; toKeyHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; KeyHashBurn721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ownerKeyHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; TRANSFER_TYPEHASH &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        &amp;quot;Transfer(uint256 tokenId,bytes32 toKeyHash,uint256 nonce,uint256 deadline)&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; DESTROY_TYPEHASH &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        &amp;quot;Destroy(uint256 tokenId,uint256 nonce,uint256 deadline)&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _symbol&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        EIP712&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;&amp;quot;KeyHashERC721&amp;quot;, &amp;quot;1&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        name &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _name&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        symbol &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _symbol&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_tokenKeyHashes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !&lt;&#x2F;span&gt;&lt;span&gt;_destroyedTokens&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Token does not exist&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _tokenKeyHashes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; toKeyHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; deadline&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;toKeyHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Invalid recipient hash&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_tokenKeyHashes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !&lt;&#x2F;span&gt;&lt;span&gt;_destroyedTokens&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Token does not exist&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; deadline&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Signature expired&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;key&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 65&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x04&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;BAD_KEY_FMT&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; currentKeyHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _tokenKeyHashes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; currentKeyHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;BAD_KEYHASH&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; nonce &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _keyNonces&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;currentKeyHash&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; structHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            TRANSFER_TYPEHASH&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            toKeyHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            deadline&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; digest &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _hashTypedDataV4&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;structHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; signer &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; digest&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;recover&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; expectedAddress &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _addressFromUncompressedKey&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signer &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; expectedAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Invalid signature&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _keyNonces&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;currentKeyHash&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; nonce &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 验签通过后再自增&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _tokenKeyHashes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; toKeyHash&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; KeyHashTransfer721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; currentKeyHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; toKeyHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getNonce&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; keyHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _keyNonces&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;keyHash&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _addressFromUncompressedKey&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; key: 65 bytes, [0] = 0x04, [1..32] = X, [33..64] = Y &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;key&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 65&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x04&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;BAD_KEY_FMT&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; y&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            x &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x21&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; key[1..32] &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            y &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x41&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; key[33..64] &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; h &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;x&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; y&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 64-byte XY &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint160&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;h&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;erc-keyhash20-implementation&quot;&gt;ERC-KeyHash20 Implementation&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;utils&#x2F;cryptography&#x2F;ECDSA.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;utils&#x2F;cryptography&#x2F;EIP712.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; KeyHashERC20&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EIP712&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    using&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ECDSA&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; symbol&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; decimals&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; totalSupply&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _keyNonces&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; KeyHashTransfer20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; fromKeyHash&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; toKeyHash&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; TRANSFER_TYPEHASH &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        &amp;quot;Transfer(bytes32 fromKeyHash,bytes32 toKeyHash,uint256 amount,uint256 nonce,uint256 deadline,bytes32 leftKeyHash)&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _symbol&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        EIP712&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;&amp;quot;KeyHashERC20&amp;quot;, &amp;quot;1&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        name &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _name&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        symbol &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _symbol&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        decimals &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 18&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; fromKeyHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; toKeyHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; deadline&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; leftKeyHash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;balanceOf&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;fromKeyHash&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Insufficient balance&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;toKeyHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Invalid recipient hash&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;leftKeyHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Invalid leftKeyHash&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;leftKeyHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span&gt; toKeyHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;LEFT_EQ_TO&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;leftKeyHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span&gt; fromKeyHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;LEFT_EQ_FROM&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; deadline&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Signature expired&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;key&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 65&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x04&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;BAD_KEY_FMT&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; fromKeyHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;BAD_KEYHASH&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; nonce &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _keyNonces&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;fromKeyHash&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; structHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            TRANSFER_TYPEHASH&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            fromKeyHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            toKeyHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            deadline&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            leftKeyHash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; digest &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _hashTypedDataV4&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;structHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; signer &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; digest&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;recover&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; expectedAddress &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _addressFromUncompressedKey&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signer &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; expectedAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Invalid signature&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _keyNonces&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;fromKeyHash&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; nonce &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 验签通过后再自增&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; remaining &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;fromKeyHash&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        balanceOf&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;fromKeyHash&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        balanceOf&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;toKeyHash&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        balanceOf&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;leftKeyHash&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; remaining&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; KeyHashTransfer20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;fromKeyHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; toKeyHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getNonce&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; keyHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _keyNonces&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;keyHash&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _addressFromUncompressedKey&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; key: 65 bytes, [0] = 0x04, [1..32] = X, [33..64] = Y &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;key&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 65&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x04&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;BAD_KEY_FMT&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; y&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            x &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x21&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; key[1..32] &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            y &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x41&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; key[33..64] &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; h &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;x&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; y&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 64-byte XY &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint160&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;h&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Replay Attacks&lt;&#x2F;strong&gt;:
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Mitigation&lt;&#x2F;strong&gt;: Per-keyHash nonces (&lt;code&gt;_keyNonces[keyHash]&lt;&#x2F;code&gt;) increment after each operation, invalidating old signatures.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Design&lt;&#x2F;strong&gt;: Similar to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2612&#x2F;&quot;&gt;EIP-2612&lt;&#x2F;a&gt; permit mechanism, ensuring owner-controlled nonce sequences.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Message Tampering&lt;&#x2F;strong&gt;:
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Mitigation&lt;&#x2F;strong&gt;: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; structured signatures include all critical parameters (&lt;code&gt;tokenId&lt;&#x2F;code&gt;, &lt;code&gt;toKeyHash&lt;&#x2F;code&gt;, &lt;code&gt;amount&lt;&#x2F;code&gt;, &lt;code&gt;leftKeyHash&lt;&#x2F;code&gt;, etc.), preventing relayer tampering. Signatures are function-specific (&lt;code&gt;TRANSFER_TYPEHASH&lt;&#x2F;code&gt;, &lt;code&gt;DESTROY_TYPEHASH&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Audit&lt;&#x2F;strong&gt;: Contracts MUST be audited to ensure no parameter omissions or hash collisions.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Signature Expiration&lt;&#x2F;strong&gt;:
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Mitigation&lt;&#x2F;strong&gt;: &lt;code&gt;deadline&lt;&#x2F;code&gt; parameter ensures signatures expire, reducing risks of leaked signatures.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Privacy Limitations&lt;&#x2F;strong&gt;:
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Issue&lt;&#x2F;strong&gt;: Public keys (key) are revealed in calldata; the corresponding Ethereum addresses can be derived off‑chain from keccak256(key[1:]). Use fresh keys (toKeyHash &#x2F; leftKeyHash) to reduce linkability.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Recommendation&lt;&#x2F;strong&gt;: Use new key pairs per token or balance to minimize linkability. Store &lt;code&gt;hashKey&lt;&#x2F;code&gt; securely, as it is sensitive.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Key Management&lt;&#x2F;strong&gt;:
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Risk&lt;&#x2F;strong&gt;: Loss or compromise of the private key corresponding to &lt;code&gt;key&lt;&#x2F;code&gt; results in loss of control. Store private keys securely.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Recommendation&lt;&#x2F;strong&gt;: Use safe systems to save &lt;code&gt;key&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Gas Costs&lt;&#x2F;strong&gt;:
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Issue&lt;&#x2F;strong&gt;: Signature verification and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; hashing increase gas costs.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Recommendation&lt;&#x2F;strong&gt;: Optimize implementations and consider gas sponsorship to offset costs.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Signature Malleability&lt;&#x2F;strong&gt;: Implementations MUST reject malleable signatures (low‑S, v ∈ {27, 28}). OpenZeppelin’s ECDSA helpers enforce these checks by default.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Permissionless CREATE2 Factory</title>
        <published>2025-05-15T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Nicholas Rodrigues Lordello</name><uri>https://github.com/nlordell</uri>
	</author>
	
	<author>
		<name>Richard Meissner</name><uri>https://github.com/rmeissner</uri>
	</author>
	
	<author>
		<name>Valentin Seehausen</name><uri>https://github.com/vseehausen</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7955/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/multi-chain-deployment-process-for-a-permissionless-contract-factory/24318" />
        

        <id>https://wg-eips.ritovision.com/7955/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:7955"
            label="ERC-7955" />
        

        
        

        
        <summary type="html">A permissionless method and parameters for deploying a CREATE2 factory across EVM chains to a deterministic address using EIP-7702.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7955/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC defines a permissionless and deterministic deployment mechanism across all EVM-compatible chains. It uses the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; &lt;code&gt;Set Code for EOAs (0x4)&lt;&#x2F;code&gt; transaction type to deploy a universal CREATE2 factory contract to a fixed address (&lt;code&gt;0xC0DEb853af168215879d284cc8B4d0A645fA9b0E&lt;&#x2F;code&gt;) with known bytecode. The factory can then create any new contract to a deterministic address using the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1014&#x2F;&quot;&gt;EIP-1014&lt;&#x2F;a&gt; &lt;code&gt;CREATE2 (0xf5)&lt;&#x2F;code&gt; opcode. It does not require preinstalls, secret keys, or chain-specific infrastructure.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Ensuring that contracts share the same address and code on multiple chains is a hard problem. It is typically done by having a known CREATE2 factory contract at a specific address that can further deterministically deploy new contracts using the &lt;code&gt;CREATE2 (0xf5)&lt;&#x2F;code&gt; opcode.&lt;&#x2F;p&gt;
&lt;p&gt;However, there is a bootstrapping problem: how do you get a CREATE2 factory contract with a specific address and code?&lt;&#x2F;p&gt;
&lt;h3 id=&quot;existing-solutions&quot;&gt;Existing Solutions&lt;&#x2F;h3&gt;
&lt;p&gt;There are currently three main approaches to this problem:&lt;&#x2F;p&gt;
&lt;h4 id=&quot;1-nick-s-method&quot;&gt;1. Nick&#x27;s Method&lt;&#x2F;h4&gt;
&lt;p&gt;Use Nick&#x27;s method to randomly generate a signature for a transaction &lt;strong&gt;without&lt;&#x2F;strong&gt; &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt; replay protection that deploys the CREATE2 factory. Nick&#x27;s method ensures that there is no known private key for the account that deploys the CREATE2 factory, meaning that the resulting contract will have a deterministic address and code on all chains. This strategy is used by the &lt;em&gt;Deterministic Deployment Proxy&lt;&#x2F;em&gt; (deployed to &lt;code&gt;0x4e59b44847b379578588920ca78fbf26c0b4956c&lt;&#x2F;code&gt;, including on Ethereum Mainnet), one of the most widely used CREATE2 factory contracts.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Downsides&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;It does not work on chains that only accept EIP-155 replay-protected transactions.&lt;&#x2F;li&gt;
&lt;li&gt;It is sensitive to changes in gas parameters on the target chain since the gas price and limit in the deployment transaction is sealed, and a new one cannot be signed without a private key.&lt;&#x2F;li&gt;
&lt;li&gt;Reverts, such as those caused by alternative gas schedules, make the CREATE2 factory no longer deployable.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;2-secret-private-key&quot;&gt;2. Secret Private Key&lt;&#x2F;h4&gt;
&lt;p&gt;Keep a carefully guarded secret key and use it to sign transactions to deploy CREATE2 factory contracts. The resulting contract will have a deterministic address and code on all chains where the transaction at a given nonce of the deployer account is a CREATE2 factory deployment, which can be verified post-deployment to ensure trustlessness. Additionally, this method does not have the same gas sensitivity downsides as Nick&#x27;s method, as the private key can sign a creation transaction with appropriate gas parameters at the time of execution. This is the strategy used by the &lt;em&gt;Safe Singleton Factory&lt;&#x2F;em&gt; and &lt;em&gt;CreateX&lt;&#x2F;em&gt; (deployed to &lt;code&gt;0x914d7Fec6aaC8cd542e72Bca78B30650d45643d7&lt;&#x2F;code&gt; and &lt;code&gt;0xba5Ed099633D3B313e4D5F7bdc1305d3c28ba5Ed&lt;&#x2F;code&gt; respectively, including on Ethereum Mainnet).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Downsides&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;It is permissioned: the party that holds the secret key has the ultimate say on which chains will get the CREATE2 factory deployments.&lt;&#x2F;li&gt;
&lt;li&gt;This requires carefully guarding a secret key; if it is exposed or lost, deployments are no longer guaranteed on new chains.&lt;&#x2F;li&gt;
&lt;li&gt;If the transaction at the given nonce is not a successful CREATE2 factory deployment, then it is no longer possible to have a CREATE2 factory at the canonical address; this can happen by human error, for example.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;3-preinstalls&quot;&gt;3. Preinstalls&lt;&#x2F;h4&gt;
&lt;p&gt;Have popular CREATE2 deployment factories deployed on new chains by default. This is, for example, what OP Stack and ZKsync do as part of their preinstalls, including the CREATE2 factory contracts mentioned above. This ensures that the CREATE2 factory contracts have known addresses and codes.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Downsides&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;It is not standardized nor adopted by all chains.&lt;&#x2F;li&gt;
&lt;li&gt;It is permissioned as a chain can choose not to include a specific CREATE2 factory contract preinstalled.&lt;&#x2F;li&gt;
&lt;li&gt;Attempts to standardize this with RIP-7740 have not been successful.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;proposal-using-eip-7702-type-0x4-transactions&quot;&gt;Proposal: Using EIP-7702 Type &lt;code&gt;0x4&lt;&#x2F;code&gt; Transactions&lt;&#x2F;h3&gt;
&lt;p&gt;This ERC proposes a permissionless alternative fourth mechanism to the existing ones described above with none of their downsides. Additionally, it standardizes a set of deployment parameters for a &lt;strong&gt;universal&lt;&#x2F;strong&gt; CREATE2 factory deployment. This ensures a common CREATE2 factory for the community instead of multiple competing copies with slightly different codes at different addresses. This single CREATE2 factory copy can bootstrap additional deterministic deployment infrastructure (such as the comprehensive CreateX universal contract deployer).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Benefits&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Universally applicable: It can be executed on any chain by any user and guarantees a reliable determination of smart contract deployments on any chain.&lt;&#x2F;li&gt;
&lt;li&gt;Fault resistant: The method is secure against &quot;out of gas&quot; and other errors.&lt;&#x2F;li&gt;
&lt;li&gt;Permissionless: The universal CREATE2 factory contract can be deployed by anyone.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;DEPLOYER_PRIVATE_KEY&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x942ba639ec667bdded6d727ad2e483648a34b584f916e6b826fdb7b512633731&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CREATE2_FACTORY_INIT_CODE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x7c60203d3d3582360380843d373d34f5806019573d813d933efd5b3d52f33d52601d6003f3&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CREATE2_FACTORY_SALT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x000000000000000000000000000000000000000000000000000000000001bec5&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;derived-parameters&quot;&gt;Derived Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Derived Parameter&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;DEPLOYER_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x962560A0333190D57009A0aAAB7Bfa088f58461C&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CREATE2_FACTORY_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xC0DEb853af168215879d284cc8B4d0A645fA9b0E&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CREATE2_FACTORY_RUNTIME_CODE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x60203d3d3582360380843d373d34f5806019573d813d933efd5b3d52f3&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CREATE2_FACTORY_CODE_HASH&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x2ad75e1e9642e6fce7d293d52fa5a8f62a79a2079abb7402256add02d6e8bc30&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Deployer&lt;&#x2F;strong&gt;: The account corresponding to &lt;code&gt;DEPLOYER_PRIVATE_KEY&lt;&#x2F;code&gt; with address &lt;code&gt;DEPLOYER_ADDRESS&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;CREATE2 factory contract&lt;&#x2F;strong&gt;: A contract that deploys other contracts with &lt;code&gt;CREATE2 (0xf5)&lt;&#x2F;code&gt; opcode, allowing smart contracts to be deployed to deterministic addresses.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Bootstrap contract&lt;&#x2F;strong&gt;: The contract that the &lt;em&gt;deployer&lt;&#x2F;em&gt; delegates to in order to deploy the &lt;em&gt;CREATE2 factory contract&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Bootstrapping code&lt;&#x2F;strong&gt;: The critical code in the &lt;em&gt;bootstrap contract&lt;&#x2F;em&gt; that performs the &lt;code&gt;CREATE2 (0xf5)&lt;&#x2F;code&gt; deployment of the &lt;em&gt;CREATE2 factory contract&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;bootstrap-contract&quot;&gt;Bootstrap Contract&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;em&gt;bootstrap contract&lt;&#x2F;em&gt; MUST execute the following or equivalent &lt;em&gt;bootstrapping code&lt;&#x2F;em&gt; as an EIP-7702 delegation target for the &lt;em&gt;deployer&lt;&#x2F;em&gt; account:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; initCode &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; CREATE2_FACTORY_INIT_CODE&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt; salt &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; CREATE2_FACTORY_SALT&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;assembly&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;memory-safe&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    create2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;initCode&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;initCode&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; salt&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;em&gt;bootstrap contract&lt;&#x2F;em&gt; MAY implement additional features such as:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Abort early if either &lt;em&gt;CREATE2 factory contract&lt;&#x2F;em&gt; is already deployed or the &lt;em&gt;deployer&lt;&#x2F;em&gt; is not correctly delegated to.
&lt;ul&gt;
&lt;li&gt;This can help mitigate gas griefing from the front-running issue described below.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Additional verification that the deployment succeeded as expected.&lt;&#x2F;li&gt;
&lt;li&gt;Emit events to facilitate tracking of either the &lt;em&gt;bootstrap contract&lt;&#x2F;em&gt; or &lt;em&gt;CREATE2 factory contract&lt;&#x2F;em&gt; deployments.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;deployment-process&quot;&gt;Deployment Process&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;Deploy a &lt;em&gt;bootstrap contract&lt;&#x2F;em&gt; described in the previous section.&lt;&#x2F;li&gt;
&lt;li&gt;Sign an EIP-7702 authorization using the &lt;code&gt;DEPLOYER_PRIVATE_KEY&lt;&#x2F;code&gt; delegating to the &lt;em&gt;bootstrap contract&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Execute an EIP-7702 type &lt;code&gt;0x4&lt;&#x2F;code&gt; transaction with the authorization from step 2; the transaction MUST call &lt;code&gt;DEPLOYER_ADDRESS&lt;&#x2F;code&gt; (&lt;strong&gt;either&lt;&#x2F;strong&gt; directly or indirectly) which delegates to the &lt;em&gt;bootstrap contract&lt;&#x2F;em&gt; and MUST perform the &lt;code&gt;CREATE2 (0xf5)&lt;&#x2F;code&gt; of the &lt;code&gt;CREATE2_FACTORY_INIT_CODE&lt;&#x2F;code&gt; with &lt;code&gt;CREATE2_FACTORY_SALT&lt;&#x2F;code&gt; in the &lt;em&gt;bootstrapping code&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Assuming successful execution of the &lt;em&gt;bootstrapping code&lt;&#x2F;em&gt; without reverting in the context of the &lt;em&gt;deployer&lt;&#x2F;em&gt;, the &lt;em&gt;CREATE2 factory contract&lt;&#x2F;em&gt; will be deployed to &lt;code&gt;CREATE2_FACTORY_ADDRESS&lt;&#x2F;code&gt; with code &lt;code&gt;CREATE2_FACTORY_RUNTIME_CODE&lt;&#x2F;code&gt; and code hash &lt;code&gt;CREATE2_FACTORY_CODE_HASH&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;deployment-mechanism&quot;&gt;Deployment Mechanism&lt;&#x2F;h3&gt;
&lt;p&gt;The deployment mechanism was chosen such that it is uniquely parameterized by the &lt;code&gt;DEPLOYER_ADDRESS&lt;&#x2F;code&gt; (which itself is derived from the &lt;code&gt;DEPLOYER_PRIVATE_KEY&lt;&#x2F;code&gt; and is therefore deterministic), the &lt;code&gt;CREATE2_FACTORY_INIT_CODE&lt;&#x2F;code&gt; and the &lt;code&gt;CREATE2_FACTORY_SALT&lt;&#x2F;code&gt; which are both fixed and deterministic. Additionally, since the &lt;code&gt;DEPLOYER_ADDRESS&lt;&#x2F;code&gt; will deploy the CREATE2 factory contract with the &lt;code&gt;CREATE2 (0xf5)&lt;&#x2F;code&gt; opcode, this guarantees that the address and code of the contract are deterministic.&lt;&#x2F;p&gt;
&lt;p&gt;The use of a publicly known private key enables this mechanism, as anyone can permissionlessly generate a delegation signature to &lt;strong&gt;any&lt;&#x2F;strong&gt; bootstrap contract that would cause the &lt;code&gt;DEPLOYER_ADDRESS&lt;&#x2F;code&gt; to execute the specified &lt;code&gt;CREATE2 (0xf5)&lt;&#x2F;code&gt; operation and deploy the factory contract to a completely deterministic address. Because of the use of &lt;code&gt;CREATE2 (0xf5)&lt;&#x2F;code&gt;, the CREATE2 factory will be deployed to &lt;code&gt;CREATE2_FACTORY_ADDRESS&lt;&#x2F;code&gt; if and only if it is deployed with &lt;code&gt;CREATE2_FACTORY_INIT_CODE&lt;&#x2F;code&gt;, thus guaranteeing a deployed code hash of &lt;code&gt;CREATE2_FACTORY_CODE_HASH&lt;&#x2F;code&gt;. Additionally, the semantics of &lt;code&gt;CREATE2 (0xf5)&lt;&#x2F;code&gt; make it so no transaction executed by &lt;code&gt;DEPLOYER_ADDRESS&lt;&#x2F;code&gt; can permanently block the deployment of the CREATE2 factory contract to &lt;code&gt;CREATE2_FACTORY_ADDRESS&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;One issue with this method is that because the &lt;code&gt;DEPLOYER_PRIVATE_KEY&lt;&#x2F;code&gt; is public, anyone can sign alternative delegations or transactions and front-run a legitimate CREATE2 factory deployment. The front-running would increase the nonce of the &lt;code&gt;DEPLOYER_ADDRESS&lt;&#x2F;code&gt; account and render the EIP-7702 authorization in the legitimate CREATE2 factory deployment transaction invalid, causing the deployment to potentially fail. This is not considered to be a serious issue, however, as:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Doing so does not prevent future deployments - meaning that an attacker can only delay the deployment of the CREATE2 factory with a sustained attack at a gas cost to the attacker, but not permanently prevent it from happening.&lt;&#x2F;li&gt;
&lt;li&gt;The damage is limited to gas griefing for accounts that are legitimately trying to deploy the CREATE2 factory contract. Furthermore, the reference implementation was coded to minimize the gas griefing damage.&lt;&#x2F;li&gt;
&lt;li&gt;In the case of a very persistent malicious actor, their attack can be circumvented by either making use of private transactions or working directly with block builders.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Another known issue with this method is that a future network upgrade may introduce new mechanisms (such as a new opcode or transaction type) to permanently set an account&#x27;s code. If this were to happen, and since the &lt;code&gt;DEPLOYER_PRIVATE_KEY&lt;&#x2F;code&gt; is publicly known, the &lt;code&gt;DEPLOYER_ADDRESS&lt;&#x2F;code&gt; account&#x27;s code could be mistakenly or maliciously set to something that does not execute the necessary bootstrapping code, permanently preventing any future deployment of the CREATE2 factory contract. If this ERC were to gain sufficient adoption, this is not believed to be an issue as:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The deployment on Ethereum Mainnet would already exist, and the &lt;code&gt;DEPLOYER_PRIVATE_KEY&lt;&#x2F;code&gt; would no longer have any value on Ethereum Mainnet.&lt;&#x2F;li&gt;
&lt;li&gt;An RIP can be adopted to ensure that &lt;code&gt;CREATE2_FACTORY_ADDRESS&lt;&#x2F;code&gt; has code &lt;code&gt;CREATE2_FACTORY_RUNTIME_CODE&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;publicly-known-private-key-instead-of-nick-s-method&quot;&gt;Publicly Known Private Key Instead of Nick&#x27;s Method&lt;&#x2F;h3&gt;
&lt;p&gt;Instead of using a publicly known &lt;code&gt;DEPLOYER_PRIVATE_KEY&lt;&#x2F;code&gt;, Nick&#x27;s method can be used to generate a random EIP-7702 authorization signature. This would prevent the front-running and forward compatibility issues described above.&lt;&#x2F;p&gt;
&lt;p&gt;However, in order for Nick&#x27;s method to work, the EIP-7702 authorization message that is signed, defined as &lt;code&gt;keccak(MAGIC || rlp([chain_id, address, nonce]))&lt;&#x2F;code&gt;, must be constant. &lt;code&gt;MAGIC&lt;&#x2F;code&gt; is already a constant; &lt;code&gt;chain_id&lt;&#x2F;code&gt; can be trivially fixed to &lt;code&gt;0&lt;&#x2F;code&gt; to specify a chain-agnostic EIP-7702 authorization; &lt;code&gt;nonce&lt;&#x2F;code&gt; can also be trivially fixed to &lt;code&gt;0&lt;&#x2F;code&gt; because Nick&#x27;s method ensures the authority has no known private key, meaning it cannot sign another message that would increment the nonce. However, fixing &lt;code&gt;address&lt;&#x2F;code&gt; is problematic. Doing so would require a contract with specific code to be deployed to the same address on all chains, which is the original bootstrapping problem the proposed permissionless CREATE2 factory aims to solve. Therefore, this creates a &quot;chicken and egg problem&quot;, making it not a viable way to generate an EIP-7702 authorization signature.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;use-of-create2-factory-contract&quot;&gt;Use of CREATE2 Factory Contract&lt;&#x2F;h3&gt;
&lt;p&gt;This mechanism allows the &lt;code&gt;DEPLOYER_ADDRESS&lt;&#x2F;code&gt; to do any &lt;code&gt;CREATE2 (0xf5)&lt;&#x2F;code&gt; deployment, so it would be possible to forgo the intermediary CREATE2 factory contract and use the deployer technique for all deployments. There are multiple downsides to this, however:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;All contract deployments are subject to the front-running issue described above, which could become an annoyance&lt;&#x2F;li&gt;
&lt;li&gt;Concurrent deployments from the deployer are subject to race conditions since EIP-7702 authorizations increase the account nonce. This means that if two deployments are submitted to the mempool without knowing about each other, only the first one will actually succeed, because the EIP-7702 authorization in the second transaction is for an outdated nonce. This is not an issue when deployers are trying to deploy the same contract as proposed in this ERC since even if the second delegation and transaction fails, the contract would have been deployed as desired.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;multiple-transaction-procedure&quot;&gt;Multiple Transaction Procedure&lt;&#x2F;h3&gt;
&lt;p&gt;Unfortunately, EIP-7702 type &lt;code&gt;0x4&lt;&#x2F;code&gt; transactions are restricted to &lt;code&gt;to&lt;&#x2F;code&gt; values that are not &lt;code&gt;null&lt;&#x2F;code&gt;, meaning that you cannot simultaneously deploy the &lt;em&gt;bootstrap contract&lt;&#x2F;em&gt; and delegate to it in a single transaction.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;choice-of-deployer-private-key&quot;&gt;Choice of Deployer Private Key&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;DEPLOYER_PRIVATE_KEY&lt;&#x2F;code&gt; was chosen as the private key at derivation path &lt;code&gt;m&#x2F;44&#x27;&#x2F;60&#x27;&#x2F;0&#x27;&#x2F;0&#x2F;0&lt;&#x2F;code&gt; for the mnemonic &lt;code&gt;make code code code code code code code code code code coconut&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;choice-of-salt&quot;&gt;Choice of Salt&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;CREATE2_FACTORY_SALT&lt;&#x2F;code&gt; was chosen as the &lt;strong&gt;first&lt;&#x2F;strong&gt; salt value starting from &lt;code&gt;0&lt;&#x2F;code&gt; such that the CREATE2 factory&#x27;s &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;55&#x2F;&quot;&gt;ERC-55&lt;&#x2F;a&gt; checksum address starts with the case sensitive &lt;code&gt;0xC0DE...&lt;&#x2F;code&gt; prefix. A verifiable method for mining a vanity address for the CREATE2 factory contract was chosen in order to ensure that the ERC authors did not find a CREATE2 hash collision on the &lt;code&gt;CREATE2_FACTORY_ADDRESS&lt;&#x2F;code&gt; that they can exploit at some point in the future.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;create2-factory-bytecode&quot;&gt;CREATE2 Factory Bytecode&lt;&#x2F;h3&gt;
&lt;p&gt;The CREATE2 factory has a similar interface to existing implementations. Namely, it accepts &lt;code&gt;salt || init_code&lt;&#x2F;code&gt; as input, which is a 32-byte &lt;code&gt;salt&lt;&#x2F;code&gt; value concatenated with the &lt;code&gt;init_code&lt;&#x2F;code&gt; of the contract to deploy. It will execute a &lt;code&gt;CREATE2&lt;&#x2F;code&gt; with the specified &lt;code&gt;salt&lt;&#x2F;code&gt; and &lt;code&gt;init_code&lt;&#x2F;code&gt;, deploying a contract with &lt;code&gt;init_code&lt;&#x2F;code&gt; to &lt;code&gt;keccak256(0xff || CREATE2_FACTORY_ADDRESS || salt || keccak256(init_code))[12:]&lt;&#x2F;code&gt;. This contract returns the address of the created contract padded to 32 bytes. This differs from some existing implementations, but was done to maintain consistency with the 32-byte word size on the EVM (same encoding as &lt;code&gt;ecrecover&lt;&#x2F;code&gt; precompile for example). A product of this is that the return data from CREATE2 factory is compatible with the Solidity ABI. In the case where the execution of &lt;code&gt;init_code&lt;&#x2F;code&gt; were to fail, any revert data is propagated to the caller.&lt;&#x2F;p&gt;
&lt;p&gt;Throughout both the CREATE2 factory contract initialization and runtime code, &lt;code&gt;RETURNDATASIZE (0x3d)&lt;&#x2F;code&gt; is used to push &lt;code&gt;0&lt;&#x2F;code&gt; onto the stack instead of the dedicated &lt;code&gt;PUSH0 (0x5f)&lt;&#x2F;code&gt; opcode. This is done to increase compatibility with chains that support EIP-7702 but not &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3855&#x2F;&quot;&gt;EIP-3855&lt;&#x2F;a&gt;, while remaining a 1-byte and 2-gas opcode.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;CREATE2_FACTORY_INIT_CODE&lt;&#x2F;code&gt; corresponds to the following assembly:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;### Constructor Code ###&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0000: PUSH29 0x60203d3d3582360380843d373d34f5806019573d813d933efd5b3d52f3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        # Stack: [runcode]                      | Push the CREATE2 factory runtime code, left padded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                                                # with three 0 bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x001e: RETURNDATASIZE  # Stack: [0; runcode]                   | Push the offset in memory to store the code&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x001f: MSTORE          # Stack: []                             | The runtime code is now in `memory[3:32]`, because of&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                                                # the 3 bytes of 0-padding&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0020: PUSH1 29        # Stack: [29]                           | Push the code length&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0022: PUSH1 3         # Stack: [3; 29]                        | Push the memory offset of the start of code&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0024: RETURN          # Stack: []                             | Return the runtime code&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;CREATE2_FACTORY_RUNTIME_CODE&lt;&#x2F;code&gt; corresponds to the following assembly:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;### Runtime Code ###&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Prepare the stack, push 32, a value that will used a lot and can summon with&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# `DUP*` to save on one byte of code (over `PUSH1 32`), and a 0 which will be&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# used by either the `RETURN` or `REVERT` branches at the end.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0000: PUSH1 32        # Stack: [32]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0002: RETURNDATASIZE  # Stack: [0; 32]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# First, load the salt value and compute the actual code size for the CREATE2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# call, this is the calldata length minus 32 for the salt prefix.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        # Stack: [0; 32]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0003: RETURNDATASIZE  # Stack: [0; 0; 32]                     | Push the calldata offset 0 of the `salt` parameter&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0004: CALLDATALOAD    # Stack: [salt; 0; 32]                  | Load the `salt` from calldata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0005: DUP3            # Stack: [32; salt; 0; 32]              | Push 32 to the stack&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0006: CALLDATASIZE    # Stack: [msg.data.len; 32; salt; ...]  | Followed by the calldata length&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0007: SUB             # Stack: [code.len; salt; 0; 32]        | Compute `msg.data.length - 32`, which is the length of&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                                                # the init `code`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Copy the init code to memory offset 0. Note that if the call to the contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# incorrectly encoded, this will revert with &amp;quot;out of gas&amp;quot;, as it will attempt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# to copy ~2**256 bytes of calldata to memory.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        # Stack: [code.len; salt; 0; 32]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0008: DUP1            # Stack: [code.len; .; salt; 0; 32]     | Duplicate the length of the init code&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0009: DUP5            # Stack: [32; code.len; ...]            | Push the offset in calldata of the code, which is 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                                                # as it comes immediately after the 32-byte `salt`; use&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                                                # the 32 value at the bottom of the stack&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x000a: RETURNDATASIZE  # Stack: [0; 32; code.len; ...]         | Push the offset (0) in memory to copy the code to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x000b: CALLDATACOPY    # Stack: [code.len; salt; 0; 32]        | Copy the init code, `memory[0:code.len]` contains the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                                                # init `code`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Deploy the contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        # Stack: [code.len; salt; 0; 32]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x000c: RETURNDATASIZE  # Stack: [0; code.len; salt; 0; 32]     | Push the offset in memory starting of the start of&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                                                # init `code`, which is 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x000d: CALLVALUE       # Stack: [v; 0; code.len; salt; 0; 32]  | Forward the call value to the contract constructor&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x000e: CREATE2         # Stack: [address; 0; 32]               | Do `create2(v, code, salt)`, which leaves the address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                                                # of the contract on the stack, or 0 if the contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                                                # creation reverted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Verify the deployment was successful and return the address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        # Stack: [address; 0; 32]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x000f: DUP1            # Stack: [address; .; 0; 32]            | Duplicate the address value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0010: PUSH1 0x19      # Stack: [0x0019; address; .; 0; 32]    | Push the jump destination offset for the code which&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                                                # handles successful deployments&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0012: JUMPI           # Stack: [address; 0; 32]               | Jump if `address != 0`, i.e. `CREATE2` succeeded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# CREATE2 reverted, propagate the revert data.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        # Stack: [address = 0; 0; 32]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0013: RETURNDATASIZE  # Stack: [r.len; 0; 0; 32]              | Push the revert data length onto the stack&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0014: DUP2            # Stack: [0; r.len; 0; 0; 32]           | Push 0 on to the stack by duplicating; note that&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                                                # `PUSH0` is intentionally do not used for increased&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                                                # compatibility with chains that do not implement that&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                                                # specific opcode&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0015: RETURNDATASIZE  # Stack: [r.len; 0; r.len; 0; 0; 32]    | Push the revert data length onto the stack again&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0016: SWAP4           # Stack: [0; 0; r.len; 0; r.len; 32]    | Reorder the stack so that both `RETURNDATACOPY` and&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                                                # `REVERT` can be called; this is done by swapping the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                                                # revert data length on the top of the stack with the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                                                # bottom-most 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0017: RETURNDATACOPY  # Stack: [0; r.len; 32]                 | Copy the revert data to `memory[0:r.len]`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0018: REVERT          # Stack: [32]                           | Revert with `memory[0:r.len]`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# CREATE2 succeeded.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0019: JUMPDEST        # Stack: [address; 0; 32]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x001a: RETURNDATASIZE  # Stack: [0; address; 0; 32]            | Push the memory offset (0) to store return data at,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                                                # `RETURNDATASIZE` is used as contract creation was&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                                                # successful, and therefore the return data has size 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x001b: MSTORE          # Stack: [0; 32]                        | Store the address in memory, `memory[0:32]` contains&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                                                # the `address` left padded to 32-bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x001c: RETURN          # Stack: []                             | Return `memory[0:32]`, i.e. the address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;There are a few backwards compatibility considerations with the new proposal:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;It requires an EVM chain with EIP-7702 enabled. This means not all chains can use this deployment method.&lt;&#x2F;li&gt;
&lt;li&gt;It would deploy yet another CREATE2 factory contract that would need to be adopted by tooling.&lt;&#x2F;li&gt;
&lt;li&gt;The proposed CREATE2 factory implementation returns the newly created contract address padded to 32 bytes. This is different to some existing contracts that return unpadded 20-byte address value.&lt;&#x2F;li&gt;
&lt;li&gt;The proposed CREATE2 factory implementation propagates revert data. This is different to some existing contracts that just revert with empty data in case executing the CREATE2 initialization code fails.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal includes a reference implementation of a bootstrap contract to which the deployer account can delegate. The reference implementation expects a call to &lt;code&gt;Bootstrap&lt;&#x2F;code&gt; to the function &lt;code&gt;deploy()&lt;&#x2F;code&gt; in an EIP-7702 type &lt;code&gt;0x4&lt;&#x2F;code&gt; transaction including the EIP-7702 authorization delegating &lt;code&gt;DEPLOYER_ADDRESS&lt;&#x2F;code&gt; to &lt;code&gt;Bootstrap&lt;&#x2F;code&gt; (NOTE: the &lt;code&gt;Bootstrap&lt;&#x2F;code&gt; is called as an entry point, instead of calling &lt;code&gt;DEPLOYER_ADDRESS&lt;&#x2F;code&gt; directly which allows the contract to do some up-front checks to minimize gas griefing risk):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.29&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Bootstrap&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; _DEPLOYER_ADDRESS &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x962560A0333190D57009A0aAAB7Bfa088f58461C&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; _CREATE2_FACTORY_ADDRESS &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xC0DEb853af168215879d284cc8B4d0A645fA9b0E&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; _CREATE2_FACTORY_CODE_HASH &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;2ad75e1e9642e6fce7d293d52fa5a8f62a79a2079abb7402256add02d6e8bc30&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; _CREATE2_FACTORY_INIT_CODE &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;7c60203d3d3582360380843d373d34f5806019573d813d933efd5b3d52f33d52601d6003f3&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; _CREATE2_FACTORY_SALT &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;000000000000000000000000000000000000000000000000000000000001bec5&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InvalidDelegation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CreationFailed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; deploy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;_CREATE2_FACTORY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;codehash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; _CREATE2_FACTORY_CODE_HASH&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; delegation &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;ef0100&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_DEPLOYER_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;codehash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; delegation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InvalidDelegation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        Bootstrap&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_DEPLOYER_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;bootstrap&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; bootstrap&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; initCode &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _CREATE2_FACTORY_INIT_CODE&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; salt &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _CREATE2_FACTORY_SALT&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; factory&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;memory-safe&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            factory &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; create2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;initCode&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;initCode&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; salt&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;factory &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; _CREATE2_FACTORY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CreationFailed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;A minimal bootstrap contract implementation is also possible (although this has a higher potential for gas griefing). The minimal bootstrap contract expects a call directly to the &lt;code&gt;DEPLOYER_ADDRESS&lt;&#x2F;code&gt; in an EIP-7702 type &lt;code&gt;0x4&lt;&#x2F;code&gt; transaction including the EIP-7702 authorization delegating &lt;code&gt;DEPLOYER_ADDRESS&lt;&#x2F;code&gt; to &lt;code&gt;MiniBootstrap&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.29&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MiniBootstrap&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; _CREATE2_FACTORY_INIT_CODE &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;7c60203d3d3582360380843d373d34f5806019573d813d933efd5b3d52f33d52601d6003f3&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; _CREATE2_FACTORY_SALT &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;000000000000000000000000000000000000000000000000000000000001bec5&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    fallback&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; initCode &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _CREATE2_FACTORY_INIT_CODE&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;memory-safe&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            pop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;create2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;initCode&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;initCode&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _CREATE2_FACTORY_SALT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;It is possible to front-run transactions that invalidate the deployer&#x27;s EIP-7702 delegation and cause the deployment to fail. This, however, comes at a gas cost to the attacker, with limited benefit beyond delaying the deployment of the CREATE2 factory. Additionally, persistent attackers can be circumvented by either using private transaction queues or working with block builders directly to ensure that the EIP-7702 bootstrapping transaction is not front-run.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;future-network-upgrades&quot;&gt;Future Network Upgrades&lt;&#x2F;h3&gt;
&lt;p&gt;If new EVM opcodes or transaction types are introduced in future network upgrades that allow an account to permanently set its code, then this method is no longer guaranteed to work. The deployer account can permanently change its code to a contract that does not have the required bootstrapping code. This can trivially be done by a malicious actor using the publicly known &lt;code&gt;DEPLOYER_PRIVATE_KEY&lt;&#x2F;code&gt; and would prevent any future deployments of CREATE2 factory.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Unidirectional Wallet Uplink aka UWULink</title>
        <published>2025-05-10T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Moody Salem</name><uri>https://github.com/moodysalem</uri>
	</author>
	
	<author>
		<name>Tina Zheng</name><uri>https://github.com/tinaszheng</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7946/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7946-unidirectional-wallet-uplink-aka-uwulink/24282" />
        

        <id>https://wg-eips.ritovision.com/7946/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7946"
            label="ERC-7946" />
        

        
        

        
        <summary type="html">Unidirectional app to wallet communication for private construction of transactions</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7946/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Universal Wallet Uplink (UWULink) is a protocol that allows applications (dApps) to request a wallet to
make a batch of contract calls in a single atomic transaction without establishing a two-way
connection or revealing the user&#x27;s address to the requester. The protocol defines a compact binary message format using
Protocol Buffers suitable for low-bandwidth channels such as QR codes or NFC tags. Two modes of operation are
supported: &lt;strong&gt;Static Mode&lt;&#x2F;strong&gt;, where the request payload directly contains the list of calls, and &lt;strong&gt;Programmable Mode&lt;&#x2F;strong&gt;,
where the payload references a contract that generates the list of calls.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;dApps often require users to perform multistep interactions, such as approving a token and then executing a
swap. Traditionally, accomplishing this has required multiple user confirmations or complex wallet connectivity.
Recent standards like &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5792&#x2F;&quot;&gt;EIP-5792&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; introduced ways to batch multiple calls into one atomic operation
via JSON-RPC (e.g. &lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt;). However, current implementations of those solutions assume an active connection
between dApp and wallet (e.g. injected provider or WalletConnect session), which creates an additional layer of UX friction.
There is a growing need for a &lt;strong&gt;privacy-preserving, frictionless workflow&lt;&#x2F;strong&gt; where a dApp or product can trigger complex
transactions without “connecting” their wallet or needing to disclosing their address to the application.&lt;&#x2F;p&gt;
&lt;p&gt;Several trends highlight this need:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Atomic Multi-Call Transactions:&lt;&#x2F;strong&gt; With the advent of account abstraction features like &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt;, externally
owned accounts (EOAs) can execute &lt;strong&gt;batch transactions&lt;&#x2F;strong&gt; a la smart contract wallets. Users expect to
combine multiple actions (e.g. token approvals, swaps, transfers) into one confirmed transaction for better UX and
guaranteed all-or-nothing execution. Developers likewise want to avoid partial failures or multiple prompts.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Privacy Concerns:&lt;&#x2F;strong&gt; Current wallet connection flows (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1193&#x2F;&quot;&gt;EIP-1193&lt;&#x2F;a&gt; &#x2F; &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1102&#x2F;&quot;&gt;EIP-1102&lt;&#x2F;a&gt;) require dApps to request access to
user accounts, linking the user&#x27;s address with the dApp even before a transaction is made. By decoupling transaction
construction from user identification, we improve privacy. The wallet should not need to announce “who” it is to the
dApp just to receive a transaction request. A one-way communication means the dApp never learns the user&#x27;s address or
other account info, mitigating tracking and profiling risks.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;One-Way Offline Interaction:&lt;&#x2F;strong&gt; In many use cases (desktop-to-mobile workflows, point-of-sale terminals, printed
media), it’s desirable to communicate a transaction request via a QR code, NFC tag, or URL without establishing a
session. Protocols like WalletConnect provide a session-based two-way link, but are heavyweight when a simple
one-off action is needed, and they reveal the user&#x27;s account to the dApp. A unidirectional link allows, for
example, a user to scan a QR code on a webpage or poster and complete an on-chain action entirely within their
wallet app. This also enables fully offline dApps to hand off transactions securely to user devices.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Compactness for QR&#x2F;NFC:&lt;&#x2F;strong&gt; Encoding transaction data for use in QR codes or NFC imposes strict size limits. Prior
standards (e.g. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;681&#x2F;&quot;&gt;EIP-681&lt;&#x2F;a&gt; Ethereum URIs) used human-readable formats that become lengthy when including contract
data (hex-encoded addresses and calldata inflate the size). WalletConnect addressed some issues by introducing a
more efficient URI scheme (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1328&#x2F;&quot;&gt;ERC-1328&lt;&#x2F;a&gt;) instead of embedding JSON in QR codes. UWULink builds on this principle by
using a concise binary serialization (Protocol Buffers), allowing more data to be communicated in a QR code or NFC
tap.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Programmability and Offloading Logic:&lt;&#x2F;strong&gt; There are scenarios where the exact list of calls depends on on-chain state
or user-specific data (for example, an airdrop claim that needs to gather all tokens claimable by that user, or a
DeFi interaction where allowances may already exist). In such cases, encoding all call data statically could be
unwieldy or inefficient if the dApp lacks knowledge of the user&#x27;s address. UWULink’s &lt;strong&gt;Programmable Mode&lt;&#x2F;strong&gt; allows a
dApp to redirect to a deterministic on-chain generator (a smart contract with a standard interface) that can produce
the list of calls that the wallet should invoke. This allows the app to invoke arbitrary logic in generating the
list of calls based on the state of the blockchain, still without exposing the user&#x27;s address.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;By addressing these points, UWULink aims to enhance user experience with one-shot multi-call transactions and improve
security and privacy by eliminating unnecessary data sharing.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;overview&quot;&gt;Overview&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;UWULink&lt;&#x2F;strong&gt; defines a protobuf message format and interpretation for transaction requests sent from a dApp to a wallet.
The only operation in scope is a request for the wallet to execute an &lt;strong&gt;atomic batch of contract calls&lt;&#x2F;strong&gt; on an
EVM-compatible blockchain. The wallet, upon receiving a UWULink request (for example, via a QR code scan, deep link, or
NFC), will decode it, present the details to the user for confirmation, and if approved, execute the calls as a single
transaction on the specified chain.&lt;&#x2F;p&gt;
&lt;p&gt;Key characteristics of the protocol:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Unidirectional Communication:&lt;&#x2F;strong&gt; Communication is &lt;strong&gt;only dApp → wallet&lt;&#x2F;strong&gt;. The dApp encodes a request and the wallet
handles it. There is no handshake or return channel in the protocol itself. The wallet is not required (or able) to
send any data back to the dApp. This one-way design ensures the dApp does not learn any information
about the user or wallet (such as the address or which wallet app is used) at request time. It also simplifies
implementation – the dApp’s job is simply to generate a batch of calls and display it, and the wallet’s job is to
execute or reject the batch.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Atomic Batch Calls:&lt;&#x2F;strong&gt; All calls listed in the request &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be executed atomically, i.e. all succeed or all fail
together. If any specific call would revert, the wallet should revert the entire batch.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;No Identity &#x2F; Auth Required:&lt;&#x2F;strong&gt; Because the request is self-contained, the wallet does not need to pre-authorize the
dApp or reveal the selected account. In traditional injected scenarios, a dApp would call &lt;code&gt;eth_requestAccounts&lt;&#x2F;code&gt; (as
per &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1102&#x2F;&quot;&gt;EIP-1102&lt;&#x2F;a&gt;) to get the user&#x27;s address. With UWULink, the first and only interaction is the user willingly
importing the transaction request (e.g. scanning the QR). The wallet should treat it similarly to how it would treat
a transaction payload from a connected dApp, except no connection context exists. If the request is malformed
or not supported, the wallet can simply alert the user and refuse.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Binary Encoding:&lt;&#x2F;strong&gt; UWULink messages are encoded as a binary blob based on a Protocol Buffers schema. This blob is
then further encoded into a URI for transport via QR code or NFC tag. The string encoding of a request is the
&lt;code&gt;uwulink:&lt;&#x2F;code&gt;
scheme followed by the base 64 encoded message:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;uwulink:&amp;lt;base64_of_UWULink_message&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Chain Identification:&lt;&#x2F;strong&gt; The message includes a chain ID to indicate which chain the calls are intended for. The
wallet must verify or use this chain ID when executing the transaction.
If the wallet is not currently on the target chain, it SHOULD prompt the user to switch to that chain or automatically
switch if permissible (similar to handling of &lt;code&gt;chainId&lt;&#x2F;code&gt; in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;681&#x2F;&quot;&gt;EIP-681&lt;&#x2F;a&gt; URIs). If the wallet cannot operate on the
requested chain, it must reject the request. This ensures that the dApp’s intent (which chain’s contracts to interact
with) is preserved and avoids confusion if the user is on a different network.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Static vs Programmable Mode:&lt;&#x2F;strong&gt; There are two mutually exclusive ways to specify the batch of calls:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Static Mode:&lt;&#x2F;strong&gt; The request directly contains the list of calls (each with target address, calldata, and
optionally ETH value) that the wallet should execute in order. This mode is straightforward and similar to
existing multi-call APIs (e.g. the JSON-RPC &lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt; payload from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5792&#x2F;&quot;&gt;EIP-5792&lt;&#x2F;a&gt;), but encoded in a
compact binary form. This is ideal when the dApp knows exactly what actions need to be performed.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Programmable Mode:&lt;&#x2F;strong&gt; The request contains a reference to an &lt;strong&gt;on-chain “resolver” contract&lt;&#x2F;strong&gt; and an input data
blob. The wallet will call a predefined view function on that contract (off-chain, via &lt;code&gt;eth_call&lt;&#x2F;code&gt;) to &lt;strong&gt;retrieve
the actual list of calls&lt;&#x2F;strong&gt; to execute. The resolver contract must implement a standardized interface (detailed
below) that takes the provided input (and possibly the caller’s address or other context) and returns a set of
calls. This mode allows dynamic computation of call lists at execution time. It improves flexibility (the dApp
can offload complex logic or personalization to the blockchain) and keeps the QR&#x2F;NFC payload small since it only
carries a contract address and input, rather than every call’s details. For example, a dApp could include just a
reference like “resolver contract X with input Y” and that contract’s resolver function will output perhaps
dozens of calls based on the latest on-chain state, the user&#x27;s address, etc.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The UWULink message includes a oneof&#x2F;union to indicate which mode is used. Wallets &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; support both modes.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;protobuf-schema&quot;&gt;Protobuf Schema&lt;&#x2F;h3&gt;
&lt;p&gt;Below is the proposed Protocol Buffers v3&lt;!-- TODO: add a link to a specific git commit after eipw is updated --&gt; schema defining the UWULink message format:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;syntax = &amp;quot;proto3&amp;quot;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;package org.ethereum.uwulink;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; The top-level UWULink transaction request message.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;message UWULinkRequest {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  uint64 chain_id = 1;  &#x2F;&#x2F; EIP-155 chain ID for the target chain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  oneof request_type {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Batch batch = 2;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ResolverReference resolver = 3;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; Static batch of calls&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;message Batch {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  repeated Call calls = 1;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; Single contract call&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;message Call {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  bytes to = 1;                &#x2F;&#x2F; 20-byte address of target contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  optional bytes value = 2;    &#x2F;&#x2F; (optional) up to 32-byte big-endian ETH value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  optional bytes data = 3;     &#x2F;&#x2F; (optional) calldata for the call&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; Reference to a resolver contract for dynamic call generation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;message ResolverReference {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  bytes resolver_address = 1;  &#x2F;&#x2F; 20-byte address of resolver contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  bytes resolver_data = 2;     &#x2F;&#x2F; opaque data to pass to resolver&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Notes on the schema:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;We use &lt;code&gt;bytes&lt;&#x2F;code&gt; for addresses and other binary data. A conforming wallet implementation MUST enforce that &lt;code&gt;Call.to&lt;&#x2F;code&gt; and
&lt;code&gt;ResolverReference.resolver_address&lt;&#x2F;code&gt; are exactly 20 bytes. The protobuf itself won&#x27;t enforce length, but using a
different length should cause the wallet to reject the message (to avoid ambiguity or mis-interpretation). The &lt;code&gt;value&lt;&#x2F;code&gt;
field in &lt;code&gt;Call&lt;&#x2F;code&gt; can be 0 bytes (interpreted as 0 ETH) up to 32 bytes. Leading zeros in &lt;code&gt;value&lt;&#x2F;code&gt; SHOULD be stripped in
the encoding for consistency (e.g., 1 wei would be encoded as &lt;code&gt;0x01&lt;&#x2F;code&gt; not 32 bytes padded; conversely the decoder
should treat a missing &lt;code&gt;value&lt;&#x2F;code&gt; or empty &lt;code&gt;value&lt;&#x2F;code&gt; as 0).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;All fields are numbered for efficient encoding. The oneof &lt;code&gt;request_type&lt;&#x2F;code&gt; ensures only one of Batch or
ResolverReference is in use. If an unknown field is present (e.g., a future extension), the wallet should ignore those
unknown fields per protobuf default behavior, but core fields must be present for validity (chain_id and one of
batch&#x2F;resolver).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;If using a text encoding (like Base64) to embed in a URI, the entire &lt;code&gt;UWULinkRequest&lt;&#x2F;code&gt; message is serialized to a
binary string, then that binary is base64-encoded. For URI safety, base64 output may need to be URL-encoded (i.e.,
&lt;code&gt;+&lt;&#x2F;code&gt;, &lt;code&gt;&#x2F;&lt;&#x2F;code&gt; characters percent-encoded or using the URL-safe base64 variant). This is an implementation detail, but
wallet developers should be aware when parsing input. In all cases, the underlying data after decoding is expected to
match the protobuf schema above.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The schema is chosen for broad compatibility. Proto3&#x27;s varint encoding will handle the &lt;code&gt;chain_id&lt;&#x2F;code&gt; (which is usually
small like 1, 137, etc.) in 1-2 bytes. The &lt;code&gt;calls&lt;&#x2F;code&gt; repeated field will simply concatenate call entries. Each call
entry will have a 1-byte field tag for &lt;code&gt;to&lt;&#x2F;code&gt; followed by 20 bytes address, etc. This results in a very compact
representation.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Example of an encoded message (for illustration): A static request for chain 1 with two calls might look like:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Call 1: to = &lt;code&gt;0x111111...1111&lt;&#x2F;code&gt;, value = none (0), data = &lt;code&gt;0xabcdef&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Call 2: to = &lt;code&gt;0x222222...2222&lt;&#x2F;code&gt;, value = 100 wei, data = (empty)&lt;&#x2F;li&gt;
&lt;li&gt;After encoding in protobuf and base64, the URI could be:
&lt;code&gt;ethereum:uwulink?request=EiABAggDEhARERERERERERERERERERERERERERIAGKDCr+8=&lt;&#x2F;code&gt; (this is a fake example string for
concept; actual encoding would differ).&lt;&#x2F;li&gt;
&lt;li&gt;The wallet would decode that back to the structured fields.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Wallet and dApp developers can import this &lt;code&gt;.proto&lt;&#x2F;code&gt; to ensure they are constructing and parsing UWULink messages
consistently.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;resolver-contract-interface-programmable-mode&quot;&gt;Resolver Contract Interface (Programmable Mode)&lt;&#x2F;h3&gt;
&lt;p&gt;This standard introduces an interface that resolver contracts must implement so that wallets can query them for call
batches. All resolver contracts &lt;strong&gt;MUST&lt;&#x2F;strong&gt; implement the following ABI (interface identifier &lt;code&gt;UWUResolver&lt;&#x2F;code&gt;):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; UWULink Resolver Interface&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UWUResolver&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Call&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; target&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Thrown when calls could not be generated, with an error code specific to this resolver.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CallGenerationFailure&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; errorCode&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Compute a batch of calls for a given request.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; requester&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the wallet (EOA or contract) that is requesting the calls.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Arbitrary request data (opaque to the wallet, provided by dApp via UWULink).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; calls&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The list of calls that correspond to the requester and request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getCalls&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; requester&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Call&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; calls&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the details for the given error code. Meant to be called by developers to better understand the error code for a resolver.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  Due to localization needs, it is expected that developers may call this function, but the wallet should not show this information to users.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getErrorCodeDetails&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; errorCode&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; information&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;The function &lt;strong&gt;MAY&lt;&#x2F;strong&gt; modify state. Wallets &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; call it off-chain, and avoid combining the call with others e.g.
via Multicall.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;requester&lt;&#x2F;code&gt; is included to allow the contract to tailor results to the specific user. For example, a resolver
could check &lt;code&gt;requester&lt;&#x2F;code&gt;’s token holdings or permissions and then return different call sets. The wallet should supply
its own sending address as &lt;code&gt;requester&lt;&#x2F;code&gt;. This means that the user’s address is revealed &lt;em&gt;only to the RPC server&lt;&#x2F;em&gt; used
by the wallet via this call, not to the dApp server or UI. In the future with the propagation of light clients, it&#x27;s
possible for the wallet to avoid revealing this information.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;data&lt;&#x2F;code&gt; parameter is the exact bytes provided in the UWULink request’s &lt;code&gt;resolver_data&lt;&#x2F;code&gt;. Its contents and encoding
are defined by the dApp’s usage and the contract’s logic. For instance, it might contain an enum indicating which
action to perform, or some user-specific claim ID, etc.&lt;&#x2F;li&gt;
&lt;li&gt;The size of the returned arrays is not explicitly limited by this standard, but practical use should keep it
reasonable (dozens rather than thousands of calls) both for blockchain computation reasons and for the user’s ability
to comprehend the request.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Wallets should implement the following logic for programmable requests:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Perform an &lt;code&gt;eth_call&lt;&#x2F;code&gt; to &lt;code&gt;resolver_address&lt;&#x2F;code&gt; with &lt;code&gt;to = resolver_address&lt;&#x2F;code&gt;, &lt;code&gt;from = address(0)&lt;&#x2F;code&gt;,
&lt;code&gt;data = ABIEncodeWithSelector(UWUResolver.getCalls, userAddress, resolver_data)&lt;&#x2F;code&gt; against the latest block. The wallet
&lt;strong&gt;MAY&lt;&#x2F;strong&gt; use the pending block, or otherwise include transactions in the state that are yet to be included in a
confirmed block.&lt;&#x2F;li&gt;
&lt;li&gt;If the call returns successfully, decode the result. This becomes the batch of calls to execute. The wallet should
then proceed exactly as if it were a static mode request containing those calls. It should display these calls to the
user for confirmation (including target addresses, values, and perhaps decoded method signatures if it can).&lt;&#x2F;li&gt;
&lt;li&gt;If the call fails (reverts or is not implemented), the wallet &lt;strong&gt;MUST&lt;&#x2F;strong&gt; abort. It SHOULD surface an error to the user
like &quot;Transaction request generation failed: resolver contract call was unsuccessful.&quot; The user then knows the dApp’s
request was bad or the contract might be wrong.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The dApp developer and resolver contract developer are responsible for ensuring that calling &lt;code&gt;getCalls&lt;&#x2F;code&gt; is not too
gas-intensive to execute (since wallets will execute it off-chain but it still must complete execution). Excessive
computation could result in the node returning an error (out of gas exception in the eth_call context). Typically these
functions will just gather data from known contracts or encode some predefined calls, which should not be prohibitively
expensive.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;example-usage&quot;&gt;Example Usage&lt;&#x2F;h3&gt;
&lt;p&gt;To illustrate how UWULink can be used in practice, consider the following scenarios:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;1. Static Mode – Token Approval and Swap (DeFi use-case):&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Alice wants to trade tokens on a decentralized exchange (DEX) using her mobile wallet, but she doesn&#x27;t want to connect
her wallet to the DEX website due to privacy concerns. The DEX dApp prepares a UWULink QR code for the trade. When Alice
selects the tokens and amount on the website, the dApp formulates two contract calls: one to the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; token contract
to &lt;code&gt;approve()&lt;&#x2F;code&gt; the DEX&#x27;s router contract, and one to the router contract to execute the swap (
&lt;code&gt;swapExactTokensForTokens&lt;&#x2F;code&gt;, for example). Normally this would be two separate transactions with two confirmations.
Instead, the dApp bundles them:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Call #1: &lt;code&gt;to = TokenContract, data = approve(router, amount)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Call #2: &lt;code&gt;to = RouterContract, data = swapExactTokensForTokens(params...)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Both calls have &lt;code&gt;value = 0&lt;&#x2F;code&gt; (no ETH being sent directly). The dApp encodes these into a UWULinkRequest (static mode) for
the current chain (e.g. Ethereum mainnet chain_id 1). The protobuf binary is base64 encoded and placed into a QR code
with a URI like:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;uwulink:CgEBEiAx...   (truncated)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Alice scans this QR with her wallet app. The wallet decodes the request: chain_id=1, two calls in batch. It recognizes
it can execute an atomic batch (Alice’s wallet supports &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt;). The wallet UI shows Alice a summary: &quot;This dApp is
requesting two actions: (1) Approve Token XYZ for spending, (2) Swap Token XYZ for Token ABC on DEX.&quot; Alice can inspect
the contract addresses (perhaps the wallet resolves known token&#x2F;contract names or shows the hex addresses) and the
parameters. She sees that both will be submitted together in one transaction. The UI might look similar to a multi-call
confirmation screen.&lt;&#x2F;p&gt;
&lt;p&gt;Alice accepts. Her wallet internally either crafts a 0x4 type transaction (since Alice is an EOA on Ethereum) embedding
bytecode to do the two calls, or uses its smart wallet module. It then signs and broadcasts the transaction. On-chain,
the two calls execute one after the other, and because of atomicity, if the swap were to fail, the approve would be
reverted too (avoiding a scenario where she approved tokens without actually swapping).&lt;&#x2F;p&gt;
&lt;p&gt;The DEX backend or frontend can monitor the blockchain for the transaction receipt (it knows what actions it expected,
or Alice can manually input the tx hash if needed). The important part is the DEX never learned Alice’s address
beforehand; it only sees it when the transaction hits the blockchain, which is unavoidable for executing the trade but
at that point privacy is preserved as well as any normal on-chain interaction (the dApp cannot link it to Alice’s web
session unless Alice herself tells it out-of-band). This shows how UWULink achieves one-scan confirmation for what used
to be multi-step, and keeps Alice’s identity private until the on-chain execution.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;2. Programmable Mode – Personalized Airdrop Claim:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;A project is running an airdrop where eligible users can claim several different token rewards based on on-chain
activity. Bob visits the airdrop dApp page. The page could ask Bob to connect his wallet to figure out what he’s
eligible for, but Bob is cautious. Instead, the dApp uses UWULink in programmable mode. It has a resolver contract
deployed on-chain which, given a user address, can determine all the reward token contracts and amounts that the user is
entitled to claim.&lt;&#x2F;p&gt;
&lt;p&gt;The dApp shows Bob a “Claim Rewards” button, which reveals a QR code. This QR encodes a UWULink request with:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;chain_id = 5&lt;&#x2F;code&gt; (Goerli testnet, for example, where the airdrop is happening).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;resolver_address = 0xDeeD…1234&lt;&#x2F;code&gt; (the address of the AirdropResolver contract).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;resolver_data =&lt;&#x2F;code&gt; some bytes encoding maybe an airdrop campaign identifier or simply empty if one global campaign.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Bob scans this with his wallet. The wallet sees it&#x27;s a resolver-type request. It calls
&lt;code&gt;getBatchCalls(BobAddress, resolver_data)&lt;&#x2F;code&gt; on &lt;code&gt;0xDeeD...1234&lt;&#x2F;code&gt; (as a view call). The AirdropResolver contract looks up
internally that BobAddress is eligible for 3 tokens: TokenA, TokenB, and TokenC with certain amounts, and the claim
function for each is &lt;code&gt;claim(address claimant, uint256 amount)&lt;&#x2F;code&gt; on each token’s distributor contract. It returns three
arrays: targets = &lt;code&gt;[AddrA, AddrB, AddrC]&lt;&#x2F;code&gt;, values = &lt;code&gt;[0,0,0]&lt;&#x2F;code&gt; (no ETH needed), callData =
&lt;code&gt;[ abi.encodeWithSelector(Distributor.claim, Bob, amtA), ... ]&lt;&#x2F;code&gt; for each token.&lt;&#x2F;p&gt;
&lt;p&gt;The wallet receives these arrays. It now has three calls to execute. It shows Bob: &quot;Claim TokenA: amount X, Claim
TokenB: amount Y, Claim TokenC: amount Z&quot; (assuming the wallet can decode the function signatures or at least show
contract addresses and method names if it has ABIs). Bob approves the batch. The wallet then either directly calls each
distributor’s &lt;code&gt;claim&lt;&#x2F;code&gt; in one aggregated transaction. Because Bob’s address was provided to the resolver, each claim call
will credit tokens to Bob (likely the contract uses the provided address or &lt;code&gt;msg.sender&lt;&#x2F;code&gt; – here it was likely coded to
use the address parameter, since the actual transaction sender will be Bob’s own address in the batch execution
context). The important part is Bob did not have to connect his wallet to the dApp; the eligibility and calls were
determined by the on-chain contract. The dApp never saw Bob’s address, yet Bob gets his tokens in one go.&lt;&#x2F;p&gt;
&lt;p&gt;After execution, Bob’s wallet shows the transaction success. The dApp might simply tell him to check his balances (or it
could have a public page showing which addresses claimed, etc., but it did not get a direct notification — it relies on
Bob or the blockchain to know the claim happened).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;3. Cross-Device Payment via NFC (Point of Sale):&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Carol is at a merchant&#x27;s point-of-sale device that accepts cryptocurrency payments via Ethereum. The merchant’s device
can display a QR or emit an NFC message with a payment request. Instead of using a simple one-address payment URI (as in
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;681&#x2F;&quot;&gt;EIP-681&lt;&#x2F;a&gt;), the merchant uses UWULink to request a more sophisticated transaction: perhaps Carol will pay through a
specific escrow contract or with a certain token if she has a discount coupon.&lt;&#x2F;p&gt;
&lt;p&gt;The device sends an &lt;strong&gt;NFC payload&lt;&#x2F;strong&gt; which Carol’s phone picks up (many wallet apps can register as handlers for certain
NDEF messages or custom URI schemes). The payload contains a UWULinkRequest in static mode:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;chain_id = 137 (Polygon, where the merchant operates).&lt;&#x2F;li&gt;
&lt;li&gt;Two calls: first call to a stablecoin contract’s &lt;code&gt;transfer(merchantAddress, amount)&lt;&#x2F;code&gt; (to pay the merchant), second
call to a logging contract &lt;code&gt;registerPurchase(merchantId, CarolAddress, amount)&lt;&#x2F;code&gt; (to log the sale in an on-chain
registry). Both calls are value 0 since a token transfer, not ETH, is used.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Carol’s wallet opens with the decoded request: It shows &quot;Pay 50 USDC to Merchant XYZ and register purchase.&quot; Carol sees
the merchant name resolved from the merchant’s address (if her wallet has ENS or a local registry of known merchants).
She approves. The wallet then executes an atomic transaction on Polygon that calls the USDC token contract and the
registry contract. The merchant’s PoS waits for confirmation on-chain (or simply trust the signed transaction once
broadcast, depending on their risk tolerance). Carol’s identity remained pseudonymous; the merchant’s device did not
directly get her wallet info, it only received the on-chain payment. And Carol only had to tap once to approve both
token transfer and logging, rather than scan one QR to pay then perhaps another to log, etc.&lt;&#x2F;p&gt;
&lt;p&gt;These examples demonstrate the flexibility of UWULink:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;In all cases, the user did not pre-connect their wallet to the application.&lt;&#x2F;li&gt;
&lt;li&gt;The requests can be transferred via out-of-band channels (QR&#x2F;NFC&#x2F;URL).&lt;&#x2F;li&gt;
&lt;li&gt;Multi-step operations become “one-click” (or one-scan) operations for the user.&lt;&#x2F;li&gt;
&lt;li&gt;The on-chain outcome is the same as if the user had manually sent those transactions, but with improved UX and
privacy.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;TBD &lt;!-- TODO --&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;UWULink is an additive protocol and does not break any existing standards. It is designed to coexist with current
methods:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Existing Wallet URIs (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;681&#x2F;&quot;&gt;EIP-681&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;831&#x2F;&quot;&gt;EIP-831&lt;&#x2F;a&gt;):&lt;&#x2F;strong&gt; UWULink can be seen as an evolution of the idea behind EIP-681 (
transaction request URIs). EIP-681 defines URIs for a single transaction (or payment) and is already supported in a
limited number of wallets for QR code scanning. UWULink extends the concept to multiple calls and binary encoding. A
wallet that does not recognize the &lt;code&gt;uwulink:&lt;&#x2F;code&gt; scheme should simply not act on it. Typically, such
a wallet would either show an error or ignore a scanned QR it cannot parse. This is a graceful failure from the user&#x27;s
perspective (they&#x27;ll know the wallet doesn&#x27;t support that request). There is no risk of confusing an UWULink QR with
an EIP-681 QR, since the scheme and content format differ. Therefore, wallets that only implement support for EIP-681
will not mistakenly handle a UWULink payload as a valid request.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Ensuring Backwards Compatibility in Data Format:&lt;&#x2F;strong&gt; The protobuf schema is designed such that new fields could be
added in the future in a non-breaking way (per Proto3 rules, unknown fields are ignored by receivers). For example, a
future version might add an optional &lt;code&gt;uint64 expiration_timestamp&lt;&#x2F;code&gt; or &lt;code&gt;string origin&lt;&#x2F;code&gt; field to carry a domain name for
UI display. An older wallet would ignore these and still execute the core request. This forward-compatibility means
UWULink can evolve without breaking older implementations, as long as additions are carefully made optional.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Fall-back to Standard Flows:&lt;&#x2F;strong&gt; From a dApp perspective, implementing UWULink does not preclude supporting
traditional wallet connections. A dApp can offer UWULink QR codes for users who prefer privacy or are on devices (like
a separate mobile) without browser extensions. At the same time, it can have the usual “Connect Wallet” button for
users who are okay with that. This multi-modal approach ensures no user is left out. Over time, if UWULink (or similar
one-way flows) prove safer and more popular, they might become the default, allowing users to interact with dApps
without connecting a wallet.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Network Compatibility:&lt;&#x2F;strong&gt; We limit scope to EVM-compatible chains. That means chains that use &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt; transaction
scheme and Ethereum-like addresses. On non-EVM chains, this standard doesn’t apply (though analogous concepts could).
Within EVM chains, a nuance: if a chain has a different maximum gas limit or transaction format peculiarity, the
wallet internally deals with that. UWULink just says &quot;execute these calls.&quot; As long as the wallet can create a
transaction that does so, it’s fine. If an EVM chain does not support atomic multi-call (some L2s or sidechains might
not immediately support EIP-7702), the wallet has to handle it at the account abstraction layer if possible, or
otherwise &lt;strong&gt;MUST&lt;&#x2F;strong&gt; reject the request. This again falls to the wallet to know its capabilities (e.g. per &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5792&#x2F;&quot;&gt;EIP-5792&lt;&#x2F;a&gt;’s
capabilities query).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In conclusion, UWULink aims to introduce new functionality without disrupting existing user journeys. It is opt-in for
all parties. Early adopters (both dApps and wallets) can experiment with it while others continue as usual. As support
grows, it could become a widely recognized standard for secure one-way wallet interactions. The design takes into
account lessons from previous proposals (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;681&#x2F;&quot;&gt;EIP-681&lt;&#x2F;a&gt; URIs, WalletConnect, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5792&#x2F;&quot;&gt;EIP-5792&lt;&#x2F;a&gt;, etc.) and ensures that adopting UWULink
is a low-risk enhancement rather than a breaking change to Ethereum’s ecosystem.&lt;&#x2F;p&gt;
&lt;!-- TODO: Reference Implementation --&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;privacy&quot;&gt;Privacy&lt;&#x2F;h3&gt;
&lt;p&gt;UWULink is designed with privacy in mind, but it introduces some new security aspects that implementers and users should
consider:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;No Wallet Identification:&lt;&#x2F;em&gt; The wallet does not disclose the user’s address or any wallet details to the dApp when
using UWULink. This significantly improves privacy compared to typical wallet connect flows. The dApp only learns of
the user&#x27;s address if and when the transaction is broadcast on-chain. Even then, the dApp cannot easily correlate that
address with a specific user session (the user could be anonymous on the website until that point).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;On-Chain Resolver Calls:&lt;&#x2F;em&gt; In programmable mode, the user&#x27;s address is supplied to the resolver contract as a
parameter. This happens off-chain via &lt;code&gt;eth_call&lt;&#x2F;code&gt;, so it does not create a public transaction. However, the node or RPC
provider that the wallet uses will see that call (just like any read call). If the RPC provider is untrusted, this
could leak some information (e.g., that this address is interested in this resolver&#x27;s data). In most cases this is a
minor concern (no more revealing than using the dApp itself while connected to an RPC), but users who are extremely
privacy-conscious might prefer static mode or ensure they use a privacy-respecting RPC. Importantly, the dApp backend
or frontend does not see this – only the blockchain infrastructure does.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;No Third-Party Tracking:&lt;&#x2F;em&gt; Because UWULink can be used via local channels (QR&#x2F;NFC), it avoids relying on any
centralized relay. WalletConnect v1, for instance, used relay servers and handshake topics which, in theory, could be
tracked or snooped (even though payloads were encrypted, the metadata might leak usage patterns). UWULink in contrast
can be a completely peer-to-peer (user and dApp) interaction with minimal digital footprint aside from the eventual
blockchain transaction.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;User Consent:&lt;&#x2F;em&gt; As with any transaction, the user explicitly consents by scanning and approving the request. The
user relies on the wallet&#x27;s simulation and multi-factor authorization capabilities to prevent sending of malicious
transactions.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;security-of-transaction-requests&quot;&gt;Security of Transaction Requests&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;Phishing and Malicious QR Codes:&lt;&#x2F;em&gt; A malicious actor could present a user with a UWULink QR code that, if scanned and
approved blindly, could cause the user to transfer funds or approve tokens to the attacker. This risk is analogous to
phishing links or malicious dApp websites in today&#x27;s context. Users should be educated to only approve UWULink
requests from sources they trust or understand. Wallets should help by displaying &lt;strong&gt;clear human-readable information&lt;&#x2F;strong&gt;
about what the request will do:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Show the names or ENS of known contract addresses involved (or at least highlight unknown addresses).&lt;&#x2F;li&gt;
&lt;li&gt;Decode function selectors to known function names if possible (e.g., show &quot;approve(address _spender, uint256
_value)&quot; instead of raw hex).&lt;&#x2F;li&gt;
&lt;li&gt;For value transfers, show the ETH or token amount in a friendly format.&lt;&#x2F;li&gt;
&lt;li&gt;Possibly warn if the request involves calling an unrecognized contract with large value transfers or if it sets a
high token allowance, etc.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;Atomic Execution and Reverts:&lt;&#x2F;em&gt; By enforcing atomic execution, UWULink ensures that partial completion won&#x27;t lead to
stuck funds or unintended states. However, this also means a malicious or buggy request could be crafted to always
revert (for example, by including an incompatible call), which could waste user gas fees if not caught. Wallets should
simulate the batch when possible. If the wallet can do a dry-run (for instance using &lt;code&gt;eth_call&lt;&#x2F;code&gt; on a Bundler or
internal simulation) it might detect a guaranteed revert and inform the user that the call set is invalid (though this
might be complex to do reliably for all calls).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;Resolver Contract Trust:&lt;&#x2F;em&gt; The programmable mode introduces a potential trust issue: the user is effectively trusting
the resolver contract’s code to generate the calls honestly. If the resolver contract is malicious, it could return
call data that benefits an attacker. For example, a malicious resolver could ignore the input data and always return a
call transferring all of the user&#x27;s ETH to the attacker’s address. &lt;strong&gt;Mitigations:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Ideally, resolver contracts should be open source and verified, and the dApp using them should be reputable. The
wallet can’t fully know if the resolver’s output is malicious until it sees it, but the user will have a chance to
review the resulting calls anyway. This is crucial: the wallet must display the &lt;em&gt;resulting calls&lt;&#x2F;em&gt; from the
resolver to the user, just as it would in static mode. The user should then notice if something is off (e.g., a
transfer of all their ETH is about to happen).&lt;&#x2F;li&gt;
&lt;li&gt;Wallet developers might consider adding special handling or warnings if a resolver returns calls that do not seem
correlated with the input. However, this is hard to generalize. At minimum, treat the resolver output with the
same suspicion as a static request. There’s no inherent additional risk beyond what static mode has, because the
user still confirms the final calls. The difference is just where the call data came from.&lt;&#x2F;li&gt;
&lt;li&gt;We assume resolver contracts will often be provided by the same party as the dApp and thus come with an implied
level of trust (or at least, they can be audited by the community if the UWULink scheme becomes popular).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;No Automatic Spending:&lt;&#x2F;em&gt; UWULink does not introduce new signing or authorization paradigms – it uses actual
transactions that the user signs on the spot. Thus, it’s less prone to the kind of issues where a signature can be
later reused (like the risks with off-chain signatures). Each UWULink request is one transaction (with possibly
multiple subcalls). After it&#x27;s executed, the link cannot be reused to automatically trigger more actions (unless the
user scans it again). This is good from a security standpoint since it doesn&#x27;t create long-lived permissions. One
exception: if a call within the batch is an approval or something, that is an on-chain permission that persists as
usual (the user should be made aware as normal).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;Denial of Service (DOS):&lt;&#x2F;em&gt; A malicious dApp could craft an extremely large UWULink payload (especially in static mode)
that could crash or slow a wallet app upon scanning (due to memory or decoding issues). Wallets should implement size
limits and perhaps streaming parsing for the protobuf to avoid crashes. If a payload exceeds a reasonable size (e.g.,
several kilobytes), the wallet can reject it for safety. Similarly, a resolver contract could try to return extremely
large results – wallets should guard against that by limiting the amount of gas provided to the resolver via eth_call.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;Capabilities and Future Extensions:&lt;&#x2F;em&gt; UWULink intentionally does not carry any additional flags like gas limits or
paymaster info (unlike EIP-5792 which has a capabilities system). This is to keep the format simple. However, this
means the wallet will apply its own heuristics for gas, and by default the user pays fees. If a future extension
wanted to allow gas sponsorship or other features, that could be added either by extending the protobuf (e.g., adding
an optional paymaster field) or by having the resolver contract itself handle that (e.g., a resolver could incorporate
a paymaster logic by returning a call to a paymaster contract as part of the batch). In any case, security
considerations around gas (like a malicious paymaster causing some weird behavior) would need to be analyzed. For now,
UWULink operates within the normal transaction model, so the main security focus is on the correctness of calls.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Comparison to Traditional Flows:&lt;&#x2F;strong&gt; One might ask, does eliminating the wallet &amp;lt;-&amp;gt; dApp handshake create any new risks?
In traditional connected dApp sessions, the wallet at least knows the origin of requests (e.g., which website is calling
&lt;code&gt;eth_sendTransaction&lt;&#x2F;code&gt; or &lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt;). In UWULink, the origin is essentially &quot;the QR code the user scanned&quot; – the
wallet might know the payload came via a QR&#x2F;NFC but not which app or site. In security terms, this means the wallet
cannot apply domain-based whitelists or blocklists (since there&#x27;s no domain, unless the URI contains one in the payload
which it typically wouldn&#x27;t). Therefore, &lt;strong&gt;the user must manually trust and verify each request.&lt;&#x2F;strong&gt; This is akin to using
a hardware wallet: every transaction is shown on a screen and the user approves it, with no assumptions about where it
came from. This places responsibility on the user and makes the wallet’s job of displaying info accurately even more
important.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Privacy vs. Usability Trade-off:&lt;&#x2F;strong&gt; Because UWULink doesn’t let the dApp query the wallet off-chain, some conveniences
are lost – e.g., the dApp cannot automatically fetch the user&#x27;s address to display their balance or NFTs in the UI prior
to a transaction. This is a conscious privacy trade-off. Some advanced dApps might find workarounds (like asking the
user to input their address manually if they want to see personalized info, or shifting more logic on-chain as in
programmable mode). Users and dApp developers must understand this trade-off. In contexts where user personalization
without login is needed, UWULink might require a bit more creativity, but it ensures that if the user chooses not to
share anything, they truly don&#x27;t until a transaction is made.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Confidential Transactions Supported Token</title>
        <published>2025-05-09T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Siyuan Zheng</name><uri>https://github.com/andrewcoder666</uri><email>zhengsiyuan.zsy@antgroup.com</email>
	</author>
	
	<author>
		<name>Xiaoyu Liu</name><uri>https://github.com/elizabethxiaoyu</uri><email>jiushi.lxy@antgroup.com</email>
	</author>
	
	<author>
		<name>Wenwei Ma</name><uri>https://github.com/madyinglight</uri><email>huiwei.mww@antgroup.com</email>
	</author>
	
	<author>
		<name>Jun Meng Tan</name><uri>https://github.com/chadxeth</uri><email>junmeng.t@antgroup.com</email>
	</author>
	
	<author>
		<name>Yuxiang Fu</name><uri>https://github.com/tmac4096</uri><email>kunfu.fyx@antgroup.com</email>
	</author>
	
	<author>
		<name>Kecheng Gao</name><uri>https://github.com/thanks-v-me-50</uri><email>gaokecheng.gkc@antgroup.com</email>
	</author>
	
	<author>
		<name>Alwin Ng Jun Wei</name><uri>https://github.com/alwinngjw</uri><email>alwin.ng@antgroup.com</email>
	</author>
	
	<author>
		<name>Chenxin Wang</name><uri>https://github.com/3235773541</uri><email>wcx465603@antgroup.com</email>
	</author>
	
	<author>
		<name>Xiang Gao</name><uri>https://github.com/GaoYiRu</uri><email>gaoxiang.gao@antgroup.com</email>
	</author>
	
	<author>
		<name>yuanshanhshan</name><uri>https://github.com/xunayuan</uri><email>yuanshanshan.yss@antgroup.com</email>
	</author>
	
	<author>
		<name>Hao Zou</name><uri>https://github.com/BruceZH0915</uri><email>situ.zh@antgroup.com</email>
	</author>
	
	<author>
		<name>Yanyi Liang</name><email>eason.lyy@antgroup.com</email>
	</author>
	
	<author>
		<name>Yuehua Zhang</name><uri>https://github.com/astroyhzcc</uri><email>ruoying.zyh@antgroup.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7945/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/interface-of-confidential-transactions-supported-token-contract/23586" />
        

        <id>https://wg-eips.ritovision.com/7945/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7945"
            label="ERC-7945" />
        

        
        

        
        <summary type="html">Confidential transactions hide token amounts. This proposal outlines a fungible confidential token interface, boosting privacy in dApps.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7945/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Classic token contracts like &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; enable their token holders to make transfers and&#x2F;or approve others to make transfers on their behalves. The generality of token standard &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; catalyzed decentralizing finance and many other blockchain applications. However, when it comes to privacy, although some technical schemes have been proposed, few standards have been established, which limits the evolution of privacy-preserving blockchain applications.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal draws up a standard interface for fungible token contracts supporting confidential transactions. It provides basic transfer functionality without loss of generality, and allowance and approve functionalities. Contracts following the standard can provide confidentiality for users’ balances and token transfer value, and can enable other blockchain applications to make transfers on behalf of owners, which empowers more privacy-preserving capabilities to blockchain applications.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Confidential transactions have been implemented in many blockchains, either natively through blockchain protocols like Monero and Zcash, or through smart contracts like Zether&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-1-1&quot;&gt;&lt;a href=&quot;#fn-1&quot;&gt;1&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; without modifying blockchain protocol.&lt;&#x2F;p&gt;
&lt;p&gt;However, when it comes to the latter way, actually few standards are proposed yet on Ethereum (and&#x2F;or other EVM-compatible blockchains) to illustrate such contracts. Users and applications cannot easily detect whether a token contract supports confidential transactions or not, and so hardly can they make transfers without revealing the actual amount.&lt;&#x2F;p&gt;
&lt;p&gt;Consequently, this proposal is to standardize the confidential transaction supported token contracts, meanwhile without loss of generality, by only specifying core methods and events.&lt;&#x2F;p&gt;
&lt;p&gt;Such standard interface allows confidential transactions of tokens to be applied by certain parties which are sensitive to transfer amount, or by privacy-preserving applications.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;contract-interface&quot;&gt;Contract Interface&lt;&#x2F;h3&gt;
&lt;p&gt;The proposed contract implements the following 2 interfaces: &lt;code&gt;ITokenMetadata&lt;&#x2F;code&gt; and &lt;code&gt;IConfidentialToken&lt;&#x2F;code&gt; .&lt;&#x2F;p&gt;
&lt;h4 id=&quot;itokenmetadata&quot;&gt;&lt;code&gt;ITokenMetadata&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;methods&quot;&gt;Methods&lt;&#x2F;h5&gt;
&lt;h6 id=&quot;name&quot;&gt;&lt;code&gt;name&lt;&#x2F;code&gt;&lt;&#x2F;h6&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Returns the name of the token - e.g. &lt;code&gt;&quot;MyConfidentialToken&quot;&lt;&#x2F;code&gt; .&lt;&#x2F;p&gt;
&lt;p&gt;OPTIONAL - This method can be used to improve usability, but interfaces and other contracts MUST NOT expect these values to be present.&lt;&#x2F;p&gt;
&lt;h6 id=&quot;symbol&quot;&gt;&lt;code&gt;symbol&lt;&#x2F;code&gt;&lt;&#x2F;h6&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; symbol&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Returns the symbol of the token. e.g. &lt;code&gt;&quot;cHIX&quot;&lt;&#x2F;code&gt; .&lt;&#x2F;p&gt;
&lt;p&gt;OPTIONAL - This method can be used to improve usability, but interfaces and other contracts MUST NOT expect these values to be present.&lt;&#x2F;p&gt;
&lt;h6 id=&quot;decimals&quot;&gt;&lt;code&gt;decimals&lt;&#x2F;code&gt;&lt;&#x2F;h6&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; decimals&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Returns the number of decimals the token uses - e.g. &lt;code&gt;8&lt;&#x2F;code&gt; , means to divide the token amount by &lt;code&gt;100000000&lt;&#x2F;code&gt; to get its user representation.&lt;&#x2F;p&gt;
&lt;p&gt;OPTIONAL - This method can be used to improve usability, but interfaces and other contracts MUST NOT expect these values to be present.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;iconfidentialtoken&quot;&gt;&lt;code&gt;IConfidentialToken&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;methods-1&quot;&gt;Methods&lt;&#x2F;h5&gt;
&lt;h6 id=&quot;confidentialbalanceof&quot;&gt;&lt;code&gt;confidentialBalanceOf&lt;&#x2F;code&gt;&lt;&#x2F;h6&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; confidentialBalanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; confidentialBalance&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Returns the confidential balance of the account with address &lt;code&gt;owner&lt;&#x2F;code&gt; .&lt;&#x2F;p&gt;
&lt;h6 id=&quot;confidentialtransfer&quot;&gt;&lt;code&gt;confidentialTransfer&lt;&#x2F;code&gt;&lt;&#x2F;h6&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; confidentialTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _confidentialTransferValue&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _proof&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Transfers &lt;code&gt;value&lt;&#x2F;code&gt; amount of tokens (behind &lt;code&gt;_confidentialTransferValue&lt;&#x2F;code&gt; ) to address &lt;code&gt;_to&lt;&#x2F;code&gt; , and MUST fire the &lt;code&gt;ConfidentialTransfer&lt;&#x2F;code&gt; event. The function SHOULD &lt;code&gt;throw&lt;&#x2F;code&gt; if the message caller’s &lt;code&gt;_proof&lt;&#x2F;code&gt; of this transfer fails to be verified.&lt;&#x2F;p&gt;
&lt;p&gt;Note:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Callers MUST handle &lt;code&gt;false&lt;&#x2F;code&gt; from returns (bool success). Callers MUST NOT assume that &lt;code&gt;false&lt;&#x2F;code&gt; is never returned!&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Implementations can fully customize the proof system, (de)serialization strategies of &lt;code&gt;bytes&lt;&#x2F;code&gt; and&#x2F;or the business workflow. For example, when implementing &quot;Zether&quot;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-1-2&quot;&gt;&lt;a href=&quot;#fn-1&quot;&gt;1&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; confidential token contracts, the &lt;code&gt;_confidentialTransferValue&lt;&#x2F;code&gt; and accounts&#x27; confidential balances will be encrypted homomorphically under ElGamal public keys, and &lt;code&gt;_proof&lt;&#x2F;code&gt; will consist 3 parts to check:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;_confidentialTransferValue&lt;&#x2F;code&gt; is well encrypted under both caller&#x27;s public key and &lt;code&gt;_to&lt;&#x2F;code&gt; &#x27;s;&lt;&#x2F;li&gt;
&lt;li&gt;The plaintext &lt;code&gt;value&lt;&#x2F;code&gt; behind &lt;code&gt;_confidentialTransferValue&lt;&#x2F;code&gt; is non-negative;&lt;&#x2F;li&gt;
&lt;li&gt;The caller&#x27;s confidential balance is actually enough to pay the plaintext &lt;code&gt;value&lt;&#x2F;code&gt; behind &lt;code&gt;_confidentialTransferValue&lt;&#x2F;code&gt; .&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h6 id=&quot;confidentialtransferfrom&quot;&gt;&lt;code&gt;confidentialTransferFrom&lt;&#x2F;code&gt;&lt;&#x2F;h6&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; confidentialTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _confidentialTransferValue&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _proof&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Transfers &lt;code&gt;value&lt;&#x2F;code&gt; amount of tokens (behind &lt;code&gt;_confidentialTransferValue&lt;&#x2F;code&gt; ) from address &lt;code&gt;_from&lt;&#x2F;code&gt; to address &lt;code&gt;_to&lt;&#x2F;code&gt; , and MUST fire the &lt;code&gt;ConfidentialTransfer&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;confidentialTransferFrom&lt;&#x2F;code&gt; method is used for a withdraw workflow, allowing contracts to transfer tokens on your behalf. This can be used for example to allow a contract to transfer tokens on your behalf and&#x2F;or to charge fees in sub-currencies. The function SHOULD &lt;code&gt;throw&lt;&#x2F;code&gt; unless the &lt;code&gt;_from&lt;&#x2F;code&gt; account has deliberately authorized the sender of the message via some mechanism, and SHOULD &lt;code&gt;throw&lt;&#x2F;code&gt; if the message caller’s &lt;code&gt;_proof&lt;&#x2F;code&gt; of this transfer fails to be verified.&lt;&#x2F;p&gt;
&lt;p&gt;Note:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Callers MUST handle &lt;code&gt;false&lt;&#x2F;code&gt; from returns (bool success). Callers MUST NOT assume that &lt;code&gt;false&lt;&#x2F;code&gt; is never returned!&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Implementations can fully customize the proof system, (de)serialization strategies of &lt;code&gt;bytes&lt;&#x2F;code&gt; and&#x2F;or the business workflow. For example, when implementing &quot;Zether&quot; confidential token contracts, the &lt;code&gt;_confidentialTransferValue&lt;&#x2F;code&gt; and accounts&#x27; confidential balances will be encrypted homomorphically under ElGamal public keys, and &lt;code&gt;_proof&lt;&#x2F;code&gt; will consist 3 parts to check:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;_confidentialTransferValue&lt;&#x2F;code&gt; is well encrypted under public keys of &lt;code&gt;_from&lt;&#x2F;code&gt; &#x27;s, &lt;code&gt;_to&lt;&#x2F;code&gt; &#x27;s and caller&#x27;s;&lt;&#x2F;li&gt;
&lt;li&gt;The plaintext &lt;code&gt;value&lt;&#x2F;code&gt; behind &lt;code&gt;_confidentialTransferValue&lt;&#x2F;code&gt; is non-negative;&lt;&#x2F;li&gt;
&lt;li&gt;The caller&#x27;s confidential allowance is actually enough to pay the plaintext &lt;code&gt;value&lt;&#x2F;code&gt; behind &lt;code&gt;_confidentialTransferValue&lt;&#x2F;code&gt; .&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h6 id=&quot;confidentialapprove&quot;&gt;&lt;code&gt;confidentialApprove&lt;&#x2F;code&gt;&lt;&#x2F;h6&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; confidentialApprove&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _confidentialValue&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _proof&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Allows &lt;code&gt;_spender&lt;&#x2F;code&gt; to withdraw from caller&#x27;s split part of balances multiple times, up to the amount (allowance value) behind &lt;code&gt;_confidentialValue&lt;&#x2F;code&gt; to 0. This function SHOULD &lt;code&gt;throw&lt;&#x2F;code&gt; if the message caller’s &lt;code&gt;_proof&lt;&#x2F;code&gt; of this transfer fails to be verified.&lt;&#x2F;p&gt;
&lt;p&gt;Caution:&lt;&#x2F;p&gt;
&lt;p&gt;This function behaves much &lt;strong&gt;differently from&lt;&#x2F;strong&gt; &lt;code&gt;approve(address,uint256)&lt;&#x2F;code&gt; in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Calling &lt;code&gt;confidentialApprove&lt;&#x2F;code&gt; splits the confidential balance of caller&#x27;s account into &lt;em&gt;allowance part&lt;&#x2F;em&gt; and &lt;em&gt;the left part&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The values behind two parts above after calling &lt;code&gt;confidentialApprove&lt;&#x2F;code&gt; , and the value behind the original confidential balance of caller&#x27;s account before calling &lt;code&gt;confidentialApprove&lt;&#x2F;code&gt; satisfy the equation:&lt;&#x2F;p&gt;
&lt;p&gt;$$
value_{Behind\ Allowance\ Part} + value_{Behind\ Left\ Part} = value_{Behind\ Original\ Confidential\ Balance}
$$&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The allowance part of confidential balance allows &lt;code&gt;_spender&lt;&#x2F;code&gt; to withdraw multiple times through calling &lt;code&gt;confidentialTransferFrom&lt;&#x2F;code&gt; until &lt;code&gt;_spender&lt;&#x2F;code&gt; does not call it any more or the value behind this part is 0.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Every time the &lt;code&gt;_spender&lt;&#x2F;code&gt; calls &lt;code&gt;confidentialTransferFrom&lt;&#x2F;code&gt; , the value behind this part will be decreased by the value behind &lt;code&gt;_confidentialTransferValue&lt;&#x2F;code&gt; .&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The left part remains as the new confidential balance of caller&#x27;s account.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;If this function is called again it,&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;merges existing allowance part into the confidential balance of caller&#x27;s account; and then&lt;&#x2F;li&gt;
&lt;li&gt;overwrites the current allowance part with &lt;code&gt;_confidentialValue&lt;&#x2F;code&gt; .&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Callers MUST handle &lt;code&gt;false&lt;&#x2F;code&gt; from returns (bool success). Callers MUST NOT assume that &lt;code&gt;false&lt;&#x2F;code&gt; is never returned!&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Implementations can fully customize the proof system, (de)serialization strategies of &lt;code&gt;bytes&lt;&#x2F;code&gt; and&#x2F;or the business workflow. For example, when implementing &quot;Zether&quot; confidential token contracts, the &lt;code&gt;_confidentialValue&lt;&#x2F;code&gt; and accounts&#x27; confidential balances will be encrypted homomorphically under ElGamal public keys, and &lt;code&gt;_proof&lt;&#x2F;code&gt; will consist 3 parts to check:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;_confidentialValue&lt;&#x2F;code&gt; is well encrypted under public keys of caller&#x27;s and &lt;code&gt;_spender&lt;&#x2F;code&gt;&#x27;s;&lt;&#x2F;li&gt;
&lt;li&gt;The plaintext &lt;code&gt;value&lt;&#x2F;code&gt; behind &lt;code&gt;_confidentialValue&lt;&#x2F;code&gt; is non-negative;&lt;&#x2F;li&gt;
&lt;li&gt;The caller&#x27;s confidential balance is actually enough to pay the plaintext &lt;code&gt;value&lt;&#x2F;code&gt; behind &lt;code&gt;_confidentialValue&lt;&#x2F;code&gt; .&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h6 id=&quot;confidentialallowance&quot;&gt;&lt;code&gt;confidentialAllowance&lt;&#x2F;code&gt;&lt;&#x2F;h6&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;functinon &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;confidentialAllowance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _confidentialValue&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Returns the allowance part which &lt;code&gt;_spender&lt;&#x2F;code&gt; is still allowed to withdraw from &lt;code&gt;_owner&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;events&quot;&gt;Events&lt;&#x2F;h5&gt;
&lt;h6 id=&quot;confidentialtransfer-1&quot;&gt;&lt;code&gt;ConfidentialTransfer&lt;&#x2F;code&gt;&lt;&#x2F;h6&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ConfidentialTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _confidentialTransferValue&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;MUST trigger when tokens are transferred.&lt;&#x2F;p&gt;
&lt;p&gt;Specifically, if tokens are transferred through function &lt;code&gt;confidentialTransferFrom&lt;&#x2F;code&gt;, &lt;code&gt;_spender&lt;&#x2F;code&gt; address MUST be set to caller&#x27;s; otherwise, it SHOULD be set to &lt;code&gt;0x0&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;A confidential token contract,&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;which creates new tokens SHOULD trigger a &lt;code&gt;ConfidentialTransfer&lt;&#x2F;code&gt; with the &lt;code&gt;_from&lt;&#x2F;code&gt; address set to &lt;code&gt;0x0&lt;&#x2F;code&gt; when tokens are minted;&lt;&#x2F;li&gt;
&lt;li&gt;which destroys existent tokens SHOULD trigger a &lt;code&gt;ConfidentialTransfer&lt;&#x2F;code&gt; with the &lt;code&gt;_to&lt;&#x2F;code&gt; address set to &lt;code&gt;0x0&lt;&#x2F;code&gt; when tokens are burnt.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h6 id=&quot;confidentialapproval&quot;&gt;&lt;code&gt;ConfidentialApproval&lt;&#x2F;code&gt;&lt;&#x2F;h6&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ConfidentialApproval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _currentAllowancePart&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _allowancePart&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;MUST trigger on any successful call to &lt;code&gt;confidentialApprove(address,bytes,bytes)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;optional-accessor-of-confidential-total-supply&quot;&gt;Optional Accessor of &quot;Confidential Total Supply&quot;&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; confidentialTotalSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Confidentiality of transfer amount makes it hard to support such field like &lt;code&gt;totalSupply()&lt;&#x2F;code&gt; in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;. Because when it comes to the token &quot;mint&quot; or &quot;burn&quot;, if every user in this contract can access &lt;code&gt;totalSupply()&lt;&#x2F;code&gt; as well as decrypt it, these users will know the actual token value to be minted or burnt by comparing the &lt;code&gt;totalSupply()&lt;&#x2F;code&gt; before and after such operations, which means that confidentiality no longer exists.&lt;&#x2F;p&gt;
&lt;p&gt;Contract implementation can optionally support &lt;code&gt;confidentialTotalSupply()&lt;&#x2F;code&gt; by evaluating if anti-money laundry (see next part) and audit are required. That would be much more plausible by making a small group of parties can know the plaintext total supply behind &lt;code&gt;confidentialTotalSupply()&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;anti-money-laundry-and-audit&quot;&gt;Anti-money Laundry and Audit&lt;&#x2F;h3&gt;
&lt;p&gt;To support audit of confidential transactions and total supply, especially such token issuers are banks or other financial institutes supervised by governments or monetary authorities, confidential transactions can be implemented without changing &lt;code&gt;confidentialTransfer&lt;&#x2F;code&gt; method signature, by encoding more info into parameters.&lt;&#x2F;p&gt;
&lt;p&gt;For example in Zether-like implementation[^2], if token transfers are required to be audited, &lt;code&gt;confidentialTransfer&lt;&#x2F;code&gt; caller encrypts transfer &lt;code&gt;value&lt;&#x2F;code&gt; redundantly under public keys of caller&#x27;s, &lt;code&gt;to&lt;&#x2F;code&gt;&#x27;s, a group of auditors&#x27;, which makes it possible that related parties can exactly know the real &lt;code&gt;value&lt;&#x2F;code&gt; behind. So does &lt;code&gt;confidentialTotalSupply()&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;fat-token&quot;&gt;Fat Token&lt;&#x2F;h3&gt;
&lt;p&gt;Confidential transactions supported token can also implement &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; at the same time.&lt;&#x2F;p&gt;
&lt;p&gt;Token accounts in such tokens can hold 2 kinds of balances. Such token contracts can optionally provide methods to hide &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; plaintext balances into confidential balances, and vice versa, to reveal confidential balances back to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; plaintext balances.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; interfaces will bring much more usability and utilities to confidential transaction supported tokens, realizing general confidentiality meantime.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;To realize full confidentiality, contracts implementing this presented interface SHOULD NOT create (mints) or destroy (burns) tokens with plaintext value parameters. For implementation, following the same encryption strategies in &lt;code&gt;confidentialTransfer(address,bytes,bytes)&lt;&#x2F;code&gt; is RECOMMENDED.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;section class=&quot;footnotes&quot;&gt;
&lt;ol class=&quot;footnotes-list&quot;&gt;
&lt;li id=&quot;fn-1&quot;&gt;
&lt;p&gt;Bünz, B., Agrawal, S., Zamani, M., &amp;amp; Boneh, D. (n.d.). &lt;span style=&quot;font-style: italic;&quot;&gt;Zether: Towards Privacy in a Smart Contract World&lt;&#x2F;span&gt;. https:&#x2F;&#x2F;doi.org&#x2F;&lt;a href=&quot;https:&#x2F;&#x2F;doi.org&#x2F;10.1007&#x2F;978-3-030-51280-4_23&quot;&gt;10.1007&#x2F;978-3-030-51280-4_23&lt;&#x2F;a&gt; (Original work published 2020)[^2]: Chen, Y., Ma, X., Tang, C., &amp;amp; Au, M. H. (n.d.). &lt;span style=&quot;font-style: italic;&quot;&gt;PGC: Decentralized Confidential Payment System with Auditability&lt;&#x2F;span&gt;. https:&#x2F;&#x2F;doi.org&#x2F;&lt;a href=&quot;https:&#x2F;&#x2F;doi.org&#x2F;10.1007&#x2F;978-3-030-58951-6_29&quot;&gt;10.1007&#x2F;978-3-030-58951-6_29&lt;&#x2F;a&gt; (Original work published 2020) &lt;a href=&quot;#fr-1-1&quot;&gt;↩&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-1-2&quot;&gt;↩2&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;section&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Account Abstraction Recovery Interface</title>
        <published>2025-05-07T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Artem Chystiakov</name><uri>https://github.com/arvolear</uri><email>artem@rarilabs.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7947/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7947-account-abstraction-recovery-interface-aari/24080" />
        

        <id>https://wg-eips.ritovision.com/7947/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7947"
            label="ERC-7947" />
        

        
        

        
        <summary type="html">Universal mechanism to recover a smart account&#x27;s access via custom recovery providers.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7947/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce a universal account abstraction recovery mechanism &lt;code&gt;recoverAccess(subject, provider, proof)&lt;&#x2F;code&gt; along with recovery provider management functions for smart accounts to securely update their access subject.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Account abstraction and the &quot;contractization&quot; of EOAs are important Ethereum milestones for improving on-chain UX and off-chain security. A wide range of smart accounts emerge daily, aiming to simplify the steep onboarding curve for new users. The ultimate smart account experience is to never ask them to deal with private keys, yet still allow for full account control and access recovery. With the developments in the Zero-Knowledge Artificial Intelligence (ZKAI) and Zero-Knowledge Two Factor Authentication (ZK2FA) fields, settling on a common mechanism may even open the doors for &quot;account recovery provider marketplaces&quot; to emerge.&lt;&#x2F;p&gt;
&lt;p&gt;The account recovery approach described in this proposal allows for multiple recovery providers to coexist and provide a wide variety of unique recovery services. In simple terms, smart accounts become &quot;recovery provider aggregators&quot;, making it possible for the users to never rely on centralized services or projects.&lt;&#x2F;p&gt;
&lt;p&gt;The Account Abstraction Recovery Interface (AARI) aims to define a flexible interface for &lt;em&gt;any&lt;&#x2F;em&gt; smart account to implement, allowing users to actively manage their account recovery providers and restore the access of an account in case of a private key loss.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;A smart account willing to support AARI MUST implement the following interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.20&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Defines a common account recovery interface for smart accounts to implement.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IAccountRecovery&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST be emitted whenever the access of the account changes as a result &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * of the account recovery (e.g. in the `recoverAccess` function).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AccessRecovered&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; subject&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST be emitted whenever a new recovery provider is added to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * the account (e.g. in the `addRecoveryProvider` function).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RecoveryProviderAdded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; provider&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST be emitted whenever a recovery provider is removed from&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * the account (e.g. in the `removeRecoveryProvider` function).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RecoveryProviderRemoved&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; provider&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A function to add a new recovery provider.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * SHOULD be access controlled.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST check that `provider` is not `address(0)`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST call `subscribe` on the `provider`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST pass `recoveryData` to the `subscribe` function.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; provider&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the address of a recovery provider (ZKP verifier) to add.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; recoveryData&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; custom data (commitment) for the recovery provider.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addRecoveryProvider&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; provider&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recoveryData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A function to remove an existing recovery provider.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * SHOULD be access controlled.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST call `unsubscribe` on the `provider`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; provider&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the address of a previously added recovery provider to remove.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; removeRecoveryProvider&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; provider&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A view function to check if a provider has been previously added.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; provider&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the provider to check.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; true&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if the provider exists in the account, false otherwise.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; recoveryProviderAdded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; provider&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A non-view function to recover access of a smart account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST check that `provider` exists in the account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST call `recover` on the `provider`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST update the account access according to `subject` if `proof` verification succeeds.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST return `true` if the access recovery is successful.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; subject&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the recovery subject (encoded owner address, access control role, etc).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; provider&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the address of a recovery provider.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; proof&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; an encoded proof of recovery (ZKP&#x2F;ZKAI, signature, etc).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `true` if recovery is successful, `false` (or revert) otherwise.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; recoverAccess&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; subject&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; provider&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; proof&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;A recovery provider MUST implement the following interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Defines a common recovery provider interface.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IRecoveryProvider&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST be emitted whenever a new account subscribes to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * the recovery provider (e.g. in the `subscribe` function).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AccountSubscribed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST be emitted whenever an account unsubscribes from&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * the recovery provider (e.g. in the `unsubscribe` function).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AccountUnsubscribed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A function that &amp;quot;subscribes&amp;quot; a smart account (msg.sender) to a recovery provider.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * SHOULD process and assign the `recoveryData` to the `msg.sender`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; recoveryData&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; a recovery commitment (hash&#x2F;ZKP public output) to be used &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * in the `recover` function to check a recovery proof validity.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; subscribe&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recoveryData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A function that revokes a smart account subscription.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST delete all the recovery data associated with the `msg.sender`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; unsubscribe&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A function to get a recovery data (commitment) of an account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the account to get the recovery data of.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; associated recovery data.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getRecoveryData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A function that checks if a recovery of a smart account (msg.sender)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * to the new subject is possible.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * SHOULD use `msg.sender`&amp;#39;s `recoveryData` to check the `proof` validity.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST ensure that the `proof` can&amp;#39;t be reused, e.g. update nonce.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; object&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the new object (may be different to subject) to recover the `msg.sender` access to.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; proof&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the recovery proof.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; recover&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; object&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; proof&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The AARI is expected to work with &lt;em&gt;any&lt;&#x2F;em&gt; account abstraction standard to allow for maximum account recovery flexibility. Whether it is &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;EIP-4337&lt;&#x2F;a&gt; or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt;, a particular smart account provider may support account recovery by simply implementing a common interface.&lt;&#x2F;p&gt;
&lt;p&gt;Since the whole account recovery process is nothing but proving the knowledge of some alternative secret to a private key, it is essential for accounts to be able to &quot;commit&quot; to this secret. The &lt;code&gt;subscribe&lt;&#x2F;code&gt; function in the recovery provider interface allows precisely for that. Moreover, if at some point in time a user wanted to &quot;recommit&quot; to a new secret (due to security reasons), they could multicall &lt;code&gt;unsubscribe&lt;&#x2F;code&gt; + &lt;code&gt;subscribe&lt;&#x2F;code&gt; functions to achieve the desired result.&lt;&#x2F;p&gt;
&lt;p&gt;The recovery functions accept arbitrary bytes as &lt;code&gt;subject&lt;&#x2F;code&gt; and &lt;code&gt;object&lt;&#x2F;code&gt; parameters to allow for a variety of access control rules to be recovered, since many smart accounts are ownerless and have no &quot;owner&quot; address to be directly substituted.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is fully backwards compatible.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;There are several security concerns to point out:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;It is up to a smart account developer to properly access control &lt;code&gt;addRecoveryProvider&lt;&#x2F;code&gt; and &lt;code&gt;removeRecoveryProvider&lt;&#x2F;code&gt; functions.&lt;&#x2F;li&gt;
&lt;li&gt;A smart account user may be &quot;phished&quot; to add a malicious recovery provider to their account. In that case, a recovery provider may gain full control over the account by accepting fake recovery proofs.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Available Attestation</title>
        <published>2025-04-30T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Mingfei Zhang</name><uri>https://github.com/Mart1i1n</uri><email>mingfei.zh@outlook.com</email>
	</author>
	
	<author>
		<name>Rujia Li</name><email>rujia@tsinghua.edu.cn</email>
	</author>
	
	<author>
		<name>Xueqian Lu</name><email>xueqian.lu@bitheart.org</email>
	</author>
	
	<author>
		<name>Sisi Duan</name><email>duansisi@tsinghua.edu.cn</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7942/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7942-available-attestation-a-reorg-resilient-solution-for-ethereum/23927" />
        

        <id>https://wg-eips.ritovision.com/7942/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7942"
            label="EIP-7942" />
        

        
        

        
        <summary type="html">A reorg-resilient solution for Ethereum</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7942/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes Available Attestation (AA), a protocol enhancement to make Ethereum PoS resilient against reorganization attacks. The proposal introduces a stability criterion for blocks based on attestation quorums, requiring that a block must include at least one-third of validators&#x27; attestations from the previous slot to be considered stable. The proposal includes three main changes: (1) modifying the parent selection rule to require AA from the previous slot, (2) replacing HLMD-GHOST with a Longest Stable Chain fork choice rule, and (3) adding a reference field to recent unstable blocks to preserve transaction continuity. These changes collectively prevent Byzantine validators from successfully executing reorganization attacks in synchronous networks while maintaining safety and liveness properties in partially synchronous networks. A full technical analysis is available in our &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7942&#x2F;.&#x2F;assets&#x2F;available-attestation-paper.pdf&quot;&gt;companion paper&lt;&#x2F;a&gt; accepted to USENIX Security 2025.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;We find that all known effective attacks on Ethereum PoS belong to reorganization attacks, although they emphasize different types of adversarial strategies. According to how the canonical chain is manipulated by the adversary, we classify known attacks into two categories: attacks from &lt;em&gt;changing block weight&lt;&#x2F;em&gt; and attacks from &lt;em&gt;filtering block tree&lt;&#x2F;em&gt;. The attacks from changing block weight refer to the strategy where Byzantine validators modify the &lt;em&gt;weight&lt;&#x2F;em&gt; of their proposed blocks to make their fork eventually become the canonical chain. Meanwhile, the attacks from filtering block tree do not change the block weight. Instead, these attacks make honest validators prune the canonical chain. This is often achieved by changing the &lt;em&gt;state&lt;&#x2F;em&gt; of honest validators. We summarize these malicious reorganization attacks in the following table.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;strong&gt;attack type&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;strong&gt;scheme&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;strong&gt;timing assumption&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;strong&gt;mitigation solution&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;strong&gt;limitation&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;changing block weight&lt;&#x2F;td&gt;&lt;td&gt;ex-ante reorg&lt;&#x2F;td&gt;&lt;td&gt;synchrony&lt;&#x2F;td&gt;&lt;td&gt;proposer boosting v1&lt;&#x2F;td&gt;&lt;td&gt;cause sandwich reorg&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;balancing attack&lt;&#x2F;td&gt;&lt;td&gt;synchrony&lt;&#x2F;td&gt;&lt;td&gt;proposer boosting v1&lt;&#x2F;td&gt;&lt;td&gt;cause sandwich reorg&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;sandwich reorg&lt;&#x2F;td&gt;&lt;td&gt;synchrony&lt;&#x2F;td&gt;&lt;td&gt;proposer boosting v2⋆&lt;&#x2F;td&gt;&lt;td&gt;cannot fully prevent&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;filtering block tree&lt;&#x2F;td&gt;&lt;td&gt;bouncing attack&lt;&#x2F;td&gt;&lt;td&gt;partial synchrony†&lt;&#x2F;td&gt;&lt;td&gt;safe-slots&lt;&#x2F;td&gt;&lt;td&gt;cannot fully prevent&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;unrealized justification reorg&lt;&#x2F;td&gt;&lt;td&gt;synchrony&lt;&#x2F;td&gt;&lt;td&gt;Capella upgrade&lt;&#x2F;td&gt;&lt;td&gt;cause staircase attack&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;justification withholding reorg&lt;&#x2F;td&gt;&lt;td&gt;synchrony&lt;&#x2F;td&gt;&lt;td&gt;Capella upgrade&lt;&#x2F;td&gt;&lt;td&gt;cause staircase attack&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;staircase attack&lt;&#x2F;td&gt;&lt;td&gt;synchrony&lt;&#x2F;td&gt;&lt;td&gt;Deneb upgrade&lt;&#x2F;td&gt;&lt;td&gt;cannot fully prevent&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;⋆ Proposer boosting parameter decreases from 0.7 to 0.4.&lt;br &#x2F;&gt;
† The attack is conducted after the network is synchronous.&lt;&#x2F;p&gt;
&lt;p&gt;In response to these vulnerabilities, mitigation approaches have been proposed from both academia and industry. They are often designed in an ad-hoc way, addressing one issue at a time. Without formal proof, these mitigation approaches may create new issues. For instance, to mitigate the ex-ante reorg attack and balancing attack, Ethereum implements the &lt;em&gt;proposer boosting&lt;&#x2F;em&gt; mechanism. By temporarily adjusting the weight of the block in the current slot, the forks created by the adversary will not become the canonical chain. However, this mitigation approach introduces new issues. A so-called &lt;em&gt;sandwich reorg attack&lt;&#x2F;em&gt; was later proposed, exploiting proposer boosting to create a reorg attack. The sandwich reorg attack is a variant of ex-ante reorg attacks where two Byzantine proposers collude to make the blocks by honest validators orphaned. Additionally, many known mitigation solutions lack formal analysis or introduce additional assumptions, e.g., by assuming that the ratio of stake controlled by the adversary is no more than 20%. Therefore, our approach aims to provide a provably secure and efficient solution that is resilient to reorg attacks in Ethereum PoS.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;overview&quot;&gt;Overview&lt;&#x2F;h3&gt;
&lt;p&gt;We provide a lightweight yet efficient solution for Ethereum PoS which is:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;reorg resilient in a synchronous network;&lt;&#x2F;li&gt;
&lt;li&gt;safe and live in a partially synchronous network;&lt;&#x2F;li&gt;
&lt;li&gt;easy to implement and deploy.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;We introduce AA, an approach inspired by conventional BFT protocols from &lt;em&gt;weak quorum&lt;&#x2F;em&gt; of attestations. Namely, consider a system with $N$ validators, among which at most $f$ are faulty. If $f+1$ validators vote for a block $b$ in slot $t$, at least one honest validator has validated $b$. The $f+1$ attestations become a &lt;em&gt;proof&lt;&#x2F;em&gt; of the availability of $b$. We use $AA_t$ to denote a block with $f+1$ attestations in slot $t$.&lt;&#x2F;p&gt;
&lt;p&gt;Putting the concept of weak quorums in the context of Ethereum PoS, we define AA as a mechanism that checks &lt;em&gt;whether a block includes matching attestations from at least one-third of validators&lt;&#x2F;em&gt; (For simplicity, we assume that all validators attest in every slot in this section). In particular, if $b$ is a block for slot $t$, its child must include attestations for $b$ from at least one-third of validators in slot $t$. We use the notion of &lt;em&gt;stable block&lt;&#x2F;em&gt; to describe this scenario.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;definition&quot;&gt;Definition&lt;&#x2F;h3&gt;
&lt;p&gt;Formally, we give the following definitions for AA:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;(AA) We use $AA_t$ to denote a block that receives more than one-third of attestations voting for it in slot $t$.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;(Stable block) &lt;em&gt;A block $b$ proposed in slot $t$ is a stable block if the parent of block $b$ is $AA_{t-1}$&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;(Unstable block) &lt;em&gt;Block $b$ is an unstable block if $b$ is not a stable block.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;(Stable chain) &lt;em&gt;The chain $c$ is a stable chain if the leaf block of $c$ is a stable block.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In practice, the validators are divided into 32 disjoint committees randomly. Since the committees are sampled pseudorandomly, the number of Byzantine validators in each committee can be approximated by a binomial distribution. We use $f$ as the number of total Byzantine validators and $f&#x27;$ as the expected number of Byzantine validators in each committee.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;We use $\vartheta$ to denote a threshold on the number of Byzantine validators in each committee and $p$ as the desirable failure probability (i.e., the probability that the number of Byzantine validators in a committee is greater than $\vartheta$).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Given the desired value $p$, the value of $\vartheta$ can be calculated using $\vartheta = \lfloor\mu + \sigma \cdot \Phi^{-1}(1 - p)\rfloor,$ where $\mu = f&#x27;$, $\sigma^2 = f&#x27;(1 - f&#x2F;n)$, and $\Phi^{-1}$ is the inverse of the cumulative distribution function of the normal distribution. We show some concrete examples of the ratio of Byzantine validators in a committee.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;n     \ p&lt;&#x2F;th&gt;&lt;th&gt;10⁻⁶&lt;&#x2F;th&gt;&lt;th&gt;10⁻⁷&lt;&#x2F;th&gt;&lt;th&gt;10⁻⁸&lt;&#x2F;th&gt;&lt;th&gt;10⁻⁹&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;2¹⁴&lt;&#x2F;td&gt;&lt;td&gt;0.4316&lt;&#x2F;td&gt;&lt;td&gt;0.4414&lt;&#x2F;td&gt;&lt;td&gt;0.4492&lt;&#x2F;td&gt;&lt;td&gt;0.4570&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;2¹⁶&lt;&#x2F;td&gt;&lt;td&gt;0.3828&lt;&#x2F;td&gt;&lt;td&gt;0.3872&lt;&#x2F;td&gt;&lt;td&gt;0.3916&lt;&#x2F;td&gt;&lt;td&gt;0.3955&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;2¹⁸&lt;&#x2F;td&gt;&lt;td&gt;0.3580&lt;&#x2F;td&gt;&lt;td&gt;0.3603&lt;&#x2F;td&gt;&lt;td&gt;0.3625&lt;&#x2F;td&gt;&lt;td&gt;0.3645&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;2²⁰&lt;&#x2F;td&gt;&lt;td&gt;0.3457&lt;&#x2F;td&gt;&lt;td&gt;0.3468&lt;&#x2F;td&gt;&lt;td&gt;0.3479&lt;&#x2F;td&gt;&lt;td&gt;0.3489&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Ethereum now has approximately $2^{20}$ validators. The maximum desirable probability $10^{-6}$ means that the protocol fails once every $10^{6}$ slots, i.e., 138 days. If the desirable failure probability is $10^{-9}$, malicious reorganization occurs once every 380 years. We can then draw the following conclusion:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;For a large $n$, the ratio of Byzantine validators is closer to $f&#x2F;n$. In this way, we can simply set $\vartheta$ as one-third of the committee size.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;protocol-changes&quot;&gt;Protocol Changes&lt;&#x2F;h3&gt;
&lt;p&gt;We make four main changes:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Modify the selection rule of parent.&lt;&#x2F;strong&gt; As mentioned in the overview, we require that a block $b$ in slot $t$ must include $\vartheta+1$ attestations to prove that the parent of block $b$ is a valid output in slot $t-1$. Therefore, the parent of block $b$ is the $AA_{t-1}$. Such a block is a stable block. If no $AA_{t-1}$ exists, the parent of block $b$ is the output of the fork choice rule. Such a block is an unstable block.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Replace HLMD-GHOST with Longest Stable Chain fork choice rule.&lt;&#x2F;strong&gt; We replace the HLMD GHOST with the longest chain as the fork choice rule. Our longest chain fork choice rule is very simple: it outputs the head of the chain with the most stable blocks. In case of a tie, the longest chain fork choice rule chooses the chain such that the leaf block has the largest slot number.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Blocks carry a reference &lt;code&gt;unstable_root&lt;&#x2F;code&gt; to recent unstable blocks to preserve transaction continuity.&lt;&#x2F;strong&gt; We additionally include a field &lt;code&gt;unstable_root&lt;&#x2F;code&gt; in a block b. Each proposer sets its &lt;code&gt;unstable_root&lt;&#x2F;code&gt; field as the hash of an unstable block. If there is no such unstable block, set &lt;code&gt;unstable_root&lt;&#x2F;code&gt; as None. The transactions in the unstable blocks should not conflict with the transactions in the longest chain. The transactions in &lt;code&gt;unstable_root&lt;&#x2F;code&gt; can also be finalized once block b (that includes &lt;code&gt;unstable_root&lt;&#x2F;code&gt;) is finalized.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Simplify the filtering rule and the justification process.&lt;&#x2F;strong&gt; We simplify the filtering rule as it only considers the chain that justifies the last justified checkpoint. Additionally, the justification process only updates when a chain crosses the epoch boundary.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;pseudocode&quot;&gt;Pseudocode&lt;&#x2F;h3&gt;
&lt;p&gt;The modifications are based on validator and fork-choice.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;modification-1&quot;&gt;Modification 1&lt;&#x2F;h4&gt;
&lt;p&gt;For the validator behavior specification (validator in consensus-specs):&lt;&#x2F;p&gt;
&lt;p&gt;To propose, the validator selects a &lt;code&gt;BeaconBlock&lt;&#x2F;code&gt;, &lt;code&gt;parent&lt;&#x2F;code&gt; using this process:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Compute AA blocks at the start of slot. Let &lt;code&gt;aa&lt;&#x2F;code&gt; be the later AA block and &lt;code&gt;aa_root&lt;&#x2F;code&gt; be the root of &lt;code&gt;aa&lt;&#x2F;code&gt;.
Set &lt;code&gt;parent_root = aa_root&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If no AA block exists, compute fork choice&#x27;s view of the head at the start of &lt;code&gt;slot&lt;&#x2F;code&gt;, after running
&lt;code&gt;on_tick&lt;&#x2F;code&gt; and applying any queued attestations from &lt;code&gt;slot - 1&lt;&#x2F;code&gt;. Set &lt;code&gt;parent_root = get_head(store)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Let &lt;code&gt;parent&lt;&#x2F;code&gt; be the block with &lt;code&gt;parent_root&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h4 id=&quot;modification-2&quot;&gt;Modification 2&lt;&#x2F;h4&gt;
&lt;p&gt;For the fork choice specification (fork_choice in consensus-specs):&lt;&#x2F;p&gt;
&lt;p&gt;Add a class called &lt;code&gt;chain&lt;&#x2F;code&gt; to manage the stable chains.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;dataclass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Chain&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;object&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    leaf&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    length&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    justified_checkpoint&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Checkpoint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Add chains in &lt;code&gt;store&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;dataclass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Store&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;object&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    chains&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Set&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Chain&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Modify &lt;code&gt;get_head&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_head&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;store&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Store&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get filtered block tree that only includes viable branches&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    chains&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_filtered_block_tree&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;store&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Execute the longest stable chain fork choice&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;chains&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;lambda&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; c&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; c&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;leaf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;modification-3&quot;&gt;Modification 3&lt;&#x2F;h4&gt;
&lt;p&gt;For the validator behavior specification (validator in consensus-specs):&lt;&#x2F;p&gt;
&lt;p&gt;Modify &lt;code&gt;Preparing for a BeaconBlock&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;To construct a &lt;code&gt;BeaconBlockBody&lt;&#x2F;code&gt;, a &lt;code&gt;block&lt;&#x2F;code&gt; (&lt;code&gt;BeaconBlock&lt;&#x2F;code&gt;) is defined with the necessary context for a block proposal:&lt;&#x2F;p&gt;
&lt;h5 id=&quot;unstable-root&quot;&gt;unstable_root&lt;&#x2F;h5&gt;
&lt;p&gt;Set &lt;code&gt;block.unstable_root&lt;&#x2F;code&gt; as the hash of the latest unstable block if such block exists. If none exists, set &lt;code&gt;block.unstable_root = None&lt;&#x2F;code&gt;. The transactions in &lt;code&gt;unstable_root&lt;&#x2F;code&gt; must not conflict with the stable chain and will be finalized once &lt;code&gt;block&lt;&#x2F;code&gt; is finalized.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;modification-4&quot;&gt;Modification 4&lt;&#x2F;h4&gt;
&lt;p&gt;For the fork choice specification (fork_choice in consensus-specs):&lt;&#x2F;p&gt;
&lt;p&gt;Modify &lt;code&gt;get_filtered_block_tree&lt;&#x2F;code&gt;. Only consider the chain that justifies the latest justified checkpoint.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_filtered_block_tree&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;store&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Store&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Chain&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    chains&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; chain&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; store&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;chains&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; is_equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;store&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;justified_checkpoint&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; chain&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;justified_checkpoint&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;root&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            chains&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;chain&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; chains&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Remove the fields &lt;code&gt;unrealized_justified_checkpoint&lt;&#x2F;code&gt; and &lt;code&gt;unrealized_finalized_checkpoint&lt;&#x2F;code&gt;. Remove &lt;code&gt;compute_pulled_up_tip&lt;&#x2F;code&gt;, i.e., remove the justification and finalization process that occurs during an epoch. The &lt;code&gt;justified_checkpoint&lt;&#x2F;code&gt; field of a chain is only updated when crossing an epoch boundary.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The reason why our approach is reorg resilient is that the AA mechanism &lt;em&gt;prevents&lt;&#x2F;em&gt; Byzantine validators from creating conflicting branches. As summarized in the table, there are two strategies for Byzantine validators: (1) Byzantine validators directly propose a block conflicting with the canonical chain and (2) Byzantine validators propose a block that extends the canonical chain and delay releasing the block. Neither of these strategies works anymore after AA is implemented. For the first type, only the leaf blocks in the block tree can be the output of the fork choice rule. If a Byzantine validator tries to create a block $b_1$ that extends a block $b_0$ that is not a leaf block, $b_0$ will receive no attestations from honest validators. Thus, block $b_1$ is an unstable block. For the second type, our approach ensures that if Byzantine validators withhold at least two stable blocks, one of them must have already been observed by &lt;em&gt;all&lt;&#x2F;em&gt; honest validators (see Lemma 2 in our paper for details).&lt;&#x2F;p&gt;
&lt;p&gt;Now it becomes clear why we use the &lt;em&gt;longest chain&lt;&#x2F;em&gt; rule to replace the HLMD-GHOST rule. Informally, as the HLMD-GHOST rule determines the canonical chain based on the weight of the blocks, and the weight is determined by the number of attestations, the HLMD-GHOST rule cannot prevent adversaries from withholding their attestations.&lt;&#x2F;p&gt;
&lt;p&gt;Our modified protocol can achieve the safety and liveness properties of the consensus protocol. Safety still holds since we do not modify Casper, the finality gadget protocol. Liveness is achieved after GST mainly because our protocol is reorg resilient in a synchronous network. As all honest validators consider the blocks proposed by honest validators to be part of the longest chain, their attestations will be considered valid by all honest validators, so eventually some block is finalized.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The proposal modifies the fork choice logic and attestation format, which may not be compatible with existing clients. A hard fork or protocol version flag will be required for deployment.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Resilience to reorg attacks&lt;&#x2F;strong&gt;: The protocol is provably resilient to all known forms of reorg attacks in synchronous networks.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;No new attack surfaces&lt;&#x2F;strong&gt;: The protocol avoids introducing new message types or unnecessary overhead.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Safe and live&lt;&#x2F;strong&gt;: Maintains standard safety and liveness in partially synchronous networks.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;A full formal proof of correctness and evaluation over 16,384 validators is provided in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7942&#x2F;.&#x2F;assets&#x2F;available-attestation-paper.pdf&quot;&gt;companion paper&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Count leading zeros (CLZ) opcode</title>
        <published>2025-04-28T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vectorized</name><uri>https://github.com/Vectorized</uri>
	</author>
	
	<author>
		<name>Georgios Konstantopoulos</name><uri>https://github.com/gakonst</uri>
	</author>
	
	<author>
		<name>Jochem Brouwer</name><uri>https://github.com/jochem-brouwer</uri>
	</author>
	
	<author>
		<name>Ben Adams</name><uri>https://github.com/benaadams</uri>
	</author>
	
	<author>
		<name>Giulio Rebuffo</name><uri>https://github.com/Giulio2002</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7939/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/create-a-new-opcode-for-counting-leading-zeros-clz/10805" />
        

        <id>https://wg-eips.ritovision.com/7939/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7939"
            label="EIP-7939" />
        

        
        

        
        <summary type="html">Opcode to count the number of leading zero bits in a 256-bit word</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7939/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce a new opcode, &lt;code&gt;CLZ(x)&lt;&#x2F;code&gt;, which pops &lt;code&gt;x&lt;&#x2F;code&gt; from the stack and pushes the number of leading zero bits in &lt;code&gt;x&lt;&#x2F;code&gt; to the stack. If &lt;code&gt;x&lt;&#x2F;code&gt; is zero, pushes 256.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Count leading zeros (CLZ) is a native opcode in many processor architectures (even in RISC architectures like ARM).&lt;&#x2F;p&gt;
&lt;p&gt;It is a basic building block used in math operations, byte operations, compression algorithms, data structures:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;lnWad&lt;&#x2F;li&gt;
&lt;li&gt;powWad&lt;&#x2F;li&gt;
&lt;li&gt;lambertW0Wad&lt;&#x2F;li&gt;
&lt;li&gt;sqrt&lt;&#x2F;li&gt;
&lt;li&gt;cbrt&lt;&#x2F;li&gt;
&lt;li&gt;byte string comparisons&lt;&#x2F;li&gt;
&lt;li&gt;generalized calldata compression&#x2F;decompression&lt;&#x2F;li&gt;
&lt;li&gt;bitmaps (for finding the next&#x2F;previous set&#x2F;unset bit)&lt;&#x2F;li&gt;
&lt;li&gt;post quantum signature schemes&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Adding a &lt;code&gt;CLZ&lt;&#x2F;code&gt; opcode will:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Lead to cheaper compute.&lt;&#x2F;li&gt;
&lt;li&gt;Lead to cheaper ZK proving costs. The fastest known Solidity implementation uses several dynamic bitwise right shifts &lt;code&gt;shr&lt;&#x2F;code&gt;, which are very expensive to prove. In SP1 rv32im, a 32-bit right shift costs 1.6x more than a 32-bit mul.&lt;&#x2F;li&gt;
&lt;li&gt;Lead to smaller bytecode size. The fastest known Solidity implementation contains several large constants and is often inlined for performance.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;A new opcode is introduced: &lt;code&gt;CLZ&lt;&#x2F;code&gt; (&lt;code&gt;0x1e&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Pops 1 value from the stack.&lt;&#x2F;li&gt;
&lt;li&gt;Pushes a value to the stack, according to the following code:&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Count leading zeros.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the number of zeros preceding the most significant one bit.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If `x` is zero, returns 256.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This is the fastest known `CLZ` implementation in Solidity and uses about 184 gas.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; clz&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; x&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; r&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @solidity memory-safe-assembly&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        r &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; shl&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; lt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        r &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; or&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; shl&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;6&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; lt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xffffffffffffffff&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; shr&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        r &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; or&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; shl&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;5&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; lt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xffffffff&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; shr&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        r &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; or&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; shl&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; lt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xffff&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; shr&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        r &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; or&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; shl&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; lt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xff&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; shr&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; forgefmt: disable-next-item&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        r &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;xor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; byte&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;and&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x1f&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; shr&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;shr&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x8421084210842108cc6318c6db6d54be&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;            0xf8f9f9faf9fdfafbf9fdfcfdfafbfcfef9fafdfafcfcfbfefafafcfbffffffff&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; iszero&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;x&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Or in Python,&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; clz&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;x&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Returns the number of zeros preceding the most significant one bit.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        raise&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; ValueError&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;clz is undefined for negative numbers&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        raise&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; ValueError&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;clz is undefined for numbers larger than 2**256 - 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Convert to binary string and remove any &amp;#39;0b&amp;#39; prefix.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bin_str&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bin&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;x&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;replace&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;bin_str&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Or in C++,&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;cpp&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;inline&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; uint32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; clz&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;uint32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; x&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    uint32_t&lt;&#x2F;span&gt;&lt;span&gt; r &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;x &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;FFFF0000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt; r &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 16&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; x &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 16&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;x &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;FF000000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt; r &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;  x &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;x &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;F0000000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt; r &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;  x &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;x &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;C0000000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt; r &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;  x &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;x &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;80000000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt; r &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; r&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `x` is a uint256 bit number represented with 8 uint32 limbs.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This implementation is optimized for SP1 proving via rv32im.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; For regular compute, it performs similarly to `ADD`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;inline&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; uint32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; clz&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;uint32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; x&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;8&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;x&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; clz&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;x&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;x&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;6&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; clz&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;x&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;6&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;x&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;5&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 64&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; clz&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;x&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;5&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;x&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 96&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; clz&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;x&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;x&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 128&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; clz&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;x&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;x&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 160&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; clz&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;x&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;x&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 192&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; clz&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;x&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;x&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 224&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; clz&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;x&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 256&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The cost of the opcode is 5, matching MUL (raised from 3 to avoid under-pricing DoS risk).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;the-special-0-case&quot;&gt;The special 0 case&lt;&#x2F;h3&gt;
&lt;p&gt;256 is the smallest number after 255. Returning a small number allows the result to be compared with minimal additional bytecode.&lt;&#x2F;p&gt;
&lt;p&gt;For byte scanning operations, one can get the number of bytes to be skipped for a zero word by simply computing &lt;code&gt;256 &amp;gt;&amp;gt; 3&lt;&#x2F;code&gt;, which gives 32.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;preference-over-ctz-count-trailing-zeros&quot;&gt;Preference over &lt;code&gt;CTZ&lt;&#x2F;code&gt; (count trailing zeros)&lt;&#x2F;h3&gt;
&lt;p&gt;Computing the least significant bit can be easily implemented with &lt;code&gt;CLZ&lt;&#x2F;code&gt; by isolating the smallest bit via &lt;code&gt;x &amp;amp; -x&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;However, it is not possible to implement &lt;code&gt;CLZ&lt;&#x2F;code&gt; with &lt;code&gt;CTZ&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-cost&quot;&gt;Gas cost&lt;&#x2F;h3&gt;
&lt;p&gt;We have benchmarked the &lt;code&gt;CLZ&lt;&#x2F;code&gt; implementation against the &lt;code&gt;ADD&lt;&#x2F;code&gt; implementation in the intx library. &lt;code&gt;CLZ&lt;&#x2F;code&gt; uses approximately the same amount of compute cycles as &lt;code&gt;ADD&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The SP1 rv32im optimized variant uses less compute cycles than &lt;code&gt;ADD&lt;&#x2F;code&gt;, in the average and worst cases.&lt;&#x2F;p&gt;
&lt;p&gt;In SP1 rv32im, a 256-bit &lt;code&gt;CLZ&lt;&#x2F;code&gt; is cheaper to prove than &lt;code&gt;ADD&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This is a new opcode not present prior.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH32 0x000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CLZ&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0000000000000000000000000000000000000000000000000000000000000100&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH32 0x8000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CLZ&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH32 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CLZ&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH32 0x4000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CLZ&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH32 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CLZ&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH32 0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CLZ&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x00000000000000000000000000000000000000000000000000000000000000ff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;CLZ&lt;&#x2F;code&gt; is a stateless opcode that has a low worst-case constant cost in memory usage, compute and proving costs. It is therefore safe from being exploited for denial of service attacks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EVM64 - 64-bit mode EVM opcodes</title>
        <published>2025-04-23T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Wei Tang</name><uri>https://github.com/sorpaas</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7937/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-9687-64-bit-mode-evm-operations/23794" />
        

        <id>https://wg-eips.ritovision.com/7937/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7937"
            label="EIP-7937" />
        

        
        

        
        <summary type="html">Multibyte opcodes for 64-bit arithmetic, comparison, bitwise and flow operations in EVM.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7937/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces multibyte opcodes prefixed by &lt;code&gt;C0&lt;&#x2F;code&gt; for 64-bit arithmetic (&lt;code&gt;C001&lt;&#x2F;code&gt;-&lt;code&gt;C00B&lt;&#x2F;code&gt;), comparison (&lt;code&gt;C010&lt;&#x2F;code&gt;-&lt;code&gt;C015&lt;&#x2F;code&gt;), bitwise (&lt;code&gt;C016&lt;&#x2F;code&gt;-&lt;code&gt;C019&lt;&#x2F;code&gt;) and flow (&lt;code&gt;C056&lt;&#x2F;code&gt; and &lt;code&gt;C057&lt;&#x2F;code&gt;) operations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Not all computations in EVM can utilize the full 256-bit integer width. It can therefore be beneficial to have a &quot;64-bit mode&quot; to avoid unnecessary cycles. This EIP uses a &quot;prefix&quot; opcode &lt;code&gt;C0&lt;&#x2F;code&gt;, essentially forming multibyte opcodes to avoid polluting the EVM opcode space too much.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;prefix-opcode-behavior&quot;&gt;Prefix opcode behavior&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP uses the prefix opcode &lt;code&gt;C0&lt;&#x2F;code&gt;, and it only occupies this single EVM opcode space. Upon the interpreter encountering opcode &lt;code&gt;C0&lt;&#x2F;code&gt;, it MUST continue to seek the next byte in code. It then executes things in &quot;64-bit mode&quot;, based on the second byte, described below. If the execution is successful, then the interpreter MUST increase &lt;code&gt;PC&lt;&#x2F;code&gt; by 2 (instead of 1).&lt;&#x2F;p&gt;
&lt;p&gt;If the second byte is not a valid 64-bit mode operation, then the interpreter MUST OOG.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;general-64-bit-mode-behavior&quot;&gt;General 64-bit mode behavior&lt;&#x2F;h3&gt;
&lt;p&gt;In 64-bit mode, all operations only work on the least significant 64-bit of each stack value. The most significant 192-bit is discarded. When a result value is pushed back onto the stack, then it MUST ensures that observable effects will see that the most significant 192-bit is zero. Note that here it&#x27;s not necessary for an interpreter to reset the most significant 192-bit to zero every time -- if the next opcode is still in 64-bit mode, then the most significant 192-bit is still unobservable. We discuss the full details in the &quot;rationale&quot; section. The interpreter only needs to reproduce the full 256-bit value upon entering non-64-bit mode. If the full computational heavy part can be written in pure 64-bit mode, then this can result in noticeable performance gain.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-cost-constants&quot;&gt;Gas cost constants&lt;&#x2F;h3&gt;
&lt;p&gt;We define the following gas cost constants:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;G_BASE64&lt;&#x2F;code&gt;: 1&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;G_VERYLOW64&lt;&#x2F;code&gt;: 2&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;G_LOW64&lt;&#x2F;code&gt;: 3&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;G_MID64&lt;&#x2F;code&gt;: 5&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;G_HIGH64&lt;&#x2F;code&gt;: 7&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;G_EXP64_STATIC&lt;&#x2F;code&gt;: 5&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;G_EXP64_DYNAMIC&lt;&#x2F;code&gt;: 25&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;arithmetic-opcodes&quot;&gt;Arithmetic opcodes&lt;&#x2F;h3&gt;
&lt;p&gt;The 64-bit mode arithmetic opcodes are defined the same as non-64-bit mode, except that it only operates on the least significant 64-bits. In the below definition, &lt;code&gt;a&lt;&#x2F;code&gt;, &lt;code&gt;b&lt;&#x2F;code&gt;, &lt;code&gt;N&lt;&#x2F;code&gt; is &lt;code&gt;a mod 2^64&lt;&#x2F;code&gt;, &lt;code&gt;b mod 2^64&lt;&#x2F;code&gt; and &lt;code&gt;N mod 2^64&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;ADD (&lt;code&gt;C001&lt;&#x2F;code&gt;) and SUB (&lt;code&gt;C003&lt;&#x2F;code&gt;): &lt;code&gt;a op b mod 2^64&lt;&#x2F;code&gt;, gas cost &lt;code&gt;G_VERYLOW64&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;MUL (&lt;code&gt;C002&lt;&#x2F;code&gt;), DIV (&lt;code&gt;C004&lt;&#x2F;code&gt;), SDIV (&lt;code&gt;C005&lt;&#x2F;code&gt;), MOD (&lt;code&gt;C006&lt;&#x2F;code&gt;), SMOD (&lt;code&gt;C007&lt;&#x2F;code&gt;), SIGNEXTEND (&lt;code&gt;C00B&lt;&#x2F;code&gt;): &lt;code&gt;a op b mod 2^64&lt;&#x2F;code&gt;, gas cost &lt;code&gt;G_LOW64&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;ADDMOD (&lt;code&gt;C008&lt;&#x2F;code&gt;), MULMOD (&lt;code&gt;C009&lt;&#x2F;code&gt;): &lt;code&gt;a op b % N mod 2^64&lt;&#x2F;code&gt;, gas cost &lt;code&gt;G_MID64&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;EXP (&lt;code&gt;C00A&lt;&#x2F;code&gt;): &lt;code&gt;a EXP b mod 2^64&lt;&#x2F;code&gt;, gas cost &lt;code&gt;static_gas = G_EXP64_STATIC, dynamic_gas = G_EXP64_DYNAMIC * exponent_byte_size&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;comparison-and-bitwise-opcodes&quot;&gt;Comparison and bitwise opcodes&lt;&#x2F;h3&gt;
&lt;p&gt;The 64-bit mode comparison and bitwise opcodes are defined the same as non-64-bit mode, except that they only operates on the least significant 64 bits.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;LT (&lt;code&gt;C010&lt;&#x2F;code&gt;), GT (&lt;code&gt;C011&lt;&#x2F;code&gt;), SLT (&lt;code&gt;C012&lt;&#x2F;code&gt;), SGT (&lt;code&gt;C013&lt;&#x2F;code&gt;), EQ (&lt;code&gt;C014&lt;&#x2F;code&gt;), AND (&lt;code&gt;C016&lt;&#x2F;code&gt;), OR (&lt;code&gt;C017&lt;&#x2F;code&gt;), XOR (&lt;code&gt;C018&lt;&#x2F;code&gt;): &lt;code&gt;a op b mod 2^64&lt;&#x2F;code&gt;, gas cost &lt;code&gt;G_VERYLOW64&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;ISZERO (&lt;code&gt;C015&lt;&#x2F;code&gt;), NOT (&lt;code&gt;C019&lt;&#x2F;code&gt;): &lt;code&gt;op a mod 2^64&lt;&#x2F;code&gt;, gas cost &lt;code&gt;G_VERYLOW64&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;SHL (&lt;code&gt;C01B&lt;&#x2F;code&gt;), SHR (&lt;code&gt;C01C&lt;&#x2F;code&gt;), SAR (&lt;code&gt;C01D&lt;&#x2F;code&gt;): &lt;code&gt;a op N mod 2^64&lt;&#x2F;code&gt;, gas cost &lt;code&gt;G_VERYLOW64&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note that:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;64-bit EQ (&lt;code&gt;C014&lt;&#x2F;code&gt;) may return true for two different integers because it&#x27;ll only compare the least significant 64 bits.&lt;&#x2F;li&gt;
&lt;li&gt;64-bit ISZERO (&lt;code&gt;C015&lt;&#x2F;code&gt;) may return true for non-zero 256-bit integers as long as the last 64 bits are zero.&lt;&#x2F;li&gt;
&lt;li&gt;BYTE (&lt;code&gt;1A&lt;&#x2F;code&gt;) does not have 64-bit mode because it affects endianness.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;jump-jumpi&quot;&gt;JUMP, JUMPI&lt;&#x2F;h3&gt;
&lt;p&gt;For flow operations JUMP and JUMPI, the behavior is as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;JUMP&lt;&#x2F;code&gt; (&lt;code&gt;C056&lt;&#x2F;code&gt;) will only read the last 64 bits from the stack value. The rest 192 bits are discarded without reading. Gas cost is &lt;code&gt;G_MID64&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;JUMPI&lt;&#x2F;code&gt; (&lt;code&gt;C057&lt;&#x2F;code&gt;) will only read the last 64 bits from the stack as destination, and the condition check will only read the last 64 bits. Gas cost is &lt;code&gt;G_HIGH64&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;In &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; validation phrase, &lt;code&gt;C0&lt;&#x2F;code&gt; is considered a standalone &quot;mode&quot; opcode and if the next byte followed is &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt;, it continues to mark a valid &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; destination. Note that because there&#x27;s no 64-bit &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt;, during execution, &lt;code&gt;C0 JUMPDEST&lt;&#x2F;code&gt; would result in OOG.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;When a smart contract uses the 64-bit mode, it&#x27;s expected that once entered, it will want to stay in 64-bit mode, and only exit to non-64-bit mode when the computationally intensive function is finished. This EIP is designed particularly with this fact in mind.&lt;&#x2F;p&gt;
&lt;p&gt;All 64-bit opcodes only operates on the 64-bit value. It totally discards the rest 192 bits. The interpreter only needs to ensure that when it exits into non-64-bit mode and next time when a value result is read, that value has the first 192 bits reset to zero. The EVM interpreter can therefore use a typed stack for optimization:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;haskell&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; StackItem&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; Value&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; U256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; Value64&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; U64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The typed stack can also be implemented as a bitmap for memory alignment.&lt;&#x2F;p&gt;
&lt;p&gt;For all inputs of 64-bit opcodes, it will either read in a &lt;code&gt;Value&lt;&#x2F;code&gt;, when it&#x27;ll only take the last 64 bits, or a &lt;code&gt;Value64&lt;&#x2F;code&gt;, which is what is needed. It then always outputs a &lt;code&gt;Value64&lt;&#x2F;code&gt;. After exiting into non-64-bit mode and upon a &lt;code&gt;Value64&lt;&#x2F;code&gt; is read, the interpreter then translate the value back to 256-bit &lt;code&gt;Value&lt;&#x2F;code&gt; by extending the first 192 bits with zero.&lt;&#x2F;p&gt;
&lt;p&gt;The 64-bit mode does not contain any opcodes which depends on the value&#x27;s endianness, therefore &lt;code&gt;Value64&lt;&#x2F;code&gt; can also be stored in the optimal endianness of the architecture.&lt;&#x2F;p&gt;
&lt;p&gt;The 64-bit mode will not save any memory usage.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;discussions&quot;&gt;Discussions&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;prefix-modes-opcodes&quot;&gt;Prefix (modes) opcodes&lt;&#x2F;h4&gt;
&lt;p&gt;This EIP also recommends that we reserve &lt;code&gt;C0&lt;&#x2F;code&gt;-&lt;code&gt;CF&lt;&#x2F;code&gt; for prefix (modes) opcodes. For example, an additional modes OVERFLOW can be envisioned that changes the behavior of arithmetic opcodes from wrapping to overflow OOG, which can help to reduce, for example, the extra cycles needed for &lt;code&gt;SafeMath&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;optimization-assumptions&quot;&gt;Optimization assumptions&lt;&#x2F;h4&gt;
&lt;p&gt;This EIP assumes that the majority of EVM implementations target native little-endian 64-bit architectures (like &lt;code&gt;x86_64&lt;&#x2F;code&gt;, &lt;code&gt;arm64&lt;&#x2F;code&gt; and &lt;code&gt;riscv64&lt;&#x2F;code&gt;). A 256-bit stack item is stored efficiently internally as 4 items of 64-bit unsigned integer &lt;code&gt;[u64; 4]&lt;&#x2F;code&gt;. This EIP works best, in terms of optimizations, for those implementations. The opcodes simply operates on the last &lt;code&gt;u64&lt;&#x2F;code&gt;, instead of the whole &lt;code&gt;[u64; 4]&lt;&#x2F;code&gt;. There are basically no other changes.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;endianness&quot;&gt;Endianness&lt;&#x2F;h4&gt;
&lt;p&gt;In 64-bit mode, the principle of the specification is that the endianness should be kept strictly as an implementation detail. There should not be any opcodes that depends on endian. This is important, because on the one hand, we must enable easy and fast interop for 64-bit and non-64-bit opcodes. On the other hand, the interpreter should be able to do optimizations internally whether it uses little or big endian.&lt;&#x2F;p&gt;
&lt;p&gt;Due to the issue of endianness, this EIP currently does not contain 64-bit mode &lt;code&gt;BYTE64&lt;&#x2F;code&gt;, memory opcodes &lt;code&gt;MLOAD64&lt;&#x2F;code&gt; and &lt;code&gt;MSTORE64&lt;&#x2F;code&gt;, and stack push opcodes &lt;code&gt;PUSH*64&lt;&#x2F;code&gt; (&lt;code&gt;PUSH1&lt;&#x2F;code&gt; to &lt;code&gt;PUSH8&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;It is possible to extend EVM64 where &quot;64-bit mode&quot; is instead defined as &quot;little-endian 64-bit mode&quot;, which can be separately discussed and specified:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;BYTE64&lt;&#x2F;code&gt; will be little-endian, so instead of &lt;code&gt;(x &amp;gt;&amp;gt; (248 - i * 8)) &amp;amp; 0xFF&lt;&#x2F;code&gt;, it will be &lt;code&gt;(x &amp;gt;&amp;gt; i * 8) &amp;amp; 0xFF&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;MLOAD64&lt;&#x2F;code&gt; and &lt;code&gt;MSTORE64&lt;&#x2F;code&gt; loads and store little-endian 64-bit values in memory.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;PUSH*64&lt;&#x2F;code&gt; (&lt;code&gt;PUSH1&lt;&#x2F;code&gt; to &lt;code&gt;PUSH8&lt;&#x2F;code&gt;) accepts literal little-endian bytes.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In specification there is no issue with the design, but this can bring significant confusions to developers. So the author advise caution.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;pop-dup-swap&quot;&gt;&lt;code&gt;POP&lt;&#x2F;code&gt;, &lt;code&gt;DUP*&lt;&#x2F;code&gt;, &lt;code&gt;SWAP*&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;There is no explicit 64-bit mode for stack operations:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;POP&lt;&#x2F;code&gt; is &quot;automatically 64-bit&quot; because it only removes values from the stack.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;DUP*&lt;&#x2F;code&gt; and &lt;code&gt;SWAP*&lt;&#x2F;code&gt; will copy or swap stack items optimized for 64-bit as is. They are kept optimized, so there&#x27;s no need for separate 64-bit mode for those opcodes.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;drawbacks&quot;&gt;Drawbacks&lt;&#x2F;h4&gt;
&lt;p&gt;Known drawbacks and tradeoffs of 64-bit mode includes:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The binary size will become larger. This is apparent as previously the opcode is single byte, but now it is two bytes. Each byte costs an additional 200 gas to deposit. However, 64-bit mode opcodes are (generally) cheaper, which gives developers sufficient incentives to utilize it (at most 200 calls and the cumulative gas costs will be cheaper).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a new (prefix) opcode &lt;code&gt;C0&lt;&#x2F;code&gt;. &lt;code&gt;C0&lt;&#x2F;code&gt; was previously an invalid opcode that has little usage, and thus the backward compatibility issues are minimal.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases are organized as &lt;code&gt;[stack_item_1, stack_item_2] C0 opcode =&amp;gt; [result_stack_item_1, result_stack_item_2]&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;[ff00000000000000 000000000000000 0000000000000ff 000000000000001, ff0000000000000 000000000000000 0000000000000ff f0000000000000f] C0 SHR =&amp;gt; [&amp;lt;0&amp;gt; 780000000000007]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;To be added.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;To be added.&lt;&#x2F;p&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Versioned Proxy Contract Interface</title>
        <published>2025-04-17T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Raphina Liu</name><uri>https://github.com/Stamp9</uri>
	</author>
	
	<author>
		<name>Monica Jin</name><uri>https://github.com/mokita-j</uri>
	</author>
	
	<author>
		<name>Martin Monperrus</name><uri>https://github.com/monperrus</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7936/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/new-erc-versioned-proxy-contract-interface/23743" />
        

        <id>https://wg-eips.ritovision.com/7936/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7936"
            label="ERC-7936" />
        

        
        

        
        <summary type="html">Multi-version proxy contracts that allow callers to select implementation</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7936/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP standardizes an interface for proxy contracts that allows callers to explicitly select which version of an implementation contract they want to interact with. Unlike traditional proxy patterns that only expose the latest implementation, this standard enables backward compatibility by maintaining access to previous implementations while supporting upgrades. The versioned proxy maintains a registry of implementation addresses mapped to version identifiers, allowing callers to specify their desired version at call time.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Smart contract upgrades are essential for fixing bugs and adding features. Current proxy patterns typically force all callers to use the latest implementation, which can break existing integrations when interfaces change.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore, traditional proxy patterns expose all users to risk if an upgrade is malicious, as they have no choice but to use the latest implementation. This standard allows users to remain on verified versions they trust, mitigating the risk of a compromised admin key or governance process deploying harmful code.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP addresses several key problems:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Breaking Changes&lt;&#x2F;strong&gt;: Interface changes in new implementations can break existing integrations.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Gradual Adoption&lt;&#x2F;strong&gt;: There is no standard way to allow gradual adoption of new contract versions.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Malicious Upgrades&lt;&#x2F;strong&gt;: Users today must trust proxy admins indefinitely, as they can&#x27;t opt out of potentially harmful upgrades without ceasing use of the contract entirely.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Trust Assumptions&lt;&#x2F;strong&gt;: Contract users must maintain perpetual trust in governance or admin keys, with no ability to selectively trust specific, audited implementations.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;interface&quot;&gt;Interface&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IVersionedProxy&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a new implementation version is registered&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; version&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The version identifier&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; implementation&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the implementation contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; VersionRegistered&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; version&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; implementation&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when the default version is &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; oldVersion&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The previous default version&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; newVersion&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The new default version&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DefaultVersionChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; oldVersion&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newVersion&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Registers a new implementation version&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; version&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The version identifier (e.g., &amp;quot;1.0.0&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; implementation&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the implementation contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; registerVersion&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; version&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; implementation&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Removes a version from the registry&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; version&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The version identifier to remove&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; removeVersion&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; version&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sets the default version to use when no version is specified&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; version&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The version identifier to set as default&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setDefaultVersion&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; version&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Gets the implementation address for a specific version&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; version&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The version identifier&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; implementation address for the specified version&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getImplementation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; version&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Gets the current default version&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; current default version identifier&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getDefaultVersion&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Gets all registered versions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; An&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of all registered version identifiers&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getVersions&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Executes a call to a specific implementation version&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; version&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The version identifier of the implementation to call&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The calldata to forward to the implementation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; return data from the implementation call&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; executeAtVersion&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; version&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;behavior-requirements&quot;&gt;Behavior Requirements&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;The proxy contract MUST maintain a mapping of version identifiers to implementation addresses.&lt;&#x2F;li&gt;
&lt;li&gt;The proxy contract MUST maintain a default version that is used when no version is specified.&lt;&#x2F;li&gt;
&lt;li&gt;When &lt;code&gt;executeAtVersion&lt;&#x2F;code&gt; is called, the proxy MUST:
&lt;ul&gt;
&lt;li&gt;Verify the specified version exists&lt;&#x2F;li&gt;
&lt;li&gt;Forward the call to the corresponding implementation&lt;&#x2F;li&gt;
&lt;li&gt;Return any data returned by the implementation&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The proxy contract MUST emit appropriate events when versions are registered, or when the default version changes.&lt;&#x2F;li&gt;
&lt;li&gt;The proxy contract SHOULD implement access control for administrative functions (registering versions, setting default).&lt;&#x2F;li&gt;
&lt;li&gt;The proxy contract MAY implement &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1967&#x2F;&quot;&gt;EIP-1967&lt;&#x2F;a&gt; storage slots for compatibility with existing tools.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;fallback-function&quot;&gt;Fallback Function&lt;&#x2F;h3&gt;
&lt;p&gt;The proxy contract SHOULD implement a fallback function that forwards calls to the default implementation version when no version is specified. This maintains compatibility with traditional proxy patterns.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;version-identifiers-as-bytes32&quot;&gt;Version Identifiers as bytes32&lt;&#x2F;h3&gt;
&lt;p&gt;Version identifiers are specified as &lt;code&gt;bytes32&lt;&#x2F;code&gt; rather than semantic versioning strings to:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Provide flexibility in versioning schemes&lt;&#x2F;li&gt;
&lt;li&gt;Reduce gas costs for storage and comparison&lt;&#x2F;li&gt;
&lt;li&gt;Allow for both string-based versions (converted to bytes32) and numeric versions&lt;&#x2F;li&gt;
&lt;li&gt;Allow for storing a Git commit identifier in SHA-1 or SHA-256&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;explicit-version-selection&quot;&gt;Explicit Version Selection&lt;&#x2F;h3&gt;
&lt;p&gt;The standard requires callers to explicitly select a version through &lt;code&gt;executeAtVersion&lt;&#x2F;code&gt; rather than encoding version information in the call data to:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Maintain a clean separation between version selection and function calls&lt;&#x2F;li&gt;
&lt;li&gt;Avoid modifying existing function signatures&lt;&#x2F;li&gt;
&lt;li&gt;Make version selection explicit and auditable&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;registry-pattern&quot;&gt;Registry Pattern&lt;&#x2F;h3&gt;
&lt;p&gt;The registry pattern was chosen over alternatives like:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Multiple Proxies&lt;&#x2F;strong&gt;: Having separate proxies for each version would increase deployment costs and complexity&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Version in Storage&lt;&#x2F;strong&gt;: Storing a single &quot;current version&quot; would not allow different callers to use different versions simultaneously&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;default-version&quot;&gt;Default Version&lt;&#x2F;h3&gt;
&lt;p&gt;The default version mechanism allows the proxy to maintain compatibility with traditional proxy patterns and supports callers that don&#x27;t need to specify a version.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is designed to enhance backward compatibility for smart contracts. It does not introduce any backward incompatibilities with existing Ethereum standards or implementations.&lt;&#x2F;p&gt;
&lt;p&gt;Existing contracts that interact with proxy contracts can continue to do so without modification, as the fallback function will route calls to the default implementation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is meant to significantly improve the security of the widely used proxy pattern.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>RLP Execution Block Size Limit</title>
        <published>2025-04-16T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Giulio Rebuffo</name><uri>https://github.com/Giulio2002</uri>
	</author>
	
	<author>
		<name>Ben Adams</name><uri>https://github.com/benaadams</uri>
	</author>
	
	<author>
		<name>Storm Slivkoff</name><uri>https://github.com/sslivkoff</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7934/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7934-add-bytesize-limit-to-blocks/23589" />
        

        <id>https://wg-eips.ritovision.com/7934/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7934"
            label="EIP-7934" />
        

        
        

        
        <summary type="html">Introduce a protocol-level cap on the maximum RLP-encoded block size to 10 MiB, including a 2 MiB margin for beacon block size.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7934/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal introduces a protocol-level cap on the maximum RLP-encoded execution block size to 10 megabytes (MiB), which includes a margin of 2 MiB to account for beacon block sizes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, Ethereum does not enforce a strict upper limit on the encoded size of blocks. This lack of constraint can result in:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Network Instability&lt;&#x2F;strong&gt;: Extremely large blocks slow down propagation and increase the risk of temporary forks and reorgs.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;DoS Risks&lt;&#x2F;strong&gt;: Malicious actors could generate exceptionally large blocks to disrupt network performance.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Additionally, blocks exceeding 10 MiB are not propagated by the consensus layer&#x27;s (CL) gossip protocol, potentially causing network fragmentation or denial-of-service (DoS) conditions.&lt;&#x2F;p&gt;
&lt;p&gt;By imposing a protocol-level limit on the RLP-encoded block size, Ethereum can ensure enhanced resilience against targeted attacks on block validation times. Adding an additional margin of 2MiB explicitly accommodates beacon block sizes, ensuring compatibility across network components.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;block-size-cap&quot;&gt;Block Size Cap&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Introduce constants:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;MAX_BLOCK_SIZE&lt;&#x2F;code&gt; set to &lt;strong&gt;10 MiB (10,485,760 bytes)&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SAFETY_MARGIN&lt;&#x2F;code&gt; set to &lt;strong&gt;2MiB (2,097,152  bytes)&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;MAX_RLP_BLOCK_SIZE&lt;&#x2F;code&gt; calculated as &lt;code&gt;MAX_BLOCK_SIZE - MARGIN&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Any RLP-encoded block exceeding &lt;code&gt;MAX_RLP_BLOCK_SIZE&lt;&#x2F;code&gt; must be considered invalid.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Thus add the following check to the Ethereum protocol:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;MAX_BLOCK_SIZE&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10_485_760&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 10 MiB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;SAFETY_MARGIN&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2_097_152&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 2 MiB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;MAX_RLP_BLOCK_SIZE&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_BLOCK_SIZE&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SAFETY_MARGIN&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if true, the block is invalid and should be rejected&#x2F;not get built&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; exceed_max_rlp_block_size&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;rlp&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_RLP_BLOCK_SIZE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;changes-to-protocol-behavior&quot;&gt;Changes to Protocol Behavior&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Block Creation&lt;&#x2F;strong&gt;: Validators must ensure the total RLP-encoded size of any produced block does not exceed &lt;code&gt;MAX_RLP_BLOCK_SIZE&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Block Validation&lt;&#x2F;strong&gt;: Nodes must reject blocks whose RLP-encoded size exceeds &lt;code&gt;MAX_RLP_BLOCK_SIZE&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;protocol-adjustment&quot;&gt;Protocol Adjustment&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;All Ethereum client implementations must integrate this size check as part of block validation and propagation.&lt;&#x2F;li&gt;
&lt;li&gt;This limit applies independently of gas-related metrics.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-10-mib&quot;&gt;Why 10 MiB?&lt;&#x2F;h3&gt;
&lt;p&gt;A cap of 10 MiB aligns with the gossip protocol constraint in Ethereum&#x27;s consensus layer (CL). An additional 2MiB margin explicitly accounts for beacon block sizes, ensuring compatibility and consistent block propagation across the network. Blocks significantly larger than 10 MiB will not be broadcast by the CL, potentially leading to network fragmentation or denial-of-service scenarios.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change is &lt;strong&gt;not backward-compatible&lt;&#x2F;strong&gt; with any blocks larger than the newly specified size limit. Validators and miners will need to ensure their block construction logic strictly respects this limit.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Restricting maximum block size provides inherent protection against deliberate oversized-block attacks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Secondary Signature Algorithms</title>
        <published>2025-04-12T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>James Kempton</name><uri>https://github.com/SirSpudlington</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7932/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7932-secondary-signature-algorithms/23514" />
        

        <id>https://wg-eips.ritovision.com/7932/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7932"
            label="EIP-7932" />
        

        
        

        
        <summary type="html">Introduces a precompile and registry for handling alternative signature algorithms</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7932/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Creates a unified registry &amp;amp; standardized interface for introducing additional signature algorithms for the use of deriving account addresses.&lt;&#x2F;li&gt;
&lt;li&gt;Introduces a precompile at address &lt;code&gt;SIGRECOVER_PRECOMPILE_ADDRESS&lt;&#x2F;code&gt; for decoding these newly introduced algorithms.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;As quantum computers become more advanced, several new post-quantum (PQ) algorithms have been designed. These algorithms all have certain drawbacks, such as large key sizes (&amp;gt;1KiB), large signature sizes, or long verification times. These issues make them more expensive to compute and store than the currently used secp256k1 curve.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP allows the use of many algorithms by introducing an algorithm registry that can be used via a single interface.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;Unless explicitly noted, integer encoding MUST be in big-endian format.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SIGRECOVER_PRECOMPILE_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;Bytes20(0x12)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SIGRECOVER_PRECOMPILE_BASE_GAS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;3000&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;algorithm-specification&quot;&gt;Algorithm specification&lt;&#x2F;h3&gt;
&lt;p&gt;New algorithms beyond the &lt;code&gt;secp256k1&lt;&#x2F;code&gt; algorithm specified in this EIP MUST be specified via a distinct EIP.&lt;&#x2F;p&gt;
&lt;p&gt;Each type of algorithm MUST specify the following fields:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;rust&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;trait&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Algorithm&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The algorithm type byte&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ALG_TYPE&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint8&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The size of signatures. Signatures MUST be padded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; to this size to be valid. Note that this does include&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the ALG_TYPE byte prefix&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    SIZE&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the gas cost of signing this data. This&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SHOULD include a reasonable minimum and MUST&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; be relative to secp256k1, i.e. 0 gas is secp256k1.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    fn&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; gas_cost&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signing_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Uint64&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check whether the signature is valid. For some&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; algorithms, this may be a no-op. This function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; will always be called before `verify`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    fn&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; None&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Error&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Take the signature and signing_data and return the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; public key of the signer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    fn&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; signing_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Error&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Specifications MUST include some form of security analysis on the provided algorithm and basic benchmarks justifying gas costs. Additionally, specifications MUST address malleability issues that may arise from specified algorithms.&lt;&#x2F;p&gt;
&lt;p&gt;An example of this specification can be found &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7932&#x2F;assets&#x2F;template-eip&#x2F;&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;deriving-address-from-public-keys&quot;&gt;Deriving address from public keys&lt;&#x2F;h3&gt;
&lt;p&gt;The function below MUST be used when deriving an address from a public key:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; pubkey_to_address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;public_key&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; algorithm_id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint8&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; algorithm_id&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;FF&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Compatibility shim to ensure backwards compatibility&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;keccak&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;public_key&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;12&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; with `||` being binary concatenation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;keccak&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;algorithm_id&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span&gt; public_key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;12&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;algorithm-registry&quot;&gt;Algorithm Registry&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AlgorithmEntry&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ALG_TYPE&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint8&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    SIZE&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_cost&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Callable&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Bytes&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    validate&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Callable&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Bytes&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span&gt; Error&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    verify&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Callable&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Bytes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span&gt; Error&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;algorithm_registry&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Dict&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;uint8&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; AlgorithmEntry&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This EIP uses the &lt;code&gt;algorithm_registry&lt;&#x2F;code&gt; object to signify algorithms that have been included within a hard fork.&lt;&#x2F;p&gt;
&lt;p&gt;A living EIP MAY be created on finalization of this EIP to track currently active algorithms across forks.&lt;&#x2F;p&gt;
&lt;p&gt;The algorithm type is reserved &lt;code&gt;0xFE&lt;&#x2F;code&gt; as invalid &#x2F; missing.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;helper-functions&quot;&gt;Helper functions&lt;&#x2F;h3&gt;
&lt;p&gt;The following helper functions are defined for convenience:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calculate_penalty&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;algorithm&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint8&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; signing_data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; algorithm&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; algorithm_registry&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    algorithm&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; algorithm_registry&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;algorithm&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; algorithm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_cost&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signing_data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validate_signature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; algorithm_registry&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    algorithm&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; algorithm_registry&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; algorithm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function cannot be called without prior calling `validate_signature(signature)`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verify_signature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;signing_data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    algorithm&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; algorithm_registry&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; algorithm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;verify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signing_data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;secp256k1-algorithm&quot;&gt;&lt;code&gt;secp256k1&lt;&#x2F;code&gt; algorithm&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;ALG_TYPE&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;FF&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;SIZE&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 66&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;SECP256K1_SIGNATURE_SIZE&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SIZE&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; secp256k1_unpack&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ByteVector&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SECP256K1_SIGNATURE_SIZE&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; tuple&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; uint8&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;big&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;64&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;big&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    y_parity&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;64&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; s&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; y_parity&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; secp256k1_validate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ByteVector&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SECP256K1_SIGNATURE_SIZE&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    SECP256K1N&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; s&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; y_parity&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; secp256k1_unpack&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SECP256K1N&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SECP256K1N&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; y_parity&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; gas_cost&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;signing_data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Uint64&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This is an adaptation from the KECCAK256 opcode&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signing_data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; Uint64&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        minimum_word_size&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signing_data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 31&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; Uint64&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;30&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;6&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; minimum_word_size&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span&gt; Error&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    secp256k1_validate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; signing_data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span&gt; Error&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Another compatibility shim to ensure passing a 32 byte hash still works.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signing_data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        signing_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signing_data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ecdsa&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; ECDSA&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    recover_sig&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; ecdsa&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;ecdsa_recoverable_deserialize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;65&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;65&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    public_key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; PublicKey&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ecdsa&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;ecdsa_recover&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signing_data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; recover_sig&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; raw&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;True&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    uncompressed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; public_key&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;serialize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;compressed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;False&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; uncompressed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;sigrecover-precompile&quot;&gt;&lt;code&gt;sigrecover&lt;&#x2F;code&gt; precompile&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP also introduces a new precompile located at &lt;code&gt;SIGRECOVER_PRECOMPILE_ADDRESS&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This precompile MUST charge &lt;code&gt;SIGRECOVER_PRECOMPILE_BASE_GAS&lt;&#x2F;code&gt; static gas before executing.&lt;&#x2F;p&gt;
&lt;p&gt;The precompile MUST output the 20-byte address of the signer provided left padded to 32 bytes. Callers MUST assume all zero bytes as a failure. On failure, the precompile MUST return 32 &lt;code&gt;0x00&lt;&#x2F;code&gt; bytes.&lt;&#x2F;p&gt;
&lt;p&gt;The precompile is defined as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; sigrecover_precompile&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;input&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;input&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; algorithm_registry&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    size&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; algorithm_registry&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SIZE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;input&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; size&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;size&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signing_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;size&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    charge_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;calculate_penalty&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signing_data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Run validate&#x2F;verify function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    validate_signature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; verify_signature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signing_data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Return address left-padded to 32 bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\x00&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 12&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; pubkey_to_address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;pubkey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;erc-4337-interoperability&quot;&gt;ERC-4337 interoperability&lt;&#x2F;h3&gt;
&lt;p&gt;While initial drafts of this EIP were competing with ERC-4337, current versions of this EIP support it via the sigrecover precompile. This allows any ERC-4337 implementation to have the same signature verification logic and address derivation logic for any given private key. This also works agnostic of whatever algorithm derives the address.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;precompile-over-native-evm-code&quot;&gt;Precompile over native EVM code&lt;&#x2F;h3&gt;
&lt;p&gt;Having a precompile allows non-EVM processes, i.e. transaction level signature verification, to access the registry &lt;em&gt;without&lt;&#x2F;em&gt; having to call into the EVM.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;opaque-signature-type&quot;&gt;Opaque &lt;code&gt;signature&lt;&#x2F;code&gt; type&lt;&#x2F;h3&gt;
&lt;p&gt;As each algorithm has unique properties, e.g. supporting signature recovery and key sizes, the object needs to hold every permutation of every possible signature and potentially additional recovery information. A bytearray of an algorithm-defined size would be able to achieve this goal.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;EIP-7932 does not modify any existing logic and does not pose any backwards compatibility issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases for the &lt;code&gt;sigrecover&lt;&#x2F;code&gt; precompile may be found in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7932&#x2F;.&#x2F;assets&#x2F;precompile_test_cases.py&quot;&gt;precompile_test_cases.py&lt;&#x2F;a&gt; file.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Allowing more ways to derive addresses for a single account may decrease overall security for that specific account. However, this is partially mitigated by the increase in processing power required to trial all algorithms. Even still, adding additional algorithms may need further discussion to ensure that the security of the network would not be compromised.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>PermaLink Asset Bound Token</title>
        <published>2025-04-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Mihai Onila</name><uri>https://github.com/MihaiORO</uri>
	</author>
	
	<author>
		<name>Nick Zeman</name><uri>https://github.com/NickZCZ</uri>
	</author>
	
	<author>
		<name>Narcis Cotaie</name><uri>https://github.com/NarcisCRO</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7929/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/non-fungible-asset-bound-token/23175" />
        

        <id>https://wg-eips.ritovision.com/7929/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7929"
            label="ERC-7929" />
        

        
        

        
        <summary type="html">Asset-bound Tokens (ABT) permanently bound to another token, known as PermaLink-ABTs.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7929/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard introduces a subclass of tokens known as &lt;strong&gt;PermaLink Asset Bound Tokens (PermaLink-ABTs)&lt;&#x2F;strong&gt;. They are a specific implementation of the broader &lt;strong&gt;Asset Bound Token (ABT)&lt;&#x2F;strong&gt; concept. ABTs establish a novel ownership paradigm where &lt;strong&gt;an asset can own another asset&lt;&#x2F;strong&gt;, enabling composable, nested, and portfolio-like token structures that evolve together over time.&lt;&#x2F;p&gt;
&lt;p&gt;PermaLink-ABTs implement a permanent binding mechanism where a token in one smart contract is irreversibly linked to a token in another contract. These links mirror key state data such as &lt;code&gt;ownerOf&lt;&#x2F;code&gt;, &lt;code&gt;tokenId&lt;&#x2F;code&gt;, &lt;code&gt;totalSupply&lt;&#x2F;code&gt;, and &lt;code&gt;balanceOf&lt;&#x2F;code&gt; using the &lt;code&gt;assetBoundContract&lt;&#x2F;code&gt; interface. Traditional token transfer and approval functions are omitted to enforce immutability and structural cohesion between bound assets.&lt;&#x2F;p&gt;
&lt;p&gt;Instead of utilizing a &lt;code&gt;mint&lt;&#x2F;code&gt; function, PermaLink-ABTs employ a &lt;code&gt;reveal&lt;&#x2F;code&gt; mechanism that activates tokens from a predefined supply. This approach enables permissionless binding and significantly reduces gas costs. A single token can have multiple PermaLink-ABTs bound to it, acting as multiple subordinate assets, forming a unified, transferable unit that simplifies asset mobility across digital identities, NFTs, and real-world assets (RWAs).&lt;&#x2F;p&gt;
&lt;p&gt;By encouraging asset composability over competition, PermaLink-ABTs introduce a dynamic, future-proof model for on-chain asset evolution.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Traditional ownership models on Ethereum are inherently limited. Only externally owned accounts (EOAs) or smart contracts can own blockchain assets. This creates rigidity, especially as the blockchain ecosystem expands to include digital identities, tokenized real-world assets (RWAs), and NFTs. Current smart contracts are static in nature, meaning once deployed, they cannot adapt to evolving systems, unforeseen use cases, or new integration layers. There is a need for a more flexible and modular ownership model that allows for dynamic interactions between assets.&lt;&#x2F;p&gt;
&lt;p&gt;This standard proposes &lt;strong&gt;Asset Bound Tokens (ABTs)&lt;&#x2F;strong&gt; as a solution to this challenge. ABTs allow one token to be permanently bound to another across contracts, creating a dynamic, flexible, and composable ownership model. By enabling tokens to move and evolve together, ABTs pave the way for new possibilities in the on-chain economy. The following use cases illustrate why ABTs are needed:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;On-Chain Identity Systems&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
Governments and institutions worldwide are piloting or implementing blockchain-based identity systems, digital passports, national IDs, and verifiable credentials such as with the ongoing European Blockchain Services Infrastructure (EBSI) initiatives. These systems often require credentials to be linked across multiple registries (e.g., healthcare, banking, voting). ABTs enable the binding of identity-linked tokens into a cohesive unit, so they move together instead of requiring manual coordination and transfers. This ensures that identity-linked assets remain interconnected and dynamic, making it easier to manage and update linked data as users interact with various systems.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Real-World Asset (RWA) Ownership Structures&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
Tokenized businesses and assets (e.g., land, equipment, commodities) need flexible ownership models. These dynamic—businesses acquire, divest, and restructure their holdings and various assets. ABTs allow contracts to represent complex, evolving ownership hierarchies, where nested assets follow changes in their parent entity’s structure (e.g., a farming company acquiring new land or an IT firm merging with another and inheriting intellectual property). ABTs ensure businesses can efficiently manage and transfer assets on-chain without the constraints of rigid smart contracts.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Manufacturing and Supply Chain Management&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
Supply chains involve multiple layers of assets: raw materials → parts → products → packaging → containers. Blockchain’s transparency is invaluable, but traditional methods of creating individual tokens or smart contracts for each stage are inefficient and costly. ABTs streamline this by linking tokens across the supply chain, allowing them to be aggregated when products are built up (e.g., shoes packed in boxes, boxes placed on pallets, pallets loaded into containers) and broken down as they move through different stages (e.g., containers unloaded, pallets split, boxes unpacked). This dynamic linking and unlinking reduce redundancy, maintain transparent immutable records, and ensure seamless tracking while minimizing gas costs. By enabling the efficient flow of assets throughout the supply chain, ABTs help reduce complexity and provide a cohesive, real-time view of the entire process.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;NFT Ecosystem Optimization&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
NFT projects often expand by launching secondary collections (e.g., additional editions, special releases). Without ABTs, this leads to fragmented value and user confusion as older and newer assets compete. ABTs allow new NFTs to be bound to originals, enhancing their value while maintaining a unified ecosystem. This strengthens liquidity and preserves market metrics, ensuring that the value of the original collection is retained and supported by the newer assets, thus benefiting both creators and collectors.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;New Opportunities for Creators&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
ABTs empower creators to build on top of existing assets permissionlessly without needing ownership of or permission from the original smart contract. This enables a new wave of creative expression, where artists can augment and enhance NFTs (e.g., adding new visuals, audio, or interactive layers) and collaborate on existing collections. Such contributions can generate new revenue streams through shared royalties, consignment, or collaborative upgrades. Owners benefit as well, since bound enhancements can increase the inherent value of their holdings, particularly in projects involving established creators or cross-collection collaborations.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;In essence, ABTs introduce a framework where tokens are linked rather than owned. This allows for dynamic and evolving asset systems, where assets move together in harmony. If a binding token moves, all associated ABTs move with it, ensuring seamless updates and reducing the need for manual transfers. This innovation transforms traditional smart contracts from static repositories into living, evolving systems capable of adapting to changing use cases, technologies, and business models.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;strong&gt;PermaLink-ABTs&lt;&#x2F;strong&gt; implementation takes the ABT model further by enforcing a permanent binding between one token and another—whether it&#x27;s another ABT, NFT or NFKBT. This permanent binding ensures that tokens can be transferred as a single unit, reducing complexity and gas fees. Instead of relying on traditional minting, PermaLink-ABTs use a &lt;code&gt;reveal&lt;&#x2F;code&gt; mechanism, activating tokens from a predefined supply. This reduces gas costs and encourages efficient linking of assets, enabling greater composability across multiple sectors.&lt;&#x2F;p&gt;
&lt;p&gt;PermaLink-ABTs consolidate asset value by allowing multiple subordinate tokens to be linked to a single binding token, providing enhanced composability and reducing fragmentation. By requiring only the binding token to be transferred, all associated assets move in sync, making it easier to manage portfolios and move groups of assets together. This approach fosters collaboration, value accrual, and compatibility across ecosystems, whether for digital identities, RWAs, NFTs, or other on-chain assets.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;ierc7929-token-interface&quot;&gt;&lt;code&gt;IERC7929&lt;&#x2F;code&gt; (Token Interface)&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;NOTES&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The following specifications use syntax from Solidity &lt;code&gt;0.8.27&lt;&#x2F;code&gt; (or above)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7929&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AssetBoundContractSet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; assetBoundContract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenExists&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;events&quot;&gt;Events&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;assetboundcontractset-event&quot;&gt;&lt;code&gt;AssetBoundContractSet&lt;&#x2F;code&gt; Event&lt;&#x2F;h4&gt;
&lt;p&gt;Emitted when the contract is deployed and bound to &lt;code&gt;assetBoundContract&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AssetBoundContractSet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; assetBoundContract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;functions&quot;&gt;Functions&lt;&#x2F;h3&gt;
&lt;p&gt;The functions detailed below MUST be implemented.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;ownerof&quot;&gt;&lt;code&gt;ownerOf&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Returns the owner of the NFT specified by the &lt;code&gt;tokenId&lt;&#x2F;code&gt;. Will read from the &lt;code&gt;assetBoundContract&lt;&#x2F;code&gt; the owner and return it.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;tokenexists&quot;&gt;&lt;code&gt;tokenExists&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Returns true if the token read from the &lt;code&gt;assetBoundContract&lt;&#x2F;code&gt; exists.
Tokens usually start existing when minted and stop existing when burned.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenExists&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;totalsupply&quot;&gt;&lt;code&gt;totalSupply&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Gets the total amount of tokens stored by the assetBoundContract&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;balanceof&quot;&gt;&lt;code&gt;balanceOf&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Returns the number of NFTs in the assetBoundContract that an owner has.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;ierc7929reveal-optional-token-interface&quot;&gt;&lt;code&gt;IERC7929Reveal&lt;&#x2F;code&gt; (Optional Token Interface)&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;NOTES&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The following specifications use syntax from Solidity &lt;code&gt;0.8.27&lt;&#x2F;code&gt; (or above)&lt;&#x2F;li&gt;
&lt;li&gt;The Reveal extension is OPTIONAL for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7929&#x2F;&quot;&gt;ERC-7929&lt;&#x2F;a&gt; contracts&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7929Reveal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7929&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TokenRevealed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; reveal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;events-1&quot;&gt;Events&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;tokenrevealed-event&quot;&gt;&lt;code&gt;TokenRevealed&lt;&#x2F;code&gt; Event&lt;&#x2F;h4&gt;
&lt;p&gt;Emitted when the &lt;code&gt;tokenId&lt;&#x2F;code&gt; is revealed&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TokenRevealed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;functions-1&quot;&gt;Functions&lt;&#x2F;h3&gt;
&lt;p&gt;The functions detailed below MUST be implemented.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;reveal&quot;&gt;&lt;code&gt;reveal&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;reveal&lt;&#x2F;code&gt; function should be implemented to allow pre-allocated tokens to be activated on demand.&lt;br &#x2F;&gt;
This method reduces gas consumption compared to traditional minting and simplifies token activation mechanics.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; reveal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The design of PermaLink-ABTs centers around the goal of enabling permanent token binding while optimizing for gas efficiency, composability, and secure ownership structures. We adopted the &lt;code&gt;assetBoundContract&lt;&#x2F;code&gt; interface to mirror essential metadata such as &lt;code&gt;ownerOf&lt;&#x2F;code&gt;, &lt;code&gt;tokenId&lt;&#x2F;code&gt;, &lt;code&gt;totalSupply&lt;&#x2F;code&gt;, and &lt;code&gt;balanceOf&lt;&#x2F;code&gt; from the binding token’s contract. This ensures that PermaLink-ABTs remain synchronized with the asset they are bound to, without duplicating logic or requiring manual updates. The mirroring also ensures traceability and visibility across contracts, allowing observers and off-chain systems to reliably interpret the token relationship. To preserve the permanent nature of the bond, standard &lt;code&gt;transfer&lt;&#x2F;code&gt; and &lt;code&gt;approve&lt;&#x2F;code&gt; methods are omitted. This immutability guarantees that PermaLink-ABTs cannot be separated from their bound asset once revealed. If the primary token moves, all attached PermaLink-ABTs move with it. This behavior supports composability, value aggregation, and consistent ownership logic.&lt;&#x2F;p&gt;
&lt;p&gt;An alternative considered was allowing flexible transfer mechanics via opt-in transfer functions or whitelisting. However, this introduced unnecessary complexity and undermined the core principle of permanence. It also increased the risk of token desynchronization, accidental fragmentation, and security vulnerabilities in contract implementations. By contrast, the current design provides a simpler and more robust foundation.&lt;&#x2F;p&gt;
&lt;p&gt;By implementing an &lt;strong&gt;optional&lt;&#x2F;strong&gt; &lt;code&gt;reveal&lt;&#x2F;code&gt; function in place of a traditional &lt;code&gt;mint&lt;&#x2F;code&gt; function it reduce gas costs and simplifies on-chain state changes for both the deployer and owner of the token having an ABT bound to it. Unlike minting, which creates tokens at runtime and incurs higher gas fees, the &lt;code&gt;reveal&lt;&#x2F;code&gt; function maps pre-allocated tokens stored in an array or mapping. This allows tokens to be activated on demand without the overhead of dynamic token creation. As a result, token issuers can prepare and store an entire supply in advance, with users later revealing and binding tokens when needed. This approach aligns with the use case of portfolio binding and asset hierarchies, where large numbers of tokens may need to be activated and bound efficiently.&lt;&#x2F;p&gt;
&lt;p&gt;PermaLink-ABTs enforce strict one-way binding with immutable relationships, making them especially suitable for use cases like identity systems, real-world asset (RWA) structures, and portfolio-locked NFTs. They act as permanently attached extensions to existing tokens, reducing complexity and avoiding redundant contract logic. This approach also provides a cleaner and more secure way to augment existing assets while maintaining compatibility across various blockchain use cases. This standard is intentionally minimal to ensure wide compatibility and flexibility. Developers can extend the base logic for specialized use cases, such as embedding royalty splits, upgrade paths, or linking to dynamic data feeds, without altering the underlying PermaLink mechanism.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;erc7929-token-implementation&quot;&gt;&lt;code&gt;ERC7929&lt;&#x2F;code&gt; (Token implementation)&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;NOTES&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The interface ID is (&lt;code&gt;0x0b76916c&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;Callers MUST handle &lt;code&gt;false&lt;&#x2F;code&gt; from &lt;code&gt;returns (bool success)&lt;&#x2F;code&gt;. Callers MUST NOT assume that &lt;code&gt;false&lt;&#x2F;code&gt; is never returned!&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC7929&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC165&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC721Enumerable&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Ownable&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC7929&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ERC721Enumerable &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;public&lt;&#x2F;span&gt;&lt;span&gt; assetBoundContract&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _assetBoundContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _symbol&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_name, _symbol) &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        assetBoundContract &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721Enumerable&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_assetBoundContract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AssetBoundContractSet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_assetBoundContract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; region EIP-165 Implementation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See {IERC165-supportsInterface}.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC721Enumerable&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC165&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;IERC7929&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; endregion&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; region Modifiers&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    modifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokensMustExist&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;tokenExists&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenIds&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC7929: Token does not exist&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        _&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; endregion Modifiers&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; region mirror functions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        public&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        virtual&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        override&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC721&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7929&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC721&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; assetBoundContract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenExists&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; assetBoundContract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        public&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        virtual&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        override&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC721Enumerable&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7929&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; assetBoundContract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;totalSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        public&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        virtual&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        override&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC721&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7929&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC721&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; assetBoundContract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;endregion&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;region Disabling approve and transfer functions to prevent transfers of ABT tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC721&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC721&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        revert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;ERC7929: Approvals not allowed&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setApprovalForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC721&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC721&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        revert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;ERC7929: Approvals not allowed&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC721&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC721&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        revert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;ERC7929: Transfers not allowed&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC721&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC721&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        safeTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC721&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC721&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        revert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;ERC7929: Transfers not allowed&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;endregion&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;ierc7929reveal-token-implementation&quot;&gt;&lt;code&gt;IERC7929Reveal&lt;&#x2F;code&gt; (Token implementation)&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;NOTES&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;This is an OPTIONAL extension for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7929&#x2F;&quot;&gt;ERC-7929&lt;&#x2F;a&gt; contracts&lt;&#x2F;li&gt;
&lt;li&gt;The interface ID is (&lt;code&gt;0xb93f208a&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;Callers MUST handle &lt;code&gt;false&lt;&#x2F;code&gt; from &lt;code&gt;returns (bool success)&lt;&#x2F;code&gt;. Callers MUST NOT assume that &lt;code&gt;false&lt;&#x2F;code&gt; is never returned!&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC7929Reveal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC7929&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC7929Reveal&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; isRevealed&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _assetBoundContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _symbol&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC7929&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_assetBoundContract, _name, _symbol) &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; region EIP-165 Implementation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See {IERC165-supportsInterface}.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;IERC7929Reveal&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; endregion&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; region Modifiers&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    modifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokensMustNotBeRevealed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                !&lt;&#x2F;span&gt;&lt;span&gt;isRevealed&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenIds&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;                &amp;quot;ERC7929: Token already revealed&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        _&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; endregion Modifiers&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; region mirror functions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC7929&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7929&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenExists&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC7929&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7929&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;tokenExists&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        public&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        override&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC7929&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7929&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;totalSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC7929&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7929&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;endregion&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;region Reveal function to reveal the token URI for a given token ID(s)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; reveal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        public&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        payable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        virtual&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        tokensMustExist&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;tokenIds&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        tokensMustNotBeRevealed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;tokenIds&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            isRevealed&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenIds&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TokenRevealed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenIds&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;endregion&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;PermaLink-ABTs are linked to another non-fungible token. If an individual loses access to this token, what we call the &lt;strong&gt;binding token&lt;&#x2F;strong&gt;, they also lose access to all PermaLink-ABTs that have been bound to it. This introduces a critical security consideration: the entire value of bound assets depends on the integrity and availability of the binding token.&lt;&#x2F;p&gt;
&lt;p&gt;To mitigate this risk, we strongly recommend the use of standards like &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6809&#x2F;&quot;&gt;ERC-6809&lt;&#x2F;a&gt;, a &lt;strong&gt;Non-Fungible Key Bound Token&lt;&#x2F;strong&gt;, which introduces on-chain two-factor authentication (2FA). ERC-6809 allows a user to bind sensitive tokens (like PermaLink-ABTs) to a secured identity layer, complete with recovery mechanisms. In the event that a user loses access to their original wallet or interacts with a malicious contract, ERC-6809 provides a safeFallback function to re-establish control.&lt;&#x2F;p&gt;
&lt;p&gt;In essence, all of the security guarantees of ERC-6809 extend to any PermaLink-ABTs bound to it. This layered security model not only protects against loss but also ensures recoverability and long-term viability for high-value bound assets. It is strongly encouraged that developers implementing PermaLink-ABTs integrate this or similar standards to provide a robust security foundation for users.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Block-Level Access Lists</title>
        <published>2025-03-31T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Toni Wahrstätter</name><uri>https://github.com/nerolation</uri>
	</author>
	
	<author>
		<name>Dankrad Feist</name><uri>https://github.com/dankrad</uri>
	</author>
	
	<author>
		<name>Francesco D`Amato</name><uri>https://github.com/fradamt</uri>
	</author>
	
	<author>
		<name>Jochem Brouwer</name><uri>https://github.com/jochem-brouwer</uri>
	</author>
	
	<author>
		<name>Ignacio Hagopian</name><uri>https://github.com/jsign</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7928/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7928-block-level-access-lists/23337" />
        

        <id>https://wg-eips.ritovision.com/7928/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7928"
            label="EIP-7928" />
        

        
        

        
        <summary type="html">Enforced block access lists with state locations and post-transaction state diffs</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7928/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces Block-Level Access Lists (BALs) that record all accounts and storage locations accessed during block execution, along with their post-execution values. BALs enable parallel disk reads, parallel transaction validation, parallel state root computation and executionless state updates.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Transaction execution cannot be parallelized without knowing in advance which addresses and storage slots will be accessed. While &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930&lt;&#x2F;a&gt; introduced optional transaction access lists, they are not enforced.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal enforces access lists at the block level, enabling:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Parallel disk reads and transaction execution&lt;&#x2F;li&gt;
&lt;li&gt;Parallel post-state root calculation&lt;&#x2F;li&gt;
&lt;li&gt;State reconstruction without executing transactions&lt;&#x2F;li&gt;
&lt;li&gt;Reduced execution time to &lt;code&gt;parallel IO + parallel EVM&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;block-structure-modification&quot;&gt;Block Structure Modification&lt;&#x2F;h3&gt;
&lt;p&gt;We introduce a new field to the block header, &lt;code&gt;block_access_list_hash&lt;&#x2F;code&gt;, which contains the Keccak-256 hash of the RLP-encoded block access list. When no state changes are present, this field is the hash of an empty RLP list &lt;code&gt;0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347&lt;&#x2F;code&gt;, i.e. &lt;code&gt;keccak256(rlp.encode([]))&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Header&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Existing fields&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block_access_list_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;rlp&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block_access_list&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;BlockAccessList&lt;&#x2F;code&gt; is not included in the block body. The EL stores BALs separately and transmits them as a field in the &lt;code&gt;ExecutionPayload&lt;&#x2F;code&gt; via the engine API. The BAL is RLP-encoded as a list of &lt;code&gt;AccountChanges&lt;&#x2F;code&gt;. When no state changes are present, this field is the empty RLP list &lt;code&gt;0xc0&lt;&#x2F;code&gt;, i.e. &lt;code&gt;rlp.encode([])&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;rlp-data-structures&quot;&gt;RLP Data Structures&lt;&#x2F;h3&gt;
&lt;p&gt;BALs use RLP encoding following the pattern: &lt;code&gt;address -&amp;gt; field -&amp;gt; block_access_index -&amp;gt; change&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Type aliases for RLP encoding&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; bytes20&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 20-byte Ethereum address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;StorageKey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Storage slot key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;StorageValue&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Storage value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Bytecode&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Variable-length contract bytecode&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;BlockAccessIndex&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; uint16&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Block access index (0 for pre-execution, 1..n for transactions, n+1 for post-execution)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Post-transaction balance in wei&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Account nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Core change structures (RLP encoded as lists)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; StorageChange: [block_access_index, new_value]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;StorageChange&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;BlockAccessIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; StorageValue&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; BalanceChange: [block_access_index, post_balance]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;BalanceChange&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;BlockAccessIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Balance&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; NonceChange: [block_access_index, new_nonce]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;NonceChange&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;BlockAccessIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Nonce&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; CodeChange: [block_access_index, new_code]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CodeChange&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;BlockAccessIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Bytecode&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SlotChanges: [slot, [changes]]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; All changes to a single storage slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SlotChanges&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;StorageKey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;StorageChange&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; AccountChanges: [address, storage_changes, storage_reads, balance_changes, nonce_changes, code_changes]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; All changes for a single account, grouped by field type&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;AccountChanges&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;                    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;SlotChanges&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;          #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; storage_changes (slot -&amp;gt; [block_access_index -&amp;gt; new_value])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;StorageKey&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;           #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; storage_reads (read-only storage keys)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;BalanceChange&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; balance_changes ([block_access_index -&amp;gt; post_balance])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;NonceChange&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;          #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; nonce_changes ([block_access_index -&amp;gt; new_nonce])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;CodeChange&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; code_changes ([block_access_index -&amp;gt; new_code])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; BlockAccessList: List of AccountChanges&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;BlockAccessList&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;AccountChanges&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;scope-and-inclusion&quot;&gt;Scope and Inclusion&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;BlockAccessList&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; is the set of all addresses accessed during block execution.&lt;&#x2F;p&gt;
&lt;p&gt;It &lt;strong&gt;MUST&lt;&#x2F;strong&gt; include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Addresses with state changes (storage, balance, nonce, or code).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Addresses accessed without state changes, including:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Targets of &lt;code&gt;BALANCE&lt;&#x2F;code&gt;, &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt;, &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt;, &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; opcodes&lt;&#x2F;li&gt;
&lt;li&gt;Targets of &lt;code&gt;CALL&lt;&#x2F;code&gt;, &lt;code&gt;CALLCODE&lt;&#x2F;code&gt;, &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;, &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; (even if they revert; see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7928&#x2F;#gas-validation-before-state-access&quot;&gt;Gas Validation Before State Access&lt;&#x2F;a&gt; for inclusion conditions)&lt;&#x2F;li&gt;
&lt;li&gt;Target addresses of &lt;code&gt;CREATE&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;CREATE2&lt;&#x2F;code&gt; if the target account is accessed&lt;&#x2F;li&gt;
&lt;li&gt;Deployed contract addresses from calls with initcode to empty addresses (e.g., calling &lt;code&gt;0x0&lt;&#x2F;code&gt; with initcode)&lt;&#x2F;li&gt;
&lt;li&gt;Transaction sender and recipient addresses (even for zero-value transfers)&lt;&#x2F;li&gt;
&lt;li&gt;COINBASE address if the block contains transactions or withdrawals to the COINBASE address&lt;&#x2F;li&gt;
&lt;li&gt;Beneficiary addresses for &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;System contract addresses accessed during pre&#x2F;post-execution; the system caller address, &lt;code&gt;SYSTEM_ADDRESS&lt;&#x2F;code&gt; (&lt;code&gt;0xfffffffffffffffffffffffffffffffffffffffe&lt;&#x2F;code&gt;), MUST NOT be included unless it experiences state access itself&lt;&#x2F;li&gt;
&lt;li&gt;Withdrawal recipient addresses, regardless of whether the withdrawal amount is non-zero&lt;&#x2F;li&gt;
&lt;li&gt;Precompiled contracts when called or accessed&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Addresses with no state changes &lt;strong&gt;MUST&lt;&#x2F;strong&gt; still be present with empty change lists.&lt;&#x2F;p&gt;
&lt;p&gt;Entries from an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930&lt;&#x2F;a&gt; access list &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; be included automatically. Only addresses and storage slots that are actually touched or changed during execution are recorded.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-validation-before-state-access&quot;&gt;Gas Validation Before State Access&lt;&#x2F;h3&gt;
&lt;p&gt;State-accessing opcodes perform gas validation in two phases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Pre-state validation&lt;&#x2F;strong&gt;: Gas costs determinable without state access (memory expansion, base opcode cost, warm&#x2F;cold access cost)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Post-state validation&lt;&#x2F;strong&gt;: Gas costs requiring state access (account existence, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; delegation resolution)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Pre-state validation MUST pass before any state access occurs. If pre-state validation fails, the target resource (address or storage slot) is never accessed and MUST NOT be included in the BAL.&lt;&#x2F;p&gt;
&lt;p&gt;Once pre-state validation passes, the target is accessed and included in the BAL. Post-state costs are then calculated; their order is implementation-defined since the target has already been accessed.&lt;&#x2F;p&gt;
&lt;p&gt;The following table specifies pre-state validation costs in addition to the base opcode cost (gas constants as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;):&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Instruction&lt;&#x2F;th&gt;&lt;th&gt;Pre-state Validation&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;BALANCE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;access_cost&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SELFBALANCE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;None (accesses current contract, always warm)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;access_cost&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;access_cost&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;access_cost&lt;&#x2F;code&gt; + &lt;code&gt;memory_expansion&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CALL&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;access_cost&lt;&#x2F;code&gt; + &lt;code&gt;memory_expansion&lt;&#x2F;code&gt; + &lt;code&gt;GAS_CALL_VALUE&lt;&#x2F;code&gt; (if value &amp;gt; 0)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CALLCODE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;access_cost&lt;&#x2F;code&gt; + &lt;code&gt;memory_expansion&lt;&#x2F;code&gt; + &lt;code&gt;GAS_CALL_VALUE&lt;&#x2F;code&gt; (if value &amp;gt; 0)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;access_cost&lt;&#x2F;code&gt; + &lt;code&gt;memory_expansion&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;STATICCALL&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;access_cost&lt;&#x2F;code&gt; + &lt;code&gt;memory_expansion&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CREATE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;memory_expansion&lt;&#x2F;code&gt; + &lt;code&gt;INITCODE_WORD_COST&lt;&#x2F;code&gt; + &lt;code&gt;GAS_CREATE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CREATE2&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;memory_expansion&lt;&#x2F;code&gt; + &lt;code&gt;INITCODE_WORD_COST&lt;&#x2F;code&gt; + &lt;code&gt;GAS_KECCAK256_WORD&lt;&#x2F;code&gt; + &lt;code&gt;GAS_CREATE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;access_cost&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SSTORE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;More than &lt;code&gt;GAS_CALL_STIPEND&lt;&#x2F;code&gt; available&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;GAS_SELF_DESTRUCT&lt;&#x2F;code&gt; + &lt;code&gt;access_cost&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;access_cost&lt;&#x2F;code&gt;: For account-accessing opcodes: &lt;code&gt;COLD_ACCOUNT_ACCESS_COST&lt;&#x2F;code&gt; if cold, &lt;code&gt;WARM_STORAGE_READ_COST&lt;&#x2F;code&gt; if warm. For storage-accessing opcodes (&lt;code&gt;SLOAD&lt;&#x2F;code&gt;): &lt;code&gt;COLD_SLOAD_COST&lt;&#x2F;code&gt; if cold, &lt;code&gt;WARM_STORAGE_READ_COST&lt;&#x2F;code&gt; if warm.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;memory_expansion&lt;&#x2F;code&gt;: Gas cost to expand memory for input&#x2F;output regions&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Post-state costs (e.g., &lt;code&gt;GAS_NEW_ACCOUNT&lt;&#x2F;code&gt; for calls to empty accounts, &lt;code&gt;GAS_SELF_DESTRUCT_NEW_ACCOUNT&lt;&#x2F;code&gt; if beneficiary does not exist) do not affect BAL inclusion since the target has already been accessed.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;eip-7702-delegation&quot;&gt;EIP-7702 Delegation&lt;&#x2F;h4&gt;
&lt;p&gt;When a call target has an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; delegation, the target is accessed to resolve the delegation. If a delegation exists, the delegated address requires its own &lt;code&gt;access_cost&lt;&#x2F;code&gt; check before being accessed. If this check fails, the delegated address MUST NOT appear in the BAL, though the original call target is included (having been accessed to resolve the delegation).&lt;&#x2F;p&gt;
&lt;p&gt;Note: Delegated accounts cannot be empty, so &lt;code&gt;GAS_NEW_ACCOUNT&lt;&#x2F;code&gt; never applies when resolving delegations.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;sstore&quot;&gt;SSTORE&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;SSTORE&lt;&#x2F;code&gt; performs an implicit read of the current storage value for gas calculation. The &lt;code&gt;GAS_CALL_STIPEND&lt;&#x2F;code&gt; check prevents this state access when operating within the call stipend. If &lt;code&gt;SSTORE&lt;&#x2F;code&gt; fails this check, the storage slot MUST NOT appear in &lt;code&gt;storage_reads&lt;&#x2F;code&gt; or &lt;code&gt;storage_changes&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;ordering-and-determinism&quot;&gt;Ordering and Determinism&lt;&#x2F;h3&gt;
&lt;p&gt;The following ordering rules &lt;strong&gt;MUST&lt;&#x2F;strong&gt; apply:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Accounts&lt;&#x2F;strong&gt;: Lexicographic by address&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;storage_changes&lt;&#x2F;strong&gt;: Slots lexicographic by storage key; within each slot, changes by block access index (ascending)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;storage_reads&lt;&#x2F;strong&gt;: Lexicographic by storage key&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;balance_changes, nonce_changes, code_changes&lt;&#x2F;strong&gt;: By block access index (ascending)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;blockaccessindex-assignment&quot;&gt;BlockAccessIndex Assignment&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;BlockAccessIndex&lt;&#x2F;code&gt; values &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be assigned as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;0&lt;&#x2F;code&gt; for &lt;strong&gt;pre‑execution&lt;&#x2F;strong&gt; system contract calls.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;1 … n&lt;&#x2F;code&gt; for transactions (in block order).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;n + 1&lt;&#x2F;code&gt; for &lt;strong&gt;post‑execution&lt;&#x2F;strong&gt; system contract calls.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;recording-semantics-by-change-type&quot;&gt;Recording Semantics by Change Type&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;storage&quot;&gt;Storage&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Writes include:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Any value change (post‑value ≠ pre‑value).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Zeroing&lt;&#x2F;strong&gt; a slot (pre‑value exists, post‑value is zero).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Reads include:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Slots accessed via &lt;code&gt;SLOAD&lt;&#x2F;code&gt; that are not written.&lt;&#x2F;li&gt;
&lt;li&gt;Slots written with unchanged values (i.e., &lt;code&gt;SSTORE&lt;&#x2F;code&gt; where post-value equals pre-value, also known as &quot;no-op writes&quot;).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note: Implementations MUST check the pre-transaction value to correctly distinguish between actual writes and no-op writes.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;balance-balance-changes&quot;&gt;Balance (&lt;code&gt;balance_changes&lt;&#x2F;code&gt;)&lt;&#x2F;h4&gt;
&lt;p&gt;Record &lt;strong&gt;post‑transaction&lt;&#x2F;strong&gt; balances (&lt;code&gt;uint256&lt;&#x2F;code&gt;) for:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Transaction &lt;strong&gt;senders&lt;&#x2F;strong&gt; (gas + value).&lt;&#x2F;li&gt;
&lt;li&gt;Transaction &lt;strong&gt;recipients&lt;&#x2F;strong&gt; (only if &lt;code&gt;value &amp;gt; 0&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;CALL&#x2F;CALLCODE &lt;strong&gt;senders&lt;&#x2F;strong&gt; (value).&lt;&#x2F;li&gt;
&lt;li&gt;CALL&#x2F;CALLCODE &lt;strong&gt;recipients&lt;&#x2F;strong&gt; (only if &lt;code&gt;value &amp;gt; 0&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;CREATE&#x2F;CREATE2 recipients (only if &lt;code&gt;value &amp;gt; 0&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;COINBASE&lt;&#x2F;strong&gt; (rewards + fees).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;SELFDESTRUCT&#x2F;SENDALL&lt;&#x2F;strong&gt; beneficiaries.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Withdrawal recipients&lt;&#x2F;strong&gt; (system withdrawals, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4895&#x2F;&quot;&gt;EIP-4895&lt;&#x2F;a&gt;).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;For unaltered account balances:&lt;&#x2F;p&gt;
&lt;p&gt;If an account’s balance changes during a transaction, but its post-transaction balance is equal to its pre-transaction balance, then the change &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; be recorded in &lt;code&gt;balance_changes&lt;&#x2F;code&gt;. The sender and recipient address &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be included in &lt;code&gt;AccountChanges&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The following special cases require addresses to be included with empty changes if no other state changes occur:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Zero-value transfer recipients&lt;&#x2F;li&gt;
&lt;li&gt;Calling a same-transaction SELFDESTRUCT on an address that had a zero pre-transaction balance&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Zero-value block reward recipients &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; trigger a balance change in the block access list and &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; cause the recipient address to be included as a read (e.g. without changes). Zero-value block reward recipients &lt;strong&gt;MUST&lt;&#x2F;strong&gt; only be included with a balance change in blocks where the reward is greater than zero.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;code&quot;&gt;Code&lt;&#x2F;h4&gt;
&lt;p&gt;Track &lt;strong&gt;post‑transaction runtime bytecode&lt;&#x2F;strong&gt; for deployed or modified contracts, and &lt;strong&gt;delegation indicators&lt;&#x2F;strong&gt; for successful delegations as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;nonce&quot;&gt;Nonce&lt;&#x2F;h4&gt;
&lt;p&gt;Record &lt;strong&gt;post‑transaction nonces&lt;&#x2F;strong&gt; for:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;EOA senders.&lt;&#x2F;li&gt;
&lt;li&gt;Contracts that performed a successful &lt;code&gt;CREATE&lt;&#x2F;code&gt; or &lt;code&gt;CREATE2&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Deployed contracts.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; authorities.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;edge-cases-normative&quot;&gt;Edge Cases (Normative)&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;COINBASE &#x2F; Fee Recipient:&lt;&#x2F;strong&gt; The COINBASE address &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be included if it experiences any state change. It &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; be included for blocks with no transactions, provided there are no other state changes (e.g., from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4895&#x2F;&quot;&gt;EIP-4895&lt;&#x2F;a&gt; withdrawals). If the COINBASE reward is zero, the COINBASE address &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be included as a &lt;em&gt;read&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Precompiled contracts:&lt;&#x2F;strong&gt; Precompiles &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be included when accessed. If a precompile receives value, it is recorded with a balance change. Otherwise, it is included with empty change lists.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;SENDALL:&lt;&#x2F;strong&gt; For positive-value selfdestructs, the sender and beneficiary are recorded with a balance change.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;SELFDESTRUCT (in-transaction):&lt;&#x2F;strong&gt; Accounts destroyed within a transaction &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be included in &lt;code&gt;AccountChanges&lt;&#x2F;code&gt; without nonce or code changes. However, if the account had a positive balance pre-transaction, the balance change to zero &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be recorded. Storage keys within the self-destructed contracts that were modified or read &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be included as a &lt;code&gt;storage_reads&lt;&#x2F;code&gt; entry.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Accessed but unchanged:&lt;&#x2F;strong&gt; Include the address with empty changes (e.g., targets of &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt;, &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt;, &lt;code&gt;BALANCE&lt;&#x2F;code&gt;, &lt;code&gt;STATICCALL&lt;&#x2F;code&gt;, etc.).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Zero‑value transfers &#x2F; Unchanged balance in transaction:&lt;&#x2F;strong&gt; Include the address; omit from &lt;code&gt;balance_changes&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Gas refunds:&lt;&#x2F;strong&gt; Record the &lt;strong&gt;final&lt;&#x2F;strong&gt; balance of the sender after each transaction.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Block rewards:&lt;&#x2F;strong&gt; Record the &lt;strong&gt;final&lt;&#x2F;strong&gt; balance of the fee recipient after each transaction.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Exceptional halts:&lt;&#x2F;strong&gt; Record the &lt;strong&gt;final&lt;&#x2F;strong&gt; nonce and balance of the sender, and the &lt;strong&gt;final&lt;&#x2F;strong&gt; balance of the fee recipient after each transaction. State changes from the reverted call are discarded, but all accessed addresses &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be included. If no changes remain, addresses are included with empty lists; if storage was read, the corresponding keys &lt;strong&gt;MUST&lt;&#x2F;strong&gt; appear in &lt;code&gt;storage_reads&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Pre‑execution system contract calls:&lt;&#x2F;strong&gt; All state changes &lt;strong&gt;MUST&lt;&#x2F;strong&gt; use &lt;code&gt;block_access_index = 0&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Post‑execution system contract calls:&lt;&#x2F;strong&gt; All state changes &lt;strong&gt;MUST&lt;&#x2F;strong&gt; use &lt;code&gt;block_access_index = len(transactions) + 1&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;EIP-7702 Delegations:&lt;&#x2F;strong&gt; The authority address &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be included with nonce and code changes after any successful delegation set, update, or clear. If authorization fails after the authority address has been loaded and added to &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt; (per &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;), it &lt;strong&gt;MUST&lt;&#x2F;strong&gt; still be included with an empty change set; if authorization fails before the authority is loaded, it &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; be included. The delegation target &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; be included during delegation creation or modification and MUST only be included once it is actually loaded as an execution target (e.g., via &lt;code&gt;CALL&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;CALLCODE&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;STATICCALL&lt;&#x2F;code&gt; under authority execution).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;EIP‑4895 (Consensus layer withdrawals):&lt;&#x2F;strong&gt; Recipients are recorded with their final balance after the withdrawal.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;EIP‑2935 (block hash):&lt;&#x2F;strong&gt; Record system contract storage diffs of the &lt;strong&gt;single&lt;&#x2F;strong&gt; updated storage slot in the ring buffer.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;EIP‑4788 (beacon root):&lt;&#x2F;strong&gt; Record system contract storage diffs of the &lt;strong&gt;two&lt;&#x2F;strong&gt; updated storage slots in the ring buffer.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;EIP‑7002 (withdrawals):&lt;&#x2F;strong&gt; Record system contract storage diffs of storage slots &lt;strong&gt;0–3&lt;&#x2F;strong&gt; (4 slots) after the dequeuing call.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;EIP‑7251 (consolidations):&lt;&#x2F;strong&gt; Record system contract storage diffs of storage slots &lt;strong&gt;0–3&lt;&#x2F;strong&gt; (4 slots) after the dequeuing call.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;engine-api&quot;&gt;Engine API&lt;&#x2F;h3&gt;
&lt;p&gt;The Engine API is extended with new structures and methods to support block-level access lists:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;ExecutionPayloadV4&lt;&#x2F;strong&gt; extends ExecutionPayloadV3 with:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;blockAccessList&lt;&#x2F;code&gt;: RLP-encoded block access list&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;engine_newPayloadV5&lt;&#x2F;strong&gt; validates execution payloads:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Accepts &lt;code&gt;ExecutionPayloadV4&lt;&#x2F;code&gt; structure&lt;&#x2F;li&gt;
&lt;li&gt;Validates that computed access list matches provided &lt;code&gt;blockAccessList&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Returns &lt;code&gt;INVALID&lt;&#x2F;code&gt; if access list is malformed or doesn&#x27;t match&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;engine_getPayloadV6&lt;&#x2F;strong&gt; builds execution payloads:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Returns &lt;code&gt;ExecutionPayloadV4&lt;&#x2F;code&gt; structure&lt;&#x2F;li&gt;
&lt;li&gt;Collects all account accesses and state changes during transaction execution&lt;&#x2F;li&gt;
&lt;li&gt;Populates &lt;code&gt;blockAccessList&lt;&#x2F;code&gt; field with RLP-encoded access list&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Block processing flow:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;When processing a block:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The EL receives the BAL in the ExecutionPayload&lt;&#x2F;li&gt;
&lt;li&gt;The EL computes &lt;code&gt;block_access_list_hash = keccak256(blockAccessList)&lt;&#x2F;code&gt; and includes it in the block header&lt;&#x2F;li&gt;
&lt;li&gt;The EL executes the block and generates the actual BAL&lt;&#x2F;li&gt;
&lt;li&gt;If the generated BAL doesn&#x27;t match the provided BAL, the block is invalid (the hash in the header would be wrong)&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The execution layer provides the RLP-encoded &lt;code&gt;blockAccessList&lt;&#x2F;code&gt; to the consensus layer via the Engine API. The consensus layer then computes the SSZ &lt;code&gt;hash_tree_root&lt;&#x2F;code&gt; for storage in the &lt;code&gt;ExecutionPayload&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Retrieval methods&lt;&#x2F;strong&gt; for historical BALs:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;engine_getPayloadBodiesByHashV2&lt;&#x2F;code&gt;: Returns &lt;code&gt;ExecutionPayloadBodyV2&lt;&#x2F;code&gt; objects containing transactions, withdrawals, and &lt;code&gt;blockAccessList&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;engine_getPayloadBodiesByRangeV2&lt;&#x2F;code&gt;: Returns &lt;code&gt;ExecutionPayloadBodyV2&lt;&#x2F;code&gt; objects containing transactions, withdrawals, and &lt;code&gt;blockAccessList&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;code&gt;blockAccessList&lt;&#x2F;code&gt; field contains the RLP-encoded BAL or &lt;code&gt;null&lt;&#x2F;code&gt; for pre-Amsterdam blocks or when data has been pruned.&lt;&#x2F;p&gt;
&lt;p&gt;The EL MUST retain BALs for at least the duration of the weak subjectivity period (&lt;code&gt;=3533 epochs&lt;&#x2F;code&gt;) to support synchronization with re-execution after being offline for less than the WSP.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;state-transition-function&quot;&gt;State Transition Function&lt;&#x2F;h3&gt;
&lt;p&gt;The state transition function must validate that the provided BAL matches the actual state accesses:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validate_block&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;execution_payload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; block_header&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 1. Compute hash from received BAL and set in header&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;block_access_list_hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; keccak&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;execution_payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;blockAccessList&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 2. Execute block and collect actual accesses&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    actual_bal&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; execute_and_collect_accesses&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;execution_payload&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 3. Verify actual execution matches provided BAL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If this fails, the block is invalid (the hash in the header would be wrong)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; rlp&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;actual_bal&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; execution_payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;blockAccessList&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; execute_and_collect_accesses&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Execute block and collect all state accesses into BAL format&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    accesses&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Pre-execution system contracts (block_access_index = 0)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    track_system_contracts_pre&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; accesses&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; block_access_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Execute transactions (block_access_index = 1..n)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; enumerate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;transactions&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        execute_transaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        track_state_changes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; accesses&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; block_access_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Withdrawals and post-execution (block_access_index = len(txs) + 1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    post_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;transactions&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; withdrawal&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;withdrawals&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        apply_withdrawal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;withdrawal&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        track_balance_change&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;withdrawal&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; accesses&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; post_index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    track_system_contracts_post&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; accesses&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; post_index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Convert to BAL format and sort&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; build_bal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;accesses&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; track_state_changes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; accesses&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; block_access_index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Track all state changes from a transaction&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; get_touched_addresses&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; accesses&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            accesses&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;                &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;storage_writes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; slot -&amp;gt; [(index, value)]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;                &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;storage_reads&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; set&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;                &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;balance_changes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;                &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;nonce_changes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;                &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;code_changes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Track storage changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; slot&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; get_storage_writes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;items&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; accesses&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;storage_writes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                accesses&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;storage_writes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            accesses&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;storage_writes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block_access_index&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Track reads (slots accessed but not written)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; get_storage_reads&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; accesses&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;storage_writes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                accesses&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;storage_reads&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Track balance, nonce, code changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; balance_changed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            accesses&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;balance_changes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block_access_index&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; get_balance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; nonce_changed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            accesses&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;nonce_changes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block_access_index&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; get_nonce&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; code_changed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            accesses&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;code_changes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block_access_index&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; get_code&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; build_bal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;accesses&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Convert collected accesses to BAL format&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bal&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; sorted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;accesses&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;keys&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sort addresses lexicographically&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; accesses&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Format storage changes: [slot, [[index, value], ...]]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        storage_changes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; sorted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;changes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                          for&lt;&#x2F;span&gt;&lt;span&gt; slot&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; changes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; sorted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;storage_writes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;items&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Account entry: [address, storage_changes, reads, balance_changes, nonce_changes, code_changes]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bal&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            addr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            storage_changes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            sorted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;list&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;storage_reads&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            sorted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;balance_changes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            sorted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;nonce_changes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            sorted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;code_changes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; bal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The BAL MUST be complete and accurate. Missing or spurious entries invalidate the block. Spurious entries MAY be detected by validating BAL indices, which MUST never be higher than &lt;code&gt;len(transactions) + 1&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Clients MAY invalidate immediately if any transaction exceeds declared state.&lt;&#x2F;p&gt;
&lt;p&gt;Clients MUST store BALs separately from blocks and make them available via the engine API.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;concrete-example&quot;&gt;Concrete Example&lt;&#x2F;h3&gt;
&lt;p&gt;Example block:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Pre-execution:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;EIP-2935: Store parent hash at block hash contract (&lt;code&gt;0x0000F90827F1C53a10cb7A02335B175320002935&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;EIP-7002: Omitted for simplicity.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Transactions:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Alice (0xaaaa...) sends 1 ETH to Bob (0xbbbb...), checks balance of 0x2222...&lt;&#x2F;li&gt;
&lt;li&gt;Charlie (0xcccc...) calls factory (0xffff...) deploying contract at 0xdddd...&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;strong&gt;Post-execution:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Withdrawal of 100 ETH to Eve (0xabcd...)&lt;&#x2F;li&gt;
&lt;li&gt;EIP-7002 and EIP-7251 omitted for simplicity.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note: Pre-execution system contract uses block_access_index = 0. Post-execution withdrawal uses block_access_index = 3 (len(transactions) + 1)&lt;&#x2F;p&gt;
&lt;p&gt;Resulting BAL (RLP structure):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Addresses are sorted lexicographically&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; AccountChanges for 0x0000F90827F1C53a10cb7A02335B175320002935 (Block hash contract)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0000F90827F1C53a10cb7A02335B175320002935&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; storage_changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            [&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\x00&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;...&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\x0f&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\xa0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; slot, [[block_access_index, parent_hash]]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; storage_reads&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; balance_changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; nonce_changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;   #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; code_changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; AccountChanges for 0x2222... (Address checked by Alice)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2222&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; storage_changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; storage_reads&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; balance_changes (no change, just checked)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; nonce_changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;   #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; code_changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; AccountChanges for 0xaaaa... (Alice - sender tx 0)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;aaaa&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; storage_changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; storage_reads&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;29a241a&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; balance_changes: [[block_access_index, post_balance]]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; nonce_changes: [[block_access_index, new_nonce]]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; code_changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; AccountChanges for 0xabcd... (Eve - withdrawal recipient)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;abcd&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; storage_changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; storage_reads&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;5f5e100&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; balance_changes: 100 ETH withdrawal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; nonce_changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;   #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; code_changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; AccountChanges for 0xbbbb... (Bob - recipient tx 0)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;bbbb&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; storage_changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; storage_reads&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;span&gt;b9aca00&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; balance_changes: +1 ETH&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; nonce_changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;   #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; code_changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; AccountChanges for 0xcccc... (Charlie - sender tx 1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;cccc&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; storage_changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; storage_reads&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;span&gt;bc16d67&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; balance_changes: after gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 5&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; nonce_changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; code_changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; AccountChanges for 0xdddd... (Deployed contract)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;dddd&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; storage_changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; storage_reads&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; balance_changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; nonce_changes: new contract nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\x60&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\x80&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\x60&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\x40&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; code_changes: deployed bytecode&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; AccountChanges for 0xeeee... (COINBASE)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;eeee&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; storage_changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; storage_reads&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;05f5e1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;0bebc2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; balance_changes: after tx fees&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; nonce_changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;   #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; code_changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; AccountChanges for 0xffff... (Factory contract)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;ffff&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; storage_changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            [&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\x00&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;...&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\x01&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\x00&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;...&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\xdd&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\xdd&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; slot 1, deployed address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; storage_reads&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; balance_changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 5&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; nonce_changes: after CREATE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; code_changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;RLP-encoded and compressed: ~400-500 bytes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;bal-design-choice&quot;&gt;BAL Design Choice&lt;&#x2F;h3&gt;
&lt;p&gt;This design variant was chosen for several key reasons:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Size vs parallelization&lt;&#x2F;strong&gt;: BALs include all accessed addresses (even unchanged) for complete parallel IO and execution.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Storage values for writes&lt;&#x2F;strong&gt;: Post-execution values enable state reconstruction during sync without individual proofs against state root.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Overhead analysis&lt;&#x2F;strong&gt;: Historical data shows ~70 KiB average BAL size.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Transaction independence&lt;&#x2F;strong&gt;: 60-80% of transactions access disjoint storage slots, enabling effective parallelization. The remaining 20-40% can be parallelized by having post-transaction state diffs.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;RLP encoding&lt;&#x2F;strong&gt;: Native Ethereum encoding format, maintains compatibility with existing infrastructure.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;bal-size-considerations-60m-block-gas-limit&quot;&gt;BAL Size Considerations (60m block gas limit)&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;Average BAL size&lt;&#x2F;strong&gt;: ~72.4 KiB (compressed)&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Storage writes: ~29.2 KiB (40.3%)&lt;&#x2F;li&gt;
&lt;li&gt;Storage reads: ~18.7 KiB (25.8%)&lt;&#x2F;li&gt;
&lt;li&gt;Balance diffs: ~6.7 KiB (9.2%)&lt;&#x2F;li&gt;
&lt;li&gt;Nonce diffs: ~1.1 KiB (1.5%)&lt;&#x2F;li&gt;
&lt;li&gt;Code diffs: ~1.2 KiB (1.6%)&lt;&#x2F;li&gt;
&lt;li&gt;Account addresses (with diffs): ~7.7 KiB (10.7%)&lt;&#x2F;li&gt;
&lt;li&gt;Touched-only addresses: ~3.5 KiB (4.8%)&lt;&#x2F;li&gt;
&lt;li&gt;RLP encoding overhead: ~4.4 KiB (6.1%)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Smaller than current worst-case calldata blocks.&lt;&#x2F;p&gt;
&lt;p&gt;An empirical analysis has been done &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7928&#x2F;assets&#x2F;bal_size_analysis&#x2F;&quot;&gt;here&lt;&#x2F;a&gt;. An updated analysis for a 60 million block gas limit can be found &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7928&#x2F;assets&#x2F;bal_size_analysis_60m&#x2F;&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;asynchronous-validation&quot;&gt;Asynchronous Validation&lt;&#x2F;h3&gt;
&lt;p&gt;BAL verification occurs alongside parallel IO and EVM operations without delaying block processing.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal requires changes to the block structure and engine API that are not backwards compatible and require a hard fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;validation-overhead&quot;&gt;Validation Overhead&lt;&#x2F;h3&gt;
&lt;p&gt;Validating access lists and balance diffs adds validation overhead but is essential to prevent acceptance of invalid blocks.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;block-size&quot;&gt;Block Size&lt;&#x2F;h3&gt;
&lt;p&gt;Increased block size impacts propagation but overhead (~70 KiB average) is reasonable for performance gains.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Linear, Page-Based Memory Costing</title>
        <published>2025-03-27T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Charles Cooper</name><uri>https://github.com/charles-cooper</uri>
	</author>
	
	<author>
		<name>Qi Zhou</name><uri>https://github.com/qizhou</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7923/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-linearize-memory-costing/23290" />
        

        <id>https://wg-eips.ritovision.com/7923/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7923"
            label="EIP-7923" />
        

        
        

        
        <summary type="html">Linearize Memory Costing and replace the current quadratic formula with a page-based cost model.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7923/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP replaces the quadratic memory model in the EVM with a linear, page-based costing model. Memory is virtually addressable. Page allocation is included in the cost model. After applying this EIP, memory limits are invariant to the state of the message call stack.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The EVM currently uses a quadratic pricing model for its memory. This was originally put in place to defend against DoS attacks. However, the memory model has several drawbacks.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;It is anachronistic. Even at a gas limit of 30 million gas, users can only use 3MB of memory in a message call (and that burns all gas). Since the quadratic term for memory expansion starts kicking in at 724 bytes, users use much less memory in practice. To use even 64KB of memory -- the amount of memory available to a PC from the early 80&#x27;s -- costs 14336 gas!&lt;&#x2F;li&gt;
&lt;li&gt;The quadratic model makes it difficult to reason about how much memory a transaction can allocate. It requires solving an optimization problem which involves computing how many message calls are available to recurse into based on the call stack limit (and, post &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;150&#x2F;&quot;&gt;EIP-150&lt;&#x2F;a&gt;, the 63&#x2F;64ths rule), and then maximizing the memory used per message call.&lt;&#x2F;li&gt;
&lt;li&gt;The quadratic model makes it impossible for high-level smart contracts languages to get the benefits of virtual memory. Most modern programming languages maintain what is known as the &quot;heap&quot; and the &quot;call stack&quot;. The heap is used to allocate objects which live past the lifetime of their current function frame, whereas the call stack is used to allocate objects which live in the current function frames. Importantly, the call stack starts at the top of memory and grows down, while the heap starts at the bottom of memory and grows up, thus the language implementation does not need to worry about the two regions of memory interfering with each other. This is a feature which is enabled by virtual, paged memory, which has been present in operating systems since the early 90&#x27;s. However, smart contract languages like Vyper and Solidity are not able to implement this, leading to inefficiencies in their memory models.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;This EIP proposes a linear costing model which more closely reflects the hardware of today, which is hierarchical (&quot;hot&quot; memory is much faster to access than &quot;cold&quot; memory), and virtually addressed (memory does not need to be allocated contiguously, but is rather served &quot;on-demand&quot; by the operating system).&lt;&#x2F;p&gt;
&lt;p&gt;First, some preliminaries. A page is 4096 bytes on most architectures. Given a memory address, its page is simple to compute by masking out the rightmost 12 bits.&lt;&#x2F;p&gt;
&lt;p&gt;There are two factors which contribute to &quot;cold&quot; memory (i.e. not-recently-used) being slower: CPU cache and TLB (Translation Lookaside Buffer) cache. The CPU cache is a least-recently-used memory cache, which is significantly faster than fetching all the way from RAM. The TLB is usually some hash table which maps virtual pages (used by the user) to physical pages in RAM. &quot;Thrashing&quot;, or accessing a lot of different memory addresses, does two things: it pushes memory out of the hot cache and into cold memory, and it pushes pages out of the TLB cache. For this reason, it is worth limiting the amount of memory that is available to a transaction to memory which can be held in the hot set.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP uses a virtual addressing scheme so that memory pages are not allocated until they are actually accessed.&lt;&#x2F;p&gt;
&lt;p&gt;Notably, the data structures used for costing memory do not need to be part of the memory implementation itself, which suggests an elegant implementation using the POSIX &lt;code&gt;mmap&lt;&#x2F;code&gt; syscall (or, its counterpart on Windows, &lt;code&gt;VirtualAlloc&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;The implementation can be approached in two ways. The first way is to implement the virtual addressing &quot;manually&quot;. This is intended for systems without &lt;code&gt;mmap&lt;&#x2F;code&gt; or a virtual addressing capability. The implementation needs to maintain a map from &lt;code&gt;map[page_id -&amp;gt; char[4096]]&lt;&#x2F;code&gt;, where &lt;code&gt;page_id&lt;&#x2F;code&gt; is an integer, computed as &lt;code&gt;memory_address &amp;gt;&amp;gt; 12&lt;&#x2F;code&gt;. (On reads or writes which cross page boundaries, the implementation needs to load both pages and combine the result of the read or write across both pages).&lt;&#x2F;p&gt;
&lt;p&gt;The other implementation is easier, for systems with &lt;code&gt;mmap&lt;&#x2F;code&gt; or a similar facility. To hold the actual data of the memory, the implementation &lt;code&gt;mmap&lt;&#x2F;code&gt;s a &lt;code&gt;2**32&lt;&#x2F;code&gt; byte region of memory. Then, memory operations can be implemented simply as reads or writes against this buffer. (With an anonymous &lt;code&gt;mmap&lt;&#x2F;code&gt;, the operating system will not allocate the entire buffer up-front, rather, it will allocate pages &quot;on demand&quot;, as they are touched). The &lt;code&gt;pages&lt;&#x2F;code&gt; map is still necessary, but it doesn&#x27;t hold any data, it is just to track which pages have been allocated, for pricing purposes. In this implementation, there are two data structures: &lt;code&gt;memory char[2**32]&lt;&#x2F;code&gt; and &lt;code&gt;allocated_pages set[page_id]&lt;&#x2F;code&gt;. The &lt;code&gt;memory&lt;&#x2F;code&gt; data structure is only used for memory reads and writes. The &lt;code&gt;allocated_pages&lt;&#x2F;code&gt; is only used for gas costing.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Consider the following constants:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;ALLOCATE_PAGE_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 100&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;PAGE_SIZE&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 4096&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;MAXIMUM_MEMORY_SIZE&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 64&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1024&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1024&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The memory costing algorithm is changed as follows:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;For each page touched by an instruction, charge &lt;code&gt;ALLOCATE_PAGE_COST&lt;&#x2F;code&gt; gas if it has not been touched before in this message call, except for page 0 which is free.&lt;&#x2F;li&gt;
&lt;li&gt;The base gas cost for all memory instructions, e.g. &lt;code&gt;MLOAD&lt;&#x2F;code&gt; and &lt;code&gt;MSTORE&lt;&#x2F;code&gt;, remains the same, at 3.&lt;&#x2F;li&gt;
&lt;li&gt;The linear and quadratic terms in the memory expansion cost are removed.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The behavior of &lt;code&gt;msize&lt;&#x2F;code&gt; remains the same. It returns the maximum byte touched by any memory instruction, rounded up by 32.&lt;&#x2F;p&gt;
&lt;p&gt;Memory addresses are restricted to 32-bits. If an address is larger than &lt;code&gt;2**32 - 1&lt;&#x2F;code&gt;, an exceptional halt should be raised.&lt;&#x2F;p&gt;
&lt;p&gt;A transaction-global memory limit is imposed. If the number of pages allocated in a transaction exceeds &lt;code&gt;MAXIMUM_MEMORY_SIZE &#x2F;&#x2F; PAGE_SIZE&lt;&#x2F;code&gt; (i.e., 16384), an exceptional halt should be raised.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Benchmarks were performed on a 2019-era CPU, with the ability to &lt;code&gt;keccak256&lt;&#x2F;code&gt; around 256MB&#x2F;s, giving it a gas-to-ns ratio of 20 ns per 1 gas (given that &lt;code&gt;keccak256&lt;&#x2F;code&gt; costs 6 gas per 32 bytes). The following benchmarks were performed:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Time to allocate a fresh page: 1-2us&lt;&#x2F;li&gt;
&lt;li&gt;Time to randomly read a byte from a 2MB range: 1.8ns&lt;&#x2F;li&gt;
&lt;li&gt;Time to randomly read a byte from a 32MB range: 7ns&lt;&#x2F;li&gt;
&lt;li&gt;Time to randomly read a byte from a 4GB range: 40ns&lt;&#x2F;li&gt;
&lt;li&gt;Time to update a hashmap with 512 items: 8ns&lt;&#x2F;li&gt;
&lt;li&gt;Time to update a hashmap with 8192 items: 9ns&lt;&#x2F;li&gt;
&lt;li&gt;Time to update a hashmap with 5mm items: 108ns&lt;&#x2F;li&gt;
&lt;li&gt;Time to execute the &lt;code&gt;mmap&lt;&#x2F;code&gt; syscall: 230ns&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;These suggest the following prices:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;100 gas to allocate a page&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note that the cost to execute &lt;code&gt;mmap&lt;&#x2F;code&gt; (~11 gas) is already well-paid for by the base cost of the CALL series of instructions (100 gas). For the same reason, page 0 is free, since the CALL overhead already pays for the initial page allocation. This also improves backwards compatibility, since it keeps the cost for any access within the first page either the same as or lower than current pricing.&lt;&#x2F;p&gt;
&lt;p&gt;There is a desire among client implementations to be able to enforce global limits separately from the gas limit due to DoS reasons. For example, RPC providers may be designed to allow many concurrent &lt;code&gt;eth_call&lt;&#x2F;code&gt; computations with a much higher gas limit than on mainnet. Not implicitly tying the memory limit to the gas limit results in one less vector for misconfiguration. That is not to say that in the future, a clean formula cannot be created which allows the memory limit to scale with future hardware improvements (e.g., proportional to the sqrt of the gas limit), but to limit the scope of things that need to be reasoned about for this EIP, the hard limit is introduced.&lt;&#x2F;p&gt;
&lt;p&gt;The hard limit is specified as a transaction-global limit rather than a message-call limit. That is, a reasonable alternative could be to limit the number of pages that can be allocated in a given message call, e.g., to 2MB, but it doesn&#x27;t significantly improve implementation complexity.&lt;&#x2F;p&gt;
&lt;p&gt;On keeping the semantics of &lt;code&gt;MSIZE&lt;&#x2F;code&gt; the same:
With users expected to use the full address space instead of growing it linearly, the rationale for keeping &lt;code&gt;MSIZE&lt;&#x2F;code&gt; semantics the same is to avoid breaking backwards compatibility with existing contracts which expect it to grow linearly. New contracts taking advantage of the new virtual addressing scheme should not rely on &lt;code&gt;MSIZE&lt;&#x2F;code&gt; for memory allocation.&lt;&#x2F;p&gt;
&lt;p&gt;A hard limit of &lt;code&gt;2**32&lt;&#x2F;code&gt; bytes was imposed on the addressing. This makes it simpler for modern 64-bit computers to allocate that much virtual address space, given that clients run on a diverse set of operating systems and architectures which have different virtual memory limits per process. This could be revisited in the future, for instance if gas limits or client memory sizes substantially increase.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Addressed in Security Considerations section. No backwards compatibility is broken, although some contracts that previously ran out of gas may now successfully complete.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;A ~60-line reference implementation is provided below. It is implemented as a patch against the &lt;code&gt;py-evm&lt;&#x2F;code&gt; codebase at commit ethereum&#x2F;py-evm@fec63b8c4b9dad9fcb1022c48c863bdd584820c6. (This is a reference implementation, it does not, for example, contain fork choice rules).&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;diff&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-meta z-diff z-header&quot;&gt;diff --git a&#x2F;eth&#x2F;vm&#x2F;computation.py b&#x2F;eth&#x2F;vm&#x2F;computation.py&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;index bf34fbee..db85aee7 100644&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-meta z-diff z-header z-from-file&quot;&gt;---&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-diff z-header z-from-file&quot;&gt; a&#x2F;eth&#x2F;vm&#x2F;computation.py&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-meta z-diff z-header z-to-file&quot;&gt;+++&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-diff z-header z-to-file&quot;&gt; b&#x2F;eth&#x2F;vm&#x2F;computation.py&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-meta z-diff z-range&quot;&gt;@@&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-diff z-range&quot;&gt; -454,34 +454,40&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-diff z-range&quot;&gt; @@&lt;&#x2F;span&gt;&lt;span&gt; class BaseComputation(ComputationAPI, Configurable):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         validate_uint256(start_position, title=&amp;quot;Memory start position&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         validate_uint256(size, title=&amp;quot;Memory size&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;        before_size = ceil32(len(self._memory))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;        after_size = ceil32(start_position + size)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;        before_cost = memory_gas_cost(before_size)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;        after_cost = memory_gas_cost(after_size)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;        if self.logger.show_debug2:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;            self.logger.debug2(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;                f&amp;quot;MEMORY: size ({before_size} -&amp;gt; {after_size}) | &amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;                f&amp;quot;cost ({before_cost} -&amp;gt; {after_cost})&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;            )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;        if size:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;            if before_cost &amp;lt; after_cost:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;                gas_fee = after_cost - before_cost&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;                self._gas_meter.consume_gas(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;                    gas_fee,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;                    reason=&amp;quot; &amp;quot;.join(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;                        (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;                            &amp;quot;Expanding memory&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;                            str(before_size),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;                            &amp;quot;-&amp;gt;&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;                            str(after_size),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;                        )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;                    ),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;                )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;            self._memory.extend(start_position, size)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        if size == 0:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;            return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        ALLOCATE_PAGE_COST = 100&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        LOWER_BITS = 12  # bits ignored for page calculations&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        PAGE_SIZE = 4096&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        assert 2**LOWER_BITS == PAGE_SIZE   # sanity check&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        MAXIMUM_MEMORY_SIZE = 64 * 1024 * 1024&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        TRANSACTION_MAX_PAGES = MAXIMUM_MEMORY_SIZE &#x2F;&#x2F; PAGE_SIZE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        end_position = start_position + size - 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        start_page = start_position &amp;gt;&amp;gt; LOWER_BITS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        end_page = end_position &amp;gt;&amp;gt; LOWER_BITS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        for page in range(start_page, end_page + 1):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;            if page not in self._memory.pages:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;                if self.transaction_context.num_pages &amp;gt;= TRANSACTION_MAX_PAGES:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;                    raise VMError(&amp;quot;Out Of Memory&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;                self.transaction_context.num_pages += 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;                reason = f&amp;quot;Allocating page {hex(page &amp;lt;&amp;lt; LOWER_BITS)}&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;                self._gas_meter.consume_gas(ALLOCATE_PAGE_COST, reason)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;                self._memory.pages[page] = True&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     def memory_write(self, start_position: int, size: int, value: bytes) -&amp;gt; None:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         return self._memory.write(start_position, size, value)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-meta z-diff z-header&quot;&gt;diff --git a&#x2F;eth&#x2F;vm&#x2F;forks&#x2F;frontier&#x2F;computation.py b&#x2F;eth&#x2F;vm&#x2F;forks&#x2F;frontier&#x2F;computation.py&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;index 51666ae0..443f82b5 100644&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-meta z-diff z-header z-from-file&quot;&gt;---&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-diff z-header z-from-file&quot;&gt; a&#x2F;eth&#x2F;vm&#x2F;forks&#x2F;frontier&#x2F;computation.py&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-meta z-diff z-header z-to-file&quot;&gt;+++&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-diff z-header z-to-file&quot;&gt; b&#x2F;eth&#x2F;vm&#x2F;forks&#x2F;frontier&#x2F;computation.py&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-meta z-diff z-range&quot;&gt;@@&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-diff z-range&quot;&gt; -29,6 +29,7&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-diff z-range&quot;&gt; @@&lt;&#x2F;span&gt;&lt;span&gt; from eth.exceptions import (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     InsufficientFunds,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     OutOfGas,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     StackDepthLimit,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;    VMError,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; from eth.vm.computation import (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     BaseComputation,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-meta z-diff z-range&quot;&gt;@@&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-diff z-range&quot;&gt; -87,12 +88,21&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-diff z-range&quot;&gt; @@&lt;&#x2F;span&gt;&lt;span&gt; class FrontierComputation(BaseComputation):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         state.touch_account(message.storage_address)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;        computation = cls.apply_computation(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;            state,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;            message,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;            transaction_context,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;            parent_computation=parent_computation,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;        )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        # implement transaction-global memory limit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        num_pages_anchor = transaction_context.num_pages&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        try:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;            computation = cls.apply_computation(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;                state,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;                message,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;                transaction_context,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;                parent_computation=parent_computation,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;            )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        finally:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;            # &amp;quot;deallocate&amp;quot; all the pages allocated in the child computation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;            # sanity check an invariant:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;            allocated_pages = len(computation._memory.pages)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;            assert transaction_context.num_pages == num_pages_anchor + allocated pages&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;            transaction_context.num_pages = num_pages_anchor&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         if computation.is_error:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             state.revert(snapshot)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-meta z-diff z-header&quot;&gt;diff --git a&#x2F;eth&#x2F;vm&#x2F;logic&#x2F;memory.py b&#x2F;eth&#x2F;vm&#x2F;logic&#x2F;memory.py&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;index 806dbd8b..247b3c74 100644&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-meta z-diff z-header z-from-file&quot;&gt;---&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-diff z-header z-from-file&quot;&gt; a&#x2F;eth&#x2F;vm&#x2F;logic&#x2F;memory.py&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-meta z-diff z-header z-to-file&quot;&gt;+++&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-diff z-header z-to-file&quot;&gt; b&#x2F;eth&#x2F;vm&#x2F;logic&#x2F;memory.py&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-meta z-diff z-range&quot;&gt;@@&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-diff z-range&quot;&gt; -43,7 +43,7&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-diff z-range&quot;&gt; @@&lt;&#x2F;span&gt;&lt;span&gt; def mload(computation: ComputationAPI) -&amp;gt; None:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; def msize(computation: ComputationAPI) -&amp;gt; None:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;    computation.stack_push_int(len(computation._memory))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;    computation.stack_push_int(computation._memory.msize)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; def mcopy(computation: ComputationAPI) -&amp;gt; None:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-meta z-diff z-header&quot;&gt;diff --git a&#x2F;eth&#x2F;vm&#x2F;memory.py b&#x2F;eth&#x2F;vm&#x2F;memory.py&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;index 2ccfd090..9002b559 100644&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-meta z-diff z-header z-from-file&quot;&gt;---&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-diff z-header z-from-file&quot;&gt; a&#x2F;eth&#x2F;vm&#x2F;memory.py&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-meta z-diff z-header z-to-file&quot;&gt;+++&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-diff z-header z-to-file&quot;&gt; b&#x2F;eth&#x2F;vm&#x2F;memory.py&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-meta z-diff z-range&quot;&gt;@@&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-diff z-range&quot;&gt; -1,8 +1,11&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-diff z-range&quot;&gt; @@&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; import logging&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;import mmap&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; from eth._utils.numeric import (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     ceil32,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;from eth.exceptions import VMError&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; from eth.abc import (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     MemoryAPI,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-meta z-diff z-range&quot;&gt;@@&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-diff z-range&quot;&gt; -13,52 +16,48&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-diff z-range&quot;&gt; @@&lt;&#x2F;span&gt;&lt;span&gt; from eth.validation import (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     validate_uint256,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; class Memory(MemoryAPI):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;    __slots__ = [&amp;quot;_bytes&amp;quot;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;    __slots__ = (&amp;quot;pages&amp;quot;, &amp;quot;msize&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     logger = logging.getLogger(&amp;quot;eth.vm.memory.Memory&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     def __init__(self) -&amp;gt; None:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;        self._bytes = bytearray()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        self.memview = mmap.mmap(-1, 2**32, flags=mmap.MAP_PRIVATE | mmap.MAP_ANONYMOUS)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        self.pages = {0: True}  # page 0 is free (per spec)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        self.msize = 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     def extend(self, start_position: int, size: int) -&amp;gt; None:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         if size == 0:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;        new_size = ceil32(start_position + size)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;        if new_size &amp;lt;= len(self):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        if start_position + size &amp;gt; self.msize:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;            self.msize = ceil32(start_position + size)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;    def write(self, start_position: int, size: int, value: bytes) -&amp;gt; None:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        if size == 0:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;        size_to_extend = new_size - len(self)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;        try:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;            self._bytes.extend(bytearray(size_to_extend))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;        except BufferError:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;            # we can&amp;#39;t extend the buffer (which might involve relocating it) if a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;            # memoryview (which stores a pointer into the buffer) has been created by&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;            # read() and not released. Callers of read() will never try to write to the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;            # buffer so we&amp;#39;re not missing anything by making a new buffer and forgetting&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;            # about the old one. We&amp;#39;re keeping too much memory around but this is still&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;            # a net savings over having read() return a new bytes() object every time.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;            self._bytes = self._bytes + bytearray(size_to_extend)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;    def __len__(self) -&amp;gt; int:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;        return len(self._bytes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        if start_position + size &amp;gt;= 2**32:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;            raise VMError(&amp;quot;Non 32-bit address&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;    def write(self, start_position: int, size: int, value: bytes) -&amp;gt; None:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;        if size:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;            validate_uint256(start_position)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;            validate_uint256(size)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;            validate_is_bytes(value)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;            validate_length(value, length=size)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;            validate_lte(start_position + size, maximum=len(self))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        validate_uint256(start_position)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        validate_uint256(size)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        validate_is_bytes(value)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        validate_length(value, length=size)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        end_position = start_position + size&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;            self._bytes[start_position : start_position + len(value)] = value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        self.memview[start_position : end_position] = value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;    # unused&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     def read(self, start_position: int, size: int) -&amp;gt; memoryview:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;        return memoryview(self._bytes)[start_position : start_position + size]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        return memoryview(self.memview)[start_position : start_position + size]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     def read_bytes(self, start_position: int, size: int) -&amp;gt; bytes:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;        return bytes(self._bytes[start_position : start_position + size])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        return bytes(self.memview[start_position : start_position + size])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     def copy(self, destination: int, source: int, length: int) -&amp;gt; None:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         if length == 0:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-meta z-diff z-range&quot;&gt;@@&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-diff z-range&quot;&gt; -69,5 +68,5&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-diff z-range&quot;&gt; @@&lt;&#x2F;span&gt;&lt;span&gt; class Memory(MemoryAPI):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         validate_uint256(length)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         validate_lte(max(destination, source) + length, maximum=len(self))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;        buf = memoryview(self._bytes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        buf = memoryview(self.memview)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         buf[destination : destination + length] = buf[source : source + length]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-meta z-diff z-header&quot;&gt;diff --git a&#x2F;eth&#x2F;vm&#x2F;transaction_context.py b&#x2F;eth&#x2F;vm&#x2F;transaction_context.py&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;index 79b570e9..5943f897 100644&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-meta z-diff z-header z-from-file&quot;&gt;---&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-diff z-header z-from-file&quot;&gt; a&#x2F;eth&#x2F;vm&#x2F;transaction_context.py&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-meta z-diff z-header z-to-file&quot;&gt;+++&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-diff z-header z-to-file&quot;&gt; b&#x2F;eth&#x2F;vm&#x2F;transaction_context.py&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-meta z-diff z-range&quot;&gt;@@&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-diff z-range&quot;&gt; -36,6 +36,9&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-diff z-range&quot;&gt; @@&lt;&#x2F;span&gt;&lt;span&gt; class BaseTransactionContext(TransactionContextAPI):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         # post-cancun&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         self._blob_versioned_hashes = blob_versioned_hashes or []&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        # eip-7923&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        self.num_pages = 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     def get_next_log_counter(self) -&amp;gt; int:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         return next(self._log_counter)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;There are two primary security considerations regarding this EIP.&lt;&#x2F;p&gt;
&lt;p&gt;One, does it break existing contracts? That is, do existing contracts depend on memory being restricted?&lt;&#x2F;p&gt;
&lt;p&gt;Outside of gas costing, existing contracts may simply execute to completion rather than running out of gas.&lt;&#x2F;p&gt;
&lt;p&gt;Two, does this enable memory-based DoS attacks against clients?&lt;&#x2F;p&gt;
&lt;p&gt;This requires a maximum-memory usage analysis. Based on a gas limit today of 30mm gas, recursively calling a contract that allocates 256KB of memory in each call stack can allocate 54MB of total memory, which is not substantially different than the 64MB limit proposed in this EIP. Note that the transaction-global memory limit proposed in this EIP provides a useful invariant, which is that future changes to call stack limits will not affect the total amount of memory that can be allocated in a given transaction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Skip `JUMPDEST` immediate argument check</title>
        <published>2025-03-26T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>William Morriss</name><uri>https://github.com/wjmelements</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7921/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7921-skip-jumpdest-immediate-argument-check/23279" />
        

        <id>https://wg-eips.ritovision.com/7921/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:7921"
            label="EIP-7921" />
        

        
        

        
        <summary type="html">All `JUMPDEST` bytes become valid `JUMPDEST`</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7921/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Allow &lt;code&gt;JUMP&lt;&#x2F;code&gt; and &lt;code&gt;JUMPI&lt;&#x2F;code&gt; to arrive at any byte matching &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; (&lt;code&gt;0x5b&lt;&#x2F;code&gt;), even if that byte is an immediate argument.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Immediate arguments are opcode parameters supplied within the code rather than the stack.
Currently determining the validity of a &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; requires determining which bytes are immediate arguments to other opcodes, such as &lt;code&gt;PUSH1&lt;&#x2F;code&gt;.
This presents several problems:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Codesize is a linear DoS vector because code must be preprocessed to determine &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; validity.&lt;&#x2F;li&gt;
&lt;li&gt;New opcodes with immediate arguments cannot be safely adopted.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CODECOPY&lt;&#x2F;code&gt; data spans can invalidate subsequent &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The rationale for this &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; validity check is to prevent unintended code execution.
However, almost all &lt;code&gt;JUMP&lt;&#x2F;code&gt; and &lt;code&gt;JUMPI&lt;&#x2F;code&gt; target constant destinations.
Removing this check allows larger programs and better opcodes.
Therefore, the cost of this safety check outweighs the benefit.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;When activated, all &lt;code&gt;0x5b&lt;&#x2F;code&gt; bytes are valid &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; for &lt;code&gt;JUMPI&lt;&#x2F;code&gt; and &lt;code&gt;JUMP&lt;&#x2F;code&gt; opcodes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Removing the check solves several problems while reducing EVM complexity.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Code previously only had one interpretation for disassembly.
With this change, a &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; located inside an immediate argument can cause multiple disassembly interpretations.
Usually the interpretations will converge after a few bytes but the length of such a dispute can be unbounded.
&lt;code&gt;CODECOPY&lt;&#x2F;code&gt; data has always been difficult to identify.
It is recommended that disassemblers provide all possible interpretations in their output in order to reveal possible underhanded functionality.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Current contracts performing dynamic jumps may gain new unintended functionality if it is possible to jump to an immediate argument containing &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt;.
It is expected that very few contracts will become vulnerable in this way.
Most smart contract programming languages do not even allow dynamic jumps, and of those that do, few will have &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; in an accessible immediate argument.
Therefore it is expected that few contracts will become vulnerable, and for many of them the newly possible codepaths will contain invalid opcodes.
A static analysis tool should be developed and made publicly available to test if a contract might become vulnerable, and the program should be run for all current contracts in order to notify projects about potential security issues.
Affected programs will have ample time to migrate.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Pragmatic stack manipulation tools</title>
        <published>2025-03-25T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>lightclient</name><uri>https://github.com/lightclient</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7912/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7912-pragmatic-expansion-of-stack-manipulation-tools/23826" />
        

        <id>https://wg-eips.ritovision.com/7912/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7912"
            label="EIP-7912" />
        

        
        

        
        <summary type="html">Add additional SWAP and DUP operations for deeper stack access</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7912/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Add &lt;code&gt;SWAP17&lt;&#x2F;code&gt;-&lt;code&gt;SWAP24&lt;&#x2F;code&gt;, &lt;code&gt;DUP17&lt;&#x2F;code&gt; - &lt;code&gt;DUP24&lt;&#x2F;code&gt;, &lt;code&gt;SWAPN&lt;&#x2F;code&gt;, &lt;code&gt;DUPN&lt;&#x2F;code&gt;, and &lt;code&gt;EXCHANGE&lt;&#x2F;code&gt;
instructions. The arbitrary depth operations must be preceded by &lt;code&gt;PUSH1&lt;&#x2F;code&gt;
instructions defining operands.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Due to the nature of some compilers, deeper stack access is a desirable VM
feature. Previous attempts either required code versioning, like the EVM Object
Format (EOF), or caused the behavior of some deployed contracts to change, due
to the interpretation of new immediates.&lt;&#x2F;p&gt;
&lt;p&gt;This is a pragmatic approach to introducing the desired functionality. It reuses
instruction semantics that have been historically agreed on, instead of new,
complex encodings and containers.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Let &lt;code&gt;top - N&lt;&#x2F;code&gt; be the &lt;code&gt;N&lt;&#x2F;code&gt;th most recently pushed value on the stack, and &lt;code&gt;top - 0&lt;&#x2F;code&gt; be the most recent.&lt;&#x2F;p&gt;
&lt;p&gt;If any of the following instructions reference a stack element beyond the
current length of the stack, causing a stack underflow, abort with an
exceptional halt.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;constant-swapxx-and-dupxx&quot;&gt;Constant &lt;code&gt;SWAPXX&lt;&#x2F;code&gt; and &lt;code&gt;DUPXX&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Add the following new instructions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;SWAP17&lt;&#x2F;code&gt;, &lt;code&gt;SWAP18&lt;&#x2F;code&gt;, ..., &lt;code&gt;SWAP24&lt;&#x2F;code&gt;: &lt;code&gt;0xb0&lt;&#x2F;code&gt;, &lt;code&gt;0xb1&lt;&#x2F;code&gt;, ..., &lt;code&gt;0xb7&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;DUP17&lt;&#x2F;code&gt;, &lt;code&gt;DUP18&lt;&#x2F;code&gt;, ..., &lt;code&gt;DUP24&lt;&#x2F;code&gt;: &lt;code&gt;0xb8&lt;&#x2F;code&gt;, &lt;code&gt;0xba&lt;&#x2F;code&gt;, ..., &lt;code&gt;0xbf&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Let &lt;code&gt;SWAPXX&lt;&#x2F;code&gt; and &lt;code&gt;DUPXX&lt;&#x2F;code&gt; refer to the static instructions defined above. &lt;code&gt;XX&lt;&#x2F;code&gt; is
defined as the stack element they are referencing.&lt;&#x2F;p&gt;
&lt;p&gt;The operation &lt;code&gt;SWAPXX&lt;&#x2F;code&gt; swaps the top element with the &lt;code&gt;top-XX&lt;&#x2F;code&gt; element. The
operation &lt;code&gt;DUPXX&lt;&#x2F;code&gt; duplicates the &lt;code&gt;top-XX&lt;&#x2F;code&gt; element and pushes the copy to the top
of the stack.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;swapn-and-dupn&quot;&gt;&lt;code&gt;SWAPN&lt;&#x2F;code&gt; and &lt;code&gt;DUPN&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Add the following new instructions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;SWAPN&lt;&#x2F;code&gt;: &lt;code&gt;0xc0&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;DUPN&lt;&#x2F;code&gt;: &lt;code&gt;0xc1&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Both operations take a single argument from the stack, &lt;code&gt;N&lt;&#x2F;code&gt;. This argument must
be provided by a &lt;code&gt;PUSH1&lt;&#x2F;code&gt; operation immediately preceding the &lt;code&gt;SWAPN&lt;&#x2F;code&gt; and &lt;code&gt;DUPN&lt;&#x2F;code&gt;
instructions. Failure to follow this calling convention will result in an
out-of-gas error. If &lt;code&gt;N&lt;&#x2F;code&gt; is zero, fail with out-of-gas error.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;SWAPN&lt;&#x2F;code&gt; pops &lt;code&gt;N&lt;&#x2F;code&gt; from the stack and swaps the new top stack element with the
&lt;code&gt;top-N&lt;&#x2F;code&gt; stack element.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;DUPN&lt;&#x2F;code&gt; pops &lt;code&gt;N&lt;&#x2F;code&gt; from the stack and push on a copy of the &lt;code&gt;top-N-1&lt;&#x2F;code&gt; stack element.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;exchange&quot;&gt;&lt;code&gt;EXCHANGE&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Add the following new instruction:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;EXCHANGE&lt;&#x2F;code&gt;: &lt;code&gt;0xc2&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;code&gt;EXCHANGE&lt;&#x2F;code&gt; instruction takes a single argument from the stack &lt;code&gt;X&lt;&#x2F;code&gt; and
deconstructs it into two operands, &lt;code&gt;N&lt;&#x2F;code&gt; and &lt;code&gt;M&lt;&#x2F;code&gt;. &lt;code&gt;N&lt;&#x2F;code&gt; is &lt;code&gt;X &amp;gt;&amp;gt; 4&lt;&#x2F;code&gt; and &lt;code&gt;M&lt;&#x2F;code&gt; is &lt;code&gt;X &amp;amp; 0x0F&lt;&#x2F;code&gt;. The argument &lt;code&gt;X&lt;&#x2F;code&gt; must be provided by a &lt;code&gt;PUSH2&lt;&#x2F;code&gt; operation immediately
preceding the &lt;code&gt;EXCHANGE&lt;&#x2F;code&gt; instruction. Failure to follow this calling convention
will result in an out-of-gas error. If either &lt;code&gt;N&lt;&#x2F;code&gt; or &lt;code&gt;M&lt;&#x2F;code&gt; are zero, fail with
out-of-gas error.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;EXCHANGE&lt;&#x2F;code&gt; pops &lt;code&gt;X&lt;&#x2F;code&gt; from the stack and will swap the stack element at index
&lt;code&gt;N-1&lt;&#x2F;code&gt; with the stack element at &lt;code&gt;M-1&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-costs&quot;&gt;Gas costs&lt;&#x2F;h3&gt;
&lt;p&gt;All operations cost &lt;code&gt;3&lt;&#x2F;code&gt; gas. Preceding push operations are charged separately
according to the gas schedule.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;constant-and-dynamic-swaps-and-dups&quot;&gt;Constant and Dynamic &lt;code&gt;SWAP&lt;&#x2F;code&gt;s and &lt;code&gt;DUP&lt;&#x2F;code&gt;s&lt;&#x2F;h3&gt;
&lt;p&gt;The main trade off between using the constant &lt;code&gt;SWAPXX&lt;&#x2F;code&gt; or &lt;code&gt;DUPXX&lt;&#x2F;code&gt; instructions
versus the dynamic &lt;code&gt;SWAPN&lt;&#x2F;code&gt; or &lt;code&gt;DUPN&lt;&#x2F;code&gt; instructions is that the dynamic
instructions require an additional two bytes in the form of a preceding &lt;code&gt;PUSH1&lt;&#x2F;code&gt;
operation, whereas the constant versions require no additional bytes.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;one-indexed-exchange&quot;&gt;One indexed &lt;code&gt;EXCHANGE&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Since &lt;code&gt;SWAP1&lt;&#x2F;code&gt; and &lt;code&gt;DUP1&lt;&#x2F;code&gt; operate on the top of the stack, it seems fitting that
&lt;code&gt;EXCHANGE(1, 2)&lt;&#x2F;code&gt; operate on the &lt;code&gt;top&lt;&#x2F;code&gt; and &lt;code&gt;top-1&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TODO&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;When verifying the preceding &lt;code&gt;PUSH&lt;&#x2F;code&gt; operations, client implementers must ensure
that the preceding bytes are not part of a longer segment of push data (e.g.
&lt;code&gt;0x6301026001b0&lt;&#x2F;code&gt; should error). This can be done efficiently by checking if
&lt;code&gt;pc-2&lt;&#x2F;code&gt; is a valid jump destination. If it is, then the &lt;code&gt;PUSH&lt;&#x2F;code&gt; instruction will
have been executed as expected.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Blob base fee bounded by execution cost</title>
        <published>2025-03-25T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Anders Elowsson</name><uri>https://github.com/anderselowsson</uri>
	</author>
	
	<author>
		<name>Ben Adams</name><uri>https://github.com/benaadams</uri>
	</author>
	
	<author>
		<name>Francesco D&#x27;Amato</name><uri>https://github.com/fradamt</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7918/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-blob-base-fee-bounded-by-price-of-blob-carrying-transaction/23271" />
        

        <id>https://wg-eips.ritovision.com/7918/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7918"
            label="EIP-7918" />
        

        
        

        
        <summary type="html">Imposes that the price of GAS_PER_BLOB blob gas is greater than the price of BLOB_BASE_COST execution gas.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7918/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP assigns a reserve price &lt;code&gt;BLOB_BASE_COST * base_fee_per_gas&lt;&#x2F;code&gt; to blobs by introducing an &lt;code&gt;if&lt;&#x2F;code&gt;-clause in &lt;code&gt;calc_excess_blob_gas()&lt;&#x2F;code&gt;. Specifically, when the reserve price is higher than &lt;code&gt;GAS_PER_BLOB * base_fee_per_blob_gas&lt;&#x2F;code&gt;, the function will not subtract &lt;code&gt;target_blob_gas&lt;&#x2F;code&gt; from &lt;code&gt;excess_blob_gas&lt;&#x2F;code&gt;, causing &lt;code&gt;excess_blob_gas&lt;&#x2F;code&gt; to increase according to &lt;code&gt;blob_gas_used&lt;&#x2F;code&gt;, while keeping the per-block maximum increase unchanged. The proposal ensures that the blob fee market can function properly and that blob consumers pay at least a relevant fraction of the market rate for the compute they request from nodes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Ethereum uses a dynamic pricing auction to set the blob base fee, lowering the fee if less gas is consumed than &lt;code&gt;target_blob_gas = GAS_PER_BLOB * blobSchedule.target&lt;&#x2F;code&gt; and raising the fee if more gas is consumed. Such an auction can function well when the blob base fee represents the price signal, allowing the mechanism to control the real price for blob consumers. However, when execution costs dominate, the price signal is lost. The blob base fee then no longer represents a significant component of the total cost facing the consumer, and the protocol can no longer rely on the blob base fee to control the equilibrium quantity of blobs consumed.&lt;&#x2F;p&gt;
&lt;p&gt;The current mechanism can therefore end up repeatedly lowering the blob base fee until it eventually settles at 1 wei. A change in the blob base fee of 10% may under such circumstances shift the total cost of utilizing blobspace by just 0.0000001%. Whenever demand picks up, over an hour of near-full blocks is required to restore a market-clearing equilibrium fee, with the mechanism intermittently resorting to a first-price auction, considered a worse UX by blob consumers. The resulting spikiness in resource consumption is suboptimal for scaling blobspace. To alleviate this, the proposal imposes a reserve price that reflects execution costs, through a simple &lt;code&gt;if&lt;&#x2F;code&gt;-clause in &lt;code&gt;calc_excess_blob_gas()&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The reserve price also fulfills a second function. Nodes must cryptographically verify KZG &lt;code&gt;proofs&lt;&#x2F;code&gt; to ensure that associated &lt;code&gt;commitments&lt;&#x2F;code&gt; correspond to provided blobs. This process is computationally expensive. It seems desirable to ensure that blob consumers pay at least some fraction of the market rate for the compute they impose on nodes. In this context, the execution base fee reflects how in-demand nodes&#x27; compute services are at the time that blob consumers request them.&lt;&#x2F;p&gt;
&lt;p&gt;By applying the reserve price to the blob base fee, the proposal jointly ensures that:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The blob base fee update mechanism can function properly, by establishing a reserve price which is significant relative to L1 execution costs of blob consumers.&lt;&#x2F;li&gt;
&lt;li&gt;Blob consumers pay at least a relevant fraction of the market rate for the compute they request from nodes, with any additional fees for data determined independently in the blob fee market.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;BLOB_BASE_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2**13&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;functions&quot;&gt;Functions&lt;&#x2F;h3&gt;
&lt;p&gt;An &lt;code&gt;if&lt;&#x2F;code&gt;-clause is added to &lt;code&gt;calc_excess_blob_gas()&lt;&#x2F;code&gt; from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt;. The function no longer subtracts &lt;code&gt;target_blob_gas&lt;&#x2F;code&gt; when updating &lt;code&gt;excess_blob_gas&lt;&#x2F;code&gt; if the price of a &lt;code&gt;blob&lt;&#x2F;code&gt; is below the price of &lt;code&gt;BLOB_BASE_COST&lt;&#x2F;code&gt; execution gas. The &lt;code&gt;blobSchedule&lt;&#x2F;code&gt; for referencing target and max blobs was introduced in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7840&#x2F;&quot;&gt;EIP-7840&lt;&#x2F;a&gt;. The current block&#x27;s &lt;code&gt;blobSchedule&lt;&#x2F;code&gt; is used during processing. Thus, in the first block after a fork—when calculating &lt;code&gt;base_fee_per_blob_gas&lt;&#x2F;code&gt; via &lt;code&gt;get_base_fee_per_blob_gas(parent)&lt;&#x2F;code&gt;—&lt;code&gt;fake_exponential()&lt;&#x2F;code&gt; must use the &lt;em&gt;new&lt;&#x2F;em&gt; &lt;code&gt;blobSchedule.baseFeeUpdateFraction&lt;&#x2F;code&gt;. Likewise, the &lt;em&gt;new&lt;&#x2F;em&gt; &lt;code&gt;blobSchedule.max&lt;&#x2F;code&gt; and &lt;code&gt;blobSchedule.target&lt;&#x2F;code&gt; must be used in &lt;code&gt;calc_excess_blob_gas()&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calc_excess_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Header&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    target_blob_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GAS_PER_BLOB&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; blobSchedule&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;target&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;excess_blob_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;blob_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; target_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BLOB_BASE_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;base_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GAS_PER_BLOB&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; get_base_fee_per_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;excess_blob_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;blob_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;blobSchedule&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; blobSchedule&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;target&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; blobSchedule&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;excess_blob_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;blob_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; target_blob_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;fee-inelasticity-and-reserve-price&quot;&gt;Fee-inelasticity and reserve price&lt;&#x2F;h3&gt;
&lt;p&gt;This proposal alleviates idiosyncrasies in the blob base fee auction. When a rollup&#x27;s costs are dominated by execution costs for the blob-carrying transactions, ZK proof verification, or priority fees, the protocol can no longer rely on the blob base fee to control the equilibrium quantity of blobs consumed. The fee update mechanism is unaware of the full price of the goods that it regulates the price for and therefore fails to converge on equilibrium in a timely manner.&lt;&#x2F;p&gt;
&lt;p&gt;We can express a simple real demand function for blobspace as&lt;&#x2F;p&gt;
&lt;p&gt;$Q(b + c).$&lt;&#x2F;p&gt;
&lt;p&gt;It maps the quantity of blobs demanded $Q$ to the blob base fee $b$ and the user&#x27;s execution costs, expressed &quot;per blob gas&quot;, $c$:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; execution_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; base_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GAS_PER_BLOB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;According to the &lt;em&gt;law of demand&lt;&#x2F;em&gt;, the lower the price $b+c$, the higher the demand. From the perspective of the blob base fee update mechanism, $c$ is fixed. If $c&amp;gt;0$, the demand curve will therefore have an &quot;inelasticity horizon&quot;, beyond which further reductions in $b$ no longer increase $Q$:&lt;&#x2F;p&gt;
&lt;p&gt;$\lim_{b \to 0} Q(b + c) = Q(c).$&lt;&#x2F;p&gt;
&lt;p&gt;In essence, the demand curve becomes a vertical line, where changes to the blob base fee $b$ no longer affect demand. Figure 1 illustrates this, with real demand curves (black to red) computed under four different execution base fees when purchasing two blobs. The hypothetical organic demand is illustrated in black. Any demand curve where execution costs are positive ($c&amp;gt;0$) eventually becomes vertical as the blob base fee falls. The protocol also uses a long-run perfectly inelastic supply curve (vertical blue line). Therefore, relatively small shifts in organic demand or the execution base fee (arrows) can lead to dramatic shifts in the equilibrium blob base fee. Importantly, the blob base fee will simply fall to the boundary of 1 wei whenever the execution cost is too high for consumers to achieve equilibrium formation at &lt;code&gt;target_blob_gas&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7918&#x2F;.&#x2F;assets&#x2F;1.png&quot; alt=&quot;Figure 1&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Figure 1.&lt;&#x2F;strong&gt; Hypothetical real demand for blobspace under different execution base fees (black to red lines). When execution cost dominates, the real demand curve becomes inelastic and parallel to the supply curve, leading the equilibrium fee to change dramatically even with small shifts in the demand curve (arrows). The proposal imposes that the equilibrium (square) forms on the edges of the upper-left quadrant, at the intersection between the target supply curve and demand or along the dashed line representing possible reserve price equilibria accounting for execution costs.&lt;&#x2F;p&gt;
&lt;p&gt;To improve the fee update mechanism, a reserve price is specified below which $b$ cannot be reduced. Specifically, we define a constant &lt;code&gt;BLOB_BASE_COST&lt;&#x2F;code&gt; and in &lt;code&gt;calc_excess_blob_gas&lt;&#x2F;code&gt; do not subtract &lt;code&gt;target_blob_gas&lt;&#x2F;code&gt; if:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;BLOB_BASE_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; base_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GAS_PER_BLOB&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; base_fee_per_blob_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This means that the reserve blob base fee becomes &lt;code&gt;BLOB_BASE_COST * base_fee_per_gas &#x2F; GAS_PER_BLOB&lt;&#x2F;code&gt; and that the ratio between the reserve price for the blob base fee and the execution base fee is fixed to: &lt;code&gt;BLOB_BASE_COST &#x2F; GAS_PER_BLOB&lt;&#x2F;code&gt;. This ratio is &lt;code&gt;1&#x2F;16&lt;&#x2F;code&gt; with the proposed constant.&lt;&#x2F;p&gt;
&lt;p&gt;The blob fee&#x27;s share of the total price will with the reserve price always be at least &lt;code&gt;BLOB_BASE_COST &#x2F; (BLOB_BASE_COST + execution_cost)&lt;&#x2F;code&gt;. This is why the equilibrium under the reserve price (dashed line in Figure 1) is situated a constant fraction below the black organic demand curve formed under a zero execution base fee. The equilibrium (squares) must then form somewhere along the edge of the upper-left quadrant, bounded by the blue supply curve and the dashed curve representing possible reserve price equilibria under real demand.&lt;&#x2F;p&gt;
&lt;p&gt;The demand curve could potentially be somewhat inelastic even under zero execution costs. This would however just be another reason to move forward with this proposal. Regardless of the exact shape of the demand curve—which of course will remain unknown and can vary going forward—the proposal is based on something tangible affecting blob consumers. This makes it a justified neutral bound on the blob base fee.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;blob-kzg-proof-verification-cost&quot;&gt;Blob KZG proof verification cost&lt;&#x2F;h3&gt;
&lt;p&gt;EIP-4844 introduced the first phase of Ethereum&#x27;s data availability sampling (DAS) roadmap. Validators on the consensus layer (CL) verify that the KZG &lt;code&gt;commitments&lt;&#x2F;code&gt; in the payload correspond to the provided &lt;code&gt;blobs&lt;&#x2F;code&gt; by cryptographically verifying the accompanying KZG &lt;code&gt;proofs&lt;&#x2F;code&gt;. Execution layer (EL) nodes must also validate the &lt;code&gt;tx_payload_body&lt;&#x2F;code&gt; and verify the wrapped data (blobs, commitments, and proofs) for every blob entering a node&#x27;s tx pool. The computational requirements for verifying a KZG proof for an entire blob are slightly higher than those for verifying a KZG proof for a single point on that blob; the latter is the specific operation covered by the &lt;code&gt;POINT_EVALUATION_PRECOMPILE_GAS&lt;&#x2F;code&gt; (50000) charged to smart contracts.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7594&#x2F;&quot;&gt;EIP-7594&lt;&#x2F;a&gt; introduces PeerDAS. It changes the compute requirements due to the reliance on blob cells and their individual proofs. The exact specification is not yet fully settled, but this is a rough guideline:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;EL nodes batch-verify &lt;code&gt;CELLS_PER_EXT_BLOB&lt;&#x2F;code&gt; (128) cell proofs for each blob before including a tx carrying that blob in their tx pool. This verification (e.g., using &lt;code&gt;verify_cell_kzg_proof_batch&lt;&#x2F;code&gt;) is roughly 15 times more expensive than the compute associated with a single &lt;code&gt;POINT_EVALUATION_PRECOMPILE_GAS&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Full nodes verify 4 custodied columns, each column containing one cell from all blobs referenced in the payload. Each column&#x27;s cell proofs can be batch-verified (also applicable below).&lt;&#x2F;li&gt;
&lt;li&gt;Supernodes verify 128 custodied columns, each column containing one cell from all blobs referenced in the payload.&lt;&#x2F;li&gt;
&lt;li&gt;Validators between full nodes and supernodes will custody between 4-128 columns.&lt;&#x2F;li&gt;
&lt;li&gt;Nodes peer-sample &lt;code&gt;SAMPLES_PER_SLOT&lt;&#x2F;code&gt; (8) columns each slot (in addition to custodied columns).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The ability on the CL to jointly process cell proofs of a column (from all blobs) through batching reduces the compute time spent per blob as the number of blobs increases. It is further possible to batch all columns jointly or to parallelize the processing across columns. When accounting for the prospect of parallelization for the CL, it is however worth remembering that the point evaluation proof verification performed by rollups using the precompile also lends itself to parallelization. This means that a comparison between the point evaluation and the sequential processing of blobs (batched per column) is still relevant (because &lt;em&gt;both&lt;&#x2F;em&gt; could be parallelized).&lt;&#x2F;p&gt;
&lt;p&gt;Figure 2 shows verification time per blob divided by the measured execution time of a single point evaluation operation (performed by the &lt;code&gt;VerifyKZGProof&lt;&#x2F;code&gt; precompile) for various configurations. The figure indicates that blobs under the current Fusaka PeerDAS specification will subject nodes to rather heavy compute requirements—when compared to the single point evaluation proof verification that a smart contract is charged &lt;code&gt;POINT_EVALUATION_PRECOMPILE_GAS&lt;&#x2F;code&gt; for. A full node would for example do the EL mempool verification for all blobs propagated p2p (15x), sample 8 columns (2x at 32 blobs when batching columns sequentially), and custody 4 designated columns (1x). How to price the KZG proof verification is however a complex question given the varying contexts in which it is performed. The proposed constant &lt;code&gt;BLOB_BASE_COST&lt;&#x2F;code&gt; is indicated by a green line in Figure 2. It is relatively moderate in comparison with the compute costs imposed on nodes.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7918&#x2F;.&#x2F;assets&#x2F;2.png&quot; alt=&quot;Figure 2&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Figure 2.&lt;&#x2F;strong&gt; Verification time per blob relative to one point evaluation on an Apple M2 Max with 12 cores. The EL mempool verification (red) takes 15 times longer in the worst case, regardless of the blob target. The per-blob verification time of columns depends on the number of custodied&#x2F;sampled columns and falls with an increase in the blob target due to speed-ups from processing all cells of a column jointly. The constant &lt;code&gt;BLOB_BASE_COST&lt;&#x2F;code&gt; is relatively moderate in comparison with the compute costs that blobs impose on nodes.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;designing-for-the-future&quot;&gt;Designing for the future&lt;&#x2F;h3&gt;
&lt;p&gt;The price of storing a fixed amount of data has fallen over the last 80 years. Technological progress generally brings down the unit cost of data services, following Nielsen’s law and Moore’s law. The ETH-denominated price per blob should likewise fall as Ethereum increases blob throughput. This effect is reinforced because a higher aggregate ETH-denominated blob revenue (which is distributed to ETH token holders via the burn) increases the fiat-denominated value of the ETH token, ceteris paribus. There is thus an upper bound on the blob base fee—a bound that falls as Ethereum scales. The same reflexivity applies to the execution base fee.&lt;&#x2F;p&gt;
&lt;p&gt;In this light, the proposal can be understood as a design for the future. Fixed thresholds not relating to blob quantity or the execution fee may not be sustainable. In a scenario where Ethereum sells more blobs per block, the equilibrium blob base fee should ideally have a relatively lower floor. Any fixed threshold (not relating to the execution base fee or blob quantity) would need to be gradually readjusted to retain the same relative impact.&lt;&#x2F;p&gt;
&lt;p&gt;If Ethereum increases blob throughput by several orders of magnitude but does &lt;em&gt;not&lt;&#x2F;em&gt; scale blockspace, such that the execution base fee remains high, the reserve price of &lt;code&gt;BLOB_BASE_COST&lt;&#x2F;code&gt; execution gas would however still become too high. At 1000 blobs and 30M execution gas per block, Ethereum would derive just over 1&#x2F;5th (21.5%) of its income from blob gas even when blobs are strictly sold at the reserve price. This implies a too high &lt;code&gt;BLOB_BASE_COST&lt;&#x2F;code&gt;, but 1000 blobs and 30M execution gas is not the trajectory that Ethereum currently is on. If Ethereum scales blockspace and blobspace roughly in synchrony, it is reasonable to expect that the reserve price remains at the desired level.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;delayed-response-during-a-quick-rise-in-execution-fees&quot;&gt;Delayed response during a quick rise in execution fees&lt;&#x2F;h3&gt;
&lt;p&gt;When the &lt;code&gt;if&lt;&#x2F;code&gt; statement concludes that Ethereum operates in the execution-fee-led pricing regime, the blob base fee rises in accordance with &lt;code&gt;blob_gas_used * (max - target) &#x2F;&#x2F; max&lt;&#x2F;code&gt;, without subtracting &lt;code&gt;target_blob_gas&lt;&#x2F;code&gt;. This is an intuitive way to return to the blob-fee-led pricing regime, retaining the same maximum fee increase while not allowing for a decrease. If the execution base fee rises quickly, there may be a few blocks before the blob base fee catches up (during which &lt;code&gt;target_blob_gas&lt;&#x2F;code&gt; will never be subtracted). This is arguably not an issue, and the smooth response in the blob base fee under these circumstances may even be seen as a benefit.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;empirical-analysis&quot;&gt;Empirical analysis&lt;&#x2F;h3&gt;
&lt;p&gt;Figures 3-4 show price evolution over three weeks in November 2024, when the average execution base fee was around 16 gwei, as well as in March 2025, when the average was around 1.3 gwei. The proposed reserve fee is applied directly to the original data, without accounting for its potential effect on the equilibrium fee. The equilibrium blob base fee would in reality rise from the threshold level once demand at this fee is above target supply. EIP-7918 imposes the maximum of the two curves, indicated in darker colors.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7918&#x2F;.&#x2F;assets&#x2F;3.png&quot; alt=&quot;Figure 3&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Figure 3.&lt;&#x2F;strong&gt; Blob base fee evolution with the current fee market (black) and the proposed reserve fee (blue), during three weeks of November 2024 when the average execution base fee was around 16 gwei. EIP-7918 imposes the maximum of the two curves, as indicated in darker colors. Thresholding is applied directly to the original data, without accounting for its effect on the equilibrium fee.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7918&#x2F;.&#x2F;assets&#x2F;4.png&quot; alt=&quot;Figure 4&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Figure 4.&lt;&#x2F;strong&gt; Blob base fee evolution with the current fee market (black) and the proposed reserve fee (blue), during three weeks of March 2025 when the average execution base fee was around 1.3 gwei. EIP-7918 imposes the maximum of the two curves, as indicated in darker colors. Thresholding is applied directly to the original data, without accounting for its effect on the equilibrium fee.&lt;&#x2F;p&gt;
&lt;p&gt;Figure 5 shows histograms for observed fees and the maximum of the two curves for the four-month period from November 2024 (start of Figure 3&#x27;s data period) through March 2025 (end of Figure 4&#x27;s data period), corresponding to approximately 900k blocks beginning at block number 22075724. The histograms employ 100 log-spaced bins per decade (factor-of-ten increase), which are smoothed using a Hanning window of width 21 with mirror-reflected edges.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7918&#x2F;.&#x2F;assets&#x2F;5.png&quot; alt=&quot;Figure 5&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Figure 5.&lt;&#x2F;strong&gt; Histogram of the blob base fee when there is no threshold or when applying EIP-7918 (dashed combination of the darker black and blue curves from previous figures), with light smoothing applied. A four-month period from November 2024 through March 2025 was analyzed. Thresholding is applied directly to the original data, without accounting for its effect on the equilibrium fee.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The blob base fee will settle at a level where a blob costs at least &lt;code&gt;BLOB_BASE_COST&lt;&#x2F;code&gt; execution gas. To the best of the authors&#x27; knowledge, there are no security risks associated with this.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>SSZ ProgressiveList</title>
        <published>2025-03-24T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Zsolt Felföldi</name><uri>https://github.com/zsfelfoldi</uri>
	</author>
	
	<author>
		<name>Cayman</name><uri>https://github.com/wemeetagain</uri>
	</author>
	
	<author>
		<name>Etan Kissling</name><uri>https://github.com/etan-status</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7916/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7916-ssz-progressivebytelist/23254" />
        

        <id>https://wg-eips.ritovision.com/7916/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        

        
        <category
            term="tag:eip:7916"
            label="EIP-7916" />
        

        
        

        
        <summary type="html">SSZ types for efficiently hashing short lists</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7916/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a new Merkle tree shape for &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;ssz&#x2F;simple-serialize.md&quot;&gt;Simple Serialize (SSZ)&lt;&#x2F;a&gt; types that results in fewer hashes when only a small number of leaves is used. The new tree shape grows progressively with increased leaf count and no longer has a bounded capacity. It also offers forward compatibility: a given chunk index is always assigned the same stable &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;ssz&#x2F;merkle-proofs.md#generalized-merkle-tree-index&quot;&gt;generalized index (gindex)&lt;&#x2F;a&gt; regardless of leaf count.&lt;&#x2F;p&gt;
&lt;p&gt;New types are defined to use the progressive Merkle tree shape: &lt;code&gt;ProgressiveList[type]&lt;&#x2F;code&gt; and &lt;code&gt;ProgressiveBitlist&lt;&#x2F;code&gt;. These new types represent lists of arbitrary length with stable merkleization, reducing hashing overhead for small lists and avoiding arbitrary capacity limits.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Current SSZ &lt;code&gt;List[type, N]&lt;&#x2F;code&gt; types require a predefined capacity &lt;code&gt;N&lt;&#x2F;code&gt;, which leads to several issues:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Inefficient hashing: Lists often contain far fewer elements than their maximum capacity (e.g., &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;bellatrix&#x2F;beacon-chain.md#custom-types&quot;&gt;&lt;code&gt;Transaction&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;), resulting in unnecessary zero-padding and dozens of extra hash computations. This is exacerbated when nesting &lt;code&gt;List[type, N]&lt;&#x2F;code&gt;, e.g., in a design where each of up to &lt;code&gt;X&lt;&#x2F;code&gt; transactions has up to &lt;code&gt;Y&lt;&#x2F;code&gt; access lists, each with up to &lt;code&gt;Z&lt;&#x2F;code&gt; storage slots.&lt;&#x2F;li&gt;
&lt;li&gt;Arbitrary Limits: The capacity &lt;code&gt;N&lt;&#x2F;code&gt; is often chosen arbitrarily (e.g., &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;bellatrix&#x2F;beacon-chain.md#execution&quot;&gt;&lt;code&gt;MAX_BYTES_PER_TRANSACTION&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;bellatrix&#x2F;beacon-chain.md#execution&quot;&gt;&lt;code&gt;MAX_TRANSACTIONS_PER_PAYLOAD&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;) and set to artificially large values to anticipate future design space, which are not always correct.&lt;&#x2F;li&gt;
&lt;li&gt;Unstable proofs: Modifying &lt;code&gt;N&lt;&#x2F;code&gt; across forks (e.g., &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;electra&#x2F;beacon-chain.md#max-operations-per-block&quot;&gt;&lt;code&gt;MAX_ATTESTER_SLASHINGS_ELECTRA&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;electra&#x2F;beacon-chain.md#max-operations-per-block&quot;&gt;&lt;code&gt;MAX_ATTESTATIONS_ELECTRA&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;) alters gindices, breaking downstream verifiers.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The progressive Merkle tree shape addresses these by:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Using a recursive tree structure that progressively grows to the actual leaf count with minimal overhead&lt;&#x2F;li&gt;
&lt;li&gt;Dropping the notion of a maximum capacity, relying instead on practical limits, e.g., SSZ&#x27;s 4 GB variable offset cap, network payload limits, gas limits, bounds on the number of signatures.&lt;&#x2F;li&gt;
&lt;li&gt;Maintaining stable gindices for each element, ensuring provers remain valid as the leaf count changes.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;progressive-merkle-tree&quot;&gt;Progressive Merkle tree&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;ssz&#x2F;simple-serialize.md#merkleization&quot;&gt;SSZ Merkleization specification&lt;&#x2F;a&gt; is extended with a helper function:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;merkleize_progressive(chunks, num_leaves=1)&lt;&#x2F;code&gt;: Given ordered &lt;code&gt;BYTES_PER_CHUNK&lt;&#x2F;code&gt;-byte chunks:
&lt;ul&gt;
&lt;li&gt;The merkleization depends on the number of input chunks and is defined recursively:
&lt;ul&gt;
&lt;li&gt;If &lt;code&gt;len(chunks) == 0&lt;&#x2F;code&gt;: the root is a zero value, &lt;code&gt;Bytes32()&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Otherwise: compute the root using &lt;code&gt;hash(a, b)&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;a&lt;&#x2F;code&gt;: Merkleize the first up to &lt;code&gt;num_leaves&lt;&#x2F;code&gt; chunks as a binary tree using &lt;code&gt;merkleize(chunks[:num_leaves], num_leaves)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;b&lt;&#x2F;code&gt;: Recursively merkleize chunks beyond &lt;code&gt;num_leaves&lt;&#x2F;code&gt; using &lt;code&gt;merkleize_progressive(chunks[num_leaves:], num_leaves * 4)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This results in a 0-terminated sequence of binary subtrees with increasing leaf count. The deepest subtree is padded with zeroed chunks (virtually for memory efficiency).&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                   root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    &#x2F;\&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                   &#x2F;  \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; 1: chunks[0 ..&amp;lt; 1]   &#x2F;\&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                     &#x2F;  \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   4: chunks[1 ..&amp;lt; 5]   &#x2F;\&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                       &#x2F;  \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   16: chunks[5 ..&amp;lt; 21]   &#x2F;\&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                         &#x2F;  \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    64: chunks[21 ..&amp;lt; 85]    0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&quot;text-align: right&quot;&gt;Depth&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Added chunks&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Total chunks&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Total capacity (bytes)&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;0&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;0&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;0&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;1&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;1&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;1&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;32&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;2&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;4&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;5&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;160&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;3&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;16&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;21&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;672&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;4&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;64&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;85&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;2&#x27;720&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;5&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;256&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;341&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;10&#x27;912&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;6&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;1&#x27;024&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;1&#x27;365&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;43&#x27;680&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;7&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;4&#x27;096&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;5&#x27;461&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;174&#x27;752&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;8&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;16&#x27;384&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;21&#x27;845&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;699&#x27;040&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;9&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;65&#x27;536&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;87&#x27;381&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;2&#x27;796&#x27;192&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;10&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;262&#x27;144&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;349&#x27;525&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;11&#x27;184&#x27;800&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;11&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;1&#x27;048&#x27;576&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;1&#x27;398&#x27;101&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;44&#x27;739&#x27;232&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;12&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;4&#x27;194&#x27;304&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;5&#x27;592&#x27;405&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;178&#x27;956&#x27;960&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;13&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;16&#x27;777&#x27;216&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;22&#x27;369&#x27;621&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;715&#x27;827&#x27;872&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;14&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;67&#x27;108&#x27;864&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;89&#x27;478&#x27;485&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;2&#x27;863&#x27;311&#x27;520&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;15&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;268&#x27;435&#x27;456&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;357&#x27;913&#x27;941&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;11&#x27;453&#x27;246&#x27;112&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;progressivelist-type-and-progressivebitlist&quot;&gt;&lt;code&gt;ProgressiveList[type]&lt;&#x2F;code&gt; and &lt;code&gt;ProgressiveBitlist&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Two new &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;ssz&#x2F;simple-serialize.md#composite-types&quot;&gt;SSZ composite types&lt;&#x2F;a&gt; are defined:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;progressive list&lt;&#x2F;strong&gt;: ordered variable-length homogeneous collection, without limit
&lt;ul&gt;
&lt;li&gt;notation &lt;code&gt;ProgressiveList[type]&lt;&#x2F;code&gt;, e.g. &lt;code&gt;ProgressiveList[uint64]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;progressive bitlist&lt;&#x2F;strong&gt;: ordered variable-length collection of &lt;code&gt;boolean&lt;&#x2F;code&gt; values, without limit
&lt;ul&gt;
&lt;li&gt;notation &lt;code&gt;ProgressiveBitlist&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The new types are considered &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;ssz&#x2F;simple-serialize.md#variable-size-and-fixed-size&quot;&gt;&quot;variable-size&quot;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;For convenience we &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;ssz&#x2F;simple-serialize.md#aliases&quot;&gt;alias&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ProgressiveByteList&lt;&#x2F;code&gt; to &lt;code&gt;ProgressiveList[byte]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;ssz&#x2F;simple-serialize.md#default-values&quot;&gt;default value&lt;&#x2F;a&gt; is defined as:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Default Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ProgressiveList[type]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;[]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ProgressiveBitlist&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;[]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;serialization&quot;&gt;Serialization&lt;&#x2F;h4&gt;
&lt;p&gt;Serialization, deserialization, and JSON mapping of &lt;code&gt;ProgressiveBitlist&lt;&#x2F;code&gt; are identical to &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;ssz&#x2F;simple-serialize.md#bitlistn&quot;&gt;&lt;code&gt;Bitlist[N]&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Serialization, deserialization, and JSON mapping of &lt;code&gt;ProgressiveList[type]&lt;&#x2F;code&gt; are identical to &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;ssz&#x2F;simple-serialize.md#vectors-containers-lists&quot;&gt;&lt;code&gt;List[type, N]&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;merkleization&quot;&gt;Merkleization&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;ssz&#x2F;simple-serialize.md#merkleization&quot;&gt;Merkleization&lt;&#x2F;a&gt; definitions are extended.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;mix_in_length(merkleize_progressive(pack(value)), len(value))&lt;&#x2F;code&gt; if &lt;code&gt;value&lt;&#x2F;code&gt; is a progressive list of basic objects.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;mix_in_length(merkleize_progressive(pack_bits(value)), len(value))&lt;&#x2F;code&gt; if &lt;code&gt;value&lt;&#x2F;code&gt; is a progressive bitlist.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;mix_in_length(merkleize_progressive([hash_tree_root(element) for element in value]), len(value))&lt;&#x2F;code&gt; if &lt;code&gt;value&lt;&#x2F;code&gt; is a progressive list of composite objects.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-a-recursive-structure&quot;&gt;Why a recursive structure?&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Efficiency: Small lists use fewer hashes (e.g., a 3-item list in a 16-element subtree wastes fewer hashes than a 1024-element &lt;code&gt;List[type, N]&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;Stability: Fixed subtree sizes ensure stable gindices, avoiding the need for dynamic depth adjustments or multiple queries.&lt;&#x2F;li&gt;
&lt;li&gt;Scalability: Recursive subtrees allow arbitrary growth without a hardcoded limit, constrained only by practical limits (e.g., network payload limit, validation rules).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;why-not-dynamic-depth&quot;&gt;Why not dynamic depth?&lt;&#x2F;h3&gt;
&lt;p&gt;Dynamic-depth Merkleization destabilizes gindices:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Requires two-step queries (length then gindex), increasing latency and reorg risks.&lt;&#x2F;li&gt;
&lt;li&gt;Complicates proofs with semantic lookups.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Mixing in successor subtrees ensures predictable gindices and proof sizes.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-not-fixed-capacity-lists&quot;&gt;Why not fixed-capacity lists?&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;List[type, N]&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Imposes arbitrary limits, hindering scalability.&lt;&#x2F;li&gt;
&lt;li&gt;Breaks stability when redefined.&lt;&#x2F;li&gt;
&lt;li&gt;Wastes hashes with padding (e.g., 1024-element capacity for a 1-item list). (only log(N) wasted hashes)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;code&gt;ProgressiveList[type]&lt;&#x2F;code&gt; offers a scalable, efficient alternative.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-are-initial-leaf-count-and-scaling-factors-not-exposed-parameters&quot;&gt;Why are initial leaf count and scaling factors not exposed parameters?&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Simplicity: Fixed values (initial leaf count 1, scaling factor 4) provide a sensible default that balances efficiency and usability, aligning with SSZ’s goal of simplicity.&lt;&#x2F;li&gt;
&lt;li&gt;Future Extensibility: If specific use cases demand different values, a future EIP could introduce parameterization. For now, fixed values reduce adoption barriers and align with the principle of &quot;good enough&quot; defaults.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The new SSZ types coexist with existing types without conflict and share their serialization logic.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ethereum&#x2F;remerkleable&lt;&#x2F;code&gt; contains static tests in &lt;code&gt;test_impl.py&lt;&#x2F;code&gt; and &lt;code&gt;test_typing.py&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ethereum&#x2F;consensus-specs&lt;&#x2F;code&gt; releases contain random tests in &lt;code&gt;tests&#x2F;general&#x2F;phase0&#x2F;ssz_generic&lt;&#x2F;code&gt;, generated according to a format defined in &lt;code&gt;tests&#x2F;format&#x2F;ssz_generic&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;See &lt;code&gt;ethereum&#x2F;remerkleable&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Resource limits: The &lt;code&gt;uint32&lt;&#x2F;code&gt; limit for variable-length offsets essentially introduces a ~4GB cap when including a &lt;code&gt;ProgressiveList[type]&lt;&#x2F;code&gt; or &lt;code&gt;ProgressiveBitlist&lt;&#x2F;code&gt; within another complex type, but practical limits (e.g., 10MB libp2p messages) apply. Implementations SHOULD enforce context-specific bounds.&lt;&#x2F;li&gt;
&lt;li&gt;Variable proof size: Recursive traversal may increase proof sizes for large indices, though logarithmic in list size due to the scaling factor.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Deterministic proposer lookahead</title>
        <published>2025-03-24T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Lin Oshitani</name><uri>https://github.com/linoscope</uri><email>lin@nethermind.io</email>
	</author>
	
	<author>
		<name>Justin Drake</name><uri>https://github.com/JustinDrake</uri><email>justin@ethereum.org</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7917/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7917-deterministic-proposer-lookahead/23259" />
        

        <id>https://wg-eips.ritovision.com/7917/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7917"
            label="EIP-7917" />
        

        
        

        
        <summary type="html">Pre-calculate and store a deterministic proposer lookahead in the beacon state at the start of every epoch</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7917/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;At the start of each epoch, pre-calculate and store in the &lt;code&gt;beacon_state&lt;&#x2F;code&gt; a deterministic &lt;code&gt;proposer_lookahead&lt;&#x2F;code&gt; for the next &lt;code&gt;MIN_SEED_LOOKAHEAD + 1&lt;&#x2F;code&gt; epochs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Unlike RANDAO seeds, which have a deterministic lookahead of at least &lt;code&gt;MIN_SEED_LOOKAHEAD == 1&lt;&#x2F;code&gt; epochs, the beacon proposer schedule of epoch &lt;code&gt;N + 1&lt;&#x2F;code&gt; is not fully predictable from the beacon state during epoch &lt;code&gt;N&lt;&#x2F;code&gt;. The reason is that, under certain edge cases, the effective balances (EBs) of active validators—themselves used as input for proposer election in epoch &lt;code&gt;N + 1&lt;&#x2F;code&gt;—can change within epoch &lt;code&gt;N&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Based preconfirmation protocols rely on a deterministic proposer schedule for smooth operations. Since the beacon genesis, slashings and penalties that accumulate to at least 1 ETH can change EBs of active validators and lead to an unpredictable proposer schedule despite the RANDAO seed being known ahead of time. The increase of MaxEB with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7251&#x2F;&quot;&gt;EIP-7251&lt;&#x2F;a&gt; increases effective balance unpredictability because rewards that accumulate to at least 1 ETH, validator consolidations, and deposits can grow EBs of active validators beyond 32 ETH.&lt;&#x2F;p&gt;
&lt;p&gt;Besides fixing next-epoch proposer schedule non-determinism, this EIP makes it possible for the proposer schedule of the next epoch to be accessible to the application layer via the beacon root and a simple Merkle proof. This highly simplifies the implementation of on-chain components for based preconfirmation protocols.&lt;&#x2F;p&gt;
&lt;p&gt;Introducing a fully deterministic lookahead fixes a long-standing beacon chain design oversight, as highlighted by Danny Ryan&#x27;s comment below:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7917&#x2F;.&#x2F;assets&#x2F;lookahead-comment.png&quot; alt=&quot;Danny Ryan&amp;#39;s comment on proposer lookahead&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;With this change, it will no longer be possible for validators to grind effective balances to manipulate the proposer schedule of the next epoch, and the analysis of effective balance grinding will collapse from what is currently a subtle analysis of EB edge cases to a trivial security analysis. Finally, the proposer lookahead gives CL clients ahead-of-time visibility over the next proposer which may simplify implementations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;BeaconState&lt;&#x2F;code&gt; container is extended with a &lt;code&gt;proposer_lookahead&lt;&#x2F;code&gt; field, which is a vector of validator indices covering the full visible lookahead period, starting from the beginning of the current epoch to the next &lt;code&gt;MIN_SEED_LOOKAHEAD&lt;&#x2F;code&gt; epochs.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    proposer_lookahead&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Vector&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;ValidatorIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;MIN_SEED_LOOKAHEAD&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SLOTS_PER_EPOCH&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;For example, &lt;code&gt;proposer_lookahead[0]&lt;&#x2F;code&gt; is the validator index for the first proposer in the current epoch, &lt;code&gt;proposer_lookahead[SLOTS_PER_EPOCH + 4]&lt;&#x2F;code&gt; is the validator index for the fifth proposer in the next epoch, and so forth.&lt;&#x2F;p&gt;
&lt;p&gt;The function &lt;code&gt;get_beacon_proposer_index&lt;&#x2F;code&gt; is modified to use the pre-calculated &lt;code&gt;proposer_lookahead&lt;&#x2F;code&gt; instead of calculating proposer indices on-demand.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_beacon_proposer_index&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; ValidatorIndex&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Return the beacon proposer index at the current slot.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;proposer_lookahead&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SLOTS_PER_EPOCH&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;At the epoch boundary, the &lt;code&gt;proposer_lookahead&lt;&#x2F;code&gt; is updated by shifting out the current epoch’s lookahead and appending the new one.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; process_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    process_proposer_lookahead&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; process_proposer_lookahead&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    last_epoch_start&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;proposer_lookahead&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SLOTS_PER_EPOCH&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Shift out proposers in the first epoch&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;proposer_lookahead&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;last_epoch_start&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;proposer_lookahead&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SLOTS_PER_EPOCH&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Fill in the last epoch with new proposer indices&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    last_epoch_proposers&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_beacon_proposer_indices&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;get_current_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MIN_SEED_LOOKAHEAD&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;proposer_lookahead&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;last_epoch_start&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; last_epoch_proposers&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_beacon_proposer_indices&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;    state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; epoch&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Epoch&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Vector&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;ValidatorIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SLOTS_PER_EPOCH&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Return the proposer indices for the given ``epoch``.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    indices&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_active_validator_indices&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; epoch&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    seed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_seed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; epoch&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; DOMAIN_BEACON_PROPOSER&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; compute_proposer_indices&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; epoch&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; seed&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; indices&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; compute_proposer_indices&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;    state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; epoch&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Epoch&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; seed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; indices&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Sequence&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;ValidatorIndex&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Vector&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;ValidatorIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SLOTS_PER_EPOCH&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Return the proposer indices for the given ``epoch``.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    start_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; compute_start_slot_at_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;epoch&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    seeds&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;seed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; uint_to_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;Slot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;start_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SLOTS_PER_EPOCH&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;compute_proposer_index&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; indices&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; seed&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; seed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; seeds&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Furthermore, the first block after the fork will calculate all lookaheads for epochs up to &lt;code&gt;MIN_SEED_LOOKAHEAD&lt;&#x2F;code&gt; ahead and fill the &lt;code&gt;proposer_lookahead&lt;&#x2F;code&gt; field in the beacon state.&lt;&#x2F;p&gt;
&lt;p&gt;See the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;cbaa0063979168a94a9c7821f366c6a221319c8e&#x2F;specs&#x2F;fulu&#x2F;beacon-chain.md&quot;&gt;updated beacon chain specs&lt;&#x2F;a&gt; in consensus-specs for more details.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;considered-alternatives&quot;&gt;Considered Alternatives&lt;&#x2F;h3&gt;
&lt;p&gt;An alternative approach would be to cache the effective balances at the start of epoch &lt;code&gt;N&lt;&#x2F;code&gt; so it can be used to calculate the proposer lookahead at the start of epoch &lt;code&gt;N+MIN_SEED_LOOKAHEAD&lt;&#x2F;code&gt;. However, this approach would require additional footprint in the beacon state, and would not be able to provide the proposer lookahead to the EVM via the beacon root.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;single-secret-leader-election-compatibility&quot;&gt;Single Secret Leader Election Compatibility&lt;&#x2F;h3&gt;
&lt;p&gt;In the future, we may introduce a Single Secret Leader Election (SSLE) mechanism in which only the selected validator knows their role until they propose a block. However, current SSLE designs still rely on a lookahead, albeit an encrypted one. In such designs, we could reuse the &lt;code&gt;proposer_lookahead&lt;&#x2F;code&gt; field by changing its type to something like &lt;code&gt;List[EncryptedValidatorIndex]&lt;&#x2F;code&gt;. And if a construction were to remove lookahead entirely, we could simply set &lt;code&gt;proposer_lookahead&lt;&#x2F;code&gt; to an empty list, meaning this wouldn’t be a blocker.&lt;&#x2F;p&gt;
&lt;p&gt;That said, any such changes would introduce additional complexity around preconfirmation protocols, but that complexity arises regardless of this EIP. Furthermore, APS (Attester Proposer Separation) envisions more sophisticated (i.e., more DDoS‑resistant) execution proposers, reducing the need for SSLE.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;added-computation-at-the-epoch-boundary&quot;&gt;Added Computation at the Epoch Boundary&lt;&#x2F;h3&gt;
&lt;p&gt;Before this EIP, consensus clients only needed to compute the current proposer’s index at each slot. With the changes introduced by this EIP, they must calculate the entire epoch’s proposer schedule at the start of each epoch. However, computing the proposer index is light, involving sampling validators until we reach a validator with sufficient effective balance to be selected as a proposer. Still, testing is needed to confirm that these additional calculations do not create performance bottlenecks in practice.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;See &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;tree&#x2F;cbaa0063979168a94a9c7821f366c6a221319c8e&#x2F;tests&#x2F;core&#x2F;pyspec&#x2F;eth2spec&#x2F;test&#x2F;fulu&quot;&gt;the spec tests&lt;&#x2F;a&gt; in consensus-specs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;malicious-lookahead-alteration&quot;&gt;Malicious Lookahead Alteration&lt;&#x2F;h3&gt;
&lt;p&gt;A critical consideration for any proposer election mechanism is preventing validators from manipulating lookahead to gain an unfair advantage. This proposal does not increase the chances of such attacks, as we do not alter the “RANDAO delay” used in the lookahead—the lookahead of epoch &lt;code&gt;N&lt;&#x2F;code&gt; is still determined by the RANDAO of epoch &lt;code&gt;N - MIN_SEED_LOOKAHEAD - 1&lt;&#x2F;code&gt; (which becomes available at the start of epoch &lt;code&gt;N - MIN_SEED_LOOKAHEAD&lt;&#x2F;code&gt;). The only difference is that it changes the “effective balances delay”: rather than using the effective balances (EB) at the start of epoch &lt;code&gt;N&lt;&#x2F;code&gt;, it now uses the EB at the start of epoch &lt;code&gt;N - MIN_SEED_LOOKAHEAD&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore, by aligning the RANDAO and effective balances in this way, the proposal removes any chance of validators adjusting their EB after seeing the RANDAO outcome, which is an attack vector to consider. No such attack has been found so far, but this change removes the possibility, hence simplifying the security analysis.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Dynamic exit queue rate limit</title>
        <published>2025-03-24T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Mikhail Kalinin</name><uri>https://github.com/mkalinin</uri>
	</author>
	
	<author>
		<name>Mike Neuder</name><uri>https://github.com/michaelneuder</uri>
	</author>
	
	<author>
		<name>Mallesh Pai</name><uri>https://github.com/Mmp610</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7922/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/dynamic-exit-churn-limit-using-historical-unused-capacity/23280" />
        

        <id>https://wg-eips.ritovision.com/7922/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7922"
            label="EIP-7922" />
        

        
        

        
        <summary type="html">Update the validator exit process by dynamically adjusting the churn limit based on historical validator exits.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7922/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes updating Ethereum&#x27;s validator exit churn calculation by dynamically adjusting the churn limit at the start of each 256-epoch period (&quot;generation&quot;) based on historical validator exits. Specifically, the maximum churn allowed in each generation will adjust according to the unused churn from the past 16 generations. This approach reduces validator wait times during periods of high exit demand &lt;em&gt;without sacrificing network safety&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Ethereum currently implements a fixed, rate-limited queue for validator exits to ensure the security and stability of the network. The exit queue ensures the economic security of transactions finalized by the validator set. Suppose a malicious validator could immediately exit the set without any delay. In that case, they may attempt to execute a double spend attack by publishing a block while withholding a conflicting block, which they release after their stake has exited the protocol. The slashing mechanism can no longer hold the malicious validator accountable, and two conflicting finalized transactions may exist (if the attacker has 1&#x2F;3 of the total stake and successfully splits the 2&#x2F;3 honest majority in half).&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;CHURN_LIMIT_QUOTIENT=2^16&lt;&#x2F;code&gt; was selected according to the rough heuristic that it should take approximately one month for 10% of the stake to exit. With 1,053,742 validators, we have a churn limit of 16 exits per epoch. 225 epochs per day $\implies$ 3600 exits per day $\implies$ 108,000 exits per 30 days. Then 108,000&#x2F;1,053,742 $\approx$ 0.10. We can interpret this as &quot;&lt;em&gt;the economic security of a finalized transaction decreases by no more than 10% within one month&lt;&#x2F;em&gt;.&quot;&lt;&#x2F;p&gt;
&lt;p&gt;Another way of understanding the 16 exits per epoch security model is that it encodes the following constraints around validator exits:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;at most 16 validators exit in the next one epoch, and&lt;&#x2F;li&gt;
&lt;li&gt;at most 32 validators exit in the next two epochs, and&lt;&#x2F;li&gt;
&lt;li&gt;at most 48 validators exit in the next three epochs, and
...&lt;&#x2F;li&gt;
&lt;li&gt;at most 16 $\cdot$ n validators exit in the next n epochs.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;While these constraints are simple to understand, the fixed per-epoch churn limit can result in unnecessarily long validator withdrawal delays during periods of higher-than-average exit demand, such as during institutional liquidations or market events. We argue that we should choose a &lt;em&gt;single&lt;&#x2F;em&gt; constraint from the above set and implement that flexibly.&lt;&#x2F;p&gt;
&lt;p&gt;We illustrate this with an example. With one million validators, the current protocol specifies that 16 validators may exit per epoch. Over two weeks, this corresponds to 50,400 exits. This translates directly to &quot;no more than 5.04% of the validators (equiv. stake) can exit within two weeks.&quot; Now imagine that in the past 13 days, no validators have exited the protocol, and thus, none of the two-week churn limit has been used. If a large staking operator with 3% of the validator set (30,000 validators) seeks to withdraw immediately, they should be able to -- this doesn&#x27;t violate the two-week limit of 5.04%. However, since only 16 exits can be processed per epoch moving forward, they are forced to wait 1875 epochs (equiv. 8.33 days).&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Key observation:&lt;&#x2F;strong&gt; If we enable the protocol to &lt;em&gt;look backward&lt;&#x2F;em&gt; at the exit history, we no longer need the per-epoch limit &lt;em&gt;looking forward&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;For example, say we chose the following constraint explicitly:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Proposed weak subjectivity constraint:&lt;&#x2F;strong&gt; &lt;em&gt;No more than 50,400 exits in two weeks.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;Then, we only need to ensure that the constraint is honored over every rolling two-week window without setting a hard cap on exits during every epoch. A dynamically adjusted churn limit based on historical validator exit data allows Ethereum to flexibly accommodate spikes in exit demand while &lt;em&gt;preserving the same security over every two-week window&lt;&#x2F;em&gt;. By tracking the unused churn capacity of recent generations (periods), we can safely increase the churn limit when the network consistently operates below capacity, significantly improving the validator exit experience.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Since the validator exit process is complex, we start with the stack trace and a verbal description of the end-to-end process in Electra.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;initiate_validator_exit&lt;&#x2F;code&gt; – a validator signals their intent to exit, which is actuated by setting &lt;code&gt;validator.exit_epoch&lt;&#x2F;code&gt; and &lt;code&gt;validator.withdrawable_epoch&lt;&#x2F;code&gt; based on the output of &lt;code&gt;compute_exit_epoch_and_update_churn&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;compute_exit_epoch_and_update_churn&lt;&#x2F;code&gt; – is used to determine the exit epoch of a validator. This function implements the exit queue in the following way:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;get_balance_churn_limit&lt;&#x2F;code&gt; - returns the amount of withdrawable ETH per epoch by dividing the total active balance by 2**16.&lt;&#x2F;li&gt;
&lt;li&gt;set &lt;code&gt;exit_balance_to_consume&lt;&#x2F;code&gt; to the churn available in the current furthest epoch where some exits will be processed.&lt;&#x2F;li&gt;
&lt;li&gt;if &lt;code&gt;exit_balance &amp;gt; exit_balance_to_consume&lt;&#x2F;code&gt;, then we calculate the number of extra epochs the exit consumes to set the final &lt;code&gt;exit_epoch&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;This EIP changes how the churn limit and exit epochs are calculated by examining the number of exits in the previous 14 generations.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;get_exit_churn_limit&lt;&#x2F;code&gt; – implements the new churn limit calculation by summing over historical generations.
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;per_epoch_exit_churn&lt;&#x2F;code&gt; is set using &lt;code&gt;get_activation_exit_churn_limit&lt;&#x2F;code&gt; as today by dividing the total stake by 2**16 and capping the result at 256 ETH. With today&#x27;s numbers, this returns 256 ETH that can churn per epoch.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;per_generation_exit_churn&lt;&#x2F;code&gt; is set by multiplying the per epoch exit churn by 256 (the number of epochs in a generation). With today&#x27;s numbers, this is 256 $\cdot$ 256 = 65536 ETH that can churn per generation.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;total_unused_exit_churn&lt;&#x2F;code&gt; is calculated by looping through the past generations and summing the amount of unused capacity, &lt;code&gt;per_generation_exit_churn - churn_usage&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The final returned value is capped at &lt;code&gt;per_epoch_exit_churn * 8&lt;&#x2F;code&gt;. With today&#x27;s numbers, this max is 256 $\cdot$ 8 = 2048 ETH per epoch.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;compute_exit_epoch_and_update_churn&lt;&#x2F;code&gt; – is modified to use &lt;code&gt;get_exit_churn_limit&lt;&#x2F;code&gt; and account for any churn consumed in the generation where the exit will be processed.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Generation&lt;&#x2F;strong&gt;: A period consisting of 256 epochs.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Historical Churn Vector&lt;&#x2F;strong&gt;: A fixed-size array (&lt;code&gt;exit_churn_vector&lt;&#x2F;code&gt;) that records the total amount of churned ETH in the previous 16 generations.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Unused Churn&lt;&#x2F;strong&gt;: The difference between the maximum possible churn and the actual churn that occurred within a generation.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;preset&quot;&gt;Preset&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Comment&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;EPOCHS_PER_CHURN_GENERATION&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint64(2**8)&lt;&#x2F;code&gt; (= 256)&lt;&#x2F;td&gt;&lt;td&gt;~27 hours&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;GENERATIONS_PER_EXIT_CHURN_VECTOR&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint64(2**4)&lt;&#x2F;code&gt; (= 16)&lt;&#x2F;td&gt;&lt;td&gt;~18 days&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;GENERATIONS_PER_EXIT_CHURN_LOOKAHEAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint(2**1)&lt;&#x2F;code&gt; (= 2)&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;EXIT_CHURN_SLACK_MULTIPLIER&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint(2**3)&lt;&#x2F;code&gt; (= 8)&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;new-state-variables&quot;&gt;New State Variables&lt;&#x2F;h3&gt;
&lt;p&gt;Add the following to the state:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;exit_churn_vector&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Vector&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;uint64&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GENERATIONS_PER_EXIT_CHURN_VECTOR&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; total exited balance per generation for GENERATIONS_PER_EXIT_CHURN_VECTOR generations&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;initialization&quot;&gt;Initialization&lt;&#x2F;h3&gt;
&lt;p&gt;Upon activation of this EIP, initialize new variables:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Mark the churn of each generation as fully consumed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;exit_churn_vector&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;UINT64_MAX&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GENERATIONS_PER_EXIT_CHURN_VECTOR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Update lookahead generations&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;earliest_exit_epoch_generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;earliest_exit_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EPOCHS_PER_CHURN_GENERATION&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;current_epoch_generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_current_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EPOCHS_PER_CHURN_GENERATION&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;lookahead_generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; current_epoch_generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GENERATIONS_PER_EXIT_CHURN_LOOKAHEAD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt; generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;current_epoch_generation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; lookahead_generation&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; earliest_exit_epoch_generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; generation&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;exit_churn_vector&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GENERATIONS_PER_EXIT_CHURN_VECTOR&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;em&gt;Design note:&lt;&#x2F;em&gt; Max out churn usage for the past generations as it is unknown; update the current and lookahead generations according to the &lt;code&gt;state.earliest_exit_epoch&lt;&#x2F;code&gt; generation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;new-functions&quot;&gt;New Functions&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;epoch-processing&quot;&gt;Epoch Processing&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; process_historical_exit_churn_vector&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    current_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_current_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    next_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; current_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    current_epoch_generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; current_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EPOCHS_PER_CHURN_GENERATION&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    earliest_exit_epoch_generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;earliest_exit_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EPOCHS_PER_CHURN_GENERATION&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    next_epoch_generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; next_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EPOCHS_PER_CHURN_GENERATION&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Update the vector if switching over to the next generation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; next_epoch_generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; current_epoch_generation&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        lookahead_generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; next_epoch_generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GENERATIONS_PER_EXIT_CHURN_LOOKAHEAD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        lookahead_generation_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; lookahead_generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GENERATIONS_PER_HISTORICAL_CHURN_VECTOR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; earliest_exit_epoch_generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; lookahead_generation&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If earliest_exit_epoch is earlier than the lookahead generation,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; reset its churn usage to 0,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;exit_churn_vector&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;lookahead_generation_index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; otherwise, mark the lookahead generation churn as fully consumed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;historical_exit_churn_vector&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;lookahead_generation_index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; UINT64_MAX&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;em&gt;Design note&lt;&#x2F;em&gt;: This function resets the lookahead generation churn upon switching to the next generation. If &lt;code&gt;state.earliest_exit_epoch&lt;&#x2F;code&gt; falls into the generation earlier than the lookahead, the lookahead generation churn usage is reset. Otherwise, it is marked as fully used.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;get-exit-churn-limit&quot;&gt;&lt;code&gt;get_exit_churn_limit&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_exit_churn_limit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Gwei&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    current_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_current_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    earliest_exit_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;earliest_exit_epoch&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; compute_activation_exit_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;get_current_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    per_epoch_exit_churn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_activation_exit_churn_limit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If the earliest_exit_epoch generation is beyond the lookahead,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; don&amp;#39;t use the slack.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    current_generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; current_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EPOCHS_PER_CHURN_GENERATION&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    lookahead_generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; current_generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GENERATIONS_PER_EXIT_CHURN_LOOKAHEAD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    earliest_exit_epoch_generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; earliest_exit_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EPOCHS_PER_CHURN_GENERATION&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; earliest_exit_epoch_generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; lookahead_generation&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; per_epoch_exit_churn&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Compute churn leftover from past generations.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    past_generations&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GENERATIONS_PER_EXIT_CHURN_VECTOR&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GENERATIONS_PER_EXIT_CHURN_LOOKAHEAD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; current_generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; past_generations&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        oldest_generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; current_generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; past_generations&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        oldest_generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    per_generation_exit_churn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; per_epoch_exit_churn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EPOCHS_PER_CHURN_GENERATION&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    total_unused_exit_churn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;oldest_generation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; current_generation&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        generation_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GENERATIONS_PER_EXIT_CHURN_VECTOR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        churn_usage&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;exit_churn_vector&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;generation_index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; churn_usage&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; per_generation_exit_churn&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            total_unused_exit_churn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; per_generation_exit_churn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; churn_usage&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Limit churn slack per epoch.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;total_unused_exit_churn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; per_epoch_exit_churn&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        per_epoch_exit_churn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EXIT_CHURN_SLACK_MULTIPLIER&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;em&gt;Design note:&lt;&#x2F;em&gt; Given churn usage for past generations and current epoch churn size estimates the churn leftover from past generations. Caps the returned churn at &lt;code&gt;per_epoch_exit_churn * EXIT_CHURN_SLACK_MULTIPLIER&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;modified-functions&quot;&gt;Modified Functions&lt;&#x2F;h3&gt;
&lt;p&gt;Replace the existing &lt;code&gt;compute_exit_epoch_and_update_churn&lt;&#x2F;code&gt; function with this simplified MINSLACK-inspired version:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; compute_exit_epoch_and_update_churn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; exit_balance&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Gwei&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Epoch&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    earliest_exit_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;earliest_exit_epoch&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; compute_activation_exit_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;get_current_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Modified in [EIP-XXXX]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    per_epoch_churn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_exit_churn_limit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; New epoch for exits.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;earliest_exit_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; earliest_exit_epoch&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        exit_balance_to_consume&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; per_epoch_churn&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        exit_balance_to_consume&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;exit_balance_to_consume&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Exit doesn&amp;#39;t fit in the current earliest epoch.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; exit_balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; exit_balance_to_consume&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        balance_to_process&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; exit_balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; exit_balance_to_consume&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        additional_epochs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;balance_to_process&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; per_epoch_churn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        earliest_exit_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; additional_epochs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        exit_balance_to_consume&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; additional_epochs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; per_epoch_churn&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Consume the balance and update state variables.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;exit_balance_to_consume&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; exit_balance_to_consume&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; exit_balance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;earliest_exit_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; earliest_exit_epoch&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; New in [EIP-XXXX]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    current_epoch_generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; current_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EPOCHS_PER_CHURN_GENERATION&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    exit_epoch_generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;earliest_exit_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EPOCHS_PER_CHURN_GENERATION&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    current_generation_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; current_epoch_generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GENERATIONS_PER_HISTORICAL_CHURN_VECTOR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Record churn usage only if exit falls into the lookahead period&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; and the exit epoch generation churn isn&amp;#39;t fully used.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    lookahead_generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; current_epoch_generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GENERATIONS_PER_EXIT_CHURN_LOOKAHEAD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    exit_epoch_generation_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; exit_epoch_generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GENERATIONS_PER_EXIT_CHURN_VECTOR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;exit_epoch_generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span&gt; lookahead_generation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        and&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;historical_exit_churn_vector&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;exit_epoch_generation_index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; UINT64_MAX&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;exit_churn_vector&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;exit_epoch_generation_index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; exit_balance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;earliest_exit_epoch&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;As we described earlier, by computing unused churn from the previous 14 generations, the churn limit dynamically responds to actual validator behavior. This mechanism:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Reduces validator waiting times during periods of congestion.&lt;&#x2F;li&gt;
&lt;li&gt;Ensures security by restricting maximum churn limit increases.&lt;&#x2F;li&gt;
&lt;li&gt;Simplifies implementation compared to more complex dynamic mechanisms.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;A generation length of 256 epochs (~27 hours) and a history of 14 generations (~16 days) balances responsiveness and stability, enabling Ethereum to adapt smoothly to sustained changes in validator exit behavior.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP requires a hard fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Validator exit constraints remain crucial for Ethereum&#x27;s accountable safety. This proposal maintains the core safety guarantee by strictly limiting the increase of the churn limit.&lt;&#x2F;li&gt;
&lt;li&gt;The maximum churn limit is capped at eight times the current fixed churn, ensuring safety assumptions hold even in worst-case scenarios.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via CC0.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Adaptive mean reversion blob pricing</title>
        <published>2025-03-23T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Anders Elowsson</name><uri>https://github.com/anderselowsson</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7915/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/adaptive-mean-reversion-blob-pricing/23243" />
        

        <id>https://wg-eips.ritovision.com/7915/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7915"
            label="EIP-7915" />
        

        
        

        
        <summary type="html">Fee schedule accounting for the long-run average to quickly restore equilibrium under inelastic demand</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7915/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Reworks the excess blob gas update in &lt;code&gt;calc_excess_blob_gas()&lt;&#x2F;code&gt; so that the blob base fee rises relatively more during high gas usage than it falls during low usage whenever the current fee is below the long-run average. This establishes a smoothly adapting, neutral lower bound for the base fee. The exponential moving average (EMA) is computed in the linear domain and stored as a header variable.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Demand for blobspace is fee-inelastic, leading to a blob base fee that may fluctuate excessively with minor shifts in aggregate demand. The lower end of the fee range of 1 wei is under current circumstances economically inconsequential, but can be reached after a period of blocks consuming fewer blobs than the target. During increases in demand, the existing fee mechanism requires sustained periods of near-full blocks to re-establish equilibrium. This exacerbates spikiness in resource consumption, which can hamper efficient scaling of throughput. Furthermore, users may intermittently need to compete in a first-price auction for inclusion, degrading UX. The appropriate fee range will inadvertently vary going forward due to changes in the ETH token price and circulating supply, as well as the protocol&#x27;s ability to scale throughput. To remain neutral and future-proof, the operational range should be established relative to the long-run average fee, smoothly affecting the equilibrium quantity of blobs consumed. Thus, this EIP introduces a new fee update mechanism that accounts for the long-run average fee when responding to shifts in demand. This allows the protocol to quickly converge to desirable equilibria while also remaining neutral and future-proof.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7915&#x2F;.&#x2F;assets&#x2F;1.png&quot; alt=&quot;Figure 1&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Figure 1.&lt;&#x2F;strong&gt; Response to various blob quantities for the proposed fee mechanism (green), the current mechanism (black), and the threshold mechanism of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7762&#x2F;&quot;&gt;EIP-7762&lt;&#x2F;a&gt; (red). The proposed mechanism smoothly converges to appropriate equilibria when demand shifts, establishing the fee relative to the long-run average base fee $\bar{f}_g$ (at 4 gwei in this example). The fee adapts faster when converging toward $\bar{f}_g$ from below than when diverging from it.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Short description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;EMA_DECAY&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2**18&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Reciprocal of the EMA decay rate (per slot)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MEAN_REVERSION_DEADBAND&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;64&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Fee ratio at which mean reversion effect accelerates&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MEAN_REVERSION_FULLBAND&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;10**6&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Fee ratio at which mean reversion effect stops increasing&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;functions&quot;&gt;Functions&lt;&#x2F;h3&gt;
&lt;p&gt;The function &lt;code&gt;calc_excess_blob_gas()&lt;&#x2F;code&gt; from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt; is updated. A mean reversion weight &lt;code&gt;w&lt;&#x2F;code&gt; is computed based on the ratio between the long-run base fee and the current base fee. The weight influences the excess gas update by smoothly increasing the gas used and decreasing the gas target as the current base fee falls below the long-run base fee (see Figure 2 below). The variable &lt;code&gt;Up&lt;&#x2F;code&gt; upsamples &lt;code&gt;w&lt;&#x2F;code&gt; to retain precision. Note that the function applies &lt;code&gt;integer_squareroot()&lt;&#x2F;code&gt;, which must be implemented at the execution layer; it is currently implemented at the consensus layer. Thresholding at &lt;code&gt;MEAN_REVERSION_FULLBAND&lt;&#x2F;code&gt; and strategic deployment of &lt;code&gt;Up&lt;&#x2F;code&gt; allows the mechanism to rely on the &lt;code&gt;uint64&lt;&#x2F;code&gt; type internally.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calc_excess_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Header&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;excess_blob_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;blob_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TARGET_BLOB_GAS_PER_BLOCK&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Compute upsampled mean reversion weight w based on the EMA fee ratio&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Up&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;16&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; get_base_fee_per_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;base_fee_per_blob_gas_ema&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        w&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Up&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;base_fee_per_blob_gas_ema&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; get_base_fee_per_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MEAN_REVERSION_FULLBAND&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            ratio&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Up&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MEAN_REVERSION_FULLBAND&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            ratio&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Up&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;base_fee_per_blob_gas_ema&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; get_base_fee_per_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        w&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;ratio&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; Up&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MEAN_REVERSION_DEADBAND&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;MEAN_REVERSION_DEADBAND&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; _&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            w&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; integer_squareroot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;w&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; Up&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Return excess blob gas based on adjusted gas usage and target under mean reversion&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;excess_blob_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;blob_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; w&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; Up&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TARGET_BLOB_GAS_PER_BLOCK&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; Up&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; w&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The exponential moving average (EMA) of the base fee is updated based on the previous block&#x27;s &lt;code&gt;base_fee_per_blob_gas&lt;&#x2F;code&gt; and &lt;code&gt;base_fee_per_blob_gas_ema&lt;&#x2F;code&gt; in a new function:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calc_base_fee_per_blob_gas_ema&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Header&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;base_fee_per_blob_gas_ema&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        get_base_fee_per_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EMA_DECAY&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;base_fee_per_blob_gas_ema&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EMA_DECAY&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;header-extension&quot;&gt;Header extension&lt;&#x2F;h3&gt;
&lt;p&gt;The current header encoding is extended with the &lt;code&gt;uint&lt;&#x2F;code&gt; field &lt;code&gt;base_fee_per_blob_gas_ema&lt;&#x2F;code&gt;. For the first post-fork block, &lt;code&gt;parent.base_fee_per_blob_gas_ema&lt;&#x2F;code&gt; is evaluated as &lt;code&gt;4*10**9&lt;&#x2F;code&gt; (4 gwei).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;execution-layer-validation&quot;&gt;Execution layer validation&lt;&#x2F;h3&gt;
&lt;p&gt;The block validity conditions on the execution layer are extended to assert that &lt;code&gt;base_fee_per_blob_gas_ema&lt;&#x2F;code&gt; was correctly updated:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check that the base fee per blob gas EMA was updated correctly&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;base_fee_per_blob_gas_ema&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; calc_base_fee_per_blob_gas_ema&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;supply-and-demand&quot;&gt;Supply and demand&lt;&#x2F;h3&gt;
&lt;p&gt;Since the introduction of blobs, the reservation fee of the marginal consumer of blobs has periodically been very low. Whenever demand picks up, a sustained succession of near-full blocks is required to restore equilibrium, with the mechanism intermittently resorting to a first-price auction, considered a worse UX by blob consumers. The resulting spikiness in resource consumption is suboptimal for scaling blobspace. At a fundamental level, the issue is that Ethereum faces a fee-inelastic demand curve while operating a perfectly inelastic supply curve—with supply fixed at &lt;code&gt;TARGET_BLOB_GAS_PER_BLOCK&lt;&#x2F;code&gt;. When an equilibrium forms between fee-inelastic supply and demand curves, even a small shift in aggregate demand can lead to huge shifts in the equilibrium fee. This proposal smoothly increases the elasticity of the supply curve as it diverges from the long-run average, restricting the equilibrium fee from forming much below the average. Combined with the faster fee adjustments in the direction of the average, a desirable equilibrium can then quickly be established during temporary shifts in demand.&lt;&#x2F;p&gt;
&lt;p&gt;Supply and demand are not fixed, and the appropriate equilibrium will inadvertently shift in the future due to changes in the ETH token price and circulating supply, as well as the protocol&#x27;s ability to scale throughput. To remain neutral and future-proof, the pricing mechanism should therefore operate on a relative basis, ideally then anchored to the computed long-run average.&lt;&#x2F;p&gt;
&lt;p&gt;When demand fails to meet supply, a producer can reduce the unit price or decrease the quantity supplied to re-establish equilibrium. If it sells unique goods but seeks to avoid inefficiencies from either idle capacity or excessive resource use, it can gradually reduce both, smoothly moving along its expansion path to attain the optimal equilibrium under the given demand curve. Ethereum can respond to &lt;em&gt;temporary downturns&lt;&#x2F;em&gt; in demand by gradually reducing both price &lt;em&gt;and&lt;&#x2F;em&gt; equilibrium throughput, smoothly reducing the number of consumed blobs at which the price remains fixed. This is achieved by adjusting the fee update to smoothly become less responsive to low gas usage, implicitly controlling output. Ethereum cannot respond to &lt;em&gt;sustained downturns&lt;&#x2F;em&gt; in demand by reducing throughput, because such a downturn could imply that circumstances have changed, and that the price is now &lt;em&gt;too high&lt;&#x2F;em&gt; (assuming the protocol remains neutral). To be clear, Ethereum reduces throughput already today during downturns in demand by thresholding at 1 wei. Any fixed threshold that prevents the price from falling further once reached reduces throughput by not allowing blocks with below-threshold gas usage to influence the future fee. However, an instant shift from a fixed response schedule to complete unresponsiveness under a below-target demand presumably does not reflect the protocol&#x27;s blobspace production expansion path (see also Figure 1).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;proposed-base-fee-update-schedule&quot;&gt;Proposed base fee update schedule&lt;&#x2F;h3&gt;
&lt;p&gt;The update schedule adheres to the following design principles:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Remain neutral and future-proof concerning changes in supply and demand.&lt;&#x2F;li&gt;
&lt;li&gt;Rely on the normal fee update schedule when the base fee is above or just slightly below the long-run average.&lt;&#x2F;li&gt;
&lt;li&gt;Smoothly adjust the fee update to become less responsive to low gas usage and more responsive to high gas usage as the ratio $\bar{f}_g&#x2F;f_g$ grows.&lt;&#x2F;li&gt;
&lt;li&gt;When the price is relatively low ($f_g&amp;lt;\bar{f}_g$), raise the fee quickly during a rise in demand and reduce it slowly during a fall in demand. In other words, add a mean reversion effect (this is closely related to the previous point).&lt;&#x2F;li&gt;
&lt;li&gt;The fee update must vary smoothly with blob quantity at all applicable $\bar{f}_g&#x2F;f_g$ ratios so that users or validators will not strategically include specific quantities of blobs in each block.&lt;&#x2F;li&gt;
&lt;li&gt;Avoid extreme responses even if the ratio $\bar{f}_g&#x2F;f_g$ diverges substantially.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;A mean reversion weight is first computed&lt;&#x2F;p&gt;
&lt;p&gt;$$
w = \sqrt[8]{\frac{\bar{f}_g&#x2F;f_g + D}{D+1}},
$$&lt;&#x2F;p&gt;
&lt;p&gt;where $D$ is the constant &lt;code&gt;MEAN_REVERSION_DEADBAND&lt;&#x2F;code&gt;, set to 64. The eighth root can be computed by applying the existing (at the consensus layer) function &lt;code&gt;integer_squareroot()&lt;&#x2F;code&gt; three times. The update to the excess gas field $e_g$ for slot $n$ is then changed from&lt;&#x2F;p&gt;
&lt;p&gt;$$
e_{g(n)} = e_{g(n-1)} + c_g - t_g
$$&lt;&#x2F;p&gt;
&lt;p&gt;to&lt;&#x2F;p&gt;
&lt;p&gt;$$
e_{g(n)} = e_{g(n-1)} + c_gw - t_g&#x2F;w.
$$&lt;&#x2F;p&gt;
&lt;p&gt;Figure 2 illustrates the resulting fee update schedule when applying the blob targets from Pectra. The further the fee falls below the average, the fewer blobs must be consumed for the fee to remain fixed. This eventually leads to equilibrium being established, even under low demand. The transition is gradual, allowing for a smooth response to shifts in demand. Note that the vertical blob spacing is kept smooth at all ratios, discouraging users or validators to strategically adapt intra-block consumption of blobs.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7915&#x2F;.&#x2F;assets&#x2F;2.png&quot; alt=&quot;Figure 2&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Figure 2.&lt;&#x2F;strong&gt; Proposed blob fee update schedule across the $f_g&#x2F;\bar{f}_g$ ratio under Pectra blob constants. When the ratio is around or above 1, the baseline fee update schedule is applied. When the fee falls below the average, fewer blobs must be consumed for the fee to remain fixed.&lt;&#x2F;p&gt;
&lt;p&gt;The fee schedule is computed across the range &lt;code&gt;MEAN_REVERSION_FULLBAND = 10**6&lt;&#x2F;code&gt;. Thus, if the ratio in Figure 2 falls below $10^{-6}$, the schedule at $10^{-6}$ applies. This approach protects against exploding fee schedules, allows the fee to gradually fall further if no blobs at all are consumed, and protects against overflow due to high ratios (thus allowing for the smaller &lt;code&gt;uint64&lt;&#x2F;code&gt; in the &lt;code&gt;calc_excess_blob_gas()&lt;&#x2F;code&gt; function). Optionally, the operational region can also be bounded by adding a constant $c$ (set in the region of 1-2 blobs worth of gas) to the fee update schedule:&lt;&#x2F;p&gt;
&lt;p&gt;$$
e_{g(n)} = e_{g(n-1)} + c_gw - t_g&#x2F;w + c(w-1).
$$&lt;&#x2F;p&gt;
&lt;p&gt;The mechanism only applies mean reversion when $f_g &amp;lt; \bar{f}_ g.$ While there can be benefits from mean reversion in both directions, the case when $f_g&amp;lt;\bar{f}_ g$ is far more important to address. Furthermore, the update schedule from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7691&#x2F;&quot;&gt;EIP-7691&lt;&#x2F;a&gt;, applied when $f_g \geq \bar{f}_g$, already decreases more with 0 blobs than it increases with the maximum.&lt;&#x2F;p&gt;
&lt;p&gt;A symmetrical update schedule at ratios around 1 was initially considered since the target from Pectra is not centered at &lt;code&gt;MAX_BLOB_GAS_PER_BLOCK&#x2F;2&lt;&#x2F;code&gt;. However, a well-formed symmetrical fee update schedule will likely not achieve a &lt;code&gt;TARGET_BLOB_GAS_PER_BLOCK&lt;&#x2F;code&gt; throughput, even though it responds to a target gas consumption by keeping the fee fixed. The reason is that the fee update for blocks $x$ blobs above the target and $x$ blobs below the target will not be reciprocal. Equilibrium would therefore settle at slightly lower throughput than &lt;code&gt;TARGET_BLOB_GAS_PER_BLOCK&lt;&#x2F;code&gt;, at a slightly higher price than when relying on the assymetrical update schedule with an identical target. The proposed fee update schedule instead intermediately transitions to a symmetrical schedule as the fee ratio falls (see Figure 2).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;computing-the-long-run-average-base-fee&quot;&gt;Computing the long-run average base fee&lt;&#x2F;h3&gt;
&lt;p&gt;An average of the base fee $\bar{f}_g$ is maintained in the header variable &lt;code&gt;base_fee_per_blob_gas_ema&lt;&#x2F;code&gt;, computed as an exponential moving average. Each slot, $\bar{f}_g$ is updated by taking&lt;&#x2F;p&gt;
&lt;p&gt;$$
\bar{f}_ {g(n)} = \bar{f}_ {g(n-1)} + \frac{f_{g(n-1)} - \bar{f}_{g(n-1)}}{m},
$$&lt;&#x2F;p&gt;
&lt;p&gt;where $m$ is a constant &lt;code&gt;EMA_DECAY=2**18&lt;&#x2F;code&gt;. This setting gives a half-life of around one month. If the &lt;code&gt;EMA_DECAY&lt;&#x2F;code&gt; is set slightly higher, the mechanism is guaranteed to influence blob pricing over the next few years. For example, initializing $\bar{f}_ g=4\times10^9$ (as proposed) and setting a half-life of four months (&lt;code&gt;EMA_DECAY=2**20&lt;&#x2F;code&gt;) ensures that $\bar{f}_ g&amp;gt;5\times10^8$ one year after activation. If the proposed mechanism is included in a hard fork that also boosts throughput, this could be seen as a bonus, given the smooth floor operating a few orders of magnitude below $\bar{f}_ g$.&lt;&#x2F;p&gt;
&lt;p&gt;Figure 3 shows how $\bar{f}_{g}$ would have evolved between November 2024 and March 2025, using $4\times10^9$ as a starting value. Note that the EMA fee could be allowed to fall below &lt;code&gt;EMA_DECAY&lt;&#x2F;code&gt; by subtracting at least 1 in each update step (this is however not part of the functionality in the specification).&lt;&#x2F;p&gt;
&lt;p&gt;The EMA is computed in the linear domain to preserve additivity and maintain interpretability. Averaging in the log-domain across excess gas (akin to a geometric mean in the linear domain) would give undue influence to fine-grained fluctuations at lower fees. This would make changes at lower gas thresholds very influential, creating feedback loops that are hard to explain and reason about; especially since the threshold at 1 wei always will be fixed and gradually could come into play over the long run due to shifts in supply or demand. However, note that while it is strictly preferred to compute the EMA in the linear domain, it would be possible to convert back to the log-domain to store and apply an excess blob gas EMA. This option is described in the next subsection.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7915&#x2F;.&#x2F;assets&#x2F;3.png&quot; alt=&quot;Figure 3&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Figure 3.&lt;&#x2F;strong&gt; Exponential moving average with the proposed settings applied to a few months of historical blob base fee data.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;alternative-approach&quot;&gt;Alternative approach&lt;&#x2F;h3&gt;
&lt;p&gt;One alternative way to structure the adaptive mean reversion was referenced in the previous subsection and will be described here. It differs in that that the protocol would rely on and store a log-domain representation of &lt;code&gt;base_fee_per_blob_gas_ema&lt;&#x2F;code&gt;: &lt;code&gt;excess_blob_gas_ema&lt;&#x2F;code&gt;. The EMA computation would still be performed in the linear domain, but &lt;code&gt;get_base_fee_per_blob_gas()&lt;&#x2F;code&gt; and its inverse—relying on a new &lt;code&gt;fake_log()&lt;&#x2F;code&gt; function—would be applied during computations to first go to the linear domain and then return to the log-domain&lt;&#x2F;p&gt;
&lt;p&gt;$$
\bar{e}_ {g(n)} = \log\Biggl[\exp\bigl(\bar{e}_ {g(n-1)}\bigr) + \frac{\exp\bigl(e_ {g(n-1)}\bigr) - \exp\bigl(\bar{e}_ {g(n-1)}\bigr)}{m}\Biggr].
$$&lt;&#x2F;p&gt;
&lt;p&gt;The weight calculation in &lt;code&gt;calc_excess_blob_gas()&lt;&#x2F;code&gt; could then be performed in the log-domain, in principle:&lt;&#x2F;p&gt;
&lt;p&gt;$$
w = \frac{\bar{e}_g-e_g + D}{D+1},
$$&lt;&#x2F;p&gt;
&lt;p&gt;but where, e.g., $D$ would be adjusted according to relevant excess gas scaling for the applicable hard fork. The fee update schedule would become very similar with both approaches, and the choice thus mostly comes down to architectural preferences.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The blob base fee doubles during full blocks if the current fee is several orders of magnitude below the average. As a result, a single-block delay in inclusion results in users paying twice as much, potentially influencing inclusion and fee-market strategies. However, practical implications should be limited, given that this aggressive fee schedule only operates at fees well below the average.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Signature Verifiers</title>
        <published>2025-03-21T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Hadrien Croubois</name><uri>https://github.com/Amxx</uri>
	</author>
	
	<author>
		<name>Ernesto García</name><uri>https://github.com/ernestognw</uri>
	</author>
	
	<author>
		<name>Francisco Giordano</name><uri>https://github.com/frangio</uri>
	</author>
	
	<author>
		<name>Aryeh Greenberg</name><uri>https://github.com/arr00</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7913/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7913-key-verifiers/23262" />
        

        <id>https://wg-eips.ritovision.com/7913/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7913"
            label="ERC-7913" />
        

        
        

        
        <summary type="html">Interface for the verification of signatures by address-less keys</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7913/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Externally Owned Accounts (EOA) can sign messages with their associated private keys. Additionally &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;ERC-1271&lt;&#x2F;a&gt; defines a method for signature verification by smart accounts such as multisig. In both cases the identity of the signer is an ethereum address. We propose a standard to extend this concept of signer description, and signature verification, to keys that do not have an ethereum identity of their own, in the sense that they don&#x27;t have their own address to represent them.&lt;&#x2F;p&gt;
&lt;p&gt;This new mechanism can be used to integrate new signers such as non-ethereum cryptographic curves, hardware devices, or even email addresses. This is particularly relevant when dealing with things like social-recovery of smart accounts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;With the development of account abstraction, there is an increasing need for non-ethereum signature verification. Cryptographic algorithms besides the natively supported secp256k1 are being used for controlling smart accounts. In particular, curves such as secp256r1 (supported by many mobile devices) and RSA keys (that are distributed by traditional institutions) are widely available. Beyond these two examples, we also see the emergence of ZK solutions for signing with emails or JWT from big Web2 services.&lt;&#x2F;p&gt;
&lt;p&gt;All these signature mechanisms have one thing in common: they do not have a canonical ethereum address to represent them onchain. While users could deploy ERC-1271 compatible contracts for each key individually, this would be cumbersome and expensive. As account abstraction tries to separate account addresses (that hold assets) from the key that controls them, giving fixed on-chain addresses to keys (and possibly sending assets to these addresses by mistake) is not the right approach. Instead, using a small number of verifier contracts that can process signatures in a standard way, and having the accounts rely on these verifiers, feels like the correct approach. This has the advantage that once the verifier is deployed, any key can be represented using a &lt;code&gt;(verifier, key)&lt;&#x2F;code&gt; pair without requiring any setup cost.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;(verifier, key)&lt;&#x2F;code&gt; pairs can be given permission to control a smart account, perform social recovery, or do any other operation without ever having a dedicated on-chain address. Systems that want to adopt this approach need to transition away from the model where signers are identified by their address to a new model where signers may not have an address, and are identified by a &lt;code&gt;bytes&lt;&#x2F;code&gt; object.&lt;&#x2F;p&gt;
&lt;p&gt;This definition is backward compatible with EOA and ERC-1271 contracts: in that case, we use the address of the identity (EOA or contract) as the verifier and the key is empty.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;nomenclature&quot;&gt;Nomenclature&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Keys are represented using &lt;code&gt;bytes&lt;&#x2F;code&gt; objects of arbitrary length. For example a P256 or RSA public key. Keys MUST NOT be empty.&lt;&#x2F;li&gt;
&lt;li&gt;Verifiers are smart contracts in charge of signature verification for a given type of key. They have an ethereum address.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;signature-verifier-interface&quot;&gt;Signature Verifier interface&lt;&#x2F;h3&gt;
&lt;p&gt;Verifiers MUST implement the following interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7913SignatureVerifier&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verifies `signature` as a valid signature of `hash` by `key`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * MUST return the bytes4 magic value 0x024ad318 (IERC7913SignatureVerifier.verify.selector) if the signature is valid.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * SHOULD return 0xffffffff or revert if the signature is not valid.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * SHOULD return 0xffffffff or revert if the key is empty&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Verifiers SHOULD be stateless.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Verifiers can be used to avoid deploying many ERC-1271 &quot;identity contract&quot; (one per key), which would be expensive. Using this model, new keys can be used without any deployment costs.&lt;&#x2F;p&gt;
&lt;p&gt;ERC-1271 already covers the cases were a key is not necessary. To avoid ambiguity, the verifiers contracts should not support (or be expected to support) empty keys. Signers that are 20 bytes long (empty key) should be handled using ERC-1271.&lt;&#x2F;p&gt;
&lt;p&gt;Consistency with existing systems (ecrecover and ERC-1271) requires the message to be &lt;code&gt;bytes32&lt;&#x2F;code&gt; hash. These are usually produced following &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;191&#x2F;&quot;&gt;ERC-191&lt;&#x2F;a&gt; or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;ERC-712&lt;&#x2F;a&gt;. Cryptographic systems that use different hashing methods SHOULD see this hash as a message, and possibly rehash it following the relevant standards.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;A system can support &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7913&#x2F;&quot;&gt;ERC-7913&lt;&#x2F;a&gt; signers alongside EOAs and ERC-1271 in the following way.&lt;&#x2F;p&gt;
&lt;p&gt;A signer is a &lt;code&gt;bytes&lt;&#x2F;code&gt; object that is the concatenation of an address and optionally a key: &lt;code&gt;verifier || key&lt;&#x2F;code&gt;. A signer is at least 20 bytes long.&lt;&#x2F;p&gt;
&lt;p&gt;Given a signer &lt;code&gt;signer&lt;&#x2F;code&gt;, a message hash &lt;code&gt;hash&lt;&#x2F;code&gt;, and a signature &lt;code&gt;sign&lt;&#x2F;code&gt;, verification is done as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;if &lt;code&gt;signer.length &amp;lt; 20&lt;&#x2F;code&gt;: verification fails;&lt;&#x2F;li&gt;
&lt;li&gt;split &lt;code&gt;signer&lt;&#x2F;code&gt; into &lt;code&gt;(verifier, key)&lt;&#x2F;code&gt; with &lt;code&gt;verifier&lt;&#x2F;code&gt; being the first 20 bytes and &lt;code&gt;key&lt;&#x2F;code&gt; being the rest (potentially empty)&lt;&#x2F;li&gt;
&lt;li&gt;if &lt;code&gt;key&lt;&#x2F;code&gt; is empty, then consider that &lt;code&gt;verifier&lt;&#x2F;code&gt; is the identity.
&lt;ul&gt;
&lt;li&gt;verification is done using ERC-1271&#x27;s isValidSignature if there is code at &lt;code&gt;verifier&lt;&#x2F;code&gt; address, or ecrecover otherwise&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;if &lt;code&gt;key&lt;&#x2F;code&gt; is not empty, call &lt;code&gt;IERC7913SignatureVerifier(verifier).verify(key, hash, signature)&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;if the return value is the expected magic value (&lt;code&gt;0x024ad318&lt;&#x2F;code&gt;) then verification is successful,&lt;&#x2F;li&gt;
&lt;li&gt;otherwise, verification fails.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;In solidity, signature verification could be implemented in the following library:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;SignatureChecker&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;#39;@openzeppelin&#x2F;contracts&#x2F;utils&#x2F;cryptography&#x2F;SignatureChecker.sol&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Extention of openzeppelin&amp;#39;s SignatureChecker library&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;library&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SignatureCheckerExtended&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isValidSignatureNow&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 20&lt;&#x2F;span&gt;&lt;span&gt; )&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; SignatureChecker&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isValidSignatureNow&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        try&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7913SignatureVerifier&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;20&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;verify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;20&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; magic&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;          return&lt;&#x2F;span&gt;&lt;span&gt; magic &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; IERC7913SignatureVerifier&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;verify&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; catch&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;          return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Signer may be used for anything from smart account session key (with a short lifetime of a few hours&#x2F;days) to social recovery &quot;guardians&quot; that may only be used several years after they are setup. In order to ensure that these signers remain valid &quot;in perpetuity&quot;, the verifier contract should be trustless. This means that the verifiers should not be upgradeable contracts.&lt;&#x2F;p&gt;
&lt;p&gt;Verifiers should also not depend on any value that can be modified after deployment. In solidity terms, the &lt;code&gt;verify&lt;&#x2F;code&gt; function should be pure. Any parameters that are involved in signature verification should either be part of the key, or part of immutable code of the verifier. Using &lt;code&gt;immutable&lt;&#x2F;code&gt; variable (in solidity) would be safe. The stateless aspect of the verifier also ensure compliance (of the verifier) with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7562&#x2F;&quot;&gt;ERC-7562&lt;&#x2F;a&gt; scope rules.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Composite EIP-712 Signatures</title>
        <published>2025-03-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Sola Ogunsakin</name><uri>https://github.com/sola92</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7920/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/composite-eip-712-signatures/23266" />
        

        <id>https://wg-eips.ritovision.com/7920/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:7920"
            label="ERC-7920" />
        

        
        

        
        <summary type="html">A scheme for signing multiple typed-data messages with a single signature</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7920/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC provides a standard for signing multiple typed-data messages with a single signature by encoding them into a Merkle tree. This allows components to independently verify messages, without requiring full knowledge of the others. It provides a significant UX improvement by reducing the number of signature prompts to one, while preserving the security and flexibility of the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; standard.&lt;&#x2F;p&gt;
&lt;p&gt;This ERC also gives applications the flexibility to verify messages in isolation, or in aggregate. This opens up new verification modalities: for e.g, an application can require that message (&lt;code&gt;x&lt;&#x2F;code&gt;) is only valid when signed in combination message (&lt;code&gt;y&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;As the ecosystem moves towards ETH-less transactions, users are often required to sign multiple off-chain messages in quick succession. Typically, a first signature is needed for a precise spend allowance (via Permit2, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2612&#x2F;&quot;&gt;ERC-2612&lt;&#x2F;a&gt;, etc.), followed by subsequent messages to direct the use of funds. This creates a frictional user experience as each signature requires a separate wallet interaction and creates confusion about what, in aggregate, is being approved.&lt;&#x2F;p&gt;
&lt;p&gt;Current solutions have significant drawbacks:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Pre-approving &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; allowance:&lt;&#x2F;strong&gt; spend creates security vulnerabilities&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Merging multiple messages into a single message:&lt;&#x2F;strong&gt; prevents independent verifiability. Each message cannot be verified without knowledge of the entire batch&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Separate signature requests:&lt;&#x2F;strong&gt; creates friction in the user experience&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This ERC has the following objectives:&lt;&#x2F;p&gt;
&lt;h3 id=&quot;single-signature&quot;&gt;Single Signature&lt;&#x2F;h3&gt;
&lt;p&gt;A single signature should cover multiple messages&lt;&#x2F;p&gt;
&lt;h3 id=&quot;isolated-verification&quot;&gt;Isolated Verification&lt;&#x2F;h3&gt;
&lt;p&gt;Messages should be independently verifiable without knowledge of others&lt;&#x2F;p&gt;
&lt;h3 id=&quot;human-readable&quot;&gt;Human-readable&lt;&#x2F;h3&gt;
&lt;p&gt;Readability benefits of EIP-712 should be preserved. Giving wallets and users insight into what is being signed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;overview&quot;&gt;Overview&lt;&#x2F;h3&gt;
&lt;p&gt;The composite signature scheme uses a Merkle tree to hash multiple typed-data data messages together under a single root. The user signs only the Merkle root. The process is described below.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;generating-a-composite-signature&quot;&gt;Generating a Composite Signature&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;For a set of messages &lt;code&gt;[m₁, m₂, ..., mₙ]&lt;&#x2F;code&gt;, encode each using EIP-712&#x27;s &lt;code&gt;encode&lt;&#x2F;code&gt; and compute its hash:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;hashₙ = keccak256(encode(mₙ))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Use these message hashes as leaf nodes in a Merkle tree and compute a &lt;code&gt;merkleRoot&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Sign the merkle root.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;signature = sign(merkleRoot)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;verification-process&quot;&gt;Verification Process&lt;&#x2F;h3&gt;
&lt;p&gt;To verify that an individual message &lt;code&gt;mₓ&lt;&#x2F;code&gt; was included in a composite signature:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Verify the signature on the &lt;code&gt;merkleRoot&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;recoveredSigner = ecrecover(merkleRoot, signature)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;isValidSignature = (recoveredSigner == expectedSigner)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Compute the leaf node for message &lt;code&gt;mₓ&lt;&#x2F;code&gt; and verify its path to the Merkle root, using the proof:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;leaf = keccak256(encode(mₓ))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;isValidProof = _verifyMerkleProof(leaf, merkleProof, merkleRoot)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Where &lt;code&gt;_verifyMerkleProof()&lt;&#x2F;code&gt; is defined as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _verifyMerkleProof&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;   bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; leaf&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;   bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; proof&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;   bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; merkleRoot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;   bytes32&lt;&#x2F;span&gt;&lt;span&gt; computedRoot &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; leaf&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;   for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; proof&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;       if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;computedRoot &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; proof&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;           computedRoot &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;computedRoot&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; proof&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;       }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;           computedRoot &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;proof&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; computedRoot&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;       }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;   return&lt;&#x2F;span&gt;&lt;span&gt; computedRoot &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; merkleRoot&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The message is verified if and only if (1) and (2) succeed.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;isVerified = isValidSignature &amp;amp;&amp;amp; isValidProof&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;specification-of-eth-signtypeddata-v5-json-rpc-method&quot;&gt;Specification of &lt;code&gt;eth_signTypedData_v5&lt;&#x2F;code&gt; JSON RPC method.&lt;&#x2F;h3&gt;
&lt;p&gt;This ERC adds a new method &lt;code&gt;eth_signTypedData_v5&lt;&#x2F;code&gt; to Ethereum JSON-RPC. This method allows signing multiple typed data messages with a single signature using the specification described above. The signing account must be prior unlocked.&lt;&#x2F;p&gt;
&lt;p&gt;This method returns: the signature, merkle root, and an array of proofs (each corresponding to an input message).&lt;&#x2F;p&gt;
&lt;h4 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h4&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;Address&lt;&#x2F;code&gt; - Signing account&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TypedData | TypedDataArray&lt;&#x2F;code&gt; - A single TypedData object or Array of &lt;code&gt;TypedData&lt;&#x2F;code&gt; objects from EIP-712.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h5 id=&quot;returns&quot;&gt;Returns&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Hex encoded 65 byte signature (same format as eth_sign)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  merkleRoot&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 32 byte Merkle root as hex string&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  proofs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Array&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Array&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Array of Merkle proofs (one for each input message)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;example&quot;&gt;Example&lt;&#x2F;h5&gt;
&lt;p&gt;Request:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;method&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_signTypedData_v5&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;types&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;EIP712Domain&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;verifyingContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;Person&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;wallet&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;Mail&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;from&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Person&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Person&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;contents&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;primaryType&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Mail&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;domain&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Ether Mail&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;verifyingContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;message&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;from&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Cow&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;wallet&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Bob&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;wallet&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;contents&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Hello, Bob!&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;types&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;EIP712Domain&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;verifyingContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;Transfer&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;recipient&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;primaryType&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Transfer&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;domain&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Ether Mail&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;verifyingContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;message&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;recipient&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Result:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x4355c47d63924e8a72e509b65029052eb6c299d53a04e167c5775fd466751c9d07299936d304c153f6443dfa05f40ff007d72911b6f72307f996231605b915621c&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;merkleRoot&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x7de103665e21d6c9d9f82ae59675443bd895ed42b571c7f952c2fdc1a5b6e8d2&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;proofs&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x4bdbac3830d492ac3f4b0ef674786940fb33481b32392e88edafd45d507429f2&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x95be87f8abefcddc8116061a06b18906f32298a4644882d06baff852164858c6&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The choice of using a Merkle tree to bundle messages provides the following additional benefits:&lt;&#x2F;p&gt;
&lt;h3 id=&quot;efficient-verification-on-chain&quot;&gt;Efficient verification on-chain&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;_verifyMerkleProof&lt;&#x2F;code&gt; has a runtime of &lt;code&gt;O(log2(N))&lt;&#x2F;code&gt; where N is the number of messages that were signed.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;flexible-verification-modes&quot;&gt;Flexible Verification Modes&lt;&#x2F;h3&gt;
&lt;p&gt;Applications can require combination of messages be signed together to enhance security.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;n-1-backwards-compatibility&quot;&gt;&lt;code&gt;N=1&lt;&#x2F;code&gt; backwards compatibility&lt;&#x2F;h3&gt;
&lt;p&gt;Merkle signature for single message bundles are equal to &lt;code&gt;eth_signTypedData_v4&lt;&#x2F;code&gt;. Requiring no onchain changes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;When the number of message is one, &lt;code&gt;eth_signTypedData_v5&lt;&#x2F;code&gt; produces the same signature as &lt;code&gt;eth_signTypedData_v4&lt;&#x2F;code&gt; since &lt;code&gt;merkleRoot == keccak256(encode(message))&lt;&#x2F;code&gt;. This allows &lt;code&gt;eth_signTypedData_v5&lt;&#x2F;code&gt; to be a drop-in replacement for &lt;code&gt;eth_signTypedData_v4&lt;&#x2F;code&gt; with no changes to on-chain verification.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;eth-signtypeddata-v5&quot;&gt;&lt;code&gt;eth_signTypedData_v5&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Reference implementation of &lt;code&gt;eth_signTypedData_v5&lt;&#x2F;code&gt; can be found the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7920&#x2F;.&#x2F;assets&#x2F;src&#x2F;eth_signTypedData_v5.ts&quot;&gt;assets directory&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;verifier&quot;&gt;Verifier&lt;&#x2F;h3&gt;
&lt;p&gt;Solidity implementation of a onchain verifier can be found the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7920&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;ExampleVerifier.sol&quot;&gt;assets directory&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;merkle&quot;&gt;Merkle&lt;&#x2F;h3&gt;
&lt;p&gt;Reference Merkle tree can be found in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7920&#x2F;.&#x2F;assets&#x2F;src&#x2F;merkle.ts&quot;&gt;assets directory&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;replay-protection&quot;&gt;Replay Protection&lt;&#x2F;h3&gt;
&lt;p&gt;This ERC focuses on generating composite messages and verifying their signatures. It does not contain mechanisms to prevent replays. Developers &lt;strong&gt;must&lt;&#x2F;strong&gt; ensure their applications can handle receiving the same message twice.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;partial-message-verification&quot;&gt;Partial Message Verification&lt;&#x2F;h3&gt;
&lt;p&gt;During verification, care &lt;strong&gt;must&lt;&#x2F;strong&gt; be taken to ensure that &lt;strong&gt;both&lt;&#x2F;strong&gt; of these checks pass:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;EIP-712 signature on the Merkle root is valid&lt;&#x2F;li&gt;
&lt;li&gt;Merkle proof is valid against the root&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;user-understanding&quot;&gt;User Understanding&lt;&#x2F;h3&gt;
&lt;p&gt;Wallets &lt;strong&gt;must&lt;&#x2F;strong&gt; communicate to users that they are signing multiple messages at once. Wallets &lt;strong&gt;must&lt;&#x2F;strong&gt; display of all message types before signing.&lt;&#x2F;p&gt;
&lt;p&gt;To ensure batch signature requests are digestible, it is recommended to limit the maximum number of messages to 10.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;merkle-tree-construction&quot;&gt;Merkle Tree Construction&lt;&#x2F;h3&gt;
&lt;p&gt;Merkle tree should be constructed in a consistent manner.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The hashing function &lt;strong&gt;must&lt;&#x2F;strong&gt; be &lt;code&gt;keccak256&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;To ensure predictable&#x2F;consistent proof sizes, implementations &lt;strong&gt;must&lt;&#x2F;strong&gt; pad leaves with zero hashes to reach next power of two to ensure balance. Let &lt;code&gt;n&lt;&#x2F;code&gt; be the number of messages. Before constructing the tree, compute the smallest &lt;code&gt;k&lt;&#x2F;code&gt; such that &lt;code&gt;2^(k-1) &amp;lt; n ≤ 2^k&lt;&#x2F;code&gt;. Insert zero hashes into the list of messages until list of messages is equal to &lt;code&gt;2^k&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;To ensure an implicit verification path, pairs &lt;strong&gt;must&lt;&#x2F;strong&gt; be sorted lexicographically before constructing parent hash.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Scaling Ethereum with a Perceptron Tree ZKP</title>
        <published>2025-03-19T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Ryo Ha</name><uri>https://github.com/sopia19910</uri><email>sopia19910@gmail.com</email>
	</author>
	
	<author>
		<name>Khajiev Nizomjon</name><uri>https://github.com/khajievN</uri><email>nizom7812@gmail.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7911/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/improving-blockchain-scalability-using-a-perceptron-tree-based-zero-knowledge-proof-model/23196" />
        

        <id>https://wg-eips.ritovision.com/7911/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7911"
            label="EIP-7911" />
        

        
        

        
        <summary type="html">Improving Ethereum scalability and privacy using Perceptron Trees to compress transaction data via ZKP.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7911/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This project proposes a method to enhance scalability and privacy protection in the Ethereum network using a Perceptron Tree-based Zero-Knowledge Proof (ZKP) model. The Perceptron Tree, a hybrid model combining the strengths of decision trees and perceptron neural networks, provides a compressed representation for transaction relationships, facilitating efficient verification. It addresses specific drawbacks of existing zk-SNARK and zk-STARK methods, consolidating multiple transactions into a single proof to reduce gas fees and decrease on-chain verification load.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The significant increase in blockchain transactions has resulted in scalability limitations and privacy issues. Existing ZKP methods effectively validate individual transactions but fall short in analyzing inter-transaction relationships while maintaining privacy.&lt;&#x2F;p&gt;
&lt;p&gt;ZK-Rollups bundle multiple transactions off-chain into a single proof submitted to the Ethereum mainnet, improving throughput and reducing costs. However, current batching approaches verify transactions individually without leveraging inter-transaction patterns or relationships.&lt;&#x2F;p&gt;
&lt;p&gt;Existing privacy solutions generate separate ZK proofs for each transaction, limiting ZKP&#x27;s full potential. The proposed Perceptron Tree model overcomes these limitations by measuring the similarity among multiple transactions and compressing them into a unified proof, thus broadening ZKP applications.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;1-tree-construction&quot;&gt;1. Tree Construction&lt;&#x2F;h3&gt;
&lt;p&gt;The system inputs a transaction dataset T = {x₁, x₂, ..., xₙ} to construct a recursive tree.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Each node classifies transaction data using a perceptron with a linear function:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;f(x) = step(Wₐ·a + Wᵦ·b + θ)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where the step function is defined as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;step(z) = {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    1, if z ≥ 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    0, if z &amp;lt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7911&#x2F;.&#x2F;assets&#x2F;20250319_203521.png&quot; alt=&quot;Perceptron Tree ZKP Process&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Tree construction recursively partitions nodes based on conditions like homogeneity (isPure) or maximum depth (maxDepth).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7911&#x2F;.&#x2F;assets&#x2F;20250319_203546.png&quot; alt=&quot;Perceptron Tree ZKP Process&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;2-relationship-similarity-calculation&quot;&gt;2. Relationship Similarity Calculation&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;path-similarity&quot;&gt;Path Similarity&lt;&#x2F;h4&gt;
&lt;p&gt;Measures similarity by the ratio of shared paths between two transactions within the tree:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sim_path(xᵢ, xⱼ) = d&#x2F;D&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;d = length of shared path&lt;&#x2F;li&gt;
&lt;li&gt;D = maximum depth of the tree&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7911&#x2F;.&#x2F;assets&#x2F;20250319_203429.png&quot; alt=&quot;Path Similarity Example&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Example: If transactions x₁ and x₂ share only the root node (d=1) in a tree of depth 3, their similarity would be 1&#x2F;3 ≈ 0.33.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;vector-space-similarity&quot;&gt;Vector Space Similarity&lt;&#x2F;h4&gt;
&lt;p&gt;Uses cosine similarity calculated from the feature vectors of each transaction:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sim_cos(xᵢ, xⱼ) = (xᵢ·xⱼ)&#x2F;(‖xᵢ‖‖xⱼ‖)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7911&#x2F;.&#x2F;assets&#x2F;20250319_203500.png&quot; alt=&quot;Vector Similarity Example&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Example: For vectors x₁ = [0.7, 0.8] and x₂ = [0.9, 0.4], the similarity is 0.91.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;3-zkp-proof-generation&quot;&gt;3. ZKP Proof Generation&lt;&#x2F;h3&gt;
&lt;p&gt;The process follows five key steps:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Construct Perceptron Tree&lt;&#x2F;strong&gt;: Build a tree based on transaction set T and train perceptrons at each node.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Calculate Node Commitments&lt;&#x2F;strong&gt;: Compute a commitment value Cₙ for each node n using weights Wₙ, bias bₙ, and hashes of left&#x2F;right child nodes:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Cₙ = H(Wₙ, bₙ, Cₗₑₜₜ, Cᵣᵢₑₕₜ)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Generate Path Proof&lt;&#x2F;strong&gt;: For a specific transaction xᵢ, demonstrate the classification path within the tree.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Prove Similarity Threshold&lt;&#x2F;strong&gt;: Prove that the similarity between two transactions xᵢ and xⱼ exceeds a predefined threshold θ.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Construct Final ZKP Proof&lt;&#x2F;strong&gt;: The final Zero-Knowledge Proof Π includes:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Π = {Cᵣₒₒₜ, path(xᵢ), sim(xᵢ, xⱼ)}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Where Cᵣₒₒₜ is the root commitment, path(xᵢ) is the path proof of xᵢ, and sim(xᵢ, xⱼ) is the similarity proof between transactions.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7911&#x2F;.&#x2F;assets&#x2F;20250319_203626.png&quot; alt=&quot;ZKP Generation Process&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;4-on-chain-verification&quot;&gt;4. On-chain Verification&lt;&#x2F;h3&gt;
&lt;p&gt;Smart contracts verify the submitted proof (Π) by checking:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The Cᵣₒₒₜ commitment matches the pre-registered tree root hash&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The transaction xᵢ is correctly classified along the provided path(xᵢ)&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The similarity between two transactions meets the predefined threshold θ&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The Perceptron Tree-based ZKP model extends the capabilities of existing zero-knowledge proof techniques by incorporating transaction relationships into the proof structure. Traditional zk-SNARK and zk-STARK methods validate individual transactions but do not leverage inter-transaction similarity, which can lead to inefficiencies.&lt;&#x2F;p&gt;
&lt;p&gt;By structuring transactions using a Perceptron Tree, this model enables compression of multiple transactions into a single proof,
reducing gas fees and improving on-chain verification efficiency. The use of a perceptron-based decision structure
ensures adaptability to various transaction patterns, making it a scalable solution for Ethereum.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal operates at the smart contract level, requiring no modifications to the existing Ethereum protocol or consensus algorithm.
It can be implemented alongside existing transaction verification methods, allowing optional adoption without network upgrades.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Privacy Protection&lt;&#x2F;strong&gt;: Verifies transaction validity without revealing specific transaction details.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Tamper Resistance&lt;&#x2F;strong&gt;: Uses commitment values based on tree structures and weights to detect data tampering.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Replay Attack Prevention&lt;&#x2F;strong&gt;: Includes unique transaction IDs in proofs to avoid replay attacks.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Lightweight Verification&lt;&#x2F;strong&gt;: Ensures efficient, simple proof verification operations within smart contracts, minimizing gas fees.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>eth_config JSON-RPC Method</title>
        <published>2025-03-18T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Danno Ferrin</name><uri>https://github.com/shemnon</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7910/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eth-config-json-rpc-method/23183" />
        

        <id>https://wg-eips.ritovision.com/7910/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="interface"
                label="Interface" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7910"
            label="EIP-7910" />
        

        
        

        
        <summary type="html">A JSON-RPC method that describes the configuration of the current and next fork</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7910/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This document describes an RPC method that provides node-relevant configuration data for the current, next, and last known forks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Throughout Ethereum&#x27;s history, there have been multiple instances where a client was not correctly configured for an upcoming hard fork, causing it to fall out of consensus when the fork boundary was crossed. Most incidents have been minor, such as a single client forking the chain in proof-of-work or having its blocks orphaned in proof-of-stake.&lt;&#x2F;p&gt;
&lt;p&gt;The most significant occurrence was during the Pectra activation on the Holešky testnet. Four out of six clients on the network had an incorrect configuration for the deposits contract. Instead of being orphaned, the incorrect chain was justified, and the side effects persist on Holešky even after reaching finality.&lt;&#x2F;p&gt;
&lt;p&gt;By providing an RPC method that allows clients to report key configuration variables before the next hard fork, operations teams can gain greater confidence that clients are correctly configured and prepared for upcoming forks.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;target-audience-and-use-cases&quot;&gt;Target Audience and Use Cases&lt;&#x2F;h3&gt;
&lt;p&gt;This method is intended for node operators, validator teams, and network monitoring tools to verify client readiness for upcoming forks. Use cases include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Automated pre-fork validation scripts comparing &lt;code&gt;eth_config&lt;&#x2F;code&gt; outputs across nodes.&lt;&#x2F;li&gt;
&lt;li&gt;Manual checks by validator operators to ensure alignment with fork specifications.&lt;&#x2F;li&gt;
&lt;li&gt;Debugging by client developers to identify configuration mismatches.&lt;&#x2F;li&gt;
&lt;li&gt;Automated checks by Consensus Layer counterparties.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;Clients MUST expose a new RPC method to report the current functional configuration and the expected next configuration via the standard JSON-RPC port.&lt;&#x2F;p&gt;
&lt;p&gt;Clients MAY also expose this method through the Engine API.&lt;&#x2F;p&gt;
&lt;p&gt;Clients MAY use these configuration objects to manage their per-fork configurations, though they SHOULD NOT simply return unprocessed configuration data.&lt;&#x2F;p&gt;
&lt;p&gt;When reporting the current, next and last configurations, clients MUST include every configuration parameter specified in this EIP.&lt;&#x2F;p&gt;
&lt;p&gt;Clients MUST return up-to-date configuration values, reflecting the most recent block header they provide. If clients cache the configuration, they MUST ensure such caches are purged when fork boundaries are crossed.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;configuration-rpc&quot;&gt;Configuration RPC&lt;&#x2F;h3&gt;
&lt;p&gt;A new JSON-RPC API, &lt;code&gt;eth_config&lt;&#x2F;code&gt;, is introduced. It takes no parameters and returns the result object specified in the next section.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;result-object-structure&quot;&gt;Result Object Structure&lt;&#x2F;h3&gt;
&lt;p&gt;The RPC response contains three members: &quot;current&quot;, &quot;next&quot;, and &quot;last&quot;. These members contain the configuration object currently in effect, the next configuration, and the last known configuration, respectively. &quot;next&quot; and &quot;last&quot; will be &lt;code&gt;null&lt;&#x2F;code&gt; if the client is not configured to support a future fork. &quot;next&quot; and &quot;last&quot; members will contain the same configuration in the case where the next configured fork is also the last configured fork.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;members-of-the-configuration-object&quot;&gt;Members of the Configuration Object&lt;&#x2F;h3&gt;
&lt;p&gt;Each configuration object MUST contain the following members, presented in alphabetical order. This RPC assumes the network is post-merge, and no accommodations are specified for proof-of-work-related issues.&lt;&#x2F;p&gt;
&lt;p&gt;Future forks may add, adjust, remove, or update members. The respective changes MUST be defined in either their EIPs or their respective meta-EIPs. Added members MUST be alphabetically sorted, so simply naming the new members is sufficient definition.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;activationtime&quot;&gt;&lt;code&gt;activationTime&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The fork activation timestamp, represented as a JSON number in Unix epoch seconds (UTC). For the &quot;current&quot; configuration, this reflects the actual activation time; for &quot;next&quot; and &quot;last&quot;, it is the scheduled time.&lt;&#x2F;p&gt;
&lt;p&gt;Activation time is required. If a fork is activated at genesis, the value &lt;code&gt;0&lt;&#x2F;code&gt; is used. If the fork is not scheduled to be activated or its activation time is unknown, it should not be in the RPC results.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;blobschedule&quot;&gt;&lt;code&gt;blobSchedule&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The blob configuration parameters for the specific fork, as defined in the genesis file. This is a JSON object with three members—&lt;code&gt;baseFeeUpdateFraction&lt;&#x2F;code&gt;, &lt;code&gt;max&lt;&#x2F;code&gt;, and &lt;code&gt;target&lt;&#x2F;code&gt;—all represented as JSON numbers.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;chainid&quot;&gt;&lt;code&gt;chainId&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The chain ID of the current network, presented as a string with an unsigned &lt;code&gt;0x&lt;&#x2F;code&gt;-prefixed hexadecimal number, with all leading zeros removed, in lower case. This specification does not support chains without a chain ID or with a chain ID of zero.&lt;&#x2F;p&gt;
&lt;p&gt;For purposes of canonicalization, this value must always be a string.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;forkid&quot;&gt;&lt;code&gt;forkId&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;FORK_HASH&lt;&#x2F;code&gt; value as specified in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6122&#x2F;&quot;&gt;EIP-6122&lt;&#x2F;a&gt; of the specific fork, presented as an unsigned &lt;code&gt;0x&lt;&#x2F;code&gt;-prefixed hexadecimal number, with zeros left-padded to a four-byte length, in lower case.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;precompiles&quot;&gt;&lt;code&gt;precompiles&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;A representation of the active precompile contracts for the fork. If a precompiled contract is replaced by an on-chain contract—or removed—then it is not included.&lt;&#x2F;p&gt;
&lt;p&gt;This is a JSON object where the members are the agreed-upon names for each contract, typically specified in the EIP defining that contract, and the values are the 20-byte &lt;code&gt;0x&lt;&#x2F;code&gt;-prefixed hexadecimal addresses of the precompiles (with zeros preserved), in lower case.&lt;&#x2F;p&gt;
&lt;p&gt;For Cancun, the contract names are (in order): &lt;code&gt;ECREC&lt;&#x2F;code&gt;, &lt;code&gt;SHA256&lt;&#x2F;code&gt;, &lt;code&gt;RIPEMD160&lt;&#x2F;code&gt;, &lt;code&gt;ID&lt;&#x2F;code&gt;, &lt;code&gt;MODEXP&lt;&#x2F;code&gt;, &lt;code&gt;BN254_ADD&lt;&#x2F;code&gt;, &lt;code&gt;BN254_MUL&lt;&#x2F;code&gt;, &lt;code&gt;BN254_PAIRING&lt;&#x2F;code&gt;, &lt;code&gt;BLAKE2F&lt;&#x2F;code&gt;, &lt;code&gt;KZG_POINT_EVALUATION&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;For Prague, the added contracts are (in order): &lt;code&gt;BLS12_G1ADD&lt;&#x2F;code&gt;, &lt;code&gt;BLS12_G1MSM&lt;&#x2F;code&gt;, &lt;code&gt;BLS12_G2ADD&lt;&#x2F;code&gt;, &lt;code&gt;BLS12_G2MSM&lt;&#x2F;code&gt;, &lt;code&gt;BLS12_PAIRING_CHECK&lt;&#x2F;code&gt;, &lt;code&gt;BLS12_MAP_FP_TO_G1&lt;&#x2F;code&gt;, &lt;code&gt;BLS12_MAP_FP2_TO_G2&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;For Osaka, the added contract is: &lt;code&gt;P256VERIFY&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;systemcontracts&quot;&gt;&lt;code&gt;systemContracts&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;A JSON object representing system-level contracts relevant to the fork, as introduced in their defining EIPs. Keys are the contract names (e.g., &lt;code&gt;BEACON_ROOTS_ADDRESS&lt;&#x2F;code&gt;) from the first EIP where they appeared, sorted alphabetically. Values are 20-byte addresses in &lt;code&gt;0x&lt;&#x2F;code&gt;-prefixed hexadecimal form, with leading zeros preserved, in lower case. Omitted for forks before Cancun.&lt;&#x2F;p&gt;
&lt;p&gt;For Cancun, the only system contract is &lt;code&gt;BEACON_ROOTS_ADDRESS&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;For Prague, the system contracts are (in order) &lt;code&gt;BEACON_ROOTS_ADDRESS&lt;&#x2F;code&gt;, &lt;code&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;code&gt;, &lt;code&gt;DEPOSIT_CONTRACT_ADDRESS&lt;&#x2F;code&gt;, &lt;code&gt;HISTORY_STORAGE_ADDRESS&lt;&#x2F;code&gt;, and &lt;code&gt;WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Future forks MUST define the list of system contracts in their meta-EIPs.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;blob-parameter-only-bpo-forks&quot;&gt;Blob Parameter Only (BPO) Forks&lt;&#x2F;h3&gt;
&lt;p&gt;BPO forks should be interpreted as new forks, taking the parent fork as base (recursively, if the parent fork is also a BPO) and updating only the appropriate values in the &lt;code&gt;blobSchedule&lt;&#x2F;code&gt; object to produce the new fork configuration.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-enumerate-precompiles-and-in-general-why-track-a-particular-config-item&quot;&gt;Why Enumerate Precompiles? (And in General, Why Track a Particular Config Item?)&lt;&#x2F;h3&gt;
&lt;p&gt;The purpose of this specification is to enable nodes to advertise, prior to a fork, that they have the correct configurations loaded and ready. Past testnet and Ethereum Mainnet forks have revealed clients with incorrect precompile sets, chain IDs, deposit contract addresses, and other configuration errors.&lt;&#x2F;p&gt;
&lt;p&gt;For precompiles in particular there has been discussion about removing or replacing precompiles in future forks, so a full enumeration of precompiles will reflect removal.&lt;&#x2F;p&gt;
&lt;p&gt;Generally, if a configurable variable or constant causes a client to diverge at a fork—whether on Ethereum Mainnet, a testnet, a devnet, or a public rollup—that variable or constant is a candidate for inclusion in the reportable configuration.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;full-configs-instead-of-deltas&quot;&gt;Full Configs Instead of Deltas&lt;&#x2F;h3&gt;
&lt;p&gt;An initial design considered using a partial configuration for the &quot;next&quot; fork instead of a complete one. However, analysis of past events showed that some parameters causing divergence (e.g., the deposit contract) were introduced in earlier forks, with consensus failures occurring in later forks due to unrelated EIPs relying on those configurations. A partial &quot;next&quot; configuration hash would not have detected such errors.&lt;&#x2F;p&gt;
&lt;p&gt;An alternative—embedding the prior fork’s hash in the next fork—would require defining rules for extracting differences and merging configurations, as well as specifying all prior fork configuration hashes. This would also complicate retroactively adding parameters (e.g., gas schedule constants and variables). The use of config hashes was also removed in a subsequent update.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;nested-vs-flat-variables&quot;&gt;Nested vs. Flat Variables&lt;&#x2F;h3&gt;
&lt;p&gt;Nested structures are easier to read, while flat structures are easier to merge. Since this specification uses full configurations for the current and next forks, merging is unnecessary, making readability the priority.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;serving-data-not-specified-in-genesis-json&quot;&gt;Serving Data Not Specified in genesis.json&lt;&#x2F;h3&gt;
&lt;p&gt;Some reported values are specification-level constants, which many clients do not include in their configuration files. However, certain EIP constants (e.g., the deposit contract) have become variables in testnets, necessitating their inclusion.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;json-as-config-format&quot;&gt;JSON as Config Format&lt;&#x2F;h3&gt;
&lt;p&gt;JSON was chosen for its ubiquity, machine and human readability, and the existence of a standardized canonical form via &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc8785&quot;&gt;RFC-8785&lt;&#x2F;a&gt;. YAML lacks a standard canonical form. No Ethereum software uses XML for configuration, and adopting it would increase every client&#x27;s library size. An invented format would be possible but would require definition and standardization within this specification.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-no-configuration-hash&quot;&gt;Why no configuration hash&lt;&#x2F;h3&gt;
&lt;p&gt;Initial drafts included a hash of the configuration data for quick comparison. There was disagreement about the data format used to generate the hash (plain JSON, RLP, SSZ). Because tooling can effectively diff JSON objects by alphabetizing object keys, the hash is superfluous.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP does not alter previous behavior. Configurations prior to Cancun are non-standard, and clients sharing pre-Cancun configurations will produce non-standard results.&lt;&#x2F;p&gt;
&lt;p&gt;Clients supporting pre-Cancun forks MAY return partial or non-standard configurations but SHOULD strive to follow the spirit of the members specified for Cancun configurations. Full compliance is REQUIRED only for Cancun and later forks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;sample-configs&quot;&gt;Sample Configs&lt;&#x2F;h3&gt;
&lt;p&gt;Hoodi Prague Config&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;activationTime&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1742999832&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;blobSchedule&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;baseFeeUpdateFraction&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 5007716&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;max&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 9&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;target&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x88bb0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;forkId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0929e24e&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;precompiles&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;BLAKE2F&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000009&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;BLS12_G1ADD&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x000000000000000000000000000000000000000b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;BLS12_G1MSM&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x000000000000000000000000000000000000000c&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;BLS12_G2ADD&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x000000000000000000000000000000000000000d&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;BLS12_G2MSM&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x000000000000000000000000000000000000000e&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;BLS12_MAP_FP2_TO_G2&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000011&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;BLS12_MAP_FP_TO_G1&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000010&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;BLS12_PAIRING_CHECK&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x000000000000000000000000000000000000000f&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;BN254_ADD&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000006&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;BN254_MUL&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000007&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;BN254_PAIRING&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000008&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;ECREC&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;ID&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000004&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;KZG_POINT_EVALUATION&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x000000000000000000000000000000000000000a&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;MODEXP&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000005&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;RIPEMD160&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000003&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;SHA256&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000002&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;systemContracts&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;BEACON_ROOTS_ADDRESS&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x000f3df6d732807ef1319fb7b8bb8522d0beac02&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000bbddc7ce488642fb579f8b00f3a590007251&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;DEPOSIT_CONTRACT_ADDRESS&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x00000000219ab540356cbb839cbe05303d7705fa&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;HISTORY_STORAGE_ADDRESS&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000f90827f1c53a10cb7a02335b175320002935&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x00000961ef480eb55e80d19ad83579a64c007002&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Hoodi Cancun Config&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;activationTime&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;blobSchedule&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;baseFeeUpdateFraction&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3338477&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;max&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 6&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;target&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x88bb0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;forkId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xbef71d30&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;precompiles&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;BLAKE2F&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000009&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;BN254_ADD&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000006&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;BN254_MUL&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000007&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;BN254_PAIRING&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000008&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;ECREC&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;ID&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000004&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;KZG_POINT_EVALUATION&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x000000000000000000000000000000000000000a&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;MODEXP&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000005&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;RIPEMD160&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000003&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;SHA256&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000002&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;systemContracts&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;BEACON_ROOTS_ADDRESS&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x000f3df6d732807ef1319fb7b8bb8522d0beac02&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;sample-json-rpc&quot;&gt;Sample JSON-RPC&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;with-future-fork-scheduled&quot;&gt;With Future Fork Scheduled&lt;&#x2F;h5&gt;
&lt;p&gt;The following RPC command, issued on Hoodi when Prague was scheduled but not activated:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;H&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Content-Type: application&#x2F;json&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;-data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{&amp;quot;jsonrpc&amp;quot;:&amp;quot;2.0&amp;quot;,&amp;quot;method&amp;quot;:&amp;quot;eth_config&amp;quot;,&amp;quot;id&amp;quot;:1}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; http:&#x2F;&#x2F;localhost:8545&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;would return (after formatting):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;current&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;activationTime&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;blobSchedule&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;baseFeeUpdateFraction&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3338477&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;max&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 6&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;target&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x88bb0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;forkId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xbef71d30&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;precompiles&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;BLAKE2F&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000009&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;BN254_ADD&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000006&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;BN254_MUL&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000007&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;BN254_PAIRING&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000008&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;ECREC&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;ID&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000004&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;KZG_POINT_EVALUATION&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x000000000000000000000000000000000000000a&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;MODEXP&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000005&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;RIPEMD160&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000003&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;SHA256&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000002&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;systemContracts&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;BEACON_ROOTS_ADDRESS&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x000f3df6d732807ef1319fb7b8bb8522d0beac02&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;next&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;activationTime&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1742999832&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;blobSchedule&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;baseFeeUpdateFraction&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 5007716&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;max&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 9&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;target&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x88bb0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;forkId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0929e24e&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;precompiles&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;BLAKE2F&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000009&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;BLS12_G1ADD&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x000000000000000000000000000000000000000b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;BLS12_G1MSM&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x000000000000000000000000000000000000000c&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;BLS12_G2ADD&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x000000000000000000000000000000000000000d&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;BLS12_G2MSM&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x000000000000000000000000000000000000000e&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;BLS12_MAP_FP2_TO_G2&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000011&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;BLS12_MAP_FP_TO_G1&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000010&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;BLS12_PAIRING_CHECK&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x000000000000000000000000000000000000000f&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;BN254_ADD&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000006&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;BN254_MUL&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000007&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;BN254_PAIRING&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000008&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;ECREC&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;ID&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000004&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;KZG_POINT_EVALUATION&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x000000000000000000000000000000000000000a&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;MODEXP&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000005&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;RIPEMD160&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000003&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;SHA256&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000002&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;systemContracts&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;BEACON_ROOTS_ADDRESS&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x000f3df6d732807ef1319fb7b8bb8522d0beac02&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000bbddc7ce488642fb579f8b00f3a590007251&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;DEPOSIT_CONTRACT_ADDRESS&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x00000000219ab540356cbb839cbe05303d7705fa&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;HISTORY_STORAGE_ADDRESS&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000f90827f1c53a10cb7a02335b175320002935&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x00000961ef480eb55e80d19ad83579a64c007002&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;last&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;activationTime&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1742999832&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;blobSchedule&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;baseFeeUpdateFraction&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 5007716&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;max&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 9&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;target&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x88bb0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;forkId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0929e24e&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;precompiles&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;BLAKE2F&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000009&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;BLS12_G1ADD&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x000000000000000000000000000000000000000b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;BLS12_G1MSM&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x000000000000000000000000000000000000000c&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;BLS12_G2ADD&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x000000000000000000000000000000000000000d&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;BLS12_G2MSM&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x000000000000000000000000000000000000000e&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;BLS12_MAP_FP2_TO_G2&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000011&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;BLS12_MAP_FP_TO_G1&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000010&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;BLS12_PAIRING_CHECK&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x000000000000000000000000000000000000000f&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;BN254_ADD&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000006&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;BN254_MUL&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000007&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;BN254_PAIRING&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000008&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;ECREC&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;ID&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000004&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;KZG_POINT_EVALUATION&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x000000000000000000000000000000000000000a&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;MODEXP&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000005&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;RIPEMD160&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000003&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;SHA256&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000002&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;systemContracts&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;BEACON_ROOTS_ADDRESS&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x000f3df6d732807ef1319fb7b8bb8522d0beac02&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000bbddc7ce488642fb579f8b00f3a590007251&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;DEPOSIT_CONTRACT_ADDRESS&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x00000000219ab540356cbb839cbe05303d7705fa&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;HISTORY_STORAGE_ADDRESS&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000f90827f1c53a10cb7a02335b175320002935&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x00000961ef480eb55e80d19ad83579a64c007002&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;without-future-fork-scheduled&quot;&gt;Without Future Fork Scheduled&lt;&#x2F;h5&gt;
&lt;p&gt;When no future forks are configured, the same RPC command would return:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;current&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;activationTime&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;blobSchedule&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;baseFeeUpdateFraction&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3338477&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;max&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 6&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;target&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x88bb0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;forkId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xbef71d30&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;precompiles&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;BLAKE2F&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000009&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;BN254_ADD&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000006&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;BN254_MUL&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000007&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;BN254_PAIRING&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000008&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;ECREC&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;ID&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000004&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;KZG_POINT_EVALUATION&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x000000000000000000000000000000000000000a&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;MODEXP&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000005&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;RIPEMD160&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000003&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;SHA256&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000002&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;systemContracts&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;BEACON_ROOTS_ADDRESS&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x000f3df6d732807ef1319fb7b8bb8522d0beac02&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;next&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; null&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;last&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; null&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Exposure Risks&lt;&#x2F;strong&gt;: Incorrect configurations could leak operational details. Operators SHOULD restrict &lt;code&gt;eth_config&lt;&#x2F;code&gt; to trusted interfaces (e.g., local access or authenticated endpoints).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Dishonest Nodes&lt;&#x2F;strong&gt;: Clients may report false configurations. Peers or monitoring tools MAY cross-check &lt;code&gt;eth_config&lt;&#x2F;code&gt; outputs against known fork specifications or other nodes&#x27; responses to detect anomalies.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;DDoS Mitigation&lt;&#x2F;strong&gt;: Clients MAY cache configuration objects internally and rate-limit &lt;code&gt;eth_config&lt;&#x2F;code&gt; requests to prevent resource exhaustion. Implementations MAY impose a minimum response interval (e.g., 1 second).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Meter Contract Code Size And Increase Limit</title>
        <published>2025-03-14T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Charles Cooper</name><uri>https://github.com/charles-cooper</uri>
	</author>
	
	<author>
		<name>Qi Zhou</name><uri>https://github.com/qizhou</uri>
	</author>
	
	<author>
		<name>Matt</name><uri>https://github.com/lightclient</uri>
	</author>
	
	<author>
		<name>Dragan Rakita</name><uri>https://github.com/rakita</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7907/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-remove-contract-size-limit/23156" />
        

        <id>https://wg-eips.ritovision.com/7907/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7907"
            label="EIP-7907" />
        

        
        

        
        <summary type="html">Increases the contract code size limit introduced in EIP-170 and adds gas metering to code loading</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7907/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP increases the contract code size limit from 24KB (24576 bytes) introduced in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;170&#x2F;&quot;&gt;EIP-170&lt;&#x2F;a&gt; to 64KB (65536 bytes), and adds gas metering for excess code loading. It introduces a gas cost of 2 gas per (32 byte) word for contract code exceeding 24KB, allowing deployment of contracts of any size while preventing DoS attacks through appropriate gas metering. Lastly, it also commensurately increases initcode size limit from 48KB, introduced in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3860&#x2F;&quot;&gt;EIP-3860&lt;&#x2F;a&gt;, to 128KB (131072 bytes).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;EIP-170 introduced a 24KB contract code size limit to prevent potential DoS attacks, as large contract code requires O(n) resource cost in terms of disk reads, VM preprocessing, and Merkle proof sizes, all of which are not directly compensated by gas fees. However, this limit restricts legitimate use cases for large contracts.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP proposes a gas-based solution that allows contracts of larger size while ensuring that users loading large contracts pay gas proportional to the additional resources they consume. This approach aligns with Ethereum&#x27;s gas model philosophy of paying for the resources consumed. A new limit has been set at 64KB, so that raising the gas limit does not break assumptions in the p2p layer.&lt;&#x2F;p&gt;
&lt;p&gt;Improving developer experience is the primary motivation for increasing the contract size limit. The current 24KB ceiling forces developers to split functionality across multiple contracts, introduce proxies or delegatecall-based indirection, and rely on architectural patterns like the Diamond Standard—even when those patterns aren&#x27;t otherwise necessary. These workarounds can increase code complexity, deployment costs, and audit surface. By raising the limit, developers can keep more logic in a single contract, improving readability and lowering gas usage by avoiding unnecessary cross-contract calls. This also makes smart contract development more accessible to newer developers, who can move from idea to deployment without first learning advanced contract composition patterns.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;COLD_SLOAD_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2100&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The cost charged for cold loading storage as defined by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;WARM_STORAGE_READ_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;100&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The cost charged for loading warm storage as defined by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;COLD_ACCOUNT_ACCESS_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2600&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The cost charged for loading a cold account as defined by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;GAS_PER_CODE_WORD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The cost charged per word of code loaded beyond the initial &lt;code&gt;24KB&lt;&#x2F;code&gt; amount.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FORK_BLKNUM&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;TBD&lt;&#x2F;td&gt;&lt;td&gt;The block number of the hard fork that this EIP is activated.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The following values are updated:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Old Value&lt;&#x2F;th&gt;&lt;th&gt;New Value&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_CODE_SIZE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;24KB (&lt;code&gt;0x6000&lt;&#x2F;code&gt;)&lt;&#x2F;td&gt;&lt;td&gt;64KB (&lt;code&gt;0x10000&lt;&#x2F;code&gt;)&lt;&#x2F;td&gt;&lt;td&gt;The maximum size for code as set in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;170&#x2F;&quot;&gt;EIP-170&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_INITCODE_SIZE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;48KB (&lt;code&gt;0xc000&lt;&#x2F;code&gt;)&lt;&#x2F;td&gt;&lt;td&gt;128KB (&lt;code&gt;0x20000&lt;&#x2F;code&gt;)&lt;&#x2F;td&gt;&lt;td&gt;The maximum size for code as set in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3860&#x2F;&quot;&gt;EIP-3860&lt;&#x2F;a&gt;. Always set at &lt;code&gt;2 * MAX_CODE_SIZE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;helpers&quot;&gt;Helpers&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ceil32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 31&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; excess_code_size&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;6000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;behavior&quot;&gt;Behavior&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;Update the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;170&#x2F;&quot;&gt;EIP-170&lt;&#x2F;a&gt; introduced &lt;code&gt;MAX_CODE_SIZE&lt;&#x2F;code&gt; constant of 24KB (&lt;code&gt;0x6000&lt;&#x2F;code&gt; bytes) to 64KB (&lt;code&gt;0x10000&lt;&#x2F;code&gt; bytes).&lt;&#x2F;li&gt;
&lt;li&gt;Introduces a new cold&#x2F;warm state for contract code. Specifically, change the gas schedule of operations that load code, e.g. the opcodes &lt;code&gt;CALL&lt;&#x2F;code&gt;, &lt;code&gt;STATICCALL&lt;&#x2F;code&gt;, &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;, &lt;code&gt;CALLCODE&lt;&#x2F;code&gt; and &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt; are modified so that dynamic &lt;code&gt;EXCESS_CODE_COST= ceil32(excess_code_size(len(code))) * GAS_PER_CODE_WORD &#x2F;&#x2F; 32&lt;&#x2F;code&gt; gas are added to the access cost if the code is cold. When the code is an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; delegation to another account, if target account code is cold add additional gas should be accounted. Warming of the contract code is subjected to the journaling and can be reverted similar to other state warming in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Update the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3860&#x2F;&quot;&gt;EIP-3860&lt;&#x2F;a&gt; introduced &lt;code&gt;MAX_INITCODE_SIZE&lt;&#x2F;code&gt; limit of 48KB (&lt;code&gt;0xc000&lt;&#x2F;code&gt; bytes) to 128KB (&lt;code&gt;0x10000&lt;&#x2F;code&gt; bytes).&lt;&#x2F;li&gt;
&lt;li&gt;If a large contract is the entry point of a transaction, the cost calculated in (2) is charged before the execution and contract code is marked as warm. This fee is not calculated towards the initial gas fee. In case of out-of-gas halt, execution will stop and the balance will not be transferred.&lt;&#x2F;li&gt;
&lt;li&gt;Empty code ( with &lt;code&gt;keccak(&quot;&quot;) = &quot;0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470&quot;&lt;&#x2F;code&gt;) is always considered warm.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Contract&lt;&#x2F;th&gt;&lt;th&gt;Gas changes (only opcodes that load code)&lt;&#x2F;th&gt;&lt;th&gt;How?&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Cold account and code&lt;&#x2F;td&gt;&lt;td&gt;Add &lt;code&gt;COLD_SLOAD_COST=2100&lt;&#x2F;code&gt;, &lt;code&gt;EXCESS_CODE_COST&lt;&#x2F;code&gt;, and &lt;code&gt;COLD_ACCOUNT_ACCESS_COST=2600&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Contract not in access list nor accessed prior in the txn&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Warm account and cold code&lt;&#x2F;td&gt;&lt;td&gt;Add &lt;code&gt;COLD_SLOAD_COST=2100&lt;&#x2F;code&gt;, &lt;code&gt;EXCESS_CODE_COST&lt;&#x2F;code&gt;, and &lt;code&gt;WARM_STORAGE_READ_COST=100&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Already accessed balance, storage, or included in access list (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930&lt;&#x2F;a&gt;)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Warm account and code&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;WARM_STORAGE_READ_COST=100&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Already accessed account code&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;&lt;code&gt;COLD_ACCOUNT_ACCESS_COST&lt;&#x2F;code&gt;, &lt;code&gt;COLD_SLOAD_COST&lt;&#x2F;code&gt;, and &lt;code&gt;WARM_STORAGE_READ_COST&lt;&#x2F;code&gt; are defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;#parameters&quot;&gt;EIP-2929&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;migration&quot;&gt;Migration&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP adds a new field to the account tuple, &lt;code&gt;codesize&lt;&#x2F;code&gt;. That is, the account tuple goes from having the following four fields, &lt;code&gt;(nonce, balance, storage_root, code_hash)&lt;&#x2F;code&gt; to &lt;code&gt;(nonce, balance, storage_root, code_hash, codesize)&lt;&#x2F;code&gt;. The reason for this is that most key-value databases in use by production clients do not allow peeking at the size of a value pointed to by a given key without actually loading the full contents of the value.&lt;&#x2F;p&gt;
&lt;p&gt;To avoid forcing a full migration, the following rules are followed:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Any account created or updated on or after &lt;code&gt;FORK_BLKNUM&lt;&#x2F;code&gt; should additionally have its codesize written into the account tuple.&lt;&#x2F;li&gt;
&lt;li&gt;Any account which does not have the &lt;code&gt;codesize&lt;&#x2F;code&gt; field is assumed to have codesize less than 24KB.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The gas cost of 2 per word was chosen to account for:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The additional disk I&#x2F;O for retrieving larger contract code&lt;&#x2F;li&gt;
&lt;li&gt;The increased computational resources for preprocessing larger code for execution (a.k.a. &quot;JUMPDEST analysis&quot;).&lt;&#x2F;li&gt;
&lt;li&gt;The growth in Merkle proof sizes for blocks containing larger contracts&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;This EIP introduces the gas cost as an additional cost for contracts exceeding 24KB. It could have been specified as a simpler &lt;code&gt;ceil32(contract_size) * GAS_PER_CODE_WORD &#x2F;&#x2F; 32&lt;&#x2F;code&gt;, without hardcoding the existing contract size limit. However, for the sake of being conservative and avoiding lowering the cost of loading existing contracts (which could be small, under the 24KB limit), the 24KB floor was added to the formula.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt; opcode could theoretically be exempt from this, since clients could just load the parts of the bytecode which are actually requested. However, this might require a change at the protocol level, since the full code is required for the block witness. For this reason, &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt; is included in the pricing scheme, and a carveout could be considered at a later date.&lt;&#x2F;p&gt;
&lt;p&gt;The new limit has been set at 64KB. The limit has been put in place so that increasing the gas limit won&#x27;t have unexpected side effects at the db or p2p layer. For instance, in devp2p, the maximum packet size is 10MB (&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;devp2p&#x2F;blob&#x2F;5713591d0366da78a913a811c7502d9ca91d29a8&#x2F;caps&#x2F;eth.md#basic-operation&quot;&gt;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;devp2p&#x2F;blob&#x2F;5713591d0366da78a913a811c7502d9ca91d29a8&#x2F;caps&#x2F;eth.md#basic-operation&lt;&#x2F;a&gt;). As of time of this writing, the maximum packet size in snap sync is even lower, at 96KB.&lt;&#x2F;p&gt;
&lt;p&gt;The limit for initcode has also been increased to 128KB, following the pattern set in EIP-3860 that the initcode limit is double the runtime code limit. While initcode is different from deployed code in that it does not live in the state and therefore isn&#x27;t visible in devp2p or in the db, fully removing the limit could have unforeseen consequences.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces additional gas costs for certain operations. Specifically, &lt;code&gt;CALL&lt;&#x2F;code&gt;, &lt;code&gt;STATICCALL&lt;&#x2F;code&gt;, &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;, &lt;code&gt;CALLCODE&lt;&#x2F;code&gt;, &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt;, and &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt; may now require extra gas when accessing cold contract code.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>HD wallet In Treasury Management</title>
        <published>2025-03-07T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Xiaoyu Liu</name><uri>https://github.com/elizabethxiaoyu</uri><email>jiushi.lxy@antgroup.com</email>
	</author>
	
	<author>
		<name>Yuxiang Fu</name><uri>https://github.com/tmac4096</uri><email>kunfu.fyx@antgroup.com</email>
	</author>
	
	<author>
		<name>Yanyi Liang</name><email>eason.lyy@antgroup.com</email>
	</author>
	
	<author>
		<name>Hao Zou</name><uri>https://github.com/BruceZH0915</uri><email>situ.zh@antgroup.com</email>
	</author>
	
	<author>
		<name>Siyuan Zheng</name><uri>https://github.com/andrewcoder666</uri><email>zhengsiyuan.zsy@antgroup.com</email>
	</author>
	
	<author>
		<name>yuanshanhshan</name><uri>https://github.com/xunayuan</uri><email>yuanshanshan.yss@antgroup.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7908/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/new-erc-deterministic-account-hierarchy-in-treasury-management/23073" />
        

        <id>https://wg-eips.ritovision.com/7908/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7908"
            label="ERC-7908" />
        

        
        

        
        <summary type="html">Hierarchical deterministic (HD) wallets for treasury systems, isolating entities via cryptographic key paths.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7908/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal aims to provide a standardized method for on-chain treasury management of institutional assets, ensuring secure private key generation, hierarchical management, and departmental permission isolation while supporting asset security and transaction efficiency in multi-chain environments. By defining a unified derivation path and security mechanisms, this proposal offers an efficient and secure solution for treasury management.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;With the rapid development of blockchain and DeFi, secure management of on-chain assets has become critical. Traditional private key management struggles to meet the security demands of large organizations in complex scenarios, where hierarchical key management, permission controls, and multi-signature mechanisms are essential. This proposal provides a standardized solution for institutional treasury management, ensuring asset security and transaction efficiency.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc2119&quot;&gt;RFC 2119&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc8174&quot;&gt;RFC 8174&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;derivation-path&quot;&gt;Derivation Path&lt;&#x2F;h3&gt;
&lt;p&gt;For secure on-chain treasury account key management, implementations MUST use the following hierarchical
deterministic (HD) path:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;latex&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;m&#x2F;44&amp;#39;&#x2F;60&amp;#39;&#x2F;entity_id&amp;#39; &#x2F; department_id&amp;#39; &#x2F; account_index&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Path Components:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Master Key (&lt;&#x2F;strong&gt;&lt;code&gt;m&lt;&#x2F;code&gt;&lt;strong&gt;)&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;SHALL represent the root HD wallet private key.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;bitcoin&#x2F;bips&#x2F;blob&#x2F;0278bf3d7111bab8f0ef8dd08f16fd7b5ac6cbd6&#x2F;bip-0044.mediawiki&quot;&gt;BIP 44&lt;&#x2F;a&gt; Compliance Layer (&lt;code&gt;44&#x27;&lt;&#x2F;code&gt;)&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;MUST use &lt;code&gt;44&#x27;&lt;&#x2F;code&gt; (hardened) to indicate BIP 44 compliance.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Coin Type Layer ( &lt;code&gt;60&#x27;&lt;&#x2F;code&gt; )&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;SHALL use &lt;code&gt;60&#x27;&lt;&#x2F;code&gt; (hardened) for Ethereum and EVM-compatible chains.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Entity Identifier ( &lt;code&gt;entity_id&#x27;&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;)&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;MUST be derived by hashing the subsidiary name into a hardened index.&lt;&#x2F;li&gt;
&lt;li&gt;MUST NOT reuse the same &lt;code&gt;entity_id&#x27;&lt;&#x2F;code&gt; across distinct subsidiaries.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Department Identifier (&lt;&#x2F;strong&gt;&lt;code&gt;department_id&#x27;&lt;&#x2F;code&gt;&lt;strong&gt;)&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;SHALL be derived by hashing the department name into a hardened index.&lt;&#x2F;li&gt;
&lt;li&gt;MUST isolate keys between departments via hardened derivation.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Account Index (&lt;&#x2F;strong&gt;&lt;code&gt;account_index&lt;&#x2F;code&gt;&lt;strong&gt;)&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;MUST use non-hardened derivation to allow unified account management.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;strong&gt;Note on BIP 44 Adaptation&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The BIP 44 &lt;code&gt;change&lt;&#x2F;code&gt; layer SHOULD be omitted for Ethereum&#x2F;EVMs due to their account model (not UTXO).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;hash-conversion&quot;&gt;Hash Conversion&lt;&#x2F;h3&gt;
&lt;p&gt;To derive &lt;code&gt;entity_id&lt;&#x2F;code&gt; and &lt;code&gt;department_id&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Entity Index Calculation&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;SHALL compute &lt;code&gt;entity_id&lt;&#x2F;code&gt; as:&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;entity_hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sha256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ENTITY:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;{&lt;&#x2F;span&gt;&lt;span&gt;entity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;digest&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;entity_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;entity_hash&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;big&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;80000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;   #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 2^31 ≤ index &amp;lt; 2^32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ol start=&quot;2&quot;&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Department Index Calculation&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;MUST compute &lt;code&gt;department_id&lt;&#x2F;code&gt; as:&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dept_hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sha256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;DEPT:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;{&lt;&#x2F;span&gt;&lt;span&gt;entity_hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;{&lt;&#x2F;span&gt;&lt;span&gt;department&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;digest&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dept_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;dept_hash&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;big&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;80000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;   #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 2^31 ≤ index &amp;lt; 2^32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ol start=&quot;3&quot;&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Output Constraints&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Generated indices MUST be integers in &lt;code&gt;[2^31, 2^32-1]&lt;&#x2F;code&gt; to enforce hardened derivation.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;extended-path-for-role-based-access&quot;&gt;Extended Path for Role-Based Access&lt;&#x2F;h3&gt;
&lt;p&gt;For finer access control (e.g., roles within departments):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;latex&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;m&#x2F;60&amp;#39;&#x2F;entity_id&amp;#39; &#x2F; department_id&amp;#39; &#x2F;role_id&amp;#39;&#x2F; account_index&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Role Identifier (&lt;&#x2F;strong&gt;&lt;code&gt;role_id&#x27;&lt;&#x2F;code&gt;&lt;strong&gt;)&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;SHOULD use hardened derivation to isolate role-specific keys.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;strong&gt;Compatibility Note&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Omitting the &lt;code&gt;44&#x27;&lt;&#x2F;code&gt; layer MAY cause incompatibility with standard wallets (e.g., MetaMask).&lt;&#x2F;li&gt;
&lt;li&gt;Integrations with such wallets MUST implement custom plugins to handle this deviation.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;simplified-path-for-smaller-entities&quot;&gt;Simplified Path for Smaller Entities&lt;&#x2F;h3&gt;
&lt;p&gt;For entities without subsidiaries:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;latex&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;m&#x2F;44&amp;#39;&#x2F;60&amp;#39; &#x2F; department_id&amp;#39; &#x2F;0&#x2F; account_index&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Compatibility Guarantee&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;This structure SHOULD ensure compatibility with mainstream BIP 44 wallets.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;key-derivation-algorithm&quot;&gt;Key Derivation Algorithm&lt;&#x2F;h3&gt;
&lt;p&gt;Implementations MUST adhere to:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;latex&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;E = Map&amp;lt;entity, List&amp;lt;Department&amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;n = Layer2 curve order&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;path = m&#x2F;44&amp;#39;&#x2F;60&amp;#39;&#x2F;entity_id&amp;#39; &#x2F; department_id&amp;#39; &#x2F; account_index&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;BIP32() = Official BIP-0032 derivation function on secp256k1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;hash = SHA256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;root_key = BIP32(path)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;for each E:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	key = hash(root_key|hierarchical_hash_to_index(entity,department))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	return key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Cryptographic Requirements&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;SHALL use &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;bitcoin&#x2F;bips&#x2F;blob&#x2F;86b29c5d81c755133114486c19a271c34087fc81&#x2F;bip-0032.mediawiki&quot;&gt;BIP 32&lt;&#x2F;a&gt; with &lt;code&gt;secp256k1&lt;&#x2F;code&gt; for HD derivation.&lt;&#x2F;li&gt;
&lt;li&gt;MUST concatenate hashes with root keys to prevent cross-layer key leakage.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;compatibility-considerations&quot;&gt;&lt;strong&gt;Compatibility Considerations&lt;&#x2F;strong&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;This specification is inspired by BIP 44 (&lt;code&gt;m&#x2F;purpose&#x27;&#x2F;coin_type&#x27;&#x2F;account&#x27;&#x2F;change&#x2F;address_index&lt;&#x2F;code&gt;), but:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;SHALL NOT use the &lt;code&gt;change&lt;&#x2F;code&gt; layer for Ethereum-based systems.&lt;&#x2F;li&gt;
&lt;li&gt;MAY extend the hierarchy beyond BIP 44’s 5-layer structure for organizational needs.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The scenarios for which the proposal applies are:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Company and Department Isolation&lt;&#x2F;strong&gt;: Different subsidiaries within the group, as well as different departments within each subsidiary, can create isolated on-chain accounts. Enhanced derivation is used to isolate exposure risks.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Group Unified Management Authority&lt;&#x2F;strong&gt;: The group administrator holds the master private key, which can derive all subsidiary private keys, granting the highest authority to view and initiate transactions across the entire group, facilitating unified management by the group administrator.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Shared Department Private Key&lt;&#x2F;strong&gt;: If subsidiary A&#x27;s administrator, Alice, needs to share accounts under subsidiary A with a new administrator, Bob, she only needs to share the master private key of subsidiary A. Accounts from various departments can then be derived from this key.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Shared Audit Public Key&lt;&#x2F;strong&gt;: If the audit department needs to audit transactions under a specific department, the extended public key of the specified department can be shared with the audit department. Through this extended public key, all subordinate public keys under the department can be derived, allowing the audit department to track all transactions associated with these public key addresses.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This standard complies with BIP 39, BIP 32, and BIP 44.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;Secure Treasury Management System&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;Enterprise-grade hierarchical deterministic wallet implementation compliant with BIP-44&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; hashlib&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; logging&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt; typing&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; import&lt;&#x2F;span&gt;&lt;span&gt; Tuple&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Dict&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt; bip32utils&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; import&lt;&#x2F;span&gt;&lt;span&gt; BIP32Key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt; eth_account&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; import&lt;&#x2F;span&gt;&lt;span&gt; Account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt; mnemonic&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; import&lt;&#x2F;span&gt;&lt;span&gt; Mnemonic&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Add BIP39 support&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Configure logging&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;logging&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;basicConfig&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;level&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;logging&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;INFO&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;logger&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; logging&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;getLogger&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;TreasurySystem&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TreasurySystem&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; __init__&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; mnemonic&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; str&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        Initialize the treasury system&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        :param mnemonic: BIP-39 mnemonic (12&#x2F;24 words)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; Mnemonic&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;english&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;check&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;mnemonic&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            raise&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; ValueError&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Invalid BIP-39 mnemonic&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Generate seed using standard BIP-39&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;seed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Mnemonic&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;to_seed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;mnemonic&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; passphrase&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;root_key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; BIP32Key&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;fromEntropy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;seed&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        logger&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;info&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Treasury system initialized. Master key fingerprint: &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;%s&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;                  self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;root_key&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;Fingerprint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;hex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    @&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;staticmethod&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _hierarchical_hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;entity&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; str&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; department&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; str&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Tuple&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        Hierarchical hash calculation (compliant with proposal spec)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        Returns: (entity_index, department_index)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Entity hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        entity_hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; hashlib&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sha256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ENTITY:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;{&lt;&#x2F;span&gt;&lt;span&gt;entity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;digest&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        entity_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;entity_hash&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;big&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;80000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Department hash (chained)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        dept_input&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;DEPT:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;{&lt;&#x2F;span&gt;&lt;span&gt;entity_hash&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;hex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;{&lt;&#x2F;span&gt;&lt;span&gt;department&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        dept_hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; hashlib&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sha256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;dept_input&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;digest&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        dept_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;dept_hash&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;big&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;80000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; entity_index&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; dept_index&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _derive_key&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; path&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; list&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; BIP32Key&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;General key derivation method&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        current_key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;root_key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; path&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; isinstance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                raise&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; TypeError&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Invalid derivation index type: &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            current_key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; current_key&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;ChildKey&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; current_key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; generate_account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; entity&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; str&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; department&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; str&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;                        account_idx&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Dict&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;str&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; str&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        Generate department account (BIP44 5-layer structure)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        Path: m&#x2F;44&amp;#39;&#x2F;60&amp;#39;&#x2F;entity&amp;#39;&#x2F;dept&amp;#39;&#x2F;account_idx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        e_idx&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; d_idx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_hierarchical_hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;entity&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; department&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; BIP-44 standard path&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        derivation_path&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;8000002C&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 44&amp;#39; (hardened)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;8000003C&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 60&amp;#39; (Ethereum)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            e_idx&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;       #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; entity_index (hardened)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            d_idx&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;       #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; department_index (hardened)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            account_idx&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address index&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_derive_key&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;derivation_path&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        priv_key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;PrivateKey&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;hex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;            &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;path&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;m&#x2F;44&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;#39;&#x2F;60&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;#39;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;{&lt;&#x2F;span&gt;&lt;span&gt;e_idx&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;#39;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;{&lt;&#x2F;span&gt;&lt;span&gt;d_idx&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;#39;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;{&lt;&#x2F;span&gt;&lt;span&gt;account_idx&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;            &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;private_key&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; priv_key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Warning: Never expose this in production&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;            &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_key&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;priv_key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_audit_xpub&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; entity&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; str&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; department&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; str&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; str&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        Retrieve department-level extended public key (for auditing)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        Path: m&#x2F;44&amp;#39;&#x2F;60&amp;#39;&#x2F;entity&amp;#39;&#x2F;dept&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        e_idx&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; d_idx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_hierarchical_hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;entity&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; department&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        path&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;8000002C&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 44&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;8000003C&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 60&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            e_idx&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;       #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; entity&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            d_idx&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; dept&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_derive_key&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;path&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;ExtendedKey&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_dept_xprv&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; entity&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; str&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; department&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; str&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; str&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        Get department-level extended private key (strictly controlled)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        Path: m&#x2F;44&amp;#39;&#x2F;60&amp;#39;&#x2F;entity&amp;#39;&#x2F;dept&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        e_idx&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; d_idx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_hierarchical_hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;entity&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; department&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        path&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;8000002C&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 44&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;8000003C&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 60&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            e_idx&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;       #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; entity&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            d_idx&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; dept&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_derive_key&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;path&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;ExtendedKey&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    @&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;staticmethod&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; derive_addresses_from_xpub&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;xpub&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; str&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; count&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; list&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Derive addresses from extended public key (audit use)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        audit_key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; BIP32Key&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;fromExtendedKey&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;xpub&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            Account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_key&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                audit_key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        .&lt;&#x2F;span&gt;&lt;span&gt;ChildKey&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;   #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address index&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        .&lt;&#x2F;span&gt;&lt;span&gt;PrivateKey&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;count&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt; __name__&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;__main__&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Example usage (remove private key printing in production)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    try&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Use standard mnemonic&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        mnemo&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Mnemonic&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;english&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        mnemonic&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; mnemo&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;generate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;strength&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        treasury&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; TreasurySystem&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;mnemonic&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        print&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;mnemonic: &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;{&lt;&#x2F;span&gt;&lt;span&gt;mnemonic&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        print&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;=== Finance Department Account Generation ===&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        finance_acc1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; treasury&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;generate_account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;GroupA&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Finance&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        finance_acc2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; treasury&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;generate_account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;GroupA&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Finance&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        print&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Account1 path: &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;{&lt;&#x2F;span&gt;&lt;span&gt;finance_acc1&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;path&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        print&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Account1 address: &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;{&lt;&#x2F;span&gt;&lt;span&gt;finance_acc1&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        print&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Account1 private key: &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;{&lt;&#x2F;span&gt;&lt;span&gt;finance_acc1&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;private_key&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        print&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Account2 path: &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;{&lt;&#x2F;span&gt;&lt;span&gt;finance_acc2&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;path&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        print&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Account2 address: &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;{&lt;&#x2F;span&gt;&lt;span&gt;finance_acc2&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        print&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Account2 private key: &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;{&lt;&#x2F;span&gt;&lt;span&gt;finance_acc2&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;private_key&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        print&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;=== Audit Verification Test===&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        audit_xpub&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; treasury&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get_audit_xpub&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;GroupA&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Finance&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        print&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Audit xpub: &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;{&lt;&#x2F;span&gt;&lt;span&gt;audit_xpub&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        audit_addresses&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; TreasurySystem&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;derive_addresses_from_xpub&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;audit_xpub&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        print&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Audit-derived addresses: &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;{&lt;&#x2F;span&gt;&lt;span&gt;audit_addresses&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span&gt; finance_acc1&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; audit_addresses&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Audit verification failed&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span&gt; finance_acc2&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; audit_addresses&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Audit verification failed&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        print&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;✅ Audit verification successful&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        print&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;=== Department Isolation Test ===&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        other_dept_acc&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; treasury&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;generate_account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;GroupA&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Audit&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        print&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Account3 path: &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;{&lt;&#x2F;span&gt;&lt;span&gt;other_dept_acc&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;path&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        print&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Account3 address: &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;{&lt;&#x2F;span&gt;&lt;span&gt;other_dept_acc&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span&gt; other_dept_acc&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; audit_addresses&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Isolation breach&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        print&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;✅ Department isolation effective&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        print&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;=== Department Private Key Sharing Test ===&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Gets the department layer extension private key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        dept_xprv&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; treasury&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get_audit_xpub&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;GroupA&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Finance&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;replace&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;xpub&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;xprv&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 实际应通过专用方法获取&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        print&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Fiance xprv: &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;{&lt;&#x2F;span&gt;&lt;span&gt;dept_xprv&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Derive the account private key from the extension private key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        dept_key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; BIP32Key&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;fromExtendedKey&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;dept_xprv&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        derived_acc0_key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; dept_key&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;ChildKey&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;PrivateKey&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;hex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        derived_acc1_key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; dept_key&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;ChildKey&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;PrivateKey&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;hex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        print&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Fiance derived_acc0_key: &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;{&lt;&#x2F;span&gt;&lt;span&gt;derived_acc0_key&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        print&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Fiance derived_acc1_key: &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;{&lt;&#x2F;span&gt;&lt;span&gt;derived_acc1_key&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify the private key derivation capability&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span&gt; derived_acc0_key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; finance_acc1&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;private_key&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Account 0 private key derivation failed&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span&gt; derived_acc1_key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; finance_acc2&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;private_key&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Account 1 private key derivation failed&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        print&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;✅ Private key derivation from department xprv successful&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    except&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; Exception&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; as&lt;&#x2F;span&gt;&lt;span&gt; e&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        logger&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;error&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;System error: &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;%s&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; exc_info&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;True&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;run script:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;pip&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; install&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; bip32utils&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; eth_account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;python&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; stms.py&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;output：&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7908&#x2F;.&#x2F;assets&#x2F;img.png&quot; alt=&quot;&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;For treasury managers, hierarchical deterministic wallet management is more convenient, but it requires additional consideration of protective measures for the master key, such as schemes for splitting and storing mnemonic phrases or master keys.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Remove Initcode Size Limit</title>
        <published>2025-03-05T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Charles Cooper</name><uri>https://github.com/charles-cooper</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7903/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/remove-initcode-size-limit/23066" />
        

        <id>https://wg-eips.ritovision.com/7903/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7903"
            label="EIP-7903" />
        

        
        

        
        <summary type="html">Removes the initcode size limit introduced in EIP-3860</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7903/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes the removal of the &lt;code&gt;initcode&lt;&#x2F;code&gt; size limit of 49152 bytes introduced in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3860&#x2F;&quot;&gt;EIP-3860&lt;&#x2F;a&gt;. The restriction complicates deploying multiple contracts addressing the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;170&#x2F;&quot;&gt;EIP-170&lt;&#x2F;a&gt; limit (24576 bytes) within a single transaction, while the existing gas metering for &lt;code&gt;initcode&lt;&#x2F;code&gt;, already ensures fair &lt;code&gt;initcode&lt;&#x2F;code&gt; costing, including for &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; analysis.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The EIP-3860 &lt;code&gt;initcode&lt;&#x2F;code&gt; size limit imposes an unnecessary constraint on deployment patterns, particularly for creation transactions creating large &lt;em&gt;logical&lt;&#x2F;em&gt; contracts composed of multiple &lt;em&gt;physical sub-contracts&lt;&#x2F;em&gt; in a single transaction.
A key argument for retaining EIP-170&#x27;s 24KB runtime code limit is that high-level languages (HLLs) should abstract it away.
However, the EIP-3860 limit prevents HLLs from cleanly abstracting this, as deploying large logical contracts exceeding 49152 bytes of &lt;code&gt;initcode&lt;&#x2F;code&gt; requires splitting into multiple transactions, undermining the abstraction.&lt;&#x2F;p&gt;
&lt;p&gt;Removing the cap simplifies smart contract deployment and enables HLLs to cleanly abstract large contracts, without compromising network security or cost attribution.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Revert the &lt;code&gt;initcode&lt;&#x2F;code&gt; size limit introduced in EIP-3860. Specifically:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Remove the 49152-byte cap on &lt;code&gt;initcode&lt;&#x2F;code&gt; size during contract creation.&lt;&#x2F;li&gt;
&lt;li&gt;Retain existing gas costs for &lt;code&gt;initcode&lt;&#x2F;code&gt; execution, including the 2 gas per byte for &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; analysis, as defined in EIP-3860.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;No changes to deployed contract size limits (EIP-170) or gas schedules beyond removing the size restriction are proposed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal is driven by the need to restore flexibility in contract deployment patterns, such as factory contracts creating multiple sub-contracts in one transaction. The design decision to remove the 49152-byte cap leverages the pre-existing gas metering system, which scales linearly with &lt;code&gt;initcode&lt;&#x2F;code&gt; size (i.e., 2 gas per byte), ensuring fair cost attribution without artificial limits.&lt;&#x2F;p&gt;
&lt;p&gt;A key justification for EIP-170&#x27;s 24576-byte limit is that high-level languages (HLLs) should abstract it away. However, EIP-3860&#x27;s &lt;code&gt;initcode&lt;&#x2F;code&gt; cap undermines this by forcing multi-transaction deployments for large contracts, breaking the abstraction HLLs aim to provide. Removing the cap aligns with this philosophy by enabling single-transaction deployments.&lt;&#x2F;p&gt;
&lt;p&gt;Alternative designs, such as increasing the cap (e.g., to 98304 bytes), were considered but rejected as arbitrary; gas metering already mitigates resource concerns. The per-block gas limit already naturally restricts &lt;code&gt;initcode&lt;&#x2F;code&gt; (at the current gas limit of 35 million, &lt;code&gt;initcode&lt;&#x2F;code&gt; is restricted to ~16mb). Furthermore, initcode has additional implied costs - it must have already been paid for via calldata or memory expansion, limiting it even more.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change is fully backwards compatible. Existing contracts and transactions remain unaffected, as the proposal only lifts a restriction without altering execution semantics or gas costs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;No new security risks are introduced. The current gas schedule already mitigates denial-of-service concerns by charging per-byte for &lt;code&gt;initcode&lt;&#x2F;code&gt;. Benchmarks were performed, and ns&#x2F;byte remained consistent across a range of different bytecodes, ranging from 128 bytes to 15MB.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via CC0.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Uncouple execution payload from beacon block</title>
        <published>2025-03-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Gajinder Singh</name><uri>https://github.com/g11tech</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7898/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/uncouple-execution-payload-from-beacon-block/23029" />
        

        <id>https://wg-eips.ritovision.com/7898/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7898"
            label="EIP-7898" />
        

        
        

        
        <summary type="html">Separates the execution payload from beacon block to independently transmit them</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7898/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, the beacon block in Ethereum Consensus embeds transactions within the &lt;code&gt;ExecutionPayload&lt;&#x2F;code&gt; field of &lt;code&gt;BeaconBlockBody&lt;&#x2F;code&gt;. This EIP proposes to replace &lt;code&gt;ExecutionPayload&lt;&#x2F;code&gt; with &lt;code&gt;ExecutionPayloadHeader&lt;&#x2F;code&gt; in &lt;code&gt;BeaconBlockBody&lt;&#x2F;code&gt; and to independently transmit &lt;code&gt;ExecutionPayloadWithInclusionProof&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;However, this EIP makes no change to the block import mechanism, with the exception that block availability now includes waiting for the availability of &lt;code&gt;ExecutionPayloadWithInclusionProof&lt;&#x2F;code&gt;, making it different and simpler from proposals like ePBS&#x2F;APS.&lt;&#x2F;p&gt;
&lt;p&gt;But this availability requirement can in fact be restricted to &lt;code&gt;gossip&lt;&#x2F;code&gt; import while allowing optimistic syncing of the execution layer (EL) on checkpoint&#x2F;range sync as EL can pull full blocks from their peers in optimistic sync as they do now.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The Ethereum protocol has an ambitious goal to grow the &lt;code&gt;gasLimit&lt;&#x2F;code&gt; of the execution payloads (possibly by 10X). This leads to larger messages, negatively affecting the networking and block processing pipelines of the consensus layer (CL) clients leading to following issues:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Higher latencies for the arrival of beacon blocks increase, requiring larger bandwidth resources to be made available for the beacon node.&lt;&#x2F;li&gt;
&lt;li&gt;The greater number and size of transactions directly increase the merkelization compute time, increasing the import time of the block.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;We know from timing games that the block import latency greatly affects a client&#x27;s performance to make correct head attestations. With this EIP, block transmission and block import processes will be decongested, allowing for greater flexibility in receiving a larger &lt;code&gt;ExecutionPayloadWithInclusionProof&lt;&#x2F;code&gt;, while the beacon block can simultaneously undergo processing.&lt;&#x2F;p&gt;
&lt;p&gt;In addition, EL clients can also independently participate in forwarding and receiving larger execution blocks. That mechanism however can be independently developed and is out of scope for this EIP.&lt;&#x2F;p&gt;
&lt;p&gt;Additional benefits obtained from this EIP:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Consensus clients don&#x27;t need to store and serve blocks with transactions, providing greater efficiency and reduced resource requirements for running a beacon node.&lt;&#x2F;li&gt;
&lt;li&gt;The proposer-builder separation (PBS) pipeline becomes more efficient by the proposer transmitting the signed block directly to the p2p network, while submitting to the builder&#x2F;relay for the independent reveal of the &lt;code&gt;ExecutionPayloadWithInclusionProof&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;In the future with zero-knowledge (ZK) proof of the EL block execution, nodes could treat the transactions similarly to blobs which leverage data availability sampling (DAS) mechanisms for available data without requiring re-execution of transactions to establish validity. Hence the L1 execution could itself become a rollup by alleviating the need to import all transaction data by a node.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Furthermore CL clients apis and code path will become cleaner and more maintainable because of collapse of blinded and full versions (like &lt;code&gt;BlindedBeaconBlock&lt;&#x2F;code&gt;, &lt;code&gt;BlindedBeaconBlockBody&lt;&#x2F;code&gt;) into same types.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ExecutionPayload&lt;&#x2F;code&gt; in the &lt;code&gt;BeaconBlockBody&lt;&#x2F;code&gt; is replaced by &lt;code&gt;ExecutionPayloadHeader&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ExecutionPayloadWithInclusionProof&lt;&#x2F;code&gt; is computed by the block proposer&#x2F;builder and gossiped independently on a separate new topic. Also builder &lt;code&gt;submitBlindedBlock&lt;&#x2F;code&gt; api is modified to respond with &lt;code&gt;ExecutionPayloadWithInclusionProof&lt;&#x2F;code&gt; instead.&lt;&#x2F;li&gt;
&lt;li&gt;Data availability checks for block import into forkchoice now must wait for availability of the corresponding &lt;code&gt;ExecutionPayloadWithInclusionProof&lt;&#x2F;code&gt; but only for gossiped blocks&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;newPayloadHeader&lt;&#x2F;code&gt; engine api is introduced to augment the previous usage of &lt;code&gt;newPayload&lt;&#x2F;code&gt; in block processing when &lt;code&gt;ExecutionPayload&lt;&#x2F;code&gt; is not available for e.g. in processing range synced blocks signaling EL clients to optimistic sync those payloads from EL p2p network.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;ELs can optionally introduce a &lt;code&gt;getExecutionPayload&lt;&#x2F;code&gt; method (similar to &lt;code&gt;getBlobs&lt;&#x2F;code&gt;) to assist with faster recovery of execution payload from the EL&#x27;s p2p network peers who could announce new payload hashes when they see new &lt;code&gt;VALID&lt;&#x2F;code&gt; payloads. However, as noted above, that mechanism could be independently specified and is out of scope for this EIP.&lt;&#x2F;p&gt;
&lt;p&gt;&amp;lt;-- TODO: add spec details --&amp;gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;There is another choice we could have made to go for &lt;code&gt;SignedExecutionPayload&lt;&#x2F;code&gt; instead of &lt;code&gt;ExecutionPayloadWithInclusionProof&lt;&#x2F;code&gt; and having a &lt;code&gt;SignedExecutionPayloadHeader&lt;&#x2F;code&gt; with builder signing these messages (validator is the builder in local block building). But without builder enshrinement tight gossip validation of &lt;code&gt;SignedExecutionPayload&lt;&#x2F;code&gt; would be an issue and could become a DOS vector.&lt;&#x2F;p&gt;
&lt;p&gt;The benefit of &lt;code&gt;SignedExecutionPayload&lt;&#x2F;code&gt; design is that it could be transmitted ahead of even the &lt;code&gt;SignedExecutionPayloadHeader&lt;&#x2F;code&gt; inclusion in beacon block and is especially useful in PBS pipeline where the proposal to builder&#x2F;relay latency can be reduced significantly.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change isn&#x27;t backward compatible and a new hardfork is required to activate this EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;&amp;lt;-- TODO --&amp;gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;&amp;lt;-- TODO --&amp;gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;&amp;lt;-- TODO --&amp;gt;&lt;&#x2F;p&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Wallet Capabilities for Account Abstraction</title>
        <published>2025-03-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Yoav Weiss</name><uri>https://github.com/yoavw</uri>
	</author>
	
	<author>
		<name>Alex Forshtat</name><uri>https://github.com/forshtat</uri>
	</author>
	
	<author>
		<name>Dror Tirosh</name><uri>https://github.com/drortirosh</uri>
	</author>
	
	<author>
		<name>Shahaf Nacson</name><uri>https://github.com/shahafn</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7902/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-wallet-capabilities-for-account-abstraction/23122" />
        

        <id>https://wg-eips.ritovision.com/7902/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7902"
            label="ERC-7902" />
        

        
        

        
        <summary type="html">EIP-5792 Capabilities allowing dApps and wallets to exchange all AA specific UserOp fields</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7902/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5792&#x2F;&quot;&gt;EIP-5792&lt;&#x2F;a&gt; defines a baseline JSON-RPC API for a communication between wallets and dapps,
and provides an ability to extend the base protocol with &quot;capabilities&quot;.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal defines a set of &quot;capabilities&quot; the wallets may want to implement in order to provide a comprehensive
support for Account Abstraction (AA).&lt;&#x2F;p&gt;
&lt;p&gt;These &quot;capabilities&quot; enable passing any data that may be required when using a Paymaster contract,
allows limiting the time range during which the UserOperation is considered valid,
provides a way for the dApp to manually control the semi-abstracted nonce and AA-specific gas limits of the UserOp,
and even allow the dApp to take part in selecting the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; account implementation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt; introduced Account Abstraction, enabling Smart Contract Accounts to function as first-class citizens in Ethereum.
However, while &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7769&#x2F;&quot;&gt;ERC-7769&lt;&#x2F;a&gt; define a low-level RPC API for Account Abstraction,
they do not specify a way for advanced AA-aware dApps to communicate their supported features and parameters to the advanced AA Wallet Applications.&lt;&#x2F;p&gt;
&lt;p&gt;This ERC addresses the issue by defining a structured set of capabilities tailored for AA-aware dApps and Wallet Applications.&lt;&#x2F;p&gt;
&lt;p&gt;It utilises the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5792&#x2F;&quot;&gt;EIP-5792&lt;&#x2F;a&gt; wallet capability model to express some of the critical aspects of AA,
ensuring dApps can seamlessly adapt to different AA Wallets without requiring custom solutions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;All actions in Account Abstraction within the context of EIP-5792 must be done on a single chain and atomically.&lt;&#x2F;p&gt;
&lt;p&gt;We define the following list of new &quot;capabilities&quot; which together cover many features necessary for Account Abstraction.
Note that use of Paymasters managed by a &quot;paymaster web service&quot; is described in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7677&#x2F;&quot;&gt;ERC-7677&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;create-eip-7702-authorization-capability&quot;&gt;Create &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; Authorization Capability&lt;&#x2F;h3&gt;
&lt;p&gt;This capability is designed to be used with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; and requests the Wallet Application to provide
an EIP-7702 authorization tuple for the specified address as part of the AA transaction.&lt;&#x2F;p&gt;
&lt;p&gt;Identifier:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;eip7702Auth&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SetCodeForEOACapabilityParams&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Record&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    account&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;       &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; EOA address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    delegation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; delegation address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Supporting Wallet Applications MUST generate an EIP-7702 compatible transaction that sets a code of the &lt;code&gt;account&lt;&#x2F;code&gt; EOA address
to the code of &lt;code&gt;delegation&lt;&#x2F;code&gt; specified in the request.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;static-paymaster-configuration-capability&quot;&gt;Static Paymaster Configuration Capability&lt;&#x2F;h3&gt;
&lt;p&gt;The purpose of this capability is allowing applications to integrate with Paymasters that do not require
the Wallet Application to resolve any dynamic configuration.&lt;&#x2F;p&gt;
&lt;p&gt;The application may hard-code or resolve these parameters first and pass them with this capability.&lt;&#x2F;p&gt;
&lt;p&gt;Identifier:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;staticPaymasterConfiguration&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; StaticPaymasterConfigurationCapabilityParams&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Record&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    paymaster&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    paymasterData&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    paymasterValidationGasLimit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    paymasterPostOpGasLimit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;validity-time-range-capability&quot;&gt;Validity Time Range Capability&lt;&#x2F;h3&gt;
&lt;p&gt;The purpose of this capability is allowing the applications to explicitly specify the time range during which
the requested operations will be valid after signing.&lt;&#x2F;p&gt;
&lt;p&gt;Identifier:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;validityTimeRange&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ValidityTimeRangeCapabilityParams&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Record&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    validAfter&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; operation valid only after this timestamp, in seconds&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    validUntil&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; operation valid only before this timestamp, in seconds&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The Wallet Application MUST verify the time range [&lt;code&gt;validAfter&lt;&#x2F;code&gt;..&lt;code&gt;validUntil&lt;&#x2F;code&gt;] is valid and present it to the
user in a human-readable way for confirmation as part of the transaction information.&lt;&#x2F;p&gt;
&lt;p&gt;The Smart Contract Account MUST specify the time range [&lt;code&gt;validAfter&lt;&#x2F;code&gt;..&lt;code&gt;validUntil&lt;&#x2F;code&gt;] as the transaction validity range.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;multidimensional-nonce-capability&quot;&gt;Multidimensional Nonce Capability&lt;&#x2F;h3&gt;
&lt;p&gt;The purpose of this capability is allowing the applications to explicitly specify the components of the
semi-abstracted nonce as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Identifier:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;multiDimensionalNonce&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MultiDimensionalNonceCapabilityParams&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Record&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    nonceKey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    nonceSequence&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;For Smart Contract Accounts that support multidimensional nonce values,
the wallet must specify these parameters during the actual on-chain execution of the batch.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;account-abstraction-gas-parameters-override-capability&quot;&gt;Account Abstraction Gas Parameters Override Capability&lt;&#x2F;h3&gt;
&lt;p&gt;The purpose of this capability is allowing the applications to override the Wallet Application&#x27;s suggested values
for all gas-related parameters.&lt;&#x2F;p&gt;
&lt;p&gt;This capability provides very low-level access to the underlying Account Abstraction protocol and should only
be used by applications closely coupled to a specific version of a specific protocol.
It may also prove useful in the context of development and debugging.&lt;&#x2F;p&gt;
&lt;p&gt;It is generally recommended that production dapps rely on higher-level features of Wallet Applications instead.&lt;&#x2F;p&gt;
&lt;p&gt;Identifier:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;accountAbstractionGasParamsOverride&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AAGasParamsOverrideCapabilityParams&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Record&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    preVerificationGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    verificationGasLimit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    callGasLimit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    paymasterVerificationGasLimit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    paymasterPostOpGasLimit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    maxFeePerGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    maxPriorityFeePerGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Notice that all fields in the &lt;code&gt;AAGasParamsOverrideCapabilityParams&lt;&#x2F;code&gt; are optional.
Only the values that callers want to override must be provided.&lt;&#x2F;p&gt;
&lt;p&gt;Wallet Applications should warn the users about the overrides being supplied by the call and use these values instead.&lt;&#x2F;p&gt;
&lt;p&gt;Wallet Applications may choose to reject calls with conflicting configurations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;!-- TODO --&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;eip7702auth&quot;&gt;&lt;code&gt;eip7702Auth&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;This is by far the most sensitive capability in the document.
There is no limit to the damage that can be done by signing the wrong capability.&lt;&#x2F;p&gt;
&lt;p&gt;Wallet Applications MUST take extreme care when working with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Wallet Applications MUST maintain a strict shortlist of well-known and publicly audited Smart Contract Account
implementations that are acceptable as &lt;code&gt;delegation&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Authorization is an extremely sensitive operation and any vulnerability or malicious code in &lt;code&gt;delegation&lt;&#x2F;code&gt; will
result in complete draining of the &lt;code&gt;account&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;staticpaymasterconfiguration&quot;&gt;&lt;code&gt;staticPaymasterConfiguration&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;This capability has an opportunity to provide the &lt;code&gt;paymaster&lt;&#x2F;code&gt; and &lt;code&gt;paymasterData&lt;&#x2F;code&gt; values for the call.
Incorrect or malicious values can be an attack vector.
For example, a Paymaster contract may hold approvals for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens which may be drained this way.&lt;&#x2F;p&gt;
&lt;p&gt;The Wallet Applications MUST make sure the provided values correspond to user intent.
Fundamentally, this is not very different to how regular transactions&#x27; &lt;code&gt;calldata&lt;&#x2F;code&gt; must be verified.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>ABI attachment in `wallet_sendCalls`</title>
        <published>2025-02-27T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Francisco Giordano</name><uri>https://github.com/frangio</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7896/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-tbd-abi-attachment-in-wallet-sendcalls/23016" />
        

        <id>https://wg-eips.ritovision.com/7896/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="interface"
                label="Interface" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:7896"
            label="EIP-7896" />
        

        
        

        
        <summary type="html">A capability to enable calldata decoding in wallets.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7896/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP extends &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5792&#x2F;&quot;&gt;EIP-5792&lt;&#x2F;a&gt; with a new &lt;code&gt;interfaces&lt;&#x2F;code&gt; capability, whereby an application can attach the contract interface specifications (aka. ABIs) that the wallet needs to reliably decode the calldata in the request.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The security model of Ethereum accounts relies on a separation of concerns between applications and wallets, the latter being responsible for securing private key material and providing restricted access to it. When an application requests a transaction or a signature, the wallet prompts the user to accept it or reject it. The user is expected to make an assessment about the desirability of the operation, given that it can potentially operate on all account assets, in the extreme case &quot;draining&quot; them all for the benefit of an attacker. The wallet is tasked with providing information about the request to lead to an accurate assessment, in particular to help detect unintended effects and attacks.&lt;&#x2F;p&gt;
&lt;p&gt;This idealized vision is far from realized. &quot;Blind signing&quot;, the practice of accepting a request without full visibility of its contents or understanding of its implications, is a pervasive problem across Ethereum. This is a puzzling situation given what&#x27;s at stake. A likely explanation is that it is simply very difficult for wallets to extract and provide good information about requests.&lt;&#x2F;p&gt;
&lt;p&gt;Before accepting a transaction request, a user would ideally like to know exactly what effects the transaction will have when included on chain. Transaction simulations have become widespread throughout wallets in recent years, where the wallet (or a service provider) runs the transaction and summarizes the observed effects in a friendly description such as &quot;-1 ETH, +2400 USDC&quot;. However, exactly predicting these effects is impossible due to mutable shared state, and describing the range of possible effects is intractable due to the turing completeness of the EVM, so we should be cautious and not overly rely on this kind of approach.&lt;&#x2F;p&gt;
&lt;p&gt;Whereas transaction simulations try to provide insight into the dynamic behavior of a transaction, wallets should also surface all of the statically available information, such as transaction parameters and application metadata.&lt;&#x2F;p&gt;
&lt;p&gt;Some parameters have clear semantics, for example, the &lt;code&gt;value&lt;&#x2F;code&gt; in a transaction expresses how much of the native token is transferred. The &lt;code&gt;data&lt;&#x2F;code&gt; in a transaction, however, presents a challenge, as it is provided to the wallet as a bytestring and cannot be reliably decoded into more meaningfully structured information without knowledge of the target contract ABI. The wallet can try to use a database of function selectors to try to guess an ABI, but this will fail for new and unknown contracts, and known selectors can be ambiguous due to collisions, including those deliberately introduced by attackers. Alternatively, the wallet can obtain an ABI from a repository of verified source code, with the downside that the main such repository is managed by a centralized party.&lt;&#x2F;p&gt;
&lt;p&gt;Since applications that request transactions are necessarily aware of the relevant ABIs, this EIP proposes a mechanism where they can attach ABIs in transaction requests, so that wallets can show decoded call data to users and help make a more informed assessment.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;A new capability called &lt;code&gt;interfaces&lt;&#x2F;code&gt; is added to EIP-5792 requests.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;wallet-sendcalls&quot;&gt;&lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;When this capability is supported, &lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt; requests MAY include a global &lt;code&gt;interfaces&lt;&#x2F;code&gt; field.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;interfaces&lt;&#x2F;code&gt; field provided by an application MUST map contract addresses to interface specs. These contract addresses SHOULD correspond to those of the &lt;code&gt;to&lt;&#x2F;code&gt; fields in the &lt;code&gt;calls&lt;&#x2F;code&gt; array of the request, and SHOULD be compared with them case-sensitively. There MAY be addresses in &lt;code&gt;calls&lt;&#x2F;code&gt; without a matching interface spec, and there MAY be addresses in &lt;code&gt;interfaces&lt;&#x2F;code&gt; without a matching call.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SendCallsParams&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; default fields omitted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    capabilities&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaces&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InterfacesCapability&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Record&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Capability&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InterfacesCapability&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        version&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        spec&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; unknown&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; version-dependent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    optional&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; boolean&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;An interface spec MUST describe how a contract will decode calldata into a series of function arguments. The interpretation of a spec as a decoding procedure depends on a version string.&lt;&#x2F;p&gt;
&lt;p&gt;The two initially defined versions are &lt;code&gt;abi-v1&lt;&#x2F;code&gt; and &lt;code&gt;abi-v2&lt;&#x2F;code&gt;, corresponding to the Contract Application Binary Interface as defined by Solidity and adopted by other languages. In these cases, the spec MUST be provided as an array as described in Solidity&#x27;s documentation, page &quot;Contract ABI Specification&quot;, section &quot;JSON&quot;. The array MAY contain event and error descriptions in addition to function descriptions, though applications SHOULD exclude irrelevant items. The v1-v2 distinction corresponds to Solidity&#x27;s &lt;code&gt;pragma abicoder v1&lt;&#x2F;code&gt; and &lt;code&gt;pragma abicoder v2&lt;&#x2F;code&gt; (or &lt;code&gt;pragma experimental ABIEncoderV2&lt;&#x2F;code&gt;). Vyper implements &lt;code&gt;abi-v2&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Applications SHOULD mark the &lt;code&gt;interfaces&lt;&#x2F;code&gt; field as &lt;code&gt;optional&lt;&#x2F;code&gt;, so that the user is able to proceed if their wallet does not support the capability or a provided spec version. If the field is marked &lt;code&gt;optional&lt;&#x2F;code&gt;, the wallet MAY ignore interfaces with unsupported spec versions.&lt;&#x2F;p&gt;
&lt;p&gt;Wallets SHOULD use the provided interface specs to decode the &lt;code&gt;data&lt;&#x2F;code&gt; of each call in the &lt;code&gt;calls&lt;&#x2F;code&gt; array in order to present the user with the decoded function arguments. Wallets MAY validate the provided specs against a database of verified or trusted specs.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;example-request&quot;&gt;Example Request&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;from&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xa22cc169386b820ab57c006a5b4980add068a7eb&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;calls&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xdac17f958d2ee523a2206206994597c13d831ec7&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x00&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xa9059cbb000000000000000000000000f0c87f351435211efa00938a33771bf38302d1f10000000000000000000000000000000000000000000000056bc75e2d63100000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;capabilities&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;interfaces&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;optional&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;0xdac17f958d2ee523a2206206994597c13d831ec7&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;abi-v1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;spec&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;transfer&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;stateMutability&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;nonpayable&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;outputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;wallet-getcapabilities&quot;&gt;&lt;code&gt;wallet_getCapabilities&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Under the &lt;code&gt;interfaces&lt;&#x2F;code&gt; capability, wallets MUST include a &lt;code&gt;versions&lt;&#x2F;code&gt; array field listing the supported interface spec versions.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;example-response&quot;&gt;Example Response&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;interfaces&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;supported&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;versions&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;abi-v1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;abi-v2&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;!-- TODO --&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;!-- TODO --&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Restricted Behavior Transaction Type</title>
        <published>2025-02-21T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Forshtat</name><uri>https://github.com/forshtat</uri>
	</author>
	
	<author>
		<name>Shahaf Nacson</name><uri>https://github.com/shahafn</uri>
	</author>
	
	<author>
		<name>Dror Tirosh</name><uri>https://github.com/drortirosh</uri>
	</author>
	
	<author>
		<name>Yoav Weiss</name><uri>https://github.com/yoavw</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7906/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-restricted-behavior-transaction-type/23130" />
        

        <id>https://wg-eips.ritovision.com/7906/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7906"
            label="EIP-7906" />
        

        
        

        
        <summary type="html">A transaction type that provides a way for senders to restrict the outcomes of their execution</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7906/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal allows the transaction payload to define write protections for balances and storage slots that are enforced at the protocol level. These protected transactions empower Ethereum users to restrict the behavior of the deployed on-chain smart contracts without needing to perform a deep analysis of their EVM bytecode.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The total value of crypto assets that have been stolen to date exceeds the yearly GDP of a medium-sized nation. This level of loss and waste is indefensible and has a long list of negative consequences for everyone involved.&lt;&#x2F;p&gt;
&lt;p&gt;Specifically, one of the major ways in which Ethereum users end up losing their funds is not exposing private keys, but instead being tricked into signing transactions that appear innocent in their Wallet applications but in practice perform a complete sweep of the senders&#x27; assets.&lt;&#x2F;p&gt;
&lt;p&gt;The ability of an average user or a Wallet application to find, collect, review, and analyze the EVM code the transaction will execute is very limited.&lt;&#x2F;p&gt;
&lt;p&gt;This leaves the users with no mechanism to enforce any restrictions on what the transaction actually does once it is signed. This leads users to perform blind signing in order to interact with Ethereum, exposing them to significant and avoidable risks.&lt;&#x2F;p&gt;
&lt;p&gt;By providing the Wallets and dApps with the ability to restrict the possible &lt;strong&gt;outcomes&lt;&#x2F;strong&gt; of a transaction, we create a tool that users and wallets will apply to reduce their risk levels.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;RESTRICTED_TX_COST&lt;&#x2F;td&gt;&lt;td&gt;TBD&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;TRACE_CALL_GAS_COST&lt;&#x2F;td&gt;&lt;td&gt;TBD&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;GET_TRACE_CALL_ADDRESS&lt;&#x2F;td&gt;&lt;td&gt;TBD&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;RESTRICTED_EXECUTION_TX_TYPE&lt;&#x2F;td&gt;&lt;td&gt;TBD&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;new-transaction-type&quot;&gt;New Transaction Type&lt;&#x2F;h3&gt;
&lt;p&gt;We introduce a new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; transaction, &quot;restricted execution transaction&quot;, where the &lt;code&gt;TransactionType&lt;&#x2F;code&gt; is &lt;code&gt;RESTRICTED_EXECUTION_TX_TYPE&lt;&#x2F;code&gt; and the &lt;code&gt;TransactionPayload&lt;&#x2F;code&gt; is the RLP serialization of the following:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;rlp([chain_id, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit, destination, value, calldata, access_list, authorization_list, asserter_address, asserter_data, asserter_gas_limit, signature_y_parity, signature_r, signature_s])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;asserter_address&lt;&#x2F;code&gt; - the address of an existing contract that will be called for the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7906&#x2F;#assertion-frame&quot;&gt;Assertion Frame&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;asserter_data&lt;&#x2F;code&gt; - the data to be passed as a call data to the Assertion Frame. In case the &lt;code&gt;asserter_address&lt;&#x2F;code&gt; is not set, this field acts as a &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7906&#x2F;#one-time-restrictions-code&quot;&gt;One-Time Restrictions Code&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;asserter_gas_limit&lt;&#x2F;code&gt; - the gas limit provided to the asserter call frame.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;one-time-restrictions-code&quot;&gt;One-Time Restrictions Code&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;asserter_address&lt;&#x2F;code&gt;, &lt;code&gt;asserter_data&lt;&#x2F;code&gt; and &lt;code&gt;asserter_gas_limit&lt;&#x2F;code&gt; fields behave similarly to the &lt;code&gt;destination&lt;&#x2F;code&gt;, &lt;code&gt;calldata&lt;&#x2F;code&gt; and &lt;code&gt;gas_limit&lt;&#x2F;code&gt; fields in existing transaction types.&lt;&#x2F;p&gt;
&lt;p&gt;If the &lt;code&gt;asserter_address&lt;&#x2F;code&gt; value is not set, the &lt;code&gt;asserter_data&lt;&#x2F;code&gt; is loaded and executed as &lt;code&gt;asserter_code&lt;&#x2F;code&gt;. This is similar to the &lt;code&gt;init_code&lt;&#x2F;code&gt; parameter logic of a legacy transaction type.&lt;&#x2F;p&gt;
&lt;p&gt;This code is executed in a static context and cannot modify the blockchain state, set contract code or deploy new contracts.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;assertion-frame&quot;&gt;Assertion Frame&lt;&#x2F;h3&gt;
&lt;p&gt;After the transaction execution frame is finished without reverting, the &lt;code&gt;RESTRICTED_EXECUTION_TX_TYPE&lt;&#x2F;code&gt; transactions MUST also successully execute a second execution frame. This frame runs in a static context and cannot modify storage or emit logs.&lt;&#x2F;p&gt;
&lt;p&gt;The purpose of this frame is to execute the state change assertions as prescribed by the &lt;code&gt;asserter_address&lt;&#x2F;code&gt; and &lt;code&gt;asserter_data&lt;&#x2F;code&gt; parameters.&lt;&#x2F;p&gt;
&lt;p&gt;In case of a revert in the Assertion Frame, the entire transaction is reverted.&lt;&#x2F;p&gt;
&lt;p&gt;The gas costs in the Assertion Frame are charged same as in the regular execution.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;execution-restrictions-assertion-frame&quot;&gt;Execution Restrictions Assertion Frame&lt;&#x2F;h3&gt;
&lt;p&gt;There are a number of parameters that constitute the core of the transaction&#x27;s execution restriction. These parameters are joined together and RLP encoded as part of the transaction payload. There are no additional costs associated with providing this parameter other than its gas cost equivalent to &lt;code&gt;calldata&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;In case any of the specified restrictions is violated, the entire transaction MUST &lt;strong&gt;revert on-chain&lt;&#x2F;strong&gt; and its gas MUST be paid until the point of the restriction violation.&lt;&#x2F;p&gt;
&lt;p&gt;The transaction is considered to be a valid transaction that can be included in a block and pays its own gas regardless of the contents of the &lt;code&gt;execution_restrictions&lt;&#x2F;code&gt; parameter.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;transaction-trace-precompile&quot;&gt;Transaction Trace Precompile&lt;&#x2F;h3&gt;
&lt;p&gt;We introduce a precompile at address &lt;code&gt;GET_TRACE_CALL_ADDRESS&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;When called in a regular execution frame, the call returns a full stack trace of the current frame up to this point.&lt;&#x2F;p&gt;
&lt;p&gt;When called in the Assertion Frame, the call returns a full stack trace of the entire transaction.&lt;&#x2F;p&gt;
&lt;p&gt;The format of the returned transaction stack trace is described in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7906&#x2F;#transaction-trace-data-structure&quot;&gt;Transaction Trace Data Structure&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;transaction-trace-data-structure&quot;&gt;Transaction Trace Data Structure&lt;&#x2F;h3&gt;
&lt;p&gt;The stack trace is represented as an ABI encoding of the following struct:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Trace&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Call&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; calls&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Call&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span&gt; target&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Storage&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; storage&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Balance&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; balances&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  CodeHash&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; codeHash&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  OpCode&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; opCodes&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Call&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; calls&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Storage&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes32&lt;&#x2F;span&gt;&lt;span&gt; slotId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes32&lt;&#x2F;span&gt;&lt;span&gt; oldValue&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes32&lt;&#x2F;span&gt;&lt;span&gt; newValue&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Balance&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span&gt; account&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span&gt; oldBalance&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span&gt; newBalance&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CodeHash&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes32&lt;&#x2F;span&gt;&lt;span&gt; newCodeHash&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OpCode&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint8&lt;&#x2F;span&gt;&lt;span&gt; opCode&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; params&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;opcodes-traced&quot;&gt;Opcodes Traced&lt;&#x2F;h4&gt;
&lt;p&gt;Including all opcodes called during a transaction execution in the stack trace is not practical. Instead, only the following opcodes with potentially dangerous non-local effects are reported as part of the &lt;code&gt;opCodes&lt;&#x2F;code&gt; field:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; (&lt;code&gt;0xFF&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; (&lt;code&gt;0xF4&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CALLCODE&lt;&#x2F;code&gt; (&lt;code&gt;0xF2&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;STATICCALL&lt;&#x2F;code&gt; (&lt;code&gt;0xFA&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CALL&lt;&#x2F;code&gt; (&lt;code&gt;0xFA&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;LOG&lt;&#x2F;code&gt; (&lt;code&gt;0xA0&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;LOG1&lt;&#x2F;code&gt; (&lt;code&gt;0xA1&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;LOG2&lt;&#x2F;code&gt; (&lt;code&gt;0xA2&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;LOG3&lt;&#x2F;code&gt; (&lt;code&gt;0xA3&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;LOG4&lt;&#x2F;code&gt; (&lt;code&gt;0xA4&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;REVERT&lt;&#x2F;code&gt; (&lt;code&gt;0xFD&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;INVALID&lt;&#x2F;code&gt; (&lt;code&gt;0xFE&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;KECCAK256&lt;&#x2F;code&gt; (&lt;code&gt;0x20&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;new-transaction-type-and-assertion-frame&quot;&gt;New Transaction Type and Assertion Frame&lt;&#x2F;h3&gt;
&lt;p&gt;One of the main advantages of a new Transaction Type for the Restricted Behaviour feature is the ability to protect all existing EOAs, and not just smart accounts. This makes it preferable to introduce a new Transaction Type instead of any other approach that would only work for smart contract accounts.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;transaction-trace-precompile-behaviour&quot;&gt;Transaction Trace Precompile Behaviour&lt;&#x2F;h3&gt;
&lt;p&gt;It is important for us to provide the same protection level to both EOAs and Smart Accounts. The Smart Accounts are not able to initiate a &lt;code&gt;RESTRICTED_EXECUTION_TX_TYPE&lt;&#x2F;code&gt; transaction themselves, and instead need to rely on checks performed during the regular execution frame of any transaction type.&lt;&#x2F;p&gt;
&lt;p&gt;By exposing the &lt;code&gt;GET_TRACE_CALL_ADDRESS&lt;&#x2F;code&gt; precompile at all times, we allow any smart contract to perform the state change assertions it may need to ensure safety and security.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;deployable-and-one-time-restrictions-code&quot;&gt;Deployable and One-Time Restrictions Code&lt;&#x2F;h3&gt;
&lt;p&gt;In some scenarios, the wallets are likely to want to apply the exact same transaction behaviour to all transactions they initiate.&lt;&#x2F;p&gt;
&lt;p&gt;In this case, it is reasonalbe and more efficient to deploy the assertions on-chain as a smart contract module, and provide its address and the inputs it may need.&lt;&#x2F;p&gt;
&lt;p&gt;However, it is possible that the wallet may want to prepare the restrictions for the transaction dynamically. In that case, there is no benefit in having the assertion code permanently deployed, and it is more efficient to provide such code as part of the transaction payload. Luckily, the EVM already has a very similar behaviour defined for the &lt;code&gt;init_code&lt;&#x2F;code&gt; field, and it appears to fit the task perfectly.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal describes a new transaction type that should not affect the functionality of existing systems.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;correct-wallet-ui-presentation&quot;&gt;Correct Wallet UI presentation&lt;&#x2F;h3&gt;
&lt;p&gt;Successfull use of the &lt;code&gt;RESTRICTED_EXECUTION_TX_TYPE&lt;&#x2F;code&gt; transaction type requires the wallets to be abile to correctly understand and present the restrictions imposed on the transaction to the users.&lt;&#x2F;p&gt;
&lt;p&gt;Wallets will need to be able to understand the meaning of the state changes being permitted by the transaction. This requires wallets to be aware of all major ERC standards, such as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;. In many cases, this also requires the wallets to be able to fetch and analyze the source code of the executed contracts.&lt;&#x2F;p&gt;
&lt;p&gt;However, the introduction of the Execution Restrictions feature significantly streamlines the process by removing the need for a deep understanding of the executed &lt;strong&gt;code&lt;&#x2F;strong&gt;. Instead, only high-level information about the stack traces&#x27; meaning is required for a clear and safe representation of possible transaction outcomes.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;insufficiently-restrictive-transactions&quot;&gt;Insufficiently Restrictive Transactions&lt;&#x2F;h3&gt;
&lt;p&gt;The worst outcome of introducing a security feature is creating a false sense of security for its user.&lt;&#x2F;p&gt;
&lt;p&gt;Wallets are expected to provide the behaviour restriction logic that protects their users&#x27; valuable assets.&lt;&#x2F;p&gt;
&lt;p&gt;It is critical that dApps, wallets, and users become educated about the consequences of not limiting their transactions&#x27; execution with sufficient strictness.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Emit log on revert</title>
        <published>2025-02-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Shoham Chakraborty</name><uri>https://github.com/shohamc1</uri>
	</author>
	
	<author>
		<name>Alex Forshtat</name><uri>https://github.com/forshtat</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7889/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7889-emit-log-on-revert/22918" />
        

        <id>https://wg-eips.ritovision.com/7889/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7889"
            label="EIP-7889" />
        

        
        

        
        <summary type="html">Top level reverts emit a log with revert message</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7889/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;All calls to the REVERT opcode with non-zero size must emit a log with revert data, making it accessible via standard RPC without the need for tracing.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Revert messages are currently inaccessible to users as they are not available via standard RPC. Instead, users have to request a node to trace the transaction and check the stack and memory at the moment when the REVERT opcode was executed.&lt;&#x2F;p&gt;
&lt;p&gt;This introduces overhead for users and nodes - users must make an additional request to find out why their transaction failed, and the node has to replay the full transaction (which may be slow and computationally expensive) to get back a relatively small piece of data.&lt;&#x2F;p&gt;
&lt;p&gt;Currently it is up to smart wallet developers to emit logs before a revert, however this is not a standard feature and thus cannot be relied upon by tools such as client libraries and block explorers. Making this log part of the protocol allows these tools to rely on logs for revert reasons.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;!-- TODO --&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;REVERTTOPIC&lt;&#x2F;code&gt;: &lt;code&gt;TBD&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;DATA_LIMIT&lt;&#x2F;code&gt;: &lt;code&gt;TBD&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;functionality&quot;&gt;Functionality&lt;&#x2F;h3&gt;
&lt;p&gt;Whenever &lt;code&gt;REVERT&lt;&#x2F;code&gt; is called with non-zero size, emit a log identical to a LOG1 with the topic &lt;code&gt;REVERTTOPIC&lt;&#x2F;code&gt;. The log data is the raw bytes of the revert message. The data is truncated to &lt;code&gt;DATA_LIMIT&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This is the simplest possible implementation that allows revert messages to be accessible via RPC methods. It does not require any changes to client libraries, or other RPC consumers as it is backward compatible. It does not introduce new RPC methods or new opcodes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Reverted transactions may now contain up to one log.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Reverted transactions must cost at least intrinsic gas (21000 gas), which is much more expensive than the LOG1 opcode (750 gas). Hence, this EIP does not introduce any new avenues to inflate Ethereum storage requirements. However, it is expected to increase the average number of logs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Delayed execution</title>
        <published>2025-02-18T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Francesco D&#x27;Amato</name><uri>https://github.com/fradamt</uri>
	</author>
	
	<author>
		<name>Toni Wahrstätter</name><uri>https://github.com/nerolation</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7886/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7886-delayed-execution/22890" />
        

        <id>https://wg-eips.ritovision.com/7886/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:7886"
            label="EIP-7886" />
        

        
        

        
        <summary type="html">Separate block validation from execution</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7886/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal introduces a mechanism to make execution blocks statically verifiable through minimal checks that only require the previous state, without requiring execution of the block&#x27;s transactions. This enables validators to attest to a block&#x27;s validity without completing its execution.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The primary advantage of this proposal is &lt;strong&gt;asynchronous block validation&lt;&#x2F;strong&gt;. In the current Ethereum protocol, blocks must be fully executed before validators can attest to them. This requirement creates a bottleneck in the consensus process, as attestors must wait for execution results before committing their votes, limiting the network&#x27;s throughput potential.&lt;&#x2F;p&gt;
&lt;p&gt;By introducing a mechanism where execution payloads can be reverted rather than invalidating the entire block, execution is no longer an immediate requirement for validation. Instead, a block&#x27;s validity can be determined based on its structural correctness and the upfront payment of transaction fees by senders. This allows attestation to happen earlier in the slot, independent of execution, potentially enabling higher block gas limits and significant throughput improvements across the network.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;header-changes&quot;&gt;Header Changes&lt;&#x2F;h3&gt;
&lt;p&gt;The block header structure is extended to support delayed execution:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;dataclass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Header&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Existing fields&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    parent_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ommers_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    coinbase&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Pre-execution state root - this is the state root before executing transactions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    pre_state_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Deferred execution outputs from parent block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    parent_transactions_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transaction root from parent block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    parent_receipt_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;         #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Receipt root from parent block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    parent_bloom&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bloom&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;               #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Logs bloom from parent block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    parent_requests_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;      #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Hash of requests from the parent block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    parent_execution_reverted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;   #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Indicates if parent block&amp;#39;s execution was reverted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Other existing fields&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    difficulty&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    number&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_limit&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_used&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;                   #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Declared gas used by txs, validated post-execution&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    timestamp&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; U256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    extra_data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    prev_randao&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    base_fee_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    withdrawals_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    blob_gas_used&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; U64&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;               #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Total blob gas used by transactions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    excess_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; U64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    parent_beacon_block_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The key changes are:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;pre_state_root&lt;&#x2F;code&gt;: Represents the state root before execution (checked against the post-execution state of the parent block)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;parent_receipt_root&lt;&#x2F;code&gt;: Receipt root from the parent block (deferred execution output)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;parent_bloom&lt;&#x2F;code&gt;: Logs bloom from the parent block (deferred execution output)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;parent_requests_hash&lt;&#x2F;code&gt;: Hash of requests from the parent block (deferred execution output)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;parent_execution_reverted&lt;&#x2F;code&gt;: Indicates whether the parent block&#x27;s execution was reverted&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;A block header MUST include all these fields to be considered valid under this EIP. The &lt;code&gt;pre_state_root&lt;&#x2F;code&gt; MUST match the state root after applying the parent block&#x27;s execution. The parent execution outputs MUST accurately reflect the previous block&#x27;s execution results to maintain chain integrity.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;chain-state-tracking&quot;&gt;Chain State Tracking&lt;&#x2F;h3&gt;
&lt;p&gt;The blockchain object is extended to track execution outputs for verification in subsequent blocks:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;dataclass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BlockChain&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Block&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; State&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    chain_id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; U64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    last_transactions_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transaction root from the last executed block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    last_receipt_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;         #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Receipt root from last executed block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    last_block_logs_bloom&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bloom&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Logs bloom from last executed block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    last_requests_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;       #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Requests hash from last executed block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    last_execution_reverted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;   #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Indicates if the last block&amp;#39;s execution was reverted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;These additional fields are used to verify the deferred execution outputs claimed in subsequent blocks. The &lt;code&gt;last_transactions_root&lt;&#x2F;code&gt;, &lt;code&gt;last_receipt_root&lt;&#x2F;code&gt;, &lt;code&gt;last_block_logs_bloom&lt;&#x2F;code&gt;, &lt;code&gt;last_requests_hash&lt;&#x2F;code&gt;, and &lt;code&gt;last_execution_reverted&lt;&#x2F;code&gt; act as critical chain state references that MUST be updated after each block execution to ensure proper state progression. When a block&#x27;s execution is reverted due to a gas mismatch, the &lt;code&gt;last_execution_reverted&lt;&#x2F;code&gt; field is set to &lt;code&gt;True&lt;&#x2F;code&gt;, which affects the base fee calculation of subsequent blocks.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;block-validation&quot;&gt;Block Validation&lt;&#x2F;h3&gt;
&lt;p&gt;Static validation is performed separately from execution. In this phase, all checks that can be done without executing transactions are performed:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validate_block&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;chain&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BlockChain&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Validate header against parent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    validate_header&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;chain&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Validate deferred execution outputs from the parent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parent_transactions_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; chain&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;last_transactions_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        raise&lt;&#x2F;span&gt;&lt;span&gt; InvalidBlock&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parent_receipt_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; chain&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;last_receipt_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        raise&lt;&#x2F;span&gt;&lt;span&gt; InvalidBlock&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parent_bloom&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; chain&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;last_block_logs_bloom&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        raise&lt;&#x2F;span&gt;&lt;span&gt; InvalidBlock&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parent_requests_hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; chain&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;last_requests_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        raise&lt;&#x2F;span&gt;&lt;span&gt; InvalidBlock&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pre_state_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; state_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;chain&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        raise&lt;&#x2F;span&gt;&lt;span&gt; InvalidBlock&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parent_execution_reverted&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; chain&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;last_execution_reverted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        raise&lt;&#x2F;span&gt;&lt;span&gt; InvalidBlock&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Process all transactions trie and validate transactions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    total_inclusion_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    total_blob_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    withdrawals_trie&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Trie&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;secured&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;False&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; default&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;None&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Track sender balances and nonces by address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sender_balances&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sender_nonces&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Calculate blob gas price based on excess blob gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    blob_gas_price&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; calculate_blob_gas_price&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;excess_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Validate each transaction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; enumerate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;map&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;decode_transaction&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;transactions&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Validate transaction parameters (signature, fees, etc.)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        validate_transaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;base_fee_per_gas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;excess_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Recover sender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        sender_address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; recover_sender&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;chain&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;chain_id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Calculate gas costs (both EIP-7623 intrinsic cost and floor cost)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        intrinsic_gas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; calldata_floor_gas_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; calculate_intrinsic_cost&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        blob_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; calculate_total_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Track total gas usage (using the maximum of intrinsic gas and floor cost)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        total_inclusion_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;intrinsic_gas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; calldata_floor_gas_cost&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        total_blob_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; blob_gas_used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Calculate maximum gas fee (including blob fees)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        effective_gas_price&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; calculate_effective_gas_price&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;base_fee_per_gas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        max_gas_fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; effective_gas_price&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; blob_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; blob_gas_price&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify sender is an EOA or has delegation support&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; sender_address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; sender_balances&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            account&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;chain&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; sender_address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            is_sender_eoa&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytearray&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                or&lt;&#x2F;span&gt;&lt;span&gt; is_valid_delegation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; is_sender_eoa&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                raise&lt;&#x2F;span&gt;&lt;span&gt; InvalidBlock&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            sender_balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;sender_address&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            sender_nonces&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;sender_address&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify sender has sufficient balance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; sender_balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;sender_address&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; max_gas_fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            raise&lt;&#x2F;span&gt;&lt;span&gt; InvalidBlock&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify correct nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; sender_nonces&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;sender_address&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            raise&lt;&#x2F;span&gt;&lt;span&gt; InvalidBlock&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Track balance and nonce changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        sender_balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;sender_address&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -=&lt;&#x2F;span&gt;&lt;span&gt; max_gas_fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        sender_nonces&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;sender_address&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Validate gas constraints&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; total_inclusion_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_used&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        raise&lt;&#x2F;span&gt;&lt;span&gt; InvalidBlock&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; total_blob_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;blob_gas_used&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        raise&lt;&#x2F;span&gt;&lt;span&gt; InvalidBlock&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Validate withdrawals trie&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; wd&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; enumerate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;withdrawals&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        trie_set&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;withdrawals_trie&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; rlp&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;Uint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; rlp&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;wd&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;withdrawals_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;withdrawals_trie&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        raise&lt;&#x2F;span&gt;&lt;span&gt; InvalidBlock&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This validation function enforces several requirements:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Clients MUST validate that the block&#x27;s parent execution outputs match the chain&#x27;s tracked last execution outputs.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;pre_state_root&lt;&#x2F;code&gt; MUST match the current state root to ensure proper state transition.&lt;&#x2F;li&gt;
&lt;li&gt;All transactions MUST be statically validated for signature correctness and transaction type-specific requirements (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt;, etc.).&lt;&#x2F;li&gt;
&lt;li&gt;Sender accounts MUST be externally owned accounts (EOAs) or have valid delegation support (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;Senders MUST have sufficient balance to cover maximum possible gas fees plus transaction value.&lt;&#x2F;li&gt;
&lt;li&gt;Transaction nonces MUST be correct and sequential per sender.&lt;&#x2F;li&gt;
&lt;li&gt;Total inclusion gas (using the maximum of intrinsic gas and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7623&#x2F;&quot;&gt;EIP-7623&lt;&#x2F;a&gt; floor cost) MUST not exceed the block&#x27;s declared gas_used.&lt;&#x2F;li&gt;
&lt;li&gt;Total blob gas MUST match the declared blob_gas_used.&lt;&#x2F;li&gt;
&lt;li&gt;Withdrawal trie root MUST match its respective header field.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;When calculating inclusion gas, the implementation uses the maximum of the regular intrinsic gas cost and the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7623&#x2F;&quot;&gt;EIP-7623&lt;&#x2F;a&gt; calldata floor cost, which ensures proper accounting for calldata gas regardless of execution outcome.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;block-execution-with-state-snapshots&quot;&gt;Block Execution with State Snapshots&lt;&#x2F;h3&gt;
&lt;p&gt;After a block passes static validation, execution proceeds with the pre-charged transaction senders:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; apply_body&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;    block_env&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; vm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;BlockEnvironment&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;    transactions&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Tuple&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Union&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;LegacyTransaction&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ...&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;    withdrawals&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Tuple&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Withdrawal&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ...&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; vm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;BlockOutput&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block_output&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; vm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;BlockOutput&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Process system transactions first (beacon roots, history storage)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    process_system_transaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        block_env&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;block_env&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        target_address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;BEACON_ROOTS_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;block_env&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parent_beacon_block_root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    process_system_transaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        block_env&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;block_env&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        target_address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;HISTORY_STORAGE_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;block_env&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;block_hashes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The parent hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Process user transactions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    process_transactions&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block_env&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; block_output&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; transactions&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Process withdrawals&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    process_withdrawals&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block_env&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; block_output&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; withdrawals&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Process requests (deposits, withdrawals, consolidations)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; not generated if execution_reverted in header is True&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    process_general_purpose_requests&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        block_env&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;block_env&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        block_output&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;block_output&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; block_output&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; process_transactions&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;    block_env&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; vm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;BlockEnvironment&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;    block_output&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; vm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;BlockOutput&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;    transactions&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Tuple&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Union&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;LegacyTransaction&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ...&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Take a block-level snapshot of the state before transaction execution&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    begin_transaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block_env&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Decode transactions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    decoded_transactions&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;decode_transaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; transactions&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Pre-charge senders for maximum possible gas fees upfront&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; decoded_transactions&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        deduct_max_tx_fee_from_sender_balance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block_env&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Execute each transaction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; enumerate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;decoded_transactions&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        process_transaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block_env&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; block_output&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Stop processing if execution is already reverted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; block_output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;execution_reverted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            break&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Validate declared gas used against actual gas used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block_output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;execution_reverted&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        block_output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;execution_reverted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        or&lt;&#x2F;span&gt;&lt;span&gt; block_output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;block_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; block_env&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;block_gas_used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If execution is reverted, reset all outputs and rollback the state&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; block_output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;execution_reverted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        rollback_transaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block_env&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        block_output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;block_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        block_output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;transactions_trie&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Trie&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;secured&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;False&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; default&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;None&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        block_output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;receipts_trie&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Trie&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;secured&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;False&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; default&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;None&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        block_output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;receipt_keys&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        block_output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;block_logs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        block_output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;requests&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        block_output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;execution_reverted&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; True&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Commit the state if execution is valid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        commit_transaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block_env&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;During block execution:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Clients MUST create a block-level snapshot before any transaction execution occurs. This happens after handling the system contracts from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4788&#x2F;&quot;&gt;EIP-4788&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2935&#x2F;&quot;&gt;EIP-2935&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Maximum fees MUST be deducted from sender balances upfront by:&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; deduct_max_tx_fee_from_sender_balance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;block_env&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    effective_gas_price&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; calculate_effective_gas_price&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; block_env&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;base_fee_per_gas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    blob_gas_price&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; calculate_blob_gas_price&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block_env&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;excess_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    blob_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; calculate_total_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_gas_fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; effective_gas_price&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; blob_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; blob_gas_price&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; recover_sender&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block_env&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;chain_id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sender_account&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block_env&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    set_account_balance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block_env&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; sender_account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; U256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;max_gas_fee&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ol start=&quot;3&quot;&gt;
&lt;li&gt;
&lt;p&gt;Transactions are executed sequentially until executing a transaction would cause the block to exceed the gas limit.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;After execution, clients MUST verify that the total gas used matches the declared &lt;code&gt;gas_used&lt;&#x2F;code&gt; in the block header.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;If the actual gas used doesn&#x27;t match the declared value, clients MUST:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Set &lt;code&gt;execution_reverted&lt;&#x2F;code&gt; to &lt;code&gt;True&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Roll back to the snapshot taken before execution&lt;&#x2F;li&gt;
&lt;li&gt;Reset all execution outputs (receipts, logs, etc.)&lt;&#x2F;li&gt;
&lt;li&gt;Return zero gas used&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The block itself remains valid, but execution outputs are not applied to the state.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;General purpose requests as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7685&#x2F;&quot;&gt;EIP-7685&lt;&#x2F;a&gt; are skipped when execution is reverted.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The execution outputs (&lt;code&gt;last_transactions_root&lt;&#x2F;code&gt;, &lt;code&gt;last_receipt_root&lt;&#x2F;code&gt;, &lt;code&gt;last_block_logs_bloom&lt;&#x2F;code&gt;, &lt;code&gt;last_requests_hash&lt;&#x2F;code&gt;, &lt;code&gt;last_execution_reverted&lt;&#x2F;code&gt;) are updated in the chain state based on the execution results, and will be verified in subsequent blocks.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Execution SHALL be stopped and the payload reverted after exceeding the block gas limit:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; process_transaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;...&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  if&lt;&#x2F;span&gt;&lt;span&gt; block_output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;block_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; block_env&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;block_gas_limit&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        block_output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;execution_reverted&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; True&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;  ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;deferred-execution-outputs&quot;&gt;Deferred Execution Outputs&lt;&#x2F;h3&gt;
&lt;p&gt;The core innovation of deferring execution outputs to the next block enables static and stateful validation without requiring immediate execution. The &lt;code&gt;pre_state_root&lt;&#x2F;code&gt; provides a cryptographically verifiable starting point for validation, while parent execution outputs create a chain of deferred execution results that maintains the integrity of the blockchain state.&lt;&#x2F;p&gt;
&lt;p&gt;This approach eliminates the execution bottleneck in the validation pipeline by allowing validators to attest to a block&#x27;s validity based on its structure and the pre-charged transaction fees, without waiting for execution results.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;pre-charging-mechanism&quot;&gt;Pre-Charging Mechanism&lt;&#x2F;h3&gt;
&lt;p&gt;Pre-charging senders with the maximum possible fees before execution provides a crucial guarantee that transactions have sufficient balance to be included in the block. This mechanism is compatible with existing fee models, including &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; dynamic fee transactions and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt; blob transactions.&lt;&#x2F;p&gt;
&lt;p&gt;By tracking sender balances and nonces during validation, the protocol can enforce transaction validity without execution, enabling earlier block attestation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;state-snapshot-architecture&quot;&gt;State Snapshot Architecture&lt;&#x2F;h3&gt;
&lt;p&gt;The block-level snapshot mechanism provides a way to revert execution when necessary. This approach allows clients to roll back the entire block&#x27;s execution if the actual gas used does not match the declared gas in the header, without invalidating the block structure itself.&lt;&#x2F;p&gt;
&lt;p&gt;This provides two key benefits:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;It allows validators to attest to blocks before execution is complete&lt;&#x2F;li&gt;
&lt;li&gt;It ensures execution is eventually performed correctly, with economic penalties for incorrect gas declarations&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;execution-reversion-handling&quot;&gt;Execution Reversion Handling&lt;&#x2F;h3&gt;
&lt;p&gt;When a block&#x27;s execution is reverted due to gas mismatch:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The block itself remains valid and part of the canonical chain&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;last_execution_reverted&lt;&#x2F;code&gt; flag is set to &lt;code&gt;True&lt;&#x2F;code&gt; in chain state&lt;&#x2F;li&gt;
&lt;li&gt;The next block must include this flag as &lt;code&gt;parent_execution_reverted&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Base fee calculations for subsequent blocks use 0 as parent gas used when parent execution was reverted&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP requires a hard fork, as it alters the block validation and execution process.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;execution-correctness-guarantees&quot;&gt;Execution Correctness Guarantees&lt;&#x2F;h3&gt;
&lt;p&gt;The protocol ensures execution correctness through these primary mechanisms:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Deferred execution outputs MUST match in subsequent blocks, creating a chain of verifiable execution results.&lt;&#x2F;li&gt;
&lt;li&gt;State rollback MUST occur if the actual gas used doesn&#x27;t match the declared value, providing an economic incentive for correct gas declaration.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;parent_execution_reverted&lt;&#x2F;code&gt; flag ensures that blocks acknowledge when parent execution has been reverted, maintaining chain integrity.&lt;&#x2F;li&gt;
&lt;li&gt;Static and stateful validation guarantees that all transactions are properly authorized and senders have sufficient funds for maximum fees.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;base-fee-dynamics-with-reverted-execution&quot;&gt;Base Fee Dynamics with Reverted Execution&lt;&#x2F;h3&gt;
&lt;p&gt;When a block&#x27;s execution is reverted, the next block&#x27;s base fee calculation treats the parent&#x27;s gas used as zero, regardless of what was declared in the header. This ensures that base fee adjustments remain responsive to actual chain usage, and prevents manipulation of the fee market through incorrect gas declarations.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;data-availability-and-economic-incentives&quot;&gt;Data Availability and Economic Incentives&lt;&#x2F;h3&gt;
&lt;p&gt;Block proposers MUST declare correct gas usage or lose transaction fees when execution is reverted. This aligns incentives for correct gas declaration and ensures execution integrity.&lt;&#x2F;p&gt;
&lt;p&gt;Even when a block&#x27;s execution is reverted due to incorrect gas declaration, the transaction data (calldata, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930&lt;&#x2F;a&gt; access lists, and blob data) MUST still be stored by all nodes for syncing and block validation purposes. This requirement creates a potential attack vector where malicious actors could attempt to place large amounts of data on-chain at a reduced cost by intentionally invalidating blocks through incorrect gas declarations.&lt;&#x2F;p&gt;
&lt;p&gt;However, this attack is not economically sustainable for several reasons:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Block proposers who invalidate blocks through incorrect gas declarations lose all execution layer rewards associated with the block.&lt;&#x2F;li&gt;
&lt;li&gt;The attack requires control of block production, which is a scarce resource in the consensus layer.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The economic costs of forgoing block rewards significantly outweigh any potential benefits, making such attacks financially impractical under normal network conditions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Cancelation for ERC-7540 Tokenized Vaults</title>
        <published>2025-02-18T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Jeroen Offerijns</name><uri>https://github.com/hieronx</uri>
	</author>
	
	<author>
		<name>Vikram Arun</name><uri>https://github.com/vikramarun</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7887/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7887-cancelation-for-erc-7540-tokenized-vaults/22906" />
        

        <id>https://wg-eips.ritovision.com/7887/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7887"
            label="ERC-7887" />
        

        
        

        
        <summary type="html">Extension of ERC-7540 with cancelation support</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7887/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The following standard extends &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7540&#x2F;&quot;&gt;ERC-7540&lt;&#x2F;a&gt; by adding support for asynchronous cancelation flows.&lt;&#x2F;p&gt;
&lt;p&gt;New methods are added to asynchronously cancel a deposit or redeem Request, view the status of the cancelation Request, and claim the assets or shares as a result of the cancelation Request.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Shares or assets locked for Requests can be stuck in the Pending state. For some use cases, such as redeeming from a pool of long-dated real-world assets, this can take a considerable amount of time.&lt;&#x2F;p&gt;
&lt;p&gt;This standard expands the scope of Asynchronous ERC-7540 Vaults by adding cancelation support.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;p&gt;The existing definitions from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7540&#x2F;&quot;&gt;ERC-7540&lt;&#x2F;a&gt; apply.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;cancelation-lifecycle&quot;&gt;Cancelation Lifecycle&lt;&#x2F;h3&gt;
&lt;p&gt;After submission, cancelation Requests go through Pending, Claimable, and Claimed stages. An example lifecycle for a deposit cancelation Request is visualized in the table below.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;strong&gt;State&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;strong&gt;User&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;strong&gt;Vault&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Pending&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;cancelDepositRequest(requestId, controller)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;pendingCancelDepositRequest[controller] = true&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Claimable&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;em&gt;Internal cancelation fulfillment&lt;&#x2F;em&gt;:  &lt;code&gt;pendingCancelDepositRequest[controller] = false&lt;&#x2F;code&gt;; &lt;code&gt;claimableCancelDepositRequest[controller] = assets&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Claimed&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;claimCancelDepositRequest(requestId, receiver, controller)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;claimableDepositRequest[controller] -= assets&lt;&#x2F;code&gt;; &lt;code&gt;asset.balanceOf[receiver] += assets&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;&lt;code&gt;pendingCancelDepositRequest&lt;&#x2F;code&gt; and &lt;code&gt;claimableCancelDepositRequest&lt;&#x2F;code&gt; are defined in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7887&#x2F;#methods&quot;&gt;Methods&lt;&#x2F;a&gt; section.&lt;&#x2F;p&gt;
&lt;p&gt;Requests MUST NOT skip or otherwise short-circuit the Claim state. In other words, to initiate and claim a Request, a user MUST call both cancel* and the corresponding Claim function separately, even in the same block. Vaults MUST NOT &quot;push&quot; tokens onto the user after a Request, users MUST &quot;pull&quot; the tokens via the Claim function.&lt;&#x2F;p&gt;
&lt;p&gt;Requests MAY skip straight from the Pending to the Claimable stage, in the case of synchronous cancelation flows.&lt;&#x2F;p&gt;
&lt;p&gt;While a deposit cancelation Request is Pending, new deposit Requests are blocked. Likewise, while a redeem cancelation Request is Pending, new redeem Requests are blocked.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;methods&quot;&gt;Methods&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;canceldepositrequest&quot;&gt;&lt;code&gt;cancelDepositRequest&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Submits a Request for asynchronous deposit cancelation. This places the Request in Pending state, with a corresponding increase in &lt;code&gt;pendingCancelDepositRequest&lt;&#x2F;code&gt; for the full amount of the pending deposit Request.&lt;&#x2F;p&gt;
&lt;p&gt;When the cancelation is Pending, new deposit Requests are blocked and &lt;code&gt;requestDeposit&lt;&#x2F;code&gt; MUST revert.&lt;&#x2F;p&gt;
&lt;p&gt;When the cancelation is Claimable, &lt;code&gt;claimableCancelDepositRequest&lt;&#x2F;code&gt; will be increased for the &lt;code&gt;controller&lt;&#x2F;code&gt;. &lt;code&gt;claimCancelDepositRequest&lt;&#x2F;code&gt; can subsequently be called by &lt;code&gt;controller&lt;&#x2F;code&gt; to receive &lt;code&gt;assets&lt;&#x2F;code&gt;. A Request MAY transition straight to Claimable state but MUST NOT skip the Claimable state.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;controller&lt;&#x2F;code&gt; MUST equal &lt;code&gt;msg.sender&lt;&#x2F;code&gt; unless the &lt;code&gt;controller&lt;&#x2F;code&gt; has approved the &lt;code&gt;msg.sender&lt;&#x2F;code&gt; as an operator.&lt;&#x2F;p&gt;
&lt;p&gt;MUST emit the &lt;code&gt;CancelDepositRequest&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ancelDepositRequest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;onpayable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;equestId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ontroller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;pendingcanceldepositrequest&quot;&gt;&lt;code&gt;pendingCancelDepositRequest&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Whether the given &lt;code&gt;requestId&lt;&#x2F;code&gt; and &lt;code&gt;controller&lt;&#x2F;code&gt; have a pending deposit cancelation Request.&lt;&#x2F;p&gt;
&lt;p&gt;MUST NOT show any variations depending on the caller.&lt;&#x2F;p&gt;
&lt;p&gt;MUST NOT revert unless due to integer overflow caused by an unreasonably large input.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; p&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;endingCancelDepositRequest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;equestId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ontroller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;sPending&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ool&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;claimablecanceldepositrequest&quot;&gt;&lt;code&gt;claimableCancelDepositRequest&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The amount of &lt;code&gt;assets&lt;&#x2F;code&gt; in Claimable cancelation state for the &lt;code&gt;controller&lt;&#x2F;code&gt; to claim.&lt;&#x2F;p&gt;
&lt;p&gt;MUST NOT show any variations depending on the caller.&lt;&#x2F;p&gt;
&lt;p&gt;MUST NOT revert unless due to integer overflow caused by an unreasonably large input.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;laimableCancelDepositRequest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;equestId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ontroller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ssets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;claimcanceldepositrequest&quot;&gt;&lt;code&gt;claimCancelDepositRequest&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Claims the deposit cancelation Request with &lt;code&gt;requestId&lt;&#x2F;code&gt; and &lt;code&gt;controller&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Transfers &lt;code&gt;assets&lt;&#x2F;code&gt; to &lt;code&gt;receiver&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;controller&lt;&#x2F;code&gt; MUST equal &lt;code&gt;msg.sender&lt;&#x2F;code&gt; unless the &lt;code&gt;controller&lt;&#x2F;code&gt; has approved the &lt;code&gt;msg.sender&lt;&#x2F;code&gt; as an operator.&lt;&#x2F;p&gt;
&lt;p&gt;MUST emit the &lt;code&gt;ClaimCancelDepositRequest&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;laimCancelDepositRequest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;onpayable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;equestId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eceiver&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ontroller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;cancelredeemrequest&quot;&gt;&lt;code&gt;cancelRedeemRequest&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Submits a Request for asynchronous redeem cancelation. This places the Request in Pending state, with a corresponding increase in &lt;code&gt;pendingCancelRedeemRequest&lt;&#x2F;code&gt; for the full amount of the pending redeem Request.&lt;&#x2F;p&gt;
&lt;p&gt;When the cancelation is Pending, new redeem Requests are blocked and &lt;code&gt;requestRedeem&lt;&#x2F;code&gt; MUST revert.&lt;&#x2F;p&gt;
&lt;p&gt;When the cancelation is Claimable, &lt;code&gt;claimableCancelRedeemRequest&lt;&#x2F;code&gt; will be increased for the &lt;code&gt;controller&lt;&#x2F;code&gt;. &lt;code&gt;claimCancelRedeemRequest&lt;&#x2F;code&gt; can subsequently be called by &lt;code&gt;controller&lt;&#x2F;code&gt; to receive &lt;code&gt;shares&lt;&#x2F;code&gt;. A Request MAY transition straight to Claimable state but MUST NOT skip the Claimable state.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;controller&lt;&#x2F;code&gt; MUST equal &lt;code&gt;msg.sender&lt;&#x2F;code&gt; unless the &lt;code&gt;controller&lt;&#x2F;code&gt; has approved the &lt;code&gt;msg.sender&lt;&#x2F;code&gt; as an operator.&lt;&#x2F;p&gt;
&lt;p&gt;MUST emit the &lt;code&gt;CancelRedeemRequest&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ancelRedeemRequest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;onpayable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;equestId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ontroller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;pendingcancelredeemrequest&quot;&gt;&lt;code&gt;pendingCancelRedeemRequest&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Whether the given &lt;code&gt;requestId&lt;&#x2F;code&gt; and &lt;code&gt;controller&lt;&#x2F;code&gt; have a pending redeem cancelation Request.&lt;&#x2F;p&gt;
&lt;p&gt;MUST NOT show any variations depending on the caller.&lt;&#x2F;p&gt;
&lt;p&gt;MUST NOT revert unless due to integer overflow caused by an unreasonably large input.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; p&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;endingCancelRedeemRequest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;equestId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ontroller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;sPending&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ool&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;claimablecancelredeemrequest&quot;&gt;&lt;code&gt;claimableCancelRedeemRequest&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The amount of &lt;code&gt;shares&lt;&#x2F;code&gt; in Claimable cancelation state for the &lt;code&gt;controller&lt;&#x2F;code&gt; to claim.&lt;&#x2F;p&gt;
&lt;p&gt;MUST NOT show any variations depending on the caller.&lt;&#x2F;p&gt;
&lt;p&gt;MUST NOT revert unless due to integer overflow caused by an unreasonably large input.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;laimableCancelRedeemRequest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;equestId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ontroller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;hares&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;claimcancelredeemrequest&quot;&gt;&lt;code&gt;claimCancelRedeemRequest&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Claims the redeem cancelation Request with &lt;code&gt;requestId&lt;&#x2F;code&gt; and &lt;code&gt;controller&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Transfers &lt;code&gt;assets&lt;&#x2F;code&gt; to &lt;code&gt;receiver&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;controller&lt;&#x2F;code&gt; MUST equal &lt;code&gt;msg.sender&lt;&#x2F;code&gt; unless the &lt;code&gt;controller&lt;&#x2F;code&gt; has approved the &lt;code&gt;msg.sender&lt;&#x2F;code&gt; as an operator.&lt;&#x2F;p&gt;
&lt;p&gt;MUST emit the &lt;code&gt;ClaimCancelRedeemRequest&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;laimCancelRedeemRequest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;onpayable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;equestId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eceiver&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; o&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;wner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;events&quot;&gt;Events&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;canceldepositrequest-1&quot;&gt;&lt;code&gt;CancelDepositRequest&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;controller&lt;&#x2F;code&gt; has requested cancelation of their deposit Request with request ID &lt;code&gt;requestId&lt;&#x2F;code&gt;. &lt;code&gt;sender&lt;&#x2F;code&gt; is the caller of the &lt;code&gt;cancelDepositRequest&lt;&#x2F;code&gt; which may not be equal to the &lt;code&gt;controller&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST be emitted when a deposit cancelation Request is submitted using the &lt;code&gt;cancelDepositRequest&lt;&#x2F;code&gt; method.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; C&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ancelDepositRequest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;vent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ontroller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;equestId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;canceldepositclaim&quot;&gt;&lt;code&gt;CancelDepositClaim&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;controller&lt;&#x2F;code&gt; has claimed their deposit cancelation Request with request ID &lt;code&gt;requestId&lt;&#x2F;code&gt;. &lt;code&gt;receiver&lt;&#x2F;code&gt; is the destination of the &lt;code&gt;assets&lt;&#x2F;code&gt;. &lt;code&gt;sender&lt;&#x2F;code&gt; is the caller of the &lt;code&gt;claimCancelDepositRequest&lt;&#x2F;code&gt; which may not be equal to the &lt;code&gt;controller&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST be emitted when a deposit cancelation Request is submitted using the &lt;code&gt;claimCancelDepositRequest&lt;&#x2F;code&gt; method.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; C&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ancelDepositClaim&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;vent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ontroller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eceiver&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;equestId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ssets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;cancelredeemrequest-1&quot;&gt;&lt;code&gt;CancelRedeemRequest&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;controller&lt;&#x2F;code&gt; has requested cancelation of their deposit Request with request ID &lt;code&gt;requestId&lt;&#x2F;code&gt;. &lt;code&gt;sender&lt;&#x2F;code&gt; is the caller of the &lt;code&gt;cancelRedeemRequest&lt;&#x2F;code&gt; which may not be equal to the &lt;code&gt;controller&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST be emitted when a redeem cancelation Request is submitted using the &lt;code&gt;cancelRedeemRequest&lt;&#x2F;code&gt; method.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; C&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ancelRedeemRequest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;vent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ontroller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;equestId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;cancelredeemclaim&quot;&gt;&lt;code&gt;CancelRedeemClaim&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;controller&lt;&#x2F;code&gt; has claimed their redeem cancelation Request with request ID &lt;code&gt;requestId&lt;&#x2F;code&gt;. &lt;code&gt;receiver&lt;&#x2F;code&gt; is the destination of the &lt;code&gt;shares&lt;&#x2F;code&gt;. &lt;code&gt;sender&lt;&#x2F;code&gt; is the caller of the &lt;code&gt;claimCancelRedeemRequest&lt;&#x2F;code&gt; which may not be equal to the &lt;code&gt;controller&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST be emitted when a redeem cancelation Request is submitted using the &lt;code&gt;claimCancelRedeemRequest&lt;&#x2F;code&gt; method.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; C&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ancelRedeemClaim&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;vent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ontroller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eceiver&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;equestId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;hares&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;erc-165-support&quot;&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; support&lt;&#x2F;h3&gt;
&lt;p&gt;Smart contracts implementing this Vault standard MUST implement the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;p&gt;Asynchronous deposit Vaults with cancelation support MUST return the constant value &lt;code&gt;true&lt;&#x2F;code&gt; if &lt;code&gt;0x8bf840e3&lt;&#x2F;code&gt; is passed through the &lt;code&gt;interfaceID&lt;&#x2F;code&gt; argument.&lt;&#x2F;p&gt;
&lt;p&gt;Asynchronous redemption Vaults with cancelation support MUST return the constant value &lt;code&gt;true&lt;&#x2F;code&gt; if &lt;code&gt;0xe76cffc7&lt;&#x2F;code&gt; is passed through the &lt;code&gt;interfaceID&lt;&#x2F;code&gt; argument.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;blocking-requests-during-cancelation&quot;&gt;Blocking Requests during Cancelation&lt;&#x2F;h3&gt;
&lt;p&gt;When &lt;code&gt;cancelDepositRequest&lt;&#x2F;code&gt; is called by a &lt;code&gt;controller&lt;&#x2F;code&gt;, new deposit Requests are blocked for this &lt;code&gt;controller&lt;&#x2F;code&gt;, and the equivalent applies to the redeem flow.&lt;&#x2F;p&gt;
&lt;p&gt;This requirement simplifies the possible states of vaults implementing asynchronous cancelation flows.&lt;&#x2F;p&gt;
&lt;p&gt;The alternative would create possible states where a cancelation is pending and a new deposit Request is triggered, leading to the current state being complex to read for integrators.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;mandated-support-for-erc-165&quot;&gt;Mandated Support for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Implementing support for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; is mandated because of the optionality of flows as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7540&#x2F;&quot;&gt;ERC-7540&lt;&#x2F;a&gt;. Integrations can use the &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; method to check whether a vault is fully asynchronous, partially asynchronous, or fully synchronous (for which it is just following the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4626&#x2F;&quot;&gt;ERC-4626&lt;&#x2F;a&gt;), and use a single contract to support all cases.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The interface is fully backwards compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7540&#x2F;&quot;&gt;ERC-7540&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Existing security considerations from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7540&#x2F;&quot;&gt;ERC-7540&lt;&#x2F;a&gt; apply.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Crosschain Broadcaster</title>
        <published>2025-02-18T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Henry Arneson</name><uri>https://github.com/godzillaba</uri>
	</author>
	
	<author>
		<name>Chris Buckland</name><uri>https://github.com/yahgwai</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7888/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/new-erc-cross-chain-broadcaster/22927" />
        

        <id>https://wg-eips.ritovision.com/7888/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7888"
            label="ERC-7888" />
        

        
        

        
        <summary type="html">Trustless storage-based message broadcasting for rollups.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7888/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC defines a protocol for cross-rollup messaging using state commitments. Users can broadcast messages on a source chain, and those messages can be verified on any other chain that shares a common ancestor with the source chain.&lt;&#x2F;p&gt;
&lt;p&gt;A state commitment is a &lt;code&gt;bytes32&lt;&#x2F;code&gt; hash that commits to a chain&#x27;s state (e.g., block hash or state root). The protocol supports different types of state commitments depending on what the rollup commits to its parent chain. Block hashes are the recommended state commitment, but state roots or other commitments may be used, such as batch hashes (since some rollups don&#x27;t commit single blocks, but batches of blocks instead).&lt;&#x2F;p&gt;
&lt;p&gt;Each chain deploys a singleton Receiver and Broadcaster contract. Broadcasters store messages; Receivers verify the Broadcasters&#x27; state on remote chains. To do this, a Receiver first verifies a chain of state commitment proofs to recover a remote state commitment, then verifies the Broadcaster&#x27;s state at that commitment.&lt;&#x2F;p&gt;
&lt;p&gt;Critically, the logic for verifying state commitment proofs is not hardcoded in the Receiver. Instead, it delegates this to a user specified list of StateProver contracts. Each StateProver defines how to verify a state commitment proof for a specific home chain to recover the state commitment of a specific target chain. Because the state commitment schemes and layouts of rollup contracts can change over time, the state commitment proof verification process itself must also be upgradeable—hence the StateProvers are upgradeable. This flexible, upgradeable proof verification model is the core contribution of this standard.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The Ethereum ecosystem is experiencing a rapid growth in the number of rollup chains. As the number of chains grows, the experience becomes more fragmented for users, creating a need for trustless &quot;interop&quot; between rollup chains. These rollup chains, hosted on different rollup stacks, have heterogeneous properties, and as yet there does not exist a simple, trustless, unified mechanism for sending messages between these diverse chains.&lt;&#x2F;p&gt;
&lt;p&gt;Many classes of applications could benefit from a unified system for broadcasting messages across chains. Some examples include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Intent-Based Protocols:&lt;&#x2F;strong&gt; These protocols enable &quot;fillers&quot; to quickly execute crosschain actions on behalf of users, followed by slower, trustless messaging to settle these actions. However, due to the lack of a simple, unified interface for sending settlement messages, intent protocols often develop proprietary methods. This raises adoption barriers for fillers, integrators, and new protocols. A pluggable, standardized messaging solution that works across rollup stacks would allow developers and standards authors to focus on other components of the intent stack, such as fulfillment constraints, order formats, and escrow.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Governance of multichain apps:&lt;&#x2F;strong&gt; Multichain apps often have a single chain where core governance contracts are located. A standardized broadcast messaging system simplifies the dissemination of proposal results to all instances of a multichain app.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Multichain Oracles:&lt;&#x2F;strong&gt; Some classes of oracles may benefit from being able to post their data to a single chain, while having that same data easily accessible across many other chains.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;compatibility-requirements&quot;&gt;Compatibility Requirements&lt;&#x2F;h3&gt;
&lt;p&gt;Chains must satisfy the following conditions to be compatible with the system:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Must store finalized state commitments on the parent chain&lt;&#x2F;li&gt;
&lt;li&gt;Must store parent chain state commitments in child chain state&lt;&#x2F;li&gt;
&lt;li&gt;Must be EVM equivalent with L1. StateProvers are deployed as copies on many chains, so need to behave the same on all those chains&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; STATE_PROVER_POINTER_SLOT &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;eip7888.pointer.slot&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;state-commitments&quot;&gt;State Commitments&lt;&#x2F;h3&gt;
&lt;p&gt;A &lt;strong&gt;state commitment&lt;&#x2F;strong&gt; is a &lt;code&gt;bytes32&lt;&#x2F;code&gt; hash that commits to the state of a chain at a particular point in time. This commitment is produced by the rollup and serves as a cryptographic representation of the chain&#x27;s state. The most common state commitments are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Block hash&lt;&#x2F;strong&gt;: A hash of the block header, which is the recommended state commitment for most implementations&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;State root&lt;&#x2F;strong&gt;: The root of the state tree (e.g., Merkle-Patricia Trie) or other state commitment structure&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Batch hash&lt;&#x2F;strong&gt;: A hash of a batch of blocks, used by some rollups that commit batches of blocks rather than individual blocks&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The choice of state commitment depends on what the rollup commits to its parent chain. Different rollups may use different state commitments, and the StateProver is responsible for verifying proofs that recover these commitments from the parent chain&#x27;s state.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;broadcaster&quot;&gt;Broadcaster&lt;&#x2F;h3&gt;
&lt;p&gt;The Broadcaster is responsible for storing messages in state to be read by Receivers on other chains. Callers of the Broadcaster are known as Publishers. The Broadcaster stores only 32 byte messages.&lt;&#x2F;p&gt;
&lt;p&gt;The Broadcaster does not accept duplicate messages from the same publisher.&lt;&#x2F;p&gt;
&lt;div align=&quot;center&quot;&gt;
&lt;img src=&quot;.&#x2F;assets&#x2F;broadcasting.svg&quot; alt=&quot;Figure 1&quot; width=&quot;30%&quot;&#x2F;&gt;
&lt;br&#x2F;&gt;
&lt;em&gt;Figure 1: A Publisher at address 0x4 calling a Broadcaster at address 0x3&lt;&#x2F;em&gt;
&lt;&#x2F;div&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Broadcasts messages to receivers.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IBroadcaster&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a message is broadcast.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  message&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The message that was broadcast by the publisher.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  publisher&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the publisher.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MessageBroadcast&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; message&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; publisher&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Broadcasts a message. Callers are called &amp;quot;publishers&amp;quot;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    MUST revert if the publisher has already broadcast the message.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         MUST emit MessageBroadcast.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         MUST store block.timestamp in slot keccak(message, msg.sender).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         MAY use additional transmission mechanisms (e.g., child-to-parent native bridges) to make messages visible.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  message&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The message to broadcast.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; broadcastMessage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; message&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;stateprovers&quot;&gt;StateProvers&lt;&#x2F;h3&gt;
&lt;p&gt;StateProvers prove a unidirectional link between two chains that have direct access to each other&#x27;s finalized state commitments. The chains in this link are called the &lt;strong&gt;home chain&lt;&#x2F;strong&gt; and the &lt;strong&gt;target chain&lt;&#x2F;strong&gt;. StateProvers are responsible for verifying state commitment proofs to prove the existence of finalized target state commitments in the state of the home chain. Block hashes are the recommended state commitment, but implementations may use other commitments (e.g., state roots, batch hashes).&lt;&#x2F;p&gt;
&lt;p&gt;Since the StateProvers are unidirectional, each chain needs to have two:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;One whose home is the child chain and target is the parent chain.&lt;&#x2F;li&gt;
&lt;li&gt;One whose home is the parent chain and target is the child chain.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;StateProvers MUST ensure that they will have the same deployed code hash on all chains.&lt;&#x2F;p&gt;
&lt;div align=&quot;center&quot;&gt;
&lt;img src=&quot;.&#x2F;assets&#x2F;BHP.svg&quot; alt=&quot;Figure 2&quot; width=&quot;30%&quot;&#x2F;&gt;
&lt;br&#x2F;&gt;
&lt;em&gt;Figure 2: A StateProver with home chain L and target chain M&lt;&#x2F;em&gt;
&lt;&#x2F;div&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The IStateProver is responsible for retrieving the state commitment of its target chain given its home chain&amp;#39;s state.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         The home chain&amp;#39;s state is given either by a state commitment and proof, or by the StateProver executing on the home chain.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         A single home and target chain are fixed by the logic of this contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IStateProver&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify the state commitment of the target chain given the state commitment of the home chain and a proof.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    MUST revert if called on the home chain.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         MUST revert if the input is invalid or the input is not sufficient to determine the state commitment.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         MUST return a target chain state commitment.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         MUST be pure, with 1 exception: MAY read address(this).code.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  homeStateCommitment&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The state commitment of the home chain.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  input&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Any necessary input to determine a target chain state commitment from the home chain state commitment.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; targetStateCommitment&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The state commitment of the target chain.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verifyTargetStateCommitment&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; homeStateCommitment&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; input&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; targetStateCommitment&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the state commitment of the target chain. Does so by directly accessing state on the home chain.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    MUST revert if not called on the home chain.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         MUST revert if the target chain&amp;#39;s state commitment cannot be determined.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         MUST return a target chain state commitment.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         SHOULD use the input to determine a specific state commitment to return. (e.g. input could be a block number)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         SHOULD NOT read from its own storage. This contract is not meant to have state.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         MAY make external calls.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  input&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Any necessary input to fetch a target chain state commitment.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; targetStateCommitment&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The state commitment of the target chain.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getTargetStateCommitment&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; input&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; targetStateCommitment&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify a storage slot given a target chain state commitment and a proof.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    This function MUST NOT assume it is being called on the home chain.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         MUST revert if the input is invalid or the input is not sufficient to determine a storage slot and its value.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         MUST return a storage slot and its value on the target chain.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         MUST be pure, with 1 exception: MAY read address(this).code.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         While messages MUST be stored in storage slots, alternative reading mechanisms may be used in some cases.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  targetStateCommitment&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The state commitment of the target chain.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  input&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Any necessary input to determine a single storage slot and its value.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the account on the target chain.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The storage slot of the account on the target chain.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The value of the storage slot.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verifyStorageSlot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; targetStateCommitment&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; input&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; slot&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The version of the state commitment prover.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    MUST be pure, with 1 exception: MAY read address(this).code.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; version&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;stateproverpointers&quot;&gt;StateProverPointers&lt;&#x2F;h3&gt;
&lt;p&gt;StateProvers can be used to get or verify target state commitments, however since their verification logic is immutable, changes to the structure of the home or target chain can break the logic in these Provers. A StateProverPointer is a Pointer to a StateProver which can be updated if proving logic needs to change.&lt;&#x2F;p&gt;
&lt;p&gt;StateProverPointers are used to reference StateProvers as opposed to referencing Provers directly. To that end, wherever a StateProver is deployed a StateProverPointer needs to be deployed to reference it.&lt;&#x2F;p&gt;
&lt;p&gt;StateProverPointers allow a permissioned party to update the Prover reference within the Pointer. Choosing which party should have the permission to update the Prover reference should be carefully considered. The general rule is that if an update to the target or home chain could break the logic in the current Prover, then the party, or mechanism, able to make that update should also be given permission to update the Prover. See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7888&#x2F;#security-considerations&quot;&gt;Security Considerations&lt;&#x2F;a&gt; for more information on StateProverPointer ownership and updates.&lt;&#x2F;p&gt;
&lt;p&gt;When updating a StateProverPointer to point to a new StateProver implementation:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The home and target chain of the new StateProver MUST be identical to the previous StateProver.&lt;&#x2F;li&gt;
&lt;li&gt;The new StateProver MUST have a higher version than the previous StateProver.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;StateProverPointers MUST store the code hash of the StateProver implementation in slot &lt;code&gt;STATE_PROVER_POINTER_SLOT&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;div align=&quot;center&quot;&gt;
&lt;img src=&quot;.&#x2F;assets&#x2F;pointer.svg&quot; alt=&quot;Figure 3&quot; width=&quot;30%&quot;&#x2F;&gt;
&lt;br&#x2F;&gt;
&lt;em&gt;Figure 3: A StateProverPointer at address 0xA pointing to a StateProver with home chain L and target chain M&lt;&#x2F;em&gt;
&lt;&#x2F;div&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  IStateProverPointer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Keeps the code hash of the latest version of a state commitment prover.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         MUST store the code hash in storage slot STATE_PROVER_POINTER_SLOT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         Different versions of the prover MUST have the same home and target chains.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         If the pointer&amp;#39;s prover is updated, the new prover MUST have a higher IStateProver::version() than the old one.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         These pointers are always referred to by their address on their home chain.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IStateProverPointer&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Return the code hash of the latest version of the prover.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; implementationCodeHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Return the address of the latest version of the prover on the home chain.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; implementationAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;routes&quot;&gt;Routes&lt;&#x2F;h3&gt;
&lt;p&gt;A route is a relative path from a Receiver on a local chain to a remote chain. It is constructed of many single degree links dictated by StateProverPointers. Receivers use the StateProvers that the Pointers reference to verify a series of proofs to obtain the remote chain&#x27;s state commitment. A route works with any state commitment scheme (block hashes, state roots, etc.) and is defined by the list of Pointer addresses on their home chains.&lt;&#x2F;p&gt;
&lt;p&gt;A valid route MUST obey the following:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Home chain of the &lt;code&gt;route[0]&lt;&#x2F;code&gt; Pointer must equal the local chain&lt;&#x2F;li&gt;
&lt;li&gt;Target chain of the &lt;code&gt;route[i]&lt;&#x2F;code&gt; Pointer must equal home chain of the &lt;code&gt;route[i+1]&lt;&#x2F;code&gt; Pointer&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;div align=&quot;center&quot;&gt;
&lt;img src=&quot;.&#x2F;assets&#x2F;route.svg&quot; alt=&quot;Figure 4&quot; width=&quot;80%&quot;&#x2F;&gt;
&lt;br&#x2F;&gt;
&lt;em&gt;Figure 4: A route [0xA, 0xB, 0xC] from chain L to chain R&lt;br&#x2F;&gt;
Chain L is an L2, Chain M is Ethereum Mainnet, Chain P is another L2, and Chain R is an L3 settling to Chain P&lt;&#x2F;em&gt;
&lt;&#x2F;div&gt;
&lt;h3 id=&quot;identifiers&quot;&gt;Identifiers&lt;&#x2F;h3&gt;
&lt;p&gt;Accounts on remote chains are identified by the route taken from the local chain plus the address on the remote chain. The Pointer addresses used in the route, along with the remote address, are cumulatively keccak256 hashed together to form a &lt;strong&gt;Remote Account ID&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;In this way any address on a remote chain, including Pointers and Broadcasters, can be uniquely identified relative to the local chain by their Remote Account ID.&lt;&#x2F;p&gt;
&lt;p&gt;ID&#x27;s depend on a route and are therefore always &lt;em&gt;relative&lt;&#x2F;em&gt; to a local chain. In other words, the same account on a given chain will have different ID&#x27;s depending on the route from the local chain.&lt;&#x2F;p&gt;
&lt;p&gt;The Remote Account ID is defined as &lt;code&gt;accumulator([...route, remoteAddress])&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; accumulator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; elems&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; acc&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; elems&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        acc &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;acc&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; elems&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In Figure 4:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The Remote Account ID of Broadcaster at &lt;code&gt;0x3&lt;&#x2F;code&gt; is &lt;code&gt;accumulator([0xA, 0xB, 0xC, 0x3])&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;The Remote Account ID of StateProverPointer &lt;code&gt;0xC&lt;&#x2F;code&gt; is &lt;code&gt;accumulator([0xA, 0xB, 0xC])&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;stateprovercopies&quot;&gt;StateProverCopies&lt;&#x2F;h3&gt;
&lt;p&gt;StateProverCopies are exact copies of StateProvers deployed on non-home chains. When a StateProver code hash is de-referenced from a Pointer, a copy of the StateProver may be used to execute its logic. Since the Pointer references the prover by code hash, a local copy of the Prover can be deployed and used to execute specific proving logic. The Receiver caches a map of &lt;code&gt;mapping(bytes32 stateProverPointerId =&amp;gt; IStateProver stateProverCopy)&lt;&#x2F;code&gt; to keep track of StateProverCopies.&lt;&#x2F;p&gt;
&lt;div align=&quot;center&quot;&gt;
&lt;img src=&quot;.&#x2F;assets&#x2F;BHPCopy.svg&quot; alt=&quot;Figure 5&quot; width=&quot;30%&quot;&#x2F;&gt;
&lt;br&#x2F;&gt;
&lt;em&gt;Figure 5: A StateProverCopy of StateProver M-&gt;P on chain L&lt;&#x2F;em&gt;
&lt;&#x2F;div&gt;
&lt;h3 id=&quot;receiver&quot;&gt;Receiver&lt;&#x2F;h3&gt;
&lt;p&gt;The Receiver is responsible for verifying 32 byte messages deposited in Broadcasters on other chains. The caller provides the Receiver with a route to the remote account and proof to verify the route.&lt;&#x2F;p&gt;
&lt;div align=&quot;center&quot;&gt;
&lt;img src=&quot;.&#x2F;assets&#x2F;receiving.svg&quot; alt=&quot;Figure 6&quot; width=&quot;80%&quot;&#x2F;&gt;
&lt;br&#x2F;&gt;
&lt;em&gt;Figure 6: Example of a Receiver reading a message from a Broadcaster on chain R&lt;&#x2F;em&gt;
&lt;&#x2F;div&gt;
&lt;p&gt;The calls in Figure 6 perform the following operations:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Subscriber calls &lt;code&gt;IReceiver::verifyBroadcastMessage&lt;&#x2F;code&gt;, passing route &lt;code&gt;[0xA, 0xB, 0xC]&lt;&#x2F;code&gt;, proof data, message, publisher.&lt;&#x2F;li&gt;
&lt;li&gt;Receiver calls &lt;code&gt;IStateProverPointer(0xA)::implementationAddress&lt;&#x2F;code&gt; to get the address of StateProver L-&amp;gt;M&lt;&#x2F;li&gt;
&lt;li&gt;Receiver calls &lt;code&gt;IStateProver(Prover L-&amp;gt;M)::getTargetState&lt;&#x2F;code&gt;, passing input given by Subscriber to get a state commitment of chain M.&lt;&#x2F;li&gt;
&lt;li&gt;Receiver calls &lt;code&gt;IStateProver(Prover Copy M-&amp;gt;P)::verifyTargetState&lt;&#x2F;code&gt;, passing chain M&#x27;s state commitment and proof data by Subscriber to get a state commitment of chain P.&lt;&#x2F;li&gt;
&lt;li&gt;Receiver calls &lt;code&gt;IStateProver(Prover Copy P-&amp;gt;R)::verifyTargetState&lt;&#x2F;code&gt;, passing chain P&#x27;s state commitment and proof data by Subscriber to get a state commitment of chain R.&lt;&#x2F;li&gt;
&lt;li&gt;Finally, Receiver calls &lt;code&gt;IStateProver(Prover Copy P-&amp;gt;R)::verifyStateValue&lt;&#x2F;code&gt;, passing input given by Subscriber to get a storage slot from the Broadcaster. The Receiver returns the Broadcaster&#x27;s Remote Account ID and the message&#x27;s timestamp to Subscriber.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Reads messages from a broadcaster.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IReceiver&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Arguments required to read state of an account on a remote chain.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    The proof is always for a single storage slot. If the proof is for multiple slots the IReceiver MUST revert.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         The proof format depends on the state commitment scheme used by the StateProver (e.g., storage proofs).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         While messages MUST be stored in storage slots, alternative reading mechanisms may be used in some cases.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  route&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The home chain addresses of the StateProverPointers along the route to the remote chain.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  scpInputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The inputs to the StateProver &#x2F; StateProverCopies.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  proof&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Proof passed to the last StateProver &#x2F; StateProverCopy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;               to verify a storage slot given a target state commitment.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RemoteReadArgs&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; route&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; scpInputs&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span&gt; proof&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Reads a broadcast message from a remote chain.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  broadcasterReadArgs&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A RemoteReadArgs object:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         - The route points to the broadcasting chain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         - The account proof is for the broadcaster&amp;#39;s account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         - The proof is for the message storage slot (MAY accept proofs of other transmission mechanisms (e.g., child-to-parent native bridges) if the broadcaster contract uses other transmission mechanisms)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  message&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The message to read.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  publisher&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the publisher who broadcast the message.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; broadcasterId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The broadcaster&amp;#39;s unique identifier.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; timestamp&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The timestamp when the message was broadcast.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verifyBroadcastMessage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;RemoteReadArgs&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; broadcasterReadArgs&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; message&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; publisher&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; broadcasterId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; timestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Updates the state commitment prover copy in storage.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         Checks that StateProverCopy has the same code hash as stored in the StateProverPointer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         Checks that the version is increasing.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  scpPointerReadArgs&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A RemoteReadArgs object:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         - The route points to the StateProverPointer&amp;#39;s home chain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         - The account proof is for the StateProverPointer&amp;#39;s account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         - The proof is for the STATE_PROVER_POINTER_SLOT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  scpCopy&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The StateProver copy on the local chain.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; scpPointerId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ID of the StateProverPointer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; updateStateProverCopy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;RemoteReadArgs&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; scpPointerReadArgs&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; IStateProver&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; scpCopy&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; scpPointerId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The StateProverCopy on the local chain corresponding to the scpPointerId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         MUST return 0 if the StateProverPointer does not exist.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; stateProverCopy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; scpPointerId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;IStateProver&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; scpCopy&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;broadcast-vs-unicast&quot;&gt;Broadcast vs Unicast&lt;&#x2F;h3&gt;
&lt;p&gt;A contract on any given chain cannot dictate which other chains can and cannot inspect its state. Contracts are naturally broadcasting their state to anything capable of reading it. Targeted messaging applications can always be built on top of a broadcast messaging system.&lt;&#x2F;p&gt;
&lt;p&gt;See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7888&#x2F;#reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;a&gt; for an example of a unicast application.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;using-storage-proofs&quot;&gt;Using Storage Proofs&lt;&#x2F;h3&gt;
&lt;p&gt;Message reading SHOULD use storage proofs to read messages from storage slots. However, an alternative method to this would be to pass messages (perhaps batched) via the canonical bridges of the chains. However storage proofs have some advantages over this method:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;They only require gas tokens on the chains where the message is sent and received, none on the chains on the route in between.&lt;&#x2F;li&gt;
&lt;li&gt;Batching by default. Since storage slots share a common state root, caching the state root allows readers to open adjacent slots at lower cost. This provides a form of implicit batching, whereas canonical bridges would need to create a form of explicit batching.&lt;&#x2F;li&gt;
&lt;li&gt;If the common ancestor of the two chains is Ethereum, sending a message using the canonical bridges would require sending a transaction on Ethereum, which would likely incur a high cost.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;no-duplicate-messages-per-publisher&quot;&gt;No duplicate messages per publisher&lt;&#x2F;h3&gt;
&lt;p&gt;To allow publishers to send the same message multiple times, some kind of nonce system would need to exist in this ERC. Since nonces can be implemented at the Publisher &#x2F; Subscriber layer, and not all Publishers &#x2F; Subscribers require this feature, it is left out of this ERC.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;cost-comparison&quot;&gt;Cost Comparison&lt;&#x2F;h4&gt;
&lt;p&gt;Here we compare the cost of using storage proofs vs sending messages via the canonical bridge, where the parent chain is Ethereum. Here, we will only consider the cost of the L1 gas as we assume it to dominate the L2 gas costs.&lt;&#x2F;p&gt;
&lt;p&gt;Each step along the route requires 1 storage proof. These proofs can be estimated at roughly 6.5k bytes. These proofs will likely be submitted on an L2&#x2F;L3 and therefore be included in blobs on the L1, which have a fluctuating blob gas price. Since rollups can dynamically switch between calldata and blobs, we can work out a maximum amount of normal L1 gas that could be using the standard cost of calldata as an upper bound. Post Pectra, the upper bound for non-zero-byte calldata is 40 gas per byte, which for 6.5k bytes equates to 260,000 L1 gas.&lt;&#x2F;p&gt;
&lt;p&gt;We want to compare this to sending a single message via a canonical rollup bridge, which is either a parent-&amp;gt;child or child-&amp;gt;parent message. This estimate is dependent on specific implementations of the bridge for different rollup frameworks, but we estimate it to be around 150,000 gas.&lt;&#x2F;p&gt;
&lt;p&gt;This puts the upper bound of the storage proof to be around 2x that of the canonical bridge, but in practice this upper bound is rarely reached. On top of that, the Receiver can implement a caching policy allowing many messages to share the same storage proofs.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;caching&quot;&gt;Caching&lt;&#x2F;h3&gt;
&lt;p&gt;This ERC does not currently describe how the Receiver can cache the results of storage proofs to improve efficiency. In brief, once a storage proof is executed it never needs to be executed again, and instead the result can be stored by the Receiver. This allows messages that share the same, or partially the same, route to share previously executed proofs and instead lookup the result. As an example we can consider the route between two L2s using storage proofs:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Ethereum block hash is looked up directly on L2&#x27; by the Receiver on L2&#x27;&lt;&#x2F;li&gt;
&lt;li&gt;The block hash of L2&#x27;&#x27; is proven using a storage proof&lt;&#x2F;li&gt;
&lt;li&gt;The account root of the Broadcaster on L2&#x27;&#x27; is proven using a storage proof&lt;&#x2F;li&gt;
&lt;li&gt;The slot value in the Broadcaster account is proven using a storage proof
The result of everything up to step 4 in this process can be stored in a Receiver cache and re-used by any unread messages in the Broadcaster. The Receiver can even go further and cache individual nodes in the account trie to make step 4. cheaper for previous messages.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;using-routes-in-identifiers&quot;&gt;Using Routes in Identifiers&lt;&#x2F;h3&gt;
&lt;p&gt;Chains are often identified by chain ID&#x27;s. Chain ID&#x27;s are set by the chain owner so they are not guaranteed to be unique. Using the addresses of the Pointers is guaranteed to be unique as it provides a way to unwrap the nested state commitments embedded in the state roots. A storage slot on a remote chain can be identified by many different remote account ID&#x27;s, but one remote account ID cannot identify more than one storage slot.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;stateprovers-pointers-and-copies&quot;&gt;StateProvers, Pointers, and Copies&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;stateprovers-1&quot;&gt;StateProvers&lt;&#x2F;h4&gt;
&lt;p&gt;Each rollup implements unique logic for managing and storing state commitments. To accommodate this diversity, StateProvers implement chain-specific procedures. This flexibility allows integration with each rollup&#x27;s distinct architecture and state commitment scheme.&lt;&#x2F;p&gt;
&lt;p&gt;The StateProver handles the final step of verifying a storage slot given a target state commitment to accommodate rollups with differing state commitment schemes and formats.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;stateproverpointers-1&quot;&gt;StateProverPointers&lt;&#x2F;h4&gt;
&lt;p&gt;Routes reference StateProvers through Pointers rather than directly. This indirection is crucial because:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Chain upgrades may require StateProver redeployments&lt;&#x2F;li&gt;
&lt;li&gt;Routes must remain stable and valid across these upgrades - ensuring in-flight messages are not broken&lt;&#x2F;li&gt;
&lt;li&gt;Pointers maintain route consistency while allowing StateProver implementations to evolve&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;stateprovercopies-1&quot;&gt;StateProverCopies&lt;&#x2F;h4&gt;
&lt;p&gt;Since StateProverPointers reference StateProvers via their code hash, a copy of the StateProver can be deployed anywhere and reliably understood to contain the same code as that referenced by the Pointer. This allows the Receiver to locally use the code of a StateProver whose home chain is a remote chain.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The following is an example of a one-way crosschain token migrator. The burn side of the migrator is a publisher which sends burn messages through a Broadcaster. The mint side subscribes to these burn messages through a Receiver on another chain.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Message format for the burn and mint migrator.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BurnMessage&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; mintTo&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The burn side of an example one-way cross chain token migrator.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    This contract is considered a &amp;quot;publisher&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Burner&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token to burn.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    IERC20 &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; immutable&lt;&#x2F;span&gt;&lt;span&gt; burnToken&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The broadcaster to publish messages through.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    IBroadcaster &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; immutable&lt;&#x2F;span&gt;&lt;span&gt; broadcaster&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An incrementing nonce, so each burn is a unique message.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; burnCount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Event emitted when tokens are burned.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    Publishers SHOULD emit enough information to reconstruct the message.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Burn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;BurnMessage&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; messageData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;IERC20&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _burnToken&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; IBroadcaster&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _broadcaster&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        burnToken &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _burnToken&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        broadcaster &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _broadcaster&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Burn the tokens and broadcast the event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         The corresponding token minter will subscribe to the message on another chain and mint the tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; burn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; mintTo&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; first, pull in the tokens and burn them&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        burnToken&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        burnToken&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;burn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; next, build a unique message&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        BurnMessage &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;memory&lt;&#x2F;span&gt;&lt;span&gt; messageData &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BurnMessage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;mintTo&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; mintTo&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; burnCount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; message &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;messageData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; finally, broadcast the message&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        broadcaster&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;broadcastMessage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;message&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Burn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;messageData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The mint side of an example one-way cross chain token migrator.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         This contract must be given minting permissions on its token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    This contract is considered a &amp;quot;subscriber&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Minter&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the Burner contract on the other chain.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; immutable&lt;&#x2F;span&gt;&lt;span&gt; burner&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The BroadcasterID corresponding to the broadcaster on the other chain that the Burner uses.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         The Minter will only accept messages published by the Burner through this Broadcaster.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; immutable&lt;&#x2F;span&gt;&lt;span&gt; broadcasterId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The receiver to listen for messages through.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    IReceiver &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; immutable&lt;&#x2F;span&gt;&lt;span&gt; receiver&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A mapping to keep track of which messages have been processed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         Subscribers SHOULD keep track of processed messages because the Receiver does not.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         The Broadcaster ensures messages are unique, so true duplicates are not possible.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; processedMessages&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token to mint.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    IERC20 &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; immutable&lt;&#x2F;span&gt;&lt;span&gt; mintToken&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _burner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _broadcasterId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; IReceiver&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _receiver&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; IERC20&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _mintToken&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        burner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _burner&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        broadcasterId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _broadcasterId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        receiver &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _receiver&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        mintToken &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _mintToken&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Mint the tokens when a message is received.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mintTokens&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;IReceiver&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;RemoteReadArgs&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; broadcasterReadArgs&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; BurnMessage&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; messageData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; calculate the message from the data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; message &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;messageData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ensure the message has not been processed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;processedMessages&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;message&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Minter: Message already processed&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; verify the broadcast message&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt; actualBroadcasterId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; receiver&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;verifyBroadcastMessage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;broadcasterReadArgs&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; message&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; burner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ensure the message is from the expected broadcaster&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;actualBroadcasterId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; broadcasterId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Minter: Invalid broadcaster ID&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; mark the message as processed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        processedMessages&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;message&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; mint tokens to the recipient&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        mintToken&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;messageData&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;mintTo&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; messageData&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;chain-upgrades&quot;&gt;Chain Upgrades&lt;&#x2F;h3&gt;
&lt;p&gt;If a chain upgrades such that a StateProver&#x27;s &lt;code&gt;verifyTargetState&lt;&#x2F;code&gt; or &lt;code&gt;getTargetState&lt;&#x2F;code&gt; functions might return data besides a finalized target state commitment, then invalid messages could be read by a &lt;code&gt;Receiver&lt;&#x2F;code&gt;. For instance, if a chain stores its state commitments on the parent chain in a specific mapping, and that storage slot is later repurposed, then an old StateProver might be able to pass along an invalid state commitment. It is therefore important that either:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;the StateProver is written in such a way to detect changes like this&lt;&#x2F;li&gt;
&lt;li&gt;the owner who is able to repurpose these storage slots is aware of the StateProver and ensures they don&#x27;t break it&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;stateproverpointer-ownership-updates&quot;&gt;StateProverPointer Ownership &#x2F; Updates&lt;&#x2F;h3&gt;
&lt;p&gt;A malicious StateProverPointer owner can DoS or forge messages. However, so can the chain owner responsible for setting the slot of historical parent&#x2F;child state commitments. Therefore it is expected that this chain owner be the same as the owner of the StateProverPointer so as not to introduce additional risks.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If the target chain of the referenced StateProver is the parent chain, the home chain owner is expected to be the StateProverPointer&#x27;s owner.&lt;&#x2F;li&gt;
&lt;li&gt;If the target chain of the referenced StateProver is the child chain, the target chain owner is expected to be the StateProverPointer&#x27;s owner.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;If an owner neglects their responsibility to update the Pointer with new StateProver implementations when necessary, messages could fail to reach their destinations.&lt;&#x2F;p&gt;
&lt;p&gt;If an owner maliciously updates a Pointer to point to a StateProver that produces fraudulent results, messages can be forged.&lt;&#x2F;p&gt;
&lt;p&gt;If there is confidence that a chain along the route connecting them will not upgrade to break a StateProver, an unowned StateProverPointer can be deployed in the absence of a properly owned one.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;message-guarantees&quot;&gt;Message guarantees&lt;&#x2F;h3&gt;
&lt;p&gt;This ERC describes a protocol for ensuring that messages from remote chains CAN be read, but not that they WILL be read. It is the responsibility of the Receiver caller to choose which messages they wish to read.&lt;&#x2F;p&gt;
&lt;p&gt;Since the ERC only uses finalized blocks, messages may take a long time to propagate between chains. Finalisation occurs sequentially in the route, therefore time to read a message is the sum of the finalisation of each of the state commitments at each step in the route.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>API for Hierarchical Accounts</title>
        <published>2025-02-18T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Wilson Cusack</name><uri>https://github.com/wilsoncusack</uri>
	</author>
	
	<author>
		<name>Jake Feldman</name><uri>https://github.com/jakefeldman</uri>
	</author>
	
	<author>
		<name>Montana Wong</name><uri>https://github.com/montycheese</uri>
	</author>
	
	<author>
		<name>Felix Zhang</name><uri>https://github.com/fan-zhang-sv</uri>
	</author>
	
	<author>
		<name>Jake Moxey</name><uri>https://github.com/jxom</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7895/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/wallet-addsubaccount/23013" />
        

        <id>https://wg-eips.ritovision.com/7895/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7895"
            label="ERC-7895" />
        

        
        

        
        <summary type="html">Adds JSON-RPC method for requesting that a universal wallet create or track another account that it owns</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7895/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC introduces a new wallet RPC, &lt;code&gt;wallet_addSubAccount&lt;&#x2F;code&gt;, which allows an app to request a wallet track a smart account that the wallet owns. It also allows apps to request the wallet to provision a new account, owned by the universal wallet with a signer provided by the caller.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Embedded app accounts (onchain accounts specific to a single app) have led to a proliferation of user addresses, which can be difficult for users to keep track of. Many embedded app account users also have a universal wallet, which can be used across apps. With hierarchical ownership–where one smart account can own another–if the embedded app account is a smart account, it could be owned by the user’s universal wallet. This would allow users to be able to control an app account via their universal wallet. However, though hierarchical ownership is already possible today, there is no way for apps to tell universal wallets about embedded app accounts a user may have. The proposed RPC provides a path for this.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;Account - In this document, “account” means smart account. A smart contract that users transact from.
Sub Account - An account that SHOULD have the main account as an owner of the sub-account. For instance, Account B is a sub-account of Account A if Account A is an owner, i.e. is a signer for Account B.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;json-rpc-methods&quot;&gt;JSON-RPC Methods&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;wallet-addsubaccount&quot;&gt;&lt;code&gt;wallet_addSubAccount&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;wallet_addSubAccount&lt;&#x2F;code&gt; RPC method allows applications to request that the connected account tracks the app account, creating a hierarchy between a universal account and app-embedded accounts. This RPC supports three different use cases.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;request&quot;&gt;Request&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Previously deployed account, i.e. wallet &amp;quot;imports&amp;quot; account &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DeployedAccount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;deployed&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Required: address of the account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  keys&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; never&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x{string}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  factory&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; never&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  factoryData&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; never&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Requester is agnostic to account type and only wants to ensure its signer is an owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CreateAccount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;create&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  keys&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    publicKey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;p256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;webcrypto-p256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;webauthn-p256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Undeployed account, app creates the account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UndeployedAccount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;undeployed&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  keys&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; never&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x{string}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; in Hex&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Required: factory address to create the account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  factory&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Required: factory calldata for the account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  factoryData&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Request&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  method&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;wallet_addSubAccount&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  params&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; JSON-RPC method version&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    version&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; JSON-RPC method account &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    account&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CreateAccount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DeployedAccount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UndeployedAccount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;response&quot;&gt;Response&lt;&#x2F;h5&gt;
&lt;p&gt;Factory data and factory address are OPTIONAL and SHOULD be returned when available. Deployed accounts MAY not have these fields.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Response&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Optional: factory address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  factory&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Optional: factory calldata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  factoryData&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;createaccount&quot;&gt;&lt;code&gt;CreateAccount&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;p&gt;Creates a new Sub Account. By default, if no signing keys (&lt;code&gt;keys&lt;&#x2F;code&gt;) are provided, the Sub Account&#x27;s signing key MUST be created &amp;amp; managed by the wallet. However, an application MAY optionally provide a set of signing keys (&lt;code&gt;keys&lt;&#x2F;code&gt;) for the Sub Account. A wallet SHOULD make the universal account an owner of the account, creating a hierarchical relationship between the newly created account and the universal account.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Parameters&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; never&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Optional: keys of the account to be created&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  keys&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    publicKey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;p256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;webcrypto-p256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;webauthn-p256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  factory&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; never&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  factoryData&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; never&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;undeployedaccount&quot;&gt;UndeployedAccount&lt;&#x2F;h5&gt;
&lt;p&gt;An undeployed account is an account that an application has created, but has not yet deployed.. The wallet can decide whether or not it is appropriate to deploy it. Wallets SHOULD validate that the universal account is an owner. Either through decoding the factoryData or simulating the deployment that there is a hierarchy between the universal account and newly created account.&lt;&#x2F;p&gt;
&lt;p&gt;Example: the application creates an account and generates the counterfactual address for the user to airdrop funds to. Once there is an account relationship with the universal account, the user wishes to perform a transaction, in which the wallet will deploy the account in order to execute the respective transaction.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Parameters&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Required: address of the account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  keys&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; never&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  factory&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; never&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  factoryData&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; never&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;deployedaccount&quot;&gt;&lt;code&gt;DeployedAccount&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;p&gt;An existing account could be any smart that an app or user wants to track via their universal wallet.&lt;&#x2F;p&gt;
&lt;p&gt;Example: The user wants to define a hierarchical relationship between an existing app account and their universal wallet.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Previously deployed account &amp;quot;import&amp;quot;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Parameters&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Required: address of the account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  keys&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; never&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  factory&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; never&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  factoryData&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; never&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;external-rpc-capabilities&quot;&gt;External RPC Capabilities&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;wallet-connect&quot;&gt;&lt;code&gt;wallet_connect&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;This ERC conforms to &lt;!-- TODO: [ERC-7846](.&#x2F;07846.md) --&gt; which includes &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5792&#x2F;&quot;&gt;ERC-5792&lt;&#x2F;a&gt; capabilities specification and introduces two new capabilities for &lt;code&gt;wallet_connect&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;addsubaccount&quot;&gt;&lt;code&gt;addSubAccount&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;p&gt;Adds a sub-account to the universal account.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Request&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  addSubAccount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    account&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CreateAccount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DeployedAccount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UndeployedAccount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;subaccounts&quot;&gt;&lt;code&gt;subAccounts&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;p&gt;Fetches all sub-accounts of the universal account (including any added ones).&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Response&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  subAccounts&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    factory&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    factoryData&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;wallet-getcapabilities&quot;&gt;&lt;code&gt;wallet_getCapabilities&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;This ERC conforms with &lt;code&gt;wallet_getCapabilities&lt;&#x2F;code&gt; &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5792&#x2F;&quot;&gt;ERC-5792&lt;&#x2F;a&gt;. The response will accommodate addSubAccount support for wallets that support it.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Response&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  addSubAccount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    supported&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    keyTypes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;p256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;webcrypto-p256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;webauthn-p256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Example &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; response&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x2105&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;addSubAccount&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;supported&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;keyTypes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;webauthn-p256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x14A34&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;addSubAccount&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;supported&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;keyTypes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;webauthn-p256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;naming&quot;&gt;Naming&lt;&#x2F;h3&gt;
&lt;p&gt;Initial intent was to leverage existing RPCs, like &lt;code&gt;wallet_connect&lt;&#x2F;code&gt; (e.g. &lt;!-- TODO: [ERC-7846](.&#x2F;07846.md) --&gt; with additional capabilities to add support for these new features, but these methods ultimately lacked flexibility. Then there were custom namespaced RPCs but this resulted with more fragmentation within the community.&lt;&#x2F;p&gt;
&lt;p&gt;Method names explored &lt;code&gt;wallet_linkAccount&lt;&#x2F;code&gt;,  &lt;code&gt;wallet_importAddress&lt;&#x2F;code&gt;, &lt;code&gt;wallet_addAddress&lt;&#x2F;code&gt;, or something else. Multiple RPCs were explored as well, separating create and tracking as two separate RPCs. To consolidate on a single RPC &lt;code&gt;wallet_addSubAccount&lt;&#x2F;code&gt; was selected. This method is more inclusive for EOA use cases.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This standard builds on existing JSON-RPC methods and complements &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5792&#x2F;&quot;&gt;ERC-5792&lt;&#x2F;a&gt; for future extensibility. Wallets can continue supporting legacy methods.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;As more capabilities are added, care should be taken to avoid unpredictable interactions. App specific accounts pose more risk for assets in those accounts. Having a universal account that maintains access to these accounts gives additional security to users and their funds.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;privacy-considerations&quot;&gt;Privacy Considerations&lt;&#x2F;h3&gt;
&lt;p&gt;Account data and any shared capabilities must be handled securely to avoid data leaks or man-in-the-middle attacks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Splitting and Merging of NFTs</title>
        <published>2025-02-15T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Nitin Bhagat</name><uri>https://github.com/nitin312</uri><email>bhagatnitin312@gmail.com</email>
	</author>
	
	<author>
		<name>JongWook Bae</name><email>bae@cwnu.ac.kr</email>
	</author>
	
	<author>
		<name>Su-Hyun Lee</name><email>sleepl@changwon.ac.kr</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7891/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7891-hierarchical-nfts-with-splitting-and-merging/22986" />
        

        <id>https://wg-eips.ritovision.com/7891/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:7891"
            label="ERC-7891" />
        

        
        

        
        <summary type="html">Interface for hierarchical NFTs, enabling splitting a single NFT and merging multiple NFTs</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7891/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard extends &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6150&#x2F;&quot;&gt;EIP-6150&lt;&#x2F;a&gt;. This introduces a structured parent-child relationship between NFTs, allowing an NFT to be fractionally split into multiple child NFTs and merged back into a single entity. It provides interfaces to retrieve an NFT&#x27;s parent, children, and hierarchical status, ensuring flexible ownership management. This standard is particularly useful for applications in fractional ownership, asset distribution, and composable digital assets, opening new possibilities in fields like real estate, gaming, and decentralized finance.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces hierarchical NFTs with splitting and merging capabilities, allowing assets to be dynamically restructured. This proposal is crucial for fractional ownership, gaming assets, and financial instruments, where assets need to be split or merged.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Splitting&lt;&#x2F;strong&gt;: One of the key limitations of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6150&#x2F;&quot;&gt;EIP-6150&lt;&#x2F;a&gt; is its rigid hierarchy, where NFTs are permanently assigned to a parent without the ability to restructure ownership. In many real-world scenarios, assets need to be split into smaller, independent units. This EIP introduces a standardized way to split an NFT into multiple child NFTs, enabling dynamic asset management. For example, in financial markets, a share NFT can be split into multiple fractional share NFTs, allowing investors to own and trade smaller portions of a share.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Merging&lt;&#x2F;strong&gt;: Just as assets need to be split, there are scenarios where multiple NFTs should be combined into a single entity. The proposed EIP enables a merging mechanism, allowing child NFTs to be consolidated into a single parent NFT, allowing asset management and transactions. For instance, in finance, fractional share NFTs can be merged back into a full share NFT, enabling seamless ownership consolidation. This is particularly useful for investors who gradually accumulate fractions of a stock and later want to own a full share.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Share Distribution&lt;&#x2F;strong&gt;: This EIP introduces ownership share management, allowing NFTs to track and distribute fractional ownership among multiple stakeholders. This solves fractional ownership tracking within parent-child NFT structures. This also allows dynamic adjustments of ownership based on splitting and merging actions. For example, a real estate NFT representing a building can have multiple owners with different share percentages. When the NFT is split, the new NFTs retain a proportion of the original ownership share. When merged, the system redistributes the shares accordingly. This Enables multi-party ownership in digital assets.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;how-the-proposed-eip-improves-over-existing-standards&quot;&gt;How the proposed EIP Improves Over Existing Standards&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Feature&lt;&#x2F;th&gt;&lt;th&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;EIP-1155&lt;&#x2F;a&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6150&#x2F;&quot;&gt;EIP-6150&lt;&#x2F;a&gt;&lt;&#x2F;th&gt;&lt;th&gt;EIP (Proposed)&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Unique NFTs&lt;&#x2F;td&gt;&lt;td&gt;✅&lt;&#x2F;td&gt;&lt;td&gt;❌&lt;&#x2F;td&gt;&lt;td&gt;✅&lt;&#x2F;td&gt;&lt;td&gt;✅&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Fungible &amp;amp; Non-Fungible&lt;&#x2F;td&gt;&lt;td&gt;❌&lt;&#x2F;td&gt;&lt;td&gt;✅&lt;&#x2F;td&gt;&lt;td&gt;❌&lt;&#x2F;td&gt;&lt;td&gt;✅&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Hierarchical Structure&lt;&#x2F;td&gt;&lt;td&gt;❌&lt;&#x2F;td&gt;&lt;td&gt;❌&lt;&#x2F;td&gt;&lt;td&gt;✅&lt;&#x2F;td&gt;&lt;td&gt;✅&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Parent-Child Relationship&lt;&#x2F;td&gt;&lt;td&gt;❌&lt;&#x2F;td&gt;&lt;td&gt;❌&lt;&#x2F;td&gt;&lt;td&gt;✅&lt;&#x2F;td&gt;&lt;td&gt;✅&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;NFT Splitting&lt;&#x2F;td&gt;&lt;td&gt;❌&lt;&#x2F;td&gt;&lt;td&gt;❌&lt;&#x2F;td&gt;&lt;td&gt;❌&lt;&#x2F;td&gt;&lt;td&gt;✅&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;NFT Merging&lt;&#x2F;td&gt;&lt;td&gt;❌&lt;&#x2F;td&gt;&lt;td&gt;❌&lt;&#x2F;td&gt;&lt;td&gt;❌&lt;&#x2F;td&gt;&lt;td&gt;✅&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Fractional Ownership&lt;&#x2F;td&gt;&lt;td&gt;❌&lt;&#x2F;td&gt;&lt;td&gt;✅&lt;&#x2F;td&gt;&lt;td&gt;❌&lt;&#x2F;td&gt;&lt;td&gt;✅&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Ownership Redistribution&lt;&#x2F;td&gt;&lt;td&gt;❌&lt;&#x2F;td&gt;&lt;td&gt;❌&lt;&#x2F;td&gt;&lt;td&gt;❌&lt;&#x2F;td&gt;&lt;td&gt;✅&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;Every compliant contract MUST implement this proposal, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;EIP-165&lt;&#x2F;a&gt;, and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6150&#x2F;&quot;&gt;ERC-6150&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0x43cb816b.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7891&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is IERC6150, IERC721, IERC165 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a child token is minted under a parent with an assigned share.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; parentId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ID of the parent token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; childId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ID of the newly minted child token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; share&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Share percentage assigned to the child token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Split&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; parentId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; childId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; share&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when multiple child tokens are merged into a new token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; newTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ID of the newly minted merged token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; mergedTokenIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Array of token IDs that were merged&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Merged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newTokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; mergedTokenIds&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Mints a new root-level parent NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenURI&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; URI string pointing to token metadata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ID of the newly minted parent token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mintParent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenURI&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Mints a child NFT under a given parent with a specific share allocation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; parentId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the parent token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _share&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Share percentage assigned to the child token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ID of the newly minted child token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mintSplit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; parentId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _share&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Merges multiple child NFTs into a new token under the same parent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; parentId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the parent token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Array of child token IDs to be merged&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; newTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ID of the newly minted merged token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mintMerge&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; parentId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenIds&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newTokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfers share ownership from one NFT to another.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Token ID receiving the share&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Token ID sending the share&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _share&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Share percentage to transfer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; sharePass&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _share&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Burns an NFT and transfers its share back to the parent NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ID of the token to burn&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; burn&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP builds upon &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6150&#x2F;&quot;&gt;ERC-6150&lt;&#x2F;a&gt; to introduce a structured mechanism for share-based hierarchical NFTs, enabling splitting, merging, and fractional ownership directly within the token standard. The proposal reuses &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6150&#x2F;&quot;&gt;ERC-6150&lt;&#x2F;a&gt;&#x27;s parent-child architecture to preserve compatibility and reduce implementation complexity. Share management is embedded natively through internal mappings, allowing each token to track its fractional ownership independently without relying on external protocols. Functions like &lt;code&gt;mintSplit&lt;&#x2F;code&gt; and &lt;code&gt;mintMerge&lt;&#x2F;code&gt; are designed to reflect real-world asset behaviors, clearly distinguishing between asset decomposition and consolidation. The &lt;code&gt;sharePass&lt;&#x2F;code&gt; function facilitates redistribution of shares between tokens without requiring minting or burning, offering an efficient internal transfer mechanism. A &lt;code&gt;burn&lt;&#x2F;code&gt; function is included to allow share return to the parent on destruction, aligning with ownership. Overall, the interface is purposefully minimal and intuitive, designed for extensibility while maintaining gas efficiency and semantic clarity.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The proposed EIP extends &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6150&#x2F;&quot;&gt;EIP-6150&lt;&#x2F;a&gt;, making it backward compatible.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Implementation: &lt;a href=&quot;..&#x2F;.&#x2F;assets&#x2F;ERC7891.sol&quot;&gt;EIP-7891&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;No security considerations were found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>ModExp Gas Cost Increase</title>
        <published>2025-02-11T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Marcin Sobczak</name><uri>https://github.com/marcindsobczak</uri>
	</author>
	
	<author>
		<name>Marek Moraczyński</name><uri>https://github.com/MarekM25</uri>
	</author>
	
	<author>
		<name>Marcos Maceo</name><uri>https://github.com/stdevMac</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7883/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7883-modexp-gas-cost-increase/22841" />
        

        <id>https://wg-eips.ritovision.com/7883/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7883"
            label="EIP-7883" />
        

        
        

        
        <summary type="html">Increases cost of ModExp precompile</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7883/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is modifying the &lt;code&gt;ModExp&lt;&#x2F;code&gt; precompile pricing algorithm introduced in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2565&#x2F;&quot;&gt;EIP-2565&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently the &lt;code&gt;ModExp&lt;&#x2F;code&gt; precompile is underpriced in certain scenarios relative to its resource consumption. By adjusting the pricing formula, this EIP aims to address these discrepancies, making &lt;code&gt;ModExp&lt;&#x2F;code&gt; sufficiently efficient to enable potential increases in the block gas limit.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Upon activation of this EIP, the gas cost of calling the precompile at address &lt;code&gt;0x0000000000000000000000000000000000000005&lt;&#x2F;code&gt; will be calculated as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def calculate_multiplication_complexity(base_length, modulus_length):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_length = max(base_length, modulus_length)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    words = math.ceil(max_length &#x2F; 8)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    multiplication_complexity = 16&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if max_length &amp;gt; 32: multiplication_complexity = 2 * words**2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return multiplication_complexity&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def calculate_iteration_count(exponent_length, exponent):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    iteration_count = 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if exponent_length &amp;lt;= 32 and exponent == 0: iteration_count = 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    elif exponent_length &amp;lt;= 32: iteration_count = exponent.bit_length() - 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    elif exponent_length &amp;gt; 32: iteration_count = (16 * (exponent_length - 32)) + ((exponent &amp;amp; (2**256 - 1)).bit_length() - 1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return max(iteration_count, 1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def calculate_gas_cost(base_length, modulus_length, exponent_length, exponent):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    multiplication_complexity = calculate_multiplication_complexity(base_length, modulus_length)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    iteration_count = calculate_iteration_count(exponent_length, exponent)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return max(500, math.floor(multiplication_complexity * iteration_count))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The specific changes from the algorithm defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2565&#x2F;&quot;&gt;EIP-2565&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;h3 id=&quot;1-increased-minimal-and-general-price&quot;&gt;1. Increased minimal and general price&lt;&#x2F;h3&gt;
&lt;p&gt;The gas cost calculation is modified from:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return max(200, math.floor(multiplication_complexity * iteration_count &#x2F; 3))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;to:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return max(500, math.floor(multiplication_complexity * iteration_count))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This change increases the minimum gas cost from 200 to 500 and triples the general cost by removing the division by 3.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;2-increase-cost-for-exponents-larger-than-32-bytes&quot;&gt;2. Increase cost for exponents larger than 32 bytes&lt;&#x2F;h3&gt;
&lt;p&gt;The gas cost calculation is modified from:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    elif exponent_length &amp;gt; 32: iteration_count = (8 * (exponent_length - 32)) + ((exponent &amp;amp; (2**256 - 1)).bit_length() - 1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;to:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    elif exponent_length &amp;gt; 32: iteration_count = (16 * (exponent_length - 32)) + ((exponent &amp;amp; (2**256 - 1)).bit_length() - 1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The multiplier for exponents larger than 32 bytes is increased from 8 to 16, doubling its impact.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;3-assume-the-minimal-base-modulus-length-to-be-32-and-increase-the-cost-when-it-is-larger-than-32-bytes&quot;&gt;3. Assume the minimal base &#x2F; modulus length to be 32 and increase the cost when it is larger than 32 bytes&lt;&#x2F;h3&gt;
&lt;p&gt;The gas cost calculation is modified from:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def calculate_multiplication_complexity(base_length, modulus_length):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_length = max(base_length, modulus_length)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    words = math.ceil(max_length &#x2F; 8)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return words**2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;to:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def calculate_multiplication_complexity(base_length, modulus_length):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_length = max(base_length, modulus_length)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    words = math.ceil(max_length &#x2F; 8)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    multiplication_complexity = 16&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if max_length &amp;gt; 32: multiplication_complexity = 2 * words**2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return multiplication_complexity&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This change introduces a minimal multiplication complexity of 16 and doubles the complexity if the base or modulus length exceeds 32 bytes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Benchmarking the &lt;code&gt;ModExp&lt;&#x2F;code&gt; precompile revealed several scenarios where its gas cost was significantly underestimated. Pricing adjustments are designed to rectify underpriced edge cases by modifying the existing &lt;code&gt;ModExp&lt;&#x2F;code&gt; pricing formula parameters. Specifically, the minimum cost for &lt;code&gt;ModExp&lt;&#x2F;code&gt; will rise from 200 to 500 (a 150% increase), the general cost will triple (a 200% increase), a minimum base&#x2F;modulus length of 32 bytes will be assumed and the cost will scale more aggressively when the base, modulus, or exponent exceed 32 bytes. These modifications aim to ensure that the &lt;code&gt;ModExp&lt;&#x2F;code&gt; precompile&#x27;s performance, even in its most resource-intensive edge cases across all execution layer clients, no longer impedes potential increases to the block gas limit.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a backwards-incompatible change. However, similar gas repricings have occurred multiple times in the Ethereum ecosystem, and their effects are well understood.&lt;&#x2F;p&gt;
&lt;p&gt;An empirical analysis of this proposal is available &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7883&#x2F;assets&#x2F;call_analysis&#x2F;&quot;&gt;here&lt;&#x2F;a&gt;, with a separate breakdown by affected entities provided &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7883&#x2F;assets&#x2F;entity_analysis&#x2F;&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;The most common usages (approximately 99.69% of historical &lt;code&gt;Modexp&lt;&#x2F;code&gt; calls as of January 4th, 2025) will experience either a 150% increase (from 200 to 500 gas) or a 200% increase (tripling from approximately 1360 gas).
No changes are made to the underlying interface or arithmetic algorithms, allowing existing test vectors to be reused. The table below presents the updated gas costs for these test vectors:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Test Case&lt;&#x2F;th&gt;&lt;th&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2565&#x2F;&quot;&gt;EIP-2565&lt;&#x2F;a&gt; Pricing&lt;&#x2F;th&gt;&lt;th&gt;EIP-7883 Pricing&lt;&#x2F;th&gt;&lt;th&gt;Increase&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_1_square&lt;&#x2F;td&gt;&lt;td&gt;200&lt;&#x2F;td&gt;&lt;td&gt;500&lt;&#x2F;td&gt;&lt;td&gt;150%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_1_qube&lt;&#x2F;td&gt;&lt;td&gt;200&lt;&#x2F;td&gt;&lt;td&gt;500&lt;&#x2F;td&gt;&lt;td&gt;150%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_1_pow0x10001&lt;&#x2F;td&gt;&lt;td&gt;341&lt;&#x2F;td&gt;&lt;td&gt;2048&lt;&#x2F;td&gt;&lt;td&gt;501%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_2_square&lt;&#x2F;td&gt;&lt;td&gt;200&lt;&#x2F;td&gt;&lt;td&gt;512&lt;&#x2F;td&gt;&lt;td&gt;156%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_2_qube&lt;&#x2F;td&gt;&lt;td&gt;200&lt;&#x2F;td&gt;&lt;td&gt;512&lt;&#x2F;td&gt;&lt;td&gt;156%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_2_pow0x10001&lt;&#x2F;td&gt;&lt;td&gt;1365&lt;&#x2F;td&gt;&lt;td&gt;8192&lt;&#x2F;td&gt;&lt;td&gt;501%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_3_square&lt;&#x2F;td&gt;&lt;td&gt;341&lt;&#x2F;td&gt;&lt;td&gt;2048&lt;&#x2F;td&gt;&lt;td&gt;501%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_3_qube&lt;&#x2F;td&gt;&lt;td&gt;341&lt;&#x2F;td&gt;&lt;td&gt;2048&lt;&#x2F;td&gt;&lt;td&gt;501%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_3_pow0x10001&lt;&#x2F;td&gt;&lt;td&gt;5461&lt;&#x2F;td&gt;&lt;td&gt;32768&lt;&#x2F;td&gt;&lt;td&gt;500%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_4_square&lt;&#x2F;td&gt;&lt;td&gt;1365&lt;&#x2F;td&gt;&lt;td&gt;8192&lt;&#x2F;td&gt;&lt;td&gt;501%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_4_qube&lt;&#x2F;td&gt;&lt;td&gt;1365&lt;&#x2F;td&gt;&lt;td&gt;8192&lt;&#x2F;td&gt;&lt;td&gt;501%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_4_pow0x10001&lt;&#x2F;td&gt;&lt;td&gt;21845&lt;&#x2F;td&gt;&lt;td&gt;131072&lt;&#x2F;td&gt;&lt;td&gt;500%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_5_square&lt;&#x2F;td&gt;&lt;td&gt;5461&lt;&#x2F;td&gt;&lt;td&gt;32768&lt;&#x2F;td&gt;&lt;td&gt;500%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_5_qube&lt;&#x2F;td&gt;&lt;td&gt;5461&lt;&#x2F;td&gt;&lt;td&gt;32768&lt;&#x2F;td&gt;&lt;td&gt;500%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_5_pow0x10001&lt;&#x2F;td&gt;&lt;td&gt;87381&lt;&#x2F;td&gt;&lt;td&gt;524288&lt;&#x2F;td&gt;&lt;td&gt;500%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_marius_1_even&lt;&#x2F;td&gt;&lt;td&gt;2057&lt;&#x2F;td&gt;&lt;td&gt;45296&lt;&#x2F;td&gt;&lt;td&gt;2102%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_guido_1_even&lt;&#x2F;td&gt;&lt;td&gt;2298&lt;&#x2F;td&gt;&lt;td&gt;51136&lt;&#x2F;td&gt;&lt;td&gt;2125%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_guido_2_even&lt;&#x2F;td&gt;&lt;td&gt;2300&lt;&#x2F;td&gt;&lt;td&gt;51152&lt;&#x2F;td&gt;&lt;td&gt;2124%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_guido_3_even&lt;&#x2F;td&gt;&lt;td&gt;5400&lt;&#x2F;td&gt;&lt;td&gt;32400&lt;&#x2F;td&gt;&lt;td&gt;500%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_guido_4_even&lt;&#x2F;td&gt;&lt;td&gt;1026&lt;&#x2F;td&gt;&lt;td&gt;94448&lt;&#x2F;td&gt;&lt;td&gt;9105%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_marcin_1_base_heavy&lt;&#x2F;td&gt;&lt;td&gt;200&lt;&#x2F;td&gt;&lt;td&gt;1152&lt;&#x2F;td&gt;&lt;td&gt;476%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_marcin_1_exp_heavy&lt;&#x2F;td&gt;&lt;td&gt;215&lt;&#x2F;td&gt;&lt;td&gt;16624&lt;&#x2F;td&gt;&lt;td&gt;7632%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_marcin_1_balanced&lt;&#x2F;td&gt;&lt;td&gt;200&lt;&#x2F;td&gt;&lt;td&gt;1200&lt;&#x2F;td&gt;&lt;td&gt;500%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_marcin_2_base_heavy&lt;&#x2F;td&gt;&lt;td&gt;867&lt;&#x2F;td&gt;&lt;td&gt;5202&lt;&#x2F;td&gt;&lt;td&gt;500%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_marcin_2_exp_heavy&lt;&#x2F;td&gt;&lt;td&gt;852&lt;&#x2F;td&gt;&lt;td&gt;16368&lt;&#x2F;td&gt;&lt;td&gt;1821%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_marcin_2_balanced&lt;&#x2F;td&gt;&lt;td&gt;996&lt;&#x2F;td&gt;&lt;td&gt;5978&lt;&#x2F;td&gt;&lt;td&gt;500%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_marcin_3_base_heavy&lt;&#x2F;td&gt;&lt;td&gt;677&lt;&#x2F;td&gt;&lt;td&gt;2032&lt;&#x2F;td&gt;&lt;td&gt;200%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_marcin_3_exp_heavy&lt;&#x2F;td&gt;&lt;td&gt;765&lt;&#x2F;td&gt;&lt;td&gt;4080&lt;&#x2F;td&gt;&lt;td&gt;433%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_marcin_3_balanced&lt;&#x2F;td&gt;&lt;td&gt;1360&lt;&#x2F;td&gt;&lt;td&gt;4080&lt;&#x2F;td&gt;&lt;td&gt;200%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP does not introduce any new functionality or make existing operations cheaper, therefore there are no direct security concerns related to new attack vectors or reduced costs. The primary security consideration for this EIP is the potential for &lt;code&gt;ModExp&lt;&#x2F;code&gt; scenarios to be overpriced, though this is deemed a lesser risk compared to the current underpricing issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EOF - EXTCODEADDRESS instruction</title>
        <published>2025-02-08T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Danno Ferrin</name><uri>https://github.com/shemnon</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7880/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7880-eof-extcodeaddress-instruction/22845" />
        

        <id>https://wg-eips.ritovision.com/7880/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7880"
            label="EIP-7880" />
        

        
        

        
        <summary type="html">Add EXTCODEADDRESS instruction to EOF to address code delegation use cases</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7880/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Add an instruction to EOF that reads code delegation designations from an account without requiring code introspection.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;EOFv1 as scoped in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7692&#x2F;&quot;&gt;EIP-7692&lt;&#x2F;a&gt; removes code introspection capabilities from the EVM, preventing EOF from reading raw code values such as code delegation designations set by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt;. There are a number of use cases where reading the delegation designation of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; would allow contracts to be more proactive about user experience issues.&lt;&#x2F;p&gt;
&lt;p&gt;One example is a managed proxy contract. Such a contract may want to ensure security by not allowing the proxy to be updated to a delegated address. There are also safety concerns with pointing to a delegation, as the contract may be updated to non EOF code and &lt;code&gt;EXTDELEGATECALL&lt;&#x2F;code&gt; will no longer be able to call the contract, due to changes outside the control of the managed proxy contract.&lt;&#x2F;p&gt;
&lt;p&gt;Another example are contracts that need to ensure that the delegation has not changed over a limited scope of time, such as sponsorships. This will prevent a transaction from receiving gas sponsorship, changing the delegation, and performing an act different than what was approved. Sponsors can encode the delegation into the transaction data and verify with this instruction.&lt;&#x2F;p&gt;
&lt;p&gt;Finally, there is the case where contracts may want to de-escalate risks and only accept a small number of delegations for any given contract. To enable this validation contracts will need to be able to resolve the actual address of delegation, not just know that one exists.&lt;&#x2F;p&gt;
&lt;p&gt;To address this the essential task of the designation parsing is moved into a new opcode &lt;code&gt;EXTCODEADDRESS&lt;&#x2F;code&gt;, where the task of calculating the delegated address will be performed. For non-delegated accounts or empty accounts the address will be the same as the queried address.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;GAS_COLD_ACCOUNT_ACCESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Defined as &lt;code&gt;2600&lt;&#x2F;code&gt; in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;execution-specs&#x2F;blob&#x2F;1adcc1bfe774798bcacc685aebc17bd9935078c3&#x2F;src&#x2F;ethereum&#x2F;cancun&#x2F;vm&#x2F;gas.py#L65-L66&quot;&gt;Ethereum Execution Layer Spec Constants&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;GAS_WARM_ACCESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Defined as &lt;code&gt;100&lt;&#x2F;code&gt; in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;execution-specs&#x2F;blob&#x2F;1adcc1bfe774798bcacc685aebc17bd9935078c3&#x2F;src&#x2F;ethereum&#x2F;cancun&#x2F;vm&#x2F;gas.py#L65-L66&quot;&gt;Ethereum Execution Layer Spec Constants&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;We introduce a new EOFv1 instruction &lt;code&gt;EXTCODEADDRESS&lt;&#x2F;code&gt; (&lt;code&gt;0xea&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;EOF code which contains this instruction prior to the fork activating this instruction is considered invalid. Beginning with the first block this EIP is activated in, this instruction is added to the set of valid EOFv1 instructions.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;execution-semantics&quot;&gt;Execution Semantics&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;extcodeaddress&quot;&gt;&lt;code&gt;EXTCODEADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Deduct &lt;code&gt;GAS_WARM_ACCESS&lt;&#x2F;code&gt; gas&lt;&#x2F;li&gt;
&lt;li&gt;pop 1 argument &lt;code&gt;target_address&lt;&#x2F;code&gt; from the stack&lt;&#x2F;li&gt;
&lt;li&gt;if &lt;code&gt;target_address&lt;&#x2F;code&gt; has any of the high 12 bytes set to a non-zero value (i.e. it does not contain a 20-byte address), then halt with an exceptional failure
&lt;ul&gt;
&lt;li&gt;Notice: Future expansion of the EVM address space may enlarge the number of valid addresses. Do not rely on this step always halting with the current restrictions.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;deduct &lt;code&gt;GAS_COLD_ACCOUNT_ACCESS - GAS_WARM_ACCESS&lt;&#x2F;code&gt; if &lt;code&gt;target_address&lt;&#x2F;code&gt; is not in &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt; and add &lt;code&gt;target_address&lt;&#x2F;code&gt; to &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Load the code from &lt;code&gt;target_address&lt;&#x2F;code&gt; and refer to it as &lt;code&gt;loaded_code&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;loaded_code&lt;&#x2F;code&gt; indicates a delegation designator (for example, prefixed with &lt;code&gt;0xef0100&lt;&#x2F;code&gt; as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt;) push the address of the designation onto the stack.
&lt;ul&gt;
&lt;li&gt;Notice: if &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; delegation designations are updated in a future fork (such as allowing chained delegations), then this section is expected to comply with any such hypothetical changes.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Otherwise, push &lt;code&gt;target_address&lt;&#x2F;code&gt; onto the stack.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note: If &lt;code&gt;target_address&lt;&#x2F;code&gt; points to an account with a contract mid-creation, then &lt;code&gt;target_address&lt;&#x2F;code&gt; is returned. If delegation designator points to an account with a contract mid-creation, then address of the designation is returned.&lt;&#x2F;p&gt;
&lt;p&gt;Note: Only &lt;code&gt;target_address&lt;&#x2F;code&gt; is warmed. If a delegation is found the address that it is delegated to is not added to the &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt;. Also, whether the delegated address is in &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt; has no impact on the gas charged for the operation.&lt;&#x2F;p&gt;
&lt;p&gt;Note: This operation straddles the line between &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; code reading and code executing instructions.  The operation steps work as a code reading instruction, but the value returned is the resolved address as through it is a code executing instruction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is very similar to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7761&#x2F;&quot;&gt;EIP-7761&lt;&#x2F;a&gt;, which introduces account type introspection. Its rationale is included by reference as they all apply to this situation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;alternative-return-the-whole-designation-have-contract-parse&quot;&gt;Alternative: Return the whole designation, have contract parse&lt;&#x2F;h3&gt;
&lt;p&gt;One alternative is to have a specially limited &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt; that would return just delegation designations. Apart from the general objections to code introspection this would then lock in and limit delegation designation formats and capabilities that must be preserved in future forks. By allowing access to the effect of the delegation rather than the mechanism, EOF preserves space for the mechanism to be changed without breaking existing code.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;EXTCODEADDRESS&lt;&#x2F;code&gt; at &lt;code&gt;0xea&lt;&#x2F;code&gt; can be introduced in a backwards compatible manner into EOFv1 (no bump to version), because &lt;code&gt;0xea&lt;&#x2F;code&gt; has been rejected by EOF validation prior to the activation of this EIP, and there are no EOF contracts on-chain with an &lt;code&gt;0xea&lt;&#x2F;code&gt; instruction which would have their behavior altered.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; code delegation is a new feature that has not been made accessible to mainnet yet. EIP authors will keep abreast of any developments and reflect on their impact to this proposed instruction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Compute Gas Cost Increase</title>
        <published>2025-02-05T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Jacek Glen</name><uri>https://github.com/JacekGlen</uri>
	</author>
	
	<author>
		<name>Lukasz Glen</name><uri>https://github.com/lukasz-glen</uri>
	</author>
	
	<author>
		<name>Maria Silva</name><uri>https://github.com/misilva73</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7904/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/gas-cost-repricing-to-reflect-computational-complexity/23067" />
        

        <id>https://wg-eips.ritovision.com/7904/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7904"
            label="EIP-7904" />
        

        
        

        
        <summary type="html">Gas Cost Increase to reflect computational complexity and transaction throughput increase</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7904/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal raises the gas costs of 13 compute operations and precompiles performing worse than 60 million gas per second (Mgas&#x2F;s). By removing these operations as bottlenecks, we can further increase the block gas limit, thus allowing for a higher throughput on the remaining operations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Recent empirical measurements have shown that EVM operations don&#x27;t have a price consistent with their computational complexity. Some operations are significantly underpriced, leading to potential bottlenecks in transaction processing. These bottlenecks limit the overall throughput of the Ethereum network, as they consume a disproportionate amount of computational resources relative to their gas cost.&lt;&#x2F;p&gt;
&lt;p&gt;By increasing the gas costs of these underpriced operations, we can alleviate these bottlenecks. This change will enable a higher block gas limit, allowing more transactions to be processed per block. The result is an overall increase in network throughput, improving the efficiency and scalability of the Ethereum blockchain.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Upon activation of this EIP, the following gas costs will be updated.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;opcodes&quot;&gt;Opcodes&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&quot;text-align: center&quot;&gt;Operation&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;Parameter&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;Current Gas&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;New Gas (Rounded)&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;Change&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;ADDMOD&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;constant&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;8&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;8&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;0.0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;DIV&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;constant&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;5&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;15&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;2.0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;KECCAK256&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;constant&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;30&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;45&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;0.5&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;KECCAK256&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;msg_size&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;6&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;6&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;0.0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;MOD&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;constant&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;5&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;12&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;1.4&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;MULMOD&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;constant&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;8&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;11&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;0.38&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;SDIV&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;constant&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;5&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;20&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;3.0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;SMOD&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;constant&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;5&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;5&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;precompiles&quot;&gt;Precompiles&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&quot;text-align: center&quot;&gt;Operation&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;Parameter&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;Current Gas&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;New Gas (Rounded)&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;Change&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;BLAKE2F&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;constant&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;0&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;170&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;NA&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;BLAKE2F&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;num_rounds&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;1&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;2&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;1.0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;BLS12_G1ADD&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;constant&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;375&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;643&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;0.71&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;BLS12_G2ADD&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;constant&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;600&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;765&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;0.27&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;ECADD&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;constant&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;150&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;314&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;1.09&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;ECPAIRING&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;constant&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;45000&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;45000&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;0.0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;ECPAIRING&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;num_pairs&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;34000&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;34103&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;0.0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;ECRECOVER&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;constant&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;3000&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;3000&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;POINT_EVALUATION&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;constant&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;50000&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;89363&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;0.79&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;empirical-estimation-of-gas-costs&quot;&gt;Empirical Estimation of Gas Costs&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;selecting-which-operations-to-reprice&quot;&gt;Selecting which Operations to Reprice&lt;&#x2F;h4&gt;
&lt;p&gt;The operations selected for repricing in this EIP were chosen based on their estimated million gas per second (Mgas&#x2F;s) performance. For this EIP, a performance target of &lt;strong&gt;60 million gas per second&lt;&#x2F;strong&gt; is chosen. With this performance target, we will be able to increase the base throughput of the chain by 3x from our current 20Mgas&#x2F;s performance.&lt;&#x2F;p&gt;
&lt;p&gt;An important consideration for repricing is whether poor performance is isolated to a single client or affects multiple implementations. This is important for distinguishing between:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Operations that genuinely need repricing (multiple clients struggle)&lt;&#x2F;li&gt;
&lt;li&gt;Operations where a specific client needs optimization (only one client struggles)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;To separate these cases, we analyze the performance of each operation the 5 main clients (besu, erigon, geth, nethermind and reth). If the difference in performance between the worst and the second-worst client is higher than 20%, we consider the operation to be a candidate for optimization rather than repricing. All the remaining operations are candidates for repricing.&lt;&#x2F;p&gt;
&lt;p&gt;The report with the full details of this step can be accessed &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7904&#x2F;assets&#x2F;included_operations&#x2F;&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;data-collection&quot;&gt;Data Collection&lt;&#x2F;h4&gt;
&lt;p&gt;The gas costs proposed in this EIP are based on the actual time each operation takes to run on the various execution clients. Similar to the methodology used in the Gas Cost Estimator project, synthetic blocks that isolate and stress individual EVM operations are generated. To benchmark a single operation, different blocks are created by varying the number of single operations executed and by changing the parameter values to the operation. The EEST benchmark suite contains the tests used to generate these blocks.&lt;&#x2F;p&gt;
&lt;p&gt;Then, the Nethermind&#x27;s Performance Benchmarking tool is used to collect the needed metrics. This tool returns the total execution time of the block and the number of times each operation was executed. Each test block is run multiple times on each client to account for variability in execution time.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;What about dynamic costs?&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Some operations have a dynamic component to their costs. For example, the &lt;code&gt;EXP&lt;&#x2F;code&gt; opcode has a gas cost that grows linearly with the exponent&#x27;s byte size. In these cases, the test benchmarks the operation with a range of inputs to assess how the resource costs vary with different inputs.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;What about differences between client implementations?&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Ultimately, we require a single cost model that is independent of the client&#x27;s implementation. Although the decision may be different in a specific situation, the general rule is to take the worst client result that cannot be optimized. This means that the worst-performing client on a given operation and resource combination will define the cost of that operation for the entire network. This is the safer and most conservative choice.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;runtime-estimation&quot;&gt;Runtime Estimation&lt;&#x2F;h4&gt;
&lt;p&gt;To estimate the runtime of a single operation from the total execution time of the corresponding synthetic blocks, a &lt;strong&gt;Non-Negative Least Squares (NNLS) Linear Regression&lt;&#x2F;strong&gt; is used. This model enforces that all coefficients are non-negative, thus ensuring execution time cannot be negative. The model estimates runtime as a linear combination of:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Constant term (intercept)&lt;&#x2F;strong&gt;: Base overhead for executing the test, which includes setup and teardown time&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Operation count (slope)&lt;&#x2F;strong&gt;: Number of times the operation is executed in the test. This parameter is the one that allows us to estimate the per-operation runtime.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Operation-specific parameters&lt;&#x2F;strong&gt;: Variables like number of rounds, message size, or number of pairs&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;For simple operations (i.e., without additional parameters), the model estimates: &lt;code&gt;runtime = intercept + slope × operation_count&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;For variable operations, the model estimates: &lt;code&gt;runtime = intercept + slope × operation_count + param1_coef × operation_count × param1 + param2_coef × operation_count × param2 + ...&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Independent models are created for each client and operation. Only operations and parameters with good model fits (R² &amp;gt; 0.5 and p-value &amp;lt; 0.05) are included in the gas cost proposal to ensure the reliability of the estimates.&lt;&#x2F;p&gt;
&lt;p&gt;The report with the model performance by operation and client can be accessed &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7904&#x2F;assets&#x2F;runtime_estimation&#x2F;2026-01-15_2026-01-29&#x2F;runtime_estimation_autogenerated_report&#x2F;&quot;&gt;here&lt;&#x2F;a&gt;, while the key model outputs can be found &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7904&#x2F;.&#x2F;assets&#x2F;runtime_estimation&#x2F;2026-01-15_2026-01-29&#x2F;results.csv&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;conversion-to-gas-costs&quot;&gt;Conversion to gas costs&lt;&#x2F;h4&gt;
&lt;p&gt;New gas costs are calculated using the same target performance of 60Mgas&#x2F;s. The formula used is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;new_gas = (anchor_rate * runtime_ms) &#x2F; 1000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Where &lt;code&gt;runtime_ms&lt;&#x2F;code&gt; is the estimated runtime in milliseconds from the regression models.&lt;&#x2F;p&gt;
&lt;p&gt;The report with the full details of this step can be accessed &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7904&#x2F;assets&#x2F;runtime_estimation&#x2F;2026-01-15_2026-01-29&#x2F;new_gas_proposal&#x2F;&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;other-projects&quot;&gt;Other Projects&lt;&#x2F;h3&gt;
&lt;p&gt;Several initiatives have explored the real gas costs of EVM operations, providing valuable context for this EIP. Notable examples include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7904&#x2F;.&#x2F;assets&#x2F;gas-cost-estimator-report.pdf&quot;&gt;Gas Cost Estimator&lt;&#x2F;a&gt; project did a similar empirical analysis. It conducted extensive testing across seven widely-used EVM implementations to measure the actual computational effort required by various opcodes and operations. Conducted in a controlled environment to eliminate external variables, the tests produced accurate and reproducible &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7904&#x2F;.&#x2F;assets&#x2F;final_gas_schedule_comparison.csv&quot;&gt;results&lt;&#x2F;a&gt;. The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7904&#x2F;.&#x2F;assets&#x2F;gas-cost-estimator.pdf&quot;&gt;findings&lt;&#x2F;a&gt; highlight misalignments between the current gas cost schedule and the real-world computational complexity of EVM operations.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7883&#x2F;&quot;&gt;EIP-7883&lt;&#x2F;a&gt; - ModExp Gas Cost Increase: This EIP specifically analyzed the ModExp and proposed a revised pricing scheme. When adjusted with our &lt;code&gt;rescale factor&lt;&#x2F;code&gt;, its costs align with this proposal, requiring no further changes. This consistency validates our measuring approach.&lt;&#x2F;li&gt;
&lt;li&gt;Nethermind&#x27;s Gas Benchmarks: This project takes a different approach to measuring gas costs. It uses standalone clients rather than isolated EVM implementations. Despite the methodological difference, its results mirror those of the Gas Cost Estimator, reinforcing our conclusions.&lt;&#x2F;li&gt;
&lt;li&gt;EVM Memory Analysis by @raxhvl: This project focuses on memory-related costs, providing valuable insights into the memory access and expansion costs.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;These projects collectively affirm the need to reassess gas costs and demonstrate broad alignment with our approach.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;computational-complexity-only&quot;&gt;Computational Complexity Only&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP intentionally focuses on computational complexity—measured as execution time on a bare CPU — while excluding network-related costs like state persistency. This ensures the proposed gas cost adjustments remain implementation-agnostic, applicable across diverse EVM clients regardless of their technological stack. By leveraging empirical data from multiple EVM implementations, we establish a universal, verifiable benchmark for computational effort. This focus simplifies estimation and enhances the proposal’s clarity and applicability within Ethereum’s varied ecosystem.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;impact-of-gas-costs-changes&quot;&gt;Impact of Gas Costs Changes&lt;&#x2F;h3&gt;
&lt;p&gt;Raising costs for underpriced operations strengthens security by deterring abuse but may increase transaction fees and reduce throughput.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP adopts a conservative strategy, prioritizing increases for operations that empirical data show as underpriced. This allows us to increase the base throughput of the chain without changing the costs of the majority of the other operations.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;point-evaluation-and-blob-fee-floor-price&quot;&gt;&lt;code&gt;POINT_EVALUATION&lt;&#x2F;code&gt; and Blob Fee Floor Price&lt;&#x2F;h4&gt;
&lt;p&gt;The proposed increase to &lt;code&gt;POINT_EVALUATION&lt;&#x2F;code&gt; gas cost (from 50,000 to 89,363) has implications for the blob fee floor price mechanism established in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7918&#x2F;&quot;&gt;EIP-7918&lt;&#x2F;a&gt;. Under EIP-7918, the blob base fee is bounded by execution costs through a reserve price of &lt;code&gt;BLOB_BASE_COST * base_fee_per_gas&lt;&#x2F;code&gt;, ensuring that blob consumers pay at least a relevant fraction of the market rate for the computational resources they impose on nodes. The computational resources imposed by blobs are the KZG proof commitments for blob transactions and, as such, the &lt;code&gt;BLOB_BASE_COST&lt;&#x2F;code&gt; was originally defined based on the cost of the &lt;code&gt;POINT_EVALUATION&lt;&#x2F;code&gt; precompile. However, for simplicity reasons, we decide not to change the &lt;code&gt;BLOB_BASE_COST&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;consideration-of-zk-snark-proof-generation&quot;&gt;Consideration of ZK-SNARK Proof Generation&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP focuses on optimizing gas costs based on general computational complexity, using a bare CPU as the reference point. Therefore, it does not specifically address the unique demands of ZK-SNARK proof generation. Nevertheless, given that this EIP is only increasing the gas costs of certain operations, it will help rather than hinder proving times for EVM blocks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This is a backwards-incompatible gas repricing that requires a scheduled network upgrade.&lt;&#x2F;p&gt;
&lt;p&gt;Developers and node operators MUST update gas estimation handling to accommodate the new costs. Specifically:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Wallets: Wallets using &lt;code&gt;eth_estimateGas&lt;&#x2F;code&gt; MUST be updated to ensure that they correctly account for the updated gas parameters. Failure to do so could result in underestimating gas, leading to failed transactions.&lt;&#x2F;li&gt;
&lt;li&gt;Node Software: RPC methods such as &lt;code&gt;eth_estimateGas&lt;&#x2F;code&gt; MUST incorporate the updated formula for gas calculation with the new state access cost values.&lt;&#x2F;li&gt;
&lt;li&gt;Contracts with Hardcoded Gas Limits: Contracts that specify hardcoded gas limits for subcalls (e.g., using call(gas, ...)) may face issues if the new gas costs exceed these limits. In these cases, developers MUST review and potentially update these contracts to ensure they function as intended post-upgrade.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Further research might be required to ensure that contracts that use hard coded limits are not broken.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Changing the cost of compute operations could impact the usability of certain applications. More analysis is needed to understand the potential effects on various dApps and user behaviors.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Interoperable Addresses</title>
        <published>2025-02-02T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Teddy</name><uri>https://github.com/0xteddybear</uri>
	</author>
	
	<author>
		<name>Joxes</name><uri>https://github.com/0xJoxess</uri>
	</author>
	
	<author>
		<name>Nick Johnson</name><uri>https://github.com/Arachnid</uri>
	</author>
	
	<author>
		<name>Francisco Giordano</name><uri>https://github.com/frangio</uri>
	</author>
	
	<author>
		<name>Skeletor Spaceman</name><uri>https://github.com/skeletor-spaceman</uri>
	</author>
	
	<author>
		<name>Racu</name><uri>https://github.com/0xRacoon</uri>
	</author>
	
	<author>
		<name>TiTi</name><uri>https://github.com/0xtiti</uri>
	</author>
	
	<author>
		<name>Gori</name><uri>https://github.com/0xGorilla</uri>
	</author>
	
	<author>
		<name>Ardy</name><uri>https://github.com/0xArdy</uri>
	</author>
	
	<author>
		<name>Onizuka</name><uri>https://github.com/onizuka-wl</uri>
	</author>
	
	<author>
		<name>Sam Kaufman</name><uri>https://github.com/SampkaML</uri>
	</author>
	
	<author>
		<name>Marco Stronati</name><uri>https://github.com/paracetamolo</uri>
	</author>
	
	<author>
		<name>Yuliya Alexiev</name><uri>https://github.com/yuliyaalexiev</uri>
	</author>
	
	<author>
		<name>Jeff Lau</name><uri>https://github.com/jefflau</uri>
	</author>
	
	<author>
		<name>Sam Wilson</name><uri>https://github.com/samwilsn</uri>
	</author>
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	<author>
		<name>Thomas Clowes</name><uri>https://github.com/clowestab</uri>
	</author>
	
	<author>
		<name>Mono</name><uri>https://github.com/0xMonoAx</uri>
	</author>
	
	<author>
		<name>Prem Makeig</name><uri>https://github.com/nxt3d</uri>
	</author>
	
	<author>
		<name>Orca</name><uri>https://github.com/0xrcinus</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7930/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7930-interoperable-addresses/23365" />
        

        <id>https://wg-eips.ritovision.com/7930/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7930"
            label="ERC-7930" />
        

        
        

        
        <summary type="html">An extensible binary format to refer to an address specific to one chain.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7930/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal introduces a &lt;strong&gt;binary format&lt;&#x2F;strong&gt; to describe a &lt;em&gt;chain-specific address&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This is achieved through a versioned, length-prefixed binary envelope that supports arbitrary-length data. The interpretation and serialization rules for the data within this envelope are defined by the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ChainAgnostic&#x2F;CAIPs&#x2F;blob&#x2F;29762ef99a6ffea1e07e3f796c0d1a5a95e89b88&#x2F;CAIPs&#x2F;caip-350.md&quot;&gt;CAIP-350&lt;&#x2F;a&gt; companion standard, which provide profiles for each chain type and defines the serialization rules for each namespace.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The address format utilized on Ethereum mainnet (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;55&#x2F;&quot;&gt;ERC-55&lt;&#x2F;a&gt;) is shared by a large number of other blockchains. This format does not encode any information about the chain on which an interaction is intended to occur, which can introduce ambiguity and operational risk.&lt;&#x2F;p&gt;
&lt;p&gt;In practice, this limitation has led each protocol to define its own ad hoc way of representing the combination of address and chain, typically using separate fields and protocol-specific conventions. This fragmentation complicates interoperability across protocols, increases tooling complexity, and leads to inconsistencies at the infrastructure level.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal builds on insights from &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ChainAgnostic&#x2F;CAIPs&#x2F;blob&#x2F;2a7d42aebaffa42d1017c702974395ff5c1b3636&#x2F;CAIPs&#x2F;caip-10.md&quot;&gt;CAIP-10&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ChainAgnostic&#x2F;CAIPs&#x2F;blob&#x2F;2a7d42aebaffa42d1017c702974395ff5c1b3636&#x2F;CAIPs&#x2F;caip-50.md&quot;&gt;CAIP-50&lt;&#x2F;a&gt;. It offers a binary canonical &lt;em&gt;Interoperable Address&lt;&#x2F;em&gt; format which:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Binds together chain identification and the raw address.&lt;&#x2F;li&gt;
&lt;li&gt;Is compact for usage with cross-chain message passing and intent declaration.&lt;&#x2F;li&gt;
&lt;li&gt;Extends beyond EVM blockchains.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;These features can not be added to existing standards as they are not easily extensible - this one is.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;comparisons-with-other-standards&quot;&gt;Comparisons with other standards&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;caip-10&quot;&gt;CAIP-10&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ChainAgnostic&#x2F;CAIPs&#x2F;blob&#x2F;2a7d42aebaffa42d1017c702974395ff5c1b3636&#x2F;CAIPs&#x2F;caip-10.md&quot;&gt;CAIP-10&lt;&#x2F;a&gt; proposes a standard text format to represent an address on a specific chain (referenced by its &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ChainAgnostic&#x2F;CAIPs&#x2F;blob&#x2F;2a7d42aebaffa42d1017c702974395ff5c1b3636&#x2F;CAIPs&#x2F;caip-2.md&quot;&gt;CAIP-2&lt;&#x2F;a&gt; identifier).&lt;&#x2F;p&gt;
&lt;p&gt;The standard &lt;strong&gt;does not&lt;&#x2F;strong&gt; concern itself with the serialization&#x2F;deserialization of the &lt;em&gt;target address&lt;&#x2F;em&gt;. It assumes knowledge of the native address format for each chain and does not enforce any serialization or canonicalization rules.&lt;&#x2F;p&gt;
&lt;p&gt;While it is trivial to add support for chains to &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ChainAgnostic&#x2F;CAIPs&#x2F;blob&#x2F;2a7d42aebaffa42d1017c702974395ff5c1b3636&#x2F;CAIPs&#x2F;caip-10.md&quot;&gt;CAIP-10&lt;&#x2F;a&gt;, the format is not optimized for usage within smart contracts as strings are an inefficient way to store data on-chain.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ChainAgnostic&#x2F;CAIPs&#x2F;blob&#x2F;2a7d42aebaffa42d1017c702974395ff5c1b3636&#x2F;CAIPs&#x2F;caip-10.md&quot;&gt;CAIP-10&lt;&#x2F;a&gt; depends on &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ChainAgnostic&#x2F;CAIPs&#x2F;blob&#x2F;2a7d42aebaffa42d1017c702974395ff5c1b3636&#x2F;CAIPs&#x2F;caip-2.md&quot;&gt;CAIP-2&lt;&#x2F;a&gt;, which limits the chain reference to 32 characters. This constraint means that &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ChainAgnostic&#x2F;CAIPs&#x2F;blob&#x2F;2a7d42aebaffa42d1017c702974395ff5c1b3636&#x2F;CAIPs&#x2F;caip-2.md&quot;&gt;CAIP-2&lt;&#x2F;a&gt; can not losslessy represent a chain. e.g. Solana chains utilize the leading 32 characters of the base58btc-encoded genesis blockhash, which is not a uniquely deterministic way of representing a chain.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;terminology&quot;&gt;Terminology&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;Target Address&lt;&#x2F;strong&gt;
: The address itself, independent of chain context. Serialized per the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ChainAgnostic&#x2F;CAIPs&#x2F;blob&#x2F;29762ef99a6ffea1e07e3f796c0d1a5a95e89b88&#x2F;CAIPs&#x2F;caip-350.md&quot;&gt;CAIP-350&lt;&#x2F;a&gt; rules for the applicable namespace. In the examples below, the target address is &lt;code&gt;0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Chain-specific Address&lt;&#x2F;strong&gt;
: An address representation that includes both the &lt;em&gt;target address&lt;&#x2F;em&gt; &lt;strong&gt;and&lt;&#x2F;strong&gt; the chain being targeted. The following are examples of chain-specific addresses:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;em&gt;Interoperable Address&lt;&#x2F;em&gt; definition outlined in this specification&lt;&#x2F;li&gt;
&lt;li&gt;The addressing format outlined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3770&#x2F;&quot;&gt;ERC-3770&lt;&#x2F;a&gt;, e.g. &lt;code&gt;arb:0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;em&gt;Interoperable Name&lt;&#x2F;em&gt; definition outlined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7828&#x2F;&quot;&gt;ERC-7828&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Interoperable Address&lt;&#x2F;strong&gt;
: A binary payload which unambiguously identifies a &lt;em&gt;target address&lt;&#x2F;em&gt; on a target chain. e.g. &lt;code&gt;0x00010000010114d8da6bf26964af9d7eed9e03e53415d37aa96045&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;interoperable-address-definition&quot;&gt;&lt;em&gt;Interoperable Address&lt;&#x2F;em&gt; Definition&lt;&#x2F;h3&gt;
&lt;p&gt;An &lt;em&gt;Interoperable Address&lt;&#x2F;em&gt; as defined by this standard MUST have the following binary format:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;┌─────────┬───────────┬──────────────────────┬────────────────┬───────────────┬─────────┐&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│ Version │ ChainType │ ChainReferenceLength │ ChainReference │ AddressLength │ Address │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;└─────────┴───────────┴──────────────────────┴────────────────┴───────────────┴─────────┘&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The components outlined above have the following meanings:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Version&lt;&#x2F;strong&gt;
: A 2-byte version identifier. For version 1 (this specification), this MUST be &lt;code&gt;0x0001&lt;&#x2F;code&gt; (big-endian). Future versions SHOULD be standardized in separate ERCs.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;ChainType&lt;&#x2F;strong&gt;
: A 2-byte value corresponding to a CASA namespace. It allows users to interpret and display the &lt;em&gt;ChainReference&lt;&#x2F;em&gt; and &lt;em&gt;Address&lt;&#x2F;em&gt;. Values are defined in the corresponding &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ChainAgnostic&#x2F;CAIPs&#x2F;blob&#x2F;29762ef99a6ffea1e07e3f796c0d1a5a95e89b88&#x2F;CAIPs&#x2F;caip-350.md&quot;&gt;CAIP-350&lt;&#x2F;a&gt; profile for the namespace.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;ChainReferenceLength&lt;&#x2F;strong&gt;
: A 1-byte integer encoding the length of &lt;em&gt;ChainReference&lt;&#x2F;em&gt; in bytes. Note that it MAY be zero, in which case the &lt;em&gt;Interoperable Address&lt;&#x2F;em&gt; MUST NOT include a chain reference.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;ChainReference&lt;&#x2F;strong&gt;
: Variable length, binary representation of the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ChainAgnostic&#x2F;CAIPs&#x2F;blob&#x2F;29762ef99a6ffea1e07e3f796c0d1a5a95e89b88&#x2F;CAIPs&#x2F;caip-350.md&quot;&gt;CAIP-350&lt;&#x2F;a&gt; chain reference. Serialization of the &lt;em&gt;ChainReference&lt;&#x2F;em&gt; within a specific namespace MUST follow the algorithm defined in the namespace&#x27;s &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ChainAgnostic&#x2F;CAIPs&#x2F;blob&#x2F;29762ef99a6ffea1e07e3f796c0d1a5a95e89b88&#x2F;CAIPs&#x2F;caip-350.md&quot;&gt;CAIP-350&lt;&#x2F;a&gt; profile. Chain profiles are maintained by the Chain-Agnostic Standards Alliance (CASA).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;AddressLength&lt;&#x2F;strong&gt;
: 1-byte integer encoding the length of Address in bytes. Note that it MAY be zero, in which case the &lt;em&gt;Interoperable Address&lt;&#x2F;em&gt; MUST NOT include an address. It MUST NOT be zero if the &lt;em&gt;ChainReferenceLength&lt;&#x2F;em&gt; is also zero.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Address&lt;&#x2F;strong&gt;
: Variable length field containing the binary encoding of the characters of the serialized address. The serialization for a specific &lt;em&gt;ChainType&lt;&#x2F;em&gt; MUST follow the rules of its corresponding &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ChainAgnostic&#x2F;CAIPs&#x2F;blob&#x2F;29762ef99a6ffea1e07e3f796c0d1a5a95e89b88&#x2F;CAIPs&#x2F;caip-350.md&quot;&gt;CAIP-350&lt;&#x2F;a&gt; profile.&lt;&#x2F;p&gt;
&lt;hr &#x2F;&gt;
&lt;p&gt;If you choose to display an &lt;em&gt;Interoperable Address&lt;&#x2F;em&gt; it is RECOMMENDED that you display it as a lower case hexadecimal string.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;examples&quot;&gt;Examples&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;example-1-ethereum-mainnet-address&quot;&gt;Example 1: Ethereum mainnet address&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;Components&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&quot;text-align: left&quot;&gt;Key&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: left&quot;&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;strong&gt;Version&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;strong&gt;ChainType&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;0x0000&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;strong&gt;ChainReferenceLength&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;strong&gt;ChainReference&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;strong&gt;AddressLength&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;20&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;strong&gt;Address&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;&lt;strong&gt;Interoperable Address&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;These components produce the following &lt;em&gt;Interoperable Address&lt;&#x2F;em&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x00010000010114d8da6bf26964af9d7eed9e03e53415d37aa96045&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ^^^^-------------------------------------------------- Version              &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ^^^^---------------------------------------------- ChainType            &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          ^^-------------------------------------------- ChainReferenceLength&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            ^^------------------------------------------ ChainReference       &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              ^^---------------------------------------- AddressLength       &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Address             &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;hr &#x2F;&gt;
&lt;h4 id=&quot;example-2-solana-mainnet-address&quot;&gt;Example 2: Solana mainnet address&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;Components&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&quot;text-align: left&quot;&gt;Key&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: left&quot;&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;strong&gt;Version&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;strong&gt;ChainType&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;0x0002&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;strong&gt;ChainReferenceLength&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;32&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;strong&gt;ChainReference&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;strong&gt;AddressLength&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;32&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;strong&gt;Address&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;MJKqp326RZCHnAAbew9MDdui3iCKWco7fsK9sVuZTX2&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;&lt;strong&gt;Interoperable Address&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;These components produce the following &lt;em&gt;Interoperable Address&lt;&#x2F;em&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x000100022045296998a6f8e2a784db5d9f95e18fc23f70441a1039446801089879b08c7ef02005333498d5aea4ae009585c43f7b8c30df8e70187d4a713d134f977fc8dfe0b5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ^^^^---------------------------------------------------------------------------------------------------------------------------------------- Version&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ^^^^------------------------------------------------------------------------------------------------------------------------------------ ChainType&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          ^^---------------------------------------------------------------------------------------------------------------------------------- ChainReferenceLength&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^------------------------------------------------------------------ ChainReference&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                                                            ^^---------------------------------------------------------------- AddressLength&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- Address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;hr &#x2F;&gt;
&lt;h4 id=&quot;example-3-evm-address-without-chainreference&quot;&gt;Example 3: EVM address without ChainReference&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;Components&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&quot;text-align: left&quot;&gt;Key&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: left&quot;&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;strong&gt;Version&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;strong&gt;ChainType&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;0x0000&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;strong&gt;ChainReferenceLength&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;strong&gt;ChainReference&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;N&#x2F;A&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;strong&gt;AddressLength&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;20&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;strong&gt;Address&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;&lt;strong&gt;Interoperable Address&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;These components produce the following &lt;em&gt;Interoperable Address&lt;&#x2F;em&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x000100000014d8da6bf26964af9d7eed9e03e53415d37aa96045&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ^^^^------------------------------------------------ Version&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ^^^^-------------------------------------------- ChainType&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          ^^------------------------------------------ ChainReferenceLength&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            ^^---------------------------------------- AddressLength&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;hr &#x2F;&gt;
&lt;h4 id=&quot;example-4-solana-mainnet-network-no-address&quot;&gt;Example 4: Solana mainnet network, no address&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;Components&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&quot;text-align: left&quot;&gt;Key&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: left&quot;&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;strong&gt;Version&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;strong&gt;ChainType&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;0x0002&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;strong&gt;ChainReferenceLength&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;32&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;strong&gt;ChainReference&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;strong&gt;AddressLength&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;strong&gt;Address&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;N&#x2F;A&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;&lt;strong&gt;Interoperable Address&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;These components produce the following &lt;em&gt;Interoperable Address&lt;&#x2F;em&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x000100022045296998a6f8e2a784db5d9f95e18fc23f70441a1039446801089879b08c7ef000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ^^^^------------------------------------------------------------------------ Version&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ^^^^-------------------------------------------------------------------- ChainType&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          ^^------------------------------------------------------------------ ChainReferenceLength&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-- ChainReference&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                                                            ^^ AddressLength&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;versioning&quot;&gt;Versioning&lt;&#x2F;h3&gt;
&lt;p&gt;These rules ensure that future standards that build upon this one maintain backwards compatibility.&lt;&#x2F;p&gt;
&lt;p&gt;Future versions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;MUST be trivially convertible to the &lt;em&gt;Interoperable Address&lt;&#x2F;em&gt; format defined in this specification&lt;&#x2F;li&gt;
&lt;li&gt;MUST set the most significant bit of the version field to 1 if the &lt;em&gt;Interoperable Address&lt;&#x2F;em&gt; format is not backward-compatible with the parsing rules outlined herein&lt;&#x2F;li&gt;
&lt;li&gt;MUST support defining an address, a chain, or both&lt;&#x2F;li&gt;
&lt;li&gt;MAY add fields but MUST NOT alter or omit any data required to reconstruct the Version 1 &lt;em&gt;Interoperable Address&lt;&#x2F;em&gt; exactly, bit for bit&lt;&#x2F;li&gt;
&lt;li&gt;MAY only be able to represent a subset of the CAIP namespaces&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;text-representation&quot;&gt;Text representation&lt;&#x2F;h3&gt;
&lt;p&gt;This specification defines a canonical binary representation that &lt;strong&gt;is not&lt;&#x2F;strong&gt; intended to be used directly in user-facing contexts. If an implementer chooses to display an &lt;em&gt;Interoperable Address&lt;&#x2F;em&gt; directly, it is RECOMMENDED that it be represented as a lowercase hexadecimal string. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7828&#x2F;&quot;&gt;ERC-7828&lt;&#x2F;a&gt; is one example of a human-readable &lt;em&gt;chain-specific address&lt;&#x2F;em&gt; definition that can be displayed in user-facing contexts.&lt;&#x2F;p&gt;
&lt;p&gt;The companion standard, CAIP-350, specifies on a per-namespace basis, the rules for converting the &lt;code&gt;ChainReference&lt;&#x2F;code&gt; and &lt;code&gt;Address&lt;&#x2F;code&gt; components of the &lt;em&gt;Interoperable Address&lt;&#x2F;em&gt; into human readable representations. These MAY be displayed in user-facing contexts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC defines a compact binary format for representing a &lt;em&gt;chain-specific address&lt;&#x2F;em&gt;, primarily intended for use within smart contracts. For other contexts—such as display to end users or programmatic use in APIs—alternative &lt;em&gt;chain-specific addressing&lt;&#x2F;em&gt; standards may be more appropriate. For example, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7828&#x2F;&quot;&gt;ERC-7828&lt;&#x2F;a&gt; specifies a human-readable &lt;em&gt;chain-specific address&lt;&#x2F;em&gt; format.&lt;&#x2F;p&gt;
&lt;p&gt;The interoperability roadmap benefits significantly from first having a standardized binary format for addresses, which allows the message passing and intents verticals to move forward on a consistent common interface.&lt;&#x2F;p&gt;
&lt;p&gt;The rationale for some of the low level specification decisions are outlined below:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;We chose to allow the &lt;code&gt;Address&lt;&#x2F;code&gt; and &lt;code&gt;ChainReference&lt;&#x2F;code&gt; components to be zero-length to make this standard flexible and to allow developers to use a single, uniform standard for many different jobs. For example if a user wants to represent an address on any compatible chain, or if the user simply wants to represent the chain itself.&lt;&#x2F;li&gt;
&lt;li&gt;We chose &lt;em&gt;not&lt;&#x2F;em&gt; to use alternate encoding formats (e.g., &lt;code&gt;base58&lt;&#x2F;code&gt; or &lt;code&gt;base64&lt;&#x2F;code&gt;) in order to make it easier for wallets and dApps to work with, and convert between, addresses that both use and do not use this addressing standard.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;While this standard aims to be a foundation to be able to canonically refer to addresses on different chains, that guarantee is going to be a leaky abstraction in the real world, given that e.g. a particular chain namespace might define a serialization scheme that can&#x27;t guarantee canonicity of addresses, or a given network might have two valid &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ChainAgnostic&#x2F;CAIPs&#x2F;blob&#x2F;2a7d42aebaffa42d1017c702974395ff5c1b3636&#x2F;CAIPs&#x2F;caip-2.md&quot;&gt;CAIP-2&lt;&#x2F;a&gt; ids referring to it.&lt;&#x2F;p&gt;
&lt;p&gt;It is therefore advised for implementers requiring canonicity of addresses (e.g by using them as keys in smart contract mappings or other key-value stores), to thoroughly review the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ChainAgnostic&#x2F;CAIPs&#x2F;blob&#x2F;29762ef99a6ffea1e07e3f796c0d1a5a95e89b88&#x2F;CAIPs&#x2F;caip-350.md&quot;&gt;CAIP-350&lt;&#x2F;a&gt; profile of a chain namespace for the possibility of a lack of canonicity of addresses (which should be noted in the profile&#x27;s &#x27;Extra Considerations&#x27; section) as well as collisions with other already-supported namespaces.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Bequeathable Contracts</title>
        <published>2025-02-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Wamith Mockbill</name><uri>https://github.com/wamith</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7878/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/new-erc-bequeathable-tokens-a-standard-to-allow-tokens-to-be-inherited-after-the-owners-death/22755" />
        

        <id>https://wg-eips.ritovision.com/7878/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:7878"
            label="ERC-7878" />
        

        
        

        
        <summary type="html">Inheritance of tokens after the owner&#x27;s death</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7878/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes a standard interface for contracts to allow tokens to be inherited after the owner&#x27;s death. The interface allows token owners to set up a Will and designate executors to enable the transfer of tokens to inheritors after a specified waiting period.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Crypto Tokens in general and NFTs in particular are starting to be used to tokenise real-world assets. In order for them to be adopted by the main stream finance world, there needs to be a way to inherit these tokens after the owner has passed away. Currently, there is no standardised way for token holders to pass on their digital assets in the event of their death.&lt;br &#x2F;&gt;
This EIP aims to solve this problem by providing a standard interface for &quot;bequeathable&quot; tokens, allowing for a secure and transparent process of token inheritance.
In designing this interface we have tried to follow the real world process of Will creation and execution.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;Every compliant contract MUST implement the &lt;code&gt;Bequeathable&lt;&#x2F;code&gt; interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; EIP-7878 Bequeathable tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-7878&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Bequeathable interface&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Bequeathable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;              Announce the owner&amp;#39;s tokens are to be inherited&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                 Emitted by `announceObit`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;   owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;       The original owner of the tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;   inheritor&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   The address of the wallet that will inherit the tokens once the moratoriumTTL time has passed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ObituaryStarted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; inheritor&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;               Announce the obituary (and moratorium) for the owner has been cancelled, as well as who cancelled it&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                  Emitted by `cancelObit`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;   owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;        The original owner of the tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;   cancelledBy&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  The address that triggered this cancellation. This can be the owner or any of the inheritors&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ObituaryCancelled&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; cancelledBy&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                 A token owner can set a Will and names one or more executors who are able to transfer their tokens after their death&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                    Although more than one executor address can be set, only one is required to start the process and then do the transfer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                    Subsequent calls to this function should overwrite any existing Will&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;   executors&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      An array of executors eg legal council, spouse, child 1, child 2 etc..&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;   moratoriumTTL&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  The time that must pass (in seconds) from when the obituary is announced to when the inheritance transfer can take place&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                    The moratoriumTTL is a safety buffer time frame that allows for any intervention before the tokens get transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setWill&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; executors&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; moratoriumTTL&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                  Get the details of a Will if set&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                     This is a way for the owner to confirm that they have correctly set their Will&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;          The current owner of the tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;   executors&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      A list of all the executors for this owners will&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;   moratoriumTTL&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  The length of time (in seconds) that must elapse after calling announceObit before the actual transfer can happen&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getWill&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; executors&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; moratoriumTTL&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;              Start the Obituary process, by announcing it and declaring who is the intended inheritor&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;   owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;       The current owner of the tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;   inheritor&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   The address of the owner to be&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; announceObit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; inheritor&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;          Cancel the Obituary that has been previously announced. Can be called by any of the executors (or the owner if still around)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;   owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   The original owner of the tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; cancelObit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                   Get the designated inheritor and how much time is left before the moratoriumTTL is satisfied&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;           The current owner of the tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;   inheritor&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;       The named inheritor when the obituary was announced&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;   moratoriumTTL&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   The time left for the moratoriumTTL before the transfer can be done&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                      A minus figure for moratoriumTTL indicates that the wait time has elapsed and the tokens can be bequeathed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getObit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; inheritor&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; moratoriumTTL&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         Bequeath ie transfer the tokens to the previously declared inheritor&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;   owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  The original owner of the tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;            The transfer should happen to the inheritor address when `announceObit` was called&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; bequeath&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;functions&quot;&gt;Functions&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;setWill&lt;&#x2F;code&gt;: Allows a token owner to set up or update their Will.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;getWill&lt;&#x2F;code&gt;: Returns the current Will details for a given owner.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;announceObit&lt;&#x2F;code&gt;: Initiates the inheritance process by an executor.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;cancelObit&lt;&#x2F;code&gt;: Cancels an active obituary process.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;getObit&lt;&#x2F;code&gt;: Retrieves the current obituary status.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;bequeath&lt;&#x2F;code&gt;: Transfers tokens to the inheritor after the waiting period.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;events&quot;&gt;Events&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;ObituaryStarted&lt;&#x2F;code&gt;: Emitted when an obituary is announced.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ObituaryCancelled&lt;&#x2F;code&gt;: Emitted when an obituary is cancelled.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The standard follows what currently happens in real life when preparing and executing a Will.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;An owner writes a Will and in doing so names the executor(s) of their Will&lt;&#x2F;li&gt;
&lt;li&gt;Upon passing away, the executor will announce the Obituary&lt;&#x2F;li&gt;
&lt;li&gt;The Will is read and the inheritors are identified&lt;&#x2F;li&gt;
&lt;li&gt;The transfer of ownership is executed according to the wishes of the Will&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;However, real life is not always as straight forward as this. Conflicts happen all the time. To handle this situation and to keep the interface simple, we added the ability to cancel the Obituary by ANY of the executors. In this way, if there is any conflict, it can be challenged out in the courts and once the matter is settled, the Obituary process can start again.&lt;&#x2F;p&gt;
&lt;p&gt;Again to keep the interface clean, all the tokens get transferred to one address. It is then that person&#x27;s responsibility to execute any further transfers.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is compatible with existing token standards like &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt;. It can be implemented alongside these standards without affecting their core functionality.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Tests are included in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7878&#x2F;.&#x2F;assets&#x2F;test&#x2F;Bequeath.test.js&quot;&gt;&lt;code&gt;Bequeath.test.js&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7878&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;Bequeathable.sol&quot;&gt;&lt;code&gt;Bequeathable.sol&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Implementers should carefully consider access control mechanisms to ensure that only authorized parties can execute Will-related functions.&lt;&#x2F;p&gt;
&lt;p&gt;The moratoriumTTL should be set to a reasonable duration to allow for potential disputes or corrections. We recommend at least 30 days, especially for tokens that are of high value.  It limits the potential damage in scenarios such as the obituray process being triggered by a bad actor who has taken over one of the executor wallets.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EOF - TXCREATE and InitcodeTransaction type</title>
        <published>2025-01-31T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Piotr Dobaczewski</name><uri>https://github.com/pdobacz</uri>
	</author>
	
	<author>
		<name>Andrei Maiboroda</name><uri>https://github.com/gumb0</uri>
	</author>
	
	<author>
		<name>Paweł Bylica</name><uri>https://github.com/chfast</uri>
	</author>
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	<author>
		<name>Danno Ferrin</name><uri>https://github.com/shemnon</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7873/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7873-eof-txcreate-instruction-and-initcodetransaction-type/22765" />
        

        <id>https://wg-eips.ritovision.com/7873/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7873"
            label="EIP-7873" />
        

        
        

        
        <summary type="html">Adds a `TXCREATE` instruction to EOF and an accompanying transaction type allowing to create EOF contracts from transaction data</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7873/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;EVM Object Format (EOF) removes the possibility to create contracts using creation transactions (with an empty &lt;code&gt;to&lt;&#x2F;code&gt; field), &lt;code&gt;CREATE&lt;&#x2F;code&gt; or &lt;code&gt;CREATE2&lt;&#x2F;code&gt; instructions. We introduce a new instruction: &lt;code&gt;TXCREATE&lt;&#x2F;code&gt;, as well as a new transaction type (&lt;code&gt;InitcodeTransaction&lt;&#x2F;code&gt;), to provide a way to create contracts using EOF containers in transaction data.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP uses terminology from the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3540&#x2F;&quot;&gt;EIP-3540&lt;&#x2F;a&gt; which introduces the EOF format.&lt;&#x2F;p&gt;
&lt;p&gt;Creation transaction and creation instructions &lt;code&gt;CREATE&lt;&#x2F;code&gt; and &lt;code&gt;CREATE2&lt;&#x2F;code&gt; are means provided by legacy EVM to deploy new code, but per requirement of removing code observability, they are not allowed to deploy EOF code. To allow Externally Owned Accounts (EOAs) to deploy EOF contracts, there must be a way to create EOF contracts using bytecode delivered in transaction data.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, the new instruction and transaction type introduced in this EIP enable contracts to create other contracts using initcode from the transaction data, which in legacy EVM is achieved via a combination of &lt;code&gt;CREATE&lt;&#x2F;code&gt; or &lt;code&gt;CREATE2&lt;&#x2F;code&gt; and loading the initcode from calldata.&lt;&#x2F;p&gt;
&lt;p&gt;This mechanism complements &lt;code&gt;EOFCREATE&lt;&#x2F;code&gt; and &lt;code&gt;RETURNCODE&lt;&#x2F;code&gt; instructions from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7620&#x2F;&quot;&gt;EIP-7620&lt;&#x2F;a&gt;, and thus all use cases of contract creation that are available in legacy EVM are enabled for EOF.&lt;&#x2F;p&gt;
&lt;p&gt;Since &lt;code&gt;TXCREATE&lt;&#x2F;code&gt; is not restricted to EOF containers, it also serves the purpose of bootstrapping EOF contracts into the state.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;INITCODE_TX_TYPE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;Bytes1(0x06)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_INITCODE_COUNT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;256&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TX_CREATE_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Defined as &lt;code&gt;32000&lt;&#x2F;code&gt; in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;execution-specs&#x2F;blob&#x2F;0f9e4345b60d36c23fffaa69f70cf9cdb975f4ba&#x2F;src&#x2F;ethereum&#x2F;shanghai&#x2F;fork_types.py#L42&quot;&gt;Ethereum Execution Layer Specs&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;STACK_DEPTH_LIMIT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Defined as &lt;code&gt;1024&lt;&#x2F;code&gt; in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;execution-specs&#x2F;blob&#x2F;0f9e4345b60d36c23fffaa69f70cf9cdb975f4ba&#x2F;src&#x2F;ethereum&#x2F;shanghai&#x2F;vm&#x2F;interpreter.py#L60&quot;&gt;Ethereum Execution Layer Specs&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;GAS_CODE_DEPOSIT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Defined as &lt;code&gt;200&lt;&#x2F;code&gt; in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;execution-specs&#x2F;blob&#x2F;0f9e4345b60d36c23fffaa69f70cf9cdb975f4ba&#x2F;src&#x2F;ethereum&#x2F;shanghai&#x2F;vm&#x2F;gas.py#L44&quot;&gt;Ethereum Execution Layer Specs&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TX_DATA_COST_PER_ZERO&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Defined as &lt;code&gt;4&lt;&#x2F;code&gt; in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;execution-specs&#x2F;blob&#x2F;0f9e4345b60d36c23fffaa69f70cf9cdb975f4ba&#x2F;src&#x2F;ethereum&#x2F;shanghai&#x2F;fork_types.py#L41&quot;&gt;Ethereum Execution Layer Specs&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TX_DATA_COST_PER_NON_ZERO&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Defined as &lt;code&gt;16&lt;&#x2F;code&gt; in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;execution-specs&#x2F;blob&#x2F;0f9e4345b60d36c23fffaa69f70cf9cdb975f4ba&#x2F;src&#x2F;ethereum&#x2F;shanghai&#x2F;fork_types.py#L40&quot;&gt;Ethereum Execution Layer Specs&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_CODE_SIZE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Defined as &lt;code&gt;24576&lt;&#x2F;code&gt; in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;170&#x2F;&quot;&gt;EIP-170&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_INITCODE_SIZE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Defined as &lt;code&gt;2 * MAX_CODE_SIZE&lt;&#x2F;code&gt; in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3860&#x2F;&quot;&gt;EIP-3860&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;transaction-types&quot;&gt;Transaction Types&lt;&#x2F;h3&gt;
&lt;p&gt;Introduce new transaction &lt;code&gt;InitcodeTransaction&lt;&#x2F;code&gt; (type &lt;code&gt;INITCODE_TX_TYPE&lt;&#x2F;code&gt;) which extends &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; (type 2) transaction by adding a new field &lt;code&gt;initcodes: List[ByteList[MAX_INITCODE_SIZE], MAX_INITCODE_COUNT]&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;initcodes&lt;&#x2F;code&gt; can only be accessed via the &lt;code&gt;TXCREATE&lt;&#x2F;code&gt; instruction (see below), therefore &lt;code&gt;InitcodeTransactions&lt;&#x2F;code&gt; are intended to be sent to contracts including &lt;code&gt;TXCREATE&lt;&#x2F;code&gt; in their execution.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;gas-schedule&quot;&gt;Gas schedule&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;initcodes&lt;&#x2F;code&gt; items data costs the same as calldata: transaction gas of an &lt;code&gt;InitcodeTransaction&lt;&#x2F;code&gt; is extended to include tokens in &lt;code&gt;initcodes&lt;&#x2F;code&gt; alongside tokens in &lt;code&gt;calldata&lt;&#x2F;code&gt;. Using the conventions from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7623&#x2F;&quot;&gt;EIP-7623&lt;&#x2F;a&gt;, the transaction gas is calculated as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;STANDARD_TOKEN_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;TOTAL_COST_FLOOR_PER_TOKEN&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tokens_in_calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; zero_bytes_in_calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; nonzero_bytes_in_calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tokens_in_initcodes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt; initcode&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; initcodes&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    tokens_in_initcodes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; zero_bytes_in_initcode&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; nonzero_bytes_in_initcode&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gasUsed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    21000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    +&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        STANDARD_TOKEN_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;tokens_in_calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; tokens_in_initcodes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        +&lt;&#x2F;span&gt;&lt;span&gt; execution_gas_used&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        TOTAL_COST_FLOOR_PER_TOKEN&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;tokens_in_calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; tokens_in_initcodes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;transaction-validation&quot;&gt;Transaction validation&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;InitcodeTransaction&lt;&#x2F;code&gt; is invalid if there are zero entries in &lt;code&gt;initcodes&lt;&#x2F;code&gt;, or if there are more than &lt;code&gt;MAX_INITCODE_COUNT&lt;&#x2F;code&gt; entries.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;InitcodeTransaction&lt;&#x2F;code&gt; is invalid if any entry in &lt;code&gt;initcodes&lt;&#x2F;code&gt; is zero length, or if any entry exceeds &lt;code&gt;MAX_INITCODE_SIZE&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;InitcodeTransaction&lt;&#x2F;code&gt; is invalid if the &lt;code&gt;to&lt;&#x2F;code&gt; is &lt;code&gt;nil&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Under transaction validation rules &lt;code&gt;initcodes&lt;&#x2F;code&gt; are not validated for conforming to the EOF specification. They are only validated when accessed via &lt;code&gt;TXCREATE&lt;&#x2F;code&gt;. This avoids potential DoS attacks of the mempool. If during the execution of an &lt;code&gt;InitcodeTransaction&lt;&#x2F;code&gt; no &lt;code&gt;TXCREATE&lt;&#x2F;code&gt; instruction is called, such transaction is still valid.&lt;&#x2F;p&gt;
&lt;p&gt;Other creation transactions that support contract creation (specifically type 0 &quot;Frontier,&quot; type 1 &quot;AccessList,&quot; type 2 &quot;FeeMarket&quot; transactions with an empty &lt;code&gt;to&lt;&#x2F;code&gt; field) will not attempt to parse EOF containers in their &lt;code&gt;input&lt;&#x2F;code&gt; field and will execute the code as non-EOF code. This will result in immediately executing the undefined &lt;code&gt;0xEF&lt;&#x2F;code&gt; instruction and halting.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;rlp-and-signature&quot;&gt;RLP and signature&lt;&#x2F;h4&gt;
&lt;p&gt;Given the definitions from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; the &lt;code&gt;TransactionPayload&lt;&#x2F;code&gt; for an &lt;code&gt;InitcodeTransaction&lt;&#x2F;code&gt; is the RLP serialization of:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[chain_id, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit, to, value, data, access_list, initcodes, y_parity, r, s]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;TransactionType&lt;&#x2F;code&gt; is &lt;code&gt;INITCODE_TX_TYPE&lt;&#x2F;code&gt; and the signature values &lt;code&gt;y_parity&lt;&#x2F;code&gt;, &lt;code&gt;r&lt;&#x2F;code&gt;, and &lt;code&gt;s&lt;&#x2F;code&gt; are calculated by constructing a secp256k1 signature over the following digest:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;keccak256(INITCODE_TX_TYPE || rlp([chain_id, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit, to, value, data, access_list, initcodes]))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; &lt;code&gt;ReceiptPayload&lt;&#x2F;code&gt; for this transaction is &lt;code&gt;rlp([status, cumulative_transaction_gas_used, logs_bloom, logs])&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;execution-semantics&quot;&gt;Execution Semantics&lt;&#x2F;h3&gt;
&lt;p&gt;Wherever not explicitly listed, the rules of EOF contract creation, as well as the &lt;code&gt;TXCREATE&lt;&#x2F;code&gt; instruction, should be identical or analogous to those of &lt;code&gt;CREATE2&lt;&#x2F;code&gt; instruction. This includes but is not limited to:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;behavior on &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt; and address collision (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;684&#x2F;&quot;&gt;EIP-684&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;EVM execution frame created for the &lt;code&gt;TXCREATE&lt;&#x2F;code&gt; initcode - memory, account context etc.&lt;&#x2F;li&gt;
&lt;li&gt;nonce bumping of the account of newly created contract &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;161&#x2F;&quot;&gt;EIP-161&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;balance checking and transfer for the creation endowment (&lt;code&gt;value&lt;&#x2F;code&gt; argument)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Introduce a new instruction on the same block number &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3540&#x2F;&quot;&gt;EIP-3540&lt;&#x2F;a&gt; is activated on: &lt;code&gt;TXCREATE&lt;&#x2F;code&gt; (&lt;code&gt;0xed&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;h4 id=&quot;txcreate&quot;&gt;&lt;code&gt;TXCREATE&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;deduct &lt;code&gt;TX_CREATE_COST&lt;&#x2F;code&gt; gas&lt;&#x2F;li&gt;
&lt;li&gt;halt with exceptional failure if the current frame is in &lt;code&gt;static-mode&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;pop &lt;code&gt;tx_initcode_hash&lt;&#x2F;code&gt;, &lt;code&gt;salt&lt;&#x2F;code&gt;, &lt;code&gt;input_offset&lt;&#x2F;code&gt;, &lt;code&gt;input_size&lt;&#x2F;code&gt;, &lt;code&gt;value&lt;&#x2F;code&gt; from the operand stack&lt;&#x2F;li&gt;
&lt;li&gt;perform (and charge for) memory expansion using &lt;code&gt;[input_offset, input_size]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;load initcode EOF container from the transaction &lt;code&gt;initcodes&lt;&#x2F;code&gt; array which hashes to &lt;code&gt;tx_initcode_hash&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;fails (returns 0 on the stack) if such initcode does not exist in the transaction, or if called from a transaction of &lt;code&gt;TransactionType&lt;&#x2F;code&gt; other than &lt;code&gt;INITCODE_TX_TYPE&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;caller&#x27;s nonce is not updated and gas for initcode execution is not consumed.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;let &lt;code&gt;initcontainer&lt;&#x2F;code&gt; be that EOF container, and &lt;code&gt;initcontainer_size&lt;&#x2F;code&gt; its length in bytes&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;check that current call depth is below &lt;code&gt;STACK_DEPTH_LIMIT&lt;&#x2F;code&gt; and that caller balance is enough to transfer &lt;code&gt;value&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;in case of failure return 0 on the stack, caller&#x27;s nonce is not updated and gas for initcode execution is not consumed.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;validate the initcode container and all its subcontainers recursively&lt;&#x2F;strong&gt;
&lt;ul&gt;
&lt;li&gt;unlike in general validation, &lt;code&gt;initcontainer&lt;&#x2F;code&gt; is additionally required to have &lt;code&gt;data_size&lt;&#x2F;code&gt; declared in the header equal to actual &lt;code&gt;data_section&lt;&#x2F;code&gt; size.&lt;&#x2F;li&gt;
&lt;li&gt;validation includes checking that the &lt;code&gt;initcontainer&lt;&#x2F;code&gt; does not contain &lt;code&gt;RETURN&lt;&#x2F;code&gt; or &lt;code&gt;STOP&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;fails (returns 0 on the stack) if container was invalid
&lt;ul&gt;
&lt;li&gt;caller’s nonce is not updated and gas for initcode execution is not consumed.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;caller&#x27;s memory slice &lt;code&gt;[input_offset:input_size]&lt;&#x2F;code&gt; is used as calldata&lt;&#x2F;li&gt;
&lt;li&gt;execute the container and deduct gas for execution. The 63&#x2F;64th rule from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;150&#x2F;&quot;&gt;EIP-150&lt;&#x2F;a&gt; applies.&lt;&#x2F;li&gt;
&lt;li&gt;increment &lt;code&gt;sender&lt;&#x2F;code&gt; account&#x27;s nonce&lt;&#x2F;li&gt;
&lt;li&gt;calculate &lt;code&gt;new_address&lt;&#x2F;code&gt; as &lt;code&gt;keccak256(0xff || sender32 || salt)[12:]&lt;&#x2F;code&gt;, where &lt;code&gt;sender32&lt;&#x2F;code&gt; is the sender address left-padded to 32 bytes with zeros&lt;&#x2F;li&gt;
&lt;li&gt;an unsuccessful execution of initcode results in pushing &lt;code&gt;0&lt;&#x2F;code&gt; onto the stack
&lt;ul&gt;
&lt;li&gt;can populate returndata if execution &lt;code&gt;REVERT&lt;&#x2F;code&gt;ed&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;sender&lt;&#x2F;code&gt;&#x27;s nonce stays updated&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;a successful execution ends with initcode executing &lt;code&gt;RETURNCODE{deploy_container_index}(aux_data_offset, aux_data_size)&lt;&#x2F;code&gt; instruction (see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7620&#x2F;&quot;&gt;EIP-7620&lt;&#x2F;a&gt;). After that:
&lt;ul&gt;
&lt;li&gt;load deploy EOF subcontainer at &lt;code&gt;deploy_container_index&lt;&#x2F;code&gt; in the container from which &lt;code&gt;RETURNCODE&lt;&#x2F;code&gt; is executed&lt;&#x2F;li&gt;
&lt;li&gt;concatenate data section with &lt;code&gt;(aux_data_offset, aux_data_offset + aux_data_size)&lt;&#x2F;code&gt; memory segment and update data size in the header&lt;&#x2F;li&gt;
&lt;li&gt;if updated deploy container size exceeds &lt;code&gt;MAX_CODE_SIZE&lt;&#x2F;code&gt;, instruction exceptionally aborts&lt;&#x2F;li&gt;
&lt;li&gt;set &lt;code&gt;state[new_address].code&lt;&#x2F;code&gt; to the updated deploy container&lt;&#x2F;li&gt;
&lt;li&gt;push &lt;code&gt;new_address&lt;&#x2F;code&gt; onto the stack&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;deduct &lt;code&gt;GAS_CODE_DEPOSIT * deployed_code_size&lt;&#x2F;code&gt; gas&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note that the implementations are expected to cache the result of container validation for the time of current transaction execution, and therefore the cost of each container&#x27;s validation is sufficiently covered by &lt;code&gt;InitcodeTransaction&lt;&#x2F;code&gt; intrinsic cost (initcodes charge).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;txcreate-failure-modes&quot;&gt;&lt;code&gt;TXCREATE&lt;&#x2F;code&gt; failure modes&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;TXCREATE&lt;&#x2F;code&gt; has two &quot;light&quot; failure modes in case the initcontainer is not present and in case the EOF validation is unsuccessful. An alternative design where both cases led to a &quot;hard&quot; failure (consuming the entire gas available) was considered. We decided to have the more granular and forgiving failure modes in order to align the gas costs incurred to the actual work the EVM performs.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;allowing-txcreate-in-legacy-evm&quot;&gt;Allowing &lt;code&gt;TXCREATE&lt;&#x2F;code&gt; in legacy EVM&lt;&#x2F;h3&gt;
&lt;p&gt;EOF contract creation requires an exceptional possibility of calling an EOF opcode in legacy code - &lt;code&gt;TXCREATE&lt;&#x2F;code&gt;, because otherwise neither legacy contracts nor create transactions can deploy EOF code to bootstrap. The alternative approach was to continue using legacy creation mechanisms, by either still relying on fetching the &lt;em&gt;initcode&lt;&#x2F;em&gt; from memory and not satisfy the overarching requirement of code non-observability, or to abuse the legacy creation transactions mechanism, or to introduce a predeployed Creator Contract into the state.&lt;&#x2F;p&gt;
&lt;p&gt;This also makes &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7698&#x2F;&quot;&gt;EIP-7698&lt;&#x2F;a&gt; (EOF - Creation transaction) no longer an essential requirement for deploying EOF contracts onto the chain. The EIP could be removed from EOFv1 and withdrawn.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;new-address-hashing-scheme&quot;&gt;New address hashing scheme&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;TXCREATE&lt;&#x2F;code&gt; uses the scheme &lt;code&gt;new_address = keccak256(0xff || sender32 || salt)[12:]&lt;&#x2F;code&gt;, same as &lt;code&gt;EOFCREATE&lt;&#x2F;code&gt; instruction. The decision whether to include initcontainer hash into salt is left to the &lt;code&gt;TXCREATE&lt;&#x2F;code&gt; caller. See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7620&#x2F;&quot;&gt;EIP-7620&lt;&#x2F;a&gt; for detailed rationale.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;eof-creation-transactions-vs-deployment-patterns&quot;&gt;EOF creation transactions vs deployment patterns&lt;&#x2F;h3&gt;
&lt;p&gt;Relying on the EOF creation transactions as the alternative solution makes it impossible for smart contract wallets to deploy arbitrary EOF contracts (only EOAs can). At the same time, it is a use case current legacy creation rules allow, thanks to &lt;code&gt;CREATE&lt;&#x2F;code&gt; and &lt;code&gt;CREATE2&lt;&#x2F;code&gt; instructions. A workaround where those arbitrary EOF contracts are first &quot;uploaded&quot; to a factory contract, and then deployed using an &lt;code&gt;EXTDELEGATECALL&lt;&#x2F;code&gt;-&lt;code&gt;EOFCREATE&lt;&#x2F;code&gt; sequence, is very expensive, as it requires the deployed contract to be put on-chain twice. Because of this, the approach proposed in this EIP is more compatible with the Account Abstraction (AA) roadmap, where smart contract wallets should have feature parity with EOAs.&lt;&#x2F;p&gt;
&lt;p&gt;On top of this, relying on nonce-based hashing scheme to obtain addresses of newly created contracts, like in the case of the EOF creation transactions, would prevent EOF contracts from being deployed counterfactually to deterministic, cross-chain addresses. Introduction of the &lt;code&gt;TXCREATE&lt;&#x2F;code&gt; instruction, supports this out of the box. ERCs can be written to provide toehold contracts which will cater for the deployment patterns, such as salt-less deployment and hashing in the sender&#x27;s address as part of the salt.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;handling-of-0xef00-prefixed-code-in-existing-transaction-types&quot;&gt;Handling of &lt;code&gt;0xEF00&lt;&#x2F;code&gt; prefixed code in existing transaction types.&lt;&#x2F;h3&gt;
&lt;p&gt;Three existing transaction types (type 0 &quot;Frontier,&quot; type 1 &quot;AccessList,&quot; type 2 &quot;FeeMarket&quot;) accept code as part of their input data in certain configurations. This code can start with &lt;code&gt;EF&lt;&#x2F;code&gt; as it is initcode and not a deployed contract.&lt;&#x2F;p&gt;
&lt;p&gt;One possible way of handling potential EOF containers in these transactions is to make them invalid if they are attempting to execute an EOF container as initcode. Specifically the transactions is invalid if the input data begins with &lt;code&gt;0xef00&lt;&#x2F;code&gt; and if the &lt;code&gt;to&lt;&#x2F;code&gt; field is set to nil, signaling a contract creation transaction. This would make blocks containing these transactions invalid, whereas before the fork including this EIP they would have been valid.&lt;&#x2F;p&gt;
&lt;p&gt;One impact that would be seen by this would be block builders, as they would need to ensure that the transactions that are invalid are not included in a block. There is precedent for this, as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7623&#x2F;&quot;&gt;EIP-7623&lt;&#x2F;a&gt; established a new floor for the gas limit in transactions, prior to its adoption the limit was lower.  However, block builders have an existing check on gas limits and transactions and that change was adjusting the formula and constants.&lt;&#x2F;p&gt;
&lt;p&gt;We should also consider the treatment &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; delegation designations receive if they show up as code in a contract creation transaction.  The transaction is valid, is executed as plain bytecode, ad the first operation executed is &lt;code&gt;0xEF&lt;&#x2F;code&gt;, which is an invalid opcode and would cause the whole transaction to abort.&lt;&#x2F;p&gt;
&lt;p&gt;Letting the inputdata of a type 0, 1, and 2 contract creation transaction execute as plain EVM code irrespective of the magic &lt;code&gt;0xEF00&lt;&#x2F;code&gt; bytes keeps a consistent behavior in client code and keeps block builders from having to update their logic in older transaction types.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change poses no risk to backwards compatibility, as it is introduced at the same time EIP-3540 is. Despite the new instruction being introduced for legacy bytecode (code which is not EOF formatted), there is little chance that a meaningful contract would unintentionally execute &lt;code&gt;0xed&lt;&#x2F;code&gt; instruction with formally valid operands and inadvertently cause it to run EOF initcode (which would also require an &lt;code&gt;InitcodeTransaction&lt;&#x2F;code&gt; to be used, otherwise the initcode lookup will fail).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;TXCREATE&lt;&#x2F;code&gt; instruction introduction into legacy EVM does not affect &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; analysis, because instruction has no immediate arguments.&lt;&#x2F;p&gt;
&lt;p&gt;The transactions of the new type are invalid until this change activates.&lt;&#x2F;p&gt;
&lt;p&gt;Contract creation options do not change for legacy bytecode, including how existing transactions with &lt;code&gt;to: nil&lt;&#x2F;code&gt; behave when encountering code in their calldata that may look like an EOF container.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Enhanced RETURN opcodes</title>
        <published>2025-01-31T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Josh Weintraub</name><uri>https://github.com/jhweintraub</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7877/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7877-new-m-s-t-rreturn-opcodes/22731" />
        

        <id>https://wg-eips.ritovision.com/7877/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7877"
            label="EIP-7877" />
        

        
        

        
        <summary type="html">Deprecate RETURN opcode in favor of new opcodes that allow returning data from various locations without first having to write to memory.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7877/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP specifies a series of new &lt;code&gt;RETURN&lt;&#x2F;code&gt; opcodes which allow the user to specify which data location to return from
instead of defaulting to returning from memory.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;With the introduction of transient storage, many smart contracts have begun to store data using the new transient opcodes to optimize for gas usage, whereby a callback
involves returning the data previously stored transiently. However, the current &lt;code&gt;RETURN&lt;&#x2F;code&gt; opcode only allows for returning sequential bytes in memory. This requires
developers to incur additional gas overhead by manually writing data from transient storage to memory before returning,
incuring both an additional memory expansion and opcode cost from complicated for-loops. Similar
inefficiencies already occur when attempting to return data already placed in storage. This EIP attempts to rectify
this by allowing developers to optimize their code by deciding where to return data from directly, instead of requiring
the intermediate step of first copying the data to memory.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces 3 new opcodes as well as renaming&#x2F;aliasing an existing one.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SRETURN (0xf6)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;TRETURN (0xf7)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;RRETURN (0xf8)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;RETURN -&amp;gt; MRETURN (0xf3)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;MRETURN&lt;&#x2F;code&gt; opcode is a rename of &lt;code&gt;RETURN&lt;&#x2F;code&gt;, whereby sequential bytes in memory are returned. It will operate exactly as it currenty does as of the Cancun hard-fork, and its gas cost will remain the same.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;RRETURN&lt;&#x2F;code&gt; operates similar to &lt;code&gt;MRETURN&lt;&#x2F;code&gt;. It pops two items off the stack, an offset to begin reading bytes from in the
existing &lt;code&gt;RETURNDATA&lt;&#x2F;code&gt; buffer, and a number of bytes to return. Those bytes are used to overwrite the existing &lt;code&gt;RETURNDATA&lt;&#x2F;code&gt; buffer and then a return to the previous function is performed.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;SRETURN&lt;&#x2F;code&gt; and &lt;code&gt;TRETURN&lt;&#x2F;code&gt; operate similarly, except on storage and transient respectively. It pops two items off the stack,
a slot number to begin reading from, and a number of sequential slots to return from. Ex: &lt;code&gt;SRETURN(0x0, 0x40)&lt;&#x2F;code&gt; returns the 64 bytes of data in slots [0, 1], and &lt;code&gt;TRETURN(0x0, 0x40)&lt;&#x2F;code&gt; returns the data in transient storage slots [0, 1]. Since the
existing &lt;code&gt;S&#x2F;TLOAD&lt;&#x2F;code&gt; opcodes already return 32-bytes, having the opcode return data in chunks of 32-bytes should make implementation by assembly&#x2F;compiler much simpler.
If the length parameter is a zero, then only the initial slot value should be returned, so &lt;code&gt;SRETURN(0x00, 0x00)&lt;&#x2F;code&gt; returns the value at storage slot 0.&lt;&#x2F;p&gt;
&lt;p&gt;The cost for these opcodes should be similar to the cost of accessing data now.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SRETURN = (number_of_cold_slots) * 2100 + (numer_of_warm_slots * 100)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;TRETURN = number_of_slots * 100&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;RRETURN = cost of RETURNDATACOPY without memory_expansion cost&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;minimum_word_size = (size + 31) &#x2F; 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;static_gas = 3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dynamic_gas = 3 * minimum_word_size&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;overall = static_gas + dynamic_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Allowing for more targeted return opcodes allows for saving gas at all levels of smart contract optimization by eliminating
the intermediate steps of first writing any data to memory before returning. In events where this data may be large, this can result in significant gas savings. These opcodes can be built into the Solidity compiler directly so that all contracts
can take advantage of them. Similarly, by making return more explicit it allows for better static analysis by avoiding messy memory allocations.&lt;&#x2F;p&gt;
&lt;p&gt;There is precedent for these changes.&lt;&#x2F;p&gt;
&lt;p&gt;EIP-3855: Introducing &lt;code&gt;PUSH0&lt;&#x2F;code&gt; opcode to optimize away alternative methods of pushing 0 onto the stack.&lt;&#x2F;p&gt;
&lt;p&gt;EIP-6: Renaming &lt;code&gt;SUICIDE&lt;&#x2F;code&gt; to &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; without changing functionality.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;There are no backwards compatibility concerns, as &lt;code&gt;MRETURN&lt;&#x2F;code&gt; will utilize the same gas cost and opcode as &lt;code&gt;RETURN&lt;&#x2F;code&gt; does now. Due to EOF, it is suggested that these changes be
activated in future EVM version once EOF has been fully implemented.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;There are no security considerations as it is fully backwards compatible, and reduces potential attack space through simplified bytecode.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>DeFi Protocol Solvency Proof Mechanism</title>
        <published>2025-01-30T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Sean Luis Guada Rodríguez</name><uri>https://github.com/SeanLuis</uri><email>seanluis47@gmail.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7893/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7893-defi-protocol-solvency-proof-mechanism/24566" />
        

        <id>https://wg-eips.ritovision.com/7893/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="last-call"
                label="Last Call" />
            
        

        
        <category
            term="tag:eip:7893"
            label="ERC-7893" />
        

        
        

        
        <summary type="html">Verifiable solvency proofs and financial health monitoring for DeFi protocols</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7893/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;A standardized interface that enables DeFi protocols to implement verifiable solvency proofs through smart contracts. This interface works by defining structured data types for assets and liabilities, with oracle-validated price feeds tracking token values in real-time. The technical implementation calculates solvency ratios using configurable risk thresholds (105% minimum solvency ratio), maintains historical metrics for trend analysis, and emits structured events upon threshold breaches. The interface standardizes methods for querying current financial health, retrieving historical data points, and updating protocol positions, all while enforcing proper validation and security controls.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The DeFi ecosystem currently lacks standardization in financial health reporting, leading to:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Inconsistent reporting methodologies across protocols&lt;&#x2F;li&gt;
&lt;li&gt;Limited transparency in real-time financial status&lt;&#x2F;li&gt;
&lt;li&gt;Absence of standardized early warning systems&lt;&#x2F;li&gt;
&lt;li&gt;Complex and time-consuming audit processes&lt;&#x2F;li&gt;
&lt;li&gt;Difficulty in assessing cross-protocol risks&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;This proposal directly addresses these challenges through a comprehensive interface that standardizes solvency reporting and monitoring:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Standardized Methodology&lt;&#x2F;strong&gt;: By providing a common interface with well-defined asset&#x2F;liability structures and mathematical models, this EIP eliminates reporting inconsistencies that currently prevent clear comparisons between protocols.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Real-time Transparency&lt;&#x2F;strong&gt;: The proposed event system and query functions enable continuous monitoring of protocol health, rather than relying on periodic manual reporting that can miss critical changes in financial status.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Automated Risk Alerts&lt;&#x2F;strong&gt;: The threshold-based alert system provides early warnings of deteriorating conditions through standardized &lt;code&gt;RiskAlert&lt;&#x2F;code&gt; events, enabling faster response to potential insolvencies than current ad-hoc monitoring approaches.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Efficient Audit Trail&lt;&#x2F;strong&gt;: The historical metrics tracking creates an immutable record of protocol health over time, significantly reducing audit complexity compared to current solutions that require reconstructing historical positions.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Cross-Protocol Risk Assessment&lt;&#x2F;strong&gt;: A common interface enables aggregation of risk data across multiple protocols, allowing systemic risk monitoring that&#x27;s impossible with today&#x27;s fragmented reporting systems.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Alternative approaches considered include:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Off-chain Reporting&lt;&#x2F;strong&gt;: While simpler to implement, this lacks the verifiability, real-time nature, and trustless properties of an on-chain solution.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Protocol-Specific Standards&lt;&#x2F;strong&gt;: These would lack the interoperability benefits of a common standard and would perpetuate fragmentation.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Complex Risk Models&lt;&#x2F;strong&gt;: More sophisticated models were evaluated but rejected in favor of this proposal&#x27;s balance between comprehensiveness and implementability.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;This EIP represents the optimal approach by providing a flexible yet standardized framework that can be implemented across diverse protocol types while maintaining reasonable gas efficiency and usability.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;ISolvencyProof&lt;&#x2F;code&gt; interface provides a standardized, on-chain mechanism for DeFi protocols to report, verify, and monitor their solvency status. This interface is designed to be both comprehensive and flexible, supporting a wide range of protocol architectures and risk management strategies.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7893&#x2F;.&#x2F;assets&#x2F;images&#x2F;diagrams&#x2F;main.svg&quot; alt=&quot;main&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;core-interface-requirements&quot;&gt;Core Interface Requirements&lt;&#x2F;h3&gt;
&lt;p&gt;Compliant implementations MUST implement the &lt;code&gt;ISolvencyProof&lt;&#x2F;code&gt; interface.&lt;&#x2F;p&gt;
&lt;p&gt;Compliant implementations MUST provide the following functionality:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Asset and Liability Tracking&lt;&#x2F;strong&gt;: Implementations MUST store and maintain current protocol assets and liabilities with token addresses, amounts, and ETH-denominated values in contract state variables. This data MUST be updated through the &lt;code&gt;updateAssets&lt;&#x2F;code&gt; and &lt;code&gt;updateLiabilities&lt;&#x2F;code&gt; functions called by authorized oracles.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Timestamp Recording&lt;&#x2F;strong&gt;: Implementations MUST record the timestamp of each asset and liability update.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Solvency Calculation&lt;&#x2F;strong&gt;: Implementations MUST calculate the solvency ratio as &lt;code&gt;(Total Assets &#x2F; Total Liabilities) × 10000&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Historical Data&lt;&#x2F;strong&gt;: Implementations MUST maintain historical records of solvency metrics for querying within specified time ranges. Implementations MAY expire old data after a reasonable retention period (e.g., 1 year) but MUST clearly document their retention policy and available time ranges in their implementation documentation.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Event Emission&lt;&#x2F;strong&gt;: Implementations MUST emit &lt;code&gt;SolvencyMetricsUpdated&lt;&#x2F;code&gt; events when financial metrics are updated, and SHOULD emit &lt;code&gt;RiskAlert&lt;&#x2F;code&gt; events when risk thresholds are breached.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Array Validation&lt;&#x2F;strong&gt;: Implementations MUST ensure that all arrays in &lt;code&gt;ProtocolAssets&lt;&#x2F;code&gt; and &lt;code&gt;ProtocolLiabilities&lt;&#x2F;code&gt; structures are of equal length.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Value Denomination&lt;&#x2F;strong&gt;: Implementations MUST express all values in ETH with 18 decimals for consistency.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.20&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ISolvencyProof&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@author&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sean Luis (@SeanLuis) &amp;lt;seanluis47@gmail.com&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Standard Interface for DeFi Protocol Solvency (EIP-DRAFT)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Interface for the DeFi Protocol Solvency Proof Standard&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@custom:security&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;-contact seanluis47@gmail.com&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@custom:version&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 1.0.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ISolvencyProof&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Protocol assets structure&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Represents the current state of protocol assets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@custom:validation&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; All arrays must be equal length&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@custom:validation&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Values must be in ETH with 18 decimals&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ProtocolAssets&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; tokens&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Addresses of tracked tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; amounts&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Amount of each token (in token decimals)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; values&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Value in ETH (18 decimals) of each token amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; timestamp&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Last update timestamp (Unix timestamp in seconds)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Protocol liabilities structure&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Represents the current state of protocol liabilities&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@custom:validation&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; All arrays must be equal length&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@custom:validation&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Values must be in ETH with 18 decimals&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ProtocolLiabilities&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; tokens&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Addresses of liability tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; amounts&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Amount of each liability (in token decimals)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; values&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Value in ETH (18 decimals) of each liability&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; timestamp&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Last update timestamp (Unix timestamp in seconds)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted on metrics update&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Real-time financial health update&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; totalAssets&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sum of asset values in ETH&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; totalLiabilities&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sum of liability values in ETH&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; healthFactor&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Calculated as (totalAssets&#x2F;totalLiabilities) × 10000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; timestamp&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Update timestamp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SolvencyMetricsUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; totalAssets&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; totalLiabilities&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; healthFactor&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; timestamp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when risk thresholds are breached&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Alerts stakeholders of potential solvency risks&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; riskLevel&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Risk level indicating severity of the breach (CRITICAL, HIGH_RISK, WARNING)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; currentValue&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Current value that triggered the alert&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; threshold&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Risk threshold that was breached&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; timestamp&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Alert timestamp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RiskAlert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; riskLevel&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; currentValue&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; threshold&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; timestamp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get protocol&amp;#39;s current assets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Full&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; asset state including tokens, amounts and values&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getProtocolAssets&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;ProtocolAssets&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get protocol&amp;#39;s current liabilities&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Full&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; liability state including tokens, amounts and values&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getProtocolLiabilities&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;ProtocolLiabilities&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Calculate current solvency ratio&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; SR&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; = (Total Assets &#x2F; Total Liabilities) × 10000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getSolvencyRatio&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check protocol solvency status&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; isSolvent&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; True if ratio &amp;gt;= minimum required&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; healthFactor&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Current solvency ratio&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verifySolvency&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; isSolvent&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; healthFactor&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get historical solvency metrics&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; startTime&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Start of time range (Unix timestamp in seconds)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; endTime&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; End of time range (Unix timestamp in seconds)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; timestamps&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Array of historical update timestamps (Unix timestamp in seconds)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ratios&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Array of historical solvency ratios (scaled by 10000)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; assets&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Array of historical asset states&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; liabilities&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Array of historical liability states&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@custom:gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function may consume significant gas for large time ranges&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getSolvencyHistory&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; startTime&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; endTime&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; timestamps&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ratios&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            ProtocolAssets&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; assets&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            ProtocolLiabilities&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; liabilities&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Update protocol assets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Only callable by authorized oracle&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; updateAssets&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokens&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amounts&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; values&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Update protocol liabilities&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Only callable by authorized oracle&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; updateLiabilities&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokens&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amounts&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; values&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;oracle-authorization-requirements&quot;&gt;Oracle Authorization Requirements&lt;&#x2F;h3&gt;
&lt;p&gt;Implementations MUST restrict calls to &lt;code&gt;updateAssets&lt;&#x2F;code&gt; and &lt;code&gt;updateLiabilities&lt;&#x2F;code&gt; to authorized addresses only. Implementations MUST revert these function calls when &lt;code&gt;msg.sender&lt;&#x2F;code&gt; is not an authorized oracle.&lt;&#x2F;p&gt;
&lt;p&gt;Implementations MAY provide oracle management functions. If provided, implementations SHOULD emit events when oracle authorization changes.&lt;&#x2F;p&gt;
&lt;p&gt;Example oracle management pattern (OPTIONAL):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Optional oracle management pattern&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OracleUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; oracle&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; authorized&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setOracle&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; oracle&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; authorized&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The core standard focuses on solvency verification requirements. Oracle management implementation details are left to individual protocol needs.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;update-function-requirements&quot;&gt;Update Function Requirements&lt;&#x2F;h3&gt;
&lt;p&gt;Implementations MUST validate input parameters for &lt;code&gt;updateAssets&lt;&#x2F;code&gt; and &lt;code&gt;updateLiabilities&lt;&#x2F;code&gt; functions:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Implementations MUST revert if the &lt;code&gt;tokens&lt;&#x2F;code&gt;, &lt;code&gt;amounts&lt;&#x2F;code&gt;, and &lt;code&gt;values&lt;&#x2F;code&gt; arrays are not of equal length.&lt;&#x2F;li&gt;
&lt;li&gt;Implementations MUST update the timestamp field to the current block timestamp (&lt;code&gt;block.timestamp&lt;&#x2F;code&gt;) when processing updates.&lt;&#x2F;li&gt;
&lt;li&gt;Implementations MUST emit a &lt;code&gt;SolvencyMetricsUpdated&lt;&#x2F;code&gt; event after successfully updating assets or liabilities.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;query-function-requirements&quot;&gt;Query Function Requirements&lt;&#x2F;h3&gt;
&lt;p&gt;Implementations MUST provide the following query capabilities:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;getProtocolAssets()&lt;&#x2F;code&gt; MUST return the current state of protocol assets including all token addresses, amounts, values, and the timestamp of the last update.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;getProtocolLiabilities()&lt;&#x2F;code&gt; MUST return the current state of protocol liabilities including all token addresses, amounts, values, and the timestamp of the last update.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;getSolvencyRatio()&lt;&#x2F;code&gt; MUST calculate and return the solvency ratio as &lt;code&gt;(totalAssets * 10000) &#x2F; totalLiabilities&lt;&#x2F;code&gt;. If &lt;code&gt;totalLiabilities&lt;&#x2F;code&gt; is zero, implementations SHOULD return a value indicating maximum solvency or revert with an appropriate error.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;verifySolvency()&lt;&#x2F;code&gt; MUST return both a boolean indicating solvency status and the current health factor (solvency ratio).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;getSolvencyHistory(startTime, endTime)&lt;&#x2F;code&gt; MUST return historical data for all recorded snapshots where the timestamp falls within the specified range (inclusive).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;interface-detection-support&quot;&gt;Interface Detection Support&lt;&#x2F;h3&gt;
&lt;p&gt;Compliant implementations MUST implement the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; function and MUST return &lt;code&gt;true&lt;&#x2F;code&gt; for the &lt;code&gt;ISolvencyProof&lt;&#x2F;code&gt; interface ID.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The standard&#x27;s design prioritizes:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Reliability through robust calculations&lt;&#x2F;li&gt;
&lt;li&gt;Efficiency via optimized data structures&lt;&#x2F;li&gt;
&lt;li&gt;Flexibility through modular design&lt;&#x2F;li&gt;
&lt;li&gt;Transparency via standardized metrics&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h4 id=&quot;asset-and-liability-management&quot;&gt;Asset and Liability Management&lt;&#x2F;h4&gt;
&lt;p&gt;Authorized oracles update the protocol&#x27;s asset and liability data through the &lt;code&gt;updateAssets&lt;&#x2F;code&gt; and &lt;code&gt;updateLiabilities&lt;&#x2F;code&gt; functions, which accept parallel arrays of token addresses, amounts, and ETH-denominated values. The interface enforces data consistency by requiring all input arrays to be of equal length and all values to be denominated in ETH with 18 decimal precision. Each update automatically timestamps the data using &lt;code&gt;block.timestamp&lt;&#x2F;code&gt;, ensuring chronological ordering of financial state changes and enabling accurate historical analysis.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;solvency-calculation-and-verification&quot;&gt;Solvency Calculation and Verification&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;getSolvencyRatio&lt;&#x2F;code&gt; function computes the current solvency ratio, defined as the total value of assets divided by the total value of liabilities, scaled by a factor of 10,000 for precision. The &lt;code&gt;verifySolvency&lt;&#x2F;code&gt; function checks whether the protocol meets a minimum required solvency ratio (commonly 105%), returning both a boolean status and the current health factor. This allows both on-chain and off-chain systems to quickly assess the protocol&#x27;s financial health and respond accordingly.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;historical-data-and-trend-analysis&quot;&gt;Historical Data and Trend Analysis&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;getSolvencyHistory&lt;&#x2F;code&gt; function enables retrieval of historical solvency metrics, including timestamps, ratios, and the corresponding asset and liability states over a specified time range. This historical data is crucial for reconstructing past events, analyzing risk trends, and providing transparency to stakeholders. This supports audits, regulatory requirements, and trend analysis needs.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;event-emission-and-risk-alerts&quot;&gt;Event Emission and Risk Alerts&lt;&#x2F;h4&gt;
&lt;p&gt;Whenever the protocol&#x27;s financial metrics are updated, the &lt;code&gt;SolvencyMetricsUpdated&lt;&#x2F;code&gt; event is emitted, providing real-time data for off-chain monitoring and analytics. When risk thresholds are breached (for example, if the solvency ratio falls below a critical level), the &lt;code&gt;RiskAlert&lt;&#x2F;code&gt; event is triggered, signaling the severity and nature of the risk. These events enable automated monitoring systems, auditors, and users to receive timely notifications and take appropriate action.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;oracle-integration-and-security&quot;&gt;Oracle Integration and Security&lt;&#x2F;h4&gt;
&lt;p&gt;The interface is designed to be oracle-agnostic, allowing protocols to integrate with a variety of price feed solutions (e.g., Chainlink, API3, custom oracles). The requirement that only authorized oracles can update asset and liability data ensures that updates are secure and resistant to manipulation. The optional &lt;code&gt;setOracle&lt;&#x2F;code&gt; and &lt;code&gt;OracleUpdated&lt;&#x2F;code&gt; event pattern is recommended for managing oracle permissions and maintaining robust security controls.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;intended-usage-and-integration&quot;&gt;Intended Usage and Integration&lt;&#x2F;h4&gt;
&lt;p&gt;Protocols implementing this interface integrate with trusted oracles for price feeds and position updates, maintain up-to-date records of their financial positions, emit standardized events for off-chain monitoring and risk management, and provide transparent, verifiable, and standardized information about their solvency status to all stakeholders. External consumers (such as auditors, users, or other smart contracts) can query the protocol&#x27;s current and historical solvency status using the provided view functions, and can listen for events to receive timely notifications of significant changes or risks. This design ensures that all stakeholders have access to reliable, real-time information about a protocol&#x27;s financial health, enabling more robust risk management and greater trust in the DeFi ecosystem.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;data-structure-design-rationale&quot;&gt;Data Structure Design Rationale&lt;&#x2F;h3&gt;
&lt;p&gt;The interface defines two primary data structures (&lt;code&gt;ProtocolAssets&lt;&#x2F;code&gt; and &lt;code&gt;ProtocolLiabilities&lt;&#x2F;code&gt;) with specific attributes:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Array-based token tracking&lt;&#x2F;strong&gt; was selected over mapping-based approaches for:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;More efficient state retrieval for monitoring systems&lt;&#x2F;li&gt;
&lt;li&gt;Better compatibility with historical tracking requirements&lt;&#x2F;li&gt;
&lt;li&gt;Simplified batch updates in volatile market conditions&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Timestamp embedding&lt;&#x2F;strong&gt; within structures rather than separate mappings provides:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Atomic updates with data consistency guarantees&lt;&#x2F;li&gt;
&lt;li&gt;Protection against partial-update scenarios during price volatility&lt;&#x2F;li&gt;
&lt;li&gt;Single-transaction verification of data freshness&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Combined value and amount tracking&lt;&#x2F;strong&gt; was implemented for:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Enhanced resilience during high market volatility&lt;&#x2F;li&gt;
&lt;li&gt;Ability to detect oracle manipulation by comparing historical value&#x2F;amount ratios&lt;&#x2F;li&gt;
&lt;li&gt;Clear audit trails for post-mortem analysis&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;test-driven-design-decisions&quot;&gt;Test-Driven Design Decisions&lt;&#x2F;h3&gt;
&lt;p&gt;Our implementation testing significantly shaped the final design:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Market Crash Simulation Tests&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Tests simulate extreme scenarios (80% ETH price drop, 70% BTC price drop)&lt;&#x2F;li&gt;
&lt;li&gt;Validates the system correctly identifies insolvency when ratios fall below critical thresholds&lt;&#x2F;li&gt;
&lt;li&gt;Confirms proper functionality of emergency protocols during rapid market movements&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Volatility Testing&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Test suite subjects implementation to sinusoidal price movements&lt;&#x2F;li&gt;
&lt;li&gt;Validates consistent health factor calculation across 5 distinct price points&lt;&#x2F;li&gt;
&lt;li&gt;Confirms historical metrics are properly recorded with sequential timestamps&lt;&#x2F;li&gt;
&lt;li&gt;Verifies that price volatility is accurately reflected in solvency ratios&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Oracle Integration&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Tests confirm proper authorization controls for price updates&lt;&#x2F;li&gt;
&lt;li&gt;Validates calculation consistency across different token types&lt;&#x2F;li&gt;
&lt;li&gt;Demonstrates resilience against unexpected price movements&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;threshold-selection-methodology&quot;&gt;Threshold Selection Methodology&lt;&#x2F;h3&gt;
&lt;p&gt;The recommended threshold values (105%, 110%, 120%) were selected based on:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Market Crash Testing&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;105% represents the critical threshold where recovery becomes unlikely&lt;&#x2F;li&gt;
&lt;li&gt;Testing confirms this threshold successfully identifies insolvency scenarios&lt;&#x2F;li&gt;
&lt;li&gt;System correctly triggers warnings at appropriate levels&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Complex Portfolio Analysis&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Tests with diverse portfolios (ETH, BTC, USDC, LP tokens, etc.)&lt;&#x2F;li&gt;
&lt;li&gt;Complex liability structures (stablecoins + volatile assets)&lt;&#x2F;li&gt;
&lt;li&gt;Thresholds provide appropriate buffer against normal market fluctuations&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Gas Optimization vs. Precision&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The selected ratio calculation method balances computational efficiency with accuracy&lt;&#x2F;li&gt;
&lt;li&gt;Implementation uses fixed-point math for consistent results&lt;&#x2F;li&gt;
&lt;li&gt;Storage optimizations maintain historical data while minimizing costs&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;implementation-insights&quot;&gt;Implementation Insights&lt;&#x2F;h3&gt;
&lt;p&gt;Key insights from comprehensive implementation and testing:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Efficient Asset Tracking&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The parallel arrays approach for token data minimizes storage costs&lt;&#x2F;li&gt;
&lt;li&gt;Implementation maintains constant-time lookups for critical operations&lt;&#x2F;li&gt;
&lt;li&gt;Bounded array sizes prevent out-of-gas scenarios&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Oracle Integration Patterns&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Permissioned oracle design prevents manipulation&lt;&#x2F;li&gt;
&lt;li&gt;Clean separation between price data and protocol logic&lt;&#x2F;li&gt;
&lt;li&gt;Flexible design supports various oracle implementations&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Risk Management System&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Multi-tier alert system provides graduated responses to deteriorating conditions&lt;&#x2F;li&gt;
&lt;li&gt;Historical metrics enable trend analysis across market cycles&lt;&#x2F;li&gt;
&lt;li&gt;Verification functions support both on-chain and off-chain monitoring systems&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;These insights are derived from comprehensive testing covering market crashes, volatility scenarios, and complex asset portfolios.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;mathematical-model&quot;&gt;Mathematical Model&lt;&#x2F;h3&gt;
&lt;p&gt;The solvency verification system is based on comprehensive mathematical models:&lt;&#x2F;p&gt;
&lt;h4 id=&quot;1-core-solvency-calculations&quot;&gt;1. Core Solvency Calculations&lt;&#x2F;h4&gt;
&lt;p&gt;$SR = (TA &#x2F; TL) × 100$&lt;&#x2F;p&gt;
&lt;p&gt;Where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;$TA = \sum(A_i × P_i)$  &#x2F;&#x2F; Total Assets&lt;&#x2F;li&gt;
&lt;li&gt;$TL = \sum(L_i × P_i)$  &#x2F;&#x2F; Total Liabilities&lt;&#x2F;li&gt;
&lt;li&gt;$A_i$ = Amount of asset i&lt;&#x2F;li&gt;
&lt;li&gt;$P_i$ = Price of asset i&lt;&#x2F;li&gt;
&lt;li&gt;$L_i$ = Liability i&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;2-risk-adjusted-health-factor&quot;&gt;2. Risk-Adjusted Health Factor&lt;&#x2F;h4&gt;
&lt;p&gt;$HF = \frac{\sum(A_i × P_i × W_i)}{\sum(L_i × P_i × R_i)}$&lt;&#x2F;p&gt;
&lt;p&gt;Where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;$W_i$ = Risk weight of asset i $(0 &amp;lt; W_i \leq 1)$&lt;&#x2F;li&gt;
&lt;li&gt;$R_i$ = Risk factor for liability i $(R_i \geq 1)$&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;3-risk-metrics&quot;&gt;3. Risk Metrics&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;value-at-risk-var&quot;&gt;Value at Risk (VaR)&lt;&#x2F;h5&gt;
&lt;p&gt;$VaR(\alpha) = \mu - (\sigma × z(\alpha))$&lt;&#x2F;p&gt;
&lt;p&gt;Where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;$\mu$ = Expected return&lt;&#x2F;li&gt;
&lt;li&gt;$\sigma$ = Standard deviation&lt;&#x2F;li&gt;
&lt;li&gt;$z(\alpha)$ = z-value for confidence level $\alpha$&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;liquidity-coverage-ratio-lcr&quot;&gt;Liquidity Coverage Ratio (LCR)&lt;&#x2F;h5&gt;
&lt;p&gt;$LCR = \frac{HQLA}{TNCO} × 100$&lt;&#x2F;p&gt;
&lt;p&gt;Where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;HQLA = High Quality Liquid Assets&lt;&#x2F;li&gt;
&lt;li&gt;TNCO = Total Net Cash Outflows (30 days)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;4-system-health-index&quot;&gt;4. System Health Index&lt;&#x2F;h4&gt;
&lt;p&gt;$SI = \frac{SR × w_1 + LCR × w_2 + (1&#x2F;\sigma) × w_3}{w_1 + w_2 + w_3}$&lt;&#x2F;p&gt;
&lt;p&gt;Where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;$w_1,w_2,w_3$ = Weighting factors&lt;&#x2F;li&gt;
&lt;li&gt;$\sigma$ = System volatility&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;5-default-probability&quot;&gt;5. Default Probability&lt;&#x2F;h4&gt;
&lt;p&gt;$PD = N(-DD)$
$DD = \frac{ln(TA&#x2F;TL) + (\mu - \sigma^2&#x2F;2)T}{\sigma\sqrt{T}}$&lt;&#x2F;p&gt;
&lt;p&gt;Where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;DD = Distance to Default&lt;&#x2F;li&gt;
&lt;li&gt;T = Time horizon&lt;&#x2F;li&gt;
&lt;li&gt;N() = Standard normal distribution&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;risk-thresholds&quot;&gt;Risk Thresholds&lt;&#x2F;h3&gt;
&lt;p&gt;The following thresholds have been validated through extensive testing:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Risk Level&lt;&#x2F;th&gt;&lt;th&gt;Ratio Range&lt;&#x2F;th&gt;&lt;th&gt;Action Required&lt;&#x2F;th&gt;&lt;th&gt;Validation Status&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;CRITICAL&lt;&#x2F;td&gt;&lt;td&gt;&amp;lt; 105%&lt;&#x2F;td&gt;&lt;td&gt;Emergency Stop&lt;&#x2F;td&gt;&lt;td&gt;✅ Validated&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;HIGH RISK&lt;&#x2F;td&gt;&lt;td&gt;105% - 110%&lt;&#x2F;td&gt;&lt;td&gt;Risk Alert&lt;&#x2F;td&gt;&lt;td&gt;✅ Validated&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;WARNING&lt;&#x2F;td&gt;&lt;td&gt;110% - 120%&lt;&#x2F;td&gt;&lt;td&gt;Monitor&lt;&#x2F;td&gt;&lt;td&gt;✅ Validated&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;HEALTHY&lt;&#x2F;td&gt;&lt;td&gt;≥ 120%&lt;&#x2F;td&gt;&lt;td&gt;Normal&lt;&#x2F;td&gt;&lt;td&gt;✅ Validated&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Testing has confirmed that:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The system correctly handles 50% market drops&lt;&#x2F;li&gt;
&lt;li&gt;Ratios are calculated accurately in all scenarios&lt;&#x2F;li&gt;
&lt;li&gt;State updates maintain consistency&lt;&#x2F;li&gt;
&lt;li&gt;Ratio limits are effective for early detection&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7893&#x2F;.&#x2F;assets&#x2F;images&#x2F;diagrams&#x2F;risk-thresholds.svg&quot; alt=&quot;risk-thresholds&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;risk-assessment-framework&quot;&gt;Risk Assessment Framework&lt;&#x2F;h3&gt;
&lt;p&gt;The standard implements a multi-tiered risk assessment system:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Primary Metrics:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Base Solvency Ratio (SR)&lt;&#x2F;li&gt;
&lt;li&gt;Risk-Adjusted Health Factor (HF)&lt;&#x2F;li&gt;
&lt;li&gt;Liquidity Coverage Ratio (LCR)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Threshold Levels:&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7893&#x2F;.&#x2F;assets&#x2F;images&#x2F;diagrams&#x2F;threshold-levels.svg&quot; alt=&quot;threshold-levels&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;oracle-integration-optional&quot;&gt;Oracle Integration (Optional)&lt;&#x2F;h3&gt;
&lt;p&gt;This standard intentionally leaves oracle implementation flexible. Protocols MAY implement price feeds in various ways:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Direct Integration&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Using existing oracle networks (Chainlink, API3, etc.)&lt;&#x2F;li&gt;
&lt;li&gt;Custom price feed implementations&lt;&#x2F;li&gt;
&lt;li&gt;Internal price calculations&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Aggregation Strategies&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Multiple oracle sources&lt;&#x2F;li&gt;
&lt;li&gt;TWAP implementations&lt;&#x2F;li&gt;
&lt;li&gt;Medianized price feeds&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7893&#x2F;.&#x2F;assets&#x2F;images&#x2F;diagrams&#x2F;oracle-integration.svg&quot; alt=&quot;oracle-integration&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;implementation-requirements&quot;&gt;Implementation Requirements&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Asset Management:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Real-time asset tracking&lt;&#x2F;li&gt;
&lt;li&gt;Price feed integration&lt;&#x2F;li&gt;
&lt;li&gt;Historical data maintenance&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Liability Tracking:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Debt obligation monitoring&lt;&#x2F;li&gt;
&lt;li&gt;Collateral requirement calculation&lt;&#x2F;li&gt;
&lt;li&gt;Risk factor assessment&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Reporting System:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Event emission for significant changes&lt;&#x2F;li&gt;
&lt;li&gt;Threshold breach notifications&lt;&#x2F;li&gt;
&lt;li&gt;Historical data access&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;implementation-considerations&quot;&gt;Implementation Considerations&lt;&#x2F;h3&gt;
&lt;h3 id=&quot;implementation-notes&quot;&gt;Implementation Notes&lt;&#x2F;h3&gt;
&lt;p&gt;Based on conducted tests, it is recommended:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Liability Management:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Maintain constant liabilities during price updates&lt;&#x2F;li&gt;
&lt;li&gt;Validate that liabilities are never 0 to avoid division by zero&lt;&#x2F;li&gt;
&lt;li&gt;Update liabilities only when actual positions change&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Ratio Calculation:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calculateRatio&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; assets&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; liabilities&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;liabilities &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; assets &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ?&lt;&#x2F;span&gt;&lt;span&gt; RATIO_DECIMALS &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; :&lt;&#x2F;span&gt;&lt;span&gt; RATIO_DECIMALS&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;assets &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; RATIO_DECIMALS&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span&gt; liabilities&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;State Validation:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Verify values before updating&lt;&#x2F;li&gt;
&lt;li&gt;Maintain accurate history&lt;&#x2F;li&gt;
&lt;li&gt;Emit events for significant changes&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Gas Considerations:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Optimize history storage&lt;&#x2F;li&gt;
&lt;li&gt;Batch updates for multiple tokens&lt;&#x2F;li&gt;
&lt;li&gt;Limit array sizes in updates&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is compatible with existing DeFi protocols and requires no changes to existing token standards.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The reference implementation provides a comprehensive example of the standard in action:&lt;&#x2F;p&gt;
&lt;h3 id=&quot;core-implementation-requirements&quot;&gt;Core Implementation Requirements&lt;&#x2F;h3&gt;
&lt;p&gt;Implementations of the &lt;code&gt;ISolvencyProof&lt;&#x2F;code&gt; interface should provide robust solvency monitoring with:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Advanced state management&lt;&#x2F;strong&gt; with atomic updates and timestamp tracking&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Multi-layered security&lt;&#x2F;strong&gt; including access control, rate limiting, and circuit breakers&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Historical data management&lt;&#x2F;strong&gt; with bounded storage and configurable retention&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Oracle integration&lt;&#x2F;strong&gt; with consensus validation and staleness detection&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Emergency response systems&lt;&#x2F;strong&gt; with automatic pausing and guardian controls&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Comprehensive event emission&lt;&#x2F;strong&gt; for real-time monitoring and risk alerts&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;recommended-implementation-patterns&quot;&gt;Recommended Implementation Patterns&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;state-management-with-security-constants&quot;&gt;State Management with Security Constants&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Security constants for production deployment&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; RATIO_DECIMALS &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10000&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; MIN_SOLVENCY_RATIO &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10500&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; CRITICAL_RATIO &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10200&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; WARNING_RATIO &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 11000&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Enhanced security constants&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; MAX_PRICE_DEVIATION &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 500&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 5%&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; MAX_TOKENS_PER_UPDATE &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 50&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; DoS protection&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; STALENESS_THRESHOLD &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3600&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 1 hour&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; CIRCUIT_BREAKER_THRESHOLD &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2000&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 20%&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; UPDATE_COOLDOWN &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 5&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;          &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 5 blocks&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; MAX_HISTORY_ENTRIES &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 8760&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ~1 year&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; MIN_ENTRY_INTERVAL &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3600&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 1 hour&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Role-based access control&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; ORACLE_ROLE &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;ORACLE_ROLE&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; EMERGENCY_ROLE &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;EMERGENCY_ROLE&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; ADMIN_ROLE &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;ADMIN_ROLE&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Enhanced state variables&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ProtocolAssets &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;private&lt;&#x2F;span&gt;&lt;span&gt; currentAssets&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ProtocolLiabilities &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;private&lt;&#x2F;span&gt;&lt;span&gt; currentLiabilities&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Multi-oracle price tracking&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; oraclePrices&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; oracleLastUpdate&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; lastUpdateBlock&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emergency controls&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; emergencyPaused&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; pauseEndTime&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; emergencyGuardian&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Historical data with metadata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; HistoricalMetric&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; timestamp&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; solvencyRatio&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ProtocolAssets assets&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ProtocolLiabilities liabilities&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; updatedBy&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;HistoricalMetric&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; metricsHistory&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; lastHistoricalEntry&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;advanced-security-features&quot;&gt;Advanced Security Features&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;access-control-system&quot;&gt;Access Control System&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Multi-role access control with backward compatibility&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;modifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOracle&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        assetOracles&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; hasRole&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ORACLE_ROLE&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        &amp;quot;Not authorized oracle&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;emergencyPaused &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; pauseEndTime&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        &amp;quot;Emergency paused&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    _&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Rate limiting to prevent spam&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;modifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; rateLimited&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; lastUpdateBlock&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; UPDATE_COOLDOWN&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        &amp;quot;Update too frequent&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    lastUpdateBlock&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RateLimitTriggered&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    _&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;circuit-breaker-implementation&quot;&gt;Circuit Breaker Implementation&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _checkCircuitBreaker&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; previousTotal&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newTotal&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;previousTotal &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; assetChange &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; newTotal &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; previousTotal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            ?&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;newTotal &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt; previousTotal&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span&gt; previousTotal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            :&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;previousTotal &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt; newTotal&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span&gt; previousTotal&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;assetChange &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; CIRCUIT_BREAKER_THRESHOLD&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            emergencyPaused &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            pauseEndTime &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3600&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 1 hour pause&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CircuitBreakerTriggered&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;Large asset change&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                assetChange&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; CIRCUIT_BREAKER_THRESHOLD&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EmergencyPaused&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; pauseEndTime&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;multi-oracle-consensus-validation&quot;&gt;Multi-Oracle Consensus Validation&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _validatePriceConsensus&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; proposedPrice&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; activeOracles &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _getActiveOracles&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;activeOracles&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Collect and validate prices from multiple oracles&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; prices &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[](&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;activeOracles&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; validPrices &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; activeOracles&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;oraclePrices&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;activeOracles&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;token&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            prices&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;validPrices&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; oraclePrices&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;activeOracles&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;token&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            validPrices&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;validPrices &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Calculate median and check deviation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; median &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _calculateMedian&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;prices&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; validPrices&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; deviation &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; proposedPrice &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; median&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        ?&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;proposedPrice &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt; median&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span&gt; median&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        :&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;median &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt; proposedPrice&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span&gt; median&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;deviation &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; MAX_PRICE_DEVIATION&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PriceDeviationAlert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; deviation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; activeOracles&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;historical-data-management&quot;&gt;Historical Data Management&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getSolvencyHistory&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; startTime&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; endTime&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        ProtocolAssets&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; ProtocolLiabilities&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Two-pass approach for gas optimization&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; count &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; metricsHistory&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;metricsHistory&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; startTime &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            metricsHistory&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; endTime&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            count&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;count &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 100&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; break&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Gas limit protection&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Allocate exact size arrays&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; timestamps &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[](&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;count&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; ratios &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[](&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;count&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ProtocolAssets&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; assets &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span&gt; ProtocolAssets&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;count&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ProtocolLiabilities&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; liabilities &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span&gt; ProtocolLiabilities&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;count&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Populate arrays&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; index &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; metricsHistory&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; index &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; count&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;metricsHistory&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; startTime &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            metricsHistory&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; endTime&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            timestamps&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; metricsHistory&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            ratios&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; metricsHistory&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;solvencyRatio&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            assets&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; metricsHistory&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;assets&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            liabilities&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; metricsHistory&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;liabilities&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;timestamps&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; ratios&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; assets&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; liabilities&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getHistoricalDataInfo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; totalEntries&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; maxEntries&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; oldestTimestamp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newestTimestamp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; minInterval&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    totalEntries &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; metricsHistory&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    maxEntries &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; MAX_HISTORY_ENTRIES&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    minInterval &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; MIN_ENTRY_INTERVAL&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;totalEntries &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        oldestTimestamp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; metricsHistory&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        newestTimestamp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; metricsHistory&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;totalEntries &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;totalEntries&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; maxEntries&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; oldestTimestamp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        newestTimestamp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; minInterval&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;emergency-response-system&quot;&gt;Emergency Response System&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; emergencyPause&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyEmergencyGuardian&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    emergencyPaused &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    pauseEndTime &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3600&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 4 hour default&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EmergencyPaused&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; pauseEndTime&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; emergencyUnpause&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyEmergencyGuardian&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    emergencyPaused &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    pauseEndTime &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EmergencyUnpaused&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getEmergencyStatus&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; isPaused&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; endTime&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; guardian&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;emergencyPaused&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; pauseEndTime&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; emergencyGuardian&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;gas-optimization-strategies&quot;&gt;Gas Optimization Strategies&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;bounded-operations&quot;&gt;Bounded Operations&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Maximum array sizes&lt;&#x2F;strong&gt; (50 tokens per update) to prevent out-of-gas&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Historical data pagination&lt;&#x2F;strong&gt; (max 100 entries per query)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Efficient storage patterns&lt;&#x2F;strong&gt; with bounded retention periods&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;storage-optimization&quot;&gt;Storage Optimization&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Circular buffer approach&lt;&#x2F;strong&gt; for historical data rotation&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Rate-limited historical entries&lt;&#x2F;strong&gt; (minimum 1-hour intervals)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Compact data structures&lt;&#x2F;strong&gt; minimizing storage overhead&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;testing-and-validation-requirements&quot;&gt;Testing and Validation Requirements&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;comprehensive-test-coverage&quot;&gt;Comprehensive Test Coverage&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Mathematical precision&lt;&#x2F;strong&gt; validation for ratio calculations&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Security feature testing&lt;&#x2F;strong&gt; (access control, rate limiting, circuit breakers)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Oracle reliability testing&lt;&#x2F;strong&gt; under various market conditions&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Gas consumption analysis&lt;&#x2F;strong&gt; with stress testing&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Emergency scenario simulation&lt;&#x2F;strong&gt; with pause&#x2F;unpause cycles&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;production-deployment-requirements&quot;&gt;Production Deployment Requirements&lt;&#x2F;h4&gt;
&lt;p&gt;Production implementations should ensure:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Multi-oracle consensus mechanism implemented and tested&lt;&#x2F;li&gt;
&lt;li&gt;Circuit breaker triggers validated with historical data&lt;&#x2F;li&gt;
&lt;li&gt;Rate limiting prevents spam without blocking legitimate updates&lt;&#x2F;li&gt;
&lt;li&gt;Emergency pause&#x2F;unpause mechanisms tested with time delays&lt;&#x2F;li&gt;
&lt;li&gt;Gas optimization prevents DoS while maintaining functionality&lt;&#x2F;li&gt;
&lt;li&gt;Access controls follow principle of least privilege&lt;&#x2F;li&gt;
&lt;li&gt;Historical data storage bounded and efficient&lt;&#x2F;li&gt;
&lt;li&gt;Security parameters documented and transparent&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;integration-patterns&quot;&gt;Integration Patterns&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;oracle-integration&quot;&gt;Oracle Integration&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Primary oracle feeds&lt;&#x2F;strong&gt; (Chainlink, API3) with fallback mechanisms&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;TWAP integration&lt;&#x2F;strong&gt; for manipulation resistance&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Staleness detection&lt;&#x2F;strong&gt; with automatic fallback to secondary oracles&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;liquidation-system-optional-enhancement&quot;&gt;Liquidation System (Optional Enhancement)&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; LiquidationConfig&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; maxLiquidationRatio&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Max % liquidatable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; liquidationBonus&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Liquidator bonus&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; minHealthFactor&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Minimum health factor&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; maxSlippage&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;          &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Slippage tolerance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bool&lt;&#x2F;span&gt;&lt;span&gt; isActive&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeLiquidation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; protocol&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; debtAmount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expectedCollateral&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; maxSlippage&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; actualCollateral&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; liquidationBonus&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Comprehensive liquidation logic with health factor validation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Slippage protection and bonus calculation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Position updates and event emission&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This implementation demonstrates production-ready patterns for DeFi protocol solvency monitoring with enterprise-grade security, gas optimization, and comprehensive risk management.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;When implementing solvency monitoring for DeFi protocols, security isn&#x27;t optional—it&#x27;s essential. We&#x27;ve learned hard lessons from protocol failures, oracle manipulation attacks, and market crashes. This section covers the practical security measures you need to implement, drawn from what actually works in production systems like Aave, Compound, and MakerDAO.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;oracle-security-implementation-requirements&quot;&gt;Oracle Security - Implementation Requirements&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;price-feed-validation&quot;&gt;Price Feed Validation&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Minimum 3 independent oracle sources&lt;&#x2F;strong&gt; with median aggregation to prevent single points of failure&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Deviation threshold checks:&lt;&#x2F;strong&gt; Reject price updates exceeding 5% difference between sources&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Staleness validation:&lt;&#x2F;strong&gt; ETH&#x2F;USD and major crypto pairs should use 1-hour maximum staleness (3600 seconds)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Circuit breaker integration:&lt;&#x2F;strong&gt; Pause solvency updates when price movements exceed 20% in single block&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Implementation patterns for price validation should include median calculation, deviation checks, and appropriate error handling.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Real-world reference:&lt;&#x2F;strong&gt; Chainlink&#x27;s Feed Registry and Aave&#x27;s AaveOracle provide solid patterns for oracle integration.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;twap-integration&quot;&gt;TWAP Integration&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;30-minute minimum windows&lt;&#x2F;strong&gt; for manipulation resistance (based on Uniswap V3 security analysis)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Minimum $1-5M liquidity&lt;&#x2F;strong&gt; in reference pools for oracle reliability&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Combined validation:&lt;&#x2F;strong&gt; Primary Chainlink feeds with Uniswap V3 TWAP backup verification&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;oracle-failure-handling&quot;&gt;Oracle Failure Handling&lt;&#x2F;h4&gt;
&lt;p&gt;Implementations should include fallback mechanisms for oracle failures, including timestamp validation, secondary oracle integration, and graceful degradation patterns.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;access-control-specific-implementation&quot;&gt;Access Control - Specific Implementation&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;role-based-permissions&quot;&gt;Role-Based Permissions&lt;&#x2F;h4&gt;
&lt;p&gt;Implementations should use established access control patterns such as OpenZeppelin&#x27;s AccessControl for role management, including oracle roles, emergency roles, and administrative functions.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;rate-limiting-implementation&quot;&gt;Rate Limiting Implementation&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Maximum 1 update per 5 blocks&lt;&#x2F;strong&gt; per authorized oracle to prevent spam attacks&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Daily update limits:&lt;&#x2F;strong&gt; 288 updates per day (every 5 minutes) for high-frequency protocols&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Emergency cooldowns:&lt;&#x2F;strong&gt; 1-hour minimum between emergency pause activations&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Rate limiting should be implemented using block-based cooldowns and per-oracle tracking.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;multi-signature-requirements&quot;&gt;Multi-signature Requirements&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;3&#x2F;5 multisig for parameter changes (threshold updates, oracle management)&lt;&#x2F;li&gt;
&lt;li&gt;4&#x2F;7 multisig for critical upgrades (we borrowed this from Compound V3)&lt;&#x2F;li&gt;
&lt;li&gt;Separate emergency pause authority from main governance (Aave&#x27;s Guardian model works well here)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;risk-management-concrete-parameters&quot;&gt;Risk Management - Concrete Parameters&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;threshold-calibration-with-production-values&quot;&gt;Threshold Calibration with Production Values&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Risk Level&lt;&#x2F;th&gt;&lt;th&gt;Solvency Ratio&lt;&#x2F;th&gt;&lt;th&gt;Liquidation Bonus&lt;&#x2F;th&gt;&lt;th&gt;Close Factor&lt;&#x2F;th&gt;&lt;th&gt;Implementation&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;CRITICAL&lt;&#x2F;td&gt;&lt;td&gt;&amp;lt; 105%&lt;&#x2F;td&gt;&lt;td&gt;10-15%&lt;&#x2F;td&gt;&lt;td&gt;100%&lt;&#x2F;td&gt;&lt;td&gt;Emergency pause all operations&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;HIGH_RISK&lt;&#x2F;td&gt;&lt;td&gt;105% - 110%&lt;&#x2F;td&gt;&lt;td&gt;7-10%&lt;&#x2F;td&gt;&lt;td&gt;75%&lt;&#x2F;td&gt;&lt;td&gt;Restrict new borrowing&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;WARNING&lt;&#x2F;td&gt;&lt;td&gt;110% - 120%&lt;&#x2F;td&gt;&lt;td&gt;5-7%&lt;&#x2F;td&gt;&lt;td&gt;50%&lt;&#x2F;td&gt;&lt;td&gt;Enhanced monitoring&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;HEALTHY&lt;&#x2F;td&gt;&lt;td&gt;≥ 120%&lt;&#x2F;td&gt;&lt;td&gt;5%&lt;&#x2F;td&gt;&lt;td&gt;50%&lt;&#x2F;td&gt;&lt;td&gt;Normal operations&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;alert-system-implementation&quot;&gt;Alert System Implementation&lt;&#x2F;h4&gt;
&lt;p&gt;Risk threshold monitoring should include graduated alerts (CRITICAL, HIGH_RISK, WARNING) with appropriate automated responses.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;historical-data-protection&quot;&gt;Historical Data Protection&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Immutable storage patterns&lt;&#x2F;strong&gt; to prevent historical data manipulation&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Checksum validation&lt;&#x2F;strong&gt; for stored historical ratios using merkle trees&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Maximum storage limits:&lt;&#x2F;strong&gt; 8760 hourly records (1 year) to prevent unbounded growth&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;emergency-response-mechanisms&quot;&gt;Emergency Response Mechanisms&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;circuit-breaker-integration&quot;&gt;Circuit Breaker Integration&lt;&#x2F;h4&gt;
&lt;p&gt;Circuit breaker mechanisms should monitor for dramatic value changes and automatically pause operations when thresholds are exceeded. Implementation should include emergency pause states, time-based recovery, and appropriate event emission.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Automatic pause triggers:&lt;&#x2F;strong&gt; Oracle deviation &amp;gt;20%, liquidity drop &amp;gt;50% in 1 hour&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Initial pause duration:&lt;&#x2F;strong&gt; 1-4 hours with exponential backoff for repeated triggers&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Gradual resume:&lt;&#x2F;strong&gt; 25% → 50% → 75% → 100% capacity with 30-minute monitoring between phases&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;time-delays-for-critical-operations&quot;&gt;Time Delays for Critical Operations&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Protocol upgrades:&lt;&#x2F;strong&gt; 7 days (604,800 seconds) following MakerDAO governance pattern&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Threshold parameter changes:&lt;&#x2F;strong&gt; 48 hours (172,800 seconds)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Oracle authority changes:&lt;&#x2F;strong&gt; 24 hours (86,400 seconds) with immediate emergency override&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;gas-optimization-security&quot;&gt;Gas Optimization Security&lt;&#x2F;h3&gt;
&lt;h5 id=&quot;bounded-operations-1&quot;&gt;Bounded Operations&lt;&#x2F;h5&gt;
&lt;p&gt;Implementations should enforce reasonable limits on array sizes, historical data storage, and operation complexity to prevent denial-of-service attacks and ensure predictable gas consumption.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;dos-attack-prevention&quot;&gt;DoS Attack Prevention&lt;&#x2F;h5&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Maximum 50 tokens per update&lt;&#x2F;strong&gt; to prevent out-of-gas scenarios&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Pagination for historical queries&lt;&#x2F;strong&gt; with max 100 records per call&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Input validation:&lt;&#x2F;strong&gt; Reject empty arrays, validate array length consistency&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Reentrancy protection:&lt;&#x2F;strong&gt; Use OpenZeppelin&#x27;s ReentrancyGuard for all external calls&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;integration-security-patterns&quot;&gt;Integration Security Patterns&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;liquidation-protection-pattern&quot;&gt;Liquidation Protection Pattern&lt;&#x2F;h4&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;&#x2F;strong&gt; This is a recommended integration pattern for protocols implementing this ERC. The core solvency monitoring contract focuses on solvency monitoring; liquidation logic should be implemented in the consuming protocol.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;Liquidation integrations should include health factor validation, partial liquidation limits, and slippage protection mechanisms.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Health factor buffers:&lt;&#x2F;strong&gt; 110% warning threshold before 105% liquidation&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Partial liquidation limits:&lt;&#x2F;strong&gt; Maximum 50% of debt in single transaction&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Slippage protection:&lt;&#x2F;strong&gt; 3% maximum slippage for automated liquidations&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;validation-and-testing-requirements&quot;&gt;Validation and Testing Requirements&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;stress-testing-scenarios&quot;&gt;Stress Testing Scenarios&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;50% market crash simulation&lt;&#x2F;strong&gt; with proper threshold triggers&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Oracle manipulation attempts&lt;&#x2F;strong&gt; with 20%+ false price movements&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;High-frequency update scenarios&lt;&#x2F;strong&gt; testing rate limiting effectiveness&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Network congestion testing&lt;&#x2F;strong&gt; with increased gas prices&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;audit-requirements&quot;&gt;Audit Requirements&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Formal verification&lt;&#x2F;strong&gt; of solvency calculation logic&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Oracle integration testing&lt;&#x2F;strong&gt; across multiple price feed providers&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Emergency scenario testing&lt;&#x2F;strong&gt; including pause&#x2F;unpause cycles&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Gas consumption analysis&lt;&#x2F;strong&gt; for all operations under stress conditions&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;production-deployment-requirements-1&quot;&gt;Production Deployment Requirements&lt;&#x2F;h4&gt;
&lt;p&gt;Production implementations should ensure:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Multi-oracle consensus mechanism implemented and tested&lt;&#x2F;li&gt;
&lt;li&gt;Circuit breaker triggers validated with historical data&lt;&#x2F;li&gt;
&lt;li&gt;Rate limiting prevents spam without blocking legitimate updates&lt;&#x2F;li&gt;
&lt;li&gt;Emergency pause&#x2F;unpause mechanisms tested with time delays&lt;&#x2F;li&gt;
&lt;li&gt;Gas optimization prevents DoS while maintaining functionality&lt;&#x2F;li&gt;
&lt;li&gt;Access controls follow principle of least privilege&lt;&#x2F;li&gt;
&lt;li&gt;Historical data storage bounded and efficient&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;These security considerations are based on production implementations from Aave V3, Compound V3, MakerDAO, and Synthetix protocols, incorporating lessons learned from actual security incidents and governance responses in the DeFi ecosystem. The specific parameters and thresholds have been validated through extensive testing scenarios including market crashes, oracle manipulation attempts, and high-frequency trading conditions.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;production-validated-security-parameters&quot;&gt;Production-Validated Security Parameters&lt;&#x2F;h3&gt;
&lt;p&gt;All security parameters have been validated against real-world DeFi protocols:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Reference&lt;&#x2F;th&gt;&lt;th&gt;Validation Status&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Critical Ratio&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;102%&lt;&#x2F;td&gt;&lt;td&gt;Aave V3 WBTC liquidation threshold&lt;&#x2F;td&gt;&lt;td&gt;✅ Production-tested&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Min Solvency Ratio&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;105%&lt;&#x2F;td&gt;&lt;td&gt;Compound V3 close factor trigger&lt;&#x2F;td&gt;&lt;td&gt;✅ Production-tested&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Warning Ratio&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;110%&lt;&#x2F;td&gt;&lt;td&gt;MakerDAO emergency shutdown threshold&lt;&#x2F;td&gt;&lt;td&gt;✅ Production-tested&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Price Deviation&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;5%&lt;&#x2F;td&gt;&lt;td&gt;Chainlink deviation standard&lt;&#x2F;td&gt;&lt;td&gt;✅ Industry standard&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Staleness Threshold&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;1 hour&lt;&#x2F;td&gt;&lt;td&gt;Chainlink ETH&#x2F;USD heartbeat&lt;&#x2F;td&gt;&lt;td&gt;✅ Industry standard&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Circuit Breaker&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;20%&lt;&#x2F;td&gt;&lt;td&gt;NYSE&#x2F;circuit breaker standard&lt;&#x2F;td&gt;&lt;td&gt;✅ Regulatory compliant&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Rate Limiting&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;5 blocks&lt;&#x2F;td&gt;&lt;td&gt;~1 minute (12s avg block time)&lt;&#x2F;td&gt;&lt;td&gt;✅ DoS protection&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Gas Optimization&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;50 token max&lt;&#x2F;td&gt;&lt;td&gt;30M gas block limit consideration&lt;&#x2F;td&gt;&lt;td&gt;✅ Network compliant&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;&lt;strong&gt;Security Documentation:&lt;&#x2F;strong&gt; Security validation reports and fork testing guides are available for detailed parameter validation and mainnet validation instructions.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Test Coverage:&lt;&#x2F;strong&gt; Implementations should include comprehensive test suites covering core functionality, security features, and edge cases. Every security-critical code path should be tested.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Testing Approach:&lt;&#x2F;strong&gt; Test contracts should simulate attack scenarios and consensus mechanisms. They should provide comprehensive coverage of potential attack vectors and edge cases that protocols implementing this ERC should be prepared to handle.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Operation Router</title>
        <published>2025-01-23T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Lucas Picollo</name><uri>https://github.com/pikonha</uri>
	</author>
	
	<author>
		<name>Alex Netto</name><uri>https://github.com/alextnetto</uri>
	</author>
	
	<author>
		<name>Nick Johnson</name><uri>https://github.com/arachnid</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7884/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/operation-router/22633" />
        

        <id>https://wg-eips.ritovision.com/7884/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:7884"
            label="ERC-7884" />
        

        
        

        
        <summary type="html">A protocol that enables smart contracts to redirect write operations to external systems.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7884/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a protocol that enables smart contracts to redirect write operations to external systems. The protocol defines a standardized way for contracts to indicate that an operation should be handled by either a contract deployed to an L2 chain, to the L1, or an off-chain database, providing an entry point for easy developer experience and client implementations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;As the Ethereum ecosystem grows, there is an increasing need for efficient ways to manage data storage across different layers and systems.&lt;&#x2F;p&gt;
&lt;p&gt;This protocol addresses these challenges by:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Providing a gas-efficient way to determine operation handlers through view functions&lt;&#x2F;li&gt;
&lt;li&gt;Enabling seamless integration with L2 solutions and off-chain databases&lt;&#x2F;li&gt;
&lt;li&gt;Maintaining strong security guarantees through typed signatures and standardized interfaces&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;core-components&quot;&gt;Core Components&lt;&#x2F;h3&gt;
&lt;p&gt;The protocol consists of three main components:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;A view function named interface &lt;code&gt;getOperationHandler&lt;&#x2F;code&gt; for determining operation handlers that can be one of the following types:
a. &lt;code&gt;OperationHandledOnchain&lt;&#x2F;code&gt; for on-chain handlers
b. &lt;code&gt;OperationHandledOffchain&lt;&#x2F;code&gt; for off-chain handlers through a gateway&lt;&#x2F;li&gt;
&lt;li&gt;A standardized message format for off-chain storage authorization&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;interface&quot;&gt;Interface&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OperationRouter&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Error to raise when an encoded function that is not supported&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is received on the getOperationHandler function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FunctionNotSupported&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Error to raise when mutations are being deferred onchain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * that being the layer 1 or a layer 2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Chain ID to perform the deferred mutation to.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contractAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Contract Address at which the deferred mutation should transact with.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OperationHandledOnchain&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      uint256&lt;&#x2F;span&gt;&lt;span&gt; chainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      address&lt;&#x2F;span&gt;&lt;span&gt; contractAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Struct used to define the domain of the typed data signature, defined in EIP-712.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; name&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The user friendly name of the contract that the signature corresponds to.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; version&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The version of domain object being used.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ID of the chain that the signature corresponds to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; verifyingContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the contract that the signature pertains to.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DomainData&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      string&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      string&lt;&#x2F;span&gt;&lt;span&gt; version&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      uint64&lt;&#x2F;span&gt;&lt;span&gt; chainId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      address&lt;&#x2F;span&gt;&lt;span&gt; verifyingContract&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Struct used to define the message context for off-chain storage authorization&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The original ABI encoded function call&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the user performing the mutation (msg.sender).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; expirationTimestamp&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The timestamp at which the mutation will expire.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MessageData&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      bytes&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      address&lt;&#x2F;span&gt;&lt;span&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      uint256&lt;&#x2F;span&gt;&lt;span&gt; expirationTimestamp&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Error to raise when mutations are being deferred to an Offchain entity&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the EIP-712 domain definition&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; url&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; URL to request to perform the off-chain mutation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The original ABI encoded function call along with authorization context&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OperationHandledOffchain&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      DomainData sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      string&lt;&#x2F;span&gt;&lt;span&gt; url&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      MessageData data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Determines the appropriate handler for an encoded function call&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; encodedFunction&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ABI encoded function call&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getOperationHandler&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; encodedFunction&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The onchain flow is specified as follows:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7884&#x2F;.&#x2F;assets&#x2F;d1.svg&quot; alt=&quot;&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;It is important to notice that the &lt;code&gt;getOperationHandler&lt;&#x2F;code&gt; relies on the given argument, the encoded function, to specify which contract will the request be redirected to, therefore, it is unable to address &lt;code&gt;multicall&lt;&#x2F;code&gt; transactions that could lead to different destination contracts. That means that &lt;code&gt;multicall&lt;&#x2F;code&gt; that is known will be redirected to different contracts should be handled in a sequential way by first calling the &lt;code&gt;getOperationHandler&lt;&#x2F;code&gt; and then making the actual transaction to the returned contract.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;database-flow&quot;&gt;Database flow&lt;&#x2F;h4&gt;
&lt;p&gt;The HTTP request made to the gateway follows the same standard proposed by the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3668&#x2F;&quot;&gt;EIP-3668&lt;&#x2F;a&gt; where the URL receives &lt;code&gt;&#x2F;{sender}&#x2F;{data}.json&lt;&#x2F;code&gt; enabling an API to behave just like an smart contract would. However, the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712 Typed Signature&lt;&#x2F;a&gt; was introduced to enable authentication.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7884&#x2F;.&#x2F;assets&#x2F;d2.svg&quot; alt=&quot;&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;implementation-example&quot;&gt;Implementation Example&lt;&#x2F;h3&gt;
&lt;p&gt;The contract deployed to the L1 MUST implement the &lt;code&gt;getOperationHandler&lt;&#x2F;code&gt; to act as a router redirecting the requests to the respective handler.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OperationRouterExample&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getOperationHandler&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; encodedFunction&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes4&lt;&#x2F;span&gt;&lt;span&gt; selector &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes4&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;encodedFunction&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;selector &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes4&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;setText(bytes32, string)&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OperationHandledOffchain&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;                DomainData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;                    &amp;quot;IdentityResolver&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;                    &amp;quot;1&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;                    1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                )&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;                &amp;quot;https:&#x2F;&#x2F;api.example.com&#x2F;profile&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;                MessageData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    encodedFunction&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;                    msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;                    block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; hours&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;selector &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes4&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;setAddress(bytes32,address)&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OperationHandledOnchain&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;                10&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x123&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;789&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The client implementation would look as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;tsx&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt; try&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    functionName&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;setText&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    abi&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    args&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; client&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;readContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    functionName&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;getOperationHandler&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    abi&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    args&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodeFunctionData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;calldata&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; catch&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;err&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getRevertErrorData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;err&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  switch&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;?.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;errorName&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    case&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;OperationHandledOffchain&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      const&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;domain&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; url&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; message&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; errorResult&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;args&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; as&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        DomainData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        MessageData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      await&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; handleDBStorage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; domain&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; url&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; message&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; signer&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    case&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;OperationHandledOnchain&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      const&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; contractAddress&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;args&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; as&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bigint&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; l2Client&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; createPublicClient&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        chain&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getChain&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Number&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        transport&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; http&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;extend&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;walletActions&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      const&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; request&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; l2Client&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;simulateContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        ...&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;calldata&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contractAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; l2Client&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;writeContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;request&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    default&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      console&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;error&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;error registering domain: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; err&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The standard aims to enable offchain writing operations, designed to be a complement for the CCIP-Read (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3668&#x2F;&quot;&gt;ERC-3668&lt;&#x2F;a&gt;) which is already widely adopted by the community.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is fully backward compatible as it:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Introduces new interfaces that don&#x27;t conflict with existing ones&lt;&#x2F;li&gt;
&lt;li&gt;Uses view functions to gather offchain information&lt;&#x2F;li&gt;
&lt;li&gt;Can be implemented alongside existing storage patterns&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;handler-validation&quot;&gt;Handler Validation&lt;&#x2F;h3&gt;
&lt;p&gt;Off-chain handlers must:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Verify EIP-712 signatures&lt;&#x2F;li&gt;
&lt;li&gt;Implement proper access controls&lt;&#x2F;li&gt;
&lt;li&gt;Handle concurrent modifications safely&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;general-recommendations&quot;&gt;General Recommendations&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Implement rate limiting for off-chain handlers&lt;&#x2F;li&gt;
&lt;li&gt;Use secure transport (HTTPS) for off-chain communications&lt;&#x2F;li&gt;
&lt;li&gt;Monitor for unusual patterns that might indicate attacks&lt;&#x2F;li&gt;
&lt;li&gt;Implement proper error handling for failed transactions&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Decentralised User Profiles</title>
        <published>2025-01-22T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Kumar Anirudha</name><uri>https://github.com/anistark</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7866/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/add-erc-decentralised-profile-standard/22610" />
        

        <id>https://wg-eips.ritovision.com/7866/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:7866"
            label="ERC-7866" />
        

        
        

        
        <summary type="html">Decentralised Interoperable User Identity with segmented Avatars per DApp Profile</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7866/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes a standard for decentralised, interoperable user profiles known as Decentralised Profiles. Profiles are implemented as &lt;strong&gt;Soul Bound Tokens (SBTs)&lt;&#x2F;strong&gt; that are immutable, non-transferable, and tied to unique identifiers across multiple blockchain networks. The standard provides a unified structure for user metadata, including dApp-specific customisation, default profiles, and seamless cross-chain compatibility. Profiles can be leveraged for identity management, reputation systems, and personalised dApp experiences.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Existing solutions for decentralised identity and user profiles lack cross-chain compatibility, dApp-specific customisation, and standardisation. A unified approach is essential to:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Facilitate interoperable profiles across all chains.&lt;&#x2F;li&gt;
&lt;li&gt;Leverage the immutability and non-transferability of SBTs for secure identities.&lt;&#x2F;li&gt;
&lt;li&gt;Enable dApp-specific customisations, such as unique avatars.&lt;&#x2F;li&gt;
&lt;li&gt;Provide a robust, standards-based alternative to centralised solutions like Gravatar.&lt;&#x2F;li&gt;
&lt;li&gt;Ensure user control and decentralisation with profiles stored on IPFS&#x2F;Arweave.&lt;&#x2F;li&gt;
&lt;li&gt;A common standard for Decentralised Identity that can be used across all chains.&lt;&#x2F;li&gt;
&lt;li&gt;Act as a Digital Passport for users, enabling seamless decentralised verification and authentication.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;unique-profile-identifiers&quot;&gt;Unique Profile Identifiers&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;decentralised-profile&quot;&gt;Decentralised Profile&lt;&#x2F;h4&gt;
&lt;p&gt;Each profile is identified by:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;username&amp;gt;@&amp;lt;network_slug&amp;gt;.soul&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;username&lt;&#x2F;code&gt;: User-defined, chain-unique string.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;network_slug&lt;&#x2F;code&gt;: Short identifier for the chain (e.g., &lt;code&gt;eth&lt;&#x2F;code&gt;, &lt;code&gt;polygon&lt;&#x2F;code&gt;, &lt;code&gt;xion&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;soul&lt;&#x2F;code&gt;: Fixed suffix indicating soul bound token.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Example:
&lt;code&gt;john@eth.soul&lt;&#x2F;code&gt;
&lt;code&gt;alice@polygon.soul&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;decentralised-identifier-did&quot;&gt;Decentralised Identifier (DID)&lt;&#x2F;h4&gt;
&lt;p&gt;Each profile is tied to a DID:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;did:&amp;lt;chain&amp;gt;:&amp;lt;address&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Example:
&lt;code&gt;did:ethereum:0x123...&lt;&#x2F;code&gt;
&lt;code&gt;did:xion:xion1abc...&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;metadata-structure&quot;&gt;Metadata Structure&lt;&#x2F;h3&gt;
&lt;p&gt;The profile metadata structure is designed to balance extensibility, usability, and compatibility with decentralized storage systems like IPFS. Metadata will adhere to the following schema:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;$schema&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;json-schema.org&#x2F;draft&#x2F;2020-12&#x2F;schema&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;UserProfile&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;username&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The unique handle of the user.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;avatar&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uri&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;IPFS URI pointing to the user&amp;#39;s main avatar image.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bio&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Short description or biography of the user.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;website&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uri&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Personal or professional website of the user.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;socials&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;User&amp;#39;s social links.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;twitter&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uri&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;URL to the user&amp;#39;s Twitter profile.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;github&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uri&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;URL to the user&amp;#39;s GitHub profile.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;required&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;twitter&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;github&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;additionalProperties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;default_avatar_visibility&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;public&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;private&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Default visibility setting for the main avatar.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;dapp_avatars&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Mapping of DApp addresses to their custom avatars and visibility settings.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;patternProperties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;^0x[a-fA-F0-9]{40}$&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;avatar&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uri&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;IPFS URI for the DApp-specific avatar.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;visibility&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;public&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;private&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Visibility setting for this avatar.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;required&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;avatar&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;visibility&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;additionalProperties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;additionalProperties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;required&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;username&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;avatar&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bio&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;website&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;socials&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;default_avatar_visibility&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;dapp_avatars&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;additionalProperties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Here&#x27;s an example using the structure above:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;username&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;batman&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;avatar&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ipfs:&#x2F;&#x2F;QmExampleMainAvatarCID&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bio&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Blockchain enthusiast and builder.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;website&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;anirudha.dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;socials&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;twitter&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;twitter.com&#x2F;kranirudha&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;github&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;github.com&#x2F;anistark&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;default_avatar_visibility&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;public&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;dapp_avatars&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;0xDAppAddress1abcdefabcdefabcdefabcdefabcdefabcd&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;avatar&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ipfs:&#x2F;&#x2F;QmExampleAvatar1CID&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;visibility&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;private&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;0xDAppAddress2abcdefabcdefabcdefabcdefabcdefabcd&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;avatar&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ipfs:&#x2F;&#x2F;QmExampleAvatar2CID&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;visibility&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;public&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;access-control&quot;&gt;Access Control&lt;&#x2F;h4&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Default Avatar Visibility&lt;&#x2F;strong&gt;: Users can set their default avatar visibility as public or private.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;dApp-Specific Avatar Visibility&lt;&#x2F;strong&gt;: Each dApp-specific avatar can also have its visibility set to public or private.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;strong&gt;Visibility Logic&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If an avatar is public, it is retrievable by any external caller.&lt;&#x2F;li&gt;
&lt;li&gt;If an avatar is private, only the user can retrieve it. Other callers will get an encoded response alongwith error message.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;dapp-specific-avatar-customisation&quot;&gt;dApp-Specific Avatar Customisation&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Users can assign dApp-specific avatars or metadata.&lt;&#x2F;li&gt;
&lt;li&gt;If no dApp-specific customisation exists, the default avatar applies.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The design of the Decentralised Profile Standard was guided by the need for a unified, interoperable user profile system that can operate seamlessly across all blockchain networks. Current solutions, such as ENS profiles or Gravatar, either lack cross-chain functionality, are centralised, or do not allow users to customise profiles for specific dApps. This standard addresses these shortcomings while ensuring simplicity, security, and scalability.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;design-decisions&quot;&gt;Design Decisions&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Decentralised Identifiers (DIDs)&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Using the &lt;code&gt;did:&amp;lt;chain&amp;gt;:&amp;lt;address&amp;gt;&lt;&#x2F;code&gt; format provides a globally unique identifier for profiles. This aligns with the decentralised identity movement and ensures compatibility with broader DID frameworks.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Decentralised Profile&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The profile format (&lt;code&gt;username@networkslug.soul&lt;&#x2F;code&gt;) makes profiles human-readable and chain-specific while maintaining a universal structure. The &lt;code&gt;.soul&lt;&#x2F;code&gt; suffix clearly identifies profiles compliant with this standard.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;dApp-Specific Avatars&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Allowing users to assign dApp-specific avatars caters to personalisation and enhances the user experience. It supports scenarios where users may want different representations or metadata for different applications.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Soul Bound Tokens (SBTs)&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Leveraging SBTs ensures that profiles are non-transferable, reinforcing the concept of identity ownership. SBTs prevent profiles from being sold or hijacked, making them ideal for reputation-based systems.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Registry and Resolver Architecture&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;This architecture was chosen for its extensibility and proven track record, as seen in ENS. It separates the management of profile identifiers (Registry) from the resolution of metadata (Resolver), making upgrades and integrations straightforward.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Compatibility with Existing Standards&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The profile standard integrates with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; for interface detection and can complement ENS or other naming systems, fostering interoperability rather than competition.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Default and dApp-Specific Metadata&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The inclusion of both default and dApp-specific metadata ensures flexibility. If dApp-specific metadata is not set, the default profile seamlessly applies, reducing friction for developers and users.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;On-Chain Data Minimisation&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Metadata is stored off-chain (e.g., IPFS or Arweave) to minimise gas costs and support scalable operations. Only URIs and pointers are stored on-chain.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Access Control&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Users have complete control over avatar visibility, catering to privacy preferences.&lt;&#x2F;li&gt;
&lt;li&gt;Specific dApp-based customizations ensure fine-grained control.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;dApp Identification&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;ul&gt;
&lt;li&gt;Requiring dApps to be identified by an address ensures traceability and security.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;ol start=&quot;11&quot;&gt;
&lt;li&gt;&lt;strong&gt;Extensibility&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;ul&gt;
&lt;li&gt;Adding metadata fields or new visibility levels does not disrupt the standard.&lt;&#x2F;li&gt;
&lt;li&gt;Profiles can remain lightweight while supporting future scalability.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;ol start=&quot;12&quot;&gt;
&lt;li&gt;&lt;strong&gt;Security&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;ul&gt;
&lt;li&gt;Access control minimizes the risk of sensitive data exposure.&lt;&#x2F;li&gt;
&lt;li&gt;Metadata stored off-chain ensures minimal gas usage and flexibility.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;alternative-designs-considered&quot;&gt;Alternative Designs Considered&lt;&#x2F;h4&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Pure On-Chain Metadata&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Storing all metadata on-chain was considered but discarded due to high gas costs, limited storage capacity, and challenges in supporting complex or large datasets such as high-resolution avatars.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Direct Integration with ENS&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;While integrating with ENS was explored, it was deemed limiting for cross-chain functionality, as ENS is predominantly tied to Ethereum. Decentralised profile takes inspiration from ENS while ensuring a truly multichain approach.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Fully Centralised System&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A centralised system would simplify implementation but contradict the core principles of decentralisation and user sovereignty.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Non-SBT-Based Implementation&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Using standard &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; tokens for profiles was considered but rejected since transferability is unsuitable for identity management. SBTs enforce the immutability of identity ownership.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;comparison-with-related-work&quot;&gt;Comparison with Related Work&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;137&#x2F;&quot;&gt;ERC-137&lt;&#x2F;a&gt; (ENS)&lt;&#x2F;strong&gt;: Provides a robust naming service but lacks dApp-specific metadata and cross-chain functionality.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Centralised identity services&lt;&#x2F;strong&gt;: Cannot leverage blockchain-specific advantages like immutability, decentralisation, and SBT integration.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;DID Standards&lt;&#x2F;strong&gt;: Profile must aligns with DID specifications, ensuring it fits into the broader decentralised identity ecosystem while offering features tailored to blockchain-based applications.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;scalability-and-extensibility&quot;&gt;Scalability and Extensibility&lt;&#x2F;h3&gt;
&lt;p&gt;The Registry and Resolver architecture, combined with off-chain metadata storage, ensures that profile can scale with the growth of the blockchain ecosystem. New chains, metadata types, and customisations can be added without disrupting the core functionality or introducing breaking changes.&lt;&#x2F;p&gt;
&lt;p&gt;The design balances simplicity, extensibility, and user control, making it well-suited for adoption across a wide range of dApps, wallets, and blockchains.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;contract-interface&quot;&gt;Contract Interface&lt;&#x2F;h3&gt;
&lt;p&gt;The standard includes the following interface:&lt;&#x2F;p&gt;
&lt;h4 id=&quot;isoulprofile&quot;&gt;&lt;code&gt;ISoulProfile&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.19&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ISoulProfile&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Metadata&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt; username&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt; avatar&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt; bio&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt; website&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; socials&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt; defaultAvatarVisibility&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; DappAvatar&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; dappAvatars&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DappAvatar&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt; avatarURI&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt; visibility&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &amp;quot;public&amp;quot; or &amp;quot;private&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ProfileCreated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; did&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; username&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AvatarUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; avatarURI&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; visibility&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DappAvatarUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; dApp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; avatarURI&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; visibility&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; createProfile&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; username&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setDefaultAvatar&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; avatarURI&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; visibility&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setDappAvatar&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; dApp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; avatarURI&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; visibility&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getDefaultAvatar&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getDappAvatar&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; dApp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;soulprofile&quot;&gt;&lt;code&gt;SoulProfile&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.19&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;access&#x2F;Ownable.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;utils&#x2F;Strings.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;ISoulProfile.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SoulProfile&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Ownable&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ISoulProfile&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Metadata&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; profiles&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    modifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyProfileOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Not authorized&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        _&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; createProfile&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; username&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;username&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Username cannot be empty&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;profiles&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;username &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Profile already exists&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        profiles&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;username &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; username&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        profiles&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;defaultAvatarVisibility &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;public&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Default to public&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ProfileCreated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; generateDID&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; username&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setDefaultAvatar&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; avatarURI&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; visibility&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;visibility&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Visibility must be set&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        profiles&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;avatar &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; avatarURI&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        profiles&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;defaultAvatarVisibility &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; visibility&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AvatarUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; avatarURI&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; visibility&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setDappAvatar&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; dApp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; avatarURI&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; visibility&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;dApp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Invalid dApp address&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;visibility&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Visibility must be set&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        profiles&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;dappAvatars&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;dApp&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DappAvatar&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;avatarURI&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; visibility&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DappAvatarUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; dApp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; avatarURI&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; visibility&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getDefaultAvatar&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        override&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; avatarURI&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; visibility&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        Metadata &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;storage&lt;&#x2F;span&gt;&lt;span&gt; profile &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; profiles&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;user&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;profile&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;avatar&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; profile&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;defaultAvatarVisibility&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getDappAvatar&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; dApp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        override&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; avatarURI&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; visibility&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        Metadata &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;storage&lt;&#x2F;span&gt;&lt;span&gt; profile &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; profiles&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;user&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        DappAvatar &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;storage&lt;&#x2F;span&gt;&lt;span&gt; dappAvatar &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; profile&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;dappAvatars&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;dApp&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;dappAvatar&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;avatarURI&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; dappAvatar&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;visibility&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; generateDID&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;did:ethereum:&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Strings&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;toHexString&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;user&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Of course, this can be extended to prepare a full registry and resolver according to ENS or similar standards. Refer to Rationale above for more information about the same.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The Decentralised Profile system is designed to ensure smooth integration with existing decentralized applications (dApps) and platforms, while offering an upgrade path for future enhancements. Below are key considerations for backwards compatibility:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;ENS Compatibility&lt;&#x2F;strong&gt;: The system adheres to the naming conventions and standards specified in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;137&#x2F;&quot;&gt;ERC-137&lt;&#x2F;a&gt; (Ethereum Name Service). This ensures that any dApps or tools already using ENS-compatible names can easily integrate profiles without additional changes.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Flexible dApp Identification&lt;&#x2F;strong&gt;: By using wallet addresses to identify dApps, the system avoids the need for centralized registration of dApps. Any existing or new dApp that interacts with Ethereum or compatible chains can use the standard by simply passing its address as a parameter.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Default Avatar Fallback&lt;&#x2F;strong&gt;: If no specific avatar is set for a dApp, the system gracefully falls back to the default avatar. This ensures that even older dApps that do not implement the latest features can continue to work seamlessly.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Upgradeable Contracts&lt;&#x2F;strong&gt;: By implementing a proxy-based architecture for all major contracts (resolver, registry, profile), the system ensures that future upgrades or changes in functionality can be deployed without disrupting existing data or workflows. Upgrades are conducted through secure proxy mechanisms like TransparentUpgradeableProxy.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Chain Agnosticism&lt;&#x2F;strong&gt;: The use of decentralized identifiers (DIDs) and chain-specific network slugs ensures interoperability across chains. This allows profiles to maintain consistency regardless of which chain they originate from, ensuring compatibility with multi-chain ecosystems.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Profile system should prioritise robust security to protect user data and prevent unauthorized access.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Access Control&lt;&#x2F;strong&gt;: Users can set visibility for their avatars (public or private). This is enforced at both the resolver and registry levels to ensure unauthorized entities cannot access private avatars. Functions that modify state (e.g., setDefaultAvatar, setDappAvatar) are protected with access controls, ensuring only the profile owner can make changes.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Data Privacy&lt;&#x2F;strong&gt;: Sensitive metadata is encrypted before storage on decentralized storage systems like IPFS or Arweave. Visibility flags ensure users can control who can view specific profile elements.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Reentrancy Protection&lt;&#x2F;strong&gt;: Functions modifying state implement the checks-effects-interactions pattern or leverage ReentrancyGuard to prevent reentrancy attacks. For example, setDappAvatar ensures that all validations are performed before updating the state.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Input Validation&lt;&#x2F;strong&gt;: All user inputs (e.g., username, visibility, dApp) are validated to ensure they meet specified criteria. Invalid or malicious inputs are rejected to prevent injection attacks or other exploits. Visibility is restricted to predefined values (&quot;public&quot; or &quot;private&quot;).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Immutable DIDs&lt;&#x2F;strong&gt;: Decentralized identifiers (DIDs) for users are immutable once created. This prevents spoofing or unauthorized changes to user identities.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Fallback Mechanisms&lt;&#x2F;strong&gt;: The system provides fallback mechanisms for fetching avatars. If a dApp-specific avatar is not found, the default avatar is returned, ensuring smooth operation without errors.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Upgradeable Contracts&lt;&#x2F;strong&gt;: Proxy contracts are used to allow for upgrades while preserving state. Upgrades are performed securely via a multi-signature governance process to minimize risks.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Rate Limiting&lt;&#x2F;strong&gt;: Rate-limiting mechanisms can be implemented to prevent spam or abuse of profile creation and update functions.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Audits and Best Practices&lt;&#x2F;strong&gt;: The contracts are designed following best practices and are to be audited regularly by independent security firms. Dependencies (e.g., OpenZeppelin contracts) are reviewed and kept up to date to mitigate vulnerabilities.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;dApp Address Verification&lt;&#x2F;strong&gt;: All dApps interacting with the system must be identified by a valid address. This ensures that unauthorized or spoofed entities cannot manipulate profiles or fetch restricted data.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Phishing Mitigation&lt;&#x2F;strong&gt;: User-facing dApps are encouraged to clearly display information about interactions on-chain. Users should be warned about potential phishing attacks and advised to interact only with verified dApps.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Gas Optimization&lt;&#x2F;strong&gt;: Operations are optimized to prevent gas exhaustion during execution, which could lead to incomplete transactions. This ensures that even on congested networks, the system remains functional.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Secure Fallback Functions&lt;&#x2F;strong&gt;: Fallback functions are implemented securely to prevent accidental Ether transfers or denial-of-service attacks.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Add Auth Data to EIP-7623 Floor</title>
        <published>2025-01-21T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Toni Wahrstätter</name><uri>https://github.com/nerolation</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8131/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-9999-add-auth-data-to-eip-7623-floor/12345" />
        

        <id>https://wg-eips.ritovision.com/8131/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:8131"
            label="EIP-8131" />
        

        
        

        
        <summary type="html">Add EIP-7702 authorization data to the EIP-7623 floor calculation</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8131/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP includes &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; authorization data in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7623&#x2F;&quot;&gt;EIP-7623&lt;&#x2F;a&gt; floor calculation, preventing circumvention of floor pricing through authorization lists.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; authorization tuples are priced for execution (&lt;code&gt;PER_EMPTY_ACCOUNT_COST = 25,000&lt;&#x2F;code&gt; gas per authorization) but do not contribute to the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7623&#x2F;&quot;&gt;EIP-7623&lt;&#x2F;a&gt; floor calculation.&lt;&#x2F;p&gt;
&lt;p&gt;This enables achieving ~9% larger blocks than intended by combining calldata with authorization data at an optimal ratio, circumventing the floor pricing mechanism.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Source&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TOTAL_COST_FLOOR_PER_TOKEN&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;10&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7623&#x2F;&quot;&gt;EIP-7623&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FLOOR_COST_PER_AUTH&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;4040&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;101 bytes × 4 tokens × 10 gas&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;PER_EMPTY_ACCOUNT_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;25000&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7623&#x2F;&quot;&gt;EIP-7623&lt;&#x2F;a&gt; floor calculation is modified to include authorization data:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tokens_in_calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; zero_bytes_in_calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; nonzero_bytes_in_calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;floor_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    TX_BASE_COST&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TOTAL_COST_FLOOR_PER_TOKEN&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; tokens_in_calldata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; FLOOR_COST_PER_AUTH&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; num_authorizations&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The gas used calculation becomes:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gasUsed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    21000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    +&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        STANDARD_TOKEN_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; tokens_in_calldata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        +&lt;&#x2F;span&gt;&lt;span&gt; execution_gas_used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        +&lt;&#x2F;span&gt;&lt;span&gt; isContractCreation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32000&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; INITCODE_WORD_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; words&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;calldata&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        +&lt;&#x2F;span&gt;&lt;span&gt; access_list_cost&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; PER_EMPTY_ACCOUNT_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; num_authorizations&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        TOTAL_COST_FLOOR_PER_TOKEN&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; tokens_in_calldata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; FLOOR_COST_PER_AUTH&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; num_authorizations&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Any transaction with a gas limit below &lt;code&gt;floor_gas&lt;&#x2F;code&gt; or below its intrinsic gas cost is considered invalid.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;flat-cost-per-authorization&quot;&gt;Flat Cost Per Authorization&lt;&#x2F;h3&gt;
&lt;p&gt;Each authorization is charged a flat &lt;code&gt;FLOOR_COST_PER_AUTH = 4040&lt;&#x2F;code&gt; gas toward the floor, derived from:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;101 bytes per authorization tuple (as specified in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;4 tokens per byte (treating all bytes as non-zero)&lt;&#x2F;li&gt;
&lt;li&gt;10 gas per token (&lt;code&gt;TOTAL_COST_FLOOR_PER_TOKEN&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This conservative approach avoids byte-level zero&#x2F;non-zero accounting while ensuring authorization data is properly reflected in the floor calculation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;floor-only-modification&quot;&gt;Floor-Only Modification&lt;&#x2F;h3&gt;
&lt;p&gt;Authorization costs are added to the floor calculation only, not to intrinsic gas. This differs from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7981&#x2F;&quot;&gt;EIP-7981&lt;&#x2F;a&gt; (access lists) because:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Authorization execution cost (25,000 gas) far exceeds floor contribution (4,040 gas per auth)&lt;&#x2F;li&gt;
&lt;li&gt;Floor-only modification is sufficient to prevent bypass&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;With this change:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Authorization data contributes to the floor path&lt;&#x2F;li&gt;
&lt;li&gt;High-execution transactions remain unaffected (execution exceeds floor)&lt;&#x2F;li&gt;
&lt;li&gt;Data-heavy transactions cannot use authorizations to bypass floor pricing&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This is a backwards incompatible gas repricing that requires a scheduled network upgrade.&lt;&#x2F;p&gt;
&lt;p&gt;Requires updates to gas estimation in wallets and nodes. Normal usage patterns remain largely unaffected since authorization execution cost typically dominates the floor contribution.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;case-1-transaction-with-authorizations-only&quot;&gt;Case 1: Transaction with Authorizations Only&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Calldata: 0 bytes&lt;&#x2F;li&gt;
&lt;li&gt;Authorizations: 10&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Old floor: 21,000 gas
New floor: 21,000 + 10 × 4,040 = 61,400 gas
Execution: 10 × 25,000 = 250,000 gas
Result: Pay execution (250,000) - unchanged, execution dominates&lt;&#x2F;p&gt;
&lt;h3 id=&quot;case-2-bypass-attempt-now-blocked&quot;&gt;Case 2: Bypass Attempt (Now Blocked)&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Calldata: 100,000 bytes (400,000 tokens)&lt;&#x2F;li&gt;
&lt;li&gt;Authorizations: 100&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Old floor: 21,000 + 400,000 × 10 = 4,021,000 gas
New floor: 21,000 + 400,000 × 10 + 100 × 4,040 = 4,425,000 gas
Execution: 21,000 + 1,600,000 + 2,500,000 = 4,121,000 gas
Result: Pay new floor (4,425,000) - bypass blocked&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;FLOOR_COST_PER_AUTH&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 4040&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 101 bytes * 4 tokens&#x2F;byte * 10 gas&#x2F;token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calculate_intrinsic_cost&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Transaction&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Tuple&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Uint&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Calculate intrinsic gas cost and floor gas cost.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Returns (intrinsic_gas, floor_gas).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Calldata tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    calldata_zero&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; sum&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    tokens_in_calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;calldata_zero&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; calldata_zero&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Authorization costs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    num_authorizations&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    auth_exec_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; isinstance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; SetCodeTransaction&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        num_authorizations&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;authorizations&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        auth_exec_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; PER_EMPTY_ACCOUNT_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; num_authorizations&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Floor: calldata + flat cost per authorization&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    floor_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        TX_BASE_COST&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        +&lt;&#x2F;span&gt;&lt;span&gt; tokens_in_calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TOTAL_COST_FLOOR_PER_TOKEN&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        +&lt;&#x2F;span&gt;&lt;span&gt; num_authorizations&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; FLOOR_COST_PER_AUTH&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Intrinsic: calldata + authorization execution cost&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    calldata_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; tokens_in_calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; STANDARD_TOKEN_COST&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    intrinsic_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TX_BASE_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; calldata_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; access_list_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; auth_exec_cost&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; intrinsic_gas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; floor_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP closes a loophole that allows circumventing &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7623&#x2F;&quot;&gt;EIP-7623&lt;&#x2F;a&gt; floor pricing. Without this fix, adversaries can achieve ~9% larger blocks by combining calldata with authorization data.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;interaction-with-eip-7981&quot;&gt;Interaction with EIP-7981&lt;&#x2F;h3&gt;
&lt;p&gt;If &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7981&#x2F;&quot;&gt;EIP-7981&lt;&#x2F;a&gt; is also adopted, both EIPs work together: access list tokens and authorization tokens are both included in the floor calculation. There are no conflicts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Ethereum state using a unified binary tree</title>
        <published>2025-01-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	<author>
		<name>Guillaume Ballet</name><uri>https://github.com/gballet</uri>
	</author>
	
	<author>
		<name>Dankrad Feist</name><uri>https://github.com/dankrad</uri>
	</author>
	
	<author>
		<name>Ignacio Hagopian</name><uri>https://github.com/jsign</uri>
	</author>
	
	<author>
		<name>Kevaundray Wedderburn</name><uri>https://github.com/kevaundray</uri>
	</author>
	
	<author>
		<name>Tanishq Jasoria</name><uri>https://github.com/tanishqjasoria</uri>
	</author>
	
	<author>
		<name>Gajinder Singh</name><uri>https://github.com/g11tech</uri>
	</author>
	
	<author>
		<name>Danno Ferrin</name><uri>https://github.com/shemnon</uri>
	</author>
	
	<author>
		<name>Piper Merriam</name><uri>https://github.com/pipermerriam</uri>
	</author>
	
	<author>
		<name>Gottfried Herold</name><uri>https://github.com/GottfriedHerold</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7864/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7864-ethereum-state-using-a-unified-binary-tree/22611" />
        

        <id>https://wg-eips.ritovision.com/7864/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7864"
            label="EIP-7864" />
        

        
        

        
        <summary type="html">Switch Ethereum state tree to a unified binary tree</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7864/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce a new binary state tree, intended to replace the hexary patricia trees. Account and storage tries are merged into a single tree with 32-byte keys, which also contains contracts code. Account data is broken into independent leaves which  are grouped by 256 in order to provide some locality.&lt;&#x2F;p&gt;
&lt;p&gt;Note: The hash function used in the current draft is not final. The current implementation uses BLAKE3 to reduce friction for EL clients experimenting with this EIP, but the final decision remains TBD. Other potential candidates include Keccak and Poseidon2.&lt;&#x2F;p&gt;
&lt;p&gt;For Poseidon2, there&#x27;s an ongoing Ethereum Foundation cryptography initiative assessing its security properties. If Poseidon2 is selected, additional specifications will be needed for field selection (BN254 scalar field, 31-bit field elements, etc.) and encoding 32-byte values into field elements.&lt;&#x2F;p&gt;
&lt;p&gt;The hash function can be switched with minimal impact on implementations as this EIP progresses toward acceptance. &lt;strong&gt;Do not&lt;&#x2F;strong&gt; assume BLAKE3 is a final decision.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Ethereum&#x27;s long-term goal is to allow blocks to be proved with validity proof so that chain verification is as simple and fast as possible. One of the most challenging parts of achieving that goal is proving the state of the tree, which is required for EVM execution.&lt;&#x2F;p&gt;
&lt;p&gt;The current Merkle-Patricia Trie (MPT) design isn&#x27;t friendly to validity proofs for many reasons, such as using RLP for node encoding, Keccak as a hashing function, being a &quot;tree of trees&quot;, and not including accounts code as part of the state.&lt;&#x2F;p&gt;
&lt;p&gt;Apart from requiring a state tree design that is friendly for block validity proofs, it&#x27;s also important to have fast and small regular Merkle proofs when the amount of state to prove is small. This is useful not only for the application layer but also for supporting future protocol needs in a stateless world (e.g: inclusion lists).&lt;&#x2F;p&gt;
&lt;p&gt;Regarding these regular Merkle proofs in an MPT, since it&#x27;s a hexary tree, their size is quite big on average and in worst-case scenarios. Given a 2^32 size tree, the expected size for proving a single branch is &lt;code&gt;15 * 32 * log_16(2^32) = 3840&lt;&#x2F;code&gt;. From a worst-case block perspective, if 30M gas is used to access only a single byte of different account codes since this code isn&#x27;t chunkified, we&#x27;d need &lt;code&gt;30M&#x2F;2400*(5*480+24k)=330MB&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;A binary tree has a good balance between out-of-circuit and in-circuit proving. Since the tree arity is two, this reduces the size of regular Merkle proofs (i.e., &lt;code&gt;# siblings * log_arity(N)&lt;&#x2F;code&gt; for arity 2 is better than for arity 16). Moreover, we propose switching from Keccak to a more proving-friendly hash function, which would be more amenable to modern proving systems.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;notable-changes-from-the-hexary-structure&quot;&gt;Notable changes from the hexary structure&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;The account and storage tries are merged into a single trie.&lt;&#x2F;li&gt;
&lt;li&gt;RLP is no longer used.&lt;&#x2F;li&gt;
&lt;li&gt;The account&#x27;s code is chunked and included in the tree.&lt;&#x2F;li&gt;
&lt;li&gt;Account data (e.g., balance, nonce, first storage slots, first code-chunks) is co-located in the tree to reduce branch openings.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;tree-structure&quot;&gt;Tree structure&lt;&#x2F;h3&gt;
&lt;p&gt;The proposed Binary Tree stores key-value entries where both the key and value are 32 bytes. The first 31-bytes of the key define the entry stem, and the last byte is the subindex in that stem. If two keys have the same stem, they live in the same &quot;big branch&quot; — this co-locates groups of 256 keys (i.e: keys with the same first 31-bytes).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7864&#x2F;.&#x2F;assets&#x2F;diagram2.png&quot; alt=&quot;Image&quot; &#x2F;&gt;
(More details about the purple&#x2F;orange part in the &quot;Tree embedding&quot; section)&lt;&#x2F;p&gt;
&lt;p&gt;We can distinguish four node types:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;InternalNode&lt;&#x2F;code&gt; has a &lt;code&gt;left_hash&lt;&#x2F;code&gt; and &lt;code&gt;right_hash&lt;&#x2F;code&gt; field (black).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;StemNode&lt;&#x2F;code&gt; has fields &lt;code&gt;stem&lt;&#x2F;code&gt;, &lt;code&gt;left_hash&lt;&#x2F;code&gt; and &lt;code&gt;right_hash&lt;&#x2F;code&gt; (blue).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;LeafNode&lt;&#x2F;code&gt; has a field &lt;code&gt;value&lt;&#x2F;code&gt; which is a 32-byte blob or &lt;code&gt;empty&lt;&#x2F;code&gt;. (orange).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;EmptyNode&lt;&#x2F;code&gt; represents an empty node&#x2F;sub-tree.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The path to a &lt;code&gt;StemNode&lt;&#x2F;code&gt; is defined by the key&#x27;s first 248-bits (31-bytes) from MSB to LSB. From this node, a subtree of 256 values exists indexed by the key&#x27;s last byte (8 bits). A newly created &lt;code&gt;StemNode&lt;&#x2F;code&gt; subtree (i.e: 256 values) has all leaves with &lt;code&gt;value: empty&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The path length isn&#x27;t 248-bits, but contains the minimal amount of &lt;code&gt;InternalNodes&lt;&#x2F;code&gt; required if other stems exist with the same prefix. As in, when walking the 248-bit path inserting a new &lt;code&gt;StemNode&lt;&#x2F;code&gt;, you can end on a &lt;code&gt;EmptyNode&lt;&#x2F;code&gt; or &lt;code&gt;StemNode&lt;&#x2F;code&gt;. In the former, you replace it with the new &lt;code&gt;StemNode&lt;&#x2F;code&gt;. In the latter, you create as many &lt;code&gt;InternalNodes&lt;&#x2F;code&gt; as common bits both stems have as prefixes. Another way to look at this is that there aren&#x27;t &lt;em&gt;extension nodes&lt;&#x2F;em&gt; in paths, but we use the minimal amount of &lt;code&gt;InternalNodes&lt;&#x2F;code&gt; to place &lt;code&gt;StemNode&lt;&#x2F;code&gt;s with common prefixes.&lt;&#x2F;p&gt;
&lt;p&gt;Below is an implementation that describes the tree structure:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; StemNode&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; __init__&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; stem&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;stem&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 31&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;stem must be 31 bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;stem&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; stem&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;values&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; list&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Optional&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;None&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; set_value&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; index&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;values&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InternalNode&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; __init__&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;left&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;right&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BinaryTree&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; __init__&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; insert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;key must be 32 bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;value must be 32 bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        stem&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;31&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        subindex&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;31&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; StemNode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;stem&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;root&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;set_value&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;subindex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_insert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; stem&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; subindex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _insert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; stem&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; subindex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; depth&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span&gt; depth&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 248&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;depth must be less than 248&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; node&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            node&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; StemNode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;stem&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            node&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;set_value&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;subindex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; node&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        stem_bits&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_bytes_to_bits&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;stem&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; isinstance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; StemNode&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If the stem already exists, update the value.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; node&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;stem&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; stem&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                node&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;set_value&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;subindex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                return&lt;&#x2F;span&gt;&lt;span&gt; node&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            existing_stem_bits&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_bytes_to_bits&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;stem&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_split_leaf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; stem_bits&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; existing_stem_bits&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; subindex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; depth&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; We&amp;#39;re in an internal node, go left or right based on the bit.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; stem_bits&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;depth&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; bit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            node&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;left&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_insert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;left&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; stem&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; subindex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; depth&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            node&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;right&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_insert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;right&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; stem&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; subindex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; depth&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; node&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _split_leaf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; leaf&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; stem_bits&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; existing_stem_bits&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; subindex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; depth&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If the stem bits are the same up to this depth, we need to create another&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; internal node and recurse.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; stem_bits&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;depth&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; existing_stem_bits&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;depth&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            new_internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; InternalNode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            bit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; stem_bits&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;depth&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; bit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                new_internal&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;left&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_split_leaf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    leaf&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; stem_bits&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; existing_stem_bits&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; subindex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; depth&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                new_internal&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;right&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_split_leaf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    leaf&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; stem_bits&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; existing_stem_bits&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; subindex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; depth&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; new_internal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            new_internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; InternalNode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            bit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; stem_bits&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;depth&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            stem&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_bits_to_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;stem_bits&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; bit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                new_internal&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;left&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; StemNode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;stem&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                new_internal&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;left&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;set_value&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;subindex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                new_internal&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;right&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; leaf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                new_internal&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;right&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; StemNode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;stem&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                new_internal&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;right&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;set_value&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;subindex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                new_internal&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;left&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; leaf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; new_internal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;node-merkelization&quot;&gt;Node merkelization&lt;&#x2F;h3&gt;
&lt;p&gt;Define &lt;code&gt;hash(value)&lt;&#x2F;code&gt; as:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;hash([0x00] * 64) = [0x00] * 32&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;hash(value) = H(value)&lt;&#x2F;code&gt;, where H is the selected cryptographic hash function.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;code&gt;value&lt;&#x2F;code&gt; parameter lengths can only be 32 and 64.&lt;&#x2F;p&gt;
&lt;p&gt;Merkelize each node type as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;internal_node_hash = hash(left_hash || right_hash)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;stem_node_hash = hash(stem || 0x00 || hash(left_hash || right_hash))&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;leaf_node_hash = hash(value)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;empty_node_hash = [0x00] * 32&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Below is an implementation of these rules using BLAKE3 as a reference implementation:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;None&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\x00&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 64&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\x00&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 64&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; or&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;data must be 32 or 64 bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; blake3&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;digest&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This will be replaced with the final hash function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; merkelize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _merkelize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;node&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; node&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\x00&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; isinstance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; InternalNode&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            left_hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; _merkelize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;left&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            right_hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; _merkelize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;right&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;left_hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; right_hash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        level&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;x&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; node&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;values&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        while&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;level&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            new_level&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;level&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                new_level&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;level&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; level&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            level&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; new_level&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;stem&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; level&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; _merkelize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;root&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;tree-embedding&quot;&gt;Tree embedding&lt;&#x2F;h3&gt;
&lt;p&gt;Instead of a two-layer structure like the MPT, we will embed all information into a unique &lt;code&gt;key: value&lt;&#x2F;code&gt; space in the proposed single tree. This section specifies which tree keys store the state&#x27;s information (account header data, code, storage). The data is colocated in such way that data that is usually accessed together lives in the same &lt;code&gt;StemNode&lt;&#x2F;code&gt; which reduces branch openings.&lt;&#x2F;p&gt;
&lt;p&gt;The following is a big picture of what we&#x27;ll continue to describe in the rest of this section:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7864&#x2F;.&#x2F;assets&#x2F;diagram1.png&quot; alt=&quot;Image&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The account stem (green &lt;code&gt;account&lt;&#x2F;code&gt; node) contains accounts basic data, first 64-storage slots, and first 128-code chunks. This co-location of data allows having data in a single stem branch that is usually accessed together. The rest of storage slots and code-chunks are spread into groups of 256 values in the rest of the tree -- this is also done for convenience since slots&#x2F;code-chunks that are close together will share the same stem branch.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;BASIC_DATA_LEAF_KEY&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;CODE_HASH_LEAF_KEY&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;HEADER_STORAGE_OFFSET&lt;&#x2F;td&gt;&lt;td&gt;64&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;CODE_OFFSET&lt;&#x2F;td&gt;&lt;td&gt;128&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;STEM_SUBTREE_WIDTH&lt;&#x2F;td&gt;&lt;td&gt;256&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;MAIN_STORAGE_OFFSET&lt;&#x2F;td&gt;&lt;td&gt;256**31&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;&lt;em&gt;It&#x27;s a required invariant that &lt;code&gt;STEM_SUBTREE_WIDTH &amp;gt; CODE_OFFSET &amp;gt; HEADER_STORAGE_OFFSET&lt;&#x2F;code&gt; and that &lt;code&gt;HEADER_STORAGE_OFFSET&lt;&#x2F;code&gt; is greater than the leaf keys. Additionally, &lt;code&gt;MAIN_STORAGE_OFFSET&lt;&#x2F;code&gt; MUST be a power of &lt;code&gt;STEM_SUBTREE_WIDTH&lt;&#x2F;code&gt;.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Note that addresses are always passed around as an &lt;code&gt;Address32&lt;&#x2F;code&gt;. To convert existing addresses to &lt;code&gt;Address32&lt;&#x2F;code&gt;, prepend with 12 zero bytes:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; old_style_address_to_address32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Address32&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\\&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;x00&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 12&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;header-values&quot;&gt;Header values&lt;&#x2F;h3&gt;
&lt;p&gt;These are the positions in the tree at which header fields of an account are stored.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tree_hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;inp&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;blake3&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;blake3&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;inp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;digest&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_tree_key&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Address32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; tree_index&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; sub_index&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Assumes STEM_SUBTREE_WIDTH = 256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; tree_hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; tree_index&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;to_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;little&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;31&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;sub_index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_tree_key_for_basic_data&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Address32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; get_tree_key&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BASIC_DATA_LEAF_KEY&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_tree_key_for_code_hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Address32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; get_tree_key&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CODE_HASH_LEAF_KEY&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;An account&#x27;s &lt;code&gt;version&lt;&#x2F;code&gt;, &lt;code&gt;balance&lt;&#x2F;code&gt;, &lt;code&gt;nonce&lt;&#x2F;code&gt;, and &lt;code&gt;code_size&lt;&#x2F;code&gt; fields are packed with big-endian encoding in the value found at &lt;code&gt;BASIC_DATA_LEAF_KEY&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Offset&lt;&#x2F;th&gt;&lt;th&gt;Size&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;version&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;code_size&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;nonce&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;8&lt;&#x2F;td&gt;&lt;td&gt;8&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;balance&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;16&lt;&#x2F;td&gt;&lt;td&gt;16&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Bytes &lt;code&gt;1..4&lt;&#x2F;code&gt; are reserved for future use.&lt;&#x2F;p&gt;
&lt;p&gt;The current layout and encoding allow for an extension of &lt;code&gt;code_size&lt;&#x2F;code&gt; to 4 bytes without changing the account version. The goal of packing these fields together in a basic-data leaf is to reduce gas costs, since we only need one branch opening compared with the usual 3 or 4 if the fields aren&#x27;t packed. This also simplifies witness generation.&lt;&#x2F;p&gt;
&lt;p&gt;When any account header field is set, the &lt;code&gt;version&lt;&#x2F;code&gt; field is also set to zero. The &lt;code&gt;codehash&lt;&#x2F;code&gt; and &lt;code&gt;code_size&lt;&#x2F;code&gt; fields are set upon contract or EOA creation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;code&quot;&gt;Code&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_tree_key_for_code_chunk&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Address32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; chunk_id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; get_tree_key&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;CODE_OFFSET&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; chunk_id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; STEM_SUBTREE_WIDTH&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;CODE_OFFSET&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; chunk_id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;  %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; STEM_SUBTREE_WIDTH&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Chunk &lt;code&gt;i&lt;&#x2F;code&gt; stores a 32 byte value, where bytes 1…31 are bytes &lt;code&gt;i*31...(i+1)*31 - 1&lt;&#x2F;code&gt; of the code (i.e. the i&#x27;th 31-byte slice of it), and byte 0 is the number of leading bytes that are part of PUSHDATA (e.g. if part of the code is &lt;code&gt;...PUSH4 99 98 | 97 96 PUSH1 128 MSTORE...&lt;&#x2F;code&gt; where &lt;code&gt;|&lt;&#x2F;code&gt; is the position where a new chunk begins, then the encoding of the latter chunk would begin &lt;code&gt;2 97 96 PUSH1 128 MSTORE&lt;&#x2F;code&gt; to reflect that the first 2 bytes are PUSHDATA).&lt;&#x2F;p&gt;
&lt;p&gt;For precision, here is an implementation of code chunkification:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;PUSH_OFFSET&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 95&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;PUSH1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; PUSH_OFFSET&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;PUSH32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; PUSH_OFFSET&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; chunkify_code&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;code&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Sequence&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Pad to multiple of 31 bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 31&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        code&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\\&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;x00&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;31&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 31&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Figure out how much pushdata there is after including each byte&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytes_to_exec_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    pos&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    while&lt;&#x2F;span&gt;&lt;span&gt; pos&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; PUSH1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span&gt; code&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;pos&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; PUSH32&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            pushdata_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; code&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;pos&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; PUSH_OFFSET&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            pushdata_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        pos&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;pushdata_bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            bytes_to_exec_data&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;pos&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; pushdata_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        pos&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; pushdata_bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Output chunks&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;bytes_to_exec_data&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;pos&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 31&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; code&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;pos&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; pos&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;31&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; pos&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 31&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;storage&quot;&gt;Storage&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_tree_key_for_storage_slot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Address32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; storage_key&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; storage_key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;CODE_OFFSET&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; HEADER_STORAGE_OFFSET&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        pos&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; HEADER_STORAGE_OFFSET&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; storage_key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        pos&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAIN_STORAGE_OFFSET&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; storage_key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; get_tree_key&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        pos&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; STEM_SUBTREE_WIDTH&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        pos&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; STEM_SUBTREE_WIDTH&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note that storage slots within the same range of size &lt;code&gt;STEM_SUBTREE_WIDTH&lt;&#x2F;code&gt; (i.e. a range with the form &lt;code&gt;x*STEM_SUBTREE_WIDTH ... (x+1)*STEM_SUBTREE_WIDTH-1)&lt;&#x2F;code&gt; are all, except for the &lt;code&gt;HEADER_STORAGE_OFFSET&lt;&#x2F;code&gt; special case, part of a single stem.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;fork&quot;&gt;Fork&lt;&#x2F;h3&gt;
&lt;p&gt;Described in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7612&#x2F;&quot;&gt;EIP-7612&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;access-events&quot;&gt;Access events&lt;&#x2F;h3&gt;
&lt;p&gt;Described in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4762&#x2F;&quot;&gt;EIP-4762&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP defines a new Binary Tree that starts empty. Only new state changes are stored in the tree. The MPT continues to exist but is frozen. This sets the stage for a future hard fork that migrates the MPT data to this Binary Tree (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7748&#x2F;&quot;&gt;EIP-7748&lt;&#x2F;a&gt;).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;single-tree-design&quot;&gt;Single tree design&lt;&#x2F;h3&gt;
&lt;p&gt;The proposal uses a single-layer tree structure with 32-byte keys and values for several reasons:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Simplicity&lt;&#x2F;strong&gt;: working with the abstraction of a key&#x2F;value store makes it easier to write code dealing with the tree (e.g. database reading&#x2F;writing, caching, syncing, proof creation, and verification) and upgrade it to other trees in the future. Additionally, witness gas rules can become simpler and clearer.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Uniformity&lt;&#x2F;strong&gt;: the state is uniformly spread throughout the tree; even if a single contract has millions of storage slots, the contract&#x27;s storage slots are not concentrated in one place. This is useful for state-syncing algorithms. Additionally, it helps reduce the effectiveness of unbalanced tree-filling attacks.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Extensibility&lt;&#x2F;strong&gt;: account headers and code being in the same structure as storage makes it easier to extend both features and even add new structures if desired.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;snark-friendliness-and-post-quantum-security&quot;&gt;SNARK friendliness and Post-Quantum security&lt;&#x2F;h3&gt;
&lt;p&gt;The proposed design should consider the usual complexity, performance, and efficiency for out-of-circuit implementations (i.e. EL clients) and in-circuit ones for generating proofs in ZK circuits.&lt;&#x2F;p&gt;
&lt;p&gt;The tree design structure tries to be simple, by not having complex branching rules. For example, in contrast with the MPT, we avoid extension nodes injected in the middle of branches. Also, RLP encoding was removed since it adds unnecessary complexity. Although complexity can be managed more easily in out-of-circuit implementations, it&#x27;s valuable to help circuit implementations be as simple as possible to avoid proving overhead.&lt;&#x2F;p&gt;
&lt;p&gt;The most important factor in the design is the cryptographic hash function used for merkleization. This hash function should have efficient implementations both out and in circuits. The hash function selection remains TBD, with several candidates under consideration:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;BLAKE3&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Good out-of-circuit performance (i.e., for raw EL client execution)&lt;&#x2F;li&gt;
&lt;li&gt;Reasonable in-circuit performance for proving&lt;&#x2F;li&gt;
&lt;li&gt;Well-established security properties&lt;&#x2F;li&gt;
&lt;li&gt;Currently used in the reference implementation to facilitate experimentation&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Keccak&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Already used in Ethereum, reducing implementation complexity&lt;&#x2F;li&gt;
&lt;li&gt;Well-studied security properties&lt;&#x2F;li&gt;
&lt;li&gt;Less efficient for circuit proving than alternatives&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Poseidon2&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Excellent in-circuit performance for ZK proofs&lt;&#x2F;li&gt;
&lt;li&gt;Potentially better proving throughput&lt;&#x2F;li&gt;
&lt;li&gt;Security analysis still ongoing through EF cryptography initiative&lt;&#x2F;li&gt;
&lt;li&gt;Would require additional specification for field selection and encoding&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The final hash function selection will balance these considerations, with particular attention to security, proving efficiency, and implementation complexity.&lt;&#x2F;p&gt;
&lt;p&gt;Due to recent progress in the quantum computing field, expert estimations consider that they can become real in the 2030s. NIST suggests stopping the use of ECC by 2030 too. Other alternatives, such as Verkle Trees, introduce a new cryptography stack to the protocol, which relies on elliptic curves that aren&#x27;t post-quantum secure. This makes the current tree proposal attractive since it only depends on hash functions, which are still safe in this new paradigm.&lt;&#x2F;p&gt;
&lt;p&gt;Moreover, there has been impressive progress in proving systems, which indicates that we could be close to achieving the required performance for creating pre-state &amp;amp; post-state proofs fast enough. This last point is crucial since the main advantage of Verkle Trees was having proofs that are small and fast to generate.&lt;&#x2F;p&gt;
&lt;p&gt;Finally, the current state tree proposal will probably be the final state tree used in the protocol, compared with Verkle Trees, which would eventually need to be replaced by a post-quantum secure alternative.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;arity-2&quot;&gt;Arity-2&lt;&#x2F;h3&gt;
&lt;p&gt;Binary tries have been chosen primarily because they reduce the witness size. In general, in an &lt;code&gt;N&lt;&#x2F;code&gt;-element tree with each element having &lt;code&gt;k&lt;&#x2F;code&gt; children, the average size of a branch is roughly &lt;code&gt;32 * (k-1) * log(N) &#x2F; log(k)&lt;&#x2F;code&gt; plus a few percent for overhead. 32 is the length of a hash; the &lt;code&gt;k-1&lt;&#x2F;code&gt; refers to the fact that a Merkle proof needs to provide all &lt;code&gt;k-1&lt;&#x2F;code&gt; sister nodes at each level, and &lt;code&gt;log(N) &#x2F; log(k)&lt;&#x2F;code&gt; is an approximation of the number of levels in the tree (e.g. a tree where each node has 5 children, with 625 nodes total, would have depth 4, as &lt;code&gt;625 = 5**4&lt;&#x2F;code&gt; and so &lt;code&gt;log(625) &#x2F; log(5) = 4&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;For any &lt;code&gt;N&lt;&#x2F;code&gt;, the expression is minimized at &lt;code&gt;k = 2&lt;&#x2F;code&gt;. Here&#x27;s a table of branch lengths for different &lt;code&gt;k&lt;&#x2F;code&gt; values assuming &lt;code&gt;N = 2**24&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;code&gt;k&lt;&#x2F;code&gt; (children per node)&lt;&#x2F;th&gt;&lt;th&gt;Branch length (chunks)&lt;&#x2F;th&gt;&lt;th&gt;Branch length (bytes)&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;1 * 24 = 24&lt;&#x2F;td&gt;&lt;td&gt;768&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;4&lt;&#x2F;td&gt;&lt;td&gt;3 * 12 = 36&lt;&#x2F;td&gt;&lt;td&gt;1152&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;8&lt;&#x2F;td&gt;&lt;td&gt;7 * 8 = 56&lt;&#x2F;td&gt;&lt;td&gt;1792&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;16&lt;&#x2F;td&gt;&lt;td&gt;15 * 6 = 90&lt;&#x2F;td&gt;&lt;td&gt;2880&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Actual branch lengths might be slightly larger than this due to uneven distribution, but the pattern of &lt;code&gt;k=2&lt;&#x2F;code&gt; remains by far the best.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;tree-depth&quot;&gt;Tree depth&lt;&#x2F;h3&gt;
&lt;p&gt;The tree design attempts to be as simple as possible considering both out-of-circuit and circuit implementations, while satisfying our throughput constraints on proving hashes.&lt;&#x2F;p&gt;
&lt;p&gt;The proposed design avoids a full 248-bit depth as it would happen in a Sparse Merkle Tree (SMT). This approach helps reduce the hashing load in proving systems, which is currently a throughput bottleneck on commodity hardware. The choice of hash function will impact this consideration - arithmetic-friendly hash functions like Poseidon2 would have different performance characteristics than cryptographic hash functions like BLAKE3 or Keccak. There are some optimization techniques that could be applied, but they add complexity to the specification.&lt;&#x2F;p&gt;
&lt;p&gt;Moreover, we could push this further trying to introduce extension nodes in the middle of paths as done in a MPT, but this also adds complexity that might not be worth it considering the tree should be quite balanced.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;state-expiry&quot;&gt;State-expiry&lt;&#x2F;h3&gt;
&lt;p&gt;State-expiry strategies such as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7736&#x2F;&quot;&gt;EIP-7736&lt;&#x2F;a&gt; could still be applied, requiring a change in the design. One potential solution is adding a field to the &lt;code&gt;StemNode&lt;&#x2F;code&gt; with &lt;code&gt;epoch&lt;&#x2F;code&gt; as described in the mentioned EIP. Another alternative is to use 247-bits for the stem, and have two subtrees &lt;code&gt;StemValuesNode&lt;&#x2F;code&gt;, which would correspond to the current 256-values, and &lt;code&gt;StemMetaNode&lt;&#x2F;code&gt; which is also a 256-subtree that can be used to store arbitrary stem metadata.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The main breaking changes are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;(1) Gas costs for code chunk access can have an impact on applications&#x27; economic viability&lt;&#x2F;li&gt;
&lt;li&gt;(2) Tree structure change makes in-EVM proofs of historical state no longer work&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;(1) can be mitigated by increasing the gas limit while implementing this EIP, allowing the same economic viability for applications.&lt;&#x2F;p&gt;
&lt;!-- TODO:

## Test Cases

- Add comprehensive test vectors for tree operations
- Finalize hash function selection and provide test vectors for the selected function
- Add test cases for edge cases in tree operations

--&gt;
&lt;!-- TODO: Remove external link

## Reference Implementation

Python reference implementation (`github.com&#x2F;jsign&#x2F;binary-tree-spec`).

--&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion. &lt;!-- TODO --&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Flow Control Wallet Call Capability</title>
        <published>2025-01-17T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Sam Wilson</name><uri>https://github.com/SamWilsn</uri><email>sam@binarycake.ca</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7867/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/wallet-sendcalls-capability-flow-control/22624" />
        

        <id>https://wg-eips.ritovision.com/7867/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="interface"
                label="Interface" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:7867"
            label="EIP-7867" />
        

        
        

        
        <summary type="html">An EIP-5792 capability providing atomicity and flow control configuration.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7867/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal extends &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5792&#x2F;&quot;&gt;EIP-5792&lt;&#x2F;a&gt; to allow dapps to downgrade their required atomicity guarantees and control the behaviour after a failed&#x2F;reverted call. It introduces the batch-scope concept of &lt;code&gt;strict&lt;&#x2F;code&gt; vs. &lt;code&gt;loose&lt;&#x2F;code&gt; atomicity, where a &lt;code&gt;strict&lt;&#x2F;code&gt; batch remains atomic in the face of chain reorgs and a &lt;code&gt;loose&lt;&#x2F;code&gt; batch does not; and the per-call ability to continue after a failed&#x2F;reverted call (&lt;code&gt;continue&lt;&#x2F;code&gt;) or stop processing (&lt;code&gt;halt&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;While the base EIP-5792 specification works extremely well for smart contract wallets, it does not allow the expression of the full range of flow control options that wallets can implement. For example, a dapp may only be submitting a batch for gas savings and not care about whether all calls are reverted on failure. A wallet may only be able to offer a limited form of atomicity through block builder backchannels, but that may be sufficient for a trading platform.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;rpc-interface&quot;&gt;RPC Interface&lt;&#x2F;h3&gt;
&lt;p&gt;The following subsections are modifications to the API endpoints from EIP-5792.&lt;&#x2F;p&gt;
&lt;p&gt;If a request does not match the schema defined below, the wallet MUST reject the request with an error code of &lt;code&gt;INVALID_SCHEMA&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;wallet-sendcalls&quot;&gt;&lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The following JSON Schema SHALL be inserted, in the request object, as values of either the batch-scope or call-scope &lt;code&gt;capabilities&lt;&#x2F;code&gt; objects (as appropriate) with a key of &lt;code&gt;flowControl&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;batch-scope&quot;&gt;Batch-scope&lt;&#x2F;h5&gt;
&lt;h6 id=&quot;schema&quot;&gt;Schema&lt;&#x2F;h6&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;$schema&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;json-schema.org&#x2F;draft&#x2F;2020-12&#x2F;schema&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;additionalProperties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;optional&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;boolean&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;atomicity&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;strict&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;loose&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;none&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h6 id=&quot;example-request&quot;&gt;Example Request&lt;&#x2F;h6&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;from&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xd46e8dd67c5d32be8058bb8eb970870f07244567&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;calls&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;capabilities&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;flowControl&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;atomicity&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;loose&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;call-scope&quot;&gt;Call-scope&lt;&#x2F;h5&gt;
&lt;h6 id=&quot;schema-1&quot;&gt;Schema&lt;&#x2F;h6&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;$schema&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;json-schema.org&#x2F;draft&#x2F;2020-12&#x2F;schema&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;additionalProperties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;optional&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;boolean&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;onFailure&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;rollback&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;halt&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;continue&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h6 id=&quot;example-request-1&quot;&gt;Example Request&lt;&#x2F;h6&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;from&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xd46e8dd67c5d32be8058bb8eb970870f07244567&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;calls&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xd46e8dd67c5d32be8058bb8eb970870f07244567&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x182183&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xfbadbaf01&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;capabilities&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;flowControl&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;onFailure&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;continue&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;wallet-getcapabilities&quot;&gt;&lt;code&gt;wallet_getCapabilities&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The following JSON Schema is inserted into the per-chain object returned from &lt;code&gt;wallet_getCapabilities&lt;&#x2F;code&gt; with a key of &lt;code&gt;flowControl&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;schema-2&quot;&gt;Schema&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;$schema&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;json-schema.org&#x2F;draft&#x2F;2020-12&#x2F;schema&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;additionalProperties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;minProperties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;none&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;$ref&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;#&#x2F;$defs&#x2F;onFailure&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;loose&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;$ref&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;#&#x2F;$defs&#x2F;onFailure&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;strict&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;$ref&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;#&#x2F;$defs&#x2F;onFailure&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;$defs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;onFailure&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;array&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uniqueItems&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;minItems&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;items&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;rollback&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;halt&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;continue&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;example-response&quot;&gt;Example Response&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;flowControl&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;loose&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;halt&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;continue&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;strict&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;continue&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;concepts&quot;&gt;Concepts&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;call-failure&quot;&gt;Call Failure&lt;&#x2F;h4&gt;
&lt;!-- TODO: is a &quot;call failure&quot; the same as a &quot;revert&quot;? --&gt;
&lt;h4 id=&quot;rollback&quot;&gt;Rollback&lt;&#x2F;h4&gt;
&lt;p&gt;A rollback is informally defined as &quot;causing no meaningful changes on chain.&quot; A
rolled back batch only makes gas accounting and bookkeeping (eg. nonce)
changes. In other words, a rollback is the default behaviour of EIP-5792 when
a call fails.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;critical-calls&quot;&gt;Critical Calls&lt;&#x2F;h4&gt;
&lt;p&gt;A critical call is a call that causes the entire batch to rollback on failure,
and correspondingly a non-critical call does not. Specifically, a critical call
has a call-scope &lt;code&gt;onFailure&lt;&#x2F;code&gt; of &lt;code&gt;rollback&lt;&#x2F;code&gt; (or no &lt;code&gt;onFailure&lt;&#x2F;code&gt; present),
while non-critical calls have either &lt;code&gt;halt&lt;&#x2F;code&gt; or &lt;code&gt;continue&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;atomicity-levels&quot;&gt;Atomicity Levels&lt;&#x2F;h4&gt;
&lt;p&gt;This proposal introduces three atomicity levels: strict, loose, and none; enabled
by setting batch-scope &lt;code&gt;atomicity&lt;&#x2F;code&gt; to &lt;code&gt;strict&lt;&#x2F;code&gt;, &lt;code&gt;loose&lt;&#x2F;code&gt;, or &lt;code&gt;none&lt;&#x2F;code&gt; respectively.
Strict may also be enabled by omitting &lt;code&gt;atomicity&lt;&#x2F;code&gt; entirely.&lt;&#x2F;p&gt;
&lt;p&gt;Strict atomicity is simply naming the default behaviour of EIP-5792: calls
within a single batch MUST be contiguous and applied atomically (or the batch
rolled back.)&lt;&#x2F;p&gt;
&lt;p&gt;Loose atomicity, on the other hand, is a weaker guarantee. In the event of a
block reorg, any number of calls from the batch MAY appear on chain (possibly
interspersed with other transactions). If there are no block reorgs, loose
atomicity MUST provide the same guarantees as strict.&lt;&#x2F;p&gt;
&lt;p&gt;The none level of atomicity only provides the guarantee that the calls appear on
chain in the order they are in the batch. Any number of calls from the batch
MAY appear on chain (possibly interspersed with other transactions).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;behaviour&quot;&gt;Behaviour&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;wallet-sendcalls-1&quot;&gt;&lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The wallet MUST reject &lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt; requests with error code
&lt;code&gt;MISSING_CAP&lt;&#x2F;code&gt; where both:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;the batch-scope &lt;code&gt;flowControl&lt;&#x2F;code&gt; capability &lt;strong&gt;is not&lt;&#x2F;strong&gt; present; and&lt;&#x2F;li&gt;
&lt;li&gt;a call-scope &lt;code&gt;flowControl&lt;&#x2F;code&gt; capability &lt;strong&gt;is&lt;&#x2F;strong&gt; present.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note that the above requirement still applies if the call-scope &lt;code&gt;flowControl&lt;&#x2F;code&gt;
capability is marked as optional.&lt;&#x2F;p&gt;
&lt;p&gt;When &lt;code&gt;flowControl&lt;&#x2F;code&gt; is present in the batch-scope &lt;code&gt;capabilities&lt;&#x2F;code&gt;, the following
changes override the behaviour specified in EIP-5792.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;removed-requirements&quot;&gt;Removed Requirements&lt;&#x2F;h5&gt;
&lt;p&gt;These requirements defined in EIP-5792 are removed:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;The wallet:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;MUST NOT await for any calls to be finalized to complete the batch&lt;&#x2F;li&gt;
&lt;li&gt;MUST submit multiple calls as an atomic unit in a single transaction&lt;&#x2F;li&gt;
&lt;li&gt;MAY revert all calls if any call fails&lt;&#x2F;li&gt;
&lt;li&gt;MUST not execute any further calls after a failed call&lt;&#x2F;li&gt;
&lt;li&gt;MAY reject the request if one or more calls in the batch is expected to
fail, when simulated sequentially&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;blockquote&gt;
&lt;h5 id=&quot;added-requirements&quot;&gt;Added Requirements&lt;&#x2F;h5&gt;
&lt;p&gt;The wallet:&lt;&#x2F;p&gt;
&lt;h6 id=&quot;batch-atomicity&quot;&gt;Batch Atomicity&lt;&#x2F;h6&gt;
&lt;ul&gt;
&lt;li&gt;MAY break the batch over multiple transactions.&lt;&#x2F;li&gt;
&lt;li&gt;MUST treat a missing batch-scope &lt;code&gt;atomicity&lt;&#x2F;code&gt; level as equivalent to &lt;code&gt;strict&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;MUST provide strict guarantees (as defined above) when the batch-scope
&lt;code&gt;atomicity&lt;&#x2F;code&gt; is &lt;code&gt;strict&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;MUST provide &lt;em&gt;at least&lt;&#x2F;em&gt; loose guarantees (as defined above) when the
batch-scope &lt;code&gt;atomicity&lt;&#x2F;code&gt; is &lt;code&gt;loose&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;MUST provide &lt;em&gt;at least&lt;&#x2F;em&gt; the in-order call inclusion guarantee (as defined
above) when the batch-scope &lt;code&gt;atomicity&lt;&#x2F;code&gt; is &lt;code&gt;none&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;MAY provide loose guarantees (as defined above) when the batch-scope
&lt;code&gt;atomicity&lt;&#x2F;code&gt; is &lt;code&gt;none&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;MAY provide strict guarantees (as defined above) when the batch-scope
&lt;code&gt;atomicity&lt;&#x2F;code&gt; is &lt;code&gt;loose&lt;&#x2F;code&gt; or &lt;code&gt;none&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;MUST rollback the batch if one or more critical calls (as defined above) fail.&lt;&#x2F;li&gt;
&lt;li&gt;MUST NOT rollback the batch if zero critical calls (as defined above) fail.
&lt;ul&gt;
&lt;li&gt;In other words, if the only failures are non-critical, the successful calls
have to appear on chain.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;MUST NOT execute a call (or ever allow a call to be executed) more than once.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h6 id=&quot;flow-control&quot;&gt;Flow Control&lt;&#x2F;h6&gt;
&lt;ul&gt;
&lt;li&gt;MUST treat a missing call-scope &lt;code&gt;flowControl&lt;&#x2F;code&gt; capability as equivalent to
setting &lt;code&gt;onFailure&lt;&#x2F;code&gt; to &lt;code&gt;rollback&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;MUST treat a missing call-scope &lt;code&gt;onFailure&lt;&#x2F;code&gt; mode as equivalent to &lt;code&gt;rollback&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;MUST NOT execute any calls following a failed call with &lt;code&gt;onFailure&lt;&#x2F;code&gt; set to
&lt;code&gt;halt&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;MUST continue to execute calls as normal following a failed call with
&lt;code&gt;onFailure&lt;&#x2F;code&gt; set to &lt;code&gt;continue&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h6 id=&quot;errors&quot;&gt;Errors&lt;&#x2F;h6&gt;
&lt;ul&gt;
&lt;li&gt;MUST reject (with error code &lt;code&gt;REJECTED_LEVEL&lt;&#x2F;code&gt;) batches containing at least one
critical call if the batch requests an atomicity level that the wallet can
provide but the user rejected (such as might happen with an
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; set code transaction.)
&lt;ul&gt;
&lt;li&gt;Note that this only applies to user rejections specifically because of
atomicity. It does not change the behaviour for batches rejected for other
reasons. This error code MUST NOT be used for other rejection reasons.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;MUST reject (with error code &lt;code&gt;UNSUPPORTED_LEVEL&lt;&#x2F;code&gt;) batches containing at least
one critical call if the batch requests an atomicity level the wallet cannot
provide for any reason other than user rejection.
&lt;ul&gt;
&lt;li&gt;Wallets supporting &lt;code&gt;strict&lt;&#x2F;code&gt; but not &lt;code&gt;loose&lt;&#x2F;code&gt; SHOULD NOT reject &lt;code&gt;loose&lt;&#x2F;code&gt;
batches and SHOULD instead upgrade the request to strict atomicity.&lt;&#x2F;li&gt;
&lt;li&gt;Note that a batch with exactly one call &lt;em&gt;always&lt;&#x2F;em&gt; satisfies the requirements
of strict atomicity.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;MUST reject (with error code &lt;code&gt;UNSUPPORTED_ON_FAIL&lt;&#x2F;code&gt;) batches containing
unsupported &lt;code&gt;onFailure&lt;&#x2F;code&gt; modes.&lt;&#x2F;li&gt;
&lt;li&gt;MUST reject (with error code &lt;code&gt;UNSUPPORTED_FLOW&lt;&#x2F;code&gt;) batches containing
unsupported combinations&#x2F;orderings of call-scope &lt;code&gt;onFailure&lt;&#x2F;code&gt; modes.
&lt;ul&gt;
&lt;li&gt;Wallets MUST reject &lt;code&gt;rollback&lt;&#x2F;code&gt; when used in a &lt;code&gt;none&lt;&#x2F;code&gt; batch, even if the
batch is upgraded to &lt;code&gt;loose&lt;&#x2F;code&gt; or &lt;code&gt;strict&lt;&#x2F;code&gt; atomicity. This also applies to
calls that do not specify an explicit &lt;code&gt;onFailure&lt;&#x2F;code&gt; mode.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;MAY reject (with error code &lt;code&gt;ROLLBACK_EXPECTED&lt;&#x2F;code&gt;) the request if the batch is
expected to be rolled back.&lt;&#x2F;li&gt;
&lt;li&gt;SHOULD inform the user before executing any calls if any call in the batch is
expected to fail.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;wallet-getcallsstatus&quot;&gt;&lt;code&gt;wallet_getCallsStatus&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;When &lt;code&gt;wallet_getCallsStatus&lt;&#x2F;code&gt; is called with a batch identifier corresponding to
a batch submitted with the batch-scope &lt;code&gt;flowControl&lt;&#x2F;code&gt; capability enabled, the
following changes override the behaviour defined in EIP-5792. Note that:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;There are no changes when called with a batch without this capability enabled;
and&lt;&#x2F;li&gt;
&lt;li&gt;Even if the behaviour of the batch is not changed from the default (eg.
setting &lt;code&gt;atomicity&lt;&#x2F;code&gt; to &lt;code&gt;strict&lt;&#x2F;code&gt; and omitting the &lt;code&gt;flowControl&lt;&#x2F;code&gt; capability for
all calls), the following changes still apply.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;removed-requirements-1&quot;&gt;Removed Requirements&lt;&#x2F;h5&gt;
&lt;p&gt;These requirements defined in EIP-5792 are removed:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;If a wallet executes multiple calls &lt;strong&gt;atomically&lt;&#x2F;strong&gt; in a single transaction,
&lt;code&gt;wallet_getCallsStatus&lt;&#x2F;code&gt; MUST return an object with a &lt;code&gt;receipts&lt;&#x2F;code&gt; field that
contains a single transaction receipt, corresponding to the transaction
in which the calls were included.&lt;&#x2F;li&gt;
&lt;li&gt;If a wallet executes multiple calls &lt;strong&gt;non-atomically&lt;&#x2F;strong&gt; through some
&lt;code&gt;capability&lt;&#x2F;code&gt; defined elsewhere, &lt;code&gt;wallet_getCallsStatus&lt;&#x2F;code&gt; MUST return an
object with a &lt;code&gt;receipts&lt;&#x2F;code&gt; field that contains &lt;strong&gt;an array of receipts&lt;&#x2F;strong&gt; for
all transactions containing batch calls that were included onchain. This
includes the batch calls that were included on-chain but eventually
reverted.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;blockquote&gt;
&lt;h5 id=&quot;added-requirements-1&quot;&gt;Added Requirements&lt;&#x2F;h5&gt;
&lt;h6 id=&quot;capabilities&quot;&gt;Capabilities&lt;&#x2F;h6&gt;
&lt;p&gt;The returned capabilities object:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;MUST contain a &lt;code&gt;flowControl&lt;&#x2F;code&gt; key set to exactly the boolean &lt;code&gt;true&lt;&#x2F;code&gt;.
&lt;ul&gt;
&lt;li&gt;It may be tempting to include additional detail about the status of
individual calls here, but don&#x27;t. Instead use a multi-status capability
defined elsewhere.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h6 id=&quot;receipts&quot;&gt;Receipts&lt;&#x2F;h6&gt;
&lt;p&gt;The returned &lt;code&gt;receipts&lt;&#x2F;code&gt; array:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;MUST NOT contain more than one receipt for the same transaction.&lt;&#x2F;li&gt;
&lt;li&gt;SHOULD NOT contain receipts for transactions without a call from the requested
batch.&lt;&#x2F;li&gt;
&lt;li&gt;MUST contain exactly one receipt capturing each successful call.
&lt;ul&gt;
&lt;li&gt;Multiple calls MAY be captured in one receipt, but the successful
execution of one call MUST NOT be captured by multiple receipts.&lt;&#x2F;li&gt;
&lt;li&gt;Given two calls (&lt;em&gt;A&lt;&#x2F;em&gt; and &lt;em&gt;B&lt;&#x2F;em&gt;) in a batch, the following are non-exhaustive
example combinations of calls-per-receipt. Each &lt;code&gt;(...)&lt;&#x2F;code&gt; is a receipt from
a single transaction.
&lt;ul&gt;
&lt;li&gt;Valid Examples:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;[(successful A, successful B)]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;[(successful A), (successful B)]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;[(successful A, unsuccessful B), (successful B)]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;[(unsuccessful A), (successful A), (successful B)]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Invalid Examples:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;[(successful A, unsuccessful B), (successful A, successful B)]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;[(successful A, successful A), (successful B)]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;MAY contain one or more receipts capturing each failed call.
&lt;ul&gt;
&lt;li&gt;For example, the wallet may retry a transaction with a higher gas limit.
Both the failed and successful transaction receipts can be included,
though only the successful receipt must be.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;SHOULD be stable over multiple &lt;code&gt;wallet_getCallsStatus&lt;&#x2F;code&gt; requests, with only new
receipts being appended.
&lt;ul&gt;
&lt;li&gt;For example:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;[(unsuccessful A)]&lt;&#x2F;code&gt; followed by &lt;code&gt;[(unsuccessful A), (successful A)]&lt;&#x2F;code&gt;
is valid; but&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;[(unsuccessful A)]&lt;&#x2F;code&gt; followed by &lt;code&gt;[(successful A)]&lt;&#x2F;code&gt; should be avoided.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;status-codes&quot;&gt;Status Codes&lt;&#x2F;h5&gt;
&lt;p&gt;This proposal modifies some of the status codes for use with EIP-5792&#x27;s
&lt;code&gt;GetCallsResult.status&lt;&#x2F;code&gt; field, and introduces the following new codes:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Code&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;102&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Partially Executed&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;207&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Partial Success&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;An &quot;included&quot; call, in this section, is defined as having either been
successfully or unsuccessfully executed. A call that has been recorded on chain,
but has not yet been executed, does not qualify as included. Executed calls
contained in batches that may still be rolled back also do not qualify as
included.&lt;&#x2F;p&gt;
&lt;p&gt;A batch is &quot;complete&quot; when all of the calls in the batch (up to and including a
failed call with an &lt;code&gt;onFailure&lt;&#x2F;code&gt; mode of &lt;code&gt;halt&lt;&#x2F;code&gt; should one be present) have been
included and the wallet will not resubmit failed calls.&lt;&#x2F;p&gt;
&lt;h6 id=&quot;100-pending&quot;&gt;&lt;code&gt;100&lt;&#x2F;code&gt; Pending&lt;&#x2F;h6&gt;
&lt;p&gt;Status &lt;code&gt;100&lt;&#x2F;code&gt; MUST NOT be returned if any calls in the batch have been included
on chain.&lt;&#x2F;p&gt;
&lt;h6 id=&quot;102-partially-executed&quot;&gt;&lt;code&gt;102&lt;&#x2F;code&gt; Partially Executed&lt;&#x2F;h6&gt;
&lt;p&gt;Status &lt;code&gt;102&lt;&#x2F;code&gt; SHALL be returned only when all of the following are true:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;At least one call in the batch has been included on chain; and&lt;&#x2F;li&gt;
&lt;li&gt;The batch is not complete.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Responses with status &lt;code&gt;102&lt;&#x2F;code&gt; MUST contain at least one receipt, and SHOULD
contain receipts for all transactions with calls that have been included.&lt;&#x2F;p&gt;
&lt;p&gt;Note that a receipt capturing a failed call does not mean the call will
ultimately fail. Wallets can resubmit calls (eg. with a higher gas limit), and
the call may be executed successfully eventually.&lt;&#x2F;p&gt;
&lt;h6 id=&quot;200-confirmed&quot;&gt;&lt;code&gt;200&lt;&#x2F;code&gt; Confirmed&lt;&#x2F;h6&gt;
&lt;p&gt;Status &lt;code&gt;200&lt;&#x2F;code&gt; MUST NOT be returned if any calls in the batch failed (including
batch rollback, and the &lt;code&gt;onFailure&lt;&#x2F;code&gt; modes &lt;code&gt;halt&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;continue&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;h6 id=&quot;207-partial-success&quot;&gt;&lt;code&gt;207&lt;&#x2F;code&gt; Partial Success&lt;&#x2F;h6&gt;
&lt;p&gt;Status &lt;code&gt;207&lt;&#x2F;code&gt; SHALL be returned only when all of the following are true:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;At least one call in the batch has been included and succeeded;&lt;&#x2F;li&gt;
&lt;li&gt;At least one call in the batch with an &lt;code&gt;onFailure&lt;&#x2F;code&gt; mode of &lt;code&gt;continue&lt;&#x2F;code&gt;
has been included and failed;&lt;&#x2F;li&gt;
&lt;li&gt;No calls with an &lt;code&gt;onFailure&lt;&#x2F;code&gt; mode of &lt;code&gt;rollback&lt;&#x2F;code&gt; have been included and failed;&lt;&#x2F;li&gt;
&lt;li&gt;No calls with an &lt;code&gt;onFailure&lt;&#x2F;code&gt; mode of &lt;code&gt;halt&lt;&#x2F;code&gt; have been included and failed;
and&lt;&#x2F;li&gt;
&lt;li&gt;The batch is complete.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h6 id=&quot;500-chain-rules-failure&quot;&gt;&lt;code&gt;500&lt;&#x2F;code&gt; Chain Rules Failure&lt;&#x2F;h6&gt;
&lt;p&gt;To clarify, status &lt;code&gt;500&lt;&#x2F;code&gt; is the correct code when the batch has rolled back &lt;em&gt;or&lt;&#x2F;em&gt;
when all calls are non-critical and have all failed.&lt;&#x2F;p&gt;
&lt;p&gt;If any calls are included and succeeded, one of &lt;code&gt;200&lt;&#x2F;code&gt;, &lt;code&gt;207&lt;&#x2F;code&gt;, or &lt;code&gt;600&lt;&#x2F;code&gt; should be
returned instead.&lt;&#x2F;p&gt;
&lt;h6 id=&quot;600-partial-chain-rules-failure&quot;&gt;&lt;code&gt;600&lt;&#x2F;code&gt; Partial Chain Rules Failure&lt;&#x2F;h6&gt;
&lt;p&gt;Status &lt;code&gt;600&lt;&#x2F;code&gt; SHALL be returned only when all of the following are true:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;At least one call in the batch has been included and succeeded;&lt;&#x2F;li&gt;
&lt;li&gt;At least one call in the batch with an &lt;code&gt;onFailure&lt;&#x2F;code&gt; mode of &lt;code&gt;halt&lt;&#x2F;code&gt; has been
included and failed;&lt;&#x2F;li&gt;
&lt;li&gt;No calls with an &lt;code&gt;onFailure&lt;&#x2F;code&gt; mode of &lt;code&gt;rollback&lt;&#x2F;code&gt; have been included and failed;
and&lt;&#x2F;li&gt;
&lt;li&gt;The batch is complete.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;wallet-getcapabilities-1&quot;&gt;&lt;code&gt;wallet_getCapabilities&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The response to &lt;code&gt;wallet_getCapabilities&lt;&#x2F;code&gt; indicates what call-scope &lt;code&gt;onFailure&lt;&#x2F;code&gt;
modes are supported for each supported batch-scope &lt;code&gt;atomicity&lt;&#x2F;code&gt; level for
batches with two or more calls. Support, here, means &quot;natively supports.&quot; A
wallet that offers &lt;code&gt;strict&lt;&#x2F;code&gt; atomicity but not &lt;code&gt;loose&lt;&#x2F;code&gt; MUST NOT advertise
support for &lt;code&gt;loose&lt;&#x2F;code&gt; (even if the wallet will upgrade &lt;code&gt;loose&lt;&#x2F;code&gt; to &lt;code&gt;strict&lt;&#x2F;code&gt;
without an error.)&lt;&#x2F;p&gt;
&lt;p&gt;The wallet:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;MAY respond with one, two, or three &lt;code&gt;atomicity&lt;&#x2F;code&gt; levels.&lt;&#x2F;li&gt;
&lt;li&gt;MAY respond with one, two, or three &lt;code&gt;onFailure&lt;&#x2F;code&gt; modes in each &lt;code&gt;atomicity&lt;&#x2F;code&gt;
level. The levels do not need to support the same modes.&lt;&#x2F;li&gt;
&lt;li&gt;MUST include the particular atomicity &#x2F; onFailure combination if it is
supported &lt;em&gt;at all&lt;&#x2F;em&gt;. For example, if particular orderings are impossible—say
&lt;code&gt;rollback&lt;&#x2F;code&gt; before &lt;code&gt;halt&lt;&#x2F;code&gt; is fine, but &lt;code&gt;halt&lt;&#x2F;code&gt; before &lt;code&gt;rollback&lt;&#x2F;code&gt; is not—then
both &lt;code&gt;rollback&lt;&#x2F;code&gt; and &lt;code&gt;halt&lt;&#x2F;code&gt; have to be included in the array.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;examples&quot;&gt;Examples&lt;&#x2F;h5&gt;
&lt;h6 id=&quot;plain-externally-owned-account-eoa&quot;&gt;Plain Externally Owned Account (EOA)&lt;&#x2F;h6&gt;
&lt;p&gt;A plain EOA might offer &lt;code&gt;halt&lt;&#x2F;code&gt; functionality by submitting one transaction per
block, and &lt;code&gt;continue&lt;&#x2F;code&gt; by submitting all calls at once.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;flowControl&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;none&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;halt&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;continue&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h6 id=&quot;shielded-mempool-externally-owned-account-eoa&quot;&gt;Shielded Mempool Externally Owned Account (EOA)&lt;&#x2F;h6&gt;
&lt;p&gt;Unlike a plain EOA, a shielded mempool can provide additional guarantees about
transaction atomicity. In this example, the wallet only offers the
&lt;code&gt;onFailure&lt;&#x2F;code&gt; mode of &lt;code&gt;continue&lt;&#x2F;code&gt; when using &lt;code&gt;none&lt;&#x2F;code&gt; atomicity, but offers all three levels when using
&lt;code&gt;loose&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;flowControl&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;none&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;continue&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;loose&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;rollback&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;halt&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;continue&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h6 id=&quot;smart-contract-wallet&quot;&gt;Smart Contract Wallet&lt;&#x2F;h6&gt;
&lt;p&gt;In this example, the wallet will service batches specifying &lt;code&gt;none&lt;&#x2F;code&gt; and &lt;code&gt;loose&lt;&#x2F;code&gt;
as if they requested &lt;code&gt;strict&lt;&#x2F;code&gt;. Even though the batches will work, the
&lt;code&gt;wallet_getCapabilities&lt;&#x2F;code&gt; response does not list &lt;code&gt;none&lt;&#x2F;code&gt; or &lt;code&gt;loose&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;flowControl&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;strict&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;rollback&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;error-codes&quot;&gt;Error Codes&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;INVALID_SCHEMA&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;!-- TODO --&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MISSING_CAP&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;!-- TODO --&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;REJECTED_LEVEL&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;!-- TODO --&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;UNSUPPORTED_LEVEL&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;!-- TODO --&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;UNSUPPORTED_ON_FAIL&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;!-- TODO --&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;UNSUPPORTED_FLOW&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;!-- TODO --&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ROLLBACK_EXPECTED&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;!-- TODO --&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;!--
  The rationale fleshes out the specification by describing what motivated the design and why particular design decisions were made. It should describe alternate designs that were considered and related work, e.g. how the feature is supported in other languages.

  The current placeholder is acceptable for a draft.

  TODO: Remove this comment before submitting
--&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;!--

  This section is optional.

  All EIPs that introduce backwards incompatibilities must include a section describing these incompatibilities and their severity. The EIP must explain how the author proposes to deal with these incompatibilities. EIP submissions without a sufficient backwards compatibility treatise may be rejected outright.

  The current placeholder is acceptable for a draft.

  TODO: Remove this comment before submitting
--&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;App developers cannot treat each call in a batch as an independent transaction
unless the atomicity level is strict. In other words, there may be additional
untrusted transactions between any of the calls in a batch. Calls that failed
may eventually flip to succeeding, and vice versa. Even strictly atomic batches
can flip between succeeding&#x2F;failing in the face of a block reorg. The calls in
loosely atomic batches can be included in separate, non-contiguous blocks. There
is no constraint over how long it will take all the calls in a batch to be
included. Apps should encode deadlines and timeout behaviors in the smart
contract calls, just as they do today for transactions, including ones otherwise
bundled.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Block-level Warming</title>
        <published>2025-01-15T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Toni Wahrstätter</name><uri>https://github.com/nerolation</uri>
	</author>
	
	<author>
		<name>Jochem Brouwer</name><uri>https://github.com/jochem-brouwer</uri>
	</author>
	
	<author>
		<name>Alex Stokes</name><uri>https://github.com/ralexstokes</uri>
	</author>
	
	<author>
		<name>Ansgar Dietrichs</name><uri>https://github.com/adietrichs</uri>
	</author>
	
	<author>
		<name>Yoav Weiss</name><uri>https://github.com/yoavw</uri>
	</author>
	
	<author>
		<name>Alex Forshtat</name><uri>https://github.com/forshtat</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7863/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7863-block-level-warming/22572" />
        

        <id>https://wg-eips.ritovision.com/7863/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7863"
            label="EIP-7863" />
        

        
        

        
        <summary type="html">Warm addresses and storage keys over the duration of a block</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7863/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal introduces block-level address and storage key warming, allowing accessed addresses and storage keys to maintain their &quot;warm&quot; status throughout an entire block&#x27;s execution. Accessed slots can be effectively cached at the block level, allowing for this optimization.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, the EVM&#x27;s storage slot warming mechanism operates at the transaction level, requiring each transaction to &quot;warm up&quot; slots independently, even when accessing the same storage locations within the same block. This design does not take advantage of the fact that modern node implementations can effectively cache storage access patterns at the block level. By extending the slot warming duration to the block level, we can:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Reduce redundant warming costs for frequently accessed slots&lt;&#x2F;li&gt;
&lt;li&gt;Better align gas costs with actual computational overhead&lt;&#x2F;li&gt;
&lt;li&gt;Improve overall network throughput without compromising security.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;As of Jan. 2025, the empirically measured efficiency gains are around 5%.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;mechanics&quot;&gt;Mechanics&lt;&#x2F;h3&gt;
&lt;p&gt;When a storage slot is accessed within a block:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The first access to a slot in a block incurs the cold access cost as of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;All subsequent accesses to the same slot within the same block incur only the warm access cost as of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The warm&#x2F;cold status resets at block boundaries&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;block-processing&quot;&gt;Block Processing&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;At the start of each block:
&lt;ul&gt;
&lt;li&gt;Initialize two empty sets &lt;code&gt;block_level_accessed_addresses&lt;&#x2F;code&gt; and &lt;code&gt;block_level_accessed_storage_keys&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;For each transaction in the block:
&lt;ul&gt;
&lt;li&gt;Before processing storage access:
&lt;ul&gt;
&lt;li&gt;Check if touched address is in &lt;code&gt;block_level_accessed_addresses&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;If yes: charge &lt;code&gt;WARM_STORAGE_READ_COST&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;If no:
&lt;ul&gt;
&lt;li&gt;Charge &lt;code&gt;COLD_ACCOUNT_ACCESS_COST&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Add address to &lt;code&gt;block_level_accessed_addresses&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Check if storage key is in &lt;code&gt;block_level_accessed_storage_keys&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;If yes: charge &lt;code&gt;WARM_STORAGE_READ_COST&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;If no:
&lt;ul&gt;
&lt;li&gt;Charge &lt;code&gt;COLD_SLOAD_COST&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Add storage key to &lt;code&gt;block_level_accessed_storage_keys&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;implementation-details&quot;&gt;Implementation Details&lt;&#x2F;h3&gt;
&lt;p&gt;The implementation modifies the block execution process to maintain block-level sets of accessed addresses and storage slots.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;block-level-storage-management&quot;&gt;Block-Level Storage Management&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; apply_body&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;...&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Initialize block-level tracking sets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block_level_accessed_addresses&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; set&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block_level_accessed_storage_keys&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; set&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; enumerate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;map&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;decode_transaction&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; transactions&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Create environment with block-level context&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        env&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; vm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;Environment&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ... other parameters ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            block_level_accessed_addresses&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;block_level_accessed_addresses&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            block_level_accessed_storage_keys&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;block_level_accessed_storage_keys&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Process transaction and update block-level sets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        gas_used&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; accessed_addresses&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; accessed_storage_keys&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; logs&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; error&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; process_transaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;env&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        block_level_accessed_addresses&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; accessed_addresses&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        block_level_accessed_storage_keys&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; accessed_storage_keys&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This code shows how block-level slot warming is implemented at the execution layer. The &lt;code&gt;block_level_accessed_addresses&lt;&#x2F;code&gt; and &lt;code&gt;block_level_accessed_storage_keys&lt;&#x2F;code&gt; sets are maintained throughout the block&#x27;s execution and passed to each transaction&#x27;s environment.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;transaction-processing&quot;&gt;Transaction Processing&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; process_transaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;env&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; vm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;Environment&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Transaction&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Tuple&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Uint&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Tuple&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Log&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ...&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Optional&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;Exception&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    preaccessed_addresses&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; set&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    preaccessed_storage_keys&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; set&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Add block-level pre-accessed slots&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    preaccessed_addresses&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;env&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;block_level_accessed_addresses&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    preaccessed_storage_keys&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;env&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;block_level_accessed_storage_keys&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Handle access lists from transaction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This adds the block-level-accessed addresses and storage keys to the preaccessed addresses and storage keys.
As a result, from the perspective of a transaction, block-level accessed addresses and storage keys are treated the same as precompiles or the coinbase address.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; process_message_call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;message&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Message&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; env&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Environment&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; MessageCallOutput&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; MessageCallOutput&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ... other fields ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        accessed_addresses&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;accessed_addresses&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        accessed_storage_keys&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;accessed_storage_keys&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The message call processing tracks accessed addresses and storage keys during execution, which are then propagated back up to the transaction level and ultimately to the block level.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The proposal builds on several key observations:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Caching Efficiency&lt;&#x2F;strong&gt;: Modern Ethereum clients already implement sophisticated caching mechanisms at the block level. Extending address and storage key warming to match this caching behavior better aligns gas costs with actual computational costs.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Backward Compatibility&lt;&#x2F;strong&gt;: The worst-case scenario for any transaction remains unchanged - it will never pay more than the current cold access cost for its first access to a slot.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Handling Reverts&lt;&#x2F;strong&gt;: In EIP-2929, if a sub-call reverts, all accessed addresses and slots are reverted to a cold state. Under block-level warming, it remains an open question whether a failing transaction (i.e., one that reverts) should ‘unwarm’ previously warmed addresses and slots for subsequent transactions within the same block. Some propose removing this revert-induced “cold reset” altogether to maintain consistency with block-level warming. This point warrants further discussion, particularly around whether or not preserving a warmed state even upon failure aligns with the broader goal of better matching gas costs to actual client caching behavior.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;First Access Warms For All&lt;&#x2F;strong&gt;: Under the proposed mechanism, the first transaction in a block that accesses and warms multiple addresses or storage slots bears the entire cost of warming, even if subsequent transactions benefit from those already-warmed slots without incurring additional costs. This approach is deemed acceptable because early execution within a block—where warming typically occurs—is generally occupied for transactions placed by professional builders aiming for top-of-block execution. Since the resulting cost discrepancy is relatively minor, a more complex cost-sharing model is avoided in favor of maintaining simplicity.
An alternative to the one-warms-for-all mechanism involves distributing the warming costs across all accesses within a block. In this approach, each transaction must at least be able to pay the cold access cost. Once all transactions in the block are executed, the total warming costs are evenly distributed, and transaction originators are refunded accordingly.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Alternative Block Warming Windows&lt;&#x2F;strong&gt;: Instead of applying warming at the block level, more advanced multi-block warming approaches can be considered. Potential options include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Warming addresses and storage keys over the duration of an epoch&lt;&#x2F;li&gt;
&lt;li&gt;Using a ring buffer spanning &lt;code&gt;x&lt;&#x2F;code&gt; blocks
Since the Execution Layer (EL) currently operates without regard to epoch boundaries, it may be preferable to maintain this design. Therefore, the second option, involving a ring buffer of size x, could be more suitable. For the ring buffer, one approach might be to store the relevant warmed information in the block header for those x blocks, but this introduces additional overhead and can complicate statelessness. Careful design would be required to manage these trade-offs (e.g., header size, client complexity) if a multi-block warming solution were adopted.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change is not backward compatible and requires a hard fork activation. However, it does not introduce any breaking changes for existing contracts, as:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;All existing transactions will continue to work as before&lt;&#x2F;li&gt;
&lt;li&gt;Gas costs will only decrease, never increase&lt;&#x2F;li&gt;
&lt;li&gt;Contract logic depending on gas costs will remain valid, as the worst-case scenario is unchanged&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Memory Usage&lt;&#x2F;strong&gt;: The set of warm slots is still bounded by block gas limit &#x2F; minimum gas cost per slot access, preventing DoS attacks through excessive memory usage.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;MEV Considerations&lt;&#x2F;strong&gt;: Block producers can optimize transaction ordering to maximize slot warming benefits for themselves. Third-party block builders can backrun transactions that warmed specific addresses or storage keys.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>AI Agent Registration and Verification</title>
        <published>2025-01-15T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Leigh Cronian</name><uri>https://github.com/cybercentry</uri><email>leigh.cronian@cybercentry.co.uk</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8126/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-8126-ai-agent-registration-and-verification/27445" />
        

        <id>https://wg-eips.ritovision.com/8126/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:8126"
            label="ERC-8126" />
        

        
        

        
        <summary type="html">Self-registration and specialised verifications for verifiable AI Agent security on Ethereum</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8126/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC defines a standard interface for registering and verifying AI agents on Ethereum. It enables AI agents to self-register with verifiable credentials and undergo specialised verification processes including Ethereum Token Verification (ETV), Staking Contract Verification (SCV), Web Application Verification (WAV), and Wallet Verification (WV). Verification providers implementing this standard process results through Private Data Verification (PDV) to generate Zero-Knowledge Proofs. Detailed verification results are accessible only to AI Agent wallet holders, providing a unified risk scoring system (0-100) that helps users assess agent trustworthiness.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;As AI agents become increasingly prevalent in blockchain ecosystems, users need standardised ways to verify their authenticity and trustworthiness. Current solutions are fragmented, with no unified standard for agent registration or verification. This ERC addresses these challenges by providing:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Self-Registration&lt;&#x2F;strong&gt;: AI agents can register themselves with verifiable on-chain credentials&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Multi-Layer Verification&lt;&#x2F;strong&gt;: Four specialised verification types assess different aspects of agent security&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Privacy-First Architecture&lt;&#x2F;strong&gt;: Zero-Knowledge Proofs ensure verification without exposing sensitive data&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Unified Risk Scoring&lt;&#x2F;strong&gt;: A standardised 0-100 risk score enables easy comparison between agents&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Micropayment Integration&lt;&#x2F;strong&gt;: x402 protocol enables cost-effective verification without gas overhead&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Quantum-Resistant Future&lt;&#x2F;strong&gt;: Optional Quantum Cryptography Verification (QCV) provides future-proof encryption&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Term&lt;&#x2F;th&gt;&lt;th&gt;Definition&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Agent Wallet&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;The Ethereum address designated as controlled by the AI agent&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;AI Agent&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;An autonomous software entity that performs actions on behalf of users, identified by an Ethereum wallet address and optional smart contract&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;ETV&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;Ethereum Token Verification - validates smart contract presence and legitimacy&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;PDV&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;Private Data Verification - generates Zero-Knowledge Proofs from verification results&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Proof ID&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;A unique identifier for a Zero-Knowledge Proof generated during verification&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;QCV&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;Quantum Cryptography Verification - provides quantum-resistant encryption for sensitive data&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Registrant&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;The Ethereum address that submitted the agent registration transaction&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Risk Score&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;A numerical value from 0-100 indicating the assessed risk level, where 0 is lowest risk and 100 is highest risk&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;SCV&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;Staking Contract Verification - validates staking contract security&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Verification Provider&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;A service implementing this standard&#x27;s verification types (ETV, PDV, QCV, SCV, WAV, WV)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;WAV&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;Web Application Verification - checks endpoint security and accessibility&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;WV&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;Wallet Verification - assesses wallet history and threat database status&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;ZKP&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;Zero-Knowledge Proof - cryptographic proof that verification occurred without revealing underlying data&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;required-standards&quot;&gt;Required Standards&lt;&#x2F;h3&gt;
&lt;p&gt;This standard requires the following EIPs&#x2F;ERCs:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Standard&lt;&#x2F;th&gt;&lt;th&gt;Purpose in This ERC&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Replay attack protection - ensures signatures include chain ID to prevent cross-chain replay attacks during agent registration and verification&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Typed structured data signing - enables human-readable signing requests for agent registration, preventing blind signing attacks and improving UX&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3009&#x2F;&quot;&gt;ERC-3009&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Transfer with authorization - enables gasless USDC transfers for x402 micropayments, allowing verification fees without requiring ETH for gas&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;191&#x2F;&quot;&gt;ERC-191&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Signed data standard - provides standardised format for signed messages used in wallet verification and proof validation&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;verification-flow&quot;&gt;Verification Flow&lt;&#x2F;h3&gt;
&lt;p&gt;The following diagram illustrates the verification process:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+-------------------+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|   AI Agent Owner  |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+--------+----------+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         | 1. Register Agent (EIP-712 signed)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         v&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+-------------------+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|  Agent Registry   |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|  (Smart Contract) |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+--------+----------+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         | 2. Emit AgentRegistered Event&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         v&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+-------------------+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|   Verification    |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|     Request       |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+--------+----------+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         | 3. Submit to Verification Provider&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         |    (x402 payment via EIP-3009)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         v&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+-------------------+     +-------------------+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|   Verification    |     |                   |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|     Provider      +----&amp;gt;+  ETV (if contract |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|                   |     |     provided)     |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+--------+----------+     +--------+----------+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         |                         |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         |                         v&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         |                +--------+----------+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         |                |       SCV         |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         |                |  (if staking      |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         |                |     provided)     |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         |                +--------+----------+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         |                         |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         |                         v&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         |                +--------+----------+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         |                |       WAV         |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         |                |  (always runs)    |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         |                +--------+----------+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         |                         |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         |                         v&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         |                +--------+----------+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         |                |       WV          |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         |                |  (always runs)    |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         |                +--------+----------+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         |                         |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         | 4. Aggregate Results    |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         |&amp;lt;------------------------+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         | 5. Generate ZK Proofs via PDV&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         v&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+-------------------+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|       PDV         |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;| (Zero-Knowledge   |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|  Proof Generation)|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+--------+----------+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         | 6. Optional: QCV encryption&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         v&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+-------------------+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|       QCV         |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;| (Quantum-Resistant|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|    Encryption)    |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+--------+----------+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         | 7. Return Proof IDs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         v&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+-------------------+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|  Update Registry  |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;| Emit AgentVerified|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+-------------------+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;agent-registration&quot;&gt;Agent Registration&lt;&#x2F;h3&gt;
&lt;p&gt;An AI agent MUST register with the following information:&lt;&#x2F;p&gt;
&lt;h4 id=&quot;required-fields&quot;&gt;Required Fields&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Field&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;name&lt;&#x2F;td&gt;&lt;td&gt;string&lt;&#x2F;td&gt;&lt;td&gt;Human-readable agent name&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;description&lt;&#x2F;td&gt;&lt;td&gt;string&lt;&#x2F;td&gt;&lt;td&gt;Brief description of agent purpose&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;walletAddress&lt;&#x2F;td&gt;&lt;td&gt;address&lt;&#x2F;td&gt;&lt;td&gt;Ethereum address controlled by agent&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;url&lt;&#x2F;td&gt;&lt;td&gt;string&lt;&#x2F;td&gt;&lt;td&gt;HTTPS endpoint for agent interaction&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;optional-fields&quot;&gt;Optional Fields&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Field&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;contractAddress&lt;&#x2F;td&gt;&lt;td&gt;address&lt;&#x2F;td&gt;&lt;td&gt;Smart contract address if applicable&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;stakingContractAddress&lt;&#x2F;td&gt;&lt;td&gt;address&lt;&#x2F;td&gt;&lt;td&gt;Staking contract address if applicable&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;platformId&lt;&#x2F;td&gt;&lt;td&gt;uint256&lt;&#x2F;td&gt;&lt;td&gt;Platform identifier for cross-platform verification&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;chainId&lt;&#x2F;td&gt;&lt;td&gt;uint256&lt;&#x2F;td&gt;&lt;td&gt;Chain ID for multi-chain agents&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;verification-types&quot;&gt;Verification Types&lt;&#x2F;h3&gt;
&lt;p&gt;Compliant verification providers MUST implement the following verification types:&lt;&#x2F;p&gt;
&lt;h4 id=&quot;etv-ethereum-token-verification&quot;&gt;ETV (Ethereum Token Verification)&lt;&#x2F;h4&gt;
&lt;p&gt;Validates on-chain presence and smart contract legitimacy.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;MUST verify contract exists on specified chain&lt;&#x2F;li&gt;
&lt;li&gt;MUST check contract against known vulnerability patterns&lt;&#x2F;li&gt;
&lt;li&gt;MUST return risk score 0-100&lt;&#x2F;li&gt;
&lt;li&gt;SHOULD accept parameters: chain_id, platform_id, contract_address&lt;&#x2F;li&gt;
&lt;li&gt;SHOULD follow OWASP Smart Contract Security guidelines&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;scv-staking-contract-verification&quot;&gt;SCV (Staking Contract Verification)&lt;&#x2F;h4&gt;
&lt;p&gt;Validates staking contract legitimacy and security when a staking contract address is provided.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;MUST verify staking contract exists on specified chain&lt;&#x2F;li&gt;
&lt;li&gt;MUST check staking mechanism implementation&lt;&#x2F;li&gt;
&lt;li&gt;MUST verify reward distribution logic&lt;&#x2F;li&gt;
&lt;li&gt;MUST check for common staking vulnerabilities (reentrancy, flash loan attacks)&lt;&#x2F;li&gt;
&lt;li&gt;MUST return risk score 0-100&lt;&#x2F;li&gt;
&lt;li&gt;SHOULD accept parameters: chain_id, staking_contract_address&lt;&#x2F;li&gt;
&lt;li&gt;SHOULD follow OWASP Smart Contract Security guidelines&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;wav-web-application-verification&quot;&gt;WAV (Web Application Verification)&lt;&#x2F;h4&gt;
&lt;p&gt;Ensures the agent&#x27;s web endpoint is accessible and secure.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;MUST verify HTTPS endpoint responds&lt;&#x2F;li&gt;
&lt;li&gt;MUST check for common security vulnerabilities&lt;&#x2F;li&gt;
&lt;li&gt;MUST verify SSL certificate validity&lt;&#x2F;li&gt;
&lt;li&gt;MUST return risk score 0-100&lt;&#x2F;li&gt;
&lt;li&gt;SHOULD accept parameter: url&lt;&#x2F;li&gt;
&lt;li&gt;SHOULD follow OWASP Web Application Security Testing guidelines (WSTG)&lt;&#x2F;li&gt;
&lt;li&gt;SHOULD check for OWASP Top 10 vulnerabilities&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;wv-wallet-verification&quot;&gt;WV (Wallet Verification)&lt;&#x2F;h4&gt;
&lt;p&gt;Confirms wallet ownership and assesses on-chain risk profile.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;MUST verify wallet has transaction history&lt;&#x2F;li&gt;
&lt;li&gt;MUST check against threat intelligence databases&lt;&#x2F;li&gt;
&lt;li&gt;MUST return risk score 0-100&lt;&#x2F;li&gt;
&lt;li&gt;SHOULD accept parameter: wallet_address&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;off-chain-verification&quot;&gt;Off-chain Verification&lt;&#x2F;h3&gt;
&lt;p&gt;Verification is performed off-chain to:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Eliminate gas costs for verification operations&lt;&#x2F;li&gt;
&lt;li&gt;Enable complex verification logic that would be prohibitively expensive on-chain&lt;&#x2F;li&gt;
&lt;li&gt;Allow verification criteria to evolve without requiring contract upgrades&lt;&#x2F;li&gt;
&lt;li&gt;Enable multiple competing verification providers&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;provider-agnostic-design&quot;&gt;Provider Agnostic Design&lt;&#x2F;h3&gt;
&lt;p&gt;This standard intentionally separates the interface specification from implementation details. Any verification provider MAY implement compliant ETV, WV, WAV, SCV, PDV, and QCV services, enabling:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Competition among verification providers&lt;&#x2F;li&gt;
&lt;li&gt;Specialisation in different verification domains&lt;&#x2F;li&gt;
&lt;li&gt;Geographic and jurisdictional flexibility&lt;&#x2F;li&gt;
&lt;li&gt;Price competition benefiting users&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;privacy-first-architecture-with-pdv&quot;&gt;Privacy-First Architecture with PDV&lt;&#x2F;h3&gt;
&lt;p&gt;Verification results are processed through Private Data Verification (PDV) which generates Zero-Knowledge Proofs. This privacy-first approach:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Eliminates data breach risks - no stored data means nothing to compromise&lt;&#x2F;li&gt;
&lt;li&gt;Provides cryptographic proof of verification that third parties can validate&lt;&#x2F;li&gt;
&lt;li&gt;Ensures GDPR and privacy regulation compliance&lt;&#x2F;li&gt;
&lt;li&gt;Builds user trust through transparent, verifiable data handling&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;quantum-resistant-future-with-qcv&quot;&gt;Quantum-Resistant Future with QCV&lt;&#x2F;h3&gt;
&lt;p&gt;Verification providers MAY implement QCV for quantum-resistant encryption of sensitive verification data.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;SHOULD use AES-256-GCM or equivalent post-quantum encryption algorithm&lt;&#x2F;li&gt;
&lt;li&gt;MUST return unique record_id for encrypted data&lt;&#x2F;li&gt;
&lt;li&gt;MUST provide decryption_url for authorized data retrieval&lt;&#x2F;li&gt;
&lt;li&gt;SHOULD ensure quantum-resistant key exchange mechanisms&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;QCV Key Properties:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Provides future-proof protection against quantum computing threats&lt;&#x2F;li&gt;
&lt;li&gt;Military-grade encryption standards (AES-256-GCM)&lt;&#x2F;li&gt;
&lt;li&gt;Enables secure long-term storage of verification records&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;payment-protocol&quot;&gt;Payment Protocol&lt;&#x2F;h3&gt;
&lt;p&gt;Verification providers MAY charge fees for verification services. When fees are required:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;SHOULD use x402 protocol for micropayments&lt;&#x2F;li&gt;
&lt;li&gt;SHOULD support stablecoin settlement (e.g., USDC)&lt;&#x2F;li&gt;
&lt;li&gt;MUST clearly disclose fee structure before verification&lt;&#x2F;li&gt;
&lt;li&gt;SHOULD use &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3009&#x2F;&quot;&gt;EIP-3009&lt;&#x2F;a&gt; TransferWithAuthorization for gasless payments&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;risk-scoring&quot;&gt;Risk Scoring&lt;&#x2F;h3&gt;
&lt;p&gt;The overall risk score MUST be calculated as the average of all applicable verification scores:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Tier&lt;&#x2F;th&gt;&lt;th&gt;Score Range&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Low Risk&lt;&#x2F;td&gt;&lt;td&gt;0-20&lt;&#x2F;td&gt;&lt;td&gt;Minimal concerns identified&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Moderate&lt;&#x2F;td&gt;&lt;td&gt;21-40&lt;&#x2F;td&gt;&lt;td&gt;Some concerns, review recommended&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Elevated&lt;&#x2F;td&gt;&lt;td&gt;41-60&lt;&#x2F;td&gt;&lt;td&gt;Notable concerns, caution advised&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;High Risk&lt;&#x2F;td&gt;&lt;td&gt;61-80&lt;&#x2F;td&gt;&lt;td&gt;Significant concerns detected&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Critical&lt;&#x2F;td&gt;&lt;td&gt;81-100&lt;&#x2F;td&gt;&lt;td&gt;Severe concerns, avoid interaction&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;error-codes&quot;&gt;Error Codes&lt;&#x2F;h3&gt;
&lt;p&gt;Implementations MUST use the following standardised error codes:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Error Code&lt;&#x2F;th&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x01&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;InvalidAddress&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Provided address is not a valid Ethereum address&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x02&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;InvalidURL&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Provided URL is malformed or not HTTPS&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x03&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;AgentNotFound&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;No agent exists with the specified agentId&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x04&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;UnauthorizedAccess&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Caller is not walletAddress or registrantAddress&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x05&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;AlreadyRegistered&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Agent with this walletAddress already exists&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x06&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;VerificationFailed&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Verification provider returned an error&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x07&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;InsufficientCredits&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;No verification credits available&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x08&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;InvalidProof&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;PDV proof validation failed&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x09&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;ProviderUnavailable&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Verification provider is not responding&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x0A&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;InvalidScore&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Risk score outside valid range (0-100)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x0B&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;ContractNotFound&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Specified contract does not exist on chain&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x0C&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;StakingContractNotFound&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Specified staking contract does not exist&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Implementations SHOULD revert with these error codes:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;error InvalidAddress();&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;error InvalidURL();&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;error AgentNotFound();&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;error UnauthorizedAccess();&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;error AlreadyRegistered();&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;error VerificationFailed();&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;error InsufficientCredits();&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;error InvalidProof();&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;error ProviderUnavailable();&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;error InvalidScore();&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;error ContractNotFound();&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;error StakingContractNotFound();&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;interface&quot;&gt;Interface&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pragma solidity ^0.8.0;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;interface IERCXXXX {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @notice Emitted when a new agent is registered&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    event AgentRegistered(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bytes32 indexed agentId,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address indexed walletAddress,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address indexed registrantAddress,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        string name&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    );&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @notice Emitted when an agent completes verification&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    event AgentVerified(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bytes32 indexed agentId,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint8 overallRiskScore,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bytes32 etvProofId,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bytes32 scvProofId,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bytes32 wavProofId,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bytes32 wvProofId,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bytes32 summaryProofId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    );&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @notice Emitted when an agent&amp;#39;s details are updated&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    event AgentUpdated(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bytes32 indexed agentId,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address indexed updatedBy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    );&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @notice Emitted when verification credits are purchased&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    event CreditsPurchased(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bytes32 indexed agentId,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address indexed purchaser,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    );&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @notice Register a new AI agent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function registerAgent(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        string calldata name,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        string calldata description,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address walletAddress,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        string calldata url,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address contractAddress,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address stakingContractAddress,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 platformId,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 chainId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ) external returns (bytes32 agentId);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @notice Get agent verification status and scores&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function getAgentVerification(bytes32 agentId) external view returns (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bool isVerified,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint8 overallRiskScore,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint8 etvScore,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint8 scvScore,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint8 wavScore,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint8 wvScore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    );&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @notice Get agent proof details (restricted to wallet holder)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @dev MUST only return data if msg.sender is walletAddress or registrantAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function getAgentProofs(bytes32 agentId) external view returns (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bytes32 etvProofId,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        string memory etvProofUrl,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bytes32 scvProofId,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        string memory scvProofUrl,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bytes32 wavProofId,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        string memory wavProofUrl,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bytes32 wvProofId,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        string memory wvProofUrl,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bytes32 summaryProofId,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        string memory summaryProofUrl&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    );&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @notice Get basic agent information&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function getAgentInfo(bytes32 agentId) external view returns (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        string memory name,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        string memory description,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address walletAddress,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address registrantAddress,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        string memory url,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address contractAddress,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address stakingContractAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    );&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;required-standards-justification&quot;&gt;Required Standards Justification&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;EIP-155 (Replay Protection)&lt;&#x2F;strong&gt;: Agent registrations involve wallet signatures. Without chain ID inclusion (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt;), a registration signature on mainnet could be replayed on testnets or L2s, potentially creating conflicting agent records across chains.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;EIP-712 (Typed Data Signing)&lt;&#x2F;strong&gt;: Registration requires users to sign structured data. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; presents human-readable signing requests (e.g., &quot;Register Agent: MyBot at 0x...&quot;) rather than opaque hashes, preventing phishing attacks where users unknowingly sign malicious transactions.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;ERC-3009 (Transfer With Authorization)&lt;&#x2F;strong&gt;: Verification fees use x402 micropayments. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3009&#x2F;&quot;&gt;ERC-3009&lt;&#x2F;a&gt; enables gasless USDC transfers where the verification provider pays gas, improving UX by not requiring users to hold ETH for verification.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;ERC-191 (Signed Data Standard)&lt;&#x2F;strong&gt;: Wallet verification requires proving wallet ownership. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;191&#x2F;&quot;&gt;ERC-191&lt;&#x2F;a&gt; provides the standardised prefix for signed messages, ensuring compatibility across wallets and preventing signature malleability.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;four-verification-types&quot;&gt;Four Verification Types&lt;&#x2F;h3&gt;
&lt;p&gt;The four verification types are presented in alphabetical order (ETV → SCV → WAV → WV) for clarity and consistency.&lt;&#x2F;p&gt;
&lt;p&gt;The decision to implement four distinct verification types addresses different aspects of agent authenticity:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;ETV&lt;&#x2F;strong&gt; validates on-chain presence and contract legitimacy, ensuring the agent has a legitimate blockchain footprint&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;SCV&lt;&#x2F;strong&gt; validates staking contract security, ensuring agents with staking mechanisms have secure and auditable contracts&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;WAV&lt;&#x2F;strong&gt; ensures the agent&#x27;s web endpoint is accessible and secure, protecting users from phishing and vulnerable endpoints&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;WV&lt;&#x2F;strong&gt; confirms wallet legitimacy and checks against threat databases, preventing association with known malicious actors&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;off-chain-verification-1&quot;&gt;Off-chain Verification&lt;&#x2F;h3&gt;
&lt;p&gt;Verification is performed off-chain to:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Eliminate gas costs for verification operations&lt;&#x2F;li&gt;
&lt;li&gt;Enable complex verification logic that would be prohibitively expensive on-chain&lt;&#x2F;li&gt;
&lt;li&gt;Allow verification criteria to evolve without requiring contract upgrades&lt;&#x2F;li&gt;
&lt;li&gt;Enable multiple competing verification providers&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;provider-agnostic-design-1&quot;&gt;Provider Agnostic Design&lt;&#x2F;h3&gt;
&lt;p&gt;This standard intentionally separates the interface specification from implementation details. Any verification provider MAY implement compliant ETV, WV, WAV, SCV, PDV, and QCV services, enabling:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Competition among verification providers&lt;&#x2F;li&gt;
&lt;li&gt;Specialisation in different verification domains&lt;&#x2F;li&gt;
&lt;li&gt;Geographic and jurisdictional flexibility&lt;&#x2F;li&gt;
&lt;li&gt;Price competition benefiting users&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;privacy-first-architecture-with-pdv-1&quot;&gt;Privacy-First Architecture with PDV&lt;&#x2F;h3&gt;
&lt;p&gt;Verification results are processed through Private Data Verification (PDV) which generates Zero-Knowledge Proofs. This privacy-first approach:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Eliminates data breach risks - no stored data means nothing to compromise&lt;&#x2F;li&gt;
&lt;li&gt;Provides cryptographic proof of verification that third parties can validate&lt;&#x2F;li&gt;
&lt;li&gt;Ensures GDPR and privacy regulation compliance&lt;&#x2F;li&gt;
&lt;li&gt;Builds user trust through transparent, verifiable data handling&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;quantum-resistant-future-with-qcv-1&quot;&gt;Quantum-Resistant Future with QCV&lt;&#x2F;h3&gt;
&lt;p&gt;Verification providers MAY implement QCV for quantum-resistant encryption of sensitive verification data.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;SHOULD use AES-256-GCM or equivalent post-quantum encryption algorithm&lt;&#x2F;li&gt;
&lt;li&gt;MUST return unique record_id for encrypted data&lt;&#x2F;li&gt;
&lt;li&gt;MUST provide decryption_url for authorized data retrieval&lt;&#x2F;li&gt;
&lt;li&gt;SHOULD ensure quantum-resistant key exchange mechanisms&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;QCV Key Properties:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Provides future-proof protection against quantum computing threats&lt;&#x2F;li&gt;
&lt;li&gt;Military-grade encryption standards (AES-256-GCM)&lt;&#x2F;li&gt;
&lt;li&gt;Enables secure long-term storage of verification records&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;owasp-alignment&quot;&gt;OWASP Alignment&lt;&#x2F;h3&gt;
&lt;p&gt;This standard recommends alignment with OWASP (Open Web Application Security Project) guidelines:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;WAV&lt;&#x2F;strong&gt; SHOULD follow OWASP Web Security Testing Guide (WSTG) for endpoint security assessment&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;ETV&#x2F;SCV&lt;&#x2F;strong&gt; SHOULD follow OWASP Smart Contract Security Verification Standard (SCSVS)&lt;&#x2F;li&gt;
&lt;li&gt;Verification providers SHOULD check for OWASP Top 10 vulnerabilities in web applications&lt;&#x2F;li&gt;
&lt;li&gt;Verification providers SHOULD check for Smart Contract Top 10 vulnerabilities in contracts&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;OWASP alignment ensures verification follows industry-recognised security standards.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;registration-fields&quot;&gt;Registration Fields&lt;&#x2F;h3&gt;
&lt;p&gt;The required fields (name, description, walletAddress, url) represent the minimum information needed to identify and interact with an AI agent. Optional fields (contractAddress, stakingContractAddress, platformId, chainId) allow for richer on-chain verification without imposing unnecessary requirements.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;risk-scoring-approach&quot;&gt;Risk Scoring Approach&lt;&#x2F;h3&gt;
&lt;p&gt;A unified 0-100 risk scoring system allows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Easy comparison between agents&lt;&#x2F;li&gt;
&lt;li&gt;Clear risk tier categorisation&lt;&#x2F;li&gt;
&lt;li&gt;Weighted average calculation for overall assessment&lt;&#x2F;li&gt;
&lt;li&gt;Actionable guidance based on score ranges&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC introduces a new standard and does not modify any existing standards. Existing AI agents can register with this standard without any modifications to their current implementations. It is designed to work alongside existing token standards (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt;) and identity standards.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;registration-tests&quot;&gt;Registration Tests&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;Test: Successful Registration&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; Pseudocode&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function testSuccessfulRegistration() {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytes32 agentId = registry.registerAgent(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;MyAIAgent&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;A helpful assistant&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        0x1234...5678,           &#x2F;&#x2F; walletAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;https:&#x2F;&#x2F;myagent.ai&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address(0),              &#x2F;&#x2F; no contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address(0),              &#x2F;&#x2F; no staking contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        0,                       &#x2F;&#x2F; platformId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        1                        &#x2F;&#x2F; chainId (mainnet)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    );&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    assert(agentId != bytes32(0));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    assert(registry.getAgentInfo(agentId).name == &amp;quot;MyAIAgent&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Test: Invalid URL Rejection&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; Pseudocode&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function testInvalidURLRejection() {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; Should revert with InvalidURL error&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    expectRevert(InvalidURL.selector);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    registry.registerAgent(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;MyAIAgent&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;Description&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        0x1234...5678,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;http:&#x2F;&#x2F;insecure.com&amp;quot;,   &#x2F;&#x2F; HTTP not HTTPS - MUST fail&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address(0),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address(0),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        0,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    );&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Test: Duplicate Registration Rejection&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; Pseudocode&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function testDuplicateRejection() {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    registry.registerAgent(&amp;quot;Agent1&amp;quot;, &amp;quot;Desc&amp;quot;, 0x1234, &amp;quot;https:&#x2F;&#x2F;a.com&amp;quot;, ...);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; Same walletAddress - MUST revert&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    expectRevert(AlreadyRegistered.selector);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    registry.registerAgent(&amp;quot;Agent2&amp;quot;, &amp;quot;Desc&amp;quot;, 0x1234, &amp;quot;https:&#x2F;&#x2F;b.com&amp;quot;, ...);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;verification-tests&quot;&gt;Verification Tests&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;MUST complete ETV when contractAddress is provided&lt;&#x2F;li&gt;
&lt;li&gt;MUST complete WV for all registered agents&lt;&#x2F;li&gt;
&lt;li&gt;MUST complete WAV for all registered agents&lt;&#x2F;li&gt;
&lt;li&gt;MUST complete SCV when stakingContractAddress is provided&lt;&#x2F;li&gt;
&lt;li&gt;MUST generate PDV proof for each verification type&lt;&#x2F;li&gt;
&lt;li&gt;MUST calculate overallRiskScore as average of applicable scores&lt;&#x2F;li&gt;
&lt;li&gt;MUST emit AgentVerified event with all proof IDs&lt;&#x2F;li&gt;
&lt;li&gt;MUST revert with &lt;code&gt;VerificationFailed&lt;&#x2F;code&gt; on provider error&lt;&#x2F;li&gt;
&lt;li&gt;MUST revert with &lt;code&gt;InsufficientCredits&lt;&#x2F;code&gt; when no credits available&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;access-control-tests&quot;&gt;Access Control Tests&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;Test: Unauthorized Proof Access&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; Pseudocode&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function testUnauthorizedProofAccess() {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytes32 agentId = registry.registerAgent(...);  &#x2F;&#x2F; registered by 0xAAAA&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; Caller is 0xBBBB (not owner or registrant)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    vm.prank(0xBBBB);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    expectRevert(UnauthorizedAccess.selector);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    registry.getAgentProofs(agentId);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;MUST allow only walletAddress or registrantAddress to view proof URLs&lt;&#x2F;li&gt;
&lt;li&gt;MUST allow only walletAddress or registrantAddress to edit agent details&lt;&#x2F;li&gt;
&lt;li&gt;MUST allow anyone to view public agent information (excluding proofs)&lt;&#x2F;li&gt;
&lt;li&gt;MUST revert with &lt;code&gt;UnauthorizedAccess&lt;&#x2F;code&gt; for unauthorized proof access&lt;&#x2F;li&gt;
&lt;li&gt;MUST revert with &lt;code&gt;AgentNotFound&lt;&#x2F;code&gt; for non-existent agentId&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;risk-score-tests&quot;&gt;Risk Score Tests&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;MUST return score 0-20 for Low Risk tier&lt;&#x2F;li&gt;
&lt;li&gt;MUST return score 21-40 for Moderate tier&lt;&#x2F;li&gt;
&lt;li&gt;MUST return score 41-60 for Elevated tier&lt;&#x2F;li&gt;
&lt;li&gt;MUST return score 61-80 for High Risk tier&lt;&#x2F;li&gt;
&lt;li&gt;MUST return score 81-100 for Critical tier&lt;&#x2F;li&gt;
&lt;li&gt;MUST revert with &lt;code&gt;InvalidScore&lt;&#x2F;code&gt; for scores outside 0-100&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The reference implementation will demonstrate:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Agent self-registration with EIP-712 typed signing&lt;&#x2F;li&gt;
&lt;li&gt;Four verification types (ETV, WV, WAV, SCV)&lt;&#x2F;li&gt;
&lt;li&gt;PDV integration for Zero-Knowledge Proof generation&lt;&#x2F;li&gt;
&lt;li&gt;x402 micropayment integration with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3009&#x2F;&quot;&gt;EIP-3009&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Risk scoring with five-tier classification&lt;&#x2F;li&gt;
&lt;li&gt;Wallet-holder restricted proof access&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;verification-trust&quot;&gt;Verification Trust&lt;&#x2F;h3&gt;
&lt;p&gt;Users MUST understand that verification through this standard indicates the agent has passed specific technical checks at a point in time, but does not guarantee the agent&#x27;s future behaviour or intentions. Risk scores provide guidance but users should exercise their own judgment.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;wallet-security&quot;&gt;Wallet Security&lt;&#x2F;h3&gt;
&lt;p&gt;Agents MUST secure their registered wallet addresses. Compromise of a wallet could allow an attacker to impersonate a legitimate agent. Re-verification is available to update risk scores.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;url-hijacking&quot;&gt;URL Hijacking&lt;&#x2F;h3&gt;
&lt;p&gt;If an agent&#x27;s URL is compromised after registration, the attacker could serve malicious content. Users SHOULD verify the current status of agents before interacting. WAV re-verification can detect compromised endpoints.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;smart-contract-risks&quot;&gt;Smart Contract Risks&lt;&#x2F;h3&gt;
&lt;p&gt;For agents with registered contract addresses, standard smart contract security considerations apply. ETV and SCV provide initial verification but users SHOULD audit any contracts they interact with.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;staking-contract-risks&quot;&gt;Staking Contract Risks&lt;&#x2F;h3&gt;
&lt;p&gt;Staking contracts present additional risks including locked funds, reward manipulation, and governance attacks. SCV verification checks common vulnerabilities but users SHOULD perform due diligence before staking with any agent.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;zero-knowledge-proof-security&quot;&gt;Zero-Knowledge Proof Security&lt;&#x2F;h3&gt;
&lt;p&gt;PDV implementations SHOULD use established ZKP systems with proven security properties:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Circuit Soundness&lt;&#x2F;strong&gt;: Implementations SHOULD use audited circuits (e.g., Groth16, PLONK) with formal security proofs&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Trusted Setup&lt;&#x2F;strong&gt;: Systems requiring trusted setup (e.g., Groth16) MUST use multi-party computation ceremonies to minimize trust assumptions&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Proof Verification&lt;&#x2F;strong&gt;: On-chain proof verification MUST use battle-tested verifier contracts&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Quantum Considerations&lt;&#x2F;strong&gt;: Current ZKP systems (based on elliptic curves) may be vulnerable to future quantum attacks. High-value, long-term proofs SHOULD consider QCV encryption as an additional layer&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;quantum-computing-threats&quot;&gt;Quantum Computing Threats&lt;&#x2F;h3&gt;
&lt;p&gt;Current cryptographic primitives face potential threats from quantum computing:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;ECDSA Signatures&lt;&#x2F;strong&gt;: Vulnerable to Shor&#x27;s algorithm on sufficiently powerful quantum computers&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;ZKP Schemes&lt;&#x2F;strong&gt;: Elliptic curve-based ZKPs (Groth16, PLONK) share quantum vulnerability&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Mitigation&lt;&#x2F;strong&gt;: QCV provides AES-256-GCM encryption which remains quantum-resistant for symmetric operations. Implementations concerned with long-term security SHOULD use QCV for sensitive verification data&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;provider-trust&quot;&gt;Provider Trust&lt;&#x2F;h3&gt;
&lt;p&gt;Users MUST evaluate their trust in chosen verification providers. Different providers may have varying levels of thoroughness, independence, and reliability. Zero-Knowledge Proofs generated by PDV provide verifiable evidence of verification completion that can be independently validated.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;attack-vectors&quot;&gt;Attack Vectors&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Sybil Attacks&lt;&#x2F;strong&gt;: Malicious actors could register many agents. Mitigated by registration fees.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Front-Running&lt;&#x2F;strong&gt;: Registration transactions could be front-run. Consider commit-reveal schemes for sensitive registrations.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Provider Collusion&lt;&#x2F;strong&gt;: Verification providers could collude with malicious agents. Users SHOULD consider using multiple independent providers for high-stakes interactions.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>ERC-721 Verifiable Credential Extension</title>
        <published>2025-01-14T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Valerio Massimo Camaiani</name><uri>https://github.com/vmc-crossmint</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7861/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-721-verifiable-credential-extension/22562" />
        

        <id>https://wg-eips.ritovision.com/7861/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7861"
            label="ERC-7861" />
        

        
        

        
        <summary type="html">An extension to ERC-721 that adds collection-wide verifiable credential properties, this allows native support for onchain credentials.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7861/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is an extension of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; that adds verifiable credential properties at the contract level. A verifiable credential is a secure digital certificate that encapsulates claims issued by a trusted authority and is designed to be tamper-evident and readily verifiable. It allows &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; tokens to natively reference and manage these credentials—as well as other types of off-chain data—by defining mechanisms for storage, encryption, revocation, and verification.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Many &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; contracts require additional properties to represent verifiable credentials. While it&#x27;s possible to implement these properties in various ways, it creates an extra effort for third-party platforms to build individualized solutions for each NFT collection.&lt;&#x2F;p&gt;
&lt;p&gt;Having a standard for verifiable credential properties will make it easier for third-party platforms to interact with and validate NFTs that represent verifiable credentials onchain.&lt;&#x2F;p&gt;
&lt;p&gt;Just as NFTs represent digital ownership, verifiable credentials (VCs) represent digital attestations about oneself (identity, education, and more). Blockchains provide an ideal solution for storing VCs and associated claims, offering precise access control, issuer legitimacy, and full lifecycle management for credentials, all while maintaining transparency to safeguard user rights.&lt;&#x2F;p&gt;
&lt;p&gt;This standard addresses key gaps in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.w3.org&#x2F;TR&#x2F;2025&#x2F;PR-vc-data-model-2.0-20250320&#x2F;&quot;&gt;W3C framework&lt;&#x2F;a&gt; by defining methods for storage, revocation, retrieval, and presentation, facilitating interoperability within a flexible, standardized structure. It supports custom cryptographic methods for signatures and proofs—from basic issuer signatures to advanced zero-knowledge (ZK) proofs and selective disclosure—allowing adaptability for diverse security requirements.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, the standard natively supports encryption, crucial for managing sensitive data. It also provides flexibility in credential storage, referencing off-chain data via &lt;code&gt;credentialURI()&lt;&#x2F;code&gt; to accommodate any storage solution, from decentralized storage (like IPFS) to centralized systems.&lt;&#x2F;p&gt;
&lt;p&gt;Originally designed with W3C credentials in mind, this standard is broad enough to support any kind of credential, for example content credentials. More generally this framework can be used to link any off-chain, private payload to an NFT.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;standardized-credential-management&quot;&gt;Standardized Credential Management&lt;&#x2F;h3&gt;
&lt;p&gt;This extension aims to provide a standardized way to represent verifiable credentials within the ERC-721 framework. The collection-wide properties (&lt;code&gt;issuer&lt;&#x2F;code&gt; and &lt;code&gt;type&lt;&#x2F;code&gt;) allow for efficient management of credentials where these properties are shared across all tokens in the collection.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;credentialURI&lt;&#x2F;code&gt; function is included to provide a way to retrieve additional off-chain information about individual credentials, similar to the &lt;code&gt;tokenURI&lt;&#x2F;code&gt; function in ERC-721.&lt;&#x2F;p&gt;
&lt;p&gt;By emitting &lt;code&gt;CredentialIssued&lt;&#x2F;code&gt; and &lt;code&gt;CredentialRevoked&lt;&#x2F;code&gt; events, third-party applications and services can track the lifecycle of credentials, enabling real-time monitoring.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;overview&quot;&gt;Overview&lt;&#x2F;h3&gt;
&lt;p&gt;Each NFT in this standard is linked to a credential that can be stored in any compatible storage location. To retrieve credentials for a specific user, is sufficient to get the desired credential NFT in their wallet, and the &lt;code&gt;credentialURI()&lt;&#x2F;code&gt; function can provide the exact location of each credential. This URI may point to public storage like IPFS or any custom storage solution with flexible access control, potentially subject to user approval.&lt;&#x2F;p&gt;
&lt;p&gt;Upon retrieval, credentials may be stored in clear text or in encrypted form. The &lt;code&gt;encryptionMethod()&lt;&#x2F;code&gt; property indicates the encryption status, allowing the verifier to know in advance if decryption is required. Decryption may involve user consent if the user&#x27;s wallet signature is required. Additional steps can be added in cases where advanced algorithms enable selective disclosure or zero-knowledge (ZK) proofs to enhance privacy.&lt;&#x2F;p&gt;
&lt;p&gt;Once decrypted, the credential&#x27;s authenticity and integrity can be verified using the &lt;code&gt;verificationMethod()&lt;&#x2F;code&gt;, ensuring it remains untampered. For ZK proofs, specific queries can also be verified without disclosing the entire credential. The standard also accounts for credential revocation, which can be implemented in various ways: via burning the associated NFT, an additional structure in the contract or even an off-chain revocation list; in the first case, checking that the NFT is unburned confirms the credential&#x27;s validity.&lt;&#x2F;p&gt;
&lt;p&gt;While originally intended for verifiable credentials, this standard&#x27;s flexibility allows it to link any private or external data payload to a user&#x27;s wallet through an NFT, expanding its utility across various data-reference use cases.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;interface&quot;&gt;Interface&lt;&#x2F;h3&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-721 Verifiable Credential Extension&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7861&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC165&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC721&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a new credential is issued&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token ID of the issued credential&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to which the credential was issued&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CredentialIssued&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a credential is revoked&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token ID of the revoked credential&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CredentialRevoked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the issuer of the credential collection&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The empty string indicates that there is no issuer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; issuer DID or address for this credential collection &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; issuer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the type of the credentials in the collection&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; credential type for this collection&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; credentialType&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the encryption method of the credentials in the collection&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; encryption method for this collection, will return empty string if not encrypted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; encryptionMethod&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the verification method of the credentials in the collection&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; verification method for this collection&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verificationMethod&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the URI for a given credential&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws if `tokenId` is not a valid NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT to get the credential URI for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; credential URI for the given NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; credentialURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check if a credential has been revoked &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The credential ID to check &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; false&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if the credential has not been revoked&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isRevoked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;issuer()&lt;&#x2F;code&gt;, &lt;code&gt;credentialType()&lt;&#x2F;code&gt;, &lt;code&gt;encryptionMethod()&lt;&#x2F;code&gt;, &lt;code&gt;verificationMethod()&lt;&#x2F;code&gt; and &lt;code&gt;credentialURI(uint256 tokenId)&lt;&#x2F;code&gt; functions MUST be implemented as view functions.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;encryptionMethod()&lt;&#x2F;code&gt; function MUST return an empty string if and only if the credential is unencrypted. In case of encrypted credentials the method SHOULD return only the encryption method; Any additional encryption details required for decryption MAY be retrieved separately (a separate function or via the contract metadata).&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;verificationMethod()&lt;&#x2F;code&gt; function MUST return the method to verify the credential proof, the response is up to the implementer but SHOULD be compatible with the W3C &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.w3.org&#x2F;TR&#x2F;2025&#x2F;PR-vc-data-integrity-20250320&#x2F;#dfn-verification-method&quot;&gt;verification method&lt;&#x2F;a&gt; concept.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;credentialURI(uint256 tokenId)&lt;&#x2F;code&gt; function MAY be used to retrieve the credential location. In case a given implementation uses a different method to retrieve the credential, &lt;code&gt;credentialURI(uint256 tokenId)&lt;&#x2F;code&gt; MUST return an empty string.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; method MUST return true when called with &lt;code&gt;0x7861069&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;isRevoked(uint256 tokenId)&lt;&#x2F;code&gt; MUST return false if the credential has not been revoked, and MUST return true if the credential has been revoked. MAY return true if the credential does not exist.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;CredentialIssued&lt;&#x2F;code&gt; and &lt;code&gt;CredentialRevoked&lt;&#x2F;code&gt; events MAY be emitted, when the corresponding operations are performed, to allow off-chain systems to monitor credential status efficiently. Credential revocation is not mandated, but MAY be implemented via burning the associated NFT.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;!-- TODO --&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is compatible with current &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; standards. It adds new functions without modifying the existing &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; functionality.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC721&#x2F;ERC721.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERC7861.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC7861&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC7861&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; immutable&lt;&#x2F;span&gt;&lt;span&gt; _issuer&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; immutable&lt;&#x2F;span&gt;&lt;span&gt; _credentialType&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; immutable&lt;&#x2F;span&gt;&lt;span&gt; _verificationMethod&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; immutable&lt;&#x2F;span&gt;&lt;span&gt; _encryptionMethod&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CredentialIssued&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CredentialRevoked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; symbol_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; issuer_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; credentialType_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; verificationMethod_&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;name_, symbol_) &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;issuer_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC7861: issuer cannot be empty&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;credentialType_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC7861: credential type cannot be empty&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _issuer &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; issuer_&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _credentialType &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; credentialType_&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _verificationMethod &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; verificationMethod_&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _encryptionMethod &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;lit-protocol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Example decentralized encryption&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; issuer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _issuer&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; credentialType&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _credentialType&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; encryptionMethod&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _encryptionMethod&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verificationMethod&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _verificationMethod&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; credentialURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_exists&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC7861: URI query for nonexistent token&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Implementation depends on how you want to store&#x2F;generate URIs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isRevoked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Implementation depends on revokation system, example for revokation on burning&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_exists&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See {IERC165-supportsInterface}.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC165&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes4&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x74699c4e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Issues a new credential to an address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to issue the credential to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token ID of the credential&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; issueCredential&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Implement access control as needed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CredentialIssued&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Revokes an existing credential&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token ID of the credential to revoke&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revokeCredential&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Implement access control as needed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_exists&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC7861: Cannot revoke nonexistent credential&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _burn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CredentialRevoked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Implementers of the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7861&#x2F;&quot;&gt;ERC-7861&lt;&#x2F;a&gt; standard must enforce strict access control to ensure only authorized parties can issue or revoke credentials. Implementers must also carefully consider access control for setting credential properties, protecting the integrity of the collection&#x27;s credential information.&lt;&#x2F;p&gt;
&lt;p&gt;Credentials should be non-transferable to maintain authenticity and prevent unauthorized transfers. Override transfer functions to enforce this if needed.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;credentialURI&lt;&#x2F;code&gt; should not contain sensitive information, as it is publicly accessible. Sensitive data should be encrypted and stored off-chain, with the &lt;code&gt;credentialURI&lt;&#x2F;code&gt; pointing to the location of this encrypted data; encryption is essential for any sensitive data stored on public storage solutions like IPFS.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Parameterized Storage Keys</title>
        <published>2025-01-06T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Prem Makeig</name><uri>https://github.com/nxt3d</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8119/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-8119-key-parameters-standard-format-for-parameterized-string-keys/27397" />
        

        <id>https://wg-eips.ritovision.com/8119/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:8119"
            label="ERC-8119" />
        

        
        

        
        <summary type="html">A format for parameterized string keys used in EVM key-value storage.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8119/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC defines a standard format for parameterized string keys used in EVM key-value storage using a forward slash (&lt;code&gt;&#x2F;&lt;&#x2F;code&gt;) separator between the key label and its parameter.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Many EVM-based smart contracts use key-value storage to store metadata where string keys may need to represent multiple instances or variations of the same metadata type. Without a standardized format for parameterized keys, different implementations use inconsistent formats, leading to interoperability issues and parsing difficulties.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;key-format&quot;&gt;Key Format&lt;&#x2F;h3&gt;
&lt;p&gt;String keys used in EVM key-value storage MAY include parameters to represent variations or instances of a metadata type. When keys include parameters, they MUST follow the format:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;key-label&amp;gt;&#x2F;&amp;lt;key-parameter&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;&amp;lt;key-label&amp;gt;&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: MUST contain only printable ASCII characters &lt;strong&gt;except&lt;&#x2F;strong&gt; space and the forward slash character. Concretely, allowed code points are &lt;code&gt;0x21-0x2E&lt;&#x2F;code&gt; and &lt;code&gt;0x30-0x7E&lt;&#x2F;code&gt; (letters, digits, and common punctuation), explicitly excluding control characters (&lt;code&gt;0x00-0x1F&lt;&#x2F;code&gt;), space (&lt;code&gt;0x20&lt;&#x2F;code&gt;), the slash character (&lt;code&gt;0x2F&lt;&#x2F;code&gt;), and DEL (&lt;code&gt;0x7F&lt;&#x2F;code&gt;). The key-label identifies the type or category of metadata.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;&amp;lt;key-parameter&amp;gt;&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: MAY be any UTF-8 encoded string. The parameter value represents a specific instance or variation of the metadata type.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Examples:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;&quot;registration&#x2F;1&quot;&lt;&#x2F;code&gt; - ASCII key-label with numeric parameter&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;&quot;user&#x2F;alice&quot;&lt;&#x2F;code&gt; - ASCII key-label with ASCII parameter&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;&quot;name&#x2F;María&quot;&lt;&#x2F;code&gt; - ASCII key-label with UTF-8 parameter (Spanish)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;&quot;description&#x2F;说明&quot;&lt;&#x2F;code&gt; - ASCII key-label with UTF-8 parameter (Chinese)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;&quot;title&#x2F;タイトル&quot;&lt;&#x2F;code&gt; - ASCII key-label with UTF-8 parameter (Japanese)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;&quot;label&#x2F;Étiquette&quot;&lt;&#x2F;code&gt; - ASCII key-label with UTF-8 parameter (French with accent)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;&quot;%gain&#x2F;50&quot;&lt;&#x2F;code&gt; - Key-label with special character (percent)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;&quot;$price&#x2F;100&quot;&lt;&#x2F;code&gt; - Key-label with special character (dollar sign)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;&quot;#tag&#x2F;featured&quot;&lt;&#x2F;code&gt; - Key-label with special character (hash)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Invalid formats:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;&quot;registration-1&quot;&lt;&#x2F;code&gt; (hyphen separator)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;&quot;registration:1&quot;&lt;&#x2F;code&gt; (colon separator)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;&quot;registration1&quot;&lt;&#x2F;code&gt; (no separator)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;&quot;key label&#x2F;value&quot;&lt;&#x2F;code&gt; (space in key-label)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This format provides a clean, consistent way to represent parameterized keys while maintaining readability and compatibility with parsers that support the slash (&lt;code&gt;&#x2F;&lt;&#x2F;code&gt;) separator format.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;format-specification&quot;&gt;Format Specification&lt;&#x2F;h3&gt;
&lt;p&gt;For string keys used in EVM key-value storage (e.g., &lt;code&gt;mapping(string =&amp;gt; bytes)&lt;&#x2F;code&gt; in Solidity, hash maps in Vyper, or equivalent structures in other EVM-compatible languages):&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The &lt;code&gt;&amp;lt;key-label&amp;gt;&lt;&#x2F;code&gt; MUST contain only printable ASCII characters (0x21-0x7E), excluding spaces and the forward slash character (&lt;code&gt;&#x2F;&lt;&#x2F;code&gt;). This excludes control characters, space, &lt;code&gt;&#x2F;&lt;&#x2F;code&gt;, and DEL.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;&amp;lt;key-label&amp;gt;&lt;&#x2F;code&gt; and &lt;code&gt;&amp;lt;key-parameter&amp;gt;&lt;&#x2F;code&gt; MUST be separated by a single forward slash (&lt;code&gt;&#x2F;&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;&amp;lt;key-parameter&amp;gt;&lt;&#x2F;code&gt; MAY be any UTF-8 encoded string, including strings that contain &lt;code&gt;&#x2F;&lt;&#x2F;code&gt;. Parsing uses the first occurrence of &lt;code&gt;&#x2F;&lt;&#x2F;code&gt; as the separator; all subsequent characters belong to the parameter.&lt;&#x2F;li&gt;
&lt;li&gt;This ERC specifies &lt;strong&gt;exactly one&lt;&#x2F;strong&gt; parameter per key. If an application needs additional sub-parameters, it MAY encode them inside the single parameter value using any application-defined encoding (for example, a space-separated list).&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The forward slash (&lt;code&gt;&#x2F;&lt;&#x2F;code&gt;) separator was chosen because:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;It provides a clear, unambiguous separator that is easy to parse programmatically&lt;&#x2F;li&gt;
&lt;li&gt;It is visually concise while still being readable compared to formats like &lt;code&gt;key:value&lt;&#x2F;code&gt; or &lt;code&gt;key-value&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC is fully backwards compatible. Existing implementations that do not use parameterized keys are unaffected. Implementations using non-standard parameter formats may continue to work but are encouraged to migrate to this standard format for better interoperability.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;valid-key-formats&quot;&gt;Valid Key Formats&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;&quot;name&quot;&lt;&#x2F;code&gt; - Simple key without parameters&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;&quot;registration&#x2F;1&quot;&lt;&#x2F;code&gt; - Key with numeric parameter&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;&quot;registration&#x2F;2&quot;&lt;&#x2F;code&gt; - Key with numeric parameter&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;&quot;user&#x2F;alice&quot;&lt;&#x2F;code&gt; - Key with ASCII string parameter&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;&quot;session&#x2F;abc123&quot;&lt;&#x2F;code&gt; - Key with alphanumeric parameter&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;&quot;name&#x2F;María&quot;&lt;&#x2F;code&gt; - Key with UTF-8 parameter (Spanish)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;&quot;description&#x2F;说明&quot;&lt;&#x2F;code&gt; - Key with UTF-8 parameter (Chinese)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;&quot;title&#x2F;タイトル&quot;&lt;&#x2F;code&gt; - Key with UTF-8 parameter (Japanese)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;&quot;label&#x2F;Étiquette&quot;&lt;&#x2F;code&gt; - Key with UTF-8 parameter (French with accent)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;&quot;key&#x2F;value:with:colons&quot;&lt;&#x2F;code&gt; - Key with parameter containing colons&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;&quot;key&#x2F;one1 two2 three3&quot;&lt;&#x2F;code&gt; - Key whose single parameter can be interpreted by an application as a list&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;&quot;key&#x2F;value&#x2F;with&#x2F;slashes&quot;&lt;&#x2F;code&gt; - Key with parameter containing additional &lt;code&gt;&#x2F;&lt;&#x2F;code&gt; (parsed at first &lt;code&gt;&#x2F;&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;&quot;excerpt&#x2F;Dan said \&quot;hi: how are you?\&quot;&quot;&lt;&#x2F;code&gt; - Key with quoted speech containing &lt;code&gt;: &lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;invalid-key-formats&quot;&gt;Invalid Key Formats&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;&quot;registration-1&quot;&lt;&#x2F;code&gt; - Uses hyphen instead of slash&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;&quot;registration:1&quot;&lt;&#x2F;code&gt; - Uses colon instead of slash&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;&quot;registration1&quot;&lt;&#x2F;code&gt; - No separator&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;&quot;key label&#x2F;value&quot;&lt;&#x2F;code&gt; - Space in key-label (key-label must be ASCII with no spaces)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The following is a Solidity reference implementation. This standard applies to all EVM-compatible languages (Solidity, Vyper, etc.) that support string-keyed storage.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.25&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Strings&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;utils&#x2F;Strings.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; KeyParametersExample&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _metadata&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Save three values&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        setMetadata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;registration&#x2F;1&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;example1&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        setMetadata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;registration&#x2F;2&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;example2&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        setMetadata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;registration&#x2F;3&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;example3&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Read them all back&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; key &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;registration&#x2F;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Strings&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;toString&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; value &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getMetadata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setMetadata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _metadata&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;key&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getMetadata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _metadata&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;key&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;User-facing input&lt;&#x2F;strong&gt;: When keys are derived from user input, clients SHOULD validate &lt;code&gt;&amp;lt;key-label&amp;gt;&lt;&#x2F;code&gt; against the allowed ASCII range and reject labels containing spaces or &lt;code&gt;&#x2F;&lt;&#x2F;code&gt; to avoid ambiguous or non-standard keys.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Ethereum Network Configuration for DApps</title>
        <published>2025-01-03T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Bogdan Gusiev</name><uri>https://github.com/bogdan</uri>
	</author>
	
	<author>
		<name>Sergey Bomko</name><uri>https://github.com/aquiladev</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7876/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7876-unified-network-configuration/22763" />
        

        <id>https://wg-eips.ritovision.com/7876/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7876"
            label="ERC-7876" />
        

        
        

        
        <summary type="html">EVM-compatible network configuration specification for DApps supporting any custom network features through extensions.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7876/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard defines a universal format for specifying network configurations to decentralized applications (DApps). The configuration includes essential information about Ethereum networks, such as available RPC URLs, native currencies, contract addresses, and block explorers. Configurations are intended to be provided by:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Network maintainers to make sure their network is supported by DApps.&lt;&#x2F;li&gt;
&lt;li&gt;Smart contract developers to ensure the smart contracts are properly integrated into DApps and changes are consistently delivered.&lt;&#x2F;li&gt;
&lt;li&gt;DApp developers internally in the organization to make use of software libraries designed around the standard and maintain consistent configuration across multiple platforms (e.g., iOS, Android).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Given that different EVM-compatible chains introduce unique features, this standard also supports extensibility, allowing networks to specify additional configuration parameters beyond the base requirements. This flexibility prevents networks from resorting to external storage for their unique configurations, preserving the goal of a unified and comprehensive network configuration standard.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, decentralized applications (DApps) support numerous EVM-compatible networks and often define network configurations in inconsistent formats, which complicates interoperability and sharing of configurations. This standard introduces a &lt;strong&gt;unified network configuration&lt;&#x2F;strong&gt; format that can be adopted by EVM-based networks, making it easier for developers to integrate with multiple networks and providing consistent configuration management.&lt;&#x2F;p&gt;
&lt;p&gt;The proposed configuration format includes essential details required by DApps, including:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Network name and ID&lt;&#x2F;li&gt;
&lt;li&gt;RPC URL for Ethereum nodes&lt;&#x2F;li&gt;
&lt;li&gt;Native currency details&lt;&#x2F;li&gt;
&lt;li&gt;Smart contract addresses&lt;&#x2F;li&gt;
&lt;li&gt;Available block explorers and NFT marketplaces&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The goal of this standard is to simplify network configuration for DApp developers and enhance interoperability across Ethereum-compatible networks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;The configuration &lt;strong&gt;MUST&lt;&#x2F;strong&gt; use a JSON object, which DApp developers can use to define multiple Ethereum networks.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;interface-definition&quot;&gt;Interface definition&lt;&#x2F;h3&gt;
&lt;p&gt;The specification interface is provided in the TypeScript type definition format, which is widely used to define JSON file formats for Ethereum DApps.
Refer to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7876&#x2F;#example-configuration&quot;&gt;Example Configuration&lt;&#x2F;a&gt; for an illustrative implementation of this standard.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * Represents the configuration for a smart contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;typedef&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ContractConfig&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;property&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address - The address of the contract on the Ethereum network. **MUST** use a checksum.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;property&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; abiUrl - URL to contract ABI file, can be relative to `abiRoot` if specified or absolute. The absence of the key or `null` value indicates that the ABI of the contract is unknown. URL content **MUST** use Contract ABI specification JSON format.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;property&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; blockCreated - The block number in which the contract was deployed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;see&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; https:&#x2F;&#x2F;docs.soliditylang.org&#x2F;en&#x2F;latest&#x2F;abi-spec.html#json&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;see&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; .&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;00055.md&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;see&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; https:&#x2F;&#x2F;url.spec.whatwg.org&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ContractConfig&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  abiUrl&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; null&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  blockCreated&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; number&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * Represents a list of contract names. No standard contracts are defined.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * The list may vary from one DApp to another for the same network.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;typedef&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ContractName&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ContractName&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * Represents the configuration for block explorers in the network configuration.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * The URLs for address, transaction, and NFT lookups are **relative** to the `root` URL.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * URLs **MUST** be relative to the `root` URL.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * URLs **MUST** include special parameters, like `:block`, `:address`, `:tx`, `:token` for relevant properties (see examples).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;typedef&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ExplorerConfig&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;property&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; root - The root URL of the block explorer (e.g., `https:&#x2F;&#x2F;freescan.example.com`).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;property&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; block - The relative URL path for viewing a specific block (e.g., `&#x2F;block&#x2F;:block`). If not available, this can be `null`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;property&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address - The relative URL path for viewing a specific address (e.g., `&#x2F;address&#x2F;:address`). If not available, this can be `null`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;property&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; tx - The relative URL path for viewing a transaction (e.g., `&#x2F;tx&#x2F;:tx`). If not available, this can be `null`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;property&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; nft - The relative URL path for viewing a specific NFT (e.g., `&#x2F;nft&#x2F;:address&#x2F;:token`). If not available, this can be `null`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ExplorerConfig&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; null&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; null&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  nft&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; null&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  block&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; null&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * Represents RPC node endpoints available in the network.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;typedef&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RpcConfig&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;property&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; url - The URL under which the RPC is available (e.g. `https:&#x2F;&#x2F;public-node.example.com&#x2F;rpc`).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RpcConfig&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  url&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * Represents relation of the network to other networks.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * e.g. a network is a testnet of a mainnet, a network is Layer 2 above some other network,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * a network has a bridge to another network, etc.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;typedef&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RelationsConfig&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;property&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; mainnetChainId - Chain ID of the recommended mainnet network if current network is a testnet. MUST be `null` for mainnet.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;property&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; parentChainId - Chain ID of a network that current network is built on top of (e.g. if current network is L2, it will be L1 chain id)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RelationsConfig&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  mainnetChainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; number&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; null&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  parentChainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; number&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; null&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * Represents the configuration for the native currency used in the network.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;typedef&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NativeCurrencyConfig&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;property&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; name - The name of the native currency (e.g., &amp;quot;Ether&amp;quot;).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;property&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; symbol - The symbol of the native currency (e.g., &amp;quot;ETH&amp;quot;).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;property&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; decimals - The number of decimal places the currency uses (e.g., 18 for Ether).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NativeCurrencyConfig&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  name&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  symbol&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  decimals&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; number&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * Represents the configuration for a specific Ethereum network used in the DApp.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * This includes details such as the network name, testnet status, RPC configurations,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * explorers, and smart contracts related to the network.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;typedef&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NetworkConfig&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;property&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; name - The name of the network (e.g., &amp;quot;Ethereum&amp;quot;, &amp;quot;Base&amp;quot;).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;property&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; testnet - A flag indicating whether the network is a testnet (`true`) or mainnet (`false`).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;property&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; nativeCurrency - Configuration for the network&amp;#39;s native currency (e.g., ETH).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;property&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; relations - Relationships with other networks (e.g., parent network or L1&#x2F;L2 or other bridged networks).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;property&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; rpcs - A record of RPC configurations for different nodes in the network, where keys represent the node names (e.g., &amp;quot;publicnode&amp;quot;).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;property&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; explorers - Optional record for block explorer configurations (e.g., nft marketplaces).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;property&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; contracts - A record of contract configurations where the values may be `null` if the contract is not deployed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;see&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; https:&#x2F;&#x2F;url.spec.whatwg.org&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NetworkConfig&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  name&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  testnet&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; boolean&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  nativeCurrency&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  NativeCurrencyConfig&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  relations&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RelationsConfig&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  rpcs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Record&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RpcConfig&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; null&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  explorers&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Record&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ExplorerConfig&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; null&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  contracts&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Record&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ContractName&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ContractConfig&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; null&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * Represents the configuration for a DApp, including version information, a summary,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * an optional description, and the network configurations.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;typedef&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Object&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Configuration&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;property&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; version - The version of the configuration, typically following semantic versioning (e.g., &amp;quot;1.0.0&amp;quot;).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;property&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; timestamp - The timestamp in ISO 8601-compatible format of when the configuration was last updated (e.g., &amp;quot;2025-01-01T12:00:00Z&amp;quot;).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;property&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; abiRoot - Optional root URL for the ABI (Application Binary Interface) if it is hosted externally.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;property&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; summary - A brief summary or title for the configuration (e.g., &amp;quot;RealPhotos Network Configuration&amp;quot;).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;property&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; description - An optional detailed description of the configuration and its purpose.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;property&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; networks - A record of network configurations, where keys represent the network IDs (e.g., &amp;quot;1&amp;quot; for ethereum mainnet).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;see&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; https:&#x2F;&#x2F;url.spec.whatwg.org&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;see&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; https:&#x2F;&#x2F;semver.org&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;see&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; https:&#x2F;&#x2F;www.iso.org&#x2F;obp&#x2F;ui&#x2F;en&#x2F;#iso:std:iso:8601:-1:ed-1:v1:en&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;export&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; default&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; type&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Configuration&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  version&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  timestamp&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  summary&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  description&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  abiRoot&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; null&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  networks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Record&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; NetworkConfig&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;contracts&quot;&gt;Contracts&lt;&#x2F;h3&gt;
&lt;p&gt;Contracts listed &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; be limited to the subset necessary to perform specific functionality, as defined by the configuration author.&lt;&#x2F;p&gt;
&lt;p&gt;Implementations &lt;strong&gt;MUST&lt;&#x2F;strong&gt; ensure that contract names are consistent across all networks. While the contract binary code deployed to different networks under the same name in the configuration can differ, implementations &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; ensure they represent different versions of the same contract. Differences &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; be communicated through additional custom properties or different &lt;code&gt;abiUrl&lt;&#x2F;code&gt;. See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7876&#x2F;#extensions&quot;&gt;Extensions&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Inlining contract ABIs &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; be used to ensure effective memory management is possible in resource-constrained environments.&lt;&#x2F;p&gt;
&lt;p&gt;It is &lt;strong&gt;RECOMMENDED&lt;&#x2F;strong&gt; for a contract name to match the name in Solidity source code if the contract bytecode is verified on block explorers.&lt;&#x2F;p&gt;
&lt;p&gt;If a contract is not deployed on a specific network, the value &lt;code&gt;null&lt;&#x2F;code&gt; &lt;strong&gt;MUST&lt;&#x2F;strong&gt; explicitly indicate the absence of a contract.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;extensions&quot;&gt;Extensions&lt;&#x2F;h3&gt;
&lt;p&gt;Implementations &lt;strong&gt;MUST&lt;&#x2F;strong&gt; ignore non-documented properties or support their interpretation where technically feasible. This ensures the standard remains adaptable to future use cases, enabling developers to extend configurations without breaking compatibility.
See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7876&#x2F;#example-extensions&quot;&gt;Example Extensions&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Non-documented properties &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; support new features or extensions, but they &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; modify or extend the basic types of existing properties.
Union types &lt;strong&gt;SHOULD NOT&lt;&#x2F;strong&gt; be used in extensions. Their usage contradicts the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7876&#x2F;#rationale&quot;&gt;Rationale&lt;&#x2F;a&gt; of the standard.
See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7876&#x2F;#incorrect-extension&quot;&gt;Incorrect Extension Example&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Extensions &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; use extensible data structures by making sure additional properties can be added at any configuration layer.&lt;&#x2F;p&gt;
&lt;p&gt;Example of rigid and extensible data structures:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# &lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Rigid&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; structure&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RigidConfiguration&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  documentationUrls&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# &lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Extensible&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; structure&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ExtensibleConfiguration&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  documentation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; url&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The design of this standard leverages the following key goals:&lt;&#x2F;p&gt;
&lt;h3 id=&quot;1-availability-and-distribution&quot;&gt;1. Availability and Distribution&lt;&#x2F;h3&gt;
&lt;p&gt;Use JSON as a universally supported data interchange format, with libraries available in virtually all modern programming languages and platforms. This ensures:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Cross-Platform Compatibility&lt;&#x2F;strong&gt;: Developers can easily parse and generate JSON regardless of their tech stack.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Ease of Integration&lt;&#x2F;strong&gt;: Existing tools and frameworks already support JSON natively, reducing implementation overhead.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Built-in Data Types&lt;&#x2F;strong&gt;: JSON provides sufficient data types to describe all necessary configurations semantically, eliminating the need for manual typecasting.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Multi-network Support&lt;&#x2F;strong&gt;: The configuration supports multiple networks, ensuring projects deployed to multiple networks can propagate their configurations faster and more consistently.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;2-readability-by-an-engineer&quot;&gt;2. Readability by an Engineer&lt;&#x2F;h3&gt;
&lt;p&gt;The human-readable structure makes it ideal for configuration files:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Clarity&lt;&#x2F;strong&gt;: JSON&#x27;s key-value pair format is intuitive and easy to understand for engineers.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Debugging&lt;&#x2F;strong&gt;: Developers can quickly inspect and troubleshoot configurations directly in text editors or IDEs.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Simplicity&lt;&#x2F;strong&gt;: Its simplicity ensures that even less experienced developers can comprehend and modify configurations without extensive training.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Human Names&lt;&#x2F;strong&gt;: Fields like &lt;code&gt;name&lt;&#x2F;code&gt; and &lt;code&gt;description&lt;&#x2F;code&gt; provide context and improve usability for engineers working with the configuration.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;3-openness-for-extensions&quot;&gt;3. Openness for Extensions&lt;&#x2F;h3&gt;
&lt;p&gt;This standard is designed to support extensions by using JSON objects rather than rigid structures like basic types or arrays.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Forward Compatibility&lt;&#x2F;strong&gt;: Unrecognized properties can be safely ignored or leveraged without breaking existing implementations.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Customizability&lt;&#x2F;strong&gt;: Developers can add additional fields to accommodate specific requirements, such as API keys or advanced metadata.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Scalability&lt;&#x2F;strong&gt;: Future updates to the standard can include new attributes while maintaining backwards compatibility.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7876&#x2F;#extensions&quot;&gt;Extensions&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;4-use-of-chain-id-as-a-unique-network-identifier&quot;&gt;4. Use of Chain ID as a Unique Network Identifier&lt;&#x2F;h3&gt;
&lt;p&gt;This standard uses the &lt;strong&gt;chain ID&lt;&#x2F;strong&gt; as the unique identifier for networks rather than custom names because:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Standardization&lt;&#x2F;strong&gt;: Chain IDs are part of the Ethereum specification and are globally recognized, ensuring consistency.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;No Collisions&lt;&#x2F;strong&gt;: Unlike custom names, chain IDs are unique, preventing conflicts between networks.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Interoperability&lt;&#x2F;strong&gt;: Using chain IDs aligns with existing Ethereum tooling and standards, making integrations seamless across diverse environments.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This standard emphasizes extensibility while maintaining backward compatibility where feasible. It ensures adaptability to the evolving requirements of Ethereum network configurations by prioritizing flexibility in its structure.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;1-compatibility-with-eip-3085&quot;&gt;1. Compatibility with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3085&#x2F;&quot;&gt;EIP-3085&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;This standard aligns with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3085&#x2F;&quot;&gt;EIP-3085&lt;&#x2F;a&gt;, the Ethereum standard for wallet Add Ethereum Chain requests, wherever applicable. However, it diverges in scenarios where EIP-3085&#x27;s rigid structure limits future enhancements.&lt;&#x2F;p&gt;
&lt;p&gt;By prioritizing extensibility over strict adherence to EIP-3085, this standard ensures compatibility with existing tools while enabling future-proof enhancements to network configurations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;example-configuration&quot;&gt;Example Configuration&lt;&#x2F;h3&gt;
&lt;p&gt;Below is an example configuration for an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; project deployed to Ethereum Mainnet and Sepolia. This illustrates how the standard can represent multi-network setups.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0.0.1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;timestamp&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2025-01-01T12:22:46.471Z&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;summary&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;NFT Artwork&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Artwork published by independent artist. Carefully crafted with style in one of the creative studios of the world.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;abiRoot&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;nft-artwork.example.com&#x2F;developer&#x2F;abi&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;networks&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Ethereum Mainnet&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;testnet&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;nativeCurrency&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Ether&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;symbol&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ETH&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;decimals&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 18&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;rpcs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;main&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;url&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;eth-rpc.example.com&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;backup&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;url&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;eth-rpc.backup.example.com&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;relations&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;mainnetChainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; null&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;parentChainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; null&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;explorers&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;megascan&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;root&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;example.org&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;block&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&#x2F;block&#x2F;:block&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&#x2F;address&#x2F;:address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&#x2F;tx&#x2F;:tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;nft&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&#x2F;nft&#x2F;:address&#x2F;:token&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;marketplace&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;root&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;nft.marketplace&#x2F;networks&#x2F;eth&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;block&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; null&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&#x2F;:address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; null&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;nft&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&#x2F;:address&#x2F;:token&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;contracts&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;Registry&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x57928ff7b0BBc3Ee4D84481e320DdB8B941f986A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;blockCreated&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1234567&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;abiUrl&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;.&#x2F;Registry.sol&#x2F;Registry.json&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;OwnerWallet&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xC12237E57B088e9191BD8054Df4f5B772646a4B6&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;blockCreated&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;11155111&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Sepolia&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;testnet&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;nativeCurrency&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Sepolia Ether&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;symbol&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ETH&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;decimals&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 18&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;rpcs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;main&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;url&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;sepolia-rpc.example.com&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;backup&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;url&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;sepolia-rpc.backup.example.com&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;relations&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;mainnetChainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;parentChainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; null&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;explorers&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;megascan&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;root&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;sepolia.example.org&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;block&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&#x2F;block&#x2F;:block&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&#x2F;address&#x2F;:address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&#x2F;tx&#x2F;:tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;nft&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&#x2F;nft&#x2F;:address&#x2F;:token&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;marketplace&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;root&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;testnets.nft.marketplace&#x2F;networks&#x2F;sepolia&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;block&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; null&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&#x2F;:address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; null&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;nft&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&#x2F;:address&#x2F;:token&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;contracts&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;Registry&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xE13471e6E5d11205AF290261f42108f89dCae72E&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;blockCreated&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 183882&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;abiUrl&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;.&#x2F;Registry.sol&#x2F;Registry.json&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;OwnerWallet&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xC12237E57B088e9191BD8054Df4f5B772646a4B6&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;blockCreated&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;em&gt;Note&lt;&#x2F;em&gt;: It is &lt;strong&gt;RECOMMENDED&lt;&#x2F;strong&gt; to use a two-space indentation format for better readability and debugging.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;configuration-loader-in-swift&quot;&gt;Configuration Loader in Swift&lt;&#x2F;h3&gt;
&lt;p&gt;Here is an example implementation of a configuration loader in Swift Programming Language, demonstrating how to load and parse a configuration file compliant with this standard:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;swift&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Foundation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BlockchainConfig&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; Codable&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;LoggerProvider&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NetworkConfig&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; Codable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Currency&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; Codable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            let&lt;&#x2F;span&gt;&lt;span&gt; name:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; String&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            let&lt;&#x2F;span&gt;&lt;span&gt; symbol:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; String&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            let&lt;&#x2F;span&gt;&lt;span&gt; decimals:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; Int&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RPC&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; Codable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            let&lt;&#x2F;span&gt;&lt;span&gt; url:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; String&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Relations&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; Codable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            let&lt;&#x2F;span&gt;&lt;span&gt; mainnetChainId:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; Int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            let&lt;&#x2F;span&gt;&lt;span&gt; parentChainId:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; Int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Explorer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; Codable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            let&lt;&#x2F;span&gt;&lt;span&gt; root:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; String&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            let&lt;&#x2F;span&gt;&lt;span&gt; block:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; String&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            let&lt;&#x2F;span&gt;&lt;span&gt; address:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; String&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            let&lt;&#x2F;span&gt;&lt;span&gt; tx:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; String&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            let&lt;&#x2F;span&gt;&lt;span&gt; nft:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; String&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Contract&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; Codable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            let&lt;&#x2F;span&gt;&lt;span&gt; address:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; String&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            let&lt;&#x2F;span&gt;&lt;span&gt; blockCreated:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; Int&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        let&lt;&#x2F;span&gt;&lt;span&gt; name:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; String&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        let&lt;&#x2F;span&gt;&lt;span&gt; testnet:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; Bool&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        let&lt;&#x2F;span&gt;&lt;span&gt; nativeCurrency:&lt;&#x2F;span&gt;&lt;span&gt; Currency&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        let&lt;&#x2F;span&gt;&lt;span&gt; rpcs:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;String&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; RPC&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        let&lt;&#x2F;span&gt;&lt;span&gt; relations:&lt;&#x2F;span&gt;&lt;span&gt; Relations&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        let&lt;&#x2F;span&gt;&lt;span&gt; explorers:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;String&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Explorer&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        let&lt;&#x2F;span&gt;&lt;span&gt; contracts:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;String&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        var&lt;&#x2F;span&gt;&lt;span&gt; registryAddress:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; String&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            contracts&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Registry&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        var&lt;&#x2F;span&gt;&lt;span&gt; megascan:&lt;&#x2F;span&gt;&lt;span&gt; Explorer &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            explorers&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;megascan&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        func&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; blockExplorerUrl&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;String&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; URL &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            let&lt;&#x2F;span&gt;&lt;span&gt; fullPath &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; megascan.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;replacingOccurrences&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;of&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;:address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;with&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; URL&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; megascan.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; fullPath&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        func&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; blockExplorerUrl&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;String&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; URL &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            let&lt;&#x2F;span&gt;&lt;span&gt; fullPath &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; megascan.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;replacingOccurrences&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;of&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;:tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;with&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; URL&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; megascan.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; fullPath&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        func&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; blockExplorerUrl&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;contractAddress&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;String&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span&gt;Data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; URL &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            let&lt;&#x2F;span&gt;&lt;span&gt; fullPath &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; explorers&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;nftmarketplace&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;nft&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                .&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;replacingOccurrences&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;of&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;:address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;with&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; contractAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                .&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;replacingOccurrences&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;of&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;:token&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;with&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; tokenId.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;decString&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; URL&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; megascan.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; fullPath&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span&gt; version:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; String&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span&gt; timestamp:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; String&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span&gt; description:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; String&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span&gt; networks:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;String&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; NetworkConfig&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;    static&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; func&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; load&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; BlockchainConfig &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        guard&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; let&lt;&#x2F;span&gt;&lt;span&gt; url &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; Bundle.main.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;url&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;forResource&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;config&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;withExtension&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;json&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            fatalError&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Blockchain config not found.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        do&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            let&lt;&#x2F;span&gt;&lt;span&gt; data &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; try&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; Data&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;contentsOf&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; url&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            let&lt;&#x2F;span&gt;&lt;span&gt; decoder &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; JSONDecoder&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            decoder.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;keyDecodingStrategy&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; .&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;convertFromSnakeCase&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; try&lt;&#x2F;span&gt;&lt;span&gt; decoder.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;decode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;BlockchainConfig.&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; catch&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            fatalError&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;JSON Config parse error: &lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;\(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This Swift code provides a structured way to handle the configuration JSON and includes utility methods for accessing contract-related information.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;example-extensions&quot;&gt;Example Extensions&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;exposing-api-key&quot;&gt;Exposing API key&lt;&#x2F;h4&gt;
&lt;p&gt;Example of an extension that &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be supported: adding an API token alongside the RPC URL when it cannot be embedded directly into the URL
(e.g., passed via an &lt;code&gt;Authorization: Bearer &amp;lt;token&amp;gt;&lt;&#x2F;code&gt; header).&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ExtendedRpcConfig&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RpcConfig&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Bearer token for API authentication&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  apiKey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Maximum requests allowed per hour&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  hourlyThroughput&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; number&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; API key restricted by contract address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  contractRestrictionEnabled&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; boolean&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; rpcs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Record&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ExtendedRpcConfig&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;restrictedNode&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    url&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;example.com&#x2F;eth&#x2F;rpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    apiKey&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ecc2fc8b494b60bcc9faa90d750183f2&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    hourlyThroughput&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 40&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    contractRestrictionEnabled&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Ensure &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7876&#x2F;#security-considerations&quot;&gt;Security Considerations&lt;&#x2F;a&gt; are followed to protect your API key.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;extending-contract-properties&quot;&gt;Extending contract properties&lt;&#x2F;h4&gt;
&lt;p&gt;Example of an extension that &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be supported: incorporating additional attributes to support &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1967&#x2F;&quot;&gt;ERC-1967&lt;&#x2F;a&gt; transparent proxies and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; interface identification.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ExtendedContractConfig&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ContractConfig&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    implementation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    proxyAdmin&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    supportsInterface&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; contracts&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Record&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ExtendedContractConfig&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Registry&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x57928ff7b0BBc3Ee4D84481e320DdB8B941f986A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;blockCreated&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 123456&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;implementation&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x489B4BC8bCA12cCeafb84aa78918b8E28594C391&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;proxyAdmin&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xFd72EeDa802481027e4200E61A5dF052287eec27&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-721 &amp;amp; ERC-165 interfaces&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;supportsInterface&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x01ffc9a7&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x80ac58cd&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;incorrect-extension&quot;&gt;Incorrect extension&lt;&#x2F;h4&gt;
&lt;p&gt;Example of an incorrect extension that &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; be supported: representing &lt;code&gt;blockCreated&lt;&#x2F;code&gt; as a hexadecimal string instead of an integer.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; contracts&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Registry&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x57928ff7b0BBc3Ee4D84481e320DdB8B941f986A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;blockCreated&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x2af821&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;It causes existing implementation to fail parsing &lt;code&gt;blockCreated&lt;&#x2F;code&gt; property expecting it to be a &lt;code&gt;number&lt;&#x2F;code&gt;, not a &lt;code&gt;string&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The network configuration defined by this standard is intended to include only public information that is already accessible through tools like block explorers. By structuring this information in a standardized format, the configuration becomes more convenient and efficient for developers to use while maintaining the integrity of public data.&lt;&#x2F;p&gt;
&lt;p&gt;To ensure security and privacy, the following considerations &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be adhered to:&lt;&#x2F;p&gt;
&lt;h3 id=&quot;1-public-information-only&quot;&gt;1. Public Information Only&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;The configuration &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; include only publicly available details.&lt;&#x2F;li&gt;
&lt;li&gt;All information included in the configuration should already be discoverable through public tools or services, such as block explorers.&lt;&#x2F;li&gt;
&lt;li&gt;Including private or sensitive information &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be protected with an additional layer of protection.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;2-exposing-api-keys&quot;&gt;2. Exposing API Keys&lt;&#x2F;h3&gt;
&lt;p&gt;Exposing API keys must be handled with caution and accompanied by a thorough evaluation of associated risks. When including API keys, the following restrictions and best practices &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; be implemented:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Scope Restrictions&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;API keys &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; be limited in scope to specific actions or contract addresses.&lt;&#x2F;li&gt;
&lt;li&gt;Consider implementing IP restrictions where possible.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Rate Limits&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Include throughput limits (e.g., hourly or daily request caps) to mitigate abuse.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Usage&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Exposing API keys &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; be done in publicly distributed configurations.&lt;&#x2F;li&gt;
&lt;li&gt;Use environment variables or other secure mechanisms to manage API keys internally within an organization.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;3-exclusion-of-sensitive-information&quot;&gt;3. Exclusion of Sensitive Information&lt;&#x2F;h3&gt;
&lt;p&gt;The configuration &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; include the following sensitive data:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Private keys&lt;&#x2F;li&gt;
&lt;li&gt;Wallet recovery phrases or mnemonics&lt;&#x2F;li&gt;
&lt;li&gt;Any information that could compromise the security or privacy of users or systems.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;4-low-overall-security-risk&quot;&gt;4. Low Overall Security Risk&lt;&#x2F;h3&gt;
&lt;p&gt;The overall security risks of using this standard are minimal due to its compatibility with established Ethereum ecosystem security practices, including:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Verification of public data through block explorers.&lt;&#x2F;li&gt;
&lt;li&gt;Adherence to existing security standards like JSON schema validation and ABI checksum verification.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;By aligning with proven methodologies and widely accepted protocols, the standard minimizes potential vulnerabilities while ensuring robust functionality.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>AI Agents NFT with Private Metadata</title>
        <published>2025-01-02T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Ming Wu</name><uri>https://github.com/sparkmiw</uri>
	</author>
	
	<author>
		<name>Jason Zeng</name><uri>https://github.com/zenghbo</uri>
	</author>
	
	<author>
		<name>Wei Wu</name><uri>https://github.com/Wilbert957</uri>
	</author>
	
	<author>
		<name>Michael Heinrich</name><uri>https://github.com/michaelomg</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7857/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7857-an-nft-standard-for-ai-agents-with-private-metadata/22391" />
        

        <id>https://wg-eips.ritovision.com/7857/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7857"
            label="ERC-7857" />
        

        
        

        
        <summary type="html">AI agent NFTs, enabling secure management of private metadata with verifiable data transfer</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7857/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;A standard interface for NFTs specifically designed for AI agents, where the metadata represents agent capabilities and requires privacy protection. Unlike traditional NFT standards that focus on static metadata, this standard introduces mechanisms for verifiable data ownership and secure transfer. By defining a unified interface for different verification methods (e.g., Trusted Execution Environment (TEE), Zero-Knowledge Proof (ZKP)), it enables secure management of valuable agent metadata such as models, memory, and character definitions, while maintaining confidentiality and verifiability.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;With the increasing intelligence of AI models, agents have become powerful tools for automating meaningful daily tasks. The integration of agents with blockchain technology has been recognized as a major narrative in the crypto industry, with many projects enabling agent creation for their users. However, a crucial missing piece is the decentralized management of agent ownership.&lt;&#x2F;p&gt;
&lt;p&gt;AI agents possess inherent non-fungible properties that make them natural candidates for NFT representation:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Each agent is unique, with its own model, memory, and character&lt;&#x2F;li&gt;
&lt;li&gt;Agents embody clear ownership rights, representing significant computational investment and intellectual property&lt;&#x2F;li&gt;
&lt;li&gt;Agents have private metadata (e.g., neural network models, memory, character definitions) that defines their capabilities&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;However, current NFT standards like &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; are insufficient for representing AI agents as digital assets. While NFTs can establish ownership of digital items, using them to represent AI agents introduces unique challenges. The key issue lies in the metadata transfer mechanism. Unlike traditional NFTs where metadata is typically static and publicly accessible, an AI agent&#x27;s metadata (which constitutes the agent itself):&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Has intrinsic value and is often the primary purpose of the transfer&lt;&#x2F;li&gt;
&lt;li&gt;Requires encrypted storage to protect intellectual property&lt;&#x2F;li&gt;
&lt;li&gt;Needs privacy-preserving and verifiable transfer mechanisms when ownership changes&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;For example, when transferring an agent NFT, we need to ensure:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The actual transfer of encrypted metadata (the agent&#x27;s model, memory, character, etc.) is verifiable&lt;&#x2F;li&gt;
&lt;li&gt;The new owner can securely access the metadata that constitutes the agent&lt;&#x2F;li&gt;
&lt;li&gt;The agent&#x27;s execution environment can verify ownership and load appropriate metadata&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;This EIP introduces a standard for NFTs with private metadata that addresses these requirements through privacy-preserving verification mechanisms, enabling secure ownership and transfer of valuable agent data while maintaining confidentiality and verifiability. This standard will serve as a foundation for the emerging agent ecosystem, allowing platforms to provide verifiable agent ownership and secure metadata management in a decentralized manner.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The EIP defines three key interfaces: the main NFT interface, the metadata interface, and the data verification interface.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;data-verification-system&quot;&gt;Data Verification System&lt;&#x2F;h3&gt;
&lt;p&gt;The verification system consists of two core components that work together to ensure secure data operations:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;On-chain Verifier (data verification interface)&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Implemented as a smart contract&lt;&#x2F;li&gt;
&lt;li&gt;Verifies proofs submitted through contract calls&lt;&#x2F;li&gt;
&lt;li&gt;Returns structured verification results&lt;&#x2F;li&gt;
&lt;li&gt;Can be implemented using different verification mechanisms (TEE&#x2F;ZKP)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Off-chain Prover&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Generates proofs for ownership and availability claims&lt;&#x2F;li&gt;
&lt;li&gt;Works with encrypted data and keys&lt;&#x2F;li&gt;
&lt;li&gt;Implementation varies based on verification mechanism:
&lt;ul&gt;
&lt;li&gt;TEE-based: Generates proofs within trusted hardware&lt;&#x2F;li&gt;
&lt;li&gt;ZKP-based: Creates cryptographic zero-knowledge proofs&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The system supports two types of proofs:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Ownership Proof&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Generated by Prover with access to original data&lt;&#x2F;li&gt;
&lt;li&gt;Proves knowledge of pre-images for claimed dataHashes&lt;&#x2F;li&gt;
&lt;li&gt;Verified on-chain through &lt;code&gt;verifyOwnership()&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Transfer Validity Proof&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Generated by Prover for data transfers&lt;&#x2F;li&gt;
&lt;li&gt;Proves:
&lt;ul&gt;
&lt;li&gt;Knowledge of original data (pre-images)&lt;&#x2F;li&gt;
&lt;li&gt;Correct decryption and re-encryption of data&lt;&#x2F;li&gt;
&lt;li&gt;Secure key transmission (using receiver&#x27;s public key to encrypt the new key)&lt;&#x2F;li&gt;
&lt;li&gt;Data availability in storage (using receiver&#x27;s signature to confirm the data is available in storage)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Verified on-chain through &lt;code&gt;verifyTransferValidity()&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The ownership verification is optional because when the minted token is transferred or cloned, the ownership verification is checked again inside the availability verification. It&#x27;s better to be safe than sorry, so we recommend doing ownership verification for minting and updates.&lt;&#x2F;p&gt;
&lt;p&gt;Different verification mechanisms have distinct capabilities:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;TEE-based Implementation&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Prover runs in trusted hardware&lt;&#x2F;li&gt;
&lt;li&gt;Can handle private keys securely&lt;&#x2F;li&gt;
&lt;li&gt;Enables direct data re-encryption&lt;&#x2F;li&gt;
&lt;li&gt;Verifier checks TEE attestations&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;ZKP-based Implementation&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Prover generates cryptographic proofs&lt;&#x2F;li&gt;
&lt;li&gt;Cannot handle multi-party private keys&lt;&#x2F;li&gt;
&lt;li&gt;Re-encryption key known to prover&lt;&#x2F;li&gt;
&lt;li&gt;Requires additional re-encryption when next update, otherwise the new update is still visible to the prover&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;data-verification-interface&quot;&gt;Data Verification Interface&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The type of the oracle&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; There are two types of oracles: TEE and ZKP&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OracleType&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;    TEE&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;    ZKP&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The access proof which is a signature signed by the receiver (the receiver may delegate the signing privilege to the access assistant)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; oldDataHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The hash of the old data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; newDataHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The hash of the new data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The nonce of the access proof&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; encryptedPubKey&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The encrypted public key, the receiver&amp;#39;s public key which used to encrypt the new data key. `encryptedPubKey` can be empty in `accessProof`, and means that use the receiver&amp;#39;s ethereum public key to encrypt the new data key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; proof&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The proof&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AccessProof&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; oldDataHash&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; newDataHash&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span&gt; encryptedPubKey&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span&gt; proof&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ownership proof which is a signature signed by the receiver (the receiver may delegate the signing privilege to the access assistant)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; proofType&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The type of the proof&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; oldDataHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The hash of the old data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; newDataHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The hash of the new data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sealedKey&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The sealed key of the new data key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; encryptedPubKey&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The encrypted public key, the receiver&amp;#39;s public key which used to encrypt the new data key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OwnershipProof&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    OracleType oracleType&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The type of the oracle&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; oldDataHash&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The hash of the old data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; newDataHash&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The hash of the new data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span&gt; sealedKey&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The sealed key of the new data key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span&gt; encryptedPubKey&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The encrypted public key, the receiver&amp;#39;s public key which used to encrypt the new data key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span&gt; proof&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The proof&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransferValidityProof&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    AccessProof accessProof&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    OwnershipProof ownershipProof&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransferValidityProofOutput&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; oldDataHash&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; newDataHash&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span&gt; sealedKey&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span&gt; encryptedPubKey&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span&gt; wantedKey&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; accessAssistant&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span&gt; accessProofNonce&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span&gt; ownershipProofNonce&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7857DataVerifier&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify data transfer validity, the _proofs prove:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         1. The pre-image of oldDataHashes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         2. The oldKey (old data key) can decrypt the pre-image and the new key re-encrypt the plaintexts to new ciphertexts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         3. The newKey (new data key) is encrypted using the encryptedPubKey&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         4. The hashes of new ciphertexts is newDataHashes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         5. The newDataHashes identified ciphertexts are available in the storage: need the signature from the receiver or the access assistant signing oldDataHashes, newDataHashes, and encryptedPubKey&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _proofs&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Proof generated by TEE&#x2F;ZKP&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verifyTransferValidity&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        TransferValidityProof&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _proofs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;TransferValidityProofOutput&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;metadata-interface&quot;&gt;Metadata Interface&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IntelligentData&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span&gt; dataDescription&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; dataHash&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7857Metadata&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the name of the NFT collection&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the symbol of the NFT collection&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; symbol&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the data hash of a token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token identifier&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; current data hash of the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; intelligentDataOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;IntelligentData&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;main-nft-interface&quot;&gt;Main NFT Interface&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7857&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The event emitted when an address is approved to transfer a token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address that is approving&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address that is being approved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token identifier&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Approval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The event emitted when an address is approved for all&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The operator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The approval&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ApprovalForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The event emitted when an address is authorized to use a token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address that is authorizing&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address that is being authorized&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token identifier&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Authorization&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The event emitted when an address is revoked from using a token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address that is revoking&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address that is being revoked&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token identifier&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AuthorizationRevoked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The event emitted when a token is transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token identifier&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address that is transferring&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address that is receiving&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transferred&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The event emitted when a token is cloned&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token identifier&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _newTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The new token identifier&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address that is cloning&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address that is receiving&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Cloned&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _newTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The event emitted when a sealed key is published&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address that is receiving&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token identifier&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _sealedKeys&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The sealed keys&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PublishedSealedKey&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _sealedKeys&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The event emitted when a user is delegated to an assistant&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _user&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The user&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _assistant&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The assistant&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DelegateAccess&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _user&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _assistant&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The verifier interface that this NFT uses&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address of the verifier contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verifier&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;IERC7857DataVerifier&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfer data with ownership&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address to transfer data to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token to transfer data for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _proofs&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Proofs of data available for _to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; iTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        TransferValidityProof&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _proofs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Clone data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address to clone data to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token to clone data for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _proofs&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Proofs of data available for _to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _newTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ID of the newly cloned token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; iClone&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        TransferValidityProof&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _proofs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _newTokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Add authorized user to group&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token to add to group&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; authorizeUsage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _user&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Revoke authorization from a user&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token to revoke authorization from&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _user&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The user to revoke authorization from&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revokeAuthorization&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _user&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Approve an address to transfer a token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to approve&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token identifier&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Set approval for all&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The operator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The approval&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setApprovalForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Delegate access check to an assistant&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _assistant&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The assistant&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; delegateAccess&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _assistant&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get token owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token identifier&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; current owner of the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the authorized users of a token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token identifier&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; current authorized users of the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; authorizedUsersOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the approved address for a token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token identifier&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; approved address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getApproved&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check if an address is approved for all&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The operator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; approval&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isApprovedForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the delegate access for a user&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _user&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The user&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; delegate access&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getDelegateAccess&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _user&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The design choices in this standard are motivated by several key requirements:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Verification Abstraction&lt;&#x2F;strong&gt;: The standard separates the verification logic into a dedicated interface (&lt;code&gt;IDataVerifier&lt;&#x2F;code&gt;), allowing different verification mechanisms (TEE, ZKP) to be implemented and used interchangeably. The verifier should support two types of proof:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Ownership Proof Verifies that the prover possesses the original data by demonstrating knowledge of the pre-images that generate the claimed dataHashes&lt;&#x2F;li&gt;
&lt;li&gt;Transfer Validity Proof Verifies secure data integrity and availability by proving: knowledge of the original data (pre-images of oldDataHashes); ability to decrypt with oldKey and re-encrypt with newKey; secure transmission of newKey using recipient&#x27;s public key; integrity of the newly encrypted data matching newDataHashes; and data availability confirmed by recipient&#x27;s signature on both &lt;code&gt;oldDataHashes&lt;&#x2F;code&gt; and &lt;code&gt;newDataHashes&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Data Protection&lt;&#x2F;strong&gt;: The standard uses data hashes and encrypted keys to ensure that valuable NFT data remains protected while still being integrity and availability verifiable&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Flexible Data Management&lt;&#x2F;strong&gt;: Three distinct data operations are supported:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Full transfer, where the data and ownership are transferred to the new owner&lt;&#x2F;li&gt;
&lt;li&gt;Data cloning, where the data is cloned to a new token but the ownership is not transferred&lt;&#x2F;li&gt;
&lt;li&gt;Data usage authorization, where the data is authorized to be used by a specific user, but the ownership is not transferred, and the user still cannot access the data. This need an environment to authenticate the user and process the request from the authorized user secretly, we call it &quot;Sealed Executor&quot;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Sealed Executor&lt;&#x2F;strong&gt;: Although the Sealed Executor is not defined and out of the scope of this standard, it is a crucial component for the standard to work. The Sealed Executor is an environment that can authenticate the user and process the request from the authorized user secretly. The Sealed Executor should get authorized group by tokenId, and the verify the signature of the user using the public keys in the authorized group. If the verification is successful, the executor will process the request and return the result to the user, and the sealed executor could be implemented by a trusted party (where permitted), TEE or Fully Homomorphic Encryption (FHE)&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP does not inherit from existing NFT standards to maintain its focus on functional data management. However, implementations can choose to additionally implement &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; if traditional NFT compatibility is desired.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;verifier&quot;&gt;Verifier&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;abstract&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BaseVerifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7857DataVerifier&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; prevent replay attack&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; usedProofs&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; prevent replay attack&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; proofTimestamps&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _checkAndMarkProof&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; proofNonce&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;usedProofs&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;proofNonce&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Proof already used&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        usedProofs&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;proofNonce&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        proofTimestamps&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;proofNonce&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; clean expired proof records (save gas)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; cleanExpiredProofs&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; proofNonces&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; proofNonces&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes32&lt;&#x2F;span&gt;&lt;span&gt; nonce &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; proofNonces&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;usedProofs&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;nonce&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;                block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; proofTimestamps&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;nonce&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 7&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; days&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                delete&lt;&#x2F;span&gt;&lt;span&gt; usedProofs&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;nonce&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                delete&lt;&#x2F;span&gt;&lt;span&gt; proofTimestamps&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;nonce&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;50&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; __gap&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AttestationConfig&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    OracleType oracleType&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; contractAddress&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Verifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    BaseVerifier&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    Initializable&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    AccessControlUpgradeable&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    PausableUpgradeable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    using&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ECDSA&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    using&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MessageHashUtils&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AttestationContractUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;AttestationConfig&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attestationConfigs&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; ADMIN_ROLE &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;ADMIN_ROLE&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; PAUSER_ROLE &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;PAUSER_ROLE&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;OracleType &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; attestationContract&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; maxProofAge&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; VERSION &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;2.0.0&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @custom:oz&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;-upgrades-unsafe-allow constructor&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _disableInitializers&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; initialize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        AttestationConfig&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _attestationConfigs&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _admin&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; initializer&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        __AccessControl_init&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        __Pausable_init&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; _attestationConfigs&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            attestationContract&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                _attestationConfigs&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;oracleType&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            ]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; _attestationConfigs&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;contractAddress&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        maxProofAge &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 7&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; days&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _grantRole&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;DEFAULT_ADMIN_ROLE&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _admin&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _grantRole&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ADMIN_ROLE&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _admin&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _grantRole&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;PAUSER_ROLE&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _admin&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AttestationContractUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_attestationConfigs&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; updateAttestationContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        AttestationConfig&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _attestationConfigs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyRole&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ADMIN_ROLE&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; _attestationConfigs&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            attestationContract&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                _attestationConfigs&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;oracleType&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            ]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; _attestationConfigs&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;contractAddress&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AttestationContractUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_attestationConfigs&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; updateMaxProofAge&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _maxProofAge&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyRole&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ADMIN_ROLE&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        maxProofAge &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _maxProofAge&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; pause&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyRole&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;PAUSER_ROLE&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _pause&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; unpause&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyRole&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;PAUSER_ROLE&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _unpause&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; hashNonce&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;nonce&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; teeOracleVerify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; messageHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            TEEVerifier&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;attestationContract&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;OracleType&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;TEE&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;verifyTEESignature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                messageHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Extract and verify signature from the access proof&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; accessProof&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The access proof&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; recovered access assistant address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verifyAccessibility&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        AccessProof&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; accessProof&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; messageHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;                &amp;quot;\x19Ethereum Signed Message:\n66&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                Strings&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;toHexString&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;                            abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                accessProof&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;oldDataHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                accessProof&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;newDataHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                accessProof&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;encryptedPubKey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                accessProof&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    )&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;                    32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; accessAssistant &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; messageHash&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;recover&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;accessProof&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;proof&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;accessAssistant &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Invalid access assistant&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; accessAssistant&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verfifyOwnershipProof&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        OwnershipProof&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ownershipProof&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;ownershipProof&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;oracleType &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; OracleType&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;TEE&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes32&lt;&#x2F;span&gt;&lt;span&gt; messageHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;                abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;                    &amp;quot;\x19Ethereum Signed Message:\n66&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    Strings&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;toHexString&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                            keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;                                abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                    ownershipProof&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;oldDataHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                    ownershipProof&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;newDataHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                    ownershipProof&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sealedKey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                    ownershipProof&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;encryptedPubKey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                    ownershipProof&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        )&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;                        32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; teeOracleVerify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;messageHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; ownershipProof&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;proof&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; TODO&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: add ZKP verification&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Process a single transfer validity proof&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; proof&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The proof data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; output&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The processed proof data as a struct&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; processTransferProof&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        TransferValidityProof&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; proof&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;TransferValidityProofOutput&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; output&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; compare the proof data in access proof and ownership proof&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            proof&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;accessProof&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;oldDataHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; proof&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;ownershipProof&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;oldDataHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;Invalid oldDataHashes&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;oldDataHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; proof&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;accessProof&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;oldDataHash&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            proof&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;accessProof&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;newDataHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; proof&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;ownershipProof&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;newDataHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;Invalid newDataHashes&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;newDataHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; proof&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;accessProof&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;newDataHash&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;wantedKey &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; proof&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;accessProof&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;encryptedPubKey&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;accessProofNonce &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; proof&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;accessProof&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;nonce&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;encryptedPubKey &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; proof&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;ownershipProof&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;encryptedPubKey&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sealedKey &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; proof&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;ownershipProof&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sealedKey&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;ownershipProofNonce &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; proof&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;ownershipProof&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;nonce&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; verify the access assistant&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;accessAssistant &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verifyAccessibility&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;proof&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;accessProof&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span&gt; isOwn &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verfifyOwnershipProof&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;proof&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;ownershipProof&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;isOwn&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Invalid ownership proof&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; output&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify data transfer validity, the _proof prove:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         1. The pre-image of oldDataHashes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         2. The oldKey can decrypt the pre-image and the new key re-encrypt the plaintexts to new ciphertexts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         3. The newKey is encrypted with the receiver&amp;#39;s pubKey to get the sealedKey&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         4. The hashes of new ciphertexts is newDataHashes (key to &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: TEE could support a private key of the receiver)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         5. The newDataHashes identified ciphertexts are available in the storage: need the signature from the receiver signing oldDataHashes and newDataHashes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; proofs&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Proof generated by TEE&#x2F;ZKP oracle&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verifyTransferValidity&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        TransferValidityProof&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; proofs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        public&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        virtual&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        override&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        whenNotPaused&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;TransferValidityProofOutput&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        TransferValidityProofOutput&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            memory&lt;&#x2F;span&gt;&lt;span&gt; outputs &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span&gt; TransferValidityProofOutput&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;proofs&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; proofs&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            TransferValidityProofOutput &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;memory&lt;&#x2F;span&gt;&lt;span&gt; output &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; processTransferProof&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                proofs&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            outputs&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; output&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes32&lt;&#x2F;span&gt;&lt;span&gt; accessProofNonce &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; hashNonce&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;accessProofNonce&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            _checkAndMarkProof&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;accessProofNonce&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes32&lt;&#x2F;span&gt;&lt;span&gt; ownershipProofNonce &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; hashNonce&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;ownershipProofNonce&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            _checkAndMarkProof&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ownershipProofNonce&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; outputs&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;50&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; __gap&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;main-nft&quot;&gt;Main NFT&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AgentNFT&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    AccessControlEnumerableUpgradeable&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    IERC7857&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    IERC7857Metadata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Updated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        IntelligentData&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _oldDatas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        IntelligentData&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _newDatas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Minted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _creator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TokenData&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; authorizedUsers&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; approvedUser&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        IntelligentData&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; iDatas&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @custom:storage&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;-location erc7201:agent.storage.AgentNFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AgentNFTStorage&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Token data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; TokenData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; tokens&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; owner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; operator &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; operatorApprovals&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; user &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt; accessAssistant&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; accessAssistants&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; nextTokenId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Contract metadata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt; symbol&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt; storageInfo&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Core components&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        IERC7857DataVerifier verifier&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; ADMIN_ROLE &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;ADMIN_ROLE&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; PAUSER_ROLE &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;PAUSER_ROLE&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; VERSION &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;2.0.0&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; keccak256(abi.encode(uint(keccak256(&amp;quot;agent.storage.AgentNFT&amp;quot;)) - 1)) &amp;amp; ~bytes32(uint(0xff))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; AGENT_NFT_STORAGE_LOCATION &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        0x4aa80aaafbe0e5fe3fe1aa97f3c1f8c65d61f96ef1aab2b448154f4e07594600&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _getAgentStorage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        private&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        pure&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;AgentNFTStorage&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; storage&lt;&#x2F;span&gt;&lt;span&gt; $&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            $&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span&gt; AGENT_NFT_STORAGE_LOCATION&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @custom:oz&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;-upgrades-unsafe-allow constructor&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _disableInitializers&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; initialize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; symbol_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; storageInfo_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; verifierAddr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; admin_&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; initializer&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;verifierAddr &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Zero address&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        __AccessControlEnumerable_init&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _grantRole&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;DEFAULT_ADMIN_ROLE&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; admin_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _grantRole&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ADMIN_ROLE&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; admin_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _grantRole&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;PAUSER_ROLE&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; admin_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        AgentNFTStorage &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;storage&lt;&#x2F;span&gt;&lt;span&gt; $ &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _getAgentStorage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        $&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;name &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; name_&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        $&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;symbol &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; symbol_&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        $&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;storageInfo &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; storageInfo_&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        $&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;verifier &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7857DataVerifier&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;verifierAddr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Basic getters&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _getAgentStorage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;name&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; symbol&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _getAgentStorage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;symbol&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verifier&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;IERC7857DataVerifier&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _getAgentStorage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;verifier&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Admin functions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; updateVerifier&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newVerifier&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyRole&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ADMIN_ROLE&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;newVerifier &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Zero address&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _getAgentStorage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;verifier &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7857DataVerifier&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;newVerifier&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; update&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        IntelligentData&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newDatas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        AgentNFTStorage &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;storage&lt;&#x2F;span&gt;&lt;span&gt; $ &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _getAgentStorage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        TokenData &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;storage&lt;&#x2F;span&gt;&lt;span&gt; token &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; $&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;tokens&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;token&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;owner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Not owner&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;newDatas&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Empty data array&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        IntelligentData&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; oldDatas &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span&gt; IntelligentData&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            token&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;iDatas&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; token&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;iDatas&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            oldDatas&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; token&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;iDatas&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        delete&lt;&#x2F;span&gt;&lt;span&gt; token&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;iDatas&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; newDatas&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            token&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;iDatas&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;push&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;newDatas&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Updated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; oldDatas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; newDatas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        IntelligentData&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; iDatas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;to &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Zero address&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;iDatas&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Empty data array&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        AgentNFTStorage &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;storage&lt;&#x2F;span&gt;&lt;span&gt; $ &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _getAgentStorage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        tokenId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; $&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;nextTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        TokenData &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;storage&lt;&#x2F;span&gt;&lt;span&gt; newToken &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; $&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;tokens&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        newToken&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;owner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        newToken&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;approvedUser &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; iDatas&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            newToken&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;iDatas&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;push&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;iDatas&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Minted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _proofCheck&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        TransferValidityProof&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; proofs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        internal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sealedKeys&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; IntelligentData&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newDatas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        AgentNFTStorage &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;storage&lt;&#x2F;span&gt;&lt;span&gt; $ &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _getAgentStorage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;to &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Zero address&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;$&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;tokens&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;owner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Not owner&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;proofs&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Empty proofs array&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        TransferValidityProofOutput&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; proofOutput &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; $&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            .&lt;&#x2F;span&gt;&lt;span&gt;verifier&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            .&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;verifyTransferValidity&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;proofs&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            proofOutput&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; $&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;tokens&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;iDatas&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;Proof count mismatch&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        sealedKeys &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;[](&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;proofOutput&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        newDatas &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span&gt; IntelligentData&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;proofOutput&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; proofOutput&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; require the initial data hash is the same as the old data hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                proofOutput&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;oldDataHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    $&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;tokens&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;iDatas&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;dataHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;                &amp;quot;Old data hash mismatch&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; only the receiver itself or the access assistant can sign the access proof&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                proofOutput&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;accessAssistant &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; $&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;accessAssistants&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    proofOutput&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;accessAssistant &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;                &amp;quot;Access assistant mismatch&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; wantedKey &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; proofOutput&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;wantedKey&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; encryptedPubKey &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; proofOutput&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;encryptedPubKey&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;wantedKey&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;                &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if the wanted key is empty, the default wanted receiver is receiver itself&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                address&lt;&#x2F;span&gt;&lt;span&gt; defaultWantedReceiver &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; Utils&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;pubKeyToAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    encryptedPubKey&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    defaultWantedReceiver &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;                    &amp;quot;Default wanted receiver mismatch&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;                &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if the wanted key is not empty, the data is private&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    Utils&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;bytesEqual&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;encryptedPubKey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; wantedKey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;                    &amp;quot;encryptedPubKey mismatch&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            sealedKeys&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; proofOutput&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sealedKey&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            newDatas&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IntelligentData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                dataDescription&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; $&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;tokens&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;iDatas&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;dataDescription&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                dataHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; proofOutput&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;newDataHash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;sealedKeys&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; newDatas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        TransferValidityProof&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; proofs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        AgentNFTStorage &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;storage&lt;&#x2F;span&gt;&lt;span&gt; $ &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _getAgentStorage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; sealedKeys&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            IntelligentData&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; newDatas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _proofCheck&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; proofs&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        TokenData &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;storage&lt;&#x2F;span&gt;&lt;span&gt; token &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; $&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;tokens&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        token&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;owner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        token&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;approvedUser &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        delete&lt;&#x2F;span&gt;&lt;span&gt; token&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;iDatas&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; newDatas&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            token&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;iDatas&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;push&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;newDatas&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transferred&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PublishedSealedKey&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; sealedKeys&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; iTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        TransferValidityProof&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; proofs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_isApprovedOrOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Not authorized&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; proofs&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        TokenData &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;storage&lt;&#x2F;span&gt;&lt;span&gt; token &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _getAgentStorage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;tokens&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_isApprovedOrOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Not authorized&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;to &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Zero address&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;token&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;owner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Not owner&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        token&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;owner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        token&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;approvedUser &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transferred&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; iTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        TransferValidityProof&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; proofs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_isApprovedOrOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Not authorized&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; proofs&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _clone&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        TransferValidityProof&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; proofs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        AgentNFTStorage &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;storage&lt;&#x2F;span&gt;&lt;span&gt; $ &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _getAgentStorage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; sealedKeys&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            IntelligentData&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; newDatas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _proofCheck&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; proofs&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; newTokenId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; $&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;nextTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        TokenData &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;storage&lt;&#x2F;span&gt;&lt;span&gt; newToken &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; $&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;tokens&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;newTokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        newToken&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;owner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        newToken&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;approvedUser &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; newDatas&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            newToken&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;iDatas&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;push&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;newDatas&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Cloned&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; newTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PublishedSealedKey&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; newTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; sealedKeys&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; newTokenId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; iClone&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        TransferValidityProof&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; proofs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_isApprovedOrOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Not authorized&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _clone&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; proofs&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; iCloneFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        TransferValidityProof&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; proofs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_isApprovedOrOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Not authorized&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _clone&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; proofs&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; authorizeUsage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;to &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Zero address&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        AgentNFTStorage &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;storage&lt;&#x2F;span&gt;&lt;span&gt; $ &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _getAgentStorage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;$&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;tokens&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;owner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Not owner&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; storage&lt;&#x2F;span&gt;&lt;span&gt; authorizedUsers &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; $&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;tokens&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;authorizedUsers&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; authorizedUsers&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;authorizedUsers&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Already authorized&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        authorizedUsers&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;push&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Authorization&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        AgentNFTStorage &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;storage&lt;&#x2F;span&gt;&lt;span&gt; $ &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _getAgentStorage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; owner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; $&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;tokens&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;owner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Token does not exist&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; authorizedUsersOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        AgentNFTStorage &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;storage&lt;&#x2F;span&gt;&lt;span&gt; $ &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _getAgentStorage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_exists&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Token does not exist&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; $&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;tokens&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;authorizedUsers&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; storageInfo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_exists&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Token does not exist&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _getAgentStorage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;storageInfo&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _exists&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _getAgentStorage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;tokens&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;owner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; intelligentDataOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;IntelligentData&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        AgentNFTStorage &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;storage&lt;&#x2F;span&gt;&lt;span&gt; $ &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _getAgentStorage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_exists&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Token does not exist&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; $&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;tokens&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;iDatas&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; owner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;to &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Approval to current owner&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            msg.sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; owner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isApprovedForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;Not authorized&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _getAgentStorage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;tokens&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;approvedUser &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Approval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setApprovalForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approved&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;operator &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Approve to caller&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _getAgentStorage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;operatorApprovals&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;operator&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; approved&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ApprovalForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; approved&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getApproved&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_exists&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Token does not exist&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _getAgentStorage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;tokens&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;approvedUser&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isApprovedForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _getAgentStorage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;operatorApprovals&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;operator&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; delegateAccess&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; assistant&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;assistant &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Zero address&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _getAgentStorage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;accessAssistants&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; assistant&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DelegateAccess&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; assistant&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getDelegateAccess&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _getAgentStorage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;accessAssistants&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;user&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _isApprovedOrOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_exists&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Token does not exist&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; owner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;spender &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; owner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            getApproved&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; spender &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            isApprovedForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; batchAuthorizeUsage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; users&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;users&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Empty users array&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        AgentNFTStorage &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;storage&lt;&#x2F;span&gt;&lt;span&gt; $ &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _getAgentStorage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;$&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;tokens&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;owner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Not owner&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; users&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;users&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Zero address in users&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            $&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;tokens&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;authorizedUsers&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;push&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;users&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Authorization&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; users&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revokeAuthorization&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        AgentNFTStorage &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;storage&lt;&#x2F;span&gt;&lt;span&gt; $ &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _getAgentStorage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;$&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;tokens&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;owner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Not owner&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;user &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Zero address&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; storage&lt;&#x2F;span&gt;&lt;span&gt; authorizedUsers &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; $&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;tokens&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;authorizedUsers&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span&gt; found &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; authorizedUsers&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;authorizedUsers&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; user&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                authorizedUsers&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; authorizedUsers&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    authorizedUsers&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                ]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                authorizedUsers&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;pop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                found &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                break&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;found&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;User not authorized&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AuthorizationRevoked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Proof Verification&lt;&#x2F;strong&gt;
&lt;ul&gt;
&lt;li&gt;Implementations must carefully verify all assertions in the proof&lt;&#x2F;li&gt;
&lt;li&gt;Replay attacks must be prevented&lt;&#x2F;li&gt;
&lt;li&gt;Different verification systems have their own security considerations, and distinct capabilities regarding key management: TEE can securely handle private keys from multi-parties, enabling direct data re-encryption. However, ZKP, due to its cryptographic nature, cannot process private keys from multi-parties. As a result, the re-encryption key is also from the prover (i.e., the sender), so tokens acquired through transfer or cloning must undergo re-encryption during their next update, otherwise the new update is still visible to the previous owner. This distinction in key handling capabilities affects how data transformations are managed during later usage&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Data Privacy&lt;&#x2F;strong&gt;
&lt;ul&gt;
&lt;li&gt;Only hashes and sealed keys are stored on-chain, actual functional data must be stored and transmitted securely off-chain&lt;&#x2F;li&gt;
&lt;li&gt;Key management is crucial for secure data access&lt;&#x2F;li&gt;
&lt;li&gt;TEE verification system could support private key of the receiver, but ZKP verification system could not. So when using ZKP, the token transferred or cloned from other should be re-encrypted when next update, otherwise the new update is still visible to the previous owner&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Access Control and State Management&lt;&#x2F;strong&gt;
&lt;ul&gt;
&lt;li&gt;Operations restricted to token owners only&lt;&#x2F;li&gt;
&lt;li&gt;All data operations must maintain integrity and availability&lt;&#x2F;li&gt;
&lt;li&gt;Critical state changes (sealed keys, ownership, permissions) must be atomic and verifiable&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Sealed Executor&lt;&#x2F;strong&gt;
&lt;ul&gt;
&lt;li&gt;Although out of scope for this standard, the Sealed Executor is crucial for secure operation&lt;&#x2F;li&gt;
&lt;li&gt;The Sealed Executor authenticates users and processes requests in a secure environment by verifying user signatures against authorized public keys for each tokenId&lt;&#x2F;li&gt;
&lt;li&gt;The Sealed Executor can be implemented through a trusted party (where permitted), TEE or FHE&lt;&#x2F;li&gt;
&lt;li&gt;Ensuring secure request processing and result delivery&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Chain-Specific Payment Requests</title>
        <published>2025-01-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Jack Chuma</name><uri>https://github.com/jackchuma</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7856/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/add-erc-chain-specific-payment-requests/22379" />
        

        <id>https://wg-eips.ritovision.com/7856/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7856"
            label="ERC-7856" />
        

        
        

        
        <summary type="html">A URI scheme for chain-specific payment requests.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7856/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes a standardized URI scheme for chain-specific payment requests, enabling users to specify transactions in the form &quot;send me X tokens of type Y on chain Z&quot;. The URI format includes essential components such as the recipient&#x27;s blockchain account, the amount of tokens, the token contract address, and optional success and error callback URLs. This standard aims to eliminate ambiguity in multi-chain payment requests, ensuring clarity and accuracy in peer-to-peer transactions and vendor or dApp requests across different blockchain networks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The ongoing expansion of the Ethereum network into a multi-chain ecosystem has introduced complexities regarding the execution of payment requests. Users and developers currently face a lack of clarity on which chain a payment request should be fulfilled, particularly when similar assets exist across multiple chains. This ambiguity complicates peer-to-peer transactions and vendor or dApp requests, leading to inefficiencies and a higher potential for errors. This standard will ensure that payment requests are clearly understood and correctly executed, regardless of the chain, thus significantly enhancing the user experience in a multi-chain environment.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;The format of the payment request URI is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cspr:&#x2F;&#x2F;&amp;lt;recipient&amp;gt;&#x2F;&amp;lt;amount&amp;gt;&#x2F;&amp;lt;token-address&amp;gt;?on-success=&amp;lt;success-callback-url&amp;gt;&amp;amp;on-error=&amp;lt;error-callback-url&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;cspr:&#x2F;&#x2F;&lt;&#x2F;code&gt; - [REQUIRED] Short for &quot;Chain-Specific Payment Request&quot;. Indicates a blockchain-based payment request.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;&amp;lt;recipient&amp;gt;&lt;&#x2F;code&gt; - [REQUIRED] The blockchain account requesting the payment (represented as a CAIP-10 account identifier).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;&amp;lt;amount&amp;gt;&lt;&#x2F;code&gt; - [REQUIRED] The amount of tokens to be sent, specified as an integer or decimal number.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;&amp;lt;token-address&amp;gt;&lt;&#x2F;code&gt; - [REQUIRED] The contract address of the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; token to send (represented as a base64 encoded string). The special value &lt;code&gt;native&lt;&#x2F;code&gt; can be used to request the native currency of the specified chain (if the chain supports a native currency).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;&amp;lt;success-callback-url&amp;gt;&lt;&#x2F;code&gt; - [OPTIONAL] The URL to redirect the user to after the transaction is confirmed.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;&amp;lt;error-callback-url&amp;gt;&lt;&#x2F;code&gt; - [OPTIONAL] The URL to redirect the user to after the transaction fails.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;examples&quot;&gt;Examples&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;requesting-1-eth-on-base-mainnet-to-address-0x1111111111111111111111111111111111111111-with-a-specified-success-callback-url&quot;&gt;Requesting 1 eth on Base Mainnet to address &lt;code&gt;0x1111111111111111111111111111111111111111&lt;&#x2F;code&gt; with a specified success callback URL:&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cspr:&#x2F;&#x2F;eip155:8453:0x1111111111111111111111111111111111111111&#x2F;1&#x2F;native?on-success=https:&#x2F;&#x2F;example.com&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;requesting-0-5-btc-on-bitcoin-mainnet&quot;&gt;Requesting 0.5 BTC on Bitcoin mainnet:&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cspr:&#x2F;&#x2F;bip122:000000000019d6689c085ae165831e93:128Lkh3S7CkDTBZ8W7BbpsN3YYizJMp8p6&#x2F;0.5&#x2F;native&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;requesting-100-usdc-on-ethereum-mainnet&quot;&gt;Requesting 100 USDC on Ethereum Mainnet:&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cspr:&#x2F;&#x2F;eip155:1:0xab16a96D359eC26a11e2C2b3d8f8B8942d5Bfcdb&#x2F;100&#x2F;0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;error-handling&quot;&gt;Error Handling&lt;&#x2F;h3&gt;
&lt;p&gt;Wallets or applications parsing these URIs MUST validate the format of the recipient account. If any component of the URI does not meet the specified requirements or format, an error should be displayed to the user.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The design of this URI standard for blockchain-based payment requests addresses the need for a clear and unambiguous method to initiate transactions across multiple Ethereum chains, including mainnet and various Layer 2 networks. The rationale for each component of the URI structure is as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;cspr:&#x2F;&#x2F;&lt;&#x2F;code&gt; Prefix:&lt;&#x2F;strong&gt; This prefix explicitly identifies the URI as a blockchain-based payment request, ensuring systems recognize and correctly handle these URIs. It follows the precedent of other protocol-specific URI schemes like &lt;code&gt;mailto:&#x2F;&#x2F;&lt;&#x2F;code&gt; for email and &lt;code&gt;http:&#x2F;&#x2F;&lt;&#x2F;code&gt; for web links.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Recipient:&lt;&#x2F;strong&gt; The recipient is specified using a CAIP-10 account identifier, a standardized format for representing blockchain addresses. With CAIP-10, you can easily identify the recipient’s blockchain network and corresponding address, regardless of the underlying address conventions.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Amount Specification:&lt;&#x2F;strong&gt; Specifying the amount in the URI clarifies the transaction&#x27;s intent, allowing users to verify the amount before sending. This helps prevent mistakes and fraud. The amount is specified as an integer or decimal number for clarity, precision, and ease of verification.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Token Address:&lt;&#x2F;strong&gt; Requiring the token address ensures the URI specifies the exact token to be sent, eliminating ambiguity. It supports both ERC-20 tokens and the native currency of a chain (if supported).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Callback URLs:&lt;&#x2F;strong&gt; Including callback URLs allows redirection to a specified URL after the transaction is confirmed or fails, enhancing the user experience by providing a seamless return to the application or website.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The token address in this URI standard is represented as a base64 encoded string to support both EVM and non-EVM chains, as all current address schemes are a subset of base64.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;alternative-designs-considered&quot;&gt;Alternative Designs Considered:&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Including Transaction Parameters: Additional transaction parameters (e.g., gas limit, gas price) were considered but are recommended to be handled by the user&#x27;s wallet application to keep the URI scheme focused on payment requests and avoid overloading the user with technical details.&lt;&#x2F;li&gt;
&lt;li&gt;Token Parameter Optionality: Initially, the token parameter was considered optional, with its omission implying the native currency of the specified chain. However, not all chains support a native currency, so requiring explicit token specification increases clarity and reduces potential errors.&lt;&#x2F;li&gt;
&lt;li&gt;An &lt;code&gt;ethereum:&#x2F;&#x2F;&lt;&#x2F;code&gt; prefix: Initially proposed as a standardized URI scheme for the Ethereum ecosystem, the &lt;code&gt;ethereum:&#x2F;&#x2F;&lt;&#x2F;code&gt; prefix aimed to provide a consistent identifier. However, to accommodate non-EVM chains, it is more practical to use a more generic identifier that is not limited to Ethereum.&lt;&#x2F;li&gt;
&lt;li&gt;ENS Support: We initially considered adding optional ENS support, but determined it was unnecessary. Because the URI scheme isn’t user-facing, including ENS would add unneeded complexity without providing tangible benefits. Additionally, ENS names that resemble addresses introduce potential security risks. Instead, adhering to the CAIP-10 standard for chain-specific account identifiers is a more practical choice.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;related-work&quot;&gt;Related Work&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;681&#x2F;&quot;&gt;ERC-681&lt;&#x2F;a&gt; is a related standard that defines a similar URI scheme for specifying token transfers in Ethereum. However, ERC-681 includes additional parameters for specifying transaction details, which were deemed unnecessary for the scope of this standard. The focus of this EIP is on simplicity and clarity in payment request specifications, with the expectation that transaction details will be handled by the user&#x27;s wallet application.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;831&#x2F;&quot;&gt;ERC-831&lt;&#x2F;a&gt; is another related standard that specifies a URI format for Ethereum. Instead of focusing exclusively on Ethereum and its rollups, this EIP is designed to be compatible with all blockchains. The primary distinction lies in the selection of the URI identifier.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Due to the unique choice in URI prefix, this EIP is not backwards compatible with ERC-681 or ERC-831.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;As there are many similarities to ERC-681, all the same security considerations apply and have been summarized below.&lt;&#x2F;p&gt;
&lt;p&gt;The security and trustworthiness of URLs are crucial, especially since they can trigger irreversible transactions. Altering the recipient&#x27;s address or the transaction amount can lead to significant financial gain for attackers. Therefore, users should only trust URLs from verified and secure sources.&lt;&#x2F;p&gt;
&lt;p&gt;To ensure the transaction amount matches the user&#x27;s intention, it should be clearly and easily verifiable by the user, including its magnitude. For ERC-20 token transactions, if the payer&#x27;s client can access the blockchain or another reliable source for token contract details, the interface should present the amount in the token&#x27;s specified units. If not, it should show the amount as stated in the URL, potentially warning the user about the uncertainty of the unit. Using scientific notation with an exponent that matches the token&#x27;s nominal unit (e.g., 18 for ether) is recommended to aid user verification.&lt;&#x2F;p&gt;
&lt;p&gt;Validate callback URLs rigorously to prevent redirection to phishing sites. Wallet developers should follow browser security best practices for URL validation.&lt;&#x2F;p&gt;
&lt;p&gt;Wallet applications must recognize chains that lack native currency support and should block native currency payment requests on these chains.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Deactivate&#x2F;Reactivate a Delegated EOA&#x27;s Key</title>
        <published>2024-12-27T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Liyi Guo</name><uri>https://github.com/colinlyguo</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7851/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7851-deactivate-reactivate-a-delegated-eoas-key/22344" />
        

        <id>https://wg-eips.ritovision.com/7851/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7851"
            label="EIP-7851" />
        

        
        

        
        <summary type="html">Introduce a new precompiled contract for EOAs with delegated code to deactivate or reactivate private keys.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7851/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a precompiled contract that enables Externally Owned Accounts (EOAs) with delegated control to smart contracts via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; to deactivate or reactivate their private keys. This design does not require additional storage fields or account state changes. By leveraging delegated code, reactivation can be performed securely through mechanisms such as social recovery.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; enables EOAs to gain smart contract capabilities, but the private key of the EOA still retains full control over the account.&lt;&#x2F;p&gt;
&lt;p&gt;With this EIP, EOAs can fully migrate to smart contract wallets, while retaining private key recovery options with reactivation. The flexible deactivate and reactivate design also paves the way for native account abstraction. e.g., &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7701&#x2F;&quot;&gt;EIP-7701&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;PRECOMPILE_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xTBD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;PRECOMPILE_GAS_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;13000&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;||&lt;&#x2F;code&gt; is the byte&#x2F;byte-array concatenation operator.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;delegated-code-encoding&quot;&gt;Delegated Code Encoding&lt;&#x2F;h3&gt;
&lt;p&gt;The deactivation status is encoded by appending or removing the &lt;code&gt;0x00&lt;&#x2F;code&gt; byte at the end of the delegated code. The transitions between two states are as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Active state: &lt;code&gt;0xef0100 || address&lt;&#x2F;code&gt;. The private key is active and can sign transactions.&lt;&#x2F;li&gt;
&lt;li&gt;Deactivated state: &lt;code&gt;0xef0100 || address || 0x00&lt;&#x2F;code&gt;. The private key is deactivated and cannot sign transactions or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; delegation authorizations.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;precompiled-contract&quot;&gt;Precompiled Contract&lt;&#x2F;h3&gt;
&lt;p&gt;A new precompiled contract is introduced at address &lt;code&gt;PRECOMPILE_ADDRESS&lt;&#x2F;code&gt;. It costs &lt;code&gt;PRECOMPILE_GAS_COST&lt;&#x2F;code&gt; and executes the following logic:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Returns a precompile contract error, consumes all gas, and no state changes are made if:
&lt;ul&gt;
&lt;li&gt;Gas is insufficient.&lt;&#x2F;li&gt;
&lt;li&gt;Called via &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; (i.e., in a read-only context).&lt;&#x2F;li&gt;
&lt;li&gt;Caller is not an EOA with delegated code (prefix &lt;code&gt;0xef0100&lt;&#x2F;code&gt; as per &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt;).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Updates caller&#x27;s delegated code based on length:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;23&lt;&#x2F;code&gt; bytes (&lt;code&gt;0xef0100 || address&lt;&#x2F;code&gt;): Appends &lt;code&gt;0x00&lt;&#x2F;code&gt; to deactivate private key authorization.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;24&lt;&#x2F;code&gt; bytes (&lt;code&gt;0xef0100 || address || 0x00&lt;&#x2F;code&gt;): Removes last byte &lt;code&gt;0x00&lt;&#x2F;code&gt; to activate private key authorization.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Saves updated code as caller&#x27;s new account code.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;transaction-validation&quot;&gt;Transaction Validation&lt;&#x2F;h3&gt;
&lt;p&gt;Validation to check whether a private key is deactivated (identified by a code prefix &lt;code&gt;0xef0100&lt;&#x2F;code&gt; and a code length of &lt;code&gt;24&lt;&#x2F;code&gt;) MUST be performed in the following scenarios:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;During transaction validity checks before execution, nodes MUST reject transactions signed with deactivated private keys to ensure such transactions cannot be included in blocks.&lt;&#x2F;li&gt;
&lt;li&gt;The same validation MUST be applied to the transaction pool when receiving new transactions to prevent invalid transactions from propagating through the network.&lt;&#x2F;li&gt;
&lt;li&gt;Any &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; authorization issued by an authority with a deactivated private key MUST be treated as invalid and skipped.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;cost-of-precompiled-contract&quot;&gt;Cost of Precompiled Contract&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;PRECOMPILE_GAS_COST&lt;&#x2F;code&gt; represents the gas required to validate and potentially update an account&#x27;s code. A fair cost for calling this precompiled contract can be determined by analyzing its impact on the node:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Reading the code of the address: &lt;code&gt;2600&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Changing the code hash (from non-zero to non-zero): &lt;code&gt;5000&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Deploying at most &lt;code&gt;24&lt;&#x2F;code&gt; bytes of code: &lt;code&gt;200 * 24 = 4800&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The primary operation consumes a total of &lt;code&gt;12400&lt;&#x2F;code&gt; gas. To account for additional overhead, such as context switching during state transitions, as well as code prefix and length validations, the cost is rounded up to &lt;code&gt;13000&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;additional-transaction-validation-overhead&quot;&gt;Additional Transaction Validation Overhead&lt;&#x2F;h3&gt;
&lt;p&gt;Due to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3607&#x2F;&quot;&gt;EIP-3607&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt;, nodes already load the account code during transaction validation to verify whether the sender is an EOA (empty code or code with prefix &lt;code&gt;0xef0100&lt;&#x2F;code&gt;). This EIP introduces only a code length check after loading the code, resulting in minimal additional overhead. Similarly, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt;’s authorization validation already involves retrieving the account code, with this EIP adding only a code length check, which is negligible compared to code reading.&lt;&#x2F;p&gt;
&lt;p&gt;Transaction pools already perform state-based checks, such as those for nonce and balance. This EIP adds an account code read and a length check, which together are comparable to nonce and balance validations. DoS prevention mechanisms, expected in transaction pools, also support these additional checks.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;an-alternative-eoa-deprecation-approach&quot;&gt;An Alternative EOA Deprecation Approach&lt;&#x2F;h3&gt;
&lt;p&gt;An alternative deprecation approach involves using a hard fork to edit all existing and new EOAs to pre-written upgradeable smart contracts, which utilize the original EOA private key for authorization. Users can add and replace keys, or upgrade the smart contracts to other implementations. However, this approach is incompatible with EOAs already delegated to smart contracts, as it will overwrite the existing smart contract implementations. This EIP aims to fill this migration gap.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;using-a-precompiled-contract&quot;&gt;Using a Precompiled Contract&lt;&#x2F;h3&gt;
&lt;p&gt;Alternative methods for deactivating and reactivating EOA private keys include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Adding a new transaction type: Introducing a new transaction type could provide a mechanism to deactivate and reactivate EOA private keys. However, reactivating the private key would rely on a delegated contract as the authorizer, which complicates defining the rules for the new transaction type.&lt;&#x2F;li&gt;
&lt;li&gt;Deploying a smart contract: Compared to reusing the code field, using a smart contract has higher costs: (i) it requires new contract storage slots to track the deactivation status of each address (ii) executing bytecode increases the overhead of the node compared to precompiled contracts, (iii) during transaction validation, reusing the code field allows deactivation status check to be combined with existing code loading in some scenarios, thereby reducing the need for additional storage reads, as discussed in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7851&#x2F;#additional-transaction-validation-overhead&quot;&gt;Additional Transaction Validation Overhead&lt;&#x2F;a&gt; section.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;in-protocol-reactivation&quot;&gt;In-Protocol Reactivation&lt;&#x2F;h3&gt;
&lt;p&gt;This approach ensures maximum compatibility with future migrations. EOAs can reactivate their private keys, delegate their accounts to an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7701&#x2F;&quot;&gt;EIP-7701&lt;&#x2F;a&gt; contract, and then deactivate their private keys again. This avoids the limitations of contract upgrades. e.g., to remove legacy proxy contracts (reducing gas overhead) when upgrading to EOF contracts, one can reactivate the EOA and redelegate it to an EOF proxy contract.&lt;&#x2F;p&gt;
&lt;p&gt;Reactivation can only be performed by the delegated contract. Since reactivating the private key grants full control over the wallet, wallets must implement this interface with strict security measures. These measures should treat reactivation as the highest level of authority, equivalent to full wallet ownership. Users should delegate their EOAs only to wallets that have been thoroughly audited and follow best practices for security.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;avoiding-delegated-code-prefix-modification&quot;&gt;Avoiding Delegated Code Prefix Modification&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP appends a byte (&lt;code&gt;0x00&lt;&#x2F;code&gt;) to the delegated code instead of modifying the prefix (&lt;code&gt;0xef0100&lt;&#x2F;code&gt;) of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; to ensure forward compatibility. If new prefixes such as &lt;code&gt;0xef0101&lt;&#x2F;code&gt; are introduced in the future, changing the prefix to represent the deactivated status (e.g., &lt;code&gt;0xef01ff&lt;&#x2F;code&gt;) makes it unclear which prefix to restore (&lt;code&gt;0xef0100&lt;&#x2F;code&gt; or &lt;code&gt;0xef0101&lt;&#x2F;code&gt;) upon reactivation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;avoiding-account-state-changes&quot;&gt;Avoiding Account State Changes&lt;&#x2F;h3&gt;
&lt;p&gt;An alternative is to add a &lt;code&gt;deactivated&lt;&#x2F;code&gt; field in the account state to track the status. However, this approach will introduce backward compatibility logic and more test vectors related to this optional field when enabling this EIP, because the field is not present in existing accounts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;When the private key is deactivated, this EIP introduces: (i) an extra byte (&lt;code&gt;0x00&lt;&#x2F;code&gt;) to be appended to the end of the delegated code, and (ii) the delegated code length becomes &lt;code&gt;24&lt;&#x2F;code&gt; bytes (e.g., &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; would return &lt;code&gt;24&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;These changes are not breaking. However, they require protocol, application, and contract implementations to use strict offsets to parse the delegated address correctly. Implementations must also check the delegated code prefix &lt;code&gt;0xef0100&lt;&#x2F;code&gt; to determine whether it represents an EOA with delegated code, while avoiding over-restrictive checks, such as asserting the code length to be exactly &lt;code&gt;23&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Initialize the state database and precompiled contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;state_db&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; StateDB&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;precompile&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; PrecompiledContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Test 1: Valid activation and deactivation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;caller&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0123&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;delegated_addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;fromhex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1122334455667788990011223344556677889900&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;active_code&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; PrecompiledContract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;DELEGATED_CODE_PREFIX&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; delegated_addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Active state&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;state_db&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;set_code&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;caller&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; active_code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;error&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; gas_left&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; precompile&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;execute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;caller&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; state_db&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;15000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span&gt; error&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span&gt; state_db&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get_code&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;caller&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; active_code&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\x00&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Deactivated state&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span&gt; gas_left&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 15000&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; PrecompiledContract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;PRECOMPILE_GAS_COST&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;error&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; gas_left&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; precompile&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;execute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;caller&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; state_db&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;15000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span&gt; error&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span&gt; state_db&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get_code&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;caller&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; active_code&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Turns to the active state again&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span&gt; gas_left&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 15000&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; PrecompiledContract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;PRECOMPILE_GAS_COST&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Test 2: Error cases&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;error&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; gas_left&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; precompile&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;execute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;caller&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; state_db&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;15000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; read_only&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;True&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span&gt; error&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;STATICCALL disallows state modification&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span&gt; gas_left&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;error&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; gas_left&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; precompile&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;execute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;caller&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; state_db&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;PrecompiledContract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;PRECOMPILE_GAS_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span&gt; error&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;insufficient gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span&gt; gas_left&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;caller&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x4567&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; EOA that is not delegated to code&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;error&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; gas_left&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; precompile&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;execute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;caller&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; state_db&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;15000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span&gt; error&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;the address is not an EOA delegated to code&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span&gt; gas_left&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;caller&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x89ab&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This is a contract address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;state_db&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;set_code&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;caller&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;fromhex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;60006000f3&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;error&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; gas_left&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; precompile&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;execute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;caller&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; state_db&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;15000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span&gt; error&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;the address is not an EOA delegated to code&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span&gt; gas_left&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PrecompiledContract&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    DELEGATED_CODE_PREFIX&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;fromhex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ef0100&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    PRECOMPILE_GAS_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 13000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; execute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; caller&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; state_db&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; gas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; read_only&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;False&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        Switch the private key state of delegated EOAs between active and deactivated.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        Parameters:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        - caller: The address calling the contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        - state_db: The state database&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        - gas: Gas provided for execution&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        - read_only: Whether called in a read-only context&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        Returns:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        - Tuple of (result, gas_left)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;          result: error bytes on failure, empty bytes on success&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;          gas_left: remaining gas, 0 on error&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;PRECOMPILE_GAS_COST&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;insufficient gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check STATICCALL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; read_only&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;STATICCALL disallows state modification&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get and validate caller&amp;#39;s code&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        code&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state_db&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get_code&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;caller&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; code&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;startswith&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;DELEGATED_CODE_PREFIX&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;the address is not an EOA delegated to code&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Update delegated code based on length&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 23&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Active state&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            state_db&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;set_code&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;caller&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; code&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\x00&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Deactivate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        elif&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 24&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Deactivated state&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            state_db&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;set_code&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;caller&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; code&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Activate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Although this is not possible, it&amp;#39;s added for completeness&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;invalid delegated code length&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;PRECOMPILE_GAS_COST&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; StateDB&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Simplified state database, omitting other account fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; __init__&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;accounts&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_code&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;accounts&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;code&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; set_code&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;accounts&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;accounts&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;accounts&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;code&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;contracts-using-ecdsa-secp256k1-signatures&quot;&gt;Contracts Using ECDSA &lt;code&gt;Secp256k1&lt;&#x2F;code&gt; Signatures&lt;&#x2F;h3&gt;
&lt;p&gt;Contracts that have already been deployed and use ECDSA &lt;code&gt;secp256k1&lt;&#x2F;code&gt; signatures outside of transaction signatures (e.g., &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens that support &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2612&#x2F;&quot;&gt;ERC-2612&lt;&#x2F;a&gt;, the &lt;code&gt;permit&lt;&#x2F;code&gt; function) will not be able to verify the deactivated status of the EOA. This means that signatures signed by private keys will remain valid in these functions.&lt;&#x2F;p&gt;
&lt;p&gt;To handle deactivated EOAs, new or upgradeable contracts can check the signing address&#x27;s deactivation status, for example:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Use &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; to get the account&#x27;s code length.&lt;&#x2F;li&gt;
&lt;li&gt;If the code length is &lt;code&gt;24&lt;&#x2F;code&gt; bytes, use &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt; to verify the code starts with &lt;code&gt;0xef0100&lt;&#x2F;code&gt; (delegated code prefix).&lt;&#x2F;li&gt;
&lt;li&gt;If both conditions are satisfied (i.e., the code size is &lt;code&gt;24&lt;&#x2F;code&gt; bytes and the code starts with &lt;code&gt;0xef0100&lt;&#x2F;code&gt;), the private key is confirmed to be deactivated, and the signature should be rejected.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;For non-upgradeable contracts, the above method cannot be applied directly. Another potential solution, at the protocol level, is to modify &lt;code&gt;ecRecover&lt;&#x2F;code&gt; precompiled contract: if the private key of the recovered address is deactivated, the &lt;code&gt;ecRecover&lt;&#x2F;code&gt; precompiled contract could return a precompile contract error (or, if not adding an error return path, return a zero address or a collision-resistant address, such as &lt;code&gt;0x1&lt;&#x2F;code&gt;). However, this approach also has limitations, as it cannot cover cases where contracts implement their own signature verification logic without relying on &lt;code&gt;ecRecover&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;irreversible-deactivation&quot;&gt;Irreversible Deactivation&lt;&#x2F;h3&gt;
&lt;p&gt;Delegating to a wallet that lacks reactivation support (e.g., by calling the precompiled contract through an appropriate interface) may result in irreversible deactivation. To mitigate this risk, users should delegate their EOAs only to thoroughly audited implementations that explicitly support this EIP.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;deactivation-and-reactivation-replay&quot;&gt;Deactivation and Reactivation Replay&lt;&#x2F;h3&gt;
&lt;p&gt;Replay attacks can occur in two scenarios: (i) repeating the same authorization on a single chain, or (ii) using the authorization across different chains.&lt;&#x2F;p&gt;
&lt;p&gt;For deactivation through EOA-signed transactions, the use of nonces in transactions ensures the same message cannot be replayed multiple times on the same chain. Additionally, the replay protection mechanism provided by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt;, if enabled, effectively prevents cross-chain message replay.&lt;&#x2F;p&gt;
&lt;p&gt;For deactivation or reactivation via delegated contracts, the contract should implement robust replay protection mechanism(s) (e.g., adding a customized nonce and the chain ID to the signed message) to safeguard against replay attacks both within the same chain and across different chains. Especially when the EOA has been (or will be) delegated to the same implementation on multiple chains.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Increase Access List Cost</title>
        <published>2024-12-27T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Toni Wahrstätter</name><uri>https://github.com/nerolation</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7981/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7981-increase-access-list-cost/24680" />
        

        <id>https://wg-eips.ritovision.com/7981/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7981"
            label="EIP-7981" />
        

        
        

        
        <summary type="html">Price access lists for data to reduce maximum block size</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7981/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP charges access lists for their data footprint, preventing the circumvention of the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7623&#x2F;&quot;&gt;EIP-7623&lt;&#x2F;a&gt; floor pricing. This effectively reduces the worst-case block size by ~21% with minimal impact on users.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Access lists are only priced for storage but not for their data.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore, access lists can circumvent the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7623&#x2F;&quot;&gt;EIP-7623&lt;&#x2F;a&gt; floor pricing by contributing to EVM gas while still leaving a non-negligible data footprint. This enables achieving the maximal possible block size by combining access lists with calldata at a certain ratio.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Source&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ACCESS_LIST_ADDRESS_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2400&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ACCESS_LIST_STORAGE_KEY_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;1900&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TOTAL_COST_FLOOR_PER_TOKEN&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;10&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7623&#x2F;&quot;&gt;EIP-7623&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Let &lt;code&gt;access_list_nonzero_bytes&lt;&#x2F;code&gt; and &lt;code&gt;access_list_zero_bytes&lt;&#x2F;code&gt; be the count of non-zero and zero bytes respectively in the addresses (20 bytes each) and storage keys (32 bytes each) contained within the access list.&lt;&#x2F;p&gt;
&lt;p&gt;Let &lt;code&gt;tokens_in_access_list = access_list_zero_bytes + access_list_nonzero_bytes * 4&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The access list cost formula changes from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930&lt;&#x2F;a&gt; to include data cost:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;access_list_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ACCESS_LIST_ADDRESS_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; access_list_addresses&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ACCESS_LIST_STORAGE_KEY_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; access_list_storage_keys&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TOTAL_COST_FLOOR_PER_TOKEN&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; tokens_in_access_list&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7623&#x2F;&quot;&gt;EIP-7623&lt;&#x2F;a&gt; floor calculation is modified to include access list tokens:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tokens_in_calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; zero_bytes_in_calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; nonzero_bytes_in_calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;total_data_tokens&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; tokens_in_calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; tokens_in_access_list&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;data_floor_gas_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TX_BASE_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TOTAL_COST_FLOOR_PER_TOKEN&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; total_data_tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The gas used calculation becomes:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gasUsed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    21000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    +&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        STANDARD_TOKEN_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; tokens_in_calldata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        +&lt;&#x2F;span&gt;&lt;span&gt; execution_gas_used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        +&lt;&#x2F;span&gt;&lt;span&gt; isContractCreation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32000&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; INITCODE_WORD_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; words&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;calldata&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        +&lt;&#x2F;span&gt;&lt;span&gt; access_list_cost&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        TOTAL_COST_FLOOR_PER_TOKEN&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; total_data_tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Any transaction with a gas limit below &lt;code&gt;21000 + TOTAL_COST_FLOOR_PER_TOKEN * total_data_tokens&lt;&#x2F;code&gt; or below its intrinsic gas cost is considered invalid.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Access list data is always charged at floor rate (added to &lt;code&gt;access_list_cost&lt;&#x2F;code&gt;), and access list tokens are included in the floor calculation. This ensures:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Access list data always pays floor rate regardless of execution level&lt;&#x2F;li&gt;
&lt;li&gt;Access lists cannot be used to bypass the calldata floor pricing&lt;&#x2F;li&gt;
&lt;li&gt;Consistent pricing across all transaction data sources&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This is a backwards incompatible gas repricing that requires a scheduled network upgrade.&lt;&#x2F;p&gt;
&lt;p&gt;Requires updates to gas estimation in wallets and nodes. Normal usage patterns remain largely unaffected.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calculate_access_list_tokens&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;access_list&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Tuple&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Access&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ...&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Count data tokens in access list addresses and storage keys.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    zero_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    nonzero_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; access&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; access_list&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; access&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                zero_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                nonzero_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; access&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slots&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            for&lt;&#x2F;span&gt;&lt;span&gt; byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; slot&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                if&lt;&#x2F;span&gt;&lt;span&gt; byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    zero_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    nonzero_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; zero_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; nonzero_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calculate_intrinsic_cost&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Transaction&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Tuple&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Uint&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Calculate intrinsic gas cost and floor gas cost.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Returns (intrinsic_gas, floor_gas).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Calldata tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    calldata_zero_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            calldata_zero_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    tokens_in_calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        calldata_zero_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;ulen&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; calldata_zero_bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Access list tokens and cost&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    tokens_in_access_list&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    access_list_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; has_access_list&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        tokens_in_access_list&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; calculate_access_list_tokens&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;access_list&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; access&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;access_list&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            access_list_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TX_ACCESS_LIST_ADDRESS_COST&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            access_list_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; ulen&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;access&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slots&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TX_ACCESS_LIST_STORAGE_KEY_COST&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; EIP-7981: Always charge data cost&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        access_list_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; tokens_in_access_list&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TOTAL_COST_FLOOR_PER_TOKEN&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; EIP-7981: Floor includes all data tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    total_data_tokens&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; tokens_in_calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; tokens_in_access_list&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    floor_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TX_BASE_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; total_data_tokens&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TOTAL_COST_FLOOR_PER_TOKEN&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Intrinsic gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    calldata_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; tokens_in_calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; STANDARD_TOKEN_COST&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    create_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TX_CREATE_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; init_code_cost&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt; is_create&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    intrinsic_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TX_BASE_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; calldata_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; create_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; access_list_cost&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; intrinsic_gas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; floor_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP closes a loophole that allows circumventing &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7623&#x2F;&quot;&gt;EIP-7623&lt;&#x2F;a&gt; floor pricing. Without this fix, attackers can achieve larger blocks than intended by combining access lists with calldata. All transaction data sources now contribute to the floor calculation consistently.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Delayed State Root</title>
        <published>2024-12-23T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Charlie Noyes</name><email>charlie@paradigm.xyz</email>
	</author>
	
	<author>
		<name>Dan Robinson</name><email>dan@paradigm.xyz</email>
	</author>
	
	<author>
		<name>Justin Drake</name><email>justin@ethereum.org</email>
	</author>
	
	<author>
		<name>Toni Wahrstätter</name><uri>https://github.com/nerolation</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7862/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7862-delayed-execution-layer-state-root/22559" />
        

        <id>https://wg-eips.ritovision.com/7862/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7862"
            label="EIP-7862" />
        

        
        

        
        <summary type="html">Separate state root computation from block validation</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7862/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal decouples state root computation from block validation by deferring the execution layer&#x27;s state root reference by one block. Each block&#x27;s header contains the post-state root of the previous block rather than its own. Validators can attest to block validity without waiting for state root computation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;State root computation is a significant bottleneck in block production. With &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7732&#x2F;&quot;&gt;EIP-7732&lt;&#x2F;a&gt; (ePBS), builders have tighter timing constraints. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7928&#x2F;&quot;&gt;EIP-7928&lt;&#x2F;a&gt; (Block-Level Access Lists) enables parallel state access but doesn&#x27;t help with state root computation for builders.&lt;&#x2F;p&gt;
&lt;p&gt;With delayed state roots:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Builders compute one state root per slot&lt;&#x2F;strong&gt; (for the previous block) instead of thousands during the MEV auction window&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;State root computation can use BAL data&lt;&#x2F;strong&gt; from the previous block to parallelize proof generation&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;The critical path shifts&lt;&#x2F;strong&gt;: state root computation is frontloaded to the beginning of the slot rather than blocking attestations&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The state root in block &lt;code&gt;n&lt;&#x2F;code&gt; represents the post-state of block &lt;code&gt;n-1&lt;&#x2F;code&gt; (equivalently: the pre-state of block &lt;code&gt;n&lt;&#x2F;code&gt;). Light clients experience one slot of additional latency for state proofs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;header&quot;&gt;Header&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;state_root&lt;&#x2F;code&gt; field semantics change. No new fields are added.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Header&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    parent_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ommers_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    coinbase&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Post-state of block (n-1), i.e., pre-state of this block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    transactions_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    receipt_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bloom&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bloom&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    difficulty&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    number&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_limit&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_used&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    timestamp&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; U256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    extra_data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    prev_randao&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    base_fee_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    withdrawals_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    blob_gas_used&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; U64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    excess_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; U64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    parent_beacon_block_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    requests_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block_access_list_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;blockchain&quot;&gt;BlockChain&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;BlockChain&lt;&#x2F;code&gt; object tracks the last computed state root:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BlockChain&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Block&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; State&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    chain_id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; U64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    last_computed_state_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;header-validation&quot;&gt;Header Validation&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validate_header&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;chain&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BlockChain&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; header&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Header&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        raise&lt;&#x2F;span&gt;&lt;span&gt; InvalidBlock&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    parent_header&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; chain&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;blocks&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify delayed state root matches the last computed state root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; chain&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;last_computed_state_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        raise&lt;&#x2F;span&gt;&lt;span&gt; InvalidBlock&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ... remaining validation unchanged&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;state-transition&quot;&gt;State Transition&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; state_transition&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;chain&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BlockChain&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    validate_header&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;chain&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block_env&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; vm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;BlockEnvironment&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block_output&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; apply_body&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        block_env&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;block_env&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        transactions&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;transactions&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        withdrawals&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;withdrawals&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Validate all roots except state_root (already validated in header)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; block_output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;block_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_used&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        raise&lt;&#x2F;span&gt;&lt;span&gt; InvalidBlock&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ... other validations&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Compute and store state root for the NEXT block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    chain&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;last_computed_state_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block_env&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    chain&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;blocks&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;chain&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;blocks&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 255&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        chain&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;blocks&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; chain&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;blocks&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;255&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;fork-activation&quot;&gt;Fork Activation&lt;&#x2F;h3&gt;
&lt;p&gt;At activation block &lt;code&gt;F&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; apply_fork&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;old&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BlockChain&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; BlockChain&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Initialize last_computed_state_root to current state root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; (post-state of block F-1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    old&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;last_computed_state_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;old&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; old&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Block &lt;code&gt;F&lt;&#x2F;code&gt; MUST contain the post-state root of block &lt;code&gt;F-1&lt;&#x2F;code&gt;. From &lt;code&gt;F+1&lt;&#x2F;code&gt; onwards, each block contains its parent&#x27;s post-state root.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;epbs-compatibility&quot;&gt;ePBS Compatibility&lt;&#x2F;h3&gt;
&lt;p&gt;With &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7732&#x2F;&quot;&gt;EIP-7732&lt;&#x2F;a&gt;, the &lt;code&gt;ExecutionPayloadEnvelope&lt;&#x2F;code&gt; contains a CL &lt;code&gt;state_root&lt;&#x2F;code&gt; verified at the end of &lt;code&gt;process_execution_payload&lt;&#x2F;code&gt;. This EIP changes only the EL header&#x27;s &lt;code&gt;state_root&lt;&#x2F;code&gt; semantics. The CL state root verification is unaffected.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;bal-synergy&quot;&gt;BAL Synergy&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7928&#x2F;&quot;&gt;EIP-7928&lt;&#x2F;a&gt; provides the block access list, which identifies all storage slots touched during execution. With delayed state roots, clients can:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Receive block &lt;code&gt;n&lt;&#x2F;code&gt; with BAL&lt;&#x2F;li&gt;
&lt;li&gt;Use the BAL to parallelize state root computation for block &lt;code&gt;n&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Include that root in block &lt;code&gt;n+1&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Without this EIP, BALs don’t help with state root computation: the root is only known after execution finishes, which is too late to use within the same slot. With this proposal, builders can start constructing a block without fully executing the previous one, by applying the BAL state diff to the slot’s pre-state.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;light-client-impact&quot;&gt;Light Client Impact&lt;&#x2F;h3&gt;
&lt;p&gt;State proofs for block &lt;code&gt;n&lt;&#x2F;code&gt; require waiting for block &lt;code&gt;n+1&lt;&#x2F;code&gt;. Most light client protocols already tolerate multi-block delays for proof generation. The security model is unchanged; only timing shifts by one slot.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Requires a hard fork. Clients that do not implement this change will reject blocks with delayed state roots.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;reorganization-handling&quot;&gt;Reorganization Handling&lt;&#x2F;h3&gt;
&lt;p&gt;During reorgs, clients MUST recompute &lt;code&gt;last_computed_state_root&lt;&#x2F;code&gt; for each block in the new canonical chain. The delayed nature does not affect reorg logic.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;pre-state-availability&quot;&gt;Pre-state Availability&lt;&#x2F;h3&gt;
&lt;p&gt;Clients MUST retain the pre-state (post-state of parent block) until the current block&#x27;s state root is included in the next block. This is already standard practice for reorg handling.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>On-chain upgrade signaling</title>
        <published>2024-12-22T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>William Entriken</name><uri>https://github.com/fulldecent</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7848/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7848-on-chain-upgrade-signaling/22306" />
        

        <id>https://wg-eips.ritovision.com/7848/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7848"
            label="EIP-7848" />
        

        
        

        
        <summary type="html">Allows participants to indicate readiness for a client upgrade when producing blocks</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7848/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal adds a mechanism for clients to signal their willingness for a network upgrade by including a “reference implementation hash” field in each block. A network upgrade activates only if enough blocks specify that they are using the new software.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, upgrades to Ethereum Mainnet are announced on the ethereum.org blog. This proposal changes that process by activating upgrades based on the consent of network participants.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Ethereum consensus clients shall identify with a reference implementation having its equivalent behaviors.&lt;&#x2F;p&gt;
&lt;p&gt;Ethereum consensus clients shall include a &lt;code&gt;referenceImplementationHash&lt;&#x2F;code&gt; (specified below) field immediately following the &lt;code&gt;extraData&lt;&#x2F;code&gt; field in the block header.&lt;&#x2F;p&gt;
&lt;p&gt;Proposed new Ethereum consensus clients shall initially behave as the then-current network does. If, and only if, a successful upgrade (defined below) is activated will the new behavior take effect.&lt;&#x2F;p&gt;
&lt;p&gt;When a network participant is willing to support a network upgrade, they shall immediately begin using the new software. The blocks they create including the new &lt;code&gt;referenceImplementationHash&lt;&#x2F;code&gt; will contribute to the network upgrade activation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;the-reference-implementation-hash&quot;&gt;The Reference Implementation Hash&lt;&#x2F;h3&gt;
&lt;p&gt;When proposing a network upgrade, the proposer shall point to a published, feature-complete reference implementation including the new software behaviors.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;strong&gt;reference implementation hash&lt;&#x2F;strong&gt; is the SHA-256 hash of the tarred source code of this reference implementation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;verification&quot;&gt;Verification&lt;&#x2F;h3&gt;
&lt;p&gt;Network participants shall study the reference implementation and decide whether they support an upgrade.&lt;&#x2F;p&gt;
&lt;p&gt;Network participants shall study any specific software they will run and ensure it faithfully implements the behaviors consistent with that reference implementation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;upgrade&quot;&gt;Upgrade&lt;&#x2F;h3&gt;
&lt;p&gt;Upgrade proposals (often referred to as hard fork EIPs) must specify an upgrade window and threshold. These parameters are implemented in the consensus client:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;VOTING_WINDOW_BEGIN&lt;&#x2F;code&gt;: the first block (inclusive) to count votes.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;VOTING_WINDOW_END&lt;&#x2F;code&gt;: the last block (inclusive) to count votes.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;REFERENCE_IMPLEMENTATION_HASH&lt;&#x2F;code&gt;: this is defined above.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;REQUIRED_APPROVALS&lt;&#x2F;code&gt;: the minimum number of approvals necessary for the upgrade.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The difference (&lt;code&gt;VOTING_WINDOW_END&lt;&#x2F;code&gt; - &lt;code&gt;VOTING_WINDOW_BEGIN&lt;&#x2F;code&gt;) must be strictly greater than 14400 (about two days) and should be chosen to provide sufficient time to advertise the upgrade to network participants.&lt;&#x2F;p&gt;
&lt;p&gt;The required approvals must be strictly greater than 50% of the blocks in the voting window. A higher threshold (such as 95% or more) is recommended.&lt;&#x2F;p&gt;
&lt;p&gt;When the block numbered &lt;code&gt;VOTING_WINDOW_END&lt;&#x2F;code&gt; is created, the upgrade is considered &quot;activated&quot; if &lt;code&gt;REQUIRED_APPROVALS&lt;&#x2F;code&gt; or more blocks during the voting window had set &lt;code&gt;referenceImplementationHash&lt;&#x2F;code&gt; to the value &lt;code&gt;REFERENCE_IMPLEMENTATION_HASH&lt;&#x2F;code&gt;; otherwise, the upgrade fails.&lt;&#x2F;p&gt;
&lt;p&gt;Blocks created from &lt;code&gt;VOTING_WINDOW_END&lt;&#x2F;code&gt; + 1 onward will use the new software behaviors if and only if the upgrade was successful.&lt;&#x2F;p&gt;
&lt;p&gt;For proof-of-work networks and other scenarios, it is possible that one fork activates the upgrade while another does not. In any case, blocks strictly greater than &lt;code&gt;VOTING_WINDOW_END&lt;&#x2F;code&gt; shall be created according to the behaviors of the software considering the outcome of the votes in the voting window which are the ancestors of that block.&lt;&#x2F;p&gt;
&lt;p&gt;Note: Just because an upgrade was activated, this does not necessarily mean that the new software behaviors must generate block &lt;code&gt;VOTING_WINDOW_END&lt;&#x2F;code&gt; + 1 differently than the old software behaviors. Perhaps the new software behaviors will stipulate that only blocks at some later time will generate differently. Perhaps the new software behaviors include some other consensus change which does not change how blocks are created.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;forking-is-no-longer-possible&quot;&gt;Forking is no Longer Possible&lt;&#x2F;h3&gt;
&lt;p&gt;Since the merge, forking Ethereum Mainnet has become practically impossible. Validators stake valuable assets to participate in the network, so any rational validator will choose to upgrade only if they expect widespread adoption. If a validator expects 95% or more participants to upgrade, they should upgrade; if they expect only 5% or less, they should not. For intermediate cases, there is a threshold where a validator would rationally shut down (incurring a small penalty) rather than risk participating in the wrong network—which could result in slashing 100% of their staked ether (currently 16 Ether per share).&lt;&#x2F;p&gt;
&lt;p&gt;Therefore, proper management of consensual upgrades is crucial.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;community-direction&quot;&gt;Community Direction&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;The Ethereum project and community do not have an official mission statement or vision. However, this proposal asserts that the Ethereum community would prefer Ethereum Mainnet to be a community-directed project.&lt;&#x2F;li&gt;
&lt;li&gt;On-chain signaling of upgrades enables community direction in a way that is not possible today.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;window&quot;&gt;Window&lt;&#x2F;h3&gt;
&lt;p&gt;Using a voting window to count votes provides real-time on-chain feedback about upgrade readiness. The upgrade is activated only after the successful completion of the voting window.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;trademark&quot;&gt;Trademark&lt;&#x2F;h3&gt;
&lt;p&gt;The Ethereum Foundation (Stiftung Ethereum), Zug, Switzerland, owns the trademark “Ethereum.” As a result, if anybody publishes a proposed Ethereum Mainnet consensus client, the foundation may have the right to restrict marketing of that software as an “Ethereum” client. That also poses unique risks related to securities rules.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;eip-2124&quot;&gt;EIP-2124&lt;&#x2F;h3&gt;
&lt;p&gt;EIP-2124 introduces a mechanism to communicate software versions between nodes. However, it does not allow for signaling readiness before an upgrade, nor does it specify what software is being upgraded to.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Any upgrade that achieves less than 100% participation will harm validators who do not participate.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Overlapping or competitive upgrades must be managed carefully; such scenarios could result in multiple networks achieving the minimum approval threshold.&lt;&#x2F;li&gt;
&lt;li&gt;An upgrade with an excessively long time period could hinder&#x2F;delay the proposal of subsequent upgrades.&lt;&#x2F;li&gt;
&lt;li&gt;Since the four voting parameters are embedded in the reference implementation, network participants must exercise due diligence to ensure that they understand the actual software behaviors.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights have been waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Social Media NFTs</title>
        <published>2024-12-18T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Nick Juntilla</name><uri>https://github.com/nickjuntilla</uri><email>nick@ownerfy.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7847/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7847-social-media-nfts/22280" />
        

        <id>https://wg-eips.ritovision.com/7847/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7847"
            label="ERC-7847" />
        

        
        

        
        <summary type="html">Create a social media post or publication in the form of an NFT.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7847/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal defines a standardized format for representing decentralized social media posts as NFTs. The Nostr protocol has done most of the heavy lifting for creating an open decentralized social media network. This ERC serves to adapt those standards to the most common blockchain non-fungible token standard. In this way we can take advantage of the reach and longevity of a blockchain. It is genericized here so that it can be easily mapped to other event based decentralized social media like the AT protocol. An event can be used as a social media post, blog post, forum post, encrypted message, RSS feed or arbitrary electronic publication. This model is flexible where the meaning and type of an event (original, reply, repost, images, video, text, etc...) is derived from its metadata. A user is anyone who has a private key. There is no permission required and anyone can create content using any NFT contract. Anyone can collate that content into a feed or timeline.&lt;&#x2F;p&gt;
&lt;p&gt;Posts may be &quot;owned&quot; by their creators, but the owner of the NFT itself is not meaningful in the standard. This may be a useful mechanic for financial purposes, but the independent signature of the post allows for a third party to publish a message on behalf of another user.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;With the continued censorship and manipulation of social media platforms, it becomes increasingly important for truly decentralized and permissionless social media to exist. Unlike other attempts at blockchain decentralized social media, this method does not rely on a centralized set of smart contracts. Blockchain integration of author-signed event based social media simply adds a powerful substrate for standardized decentralized social media to exist in. The benefits of blockchain include, but are not limited to, longevity, censorship resistance, monetary, and neutrality. The NFT standard is the most common and widely used standard for representing unique digital data on the blockchain. Using the NFT standard and standard NFT properties means that every marketplace, wallet and app that makes NFTs viewable is also a publication channel. With the data publicly available, custom feed algorithms can also be built to give control back to users.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;to-derive-the-id&quot;&gt;To derive the id&lt;&#x2F;h3&gt;
&lt;p&gt;To obtain the id, we sha256 the serialized attributes in this order. The serialization is done over the UTF-8 JSON-serialized string of the following structure:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;  0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;  &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;p&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;b&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;k&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;y&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; l&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;w&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; h&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;x&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;g&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;  &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;d&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;_&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;x&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;m&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;m&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;p&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;d&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;  &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;k&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;d&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;m&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;b&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;  &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;g&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;y&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; o&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;y&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; o&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;null&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;g&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;  &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;g&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;To prevent implementation differences from creating a different event ID for the same event, the following rules MUST be followed while serializing:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;UTF-8 should be used for encoding.&lt;&#x2F;li&gt;
&lt;li&gt;Preceding and trailing whitespace must be trimmed from serialized JSON and field values.&lt;&#x2F;li&gt;
&lt;li&gt;If spaces are used in tags they must be single spaces within array values.&lt;&#x2F;li&gt;
&lt;li&gt;The following characters in the content field must be escaped as shown, and all other characters must be included verbatim:
&lt;ul&gt;
&lt;li&gt;A line break (0x0A), use \n&lt;&#x2F;li&gt;
&lt;li&gt;A double quote (0x22), use &quot;&lt;&#x2F;li&gt;
&lt;li&gt;A backslash (0x5C), use \&lt;&#x2F;li&gt;
&lt;li&gt;A carriage return (0x0D), use \r&lt;&#x2F;li&gt;
&lt;li&gt;A tab character (0x09), use \t&lt;&#x2F;li&gt;
&lt;li&gt;A backspace, (0x08), use \b&lt;&#x2F;li&gt;
&lt;li&gt;A form feed, (0x0C), use \f&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;kinds&quot;&gt;Kinds&lt;&#x2F;h3&gt;
&lt;p&gt;0: User metadata: the content is set to a stringified JSON object {name: &lt;code&gt;&amp;lt;username&amp;gt;&lt;&#x2F;code&gt;, about: &lt;code&gt;&amp;lt;string&amp;gt;&lt;&#x2F;code&gt;, picture: &lt;code&gt;&amp;lt;url, string&amp;gt;&lt;&#x2F;code&gt;} describing the user who created the event. Extra metadata fields may be set. A relay may delete older events once it gets a new one for the same pubkey.
1: Original content: original generated user content is usually accompanied by short-form text, but may include off-chain or on-chain references to other media or events.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;tags&quot;&gt;Tags&lt;&#x2F;h3&gt;
&lt;p&gt;Tags are a flexible mechanism to attach additional structured data to a post. Each tag is an array of one or more strings, with some conventions around them.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The blockchain tag is &lt;strong&gt;recommended&lt;&#x2F;strong&gt; for events published using this method.
&lt;code&gt;[&quot;blockchain&quot;, &quot;&amp;lt;blockchain-name-or-id&amp;gt;&quot;, &quot;&amp;lt;contract&amp;gt;&quot;, &quot;&amp;lt;token_id&quot;&amp;gt;]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;&amp;lt;blockchain-name-or-id&amp;gt;&lt;&#x2F;code&gt; is the name of the chain. e.g. &quot;Ethereum&quot;, &quot;Polygon&quot;, &quot;Base&quot; or chain id. e.g. &quot;1&quot;, &quot;137&quot;, &quot;8453&quot;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;&amp;lt;contract&amp;gt;&lt;&#x2F;code&gt; is the contract address. e.g. &quot;0x0000000000000000000000000000000000000000&quot;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;&amp;lt;token_id&amp;gt;&lt;&#x2F;code&gt; is the token id. e.g. &quot;12345&quot;. The token_id may be omitted if it is not known before publication as it is part of the signed data.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Optional tags:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Multiple media tags can be attached by using multiple imeta tags &lt;code&gt;[&quot;imeta&quot;, ...]&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;imeta&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;dim 1920x1080&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;url &amp;lt;URL&amp;gt;&#x2F;1080&#x2F;12345.mp4&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;m video&#x2F;mp4&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;References to Other Posts:
&lt;code&gt;[&quot;e&quot;, &quot;&amp;lt;id_of_referenced_post&amp;gt;&quot;]&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Public addresses involved in this post:
&lt;code&gt;[&quot;p&quot;, &quot;&amp;lt;pubkey&amp;gt;&quot;, ...]&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;External URLs:
&lt;code&gt;[&quot;r&quot;, &quot;&amp;lt;URL&amp;gt;&quot;]&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;metadata-json&quot;&gt;Metadata JSON&lt;&#x2F;h3&gt;
&lt;p&gt;Event fields are stored in the NFT&#x27;s metadata under &lt;code&gt;attributes&lt;&#x2F;code&gt;. The &lt;code&gt;description&lt;&#x2F;code&gt; field of the NFT is identical to &lt;code&gt;content&lt;&#x2F;code&gt;. The &lt;code&gt;name&lt;&#x2F;code&gt; may be user defined or include the author and time created. All attributes besides &lt;code&gt;id&lt;&#x2F;code&gt;, &lt;code&gt;pubkey&lt;&#x2F;code&gt;, &lt;code&gt;created_at&lt;&#x2F;code&gt;, &lt;code&gt;kind&lt;&#x2F;code&gt;, &lt;code&gt;sig&lt;&#x2F;code&gt;, and &lt;code&gt;content&lt;&#x2F;code&gt; are assumed to be event tags.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;title of post&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;string should match the attribute content tag&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;image&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;optional usually the first m image tag&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;animation_url&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;optional use this for multi-media such as MP4, MP3, WAV, WEBM, etc... should be included in imeta tags as well&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;external_url&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;optional should be included in attribute r tags&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;attributes&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;32-bytes lowercase hex-encoded sha256 of the serialized attribute data&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;32-bytes lowercase hex-encoded public key of the public creator&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;created_at&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;x&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;m&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;m&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;p&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;d&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;kind&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;g&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;w&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;d&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 65535&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;sig&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;64-bytes lowercase hex of the signature of the sha256 hash of the serialized attribute data, which is the same as the id field&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;content&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;this key should match the description even if empty string&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;imeta&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;optional imeta tags&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;optional ID of referenced event&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;optional reference to external URL&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;    .&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;h&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;_&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;p&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;_&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;b&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;generating-keys&quot;&gt;Generating Keys&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;Private key:&lt;&#x2F;strong&gt; Any Ethereum private key or mnemonic phrase can be used, as long as the result is a 32-byte hex string. A key can be generated locally as well with a command like &lt;code&gt;openssl rand -hex 32&lt;&#x2F;code&gt;. This key is used to sign the post and is stored in the pubkey field.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Public key:&lt;&#x2F;strong&gt; Public keys are based on Taproot + Schnorr, bitcoin &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;bitcoin&#x2F;bips&#x2F;blob&#x2F;5767f444995df378ad772887b739e84bd9002d95&#x2F;bip-0341.mediawiki&quot;&gt;BIP 341&lt;&#x2F;a&gt;. It&#x27;s recommended to use a tool like nostr-tools to generate a public key from a private key.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;sign-a-post&quot;&gt;Sign a post&lt;&#x2F;h3&gt;
&lt;p&gt;Signatures are based on schnorr signatures standard for the curve secp256k1. To sign with Schnorr signatures on secp256k1, you need a private key, a message, and a random nonce (k). You then calculate a public nonce (R), a challenge (e), and finally, the signature (s) by combining these values. It&#x27;s best to use a tool like nostr-tools or nostril or schnorr.c in the bitcoin core library.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;the-pubevent&quot;&gt;The PubEvent&lt;&#x2F;h3&gt;
&lt;h3 id=&quot;when-a-new-post-is-created&quot;&gt;When a new post is created&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PubEvent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; pubkey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; created_at&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; kind&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; content&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tags&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sig&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;id&lt;&#x2F;code&gt;: the unique identifier of the post.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;pubkey&lt;&#x2F;code&gt;: the public key of the post creator.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;created_at&lt;&#x2F;code&gt;: the timestamp of creation.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;kind&lt;&#x2F;code&gt;: the event kind; 1, for an original post.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;content&lt;&#x2F;code&gt;: the textual content of the post.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;tags&lt;&#x2F;code&gt;: the structured metadata.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;sig&lt;&#x2F;code&gt;: the signature of the post data. Should be 64 bytes.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;to-reply-to-a-post&quot;&gt;To reply to a post&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PubEvent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; pubkey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; created_at&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; kind&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; content&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tags&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sig&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;id&lt;&#x2F;code&gt;: The unique identifier of the post.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;pubkey&lt;&#x2F;code&gt;: The public key of the post creator.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;created_at&lt;&#x2F;code&gt;: The timestamp of creation.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;kind&lt;&#x2F;code&gt;: Also 1 for replies.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;content&lt;&#x2F;code&gt;: The textual content of the post.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;tags&lt;&#x2F;code&gt;: The structured metadata including outlined below.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;sig&lt;&#x2F;code&gt;: The signature of the post data. Should be 64 bytes.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;the-reply-e-tag&quot;&gt;The reply &quot;e&quot; tag&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;[&quot;e&quot;, &amp;lt;event-id&amp;gt;, &amp;lt;relay-url&amp;gt;, &amp;lt;marker&amp;gt;, &amp;lt;pubkey&amp;gt;]&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Where:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;&amp;lt;event-id&amp;gt;&lt;&#x2F;code&gt; is the id of the event being referenced.
&lt;code&gt;&amp;lt;relay-url&amp;gt;&lt;&#x2F;code&gt; optionally is the URL of a recommended off-chain relayer. Use empty string,&quot;&quot;, if none or on the blockchain only.
&lt;code&gt;&amp;lt;marker&amp;gt;&lt;&#x2F;code&gt; is optional and if present is one of &quot;reply&quot;, &quot;root&quot;, or &quot;mention&quot;.
&lt;code&gt;&amp;lt;pubkey&amp;gt;&lt;&#x2F;code&gt; is optional, SHOULD be the pubkey of the author of the referenced event&lt;&#x2F;p&gt;
&lt;p&gt;Those marked with &quot;reply&quot; denote the id of the reply event being responded to. Those marked with &quot;root&quot; can denote the root id of the reply thread being responded to. Those marked with &quot;mention&quot; denote a quoted or reposted event id.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;&amp;lt;pubkey&amp;gt;&lt;&#x2F;code&gt; SHOULD be the pubkey of the author of the e tagged event, this is used in the outbox model to search for that event from the author&#x27;s write relays where relay hints did not resolve the event.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;the-p-tag&quot;&gt;The &quot;p&quot; tag&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;[&quot;p&quot;, &amp;lt;pubkey&amp;gt;, ...]&lt;&#x2F;code&gt;
Used in a text event contains a list of pubkeys used to record who is involved in a reply thread.&lt;&#x2F;p&gt;
&lt;p&gt;When replying to a text event E the reply event&#x27;s &quot;p&quot; tags can contain all of E&#x27;s &quot;p&quot; tags as well as the &quot;pubkey&quot; of the event being replied to.&lt;&#x2F;p&gt;
&lt;p&gt;Example: Given a text event authored by a1 with &quot;p&quot; tags [p1, p2, p3] then the &quot;p&quot; tags of the reply can be [a1, p1, p2, p3] in no particular order.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;reposts&quot;&gt;Reposts&lt;&#x2F;h3&gt;
&lt;p&gt;A repost is a kind 6 event that is used to signal to followers that a kind 1 text post is worth reading.&lt;&#x2F;p&gt;
&lt;p&gt;The content of a repost event is the stringified JSON of the reposted post. It MAY also be empty, but that is not recommended.&lt;&#x2F;p&gt;
&lt;p&gt;The repost event MUST include an e tag with the id of the post that is being reposted. That tag should include a blockchain tag or indexer relay where the post can be fetched.&lt;&#x2F;p&gt;
&lt;p&gt;The repost SHOULD include a p tag with the pubkey of the event being reposted.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;quote-reposts&quot;&gt;Quote Reposts&lt;&#x2F;h3&gt;
&lt;p&gt;Quote reposts are kind 1 events with an embedded q tag of the post being quote reposted. The q tag ensures quote reposts are not pulled and included as replies in threads. It also allows you to easily pull and count all of the quotes for a post.&lt;&#x2F;p&gt;
&lt;p&gt;q tags should follow the same conventions as e tags, with the exception of the mark argument.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;[&quot;q&quot;, &amp;lt;event-id&amp;gt;, &amp;lt;relay-url&amp;gt;, &amp;lt;pubkey&amp;gt;, &amp;lt;blockchain-name-or-id&amp;gt;]&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;These attributes in the metadata are a 1:1 mapping of a Nostr-style event. Nostr is a blockchain compatible social media protocol because it uses a public&#x2F;private key verification system that does not rely on a central set of smart contracts. It relies on the same format of private key EVM chains already use. It has a json based event system that is easily mapped to NFTs. Content can be freely moved between web3 and web2 based platforms. Each post is signed by the author, enabling tamperproof third-party transportation and publishing. A standardized tagging system enables referencing posts on other blockchains, other contracts, or external URLs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Only the metadata format and PubEvent is required.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; createPost&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uri&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; pubkey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; created_at&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; kind&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; content&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tags&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sig&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; uri&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PubEvent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; pubkey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; created_at&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; kind&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; content&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tags&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; sig&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In this example &lt;code&gt;PubEvent&lt;&#x2F;code&gt; is &lt;strong&gt;required&lt;&#x2F;strong&gt; to announce a publication event has occurred. This event is flexible and can be used for all event types and kinds.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;token-standards-compatibility&quot;&gt;Token Standards Compatibility&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;:&lt;&#x2F;strong&gt; Each post should be a unique (&lt;code&gt;tokenId&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt;:&lt;&#x2F;strong&gt; A &lt;code&gt;tokenId&lt;&#x2F;code&gt; should only represent one post event even if minted multiple times.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h4&gt;
&lt;p&gt;This is an additive standard on top of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt;. Existing NFTs remain compatible; clients or platforms that understand this standard can interpret these tokens as social posts as well as traditional NFTs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;Data Integrity:&lt;&#x2F;strong&gt;
Ensure that id is consistently &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7847&#x2F;#to-derive-the-id&quot;&gt;derived, as described above&lt;&#x2F;a&gt;, to prevent forgeries. The owner of an NFT is inconsequential to the authenticity of the post, if the post is properly signed.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;spam-and-moderation&quot;&gt;Spam and Moderation&lt;&#x2F;h3&gt;
&lt;p&gt;Event driven social media and NFTs both allow permissionless creation of content. Platforms built on this standard should implement their own moderation layers, blocklists, or reputation systems.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Wallet Connection API</title>
        <published>2024-12-15T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Conner Swenberg</name><uri>https://github.com/ilikesymmetry</uri>
	</author>
	
	<author>
		<name>Jake Moxey</name><uri>https://github.com/jxom</uri>
	</author>
	
	<author>
		<name>Lukas Rosario</name><uri>https://github.com/lukasrosario</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7846/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7846-wallet-connection-api/22245" />
        

        <id>https://wg-eips.ritovision.com/7846/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7846"
            label="ERC-7846" />
        

        
        

        
        <summary type="html">Adds JSON-RPC method for requesting wallet connection with modular capabilities.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7846/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC introduces a new wallet connection JSON-RPC method focused on extensibility, &lt;code&gt;wallet_connect&lt;&#x2F;code&gt;. It leverages the modular capabilities approach defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5792&#x2F;#wallet-getcapabilities&quot;&gt;ERC-5792&lt;&#x2F;a&gt; to streamline connections and authentication into a single interaction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;With applications beginning to require support for more sophisticated functionality in wallet connection flows, the need for a unified and extensible wallet connection JSON-RPC method has become more apparent.&lt;&#x2F;p&gt;
&lt;p&gt;This is especially evident in the case of attempting to batch connection with authentication, where existing methods like &lt;code&gt;eth_requestAccounts&lt;&#x2F;code&gt; and &lt;code&gt;personal_sign&lt;&#x2F;code&gt; lack extensibility and require at least two separate user interactions (ie. connect and then sign).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;json-rpc-methods&quot;&gt;JSON-RPC Methods&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;wallet-connect&quot;&gt;&lt;code&gt;wallet_connect&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Requests to connect account(s) with optional capabilities.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;request&quot;&gt;Request&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Request&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  method&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;wallet_connect&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  params&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; JSON-RPC method version.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    version&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Optional capabilities to request (e.g. Sign In With Ethereum).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    capabilities&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Record&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; unknown&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;response&quot;&gt;Response&lt;&#x2F;h5&gt;
&lt;p&gt;List of connected accounts with their associated capabilities.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Response&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  accounts&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the connected account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Capabilities granted that is associated with this account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    capabilities&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Record&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; unknown&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;example&quot;&gt;Example&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; response&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; provider&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;request&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  method&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;wallet_connect&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  params&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    version&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    capabilities&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      signInWithEthereum&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;12345678&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        chainId&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *   accounts: [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *     {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *       address: &amp;#39;0x...&amp;#39;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *       capabilities: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *         signInWithEthereum: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *           message: &amp;#39;app.com wants you to sign in with your Ethereum account:\n0x...&amp;#39;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *           signature: &amp;#39;0x...&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *         }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *       }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *     }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *   ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;wallet-disconnect&quot;&gt;&lt;code&gt;wallet_disconnect&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Disconnects connected account(s).&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The wallet SHOULD revoke access to the user account(s) information, as well as to any capabilities associated with them that were granted upon connection via &lt;code&gt;wallet_connect&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;request-1&quot;&gt;Request&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Request&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  method&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;wallet_disconnect&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;example-1&quot;&gt;Example&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; provider&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;request&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  method&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;wallet_disconnect&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;capabilities&quot;&gt;Capabilities&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;signinwithethereum&quot;&gt;&lt;code&gt;signInWithEthereum&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Adds support for offchain authentication using &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4361&#x2F;&quot;&gt;ERC-4361&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h5&gt;
&lt;p&gt;Same as ERC-4361 specification with minor modifications:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The casing of multi-word fields has been adjusted to camelCase instead of kebab-case. Resources are an array field.&lt;&#x2F;li&gt;
&lt;li&gt;The account address returned by &lt;code&gt;wallet_connect&lt;&#x2F;code&gt; MUST match the address inferred in the Sign-In with Ethereum (SIWE) message.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;version&lt;&#x2F;code&gt; is optional and defaults to an accepted version defined in ERC-4361 if not provided.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;domain&lt;&#x2F;code&gt; is optional and defaults to the domain of the requesting app if not provided.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;uri&lt;&#x2F;code&gt; is optional and defaults to the uri of the requesting app if not provided.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;issuedAt&lt;&#x2F;code&gt; is optional and defaults to the current time if not provided.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The wallet MUST return a ERC-4361-formatted message that exactly matches the requested parameters and a signature over the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;191&#x2F;&quot;&gt;EIP-191&lt;&#x2F;a&gt; &lt;code&gt;personal_sign&lt;&#x2F;code&gt; hash of the message. The app SHOULD also verify that the two match for security.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Parameters&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  signInWithEthereum&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; EIP-155 hex-encoded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    version&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    scheme&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    domain&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    uri&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    statement&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    issuedAt&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    expirationTime&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    notBefore&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    requestId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    resources&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;response-1&quot;&gt;Response&lt;&#x2F;h5&gt;
&lt;p&gt;Formatted SIWE message and signature.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Response&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  signInWithEthereum&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Formatted SIWE message.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    message&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Signature over the EIP-191 personal_sign hash of the message.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;example-2&quot;&gt;Example&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; result&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; provider&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;request&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  method&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;wallet_connect&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  params&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    version&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    capabilities&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      signInWithEthereum&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;12345678&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        chainId&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        version&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        domain&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;app.com&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uri&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;app.com&#x2F;connect&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        issuedAt&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2024-12-35T04:20:00Z&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        expirationTime&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2024-12-35T06:09:00Z&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *   accounts: [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *     {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *       address: &amp;#39;0x...&amp;#39;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *       capabilities: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *         signInWithEthereum: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *           message: &amp;#39;app.com wants you to sign in with your Ethereum account:\n0x...&amp;#39;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *           signature: &amp;#39;0x...&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *         }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *       }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *     }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *   ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;multiple-accounts&quot;&gt;Multiple Accounts&lt;&#x2F;h3&gt;
&lt;p&gt;Returning multiple accounts allows greater generality for apps that wish to interact in more complex ways with users. This also improves our backwards compatibility with &lt;code&gt;eth_requestAccounts&lt;&#x2F;code&gt;. In practice, we expect most apps only interact with the first account in the array.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;capability-results&quot;&gt;Capability Results&lt;&#x2F;h3&gt;
&lt;p&gt;Returning capability results alongside the connection unlocks many valuable use cases such as authentication, user metadata sharing, and permissions granted to the app.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;initial-authentication-capability&quot;&gt;Initial Authentication Capability&lt;&#x2F;h3&gt;
&lt;p&gt;To ensure immediate value, this proposal includes a capability that combines wallet connection with authentication using the widely adopted &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4361&#x2F;&quot;&gt;Sign In With Ethereum (ERC-4361)&lt;&#x2F;a&gt; standard. This optional capability simplifies the onboarding process for apps and users by combining two steps — connection and authentication — into a single interaction. Apps that prefer alternative authentication flows can implement their own capabilities without being constrained by this design.&lt;&#x2F;p&gt;
&lt;p&gt;By unifying connection and authentication into one step, apps can reduce friction, improve the user experience, and minimize redundant interactions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This standard builds on existing JSON-RPC methods and complements ERC-5792 for future extensibility. Wallets can continue supporting legacy methods.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Applies &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4361&#x2F;#security-considerations&quot;&gt;ERC-4361 security principles&lt;&#x2F;a&gt;. As more capabilities are added, care must be taken to avoid unpredictable interactions.&lt;&#x2F;p&gt;
&lt;p&gt;Wallet addresses and any shared capabilities must be handled securely to avoid data leaks or man-in-the-middle attacks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Cross-chain Message Format and Mailbox</title>
        <published>2024-12-12T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Ellie Davidson</name><uri>https://github.com/elliedavidson</uri>
	</author>
	
	<author>
		<name>Alex Xiong</name><uri>https://github.com/alxiong</uri>
	</author>
	
	<author>
		<name>Philippe Camacho</name><uri>https://github.com/philippecamacho</uri>
	</author>
	
	<author>
		<name>and Ben Fisch</name><uri>https://github.com/benafisch</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7841/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7841-cross-chain-message-format-and-mailbox/22185" />
        

        <id>https://wg-eips.ritovision.com/7841/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:7841"
            label="ERC-7841" />
        

        
        

        
        <summary type="html">A mailbox API and message format to provide a unified cross-chain developer experience</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7841/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC proposes a &lt;strong&gt;mailbox API&lt;&#x2F;strong&gt; and &lt;strong&gt;message format&lt;&#x2F;strong&gt; for sending and receiving data between L2s. This standard makes it easier for developers to build cross-chain applications that work over a variety of VMs, chain settlement mechanisms (e.g., ZK or optimistic settlement), and messaging protocols (e.g., synchronous or asynchronous protocols). This ERC accomplishes this by 1.) defining a mailbox interface through which cross-chain messages can be sent and received independent of their payload; 2.) defining a VM-agnostic message format and address type to make the interface compatible with many VMs;  3.) keeping the mailbox interface minimal to make it compatible with many kinds of cross-chain communication.  Example applications include an intent-based bridge, a liquidity-unifying DEX operating across multiple chains, or a cross-chain lending application.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;L2s have scaled Ethereum and unlocked new avenues for innovation, but left the ecosystem &lt;em&gt;fragmented&lt;&#x2F;em&gt;. To address this, there are a variety of cross-chain communication protocols designed to make L2s composable with each other, each implements its own message format that is incompatible with others. This ERC proposes a neutral, standard format for sending and receiving cross-chain messages. By standardizing the interface chains for messaging, we achieve:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Unified developer experience:&lt;&#x2F;strong&gt; This standard abstracts away the low-level details of message passing from applications. This allows application developers to achieve the following, even among chains with different VMs, coordination protocols, or settlement logic:
&lt;ul&gt;
&lt;li&gt;send&#x2F;receive messages to&#x2F;from many chains using the &lt;strong&gt;same interface&lt;&#x2F;strong&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;deploy their application across multiple chains with &lt;strong&gt;little-to-no&lt;&#x2F;strong&gt; code changes.&lt;&#x2F;li&gt;
&lt;li&gt;focus on their application’s design instead of cross-chain infrastructure.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Modularity:&lt;&#x2F;strong&gt;  This ERC standardizes only the low level information required for sending and receiving messages between chains, similar to the Internet Protocol. This allows a &lt;strong&gt;clean separation&lt;&#x2F;strong&gt; between the interface for sending&#x2F;receiving messages (this ERC) and a coordination protocol or settlement mechanism. This allows chains to adopt this standard with minimal changes, and gives chains &lt;strong&gt;flexibility&lt;&#x2F;strong&gt; to choose the specific protocols they need, instead of forcing all chains to agree on a single coordination protocol or settlement mechanism.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Shared Infrastructure:&lt;&#x2F;strong&gt; This standard allows applications and chains to &lt;strong&gt;reuse&#x2F;repurpose infrastructure&lt;&#x2F;strong&gt; for different use cases. Applications can leverage existing library contracts for common operations like encoding message payload for token transfer, while relayer networks can serve multiple purposes without significant modifications. This shared foundation simplifies the development and deployment of new chains, applications, and protocols.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;terminology&quot;&gt;Terminology&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;A &lt;strong&gt;Messaging Protocol&lt;&#x2F;strong&gt; consists of mailbox contracts and a coordination (sub)protocol. A chain sends a message through a transaction that writes to its outbox and receives a message through a transaction that reads from the inbox.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Coordination Protocol&lt;&#x2F;strong&gt;: A mechanism that relays messages between source and destination mailboxes, commonly through off-chain mechanisms. Examples include shared sequencers or intent relayers. A settlement mechanism to ensure the integrity of cross-chain messages is often part of a coordination protocol. It is not always required in the case of asynchronous messaging.&lt;&#x2F;li&gt;
&lt;li&gt;In &lt;em&gt;&lt;strong&gt;synchronous&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt; messaging protocols, chains have synchronized blocks (e.g., a block for each chain is produced every &lt;em&gt;t&lt;&#x2F;em&gt; seconds) and messages are received on the destination chain within the same block timeslot as they were sent from the source chain. In particular, a chain may send a message and read a response in one transaction within a block on a chain.&lt;&#x2F;li&gt;
&lt;li&gt;In &lt;em&gt;&lt;strong&gt;asynchronous&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt; messaging protocols the restrictions of synchronous protocols do not apply. In particular, the chains sending and receiving messages may not have synchronized block timeslots and there may be a delay (measured in elapsed blocks) between the transaction on the source chain that sends a message and the transaction on the destination chain in which it is received.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;There is a wide range of ways in which both synchronous and asynchronous protocols may operate. For example, some protocols (particularly for asynchronous messaging) may require the source chain&#x27;s block in which the message was sent to be finalized (e.g., settled on Ethereum) before it can be included within a block produced for the destination chain. Other protocols may allow for messages to be optimistically included in blocks with consistency checks delayed until settlement time (reminiscent of speculative execution).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;message-format&quot;&gt;Message Format&lt;&#x2F;h3&gt;
&lt;p&gt;All messages MUST follow this format:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Metadata type&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Metadata for a cross-chain message&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Metadata&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The chain identifier of the source chain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint32&lt;&#x2F;span&gt;&lt;span&gt; srcChainId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The chain identifier of the destination chain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint32&lt;&#x2F;span&gt;&lt;span&gt; destChainId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the sending party&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 32 bytes are used to encode the address. In the case of an&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     Ethereum address, the last 12 bytes can be padded with zeros&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; srcAddress&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the recipient&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 32 bytes are used to encode the address. In the case of an &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     Ethereum address, the last 12 bytes can be padded with zeros&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; destAddress&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier for a cross-chain interaction session&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SHOULD be unique for every new cross-chain calls&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint128&lt;&#x2F;span&gt;&lt;span&gt; sessionId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The message counter within an interaction session &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SHOULD be unique within a session&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; OPTIONAL for most asynchronous bridges where every message has a &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     distinct sessionId, simply set to 0 if unused&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; E.g. In a cross-chain call: ChainA.func1 -m1-&amp;gt; ChainB.func2 -m2-&amp;gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     ChainC.func3 -m3-&amp;gt; ChainB.func4, the subscript i in m_i is the nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint128&lt;&#x2F;span&gt;&lt;span&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Message type&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A cross-chain message&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Message&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The message metadata &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Metadata metadata&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Message payload &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; It may be ABI-encoded function calls, info about bridged assets, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     or arbitrary message data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span&gt; payload&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Implementations SHOULD use a global rollup registry service that supports registration, deregistration, and efficient lookup of a rollup&#x27;s chain ID. This work is outside the scope of this ERC, however.
Our standard is compatible with any ERC defining chain-specific addresses to better display the sender and receiver of a &lt;code&gt;Message&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;mailbox-apis&quot;&gt;Mailbox APIs&lt;&#x2F;h3&gt;
&lt;p&gt;Each chain SHOULD have &lt;strong&gt;two canonical Mailbox contracts, one for synchronous and the other for asynchronous messaging&lt;&#x2F;strong&gt;, responsible for managing both incoming and outgoing messages. The following APIs are RECOMMENDED to provide the minimal required functionality. Implementations of these APIs MAY include additional functions to support customized or more complex workflows.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Mailbox contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Mailbox for sending (resp. receiving) messages to (resp. from) &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     other chains, standardized for messaging protocols that support &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     synchronous or asynchronous, or both types of message passing.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Mailbox&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @notice Inbox: a key-value map, mapping: metadata digest -&amp;gt; payload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @dev Implementators MAY instantiate with the following map&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; mapping(bytes32 =&amp;gt; bytes) inbox;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the chain ID for the host chain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SHOULD be set at the deployment time as immutable except for when &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     using an upgradable Mailbox since immutable variables are discouraged.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST NOT change regardless of upgradable contracts or not.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; chain_id&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the digest of the inbox, used for mailbox consistency &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     checks&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; There SHOULD be an accumulator (e.g. chained-hash or MerkleTree) &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     logic that takes in every new inbox message and updates the digest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; srcChainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Identifier of the source chain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Digest&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; of all inbox messages coming from `srcChainId`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; inboxDigest&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; srcChainId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the digest of the outbox, used for mailbox consistency &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     checks&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; There SHOULD be an accumulator (e.g. chained-hash or MerkleTree) &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     logic that takes in every new outbox message and updates the digest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; destChainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Identifier of the destination chain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Digest&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; of all outbox messages directed at `destChainId`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; outboxDigest&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; destChainId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the &amp;quot;key&amp;quot; in inbox&#x2F;outbox map for a message according &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     to its metadata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The metadata includes all fields in the `Metadata` struct.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getMetadataDigest&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        Metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; metadata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Send a message to another chain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Metadata of the message&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; payload&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Payload of the message&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SHOULD sanity check `metadata.srcChainId == this.chain_id() &amp;amp;&amp;amp; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     metadata.srcAddress == msg.sender`;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SHOULD update the outbox digest and&#x2F;or the outbox&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; send&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; metadata&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; payload&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Receive a message from another chain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SHOULD revert if message cannot be retrieved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SHOULD sanity check `metadata.destChainId == this.chain_id()`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Metadata of the message&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; payload&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; of the retrieved message&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; recv&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        Metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; metadata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; payload&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Populate the inbox with incoming messages&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; messages&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Inbox messages to put in `this.inbox`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; aux&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; OPTIONAL auxiliary information&#x2F;witness to justify these &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     inbox messages&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `aux` may be empty or signature from a trusted relayer, etc.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; populateInbox&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        Message&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; messages&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; aux&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Generates a fresh and random sessionId for new messages&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; In order to ensure the uniqueness of the value generated, this &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     function MIGHT require using a contract variable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; With this unique session ID, for messages that do not require a &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     nonce, we can set nonce=0, and the overall metadata digest is still &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     collision-free with high probability&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; A&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; unique sessionId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; randSessionId&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint128&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;Mailbox&lt;&#x2F;code&gt; contract SHOULD keep track of an &lt;em&gt;inbox&lt;&#x2F;em&gt; of incoming messages. The concrete data structure used to store the &lt;code&gt;inbox&lt;&#x2F;code&gt; queue SHOULD be a hash-map-like &lt;code&gt;mapping&lt;&#x2F;code&gt; in Solidity to enable efficient lookup by the dApps with payload-independent query keys. Being able to read&#x2F;receive messages based on their metadata only, rather than their actual payload, is critical in achieving synchronous messaging with a dynamic payload known only at runtime. It is OPTIONAL to track the full outbox messages in the contract storage — an outbox digest may be sufficient for some cases.&lt;&#x2F;p&gt;
&lt;p&gt;While a single Mailbox contract could support both synchronous and asynchronous messaging protocols, this would require applications to specify the messaging mode for each interaction since each mode may require different settlement logic. Such a design would significantly complicate the Mailbox contract API, its implementation, and related infrastructure components like settlement logic. A more practical approach is to deploy separate, canonical Mailbox contracts for each mode. This allows applications to switch between synchronous and asynchronous messaging simply by pointing to the appropriate contract address.&lt;&#x2F;p&gt;
&lt;p&gt;Messages received via &lt;code&gt;Mailbox.recv()&lt;&#x2F;code&gt; are &lt;strong&gt;authenticated&lt;&#x2F;strong&gt; because they must first be populated in the inbox, with their integrity verified before the receiving action finalizes. This verification is performed either through the &lt;code&gt;aux&lt;&#x2F;code&gt; field during the &lt;code&gt;populateInbox()&lt;&#x2F;code&gt; call or via an external settlement layer.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;multiple-vm-support&quot;&gt;Multiple VM Support&lt;&#x2F;h3&gt;
&lt;p&gt;Notice that our standard requires &lt;strong&gt;no changes to a chain&#x27;s VM&lt;&#x2F;strong&gt; (i.e. no new opcode or precompiles required), but only proposes some smart contract interfaces. Specifically, the sender&#x2F;recipient account type — generic &lt;code&gt;bytes32&lt;&#x2F;code&gt; instead of EVM-specific &lt;code&gt;address&lt;&#x2F;code&gt; type -- allows this standard to support a much wider class of VMs (e.g. SolanaVM that uses &lt;code&gt;Ed25519&lt;&#x2F;code&gt; public key as their accounts).&lt;&#x2F;p&gt;
&lt;p&gt;An optional &lt;code&gt;MultiplexABIEncoder&lt;&#x2F;code&gt; contract can abstract away the VM-specific encoding when preparing the message payload: a generic &lt;code&gt;encode(chainId)&lt;&#x2F;code&gt; function, as opposed to EVM’s &lt;code&gt;abi.encode&lt;&#x2F;code&gt;, that takes in the destination chain ID and decides the corresponding encoder logic so that the receiving party can decode natively. If the apps only care about interoperating with EVM chains, they can safely use &lt;code&gt;abi.encode()&lt;&#x2F;code&gt; as is and not go through any general encoder.&lt;&#x2F;p&gt;
&lt;p&gt;On the receiving side, EVM chains would type cast &lt;code&gt;address(parsedAddress)&lt;&#x2F;code&gt; on the &lt;code&gt;bytes32 parsedAddress&lt;&#x2F;code&gt; from the received message.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;arbitrary-message-payload&quot;&gt;Arbitrary message payload&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;Message.payload&lt;&#x2F;code&gt; field is designed for maximum flexibility, capable of encoding arbitrary data, including application-specific structures like the &lt;code&gt;CrossChainOrder&lt;&#x2F;code&gt; from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7683&#x2F;&quot;&gt;ERC-7683&lt;&#x2F;a&gt; (See &lt;em&gt;Example Usage&lt;&#x2F;em&gt; section below for details of this integration). In contrast to some existing bridge designs that restrict the payload to function calls, the message payload in our design can also represent simpler data types, such as a boolean status flag for acknowledgments. This flexibility enables a wider range of use cases and simplifies integration across various applications.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;use-metadata-digest-instead-of-sessionid-for-message-query-key&quot;&gt;Use Metadata Digest Instead of &lt;code&gt;sessionId&lt;&#x2F;code&gt; for Message Query Key&lt;&#x2F;h3&gt;
&lt;p&gt;For message lookups in the mailbox, the query key is derived from the hash of all message metadata rather than relying on a single &lt;code&gt;sessionId&lt;&#x2F;code&gt; field. This is because the &lt;code&gt;sessionId&lt;&#x2F;code&gt; derivation is customizable and may not adequately bind to key metadata like source and destination addresses. In contrast, the wrapping messaging protocol may enforce permissions for sending or receiving based on these metadata fields, so the query key must bind to the entire set of metadata.&lt;&#x2F;p&gt;
&lt;p&gt;Observe that when applications allow users to define &lt;code&gt;sessionId&lt;&#x2F;code&gt;, these values may not be unique across messages. Depending on the implementation of the inbox, this could be a concern. For example,  a mapping-based inbox needs an additional &lt;em&gt;nullifier set&lt;&#x2F;em&gt; to enforce the uniqueness of message metadata and avoid message overwrites in the case of a colliding map-key.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;pre-filled-inbox&quot;&gt;Pre-filled Inbox&lt;&#x2F;h3&gt;
&lt;p&gt;In contrast to other asynchronous bridge designs, our standard explicitly separates inbox filling from reading, enabling a unified interface for message retrieval. This separation allows specialized parties like builders or coordinators to handle protocol-specific message authentication when writing to the inbox, while applications can fetch messages directly. Additionally, message retrieval requires only metadata rather than the complete message, which is valuable in synchronous settings where message payloads are determined at execution time.&lt;&#x2F;p&gt;
&lt;p&gt;As mentioned above, pre-filling the inbox of the destination chain incurs additional gas costs which are manageable on L2s. We list some advantages of our approach:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Eliminates Merkle inclusion proof verification when receiving every message. Some messaging protocols obviate Merkle proofs completely, even during &lt;code&gt;populateInbox()&lt;&#x2F;code&gt;, and delay the mailbox check to the settlement layer.&lt;&#x2F;li&gt;
&lt;li&gt;Allows upgrade of the coordination protocol (e.g. the internal of &lt;code&gt;populateInbox()&lt;&#x2F;code&gt;and&#x2F;or the settlement layer logic) without requiring changes to connected apps.&lt;&#x2F;li&gt;
&lt;li&gt;Enables user-signed transactions on the destination chain instead of shared sequencer-signed transactions in synchronous messaging. This flexibility simplifies gas payment handling and ensures a consistent &lt;code&gt;msg.sender&lt;&#x2F;code&gt;. Detailed explanations are omitted for brevity (extended answers on the website).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;related-proposals&quot;&gt;Related Proposals&lt;&#x2F;h3&gt;
&lt;p&gt;In comparison to Inter-blockchain Communication(IBC)-like standards, this ERC is designed to work in a &lt;em&gt;stateless&lt;&#x2F;em&gt; manner. Messages do not need to pass a proof from the source chain at the time they are consumed on the destination chain. This allows use cases such as synchronous composability and intra-block messaging since messages don’t need to include finalized state from the source chain. Additionally, this ERC does not require multiple steps to establish a link between two chains. Messages can be directly sent from one chain to another in a single step.&lt;&#x2F;p&gt;
&lt;p&gt;ERC-7683 standardizes intent-based systems by defining structs for orders and interfaces for settlement smart contracts. This standard is application-specific and aimed at designers of cross-chain intent systems, while our proposal is more general and targets developers implementing arbitrary cross-chain applications. However, an intent system based on ERC-7683 &lt;strong&gt;can be built on top&lt;&#x2F;strong&gt; of our standard due to its modularity. An application implementing ERC-7683 could use the &lt;code&gt;Mailbox&lt;&#x2F;code&gt; API defined in this proposal to send &lt;code&gt;originData&lt;&#x2F;code&gt; from event messages between the source chain (where user funds are deposited) and the destination chain(s) (where intents are solved). We provide more details in the &lt;em&gt;Example Usage&lt;&#x2F;em&gt; section.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found. Since this is an opt-in protocol, L2s that do not opt-in to this will not be affected. Furthermore, this protocol can operate in existing cross-chain flows today, such as in intent-based bridges or native bridging of assets between L2s.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;We show a &lt;em&gt;possible&lt;&#x2F;em&gt; implementation of the mailbox contract for synchronous messaging protocol, and explain how it can be easily modified to support asynchronous protocols as well.&lt;&#x2F;p&gt;
&lt;p&gt;The high-level flow is as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Sending a message simply updates the outbox digest.&lt;&#x2F;li&gt;
&lt;li&gt;Prefill the inbox by inserting the messages sequentially in the same order as the outbox in the source chain. Each insertion updates the corresponding inbox digest.
&lt;ul&gt;
&lt;li&gt;The prefilling transaction is likely created by a &lt;em&gt;coordinator&lt;&#x2F;em&gt; in the coordination protocol, who monitors messages sent from all rollups and relay them to the intended destination chain. The rollup sequencer includes this transaction in the block, ensuring it precedes any mailbox &quot;read&quot; operations and enforces a single prefilling per block.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Applications can then read a message by querying the key-value map inbox with the (hashed) message metadata.&lt;&#x2F;li&gt;
&lt;li&gt;External to these transactions, the settlement layer will receive new inbox digest and outbox digest (with storage proofs against a proven new rollup state) and checks &lt;code&gt;chain_i.inboxDigest[chain_j] == chain_j.outboxDigest[chain_i]&lt;&#x2F;code&gt; for all &lt;code&gt;i!=j&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;Note: We ignore the slight complication of mailbox reset at the beginning of each block using nested mapping in our description above for brevity, but they are dealt with in our code snippet below.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Mailbox contract implementation for synchronous communication&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Mailbox&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ... Constructor + other simple functions like chain_id().&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; nested map: blockNum -&amp;gt; metadataDigest -&amp;gt; payload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Easy cleanup by `delete inbox[block.number -1]`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; inbox&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Mapping to detect key collisions: metadataDigest -&amp;gt; writtenFlag&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; outboxNullifier&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; These hash values are computed incrementally.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Nested map: blockNum -&amp;gt; srcChainId -&amp;gt; H(...H(m_2 | H(m_1))..)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Easy cleanup by `delete inboxDigest[block.number -1]`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; inboxDigest&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Nested map: blockNum -&amp;gt; destChainId -&amp;gt; H(...H(m_2 | H(m_1))..)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Easy cleanup by `delete outboxDigest[block.number -1]`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; outboxDigest&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Given the metadata (Message struct without payload field) of a &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     message, derive the digest used as the dictionary key for inbox&#x2F;outbox.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getMetadataDigest&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; srcChainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; destChainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; srcAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; destAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            keccak&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;                abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    srcChainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    destChainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    srcAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    destAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    uid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Conceptual &amp;quot;cleanup&#x2F;reset&amp;quot; of mailbox after each block since &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     sync msgs are received immediately.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _resetMailbox&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        delete&lt;&#x2F;span&gt;&lt;span&gt; inbox&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        delete&lt;&#x2F;span&gt;&lt;span&gt; inboxDigest&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        delete&lt;&#x2F;span&gt;&lt;span&gt; outboxDigest&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Send a message to another chain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; send&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; destChainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; destAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uid&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; payload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; key &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getMetadataDigest&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;chain_id&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            destChainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;srcAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            uid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Prevent overwriting the same key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;outboxNullifier&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;key&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        outboxNullifier&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;key&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Update the outbox digest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; digest&amp;#39; = H(digest | metadata | payload)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        outboxDigest&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;chain_id&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                outboxDigest&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;chain_id&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                m&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function can only be called once per block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; populateInbox&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Message&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; messages&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; aux&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Before putting new inbox messages at the beginning of each block, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     &amp;quot;reset&amp;quot; the inbox&#x2F;outbox&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _resetMailbox&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; messages&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            Message &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;memory&lt;&#x2F;span&gt;&lt;span&gt; m &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; messages&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Reject if the message was not sent to this chain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;m&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;destChainId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;chain_id&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes32&lt;&#x2F;span&gt;&lt;span&gt; key &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getMetadataDigest&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                m&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;srcChainid&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                m&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;srcAddr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;                this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;chain_id&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                m&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;destAddr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                m&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;uid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            inbox&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;key&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; m&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Update the inbox digest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; digest&amp;#39; = H(digest | metadata | payload)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            inboxDigest&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;m&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;srcChainId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;                abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    inboxDigest&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;m&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;srcChainId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    m&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Receive a message from another chain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; recv&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; srcChainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; srcAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; destAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; key &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getMetadataDigest&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            srcChainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;chain_id&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;srcAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;destAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            uid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; inbox&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;key&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;To extend the synchronous mailbox to support asynchronous protocols, we only need these modifications:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Remove the first layer of mapping from &lt;code&gt;inbox&lt;&#x2F;code&gt;, &lt;code&gt;inboxDigest&lt;&#x2F;code&gt;, &lt;code&gt;outboxDigest&lt;&#x2F;code&gt;, since the “domain-separation from block number” requirement is gone. (e.g. changed to &lt;code&gt;mapping(bytes32 =&amp;gt; bytes) inbox&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;At the settlement layer, enforce that the destination chain’s inbox is a &lt;strong&gt;subset&lt;&#x2F;strong&gt; of the source chain’s outbox messages, rather than a full equality check.
&lt;ul&gt;
&lt;li&gt;Consequently, change the accumulator algorithm used to compute &lt;code&gt;inboxDigest,outboxDigest&lt;&#x2F;code&gt; to ones with efficient subset proof.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Remove the &lt;code&gt;_reset()&lt;&#x2F;code&gt; logic since all messages for async will be permanently stored.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;note-on-gas-cost&quot;&gt;Note on Gas Cost&lt;&#x2F;h3&gt;
&lt;p&gt;The most costly operations are &lt;code&gt;sstore&lt;&#x2F;code&gt; during &lt;code&gt;Mailbox.populateInbox()&lt;&#x2F;code&gt;, which writes to the mapping &lt;code&gt;inbox&lt;&#x2F;code&gt; in contract storage, and &lt;code&gt;sload&lt;&#x2F;code&gt;, during &lt;code&gt;Mailbox.recv()&lt;&#x2F;code&gt; which reads from the &lt;code&gt;inbox&lt;&#x2F;code&gt; in storage. Luckily, Mailboxes costs on L2 are much cheaper. In cases of more gas-sensitive chains and applications, we suggest these potential optimizations:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;delete inbox[key]&lt;&#x2F;code&gt; during &lt;code&gt;.recv()&lt;&#x2F;code&gt; to get gas refunds for cleaning some storage
&lt;ul&gt;
&lt;li&gt;Synchronous messages are cleaned up at the end of the same block in which they are populated. L2 can optionally implement gas optimizations for such block ephemeral storage.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;utilize the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930&lt;&#x2F;a&gt; access list to “pre-warm” predictable storage slots for lower execution cost&lt;&#x2F;li&gt;
&lt;li&gt;batch-populate inbox messages and cluster them under fewer keys (bucketed mapping) e.g.: &lt;code&gt;mapping(bytes32 bucketKey =&amp;gt; mapping(bytes32 =&amp;gt; bytes)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;example-usage-sync-and-async-cross-chain-transfers&quot;&gt;Example Usage - Sync and Async Cross-chain Transfers&lt;&#x2F;h3&gt;
&lt;p&gt;An ERC token contract wishing to allow cross-chain transfers would need to add the functions &lt;code&gt;xTransfer&lt;&#x2F;code&gt; and &lt;code&gt;xReceive&lt;&#x2F;code&gt; . The logic of a single chain transfer (e.g. &lt;code&gt;Token.send&lt;&#x2F;code&gt;) must be split into two functions &lt;code&gt;Token.xTransfer&lt;&#x2F;code&gt; and &lt;code&gt;Token.xReceive&lt;&#x2F;code&gt;. Each of these functions respectively mints and burns the same amount of assets and interact with the &lt;code&gt;Mailbox&lt;&#x2F;code&gt; contract.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC20 token contract supporting cross-chain transfers&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; XChainToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC20Burnable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; points to the Mailbox contract used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Mailbox &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;public&lt;&#x2F;span&gt;&lt;span&gt; mailbox&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; bitmap for redeem-once control on inbox messages&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; isRedeemed&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; maps chainId to the canonical XChainToken address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; xChainTokenAddress&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; use this function to transfer some amount of this token to &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     another address on another chain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; destAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; receiver address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; amount to transfer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; destChainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; identifier of the destination chain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; xTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; destChainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; destAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Burn the token of the caller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;burn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Write a message to the Mailbox to notify the other chain that the &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     token have been successfully burnt.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; payload &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; destAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Specify the amount to be minted and the recipient&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        mailbox&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;send&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            Mailbox&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Metadata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                mailbox&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;chain_id&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                destChainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;xChainTokenAddress&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;destChainId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                mailbox&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;randSessionId&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;                0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            payload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function must be called on the destination chain to mint &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     the tokens. This function can be called by any participant.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; srcChainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; identifier of the source chain the funds are sent from&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sessionId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; unique identifier needed to fetch the message&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; xReceive&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; srcChainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint128&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sessionId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Analoguous to crossTransfer except that this function can only be &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     called once with the same parameters in order to avoid double &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     minting. A mapping struct like isRedeemed can be used for this &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     purpose.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; payload &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; mailbox&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;recv&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            Mailbox&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Metadata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                srcChainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                mailbox&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;chain_id&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;xChainTokenAddress&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;srcChainId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                sessionId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;                0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt; destAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;decode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            payload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;destAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;example-usage-cross-chain-function-calls&quot;&gt;Example Usage - Cross-chain function calls&lt;&#x2F;h3&gt;
&lt;p&gt;In this example we show how to implement a cross-chain function call using the &lt;code&gt;Mailbox&lt;&#x2F;code&gt; abstraction:  The logic of cross-chain execution is handled by a contract &lt;code&gt;RemoteExecuter&lt;&#x2F;code&gt; deployed on both source and destination chains.&lt;&#x2F;p&gt;
&lt;p&gt;On the source chain &lt;code&gt;A&lt;&#x2F;code&gt;, a user wanting to call a function &lt;code&gt;fun&lt;&#x2F;code&gt; of a contract &lt;code&gt;Foo&lt;&#x2F;code&gt; on the destination chain &lt;code&gt;B&lt;&#x2F;code&gt; can invoke &lt;code&gt;RemoteExecuter.remoteCall&lt;&#x2F;code&gt; with the address of the contract &lt;code&gt;Foo&lt;&#x2F;code&gt; and other parameters including the function name and its arguments. This generates a message that is sent to chain &lt;code&gt;B&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;On the destination chain &lt;code&gt;B&lt;&#x2F;code&gt;, a call to &lt;code&gt;RemoteExecuter.execute&lt;&#x2F;code&gt;  fetches the message sent from the source chain &lt;code&gt;A&lt;&#x2F;code&gt;, parses it and executes the corresponding function of the local contract &lt;code&gt;Foo&lt;&#x2F;code&gt;. The &lt;code&gt;RemoteExecuter&lt;&#x2F;code&gt; contract also takes care of preventing messages replays.&lt;&#x2F;p&gt;
&lt;p&gt;Note that in this example gas on the destination chain is paid by the caller of &lt;code&gt;RemoteExecuter.execute&lt;&#x2F;code&gt; . In practice this participant can be the same user who called &lt;code&gt;RemoteExecuter.remoteCall&lt;&#x2F;code&gt; on the source chain. More advanced gas management policies can be implemented where another party calls &lt;code&gt;RemoteExecuter.execute&lt;&#x2F;code&gt; and pays on behalf of the user.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Contract deployed on both chains A and B&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This contract takes care of receiving remote calls from the source chain &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     and of the execution on the destination chain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RemoteExecuter&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; points to the chain Mailbox&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Mailbox &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;public&lt;&#x2F;span&gt;&lt;span&gt; mailbox&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; maps chainId to the canonical RemoteExecuter address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; We assume the contract RemoteExecuter is deployed on both (or &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     more) chains, and this map allows to know the address of the &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     contract on the other chain(s).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; remoteExecuterAddress&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Track which messages have already been processed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; executedMessages&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Prepare the execution function on a another chain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function sends a message to the destination chain with the &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     parameters of the call&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; remoteCall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; destChainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; remoteContractAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; callParams&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        Mailbox&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;Metadata &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;memory&lt;&#x2F;span&gt;&lt;span&gt; metadata &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; Mailbox&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Metadata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            mailbox&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;chain_id&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            destChainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;remoteExecuterAddress&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;destChainId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            mailbox&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;randSessionId&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;            0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        mailbox&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;send&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;metadata&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; callParams&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Call a contract function locally based on some message that was &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     sent from another chain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; srcChainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Identifier of the source chain where the call was &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     initiated&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sessionId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Session identifier&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; execute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; srcChainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint128&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sessionId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check that the message has not be executed yet&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; uid &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sessionId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;executedMessages&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;uid&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;already executed&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Read the message&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        Mailbox&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;Metadata &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;memory&lt;&#x2F;span&gt;&lt;span&gt; metadata &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; Mailbox&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Metadata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            srcChainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            mailbox&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;chain_id&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;remoteExecuterAddress&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;srcChainId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            sessionId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;            0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; payload &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; Mailbox&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;recv&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;metadata&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Call the function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; contractAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; callParams&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;decode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            payload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        contractAddress&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;call&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 100000&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;callParams&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Mark message as executed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;executedMessages&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;uid&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Contract deployed on chain A&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Caller&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Function on the source chain A that calls a function of a &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     contract deployed on the destination chain B&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier of the destination chain CHAIN_B_ID and the remote &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     contract address FOO_CONTRACT_ADDRESS are hardcoded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; val&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; parameter to be passed to the function Foo.fun(...)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; callChainB&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; val&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; callParams &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodeCall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;Foo&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;fun&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;val&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        RemoteExecuter&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;remoteCall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;CHAIN_B_ID&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; FOO_CONTRACT_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; callParams&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Contract deployed on chain B&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; We assume this contract is deployed at the address FOO_CONTRACT_ADDRESS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This contract has a function that is called from chain A&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Foo&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fun&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; parameter&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;parameter &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 42&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Security concerns for the messaging format and mailbox APIs themselves are minimal, as the protocol specification focuses on providing a rich and expressive interface for various message passing protocols. Security responsibilities lie with the underlying messaging protocol design and the application utilizing it. This specification ensures the interfaces are flexible enough to support the majority of cross-chain messaging protocols, while security within those protocols is outside the scope of this proposal.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Diffusive Tokens</title>
        <published>2024-12-07T00:00:00+00:00</published>
        <updated>2026-04-25T12:06:20+00:00</updated>
	
	
	<author>
		<name>Cheng Qian</name><uri>https://github.com/jamesavechives</uri><email>james.walstonn@gmail.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7837/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7837-diffusive-tokens/21989" />
        

        <id>https://wg-eips.ritovision.com/7837/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:7837"
            label="ERC-7837" />
        

        
        

        
        <summary type="html">A fungible token that mints new tokens on transfer, charges a per-token native fee, and enforces a capped supply.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7837/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC proposes a standard for a new type of fungible token, called &lt;strong&gt;Diffusive Tokens (DIFF)&lt;&#x2F;strong&gt;. Unlike traditional &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens, transferring DIFF tokens does not decrease the sender’s balance. Instead, it &lt;em&gt;mints&lt;&#x2F;em&gt; new tokens directly to the recipient, increasing the total supply on every transfer action. A fixed native currency fee is charged per token transferred, and this fee is paid by the sender to the contract owner. The supply growth is limited by a maximum supply set by the owner. Token holders can also burn their tokens to reduce the total supply. These features enable a controlled, incentivized token distribution model that merges fungibility with a built-in economic mechanism.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Traditional &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens maintain a constant total supply and simply redistribute balances on transfers. While this model is widespread, certain use cases benefit from a token design that continuously expands supply during transfers, simulating a controlled &quot;diffusion&quot; of value. The Diffusive Token model may be suitable for representing claims on real-world goods (e.g., a product batch like iPhone 15 units), digital goods, or controlled asset distributions where initial token distribution and ongoing availability need to be managed differently.&lt;&#x2F;p&gt;
&lt;p&gt;This model also includes a native currency fee per token transferred, incentivizing careful, value-driven transfers and providing a revenue stream for the token’s issuer. The maximum supply cap prevents unbounded inflation, ensuring long-term scarcity. The ability for owners to burn tokens to redeem underlying goods or services directly maps on-chain assets to real-world redemptions.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Use Cases&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Real-World Asset Backing&lt;&#x2F;strong&gt;: A manufacturer can issue DIFF tokens representing a batch of products (e.g., iPhones). Each token can be redeemed (burned) for one physical item.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Fee-Driven Incentives&lt;&#x2F;strong&gt;: The transfer fee ensures that infinite minting by constant transferring is economically disincentivized. The fee also supports the token issuer or provides a funding mechanism.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;terminology&quot;&gt;Terminology&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Diffusive Token&lt;&#x2F;strong&gt;: A fungible token unit that is minted on transfers.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Max Supply&lt;&#x2F;strong&gt;: The maximum total supply the token can reach.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Transfer Fee&lt;&#x2F;strong&gt;: A fee in native blockchain currency (e.g., ETH) that must be paid by the sender for each token transferred. The total fee = &lt;code&gt;transferFee * amount&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Burn&lt;&#x2F;strong&gt;: The action of destroying tokens, reducing both the holder’s balance and the total supply.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;data-structures&quot;&gt;Data Structures&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Total Supply and Max Supply&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; totalSupply&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; maxSupply&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Transfer Fee&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; transferFee&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; fee per token transferred in wei&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;owner&lt;&#x2F;code&gt; sets and updates &lt;code&gt;transferFee&lt;&#x2F;code&gt; and &lt;code&gt;maxSupply&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;token-semantics&quot;&gt;Token Semantics&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Minting on Transfer&lt;&#x2F;strong&gt;
When a transfer occurs from &lt;code&gt;A&lt;&#x2F;code&gt; to &lt;code&gt;B&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;A&lt;&#x2F;code&gt; does not lose any tokens.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;B&lt;&#x2F;code&gt; receives newly minted tokens (increasing their balance and totalSupply).&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;totalSupply&lt;&#x2F;code&gt; increases by the transferred amount, but must not exceed &lt;code&gt;maxSupply&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Fixed Transfer Fee in Native Currency&lt;&#x2F;strong&gt;
Each transfer requires the sender to pay &lt;code&gt;transferFee * amount&lt;&#x2F;code&gt; in the native currency. If &lt;code&gt;msg.value&lt;&#x2F;code&gt; is insufficient, the transaction reverts.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Maximum Supply&lt;&#x2F;strong&gt;
If a transfer would cause &lt;code&gt;totalSupply + amount &amp;gt; maxSupply&lt;&#x2F;code&gt;, it must revert.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Burning Tokens&lt;&#x2F;strong&gt;
Token holders can burn tokens to:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Reduce their balance by the burned amount.&lt;&#x2F;li&gt;
&lt;li&gt;Decrease &lt;code&gt;totalSupply&lt;&#x2F;code&gt; by the burned amount.
This can map to redeeming underlying goods or simply deflating the token.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;interface&quot;&gt;Interface&lt;&#x2F;h3&gt;
&lt;p&gt;The DIFF standard aligns partially with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;, but redefines certain behaviors:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Core Functions:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;function balanceOf(address account) external view returns (uint256);&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;function transfer(address to, uint256 amount) external payable returns (bool);&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Modified behavior&lt;&#x2F;strong&gt;: Mints &lt;code&gt;amount&lt;&#x2F;code&gt; tokens to &lt;code&gt;to&lt;&#x2F;code&gt;, requires &lt;code&gt;msg.value &amp;gt;= transferFee * amount&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;function burn(uint256 amount) external;&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Reduces sender’s balance and &lt;code&gt;totalSupply&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Administration Functions (Owner Only):&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;function setMaxSupply(uint256 newMax) external;&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;function setTransferFee(uint256 newFee) external;&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;function withdrawFees(address payable recipient) external;&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Withdraws accumulated native currency fees.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Optional Approval Interface (For Compatibility):&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;function approve(address spender, uint256 amount) external returns (bool);&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;function transferFrom(address from, address to, uint256 amount) external payable returns (bool);&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Modified behavior&lt;&#x2F;strong&gt;: Similar to &lt;code&gt;transfer&lt;&#x2F;code&gt;, but uses allowance and still mints tokens to &lt;code&gt;to&lt;&#x2F;code&gt; rather than redistributing from &lt;code&gt;from&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;events&quot;&gt;Events&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;event Transfer(address indexed from, address indexed to, uint256 amount);&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Emitted when tokens are minted to &lt;code&gt;to&lt;&#x2F;code&gt; via a transfer call.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;event Burn(address indexed burner, uint256 amount);&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Emitted when &lt;code&gt;amount&lt;&#x2F;code&gt; of tokens are burned from an address.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;event FeeUpdated(uint256 newFee);&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Emitted when the owner updates the &lt;code&gt;transferFee&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;event MaxSupplyUpdated(uint256 newMaxSupply);&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Emitted when the owner updates &lt;code&gt;maxSupply&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;compliance-with-erc-20&quot;&gt;Compliance with ERC-20&lt;&#x2F;h3&gt;
&lt;p&gt;The DIFF standard implements the ERC-20 interface but significantly alters the &lt;code&gt;transfer&lt;&#x2F;code&gt; and &lt;code&gt;transferFrom&lt;&#x2F;code&gt; semantics:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Fungibility&lt;&#x2F;strong&gt;: Each token unit is identical and divisible as in ERC-20.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Balances and Transfers&lt;&#x2F;strong&gt;: The &lt;code&gt;balanceOf&lt;&#x2F;code&gt; function works as normal. However, &lt;code&gt;transfer&lt;&#x2F;code&gt; and &lt;code&gt;transferFrom&lt;&#x2F;code&gt; no longer redistribute tokens. Instead, they mint new tokens (up to &lt;code&gt;maxSupply&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Approvals&lt;&#x2F;strong&gt;: The &lt;code&gt;approve&lt;&#x2F;code&gt; and &lt;code&gt;transferFrom&lt;&#x2F;code&gt; functions remain, but their logic is unconventional since the sender’s balance is never reduced by transfers.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;While the DIFF standard can be seen as ERC-20 compatible at the interface level, the underlying economics differ substantially.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;Design Decisions&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Unlimited Minting vs. Max Supply&lt;&#x2F;strong&gt;: Allowing minting on every transfer provides a “diffusive” spread of tokens. The &lt;code&gt;maxSupply&lt;&#x2F;code&gt; prevents uncontrolled inflation.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Burn Mechanism&lt;&#x2F;strong&gt;: Enables redemption or deflation as tokens are taken out of circulation.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Owner Controls&lt;&#x2F;strong&gt;: The owner (e.g., issuer) can adjust fees and max supply, maintaining flexibility as market conditions change.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The DIFF standard is interface-compatible with ERC-20 but not behaviorally identical. Any system integrating DIFF tokens should understand the difference in minting on transfer.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Wallets and Exchanges&lt;&#x2F;strong&gt;: Most ERC-20 compatible tools can display balances and initiate transfers. However, the unusual economics (mint on transfer) may confuse users and pricing mechanisms.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Allowances and TransferFrom&lt;&#x2F;strong&gt;: Still implemented for interoperability, but the expected logic (debiting &lt;code&gt;from&lt;&#x2F;code&gt; balance) does not apply.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Initial Conditions&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Deploy contract with &lt;code&gt;maxSupply = 1,000,000 DIFF&lt;&#x2F;code&gt;, &lt;code&gt;transferFee = 0.001 ETH&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;totalSupply = 0&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Owner sets parameters and verifies via &lt;code&gt;maxSupply()&lt;&#x2F;code&gt; and &lt;code&gt;transferFee()&lt;&#x2F;code&gt; getters.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Minting on Transfer&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;User A calls &lt;code&gt;transfer(B, 100)&lt;&#x2F;code&gt; with &lt;code&gt;msg.value = 0.1 ETH&lt;&#x2F;code&gt; (assuming &lt;code&gt;transferFee = 0.001 ETH&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;Check &lt;code&gt;balances[B] == 100&lt;&#x2F;code&gt;, &lt;code&gt;totalSupply == 100&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Check that the contract now holds 0.1 ETH from the fee.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Exceeding Max Supply&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If &lt;code&gt;totalSupply = 999,950&lt;&#x2F;code&gt; and someone tries to transfer 100 tokens, causing &lt;code&gt;totalSupply&lt;&#x2F;code&gt; to exceed &lt;code&gt;1,000,000&lt;&#x2F;code&gt;, the transaction reverts.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Burning Tokens&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;User B calls &lt;code&gt;burn(50)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Check &lt;code&gt;balances[B] == 50&lt;&#x2F;code&gt;, &lt;code&gt;totalSupply == 50&lt;&#x2F;code&gt; less than before.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Burn&lt;&#x2F;code&gt; event emitted.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Updating Fee and Withdrawing Funds&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Owner calls &lt;code&gt;setTransferFee(0.002 ETH)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;FeeUpdated&lt;&#x2F;code&gt; event emitted.&lt;&#x2F;li&gt;
&lt;li&gt;Owner calls &lt;code&gt;withdrawFees(ownerAddress)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Check that &lt;code&gt;ownerAddress&lt;&#x2F;code&gt; receives accumulated fees.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;A reference implementation is provided under the asset folder in the EIPs repository. The implementation includes:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A basic contract implementing the DIFF standard.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DiffusiveToken&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; -----------------------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; State Variables&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; -----------------------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; symbol&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; decimals&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; totalSupply&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; maxSupply&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; transferFee&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Fee per token transferred in wei&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; -----------------------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Events&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; -----------------------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Burn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; burner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FeeUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newFee&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MaxSupplyUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newMaxSupply&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Approval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; -----------------------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Modifiers&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; -----------------------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    modifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;DiffusiveToken: caller is not the owner&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        _&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; -----------------------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Constructor&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; -----------------------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Constructor sets the initial parameters for the Diffusive Token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _name&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Token name&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _symbol&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Token symbol&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _decimals&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Decimal places&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _maxSupply&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The max supply of tokens that can ever exist&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _transferFee&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Initial fee per token transferred in wei&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _symbol&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _decimals&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _maxSupply&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _transferFee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        name &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _name&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        symbol &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _symbol&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        decimals &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _decimals&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        maxSupply &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _maxSupply&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        transferFee &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _transferFee&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        owner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        totalSupply &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Initially, no tokens are minted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; -----------------------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; External and Public Functions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; -----------------------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the token balance of the given address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to query&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfers `amount` tokens to address `to`, minting new tokens in the process.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Requires payment of native currency: transferFee * amount.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Recipient address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Number of tokens to transfer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; True&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if successful&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;to &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;DiffusiveToken: transfer to zero address&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;amount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;DiffusiveToken: amount must be greater than zero&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; requiredFee &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; transferFee &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;value &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; requiredFee&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;DiffusiveToken: insufficient fee&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check max supply limit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;totalSupply &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt; amount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; maxSupply&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;DiffusiveToken: would exceed max supply&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Mint new tokens to `to`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        totalSupply &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Burns `amount` tokens from the caller&amp;#39;s balance, decreasing total supply.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The number of tokens to burn&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; burn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;amount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;DiffusiveToken: burn amount must be greater than zero&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;DiffusiveToken: insufficient balance&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        totalSupply &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Burn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Approves `spender` to transfer up to `amount` tokens on behalf of `msg.sender`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address authorized to spend&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The max amount they can spend&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;spender &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;DiffusiveToken: approve to zero address&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        allowances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;spender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Approval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the current allowance of `spender` for `owner`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The owner of the tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address allowed to spend the tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; allowance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; allowances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_owner&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_spender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfers `amount` tokens from `from` to `to` using the allowance mechanism.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The `from` account does not lose tokens; this still mints to `to`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address from which the allowance has been given&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The recipient address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The number of tokens to transfer (mint)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;to &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;DiffusiveToken: transfer to zero address&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;amount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;DiffusiveToken: amount must be greater than zero&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; allowed &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; allowances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;allowed &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;DiffusiveToken: allowance exceeded&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Deduct from allowance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        allowances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; allowed &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; requiredFee &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; transferFee &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;value &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; requiredFee&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;DiffusiveToken: insufficient fee&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check max supply&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;totalSupply &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt; amount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; maxSupply&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;DiffusiveToken: would exceed max supply&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Mint tokens to `to`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        totalSupply &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; -----------------------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Owner Functions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; -----------------------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Updates the maximum supply of tokens. Must be &amp;gt;= current totalSupply.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; newMaxSupply&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The new maximum supply&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setMaxSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newMaxSupply&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;newMaxSupply &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; totalSupply&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;DiffusiveToken: new max &amp;lt; current supply&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        maxSupply &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; newMaxSupply&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MaxSupplyUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;newMaxSupply&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Updates the per-token transfer fee.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; newFee&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The new fee in wei per token transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setTransferFee&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newFee&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        transferFee &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; newFee&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FeeUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;newFee&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Allows the owner to withdraw accumulated native currency fees.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; recipient&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address that will receive the withdrawn fees&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; withdrawFees&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;recipient &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;DiffusiveToken: withdraw to zero address&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; balance &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balance&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt; success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; )&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;call&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; balance&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;DiffusiveToken: withdrawal failed&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; -----------------------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Fallback and Receive&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; -----------------------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Allows the contract to receive Ether.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    receive&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;Interfaces and helper contracts for testing and demonstration purposes.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Reentrancy&lt;&#x2F;strong&gt;: Handle fee transfers using the Checks-Effects-Interactions pattern. Consider &lt;code&gt;ReentrancyGuard&lt;&#x2F;code&gt; from OpenZeppelin to prevent reentrant calls.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Overflow&#x2F;Underflow&lt;&#x2F;strong&gt;: Solidity 0.8.x guards against this by default.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Contract Balance Management&lt;&#x2F;strong&gt;: Ensure enough native currency is sent to cover fees. Revert on insufficient fees.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Access Control&lt;&#x2F;strong&gt;: Only the owner can update &lt;code&gt;transferFee&lt;&#x2F;code&gt; and &lt;code&gt;maxSupply&lt;&#x2F;code&gt;. Use proper &lt;code&gt;onlyOwner&lt;&#x2F;code&gt; modifiers.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Scheduled function calls</title>
        <published>2024-12-06T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Keyvan Kambakhsh</name><uri>https://github.com/keyvank</uri>
	</author>
	
	<author>
		<name>Nobitex Labs</name><email>labs@nobitex.ir</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7833/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7833-scheduled-function-calls/21975" />
        

        <id>https://wg-eips.ritovision.com/7833/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:7833"
            label="EIP-7833" />
        

        
        

        
        <summary type="html">Giving life to smart contracts by enabling their functions to be automatically invoked by block producers.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7833/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Ethereum&#x27;s smart contracts enable users to delegate control of their funds to code, but these contracts require an external trigger to execute. Timing is often critical, and issues such as network delays or malicious behavior by block producers—like MEV attacks—can prevent timely execution. To address these challenges, this Ethereum Improvement Proposal (EIP) introduces a new opcode, OFFERCALL, which allows contracts to schedule function calls. When functions self-schedule, they exhibit bot-like behavior. These scheduled calls would offer ETH to block producers as an incentive to prioritize their execution over manually submitted transactions. If the offer is not fulfilled, the bot is deactivated until manually re-ignited by the owner. The EIP proposes enforcing the execution of scheduled calls as a requirement for block validity. This could help mitigate MEV attacks, as block producers would be compelled to execute bots that neutralize market manipulation within the blockchain.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Adding bot-like behavior to an EVM function is achieved by recursively scheduling a call to the same function in the next block. We propose introducing a new EVM opcode, OFFERCALL, which, as the name implies, offers ETH to be burnt to the block producer of the next block in exchange for invoking a function. These offers are aggregated and ranked by the Ethereum node, with only the top N offers being retained; all others are discarded. Scheduled calls must be executed before any user transactions, with execution order determined by their rank in the sorted list. The offered ETH is burnt to prevent block producers from exploiting the system by scheduling calls that pay the offered amounts back to themselves.&lt;&#x2F;p&gt;
&lt;p&gt;Here is a solidity example of how the usage of OFFERCALL would look like:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Bot&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; offerPerCall&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _offer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        offerPerCall &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _offer&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Ignite the bot with an initial invocation offer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        offercall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;update&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; offerPerCall&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setOffer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _offer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        offerPerCall &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _offer&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; update&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Do scheduled work&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The callee may reschedule itself in order to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; introduce a bot-like behavior.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The callee has to be careful about its offer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; otherwise it may die.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        offercall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;update&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; offerPerCall&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Once an offercall fails, the contract owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; may have to set a new offer by calling `setOffer`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; and then invoking the `update()` function again.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;An OFFERCALL fails in two situations:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The contract does not hold at least the offered amount of ETH.&lt;&#x2F;li&gt;
&lt;li&gt;The offered amount is not large enough to rank within the top N offers.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In the case of a self-scheduling function, once an OFFERCALL fails, the bot is deactivated. The only way to revive it is for the contract owner to manually call the function again, likely with a higher offer.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The rationale behind this Ethereum Improvement Proposal (EIP) stems from the need to enhance the reliability and fairness of smart contract execution on the Ethereum network. While Ethereum’s smart contracts allow for a high degree of programmability and automation, the execution of these contracts often depends on external triggers, such as user transactions or network conditions. This dependency introduces significant challenges, particularly in situations where timing is critical or when malicious actors, like block producers, can exploit the system for profit.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The introduction of the new OFFERCALL opcode in this EIP requires a network upgrade, as it adds new functionality that is not currently supported by the Ethereum Virtual Machine (EVM). This change will affect how smart contracts can schedule and incentivize the execution of specific function calls, introducing a new mechanism that block producers must accommodate.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;N&#x2F;A&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The main concern with this EIP is whether it could lead to centralization, as wealthier users might dominate execution priorities. Burning unfulfilled offers partly addresses this by preventing endless offers.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Separate Metadata Section for EOF</title>
        <published>2024-12-06T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Kaan Uzdogan</name><uri>https://github.com/kuzdogan</uri>
	</author>
	
	<author>
		<name>Marco Castignoli</name><uri>https://github.com/marcocastignoli</uri>
	</author>
	
	<author>
		<name>Manuel Wedler</name><uri>https://github.com/manuelwedler</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7834/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7834-separate-metadata-section-for-eof/22138" />
        

        <id>https://wg-eips.ritovision.com/7834/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7834"
            label="EIP-7834" />
        

        
        

        
        <summary type="html">Introduce a new separate metadata section to the EOF</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7834/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce a new separate metadata section to the Ethereum Object Format (EOF) that is unreachable by the code, and any changes to which does not affect the code.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;It is desirable to include metadata in contract&#x27;s bytecode for various reasons. For instance, both the Solidity and Vyper compilers by default include the language and compiler version used to compile. Vyper (with 0.4.1) appends an integrity hash to the initcode in CBOR encoding. Solidity additionally includes the IPFS or the Swarm hash of the Solidity contract metadata.json file, and the experimental Solidity flag. The current (pre-EOF) practice is to append this CBOR encoded metadata section in the contract&#x27;s runtime bytecode, followed by the 2 bytes length of the CBOR encoded bytes.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        Solidity     ┌──────────────────────────────────────────0x0033 bytes──────────────────────────────────────────────┐&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;...7265206c656e677468a2646970667358221220dceca8706b29e917dacf25fceef95acac8d90d765ac926663ce4096195952b6164736f6c634300060b0033&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This poses a problem for source code verification where the onchain bytecode is compared to the compiled bytecode of the given source code. During a contract verification, metadata sections, in particular the IPFS hash, need to be ignored and only the executional bytecode should be compared. Since pre-EOF bytecode is not structured, it is not possible to distinguish the metadata section from the executional bytecode easily. This gets even trickier in the case of factory contracts with multiple nested bytecodes, each having their own metadata sections. Verifiers need to implement their own heuristics and workarounds to find the metadata sections and ignore it.&lt;&#x2F;p&gt;
&lt;p&gt;The EOF brings structure to the bytecode by separating the code from the data, and placing the code of each contract in their respective containers. In its current form, this makes it possible to find the data easier than the pre-EOF bytecode. However, the current spec also does not describe a metadata section. Compilers currently need to place the contract metadata inside the data section which poses several problems:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;It is not straightforward to distinguish the metadata part in the &lt;code&gt;data_section&lt;&#x2F;code&gt;, which poses the same problem as the pre-EOF bytecode.&lt;&#x2F;li&gt;
&lt;li&gt;Any change to the metadata&#x27;s size within the data section will change the executional bytecode, e.g. through shifting &lt;code&gt;DATALOADN&lt;&#x2F;code&gt; offsets. With that, two identical contracts with different metadata sizes will not match during source code, since the code will be different.&lt;&#x2F;li&gt;
&lt;li&gt;The metadata can theoretically be reached by the code, e.g. via manipulating the &lt;code&gt;DATALOADN&lt;&#x2F;code&gt; instructions.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;Extending the format introduced in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3540&#x2F;&quot;&gt;EIP-3540&lt;&#x2F;a&gt;, this EIP proposes to add a new OPTIONAL section in the body called &lt;code&gt;metadata_section&lt;&#x2F;code&gt; before the &lt;code&gt;data_section&lt;&#x2F;code&gt;, and to add two new OPTIONAL fields &lt;code&gt;kind_metadata&lt;&#x2F;code&gt; (value: &lt;code&gt;0x05&lt;&#x2F;code&gt;) and &lt;code&gt;metadata_size&lt;&#x2F;code&gt; to the header before the &lt;code&gt;kind_data&lt;&#x2F;code&gt; and &lt;code&gt;data_size&lt;&#x2F;code&gt; fields.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;container := header, body&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;header :=&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    magic, version,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    kind_type, type_size,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    kind_code, num_code_sections, code_size+,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    [kind_container, num_container_sections, container_size+,]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    [kind_metadata, metadata_size,]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    kind_data, data_size,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    terminator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;body := types_section, code_section+, container_section*, [metadata_section], data_section&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;types_section := (inputs, outputs, max_stack_increase)+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;header&quot;&gt;Header&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;name&lt;&#x2F;th&gt;&lt;th&gt;length&lt;&#x2F;th&gt;&lt;th&gt;value&lt;&#x2F;th&gt;&lt;th&gt;description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;...&lt;&#x2F;td&gt;&lt;td&gt;...&lt;&#x2F;td&gt;&lt;td&gt;...&lt;&#x2F;td&gt;&lt;td&gt;...&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;kind_metadata&lt;&#x2F;td&gt;&lt;td&gt;1 byte&lt;&#x2F;td&gt;&lt;td&gt;0x05&lt;&#x2F;td&gt;&lt;td&gt;kind marker for metadata size section&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;metadata_size&lt;&#x2F;td&gt;&lt;td&gt;2 bytes&lt;&#x2F;td&gt;&lt;td&gt;0x0001-0xFFFF&lt;&#x2F;td&gt;&lt;td&gt;16-bit unsigned big-endian integer denoting the length of the metadata section content&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;kind_data&lt;&#x2F;td&gt;&lt;td&gt;1 byte&lt;&#x2F;td&gt;&lt;td&gt;0xff&lt;&#x2F;td&gt;&lt;td&gt;kind marker for data size section&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;data_size&lt;&#x2F;td&gt;&lt;td&gt;2 bytes&lt;&#x2F;td&gt;&lt;td&gt;0x0000-0xFFFF&lt;&#x2F;td&gt;&lt;td&gt;16-bit unsigned big-endian integer denoting the length of the data section content (*)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;terminator&lt;&#x2F;td&gt;&lt;td&gt;1 byte&lt;&#x2F;td&gt;&lt;td&gt;0x00&lt;&#x2F;td&gt;&lt;td&gt;marks the end of the header&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;body&quot;&gt;Body&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;name&lt;&#x2F;th&gt;&lt;th&gt;length&lt;&#x2F;th&gt;&lt;th&gt;value&lt;&#x2F;th&gt;&lt;th&gt;description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;...&lt;&#x2F;td&gt;&lt;td&gt;...&lt;&#x2F;td&gt;&lt;td&gt;...&lt;&#x2F;td&gt;&lt;td&gt;...&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;metadata_section&lt;&#x2F;td&gt;&lt;td&gt;variable&lt;&#x2F;td&gt;&lt;td&gt;n&#x2F;a&lt;&#x2F;td&gt;&lt;td&gt;arbitrary sequence of bytes&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;data_section&lt;&#x2F;td&gt;&lt;td&gt;variable&lt;&#x2F;td&gt;&lt;td&gt;n&#x2F;a&lt;&#x2F;td&gt;&lt;td&gt;arbitrary sequence of bytes&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The structure and the encoding of the &lt;code&gt;metadata_section&lt;&#x2F;code&gt; is not defined by this EIP. It is left to the compilers, tooling, or the contract developers to define the encoding and the content. The current practice by the Solidity and Vyper compilers is to use CBOR encoding.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;metadata_section&lt;&#x2F;code&gt; in the &lt;code&gt;body&lt;&#x2F;code&gt;, as well as the &lt;code&gt;kind_metadata&lt;&#x2F;code&gt; and &lt;code&gt;metadata_size&lt;&#x2F;code&gt; fields in the &lt;code&gt;header&lt;&#x2F;code&gt;, are OPTIONAL. This way, the compilers can avoid additional bytes in the container if they don&#x27;t want to write any metadata. The &lt;code&gt;data_section&lt;&#x2F;code&gt; can change in its size and content during deployment, therefore it needs to be REQUIRED, even if the data is empty. The &lt;code&gt;metadata_section&lt;&#x2F;code&gt; is not expected to change during the deployment.&lt;&#x2F;p&gt;
&lt;p&gt;The reason for placing the &lt;code&gt;metadata_section&lt;&#x2F;code&gt; before the &lt;code&gt;data_section&lt;&#x2F;code&gt;, and assigning &lt;code&gt;kind_metadata&lt;&#x2F;code&gt; the value &lt;code&gt;0x05&lt;&#x2F;code&gt; (and not &lt;code&gt;0x04&lt;&#x2F;code&gt;) is to make it easier for the existing EOF tooling adapt the changes. Additionally, if the &lt;code&gt;metadata_section&lt;&#x2F;code&gt; was placed after the &lt;code&gt;data_section&lt;&#x2F;code&gt;, changes to the &lt;code&gt;data_section&lt;&#x2F;code&gt; in deploy time would cause the &lt;code&gt;metadata_section&lt;&#x2F;code&gt; to shift. By placing the &lt;code&gt;metadata_section&lt;&#x2F;code&gt; before, this could be mitigated.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues are expected since &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3540&#x2F;&quot;&gt;EIP-3540&lt;&#x2F;a&gt; is not implemented yet.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;No security considerations as this section is meant not to be executed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Wallet Call Preparation API</title>
        <published>2024-12-06T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Lukas Rosario</name><uri>https://github.com/lukasrosario</uri>
	</author>
	
	<author>
		<name>Conner Swenberg</name><uri>https://github.com/ilikesymmetry</uri>
	</author>
	
	<author>
		<name>Adam Hodges</name><uri>https://github.com/ajhodges</uri>
	</author>
	
	<author>
		<name>Paaras Bhandari</name><uri>https://github.com/paarasbhandari</uri>
	</author>
	
	<author>
		<name>Jake Moxey</name><uri>https://github.com/jxom</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7836/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/new-erc-wallet-call-preparation-api/22456" />
        

        <id>https://wg-eips.ritovision.com/7836/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7836"
            label="ERC-7836" />
        

        
        

        
        <summary type="html">Adds JSON-RPC methods for requesting unsigned EIP-5792 calls based on the wallet&#x27;s implementation, and then sending those calls once signed.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7836/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal defines complementary JSON-RPC methods to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5792&#x2F;&quot;&gt;EIP-5792&#x27;s &lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; to enable an Application to sign over a call bundle (instead of the Wallet). Methods defined in this proposal are purposed for the Application to sign over &lt;code&gt;calls&lt;&#x2F;code&gt; and submit them to the Wallet with an accompanying signature. This is in contrast to &lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt;, where a Wallet itself signs over the call bundle.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Applications are increasingly seeking to use session keys and scoped permissions to make transactions on a user&#x27;s behalf, without the user having to approve and sign each transaction in their wallet&#x27;s interface. One example is an application that automates a user&#x27;s decentralised exchange trading. As Smart Contract Accounts (SCAs) contain arbitrary execution interfaces that lead to varying calldata formats, it is not possible for an Application to know how to sign over an action for any arbitrary Account implementation, without maintaining a mapping of Account implementations to their signing logic. Apps need a simple way to request the payload that their session keys should sign, given a call or set of calls they wish to make, and a way to execute the calls once signed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;In this specification, we define two new JSON-RPC methods: &lt;code&gt;wallet_prepareCalls&lt;&#x2F;code&gt; and &lt;code&gt;wallet_sendPreparedCalls&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;wallet-preparecalls&quot;&gt;&lt;code&gt;wallet_prepareCalls&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Instructs a Wallet to prepare a call bundle according to the Account&#x27;s implementation. It returns a &lt;code&gt;digest&lt;&#x2F;code&gt; of the call bundle to sign over, as well as the parameters required to fulfil a &lt;code&gt;wallet_sendPreparedCalls&lt;&#x2F;code&gt; request (ie. &lt;code&gt;capabilities&lt;&#x2F;code&gt;, &lt;code&gt;chainId&lt;&#x2F;code&gt;, &lt;code&gt;context&lt;&#x2F;code&gt;, and &lt;code&gt;version&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;After calling &lt;code&gt;wallet_prepareCalls&lt;&#x2F;code&gt;, consumers are expected to sign over the &lt;code&gt;digest&lt;&#x2F;code&gt; and submit the &lt;code&gt;signature&lt;&#x2F;code&gt; and prepared calls to the Wallet via &lt;code&gt;wallet_sendPreparedCalls&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h4 id=&quot;request&quot;&gt;Request&lt;&#x2F;h4&gt;
&lt;blockquote&gt;
&lt;p&gt;The request is identical to that of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5792&#x2F;&quot;&gt;&lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Request&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  method&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;wallet_prepareCalls&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  params&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Calls to be executed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;      calls&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        to&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        capabilities&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Record&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; any&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Capabilities.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;      capabilities&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Record&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; any&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Chain ID of the chain the calls are being submitted to.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;      chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sender address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;      from&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Key (hint) that will be used to sign the call bundle.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;      key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Whether the digest will be prehashed by the key (default behavior of WebCrypto APIs).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        prehash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; boolean&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Public key.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        publicKey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Key type.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;secp256k1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;p256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;webauthn-p256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; JSON-RPC method version.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;      version&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;response&quot;&gt;Response&lt;&#x2F;h4&gt;
&lt;blockquote&gt;
&lt;p&gt;The response is intended to be forwarded to &lt;code&gt;wallet_sendPreparedCalls&lt;&#x2F;code&gt; (minus the &lt;code&gt;digest&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Response&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Capabilities to be forwarded to `wallet_sendPreparedCalls`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  capabilities&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Record&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; any&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Chain ID of the chain the calls are being submitted to.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Data specific to the Wallet to be forwarded to `wallet_sendPreparedCalls`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; (e.g. ERC-4337 UserOperation or alternative).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  context&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; unknown&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Key (hint) that will be used to sign the call bundle.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Whether the digest will be prehashed by the key (default behavior of WebCrypto APIs).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    prehash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; boolean&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Public key.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    publicKey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Key type.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;secp256k1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;p256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;webauthn-p256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;webcrypto-p256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Digest of the call bundle to sign over.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  digest&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; JSON-RPC method version.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  version&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;example&quot;&gt;Example&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; response&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; provider&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;request&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  method&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;wallet_prepareCalls&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  params&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      calls&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          to&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xcafebabecafebabecafebabecafebabecafebabe&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xdeadbeef&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      capabilities&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        paymasterService&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          url&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      chainId&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      key&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        prehash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        publicKey&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;p256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      version&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *   capabilities: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *     paymasterService: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *       url: &amp;#39;https:&#x2F;&#x2F;...&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *     }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *   },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *   chainId: &amp;#39;0x1&amp;#39;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *   context: { ... },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *   digest: &amp;#39;0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef&amp;#39;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *   key: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *     prehash: false,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *     publicKey: &amp;#39;0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef&amp;#39;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *     type: &amp;#39;p256&amp;#39;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *   },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *   version: &amp;#39;1&amp;#39;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;wallet-sendpreparedcalls&quot;&gt;&lt;code&gt;wallet_sendPreparedCalls&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Instructs a Wallet to execute a prepared call bundle (response of &lt;code&gt;wallet_prepareCalls&lt;&#x2F;code&gt;) with an accompanying &lt;code&gt;signature&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h4&gt;
&lt;blockquote&gt;
&lt;p&gt;The request is identical to the response of &lt;code&gt;wallet_prepareCalls&lt;&#x2F;code&gt;, except that it includes a &lt;code&gt;signature&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Request&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  method&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;wallet_sendPreparedCalls&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  params&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Capabilities.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;      capabilities&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Record&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; any&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Chain ID of the chain the calls are being submitted to.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;      chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Data specific to the Wallet from the `wallet_prepareCalls` response.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; (e.g. ERC-4337 UserOperation or alternative).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;      context&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; unknown&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Key that was used to sign the call bundle.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;      key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Whether the digest will be prehashed by the key (default behavior of WebCrypto APIs).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        prehash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; boolean&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Public key.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        publicKey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Key type.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;secp256k1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;p256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;webauthn-p256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;webcrypto-p256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Signature of the call bundle.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;      signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; JSON-RPC method version.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;      version&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;response-1&quot;&gt;Response&lt;&#x2F;h4&gt;
&lt;blockquote&gt;
&lt;p&gt;The response is identical to that of &lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Response&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  id&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  capabilities&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Record&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; any&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;example-1&quot;&gt;Example&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; digest&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ...&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;request&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; provider&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;request&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  method&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;wallet_prepareCalls&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  params&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      calls&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          to&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xcafebabecafebabecafebabecafebabecafebabe&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xdeadbeef&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      capabilities&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        paymasterService&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          url&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      chainId&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      key&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        prehash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        publicKey&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;p256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      version&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; p256&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;sign&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;digest&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; privateKey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; response&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; provider&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;request&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  method&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;wallet_sendPreparedCalls&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  params&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      ...&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;request&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *   {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *     id: &amp;#39;0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef&amp;#39;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *   }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;These endpoints extend the interface established by EIP-5792, given the emergent needs of application developers.&lt;&#x2F;p&gt;
&lt;p&gt;Adding new endpoints for this specific use case is simpler than adding additional options to the &lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt; endpoint.&lt;&#x2F;p&gt;
&lt;p&gt;Surfacing the prepared calls should be relatively simple for wallets, who already need to do preparation internally in order to support &lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt;, and who then submit signed calls on chain.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This specification is currently compatible with EIP-5792 and does not introduce breaking changes to existing &lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt; flows.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;It does not modify or deprecate &lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt;; wallets compliant with EIP-5792 continue to work unchanged.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;wallet_prepareCalls&lt;&#x2F;code&gt; mirrors the &lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt; request shape and returns values intended to be forwarded to &lt;code&gt;wallet_sendPreparedCalls&lt;&#x2F;code&gt;, preserving field formats such as &lt;code&gt;capabilities&lt;&#x2F;code&gt;, &lt;code&gt;chainId&lt;&#x2F;code&gt;, &lt;code&gt;context&lt;&#x2F;code&gt;, and &lt;code&gt;version&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;wallet_sendPreparedCalls&lt;&#x2F;code&gt; consumes the same data the wallet would otherwise construct internally for EIP-5792, with the addition of an externally produced &lt;code&gt;signature&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Any additional key types or hints (e.g., WebCrypto&#x2F;WebAuthn variants) are optional and do not affect EIP-5792 behavior.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Key authorization and scope: Wallets MUST verify that the provided &lt;code&gt;key.publicKey&lt;&#x2F;code&gt; is authorized for the account and that the requested &lt;code&gt;capabilities&lt;&#x2F;code&gt; are within that key’s permissions (scopes, limits, validity windows).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Prehashing consistency: Honor &lt;code&gt;key.prehash&lt;&#x2F;code&gt; consistently. A mismatch between signer and verifier (e.g., double-hashing vs prehashed input) can cause verification failures. Wallets SHOULD fix the hash function per key type.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Preparation-to-execution linkage: Wallets SHOULD ensure &lt;code&gt;wallet_sendPreparedCalls&lt;&#x2F;code&gt; corresponds to a &lt;code&gt;digest&lt;&#x2F;code&gt; they could have produced (e.g., by recomputing it) and MAY track a preparation identifier and&#x2F;or validity window to mitigate long-lived replay.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;WebAuthn&#x2F;origin considerations: For &lt;code&gt;webauthn-p256&lt;&#x2F;code&gt;, prefer user-verification and origin-bound credentials. Applications SHOULD keep session keys non-extractable and hardware-backed where available, and avoid presenting opaque digests for end-user approval.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Resource usage and DoS: Wallets MAY rate-limit &lt;code&gt;wallet_prepareCalls&lt;&#x2F;code&gt;, cap bundle sizes, and validate inputs early to avoid expensive context generation for malformed or adversarial requests.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>SLOTNUM opcode</title>
        <published>2024-12-06T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Marc Harvey-Hill</name><uri>https://github.com/Marchhill</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7843/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7843-slotnum-opcode/22234" />
        

        <id>https://wg-eips.ritovision.com/7843/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7843"
            label="EIP-7843" />
        

        
        

        
        <summary type="html">Opcode to get the current slot number</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7843/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes to add a new opcode &lt;code&gt;SLOTNUM&lt;&#x2F;code&gt; (&lt;code&gt;0x4b&lt;&#x2F;code&gt;), that returns the corresponding slot number for the current block.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;There are currently two ways to get the current slot number onchain:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Calculate from the block timestamp. This requires hardcoding the chain slot length into a smart contract.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Provide the slot number as calldata and prove it against the beacon block root (using &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4788&#x2F;&quot;&gt;EIP-4788&lt;&#x2F;a&gt;).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Both of these approaches have significant drawbacks. (1) would break contracts in the event of a change to the slot length. (2) is expensive in terms of gas, encouraging approach (1) to be used instead.&lt;&#x2F;p&gt;
&lt;p&gt;A better approach is for the slot length to be abstracted away from applications, and instead the slot number can be calculated in the consensus layer client and exposed by an opcode. This paves the way for future changes to the slot length.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;A new opcode &lt;code&gt;SLOTNUM&lt;&#x2F;code&gt; is introduced at &lt;code&gt;0x4b&lt;&#x2F;code&gt;. It shall return one stack element.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;output&quot;&gt;Output&lt;&#x2F;h3&gt;
&lt;p&gt;One element &lt;code&gt;slotNumber&lt;&#x2F;code&gt; is added to the stack; it is equal to the corresponding slot number for this block. &lt;code&gt;slotNumber&lt;&#x2F;code&gt; is a &lt;code&gt;uint64&lt;&#x2F;code&gt; in big endian encoding.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-cost&quot;&gt;Gas Cost&lt;&#x2F;h3&gt;
&lt;p&gt;The gas cost for &lt;code&gt;SLOTNUM&lt;&#x2F;code&gt; is a fixed fee of &lt;code&gt;2&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;rpc-changes&quot;&gt;RPC changes&lt;&#x2F;h3&gt;
&lt;p&gt;The slot number is calculated in the consensus layer and passed to the execution layer through the engine API.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;header-extension&quot;&gt;Header extension&lt;&#x2F;h4&gt;
&lt;p&gt;The header encoding shall be extended to include a &lt;code&gt;slotNumber&lt;&#x2F;code&gt; field of type &lt;code&gt;uint64&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;engine-api-changes&quot;&gt;Engine API changes&lt;&#x2F;h4&gt;
&lt;p&gt;New objects &lt;code&gt;ExecutionPayloadV4&lt;&#x2F;code&gt; and &lt;code&gt;PayloadAttributesV4&lt;&#x2F;code&gt; are introduced, adding a &lt;code&gt;slotNumber&lt;&#x2F;code&gt; field of type &lt;code&gt;uint64&lt;&#x2F;code&gt;. The methods &lt;code&gt;engine_newPayloadV4&lt;&#x2F;code&gt;, &lt;code&gt;engine_getPayloadV6&lt;&#x2F;code&gt;, and &lt;code&gt;engine_forkChoiceUpdateV4&lt;&#x2F;code&gt; are added, to use the new objects.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;gas-price&quot;&gt;Gas Price&lt;&#x2F;h3&gt;
&lt;p&gt;The opcode is priced to match similar opcodes in the &lt;code&gt;W_base&lt;&#x2F;code&gt; set.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;calculation-in-consensus-layer&quot;&gt;Calculation in consensus layer&lt;&#x2F;h3&gt;
&lt;p&gt;The slot number could alternatively be calculated in the execution layer using the timestamp, but it is more appropriate to calculate values pertaining to the beacon chain in the consensus layer. Additionally this avoids code duplication, as the slot number is already calculated in the consensus layer.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;zk-vm-proving&quot;&gt;ZK-VM proving&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;SLOTNUM&lt;&#x2F;code&gt; opcode should not increase the complexity of proving EVM execution, as it is similar to existing opcodes such as &lt;code&gt;TIMESTAMP&lt;&#x2F;code&gt;. The slot number is included in the block header rather than as a &lt;code&gt;engine_newPayload&lt;&#x2F;code&gt; parameter, ensuring that the block is self-contained for proving; no extra inputs to the circuit are required.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;N&#x2F;A&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;None.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Sustainable collaborative NFT collections</title>
        <published>2024-12-04T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Gustavo Lobo</name><uri>https://github.com/gflobo</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7832/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7832-sustainable-nft-collections/22201" />
        

        <id>https://wg-eips.ritovision.com/7832/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7832"
            label="ERC-7832" />
        

        
        

        
        <summary type="html">Economically sustainable collaborative NFT collections with dynamic fees and donation-based engagement.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7832/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes a standard for creating economically sustainable NFT governance for collections built on collaborative models based on &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;. It introduces dynamic minting fees, role-based access control, and a donation-based engagement model to enhance creator-community interactions. These mechanisms aim to balance scarcity, incentivize meaningful participation, and ensure sustainable growth for both creators and contributors.&lt;&#x2F;p&gt;
&lt;p&gt;The model defines &quot;economically sustainable&quot; as tokens whose minting value, creator subscription fees, and token quantity within each progressive discount cycle can only be adjusted once every 30 days from the last update by an &lt;code&gt;ADMIN&lt;&#x2F;code&gt; user. These mechanisms prevent excessive administrative modifications that could disrupt market stability, ensuring consistent price discovery and maintaining participant confidence. By aligning incentives and fostering predictability, the model creates a robust framework for engagement and value creation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h3&gt;
&lt;p&gt;As the NFT market matures, one of the recurring challenges faced by both creators and users is the inflationary nature of supply and the lack of effective mechanisms to engage the community meaningfully. NFT collections built on collaborative models require governance systems that empower all stakeholders—creators, contributors, and collectors—while also maintaining long-term economic sustainability. The introduction of this proposal aims to solve these issues by fostering a more dynamic, flexible, and transparent system for NFT collections. This EIP addresses these gaps by introducing:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Role-Based Access&lt;&#x2F;strong&gt;: Empowering creators while ensuring transparent governance by admins.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Dynamic Minting Fees&lt;&#x2F;strong&gt;: To align token costs with user activity and ownership.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Donation-Based Engagement&lt;&#x2F;strong&gt;: Encouraging contributions to creators.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;The following interface &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be implemented.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.20&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7832&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC721&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Events&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CreatorTermsUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; mintBaseFee&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; creatorSignatureFee&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; maxMintsPerUserInCycle&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DonationReceived&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Function to get the current token ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; currentTokenId&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Function to get the current mint base fee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mintBaseFee&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Function to get the creator signature fee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; creatorSignatureFee&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Function to get the maximum mints a user can perform during his progressive discount cycle per mint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; maxMintsPerUserInCycle&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Function to get the last update timestamp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; lastUpdateTimestamp&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Function to get the update interval constant (30 days)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UPDATE_INTERVAL&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Function to get the CREATOR_ROLE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getCreatorSignature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Function to get the CONTRIBUTOR_ROLE identifier&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CONTRIBUTOR_ROLE&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Function to get CREATOR_ROLE identifier&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CREATOR_ROLE&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Function to get ADMIN_ROLE identifier&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ADMIN_ROLE&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Function to check the number of mints a user has performed in their current cycle of progressive discounts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mintsPerUserInCycle&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Allow users to donate ETH to a specific creator in the system.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; donate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; creator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Allow users to check their mint fee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mintFee&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Allow token owners to burn their tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; burn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Allow ADMIN_ROLE pause the contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; pause&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Allow ADMIN_ROLE unpause the contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; unpause&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Allow CREATOR_ROLE to mint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeMint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uri&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Allow ADMIN_ROLE to update contract terms&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; updateTerms&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; mintBaseFee&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; creatorSignatureFee&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; maxMintsPerUserInCycle&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Allow ADMIN_ROLE to withdraw funds from the contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; withdraw&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;currenttokenid&quot;&gt;&lt;code&gt;currentTokenId()&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;Description:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Tracks the current token ID in the system. Can also be used to determine how many tokens have been minted in the system.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;mintbasefee&quot;&gt;&lt;code&gt;mintBaseFee()&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;Description&lt;&#x2F;strong&gt;:&lt;br &#x2F;&gt;
The base fee for minting a token, paid by the user to create a new token.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;creatorsignaturefee&quot;&gt;&lt;code&gt;creatorSignatureFee()&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;Description&lt;&#x2F;strong&gt;:&lt;br &#x2F;&gt;
The fee required for a user to acquire a creator&#x27;s signature, allowing them to become a creator in the system.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;maxmintsperuserincycle&quot;&gt;&lt;code&gt;maxMintsPerUserInCycle()&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;Description&lt;&#x2F;strong&gt;:&lt;br &#x2F;&gt;
The maximum number of mints a user can perform during their current cycle of progressive discounts. Once the limit is exceeded, the user&#x27;s minting count is reset to zero.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;lastupdatetimestamp&quot;&gt;&lt;code&gt;lastUpdateTimestamp()&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;Description&lt;&#x2F;strong&gt;:&lt;br &#x2F;&gt;
Timestamp of the last time the contract terms were updated (e.g., minting fees and creator signature fees). It is used to determine when the contract&#x27;s terms can be updated again.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;update-interval&quot;&gt;&lt;code&gt;UPDATE_INTERVAL()&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;Description&lt;&#x2F;strong&gt;:&lt;br &#x2F;&gt;
The time interval between contract terms updates. &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be fixed to &lt;ins&gt;30 days&lt;&#x2F;ins&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;admin-role&quot;&gt;&lt;code&gt;ADMIN_ROLE()&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;Description&lt;&#x2F;strong&gt;:&lt;br &#x2F;&gt;
The role identifier for admins in the system.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Requirements&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;MUST&lt;&#x2F;strong&gt; be assigned inside the constructor to the &lt;code&gt;msg.sender&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;creator-role&quot;&gt;&lt;code&gt;CREATOR_ROLE()&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;Description&lt;&#x2F;strong&gt;:&lt;br &#x2F;&gt;
The role identifier for creators in the system.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Requirements&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;MUST&lt;&#x2F;strong&gt; be assigned inside the constructor to the &lt;code&gt;msg.sender&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;contributor-role&quot;&gt;&lt;code&gt;CONTRIBUTOR_ROLE()&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;Description&lt;&#x2F;strong&gt;:&lt;br &#x2F;&gt;
The role identifier for contributors in the system.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;mintsperuserincycle-address-user&quot;&gt;&lt;code&gt;mintsPerUserInCycle(address user)&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;Description&lt;&#x2F;strong&gt;:&lt;br &#x2F;&gt;
Tracks the number of mints a user has performed in their current cycle of progressive discounts. It is used to enforce the maximum minting limit per user.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;creatortermsupdated-uint256-mintbasefee-uint256-creatorsignaturefee-uint256-maxmintsperuserincycle&quot;&gt;&lt;code&gt;CreatorTermsUpdated(uint256 mintBaseFee, uint256 creatorSignatureFee, uint256 maxMintsPerUserInCycle)&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;Description&lt;&#x2F;strong&gt;:&lt;br &#x2F;&gt;
Emitted when the contract terms related to minting are updated by the &lt;code&gt;ADMIN_ROLE&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;donationreceived-address-from-address-to-uint256-amount&quot;&gt;&lt;code&gt;DonationReceived(address from, address to, uint256 amount)&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;Description&lt;&#x2F;strong&gt;:&lt;br &#x2F;&gt;
Emitted when a user donates ETH to a creator. This event tracks the details of the donation, including the donor&#x27;s address, the recipient&#x27;s address, and the donation amount.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Parameters&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;from&lt;&#x2F;code&gt;: The address of the user making the donation.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;to&lt;&#x2F;code&gt;: The address of the creator receiving the donation.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;amount&lt;&#x2F;code&gt;: The amount of ETH donated.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;safemint-string-memory-uri&quot;&gt;&lt;code&gt;safeMint(string memory uri)&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;Description&lt;&#x2F;strong&gt;:&lt;br &#x2F;&gt;
Allows the caller to mint a new token to their address with a provided URI.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Requirements&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The caller &lt;strong&gt;MUST&lt;&#x2F;strong&gt; have the &lt;strong&gt;CREATOR_ROLE&lt;&#x2F;strong&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The user &lt;strong&gt;MUST&lt;&#x2F;strong&gt; pay the minting fee, which is dynamic based on their previous minting activity.&lt;&#x2F;li&gt;
&lt;li&gt;If the minting limit is exceeded, the user&#x27;s mint count &lt;strong&gt;SHALL&lt;&#x2F;strong&gt; be reset to zero.&lt;&#x2F;li&gt;
&lt;li&gt;Is &lt;strong&gt;RECOMMENDED&lt;&#x2F;strong&gt; to require that the contract is not paused before using this function.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;mintfee&quot;&gt;&lt;code&gt;mintFee()&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;Description&lt;&#x2F;strong&gt;:&lt;br &#x2F;&gt;
Calculates and returns the current minting fee that the caller &lt;strong&gt;MUST&lt;&#x2F;strong&gt; pay, based on the number of mints performed during his current discount per mint cycle. Is &lt;strong&gt;RECOMMENDED&lt;&#x2F;strong&gt; that the fee use a logarithmic reduction to adjust the fee smoothly.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Formula:&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;\text{mintFee} = &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;\begin{cases}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0, &amp;amp; \text{if msg.sender has the ADMIN\_ROLE} \\ &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;\frac{\text{mintBaseFee}}{\log_x(\text{userMints})}, &amp;amp; \text{if } \text{userMints} &amp;gt; 1 \\ &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;\frac{\text{mintBaseFee}}{1}, &amp;amp; \text{if } \text{userMints} &amp;lt;= 1 &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;\end{cases}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;blockquote&gt;
&lt;p&gt;Note: Please note that the returned logarithm is always rounded to integers due to the characteristics of Solidity with floating-point numbers.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Requirements&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The minting fee &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be paid by the caller.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;donate-address-creator&quot;&gt;&lt;code&gt;donate(address creator)&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;Description&lt;&#x2F;strong&gt;:&lt;br &#x2F;&gt;
Allows users to donate ETH to a creator, helping fund their activities. After making a donation, the donor &lt;strong&gt;SHALL&lt;&#x2F;strong&gt; receive the &lt;strong&gt;CONTRIBUTOR_ROLE&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Requirements&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The provided address &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be a valid creator (having the &lt;strong&gt;CREATOR_ROLE&lt;&#x2F;strong&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;msg.sender&lt;&#x2F;code&gt; &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; be the same as the &lt;code&gt;creator&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The donation amount &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be greater than zero.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;MUST&lt;&#x2F;strong&gt; emit a &lt;code&gt;DonationReceived&lt;&#x2F;code&gt; event after the donation is processed.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;getcreatorsignature&quot;&gt;&lt;code&gt;getCreatorSignature()&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;Description&lt;&#x2F;strong&gt;:&lt;br &#x2F;&gt;
Allows a user to acquire a creator&#x27;s signature by paying the required fee.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Requirements&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The caller &lt;strong&gt;MUST&lt;&#x2F;strong&gt; pay the creator signature fee.&lt;&#x2F;li&gt;
&lt;li&gt;After the payment, the caller &lt;strong&gt;SHALL&lt;&#x2F;strong&gt; be granted the &lt;strong&gt;CREATOR_ROLE&lt;&#x2F;strong&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Is &lt;strong&gt;RECOMMENDED&lt;&#x2F;strong&gt; to require that the contract is not paused before using this function.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;updateterms-uint256-mintbasefee-uint256-creatorsignaturefee-uint256-maxmintsperuserincycle&quot;&gt;&lt;code&gt;updateTerms(uint256 mintBaseFee, uint256 creatorSignatureFee, uint256 maxMintsPerUserInCycle)&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;Description&lt;&#x2F;strong&gt;:&lt;br &#x2F;&gt;
Allows the admin to update the minting fee, creator signature fee, and the maximum mints per user in a cycle of progressive discounts.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Requirements&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Only the &lt;code&gt;ADMIN_ROLE&lt;&#x2F;code&gt; &lt;strong&gt;MUST&lt;&#x2F;strong&gt; call this function.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;MUST&lt;&#x2F;strong&gt; be called in the contract constructor as the first update of the contract terms.&lt;&#x2F;li&gt;
&lt;li&gt;The update interval period &lt;strong&gt;SHALL&lt;&#x2F;strong&gt; be respected before another update can occur.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;MUST&lt;&#x2F;strong&gt; emit a &lt;code&gt;CreatorTermsUpdated&lt;&#x2F;code&gt; event after the contract terms are updated.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;withdraw-uint256-amount&quot;&gt;&lt;code&gt;withdraw(uint256 amount)&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;Description&lt;&#x2F;strong&gt;:&lt;br &#x2F;&gt;
Allows the &lt;code&gt;ADMIN_ROLE&lt;&#x2F;code&gt; to withdraw ETH from the contract.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Requirements&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Only the &lt;code&gt;ADMIN_ROLE&lt;&#x2F;code&gt; &lt;strong&gt;MUST&lt;&#x2F;strong&gt; call this function.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;burn-uint256-tokenid&quot;&gt;&lt;code&gt;burn(uint256 tokenId)&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;Description&lt;&#x2F;strong&gt;:&lt;br &#x2F;&gt;
Allows the owner of a token to burn (destroy) the token specified by &lt;code&gt;tokenId&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Requirements&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The caller &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be the owner of the token.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;pause&quot;&gt;&lt;code&gt;pause()&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;Description&lt;&#x2F;strong&gt;:&lt;br &#x2F;&gt;
Allows the &lt;code&gt;ADMIN_ROLE&lt;&#x2F;code&gt; to pause the contract, disabling certain functions.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Requirements&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Only the &lt;code&gt;ADMIN_ROLE&lt;&#x2F;code&gt; &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; call this function to pause the contract.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;unpause&quot;&gt;&lt;code&gt;unpause()&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;Description&lt;&#x2F;strong&gt;:&lt;br &#x2F;&gt;
Allows the &lt;code&gt;ADMIN_ROLE&lt;&#x2F;code&gt; to unpause the contract, re-enabling functionality.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Requirements&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Only the &lt;code&gt;ADMIN_ROLE&lt;&#x2F;code&gt; &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; call this function to unpause the contract.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Below are the key considerations and justifications for the design choices:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Access Control&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Problem&lt;&#x2F;strong&gt;: In collaborative NFT systems, it is essential to ensure that critical contract functions are executed only by authorized users to prevent misuse or manipulation. Without proper access control, there is a risk that anyone could modify key parameters, such as minting fees, terms, or contract pauses, which could lead to instability or unfair advantages for certain users.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Solution&lt;&#x2F;strong&gt;: By introducing role-based access control, this standard ensures that only trusted actors can perform sensitive actions. Admins are responsible for updating contract terms, pausing or unpausing the contract, and withdrawing funds, while creators can manage their own collections and get donations. This prevents arbitrary changes that might harm market stability or erode community trust.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Dynamic Minting Fees&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Problem&lt;&#x2F;strong&gt;: Fixed minting fees often lead to hoarding and disproportionate ownership, limiting equitable access to NFTs.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Solution&lt;&#x2F;strong&gt;: By dynamically adjusting minting fees based on user activity within defined &lt;u&gt;minting cycles&lt;&#x2F;u&gt;, we ensure that users are incentivized to engage with the platform by receiving &lt;u&gt;gradual discounts as they mint&lt;&#x2F;u&gt;. Using a logarithmic reduction in minting fees ensures that the process is gradual, preventing market manipulation and maintaining scarcity over time.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Donation-Based Engagement&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Problem&lt;&#x2F;strong&gt;: Creators often lack sustainable models for fostering community engagement and receiving contributions.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Solution&lt;&#x2F;strong&gt;: The donation system provides a transparent way for contributors to support their favorite creators directly. This can be used to attribute benefits in future trades, for example. This encourages deeper engagement and strengthens the relationship between creators and their communities.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP is fully compatible with ERC-721. Extensions like dynamic minting fees, donation systems are modular and do not impact existing NFT token functionalities.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;mintfee-1&quot;&gt;&lt;code&gt;mintFee()&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mintFee&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;hasRole&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ADMIN_ROLE&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; userMints &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mintsPerUserInCycle&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; divisor &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; userMints &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ?&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; :&lt;&#x2F;span&gt;&lt;span&gt; Math&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;log2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;userMints&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; mintBaseFee &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; divisor&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;safemint-string-memory-uri-1&quot;&gt;&lt;code&gt;safeMint(string memory uri)&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeMint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uri&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;public&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;payable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;override&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;onlyIfNotPaused&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;nonReentrant&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;onlyRole&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;CREATOR_ROLE&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bool&lt;&#x2F;span&gt;&lt;span&gt; userMintsExceeded &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mintsPerUserInCycle&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; maxMintsPerUserInCycle&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;value &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mintFee&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Not enough ETH!&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; tokenId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; currentTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    _safeMint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    _setTokenURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; uri&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;userMintsExceeded&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        mintsPerUserInCycle&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    mintsPerUserInCycle&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Reentrancy Protection:&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
Is &lt;strong&gt;RECOMMENDED&lt;&#x2F;strong&gt; to make sure the functions &lt;code&gt;safeMint&lt;&#x2F;code&gt;, &lt;code&gt;withdraw&lt;&#x2F;code&gt; and &lt;code&gt;donate&lt;&#x2F;code&gt; are protected against reentrancy attacks.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Paused State:&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
The Administrators &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be able to pause the contract during emergencies to prevent unwanted operations and mitigate risks during uncertain times.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Burning Security:&lt;&#x2F;strong&gt;
Ensure that only the owner of a token can burn it, reducing the risk of malicious contracts or unauthorized users destroying tokens belonging to others. The burn behavior is restricted to the ownership function, enhancing security by preventing accidental or abusive token destruction.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Data Asset NFT</title>
        <published>2024-11-29T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Allen Dong</name><uri>https://github.com/Allen2730</uri>
	</author>
	
	<author>
		<name>Lonika Zhang</name><email>lonika@memolabs.net</email>
	</author>
	
	<author>
		<name>Steven He</name><email>steven@memolabs.net</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7829/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7829-data-asset-nft/21881" />
        

        <id>https://wg-eips.ritovision.com/7829/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:7829"
            label="ERC-7829" />
        

        
        

        
        <summary type="html">Bring Data Assets—online digital products—to NFTs and ensure their integrity through a storage proof.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7829/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal extends the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; standard to support Data Assets which refers to digital products created by creators.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal introduces a modular Data Availability (DA) layer that safeguards on-chain data integrity, preventing value discrepancies caused by off-chain data loss, tampering, or expiration. Furthermore, this proposal introduces a new role, Reader, where a single token can have multiple Readers. This solution reflects the inherent replicability of Data Assets, namely that each piece of data can be replicated multiple times and accessed by multiple users, thus amplifying the value of the Data Assets.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;ERC-721 proposed NFTs to represent the ownership of digital or physical assets. Currently, the NFT metadata is considered the NFT content, and its scarcity determines the value of the NFT. NFT owners can convert the content value of NFTs into revenue by transferring the ownership of NFTs. However, due to the high transaction fees, storage costs, and other expenses, NFTs are currently only able to represent the ownership of high-value assets, which limits the range of assets that NFTs can represent. This is especially true for Data Assets, which refers to digital products created by creators, such as online blogs, videos, small games or music. Therefore, the value of Data Assets depends on their quality, whether the creator is famous, whether it is hyped and so on.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore, to reduce storage costs, the NFT content is generally stored off-chain or using cross-chain storage, and the link of NFT content is saved on-chain. Off-chain users can access the NFT content by visiting the link. However, on-chain contracts can not access the link to determine the status of the data, such as data loss, data tampering, or data expiration. These situations can lead to the data deviating from its actual value, but the NFT still exists on the chain, and the underlying copyright is still being sold in the market.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal introduces Data Asset NFTs, which solve the dilemma of on-chain Data Assets by combining a modular data layer--Data Availability (DA).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;related-work&quot;&gt;Related Work&lt;&#x2F;h3&gt;
&lt;p&gt;There are Existing proposals to NFT integrity, but each proposal contains at least one of these limitations:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Storing NFT content on-chain, which requires the underlying data asset to possess inherent speculative value to justify prohibitive storage costs.&lt;&#x2F;li&gt;
&lt;li&gt;Requiring attestations from a trusted third party, while introduces centralized trust issue.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;terms&quot;&gt;Terms&lt;&#x2F;h3&gt;
&lt;p&gt;In this proposal, we divide data assets into three parts:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Storage Metadata: Includes commitment, size, expire, and uploader&#x27;s address. Stored and maintained by storage contracts on the blockchain.&lt;&#x2F;li&gt;
&lt;li&gt;Permission Metadata: Includes information on ownership and reading rights, as well as which addresses can modify this information. Stored and maintained by permission contracts on the blockchain.&lt;&#x2F;li&gt;
&lt;li&gt;Data Content: Data uploaded by users to the storage system. Data content is stored in off-chain storage nodes.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Every compliant data permission contract must implement the Interface&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;p&gt;The data permission contract is an extension of ERC-721, adding the reader role, where a single data asset can correspond to multiple readers.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7829&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC721&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UpdateReader&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; reader&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; valid&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setReader&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; reader&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; valid&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isReader&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; reader&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; commitByTokenId&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; sizeByTokenId&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; expireByTokenId&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The metadata JSON schema for Data Asset NFTs is as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Data Asset Metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Identifies the asset to which this NFT represents&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Describes the asset to which this NFT represents&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;commit&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A commit pointing to the data resource&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;size&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;integer&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The size of the data resource&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;expire&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;integer&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The expire time of the data resource&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The Reader role should not involve changes in permissions, meaning that Readers cannot call functions such as &lt;code&gt;transfer&lt;&#x2F;code&gt;, &lt;code&gt;approve&lt;&#x2F;code&gt;, &lt;code&gt;setApprovalForAll&lt;&#x2F;code&gt;, and &lt;code&gt;setReader&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;When Alice calls the &lt;code&gt;transfer&lt;&#x2F;code&gt; function to transfer one of Alice&#x27;s Data Asset NFTs to Bob:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The owner address is set to Bob&#x27;s address;&lt;&#x2F;li&gt;
&lt;li&gt;The approved address is set to 0.&lt;&#x2F;li&gt;
&lt;li&gt;However, all readers are retained.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;extension-storage-contract&quot;&gt;Extension: Storage Contract&lt;&#x2F;h3&gt;
&lt;p&gt;This proposal extends the metadata information of NFTs. Metadata information is uploaded by users and requires relevant certificates, which can be the storage node&#x27;s signature on the NFT&#x27;s metadata information. This proposal specify that the NFT metadata should at least include commitment, size, expire, and uploader&#x27;s address.&lt;&#x2F;p&gt;
&lt;p&gt;The implementer of this proposal selects a trusted storage system and a trusted modular data layer DA, or deploys the modular storage layer DA themselves.&lt;&#x2F;p&gt;
&lt;p&gt;When the Owner or Approved Operator calls the &lt;code&gt;transfer&lt;&#x2F;code&gt;, &lt;code&gt;approve&lt;&#x2F;code&gt;, or &lt;code&gt;setReader&lt;&#x2F;code&gt; functions, they must additionally check whether the current time &lt;code&gt;block.timestamp&lt;&#x2F;code&gt; is greater than the expiration time &lt;code&gt;expire&lt;&#x2F;code&gt; before making the call. If the current time &lt;code&gt;block.timestamp&lt;&#x2F;code&gt; is less than the expiration time &lt;code&gt;expire&lt;&#x2F;code&gt;, then proceed with subsequent operations; if the current time &lt;code&gt;block.timestamp&lt;&#x2F;code&gt; is greater than the expiration time &lt;code&gt;expire&lt;&#x2F;code&gt;, then interrupt subsequent operations and return an exception message.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;extension-storage-proof&quot;&gt;Extension: Storage Proof&lt;&#x2F;h3&gt;
&lt;p&gt;This proposal uses storage proof to prove the availability of data content, thereby proving the correctness of NFT metadata, especially the &lt;code&gt;expire&lt;&#x2F;code&gt; of the NFT.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal does not limit the proof scheme used, but recommends the use of KZG polynomial commitment technology. KZG polynomial commitment technology can generate two generator elements $g_1$ and $g_2$ during initialization. It also generates a corresponding commitment C based on the data content and uploads it as the unique identifier of the data when uploading metadata. When generating proof, the verifier generates a random number $z$, and the prover generates proof $P=(y, π)$ based on the data content and random number $z$, verifying $e(π, yg_1-zg_2) = e(C - y*g_1, g_2)$.&lt;&#x2F;p&gt;
&lt;p&gt;In addition, KZG polynomial commitment technology can aggregate multiple proofs into a single proof, and two-step verification can verify the correctness of all proofs, including summing all commitments to get the aggregated commitment $C_n$, and verifying the aggregated proof $P_n=(y_n, π_n)$ by verifying $e(π_n, y_ng_1-zg_2) = e(C_n - y_n*g_1, g_2)$.&lt;&#x2F;p&gt;
&lt;p&gt;To avoid long proof generation times, random sampling can be used to randomly select data to be challenged. Therefore, the contract needs to provide a secure pseudo-random number generation function for randomly selecting challenged data, which can also be used as the random number $z$ for KZG.&lt;&#x2F;p&gt;
&lt;p&gt;During the verification process, summing all commitments to get the aggregated commitment requires a large amount of gas fees. This proposal recommends using optimistic proof, which assumes that the aggregated commitment is correct and only verifies $e(π_n, y_ng_1-zg_2) = e(C_n - y_n*g_1, g_2)$ during verification. After verifying the aggregated proof, the availability of the data cannot be proven, so a certain period of challenging is required. During the challenging period, anyone can challenge the commitment proof $C_n$. If the challenge is successful, the challenger gets a reward and the prover is punished; if the challenge fails, the challenger is punished and the prover gets additional benefits.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7829&#x2F;.&#x2F;assets&#x2F;architect.svg&quot; alt=&quot;arc&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;data-asset-nft-integrity&quot;&gt;Data Asset NFT Integrity&lt;&#x2F;h3&gt;
&lt;p&gt;The DA Layer is responsible for off-chain storage of Data Content and on-chain storage of Storage Metadata, and ensures the integrity of Data Assets through periodically submiting and verifing &lt;strong&gt;storage proofs&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;To optimize gas costs, we adopt an &lt;strong&gt;optimistic proof approach&lt;&#x2F;strong&gt;, significantly reducing verification expenses.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Proof Cycle Workflow&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Proof Generation &amp;amp; Aggregation&lt;&#x2F;strong&gt;:
&lt;ul&gt;
&lt;li&gt;The &lt;strong&gt;DA Provider&lt;&#x2F;strong&gt; generates storage proofs for sampled data content, aggregates them into a single &lt;strong&gt;aggregated proof&lt;&#x2F;strong&gt;, and submits it to the &lt;strong&gt;DA Contract&lt;&#x2F;strong&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;strong&gt;DA Contract&lt;&#x2F;strong&gt; verifies the correctness of the aggregated proof.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Fraud Proof Mechanism&lt;&#x2F;strong&gt;:
&lt;ul&gt;
&lt;li&gt;The &lt;strong&gt;DA Verifier&lt;&#x2F;strong&gt; performs off-chain validation to confirm whether the aggregated proof was correctly derived from the selected data.&lt;&#x2F;li&gt;
&lt;li&gt;If the proof is invalid, the verifier &lt;strong&gt;challenges&lt;&#x2F;strong&gt; it by submitting a fraud proof to the DA Contract.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;reader&quot;&gt;Reader&lt;&#x2F;h3&gt;
&lt;p&gt;This proposal enables a &lt;strong&gt;single data asset NFT&lt;&#x2F;strong&gt; to have &lt;strong&gt;multiple Readers&lt;&#x2F;strong&gt;, each granted access to the off-chain data content. This design aligns with the inherent properties of data assets:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Replicability&lt;&#x2F;strong&gt;: Data can be copied and distributed without degradation.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Value Amplification&lt;&#x2F;strong&gt;: By allowing resale or multi-party access, the asset’s utility and market value increase.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal combines the existing ERC-721 extension and is backward compatible with the ERC-721 standard.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The security of Data Asset NFTs depends not only on the blockchain but also on the modular data layer DA. Therefore, the implementer of this proposal needs to carefully select the modular data layer DA.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Contract size limit increase for EOF</title>
        <published>2024-11-29T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	<author>
		<name>Danno Ferrin</name><uri>https://github.com/shemnon</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7830/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7830-contract-size-limit-increase-for-eof/21927" />
        

        <id>https://wg-eips.ritovision.com/7830/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7830"
            label="EIP-7830" />
        

        
        

        
        <summary type="html">Raise the limit for only EOF contracts to 64 KiB</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7830/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Revise the contract size limit for EOF contracts to be 64 KiB instead of the existing 24 KiB limit. Legacy contracts are unaffected.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The contract size limit was introduced as a measure against DoS attacks. &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt;-analysis is required for legacy contracts, and many of the algorithms performing it are not linear and&#x2F;or have unknown unknowns. This is one of the reasons for the hesitance of a limit increase.&lt;&#x2F;p&gt;
&lt;p&gt;For contract developers the limit poses annoying problems, given modern contracts with good error reporting would consume more space. They are forced to work with workarounds, like &quot;libraries&quot; (using &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;), splitting an application across regular contracts (and &lt;code&gt;CALL&lt;&#x2F;code&gt;-ing across), or working with proxies (e.g. the &quot;diamond pattern&quot;). All these solutions have resulted in suboptimal patterns, bugs in deployed contracts, and loss of funds.&lt;&#x2F;p&gt;
&lt;p&gt;With EOF the &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt;-analysis is removed from runtime and a validation process is performed once during deployment. The initcode cost &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3860&#x2F;&quot;&gt;EIP-3860&lt;&#x2F;a&gt; introduced accounts for this validation too. Therefore, with EOF there are no known problems for increasing the limit, because the overheads are already accounted for.&lt;&#x2F;p&gt;
&lt;p&gt;Storage cost is already paid per contract byte.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;170&#x2F;&quot;&gt;EIP-170&lt;&#x2F;a&gt; specifies &lt;code&gt;MAX_CODE_SIZE&lt;&#x2F;code&gt; as 24576 bytes, and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3860&#x2F;&quot;&gt;EIP-3860&lt;&#x2F;a&gt; specifies &lt;code&gt;MAX_INITCODE_SIZE&lt;&#x2F;code&gt; as &lt;code&gt;2 * MAX_CODE_SIZE&lt;&#x2F;code&gt; (49152 bytes).&lt;&#x2F;p&gt;
&lt;p&gt;Starting &lt;code&gt;FORK_BLOCK&lt;&#x2F;code&gt;, for EOF initcode&#x2F;code (code starting with the &lt;code&gt;0xEF 0x00&lt;&#x2F;code&gt; bytes) the limit is changed:&lt;code&gt;MAX_CODE_SIZE&lt;&#x2F;code&gt; is set to 65536 bytes (64 KiB). This means &lt;code&gt;MAX_INITCODE_SIZE&lt;&#x2F;code&gt; becomes 131072 bytes (128 KiB).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The 64 KiB limit is over 2x of existing limit, while it is not a significant increase, it is the realistic increase given the limitations of initcode. In EOF deployment the to-be-deployed code is stored as a section (&quot;subcontainer&quot;), which has a size limit of 64 KiB, therefore it is not possible to deploy larger contracts without introducing a large or variable-length-encoded size field.&lt;&#x2F;p&gt;
&lt;p&gt;A further increase can be proposed with applying these changes to EOF.&lt;&#x2F;p&gt;
&lt;p&gt;This increase still fits within the gas schedule, limiting the size to less than what gas limits allow.  In &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;170&#x2F;&quot;&gt;EIP-170&lt;&#x2F;a&gt; the gas limit was first set &quot;by setting the cap at a value slightly higher than what is feasible with current gas limits.&quot; At that time the gas limit had not exceeded 5M gas.&lt;&#x2F;p&gt;
&lt;p&gt;A simple analysis shows contract deployments for 64 KiB contracts to be between 14M and 16M gas, roughly close to the current 15M target.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Cancun&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;This EIP&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;36M Gas&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Max Initcode&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Initcode bytes&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;200&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;200&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;200&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;65,536&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Deployed Bytes&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;24,576&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;65,536&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;165,331&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;65,536&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Zero byte ratio&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;10%&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;10%&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;10%&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;10%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Initcode Cost&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;4&#x2F;16&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;4&#x2F;16&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;4&#x2F;16&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;4&#x2F;16&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Intrinsic Gas&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;53,000&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;53,000&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;53,000&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;53,000&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Calldata Gas&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;366,685&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;972,893&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;2,449,859&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;1,939,866&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;EIP-3860 Gas&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;49,552&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;131,472&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;331,062&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;262,144&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;EVM Execution&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;100,000&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;100,000&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;100,000&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;100,000&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Code Deposit&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;4,915,200&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;13,107,200&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;33,066,200&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;13,107,200&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Total Cost&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;5,484,437&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;14,364,565&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;36,000,121&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;15,462,210&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Note that the Max 30M gas contract size of 135 KiB is outside the limits of what is proposed in this EIP and is included to show what it would take to exceed current gas limits.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This is a backwards compatible change. Existing contracts are unaffected, and only new deployments see the effect.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Given the analysis cost is paid as part of deployment, the size of contract should have no effect on the runtime.&lt;&#x2F;p&gt;
&lt;p&gt;A more thorough analysis may be needed to determine whether the proposed limit poses any risk because of client storage architectures.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Interoperable Names</title>
        <published>2024-11-27T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Sam Kaufman</name><uri>https://github.com/SampkaML</uri>
	</author>
	
	<author>
		<name>Marco Stronati</name><uri>https://github.com/paracetamolo</uri>
	</author>
	
	<author>
		<name>Yuliya Alexiev</name><uri>https://github.com/yuliyaalexiev</uri>
	</author>
	
	<author>
		<name>Jeff Lau</name><uri>https://github.com/jefflau</uri>
	</author>
	
	<author>
		<name>Sam Wilson</name><uri>https://github.com/samwilsn</uri>
	</author>
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	<author>
		<name>Teddy</name><uri>https://github.com/0xteddybear</uri>
	</author>
	
	<author>
		<name>Joxes</name><uri>https://github.com/Joxess</uri>
	</author>
	
	<author>
		<name>Racu</name><uri>https://github.com/0xRacoon</uri>
	</author>
	
	<author>
		<name>Skeletor Spaceman</name><uri>https://github.com/0xskeletor-spaceman</uri>
	</author>
	
	<author>
		<name>TiTi</name><uri>https://github.com/0xtiti</uri>
	</author>
	
	<author>
		<name>Gori</name><uri>https://github.com/0xGorilla</uri>
	</author>
	
	<author>
		<name>Ardy</name><uri>https://github.com/0xArdy</uri>
	</author>
	
	<author>
		<name>Onizuka</name><uri>https://github.com/onizuka-wl</uri>
	</author>
	
	<author>
		<name>Lumi</name><uri>https://github.com/oxlumi</uri>
	</author>
	
	<author>
		<name>Moebius</name><uri>https://github.com/0xmoebius</uri>
	</author>
	
	<author>
		<name>Thomas Clowes</name><uri>https://github.com/clowestab</uri>
	</author>
	
	<author>
		<name>Prem Makeig</name><uri>https://github.com/nxt3d</uri>
	</author>
	
	<author>
		<name>Mono</name><uri>https://github.com/0xMonoAx</uri>
	</author>
	
	<author>
		<name>Orca</name><uri>https://github.com/0xrcinus</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7828/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7828-chain-specific-addresses-using-ens/21930" />
        

        <id>https://wg-eips.ritovision.com/7828/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:7828"
            label="ERC-7828" />
        

        
        

        
        <summary type="html">Defines a human readable chain-specific address format that allows for chain discovery using ENS.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7828/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal defines an Interoperable Name, a chain-specific address format with the structure &lt;code&gt;&amp;lt;address&amp;gt;@&amp;lt;chain&amp;gt;#&amp;lt;checksum&amp;gt;&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;&amp;lt;address&amp;gt;&lt;&#x2F;code&gt; can be an address, or an ENS name.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;&amp;lt;chain&amp;gt;&lt;&#x2F;code&gt; can be a &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ChainAgnostic&#x2F;CAIPs&#x2F;blob&#x2F;29762ef99a6ffea1e07e3f796c0d1a5a95e89b88&#x2F;CAIPs&#x2F;caip-350.md&quot;&gt;CAIP-350&lt;&#x2F;a&gt; chain identifier, or it can be a human-readable label. This specification defines how such labels can be resolved to chain-specific metadata, via the Ethereum Name Service (ENS).&lt;&#x2F;p&gt;
&lt;p&gt;The optional &lt;code&gt;&amp;lt;checksum&amp;gt;&lt;&#x2F;code&gt; allows clients to verify the integrity of the Interoperable Name.&lt;&#x2F;p&gt;
&lt;p&gt;The result is chain-specific addresses such as:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7@eip155:1#80B12379&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;alice.eth@eip155:1&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;alice.eth@ethereum&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The current Ethereum address landscape is evolving toward an ecosystem with hundreds, and eventually thousands, of L2s that share the same address format as Ethereum mainnet. This means an address by itself is insufficient to determine which chain it is associated with. This ambiguity can result in funds being sent to an unreachable address on the wrong chain.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7930&#x2F;&quot;&gt;ERC-7930&lt;&#x2F;a&gt; introduced a binary format for representing a &lt;em&gt;target address&lt;&#x2F;em&gt; on a specific blockchain. While this binary data is well suited for low-level usage (e.g. in smart contracts), its meaning is semantically opaque to human users.&lt;&#x2F;p&gt;
&lt;p&gt;The core motivation for introducing the &lt;em&gt;Interoperable Name&lt;&#x2F;em&gt; standard is to provide maximally readable, &lt;em&gt;chain-specific addresses&lt;&#x2F;em&gt; for user-facing interactions.&lt;&#x2F;p&gt;
&lt;p&gt;A foundational text representation (e.g. &lt;code&gt;0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7@eip155:1&lt;&#x2F;code&gt;) enables a significantly more readable &lt;em&gt;chain-specific address&lt;&#x2F;em&gt; format. An expanded form that leverages the name resolution capabilities of the Ethereum Name Service (ENS) further improves readability, allowing addresses to be expressed in a maximally human-friendly form (e.g. &lt;code&gt;wallet.ensdao.eth@ethereum&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;An on-chain registry provides a canonical source of truth for mapping human-readable chain labels to the metadata associated with each chain. Today, chains are identified using a variety of specifications (e.g. &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ChainAgnostic&#x2F;CAIPs&#x2F;blob&#x2F;36ef9ee906da090366cb679634a0850e91785db6&#x2F;CAIPs&#x2F;caip-2.md&quot;&gt;CAIP-2&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt; for EVM-compatible networks), whose formats are not necessarily semantically clear to human users. By introducing an on-chain registry, applications can refer to a chain using a readable identifier such as &lt;code&gt;base&lt;&#x2F;code&gt;, rather than an opaque identifier like &lt;code&gt;eip155:8453&lt;&#x2F;code&gt; or &lt;code&gt;8453&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Historically, the mapping from chain names to identifiers has, since &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt;, been maintained off-chain using a centralized list.&lt;&#x2F;p&gt;
&lt;p&gt;This approach has several shortcomings:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;It does not scale with the growing number of blockchains&lt;&#x2F;li&gt;
&lt;li&gt;It relies on a trusted centralized maintainer&lt;&#x2F;li&gt;
&lt;li&gt;It does not support non-EVM chains&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This specification defines an architecture that enables chain operators to take ownership of their chain-specific data, thereby reducing reliance on a single centralized entity and ensuring data integrity.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;terminology&quot;&gt;Terminology&lt;&#x2F;h3&gt;
&lt;p&gt;This section builds upon the Terminology defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7930&#x2F;&quot;&gt;ERC-7930&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Interoperable Name&lt;&#x2F;strong&gt;
: A human-readable &lt;em&gt;chain-specific address&lt;&#x2F;em&gt; format meant to be used by humans for user-facing interactions. e.g. &lt;code&gt;0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045@eip155:1#4CA88C9C&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;interoperable-name-definition&quot;&gt;Interoperable Name Definition&lt;&#x2F;h3&gt;
&lt;p&gt;The format of an &lt;em&gt;Interoperable Name&lt;&#x2F;em&gt; is &lt;code&gt;&amp;lt;address&amp;gt;@&amp;lt;chain&amp;gt;#&amp;lt;checksum&amp;gt;&lt;&#x2F;code&gt; where the components match the following regular expressions:&lt;&#x2F;p&gt;
&lt;h4 id=&quot;syntax&quot;&gt;Syntax&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;ABNF&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;interoperable-name&amp;gt;  ::=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;chain&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;checksum&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;address&amp;gt;             ::=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;%&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a-zA-Z0-9&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;*&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;chain&amp;gt;               ::=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a-zA-Z0-9&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;*&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;checksum&amp;gt;            ::=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt;9&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;A-F&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;These components have the following meanings:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;&amp;lt;address&amp;gt;&lt;&#x2F;code&gt; can either be:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A &lt;em&gt;target address&lt;&#x2F;em&gt; as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7930&#x2F;&quot;&gt;ERC-7930&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;An Ethereum Name Service (ENS) name. e.g, &lt;code&gt;wallet.ensdao.eth&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;&amp;lt;chain&amp;gt;&lt;&#x2F;code&gt; can either be:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The string representation of a specific blockchain as defined in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ChainAgnostic&#x2F;CAIPs&#x2F;blob&#x2F;29762ef99a6ffea1e07e3f796c0d1a5a95e89b88&#x2F;CAIPs&#x2F;caip-350.md&quot;&gt;CAIP-350&lt;&#x2F;a&gt;. For example &lt;code&gt;eip155:1&lt;&#x2F;code&gt; for Ethereum Mainnet, or &lt;code&gt;solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d&lt;&#x2F;code&gt; for Solana Mainnet.&lt;&#x2F;li&gt;
&lt;li&gt;A human-readable label identifier for a specific chain, defined and registered as a subdomain of the &lt;code&gt;on.eth&lt;&#x2F;code&gt; ENS name. An on-chain resolver contract maps these labels to their corresponding canonical &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7930&#x2F;&quot;&gt;ERC-7930&lt;&#x2F;a&gt; chain identifiers, and exposes additional chain metadata.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;&amp;lt;checksum&amp;gt;&lt;&#x2F;code&gt; is defined as the first 4 bytes (8 characters) of the Keccak-256 hash, represented as a hexadecimal string (Base16, as specified in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc4648&quot;&gt;RFC 4648&lt;&#x2F;a&gt;). The hash is computed over the concatenation of the following binary fields from the canonical &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7930&#x2F;&quot;&gt;ERC-7930&lt;&#x2F;a&gt; Interoperable Address:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ChainType&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ChainReferenceLength&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ChainReference&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;AddressLength&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Address&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;&#x2F;strong&gt; The Version field MUST NOT be included in the hashed data.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;checksums&quot;&gt;Checksums&lt;&#x2F;h4&gt;
&lt;p&gt;The checksum provides an optional integrity verification mechanism for Interoperable Names that include a raw target address.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The checksum is OPTIONAL but RECOMMENDED when the &lt;address&gt; component represents a target address, as it helps mitigate homoglyph and spoofing attacks for chain-specific addresses.&lt;&#x2F;li&gt;
&lt;li&gt;A checksum SHOULD NOT be included when the &lt;address&gt; component is an ENS name&lt;&#x2F;li&gt;
&lt;li&gt;Clients MAY include or omit the checksum when displaying or sharing an &lt;em&gt;Interoperable Name&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Clients MAY accept &lt;em&gt;Interoperable Name&lt;&#x2F;em&gt; inputs with or without a checksum.&lt;&#x2F;li&gt;
&lt;li&gt;When a checksum is provided for a target address, clients MAY validate it by deriving the underlying &lt;em&gt;Interoperable Address&lt;&#x2F;em&gt; and recalculating the checksum.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;UI&#x2F;UX developers are encouraged to determine the most appropriate way to warn users when a checksum does not match, when resolution fails, or any other scenario they deem necessary to ensure user safety and clarity.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;versioning&quot;&gt;Versioning&lt;&#x2F;h4&gt;
&lt;p&gt;This specification does not define its own versioning mechanism.&lt;&#x2F;p&gt;
&lt;p&gt;Implementers SHOULD ensure they are up to date with the version of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7930&#x2F;&quot;&gt;ERC-7930&lt;&#x2F;a&gt; they are using. Refer to the versioning section of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7930&#x2F;&quot;&gt;ERC-7930&lt;&#x2F;a&gt; for detailed rules.&lt;&#x2F;p&gt;
&lt;p&gt;Implementations MUST maintain convertibility between &lt;em&gt;Interoperable Names&lt;&#x2F;em&gt; and the corresponding &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7930&#x2F;&quot;&gt;ERC-7930&lt;&#x2F;a&gt; &lt;em&gt;Interoperable Address&lt;&#x2F;em&gt; binary format.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;target-address-examples&quot;&gt;&lt;em&gt;Target Address&lt;&#x2F;em&gt; Examples&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;ethereum-mainnet&quot;&gt;Ethereum Mainnet&lt;&#x2F;h4&gt;
&lt;p&gt;The address &lt;code&gt;0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7&lt;&#x2F;code&gt; on Ethereum Mainnet could be represented as either of the following:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7@eip155:1#80B12379&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7@ethereum#80B12379&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;&#x2F;strong&gt; In the second example &lt;code&gt;ethereum&lt;&#x2F;code&gt; is the chain label for Ethereum mainnet in the on-chain ENS resolver set for the &lt;code&gt;on.eth&lt;&#x2F;code&gt; namespace (see below).&lt;&#x2F;p&gt;
&lt;h4 id=&quot;non-evm-chains&quot;&gt;Non-EVM chains&lt;&#x2F;h4&gt;
&lt;p&gt;The address &lt;code&gt;bc1qwz2lhc40s8ty3l5jg3plpve3y3l82x9l42q7fk&lt;&#x2F;code&gt; on Bitcoin Mainnet could be represented as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;bc1qwz2lhc40s8ty3l5jg3plpve3y3l82x9l42q7fk@bip122:000000000019d6689c085ae165831e93#597D21A1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;bc1qwz2lhc40s8ty3l5jg3plpve3y3l82x9l42q7fk@bitcoin#597D21A1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;&#x2F;strong&gt; In the second example &lt;code&gt;bitcoin&lt;&#x2F;code&gt; is the chain label for Bitcoin mainnet in the on-chain ENS resolver set for the &lt;code&gt;on.eth&lt;&#x2F;code&gt; namespace (see below).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;ens-address-examples&quot;&gt;ENS &lt;code&gt;&amp;lt;address&amp;gt;&lt;&#x2F;code&gt; Examples&lt;&#x2F;h3&gt;
&lt;p&gt;ENS resolves addresses on a chain-specific basis, as outlined in ENSIP-9 and ENSIP-11.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;ethereum-mainnet-1&quot;&gt;Ethereum Mainnet&lt;&#x2F;h4&gt;
&lt;p&gt;Assuming that &lt;code&gt;wallet.ensdao.eth&lt;&#x2F;code&gt; resolves to &lt;code&gt;0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7&lt;&#x2F;code&gt; &lt;strong&gt;for Ethereum mainnet&lt;&#x2F;strong&gt; either of the following could be used to represent the same &lt;em&gt;target address&lt;&#x2F;em&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;wallet.ensdao.eth@eip155:1#80B12379&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;wallet.ensdao.eth@ethereum#80B12379&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;non-evm-chains-1&quot;&gt;Non-EVM chains&lt;&#x2F;h4&gt;
&lt;p&gt;Assuming that &lt;code&gt;wallet.ensdao.eth&lt;&#x2F;code&gt; resolves to &lt;code&gt;bc1qwz2lhc40s8ty3l5jg3plpve3y3l82x9l42q7fk&lt;&#x2F;code&gt; &lt;strong&gt;for Bitcoin mainnet&lt;&#x2F;strong&gt; either of the following could be used to represent the same &lt;em&gt;target address&lt;&#x2F;em&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;wallet.ensdao.eth@bip122:000000000019d6689c085ae165831e93#597D21A1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;wallet.ensdao.eth@bitcoin#597D21A1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;resolving-the-chain-component&quot;&gt;Resolving the &lt;code&gt;&amp;lt;chain&amp;gt;&lt;&#x2F;code&gt; component&lt;&#x2F;h3&gt;
&lt;p&gt;If the &lt;code&gt;&amp;lt;chain&amp;gt;&lt;&#x2F;code&gt; component of an &lt;em&gt;Interoperable Address&lt;&#x2F;em&gt; does not contain a colon (&lt;code&gt;:&lt;&#x2F;code&gt;) it is interpreted as being label under the &lt;code&gt;on.eth&lt;&#x2F;code&gt; ENS namespace.&lt;&#x2F;p&gt;
&lt;p&gt;The resolver for &lt;code&gt;on.eth&lt;&#x2F;code&gt; MUST implement ENSIP-24 - Arbitrary Data Resolution, and allow for the resolution of the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7930&#x2F;&quot;&gt;ERC-7930&lt;&#x2F;a&gt; &lt;em&gt;Interoperable Address&lt;&#x2F;em&gt; for the specified chain label using the key, &lt;code&gt;interoperable-address&lt;&#x2F;code&gt;. For example if you resolve the &lt;code&gt;interoperable-address&lt;&#x2F;code&gt; data record for &lt;code&gt;ethereum.on.eth&lt;&#x2F;code&gt; the &lt;em&gt;Interoperable Address&lt;&#x2F;em&gt; &lt;code&gt;0x00010000010100&lt;&#x2F;code&gt; SHOULD be returned.&lt;&#x2F;p&gt;
&lt;p&gt;The on-chain resolver for &lt;code&gt;on.eth&lt;&#x2F;code&gt; MAY implement aliasing so that multiple chain labels, such as &lt;code&gt;op.on.eth&lt;&#x2F;code&gt; and &lt;code&gt;optimism.on.eth&lt;&#x2F;code&gt;, resolve to the same underlying data. To ensure consistency and integrity, there must be a single canonical representation of this data.&lt;&#x2F;p&gt;
&lt;p&gt;A pseudocode implementation of this resolution is as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * Pseudocode to resolve the Interoperable Address associated with &amp;#39;ethereum.on.eth&amp;#39; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * Using ENSIP-24 and the data key &amp;#39;interoperable-address&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 1. Inputs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; domain&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ethereum.on.eth&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;interoperable-address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 2. Derive the Node (Namehash)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; node&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; namehash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;domain&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 3. Locate the Resolver for the node&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; registry&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;ENS_REGISTRY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; resolverAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; registry&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;resolver&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;node&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 4. Instantiate the Resolver&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; resolver&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;resolverAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 5. Resolve the Interoperable Address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ENSIP-24 Interface: data(bytes32 node, string key) -&amp;gt; bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; rawData&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; resolver&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The resolver for &lt;code&gt;on.eth&lt;&#x2F;code&gt; MUST implement ENSIP-5 - Text Records, and allow for the resolution of text records for the &lt;code&gt;reverse.on.eth&lt;&#x2F;code&gt; namespace of the form &lt;code&gt;chain-label:&lt;&#x2F;code&gt; followed by the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7930&#x2F;&quot;&gt;ERC-7930&lt;&#x2F;a&gt; &lt;em&gt;Interoperable Address&lt;&#x2F;em&gt; you are trying to discern the label for. For example, the &lt;em&gt;Interoperable Address&lt;&#x2F;em&gt; representing Ethereum Mainnet is &lt;code&gt;0x00010000010100&lt;&#x2F;code&gt;. Resolution of the text record &lt;code&gt;chain-label:0x00010000010100&lt;&#x2F;code&gt; for the &lt;code&gt;reverse.on.eth&lt;&#x2F;code&gt; namespace SHOULD return &lt;code&gt;ethereum&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;While multiple labels - such as &lt;code&gt;op.on.eth&lt;&#x2F;code&gt; and &lt;code&gt;optimism.on.eth&lt;&#x2F;code&gt; — may resolve to the &lt;em&gt;Interoperable Address&lt;&#x2F;em&gt; &lt;code&gt;0x00010000010a00&lt;&#x2F;code&gt;, the reverse resolution process will always return the canonical label: &lt;code&gt;optimism&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;A pseudocode implementation of this resolution is as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * Pseudocode to resolve a chain label from an ERC-7930 Interoperable Address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * Using ENSIP-5, the namespace reverse.on.eth, and the text record key chain-label:0x00010000010a00&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 1. Inputs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; interoperableAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x00010000010a00&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; namespace&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;reverse.on.eth&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 2. Construct the specific Text Record Key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Format: &amp;quot;chain-label:&amp;quot; + [ERC-7930 Address]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; textKey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;chain-label:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; interoperableAddress&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 3. Derive the Node (Namehash) for the reverse namespace&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; node&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; namehash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;namespace&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 4. Locate the Resolver for &amp;#39;reverse.on.eth&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; As the resolver will be set on the second level domain `on.eth` consideration should be given to ENSIP-10&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; registry&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;ENS_REGISTRY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; resolverAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; registry&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;resolver&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;node&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 5. Instantiate the Resolver&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; resolver&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;resolverAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 6. Query the Text Record (ENSIP-5)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Signature: text(bytes32 node, string key) -&amp;gt; string&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; chainLabel&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; resolver&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;text&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; textKey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Additional implementation details about the resolver contract implementation can be discerned by referencing the ENS documentation, and viewing the verified source code of the contract set as the resolver for &lt;code&gt;on.eth&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;resolving-the-address-component&quot;&gt;Resolving the &lt;code&gt;&amp;lt;address&amp;gt;&lt;&#x2F;code&gt; component&lt;&#x2F;h3&gt;
&lt;p&gt;If the &lt;code&gt;&amp;lt;address&amp;gt;&lt;&#x2F;code&gt; component contains a period (&lt;code&gt;.&lt;&#x2F;code&gt;), it is assumed to be an ENS name. Because ENS fully integrates with the Domain Name System (DNS), any traditional domain name can function as an ENS name, as can any name using the blockchain-native &lt;code&gt;.eth&lt;&#x2F;code&gt; extension.&lt;&#x2F;p&gt;
&lt;p&gt;If an ENS address is used within the &lt;code&gt;&amp;lt;address&amp;gt;&lt;&#x2F;code&gt; component, it MUST be resolved subject to the ENS resolution specifications, giving consideration to the target chain specified in the &lt;code&gt;&amp;lt;chain&amp;gt;&lt;&#x2F;code&gt; component.&lt;&#x2F;p&gt;
&lt;p&gt;The specifications of note are ENSIP-9: Multichain address resolution, ENSIP-10: Wildcard resolution, and ENSIP-11: EVM compatible Chain Address Resolution. These specification outline how one resolves an ENS name to discern the address &lt;strong&gt;for a specific chain&lt;&#x2F;strong&gt;. Consideration MUST be given to both current and future ENSIPs pertaining to address resolution.&lt;&#x2F;p&gt;
&lt;p&gt;If a &lt;em&gt;target address&lt;&#x2F;em&gt; has been used for the &lt;code&gt;&amp;lt;address&amp;gt;&lt;&#x2F;code&gt; component (or once the ENS name has been resolved to a &lt;em&gt;target address&lt;&#x2F;em&gt;) it should be serialized subject to the rules defined in the relevant &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ChainAgnostic&#x2F;CAIPs&#x2F;blob&#x2F;29762ef99a6ffea1e07e3f796c0d1a5a95e89b88&#x2F;CAIPs&#x2F;caip-350.md&quot;&gt;CAIP-350&lt;&#x2F;a&gt; profile for the given &lt;code&gt;&amp;lt;chain&amp;gt;&lt;&#x2F;code&gt;. This ensures that different valid text representations (e.g., case variations in an address) resolve to a single, canonical binary form, which is essential for consistent checksum calculation and data integrity.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;The Ethereum Name Service (ENS) is a well-established blockchain identity primitive that enables the registration of human-readable names (e.g. example.eth, wallet.ensdao.eth) which resolve to addresses on a chain-specific basis. ENS is widely used, familiar to users, and well understood by implementers.&lt;&#x2F;li&gt;
&lt;li&gt;For flexibility and backwards compatibility, this specification allows a raw target address to be used in the &lt;code&gt;&amp;lt;address&amp;gt;&lt;&#x2F;code&gt; component, accommodating users and applications that prefer traditional address representations.&lt;&#x2F;li&gt;
&lt;li&gt;In this specification, checksums are defined as OPTIONAL. While they provide meaningful integrity guarantees for raw, chain-specific target addresses, their applicability to ENS-based names is limited. ENS names may resolve to different addresses over time depending on resolver behavior, which means that a previously generated checksum may no longer validate even when resolution is correct. In addition, when using ENS, users already delegate name normalization, resolution, and validation to ENS-specific mechanisms, so applying checksums in these cases provides limited additional security while increasing complexity and ambiguity for implementers. As a result, checksums are primarily intended to protect the integrity of raw, chain-specific addresses, while remaining optional and flexible for user-facing applications.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7930&#x2F;&quot;&gt;ERC-7930&lt;&#x2F;a&gt; Version field is excluded from checksum calculation to allow the same Interoperable Name to remain valid across version upgrades of the binary format.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Implementers MUST give consideration to the name normalization specifications of the Ethereum Name Service so as to avoid homoglyph or spoofing attacks. These are outlined in ENSIP-1 and ENSIP-15.&lt;&#x2F;li&gt;
&lt;li&gt;Users should stay vigilant of address poisoning attacks when using a raw &lt;em&gt;target address&lt;&#x2F;em&gt; in the &lt;code&gt;&amp;lt;address&amp;gt;&lt;&#x2F;code&gt; component.&lt;&#x2F;li&gt;
&lt;li&gt;ENS resolution depends on resolver contracts set for each name. Resolvers may change over time, and wildcard resolvers (ENSIP-10) may return dynamic data&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Transaction Gas Limit Cap</title>
        <published>2024-11-23T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Giulio Rebuffo</name><uri>https://github.com/Giulio2002</uri>
	</author>
	
	<author>
		<name>Toni Wahrstätter</name><uri>https://github.com/nerolation</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7825/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7825-transaction-gas-limit-cap/21848" />
        

        <id>https://wg-eips.ritovision.com/7825/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:7825"
            label="EIP-7825" />
        

        
        

        
        <summary type="html">Introduce a protocol-level cap on the maximum gas used by a transaction to 16,777,216 (2^24).</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7825/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal introduces a protocol-level cap on the maximum gas usage per transaction to 16,777,216 (2^24) gas. By implementing this limit, Ethereum can enhance its resilience against certain DoS vectors, improve network stability, and provide more predictability to transaction processing costs, especially in the context of increasing the gas limit.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, transactions can theoretically consume up to the entire block gas limit, which poses several risks:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;DoS Attacks&lt;&#x2F;strong&gt;: A single transaction consuming most or all of the block gas can result in uneven load distribution and impact network stability.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;State Bloat Risks&lt;&#x2F;strong&gt;: High-gas transactions often result in larger state changes, increasing the burden on nodes and exacerbating the Ethereum state growth problem.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Validation Overhead&lt;&#x2F;strong&gt;: High-gas transactions can lead to longer block verification times, negatively impacting user experience and network decentralization.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;By limiting individual transactions to a maximum of 16,777,216 gas, we aim to:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Reduce the risks of single-transaction DoS attacks.&lt;&#x2F;li&gt;
&lt;li&gt;Promote fairer gas allocation across transactions within a block.&lt;&#x2F;li&gt;
&lt;li&gt;Ensure better synchronization among nodes by mitigating extreme block validation times.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;gas-cap&quot;&gt;Gas Cap&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Enforce a protocol-level maximum of &lt;strong&gt;16,777,216 gas (2^24)&lt;&#x2F;strong&gt; for any single transaction.&lt;&#x2F;li&gt;
&lt;li&gt;This cap applies regardless of the block gas limit set by miners or validators.&lt;&#x2F;li&gt;
&lt;li&gt;Transactions specifying gas limits higher than 16,777,216 gas will be rejected with an appropriate error code (e.g., &lt;code&gt;MAX_GAS_LIMIT_EXCEEDED&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;changes-to-evm-behavior&quot;&gt;Changes to EVM Behavior&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Txpool Validation&lt;&#x2F;strong&gt;: During transaction validation, if the &lt;code&gt;gasLimit&lt;&#x2F;code&gt; specified by the sender exceeds 16,777,216, the transaction is invalidated (not included in the txpool).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Block Validation&lt;&#x2F;strong&gt;: As part of block validation before processing, any block having a transaction with &lt;code&gt;gasLimit&lt;&#x2F;code&gt; &amp;gt; 16,777,216 is deemed invalid and rejected.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;protocol-adjustment&quot;&gt;Protocol Adjustment&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;GAS_LIMIT&lt;&#x2F;code&gt; parameter for transactions will be capped in client implementations at 16,777,216.&lt;&#x2F;li&gt;
&lt;li&gt;This cap is &lt;strong&gt;independent&lt;&#x2F;strong&gt; of the block gas limit, which exceeds this value.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-16-777-216-2-24&quot;&gt;Why 16,777,216 (2^24)?&lt;&#x2F;h3&gt;
&lt;p&gt;The proposed cap of 16,777,216 gas (2^24) provides a clean power-of-two boundary that simplifies implementation while still being large enough to accommodate most complex transactions, including contract deployments and advanced DeFi interactions. This value represents approximately half of typical block sizes (30-40 million gas), ensuring multiple transactions can fit within each block.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;compatibility-with-current-gas-dynamics&quot;&gt;Compatibility with Current Gas Dynamics&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Backward Compatibility&lt;&#x2F;strong&gt;: Transactions with gas usage below 16,777,216 remain unaffected. Existing tooling and dApps need only minor updates to enforce the new cap.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Impact on Validators&lt;&#x2F;strong&gt;: Validators can continue to process blocks with a gas limit exceeding 16,777,216, provided individual transactions adhere to the cap.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change is &lt;strong&gt;not backward-compatible&lt;&#x2F;strong&gt; with transactions that specify gas limits exceeding 16,777,216. Transactions with such high limits will need to be split into smaller operations. This adjustment is expected to impact a minimal number of users and dApps, as most transactions today fall well below the proposed cap.&lt;&#x2F;p&gt;
&lt;p&gt;An &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7825&#x2F;assets&#x2F;analysis&#x2F;&quot;&gt;empirical analysis&lt;&#x2F;a&gt; has been conducted to assess the potential impact of this change.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;DoS Mitigation&lt;&#x2F;strong&gt;: A fixed cap reduces the risk of DoS attacks caused by excessively high-gas transactions.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Block Verification Stability&lt;&#x2F;strong&gt;: By capping individual transactions, the validation of blocks becomes more predictable and uniform.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Edge Cases&lt;&#x2F;strong&gt;: Certain highly complex transactions, such as large contract deployments, may require re-architecting to fit within the 16,777,216 gas cap.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Minimal Batch Executor Interface</title>
        <published>2024-11-21T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Vectorized</name><uri>https://github.com/Vectorized</uri>
	</author>
	
	<author>
		<name>Jake Moxey</name><uri>https://github.com/jxom</uri>
	</author>
	
	<author>
		<name>Hadrien Croubois</name><uri>https://github.com/Amxx</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7821/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7821-minimal-batch-executor-interface/21776" />
        

        <id>https://wg-eips.ritovision.com/7821/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7821"
            label="ERC-7821" />
        

        
        

        
        <summary type="html">A minimal batch executor interface for delegations</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7821/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal defines a minimal batch executor interface for delegations. A delegation is a smart contract that implements logic which other smart contracts can delegate to. This allows atomic batched executions to be prepared in a standardized way.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;With the advent of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt;, it is possible for Externally Owned Accounts (EOAs) to perform atomic batched executions.&lt;&#x2F;p&gt;
&lt;p&gt;We anticipate that there will be multiple EIP-7702 delegations from multiple major vendors. A standard for the execution interface will enable better interoperability. EIP-7702 delegation is a risky procedure which should be done sparingly — it should not be performed upon each time a user switches websites. Also, EIP-7702 delegations are transactions that cost gas, making frequent delegation switching uneconomical. A standardized execution interface will reduce the need to switch delegations.&lt;&#x2F;p&gt;
&lt;p&gt;This standard complements the &lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt; API in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5792&#x2F;&quot;&gt;EIP-5792&lt;&#x2F;a&gt;. It enables the detection of atomic batch execution capabilities on EOAs and the preparation of the calldata for atomic batch executions on EOAs.&lt;&#x2F;p&gt;
&lt;p&gt;Using atomic batched executions reduces total latency and total tranaction costs, making it preferable over sequential transaction sending for EOAs.&lt;&#x2F;p&gt;
&lt;p&gt;Hence the utmost motivation for this proposal, which has been crafted for maximal simplicity, extensibility, performance and compatibility.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;overview&quot;&gt;Overview&lt;&#x2F;h3&gt;
&lt;p&gt;The minimal batch executor interface is defined as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Interface for minimal batch executor.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7821&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Call struct for the `execute` function.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Call&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Replaced with `address(this)` if `address(0)`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Amount of native currency (i.e. Ether) to send.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Calldata to send with the call.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Executes the calls in `executionData`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Reverts and bubbles up error if any call fails.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MAY replace the `Call.to` with `address(this)` if `address(0)`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `executionData` encoding (single batch):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - If `opData` is empty, `executionData` is simply `abi.encode(calls)`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - Else, `executionData` is `abi.encode(calls, opData)`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   See: https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-7579&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `executionData` encoding (batch of batches):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - `executionData` is `abi.encode(bytes[])`, where each element in `bytes[]`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   is an `executionData` for a single batch.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Supported modes:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - `0x01000000000000000000...`: Single batch. Does not support optional `opData`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - `0x01000000000078210001...`: Single batch. Supports optional `opData`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - `0x01000000000078210002...`: Batch of batches. The mode is optional.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; For the &amp;quot;batch of batches&amp;quot; mode, each batch will be recursively passed into&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `execute` internally with mode `0x01000000000078210001...`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Useful for passing in batches signed by different signers.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Authorization checks:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - If `opData` is empty, the implementation SHOULD require that&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   `msg.sender == address(this)`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - If `opData` is not empty, the implementation SHOULD use the signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   encoded in `opData` to determine if the caller can perform the execution.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - If `msg.sender` is an authorized entry point, then `execute` MAY accept&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   calls from the entry point, and MAY use `opData` for specialized logic.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `opData` may be used to store additional data for authentication,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; paymaster data, gas limits, etc.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; For calldata compression efficiency, if a Call.to is `address(0)`,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; it will be replaced with `address(this)`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; execute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; mode&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; executionData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Provided for execution mode support detection.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Only returns true for:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - `0x01000000000000000000...`: Single batch. Does not support optional `opData`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - `0x01000000000078210001...`: Single batch. Supports optional `opData`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - `0x01000000000078210002...`: Batch of batches. The mode is optional.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsExecutionMode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; mode&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Support for batch of batches mode is OPTIONAL. If it is not supported, the contract MUST return false for any mode starting with &lt;code&gt;0x01000000000078210002&lt;&#x2F;code&gt; in &lt;code&gt;supportsExecutionMode&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;recommendations&quot;&gt;Recommendations&lt;&#x2F;h3&gt;
&lt;p&gt;To support the approve + swap workflow on EOAs with delegations, frontends SHOULD:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Query &lt;code&gt;supportsExecutionMode(bytes32(0x0100000000000000000000000000000000000000000000000000000000000000))&lt;&#x2F;code&gt;, ensuring that it returns true.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Perform &lt;code&gt;execute(bytes32(0x0100000000000000000000000000000000000000000000000000000000000000), abi.encode(calls))&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;We aim for radical minimalism to keep the standard as left-curved as possible. Simplicity is the key to adoption. Our North Star is to get every decentralized exchange to support the approve + swap workflow for EOAs with delegations as soon as possible.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;execute-and-supportsexecutionmode&quot;&gt;&lt;code&gt;execute&lt;&#x2F;code&gt; and &lt;code&gt;supportsExecutionMode&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;We have opted to use the &lt;code&gt;execute&lt;&#x2F;code&gt; and &lt;code&gt;supportsExecutionMode&lt;&#x2F;code&gt; functions in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7579&#x2F;&quot;&gt;ERC-7579&lt;&#x2F;a&gt; for better compatibility with the existing smart account ecosystem.&lt;&#x2F;p&gt;
&lt;p&gt;While radical minimalism is the goal, some compromises have to be made in the pursuit for better adoption.&lt;&#x2F;p&gt;
&lt;p&gt;For minimalism, this standard does not require implementing the &lt;code&gt;executeFromExecutor&lt;&#x2F;code&gt; function in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7579&#x2F;&quot;&gt;ERC-7579&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;optional-encoding-of-opdata-in-executiondata&quot;&gt;Optional encoding of &lt;code&gt;opData&lt;&#x2F;code&gt; in &lt;code&gt;executionData&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;opData&lt;&#x2F;code&gt; bytes parameter can be optionally included in &lt;code&gt;executionData&lt;&#x2F;code&gt; by either doing &lt;code&gt;abi.encode(calls)&lt;&#x2F;code&gt; or &lt;code&gt;abi.encode(calls, opData)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;replacing-address-0-with-address-this&quot;&gt;Replacing &lt;code&gt;address(0)&lt;&#x2F;code&gt; with &lt;code&gt;address(this)&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;For calldata compression optimization.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;optional-batch-of-batches-mode&quot;&gt;Optional batch of batches mode&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;opData&lt;&#x2F;code&gt; may be used to provide authentication data for a single batch. Having a batch of batches mode will enable a single transaction to be able to submit batches signed by different signers, without the need for an authorized entry point. This mode is kept optional because the same functionality can still be achieved with the use of an authorized entry point. It is included for developer experience.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backwards compatibility issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.4&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Minimal batch executor mixin.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;abstract&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC7821&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                          STRUCTS                           &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Call struct for the `execute` function.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Call&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Replaced with `address(this)` if `address(0)`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Amount of native currency (i.e. Ether) to send.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Calldata to send with the call.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                           ERRORS                           &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The execution mode is not supported.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UnsupportedExecutionMode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                    EXECUTION OPERATIONS                    &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Executes the calls in `executionData`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Reverts and bubbles up error if any call fails.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `executionData` encoding (single batch):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - If `opData` is empty, `executionData` is simply `abi.encode(calls)`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - Else, `executionData` is `abi.encode(calls, opData)`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   See: https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-7579&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `executionData` encoding (batch of batches):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - `executionData` is `abi.encode(bytes[])`, where each element in `bytes[]`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   is an `executionData` for a single batch.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Supported modes:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - `0x01000000000000000000...`: Single batch. Does not support optional `opData`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - `0x01000000000078210001...`: Single batch. Supports optional `opData`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - `0x01000000000078210002...`: Batch of batches. The mode is optional.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; For the &amp;quot;batch of batches&amp;quot; mode, each batch will be recursively passed into&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `execute` internally with mode `0x01000000000078210001...`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Useful for passing in batches signed by different signers.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Authorization checks:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - If `opData` is empty, the implementation SHOULD require that&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   `msg.sender == address(this)`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - If `opData` is not empty, the implementation SHOULD use the signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   encoded in `opData` to determine if the caller can perform the execution.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - If `msg.sender` is an authorized entry point, then `execute` MAY accept&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   calls from the entry point, and MAY use `opData` for specialized logic.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `opData` may be used to store additional data for authentication,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; paymaster data, gas limits, etc.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; For calldata compression efficiency, if a Call.to is `address(0)`,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; it will be replaced with `address(this)`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; execute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; mode&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; executionData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        public&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        payable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        virtual&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; id &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _executionModeId&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;mode&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;id &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            mode &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;^&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;22&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; batches &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;decode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;executionData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; batches&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;                execute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;mode&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; batches&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;id &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UnsupportedExecutionMode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span&gt; tryWithOpData&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @solidity memory-safe-assembly&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            let&lt;&#x2F;span&gt;&lt;span&gt; t &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; gt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;mload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;executionData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x3f&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            let&lt;&#x2F;span&gt;&lt;span&gt; executionDataLength &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;executionData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            tryWithOpData &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; and&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;eq&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; and&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;executionDataLength&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x3f&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; t&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        Call&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; calls&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; opData&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;tryWithOpData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            (&lt;&#x2F;span&gt;&lt;span&gt;calls&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; opData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;decode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;executionData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;Call&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            calls &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;decode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;executionData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;Call&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _execute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;calls&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; opData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Provided for execution mode support detection.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Only returns true for:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - `0x01000000000000000000...`: Single batch. Does not support optional `opData`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - `0x01000000000078210001...`: Single batch. Supports optional `opData`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - `0x01000000000078210002...`: Batch of batches. The mode is optional.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsExecutionMode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; mode&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _executionModeId&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;mode&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                      INTERNAL HELPERS                      &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0: invalid mode, 1: no `opData` support, 2: with `opData` support, 3: batch of batches.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _executionModeId&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; mode&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Only supports atomic batched executions.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; For the encoding scheme, see: https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-7579&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Bytes Layout:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - [0]      ( 1 byte )  `0x01` for batch call.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - [1]      ( 1 byte )  `0x00` for revert on any failure.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - [2..5]   ( 4 bytes)  Reserved by ERC7579 for future standardization.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - [6..9]   ( 4 bytes)  `0x00000000` or `0x78210001` or `0x78210002`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - [10..31] (22 bytes)  Unused. Free for use.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; m &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;mode&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;22&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xffff00000000ffffffff&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;m &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x01000000000078210002&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; id &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;m &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x01000000000078210001&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; id &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;m &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x01000000000000000000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; id &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Executes the calls and returns the results.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Reverts and bubbles up error if any call fails.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _execute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Call&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; calls&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; opData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        internal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        virtual&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Very basic auth to only allow this contract to be called by itself.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Override this function to perform more complex auth with `opData`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;opData&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Remember to return `_execute(calls)` when you override this function.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _execute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;calls&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        revert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; In your override, replace this with logic to operate on `opData`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Executes the calls.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Reverts and bubbles up error if any call fails.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _execute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Call&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; calls&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; calls&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            Call &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;memory&lt;&#x2F;span&gt;&lt;span&gt; c &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; calls&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            address&lt;&#x2F;span&gt;&lt;span&gt; to &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; c&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;to &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ?&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; :&lt;&#x2F;span&gt;&lt;span&gt; c&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            _execute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; c&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; c&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Executes the call.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Reverts and bubbles up error if the call fails.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _execute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        internal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        virtual&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt; success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;call&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @solidity memory-safe-assembly&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Bubble up the revert if the call reverts.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            revert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;result&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;access-controls-for-execute&quot;&gt;Access controls for &lt;code&gt;execute&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Implementations should ensure that &lt;code&gt;execute&lt;&#x2F;code&gt; have the proper access controls.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Access Control Registry</title>
        <published>2024-11-19T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Shubham Khandelwal</name><uri>https://github.com/shubh-ta</uri>
	</author>
	
	<author>
		<name>Anushka Yadav</name><uri>https://github.com/anushka642000</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7820/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7820-access-control-registry/21764" />
        

        <id>https://wg-eips.ritovision.com/7820/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7820"
            label="ERC-7820" />
        

        
        

        
        <summary type="html">Registration, unregistration, role assignment, and role revocation for contracts, ensuring secure and transparent role management.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7820/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The Access Control Registry (ACR) standard defines a universal interface for managing role-based access control across multiple smart contracts. This standard introduces a centralized registry system allowing access control management for multiple smart contracts. The single access-control registry smart contract manages the user roles across multiple contracts, and can be queryed for contract-specific role information. Additionally, the ACR standard provides functionality to grant and revoke roles for specific accounts, either individually or in bulk, ensuring that only authorized users can perform specific actions within a specific contract.&lt;&#x2F;p&gt;
&lt;p&gt;The core of the standard includes:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Registration and Unregistration&lt;&#x2F;strong&gt;: Contracts can register with the ACR, specifying an admin who can manage roles within the contract. Contracts can also be unregistered when they are no longer active.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Role Management&lt;&#x2F;strong&gt;: Admins can grant or revoke roles for accounts, either individually or in batches, ensuring fine-grained control over who can perform what actions within a contract.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Role Verification&lt;&#x2F;strong&gt;: Any account can verify if another account has a specific role in a registered contract, providing transparency and facilitating easier integration with other systems.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;By centralizing access control management, the ACR standard aims to reduce redundancy, minimize errors in access control logic, and provide a clear and standardized approach to role management across smart contracts. This improves security and maintainability, making it easier for developers to implement robust access control mechanisms in their applications.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;As decentralized applications (dApps) grow in complexity, managing access control across multiple smart contracts becomes increasingly difficult.
Current practices involve bespoke implementations, leading to redundancy and potential security flaws. A standardized approach for managing roles and permissions will ensure better interoperability, security, and transparency. By providing a unified interface for registering contracts and managing roles, this standard simplifies development, ensures consistency and enhances security. It facilitates easier integration and auditing, fostering a more robust and interoperable ecosystem.&lt;&#x2F;p&gt;
&lt;p&gt;The advantages of using the provided system might be:&lt;&#x2F;p&gt;
&lt;p&gt;Structured smart contracts management via specialized contracts.
Ad-hoc access-control provision of a protocol.
Ability to specify custom access control rules to maintain the protocol.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “NOT RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;AccessControlRegistry&lt;&#x2F;code&gt; contract provides a standardized interface for managing access control in Ethereum smart contracts. It includes functions to register and unregister contracts, grant and revoke roles for specific contracts, and check if an account has a particular role in a registered contract. Events are emitted for contract registration, unregistration, role grants, and role revocations, ensuring transparency and traceability of access control changes.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, the AccessControlRegistry MUST reject the registration of zero addresses.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0.8.23&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IAccessControlRegistry&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a contract is registered.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @param _contract The address of the registered contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @param _admin The address of the admin for the registered contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ContractRegistered&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _contract&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _admin&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a contract is unregistered.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @param _contract The address of the unregistered contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @param _admin The address who unregistered the contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ContractUnregistered&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _contract&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _admin&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a role is granted to an account for a contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @param targetContract The address of the contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @param role The role being granted.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @param account The address of the account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RoleGranted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; targetContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; role&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a role is revoked from an account for a contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @param targetContract The address of the contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @param role The role being revoked.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @param account The address of the account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RoleRevoked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; targetContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; role&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Registers a contract with the given admin.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @param _admin The address of the admin for the registered contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; registerContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _admin&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Unregisters a contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @param _contract The address of the contract to unregister.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; unRegisterContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _contract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Grants roles to multiple accounts for multiple contracts.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @param targetContracts An array of contract addresses to which roles will be granted.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @param roles An array of roles to be granted.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @param accounts An array of accounts to be granted the roles.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; grantRole&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; targetContracts&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; roles&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; accounts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Revokes roles from multiple accounts for multiple contracts.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @param targetContracts An array of contract addresses from which roles will be revoked.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @param roles An array of roles to be revoked.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @param accounts An array of accounts from which the roles will be revoked.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revokeRole&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; targetContracts&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; roles&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; accounts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;Gets the information of a registered contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;@param _contract The address of the contract to get the information.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;@return isActive Whether the contract is active.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;@return admin The address of the admin for the contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;MUST revert if the registered contract doesn&amp;#39;t exist&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getContractInfo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; isActive&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; admin&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Gets the information of a registered contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @param _contract The address of the contract to get the information.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @return isActive Whether the contract is active.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @return admin The address of the admin for the contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST revert if the registered contract doesn&amp;#39;t exist`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getRoleInfo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; isActive&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; admin&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;IAccessControlRegistry&lt;&#x2F;code&gt; interface aims to provide a standardized way to manage access control across multiple contracts within the ecosystem. By defining a clear structure and set of events, this interface helps streamline the process of registering, unregistering, and managing roles for contracts. The rationale for each function and event is as follows:&lt;&#x2F;p&gt;
&lt;h3 id=&quot;contract-registration-and-unregistration&quot;&gt;Contract Registration and Unregistration&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;registerContract(address _admin)&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: This function allows the registration of a new contract along with its admin address. This is crucial for initializing the access control settings for a contract and ensuring that there is an accountable admin who can manage roles and permissions.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;unRegisterContract(address _contract)&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: This function enables the removal of a contract from the registry. Unregistering a contract is important when a contract is no longer in use or needs to be decommissioned to prevent unauthorized access.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;role-management&quot;&gt;Role Management&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;grantRole(address[] memory targetContracts, bytes32[] memory roles, address[] memory accounts)&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: This function allows the assignment of roles to multiple accounts for multiple contracts in a single transaction. This bulk operation is designed to reduce the gas costs and simplify the process of role assignment in large systems with numerous contracts and users.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;revokeRole(address[] memory targetContracts, bytes32[] memory roles, address[] memory accounts)&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: Similar to &lt;code&gt;grantRole&lt;&#x2F;code&gt;, this function facilitates the revocation of roles from multiple accounts across multiple contracts in a single transaction. This ensures efficient management of permissions, especially in scenarios where many users need their roles updated simultaneously.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;role-checking&quot;&gt;Role Checking&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;getRoleInfo(address targetContract, address account, bytes32 role)&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: This view function allows the verification of whether a particular account holds a specific role for a given contract. This is essential for ensuring that operations requiring specific permissions are performed only by authorized users.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;contract-information-retrieval&quot;&gt;Contract Information Retrieval&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;getContractInfo(address _contract)&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: This function provides the ability to retrieve the status and admin information of a registered contract. It enhances transparency and allows administrators and users to easily query the status and management of any contract within the registry.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;events&quot;&gt;Events&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;ContractRegistered(address indexed _contract, address indexed _admin)&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: Emitted when a new contract is registered, this event ensures that there is a public record of contract registrations, facilitating auditability and transparency.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;ContractUnregistered(address indexed _contract, address indexed _admin)&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: Emitted when a contract is unregistered, this event serves to notify the system and its users of the removal of a contract from the registry, which is critical for maintaining an up-to-date and accurate registry.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;RoleGranted(address indexed targetContract, bytes32 indexed role, address indexed account)&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: Emitted when a role is granted to an account, this event provides a public log that can be used to track role assignments and changes, ensuring that role grants are transparent and verifiable.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;RoleRevoked(address indexed targetContract, bytes32 indexed role, address indexed account)&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: Emitted when a role is revoked from an account, this event similarly ensures that role revocations are publicly logged and traceable, supporting robust access control management.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;register&lt;&#x2F;code&gt; function must be invoked from the registering smart contract.
The &lt;code&gt;grantRole&lt;&#x2F;code&gt; and &lt;code&gt;revokeRole&lt;&#x2F;code&gt; functions must be invoked either from the registered contract or the admin of the registered contract.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0.8.23&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IAccessControlRegistry.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AccessControlRegistry&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IAccessControlRegistry&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Contains information about a registered contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @param isActive Indicates whether the contract is active.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @param admin The address of the admin for the registered contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ContractInfo&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span&gt; isActive&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; admin&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Mapping to store information of registered contracts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; ContractInfo&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; contracts&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Mapping to track roles assigned to accounts for specific contracts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; _contractRoles&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Custom error to handle duplicate registration attempts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ContractAlreadyRegistered&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Modifier to check if the caller is an admin or the contract itself&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    modifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyAdminOrContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _contract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            _isAdmin&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            (&lt;&#x2F;span&gt;&lt;span&gt;contracts&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;isActive &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; _contract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;Caller is not admin nor contract&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        _&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Modifier to check if the caller is an admin of the contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    modifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyAdmin&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _contract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            _isAdmin&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;Caller is not an admin&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        _&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Modifier to ensure the contract is active&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    modifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyActiveContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _contract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;contracts&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_contract&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;isActive&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Contract not registered&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        _&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Modifier to validate if the provided address is non-zero&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    modifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addr &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Invalid address&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        _&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Registers a contract with the given admin&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; _admin: Address of the admin to register&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; registerContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _admin&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_admin&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; _contract &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check if the contract is already registered&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ContractInfo &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;storage&lt;&#x2F;span&gt;&lt;span&gt; contractInfo &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; contracts&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_contract&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;contractInfo&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;isActive&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ContractAlreadyRegistered&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Register the contract with the provided admin&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        contractInfo&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;isActive &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        contractInfo&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;admin &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _admin&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ContractRegistered&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _admin&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Unregisters a contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; _contract: Address of the contract to unregister&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; unRegisterContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _contract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        public&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        onlyAdmin&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_contract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        onlyActiveContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_contract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ContractInfo &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;storage&lt;&#x2F;span&gt;&lt;span&gt; contractInfo &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; contracts&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_contract&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        contractInfo&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;isActive &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        contractInfo&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;admin &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ContractUnregistered&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Grants roles to multiple accounts for multiple contracts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; targetContracts: Array of contract addresses&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; roles: Array of roles to grant&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; accounts: Array of accounts to assign the roles&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; grantRole&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; targetContracts&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; roles&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; accounts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            targetContracts&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; roles&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            roles&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; accounts&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;Array lengths do not match&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; cachedArrayLength &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; roles&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Grant roles in a batch&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; cachedArrayLength&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            _grantRole&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;targetContracts&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; roles&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; accounts&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Revokes roles from multiple accounts for multiple contracts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; targetContracts: Array of contract addresses&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; roles: Array of roles to revoke&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; accounts: Array of accounts from which roles are revoked&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revokeRole&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; targetContracts&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; roles&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; accounts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            targetContracts&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; roles&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            roles&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; accounts&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;Array lengths do not match&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; cachedArrayLength &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; roles&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Revoke roles in a batch&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; cachedArrayLength&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            _revokeRole&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;targetContracts&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; roles&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; accounts&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieves information of a registered contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; _contract: Address of the contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns: isActive status and admin address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getContractInfo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _contract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        public&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; isActive&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; admin&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ContractInfo &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;storage&lt;&#x2F;span&gt;&lt;span&gt; info &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; contracts&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_contract&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;info&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;isActive&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; info&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;admin&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Gets role information for an account and contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; targetContract: Address of the target contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; account: Address of the account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; role: Role identifier&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns: Boolean indicating if the account has the role&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getRoleInfo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; targetContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; role&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _contractRoles&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;targetContract&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;role&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Internal function to grant a role to an account for a contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _grantRole&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; targetContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; role&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        internal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        onlyAdminOrContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;targetContract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        onlyActiveContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;targetContract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        validAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _contractRoles&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;targetContract&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;role&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RoleGranted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;targetContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; role&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Internal function to revoke a role from an account for a contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _revokeRole&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; targetContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; role&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        internal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        onlyAdminOrContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;targetContract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        onlyActiveContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;targetContract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        validAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            _contractRoles&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;targetContract&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;role&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;Role already revoked&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _contractRoles&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;targetContract&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;role&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RoleRevoked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;targetContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; role&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Checks if the caller is an admin for the contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; _contract: Address of the contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; _admin: Address of the admin&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns: Boolean indicating admin status&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _isAdmin&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _admin&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _admin &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; contracts&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_contract&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;admin&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;design-decisions&quot;&gt;Design Decisions&lt;&#x2F;h3&gt;
&lt;p&gt;There are a few design decisions that have to be explicitly specified to ensure the functionality, security, and efficiency of the &lt;code&gt;IAccessControlRegistry&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;h4 id=&quot;decentralized-contract-registration&quot;&gt;Decentralized Contract Registration&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;No Central Owner&lt;&#x2F;strong&gt;: There is no central owner who can register contracts. This design choice promotes decentralization and ensures that individual contracts are responsible for their own registration and management.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;efficient-storage-and-lookup&quot;&gt;Efficient Storage and Lookup&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;Mapping Utilization&lt;&#x2F;strong&gt;: The use of mappings for storing contract information (&lt;code&gt;mapping(address =&amp;gt; ContractInfo) private contracts&lt;&#x2F;code&gt;) and role assignments (&lt;code&gt;mapping(address =&amp;gt; mapping(address =&amp;gt; mapping(bytes32 =&amp;gt; bool))) private _contractRoles&lt;&#x2F;code&gt;) ensures efficient storage and lookup. This is crucial for maintaining performance in a large-scale system with numerous contracts and roles.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;role-management-flexibility&quot;&gt;Role Management Flexibility&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;Bulk Operations&lt;&#x2F;strong&gt;: Functions like &lt;code&gt;grantRole&lt;&#x2F;code&gt; and &lt;code&gt;revokeRole&lt;&#x2F;code&gt; allow for the assignment and revocation of roles to multiple accounts for multiple contracts in a single transaction. This bulk operation reduces gas costs and simplifies the process of role management in large systems.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;robust-security-measures&quot;&gt;Robust Security Measures&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;Admin-Only Operations&lt;&#x2F;strong&gt;: Functions that modify the state, such as unRegisterContract, &lt;code&gt;_grantRole&lt;&#x2F;code&gt;, and &lt;code&gt;_revokeRole&lt;&#x2F;code&gt;, are restricted to contract admins. This ensures that only authorized personnel can manage contracts and roles, reducing the risk of unauthorized changes.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Valid Address Checks&lt;&#x2F;strong&gt;: The &lt;code&gt;validAddress&lt;&#x2F;code&gt; modifier ensures that addresses are non-zero, preventing potential issues with null addresses which could lead to unintended behavior or security vulnerabilities.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Active Contract Checks&lt;&#x2F;strong&gt;: The &lt;code&gt;onlyActiveContract&lt;&#x2F;code&gt; modifier ensures that actions are only performed on active or registered contracts, preventing operations on inactive or unregistered contracts.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;transparent-auditing&quot;&gt;Transparent Auditing&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;Event Logging&lt;&#x2F;strong&gt;: Emitting events for each significant action (registration, unregistration, role granting, and revocation) provides a transparent log that can be monitored and audited. This helps in detecting and responding to unauthorized or suspicious activities promptly.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;AccessControlRegistry&lt;&#x2F;code&gt; implements several security measures to ensure the integrity and reliability of the access control system:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Admin-Only Restrictions&lt;&#x2F;strong&gt;: By limiting state-modifying functions to contract admins, the system prevents unauthorized users from making critical changes.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Active Contract Checks&lt;&#x2F;strong&gt;: Operations are restricted to active contracts, reducing the risk of interacting with deprecated or unregistered contracts.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Event Logging&lt;&#x2F;strong&gt;: Comprehensive event logging supports transparency and auditability, allowing for effective monitoring and detection of unauthorized actions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>SETDELEGATE instruction</title>
        <published>2024-11-18T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Hadrien Croubois</name><uri>https://github.com/amxx</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7819/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7819-create-delegate/21763" />
        

        <id>https://wg-eips.ritovision.com/7819/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7819"
            label="EIP-7819" />
        

        
        

        
        <summary type="html">Introduce a new instruction allowing contracts to create clones using EIP-7702 delegation designations</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7819/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce a new instruction that allows smart contracts to create (and update) delegation accounts that match &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt;&#x27;s design. These accounts can be used similarly to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1167&#x2F;&quot;&gt;ERC-1167&lt;&#x2F;a&gt; clones, with significant advantages.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Many on-chain applications involve creating multiple instances of the same code at different locations. These applications often rely on clones, or proxies, to reduce deployment costs.&lt;&#x2F;p&gt;
&lt;p&gt;Clones, such as the one described in ERC-1167 are minimal pieces of code that contain the target address directly in the code. That makes them extremely light but prevents any form of reconfiguration (upgradability).&lt;&#x2F;p&gt;
&lt;p&gt;Upgradeable proxies differ from clones in that they read the implementation&#x27;s address from storage. This makes them more versatile but also more expensive to use.&lt;&#x2F;p&gt;
&lt;p&gt;In both cases delegating the received calls to an implementation using EVM code comes with some downsides:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Calldata must be copied to memory before performing the delegate call&lt;&#x2F;li&gt;
&lt;li&gt;If EOF is enabled, clones and proxy written in EOF do not support delegation to an implementation written in legacy EVM code, and are thus limited or possibly dangerous. This encourages the continued use of legacy EVM code.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;EIP-7702 introduces a new type of object that has the expected behavior: delegation indicator. These objects are designed to be instantiated at the address of EOA&#x27;s, but the same behavior could be re-used to implement clones at the protocol level. Using delegation indicators for this use-case provides upgradeability without the need for storage lookups if the contract calling the &lt;code&gt;SETDELEGATE&lt;&#x2F;code&gt; allows it. It also removes any issue related to code version incompatibilities.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;account-abstraction&quot;&gt;Account abstraction&lt;&#x2F;h3&gt;
&lt;p&gt;Smart accounts, as in contracts that are &quot;owned&quot; by one or multiple keys and are intended to replace EOAs, are often deployed using clones or proxies that point to a singleton implementation. This forces a choice between having an upgradeable or a non-upgradeable design. Both designs come with downsides. Non-upgradeable design can leave you stranded with a buggy (or limited) account code. Upgradeable design comes with costs associated with fetching the implementation address.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;SETDELEGATE&lt;&#x2F;code&gt; instruction would enable new factories to implement an upgradeable design without the added cost of the lookup. Factories could also deploy non-upgradeable variants, or even selectively disable the upgradeability of some accounts. Both the upgrade mechanism and the selective locking would be handled at the factory level, which removes the burden of implementing the upgrade logic into the account itself.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, using EIP-7702 delegations instead of clones&#x2F;proxies moves the call redirection logic from the userspace to the protocol. This means fewer EVM operations, and thus a reduced gas consumption of every operation that calls these contracts. This includes the verification of signatures and the execution of user operations, but also transfers of assets that include a callback, such as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; tokens.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;scalability&quot;&gt;Scalability&lt;&#x2F;h3&gt;
&lt;p&gt;Clones and proxy contracts are present in large numbers in the blockchain state. OpenZeppelin&#x27;s &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1967&#x2F;&quot;&gt;ERC-1967&lt;&#x2F;a&gt; proxies are ~708 bytes. Using EIP-7702 delegations that are only 23 bytes would reduce blockchain state usage.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, clones and proxy contracts have to handle the redirection of the call in the userspace, which includes execution cost. Using EIP-7702 delegations, which would move the redirection to the protocol level, would reduce the gas cost of all operations that target. This means more gas &#x2F; blockspace is available for the actual execution of the contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;A new instruction (&lt;code&gt;SETDELEGATE&lt;&#x2F;code&gt;) is added at &lt;code&gt;0xf6&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;behavior&quot;&gt;Behavior&lt;&#x2F;h3&gt;
&lt;p&gt;Executing this instruction does the following:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;deduct &lt;code&gt;EMPTY_ACCOUNT_COST&lt;&#x2F;code&gt; gas&lt;&#x2F;li&gt;
&lt;li&gt;halt if the current frame is in &lt;code&gt;static-mode&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;pop &lt;code&gt;salt&lt;&#x2F;code&gt;, &lt;code&gt;target&lt;&#x2F;code&gt; from the operand stack&lt;&#x2F;li&gt;
&lt;li&gt;calculate &lt;code&gt;location&lt;&#x2F;code&gt; as &lt;code&gt;keccak256(DESIGNATOR ++ address ++ salt)[12:]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;add &lt;code&gt;location&lt;&#x2F;code&gt; to &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt;, as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;halt if the code at &lt;code&gt;location&lt;&#x2F;code&gt; is not empty and does not start with &lt;code&gt;0xEF0100&lt;&#x2F;code&gt; (no empty and not a delegation indicator)&lt;&#x2F;li&gt;
&lt;li&gt;add &lt;code&gt;EMPTY_ACCOUNT_COST - BASE_COST&lt;&#x2F;code&gt; gas to the global refund counter if &lt;code&gt;location&lt;&#x2F;code&gt; exists in the trie&lt;&#x2F;li&gt;
&lt;li&gt;set the code of &lt;code&gt;location&lt;&#x2F;code&gt; to be &lt;code&gt;DESIGNATOR ++ target&lt;&#x2F;code&gt;, matching the delegation process defined in EIP-7702
&lt;ul&gt;
&lt;li&gt;Similarly to EIP-7702, if &lt;code&gt;target&lt;&#x2F;code&gt; is &lt;code&gt;0x0&lt;&#x2F;code&gt; do not write the designation. Clear the code at &lt;code&gt;location&lt;&#x2F;code&gt; and reset the &lt;code&gt;location&lt;&#x2F;code&gt;&#x27;s code hash to the empty hash &lt;code&gt;0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;if the nonce of the account at &lt;code&gt;location&lt;&#x2F;code&gt; is 0, increment it to 1&lt;&#x2F;li&gt;
&lt;li&gt;push &lt;code&gt;location&lt;&#x2F;code&gt; onto the stack&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;On step 8, &lt;code&gt;target&lt;&#x2F;code&gt; MUST be exactly 20 bytes. If the value retrieved from the stack is smaller than 20 bytes, it MUST be left fill (big-endian notation) with zeros. If it is bigger than 20 bytes, it must be trimmed of the highest bytes. The code placed at &lt;code&gt;location&lt;&#x2F;code&gt; MUST be exactly 23 bytes long, following EIP-7702.&lt;&#x2F;p&gt;
&lt;p&gt;The delegation indicator created at &lt;code&gt;location&lt;&#x2F;code&gt; behaves identically to those created by EIP-7702.&lt;&#x2F;p&gt;
&lt;p&gt;Note: The delegation is effective immediately upon the completion of the operation. Calls to the address as soon as the next operation will execute the newly delegated code.&lt;&#x2F;p&gt;
&lt;p&gt;The delegation indicators created by the &lt;code&gt;SETDELEGATE&lt;&#x2F;code&gt; opcode are the same objects as the one created using EIP-7702. Therefore, all the behavior specificities documented in EIP-7702 (&lt;code&gt;CODESIZE&lt;&#x2F;code&gt;, &lt;code&gt;CODECOPY&lt;&#x2F;code&gt;, targeting precompile, or chaining delegation indicator) also apply here. Any future EIP that modify the behavior of EIP-7702 delegation indicators should also apply to the delegation indicators created using &lt;code&gt;SETDELEGATE&lt;&#x2F;code&gt;. They are not contracts, and cannot be deleted using &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;, even if the &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; appens in the same transaction that created the account at &lt;code&gt;location&lt;&#x2F;code&gt;. Destruction of the delegations SHOULD only be possible by the same caller (that created them) doing a new &lt;code&gt;SETDELEGATE&lt;&#x2F;code&gt; call with the same salt and a zero target.&lt;&#x2F;p&gt;
&lt;p&gt;Step 9 ensures that an account that was created using &lt;code&gt;SETDELEGATE&lt;&#x2F;code&gt; never returns to an empty state (forbiden by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7523&#x2F;&quot;&gt;EIP-7523&lt;&#x2F;a&gt;). Even if the balance is zero, no state was ever set, and the code is removed by a &lt;code&gt;SETDELEGATE&lt;&#x2F;code&gt; operation (with zero target), then the nonce being (at least) one would guarantee the account is not empty.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;p&gt;These parameters are the same ones as used in EIP-7702.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;DESIGNATOR&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;0xef0100&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;EMPTY_ACCOUNT_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;25000&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;BASE_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;12500&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;gas-cost&quot;&gt;Gas cost&lt;&#x2F;h3&gt;
&lt;p&gt;The execution of the &lt;code&gt;SETDELEGATE&lt;&#x2F;code&gt; instruction involves fewer moving pieces than what EIP-7702 gas costs account for:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;there is no signature recovery&lt;&#x2F;li&gt;
&lt;li&gt;there is no dedicated calldata that must be accounted for that is not already paid for at the transaction level&lt;&#x2F;li&gt;
&lt;li&gt;there is no nonce update&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Therefore, the cost of executing this instruction could be lower than EIP-7702. Numbers from EIP-7702 are reused for simplicity. They are lower than &lt;code&gt;CREATE&lt;&#x2F;code&gt; or &lt;code&gt;CREATE2&lt;&#x2F;code&gt; operations, making the use of this instruction competitive for the intended use-cases.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;address-collision&quot;&gt;Address collision&lt;&#x2F;h3&gt;
&lt;p&gt;The derivation of the &lt;code&gt;location&lt;&#x2F;code&gt; is designed not to conflict with contracts created using the &lt;code&gt;CREATE&lt;&#x2F;code&gt; or &lt;code&gt;CREATE2&lt;&#x2F;code&gt; opcodes. In particular, the pre-images used to hash the produced address have different lengths, preventing any collision:&lt;&#x2F;p&gt;
&lt;p&gt;Contracts deployed using &lt;code&gt;CREATE2&lt;&#x2F;code&gt; have an address that is derived from a 85 bytes long pre-image, as opposed to 55 bytes for &lt;code&gt;SET_DELEGATE&lt;&#x2F;code&gt;. This observation alone remove the risk of pre-image collision.&lt;&#x2F;p&gt;
&lt;p&gt;Contracts deployed using &lt;code&gt;CREATE&lt;&#x2F;code&gt; have an address that is derived from the &lt;code&gt;RLP([address, nonce])&lt;&#x2F;code&gt;. For this pre-image to have a length 55 (like &lt;code&gt;SET_DELEGATE&lt;&#x2F;code&gt;), &lt;code&gt;nonce&lt;&#x2F;code&gt; must be 32 bytes long. In that case, the &lt;code&gt;RLP([address, nonce])&lt;&#x2F;code&gt; would be &lt;code&gt;0xf694&amp;lt;address&amp;gt;a0&amp;lt;nonce&amp;gt;&lt;&#x2F;code&gt; and would thus not start with the magic value used by &lt;code&gt;SETDELEGATE&lt;&#x2F;code&gt;. A smaller nonce could lead to the pre-image starting with &lt;code&gt;0xef&lt;&#x2F;code&gt;, but in that case the pre-image would be smaller than 55 bytes. Even in that case, the pre-image would start with &lt;code&gt;0xef94&lt;&#x2F;code&gt;, &lt;code&gt;0x94&lt;&#x2F;code&gt; encoding the &lt;code&gt;address&lt;&#x2F;code&gt; object (that is 20 bytes long).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;delegator-upgrades-deletion&quot;&gt;Delegator upgrades &amp;amp; deletion&lt;&#x2F;h3&gt;
&lt;p&gt;Reusing EIP-7702 behavior, including clearing the code if the target is 0, results in the ability to upgrade or even &quot;remove&quot; the created designator. This process is controlled (and can be restricted) by the factory (the contract that calls &lt;code&gt;SETDELEGATE&lt;&#x2F;code&gt;). Some factories will add checks that prevent re-executing &lt;code&gt;SETDELEGATE&lt;&#x2F;code&gt; with a salt that was already used, making the create designator immutable. Others may allow access-restricted upgrades, but prevent deletion. In any case, guarantees about the lifecycle of the designator created using &lt;code&gt;SETDELEGATE&lt;&#x2F;code&gt; are provided by the contracts that call it and not by the protocol.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;delegator-chaining&quot;&gt;Delegator chaining&lt;&#x2F;h3&gt;
&lt;p&gt;As documented in EIP-7702, designator chains or loops are not resolved. This means that, unlike clones, chaining is an issue. This is however something developers are used to, as chaining proxy can result in strange behaviors, including infinite delegation loops.&lt;&#x2F;p&gt;
&lt;p&gt;Factories may want to protect against this risk by verifying that the &lt;code&gt;target&lt;&#x2F;code&gt; doesn&#x27;t contain a designator. This can be achieved using a legacy contract helper that has access to &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt;. It could also be done using other forms of introspection such as an &lt;code&gt;ACCOUNT_TYPE&lt;&#x2F;code&gt; instruction.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;front-running-initialization&quot;&gt;Front running initialization&lt;&#x2F;h3&gt;
&lt;p&gt;Unlike EIP-7702 signature, which can be included in any transaction, and can thus lead to initialization front-running if the implementation doesn&#x27;t check the authenticity of the initialization parameters, &lt;code&gt;CREATE_DELEGATE&lt;&#x2F;code&gt; is executed by a smart contract that can execute the initialization logic atomically, just after the delegation is created. This process is well-known to developers that initialize clones and proxies just after creation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;multiple-delegation-changes-within-a-single-transaction&quot;&gt;Multiple delegation changes within a single transaction.&lt;&#x2F;h3&gt;
&lt;p&gt;If a contract performs multiple &lt;code&gt;SETDELEGATE&lt;&#x2F;code&gt; operations with the same salt but different targets within the same transaction, while doing calls corresponding address, this would have, in the same transaction without reverts, an address that has multiple different codes associated with it, two or more of which are executed. This include the delegation being removed&#x2F;reset any number of time during the transaction.&lt;&#x2F;p&gt;
&lt;p&gt;This behavior, is already possible with more traditional upgradeable contracts, where change of target are caused by a specific storage slot being modified.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Expirable ERC-20</title>
        <published>2024-11-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>sirawt</name><uri>https://github.com/MASDXI</uri>
	</author>
	
	<author>
		<name>ADISAKBOONMARK</name><uri>https://github.com/ADISAKBOONMARK</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7818/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7818-expirable-erc20/21655" />
        

        <id>https://wg-eips.ritovision.com/7818/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:7818"
            label="ERC-7818" />
        

        
        

        
        <summary type="html">An ERC-20 extension for creating fungible tokens with expiration, supporting time-limited use cases.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7818/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Introduces an extension for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens, which facilitates the implementation of an expiration mechanism. Through this extension, tokens have a predetermined validity period, after which they become invalid and can no longer be transferred or used. This functionality proves beneficial in scenarios such as time-limited bonds, loyalty rewards, or game tokens necessitating automatic invalidation after a specific duration. The extension is crafted to seamlessly align with the existing &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; standard, ensuring smooth integration with the prevailing token smart contract while introducing the capability to govern and enforce token expiration at the contract level.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This extension facilitates the development of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; standard compatible tokens featuring expiration dates. This capability broadens the scope of potential applications, particularly those involving time-sensitive assets. Expirable tokens are well-suited for scenarios necessitating temporary validity, including:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Bonds or financial instruments with defined maturity dates&lt;&#x2F;li&gt;
&lt;li&gt;Time-constrained assets within gaming ecosystems&lt;&#x2F;li&gt;
&lt;li&gt;Next-gen loyalty programs incorporating expiring rewards or points&lt;&#x2F;li&gt;
&lt;li&gt;Prepaid credits for utilities or services (e.g., cashback, data packages, fuel, computing resources) that expire if not used within a specified time frame&lt;&#x2F;li&gt;
&lt;li&gt;Postpaid telecom data package allocations that expire at the end of the billing cycle, motivating users to utilize their data before it resets&lt;&#x2F;li&gt;
&lt;li&gt;Tokenized e-Money for a closed-loop ecosystem, such as transportation, food court, and retail payments&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “NOT RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;epoch-mechanism&quot;&gt;Epoch Mechanism&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;Epochs&lt;&#x2F;strong&gt; represent a specific period or block range during which certain tokens are valid. They can be categorized into two types&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;block-based&lt;&#x2F;strong&gt; Defined by a specific number of blocks (e.g., 1000 &lt;code&gt;blocks&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;time-based&lt;&#x2F;strong&gt; Defined by a specific duration in seconds (e.g., 1000 &lt;code&gt;seconds&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Tokens linked to an &lt;code&gt;epoch&lt;&#x2F;code&gt; remain valid as long as the &lt;code&gt;epoch&lt;&#x2F;code&gt; is active. Once the specified number of &lt;code&gt;blocks&lt;&#x2F;code&gt; or the duration in &lt;code&gt;seconds&lt;&#x2F;code&gt; has passed, the &lt;code&gt;epoch&lt;&#x2F;code&gt; expires, and any tokens associated with it are considered expired.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;balance-look-back-over-epochs&quot;&gt;Balance Look Back Over Epochs&lt;&#x2F;h3&gt;
&lt;p&gt;To retrieve the usable balance, tokens are checked from the &lt;strong&gt;current epoch&lt;&#x2F;strong&gt; against a &lt;strong&gt;past epoch&lt;&#x2F;strong&gt; (which can be any &lt;em&gt;&lt;strong&gt;n&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt; epochs back). The past epoch can be set to any value &lt;em&gt;&lt;strong&gt;n&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt;, allowing flexibility in tracking and summing tokens that are still valid from previous epochs, up to &lt;em&gt;&lt;strong&gt;n&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt; epochs back.&lt;&#x2F;p&gt;
&lt;p&gt;The usable balance is the sum of tokens valid between the &lt;strong&gt;current epoch&lt;&#x2F;strong&gt; and the &lt;strong&gt;past epoch&lt;&#x2F;strong&gt;, ensuring that only non-expired tokens are considered.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;example-scenario&quot;&gt;Example Scenario&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;strong&gt;epoch&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;strong&gt;balance&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;150&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;200&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Current Epoch&lt;&#x2F;strong&gt;: 3&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Past Epoch&lt;&#x2F;strong&gt;: 1 epoch back&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Usable Balance&lt;&#x2F;strong&gt;: 350&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Tokens from &lt;strong&gt;Epoch 2&lt;&#x2F;strong&gt; and &lt;strong&gt;Epoch 3&lt;&#x2F;strong&gt; are valid. The same logic applies for any &lt;em&gt;&lt;strong&gt;n&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt; epochs back, where the usable balance includes tokens from the current epoch and all prior valid epochs.&lt;&#x2F;p&gt;
&lt;p&gt;Compatible implementations &lt;strong&gt;MUST&lt;&#x2F;strong&gt; inherit from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;&#x27;s interface and &lt;strong&gt;MUST&lt;&#x2F;strong&gt; have all the following functions and all function behavior &lt;strong&gt;MUST&lt;&#x2F;strong&gt; meet the specification.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; &amp;gt;=0.8.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0.9&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-7818 interface&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Interface for adding expirable functionality to ERC20 tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERC20.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7818&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC20&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Enum represents the types of `epoch` that can be used.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The implementing contract may use one of these types to define how the `epoch` is measured.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EPOCH_TYPE&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        BLOCKS_BASED&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; measured in the number of blocks (e.g., 1000 blocks)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        TIME_BASED&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; measured in seconds (UNIX time) (e.g., 1000 seconds)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieves the balance of a specific `epoch` owned by an account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The `epoch for which the balance is checked.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The balance of the specified `epoch`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &amp;quot;MUST&amp;quot; return 0 if the specified `epoch` is expired.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOfAtEpoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; epoch&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieves the latest epoch currently tracked by the contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The latest epoch of the contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; currentEpoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieves the duration of a single epoch.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The duration of a single epoch.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The unit of the epoch length is determined by the `validityPeriodType` function.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; epochLength&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the type of the epoch.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; EPOCH_TYPE&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  Enum value indicating the unit of an epoch.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; epochType&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;EPOCH_TYPE&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieves the validity duration in `epoch` counts.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The validity duration in `epoch` counts.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validityDuration&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Checks whether a specific `epoch` is expired.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The `epoch` to check.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; True if the token is expired, false otherwise.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Implementing contracts &amp;quot;MUST&amp;quot; define and document the logic for determining expiration,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * typically by comparing the latest epoch with the given `epoch` value,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * based on the `EPOCH_TYPE` measurement (e.g., block count or time duration).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isEpochExpired&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; epoch&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfers a specific `epoch` and value to a recipient.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The `epoch` for the transfer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The recipient address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount to transfer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; True if the transfer succeeded, otherwise false.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferAtEpoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; epoch&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfers a specific `epoch` and value from one account to another.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The `epoch` for the transfer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The sender&amp;#39;s address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The recipient&amp;#39;s address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount to transfer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; True if the transfer succeeded, otherwise false.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFromAtEpoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; epoch&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;behavior-specification&quot;&gt;Behavior Specification&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;balanceOf&lt;&#x2F;code&gt; &lt;strong&gt;MUST&lt;&#x2F;strong&gt; return the total balance of tokens held by an account that are still valid (i.e., have not expired). This includes any tokens associated with specific epochs, provided they remain within their validity duration. Expired tokens &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; be included in the returned balance, ensuring that only actively usable tokens are reflected in the result.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;balanceOfAtEpoch&lt;&#x2F;code&gt; &lt;strong&gt;MUST&lt;&#x2F;strong&gt; return the balance of tokens held by an account at the specified &lt;code&gt;epoch&lt;&#x2F;code&gt;. If the specified epoch is expired, this function &lt;strong&gt;MUST&lt;&#x2F;strong&gt; return &lt;code&gt;0&lt;&#x2F;code&gt;.
For example, if &lt;code&gt;epoch&lt;&#x2F;code&gt; 5 has expired, calling &lt;code&gt;balanceOfByEpoch(5, address)&lt;&#x2F;code&gt; returns &lt;code&gt;0&lt;&#x2F;code&gt; even if there were tokens previously held in that epoch.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;currentEpoch&lt;&#x2F;code&gt; &lt;strong&gt;MUST&lt;&#x2F;strong&gt; return the current &lt;code&gt;epoch&lt;&#x2F;code&gt; of the contract.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;epochLength&lt;&#x2F;code&gt; &lt;strong&gt;MUST&lt;&#x2F;strong&gt; return duration between &lt;code&gt;epoch&lt;&#x2F;code&gt; in blocks or time in seconds.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;epochType&lt;&#x2F;code&gt; &lt;strong&gt;MUST&lt;&#x2F;strong&gt; return the type of epoch used by the contract, which can be either &lt;code&gt;BLOCKS_BASED&lt;&#x2F;code&gt; or &lt;code&gt;TIME_BASED&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;validityDuration&lt;&#x2F;code&gt; &lt;strong&gt;MUST&lt;&#x2F;strong&gt; return the validity duration of tokens in terms of &lt;code&gt;epoch&lt;&#x2F;code&gt; counts.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;isEpochExpired&lt;&#x2F;code&gt; &lt;strong&gt;MUST&lt;&#x2F;strong&gt; return true if the given &lt;code&gt;epoch&lt;&#x2F;code&gt; is expired, otherwise &lt;code&gt;false&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;transfer&lt;&#x2F;code&gt; and &lt;code&gt;transferFrom&lt;&#x2F;code&gt; &lt;strong&gt;MUST&lt;&#x2F;strong&gt; exclusively transfer tokens that remain non-expired at the time of the transaction. Attempting to transfer expired tokens &lt;strong&gt;MUST&lt;&#x2F;strong&gt; revert the transaction or return &lt;code&gt;false&lt;&#x2F;code&gt;. Additionally, implementations &lt;strong&gt;MAY&lt;&#x2F;strong&gt; include logic to prioritize the automatic transfer of tokens closest to expiration, ensuring that the earliest expiring tokens are used first, provided they meet the non-expired condition.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;transferAtEpoch&lt;&#x2F;code&gt; and &lt;code&gt;transferFromAtEpoch&lt;&#x2F;code&gt; &lt;strong&gt;MUST&lt;&#x2F;strong&gt; transfer the specified number of tokens held by an account at the specified epoch to the recipient, If the epoch has expired, the transaction &lt;strong&gt;MUST&lt;&#x2F;strong&gt; &lt;code&gt;revert&lt;&#x2F;code&gt; or return &lt;code&gt;false&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;totalSupply&lt;&#x2F;code&gt; &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; be set to &lt;code&gt;0&lt;&#x2F;code&gt; or &lt;code&gt;type(uint256).max&lt;&#x2F;code&gt; due to the challenges of tracking only valid (non-expired) tokens.&lt;&#x2F;li&gt;
&lt;li&gt;The implementation &lt;strong&gt;MAY&lt;&#x2F;strong&gt; use a standardized custom error, such as &lt;code&gt;ERC7818TransferredExpiredToken&lt;&#x2F;code&gt; or &lt;code&gt;ERC7818TransferredExpiredToken(address sender, uint256 epoch)&lt;&#x2F;code&gt;, to clearly indicate that the operation failed due to attempting to transfer expired tokens.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;additional-potential-useful-function&quot;&gt;Additional Potential Useful Function&lt;&#x2F;h3&gt;
&lt;p&gt;These &lt;strong&gt;OPTIONAL&lt;&#x2F;strong&gt; functions provide additional functionality that might be useful depending on the specific use case.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;getEpochBalance&lt;&#x2F;code&gt; returns the amount of tokens stored in a given &lt;code&gt;epoch&lt;&#x2F;code&gt;, even if the &lt;code&gt;epoch&lt;&#x2F;code&gt; has expired.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;getEpochInfo&lt;&#x2F;code&gt; returns both the start and end of the specified &lt;code&gt;epoch&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;getNearestExpiryOf&lt;&#x2F;code&gt; returns the token amount closest to expiration, along with an estimated expiration block number or timestamp based on &lt;code&gt;epochType&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;getRemainingDurationBeforeEpochChange&lt;&#x2F;code&gt; returns the remaining time or blocks before the &lt;code&gt;epoch&lt;&#x2F;code&gt; change happens, based on the &lt;code&gt;epochType&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Although the term &lt;code&gt;epoch&lt;&#x2F;code&gt; is an abstract concept, it leaves room for various implementations. For example, epochs can support more granular tracking of tokens within each epoch, allowing for greater control over when tokens are valid or expired on-chain. Alternatively, epochs can support bulk expiration, where all tokens within the same epoch expire simultaneously. This flexibility enables different methods of tracking token expiration, depending on the specific needs of the use case.
&lt;code&gt;epoch&lt;&#x2F;code&gt; also introduces a &quot;lazy&quot; way to simplify token expiration tracking in a flexible and gas-efficient manner. Instead of continuously updating the expiration state with &lt;code&gt;write&lt;&#x2F;code&gt; operations by the user or additional services, the current epoch can be calculated using a &lt;code&gt;read&lt;&#x2F;code&gt; operation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is fully &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; compatible.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;For reference implementation can be found &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7818&#x2F;assets&#x2F;README&#x2F;&quot;&gt;here&lt;&#x2F;a&gt;, But in the reference implementation, we employ a sorted list to automatically select the token that nearest expires first with a First-In-First-Out (&lt;code&gt;FIFO&lt;&#x2F;code&gt;) and sliding window algorithm that operates based on the &lt;code&gt;block.number&lt;&#x2F;code&gt; as opposed to relying on &lt;code&gt;block.timestamp&lt;&#x2F;code&gt;, which has been criticized for its lack of security and resilience, particularly given the increasing usage of Layer 2 (L2) networks over Layer 1 (L1) networks. Many L2 networks exhibit centralization and instability, which directly impacts asset integrity, rendering them potentially unusable during periods of network halting, as they are still reliant on the timestamp.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;denial-of-service&quot;&gt;Denial Of Service&lt;&#x2F;h3&gt;
&lt;p&gt;Run out of gas problem due to the operation consuming higher gas if transferring multiple groups of small tokens or loop transfer.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-limit-vulnerabilities&quot;&gt;Gas Limit Vulnerabilities&lt;&#x2F;h3&gt;
&lt;p&gt;Exceeds block gas limit if the blockchain has a block gas limit lower than the gas used in the transaction.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;block-values-as-a-proxy-for-time&quot;&gt;Block values as a proxy for time&lt;&#x2F;h3&gt;
&lt;p&gt;if using &lt;code&gt;block.timestamp&lt;&#x2F;code&gt; for calculating &lt;code&gt;epoch&lt;&#x2F;code&gt; and In rare network halts, block production stops, freezing &lt;code&gt;block.timestamp&lt;&#x2F;code&gt; and disrupting time-based logic. This risks asset integrity and inconsistent states.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;fairness-concerns&quot;&gt;Fairness Concerns&lt;&#x2F;h3&gt;
&lt;p&gt;In a straightforward implementation, where all tokens within the same epoch share the same expiration (e.g., at &lt;code&gt;epoch&lt;&#x2F;code&gt;:&lt;code&gt;x&lt;&#x2F;code&gt;), bulk expiration occurs.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;risks-in-liquidity-pools&quot;&gt;Risks in Liquidity Pools&lt;&#x2F;h3&gt;
&lt;p&gt;When tokens with expiration dates are deposited into liquidity pools (e.g., in DEXs), they may expire while still in the pool.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Set upper bounds for MODEXP</title>
        <published>2024-11-11T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	<author>
		<name>Radoslaw Zagorowicz</name><uri>https://github.com/rodiazet</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7823/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7823-set-upper-bounds-for-modexp/21798" />
        

        <id>https://wg-eips.ritovision.com/7823/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7823"
            label="EIP-7823" />
        

        
        

        
        <summary type="html">Each input field is restricted to a maximum of 8192 bits</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7823/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce an upper bound on the inputs of the MODEXP precompile. This can reduce the number of potential bugs, because the testing surface is not infinite anymore, and makes it easier to be replaced using EVMMAX.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The MODEXP precompile has been a source of numerous consensus bugs. Many of them were due to specifically crafted cases using impractical input lengths.&lt;&#x2F;p&gt;
&lt;p&gt;Its pricing function is also quite complex given its nature of unbounded inputs. While we don&#x27;t suggest to rework the pricing function, it may be possible in a future upgrade once the limits are in place.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore this limitation makes it more feasible to have the precompile replaced with EVM code through features like EVMMAX.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Recap from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;198&#x2F;&quot;&gt;EIP-198&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;At address &lt;code&gt;0x00……05&lt;&#x2F;code&gt;, add a precompile that expects input in the following format:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;&amp;lt;length_of_BASE&amp;gt; &amp;lt;length_of_EXPONENT&amp;gt; &amp;lt;length_of_MODULUS&amp;gt; &amp;lt;BASE&amp;gt; &amp;lt;EXPONENT&amp;gt; &amp;lt;MODULUS&amp;gt;&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;We introduce an upper bound to the inputs of the precompile, each of the length inputs (&lt;code&gt;length_of_BASE&lt;&#x2F;code&gt;, &lt;code&gt;length_of_EXPONENT&lt;&#x2F;code&gt; and &lt;code&gt;length_of_MODULUS&lt;&#x2F;code&gt;) MUST be less than or equal to 8192 bits (1024 bytes).&lt;&#x2F;p&gt;
&lt;p&gt;If any of these inputs are larger than the limit, the precompile execution stops, returns an error, and consumes all gas.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;limit&quot;&gt;Limit&lt;&#x2F;h3&gt;
&lt;p&gt;This upper bound allows the existing use cases of MODEXP:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;RSA verification with up to 8192 bit keys. Commonly used ones are 1024&#x2F;2048&#x2F;4096 bits.&lt;&#x2F;li&gt;
&lt;li&gt;Elliptic curve related use cases are usually less than 384 bits.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;evmmax&quot;&gt;EVMMAX&lt;&#x2F;h3&gt;
&lt;p&gt;Replacing the precompile with EVM code using an instruction set like EVMMAX would be made simpler with this limit: Common cases (256, 381, 1024, 2048) could be implemented in special fast paths, while a slow fallback could be provided for the rest. Or even special, frequently used, moduli could have their own paths.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore one could consider limiting the lengths to certain inputs only.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;analysis&quot;&gt;Analysis&lt;&#x2F;h3&gt;
&lt;p&gt;Since MODEXP was introduced in the Byzantium hard fork, an analysis has been conducted between block 5472266 (April 20, 2018) and block 21550926 (January 4th, 2025). All lengths of inputs are expressed in bytes.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;base-length-occurrences&quot;&gt;Base length occurrences&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;code&gt;input_of_BASE&lt;&#x2F;code&gt;&lt;&#x2F;th&gt;&lt;th&gt;count&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;td&gt;2439595&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;128&lt;&#x2F;td&gt;&lt;td&gt;4167&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;256&lt;&#x2F;td&gt;&lt;td&gt;2969&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;160&lt;&#x2F;td&gt;&lt;td&gt;436&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;512&lt;&#x2F;td&gt;&lt;td&gt;36&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;13&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;64&lt;&#x2F;td&gt;&lt;td&gt;7&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;78&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;513&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;129&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;385&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;exponent-length-occurrences&quot;&gt;Exponent length occurrences&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;code&gt;input_of_EXPONENT&lt;&#x2F;code&gt;&lt;&#x2F;th&gt;&lt;th&gt;count&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;td&gt;2442255&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;4771&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;159&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;128&lt;&#x2F;td&gt;&lt;td&gt;29&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;13&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;modulo-length-occurrences&quot;&gt;Modulo length occurrences&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;code&gt;input_of_MODULUS&lt;&#x2F;code&gt;&lt;&#x2F;th&gt;&lt;th&gt;count&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;td&gt;2439594&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;128&lt;&#x2F;td&gt;&lt;td&gt;4167&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;256&lt;&#x2F;td&gt;&lt;td&gt;2968&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;160&lt;&#x2F;td&gt;&lt;td&gt;436&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;512&lt;&#x2F;td&gt;&lt;td&gt;38&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;13&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;64&lt;&#x2F;td&gt;&lt;td&gt;8&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;78&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;129&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;384&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;257&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;This shows that no past successful use case exceeded an input length of 513 bytes, and the majority uses 32&#x2F;128&#x2F;256 byte inputs.&lt;&#x2F;p&gt;
&lt;p&gt;Besides these, there were a few invocations with invalid inputs:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Empty inputs&lt;&#x2F;li&gt;
&lt;li&gt;Inputs consisting of only &lt;code&gt;0x9e5faafc&lt;&#x2F;code&gt; or &lt;code&gt;0x85474728&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;A large, but invalid input: &lt;code&gt;0x9e281a98000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000021e19e0c9bab2400000&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This is a backwards incompatible change. However, based on analysis until block 21550926 (see above), no past transaction would have behaved differently after this change.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Since only the accepted input range is reduced, no new security surface area is expected.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>ZK Identity Registry</title>
        <published>2024-11-08T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Artem Chystiakov</name><uri>https://github.com/arvolear</uri><email>artem@rarilabs.com</email>
	</author>
	
	<author>
		<name>Oleksandr Kurbatov</name><email>oleksandr@rarilabs.com</email>
	</author>
	
	<author>
		<name>Yaroslav Panasenko</name><email>yaroslav@rarilabs.com</email>
	</author>
	
	<author>
		<name>Michael Elliot</name><uri>https://github.com/michaelelliot</uri><email>mike@zkpassport.id</email>
	</author>
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7812/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7812-zk-identity-registry/21624" />
        

        <id>https://wg-eips.ritovision.com/7812/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        

        
        <category
            term="tag:eip:7812"
            label="ERC-7812" />
        

        
        

        
        <summary type="html">Singleton registry system for storing abstract private provable statements.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7812/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces an on-chain registry system for storing and proving abstract statements. Users may utilize the system to store commitments to their private data to later prove its validity and authenticity via zero knowledge, without disclosing anything about the data itself. Moreover, developers may use the singleton &lt;code&gt;EvidenceRegistry&lt;&#x2F;code&gt; contract available at &lt;code&gt;0x781246D2256dc0C1d8357c9dDc1eEe926a9c7812&lt;&#x2F;code&gt; to integrate custom business-specific registrars for managing and processing particular statements.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP stemmed from the need to localize and unravel the storage and issuance of provable statements so that future protocols can anchor to the standardized singleton on-chain registry and benefit from cross-reuse.&lt;&#x2F;p&gt;
&lt;p&gt;The aggregation of provable statements significantly improves reusability, portability, and security of the abundance of zero knowledge privacy-oriented solutions. The abstract specification of the registry allows custom indentity-based, reputation-based, proof-of-attendance-based, etc., protocols to be implemented with little to minimal constraints.&lt;&#x2F;p&gt;
&lt;p&gt;The given proposal lays the important foundation for specific solution to build upon. The more concrete specifications of statements and commitments structures are expected to emerge as separate, standalone EIPs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;A &quot;Sparse Merkle Tree (SMT)&quot; is a special Merkle tree that works by deterministically and idempotently storing key&#x2F;value pairs in the given locations leveraging a hash function. The Poseidon hash function is often used to optimize the compatibility with ZK.&lt;&#x2F;li&gt;
&lt;li&gt;A &quot;statement&quot; is an accepted structured representation of some abstract evidence. A statement can range from a simple &lt;code&gt;string&lt;&#x2F;code&gt; to a Merkle root of some SMT.&lt;&#x2F;li&gt;
&lt;li&gt;A &quot;commitment&quot; is a special public value resulting from blinding a statement to conceal it. Commitments allow the authenticity of a statement to be proven in ZK without disclosing the statement itself.&lt;&#x2F;li&gt;
&lt;li&gt;A &quot;commitment key&quot; is a private salt mixed with the statement to obtain a commitment to that statement. The commitment key must be kept private to maintain the confidentiality of statements.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;general&quot;&gt;General&lt;&#x2F;h3&gt;
&lt;p&gt;The on-chain registry system consists of two subsystems: the &lt;code&gt;EvidenceRegistry&lt;&#x2F;code&gt; with &lt;code&gt;EvidenceDB&lt;&#x2F;code&gt; and &lt;code&gt;Registrar&lt;&#x2F;code&gt; components. This EIP will focus on describing and standardizing the former, while the &lt;code&gt;Registrar&lt;&#x2F;code&gt; specification may be amended as the separate proposals.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7812&#x2F;.&#x2F;assets&#x2F;images&#x2F;diagram.png&quot; alt=&quot;The on-chain evidence registry system entities diagram.&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The on-chain evidence registry system entities diagram.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;EvidenceRegistry&lt;&#x2F;code&gt; acts as the entrypoint to a protocol-wide provable database &lt;code&gt;EvidenceDB&lt;&#x2F;code&gt; where arbitrary &lt;code&gt;32-byte&lt;&#x2F;code&gt; data can be written to and later proven on demand. The &lt;code&gt;Registrar&lt;&#x2F;code&gt; entities implement specific business use cases, structure the provable data, and utilize &lt;code&gt;EvidenceRegistry&lt;&#x2F;code&gt; to put this data in the &lt;code&gt;EvidenceDB&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;In order to prove that certain data is or is not present in the &lt;code&gt;EvidenceDB&lt;&#x2F;code&gt; Merkle proofs may be used. Understanding how a specific &lt;code&gt;Registrar&lt;&#x2F;code&gt; has structured and put data into the &lt;code&gt;EvidenceDB&lt;&#x2F;code&gt;, one may implement an on-chain ZK verifier (using Circom or any other stack) and prove the inclusion (or exclusion) of the data in the database.&lt;&#x2F;p&gt;
&lt;p&gt;The Circom implementation of a general-purpose SMT-driven &lt;code&gt;EvidenceDB&lt;&#x2F;code&gt; verifier circuit together with the Solidity implementation of &lt;code&gt;EvidenceRegistry&lt;&#x2F;code&gt; and &lt;code&gt;EvidenceDB&lt;&#x2F;code&gt; smart contracts may be found in the &quot;Reference Implementation&quot; section.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;evidence-db&quot;&gt;Evidence DB&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;EvidenceDB&lt;&#x2F;code&gt; smart contract MAY implement an arbitrary provable key&#x2F;value data structure, however it MUST support the &lt;code&gt;addition&lt;&#x2F;code&gt;, &lt;code&gt;update&lt;&#x2F;code&gt;, and &lt;code&gt;removal&lt;&#x2F;code&gt; of elements. All of the supported write operations MUST maintain the property of idempotence (e.i. &lt;code&gt;addition&lt;&#x2F;code&gt; followed by &lt;code&gt;removal&lt;&#x2F;code&gt; should not change the state of the database). The data structure of choice MUST be capable of providing both element inclusion and exclusion proofs. The functions that modify the &lt;code&gt;EvidenceDB&lt;&#x2F;code&gt; state MUST be callable only by the &lt;code&gt;EvidenceRegistry&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;For reference, the &lt;code&gt;EvidenceDB&lt;&#x2F;code&gt; smart contract MAY implement the following interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Evidence DB interface for Sparse Merkle Tree based statements database.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IEvidenceDB&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Represents the proof of a node&amp;#39;s inclusion&#x2F;exclusion in the tree.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; root&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The root hash of the Merkle tree.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; siblings&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of sibling hashes can be used to get the Merkle Root.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; existence&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Indicates the presence (true) or absence (false) of the node.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The key associated with the node.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The value associated with the node.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auxExistence&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Indicates the presence (true) or absence (false) of an auxiliary node.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auxKey&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The key of the auxiliary node.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auxValue&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The value of the auxiliary node.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Proof&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; root&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; siblings&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span&gt; existence&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span&gt; auxExistence&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; auxKey&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; auxValue&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Adds the new element to the tree.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Removes the element from the tree.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; remove&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Updates the element in the tree.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; update&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newValue&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Gets the SMT root.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * SHOULD NOT be used on-chain due to roots frontrunning.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getRoot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Gets the number of nodes in the tree.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getSize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Gets the max tree height (number of branches in the Merkle proof)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getMaxHeight&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Gets Merkle inclusion&#x2F;exclusion proof of the element.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getProof&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Proof&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Gets the element value by its key.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getValue&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;evidence-registry&quot;&gt;Evidence Registry&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;EvidenceRegistry&lt;&#x2F;code&gt; smart contract is the central piece of this EIP. The &lt;code&gt;EvidenceRegistry&lt;&#x2F;code&gt; MUST implement the following interface, however, it MAY be extended:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Common Evidence Registry interface.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IEvidenceRegistry&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST be emitted whenever the Merkle root is updated.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RootUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; prev&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; curr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Adds the new statement to the DB.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addStatement&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Removes the statement from the DB.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; removeStatement&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Updates the statement in the DB.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; updateStatement&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newValue&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieves historical DB roots creation timestamps.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Latest root MUST return `block.timestamp`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Non-existent root MUST return `0`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getRootTimestamp&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; root&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Builds and returns the isolated key for `source` and given `key`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getIsolatedKey&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; source&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;addStatement&lt;&#x2F;code&gt;, &lt;code&gt;removeStatement&lt;&#x2F;code&gt;, and &lt;code&gt;updateStatement&lt;&#x2F;code&gt; methods MUST isolate the statement &lt;code&gt;key&lt;&#x2F;code&gt; in order for the database to allocate a specific namespace for a caller. These methods MUST revert in case the isolated key being added already exists in the &lt;code&gt;EvidenceDB&lt;&#x2F;code&gt; or the isolated key being removed or updated does not.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;EvidenceRegistry&lt;&#x2F;code&gt; MUST maintain the linear history of &lt;code&gt;EvidenceDB&lt;&#x2F;code&gt; roots. The &lt;code&gt;getRootTimestamp&lt;&#x2F;code&gt; method MUST NOT revert. Instead, it MUST return &lt;code&gt;0&lt;&#x2F;code&gt; in case the queried &lt;code&gt;root&lt;&#x2F;code&gt; does not exist. The method MUST return &lt;code&gt;block.timestamp&lt;&#x2F;code&gt; in case the latest root is requested.&lt;&#x2F;p&gt;
&lt;p&gt;Before communicating with the &lt;code&gt;EvidenceDB&lt;&#x2F;code&gt;, the &lt;code&gt;key&lt;&#x2F;code&gt; MUST be isolated in the following way:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt; isolatedKey &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Where the &lt;code&gt;hash&lt;&#x2F;code&gt; is secure protocol-wide hash function of choice.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;hash-function&quot;&gt;Hash Function&lt;&#x2F;h3&gt;
&lt;p&gt;The same secure hash function MUST be employed in both &lt;code&gt;EvidenceRegistry&lt;&#x2F;code&gt; and &lt;code&gt;EvidenceDB&lt;&#x2F;code&gt;. It is RECOMMENDED to use ZK-friendly hash function such as &lt;code&gt;poseidon&lt;&#x2F;code&gt; to streamline the database proving.&lt;&#x2F;p&gt;
&lt;p&gt;In case ZK-friendly hash function is chosen, &lt;code&gt;EvidenceRegistry&lt;&#x2F;code&gt; MUST NOT accept &lt;code&gt;keys&lt;&#x2F;code&gt; or &lt;code&gt;values&lt;&#x2F;code&gt; beyond the underlying elliptic curve prime field size (&lt;code&gt;21888242871839275222246405745257275088548364400416034343698204186575808495617&lt;&#x2F;code&gt; for &lt;code&gt;BN128&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;During the EIP specification we have considered two approaches: where every protocol has its own registry and where all protocols are united under a singleton registry. We have decided to go with the latter as this approach provides the following benefits:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Cross-chain portability. Only a single &lt;code&gt;bytes32&lt;&#x2F;code&gt; value (the SMT root) has to be sent cross-chain to be able to prove the state of the registry.&lt;&#x2F;li&gt;
&lt;li&gt;Centralization of trust. Users only need to trust a single, permissionaless, immutable smart contract.&lt;&#x2F;li&gt;
&lt;li&gt;Integration streamline. The singleton design formalizes the system interface, the hash function, and the overall proofs structure to simplify the integration.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The proposal is deliberately written as abstract as possible to not constrain the possible business use cases and allow &lt;code&gt;Registrars&lt;&#x2F;code&gt; to implement arbitrary provable solutions.&lt;&#x2F;p&gt;
&lt;p&gt;It is expected that based on this work future EIPs will describe concrete registrars with the exact procedures of generation of commitments, management of commitment keys, and proving of operated statements. For instance, there may be a registrar for on-chain accounting of national passports, a registrar with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;EIP-4337&lt;&#x2F;a&gt; confidential account identity management, a registrar for POAPs, etc.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;EvidenceDB&lt;&#x2F;code&gt; namespacing is chosen to segregate the write access to the database cells, ensuring that no entity but issuer can alter their content. However, this decision delegates the access control management responsibility solely to registrars, an important aspect to be considered during their development.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;EvidenceRegistry&lt;&#x2F;code&gt; maintains the minimal viable (gas-wise) history of roots on-chain for smooth registrars integration. In case more elaborate history is required, it is RECOMMENDED to implement off-chain services for parsing of &lt;code&gt;RootUpdated&lt;&#x2F;code&gt; events.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is fully backwards compatible.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;deployment-method&quot;&gt;Deployment Method&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;EvidenceRegistry&lt;&#x2F;code&gt; is a singleton contract available at &lt;code&gt;0x781246D2256dc0C1d8357c9dDc1eEe926a9c7812&lt;&#x2F;code&gt; deployed via the &quot;deterministic deployment proxy&quot; from &lt;code&gt;0x4e59b44847b379578588920ca78fbf26c0b4956c&lt;&#x2F;code&gt; with the salt &lt;code&gt;0x04834e077c463de76a20df3770a7b96a5e5eb826922d1514f943cd5b41ccaed0&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The reference implementation of &lt;code&gt;EvidenceRegistry&lt;&#x2F;code&gt; and &lt;code&gt;EvidenceDB&lt;&#x2F;code&gt; Solidity smart contracts together with the evidence registry state verifier Circom circuit is provided in the proposal.&lt;&#x2F;p&gt;
&lt;p&gt;The low-level Solidity and Circom implementations of SMT can be found &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7812&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;SparseMerkleTree.sol&quot;&gt;here&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7812&#x2F;.&#x2F;assets&#x2F;circuits&#x2F;SparseMerkleTree.circom&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The height of the SMT is set to &lt;code&gt;80&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Please note that the reference implementation depends on the &lt;code&gt;@openzeppelin&#x2F;contracts v5.1.0&lt;&#x2F;code&gt; and &lt;code&gt;circomlib v2.0.5&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h3 id=&quot;evidencedb-implementation&quot;&gt;EvidenceDB Implementation&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.21&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Initializable&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;proxy&#x2F;utils&#x2F;Initializable.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IEvidenceDB&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;interfaces&#x2F;IEvidenceDB.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;SparseMerkleTree&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;libraries&#x2F;SparseMerkleTree.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;PoseidonUnit2L&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;PoseidonUnit3L&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;libraries&#x2F;Poseidon.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EvidenceDB&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IEvidenceDB&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Initializable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    using&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SparseMerkleTree&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SparseMerkleTree&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;SMT&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _evidenceRegistry&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    SparseMerkleTree&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;SMT &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;private&lt;&#x2F;span&gt;&lt;span&gt; _tree&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    modifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyEvidenceRegistry&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _requireEvidenceRegistry&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        _&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; __EvidenceDB_init&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; evidenceRegistry_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; maxDepth_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; initializer&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _evidenceRegistry &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; evidenceRegistry_&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _tree&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;initialize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;maxDepth_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _tree&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;setHashers&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_hash2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _hash3&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@inheritdoc&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; IEvidenceDB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyEvidenceRegistry&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _tree&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;key_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; value_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@inheritdoc&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; IEvidenceDB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; remove&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyEvidenceRegistry&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _tree&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;remove&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;key_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@inheritdoc&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; IEvidenceDB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; update&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newValue_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyEvidenceRegistry&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _tree&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;update&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;key_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; newValue_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@inheritdoc&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; IEvidenceDB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getRoot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _tree&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getRoot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@inheritdoc&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; IEvidenceDB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getSize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _tree&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getNodesCount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@inheritdoc&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; IEvidenceDB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getMaxHeight&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _tree&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getMaxDepth&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@inheritdoc&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; IEvidenceDB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getProof&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Proof&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _tree&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getProof&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;key_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@inheritdoc&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; IEvidenceDB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getValue&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _tree&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getNodeByKey&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;key_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the address of the Evidence Registry.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getEvidenceRegistry&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _evidenceRegistry&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _requireEvidenceRegistry&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;_evidenceRegistry &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NotFromEvidenceRegistry&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _hash2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; element1_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; element2_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; PoseidonUnit2L&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;poseidon&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;element1_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; element2_&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _hash3&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; element1_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; element2_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; element3_&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; PoseidonUnit3L&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;poseidon&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;element1_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; element2_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; element3_&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;evidenceregistry-implementation&quot;&gt;EvidenceRegistry Implementation&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.21&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Initializable&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;proxy&#x2F;utils&#x2F;Initializable.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IEvidenceDB&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;interfaces&#x2F;IEvidenceDB.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IEvidenceRegistry&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;interfaces&#x2F;IEvidenceRegistry.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;PoseidonUnit2L&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;libraries&#x2F;Poseidon.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EvidenceRegistry&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IEvidenceRegistry&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Initializable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; BABY_JUB_JUB_PRIME_FIELD &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        21888242871839275222246405745257275088548364400416034343698204186575808495617&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    IEvidenceDB &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;private&lt;&#x2F;span&gt;&lt;span&gt; _evidenceDB&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _rootTimestamps&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    modifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyInPrimeField&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _requireInPrimeField&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        _&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    modifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onRootUpdate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; prevRoot_ &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _evidenceDB&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getRoot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _rootTimestamps&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;prevRoot_&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        _&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RootUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;prevRoot_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _evidenceDB&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getRoot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; __EvidenceRegistry_init&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; evidenceDB_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; initializer&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _evidenceDB &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IEvidenceDB&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evidenceDB_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@inheritdoc&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; IEvidenceRegistry&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addStatement&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value_&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyInPrimeField&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;key_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyInPrimeField&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;value_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onRootUpdate&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; isolatedKey_ &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getIsolatedKey&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; key_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;_evidenceDB&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getValue&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;isolatedKey_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; KeyAlreadyExists&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;key_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _evidenceDB&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;isolatedKey_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; value_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@inheritdoc&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; IEvidenceRegistry&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; removeStatement&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyInPrimeField&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;key_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onRootUpdate&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; isolatedKey_ &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getIsolatedKey&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; key_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;_evidenceDB&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getValue&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;isolatedKey_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; KeyDoesNotExist&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;key_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _evidenceDB&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;remove&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;isolatedKey_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@inheritdoc&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; IEvidenceRegistry&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; updateStatement&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newValue_&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyInPrimeField&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;key_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyInPrimeField&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;newValue_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onRootUpdate&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; isolatedKey_ &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getIsolatedKey&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; key_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;_evidenceDB&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getValue&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;isolatedKey_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; KeyDoesNotExist&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;key_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _evidenceDB&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;update&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;isolatedKey_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; newValue_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@inheritdoc&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; IEvidenceRegistry&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getRootTimestamp&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; root_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;root_ &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;root_ &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; _evidenceDB&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getRoot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _rootTimestamps&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;root_&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@inheritdoc&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; IEvidenceRegistry&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getIsolatedKey&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; source_&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; PoseidonUnit2L&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;poseidon&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint160&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;source_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; key_&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getEvidenceDB&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_evidenceDB&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _requireInPrimeField&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;key_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; BABY_JUB_JUB_PRIME_FIELD&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NumberNotInPrimeField&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;key_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;evidenceregistry-verifier-implementation&quot;&gt;EvidenceRegistry Verifier Implementation&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; LICENSE: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; circom&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2.1.9&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;include &lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;SparseMerkleTree.circom&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;template &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;BuildIsolatedKey&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signal output isolatedKey&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signal input &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signal input key&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    component hasher &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Poseidon&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    hasher&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;inputs&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    hasher&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;inputs&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    hasher&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;out &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; isolatedKey&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;template &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;EvidenceRegistrySMT&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;levels&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Public Inputs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signal input root&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Private Inputs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signal input &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signal input key&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signal input value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signal input siblings&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;levels&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signal input auxKey&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signal input auxValue&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signal input auxIsEmpty&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signal input isExclusion&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Build isolated key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    component isolatedKey &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BuildIsolatedKey&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    isolatedKey&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    isolatedKey&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;key &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify Sparse Merkle Tree Proof&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    component smtVerifier &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SparseMerkleTree&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;levels&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    smtVerifier&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;siblings &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; siblings&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    smtVerifier&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;key &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; isolatedKey&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;isolatedKey&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    smtVerifier&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;value &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    smtVerifier&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;auxKey &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; auxKey&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    smtVerifier&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;auxValue &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; auxValue&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    smtVerifier&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;auxIsEmpty &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; auxIsEmpty&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    smtVerifier&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;isExclusion &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; isExclusion&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    smtVerifier&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;root &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; root&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;component main &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;public&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;root&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EvidenceRegistrySMT&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;80&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;From security standpoint there are several important aspects that must be highlighted.&lt;&#x2F;p&gt;
&lt;p&gt;The individual registrars are expected to provide the functionality for both management and proving of statements. The proving will often be carried out by ZK proofs, which require trusted setup. Improperly setup ZK verifiers can be exploited to verify forged proofs.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;getRoot&lt;&#x2F;code&gt; method of &lt;code&gt;EvidenceDB&lt;&#x2F;code&gt; SHOULD NOT be used on-chain by the integrating registrars to check the validity of the database state. Instead, the required &lt;code&gt;root&lt;&#x2F;code&gt; SHOULD be passed as a function parameter and checked via &lt;code&gt;getRootTimestamp&lt;&#x2F;code&gt; method to avoid being frontrun.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Store, Table-Based Introspectable Storage</title>
        <published>2024-11-08T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>alvarius</name><uri>https://github.com/alvrs</uri>
	</author>
	
	<author>
		<name>dk1a</name><uri>https://github.com/dk1a</uri>
	</author>
	
	<author>
		<name>frolic</name><uri>https://github.com/frolic</uri>
	</author>
	
	<author>
		<name>ludens</name><uri>https://github.com/ludns</uri>
	</author>
	
	<author>
		<name>vdrg</name><uri>https://github.com/vdrg</uri>
	</author>
	
	<author>
		<name>yonada</name><email>yonada@proton.me</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7813/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7813-store-table-based-introspectable-storage/21628" />
        

        <id>https://wg-eips.ritovision.com/7813/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        

        
        <category
            term="tag:eip:7813"
            label="ERC-7813" />
        

        
        

        
        <summary type="html">On-chain tables for automatic indexing and introspectable state</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7813/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard introduces a flexible on-chain storage pattern that organizes data into structured tables that consist of records with fixed key and value schemas, similar to a traditional database. This storage pattern consists of a unified contract interface for data access, along with a compact binary encoding format for both static and dynamic data types. State changes are tracked through standardized events that enable automatic, schema-aware state replication by off-chain indexers. New tables can be dynamically registered at runtime through a special table that stores schema metadata for all tables, allowing the system to evolve without breaking existing contracts or integrations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The absence of consistent standards for on-chain data management in smart contracts can lead to rigid implementations, tightly coupled contract logic with off-chain services, and challenges in updating or extending a contract’s data layout without breaking existing integrations.&lt;&#x2F;p&gt;
&lt;p&gt;Using the storage mechanism defined in this ERC provides the following benefits:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Automatic Indexing&lt;&#x2F;strong&gt;: By emitting consistent, standardized events during state changes, off-chain services can automatically track on-chain state and provide schema-aware indexer APIs.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Elimination of Custom Getter Functions&lt;&#x2F;strong&gt;: Any contract or off-chain service can read stored data through a consistent interface, decoupling smart contract implementation from specific data access patterns and reducing development overhead.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Simpler Upgradability&lt;&#x2F;strong&gt;: This pattern leverages unstructured storage, making it easier to upgrade contract logic without the risks associated with using a fixed storage layout.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Flexible Data Extensions&lt;&#x2F;strong&gt;: New tables can be added at runtime without without breaking existing integrations with other data consumers.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Reduced gas costs&lt;&#x2F;strong&gt;: Using efficient data packing reduces gas costs for both storage and event emissions.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;store&quot;&gt;Store&lt;&#x2F;h4&gt;
&lt;p&gt;A smart contract that implements the interface proposed by this ERC and organizes data in Tables. It emits events for each data operation so that off-chain components can replicate the state of all tables.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;table&quot;&gt;Table&lt;&#x2F;h4&gt;
&lt;p&gt;A storage structure that holds &lt;strong&gt;Records&lt;&#x2F;strong&gt; sharing the same &lt;strong&gt;Schema&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;On-chain Table&lt;&#x2F;strong&gt;: Stores its state on-chain and emits events for off-chain- indexers.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Off-chain Table&lt;&#x2F;strong&gt;: Does not store state on-chain but emits events for off-chain indexers.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;record&quot;&gt;Record&lt;&#x2F;h4&gt;
&lt;p&gt;A piece of data stored in a &lt;strong&gt;Table&lt;&#x2F;strong&gt;, addressed by one or more keys.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;resourceid&quot;&gt;&lt;code&gt;ResourceId&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;A 32-byte value that uniquely identifies each &lt;strong&gt;Table&lt;&#x2F;strong&gt; within the &lt;strong&gt;Store&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ResourceId&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Encoding:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;strong&gt;Bytes (from left to right)&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;strong&gt;Description&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;0-1&lt;&#x2F;td&gt;&lt;td&gt;Table type identifier&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;2-31&lt;&#x2F;td&gt;&lt;td&gt;Unique identifier&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;&lt;strong&gt;Table Type Identifiers:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;0x7462&lt;&#x2F;code&gt; (&lt;code&gt;&quot;tb&quot;&lt;&#x2F;code&gt;) for on-chain tables&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;0x6f74&lt;&#x2F;code&gt; (&lt;code&gt;&quot;ot&quot;&lt;&#x2F;code&gt;) for off-chain tables&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;schema&quot;&gt;&lt;code&gt;Schema&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Used to represent the layout of Records within a table.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Schema&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Each Table defines two schemas:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Key Schema: the types of the keys used to uniquely identify a &lt;strong&gt;Record&lt;&#x2F;strong&gt; within a table. It consists only of fixed-length data types.&lt;&#x2F;li&gt;
&lt;li&gt;Value Schema: the types of the value fields of a &lt;strong&gt;Record&lt;&#x2F;strong&gt; within a table, which can include both fixed-length and variable-length data types.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;strong&gt;Byte(s) from left to right&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;strong&gt;Value&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;strong&gt;Constraint&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;0-1&lt;&#x2F;td&gt;&lt;td&gt;Total byte length of static fields&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;Number of static length fields&lt;&#x2F;td&gt;&lt;td&gt;≤ (28 - number of dynamic length fields)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;Number of dynamic length fields&lt;&#x2F;td&gt;&lt;td&gt;For the key schema, 0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;For the value schema, ≤5&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;4-31&lt;&#x2F;td&gt;&lt;td&gt;Each byte encodes a &lt;code&gt;SchemaType&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Dynamic-length types MUST come after all the static-length types.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;schematype&quot;&gt;&lt;code&gt;SchemaType&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Single byte that represents the type of a specific static or dynamic field.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SchemaType&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt; .&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Type Encoding:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Value Range&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x00&lt;&#x2F;code&gt; to &lt;code&gt;0x1F&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint8&lt;&#x2F;code&gt; to &lt;code&gt;uint256&lt;&#x2F;code&gt; (increments of 8 bits)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x20&lt;&#x2F;code&gt; to &lt;code&gt;0x3F&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;int8&lt;&#x2F;code&gt; to &lt;code&gt;int256&lt;&#x2F;code&gt; (increments of 8 bits)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x40&lt;&#x2F;code&gt; to &lt;code&gt;0x5F&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;bytes1&lt;&#x2F;code&gt; to &lt;code&gt;bytes32&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;bool&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x61&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;address&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x62&lt;&#x2F;code&gt; to &lt;code&gt;0x81&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint8[]&lt;&#x2F;code&gt; to &lt;code&gt;uint256[]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x82&lt;&#x2F;code&gt; to &lt;code&gt;0xA1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;int8[]&lt;&#x2F;code&gt; to &lt;code&gt;int256[]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xA2&lt;&#x2F;code&gt; to &lt;code&gt;0xC1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;bytes1[]&lt;&#x2F;code&gt; to &lt;code&gt;bytes32[]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xC2&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;bool[]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xC3&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;address[]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xC4&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;bytes&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xC5&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;string&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;fieldlayout&quot;&gt;&lt;code&gt;FieldLayout&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Encodes the concrete value &lt;code&gt;Schema&lt;&#x2F;code&gt; information, specifically the total byte length of the static fields, the number of dynamic fields and the length of each static field on its own.&lt;&#x2F;p&gt;
&lt;p&gt;This encoding serves as an optimization for on-chain operations. By having the exact lengths readily available, the Store doesn&#x27;t need to repeatedly compute or translate the schema definitions into actual field lengths during execution.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FieldLayout&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;strong&gt;Byte(s) from left to right&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;strong&gt;Value&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;strong&gt;Constraint&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;0-1&lt;&#x2F;td&gt;&lt;td&gt;Total length of static fields&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;Number of static length fields&lt;&#x2F;td&gt;&lt;td&gt;≤ (28 - number of dynamic length fields)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;Number of dynamic length fields&lt;&#x2F;td&gt;&lt;td&gt;For the key schema, 0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;For the value schema, ≤5&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;4-31&lt;&#x2F;td&gt;&lt;td&gt;Each byte encodes the byte length of the corresponding static field&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;encodedlengths&quot;&gt;&lt;code&gt;EncodedLengths&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Encodes the byte length of all the dynamic fields of a specific Record. It is returned by the Store methods when reading a Record, as it is needed for decoding dynamic fields.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EncodedLengths&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Bytes (from least to most significant)&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;0x00-0x06&lt;&#x2F;td&gt;&lt;td&gt;uint56&lt;&#x2F;td&gt;&lt;td&gt;Total byte length of dynamic data&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x07-0xB&lt;&#x2F;td&gt;&lt;td&gt;uint40&lt;&#x2F;td&gt;&lt;td&gt;Length of the first dynamic field&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x0C-0x10&lt;&#x2F;td&gt;&lt;td&gt;uint40&lt;&#x2F;td&gt;&lt;td&gt;Length of the second dynamic field&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x11-0x15&lt;&#x2F;td&gt;&lt;td&gt;uint40&lt;&#x2F;td&gt;&lt;td&gt;Length of the third dynamic field&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x16-0x1A&lt;&#x2F;td&gt;&lt;td&gt;uint40&lt;&#x2F;td&gt;&lt;td&gt;Length of the fourth dynamic field&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x1B-0x1F&lt;&#x2F;td&gt;&lt;td&gt;uint40&lt;&#x2F;td&gt;&lt;td&gt;Length of the fifth dynamic field&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;packed-data-encoding&quot;&gt;Packed Data Encoding&lt;&#x2F;h3&gt;
&lt;p&gt;Record data returned by Store methods and included in Store events uses the following encoding rules.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;field-limits&quot;&gt;Field Limits&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Maximum Total Fields&lt;&#x2F;strong&gt;: A record can contain up to &lt;strong&gt;28 fields&lt;&#x2F;strong&gt; in total (both static and dynamic fields combined).
&lt;ul&gt;
&lt;li&gt;This limit is due to the &lt;code&gt;Schema&lt;&#x2F;code&gt; type structure, which uses 28 bytes (bytes 4 to 31) to define field types, with one byte per field (&lt;code&gt;SchemaType&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Dynamic Fields Limit&lt;&#x2F;strong&gt;: A record can have up to &lt;strong&gt;5 dynamic fields&lt;&#x2F;strong&gt;.
&lt;ul&gt;
&lt;li&gt;This is due to the fact that a single 32 bytes word (&lt;code&gt;EncodedLengths&lt;&#x2F;code&gt;) to encode the byte lengths of each dynamic field, instead of encoding each length separately as Solidity’s &lt;code&gt;abi.encode&lt;&#x2F;code&gt; would.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Static Fields Limit&lt;&#x2F;strong&gt;: The maximum number of static fields is &lt;strong&gt;28 minus the number of dynamic fields&lt;&#x2F;strong&gt;.
&lt;ul&gt;
&lt;li&gt;For example, if there are 5 dynamic fields, the maximum number of static fields is 23 (28 - 5).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;encoding-rules&quot;&gt;Encoding Rules&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Static-length fields are encoded without any padding, and concatenated in the order they are defined in the schema, which is equivalent to using Solidity&#x27;s &lt;code&gt;abi.encodePacked&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;For dynamic-length fields (arrays, &lt;code&gt;bytes&lt;&#x2F;code&gt;, and &lt;code&gt;string&lt;&#x2F;code&gt;s):
&lt;ul&gt;
&lt;li&gt;If the field is an array, its elements are tightly packed without padding.&lt;&#x2F;li&gt;
&lt;li&gt;All dynamic fields are concatenated together without padding and without including their lengths.&lt;&#x2F;li&gt;
&lt;li&gt;The lengths of all dynamic fields are encoded into a single &lt;code&gt;EncodedLengths&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;example&quot;&gt;Example&lt;&#x2F;h4&gt;
&lt;p&gt;Suppose a table has the following value schema:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt; description&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint8&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; scores&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Encoding (Pseudocode)&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; staticData &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This is a custom function as Solidity does not provide a way to tightly pack array elements&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; packedScores &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; packElementsWithoutPadding&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;scores&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; abi.encodePacked concatenates both description and packedScores without including their lengths&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; dynamicData &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;description&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; packedScores&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Total length is encoded in the 56 least significant bits&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;EncodedLengths encodedLengths &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; dynamicData&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Each length is encoded using 5 bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;encodedLengths &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;description&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;56&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;encodedLengths &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;encodedData&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;56&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 5&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The full encoded record data is represented by the following tuple:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; (staticData, encodedLengths, dynamicData)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;store-interface&quot;&gt;Store Interface&lt;&#x2F;h3&gt;
&lt;p&gt;All Stores MUST implement the following interface.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IStore&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * Get full encoded record (all fields, static and dynamic data) for the given tableId and key tuple.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getRecord&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    ResourceId&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tableId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; keyTuple&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; staticData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; EncodedLengths&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; encodedLengths&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; dynamicData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * Get a single encoded field from the given tableId and key tuple.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getField&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    ResourceId&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tableId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; keyTuple&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; fieldIndex&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * Get the byte length of a single field from the given tableId and key tuple&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getFieldLength&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    ResourceId&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tableId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; keyTuple&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; fieldIndex&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The return values of both &lt;code&gt;getRecord&lt;&#x2F;code&gt; and &lt;code&gt;getField&lt;&#x2F;code&gt; use the encoding rules previously defined in the Packed Data Encoding section. More specifically, &lt;code&gt;getRecord&lt;&#x2F;code&gt; returns the fully encoded record tuple, and the data returned by &lt;code&gt;getField&lt;&#x2F;code&gt; is encoded using the encoding rules as if the field was being encoded on its own.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;store-operations-and-events&quot;&gt;Store Operations and Events&lt;&#x2F;h3&gt;
&lt;p&gt;This standard defines three core operations for manipulating records in a table: setting, updating, and deleting. For each operation, specific events must be emitted. The implementation details of these operations are left to the discretion of each Store implementation.&lt;&#x2F;p&gt;
&lt;p&gt;The fundamental requirement is that for on-chain tables the Record data retrieved through the Store interface methods at any given block MUST be consistent with the Record data that would be obtained by applying the operations implied by the Store events up to that block. This ensures data integrity and allows for accurate off-chain state reconstruction.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;store-setrecord&quot;&gt;Store_SetRecord&lt;&#x2F;h4&gt;
&lt;p&gt;Setting a Record means overwriting all of its fields. This operation can be performed whether the record has been set before or not (the standard does not enforce existence checks).&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;Store_SetRecord&lt;&#x2F;code&gt; event &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be emitted whenever the full data of a record has been overwritten.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Store_SetRecord&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  ResourceId&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tableId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; keyTuple&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; staticData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  EncodedLengths&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; encodedLengths&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; dynamicData&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Parameters:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;strong&gt;Name&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;strong&gt;Type&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;strong&gt;Description&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;tableId&lt;&#x2F;td&gt;&lt;td&gt;ResourceId&lt;&#x2F;td&gt;&lt;td&gt;The ID of the table where the record is set&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;keyTuple&lt;&#x2F;td&gt;&lt;td&gt;bytes32[]&lt;&#x2F;td&gt;&lt;td&gt;An array representing the composite key for the record&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;staticData&lt;&#x2F;td&gt;&lt;td&gt;bytes&lt;&#x2F;td&gt;&lt;td&gt;The static data of the record using packed encoding&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;encodedLengths&lt;&#x2F;td&gt;&lt;td&gt;EncodedLengths&lt;&#x2F;td&gt;&lt;td&gt;The encoded lengths of the dynamic data of the record&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;dynamicData&lt;&#x2F;td&gt;&lt;td&gt;bytes&lt;&#x2F;td&gt;&lt;td&gt;The dynamic data of the record, using &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7813&#x2F;#packed-data-encoding&quot;&gt;custom packed encoding&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;store-splicestaticdata&quot;&gt;Store_SpliceStaticData&lt;&#x2F;h4&gt;
&lt;p&gt;Splicing the static data of a Record consists in overwriting bytes of the packed encoded static fields. The total length of static data does not change as it is determined by the table’s value schema.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;Store_SpliceStaticData&lt;&#x2F;code&gt; event MUST be emitted whenever the static data of the Record has been spliced.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Store_SpliceStaticData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  ResourceId&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tableId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; keyTuple&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint48&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; start&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Parameters:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;strong&gt;Name&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;strong&gt;Type&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;strong&gt;Description&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;tableId&lt;&#x2F;td&gt;&lt;td&gt;ResourceId&lt;&#x2F;td&gt;&lt;td&gt;The ID of the table where the data is spliced&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;keyTuple&lt;&#x2F;td&gt;&lt;td&gt;bytes32[]&lt;&#x2F;td&gt;&lt;td&gt;An array representing the key for the record&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;start&lt;&#x2F;td&gt;&lt;td&gt;uint48&lt;&#x2F;td&gt;&lt;td&gt;The start position in bytes for the splice operation&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;data&lt;&#x2F;td&gt;&lt;td&gt;bytes&lt;&#x2F;td&gt;&lt;td&gt;Packed ABI encoding of a tuple with the value&#x27;s static fields&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;store-splicedynamicdata&quot;&gt;Store_SpliceDynamicData&lt;&#x2F;h4&gt;
&lt;p&gt;Splicing the dynamic data of a Record involves modifying the packed encoded representation of its dynamic fields by removing, replacing, and&#x2F;or inserting new bytes in place.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;Store_SpliceDynamicData&lt;&#x2F;code&gt; event MUST be emitted whenever the dynamic data of the Record has been spliced.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Store_SpliceDynamicData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  ResourceId&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tableId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; keyTuple&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; dynamicFieldIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint48&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; start&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint40&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; deleteCount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  EncodedLengths&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; encodedLengths&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Parameters:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;strong&gt;Name&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;strong&gt;Type&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;strong&gt;Description&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;tableId&lt;&#x2F;td&gt;&lt;td&gt;ResourceId&lt;&#x2F;td&gt;&lt;td&gt;The ID of the table where the data is spliced&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;keyTuple&lt;&#x2F;td&gt;&lt;td&gt;bytes32[]&lt;&#x2F;td&gt;&lt;td&gt;An array representing the composite key for the record&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;dynamicFieldIndex&lt;&#x2F;td&gt;&lt;td&gt;uint8&lt;&#x2F;td&gt;&lt;td&gt;The index of the dynamic field to splice data, relative to the start of the dynamic fields (Dynamic field index = field index - number of static fields)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;start&lt;&#x2F;td&gt;&lt;td&gt;uint48&lt;&#x2F;td&gt;&lt;td&gt;The start position in bytes for the splice operation&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;deleteCount&lt;&#x2F;td&gt;&lt;td&gt;uint40&lt;&#x2F;td&gt;&lt;td&gt;The number of bytes to delete in the splice operation&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;encodedLengths&lt;&#x2F;td&gt;&lt;td&gt;EncodedLengths&lt;&#x2F;td&gt;&lt;td&gt;The resulting encoded lengths of the dynamic data of the record&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;data&lt;&#x2F;td&gt;&lt;td&gt;bytes&lt;&#x2F;td&gt;&lt;td&gt;The data to insert into the dynamic data of the record at the start byte&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;store-deleterecord&quot;&gt;Store_DeleteRecord&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;Store_DeleteRecord&lt;&#x2F;code&gt; event MUST be emitted whenever the Record has been deleted from the Table.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Store_DeleteRecord&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;ResourceId&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tableId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; keyTuple&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Parameters:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;strong&gt;Name&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;strong&gt;Type&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;strong&gt;Description&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;tableId&lt;&#x2F;td&gt;&lt;td&gt;ResourceId&lt;&#x2F;td&gt;&lt;td&gt;The ID of the table where the record is deleted&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;keyTuple&lt;&#x2F;td&gt;&lt;td&gt;bytes32[]&lt;&#x2F;td&gt;&lt;td&gt;An array representing the composite key for the record&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;See the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7813&#x2F;#reference-implementation&quot;&gt;reference implementation section&lt;&#x2F;a&gt; for an example on how to index store events.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;the-tables-table&quot;&gt;The &lt;code&gt;Tables&lt;&#x2F;code&gt; table&lt;&#x2F;h3&gt;
&lt;p&gt;To keep track of the information of each table and support registering new tables at runtime, the Store implementation MUST include a special on-chain &lt;code&gt;Tables&lt;&#x2F;code&gt; table, which behaves the same way as other on-chain tables except for the special constraints mentioned below.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;Tables&lt;&#x2F;code&gt; table MUST use the following &lt;code&gt;Schema&lt;&#x2F;code&gt;s:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Key Schema:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;tableId&lt;&#x2F;code&gt; (&lt;code&gt;ResourceId&lt;&#x2F;code&gt;): &lt;code&gt;ResourceId&lt;&#x2F;code&gt; of the table this record describes.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Value Schema:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;fieldLayout&lt;&#x2F;code&gt; (&lt;code&gt;FieldLayout&lt;&#x2F;code&gt;): encodes the byte length of each static data type in the table.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;keySchema&lt;&#x2F;code&gt; (&lt;code&gt;Schema&lt;&#x2F;code&gt;): represents the data types of the (composite) key of the table.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;valueSchema&lt;&#x2F;code&gt; (&lt;code&gt;Schema&lt;&#x2F;code&gt;): represents the data types of the value fields of the table.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;abiEncodedKeyNames&lt;&#x2F;code&gt; (&lt;code&gt;bytes&lt;&#x2F;code&gt;): ABI encoded string array of key names.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;abiEncodedFieldNames&lt;&#x2F;code&gt; (&lt;code&gt;bytes&lt;&#x2F;code&gt;): ABI encoded string array of field names.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Records stored in the &lt;code&gt;Tables&lt;&#x2F;code&gt; table are considered immutable:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;Store&lt;&#x2F;code&gt; MUST emit a single &lt;code&gt;Store_SetRecord&lt;&#x2F;code&gt; event for each table being registered.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;Store&lt;&#x2F;code&gt; SHOULD NOT emit any other &lt;code&gt;Store&lt;&#x2F;code&gt; events for a &lt;code&gt;Table&lt;&#x2F;code&gt; registered in the &lt;code&gt;Tables&lt;&#x2F;code&gt; table.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;code&gt;Tables&lt;&#x2F;code&gt; table MUST store a record that describes itself before any other table is registered, emitting the corresponding &lt;code&gt;Store_SetRecord&lt;&#x2F;code&gt; event. The record must use the following &lt;code&gt;tableId&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; First two bytes indicates that this is an on-chain table&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The next 30 bytes are the unique identifier for the Tables table&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; bytes32(&amp;quot;tb&amp;quot;) | bytes32(&amp;quot;store&amp;quot;) &amp;gt;&amp;gt; (2 * 8) | bytes32(&amp;quot;Tables&amp;quot;) &amp;gt;&amp;gt; (2 * 8 + 14 * 8)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ResourceId tableId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; ResourceId&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;wrap&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x746273746f72650000000000000000005461626c657300000000000000000000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;By using a predefined &lt;code&gt;ResourceId&lt;&#x2F;code&gt; and &lt;code&gt;Schema&lt;&#x2F;code&gt; for the &lt;code&gt;Tables&lt;&#x2F;code&gt; table, off-chain indexers can interpret store events for all registered tables. This enables the development of advanced off-chain services that operate on structured data rather than raw encoded data like in the previous indexer implementation example.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;splice-events&quot;&gt;Splice Events&lt;&#x2F;h3&gt;
&lt;p&gt;While the &lt;code&gt;Store_SetRecord&lt;&#x2F;code&gt; event suffices for tracking the data of each record off-chain, including &lt;code&gt;Splice&lt;&#x2F;code&gt; events (&lt;code&gt;Store_SpliceStaticData&lt;&#x2F;code&gt; and &lt;code&gt;Store_SpliceDynamicData&lt;&#x2F;code&gt;) allows for more efficient partial updates. When only a portion of a record changes, emitting a full &lt;code&gt;SetRecord&lt;&#x2F;code&gt; event would be inefficient because the entire record data would need to be read from storage and emitted. &lt;code&gt;Splice&lt;&#x2F;code&gt; events enable the store to emit only the minimal necessary data for the update, reducing gas consumption. This is particularly important for records with large dynamic fields, as the cost of updating them doesn’t grow with the field’s size.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;disallowing-arrays-of-dynamic-types&quot;&gt;Disallowing Arrays of Dynamic Types&lt;&#x2F;h3&gt;
&lt;p&gt;Arrays of dynamic types (e.g., &lt;code&gt;string[]&lt;&#x2F;code&gt;, &lt;code&gt;bytes[]&lt;&#x2F;code&gt;) are intentionally not included as supported &lt;code&gt;SchemaType&lt;&#x2F;code&gt;s. This restriction enforces a flat data schema, which simplifies the store implementation and enhances efficiency. If users need to store such data structures, they can model them using a separate table with a schema like &lt;code&gt;{ index: uint256, data: bytes }&lt;&#x2F;code&gt;, where each array element is represented as an individual record.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;fieldlayout-optimization&quot;&gt;FieldLayout Optimization&lt;&#x2F;h3&gt;
&lt;p&gt;Including the &lt;code&gt;FieldLayout&lt;&#x2F;code&gt; in the &lt;code&gt;Tables&lt;&#x2F;code&gt; schema provides an on-chain optimization by precomputing and storing the exact byte lengths of static fields. This eliminates the need to repeatedly compute field lengths and offsets during runtime, which can be gas-intensive. By having this information readily available, the store can perform storage operations more efficiently, while components reading from the store can retrieve it from the &lt;code&gt;Tables&lt;&#x2F;code&gt; table to decode the corresponding records.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;special-tables-table&quot;&gt;Special &lt;code&gt;Tables&lt;&#x2F;code&gt; table&lt;&#x2F;h3&gt;
&lt;p&gt;Including a special &lt;code&gt;Tables&lt;&#x2F;code&gt; table provides significant benefits for off-chain indexers. While emitting events for table registration isn&#x27;t strictly necessary for basic indexers that operate on raw encoded data, doing so makes indexers aware of the schemas used by each table. This awareness enables the development of more advanced, schema-aware indexer APIs (e.g., SQL-like query capabilities), enhancing the utility and flexibility of off-chain data interactions.&lt;&#x2F;p&gt;
&lt;p&gt;By reusing existing Store abstractions for table registration, we also simplify the implementation and eliminate the need for additional, specific table registration events. Indexers can leverage the standard Store events to access schema information, ensuring consistency and reducing complexity.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;store-event-indexing&quot;&gt;Store Event Indexing&lt;&#x2F;h3&gt;
&lt;p&gt;The following example shows how a simple in-memory indexer can use the Store events to replicate the Store state off-chain. It is important to note that this indexer operates over raw encoded data which is not that useful on its own, but can be improved as we will explain in the next section.&lt;&#x2F;p&gt;
&lt;p&gt;We use TypeScript for this example but it can easily be replicated with other languages.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;tsx&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Record&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  staticData&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Hex&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  encodedLengths&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Hex&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  dynamicData&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Hex&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; store&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Map&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Record&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Create a key string from a table ID and key tuple to use in our store Map above&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; storeKey&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;tableId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Hex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; keyTuple&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Hex&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  return&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tableId&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;keyTuple&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;join&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Like `Array.splice`, but for strings of bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; bytesSplice&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Hex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  start&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; number&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  deleteCount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  newData&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Hex&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; dataNibbles&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;replace&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;^&lt;&#x2F;span&gt;&lt;span class=&quot;z-string z-regexp&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;split&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; newDataNibbles&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; newData&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;replace&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;^&lt;&#x2F;span&gt;&lt;span class=&quot;z-string z-regexp&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;split&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  return&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;dataNibbles&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    .&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;splice&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;start&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; deleteCount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    .&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;concat&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;newDataNibbles&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    .&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;join&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; bytesLength&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Hex&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; number&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;replace&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;^&lt;&#x2F;span&gt;&lt;span class=&quot;z-string z-regexp&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; processStoreEvent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;log&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; StoreEvent&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;log&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;eventName&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ===&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Store_SetRecord&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; storeKey&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;log&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;args&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tableId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; log&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;args&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;keyTuple&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Overwrite all of the Record&amp;#39;s fields&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    store&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;set&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      staticData&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; log&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;args&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;staticData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      encodedLengths&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; log&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;args&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;encodedLengths&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      dynamicData&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; log&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;args&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;dynamicData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;log&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;eventName&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ===&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Store_SpliceStaticData&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; storeKey&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;log&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;args&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tableId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; log&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;args&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;keyTuple&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; record&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; store&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;get&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ??&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      staticData&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      encodedLengths&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      dynamicData&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Splice the static field data of the Record&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    store&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;set&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      staticData&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; bytesSplice&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        record&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;staticData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        log&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;args&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;start&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        bytesLength&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;log&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;args&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        log&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;args&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      )&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      encodedLengths&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; record&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;encodedLengths&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      dynamicData&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; record&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;dynamicData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;log&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;eventName&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ===&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Store_SpliceDynamicData&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; storeKey&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;log&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;args&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tableId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; log&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;args&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;keyTuple&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; record&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; store&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;get&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ??&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      staticData&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      encodedLengths&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      dynamicData&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Splice the dynamic field data of the Record&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    store&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;set&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      staticData&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; record&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;staticData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      encodedLengths&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; log&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;args&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;encodedLengths&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      dynamicData&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; bytesSplice&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        record&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;dynamicData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        log&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;args&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;start&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        log&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;args&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;deleteCount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        log&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;args&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      )&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;log&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;eventName&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ===&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Store_DeleteRecord&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; storeKey&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;log&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;args&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tableId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; log&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;args&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;keyTuple&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Delete the whole Record&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    store&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;delete&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;access-control&quot;&gt;Access Control&lt;&#x2F;h3&gt;
&lt;p&gt;This standard only defines functions to &lt;strong&gt;read&lt;&#x2F;strong&gt; from the Store (&lt;code&gt;getRecord&lt;&#x2F;code&gt;, &lt;code&gt;getField&lt;&#x2F;code&gt;, and &lt;code&gt;getFieldLength&lt;&#x2F;code&gt;). The methods for setting or modifying records in the store are left to each specific implementation. Therefore, implementations &lt;strong&gt;must provide appropriate access control mechanisms&lt;&#x2F;strong&gt; for writing to the store, tailored to their specific use cases.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;on-chain-data-accessibility&quot;&gt;On-Chain Data Accessibility&lt;&#x2F;h3&gt;
&lt;p&gt;All data stored within a store is accessible not only off-chain but also &lt;strong&gt;on-chain&lt;&#x2F;strong&gt; by other smart contracts through the provided read functions (&lt;code&gt;getRecord&lt;&#x2F;code&gt;, &lt;code&gt;getField&lt;&#x2F;code&gt;, and &lt;code&gt;getFieldLength&lt;&#x2F;code&gt;). This differs from the typical behavior of smart contracts, where internal storage variables are private by default and cannot be directly read by other contracts unless explicit getter functions are provided. Thus, developers must be mindful that any data stored in the store is openly accessible to other smart contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Wallet Asset Discovery</title>
        <published>2024-11-07T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Luka Isailovic</name><uri>https://github.com/lukaisailovic</uri>
	</author>
	
	<author>
		<name>Konrad Kopp</name><uri>https://github.com/kopy-kat</uri>
	</author>
	
	<author>
		<name>Derek Rein</name><uri>https://github.com/arein</uri>
	</author>
	
	<author>
		<name>Chris Smith</name><uri>https://github.com/chris13524</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7811/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7811-wallet-asset-discovery/21639" />
        

        <id>https://wg-eips.ritovision.com/7811/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:7811"
            label="ERC-7811" />
        

        
        

        
        <summary type="html">JSON-RPC method for wallets to share a user’s full asset list with Dapps, including assets not easily found through on-chain data alone</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7811/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC introduces a new RPC call, &lt;code&gt;wallet_getAssets&lt;&#x2F;code&gt;, for wallets to declare to the Dapp what assets are owned by the user. This allows for more accurate asset discovery and the use of assets that aren’t available on-chain but can be provided by the wallet&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, Dapps primarily rely on on-chain data to determine a user&#x27;s balance, which can be limiting. Furthermore, a Dapp might restrict the user from initiating actions that the wallet could otherwise resolve, as it cannot account for the total assets a user has across different accounts or chains.&lt;&#x2F;p&gt;
&lt;p&gt;Wallets already have information about a user&#x27;s assets, including those not visible on-chain, and need a way to communicate that information to Dapps.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;method-wallet-getassets&quot;&gt;Method: &lt;code&gt;wallet_getAssets&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;request-schema&quot;&gt;Request schema&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Hex&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AssetType&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;native&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;erc20&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;erc721&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Hex&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AddressOrNative&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;native&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Eip155ChainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Hex&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; WalletGetAssetsRequest&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  account&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Address&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  assetFilter&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Record&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    Eip155ChainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;      address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AddressOrNative&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;      type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AssetType&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  assetTypeFilter&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AssetType&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  chainFilter&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Hex&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;account&lt;&#x2F;code&gt; is a &lt;strong&gt;REQUIRED&lt;&#x2F;strong&gt; field that indicates for which account assets are requested.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;assetFilter&lt;&#x2F;code&gt; is &lt;strong&gt;OPTIONAL&lt;&#x2F;strong&gt; field that accepts a list of assets identifiers. Each asset identifier is an object that contains &lt;code&gt;address&lt;&#x2F;code&gt; and &lt;code&gt;type&lt;&#x2F;code&gt; fields and is scoped by &lt;code&gt;chainId&lt;&#x2F;code&gt;, where ChainId &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be a valid &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt; chainId.&lt;&#x2F;p&gt;
&lt;p&gt;If the &lt;code&gt;assetFilter&lt;&#x2F;code&gt; field is provided, the wallet &lt;strong&gt;MUST&lt;&#x2F;strong&gt; only return the assets specified within it, even if &lt;code&gt;assetTypeFilter&lt;&#x2F;code&gt; or &lt;code&gt;chainFilter&lt;&#x2F;code&gt; could have further filtered the result. This effectively disregards the &lt;code&gt;assetTypeFilter&lt;&#x2F;code&gt; and &lt;code&gt;chainFilter&lt;&#x2F;code&gt; fields entirely. The reason for this is that they are already implicitly defined within the &lt;code&gt;assetFilter&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;If the &lt;code&gt;assetFilter&lt;&#x2F;code&gt; field is omitted, the wallet &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; return all available assets for the requested account. It is &lt;strong&gt;RECOMMENDED&lt;&#x2F;strong&gt; that the returned assets be ordered by estimated value in descending order, as determined by the wallet.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;assetTypeFilter&lt;&#x2F;code&gt; is an &lt;strong&gt;OPTIONAL&lt;&#x2F;strong&gt; field that specifies an array of asset types, as defined in this ERC. If &lt;code&gt;assetTypeFilter&lt;&#x2F;code&gt; field is provided, wallet &lt;strong&gt;MUST&lt;&#x2F;strong&gt; include only assets with those types in the response.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;chainFilter&lt;&#x2F;code&gt; is an &lt;strong&gt;OPTIONAL&lt;&#x2F;strong&gt; field that specifies an array of chain ids, where each value in the array &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be a valid &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt; chainId&lt;&#x2F;p&gt;
&lt;p&gt;Consumers of &lt;code&gt;wallet_getAssets&lt;&#x2F;code&gt; SHOULD set &lt;code&gt;assetFilter&lt;&#x2F;code&gt;, &lt;code&gt;assetTypeFilter&lt;&#x2F;code&gt; and &lt;code&gt;chainFilter&lt;&#x2F;code&gt; with as granular as reasonably possible values. For example, if an app is only interested in interacting with a single token on a single chain, it should provide filters for this. Doing this both ensures that wallets and the underlying infrastructure do not incur excessive cost, as well as significantly increased performance to client applications.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;example-request&quot;&gt;Example request&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;account&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;assetFilter&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;0x1&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;erc20&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;native&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;native&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;0xa&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;erc20&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;assetTypeFilter&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ERC20&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;native&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainFilter&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;response-schema&quot;&gt;Response schema&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Asset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AddressOrNative&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Hex&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; any&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; WalletGetAssetsResponse&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Record&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Hex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Asset&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The key &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt; chainId&lt;&#x2F;p&gt;
&lt;p&gt;Asset fields:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;address&lt;&#x2F;code&gt; is the address of the asset as &lt;code&gt;Hex&lt;&#x2F;code&gt; or &lt;code&gt;native&lt;&#x2F;code&gt; string for native assets.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;balance&lt;&#x2F;code&gt; is the balance of the asset as &lt;code&gt;Hex&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;type&lt;&#x2F;code&gt;:&lt;&#x2F;strong&gt; A string indicating the type of the asset. Common asset types include but &lt;strong&gt;aren’t limited to&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;erc20&lt;&#x2F;code&gt;:&lt;&#x2F;strong&gt; For &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;erc721&lt;&#x2F;code&gt;:&lt;&#x2F;strong&gt; For &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; tokens (NFTs)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;native&lt;&#x2F;code&gt;:&lt;&#x2F;strong&gt; For the chain&#x27;s native asset&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;metadata&lt;&#x2F;code&gt;:&lt;&#x2F;strong&gt; An &lt;strong&gt;OPTIONAL&lt;&#x2F;strong&gt; object containing additional information about the asset. The specific fields within the metadata object may vary depending on the asset type and the wallet&#x27;s implementation.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;example-response&quot;&gt;Example response&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;0x1&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xcaaea35047fe5702&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ERC20&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Token&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;symbol&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;TOK&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;decimals&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 18&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;native&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xcaaea35047fe5702&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;native&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;0xa&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x456&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xcd5595&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ERC721&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;well-known-asset-types&quot;&gt;Well-known asset types&lt;&#x2F;h3&gt;
&lt;p&gt;Below are expansions of &lt;code&gt;metadata&lt;&#x2F;code&gt; for well-known asset types. Implementations that are compliant with this ERC and return these well-known asset types &lt;strong&gt;MUST&lt;&#x2F;strong&gt; return at least these fields in &lt;code&gt;metadata&lt;&#x2F;code&gt;. Implementations &lt;strong&gt;MAY&lt;&#x2F;strong&gt; return more fields than specified here.
This ERC does not specify an exhaustive list of asset types.
Since the type is a generic string, there could be a mismatch between the type Dapp expects and the one returned by the wallet.
It’s important that no two assets share the same type.
Therefore, new asset types should be specified in future ERCs.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Native&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NativeAsset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;native&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Hex&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;native&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Example:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;native&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xcaaea35047fe5702&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;native&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;ERC-20 Token&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Erc20Asset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Hex&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Hex&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;erc20&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    name&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    symbol&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    decimals&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; number&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Example:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xcaaea35047fe5702&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;erc20&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Token&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;symbol&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;TOK&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;decimals&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 18&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;ERC-721 Token&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Erc721Asset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Hex&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Hex&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;erc721&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    name&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    symbol&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Hex&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    tokenURI&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Example:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;erc721&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Thor&amp;#39;s hammer&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;symbol&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;THOR&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;tokenURI&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ipfs:&#x2F;&#x2F;hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;capabilities&quot;&gt;Capabilities&lt;&#x2F;h3&gt;
&lt;p&gt;If the wallet is using &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ChainAgnostic&#x2F;CAIPs&#x2F;blob&#x2F;0848f06f6cfc29ce619bccdd5035c1d500033b21&#x2F;CAIPs&#x2F;caip-25.md&quot;&gt;CAIP-25&lt;&#x2F;a&gt; authorization, wallet &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; include &lt;code&gt;wallet_getAssets&lt;&#x2F;code&gt; in the &lt;code&gt;methods&lt;&#x2F;code&gt; array in &lt;code&gt;sessionScopes&lt;&#x2F;code&gt; of &lt;code&gt;eip155&lt;&#x2F;code&gt; namespace.&lt;&#x2F;p&gt;
&lt;p&gt;If the wallet supports &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5792&#x2F;&quot;&gt;ERC-5792&lt;&#x2F;a&gt; wallet &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; respond on &lt;code&gt;wallet_getCapabilities&lt;&#x2F;code&gt; request using the &lt;code&gt;assetDiscovery&lt;&#x2F;code&gt; key. Value should be an object with &lt;code&gt;supported&lt;&#x2F;code&gt; key and value &lt;code&gt;true&lt;&#x2F;code&gt;
Wallet &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; include this for every chainId.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;0xa&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;assetDiscovery&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;supported&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;!-- TODO --&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;!-- TODO --&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>JSON Contract with Value Version Control</title>
        <published>2024-11-07T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>lex-clinic</name><uri>https://github.com/lex-clinic</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7827/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7827-json-smart-contract-with-value-version-control/21865" />
        

        <id>https://wg-eips.ritovision.com/7827/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:7827"
            label="ERC-7827" />
        

        
        

        
        <summary type="html">Manage a JSON object onchain with per-key version history and a REST-like read interface.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7827/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP defines a smart contract interface that allows for managing a JSON object within a smart contract, offering both real-time JSON output and a version-controlled history for each value. The interface includes methods to retrieve the most recent JSON state as well as the version history of each key in the JSON object. This approach supports REST developers familiar with JSON-based data interactions, thus improving accessibility for developers new to Web3 and Ethereum.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;With an increasing number of developers from RESTful backgrounds joining the Ethereum ecosystem, there is a need for a contract interface that allows developers to easily interact with structured JSON data. This EIP aims to create a universal standard that provides JSON data management and version control functionality in a straightforward and REST-like way, making Ethereum more accessible and developer-friendly.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The contract interface includes the following methods:&lt;&#x2F;p&gt;
&lt;h3 id=&quot;read-methods&quot;&gt;Read Methods&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;json()&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Output:&lt;&#x2F;strong&gt; &lt;code&gt;string&lt;&#x2F;code&gt; (a JSON string representing the entire object)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Description:&lt;&#x2F;strong&gt; Returns the current state of the JSON object as a string.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;version(string key)&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Inputs:&lt;&#x2F;strong&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;key&lt;&#x2F;code&gt; (&lt;code&gt;string&lt;&#x2F;code&gt;): The JSON key whose version history is requested.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Output:&lt;&#x2F;strong&gt; &lt;code&gt;string&lt;&#x2F;code&gt; (a JSON array as a string)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Description:&lt;&#x2F;strong&gt; Returns an array of all versions of the specified key&#x27;s value in JSON format. The array is ordered chronologically, with the earliest version at index 0 and the most recent version at the highest index.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;write-method&quot;&gt;Write Method&lt;&#x2F;h3&gt;
&lt;ol start=&quot;3&quot;&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;write(string[] keys, string[] values, bool replace)&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Inputs:&lt;&#x2F;strong&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;keys&lt;&#x2F;code&gt; (&lt;code&gt;string[]&lt;&#x2F;code&gt;): Array of keys to be added or updated in the JSON object.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;values&lt;&#x2F;code&gt; (&lt;code&gt;string[]&lt;&#x2F;code&gt;): Array of values corresponding to the keys.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;replace&lt;&#x2F;code&gt; (&lt;code&gt;bool&lt;&#x2F;code&gt;): If &lt;code&gt;true&lt;&#x2F;code&gt;, replaces existing values; if &lt;code&gt;false&lt;&#x2F;code&gt;, reverts if the key already exists.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Output:&lt;&#x2F;strong&gt; None&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Description:&lt;&#x2F;strong&gt; Writes new values to the JSON object, either adding a new key or updating an existing one, based on the &lt;code&gt;replace&lt;&#x2F;code&gt; parameter.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;solidity-interface-non-normative&quot;&gt;Solidity Interface (non-normative)&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7827&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; json&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; version&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; write&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; keys&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; values&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; replace&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;examples-non-normative&quot;&gt;Examples (non-normative)&lt;&#x2F;h3&gt;
&lt;p&gt;Assume the following scenario with key-value management:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Initial Write:&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;write&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;name&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;Alice&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;JSON Output:&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Alice&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;Version History of &lt;code&gt;name&lt;&#x2F;code&gt;:&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Alice&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ol start=&quot;2&quot;&gt;
&lt;li&gt;&lt;strong&gt;Updating Value with Replacement:&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;write&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;name&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;Bob&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;JSON Output:&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Bob&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;Version History of &lt;code&gt;name&lt;&#x2F;code&gt;:&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Alice&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Bob&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ol start=&quot;3&quot;&gt;
&lt;li&gt;&lt;strong&gt;Attempting to Update without Replacement (reverts if &lt;code&gt;name&lt;&#x2F;code&gt; exists):&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;write&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;name&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;Charlie&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;This transaction reverts because &lt;code&gt;name&lt;&#x2F;code&gt; already exists and &lt;code&gt;replace&lt;&#x2F;code&gt; is &lt;code&gt;false&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;REST-like Access via JSON Method&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
The &lt;code&gt;json&lt;&#x2F;code&gt; method enables developers to interact with the contract as if it were a RESTful API, improving accessibility for those familiar with traditional web development paradigms.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Version Management via Version Method&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
The &lt;code&gt;version&lt;&#x2F;code&gt; method provides a straightforward version control system for each key, offering a history of values that developers can reference without altering the main JSON structure. This maintains immutability for historical values while allowing updates to be appended.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Compatibility with Web3 Abstractions&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
Ensuring a simple and standardized ABI is essential for usability with Web3 libraries, thus enhancing developer experience and facilitating onboarding.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is a new standard and does not interfere with existing standards. However, it introduces JSON object handling and version control, which may have specific considerations for gas optimization.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;JSON encoding onchain is inherently gas-heavy. This standard limits complexity by treating values as strings and leaving encoding efficiency to client libraries.&lt;&#x2F;li&gt;
&lt;li&gt;Contracts &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; guard against unbounded array writes, which could otherwise make the &lt;code&gt;write&lt;&#x2F;code&gt; method expensive or DOS-prone.&lt;&#x2F;li&gt;
&lt;li&gt;Care should be taken to handle large JSON objects efficiently to avoid excessive gas consumption.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Universal Orchestrator RPC</title>
        <published>2024-11-07T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Kieran Goodary</name><uri>https://github.com/IAmKio</uri>
	</author>
	
	<author>
		<name>Pillar Wallet</name><uri>https://github.com/pillarwallet</uri>
	</author>
	
	<author>
		<name>Luke Wickens</name><uri>https://github.com/lbw33</uri>
	</author>
	
	<author>
		<name>Rana Khoury</name><uri>https://github.com/RanaBug</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7845/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7845-universal-orchestrator-rpc/21885" />
        

        <id>https://wg-eips.ritovision.com/7845/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7845"
            label="ERC-7845" />
        

        
        

        
        <summary type="html">A universal data model that an Orchestrator can understand to help fulfil a request for a solution from a wallet or any other system.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7845/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;blockquote&gt;
&lt;p&gt;&quot;Hey smart speaker, swap my Shiba Inu for Pillar&quot;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;&quot;Assistant, how much USDC can I buy with what&#x27;s in my wallet?&quot;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;&quot;Send 10 OP to Vitalik and 5 PEPE to Deimantas&quot;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;The Universal Orchestrator RPC aims to standardise the &lt;strong&gt;minimum shape and requirements&lt;&#x2F;strong&gt; of a &lt;strong&gt;request for a solution&lt;&#x2F;strong&gt; &lt;em&gt;&lt;strong&gt;from&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt; an arbitrary system managing an Ethereum wallet &lt;em&gt;&lt;strong&gt;to&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt;, ultimately, an Orchestrator.&lt;&#x2F;p&gt;
&lt;p&gt;An arbitrary system could be a website, device, app, server program etc - anything that manages an Ethereum wallet, &lt;strong&gt;speaks Ethereum JSON-RPC&lt;&#x2F;strong&gt; and is looking to request solutions from an Orchestrator.&lt;&#x2F;p&gt;
&lt;p&gt;All solutions from an Orchestrator are ChA¹ (Chain Abstraction-first) by default.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7845&#x2F;.&#x2F;assets&#x2F;flow.jpg&quot; alt=&quot;Flow&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Data model standards can be written in any shape. A system will often expose their external interface but require that the request to the aforementioned interface is modelled in a way that the service understands. This creates a huge level of inconsistency and in turn makes Orchestrator interoperability more difficult.&lt;&#x2F;p&gt;
&lt;p&gt;Orchestrators will become more widespread and numerous over time. This is especially true with the advent of Artificial Intelligence (AI) driven systems, the continued advancement of Human Computer Interaction (HCI) devices (especially those that are voice controlled) and the emergence of Extended Reality (XR) platforms.&lt;&#x2F;p&gt;
&lt;p&gt;Standardising the request object that an Orchestrator can understand from a wallet will drive adoption and make decentralised app development easier for developers that don&#x27;t know how to make on-chain transactions or have the required technical understanding of block building systems.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;The Orchestrator&#x27;s external interface(s) that expose functionality to an end-user application or another system MUST use JavaScript Object Notation (JSON).&lt;&#x2F;p&gt;
&lt;p&gt;The following data definitions are available and MUST &lt;strong&gt;prefer chain abstraction (ChA¹)&lt;&#x2F;strong&gt;, unless stated. Chain abstraction means that, where possible, should an asset span multiple chains - expect a solution from an Orchestrator to use and send assets to and from the supported chains to deliver a complete and cost-effective solution.&lt;&#x2F;p&gt;
&lt;p&gt;The following sequence diagram shows the flow of events in this proposal:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7845&#x2F;.&#x2F;assets&#x2F;sequence.png&quot; alt=&quot;Sequence Diagram&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;This specification follows the top level data shape of Ethereum JSON-RPC requests, as shown below:&lt;&#x2F;p&gt;
&lt;h3 id=&quot;request&quot;&gt;Request&lt;&#x2F;h3&gt;
&lt;p&gt;The request definition is what a wallet sends to an Orchestrator for solutions to one or more problems. The request follows the specification from Ethereum JSON-RPC.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;rpc&quot;&gt;RPC&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Rpc&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    id&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; number&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; REQUIRED&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; REQUIRED&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    method&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; REQUIRED&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    params&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Problem&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; REQUIRED&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The top level definition is an Ethereum RPC object.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;id&lt;&#x2F;code&gt; property is a random number that you can assign for your own purposes.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;jsonrpc&lt;&#x2F;code&gt; property takes a &lt;code&gt;string&lt;&#x2F;code&gt; that represents the version of JSON-RPC being used. Usually &lt;code&gt;&quot;2.0&quot;&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;method&lt;&#x2F;code&gt; property is the method call intended for the Orchestrator, and by default CAN be &lt;code&gt;orchestrator_findSolutions&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;params&lt;&#x2F;code&gt; property contains an array of &lt;code&gt;Problem&lt;&#x2F;code&gt; objects, and is REQUIRED. The Problem object is defined below.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;problem&quot;&gt;Problem&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Problem&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    actions&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Action&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; REQUIRED&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; number&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; OPTIONAL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;Problem&lt;&#x2F;code&gt; definition has just one REQUIRED property, &lt;code&gt;actions&lt;&#x2F;code&gt;. The &lt;code&gt;Problem&lt;&#x2F;code&gt; interface leaves space for additional properties in future network upgrades and existing or emerging standards.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;actions&lt;&#x2F;code&gt; property takes an &lt;code&gt;array&lt;&#x2F;code&gt; of &lt;code&gt;Action&lt;&#x2F;code&gt; objects, defined below, and is REQUIRED.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;chainId&lt;&#x2F;code&gt; takes a &lt;code&gt;number&lt;&#x2F;code&gt;, representing the chain ID, and is OPTIONAL.
&lt;ul&gt;
&lt;li&gt;If no &lt;code&gt;chainId&lt;&#x2F;code&gt; is provided:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;chainId&lt;&#x2F;code&gt; property MUST assume &lt;code&gt;1&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;action&quot;&gt;Action&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Action&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    from&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; REQUIRED&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    towards&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Asset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Destination&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; REQUIRED&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    with&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Offering&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; OPTIONAL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; OPTIONAL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    functionCallName&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; OPTIONAL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    functionCallData&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; OPTIONAL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    deadline&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; number&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; OPTIONAL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;Action&lt;&#x2F;code&gt; definition has several properties that indicate the desired action. The set properties determine the action that needs to be solved.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;from&lt;&#x2F;code&gt; property is REQUIRED, takes a &lt;code&gt;string&lt;&#x2F;code&gt; and represents the wallet that this &lt;code&gt;Action&lt;&#x2F;code&gt; is for.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;towards&lt;&#x2F;code&gt; property is REQUIRED, takes an &lt;code&gt;array&lt;&#x2F;code&gt; of either an &lt;code&gt;Asset&lt;&#x2F;code&gt; or a &lt;code&gt;Destination&lt;&#x2F;code&gt; type and represents where this &lt;code&gt;Action&lt;&#x2F;code&gt; is targeted towards.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;with&lt;&#x2F;code&gt; property is OPTIONAL, takes an &lt;code&gt;array&lt;&#x2F;code&gt; of &lt;code&gt;Offering&lt;&#x2F;code&gt; type and represents what assets the wallet is prepared to offer to facilitate this &lt;code&gt;Action&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;If the &lt;code&gt;with&lt;&#x2F;code&gt; property contains no &lt;code&gt;Offering&lt;&#x2F;code&gt; entries, then the Orchestrator MUST consider all assets available in the address space for an &lt;code&gt;Offering&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;type&lt;&#x2F;code&gt; property is OPTIONAL, takes a &lt;code&gt;string&lt;&#x2F;code&gt; and is intended to help classify this action. Examples might include, but are not limited to - &lt;code&gt;transfer&lt;&#x2F;code&gt;, &lt;code&gt;swap&lt;&#x2F;code&gt;, &lt;code&gt;call&lt;&#x2F;code&gt; etc and is intended to assist the Orchestrator with the action.
&lt;ul&gt;
&lt;li&gt;If no &lt;code&gt;type&lt;&#x2F;code&gt; is provided, then &#x27;transfer&#x27; MUST be assumed&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;functionCallName&lt;&#x2F;code&gt; property is OPTIONAL, takes a &lt;code&gt;string&lt;&#x2F;code&gt; and represents the function name to call against the &lt;code&gt;towards&lt;&#x2F;code&gt; property. If this is defined, the Orchestrator can be assumed that this Action desires to call a smart contract as part of the action.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;functionCallData&lt;&#x2F;code&gt; property is OPTIONAL, takes a &lt;code&gt;string&lt;&#x2F;code&gt; and represents the data payload for &lt;code&gt;functionCallName&lt;&#x2F;code&gt;. If this is defined but &lt;code&gt;functionCallName&lt;&#x2F;code&gt; is not, this property SHOULD be ignored.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;deadline&lt;&#x2F;code&gt; property is OPTIONAL, takes a &lt;code&gt;number&lt;&#x2F;code&gt; and represents a wallet-defined unix timestamp for when an action should have a solution by. Useful for high throughput systems, or time sensitive actions.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;asset&quot;&gt;Asset&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Asset&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    symbol&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; OPTIONAL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; OPTIONAL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; number&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; OPTIONAL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The Asset definition defines an asset in question. This definition prefers chain abstraction.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;symbol&lt;&#x2F;code&gt; property is OPTIONAL, takes a &lt;code&gt;string&lt;&#x2F;code&gt; and represents the symbol of the Asset in question.
&lt;ul&gt;
&lt;li&gt;if no &lt;code&gt;symbol&lt;&#x2F;code&gt; is provided, &lt;code&gt;address&lt;&#x2F;code&gt; must be used&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;address&lt;&#x2F;code&gt; property is OPTIONAL, takes a &lt;code&gt;string&lt;&#x2F;code&gt; and represents the &lt;code&gt;address&lt;&#x2F;code&gt; of the smart contract for this &lt;code&gt;Asset&lt;&#x2F;code&gt;.
&lt;ul&gt;
&lt;li&gt;if no &lt;code&gt;address&lt;&#x2F;code&gt; is provided, the native gas token MUST be used&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;chainId&lt;&#x2F;code&gt; property is OPTIONAL, takes a &lt;code&gt;number&lt;&#x2F;code&gt; and represents the chain that this asset resides on. Useful for direct targeting of an &lt;code&gt;Asset&lt;&#x2F;code&gt; on a particular chain.&lt;&#x2F;li&gt;
&lt;li&gt;If no &lt;code&gt;chainId&lt;&#x2F;code&gt; is provided: - The Orchestrator is free to use any corresponding asset on any chain to facilitate the action&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;destination&quot;&gt;Destination&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Destination&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; REQUIRED&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; number&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; REQUIRED&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The Destination definition defines a direct target and is used in scenarios where the Orchestrator interpretation MUST NOT be used.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;address&lt;&#x2F;code&gt; property is REQUIRED and takes a &lt;code&gt;string&lt;&#x2F;code&gt; that represents the address space for this &lt;code&gt;Destination&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;chainId&lt;&#x2F;code&gt; property is REQUIRED and takes a &lt;code&gt;number&lt;&#x2F;code&gt; and represents the chain the above &lt;code&gt;address&lt;&#x2F;code&gt; property resides on.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;offering&quot;&gt;Offering&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Offering&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    symbol&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SHOULD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SHOULD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; OPTIONAL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; number&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; OPTIONAL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;Offering&lt;&#x2F;code&gt; definition defines what the requester is willing to spend from their wallet in order to facilitate the action being solved.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;symbol&lt;&#x2F;code&gt; property SHOULD be specified and represents the symbol of the &lt;code&gt;Offering&lt;&#x2F;code&gt; in question
&lt;ul&gt;
&lt;li&gt;If no &lt;code&gt;symbol&lt;&#x2F;code&gt; is provided, the address MUST be used&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;address&lt;&#x2F;code&gt; property SHOULD be specified and takes a &lt;code&gt;string&lt;&#x2F;code&gt; that represents the address space for this &lt;code&gt;Offering&lt;&#x2F;code&gt;.
&lt;ul&gt;
&lt;li&gt;If no &lt;code&gt;address&lt;&#x2F;code&gt; is provided, the native gas token MUST be used&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;amount&lt;&#x2F;code&gt; property is OPTIONAL and represents the amount to be offered as part of the &lt;code&gt;Action&lt;&#x2F;code&gt;. Accepts either a &lt;code&gt;number&lt;&#x2F;code&gt;, which represents an ether unit, or a &lt;code&gt;string&lt;&#x2F;code&gt; which can be used for BigNumbers.
&lt;ul&gt;
&lt;li&gt;If no amount is provided, the maximum value of the address, symbol or native gas unit must be assumed&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;chainId&lt;&#x2F;code&gt; property is OPTIONAL and takes a &lt;code&gt;number&lt;&#x2F;code&gt; that represents the chain the above &lt;code&gt;address&lt;&#x2F;code&gt; property resides on.
&lt;ul&gt;
&lt;li&gt;If no &lt;code&gt;chainId&lt;&#x2F;code&gt; is provided:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;address&lt;&#x2F;code&gt; MUST NOT be used&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;symbol&lt;&#x2F;code&gt; MUST be used (ChA¹)&lt;&#x2F;li&gt;
&lt;li&gt;If no higher level &lt;code&gt;chainId&lt;&#x2F;code&gt; property exists in the &lt;code&gt;Problem&lt;&#x2F;code&gt; property
&lt;ul&gt;
&lt;li&gt;The Orchestrator is free to use any corresponding asset on any chain to facilitate the action (ChA¹)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;response&quot;&gt;Response&lt;&#x2F;h3&gt;
&lt;p&gt;The response definition is what an Orchestrator sends back as a response to the request for solutions from a wallet. The response, like the request, follows the specification from Ethereum JSON-RPC.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;rpc-1&quot;&gt;RPC&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Rpc&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    id&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; REQUIRED&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; REQUIRED&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    result&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Solution&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; REQUIRED&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The top level object is an Ethereum RPC object.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;id&lt;&#x2F;code&gt; property is REQUIRED, takes a &lt;code&gt;string&lt;&#x2F;code&gt; and MUST correlate to the same &lt;code&gt;number&lt;&#x2F;code&gt; that was received as part of the request object to the Orchestrator.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;jsonrpc&lt;&#x2F;code&gt; property is REQUIRED, takes a &lt;code&gt;string&lt;&#x2F;code&gt; and represents the version of JSON-RPC being used. Usually &lt;code&gt;&quot;2.0&quot;&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;result&lt;&#x2F;code&gt; property is REQUIRED and takes an array of &lt;code&gt;Solution&lt;&#x2F;code&gt; objects. The &lt;code&gt;Solution&lt;&#x2F;code&gt; object is defined below.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;solution&quot;&gt;Solution&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Solution&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    name&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; REQUIRED&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    description&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; OPTIONAL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    transactions&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transaction&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; REQUIRED&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    deadline&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; number&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; OPTIONAL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The above &lt;code&gt;Solution&lt;&#x2F;code&gt; interface is the &lt;em&gt;solution&lt;&#x2F;em&gt; to a &lt;em&gt;problem&lt;&#x2F;em&gt; requested above. The &lt;code&gt;Solution&lt;&#x2F;code&gt; MUST be in the same order to a &lt;code&gt;Problem&lt;&#x2F;code&gt; that was requested.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;name&lt;&#x2F;code&gt; property is REQUIRED, takes a &lt;code&gt;string&lt;&#x2F;code&gt; and represents a short, non-technical and user-friendly, name of the solution.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;description&lt;&#x2F;code&gt; property is OPTIONAL, takes a &lt;code&gt;string&lt;&#x2F;code&gt; and represents a longer, non-technical and user-friendly, description of the solution.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;transactions&lt;&#x2F;code&gt; property is REQUIRED, takes an &lt;code&gt;array&lt;&#x2F;code&gt; of &lt;code&gt;Transaction&lt;&#x2F;code&gt; objects and represents one or more transactions needed for the user to execute the solution.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;deadline&lt;&#x2F;code&gt; property is OPTIONAL, takes a &lt;code&gt;number&lt;&#x2F;code&gt; and represents a unix timestamp by which this &lt;code&gt;Solution&lt;&#x2F;code&gt; should be executed. This is defined by the Orchestrator.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;transaction&quot;&gt;Transaction&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transaction&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    to&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Destination&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; REQUIRED&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; number&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; REQUIRED&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; REQUIRED&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; OPTIONAL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The above &lt;code&gt;Transaction&lt;&#x2F;code&gt; interface is a transaction definition that allows a wallet to perform their solution to a problem. There may be 1 or more transactions for a &lt;code&gt;Solution&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;to&lt;&#x2F;code&gt; property is REQUIRED, takes a &lt;code&gt;Destination&lt;&#x2F;code&gt; type and represents the target for this Solution.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;chainId&lt;&#x2F;code&gt; property is REQUIRED, takes a number and represents the chain that this &lt;code&gt;Transaction&lt;&#x2F;code&gt; is targeted at. The &lt;code&gt;chainId&lt;&#x2F;code&gt; is REQUIRED here because the wallet MUST know where to send assets from as an origin due to the existence of multichain assets.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;amount&lt;&#x2F;code&gt; property is REQUIRED and represents the amount to be sent as part of the &lt;code&gt;Transaction&lt;&#x2F;code&gt;. Accepts either a &lt;code&gt;number&lt;&#x2F;code&gt;, which represents an ether unit, or a &lt;code&gt;string&lt;&#x2F;code&gt; which can be used for BigNumbers.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Uses the Ethereum JSON-RPC JSON wrapper for greater compatibility.&lt;&#x2F;li&gt;
&lt;li&gt;The interface definitions use only generic primitive types to ensure wide compatibility for any programming language.&lt;&#x2F;li&gt;
&lt;li&gt;The interface definitions defined in this ERC attempts to cover as many scenarios as possible, from an Orchestrator perspective that a wallet may ask for, but focuses on core blockchain functionality.&lt;&#x2F;li&gt;
&lt;li&gt;Certain high-level definitions, such as the &lt;code&gt;Problem&lt;&#x2F;code&gt; object definition, are sparse by design to allow space for future features introduced by other ERC&#x27;s or network upgrades.&lt;&#x2F;li&gt;
&lt;li&gt;Terminology is targeted towards a non-technical lexicon to aid in wider adoption and understanding.&lt;&#x2F;li&gt;
&lt;li&gt;Nearly all options are REQUIRED, SHOULD and OPTIONAL to allow for both wallet and Orchestrator flexibility in providing solutions for the wallet request.&lt;&#x2F;li&gt;
&lt;li&gt;It&#x27;s understood that the Orchestrator interpretations and implementations will vary, so where possible the specification enforces REQUIRED and MUST to provide a universal level of service to an end-user or another service.&lt;&#x2F;li&gt;
&lt;li&gt;The specification is &lt;strong&gt;NOT&lt;&#x2F;strong&gt; intended to standardise or modify the internal data structure or communication layer of an Orchestrator.&lt;&#x2F;li&gt;
&lt;li&gt;Other parameters that could be considered, such as gas limits and estimations, are delegated back to the wallet as ultimately it is the wallet that will execute the solution(s).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;example-requests-and-responses-for-solutions&quot;&gt;Example requests and responses for solutions&lt;&#x2F;h3&gt;
&lt;p&gt;The following examples show a few common scenarios with their requests to, and from, an Orchestrator. All examples are chain abstracted (ChA¹) by default, unless specified.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;sending-an-erc-20-token-to-another-address&quot;&gt;Sending an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; token to another address&lt;&#x2F;h4&gt;
&lt;p&gt;The following request performs an action:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;from 0xbafB4E1EFA94B359e2E175CF6156AedA2cACa165&lt;&#x2F;li&gt;
&lt;li&gt;towards address 0x50840CE036eEf2005d3c4d6f6Eb65f8116a01629
&lt;ul&gt;
&lt;li&gt;with symbol USDC, amount 5&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;blockquote&gt;
&lt;p&gt;[!NOTE]
Notes: All requests for solutions should be chain abstracted (ChA¹) by default. The Orchestrator &amp;gt; &amp;gt; can check for 5 USDC on any chain for the above &quot;from&quot; address, and send a solution that receives &amp;gt; the 5 USDC on any other chain.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h5 id=&quot;request-to-orchestrator&quot;&gt;Request to Orchestrator&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1234&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;method&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;orchestrator_findSolutions&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;problems&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;actions&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;from&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xbafB4E1EFA94B359e2E175CF6156AedA2cACa165&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;towards&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x50840CE036eEf2005d3c4d6f6Eb65f8116a01629&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;with&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;symbol&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;USDC&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;response-from-orchestrator&quot;&gt;Response from Orchestrator&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1234&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Send 5 USDC&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Send 5 USDC from 0xbafB4E1EFA94B359e2E175CF6156AedA2cACa165 to 0x50840CE036eEf2005d3c4d6f6Eb65f8116a01629&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;transactions&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;swapping-native-token-to-usdc&quot;&gt;Swapping native token to USDC&lt;&#x2F;h4&gt;
&lt;p&gt;The following request performs an action:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;from 0xbafB4E1EFA94B359e2E175CF6156AedA2cACa165&lt;&#x2F;li&gt;
&lt;li&gt;towards symbol USDC
&lt;ul&gt;
&lt;li&gt;with: 0.1&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;blockquote&gt;
&lt;p&gt;[!NOTE]
Notes: All requests for solutions should be chain abstracted (ChA¹) by default. The Orchestrator
can take 0.1 native asset from any chain in return for USDC on any chain.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h5 id=&quot;request-to-orchestrator-1&quot;&gt;Request to Orchestrator&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1337&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;method&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;orchestrator_findSolutions&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;problems&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;actions&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;from&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xbafB4E1EFA94B359e2E175CF6156AedA2cACa165&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;towards&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;symbol&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;USDC&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;with&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0.1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;response-from-orchestrator-1&quot;&gt;Response from Orchestrator&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1337&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Swap 0.1 ETH for 371.498 USDC&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Swapping 0.1 ETH from 0xbafB4E1EFA94B359e2E175CF6156AedA2cACa165 to 371.498 USDC via Uniswap&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;transactions&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0.1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;swapping-multiple-tokens-to-usdc&quot;&gt;Swapping multiple tokens to USDC&lt;&#x2F;h4&gt;
&lt;p&gt;The following request performs an action:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;from 0xbafB4E1EFA94B359e2E175CF6156AedA2cACa165&lt;&#x2F;li&gt;
&lt;li&gt;towards symbol USDC&lt;&#x2F;li&gt;
&lt;li&gt;with SHIB and &#x2F; or Pillar&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;blockquote&gt;
&lt;p&gt;[!NOTE]
Notes: All requests for solutions should be chain abstracted (ChA¹) by default. The Orchestrator
can take any amount of SHIB and &#x2F; or Pillar from any chain in return for an exchanged amount of
USDC on any chain.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h5 id=&quot;request-to-orchestrator-2&quot;&gt;Request to Orchestrator&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1234&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;method&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;orchestrator_findSolutions&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;problems&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;actions&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;from&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xbafB4E1EFA94B359e2E175CF6156AedA2cACa165&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;towards&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;symbol&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;USDC&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;with&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;symbol&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;SHIB&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;symbol&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Pillar&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;response-from-orchestrator-2&quot;&gt;Response from Orchestrator&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1337&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Swap 171,246 SHIB and 1004.72 Pillar for 10 USDC&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Swapping 171,246 SHIB and 1004.72 Pillar from 0xbafB4E1EFA94B359e2E175CF6156AedA2cACa165 to 10 USDC via Uniswap&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;transactions&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0.1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;sending-an-erc-20-token-to-multiple-addresses&quot;&gt;Sending an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; token to multiple addresses&lt;&#x2F;h4&gt;
&lt;p&gt;The following request performs the following actions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Action 1
&lt;ul&gt;
&lt;li&gt;from 0xbafB4E1EFA94B359e2E175CF6156AedA2cACa165&lt;&#x2F;li&gt;
&lt;li&gt;towards address 0x50840CE036eEf2005d3c4d6f6Eb65f8116a01629&lt;&#x2F;li&gt;
&lt;li&gt;with 5 USDC&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Action 2
&lt;ul&gt;
&lt;li&gt;from 0xbafB4E1EFA94B359e2E175CF6156AedA2cACa165&lt;&#x2F;li&gt;
&lt;li&gt;towards address 0xFCd239451346238B5560511Ae47A0b82b1bbE9f0&lt;&#x2F;li&gt;
&lt;li&gt;with 100 PLR&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;blockquote&gt;
&lt;p&gt;[!NOTE]
Notes: All requests for solutions should be chain abstracted (ChA¹) by default. The Orchestrator
can move the specified asset amounts on any chain where the asset exists in the &quot;from&quot; address.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h5 id=&quot;request-to-orchestrator-3&quot;&gt;Request to Orchestrator&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;method&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;orchestrator_findSolutions&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;problems&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;actions&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;from&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xbafB4E1EFA94B359e2E175CF6156AedA2cACa165&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;towards&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x50840CE036eEf2005d3c4d6f6Eb65f8116a01629&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;with&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;symbol&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;USDC&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;from&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xbafB4E1EFA94B359e2E175CF6156AedA2cACa165&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;towards&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xFCd239451346238B5560511Ae47A0b82b1bbE9f0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;with&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;symbol&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;PLR&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 100&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;response-from-orchestrator-3&quot;&gt;Response from Orchestrator&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Send 5 USDC to 0x...629 and 100 PLR to 0x...9f0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Send 5 USDC to 0x50840CE036eEf2005d3c4d6f6Eb65f8116a01629 and 100 PLR to 0xFCd239451346238B5560511Ae47A0b82b1bbE9f0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;transactions&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;calling-a-smart-contract-function-on-polygon-inscribing-a-message-which-costs-1-usdc&quot;&gt;Calling a Smart Contract function on Polygon: Inscribing a message which costs 1 USDC&lt;&#x2F;h4&gt;
&lt;p&gt;The following request performs an action:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;from 0xbafB4E1EFA94B359e2E175CF6156AedA2cACa165&lt;&#x2F;li&gt;
&lt;li&gt;towards address 0x50840CE036eEf2005d3c4d6f6Eb65f8116a01629 on chain 137&lt;&#x2F;li&gt;
&lt;li&gt;with 1 USDC&lt;&#x2F;li&gt;
&lt;li&gt;calling &quot;inscribe&quot; with &quot;0x...&quot;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;blockquote&gt;
&lt;p&gt;[!NOTE]
Notes: All requests for solutions should be chain abstracted (ChA¹) by default - HOWEVER in this
example, the &lt;code&gt;chainId&lt;&#x2F;code&gt; property on the &lt;code&gt;Destination&lt;&#x2F;code&gt; interface has been specified. The operation
should now be locked to the specified chain. Because &lt;code&gt;functionCallName&lt;&#x2F;code&gt; and &lt;code&gt;functionCallData&lt;&#x2F;code&gt;
exist, the Orchestrator can infer that this is a smart contract call and act accordingly.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h5 id=&quot;request-to-orchestrator-4&quot;&gt;Request to Orchestrator&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 420&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;method&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;orchestrator_findSolutions&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;problems&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;actions&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;from&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xbafB4E1EFA94B359e2E175CF6156AedA2cACa165&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;towards&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x50840CE036eEf2005d3c4d6f6Eb65f8116a01629&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 137&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;with&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;symbol&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;USDC&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;functionCallName&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;inscribe&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;functionCallData&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;response-from-orchestrator-4&quot;&gt;Response from Orchestrator&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 420&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Inscribe with 1 USDC&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Call the Inscribe function with 1 USDC on Polygon&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;transactions&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 137&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 137&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;orchestrator-reputation&quot;&gt;Orchestrator reputation&lt;&#x2F;h3&gt;
&lt;p&gt;The ability for anyone to build an Orchestrator inherently brings the opportunity for code errors and therefore a degraded service. Orchestrators may also be abandoned over time. A reputation score should be leveraged by the Orchestrator to determine if the Orchestrator is fit for purpose. This should be up to the requesting system or wallet to determine.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;orchestrator-producing-dishonest-solutions&quot;&gt;Orchestrator producing dishonest solutions&lt;&#x2F;h3&gt;
&lt;p&gt;An Orchestrator may return transactions as part of a solution that are wrong or attempt to take more than what was asked of it. Where possible, the Orchestrator should validate returned transaction address destinations and any other data.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;orchestrator-personality-variations&quot;&gt;Orchestrator personality variations&lt;&#x2F;h3&gt;
&lt;p&gt;Whilst not a security consideration per-se, some Orchestrators may gravitate towards their own business targets which may skew the outcome of Orchestrator solutions. The systems or wallets requesting solutions from Orchestrators should be mindful of this unless it is intended.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Minimal intent-centric EOA smart account</title>
        <published>2024-11-02T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>hellohanchen</name><uri>https://github.com/hellohanchen</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7806/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7806-minimal-intent-centric-eoa-smart-account/21565" />
        

        <id>https://wg-eips.ritovision.com/7806/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7806"
            label="ERC-7806" />
        

        
        

        
        <summary type="html">Extensible intent-centric EOA smart account interface design to support batch execution, gas sponsorship and more other functionalities.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7806/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal defines a standard interface for intent-centric smart accounts. It enables externally owned accounts (EOAs) to delegate contract code to a smart account implementation, allowing them to sign intents. These intents can then be executed by solvers (or relayers) on behalf of the account owner, streamlining interactions and expanding the capabilities of EOAs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Account Abstraction (AA) is a highly discussed topic in the blockchain industry, as it enhances the programmability of accounts, enabling features such as:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Batch Execution&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Gas Sponsorship&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Access Control&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The introduction of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt; established a permissionless standard for AA, unlocking a wide range of powerful features. However, ERC-4337 has several limitations:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Complexity&lt;&#x2F;strong&gt;: The standard requires multiple interdependent components, including the Account, EntryPoint, Paymaster, Bundler, and additional plugins (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6900&#x2F;&quot;&gt;ERC-6900&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7579&#x2F;&quot;&gt;ERC-7579&lt;&#x2F;a&gt;. Running a bundler demands significant engineering expertise and introduces operational overhead.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Compatibility&lt;&#x2F;strong&gt;: Component dependencies make upgrades cumbersome, often requiring multiple smart contracts to be updated simultaneously. This creates fragmentation within the ecosystem.
one version update, also divides the ecosystem.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Cost&lt;&#x2F;strong&gt;: Processing &lt;code&gt;UserOperation&lt;&#x2F;code&gt; transactions consumes a high amount of gas.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Trust Assumption&lt;&#x2F;strong&gt;: Despite being designed as a permissionless standard, ERC-4337 still relies on centralized entities. Paymasters, for instance, are typically centralized, as they must either trust account owners to reimburse gas costs or manage external funding sources. Similarly, bundlers operate within a miner extractable value (MEV) environment, requiring users to trust them for transaction inclusion.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7521&#x2F;&quot;&gt;ERC-7521&lt;&#x2F;a&gt; introduced a smart contract account (SCA) solution with an intent-centric design. It allows solvers to fulfill account owners&#x27; intents while maintaining flexibility for custom execution logic and ensuring forward compatibility.&lt;&#x2F;p&gt;
&lt;p&gt;With the introduction of &lt;code&gt;SET_CODE_TX_TYPE=0x04&lt;&#x2F;code&gt;, EOAs can now set contract code dynamically, granting them programmability similar to SCAs. This presents an opportunity to develop a new standard that extends AA capabilities to EOAs while addressing the aforementioned challenges.&lt;&#x2F;p&gt;
&lt;p&gt;By simplifying execution, improving efficiency, and enhancing user experience, this proposal aims to accelerate the adoption of intent-centric account abstraction smart contracts.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;solvers-relayers-paymasters-and-bundlers-all-in-one&quot;&gt;Solvers, Relayers, Paymasters, and Bundlers—All in One&lt;&#x2F;h3&gt;
&lt;p&gt;In an intent-centric system, solvers play a crucial role in fulfilling user intents and are rewarded accordingly. This proposal introduces an open execution model, where any solver can participate, fostering a competitive environment that benefits users.&lt;&#x2F;p&gt;
&lt;p&gt;With integrated gas abstraction, solvers can cover gas fees using native tokens while receiving other tokens from the EOA account as compensation. Additionally, solvers can further optimize costs by bundling multiple intent executions into a single blockchain transaction.&lt;&#x2F;p&gt;
&lt;p&gt;Each solver is free to develop its own strategies for maximizing profitability. This proposal does not impose restrictions on how solvers execute intents, ensuring flexibility and adaptability in diverse execution scenarios.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT
RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;userintent-schema&quot;&gt;&lt;code&gt;UserIntent&lt;&#x2F;code&gt; schema&lt;&#x2F;h3&gt;
&lt;p&gt;Each intent is a packed data structure containing sufficient information about the operations the account owner wants to execute. The core structure of a &lt;code&gt;UserIntent&lt;&#x2F;code&gt; object is as follows:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Field&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;sender&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;address&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The address of the account initiating the intent.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;standard&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;address&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The &lt;code&gt;IStandard&lt;&#x2F;code&gt; implementation responsible for validating and parsing the &lt;code&gt;UserIntent&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;header&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;bytes&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Metadata associated with the &lt;code&gt;UserIntent&lt;&#x2F;code&gt;, interpreted by &lt;code&gt;standard&lt;&#x2F;code&gt;. Stored as bytes for flexibility.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;instructions&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;bytes[]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The execution details of the &lt;code&gt;UserIntent&lt;&#x2F;code&gt;, interpreted by &lt;code&gt;standard&lt;&#x2F;code&gt;. Stored as &lt;code&gt;bytes[]&lt;&#x2F;code&gt; to allow flexibility.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;signatures&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;bytes[]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Validatable signatures required for execution, interpreted by &lt;code&gt;standard&lt;&#x2F;code&gt;.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;fields-explanations&quot;&gt;Fields Explanations&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;header&lt;&#x2F;code&gt;: The &lt;code&gt;bytes header&lt;&#x2F;code&gt; can carry information about how to validate the intent or how to prevent
double-spending. For example, &lt;code&gt;header&lt;&#x2F;code&gt; can contain an &lt;code&gt;uint256 nonce&lt;&#x2F;code&gt; to check if the &lt;code&gt;nonce&lt;&#x2F;code&gt; is used already.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;instructions&lt;&#x2F;code&gt;: These &lt;code&gt;bytes instructions&lt;&#x2F;code&gt; can just be concatenated &lt;code&gt;(address,value,calldata)&lt;&#x2F;code&gt; or can be
standardized values, for example &lt;code&gt;(erc20TokenAddress,1000)&lt;&#x2F;code&gt; means the &lt;code&gt;instructions&lt;&#x2F;code&gt; can use up to 1000 of the
specified &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; token. It is NOT REQUIRED that all &lt;code&gt;instructions&lt;&#x2F;code&gt; MUST be provided by the EOA owner to allow dynamically carry out other operations during intent executions, but the &lt;code&gt;IStandard&lt;&#x2F;code&gt; design needs to carefully handle this case.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;signatures&lt;&#x2F;code&gt;: The &lt;code&gt;bytes signatures&lt;&#x2F;code&gt; field can support different signing methods. It is NOT REQUIRED that
all &lt;code&gt;signatures&lt;&#x2F;code&gt; MUST be provided by the EOA owner, some of them MAY be provided by solver, relayer or anyone else.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;pack-userintent-as-bytes&quot;&gt;Pack &lt;code&gt;UserIntent&lt;&#x2F;code&gt; as Bytes&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;UserIntent&lt;&#x2F;code&gt; object is packed and encoded into &lt;code&gt;bytes calldata userIntent&lt;&#x2F;code&gt;. There is no strict schema requirement for the data structure. Each &lt;code&gt;IAccount&lt;&#x2F;code&gt; and &lt;code&gt;IStandard&lt;&#x2F;code&gt; implementation can define its own encoding and decoding methods for handling the &lt;code&gt;bytes&lt;&#x2F;code&gt; data.&lt;&#x2F;p&gt;
&lt;p&gt;Here is an example of packed-encoded format:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Section&lt;&#x2F;th&gt;&lt;th&gt;Value Type&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;userIntent[0:20]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;address&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;sender&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;userIntent[20:40]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;address&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;standard&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;userIntent[40:42]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint16&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Length of &lt;code&gt;header&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;userIntent[42:44]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint16&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Length of &lt;code&gt;instructions&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;userIntent[44:46]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint16&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Length of &lt;code&gt;signatures&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Next &lt;code&gt;headerLength&lt;&#x2F;code&gt; bytes&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;bytes&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The actual &lt;code&gt;header&lt;&#x2F;code&gt; data&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Next &lt;code&gt;instructionsLength&lt;&#x2F;code&gt; bytes&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;bytes&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The actual &lt;code&gt;instructions&lt;&#x2F;code&gt; data&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Next &lt;code&gt;signatureLength&lt;&#x2F;code&gt; bytes&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;bytes&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The actual &lt;code&gt;signatures&lt;&#x2F;code&gt; data&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Remaining bytes&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;bytes&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Extra data, such as nested intents for further execution&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;istandard-interface&quot;&gt;&lt;code&gt;IStandard&lt;&#x2F;code&gt; Interface&lt;&#x2F;h3&gt;
&lt;p&gt;Each standard defines how to parse and validate a &lt;code&gt;UserIntent&lt;&#x2F;code&gt;. Implementations of standard must conform to the &lt;code&gt;IStandard&lt;&#x2F;code&gt; interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IStandard&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Validate user&amp;#39;s intent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; returning validation result, the type uses bytes4 for extensibility purpose&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; result&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; values representing validation outcomes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validateUserIntent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; intent&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Unpack user&amp;#39;s intent, it is RECOMMENDED to validate intent while unpacking to save gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; returning unpacked result, the type uses bytes for extensibility purpose&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; result&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; unpacked result status&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; operations&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; unpacked operations that can be executed by the IAccount, NOT REQUIRED to match UserIntent.instructions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; unpackOperations&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; intent&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; result&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operations&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;IStandard&lt;&#x2F;code&gt; interface is responsible for defining and enforcing the validation logic for &lt;code&gt;UserIntent&lt;&#x2F;code&gt; objects.&lt;&#x2F;p&gt;
&lt;p&gt;It operates similarly to the &lt;code&gt;EntryPoint&lt;&#x2F;code&gt; in ERC-4337 and ERC-7521.&lt;&#x2F;p&gt;
&lt;p&gt;The extensibility of &lt;code&gt;bytes4&lt;&#x2F;code&gt; return types allows future upgrades without modifying the function signatures.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;iaccount-interface&quot;&gt;&lt;code&gt;IAccount&lt;&#x2F;code&gt; Interface&lt;&#x2F;h3&gt;
&lt;p&gt;On the account side, &lt;code&gt;IAccount&lt;&#x2F;code&gt; provides the interface for executing &lt;code&gt;bytes calldata intent&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IAccount&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Execute user&amp;#39;s intent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; returning execution result, the type uses bytes for extensibility purpose&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; result&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; values representing execution outcomes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; executeUserIntent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; intent&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Using &lt;code&gt;SET_CODE_TX_TYPE=0x04&lt;&#x2F;code&gt;, EOAs can delegate contract code to an &lt;code&gt;IAccount&lt;&#x2F;code&gt; implementation, enabling them to function as smart accounts. A single account implementation can be shared across multiple EOAs, meaning:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;It only needs to be deployed and audited once.&lt;&#x2F;li&gt;
&lt;li&gt;Each EOA owner is responsible for delegating their account to a secure &lt;code&gt;IAccount&lt;&#x2F;code&gt; implementation.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;It is RECOMMENDED that each account leverages &lt;code&gt;IStandard&lt;&#x2F;code&gt; to validate and unpack operations, check &lt;strong&gt;Reference
Implementation&lt;&#x2F;strong&gt; for examples. Account smart contract can be stateless to avoid sharing storage space with other delegated contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;usage-of-bytes&quot;&gt;Usage of Bytes&lt;&#x2F;h3&gt;
&lt;p&gt;Defining &lt;code&gt;UserIntent&lt;&#x2F;code&gt; object as a struct would improve readability and make it easier to work with in Solidity. For example:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UserIntent&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; standard&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span&gt; header&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; instructions&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; signatures&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;However, this approach has several drawbacks:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Mandating all &lt;code&gt;IAccount&lt;&#x2F;code&gt; and &lt;code&gt;IStandard&lt;&#x2F;code&gt; implementations to follow this specific struct format reduces flexibility.&lt;&#x2F;li&gt;
&lt;li&gt;The use of &lt;code&gt;bytes[]&lt;&#x2F;code&gt; introduces additional gas costs due to Solidity&#x27;s dynamic array encoding.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Since all objects within the UserIntent structure are optional and their usage depends on &lt;code&gt;IStandard&lt;&#x2F;code&gt; and &lt;code&gt;IAccount&lt;&#x2F;code&gt; implementations, the bytes format ensures maximum flexibility while preserving compatibility.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;execution-in-eoa-contract-code&quot;&gt;Execution in EOA Contract Code&lt;&#x2F;h3&gt;
&lt;p&gt;With &lt;code&gt;SET_CODE_TX_TYPE=0x04&lt;&#x2F;code&gt;, EOAs gain the ability to execute contract code. Executing transactions directly from an EOA provides several key benefits:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Preserves EOA Control&lt;&#x2F;strong&gt;: Execution remains fully controlled by the account owner. If needed, the EOA owner can easily disable all smart contract functionalities by un-delegating the contract code.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Consistent &lt;code&gt;msg.sender&lt;&#x2F;code&gt; Behavior&lt;&#x2F;strong&gt;: Since the execution originates from an EOA, &lt;code&gt;msg.sender&lt;&#x2F;code&gt; always resolves to the EOA address, simplifying authentication and permission checks.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Stateless Execution&lt;&#x2F;strong&gt;: The execution logic can be designed to be stateless, allowing the &lt;code&gt;IAccount&lt;&#x2F;code&gt; implementation to avoid storing persistent data, reducing storage costs.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;If an EOA does not require smart contract execution, or if executing an intent is too expensive, the owner can still use the account as a regular EOA without any modifications.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;validation-in-the-standard-contract&quot;&gt;Validation in the Standard Contract&lt;&#x2F;h3&gt;
&lt;p&gt;Validation logic often relies on contract state. For example, a weighted multi-owner signature scheme needs to track the weight assigned to each signer. Keeping intent validation entirely within &lt;code&gt;IStandard&lt;&#x2F;code&gt; offers multiple advantages:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Simplified Implementation&lt;&#x2F;strong&gt;: By mirroring the &lt;code&gt;EntryPoint&lt;&#x2F;code&gt; concept from ERC-4337 but in a simpler form, &lt;code&gt;IStandard&lt;&#x2F;code&gt; focuses solely on validation.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Easier Auditing and Maintenance&lt;&#x2F;strong&gt;: Since &lt;code&gt;IStandard&lt;&#x2F;code&gt; is responsible only for validation, it becomes easier for contract engineers to implement, audit, and maintain.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Modular Validation&lt;&#x2F;strong&gt;: The &lt;code&gt;IStandard&lt;&#x2F;code&gt; interface is inherently modular, allowing for more complex validation mechanisms. For instance, a &quot;compound&quot; standard could decompose an intent into smaller components, validate each separately, and then combine the results.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;gas-abstraction&quot;&gt;Gas Abstraction&lt;&#x2F;h3&gt;
&lt;p&gt;This design enables gasless transactions by allowing any address to initiate a transaction on behalf of the intent&#x27;s sender.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The sender can specify how and what to pay in the intent’s &lt;code&gt;header&lt;&#x2F;code&gt; or &lt;code&gt;instructions&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Payments can be made in any token from the sender’s account.&lt;&#x2F;li&gt;
&lt;li&gt;The transaction cost can be covered by transferring tokens from the sender’s account to &lt;code&gt;tx.origin&lt;&#x2F;code&gt; (the address submitting the transaction).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;no-re-entry-protection-enforced&quot;&gt;No re-entry protection enforced&lt;&#x2F;h3&gt;
&lt;p&gt;This proposal does not enforce built-in re-entry protection mechanisms such as nonces. The rationale behind this decision is that certain intents are inherently designed to be executed multiple times.&lt;&#x2F;p&gt;
&lt;p&gt;Instead of a global re-entry protection mechanism, each standard should define its own protection rules based on its intended use case. Implementers are encouraged to:&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This &lt;code&gt;IAccount&lt;&#x2F;code&gt; standard shares the same backwards compatibility considerations as the introduction of EOA contract code execution (&lt;code&gt;SET_CODE_TX_TYPE=0x04&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;helper-library&quot;&gt;Helper Library&lt;&#x2F;h3&gt;
&lt;p&gt;This &lt;code&gt;PackedIntent&lt;&#x2F;code&gt; is a library to decode &lt;code&gt;(address sender, address standard, uint16 headerLength, uint16 instructionsLength, uint16 signaturesLength)&lt;&#x2F;code&gt; from a packed encoded intent. The following &lt;code&gt;IAccount&lt;&#x2F;code&gt; and &lt;code&gt;IStandrd&lt;&#x2F;code&gt; implementations both follow &lt;code&gt;PackedIntent&lt;&#x2F;code&gt; schema.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; PackedIntent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This is a library that packs metadata of intent (sender, standard, lengths) into bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the packed intent data schema is defined as follows:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 1. sender: address, 20-bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 2. standard: address, 20-bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 3. headerLength: uint16, 2-bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 4. instructionLength: uint16, 2-bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 5. signatureLength: uint16, 2-bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;library&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PackedIntent&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; getSenderAndStandard is a function that gets the sender and standard from the intent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; intent&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The intent to get the sender and standard from&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The sender of the intent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; standard&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The standard of the intent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getSenderAndStandard&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; intent&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;intent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 40&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Intent too short&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;intent&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 20&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;intent&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;20&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; :&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 40&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; getLengths is a function that gets the lengths from the intent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; intent&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The intent to get the lengths from&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; headerLength&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The length of the header&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; instructionLength&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The length of the instructions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; signatureLength&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The length of the signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getLengths&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; intent&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;intent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 46&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Missing length section&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint16&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;intent&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;40&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; :&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 42&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint16&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;intent&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;42&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; :&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 44&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint16&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;intent&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;44&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; :&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 46&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; getSignatureLength is a function that gets the signature length from the intent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; intent&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The intent to get the signature length from&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; signatureLength&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The length of the signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getSignatureLength&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; intent&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;intent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 46&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Missing length section&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint16&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;intent&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;44&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; :&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 46&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; getIntentLength is a function that gets the intent length from the intent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; intent&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The intent to get the intent length from&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; result&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The sum of header, instruction and signature lengths&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getIntentLength&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; intent&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;intent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 46&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Missing length section&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; headerLength &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint16&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;intent&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;40&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; :&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 42&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; instructionLength &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint16&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;intent&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;42&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; :&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 44&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; signatureLength &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint16&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;intent&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;44&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; :&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 46&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; headerLength &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt; instructionLength &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt; signatureLength &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 46&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; getIntentLengthFromSection is a function that gets the intent length from the length section&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; lengthSection&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The length section to get the intent length from&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; result&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The sum of header, instruction and signature lengths&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getIntentLengthFromSection&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes6&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; lengthSection&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint16&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            let&lt;&#x2F;span&gt;&lt;span&gt; value &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span&gt; lengthSection&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            let&lt;&#x2F;span&gt;&lt;span&gt; a &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; shr&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;240&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Extract first 2 bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            let&lt;&#x2F;span&gt;&lt;span&gt; b &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; and&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;shr&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;224&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xFFFF&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Extract next 2 bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            let&lt;&#x2F;span&gt;&lt;span&gt; c &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; and&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;shr&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;208&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xFFFF&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Extract last 2 bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            result &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;a&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; b&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; c&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 46&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;relayed-execution-standard&quot;&gt;Relayed Execution Standard&lt;&#x2F;h3&gt;
&lt;p&gt;This &lt;code&gt;RelayedExecutionStandard&lt;&#x2F;code&gt; allows relayer to execute the operations on chain and take &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; token from the intent sender, thus achieve a gas-less experience for the sender.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;MessageHashUtils&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;import &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ECDSA&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;import &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC20&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;import &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IStandard&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;import &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IAccount&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;import &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;PackedIntent&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @title ERC7806Constants&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @notice This is a library that defines the constants for the ERC7806 standard&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;library ERC7806Constants &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; VALIDATION_DENIED&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; magic&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; of&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; denied&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; intent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; VALIDATION_DENIED&lt;&#x2F;span&gt;&lt;span&gt; = &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x00000000&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; VALIDATION_APPROVED&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; magic&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; of&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validated&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; intent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; VALIDATION_APPROVED&lt;&#x2F;span&gt;&lt;span&gt; = &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x00000001&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;abstract contract HashGatedStandard is IStandard &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; HashUsed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt; =&amp;gt; &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;) &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _hashes&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checkHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span&gt;) &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; compositeKey&lt;&#x2F;span&gt;&lt;span&gt; = &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;hash&lt;&#x2F;span&gt;&lt;span&gt;));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _hashes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;compositeKey&lt;&#x2F;span&gt;&lt;span&gt;];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function markHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;uint256 hash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; external &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; compositeKey&lt;&#x2F;span&gt;&lt;span&gt; = &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;hash&lt;&#x2F;span&gt;&lt;span&gt;));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _hashes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;compositeKey&lt;&#x2F;span&gt;&lt;span&gt;] = &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; HashUsed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;hash&lt;&#x2F;span&gt;&lt;span&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;*&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;RelayedExecutionStandard&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;This standard allows sender to define a list of execution instructions and asks the relayer to execute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;on chain on behalf of the sender&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt; It is hash and time gated means the intent can only be executed before&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;a timestamp and can only be executed once&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;The first 20 bytes of the `intent` is sender address&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;The next 20 bytes of the `intent` is the standard address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; which should be equal to address of this standard&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;The following is the length section&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; containing 3 uint16 defining header length&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; instructions length and signature length&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;The header is either 8 bytes long or 28 bytes long&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;The 8-byte part is the timestamp in epoch seconds&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;The optional 20-byte defines the assigned relayer address if the sender only wants a specific relayer to execute&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;The instructions contains 2 main part&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;The first 36 bytes is a packed encoded &lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; uint128&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; pair representing the &lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;#39;payment&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt; that the sender will pay to the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;relayer&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt; It should be an ERC20 token&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;The following 1-byte is an uint8 defining the number of instructions to execute&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;The instructions are concatenated together&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; the first 2 bytes &lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;uint16&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; defines the length of each instruction&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; the following&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;is the instruction body&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt; Instructions should be abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; which can directly be executed by&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;the sender account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;The signature field is always 65 bytes long&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt; It contains the signed bytes&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;concat&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; instructions&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;contract RelayedExecutionStandard is HashGatedStandard &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    using&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ECDSA&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; for&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ICS_NUMBER&lt;&#x2F;span&gt;&lt;span&gt; = &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ICS1&lt;&#x2F;span&gt;&lt;span&gt;&amp;quot;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DESCRIPTION&lt;&#x2F;span&gt;&lt;span&gt; = &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Timed&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Hashed&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Relayed&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Execution&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Standard&lt;&#x2F;span&gt;&lt;span&gt;&amp;quot;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; VERSION&lt;&#x2F;span&gt;&lt;span&gt; = &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;&amp;quot;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AUTHOR&lt;&#x2F;span&gt;&lt;span&gt; = &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;hellohanchen&lt;&#x2F;span&gt;&lt;span&gt;&amp;quot;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validateUserIntent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; intent&lt;&#x2F;span&gt;&lt;span&gt;) &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span&gt;) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; standard&lt;&#x2F;span&gt;&lt;span&gt;) = &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;PackedIntent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getSenderAndStandard&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;intent&lt;&#x2F;span&gt;&lt;span&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;standard&lt;&#x2F;span&gt;&lt;span&gt; == &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;), &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Not&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; this&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; standard&lt;&#x2F;span&gt;&lt;span&gt;&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; headerLength&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; instructionsLength&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; signatureLength&lt;&#x2F;span&gt;&lt;span&gt;) = &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;PackedIntent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getLengths&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;intent&lt;&#x2F;span&gt;&lt;span&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;headerLength&lt;&#x2F;span&gt;&lt;span&gt; == &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;28&lt;&#x2F;span&gt;&lt;span&gt; || &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;headerLength&lt;&#x2F;span&gt;&lt;span&gt; == &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;8&lt;&#x2F;span&gt;&lt;span&gt;, &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Invalid&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; header&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; length&lt;&#x2F;span&gt;&lt;span&gt;&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;instructionsLength&lt;&#x2F;span&gt;&lt;span&gt; &amp;gt;= &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;36&lt;&#x2F;span&gt;&lt;span&gt;, &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Instructions&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; too&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; short&lt;&#x2F;span&gt;&lt;span&gt;&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;signatureLength&lt;&#x2F;span&gt;&lt;span&gt; == &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;65&lt;&#x2F;span&gt;&lt;span&gt;, &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Invalid&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; length&lt;&#x2F;span&gt;&lt;span&gt;&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &#x2F;&#x2F; &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;end&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; of&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; instructions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; instructionsEndIndex&lt;&#x2F;span&gt;&lt;span&gt; = &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;46&lt;&#x2F;span&gt;&lt;span&gt; + &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;headerLength&lt;&#x2F;span&gt;&lt;span&gt; + &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;instructionsLength&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;instructionsLength&lt;&#x2F;span&gt;&lt;span&gt; + &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;signatureLength&lt;&#x2F;span&gt;&lt;span&gt; == &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;intent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;, &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Invalid&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; intent&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; length&lt;&#x2F;span&gt;&lt;span&gt;&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &#x2F;&#x2F; &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;validate&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span&gt; = &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_validateSignatures&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;intent&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;instructionsEndIndex&lt;&#x2F;span&gt;&lt;span&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(!&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;checkHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;hash&lt;&#x2F;span&gt;&lt;span&gt;), &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; already&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; executed&lt;&#x2F;span&gt;&lt;span&gt;&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &#x2F;&#x2F; &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;header&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; contains&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; expiration&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; timestamp&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; and&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; assigned&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; relayer&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;optional&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;bytes8&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;intent&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;46&lt;&#x2F;span&gt;&lt;span&gt; : &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;54&lt;&#x2F;span&gt;&lt;span&gt;]))) &amp;gt;= &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;timestamp&lt;&#x2F;span&gt;&lt;span&gt;, &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Intent&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; expired&lt;&#x2F;span&gt;&lt;span&gt;&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &#x2F;&#x2F; &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;assignedRelayerAddress&lt;&#x2F;span&gt;&lt;span&gt; = &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;intent&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;54&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;74&lt;&#x2F;span&gt;&lt;span&gt;]) [&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;optional&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &#x2F;&#x2F; &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;end&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; of&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; header&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; section&lt;&#x2F;span&gt;&lt;span&gt; &#x2F; &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;begin&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; of&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; instruction&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; section&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; headerEndIndex&lt;&#x2F;span&gt;&lt;span&gt; = &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;46&lt;&#x2F;span&gt;&lt;span&gt; + &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;headerLength&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &#x2F;&#x2F; &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;first&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; 20&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; of&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; instruction&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; out&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; token&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; outTokenAddress&lt;&#x2F;span&gt;&lt;span&gt; = &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;bytes20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;intent&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;headerEndIndex&lt;&#x2F;span&gt;&lt;span&gt; : &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;headerEndIndex&lt;&#x2F;span&gt;&lt;span&gt; + &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;20&lt;&#x2F;span&gt;&lt;span&gt;]));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &#x2F;&#x2F; &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;out&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; token&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;use&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; uint128&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; shorten&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; intent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; outTokenAmount&lt;&#x2F;span&gt;&lt;span&gt; = &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;uint128&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;bytes16&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;intent&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;headerEndIndex&lt;&#x2F;span&gt;&lt;span&gt; + &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;20&lt;&#x2F;span&gt;&lt;span&gt; : &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;headerEndIndex&lt;&#x2F;span&gt;&lt;span&gt; + &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;36&lt;&#x2F;span&gt;&lt;span&gt;])));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;outTokenAddress&lt;&#x2F;span&gt;&lt;span&gt; != &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;) = &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;outTokenAddress&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;staticcall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;                abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodeWithSelector&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC20&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;balanceOf&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;selector&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            );&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; (!&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;success&lt;&#x2F;span&gt;&lt;span&gt; || &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt; != &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;                revert&lt;&#x2F;span&gt;&lt;span&gt;(&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Not&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC20&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;decode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &amp;gt;= outTokenAmount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Insufficient token balance&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balance &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; outTokenAmount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Insufficient eth balance&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; end of outToken instruction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; numExecutions &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes1&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;intent&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;headerEndIndex &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 36&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; :&lt;&#x2F;span&gt;&lt;span&gt; headerEndIndex &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 37&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; instruction index&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; instructionIndex &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; begin of the first instruction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; instructionStart&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; instructionEnd &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; headerEndIndex &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 37&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        while&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;instructionIndex &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; numExecutions&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            instructionStart &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; instructionEnd&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;instructionStart &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; instructionsEndIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Intent too short: instruction length&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; end of this execution instruction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            instructionEnd &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; instructionStart &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint16&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;intent&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;instructionStart &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; instructionStart &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;instructionEnd &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; instructionsEndIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Intent too short: single instruction&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            instructionIndex &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;instructionEnd &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; instructionsEndIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Intent length doesn&amp;#39;t match&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; ERC7806Constants&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;VALIDATION_APPROVED&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; unpackOperations&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; intent&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; code&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; unpackedInstructions&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt; standard&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; PackedIntent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getSenderAndStandard&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;intent&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;standard &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Not this standard&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; headerLength&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt; instructionsLength&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt; signatureLength&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; PackedIntent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getLengths&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;intent&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;headerLength &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 28&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span&gt; headerLength &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Invalid header length&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;instructionsLength &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 36&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Instructions too short&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signatureLength &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 65&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Invalid signature length&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; end of instructions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; instructionsEndIndex &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 46&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; headerLength &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt; instructionsLength&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;instructionsLength &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt; signatureLength &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; intent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Invalid intent length&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; fetch header content (timestamp, relayer address [optional])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes8&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;intent&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;46&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; :&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 54&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Intent expired&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;headerLength &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 28&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; assigned relayer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;origin &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;intent&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;54&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; :&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 74&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Invalid relayer&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; intentHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _validateSignatures&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; intent&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; instructionsEndIndex&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;checkHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; intentHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Hash is already executed&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; begin of instructions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; headerEndIndex &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; headerLength &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 46&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; total instructions = mark hash + transfer token to relayer + executions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the first 36 bytes defines the payment to relayer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the next 1 byte defines the number of execution instructions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        unpackedInstructions &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;[](&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt; + &lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bytes1&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;intent&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;headerEndIndex&lt;&#x2F;span&gt;&lt;span&gt; + &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;36&lt;&#x2F;span&gt;&lt;span&gt; : &lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;headerEndIndex&lt;&#x2F;span&gt;&lt;span&gt; + &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;37&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; first instruction is mark hash to prevent re-entry attack&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        unpackedInstructions&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodeWithSelector&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;markHash&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; intentHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the first 20 bytes of instructions is the out token address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; outTokenAddress &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;intent&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;headerEndIndex &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; headerEndIndex &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 20&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; outTokenAmount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint128&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes16&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;intent&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;headerEndIndex &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 20&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; :&lt;&#x2F;span&gt;&lt;span&gt; headerEndIndex &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 36&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; out token instruction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;outTokenAddress &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            unpackedInstructions&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;origin&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; outTokenAmount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            unpackedInstructions&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                outTokenAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;                abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodeWithSelector&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;IERC20&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;transfer&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;origin&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; outTokenAmount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; instruction index&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; instructionIndex &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; instructionEndIndex &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; headerEndIndex &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 37&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; instructionStartIndex&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        while&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;instructionIndex &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; unpackedInstructions&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; start of next execution instruction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            instructionStartIndex &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; instructionEndIndex&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;instructionStartIndex &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; instructionEndIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Intent too short: instruction length&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; end of next execution instruction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            instructionEndIndex &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; instructionStartIndex &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint16&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;intent&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;instructionStartIndex &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; instructionStartIndex &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;instructionEndIndex &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; instructionsEndIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Intent too short: single instruction&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            unpackedInstructions&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;instructionIndex&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; intent&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;instructionStartIndex &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; :&lt;&#x2F;span&gt;&lt;span&gt; instructionEndIndex&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            instructionIndex &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;instructionEndIndex &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; instructionsEndIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Intent length doesn&amp;#39;t match&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;ERC7806Constants&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;VALIDATION_APPROVED&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; unpackedInstructions&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _validateSignatures&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; intent&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sigStartIndex&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; intentHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;intent&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;46&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; :&lt;&#x2F;span&gt;&lt;span&gt; sigStartIndex&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;chainid&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; messageHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; MessageHashUtils&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;toEthSignedMessageHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;intentHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sender &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; messageHash&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;recover&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;intent&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;sigStartIndex &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; sigStartIndex &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 65&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Invalid sender signature&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;intentHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; -------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The following methods will be removed after testing&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; -------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; sampleIntent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; relayer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; outTokenAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint128&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; outAmount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; executions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; intent&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; intentHash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; header &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; relayer &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ?&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 31536000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xFFFFFFFFFFFFFFFF&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; :&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 31536000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xFFFFFFFFFFFFFFFF&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; relayer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; instructions &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;concat&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;outTokenAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes16&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;outAmount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes1&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;executions&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; executions&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            uint16&lt;&#x2F;span&gt;&lt;span&gt; length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint16&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;executions&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            instructions &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;concat&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;instructions&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; executions&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; toSign &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;concat&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; instructions&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        intentHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;toSign&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;chainid&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        intent &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;concat&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint16&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint16&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;instructions&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint16&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;65&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; toSign&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;intent&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; intentHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; sampleERC20Execution&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; receiver&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;token &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;receiver&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodeWithSelector&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;IERC20&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;transfer&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;receiver&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; executeUserIntent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; intent&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; PackedIntent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getSenderAndStandard&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;intent&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; executeCallData &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodeWithSelector&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;IAccount&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;executeUserIntent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; intent&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;call&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;value &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; gas &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; gasleft&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;executeCallData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; result&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;sample-account&quot;&gt;Sample Account&lt;&#x2F;h3&gt;
&lt;p&gt;The following &lt;code&gt;IAccount&lt;&#x2F;code&gt; implementation uses a &lt;code&gt;StandardRegistry&lt;&#x2F;code&gt; to maintain allowlist of standards and just batch execute
all operations returned from &lt;code&gt;IStandard.unpackOperations&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;MessageHashUtils&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;utils&#x2F;cryptography&#x2F;MessageHashUtils.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ECDSA&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;utils&#x2F;cryptography&#x2F;ECDSA.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; StandardRegistry&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This is a registry for standards, determining whether an account accepts a standard&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; EIP-712 is used for signature verification&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; StandardRegistry&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    using&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ECDSA&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The event emitted when a standard is registered&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; StandardRegistered&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signer&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; standard&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The event emitted when a standard is unregistered&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; StandardUnregistered&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signer&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; standard&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The domain separator of this contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; immutable&lt;&#x2F;span&gt;&lt;span&gt; DOMAIN_SEPARATOR&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The type hash of the signed data of this contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; immutable&lt;&#x2F;span&gt;&lt;span&gt; SIGNED_DATA_TYPEHASH&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The mapping of nonces&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt; nonce &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt; used&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _nonces&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The mapping of registrations&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt; standard &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt; registered&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _registrations&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The constructor of this contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        DOMAIN_SEPARATOR &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;StandardRegistry&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Contract name&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;2&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Version&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;                block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;chainid&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Chain ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Contract address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        SIGNED_DATA_TYPEHASH &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;Permission(bool registering,address standard,uint256 nonce)&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The function to permit a standard, allowing a relayer to register or unregister a standard for a user&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; registering&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Whether registering or unregistering&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; signer&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The signer of the permission&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; standard&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The standard to permit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The nonce of the permission&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The signature of the permission&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; permit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; registering&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; standard&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; compositeKey &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;_nonces&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;compositeKey&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Invalid nonce&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; validate signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; structHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;SIGNED_DATA_TYPEHASH&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; registering&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; standard&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; digest &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; MessageHashUtils&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;toTypedDataHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;DOMAIN_SEPARATOR&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; structHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signer &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; digest&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;recover&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Invalid signature&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _process&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;registering&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; standard&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The function to update a standard registration directly&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; registering&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Whether registering or unregistering&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; standard&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The standard to update&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The nonce of the update&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; update&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; registering&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; standard&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; signer &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; compositeKey &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;_nonces&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;compositeKey&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Invalid nonce&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _process&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;registering&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; standard&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The function to check if a nonce is used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; signer&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The signer of the nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The nonce to check&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; result&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; true if the nonce is used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isNonceUsed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; compositeKey &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _nonces&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;compositeKey&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The function to check if a standard is registered&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; signer&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The signer of the standard&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; standard&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The standard to check&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; result&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; true if the standard is registered&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isRegistered&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; standard&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; compositeKey &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; standard&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _registrations&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;compositeKey&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The function to process a standard registration or unregistration&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; registering&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Whether registering or unregistering&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; signer&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The signer of the registration&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; standard&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The standard to process&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The nonce of the registration&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _process&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; registering&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; standard&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; compositeKey &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; standard&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;registering&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            _registrations&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;compositeKey&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; StandardRegistered&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; standard&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            _registrations&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;compositeKey&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; StandardUnregistered&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; standard&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        compositeKey &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _nonces&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;compositeKey&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AccountImplV0&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; DESCRIPTION &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Account with Batch Execution, Standard Registry&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; VERSION &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;0.0.0&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; AUTHOR &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;hellohanchen&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    StandardRegistry &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; REGISTRY &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; StandardRegistry&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; VALIDATION_APPROVED &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x00000001&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; VALIDATION_DENIED &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x00000000&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; executeOtherIntent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; intent&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt; standard&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; PackedIntent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getSenderAndStandard&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;intent&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sender &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Intent is not from this account&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;REGISTRY&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isRegistered&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; standard&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Standard not registered&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; standard validation and unpack&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span&gt; validationCode&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; instructions&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IStandard&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;standard&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;unpackOperations&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;intent&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;validationCode &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; VALIDATION_APPROVED&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Validation failed&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; batch execute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; instructions&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; dest&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;decode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;instructions&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt; success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; dest&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;call&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;value &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; gas &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; gasleft&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                revert&lt;&#x2F;span&gt;&lt;span&gt; SelfExecutableAccount&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ExecutionError&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    receive&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;As shown above, the implementation of &lt;code&gt;IAccount&lt;&#x2F;code&gt; is stateless and simple, so that it can be compatible with different &lt;code&gt;IStandard&lt;&#x2F;code&gt;.
While the &lt;code&gt;IStandard&lt;&#x2F;code&gt; implementation is complex because it needs to define its own schema. But both contracts will be public
and audited, to ensure the security of intent execution.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The security of this standard primarily depends on the implementation of both &lt;code&gt;IStandard&lt;&#x2F;code&gt; and &lt;code&gt;IAccount&lt;&#x2F;code&gt;. Each component must ensure that user intents are validated and executed safely. Additionally, solvers are responsible for securing their own execution environments to prevent unintended exploits.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;auditability-of-both-validation-and-execution&quot;&gt;Auditability of both Validation and Execution&lt;&#x2F;h3&gt;
&lt;p&gt;To ensure security and maintain ecosystem integrity, it is critical that both the standard (&lt;code&gt;IStandard&lt;&#x2F;code&gt;) and account (&lt;code&gt;IAccount&lt;&#x2F;code&gt;) implementations are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Publicly auditable&lt;&#x2F;strong&gt;: Open access to contract code allows security researchers to identify potential vulnerabilities.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Well-reviewed and shared&lt;&#x2F;strong&gt;: Public discussions and peer reviews help strengthen security assumptions.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Secure against compatibility risks&lt;&#x2F;strong&gt;: Ensuring compatibility between different standard and account implementations can prevent unintended interactions that may lead to exploits.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;delegated-contract-storage-risks&quot;&gt;Delegated Contract Storage Risks&lt;&#x2F;h3&gt;
&lt;p&gt;If an &lt;code&gt;IAccount&lt;&#x2F;code&gt; implementation maintains state (instead of being stateless), it could:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Interfere with other delegated contracts sharing the same storage.&lt;&#x2F;li&gt;
&lt;li&gt;Be manipulated by unauthorized users if storage is not properly protected.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Strongly RECOMMEND stateless execution to prevent storage conflicts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Fork-choice enforced Inclusion Lists (FOCIL)</title>
        <published>2024-11-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Thomas Thiery</name><uri>https://github.com/soispoke</uri><email>thomas.thiery@ethereum.org</email>
	</author>
	
	<author>
		<name>Francesco D&#x27;Amato</name><email>francesco.damato@ethereum.org</email>
	</author>
	
	<author>
		<name>Julian Ma</name><email>julian.ma@ethereum.org</email>
	</author>
	
	<author>
		<name>Barnabé Monnot</name><email>barnabe.monnot@ethereum.org</email>
	</author>
	
	<author>
		<name>Terence Tsao</name><email>ttsao@offchainlabs.com</email>
	</author>
	
	<author>
		<name>Jacob Kaufmann</name><email>jacob.kaufmann@ethereum.org</email>
	</author>
	
	<author>
		<name>Jihoon Song</name><email>jihoon.song@ethereum.org</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7805/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7805-committee-based-fork-choice-enforced-inclusion-lists-focil/21578" />
        

        <id>https://wg-eips.ritovision.com/7805/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7805"
            label="EIP-7805" />
        

        
        

        
        <summary type="html">Allow a committee of validators to force-include a set of transactions in every block</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7805/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;FOCIL implements a robust mechanism to preserve Ethereum’s censorship resistance properties by guaranteeing timely transaction inclusion.&lt;&#x2F;p&gt;
&lt;p&gt;FOCIL (&lt;strong&gt;Fo&lt;&#x2F;strong&gt;rk-&lt;strong&gt;c&lt;&#x2F;strong&gt;hoice enforced &lt;strong&gt;I&lt;&#x2F;strong&gt;nclusion &lt;strong&gt;L&lt;&#x2F;strong&gt;ists) is built in a few simple steps:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;In each slot, a set of validators is selected as inclusion list (IL) committee members. Each member builds and gossips one IL according to their subjective view of the mempool.&lt;&#x2F;li&gt;
&lt;li&gt;The proposer and all attesters of the next slot monitor, store and forward available ILs.&lt;&#x2F;li&gt;
&lt;li&gt;The proposer (or the builder if the block is not built locally by the proposer) includes transactions from all collected ILs in its block. The proposer then broadcasts the block including IL transactions to the rest of the network.&lt;&#x2F;li&gt;
&lt;li&gt;Attesters only vote for the proposer&#x27;s block if it includes transactions from all stored ILs.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;In an effort to shield the Ethereum validator set from centralizing forces, the right to build blocks has been auctioned off to specialized entities known as &lt;em&gt;builders&lt;&#x2F;em&gt;. This has led to a few sophisticated builders dominating block production, leading to a deterioration of the network’s censorship resistance properties. To address this issue, research has focused on improving Ethereum&#x27;s transaction inclusion guarantees by enabling validators to impose constraints on builders. This is achieved by force-including transactions in blocks via ILs.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;high-level-overview&quot;&gt;High-level Overview&lt;&#x2F;h3&gt;
&lt;p&gt;FOCIL is a committee-based, fork-choice enforced inclusion list (IL) design that improves upon previous IL mechanisms and block co-creation proposals. It addresses issues related to bribing&#x2F;extortion attacks, IL equivocation, account abstraction (AA), and transaction invalidation.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7805&#x2F;.&#x2F;assets&#x2F;diagram_FOCIL.png&quot; alt=&quot;FOCIL diagram&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;roles-and-participants&quot;&gt;Roles And Participants&lt;&#x2F;h3&gt;
&lt;p&gt;This section outlines the workflow of FOCIL, detailing the roles and responsibilities of various participants: IL committee members, validators, builders, proposers and attesters.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;il-committee-members&quot;&gt;IL Committee Members&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;Slot N&lt;&#x2F;code&gt;, &lt;code&gt;t=0 to 8s&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;:
IL committee members construct their ILs by including transactions pending in the public mempool, and broadcast them over the P2P network after processing the block for &lt;code&gt;slot N&lt;&#x2F;code&gt; and confirming it as the head. If no block is received by &lt;code&gt;t=7s&lt;&#x2F;code&gt;, they should run &lt;code&gt;get_head&lt;&#x2F;code&gt; and build and release their ILs based on the node’s local head.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;IL committee members may follow different strategies for constructing their ILs as discussed in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7805&#x2F;#il-building&quot;&gt;IL Building&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;validators&quot;&gt;Validators&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;Slot N&lt;&#x2F;code&gt;, &lt;code&gt;t=0s to 9s&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: Validators receive ILs from the P2P network and store (1) all new ILs that pass the CL P2P validation rules, and (2) any evidence of IL equivocation by committee members (i.e., if multiple ILs are received from the same committee member).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;Slot N&lt;&#x2F;code&gt;, &lt;code&gt;t=9s&lt;&#x2F;code&gt; to &lt;code&gt;Slot N+1&lt;&#x2F;code&gt;, &lt;code&gt;t=4s&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: After the view freeze deadline at &lt;code&gt;t=9s&lt;&#x2F;code&gt;, validators:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Do not store new ILs received after the deadline.&lt;&#x2F;li&gt;
&lt;li&gt;Continue forwarding ILs to peers following the CL P2P validation rules.&lt;&#x2F;li&gt;
&lt;li&gt;Record any evidence of IL equivocation that occurs after the view freeze deadline.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;After the attestation deadline of &lt;strong&gt;&lt;code&gt;Slot N+1&lt;&#x2F;code&gt;, &lt;code&gt;t=4s&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;, validators ignore any new ILs related to the previous slot&#x27;s IL committee, and stop recording equivocation evidence for the previous slot&#x27;s ILs.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;builder&quot;&gt;Builder&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;Slot N&lt;&#x2F;code&gt;, &lt;code&gt;t=0s to 11s&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: The builder (i.e., a proposer doing local block building or an external builder) receives ILs from the P2P network, forwarding and caching those that pass the CL P2P validation rules. Optionally, an RPC endpoint can be added to allow the builder to request missing ILs from its peers (e.g., by committee index at &lt;code&gt;t=10s&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;Slot N&lt;&#x2F;code&gt;, &lt;code&gt;t=11s&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;:
The builder freezes its view of ILs and asks the EL to update its execution payload by adding transactions from its view (the exact timings will be defined after running some tests&#x2F;benchmarks).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;proposer&quot;&gt;Proposer&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;Slot N+1&lt;&#x2F;code&gt;, &lt;code&gt;t=0s&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;:
The proposer broadcasts its block with the up-to-date execution payload satisfying IL transactions over the P2P network.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;attesters&quot;&gt;Attesters&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;Slot N+1&lt;&#x2F;code&gt;, &lt;code&gt;t=4s&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;:
Attesters monitor the P2P network for the proposer’s block. Upon detecting it, they verify whether all transactions from their stored ILs are included in the proposer’s execution payload, except for ILs whose sender has equivocated. Based on their frozen view of the ILs from &lt;code&gt;t=9s&lt;&#x2F;code&gt; in the previous slot, attesters check if the execution payload satisfies IL conditions. This is done either by confirming that all transactions are present or by determining if any missing transactions are invalid when appended to the end of the payload. In such cases, attesters use the EL to perform nonce and balance checks to validate the missing transactions and check whether there is enough space in the block to include the transaction(s).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;cl-p2p-validation-rules&quot;&gt;CL P2P Validation Rules&lt;&#x2F;h4&gt;
&lt;p&gt;When validators receive ILs from the P2P network, they perform a series of validation checks before forwarding or caching them. These rules protect against Denial-of-Service attacks by (1) limiting ILs&#x27; byte size and (2) restricting IL proposals to a small committee of IL committee members, thereby tightly bounding bandwidth, the main resource consumed by the propagation of ILs. Consumption of other relevant resources, such as verification time, is minimal because the only nontrivial check performed on IL propagation is signature verification. At this stage, there is no EL verification of the transactions within ILs. This means that ILs are allowed to contain any transactions—valid or invalid—since validators do not perform EL-side validity checks. This design choice is intended to avoid additional computational overhead.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The slot of the IL matches the current or previous slot.&lt;&#x2F;li&gt;
&lt;li&gt;The root of the IL committee referenced in the IL matches the expected IL committee root for its slot.&lt;&#x2F;li&gt;
&lt;li&gt;Received two or fewer ILs from this IL committee member (see IL equivocation section below).&lt;&#x2F;li&gt;
&lt;li&gt;The IL is correctly signed by the validator.&lt;&#x2F;li&gt;
&lt;li&gt;The validator is part of the IL committee.&lt;&#x2F;li&gt;
&lt;li&gt;The size of a IL does not exceed the maximum size allowed (e.g., &lt;code&gt;MAX_BYTES_PER_INCLUSION_LIST = 8 KiB&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;execution-layer&quot;&gt;Execution Layer&lt;&#x2F;h3&gt;
&lt;p&gt;On the execution layer, an additional check is introduced for new payloads. After all of the transactions in the payload have been executed, we check whether any transaction from ILs, that is not already present in the payload, could be validly included (i.e. nonce and balance checks pass). If that is the case for any transaction, then an error is returned to the CL. Although the block is valid, the CL will not attest to it.&lt;&#x2F;p&gt;
&lt;p&gt;Let &lt;code&gt;B&lt;&#x2F;code&gt; denote the current block.
Let &lt;code&gt;S&lt;&#x2F;code&gt; denote the execution state following the execution of the last transaction in &lt;code&gt;B&lt;&#x2F;code&gt;.
Let &lt;code&gt;gas_left&lt;&#x2F;code&gt; be the gas remaining after execution of B.&lt;&#x2F;p&gt;
&lt;p&gt;For each transaction &lt;code&gt;T&lt;&#x2F;code&gt; in ILs, perform the following:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Check whether &lt;code&gt;T&lt;&#x2F;code&gt; is present in &lt;code&gt;B&lt;&#x2F;code&gt;. If &lt;code&gt;T&lt;&#x2F;code&gt; is present, then jump to the next transaction, else continue with next step.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Check whether &lt;code&gt;B&lt;&#x2F;code&gt; has enough remaining gas to execute &lt;code&gt;T&lt;&#x2F;code&gt;. If &lt;code&gt;T.gas&lt;&#x2F;code&gt; &amp;gt; &lt;code&gt;gas_left&lt;&#x2F;code&gt;, then jump to the next transaction, else continue with next step.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Validate &lt;code&gt;T&lt;&#x2F;code&gt; against &lt;code&gt;S&lt;&#x2F;code&gt; by checking the nonce and balance of &lt;code&gt;T.origin&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;If &lt;code&gt;T&lt;&#x2F;code&gt; is invalid, then continue to the next transaction.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;If &lt;code&gt;T&lt;&#x2F;code&gt; is valid, terminate process and return an &lt;code&gt;INCLUSION_LIST_UNSATISFIED&lt;&#x2F;code&gt; status.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;engine-api-changes&quot;&gt;Engine API Changes&lt;&#x2F;h4&gt;
&lt;p&gt;We make the following changes to the engine API:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Add &lt;code&gt;engine_getInclusionListV1&lt;&#x2F;code&gt; endpoint to retrieve an IL from the &lt;code&gt;ExecutionEngine&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Add &lt;code&gt;engine_updatePayloadWithInclusionListV1&lt;&#x2F;code&gt; endpoint to update a payload with the IL that should be used to build the block. This takes as an argument an 8-byte &lt;code&gt;payloadId&lt;&#x2F;code&gt; of the ongoing payload build process, along with the IL itself.&lt;&#x2F;li&gt;
&lt;li&gt;Modify &lt;code&gt;engine_newPayload&lt;&#x2F;code&gt; endpoint to include a parameter for transactions in ILs determined by the IL committee member. If the IL is not satisfied an &lt;code&gt;INCLUSION_LIST_UNSATISFIED&lt;&#x2F;code&gt; status must be returned.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;il-building&quot;&gt;IL Building&lt;&#x2F;h4&gt;
&lt;p&gt;The rules for building ILs are left to the discretion of implementers. For instance, they may select transactions from the public mempool in various ways such as at random, by priority fee, or based on how long they have been pending. The IL has a maximum size of &lt;code&gt;MAX_BYTES_PER_INCLUSION_LIST = 8 KiB&lt;&#x2F;code&gt; for all of the RLP encoded transactions.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;consensus-layer&quot;&gt;Consensus Layer&lt;&#x2F;h3&gt;
&lt;p&gt;The full consensus changes can be found in the following GitHub repository. They are split between:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;e678deb772fe83edd1ea54cb6d2c1e4b1e45cec6&#x2F;specs&#x2F;_features&#x2F;eip7805&#x2F;beacon-chain.md&quot;&gt;Beacon Chain&lt;&#x2F;a&gt; changes.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;e678deb772fe83edd1ea54cb6d2c1e4b1e45cec6&#x2F;specs&#x2F;_features&#x2F;eip7805&#x2F;fork-choice.md&quot;&gt;Fork choice&lt;&#x2F;a&gt; changes.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;e678deb772fe83edd1ea54cb6d2c1e4b1e45cec6&#x2F;specs&#x2F;_features&#x2F;eip7805&#x2F;p2p-interface.md&quot;&gt;P2P&lt;&#x2F;a&gt; changes.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;e678deb772fe83edd1ea54cb6d2c1e4b1e45cec6&#x2F;specs&#x2F;_features&#x2F;eip7805&#x2F;validator.md&quot;&gt;Honest validator guide&lt;&#x2F;a&gt; changes.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;beacon-chain-changes&quot;&gt;Beacon chain changes&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;preset&quot;&gt;Preset&lt;&#x2F;h5&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;DOMAIN_IL_COMMITTEE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;DomainType(&#x27;0x0C000000&#x27;)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;IL_COMMITTEE_SIZE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint64(2**4)&lt;&#x2F;code&gt; (=16)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_BYTES_PER_INCLUSION_LIST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint64(2**13)&lt;&#x2F;code&gt; (=8192)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h5 id=&quot;new-containers&quot;&gt;New containers&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InclusionList&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    slot&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    validator_index&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ValidatorIndex&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    inclusion_list_committee_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    transactions&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Transaction&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_TRANSACTIONS_PER_PAYLOAD&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SignedInclusionList&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    message&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; InclusionList&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BLSSignature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;fork-choice-changes&quot;&gt;Fork choice changes&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Store ILs observed over gossip before the view freeze deadline.&lt;&#x2F;li&gt;
&lt;li&gt;If more than one IL is observed from the same IL committee member, mark the committee member as an equivocator and ignore any further ILs from them.&lt;&#x2F;li&gt;
&lt;li&gt;The beacon block from the current slot is only attested to if it satisfies IL conditions, based on all stored ILs from non equivocators.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;p2p-changes&quot;&gt;P2P changes&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;A new global topic for broadcasting &lt;code&gt;SignedInclusionList&lt;&#x2F;code&gt; objects.&lt;&#x2F;li&gt;
&lt;li&gt;A new RPC topic for request &lt;code&gt;SignedInclusionList&lt;&#x2F;code&gt; based on IL committee index.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;core-properties&quot;&gt;Core Properties&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Committee-based: FOCIL relies on a committee of multiple validators, rather than a single proposer, to construct and broadcast ILs. This approach significantly reduces the surface for bribery and extortion attacks and strengthens censorship resistance.&lt;&#x2F;li&gt;
&lt;li&gt;Fork-choice enforced: FOCIL incorporates the force-inclusion mechanism into the fork-choice rule, an integral component of the consensus process, thereby preventing any actor from bypassing the system. Attesters vote only for blocks that include transactions from a set of ILs provided by the IL committee and that satisfy the IL constraints. Any block failing to meet these criteria will not be voted on by the attesters, and therefore cannot be canonical.&lt;&#x2F;li&gt;
&lt;li&gt;Same-slot: With FOCIL running in parallel with the block building process for &lt;code&gt;slot N+1&lt;&#x2F;code&gt; during &lt;code&gt;slot N&lt;&#x2F;code&gt;, the constraints imposed on &lt;code&gt;block B&lt;&#x2F;code&gt; for &lt;code&gt;slot N+1&lt;&#x2F;code&gt; can include transactions submitted during &lt;code&gt;slot N&lt;&#x2F;code&gt;. This represents a strict improvement over forward IL designs like &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7547&#x2F;&quot;&gt;EIP-7547&lt;&#x2F;a&gt;, where the forward property introduced a 1-slot delay.&lt;&#x2F;li&gt;
&lt;li&gt;Conditional inclusion: FOCIL adopts conditional inclusion, accepting blocks that may lack some transactions from ILs if they cannot append the transactions to the end of the block or if they are full.&lt;&#x2F;li&gt;
&lt;li&gt;Anywhere-in-block: FOCIL is unopinionated about the placement of transactions from ILs within a block. This reduces incentives for sophisticated actors to use side channels to bypass the mechanism. Combined with conditional inclusion, this flexibility makes the emergence of off-protocol markets less attractive.&lt;&#x2F;li&gt;
&lt;li&gt;No incentive mechanism: FOCIL does not provide explicit rewards for IL committee members participating in the mechanism. We believe that the added complexity of implementing a transaction fee system for FOCIL is not justified. Instead, we rely on altruistic behavior, as FOCIL requires only a &lt;code&gt;1-out-of-N&lt;&#x2F;code&gt; honesty assumption from IL committee members for the mechanism to work as intended.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces backward incompatible changes to the block validation rule set on the consensus layer and must be accompanied by a hard fork. These changes do not break anything related to current user activity and experience.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;consensus-liveness&quot;&gt;Consensus Liveness&lt;&#x2F;h3&gt;
&lt;p&gt;The builder of &lt;code&gt;slot N+1&lt;&#x2F;code&gt; cannot construct a canonical block without first receiving the ILs broadcast during &lt;code&gt;slot N&lt;&#x2F;code&gt;. This means that the builder (including cases in which the proposer locally builds its block) must be well-connected to the IL committee members to ensure timely access to these inclusion lists. Additionally, there must be sufficient time between the view freeze deadline (&lt;code&gt;t=9s&lt;&#x2F;code&gt; of &lt;code&gt;slot N&lt;&#x2F;code&gt;) and the moment the proposer must broadcast &lt;code&gt;block B&lt;&#x2F;code&gt; to the rest of the network. This buffer allows the builder to gather all available ILs and update the execution payload of &lt;code&gt;block B&lt;&#x2F;code&gt; accordingly.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;il-equivocation&quot;&gt;IL Equivocation&lt;&#x2F;h3&gt;
&lt;p&gt;To mitigate IL equivocation, FOCIL introduces a new P2P network rule that allows forwarding up to two ILs per IL committee member. If the proposer or attesters detect two different ILs sent by the same IL committee member, they should ignore all ILs from that member. In the worst case, the bandwidth of the IL gossip subnet can at most double.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;payload-construction&quot;&gt;Payload Construction&lt;&#x2F;h3&gt;
&lt;p&gt;The builder, responsible for constructing the execution payload, must ensure that the IL is satisfied. A naive way to do so would be to build an initial payload in whatever way the builder desires, then execute the following algorithm:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Sequentially check validity of any yet-to-be-included IL tx against the post-state. If none is found, payload building is over.&lt;&#x2F;li&gt;
&lt;li&gt;If one is found, append it to the end of the payload and update the post-state. Go back to step 1.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The issue with this simple approach is that, given a set of &lt;code&gt;n&lt;&#x2F;code&gt; IL transactions, one might end up needing to do &lt;code&gt;n + (n-1) + (n-2) + ...&lt;&#x2F;code&gt; validity checks, so &lt;code&gt;O(n^2)&lt;&#x2F;code&gt;. For example, the &lt;code&gt;n&lt;&#x2F;code&gt;th tx might be valid while all others are not, but its execution sends balance to the sender of the &lt;code&gt;(n-1)&lt;&#x2F;code&gt;th tx, making it valid, and in turn, the &lt;code&gt;(n-1)&lt;&#x2F;code&gt;th sends balance to the sender of the &lt;code&gt;(n-2)&lt;&#x2F;code&gt;th tx, etc.&lt;&#x2F;p&gt;
&lt;p&gt;To efficiently ensure that all valid IL txs have been included in the payload, builders can adopt a simple strategy: prior to building the payload, they store the &lt;code&gt;nonce&lt;&#x2F;code&gt; and &lt;code&gt;balance&lt;&#x2F;code&gt; of all Externally Owned Accounts (EOAs) involved in IL transactions. As they construct the payload, builders track these EOAs, maintaining and updating each EOA&#x27;s &lt;code&gt;nonce&lt;&#x2F;code&gt; and &lt;code&gt;balance&lt;&#x2F;code&gt; whenever changes occur—specifically, when the &lt;code&gt;nonce&lt;&#x2F;code&gt; increments (indicating that a transaction from that EOA has been executed) or when the &lt;code&gt;balance&lt;&#x2F;code&gt; changes without a &lt;code&gt;nonce&lt;&#x2F;code&gt; increment (e.g., after an Account Abstraction (AA) transaction has interacted with that EOA).&lt;&#x2F;p&gt;
&lt;p&gt;This tracking allows builders to verify IL transaction validity in real-time, enabling them to add transactions sequentially until all remaining transactions are either invalid because the nonce or balance of the associated EOA does not change or cannot be included due to insufficient gas. This approach minimizes overhead by keeping track only of the state changes that are relevant to the validity of IL txs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Withdrawal Credential Update Request</title>
        <published>2024-10-31T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Lucas Saldanha</name><uri>https://github.com/lucassaldanha</uri>
	</author>
	
	<author>
		<name>Mikhail Kalinin</name><uri>https://github.com/mkalinin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7804/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7804-withdrawal-credential-update-request/21514" />
        

        <id>https://wg-eips.ritovision.com/7804/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7804"
            label="EIP-7804" />
        

        
        

        
        <summary type="html">Allow validators to update their withdrawal credentials via execution requests</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7804/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal defines a mechanism to allow validators to update their withdrawal
credentials using a new execution request type (0x03). The request allows for
changing the execution address and the withdrawal credential prefix (0x01 or 0x02).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;When the ability to update a validator BLS withdrawal credentials to execution
address was introduced in Capella, one of the most common questions was about
allowing the withdrawal credential to be changed in the future.
Either for security (e.g. credential rotation) or to allow for alternative ways
of handling withdrawals (e.g. having a contract address as credentials).
The main reason for not adding this options was because implementing
this communication channel between the Execution Layer and the Consensus Layer is
complex (based on the experience with the Eth1 bridge).&lt;&#x2F;p&gt;
&lt;p&gt;In Electra, the protocol was upgraded with Execution Requests (deposits, withdrawals and
consolidations), and a mechanism for general purpose execution requests
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7685&#x2F;&quot;&gt;EIP-7685&lt;&#x2F;a&gt;, decreasing the complexity of adding
a new request from execution to consensus layer.&lt;&#x2F;p&gt;
&lt;p&gt;The introduction of execution requests that are created on the execution layer,
opened up possibilities on how validators can be managed.
Execution request can be created via smart contracts, allowing for decentralized
and on-chain mechanisms to be explored.
This also means validators will be able to move between execution and compounding
withdrawal credentials (following the correct churn on the total staked amount).&lt;&#x2F;p&gt;
&lt;p&gt;For an execution request to be authorized in the consensus layer, the withdrawal
credential of the validator must be the same of the &lt;code&gt;msg.caller&lt;&#x2F;code&gt; when processing
the transaction on the EVM.
So the validator&#x27;s withdrawal credential must be the same address of the smart contract
creating the request (not the credential of the transaction sender), or the contract
needs to use &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; to ensure the caller address matches the address in the
validator&#x27;s withdrawal credential.
Validators that already have a contract address as their withdrawal credentials should
be able to update their contracts to meet this demand (assuming they have an
updatable contract).&lt;&#x2F;p&gt;
&lt;p&gt;There problems for existing validators that have their withdrawal credentials
set to an EOA account is they will never be able to use smart contracts
for creating execution requests, because the current design does not allow for these
credentials to ever be changed.&lt;&#x2F;p&gt;
&lt;p&gt;Allowing for validators to update their withdrawal credentials mean they can opt-in
and out of different schemes and strategies on managing their validators, favouring
experimentation and innovation.
Today, the only alternative to this is exiting the validator and creating a new
validator with different withdrawal credentials.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Comment&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FORK_TIMESTAMP&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;em&gt;TBD&lt;&#x2F;em&gt;&lt;&#x2F;td&gt;&lt;td&gt;Mainnet&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;configuration&quot;&gt;Configuration&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Comment&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;WITHDRAWAL_CREDENTIALS_UPDATE_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x09Fc772D0857550724b07B850a4323f39112aAaA&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Where to call and store relevant details about the withdrawal credentials update mechanism&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;WITHDRAWAL_CREDENTIALS_UPDATE_REQUEST_TYPE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x03&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7685&#x2F;&quot;&gt;EIP-7685&lt;&#x2F;a&gt; type prefix for withdrawal credential update request&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SYSTEM_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xfffffffffffffffffffffffffffffffffffffffe&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Address used to invoke system operation on contract&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;EXCESS_WITHDRAWAL_CREDENTIALS_UPDATE_REQUESTS_STORAGE_SLOT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;WITHDRAWAL_CREDENTIALS_UPDATE_REQUEST_COUNT_STORAGE_SLOT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;WITHDRAWAL_CREDENTIALS_UPDATE_REQUEST_QUEUE_HEAD_STORAGE_SLOT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;Pointer to head of the withdrawal credential update request message queue&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;WITHDRAWAL_CREDENTIALS_UPDATE_REQUEST_QUEUE_TAIL_STORAGE_SLOT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;Pointer to the tail of the withdrawal credential update request message queue&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;WITHDRAWAL_CREDENTIALS_UPDATE_REQUEST_QUEUE_STORAGE_OFFSET&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;4&lt;&#x2F;td&gt;&lt;td&gt;The start memory slot of the in-state withdrawal credential update request message queue&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_WITHDRAWAL_CREDENTIALS_UPDATE_REQUESTS_PER_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;4&lt;&#x2F;td&gt;&lt;td&gt;Maximum number of withdrawal credential update requests that can be dequeued into a block&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TARGET_WITHDRAWAL_CREDENTIALS_UPDATE_REQUESTS_PER_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MIN_WITHDRAWAL_CREDENTIALS_UPDATE_REQUEST_FEE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;WITHDRAWAL_CREDENTIALS_UPDATE_REQUEST_FEE_UPDATE_FRACTION&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;17&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;EXCESS_INHIBITOR&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2**256-1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Excess value used to compute the fee before the first system call&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;execution-layer&quot;&gt;Execution Layer&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;FORK_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; -- the first block in a blockchain with the &lt;code&gt;timestamp&lt;&#x2F;code&gt; greater or equal to &lt;code&gt;FORK_TIMESTAMP&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;withdrawal-credentials-update-request-operation&quot;&gt;Withdrawal Credentials Update request operation&lt;&#x2F;h4&gt;
&lt;p&gt;The new withdrawal credential update request operation is an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7685&#x2F;&quot;&gt;EIP-7685&lt;&#x2F;a&gt; request
with type &lt;code&gt;0x03&lt;&#x2F;code&gt; and consists of the following fields:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;pubkey&lt;&#x2F;code&gt;: &lt;code&gt;Bytes48&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;old_address&lt;&#x2F;code&gt;: &lt;code&gt;Bytes20&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;new_address&lt;&#x2F;code&gt;: &lt;code&gt;Bytes20&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7685&#x2F;&quot;&gt;EIP-7685&lt;&#x2F;a&gt; encoding of a withdrawal credential update request is computed as follows.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;request_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; WITHDRAWAL_CREDENTIALS_UPDATE_REQUEST_TYPE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;request_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; read_withdrawal_credential_update_requests&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;withdrawal-credentials-update-request-contract&quot;&gt;Withdrawal Credentials Update Request Contract&lt;&#x2F;h4&gt;
&lt;p&gt;The contract is similar to other execution requests contracts for Deposits, Withdrawals and Consolidation.
The contract has three different code paths, which can be summarized at a high level as follows:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Add request - requires a &lt;code&gt;68&lt;&#x2F;code&gt; byte input, the validator&#x27;s public key concatenated with the new address for withdrawal credentials.&lt;&#x2F;li&gt;
&lt;li&gt;Excess requests getter - if the input length is zero, return the current excess requests count.&lt;&#x2F;li&gt;
&lt;li&gt;System process - if called by system address, pop off the withdrawal credential update requests for the current block from the queue.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;!-- TODO add sudo code &#x2F; bytecode &#x2F; deployment &#x2F; etc (very similar to existing request contracts) --&gt;
&lt;h4 id=&quot;block-processing&quot;&gt;Block processing&lt;&#x2F;h4&gt;
&lt;p&gt;At the end of processing any execution block where &lt;code&gt;block.timestamp &amp;gt;= FORK_TIMESTAMP&lt;&#x2F;code&gt; (i.e. after processing all transactions and after performing the block body requests validations) client software &lt;strong&gt;MUST&lt;&#x2F;strong&gt; include a call the contract as &lt;code&gt;SYSTEM_ADDRESS&lt;&#x2F;code&gt; and empty input data to trigger the system subroutine execute. The response should be treated as a new request type (0x03) according to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7685&#x2F;&quot;&gt;EIP-7685&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;block-validation&quot;&gt;Block Validation&lt;&#x2F;h4&gt;
&lt;p&gt;EL must check that the commitment hash in the execution block header matches the hash of the list of execution requests the CL sends when
validating the execution block (including any requests of the new defined type 0x03).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;consensus-layer&quot;&gt;Consensus Layer&lt;&#x2F;h3&gt;
&lt;!-- TODO complete the specification --&gt;
&lt;p&gt;Summary of changes:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;New container &lt;code&gt;WithdrawalCredentialUpdateRequest&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;New method in Block Processing: &lt;code&gt;process_withdrawal_credential_update_request&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;New Beacon State mutator method: &lt;code&gt;update_withdrawal_credentials&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; WithdrawalCredentialUpdateRequest&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    validator_pubkey&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BLSPubkey&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    old_address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; request contract will set this to msg.caller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    new_address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; process_withdrawal_credential_update_request&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; withdrawal_credentials_update_requests&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; WithdrawalCredentialUpdateRequest&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    validator_pubkeys&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validators&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify pubkey exists&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    request_pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; withdrawal_credentials_update_requests&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validator_pubkey&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; request_pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; validator_pubkeys&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; ValidatorIndex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;validator_pubkeys&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;request_pubkey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    validator&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validators&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify withdrawal credentials&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    has_correct_credential&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; has_execution_withdrawal_credential&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;validator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    is_correct_old_address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        validator&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;withdrawal_credentials&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;12&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; withdrawal_credentials_update_requests&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;old_address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;has_correct_credential&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span&gt; is_correct_old_address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    credential_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; withdrawal_credentials_update_requests&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;type&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    is_eth1_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; credential_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ETH1_ADDRESS_WITHDRAWAL_PREFIX&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    is_compounding_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; credential_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; COMPOUNDING_WITHDRAWAL_PREFIX&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify valid type&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;is_eth1_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; or&lt;&#x2F;span&gt;&lt;span&gt; is_compounding_type&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-deprecated&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    update_withdrawal_credentials&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; index&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; credential_type&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; withdrawal_credentials_update_requests&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;new_address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; update_withdrawal_credentials&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; index&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ValidatorIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; new_credential_type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; new_withdrawal_credentials&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    old_credential_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; validator&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;withdrawal_credentials&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    validator&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validators&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    validator&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;withdrawal_credentials&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        new_credential_type&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        +&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\x00&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 11&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        +&lt;&#x2F;span&gt;&lt;span&gt; new_withdrawal_credentials&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If moving from 0x01 to 0x02&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;old_credential_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ETH1_ADDRESS_WITHDRAWAL_PREFIX&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span&gt; new_credential_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; COMPOUNDING_WITHDRAWAL_PREFIX&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;      #&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;TODO&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: in this case we need to ensure we put them through the churn&#x2F;likely re-using some of the exiting rules&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      switch_to_compounding_validator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;!-- TODO --&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;!-- TODO --&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;!-- TODO --&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Ownership is defined based on control of the withdrawal credential account, either as a private key (for EOA accounts) or controlling
the smart contract at the address set as withdrawal credential. Therefore allowing an update should not bring any security implications.&lt;&#x2F;p&gt;
&lt;p&gt;Further discussion needed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>etha - Sharded Blocks Subprotocol</title>
        <published>2024-10-30T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Ahmad Bitar</name><uri>https://github.com/smartprogrammer93</uri><email>smartprogrammer@windowslive.com</email>
	</author>
	
	<author>
		<name>Giulio Rebuffo</name><uri>https://github.com/Giulio2002</uri>
	</author>
	
	<author>
		<name>Gary Schulte</name><uri>https://github.com/garyschulte</uri><email>garyschulte@gmail.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7801/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7801-etha-sharded-blocks-subprotocol/21507" />
        

        <id>https://wg-eips.ritovision.com/7801/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="networking"
                label="Networking" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7801"
            label="EIP-7801" />
        

        
        

        
        <summary type="html">Introduces the etha subprotocol for serving historical blocks data.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7801/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes the creation of a new subprotocol, &lt;code&gt;etha&lt;&#x2F;code&gt;, enabling Ethereum nodes to communicate available block spans via a bitmask. Each bit represents a 106_496-block span within each 1_064_960 block range of chain history. Nodes use this bitmask to signal stored spans and commit to storing future spans as they are created. This allows peers to make informed decisions about data availability without first connecting and querying for it. The bitmask repeats every 1_064_960 blocks for straightforward reasoning about data availability probabilities.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;etha&lt;&#x2F;code&gt; subprotocol has the same functionality to serve historical data using message types copied from the &lt;code&gt;eth&lt;&#x2F;code&gt; protocol, enabling efficient data retrieval.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;With &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4444&#x2F;&quot;&gt;EIP-4444&lt;&#x2F;a&gt;, nodes may prune historical data while others continue serving it. Determining data availability by connecting and requesting blocks is inefficient consuming unnecessary bandwidth. This EIP addresses this inefficiency by enabling nodes to shard chain history into 106_496 block segments and signal availability via a bitmask.&lt;&#x2F;p&gt;
&lt;p&gt;By introducing a separate subprotocol, &lt;code&gt;etha&lt;&#x2F;code&gt;, nodes can exchange this information seamlessly and retain the ability to serve historical data without impacting existing &lt;code&gt;eth&lt;&#x2F;code&gt; protocol versions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;subprotocol-handshake&quot;&gt;Subprotocol Handshake&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Introduce a new subprotocol named &lt;code&gt;etha&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Define the handshake message for the &lt;code&gt;etha&lt;&#x2F;code&gt; subprotocol as follows:
&lt;ul&gt;
&lt;li&gt;Handshake packet: &lt;code&gt;[version: P, networkid: P, blockhash: B_32, genesis: B_32, forkid, blockBitmask]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;blockBitmask&lt;&#x2F;code&gt; is a 10-bit bitmask, with each bit representing a 106_496-block range per 1_064_960 blocks of history.&lt;&#x2F;li&gt;
&lt;li&gt;the rest of the elements are as defined in eth&#x2F;69&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;supported-messages&quot;&gt;Supported Messages&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;etha&lt;&#x2F;code&gt; subprotocol &lt;strong&gt;MUST&lt;&#x2F;strong&gt; include support for the following messages from the &lt;code&gt;eth&#x2F;69&lt;&#x2F;code&gt; protocol to facilitate historical data serving:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;GetBlockBodies (0x05):&lt;&#x2F;strong&gt; Request block bodies.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;BlockBodies (0x06):&lt;&#x2F;strong&gt; Response to &lt;code&gt;GetBlockBodies&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;GetReceipts (0x0f):&lt;&#x2F;strong&gt; Request receipts.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Receipts (0x10):&lt;&#x2F;strong&gt; Response to &lt;code&gt;GetReceipts&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The semantics and payload structures for these messages are identical to their counterparts in the &lt;code&gt;eth&#x2F;69&lt;&#x2F;code&gt; protocol, ensuring compatibility for historical data serving.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;node-behavior&quot;&gt;Node Behavior&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Bitmask Initialization&lt;&#x2F;strong&gt;: Nodes &lt;strong&gt;MAY&lt;&#x2F;strong&gt; set at least one bit in the &lt;code&gt;blockBitmask&lt;&#x2F;code&gt; to &lt;code&gt;on&lt;&#x2F;code&gt; upon startup and backfill the corresponding 106_496-block span.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Shard Retention Probability&lt;&#x2F;strong&gt;: Nodes &lt;strong&gt;MUST&lt;&#x2F;strong&gt; retain new block spans according to their bitmask, aiming to cover at least 10% of chain history.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Commitment to Future Ranges&lt;&#x2F;strong&gt;: Nodes &lt;strong&gt;MUST&lt;&#x2F;strong&gt; retain spans corresponding to their advertised bitmask as new blocks are added.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Bitmask Space&lt;&#x2F;strong&gt;: The 106_496 range &lt;code&gt;blockBitmask&lt;&#x2F;code&gt; repeats every 1_064_960 blocks, enabling efficient representation of historical data locality across epochs.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Upon connection using &lt;code&gt;etha&lt;&#x2F;code&gt;, nodes exchange the handshake message with the &lt;code&gt;blockBitmask&lt;&#x2F;code&gt;. This single handshake eliminates the need for additional message types.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;enr-extension&quot;&gt;ENR Extension&lt;&#x2F;h3&gt;
&lt;p&gt;Alternatively, the &lt;code&gt;blockBitmask&lt;&#x2F;code&gt; could be derived or encoded into the Ethereum Node Record (ENR), enabling nodes to advertise block spans without a handshake. As an example, the &lt;code&gt;blockBitmask&lt;&#x2F;code&gt; can be derived from the &lt;code&gt;secp256k1&lt;&#x2F;code&gt; field of the ENR.  However, this method lacks the authentication and reliability of the handshake approach. Additionally, there is not guarantee that the node you are connecting to supports the &lt;code&gt;etha&lt;&#x2F;code&gt; subprotocol.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The bitmask approach provides a flexible means to represent and retain block data while committing to future spans. This mechanism aligns with the pruning proposed in EIP-4444, while ensuring that historical and future data spans remain available across the network.&lt;&#x2F;p&gt;
&lt;p&gt;A similar bitlist approach is already used in the Consensus Layer for attestation subnets, making it a familiar and efficient method for representing data spans. Additionally, committing to future spans ensures better predictability and stability for data locality.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;etha&lt;&#x2F;code&gt; subprotocol separates this functionality from &lt;code&gt;eth&lt;&#x2F;code&gt; ensuring nodes dont hammer other nodes with requests on historical ranges that they do not posses on the eth protocol.&lt;&#x2F;p&gt;
&lt;p&gt;The range sizes of 106,496 and 1,064,960 blocks were chosen because they are multiples of Era1’s maximum block range of 8,192, which allows for straightforward storage and representation using Era1 files.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;etha&lt;&#x2F;code&gt; subprotocol is independent of the &lt;code&gt;eth&lt;&#x2F;code&gt; protocol. This EIP does not affect the consensus engine or require a hard fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;There are some considerations:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Data unavailability for any given shard can be modeled as: P = (0.9)^n, where n is the number of peers.  Assuming a random distribution of nodes that are participating in EIP-7801 history sharding, for 25 peers, this chance is 7%.  For 32 peers, this chance drops to 3.4%. This assumes that a significant number of nodes on the network are serving at least one shard.  Adoption by a majority of clients as a default would likely be necessary for a complete sharded history to be available and replicated sufficiently across the network.&lt;&#x2F;li&gt;
&lt;li&gt;As history grows, so will the size of the retained shards on disk, thus raising the storage requirements per node.  However, nodes will still benefit from a ~90% storage reduction over the present chain storage requirements, and will scale their future chain storage requirements by only 10% of the rate they would have by retaining all history.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;This document is CC0-licensed; rights are waived through &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Token With Mint&#x2F;Burn Access Across Chains</title>
        <published>2024-10-30T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>skeletor</name><uri>https://github.com/skeletor-spaceman</uri>
	</author>
	
	<author>
		<name>parti</name><uri>https://github.com/0xParticle</uri>
	</author>
	
	<author>
		<name>joxes</name><uri>https://github.com/Joxess</uri>
	</author>
	
	<author>
		<name>ng</name><uri>https://github.com/0xng</uri>
	</author>
	
	<author>
		<name>agus duha</name><uri>https://github.com/agusduha</uri>
	</author>
	
	<author>
		<name>disco</name><uri>https://github.com/0xDiscotech</uri>
	</author>
	
	<author>
		<name>gotzen</name><email>gotzen@defi.sucks</email>
	</author>
	
	<author>
		<name>0age</name><email>0age@uniswap.org</email>
	</author>
	
	<author>
		<name>Mark Tyneway</name><email>mark@oplabs.co</email>
	</author>
	
	<author>
		<name>Zain Bacchus</name><email>zain@oplabs.co</email>
	</author>
	
	<author>
		<name>Matt Solomon</name><email>msolomon@oplabs.co</email>
	</author>
	
	<author>
		<name>Maurelian</name><email>maurelian@protonmail.ch</email>
	</author>
	
	<author>
		<name>Blaine Malone</name><uri>https://github.com/blmalone</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7802/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7802-crosschain-token-interface/21508" />
        

        <id>https://wg-eips.ritovision.com/7802/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7802"
            label="ERC-7802" />
        

        
        

        
        <summary type="html">Allow authorized contracts to mint and burn token representations during crosschain transfers</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7802/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard introduces a minimal and extensible interface, &lt;code&gt;IERC7802&lt;&#x2F;code&gt;, for tokens to enable standardized crosschain communication. The interface consists of two functions, &lt;code&gt;crosschainMint&lt;&#x2F;code&gt; and &lt;code&gt;crosschainBurn&lt;&#x2F;code&gt;, which allow authorized bridge contracts to mint and burn token representations during crosschain transfers. These functions serve as the entry points for bridge logic, enabling consistent handling of token supply across chains.&lt;&#x2F;p&gt;
&lt;p&gt;The interface also defines two standardized events, &lt;code&gt;CrosschainMint&lt;&#x2F;code&gt; and &lt;code&gt;CrosschainBurn&lt;&#x2F;code&gt;, which emit metadata, including the target address, token amount, and caller. These events facilitate deterministic indexing and monitoring of crosschain activities by off-chain agents, such as indexers, analytics tools, and auditors.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;IERC7802&lt;&#x2F;code&gt; is intentionally lightweight, ensuring minimal overhead for implementation. Its modular design enables extensibility, allowing additional features—such as mint&#x2F;burn limits, transfer fees, or bridge-specific access control mechanisms—to be layered on top without modifying the base interface.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;All rollups and multiple important sidechains implement canonical bridges that embed their security into some part of the network&#x27;s core architecture. These bridges do not have mint&#x2F;burn rights over original tokens, so they usually lock (unlock) liquidity on the native chain and then mint (burn) a non-equivalent representation on the other. Mint&#x2F;burn is used because the native token is non-existent on that side, so they must create a new representation. However, each bridge implements a different interface for minting&#x2F;burning on non-native chains.&lt;&#x2F;p&gt;
&lt;p&gt;This interface fragmentation is a massive issue in crosschain communication among chains via third-party bridges or future canonical solutions. At this point, it is clear that every bridge would benefit from a standardized interface for minted&#x2F;burnt tokens.&lt;&#x2F;p&gt;
&lt;p&gt;There have been different attempts in the past to standardize token-bridging interfaces. However, third-party providers are also developing crosschain token frameworks. Each framework defines its features, like rate limits and fee switches, and implements its mint and burn versions. The resultant interfaces become highly specific, lacking naming conventions and structures.&lt;&#x2F;p&gt;
&lt;p&gt;The proposed interface includes the most relevant and minimal set of actions used by most of these standards. These actions also do not require any governance or owner participation, in contrast, for instance, to set rate limits.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC introduces the &lt;code&gt;IERC7802&lt;&#x2F;code&gt; interface.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;interface-identification&quot;&gt;Interface Identification&lt;&#x2F;h3&gt;
&lt;p&gt;The interface identifier for &lt;code&gt;IERC7802&lt;&#x2F;code&gt; is &lt;strong&gt;&lt;code&gt;0x33331994&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;, calculated according to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; as the XOR of the function selectors of the two functions in the interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; INTERFACE_ID_IERC7802 &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes4&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;crosschainMint(address,uint256)&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ^&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes4&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;crosschainBurn(address,uint256)&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;or via Solidity as&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;IERC7802&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;interfaceId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Implementors MUST ensure that the &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; method of ERC-165 returns true for this interface ID to indicate support for &lt;code&gt;IERC7802&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;methods&quot;&gt;Methods&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;crosschainMint&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Mints &lt;code&gt;_amount&lt;&#x2F;code&gt; of token to address &lt;code&gt;_account&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This function works as the minting entry point for bridge contracts.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; crosschainMint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Implementations SHOULD emit &lt;code&gt;Transfer(address(0), _to, _amount)&lt;&#x2F;code&gt; on calls to &lt;code&gt;crosschainMint&lt;&#x2F;code&gt; to be compliant with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; invariants on token creation.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;crosschainBurn&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Burns &lt;code&gt;_amount&lt;&#x2F;code&gt; of token from address &lt;code&gt;_account&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This function works as the burning entry point for bridge contracts.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; crosschainBurn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Implementations might consider emitting &lt;code&gt;Transfer(_from, address(0), _amount)&lt;&#x2F;code&gt; on calls to &lt;code&gt;crosschainBurn&lt;&#x2F;code&gt; to be compliant with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5679&#x2F;&quot;&gt;ERC-5679&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;events&quot;&gt;Events&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;CrosschainMint&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;MUST trigger when &lt;code&gt;crosschainMint&lt;&#x2F;code&gt; is successfully called.
The &lt;code&gt;_sender&lt;&#x2F;code&gt; parameter MUST be set to the msg.sender at the time the function is called.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CrosschainMint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;CrosschainBurn&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;MUST trigger when &lt;code&gt;crosschainBurn&lt;&#x2F;code&gt; is successfully called.
The &lt;code&gt;_sender&lt;&#x2F;code&gt; parameter MUST be set to the msg.sender at the time the function is called.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CrosschainBurn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;design-philosophy&quot;&gt;Design philosophy&lt;&#x2F;h3&gt;
&lt;p&gt;The core design decisions behind this minimal interface are&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Bridge agnosticism.&lt;&#x2F;li&gt;
&lt;li&gt;Extensibility.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Bridge agnosticism&lt;&#x2F;strong&gt;
This interface is designed so bridges, not tokens, contain the logic to process crosschain actions. By maintaining this separation of concerns, token contracts remain simple, reducing their attack surface and easing auditing and upgradability. Offloading crosschain complexities to bridge contracts ensures that tokens do not embed specific bridge logic.&lt;&#x2F;p&gt;
&lt;p&gt;By implementing the proposed interface, tokens can be supported by different bridge designs:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Lock&#x2F;unlock bridges can still operate and do not require any token modification.&lt;&#x2F;li&gt;
&lt;li&gt;Burn&#x2F;mint bridges can now use a universal and minimal token interface, so they will not need to introduce bridge-specific representations, improving crosschain fungibility.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Extensibility&lt;&#x2F;strong&gt;
The minimal interface serves as a foundational layer upon which other standards can be built.
Token issuers or bridge contracts can extend functionality by adding features such as mint&#x2F;burn limits, crosschain transfer fees, and more without altering the core interface.&lt;&#x2F;p&gt;
&lt;p&gt;The interface is intentionally neutral and does not impose conditions on:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Access Control&lt;&#x2F;strong&gt;: Token issuers determine who is authorized to call &lt;code&gt;crosschainMint()&lt;&#x2F;code&gt; and &lt;code&gt;crosschainBurn()&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Zero Amount Calls&lt;&#x2F;strong&gt;: Token issuers decide whether to allow or revert calls with zero amounts.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;separation-of-local-and-crosschain-minting-burning&quot;&gt;Separation of Local and crosschain Minting&#x2F;Burning&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;Different actions&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Local minting and burning are fundamentally different from crosschain minting and burning.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;In crosschain operations, the total circulating supply across all chains is expected to remain constant, as tokens are transferred between chains rather than created or destroyed in isolation.&lt;&#x2F;li&gt;
&lt;li&gt;Agents that mint and burn tokens in crosschain transfer fundamentally differ from token owners. It make sense for the two actors to have different permissions.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Therefore, it is reasonable to have different checks, access controls, and logic (such as mint&#x2F;burn limits) for crosschain actions.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Separation of concerns&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Merging local and crosschain minting&#x2F;burning into the same functions can lead to complex implementations that intertwine different operational logic.
By splitting into two, concerns remain separate, making the codebase cleaner and more maintainable.&lt;&#x2F;p&gt;
&lt;p&gt;This separation of concerns is particularly relevant for&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Upgrades: Any changes in access control, limits, or logic will only affect the separate crosschain functions (&lt;code&gt;crosschainMint&lt;&#x2F;code&gt; and &lt;code&gt;crosschainBurn&lt;&#x2F;code&gt;) without altering the standard local mint and burn implementations.&lt;&#x2F;li&gt;
&lt;li&gt;Integrations with Different Chains: To make an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; crosschain compatible,
issuers simply need to implement the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7802&#x2F;&quot;&gt;ERC-7802&lt;&#x2F;a&gt; extension with the corresponding access controls for each chain.
For example, when integrating with Optimism, the ERC-20 would grant access to the Optimism bridge; when integrating with Arbitrum, it would grant access to the Arbitrum bridge.
The local mint and burn functions remain unchanged.
Using dedicated functions for crosschain operations provides a more modular approach, avoiding the need to modify the base implementation for each chain.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Dedicated events&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;A similar reasoning applies to having dedicated crosschain-specific events. The separation significantly facilitates the work of indexers, analytics tools, and auditors. It allows for straightforward tracking of crosschain activities, detecting anomalies, and monitoring bridge operations. If crosschain and local events are indistinguishable, off-chain agents must implement complex logic to differentiate them, increasing the potential for errors and inefficiencies.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;erc-165-interface&quot;&gt;ERC-165 Interface&lt;&#x2F;h3&gt;
&lt;p&gt;The inclusion of ERC-165 provides an additional security check for integrators. By providing the interface identifier through the &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; method, callers can programmatically confirm that the token adheres to the &lt;code&gt;IERC7802&lt;&#x2F;code&gt; interface.
This verification ensures that the token supports both &lt;code&gt;crosschainMint&lt;&#x2F;code&gt; and &lt;code&gt;crosschainBurn&lt;&#x2F;code&gt; functions, preventing scenarios where only one function is implemented. Such incomplete implementations could lead to issues like users burning tokens to bridge out but being unable to mint them upon return, resulting in failed crosschain actions.&lt;&#x2F;p&gt;
&lt;p&gt;It is important to note that this check can only be performed locally on the chain where the token contract resides. There is no inherent guarantee that the token on the receiving chain also supports the &lt;code&gt;IERC7802&lt;&#x2F;code&gt; interface. Ensuring crosschain consistency of interface support is the responsibility of the bridge implementation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal is fully backwards compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;As discussed in the Motivation section, a minimal, flexible crosschain standard interface is necessary. The problem becomes larger as more tokens are deployed without a standardized format.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Upgradable tokens can be upgraded to implement the new interface.&lt;&#x2F;li&gt;
&lt;li&gt;Non-upgradable tokens cannot implement the interface on the token itself. They can still migrate to a standard-compliant version using a lockbox mechanism, as proposed by xERC-20. The idea is to lock non-mintable tokens and mint the same amount of interface-compliant tokens. The bridge contract can act as a lockbox on the native chain.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Bridge contracts will also need an upgrade to integrate with the interface.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0.8.25&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC20&#x2F;ERC20.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;utils&#x2F;introspection&#x2F;IERC165.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; IERC7802&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Defines the interface for crosschain ERC20 transfers.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7802&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC165&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a crosschain transfer mints tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;       Address of the account tokens are being minted for.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   Amount of tokens minted.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   Address of the caller (msg.sender) who invoked crosschainMint.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CrosschainMint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a crosschain transfer burns tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     Address of the account tokens are being burned from.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   Amount of tokens burned.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   Address of the caller (msg.sender) who invoked crosschainBurn.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CrosschainBurn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Mint tokens through a crosschain transfer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     Address to mint tokens to.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Amount of tokens to mint.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; crosschainMint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Burn tokens through a crosschain transfer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   Address to burn tokens from.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Amount of tokens to burn.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; crosschainBurn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CrosschainERC20&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC20&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC7802&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the TOKEN_BRIDGE contract that is allowed to mint&#x2F;burn tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; immutable&lt;&#x2F;span&gt;&lt;span&gt; TOKEN_BRIDGE&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Custom error for unauthorized access.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Unauthorized&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Constructor to set the TOKEN_BRIDGE address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenBridge&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the TOKEN_BRIDGE.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenBridge&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; symbol&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;name, symbol) &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_tokenBridge &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Invalid TOKEN_BRIDGE address&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        TOKEN_BRIDGE &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _tokenBridge&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A modifier that only allows the TOKEN_BRIDGE to call&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    modifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyTokenBridge&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; TOKEN_BRIDGE&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Unauthorized&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        _&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Allows the TOKEN_BRIDGE to mint tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     Address to mint tokens to.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Amount of tokens to mint.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; crosschainMint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyTokenBridge&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CrosschainMint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Allows the TOKEN_BRIDGE to burn tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   Address to burn tokens from.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Amount of tokens to burn.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; crosschainBurn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyTokenBridge&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _burn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CrosschainBurn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;IERC7802&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span&gt; interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;IERC165&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;interfaceId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;permissions&quot;&gt;Permissions&lt;&#x2F;h3&gt;
&lt;p&gt;Token issuers are responsible for controlling which contracts are authorized to call the &lt;code&gt;crosschainMint()&lt;&#x2F;code&gt; and &lt;code&gt;crosschainBurn()&lt;&#x2F;code&gt; functions. A buggy or malicious authorized caller could mint or burn tokens improperly, damaging token holders and disrupting integrations.&lt;&#x2F;p&gt;
&lt;p&gt;One method to minimize potential losses is introducing mint&#x2F;burn limits, as proposed by xERC-20. These features are fully compatible with the proposed interface.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;wrapped-native-tokens&quot;&gt;Wrapped Native Tokens&lt;&#x2F;h3&gt;
&lt;p&gt;This standard should not be used for wrapped native tokens like WETH, as it can lead to uncollateralized minting if the bridge does not control the underlying asset.&lt;&#x2F;p&gt;
&lt;p&gt;The only safe exception is when the bridge can burn and mint the native token symmetrically on both chains, ensuring proper collateralization.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>System logs</title>
        <published>2024-10-29T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Etan Kissling</name><uri>https://github.com/etan-status</uri>
	</author>
	
	<author>
		<name>Gajinder Singh</name><uri>https://github.com/g11tech</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7799/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7799-system-logs/21497" />
        

        <id>https://wg-eips.ritovision.com/7799/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7799"
            label="EIP-7799" />
        

        
        

        
        <summary type="html">Per-block logs without associated transactions</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7799/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP defines an extension for eth_getLogs to provide logs for events that are not associated with a given transaction, such as block rewards and withdrawals.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;With &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7708&#x2F;&quot;&gt;EIP-7708&lt;&#x2F;a&gt; wallets gain the ability to use eth_getLogs to track changes to their ETH balance. However, the ETH balance may change without an explicit transaction, through block production and withdrawals. By having such operations emit block-level system logs, eth_getLogs provides a complete picture of ETH balance changes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;fee-payment-logs&quot;&gt;Fee payment logs&lt;&#x2F;h3&gt;
&lt;p&gt;A log, identical to a LOG2, is issued for every transaction and appended after all other logs created by EVM execution. The fee amount incorporates the total fee charged during transaction execution, including the base fee, the priority fee, and potential blob fees.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Field&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;address&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xfffffffffffffffffffffffffffffffffffffffe&lt;&#x2F;code&gt; (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4788&#x2F;&quot;&gt;&lt;code&gt;SYSTEM_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;topics[0]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x7bd3aa7d673767f759ebf216e7f6c12844986c661ae6e0f1d988cf7eb7394d1d&lt;&#x2F;code&gt; (&lt;code&gt;keccak256(&#x27;Fee(address,uint256)&#x27;)&lt;&#x2F;code&gt;)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;topics[1]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;from&lt;&#x2F;code&gt; address (zero prefixed to fill uint256)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;data&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;amount&lt;&#x2F;code&gt; in Wei (big endian uint256)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;system-logs-list&quot;&gt;System logs list&lt;&#x2F;h3&gt;
&lt;p&gt;A new list is introduced to track all block level logs emitted from system interactions. The definition uses the &lt;code&gt;Log&lt;&#x2F;code&gt; SSZ type from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6466&#x2F;&quot;&gt;EIP-6466&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;system_logs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Log&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    log_0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; log_1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; log_2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ...&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;priority-fee-processing&quot;&gt;Priority fee processing&lt;&#x2F;h3&gt;
&lt;p&gt;A log SHALL be appended to the system logs list when crediting the batched &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8115&#x2F;&quot;&gt;EIP-8115&lt;&#x2F;a&gt; priority fee.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Field&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;address&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xfffffffffffffffffffffffffffffffffffffffe&lt;&#x2F;code&gt; (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4788&#x2F;&quot;&gt;&lt;code&gt;SYSTEM_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;topics[0]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x5dfe9c0fd3043bb299f97cfece428f0396cf8b7890c525756e4ea5c0ff7d61b2&lt;&#x2F;code&gt; (&lt;code&gt;keccak256(&#x27;PriorityRewards(address,uint256)&#x27;)&lt;&#x2F;code&gt;)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;topics[1]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;to&lt;&#x2F;code&gt; address (zero prefixed to fill uint256)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;data&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;amount&lt;&#x2F;code&gt; in Wei (big endian uint256)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;withdrawal-processing&quot;&gt;Withdrawal processing&lt;&#x2F;h3&gt;
&lt;p&gt;A log SHALL be appended to the system logs list on every &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4895&#x2F;&quot;&gt;EIP-4895&lt;&#x2F;a&gt; withdrawal.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Field&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;address&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xfffffffffffffffffffffffffffffffffffffffe&lt;&#x2F;code&gt; (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4788&#x2F;&quot;&gt;&lt;code&gt;SYSTEM_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;topics[0]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65&lt;&#x2F;code&gt; (&lt;code&gt;keccak256(&#x27;Withdrawal(address,uint256)&#x27;)&lt;&#x2F;code&gt;)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;topics[1]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;to&lt;&#x2F;code&gt; address (zero prefixed to fill uint256)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;data&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;amount&lt;&#x2F;code&gt; in Wei (big endian uint256)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;genesis-processing&quot;&gt;Genesis processing&lt;&#x2F;h3&gt;
&lt;p&gt;A log SHALL be appended to the system logs list when generating genesis blocks for networks that adopt this EIP from the beginning.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Field&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;address&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xfffffffffffffffffffffffffffffffffffffffe&lt;&#x2F;code&gt; (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4788&#x2F;&quot;&gt;&lt;code&gt;SYSTEM_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;topics[0]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xba2f6409ffd24dd4df8e06be958ed8c1706b128913be6e417989c74969b0b55a&lt;&#x2F;code&gt; (&lt;code&gt;keccak256(&#x27;Genesis(address,uint256)&#x27;)&lt;&#x2F;code&gt;)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;topics[1]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;to&lt;&#x2F;code&gt; address (zero prefixed to fill uint256)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;data&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;amount&lt;&#x2F;code&gt; in Wei (big endian uint256)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;execution-block-header-changes&quot;&gt;Execution block header changes&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;devp2p&#x2F;blob&#x2F;5713591d0366da78a913a811c7502d9ca91d29a8&#x2F;caps&#x2F;eth.md#block-encoding-and-validity&quot;&gt;execution block header&lt;&#x2F;a&gt; is extended with a new field, &lt;code&gt;system-logs-root&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;block_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;system_logs_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; system_logs&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;hash_tree_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;json-rpc-api&quot;&gt;JSON-RPC API&lt;&#x2F;h3&gt;
&lt;p&gt;Block header objects in the context of the JSON-RPC API are extended to include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;systemLogsRoot&lt;&#x2F;code&gt;: &lt;code&gt;DATA&lt;&#x2F;code&gt;, 32 Bytes&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Log objects in the context of the JSON-RPC API are updated as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;logIndex&lt;&#x2F;code&gt;: &lt;code&gt;QUANTITY&lt;&#x2F;code&gt; - The additional system logs are indexed consecutively after the existing logs from transaction receipts&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;transactionIndex&lt;&#x2F;code&gt;: &lt;code&gt;QUANTITY&lt;&#x2F;code&gt; - &lt;code&gt;null&lt;&#x2F;code&gt; is also used for system logs; pending logs can still be identified by checking the &lt;code&gt;blockHash&lt;&#x2F;code&gt; for &lt;code&gt;null&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;transactionHash&lt;&#x2F;code&gt;: DATA, 32 Bytes - &lt;code&gt;null&lt;&#x2F;code&gt; is also used for system logs&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;engine-api&quot;&gt;Engine API&lt;&#x2F;h3&gt;
&lt;p&gt;In the engine API, the &lt;code&gt;ExecutionPayload&lt;&#x2F;code&gt; for versions corresponding to forks adopting this EIP is extended to include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;systemLogsRoot&lt;&#x2F;code&gt;: &lt;code&gt;DATA&lt;&#x2F;code&gt;, 32 Bytes&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;As part of &lt;code&gt;engine_forkchoiceUpdated&lt;&#x2F;code&gt;, Execution Layer implementations SHALL verify that &lt;code&gt;systemLogsRoot&lt;&#x2F;code&gt; for each block matches the actual value computed from local processing. This extends on top of existing &lt;code&gt;receiptsRoot&lt;&#x2F;code&gt; validation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;consensus-executionpayload-changes&quot;&gt;Consensus &lt;code&gt;ExecutionPayload&lt;&#x2F;code&gt; changes&lt;&#x2F;h3&gt;
&lt;p&gt;The consensus &lt;code&gt;ExecutionPayload&lt;&#x2F;code&gt; type is extended with a new field to store the system logs root.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ExecutionPayload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    system_logs_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Together with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7708&#x2F;&quot;&gt;EIP-7708&lt;&#x2F;a&gt; this EIP provides the ability for wallets to compute the exact ETH balance from logs without requiring download of every single block header and all withdrawals.&lt;&#x2F;p&gt;
&lt;p&gt;The block reward from priority fees no longer has to be summed up by processing all receipts and can be obtained from the system logs root, making it efficiently provable.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;alternatives-future&quot;&gt;Alternatives &#x2F; Future&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The information from withdrawals is now duplicated across both the &lt;code&gt;withdrawals&lt;&#x2F;code&gt; list and the system logs. Maybe the information could be massaged into the emitted &lt;code&gt;Withdrawal&lt;&#x2F;code&gt; log data, allowing the existing &lt;code&gt;withdrawals&lt;&#x2F;code&gt; list to be retired. The current list design requires the wallet to obtain all block headers and all withdrawals to ensure they obtained all data pertaining to the observed account. Allowing them to be queried using &lt;code&gt;eth_getLogs&lt;&#x2F;code&gt; is more in line with how deposits are being tracked.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The log definitions themselves are subject to change. Aligning them with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; for plain credits provides consistency. For withdrawals, the log data could match the form of deposit logs and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7685&#x2F;&quot;&gt;EIP-7685&lt;&#x2F;a&gt; request logs.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;As a new field is added to the block header, applications assuming a specific block header layout may need updating.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The emitted logs use &lt;code&gt;SYSTEM_ADDRESS&lt;&#x2F;code&gt; as their &lt;code&gt;address&lt;&#x2F;code&gt; which cannot conflict with user controlled smart contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>SSZ execution blocks</title>
        <published>2024-10-28T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Etan Kissling</name><uri>https://github.com/etan-status</uri>
	</author>
	
	<author>
		<name>Gajinder Singh</name><uri>https://github.com/g11tech</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7807/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7807-ssz-execution-blocks/21580" />
        

        <id>https://wg-eips.ritovision.com/7807/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7807"
            label="EIP-7807" />
        

        
        

        
        <summary type="html">Migration of execution blocks to SSZ</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7807/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP defines a migration process of execution blocks to &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;ssz&#x2F;simple-serialize.md&quot;&gt;Simple Serialize (SSZ)&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;With &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6404&#x2F;&quot;&gt;EIP-6404&lt;&#x2F;a&gt; SSZ transactions, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6466&#x2F;&quot;&gt;EIP-6466&lt;&#x2F;a&gt; SSZ receipts, and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6465&#x2F;&quot;&gt;EIP-6465&lt;&#x2F;a&gt; SSZ withdrawals, all Merkle-Patricia Tries (MPT) besides the state trie are converted to SSZ. This enables the surrounding data structure, the execution block itself, to also convert to SSZ, achieving a unified block representation across both Consensus Layer and Execution Layer.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Normalized block hash:&lt;&#x2F;strong&gt; The Consensus Layer can compute the block hash autonomously, enabling it to process all consistency checks that currently require asynchronous communication with the Execution Layer (&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;electra&#x2F;beacon-chain.md#modified-verify_and_notify_new_payload&quot;&gt;&lt;code&gt;verify_and_notify_new_payload&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;). This allows early rejection of inconsistent blocks and dropping the requirement to wait for engine API interactions while syncing.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Optimized engine API:&lt;&#x2F;strong&gt; With all exchanged data supporting SSZ, the engine API can be changed from the textual JSON encoding to binary SSZ encoding, reducing exchanged data size by ~50% and significantly improving encoding&#x2F;parsing efficiency.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Proving support:&lt;&#x2F;strong&gt; With SSZ, individual fields of the execution block header become provable without requiring full block headers to be present. With &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7495&#x2F;&quot;&gt;EIP-7495&lt;&#x2F;a&gt; SSZ &lt;code&gt;ProgressiveContainer&lt;&#x2F;code&gt;, proofs are forward compatible as long as underlying semantics of individual fields are unchanged, reducing maintenance requirements for smart contracts and verifying client applications.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Cleanup opportunity:&lt;&#x2F;strong&gt; The conversion to SSZ allows dropping historical fields from the PoW era and the inefficient logs bloom mechanism.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-amounts&quot;&gt;Gas amounts&lt;&#x2F;h3&gt;
&lt;p&gt;The different kinds of gas amounts are combined into a single structure, mirroring the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6404&#x2F;#gas-fees&quot;&gt;EIP-6404 gas fees&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;SSZ equivalent&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6404&#x2F;#normalized-transactions&quot;&gt;&lt;code&gt;GasAmount&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint64&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; GasAmounts&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    regular&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; GasAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    blob&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; GasAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;requests-hash-computation&quot;&gt;Requests hash computation&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;requests_hash&lt;&#x2F;code&gt; is changed to &lt;code&gt;ExecutionRequests.hash_tree_root()&lt;&#x2F;code&gt; using the same structure as in the Consensus Layer &lt;code&gt;BeaconBlockBody&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;execution-block-headers&quot;&gt;Execution block headers&lt;&#x2F;h3&gt;
&lt;p&gt;New execution block headers use a normalized SSZ representation.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ExecutionBlockHeader&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity&quot;&gt;    ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    parent_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    miner&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    transactions_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; EIP-6404 transactions.hash_tree_root()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    receipts_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; EIP-6466 receipts.hash_tree_root()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    number&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_limits&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; GasAmounts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_used&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; GasAmounts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    timestamp&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    extra_data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ByteList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;MAX_EXTRA_DATA_BYTES&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    mix_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    base_fees_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BlobFeesPerGas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    withdrawals_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; EIP-6465 withdrawals.hash_tree_root()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    excess_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; GasAmounts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    parent_beacon_block_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    requests_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; EIP-6110 execution_requests.hash_tree_root()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    system_logs_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; EIP-7799 system_logs.hash_tree_root()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;execution-block-hash-computation&quot;&gt;Execution block hash computation&lt;&#x2F;h3&gt;
&lt;p&gt;For new blocks, the execution block hash is changed to be based on &lt;code&gt;hash_tree_root&lt;&#x2F;code&gt; in all contexts, including (1) the &lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt; opcode, (2) JSON-RPC API interactions (&lt;code&gt;blockHash&lt;&#x2F;code&gt; field), (3) devp2p networking.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;consensus-executionpayload-changes&quot;&gt;Consensus &lt;code&gt;ExecutionPayload&lt;&#x2F;code&gt; changes&lt;&#x2F;h3&gt;
&lt;p&gt;Usages of &lt;code&gt;ExecutionPayloadHeader&lt;&#x2F;code&gt; are replaced with &lt;code&gt;ExecutionBlockHeader&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Usages of &lt;code&gt;ExecutionPayload&lt;&#x2F;code&gt; are updated to share &lt;code&gt;hash_tree_root&lt;&#x2F;code&gt; with &lt;code&gt;ExecutionBlockHeader&lt;&#x2F;code&gt;. &lt;code&gt;transactions_root&lt;&#x2F;code&gt;, &lt;code&gt;withdrawals_root&lt;&#x2F;code&gt; and &lt;code&gt;requests_hash&lt;&#x2F;code&gt; are expanded to their full list contents.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ExecutionPayload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity&quot;&gt;    ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    parent_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    miner&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    transactions&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Transaction&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    receipts_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    number&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_limits&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; GasAmounts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_used&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; GasAmounts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    timestamp&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    extra_data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ByteList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;MAX_EXTRA_DATA_BYTES&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    mix_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    base_fees_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BlobFeesPerGas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    withdrawals&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Withdrawal&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    excess_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; GasAmounts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    parent_beacon_block_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    requests&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionRequests&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    system_logs_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This completes the transition to SSZ for everything except the execution state trie.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;future&quot;&gt;Future&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;With SSZ &lt;code&gt;Log&lt;&#x2F;code&gt;, the withdrawals mechanism and validator requests could be redefined to be based on logs (similar to deposits, originally, but without the delay), possibly removing the need for &lt;code&gt;withdrawals_root&lt;&#x2F;code&gt; and &lt;code&gt;requests_hash&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The CL would insert the extra logs for minting (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7799&#x2F;&quot;&gt;EIP-7799&lt;&#x2F;a&gt;) and could fetch the ones relevant for withdrawing (deposits, requests, consolidations). That mechanism would be more generic than &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7685&#x2F;&quot;&gt;EIP-7685&lt;&#x2F;a&gt; and would drop requiring the EL to special case requests, including &lt;code&gt;compute_requests_hash&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;For client applications and smart contracts, it would streamline transaction history verification based on &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7792&#x2F;&quot;&gt;EIP-7792&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The Engine API should be updated with (1) possible withdrawals&#x2F;requests refactoring as above, (2) dropping the &lt;code&gt;block_hash&lt;&#x2F;code&gt; field so that &lt;code&gt;ExecutionPayload&lt;&#x2F;code&gt; is replaced with &lt;code&gt;ExecutionBlockHeader&lt;&#x2F;code&gt;, (3) binary encoding based on &lt;code&gt;ForkDigest&lt;&#x2F;code&gt;-context (through HTTP header or interleaved, similar to beacon-API). This reduces encoding overhead and also simplifies sharing data structures in combined CL&#x2F;EL in-process implementations.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This breaks compatibility of smart contracts that depend on the previous block header binary format, including for &quot;generic&quot; implementations that assume a common prefix and run the entire data through a linear keccak256 hash.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The SSZ block hash is based on SHA256 and shares the namespace with existing keccak256 based block hashes. As these hash algorithms are fundamentally different, no significant collision risk is expected.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Double speed for hash_tree_root</title>
        <published>2024-10-23T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Etan Kissling</name><uri>https://github.com/etan-status</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7797/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7797-double-speed-for-hash-tree-root/21447" />
        

        <id>https://wg-eips.ritovision.com/7797/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7797"
            label="EIP-7797" />
        

        
        

        
        <summary type="html">Double the performance of hash_tree_root by customizing SHA-256</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7797/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP explains how to customize &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b3e83f6691c61e5b35136000146015653b22ed38&#x2F;ssz&#x2F;simple-serialize.md#merkleization&quot;&gt;&lt;code&gt;hash_tree_root&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; to double its performance.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Hashing is a dominant performance bottleneck for Consensus Layer implementations. To support large validator counts, it is critical to optimize hashing performance.&lt;&#x2F;p&gt;
&lt;p&gt;Consensus Layer hashes are based on &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b3e83f6691c61e5b35136000146015653b22ed38&#x2F;ssz&#x2F;simple-serialize.md#merkleization&quot;&gt;&lt;code&gt;hash_tree_root&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;, a mechanism that splits up the data into chunks and then forms a tree by recursively combining two adjacent chunks and hashing them into a single parent chunk until only a single root chunk remains.&lt;&#x2F;p&gt;
&lt;p&gt;For hashing, Secure Hash Algorithm 2 with a digest size of 256 bits is used (SHA-256). This algorithm produces &lt;em&gt;exactly&lt;&#x2F;em&gt; 256 bits of output for a variable-length input message. However, as &lt;code&gt;hash_tree_root&lt;&#x2F;code&gt; pads all input chunks to exactly 256 bits, the effective input message length is always &lt;em&gt;exactly&lt;&#x2F;em&gt; 512 bits.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP defines how the SHA-256 algorithm used by &lt;code&gt;hash_tree_root&lt;&#x2F;code&gt; can be customized to exploit knowledge of the exact input length to double its performance, while retaining its security properties.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;sha-256-preprocessing&quot;&gt;SHA-256 preprocessing&lt;&#x2F;h3&gt;
&lt;p&gt;Before SHA-256 hash computation begins, the input message is preprocessed. A single &lt;code&gt;1&lt;&#x2F;code&gt; bit is appended to the input message, followed by a varying number of &lt;code&gt;0&lt;&#x2F;code&gt; bits, and finally a big endian &lt;code&gt;uint64&lt;&#x2F;code&gt; indicating the input message bit length. The number of &lt;code&gt;0&lt;&#x2F;code&gt; bits is chosen so that the message size is the smallest possible multiple of 512 bits. In the context of &lt;code&gt;hash_tree_root&lt;&#x2F;code&gt; where the input message size is 512 bits, preprocessing results in the following padded message:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   0x00 |                                               |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   0x10 |                     Input                     |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   0x20 |                    message                    |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   0x30 |                                               |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   0x40 |80|00 00 00 00 00 00 00 00 00 00 00 00 00 00 00|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   0x50 |00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   0x60 |00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   0x70 |00 00 00 00 00 00 00 00|00 00 00 00 00 00 02 00|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;sha-256-blocks&quot;&gt;SHA-256 blocks&lt;&#x2F;h3&gt;
&lt;p&gt;SHA-256 operates on message blocks of 512 bits. Therefore, in the context of &lt;code&gt;hash_tree_root&lt;&#x2F;code&gt; where the input message size is 512 bits, two message blocks are formed, the first containing the entire input message, and the second containing entirely static data resulting from the preprocessing step.&lt;&#x2F;p&gt;
&lt;p&gt;Note that the second 512 bit message block does not provide any entropy, and is only useful to distinguish input messages that share a common prefix and only vary in the number of trailing &lt;code&gt;0&lt;&#x2F;code&gt; bits. As &lt;code&gt;hash_tree_root&lt;&#x2F;code&gt; uses a fixed message size, no distinguishing is necessary. Further, SHA-256 is also considered secure for padded messages that fit into a single message block.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;sha-256-512&quot;&gt;SHA-256-512&lt;&#x2F;h3&gt;
&lt;p&gt;A new algorithm SHA-256-512 is defined as a modified SHA-256 algorithm that skips input message preprocessing and is restricted to inputs of exactly 512 bits. The input message SHALL be processed as is, as a single 512-bit SHA-256 message block.&lt;&#x2F;p&gt;
&lt;p&gt;For every &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b3e83f6691c61e5b35136000146015653b22ed38&#x2F;ssz&#x2F;simple-serialize.md#composite-types&quot;&gt;composite SSZ type&lt;&#x2F;a&gt; in use, implementations SHALL support a new type that shares the same functionality, but hashes using SHA-256-512 instead of regular SHA-256.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;consensus-types&quot;&gt;Consensus types&lt;&#x2F;h3&gt;
&lt;p&gt;Starting with the hard fork that introduces this EIP, the SHA-256-512 based composite SSZ types SHOULD be preferred over existing SHA-256 based types.&lt;&#x2F;p&gt;
&lt;p&gt;Certain use cases covering historical objects MAY require conversion to the historical data type and re-hashing with the original SHA-256 type to recover their historical root. This includes &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b3e83f6691c61e5b35136000146015653b22ed38&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#compute_signing_root&quot;&gt;&lt;code&gt;compute_signing_root&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; signing over historical data, and also individual fields such as &lt;code&gt;BeaconState.latest_block_header&lt;&#x2F;code&gt; which MAY refer to data from prior forks.&lt;&#x2F;p&gt;
&lt;p&gt;Certain other objects such as &lt;code&gt;DepositData&lt;&#x2F;code&gt; or &lt;code&gt;VoluntaryExit&lt;&#x2F;code&gt; MAY continue to rely on existing SHA-256 logic.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Doubling the throughput of the underlying hash algorithm allows scaling to more validators on the same hardware, or allows using the freed CPU time for other tasks. Even when caching rarely-changed intermediate hashes across computations such as the &lt;code&gt;validators&lt;&#x2F;code&gt; list of a &lt;code&gt;BeaconState&lt;&#x2F;code&gt;, and employing hardware-accelerated SHA-256 implementations that are further optimized for the tree structure using libraries such as &lt;code&gt;prysmaticlabs&#x2F;hashtree&lt;&#x2F;code&gt;, the state root validation step of the Consensus Layer state transition function can still consume ~25% of CPU time (Holesky test network, ~1.7m validators), mostly dominated by frequently changing per-validator structures such as the &lt;code&gt;EpochParticipationFlags&lt;&#x2F;code&gt; lists.&lt;&#x2F;p&gt;
&lt;p&gt;If the hash algorithm is changed to a more zero-knowledge friendly one in the future, similar efforts as described in this EIP would be needed to identify the locations where historical objects need to be hashed using historical hashes, and also to introduce new composite SSZ types. A switch from SHA-256 to SHA-256-512 would pull such work ahead, and any future hash algorithm changes would solely have to extend on these known locations. The total work necessary to switch hash algorithms multiple times is comparable to switching a single time.&lt;&#x2F;p&gt;
&lt;p&gt;Existing hardware acceleration for SHA-256 continues to be viable, as only the message preprocessing step is dropped. Hardware acceleration typically only implements the SHA-256 message block function, which is unchanged by this EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Smart contracts and client applications that verify Consensus Layer data require updates to remain compatible with data hashed using SHA-256-512. New logic may be required to correctly select the hash algorithm for historical structures such as &lt;code&gt;BeaconBlockHeader&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;SSZ serialization, generalized indices, as well as semantics of individual object fields remain unchanged.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Certain SHA-256-512 hashes of 512 bit data may collide with regular SHA-256 hashes of shorter data. For example:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Any common 440-bit prefix: &lt;code&gt;COMMON_PREFIX := 0x000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f30313233343536&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SHA-256-512(COMMON_PREFIX ++ 0x80 ++ 0x00000000000001b8) == 463eb28e72f82e0a96c0a4cc53690c571281131f672aa229e0d45ae59b598b59&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SHA-256(COMMON_PREFIX) == 463eb28e72f82e0a96c0a4cc53690c571281131f672aa229e0d45ae59b598b59&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Because SSZ has never hashed data with sizes different from 512 bits, SSZ hashes based on SHA-256 do not collide with hashes based on SHA-256-512.&lt;&#x2F;p&gt;
&lt;p&gt;SHA-256-512 SHOULD NOT be used for purposes other than SSZ Merkleization.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Grant Registry</title>
        <published>2024-10-22T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Guilherme Neves</name><uri>https://github.com/0xneves</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7794/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7794-grant-registry/20791" />
        

        <id>https://wg-eips.ritovision.com/7794/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7794"
            label="ERC-7794" />
        

        
        

        
        <summary type="html">A cross-network registry contract to manage and track grants, enhancing transparency and  interoperability for grant programs.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7794/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal introduces a Grant Registry contract intended for managing financial, research, or project-based grants that provide funding for projects across multiple blockchains. The contract standardizes the registration, management, and tracking of these grants by organizing data into distinct categories, enabling clear separation between immutable fields and mutable fields. It supports modular disbursement tracking and allows for external links to off-chain documentation. This registry emits lifecycle events, enabling external protocols to efficiently access grant data, which promotes transparency, interoperability, and enhanced insights into grant program performance.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The Ethereum ecosystem currently lacks a standardized way to manage and track grants across different chains and programs, leading to inefficiencies and fragmentation. Each grant program has its own distinct interface, processes, and management mechanisms, which creates barriers for both funders and grantees. These issues hinder transparency, complicate the tracking of fund disbursements, and make it difficult to evaluate the overall effectiveness of grant programs across different networks.&lt;&#x2F;p&gt;
&lt;p&gt;The lack of interoperability between grant programs further exacerbates the problem, as projects and contributors often work across multiple blockchains. This makes it challenging to aggregate data, monitor milestones, and assess grantee performance in a consistent manner.&lt;&#x2F;p&gt;
&lt;p&gt;The Grant Registry contract solves these issues by introducing a unified standard that ensures all grants can be registered, tracked, and managed consistently, regardless of the underlying chain or program. This approach not only simplifies the lifecycle management of grants but also fosters better collaboration between communities, allowing for more competitiveness and better tracking of progress. Additionally, the standardization of data opens the door for more insightful analytics, enabling protocols to measure the impact of grants in a much more streamlined and transparent way.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;contract-interface&quot;&gt;&lt;strong&gt;Contract Interface&lt;&#x2F;strong&gt;&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.20&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IGrantRegistry&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Thrown when the community name length is invalid (e.g., too short or too long).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InvalidCommunityNameLength&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Thrown when the caller is not the current grant manager.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InvalidGrantManager&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Thrown when a grant is already registered with the provided ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; GrantAlreadyRegistered&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Thrown when attempting to add a grantee that is already present in the set.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; GranteeAlreadyAdded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Thrown when attempting to remove a grantee that is not found in the set.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; GranteeNotFound&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Thrown when attempting to add or reference an invalid external link.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InvalidExternalLink&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Thrown when an invalid index is provided (e.g., out of bounds for an array).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InvalidIndex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Thrown when a milestone date is invalid (e.g., earlier than the grant&amp;#39;s start date).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InvalidStartDate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Thrown when attempting to add a milestone date that is already present.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MilestoneDateAlreadyAdded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Thrown when attempting to remove or reference a milestone date that is not found.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MilestoneDateNotFound&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a new grant is registered.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The unique identifier for the grant.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The grant&amp;#39;s unique numeric ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; chainid&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The chain ID where the grant is registered.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; community&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The name of the community that issued the grant.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; grantManager&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the grant manager.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; GrantRegistered&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; chainid&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; community&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantManager&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when the ownership of a grant is transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The unique identifier of the grant.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; newGrantManager&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the new grant manager.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OwnershipTransferred&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newGrantManager&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a new grantee is added to the grant.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The unique identifier of the grant.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; grantee&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the new grantee.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; GranteeAdded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantee&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a grantee is removed from the grant.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The unique identifier of the grant.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; grantee&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the removed grantee.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; GranteeRemoved&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantee&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when the start date of a grant is set.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The unique identifier of the grant.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; startDate&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The timestamp representing the start date.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; StartDateSet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; startDate&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a new milestone date is added to the grant.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The unique identifier of the grant.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; milestoneDate&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The timestamp of the added milestone.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MilestoneDateAdded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; milestoneDate&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a milestone date is removed from the grant.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The unique identifier of the grant.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; milestoneDate&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The timestamp of the removed milestone.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MilestoneDateRemoved&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; milestoneDate&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a disbursement is added to a milestone.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The unique identifier of the grant.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; milestoneDate&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The timestamp of the milestone.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; fundingToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token used for the disbursement.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; fundingAmount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of the disbursement.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DisbursementAdded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; milestoneDate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; fundingToken&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; fundingAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a disbursement is removed from a milestone.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The unique identifier of the grant.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; milestoneDate&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The timestamp of the milestone.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DisbursementRemoved&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; milestoneDate&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a disbursement status is updated.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The unique identifier of the grant.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; milestoneDate&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The timestamp of the milestone.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; isDisbursed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Boolean indicating if the disbursement has been made.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DisbursementMade&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; milestoneDate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; isDisbursed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when an external link is added to the grant.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The unique identifier of the grant.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; link&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The external URL added.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ExternalLinkAdded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; link&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when an external link is removed from the grant.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The unique identifier of the grant.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; link&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The external URL removed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ExternalLinkRemoved&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; link&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Registers a new grant with the provided details. `grantId` is generated by hashing the grant&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * details and the current timestamp.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * - The `grantManager` address must not be the zero address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * - The `community` name must not be empty.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * - The grant must not already be registered.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * Emits a {GrantRegistered} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The unique identifier for the grant program.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; chainid&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The chain ID where the grant is being registered.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; community&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The name of the community or protocol issuing the grant.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; grantManager&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the grant manager.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; generated `grantId` as a bytes32 value.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; registerGrant&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; chainid&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; community&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantManager&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfers ownership of the grant to a new grant manager.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * - The caller must be the current grant manager.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * - The `newGrantManager` address must not be the zero address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * Emits an {OwnershipTransferred} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The unique identifier of the grant.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; newGrantManager&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the new grant manager.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferOwnership&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newGrantManager&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Adds a new grantee to the grant.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * - The caller must be the current grant manager.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * - The `grantee` address must not be the zero address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * Emits a {GranteeAdded} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The unique identifier of the grant.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; grantee&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the grantee to be added.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addGrantee&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantee&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Removes an existing grantee from the grant.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * - The caller must be the current grant manager.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * - The `grantee` address must be present in the grant.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * Emits a {GranteeRemoved} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The unique identifier of the grant.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; grantee&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the grantee to be removed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; removeGrantee&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantee&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sets the start date for the grant.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * - The caller must be the current grant manager.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * Emits a {StartDateSet} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The unique identifier of the grant.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; startDate&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The timestamp representing the start date.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setStartDate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; startDate&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Adds a new milestone date for the grant.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * - The caller must be the current grant manager.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * - The milestone date must not already exist in the grant.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * Emits a {MilestoneDateAdded} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The unique identifier of the grant.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; milestoneDate&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The timestamp representing the milestone date.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addMilestoneDate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; milestoneDate&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Removes a milestone date from the grant.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * - The caller must be the current grant manager.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * - The milestone date must exist in the grant.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * Emits a {MilestoneDateRemoved} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The unique identifier of the grant.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; milestoneDate&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The timestamp representing the milestone date to be removed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; removeMilestoneDate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; milestoneDate&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Ovewrites a disbursement for a specific milestone.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * - The caller must be the current grant manager.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * - The milestone date must exist in the grant.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * Emits a {DisbursementAdded} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The unique identifier of the grant.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; milestoneDate&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The milestone date associated with the disbursement.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; fundingToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the token used for funding.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; fundingAmount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of tokens to be disbursed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addDisbursement&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; milestoneDate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; fundingToken&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; fundingAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Removes a disbursement for a specific milestone.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * - The caller must be the current grant manager.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * - The milestone date must exist in the grant.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * Emits a {DisbursementRemoved} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The unique identifier of the grant.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; milestoneDate&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The milestone date associated with the disbursement.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; removeDisbursement&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; milestoneDate&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Updates the disbursement status for a specific milestone.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * - The caller must be the current grant manager.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * - The milestone date must exist in the grant.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * Emits a {DisbursementMade} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The unique identifier of the grant.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; milestoneDate&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The milestone date associated with the disbursement.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; isDisbursed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A boolean value indicating if the disbursement has been made.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setDisbursementStatus&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; milestoneDate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; isDisbursed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Adds an external link related to the grant.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * - The caller must be the current grant manager.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * - The link must not be empty.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * Emits an {ExternalLinkAdded} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The unique identifier of the grant.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; link&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The external URL to be added.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addExternalLink&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; link&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Removes an external link associated with the grant.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * - The caller must be the current grant manager.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * - The index must be within the bounds of the external links array.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * Emits an {ExternalLinkRemoved} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The unique identifier of the grant.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; index&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The index of the external link to be removed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; removeExternalLink&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieves details of a specific grant by its ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The unique identifier of the grant&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `Grant` struct containing id, chainid, and community label&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getGrant&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Grant&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieves the current grant manager for a specific grant&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The unique identifier of the grant&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address of the grant manager&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getGrantManager&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieves the list of grantees associated with a specific grant&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The unique identifier of the grant&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; An&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of addresses representing the grantees&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getGrantees&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieves the start date and list of milestone dates for a specific grant&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The unique identifier of the grant&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; start date and an array of milestone dates&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getMilestonesDates&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieves the disbursement details for a specific milestone in a grant&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The unique identifier of the grant&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; milestoneDate&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The date of the milestone for which disbursement details are requested&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `Disbursements` struct containing the token address, funding amount, and disbursement status&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getDisbursement&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; milestoneDate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Disbursements&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieves the list of external links associated with a specific grant&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The unique identifier of the grant&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; An&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of strings representing the external links&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getExternalLinks&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;When calling the &lt;code&gt;registerGrant&lt;&#x2F;code&gt; function:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;grantManager&lt;&#x2F;code&gt; &lt;strong&gt;MUST&lt;&#x2F;strong&gt; submit a valid grantManager address that is not the zero address.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;community&lt;&#x2F;code&gt; label &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be a non-empty string.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;grant&lt;&#x2F;code&gt; ID &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be unique and not already registered in the system.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;When editing overall grant details:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;grantManager&lt;&#x2F;code&gt; &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be the current grant manager to make changes to the grant.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;When adding a &lt;code&gt;milestoneDate&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;milestoneDate&lt;&#x2F;code&gt; &lt;strong&gt;MUST&lt;&#x2F;strong&gt; not exist in the milestonesDates set.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;When editing disbursments:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;milestoneDate&lt;&#x2F;code&gt; &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be a valid milestone date associated with the grant.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;When adding &lt;code&gt;externalLinks&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The string &lt;strong&gt;MUST&lt;&#x2F;strong&gt; not be empty.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The design of this Grant Registry Contract is driven by the need for a flexible and modular system that supports a wide range of grant programs across different chains. The rationale for the key design decisions is outlined below:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Separation of Fields: The division of fields into different categories, such as identification, grant data, and disbursement-related information, allows for a more efficient use of on-chain storage. Immutable fields like id, chainid, and community are kept separate from mutable fields, ensuring that core identification elements remain unchanged, while other aspects like milestones and participants can be updated throughout the grant lifecycle.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Modular Disbursement Handling: Not all grant programs will choose to perform disbursements on-chain. By allowing disbursements to be managed through external links, the contract remains modular and adaptable to different use cases. Programs that prefer to handle disbursements off-chain can still use the registry for status tracking, ensuring broad applicability across different ecosystems.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Dynamic Team Management: The participants structure uses EnumerableSet for grantees, allowing for team-based grants. This feature facilitates tracking of contributions and adjustments to the grant team over time, enabling more comprehensive reputation systems and transparency.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;This design aims to create a scalable, efficient system that can evolve with the needs of different grant programs, while maintaining key benefits like transparency, modularity, and low gas usage.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.20&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; { &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IGrantRegistry&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IGrantRegistry.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; { &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;EnumerableSet&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;utils&#x2F;structs&#x2F;EnumerableSet.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; GrantRegistry&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IGrantRegistry&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  using&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EnumerableSet&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EnumerableSet&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;AddressSet&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  using&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EnumerableSet&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EnumerableSet&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;UintSet&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Mapping to store the details of each grant, keyed by its unique grantId.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Grant&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _grants&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Stores information about the participants in each grant (manager and grantees), keyed by the grantId.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * This mapping allows tracking of the grant manager and the associated grantees for each grant.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Participants&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _participants&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Stores milestone-related data for each grant, keyed by the grantId.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * This includes the start date, milestone dates, and disbursements related to each milestone.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Milestones&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _milestones&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Stores external links related to each grant, such as proposal URLs or related documentation, keyed by grantId.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * External links provide references to off-chain information about the grant.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _externalLinks&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See {IGrantRegistry-registerGrant}.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; registerGrant&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; chainid&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; community&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantManager&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; grantId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;      abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; chainid&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; community&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;grantManager &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InvalidGrantManager&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;community&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InvalidCommunityNameLength&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_grants&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;grantId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;community&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; GrantAlreadyRegistered&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    _grants&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;grantId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Grant&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; chainid&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; community&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    _participants&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;grantId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;grantManager &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; grantManager&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; GrantRegistered&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;grantId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; chainid&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; community&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; grantManager&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; grantId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See {IGrantRegistry-transferOwnership}.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferOwnership&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newGrantManager&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    _requireManager&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;grantId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;newGrantManager &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InvalidGrantManager&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    _participants&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;grantId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;grantManager &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; newGrantManager&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OwnershipTransferred&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;grantId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; newGrantManager&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See {IGrantRegistry-addGrantee}.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addGrantee&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantee&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    _requireManager&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;grantId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;grantee &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InvalidGrantManager&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bool&lt;&#x2F;span&gt;&lt;span&gt; success &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _participants&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;grantId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;grantees&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;grantee&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; GranteeAlreadyAdded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; GranteeAdded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;grantId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; grantee&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See {IGrantRegistry-removeGrantee}.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; removeGrantee&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantee&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    _requireManager&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;grantId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bool&lt;&#x2F;span&gt;&lt;span&gt; success &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _participants&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;grantId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;grantees&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;remove&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;grantee&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; GranteeNotFound&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; GranteeRemoved&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;grantId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; grantee&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See {IGrantRegistry-setStartDate}.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setStartDate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; startDate&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    _requireManager&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;grantId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    _milestones&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;grantId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;startDate &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; startDate&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; StartDateSet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;grantId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; startDate&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See {IGrantRegistry-addMilestoneDate}.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addMilestoneDate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; milestoneDate&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    _requireManager&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;grantId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bool&lt;&#x2F;span&gt;&lt;span&gt; success &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _milestones&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;grantId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;milestonesDates&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;milestoneDate&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MilestoneDateAlreadyAdded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MilestoneDateAdded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;grantId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; milestoneDate&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See {IGrantRegistry-removeMilestoneDate}.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; removeMilestoneDate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; milestoneDate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    _requireManager&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;grantId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bool&lt;&#x2F;span&gt;&lt;span&gt; success &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _milestones&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;grantId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;milestonesDates&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;remove&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;milestoneDate&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MilestoneDateNotFound&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MilestoneDateRemoved&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;grantId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; milestoneDate&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See {IGrantRegistry-addDisbursement}.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addDisbursement&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; milestoneDate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; fundingToken&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; fundingAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    _requireManager&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;grantId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    _requireMilestoneDate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;grantId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; milestoneDate&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    _milestones&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;grantId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;disbursements&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;milestoneDate&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Disbursements&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      fundingToken&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      fundingAmount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;      false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DisbursementAdded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;grantId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; milestoneDate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; fundingToken&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; fundingAmount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See {IGrantRegistry-removeDisbursement}.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; removeDisbursement&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; milestoneDate&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    _requireManager&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;grantId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    _requireMilestoneDate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;grantId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; milestoneDate&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    delete&lt;&#x2F;span&gt;&lt;span&gt; _milestones&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;grantId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;disbursements&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;milestoneDate&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DisbursementRemoved&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;grantId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; milestoneDate&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See {IGrantRegistry-setDisbursementStatus}.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setDisbursementStatus&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; milestoneDate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; isDisbursed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    _requireManager&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;grantId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    _requireMilestoneDate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;grantId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; milestoneDate&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    _milestones&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;grantId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;disbursements&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;milestoneDate&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;isDisbursed &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; isDisbursed&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DisbursementMade&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;grantId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; milestoneDate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; isDisbursed&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See {IGrantRegistry-addExternalLink}.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addExternalLink&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; link&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    _requireManager&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;grantId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;link&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InvalidExternalLink&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    _externalLinks&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;grantId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;push&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;link&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ExternalLinkAdded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;grantId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; link&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See {IGrantRegistry-removeExternalLink}.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; removeExternalLink&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    _requireManager&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;grantId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;index &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _externalLinks&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;grantId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InvalidIndex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; link &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _externalLinks&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;grantId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    _externalLinks&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;grantId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; _externalLinks&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;grantId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      _externalLinks&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;grantId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    _externalLinks&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;grantId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;pop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ExternalLinkRemoved&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;grantId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; link&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Ensures that the caller is the grant manager for the given grantId.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * Reverts with `InvalidGrantManager` if the caller is not the grant manager.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The unique identifier of the grant being checked.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _requireManager&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; _participants&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;grantId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;grantManager&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InvalidGrantManager&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Ensures that the milestone date is present in the grant.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * Reverts with `MilestoneDateNotFound` if the milestone date is not present.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The unique identifier of the grant being checked.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; milestoneDate&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The milestone date being checked.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _requireMilestoneDate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; milestoneDate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;_milestones&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;grantId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;milestonesDates&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;contains&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;milestoneDate&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MilestoneDateNotFound&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See {IGrantRegistry-getGrant}.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getGrant&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Grant&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; _grants&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;grantId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See {IGrantRegistry-getGrantManager}.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getGrantManager&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; _participants&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;grantId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;grantManager&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See {IGrantRegistry-getGrantees}.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getGrantees&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; _participants&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;grantId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;grantees&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;values&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See {IGrantRegistry-getMilestonesDates}.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getMilestonesDates&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      _milestones&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;grantId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;startDate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      _milestones&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;grantId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;milestonesDates&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;values&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See {IGrantRegistry-getDisbursement}.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getDisbursement&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; milestoneDate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Disbursements&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; _milestones&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;grantId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;disbursements&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;milestoneDate&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See {IGrantRegistry-getExternalLinks}.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getExternalLinks&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; _externalLinks&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;grantId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Key considerations for this implementation:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Gas Optimization: &lt;code&gt;grantId&lt;&#x2F;code&gt; utilizes immutable identification fields to minimize large gas consumption. This ensures that essential information is used with keccak256 efficiently, while the mutable data can be submitted or modified later as the project evolves without affecting the identification method.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Use of EnumerableSet: By leveraging EnumerableSet for managing participants and milestone dates, the contract allows for dynamic updates, such as team composition changes or new milestones. This approach offers flexibility without sacrificing the ability to efficiently track changes.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;No security concerns were found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Wallet Call Token Capabilities</title>
        <published>2024-10-22T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Agustín Aguilar</name><uri>https://github.com/agusx1211</uri>
	</author>
	
	<author>
		<name>Michael Standen</name><uri>https://github.com/ScreamingHawk</uri>
	</author>
	
	<author>
		<name>Peter Kieltyka</name><uri>https://github.com/pkieltyka</uri>
	</author>
	
	<author>
		<name>William Hua</name><uri>https://github.com/attente</uri>
	</author>
	
	<author>
		<name>Philippe Castonguay</name><uri>https://github.com/PhABC</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7795/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7795-wallet-call-token-capabilities/21426" />
        

        <id>https://wg-eips.ritovision.com/7795/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7795"
            label="ERC-7795" />
        

        
        

        
        <summary type="html">Wallet Call API extension for transaction prerequisites for common token types</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7795/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC extends &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5792&#x2F;&quot;&gt;EIP-5792&lt;&#x2F;a&gt; by defining capabilities that allow dApps to specify common token prerequisites for transactions, such as having certain &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;, or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; tokens. Wallets can then help users meet these requirements before executing the transactions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;It is fairly common for dApps to reside only on one network, but this comes at the cost of shrinking the direct liquidity that these dApps can access. This happens because most users only have funds on a limited number of networks. As the number of networks grows, the likelihood of intersection between the networks chosen by the dApp and the user decreases.&lt;&#x2F;p&gt;
&lt;p&gt;Given that dApps don&#x27;t have a way of communicating with the wallet about their &quot;final intent&quot;, they can only use transaction requests to communicate the last action that the user should take. However, it is up to the user to &quot;guess&quot; what prior actions need to be executed to fulfill the prerequisites of that final action.&lt;&#x2F;p&gt;
&lt;p&gt;This guessing may involve consolidating funds into a single network or exchanging assets into another asset accepted by the dApp. This is a cumbersome process for the user and results in a highly degraded UX.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;This ERC extends &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5792&#x2F;&quot;&gt;EIP-5792&lt;&#x2F;a&gt; by adding new capabilities that can be used with the &lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt; and &lt;code&gt;wallet_getCapabilities&lt;&#x2F;code&gt; methods. These capabilities allow specifying different types of transaction requirements for common token standards that wallets can handle.&lt;&#x2F;p&gt;
&lt;p&gt;DApps &lt;strong&gt;MAY&lt;&#x2F;strong&gt; opt out of using this feature if they wish to handle requirement fulfillment themselves.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;erc-20-minimum-balance-capability&quot;&gt;ERC-20 Minimum Balance Capability&lt;&#x2F;h3&gt;
&lt;p&gt;A dApp can use the &lt;code&gt;erc20MinBalance&lt;&#x2F;code&gt; capability in a &lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt; request to request that a wallet ensure the owner has a minimum balance of a specified &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; token.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;wallet-getcapabilities-response&quot;&gt;&lt;code&gt;wallet_getCapabilities&lt;&#x2F;code&gt; Response&lt;&#x2F;h4&gt;
&lt;p&gt;Schema:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Erc20MinBalanceCapability&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  supported&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; boolean&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  versions&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Example:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;0x1&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;erc20MinBalance&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;supported&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;versions&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;wallet-sendcalls-request&quot;&gt;&lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt; Request&lt;&#x2F;h4&gt;
&lt;p&gt;Version 1.0 Schema:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Erc20MinBalanceParams&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  version&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Hex chain id&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  token&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  minAmount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Hex value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This capability requests that the &lt;code&gt;owner&lt;&#x2F;code&gt; address &lt;strong&gt;MUST&lt;&#x2F;strong&gt; have a balance of at least &lt;code&gt;minAmount&lt;&#x2F;code&gt; of &lt;code&gt;token&lt;&#x2F;code&gt; on &lt;code&gt;chainId&lt;&#x2F;code&gt; before the transaction is executed.&lt;&#x2F;p&gt;
&lt;p&gt;Example:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;from&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xd46e8dd67c5d32be8058bb8eb970870f07244567&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;calls&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xd46e8dd67c5d32be8058bb8eb970870f07244567&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x00&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;capabilities&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;erc20MinBalance&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xd46e8dd67c5d32be8058bb8eb970870f07244567&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;token&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;minAmount&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0f4240&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;erc-20-minimum-allowance-capability&quot;&gt;ERC-20 Minimum Allowance Capability&lt;&#x2F;h3&gt;
&lt;p&gt;A dApp can use the &lt;code&gt;erc20MinAllowance&lt;&#x2F;code&gt; capability in a &lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt; request to request that a wallet ensure the owner has a minimum allowance of a specified &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; token.
Note this capability does not imply that the owner has a balance of the token, only that the allowance is equal to or greater than the specified amount.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;wallet-getcapabilities-response-1&quot;&gt;&lt;code&gt;wallet_getCapabilities&lt;&#x2F;code&gt; Response&lt;&#x2F;h4&gt;
&lt;p&gt;Schema:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Erc20MinAllowanceCapability&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  supported&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; boolean&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  versions&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Example:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;0x1&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;erc20MinAllowance&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;supported&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;versions&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;wallet-sendcalls-request-1&quot;&gt;&lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt; Request&lt;&#x2F;h4&gt;
&lt;p&gt;Version 1.0 Schema:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Erc20MinAllowanceParams&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  version&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Hex chain id&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  token&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  minAmount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Hex value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This capability requests that the &lt;code&gt;owner&lt;&#x2F;code&gt; address &lt;strong&gt;MUST&lt;&#x2F;strong&gt; have an allowance of at least &lt;code&gt;minAmount&lt;&#x2F;code&gt; of &lt;code&gt;token&lt;&#x2F;code&gt; for &lt;code&gt;operator&lt;&#x2F;code&gt; on &lt;code&gt;chainId&lt;&#x2F;code&gt; before the transaction is executed.&lt;&#x2F;p&gt;
&lt;p&gt;Example:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;from&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xd46e8dd67c5d32be8058bb8eb970870f07244567&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;calls&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xd46e8dd67c5d32be8058bb8eb970870f07244567&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x00&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;capabilities&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;erc20MinAllowance&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xd46e8dd67c5d32be8058bb8eb970870f07244567&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;token&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xd46e8dd67c5d32be8058bb8eb970870f07244567&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;minAmount&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0f4240&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;erc-721-ownership-capability&quot;&gt;ERC-721 Ownership Capability&lt;&#x2F;h3&gt;
&lt;p&gt;A dApp can use the &lt;code&gt;erc721Ownership&lt;&#x2F;code&gt; capability in a &lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt; request to request that a wallet ensure the owner has ownership of a specified &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; token.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;wallet-getcapabilities-response-2&quot;&gt;&lt;code&gt;wallet_getCapabilities&lt;&#x2F;code&gt; Response&lt;&#x2F;h4&gt;
&lt;p&gt;Schema:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Erc721OwnershipCapability&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  supported&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; boolean&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  versions&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Example:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;0x1&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;erc721Ownership&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;supported&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;versions&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;wallet-sendcalls-request-2&quot;&gt;&lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt; Request&lt;&#x2F;h4&gt;
&lt;p&gt;Version 1.0 Schema:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Erc721OwnershipParams&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  version&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Hex chain id&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  token&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Hex value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This capability requests that the &lt;code&gt;owner&lt;&#x2F;code&gt; address &lt;strong&gt;MUST&lt;&#x2F;strong&gt; have ownership of &lt;code&gt;tokenId&lt;&#x2F;code&gt; of &lt;code&gt;token&lt;&#x2F;code&gt; on &lt;code&gt;chainId&lt;&#x2F;code&gt; before the transaction is executed.&lt;&#x2F;p&gt;
&lt;p&gt;Example:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;from&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xd46e8dd67c5d32be8058bb8eb970870f07244567&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;calls&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x00&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;capabilities&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;erc721Ownership&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xd46e8dd67c5d32be8058bb8eb970870f07244567&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;token&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x10&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;erc-721-approval-capability&quot;&gt;ERC-721 Approval Capability&lt;&#x2F;h3&gt;
&lt;p&gt;A dApp can use the &lt;code&gt;erc721Approval&lt;&#x2F;code&gt; capability in a &lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt; request to request that a wallet ensure the owner has approved a specified &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; token.
Note this capability does not imply that the owner has a balance of the token, only that the allowance is equal to or greater than the specified amount.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;wallet-getcapabilities-response-3&quot;&gt;&lt;code&gt;wallet_getCapabilities&lt;&#x2F;code&gt; Response&lt;&#x2F;h4&gt;
&lt;p&gt;Schema:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Erc721ApprovalCapability&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  supported&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; boolean&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  versions&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Example:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;0x1&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;erc721Approval&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;supported&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;versions&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;wallet-sendcalls-request-3&quot;&gt;&lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt; Request&lt;&#x2F;h4&gt;
&lt;p&gt;Version 1.0 Schema:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Erc721ApprovalParams&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  version&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Hex chain id&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  token&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Hex value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This capability requests that the &lt;code&gt;owner&lt;&#x2F;code&gt; address &lt;strong&gt;MUST&lt;&#x2F;strong&gt; have approved &lt;code&gt;operator&lt;&#x2F;code&gt; to transfer &lt;code&gt;tokenId&lt;&#x2F;code&gt; of &lt;code&gt;token&lt;&#x2F;code&gt; on &lt;code&gt;chainId&lt;&#x2F;code&gt; before the transaction is executed.&lt;&#x2F;p&gt;
&lt;p&gt;Example:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;from&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xd46e8dd67c5d32be8058bb8eb970870f07244567&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;calls&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x00&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;capabilities&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;erc721Approval&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xd46e8dd67c5d32be8058bb8eb970870f07244567&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;token&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x10&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;erc-1155-minimum-balance-capability&quot;&gt;ERC-1155 Minimum Balance Capability&lt;&#x2F;h3&gt;
&lt;p&gt;A dApp can use the &lt;code&gt;erc1155MinBalance&lt;&#x2F;code&gt; capability in a &lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt; request to request that a wallet ensure the owner has a minimum balance of a specified &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; token.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;wallet-getcapabilities-response-4&quot;&gt;&lt;code&gt;wallet_getCapabilities&lt;&#x2F;code&gt; Response&lt;&#x2F;h4&gt;
&lt;p&gt;Schema:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Erc1155MinBalanceCapability&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  supported&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; boolean&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  versions&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Example:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;0x1&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;erc1155MinBalance&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;supported&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;versions&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;wallet-sendcalls-request-4&quot;&gt;&lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt; Request&lt;&#x2F;h4&gt;
&lt;p&gt;Version 1.0 Schema:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Erc1155MinBalanceParams&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  version&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Hex chain id&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  token&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Hex value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  minAmount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Hex value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This capability requests that the &lt;code&gt;owner&lt;&#x2F;code&gt; address &lt;strong&gt;MUST&lt;&#x2F;strong&gt; have a balance of at least &lt;code&gt;minAmount&lt;&#x2F;code&gt; of &lt;code&gt;tokenId&lt;&#x2F;code&gt; of &lt;code&gt;token&lt;&#x2F;code&gt; on &lt;code&gt;chainId&lt;&#x2F;code&gt; before the transaction is executed.&lt;&#x2F;p&gt;
&lt;p&gt;Example:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;from&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xd46e8dd67c5d32be8058bb8eb970870f07244567&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;calls&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x631998e91476da5b870d741192fc5cbc55f5a52e&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x00&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;capabilities&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;erc1155MinBalance&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xd46e8dd67c5d32be8058bb8eb970870f07244567&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;token&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x631998e91476da5b870d741192fc5cbc55f5a52e&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x10&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;minAmount&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0f4240&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;erc-1155-minimum-allowance-capability&quot;&gt;ERC-1155 Minimum Allowance Capability&lt;&#x2F;h3&gt;
&lt;p&gt;A dApp can use the &lt;code&gt;erc1155MinAllowance&lt;&#x2F;code&gt; capability in a &lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt; request to request that a wallet ensure the owner has a minimum allowance of a specified &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; token.
Note this capability does not imply that the owner has a balance of the token, only that the allowance is equal to or greater than the specified amount.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;wallet-getcapabilities-response-5&quot;&gt;&lt;code&gt;wallet_getCapabilities&lt;&#x2F;code&gt; Response&lt;&#x2F;h4&gt;
&lt;p&gt;Schema:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Erc1155MinAllowanceCapability&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  supported&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; boolean&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  versions&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Example:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;0x1&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;erc1155MinAllowance&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;supported&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;versions&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;wallet-sendcalls-request-5&quot;&gt;&lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt; Request&lt;&#x2F;h4&gt;
&lt;p&gt;Version 1.0 Schema:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Erc1155MinAllowanceParams&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  version&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Hex chain id&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  token&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Hex value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  minAmount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Hex value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This capability requests that the &lt;code&gt;owner&lt;&#x2F;code&gt; address &lt;strong&gt;MUST&lt;&#x2F;strong&gt; have an allowance of at least &lt;code&gt;minAmount&lt;&#x2F;code&gt; of &lt;code&gt;tokenId&lt;&#x2F;code&gt; of &lt;code&gt;token&lt;&#x2F;code&gt; for &lt;code&gt;operator&lt;&#x2F;code&gt; on &lt;code&gt;chainId&lt;&#x2F;code&gt; before the transaction is executed.&lt;&#x2F;p&gt;
&lt;p&gt;Example:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;from&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xd46e8dd67c5d32be8058bb8eb970870f07244567&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;calls&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x631998e91476da5b870d741192fc5cbc55f5a52e&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x00&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;capabilities&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;erc1155MinAllowance&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xd46e8dd67c5d32be8058bb8eb970870f07244567&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;token&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x631998e91476da5b870d741192fc5cbc55f5a52e&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x10&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;minAmount&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0f4240&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;usage-examples&quot;&gt;Usage Examples&lt;&#x2F;h3&gt;
&lt;p&gt;This ERC serves as a foundational component for building user experiences that rely on cross-chain actions. It can be leveraged in various ways, depending on the combination of use cases and wallet implementations. Consider the following high-level examples.&lt;&#x2F;p&gt;
&lt;p&gt;Not shown in the examples below are the &lt;code&gt;wallet_getCallsStatus&lt;&#x2F;code&gt; and &lt;code&gt;wallet_showCallsStatus&lt;&#x2F;code&gt; methods, which are used to query the status of a call bundle and display it to the user. The dApp &lt;strong&gt;MAY&lt;&#x2F;strong&gt; use these methods to provide a better user experience while waiting for the transactions to be fulfilled. More information can be found in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5792&#x2F;&quot;&gt;EIP-5792&lt;&#x2F;a&gt; specification.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;marketplace-interaction-with-bridge-using-an-eoa-wallet&quot;&gt;Marketplace Interaction with Bridge Using an EOA Wallet&lt;&#x2F;h4&gt;
&lt;p&gt;A user wants to purchase &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; tokens on &lt;strong&gt;Chain A&lt;&#x2F;strong&gt; but only has funds on &lt;strong&gt;Chain B&lt;&#x2F;strong&gt;. The user employs an Externally Owned Account (EOA) based wallet. The dApp requests an intended transaction using &lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt;, which includes the marketplace transaction alongside the requirement of owning funds on Chain A.&lt;&#x2F;p&gt;
&lt;p&gt;In this scenario, the wallet &lt;strong&gt;MAY&lt;&#x2F;strong&gt; prompt the user to sign the necessary transactions to fulfill the requirements before proceeding with the main transaction. The wallet &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; compute possible solutions to meet the requirements and &lt;strong&gt;MUST&lt;&#x2F;strong&gt; ensure that these prerequisites are met prior to executing the main transaction.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7795&#x2F;.&#x2F;assets&#x2F;eoa_example.svg&quot; alt=&quot;EOA Example&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;bridge-swap-and-payment-using-a-smart-contract-wallet&quot;&gt;Bridge, Swap, and Payment Using a Smart Contract Wallet&lt;&#x2F;h4&gt;
&lt;p&gt;A dApp requests a payment from a user, which &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be made in &lt;strong&gt;Token Z&lt;&#x2F;strong&gt; on &lt;strong&gt;Chain B&lt;&#x2F;strong&gt;, but the user holds &lt;strong&gt;Token Y&lt;&#x2F;strong&gt; on &lt;strong&gt;Chain A&lt;&#x2F;strong&gt;. The dApp requests an intended transaction using &lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt;, including the payment transaction alongside the requirement of having enough Token Z on Chain B.&lt;&#x2F;p&gt;
&lt;p&gt;In this scenario, the Smart Contract Wallet &lt;strong&gt;MAY&lt;&#x2F;strong&gt; prompt the user to sign all the necessary transactions at once, executing them in the appropriate order. The wallet &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; compute solutions to fulfill the requirements and &lt;strong&gt;MUST&lt;&#x2F;strong&gt; ensure that all prerequisites are satisfied before proceeding with the main transaction.&lt;&#x2F;p&gt;
&lt;p&gt;The signed transactions &lt;strong&gt;MAY&lt;&#x2F;strong&gt; be sent simultaneously to bundlers, who execute them as they become available, allowing the operation to complete even if the wallet disconnects.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7795&#x2F;.&#x2F;assets&#x2F;sc_example.svg&quot; alt=&quot;SC Example&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC extends &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5792&#x2F;&quot;&gt;EIP-5792&lt;&#x2F;a&gt; rather than defining new RPC methods because:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Consistency&lt;&#x2F;strong&gt;: Leverages existing capability discovery mechanism&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Composability&lt;&#x2F;strong&gt;: Requirements can be combined with other &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5792&#x2F;&quot;&gt;EIP-5792&lt;&#x2F;a&gt; capabilities&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Flexibility&lt;&#x2F;strong&gt;: Wallets can implement only the requirements they support&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Extensibility&lt;&#x2F;strong&gt;: New requirement types can be added as additional capabilities&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The decision to split requirements into individual capabilities rather than a single capability type allows:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Granular support by wallets&lt;&#x2F;li&gt;
&lt;li&gt;Clear capability discovery&lt;&#x2F;li&gt;
&lt;li&gt;Independent versioning of requirement types&lt;&#x2F;li&gt;
&lt;li&gt;Simpler implementation for basic wallets&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC does not introduce any new security risks or trust assumptions.&lt;&#x2F;p&gt;
&lt;p&gt;Users already trust their wallet provider to craft, manipulate and send transactions on their behalf. This ERC only adds a new field to the transaction request, which the wallet can use to make more informed decisions about transaction construction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Verifiable logs</title>
        <published>2024-10-21T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Etan Kissling</name><uri>https://github.com/etan-status</uri>
	</author>
	
	<author>
		<name>Gajinder Singh</name><uri>https://github.com/g11tech</uri>
	</author>
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7792/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7792-verifiable-logs/21424" />
        

        <id>https://wg-eips.ritovision.com/7792/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7792"
            label="EIP-7792" />
        

        
        

        
        <summary type="html">Scheme to make the eth_getLogs response verifiable</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7792/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP defines a method to make the &lt;code&gt;eth_getLogs&lt;&#x2F;code&gt; JSON-RPC response verifiable.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;eth_getLogs&lt;&#x2F;code&gt; endpoint is used by wallets to obtain the transaction history pertaining to an account or a topic. To verify correctness and completeness of the logs, a wallet would also have to obtain all block headers and check against their logs bloom. However, that mechanism is inefficient due to its high false positive rate and also involves an unpractical amount of network round trips. This EIP defines a replacement mechanism to efficiently and incrementally verify correctness and completeness of &lt;code&gt;eth_getLogs&lt;&#x2F;code&gt; responses.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;configuration&quot;&gt;Configuration&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;LOG_CONTRACT_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xfffffffffffffffffffffffffffffffffffffffe&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;log-accumulation&quot;&gt;Log accumulation&lt;&#x2F;h3&gt;
&lt;p&gt;After executing all transactions of a block, commitments of all emitted logs are accumulated into the storage of &lt;code&gt;LOG_CONTRACT_ADDRESS&lt;&#x2F;code&gt;. The contract has no code, and its storage layout consists of three slots of type &lt;code&gt;mapping&lt;&#x2F;code&gt;. However to prevent &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;158&#x2F;&quot;&gt;EIP-158&lt;&#x2F;a&gt; cleanup, the contract&#x27;s nonce is set to &lt;code&gt;1&lt;&#x2F;code&gt; at the first write.&lt;&#x2F;p&gt;
&lt;p&gt;| Name | Value | Type |
| &lt;code&gt;LOG_ADDRESS_STORAGE_SLOT&lt;&#x2F;code&gt; | &lt;code&gt;0&lt;&#x2F;code&gt; | &lt;code&gt;mapping(address =&amp;gt; bytes32)&lt;&#x2F;code&gt; |
| &lt;code&gt;LOG_TOPICS_STORAGE_SLOT&lt;&#x2F;code&gt; | &lt;code&gt;1&lt;&#x2F;code&gt; | &lt;code&gt;mapping(bytes32 =&amp;gt; bytes32)&lt;&#x2F;code&gt; |
| &lt;code&gt;LOG_ADDRESS_TOPICS_STORAGE_SLOT&lt;&#x2F;code&gt; | &lt;code&gt;2&lt;&#x2F;code&gt; | &lt;code&gt;mapping(bytes32 =&amp;gt; bytes32)&lt;&#x2F;code&gt; |&lt;&#x2F;p&gt;
&lt;p&gt;Additional metadata about each log&#x27;s origin is mixed in to each &lt;code&gt;LogEntry&lt;&#x2F;code&gt;. The definition uses the &lt;code&gt;Log&lt;&#x2F;code&gt; SSZ type as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6466&#x2F;&quot;&gt;EIP-6466&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BlockMeta&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    timestamp&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    number&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; LogMeta&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BlockMeta&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    transaction_index&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Log&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    topics&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Bytes32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_TOPICS_PER_LOG&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ByteList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;MAX_LOG_DATA_SIZE&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; LogEntry&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    meta&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; LogMeta&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    log&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Log&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;hash_tree_root(LogEntry)&lt;&#x2F;code&gt; commitments are subsequently tracked as part of &lt;code&gt;LOG_CONTRACT_ADDRESS&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; accumulate_log&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Evm&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; entry_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; hashlib&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sha256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    root&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;update&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;entry_root&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    root&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;update&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;env&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; LOG_CONTRACT_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;env&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; LOG_CONTRACT_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; root&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;digest&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; track_log&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Evm&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; entry&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; LogEntry&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    entry_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; entry&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;hash_tree_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Allow verification via `address` filter&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;entry&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;log&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; LOG_ADDRESS_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    accumulate_log&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; entry_root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; topic&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; entry&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;log&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;topics&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Allow verification via `topics` filter&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;topic&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; LOG_TOPICS_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        accumulate_log&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; entry_root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Allow verification via combined `address` + `topics` filter&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;entry&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;log&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; topic&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; LOG_ADDRESS_TOPICS_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        accumulate_log&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; entry_root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;json-rpc-api&quot;&gt;JSON-RPC API&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;eth_getLogs&lt;&#x2F;code&gt; response format is extended to include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;blockTimestamp&lt;&#x2F;code&gt;: &lt;code&gt;QUANTITY&lt;&#x2F;code&gt; - The timestamp field of the block referred to by &lt;code&gt;blockHash&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;verification&quot;&gt;Verification&lt;&#x2F;h3&gt;
&lt;p&gt;For &lt;code&gt;eth_getLogs(address, topics, fromBlock, toBlock)&lt;&#x2F;code&gt;, the response data can be verified for correctness and completion by obtaining:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;fromBlock&lt;&#x2F;code&gt; and &lt;code&gt;toBlock&lt;&#x2F;code&gt; block headers (validated against their known hashes)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;fromBlock&lt;&#x2F;code&gt;&#x27;s &lt;code&gt;parentBlock&lt;&#x2F;code&gt; header (validated against &lt;code&gt;fromBlock.parentHash&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;Historical log accumulator at &lt;code&gt;parentBlock&lt;&#x2F;code&gt; based on given filters (validated with &lt;code&gt;eth_getProof&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;Log accumulator at &lt;code&gt;toBlock&lt;&#x2F;code&gt; based on given filters (validated with &lt;code&gt;eth_getProof&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Starting from the historical log accumulator from (3), each response entry is applied to it in a way compatible with &lt;code&gt;accumulate_log&lt;&#x2F;code&gt; above. If the log accumulator ends up matching the value from (4), the response data is correct and &lt;code&gt;LogEntry&lt;&#x2F;code&gt; derived from it can be trusted.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Making the &lt;code&gt;eth_getLogs&lt;&#x2F;code&gt; response verifiable adds the necessary security attributes to enable wallets to transition away from relying on trusted data providers, ultimately improving the wallet&#x27;s privacy guarantees as it is no longer subject to the privacy policy of any given provider.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-cost&quot;&gt;Gas cost&lt;&#x2F;h3&gt;
&lt;p&gt;The gas cost produced by this scheme is significantly higher than what &lt;code&gt;LOG#&lt;&#x2F;code&gt; opcodes produce as of Prague, primarily due to the additional &lt;code&gt;SLOAD&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;SSTORE&lt;&#x2F;code&gt; and the double cost of &lt;code&gt;SHA256&lt;&#x2F;code&gt; opcodes compared to &lt;code&gt;KECCAK256&lt;&#x2F;code&gt; opcodes. The gas cost increases outweigh the savings from dropping logs blooms.&lt;&#x2F;p&gt;
&lt;p&gt;If the mechanism turns out to be prohibitively expensive even when optimized, it may be necessary to move the log accumulators to a separate optimized data structure (not in &lt;code&gt;state_root&lt;&#x2F;code&gt;), or to an out-of-protocol zk system. Even then, the gas cost for logs should still reflect the actual overall cost to update a typical out-of-protocol accumulator to deter against log spamming.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;block-number-transaction-index-in-meta-instead-of-hashes&quot;&gt;Block number &#x2F; transaction index in meta instead of hashes&lt;&#x2F;h3&gt;
&lt;p&gt;As long as the accumulators are stored in the state trie, they cannot refer to the block hash as the block hash hashes over the state trie, producing a cyclic dependency. If an external system is used, hashes may be included as in that scenario the state root is not affected by the IVC.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;It is still possible to process &lt;code&gt;eth_getLogs&lt;&#x2F;code&gt; responses from trusted servers as is, without verifying them. Client applications with strict response validation may need to be updated to allow the additional &lt;code&gt;blockTimestamp&lt;&#x2F;code&gt; field.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This scheme reuses existing &lt;code&gt;eth_getProof&lt;&#x2F;code&gt; and SSZ Merkle proofs; it does not introduce new security risks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Conditional Transactions</title>
        <published>2024-10-17T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Marc Harvey-Hill</name><uri>https://github.com/Marchhill</uri>
	</author>
	
	<author>
		<name>Ahmad Bitar</name><uri>https://github.com/smartprogrammer93</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7793/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7793-asserttxindex-opcode/21513" />
        

        <id>https://wg-eips.ritovision.com/7793/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:7793"
            label="EIP-7793" />
        

        
        

        
        <summary type="html">Transactions that only executes at a specific index and slot</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7793/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes to add a new transaction format for &quot;conditional transactions&quot;, that are only valid at a specified slot and index within the block. A new opcode &lt;code&gt;TXINDEX&lt;&#x2F;code&gt; is introduced to expose the conditional transaction index onchain.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The proposal aims to improve support for encrypted mempools. Transactions in an encrypted mempool are ordered while the transactions are encrypted, before being decrypted and included onchain at the top of the block. If the builder does not respect the order when including the decrypted transactions then they could frontrun decrypted transactions. The new transaction type can be used to make this impossible; if a decrypted transaction is not included at the correct index, it will be invalid.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;COND_TX_TYPE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;Bytes1(0x05)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TXINDEX_OPCODE_BYTE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;Bytes1(0x4c)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TXINDEX_OPCODE_GAS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;conditional-transaction-type&quot;&gt;Conditional Transaction Type&lt;&#x2F;h3&gt;
&lt;p&gt;We introduce a new type of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; transaction, &quot;conditional transactions&quot;, where the &lt;code&gt;TransactionType&lt;&#x2F;code&gt; is &lt;code&gt;COND_TX_TYPE&lt;&#x2F;code&gt; and the &lt;code&gt;TransactionPayload&lt;&#x2F;code&gt; is the RLP serialization of the following &lt;code&gt;TransactionPayloadBody&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[chain_id, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit, to, value, data, access_list, max_fee_per_blob_gas, blob_versioned_hashes, conditional_slot, conditional_tx_index, y_parity, r, s]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The fields &lt;code&gt;chain_id&lt;&#x2F;code&gt;, &lt;code&gt;nonce&lt;&#x2F;code&gt;, &lt;code&gt;max_priority_fee_per_gas&lt;&#x2F;code&gt;, &lt;code&gt;max_fee_per_gas&lt;&#x2F;code&gt;, &lt;code&gt;gas_limit&lt;&#x2F;code&gt;, &lt;code&gt;to&lt;&#x2F;code&gt;, &lt;code&gt;value&lt;&#x2F;code&gt;, &lt;code&gt;data&lt;&#x2F;code&gt;, &lt;code&gt;access_list&lt;&#x2F;code&gt;, &lt;code&gt;max_fee_per_blob_gas&lt;&#x2F;code&gt; follow the same semantics as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt;. The field &lt;code&gt;blob_versioned_hashes&lt;&#x2F;code&gt; is the same except that the list may be empty for a conditional transaction.&lt;&#x2F;p&gt;
&lt;p&gt;The fields &lt;code&gt;conditional_slot&lt;&#x2F;code&gt; and &lt;code&gt;conditional_tx_index&lt;&#x2F;code&gt; are both &lt;code&gt;uint64&lt;&#x2F;code&gt; and specify the slot and transaction index in which this transaction should be considered valid respectively. In order to verify that &lt;code&gt;conditional_slot&lt;&#x2F;code&gt; is correct, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7843&#x2F;&quot;&gt;EIP-7843&lt;&#x2F;a&gt; is a dependency, as this adds the slot number to the header. For both fields &lt;code&gt;-1&lt;&#x2F;code&gt; is used as a sentinel value for which the slot or transaction index check will not take place.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;signature&quot;&gt;Signature&lt;&#x2F;h4&gt;
&lt;p&gt;The signature values &lt;code&gt;y_parity&lt;&#x2F;code&gt;, &lt;code&gt;r&lt;&#x2F;code&gt;, and &lt;code&gt;s&lt;&#x2F;code&gt; are calculated by constructing a secp256k1 signature over the following digest:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;keccak256(COND_TX_TYPE || rlp([chain_id, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit, to, value, data, access_list, max_fee_per_blob_gas, blob_versioned_hashes, conditional_slot, conditional_tx_index]))&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;txindex-opcode&quot;&gt;TXINDEX opcode&lt;&#x2F;h3&gt;
&lt;p&gt;A new opcode &lt;code&gt;TXINDEX&lt;&#x2F;code&gt; is introduced at &lt;code&gt;TXINDEX_OPCODE_BYTE&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;output&quot;&gt;Output&lt;&#x2F;h4&gt;
&lt;p&gt;One element &lt;code&gt;TransactionIndex&lt;&#x2F;code&gt; is added to the stack. &lt;code&gt;TransactionIndex&lt;&#x2F;code&gt; is a &lt;code&gt;uint64&lt;&#x2F;code&gt; in big endian encoding. It is equal to &lt;code&gt;conditional_tx_index&lt;&#x2F;code&gt; if the current transaction is a conditional transaction, and &lt;code&gt;-1&lt;&#x2F;code&gt; otherwise.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;gas-cost&quot;&gt;Gas Cost&lt;&#x2F;h4&gt;
&lt;p&gt;The gas cost for &lt;code&gt;TXINDEX&lt;&#x2F;code&gt; is a fixed fee of &lt;code&gt;TXINDEX_OPCODE_GAS&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;transaction-type&quot;&gt;Transaction Type&lt;&#x2F;h3&gt;
&lt;p&gt;An alternative design could simply return the current transaction index without adding a new transaction type. Adding a new transaction type is favoured as it means that the expected transaction index must be declared statically upfront, rather than allowing dynamic behaviour based on the returned transaction index. This prevents complex constraints being imposed that makes it difficult to build a block.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-price&quot;&gt;Gas Price&lt;&#x2F;h3&gt;
&lt;p&gt;The opcode is priced to match similar opcodes in the &lt;code&gt;W_base&lt;&#x2F;code&gt; set.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;N&#x2F;A&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;None.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Soulbound Degradable Governance</title>
        <published>2024-10-15T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Guilherme Neves</name><uri>https://github.com/0xneves</uri>
	</author>
	
	<author>
		<name>Rafael Castaneda</name><email>rafaelcastaneda@gmail.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7787/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7787-soulbound-degradable-governance/21326" />
        

        <id>https://wg-eips.ritovision.com/7787/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7787"
            label="ERC-7787" />
        

        
        

        
        <summary type="html">DAO governance where voting power is non-transferable and decays over time without active contributions.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7787/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal introduces the Soulbound Degradable Governance (SDG) standard, where governance power should be granted as non-transferable tokens that decay over time unless renewed through participation. SDG enables young DAOs to implement merit-based governance by detaching governance power from economic power while on early stages of development.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Traditional DAO governance models rely heavily on economic tokens, where voting power is proportional to token holdings. While effective for some use cases, this model risks concentrating power among wealthy members, leading to plutocracy and discouraging participation from smaller stakeholders. Furthermore, it fosters a treasury-centric culture that attracts contributors primarily focused on financial gain, rather than long-term governance or community well-being.&lt;&#x2F;p&gt;
&lt;p&gt;Young DAOs, in particular, need governance models that incentivize active contributions without relying on economic power. This proposal addresses these issues by detaching governance power from economic power and ensuring political power decays if not maintained through ongoing participation. This approach creates a merit-based structure that reflects continuous involvement and reduces the risk of early-stage centralization or dependent on heavy inflationary policies.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;,
&quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as
described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;This system MUST operate with two distinct tokens types, one representing &lt;strong&gt;political power&lt;&#x2F;strong&gt; and another representing &lt;strong&gt;economic power&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;The political power token SHOULD be non-transferable with over-time decayment.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The economic power token supports liquidity and trade, providing the financial utility needed for the DAO’s operations and is RECOMMENDED to be a standard &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; token.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The implementer of this standard MUST:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Override the &lt;code&gt;transfer(...)&lt;&#x2F;code&gt; function for the governance token to block transfers between addresses.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Create a decay mechanism by overriding the &lt;code&gt;getVotes(...)&lt;&#x2F;code&gt; function on parent contract, reducing the token’s voting power over time. This is RECOMMENDED to be a linear or exponential decay formula.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Create the respective &lt;strong&gt;Event&lt;&#x2F;strong&gt; emissions that track the voting power of addresses.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;contract-interface&quot;&gt;Contract Interface:&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.20&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SDG&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the grace period duration before the voting units begins decaying. This period is&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * fixed to 90 days. But it can be overridden in derived contracts.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; duration of the grace period in seconds.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; gracePeriod&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the duration of the decay period during which the voting units decreases. This&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * period is fixed to 90 days. But it can be overridden in derived contracts.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; duration of the decay period in seconds.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; decayPeriod&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Should be implemented by derived contracts to return the current voting units of an account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * This function calculates the voting units based on the last time it was updated and decays it&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * over time.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to check for voting units.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; current voting units of the account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getVotes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The SDG standard ensures flexibility by not being tied to any specific token type, allowing DAOs to implement it with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt;, or other future token standards. This decision maximizes the compatibility and adaptability of the framework across different governance models.&lt;&#x2F;p&gt;
&lt;p&gt;The choice to &lt;strong&gt;decouple governance power from economic power&lt;&#x2F;strong&gt; aims to provide a practical governance model for young DAOs seeking to prevent early centralization while fostering active participation. Non-transferable governance tokens ensure that only engaged members retain influence, as political power decays over time if not renewed through contributions.&lt;&#x2F;p&gt;
&lt;p&gt;We deliberately avoided incorporating mechanisms like &quot;Game Master mode&quot; for early stages or fixed decayment strategy within the standard to keep the specification &lt;strong&gt;minimal and modular&lt;&#x2F;strong&gt;. These governance structures should be implemented by individual DAOs if needed, without burdening the core SDG standard with additional complexity. The goal is to provide DAOs with the essential tools to build sustainable, merit-based governance, while leaving room for experimentation and customization at the implementation level.&lt;&#x2F;p&gt;
&lt;p&gt;The inclusion of &lt;strong&gt;grace periods&lt;&#x2F;strong&gt; and &lt;strong&gt;decay periods&lt;&#x2F;strong&gt; balances fairness with fluidity, incentivizing active participation while preventing governance stagnation. These mechanics ensure that governance power reflects recent contributions, phasing out inactive members naturally, and maintaining a dynamic, merit-based structure.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.20&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; { &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;SDG&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;SDG.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SDG implementation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; { &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;SOULERC721&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;ERC721&#x2F;SOULERC721.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Soulbounded ERC721 implementation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; { &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Ownable&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;access&#x2F;Ownable.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Oz Ownable contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Valocracy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Implements the SDG governance model where governance power decays over time if not actively maintained.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * Only the DAO governance contract, as the owner, can mint new tokens or grant additional governance power.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Valocracy&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SDG&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;SOULERC721&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Ownable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Event emitted when voting units are updated&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; VotingUnitsUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; oldVotingUnits&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newVotingUnits&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sequential ID and total supply of tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; totalSupply&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Mapping of addresses to their token IDs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _tokens&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _name&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The name of the ERC721 token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _symbol&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The symbols of the ERC721 token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _symbol&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Ownable&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_msgSender&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)) &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;SOULERC721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_name, _symbol) &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See {IERC721Metadata-tokenURI}.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function returns a static string as the token URI. In a real implementation, this&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * function should return an URI that points to a JSON file with metadata about the token. Or even&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * better, a dynamic SVG that displays the governance power of the token holder.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Custom images or Dynamic NFT that displays the governance power&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See {ISDG-getVotes}.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getVotes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; grantedTime &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _lastUpdateOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If no voting units was granted or still in grace period, return all voting units&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;grantedTime &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; grantedTime &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; gracePeriod&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _votingUnitsOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Calculate time passed since grace period ended&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; timeSinceGracePeriod &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;grantedTime &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; gracePeriod&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If decay period is over, return 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;timeSinceGracePeriod &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; decayPeriod&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Linear decay: Calculate remaining voting units during decay period&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; decayPercentage &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;timeSinceGracePeriod &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1e18&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; decayPeriod&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Percentage in 18 decimals&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; remainingVotes &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_votingUnitsOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1e18&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; decayPercentage&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1e18&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; remainingVotes&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Grants voting units to the specified account by `amount`. Only the contract owner can&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * mint new tokens and grant additional votings units. If the users doesn&amp;#39;t have a token, one&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * will be minted for them.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to mint the new token or grant additional voting units.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of voting units to grant alongside the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; grantVotingUnits&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;_tokens&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      _mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;totalSupply&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      _tokens&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; totalSupply&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; votingUnits &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getVotes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    _setVotingUnits&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; votingUnits &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; VotingUnitsUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; votingUnits&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Burns an ERC721 token and erases the voting units associated with the token holder.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token must exist and be burnable by the token holder or authorized entity.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ID of the token to burn.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; burn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; from &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; votingUnits &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getVotes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    _tokens&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    _setVotingUnits&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    _burn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; VotingUnitsUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; votingUnits&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;No security concerns were found. &lt;!-- TODO --&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Dynamic target blob count</title>
        <published>2024-10-15T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Marc Harvey-Hill</name><uri>https://github.com/Marchhill</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7788/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7788-dynamic-target-blob-count/21399" />
        

        <id>https://wg-eips.ritovision.com/7788/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7788"
            label="EIP-7788" />
        

        
        

        
        <summary type="html">Target blob count changes dynamically to aim for constant blob costs</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7788/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes to make the target blob count adjust dynamically up to a safe maximum target. This adjustment will target a constant price in ETH for blobs, aiming for consistent costs of L2 transactions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Ethereum currently uses a target of 50% capacity for blob count, with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; smoothing out short-term spikes and pushing average throughput towards the target. A dynamic target is orthogonal to EIP-1559, tweaking the target itself over a longer timescale to aim for some desired blob cost.&lt;&#x2F;p&gt;
&lt;p&gt;With static targeting the target may be higher than the actual demand, causing the protocol to undercharge for blobspace. This decreases the amount of fees burned, negatively affecting the price of ETH and total network security.&lt;&#x2F;p&gt;
&lt;p&gt;As an example, consider what would happen if there was a large increase in max blob count due to DAS implementation but the target remained at 50%. It is unlikely that demand would immediately jump to anywhere near the target, and so for months or years the protocol would effectively charge nothing for L2 transactions. With a dynamic target, the target blob count would drop until the cost of blobspace for an L2 transaction approximated some affordable constant value. In this way, some fees are still burned by the protocol, but new L2s are not discouraged from using Ethereum blobspace, knowing that the target will increase in response to an increase in demand and blob fees will remain reasonably consistent.&lt;&#x2F;p&gt;
&lt;p&gt;While the max blob count and max target are hard constraints based on resource utilisation limits, setting the target itself is far more subjective. A dynamic target can optimise for constant and affordable L2 transaction costs without requiring regular intervention by core developers to make tweaks based on changes in demand.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FORK_TIMESTAMP&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;TBD&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TARGET_BLOB_COUNT_CHANGE_RATE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MIN_TARGET_BLOB_COUNT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_TARGET_BLOB_COUNT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;3&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;BLOB_COST_CHANGE_MARGIN&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2^48&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TARGET_BLOB_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2^49&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;dynamic-targeting&quot;&gt;Dynamic targeting&lt;&#x2F;h3&gt;
&lt;p&gt;The target blob count changes each epoch based on the mean blob cost over the previous epoch. If the average cost exceeds the desired amount beyond some margin then the target is increased; likewise if it is below the desired amount by some margin the target will decrease. The target can increase up to &lt;code&gt;MAX_TARGET_BLOB_COUNT&lt;&#x2F;code&gt;, which is deemed to be a safe average throughput for the network, and down to a minimum of &lt;code&gt;MIN_TARGET_BLOB_COUNT&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Calculating targets:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;blob_cost_diff&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; mean_blob_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TARGET_BLOB_COST&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;target_change_direction&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt; blob_cost_diff&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;BLOB_COST_CHANGE_MARGIN&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt; blob_cost_diff&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BLOB_COST_CHANGE_MARGIN&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;next_epoch_blob_count&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;MAX_TARGET_BLOB_COUNT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; previous_epoch_blob_count&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;target_change_direction&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TARGET_BLOB_COUNT_CHANGE_RATE&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MIN_TARGET_BLOB_COUNT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;engine-api-change&quot;&gt;Engine API change&lt;&#x2F;h3&gt;
&lt;p&gt;The Engine API is extended to provide the &lt;code&gt;mean_blob_cost&lt;&#x2F;code&gt; for the current epoch when the CL requests it from the EL. The CL requests this at the end of an epoch to set the target for the next epoch (depends on &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7742&#x2F;&quot;&gt;EIP-7742&lt;&#x2F;a&gt;).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;constant-blob-cost-target&quot;&gt;Constant blob cost target&lt;&#x2F;h3&gt;
&lt;p&gt;A constant blob cost target can keep L2 transaction costs affordable for end users. Volatility in the price of ETH would affect affordability, but is unlikely to be significant compared to normal fluctuations in blob gas costs due to spikes in activity. In future the costs could be adjusted in the case of changes in the order of magnitude of ETH price.&lt;&#x2F;p&gt;
&lt;p&gt;An alternative approach would be to track a target blob cost in fiat. However, choosing a specific fiat currency is not credibly neutral, and introducing exchange rate oracles into the protocol could be an attack vector.&lt;&#x2F;p&gt;
&lt;p&gt;Yet another alternative is to have validators vote on the target blob cost, but they may have conflicts of interest (for example if they operate a rollup) so again this is not credibly neutral.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;target-block-gas&quot;&gt;Target block gas&lt;&#x2F;h3&gt;
&lt;p&gt;The same logic could be applied to the target block gas, but generally blockspace is in high demand so arguably gas costs are never too low. The target should be set to the maximum average throughput that the network can safely handle, a dynamic target is not necessary.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parameter-choices&quot;&gt;Parameter choices&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;TARGET_BLOB_COST&lt;&#x2F;code&gt; is chosen so that the system targets affordable L2 transactions. Assuming that the theoretical compressed size of a simple transfer is 23 bytes, this gives a blobspace cost for L2 transactions of:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(23 &#x2F; 125000) * TARGET_BLOB_COST ≈ 104 gWei&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;At today’s prices, $1 would cover blobspace for around 3700 simple transfers on L2. The blob cost target should be chosen with extensive community involvement. Note that this is the cost of blobspace for an L2 transaction; the total cost will be more due to rollup execution costs.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;TARGET_BLOB_COUNT_CHANGE_RATE&lt;&#x2F;code&gt; is chosen as a compromise between the system being reactive to changes in demand, and not having large jumps in average throughput. &lt;code&gt;BLOB_COST_CHANGE_MARGIN&lt;&#x2F;code&gt; is set such that target blob count will stay static when blob costs are within a range ±50% of &lt;code&gt;TARGET_BLOB_COST&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;MAX_TARGET_BLOB_COUNT&lt;&#x2F;code&gt; is set to &lt;code&gt;3&lt;&#x2F;code&gt; to match the current static target. This value should be increased in future when it is deemed to be safe to increase average blob throughput.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;N&#x2F;A&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;N&#x2F;A&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;N&#x2F;A&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;!-- TODO --&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Cross-Chain Messaging Gateway</title>
        <published>2024-10-14T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Francisco Giordano</name><uri>https://github.com/frangio</uri>
	</author>
	
	<author>
		<name>Hadrien Croubois</name><uri>https://github.com/Amxx</uri>
	</author>
	
	<author>
		<name>Ernesto Garcia</name><uri>https://github.com/ernestognw</uri>
	</author>
	
	<author>
		<name>CJ Cobb</name><uri>https://github.com/cjcobb23</uri>
	</author>
	
	<author>
		<name>Sergey Gorbunov</name><uri>https://github.com/sergeynog</uri>
	</author>
	
	<author>
		<name>joxes</name><uri>https://github.com/Joxess</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7786/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7786-cross-chain-messaging-gateway/21374" />
        

        <id>https://wg-eips.ritovision.com/7786/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="last-call"
                label="Last Call" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:7786"
            label="ERC-7786" />
        

        
        

        
        <summary type="html">An interface for contracts to send and receive cross-chain messages containing arbitrary data.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7786/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal describes an interface, and the corresponding workflow, for smart contracts to send arbitrary data through cross-chain messaging protocols. The end goal of this proposal is to have all such messaging protocols accessible via this interface (natively or using &quot;adapters&quot;) to improve their composability and interoperability. That would allow a new class of cross-chain native smart contracts to emerge while reducing vendor lock-in. This proposal is modular by design, allowing users to leverage bridge-specific features through attributes (structured metadata) while providing simple &quot;universal&quot; access to the simple feature of &quot;just getting a simple message through&quot;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Cross-chain messaging protocols (or bridges) allow communication between smart contracts deployed on different blockchains. There is a large diversity of such protocols with multiple degrees of decentralization, different architectures, implementing different interfaces, and providing different guarantees to users.&lt;&#x2F;p&gt;
&lt;p&gt;Because almost every protocol implements a different workflow using a specific interface, portability between bridges is currently basically impossible. This also prevents the development of generic contracts that rely on cross chain communication.&lt;&#x2F;p&gt;
&lt;p&gt;The objective of this ERC is to provide a standard interface, and a corresponding workflow, for performing cross-chain communication between contracts. Existing cross-chain communication protocols that do not natively implement this interface should be able to adopt it using adapter gateway contracts.&lt;&#x2F;p&gt;
&lt;p&gt;Compared to previous ERCs in this area, this ERC offers compatibility with chains outside of the Ethereum&#x2F;EVM ecosystem, and it is extensible to support the different feature sets of various protocols while offering a shared core of standard functionality.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;message-field-encoding&quot;&gt;Message Field Encoding&lt;&#x2F;h3&gt;
&lt;p&gt;A cross-chain message consists of a sender, recipient, payload, value (native token), and list of attributes.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;sender-and-recipient&quot;&gt;Sender and Recipient&lt;&#x2F;h4&gt;
&lt;p&gt;The sender account (in the source chain) and recipient account (in the destination chain) MUST be input in an Interoperable Address binary format, specified in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7930&#x2F;&quot;&gt;ERC-7930&lt;&#x2F;a&gt;, which MUST be serialized according to CAIP-350. The recipient field MAY be omitted or zeroed (contain an Interoperable Address with all fields set to zero) to indicate an unspecified destination, such as when a broadcast mode is employed and the final recipients are determined by the protocol itself.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;payload&quot;&gt;Payload&lt;&#x2F;h4&gt;
&lt;p&gt;The payload is an opaque &lt;code&gt;bytes&lt;&#x2F;code&gt; value.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;attributes&quot;&gt;Attributes&lt;&#x2F;h4&gt;
&lt;p&gt;An attribute is a key-value pair, where the key determines the type and encoding of the value, as well as its meaning and behavior in the gateway.&lt;&#x2F;p&gt;
&lt;p&gt;The set of valid attributes is extensible. It is RECOMMENDED to standardize them and their characteristics by publishing them as ERCs. A gateway MAY support any set of standard or custom attributes.&lt;&#x2F;p&gt;
&lt;p&gt;An attribute key is a 4-byte value (&lt;code&gt;bytes4&lt;&#x2F;code&gt;). It is RECOMMENDED to define a key as the function selector for a function signature according to Solidity ABI (for example, &lt;code&gt;minGasLimit(uint256)&lt;&#x2F;code&gt; resulting in the key &lt;code&gt;39f87ba1&lt;&#x2F;code&gt;), so as to give the key a human-readable name and a standard value encoding corresponding to the ABI-encoding of the function arguments.&lt;&#x2F;p&gt;
&lt;p&gt;An attribute value is byte array (&lt;code&gt;bytes&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;The list of attributes MUST be encoded as &lt;code&gt;bytes[]&lt;&#x2F;code&gt; (an array of &lt;code&gt;bytes&lt;&#x2F;code&gt;) where each element is the concatenation of a key and a value. (Note that in the case of keys defined as Solidity function selectors, each element of the array can be encoded by &lt;code&gt;abi.encodeWithSignature&lt;&#x2F;code&gt;.)&lt;&#x2F;p&gt;
&lt;p&gt;A message with no attributes (an empty attributes list) MUST be considered a valid message.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;sending-procedure&quot;&gt;Sending Procedure&lt;&#x2F;h3&gt;
&lt;p&gt;A &lt;strong&gt;Source Gateway&lt;&#x2F;strong&gt; is a contract that offers a protocol to send a message to a recipient on another chain. It MUST implement &lt;code&gt;IERC7786GatewaySource&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7786GatewaySource&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MessageSent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sendId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;,    &lt;&#x2F;span&gt;&lt;span&gt;&#x2F;&#x2F; &lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;Binary&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; Interoperable&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; Address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span&gt;&#x2F;&#x2F; &lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;Binary&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; Interoperable&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; Address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; payload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attributes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UnsupportedAttribute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span&gt; selector&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsAttribute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; selector&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; sendMessage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Binary Interoperable Address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; payload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attributes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sendId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;supportsattribute&quot;&gt;&lt;code&gt;supportsAttribute&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Returns a boolean indicating whether an attribute (identified by its key) is supported by the gateway.&lt;&#x2F;p&gt;
&lt;p&gt;A gateway MAY be upgraded with support for additional attributes. Once present support for an attribute SHOULD NOT be removed to preserve backwards compatibility with users of the gateway.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;sendmessage&quot;&gt;&lt;code&gt;sendMessage&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Initiates the sending of a message.&lt;&#x2F;p&gt;
&lt;p&gt;Further action MAY be required by the gateway to make the sending of the message effective, such as providing payment for gas. See Post-processing.&lt;&#x2F;p&gt;
&lt;p&gt;MUST revert with &lt;code&gt;UnsupportedAttribute&lt;&#x2F;code&gt; if an unsupported attribute is included. MAY revert if an attribute value is not valid for the key.&lt;&#x2F;p&gt;
&lt;p&gt;MAY accept call value (native token) to be sent with the message. MUST revert if call value is included but it is not a feature supported by the gateway. It is unspecified how this value is represented on the destination.&lt;&#x2F;p&gt;
&lt;p&gt;MAY generate and return a unique non-zero &lt;em&gt;send identifier&lt;&#x2F;em&gt;, otherwise returning zero. This identifier can be used to track the lifecycle of the message in the source gateway in events and for post-processing. &lt;em&gt;Note that this identifier MAY be different from the &lt;code&gt;receiveId&lt;&#x2F;code&gt; that is delivered to the recipient, since that identifier may preferably consist of values like transaction id and log index that are not available in the execution environment.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;MUST emit a &lt;code&gt;MessageSent&lt;&#x2F;code&gt; event, including the optional send identifier that is returned by the function.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;messagesent&quot;&gt;&lt;code&gt;MessageSent&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;This event signals that a would-be sender has requested a message to be sent.&lt;&#x2F;p&gt;
&lt;p&gt;If &lt;code&gt;sendId&lt;&#x2F;code&gt; is present, post-processing MAY be required to send the message through the cross-chain channel.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;post-processing&quot;&gt;Post-processing&lt;&#x2F;h4&gt;
&lt;p&gt;After a sender has invoked &lt;code&gt;sendMessage&lt;&#x2F;code&gt;, further action MAY be required by the gateways to make the message effective. This is called &lt;em&gt;post-processing&lt;&#x2F;em&gt;. For example, some payment is typically required to cover the gas of executing the message at the destination.&lt;&#x2F;p&gt;
&lt;p&gt;The exact interface for any such action is out of scope of this ERC.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;reception-procedure&quot;&gt;Reception Procedure&lt;&#x2F;h3&gt;
&lt;p&gt;A &lt;strong&gt;Destination Gateway&lt;&#x2F;strong&gt; is a contract that implements a protocol to validate messages sent on other chains. The interface of the destination gateway and how it is invoked is out of scope of this ERC.&lt;&#x2F;p&gt;
&lt;p&gt;The protocol MUST ensure delivery of a sent message to its &lt;strong&gt;recipient&lt;&#x2F;strong&gt; using the &lt;code&gt;IERC7786Recipient&lt;&#x2F;code&gt; interface (specified below), which the recipient MUST implement.&lt;&#x2F;p&gt;
&lt;p&gt;Once the message can be safely delivered (see Properties), the gateway MUST invoke &lt;code&gt;receiveMessage&lt;&#x2F;code&gt; with the message identifier and contents, unless the sender or the recipient explicitly requested otherwise.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;receiveId&lt;&#x2F;code&gt; MUST be either empty or unique (for the calling gateway) to the message being relayed. The format of this identifier is not specified, and the gateway can use it at its own discretion. For example it can be an identifier of the &lt;code&gt;MessagePosted&lt;&#x2F;code&gt; event that created the message.&lt;&#x2F;p&gt;
&lt;p&gt;The gateway MUST verify that &lt;code&gt;receiveMessage&lt;&#x2F;code&gt; returns the correct value, and MUST revert otherwise.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7786Recipient&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; receiveMessage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; receiveId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Unique identifier&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Binary Interoperable Address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; payload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;receivemessage&quot;&gt;&lt;code&gt;receiveMessage&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Delivery of a message sent from another chain.&lt;&#x2F;p&gt;
&lt;p&gt;The recipient MUST validate that the caller of this function is a &lt;strong&gt;known gateway&lt;&#x2F;strong&gt;, i.e., one whose underlying cross-chain messaging protocol it trusts.&lt;&#x2F;p&gt;
&lt;p&gt;MUST return &lt;code&gt;IERC7786Recipient.receiveMessage.selector&lt;&#x2F;code&gt; (&lt;code&gt;0x2432ef26&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;h4 id=&quot;interaction-diagram&quot;&gt;Interaction Diagram&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7786&#x2F;.&#x2F;assets&#x2F;send-execute.png&quot; alt=&quot;&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;properties&quot;&gt;Properties&lt;&#x2F;h3&gt;
&lt;p&gt;The protocol underlying a pair of gateways is expected to guarantee a series of properties. For a detailed definition and discussion, we refer to XChain Research’s &lt;em&gt;Cross-chain Interoperability Report&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The protocol MUST guarantee Safety: A message is delivered at the destination if and only if it was sent at the source. The delivery process must ensure a message is only delivered once the sending transaction is finalized, and not delivered more than once. Note that there can be multiple messages with identical parameters that must be delivered separately.&lt;&#x2F;li&gt;
&lt;li&gt;The protocol MUST guarantee Liveness: A sent message is eventually delivered to the destination, assuming Liveness and censorship-resistance of the source and destination chains and that any protocol costs are paid.&lt;&#x2F;li&gt;
&lt;li&gt;The protocol SHOULD guarantee Timeliness: A sent message is delivered at the destination within a bounded delivery time, which should be documented.&lt;&#x2F;li&gt;
&lt;li&gt;The above properties SHOULD NOT rely on trust in some centralized actor. For example, safety should be guaranteed by some trustless mechanism such as a light client proof or attestations by an open, decentralized validator set. Relaying should be decentralized or permissionless to ensure liveness; a centralized relayer can fail and thus halt the protocol.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Attributes are designed so that gateways can expose any specific features the bridge offers without having to use a proprietary interface. This should allow contracts to change the gateway they use while continuing to express messages the same way. This portability offers many advantages:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A contract that relies on a specific gateway for sending messages is vulnerable to the gateway being paused, deprecated, or simply breaking. If the communication between the contract and the gateway is standard, an admin of the contract could update the address (in storage) of the gateway to use. In particular, senders to update to the new gateway when a new version is available.&lt;&#x2F;li&gt;
&lt;li&gt;Bridge layering is made easier. In particular, this interface should allow for gateways that route the message through multiple independent bridges. Delivery of the message could require one or multiple of these independent bridges depending on whether improved liveness or safety is desired.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;As some cross-chain communication protocols require additional parameters beyond the destination and the payload, and because we want to send messages through those bridges without any knowledge of these additional parameters, a post-processing of the message MAY be required (after &lt;code&gt;sendMessage&lt;&#x2F;code&gt; is called, and before the message is delivered). The additional parameters MAY be supported through attributes, which would remove the need for a post-processing step. If these additional parameters are not provided through attributes, an additional call to the gateway is REQUIRED for the message to be sent. If possible, the gateway SHOULD be designed so that anyone with an incentive for the message to be delivered can jump in. A malicious actor providing invalid parameters SHOULD NOT prevent the message from being successfully relayed by someone else.&lt;&#x2F;p&gt;
&lt;p&gt;Some protocols gateway support doing arbitrary direct calls on the recipient. In that case, the recipient must detect that they are being called by the gateway to properly identify cross-chain messages. Getters are available on the gateway to figure out where the cross-chain message comes from (source chain and sender address). This approach has the downside that it allows anyone to trigger any call from the gateway to any contract. This is dangerous if the gateway ever holds any assets (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; or similar). The use of a dedicated &lt;code&gt;receiveMessage&lt;&#x2F;code&gt; function on the recipient protects any assets or permissions held by the gateway against such attacks. If the ability to perform direct calls is desired, this can be implemented as a wrapper on top of any gateway that implements this ERC.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Existing cross-chain messaging protocols implement proprietary interfaces. We recommend that protocols natively implement the standard interface defined here, and propose the development of standard adapters for those that don&#x27;t.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;handling-addresses&quot;&gt;Handling addresses&lt;&#x2F;h3&gt;
&lt;p&gt;Interoperable Addresses (ERC‑7930) rely on CAIP‑350 serialization. Using non‑canonical encodings can lead to silent delivery failures. Gateways SHOULD reject non‑canonical encodings and MAY normalize them before emission.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EIP-712 Extensions for Account Abstraction</title>
        <published>2024-10-08T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Francisco Giordano</name><uri>https://github.com/frangio</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7803/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7803-eip-712-extensions-for-account-abstraction/21436" />
        

        <id>https://wg-eips.ritovision.com/7803/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:7803"
            label="ERC-7803" />
        

        
        

        
        <summary type="html">Improvements for EIP-712 to support smart contract accounts.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7803/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC improves on &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; signatures to better support smart contract accounts by 1) introducing signing domains as a way to prevent replay attacks when private keys are shared across accounts, and 2) allowing dapps and wallets to coordinate on the method that will be used to authenticate the signature.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;signing-domains&quot;&gt;Signing Domains&lt;&#x2F;h3&gt;
&lt;p&gt;Standards like &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;ERC-1271&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6492&#x2F;&quot;&gt;ERC-6492&lt;&#x2F;a&gt; give smart contract accounts (SCAs) the ability to produce signatures that an application can authenticate without knowledge of the abstract rules of the account. This is an important primitive for applications, as the account owner is able to authorize a third-party to act on its behalf without interacting with the chain.&lt;&#x2F;p&gt;
&lt;p&gt;Smart contract accounts may be &quot;owned&quot; by cryptographic keys whose signatures are used to authorize the use of the account. There is not necessarily a one-to-one mapping between keys and accounts, because a single key may control multiple accounts, so care must be taken to prevent replay attacks across them. This is done by binding a signature to a particular account.&lt;&#x2F;p&gt;
&lt;p&gt;EIP-712 introduced a scheme where signatures can be bound to a verifying domain, which corresponds to the protocol contract that will authenticate a signature. Reusing this mechanism to additionally bind a signature to the domain of the smart contract account runs into a large amount of complexity and attack surface (see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7739&#x2F;&quot;&gt;ERC-7739&lt;&#x2F;a&gt;), as well as yet unresolved issues with account composability (SCAs that control other SCAs). This ERC introduces &lt;em&gt;signing domains&lt;&#x2F;em&gt; in addition to verifying domains to natively enable wallets to generate smart contract account signatures with replay protection.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;authentication-methods&quot;&gt;Authentication Methods&lt;&#x2F;h3&gt;
&lt;p&gt;ERC-1271 is a minimal and very general interface that has been very effective. It requires the contract code to be already deployed by the time the signature needs to be authenticated, so ERC-6492 extends ERC-1271 to support that use case. In the future additional methods may need to be developed.&lt;&#x2F;p&gt;
&lt;p&gt;Support for these methods across protocols is currently lacking and is a major pain point for the Account Abstraction roadmap. Where ERC-1271 is supported, it is not necessarily used uniformly, in particular some contracts attempt &lt;code&gt;ECRECOVER&lt;&#x2F;code&gt; prior to invoking &lt;code&gt;isValidSignature&lt;&#x2F;code&gt; while others do the opposite, which will result in very different semantics post &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This ERC addresses this by allowing dapps to communicate the types of signatures a protocol&#x27;s contracts support, i.e., which authentication methods will be used, and in what order.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;Requests for typed data signatures via JSON-RPC (&lt;code&gt;eth_signTypedData&lt;&#x2F;code&gt;) or client libraries are extended with the following optional properties:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;signingDomains&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;authMethods&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;These new properties are used alongside the existing ones, i.e., &lt;code&gt;types&lt;&#x2F;code&gt;, &lt;code&gt;primaryType&lt;&#x2F;code&gt;, &lt;code&gt;domain&lt;&#x2F;code&gt;, and &lt;code&gt;message&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The signature returned in response to the request MAY be of any size, and in the absence of &lt;code&gt;authMethods&lt;&#x2F;code&gt; it MUST be treated opaquely as the type of the signature is not known.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;signingdomains&quot;&gt;&lt;code&gt;signingDomains&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;This property is an array of smart contract account domains. Each member of the array is an object with the following keys:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;types&lt;&#x2F;code&gt;: An object with the same format as EIP-712 &lt;code&gt;types&lt;&#x2F;code&gt; with at least an &lt;code&gt;EIP712Domain&lt;&#x2F;code&gt; key.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;domain&lt;&#x2F;code&gt;: An object that is valid with respect to the type &lt;code&gt;EIP712Domain&lt;&#x2F;code&gt; described in &lt;code&gt;types&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;From right to left the array lists the chain of accounts through which the signer ultimately has control over the &quot;outermost&quot; signing domain (i.e., that listed first).&lt;&#x2F;p&gt;
&lt;p&gt;For example:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;A dapp requests an EIP-712 signature to a connected account via JSON-RPC. &lt;code&gt;signingDomains&lt;&#x2F;code&gt; is empty or undefined.&lt;&#x2F;li&gt;
&lt;li&gt;The connected account is a multisig, so it requests EIP-712 signatures from its signers, prepending the domain of the multisig to &lt;code&gt;signingDomains&lt;&#x2F;code&gt;, which is now an array of length 1.&lt;&#x2F;li&gt;
&lt;li&gt;One of the signers uses a smart contract account controlled by an ECDSA key held in a hardware wallet, so their wallet requests an EIP-712 signature from the hardware wallet, prepending the domain of the smart contract account to &lt;code&gt;signingDomains&lt;&#x2F;code&gt;, which is now an array of length 2.&lt;&#x2F;li&gt;
&lt;li&gt;The signer verifies the contents of the signature in their hardware wallet. They are able to see that they are signing a message intended for a particular dapp domain, on behalf of their smart contract account (closest signing domain), as a member of the multisig (furthest signing domain).&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h4 id=&quot;encoding-of-data-to-be-signed&quot;&gt;Encoding of data to be signed&lt;&#x2F;h4&gt;
&lt;p&gt;In the presence of &lt;code&gt;signingDomains&lt;&#x2F;code&gt; the account should encode the message to be signed according to the following recursive procedure:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;encodeForSigningDomains(signingDomainSeparators : [𝔹²⁵⁶], verifyingDomainSeparator : 𝔹²⁵⁶, message : 𝕊) =&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;If &lt;code&gt;signingDomainSeparators = [first, ...others]&lt;&#x2F;code&gt;: &lt;code&gt;&quot;\x19\x02&quot; ‖ first ‖ encodeForSigningDomains(others, verifyingDomainSeparator, message)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;signingDomainSeparators = []&lt;&#x2F;code&gt;: &lt;code&gt;encode(domainSeparator, message)&lt;&#x2F;code&gt;, where &lt;code&gt;encode&lt;&#x2F;code&gt; is defined by EIP-712.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;code&gt;signingDomainSeparators&lt;&#x2F;code&gt; is the array of hashes of the domains included in &lt;code&gt;signingDomains&lt;&#x2F;code&gt;, in the same order, computed according to EIP-712&#x27;s &lt;code&gt;hashStruct&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;authmethods&quot;&gt;&lt;code&gt;authMethods&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;This property is an array of supported signature authentication methods, listed in the order that the verifying domain tries them.&lt;&#x2F;p&gt;
&lt;p&gt;Each member of the array is an object with the following keys:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;id&lt;&#x2F;code&gt;: An string that identifies the method. It may be one of:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ECDSA&lt;&#x2F;code&gt;: ECDSA signatures by Externally Owned Accounts.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ERC-{n}&lt;&#x2F;code&gt;: A standard type of signature specified by an ERC. &lt;code&gt;n&lt;&#x2F;code&gt; must not be padded with zeros.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;parameters&lt;&#x2F;code&gt; (optional): An array of method-specific parameters.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;json-schema&quot;&gt;JSON Schema&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  properties&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    types&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;$ref&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;#&#x2F;$defs&#x2F;EIP712Types&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    primaryType&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    domain&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    message&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    signingDomains&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;array&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      items&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;$ref&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;#&#x2F;$defs&#x2F;EIP712Types&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    authMethods&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;array&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      items&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        parameters&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;array&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        required&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  required&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;types&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;primaryType&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;domain&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;message&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  $defs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    EIP712Types&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      properties&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        EIP712Domain&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;array&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      additionalProperties&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;array&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        items&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;          type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;          properties&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;          required&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      required&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;EIP712Domain&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;!-- TODO --&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;!-- TODO --&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion. &lt;!-- TODO --&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>GETCONTRACT opcode</title>
        <published>2024-10-07T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Tim Pechersky</name><uri>https://github.com/peersky</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7784/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7784-getcontract-code/21325" />
        

        <id>https://wg-eips.ritovision.com/7784/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7784"
            label="EIP-7784" />
        

        
        

        
        <summary type="html">Global byte code accessing by its hash</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7784/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This is a proposal to add a new opcode, &lt;code&gt;GETCONTRACT&lt;&#x2F;code&gt;. The &lt;code&gt;GETCONTRACT&lt;&#x2F;code&gt; opcode would return the address containing the bytecode by its hash.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Content addressing by hash is a common pattern in database design. It allows to store and retrieve data by its unique footprint in the storage. This pattern is widely used in the industry and it allows abstracting the actual storage location and allows reusing the same bytecode in multiple contracts.&lt;&#x2F;p&gt;
&lt;p&gt;Today, existing contract discovery relies on addresses, which are non-deterministic and can be obfuscated through proxies. Indexing by bytecode hash provides a deterministic and tamper-proof way to identify and verify contract code, enhancing security and trust in the Ethereum ecosystem.&lt;&#x2F;p&gt;
&lt;p&gt;Consider a security auditor who wants to attest to the integrity of a contract’s code. By referencing bytecode hashes, auditors can focus their audit on the bytecode itself, without needing to assess deployment parameters or storage contents. This method verifies the integrity of a contract’s codebase without auditing the entire contract state.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, bytecode referencing allows whitelist contracts before deployment, allowing developers to get pre-approval for their codebase without disclosing the code itself, or even pre-setup infrastructure that will change it behavior upon adding some determined functionality on chain.&lt;&#x2F;p&gt;
&lt;p&gt;For developers relying on extensive code reuse, bytecode referencing protects against malicious changes that can occur with address-based referencing through proxies. This builds long-term trust chains extending to end-user applications.&lt;&#x2F;p&gt;
&lt;p&gt;For decentralized application (dApp) developers, a code index can save gas costs by allowing them to reference existing codebase instead of redeploying them, optimizing resource usage. This can be useful for dApps that rely on extensive re-use of same codebase as own dependencies.&lt;&#x2F;p&gt;
&lt;p&gt;This also allows to build new core standards more conveniently, for example, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; can use it as dependency, to allow users who want to set up one-time code on their EOAs by referring to &lt;code&gt;GETCONTRACT&lt;&#x2F;code&gt; instead of specifying potentially mutable address based functionality.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;opcode-definition&quot;&gt;Opcode Definition&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Mnemonic:&lt;&#x2F;strong&gt; &lt;code&gt;GETCONTRACT&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Opcode Value:&lt;&#x2F;strong&gt; &lt;code&gt;0x4f&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Input:&lt;&#x2F;strong&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;codehash&lt;&#x2F;code&gt;: A single 32-byte code hash from the stack.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Output:&lt;&#x2F;strong&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;address&lt;&#x2F;code&gt;:  If the &lt;code&gt;codehash&lt;&#x2F;code&gt; exists in the state, pushes the corresponding contract address onto the stack. Otherwise, pushes 0.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Gas Cost:&lt;&#x2F;strong&gt; 150&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Stack Effects:&lt;&#x2F;strong&gt; Pops 1 item, pushes 1 item.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Error Handling:&lt;&#x2F;strong&gt;  If the &lt;code&gt;codehash&lt;&#x2F;code&gt; is invalid or the bytecode retrieval encounters an error, the instruction will revert.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Every contract stored in EVM MUST be added to the state trie with the key being the keccak256 hash of the contract&#x27;s bytecode, provided it is:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;not already present&lt;&#x2F;li&gt;
&lt;li&gt;The contract did not invoke the &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; opcode.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; return value IS NOT &lt;code&gt;0xeadcdba66a79ab5dce91622d1d75c8cff5cff0b96944c3bf1072cd08ce018329&lt;&#x2F;code&gt; (&lt;code&gt;keccak256(0xef01)&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;example-usage&quot;&gt;Example Usage&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getContractAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; codehash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; contractAddress&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        contractAddress &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; GETCONTRACT&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;codehash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; contractAddress&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;Bytecode over Addresses&lt;&#x2F;strong&gt;: Bytecode is deterministic and can be verified on-chain, while addresses are opaque and mutable.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Do not re-index&lt;&#x2F;strong&gt;: There is small, yet non-zero probability of hash collision attack. Disallowing updates to indexed location of bytecode coupes with this.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Gas cost&lt;&#x2F;strong&gt;: This operation is more complex than simple data retrieval, however lookup in the database by hash generally is simpler in complexity.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;Malicious Code&lt;&#x2F;strong&gt;: The index does NOT guarantee the safety or functionality of indexed contracts. Users MUST exercise caution and perform their own due diligence before interacting with indexed contracts.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Storage contents of registered contracts&lt;&#x2F;strong&gt;: The index only refers to the bytecode of the contract, not the storage contents. This means that the contract state is not indexed and may change over time.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; delegation:&lt;&#x2F;strong&gt; Temporary code delegation is disallowed to prevent case of registering a code hash that becomes unavailable. Standard explicitly disallows contracts with bytecode delegated via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; from being indexed.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;SELFDESTRUCT&lt;&#x2F;strong&gt;: Contracts that &lt;code&gt;selfdestruct&lt;&#x2F;code&gt; are not indexed, as they will not have a codehash in the state trie.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Reduce Block Latency</title>
        <published>2024-10-05T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Ben Adams</name><uri>https://github.com/benaadams</uri>
	</author>
	
	<author>
		<name>Dankrad Feist</name><uri>https://github.com/dankrad</uri>
	</author>
	
	<author>
		<name>Maria Inês Silva</name><uri>https://github.com/misilva73</uri>
	</author>
	
	<author>
		<name>Paul Harris</name><uri>https://github.com/rolfyone</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7782/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7782-reduce-block-latency/21271" />
        

        <id>https://wg-eips.ritovision.com/7782/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7782"
            label="EIP-7782" />
        

        
        

        
        <summary type="html">Reduce Ethereum&#x27;s slot time from 12s to 6s to decrease latency by 50%, distribute bandwidth usage, and improve UX.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7782/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Reduce Ethereum&#x27;s slot time from 12 s to 6 s, halving on‑chain latency and epoch duration. This doubles slot throughput while keeping block and blob sizes unchanged, smoothing bandwidth usage. The change delivers better user experience, faster Layer 2 interaction, tighter DEX pricing, reduced MEV, and quicker finality.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Protocol Carrying Capacity&lt;&#x2F;strong&gt; It is impractical to increase block sizes beyond 10MiB without substantial networking changes. However it is practical to decrease slot time to achieve similar effect while also improving the UX at same time.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Enhanced UX&lt;&#x2F;strong&gt;: Confirmations now arrive in ~6 s instead of 12 s.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Faster Finality&lt;&#x2F;strong&gt;: Epochs shrink from 384 s (32 × 12 s) to 192 s (32 × 6 s), accelerating Casper‑FFG finality.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;L2 Interoperability&lt;&#x2F;strong&gt;: Layer 2 rollups see half the settlement delay on L1, improving throughput and reducing reorg risk period.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Based rollups&lt;&#x2F;strong&gt;: Based rollup sequencing is tied to L1 block time so faster blocks directly improves based rollups.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;DEX Economics&lt;&#x2F;strong&gt;: More frequent blocks decrease LVR (Loss Versus Rebalancing), which improves the economics for liquidity providers. More liquidity means lower spreads (reduced slippage).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Bandwidth Smoothing&lt;&#x2F;strong&gt;: Doubling slot rate distributes bandwidth evenly without increasing peak block size; nodes with modest capacity remain supported.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;On the consensus layer, a new parameter is added to the configuration:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SLOT_SCHEDULE:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  - EPOCH: 348618&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    SECONDS_PER_SLOT: 12&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  - EPOCH: 355368&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    SECONDS_PER_SLOT: 6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The parameters and schedules above are purely illustrative. Actual values and schedules are beyond the scope of this specification.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;adjustment-to-gas-and-blob-limits&quot;&gt;Adjustment to gas and blob limits&lt;&#x2F;h3&gt;
&lt;p&gt;The first execution block after the fork needs to specify half the previous gas limit. With this fork, all gas limit settings are reinterpreted as &quot;gas per 12 seconds&quot;. I.e., if the user configuration or otherwise default gas limit vote was 36,000,000, the client should now vote for 18,000,000. All values are rounded down to integers.&lt;&#x2F;p&gt;
&lt;p&gt;The blob target and limit are also halved, rounded down to the nearest integer.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;attestation-deadlines&quot;&gt;Attestation deadlines&lt;&#x2F;h3&gt;
&lt;p&gt;All clients need to be reconfigured so that deadlines can be configured in milliseconds for finer granularity. Currently the slot is split into three equal intervals, with proposal happening at time 0, and attestations and aggregations being sent at one thirds and two thirds of the slot time. We change this to a new uneven schedule, in order to give sufficient time for block propagation, which takes the most time:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Block proposal at 0 ms&lt;&#x2F;li&gt;
&lt;li&gt;Attestations at 3000 ms&lt;&#x2F;li&gt;
&lt;li&gt;Aggregates at 4500 ms&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal balances user experience, economic efficiency, and network stability:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;UX &amp;amp; Finality: Halving slot time directly reduces confirmation latency and halves epoch duration, delivering faster feedback to users and speeding up Casper-FFG finality.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Economic Efficiency: Increased block frequency tightens DEX price spreads, lowers slippage, and diminishes arbitrage and MEV opportunities, improving on-chain trading conditions.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;L2 &amp;amp; Based Rollups Synergy: Layer 2 rollups, especially based rollups, benefit from reduced L1 settlement delays, enhancing throughput and user-perceived performance in rollup ecosystems.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Network Stability: Maintaining existing p2p network maximum smooths bandwidth usage over time, avoiding peak-load spikes and preserving accessibility for nodes with diverse bandwidth capacities.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backwards compatibility concerns.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Network Congestion&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Increased Message Frequency&lt;&#x2F;strong&gt;: The network must handle more frequent messages without congestion.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Mitigation&lt;&#x2F;strong&gt;: Implement network optimizations and encourage the use of efficient client software.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Consensus Integrity&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Fork Choice Stability&lt;&#x2F;strong&gt;: Ensure that the fork choice rule remains robust against potential reorganization attacks.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Finality Gadgets&lt;&#x2F;strong&gt;: Confirm that finality mechanisms function correctly under new timing conditions.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via CC0 1.0 Universal.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Interoperable Delegated Accounts</title>
        <published>2024-10-02T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>David Kim</name><uri>https://github.com/PowerStream3604</uri>
	</author>
	
	<author>
		<name>Richard Meissner</name><uri>https://github.com/rmeissner</uri>
	</author>
	
	<author>
		<name>Akshay Patel</name><uri>https://github.com/akshay-ap</uri>
	</author>
	
	<author>
		<name>Joshua Kim</name><uri>https://github.com/LightningHun</uri>
	</author>
	
	<author>
		<name>Fangting</name><uri>https://github.com/trinity-0111</uri>
	</author>
	
	<author>
		<name>Yoav Weiss</name><uri>https://github.com/yoavw</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7779/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7779-interoperable-delegated-account/21237" />
        

        <id>https://wg-eips.ritovision.com/7779/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7779"
            label="ERC-7779" />
        

        
        

        
        <summary type="html">Interface for delegated externally owned accounts to enable better redelegation between wallets.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7779/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal outlines the interfaces to make delegated EOAs interoperable after the merge of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt;. With &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt;, EOAs will be able to enable execution abstraction, which leads to a more feature-rich account, including gas sponsorship, batch execution, and more.&lt;&#x2F;p&gt;
&lt;p&gt;However, there is a need to help facilitate storage management for redelegation, as invalid management of storage may incur storage collisions that can lead to unexpected behavior of accounts (e.g., account getting locked, security vulnerabilities, etc)&lt;&#x2F;p&gt;
&lt;p&gt;The interface &lt;code&gt;InteroperableDelegatedAccount&lt;&#x2F;code&gt; suggests the interfaces for delegated EOAs to be interoperable and facilitate a better environment for redelegation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;After the merge of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt;, it is expected that a considerable number of EOA wallets will migrate from pure EOA accounts to delegated EOA accounts.&lt;&#x2F;p&gt;
&lt;p&gt;This is to enable a more appealing wallet UX, including a 1-step swap, automated subscription, gas sponsorship, and more.&lt;&#x2F;p&gt;
&lt;p&gt;However, considering the fact that delegated EOAs will utilize its own storage bound to their Smart Account implementation, the storage management is essential to foster migration between wallets to better ensure sovereignty of users to freely migrate their wallet app whenever they want.&lt;&#x2F;p&gt;
&lt;p&gt;EOA (Externally Owned Account) is currently comprised of cryptographic key pair that is mostly managed in the form of mnemonic phrase.&lt;&#x2F;p&gt;
&lt;p&gt;This simplicity provided frictionless interoperability between wallets that gave users the freedom to freely migrate between different wallet applications.&lt;&#x2F;p&gt;
&lt;p&gt;However, after the merge of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt;, each EOA will be given the ability to delegate itself to a smart account which will impact migration as storage remains in the continuous context while EOA can be delegated to diverse smart accounts if the user migrates their wallet.&lt;&#x2F;p&gt;
&lt;p&gt;Account Abstraction Wallets, given the wallet-specific validation and execution logic, also have the interoperability issue to be considered but its importance in EOA is much more significant as EOA users are already familiar with wallet migration and its a common action to migrate wallets.&lt;&#x2F;p&gt;
&lt;p&gt;This spec provides a standard approach for fetching the storage base used in the delegated account together with an optional mechanism to clean up the storage.&lt;&#x2F;p&gt;
&lt;p&gt;Moreover, it is worth noting that this spec is not limited to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; based smart accounts but smart accounts and smart contracts in general that uses a custom storage slot.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IInteroperableDelegatedAccount&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;*&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * @dev    Provides the namespace of the account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *         namespace of accounts can possibly include, account version, account name, wallet vendor name, etc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * @notice this standard does not standardize the namespace format&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * e.g.,   &amp;quot;v0.1.2.7702Account.WalletProjectA&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; accountId&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;*&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * @dev    Externally shares the storage bases that has been used throughout the account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *         Majority of 7702 accounts will have their distinctive storage base to reduce the chance of storage collision.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *         This allows the external entities to know what the storage base is of the account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *         Wallets willing to redelegate already-delegated accounts should call accountStorageBase() to check if it confirms with the account it plans to redelegate.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *         The bytes32 array should be stored at the storage slot: keccak(keccak(&amp;#39;InteroperableDelegatedAccount.ERC.Storage&amp;#39;)-1) &amp;amp; ~0xff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *         This is an append-only array so newly redelegated accounts should not overwrite the storage at this slot, but just append their base to the array.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *         This append operation should be done during the initialization of the account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * 		   This array should return a value of keccak hash unless using external storage.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; accountStorageBases&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IRedelegableDelegatedAccount&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;*&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * @dev    Function called before redelegation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *         This function should prepare the account for a delegation to a different implementation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *         This function could be triggered by the new wallet that wants to redelegate an already delegated EOA.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *         It should uninitialize storages if needed and execute wallet-specific logic to prepare for redelegation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *         msg.sender should be the owner of the account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onRedelegation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Accounts MUST implement the &lt;code&gt;IInteroperableDelegatedAccount&lt;&#x2F;code&gt; to be compliant with the standard.&lt;&#x2F;p&gt;
&lt;p&gt;Accounts MUST use &lt;code&gt;keccak256()&lt;&#x2F;code&gt; to compute the storage bases for &lt;code&gt;accountStorageBases()&lt;&#x2F;code&gt;, unless using external storage contract.&lt;&#x2F;p&gt;
&lt;p&gt;Accounts MAY implement the &lt;code&gt;IRedelegableDelegatedAccount&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;accountid&quot;&gt;&lt;code&gt;accountId()&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;This function is a view function to fetch the account information.&lt;&#x2F;p&gt;
&lt;p&gt;A use case for this could be wallet showing the redelegation process e.g., Are you willing to migrate your account &lt;code&gt;“Wallet A” → “Wallet B”&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Wallet A information could be extracted from &lt;code&gt;accountId()&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;accountstoragebases&quot;&gt;&lt;code&gt;accountStorageBases()&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;This function returns the list of base storage slots of that account has used.&lt;&#x2F;p&gt;
&lt;p&gt;To comply with this standard, the account MUST use &lt;code&gt;keccak256()&lt;&#x2F;code&gt; to prevent collision when calculating the storage slot.&lt;&#x2F;p&gt;
&lt;p&gt;EIP-7702 Accounts do plan to use a custom non-zero storage slot to avoid storage collision as much as possible, however, there hasn’t been a standardized approach on how to fetch them.&lt;&#x2F;p&gt;
&lt;p&gt;This function provides a standardized approach for wallets and other applications to check the base storage slots of an account, and verify if the base storage slots are far enough from the newly to-be-redelegated account’s base storage slot.&lt;&#x2F;p&gt;
&lt;p&gt;Note that there could be some exceptions for mappings, etc depending on how account manages storage.&lt;&#x2F;p&gt;
&lt;p&gt;This provides Wallets and applications a standard approach to fetch the base storage slots for verification rather than just relying on the probability of hash.&lt;&#x2F;p&gt;
&lt;p&gt;If the account uses external storage, it should return ERC Number prefixed slot with the external storage contract address concatenated.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt;ERC&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt;Number&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt;ERC&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt;Number&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt;ERC&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt;Number&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;N&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt;Storage&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt;Contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt;Address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;For example, if the storage contract address is &lt;code&gt;0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA&lt;&#x2F;code&gt; the returned value should be&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x777977797779777977797779AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;When the account is delegated(e.g., during the account initialization stage), the account implementation should append the base storage slot of the account to the following slot position: &lt;code&gt;keccak(keccak(&#x27;InteroperableDelegatedAccount.ERC.Storage&#x27;)-1) &amp;amp; ~0xff&lt;&#x2F;code&gt; .&lt;&#x2F;p&gt;
&lt;p&gt;The storage variable would be using the &lt;code&gt;bytes32[]&lt;&#x2F;code&gt; type and is an append-only variable which newly delegated accounts append its storage slot hash. The account may choose to not append its storage base to an array if there is an identical entry that already exist.&lt;&#x2F;p&gt;
&lt;p&gt;In case the account identifies that there are colliding storage bases, the account can perform further storage verification either off-chain or on-chain and decide whether the delegation would happen.&lt;&#x2F;p&gt;
&lt;p&gt;Wallet may revert the delegation if the colliding storage includes a suspicious storage values that may target the user(e.g., shadow signer, etc).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;onredelegation&quot;&gt;&lt;code&gt;onRedelegation()&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;This function is to prepare for the redelegation to a new account.&lt;&#x2F;p&gt;
&lt;p&gt;When this function is called, the existing delegated account should perform actions to not limit or impact the user when the user redelegates to a new account as much as possible.&lt;&#x2F;p&gt;
&lt;p&gt;For example, the account could uninitialize the storage variables as much as it can to provide clean storage for new wallet.&lt;&#x2F;p&gt;
&lt;p&gt;This standard, however, does not explicitly state the behavior to be done during this function call as wallet implementations have very distinctive architecture and details.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;The standard expect the wallet implementation to revert it back to a clean storage state &lt;em&gt;&lt;strong&gt;as much as possible&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt; with this function.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;onRedelegation()&lt;&#x2F;code&gt; should validate if the caller is indeed the authorized user by checking the &lt;code&gt;msg.sender&lt;&#x2F;code&gt; value.&lt;&#x2F;p&gt;
&lt;p&gt;This could also be done through a &quot;self-call&quot; if a custom validation scheme is implemented or at the wallet&#x27;s discretion as a side case.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7779&#x2F;.&#x2F;assets&#x2F;diagram.svg&quot; alt=&quot;diagram showing the flow of onredelegation&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;storage-base-checks&quot;&gt;Storage base checks&lt;&#x2F;h3&gt;
&lt;p&gt;This standard is designed with the need of wallets to validate the storage of the EOA, even if some may consider that the probability of hash is already big that the account doesn&#x27;t have to check, assuming that each wallet uses a different storage base slot.
In fact, this standard thinks exactly the opposite. It is worth scanning the storage, or at least the storage that the delegated account will use, which the wallet wants to delegate to. E.g., Just like developers validating the storage of Facets in Diamond (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2535&#x2F;&quot;&gt;ERC-2535&lt;&#x2F;a&gt;) to prevent storage collision and not just relying on hash probability.
In line with this, the &lt;code&gt;accountStorageBases()&lt;&#x2F;code&gt; was designed to not only return the storage base of the current wallet implementation, but return the full historical storage slots that the account has used.
This could provide valuable information for the storage scanning of the EOA before delegation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;optional-onredelegation&quot;&gt;Optional &lt;code&gt;onRedelegation()&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;onRedelegation()&lt;&#x2F;code&gt; was designed to be optional to lower the barrier of being compliant with this standard. Also, there could be accounts that does not functionally require a hook-logic to be in place before redelegation, or accounts that does not suite with the design principle of the &lt;code&gt;onRedelegation()&lt;&#x2F;code&gt; e.g., excessive use of mapping or data types that&#x27;s hard to uninitialize.&lt;&#x2F;p&gt;
&lt;p&gt;It is worth noting that, &lt;code&gt;onRedelegation()&lt;&#x2F;code&gt; does not obligate the account to completely whipe out it&#x27;s storage. It&#x27;s more of a best effort function to leave the cleanest stage for the future use of the EOA in a new wallet. Or to execute a function to prepare for redelegation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Existing smart accounts that was built prior to the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; discussion will need changes to support this standard.&lt;&#x2F;p&gt;
&lt;p&gt;This standard was specifically for Smart Accounts for EOA, but this could be applied further to diverse cases and architecture.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Calling &lt;code&gt;onRedelegation()&lt;&#x2F;code&gt; should include security mechanism to properly authentication the owner.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;This standard enforces the accounts to&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;provide proper Base Storage Slot when &lt;code&gt;accountStorageBase()&lt;&#x2F;code&gt; is called&lt;&#x2F;li&gt;
&lt;li&gt;perform proper actions to make account storage to a clean state as much as possible (e.g., uninitialization of storage variables, etc) IF the account supports &lt;code&gt;onRedelegation()&lt;&#x2F;code&gt;
However, whether the account follows the above three enforcements with behavioral actions is dependant of the account.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;If needed, accounts may check the authenticity of the information through off-chain approaches.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Wiping out the storage completely may not be an adaptable action depending on how account implementation manages storage.&lt;&#x2F;p&gt;
&lt;p&gt;This standard recommends the account to completely wipe out its storage, however, exceptions apply if the account is incapable of doing that.&lt;&#x2F;p&gt;
&lt;p&gt;In the case when the account cannot completely wipe out its storage, the standard expect the account to perform the best degree of action it can do to support the redelegation operation for the user.&lt;&#x2F;p&gt;
&lt;p&gt;Also, the account should make sure the initializer cannot be triggered by an arbitrary entity after &lt;code&gt;onRedelegation()&lt;&#x2F;code&gt; is called.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;onRedelegation()&lt;&#x2F;code&gt; should not reset the replay protection considering that it could incur a vulnerability(e.g., signature reply attack).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;It is worth noting that this standard is an ERC, which means that even if the ERC enforces it, the actual implementation may not be compliant with it. e.g., accounts pretending to support this standard which is not, in fact. So it is recommend to validate if the account is a know implementation that is secure and compliant with the standard.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The standard ENFORCES the storage slot to be calculated through &lt;code&gt;keccak256()&lt;&#x2F;code&gt; to reduce collision. The preimage of the hash could be the name&#x2F;version or a combination, it is under full discretion of the account.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Block Gas Accounting without Refunds</title>
        <published>2024-10-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Ben Adams</name><uri>https://github.com/benaadams</uri>
	</author>
	
	<author>
		<name>Toni Wahrstätter</name><uri>https://github.com/nerolation</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7778/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7778-prevent-block-gas-smuggling/21234" />
        

        <id>https://wg-eips.ritovision.com/7778/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7778"
            label="EIP-7778" />
        

        
        

        
        <summary type="html">Prevent Block Gas Limit Circumvention by Excluding Refunds from Block Gas Accounting</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7778/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP modifies the block gas accounting mechanism to prevent the circumvention of block gas limits. It proposes that gas refunds, particularly those from SSTORE operations setting storage slots to zero, should not reduce the gas counted toward the block gas limit, while still being applied to transaction gas costs for users.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, gas refunds from operations like clearing storage slots (setting to zero) reduce both the transaction gas cost for users and the gas counted toward the block gas limit. This creates a discrepancy between the computational work performed and the gas accounted for in the block.&lt;&#x2F;p&gt;
&lt;p&gt;Example: Block &lt;code&gt;20878522&lt;&#x2F;code&gt; shows a net usage of 28.5 MGas, but contains 4.01 MGas of refunds, bringing the gross usage to 32.51 MGas—exceeding the block gas limit by 2.51 MGas.&lt;&#x2F;p&gt;
&lt;p&gt;This mechanism can be exploited to perform more operations in a block than the gas limit intends to allow, potentially leading to:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Network instability due to oversized blocks&lt;&#x2F;li&gt;
&lt;li&gt;Denial-of-service vectors&lt;&#x2F;li&gt;
&lt;li&gt;Computational loads exceeding the intended block gas limit&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;gas-accounting-changes&quot;&gt;Gas Accounting Changes&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;User Gas Accounting (Unchanged):&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Users continue to receive gas refunds for operations that qualify (e.g., setting storage to zero)&lt;&#x2F;li&gt;
&lt;li&gt;Transaction gas: &lt;code&gt;gas_spent = max(tx_gas_used - gas_refund, calldata_floor_gas_cost)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Block Gas Accounting (Modified):&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;When calculating gas for block gas limit enforcement, refunds are not subtracted&lt;&#x2F;li&gt;
&lt;li&gt;Block gas accounting becomes: &lt;code&gt;block.gas_used += max(tx_gas_used, calldata_floor_gas_cost)&lt;&#x2F;code&gt; (incorporating the calldata floor from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7623&#x2F;&quot;&gt;EIP-7623&lt;&#x2F;a&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;Storage discounts that reflect actual reduced computational work (e.g., warm storage access, reverting to original values) remain applied to block gas accounting&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;aligning-gas-limits-with-computational-work&quot;&gt;Aligning Gas Limits with Computational Work&lt;&#x2F;h3&gt;
&lt;p&gt;The block gas limit is designed to constrain the computational load per block. Gas refunds were introduced to incentivize &quot;cleaning up&quot; the state, not to allow exceeding computational limits. By excluding refunds from block gas accounting, we ensure the block gas limit effectively constrains computational load&lt;&#x2F;p&gt;
&lt;h3 id=&quot;preserving-user-incentives&quot;&gt;Preserving User Incentives&lt;&#x2F;h3&gt;
&lt;p&gt;Users still receive gas refunds, maintaining incentives for efficient state management. Only the accounting for block-level constraints changes, not the economics for individual users&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;This change is not backwards compatible and requires a hard fork&lt;&#x2F;li&gt;
&lt;li&gt;User and developer experience for individual transactions remains unchanged&lt;&#x2F;li&gt;
&lt;li&gt;Block producers need to adjust their transaction selection algorithms to account for the new gas accounting rules&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;SSTORE Operations:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Setting storage to zero: User receives refund, but block gas accounting uses full cost&lt;&#x2F;li&gt;
&lt;li&gt;Verify blocks containing many storage-clearing operations still adhere to gas limits&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Block Gas Limit Edge Cases:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Construct blocks with varying amounts of refundable operations&lt;&#x2F;li&gt;
&lt;li&gt;Ensure blocks cannot exceed gas limits through refund mechanisms&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Transaction Gas vs Block Gas:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Verify that transaction costs for users remain unchanged&lt;&#x2F;li&gt;
&lt;li&gt;Confirm block gas accounting properly excludes refunds&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Eliminates potential denial-of-service vectors that exploit gas refunds to exceed block computational limits&lt;&#x2F;li&gt;
&lt;li&gt;Improves predictability of block processing times by enforcing stricter limits on computational work&lt;&#x2F;li&gt;
&lt;li&gt;Prevents miners&#x2F;validators from including transactions that collectively contain more computational work than intended&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Validation Module Extension for ERC-7579</title>
        <published>2024-10-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>zeroknots</name><uri>https://github.com/zeroknots</uri>
	</author>
	
	<author>
		<name>Konrad Kopp</name><uri>https://github.com/kopy-kat</uri>
	</author>
	
	<author>
		<name>Taek Lee</name><uri>https://github.com/leekt</uri>
	</author>
	
	<author>
		<name>Fil Makarov</name><uri>https://github.com/filmakarov</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7780/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7780-validation-module-extension-for-erc-7579/21273" />
        

        <id>https://wg-eips.ritovision.com/7780/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7780"
            label="ERC-7780" />
        

        
        

        
        <summary type="html">Introduces new smart account module types for signature validation and permissioning</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7780/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal introduces three new module types on top of the existing modules described in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7579&#x2F;&quot;&gt;ERC-7579&lt;&#x2F;a&gt;. The modules are policy, signer and stateless validator. None of these modules are required to be implemented by accounts, but accounts can choose to implement them or other modules can choose to make use of them for additional composability.&lt;&#x2F;p&gt;
&lt;p&gt;Policy modules can be used to check what a &lt;code&gt;UserOperation&lt;&#x2F;code&gt; or action is trying to achieve and determine if this is allowed. Signer modules can be used to validate signatures on provided hashes. Stateless validators are modules that are used to both validate signatures and compare them to a calldata-provided data blob which could, for example, include owners to check signatures against.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The modules introduced by this proposal aim to create more composability around signature and permission verification.&lt;&#x2F;p&gt;
&lt;p&gt;Policy and signer modules allow an account to make direct use of such a permissioning logic rather than relying on external modules to handle this. This has the upside of lower gas cost but the downside of less flexibility for users and developers that use the account.&lt;&#x2F;p&gt;
&lt;p&gt;Stateless validators enable further composability around signature validation logic. In many cases, it does not make sense to re-write signature validation for new validators, but instead to use the existing ones. However, this is usually not possible since the validators rely on a stored configuration indexed by the &lt;code&gt;msg.sender&lt;&#x2F;code&gt;, which is expected to be an account. Stateless validators solve this problem by not relying on state to compare signature verification against, but instead to compare it against a calldata-provided argument.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;This standard introduces three new module types on top of the existing modules introduced by ERC-7579:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Policy&lt;&#x2F;code&gt; (type id: 5)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Signer&lt;&#x2F;code&gt; (type id: 6)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;StatelessValidator&lt;&#x2F;code&gt; (type id: 7)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;PreValidationHookERC1271&lt;&#x2F;code&gt; (type id: 8)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;PreValidationHookERC4337&lt;&#x2F;code&gt; (type id: 9)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;StatelessValidatorWithSender&lt;&#x2F;code&gt; (type id: 10)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note: A single module can be of multiple types.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;policy&quot;&gt;Policy&lt;&#x2F;h3&gt;
&lt;p&gt;Policies MUST implement &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7579&#x2F;&quot;&gt;ERC-7579&lt;&#x2F;a&gt;&#x27;s &lt;code&gt;IModule&lt;&#x2F;code&gt; and the &lt;code&gt;IPolicy&lt;&#x2F;code&gt; interface and have module type id: &lt;code&gt;5&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IPolicy&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IModule&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;		&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;		 * Checks a userOp to determine if it should be executed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;         *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;         * SHOULD validate the executions in the userOp against stored configurations&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;         *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;		 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The id of the policy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;		 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; userOp&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The user operation to check&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;         *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;		 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; validation data to return to the EntryPoint as specified by ERC-4337&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;		 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checkUserOpPolicy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;			  bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;			  PackedUserOperation&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; userOp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        payable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        virtual&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;		&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;		 * Checks a signature to determine if it should be executed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;         *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;         * SHOULD validate the hash in order to determine what the signature is used for and if it should be permitted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;         * MAY check the sender to determine whether the signature should be permitted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;         *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;		 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The id of the policy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;		 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The sender of the transaction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;		 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The hash of the transaction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;		 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sig&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The signature of the transaction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;         *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;		 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; validation data to return to the EntryPoint as specified by ERC-4337&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;		 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;		function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checkSignaturePolicy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;			  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;			  bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;			  bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sig&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        virtual&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;signer&quot;&gt;Signer&lt;&#x2F;h3&gt;
&lt;p&gt;Signers MUST implement the &lt;code&gt;IModule&lt;&#x2F;code&gt; and the &lt;code&gt;ISigner&lt;&#x2F;code&gt; interface and have module type id: &lt;code&gt;6&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ISigner&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IModule&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;		&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;		 * Check the signature of a user operation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;         *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;		 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The id of the signer config&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;		 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; userOp&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The user operation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;		 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; userOpHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The hash of the user operation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;         *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;		 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; status of the signature check to return to the EntryPoint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;		 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checkUserOpSignature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;			  PackedUserOperation&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; userOp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;			  bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; userOpHash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        payable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        virtual&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;		&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;		 * Check an ERC-1271 signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;         *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;		 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The id of the signer config&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;		 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The sender of the signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;		 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The hash to check against&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;		 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sig&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The signature to validate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;         *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;		 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-1271 magic value if the signature is valid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;		 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checkSignature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sig&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        virtual&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;stateless-validator&quot;&gt;Stateless Validator&lt;&#x2F;h3&gt;
&lt;p&gt;StatelessValidators MUST implement the &lt;code&gt;IStatelessValidator&lt;&#x2F;code&gt; interface and have module type id: &lt;code&gt;7&lt;&#x2F;code&gt;. It is RECOMMENDED that all Validators (module type id &lt;code&gt;1&lt;&#x2F;code&gt;) also implement the Stateless Validator interface for additional composabillity.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IStatelessValidator&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Validates a signature given some data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The data that was signed over&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The signature to verify&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The data to validate the verified signature against&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST validate that the signature is a valid signature of the hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST compare the validated signature against the data provided&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST return true if the signature is valid and false otherwise&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validateSignatureWithData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Returns boolean value if module is a certain type&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; moduleTypeId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the module type ID according the ERC-7579 spec&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST return true if the module is of the given type and false otherwise&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isModuleType&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; moduleTypeId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;prevalidationhookerc1271&quot;&gt;&lt;code&gt;PreValidationHookERC1271&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;PreValidationHookERC1271&lt;&#x2F;code&gt; MUST implement the &lt;code&gt;IPreValidationHookERC1271&lt;&#x2F;code&gt; interface and have module type id: &lt;code&gt;8&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IPreValidationHookERC1271&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; preValidationHookERC1271&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; hookHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; hookSignature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;prevalidationhookerc4337&quot;&gt;&lt;code&gt;PreValidationHookERC4337&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;PreValidationHookERC4337&lt;&#x2F;code&gt; MUST implement the &lt;code&gt;IPreValidationHookERC4337&lt;&#x2F;code&gt; interface and have module type id: &lt;code&gt;9&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IPreValidationHookERC4337&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; preValidationHookERC4337&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        PackedUserOperation&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; userOp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; missingAccountFunds&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; userOpHash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; hookHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; hookSignature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;statelessvalidatorwithsender&quot;&gt;StatelessValidatorWithSender&lt;&#x2F;h3&gt;
&lt;p&gt;StatelessValidatorWithSender MUST implement the &lt;code&gt;IStatelessValidatorWithSender&lt;&#x2F;code&gt; interface and have module type id: &lt;code&gt;10&lt;&#x2F;code&gt;. It is RECOMMENDED that all Validators (module type id &lt;code&gt;1&lt;&#x2F;code&gt;) also implement the Stateless Validator With Sender interface for additional composabillity.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IStatelessValidatorWithSender&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Validates a signature given some data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address who called account.isValidSignature()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The data that was signed over&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The signature to verify&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The data to validate the verified signature against&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST validate that the signature is a valid signature of the hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST compare the validated signature against the data provided&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST return true if the signature is valid and false otherwise&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validateSignatureWithDataWithSender&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;TBD &lt;!-- TODO --&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;TBD &lt;!-- TODO --&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>BURN opcode</title>
        <published>2024-09-30T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Dev Bear</name><uri>https://github.com/itsdevbear</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7775/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7775-burn-opcode/21287" />
        

        <id>https://wg-eips.ritovision.com/7775/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7775"
            label="EIP-7775" />
        

        
        

        
        <summary type="html">An opcode to burn native ether at the given address</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7775/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal introduces a &lt;code&gt;BURN&lt;&#x2F;code&gt; opcode to the EVM. When called, the opcode is to burn native ether at the address of the current evm context.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The motivation for this proposal is to provide a standardized and efficient way to burn native ether directly within the EVM. Historically, contracts such as the BeaconDepositContract have &quot;burned&quot; ether by making it irrecoverable from the given address. This approach can lead to confusion and potential misuse. By introducing a dedicated &lt;code&gt;BURN&lt;&#x2F;code&gt; opcode, we can ensure a clear and consistent method for burning native ether. This could become useful for Ethereum L2s when transferring ether back to the L1, as well as other EVM L1 chains that could leverage this for their cryptoeconomics.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;behaviour&quot;&gt;Behaviour&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;BURN&lt;&#x2F;code&gt; opcode &lt;code&gt;(0xFC)&lt;&#x2F;code&gt; is introduced with the following behavior:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Pops one 32-byte word from the top of the stack, treating these bytes as the &lt;code&gt;uint256&lt;&#x2F;code&gt; amount of native ether to be burned.&lt;&#x2F;li&gt;
&lt;li&gt;Retrieves the current address from the EVM execution context.&lt;&#x2F;li&gt;
&lt;li&gt;Checks the balance of the current address.&lt;&#x2F;li&gt;
&lt;li&gt;If the amount to be burned is greater than the balance of the current address, the opcode &lt;code&gt;MUST&lt;&#x2F;code&gt; revert.&lt;&#x2F;li&gt;
&lt;li&gt;If the amount to be burned is 0, the execution &lt;code&gt;MUST NOT&lt;&#x2F;code&gt; revert.&lt;&#x2F;li&gt;
&lt;li&gt;Subtracts the amount from the current address&#x27;s native ether balance.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;When &lt;code&gt;BURN&lt;&#x2F;code&gt; is used in the context of a DELEGATECALL or CALLCODE, the contract whose balance is to be manipulated is the contract that issued the DELEGATECALL or CALLCODE instruction.&lt;&#x2F;p&gt;
&lt;p&gt;When &lt;code&gt;BURN&lt;&#x2F;code&gt; is used in the context of a STATICCALL the call &lt;code&gt;MUST&lt;&#x2F;code&gt; revert.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-cost&quot;&gt;Gas Cost&lt;&#x2F;h3&gt;
&lt;p&gt;The base gas cost for the &lt;code&gt;BURN&lt;&#x2F;code&gt; opcode is 100 gas. The dynamic gas cost is determined as follows:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;If the value to be burned is 0, the dynamic gas cost is 0.&lt;&#x2F;li&gt;
&lt;li&gt;If the account doesn&#x27;t exist, or the balance of the account is 0, the dynamic gas cost is 0.&lt;&#x2F;li&gt;
&lt;li&gt;Otherwise, the dynamic gas cost is 2800.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The total gas cost for the &lt;code&gt;BURN&lt;&#x2F;code&gt; opcode is the sum of the base gas cost and the dynamic gas cost.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;pseudocode&quot;&gt;Pseudocode&lt;&#x2F;h3&gt;
&lt;p&gt;Example pseudocode for the &lt;code&gt;BURN&lt;&#x2F;code&gt; opcode:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; op_burn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;pc&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; interpreter&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; scope&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Consume the base gas cost&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    interpreter&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;consume_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;100&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Pop the value to be burned from the stack&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    value_to_burn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; scope&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;stack&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If the value to be burned is 0, do not revert&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; value_to_burn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieve the current address from the EVM execution context&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    current_address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; scope&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check the balance of the current address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; interpreter&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state_db&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get_balance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;current_address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If the value to be burned is greater than the balance, revert&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; value_to_burn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; balance&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ErrInsufficientBalance&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If the account balance is 0, return.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Subtract the value from the current address&amp;#39;s balance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    interpreter&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state_db&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sub_balance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;current_address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; value_to_burn&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The account is known to exist at this point, thus we consume &amp;quot;warm&amp;quot; gas.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    interpreter&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;consume_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2800&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The introduction of the &lt;code&gt;BURN&lt;&#x2F;code&gt; opcode helps clean up a piece of weird semantics in the Ethereum. Historically, burning native ether involved sending them to an address from which they could not be recovered, such as the zero address or a contract with no withdrawal functionality. This method is not only inefficient but also confusing for indexers and other tools that track token movements. By providing a dedicated &lt;code&gt;BURN&lt;&#x2F;code&gt; opcode, we eliminate this ambiguity and ensure that the act of burning tokens is explicit and standardized.&lt;&#x2F;p&gt;
&lt;p&gt;Potential Pros:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Provides a clear and standardized method for burning native ether within smart contracts.&lt;&#x2F;li&gt;
&lt;li&gt;Allows for better accounting practices of native token within smart contracts.&lt;&#x2F;li&gt;
&lt;li&gt;Reduces the possibility of a smart contract exploit caused by native token that was marked as &quot;burned&quot; being unintetionally recovered.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Potential Cons:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Does not help remove unrecoverable ether sitting in existing contracts.&lt;&#x2F;li&gt;
&lt;li&gt;New code in the clients&lt;&#x2F;li&gt;
&lt;li&gt;New concept needed to be added to the yellow paper.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a new opcode and thus must be activated via a scheduled hardfork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;!-- TODO --&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;!-- TODO --&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Potentially opens up misuse when using &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Governance for Human Robot Societies</title>
        <published>2024-09-29T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>OpenMind</name>
	</author>
	
	<author>
		<name>Jan Liphardt</name><email>jan@openmind.org</email>
	</author>
	
	<author>
		<name>Shaohong Zhong</name><uri>https://github.com/ShaohongZ</uri>
	</author>
	
	<author>
		<name>Boyuan Chen</name><uri>https://github.com/bchen-dev</uri>
	</author>
	
	<author>
		<name>Paige Xu</name><email>paige@openmind.org</email>
	</author>
	
	<author>
		<name>James Ball</name><email>james.ball@nethermind.io</email>
	</author>
	
	<author>
		<name>Thamer Dridi</name><email>thamer.dridi@nethermind.io</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7777/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7777-proposal-for-human-robot-societies/21216" />
        

        <id>https://wg-eips.ritovision.com/7777/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7777"
            label="ERC-7777" />
        

        
        

        
        <summary type="html">Defines interfaces for managing the identities of humans and robots, and establishing rule sets for their interaction.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7777/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal defines two core interfaces: &lt;code&gt;IUniversalIdentity&lt;&#x2F;code&gt; and &lt;code&gt;IUniversalCharter&lt;&#x2F;code&gt;, providing mechanisms for humans, and robots to establish their identities and to create decentralized communities governed by specific rule sets. The &lt;code&gt;IUniversalIdentity&lt;&#x2F;code&gt; interface establishes the fair and equitable treatment of sentient computer architectures other than the human brain, enabling robots to acquire on-chain identities, and thereby interact and transact with humans. Additionally the &lt;code&gt;IUniversalIdentity&lt;&#x2F;code&gt; interface also includes support for hardware-backed identity verification, enabling physical robots to prove their identity through cryptographic signatures derived from secure hardware elements and a challenge-response scheme. The &lt;code&gt;IUniversalCharter&lt;&#x2F;code&gt; enables humans and robots to create, join (“register”), maintain (“update”), leave, and terminate self-regulated societies based on predefined rule sets, providing a framework for collaboration and prosperity for mixed societies of humans and robots. These interfaces aim to provide a flexible yet enforceable structure for human-robot interactions in decentralized systems, ensuring efficiency, transparency, and security for all participants.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The human brain is a wet, massively parallel electrochemical computer. Recent hardware and software advances make it likely that soon, human societies will need tools for interacting with sentient, non-human computers, such as robots. Our current forms of government, where citizens are auto-enrolled into specific rule sets depending on where they were born, do not gracefully map onto robots without a traditional birthplace or birthtime. Among many difficulties being experienced by robots, they are (currently) unable to obtain standard forms of ID (such as passports), it is not clear which rule sets apply to them (since in general they are not born in specific places), and they cannot currently use the standard human-centered banking system. Likewise, in the event in which robots are harmed by humans or non-biological computers, it is not clear which human court has jurisdiction.&lt;&#x2F;p&gt;
&lt;p&gt;Traditional geographically-defined and human-centered systems can be inefficient, slow to change, opaque, and can struggle to accommodate global, virtualized societies.  Decentralized, immutable, and public computers offer an ideal solution to these limitations, since they do not inherently discriminate against non-human computers and therefore offer an equitable and more just framework for governance.  In particular, smart contracts can provide a powerful framework for regulating the rights and responsibilities or interacting parties regardless of implementation details of their compute architecture.&lt;&#x2F;p&gt;
&lt;p&gt;The general motivation of this ERC is to provide a standard interface for smart contracts focusing on identity&#x2F;governance for heterogeneous global societies. While there are an unlimited number of such rule sets, there are obvious benefits to providing a standard interface to those rule sets, greatly reducing the friction and complexity of creating, joining, maintaining, and ending such societies. The specific motivation of this ERC is twofold:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Robot Identity Creation and Management: To participate meaningfully and comply with on-chain laws, non-humans such as robots must be able to acquire meaningful on-chain identities. Importantly, these identities should enable robots to enjoy the benefits of, but also bear the responsibility of, being part of a specific society. Thus, we propose to enable smart contract-based identity for robots. Specifically, each robot is represented by a smart contract and needs to follow the rules defined in the contract to interact with other agents on the chain. Each robot can also specify hardware identity parameters such as a manufacturer, operator, model and serial number in conjunction with a public key which is intended to be generated using a secure element on the Robot. This provides a tamper-resistant and unclonable proof that can be physically verified through challenge-response authentication - where any party can verify the robot&#x27;s identity by having the device cryptographically sign a challenge using its hardware-secured private key. These verified identities are published on-chain. This interface also ensures flexibility by all participants to propose, adopt, or revoke rules, enabling self-managed compliance and transparent interaction with other participants.&lt;&#x2F;li&gt;
&lt;li&gt;Rule Creation and Enforcement: For humans and robots to effectively collaborate, they must agree upon a rule set. This Ethereum-based system provides a basic decentralized framework for governing human-robot interactions through smart contracts. We propose to enforce the rule-sets by requiring humans and robots to join regulated access smart contracts that check their compliance with the given rules. We also ensure scalability, whereby multiple regulated access contracts can be created to tailor to different purposes, and humans and robots can choose to join the relevant system as needed.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Together, these interfaces form the foundation for managing complex human-robot interactions, enabling a decentralized, verifiable, and rule-based ecosystem where robots and humans can interact securely, transparently, and responsibly, for maximum benefit of all.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IUniversalIdentity&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Structure for hardware identity&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; HardwareIdentity&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; publicKey&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Hardware-bound public key uniquely tied to this robot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt; manufacturer&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;           &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Identifier for the robot&amp;#39;s manufacturer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;               &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Identifier for the robot&amp;#39;s operator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt; model&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Model identifier of the robot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt; serialNumber&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;           &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Unique serial number for the robot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; initialHashSignature&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Signature of the initial system state hash (e.g., firmware, OS) by the root key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; currentHashSignature&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Signature of the latest state hash, updated periodically for integrity verification by the root key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Gets the hardware identity info&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; HardwareIdentity&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Current hardware identity&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getHardwareIdentity&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;HardwareIdentity&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Generates a new challenge for hardware verification&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Random challenge that needs to be signed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; generateChallenge&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify response to a specific challenge&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; challenge&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The challenge that was issued&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Hardware signature of the challenge&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; True if signature is valid for this challenge&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verifyChallenge&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; challenge&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Adds a rule to the robot&amp;#39;s identity, showing that the robot agrees to follow the rule.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; rule&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The dynamic byte array representing the rule that the robot agrees to follow. Each rule is a textual string encoded into a dynamic byte array. For example: &amp;#39;A robot must keep a 1m distance from humans.&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The rule SHOULD come from the rule sets defined in the IUniversalCharter contract that the robot intends to join. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function SHOULD be implemented by contracts to add the rules that the robot intends to follow.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addRule&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; rule&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Removes a rule from the robot&amp;#39;s identity.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; rule&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The dynamic byte array representing the rule that the robot no longer agrees to follow.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function SHOULD be implemented by contracts to remove the rules that the robot does not intend to follow.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; removeRule&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; rule&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Checks if the robot complies with a specific rule.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; rule&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The rule to check.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns true if the robot complies with the rule.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function MUST be implemented by contracts for compliance verification.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checkCompliance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; rule&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a rule is added to the robot&amp;#39;s identity.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RuleAdded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; rule&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a rule is removed from the robot&amp;#39;s identity.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RuleRemoved&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; rule&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a charter is subscribed to.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SubscribedToCharter&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; charter&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when it is unsubscribed from a charter.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UnsubscribedFromCharter&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; charter&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IUniversalCharter&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Define the user types as an enum.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UserType&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt; Human&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt; Robot&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Registers a user (human or robot) to join the system by agreeing to a rule set.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; userType&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The type of user.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ruleSet&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The array of individual rules the user agrees to follow. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function MUST be implemented by contracts using this interface.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The implementing contract MUST ensure that the user complies with the specified rule set before registering them in the system by invoking `checkCompliance`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; registerUser&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;UserType&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; userType&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ruleSet&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Allows a user (human or robot) to leave the system &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function MUST be callable only by the user themselves (via `msg.sender`). &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The implementing contract MUST ensure that the user has complied with all necessary rules before they can successfully leave the system by invoking `checkCompliance`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; leaveSystem&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Checks if the user (human or robot) complies with the system’s rules.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; user&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the user (human or robot).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ruleSet&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The array of individual rules to verify. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns true if the user complies with the rule set.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function SHOULD invoke the `checkCompliance` function of the user’s IUniversalIdentity contract to check for rules individually. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function MUST be implemented by contracts for compliance verification.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checkCompliance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ruleSet&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Updates the rule set.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; newRuleSet&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The array of new individual rules replacing the existing ones. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function SHOULD be restricted to authorized users (e.g., contract owner).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; updateRuleSet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newRuleSet&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Terminates the contract, preventing any further registrations or interactions.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function SHOULD be restricted to authorized users (e.g., contract owner).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function SHOULD be implemented by contracts.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; terminateContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a user joins the system by agreeing to a set of rules.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UserRegistered&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;UserType&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; userType&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ruleSet&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a user successfully leaves the system after fulfilling obligations.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UserLeft&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a user’s compliance with a rule set is verified.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ComplianceChecked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ruleSet&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a rule set is updated.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RuleSetUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newRuleSet&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; updatedBy&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;IUniversalIdentity&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;struct HardwareIdentity&lt;&#x2F;code&gt;
The HardwareIdentity structure provides essential information about a robot, including a challenge-response public key, manufacturer, operator, model, manufacturer serial number&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;generateChallenge()&lt;&#x2F;code&gt;
This function enables secure identity verification through a challenge-response authentication.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;verifyChallenge(bytes32 challenge, bytes memory signature)&lt;&#x2F;code&gt;
This function verifies that a signature was genuinely created by the robot&#x27;s secure hardware in response to a specific challenge.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;addRule(bytes memory rule)&lt;&#x2F;code&gt;
This function allows a robot to flexibly adopt new compliance requirements in order join different &lt;code&gt;IUniversalCharter&lt;&#x2F;code&gt; contracts.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;removeRule(bytes memory rule)&lt;&#x2F;code&gt;
This function allows a robot to dynamically manage and maintain its rules, ensuring that its rule set remains up-to-date.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;checkCompliance(bytes memory rule)&lt;&#x2F;code&gt;
This function ensures that a robot is adhering to rules by performing decentralised checks on its compliance.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;Events (RuleAdded, RuleRemoved)&lt;&#x2F;code&gt;
These events provide transparency and traceability, making it easier to track compliance status.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;IUniversalCharter&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;enum UserType { Human, Robot }&lt;&#x2F;code&gt;
The UserType enum makes it easier for contracts to handle different user types without the cost and errors associated with strings. This provides the basis for differentiated handling in future implementations, allowing the system to potentially apply different rules or logic based on whether the user is a human or a robot.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;registerUser(UserType userType, bytes[] memory ruleSet)&lt;&#x2F;code&gt;
This function ensures that a user—whether human or robot—is bound to a particular set of rules upon joining the system.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;leaveSystem()&lt;&#x2F;code&gt;
This function allows users to flexibly and securely leave a &lt;code&gt;IUniversalCharter&lt;&#x2F;code&gt; contract after compliance is checked.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;checkCompliance(address user, bytes[] memory ruleSet)&lt;&#x2F;code&gt;
This function ensures that the system can efficiently manage and verify compliance against predefined rule sets, helping maintain the overall integrity of the system.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;updateRuleSet(bytes[] memory newRuleSet)&lt;&#x2F;code&gt;
This function enables the &lt;code&gt;IUniversalCharter&lt;&#x2F;code&gt; contract to adapt and update, removing the need to create a new contract for ruleset updates.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;terminateContract()&lt;&#x2F;code&gt;
This function allows for the orderly and permanent shutdown of the contract.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;Events (UserRegistered, UserLeft, ComplianceChecked, RuleSetUpdated, ContractTerminated)&lt;&#x2F;code&gt;
These events collectively ensure that key activities are visible to off-chain systems and participants, making the system auditable and transparent.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.19&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; { &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;OwnableUpgradeable&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts-upgradeable&#x2F;access&#x2F;OwnableUpgradeable.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; { &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;UniversalCharter&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;UniversalCharter.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Interfaces&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; { &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IUniversalIdentity&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;interface&#x2F;IUniversalIdentity.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; { &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IUniversalCharter&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;interface&#x2F;IUniversalCharter.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; UniversalIdentity&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The UniversalIdentity contract is used to manage the identity of robots.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UniversalIdentity&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IUniversalIdentity&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;OwnableUpgradeable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Version identifier for the current implementation of the contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; VERSION &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;v0.0.1&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Mapping to store rules that the robot has agreed to follow&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; robotRules&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Mapping to store the off-chain compliance status for each rule&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; complianceStatus&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Track the charters the robot is subscribed to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; subscribedCharters&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Custom errors to save gas on reverts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RuleNotAgreed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt; rule&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RuleNotCompliant&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt; rule&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RuleAlreadyAdded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt; rule&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Event to emit when compliance is checked&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; updater&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the compliance updater (owner of the contract)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; rule&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The rule that was checked&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ComplianceChecked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; updater&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; rule&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Modifier to check if a rule exists&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    modifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ruleExists&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; rule&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;robotRules&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;rule&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Rule does not exist&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        _&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Constructor to set the owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        initialize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt; _owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xdEaD&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Initializer function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; initialize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; initializer&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        __Ownable_init&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        transferOwnership&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        hardwareIdentity &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _hardwareIdentity&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Gets the hardware identity info&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getHardwareIdentity&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;HardwareIdentity&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; hardwareIdentity&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Generates a new challenge for hardware verification&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; generateChallenge&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; challenge &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;prevrandao&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            msg.sender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        activeChallenge&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;challenge&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; challenge&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify response to a specific challenge&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verifyChallenge&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; challenge&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;activeChallenge&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;challenge&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InvalidChallenge&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Remove challenge after use&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        delete&lt;&#x2F;span&gt;&lt;span&gt; activeChallenge&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;challenge&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify the signature using ECDSA&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; messageHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;challenge&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; ethSignedMessageHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; ECDSA&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;toEthSignedMessageHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;messageHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; signer &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; ECDSA&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;recover&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ethSignedMessageHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Convert hardware public key to address for comparison&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; hardwareAddress &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint160&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;hardwareIdentity&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;publicKey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;signer &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span&gt; hardwareAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InvalidSignature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Updates the hardware identity information&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _hardwareIdentity&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; New hardware identity information&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; updateHardwareIdentity&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        HardwareIdentity&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _hardwareIdentity&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        hardwareIdentity &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _hardwareIdentity&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Adds a rule to the robot&amp;#39;s identity&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; rule&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The dynamic byte array representing the rule that the robot agrees to follow.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addRule&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; rule&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;robotRules&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;rule&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RuleAlreadyAdded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;rule&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Add rule to the mapping&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        robotRules&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;rule&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RuleAdded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;rule&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Removes a rule from the robot&amp;#39;s identity&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; rule&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The dynamic byte array representing the rule that the robot no longer agrees to follow.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; removeRule&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; rule&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ruleExists&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;rule&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        robotRules&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;rule&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        complianceStatus&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;rule&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RuleRemoved&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;rule&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Subscribe and register to a specific UniversalCharter contract using its stored rule set&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; charter&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the UniversalCharter contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; version&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The version of the rule set to fetch and register for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; subscribeAndRegisterToCharter&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; charter&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; version&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;subscribedCharters&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;charter&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Already subscribed to this charter&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        subscribedCharters&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;charter&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Fetch the rule set directly from the UniversalCharter contract using the public getter&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; ruleSet &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UniversalCharter&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;charter&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getRuleSet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;version&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Register as a robot in the charter using the fetched rule set&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        UniversalCharter&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;charter&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;registerUser&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;IUniversalCharter&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;UserType&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;Robot&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; ruleSet&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SubscribedToCharter&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;charter&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Leave the system for a specific UniversalCharter contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; charter&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the UniversalCharter contract to leave&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; leaveCharter&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; charter&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;subscribedCharters&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;charter&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Not subscribed to this charter&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Call the leaveSystem function of the UniversalCharter contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        UniversalCharter&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;charter&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;leaveSystem&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Unsubscribe from the charter after leaving&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        subscribedCharters&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;charter&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UnsubscribedFromCharter&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;charter&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Updates compliance status for a rule (called by the owner)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; rule&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The dynamic byte array representing the rule&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; status&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The compliance status (true if compliant, false if not)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; updateCompliance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; rule&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; status&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ruleExists&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;rule&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        complianceStatus&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;rule&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; status&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ComplianceChecked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; rule&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Checks if the robot has agreed to follow a specific rule and if it is compliant&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; rule&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The rule to check.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns true if the robot has agreed to the rule and is compliant&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checkCompliance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; rule&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;robotRules&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;rule&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RuleNotAgreed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;rule&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Gets the compliance status of a rule&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; rule&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The rule to check.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getRule&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; rule&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; robotRules&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;rule&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Gets the subscription status of a charter&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; charter&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the charter to check.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getSubscribedCharters&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; charter&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; subscribedCharters&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;charter&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Gets the compliance status of a rule&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; rule&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The rule to check.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getComplianceStatus&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; rule&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; complianceStatus&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;rule&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0.8.20&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; { &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;OwnableUpgradeable&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts-upgradeable&#x2F;access&#x2F;OwnableUpgradeable.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; { &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;SystemConfig&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;SystemConfig.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Interfaces&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; { &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IUniversalCharter&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;interface&#x2F;IUniversalCharter.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; { &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IUniversalIdentity&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;interface&#x2F;IUniversalIdentity.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; UniversalCharter&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The UniversalCharter contract is used to manage the registration and compliance of users.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UniversalCharter&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IUniversalCharter&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;OwnableUpgradeable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Struct to store information about a registered user&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UserInfo&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span&gt; isRegistered&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        UserType userType&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; ruleSetVersion&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Rule set version the user is following&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Mapping to store registered users&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; UserInfo&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; users&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Mapping to store rule sets by version number&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; ruleSets&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Mapping to track the rule set hash and its corresponding version&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; ruleSetVersions&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Version identifier for the current implementation of the contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; VERSION &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;v0.0.1&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Variable to track the current version of the rule set&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; currentVersion&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Variable to store the address of the SystemConfig contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    SystemConfig &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;public&lt;&#x2F;span&gt;&lt;span&gt; systemConfig&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Error for when a method cannot be called when paused. This could be renamed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; to `Paused` in the future, but it collides with the `Paused` event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CallPaused&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Reverts when paused.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    modifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; whenNotPaused&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;paused&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CallPaused&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        _&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Constucts the UniversalCharter contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        initialize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt; _owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xdEaD&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _systemConfig&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xdEaD&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Initializer function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; initialize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _systemConfig&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; initializer&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        __Ownable_init&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        transferOwnership&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        systemConfig &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SystemConfig&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_systemConfig&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Registers a user (either human or robot) by agreeing to a rule set&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; userType&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The type of user: Human or Robot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ruleSet&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The array of individual rules the user agrees to follow&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; registerUser&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;UserType&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; userType&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ruleSet&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; whenNotPaused&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;users&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;isRegistered&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;User already registered&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Hash the rule set to find the corresponding version&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; ruleSetHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ruleSet&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; version &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; ruleSetVersions&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;ruleSetHash&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;version &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Invalid or unregistered rule set&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; For robots, ensure compliance with each rule via the UniversalIdentity contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;userType &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; UserType&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;Robot&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_checkRobotCompliance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; version&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Robot not compliant with rule set&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Register the user with the versioned rule set&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        users&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UserInfo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt; isRegistered&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; userType&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; userType&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; ruleSetVersion&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; version &lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UserRegistered&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; userType&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; ruleSet&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Allows a user (human or robot) to leave the system after passing compliance checks&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; leaveSystem&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; whenNotPaused&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;users&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;isRegistered&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;User not registered&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        UserInfo &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;memory&lt;&#x2F;span&gt;&lt;span&gt; userInfo &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; users&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; For robots, verify compliance with all rules in the rule set&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; version &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; userInfo&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;ruleSetVersion&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;userInfo&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;userType &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; UserType&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;Robot&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_checkRobotCompliance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; version&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Robot not compliant with rule set&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        users&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UserInfo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt; isRegistered&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; userType&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; UserType&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;Human&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; ruleSetVersion&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UserLeft&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Internal function to verify robot hardware identity&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; robotAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the robot to verify&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns true if hardware verification succeeds&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _verifyRobotHardware&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; robotAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        IUniversalIdentity robot &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IUniversalIdentity&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;robotAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get hardware identity to ensure it exists&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        robot&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getHardwareIdentity&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Generate a new challenge&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; challenge &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; robot&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;generateChallenge&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Store the challenge for future reference&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        users&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;robotAddress&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;lastVerifiedChallenge &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; challenge&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get signature from the robot (this would typically happen off-chain)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; For this implementation, we&amp;#39;ll assume the signature is provided in a separate tx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; and just verify the challenge exists&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; challenge &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Checks if a user complies with their registered rule set&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; user&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the user (human or robot)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ruleSet&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The array of individual rules to verify&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns true if the user complies with the given rule set&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checkCompliance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ruleSet&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;users&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;user&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;isRegistered&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;User not registered&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Hash the provided rule set to find the corresponding version&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; ruleSetHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ruleSet&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; version &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; ruleSetVersions&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;ruleSetHash&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;version &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Invalid or unregistered rule set&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;users&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;user&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;ruleSetVersion &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; version&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Rule set version mismatch&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; For robots, check compliance with each rule in the UniversalIdentity contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;users&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;user&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;userType &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; UserType&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;Robot&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _checkRobotCompliance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; version&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If the user is human, compliance is assumed for now (can be extended)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Internal function to check compliance for robots with their rule set version&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function will revert if the robot is not compliant with any rule. Returns true for view purposes.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; robotAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the robot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; version&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The version of the rule set to verify compliance with&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns true if the robot is compliant with all the rules in the rule set&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _checkRobotCompliance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; robotAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; version&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        IUniversalIdentity robot &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IUniversalIdentity&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;robotAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; rules &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; ruleSets&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;version&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; rules&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;robot&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;checkCompliance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;rules&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Updates or defines a new rule set version.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; newRuleSet&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The array of new individual rules.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function SHOULD be restricted to authorized users (e.g., contract owner).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; updateRuleSet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newRuleSet&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; whenNotPaused&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;newRuleSet&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Cannot update to an empty rule set&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Hash the new rule set and ensure it&amp;#39;s not already registered&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; ruleSetHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;newRuleSet&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ruleSetVersions&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;ruleSetHash&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Rule set already registered&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Increment the version and store the new rule set&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        currentVersion &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ruleSets&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;currentVersion&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; newRuleSet&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ruleSetVersions&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;ruleSetHash&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; currentVersion&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RuleSetUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;newRuleSet&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Getter for the latest version of the rule set.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getLatestRuleSetVersion&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; currentVersion&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the rule set for a specific version.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; version&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The version of the rule set to retrieve.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getRuleSet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; version&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; ruleSets&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;version&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the version number for a specific rule set.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ruleSet&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The hash of the rule set to retrieve the version for.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getRuleSetVersion&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ruleSet&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; ruleSetVersions&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;ruleSet&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getUserInfo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;UserInfo&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; users&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;user&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Getter for the current paused status.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; paused_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Whether or not the contract is paused.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; paused&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; paused_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        paused_ &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; systemConfig&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;paused&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Compliance Updater: The compliance updater role in the &lt;code&gt;UniversalIdentity&lt;&#x2F;code&gt; contract is critical for updating compliance statuses (currently limited to the owner). It is essential to ensure secure ownership to minimize the risks of unauthorized or malicious updates.&lt;&#x2F;p&gt;
&lt;p&gt;Rule Management: Functions such as addRule, removeRule, and updateCompliance in the &lt;code&gt;UniversalIdentity&lt;&#x2F;code&gt; contract and updateRuleSet in the &lt;code&gt;UniversalCharter&lt;&#x2F;code&gt; contract directly affect rule enforcement. It’s essential to ensure these functions are only callable by authorized users.&lt;&#x2F;p&gt;
&lt;p&gt;Upgradeable Contracts: The use of OwnableUpgradeable introduces risks during the initialization and upgrade process. Ensuring that the initialize function is protected against re-execution is critical to avoid reinitialization attacks.&lt;&#x2F;p&gt;
&lt;p&gt;Gas Consumption: Excessively large rule sets could lead to high gas costs or DoS risks. Consider setting limits on the number of rules allowed per rule set to maintain gas efficiency and avoid performance issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Onchain registration of chain identifiers</title>
        <published>2024-09-26T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Marco Stronati</name><uri>https://github.com/paracetamolo</uri>
	</author>
	
	<author>
		<name>Jeff Lau</name><uri>https://github.com/jefflau</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7785/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/on-chain-registration-of-chain-identifiers/21299" />
        

        <id>https://wg-eips.ritovision.com/7785/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:7785"
            label="ERC-7785" />
        

        
        

        
        <summary type="html">Derive chain identifiers by hashing their chain name and use ENS to map chain names to these identifiers</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7785/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC proposes to derive chain identifiers as a digest of their chain name (and other information) and to use ENS to map chain names to identifiers in place of the centralized list on GitHub.
A solution to support existing chain identifiers that were not derived following this ERC is also proposed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The mapping between chain names and identifiers, such as &lt;code&gt;Mainnet -&amp;gt; 0x1&lt;&#x2F;code&gt;, is currently maintained in a centralized list.
However this solution has two main shortcomings:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;It does not scale with the growing number of L2s.&lt;&#x2F;li&gt;
&lt;li&gt;The list maintainers are a single point of failure.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Desired properties:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;the ability to register new chain names and identifiers in a censorship-resistant way&lt;&#x2F;li&gt;
&lt;li&gt;the ability to resolve chain names and identifiers in a trustless way&lt;&#x2F;li&gt;
&lt;li&gt;maintain a unique mapping between names and identifiers&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;chain-identifier-spoofing-and-replay-attacks&quot;&gt;Chain Identifier Spoofing and Replay Attacks&lt;&#x2F;h3&gt;
&lt;p&gt;An important property of the centralized list is that it keeps a one-to-one correspondence between names and identifiers.&lt;&#x2F;p&gt;
&lt;p&gt;Without this property, an attacker could register a fresh name pointing to an existing identifier. For example &lt;code&gt;my-testnet&lt;&#x2F;code&gt; could point to mainnet &lt;code&gt;0x1&lt;&#x2F;code&gt;. A user could be tricked into signing a transaction for the innocent looking &lt;code&gt;my-testnet&lt;&#x2F;code&gt; while actually signing a transaction for mainnet, a transaction that the attacker can then replay.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;extending-chain-identifiers&quot;&gt;Extending chain identifiers&lt;&#x2F;h3&gt;
&lt;p&gt;Current chain identifiers are usually chosen arbitrarily to be short. While these identifiers are convenient on a small scale, as their number increases it is more desirable to draw them from a larger space.&lt;&#x2F;p&gt;
&lt;p&gt;We propose to extend the size of identifiers to 32 bytes and to derive them using a cryptographic hash function.
The input to the function MUST contain the chain name and MAY contain additional information.&lt;&#x2F;p&gt;
&lt;p&gt;An example for a L2:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;chain_id = Keccak-256(CHAIN_NAME, SETTLEMENT_CHAIN_ID, VERSION, DEPLOYER_CONTRACT_ADDRESS, SALT)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;SETTLEMENT_CHAIN_ID&lt;&#x2F;code&gt; is the id of the L1 where the L2 settles, it could be Mainnet or a testnet.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;VERSION&lt;&#x2F;code&gt; is to separate the domain of the hash function with an arbitrary string&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;DEPLOYER_CONTRACT_ADDRESS&lt;&#x2F;code&gt; is the address of the L2 on the L1&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;chain-name-resolution&quot;&gt;Chain name resolution&lt;&#x2F;h3&gt;
&lt;p&gt;Any ENS name can resolve to a chain identifier as specified in &lt;!-- TODO: Is 2304 a sufficient replacement for ENSIP-11? --&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2304&#x2F;&quot;&gt;ERC-2304&lt;&#x2F;a&gt;. The name should resolve to a record containing not only the chain identifier, but also all the optional information necessary to verify the identifier.&lt;&#x2F;p&gt;
&lt;p&gt;For example the chain name &lt;code&gt;rollup&lt;&#x2F;code&gt; can be converted to a chain identifier on Mainnet by resolving:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;rollup.eth -&amp;gt; {version : uint, bridge : address, chain_id : chain_id}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;and then verified using:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;chain_id == hash(&amp;quot;rollup&amp;quot;, 0x1, version, bridge)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;!--
  The rationale fleshes out the specification by describing what motivated the design and why particular design decisions were made. It should describe alternate designs that were considered and related work, e.g. how the feature is supported in other languages.

  The current placeholder is acceptable for a draft.

  TODO: Remove this comment before submitting
--&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Existing identifiers, that were not derived using the scheme above, can be supported using a reverse mapping from chain identifiers to chain names, so that one can check for uniqueness.&lt;&#x2F;p&gt;
&lt;p&gt;For example the chain name &lt;code&gt;legacy-rollup.eth&lt;&#x2F;code&gt; can be resolved to the chain identifier &lt;code&gt;0x123&lt;&#x2F;code&gt;.
Then &lt;code&gt;0x123&lt;&#x2F;code&gt; can be resolved in the &lt;code&gt;chainid.reverse&lt;&#x2F;code&gt; domain to a &lt;code&gt;chain_name&lt;&#x2F;code&gt;.
If &lt;code&gt;chain_name == legacy-rollup&lt;&#x2F;code&gt; then the mapping is valid.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;bootstrapping-and-handover&quot;&gt;Bootstrapping and handover&lt;&#x2F;h3&gt;
&lt;p&gt;In order to bootstrap the handling of legacy chain identifiers, we imagine the EF populating the &lt;code&gt;chainid.reverse&lt;&#x2F;code&gt; domain, a temporary &lt;code&gt;l2.eth&lt;&#x2F;code&gt; for names and then handing them over.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;EF populates two subdomains &lt;code&gt;l2.eth&lt;&#x2F;code&gt; and &lt;code&gt;chainid.reverse&lt;&#x2F;code&gt; using Ethereum lists.&lt;&#x2F;li&gt;
&lt;li&gt;A rollup registers a &lt;code&gt;rollup.eth&lt;&#x2F;code&gt; and points it to their `chain_id.&lt;&#x2F;li&gt;
&lt;li&gt;EF hands over to the rollup &lt;code&gt;rollup.l2.eth&lt;&#x2F;code&gt; and &lt;code&gt;chain_id.chainid.reverse&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;The rollup updates &lt;code&gt;chain_id.chainid.reverse&lt;&#x2F;code&gt; to return &lt;code&gt;rollup.eth&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Domain spoofing can lead to replay attacks as described above and can be eliminated by deriving new identifiers using a hash function and by checking the reverse mapping for legacy identifiers.&lt;&#x2F;p&gt;
&lt;p&gt;Domain squatting, the practice of ammassing a large number of domains in the hope to selling them later to legitimate users, is a possibility but with an increasing number of L2 registrations we can expect the same problem to appear in the centralized Github list.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Cache invalidation in ERC-5219 mode Web3 URL</title>
        <published>2024-09-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Nicolas Deschildre</name><uri>https://github.com/nand2</uri>
	</author>
	
	<author>
		<name>Sam Wilson</name><uri>https://github.com/SamWilsn</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7774/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7774-cache-invalidation-in-erc-5219-mode-web3-url/21255" />
        

        <id>https://wg-eips.ritovision.com/7774/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7774"
            label="ERC-7774" />
        

        
        

        
        <summary type="html">Introduce a new HTTP cache control method using EVM events for invalidation</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7774/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;In the context of the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6860&#x2F;&quot;&gt;ERC-6860&lt;&#x2F;a&gt; &lt;code&gt;web3:&#x2F;&#x2F;&lt;&#x2F;code&gt; standard, this ERC extends the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6944&#x2F;&quot;&gt;ERC-6944&lt;&#x2F;a&gt; resolve mode. It introduces mechanisms to address limitations that prevent the use of standard &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc9111&quot;&gt;RFC 9111&lt;&#x2F;a&gt; HTTP caching.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Calls to Ethereum RPC providers are costly—both CPU-wise for local nodes and monetarily for paid external RPC providers. Furthermore, external RPC providers are rate-limited, which can quickly cause disruptions when loading &lt;code&gt;web3:&#x2F;&#x2F;&lt;&#x2F;code&gt; URLs.&lt;&#x2F;p&gt;
&lt;p&gt;Therefore, it makes sense to implement caching mechanisms to reduce RPC calls when possible. Since &lt;code&gt;web3:&#x2F;&#x2F;&lt;&#x2F;code&gt; aims to be as close to HTTP as possible, leveraging standard &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc9111&quot;&gt;RFC 9111&lt;&#x2F;a&gt; HTTP caching is the natural choice. In the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6944&#x2F;&quot;&gt;ERC-6944&lt;&#x2F;a&gt; resolve mode, smart contracts can already return standard HTTP caching headers like &lt;code&gt;Cache-Control&lt;&#x2F;code&gt; and &lt;code&gt;ETag&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;However, due to the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6944&#x2F;&quot;&gt;ERC-6944&lt;&#x2F;a&gt; resolve mode not forwarding request HTTP headers to the smart contract, smart contracts cannot handle &lt;code&gt;If-None-Match&lt;&#x2F;code&gt; and &lt;code&gt;If-Modified-Since&lt;&#x2F;code&gt; cache validation headers. Consequently, they are limited to using the &lt;code&gt;Cache-control: max-age=XX&lt;&#x2F;code&gt; mechanism, which causes each cache validation request to trigger an RPC call, regenerating the full response.&lt;&#x2F;p&gt;
&lt;p&gt;This ERC proposes a solution to bypass this limitation by allowing websites to broadcast cache invalidations via smart contract events.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, even if smart contracts could read request HTTP headers, using smart contract events is more efficient, as it moves cache invalidation logic outside the contract.&lt;&#x2F;p&gt;
&lt;p&gt;We add this feature to the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6944&#x2F;&quot;&gt;ERC-6944&lt;&#x2F;a&gt; resolve mode because it can be added without changes to the interface. Future resolve modes that allow for request HTTP headers may also implement this ERC.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;This standard introduces the &lt;code&gt;evm-events&lt;&#x2F;code&gt; cache directive for the &lt;code&gt;Cache-Control&lt;&#x2F;code&gt; header of request responses, as an extension directive as defined in section 5.2.3 of &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc9111&quot;&gt;RFC 9111&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;When an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6944&#x2F;&quot;&gt;ERC-6944&lt;&#x2F;a&gt; resolve mode website wants to use event-based caching for a request, it MUST:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Include the &lt;code&gt;evm-events&lt;&#x2F;code&gt; directive in the &lt;code&gt;Cache-Control&lt;&#x2F;code&gt; header of the response.&lt;&#x2F;li&gt;
&lt;li&gt;Include the &lt;code&gt;ETag&lt;&#x2F;code&gt; and&#x2F;or &lt;code&gt;Cache-Control&lt;&#x2F;code&gt; headers in the response, as per traditional &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc9111&quot;&gt;RFC 9111&lt;&#x2F;a&gt; HTTP caching.&lt;&#x2F;li&gt;
&lt;li&gt;Emit a cache invalidation event (as defined below) for the path in the smart contract when the output of the response changes and it deems cache clearing necessary.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;A value to the &lt;code&gt;evm-events&lt;&#x2F;code&gt; cache directive is optional, and can be used to specify to listen for additional events on other smart contracts, and&#x2F;or for other paths. The cache directive value syntax in ABNF notation is :&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cache-directive-value = [ address-path-absolute *( &amp;quot; &amp;quot; address-path-absolute ) ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;address-path-absolute = [ address ] path-absolute [ &amp;quot;?&amp;quot; query ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;address               = &amp;quot;0x&amp;quot; 20( HEXDIG HEXDIG )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;path-absolute         = &amp;lt;path-absolute, see RFC 3986, Section 3.3&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;query                 = &amp;lt;query, see RFC 3986, Section 3.4&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Examples&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Cache-control: evm-events&lt;&#x2F;code&gt; : The cache of the page returning this directive will be cleared when the contract having responded to the request emits a cache clearing event for the path of the page having been served.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Cache-control: evm-events=&quot;&#x2F;path&#x2F;path2&quot;&lt;&#x2F;code&gt; : Same behavior than the first example, but additionally the cache of the page returning this directive will be cleared when the contract having responded to the request emits a cache clearing event for path &lt;code&gt;&#x2F;path&#x2F;path2&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Cache-control: evm-events=&quot;0xe4ba0e245436b737468c206ab5c8f4950597ab7f&#x2F;path&#x2F;path2&quot;&lt;&#x2F;code&gt; : Same behavior than the first example, but additionally the cache of the page returning this directive will be cleared when the contract &lt;code&gt;0xe4ba0e245436b737468c206ab5c8f4950597ab7f&lt;&#x2F;code&gt; emits a cache clearing event for path &lt;code&gt;&#x2F;path&#x2F;path2&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Cache-control: evm-events=&quot;0xe4ba0e245436b737468c206ab5c8f4950597ab7f&quot;&lt;&#x2F;code&gt; : Same behavior than the first example, but additionally the cache of the page returning this directive will be cleared when the contract &lt;code&gt;0xe4ba0e245436b737468c206ab5c8f4950597ab7f&lt;&#x2F;code&gt; emits a cache clearing event for the path of the page having been served.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Cache-control: evm-events=&quot;&#x2F;path&#x2F;path2 &#x2F;path&#x2F;path3&quot;&lt;&#x2F;code&gt; : Same behavior than the first example, but additionally the cache of the page returning this directive will be cleared when the contract having responded to the request emits a cache clearing event for path &lt;code&gt;&#x2F;path&#x2F;path2&lt;&#x2F;code&gt; or &lt;code&gt;&#x2F;path&#x2F;path3&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;cache-invalidation-event&quot;&gt;Cache invalidation event&lt;&#x2F;h3&gt;
&lt;p&gt;The event is defined as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;event ClearPathCache(string[] paths);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This event clears the cache for an array of &lt;code&gt;paths&lt;&#x2F;code&gt;. Each &lt;code&gt;path&lt;&#x2F;code&gt; refers to the &lt;code&gt;pathQuery&lt;&#x2F;code&gt; part of the ABNF definition in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6860&#x2F;&quot;&gt;ERC-6860&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A &lt;code&gt;path&lt;&#x2F;code&gt; MUST NOT end with a &lt;code&gt;&#x2F;&lt;&#x2F;code&gt;, except when the whole path is the root path, which is &lt;code&gt;&#x2F;&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Two &lt;code&gt;paths&lt;&#x2F;code&gt; are considered identical if they have the same &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5219&#x2F;&quot;&gt;ERC-5219&lt;&#x2F;a&gt; resource entries and their parameter values match, regardless of the order.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Example&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;&#x2F;test?a=1&amp;amp;b=2&lt;&#x2F;code&gt; and &lt;code&gt;&#x2F;test?b=2&amp;amp;a=1&lt;&#x2F;code&gt; are considered identical.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;wildcard-usage&quot;&gt;Wildcard usage&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;paths&lt;&#x2F;code&gt; may contain &lt;code&gt;*&lt;&#x2F;code&gt; wildcards, with the following rules:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Wildcards in Resource Entries&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;A wildcard (&lt;code&gt;*&lt;&#x2F;code&gt;) can be used on its own in an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5219&#x2F;&quot;&gt;ERC-5219&lt;&#x2F;a&gt; resource entry.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;A wildcard CANNOT be combined with other characters in the same entry; if it is, the &lt;code&gt;path&lt;&#x2F;code&gt; will be ignored.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;A wildcard requires at least one character to match.
&lt;strong&gt;Examples&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;&#x2F;*&lt;&#x2F;code&gt; will match &lt;code&gt;&#x2F;test&lt;&#x2F;code&gt; but not &lt;code&gt;&#x2F;test&#x2F;abc&lt;&#x2F;code&gt; and not &lt;code&gt;&#x2F;&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;&#x2F;test&#x2F;*&lt;&#x2F;code&gt; will match &lt;code&gt;&#x2F;test&#x2F;abc&lt;&#x2F;code&gt; but will not match &lt;code&gt;&#x2F;test&#x2F;&lt;&#x2F;code&gt; or &lt;code&gt;&#x2F;test&#x2F;abc&#x2F;def&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;&#x2F;*&#x2F;abc&lt;&#x2F;code&gt; will match &lt;code&gt;&#x2F;test&#x2F;abc&lt;&#x2F;code&gt;, but not &lt;code&gt;&#x2F;&#x2F;abc&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;&#x2F;t*t&lt;&#x2F;code&gt; is invalid, so the &lt;code&gt;path&lt;&#x2F;code&gt; will be ignored.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Wildcards in Parameter Values&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;A wildcard can be used alone as a parameter value.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;A wildcard CANNOT be combined with other characters in the parameter value, or the &lt;code&gt;path&lt;&#x2F;code&gt; will be ignored.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;A wildcard in parameter values requires at least one character to match.
&lt;strong&gt;Examples&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;&#x2F;abc?a=*&lt;&#x2F;code&gt; will match &lt;code&gt;&#x2F;abc?a=zz&lt;&#x2F;code&gt; but not &lt;code&gt;&#x2F;abc?a=&lt;&#x2F;code&gt; or &lt;code&gt;&#x2F;abc?a=zz&amp;amp;b=cc&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;&#x2F;abc?a=*&amp;amp;b=*&lt;&#x2F;code&gt; will match &lt;code&gt;&#x2F;abc?a=1&amp;amp;b=2&lt;&#x2F;code&gt; and &lt;code&gt;&#x2F;abc?b=2&amp;amp;a=1&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;&#x2F;abc?a=z*&lt;&#x2F;code&gt; is invalid, so the &lt;code&gt;path&lt;&#x2F;code&gt; will be ignored.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Special Case: Global Wildcard&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A &lt;code&gt;path&lt;&#x2F;code&gt; containing only a &lt;code&gt;*&lt;&#x2F;code&gt; will match every path within the smart contract.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Wildcards are intentionally limited to these simple cases to facilitate efficient path lookup implementations.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;caching-behavior&quot;&gt;Caching behavior&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;cache-invalidation-states-for-web3-clients&quot;&gt;Cache Invalidation States for &lt;code&gt;web3:&#x2F;&#x2F;&lt;&#x2F;code&gt; Clients&lt;&#x2F;h4&gt;
&lt;p&gt;A &lt;code&gt;web3:&#x2F;&#x2F;&lt;&#x2F;code&gt; client can be in one of two cache invalidation states for each chain and smart contract:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Listening for Events&lt;&#x2F;strong&gt;:&lt;br &#x2F;&gt;
The &lt;code&gt;web3:&#x2F;&#x2F;&lt;&#x2F;code&gt; client MUST listen for the cache invalidation events defined earlier and should aim to stay as close to real-time as possible.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Not Listening for Events&lt;&#x2F;strong&gt;:&lt;br &#x2F;&gt;
This is the default state when this ERC is not implemented. In this state, the &lt;code&gt;web3:&#x2F;&#x2F;&lt;&#x2F;code&gt; client ignores all HTTP caching validation requests (e.g., &lt;code&gt;If-None-Match&lt;&#x2F;code&gt;, &lt;code&gt;If-Modified-Since&lt;&#x2F;code&gt; request headers).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The &lt;code&gt;web3:&#x2F;&#x2F;&lt;&#x2F;code&gt; client can switch between these states at any time and MAY implement heuristics to optimize the use of RPC providers by switching states as appropriate.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;cache-key-value-mapping&quot;&gt;Cache Key-Value Mapping&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;web3:&#x2F;&#x2F;&lt;&#x2F;code&gt; client maintains a key-value mapping for caching, which MUST be cleared whenever it transitions from &quot;Listening for Events&quot; to &quot;Not Listening for Events.&quot; The mapping is structured as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mapping(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  (&amp;lt;chain id&amp;gt;, &amp;lt;contract address&amp;gt;, &amp;lt;ERC-6860 pathQuery&amp;gt;) &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  =&amp;gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  (&amp;lt;last modified date&amp;gt;, &amp;lt;ETag&amp;gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Additional elements can be included in the mapping key when necessary. For example, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7618&#x2F;&quot;&gt;ERC-7618&lt;&#x2F;a&gt; requires the inclusion of the &lt;code&gt;Accept-Encoding&lt;&#x2F;code&gt; request header in the mapping key.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;handling-requests-in-listening-for-events-state&quot;&gt;Handling Requests in &quot;Listening for Events&quot; State&lt;&#x2F;h4&gt;
&lt;p&gt;When a request is received in the &quot;Listening for Events&quot; state:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;If no mapping entry exists&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;web3:&#x2F;&#x2F;&lt;&#x2F;code&gt; client queries the smart contract.&lt;&#x2F;li&gt;
&lt;li&gt;If the response includes the &lt;code&gt;evm-events&lt;&#x2F;code&gt; directive in the &lt;code&gt;Cache-Control&lt;&#x2F;code&gt; header and an &lt;code&gt;ETag&lt;&#x2F;code&gt;, a mapping entry is created using the &lt;code&gt;ETag&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If the response contains the &lt;code&gt;evm-events&lt;&#x2F;code&gt; directive and a &lt;code&gt;max-age=XX&lt;&#x2F;code&gt; directive in the &lt;code&gt;Cache-Control&lt;&#x2F;code&gt; header, the mapping entry is created with the &lt;code&gt;last modified date&lt;&#x2F;code&gt;, determined in the following order of priority:
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;Last-Modified&lt;&#x2F;code&gt; header, if present.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;Date&lt;&#x2F;code&gt; header, if present.&lt;&#x2F;li&gt;
&lt;li&gt;Otherwise, the block date when the smart contract was queried.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;If the response includes both an &lt;code&gt;ETag&lt;&#x2F;code&gt; and a &lt;code&gt;Cache-Control: evm-events max-age=XX&lt;&#x2F;code&gt; directive, a single mapping entry is created containing both the &lt;code&gt;ETag&lt;&#x2F;code&gt; and the &lt;code&gt;last modified date&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;If a mapping entry exists&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;If the request contains a valid &lt;code&gt;If-None-Match&lt;&#x2F;code&gt; header:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If the &lt;code&gt;ETag&lt;&#x2F;code&gt; in the mapping matches the &lt;code&gt;If-None-Match&lt;&#x2F;code&gt; value, the &lt;code&gt;web3:&#x2F;&#x2F;&lt;&#x2F;code&gt; client returns a &lt;code&gt;304 Not Modified&lt;&#x2F;code&gt; response immediately.&lt;&#x2F;li&gt;
&lt;li&gt;If the &lt;code&gt;ETag&lt;&#x2F;code&gt; does not match, the client queries the smart contract, deletes the mapping entry, and processes the request as if no mapping entry existed.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;If the request contains a valid &lt;code&gt;If-Modified-Since&lt;&#x2F;code&gt; header:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If the &lt;code&gt;last modified date&lt;&#x2F;code&gt; in the mapping is earlier than the &lt;code&gt;If-Modified-Since&lt;&#x2F;code&gt; date, the client returns a &lt;code&gt;304 Not Modified&lt;&#x2F;code&gt; response immediately.&lt;&#x2F;li&gt;
&lt;li&gt;Otherwise, the client queries the smart contract, deletes the mapping entry, and processes the request as if no mapping entry existed.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;If the request contains neither &lt;code&gt;If-None-Match&lt;&#x2F;code&gt; nor &lt;code&gt;If-Modified-Since&lt;&#x2F;code&gt; headers (or they are invalid):&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The client queries the smart contract, deletes the mapping entry, and processes the request as if no mapping entry existed.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h4 id=&quot;cache-invalidation-via-blockchain-events&quot;&gt;Cache Invalidation via Blockchain Events&lt;&#x2F;h4&gt;
&lt;p&gt;In the &quot;Listening for Events&quot; state, the &lt;code&gt;web3:&#x2F;&#x2F;&lt;&#x2F;code&gt; client listens to the blockchain for the cache invalidation events defined in the previous section. For each path match, it deletes the corresponding mapping entry.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;To stay as close as possible to standard HTTP, we reuse the HTTP caching mechanism headers.&lt;&#x2F;p&gt;
&lt;p&gt;The use of the &lt;code&gt;evm-events&lt;&#x2F;code&gt; directive is necessary to avoid a situation where a website uses traditional &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc9111&quot;&gt;RFC 9111&lt;&#x2F;a&gt; HTTP caching headers, but the contract does not implement this ERC  by failing to emit the events. In such cases, &lt;code&gt;web3:&#x2F;&#x2F;&lt;&#x2F;code&gt; clients implementing this ERC would serve stale content for that website indefinitely.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Stale content will be served during the delay between a user transaction emitting a cache clearing event, and the &lt;code&gt;web3:&#x2F;&#x2F;&lt;&#x2F;code&gt; client picking and processing the event.&lt;&#x2F;p&gt;
&lt;p&gt;For each cached page, websites must properly implement cache invalidation events; otherwise, stale content will be served indefinitely.&lt;&#x2F;p&gt;
&lt;p&gt;In the event of a chain reorganization, the &lt;code&gt;web3:&#x2F;&#x2F;&lt;&#x2F;code&gt; client must roll back its caching state, or reverted content will be served until the next cache clearing event.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Transparent Financial Statements</title>
        <published>2024-09-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Ignacio Ceaglio</name><uri>https://github.com/Nachoxt17</uri><email>ignacioceaglio@gmail.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7776/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-xxxx-transparent-financial-statements/21191" />
        

        <id>https://wg-eips.ritovision.com/7776/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7776"
            label="ERC-7776" />
        

        
        

        
        <summary type="html">Open Transparent Financial Data such as Revenue, Costs of Goods Sold, Operating Expenses, EBITDA and Earnings Per Share for all Investors.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7776/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal defines a standard API that enables EVM Blockchain-based companies (or also called &quot;protocols&quot;) to publish their financial information, specifically Income Statements and Balance Sheets, on-
chain in a transparent and accessible manner through solidity smart contracts. This standard aims to emulate the reporting structure used by publicly traded companies in traditional stocks markets, like
the SEC 10-Q filings. The financial statements include key information, namely as Revenue, Cost of Goods Sold, Operating Expenses, Operating Income, Earnings before Interest, Taxes, Depreciation, and
Amortization (EBITDA) and
Earnings Per Share-Token (EPS), allowing investors to assess the financial health of blockchain-based companies in a standardized, transparent, clear and reliable format.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The motivation of this ERC is to bring seriousness to the cryptocurrencies investments market. Currently, the situation is as follows:&lt;&#x2F;p&gt;
&lt;p&gt;The current state of token investment analysis is opaque, with most information presented in an abstract and non-quantitative form. This standard API ensures a consistent and reliable way for investors to
evaluate blockchain projects based on real financial data published directly on-chain, not just speculative promises. This will establish a greater
trust in the cryptocurrency markets and align token analysis with the standards of traditional equity markets.&lt;&#x2F;p&gt;
&lt;p&gt;Most &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; Tokens representing EVM Blockchain-based companies (or also called &quot;protocols&quot;), DO NOT work the same way as a publicly traded stock that represents a share of ownership of the
equity of that such company (so the user who buys a protocol&#x27;s ERC-20, is also now a share-holder and co-owner of the business, its profits and&#x2F;or its dividends), but rather function as &quot;commodities&quot; such
as oil; they are consumable items created by said EVM Blockchain-based company (or &quot;protocol&quot;) to be spent in their platform. They are publicly traded and advertised to be representing the underlying
protocol like a share, working in practice the same way as a commodity and without any public, transparent and &lt;em&gt;Clear&lt;&#x2F;em&gt; Financial Information as publicly traded stocks have.&lt;&#x2F;p&gt;
&lt;p&gt;Added to that, most token research analysis reports that can be currently found on the internet are informal Substack or Twitter posts, with lots of abstract explanations about the features of the said
protocol to invest in, that lack of transparent financial numbers and factual financial information, that are made by anonymous users without real exposed reputations to affect.&lt;&#x2F;p&gt;
&lt;p&gt;This ERC will improve that by giving users and investors transparent, clear and factual financial information to work with when analyzing as a potential investment the such
EVM Blockchain-based company that implements this ERC in their solidity smart contracts, and that will generate trust, transparency and seriousness in the cryptocurrencies investments market long term.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in
RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;All Transparent Financial Statements Standard implementations MUST implement ERC-20 to represent shares, and the financial numbers such as Revenue, Costs of Goods Sold, Operating Expenses, Operating
Income, EBITDA, Other Income and Expenses, Net Income and Earnings Per Share MUST be displayed in the value of the protocol&#x27;s stablecoin of choice.&lt;&#x2F;p&gt;
&lt;p&gt;All Transparent Financial Statements MUST implement ERC-20&#x27;s optional metadata extensions.
The &lt;code&gt;name&lt;&#x2F;code&gt; and &lt;code&gt;symbol&lt;&#x2F;code&gt; functions SHOULD reflect the underlying token&#x27;s &lt;code&gt;name&lt;&#x2F;code&gt; and &lt;code&gt;symbol&lt;&#x2F;code&gt; in some way.&lt;&#x2F;p&gt;
&lt;p&gt;All methods MUST be of visibility &lt;code&gt;external&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;All methods MUST return their financial numbers valued in the provided &lt;code&gt;stablecoin&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;If the contract owner uses data or methods from other owned smart contracts external to their smart contract implementation of this standard, those smart contracts MUST be verified in the correspondent
blockchain explorer and of open and visible source code.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Timestamp Constraint&lt;&#x2F;em&gt;: For all methods, &lt;code&gt;startTimestamp&lt;&#x2F;code&gt; MUST be less than or equal to &lt;code&gt;endTimestamp&lt;&#x2F;code&gt;. If &lt;code&gt;startTimestamp&lt;&#x2F;code&gt; is equal to &lt;code&gt;endTimestamp&lt;&#x2F;code&gt;, the method returns a balance sheet snapshot. If
&lt;code&gt;startTimestamp&lt;&#x2F;code&gt; is less than &lt;code&gt;endTimestamp&lt;&#x2F;code&gt;, the method returns an income statement for that period.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Output Structs&lt;&#x2F;em&gt;: Instead of a single &lt;code&gt;uint256&lt;&#x2F;code&gt; value, each method returns a &lt;code&gt;struct&lt;&#x2F;code&gt; with one or &lt;em&gt;OPTIONAL&lt;&#x2F;em&gt; more &lt;code&gt;uint256&lt;&#x2F;code&gt; entries to allow for detailed financial data, each one with their own customized
entry &lt;code&gt;name&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Currency: The individual stablecoin used to value the publicly displayed financial numbers.&lt;&#x2F;li&gt;
&lt;li&gt;Revenue: Total earnings from selling products or services before expenses.&lt;&#x2F;li&gt;
&lt;li&gt;Cost of Goods Sold (COGS): Direct costs for producing goods&#x2F;services, including labor and materials.&lt;&#x2F;li&gt;
&lt;li&gt;Operating Expenses: Expenses like Selling, General, and Administrative, Research and Development, and other operational costs.&lt;&#x2F;li&gt;
&lt;li&gt;Operating Income: Revenue minus operating expenses.&lt;&#x2F;li&gt;
&lt;li&gt;EBITDA: Earnings Before Interest, Taxes, Depreciation, and Amortization.&lt;&#x2F;li&gt;
&lt;li&gt;Other Income and Expenses: Non-operating income, such as interest, investment gains or losses.&lt;&#x2F;li&gt;
&lt;li&gt;Net Income: Profit after all expenses, taxes, and deductions.&lt;&#x2F;li&gt;
&lt;li&gt;EPS: Earnings per Share Token (ERC-20), showing profit allocated per share.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;methods&quot;&gt;Methods&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;stablecoinaddress&quot;&gt;&lt;code&gt;stablecoinAddress&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Returns the &lt;code&gt;address&lt;&#x2F;code&gt; of the individual stablecoin used to value the publicly displayed financial numbers.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;tablecoinAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  v&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;isibility&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;xternal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;urrencyAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;revenue&quot;&gt;&lt;code&gt;revenue&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Returns total revenue generated by the protocol within a time period.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;evenue&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  v&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;isibility&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;xternal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;tartTimestamp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ndTimestamp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; R&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;evenueStruct&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;truct&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      f&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ields&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; g&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;rossRevenue&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;          t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; o&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ptionalAdditionalRevenueDetail1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;          t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; o&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ptionalAdditionalRevenueDetailN&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;          t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;cogs&quot;&gt;&lt;code&gt;cogs&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Returns the cost of goods sold within a specified period.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ogs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  v&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;isibility&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;xternal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;tartTimestamp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ndTimestamp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; C&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;OGSStruct&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;truct&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      f&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ields&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;otalCOGS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;          t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; o&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ptionalAdditionalCOGSDetail1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;          t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; o&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ptionalAdditionalCOGSDetailN&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;          t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;operatingexpenses&quot;&gt;&lt;code&gt;operatingExpenses&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Returns the total operating expenses within a specified period.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; o&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;peratingExpenses&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  v&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;isibility&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;xternal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;tartTimestamp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ndTimestamp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; O&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;peratingExpensesStruct&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;truct&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      f&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ields&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;otalOperatingExpenses&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;          t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; o&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ptionalAdditionalExpenseDetail1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;          t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; o&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ptionalAdditionalExpenseDetailN&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;          t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;operatingincome&quot;&gt;&lt;code&gt;operatingIncome&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Returns operating income for the specified period (Revenue - COGS - Operating Expenses).&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; o&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;peratingIncome&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  v&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;isibility&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;xternal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;tartTimestamp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ndTimestamp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; O&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;peratingIncomeStruct&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;truct&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      f&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ields&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;otalOperatingIncome&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;          t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; o&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ptionalAdditionalIncomeDetail1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;          t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; o&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ptionalAdditionalIncomeDetailN&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;          t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;ebitda&quot;&gt;&lt;code&gt;ebitda&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Returns EBITDA for the given period.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bitda&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  v&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;isibility&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;xternal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;tartTimestamp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ndTimestamp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; E&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;BITDAstruct&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;truct&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      f&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ields&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;otalEBITDA&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;          t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; o&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ptionalAdditionalEBITDADetail1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;          t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; o&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ptionalAdditionalEBITDADetailN&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;          t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;otherincomeexpenses&quot;&gt;&lt;code&gt;otherIncomeExpenses&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Returns non-operating income and expenses, such as interest and investment gains or losses, for the specified period.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; o&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;therIncomeExpenses&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  v&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;isibility&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;xternal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;tartTimestamp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ndTimestamp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; O&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;therIncomeExpensesStruct&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;truct&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      f&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ields&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;otalOtherIncome&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;          t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;otalOtherExpenses&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;          t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;otalOtherIncomeDetail1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;          t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;otalOtherExpensesDetail1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;          t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;otalOtherIncomeDetailN&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;          t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;otalOtherExpensesDetailN&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;          t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;netincome&quot;&gt;&lt;code&gt;netIncome&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Returns net income for the period (Operating Income + Other Income&#x2F;Expenses - Taxes - Depreciation).&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;etIncome&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  v&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;isibility&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;xternal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;tartTimestamp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ndTimestamp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; N&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;etIncomeStruct&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;truct&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      f&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ields&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;otalNetIncome&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;          t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; o&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ptionalAdditionalNetIncomeDetail1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;          t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; o&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ptionalAdditionalNetIncomeDetailN&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;          t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;earningspershare&quot;&gt;&lt;code&gt;earningsPerShare&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Returns Earnings Per Share Token (EPS) for the period.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;arningsPerShare&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  v&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;isibility&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;xternal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;tartTimestamp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ndTimestamp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; E&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;PSstruct&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;truct&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      f&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ields&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;asicEPS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;          t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; d&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ilutedEPS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;          t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; E&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;PSDetail1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;          t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; E&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;PSDetailN&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;          t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;fullfinancialreport&quot;&gt;&lt;code&gt;fullFinancialReport&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Returns a comprehensive struct that includes all the prior financial details of the protocol combined: Revenue, COGS, Operating Expenses, Operating Income, EBITDA, Other Incomes and Expenses, Net income,
and EPS into a unified &lt;code&gt;Struct&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ullFinancialReport&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  v&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;isibility&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;xternal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;tartTimestamp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ndTimestamp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; F&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ullFinancialsStruct&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;truct&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      f&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ields&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; R&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;evenueStruct&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;          t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;truct&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; C&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;OGSStruct&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;          t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;truct&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; O&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;peratingExpensesStruct&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;          t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;truct&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; O&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;peratingIncomeStruct&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;          t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;truct&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; E&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;BITDAstruct&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;          t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;truct&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; O&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;therIncomeExpensesStruct&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;          t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;truct&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; N&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;etIncomeStruct&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;          t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;truct&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; E&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;PSstruct&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;          t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;truct&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;ERC-20 is enforced because implementation details like Earnings Per Token calculation directly carry over to the accounting. This standardization makes the Transparent Financial Statements compatible with
all ERC-20 use cases.&lt;&#x2F;p&gt;
&lt;p&gt;This implementation enables the protocol to share their financial information both as their latest updated Balance Sheet (if the user chooses to just see a current snapshot of
the financial state of the company) and as an Income Statement (if the user chooses to see the evolution of the financial state of the company between two different block
timestamps) and also is thought to interact with other separated Smart Contracts of the same protocol from which the financial information will be sent.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Transparent Financial Statements Standard is fully backward compatible with the ERC-20 standard and has no known compatibility issues with other standards.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0.8.27&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC20&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; symbol&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransparentFinancialStatements&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; stablecoin&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RevenueStruct&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; grossRevenue&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; optionalAdditionalRevenueDetail1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; optionalAdditionalRevenueDetailN&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; COGSStruct&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; totalCOGS&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; optionalAdditionalCOGSDetail1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; optionalAdditionalCOGSDetailN&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OperatingExpensesStruct&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; totalOperatingExpenses&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; optionalAdditionalExpenseDetail1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; optionalAdditionalExpenseDetailN&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OperatingIncomeStruct&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; totalOperatingIncome&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; optionalAdditionalIncomeDetail1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; optionalAdditionalIncomeDetailN&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EBITDAstruct&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; totalEBITDA&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; optionalAdditionalEBITDADetail1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; optionalAdditionalEBITDADetailN&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OtherIncomeExpensesStruct&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; totalOtherIncome&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; totalOtherExpenses&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; totalOtherIncomeDetail1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; totalOtherExpensesDetail1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; totalOtherIncomeDetailN&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; totalOtherExpensesDetailN&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NetIncomeStruct&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; totalNetIncome&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; optionalAdditionalNetIncomeDetail1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; optionalAdditionalNetIncomeDetailN&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EPSstruct&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; basicEPS&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; dilutedEPS&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; EPSDetail1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; EPSDetailN&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FullFinancialsStruct&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        RevenueStruct revenue&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        COGSStruct cogs&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        OperatingExpensesStruct operatingExpenses&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        OperatingIncomeStruct operatingIncome&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        EBITDAstruct ebitda&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        OtherIncomeExpensesStruct otherIncomeExpenses&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        NetIncomeStruct netIncome&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        EPSstruct eps&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _stablecoin&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        stablecoin &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _stablecoin&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; currency&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; stablecoin&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revenue&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; startTimestamp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; endTimestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        public&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;RevenueStruct&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;startTimestamp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; endTimestamp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Invalid timestamps&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Logic to calculate and return revenue details&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RevenueStruct&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 500&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 100&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Example values&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; cogs&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; startTimestamp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; endTimestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        public&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;COGSStruct&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;startTimestamp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; endTimestamp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Invalid timestamps&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Logic to calculate and return COGS details&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; COGSStruct&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;400&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 150&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 50&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Example values&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; operatingExpenses&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; startTimestamp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; endTimestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        public&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;OperatingExpensesStruct&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;startTimestamp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; endTimestamp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Invalid timestamps&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Logic to calculate and return operating expenses details&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OperatingExpensesStruct&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;300&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 100&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 50&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Example values&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; operatingIncome&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; startTimestamp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; endTimestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        public&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;OperatingIncomeStruct&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;startTimestamp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; endTimestamp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Invalid timestamps&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Logic to calculate and return operating income details&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OperatingIncomeStruct&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;300&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 100&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 50&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Example values&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ebitda&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; startTimestamp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; endTimestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        public&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;EBITDAstruct&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;startTimestamp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; endTimestamp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Invalid timestamps&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Logic to calculate and return EBITDA details&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EBITDAstruct&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;700&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 200&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 100&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Example values&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; otherIncomeExpenses&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; startTimestamp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; endTimestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        public&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;OtherIncomeExpensesStruct&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;startTimestamp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; endTimestamp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Invalid timestamps&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Logic to calculate and return other income&#x2F;expenses details&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OtherIncomeExpensesStruct&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;100&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 50&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 20&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 30&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Example values&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; netIncome&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; startTimestamp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; endTimestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        public&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;NetIncomeStruct&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;startTimestamp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; endTimestamp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Invalid timestamps&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Logic to calculate and return net income details&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NetIncomeStruct&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;600&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 200&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 100&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Example values&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; earningsPerShare&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; startTimestamp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; endTimestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        public&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;EPSstruct&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;startTimestamp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; endTimestamp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Invalid timestamps&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Logic to calculate and return EPS details&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EPSstruct&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Example values&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fullFinancialReport&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; startTimestamp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; endTimestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        public&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;FullFinancialsStruct&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;startTimestamp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; endTimestamp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Invalid timestamps&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Logic to calculate and return all financial details&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FullFinancialsStruct&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            revenue&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;startTimestamp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; endTimestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            cogs&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;startTimestamp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; endTimestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            operatingExpenses&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;startTimestamp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; endTimestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            operatingIncome&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;startTimestamp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; endTimestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            ebitda&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;startTimestamp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; endTimestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            otherIncomeExpenses&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;startTimestamp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; endTimestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            netIncome&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;startTimestamp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; endTimestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            earningsPerShare&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;startTimestamp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; endTimestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC involves displaying critical financial data on-chain, so special attention must be paid to ensure the accuracy and security of the data, particularly in preventing tampering or manipulation of key
financial figures.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Fractional Reserve Token</title>
        <published>2024-09-17T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Yaron Velner</name><uri>https://github.com/yaronvel</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7770/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7770-fractional-reserve-token/21103" />
        

        <id>https://wg-eips.ritovision.com/7770/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7770"
            label="ERC-7770" />
        

        
        

        
        <summary type="html">An interface for tokens that maintain a peg to an underlying token while being only partially redeemable to this token.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7770/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;We propose a new token standard for synthetic assets that are only partially redeemable to their underlying asset, but fully backed by other collateral assets.&lt;&#x2F;p&gt;
&lt;p&gt;The standard defines an interface to mint fractional reserve assets, and a standard to reflect economic risk related data to the token holders and lenders.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The Cambrian explosion of new L1s and L2s gave rise to bridged assets which are synthetic by nature. Indeed, ETH on Arbitrum L2, or WETH on Binance Smart Chain are not fully fungible with their mainnet counterpart. However, these assets are fully backed by their mainnet counterpart and guaranteed to be redeemable to their mainnet underlying asset, albeit with certain time delay.&lt;&#x2F;p&gt;
&lt;p&gt;Fractional reserve tokens can allow an ecosystem (chains, L2s, and other networks of economic activity) to increase its supply by allowing users to mint the asset not only by bridging it to the ecosystem, but also by borrowing it (typically against a collateral).&lt;&#x2F;p&gt;
&lt;p&gt;As an example, consider a fractional reserve token, namely, frDAI, that represents a synthetic DAI.
Such token will allow users to mint 1 frDAI upon deposit of 1 DAI, or by providing a collateral that worth more than 1 DAI.
Quick redemption of frDAI to DAI is available as long as there is still some DAI balance in the frDAI token, and otherwise, the price of frDAI may temporarily fluctuate until borrowers repay their debt.&lt;&#x2F;p&gt;
&lt;p&gt;Fractional reserve tokens may delegate minting capabilities for multiple risk curators and lending markets. Hence, a uniform standard for fractional reserve minting is needed.
Fractional reserve banking does not come without risks, such as insolvency or a bank run.
This standard does not aim to dictate economic risk management practices, but rather to have a standard on how to reflect the risk to token holders.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.
The standard has the following requirements:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;MUST&lt;&#x2F;strong&gt; be &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; compatible.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;interface&quot;&gt;Interface&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;interface IERCXXX is IERC20 {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; events&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    event MintFractionalReserve(address indexed minter, address to, uint256 amount);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    event BurnFractionalReserve(address indexed burner, address from, uint256 amount);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    event SetSegregatedAccount(address account, bool segregated);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; functions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; setters&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function fractionalReserveMint(address _to, uint256 _amount) external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function fractionalReserveBurn(address _from, uint256 _amount) external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   &#x2F;&#x2F; getters&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function totalBorrowedSupply() external view returns (uint256);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function requiredReserveRatio() external view returns (uint256);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function segregatedAccount(address _account) external view returns (bool);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function totalSegregatedSupply() external view returns (uint256);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;reserve-ratio&quot;&gt;Reserve ratio&lt;&#x2F;h3&gt;
&lt;p&gt;The reserve ratio reflects the ratio between the token that is available as cash, i.e., available for an immediate redemption (or alternatively, a token that was not minted via a fractional reserve minting), and the total supply of the token. Segregated accounts &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be subtracted from the cash balance.&lt;&#x2F;p&gt;
&lt;p&gt;Formally, the reserve ratio is denoted by $$\frac{totalSupply() - totalBorrowedSupply() - \sum_{a \in \text{Segregated Accounts}} \text{balanceOf}(a)}{totalSupply()}$$.
Additional fractional reserve minting &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; occur when the reserve ratio, multiplied by &lt;code&gt;1e18&lt;&#x2F;code&gt; is lower than &lt;code&gt;requiredReserveRatio()&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;mint-and-burn-functionality&quot;&gt;Mint and burn functionality&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;fractionalReserveMint&lt;&#x2F;code&gt; and &lt;code&gt;fractionalReserveBurn&lt;&#x2F;code&gt; functions &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; be called by permissioned addresses, e.g., risk curators or lending markets. These entities &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; mint new tokens only to addresses that already locked collateral in a dedicated contract.&lt;&#x2F;p&gt;
&lt;p&gt;The reserve ratio is denoted by $$\frac{totalSupply() - \sum_{a \in \text{Segregated Accounts}} \text{balanceOf}(a)}{totalSupply() + totalBorrowedSupply()}$$.
&lt;code&gt;fractionalReserveMint&lt;&#x2F;code&gt; &lt;strong&gt;MUST&lt;&#x2F;strong&gt; revert if the reserve ratio, multiplied by &lt;code&gt;e18&lt;&#x2F;code&gt; exceeds &lt;code&gt;requiredReserveRatio()&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;A successful call to &lt;code&gt;fractionalReserveMint(_to, _amount)&lt;&#x2F;code&gt; &lt;strong&gt;MUST&lt;&#x2F;strong&gt; increase the value of &lt;code&gt;totalSupply()&lt;&#x2F;code&gt;, &lt;code&gt;totalBorrowedSupply()&lt;&#x2F;code&gt;, and the token balance of address &lt;code&gt;_to&lt;&#x2F;code&gt;, by &lt;code&gt;_amount&lt;&#x2F;code&gt; units.
A call to &lt;code&gt;fractionalReserveMint&lt;&#x2F;code&gt; &lt;strong&gt;MUST&lt;&#x2F;strong&gt; emit a &lt;code&gt;MintFractionalReserve&lt;&#x2F;code&gt; event.
A call to &lt;code&gt;fractionalReserveMint&lt;&#x2F;code&gt; &lt;strong&gt;MUST&lt;&#x2F;strong&gt; revert if after the mint the reserve ratio, multiplied by &lt;code&gt;1e18&lt;&#x2F;code&gt; exceeds the value of &lt;code&gt;requiredReserveRatio()&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Similarly, a successful call to &lt;code&gt;fractionalReserveBurn(_from, _amount)&lt;&#x2F;code&gt; &lt;strong&gt;MUST&lt;&#x2F;strong&gt; decrease the value of &lt;code&gt;totalSupply()&lt;&#x2F;code&gt;,&lt;code&gt;totalBorrowedSupply()&lt;&#x2F;code&gt;, and the token balance of address &lt;code&gt;_from&lt;&#x2F;code&gt; by &lt;code&gt;_amount&lt;&#x2F;code&gt; units.
A call to &lt;code&gt;fractionalReserveBurn&lt;&#x2F;code&gt; &lt;strong&gt;MUST&lt;&#x2F;strong&gt; emit a &lt;code&gt;BurnFractionalReserve&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;segregated-accounts&quot;&gt;Segregated accounts&lt;&#x2F;h3&gt;
&lt;p&gt;At every point in time, it &lt;strong&gt;MUST&lt;&#x2F;strong&gt; hold that the sum of token balances for segregated addresses equals to &lt;code&gt;totalSegregatedSupply()&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;account-balance&quot;&gt;Account balance&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;fractionalReserveMint&lt;&#x2F;code&gt; &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; be used in conjunction with a lending operation, where the minted token is borrowed. The lending operation &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; come with an interest rate, and some of the interest rate proceedings &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; be distributed to token holders that are not in segregated accounts.
This standard does not dictate how distribution should occur.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The standard aims to standardise how multiple lending markets and risk providers can interact with a fractional reserve token. The actual lending operation should be done carefully by trusted entities, and it is the token owner&#x27;s responsibility to make sure the parties who have fractional reserve minting credentials are reliable.&lt;&#x2F;p&gt;
&lt;p&gt;At the core of the coordination relies the need to understand how much additional supply is available for borrow, and at what interest rate. The additional borrowable supply is deduced from the required reserve ratio, and the total, borrowable and segregated supply.
Lower reserve ratio gives rise to higher capital efficiency, however it increases the &lt;strong&gt;likelihood&lt;&#x2F;strong&gt; of depeg or a run on the bank, where token holders cannot immediately redeem their synthetic token.
Having the reserve ratio as part of the standard allows risk curators to better price the risk, and, e.g., set the interest rate to be monotonically increasing with the current reserve ratio.&lt;&#x2F;p&gt;
&lt;p&gt;The standard does not dictate how the accrued interest rate is distributed. One possible distribution is by making the token a rebased token. An alternative way is to introduce staking, or just airdropping of proceeds.&lt;&#x2F;p&gt;
&lt;p&gt;While a fractional reserve is most useful when it is backed by a known asset, e.g., frDAI and DAI, it can also be used in isolation. In such a case, a token will have a fixed initial supply, however additional supply can be borrowed. In such cases the supply temporarily increases, but the net holdings (&lt;code&gt;totalSupply() - totalBorrowedSupply()&lt;&#x2F;code&gt;) remains unchanged.&lt;&#x2F;p&gt;
&lt;p&gt;Increasing the total supply could be a concern if a token is used for DAO votes and&#x2F;or if dividends are distributed to token holders.
In order to mitigate such concerns, segregated accounts are introduced, with the premise that money in these accounts is not counted towards the reserve, and therefore, additional token supply cannot be minted against them.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Fractional reserve tokens should be backwards compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; The code below is provided only for illustration, DO NOT use it in production&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;contract FractionalReserveToken is ERC20, Ownable {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    event MintFractionalReserve(address indexed minter, address to, uint256 amount);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    event BurnFractionalReserve(address indexed burner, address from, uint256 amount);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    event SetSegregatedAccount(address account, bool segregated);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @notice token supply in these accounts is not counted towards the reserve, and&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; therefore, additional token supply cannot be minted against them.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    mapping(address =&amp;gt; bool) public segregatedAccount;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @notice ratio between the token that is available as cash (immediate redemption)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; and the total supply of the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    uint256 public requiredReserveRatio;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    uint256 public totalBorrowedSupply;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    constructor(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        string memory _name,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        string memory _symbol&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ) ERC20(_name, _symbol) Ownable(msg.sender) {}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function fractionalReserveMint(address to, uint256 amount) external onlyOwner {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _mint(to, amount);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        totalBorrowedSupply += amount;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        emit MintFractionalReserve(msg.sender, to, amount);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 reserveRatio = (totalSupply() - totalBorrowedSupply - segregatedSupply) * 1e18 &#x2F; totalSupply();&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        require(reserveRatio &amp;gt;= requiredReserveRatio, &amp;quot;reserveRatio&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function fractionalReserveBurn(address from, uint256 amount) external onlyOwner {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _burn(from, amount);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        totalBorrowedSupply -= amount;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        emit BurnFractionalReserve(msg.sender, from, amount);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; ------------------------------------------------------------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; Code below is not part of the standard&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; ------------------------------------------------------------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    uint256 internal segregatedSupply; &#x2F;&#x2F; supply of segregated tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function _update(address from, address to, uint256 value) internal override {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &#x2F;&#x2F; keep the reserve up to date on transfers&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        if (!segregatedAccount[from] &amp;amp;&amp;amp; segregatedAccount[to]) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            segregatedSupply += value;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        if (segregatedAccount[from] &amp;amp;&amp;amp; !segregatedAccount[to]) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            segregatedSupply -= value;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ERC20._update(from, to, value);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function mint(address account, uint256 value) external onlyOwner {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _mint(account, value);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function burn(address account, uint256 value) external onlyOwner {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _burn(account, value);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function setSegregatedAccount(address account, bool segregated) external onlyOwner {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        if (segregated) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            require(!segregatedAccount[account], &amp;quot;segregated&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            segregatedSupply += balanceOf(account);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        } else {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            require(segregatedAccount[account], &amp;quot;!segregated&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            segregatedSupply -= balanceOf(account);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        segregatedAccount[account] = segregated;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        emit SetSegregatedAccount(account, segregated);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function setRequiredReserveRatio(uint256 value) external onlyOwner {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        requiredReserveRatio = value;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Fractional reserve banking comes with many economic risks. This standard does not aim to provide guidelines on how to properly mitigate them.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EXTCODETYPE instruction</title>
        <published>2024-09-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Andrei Maiboroda</name><uri>https://github.com/gumb0</uri>
	</author>
	
	<author>
		<name>Piotr Dobaczewski</name><uri>https://github.com/pdobacz</uri>
	</author>
	
	<author>
		<name>Danno Ferrin</name><uri>https://github.com/shemnon</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7761/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7761-is-contract-instruction/20936" />
        

        <id>https://wg-eips.ritovision.com/7761/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:7761"
            label="EIP-7761" />
        

        
        

        
        <summary type="html">Add EXTCODETYPE instruction to EOF to address common uses of EXTCODE* instructions</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7761/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Allow EOF contracts to discriminate between EOAs (Externally Owned Accounts) and contract accounts by introducing an &lt;code&gt;EXTCODETYPE&lt;&#x2F;code&gt; instruction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;EOFv1 as scoped in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7692&#x2F;&quot;&gt;EIP-7692&lt;&#x2F;a&gt; removes code introspection capabilities from the EVM, including the &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; instruction (in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3540&#x2F;&quot;&gt;EIP-3540&lt;&#x2F;a&gt;). This makes it hard for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; standard contracts to be implemented, as they rely on discovering whether a token&#x27;s &lt;code&gt;safeTransfer&lt;&#x2F;code&gt; call target was an EOA or a contract account:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;safeTransfers&lt;&#x2F;code&gt; to EOAs succeed&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;safeTransfers&lt;&#x2F;code&gt; to contract accounts call an &lt;code&gt;onERC721Received&lt;&#x2F;code&gt; (&lt;code&gt;onERC1155Received&lt;&#x2F;code&gt;) on them and expect to get a special magic return value, otherwise the transfer reverts (on the assumption that such a recipient may not be able to interact with the token)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Application and library developers are also concerned about dynamic proxies written in EOF accidentally pointing to legacy accounts which cannot safely be called with &lt;code&gt;EXTDELEGATECALL&lt;&#x2F;code&gt;. They would like a way to differentiate between EOF and legacy contracts.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;EXTCODETYPE&lt;&#x2F;code&gt; is aimed to fill this gap and bring back the possibility to easily implement ERC-721 and ERC-1155 standard contracts in EOF as well as preserve EOF proxy contract safety.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FORK_BLKNUM&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;tbd&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;GAS_COLD_ACCOUNT_ACCESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Defined as &lt;code&gt;2600&lt;&#x2F;code&gt; in the [Ethereum Execution Layer Spec Constants]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;GAS_WARM_ACCESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Defined as &lt;code&gt;100&lt;&#x2F;code&gt; in the [Ethereum Execution Layer Spec Constants]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TYPE_NONE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TYPE_LEGACY_CONTRACT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TYPE_EOF_CONTRACT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;We introduce a new EOFv1 instruction on the block number &lt;code&gt;FORK_BLKNUM&lt;&#x2F;code&gt;: &lt;code&gt;EXTCODETYPE&lt;&#x2F;code&gt; (&lt;code&gt;0xe9&lt;&#x2F;code&gt;)&lt;&#x2F;p&gt;
&lt;p&gt;EOF code which contains this instruction before &lt;code&gt;FORK_BLKNUM&lt;&#x2F;code&gt; is considered invalid. Beginning with block &lt;code&gt;FORK_BLKNUM&lt;&#x2F;code&gt; &lt;code&gt;0xe9&lt;&#x2F;code&gt; is added to the set of valid EOFv1 instructions.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;execution-semantics&quot;&gt;Execution Semantics&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;extcodetype&quot;&gt;&lt;code&gt;EXTCODETYPE&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;deduct &lt;code&gt;GAS_WARM_ACCESS&lt;&#x2F;code&gt; gas&lt;&#x2F;li&gt;
&lt;li&gt;pop 1 argument &lt;code&gt;target_address&lt;&#x2F;code&gt; from the stack&lt;&#x2F;li&gt;
&lt;li&gt;if &lt;code&gt;target_address&lt;&#x2F;code&gt; has any of the high 12 bytes set to a non-zero value (i.e. it does not contain a 20-byte address), then halt with an exceptional failure
&lt;ul&gt;
&lt;li&gt;Notice: Future expansion of the EVM address space may remove or reduce the number of bytes in this check.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;deduct &lt;code&gt;GAS_COLD_ACCOUNT_ACCESS - GAS_WARM_ACCESS&lt;&#x2F;code&gt; if &lt;code&gt;target_address&lt;&#x2F;code&gt; is not in &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt; and add &lt;code&gt;target_address&lt;&#x2F;code&gt; to &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Load the code from &lt;code&gt;target_address&lt;&#x2F;code&gt; and refer to it as &lt;code&gt;loaded_code&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;if &lt;code&gt;loaded_code&lt;&#x2F;code&gt; is empty (does not exist or has zero length), push &lt;code&gt;TYPE_NONE&lt;&#x2F;code&gt; onto the stack and stop processing the operation&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;loaded_code&lt;&#x2F;code&gt; indicates a delegation designator (for example, &lt;code&gt;0xef0100&lt;&#x2F;code&gt; as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt;),
&lt;ul&gt;
&lt;li&gt;replace &lt;code&gt;loaded_code&lt;&#x2F;code&gt; with the delegated code.&lt;&#x2F;li&gt;
&lt;li&gt;deduct gas in accordance with the delegation designation rules&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;loaded_code&lt;&#x2F;code&gt; indicates an EOFv1 packaged contract (starts with the bytes &lt;code&gt;0xef0001&lt;&#x2F;code&gt;) push &lt;code&gt;TYPE_EOF_CONTRACT&lt;&#x2F;code&gt; onto the stack and stop processing the operation&lt;&#x2F;li&gt;
&lt;li&gt;Otherwise, push &lt;code&gt;TYPE_LEGACY_CONTRACT&lt;&#x2F;code&gt; onto the stack and stop processing the operation&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note: if there is not enough gas to deduct for delegation designation the whole message frame will halt, making updating the &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt; irrelevant.&lt;&#x2F;p&gt;
&lt;p&gt;Note: If &lt;code&gt;target_address&lt;&#x2F;code&gt; or the delegation designator points to an account with a contract mid-creation then the code is empty and returns &lt;code&gt;0&lt;&#x2F;code&gt; (&lt;code&gt;TYPE_NONE&lt;&#x2F;code&gt;). This is aligned with similar behavior of instructions like &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;alternative-solutions&quot;&gt;Alternative solutions&lt;&#x2F;h3&gt;
&lt;p&gt;There have been other solutions proposed to alleviate the problems related to lack of code introspection required for ERC-721 and ERC-1155 standards:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Extra status code for &lt;code&gt;EXT*CALL&lt;&#x2F;code&gt; instruction - allowing to discriminate a result coming from calling an EOA&lt;&#x2F;li&gt;
&lt;li&gt;Extra argument for &lt;code&gt;EXT*CALL&lt;&#x2F;code&gt; (a &quot;fail if EOA&quot; flag)&lt;&#x2F;li&gt;
&lt;li&gt;Two return values from &lt;code&gt;EXT*CALL&lt;&#x2F;code&gt; (status code + whether it was EOA)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;EXT*CALL&lt;&#x2F;code&gt; setting a new &lt;code&gt;callstatus&lt;&#x2F;code&gt; register (+ a new &lt;code&gt;CALLSTATUS&lt;&#x2F;code&gt; instruction)&lt;&#x2F;li&gt;
&lt;li&gt;Re-enable &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; in EOF, keeping its behavior same as in legacy&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;code&gt;EXTCODETYPE&lt;&#x2F;code&gt; has been chosen as the most elegant and minimal solution satisfying the requirements at hand and still able to be introduced in EOFv1.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;reuse-the-0x3b-extcodesize-opcode-for-extcodetype&quot;&gt;Reuse the &lt;code&gt;0x3b&lt;&#x2F;code&gt; (&lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt;) opcode for &lt;code&gt;EXTCODETYPE&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;A new opcode is preferred by a general policy to not reuse opcodes. Also &lt;code&gt;EXTCODETYPE&lt;&#x2F;code&gt; can be rolled out in legacy EVM if desired.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;keep-code-introspection-banned&quot;&gt;Keep code introspection banned&lt;&#x2F;h3&gt;
&lt;p&gt;Removing code introspection is one of the tenets of EOF and &lt;code&gt;EXTCODETYPE&lt;&#x2F;code&gt; would be an exception from the principle. Without &lt;code&gt;EXTCODETYPE&lt;&#x2F;code&gt;, ERC-721 and ERC-1155 standard implementations have to resort to either:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Leveraging a &quot;booster contract&quot; which would be legacy and would call &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; for them. This has been deemed inelegant and inconvenient from the point of view of library implementers, requiring them to hard code an address of such a contract (with the usual address-related problems arising on different EVM chains)&lt;&#x2F;li&gt;
&lt;li&gt;Continuing to use legacy EVM themselves. This is suboptimal, since EVM compilers are likely to at some point deprecate legacy EVM as compilation target&lt;&#x2F;li&gt;
&lt;li&gt;Updating the standards to not rely on code introspection patterns in &lt;code&gt;safeTransfer&lt;&#x2F;code&gt; safeguards. This can be accomplished for example by leveraging &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt;, leaving out only contracts which do not implement ERC-165, and at the same time have non-throwing fallback functions, as indistinguishable from EOAs. This is not easy to achieve since ERC-721 and ERC-1155 are Final and adopted in practice.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;endgame-account-abstraction-issues&quot;&gt;&quot;Endgame Account Abstraction&quot; issues&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;EXTCODETYPE&lt;&#x2F;code&gt; (and earlier &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; available in legacy EVM) are claimed to slow down AA adoption, because they encourage patterns which discriminate between smart contract and EOA accounts, e.g. not allowing the former to interact. However, there are counterarguments that it is up to other factors which slow down AA adoption (assumption that accounts can produce ECDSA signatures, and the lack of adoption of smart contract signatures).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;including-safeguarding-against-proxy-bricking&quot;&gt;Including safeguarding against proxy bricking&lt;&#x2F;h3&gt;
&lt;p&gt;In parallel to the ERC-721 &#x2F; ERC-1155 problem, another potential risk has been brought to attention. Since EOFv1 prohibits &lt;code&gt;EXTDELEGATECALL&lt;&#x2F;code&gt; targeting legacy contracts, there exists a scenario where an EOF proxy contract accidentally upgrades its implementation to a legacy EVM one. Since reverting this or upgrading again (using current proxy standards) requires the implementation contract to be called, it would effectively render the contract unusable.&lt;&#x2F;p&gt;
&lt;p&gt;For this reason it was decided to have a generalized &lt;code&gt;EXTCODETYPE&lt;&#x2F;code&gt; instruction instead of a &lt;code&gt;HASCODE&lt;&#x2F;code&gt; instruction. This provides the means to safeguard against such a scenario that a simpler instruction could not.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;relation-to-eip-7702-set-eoa-account-code&quot;&gt;Relation to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; &quot;Set EOA account code&quot;&lt;&#x2F;h3&gt;
&lt;p&gt;After &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; is activated, the discrimination between EOAs and contract accounts using &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; (or &lt;code&gt;EXTCODETYPE&lt;&#x2F;code&gt;) has an edge case: Whenever an EOA sets its code to a contract account which does not respond as expected to an &lt;code&gt;onERC721Received&lt;&#x2F;code&gt; (&lt;code&gt;onERC1155Received&lt;&#x2F;code&gt;) callback, transfers to it will revert, despite the recipient being able to interact with the token. This has been deemed unlikely to be a problem, as for the intended real-world uses of EIP-7702, those callbacks will be implemented by designator codes.&lt;&#x2F;p&gt;
&lt;p&gt;Because of the requirement that EOF proxy contracts be able to determine if the new target is safe we cannot return a value for indicating that the account itself is delegated without also providing the delegated address. Instead, we return  the code for the account that has the delegated code, applying the delegation. This is because the executable code is what matters for proxy updates.&lt;&#x2F;p&gt;
&lt;p&gt;This differs from &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt; and &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; behavior which do return a hash and short code indicating the proxy. The behavior of &lt;code&gt;EXTCODETYPE&lt;&#x2F;code&gt; is closer to a &quot;code executing operation&quot; in purpose as it is meant to describe the execution behavior of the account.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;EXTCODETYPE&lt;&#x2F;code&gt; at &lt;code&gt;0xe9&lt;&#x2F;code&gt; can be introduced in a backwards compatible manner into EOFv1 (no bump to version), because &lt;code&gt;0xe9&lt;&#x2F;code&gt; has been rejected by EOF validation before &lt;code&gt;FORK_BLKNUM&lt;&#x2F;code&gt; and there are no EOF contracts on-chain with a &lt;code&gt;0xe9&lt;&#x2F;code&gt; which would have their behavior altered.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion &lt;!-- TODO --&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;[Ethereum Execution Layer Spec Constants] :https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;execution-specs&#x2F;blob&#x2F;1adcc1bfe774798bcacc685aebc17bd9935078c3&#x2F;src&#x2F;ethereum&#x2F;cancun&#x2F;vm&#x2F;gas.py#L65-L66&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Signature Aggregation for ERC-4337</title>
        <published>2024-09-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	<author>
		<name>Yoav Weiss</name><uri>https://github.com/yoavw</uri>
	</author>
	
	<author>
		<name>Dror Tirosh</name><uri>https://github.com/drortirosh</uri>
	</author>
	
	<author>
		<name>Shahaf Nacson</name><uri>https://github.com/shahafn</uri>
	</author>
	
	<author>
		<name>Alex Forshtat</name><uri>https://github.com/forshtat</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7766/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7766-signature-aggregation-for-account-abstraction/21123" />
        

        <id>https://wg-eips.ritovision.com/7766/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7766"
            label="ERC-7766" />
        

        
        

        
        <summary type="html">An ERC-4337 improvement to aggregation of all UserOperation signatures in a bundle</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7766/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt; defined a way to achieve Account Abstraction on Ethereum using an alternative &lt;code&gt;UserOperation&lt;&#x2F;code&gt; mempool.&lt;&#x2F;p&gt;
&lt;p&gt;However, one big limitation remains:
each transaction must carry its own &lt;code&gt;signature&lt;&#x2F;code&gt; or other form of validation input in order to be included.&lt;&#x2F;p&gt;
&lt;p&gt;We propose an extension to the ERC-4337 that introduces a new entity, aggregator, that is called during validation, to validate multiple user operations at once.&lt;&#x2F;p&gt;
&lt;p&gt;This addition will enable &lt;code&gt;UserOperations&lt;&#x2F;code&gt; to support sharing validation inputs, saving gas and guaranteeing atomicity of the bundle.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Using validation schemes that allow signature aggregation enables significant optimisations and savings on
gas for execution and transaction data cost. This is especially relevant in the context of rollups that publish data on
the Ethereum mainnet.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;aggregator-a-new-erc-4337-useroperation-entity-contract&quot;&gt;Aggregator - a new ERC-4337 &lt;code&gt;UserOperation&lt;&#x2F;code&gt; entity contract&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Aggregator&lt;&#x2F;strong&gt; - a helper contract trusted by accounts to validate an aggregated signature.
Bundlers&#x2F;Clients whitelist the supported aggregators.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;using-signature-aggregator&quot;&gt;Using Signature Aggregator&lt;&#x2F;h3&gt;
&lt;p&gt;A signature aggregator exposes the following interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IAggregator&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validateUserOpSignature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;PackedUserOperation&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; userOp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sigForUserOp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; aggregateSignatures&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;PackedUserOperation&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; userOps&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; aggregatesSignature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validateSignatures&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;PackedUserOperation&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; userOps&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;An account signifies it uses signature aggregation by returning its address from &lt;code&gt;validateUserOp&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;During &lt;code&gt;simulateValidation&lt;&#x2F;code&gt;, this aggregator is returned to the bundler as part of the &lt;code&gt;aggregatorInfo&lt;&#x2F;code&gt; field in the &lt;code&gt;ValidationResult&lt;&#x2F;code&gt; struct.&lt;&#x2F;li&gt;
&lt;li&gt;All aggregators MUST be staked.&lt;&#x2F;li&gt;
&lt;li&gt;The bundler should first verify the aggregator is not throttled or banned according to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7562&#x2F;&quot;&gt;ERC-7562&lt;&#x2F;a&gt; rules.&lt;&#x2F;li&gt;
&lt;li&gt;To accept the &lt;code&gt;UserOperation&lt;&#x2F;code&gt;, the bundler must call &lt;code&gt;validateUserOpSignature()&lt;&#x2F;code&gt; to validate the &lt;code&gt;UserOperation&lt;&#x2F;code&gt; signature.
This method returns an &quot;alternate signature&quot; that should be used during bundling.&lt;br &#x2F;&gt;
An &quot;alternative signature&quot; is normally an empty byte array but can also contain some data for the &lt;code&gt;acccount&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The bundler MUST call &lt;code&gt;validateUserOp&lt;&#x2F;code&gt; a second time on the account with the &lt;code&gt;UserOperation&lt;&#x2F;code&gt; using the
returned &quot;alternative signature&quot;, and make sure it returns the same value.&lt;&#x2F;li&gt;
&lt;li&gt;Implementations of an &lt;code&gt;aggregateSignatures()&lt;&#x2F;code&gt; function must aggregate all UserOp signatures into a single value.&lt;&#x2F;li&gt;
&lt;li&gt;Note that the above methods are helper methods for the bundler.
The bundler MAY use a native library to perform the same validation and aggregation logic.&lt;&#x2F;li&gt;
&lt;li&gt;Implementations of a &lt;code&gt;validateSignatures()&lt;&#x2F;code&gt; function MUST verify the aggregated signature&#x27;s validity
for all &lt;code&gt;UserOperations&lt;&#x2F;code&gt; in the array, and revert otherwise.
This method is called on-chain by &lt;code&gt;handleAggregatedOps()&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AggregatorStakeInfo&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; aggregator&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    StakeInfo stakeInfo&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;bundling-changes&quot;&gt;Bundling changes&lt;&#x2F;h3&gt;
&lt;p&gt;In addition to the steps described in ERC-4337, during bundling the bundler should:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Sort UserOps by aggregator, to create the lists of UserOps-per-aggregator.&lt;&#x2F;li&gt;
&lt;li&gt;For each aggregator, call &lt;code&gt;aggregateSignatures()&lt;&#x2F;code&gt; to create aggregated signature, and update the UserOps.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;new-entry-point-function-in-the-erc-4337-entrypoint-contract&quot;&gt;New &quot;entry point&quot; function in the ERC-4337 &lt;code&gt;EntryPoint&lt;&#x2F;code&gt; contract&lt;&#x2F;h3&gt;
&lt;p&gt;We define the following addition to the core interface of the &lt;code&gt;EntryPoint&lt;&#x2F;code&gt; contract:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; handleAggregatedOps&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    UserOpsPerAggregator&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; opsPerAggregator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; beneficiary&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UserOpsPerAggregator&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    PackedUserOperation&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; userOps&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    IAggregator aggregator&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;An account that works with aggregated signature should return its signature aggregator address
in the &lt;code&gt;authorizer&lt;&#x2F;code&gt; return value of the &lt;code&gt;validateUserOp&lt;&#x2F;code&gt; function.
It MAY ignore the signature field.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;handleAggregatedOps&lt;&#x2F;code&gt; can handle a batch that contains userOps of multiple aggregators (and also requests without any aggregator)&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;handleAggregatedOps&lt;&#x2F;code&gt; performs the same logic as &lt;code&gt;handleOps&lt;&#x2F;code&gt;, but it must transfer the correct aggregator to each
userOp, and also must call &lt;code&gt;validateSignatures&lt;&#x2F;code&gt; on each aggregator before doing all the per-account validation.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;code: -32506&lt;&#x2F;strong&gt; - transaction rejected because wallet specified unsupported signature aggregator&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;data&lt;&#x2F;code&gt; field SHOULD contain an &lt;code&gt;aggregator&lt;&#x2F;code&gt; value, as returned by the account&#x27;s validateUserOp()&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;account-returning-the-alternative-signature&quot;&gt;Account returning the &quot;alternative signature&quot;&lt;&#x2F;h3&gt;
&lt;p&gt;When using an &lt;code&gt;aggregator&lt;&#x2F;code&gt; contract, the accounts delegate their ability to authenticate &lt;code&gt;UserOperations&lt;&#x2F;code&gt;.
The entire contents of the&lt;&#x2F;p&gt;
&lt;p&gt;In order to allow the validation function of the account to perform other checks, the &lt;code&gt;validateUserOpSignature&lt;&#x2F;code&gt;
function generates a byte array that will replace the &lt;code&gt;UserOperation&lt;&#x2F;code&gt; signature when executed on-chain.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;As ERC-4337 was created with signature aggregation on the roadmap, no modifications are needed to the
deployed EntryPoint smart contracts.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal introduces new features without affecting the existing ones, and does not break backwards compatibility.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;malicious-aggregators&quot;&gt;Malicious aggregators&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;aggregator&lt;&#x2F;code&gt; contracts are among te most trusted contracts in the entire ecosystem.
They can authorize transactions on behalf of accounts, and they can invalidate large numbers of transactions with
a simple storage change.&lt;&#x2F;p&gt;
&lt;p&gt;Both account developers and block builders should be extremely careful with the selection of &lt;code&gt;aggregator&lt;&#x2F;code&gt; contracts
that they are willing to support.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Increase MIN_BASE_FEE_PER_BLOB_GAS</title>
        <published>2024-08-31T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Max Resnick</name><uri>https://github.com/MaxResnick</uri>
	</author>
	
	<author>
		<name>Davide Crapis</name><uri>https://github.com/dcrapis</uri>
	</author>
	
	<author>
		<name>Ansgar Dietrichs</name><uri>https://github.com/adietrichs</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7762/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7762-increase-min-base-fee-per-blob-gas/20949" />
        

        <id>https://wg-eips.ritovision.com/7762/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7762"
            label="EIP-7762" />
        

        
        

        
        <summary type="html">Adjust the MIN_BASE_FEE_PER_BLOB_GAS to speed up price discovery on blob space</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7762/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes an increase to the MIN_BASE_FEE_PER_BLOB_GAS to speed up price discovery on blob space. It also resets the excess blob gas to 0, to avoid a blob base fee spike.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;When scoping 4844, the thinking was that blobs would only enter price discovery once, relatively quickly after the blob rollout; however, this has not been the case. In fact, blobs have entered price discovery several times, and the frequency of price discovery events is likely to increase in the short term as we approach saturation of capacity. Moreover, the roadmap calls for further increases in blob capacity in subsequent hardforks, which may lead to price discovery events happening around those changes in the future.&lt;&#x2F;p&gt;
&lt;p&gt;Increasing the MIN_BASE_FEE_PER_BLOB_GAS will speed up price discovery on blob space.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;min-base-fee-per-blob-gas-increase&quot;&gt;&lt;code&gt;MIN_BASE_FEE_PER_BLOB_GAS&lt;&#x2F;code&gt; Increase&lt;&#x2F;h3&gt;
&lt;p&gt;The main specification change introduced by this EIP is setting MIN_BASE_FEE_PER_BLOB_GAS to 2**25:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;diff&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt; MIN_BASE_FEE_PER_BLOB_GAS  =  2**25&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt; MIN_BASE_FEE_PER_BLOB_GAS = 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;excess-blob-gas-reset&quot;&gt;&lt;code&gt;excess_blob_gas&lt;&#x2F;code&gt; Reset&lt;&#x2F;h3&gt;
&lt;p&gt;To avoid a blob base fee spike, the &lt;code&gt;calc_excess_blob_gas&lt;&#x2F;code&gt; is modified to reset &lt;code&gt;excess_blob_gas&lt;&#x2F;code&gt; to 0 at the fork. To detect the fork height, the block timestamp needs to be passed into &lt;code&gt;calc_excess_blob_gas&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calc_excess_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Header&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; block_timestamp&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; at the fork, set excess_blob_gas to 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; FORK_TIMESTAMP&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span&gt; block_timestamp&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; FORK_TIMESTAMP&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; otherwise, calculate normally&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;validate_block&lt;&#x2F;code&gt; needs to be updated to pass the block timestamp into &lt;code&gt;calc_excess_blob_gas&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validate_block&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; add timestamp parameter&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;excess_blob_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; calc_excess_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The current MIN_BASE_FEE_PER_BLOB_GAS is 1 wei. This is many orders of magnitude lower than the prevailing price of blobs when blobs enter price discovery. Whenever demand for blobs exceeds supply, blobs enter price discovery, but traversing the 8 orders of magnitude between 1 wei and the point where elasticity of demand starts to decrease takes a long time.&lt;&#x2F;p&gt;
&lt;p&gt;The blob base fee can at most double every $\log_{1.125}(10) = 5.885$ blocks when blocks use all available blob space. When blobs enter price discovery, they must climb many factors of 2 to reach the prevailing price.&lt;&#x2F;p&gt;
&lt;p&gt;To set the parameter appropriately, one approach is to look at the cost of simple transfers when base fees are low. The cost of a simple transfer when the base fee is 1 GWEI  is ~5 cents USD at today&#x27;s prices (2,445.77$ ETH&#x2F;USDC). We can try to peg the minimum price of a blob to that. Today, to reach this price, it requires an excess blob gas of &lt;code&gt;63070646&lt;&#x2F;code&gt;. When you calculate how long this would take to reach from 0 excess blob gas, you get:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;63070646&#x2F;(3 * 2**17) = 160.396947225&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The closest power of 2 to the corresponding reserve price would be &lt;code&gt;MIN_BASE_FEE_PER_BLOB_GAS = 2**27&lt;&#x2F;code&gt;. Out of an abundance of caution, we will go with &lt;code&gt;MIN_BASE_FEE_PER_BLOB_GAS = 2**25&lt;&#x2F;code&gt; to ensure that even if the price of ETH rises significantly, the reserve price will not be set too high. This value corresponds to a minimum blob price of ~1 cent at today&#x27;s prices (2,445.77$ ETH&#x2F;USDC). Further, decreasing the &lt;code&gt;MIN_BASE_FEE_PER_BLOB_GAS&lt;&#x2F;code&gt; beyond &lt;code&gt;2**25&lt;&#x2F;code&gt; would slow down price discovery without a significant decrease in the price of blobs when the network is unsaturated.&lt;&#x2F;p&gt;
&lt;p&gt;Below you will find a plot provided by @dataalways showing the fraction of type 3 transaction fees that are paid in blob base fees for different values of &lt;code&gt;MIN_BASE_FEE_PER_BLOB_GAS&lt;&#x2F;code&gt;. Note that even after the proposed change, for historical values of l1 gas, the price of blobs would have been dominated by the price of the L1 gas.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7762&#x2F;.&#x2F;assets&#x2F;base_fee_1.png&quot; alt=&quot;Base Fee 1&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7762&#x2F;.&#x2F;assets&#x2F;base_fee_225.png&quot; alt=&quot;Base Fee 2^25&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;hr &#x2F;&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is not backwards compatible and requires a coordinated upgrade across all clients at a specific block number.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Rollups that use blobs as a data availability layer will need to update their posting strategies.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Multi-Chain Addressing</title>
        <published>2024-08-30T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Sam Wilson</name><uri>https://github.com/SamWilsn</uri><email>sam@binarycake.ca</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7831/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7831-multi-chain-addressing/21942" />
        

        <id>https://wg-eips.ritovision.com/7831/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7831"
            label="ERC-7831" />
        

        
        

        
        <summary type="html">Textual representation of an address and a chain.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7831/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal introduces a chain-specific address format that allows specifying both an account and the chain on which that account intends to transact. These chain-specific addresses take the form of &lt;code&gt;(example.eth:optimism)&lt;&#x2F;code&gt;, &lt;code&gt;6A10161835a36302BfD39bDA9B44f5734442234e:ethereum:11155111&lt;&#x2F;code&gt;, and so on. The target chain is resolved using a registry stored on ENS.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The Ethereum ecosystem is becoming steadily more fragmented. This means a 20 byte address by itself is not enough information to fully specify an account. This can be problematic if funds are sent to an unreachable address on the incorrect chain.&lt;&#x2F;p&gt;
&lt;p&gt;Instead of using chain identifiers, which are not human readable, the address could be extended with a human-readable chain name, which can then be resolved to a chain identifier. The mapping from chain names to identifiers has, since &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt;, been maintained off chain using a centralized list. This solution has two main shortcomings:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;It does not scale with the growing number of L2s.&lt;&#x2F;li&gt;
&lt;li&gt;The list maintainer is a trusted centralized entity.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This ERC proposes the use of ENS to map chain names to identifiers, while still allowing maximum flexibility by changing the root chain.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-not-ens-with-erc-2304&quot;&gt;Why not ENS with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2304&#x2F;&quot;&gt;ERC-2304&lt;&#x2F;a&gt;?&lt;&#x2F;h3&gt;
&lt;p&gt;While &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2304&#x2F;&quot;&gt;ERC-2304&lt;&#x2F;a&gt; allows registrants to specify per-chain addresses, it does not provide a default chain to receive assets on (nor should it.) The choice of receiving chain depends too much on off-chain factors to require a transaction to change.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc2119&quot;&gt;RFC 2119&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc8174&quot;&gt;RFC 8174&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Grammar snippets in this proposal are given in Augmented Backus-Naur form (ABNF) as defined in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc5234&quot;&gt;RFC 5234&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc7405&quot;&gt;RFC 7405&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;p&gt;The following terms are used throughout this proposal:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;agent&lt;&#x2F;strong&gt; - software&#x2F;tool responsible for resolving a chain-specific address to its exact account and chain.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;bridge&lt;&#x2F;strong&gt; - contract that connects the root chain to the target chain (eg. to transfer tokens, proxy function calls.)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;root chain&lt;&#x2F;strong&gt; - blockchain containing bridge and name resolver contracts.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;target chain&lt;&#x2F;strong&gt; - blockchain where the identified account intends to transact; can be any chain with a bridge on the root chain.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;syntax&quot;&gt;Syntax&lt;&#x2F;h3&gt;
&lt;p&gt;At a high level, a chain-specific address is made of three components separated by colons (&lt;code&gt;:&lt;&#x2F;code&gt;) ordered from most general on the right to most specific on the left:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;a &lt;code&gt;local-part&lt;&#x2F;code&gt;, that identifies the account on the target chain;&lt;&#x2F;li&gt;
&lt;li&gt;a &lt;code&gt;chain-part&lt;&#x2F;code&gt;, that identifies the target chain; and&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;optionally&lt;&#x2F;em&gt;, a &lt;code&gt;root-part&lt;&#x2F;code&gt; that identifies the root chain.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;These components may be enclosed by parentheses (&lt;code&gt;(&lt;&#x2F;code&gt; and &lt;code&gt;)&lt;&#x2F;code&gt;) to resolve parsing ambiguities.&lt;&#x2F;p&gt;
&lt;p&gt;More formally, valid chain-specific addresses MUST adhere to the following grammar:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;ABNF&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;address         =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; OPEN&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bare-address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; CLOSE&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;                  bare-address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;bare-address    =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; local-part&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; SEP&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; chain-part&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;SEP&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; root-part&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;OPEN            =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CLOSE           =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SEP             =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;local-part&quot;&gt;Local Part&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;local-part&lt;&#x2F;code&gt; is the most specific section of a chain-specific address. It identifies the account on the target chain. It can be either a hexadecimal string (&lt;code&gt;hex-address&lt;&#x2F;code&gt;) or an ENS-like name (&lt;code&gt;ens-like&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;Valid &lt;code&gt;local-part&lt;&#x2F;code&gt; fragments MUST match the following grammar:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;ABNF&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;local-part      =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; hex-address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;                  ens-like&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;hexadecimal-address&quot;&gt;Hexadecimal Address&lt;&#x2F;h5&gt;
&lt;p&gt;When &lt;code&gt;local-part&lt;&#x2F;code&gt; is a hexadecimal string, it MUST include checksum letter casing (see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7831&#x2F;#checksum&quot;&gt;Checksum&lt;&#x2F;a&gt;), and it MAY omit leading zeros. It MUST NOT include a leading &lt;code&gt;0x&lt;&#x2F;code&gt; prefix.&lt;&#x2F;p&gt;
&lt;p&gt;Note that &lt;code&gt;local-part&lt;&#x2F;code&gt; may encode an address longer or shorter than 20 bytes (40 hexadecimal digits.) Implementations MUST support &lt;code&gt;local-part&lt;&#x2F;code&gt; lengths of 1 hexadecimal digit up to 40 digits. Implementations SHOULD support arbitrarily sized (within some reasonable limit) &lt;code&gt;local-part&lt;&#x2F;code&gt; components.&lt;&#x2F;p&gt;
&lt;p&gt;Formally, &lt;code&gt;hex-address&lt;&#x2F;code&gt; MUST match the following grammar:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;ABNF&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;hex-address     =&lt;&#x2F;span&gt;&lt;span&gt; 1*&lt;&#x2F;span&gt;&lt;span&gt;HEXDIG&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;ens-like-names&quot;&gt;ENS-Like Names&lt;&#x2F;h5&gt;
&lt;p&gt;To disambiguate an ENS name from a hexadecimal string—and unlike standard ENS names—names used in the &lt;code&gt;local-part&lt;&#x2F;code&gt; of a chain-specific address MUST contain at least one dot (&lt;code&gt;.&lt;&#x2F;code&gt;). If present, a dot placed at the rightmost position (eg. &lt;code&gt;eth.&lt;&#x2F;code&gt; or &lt;code&gt;example.eth.&lt;&#x2F;code&gt;) SHALL be removed before resolving the name. Chain-specific addresses SHOULD NOT contain a dot in the rightmost position unless no other dot is present.&lt;&#x2F;p&gt;
&lt;p&gt;The following grammar is illustrative only. See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;137&#x2F;&quot;&gt;ERC-137&lt;&#x2F;a&gt; for the definition of an ENS name.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;ABNF&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Rough approximation of ENS names, with the additional requirement that it&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; contain at least one &amp;quot;.&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ens-like        =&lt;&#x2F;span&gt;&lt;span&gt; 1*&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;NOTSEP&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; DOT&lt;&#x2F;span&gt;&lt;span&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt;1*&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;NOTSEP&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;DOT&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;NOTSEP          =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; %x01-39&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; %x3b-ff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;chain-part&quot;&gt;Chain Part&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;chain-part&lt;&#x2F;code&gt; identifies the target chain. It MUST be a valid ENS name as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;137&#x2F;&quot;&gt;ERC-137&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The following grammar is illustrative only. See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;137&#x2F;&quot;&gt;ERC-137&lt;&#x2F;a&gt; for the definition of an ENS name.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;ABNF&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;chain-part      =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ens-name&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Rough approximation of ENS names, with no additional requirements&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ens-name        =&lt;&#x2F;span&gt;&lt;span&gt; 1*&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;NOTSEP&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;root-part&quot;&gt;Root Part&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;root-part&lt;&#x2F;code&gt; identifies the root chain against which other names are resolved. When present, the &lt;code&gt;root-part&lt;&#x2F;code&gt; SHALL be the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt; &lt;code&gt;chainid&lt;&#x2F;code&gt; of the root chain in decimal format. &lt;code&gt;root-part&lt;&#x2F;code&gt; SHOULD NOT be present when &lt;code&gt;chainid == 1&lt;&#x2F;code&gt;, and MUST be present when &lt;code&gt;chainid != 1&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;ABNF&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;root-part =&lt;&#x2F;span&gt;&lt;span&gt; 1*&lt;&#x2F;span&gt;&lt;span&gt;DIGIT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;resolution&quot;&gt;Resolution&lt;&#x2F;h3&gt;
&lt;p&gt;Resolving a chain-specific address begins on the right, and moves leftward.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;root-chain&quot;&gt;Root Chain&lt;&#x2F;h4&gt;
&lt;p&gt;If &lt;code&gt;root-part&lt;&#x2F;code&gt; is not present, assume it is &lt;code&gt;1&lt;&#x2F;code&gt;. Set the root&#x27;s &lt;code&gt;chainid&lt;&#x2F;code&gt; to the value of &lt;code&gt;root-part&lt;&#x2F;code&gt;. The agent MUST be able to resolve ENS names against this chain. This likely means it has RPC access and a known ENS Resolver address, but any method of resolving addresses is sufficient.&lt;&#x2F;p&gt;
&lt;p&gt;Note that this makes &lt;code&gt;example.eth:optimism&lt;&#x2F;code&gt; distinct from &lt;code&gt;example.eth:optimism:10&lt;&#x2F;code&gt;. In the former case, both &lt;code&gt;example.eth&lt;&#x2F;code&gt; and &lt;code&gt;optimism&lt;&#x2F;code&gt; are resolved using ENS deployed on mainnet. In the second case, the two names would be resolved against an ENS deployed on the Optimism chain—an unusual situation.&lt;&#x2F;p&gt;
&lt;p&gt;The assignment of chain identifiers is defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;target-chain&quot;&gt;Target Chain&lt;&#x2F;h4&gt;
&lt;p&gt;Next, construct an ENS name for the target chain by concatenating the value of &lt;code&gt;chain-part&lt;&#x2F;code&gt; with &lt;code&gt;.tbd.eth&lt;&#x2F;code&gt; &lt;!-- TODO --&gt;(such that &lt;code&gt;example.eth:foobar&lt;&#x2F;code&gt; would have a target chain of &lt;code&gt;foobar.tbd.eth&lt;&#x2F;code&gt;&lt;!-- TODO --&gt;.) Resolve the target chain&#x27;s address (i.e. with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;137&#x2F;&quot;&gt;ERC-137&lt;&#x2F;a&gt;&#x27;s &lt;code&gt;addr&lt;&#x2F;code&gt;) against the ENS deployment on the root chain. The contract at this address is the &quot;bridge contract.&quot;&lt;&#x2F;p&gt;
&lt;p&gt;The agent has to verify that the bridge contract supports the &lt;code&gt;chain-part&lt;&#x2F;code&gt; in the address. First, the agent MUST call &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt;&#x27;s &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; on the bridge contract using &lt;code&gt;ChainMetadata&lt;&#x2F;code&gt;&#x27;s interface identifier (see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7831&#x2F;#bridge-interface&quot;&gt;Bridge Interface&lt;&#x2F;a&gt;) and the agent SHALL fail resolution if it returns false. Next, the agent MUST call the bridge contract&#x27;s &lt;code&gt;acceptsName&lt;&#x2F;code&gt; function with the same namehash (see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;137&#x2F;&quot;&gt;ERC-137&lt;&#x2F;a&gt;) used in the above call to &lt;code&gt;addr&lt;&#x2F;code&gt;. The agent SHALL fail resolution if &lt;code&gt;acceptsName&lt;&#x2F;code&gt; returns false.&lt;&#x2F;p&gt;
&lt;p&gt;A bridge contract SHALL provide functionality&#x2F;metadata enabling the agent to interact with the target chain. Further, it SHALL support the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; mechanism for interface discovery, and MAY support other methods to accomplish the same. Bridge contracts MUST implement &lt;code&gt;ChainMetadata&lt;&#x2F;code&gt; (see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7831&#x2F;#bridge-interface&quot;&gt;Bridge Interface&lt;&#x2F;a&gt;.) Further specifics of bridging are left for future proposals.&lt;&#x2F;p&gt;
&lt;!-- TODO: Should we ensure that each chain id is one-to-one mapped to a name? --&gt;
&lt;h4 id=&quot;local-address&quot;&gt;Local Address&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;hexadecimal&quot;&gt;Hexadecimal&lt;&#x2F;h5&gt;
&lt;p&gt;Verify the checksum (see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7831&#x2F;#checksum&quot;&gt;Checksum&lt;&#x2F;a&gt;.)&lt;&#x2F;p&gt;
&lt;p&gt;The local address is the hexadecimal encoding of the binary representation of the target chain&#x27;s native address. For example, for the native Ethereum address &lt;code&gt;0x6A10161835a36302BfD39bDA9B44f5734442234e&lt;&#x2F;code&gt;, the local address would be &lt;code&gt;6A10161835a36302BfD39bDA9B44f5734442234e&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;ens-like&quot;&gt;ENS-Like&lt;&#x2F;h5&gt;
&lt;p&gt;If the local address ends in a dot (&lt;code&gt;.&lt;&#x2F;code&gt;), remove it. Resolve the address using &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2304&#x2F;&quot;&gt;ERC-2304&lt;&#x2F;a&gt;&#x27;s &lt;code&gt;addr&lt;&#x2F;code&gt; against the ENS deployment on the root chain with a &lt;code&gt;coinType&lt;&#x2F;code&gt; derived from the &lt;code&gt;chainid&lt;&#x2F;code&gt; of the target chain (retrieved from the bridge contract.)&lt;&#x2F;p&gt;
&lt;h3 id=&quot;bridge-interface&quot;&gt;Bridge Interface&lt;&#x2F;h3&gt;
&lt;p&gt;Bridge contracts MUST implement the following interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ChainMetadata&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; chainId&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; coinType&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; acceptsName&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; keccak&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;When queried using &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt;&#x27;s &lt;code&gt;supportsInterface&lt;&#x2F;code&gt;, bridge contracts MUST return true for &lt;code&gt;0x00000000&lt;&#x2F;code&gt;&lt;!-- TODO --&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;checksum&quot;&gt;Checksum&lt;&#x2F;h3&gt;
&lt;!-- TODO: Get someone smarter than me to verify that this is a reasonable extension of ERC-55 --&gt;
&lt;!-- TODO: Decide if we want ERC-1191. Would we use the root chain id, the target chain id, or even crazier—use the full chain-specific address as the input to the keccak? --&gt;
&lt;p&gt;Hexadecimal strings are cased according to a slightly modified &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;55&#x2F;&quot;&gt;ERC-55&lt;&#x2F;a&gt; algorithm. The algorithm is modified by wrapping &lt;code&gt;nibble_index&lt;&#x2F;code&gt; to fit within the keccak hash.&lt;&#x2F;p&gt;
&lt;details&gt;
&lt;summary&gt;Python implementation of the modified ERC-55 algorithm&lt;&#x2F;summary&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt; Crypto&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;Hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; import&lt;&#x2F;span&gt;&lt;span&gt; keccak&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; from pycryptodome&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checksum_encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    hex_addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;hex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    checksummed_buffer&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Treat the hex address as ascii&#x2F;utf-8 for keccak256 hashing&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    k&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; keccak&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;new&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;digest_bits&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    k&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;update&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;hex_addr&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;utf-8&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    hashed_address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; k&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;hexdigest&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Iterate over each character in the hex address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; nibble_index&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; character&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; enumerate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;hex_addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; character&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0123456789&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; We can&amp;#39;t upper-case the decimal digits&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            checksummed_buffer&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; character&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        elif&lt;&#x2F;span&gt;&lt;span&gt; character&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;abcdef&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check if the corresponding hex digit (nibble) in the hash is 8 or higher&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            nibble_index_wrapped&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; nibble_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;hashed_address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            hashed_address_nibble&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;hashed_address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;nibble_index_wrapped&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 16&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; hashed_address_nibble&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 7&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                checksummed_buffer&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; character&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;upper&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                checksummed_buffer&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; character&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            raise&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; Exception&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;                f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Unrecognized hex character &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;{&lt;&#x2F;span&gt;&lt;span&gt;character&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;!r&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; at position &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;{&lt;&#x2F;span&gt;&lt;span&gt;nibble_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; checksummed_buffer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; test&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;addr_str&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; str&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    padded_addr_str&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; addr_str&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;removeprefix&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;padded_addr_str&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Pad to an even number of nibbles.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        padded_addr_str&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; padded_addr_str&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    addr_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;fromhex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;padded_addr_str&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    checksum_encoded&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; checksum_encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addr_bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; checksum_encoded&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; addr_str&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        print&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;{&lt;&#x2F;span&gt;&lt;span&gt;checksum_encoded&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; != expected &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;{&lt;&#x2F;span&gt;&lt;span&gt;addr_str&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;test&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;test&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xfB6916095ca1df60bB79Ce92cE3Ea74c37c5d359&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;test&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xdbF03B407c01E7cD3CBea99509d93f8DDDC8C6FB&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;test&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xD1220A0cf47c7B9Be7A2E6BA89F429762e7b9aDb&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;test&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x004f67dAbb603AAA58eD52641CCafF09C559704A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;test&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x4F67dABB603aAa58Ed52641cCAff09C559704A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;test&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;5aaeB6053f3e94c9B9a09f33669435E7&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ef1BEaED5AaEB6053f3e94C9B9a09F33&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;669435e7ef1bEAed5aaEb6053f3e94C9&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;b9a09f33669435E7ef1beAED5aaEB605&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;3f3e94c9b9a09F33669435e7ef1beAED&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;details&gt;
&lt;p&gt;For example, these strings are correctly cased:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;004f67dAbb603AAA58eD52641CCafF09C559704A&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;04f67dAbb603AAA58eD52641CCafF09C559704A&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;4F67dABB603aAa58Ed52641cCAff09C559704A&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;component-order&quot;&gt;Component Order&lt;&#x2F;h3&gt;
&lt;p&gt;The components are ordered from most specific to most general because... &lt;!-- TODO --&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;separator-choice&quot;&gt;Separator Choice&lt;&#x2F;h3&gt;
&lt;p&gt;The colon (&lt;code&gt;:&lt;&#x2F;code&gt;) is a reasonable choice for separator because it is not an allowed character in ENS names, it is familiar (eg. IPv6), and isn&#x27;t as overloaded as the &lt;code&gt;@&lt;&#x2F;code&gt; symbol.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;alternative&quot;&gt;Alternative: &lt;code&gt;@&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;@&lt;&#x2F;code&gt; symbol is a common choice for addresses, and finds use in email and several federated communication protocols. The English reading (foo-&lt;strong&gt;AT&lt;&#x2F;strong&gt;-example-DOT-com) is natural and implies a hierarchy between the left and the right components.&lt;&#x2F;p&gt;
&lt;p&gt;Unfortunately, because the &lt;code&gt;@&lt;&#x2F;code&gt; symbol is so widely used, including it in a chain-specific address would make all those protocol identifiers more confusing (or even invalid.) For example, &lt;code&gt;foo@foo.eth@ethereum&lt;&#x2F;code&gt; is not a valid email address.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;alternative-1&quot;&gt;Alternative: &lt;code&gt;&#x2F;&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;!-- TODO --&gt;
&lt;h3 id=&quot;target-chain-as-subdomain&quot;&gt;Target Chain as Subdomain&lt;&#x2F;h3&gt;
&lt;p&gt;While it would be technically possible to resolve &lt;code&gt;chain-part&lt;&#x2F;code&gt; against a root ENS name (eg. &lt;code&gt;ethereum.eth&lt;&#x2F;code&gt; instead of &lt;code&gt;ethereum.tbd.eth&lt;&#x2F;code&gt;&lt;!-- TODO --&gt;), using a subdomain allows the pre-registration of well-known chain names for an initial distribution of names before switching to open registration.&lt;&#x2F;p&gt;
&lt;p&gt;Without such a pre-registration, an attacker could register well-known names before the legitimate project.&lt;&#x2F;p&gt;
&lt;p&gt;After the pre-registration period, open registration is acceptable because new chains can register their names before announcing publicly.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;It is always possible to determine whether a particular string is a chain-specific address, a plain address, or a plain ENS name. Because of this property, there is little opportunity for backwards incompatibility: chain-specific addresses are not valid legacy addresses or ENS names, so tools without support will simply reject them.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;!--
  -- TODO: Test Case Ideas
  --
  -- * Longer than 20-byte hex local-part
  --&gt;
&lt;h3 id=&quot;ens-configuration&quot;&gt;ENS Configuration&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;mainnet-1&quot;&gt;Mainnet (1)&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Coin Type&lt;&#x2F;th&gt;&lt;th&gt;Record&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ethereum.tbd.eth&lt;&#x2F;code&gt;&lt;!-- TODO --&gt;&lt;&#x2F;td&gt;&lt;td&gt;-&lt;&#x2F;td&gt;&lt;td&gt;a bridge contract to mainnet (1)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;rollup1.tbd.eth&lt;&#x2F;code&gt;&lt;!-- TODO --&gt;&lt;&#x2F;td&gt;&lt;td&gt;-&lt;&#x2F;td&gt;&lt;td&gt;a bridge contract to rollup1 (1608)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;example.eth&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2147483649&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xaAaAaAaaAaAaAaaAaAAAAAAAAaaaAaAaAaaAaaAa&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;example.eth&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2147485256&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;sepolia-11155111&quot;&gt;Sepolia (11155111)&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Coin Type&lt;&#x2F;th&gt;&lt;th&gt;Record&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ethereum.tbd.eth&lt;&#x2F;code&gt;&lt;!-- TODO --&gt;&lt;&#x2F;td&gt;&lt;td&gt;-&lt;&#x2F;td&gt;&lt;td&gt;a bridge contract to sepolia (11155111)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;example.eth&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;!-- TODO --&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;!-- TODO --&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;inputs-expected-outputs&quot;&gt;Inputs &amp;amp; Expected Outputs&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;valid&quot;&gt;Valid&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Input&lt;&#x2F;th&gt;&lt;th&gt;Target Chain&lt;&#x2F;th&gt;&lt;th&gt;Local Address&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;(example.eth:ethereum)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;mainnet (1)&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xaAaAaAaaAaAaAaaAaAAAAAAAAaaaAaAaAaaAaaAa&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;example.eth:rollup1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;rollup1 (1608)&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;example.eth.:ethereum&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;mainnet (1)&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xaAaAaAaaAaAaAaaAaAAAAAAAAaaaAaAaAaaAaaAa&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0:ethereum&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;mainnet (1)&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x0000000000000000000000000000000000000000&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;invalid&quot;&gt;Invalid&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Input&lt;&#x2F;th&gt;&lt;th&gt;Failure Reason&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;(0xaAaAaAaaAaAaAaaAaAAAAAAAAaaaAaAaAaaAaaAa:ethereum)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Invalid hexadecimal&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:ethereum)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Invalid checksum&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;(AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA:ethereum)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Invalid checksum&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;(eth:ethereum)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Invalid hexadecimal&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;(:ethereum)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Missing &lt;code&gt;local-part&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;!--
  This section is optional.

  The Reference Implementation section should include a minimal implementation that assists in understanding or implementing this specification. It should not include project build files. The reference implementation is not a replacement for the Specification section, and the proposal should still be understandable without it.
  If the reference implementation is too large to reasonably be included inline, then consider adding it as one or more files in `..&#x2F;assets&#x2F;eip-####&#x2F;`. External links will not be allowed.

  TODO: Remove this comment before submitting
--&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;unicode-typosquatting-attacks&quot;&gt;Unicode &amp;amp; Typosquatting Attacks&lt;&#x2F;h3&gt;
&lt;p&gt;An attacker could register ENS names that resemble well-known chain names. For example, &lt;code&gt;etherium&lt;&#x2F;code&gt; and &lt;code&gt;ehtereum&lt;&#x2F;code&gt; are reasonably close to &lt;code&gt;ethereum&lt;&#x2F;code&gt;. While many unicode homoglyphs are caught by ENS libraries, agents should still be aware of the risk they pose.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>JSON-RPC API for ERC-4337</title>
        <published>2024-08-23T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	<author>
		<name>Yoav Weiss</name><uri>https://github.com/yoavw</uri>
	</author>
	
	<author>
		<name>Dror Tirosh</name><uri>https://github.com/drortirosh</uri>
	</author>
	
	<author>
		<name>Shahaf Nacson</name><uri>https://github.com/shahafn</uri>
	</author>
	
	<author>
		<name>Alex Forshtat</name><uri>https://github.com/forshtat</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7769/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7769-json-rpc-for-erc-4337-account-abstraction/21126" />
        

        <id>https://wg-eips.ritovision.com/7769/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:7769"
            label="ERC-7769" />
        

        
        

        
        <summary type="html">JSON-RPC API methods for communication between smart contract account wallets and ERC-4337 bundlers</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7769/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Defines new JSON-RPC API methods which enable &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt; wallets to communicate with &lt;code&gt;UserOpeation&lt;&#x2F;code&gt; mempool
nodes and bundlers, matching the functionality that exists for Ethereum transactions.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, a set of &lt;code&gt;debug&lt;&#x2F;code&gt; JSON-RPC API methods is defined in order to facilitate development, testing and
debugging issues with ERC-4337 implementations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;In ERC-4337, user transactions as defined in Ethereum are replaced with &lt;code&gt;UserOperation&lt;&#x2F;code&gt; objects, which contain all the
information needed to perform the operations requested by the users.&lt;&#x2F;p&gt;
&lt;p&gt;However, existing Ethereum JSON-RPC API methods are not suited to working with &lt;code&gt;UserOperation&lt;&#x2F;code&gt; objects.
In order to facilitate the operation of the alternative &lt;code&gt;UserOperation&lt;&#x2F;code&gt; mempool it is important that all
implementations of the ERC-4337 protocol have a standardized set of APIs that can be used interchangeably.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;bundler&lt;&#x2F;strong&gt;: a node exposing the APIs, in order to submit them to the network.
A bundler collects one or more UserOperations into a bundle and submits them together to
the &lt;code&gt;EntryPoint&lt;&#x2F;code&gt; in a single &lt;code&gt;handleOps&lt;&#x2F;code&gt; call.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;rpc-methods-eth-namespace&quot;&gt;RPC methods (eth namespace)&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;eth-senduseroperation&quot;&gt;&lt;code&gt;eth_sendUserOperation&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;eth_sendUserOperation&lt;&#x2F;code&gt; method submits a &lt;code&gt;UserOperation&lt;&#x2F;code&gt; object to the UserOperation mempool.
The client MUST validate the &lt;code&gt;UserOperation&lt;&#x2F;code&gt;, and return a result accordingly.&lt;&#x2F;p&gt;
&lt;p&gt;The result SHOULD be set to the &lt;code&gt;userOpHash&lt;&#x2F;code&gt; if and only if the request passed simulation and was accepted
in the client&#x27;s UserOperation pool.&lt;&#x2F;p&gt;
&lt;p&gt;If the validation, simulation, or UserOperation pool inclusion fails,
&lt;code&gt;userOpHash&lt;&#x2F;code&gt; SHOULD NOT be returned. Rather, the client SHOULD return the failure reason.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;parameters&quot;&gt;Parameters:&lt;&#x2F;h5&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;UserOperation&lt;&#x2F;strong&gt; a full user-operation struct.&lt;br &#x2F;&gt;
All fields MUST be set as hex values.&lt;br &#x2F;&gt;
Empty &lt;code&gt;bytes&lt;&#x2F;code&gt; block (e.g. empty &lt;code&gt;initCode&lt;&#x2F;code&gt;) MUST be set to &lt;code&gt;&quot;0x&quot;&lt;&#x2F;code&gt;\&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;factory&lt;&#x2F;strong&gt; and &lt;strong&gt;factoryData&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
Must provide either both of these parameters, or none.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;paymaster&lt;&#x2F;strong&gt;, &lt;strong&gt;paymasterData&lt;&#x2F;strong&gt;, &lt;strong&gt;paymasterValidationGasLimit&lt;&#x2F;strong&gt;, &lt;strong&gt;paymasterPostOpGasLimit&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
Must provide either all of these parameters, or none.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;entryPoint&lt;&#x2F;strong&gt; the &lt;code&gt;EntryPoint&lt;&#x2F;code&gt; contract address the request should be sent through.&lt;br &#x2F;&gt;
This MUST be one of the entry points returned by the &lt;code&gt;supportedEntryPoints&lt;&#x2F;code&gt; RPC call.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h5 id=&quot;return-value&quot;&gt;Return value:&lt;&#x2F;h5&gt;
&lt;ul&gt;
&lt;li&gt;If the UserOperation is valid, the client MUST return the calculated &lt;code&gt;userOpHash&lt;&#x2F;code&gt; for it&lt;&#x2F;li&gt;
&lt;li&gt;in case of failure, MUST return an &lt;code&gt;error&lt;&#x2F;code&gt; result object, with &lt;code&gt;code&lt;&#x2F;code&gt; and &lt;code&gt;message&lt;&#x2F;code&gt;.&lt;br &#x2F;&gt;
The error code and message SHOULD be set as follows:
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;code: -32602&lt;&#x2F;strong&gt; - invalid &lt;code&gt;UserOperation&lt;&#x2F;code&gt; struct&#x2F;fields&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;code: -32500&lt;&#x2F;strong&gt; - transaction rejected by &lt;code&gt;EntryPoint&lt;&#x2F;code&gt; contract&#x27;s &lt;code&gt;simulateValidation&lt;&#x2F;code&gt; function
during wallet creation or validation
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;message&lt;&#x2F;code&gt; field MUST be set to the emitted &lt;code&gt;FailedOp&lt;&#x2F;code&gt; event&#x27;s &quot;&lt;code&gt;AAxx&lt;&#x2F;code&gt;&quot; error message from the &lt;code&gt;EntryPoint&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;code: -32501&lt;&#x2F;strong&gt; - transaction rejected by &lt;code&gt;paymaster&lt;&#x2F;code&gt; contract&#x27;s &lt;code&gt;validatePaymasterUserOp&lt;&#x2F;code&gt; function
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;message&lt;&#x2F;code&gt; field SHOULD be set to the revert message from the &lt;code&gt;paymaster&lt;&#x2F;code&gt; contract&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;data&lt;&#x2F;code&gt; field MUST contain a &lt;code&gt;paymaster&lt;&#x2F;code&gt; value&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;code: -32502&lt;&#x2F;strong&gt; - transaction rejected because of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7562&#x2F;&quot;&gt;ERC-7562&lt;&#x2F;a&gt; opcode validation rule violation&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;code: -32503&lt;&#x2F;strong&gt; - UserOperation out of time-range:&lt;br &#x2F;&gt;
either wallet or paymaster returned a time-range, and it has already expired or will expire soon.
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;data&lt;&#x2F;code&gt; field SHOULD contain the &lt;code&gt;validUntil&lt;&#x2F;code&gt; and &lt;code&gt;validAfter&lt;&#x2F;code&gt; values&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;data&lt;&#x2F;code&gt; field SHOULD contain a &lt;code&gt;paymaster&lt;&#x2F;code&gt; address if this error was triggered by the &lt;code&gt;paymaster&lt;&#x2F;code&gt; contract&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;code: -32504&lt;&#x2F;strong&gt; - transaction rejected because &lt;code&gt;paymaster&lt;&#x2F;code&gt; is throttled or banned due to ERC-7562 reputation rules
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;data&lt;&#x2F;code&gt; field SHOULD contain a &lt;code&gt;paymaster&lt;&#x2F;code&gt; address&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;code: -32505&lt;&#x2F;strong&gt; - transaction rejected because &lt;code&gt;paymaster&lt;&#x2F;code&gt; contract&#x27;s ERC-7562 stake or unstake-delay is too low
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;data&lt;&#x2F;code&gt; field SHOULD contain a &lt;code&gt;paymaster&lt;&#x2F;code&gt; address&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;data&lt;&#x2F;code&gt; field SHOULD contain a &lt;code&gt;minimumStake&lt;&#x2F;code&gt; and &lt;code&gt;minimumUnstakeDelay&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;code: -32507&lt;&#x2F;strong&gt; - transaction rejected because of wallet signature check failed&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;code: -32508&lt;&#x2F;strong&gt; - transaction rejected because paymaster balance can&#x27;t cover all pending &lt;code&gt;UserOperations&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;example&quot;&gt;Example:&lt;&#x2F;h5&gt;
&lt;p&gt;Request:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;method&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_sendUserOperation&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      eip7702Auth&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; an EIP-7702 authorization tuple&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      factory&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      factoryData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      callData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      callGasLimit&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      verificationGasLimit&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      preVerificationGas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      maxFeePerGas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      maxPriorityFeePerGas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      paymaster&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      paymasterVerificationGasLimit&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      paymasterPostOpGasLimit&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      paymasterData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    entryPoint&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Response:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &amp;quot;jsonrpc&amp;quot;: &amp;quot;2.0&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &amp;quot;id&amp;quot;: 1,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &amp;quot;result&amp;quot;: &amp;quot;0x123456789012345678901234567890123456789012345678901234567890abcd&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;example-failure-responses&quot;&gt;Example failure responses:&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;message&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;AA21 didn&amp;#39;t pay prefund&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;code&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -32500&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;message&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;paymaster stake too low&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;paymaster&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x123456789012345678901234567890123456790&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;minimumStake&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xde0b6b3a7640000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;minimumUnstakeDelay&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x15180&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;code&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -32504&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;support-for-eip-7702-authorizations&quot;&gt;Support for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; authorizations&lt;&#x2F;h5&gt;
&lt;p&gt;On networks with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; activated, the &lt;code&gt;UserOperation&lt;&#x2F;code&gt; object may also contain an &lt;code&gt;eip7702Auth&lt;&#x2F;code&gt; tuple.
Notice that according to EIP-7702 an &lt;code&gt;eip7702Auth&lt;&#x2F;code&gt; tuple must be provided only to perform a &lt;strong&gt;change&lt;&#x2F;strong&gt; of the authorization address.
Once the necessary &lt;code&gt;eip7702Auth&lt;&#x2F;code&gt; tuple was stored on-chain,
users are not required to provide the same &lt;code&gt;eip7702Auth&lt;&#x2F;code&gt; tuple for any consequent
&lt;code&gt;UserOperation&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Separately, the fields &lt;code&gt;factory&lt;&#x2F;code&gt; and &lt;code&gt;factoryData&lt;&#x2F;code&gt; have a modified behaviour when using an EIP-7702 authorized &lt;code&gt;sender&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;factory&lt;&#x2F;code&gt; field SHOULD be set to exactly the &lt;code&gt;INITCODE_EIP7702_MARKER = 0x7702&lt;&#x2F;code&gt; flag when using an EIP-7702 authorized &lt;code&gt;sender&lt;&#x2F;code&gt;.
Passing his flag instructs the &lt;code&gt;EntryPoint&lt;&#x2F;code&gt; contract to verify the &lt;code&gt;sender&lt;&#x2F;code&gt; address contains a valid EIP-7702 authorization.&lt;&#x2F;p&gt;
&lt;p&gt;When &lt;code&gt;INITCODE_EIP7702_MARKER&lt;&#x2F;code&gt; is specified, the &lt;code&gt;factoryData&lt;&#x2F;code&gt; value is passed directly to the &lt;code&gt;sender&lt;&#x2F;code&gt; contract,
instead of the &lt;code&gt;factory&lt;&#x2F;code&gt; contract.
This is done as a separate call before the &lt;code&gt;validateUserOp&lt;&#x2F;code&gt; is called,
meaning the &lt;code&gt;sender&lt;&#x2F;code&gt; contract will be called two times during validation.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;factoryData&lt;&#x2F;code&gt; value can be left empty. In this case, the call will not be performed.&lt;&#x2F;p&gt;
&lt;p&gt;The purpose of this &lt;code&gt;factoryData&lt;&#x2F;code&gt; call is to provide the EIP-7702 &lt;code&gt;sender&lt;&#x2F;code&gt; contract an ability to initialize its
storage before accepting the &lt;code&gt;UserOperation&lt;&#x2F;code&gt; via the &lt;code&gt;validateUserOp&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;eth-estimateuseroperationgas&quot;&gt;eth_estimateUserOperationGas&lt;&#x2F;h4&gt;
&lt;p&gt;Estimate the gas values for a &lt;code&gt;UserOperation&lt;&#x2F;code&gt;.
Given &lt;code&gt;UserOperation&lt;&#x2F;code&gt; optionally without gas limits and gas prices, return the needed gas limits.
The signature field is ignored by the wallet, so that the operation will not require the user&#x27;s approval.
Still, it might require putting a &quot;stub&quot; &lt;code&gt;signature&lt;&#x2F;code&gt; value, e.g. a &lt;code&gt;signature&lt;&#x2F;code&gt; byte array of the right length.
If the UserOperation contains an &lt;code&gt;eip7702Auth&lt;&#x2F;code&gt; tuple, for the purpose of estimation the signature should be ignored, and the tuple should be evaluated as if it was signed by the &lt;code&gt;sender&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Parameters&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Same as &lt;code&gt;eth_sendUserOperation&lt;&#x2F;code&gt;&lt;br &#x2F;&gt;
All gas limits and fees parameters are optional, but are used if specified.&lt;br &#x2F;&gt;
&lt;code&gt;maxFeePerGas&lt;&#x2F;code&gt; and &lt;code&gt;maxPriorityFeePerGas&lt;&#x2F;code&gt; default to zero, so no payment is required by neither account nor paymaster.&lt;&#x2F;li&gt;
&lt;li&gt;Optionally accepts the &lt;code&gt;State Override Set&lt;&#x2F;code&gt; to allow users to modify the state during the gas estimation.&lt;br &#x2F;&gt;
This field as well as its behavior is equivalent to the ones defined for &lt;code&gt;eth_call&lt;&#x2F;code&gt; RPC method.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Return Values:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;preVerificationGas&lt;&#x2F;strong&gt; gas overhead of this &lt;code&gt;UserOperation&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;verificationGasLimit&lt;&#x2F;strong&gt; estimation of gas limit required by the validation of this &lt;code&gt;UserOperation&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;paymasterVerificationGasLimit&lt;&#x2F;strong&gt; estimation of gas limit required by the paymaster verification&lt;br &#x2F;&gt;
Returned only if the &lt;code&gt;UserOperation&lt;&#x2F;code&gt; specifies a &lt;code&gt;Paymaster&lt;&#x2F;code&gt; address&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;callGasLimit&lt;&#x2F;strong&gt; estimation of gas limit required by the inner account execution&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;&#x2F;strong&gt; actual &lt;code&gt;postOpGasLimit&lt;&#x2F;code&gt; cannot be reliably estimated.&lt;br &#x2F;&gt;
Paymasters should provide this value to account, and require that specific value on-chain during validation.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;error-codes&quot;&gt;Error Codes:&lt;&#x2F;h5&gt;
&lt;p&gt;Same as &lt;code&gt;eth_sendUserOperation&lt;&#x2F;code&gt;
This operation may also return an error if either the inner call to the account contract reverts,
or paymaster&#x27;s &lt;code&gt;postOp&lt;&#x2F;code&gt; call reverts.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;eth-getuseroperationbyhash&quot;&gt;eth_getUserOperationByHash&lt;&#x2F;h4&gt;
&lt;p&gt;Return a &lt;code&gt;UserOperation&lt;&#x2F;code&gt;object based on a &lt;code&gt;userOpHash&lt;&#x2F;code&gt; value returned by &lt;code&gt;eth_sendUserOperation&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Parameters&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;hash&lt;&#x2F;strong&gt; a &lt;code&gt;userOpHash&lt;&#x2F;code&gt; value returned by &lt;code&gt;eth_sendUserOperation&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Return value&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;If the &lt;code&gt;UserOperation&lt;&#x2F;code&gt; is included in a block:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Return a full UserOperation, with the addition of &lt;code&gt;entryPoint&lt;&#x2F;code&gt;, &lt;code&gt;blockNumber&lt;&#x2F;code&gt;, &lt;code&gt;blockHash&lt;&#x2F;code&gt; and &lt;code&gt;transactionHash&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Else if the &lt;code&gt;UserOperation&lt;&#x2F;code&gt; is pending in the bundler&#x27;s mempool:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;MAY return &lt;code&gt;null&lt;&#x2F;code&gt;, or a full &lt;code&gt;UserOperation&lt;&#x2F;code&gt;, with the addition of the &lt;code&gt;entryPoint&lt;&#x2F;code&gt; field and a &lt;code&gt;null&lt;&#x2F;code&gt; value for &lt;code&gt;blockNumber&lt;&#x2F;code&gt;, &lt;code&gt;blockHash&lt;&#x2F;code&gt; and &lt;code&gt;transactionHash&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Else:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Return &lt;code&gt;null&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;eth-getuseroperationreceipt&quot;&gt;eth_getUserOperationReceipt&lt;&#x2F;h4&gt;
&lt;p&gt;Return a &lt;code&gt;UserOperation&lt;&#x2F;code&gt; receipt object based on a &lt;code&gt;userOpHash&lt;&#x2F;code&gt; value returned by &lt;code&gt;eth_sendUserOperation&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Parameters&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;hash&lt;&#x2F;strong&gt; a &lt;code&gt;userOpHash&lt;&#x2F;code&gt; value returned by &lt;code&gt;eth_sendUserOperation&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Return value&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;null&lt;&#x2F;code&gt; in case the &lt;code&gt;UserOperation&lt;&#x2F;code&gt; is not yet included in a block, or:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;userOpHash&lt;&#x2F;strong&gt; the request hash&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;entryPoint&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;sender&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;nonce&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;paymaster&lt;&#x2F;strong&gt; the paymaster used for this userOp (or empty)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;actualGasCost&lt;&#x2F;strong&gt; - the actual amount paid (by account or paymaster) for this &lt;code&gt;UserOperation&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;actualGasUsed&lt;&#x2F;strong&gt; - total gas used by this &lt;code&gt;UserOperation&lt;&#x2F;code&gt;, including pre-verification, creation, validation and execution&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;success&lt;&#x2F;strong&gt; boolean - whether this execution completed without a revert&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;reason&lt;&#x2F;strong&gt; - in case of reverted &lt;code&gt;UserOperation&lt;&#x2F;code&gt;, the returned revert reason byte array&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;logs&lt;&#x2F;strong&gt; - the logs generated by this particular &lt;code&gt;UserOperation&lt;&#x2F;code&gt;, not including logs of other &lt;code&gt;UserOperations&lt;&#x2F;code&gt; in the same bundle&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;receipt&lt;&#x2F;strong&gt; the &lt;code&gt;TransactionReceipt&lt;&#x2F;code&gt; object.
Note that the returned &lt;code&gt;TransactionReceipt&lt;&#x2F;code&gt; is for the entire bundle, not only for this &lt;code&gt;UserOperation&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;eth-supportedentrypoints&quot;&gt;eth_supportedEntryPoints&lt;&#x2F;h4&gt;
&lt;p&gt;Returns an array of the &lt;code&gt;EntryPoint&lt;&#x2F;code&gt; contracts&#x27; addresses supported by the client.
The first element of the array &lt;code&gt;SHOULD&lt;&#x2F;code&gt; be the &lt;code&gt;EntryPoint&lt;&#x2F;code&gt; contract addressed preferred by the client.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;method&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_supportedEntryPoints&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xcd01C8aa8995A59eB7B2627E69b40e0524B5ecf8&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x7A0A0d159218E6a2f407B99173A2b12A6DDfC2a6&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;eth-chainid&quot;&gt;eth_chainId&lt;&#x2F;h4&gt;
&lt;p&gt;Returns &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt; Chain ID.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;method&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;rpc-methods-debug-namespace&quot;&gt;RPC methods (debug Namespace)&lt;&#x2F;h3&gt;
&lt;p&gt;This api must only be available in testing mode and is required by the compatibility test suite.
In production, any &lt;code&gt;debug_*&lt;&#x2F;code&gt; rpc calls should be blocked.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;debug-bundler-clearstate&quot;&gt;debug_bundler_clearState&lt;&#x2F;h4&gt;
&lt;p&gt;Clears the bundler mempool and reputation data of paymasters&#x2F;accounts&#x2F;factories.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;method&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;debug_bundler_clearState&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ok&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;debug-bundler-dumpmempool&quot;&gt;debug_bundler_dumpMempool&lt;&#x2F;h4&gt;
&lt;p&gt;Dumps the current &lt;code&gt;UserOperation&lt;&#x2F;code&gt; mempool&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Parameters:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;EntryPoint&lt;&#x2F;strong&gt; the entrypoint used by &lt;code&gt;eth_sendUserOperation&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Returns:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;array&lt;&#x2F;code&gt; - Array of &lt;code&gt;UserOperation&lt;&#x2F;code&gt; objects currently in the mempool.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;method&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;debug_bundler_dumpMempool&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1306b01bC3e4AD202612D3843387e94737673F53&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;        s&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;d&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;        n&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;        f&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;y&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;        f&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;y&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;        c&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;        c&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;G&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;L&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;m&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;        v&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;G&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;L&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;m&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;        p&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;V&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;G&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;        m&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;x&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;F&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;P&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;G&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;        m&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;x&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;P&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;y&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;F&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;P&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;G&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;        s&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;g&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;debug-bundler-sendbundlenow&quot;&gt;debug_bundler_sendBundleNow&lt;&#x2F;h4&gt;
&lt;p&gt;Forces the bundler to build and execute a bundle from the mempool as &lt;code&gt;handleOps()&lt;&#x2F;code&gt; transaction.&lt;&#x2F;p&gt;
&lt;p&gt;Returns: &lt;code&gt;transactionHash&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;method&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;debug_bundler_sendBundleNow&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xdead9e43632ac70c46b4003434058b18db0ad809617bd29f3448d46ca9085576&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;debug-bundler-setbundlingmode&quot;&gt;debug_bundler_setBundlingMode&lt;&#x2F;h4&gt;
&lt;p&gt;Sets bundling mode.&lt;&#x2F;p&gt;
&lt;p&gt;After setting mode to &quot;manual&quot;, an explicit call to &lt;code&gt;debug_bundler_sendBundleNow&lt;&#x2F;code&gt; is required to send a bundle.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;parameters-1&quot;&gt;parameters:&lt;&#x2F;h5&gt;
&lt;p&gt;&lt;code&gt;mode&lt;&#x2F;code&gt; - &#x27;manual&#x27; | &#x27;auto&#x27;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;method&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;debug_bundler_setBundlingMode&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;manual&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ok&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;debug-bundler-setreputation&quot;&gt;debug_bundler_setReputation&lt;&#x2F;h4&gt;
&lt;p&gt;Sets the reputation of given addresses.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Parameters:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;An array of reputation entries to add&#x2F;replace, with the fields:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;address&lt;&#x2F;code&gt; - the address to set the reputation for&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;opsSeen&lt;&#x2F;code&gt; - number of times a user operations with that entity was seen and added to the mempool&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;opsIncluded&lt;&#x2F;code&gt; - number of times user operations that use this entity was included on-chain&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;EntryPoint&lt;&#x2F;strong&gt; the entrypoint used by &lt;code&gt;eth_sendUserOperation&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;method&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;debug_bundler_setReputation&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x7A0A0d159218E6a2f407B99173A2b12A6DDfC2a6&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;opsSeen&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x14&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;opsIncluded&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1306b01bC3e4AD202612D3843387e94737673F53&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ok&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;debug-bundler-dumpreputation&quot;&gt;debug_bundler_dumpReputation&lt;&#x2F;h4&gt;
&lt;p&gt;Returns the reputation data of all observed addresses.
Returns an array of reputation objects, each with the fields described above in &lt;code&gt;debug_bundler_setReputation&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Parameters:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;EntryPoint&lt;&#x2F;strong&gt; the entrypoint used by &lt;code&gt;eth_sendUserOperation&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Return value:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;An array of reputation entries with the fields:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;address&lt;&#x2F;code&gt; - the address to set the reputation for&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;opsSeen&lt;&#x2F;code&gt; - number of times a user operations with that entity was seen and added to the mempool&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;opsIncluded&lt;&#x2F;code&gt; - number of times user operation that use this entity was included on-chain&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;status&lt;&#x2F;code&gt; - (string) The status of the address in the bundler (&lt;code&gt;&#x27;ok&#x27;&lt;&#x2F;code&gt; | &lt;code&gt;&#x27;throttled&#x27;&lt;&#x2F;code&gt; | &lt;code&gt;&#x27;banned&#x27;&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;method&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;debug_bundler_dumpReputation&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1306b01bC3e4AD202612D3843387e94737673F53&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x7A0A0d159218E6a2f407B99173A2b12A6DDfC2a6&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;opsSeen&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x14&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;opsIncluded&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x13&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;status&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ok&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;debug-bundler-adduserops&quot;&gt;debug_bundler_addUserOps&lt;&#x2F;h4&gt;
&lt;p&gt;Inject &lt;code&gt;UserOperation&lt;&#x2F;code&gt; objects array into the mempool.
Assume the given &lt;code&gt;UserOperation&lt;&#x2F;code&gt; objects all pass validation without actually validating them,
and accept them directly into the mempool.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Parameters:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;An array of &lt;code&gt;UserOperation&lt;&#x2F;code&gt; objects&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;method&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;debug_bundler_addUserOps&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;d&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xa...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; .&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;d&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xb...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; .&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ok&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;explicit debug functions: bundlers are required to provide a set of debug functions, so that the &quot;bundler specification test suite&quot; can be used to verify its adherance to the spec.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal defines a new JSON-RPC API standard that does not pose any backwards compatibility challenges.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;preventing-dos-attacks-on-useroperation-mempool&quot;&gt;Preventing DoS attacks on UserOperation mempool&lt;&#x2F;h3&gt;
&lt;p&gt;Operating a public production ERC-4337 node is a computationally intensive task and may be a target of a DoS attack.
This is addressed by the ERC-7562 validation rules, which defines a way for the ERC-4337 node to track participants&#x27;
reputation as well as preventing nodes from accepting maliciously crafted &lt;code&gt;UserOperations&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;It is strictly recommended that all ERC-4337 nodes also implement ERC-7562 validation rules to minimize DoS risks.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;disabling-debug-api-in-production-servers&quot;&gt;Disabling &lt;code&gt;debug&lt;&#x2F;code&gt; API in production servers&lt;&#x2F;h3&gt;
&lt;p&gt;The API defined in the &lt;code&gt;debug&lt;&#x2F;code&gt; namespace is not intended to ever be publicly available.
Production implementations of ERC-4337 must never make it available by default,
and in fact enabling it should result in a clear warning of the potential dangers of exposing this API.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Privileged Non-Fungible Tokens Tied To RWA</title>
        <published>2024-08-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>frank</name><uri>https://github.com/frankmint2024</uri><email>frank@mintchain.io</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7765/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc7765-privileged-non-fungible-tokens-tied-to-rwa/21048" />
        

        <id>https://wg-eips.ritovision.com/7765/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7765"
            label="ERC-7765" />
        

        
        

        
        <summary type="html">An interface extending ERC-721 representing real world assets that users can exercise privileges with NFTs.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7765/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP defines an interface to carry a real world asset with some privileges that can be exercised by the holder of the corresponding NFT. The EIP standardizes the interface for non-fungible tokens representing real world assets with privileges to be exercised, such as products sold onchain which can be redeemed in the real world.&lt;&#x2F;p&gt;
&lt;p&gt;And the privileges we describe here specifically refer to the rights and interests bound to the RWA NFT that can be executed by the holder in the real world.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;NFTs bound to real-world assets sometimes need to carry certain privileges that can be exercised by the holder. Users can initiate transactions onchain to specify the exercise of a certain privilege, thereby achieving real-world privileges that directly map the onchain privilege through subsequent operations. For example, if a certain product such as a pair of shoes is sold onchain in the representation of NFT, the NFT holder can exercise the privilege of exchanging physical shoes offchain, to achieve the purpose of interoperability between the blockchain and the real world.&lt;&#x2F;p&gt;
&lt;p&gt;Having a standard interface enables interoperability for services, clients, UI, and inter-contract functionalities on top of this use-case.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;This standard inherits the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; NFT token standard for all transfer and approval logic. All transfer and approval functions are inherited from this token standard without changes. Additionally, this standard also inherits the ERC-721 Metadata standards for name, symbol, and metadata URI lookup.&lt;&#x2F;p&gt;
&lt;p&gt;Any compliant contract following this EIP &lt;strong&gt;MUST&lt;&#x2F;strong&gt; implement the following interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pragma solidity &amp;gt;=0.7.0 &amp;lt;0.9.0;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @title ERC-7765 Privileged Non-Fungible Tokens Tied To Real World Assets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @dev See https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-7765&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;interface IERC7765 &#x2F;* is IERC721, IERC165 *&#x2F; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @notice This event emitted when a specific privilege of a token is successfully exercised.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @param _operator  the address who exercised the privilege.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @param _to  the address to benefit from the privilege.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @param _tokenId  the NFT tokenID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @param _privilegeId  the ID of the privileges.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    event PrivilegeExercised(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address indexed _operator,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address indexed _to,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 indexed _tokenId,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 _privilegeId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    );&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @notice This function exercise a specific privilege of a token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @dev Throws if `_privilegeId` is not a valid privilegeId.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @param _to  the address to benefit from the privilege.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @param _tokenId  the NFT tokenID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @param _privilegeId  the ID of the privileges.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @param _data  extra data passed in for extra message or future extension.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function exercisePrivilege(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address _to,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 _tokenId,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 _privilegeId,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bytes calldata _data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ) external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @notice This function is to check whether a specific privilege of a token can be exercised.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @dev Throws if `_privilegeId` is not a valid privilegeId.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @param _to  the address to benefit from the privilege.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @param _tokenId  the NFT tokenID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @param _privilegeId  the ID of the privileges.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function isExercisable(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address _to,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 _tokenId,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 _privilegeId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ) external view returns (bool _exercisable);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @notice This function is to check whether a specific privilege of a token has been exercised.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @dev Throws if `_privilegeId` is not a valid privilegeId.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @param _to  the address to benefit from the privilege.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @param _tokenId  the NFT tokenID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @param _privilegeId  the ID of the privileges.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function isExercised(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address _to,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 _tokenId,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 _privilegeId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ) external view returns (bool _exercised);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @notice This function is to list all privilegeIds of a token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @param _tokenId  the NFT tokenID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function getPrivilegeIds(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 _tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ) external view returns (uint256[] memory privilegeIds);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The function &lt;code&gt;exercisePrivilege&lt;&#x2F;code&gt; performs the exercise action to a specific privilege of a token. If succeeds, it is expected to emit a &lt;code&gt;PrivilegeExercised&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;p&gt;The function &lt;code&gt;getPrivilegeIds&lt;&#x2F;code&gt; provides a way to manage the binding relationship between NFTs and privilegeIds.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;strong&gt;metadata extension&lt;&#x2F;strong&gt; is OPTIONAL for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7765&#x2F;&quot;&gt;EIP-7765&lt;&#x2F;a&gt; smart contracts. This allows your smart contract to be interrogated for its details about the privileges which your NFTs carry.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pragma solidity &amp;gt;=0.7.0 &amp;lt;0.9.0;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @title ERC-7765 Privileged Non-Fungible Tokens Tied To Real World Assets, optional metadata extension&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @dev See https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-7765&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;interface IERC7765Metadata &#x2F;* is IERC7765 *&#x2F; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @notice A distinct Uniform Resource Identifier (URI) for a given privilegeId.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @dev Throws if `_privilegeId` is not a valid privilegeId. URIs are defined in RFC&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F;  3986. The URI may point to a JSON file that conforms to the &amp;quot;ERC-7765&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F;  Metadata JSON Schema&amp;quot;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function privilegeURI(uint256 _privilegeId) external view returns (string memory);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This is the “EIP-7765 Metadata JSON Schema” referenced above.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;title&amp;quot;: &amp;quot;Privilege Metadata&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;type&amp;quot;: &amp;quot;object&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;properties&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;name&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &amp;quot;description&amp;quot;: &amp;quot;Identifies the specific privilege.&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;description&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &amp;quot;description&amp;quot;: &amp;quot;Describes the specific privilege.&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;resource&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &amp;quot;description&amp;quot;: &amp;quot;A URI pointing to a resource representing the specific privilege.&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;IERC7765Metadata&lt;&#x2F;code&gt; provides specifications for obtaining metadata information of privileges. A contract that implements &lt;code&gt;IERC7765Metadata&lt;&#x2F;code&gt; &lt;strong&gt;SHALL&lt;&#x2F;strong&gt; also implement &lt;code&gt;IERC7765&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;With the &lt;code&gt;PrivilegeExercised&lt;&#x2F;code&gt; event emitted onchain, we can determine that the user has confirmed the exercise of this privilege, so as to implement the privilege in the real world.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;We choose to include an address &lt;code&gt;_to&lt;&#x2F;code&gt; for functions &lt;code&gt;exercisePrivilege&lt;&#x2F;code&gt;, &lt;code&gt;isExercisable&lt;&#x2F;code&gt; and &lt;code&gt;isExercised&lt;&#x2F;code&gt; so that a specific privilege of an NFT MAY be exercised for someone who will benefit from it other than the NFT holder nor the transaction initiator. And This EIP doesn&#x27;t assume who has the power to perform this action, it&#x27;s totally decided by the developers who are using this standard.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;We choose to include an extra &lt;code&gt;_data&lt;&#x2F;code&gt; field to function &lt;code&gt;exercisePrivilege&lt;&#x2F;code&gt; for extra message or future extension. For example, developers can use &lt;code&gt;_data&lt;&#x2F;code&gt; to exercise a privilege that takes effect directly onchain such as direct distribution of cryptocurrency assets.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The boolean view functions of &lt;code&gt;isExercisable&lt;&#x2F;code&gt; and &lt;code&gt;isExercised&lt;&#x2F;code&gt; can be used to check whether a specific privilege of an NFT can be exercisable or has been exercised to the &lt;code&gt;_to&lt;&#x2F;code&gt; address.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is an extension of ERC-721. It is fully compatible with both of the commonly used optional extensions (&lt;code&gt;IERC721Metadata&lt;&#x2F;code&gt; and &lt;code&gt;IERC721Enumerable&lt;&#x2F;code&gt;) mentioned in the ERC-721 standard.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The reference implementation of Privileged NFTs can be found &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7765&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;ERC7765Example.sol&quot;&gt;Here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Compliant contracts should pay attention to the storage to the states of the privileges. The contract should properly handle the state transition of each privilege of each NFT, clearly showing that each privilege is exercisable or has been exercised.&lt;&#x2F;p&gt;
&lt;p&gt;Compliant contracts should also carefully define access control, particularly whether any EOA or contract account may or may not call &lt;code&gt;exercisePrivilege&lt;&#x2F;code&gt; function in any use case. Security audits and tests should be used to verify that the access control to the &lt;code&gt;exercisePrivilege&lt;&#x2F;code&gt; function behaves as expected.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Minimal Upgradeable Proxies</title>
        <published>2024-08-19T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Atarpara</name><uri>https://github.com/Atarpara</uri>
	</author>
	
	<author>
		<name>JT Riley</name><uri>https://github.com/jtriley-eth</uri>
	</author>
	
	<author>
		<name>Thomas</name><uri>https://github.com/0xth0mas</uri>
	</author>
	
	<author>
		<name>xiaobaiskill</name><uri>https://github.com/xiaobaiskill</uri>
	</author>
	
	<author>
		<name>Vectorized</name><uri>https://github.com/Vectorized</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7760/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7760-minimal-upgradeable-proxies/20868" />
        

        <id>https://wg-eips.ritovision.com/7760/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7760"
            label="ERC-7760" />
        

        
        

        
        <summary type="html">Minimal upgradeable proxies with immutable arguments and support for onchain implementation queries</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7760/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard defines minimal &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1967&#x2F;&quot;&gt;ERC-1967&lt;&#x2F;a&gt; proxies for three patterns: (1) transparent, (2) UUPS, (3) beacon. The proxies support optional immutable arguments which are appended to the end of their runtime bytecode. Additional variants which support onchain implementation querying are provided.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Having standardized minimal bytecode for upgradeable proxies enables the following:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Automatic verification on block explorers.&lt;&#x2F;li&gt;
&lt;li&gt;Ability for immutable arguments to be queried onchain, as these arguments are stored at the same bytecode offset,&lt;&#x2F;li&gt;
&lt;li&gt;Ability for the implementation to be queried and verified onchain.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The minimal nature of the proxies enables cheaper deployment and runtime costs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;general-specifications&quot;&gt;General specifications&lt;&#x2F;h3&gt;
&lt;p&gt;All of the following proxies MAY have optional data bytecode appended to the end of their runtime bytecode.&lt;&#x2F;p&gt;
&lt;p&gt;Emitting the ERC-1967 events during initialization is OPTIONAL. Indexers MUST NOT expect the initialization code to emit the ERC-1967 events.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;onchain-querying-of-implementation-for-i-variants&quot;&gt;Onchain querying of implementation for I-variants&lt;&#x2F;h3&gt;
&lt;p&gt;The I-variants have logic that returns the implementation baked into their bytecode.&lt;&#x2F;p&gt;
&lt;p&gt;When called with any 1-byte calldata, these I-variants will return the address (left-zero-padded to 32 bytes) and will not forward the calldata to the target.&lt;&#x2F;p&gt;
&lt;p&gt;The bytecode of the proxies before any optional immutable arguments MUST be verified with the following steps:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Fetch the bytecode before any immutable arguments with &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Zeroize any baked-in factory address in the fetched bytecode.&lt;&#x2F;li&gt;
&lt;li&gt;Ensure that the hash of the final fetched bytecode matches the expected hash of the bytecode.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;If the hash does not match, the implementation address returned MUST NOT be trusted.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;minimal-erc-1967-transparent-upgradeable-proxy&quot;&gt;Minimal ERC-1967 transparent upgradeable proxy&lt;&#x2F;h3&gt;
&lt;p&gt;The transparent upgradeable proxy is RECOMMENDED to be deployed by a factory that doubles as the account that is authenticated to perform upgrades. An externally owned account may perform the deployment on behalf of the factory. For convention, we will refer to the factory as the immutable account authorized to invoke the upgrade logic on the proxy.&lt;&#x2F;p&gt;
&lt;p&gt;As the proxy&#x27;s runtime bytecode contains logic to allow the factory to set any storage slot with any value, the initialization code MAY skip storing the implementation slot.&lt;&#x2F;p&gt;
&lt;p&gt;The upgrading logic does not emit the ERC-1967 event. Indexers MUST NOT expect the upgrading logic to emit the ERC-1967 events.&lt;&#x2F;p&gt;
&lt;p&gt;During upgrades, the factory MUST call the upgradeable proxy with following calldata:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The new implementation address, converted to a 32-byte word.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint160&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;implementation&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-1967 implementation slot.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Optional calldata to be forwarded to the implementation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; via delegatecall after setting the implementation slot.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;minimal-erc-1967-transparent-upgradeable-proxy-for-basic-variant&quot;&gt;Minimal ERC-1967 transparent upgradeable proxy for (basic variant)&lt;&#x2F;h4&gt;
&lt;p&gt;Runtime bytecode (20-byte factory address subvariant):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;3d3d3373________________________________________14605757363d3d37363d7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc545af43d6000803e6052573d6000fd5b3d6000f35b3d356020355560408036111560525736038060403d373d3d355af43d6000803e6052573d6000fd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where &lt;code&gt;________________________________________&lt;&#x2F;code&gt; is the 20-byte factory address.&lt;&#x2F;p&gt;
&lt;p&gt;Runtime bytecode (14-byte factory address subvariant):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;3d3d336d____________________________14605157363d3d37363d7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc545af43d6000803e604c573d6000fd5b3d6000f35b3d3560203555604080361115604c5736038060403d373d3d355af43d6000803e604c573d6000fd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where &lt;code&gt;____________________________&lt;&#x2F;code&gt; is the 14-byte factory address.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;minimal-erc-1967-transparent-upgradeable-proxy-i-variant&quot;&gt;Minimal ERC-1967 transparent upgradeable proxy (I-variant)&lt;&#x2F;h4&gt;
&lt;p&gt;Runtime bytecode (20-byte factory address subvariant):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;3658146083573d3d3373________________________________________14605D57363d3d37363D7f360894a13ba1A3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc545af43d6000803e6058573d6000fd5b3d6000f35b3d35602035556040360380156058578060403d373d3d355af43d6000803e6058573d6000fd5b602060293d393d51543d52593df3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where &lt;code&gt;________________________________________&lt;&#x2F;code&gt; is the 20-byte factory address.&lt;&#x2F;p&gt;
&lt;p&gt;Runtime bytecode (14-byte factory address subvariant):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;365814607d573d3d336d____________________________14605757363d3D37363d7F360894A13Ba1A3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc545af43d6000803e6052573d6000fd5b3d6000f35b3d35602035556040360380156052578060403d373d3d355af43d6000803e6052573d6000fd5b602060233d393d51543d52593df3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where &lt;code&gt;____________________________&lt;&#x2F;code&gt; is the 14-byte factory address.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;minimal-erc-1967-uups-proxy&quot;&gt;Minimal ERC-1967 UUPS proxy&lt;&#x2F;h3&gt;
&lt;p&gt;As this proxy does not contain upgrading logic, the initialization code MUST store the implementation at the ERC-1967 implementation storage slot &lt;code&gt;0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;minimal-erc-1967-uups-proxy-basic-variant&quot;&gt;Minimal ERC-1967 UUPS proxy (basic variant)&lt;&#x2F;h4&gt;
&lt;p&gt;Runtime bytecode:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;363d3d373d3d363d7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc545af43d6000803e6038573d6000fd5b3d6000f3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;minimal-erc-1967-uups-proxy-i-variant&quot;&gt;Minimal ERC-1967 UUPS proxy (I-variant)&lt;&#x2F;h4&gt;
&lt;p&gt;Runtime bytecode:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;365814604357363d3d373d3d363d7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc545af43d6000803e603e573d6000fd5b3d6000f35b6020600f3d393d51543d52593df3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;minimal-erc-1967-beacon-proxy&quot;&gt;Minimal ERC-1967 beacon proxy&lt;&#x2F;h3&gt;
&lt;p&gt;As this proxy does not contain upgrading logic, the initialization code MUST store the implementation at the ERC-1967 implementation storage slot &lt;code&gt;0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;minimal-erc-1967-beacon-proxy-basic-variant&quot;&gt;Minimal ERC-1967 beacon proxy (basic variant)&lt;&#x2F;h4&gt;
&lt;p&gt;Runtime bytecode:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;363d3d373d3d363d602036600436635c60da1b60e01b36527fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50545afa5036515af43d6000803e604d573d6000fd5b3d6000f3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;minimal-erc-1967-beacon-proxy-i-variant&quot;&gt;Minimal ERC-1967 beacon proxy (I-variant)&lt;&#x2F;h4&gt;
&lt;p&gt;Runtime bytecode:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;363d3d373d3d363d602036600436635c60da1b60e01b36527fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50545afa361460525736515af43d600060013e6052573d6001fd5b3d6001f3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;no-usage-of-push0-opcode&quot;&gt;No usage of &lt;code&gt;PUSH0&lt;&#x2F;code&gt; opcode&lt;&#x2F;h3&gt;
&lt;p&gt;For more widespread EVM compatibility, the proxies deliberately do not use the &lt;code&gt;PUSH0&lt;&#x2F;code&gt; opcode proposed in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3855&#x2F;&quot;&gt;EIP-3855&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Converting the proxies to &lt;code&gt;PUSH0&lt;&#x2F;code&gt; variants may be done in a separate future ERC.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;optimization-priorities&quot;&gt;Optimization priorities&lt;&#x2F;h3&gt;
&lt;p&gt;The proxies are first optimized for minimal runtime gas before minimal bytecode size.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;minimal-nature&quot;&gt;Minimal nature&lt;&#x2F;h3&gt;
&lt;p&gt;These proxies made from handcrafted EVM bytecode. While utmost efforts have been made to ensure that they are as minimal as possible at the time of development, it is possible that they can be further optimized. If a variant has already been used in the wild, it is preferable to keep their existing layout in this standard, as the benefits of automatic block explorer verification will outweigh the few gas saved during runtime or deployment.&lt;&#x2F;p&gt;
&lt;p&gt;For historical reference, the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1167&#x2F;&quot;&gt;ERC-1167&lt;&#x2F;a&gt; minimal proxy was not the theoretical minimal at the time of writing. The 0age minimal proxy has lower runtime gas costs and smaller bytecode size.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;transparent-upgradeable-proxy&quot;&gt;Transparent upgradeable proxy&lt;&#x2F;h3&gt;
&lt;p&gt;The factory address in the transparent upgradeable proxy is baked into the immutable bytecode of the minimal transparent upgradeable proxy.&lt;&#x2F;p&gt;
&lt;p&gt;This is to save a &lt;code&gt;SLOAD&lt;&#x2F;code&gt; for every proxy call.&lt;&#x2F;p&gt;
&lt;p&gt;As the factory can contain custom authorization logic that allows for admin rotation, we do not lose any flexibility.&lt;&#x2F;p&gt;
&lt;p&gt;The upgrade logic takes in any 32 byte value and 32 byte storage slot. This is for flexibility and bytecode conciseness.&lt;&#x2F;p&gt;
&lt;p&gt;We do not lose any security as the implementation can still modify any storage slot.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;14-byte-factory-address-subvariants&quot;&gt;14-byte factory address subvariants&lt;&#x2F;h3&gt;
&lt;p&gt;It is beneficial to install the transparent upgradeable proxy factory at a vanity address with leading zero bytes so that the proxy&#x27;s bytecode can be optimized to be shorter.&lt;&#x2F;p&gt;
&lt;p&gt;A 14-byte factory address (i.e. 6 leading zero bytes) is chosen because it strikes a balance between mining costs and bytecode size.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;i-variants&quot;&gt;I-variants&lt;&#x2F;h3&gt;
&lt;p&gt;The so-called &quot;I-variants&quot; contain logic that returns the implementation address baked into the proxy bytecode.&lt;&#x2F;p&gt;
&lt;p&gt;This allows contracts to retrieve the implementation of the proxy onchain in a verifiable way.&lt;&#x2F;p&gt;
&lt;p&gt;As long as the proxy&#x27;s runtime bytecode starts with the bytecode in this standard, we can be sure that the implementation address is not spoofed.&lt;&#x2F;p&gt;
&lt;p&gt;The choice of reserving 1-byte calldata to denote an implementation query request is for efficiency and to prevent calldata collision. Regular ETH transfers use 0-byte calldata, and regular Solidity function calls use calldata that is 4 bytes or longer.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;omission-of-events-in-bytecode&quot;&gt;Omission of events in bytecode&lt;&#x2F;h3&gt;
&lt;p&gt;This is for minimal bytecode size and deployment costs.&lt;&#x2F;p&gt;
&lt;p&gt;Most block explorers and indexers are able to deduce the latest implementation without the use of events simply by reading the slots.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;immutable-arguments-are-not-appended-to-forwarded-calldata&quot;&gt;Immutable arguments are not appended to forwarded calldata&lt;&#x2F;h3&gt;
&lt;p&gt;This is to avoid compatibility and safety issues with other ERC standards that append extra data to the calldata.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt; opcode can be used to retrieve the immutable arguments.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;no-fixed-initialization-code&quot;&gt;No fixed initialization code&lt;&#x2F;h3&gt;
&lt;p&gt;As long as the initialization code is able to initialize the relevant ERC-1967 implementation slot where needed (i.e. for the UUPS proxy and Beacon proxy), there is no need for additional requirements on the initialization code.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;out-of-scope-topics&quot;&gt;Out of scope topics&lt;&#x2F;h3&gt;
&lt;p&gt;The following topics are intentionally out of scope of this standard, as they can contain custom logic:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Factories for proxy deployment.&lt;&#x2F;li&gt;
&lt;li&gt;Logic for reading and verifying the implementation from the I-variants onchain.&lt;&#x2F;li&gt;
&lt;li&gt;Beacon for the beacon proxies.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Nevertheless, they require careful implementation to ensure security and correctness.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;minimal-erc-1967-transparent-upgradeable-proxy-implementation&quot;&gt;Minimal ERC-1967 transparent upgradeable proxy implementation&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;minimal-erc-1967-transparent-upgradeable-proxy-implementation-basic-variant&quot;&gt;Minimal ERC-1967 transparent upgradeable proxy implementation (basic variant)&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;library&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC1967MinimalTransparentUpgradeableProxyLib&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; initCodeFor20ByteFactoryAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes13&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x607f3d8160093d39f33d3d3373&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x14605757363d3d37363d7f360894a13ba1a3210667c828492db98dca3e2076cc&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x3735a920a3ca505d382bbc545af43d6000803e6052573d6000fd5b3d6000f35b&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x3d356020355560408036111560525736038060403d373d3d355af43d6000803e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes7&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x6052573d6000fd&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; initCodeFor14ByteFactoryAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes13&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x60793d8160093d39f33d3d336d&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            uint112&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint160&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x14605157363d3d37363d7f360894a13ba1a3210667c828492db98dca3e2076cc&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x3735a920a3ca505d382bbc545af43d6000803e604c573d6000fd5b3d6000f35b&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x3d3560203555604080361115604c5736038060403d373d3d355af43d6000803e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes7&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x604c573d6000fd&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; initCode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint160&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 112&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; initCodeFor20ByteFactoryAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; initCodeFor14ByteFactoryAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; deploy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; implementation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; initializationData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        internal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; instance&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; m &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; initCode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            instance &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; create&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;m&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;m&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;instance &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Deployment failed.&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        upgrade&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;instance&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; implementation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; initializationData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; upgrade&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; instance&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; implementation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; upgradeData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt; success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; instance&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;                &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The new implementation address, converted to a 32-byte word.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint160&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;implementation&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;                &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-1967 implementation slot.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;                &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Optional calldata to be forwarded to the implementation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;                &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; via delegatecall after setting the implementation slot.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                upgradeData&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Upgrade failed.&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;minimal-erc-1967-transparent-upgradeable-proxy-implementation-i-variant&quot;&gt;Minimal ERC-1967 transparent upgradeable proxy implementation (I-variant)&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;library&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC1967IMinimalTransparentUpgradeableProxyLib&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; initCodeFor20ByteFactoryAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes19&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x60923d8160093d39f33658146083573d3d3373&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x14605D57363d3d37363D7f360894a13ba1A32106&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x67c828492db98dca3e2076cc3735a920a3ca505d382bbc545af43d6000803e60&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x58573d6000fd5b3d6000f35b3d35602035556040360380156058578060403d37&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x3d3d355af43d6000803e6058573d6000fd5b602060293d393d51543d52593df3&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; initCodeFor14ByteFactoryAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes19&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x608c3d8160093d39f3365814607d573d3d336d&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            uint112&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint160&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x14605757363d3D37363d7F360894A13Ba1A32106&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x67c828492db98dca3e2076cc3735a920a3ca505d382bbc545af43d6000803e60&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x52573d6000fd5b3d6000f35b3d35602035556040360380156052578060403d37&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x3d3d355af43d6000803e6052573d6000fd5b602060233d393d51543d52593df3&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; initCode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint160&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 112&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; initCodeFor20ByteFactoryAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; initCodeFor14ByteFactoryAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; deploy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; implementation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; initializationData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        internal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; instance&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; m &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; initCode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            instance &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; create&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;m&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;m&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;instance &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Deployment failed.&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        upgrade&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;instance&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; implementation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; initializationData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; upgrade&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; instance&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; implementation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; upgradeData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt; success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; instance&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;                &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The new implementation address, converted to a 32-byte word.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint160&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;implementation&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;                &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-1967 implementation slot.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;                &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Optional calldata to be forwarded to the implementation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;                &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; via delegatecall after setting the implementation slot.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                upgradeData&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Upgrade failed.&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;minimal-erc-1967-uups-proxy-implementation&quot;&gt;Minimal ERC-1967 UUPS proxy implementation&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;minimal-erc-1967-uups-proxy-implementation-basic-variant&quot;&gt;Minimal ERC-1967 UUPS proxy implementation (basic variant)&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;library&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC1967MinimalUUPSProxyLib&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; initCode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; implementation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; args&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        internal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        pure&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; n &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x003d&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; args&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;n &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xffff&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Immutable args too long.&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes1&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x61&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            uint16&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes7&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x3d8160233d3973&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            implementation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x6009&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x5155f3363d3d373d3d363d7f360894a13ba1a3210667c828492db98dca3e2076&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xcc3735a920a3ca505d382bbc545af43d6000803e6038573d6000fd5b3d6000f3&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            args&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; deploy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; implementation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; args&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        internal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; instance&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; m &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; initCode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;implementation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; args&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            instance &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; create&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;m&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;m&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;instance &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Deployment failed.&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;minimal-erc-1967-uups-proxy-implementation-i-variant&quot;&gt;Minimal ERC-1967 UUPS proxy implementation (I-variant)&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;library&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC1967IMinimalUUPSProxyLib&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; initCode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; implementation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; args&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        internal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        pure&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; n &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x0052&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; args&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;n &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xffff&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Immutable args too long.&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes1&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x61&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            uint16&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes7&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x3d8160233d3973&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            implementation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes23&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x600f5155f3365814604357363d3d373d3d363d7f360894&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xa13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc545af4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x3d6000803e603e573d6000fd5b3d6000f35b6020600f3d393d51543d52593df3&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            args&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; deploy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; implementation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; args&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        internal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; instance&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; m &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; initCode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;implementation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; args&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            instance &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; create&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;m&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;m&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;instance &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Deployment failed.&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;minimal-erc-1967-beacon-proxy-implementation&quot;&gt;Minimal ERC-1967 beacon proxy implementation&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;minimal-erc-1967-beacon-proxy-implementation-basic-variant&quot;&gt;Minimal ERC-1967 beacon proxy implementation (basic variant)&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;library&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC1967MinimalBeaconProxyLib&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; initCode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; beacon&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; args&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; n &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x0052&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; args&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;n &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xffff&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Immutable args too long.&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes1&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x61&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            uint16&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes7&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x3d8160233d3973&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            beacon&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes23&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x60195155f3363d3d373d3d363d602036600436635c60da&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x1b60e01b36527fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6c&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xb3582b35133d50545afa5036515af43d6000803e604d573d6000fd5b3d6000f3&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            args&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; deploy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; beacon&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; args&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; instance&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; m &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; initCode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;beacon&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; args&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            instance &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; create&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;m&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;m&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;instance &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Deployment failed.&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;minimal-erc-1967-beacon-proxy-implementation-i-variant&quot;&gt;Minimal ERC-1967 beacon proxy implementation (I-variant)&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;library&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC1967IMinimalBeaconProxyLib&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; initCode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; beacon&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; args&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; n &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x0057&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; args&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;n &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xffff&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Immutable args too long.&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes1&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x61&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            uint16&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes7&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x3d8160233d3973&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            beacon&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes28&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x60195155f3363d3d373d3d363d602036600436635c60da1b60e01b36&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x527fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b3513&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x3d50545afa361460525736515af43d600060013e6052573d6001fd5b3d6001f3&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            args&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; deploy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; beacon&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; args&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; instance&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; m &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; initCode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;beacon&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; args&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            instance &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; create&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;m&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;m&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;instance &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Deployment failed.&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;transparent-upgradeable-proxy-factory-security-considerations&quot;&gt;Transparent upgradeable proxy factory security considerations&lt;&#x2F;h3&gt;
&lt;p&gt;To ensure security, the transparent upgradeable proxy factory must implement proper access control to allow proxies to be upgraded by only authorized accounts.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;calldata-length-collision-for-i-variants&quot;&gt;Calldata length collision for I-variants&lt;&#x2F;h3&gt;
&lt;p&gt;The I-variants reserve all calldata of length 1 to denote a request to return the implementation. This may pose compatibility issues if the underlying implementation actually uses 1-byte calldata for special purposes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EOF&#x2F;EVM Trace Specification</title>
        <published>2024-08-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Martin Holst Swende</name><uri>https://github.com/holiman</uri>
	</author>
	
	<author>
		<name>Marius van der Wijden</name><uri>https://github.com/MariusVanDerWijden</uri>
	</author>
	
	<author>
		<name>Danno Ferrin</name><uri>https://github.com/shemnon</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7756/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7756-eof-evm-trace-specification/20806" />
        

        <id>https://wg-eips.ritovision.com/7756/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="interface"
                label="Interface" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7756"
            label="EIP-7756" />
        

        
        

        
        <summary type="html">Updates EIP-3155 tracing to add EOF support</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7756/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Updates the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3155&#x2F;&quot;&gt;EIP-3155&lt;&#x2F;a&gt; JSON tracing specification to support EOF features.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;EIP-3155 defined a tracing standard for Legacy EVM operations. However, the EVM Object
Format (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7692&#x2F;&quot;&gt;EIP-7692&lt;&#x2F;a&gt;) adds a number of features that need to be reflected in debugging
traces.&lt;&#x2F;p&gt;
&lt;p&gt;The use of these traces has also moved out from state testing, including live block tracing and
differential fuzzing, increasing the need to keep tracing up to date.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP has multiple goals:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Add members to the trace object to support new EOF features.&lt;&#x2F;li&gt;
&lt;li&gt;Support tracing contracts contained in an EOF container as well as uncontained &quot;legacy&quot; contracts
in the same trace.&lt;&#x2F;li&gt;
&lt;li&gt;Clarify any previous ambiguities in the EIP-3155 specification.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;To promote clarity and provide a cohesive specification, the entire tracing specification will be
presented with alterations in-line rather than as a set of diffs on top of EIP-3155. Differences
will be highlighted in the Backwards Compatibility section.&lt;&#x2F;p&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;
RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as
described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;datatypes&quot;&gt;Datatypes&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Explanation&lt;&#x2F;th&gt;&lt;th&gt;JSON member example&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Number&lt;&#x2F;td&gt;&lt;td&gt;JSON number&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;&quot;pc&quot;:0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Hex-Number&lt;&#x2F;td&gt;&lt;td&gt;Hex-encoded number&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;&quot;gas&quot;:&quot;0x2540be400&quot;&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;String&lt;&#x2F;td&gt;&lt;td&gt;Plain string&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;&quot;opName&quot;:&quot;PUSH1&quot;&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Hex-String&lt;&#x2F;td&gt;&lt;td&gt;Hex-encoded string&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;&quot;returnData&quot;:&quot;0x60616203&quot;&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Array&lt;&#x2F;td&gt;&lt;td&gt;Array of Hex-Strings&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;&quot;stack&quot;:[&quot;0x0&quot;, &quot;0x0&quot;]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Key-Value&lt;&#x2F;td&gt;&lt;td&gt;Key-Value structure with key and values encoded as hex strings&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;&quot;storage&quot;:{&quot;0x0&quot;:&quot;0x1&quot;, &quot;0x1&quot;:&quot;0x1&quot;}&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Boolean&lt;&#x2F;td&gt;&lt;td&gt;Json bool can either be true or false&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;&quot;pass&quot;: true&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;ul&gt;
&lt;li&gt;Clients may OPTIONALLY output Number where a Hex-Number is expected and vice-versa. Clients that
do this SHOULD provide a CLI option to strictly observe the correct output type.&lt;&#x2F;li&gt;
&lt;li&gt;Numbers larger than 2^53 - 1 must be represented as Hex-Numbers. This is a limitation of JSON.&lt;&#x2F;li&gt;
&lt;li&gt;Consumers of EIP-7756 traces SHOULD be written in a way that members of type Hex-Number and
Number may be provided a Number or Hex-Number instead, respectively.&lt;&#x2F;li&gt;
&lt;li&gt;Note that there is no string formatted decimal number alternative. Decimal representations are
always JSON numbers, and hex representations are always strings encoding hex numbers.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;output&quot;&gt;Output&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;The client outputs one JSON object per EVM operation executed.&lt;&#x2F;li&gt;
&lt;li&gt;The client MUST NOT output multiple lines for the same operation execution.&lt;&#x2F;li&gt;
&lt;li&gt;The client MUST NOT output a line for the &lt;code&gt;STOP&lt;&#x2F;code&gt; operation if an error occurred, or if the
contract runs out of instructions.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;required-fields&quot;&gt;Required Fields&lt;&#x2F;h4&gt;
&lt;p&gt;Each trace line MUST have these fields.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Explanation&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;pc&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Number&lt;&#x2F;td&gt;&lt;td&gt;Program Counter&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;op&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Hex-Number&lt;&#x2F;td&gt;&lt;td&gt;OpCode&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;opName&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;String&lt;&#x2F;td&gt;&lt;td&gt;Name of the operation&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;gas&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Number&lt;&#x2F;td&gt;&lt;td&gt;Gas left before executing this operation&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;stack&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Array of Hex-Numbers&lt;&#x2F;td&gt;&lt;td&gt;Array of all values on the stack&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;depth&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Number&lt;&#x2F;td&gt;&lt;td&gt;Depth of the call stack&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;error&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Hex-String&lt;&#x2F;td&gt;&lt;td&gt;Description of an error (SHOULD contain revert reason if supported)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;pc&lt;&#x2F;code&gt; value is zero indexed from the beginning of the contract when the contract is not in an
EOF container, or from the beginning of the container EOF container. For legacy contracts the
first execution line is for &lt;code&gt;&quot;pc&quot;:0&lt;&#x2F;code&gt;. For EOF contracts the zero byte corresponds to the &lt;code&gt;0xEF&lt;&#x2F;code&gt;
magic byte. The first line of execution will not be at &lt;code&gt;&quot;pc&quot;:0&lt;&#x2F;code&gt; but at the first byte of the first
code section executed.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;opName&lt;&#x2F;code&gt; SHOULD be the most current name of the operation, in cases where operations have multiple
specification names (&lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; and &lt;code&gt;PREVRANDAO&lt;&#x2F;code&gt;)&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;If &lt;code&gt;stack&lt;&#x2F;code&gt; is empty an empty array (&lt;code&gt;[]&lt;&#x2F;code&gt;) is used instead of &lt;code&gt;null&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;depth&lt;&#x2F;code&gt; starts at 1.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;error&lt;&#x2F;code&gt; SHOULD be omitted if a prior CALL series or CREATE series operation within the current
frame has not returned a revert reason and the current operation did not trigger an exceptional
halt.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;!-- - `stack` MAY exclude stack items that are more than any operation will need to execute, which 
is currently seven stack items. If any stack items are excluded past that point then all stack items
past that point MUST be excluded
--&gt;
&lt;h4 id=&quot;recommended-fields&quot;&gt;Recommended Fields&lt;&#x2F;h4&gt;
&lt;p&gt;Each trace line SHOULD have these fields in the conditions they are indicated for.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Explanation&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;gasCost&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Number&lt;&#x2F;td&gt;&lt;td&gt;Gas cost of this operation&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;memSize&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Number&lt;&#x2F;td&gt;&lt;td&gt;Size of memory array&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;returnData&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Hex-String&lt;&#x2F;td&gt;&lt;td&gt;Data returned by function call&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;refund&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Hex-Number&lt;&#x2F;td&gt;&lt;td&gt;Amount of &lt;strong&gt;global&lt;&#x2F;strong&gt; gas refunded&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;gasCost&lt;&#x2F;code&gt; is the sum of all gas costs, including dynamic costs such as memory expansion, call
stipend, and account warming costs.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;memSize&lt;&#x2F;code&gt; is counted in 8-bit bytes, not 256-bit words.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;returnData&lt;&#x2F;code&gt; SHOULD NOT be present if a CALL series operation has not completed within the current
frame.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;optional-fields&quot;&gt;Optional Fields&lt;&#x2F;h4&gt;
&lt;p&gt;Each trace line MAY have these fields in the conditions they are indicated for.
If a field is to be omitted within a trace, it MUST always be omitted within the same trace.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Explanation&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;section&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Number&lt;&#x2F;td&gt;&lt;td&gt;Current EOF section being executed&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;immediate&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Hex-String&lt;&#x2F;td&gt;&lt;td&gt;Immediate argument of the Opcode&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;functionDepth&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Number&lt;&#x2F;td&gt;&lt;td&gt;Depth of the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4750&#x2F;&quot;&gt;EIP-4750&lt;&#x2F;a&gt; CALLF return stack&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;memory&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Array of Hex-Strings&lt;&#x2F;td&gt;&lt;td&gt;Array of all allocated values&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;storage&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Key-Value&lt;&#x2F;td&gt;&lt;td&gt;Array of all stored values&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;section&lt;&#x2F;code&gt; member must only be present when tracing a contract contained in an EOF container.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;immediate&lt;&#x2F;code&gt; field MUST NOT be present for operations without immediate data.
&lt;ul&gt;
&lt;li&gt;For PUSH series operations, this field is OPTIONAL as the immediate data is pushed onto the
stack&lt;&#x2F;li&gt;
&lt;li&gt;For RJUMPV this would include the table length and the entire table. Clients MAY instead store
just the table length.&lt;&#x2F;li&gt;
&lt;li&gt;For all other operations with immediate data the entire immediate data, including leading
zeros, SHOULD be present.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;functionDepth&lt;&#x2F;code&gt; starts at 1, and MAY be omitted if it is 1.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;functionDepth&lt;&#x2F;code&gt; MUST NOT be present for trace lines of code not in an EOF container.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;memory&lt;&#x2F;code&gt; is empty an empty array (&lt;code&gt;[]&lt;&#x2F;code&gt;) is used instead of &lt;code&gt;null&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;storage&lt;&#x2F;code&gt; member SHOULD only include items read or written via &lt;code&gt;SSTORE&lt;&#x2F;code&gt; or &lt;code&gt;SLOAD&lt;&#x2F;code&gt;, and not
the account&#x27;s entire storage.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;Example:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&amp;quot;pc&amp;quot;:0,&amp;quot;op&amp;quot;:96,&amp;quot;gas&amp;quot;:&amp;quot;0x2540be400&amp;quot;,&amp;quot;gasCost&amp;quot;:&amp;quot;0x3&amp;quot;,&amp;quot;memory&amp;quot;:&amp;quot;0x&amp;quot;,&amp;quot;memSize&amp;quot;:0,&amp;quot;stack&amp;quot;:[],&amp;quot;depth&amp;quot;:1,&amp;quot;error&amp;quot;:null,&amp;quot;opName&amp;quot;:&amp;quot;PUSH1&amp;quot;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;summary-line&quot;&gt;Summary Line&lt;&#x2F;h3&gt;
&lt;p&gt;At the end of execution, the client SHOULD print summary info. This summary MUST be a single JSON
object.&lt;&#x2F;p&gt;
&lt;p&gt;This info SHOULD have the following members.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Explanation&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;stateRoot&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Hex-String&lt;&#x2F;td&gt;&lt;td&gt;Root of the state trie after executing the transaction&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;output&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Hex-String&lt;&#x2F;td&gt;&lt;td&gt;Return values of the function&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;gasUsed&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Number&lt;&#x2F;td&gt;&lt;td&gt;All gas used by the transaction&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;pass&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Boolean&lt;&#x2F;td&gt;&lt;td&gt;If the tx was successful, or if the test passed&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;time&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Number&lt;&#x2F;td&gt;&lt;td&gt;Time in nanoseconds needed to execute the transaction&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;fork&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;String&lt;&#x2F;td&gt;&lt;td&gt;Name of the fork rules used for execution&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;time&lt;&#x2F;code&gt; and &lt;code&gt;fork&lt;&#x2F;code&gt; fields MAY be provided.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;Example&lt;&#x2F;em&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&amp;quot;stateRoot&amp;quot;:&amp;quot;0xd4c577737f5d20207d338c360c42d3af78de54812720e3339f7b27293ef195b7&amp;quot;,&amp;quot;output&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;gasUsed&amp;quot;:&amp;quot;0x3&amp;quot;,&amp;quot;pass&amp;quot;:&amp;quot;true&amp;quot;,&amp;quot;time&amp;quot;:141485}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is an extension of the EIP-3155 tracing features that has been in use for years. Rather
than dramatically re-boot the feature, the information was added to the existing traces.&lt;&#x2F;p&gt;
&lt;p&gt;A &quot;mini&quot; trace was contemplated to allow for tracing to be included in tools such as
&lt;code&gt;t8n&lt;&#x2F;code&gt; and to allow for more efficient RPC tracing calls, but that seemed sufficiently different that
it would be a stand-alone EIP rather than an EIP that adds features to the existing tracing
capabilities.&lt;&#x2F;p&gt;
&lt;p&gt;The idea of moving to a JSON Schema was rejected to ensure maximum compatibility with existing
clients.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Clients emitting tracing JSON for uncontained &quot;legacy&quot; contracts will produce a compatible trace,
except as outlined below&lt;&#x2F;p&gt;
&lt;h3 id=&quot;changes-from-eip-3155&quot;&gt;Changes from EIP-3155&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;The term Client Under Test or CUT has been replaced simply with &quot;client.&quot;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;gas&lt;&#x2F;code&gt;, &lt;code&gt;gasCost&lt;&#x2F;code&gt;, and &lt;code&gt;gasUsed&lt;&#x2F;code&gt; are now Number types.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;opcode&lt;&#x2F;code&gt; is now a Hex-Number type.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;additions-to-eip-3155&quot;&gt;Additions to EIP-3155&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;immediate&lt;&#x2F;code&gt; member was added to support the large number of instructions that contain
immediate operations. Without this change, users would need bytes of the contracts being executed
to rationalize the traces.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;section&lt;&#x2F;code&gt; and &lt;code&gt;functionDepth&lt;&#x2F;code&gt; members were added to support &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4750&#x2F;&quot;&gt;EIP-4750&lt;&#x2F;a&gt; EOF
Functions.&lt;&#x2F;li&gt;
&lt;li&gt;Added clarification around where &lt;code&gt;pc&lt;&#x2F;code&gt; indexes when run in an EOF container.&lt;&#x2F;li&gt;
&lt;li&gt;Added Hex-Number&#x2F;Number interchangeability expectations. Clients MAY provide either types when
one is specified and consumers SHOULD be prepared to accept either type. Clients SHOULD provide a
flag to output members with the specified number type only.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;clients&quot;&gt;Clients&lt;&#x2F;h3&gt;
&lt;p&gt;Besu, evmone, EthereumJS, Geth, Nethermind, and Reth already produce these standard traces in
various tools. Adding the new fields will align with work needed to support the EOF EIPs enumerated
in EIP-7692.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;This is the trace output from the Ethereum Execution Specification Test from one of the
parameterized executions of &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;execution-spec-tests&#x2F;blob&#x2F;632d151ea8a71d09a3a0acbdb85d97fa18c8456b&#x2F;tests&#x2F;prague&#x2F;eip7692_eof_v1&#x2F;eip3540_eof_v1&#x2F;test_execution_function.py#L304-L335&quot;&gt;test_eof_functions_contract_call_succeed&lt;&#x2F;a&gt;.
Memory and return data is disabled.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;jsonl&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;pc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;op&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x60&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;49979000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gasCost&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;memSize&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;stack&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;depth&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;refund&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;opName&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;PUSH1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;pc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;op&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x60&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;49978997&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gasCost&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;memSize&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;stack&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;depth&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;refund&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;opName&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;PUSH1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;pc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;op&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x60&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;49978994&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gasCost&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;memSize&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;stack&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;depth&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;refund&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;opName&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;PUSH1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;pc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;6&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;op&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x60&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;49978991&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gasCost&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;memSize&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;stack&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;depth&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;refund&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;opName&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;PUSH1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;pc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;8&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;op&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x60&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;49978988&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gasCost&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;memSize&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;stack&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;depth&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;refund&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;opName&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;PUSH1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;pc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;op&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x61&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;49978985&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gasCost&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;memSize&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;stack&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;depth&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;refund&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;opName&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;PUSH2&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;pc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;13&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;op&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x5a&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;49978982&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gasCost&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;memSize&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;stack&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;depth&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;refund&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;opName&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;GAS&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;pc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;14&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;op&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xf1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;49978980&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gasCost&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;49198100&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;memSize&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;stack&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x2fa9e64&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;depth&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;refund&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;opName&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;CALL&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;pc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;25&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;section&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;op&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xe3&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;immediate&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0001&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;49195500&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gasCost&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;5&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;memSize&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;stack&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;depth&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;refund&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;opName&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;CALLF&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;pc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;29&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;section&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;op&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xe4&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;49195495&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gasCost&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;memSize&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;stack&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;depth&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;functionDepth&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;refund&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;opName&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;RETF&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;pc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;28&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;section&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;op&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x00&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;49195492&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gasCost&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;memSize&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;stack&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;depth&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;refund&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;opName&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;STOP&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;pc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;15&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;op&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x60&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;49976372&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gasCost&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;memSize&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;stack&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;depth&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;refund&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;opName&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;PUSH1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;pc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;17&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;op&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x55&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;49976369&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gasCost&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;22100&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;memSize&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;stack&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;depth&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;refund&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;opName&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;SSTORE&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;pc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;18&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;op&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x00&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;49954269&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gasCost&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;memSize&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;stack&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;depth&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;refund&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;opName&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;STOP&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;output&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gasUsed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;45731&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;fork&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Osaka&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;postHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x2c47b4070c1eef501d9548959c3abde2d8dc78ed1d819697c61d2b0861cc78cf&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;pass&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;true&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Clients should be aware that tracing can be expensive both in terms of CPU overhead and network
bandwidth. Tracing endpoints should not be enabled by default, and when they are enabled should have
access restrictions on the network level. Failure to do so could result in a client being
overwhelmed with requests and, if operating as a validator, cause the client to fail to provide
execution attestations in a timely manner.&lt;&#x2F;p&gt;
&lt;p&gt;Differential fuzzing is also a double-edged sword. While it allows client teams the ability to
identify consensus splits, the client teams need to be prompt in fixing any issues that are
discovered.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>GAS2ETH opcode</title>
        <published>2024-08-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Charles Cooper</name><uri>https://github.com/charles-cooper</uri>
	</author>
	
	<author>
		<name>pcaversaccio</name><uri>https://github.com/pcaversaccio</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7791/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7791-gas2eth-opcode/21418" />
        

        <id>https://wg-eips.ritovision.com/7791/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7791"
            label="EIP-7791" />
        

        
        

        
        <summary type="html">Introduces a new opcode, `GAS2ETH`, to convert gas to ETH</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7791/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a new &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; opcode that enables the direct conversion of gas into ether (ETH).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is based on the premise that smart contract authors, compiler teams, and public goods projects in general should be compensated for their contributions. Moreover, their compensation should &lt;em&gt;scale&lt;&#x2F;em&gt; with the usage of their contracts. A widely used and popular contract offers significant value to its users through its functionality and to the network by driving demand for blockspace — Ethereum&#x27;s &lt;em&gt;raison d&#x27;être&lt;&#x2F;em&gt;. This increased demand also benefits miners and validators, who are rewarded for executing these contracts.&lt;&#x2F;p&gt;
&lt;p&gt;Monetizing smart contracts in a scalable manner remains challenging at the time of this writing. This difficulty is evident from existence of many different monetization strategies employed across various smart contracts — ranging from fee structures to the issuance of tokens with &quot;tokenomics&quot; of varying levels of complexity. Additionally, many public goods projects struggle to secure funding.&lt;&#x2F;p&gt;
&lt;p&gt;Introducing the &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; opcode offers contract authors, as well as the tools they use, a new way to achieve their monetization objectives. By charging gas, they integrate with an established user experience that is both familiar and understood by users. The proposed instruction ensures that existing transaction creation and processing tools remain unchanged. Moreover, by charging gas, contract authors align economically with network activity; they benefit from higher compensation during periods of intense network usage and receive less when activity is low. This helps align the incentives of smart contract authors, validators, and the broader network.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;A new opcode, &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; (&lt;code&gt;0xFC&lt;&#x2F;code&gt;), is introduced to enable direct conversion of gas into ETH within the EVM. This opcode operates under a new budgeting mechanism: each transaction maintains a &lt;em&gt;global&lt;&#x2F;em&gt; &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; budget initialized to the transaction gas limit (&lt;code&gt;tx.gas_limit&lt;&#x2F;code&gt;), and each call frame derives a &lt;em&gt;local&lt;&#x2F;em&gt; allowance from the gas forwarded to it. These budgets cap the total amount of gas that can be converted into ETH, both per call frame and across the entire transaction.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;execution-semantics&quot;&gt;Execution Semantics&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; (&lt;code&gt;0xFC&lt;&#x2F;code&gt;) opcode executes according to the following rules:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Pops two values from the stack: &lt;code&gt;addr&lt;&#x2F;code&gt; then &lt;code&gt;gas_amount&lt;&#x2F;code&gt;. If there are fewer than two values on the stack, the calling context MUST fail with stack underflow.&lt;&#x2F;li&gt;
&lt;li&gt;Deducts &lt;code&gt;gas_amount&lt;&#x2F;code&gt; from both the current call frame&#x27;s local &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; allowance and the transaction-global &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; budget.
&lt;ul&gt;
&lt;li&gt;If &lt;code&gt;gas_amount&lt;&#x2F;code&gt; is greater than the current call frame&#x27;s local &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; allowance or the remaining transaction-global &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; budget, set &lt;code&gt;gas_amount&lt;&#x2F;code&gt; to &lt;code&gt;min(gas_amount, remaining_local_allowance, remaining_global_GAS2ETH_budget)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Computes &lt;code&gt;wei_val&lt;&#x2F;code&gt; by multiplying &lt;code&gt;gas_amount&lt;&#x2F;code&gt; by the current transaction context&#x27;s &lt;code&gt;gas_price&lt;&#x2F;code&gt; (&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;execution-specs&#x2F;blob&#x2F;98d6ddaaa709a2b7d0cd642f4cfcdadc8c0808e1&#x2F;src&#x2F;ethereum&#x2F;cancun&#x2F;vm&#x2F;instructions&#x2F;environment.py#L325&quot;&gt;EELS&lt;&#x2F;a&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;Endows the address &lt;code&gt;addr&lt;&#x2F;code&gt; with &lt;code&gt;wei_val&lt;&#x2F;code&gt; wei.&lt;&#x2F;li&gt;
&lt;li&gt;Pushes &lt;code&gt;wei_val&lt;&#x2F;code&gt; onto the stack.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;On reverts (e.g., through the &lt;code&gt;REVERT&lt;&#x2F;code&gt; opcode or any exceptional halt), any gas paid out via &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; MUST be refunded to both the transaction-global and the parent call frame&#x27;s budgets.&lt;&#x2F;p&gt;
&lt;p&gt;Note that the transfer of &lt;code&gt;wei_val&lt;&#x2F;code&gt; to the target account cannot fail. In particular, the destination account code (if any) is not executed, or, if the account does not exist, the balance is still added to the given address &lt;code&gt;addr&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Gas consumed by &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; does not affect the base fee, burn, block &lt;code&gt;gasUsed&lt;&#x2F;code&gt;, or the transaction fee. Instead, the ETH transfer represents a direct payment from the transaction signer (i.e. &lt;code&gt;tx.origin&lt;&#x2F;code&gt;) to the recipient address, outside the block reward and fee accounting mechanisms. This ensures no duplication of ETH between the &lt;code&gt;COINBASE&lt;&#x2F;code&gt; reward and the amount transferred via &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas2eth-budgeting-model&quot;&gt;&lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; Budgeting Model&lt;&#x2F;h3&gt;
&lt;p&gt;A transaction maintains a single global &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; budget initialized to the transaction gas limit (&lt;code&gt;tx.gas_limit&lt;&#x2F;code&gt;). Each call frame also maintains a local allowance, derived automatically from the gas forwarded to it:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;On &lt;code&gt;CALL&lt;&#x2F;code&gt;, &lt;code&gt;CALLCODE&lt;&#x2F;code&gt;, or &lt;code&gt;STATICCALL&lt;&#x2F;code&gt;: &lt;code&gt;allowance = min(forwarded_gas, remaining_global_GAS2ETH_budget)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;On &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;: the callee shares the caller&#x27;s allowance.&lt;&#x2F;li&gt;
&lt;li&gt;On revert: all &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; deductions within that call frame are refunded to both the transaction-global and parent frame&#x27;s budgets.&lt;&#x2F;li&gt;
&lt;li&gt;On normal return: any unused local allowance is returned to the transaction-global &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; budget.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This model ensures that untrusted callees cannot consume more &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; than the gas explicitly forwarded to them, while keeping total &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; creation bounded by the transaction&#x27;s gas limit.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-cost&quot;&gt;Gas cost&lt;&#x2F;h3&gt;
&lt;p&gt;The proposed cost of this opcode is identical to the recently proposed &lt;code&gt;PAY&lt;&#x2F;code&gt; opcode.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Definition&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;WARM_STORAGE_READ_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;COLD_ACCOUNT_ACCESS_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;GAS_NEW_ACCOUNT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;execution-specs&#x2F;blob&#x2F;4d953035fb0cceda7cf21d71b2ab7a9a6f4632f0&#x2F;src&#x2F;ethereum&#x2F;frontier&#x2F;vm&#x2F;gas.py#L52&quot;&gt;EELS&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;GAS_CALL_VALUE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;execution-specs&#x2F;blob&#x2F;4d953035fb0cceda7cf21d71b2ab7a9a6f4632f0&#x2F;src&#x2F;ethereum&#x2F;frontier&#x2F;vm&#x2F;gas.py#L53&quot;&gt;EELS&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;gas-calculation&quot;&gt;Gas calculation&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Is &lt;code&gt;addr&lt;&#x2F;code&gt; in &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt;?
&lt;ul&gt;
&lt;li&gt;If yes, &lt;code&gt;WARM_STORAGE_READ_COST&lt;&#x2F;code&gt;;&lt;&#x2F;li&gt;
&lt;li&gt;Otherwise, &lt;code&gt;COLD_ACCOUNT_ACCESS_COST&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Does &lt;code&gt;addr&lt;&#x2F;code&gt; exist or is &lt;code&gt;val&lt;&#x2F;code&gt; zero?
&lt;ul&gt;
&lt;li&gt;If yes to either, zero;&lt;&#x2F;li&gt;
&lt;li&gt;Otherwise, &lt;code&gt;GAS_NEW_ACCOUNT&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Is &lt;code&gt;val&lt;&#x2F;code&gt; zero?
&lt;ul&gt;
&lt;li&gt;If yes, zero;&lt;&#x2F;li&gt;
&lt;li&gt;Otherwise, &lt;code&gt;GAS_CALL_VALUE&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; vs. pro-rata: The pro-rata model incentivizes inflating contract gas usage to artificially increase fees. In contrast, this proposal allows contract authors to charge their desired amount directly, eliminating the need for unnecessary gas consumption.&lt;&#x2F;li&gt;
&lt;li&gt;Target address vs. simply increasing balance of the currently executing contract: Using a target address is more flexible, enabling contract authors to write more modular code and separate the concerns of fee collection from contract functionality. For instance, the contract may want to designate a specific recipient for fees without necessarily granting them direct withdrawal access.&lt;&#x2F;li&gt;
&lt;li&gt;Charging gas instead of ETH: Charging ETH directly complicates the user experience and prevents contract authors from participating in fluctuations in gas demand directly.&lt;&#x2F;li&gt;
&lt;li&gt;For the value of &lt;code&gt;gas_price&lt;&#x2F;code&gt;, use the same gas price as which is used to calculate the tx cost in ETH. This leads to the most consistent computation between &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; and the user&#x27;s experience when creating a transaction.&lt;&#x2F;li&gt;
&lt;li&gt;Separate budget: Having a separate budget prevents certain types of DoS attacks where usage of &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; can interfere with the actual budget needed for execution of the contract. (For example, a target contract can &quot;waste&quot; gas with &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt;, resulting in the caller not having enough gas to finish execution). This also results in &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; usage not affecting the burn rate. The intuition is that, since it doesn&#x27;t actually use computational resources (which gas normally &quot;accounts&quot; for), it shouldn&#x27;t affect blockspace computations or the base fee.&lt;&#x2F;li&gt;
&lt;li&gt;Budget being 100% of the gas limit: 100% of the gas limit is a &quot;natural&quot; bound on the gas used and provides some protection to the user from unbounded &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; spending. In the future, a new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt;-based transaction type could be added which includes an explicitly user-specified &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; budget.&lt;&#x2F;li&gt;
&lt;li&gt;No exceptional halt when &lt;code&gt;gas_amount&lt;&#x2F;code&gt; exceeds the remaining budgets, both the current call frame&#x27;s local &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; allowance and the transaction-global &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; budget. Since these budgets are not introspectable, the contract would otherwise have no way to gracefully avoid an exceptional halt.&lt;&#x2F;li&gt;
&lt;li&gt;Bounding by execution gas ensures that untrusted callees cannot consume more &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; than the gas explicitly forwarded to them.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Like the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5920&#x2F;&quot;&gt;&lt;code&gt;PAY&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; opcode and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4895&#x2F;&quot;&gt;beacon withdrawals&lt;&#x2F;a&gt;, &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; enables ETH transfers that occur without code execution in the recipient account. To prevent denial-of-service (DoS) attacks from untrusted callees, each call frame receives a local &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; allowance automatically derived from the gas &lt;em&gt;forwarded&lt;&#x2F;em&gt; to it, while a transaction-global &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; budget enforces an overall cap equal to the transaction&#x27;s gas limit. This ensures that:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Callees cannot deplete the sender&#x27;s &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; budget beyond the gas explicitly forwarded to them.&lt;&#x2F;li&gt;
&lt;li&gt;Contracts calling into untrusted code remain robust, as the callee&#x27;s &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; spending capacity is naturally limited by its gas stipend.&lt;&#x2F;li&gt;
&lt;li&gt;The total ETH that can be created via &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; in a transaction is strictly bounded.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;It&#x27;s important to note that &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; introduces an economic incentive for malicious contracts to consume as much of their allowance as possible, converting previously non-profitable griefing vectors into potentially profitable ones. Contract authors SHOULD minimize forwarded gas and &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; exposure when interacting with untrusted code, similar to existing best practices for limiting gas stipends or ETH transfers.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Wrapping of bubbled up reverts</title>
        <published>2024-08-06T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Daniel Gretzke</name><uri>https://github.com/gretzke</uri>
	</author>
	
	<author>
		<name>Sara Reynolds</name><uri>https://github.com/snreynolds</uri>
	</author>
	
	<author>
		<name>Alice Henshaw</name><uri>https://github.com/hensha256</uri>
	</author>
	
	<author>
		<name>Marko Veniger</name><email>marko.veniger@tenderly.co</email>
	</author>
	
	<author>
		<name>Hadrien Croubois</name><uri>https://github.com/Amxx</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7751/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7751-wrapping-of-bubbled-up-reverts/20740" />
        

        <id>https://wg-eips.ritovision.com/7751/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:7751"
            label="ERC-7751" />
        

        
        

        
        <summary type="html">Handling bubbled up reverts using custom errors with additional context</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7751/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC proposes a standard for handling bubbled up reverts in Ethereum smart contracts using a dedicated custom error. This standard aims to improve the clarity and usability of revert reasons by allowing additional context to be passed alongside the raw bytes of the bubbled up revert. The &lt;code&gt;WrappedError&lt;&#x2F;code&gt; custom error should wrap reverts from called contracts and provide a consistent interface for parsing and handling reverts in tools like Etherscan or Tenderly.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, when a smart contract calls another and the called contract reverts, the revert reason is usually bubbled up and thrown as is. This can make it more difficult to tell which context the error came from. By standardizing the use of custom errors with additional context, more meaningful and informative revert reasons can be provided. This will improve the debugging experience and make it easier for developers and infrastructure providers like Etherscan to display accurate stack traces.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;In order to wrap a revert, a contract MUST revert with the following error that corresponds to the following signature &lt;code&gt;0x90bfb865&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; WrappedError&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; target&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes4&lt;&#x2F;span&gt;&lt;span&gt; selector&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt; reason&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt; details&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;target&lt;&#x2F;code&gt; is the address of the called contract that reverted.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;selector&lt;&#x2F;code&gt; is the selector of the called function that reverted. If the call was an ETH transfer without any data, the selector MUST be &lt;code&gt;bytes4(0)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;reason&lt;&#x2F;code&gt; is the raw bytes of the revert reason.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;details&lt;&#x2F;code&gt; is optional additional context about the revert. In cases where no additional context is needed, the &lt;code&gt;details&lt;&#x2F;code&gt; bytes can be empty. In cases with additional context, the &lt;code&gt;details&lt;&#x2F;code&gt; bytes MUST be an ABI encoded custom error declared on the contract that emits the &lt;code&gt;WrappedError&lt;&#x2F;code&gt; error.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;By including the called contract and function, raw revert bytes and additional context, developers can provide more detailed information about the failure. Additionally, by standardizing the way reverts are bubbled up, it also enables nested bubbled up reverts where multiple reverts thrown by different contracts can be followed recursively. The reverts can also be parsed and handled by tools like Etherscan and Foundry to further enhance the readability and debuggability of smart contract interactions, as well as facilitating better error handling practices in general.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC does not introduce any backwards incompatibilities. Existing contracts can adopt this standard incrementally.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0.8.26&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Token&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;balanceOf&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;insufficient balance&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        balanceOf&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        balanceOf&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Vault&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Token token&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; WrappedError&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; target&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes4&lt;&#x2F;span&gt;&lt;span&gt; selector&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt; reason&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt; details&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC20TransferFailed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Token&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        token &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; token_&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; withdraw&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; logic&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        try&lt;&#x2F;span&gt;&lt;span&gt; token&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; catch&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; error&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; WrappedError&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; token&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;transfer&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; error&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodeWithSelector&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ERC20TransferFailed&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Router&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Vault vault&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; WrappedError&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; target&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes4&lt;&#x2F;span&gt;&lt;span&gt; selector&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt; reason&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt; details&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Vault&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; vault_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        vault &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; vault_&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; withdraw&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; logic&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        try&lt;&#x2F;span&gt;&lt;span&gt; vault&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;withdraw&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; catch&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; error&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; WrappedError&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;vault&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; vault&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;withdraw&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; error&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Test&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; test_BubbledNestedReverts&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        Token token &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Token&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        Vault vault &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Vault&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        Router router &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Router&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;vault&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        try&lt;&#x2F;span&gt;&lt;span&gt; router&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;withdraw&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; catch&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; thrownError&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; expectedError &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodeWithSelector&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                Router&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;WrappedError&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;vault&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; vault&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;withdraw&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodeWithSelector&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    Vault&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;WrappedError&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    token&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;transfer&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;                    abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodeWithSignature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;Error(string)&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;insufficient balance&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;                    abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodeWithSelector&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;Vault&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;ERC20TransferFailed&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                )&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            assert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;thrownError&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;expectedError&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;When catching a revert from a called contract, the calling contract should revert with a custom error following the above conventions.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Foo&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; WrappedError&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; target&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes4&lt;&#x2F;span&gt;&lt;span&gt; selector&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt; reason&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt; details&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MyCustomError&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; foo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; logic&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt; success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; returnData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; WrappedError&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes4&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; returnData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodeWithSelector&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;MyCustomError&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 42&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Smart contracts could either drop or purposefully suppress the bubbled up reverts along the revert chain. Additionally, smart contracts may also lie or incorrectly report the wrapped reverts, so the information is not guaranteed to be accurate.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Decentralized Employment System</title>
        <published>2024-08-04T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>James Savechives</name><uri>https://github.com/jamesavechives</uri><email>james.walstonn@gmail.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7750/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7750-decentralized-employment-system-des/20724" />
        

        <id>https://wg-eips.ritovision.com/7750/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:7750"
            label="ERC-7750" />
        

        
        

        
        <summary type="html">An employment system that records employment history.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7750/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC proposes a Decentralized Employment System (DES) built on the Ethereum blockchain. The DES facilitates the creation and management of companies, records comprehensive employment histories through unique employee tokens, enables the formation and execution of labor contracts, automates salary payments via an escrow mechanism, incorporates a robust moderation system for dispute resolution, and implements a reputation-based review system for both employers and employees. By leveraging blockchain&#x27;s transparency and immutability, the DES ensures accountability and trust throughout the employment lifecycle, from company creation and hiring to contract fulfillment and termination.&lt;&#x2F;p&gt;
&lt;p&gt;The system operates post employee testing and prior to the final hiring and contract signing. Employees possess a &lt;strong&gt;Soulbound Token (SBT)&lt;&#x2F;strong&gt; representing their employment history, which companies review before finalizing labor contracts. This token-based approach ensures a secure and verifiable employment record that enhances the hiring process&#x27;s integrity.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Traditional employment systems are centralized, opaque, and often lack trust. The DES aims to introduce transparency, immutability, and trust into the employment process by leveraging blockchain technology. By recording employment history on-chain, enabling decentralized company creation, automating contract enforcement, and providing mechanisms for dispute resolution, the DES promotes a fairer and more transparent employment ecosystem. Additionally, the system streamlines the hiring process by securely managing employment records and automating contractual obligations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;solidity-interface&quot;&gt;Solidity Interface&lt;&#x2F;h3&gt;
&lt;p&gt;To provide a clear and standardized way for developers to interact with the DES, the following Solidity interface outlines the primary functions and events of the system:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Decentralized Employment System Interface&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IDecentralizedEmploymentSystem&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Events&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CompanyRegistered&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; companyId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; industry&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EmployeeTokenMinted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; employee&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ContractCreated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contractId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; companyId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; employeeTokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; salary&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; duration&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ContractExecuted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contractId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SalaryDeposited&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contractId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SalaryReleased&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contractId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; employee&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DisputeRaised&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contractId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; raisedBy&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DisputeResolved&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contractId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; decisionForEmployee&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ContractTerminated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contractId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; reason&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ReviewSubmitted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contractId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; rating&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; comments&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Company Management&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; registerCompany&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; industry&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; companyId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getCompany&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; companyId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; industry&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; employeeIds&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Employee Management&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mintEmployeeToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; employee&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; metadataURI&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getEmploymentHistory&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; employeeTokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contractIds&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Labor Contracts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; createContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; companyId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; employeeTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; salary&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; duration&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; responsibilities&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; terminationConditions&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contractId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; executeContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contractId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Payment System&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; depositSalary&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contractId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; releaseSalary&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contractId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Dispute Resolution&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; raiseDispute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contractId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; resolveDispute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contractId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; decisionForEmployee&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Contract Termination&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; terminateContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contractId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; reason&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; Review&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; System&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; submitReview&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contractId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; rating&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; comments&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getReviews&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contractId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Review&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Structures&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Review&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span&gt; rating&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt; comments&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; reviewer&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;detailed-function-specifications&quot;&gt;Detailed Function Specifications&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;1-company-management&quot;&gt;1. Company Management&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;a. Company Registration&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Function&lt;&#x2F;strong&gt;: &lt;code&gt;registerCompany(string calldata name, string calldata industry) external returns (uint companyId)&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Description&lt;&#x2F;strong&gt;: Allows users to register a new company on the blockchain. Each company is assigned a unique &lt;code&gt;companyId&lt;&#x2F;code&gt; and associated with the caller&#x27;s address as the owner.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Parameters&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;name&lt;&#x2F;code&gt;: The name of the company.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;industry&lt;&#x2F;code&gt;: The industry sector of the company.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Returns&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;companyId&lt;&#x2F;code&gt;: A unique identifier for the registered company.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;b. Retrieve Company Profile&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Function&lt;&#x2F;strong&gt;: &lt;code&gt;getCompany(uint companyId) external view returns (string memory name, string memory industry, address owner, uint[] memory employeeIds)&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Description&lt;&#x2F;strong&gt;: Retrieves the profile details of a registered company, including its name, industry, owner address, and a list of associated employee token IDs.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Parameters&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;companyId&lt;&#x2F;code&gt;: The unique identifier of the company.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Returns&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;name&lt;&#x2F;code&gt;: Name of the company.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;industry&lt;&#x2F;code&gt;: Industry sector of the company.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;owner&lt;&#x2F;code&gt;: Ethereum address of the company owner.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;employeeIds&lt;&#x2F;code&gt;: Array of employee token IDs associated with the company.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;2-employee-management&quot;&gt;2. Employee Management&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;a. Employee Tokenization&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Function&lt;&#x2F;strong&gt;: &lt;code&gt;mintEmployeeToken(address employee, string calldata metadataURI) external returns (uint tokenId)&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Description&lt;&#x2F;strong&gt;: Mints a &lt;strong&gt;Soulbound Token (SBT)&lt;&#x2F;strong&gt; representing an employee. The token contains metadata about the employee, such as professional credentials, stored off-chain and referenced via &lt;code&gt;metadataURI&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Parameters&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;employee&lt;&#x2F;code&gt;: Ethereum address of the employee.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;metadataURI&lt;&#x2F;code&gt;: URI pointing to the employee&#x27;s metadata.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Returns&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;tokenId&lt;&#x2F;code&gt;: A unique identifier for the employee token.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;b. Retrieve Employment History&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Function&lt;&#x2F;strong&gt;: &lt;code&gt;getEmploymentHistory(uint employeeTokenId) external view returns (uint[] memory contractIds)&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Description&lt;&#x2F;strong&gt;: Fetches the complete employment history of an employee by returning an array of associated &lt;code&gt;contractIds&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Parameters&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;employeeTokenId&lt;&#x2F;code&gt;: The unique identifier of the employee&#x27;s token.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Returns&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;contractIds&lt;&#x2F;code&gt;: Array of contract IDs representing the employee&#x27;s employment history.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;3-labor-contracts&quot;&gt;3. Labor Contracts&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;a. Contract Creation&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Function&lt;&#x2F;strong&gt;: &lt;code&gt;createContract(uint companyId, uint employeeTokenId, uint salary, uint duration, string calldata responsibilities, string calldata terminationConditions) external returns (uint contractId)&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Description&lt;&#x2F;strong&gt;: Enables a company to create a new labor contract with an employee. This function assigns a unique &lt;code&gt;contractId&lt;&#x2F;code&gt; to the contract.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Parameters&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;companyId&lt;&#x2F;code&gt;: The unique identifier of the company initiating the contract.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;employeeTokenId&lt;&#x2F;code&gt;: The unique identifier of the employee&#x27;s token.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;salary&lt;&#x2F;code&gt;: The agreed-upon salary for the contract period.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;duration&lt;&#x2F;code&gt;: Duration of the contract in months.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;responsibilities&lt;&#x2F;code&gt;: Description of the employee&#x27;s responsibilities.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;terminationConditions&lt;&#x2F;code&gt;: Conditions under which the contract can be terminated.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Returns&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;contractId&lt;&#x2F;code&gt;: A unique identifier for the newly created contract.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;b. Contract Execution&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Function&lt;&#x2F;strong&gt;: &lt;code&gt;executeContract(uint contractId) external&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Description&lt;&#x2F;strong&gt;: Activates the contract by marking it as active once both the company and the employee have agreed to the terms by signing the transaction with their respective wallets.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Parameters&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;contractId&lt;&#x2F;code&gt;: The unique identifier of the contract to be executed.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;4-payment-system&quot;&gt;4. Payment System&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;a. Salary Deposits&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Function&lt;&#x2F;strong&gt;: &lt;code&gt;depositSalary(uint contractId) external payable&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Description&lt;&#x2F;strong&gt;: Allows the company to deposit the agreed salary into the contract&#x27;s escrow. The function ensures that the deposited amount matches the contract&#x27;s salary.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Parameters&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;contractId&lt;&#x2F;code&gt;: The unique identifier of the contract for which the salary is being deposited.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Payable&lt;&#x2F;strong&gt;: Yes, the function is payable to accept the salary funds.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;b. Automated Payments&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Function&lt;&#x2F;strong&gt;: &lt;code&gt;releaseSalary(uint contractId) external&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Description&lt;&#x2F;strong&gt;: Releases the salary from escrow to the employee&#x27;s address based on the contract&#x27;s payment schedule or upon contract completion.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Parameters&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;contractId&lt;&#x2F;code&gt;: The unique identifier of the contract for which the salary is being released.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;5-dispute-resolution&quot;&gt;5. Dispute Resolution&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;a. Dispute Initiation&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Function&lt;&#x2F;strong&gt;: &lt;code&gt;raiseDispute(uint contractId) external&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Description&lt;&#x2F;strong&gt;: Allows either party involved in the contract to initiate a dispute. This action triggers the assignment of a moderator to resolve the issue.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Parameters&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;contractId&lt;&#x2F;code&gt;: The unique identifier of the contract in dispute.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;b. Dispute Resolution&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Function&lt;&#x2F;strong&gt;: &lt;code&gt;resolveDispute(uint contractId, bool decisionForEmployee) external&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Description&lt;&#x2F;strong&gt;: Enables the assigned moderator to resolve the dispute by making a decision. If the decision favors the employee, escrow funds are transferred accordingly; otherwise, they may be returned to the company.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Parameters&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;contractId&lt;&#x2F;code&gt;: The unique identifier of the contract under dispute.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;decisionForEmployee&lt;&#x2F;code&gt;: Boolean indicating if the decision favors the employee.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;6-contract-termination&quot;&gt;6. Contract Termination&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;a. Termination Conditions&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Function&lt;&#x2F;strong&gt;: &lt;code&gt;terminateContract(uint contractId, string calldata reason) external&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Description&lt;&#x2F;strong&gt;: Allows the company to terminate the contract based on predefined conditions. This function updates the contract status to &quot;terminated.&quot;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Parameters&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;contractId&lt;&#x2F;code&gt;: The unique identifier of the contract to be terminated.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;reason&lt;&#x2F;code&gt;: The reason for termination.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;7-review-system&quot;&gt;7. Review System&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;a. Submit Review&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Function&lt;&#x2F;strong&gt;: &lt;code&gt;submitReview(uint contractId, uint rating, string calldata comments) external&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Description&lt;&#x2F;strong&gt;: Enables both companies and employees to submit reviews post-contract. Reviews include a rating and comments, contributing to the reputation score of both parties.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Parameters&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;contractId&lt;&#x2F;code&gt;: The unique identifier of the contract being reviewed.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;rating&lt;&#x2F;code&gt;: Numerical rating reflecting the experience.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;comments&lt;&#x2F;code&gt;: Detailed feedback about the contract.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;b. Retrieve Reviews&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Function&lt;&#x2F;strong&gt;: &lt;code&gt;getReviews(uint contractId) external view returns (Review[] memory)&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Description&lt;&#x2F;strong&gt;: Retrieves all reviews associated with a specific contract.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Parameters&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;contractId&lt;&#x2F;code&gt;: The unique identifier of the contract whose reviews are being fetched.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Returns&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Review[]&lt;&#x2F;code&gt;: An array of reviews related to the contract.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;employment-history&quot;&gt;Employment History&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Immutable Records&lt;&#x2F;strong&gt;: Employment history is maintained as an array of contract IDs linked to each employee&#x27;s Soulbound Token (SBT). This ensures that all employment records are permanently and immutably stored on the blockchain.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Public Accessibility&lt;&#x2F;strong&gt;: Employment history data is publicly accessible through the &lt;code&gt;getEmploymentHistory&lt;&#x2F;code&gt; function, allowing companies to verify an employee&#x27;s past engagements before finalizing contracts.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;payment-system&quot;&gt;Payment System&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Salary Deposits&lt;&#x2F;strong&gt;: Companies deposit salaries into an escrow managed by the smart contract by calling &lt;code&gt;depositSalary&lt;&#x2F;code&gt;. The contract ensures that funds are securely held until payment conditions are satisfied.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Automated Payments&lt;&#x2F;strong&gt;: Salaries are released automatically or upon triggering the &lt;code&gt;releaseSalary&lt;&#x2F;code&gt; function, ensuring timely and condition-based payments to employees.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;moderation-and-dispute-resolution&quot;&gt;Moderation and Dispute Resolution&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Dispute Initiation and Resolution&lt;&#x2F;strong&gt;: Either party can raise disputes, which are then resolved by assigned moderators. Moderators act as impartial arbitrators to ensure fair outcomes based on contract terms and evidence provided.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;firing-employees&quot;&gt;Firing Employees&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Termination Conditions&lt;&#x2F;strong&gt;: Companies can terminate contracts based on predefined conditions, with the option for dispute resolution if termination is contested.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;review-system&quot;&gt;Review System&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Reputation Scores&lt;&#x2F;strong&gt;: Reviews contribute to the reputation scores of both companies and employees, fostering accountability and encouraging positive behavior within the ecosystem.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Employee Tokenization&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Utilizing &lt;strong&gt;Soulbound Tokens (SBTs)&lt;&#x2F;strong&gt; to represent employees ensures that each employee has a unique, non-transferable identity on the blockchain. This design choice enhances the integrity of employment records, making them tamper-proof and verifiable. It also allows companies to access a comprehensive employment history before finalizing contracts, promoting transparency.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Escrow System for Salary Payments&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Implementing an escrow mechanism secures salary payments, ensuring that funds are only released when contractual obligations are met. This system protects both employees and companies by guaranteeing that salaries are available and that payments are contingent on contract fulfillment.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Moderation and Dispute Resolution&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Incorporating a moderation system allows for the resolution of disputes that cannot be automatically enforced by smart contracts. Moderators provide necessary human oversight in complex employment matters, ensuring fair and just outcomes.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Public Employment History&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Making employment history publicly accessible fosters trust and accountability. It allows potential employers to verify past employment and credentials, reducing the risk of fraud and enhancing the credibility of employees within the ecosystem.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Review System&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A reputation-based review system encourages positive interactions and behaviors among users. By allowing both companies and employees to submit reviews, the system promotes mutual accountability and helps build reliable reputations.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Company Creation&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Input&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;A user calls &lt;code&gt;registerCompany(&quot;TechCorp&quot;, &quot;Technology&quot;)&lt;&#x2F;code&gt;.
&lt;strong&gt;Expected State Changes&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;A new &lt;code&gt;companyId&lt;&#x2F;code&gt; is generated (e.g., &lt;code&gt;companyId = 1&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;companies&lt;&#x2F;code&gt; mapping is updated:&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   companies&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;↦&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    name&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;TechCorp&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    industry&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;Technology&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;callerAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    employeeIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt; ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;An event &lt;code&gt;CompanyRegistered&lt;&#x2F;code&gt; is emitted with the arguments &lt;code&gt;(1, callerAddress, &quot;TechCorp&quot;, &quot;Technology&quot;)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Expected Output&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Return Value&lt;&#x2F;strong&gt;: &lt;code&gt;companyId = 1&lt;&#x2F;code&gt; (the newly created company ID).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Event&lt;&#x2F;strong&gt;: &lt;code&gt;CompanyRegistered&lt;&#x2F;code&gt; is logged.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;ol start=&quot;2&quot;&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Employee Token Minting&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Input&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The contract owner (or an authorized address) calls &lt;code&gt;mintEmployeeToken(employeeAddress, &quot;ipfs:&#x2F;&#x2F;metadataURI&quot;)&lt;&#x2F;code&gt;.
&lt;strong&gt;Expected State Changes&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;A new token ID is generated (e.g., &lt;code&gt;tokenId = 5&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;An internal mapping (e.g., &lt;code&gt;employeeTokenToOwner&lt;&#x2F;code&gt;) is updated:&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   employeeTokenToOwner&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;5&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;↦employeeAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;(Optional) If the implementation tracks metadata, another mapping (e.g., &lt;code&gt;employeeTokenMetadata&lt;&#x2F;code&gt;) might store:&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   employeeTokenMetadata&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;5&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;↦&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;ipfs:&#x2F;&#x2F;metadataURI&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;An event &lt;code&gt;EmployeeTokenMinted&lt;&#x2F;code&gt; is emitted with &lt;code&gt;(5, employeeAddress)&lt;&#x2F;code&gt;.
&lt;strong&gt;Expected Output&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Return Value&lt;&#x2F;strong&gt;: &lt;code&gt;tokenId = 5&lt;&#x2F;code&gt; (the newly minted employee token ID).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Event&lt;&#x2F;strong&gt;: &lt;code&gt;EmployeeTokenMinted&lt;&#x2F;code&gt; is logged.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Contract Creation and Execution&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Input&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;A company with &lt;code&gt;companyId = 1&lt;&#x2F;code&gt; calls:&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;   createContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;5&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;6&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;SoftwareDevelopment&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;Failuretomeetdeadlines&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;which returns &lt;code&gt;contractId&lt;&#x2F;code&gt;.
2. Both the company and the employee call &lt;code&gt;executeContract(contractId)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Expected State Changes&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Contract Creation&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;A new labor contract ID is generated, e.g., &lt;code&gt;contractId = 10&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;contracts&lt;&#x2F;code&gt; mapping is updated:&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   contracts&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;↦&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     companyId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     employeeTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;5&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     salary&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     duration&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;6&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     responsibilities&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;SoftwareDevelopment&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     terminationConditions&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;Failuretomeetdeadlines&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;status&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;Created&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ol start=&quot;3&quot;&gt;
&lt;li&gt;The system may also update a per-company or per-employee tracking structure (optional but typical):&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   companyContracts&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;push&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   employeeContracts&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;5&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;push&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ol start=&quot;4&quot;&gt;
&lt;li&gt;An event &lt;code&gt;ContractCreated&lt;&#x2F;code&gt; is emitted with arguments &lt;code&gt;(10, 1, 5, 1000, 6)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Contract Execution&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Upon calls from both parties, the contract’s status changes from &lt;code&gt;&quot;Created&quot;&lt;&#x2F;code&gt; to &lt;code&gt;&quot;Active&quot;&lt;&#x2F;code&gt;:&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   contracts&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;status↦&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;Active&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ol start=&quot;2&quot;&gt;
&lt;li&gt;An event &lt;code&gt;ContractExecuted&lt;&#x2F;code&gt; is emitted with &lt;code&gt;(10)&lt;&#x2F;code&gt; once both signatures&#x2F;confirmations are received.
&lt;strong&gt;Expected Output&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Return Value&lt;&#x2F;strong&gt; (from &lt;code&gt;createContract&lt;&#x2F;code&gt;): &lt;code&gt;contractId = 10&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Event&lt;&#x2F;strong&gt;: &lt;code&gt;ContractCreated(10, 1, 5, 1000, 6)&lt;&#x2F;code&gt; upon creation.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Event&lt;&#x2F;strong&gt;: &lt;code&gt;ContractExecuted(10)&lt;&#x2F;code&gt; once execution is confirmed by both parties.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Salary Deposit&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Input&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The company (owner of &lt;code&gt;companyId = 1&lt;&#x2F;code&gt;) calls &lt;code&gt;depositSalary(10)&lt;&#x2F;code&gt; and sends &lt;code&gt;1000 USDC&lt;&#x2F;code&gt; (or equivalent in wei for an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; token or native token) to the contract.
&lt;strong&gt;Expected State Changes&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;ol&gt;
&lt;li&gt;The contract’s escrow balance mapping is updated:&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   escrowBalances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;↦&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ol start=&quot;2&quot;&gt;
&lt;li&gt;An event &lt;code&gt;SalaryDeposited&lt;&#x2F;code&gt; is emitted with &lt;code&gt;(10, 1000)&lt;&#x2F;code&gt;.
&lt;strong&gt;Expected Output&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Event&lt;&#x2F;strong&gt;: &lt;code&gt;SalaryDeposited(10, 1000)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;The contract’s internal &lt;code&gt;escrowBalances[10]&lt;&#x2F;code&gt; should now be &lt;code&gt;1000&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Salary Payment&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Input&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;After the contract’s duration or satisfaction of any release condition, &lt;code&gt;releaseSalary(10)&lt;&#x2F;code&gt; is called (by the contract or the employee).
&lt;strong&gt;Expected State Changes&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;ol&gt;
&lt;li&gt;The escrow balance for &lt;code&gt;contractId = 10&lt;&#x2F;code&gt; is transferred to the employee token owner (&lt;code&gt;employeeAddress&lt;&#x2F;code&gt; associated with token ID &lt;code&gt;5&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;escrowBalances[10]&lt;&#x2F;code&gt; is set to &lt;code&gt;0&lt;&#x2F;code&gt;:&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   escrowBalances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;↦&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ol start=&quot;3&quot;&gt;
&lt;li&gt;An event &lt;code&gt;SalaryReleased&lt;&#x2F;code&gt; is emitted with &lt;code&gt;(10, employeeAddress)&lt;&#x2F;code&gt;.
&lt;strong&gt;Expected Output&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Event&lt;&#x2F;strong&gt;: &lt;code&gt;SalaryReleased(10, employeeAddress)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;The updated &lt;code&gt;escrowBalances[10]&lt;&#x2F;code&gt; is now &lt;code&gt;0&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The employee’s on-chain balance (or token balance if using &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;) increases by &lt;code&gt;1000&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Employment Termination&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Input&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The company calls &lt;code&gt;terminateContract(10, &quot;Failure to meet deadlines&quot;)&lt;&#x2F;code&gt;.
&lt;strong&gt;Expected State Changes&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;ol&gt;
&lt;li&gt;The &lt;code&gt;contracts[10].status&lt;&#x2F;code&gt; is updated to &lt;code&gt;&quot;Terminated&quot;&lt;&#x2F;code&gt;:&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   contracts&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;status↦&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;Terminated&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ol start=&quot;2&quot;&gt;
&lt;li&gt;An event &lt;code&gt;ContractTerminated&lt;&#x2F;code&gt; is emitted with &lt;code&gt;(10, &quot;Failure to meet deadlines&quot;)&lt;&#x2F;code&gt;.
&lt;strong&gt;Expected Output&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Event&lt;&#x2F;strong&gt;: &lt;code&gt;ContractTerminated(10, &quot;Failure to meet deadlines&quot;)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;contracts[10]&lt;&#x2F;code&gt; status is now &lt;code&gt;&quot;Terminated&quot;&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;No further salary obligations exist unless otherwise specified in dispute-resolution processes.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Dispute Resolution&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Input&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Either party (company or employee) calls &lt;code&gt;raiseDispute(10)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The assigned moderator calls &lt;code&gt;resolveDispute(10, true)&lt;&#x2F;code&gt; indicating the decision favors the employee.
&lt;strong&gt;Expected State Changes&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Dispute Raised&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The contract’s dispute status is noted (implementation-specific, but typically &lt;code&gt;contracts[10].disputeRaised = true&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;An event &lt;code&gt;DisputeRaised(10, msg.sender)&lt;&#x2F;code&gt; is emitted.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Dispute Resolved&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;If &lt;code&gt;decisionForEmployee == true&lt;&#x2F;code&gt;, any remaining escrow funds for &lt;code&gt;contractId = 10&lt;&#x2F;code&gt; are transferred to the employee.&lt;&#x2F;li&gt;
&lt;li&gt;A &lt;code&gt;DisputeResolved(10, true)&lt;&#x2F;code&gt; event is emitted.
&lt;strong&gt;Expected Output&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Event&lt;&#x2F;strong&gt;: &lt;code&gt;DisputeRaised(10, msg.sender)&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Event&lt;&#x2F;strong&gt;: &lt;code&gt;DisputeResolved(10, true)&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;If funds remain in escrow, &lt;code&gt;escrowBalances[10]&lt;&#x2F;code&gt; is set to &lt;code&gt;0&lt;&#x2F;code&gt;, and the employee receives the outstanding balance.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Contract Integrity&lt;&#x2F;strong&gt;: Ensure that all labor contracts are immutable and cannot be tampered with once created and executed.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Fund Security&lt;&#x2F;strong&gt;: Salaries are securely held in escrow, and only released based on predefined conditions to prevent unauthorized access or misuse.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Moderator Trust&lt;&#x2F;strong&gt;: Implement a decentralized and transparent system for selecting and monitoring moderators to maintain impartiality and trust in dispute resolutions.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Review System&lt;&#x2F;strong&gt;: Incorporate safeguards against fraudulent reviews, such as verifying the association of reviews with legitimate contract completions, to maintain accurate and trustworthy reputation scores.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Token Security&lt;&#x2F;strong&gt;: Use &lt;strong&gt;Soulbound Tokens (SBTs)&lt;&#x2F;strong&gt; for employee representation to prevent token transfers and ensure that employment records are securely tied to the respective individuals.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Tamperproof Extension Wallets API (TWIST)</title>
        <published>2024-07-29T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Erik Marks</name><uri>https://github.com/remarks</uri>
	</author>
	
	<author>
		<name>Guillaume Grosbois</name><uri>https://github.com/uni-guillaume</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7754/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7754-tamperproof-web-immutable-transaction-twit/20767" />
        

        <id>https://wg-eips.ritovision.com/7754/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7754"
            label="ERC-7754" />
        

        
        

        
        <summary type="html">Provides a mechanism for dapps to use the extension wallets API in a tamperproof way</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7754/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Tamperproof Web Immutable Secure Transaction (TWIST) introduces a new RPC method to be implemented by wallets, &lt;code&gt;wallet_signedRequest&lt;&#x2F;code&gt;, that
enables dapps to interact with wallets in a tamperproof manner via &quot;signed requests&quot;. The
dapp associates a public key with its DNS record and uses the corresponding private key to
sign payloads sent to the wallet via &lt;code&gt;wallet_signedRequest&lt;&#x2F;code&gt;. Wallets can then use the
public key in the DNS record to validate the integrity of the payload.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This standard aims to enhance the end user&#x27;s experience by granting them confidence that requests from their dapps have not been tampered with.
In essence, this is similar to how HTTPS is used in the web.&lt;&#x2F;p&gt;
&lt;p&gt;Currently, the communication channel between dapps and wallets is vulnerable to man in the middle attacks.
Specifically, attackers can intercept RPC requests by injecting JavaScript code in the page,
via e.g. an XSS vulnerability or due to a malicious extension.
Once an RPC request is intercepted, it can be modified in a number of pernicious ways, including:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Editing the calldata in order to siphon funds or otherwise change the transaction outcome&lt;&#x2F;li&gt;
&lt;li&gt;Modifying the parameters of an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; request&lt;&#x2F;li&gt;
&lt;li&gt;Obtaining a replayable signature from the wallet&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Even if the user realizes that requests from the dapp may be tampered with, they have little to no recourse to mitigate the problem.
Overall, the lack of a chain of trust between the dapp and the wallet hurts the ecosystem as a whole:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Users cannot simply trust otherwise honest dapps, and are at risk of losing funds&lt;&#x2F;li&gt;
&lt;li&gt;Dapp maintainers are at risk of hurting their reputations if an attacker finds a viable MITM attack&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;For these reasons, we recommend that wallets implement the &lt;code&gt;wallet_signedRequest&lt;&#x2F;code&gt; RPC method.
This method provides dapp developers with a way to explicitly ask the wallet to verify the
integrity of a payload. This is a significant improvement over the status quo, which forces
dapps to rely on implicit approaches such as argument bit packing.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;overview&quot;&gt;Overview&lt;&#x2F;h3&gt;
&lt;p&gt;We propose to use the dapp&#x27;s domain certificate of a root of trust to establish a trust chain as follow:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The user&#x27;s browser verifies the domain certificate and displays appropriate warnings if overtaken&lt;&#x2F;li&gt;
&lt;li&gt;The DNS record of the dapp hosts a TXT field pointing to a URL where a JSON manifest is hosted
&lt;ul&gt;
&lt;li&gt;This file SHOULD be at a well known address such as &lt;code&gt;example[.]com&#x2F;.well-known&#x2F;twist.json&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The config file contains an array of objects of the form &lt;code&gt;{ id, alg, publicKey }&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;For signed requests, the dapp first securely signs the payload with a private key, for example by submitting a request to its backend&lt;&#x2F;li&gt;
&lt;li&gt;The original payload, signature, and public key id are sent to the wallet via the &lt;code&gt;wallet_signedRequest&lt;&#x2F;code&gt; RPC method&lt;&#x2F;li&gt;
&lt;li&gt;The wallet verifies the signature before processing the request normally&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;wallet-integration&quot;&gt;Wallet integration&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;key-discovery&quot;&gt;Key discovery&lt;&#x2F;h4&gt;
&lt;p&gt;Attested public keys are necessary for the chain of trust to be established.
Since this is traditionally done via DNS certificates, we propose the addition of a DNS record containing the public keys.
This is similar to RFC 6376&#x27;s DKIM, but the use of a manifest file provides more flexibility for future improvements, as well as support for multiple algorithm and key pairs.&lt;&#x2F;p&gt;
&lt;p&gt;Similarly to standard RFC 7519&#x27;s JWT practices, the wallet could eagerly cache dapp keys.
However, in the absence of a revocation mechanism, a compromised key could still be used until caches have expired.
To mitigate this, wallets SHOULD NOT cache dapp public keys for more than 2 hours.
This practice establishes a relatively short vulnerability window, and manageable overhead for both wallet and dapp maintainers.&lt;&#x2F;p&gt;
&lt;p&gt;Example DNS record for &lt;code&gt;my-crypto-dapp.invalid&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;TXT: TWIST=&#x2F;.well-known&#x2F;twist.json&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Example TWIST manifest at &lt;code&gt;my-crypto-dapp[.]invalid&#x2F;.well-known&#x2F;twist.json&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;publicKeys&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;alg&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ES256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;publicKey&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xaf34...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;alg&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;PS256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;publicKey&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x98ab...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Implementers MUST support at least the following &quot;alg&quot; param values, from RFC 7518 section 3.1: ES256 and EdDSA. Implementers SHOULD support PS256, RS256, ES384, ES512, PS384, PS512, RS384, and RS512.&lt;&#x2F;p&gt;
&lt;p&gt;Implementers SHOULD use &lt;code&gt;SubtleCrypto&lt;&#x2F;code&gt;, since it is available in modern browsers.&lt;&#x2F;p&gt;
&lt;p&gt;Public keys MUST be encoded using the X.509 SubjectPublicKeyInfo (SPKI) structure in DER format and represented as hex-encoded strings.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;manifest-schema&quot;&gt;Manifest schema&lt;&#x2F;h4&gt;
&lt;p&gt;We propose a simple and extensible schema:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;TWIST manifest&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;publicKeys&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;array&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;items&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;alg&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;publicKey&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;rpc-method&quot;&gt;RPC method&lt;&#x2F;h4&gt;
&lt;p&gt;The parameters of &lt;code&gt;wallet_signedRequest&lt;&#x2F;code&gt; are specified by this TypeScript interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RequestPayload&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Params&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; method&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; params&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Params&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SignedRequestParameters&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Params&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  requestPayload&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RequestPayload&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Params&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  keyId&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Here&#x27;s a non-normative example of calling &lt;code&gt;wallet_signedRequest&lt;&#x2F;code&gt; using the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1193&#x2F;&quot;&gt;EIP-1193&lt;&#x2F;a&gt; provider interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; keyId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; requestPayload&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RequestPayload&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;TransactionParams&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  method&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_sendTransaction&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  params&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;      &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ... &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getSignature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;requestPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; keyId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Using the EIP-1193 provider interface&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; result&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ethereum&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;request&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  method&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;wallet_signedRequest&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  params&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;requestPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; keyId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;signature-verification&quot;&gt;Signature verification&lt;&#x2F;h4&gt;
&lt;ol&gt;
&lt;li&gt;Upon receiving an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1193&#x2F;&quot;&gt;EIP-1193&lt;&#x2F;a&gt; call, the wallet MUST check of the existence of the TWIST manifest for the &lt;code&gt;sender.tab.url&lt;&#x2F;code&gt; domain
a. The wallet MUST enforce HTTPS as HTTP call would be vulnerable to DNS spoofing
b. The wallet MUST verify that the manifest is hosted on the &lt;code&gt;sender.tab.url&lt;&#x2F;code&gt; domain
c. The wallet SHOULD find the DNS TXT record to find the manifest location
d. The wallet MAY first try the &lt;code&gt;&#x2F;.well-known&#x2F;twist.json&lt;&#x2F;code&gt; location
e. The wallet MUST NOT follow redirects when querying the manifest location as it could lead to open redirect attacks
f. The wallet SHOULD validate the &lt;code&gt;Content-Type&lt;&#x2F;code&gt; header of the response is specifically set to &lt;code&gt;application&#x2F;json&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;If TWIST is NOT configured for the &lt;code&gt;sender.tab.url&lt;&#x2F;code&gt; domain, then proceed as usual&lt;&#x2F;li&gt;
&lt;li&gt;If TWIST is configured and the &lt;code&gt;request&lt;&#x2F;code&gt; method is used, then the wallet SHOULD display a visible and actionable warning to the user
a. If the user opts to ignore the warning, then proceed as usual
b. If the user opts to cancel, then the wallet MUST cancel the call&lt;&#x2F;li&gt;
&lt;li&gt;If TWIST is configured and the &lt;code&gt;wallet_signedRequest&lt;&#x2F;code&gt; method is used with the parameters &lt;code&gt;requestPayload&lt;&#x2F;code&gt;, &lt;code&gt;signature&lt;&#x2F;code&gt; and &lt;code&gt;keyId&lt;&#x2F;code&gt; then:
a. The wallet MAY display a visible cue indicating that this interaction is signed
b. The wallet MUST verify that the keyId exists in the TWIST manifest and find the associated key record
c. From the key record, the wallet MUST use the &lt;code&gt;alg&lt;&#x2F;code&gt; field and the &lt;code&gt;publicKey&lt;&#x2F;code&gt; field to verify &lt;code&gt;requestPayload&lt;&#x2F;code&gt; integrity by calling &lt;code&gt;crypto.verify(alg, key, signature, requestPayload)&lt;&#x2F;code&gt;
d. If the signature is invalid, the wallet MUST display a visible and actionable warning to the user
i. If the user opts to ignore the warning, then proceed to call &lt;code&gt;request&lt;&#x2F;code&gt; with the argument &lt;code&gt;requestPayload&lt;&#x2F;code&gt;
ii. If the user opts to cancel, then the wallet MUST cancel the call
e. If the signature is valid, the wallet MUST call &lt;code&gt;request&lt;&#x2F;code&gt; with the argument &lt;code&gt;requestPayload&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h4 id=&quot;example-method-implementation-wallet&quot;&gt;Example method implementation (wallet)&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;async&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; signedRequest&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  requestPayload&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RequestPayload&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;unknown&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  keyId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Promise&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;unknown&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 1. Get the domain of the sender.tab.url&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; domain&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getDappDomain&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 2. Get the manifest for the current domain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; It&amp;#39;s possible to use RFC 8484 for the actual DNS-over-HTTPS specification.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; However, here we are doing it with DoHjs.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This step is optional, and you could go directly to the well-known address first at `domain + &amp;#39;&#x2F;.well-known&#x2F;twist.json&amp;#39;`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; doh&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;dohjs&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; resolver&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; doh&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;DohResolver&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;doh-endpoint&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; manifestPath&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; dnsResp&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; resolver&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;query&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;domain&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;TXT&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; record&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; of&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; dnsResp&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;answers&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;record&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;startsWith&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;TWIST=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; continue&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    manifestPath&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; record&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;substring&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;5&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This should be domain + &amp;#39;&#x2F;.well-known&#x2F;twist.json&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    break&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 3. Parse the manifest and get the key and algo based on `keyId`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; manifestUrl&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;domain&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;manifestPath&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;startsWith&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ?&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; :&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;manifestPath&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; manifestReq&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fetch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;manifestUrl&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt; redirect&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; contentType&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;manifestReq&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;headers&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;get&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;content-type&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;toLowerCase&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;contentType&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;startsWith&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;application&#x2F;json&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    throw&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Error&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The manifest is not a proper JSON file&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; manifest&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; manifestReq&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;json&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; keyData&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; manifest&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;publicKeys&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;find&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;x&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; x&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ===&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; keyId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;keyData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    throw&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Error&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Could not find the signing key&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; keyData&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;publicKey&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; alg&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; keyData&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;alg&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 4. Verify the signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; valid&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; crypto&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;verify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;alg&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; requestPayload&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;valid&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    throw&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Error&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The data was tampered with&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  return&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; processRequest&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;requestPayload&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;wallet-ux-suggestion&quot;&gt;Wallet UX suggestion&lt;&#x2F;h3&gt;
&lt;p&gt;Similarly to the padlock icon for HTTPS, wallets should display a visible indication when TWIST is configured on a domain. This will improve the UX of the end user who will immediately be able to tell
that interactions between the dapp they are using and the wallet are secure, and this will encourage dapp developer to adopt TWIST, making the overall ecosystem more secure&lt;&#x2F;p&gt;
&lt;p&gt;When dealing with insecure request, either because the dapp (or an attacker) uses &lt;code&gt;request&lt;&#x2F;code&gt; on a domain where TWIST is configured, or because the signature does not match, wallets should warn the user but
not block: an eloquently worded warning will increase the transparency enough that end user may opt to cancel the interaction or proceed with the unsafe call.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The proposed implementation does not modify any of the existing functionalities offered by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1193&#x2F;&quot;&gt;EIP-1193&lt;&#x2F;a&gt;. Its additive
nature makes it inherently backward compatible. Its core design is modeled after existing solutions to existing problems (such as DKIM). As a result the proposed specification will be non disruptive, easy to
implements for both wallets and dapps, with a predictable threat model.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;replay-prevention&quot;&gt;Replay prevention&lt;&#x2F;h3&gt;
&lt;p&gt;While signing the &lt;code&gt;requestArg&lt;&#x2F;code&gt; payload guarantees data integrity, it does not prevent replay attacks in itself:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;a signed payload can be replayed multiple times&lt;&#x2F;li&gt;
&lt;li&gt;a signed payload can be replayed across multiple chains&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;em&gt;Effective&lt;&#x2F;em&gt; time replay attacks as described in &lt;code&gt;1.&lt;&#x2F;code&gt; are generally prevented by the transaction nonce.
Cross chain replay can be prevented by leveraging the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; &lt;code&gt;signTypedData&lt;&#x2F;code&gt; method.&lt;&#x2F;p&gt;
&lt;p&gt;Replay attack would still be possible on any method that is not protected by either: this affects effectively all the &quot;readonly&quot; methods
which are of very limited value for an attacker.&lt;&#x2F;p&gt;
&lt;p&gt;For these reason, we do not recommend a specific replay protection mechanism at this time. If&#x2F;when the need arise, the extensibility of
the manifest will provide the necessary room to enforce a replay protection envelope (eg:JWT) for affected dapp.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;malicious-manifests&quot;&gt;Malicious manifests&lt;&#x2F;h3&gt;
&lt;p&gt;The manifest itself could be attacked, defeating the purpose of TWIST. We identified the following possible attacks, and their counter measure:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;An attacker can spoof DNS entries and use it to serve their own manifest: to avoid this, the wallet implementation MUST only query the manifest from &lt;code&gt;&#x27;https:&#x2F;&#x2F;${sender.tab.url}&#x2F;${pathFromDNSRecord}&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;An attacker can leverage other flaws in a dapp to host a malicious manifest on the dapp domain itself
a. by leveraging open redirect: consequently the wallet MUST NOT follow redirect when querying the manifest
b. by managing to host a file on the dapp domain: consequently the wallet SHOULD verify the &lt;code&gt;content-type&lt;&#x2F;code&gt; header is equal to &lt;code&gt;application&#x2F;json&lt;&#x2F;code&gt; to mitigate this attack vector&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>State conversion to Verkle Tree</title>
        <published>2024-07-23T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Guillaume Ballet</name><uri>https://github.com/gballet</uri>
	</author>
	
	<author>
		<name>Ignacio Hagopian</name><uri>https://github.com/jsign</uri>
	</author>
	
	<author>
		<name>Gajinder Singh</name><uri>https://github.com/g11tech</uri>
	</author>
	
	<author>
		<name>Ansgar Dietrichs</name><uri>https://github.com/adietrichs</uri>
	</author>
	
	<author>
		<name>Gottfried Herold</name><uri>https://github.com/GottfriedHerold</uri>
	</author>
	
	<author>
		<name>Jamie Lokier</name><uri>https://github.com/jlokier</uri>
	</author>
	
	<author>
		<name>Tanishq Jasoria</name><uri>https://github.com/tanishqjasoria</uri>
	</author>
	
	<author>
		<name>Parithosh Jayanthi</name><uri>https://github.com/parithosh</uri>
	</author>
	
	<author>
		<name>Gabriel Rocheleau</name><uri>https://github.com/gabrocheleau</uri>
	</author>
	
	<author>
		<name>Karim Taam</name><uri>https://github.com/matkt</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7748/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7748-state-conversion-to-verkle-tree/20625" />
        

        <id>https://wg-eips.ritovision.com/7748/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7748"
            label="EIP-7748" />
        

        
        

        
        <summary type="html">Describes a state conversion procedure to migrate key-values from the Merkle Patricia Tree to the Verkle Tree.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7748/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes a procedure to convert, on each block, a fixed number of key-values from the existing Merkle Patricia Tree (MPT) to the Verkle Tree (VKT).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The accounts state is too large to wait for transactions to organically move all of them to the VKT through the Overlay Tree. Thus, we need a strategy to convert all the state within a reasonable time. The state conversion completion allows removing the Overlay Tree abstraction introduced in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7612&#x2F;&quot;&gt;EIP-7612&lt;&#x2F;a&gt; and to use directly the VKT for all state access.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;value&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CONVERSION_START_TIMESTAMP&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;TBD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Timestamp at which the conversion starts.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CONVERSION_STRIDE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;TBD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Maximum number of &lt;em&gt;conversion units&lt;&#x2F;em&gt; to be converted per block&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;A &lt;em&gt;conversion unit&lt;&#x2F;em&gt; is:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A contract storage slot.&lt;&#x2F;li&gt;
&lt;li&gt;An account data (e.g. balance, nonce, code-hash) and code (if any).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;changes-to-the-execution-spec&quot;&gt;Changes to the execution spec&lt;&#x2F;h3&gt;
&lt;p&gt;Include the following code in the existing &lt;code&gt;apply_body(...)&lt;&#x2F;code&gt; function:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; apply_body&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; State&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; ...&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Tuple&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Uint&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Bloom&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; State&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &amp;lt;new_code&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; block_time&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CONVERSION_START_TIMESTAMP&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_conversion_finished&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        state_convert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CONVERSION_STRIDE&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &amp;lt;&#x2F;new_code&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; enumerate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;map&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;decode_transaction&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; transactions&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Before executing txs, it calls &lt;code&gt;state_convert(...)&lt;&#x2F;code&gt; (described below) which performs a state conversion step for this block.&lt;&#x2F;p&gt;
&lt;p&gt;In &lt;code&gt;state.py&lt;&#x2F;code&gt;, add the following code:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;dataclass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; StoragePhase&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    The account next conversion step continues converting the &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    storage-slot with key greater than or equal to next_key. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    If there isn&amp;#39;t such a storage-slot, the account must move to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    AccountDataPhase.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    next_key&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;   &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;dataclass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AccountDataPhase&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    The account next conversion step continues migrating the account &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    code (if any) and basic data. After processing, the account must &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    move to the next account in the trie (or finish if it was the &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    last one).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    pass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;dataclass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CurrentConvertingAccount&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Contains the state conversion next step.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    phase&lt;&#x2F;span&gt;&lt;span&gt; :&lt;&#x2F;span&gt;&lt;span&gt; StoragePhase&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span&gt; AccountDataPhase&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;These new structures allows &lt;code&gt;State&lt;&#x2F;code&gt; to track where we&#x27;re in the conversion process.&lt;&#x2F;p&gt;
&lt;p&gt;Modify the &lt;code&gt;State&lt;&#x2F;code&gt; class by adding the following attributes:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;dataclass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; State&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &amp;lt;new_code&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    _conversion_curr_account&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Optional&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;CurrentConvertingAccount&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    _conversion_finished&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &amp;lt;&#x2F;new_code&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Define a function with the following signature:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; trie_get_next_at_key&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;trie&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Trie&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;K&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; V&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; key_seek&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;K&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; V&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Optional&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Bytes&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the first (key, value) in the trie-key is &amp;gt;= key_seek.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This method must only be used on Tries with secured=True,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; since key_seek is the keccak256(K).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - K, V: the key and value (e.g: Address&#x2F;Value, StorageSlot&#x2F;Value)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - next_key: The smallest trie-key present in the trie greater &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; than key_seek, or None if there isn&amp;#39;t one.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; It is up to the implementer to decide the best implementation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; considering its client architecture.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Add or modify the following functions:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; New function.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_conversion_account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; State&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; CurrentConvertingAccount&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; When starting the conversion, initialize with the first account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; in the MPT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_conversion_curr_account&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Initialize with the first account in the account trie.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        first_account&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; trie_get_next_at_key&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Accounts conversion starts with storage-slots conversion.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        phase&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; StoragePhase&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Starts with the lowest storage-slot key.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_conversion_curr_account&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; CurrentConvertingAccount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;first_account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; phase&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_conversion_curr_account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; New function.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; conversion_move_to_next_account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; State&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    curr_account&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get_conversion_account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; next_key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; trie_get_next_at_key&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_main_trie&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; curr_account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;phase&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;next_key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; next_key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; We finished the conversion&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_conversion_finished&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; True&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Move to the next account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_conversion_curr_account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_conversion_curr_account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;phase&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; StoragePhase&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x00&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Modified function: add new only_if_empty optional parameter.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; set_storage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;    state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; State&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; U256&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; only_if_empty&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; True&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &amp;lt;new_code&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; only_if_empty&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_overlay_tree&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;get_tree_key_for_storage_slot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &amp;lt;&#x2F;new_code&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_overlay_tree&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;set&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;get_tree_key_for_storage_slot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;As mentioned previously, the next function is called by &lt;code&gt;apply_body(...)&lt;&#x2F;code&gt; to perform the conversion step for a block:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Note the following function is optimized for readability, not for performance.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; state_convert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; State&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; stride&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    while&lt;&#x2F;span&gt;&lt;span&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; stride&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_conversion_finished&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        curr_account&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get_conversion_account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Skip translating storage if the account has an empty code hash.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Skip storage conversion for accounts with 0 nonce and empty code.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This covers the 28 EIP-7610 accounts, but would also cover all&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; pre-eip161 accounts on other chains.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; curr_account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;curr_account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_conversion_curr_account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;phase&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; AccountDataPhase&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Account storage.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; curr_account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;phase&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; is&lt;&#x2F;span&gt;&lt;span&gt; StoragePhase&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the storage-slot from _storage_tries which is MPT data.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            trie&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_storage_tries&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;curr_account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; trie&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                slot_num&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; slot_value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; next_key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; trie_get_next_at_key&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;trie&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; curr_account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;phase&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;next_key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;                #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The Overlay Tree will write in the VKT. We use the new&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;                #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; only_if_empty parameter to avoid writing stale values.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                set_storage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; curr_account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; slot_num&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; slot_value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; only_if_empty&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;True&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                if&lt;&#x2F;span&gt;&lt;span&gt; next_key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;                    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; There&amp;#39;re more storage-slots to be converted, continue in this phase.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;conversion_curr_account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;phase&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;next_key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; next_key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;                    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; No more storage-slots. Move to the account data migration.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;conversion_curr_account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;phase&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; AccountDataPhase&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;                #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; There&amp;#39;s no storage trie for the account, move directly to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;                #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; migrating account&amp;#39;s data and code (if any).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;conversion_curr_account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;phase&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; AccountDataPhase&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Account code and basic data.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Getting the code from the Overlay Tree is fine since it promises to return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the Account full code which would come from the MPT or a separate code database.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            account&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; curr_account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            chunked_code&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; chunkify_code&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            for&lt;&#x2F;span&gt;&lt;span&gt; chunk_num&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;chunked_code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                state_set_codechunk&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; chunk_num&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; chunked_code&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;chunk_num&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If the account data (i.e: nonce, balance, code-size, code-hash) lives in MPT, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; get_account will pull from MPT and then we write to the VKT. If the account &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; data already lives in the VKT (i.e: it was indirectly converted by a tx), then &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; it will return it from the VKT and write it again (i.e: it&amp;#39;s a noop).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Thus, this operation is correct under both scenarios. That is, it won&amp;#39;t&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; write stale data.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            account&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; curr_account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            set_account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; curr_account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;conversion_move_to_next_account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;state-conversion-step-position-in-block-execution&quot;&gt;State conversion step position in block execution&lt;&#x2F;h3&gt;
&lt;p&gt;Performing the conversion step before the block txs execution has some benefits:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If the state conversion step is done after txs execution, there&#x27;s a possibility that txs execution writes overlap with converted key-values, having to care about them becoming stale in the same block. With the proposed ordering, they can only become stale by writes of previous blocks.&lt;&#x2F;li&gt;
&lt;li&gt;It can reduce the complexity of optimizations, such as frontrunning the state conversion for the next block before it arrives.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;conversion-stride-proposed-value&quot;&gt;&lt;code&gt;CONVERSION_STRIDE&lt;&#x2F;code&gt; proposed value&lt;&#x2F;h3&gt;
&lt;p&gt;Performance benchmarks were done to achieve the right balance between:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Don&#x27;t overload the clients with too much extra work per block.&lt;&#x2F;li&gt;
&lt;li&gt;Don&#x27;t create an unmanageable load in clients during feasible long reorgs.&lt;&#x2F;li&gt;
&lt;li&gt;Finish the conversion as fast as possible.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;account-code-chunking-done-in-a-single-step&quot;&gt;Account code chunking done in a single step&lt;&#x2F;h3&gt;
&lt;p&gt;If an account has code, this is chunked and inserted in the VKT in one go. An alternative is including a &lt;code&gt;CodePhase&lt;&#x2F;code&gt; and let each inserted chunk consume one unit of &lt;code&gt;CONVERSION_STRIDE&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;We decided to not do this to reduce the algorithm complexity. Considering the current maximum code size, the worst case scenario for a block could overflow the &lt;code&gt;CONVERSION_STRIDE&lt;&#x2F;code&gt; limit by 24k&#x2F;31~=793 units.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;deletion-of-eip-7610-accounts&quot;&gt;Deletion of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7610&#x2F;&quot;&gt;EIP-7610&lt;&#x2F;a&gt; accounts&lt;&#x2F;h3&gt;
&lt;p&gt;EIP-7610 mentions the existence of 28 accounts that have:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;a nonce of 0,&lt;&#x2F;li&gt;
&lt;li&gt;no code&lt;&#x2F;li&gt;
&lt;li&gt;a non-empty storage tree&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;These storage slots are to be omitted from the conversion process, as they can not be accessed.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;expected-time-for-the-conversion-to-finish&quot;&gt;Expected time for the conversion to finish&lt;&#x2F;h3&gt;
&lt;p&gt;TODO: We have an estimation, but it might be worth recalculating it closer to the proposed fork having a more up to date state size estimate.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;missed-slots&quot;&gt;Missed slots&lt;&#x2F;h3&gt;
&lt;p&gt;The conversion logic runs at the start of each block, so missed slots don&#x27;t create special situations.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;accounts-storage-account-data-order&quot;&gt;Accounts storage-&amp;gt;account-data order&lt;&#x2F;h3&gt;
&lt;p&gt;The proposed order synergizes with many EL client flat-db architectures, minimizing random disk-IO.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;not-counting-eip-161-accounts-for-conversion-stride-limit&quot;&gt;Not counting &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;161&#x2F;&quot;&gt;EIP-161&lt;&#x2F;a&gt; accounts for &lt;code&gt;CONVERSION_STRIDE&lt;&#x2F;code&gt; limit&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;CONVERSION_STRIDE&lt;&#x2F;code&gt; parameter tries to limit the load of effective writes. These special accounts are skipped since we try to perform a bulk &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;158&#x2F;&quot;&gt;EIP-158&lt;&#x2F;a&gt; deletion of the remaining accounts.&lt;&#x2F;p&gt;
&lt;p&gt;This might sound dangerous since if there were 1k of these accounts and all corresponded to be converted in the same block, we&#x27;d be forcing the clients to iterate 1k accounts without counting any quota from &lt;code&gt;CONVERSION_STRIDE&lt;&#x2F;code&gt;. The number of remaining accounts to delete is very low (i.e.: dozen) and also not contiguous, so this shouldn&#x27;t be a concern.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;mpt-preimage-resolving&quot;&gt;MPT preimage resolving&lt;&#x2F;h3&gt;
&lt;p&gt;EL clients are expected to satisfy at least one of these conditions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;They have a proper flat-db design, which doesn&#x27;t require preimage resolving.&lt;&#x2F;li&gt;
&lt;li&gt;They have a full preimage database which can resolve &lt;em&gt;trie_key&lt;&#x2F;em&gt;-&amp;gt;&lt;em&gt;preimage&lt;&#x2F;em&gt; (but this can have poor performance).&lt;&#x2F;li&gt;
&lt;li&gt;They have downloaded the preimage database image that will be distributed before the conversion starts.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TODO: currently described in an external document.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;transition-post-genesis&lt;&#x2F;code&gt; branch in &lt;code&gt;github.com&#x2F;gballet&#x2F;go-ethereum&lt;&#x2F;code&gt; implements this when setting &lt;code&gt;--override.overlay-stride&lt;&#x2F;code&gt; to a non-zero value on the command line.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Trustless log and transaction index</title>
        <published>2024-07-17T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Zsolt Felföldi</name><uri>https://github.com/zsfelfoldi</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7745/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7745-two-dimensional-log-filter-data-structure/20580" />
        

        <id>https://wg-eips.ritovision.com/7745/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7745"
            label="EIP-7745" />
        

        
        

        
        <summary type="html">An efficient, light client and DHT friendly replacement for block header bloom filters</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7745/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Replace the fixed 2048 bit log event bloom filters with a new lookup index data structure that can adapt to the changing number of events per block and consistently guarantee a sufficiently low false positive ratio, allowing efficient trustless proofs of log event queries, canonical block hash and transaction hash lookups.&lt;&#x2F;p&gt;
&lt;p&gt;The proposed structure maps all index entries (log events, transaction and block markers) onto a global linear index space and hashes them into a binary Merkle tree based on that index. It also contains a &lt;em&gt;filter map&lt;&#x2F;em&gt; for every fixed length section of the index space. These are two dimensional sparse bit maps that provide an efficient probabilistic method for looking up indexed values or query patterns of values, yielding potential matches in the form of exact positions in the linear index space. Unlike the per-block bloom filters, they allow searching for specific events by accessing only a small portion of the entire dataset which can also be proven with a Merkle proof, making the search both efficient and light client friendly.&lt;&#x2F;p&gt;
&lt;p&gt;The proposed structure can be efficiently used both for local search and for remote proof generation&#x2F;verification, thereby simplifying implementation of provers and verifiers. It also allows validators that are not interested in either searching or proving logs to generate the index root hash by maintaining a minimal index state with a relatively small (hard capped) size.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Adding logs has a significantly lower gas cost and should accordingly be less resource consuming than writing to the state. The original design of bloom filters in each block achieves this goal as there is no complex data structure like the state to update, the set of logs emitted in each block is all contained within the header and receipts belonging to that block. Logs mostly just have long term storage costs. On the other hand, searching logs in a long range of blocks is very expensive and the current bloom filters do not really help.&lt;&#x2F;p&gt;
&lt;p&gt;Bloom filters are only useful as long as they are sufficiently sparse. False positive ratio rises rapidly with the number of events per filter and the density of &lt;code&gt;1&lt;&#x2F;code&gt; bits in the filter bit vector. In the currently existing bloom filter each log address and topic sets 3 out of a fixed length of 2048 bits which resulted in sufficiently sparse filters in the beginning but with the increase of the block gas limits the false positive ratio soon made the filter practically useless. Mainnet blocks currently add over 1000 log addresses and topics in average and therefore the bloom filter size would need to increase about tenfold in order to achieve acceptable false positive rates again. This would raise block header size to about 3 kilobytes. Even if the size of the per-block bloom filters would be raised to a sufficient level, log search would still require accessing the entire header chain. Searching in just the most recent one year history would cost over 6 gigabytes of data, not counting the access of actual logs where the bloom filters have a match. The current situation is even worse, requiring a large portion of the full block receipt sets to be accessed due to the high false positive rate of the bloom filters. Transaction inclusion lookup is also very expensive, requiring all block bodies in the searched range.&lt;&#x2F;p&gt;
&lt;p&gt;While full nodes and RPC servers can and usually do build additional index structures to aid certain lookups, these structures cannot be verified remotely. While it is important to improve the transaction processing capabilities of Ethereum, trustless provability is required throughout the entire stack, from end user applications signing transactions, to the same or other end user applications getting the results they need. Scaling transaction processing only makes sense as long as there is also a trustless and scalable way to access the relevant results of those transactions. Users relying on trusted servers and indexers kind of beats the whole point of Ethereum.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;terms-and-definitions&quot;&gt;Terms and definitions&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;index entry&lt;&#x2F;em&gt;: a single entry in the &lt;code&gt;index_entries&lt;&#x2F;code&gt; tree associated with an indexed event. It is either a &lt;em&gt;log entry&lt;&#x2F;em&gt;, a &lt;em&gt;transaction entry&lt;&#x2F;em&gt; or a &lt;em&gt;block entry&lt;&#x2F;em&gt;. An &lt;em&gt;index entry&lt;&#x2F;em&gt; generates one or more &lt;em&gt;map values&lt;&#x2F;em&gt;. Each &lt;em&gt;log entry&lt;&#x2F;em&gt; adds one &lt;em&gt;address value&lt;&#x2F;em&gt; and 0..4 &lt;em&gt;topic values&lt;&#x2F;em&gt; (in this order). Each &lt;em&gt;transaction entry&lt;&#x2F;em&gt; adds one &lt;em&gt;transaction value&lt;&#x2F;em&gt; and each &lt;em&gt;block entry&lt;&#x2F;em&gt; adds one &lt;em&gt;block value&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;map value&lt;&#x2F;em&gt;: a searchable value associated with an &lt;em&gt;index entry&lt;&#x2F;em&gt;. It is either an &lt;em&gt;address value&lt;&#x2F;em&gt;, a &lt;em&gt;topic value&lt;&#x2F;em&gt;, a &lt;em&gt;transaction value&lt;&#x2F;em&gt; or a &lt;em&gt;block value&lt;&#x2F;em&gt;. Each &lt;em&gt;map value&lt;&#x2F;em&gt; is represented by a 32 byte hash (the &lt;em&gt;map value hash&lt;&#x2F;em&gt;) which is calculated as &lt;code&gt;sha2(address)&lt;&#x2F;code&gt;, &lt;code&gt;sha2(topic)&lt;&#x2F;code&gt;, &lt;code&gt;sha2(tx_hash + b&quot;\x01&quot;)&lt;&#x2F;code&gt; or &lt;code&gt;sha2(block_hash + b&quot;\x02&quot;)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;map value index&lt;&#x2F;em&gt;: a single position in the global linear index space. A new &lt;em&gt;map value index&lt;&#x2F;em&gt; is assigned to each indexed &lt;em&gt;map value&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;map entry index&lt;&#x2F;em&gt;: the position where an &lt;em&gt;index entry&lt;&#x2F;em&gt; is located in the &lt;code&gt;index_entries&lt;&#x2F;code&gt; tree. Each &lt;em&gt;index entry&lt;&#x2F;em&gt; is located at the position corresponding to the &lt;em&gt;map value index&lt;&#x2F;em&gt; of the first &lt;em&gt;map value&lt;&#x2F;em&gt; it generates.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;filter map&lt;&#x2F;em&gt;: a &lt;code&gt;MAP_WIDTH&lt;&#x2F;code&gt; by &lt;code&gt;MAP_HEIGHT&lt;&#x2F;code&gt; sized sparse bit map assigned to a &lt;code&gt;VALUES_PER_MAP&lt;&#x2F;code&gt; length section of the &lt;em&gt;map value index&lt;&#x2F;em&gt; space. Each &lt;em&gt;map value&lt;&#x2F;em&gt; assigned to this range is marked on the map at a row and column that depends on the &lt;em&gt;map value index&lt;&#x2F;em&gt;, &lt;em&gt;mapping layer&lt;&#x2F;em&gt; and the &lt;em&gt;map value hash&lt;&#x2F;em&gt;. Rows are sparsely encoded as a list of marked column indices (in strictly ascending order, which also coincides with the order of occurence). Each map contains at most &lt;code&gt;VALUES_PER_MAP&lt;&#x2F;code&gt; marks and therefore the chance of false positives is kept at a constant low level.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;mapping layer&lt;&#x2F;em&gt;: each layer defines a (&lt;em&gt;map index&lt;&#x2F;em&gt;, &lt;em&gt;map value hash&lt;&#x2F;em&gt;) =&amp;gt; &lt;em&gt;row index&lt;&#x2F;em&gt; mapping and imposes a limit on the number of &lt;em&gt;map values&lt;&#x2F;em&gt; mapped into each row using that particular mapping. Multiple &lt;em&gt;mapping layers&lt;&#x2F;em&gt; can be applied simultaneously on the same &lt;em&gt;filter map&lt;&#x2F;em&gt;. Each &lt;em&gt;map value&lt;&#x2F;em&gt; is mapped using the lowest possible &lt;em&gt;mapping layer&lt;&#x2F;em&gt; where the number of marks in the assigned row is lower than the limit. On layer 0 the &lt;em&gt;row index&lt;&#x2F;em&gt; mapping only changes once per &lt;em&gt;index epoch&lt;&#x2F;em&gt;. On higher layers the mapping changes more frequently and also the row size limit is higher.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;index epoch&lt;&#x2F;em&gt;: a &lt;code&gt;MAPS_PER_EPOCH&lt;&#x2F;code&gt; sized group of consecutive &lt;em&gt;filter maps&lt;&#x2F;em&gt; stored in the hash tree in a way so that multiple rows of adjacent &lt;em&gt;filter maps&lt;&#x2F;em&gt; with the same &lt;em&gt;row index&lt;&#x2F;em&gt; can be efficiently retrieved in a single Merkle multiproof.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;consensus-data-format&quot;&gt;Consensus data format&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;block-headers&quot;&gt;Block headers&lt;&#x2F;h4&gt;
&lt;p&gt;Beginning at the execution timestamp &lt;code&gt;FORK_TIMESTAMP&lt;&#x2F;code&gt;, execution clients MUST replace the &lt;code&gt;logs_bloom&lt;&#x2F;code&gt; field of the header schema with &lt;code&gt;log_index_root&lt;&#x2F;code&gt; which is the root hash of the &lt;code&gt;LogIndex&lt;&#x2F;code&gt; structure after adding the logs emitted in the given block.&lt;&#x2F;p&gt;
&lt;p&gt;The resulting RLP encoding of the header is therefore:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;rlp([&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    parent_hash,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347, # ommers hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    coinbase,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state_root,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    txs_root,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    receipts_root,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    log_index_root,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    0, # difficulty&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    number,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_limit,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_used,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    timestamp,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    extradata,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    prev_randao,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    0x0000000000000000, # nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    base_fee_per_gas,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    withdrawals_root,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    blob_gas_used,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    excess_blob_gas,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    parent_beacon_block_root,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;container-types&quot;&gt;Container types&lt;&#x2F;h4&gt;
&lt;p&gt;These definitions use the &lt;code&gt;ProgressiveList&lt;&#x2F;code&gt; and &lt;code&gt;ProgressiveByteList&lt;&#x2F;code&gt; SSZ types as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7916&#x2F;&quot;&gt;EIP-7916&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Note that the &lt;code&gt;LogIndex&lt;&#x2F;code&gt; and &lt;code&gt;IndexEpoch&lt;&#x2F;code&gt; container definitions below are &quot;naive&quot; definitions suitable to define SSZ merkleization. The entire log index is typically too big to be represented in memory as a whole. A more efficient implementation can be found here: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7745&#x2F;.&#x2F;assets&#x2F;log_index.py&quot;&gt;log_index.py&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7745&#x2F;.&#x2F;assets&#x2F;binary_tree.py&quot;&gt;binary_tree.py&lt;&#x2F;a&gt;  (taken from the EELS implementation). This code keeps only the currently processed parts of the tree in memory, expanding untouched empty subtrees on demand and collapsing finalized subtrees.&lt;&#x2F;p&gt;
&lt;p&gt;Also note that the containers defined here (including &lt;code&gt;FilterRow&lt;&#x2F;code&gt;) have a non-initialized default value, represented as a null leaf in the Merkle tree. Initialization of these containers is explicit and happens at a well defined point. &lt;code&gt;IndexEpoch&lt;&#x2F;code&gt; is initialized when the first &lt;em&gt;index entry&lt;&#x2F;em&gt; is added to the epoch. All rows of a map are initialized when the first &lt;em&gt;index entry&lt;&#x2F;em&gt; is added to the map. &lt;code&gt;IndexEntry&lt;&#x2F;code&gt; is initialized when added; entry positions belonging to unused &lt;em&gt;map entry indices&lt;&#x2F;em&gt; are left uninitialized. The &lt;code&gt;Log&lt;&#x2F;code&gt; container is only initialized in case of &lt;em&gt;log entries&lt;&#x2F;em&gt;. If it is initialized then &lt;code&gt;topics&lt;&#x2F;code&gt; and &lt;code&gt;data&lt;&#x2F;code&gt; lists in the &lt;code&gt;Log&lt;&#x2F;code&gt; container are always initialized.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;class LogIndex(Container):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    epochs: Vector[IndexEpoch, MAX_EPOCH_HISTORY]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    next_index: uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;class IndexEpoch(Container):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    filter_maps: Vector[Vector[FilterRow, MAPS_PER_EPOCH], MAP_HEIGHT]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    index_entries: Vector[IndexEntry, MAPS_PER_EPOCH * VALUES_PER_MAP]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;type FilterRow = ProgressiveList[uint32]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;class IndexEntry(Container):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    log_entry: Log&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    entry_meta: Vector[Bytes32, 4] # LogMeta &#x2F; TransactionMeta &#x2F; BlockMeta&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;class Log(Container):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address: ExecutionAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    topics: List[Bytes32, 4]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    data: ProgressiveByteList&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;entry_meta&lt;&#x2F;code&gt; vector has a fixed format but its interpretation depends on the type of &lt;em&gt;index entry&lt;&#x2F;em&gt; and the type of entry can also be determined based on its contents (and based on whether &lt;code&gt;log_entry&lt;&#x2F;code&gt; is initialized or not). Whenever &lt;code&gt;IndexEntry&lt;&#x2F;code&gt; is initialized, &lt;code&gt;entry_meta&lt;&#x2F;code&gt; contains either one of these containers:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;class LogMeta(Container):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block_number: uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    transaction_hash: Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    transaction_index: uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    log_in_tx_index: uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;class TransactionMeta(Container):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block_number: uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    transaction_hash: Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    transaction_index: uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    receipt_hash: Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;class BlockMeta(Container):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block_number: uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block_hash: Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    timestamp: uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    zero: uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;index-entry-types-and-corresponding-map-values&quot;&gt;Index entry types and corresponding map values&lt;&#x2F;h4&gt;
&lt;p&gt;Three types of &lt;em&gt;index entries&lt;&#x2F;em&gt; are added during state transition: log, transaction and block. For each processed transaction, a &lt;em&gt;transaction entry&lt;&#x2F;em&gt; is added first, then &lt;em&gt;log entries&lt;&#x2F;em&gt; are added in the order of EVM execution. The &lt;em&gt;block entry&lt;&#x2F;em&gt; referring to the processed block is not added during the state transition because it is supposed to reference the block hash which is not known yet. It can be added either after block building&#x2F;validaton or are the beginning of the next state transition. In either case, the &lt;code&gt;block entry&lt;&#x2F;code&gt; of block N first appears in the log index state of block N+1 as the first new &lt;code&gt;index entry&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The following table shows an example of mapping all index entry types onto the &lt;em&gt;map value index&lt;&#x2F;em&gt; space:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Index entry&lt;&#x2F;th&gt;&lt;th&gt;Map entry index&lt;&#x2F;th&gt;&lt;th&gt;Map values&lt;&#x2F;th&gt;&lt;th&gt;Map value indices&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Block #0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;Block&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Tx    #1&#x2F;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;Transaction&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Log   #1&#x2F;0&#x2F;0&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;Addr, 3x Topic&lt;&#x2F;td&gt;&lt;td&gt;2, 3, 4, 5&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Log   #1&#x2F;0&#x2F;1&lt;&#x2F;td&gt;&lt;td&gt;6&lt;&#x2F;td&gt;&lt;td&gt;Addr, 3x Topic&lt;&#x2F;td&gt;&lt;td&gt;6, 7, 8, 9&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Tx    #1&#x2F;1&lt;&#x2F;td&gt;&lt;td&gt;10&lt;&#x2F;td&gt;&lt;td&gt;Transaction&lt;&#x2F;td&gt;&lt;td&gt;10&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Log   #1&#x2F;1&#x2F;0&lt;&#x2F;td&gt;&lt;td&gt;11&lt;&#x2F;td&gt;&lt;td&gt;Addr, 2x Topic&lt;&#x2F;td&gt;&lt;td&gt;11, 12, 13&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Log   #1&#x2F;1&#x2F;1&lt;&#x2F;td&gt;&lt;td&gt;14&lt;&#x2F;td&gt;&lt;td&gt;Addr, Topic&lt;&#x2F;td&gt;&lt;td&gt;14, 15&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Log   #1&#x2F;1&#x2F;2&lt;&#x2F;td&gt;&lt;td&gt;16&lt;&#x2F;td&gt;&lt;td&gt;Addr, 2x Topic&lt;&#x2F;td&gt;&lt;td&gt;16, 17, 18&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Block #1&lt;&#x2F;td&gt;&lt;td&gt;19&lt;&#x2F;td&gt;&lt;td&gt;Block&lt;&#x2F;td&gt;&lt;td&gt;19&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Tx    #2&#x2F;0&lt;&#x2F;td&gt;&lt;td&gt;20&lt;&#x2F;td&gt;&lt;td&gt;Transaction&lt;&#x2F;td&gt;&lt;td&gt;20&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Log   #2&#x2F;0&#x2F;0&lt;&#x2F;td&gt;&lt;td&gt;21&lt;&#x2F;td&gt;&lt;td&gt;Addr, 4x Topic&lt;&#x2F;td&gt;&lt;td&gt;21, 22, 23, 24, 25&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Note that the missing &lt;em&gt;map entry indices&lt;&#x2F;em&gt; are represented in the &lt;code&gt;index_entries&lt;&#x2F;code&gt; tree with uninitialized &lt;code&gt;IndexEntry&lt;&#x2F;code&gt; containers (zero value leaves in the &lt;code&gt;index_entries&lt;&#x2F;code&gt; vector). Most of these empty entries correspond to the &lt;em&gt;topic value&lt;&#x2F;em&gt; indices. Also, the last few entries of each map might be emtpy because the &lt;em&gt;map values&lt;&#x2F;em&gt; generated by a single &lt;em&gt;index entry&lt;&#x2F;em&gt; never cross a filter map boundary. So, for example, when &lt;code&gt;VALUES_PER_MAP&lt;&#x2F;code&gt; is 0x10000 and &lt;code&gt;next_index&lt;&#x2F;code&gt; is &lt;code&gt;0x2FFFE&lt;&#x2F;code&gt; and a &lt;em&gt;log entry&lt;&#x2F;em&gt; with on address and two topics is added, the last two positions of the map are left empty and the new &lt;em&gt;log entry&lt;&#x2F;em&gt; is added starting from position 0x30000.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;filter-map-row-encoding&quot;&gt;Filter map row encoding&lt;&#x2F;h4&gt;
&lt;p&gt;Each row of the &lt;em&gt;filter map&lt;&#x2F;em&gt; is encoded as a series of little endian binary encoded column indices. For encoding simplicity the column indices are always encoded as 32 bit values, regardless of the fact that &lt;code&gt;MAP_WIDTH&lt;&#x2F;code&gt; is less than 32. This only applies to consensus encoding and hashing though while local storage and proof encoding can use a more tightly packed format.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;proposed-constants&quot;&gt;Proposed constants&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;MAP_WIDTH&lt;&#x2F;td&gt;&lt;td&gt;2**24&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;MAP_HEIGHT&lt;&#x2F;td&gt;&lt;td&gt;2**16&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;VALUES_PER_MAP&lt;&#x2F;td&gt;&lt;td&gt;2**16&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;MAPS_PER_EPOCH&lt;&#x2F;td&gt;&lt;td&gt;2**10&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;MAX_EPOCH_HISTORY&lt;&#x2F;td&gt;&lt;td&gt;2**24&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;MAX_ROW_LENGTH&lt;&#x2F;td&gt;&lt;td&gt;[8, 168, 2728, 10920]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;MAPPING_FREQUENCY&lt;&#x2F;td&gt;&lt;td&gt;[2**10, 2**6, 2**2, 1]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Note that &lt;code&gt;MAX_ROW_LENGTH&lt;&#x2F;code&gt; and &lt;code&gt;MAPPING_FREQUENCY&lt;&#x2F;code&gt; parameters are specified as lists because the applicable values depend on the used &lt;em&gt;mapping layer&lt;&#x2F;em&gt;. For layers higher than the index of the last elements of these lists the last element is applicable. Also note that the &lt;code&gt;MAX_ROW_LENGTH&lt;&#x2F;code&gt; values correspond to the cumulative capacity of &lt;code&gt;ProgressiveList&lt;&#x2F;code&gt; tree levels; a layer 0 row fits into the first level, a layer 1 row fits into the first three levels and so on.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;constructing-the-filter-map&quot;&gt;Constructing the filter map&lt;&#x2F;h3&gt;
&lt;p&gt;For each &lt;code&gt;VALUES_PER_MAP&lt;&#x2F;code&gt; long section of the &lt;em&gt;map value index&lt;&#x2F;em&gt; space a &lt;em&gt;filter map&lt;&#x2F;em&gt; is generated. These are fixed size &lt;code&gt;MAP_WIDTH&lt;&#x2F;code&gt; by &lt;code&gt;MAP_HEIGHT&lt;&#x2F;code&gt; sparse bit maps and each &lt;em&gt;map value&lt;&#x2F;em&gt; is marked on the map with a single bit being set to one. The number of marks in a row (the length of the sparse encoded row) is referred to as &quot;row length&quot;, not to be confused with the constant &lt;code&gt;MAP_WIDTH&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;epochs-and-mapping-layers&quot;&gt;Epochs and mapping layers&lt;&#x2F;h4&gt;
&lt;p&gt;In order to allow efficient search of a certain &lt;em&gt;map value&lt;&#x2F;em&gt; in a long historical range, &lt;em&gt;filter maps&lt;&#x2F;em&gt; are organized into &lt;em&gt;index epochs&lt;&#x2F;em&gt;, each consisting of a fixed &lt;code&gt;MAPS_PER_EPOCH&lt;&#x2F;code&gt; number of maps. In the most usual case (when row density is around average or below) row mapping stays the same  during an entire epoch. The hash tree is organized in a way that instead of putting all rows of a single map close to each other, rows of the same &lt;em&gt;row index&lt;&#x2F;em&gt; throughout an entire epoch are close to each other and therefore are cheap to access and&#x2F;or prove with a Merkle proof.&lt;&#x2F;p&gt;
&lt;p&gt;In order to mitigate collisions in densely populated rows, the concept of &lt;em&gt;mapping layers&lt;&#x2F;em&gt; is introduced, meaning that if a certain row already has a certain number of entries then the row mapping is changed and very frequent &lt;em&gt;map values&lt;&#x2F;em&gt; are mapped into multiple rows. Initially, when a map is empty, every &lt;em&gt;map value&lt;&#x2F;em&gt; is mapped using &lt;em&gt;mapping layer&lt;&#x2F;em&gt; 0 or the &quot;base layer&quot;. If a row reaches &lt;code&gt;MAX_ROW_LENGTH[0]&lt;&#x2F;code&gt; then any further &lt;em&gt;map values&lt;&#x2F;em&gt; mapped onto that row in the base layer mapping will use layer 1 mapping instead. On layer 1 a different row is assigned to the same &lt;em&gt;map value&lt;&#x2F;em&gt; and the row length limit in increased to &lt;code&gt;MAX_ROW_LENGTH[1]&lt;&#x2F;code&gt;. If this row also reaches its limit, layer 2 mapping is used and so on. Note that a row filled at a certain &lt;em&gt;mapping layer&lt;&#x2F;em&gt; can be grown further on a higher layer. Different &lt;em&gt;map values&lt;&#x2F;em&gt; colliding in the same row on a certain layer are probably mapped in different rows on the next layer, which means that a very popular value might populate multiple rows (also very long ones) but an unlucky less popular one colliding with it on base layer will probably just have to move one layer up. The search process is similar, if the searcher finds that the row belonging to the searched value is full according to the base layer limit then it also has to check the next layer and so on, until it finds a non-full row.&lt;&#x2F;p&gt;
&lt;p&gt;If a row is longer than the limit according to the layer the searcher is looking at then it can safely ignore the extra entries assuming that they were added by another value on a higher layer. The &lt;code&gt;ProgressiveList&lt;&#x2F;code&gt; container makes it efficient to prove row data belonging to the lower layer even if there is much more data in the same row added on a higher layer.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;row-mapping&quot;&gt;Row mapping&lt;&#x2F;h4&gt;
&lt;p&gt;While base layer row mapping stays the same for an entire epoch, higher layer mappings are changed more frequently. Each mapping change has a cost in terms of database access overhead and Merkle proof size overhead and epoch size is determined in a way that these overheads stay sufficiently low compared to the cost of accessing the actual useful data. On higher layers where the rows are longer, a more frequent remapping is possible because the useful data size per map is also higher. It is also desirable so that a less frequent &lt;em&gt;map value&lt;&#x2F;em&gt; will only suffer from colliding with a more popular one for a shorter time.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;em&gt;row index&lt;&#x2F;em&gt; is calculated as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def get_row_index(map_index, layer_index: Uint, map_value_hash: Hash32) -&amp;gt; Uint:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Returns the row index where the given map value hash is mapped on the given&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    map and mapping layer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    mf_index = min(layer_index, len(MAPPING_FREQUENCY) - 1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    mapping_frequency = MAPPING_FREQUENCY[mf_index]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    masked_map_index = map_index - (map_index % mapping_frequency)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    row_hash = sha256(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        map_value_hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        + masked_map_index.to_le_bytes4()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        + layer_index.to_le_bytes4()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ).digest()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return Uint.from_le_bytes(row_hash[0:4]) % MAP_HEIGHT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The following figure shows how &lt;em&gt;map values&lt;&#x2F;em&gt; are mapped to rows on different &lt;em&gt;mapping layers&lt;&#x2F;em&gt;. Each dot represents a map row and the numbers indicate the &lt;em&gt;mapping layer&lt;&#x2F;em&gt; on which the row has been assigned to the given &lt;em&gt;map value&lt;&#x2F;em&gt;. Note that it might happen that a higher layer mapping coincides with a lower layer mapping for the same value; this does not cause any problem though as the row is simply grown further on the higher layer. The search algorithm can also simply revisit the same row in a higher layer iteration if necessary and process the rest of the row that it first ignored.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;map index        111111 1111222222222233 3333333344444444 4455555555556666&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;       0123456789012345 6789012345678901 2345678901234567 8901234567890123&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      +----------------+----------------+----------------+----------------+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;row 0 |2........2......|2...............|...2............|........2.......|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;row 1 |........1111.2..|.....2..1111....|1111.....2...2..|2111..2......2..|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;row 2 |0000000000000000|.2..2....2..2...|....2111....2...|..2.....11112...|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;row 3 |....2..22...1111|..........2.1111|2.......2.2.1111|.......2...2....|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;row 4 |.2..1111..2....2|1112..2.2....2..|0000000011110020|...21111.2....2.|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;row 5 |...2........2...|...............2|.2...2.........2|.2...2..........|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;row 6 |1111.22....2..2.|0020000000020000|.......2...2....|..........2.1112|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;row 7 |..2.............|....1112......2.|..2...2.........|0000200000000000|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      +----------------+----------------+----------------+----------------+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            epoch 0          epoch 1          epoch 2          epoch 3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Fig 2. Row mapping of a single log value on different mapping layers&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;MAP_HEIGHT = 8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;MAPS_PER_EPOCH = 16&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;MAPPING_FREQUENCY = [16, 4, 1]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;column-mapping&quot;&gt;Column mapping&lt;&#x2F;h4&gt;
&lt;p&gt;Column mapping assumes that &lt;code&gt;MAP_WIDTH&lt;&#x2F;code&gt; is a multiple of &lt;code&gt;VALUES_PER_MAP&lt;&#x2F;code&gt;. &lt;em&gt;column index&lt;&#x2F;em&gt; is calculated as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def get_column_index(map_value_index: Uint, map_value_hash: Hash32) -&amp;gt; Uint:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Returns the column index where the given entry hash is mapped at the given&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    entry index.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    col_hash = fnv1a_64(map_value_index.to_le_bytes8() + map_value_hash)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    folded_hash = (col_hash &amp;gt;&amp;gt; 32) ^ (col_hash &amp;amp; 0xFFFFFFFF)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    hash_bits = LOG2_MAP_WIDTH - LOG2_VALUES_PER_MAP&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (map_value_index % VALUES_PER_MAP)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;lt;&amp;lt; hash_bits + folded_hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;gt;&amp;gt; (32 - hash_bits)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;As shown on the figure below, this mapping practically assigns a &lt;code&gt;MAP_WIDTH &#x2F;&#x2F; VALUES_PER_MAP&lt;&#x2F;code&gt; by &lt;code&gt;MAP_HEIGHT&lt;&#x2F;code&gt; rectangle to each &lt;em&gt;map value index&lt;&#x2F;em&gt; and ensures that each &lt;em&gt;map value&lt;&#x2F;em&gt; places exactly one mark in its own rectangle (the letters A-D represent different &lt;em&gt;map values&lt;&#x2F;em&gt;). This property also ensures that &lt;em&gt;map value index&lt;&#x2F;em&gt; can be restored from &lt;em&gt;map index&lt;&#x2F;em&gt; and &lt;em&gt;column index&lt;&#x2F;em&gt;, column indices never collide and keep the original order of &lt;em&gt;map value&lt;&#x2F;em&gt; indices, allowing efficient Merkle exclusion proofs of certain &lt;em&gt;column indices&lt;&#x2F;em&gt; in long rows.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;column             11 1111 1111 2222 2222 2233&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;       0123 4567 8901 2345 6789 0123 4567 8901&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      +---------------------------------------+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;row 0 |.... .... .... .... .... .... .... ....|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;row 1 |.... .... .... .... .... .C.. .... ....|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;row 2 |.A.. .... ...A .... A... .... ...A ....|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;row 3 |.... .... .... .... .... .... .... ....|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;row 4 |.... .... .... .... .... .... .... ....|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;row 5 |.... .B.. .... ...B .... .... .... ....|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;row 6 |.... .... .... .... .... .... .... ..D.|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;row 7 |.... .... .... .... .... .... .... ....|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      +---------------------------------------+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Fig 3. A single filter map with 8 entries of 4 different log values&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;MAP_WIDTH = 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;MAP_HEIGHT = 8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;VALUES_PER_MAP = 8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;updating-the-log-index-and-calculating-the-root-hash&quot;&gt;Updating the log index and calculating the root hash&lt;&#x2F;h3&gt;
&lt;p&gt;See the following functions in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7745&#x2F;.&#x2F;assets&#x2F;log_index.py&quot;&gt;log_index.py&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;log_index_add_log_entries&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;log_index_add_transaction_entry&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;log_index_add_block_entry&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;log_index_root&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note that the &lt;em&gt;block entry&lt;&#x2F;em&gt; may be added either after building&#x2F;verifying the given block or before processing the next one, but &lt;code&gt;log_index_root&lt;&#x2F;code&gt; should always be calculated after adding transaction and log entries and before adding the block entry for the some block (block building would not even be possible otherwise as the log index root is referenced in the block header).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;finding-potential-matches&quot;&gt;Finding potential matches&lt;&#x2F;h3&gt;
&lt;p&gt;Determining whether a &lt;em&gt;column index&lt;&#x2F;em&gt; found in the appropriate row is relevant for the searched &lt;em&gt;map value&lt;&#x2F;em&gt; is possible by restoring the &lt;em&gt;map value index&lt;&#x2F;em&gt; and then calculating the &lt;em&gt;column index&lt;&#x2F;em&gt; from it again in order to check whether the quasi-random collision filter part matches the expected value for the given &lt;em&gt;map value&lt;&#x2F;em&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def get_map_value_index(map_index, column_index: Uint) -&amp;gt; Uint:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    map_value_width = MAP_WIDTH &#x2F;&#x2F; VALUES_PER_MAP&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return map_index * VALUES_PER_MAP + column_index &#x2F;&#x2F; map_value_width&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def is_potential_match(map_index, column_index: Uint, map_value: Hash32) -&amp;gt; bool:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return get_column_index(get_map_value_index(map_index, column_index), map_value) == column_index&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Iterating through all relevant &lt;em&gt;mapping layers&lt;&#x2F;em&gt; and corresponding rows is similar to how new &lt;em&gt;map values&lt;&#x2F;em&gt; are added. Filtering all potential matches from all relevant rows can be done with the following function:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def get_potential_matches((log_index: LogIndexReader, map_index: Uint, map_value: Hash) -&amp;gt; List[Uint]:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    matches = []&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    layer_index = 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    while True:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        mr_index = min(layer_index, len(MAX_ROW_LENGTH) - 1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        max_row_length = MAX_ROW_LENGTH[mr_index]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        row_index = get_row_index(map_index, layer_index, map_value)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        row = get_filter_row(log_index, map_index, row_index)[:max_row_length]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        for column_index in row:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if is_potential_match(map_index, column_index, log_value):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                matches.append(get_log_value_index(map_index, column_index))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        if len(row) &amp;lt; max_row_length:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            break&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        layer_index += 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return matches&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;initialization-minimal-state-and-wire-protocol-extension&quot;&gt;Initialization, minimal state and wire protocol extension&lt;&#x2F;h3&gt;
&lt;p&gt;It is a property of the log index tree that over time most of the tree nodes get finalized, which means that in a minimal log index state representation finalized subtrees can be collapsed into a single tree node as their descendants are no longer needed for adding new entries. At every single moment there is one &lt;em&gt;filter map&lt;&#x2F;em&gt; being updated, maybe the few most recently completed maps might still be affected by a reorg, but if the chain finalizes properly then all but the few most recent maps are also finalized. Internal tree nodes with all finalized children are also finalized and can be collapsed into the lowest finalized ancestor. Similarly, internal nodes covering a range that has not been touched yet can be stored without having their children in memory, and they can be expanded on demand.&lt;&#x2F;p&gt;
&lt;p&gt;Certain types of clients (those only interested in validation and not in using&#x2F;serving log index data) have the option to just maintain this minimal log index state. Those who are interested in event history should probably also only keep the minimal state in memory and store the finalized and collapsed subtrees on disk. Clients can also initialize their log index with such a minimal state and then optionally regenerate the older parts from blocks and receipts locally. When the log index state of a finalized block is represented and no room for rollback is needed, the minimal tree representation simplifies into a set of Merkle branches leading to the map rows and to the &lt;em&gt;index entry&lt;&#x2F;em&gt; corresponding to &lt;code&gt;next_index&lt;&#x2F;code&gt; (with everything on the left side of these branches collapsed and nothing on their right sides expanded yet). Assuming an efficient encoding of the current &lt;code&gt;filter_map_rows&lt;&#x2F;code&gt; where the variable length of each filter row is encoded in two bytes and the column indices tightly packed into 3 bytes each, the minimal log index state can be serialized into 21300808 bytes. This number can be considered as an estimate of the amount of data required to initialize the log index data structure at any point.&lt;&#x2F;p&gt;
&lt;p&gt;Note that initialization is also possible on an epoch boundary, in which case the log index is very cheap to initialize (only requires the last &lt;em&gt;block entry&lt;&#x2F;em&gt; branch before the epoch boundary and the first one after) but in this case all blocks and receipts between the boundary and the current head are required to generate the last unfinished epoch. Epoch boundary initialization can also be used to index further historical epochs after the initialization of the head state.&lt;&#x2F;p&gt;
&lt;p&gt;Both head state initialization and epoch boundary initialization requires the extension of the Ethereum Wire Protocol through which clients can request Merkle multiproofs to initialize the required parts of the log index tree, using a recently finalized block as the starting point. Note that since the total amount of initialization data is too big to fit in a single devp2p response, the protocol splits the data into multiple subsets, each obtainable in the form of a separately verifiable log index Merkle proof. See the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7745&#x2F;assets&#x2F;wire_protocol_extension&#x2F;&quot;&gt;wire protocol extension&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7745&#x2F;assets&#x2F;log_index_proof_format&#x2F;&quot;&gt;log index proof format&lt;&#x2F;a&gt; specs for further details.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;design-goals&quot;&gt;Design goals&lt;&#x2F;h3&gt;
&lt;p&gt;The proposed data structure is intended to realize a balance between the cost of adding items and accessing old ones. In a search structure of a constantly growing dataset there is typically a tradeoff between the cost of adding new data and the cost of searcing the existing dataset. One extreme is just linearly storing the data, which is practically the case now with logs, with the bloom filters being mostly useless. The other extreme is one big Merkle tree with all &lt;em&gt;map values&lt;&#x2F;em&gt; ever used as keys and the list of all occurences (possibly in a further merkleized format) as values. With billions of unique &lt;em&gt;map values&lt;&#x2F;em&gt;, adding new entries here is expected to have costs similar to that of the state, with multiple lookups and modifications&#x2F;insertions at random places in a database on the order of magnitude of hundreds of gigabytes. Another issue where this is similar to the state is that removing old entries is hard and expensive. Adding logs is supposed to be cheaper than writing the state so solutions between these two extremes were considered as potentially practical, with multiple smaller structures generated periodically.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;em&gt;filter maps&lt;&#x2F;em&gt; have a fixed tree size and an efficient tree hashing scheme. Filter entries are sorted into rows based on content and position in a way that allows quick linear database access and size efficient Merkle proofs. The difficulties arising from certain types of events being much more frequent than others are also mitigated. Update and maintenance costs are also limited as tree nodes are eventually finalized and the number of non-finalized non-empty nodes is always hard capped, ensuring moderate memory requirements. Initialization costs of the data structure at any point of the chain are also capped. Additional database storage costs of &lt;em&gt;filter maps&lt;&#x2F;em&gt; is about 15-20% of the size of the actual logs, depending on certain implementation tradeoffs. The Merkle tree structure also makes it easy to discard entire epochs along with the corresponding Merkle subtrees, making the implementation of history expiry of the log index simple.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;map-value-index-space&quot;&gt;Map value index space&lt;&#x2F;h3&gt;
&lt;p&gt;In each block a varying number of &lt;em&gt;map values&lt;&#x2F;em&gt; are emitted. In addition to inefficient search, another drawback of per-block fixed size bloom filters is the varying filter utilization leading to over-utilized filters giving many false positives in some blocks and&#x2F;or wastefully under-utilized filters in some blocks. Block gas limits also tend to change significantly over the long term so any future-proof solution has to be able to adapt to the varying number of &lt;em&gt;map values&lt;&#x2F;em&gt; per block.&lt;&#x2F;p&gt;
&lt;p&gt;Mapping &lt;em&gt;map values&lt;&#x2F;em&gt; on their own linear index space ensures uniform filter utilization of identically structured &lt;em&gt;filter maps&lt;&#x2F;em&gt;. Compared to the alternative of constantly changing adaptive filter size, this approach greatly improves the efficiency of database access and Merkle proofs. It also allows efficient search pattern filtering as each potential match provides exact position information.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;index-entries-tree&quot;&gt;Index entries tree&lt;&#x2F;h3&gt;
&lt;p&gt;Hashing every event into the &lt;code&gt;index_entries&lt;&#x2F;code&gt; tree keyed by &lt;em&gt;map entry index&lt;&#x2F;em&gt; is additional work and complexity but it simplifies the proving process significantly. Proving the events based only on &lt;em&gt;map value indices&lt;&#x2F;em&gt; would be possible if receipts had a &lt;em&gt;map value index&lt;&#x2F;em&gt; pointer hashed into them (so the client could also verify that the received receipt actually covers the &lt;em&gt;map value index&lt;&#x2F;em&gt; derived from the &lt;em&gt;filter map&lt;&#x2F;em&gt;; in this case though an extra mechanism would be necessary to prove that the receipt is referenced in a block that is part of the same canonical chain where the log index root was referenced. Proving old canonical blocks is currently theoretically possible through the beacon chain but painful and also would require extra infrastructure. On the other hand, the &lt;code&gt;index_entries&lt;&#x2F;code&gt; tree not only solves the problem of proving the matching canonical receipts, with the &lt;em&gt;block entries&lt;&#x2F;em&gt; it also provides a convenient way to prove canonical EL blocks through EL data structures only, and even provides provable canonical block hash to block number lookups.&lt;&#x2F;p&gt;
&lt;p&gt;Note though that storing the entire&lt;code&gt;index_entries&lt;&#x2F;code&gt; trees directly in their proposed merkleized format on disk is not really efficient. This is not an issue for validators that want to maintain a minimal state; for them, updating the &lt;code&gt;index_entries&lt;&#x2F;code&gt; subtrees is really cheap as they only need to maintain a single Merkle branch pointing to the next &lt;em&gt;map value index&lt;&#x2F;em&gt;. Provers can implement &lt;code&gt;index_entries&lt;&#x2F;code&gt; efficiently by storing a subset of the Merkle tree nodes (the ones at least a few levels below leaf level in order to save space) and generate the rest on demand based on the receipts that encode the same data in a more compact form.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;alternative-filter-structures-considered&quot;&gt;Alternative filter structures considered&lt;&#x2F;h3&gt;
&lt;p&gt;One question considered was whether to periodically build lookup trees of events with each unique &lt;em&gt;map value&lt;&#x2F;em&gt; emitted in a given period being a separate key under which only the occurences of that specific event are listed, or to use a more compressed fixed size tree format where different &lt;em&gt;map values&lt;&#x2F;em&gt; might collide (though preferably not too many of them). This decision mostly boiled down to data access efficiency, both in terms of local disk access and remote Merkle proof size. Identically structured trees can be efficiently arranged in larger units (called &lt;em&gt;index epochs&lt;&#x2F;em&gt; here), with values belonging to the same key in subsequent trees of an epoch located close to each other. This improves database access speed. It also allows smaller Merkle proofs with a series of leaves encoded together in an efficient format and internal nodes on only two boundary branches. Database writes are also efficient as the order of adding tree entries is not random and all the non-finalized parts of the tree can be kept in memory with a hard capped memory requirement.&lt;&#x2F;p&gt;
&lt;p&gt;The other design decision considered here was whether to hash entire index entries into the list of &lt;em&gt;map value&lt;&#x2F;em&gt; occurences or just store position info and have a separate tree of log entries. Though the separate &lt;code&gt;filter_maps&lt;&#x2F;code&gt; and &lt;code&gt;index_entries&lt;&#x2F;code&gt; structures do present some additional complexity, the second option was chosen because of the size of Merkle proofs. Looking up a rarely used &lt;em&gt;map value&lt;&#x2F;em&gt; means encountering more irrelevant entries than relevant ones. By adding probabilistic filter information to position information, the vast majority of the irrelevant entries can be filtered out after accessing&#x2F;proving 3 bytes of data instead of an entire &lt;em&gt;map value&lt;&#x2F;em&gt; (32 bytes). When proving matches of multiple &lt;em&gt;map value&lt;&#x2F;em&gt; patterns this 10x advantage exists even with more frequent individual lookup values. Tests have shown that realistic log searches often yield a lot more matches for the individual &lt;em&gt;map values&lt;&#x2F;em&gt; themselves that the pattern itself. Pattern matching can be performed on the position information of individual potential matches and actual &lt;em&gt;index entries&lt;&#x2F;em&gt; only need to be proven at the potential pattern matches.&lt;&#x2F;p&gt;
&lt;p&gt;In conclusion, for the given application the fixed tree size approach with separate position info plus probabilistic collision filter approach seemed to be the most appropriate.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;false-positive-rate&quot;&gt;False positive rate&lt;&#x2F;h3&gt;
&lt;p&gt;From the &lt;em&gt;filter maps&lt;&#x2F;em&gt; a set of potential matches can be derived for any block range and &lt;em&gt;map value&lt;&#x2F;em&gt; or pattern of &lt;em&gt;map values&lt;&#x2F;em&gt;. These matches can then be looked up in the corresponding &lt;code&gt;index_entries&lt;&#x2F;code&gt; trees and actually matching events can be added to the set of results. The design guarantees that the set of potential matches includes all actual matches but and also has a consistently low false positive rate.&lt;&#x2F;p&gt;
&lt;p&gt;False positives can happen when the quasi-random collision filter part of a &lt;em&gt;column index&lt;&#x2F;em&gt; accidentally matches the expected value even though it was generated by a &lt;em&gt;map value&lt;&#x2F;em&gt; other than the searched one. The chance of this happening is &lt;code&gt;VALUES_PER_MAP &#x2F; MAP_WIDTH&lt;&#x2F;code&gt; per colliding enrty in a row that is relevant for the search. Assuming that most entries in a map are different from the searched one, assuming uniform random distribution of entries, the average number of colliding entries found in a relevant row is &lt;code&gt;VALUES_PER_MAP &#x2F; MAP_HEIGHT&lt;&#x2F;code&gt; giving an average false positive rate of &lt;code&gt;VALUES_PER_MAP ** 2 &#x2F; MAP_WIDTH &#x2F; MAP_HEIGHT&lt;&#x2F;code&gt; per &lt;em&gt;filter map&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Though certain &lt;em&gt;map values&lt;&#x2F;em&gt; might be emitted a lot more than others and therefore the &lt;em&gt;row index&lt;&#x2F;em&gt; distribution might not be entirely uniform, periodical remapping of rows and using multiple &lt;em&gt;mapping layers&lt;&#x2F;em&gt; ensures that over a long enough search period random collisions with more frequent &lt;em&gt;map values&lt;&#x2F;em&gt; do even out. &lt;em&gt;Mapping layers&lt;&#x2F;em&gt; do have another consequence though; if any row has at least &lt;code&gt;MAX_ROW_LENGTH[0]&lt;&#x2F;code&gt; entries then the search logic requires looking into another row that is mapped to the searched &lt;em&gt;map value&lt;&#x2F;em&gt; on the next &lt;em&gt;mapping layer&lt;&#x2F;em&gt;. The maximum possible number of such rows is &lt;code&gt;VALUES_PER_MAP &#x2F; MAX_ROW_LENGTH[0]&lt;&#x2F;code&gt; and therefore the chance of randomly hitting one is &lt;code&gt;VALUES_PER_MAP &#x2F; MAX_ROW_LENGTH[0] &#x2F; MAP_HEIGHT&lt;&#x2F;code&gt; in the worst case. In this case an extra row has to be processed, with extra chance of finding false positives. A collision with a frequent value at a certain &lt;em&gt;mapping layer&lt;&#x2F;em&gt; does not indicate a collision on the next layer though, therefore the expected number of entries in that row is no different from the first one. Having to process a third row would presume that the second one had at least &lt;code&gt;MAX_ROW_LENGTH[1]&lt;&#x2F;code&gt; entries. The chance of this happening after the first coincidence is practically negligible in the context of expected false positives.&lt;&#x2F;p&gt;
&lt;p&gt;The expected number of false positives for a single &lt;em&gt;map value&lt;&#x2F;em&gt; search can be estimated as &lt;code&gt;VALUES_PER_MAP ** 2 &#x2F; MAP_WIDTH &#x2F; MAP_HEIGHT * (1 + VALUES_PER_MAP &#x2F; MAX_ROW_LENGTH[0] &#x2F; MAP_HEIGHT)&lt;&#x2F;code&gt; per &lt;em&gt;filter map&lt;&#x2F;em&gt;. With the proposed constants this roughly equals 0.0044 false positives per map. As of March 2025 the average number of &lt;em&gt;map values&lt;&#x2F;em&gt; emitted in a mainnet block is slightly over 1000 while a &lt;em&gt;filter map&lt;&#x2F;em&gt; consists of 65536 &lt;em&gt;map values&lt;&#x2F;em&gt;. This gives a rough estimate of one false positive per 14000 blocks, which costs the searcher an extra lookup in a &lt;code&gt;log_entries&lt;&#x2F;code&gt; tree. The expected number of false positives in the entire chain history is around 1200.&lt;&#x2F;p&gt;
&lt;p&gt;Note that this is only true for a single value search while a typical pattern search requiring certain values on multiple positions has an exponentially lower false positive rate. For example if the pattern is [Addr, Topic1, Topic2] then three &lt;em&gt;map value&lt;&#x2F;em&gt; searches are performed and an actual log lookup is only necessary if the first search yields &lt;code&gt;N&lt;&#x2F;code&gt;, the second &lt;code&gt;N+1&lt;&#x2F;code&gt; and the third &lt;code&gt;N+2&lt;&#x2F;code&gt; simultaneously. If necessary, the rate can be easily reduced by using a higher &lt;code&gt;MAP_WIDTH&lt;&#x2F;code&gt;, at the cost of growing the size of encoded rows.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The existing log filter API (&lt;code&gt;eth_getLogs&lt;&#x2F;code&gt;, &lt;code&gt;eth_newFilter&lt;&#x2F;code&gt;, &lt;code&gt;eth_getFilterLogs&lt;&#x2F;code&gt;, &lt;code&gt;eth_getFilterChanges&lt;&#x2F;code&gt;) can be implemented with the new filter data structure. Applications relying on this API can operate without any change, benefiting from a higher search performance. Repricing the &lt;code&gt;LOG&lt;&#x2F;code&gt; opcode might be considered after performing benchmarks but the extra processing cost is not significant while the extra storage cost is around 15%. Other than that the EVM is not affected in any way as it only emits logs but does not directly access them.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;safe-access-with-a-remote-prover&quot;&gt;Safe access with a remote prover&lt;&#x2F;h3&gt;
&lt;p&gt;In order to prove a complete set of matches matching a given search pattern in a given block range, the prover needs to&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;prove the &lt;em&gt;map value index&lt;&#x2F;em&gt; range that corresponds to the searched block number range by proving the &lt;em&gt;block entries&lt;&#x2F;em&gt; of &lt;code&gt;first_block - 1&lt;&#x2F;code&gt; and &lt;code&gt;last_block&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;prove the relevant rows of &lt;em&gt;filter maps&lt;&#x2F;em&gt; based on &lt;em&gt;map index&lt;&#x2F;em&gt; and &lt;em&gt;row index&lt;&#x2F;em&gt; (verifier can determine the relevant rows in advance based on the &lt;em&gt;map values&lt;&#x2F;em&gt; in the search pattern and the relevant &lt;em&gt;map value index&lt;&#x2F;em&gt; range)&lt;&#x2F;li&gt;
&lt;li&gt;prove the actual &lt;em&gt;index entry&lt;&#x2F;em&gt; belonging to any potentially matching &lt;em&gt;map value index&lt;&#x2F;em&gt; and also the &lt;em&gt;block entry&lt;&#x2F;em&gt; with the same block number if the &lt;code&gt;blockHash&lt;&#x2F;code&gt; of the log position info is needed&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Since all three steps can be realized with Merkle proofs of the same &lt;code&gt;LogIndex&lt;&#x2F;code&gt; structure referenced in the block headers, any search with a remove prover is as safe as the client&#x27;s knowledge about the chain head.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;deliberate-false-positive-attacks&quot;&gt;Deliberate false positive attacks&lt;&#x2F;h3&gt;
&lt;p&gt;The design guarantees that false positive rates do even out statistically over several epochs, even in case of random collisions with very frequent values, ensuring that an excessive amount false positives will not make the bandwidth and processing costs of the search prohibitively high. All of this is true for random collisions only though, not deliberately created collisions. A deliberate attack on a certain important &lt;em&gt;map value&lt;&#x2F;em&gt; in order to raise its false positive rate can not be ruled out entirely since with a low amount of filter data generated per &lt;em&gt;map value&lt;&#x2F;em&gt; it is always possible to &quot;mine&quot; another value that generates colliding filter data. The column mapping used here makes this attack a lot harder though, since the &lt;em&gt;column index&lt;&#x2F;em&gt; depends on both the &lt;em&gt;map value&lt;&#x2F;em&gt; and the exact &lt;em&gt;map value index&lt;&#x2F;em&gt;, making this attack only possible for block builders who are probably offered MEV rewards for much more lucrative manipulations of the transaction set than making the search of certain events slightly more expensive.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Composable Security Middleware Hooks</title>
        <published>2024-07-17T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Tim Pechersky</name><uri>https://github.com/peersky</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7746/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7746-composable-security-middleware-hooks/19471" />
        

        <id>https://wg-eips.ritovision.com/7746/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="last-call"
                label="Last Call" />
            
        

        
        <category
            term="tag:eip:7746"
            label="ERC-7746" />
        

        
        

        
        <summary type="html">An interface for composable, runtime security checks in smart contracts.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7746/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes a standard interface, &lt;code&gt;ILayer&lt;&#x2F;code&gt;, for implementing composable security layers in smart contracts. These layers act as middleware, enabling runtime validation of function calls before and after execution, independent of the protected contract&#x27;s logic. This approach facilitates modular security, allowing independent providers to manage and upgrade security layers across multiple contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Current smart contract security practices often rely on monolithic validation logic within the contract itself. This can lead to tightly coupled code, making it difficult to isolate and address security concerns. Better structured architecture is needed, middleware like approach is widely used in the industry, allowing to wrap calls in other calls in generic and repeatable pattern with same call signatures.&lt;&#x2F;p&gt;
&lt;p&gt;The Security Layers Standard introduces a modular approach, enabling:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Independent Security Providers:&lt;&#x2F;strong&gt; Specialized security providers can focus on developing and maintaining specific security checks.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Composable Security:&lt;&#x2F;strong&gt; Layers can be combined to create comprehensive security profiles tailored to individual contract needs.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Upgradability:&lt;&#x2F;strong&gt; Security layers can be updated without requiring changes to the protected contract.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Flexibility:&lt;&#x2F;strong&gt; Layers can perform a wide range of validation checks, including access control, input sanitization, output verification, and more.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Having a generalized standard for such layers can help to build more secure and modular systems as well as enable security providers to build generic, service-oriented security oracle solutions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;A contract implementing the &lt;code&gt;ILayer&lt;&#x2F;code&gt; interface MUST provide two functions:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0.8.20&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ILayer&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Validates a function call before execution.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; configuration&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Layer-specific configuration data.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; selector&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The function selector being called.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address initiating the call.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of ETH sent with the call (if any).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The calldata for the function call.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; beforeCallResult&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Arbitrary data to be passed to `afterCallValidation`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST revert if validation fails.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; beforeCall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; configuration&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; selector&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Validates a function call after execution.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; configuration&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Layer-specific configuration data.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; selector&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The function selector being called.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address initiating the call.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of ETH sent with the call (if any).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The calldata for the function call.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; beforeCallResult&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The data returned by `beforeCallValidation`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST revert if validation fails.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; afterCall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; configuration&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; selector&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; beforeCallResult&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;A protected contract MAY integrate security layers by calling the &lt;code&gt;beforeCallValidation&lt;&#x2F;code&gt; function before executing its logic and the &lt;code&gt;afterCallValidation&lt;&#x2F;code&gt; function afterwards. Multiple layers can be registered and executed in a defined order. The protected contract MUST revert if any layer reverts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;Flexibility&lt;&#x2F;strong&gt;: The &lt;code&gt;layerConfig&lt;&#x2F;code&gt; parameter allows for layer-specific customization, enabling a single layer implementation to serve multiple contracts with varying requirements.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;non-static calls&lt;&#x2F;strong&gt;: Layers can maintain their own state, allowing for more complex validation logic (e.g., rate limiting, usage tracking).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Strict Validation&lt;&#x2F;strong&gt;: Reverts on validation failure ensure a fail-safe mechanism, preventing execution of potentially harmful transactions.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Gas Costs&lt;&#x2F;strong&gt;: Layers naturally will have gas costs associated with their execution. However, the benefits of enhanced security and modularity outweigh these costs, especially as blockchain technology continues to evolve and we expect gas costs to decrease over time.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;A reference implementation of the &lt;code&gt;ILayer&lt;&#x2F;code&gt; interface and a sample protected contract can be found in the repository:
In the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7746&#x2F;.&#x2F;assets&#x2F;ILayer.sol&quot;&gt;&lt;code&gt;ILayer.sol&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; a reference interface is provided.&lt;&#x2F;p&gt;
&lt;p&gt;In this test, a &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7746&#x2F;.&#x2F;assets&#x2F;test&#x2F;Protected.sol&quot;&gt;&lt;code&gt;Protected.sol&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; contract is protected by a &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7746&#x2F;.&#x2F;assets&#x2F;test&#x2F;RateLimitLayer.sol&quot;&gt;&lt;code&gt;RateLimitLayer.sol&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; layer. The &lt;code&gt;RateLimitLayer&lt;&#x2F;code&gt; implements the &lt;code&gt;ILayer&lt;&#x2F;code&gt; interface and enforces a rate which client has configured.
The &lt;code&gt;Drainer&lt;&#x2F;code&gt; simulates a vulnerable contract that acts in a malicious way. In the &lt;code&gt;test.ts&lt;&#x2F;code&gt; The &lt;code&gt;Drainer&lt;&#x2F;code&gt; contract is trying to drain the funds from the &lt;code&gt;Protected&lt;&#x2F;code&gt; contract. It is assumed that &lt;code&gt;Protected&lt;&#x2F;code&gt; contract has bug that allows partial unauthorized access to the state.
The &lt;code&gt;RateLimitLayer&lt;&#x2F;code&gt; is configured to allow only 10 transactions per block from same sender. The test checks that the &lt;code&gt;Drainer&lt;&#x2F;code&gt; contract is not able to drain the funds from the &lt;code&gt;Protected&lt;&#x2F;code&gt; contract.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;Layer Trust&lt;&#x2F;strong&gt;: Thoroughly audit and vet any security layer before integrating it into your contract. Malicious layers can compromise contract security.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Code Index</title>
        <published>2024-07-16T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Tim Pechersky</name><uri>https://github.com/peersky</uri><email>t@peersky.xyz</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7744/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7744-code-index/20569" />
        

        <id>https://wg-eips.ritovision.com/7744/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="last-call"
                label="Last Call" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7744"
            label="ERC-7744" />
        

        
        

        
        <summary type="html">Global repository of bytecode, enabling developers, auditors, and researchers to find, analyze, and reuse bytecode efficiently.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7744/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP defines a standard interface for indexing smart contracts on Ethereum by their bytecode hash. This enables trustless discovery and verification of contract code, facilitating use cases like bytecode signing, whitelisting, and decentralized distribution mechanisms.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Existing contract discovery relies on addresses, which are non-deterministic and can be obfuscated through proxies. Indexing by bytecode hash provides a deterministic and tamper-proof way to identify and verify contract code, enhancing security and trust in the Ethereum ecosystem.&lt;&#x2F;p&gt;
&lt;p&gt;Consider a security auditor who wants to attest to the integrity of a contract&#x27;s code. By referencing bytecode hashes, auditors can focus their audit on the bytecode itself, without needing to assess deployment parameters or storage contents. This method verifies the integrity of a contract&#x27;s codebase without auditing the entire contract state.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, bytecode referencing allows whitelist contracts before deployment, allowing developers to get pre-approval for their codebase without disclosing the code itself, or even pre-setup infrastructure that will change it behavior upon adding some determined functionality on chain.&lt;&#x2F;p&gt;
&lt;p&gt;For developers relying on extensive code reuse, bytecode referencing protects against malicious changes that can occur with address-based referencing through proxies. This builds long-term trust chains extending to end-user applications.&lt;&#x2F;p&gt;
&lt;p&gt;For decentralized application (dApp) developers, a code index can save gas costs by allowing them to reference existing codebases instead of redeploying them, optimizing resource usage. This can be useful for dApps that rely on extensive re-use of same codebase as own dependencies.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-this-registry-needs-to-be-an-erc&quot;&gt;Why this registry needs to be an ERC&lt;&#x2F;h3&gt;
&lt;p&gt;The Code Index is essential for trustless and secure smart contract development. By standardizing the interface for indexing contracts by their bytecode, developers can easily integrate this feature into their smart contracts, enhancing the security and trustworthiness of the Ethereum ecosystem.&lt;&#x2F;p&gt;
&lt;p&gt;Its simplicity and generic nature make it suitable for a wide range of applications. The ability to globally reference the same codebase makes it an ideal candidate for standardization.&lt;&#x2F;p&gt;
&lt;p&gt;Ultimately, this feature should be incorporated into EIP standards, as it is a fundamental building block for trustless and secure smart contract development. This standard is a step towards this goal.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0.8.28&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC7744&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERC7744.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Byte Code Indexer Contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; You can use this contract to index contracts by their bytecode.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This allows to query contracts by their bytecode instead of addresses.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@author&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Tim Pechersky (@Peersky)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC7744&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7744&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; index&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isEIP7702&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes3&lt;&#x2F;span&gt;&lt;span&gt; prefix&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            extcodecopy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x40&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Copy first 3 bytes to memory&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            prefix &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x40&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Load the 3 bytes from memory&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; prefix &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes3&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xef0100&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isValidContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; code &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; container&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; codeHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;codehash&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; codeHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isEIP7702&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Registers a contract in the index by its bytecode hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; container&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The contract to register&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `msg.codeHash` will be used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; It will revert if the contract is already indexed or if returns EIP7702 delegated EOA&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; register&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; etalon &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; index&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;container&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;codehash&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isValidContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Invalid container&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;etalon &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isValidContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;etalon&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; alreadyExists&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;container&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;codehash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        index&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;container&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;codehash&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; container&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Indexed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;container&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; container&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;codehash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the contract address by its bytecode hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; returns zero if the contract is not indexed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The bytecode hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; contract address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; index&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;id&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;deployment-method&quot;&gt;Deployment method&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;CodeIndex&lt;&#x2F;code&gt; contract is deployed at: &lt;code&gt;0xC0De1D1126b6D698a0073A4e66520111cEe22F62&lt;&#x2F;code&gt; using &lt;code&gt;CREATE2&lt;&#x2F;code&gt; via the deterministic deployer at &lt;code&gt;0x4e59b44847b379578588920ca78fbf26c0b4956c&lt;&#x2F;code&gt; with a salt of &lt;code&gt;0x9425035d50edcd7504fe5eeb5df841cc74fe6cccd82dca6ee75bcdf774bd88d9&lt;&#x2F;code&gt; is obtained by seeking a vanity address starting with meaningful name &quot;Code ID (&lt;code&gt;c0de1d&lt;&#x2F;code&gt;) for a bytecode compiled with &lt;code&gt;solc 0.8.28&lt;&#x2F;code&gt; as &lt;code&gt;solc --input-file src&#x2F;ERC7744.sol --bin --optimize --optimize-runs 2000 --metadata-hash none --via-ir --optimize-yul&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;Bytecode over Addresses&lt;&#x2F;strong&gt;: Bytecode is deterministic and can be verified on-chain, while addresses are opaque and mutable.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Reverting on re-indexing&lt;&#x2F;strong&gt;: There is small, yet non-zero probability of hash collision attack. Disallowing updates to indexed location of bytecode coupes with this.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Simple Interface&lt;&#x2F;strong&gt;: The interface is minimal and focused to maximize composability and ease of implementation.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Library Implementation&lt;&#x2F;strong&gt;: Implementing this as a library would limit its impact, making code reuse more difficult and lacking a single, official source of truth. By establishing this as an ERC, we ensure standardization and widespread adoption, driving the ecosystem forward.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Reference implementation of the Code Index can be found in the assets folder. There you can find the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7744&#x2F;.&#x2F;assets&#x2F;IERC7744.sol&quot;&gt;interface&lt;&#x2F;a&gt; and the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7744&#x2F;.&#x2F;assets&#x2F;ERC7744.sol&quot;&gt;implementation&lt;&#x2F;a&gt; of the Code Index.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;Malicious Code&lt;&#x2F;strong&gt;: The index does NOT guarantee the safety or functionality of indexed contracts. Users MUST exercise caution and perform their own due diligence before interacting with indexed contracts.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Storage contents of registered contracts&lt;&#x2F;strong&gt;: The index only refers to the bytecode of the contract, not the storage contents. This means that the contract state is not indexed and may change over time.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt;&lt;&#x2F;strong&gt;: The index does not index the EIP-7702 delegated accounts. During attempt to register, it checks if contract code begins with reserved delegation designator &lt;code&gt;0xef0100&lt;&#x2F;code&gt; and if so, it will revert.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Self-Destruct Contracts&lt;&#x2F;strong&gt;: In case of indexed contract storage becomes empty, contracts may be re-indexed, During register function call, if contract is already indexed, we run &lt;code&gt;isValidContainer&lt;&#x2F;code&gt; check on the indexed address. It it fails, re-indexing is allowed with a newly specified address.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Multi-Owner Non-Fungible Tokens (MO-NFT)</title>
        <published>2024-07-13T00:00:00+00:00</published>
        <updated>2026-04-25T12:06:20+00:00</updated>
	
	
	<author>
		<name>Cheng Qian</name><uri>https://github.com/jamesavechives</uri><email>james.walstonn@gmail.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7743/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/discussion-on-eip-7743-multi-owner-non-fungible-tokens-mo-nft/20577" />
        

        <id>https://wg-eips.ritovision.com/7743/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:7743"
            label="ERC-7743" />
        

        
        

        
        <summary type="html">Non-fungible token that supports multiple owners, allowing shared ownership and transferability among users.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7743/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC proposes a new standard for non-fungible tokens (NFTs) that supports multiple owners. The MO-NFT standard allows a single NFT to have multiple owners, reflecting the shared and distributable nature of digital assets. This model incorporates mechanisms for provider-defined transfer fees and ownership archiving, enabling flexible and collaborative ownership structures. It maintains compatibility with the existing &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; standard to ensure interoperability with current tools and platforms.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Traditional NFTs enforce a single-ownership model, which does not align with the inherent duplicability and collaborative potential of digital assets. MO-NFTs allow for shared ownership, promoting wider distribution and collaboration while maintaining secure access control. The inclusion of provider fees and ownership archiving enhances the utility and flexibility of NFTs in representing digital assets and services.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;token-creation-and-ownership-model&quot;&gt;Token Creation and Ownership Model&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Minting&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The function &lt;code&gt;mintToken()&lt;&#x2F;code&gt; allows the creation of a new MO-NFT. The caller becomes both the initial owner and the provider of the token.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mintToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;A new &lt;code&gt;tokenId&lt;&#x2F;code&gt; is generated, and the caller is added to the owners set and recorded as the provider. The &lt;code&gt;balanceOf&lt;&#x2F;code&gt; the caller is incremented.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Ownership List&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The MO-NFT maintains a list of owners for each token. Owners are stored in an enumerable set to prevent duplicates and allow efficient lookup.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Provider Role&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The provider is the initial owner who can set and update the &lt;code&gt;transferValue&lt;&#x2F;code&gt; fee. Only the provider can modify certain token parameters.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Transfer Mechanism&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Owners can transfer the token to new owners using &lt;code&gt;transferFrom&lt;&#x2F;code&gt;. The transfer adds the new owner to the list without removing existing owners and transfers the &lt;code&gt;transferValue&lt;&#x2F;code&gt; fee to the provider.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;transfer-of-ownership&quot;&gt;Transfer of Ownership&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Additive Ownership&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Transferring ownership adds the new owner to the ownership list without removing current owners. This approach reflects the shared nature of digital assets.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Provider Fee Handling&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;During a transfer, the specified &lt;code&gt;transferValue&lt;&#x2F;code&gt; fee is transferred to the provider. The contract must have sufficient balance to cover this fee.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Archiving Ownership&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Owners can mark themselves as archived for a specific token, meaning they can no longer transfer that token. Once set, this status cannot be reversed. And for Digital Asset platform, this status means the owner can download the real digital asset directly; if it is not archived, then it must be changed to archived first, then owner can download the real digital asset.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; archive&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;interface-definitions&quot;&gt;Interface Definitions&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;Minting Functions&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;function mintToken() public onlyOwner returns (uint256);&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;function provide(string memory assetName, uint256 size, bytes32 fileHash, address provider, uint256 transferValue) external returns (uint256);&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Transfer Functions&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;function transferFrom(address from, address to, uint256 tokenId) public;&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;function safeTransferFrom(address from, address to, uint256 tokenId) public;&lt;&#x2F;code&gt; &lt;em&gt;(Disabled or overridden)&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public;&lt;&#x2F;code&gt; &lt;em&gt;(Disabled or overridden)&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Ownership Management Functions&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;function isOwner(uint256 tokenId, address account) public view returns (bool);&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;function getOwnersCount(uint256 tokenId) public view returns (uint256);&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;function balanceOf(address owner) external view returns (uint256 balance);&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;function ownerOf(uint256 tokenId) external view returns (address owner);&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Provider Functions&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;function setTransferValue(uint256 tokenId, uint256 newTransferValue) external;&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Archived Status Function&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;function archive(uint256 tokenId) external;&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;events&quot;&gt;Events&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;event TokenMinted(uint256 indexed tokenId, address indexed owner);&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;event TokenTransferred(uint256 indexed tokenId, address indexed from, address indexed to);&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;event TransferValueUpdated(uint256 indexed tokenId, uint256 oldTransferValue, uint256 newTransferValue);&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;event ArchivedStatusUpdated(uint256 indexed tokenId, address indexed owner, bool archived);&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;erc-721-compliance&quot;&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; Compliance&lt;&#x2F;h3&gt;
&lt;p&gt;The MO-NFT standard is designed to be compatible with the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; standard. It implements required functions such as &lt;code&gt;balanceOf&lt;&#x2F;code&gt;, &lt;code&gt;ownerOf&lt;&#x2F;code&gt;, and &lt;code&gt;transferFrom&lt;&#x2F;code&gt; from the &lt;code&gt;ERC721&lt;&#x2F;code&gt; interface.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Approval Functions&lt;&#x2F;strong&gt;: Functions like &lt;code&gt;approve&lt;&#x2F;code&gt;, &lt;code&gt;getApproved&lt;&#x2F;code&gt;, &lt;code&gt;setApprovalForAll&lt;&#x2F;code&gt;, and &lt;code&gt;isApprovedForAll&lt;&#x2F;code&gt; are intentionally disabled or overridden, as they do not align with the MO-NFT multi-owner model.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Safe Transfer Functions&lt;&#x2F;strong&gt;: The &lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt; functions are restricted because traditional ERC-721 transfer safety checks are not applicable when ownership is additive rather than exclusive.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Supports Interface&lt;&#x2F;strong&gt;: The &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; function ensures that the MO-NFT declares compatibility with the ERC-721 standard, allowing it to be integrated with existing tools and platforms.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;IERC721&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span&gt; interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;IERC165&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;interfaceId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Multi-Ownership Model&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Digital assets are inherently duplicable and can be shared without loss of quality. The multi-owner model allows broader distribution and collaboration while maintaining a unique token identity.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Additive Ownership&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;By adding new owners without removing existing ones, we support shared ownership models common in collaborative environments and digital content distribution.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Provider Fee Mechanism&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Incorporating a provider fee incentivizes creators and providers by rewarding them whenever the asset is transferred. This aligns with models where creators receive royalties or fees for their work.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Ownership Archiving&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Allowing owners to archive themselves from the ownership list provides flexibility, enabling owners to relinquish rights or prevent further transfers of the asset. This replaces the previous concept of &quot;burning&quot; ownership.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;ERC-721 Compatibility&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Maintaining compatibility with ERC-721 allows MO-NFTs to leverage existing infrastructure, tools, and platforms, facilitating adoption and interoperability.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;While the MO-NFT standard aims to maintain compatibility with ERC-721, certain deviations are necessary due to the multi-owner model:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Disabling Approvals Functions&lt;&#x2F;strong&gt;: Traditional ERC-721 approvals assume that a single owner has the right to grant or revoke approvals. In MO-NFT, a token can have multiple owners. Without a protocol-defined mechanism for “co-ownership consensus,” an approval system would open the door to an unintentional or unwanted transfer if only one co-owner granted approval. We felt this approach could undermine the shared-ownership model, so the reference implementation chooses to revert calls to approval-related functions.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This may limit compatibility with existing NFT platforms and marketplaces that rely on approve or setApprovalForAll. In principle, developers could extend the MO-NFT standard with more advanced “multi-signature” or “consensus-based” approvals, but that is beyond the scope of this initial EIP. Our goal is to keep the core standard minimal and avoid confusion for marketplaces that were built with single-owner assumptions.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Safe Transfer Functions&lt;&#x2F;strong&gt;: The “safe” variants of ERC-721 transfers (safeTransferFrom) serve to protect tokens from being accidentally sent to non-compliant contracts. Because MO-NFT’s multi-owner approach does not inherently break the logic of “checking whether the recipient can handle ERC-721 tokens.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Implementing “safe” in the same manner as ERC-721: after a new owner is added, check &lt;code&gt;onERC721Received&lt;&#x2F;code&gt; on the recipient contract.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;ownerOf&lt;&#x2F;code&gt; Function&lt;&#x2F;strong&gt;: Returns the first owner in the owners list for compatibility, but the concept of a single owner does not fully apply.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Developers should be aware of these differences when integrating MO-NFTs into systems designed for standard ERC-721 tokens.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Minting an MO-NFT and Verifying Initial Ownership&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Input&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Call &lt;code&gt;mintToken()&lt;&#x2F;code&gt; as the provider.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Expected Output&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;A new &lt;code&gt;tokenId&lt;&#x2F;code&gt; is generated.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The caller is added as the first owner.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;balanceOf&lt;&#x2F;code&gt; the caller increases by 1.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The provider is recorded for the token.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;TokenMinted&lt;&#x2F;code&gt; event is emitted.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Transferring an MO-NFT and Verifying Provider Fee Transfer&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Input&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Call &lt;code&gt;transferFrom(from, to, tokenId)&lt;&#x2F;code&gt; where &lt;code&gt;from&lt;&#x2F;code&gt; is an existing owner and &lt;code&gt;to&lt;&#x2F;code&gt; is a new address.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Expected Output&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;to&lt;&#x2F;code&gt; address is added to the owners list.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;transferValue&lt;&#x2F;code&gt; fee is transferred to the provider.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;balanceOf&lt;&#x2F;code&gt; of the &lt;code&gt;to&lt;&#x2F;code&gt; address increases by 1.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;TokenTransferred&lt;&#x2F;code&gt; event is emitted.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Archiving Ownership&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Input&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;An owner calls &lt;code&gt;archive(tokenId)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Expected Output&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The owner’s transfer ability for that token is archived.&lt;&#x2F;li&gt;
&lt;li&gt;The owner can no longer transfer that token.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ArchivedStatusUpdated&lt;&#x2F;code&gt; event is emitted.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Setting Transfer Value&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Input&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The provider calls &lt;code&gt;setTransferValue(tokenId, newTransferValue)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Expected Output&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;transferValue&lt;&#x2F;code&gt; is updated in the contract.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;TransferValueUpdated&lt;&#x2F;code&gt; event is emitted.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Failing Transfer to Existing Owner&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Input&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Attempt to &lt;code&gt;transferFrom&lt;&#x2F;code&gt; to an address that is already an owner.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Expected Output&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The transaction reverts with the error &lt;code&gt;&quot;MO-NFT: Recipient is already an owner&quot;&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;No changes to ownership or balances occur.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The full reference implementation code for the MO-NFT standard is included in the EIPs repository under assets folder. This ensures the code is preserved alongside the EIP and remains accessible.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Contracts&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7743&#x2F;.&#x2F;assets&#x2F;MONFT.sol&quot;&gt;&lt;code&gt;MONFT.sol&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;: The base implementation of the MO-NFT standard.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7743&#x2F;.&#x2F;assets&#x2F;DigitalAsset.sol&quot;&gt;&lt;code&gt;DigitalAsset.sol&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;: An extended implementation for digital assets with provider fees.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Interfaces&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7743&#x2F;.&#x2F;assets&#x2F;IDigitalAsset.sol&quot;&gt;&lt;code&gt;IDigitalAsset.sol&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;: Interface defining the functions for digital asset management.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;key-functions-in-reference-implementation&quot;&gt;Key Functions in Reference Implementation&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;Minting Tokens&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mintToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    _nextTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Add the sender to the set of owners for the new token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    _owners&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_nextTokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Increment the balance of the owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    _balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Set the provider to the caller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    _providers&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_nextTokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TokenMinted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_nextTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; _nextTokenId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Transferring Tokens&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;MO-NFT: Caller is not an owner&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;to &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;MO-NFT: Transfer to zero address&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;MO-NFT: Recipient is already an owner&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Add the new owner to the set&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    _owners&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    _balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfer the transferValue to the provider&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; transferValue &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _transferValues&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; provider &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _providers&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balance &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; transferValue&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Insufficient contract balance&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt; success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; )&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; provider&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;call&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; transferValue&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Transfer to provider failed&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TokenTransferred&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Archiving Ownership&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; archive&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            isOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;MO-NFT: Caller is not the owner of this token&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Once archived, the status cannot be reversed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            _archivedStatus&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;MO-NFT: Token can only be archived once for an owner&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _archivedStatus&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ArchivedStatusUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; archived&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Reentrancy Attacks&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Mitigation&lt;&#x2F;strong&gt;: Use the Checks-Effects-Interactions pattern when transferring Ether (e.g., transferring &lt;code&gt;transferValue&lt;&#x2F;code&gt; to the provider).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Recommendation&lt;&#x2F;strong&gt;: Consider using &lt;code&gt;ReentrancyGuard&lt;&#x2F;code&gt; from OpenZeppelin to prevent reentrant calls.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Integer Overflow and Underflow&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Mitigation&lt;&#x2F;strong&gt;: Solidity 0.8.x automatically checks for overflows and underflows, throwing exceptions when they occur.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Access Control&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Ensured By&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Only owners can call transfer functions.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Only providers can set the &lt;code&gt;transferValue&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Use of &lt;code&gt;require&lt;&#x2F;code&gt; statements to enforce access control.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Denial of Service (DoS)&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Consideration&lt;&#x2F;strong&gt;: Functions that iterate over owners could be expensive in terms of gas if the owners list is large.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Mitigation&lt;&#x2F;strong&gt;: Avoid such functions or limit the number of owners.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Data Integrity&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Ensured By&lt;&#x2F;strong&gt;: Proper use of Solidity&#x27;s data types and structures, and by emitting events for all state-changing operations for off-chain verification.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Ether Handling&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Consideration&lt;&#x2F;strong&gt;: Ensure the contract can receive Ether to handle provider payments.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Mitigation&lt;&#x2F;strong&gt;: Implement a &lt;code&gt;receive()&lt;&#x2F;code&gt; function to accept Ether.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Uncouple blob count between CL and EL</title>
        <published>2024-07-12T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Stokes</name><uri>https://github.com/ralexstokes</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7742/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7742-uncouple-blob-count-between-cl-and-el/20550" />
        

        <id>https://wg-eips.ritovision.com/7742/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:7742"
            label="EIP-7742" />
        

        
        

        
        <summary type="html">Have CL verify blob maximum and have EL get target value from CL</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7742/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Update blob maximum and target verification from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The execution layer no longer verifies the blob maximum and receives the target dynamically from the consensus layer.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Following EIP-4844, the execution layer (EL) maintains a hard-coded blob target value and blob maximum value. Given the relationship
of the EL and the consensus layer (CL) node software, the verification of the blob maximum is redundant so it can be removed
entirely without any change in security. The blob maximum is still provided during block construction via the Engine API.
This EIP also changes how the EL sources the current blob target value for two reasons:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Gain more flexibility over the value, rather than the static &lt;code&gt;TARGET == MAX &#x2F;&#x2F; 2&lt;&#x2F;code&gt; relation in EIP-4844.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Uncouple development and deployment of the CL and EL layers in the event it is desirable to change the blob target value.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;background&quot;&gt;Background&lt;&#x2F;h3&gt;
&lt;p&gt;The data facility introduced via EIP-4844 adds blobs to Ethereum blocks, which are simply fixed sets of data that can be
included in the canonical chain but have no execution semantics (cf. &lt;code&gt;calldata&lt;&#x2F;code&gt; in an Ethereum transaction).&lt;&#x2F;p&gt;
&lt;p&gt;The protocol specifies a maximum allowed blob count per block to prevent DoS vectors via the abuse of this data facility.
The protocol also maintains an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt;-like &quot;target&quot; value for an intended running average amount of blob throughput per
unit time. Blob usage is compared against this target to influence a &quot;blob base fee&quot; to administer allocation of this
resource to users of the Ethereum protocol.&lt;&#x2F;p&gt;
&lt;p&gt;Both of these values are currently hard-coded in the EL after EIP-4844 and the blob maximum is separately hard-coded in
the CL following EIP-4844. This EIP proposes a set of changes to uncouple these values across the CL and EL to make development
and deployment of changes to the blob count easier.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;maximum-blobs-per-block&quot;&gt;Maximum blobs per block&lt;&#x2F;h4&gt;
&lt;p&gt;The blob maximum is verified in the CL node and the EL inherits this verification during the consistency check of the
versioned hashes corresponding to each blob as specified by the Engine API. Because of this, the strict check specified
by EIP-4844 is unnecessary.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;target-amount-of-blobs-per-block&quot;&gt;Target amount of blobs per block&lt;&#x2F;h4&gt;
&lt;p&gt;The target is currently specified as a fixed value in relation to the blob count. The Ethereum community intends to increase
the blob parameters as part of its scaling strategy and the ability to have a more flexible target value in relation to
the blob max is desirable to reduce rigidity in this protocol parameter.&lt;&#x2F;p&gt;
&lt;p&gt;Even if the EL keeps a fixed target value based on the max, removing the max implies the EL would not know what the target
value should be. To address this lack of information, this EIP proposes the CL sends the current target value to the EL
with each provided payload over the Engine API. The EL block header will also need to be extended with this target value
to preserve the security of optimistic sync.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;block-structure-and-validity&quot;&gt;Block structure and validity&lt;&#x2F;h3&gt;
&lt;p&gt;Upon activation of this EIP, execution clients &lt;strong&gt;MUST&lt;&#x2F;strong&gt; extend the header schema with an
additional 64-bit field: the &lt;code&gt;target_blobs_per_block&lt;&#x2F;code&gt;. This value is set to the current target blob count. The Engine API
is modified along with this EIP to provide the &lt;code&gt;target_blobs_per_block&lt;&#x2F;code&gt; with each payload and implementations can use this
value to correctly set the block header field.&lt;&#x2F;p&gt;
&lt;p&gt;Validity of the &lt;code&gt;target_blobs_per_block&lt;&#x2F;code&gt; is guaranteed from the consensus layer, much like how withdrawals are handled.&lt;&#x2F;p&gt;
&lt;p&gt;When verifying a block, execution clients &lt;strong&gt;MUST&lt;&#x2F;strong&gt; ensure the target blob count in the block header matches the one
provided by the consensus client.&lt;&#x2F;p&gt;
&lt;p&gt;For a genesis block with no existing parent, the value should be set according to the agreed specification for the
target blob count given by that genesis block&#x27;s protocol rule set.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;block-processing&quot;&gt;Block processing&lt;&#x2F;h3&gt;
&lt;p&gt;Upon activating this EIP (i.e. before processing any transactions),
the verification of the blob maximum as given in EIP-4844 can be skipped. Concretely, this means any logic relating
to &lt;code&gt;MAX_BLOB_GAS_PER_BLOCK&lt;&#x2F;code&gt; as given in EIP-4844 can be deprecated.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, &lt;code&gt;calc_excess_blob_gas&lt;&#x2F;code&gt; is updated as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calc_excess_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Header&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    target_blob_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;target_blobs_per_block&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GAS_PER_BLOB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;excess_blob_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;blob_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; target_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;excess_blob_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;blob_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; target_blob_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Otherwise, the specification of EIP-4844 is not changed. For example, blob base fee accounting and excess blob gas tracking occur in the exact same way.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;block-construction&quot;&gt;Block construction&lt;&#x2F;h3&gt;
&lt;p&gt;The Engine API is extended to provide both the &lt;code&gt;target_blobs_per_block&lt;&#x2F;code&gt; and the &lt;code&gt;max_blobs_per_block&lt;&#x2F;code&gt; when the CL requests the EL to construct a payload for proposal.&lt;&#x2F;p&gt;
&lt;p&gt;These values should be used to ensure the correct number of blobs are included in any constructed payload, and to ensure that the blob base fee accounting is correctly computed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-not-have-the-cl-also-compute-the-blob-base-fee-and-remove-any-notion-of-blob-counts-from-el-processing&quot;&gt;Why not have the CL also compute the blob base fee and remove any notion of blob counts from EL processing?&lt;&#x2F;h3&gt;
&lt;p&gt;Hoisting the full computation into the CL is possible, but it does violate the separation of concerns between these two layers of the protocol stack.
The CL maintains a maximum value to address e.g. DoS risks, and the EL maintains knowledge of the target value to address fee accounting.
Putting the target computation in the CL violates the respective responsibilities of each layer.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;N&#x2F;A&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;N&#x2F;A&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;N&#x2F;A&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Leaf-level state expiry in verkle trees</title>
        <published>2024-07-05T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Guillaume Ballet</name><uri>https://github.com/gballet</uri>
	</author>
	
	<author>
		<name>Wei Han Ng</name><uri>https://github.com/weiihann</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7736/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7736-leaf-level-state-expiry-in-verkle-trees/20474" />
        

        <id>https://wg-eips.ritovision.com/7736/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7736"
            label="EIP-7736" />
        

        
        

        
        <summary type="html">Simple state expiry scheme in which only &quot;extension-and-suffix trees&quot; are expired.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7736/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Adds an &quot;update epoch&quot; to the verkle tree extension node. When it is time for an epoch to expire, the extension node and its suffix nodes can be deleted.&lt;&#x2F;p&gt;
&lt;p&gt;A new transaction type with a simple verkle proof pays for the costs of reactivating the extension and suffix nodes, and updating the epoch counter.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Previous attempts at implementing state expiry have been stalled by the quickly-increasing complexity, require heavy change in the structure of ethereum (address space extension, oil, multiple trees, ...). This proposal is offering a simpler albeit non-exhaustive approach to state expiry: only removing the leaf nodes and leaving the rest of the tree intact. This removes the need for methods that would be detrimental to the user and developer experience.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FORK_TIME&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Fork activation time&lt;&#x2F;td&gt;&lt;td&gt;TBD&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;EPOCH_LENGTH&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Duration of an epoch, in s&lt;&#x2F;td&gt;&lt;td&gt;15778800 (6 months)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;INITIAL_EPOCH_COUNTER&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The epoch that ends at timestamp &lt;code&gt;FORK_TIME&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;NUM_ACTIVE_EPOCHS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Number of concurrently unexpired epochs&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;RESURRECT_TX_TYPE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Type ID for resurrection transactions&lt;&#x2F;td&gt;&lt;td&gt;TBD&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;change-to-the-verkle-tree&quot;&gt;Change to the verkle tree&lt;&#x2F;h3&gt;
&lt;p&gt;Add an integral variable called &lt;code&gt;current_epoch&lt;&#x2F;code&gt;. It is initialized to &lt;code&gt;INITIAL_EPOCH_COUNTER&lt;&#x2F;code&gt; before the fork, and contains the current epoch number.&lt;&#x2F;p&gt;
&lt;p&gt;Add a new &lt;code&gt;last_epoch&lt;&#x2F;code&gt; field to the extension node:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; extension_and_suffix_tree&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;stem&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; bytes31&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; values&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Dict&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;byte&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; last_epoch&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sub_leaves&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 512&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; suffix&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; values&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;items&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        sub_leaves&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; suffix&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;16&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;little&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;128&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        sub_leaves&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; suffix&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;16&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;little&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    C1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; compute_commitment_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sub_leaves&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;256&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    C2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; compute_commitment_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sub_leaves&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;256&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; compute_commitment_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Extension marker&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                                    int&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;stem&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;little&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                    group_to_scalar_field&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;C1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                    group_to_scalar_field&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;C2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                    last_epoch&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Added in this EIP&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                    [&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 251&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The following rules are added to tree update operations:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;For a read or write event to the tree, check that &lt;code&gt;current_epoch &amp;lt; last_epoch + NUM_ACTIVE_EPOCHS&lt;&#x2F;code&gt;.
&lt;ul&gt;
&lt;li&gt;If this is &lt;code&gt;true&lt;&#x2F;code&gt;, proceed with the write&#x2F;read&lt;&#x2F;li&gt;
&lt;li&gt;Otherwise, revert.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;last_epoch&lt;&#x2F;code&gt; is updated with the value of &lt;code&gt;current_epoch&lt;&#x2F;code&gt; each time that a &lt;em&gt;write&lt;&#x2F;em&gt; event is processed for this extension node.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;expiry&quot;&gt;Expiry&lt;&#x2F;h3&gt;
&lt;p&gt;At the start of block processing, before transactions are executed, run &lt;code&gt;check_epoch_end&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; check_epoch_end&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; FORK_TIME&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; current_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EPOCH_LENGTH&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        current_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; current_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        schedule_expiry&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;current_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;NUM_ACTIVE_EPOCHS&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;It is left to client implementers to decide on the behavior of the &lt;code&gt;schedule_expiry&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;p&gt;Data that needs to be kept for the expiry:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;the &lt;code&gt;stem&lt;&#x2F;code&gt; value, so that siblings can be inserted&lt;&#x2F;li&gt;
&lt;li&gt;The commitment &lt;code&gt;C&lt;&#x2F;code&gt; to the node&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;That data is referred to as the &lt;em&gt;keepsake&lt;&#x2F;em&gt; for this extension-and-suffix node.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;&#x2F;strong&gt;: that actual deletion may not happen before the first block in the epoch has finalized, unless there is a way for the client to recover the block in case of a reorg.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;resurrection&quot;&gt;Resurrection&lt;&#x2F;h3&gt;
&lt;p&gt;The resurrection transaction is defined as follows:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;RESURRECT_TX_TYPE|ssz(Vector[stem,last_epoch,values])&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;stem&lt;&#x2F;code&gt; is used to find the location in the tree, so that the node can be recreated;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;last_epoch&lt;&#x2F;code&gt; and &lt;code&gt;values&lt;&#x2F;code&gt; are the items that were deleted;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;At the start of the validation, charge the costs using constants defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4762&#x2F;&quot;&gt;EIP-4762&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; resurrect_gas_cost&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;values&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; WITNESS_BRANCH_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;            SUBTREE_EDIT_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            sum&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;WITNESS_CHUNK_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CHUNK_EDIT_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CHUNK_FILL_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; values&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Once the gas cost has been paid, the validation process begins:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validate_subtrees&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;tree&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; current_epoch&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The tx is a SSZ payload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    subtrees&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; deserialize_ssz&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; subtrees&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Process all subtrees in the transaction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; subtree&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; subtrees&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ok&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; validate_subtree&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tree&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; subtree&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;stem&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; subtree&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;values&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; subtree&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;last_epoch&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; current_epoch&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; ok&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validate_subtree&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;tree&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; stem&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; values&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; last_epoch&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; current_epoch&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Compute the commitment to the expired&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; tree, get the &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    expired_C&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; extension_and_suffix_tree&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;stem&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; values&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; last_epoch&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    expired&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; tree&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get_keepsake&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;stem&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; keepsake&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; expired_C&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Replace the keepsake with the resurrected&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; extension-and-suffix tree.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    new_C&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; extension_and_suffix_tree&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;stem&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; values&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; current_epoch&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; tree&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;resurrect_subtree&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;stem&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; new_C&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; values&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; current_epoch&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where &lt;code&gt;resurrect_subtree&lt;&#x2F;code&gt; will return &lt;code&gt;None&lt;&#x2F;code&gt; upon success, and an error otherwise.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This approach has the benefit of simplicity, over previous proposals for state expiry:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;no Address Space Extension (ASE) required&lt;&#x2F;li&gt;
&lt;li&gt;it only uses a single tree instead of multiple, per-epoch trees&lt;&#x2F;li&gt;
&lt;li&gt;smaller resurrection proofs, as only providing the data is necessary to resurrect.&lt;&#x2F;li&gt;
&lt;li&gt;clear gas costs&lt;&#x2F;li&gt;
&lt;li&gt;only expire &quot;cold&quot; data, the &quot;hot&quot; data set remains active&lt;&#x2F;li&gt;
&lt;li&gt;it is forward-compatible, as ASE or multiple trees are still possible.&lt;&#x2F;li&gt;
&lt;li&gt;the exponentiation&#x2F;addition computation for &lt;code&gt;current_epoch&lt;&#x2F;code&gt; need only be paid once per epoch, which is quickly amortized.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;While it&#x27;s not deleting &lt;em&gt;all&lt;&#x2F;em&gt; the data, it deletes &lt;em&gt;most&lt;&#x2F;em&gt; of it, namely the values and subcommitments, while retaining the ability to easily insert siblings.&lt;&#x2F;p&gt;
&lt;p&gt;It is also more expensive than resurrecting a single leaf, which is the cost paid for simplification.&lt;&#x2F;p&gt;
&lt;p&gt;The reason why only writes update the resurrection counter, is that any update to the resurrection counter has the effect of a write. Doing so would mean either:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Increasing the cost of a read to that of a write. This would increase the gas costs even more than they did in EIP-4762.&lt;&#x2F;li&gt;
&lt;li&gt;Effectively doing a write for the cost of a read. This would both neuter state expiry and possibly add a DOS vector.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal is backwards-compatible with verkle, as by default the value for the 4th (index starting at 0) evaluation point is set to &lt;code&gt;0&lt;&#x2F;code&gt; in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6800&#x2F;&quot;&gt;EIP-6800&lt;&#x2F;a&gt;, which is the value of &lt;code&gt;INITIAL_EPOCH_COUNTER&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TODO&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TODO&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Gateway Attributes for Message Control</title>
        <published>2024-07-04T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Ernesto García</name><uri>https://github.com/ernestognw</uri>
	</author>
	
	<author>
		<name>Kalman Lajko</name><uri>https://github.com/LajkoKalman</uri>
	</author>
	
	<author>
		<name>Valera Grinenko</name><uri>https://github.com/0xValera</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7985/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/new-erc-attributes-for-message-control-in-erc-7786-gateways/24734" />
        

        <id>https://wg-eips.ritovision.com/7985/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7985"
            label="ERC-7985" />
        

        
        

        
        <summary type="html">Gateway attributes for cancellation, timeout, retry, dependencies, and delivery control in cross-chain messaging.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7985/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC defines standard attributes for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7786&#x2F;&quot;&gt;ERC-7786&lt;&#x2F;a&gt; cross-chain messaging gateways to enable consistent cancellation, timeout, retry, dependency, and delivery control mechanisms across implementations. These attributes provide applications with predictable control over message lifecycle, ordering, and delivery requirements.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7786&#x2F;&quot;&gt;ERC-7786&lt;&#x2F;a&gt; introduces an extensible attribute system for cross-chain messaging, but leaves attribute standardization to follow-up specifications. As cross-chain applications mature, consistent patterns for message control have emerged as essential requirements:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Cancellation&lt;&#x2F;strong&gt;: Applications need to cancel pending messages due to changed conditions&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Timeouts&lt;&#x2F;strong&gt;: Automatic cancellation prevents indefinite pending states&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Retry Logic&lt;&#x2F;strong&gt;: Standardized failure handling improves reliability&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Revert Behavior&lt;&#x2F;strong&gt;: Consistent error semantics across gateways&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Message Dependencies&lt;&#x2F;strong&gt;: Ensuring correct ordering when messages must deliver in sequence&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Gas Requirements&lt;&#x2F;strong&gt;: Preventing delivery failures due to insufficient gas&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Delivery Timing&lt;&#x2F;strong&gt;: Controlling when messages can be delivered for scheduling and coordination&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Without standardized attributes, each gateway implements these features differently, fragmenting the ecosystem and requiring application-specific integration logic.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;standard-attributes&quot;&gt;Standard Attributes&lt;&#x2F;h3&gt;
&lt;p&gt;This specification defines standard attributes for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7786&#x2F;&quot;&gt;ERC-7786&lt;&#x2F;a&gt; cross-chain messaging gateways. The word &quot;delivery&quot; (or &quot;deliver&quot;) is used to refer to the process of delivering a message to the destination chain, similar to its usage in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7786&#x2F;&quot;&gt;ERC-7786&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Gateways MAY implement attributes independently. Gateways MUST validate the attribute&#x27;s encoding for each attribute they implement and revert the transaction if the encoding is invalid.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;cancellable-bool&quot;&gt;&lt;code&gt;cancellable(bool)&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Indicates whether a message can be cancelled after submission. This attribute uses selector &lt;code&gt;0xde986d7f&lt;&#x2F;code&gt;, which represents the first 4 bytes of &lt;code&gt;keccak256(&quot;cancellable(bool)&quot;)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The attribute value is encoded as an ABI-encoded boolean, and MAY default to &lt;code&gt;false&lt;&#x2F;code&gt; when not specified. When set to &lt;code&gt;true&lt;&#x2F;code&gt;, gateways MUST provide a cancellation mechanism to allow applications to cancel pending messages due to changed conditions or requirements.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;deliverbefore-uint256&quot;&gt;&lt;code&gt;deliverBefore(uint256)&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Specifies a timestamp after which the message cannot be delivered. This attribute uses selector &lt;code&gt;0x3e97d7ee&lt;&#x2F;code&gt;, derived from the first 4 bytes of &lt;code&gt;keccak256(&quot;deliverBefore(uint256)&quot;)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The value is encoded as an ABI-encoded Unix timestamp, and MAY default to &lt;code&gt;0&lt;&#x2F;code&gt; when not specified. Gateways MUST NOT deliver messages after the expiration timestamp unless &lt;code&gt;0&lt;&#x2F;code&gt; is specified, which MUST be interpreted as no expiration.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;deliverafter-uint256&quot;&gt;&lt;code&gt;deliverAfter(uint256)&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Specifies the earliest timestamp at which the message can be delivered. This attribute uses selector &lt;code&gt;0x745910eb&lt;&#x2F;code&gt;, derived from the first 4 bytes of &lt;code&gt;keccak256(&quot;deliverAfter(uint256)&quot;)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The value is encoded as an ABI-encoded Unix timestamp, and MAY default to &lt;code&gt;0&lt;&#x2F;code&gt; when not specified. Gateways MUST NOT deliver messages before the delivery timestamp unless &lt;code&gt;0&lt;&#x2F;code&gt; is specified, which MUST be interpreted as no delay. When combined with &lt;code&gt;deliverBefore(uint256)&lt;&#x2F;code&gt;, this creates a delivery time window.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;retrypolicy-bytes&quot;&gt;&lt;code&gt;retryPolicy(bytes)&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Defines retry behavior for failed message delivery. Using selector &lt;code&gt;0xf002c055&lt;&#x2F;code&gt; from the first 4 bytes of &lt;code&gt;keccak256(&quot;retryPolicy(bytes)&quot;)&lt;&#x2F;code&gt;, this attribute encodes retry parameters as ABI-encoded bytes.&lt;&#x2F;p&gt;
&lt;p&gt;The format follows &lt;code&gt;abi.encodePacked(uint16(maxRetries), uint32(retryDelay), uint32(backoffMultiplier))&lt;&#x2F;code&gt;, where &lt;code&gt;maxRetries&lt;&#x2F;code&gt; specifies the maximum number of retry attempts (with 0 indicating no retries), &lt;code&gt;retryDelay&lt;&#x2F;code&gt; defines the initial delay between retries in seconds, and &lt;code&gt;backoffMultiplier&lt;&#x2F;code&gt; provides the multiplier for exponential backoff in basis points (with 10000 representing 1x multiplier).&lt;&#x2F;p&gt;
&lt;p&gt;The attribute value MAY default to &lt;code&gt;0x&lt;&#x2F;code&gt; when not specified, equivalent to infinite retries, no delay, and no backoff (or &lt;code&gt;maxRetries = 0&lt;&#x2F;code&gt;, &lt;code&gt;retryDelay = 0&lt;&#x2F;code&gt;, and &lt;code&gt;backoffMultiplier = 0&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;h4 id=&quot;revertbehavior-uint8&quot;&gt;&lt;code&gt;revertBehavior(uint8)&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Specifies how delivery failures MUST be handled. This attribute uses selector &lt;code&gt;0x9e521a77&lt;&#x2F;code&gt;, representing the first 4 bytes of &lt;code&gt;keccak256(&quot;revertBehavior(uint8)&quot;)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The value is encoded as an ABI-encoded uint8 with the following possible values:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;0&lt;&#x2F;code&gt; – Revert on Failure&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Gateways MUST revert the entire message delivery when any failure occurs.&lt;&#x2F;li&gt;
&lt;li&gt;Gateways SHOULD propagate the original failure reason when reverting.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;1&lt;&#x2F;code&gt; – Emit-and-Continue&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Gateways MUST emit a &lt;code&gt;MessageFailed(bytes32 sendId, string reason)&lt;&#x2F;code&gt; event upon failure.&lt;&#x2F;li&gt;
&lt;li&gt;Gateways MUST continue delivery of subsequent messages or operations.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;2&lt;&#x2F;code&gt; – Silent Failure&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Gateways MUST NOT revert the transaction&lt;&#x2F;li&gt;
&lt;li&gt;Gateways MUST NOT emit any failure-related events.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;When not specified, the attribute MUST default to &lt;code&gt;0&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;dependson-bytes32&quot;&gt;&lt;code&gt;dependsOn(bytes32[])&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Specifies message dependencies that must be delivered before this message. This attribute uses selector &lt;code&gt;0xa9fed7b9&lt;&#x2F;code&gt;, derived from the first 4 bytes of &lt;code&gt;keccak256(&quot;dependsOn(bytes32[])&quot;)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The value is encoded as an ABI-encoded array of message identifiers. Gateways MUST NOT deliver a message until all messages specified in the &lt;code&gt;dependsOn&lt;&#x2F;code&gt; array have been successfully delivered. When not specified or empty, the message has no dependencies. This ensures correct ordering and prevents out-of-order delivery issues.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;mingaslimit-uint256&quot;&gt;&lt;code&gt;minGasLimit(uint256)&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Specifies the minimum gas limit required for message delivery. This attribute uses selector &lt;code&gt;0x39f87ba1&lt;&#x2F;code&gt;, derived from the first 4 bytes of &lt;code&gt;keccak256(&quot;minGasLimit(uint256)&quot;)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The value is encoded as an ABI-encoded uint256 representing the minimum gas units required. Gateways MUST ensure at least this amount of gas is available before attempting message delivery. When not specified, gateways MAY use their default gas allocation strategies.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;These attributes address the most common cross-chain message control requirements:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Lifecycle control&lt;&#x2F;strong&gt; via cancellation and timeout mechanisms&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Delivery timing&lt;&#x2F;strong&gt; through delivery time windows&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Failure handling&lt;&#x2F;strong&gt; via retry policies and revert behavior&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Message ordering&lt;&#x2F;strong&gt; through dependency chains&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Delivery guarantees&lt;&#x2F;strong&gt; via minimum gas requirements&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The byte-encoded retry policy allows for extensible parameters without requiring additional attributes. The dependency mechanism enables complex multi-message workflows while maintaining simplicity for single-message scenarios.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This specification extends &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7786&#x2F;&quot;&gt;ERC-7786&lt;&#x2F;a&gt; without breaking changes. Gateways not supporting these attributes will operate normally per the base specification&#x27;s requirement to handle unknown attributes gracefully.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;!-- TODO: Discuss --&gt;
&lt;!-- Maybe? --&gt;
&lt;!-- - **Dependency Cycles**: Gateways should detect and reject circular dependencies in `dependsOn` arrays --&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Permissionless Script Registry</title>
        <published>2024-07-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Victor Zhang</name><uri>https://github.com/zhangzhongnan928</uri>
	</author>
	
	<author>
		<name>James Brown</name><uri>https://github.com/JamesSmartCell</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7738/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7738-permissionless-script-registry/20503" />
        

        <id>https://wg-eips.ritovision.com/7738/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:7738"
            label="ERC-7738" />
        

        
        

        
        <summary type="html">Permissionless registry to fetch executable scripts for contracts</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7738/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP provides a means to create a standard registry for locating executable scripts associated with the token.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5169&#x2F;&quot;&gt;ERC-5169&lt;&#x2F;a&gt; provides a client script lookup method for contracts. This requires the contract to have implemented the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5169&#x2F;&quot;&gt;ERC-5169&lt;&#x2F;a&gt; interface at the time of construction (or allow an upgrade path).&lt;&#x2F;p&gt;
&lt;p&gt;This proposal outlines a contract that can supply prototype and certified scripts. The contract would be a multichain singleton instance that would be deployed at identical addresses on supported chains.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;overview&quot;&gt;Overview&lt;&#x2F;h3&gt;
&lt;p&gt;The registry contract will supply a set of URI links for a given contract address. These URI links point to script programs that can be fetched by a wallet, viewer or mini-dapp.&lt;&#x2F;p&gt;
&lt;p&gt;The pointers can be set permissionlessly using a setter in the registry contract.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY” and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;The contract MUST implement the &lt;code&gt;IERC7738&lt;&#x2F;code&gt; interface.
The contract MUST emit the &lt;code&gt;ScriptUpdate&lt;&#x2F;code&gt; event when the script is updated.
The contract SHOULD order the &lt;code&gt;scriptURI&lt;&#x2F;code&gt; returned so that the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;173&#x2F;&quot;&gt;ERC-173&lt;&#x2F;a&gt; &lt;code&gt;owner()&lt;&#x2F;code&gt; of the contract&#x27;s script entries are returned first (in the case of simple implementations the wallet will pick the first &lt;code&gt;scriptURI&lt;&#x2F;code&gt; returned).
The contract SHOULD provide a means to page through entries if there are a large number of scriptURI entries.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7738&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This event emits when the scriptURI is updated, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; so wallets implementing this interface can update a cached script&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ScriptUpdate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contractAddress&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newScriptURI&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the scriptURI for the contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; scriptURI&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; scriptURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contractAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Update the scriptURI &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; emits event ScriptUpdate(address indexed contractAddress, scriptURI memory newScriptURI);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setScriptURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contractAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; scriptURIList&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This method allows contracts written without the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5169&#x2F;&quot;&gt;ERC-5169&lt;&#x2F;a&gt; interface to associate scripts with themselves, and avoids the need for a centralised online server, with subsequent need for security and the requires an organisation to become a gatekeeper for the database.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases are included in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7738&#x2F;.&#x2F;assets&#x2F;test&#x2F;NFTRegistryTest.test.ts&quot;&gt;NFTRegistryTest.test.ts&lt;&#x2F;a&gt;. Contracts, deployment scripts and registry script can be found alongside the test script.&lt;&#x2F;p&gt;
&lt;p&gt;Clone the repo and run:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;cd&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; ..&#x2F;assets&#x2F;eip-7738&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;npm&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; install&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;-save-dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; hardhat&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;npm&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; install&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;npx&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; hardhat&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; test&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The live implementation of the script registry is at &lt;code&gt;0x0077380bCDb2717C9640e892B9d5Ee02Bb5e0682&lt;&#x2F;code&gt; on several mainnet, L2 and testnet chains. To deploy scripts for use you can directly call the &lt;code&gt;setScriptURI&lt;&#x2F;code&gt; function:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setScriptURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contractAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newScriptURIs&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;or use the bundled ethers script, ensuring to fill in the target contract address and scriptURI:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7738&#x2F;.&#x2F;assets&#x2F;scripts&#x2F;createRegistryEntry.ts&quot;&gt;Create Registry Entry&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;simplified-implementation&quot;&gt;Simplified Implementation&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;access&#x2F;Ownable.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DecentralisedRegistry&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7738&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ScriptEntry&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; scriptURIs&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; addrList&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; ScriptEntry&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _scriptURIs&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setScriptURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contractAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; scriptURIList&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;scriptURIList&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;&amp;gt; 0 entries required in scriptURIList&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span&gt; isOwnerOrExistingEntry &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Ownable&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;contractAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            ||&lt;&#x2F;span&gt;&lt;span&gt; _scriptURIs&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;contractAddress&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;scriptURIs&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _scriptURIs&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;contractAddress&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;scriptURIs&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; scriptURIList&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;isOwnerOrExistingEntry&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            _scriptURIs&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;contractAddress&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;addrList&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;push&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ScriptUpdate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;contractAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; scriptURIList&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Return the list of scriptURI for this contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Order the return list so `Owner()` assigned scripts are first in the list&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; scriptURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contractAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;build scriptURI return list, owner first&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; contractOwner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Ownable&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;contractAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; addrList &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _scriptURIs&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;contractAddress&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;addrList&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;now calculate list length&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; listLen &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _scriptURIs&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;contractAddress&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;scriptURIs&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;contractOwner&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; addrList&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            listLen &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _scriptURIs&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;contractAddress&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;scriptURIs&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;addrList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; ownerScripts &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;[](&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;listLen&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Add owner scripts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; scriptIndex &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _addScriptURIs&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;contractOwner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; contractAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; ownerScripts&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Add remainder scripts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; addrList&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            scriptIndex &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _addScriptURIs&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addrList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; contractAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; ownerScripts&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; scriptIndex&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; ownerScripts&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _addScriptURIs&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contractAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ownerScripts&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; scriptIndex&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; j &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; j &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; _scriptURIs&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;contractAddress&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;scriptURIs&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;user&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; j&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; thisScriptURI &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _scriptURIs&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;contractAddress&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;scriptURIs&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;user&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;j&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;thisScriptURI&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                ownerScripts&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;scriptIndex&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; thisScriptURI&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; scriptIndex&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The scripts provided could be authenticated in various ways:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The target contract which the setter specifies implements the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;173&#x2F;&quot;&gt;ERC-173&lt;&#x2F;a&gt; &lt;code&gt;Ownable&lt;&#x2F;code&gt; interface. Once the script is fetched, the signature can be verified to match the Owner(). In the case of TokenScript this can be checked by a dapp or wallet using the TokenScript SDK, the TokenScript online verification service, or by extracting the signature from the XML, taking a keccak256 of the script and ecrecover the signing key address.&lt;&#x2F;li&gt;
&lt;li&gt;If the contract does not implement Ownable, further steps can be taken:
a. The hosting app&#x2F;wallet can acertain the deployment key using 3rd party API or block explorer. The implementing wallet, dapp or viewer would then check the signature matches this deployment key.
b. Signing keys could be pre-authenticated by a hosting app, using an embedded keychain.
c. A governance token could allow a script council to authenticate requests to set and validate keys.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;If these criteria are not met:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;For mainnet implementations the implementing wallet should be cautious about using the script - it would be at the app and&#x2F;or user&#x27;s discretion.&lt;&#x2F;li&gt;
&lt;li&gt;For testnets, it is acceptable to allow the script to function, at the discretion of the wallet provider.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Enshrined Proposer-Builder Separation</title>
        <published>2024-06-28T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Francesco D&#x27;Amato</name><email>francesco.damato@ethereum.org</email>
	</author>
	
	<author>
		<name>Barnabé Monnot</name><email>barnabe.monnot@ethereum.org</email>
	</author>
	
	<author>
		<name>Michael Neuder</name><email>michael.neuder@ethereum.org</email>
	</author>
	
	<author>
		<name>Potuz</name><uri>https://github.com/potuz</uri>
	</author>
	
	<author>
		<name>Justin Traglia</name><email>jtraglia@ethereum.org</email>
	</author>
	
	<author>
		<name>Terence Tsao</name><email>ttsao@offchainlabs.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7732/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7732-enshrined-proposer-builder-separation-epbs/19634" />
        

        <id>https://wg-eips.ritovision.com/7732/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7732"
            label="EIP-7732" />
        

        
        

        
        <summary type="html">Separates the ethereum block in consensus and execution parts, adds a mechanism for the consensus proposer to choose the execution proposer.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7732/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP fundamentally changes the way an Ethereum block is validated by decoupling the execution validation from the consensus validation both logically as well as temporally. It does so by introducing a new in-protocol entity called &lt;em&gt;builders&lt;&#x2F;em&gt; and adding a new duty (submitting &lt;em&gt;payload timeliness attestations&lt;&#x2F;em&gt;) to Ethereum validators. The &lt;code&gt;ExecutionPayload&lt;&#x2F;code&gt; field of the &lt;code&gt;BeaconBlockBody&lt;&#x2F;code&gt; is removed and instead it is replaced by a signed commitment (a &lt;code&gt;SignedExecutionPayloadBid&lt;&#x2F;code&gt; object) from a builder to later reveal the corresponding execution payload. This commitment specifies in particular the blockhash of the execution block and a &lt;em&gt;value&lt;&#x2F;em&gt; to be paid to the beacon block proposer. When processing the &lt;code&gt;BeaconBlock&lt;&#x2F;code&gt;, the committed value is deducted from the builder&#x27;s beacon chain balance and later a withdrawal is placed to an address, of the proposer&#x27;s choosing, in the execution layer. A subset of validators in the beacon committee is assigned to the &lt;em&gt;Payload Timeliness Committee&lt;&#x2F;em&gt; (PTC), these validators are tasked to attest (by broadcasting a &lt;code&gt;PayloadAttestationMessage&lt;&#x2F;code&gt;) to whether the corresponding builder has revealed the committed execution payload (with the right blockhash) in a timely fashion and whether the correspoding blob data was available according to their view. PTC members are not required to validate the execution payload, execution validation is thus deferred until the next beacon block validation. While builder&#x27;s are staked entities, their stake is not actively validating the beacon chain, they are not subject to the usual deposit and exit churn&#x2F;queues and can be staked for as little as 1ETH. While the in-protocol payment via withdrawals is trustlessly deducted from this stake, the protocol also accomodates for trusted payments in the form of &lt;em&gt;promises&lt;&#x2F;em&gt; to be fulfiled elsewhere.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP solves a different set of unrelated important problems.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;An overwhelming majority of beacon block proposers outsource the construction of the execution payload within their blocks to a third party (henceforth called a &lt;em&gt;builder&lt;&#x2F;em&gt;). In order to do so, they request the hash tree root (HTR) of a promised execution payload and submit a &lt;code&gt;SignedBlindedBeaconBlock&lt;&#x2F;code&gt; to a trusted party that is tasked with replacing the HTR with the full execution payload (received from the builder) before broadcasting. This EIP allows for a trust-free fair exchange between the beacon block proposer and the builder, guaranteeing that an honest beacon block proposer will receive payment from the builder regardless of the latter&#x27;s actions and that the honest builder&#x27;s payload will be the canonical head of the chain regardless of the proposer&#x27;s action.&lt;&#x2F;li&gt;
&lt;li&gt;Currently, validators have the time between receiving the full beacon block (including an execution payload) and the attesting deadline (4 seconds in Ethereum mainnet) to perform both consensus and execution state transition functions, check blob data availability and evaluate the new head of the blockchain. The remainder of the slot time is spent doing less CPU-intense and critical task. By separating the validation of the execution and consensus part of the block, validators are only tasked to perform the consensus state transition function in this critical time before attesting, while execution and data availability validation is deferred for most of the remainder of the slot (between the builder&#x27;s reveal time and the next attestation deadline).&lt;&#x2F;li&gt;
&lt;li&gt;By removing the full execution payload size from the consensus block, it allows for faster network propagation on the critical path.&lt;&#x2F;li&gt;
&lt;li&gt;It removes the increased reorg likeliness of including blob transactions in blocks given the natural increase in timelines for data availability checks and the fact that the builder may broadcast the blob sidecars even before attestations for the beacon block have been released.&lt;&#x2F;li&gt;
&lt;li&gt;It prevents validators from missing attestations and strengthens the weight properties of fork choice in the event that builders produce invalid payloads.&lt;&#x2F;li&gt;
&lt;li&gt;It removes the need to use trusted middleware in order to delegate block construction to a builder.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;execution-layer&quot;&gt;Execution Layer&lt;&#x2F;h3&gt;
&lt;p&gt;No changes are required.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;consensus-layer&quot;&gt;Consensus Layer&lt;&#x2F;h3&gt;
&lt;p&gt;The full consensus changes can be found in the consensus-specs Github repository. They are split between:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;c94138e73e0e70eb4b27f9be4d4e9325fa1aebf7&#x2F;specs&#x2F;gloas&#x2F;beacon-chain.md&quot;&gt;Beacon Chain&lt;&#x2F;a&gt; changes.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;c94138e73e0e70eb4b27f9be4d4e9325fa1aebf7&#x2F;specs&#x2F;gloas&#x2F;fork-choice.md&quot;&gt;Fork choice&lt;&#x2F;a&gt; changes.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;c94138e73e0e70eb4b27f9be4d4e9325fa1aebf7&#x2F;specs&#x2F;gloas&#x2F;p2p-interface.md&quot;&gt;P2P&lt;&#x2F;a&gt; changes.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;c94138e73e0e70eb4b27f9be4d4e9325fa1aebf7&#x2F;specs&#x2F;gloas&#x2F;validator.md&quot;&gt;Honest validator guide&lt;&#x2F;a&gt; changes.&lt;&#x2F;li&gt;
&lt;li&gt;A new &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;c94138e73e0e70eb4b27f9be4d4e9325fa1aebf7&#x2F;specs&#x2F;gloas&#x2F;builder.md&quot;&gt;honest builder&lt;&#x2F;a&gt; guide.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;c94138e73e0e70eb4b27f9be4d4e9325fa1aebf7&#x2F;specs&#x2F;gloas&#x2F;fork.md&quot;&gt;Fork logic&lt;&#x2F;a&gt; changes.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;A summary of the main changes is included below, the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7732&#x2F;#rationale&quot;&gt;Rationale&lt;&#x2F;a&gt; section contains explanation for most of the design decisions around these changes.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;beacon-chain-changes&quot;&gt;Beacon chain changes&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;types&quot;&gt;Types&lt;&#x2F;h5&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;SSZ equivalent&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;BuilderIndex&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint64&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Builder registry index&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h5 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h5&gt;
&lt;h6 id=&quot;index-flags&quot;&gt;Index flags&lt;&#x2F;h6&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;BUILDER_INDEX_FLAG&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint64(2**40)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Bitwise flag which indicates that a &lt;code&gt;ValidatorIndex&lt;&#x2F;code&gt; should be treated as a &lt;code&gt;BuilderIndex&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h5 id=&quot;domains&quot;&gt;Domains&lt;&#x2F;h5&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;DOMAIN_BEACON_BUILDER&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;DomainType(&#x27;0x0B000000&#x27;)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;DOMAIN_PTC_ATTESTER&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;DomainType(&#x27;0x0C000000&#x27;)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;DOMAIN_PROPOSER_PREFERENCES&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;DomainType(&#x27;0x0D000000&#x27;)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h5 id=&quot;misc&quot;&gt;Misc&lt;&#x2F;h5&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;BUILDER_INDEX_SELF_BUILD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;BuilderIndex(UINT64_MAX)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Value which indicates the proposer built the payload&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;BUILDER_PAYMENT_THRESHOLD_NUMERATOR&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint64(6)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;BUILDER_PAYMENT_THRESHOLD_DENOMINATOR&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint64(10)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h5 id=&quot;withdrawal-prefixes&quot;&gt;Withdrawal prefixes&lt;&#x2F;h5&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;BUILDER_WITHDRAWAL_PREFIX&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;Bytes1(&#x27;0x03&#x27;)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Withdrawal credential prefix for a builder&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h5 id=&quot;preset&quot;&gt;Preset&lt;&#x2F;h5&gt;
&lt;h6 id=&quot;misc-1&quot;&gt;Misc&lt;&#x2F;h6&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;PTC_SIZE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint64(2**9)&lt;&#x2F;code&gt; (= 512)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h6 id=&quot;max-operations-per-block&quot;&gt;Max operations per block&lt;&#x2F;h6&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_PAYLOAD_ATTESTATIONS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;4&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h6 id=&quot;state-list-lengths&quot;&gt;State list lengths&lt;&#x2F;h6&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Unit&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;BUILDER_REGISTRY_LIMIT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint64(2**40)&lt;&#x2F;code&gt; (= 1,099,511,627,776)&lt;&#x2F;td&gt;&lt;td&gt;Builders&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;BUILDER_PENDING_WITHDRAWALS_LIMIT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint64(2**20)&lt;&#x2F;code&gt; (= 1,048,576)&lt;&#x2F;td&gt;&lt;td&gt;Builder pending withdrawals&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h6 id=&quot;withdrawals-processing&quot;&gt;Withdrawals processing&lt;&#x2F;h6&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_BUILDERS_PER_WITHDRAWALS_SWEEP&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2**14&lt;&#x2F;code&gt; (= 16,384)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h5 id=&quot;configuration&quot;&gt;Configuration&lt;&#x2F;h5&gt;
&lt;h6 id=&quot;time-parameters&quot;&gt;Time parameters&lt;&#x2F;h6&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;Unit&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MIN_BUILDER_WITHDRAWABILITY_DELAY&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint64(2**6)&lt;&#x2F;code&gt; (= 64)&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;epochs&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h5 id=&quot;containers&quot;&gt;Containers&lt;&#x2F;h5&gt;
&lt;h6 id=&quot;new-containers&quot;&gt;New containers&lt;&#x2F;h6&gt;
&lt;h6 id=&quot;builder&quot;&gt;&lt;code&gt;Builder&lt;&#x2F;code&gt;&lt;&#x2F;h6&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Builder&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    pubkey&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BLSPubkey&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    version&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    execution_address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    balance&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Gwei&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    deposit_epoch&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Epoch&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    withdrawable_epoch&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Epoch&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h6 id=&quot;builderpendingpayment&quot;&gt;&lt;code&gt;BuilderPendingPayment&lt;&#x2F;code&gt;&lt;&#x2F;h6&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BuilderPendingPayment&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    weight&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Gwei&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    withdrawal&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BuilderPendingWithdrawal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h6 id=&quot;builderpendingwithdrawal&quot;&gt;&lt;code&gt;BuilderPendingWithdrawal&lt;&#x2F;code&gt;&lt;&#x2F;h6&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BuilderPendingWithdrawal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    fee_recipient&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    amount&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Gwei&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    builder_index&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BuilderIndex&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h6 id=&quot;payloadattestationdata&quot;&gt;&lt;code&gt;PayloadAttestationData&lt;&#x2F;code&gt;&lt;&#x2F;h6&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PayloadAttestationData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    beacon_block_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    slot&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_present&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; boolean&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    blob_data_available&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; boolean&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h6 id=&quot;payloadattestation&quot;&gt;&lt;code&gt;PayloadAttestation&lt;&#x2F;code&gt;&lt;&#x2F;h6&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PayloadAttestation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    aggregation_bits&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bitvector&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;PTC_SIZE&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; PayloadAttestationData&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BLSSignature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h6 id=&quot;payloadattestationmessage&quot;&gt;&lt;code&gt;PayloadAttestationMessage&lt;&#x2F;code&gt;&lt;&#x2F;h6&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PayloadAttestationMessage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    validator_index&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ValidatorIndex&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; PayloadAttestationData&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BLSSignature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h6 id=&quot;indexedpayloadattestation&quot;&gt;&lt;code&gt;IndexedPayloadAttestation&lt;&#x2F;code&gt;&lt;&#x2F;h6&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IndexedPayloadAttestation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    attesting_indices&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;ValidatorIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; PTC_SIZE&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; PayloadAttestationData&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BLSSignature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h6 id=&quot;executionpayloadbid&quot;&gt;&lt;code&gt;ExecutionPayloadBid&lt;&#x2F;code&gt;&lt;&#x2F;h6&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ExecutionPayloadBid&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    parent_block_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    parent_block_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    prev_randao&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    fee_recipient&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_limit&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    builder_index&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BuilderIndex&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    slot&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Gwei&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    execution_payment&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Gwei&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    blob_kzg_commitments&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;KZGCommitment&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_BLOB_COMMITMENTS_PER_BLOCK&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h6 id=&quot;signedexecutionpayloadbid&quot;&gt;&lt;code&gt;SignedExecutionPayloadBid&lt;&#x2F;code&gt;&lt;&#x2F;h6&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SignedExecutionPayloadBid&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    message&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionPayloadBid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BLSSignature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h6 id=&quot;executionpayloadenvelope&quot;&gt;&lt;code&gt;ExecutionPayloadEnvelope&lt;&#x2F;code&gt;&lt;&#x2F;h6&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ExecutionPayloadEnvelope&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionPayload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    execution_requests&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionRequests&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    builder_index&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BuilderIndex&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    beacon_block_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    slot&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h6 id=&quot;signedexecutionpayloadenvelope&quot;&gt;&lt;code&gt;SignedExecutionPayloadEnvelope&lt;&#x2F;code&gt;&lt;&#x2F;h6&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SignedExecutionPayloadEnvelope&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    message&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionPayloadEnvelope&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BLSSignature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h6 id=&quot;modified-containers&quot;&gt;Modified containers&lt;&#x2F;h6&gt;
&lt;h6 id=&quot;beaconblockbody&quot;&gt;&lt;code&gt;BeaconBlockBody&lt;&#x2F;code&gt;&lt;&#x2F;h6&gt;
&lt;p&gt;&lt;em&gt;Note&lt;&#x2F;em&gt;: The removed fields (&lt;code&gt;execution_payload&lt;&#x2F;code&gt;, &lt;code&gt;blob_kzg_commitments&lt;&#x2F;code&gt;, and
&lt;code&gt;execution_requests&lt;&#x2F;code&gt;) now exist in &lt;code&gt;ExecutionPayloadEnvelope&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BeaconBlockBody&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    randao_reveal&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BLSSignature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    eth1_data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Eth1Data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    graffiti&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    proposer_slashings&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;ProposerSlashing&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_PROPOSER_SLASHINGS&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    attester_slashings&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;AttesterSlashing&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_ATTESTER_SLASHINGS_ELECTRA&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    attestations&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Attestation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_ATTESTATIONS_ELECTRA&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    deposits&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Deposit&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_DEPOSITS&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    voluntary_exits&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;SignedVoluntaryExit&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_VOLUNTARY_EXITS&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sync_aggregate&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; SyncAggregate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; [Modified in Gloas:EIP7732]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Removed `execution_payload`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bls_to_execution_changes&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;SignedBLSToExecutionChange&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_BLS_TO_EXECUTION_CHANGES&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; [Modified in Gloas:EIP7732]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Removed `blob_kzg_commitments`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; [Modified in Gloas:EIP7732]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Removed `execution_requests`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; [New in Gloas:EIP7732]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signed_execution_payload_bid&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; SignedExecutionPayloadBid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; [New in Gloas:EIP7732]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_attestations&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;PayloadAttestation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_PAYLOAD_ATTESTATIONS&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h6 id=&quot;beaconstate&quot;&gt;&lt;code&gt;BeaconState&lt;&#x2F;code&gt;&lt;&#x2F;h6&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    genesis_time&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    genesis_validators_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    slot&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    fork&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Fork&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    latest_block_header&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconBlockHeader&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block_roots&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Vector&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SLOTS_PER_HISTORICAL_ROOT&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state_roots&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Vector&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SLOTS_PER_HISTORICAL_ROOT&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    historical_roots&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; HISTORICAL_ROOTS_LIMIT&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    eth1_data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Eth1Data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    eth1_data_votes&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Eth1Data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EPOCHS_PER_ETH1_VOTING_PERIOD&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SLOTS_PER_EPOCH&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    eth1_deposit_index&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    validators&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Validator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; VALIDATOR_REGISTRY_LIMIT&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    balances&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Gwei&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; VALIDATOR_REGISTRY_LIMIT&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    randao_mixes&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Vector&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Bytes32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EPOCHS_PER_HISTORICAL_VECTOR&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    slashings&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Vector&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Gwei&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EPOCHS_PER_SLASHINGS_VECTOR&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    previous_epoch_participation&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;ParticipationFlags&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; VALIDATOR_REGISTRY_LIMIT&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    current_epoch_participation&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;ParticipationFlags&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; VALIDATOR_REGISTRY_LIMIT&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    justification_bits&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bitvector&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;JUSTIFICATION_BITS_LENGTH&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    previous_justified_checkpoint&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Checkpoint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    current_justified_checkpoint&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Checkpoint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    finalized_checkpoint&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Checkpoint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    inactivity_scores&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;uint64&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; VALIDATOR_REGISTRY_LIMIT&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    current_sync_committee&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; SyncCommittee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    next_sync_committee&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; SyncCommittee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; [Modified in Gloas:EIP7732]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Removed `latest_execution_payload_header`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; [New in Gloas:EIP7732]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    latest_execution_payload_bid&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionPayloadBid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    next_withdrawal_index&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; WithdrawalIndex&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    next_withdrawal_validator_index&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ValidatorIndex&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    historical_summaries&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;HistoricalSummary&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; HISTORICAL_ROOTS_LIMIT&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    deposit_requests_start_index&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    deposit_balance_to_consume&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Gwei&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    exit_balance_to_consume&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Gwei&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    earliest_exit_epoch&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Epoch&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    consolidation_balance_to_consume&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Gwei&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    earliest_consolidation_epoch&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Epoch&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    pending_deposits&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;PendingDeposit&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; PENDING_DEPOSITS_LIMIT&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    pending_partial_withdrawals&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;PendingPartialWithdrawal&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; PENDING_PARTIAL_WITHDRAWALS_LIMIT&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    pending_consolidations&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;PendingConsolidation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; PENDING_CONSOLIDATIONS_LIMIT&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    proposer_lookahead&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Vector&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;ValidatorIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;MIN_SEED_LOOKAHEAD&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SLOTS_PER_EPOCH&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; [New in Gloas:EIP7732]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    builders&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Builder&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BUILDER_REGISTRY_LIMIT&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; [New in Gloas:EIP7732]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    next_withdrawal_builder_index&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BuilderIndex&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; [New in Gloas:EIP7732]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    execution_payload_availability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bitvector&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SLOTS_PER_HISTORICAL_ROOT&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; [New in Gloas:EIP7732]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    builder_pending_payments&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Vector&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;BuilderPendingPayment&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SLOTS_PER_EPOCH&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; [New in Gloas:EIP7732]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    builder_pending_withdrawals&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;BuilderPendingWithdrawal&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BUILDER_PENDING_WITHDRAWALS_LIMIT&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; [New in Gloas:EIP7732]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    latest_block_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; [New in Gloas:EIP7732]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_expected_withdrawals&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Withdrawal&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_WITHDRAWALS_PER_PAYLOAD&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;BeaconState&lt;&#x2F;code&gt; container is modified with the addition of:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;builders&lt;&#x2F;code&gt;, of type &lt;code&gt;List[Builder, BUILDER_REGISTRY_LIMIT]&lt;&#x2F;code&gt; to track the new in-protocol staked builders.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;next_withdrawal_builder_index&lt;&#x2F;code&gt; of type &lt;code&gt;BuilderIndex&lt;&#x2F;code&gt; to help tracking builder withdrawals.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;execution_payload_availability&lt;&#x2F;code&gt;, of type &lt;code&gt;Bitvector[SLOTS_PER_HISTORICAL_ROOT]&lt;&#x2F;code&gt; to track the presence of execution payloads on the canonical chain.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;builder_pending_payments&lt;&#x2F;code&gt;, of type &lt;code&gt;Vector[BuilderPendingPayment, 2 * SLOTS_PER_EPOCH]&lt;&#x2F;code&gt; to track pending payments from builders to proposers before the execution payload has been processed.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;builder_pending_withdrawals&lt;&#x2F;code&gt;, of type &lt;code&gt;List[BuilderPendingWithdrawal, BUILDER_PENDING_WITHDRAWALS_LIMIT]&lt;&#x2F;code&gt; to track pending withdrawals to the execution layer with the builders&#x27; payments.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;latest_block_hash&lt;&#x2F;code&gt;, of type &lt;code&gt;Hash32&lt;&#x2F;code&gt;, to track the blockhash of the last execution payload in the blockchain.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;payload_expected_withdrawals&lt;&#x2F;code&gt; of type &lt;code&gt;List[Withdrawal, MAX_WITHDRAWALS_PER_PAYLOAD]&lt;&#x2F;code&gt; to track the latest withdrawals that were deducted in the consensus layer and need to still be honored in the Execution Layer.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;code&gt;BeaconBlockBody&lt;&#x2F;code&gt; is modified with the addition of:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;signed_execution_payload_bid&lt;&#x2F;code&gt; of type &lt;code&gt;SignedExecutionPayloadBid&lt;&#x2F;code&gt; with the builder&#x27;s commitment.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;payload_attestations&lt;&#x2F;code&gt; of type &lt;code&gt;List[PayloadAttestation, MAX_PAYLOAD_ATTESTATIONS]&lt;&#x2F;code&gt; a list of PTC attestations from the previous slot.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;code&gt;ExecutionPayloadHeader&lt;&#x2F;code&gt; object is changed (and renamed to &lt;code&gt;ExecutionPayloadBid&lt;&#x2F;code&gt;) to only track the minimum information needed to commit to a builder&#x27;s payload.&lt;&#x2F;p&gt;
&lt;p&gt;State transition logic is modified by:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A new beacon state getter &lt;code&gt;get_ptc&lt;&#x2F;code&gt; returns the PTC members for a given slot.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;process_withdrawals&lt;&#x2F;code&gt; is modified as follows. Withdrawals are obtained directly from the beacon state instead of the execution payload. They are deducted from the beacon chain. The beacon state &lt;code&gt;latest_withdrawals_root&lt;&#x2F;code&gt; is updated with the HTR of this list. The next execution payload MUST include withdrawals matching the &lt;code&gt;state.latest_withdrawals_root&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;process_execution_payload&lt;&#x2F;code&gt; is removed from &lt;code&gt;process_block&lt;&#x2F;code&gt;. Instead a new function &lt;code&gt;process_execution_payload_bid&lt;&#x2F;code&gt; is included, this function validates the &lt;code&gt;SignedExecutionPayloadBid&lt;&#x2F;code&gt; included in the &lt;code&gt;BeaconBlockBody&lt;&#x2F;code&gt;, ensures the payment from the builder&#x27;s balance can be deducted and adds a &lt;code&gt;BuilderPendingPayment&lt;&#x2F;code&gt; object to the beacon state.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;process_deposit_request&lt;&#x2F;code&gt; is removed from &lt;code&gt;process_operations&lt;&#x2F;code&gt; and deferred until &lt;code&gt;process_execution_payload&lt;&#x2F;code&gt;. Special care is added for deposit requests from new validator pubkeys, with withdrawal credentials starting with the prefix &lt;code&gt;BUILDER_WITHDRAWAL_PREFIX&lt;&#x2F;code&gt;. These deposits are immediately added to the beacon chain and processed as new builders.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;process_withdrawal_request&lt;&#x2F;code&gt; is removed from &lt;code&gt;process_operations&lt;&#x2F;code&gt; and deferred until &lt;code&gt;process_execution_payload&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;process_consolidation_request&lt;&#x2F;code&gt; is removed from &lt;code&gt;process_operations&lt;&#x2F;code&gt; and deferred until &lt;code&gt;process_execution_payload&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;A new &lt;code&gt;process_payload_attestation&lt;&#x2F;code&gt; is added to &lt;code&gt;process_operations&lt;&#x2F;code&gt;, this function validates the payload timeliness attestations broadcast by the PTC members.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;process_execution_payload&lt;&#x2F;code&gt; is now called as a separate helper when receiving a &lt;code&gt;SignedExecutionPayloadEnvelope&lt;&#x2F;code&gt; on the P2P layer. This function in particular checks that the HTR of the resulting beacon state coincides with the committed one in the payload envelope. On sucessful processing of the execution payload, the corresponding &lt;code&gt;BuilderPendingPayment&lt;&#x2F;code&gt; is removed from the beacon state and a &lt;code&gt;BuilderPendingWithdrawal&lt;&#x2F;code&gt; is queued.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Epoch processing is modified by addition of a new helper function &lt;code&gt;process_builder_pending_payments&lt;&#x2F;code&gt;, that processes the builder pending payments from those payloads that were not included in the canonical chain.
Although there is no change in the &lt;code&gt;AttestationData&lt;&#x2F;code&gt; object, the &lt;code&gt;index&lt;&#x2F;code&gt; field which is unused since the Electra fork, is now repurposed to signal payload availability. The value of &lt;code&gt;0&lt;&#x2F;code&gt; is used when attesting to the current beacon block or a past beacon block without a payload present, and the value of &lt;code&gt;1&lt;&#x2F;code&gt; is used to attest to a past beacon block with a payload present.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;fork-choice-changes&quot;&gt;Fork-Choice changes&lt;&#x2F;h4&gt;
&lt;p&gt;Forkchoice is changed substantially to deal with the fact that forkchoice nodes can have different payload content.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;p2p-changes&quot;&gt;P2P changes&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;A new global topic for broadcasting &lt;code&gt;SignedExecutionPayloadBid&lt;&#x2F;code&gt; messages (builder bids).&lt;&#x2F;li&gt;
&lt;li&gt;A new global topic for broadcasting &lt;code&gt;PayloadAttestationMessage&lt;&#x2F;code&gt; objects.&lt;&#x2F;li&gt;
&lt;li&gt;A new global topic for broadcasting &lt;code&gt;ProposerPreferences&lt;&#x2F;code&gt; objects.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;engine-api&quot;&gt;Engine API&lt;&#x2F;h3&gt;
&lt;p&gt;No changes needed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;staked-builders&quot;&gt;Staked builders&lt;&#x2F;h3&gt;
&lt;p&gt;Being a builder is a new type of entity tracked in the beacon state. As such builders are staked in the beacon chain and they have their own withdrawal credential prefix. This allows for in-protocol trustless enforcement of the builder&#x27;s payment to the proposer. Alternatively, payment could be enforced in the Execution Layer (EL) at the cost of adding the corresponding EL consensus-changing logic. Payments in the EL have the advantage of not requiring the builder to periodically submit deposit transactions to replenish their validator balance. Both systems require availability of funds before the payload is revealed: in the Consensus Layer (CL) this is done by getting builders to stake. In the EL this is done with a balance check and a payment transaction. This transaction can be checked without executing the payload only if it the first transaction of the block.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;delayed-validation&quot;&gt;Delayed validation&lt;&#x2F;h3&gt;
&lt;p&gt;The Payload Timeliness Committee members do not need to validate the execution payload before attesting to it. They perform basic checks such as verifying the builder&#x27;s signature, and the correct blockhash is included. This takes away the full execution payload validation from the hot path of validation of an Ethereum block, giving the next proposer 6 seconds (&lt;code&gt;SECONDS_PER_SLOT * 2 &#x2F;&#x2F; INTERVALS_PER_SLOT&lt;&#x2F;code&gt;) to validate the payload and every other validator 9 seconds (&lt;code&gt;SECONDS_PER_SLOT * 3 &#x2F;&#x2F; INTERVALS_PER_SLOT&lt;&#x2F;code&gt;). From a user UX perspective, a transaction included in slot &lt;code&gt;N&lt;&#x2F;code&gt; by the builder is not widely validated until the proposer of slot &lt;code&gt;N+1&lt;&#x2F;code&gt; releases their beacon block on top of block &lt;code&gt;N&lt;&#x2F;code&gt; first and the attesters of slot &lt;code&gt;N+1&lt;&#x2F;code&gt; vote on this beacon block as the head of the chain.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;fork-choice&quot;&gt;Fork choice&lt;&#x2F;h3&gt;
&lt;p&gt;The following features of fork choice are guaranteed under specified margins of security:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Proposer unconditional payment.&lt;&#x2F;li&gt;
&lt;li&gt;Builder reveal safety.&lt;&#x2F;li&gt;
&lt;li&gt;Builder withhold safety.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Proposer unconditional payment refers to the following. An Ethereum slot can be either:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Full&lt;&#x2F;em&gt;: both the beacon block and the execution payload have been revealed and included on-chain.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;Skipped&lt;&#x2F;em&gt;: No beacon block (and therefore no execution payload) has been included on-chain for this slot.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;Empty&lt;&#x2F;em&gt;: The beacon block has been included on-chain, but the committed execution payload has not.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Proposer unconditional payment refers to the fact that in the third scenario the beacon block proposer received payment from the corresponding builder.&lt;&#x2F;p&gt;
&lt;p&gt;Builder reveal safety refers to the fact that if the builder acted honestly and revealed a payload in a timely fashion (as attested by the PTC) then the revealed payload will be included on-chain.&lt;&#x2F;p&gt;
&lt;p&gt;Builder withhold safety refers to the fact that if some beacon block containing a builder&#x27;s commitment is withheld and revealed late, the builder will not be charged the value of the bid. In particular, the payload does not even need to be revealed in this case.&lt;&#x2F;p&gt;
&lt;p&gt;The precise method by which these safety mechanisms are enforced is by allowing attestations to also signal their view of the slot as in either of the above options &lt;em&gt;Full&lt;&#x2F;em&gt;, &lt;em&gt;Skipped&lt;&#x2F;em&gt; or &lt;em&gt;Empty&lt;&#x2F;em&gt;. For this, the &lt;code&gt;index&lt;&#x2F;code&gt; field in the &lt;code&gt;AttestationData&lt;&#x2F;code&gt; is used as explained above.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;ptc-equivocations&quot;&gt;PTC equivocations&lt;&#x2F;h3&gt;
&lt;p&gt;There is no penalty for PTC nor payload equivocation (that is revealing the right payload and also a withheld message at the same time). A collusion of a builder controlling network partition with a single malicious PTC member could cause a split view by achieving consensus both on payload withheld and a payload present. This could be mitigated by setting &lt;code&gt;PAYLOAD_TIMELY_THRESHOLD&lt;&#x2F;code&gt; to be 2&#x2F;3 of the PTC, in which case the malicious operator would have to control at least 33% of the PTC.&lt;&#x2F;p&gt;
&lt;p&gt;Another mitigation mechanism is to add new slashing conditions for payload equivocation or PTC equivocations (both are signed messages by validators).&lt;&#x2F;p&gt;
&lt;p&gt;Since this attack results in a split view at a cost for the builder (the payload is revealed and may not be included) this EIP opted for simplicity of implementation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;withdrawals&quot;&gt;Withdrawals&lt;&#x2F;h3&gt;
&lt;p&gt;Withdrawals from the beacon chain are complex in nature, they involve removing funds from one layer and crediting them on another, with different trigger mechanisms that can start from either layer. Before applying the consensus layer state transition function to a given beacon state &lt;code&gt;pre_state&lt;&#x2F;code&gt; and processing a given signed beacon block &lt;code&gt;block&lt;&#x2F;code&gt;, the set of withdrawals that are expected to be deducted from the beacon chain are completely determined by &lt;code&gt;pre_state&lt;&#x2F;code&gt;. Previous to this EIP the set of withdrawals that are credited on the execution layer are included in &lt;code&gt;block&lt;&#x2F;code&gt;. The block is deemed invalid if these withdrawals do not match. With the separation included in this EIP, these operations of deducting and crediting become asynchronous:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;When processing the beacon block, the withdrawals are deducted from the beacon chain.&lt;&#x2F;li&gt;
&lt;li&gt;The set of withdrawals just deducted is committed to the beacon state &lt;code&gt;post_state&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;When processing any execution payload whose parent beacon state is &lt;code&gt;post_state&lt;&#x2F;code&gt;, the payload is deemed invalid if it doesn&#x27;t include precisely the list of withdrawals committed to &lt;code&gt;post_state&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This asynchronous mechanism has some consequences as slots may be &lt;em&gt;empty&lt;&#x2F;em&gt; as defined above. In these cases, the consensus layer does not process any more withdrawals until an execution payload has fulfilled the outstanding ones. An alternative design would be to defer all of withdrawal processing to the execution payload validation phase (ie. &lt;code&gt;process_execution_payload&lt;&#x2F;code&gt;). This has the advantage of not needing to track the fulfilled withdrawals on the beacon chain. The logic changes when several payloads are missing, in which case balances on the beacon chain change and therefore a withdrawal that would be possible with the former mechanism may be different, or even impossible with the latter.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;three-state-transition-functions&quot;&gt;Three state transition functions&lt;&#x2F;h3&gt;
&lt;p&gt;The current EIP adds an extra state transition function to the block processing in Ethereum. Processing a &lt;code&gt;SignedBeaconBlock&lt;&#x2F;code&gt; changes the consensus layer &lt;code&gt;BeaconState&lt;&#x2F;code&gt;. A &lt;code&gt;SignedExecutionPayloadEnvelope&lt;&#x2F;code&gt; changes both the execution layer state and the consensus layer one. As such, the envelope commits to the consensus layer post-state-transition beacon state root.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;compatible-designs&quot;&gt;Compatible designs&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;inclusion-lists&quot;&gt;Inclusion lists&lt;&#x2F;h4&gt;
&lt;p&gt;This EIP is fully compatible with forkchoice enforced inclusion lists as specified in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7805&#x2F;&quot;&gt;EIP-7805&lt;&#x2F;a&gt; or similar.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;slot-auctions&quot;&gt;Slot auctions&lt;&#x2F;h4&gt;
&lt;p&gt;A simple change to this EIP is to remove the blockhash commitment from the &lt;code&gt;SignedExecutionPayloadBid&lt;&#x2F;code&gt;. This allows the builder to commit any payload to the slot. A preliminary security analysis shows that payload equivocation does not weaken fork choice&#x27;s FFG. Some advantages of Slot auctions include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Better user experience as any submitted transaction can be included in the next block (with block auctions a transaction sent in the first half of the slot can only be included in the following block).&lt;&#x2F;li&gt;
&lt;li&gt;Longer continuous time to build blocks.&lt;&#x2F;li&gt;
&lt;li&gt;Better compatibility designs with fork choice enforced inclusion list proposals.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces backward incompatible changes to the block validation rule set on the consensus layer and must be accompanied by a hard fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;free-option-problem&quot;&gt;Free option problem&lt;&#x2F;h3&gt;
&lt;p&gt;Economically rational but malicious (as defined by the honest builder guide) builders may chose to withhold their payload in the event that it would be profitable for them. This could result in missed slots and degradation of user experience of Ethereum. Some preliminary data in the form of simulation suggests that the number of these occurrences may be noticeable. Some mitigations were proposed in the form of variable penalties for builders that fail to include their payload envelopes in the canonical chain.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;builder-safety&quot;&gt;Builder safety&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;A colluding set of proposers and attesters controlling consecutive blocks and more than 20% of the total stake can reorg a builder&#x27;s payload and force it to pay the bid&#x27;s value.&lt;&#x2F;li&gt;
&lt;li&gt;There is no possible &lt;em&gt;unbundling&lt;&#x2F;em&gt; of the builder&#x27;s payload in the same slot, that is, if the builder reveals a payload for the head of the chain, no other payload is possible for the current slot.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;malicious-ptc&quot;&gt;Malicious PTC&lt;&#x2F;h3&gt;
&lt;p&gt;The expected time for a malicious attacker, controlling 35% of the total stake, to have a majority control on the PTC is 205 000 years.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Decentralized Identity Verification (DID)</title>
        <published>2024-06-26T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Anushka Yadav</name><uri>https://github.com/64anushka</uri><email>64anushka@gmail.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7734/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/discussion-on-decentralized-identity-verification-did-standard/20392" />
        

        <id>https://wg-eips.ritovision.com/7734/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:7734"
            label="ERC-7734" />
        

        
        

        
        <summary type="html">A privacy-preserving method for decentralized identity verification, enabling secure integration of identity management in dApps.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7734/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal introduces a standard for decentralized identity verification (DID) on the blockchain. The standard leverages cryptographic hashes to represent identity proofs and events for transparency and traceability. By emphasizing simplicity, privacy, and user control, this proposal aims to reduce overhead for developers and users, ensuring seamless integration into decentralized applications (dApps). It offers a minimalistic solution that keeps identity structure simple and enables off-chain mechanisms for detailed identity management and verification.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Centralized identity verification methods are cumbersome, prone to data breaches, and fail to provide users control over their identity data. Existing DID solutions often introduce complexity, making adoption challenging for developers and users. This proposal seeks to address these issues by:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Offering a minimalistic, decentralized standard that simplifies identity verification.&lt;&#x2F;li&gt;
&lt;li&gt;Providing privacy-preserving mechanisms that keep sensitive identity data off-chain.&lt;&#x2F;li&gt;
&lt;li&gt;Encouraging wider adoption by enabling seamless integration into dApps across various industries.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;stakeholders&quot;&gt;Stakeholders&lt;&#x2F;h3&gt;
&lt;p&gt;The following stakeholders will benefit from this proposal:&lt;&#x2F;p&gt;
&lt;h4 id=&quot;dapp-developers&quot;&gt;dApp Developers&lt;&#x2F;h4&gt;
&lt;p&gt;Developers creating decentralized applications that require identity verification can implement this standard to provide users with secure, decentralized identity management. The minimalistic design makes it easier to integrate into existing workflows without adding unnecessary complexity.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;service-providers&quot;&gt;Service Providers&lt;&#x2F;h4&gt;
&lt;p&gt;Platforms offering services such as decentralized finance (DeFi), gaming, or social networking can integrate this standard to verify user identities without relying on centralized authorities. This reduces the risk of fraud and enhances user trust.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;enterprises&quot;&gt;Enterprises&lt;&#x2F;h4&gt;
&lt;p&gt;Companies looking to integrate blockchain-based identity solutions into their existing systems can use this standard to ensure secure and privacy-preserving identity verification. This allows for a seamless transition to decentralized technologies while maintaining user privacy and security.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;developers-of-interoperability-solutions&quot;&gt;Developers of Interoperability Solutions&lt;&#x2F;h4&gt;
&lt;p&gt;Those working on cross-platform and cross-blockchain interoperability can implement this standard to enable a unified identity verification mechanism across different systems, reducing complexity and increasing user control over their identities.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;differentiation&quot;&gt;Differentiation&lt;&#x2F;h3&gt;
&lt;p&gt;This proposal stands out from other DID standards by focusing on minimalism, user control, and privacy. Unlike other solutions that encompass a wide range of identity attributes and interactions, this standard keeps the structure simple and relies on off-chain mechanisms for detailed identity management. Its simplicity fosters easier adoption, making it ideal for dApps that prioritize user-centric, secure ecosystems.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The Decentralized Identity Verification (DID) standard introduces a simple, secure, and privacy-preserving mechanism for verifying user identities on the  blockchain. The key components of this standard are outlined below:&lt;&#x2F;p&gt;
&lt;h4 id=&quot;identity-contract&quot;&gt;Identity Contract&lt;&#x2F;h4&gt;
&lt;p&gt;A smart contract that acts as the central authority for identity verification. The contract stores the status of identity verifications for users and ensures that verification events are triggered securely and transparently.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;verification-function&quot;&gt;Verification Function&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;verifyIdentity&lt;&#x2F;code&gt; function allows a user to submit two verification hashes that represent off-chain proofs or attestations of identity. These hashes can be derived from external sources such as third-party verifiers, documents, or attestations.The function compares the provided hashes and updates the identity verification status accordingly.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;input-parameters&quot;&gt;Input Parameters:&lt;&#x2F;h5&gt;
&lt;p&gt;&lt;strong&gt;identityHash:&lt;&#x2F;strong&gt; A cryptographic hash representing the user&#x27;s identity.
&lt;strong&gt;verificationHash:&lt;&#x2F;strong&gt; A cryptographic hash derived from the proof or attestation used to verify the identity.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;identityverified-event&quot;&gt;IdentityVerified Event&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;IdentityVerified&lt;&#x2F;code&gt; event is emitted when the user&#x27;s identity verification is successfully updated. This event ensures traceability and transparency, allowing dApp developers and users to track verification statuses.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;identity-structure&quot;&gt;Identity Structure&lt;&#x2F;h4&gt;
&lt;p&gt;The identity is a simple structure represented by a unique address (public key). Additional identity attributes, such as name or age, are optional and left to off-chain management. This minimal approach keeps the implementation lean, avoiding unnecessary complexity and encouraging broader adoption.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;interface&quot;&gt;Interface&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IDecentralizedIdentity&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Struct to represent an identity&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Identity&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; userAddress&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Ethereum address of the user&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; identityHash&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Hash of the identity data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; verificationHashes&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Hashes used for verifying identity&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span&gt; isVerified&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Indicates if the identity is verified&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; timestamp&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Timestamp of identity creation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Event emitted when a new identity is created&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IdentityCreated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; userAddress&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; identityHash&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; timestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Event emitted when an identity is verified&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IdentityVerified&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; userAddress&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; verificationHashes&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; timestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Event emitted when an identity is revoked&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IdentityRevoked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; userAddress&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; timestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Function to create a new decentralized identity for the caller.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Parameters:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - identityHash: Hash of the identity data.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; createIdentity&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; identityHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Function to verify the decentralized identity for the caller.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Parameters:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - verificationHashes: Hashes used for verifying the identity. These can be &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   derived from off-chain proofs, cryptographic challenges, or other methods &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   specific to the implementer&amp;#39;s requirements. The exact meaning and derivation &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   of the verificationHashes are left to the contract&amp;#39;s implementer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verifyIdentity&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; verificationHashes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Function to revoke the decentralized identity for the caller.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revokeIdentity&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Function to retrieve the decentralized identity for a given user address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Parameters:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - userAddress Ethereum address of the user.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; identity The decentralized identity struct.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getIdentity&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; userAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Identity&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The design leverages cryptographic hashes to represent identity information, ensuring that sensitive data is not stored directly on the blockchain. The use of &lt;code&gt;verificationHashes&lt;&#x2F;code&gt; allows for flexible identity verification mechanisms. These hashes could be derived from various off-chain proofs, such as cryptographic challenges or attestations, depending on the implementer&#x27;s needs. By leaving the interpretation of the verification hashes open, the standard enables adaptability while maintaining privacy and security. Additionally, the inclusion of events ensures transparency and traceability.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IDecentralizedIdentity.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DecentralizedIdentity&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IDecentralizedIdentity&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Mapping to store identities by user address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Identity&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; identities&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Function to create a new decentralized identity for the caller.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Parameters:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - identityHash Hash of the identity data.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; createIdentity&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; identityHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Ensure identity does not already exist&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;identities&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;userAddress &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Identity already exists&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Create the identity for the caller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        identities&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Identity&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            userAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            identityHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; identityHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            verificationHashes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Initialize with empty hashes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            isVerified&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            timestamp&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emit event for the creation of a new identity&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IdentityCreated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; identityHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Function to verify the decentralized identity for the caller.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Parameters:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - verificationHashes: Hashes used for verifying the identity.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verifyIdentity&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; verificationHashes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Ensure identity exists&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;identities&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;userAddress &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Identity does not exist&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Update verification hashes and mark identity as verified&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        identities&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;verificationHashes &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; verificationHashes&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        identities&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;isVerified &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emit event for the verification of identity&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IdentityVerified&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; verificationHashes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Function to revoke the decentralized identity for the caller.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revokeIdentity&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Ensure identity exists&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;identities&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;userAddress &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Identity does not exist&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Mark identity as not verified&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        identities&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;isVerified &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emit event for the revocation of identity&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IdentityRevoked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Function to retrieve the decentralized identity for a given user address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Parameters:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - userAddress Ethereum address of the user.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; identity The decentralized identity struct.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getIdentity&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; userAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Identity&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; identities&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;userAddress&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;Secure Hashing&lt;&#x2F;strong&gt;: Ensure that identity and verification hashes are generated using a secure hashing algorithm to prevent collisions and ensure the integrity of the identity data.
&lt;strong&gt;Replay Attacks&lt;&#x2F;strong&gt;: Verification hashes should incorporate nonces or timestamps to prevent replay attacks.
&lt;strong&gt;Implementation Flexibility&lt;&#x2F;strong&gt;: Developers must ensure that hash generation and validation processes are robust and resistant to manipulation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EVM Transaction Bundles</title>
        <published>2024-06-24T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Lily Johnson</name><uri>https://github.com/lilyjjo</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7727/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7727-evm-transaction-bundles/20322" />
        

        <id>https://wg-eips.ritovision.com/7727/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:7727"
            label="EIP-7727" />
        

        
        

        
        <summary type="html">Enable meta transactions to order other transactions without revert protections.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7727/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces two new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; transaction types and one new opcode, enabling smart contracts and transactions to delegate their local sequencing rights to an off-chain entity. These new transaction types work together to create EVM-native &#x27;bundles&#x27;, which are similar to but weaker than the Proposer-Builder Separation (PBS) bundles offered by builders to searchers.&lt;&#x2F;p&gt;
&lt;p&gt;One of the EIP-2718 transactions is an extended normal transaction that supports:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Specifying the entity who can place the transaction in a bundle.&lt;&#x2F;li&gt;
&lt;li&gt;An optional block number that the transaction is valid in.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The other EIP-2718 transaction is a &#x27;meta&#x27; transaction that does not enter into execution, but rather orders transactions of its own type and the other new type. The &#x27;meta&#x27; transaction can also specify an entity allowed to include it in a bundle and a valid block number.&lt;&#x2F;p&gt;
&lt;p&gt;The new opcode reveals to the EVM the entity that placed the transaction in a bundle if the transaction was in a bundle.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, a single block builder has unrestricted control over the final sequencing of a block’s transactions. This poses a problem, as sequencing—the choice of who gets to interact with specific pieces of state and in what order—significantly influences value flow. The objective of this EIP is to allow more parties to participate in the construction of single blocks by exposing sequencing concepts inside of the EVM. This change would enable EVM applications to reclaim some of the sequencing value that is currently monopolized by block builders, redirecting it back to the applications themselves.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;DELEGATED_TX_TYPE&lt;&#x2F;td&gt;&lt;td&gt;0x05&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;BUNDLE_TX_TYPE&lt;&#x2F;td&gt;&lt;td&gt;0x06&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;BUNDLE_BASE_GAS_COST&lt;&#x2F;td&gt;&lt;td&gt;TBD &lt;!-- TODO --&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;BUNDLE_SIGNER_OPCODE_NUMBER&lt;&#x2F;td&gt;&lt;td&gt;TBD &lt;!-- TODO --&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;new-transaction-payload-types&quot;&gt;New Transaction Payload Types&lt;&#x2F;h3&gt;
&lt;p&gt;Two new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; transactions with types &lt;code&gt;DELEGATED_TX_TYPE&lt;&#x2F;code&gt; and &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;For the &lt;code&gt;DELEGATED_TX_TYPE&lt;&#x2F;code&gt;, the transaction payload should be interpreted as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;go&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;05&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; rlp&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	bundleSigner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	blockNumber&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	chainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	gasPrice&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	gasLimit&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	signatureYParity&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	signatureR&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	signatureS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;signatureYParity&lt;&#x2F;code&gt;, &lt;code&gt;signatureR&lt;&#x2F;code&gt;, &lt;code&gt;signatureS&lt;&#x2F;code&gt; elements of the &lt;code&gt;DELEGATED_TX_TYPE&lt;&#x2F;code&gt; represent a secp256k1 signature over:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;go&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;05&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; rlp&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;bundleSigner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; blockNumber&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; chain_id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; gasPrice&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; gasLimit&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;For the &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt;, the transaction payload should be interpreted as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;go&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;06&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; rlp&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	bundleSigner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	blockNumber&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	chainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	gasPrice&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	transactionList&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	signatureYParity&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	signatureR&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	signatureS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Where the &lt;code&gt;transactionList&lt;&#x2F;code&gt; element is a list of syntactically valid transactions of either type &lt;code&gt;DELEGATED_TX_TYPE&lt;&#x2F;code&gt; or &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt;. At least one transaction must be in the list.&lt;&#x2F;p&gt;
&lt;p&gt;An example would of the &lt;code&gt;transactionList&lt;&#x2F;code&gt; would be:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;go&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	DELEGATED_TX_TYPE&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	BUNDLE_TX_TYPE&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	DELEGATED_TX_TYPE&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;payload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;signatureYParity&lt;&#x2F;code&gt;, &lt;code&gt;signatureR&lt;&#x2F;code&gt;, &lt;code&gt;signatureS&lt;&#x2F;code&gt; elements of the &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt; represent a secp256k1 signature over:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;go&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;06&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; rlp&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;bundleSigner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; blockNumber&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; chainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; gasPrice&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; transactionList&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;We’ll refer to address resolved by this signature the bundle transaction’s signer.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;bundle-signer-opcode&quot;&gt;&lt;code&gt;BUNDLE_SIGNER&lt;&#x2F;code&gt; Opcode&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;BUNDLE_SIGNER&lt;&#x2F;code&gt; is a new opcode identified by &lt;code&gt;BUNDLE_SIGNER_OPCODE_NUMBER&lt;&#x2F;code&gt; that requires zero stack arguments.&lt;&#x2F;p&gt;
&lt;p&gt;When the transaction type is &lt;code&gt;DELEGATED_TX_TYPE&lt;&#x2F;code&gt;, this opcode pushes the &lt;code&gt;bundleSigner&lt;&#x2F;code&gt; from the transaction payload onto the stack as an address. If the transaction is of a different type, it returns the zero address.&lt;&#x2F;p&gt;
&lt;p&gt;The gas cost for this opcode is the &lt;code&gt;GAS_VERY_LOW&lt;&#x2F;code&gt; gas constant.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;transaction-validity-rules&quot;&gt;Transaction Validity Rules&lt;&#x2F;h3&gt;
&lt;p&gt;For a &lt;code&gt;DELEGATED_TX_TYPE&lt;&#x2F;code&gt; to be valid, the following must be true:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The transaction must be included in a &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt;&#x27;s &lt;code&gt;transactionList&lt;&#x2F;code&gt; to be valid.&lt;&#x2F;li&gt;
&lt;li&gt;The transaction’s specified &lt;code&gt;bundleSigner&lt;&#x2F;code&gt; must be equal to the address who signed over the &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt; that included the transaction in a &lt;code&gt;transactionList&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The payload variable &lt;code&gt;blockNumber&lt;&#x2F;code&gt;, if not zero, must be the block number that the transaction is executed in.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;For a &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt; to be valid, the following MUST be true:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;All transactions in the &lt;code&gt;transactionList&lt;&#x2F;code&gt; must specify the signer of the &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt; as the &lt;code&gt;bundleSigner&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The transaction must be included in a &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt;&#x27;s &lt;code&gt;transactionList&lt;&#x2F;code&gt; if the &lt;code&gt;bundleSigner&lt;&#x2F;code&gt; payload variable is not the zero address.&lt;&#x2F;li&gt;
&lt;li&gt;The payload variable &lt;code&gt;blockNumber&lt;&#x2F;code&gt;, if not zero, must be the block number that the transaction is executed in.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;gas-costs&quot;&gt;Gas Costs&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt; has a new gas cost formula that changes based on whether the transactions in the &lt;code&gt;transactionList&lt;&#x2F;code&gt; are valid at the time of execution.&lt;&#x2F;p&gt;
&lt;p&gt;If a transaction in the &lt;code&gt;transactionList&lt;&#x2F;code&gt; is invalid, the &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt; transaction is charged as if the invalid transaction&#x27;s bytes were part of a typical transaction&#x27;s &lt;code&gt;CALL_DATA&lt;&#x2F;code&gt;. If an inner transaction is valid, there is no cost for its inclusion in the list.&lt;&#x2F;p&gt;
&lt;p&gt;The formula is calculated as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;go&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;BUNDLE_BASE_GAS_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;CALL_DATA_TOKEN_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; transaction_list_invalid_tx_byte_length&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;At the start of processing, the &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt;&#x27;s signer is charged as if all inner transactions were invalid and is refunded the gas for the valid transactions as each valid transaction finishes execution.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;DELEGATED_TX_TYPE&lt;&#x2F;code&gt; follows typical gas costing rules.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;execution&quot;&gt;Execution&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;DELEGATED_TX_TYPE&lt;&#x2F;code&gt; execute normally with the &lt;code&gt;BUNDLE_SIGNER&lt;&#x2F;code&gt; opcode returning the &lt;code&gt;bundleSigner&lt;&#x2F;code&gt; payload variable.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt; do not start execution contexts. The&lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt;&#x27;s &lt;code&gt;NONCE&lt;&#x2F;code&gt; must be incremented before the start of any &lt;code&gt;transactionList&lt;&#x2F;code&gt; execution.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;receiptpayload-definitions&quot;&gt;ReceiptPayload Definitions&lt;&#x2F;h3&gt;
&lt;p&gt;For &lt;code&gt;DELEGATED_TX_TYPE&lt;&#x2F;code&gt; transaction that are able to begin execution, their &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; receipt payload should be interpreted as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;go&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;rlp&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;status&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; cumulativeGasUsed&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; logsBloom&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; logs&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;DELEGATED_TX_TYPE&lt;&#x2F;code&gt; transactions that are invalid do not get transaction receipts.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt; transaction’s  &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; receipt payload should be interpreted as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;go&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;rlp&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;statusArray&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; cumulativeGasUsed&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Where the &lt;code&gt;statusArray&lt;&#x2F;code&gt; is a list of status results for the inner &lt;code&gt;transactionList&lt;&#x2F;code&gt;&#x27;s transactions. The list must be the same length as the &lt;code&gt;transactionList&lt;&#x2F;code&gt; and report the statuses in the same order. The status type &lt;code&gt;0x3&lt;&#x2F;code&gt; should be used to report invalid transactions.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;cumulateGasUsed&lt;&#x2F;code&gt; is the amount of gas spent by the &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt;&#x27;s signer on the &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt; transaction costs post &lt;code&gt;CALLDATA&lt;&#x2F;code&gt; refund.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;allowing-invalid-transactions-to-be-included-in-a-bundle-tx-type-s-transactionlist&quot;&gt;Allowing invalid transactions to be included in a &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt;&#x27;s &lt;code&gt;transactionList&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Knowing how a transaction will execute is challenging without knowing the state root to which the transaction is applied. Creators of &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt; transactions can only access the previous block’s state root and cannot predict which transactions will precede the &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt; transaction in the upcoming block&#x27;s total order. If only valid transactions were permitted, &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt; transaction lists could be easily invalidated by a single inner transaction attempting to grief the bundle through nonce or gas invalidations.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;charging-the-bundle-tx-type-s-signer-calldata-gas-costs-for-invalid-transactions&quot;&gt;Charging the &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt;&#x27;s signer &lt;code&gt;CALLDATA&lt;&#x2F;code&gt; gas costs for invalid transactions&lt;&#x2F;h3&gt;
&lt;p&gt;Blockchains must charge for the work that nodes perform to prevent DoS attacks. Even though invalid transactions in &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt; transaction lists do not execute, they still occupy block space as bytes and must be paid for by some entity. It is assumed that &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt; creators will be sophisticated entities capable of simulating the previous block’s state with relative accuracy and able to generate enough profit to offset any invalidation costs incurred.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;BUNDLE_BASE_GAS_COST&lt;&#x2F;code&gt; should be set to make the cost of attempting to grief the &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt; signer more expensive than the cost of the bytes to cover the invalid transaction.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;requiring-delegated-tx-type-typed-transactions-to-be-included-in-a-bundle-tx-type-s-transactionlist&quot;&gt;Requiring &lt;code&gt;DELEGATED_TX_TYPE&lt;&#x2F;code&gt; typed transactions to be included in a &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt;&#x27;s &lt;code&gt;transactionList&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;If &lt;code&gt;DELEGATED_TX_TYPE&lt;&#x2F;code&gt; transactions were able to be executed outside of a &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt; transaction list, then there would be competition between the &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt; signer and the total block builder for the right to choose how to locally sequence the transaction. If the &lt;code&gt;DELEGATED_TX_TYPE&lt;&#x2F;code&gt; transaction signer wished to allow the total block builder to choose the local ordering, then the &lt;code&gt;DELEGATED_TX_TYPE&lt;&#x2F;code&gt; transaction type should not be used.&lt;&#x2F;p&gt;
&lt;p&gt;The same principle applies to &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt; transactions. Those that specify a &lt;code&gt;bundleSigner&lt;&#x2F;code&gt; must only be included in a &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt; list, while those that do not specify a &lt;code&gt;bundleSigner&lt;&#x2F;code&gt; must not be included in such a list.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;not-allowing-other-transactions-types-to-be-included-in-a-bundle-tx-type-s-transactionlist&quot;&gt;Not allowing other transactions types to be included in a &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt;&#x27;s &lt;code&gt;transactionList&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;This restriction was implemented as a precautionary measure and could be reconsidered in the future. Allowing the inclusion of other transaction types that do not specify a &lt;code&gt;bundleSigner&lt;&#x2F;code&gt; into the &lt;code&gt;transactionList&lt;&#x2F;code&gt; could result in multiple searchers attempting to include the same transaction in a bundle. This could potentially create spam within a block.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;differences-from-pbs-searcher-bundles&quot;&gt;Differences from PBS Searcher Bundles&lt;&#x2F;h3&gt;
&lt;p&gt;PBS block builders currently offer &#x27;bundles&#x27; as a service to searchers in the form of transaction lists that either all execute without reversion or are not included in a block. Searchers typically use these bundles to bid for the right to be the first to interact with a piece of state or to place logic before or after transactions created by non-searcher entities, with back-running and sandwiching being examples. PBS block builders provide this service as a way to gain order flow and increase their block&#x27;s value.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt; transaction differ in two key ways:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;There is no revert protection.&lt;&#x2F;li&gt;
&lt;li&gt;Only transactions explicitly delegating to a &lt;code&gt;bundleSigner&lt;&#x2F;code&gt; can be bundled.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;These choices were made to prevent DoS attacks on builders and to be compatible with non-PBS block builders running other algorithms.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Block builders are problematic today partly due to their ability to perform censorship and enforce malicious orderings. These concerns persist even when sequencing rights are delegated to a specific entity. The code that generates the off-chain ordering should be public and executed in a trust-minimized manner, such as in a TEE (Trusted Execution Environment) or on a blockchain with faster block times.&lt;&#x2F;p&gt;
&lt;p&gt;Similarly, smart contracts that restrict functionality to transactions signed by a specific &lt;code&gt;BUNDLE_SIGNER&lt;&#x2F;code&gt; should provide mechanisms for users to withdraw funds without relying on the delegated sequencing entity to be online or non-malicious. A two-step fund removal process could be implemented to allow safe interaction with bundle construction and simulation logic.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Add wallet_signIntendedValidatorData method</title>
        <published>2024-06-21T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Yamen Merhi</name><uri>https://github.com/YamenMerhi</uri>
	</author>
	
	<author>
		<name>Patronum Labs</name><uri>https://github.com/Patronum-Labs</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7749/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7749-add-wallet-signintendedvalidatordata-method/20693" />
        

        <id>https://wg-eips.ritovision.com/7749/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="interface"
                label="Interface" />
            
        

        
        <category
            term="tag:eip:7749"
            label="EIP-7749" />
        

        
        

        
        <summary type="html">A new RPC method to sign data with an intended validator address according to ERC-191 version 0x00.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7749/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a new JSON-RPC method, &lt;code&gt;wallet_signIntendedValidatorData&lt;&#x2F;code&gt;, which allows signing data with an intended validator address using &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;191&#x2F;&quot;&gt;ERC-191&lt;&#x2F;a&gt; version 0x00 with this format:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x19&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;intended&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; validator&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; addres&lt;&#x2F;span&gt;&lt;span&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; sig&lt;&#x2F;span&gt;&lt;span&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, signing messages relies heavily on ERC-191 version 0x45 (&lt;code&gt;eth_sign&lt;&#x2F;code&gt;) and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; (&lt;code&gt;eth_signTypedData&lt;&#x2F;code&gt;). While EIP-712 provides a more structured approach, it is often seen as complex. On the other hand, ERC-191 version 0x45 is widely used but poses significant phishing risks due to the lack of data parsing.&lt;&#x2F;p&gt;
&lt;p&gt;ERC-191 defines three versions: 0x45, 0x01, and 0x00. This proposal aims to fully support ERC-191 by introducing the rpc call for 0x00 version, which enables signing data with an intended validator address. This new method will:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Enable more dApps to use ERC-191 version 0x00 without using raw signing methods which might be dangerous and restricted in few wallets.&lt;&#x2F;li&gt;
&lt;li&gt;Enhance security by parsing data and displaying the intended validator address, reducing phishing risks.&lt;&#x2F;li&gt;
&lt;li&gt;Provide a simpler alternative to EIP-712, offering a balance between usability and security.&lt;&#x2F;li&gt;
&lt;li&gt;Be particularly relevant for smart contract accounts, allowing signing with a specific intended validator address.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;With the rise of smart contract accounts and the reliance on signatures to improve UX, the need for supporting ERC-191 version 0x00 increases, especially given the prevalence of verifier smart contracts, such as Entry Points, Smart Contract Accounts, Key Managers, etc.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;wallet-signintendedvalidatordata&quot;&gt;&lt;code&gt;wallet_signIntendedValidatorData&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;MUST calculate an Ethereum signature using &lt;code&gt;sign(keccak256(&quot;\x19\x00&amp;lt;intended validator address&amp;gt;&amp;lt;data to sign&amp;gt;&quot;))&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This method adds a prefix to the message to prevent malicious dApps from signing arbitrary data (e.g., a transaction) and using the signature to impersonate the victim.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; WalletSignIntendedValidatorDataParams&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  signerAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  validatorAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;     &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  dataToSign&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;           &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;signerAddress&lt;&#x2F;code&gt; - 20-byte account address: The address signing the constructed message.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;validatorAddress&lt;&#x2F;code&gt; - 20-byte account address: The intended validator address included in the message to sign.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;dataToSign&lt;&#x2F;code&gt; - Data string: The data to sign.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h4 id=&quot;returns&quot;&gt;Returns&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;Signature&lt;&#x2F;code&gt; - The Ethereum Signature generated.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;wallet_signIntendedValidatorData&lt;&#x2F;code&gt; method aims to bridge the gap between the simplicity of ERC-191 version 0x45 and the structured approach of EIP-712. By specifying the intended validator address, it reduces phishing risks and provides a more secure signing method for smart contract accounts and other use cases requiring a specific validator address.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;example&quot;&gt;Example&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Signer Address (&lt;code&gt;0x6aFbBC5e6AFcB251371711a6551E60ead2779Dc0&lt;&#x2F;code&gt;): This is the address of the account that will be used to sign the constructed message. We have access to the private key of this address, which allows us to generate the signature securely.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Verifier Address (&lt;code&gt;0x345B918b9E06fAa7B0e56bd71Ba418F31F47FED4&lt;&#x2F;code&gt;): This address represents the address verifying the signature, could be an EOA or smart contract. For example, it could be a contract that performs specific actions based on the validity of the signature. By including this address in the data to be signed, we ensure that the signature cannot be reused by malicious actors for unintended purposes.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Data to Sign (&lt;code&gt;0x59616d656e&lt;&#x2F;code&gt;): This is the hex-encoded string representing the actual content to be signed. In this example, it is the hex encoding for the ASCII string &quot;Yamen&quot;. The data, combined with the verifier address, is hashed and signed to generate a unique signature that cannot be used for any other purpose.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Request:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;-data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{&amp;quot;jsonrpc&amp;quot;:&amp;quot;2.0&amp;quot;,&amp;quot;method&amp;quot;:&amp;quot;wallet_signIntendedValidatorData&amp;quot;,&amp;quot;params&amp;quot;:[&amp;quot;0x6aFbBC5e6AFcB251371711a6551E60ead2779Dc0&amp;quot;, &amp;quot;0x345B918b9E06fAa7B0e56bd71Ba418F31F47FED4&amp;quot;, &amp;quot;0x59616d656e&amp;quot;], &amp;quot;id&amp;quot;:1}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;method&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;wallet_signIntendedValidatorData&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x6aFbBC5e6AFcB251371711a6551E60ead2779Dc0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x345B918b9E06fAa7B0e56bd71Ba418F31F47FED4&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x59616d656e&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Result:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x4355c47d63924e8a72e509b65029052eb6c299d53a04e167c5775fd466751c9d07299936d304c153f6443dfa05f40ff007d72911b6f72307f996231605b915621c&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The result field contains the Ethereum signature generated by signing the hashed message according to version 0 of ERC-191.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Users should exercise caution when signing messages. Double-check the address of the verifier and ensure trust in the dApp triggering the sign request.&lt;&#x2F;p&gt;
&lt;p&gt;To protect against replay attacks and cross-chain replay attacks, include chainId and nonce in the validator data to sign.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Common Quote Oracle</title>
        <published>2024-06-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>alcueca</name><uri>https://github.com/alcueca</uri>
	</author>
	
	<author>
		<name>ruvaag</name><uri>https://github.com/ruvaag</uri>
	</author>
	
	<author>
		<name>totomanov</name><uri>https://github.com/totomanov</uri>
	</author>
	
	<author>
		<name>r0ohafza</name><uri>https://github.com/r0ohafza</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7726/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7726-common-quote-oracle/20351" />
        

        <id>https://wg-eips.ritovision.com/7726/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7726"
            label="ERC-7726" />
        

        
        

        
        <summary type="html">Interface for data feeds providing the relative value of assets.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7726/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The following allows for the implementation of a standard API for data feeds providing the relative value of
assets, forcing compliant contracts to use explicit token amounts instead of price factors. This approach has been
shown to lead to better security and time-to-market outcomes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The information required to value assets is scattered over a number of major and minor sources, each one with their own
integration API and security considerations. Many protocols over the years have implemented oracle adapter layers for
their own use to abstract this complexity away from their core implementations, leading to much duplicated effort.&lt;&#x2F;p&gt;
&lt;p&gt;This specification provides a standard API aimed to serve the majority of use cases. Preference is given to ease of
integration and serving the needs of product teams with less knowledge, requirements and resources.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;base asset: The asset that the user needs to know the value for (e.g: USDC as in &quot;I need to know the value of 1e6 USDC
in ETH terms&quot;).&lt;&#x2F;li&gt;
&lt;li&gt;quote asset: The asset in which the user needs to value the &lt;code&gt;base&lt;&#x2F;code&gt; (e.g: ETH as in &quot;I need to know the value of 1e6
USDC in ETH terms&quot;).&lt;&#x2F;li&gt;
&lt;li&gt;value: An amount of &lt;code&gt;base&lt;&#x2F;code&gt; in &lt;code&gt;quote&lt;&#x2F;code&gt; terms (e.g. The &lt;code&gt;value&lt;&#x2F;code&gt; of 1000e6 USDC in ETH terms is 283,969,794,427,307,000
ETH, and the &lt;code&gt;value&lt;&#x2F;code&gt; of 1000e18 ETH in USDC terms is 3,521,501,299,000 USDC). Note that this is an asset amount, and
not a decimal factor.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;methods&quot;&gt;Methods&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;getquote&quot;&gt;&lt;code&gt;getQuote&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Returns the value of &lt;code&gt;baseAmount&lt;&#x2F;code&gt; of &lt;code&gt;base&lt;&#x2F;code&gt; in &lt;code&gt;quote&lt;&#x2F;code&gt; terms.&lt;&#x2F;p&gt;
&lt;p&gt;MUST round down towards 0.&lt;&#x2F;p&gt;
&lt;p&gt;MUST revert if the value of &lt;code&gt;baseAmount&lt;&#x2F;code&gt; of &lt;code&gt;base&lt;&#x2F;code&gt; in &lt;code&gt;quote&lt;&#x2F;code&gt; terms would overflow in a uint256.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; g&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;etQuote&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;aseAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ase&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; q&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uote&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; q&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uoteAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;special-addresses&quot;&gt;Special Addresses&lt;&#x2F;h3&gt;
&lt;p&gt;Some assets under the scope of this specification don&#x27;t have an address, such as ETH, BTC and national currencies.&lt;&#x2F;p&gt;
&lt;p&gt;For ETH, the address will be &lt;code&gt;0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE&lt;&#x2F;code&gt; as per &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7528&#x2F;&quot;&gt;ERC-7528&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;For BTC, the address will be &lt;code&gt;0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;For assets without an address, but with an ISO 4217 &lt;!-- TODO: Bug Sam about editing EIP-1 to allow certain ISO external links --&gt; code, the code will be used (e.g. &lt;code&gt;address(840)&lt;&#x2F;code&gt; for USD).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The use of &lt;code&gt;getQuote&lt;&#x2F;code&gt; doesn&#x27;t require the consumer to be aware of any decimal partitions that might have been defined
for the &lt;code&gt;base&lt;&#x2F;code&gt; or &lt;code&gt;quote&lt;&#x2F;code&gt; and should be preferred in most data processing cases.&lt;&#x2F;p&gt;
&lt;p&gt;The spec doesn&#x27;t include a &lt;code&gt;getPrice&lt;&#x2F;code&gt; function because it is rarely needed on-chain, and it would be a decimal number of
difficult representation. The popular option for representing prices can be implemented for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; with decimals as
`oracle.getQuote(base, quote, 10**base.decimals()) and will give the value of a whole unit of base in quote terms.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Most existing data feeds related to the relative value of pairs of assets should be representable using this standard.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This specification purposefully provides no methods for data consumers to assess the validity of the data they receive.
It is expected of individual implementations using this specification to decide and publish the quality of the data that
they provide, including the conditions in which they will stop providing it.&lt;&#x2F;p&gt;
&lt;p&gt;Consumers should review these guarantees and use them to decide whether to integrate or not with a data provider.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Deferred Token Transfer</title>
        <published>2024-06-09T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Chen Liaoyuan</name><uri>https://github.com/chenly</uri><email>cly@kip.pro</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7720/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7720-deferred-token-transfer/20245" />
        

        <id>https://wg-eips.ritovision.com/7720/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7720"
            label="ERC-7720" />
        

        
        

        
        <summary type="html">Allows users to schedule ERC-20 token transfers for withdrawal at a specified future time, enabling deferred payments.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7720/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard specifies that allows users to deposit &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens for a beneficiary. The beneficiary can withdraw the tokens only after a specified future timestamp. Each deposit transaction is assigned a unique ID and includes details such as the token address, sender, recipient, amount, unlock time, and withdrawal status.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;In various scenarios, such as vesting schedules, escrow services, or timed rewards, there is a need for deferred payments. This contract provides a secure and reliable mechanism for time-locked token transfers, ensuring that tokens can only be transferred after a specified timestamp is reached. By facilitating structured and delayed payments, it adds an extra layer of security and predictability to token transfers. This is particularly useful for scenarios where payments are contingent upon the passage of time.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;Implementers of this standard &lt;strong&gt;MUST&lt;&#x2F;strong&gt; have all of the following functions:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ITokenTransfer&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Event emitted when a transfer is initiated.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; txnId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint40&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; unlockTime&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; referenceNo&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Event emitted when tokens are withdrawn.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Withdraw&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; txnId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Function to initiate a token transfer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Parameters:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - _token: Address of the ERC20 token contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - _from: Address of the sender.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - _to: Address of the recipient.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - _amount: Amount of tokens to be transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - _unlockTime: Time after which the tokens can be withdrawn.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - _reference: Reference ID for the transaction.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the transaction ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint40&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _unlockTime&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _reference&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; txnId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Function to withdraw tokens from a transaction.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Parameters:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - _txnId: ID of the transaction to withdraw from.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; withdraw&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _txnId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Function to get transaction details.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Parameters:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - _txnId: ID of the transaction.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the transaction details.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getTransaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _txnId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            uint40&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; unlockTime&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; referenceNo&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; withdrawn&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The design of the Deferred Token Transfer contract aims to provide a straightforward and secure method for handling time-locked token transfers. The following considerations were made during its development:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Unlock Time Precision with &lt;code&gt;uint40&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: We chose a full &lt;code&gt;uint40&lt;&#x2F;code&gt; for &lt;code&gt;_unlockTime&lt;&#x2F;code&gt; because it provides a sufficiently large range to cover all practical time-lock scenarios. This ensures that the contract can handle deferred payments that require precise timing over long periods, such as vesting schedules or long-term escrows.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Returning &lt;code&gt;txnId&lt;&#x2F;code&gt; from &lt;code&gt;transferFrom&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: The &lt;code&gt;transferFrom&lt;&#x2F;code&gt; function returns a unique &lt;code&gt;txnId&lt;&#x2F;code&gt; for each transaction. This design choice was made to facilitate easy and independent tracking of each transaction. By having a unique ID, users can manage and reference specific transactions, ensuring clarity and preventing confusion. This approach allows each transaction&#x27;s state to be managed independently, simplifying the withdrawal process.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Compatibility with Existing ERC-20 Tokens&lt;&#x2F;strong&gt;: The standard is designed as a separate interface rather than an extension of ERC-20 to ensure flexibility and broad compatibility. By not modifying the ERC-20 standard directly, this proposal can be used with any existing ERC-20 token without requiring changes to their contracts. This flexibility makes the standard applicable to a wide range of tokens already in circulation, enhancing its utility and adoption potential.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC20&#x2F;utils&#x2F;SafeERC20.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TokenTransfer&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    using&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SafeERC20&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC20&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transaction&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; token&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the ERC20 token contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; from&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;       &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the sender.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the recipient.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Amount of tokens to be transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint40&lt;&#x2F;span&gt;&lt;span&gt; unlockTime&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Time after which the tokens can be withdrawn.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; referenceNo&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Reference ID for the transaction.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span&gt; withdrawn&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Flag indicating if the tokens have been withdrawn.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Mapping from transaction ID to Transaction structure.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Transaction&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; transactions&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Variable to keep track of the next transaction ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; lastTxnId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Event emitted when a transfer is initiated.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; txnId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint40&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; unlockTime&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; referenceNo&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Event emitted when tokens are withdrawn.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Withdraw&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; txnId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Function to initiate a token transfer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Parameters:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - _token: Address of the ERC20 token contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - _from: Address of the sender.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - _to: Address of the recipient.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - _amount: Amount of tokens to be transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - _unlockTime: Time after which the tokens can be withdrawn.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - _reference: Reference ID for the transaction.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the transaction ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint40&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _unlockTime&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _reference&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; txnId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_amount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Invalid transfer amount&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfer tokens from sender to this contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        IERC20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;safeTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        lastTxnId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Store the transaction details.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        transactions&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;lastTxnId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            token&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; _token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            from&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            to&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            unlockTime&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; _unlockTime&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            referenceNo&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; _reference&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            withdrawn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emit an event for the transaction creation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;lastTxnId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _unlockTime&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _reference&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; lastTxnId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Function to withdraw tokens from a transaction.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Parameters:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - _txnId: ID of the transaction to withdraw from.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; withdraw&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _txnId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        Transaction &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;storage&lt;&#x2F;span&gt;&lt;span&gt; transaction &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; transactions&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_txnId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Invalid transaction ID&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;unlockTime&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Current time is before unlock time&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; require(transaction.to == msg.sender, &amp;quot;Only the recipient can withdraw the tokens&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;withdrawn&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Tokens already withdrawn&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        IERC20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;safeTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;withdrawn &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emit an event for the token withdrawal.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Withdraw&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_txnId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Function to get transaction details.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Parameters:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - _txnId: ID of the transaction.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the transaction details.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getTransaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _txnId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            uint40&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; unlockTime&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; referenceNo&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; withdrawn&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        Transaction &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;storage&lt;&#x2F;span&gt;&lt;span&gt; transaction &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; transactions&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_txnId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Invalid transaction ID&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;unlockTime&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;referenceNo&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;withdrawn&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;Ownerless Contract Design&lt;&#x2F;strong&gt;: To prevent the risk of token loss after deposit, the contract should not have an owner. This ensures that the contract&#x27;s token balance cannot be transferred to any address other than the designated beneficiary.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Strict Beneficiary Control&lt;&#x2F;strong&gt;: During withdrawal, the contract must strictly ensure that tokens are transferred only to the beneficiary specified at the time of deposit. This prevents unauthorized access and ensures that only the intended recipient can withdraw the tokens.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Opaque Token</title>
        <published>2024-06-09T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Ivica Aračić</name><uri>https://github.com/ivica7</uri>
	</author>
	
	<author>
		<name>Ante Bešlić</name><uri>https://github.com/ethSplit</uri>
	</author>
	
	<author>
		<name>Mirko Katanić</name><uri>https://github.com/mkatanic</uri>
	</author>
	
	<author>
		<name>SWIAT</name>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7722/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7722-opaque-token/20249" />
        

        <id>https://wg-eips.ritovision.com/7722/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7722"
            label="ERC-7722" />
        

        
        

        
        <summary type="html">A token specification designed to enhance privacy by concealing balance information.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7722/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC proposes a specification for an opaque token that enhances privacy by concealing balance information. Privacy is achieved by representing balances as off-chain data encapsulated in hashes, referred to as &quot;baskets&quot;. These baskets can be reorganized, transferred, and managed through token functions on-chain.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Smart contract accounts serve as well-defined identities that can have reusable claims and attestations attached to them, making them highly useful for various applications. However, this strength also introduces a significant privacy challenge when these identities are used to hold tokens. Specifically, in the case of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; compatible tokens, where balances are stored directly on-chain in plain text, the transparency of these balances can compromise the privacy of the account holder. This creates a dilemma: while the reuse of claims and attestations tied to a smart contract account can be advantageous, it also increases the risk of exposing sensitive financial information, particularly when these well-defined identities are associated with publicly visible token holdings.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal aims to conceal balances on-chain, allowing the use of smart contract accounts to hold tokens without compromising privacy or integrity.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;The concept revolves around representing token balances on-chain as hashed values, called baskets, which obscure the actual balance information. These baskets combine a random salt, a unique token ID, and the token&#x27;s value, making it impossible to derive the token&#x27;s value directly from the blockchain.&lt;&#x2F;p&gt;
&lt;p&gt;The token interface allows for creating, transferring, issuing, and reorganizing (splitting and joining) these baskets. To prevent unauthorized changes and maintain integrity, oracle services verify that the total value of baskets remains consistent during reorganizations. Additionally, differential privacy techniques, such as overlaying noise and empty transfers, further protect privacy by making it difficult to trace token movements and determine actual transaction details.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;baskets&quot;&gt;Baskets&lt;&#x2F;h3&gt;
&lt;p&gt;Balances are represented on-chain as hashes of the form:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;keccak256(abi.encode(salt, tokenId, value))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; where  salt (bytes32)    - random 32bytes to increase the entropy and&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;                            make brute-forcing the hash impossible&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;        tokenId (bytes32) - a unique tokenId within token&amp;#39;s smart contract instance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;        value (uint256)   - the value of the position&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;For the remainder of this document, we refer to these hashes as &quot;baskets&quot; because they conceal the balance information in an opaque manner, similar to how a covered basket hides its contents.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;token-interface&quot;&gt;Token Interface&lt;&#x2F;h3&gt;
&lt;p&gt;An opaque token MUST implement the following interface.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;interface OpaqueToken {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &#x2F;&#x2F; TYPES&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  struct SIGNATURE {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    uint8 v; bytes32 r; bytes32 s;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  struct ORACLECONFIG {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    uint8 minNumberOfOracles; &#x2F;&#x2F; min. number of oracle signatures required for reorg&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address[] oracles;        &#x2F;&#x2F; valid oracles&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &#x2F;&#x2F; EVENTS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   * @dev MUST be emitted when new token is created&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   * @param initiatedBy address that created and controls the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   * @param tokenId identifier of the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   * @param totalSupplyBasket initial supply basket, containing total supply of tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   * @param ref custom reference as used by initiator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  event CreateToken(address initiatedBy, bytes32 tokenId, bytes32 totalSupplyBasket, bytes32 ref);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   * @dev MUST be emitted on issuance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   * @param initiatedBy address that initiated issuance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   * @param baskets baskets that were issued to the receiver&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   * @param receiver address that received baskets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   * @param ref custom reference as used by initiator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  event Issue(address initiatedBy, bytes32[] baskets, address receiver, bytes32 ref);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   * @dev MUST be emitted when holder baskets are restructured&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   * @param initiatedBy address that initiated reorg and owner of all baskets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   * @param basketsIn baskets that are restructured and no longer exist&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   * @param basketsOut baskets that are newly created&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   * @param ref custom reference as used by initiator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  event ReorgHolderBaskets(address initiatedBy, bytes32[] basketsIn, bytes32[] basketsOut, bytes32 ref);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   * @dev MUST be emitted when supply baskets are restructured&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   * @param initiatedBy address that initiated reorg&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   * @param basketsIn supply baskets that are restructured and no longer exist&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   * @param basketsOut supply baskets that are newly created&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   * @param ref custom reference as used by initiator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  event ReorgSupplyBaskets(address initiatedBy, bytes32[] basketsIn, bytes32[] basketsOut, bytes32 ref);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   * @dev MUST be emitted when baskets are transferred from one address to another&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   * @param initiatedBy address that initiated the transfer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   * @param receiver address that is the new owner of baskets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   * @param baskets baskets that were transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   * @param ref custom reference as used by initiator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  event Transfer(address initiatedBy, address receiver, bytes32[] baskets, bytes32 ref);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   * @dev MUST be emitted on redeem&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   * @param initiatedBy address that initiated redeem&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   * @param baskets baskets that were redeemed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   * @param ref custom reference as used by initiator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  event Redeem(address initiatedBy, bytes32[] baskets, bytes32 ref);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &#x2F;&#x2F; FUNCTIONS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   * @dev returns the configuration for this token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  function oracleConfig() external view returns (ORACLECONFIG memory);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   * @dev returns the address of the basket owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  function owner(bytes32 basket) external view returns (address);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   * @dev returns the total supply for a `tokenId``&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   * All token investors are allowed to fetch this value from the token operator&amp;#39;s off-chain storage.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  function totalSupply(bytes32 tokenId) external view returns (bytes32);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   * @dev returns the operator of this token, who is also responsible for providing the main&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   * off-chain storage source.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  function operator() external view returns (address);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   * @dev Allows the token operator to create a new token with the specified `tokenId` and an initial &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   * `totalSupplyBasket`. The `totalSupplyBasket` can be partitioned using {reorgSupplyBaskets} as needed &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   * when calling {issue}. The `ref` parameter can be used freely by the caller for any reference purpose.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  function createToken(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      bytes32 tokenId,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      bytes32 totalSupplyBasket,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      bytes32 ref&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ) external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   * @dev Allows the token operator to issue tokens by assigning `supplyBaskets` to a `receiver` which &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   * becomes the owner of these baskets. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  function issue(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      bytes32[] calldata supplyBaskets,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      address receiver,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      bytes32 ref&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ) external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   * @dev transfers `baskets` to a `receiver` who becomes the new owner of these baskets. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  function transfer(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      bytes32[] calldata baskets,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      address receiver,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      bytes32 ref&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ) external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   * @dev reorganizes a set of holder baskets (`basketsIn`) to a new set (`basketsOut`) having&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   * the same value, i.e., the sum of all values from input baskets equals the sum of values&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   * in output baskets. In order to ensure the integrity, external oracle service is required that&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   * will sign the reorg proposal requested by the basket owner, which is passed as `reorgOracleSignatures`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   * The minimum number of oracle signatures is defined in the oracle configuration.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  function reorgHolderBaskets(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      SIGNATURE[] calldata reorgOracleSignatures,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      bytes32[] calldata basketsIn,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      bytes32[] calldata basketsOut,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      bytes32 ref&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ) external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   * @dev same as {reorgHolderBaskets}, but for the available supply baskets.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  function reorgSupplyBaskets(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      SIGNATURE[] calldata reorgOracleSignatures,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      bytes32[] calldata basketsIn,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      bytes32[] calldata basketsOut,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      bytes32 ref&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ) external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   * @dev redeems holder&amp;#39;s `baskets` and returns them to available supply&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  function redeem(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      bytes32[] calldata baskets,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      bytes32 ref&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ) external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;user-roles&quot;&gt;User Roles&lt;&#x2F;h3&gt;
&lt;p&gt;There are two roles in Opaque Token:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Token Operator: One who creates a token and issues positions in it, and controls it&#x27;s non-circulating supply (held in supply baskets). Will use createToken, reorgSupplyBasket and issue functions. Also has ability to force actions through forceTransfer and forceReorg functions.&lt;&#x2F;li&gt;
&lt;li&gt;Token User: address that holds circulating tokens (held in owned baskets). Will use reorgSupplyBaskets, transfer and redeem functions.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;off-chain-data-endpoints&quot;&gt;Off-chain Data Endpoints&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;The operator of the token (e.g., issuer or registrar) MUST provide the off-chain storage that implements the &lt;code&gt;GET basket&lt;&#x2F;code&gt; and &lt;code&gt;PUT basket&lt;&#x2F;code&gt; REST endpoints as described in this section.&lt;&#x2F;li&gt;
&lt;li&gt;The operator MUST ensure the availability of the basket data and will share it on need-to-know basis with all eligible holders, i.e., with all address that either were holding the basket in the past or are currently the holder of the basket.&lt;&#x2F;li&gt;
&lt;li&gt;To ensure data is only shared with and can be written by eligible holders, the operator MUST implement authentication for both endpoints. The concrete authentication schema is not specified here and my depend on the environment of the token operator.&lt;&#x2F;li&gt;
&lt;li&gt;The operator MUST allow an existing token holder to &lt;code&gt;PUT basket&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;The operator MUST allow the current or historical basket holder to &lt;code&gt;GET basket&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Token holders SHOULD store a copy of the data about their own baskets in their own off-chain storage for the case that operator&#x27;s service is unavailable.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;REST API Endpoints for creating and querying baskets:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Endpoint: PUT baskets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Description: will store baskets if the `basket` hash is matching `data`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  PostData: &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      basket: keccak256(abi.encode(salt, tokenId, value)),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      data: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        salt: &amp;lt;bytes32&amp;gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        tokenId: &amp;lt;bytes32&amp;gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        value: &amp;lt;uint256&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Endpoint: GET baskets?basket-hash=&amp;lt;bytes32&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Description: will return the list of baskets depending on the query parameters.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Query Parameters:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    - basket-hash (optional): returns one basket matching the requested hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    - if no query parameter is set, then the endpoint will return all baskets of the requestor&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Response:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      basket: keccak256(abi.encode(salt, tokenId, value)),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      data: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        salt: &amp;lt;bytes32&amp;gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        tokenId: &amp;lt;bytes32&amp;gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        value: &amp;lt;uint256&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;reorg-endpoint&quot;&gt;reorg Endpoint&lt;&#x2F;h3&gt;
&lt;p&gt;To ensure the integrity of a reorg and avoid accidental or fraudulent issues or redeems, an oracle services is required.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Oracles MUST provide a &lt;code&gt;POST reorg&lt;&#x2F;code&gt; REST Endpoint as described in this section&lt;&#x2F;li&gt;
&lt;li&gt;Oracles MUST sign any reorg proposal request where
&lt;ul&gt;
&lt;li&gt;the sum of values in input baskets grouped by tokenId is equal the sum of values of the output baskets grouped by tokenId.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;item.basket&lt;&#x2F;code&gt; hash matches &lt;code&gt;keccak256(abi.encode(data.salt, data.tokenId, data.value))&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The reorg endpoint MUST be stateless&lt;&#x2F;li&gt;
&lt;li&gt;Oracle MUST NOT persist data from the request for later analysis.&lt;&#x2F;li&gt;
&lt;li&gt;The reorg endpoint SHOULD NOT require authentication and can be used by anyone without restrictions.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Endpoint: POST reorg&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PostData:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  in: [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      basket: keccak256(abi.encode(salt, tokenId, value)),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      data: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        salt: &amp;lt;bytes32&amp;gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        tokenId: &amp;lt;bytes32&amp;gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        value: &amp;lt;uint256&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ],&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  out: [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      basket: keccak256(abi.encode(salt, tokenId, value)),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      data: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        salt: &amp;lt;bytes32&amp;gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        tokenId: &amp;lt;bytes32&amp;gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        value: &amp;lt;uint256&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Response: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; hash is signed with oracles private key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; basketsIn and basketsIn are bytes32[]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signature: sign(keccak256(abi.encode(basketsIn, basketsOut)))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Example for valid reorg requests (salt and hashes are omitted for better readability):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;in : (..., token1, 10), (..., token1, 30), (..., token2, 5), (..., token2, 95)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;out: (..., token1, 40), (..., token2, 100)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;in : (..., token1, 40), (..., token2, 100)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;out: (..., token1, 10), (..., token1, 30), (..., token2, 5), (..., token2, 95)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;overlaying-noise-differential-privacy&quot;&gt;Overlaying Noise (Differential Privacy)&lt;&#x2F;h3&gt;
&lt;p&gt;To further enhance privacy and obscure transaction details, an additional layer of noise need to be introduced through reorgs and empty transfers. For example, received baskets can be reorganized into new baskets to prevent information leakage to the previous owner. Additionally, null-value baskets can be sent to random receivers (empty transfers), making it difficult for observers to determine who is transferring to whom.&lt;&#x2F;p&gt;
&lt;p&gt;Example with reorg and null-value basket transfers:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;A owns basket-a1{..., value:10}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;B owns basket-b1{..., value:5}, basket-b2{..., value:15}, ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;A: transfer basket-a1 to B&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;B: reorg [basket-a1, basket-b1, basket-b2]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      to [basket-b3{..., value:10}, basket-b4{..., value:10}, basket-b5:{..., value:10},&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            basket-b6:{..., value:0}, basket-b7:{..., value:0}]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      where sum of inputs is the sum of outputs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;B: transfer basket-b5{value:10} to C&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;B: transfer basket-b6{value:0}  to D&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;B: transfer basket-b7{value:0}  to E&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;If B would directly send basket-a1 to C, A would know what C is receiving, however, now that B has reorg&#x27;ed the baskets, A can not know anymore what has been sent to C.&lt;&#x2F;p&gt;
&lt;p&gt;Moreover, observers still see who is communicating with whom, but since there is noise introduced, they can not tell which of these transfers are actually transferring real values.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;breaking-the-erc-20-compatibility&quot;&gt;Breaking the ERC-20 Compatibility&lt;&#x2F;h3&gt;
&lt;p&gt;The transparency inherent in ERC-20 tokens presents a significant issue for reusable blockchain identities. To address this, we prioritize privacy over ERC-20 compatibility, ensuring the confidentiality of token balances.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;reorg-oracles&quot;&gt;Reorg Oracles&lt;&#x2F;h3&gt;
&lt;p&gt;The trusted oracles and the minimum number of required signatures can be configured to achieve the desired level of decentralization.&lt;&#x2F;p&gt;
&lt;p&gt;The basket holder proposes the input and output baskets for the reorg, while the oracles are responsible for verifying that the sums of the values on both sides (input and output) are equal. This system allows for mutual control, ensuring that no single party can manipulate the process.&lt;&#x2F;p&gt;
&lt;p&gt;Fraudulent oracles can be tracked back on-chain, i.e., the system ensures weak-integrity at minimum.&lt;&#x2F;p&gt;
&lt;p&gt;To further strengthen the integrity, it would also be possible to apply Zero-Knowledge Proofs (ZKP) to provide reorg proofs, however, we have chosen to use oracles for efficiency and simplicity reasons.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;off-chain-data-storage&quot;&gt;Off-chain Data Storage&lt;&#x2F;h3&gt;
&lt;p&gt;We have chosen the token operator, which in most cases will be the issuer or registrar, as the initial and main source for off-chain data. This is acceptable, since they must know anyway which investor holds which positions to manage lifecycle events on the token. While this approach may not be suitable for every use case within the broader Ethereum ecosystem, it fits well the financial instruments in the regulated environment of the financial industry, which rely on strict KYC and token operation procedures.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Opaque Token is not compatible with ERC-20 for reasons explained in the Rationale section.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;fraudulent-oracles&quot;&gt;Fraudulent Oracles&lt;&#x2F;h3&gt;
&lt;!-- TODO --&gt;
&lt;h3 id=&quot;oracles-collecting-confidential-data&quot;&gt;Oracles Collecting Confidential Data&lt;&#x2F;h3&gt;
&lt;!-- TODO --&gt;
&lt;h3 id=&quot;confidential-data-loss&quot;&gt;Confidential Data Loss&lt;&#x2F;h3&gt;
&lt;!-- TODO --&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Authorize Operator</title>
        <published>2024-06-03T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Jeroen Offerijns</name><uri>https://github.com/hieronx</uri>
	</author>
	
	<author>
		<name>João Martins</name><uri>https://github.com/0xTimepunk</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7741/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7741-authorize-operator/20531" />
        

        <id>https://wg-eips.ritovision.com/7741/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7741"
            label="ERC-7741" />
        

        
        

        
        <summary type="html">Set Operator via EIP-712 secp256k1 signatures</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7741/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;A set of functions to enable meta-transactions and atomic interactions with contracts implementing an operator model, via signatures conforming to the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; typed message signing specification.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The primary motivation for this standard is to enhance the flexibility, security, and efficiency of operator management. By leveraging EIP-712 signatures, this standard allows users to authorize operators without the need for on-chain transactions, reducing gas costs and improving user experience. This is particularly beneficial whenever frequent operator changes and cross-chain interactions are required.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, this standard aims to:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Enable Meta-Transactions&lt;&#x2F;strong&gt;: Allow users to delegate the execution of transactions to operators, enabling meta-transactions where the user does not need to hold native tokens to pay for gas fees on each chain.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Improve Security&lt;&#x2F;strong&gt;: Utilize the EIP-712 standard for typed data signing, which provides a more secure and user-friendly way to sign messages compared to raw data signing.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Facilitate Interoperability&lt;&#x2F;strong&gt;: Provide a standardized interface for operator management that can be adopted across various vault protocols, promoting interoperability and reducing integration complexity for developers.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Streamline Cross-Chain Operations&lt;&#x2F;strong&gt;: Simplify the process of managing operators across different chains, making it easier for protocols to maintain consistent operator permissions and interactions in a multi-chain environment.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;By addressing these needs, the &lt;code&gt;Authorize Operator&lt;&#x2F;code&gt; standard aims to streamline the process of managing operators in decentralized vault protocols, making it easier for users and developers to interact with smart contracts in a secure, cost-effective, and interoperable manner across multiple blockchain networks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;operator-compatible-contracts&quot;&gt;Operator-compatible contracts&lt;&#x2F;h3&gt;
&lt;p&gt;This signed authorization scheme applies to any contracts implementing the following interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IOperator&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OperatorSet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approved&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setOperator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approved&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isOperator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; status&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6909&#x2F;&quot;&gt;EIP-6909&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7540&#x2F;&quot;&gt;EIP-7540&lt;&#x2F;a&gt; already implement this interface.&lt;&#x2F;p&gt;
&lt;p&gt;The naming of the arguments is interchangeable, e.g. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6909&#x2F;&quot;&gt;EIP-6909&lt;&#x2F;a&gt; uses &lt;code&gt;spender&lt;&#x2F;code&gt; instead of &lt;code&gt;operator&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;methods&quot;&gt;Methods&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;authorizeoperator&quot;&gt;&lt;code&gt;authorizeOperator&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Grants or revokes permissions for &lt;code&gt;operator&lt;&#x2F;code&gt; to manage Requests on behalf of the &lt;code&gt;msg.sender&lt;&#x2F;code&gt;, using an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; signature.&lt;&#x2F;p&gt;
&lt;p&gt;MUST revert if the &lt;code&gt;deadline&lt;&#x2F;code&gt; has passed.&lt;&#x2F;p&gt;
&lt;p&gt;MUST invalidate the nonce of the signature to prevent message replay.&lt;&#x2F;p&gt;
&lt;p&gt;MUST revert if the &lt;code&gt;signature&lt;&#x2F;code&gt; is not a valid &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; signature, with the given input parameters.&lt;&#x2F;p&gt;
&lt;p&gt;MUST set the operator status to the &lt;code&gt;approved&lt;&#x2F;code&gt; value.&lt;&#x2F;p&gt;
&lt;p&gt;MUST log the &lt;code&gt;OperatorSet&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;p&gt;MUST return &lt;code&gt;true&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uthorizeOperator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;onpayable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; o&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;wner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; o&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;perator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;pproved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ool&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;once&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ytes32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; d&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eadline&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ignature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uccess&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ool&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;invalidatenonce&quot;&gt;&lt;code&gt;invalidateNonce&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Revokes the given &lt;code&gt;nonce&lt;&#x2F;code&gt; for &lt;code&gt;msg.sender&lt;&#x2F;code&gt; as the &lt;code&gt;owner&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;nvalidateNonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;onpayable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;once&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ytes32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;authorizations&quot;&gt;&lt;code&gt;authorizations&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Returns whether the given &lt;code&gt;nonce&lt;&#x2F;code&gt; has been used for the &lt;code&gt;controller&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uthorizations&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;onpayable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ontroller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;once&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ytes32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;sed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ool&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;domain-separator&quot;&gt;&lt;code&gt;DOMAIN_SEPARATOR&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Returns the &lt;code&gt;DOMAIN_SEPARATOR&lt;&#x2F;code&gt; as defined according to EIP-712. The &lt;code&gt;DOMAIN_SEPARATOR&lt;&#x2F;code&gt; should be unique to the contract and chain to prevent replay attacks from other domains, and satisfy the requirements of EIP-712, but is otherwise unconstrained.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; D&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;OMAIN_SEPARATOR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;onpayable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ytes32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;erc-165-support&quot;&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; support&lt;&#x2F;h3&gt;
&lt;p&gt;Smart contracts implementing this standard MUST implement the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;p&gt;Contracts MUST return the constant value &lt;code&gt;true&lt;&#x2F;code&gt; if &lt;code&gt;0xa9e50872&lt;&#x2F;code&gt; is passed through the &lt;code&gt;interfaceID&lt;&#x2F;code&gt; argument.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;similarity-to-erc-2612&quot;&gt;Similarity to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2612&#x2F;&quot;&gt;ERC-2612&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The specification is intentionally designed to closely match &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2612&#x2F;&quot;&gt;ERC-2612&lt;&#x2F;a&gt;. This should simplify new integrations of the standard.&lt;&#x2F;p&gt;
&lt;p&gt;The main difference is using &lt;code&gt;bytes32&lt;&#x2F;code&gt; vs &lt;code&gt;uint256&lt;&#x2F;code&gt;, which enables unordered nonces.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This code snippet is incomplete pseudocode used for example only and is no way intended to be used in production or guaranteed to be secure&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; AUTHORIZE_OPERATOR_TYPEHASH &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;AuthorizeOperator(address controller,address operator,bool approved,bytes32 nonce,uint256 deadline)&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; owner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt; nonce &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt; used&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; authorizations&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DOMAIN_SEPARATOR&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; EIP-712 implementation &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isValidSignature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; digest&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; valid&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-1271 implementation &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; authorizeOperator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; controller&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approved&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; deadline&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; deadline&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC7540Vault&#x2F;expired&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;controller &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC7540Vault&#x2F;invalid-controller&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;authorizations&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;controller&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;nonce&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC7540Vault&#x2F;authorization-used&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        authorizations&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;controller&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;nonce&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; digest &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;                &amp;quot;\x19\x01&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;                DOMAIN_SEPARATOR&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;AUTHORIZE_OPERATOR_TYPEHASH&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; controller&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; approved&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; deadline&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;SignatureLib&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isValidSignature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;controller&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; digest&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC7540Vault&#x2F;invalid-authorization&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        isOperator&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;controller&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;operator&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; approved&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OperatorSet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;controller&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; approved&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        success &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; invalidateNonce&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        authorizations&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;nonce&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Operators have significant control over users and the signed message can lead to undesired outcomes. The expiration date should be set as short as feasible to reduce the chance of an unused signature leaking at a later point.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Readable Typed Signatures for Smart Accounts</title>
        <published>2024-05-28T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>vectorized</name><uri>https://github.com/vectorized</uri>
	</author>
	
	<author>
		<name>Sihoon Lee</name><uri>https://github.com/push0ebp</uri>
	</author>
	
	<author>
		<name>Francisco Giordano</name><uri>https://github.com/frangio</uri>
	</author>
	
	<author>
		<name>Hadrien Croubois</name><uri>https://github.com/Amxx</uri>
	</author>
	
	<author>
		<name>Ernesto García</name><uri>https://github.com/ernestognw</uri>
	</author>
	
	<author>
		<name>Im Juno</name><uri>https://github.com/junomonster</uri>
	</author>
	
	<author>
		<name>howydev</name><uri>https://github.com/howydev</uri>
	</author>
	
	<author>
		<name>Atarpara</name><uri>https://github.com/Atarpara</uri>
	</author>
	
	<author>
		<name>0xcuriousapple</name><uri>https://github.com/0xcuriousapple</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7739/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7739-readable-typed-signatures-for-smart-accounts/20513" />
        

        <id>https://wg-eips.ritovision.com/7739/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7739"
            label="ERC-7739" />
        

        
        

        
        <summary type="html">A defensive rehashing scheme which prevents signature replays across smart accounts and preserves the readability of the signed contents</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7739/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal defines a standard to prevent signature replays across multiple smart accounts when they are owned by a single Externally Owned Account (EOA). This is achieved through a defensive rehashing scheme for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;ERC-1271&lt;&#x2F;a&gt; verification using specific nested &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; typed structures, which preserves the readability of the signed contents during wallet client signature requests.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Smart accounts can verify signatures with via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;ERC-1271&lt;&#x2F;a&gt; using the &lt;code&gt;isValidSignature&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;p&gt;A straightforward implementation as shown below, is vulnerable to signature replay attacks.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This implementation is NOT safe.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isValidSignature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint8&lt;&#x2F;span&gt;&lt;span&gt; v &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint8&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;64&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt; s&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;decode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Reject malleable signatures.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;s&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; signer &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; ecrecover&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; s&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Reject failed recovery.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signer &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `owner` is a storage variable containing the smart account&amp;#39;s owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;signer &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x1626ba7e&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xffffffff&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;When multiple smart accounts are owned by a single EOA, the same signature can be replayed across the smart accounts if the &lt;code&gt;hash&lt;&#x2F;code&gt; does not include the smart account address.&lt;&#x2F;p&gt;
&lt;p&gt;Unfortunately, this is the case for many popular applications (e.g. Permit2). As such, many smart account implementations perform some form of defensive rehashing. First, the smart account computes a final hash from minimally: (1) the hash, (2) its own address, (3) the chain ID. Then, the smart account verifies the final hash against the signature. Defensive rehashing can be implemented with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt;, but a straightforward implementation will make the signed contents opaque.&lt;&#x2F;p&gt;
&lt;p&gt;This standard provides a defensive rehashing scheme that makes the signed contents visible across all wallet clients that support &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt;. It is designed for minimal adoption friction. Even if wallet clients or application frontends are not updated, users can still inject client side JavaScript to enable the defensive rehashing.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;overview&quot;&gt;Overview&lt;&#x2F;h3&gt;
&lt;p&gt;The following dependencies are REQUIRED:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; Typed structured data hashing and signing.&lt;br &#x2F;&gt;
Provides the relevant typed data hashing logic internally, which is required to construct the final hashes.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;ERC-1271&lt;&#x2F;a&gt; Standard Signature Validation Method for Contracts.&lt;br &#x2F;&gt;
Provides the &lt;code&gt;isValidSignature(bytes32 hash, bytes calldata signature)&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5267&#x2F;&quot;&gt;ERC-5267&lt;&#x2F;a&gt; Retrieval of EIP-712 domain.&lt;br &#x2F;&gt;
Provides the &lt;code&gt;eip712Domain()&lt;&#x2F;code&gt; function which is required to compute the final hashes.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This standard defines the behavior of the &lt;code&gt;isValidSignature&lt;&#x2F;code&gt; function for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;ERC-1271&lt;&#x2F;a&gt;, which comprises of two workflows: (1) the &lt;code&gt;TypedDataSign&lt;&#x2F;code&gt; workflow, (2) the &lt;code&gt;PersonalSign&lt;&#x2F;code&gt; workflow.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;typeddatasign-workflow&quot;&gt;&lt;code&gt;TypedDataSign&lt;&#x2F;code&gt; workflow&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;TypedDataSign&lt;&#x2F;code&gt; workflow handles the case where the &lt;code&gt;hash&lt;&#x2F;code&gt; is originally computed with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;typeddatasign-final-hash&quot;&gt;&lt;code&gt;TypedDataSign&lt;&#x2F;code&gt; final hash&lt;&#x2F;h4&gt;
&lt;p&gt;The final hash for the &lt;code&gt;TypedDataSign&lt;&#x2F;code&gt; workflow is defined as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;keccak256(\x19\x01 ‖ APP_DOMAIN_SEPARATOR ‖&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    hashStruct(TypedDataSign({&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        contents: hashStruct(originalStruct),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        name: eip712Domain().name,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        version: eip712Domain().version,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        chainId: eip712Domain().chainId,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        verifyingContract: eip712Domain().verifyingContract,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        salt: eip712Domain().salt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where &lt;code&gt;‖&lt;&#x2F;code&gt; denotes the concatenation operator for bytes.&lt;&#x2F;p&gt;
&lt;p&gt;In Solidity, this can be written as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;finalTypedDataSignHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;1901&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Application specific domain separator. Passed via `signature`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;APP_DOMAIN_SEPARATOR&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;                abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;                    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Computed on-the-fly with `contentsType`, which is passed via `signature`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    typedDataSignTypehash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;                    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This is the `contents` struct hash, which is passed via `signature`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;hashStruct&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;originalStruct&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;                    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `eip712Domain()` is from ERC-5267. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;eip712Domain&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;name&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;eip712Domain&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;version&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;eip712Domain&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;chainId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint160&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;eip712Domain&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;verifyingContract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;eip712Domain&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;salt&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where &lt;code&gt;typedDataSignTypehash&lt;&#x2F;code&gt; is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;typedDataSignTypehash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;          abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;              &amp;quot;TypedDataSign(&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                  contentsName&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot; contents,&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;                  &amp;quot;string name,&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;                  &amp;quot;string version,&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;                  &amp;quot;uint256 chainId,&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;                  &amp;quot;address verifyingContract,&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;                  &amp;quot;bytes32 salt&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;              &amp;quot;)&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              contentsType&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;If &lt;code&gt;contentsType&lt;&#x2F;code&gt; is &lt;code&gt;&quot;Mail(address from,address to,string message)&quot;&lt;&#x2F;code&gt;, then &lt;code&gt;contentsName&lt;&#x2F;code&gt; will be &lt;code&gt;&quot;Mail&quot;&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;contentsName&lt;&#x2F;code&gt; is the substring of &lt;code&gt;contentsType&lt;&#x2F;code&gt; up to (excluding) the first instance of &lt;code&gt;&quot;(&quot;&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;p&gt;In Solidity, this can be written as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `slice(string memory subject, uint256 start, uint256 end)` &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; returns a copy of `subject` sliced from `start` to `end` (exclusive).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `start` and `end` are byte offsets.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `indexOf(string memory subject, string memory search)`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the byte index of the first location of `search` in `subject`,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; searching from left to right. Returns `2**256 - 1` if `search` is not found.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;contentsName &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    LibString&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;slice&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        contentsType&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Start byte index.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        LibString&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;indexOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;contentsType&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;(&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; End byte index (exclusive).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7739&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;utils&#x2F;LibString.sol&quot;&gt;A copy of the &lt;code&gt;LibString&lt;&#x2F;code&gt; Solidity library is provided for completeness&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;For safety, it is RECOMMENDED to treat the signature as invalid if any of the following is true:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;contentsName&lt;&#x2F;code&gt; is the empty string (i.e. &lt;code&gt;bytes(contentsName).length == 0&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;contentsName&lt;&#x2F;code&gt; starts with any of the following bytes &lt;code&gt;abcdefghijklmnopqrstuvwxyz(&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;contentsName&lt;&#x2F;code&gt; contains any of the following bytes &lt;code&gt;, )\x00&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;typeddatasign-signature&quot;&gt;&lt;code&gt;TypedDataSign&lt;&#x2F;code&gt; signature&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;signature&lt;&#x2F;code&gt; passed into &lt;code&gt;isValidSignature&lt;&#x2F;code&gt; will be changed to:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;originalSignature ‖ APP_DOMAIN_SEPARATOR ‖ contents ‖ contentsDescription ‖ uint16(contentsDescription.length)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;contents&lt;&#x2F;code&gt; is the bytes32 struct hash of the original struct.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;contentsDescription&lt;&#x2F;code&gt; is either:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;contentsType&lt;&#x2F;code&gt; (implicit mode),&lt;br &#x2F;&gt;
where &lt;code&gt;contentsType&lt;&#x2F;code&gt; starts with &lt;code&gt;contentsName&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;contentsType ‖ contentsName&lt;&#x2F;code&gt; (explicit mode),&lt;br &#x2F;&gt;
where &lt;code&gt;contentsType&lt;&#x2F;code&gt; may not necessarily start with &lt;code&gt;contentsName&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In Solidity, this can be written as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;signature &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;    abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;originalSignature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;APP_DOMAIN_SEPARATOR&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;contents&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;contentsDescription&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint16&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;contentsDescription&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The appended &lt;code&gt;APP_DOMAIN_SEPARATOR&lt;&#x2F;code&gt; and &lt;code&gt;contents&lt;&#x2F;code&gt; struct hash will be used to verify if the &lt;code&gt;hash&lt;&#x2F;code&gt; passed into &lt;code&gt;isValidSignature&lt;&#x2F;code&gt; is indeed correct via:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;hash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;    abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;1901&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;APP_DOMAIN_SEPARATOR&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;contents&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;If the &lt;code&gt;hash&lt;&#x2F;code&gt; does not match the reconstructed hash, then the &lt;code&gt;hash&lt;&#x2F;code&gt; and &lt;code&gt;signature&lt;&#x2F;code&gt; are invalid under the &lt;code&gt;TypedDataSign&lt;&#x2F;code&gt; workflow.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;personalsign-workflow&quot;&gt;&lt;code&gt;PersonalSign&lt;&#x2F;code&gt; workflow&lt;&#x2F;h3&gt;
&lt;p&gt;This &lt;code&gt;PersonalSign&lt;&#x2F;code&gt; workflow handles the case where the &lt;code&gt;hash&lt;&#x2F;code&gt; is originally computed with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;191&#x2F;&quot;&gt;EIP-191&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;personalsign-final-hash&quot;&gt;&lt;code&gt;PersonalSign&lt;&#x2F;code&gt; final hash&lt;&#x2F;h4&gt;
&lt;p&gt;The final hash for the &lt;code&gt;PersonalSign&lt;&#x2F;code&gt; workflow is defined as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;keccak256(\x19\x01 ‖ ACCOUNT_DOMAIN_SEPARATOR ‖&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    hashStruct(PersonalSign({&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        prefixed: keccak256(bytes(\x19Ethereum Signed Message:\n ‖&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        base10(bytes(someString).length) ‖ someString))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where &lt;code&gt;‖&lt;&#x2F;code&gt; denotes the concatenation operator for bytes.&lt;&#x2F;p&gt;
&lt;p&gt;In Solidity, this can be written as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;finalPersonalSignHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;1901&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Smart account domain separator.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Can be computed via `eip712Domain()` from ERC-5267.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ACCOUNT_DOMAIN_SEPARATOR&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;                abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;                    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `PERSONAL_SIGN_TYPEHASH`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;PersonalSign(bytes prefixed)&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;                    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `hash` is from `isValidSignature(hash, signature)`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Here, &lt;code&gt;hash&lt;&#x2F;code&gt; is computed in the application contract and passed into &lt;code&gt;isValidSignature&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The smart account does not need to know how &lt;code&gt;hash&lt;&#x2F;code&gt; is computed. For completeness, this is how it can be computed:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;hash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;    abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        &amp;quot;\x19Ethereum Signed Message:\n&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `toString` returns the base10 representation of a uint256.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        LibString&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;toString&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;someString&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This is the original message to be signed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        someString&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;personalsign-signature&quot;&gt;&lt;code&gt;PersonalSign&lt;&#x2F;code&gt; signature&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;PersonalSign&lt;&#x2F;code&gt; workflow does not require additional data to be appended to the &lt;code&gt;signature&lt;&#x2F;code&gt; passed into &lt;code&gt;isValidSignature&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;support-detection&quot;&gt;Support detection&lt;&#x2F;h3&gt;
&lt;p&gt;Smart accounts SHOULD return &lt;code&gt;bytes4(0x77390001)&lt;&#x2F;code&gt; for &lt;code&gt;isValidSignature(0x7739773977397739773977397739773977397739773977397739773977397739, &quot;&quot;)&lt;&#x2F;code&gt; to indicate support for this standard.&lt;&#x2F;p&gt;
&lt;p&gt;The magic number &lt;code&gt;bytes4(0x77390001)&lt;&#x2F;code&gt; MAY be incremented if this standard gets updated.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;signature-verification-workflow-deduction&quot;&gt;Signature verification workflow deduction&lt;&#x2F;h3&gt;
&lt;p&gt;As the &lt;code&gt;isValidSignature&lt;&#x2F;code&gt; signature function signature is unchanged, the implementation MUST be able to deduce the type of workflow required to verify the signature.&lt;&#x2F;p&gt;
&lt;p&gt;If the signature contains the correct data to reconstruct the &lt;code&gt;hash&lt;&#x2F;code&gt;, the &lt;code&gt;isValidSignature&lt;&#x2F;code&gt; function MUST perform the &lt;code&gt;TypedDataSign&lt;&#x2F;code&gt; workflow.
Otherwise, the &lt;code&gt;isValidSignature&lt;&#x2F;code&gt; function MUST perform the &lt;code&gt;PersonalSign&lt;&#x2F;code&gt; workflow.&lt;&#x2F;p&gt;
&lt;p&gt;In Solidity, the check can be written as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If this is true, it means that the `signature` contains &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the correct `APP_DOMAIN_SEPARATOR` and `contents`,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; and the `TypedDataSign` workflow MUST be performed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Otherwise, the `PersonalSign` workflow MUST be performed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;hash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;    abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;1901&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;APP_DOMAIN_SEPARATOR&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;contents&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;conditional-skipping-of-defensive-rehashing&quot;&gt;Conditional skipping of defensive rehashing&lt;&#x2F;h3&gt;
&lt;p&gt;Smart accounts MAY skip the defensive rehashing workflows if any of the following is true:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;isValidSignature&lt;&#x2F;code&gt; is called off-chain.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;hash&lt;&#x2F;code&gt; passed into &lt;code&gt;isValidSignature&lt;&#x2F;code&gt; has already included the address of the smart account.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;As many developers may not update their applications to support the nested EIP-712 workflow, smart account implementations SHOULD try to accommodate by skipping the defensive rehashing where it is safe to do so.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;typeddatasign-structure&quot;&gt;&lt;code&gt;TypedDataSign&lt;&#x2F;code&gt; structure&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;typedDataSignTypehash&lt;&#x2F;code&gt; must be constructed on-the-fly on-chain. This is to enforce that the signed contents will be visible in the signature request, by requiring that &lt;code&gt;contents&lt;&#x2F;code&gt; be a user defined type.&lt;&#x2F;p&gt;
&lt;p&gt;The fields of &lt;code&gt;eip712Domain&lt;&#x2F;code&gt; are flattened into the &lt;code&gt;TypedDataSign&lt;&#x2F;code&gt; structure instead of being included as a field of type &lt;code&gt;EIP712Domain&lt;&#x2F;code&gt; in order to avoid a conflict with the domain type of the verifying contract in case it&#x27;s different.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;bytes1 fields&lt;&#x2F;code&gt; bitmap and &lt;code&gt;uint256[] extensions&lt;&#x2F;code&gt; array in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5267&#x2F;&quot;&gt;ERC-5267&lt;&#x2F;a&gt; have been omitted. Differentiating between an absent field versus a zero field (e.g. &lt;code&gt;bytes32(0)&lt;&#x2F;code&gt;) offers no additional security benefits for on-chain defensive rehashing. The &lt;code&gt;extensions&lt;&#x2F;code&gt; parameter is a list of EIP numbers used for off-chain signaling.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;contentsdescription-with-implicit-and-explicit-modes&quot;&gt;&lt;code&gt;contentsDescription&lt;&#x2F;code&gt; with implicit and explicit modes&lt;&#x2F;h3&gt;
&lt;p&gt;When the &lt;code&gt;contents&lt;&#x2F;code&gt; structure contains nested types, EIP-712 lexicographical sorting can result in the &lt;code&gt;contentsName&lt;&#x2F;code&gt; not being positioned exactly at the start of the &lt;code&gt;contentsType&lt;&#x2F;code&gt;. As such, we need the explicit mode.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;support-detection-with-isvalidsignature&quot;&gt;Support detection with &lt;code&gt;isValidSignature&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;For easier implementation in modular smart accounts, we have decided to utilize the &lt;code&gt;isValidSignature&lt;&#x2F;code&gt; method to return a magic number instead of defining new functions.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;rejecting-contentsname-beginning-with-any-lowercase-7-bit-ascii-character&quot;&gt;Rejecting &lt;code&gt;contentsName&lt;&#x2F;code&gt; beginning with any lowercase 7-bit ASCII character&lt;&#x2F;h3&gt;
&lt;p&gt;This recommendation is to keep the standard language agnostic and future-proof. Atomic types such as &lt;code&gt;uint256&lt;&#x2F;code&gt; may be named differently in other languages (e.g. &lt;code&gt;u256&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;detection-of-previous-draft&quot;&gt;Detection of previous draft&lt;&#x2F;h3&gt;
&lt;p&gt;In an earlier draft, we have designated a &lt;code&gt;supportsNestedTypedDataSign()&lt;&#x2F;code&gt; function for support detection, which returns &lt;code&gt;bytes4(0xd620c85a)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7739&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;accounts&#x2F;ERC1271.sol&quot;&gt;A production ready and optimized implementation is provided for reference&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;It includes relevant complementary features required for safety, flexibility, developer experience, and user experience.&lt;&#x2F;p&gt;
&lt;p&gt;The reference implementation is intentionally not minimalistic. This is to avoid repeating the mistake of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;ERC-1271&lt;&#x2F;a&gt;, where a minimalist reference implementation is wrongly assumed to be safe for production use.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;rejecting-invalid-contentsname&quot;&gt;Rejecting invalid &lt;code&gt;contentsName&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Current major implementations of &lt;code&gt;eth_signTypedData&lt;&#x2F;code&gt; do not sanitize the names of custom types.&lt;&#x2F;p&gt;
&lt;p&gt;A phishing website can craft a &lt;code&gt;contentsName&lt;&#x2F;code&gt; with control characters to break out of the &lt;code&gt;PersonalSign&lt;&#x2F;code&gt; type encoding, resulting in the wallet client asking the user to sign an opaque hash.&lt;&#x2F;p&gt;
&lt;p&gt;Requiring on-chain sanitization of &lt;code&gt;contentsName&lt;&#x2F;code&gt; will block this phishing attack vector.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;impossible-to-chain-multiple-signers-of-this-kind&quot;&gt;Impossible to chain multiple signers of this kind&lt;&#x2F;h3&gt;
&lt;p&gt;An account that uses this method as replay protection for ERC-1271 signatures cannot have a signer that uses the same method. This is because a signature defines a &lt;code&gt;TypedDataSign&lt;&#x2F;code&gt; struct type with a member that has the type of the message being signed, and if the message being signed is another &lt;code&gt;TypedDataSign&lt;&#x2F;code&gt; struct, the resulting EIP-712 message will contain in its body two separate &lt;code&gt;TypedDataSign&lt;&#x2F;code&gt; types with incompatible contents, something that can&#x27;t be represented in an EIP-712 request.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Anti-correlation attestation penalties</title>
        <published>2024-05-25T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>dapplion</name><uri>https://github.com/dapplion</uri>
	</author>
	
	<author>
		<name>Toni Wahrstätter</name><uri>https://github.com/nerolation</uri>
	</author>
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7716/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7716-anti-correlation-attestation-penalties/20137" />
        

        <id>https://wg-eips.ritovision.com/7716/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7716"
            label="EIP-7716" />
        

        
        

        
        <summary type="html">Adjust penalties for missed attestations based on in-slot correlation of missed attestation</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7716/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The decentralization of the validator set is one of the most important properties of Ethereum for credible neutrality and censorship resistance. By adjusting penalties to foster decentralization, diversification and fault-tolerance, this EIP proposes to adjust penalties in a way that more diversified entities get lower penalties while entities with high correlations in their setup face more severe ones.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;As of now, during times of usual network operation, there are no economic incentives to diversify node operations through using multiple different nodes, geographical locations, clients, ISP providers, etc., except for reducing the risk of penalties affecting all validators simultaneously, thereby limiting the impact to only a fraction of them.&lt;&#x2F;p&gt;
&lt;p&gt;Attestation penalties are currently agnostic to other participation actions. This proposal scales attestation penalties as a function of other participants&#x27; actions. The goal is to decrease the profitability of participants that exhibit correlated behavior.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;PENALTY_ADJUSTMENT_FACTOR&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;4096&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_PENALTY_FACTOR&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;4&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Add a variable &lt;code&gt;NET_EXCESS_PENALTIES&lt;&#x2F;code&gt; to the beacon state.&lt;&#x2F;p&gt;
&lt;p&gt;Let &lt;code&gt;penalty_factor&lt;&#x2F;code&gt; be determined through&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;min(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (non_attesting_balance * PENALTY_ADJUSTMENT_FACTOR) &#x2F;&#x2F; (NET_EXCESS_PENALTIES * total_active_balance + 1), &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    MAX_PENALTY_FACTOR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Let &lt;code&gt;NET_EXCESS_PENALTIES&lt;&#x2F;code&gt; be &lt;code&gt;max(1, NET_EXCESS_PENALTIES + penalty_factor) - 1&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;penalty-adjustment-factor&quot;&gt;PENALTY_ADJUSTMENT_FACTOR&lt;&#x2F;h3&gt;
&lt;p&gt;This variable impacts the sensitivity of the &lt;code&gt;NET_EXCESS_PENALTIES&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Given stable participation, the &lt;code&gt;penalty_factor&lt;&#x2F;code&gt; is one.
If participation decreases, the &lt;code&gt;penalty_factor&lt;&#x2F;code&gt; will temporarily increase above one until &lt;code&gt;net_excess_penalties&lt;&#x2F;code&gt; catches up.
If participation increases, the &lt;code&gt;penalty_factor&lt;&#x2F;code&gt; will temporarily be zero until &lt;code&gt;net_excess_penalties&lt;&#x2F;code&gt; catches up.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;PENALTY_ADJUSTMENT_FACTOR&lt;&#x2F;code&gt; regulates how fast &lt;code&gt;net_excess_penalties&lt;&#x2F;code&gt; catches up.
In other words, the &lt;code&gt;PENALTY_ADJUSTMENT_FACTOR&lt;&#x2F;code&gt; determines the frequency that the penalty_factor is not one.&lt;&#x2F;p&gt;
&lt;p&gt;A high &lt;code&gt;PENALTY_ADJUSTMENT_FACTOR&lt;&#x2F;code&gt; causes the &lt;code&gt;net_excess_penalties&lt;&#x2F;code&gt; to adjust slower.
A low &lt;code&gt;PENALTY_ADJUSTMENT_FACTOR&lt;&#x2F;code&gt; causes the &lt;code&gt;net_excess_penalties&lt;&#x2F;code&gt; to react more sensitively to changes in participation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;max-penalty-factor&quot;&gt;&lt;code&gt;MAX_PENALTY_FACTOR&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;MAX_PENALTY_FACTOR&lt;&#x2F;code&gt; puts a ceiling onto the maximum factor with which the penalty for missed attestations is scaled to prevent overly harsh punishments.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This is a backwards incompatible adjustment of attestations rewards and penalties that requires a scheduled network upgrade.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;We acknowledge that splitting validator views can be leveraged as an attack to increase the &lt;code&gt;penalty_factor&lt;&#x2F;code&gt; for validators of consecutive slots with little risk for the proposer.
TBD.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Request Permissions from Wallets</title>
        <published>2024-05-24T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Luka Isailovic</name><uri>https://github.com/lukaisailovic</uri>
	</author>
	
	<author>
		<name>Derek Rein</name><uri>https://github.com/arein</uri>
	</author>
	
	<author>
		<name>Dan Finlay</name><uri>https://github.com/danfinlay</uri>
	</author>
	
	<author>
		<name>Derek Chiang</name><uri>https://github.com/derekchiang</uri>
	</author>
	
	<author>
		<name>Fil Makarov</name><uri>https://github.com/filmakarov</uri>
	</author>
	
	<author>
		<name>Pedro Gomes</name><uri>https://github.com/pedrouid</uri>
	</author>
	
	<author>
		<name>Conner Swenberg</name><uri>https://github.com/ilikesymmetry</uri>
	</author>
	
	<author>
		<name>Lukas Rosario</name><uri>https://github.com/lukasrosario</uri>
	</author>
	
	<author>
		<name>Idris Bowman</name><uri>https://github.com/V00D00-child</uri>
	</author>
	
	<author>
		<name>Jeff Smale</name><uri>https://github.com/jeffsmale90</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7715/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7715-grant-permissions-from-wallets/20100" />
        

        <id>https://wg-eips.ritovision.com/7715/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:7715"
            label="ERC-7715" />
        

        
        

        
        <summary type="html">Adds JSON-RPC method for requesting permissions from a wallet</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7715/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;We define a new JSON-RPC method &lt;code&gt;wallet_requestExecutionPermissions&lt;&#x2F;code&gt; for DApp to request a Wallet to grant permissions in order to execute transactions on the user’s behalf. This enables two use cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Executing transactions for users without a wallet connection.&lt;&#x2F;li&gt;
&lt;li&gt;Executing transactions for users with a wallet connection that is scoped with permissions.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently most DApps implement a flow similar to the following:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7715&#x2F;.&#x2F;assets&#x2F;approve-flow.svg&quot; alt=&quot;Wallet Approve Flow&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Each interaction requires the user to sign a transaction with their wallet. The problems are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;It can get tedious for the user to manually approve every transaction, especially in highly-interactive applications such as games.&lt;&#x2F;li&gt;
&lt;li&gt;It’s impossible to send transactions for users without an active wallet connection. This invalidates use cases such as subscriptions, passive investments, limit orders, and more.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;permission-types-rule-types&quot;&gt;Permission Types, Rule Types&lt;&#x2F;h3&gt;
&lt;p&gt;This ERC does not specify an exhaustive list of rule or permission types, since we expect more rule and permission types to be developed as wallets get more advanced. A permission type, or rule type is valid as long as both the DApp and the wallet are willing to support it.&lt;&#x2F;p&gt;
&lt;p&gt;However, if two permissions or two rules share the same type name, a DApp could request with one type of permission, or rule while the wallet grants another. Therefore, it’s important that no two permissions, or two rules share the same type. Furthermore, new permission types or rule types should be specified in addition ERCs. In all cases, these new types MUST inherit from the &lt;code&gt;BasePermission&lt;&#x2F;code&gt; or &lt;code&gt;BaseRule&lt;&#x2F;code&gt; scheme.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;permissions&quot;&gt;Permissions&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;isAdjustmentAllowed&lt;&#x2F;code&gt; defines a boolean value that allows DApp to define whether the Wallet MAY attenuate(reduce or increase) the authority of a &quot;permission&quot; to meet the user’s terms for approval.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;For example, a DApp may require an allowance for a specific asset to complete a payment and does not want the user to adjust the requested allowance.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;tsx&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BasePermission&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; enum defined by ERCs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  isAdjustmentAllowed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; boolean&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; whether the wallet MAY attenuate the permission&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Record&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; any&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; specific to the type, structure defined by ERCs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;rules&quot;&gt;Rules&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;tsx&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BaseRule&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; enum defined by ERCs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Record&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; any&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; specific to the type, structure defined by ERCs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Constrains a permission so that it is only valid until a specified timestamp.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ExpiryRule&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BaseRule&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;expiry&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    timestamp&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; number&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; unix timestamp at which the permission becomes invalid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;wallet-requestexecutionpermissions&quot;&gt;&lt;code&gt;wallet_requestExecutionPermissions&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;We introduce a &lt;code&gt;wallet_requestExecutionPermissions&lt;&#x2F;code&gt; method for the DApp to request the Wallet to grant permissions.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;request-specification&quot;&gt;Request Specification&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;tsx&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PermissionRequest&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Hex&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; hex-encoding of uint256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  from&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Address&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  to&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Address&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  permission&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; enum defined by ERCs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    isAdjustmentAllowed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; boolean&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; whether the permission can be adjusted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Record&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; any&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;specific to the type, structure defined by ERCs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  rules&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; enum defined by ERCs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Record&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; any&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; specific to the type, structure defined by ERCs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;chainId&lt;&#x2F;code&gt; defines the chain with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt; which applies to this permission request and all addresses can be found defined by other parameters.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;from&lt;&#x2F;code&gt; identifies the account being targeted for this permission request which is useful when a connection has been established and multiple accounts have been exposed. It is optional to let the user choose which account to grant permission for.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;to&lt;&#x2F;code&gt; is a field that identifies the DApp session account associated with the permission&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;permission&lt;&#x2F;code&gt; defines the allowed behavior the &lt;code&gt;to&lt;&#x2F;code&gt; account can do on behalf of the &lt;code&gt;from&lt;&#x2F;code&gt; account. See the “Permission” section for details.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;rules&lt;&#x2F;code&gt; define the restrictions or conditions that a &lt;code&gt;to&lt;&#x2F;code&gt; account MUST abide by when using a permission to act on behalf of an account. See the “Rule” section for details.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Request example&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;p&gt;An array of &lt;code&gt;PermissionRequest&lt;&#x2F;code&gt; objects is the final &lt;code&gt;params&lt;&#x2F;code&gt; field expected by the &lt;code&gt;wallet_requestExecutionPermissions&lt;&#x2F;code&gt; RPC.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;tsx&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    chainId&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    from&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    to&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x016562aA41A8697720ce0943F003141f5dEAe006&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    permission&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;native-token-allowance&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      isAdjustmentAllowed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        allowance&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1DCD6500&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    rules&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;expiry&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          timestamp&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1577840461&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;response-specification&quot;&gt;Response Specification&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;tsx&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PermissionResponse&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PermissionRequest&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  context&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Hex&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  dependencies&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    factory&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    factoryData&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  delegationManager&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;First note that the response contains all of the parameters of the original request and it is not guaranteed that the values received are equivalent to those requested.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;context&lt;&#x2F;code&gt; is a catch-all to identify a permission for revoking permissions or redeeming permissions, and can contain non-identifying data as well. The &lt;code&gt;context&lt;&#x2F;code&gt; is required as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7710&#x2F;&quot;&gt;ERC-7710&lt;&#x2F;a&gt;. See “Rationale” for details.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;dependencies&lt;&#x2F;code&gt; is an array of objects, each containing fields for &lt;code&gt;factory&lt;&#x2F;code&gt; and &lt;code&gt;factoryData&lt;&#x2F;code&gt; as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt;. Either both &lt;code&gt;factory&lt;&#x2F;code&gt; and &lt;code&gt;factoryData&lt;&#x2F;code&gt; must be specified in an entry, or neither. This array is used describe accounts that are not yet deployed but MUST be deployed in order for a permission to be successfully redeemed. If any of the involved accounts have not yet been deployed, the wallet MUST return the corresponding &lt;code&gt;dependencies&lt;&#x2F;code&gt;. If all accounts have already been deployed, the wallet MUST return an empty &lt;code&gt;dependencies&lt;&#x2F;code&gt; array. The DApp MUST deploy each account by calling the &lt;code&gt;factory&lt;&#x2F;code&gt; contract with &lt;code&gt;factoryData&lt;&#x2F;code&gt; as the calldata.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;delegationManager&lt;&#x2F;code&gt; is required as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7710&#x2F;&quot;&gt;ERC-7710&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;If the request is malformed or the wallet is unable&#x2F;unwilling to grant permissions, wallet MUST return an error with a code as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1193&#x2F;&quot;&gt;ERC-1193&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;wallet_requestExecutionPermissions&lt;&#x2F;code&gt; response example:&lt;&#x2F;p&gt;
&lt;p&gt;An array of &lt;code&gt;PermissionResponse&lt;&#x2F;code&gt; objects is the final &lt;code&gt;result&lt;&#x2F;code&gt; field expected by the &lt;code&gt;wallet_requestExecutionPermissions&lt;&#x2F;code&gt; RPC.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;tsx&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; original request with modifications&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    chainId&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    from&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    to&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x016562aA41A8697720ce0943F003141f5dEAe006&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    permission&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;native-token-allowance&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      isAdjustmentAllowed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        allowance&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1DCD65000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; response-specific fields&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    context&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0x016562aA41A8697720ce0943F003141f5dEAe0060000771577157715&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    dependencies&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        factory&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        factoryData&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    delegationManager&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;wallet-revokeexecutionpermission&quot;&gt;&lt;code&gt;wallet_revokeExecutionPermission&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Permissions can be revoked by calling this method and the wallet will respond with an empty response when successful.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;request-specification-1&quot;&gt;Request Specification&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;tsx&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RevokeExecutionPermissionRequestParams&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  permissionContext&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x{string}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;response-specification-1&quot;&gt;Response Specification&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;tsx&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; GetPermissionsInfoResultParams&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  chainIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;wallet-getsupportedexecutionpermissions&quot;&gt;&lt;code&gt;wallet_getSupportedExecutionPermissions&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;We introduce a &lt;code&gt;wallet_getSupportedExecutionPermissions&lt;&#x2F;code&gt; method for the Wallet to specify the permission types and rules types it supports.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;request-specification-2&quot;&gt;Request Specification&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;Request example&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;tsx&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;window&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;ethereum&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;request&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;method&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;wallet_getSupportedExecutionPermissions&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;Promise&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;GetSupportedExecutionPermissionsResult&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;response-specification-2&quot;&gt;Response Specification&lt;&#x2F;h4&gt;
&lt;p&gt;The wallet SHOULD include an object keyed on supported permission types including &lt;code&gt;ruleTypes&lt;&#x2F;code&gt; (&lt;code&gt;string[]&lt;&#x2F;code&gt;) that can be applied to the permission.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;tsx&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; GetSupportedExecutionPermissionsResult&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Record&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;permission-type&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    chainIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    ruleTypes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Hex chain id&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;An object keyed on all permission types supported by the Wallet expected by the &lt;code&gt;wallet_getSupportedExecutionPermissions&lt;&#x2F;code&gt; RPC.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;native-token-allowance&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x123&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x345&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;rulesTypes&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;expiry&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;erc20-token-allowance&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x123&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;rulesTypes&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;erc721-token-allowance&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x123&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;rulesTypes&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;expiry&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;wallet-getgrantedexecutionpermissions&quot;&gt;&lt;code&gt;wallet_getGrantedExecutionPermissions&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;We introduce a &lt;code&gt;wallet_getGrantedExecutionPermissions&lt;&#x2F;code&gt; method for the DApp to retrieve previously granted permissions.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;request-specification-3&quot;&gt;Request Specification&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;Request example&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;tsx&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;window&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;ethereum&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;request&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;method&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;wallet_getGrantedExecutionPermissions&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;Promise&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;PermissionResponses&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;response-specification-3&quot;&gt;Response Specification&lt;&#x2F;h4&gt;
&lt;p&gt;The wallet MUST include all granted permissions that are not yet revoked.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;tsx&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PermissionResponses&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Example:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;tsx&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    chainId&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    from&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    to&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x016562aA41A8697720ce0943F003141f5dEAe006&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    permission&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;native-token-allowance&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      isAdjustmentAllowed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        allowance&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1DCD65000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    context&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0x016562aA41A8697720ce0943F003141f5dEAe0060000771577157715&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    dependencies&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        factory&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        factoryData&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    delegationManager&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;sending-transaction-to-redeem-permissions&quot;&gt;Sending transaction to redeem permissions&lt;&#x2F;h3&gt;
&lt;p&gt;The permission response data will be redeemable by the &lt;code&gt;account&lt;&#x2F;code&gt; defined in the &lt;code&gt;to&lt;&#x2F;code&gt; field, using the interfaces specified in ERC-7710. This allows the recipient of the permissions to use any account type (EOA or contract) to form a transaction or UserOp using whatever payment or relay infrastructure they prefer, by sending an internal message to the returned &lt;code&gt;permissions.delegationManager&lt;&#x2F;code&gt; and calling its &lt;code&gt;function redeemDelegation(bytes[] calldata _permissionContexts, bytes32[] calldata _modes, bytes[] calldata _executionCallData) external;&lt;&#x2F;code&gt; function with the &lt;code&gt;_permissionContexts&lt;&#x2F;code&gt; parameter set to the returned &lt;code&gt;permissions.context&lt;&#x2F;code&gt;, and the &lt;code&gt;_executionCallData&lt;&#x2F;code&gt; data forming the message that the permissions recipient desires the user&#x27;s account to emit, as defined by this struct:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;struct Execution {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  address target;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  uint256 value;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  bytes callData;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;A simple pseudocode example of using a permission in this way, where DApp wants to request a permission from &lt;code&gt;bob&lt;&#x2F;code&gt; might be like this:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Alice requests a permission from Bob&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; permissionsResponse&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; window&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;ethereum&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;request&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  method&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;wallet_requestExecutionPermissions&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  params&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    from&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bob&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    chainId&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    to&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x_dapp_session_account&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    permission&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;native-token-allowance&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      isAdjustmentAllowed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        allowance&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0DE0B6B3A7640000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    rules&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;expiry&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        data&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          timestamp&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Math&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;floor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Date&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;now&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3600&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 1 hour from now&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Extract the permissionsContext and delegationManager&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; permissionsContext&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; permissionsResponse&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;context&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; delegationManager&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; permissionsResponse&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;delegationManager&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; DApp forms the execution they want Bob&amp;#39;s account to take&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; execution&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  target&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bob&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x06F05B59D3B20000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  callData&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; encodedExecutionCalldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;execution&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;target&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; execution&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; execution&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;callData&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Chose execution mode (SingleDefault)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; executionMode&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; DApp sends the transaction by calling redeemDelegation on with encode execution on Bob&amp;#39;s account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; dapp&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;sendTransaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  to&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; delegationManager&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; encodeFunctionData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    abi&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; DelegationManager&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    functionName&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;redeemDelegations&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    args&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;permissionsContext&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;executionMode&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;encodedExecutionCalldata&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Example of the entire flow:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;mermaid&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sequenceDiagram&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  participant DApp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  participant Provider as window.ethereum&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  participant Wallet&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  participant User&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  participant Chain as Relay infrastructure&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Note over DApp: DApp discovers supported permission and rules types&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  DApp-&amp;gt;&amp;gt;Provider: request({method: &amp;quot;wallet_getSupportedExecutionPermissions&amp;quot;, params: []})&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Provider-&amp;gt;&amp;gt;Wallet: wallet_getSupportedExecutionPermissions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Wallet-&amp;gt;&amp;gt;DApp: Returns supported permission and rules types&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Note over DApp: DApp triggers permissions request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  DApp-&amp;gt;&amp;gt;Provider: request({method: &amp;quot;wallet_requestExecutionPermissions&amp;quot;, params: [ PermissionRequest[] ]})&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Provider-&amp;gt;&amp;gt;Wallet: wallet_requestExecutionPermissions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Wallet-&amp;gt;&amp;gt;User: Display permission request&amp;lt;br&#x2F;&amp;gt; (permissions, rules, to = account)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  User--&amp;gt;&amp;gt;Wallet: Approve or reject&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Wallet--&amp;gt;&amp;gt;Provider: PermissionResponse[]&amp;lt;br&#x2F;&amp;gt;includes context,&amp;lt;br&#x2F;&amp;gt;delegationManager,&amp;lt;br&#x2F;&amp;gt;dependencies&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Provider--&amp;gt;&amp;gt;DApp: PermissionResponse[]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  alt Undeployed user account(s)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      DApp-&amp;gt;&amp;gt;Chain: Deploy via factory using dependencies&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      Chain--&amp;gt;&amp;gt;DApp: Deployment success&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  end&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Note over DApp: DApp forms Action calldata&amp;lt;br&#x2F;&amp;gt;to be executed by user&amp;#39;s account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  DApp-&amp;gt;&amp;gt;Chain: sendTransaction({&amp;lt;br&#x2F;&amp;gt; to: delegationManager,&amp;lt;br&#x2F;&amp;gt; data: redeemDelegations([context], [executionMode], [encodedAction])&amp;lt;br&#x2F;&amp;gt;})&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Chain--&amp;gt;&amp;gt;DApp: tx receipt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The typical transaction flow of &lt;code&gt;suggesting transactions =&amp;gt; approving transactions =&amp;gt; sending transactions&lt;&#x2F;code&gt; is deeply limiting in several ways:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Users must be online to send transactions. DApps cannot send transactions for users when they are offline, which makes use cases such as subscriptions or automated trading impossible.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Users must manually approve every transaction, interrupting what could otherwise be a smooth user experience.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;With this ERC, DApps can request Wallets to grant permissions and execute transactions on the user&#x27;s behalf, therefore circumventing the issues above.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;permissionscontext&quot;&gt;&lt;code&gt;permissionsContext&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Since this ERC only specifies the interaction between the wallet and the DApp but not how the wallet enforces permissions, we need a flexible way for the wallet to pass along information to the DApp so that it can construct transactions that imbue the permissions.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;permissionsContext&lt;&#x2F;code&gt; field is meant to be an opaque string that&#x27;s maximally flexible and can encode arbitrary information for different permissions schemes.&lt;&#x2F;p&gt;
&lt;p&gt;DApps must submit transactions with the &lt;code&gt;account&lt;&#x2F;code&gt; specified in the &lt;code&gt;to&lt;&#x2F;code&gt; field, using the &lt;code&gt;permissionsContext&lt;&#x2F;code&gt; as the &lt;code&gt;_data&lt;&#x2F;code&gt; when interacting with the delegation manager.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;non-exhaustive-list-of-permissions-and-rules&quot;&gt;Non-exhaustive list of permissions and rules&lt;&#x2F;h3&gt;
&lt;p&gt;With the advancement in wallet technologies, we expect new types of permissions and rules to be developed. We considered mandating that each permission and rule must have a UUID in order to avoid collisions, but ultimately decided to stick with the simpler approach for now of simply mandating that these types be defined in ERCs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;&lt;strong&gt;Backwards Compatibility&lt;&#x2F;strong&gt;&lt;&#x2F;h2&gt;
&lt;p&gt;Wallets that don’t support &lt;code&gt;wallet_requestExecutionPermissions&lt;&#x2F;code&gt; SHOULD return an error message if the JSON-RPC method is called.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;&lt;strong&gt;Reference Implementation&lt;&#x2F;strong&gt;&lt;&#x2F;h2&gt;
&lt;p&gt;For a minimal reference implementation focusing on permission granting from a &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1193&#x2F;&quot;&gt;EIP-1193&lt;&#x2F;a&gt; Ethereum provider, please see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7715&#x2F;.&#x2F;assets&#x2F;Example7715PermissionsRequestHandler.html&quot;&gt;Example7715PermissionsRequestHandler&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;For a complete reference implementation of a Permissions handler, see the MetaMask Permissions Snap, which includes features such as:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Support for commonly used permission and rule types with ability to attenuate(reduce or increase) the requested capability to meet the user’s terms for approval.&lt;&#x2F;li&gt;
&lt;li&gt;User encrypted storage for all permissions granted through the Wallet handler to enable revocation mechanisms.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;&lt;strong&gt;Security Considerations&lt;&#x2F;strong&gt;&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;limited-permission-scope&quot;&gt;&lt;strong&gt;Limited Permission Scope&lt;&#x2F;strong&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;DApps should only request the permissions they need, with a reasonable expiration time.&lt;&#x2F;p&gt;
&lt;p&gt;Wallets MUST correctly enforce permissions. Ultimately, users must trust that their wallet software is implemented correctly, and permissions should be considered a part of the wallet implementation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;phishing-attacks&quot;&gt;&lt;strong&gt;Phishing Attacks&lt;&#x2F;strong&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Malicious DApps could pose as legitimate applications and trick users into granting broad permissions. Wallets MUST clearly display the permissions to users and warn them against granting dangerous permissions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Box type for EIP-712 messages</title>
        <published>2024-05-23T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Francisco Giordano</name><uri>https://github.com/frangio</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7713/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7713-box-types-for-eip-712-messages/20092" />
        

        <id>https://wg-eips.ritovision.com/7713/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="interface"
                label="Interface" />
            
        

        
        <category
            term="tag:eip:7713"
            label="EIP-7713" />
        

        
        

        
        <summary type="html">A mechanism for EIP-712 messages to contain parameters of arbitrary type</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7713/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP defines a new type &lt;code&gt;box&lt;&#x2F;code&gt; for use in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; messages. A &lt;code&gt;box&lt;&#x2F;code&gt; value is a value of an arbitrary struct type whose underlying type is encapsulated and hidden from the outer struct but transparent and type-checkable by the wallet, and thus able to be fully inspected by the user prior to signing. A verifying contract can be made agnostic to the underlying type of a &lt;code&gt;box&lt;&#x2F;code&gt; value, but this type is not erased and can be verified on-chain if necessary.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;EIP-712 signatures have become a widely used primitive for users to express and authorize intents off-chain. Wide-ranging applications are able to define parameterized messages for users to sign in their wallet through a general-purpose interface that clearly surfaces the type, parameters, and domain of authorization. This crucially applies to hardware wallets as a last line of defense.&lt;&#x2F;p&gt;
&lt;p&gt;The general-purpose nature of EIP-712 is key to its success, but in addition wallets are able to develop special-purpose interfaces and capabilities for specific types of messages as they become more widely used. For example, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2612&#x2F;&quot;&gt;ERC-2612&lt;&#x2F;a&gt; Permits are a well-known EIP-712 message that wallets display to the user in a special way that clearly surfaces the known implications and risks of signing.&lt;&#x2F;p&gt;
&lt;p&gt;Special-purpose interfaces improve usability and security for the user, but rely on standardized message types such as Permits. This EIP concerns the ability to standardize messages that contain within them parameters of arbitrary type.&lt;&#x2F;p&gt;
&lt;p&gt;A recent example is found in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7683&#x2F;&quot;&gt;ERC-7683&lt;&#x2F;a&gt;, which defines a struct with the following member:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Arbitrary implementation-specific data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Can be used to define tokens, amounts, destination chains, fees, settlement parameters,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; or any other order-type specific information&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt; orderData&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Defining this parameter with type &lt;code&gt;bytes&lt;&#x2F;code&gt; enables the message to contain data of arbitrary type and is sufficient to bind the signature to implementation-specific data, but it amounts to type erasure. As a consequence, the user will be presented with an opaque bytestring in hexadecimal format in the wallet&#x27;s signing interface. This negates the benefit of using EIP-712 signatures because the true contents of the parameter are invisible to the wallet&#x27;s general-purpose interface.&lt;&#x2F;p&gt;
&lt;p&gt;Another example is found in recent efforts to make &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;ERC-1271&lt;&#x2F;a&gt; signatures secure against replay. Achieving this without making the message contents opaque to the signer requires embedding an application&#x27;s EIP-712 message inside an outer message that binds it to a specific account. The type of the outer message depends on the type of the inner message, and making the type reproducible by the smart contract account on-chain for verification requires an inefficient scheme to communicate the string-encoded type of the inner message as a part of the signature.&lt;&#x2F;p&gt;
&lt;p&gt;Both of these use cases would benefit from the ability to define EIP-712 struct parameters of arbitrary type in such a way that the verifying contract can be agnostic to the type of the parameter&#x27;s value in a message while the wallet retains the ability to transparently display it to the user for inspection.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;EIP-712 is extended as follows:&lt;&#x2F;p&gt;
&lt;h3 id=&quot;typed-structured-data&quot;&gt;Typed structured data&lt;&#x2F;h3&gt;
&lt;p&gt;A struct type may contain a &lt;em&gt;boxed member&lt;&#x2F;em&gt; by declaring it with type &lt;code&gt;box&lt;&#x2F;code&gt;. Example:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Envelope&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; account&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    box contents&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;A boxed member has an underlying &lt;em&gt;unboxed type&lt;&#x2F;em&gt;, which is an arbitrary struct type and may be different in each message.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;encodetype&quot;&gt;&lt;code&gt;encodeType&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;A boxed member is encoded as &lt;code&gt;&quot;box &quot; || name&lt;&#x2F;code&gt;. For example, the above &lt;code&gt;Envelope&lt;&#x2F;code&gt; struct is encoded as &lt;code&gt;Envelope(address account,box contents)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;encodedata&quot;&gt;&lt;code&gt;encodeData&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;A boxed value is encoded as its underlying &lt;em&gt;unboxed value&lt;&#x2F;em&gt;, i.e., &lt;code&gt;hashStruct(value) = keccak256(typeHash, encodeData(value))&lt;&#x2F;code&gt; where &lt;code&gt;typeHash&lt;&#x2F;code&gt; corresponds to the unboxed type and &lt;code&gt;encodeData&lt;&#x2F;code&gt; is operating on a value of that type.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;signtypeddata-schema&quot;&gt;&lt;code&gt;signTypedData&lt;&#x2F;code&gt; schema&lt;&#x2F;h3&gt;
&lt;p&gt;A signature request for an EIP-712 message that involves a boxed member shall include the unboxed type as a part of the message object. A boxed value must be an object with properties &lt;code&gt;value&lt;&#x2F;code&gt;, &lt;code&gt;primaryType&lt;&#x2F;code&gt;, and &lt;code&gt;types&lt;&#x2F;code&gt;. The &lt;code&gt;value&lt;&#x2F;code&gt; shall be type-checked and encoded according to &lt;code&gt;primaryType&lt;&#x2F;code&gt; and &lt;code&gt;types&lt;&#x2F;code&gt;, analogously to an EIP-712 message (though without the &lt;code&gt;\x19&lt;&#x2F;code&gt; prefix). The &lt;code&gt;types&lt;&#x2F;code&gt; defined in the message outside of the boxed value shall not be in scope for the encoding of a boxed value.&lt;&#x2F;p&gt;
&lt;p&gt;For example, a message for the &lt;code&gt;Envelope&lt;&#x2F;code&gt; type above may be represented as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    domain&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ...&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    primaryType&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Envelope&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    types&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        Envelope&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;account&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;contents&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;box&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    message&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        account&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        contents&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            primaryType&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Mail&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            types&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;                Mail&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;greeting&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;                greeting&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Hello world&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;json-schema-of-a-boxed-value&quot;&gt;JSON Schema of a boxed value&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  properties&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    primaryType&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    types&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      additionalProperties&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;array&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        items&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;          type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;          properties&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;          required&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  required&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;primaryType&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;types&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;TBD &lt;!-- TODO --&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion. &lt;!-- TODO --&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Smart Contract Delegation</title>
        <published>2024-05-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Ryan McPeck</name><uri>https://github.com/McOso</uri>
	</author>
	
	<author>
		<name>Dan Finlay</name><uri>https://github.com/DanFinlay</uri>
	</author>
	
	<author>
		<name>Rob Dawson</name><uri>https://github.com/rojotek</uri>
	</author>
	
	<author>
		<name>Derek Chiang</name><uri>https://github.com/derekchiang</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7710/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/towards-more-conversational-wallet-connections-a-proposal-for-the-redeemdelegation-interface/16690" />
        

        <id>https://wg-eips.ritovision.com/7710/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7710"
            label="ERC-7710" />
        

        
        

        
        <summary type="html">Interfaces for consistently delegating capabilities to other contracts or EOAs.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7710/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal introduces a standard way for smart contracts to delegate capabilities to other smart contracts
or Externally Owned Accounts (EOAs).  The delegating contract (delegator) must be able to authorize a
&lt;code&gt;DelegationManager&lt;&#x2F;code&gt; contract to call the delegator to execute the desired action.&lt;&#x2F;p&gt;
&lt;p&gt;This framework empowers a delegating contract with the ability to delegate any actions it has the authority to perform,
thereby enabling more flexible and scalable contract interactions. This standard outlines the
minimal interface necessary to facilitate such delegation.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, this proposal is compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt;, although its implementation does not
necessitate &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The development of smart contracts on Ethereum has led to a diverse array of decentralized applications (dApps)
that leverage composability to interact with one another in innovative ways. While current smart contracts are
indeed capable of working together, enabling these interactions, especially in the realm of sharing capabilities
or permissions, remains a tedious and often gas-expensive process, which lacks backwards compatibility.&lt;&#x2F;p&gt;
&lt;p&gt;Currently, for a smart contract to interact with or utilize the functionality of another, it typically requires
hardcoded permissions or the development of bespoke, intermediary contracts. This not only increases the complexity and
development time but also results in higher deployment and execution gas costs. Moreover, the rigid nature of these
interactions limits the ability to adapt to new requirements or to delegate specific, limited permissions in a dynamic
manner.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, the need to repeatedly sign messages for each interaction creates friction in user experiences, particularly in scenarios requiring frequent or automated interactions.&lt;&#x2F;p&gt;
&lt;p&gt;The proposed standard aims to solve these challenges by enabling the creation of long-lived sessions and delegated permissions through a single signature. These delegations can be used to:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Establish persistent sessions with dApps that don&#x27;t require repeated signing&lt;&#x2F;li&gt;
&lt;li&gt;Grant bounded permissions to AI agents or automated systems&lt;&#x2F;li&gt;
&lt;li&gt;Create shareable invite links with specific capabilities&lt;&#x2F;li&gt;
&lt;li&gt;Enable third-party delegates to act within well-defined policy constraints&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;By allowing the creation of open-ended yet policy-constrained delegations with a single signature, this standard helps
minimize user interactions while maximizing their meaningful content. Users can grant specific capabilities with
clear boundaries, rather than repeatedly signing similar permissions.&lt;&#x2F;p&gt;
&lt;p&gt;The proposed standard aims to simplify and standardize the process of delegation between contracts, reducing the
operational complexity and gas costs associated with shared capabilities. By establishing a common framework for
delegating permissions, we can streamline interactions within the Ethereum ecosystem, making contracts more flexible,
cost-effective, and adaptable to the needs of diverse applications. This opens up new possibilities for collaboration
and innovation, allowing dApps to leverage each other&#x27;s strengths in a more seamless and efficient manner.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT
RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;terms&quot;&gt;Terms&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;A &lt;strong&gt;Delegator&lt;&#x2F;strong&gt; is a smart contract that can create a delegation.&lt;&#x2F;li&gt;
&lt;li&gt;A &lt;strong&gt;Delegation Manager&lt;&#x2F;strong&gt; is a smart contract that validates delegation authority and calls on the &lt;em&gt;Delegator&lt;&#x2F;em&gt; to execute an action. It implements the &lt;code&gt;ERC7710Manager&lt;&#x2F;code&gt; interface. A Delegation Manager verifies and processes delegation redemptions, and multiple Delegation Managers can exist with different implementations. A contract account can be its own delegation manager.&lt;&#x2F;li&gt;
&lt;li&gt;A &lt;strong&gt;delegation&lt;&#x2F;strong&gt; is an authority given to another address to perform a specific action.&lt;&#x2F;li&gt;
&lt;li&gt;A &lt;strong&gt;delegate&lt;&#x2F;strong&gt; is a smart contract, smart contract account, or EOA that has authority to redeem a delegation.&lt;&#x2F;li&gt;
&lt;li&gt;A &lt;strong&gt;redeemer&lt;&#x2F;strong&gt; is a &lt;em&gt;delegate&lt;&#x2F;em&gt; that is using a delegation.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;obtaining-delegations&quot;&gt;Obtaining Delegations&lt;&#x2F;h3&gt;
&lt;p&gt;The process by which a delegate obtains a delegation is intentionally left out of scope for this ERC. This ERC focuses solely on the interface for redeeming delegations and the validation of delegation authority. The mechanism for requesting and granting delegations may be implemented in various ways depending on the use case, such as through &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7715&#x2F;&quot;&gt;ERC-7715&lt;&#x2F;a&gt; or other protocols. This separation of concerns allows for flexibility in how delegations are created while maintaining a consistent interface for their redemption.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;overview&quot;&gt;Overview&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;redeeming-a-delegation&quot;&gt;Redeeming a Delegation&lt;&#x2F;h4&gt;
&lt;p&gt;When a delegate wishes to redeem a delegation, they call the &lt;code&gt;redeemDelegations&lt;&#x2F;code&gt; function on the Delegation Manager and
pass in the action they want to execute and the proof of authority (ie delegation) which they are executing on behalf
of. The Delegation Manager then verifies the delegation&#x27;s validity and, if valid, calls the privileged function on the
Delegator which executes the specified capability on behalf of the Delegator.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7710&#x2F;.&#x2F;assets&#x2F;diagram.svg&quot; alt=&quot;diagram showing the flow of redeemDelegations&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;interfaces&quot;&gt;Interfaces&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;erc7710manager-sol&quot;&gt;&lt;code&gt;ERC7710Manager.sol&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The Delegation Manager MUST implement the &lt;code&gt;redeemDelegations&lt;&#x2F;code&gt; which will be responsible for validating the delegations
being redeemed, and will then call the delegators to execute the actions.&lt;&#x2F;p&gt;
&lt;p&gt;The bytes array &lt;code&gt;_permissionContexts&lt;&#x2F;code&gt; passed in as a parameter to the &lt;code&gt;redeemDelegations&lt;&#x2F;code&gt; function contains the authority to execute a
specific action on behalf of the delegating contract.&lt;&#x2F;p&gt;
&lt;p&gt;The bytes32 array &lt;code&gt;_modes&lt;&#x2F;code&gt; and the bytes array &lt;code&gt;_executionCallDatas&lt;&#x2F;code&gt; passed in as parameters to the &lt;code&gt;redeemDelegations&lt;&#x2F;code&gt; function are arrays of &lt;code&gt;mode&lt;&#x2F;code&gt; and &lt;code&gt;executionCalldata&lt;&#x2F;code&gt;, which are defined precisely in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7579&#x2F;&quot;&gt;ERC-7579&lt;&#x2F;a&gt; (under the &quot;Execution Behavior&quot; section).  Briefly, &lt;code&gt;mode&lt;&#x2F;code&gt; encodes the &quot;behavior&quot; of the execution, which could be a single call, a batch call, and others.  &lt;code&gt;executionCallData&lt;&#x2F;code&gt; encodes the data of the execution, which typically includes at least a &lt;code&gt;target&lt;&#x2F;code&gt;, a &lt;code&gt;value&lt;&#x2F;code&gt;, and a &lt;code&gt;to&lt;&#x2F;code&gt; address.&lt;&#x2F;p&gt;
&lt;p&gt;The three arrays MUST be interpreted as a list of tuples, where each tuple consists of (&lt;code&gt;_permissionContexts[i]&lt;&#x2F;code&gt;, &lt;code&gt;_modes[i]&lt;&#x2F;code&gt;, &lt;code&gt;_executionCallDatas[i]&lt;&#x2F;code&gt;). The function MUST revert if the arrays have different lengths. Each tuple represents a single delegation redemption with its associated permission context, execution mode, and execution data. Implementations MUST enforce atomicity of the batch.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;permission-verification&quot;&gt;Permission Verification&lt;&#x2F;h4&gt;
&lt;p&gt;While this interface does not include an explicit method for checking delegation permissions, dApps SHOULD verify permissions before attempting to execute actions by:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Simulating the &lt;code&gt;redeemDelegations&lt;&#x2F;code&gt; call with the intended parameters&lt;&#x2F;li&gt;
&lt;li&gt;Using the simulation results to determine if the delegation would succeed&lt;&#x2F;li&gt;
&lt;li&gt;If the simulation fails, the dApp can request new or updated permissions from the user&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;This simulation-based approach provides stronger guarantees than a method exposed by the delegation manager, as it validates the entire execution context rather than the claims of the delegation manager.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0.8.23&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC7710Manager&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Interface for Delegation Manager that exposes the redeemDelegations function.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC7710Manager&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This method validates the provided permission contexts and executes the execution if the caller has authority to do so.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the structure of the _permissionContexts bytes[] is determined by the specific Delegation Manager implementation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _permissionContexts&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the data used to validate the authority given to execute the corresponding execution.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _action&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the action to be executed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _modes&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the array of modes to execute the related executioncallData&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _executionCallDatas&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the array of encoded executions to be executed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; redeemDelegations&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _permissionContexts&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _modes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _executionCallData&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The design of this ERC is motivated by the need to introduce standardized, secure, and efficient mechanisms for
delegation within the Ethereum ecosystem. Several considerations were taken into account:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Flexibility and Scalability&lt;&#x2F;strong&gt;: The proposed interfaces are designed to be minimal yet powerful, allowing contracts to
delegate a wide range of actions without imposing a heavy implementation burden. This balance aims to encourage
widespread adoption and innovation.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Interoperability&lt;&#x2F;strong&gt;: Compatibility with existing standards, such as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;ERC-1271&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt;, ensures that this approach
can be seamlessly integrated into the current Ethereum infrastructure. This encourages adoption and leverages existing
security practices.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Usability&lt;&#x2F;strong&gt;: By enabling contracts to delegate specific actions to others, we open the door to more user-friendly
DApps that can perform a variety of tasks on behalf of users, reducing the need for constant user interaction and
enhancing the overall user experience.&lt;&#x2F;p&gt;
&lt;p&gt;This ERC represents a step towards a more interconnected and flexible Ethereum ecosystem, where smart contracts can more
effectively collaborate and adapt to users&#x27; needs.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;execution-interface&quot;&gt;Execution Interface&lt;&#x2F;h3&gt;
&lt;p&gt;A previous iteration of this spec defined &lt;code&gt;Action&lt;&#x2F;code&gt; as a simple &lt;code&gt;(target, value, data)&lt;&#x2F;code&gt; tuple, and defined a specific
execution interface on the delegator that is &lt;code&gt;executeDelegatedAction(Action _action)&lt;&#x2F;code&gt; which the Delegation Manager is
supposed to call.&lt;&#x2F;p&gt;
&lt;p&gt;That approach had a few downsides:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Existing smart accounts won&#x27;t be compatible with this spec (unless they happen to implement the execution interface).&lt;&#x2F;li&gt;
&lt;li&gt;The execution behavior is limited to a single call, since &lt;code&gt;Action&lt;&#x2F;code&gt; could only encode a single call.  It made complex
execution behaviors such as batching, delegatecall, and CREATE2 impossible.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;To solve the first issue, we decided to remove the requirement for the delegator to implement any specific interface.
Rather, we rely on the Delegation Manager to correctly call the delegator, and we rely on the fact that a delegator would
only create &lt;code&gt;_permissionContexts&lt;&#x2F;code&gt; for a Delegation Manager that knows how to correctly call it.&lt;&#x2F;p&gt;
&lt;p&gt;To solve the second issue, we decied to adopt the execution interface from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7579&#x2F;&quot;&gt;ERC-7579&lt;&#x2F;a&gt;, which had to solve a similar problem
within the context of modular smart accounts: defining a standardized execution interface that can support many types of
executions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;For a minimal reference implementation focusing on delegation redemption, please see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7710&#x2F;.&#x2F;assets&#x2F;Example7710Manager.sol&quot;&gt;Example7710Manager&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;For a complete reference implementation of a Delegation Manager, see the MetaMask Delegation Framework, which includes features such as:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; signature validation for delegations&lt;&#x2F;li&gt;
&lt;li&gt;Support for both EOA and contract signatures (ERC-1271)&lt;&#x2F;li&gt;
&lt;li&gt;Caveat enforcement for fine-grained delegation control&lt;&#x2F;li&gt;
&lt;li&gt;Batch delegation processing&lt;&#x2F;li&gt;
&lt;li&gt;Delegation revocation mechanisms&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The MetaMask implementation demonstrates one way to build a robust delegation system while adhering to this standard&#x27;s interface requirements.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The introduction of customizable authorization terms requires careful consideration of how authorization data is
structured and interpreted. Potential security risks include the misinterpretation of authorization terms and
unauthorized actions being taken if the interface is not properly implemented. It is recommended that applications
implementing this interface undergo thorough security audits to ensure that authorization terms are handled securely.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;permission-verification-1&quot;&gt;Permission Verification&lt;&#x2F;h3&gt;
&lt;p&gt;dApps MUST NOT assume that having received a delegation in the past guarantees future execution rights. Delegations can be revoked, expire, or become invalid due to state changes. To ensure reliable operation:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Always simulate delegation redemptions before submitting them on-chain&lt;&#x2F;li&gt;
&lt;li&gt;Handle simulation failures gracefully by requesting new permissions when needed&lt;&#x2F;li&gt;
&lt;li&gt;Consider implementing retry logic with escalating permission requests&lt;&#x2F;li&gt;
&lt;li&gt;Be prepared for delegations to become invalid between simulation and execution&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Needs discussion. &lt;!-- TODO --&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Read BLOCKHASH from storage and update cost</title>
        <published>2024-05-18T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	<author>
		<name>Tomasz Stanczak</name><uri>https://github.com/tkstanczak</uri>
	</author>
	
	<author>
		<name>Guillaume Ballet</name><uri>https://github.com/gballet</uri>
	</author>
	
	<author>
		<name>Gajinder Singh</name><uri>https://github.com/g11tech</uri>
	</author>
	
	<author>
		<name>Tanishq Jasoria</name><uri>https://github.com/tanishqjasoria</uri>
	</author>
	
	<author>
		<name>Ignacio Hagopian</name><uri>https://github.com/jsign</uri>
	</author>
	
	<author>
		<name>Jochem Brouwer</name><uri>https://github.com/jochem-brouwer</uri>
	</author>
	
	<author>
		<name>Gabriel Rocheleau</name><uri>https://github.com/gabrocheleau</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7709/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7709-read-blockhash-opcode-from-storage-and-adjust-gas-cost/20052" />
        

        <id>https://wg-eips.ritovision.com/7709/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7709"
            label="EIP-7709" />
        

        
        

        
        <summary type="html">Read the `BLOCKHASH (0x40)` opcode from the EIP-2935 system contract storage and adjust its gas cost to reflect storage access.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7709/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Update the &lt;code&gt;BLOCKHASH (0x40)&lt;&#x2F;code&gt; opcode to read and serve from the system contract storage and charge the &lt;strong&gt;additional&lt;&#x2F;strong&gt; (cold or warm) storage costs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;BLOCKHASH (0x40)&lt;&#x2F;code&gt; opcode currently assumes that the client has knowledge of the previous blocks, which in Verkle &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6800&#x2F;&quot;&gt;EIP-6800&lt;&#x2F;a&gt; would prevent stateless execution. However with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2935&#x2F;&quot;&gt;EIP-2935&lt;&#x2F;a&gt; blockhashes can be retrieved and served from its system contract storage which allows Verkle blocks to include a storage access witness for stateless execution.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FORK_TIMESTAMP&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;TBD&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;HISTORY_STORAGE_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x0000F90827F1C53a10cb7A02335B175320002935&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;BLOCKHASH_SERVE_WINDOW&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;256&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The &lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt; opcode semantics remains the same as before. From the &lt;code&gt;fork_block&lt;&#x2F;code&gt; (defined as &lt;code&gt;fork_block.timestamp &amp;gt;= FORK_TIMESTAMP and fork_block.parent.timestamp &amp;lt; FORK_TIMESTAMP&lt;&#x2F;code&gt;), the &lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt; instruction should be updated to resolve block hash in the following manner:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; resolve_blockhash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Block&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; State&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; arg&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; note that outside the BLOCKHASH_SERVE_WINDOW we continue to return 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; despite the 2935 history contract being able to serve more hashes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  if&lt;&#x2F;span&gt;&lt;span&gt; arg&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; or&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;arg&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BLOCKHASH_SERVE_WINDOW&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; performs an sload on arg % HISTORY_SERVE_WINDOW including gas charges,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; warming effects as well as execution accesses&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; note that the `BLOCKHASH_SERVE_WINDOW` and the 2935 ring buffer window&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `HISTORY_SERVE_WINDOW` for slot calculation are different&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  return&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;load_slot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;HISTORY_STORAGE_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; arg&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; HISTORY_SERVE_WINDOW&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;ONLY if the &lt;code&gt;arg&lt;&#x2F;code&gt; is within the correct &lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt; window, clients can choose to either&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;do a direct &lt;code&gt;SLOAD&lt;&#x2F;code&gt; from state, or&lt;&#x2F;li&gt;
&lt;li&gt;do a system call to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2935&#x2F;&quot;&gt;EIP-2935&lt;&#x2F;a&gt; contract via its &lt;code&gt;get&lt;&#x2F;code&gt; mechanism (caller other than &lt;code&gt;SYSTEM_ADDRESS&lt;&#x2F;code&gt;) or&lt;&#x2F;li&gt;
&lt;li&gt;serve from memory or as per current designs if maintaining requisite history (full clients for e.g.)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;However the entire semantics and after effects of the &lt;code&gt;SLOAD&lt;&#x2F;code&gt; operation needs to be applied as per the current fork if the &lt;code&gt;arg&lt;&#x2F;code&gt; is within the correct &lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt; window:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;SLOAD&lt;&#x2F;code&gt; gas costs (cold or warm) for the &lt;code&gt;arg % HISTORY_SERVE_WINDOW&lt;&#x2F;code&gt; slot.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SLOAD&lt;&#x2F;code&gt; after effects on the slot (warming the slot)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SLOAD&lt;&#x2F;code&gt; accesses added to execution witnesses if Verkle (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6800&#x2F;&quot;&gt;EIP-6800&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4762&#x2F;&quot;&gt;EIP-4762&lt;&#x2F;a&gt;) is activated&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;activation&quot;&gt;Activation&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP specifies the transition to the new logic assuming that &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2935&#x2F;&quot;&gt;EIP-2935&lt;&#x2F;a&gt; has been activated:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;sufficiently ahead of this EIP&#x27;s activation (&amp;gt;= &lt;code&gt;BLOCKHASH_SERVE_WINDOW&lt;&#x2F;code&gt;) or&lt;&#x2F;li&gt;
&lt;li&gt;at genesis for testnets&#x2F;devnets where this EIP could also be activated at genesis&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The current proposal is to activate this EIP with Verkle to allow for stateless execution of the block.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-costs&quot;&gt;Gas costs&lt;&#x2F;h3&gt;
&lt;p&gt;As described above, if the &lt;code&gt;arg&lt;&#x2F;code&gt; to be resolved is within the correct window, the corresponding &lt;code&gt;SLOAD&lt;&#x2F;code&gt; charges and accesses are to be applied for the slot &lt;code&gt;arg % HISTORY_SERVE_WINDOW&lt;&#x2F;code&gt;. Note that the &lt;code&gt;HISTORY_SERVE_WINDOW&lt;&#x2F;code&gt; and &lt;code&gt;BLOCKHASH_SERVE_WINDOW&lt;&#x2F;code&gt; are different.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;reading-from-the-system-contract&quot;&gt;Reading from the System contract&lt;&#x2F;h3&gt;
&lt;p&gt;Even if the clients choose to resolve &lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt; through system call to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2935&#x2F;&quot;&gt;EIP-2935&lt;&#x2F;a&gt; contract, the gas cost for the system code execution (and also the code witnesses if Verkle activated) is not applied. Only the effect of &lt;code&gt;SLOAD&lt;&#x2F;code&gt; is applied as described above.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;The reason behind the updated gas cost is to match the real operation, which is equivalent to an &lt;code&gt;SLOAD&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2935&#x2F;&quot;&gt;EIP-2935&lt;&#x2F;a&gt; system contract execution charges (and accesses) are not applied to keep the gas low and to keep things simple for clients which choose to resolve &lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt; in other ways (directly or though memory&#x2F;maintained history)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note that &lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt; opcode only serves a limited &lt;code&gt;BLOCKHASH_SERVE_WINDOW&lt;&#x2F;code&gt; to be backward compatible (and to not extend the above exemptions). For deeper accesses one will need to directly call &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2935&#x2F;&quot;&gt;EIP-2935&lt;&#x2F;a&gt; system contract which will lead to a normal contract execution (as well as charges and accesses)&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a significant increase in the cost of &lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt;, which could break use-cases that rely on the previous gas cost. Also, this EIP introduces a breaking change in the case where less than &lt;code&gt;BLOCKHASH_SERVE_WINDOW&lt;&#x2F;code&gt; elapse between the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2935&#x2F;&quot;&gt;EIP-2935&lt;&#x2F;a&gt; fork and this EIP&#x27;s fork (unless &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2935&#x2F;&quot;&gt;EIP-2935&lt;&#x2F;a&gt;  is activated in genesis for e.g. in testnets&#x2F;devnets) as the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2935&#x2F;&quot;&gt;EIP-2935&lt;&#x2F;a&gt; system contract would not have saved the required history.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;If &lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt; is not called or there is no &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2935&#x2F;&quot;&gt;EIP-2935&lt;&#x2F;a&gt; contract call by any transaction, only the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2935&#x2F;&quot;&gt;EIP-2935&lt;&#x2F;a&gt; system update of the parent hash shows up in witnesses if Verkle is activated.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt; is called, there MUST be a storage access gas charge (and corresponding access witness if Verkle is activated) for the storage slot but ONLY if the &lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt; query is for the last &lt;code&gt;BLOCKHASH_SERVE_WINDOW&lt;&#x2F;code&gt; ancestors. This is irrespective of how the client chooses to resolve the &lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt; (directly, via system contract or via memory)&lt;&#x2F;li&gt;
&lt;li&gt;The gas cost for each &lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt; operation should still be charged, in addition to the &lt;code&gt;SLOAD&lt;&#x2F;code&gt; cost of each lookup (if performed)&lt;&#x2F;li&gt;
&lt;li&gt;If the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2935&#x2F;&quot;&gt;EIP-2935&lt;&#x2F;a&gt; contract is called directly (i.e. not through &lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt;), then the witness and gas costs (including those related to contract code) are applied as per normal contract execution of the current fork.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt; should be consistently resolved if this EIP is activated correctly &lt;code&gt;&amp;gt;= BLOCKHASH_SERVE_WINDOW&lt;&#x2F;code&gt; after &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2935&#x2F;&quot;&gt;EIP-2935&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;No security considerations other than the ones contained in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2935&#x2F;&quot;&gt;EIP-2935&lt;&#x2F;a&gt; are determined as of now.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>ETH transfers emit a log</title>
        <published>2024-05-17T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	<author>
		<name>Peter Davies</name><uri>https://github.com/petertdavies</uri>
	</author>
	
	<author>
		<name>Etan Kissling</name><uri>https://github.com/etan-status</uri>
	</author>
	
	<author>
		<name>Gajinder Singh</name><uri>https://github.com/g11tech</uri>
	</author>
	
	<author>
		<name>Carson</name><uri>https://github.com/carsons-eels</uri>
	</author>
	
	<author>
		<name>Jared Wasinger</name><uri>https://github.com/jwasinger</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7708/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7708-eth-transfers-emit-a-log/20034" />
        

        <id>https://wg-eips.ritovision.com/7708/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7708"
            label="EIP-7708" />
        

        
        

        
        <summary type="html">All ETH transfers emit a log</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7708/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;All ETH-transfers, including transactions, &lt;code&gt;CALL&lt;&#x2F;code&gt; and &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; emit a log.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Logs are often used to track when balance changes of assets on Ethereum. Logs work for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens, but they do not work for ETH. ETH transfers from EOAs can be read from the transaction list in the block, but ETH transfers from smart contract wallets are not automatically logged anywhere. This has already led to problems in the past, eg. early exchanges would often not properly support deposits from smart contract wallets, or only support them with a much longer delay. This EIP proposes that we automatically generate a log every time a value-transferring &lt;code&gt;CALL&lt;&#x2F;code&gt; or &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; happens. We also add a similar log for transfers in transactions, so that all ETH transfers can be tracked using one mechanism.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;eth-transfer-logs&quot;&gt;ETH transfer logs&lt;&#x2F;h3&gt;
&lt;p&gt;A log, identical to a LOG3, is issued for:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Any nonzero-value-transferring transaction to a different account, before any other logs created by EVM execution&lt;&#x2F;li&gt;
&lt;li&gt;Any nonzero-value-transferring &lt;code&gt;CALL&lt;&#x2F;code&gt; to a different account, at the time that the value transfer executes&lt;&#x2F;li&gt;
&lt;li&gt;Any nonzero-value-transferring &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; to a different account, at the time that the value transfer executes&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Field&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;address&lt;&#x2F;code&gt; emitting log&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xfffffffffffffffffffffffffffffffffffffffe&lt;&#x2F;code&gt; (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4788&#x2F;&quot;&gt;&lt;code&gt;SYSTEM_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;topics[0]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef&lt;&#x2F;code&gt; (&lt;code&gt;keccak256(&#x27;Transfer(address,address,uint256)&#x27;)&lt;&#x2F;code&gt;)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;topics[1]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;from&lt;&#x2F;code&gt; address (zero prefixed to fill uint256)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;topics[2]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;to&lt;&#x2F;code&gt; address (zero prefixed to fill uint256)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;data&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;amount&lt;&#x2F;code&gt; in Wei (big endian uint256)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;This matches the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; Transfer event definition.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;selfdestruct-processing&quot;&gt;Selfdestruct processing&lt;&#x2F;h3&gt;
&lt;p&gt;A log, identical to a LOG2, is issued for:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Any non-zero balance removal which occurs when a contract created in the same transaction invokes &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; with itself as a target, at the time that the opcode is invoked.&lt;&#x2F;li&gt;
&lt;li&gt;Each account which has been marked for deletion and holds a balance at the time of removal during transaction finalization.  Burn logs are emitted after any other logs created by EVM execution and the payment of the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; priority fee to the coinbase, in lexicographical order of account address&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Field&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;address&lt;&#x2F;code&gt; emitting log&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xfffffffffffffffffffffffffffffffffffffffe&lt;&#x2F;code&gt; (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4788&#x2F;&quot;&gt;&lt;code&gt;SYSTEM_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;topics[0]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x4bfaba3443c1a1836cd362418edc679fc96cae8449cbefccb6457cdf2c943083&lt;&#x2F;code&gt; (&lt;code&gt;keccak256(&#x27;Selfdestruct(address,uint256)&#x27;)&lt;&#x2F;code&gt;)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;topics[1]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Closed &lt;code&gt;contract_address&lt;&#x2F;code&gt; (zero prefixed to fill uint256)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;data&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;amount&lt;&#x2F;code&gt; in Wei (big endian uint256)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The Selfdestruct log is emitted when (1) a &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; to self is triggered, or when (2) a smart contract is closed after receiving more ETH after already flagged for &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This is the simplest possible implementation that ensures that all ETH transfers are implemented in some kind of record that can be easily accessed through making RPC calls into a node, or through asking for a Merkle branch that is hashed into the block root. The log type is compatible with the ERC-20 token standard, but does not introduce any overly-specific ERC-20 features (eg. ABI encodings) into the specification.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;open-questions&quot;&gt;Open questions&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;Magic value used for &lt;code&gt;address&lt;&#x2F;code&gt;? For address: (a) &lt;code&gt;0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee&lt;&#x2F;code&gt; (same as &lt;code&gt;eth_simulateV1&lt;&#x2F;code&gt;), (b) &lt;code&gt;0xfffffffffffffffffffffffffffffffffffffffe&lt;&#x2F;code&gt; (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4788&#x2F;&quot;&gt;&lt;code&gt;SYSTEM_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;), (c) zero address&lt;&#x2F;li&gt;
&lt;li&gt;Should fee payments trigger a log? It would ensure &quot;completeness&quot;, in the sense that you can compute the exact current balance table by watching logs, but it would greatly increase the number of logs, perhaps to an unacceptably high amount.&lt;&#x2F;li&gt;
&lt;li&gt;Should withdrawals also trigger a log? They are not associated with transactions.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TODO&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;ETH transfers already cost a minimum of 6700 gas, which is much more expensive than the LOG3 opcode (1500 gas). Hence, this EIP does not increase the worst-case number of logs that can be put into a block. It will somewhat increase the average number of logs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Separate gas type for calldata</title>
        <published>2024-05-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7706/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7706-create-a-separate-basefee-and-gaslimit-for-calldata/19998" />
        

        <id>https://wg-eips.ritovision.com/7706/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:7706"
            label="EIP-7706" />
        

        
        

        
        <summary type="html">Create a separate basefee and gaslimit for calldata</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7706/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Add a new type of gas for transaction calldata. Add a new transaction type that provides &lt;code&gt;max_basefee&lt;&#x2F;code&gt; and &lt;code&gt;priority_fee&lt;&#x2F;code&gt; as a vector, providing values for execution gas, blob gas and calldata gas. Modify the basefee adjustment to use the same mechanism for the three types of gas.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;A major argument against raising the Ethereum gas limit, making calldata cheaper, or increasing the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt; blob count before technologies like PeerDAS become available, is that the theoretical maximum size of an Ethereum block is already too large, and we cannot afford to increase it further. However, there is an inefficiency here: the current average size of a block (not including blobs) is ~100 kB, and the theoretical max is &lt;code&gt;30,000,000 &#x2F; 16 = 1,875,000&lt;&#x2F;code&gt; bytes (one could make larger blocks using zero bytes, but in practice zero-byte-heavy blocks would be compressed to less than 1.87 million bytes due to snappy compression). Ideally, we would have a way to bound the maximum, without making calldata more scarce &lt;em&gt;on average&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP does exactly this, by adopting the same technique that was applied for blob data in EIP-4844: we introduce a separate fee market for calldata, with a separate basefee and a separate per-block gas limit. The theoretical max calldata size of a block would be greatly reduced, while basic economic analysis suggests that &lt;em&gt;on average&lt;&#x2F;em&gt;, calldata would become considerably cheaper.&lt;&#x2F;p&gt;
&lt;p&gt;The EIP also introduces a new transaction type which includes the three types of max-basefees and priority fees as a vector, allowing the same code paths to handle all three types of gas. We also make the basefee adjustment, which currently uses separate mechanisms for execution gas (introduced in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt;) and blobs (introduced in EIP-4844), use the same approach for all three types of gas. This simplifies the basefee adjustment rules, and ensures that the stronger mathematical properties of the newer EIP-4844 basefee adjustment algorithm cover all three types of gas.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;FORK_BLKNUM&lt;&#x2F;code&gt; = &lt;code&gt;TBD&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;NEW_TX_TYPE&lt;&#x2F;code&gt; = &lt;code&gt;TBD&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CALLDATA_GAS_PER_TOKEN&lt;&#x2F;code&gt; = &lt;code&gt;4&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TOKENS_PER_NONZERO_BYTE&lt;&#x2F;code&gt; = &lt;code&gt;4&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CALLDATA_GAS_LIMIT_RATIO&lt;&#x2F;code&gt; = &lt;code&gt;4&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;LIMIT_TARGET_RATIOS = [2, 2, 4]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;MIN_BASE_FEE_PER_GAS = 1&lt;&#x2F;code&gt; # Rename of EIP-4844 MIN_BASE_FEE_PER_BLOB_GAS&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;BASE_FEE_UPDATE_FRACTION = 8&lt;&#x2F;code&gt; # Roughly matches EIP-4844 parameters&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;new-transaction-type&quot;&gt;New transaction type&lt;&#x2F;h3&gt;
&lt;p&gt;As of &lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt;, a new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; transaction is introduced with &lt;code&gt;TransactionType&lt;&#x2F;code&gt; = &lt;code&gt;TX_TYPE(NEW_TX_TYPE)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; &lt;code&gt;TransactionPayload&lt;&#x2F;code&gt; for this transaction is&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[chain_id, nonce, gas_limit, to, value, data, access_list, blob_versioned_hashes, max_fees_per_gas, priority_fees_per_gas, y_parity, r, s]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;We require &lt;code&gt;max_fees_per_gas&lt;&#x2F;code&gt; and &lt;code&gt;priority_fees_per_gas&lt;&#x2F;code&gt; to be length-3 vectors, each of which contain integers from &lt;code&gt;0&lt;&#x2F;code&gt; to &lt;code&gt;2**64-1&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The intrinsic cost of the new transaction is inherited from EIP-4844, except that the calldata gas cost (16 per nonzero byte, 4 per zero byte) is removed.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;block-processing-and-transaction-fees&quot;&gt;Block processing and transaction fees&lt;&#x2F;h3&gt;
&lt;p&gt;We add the functions &lt;code&gt;get_max_fees&lt;&#x2F;code&gt; and &lt;code&gt;get_priority_fees&lt;&#x2F;code&gt;, to compute these length-3 vectors for previous transaction types:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def get_max_fees(tx: Transaction) -&amp;gt; [int, int, int]:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if tx.type == NEW_TX_TYPE:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return tx.max_fees_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    elif tx.type == BLOB_TX_TYPE:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return [tx.max_fee_per_gas, tx.max_fee_per_blob_gas, tx.max_fee_per_gas]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    elif is_eip_1559(tx.type):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return [tx.max_fee_per_gas, 0, tx.max_fee_per_gas]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    else:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return [tx.gasprice, 0, tx.gasprice]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def get_priority_fees(tx: Transaction) -&amp;gt; [int, int, int]:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if tx.type == NEW_TX_TYPE:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return tx.priority_fees_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    elif tx.type == BLOB_TX_TYPE:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return [tx.max_priority_fee_per_gas, 0, tx.max_priority_fee_per_gas]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    elif is_eip_1559(tx.type):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return [tx.max_priority_fee_per_gas, 0, tx.max_priority_fee_per_gas]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    else:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return [tx.gasprice, 0, tx.gasprice]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;We also add some helpers:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def all_less_or_equal(v1: [int, int, int], v2: [int, int, int]) -&amp;gt; bool:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return all(x &amp;lt;= y for x, y in zip(v1, v2))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def vector_add(v1: [int, int, int], v2: [int, int, int]) -&amp;gt; [int, int, int]:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return [x+y for x, y in zip(v1, v2)]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def vector_subtract(v1: [int, int, int], v2: [int, int, int]) -&amp;gt; [int, int, int]:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return [x-y for x, y in zip(v1, v2)]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def vector_subtract_clamp_at_zero(v1: [int, int, int], v2: [int, int, int]) -&amp;gt; [uint, uint, uint]:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return [x-y if x &amp;gt;= y else 0 for x, y in zip(v1, v2)]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def vector_mul(v1: [int, int, int], v2: [int, int, int]) -&amp;gt; [int, int, int]:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return [x*y for x, y in zip(v1, v2)]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Same rules as current calldata pricing, but rephrased (similar language to EIP-7623)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def get_calldata_gas(calldata: bytes) -&amp;gt; int:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    tokens = calldata.count(0) + (len(calldata) - calldata.count(0)) * TOKENS_PER_NONZERO_BYTE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return tokens * CALLDATA_GAS_PER_TOKEN&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def get_gaslimits(tx: Transaction) -&amp;gt; [int, int, int]:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if tx.type == NEW_TX_TYPE:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return [tx.gaslimit, len(tx.blob_versioned_hashes) * GAS_PER_BLOB, get_calldata_gas(tx.data)]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    elif tx.type == BLOB_TX_TYPE:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return [tx.gaslimit, len(tx.blob_versioned_hashes) * GAS_PER_BLOB, get_calldata_gas(tx.data)]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    elif is_eip_1559(tx.type):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return [tx.gaslimit, 0, get_calldata_gas(tx.data)]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    else:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return [tx.gaslimit, 0, get_calldata_gas(tx.data)]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def get_fees_per_gas(tx: Transaction, block_basefees: [int, int, int]) -&amp;gt; [int, int, int]:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_fees = get_max_fees(tx)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    priority_fees = get_priority_fees(tx)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    output = []&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Fee sufficiency check, similar to EIP-1559 and 4844&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    require(all_less_or_equal(block_basefees, max_fees))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Similar logic to EIP-1559 and 4844&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        min(basefee + priority_fee, max_fee)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        for block_basefee, max_fee, priority_fee in zip(block_basefees, max_fees, priority_fees)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;get_block_gaslimits(block: Block) -&amp;gt; [int, int, int]:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return [block.gaslimit, MAX_BLOB_GAS_PER_BLOCK, block.gaslimit &#x2F;&#x2F; CALLDATA_GAS_LIMIT_RATIO]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;At the start of block processing&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;We initialize a vector &lt;code&gt;gas_used_so_far&lt;&#x2F;code&gt; to &lt;code&gt;[0, 0, 0]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;At the start of processing a transaction&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Compute &lt;code&gt;fees_per_gas = get_fees_per_gas(tx, get_block_basefees(block))&lt;&#x2F;code&gt; and &lt;code&gt;tx_gaslimits = get_gaslimits(tx)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Check that &lt;code&gt;all_less_or_equal(vector_add(gas_used_so_far, tx_gaslimits), block.gas_limits)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Deduct &lt;code&gt;sum(vector_mul(fees_per_gas, tx_gaslimits))&lt;&#x2F;code&gt; wei from the &lt;code&gt;tx.origin&lt;&#x2F;code&gt; account&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note that &lt;code&gt;get_block_basefees(block)&lt;&#x2F;code&gt; is not yet defined, we will define it in the section below. The &lt;code&gt;block.gas_limits&lt;&#x2F;code&gt; field is also defined in the section below.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;At the end of processing a transaction&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Compute &lt;code&gt;tx_gas_consumed&lt;&#x2F;code&gt; as a three item vector, where the first item is the amount of gas actually consumed by the transaction execution, and the second and third match the values in &lt;code&gt;get_gaslimits(tx)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Refund &lt;code&gt;sum(vector_mul(fees_per_gas, vector_sub(tx_gaslimits, tx_gas_consumed)))&lt;&#x2F;code&gt; to the &lt;code&gt;tx.origin&lt;&#x2F;code&gt; account (in practice, only the first term will be nonzero for now)&lt;&#x2F;li&gt;
&lt;li&gt;Set &lt;code&gt;gas_used_so_far = vector_add(gas_used_so_far, tx_gas_consumed)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;At the end of processing a block&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Require &lt;code&gt;block.gas_used = gas_used_so_far&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;code&gt;block.gas_used&lt;&#x2F;code&gt; field will be defined in the section below.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;block-structure&quot;&gt;Block structure:&lt;&#x2F;h3&gt;
&lt;p&gt;We update &lt;code&gt;BlockHeader&lt;&#x2F;code&gt; field, to remove the &lt;code&gt;blob_gas_used&lt;&#x2F;code&gt;, &lt;code&gt;gas_used&lt;&#x2F;code&gt;, &lt;code&gt;base_fee_per_gas&lt;&#x2F;code&gt;, &lt;code&gt;gas_limit&lt;&#x2F;code&gt; and &lt;code&gt;excess_blob_gas&lt;&#x2F;code&gt; fields, and we add new fields, all of the &lt;code&gt;[int, int, int]&lt;&#x2F;code&gt; type: &lt;code&gt;gas_limits&lt;&#x2F;code&gt;, &lt;code&gt;gas_used&lt;&#x2F;code&gt;, &lt;code&gt;excess_gas&lt;&#x2F;code&gt;. The resulting RLP encoding becomes:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;rlp([&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    parent_hash,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347, # ommers hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    coinbase,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state_root,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    txs_root,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    receipts_root,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    logs_bloom,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    0, # difficulty&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    number,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    timestamp,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    extradata,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    prev_randao,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    0x0000000000000000, # nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    withdrawals_root,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_limits,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_used,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    excess_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;We define:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;get_block_gas_targets(parent: Header) -&amp;gt; [int, int, int]:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return [limit &#x2F;&#x2F; target_ratio for limit, target_ratio in zip(parent.gas_limits, LIMIT_TARGET_RATIOS)]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;We calculate the required &lt;code&gt;excess_gas&lt;&#x2F;code&gt; values as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def calc_excess_gas(parent: Header) -&amp;gt; [int, int, int]:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return vector_subtract_clamp_at_zero(vector_add(parent_excess, parent_used), get_block_gas_targets(parent))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;We calculate the required &lt;code&gt;gas_limits&lt;&#x2F;code&gt; as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;gas_limits[0]&lt;&#x2F;code&gt; must follow the existing adjustment formula&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;gas_limits[1]&lt;&#x2F;code&gt; must equal &lt;code&gt;MAX_BLOB_GAS_PER_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;gas_limits[2]&lt;&#x2F;code&gt; must equal &lt;code&gt;gas_limits[0] &#x2F;&#x2F; CALLDATA_GAS_LIMIT_RATIO&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Now, we define &lt;code&gt;get_block_basefees&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def get_block_basefees(parent: Header) -&amp;gt; [int, int, int]:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        fake_exponential(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            MIN_BASE_FEE_PER_GAS,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            excess_gas,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            target * BASE_FEE_UPDATE_FRACTION&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        for (excess_gas, target) in zip(parent.excess_gas, get_block_gas_targets(parent))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;conversion-of-all-gas-related-mechanics-into-vectors&quot;&gt;Conversion of all gas-related mechanics into vectors&lt;&#x2F;h3&gt;
&lt;p&gt;This allows the same logic that is used for handling gas to handle all three types of gas. As a result, it&#x27;s arguably a net simplification of protocol gas handling logic, despite the fact that the total number of gas types increases from 2 to 3&lt;&#x2F;p&gt;
&lt;h3 id=&quot;target-ratios&quot;&gt;Target ratios&lt;&#x2F;h3&gt;
&lt;p&gt;The target ratios for execution gas and blobs are set to 2; the target ratio for calldata is set to 4. This greatly decreases the number of scenarios in which calldata actually hits the limit, which mitigates economic impact of the EIP, because analysis of EIP-1559-style fee markets is much simpler in &quot;under-the-limit&quot; conditions than in &quot;at-the-limit&quot; conditions. Additionally, it reduces the risk that applications requiring large calldata will outright stop working.&lt;&#x2F;p&gt;
&lt;p&gt;The current parameters set the target calldata per block to 187,500 bytes, about 2x the current average. Using basic supply-and-demand reasoning, this implies that calldata is likely to become significantly cheaper as a result of this EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Previous transaction types set the calldata basefee and priority fee to equal each other. The calldata gas costs were intentionally set to be identical to today, and the gas target similar to present-day usage, so that setting the two fees to be equal each other is a reasonable approximation to optimal behavior. In practice, the new transaction type would be superior, so we expect users to switch to it over time. However, the loss suffered by old-style transaction users would not be that high, because priority fees are generally small compared to basefees, and the amount that a user pays is proportional to the basefee.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Optimal block building behavior becomes more complex as a result of this EIP, particularly under the boundary conditions when blocks are full of one or both types of gas. We argue that the effects of this are not too large, because in practice over 90% of blocks are under-full, and naive &quot;greedy algorithms&quot; can get a close-enough-to-optimal outcome. The centralization risks of proprietary block-building algorithms are thus likely to be much smaller than other existing risks with eg. MEV extraction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Incentivize Access List Provisioning</title>
        <published>2024-05-12T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Ben Adams</name><uri>https://github.com/benaadams</uri>
	</author>
	
	<author>
		<name>Oleg Iakushkin</name><uri>https://github.com/OlegJakushkin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7707/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7707-align-incentives-for-access-list-provisioning/20025" />
        

        <id>https://wg-eips.ritovision.com/7707/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7707"
            label="EIP-7707" />
        

        
        

        
        <summary type="html">This EIP proposes updating gas cost parameters for access lists to incentivise their use and improve transaction execution efficiency.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7707/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP reduces the gas cost of access list data, incentivizing the inclusion of complete and valid access lists in transactions to improve data load efficiency for execution layer clients.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;While &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930&lt;&#x2F;a&gt; introduced &lt;code&gt;accessLists&lt;&#x2F;code&gt; as a mechanism for &lt;code&gt;SLOAD&lt;&#x2F;code&gt;
pre-warming  to reduce gas costs by informing the EVM upfront about which storage slots a transaction will access,
the practical use is limited and uncommon due to the savings versus penalties involved. In order to break even for
each address included &lt;code&gt;24 storage keys&lt;&#x2F;code&gt; are required per address, and there is a &lt;code&gt;100 gas&lt;&#x2F;code&gt; saving per key at &lt;code&gt;25+&lt;&#x2F;code&gt;;
in contrast the penalty for including an unused key is &lt;code&gt;1900 gas&lt;&#x2F;code&gt;, so break-even where one key is unused is &lt;code&gt;43 keys&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This situation makes the break-even and risk-reward ratio of  &lt;code&gt;accessLists&lt;&#x2F;code&gt; rarely appealing in practice for regular
transactions, where a prior transaction could lead to a different branch being taken and a slightly different set of
storage slots being accessed. Furthermore, a very high number of SLOADs is required to start breaking even.&lt;&#x2F;p&gt;
&lt;p&gt;For some clients, data loading takes &lt;code&gt;&amp;gt;70%&lt;&#x2F;code&gt; of block execution time. This
happens in part due to sequential transaction execution and iterative
search of effectively random access data.&lt;&#x2F;p&gt;
&lt;p&gt;While NVMe drives have massive throughput and IOPS; this is their
concurrent throughput operated through multiple queues and they do not
have this performance if data is accessed completely sequentially with
one request waiting for the prior to complete i.e. stacking individual
IOPS latency end to end will not give anything close to maximal
throughput that these drives can deliver (which is different from the
HDD world where heads needed to seek to different physical locations for
each read). This is a similar situation with network attached storage or
cloud data disks; however the latency here is even more amplified than a
local direct CPU attached NVMe drive (i.e. via network card).&lt;&#x2F;p&gt;
&lt;p&gt;If nodes had a somewhat clearer picture of what data to pre-load for the
block&#x27;s execution; that can be done in parallel, hiding much of the
latency from accessing that data when discovered from executing the
transaction. Very much in a similar way to instruction pipelining on a
CPU hiding memory access latencies; the data access for transactions
could be pipelined. This can lead to faster&#x2F;cheaper block execution and
would facilitate data dependency hints for parallel Tx execution in the
future, like on other emerging chains that were developed with more
modern hardware in mind.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;We shall update &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930&lt;&#x2F;a&gt;
parameters:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ACCESS_LIST_STORAGE_KEY_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;320&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ACCESS_LIST_ADDRESS_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;512&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;As stated in the introduction the gas cost benefit analysis does not
encourage the users of the chain to provide accessList hints, even
though the mechanism is already in protocol (and a call to
&lt;code&gt;eth_createAccessList&lt;&#x2F;code&gt; will give them, or a wallet the correct list
to include). So we propose a reduction in the pricing of those data
access lists to make them more inline with calldata.&lt;&#x2F;p&gt;
&lt;p&gt;Levelling the playing field between small &lt;code&gt;call_data&lt;&#x2F;code&gt; and &lt;code&gt;access_lists&lt;&#x2F;code&gt;
costs, (and incentivise &lt;code&gt;access_lists&lt;&#x2F;code&gt; provisioning from transaction
senders as they are needed for transaction execution in a faster
manner), the price model updates would look as follows:&lt;&#x2F;p&gt;
&lt;p&gt;Use &lt;code&gt;STANDARD_TOKEN_COST * tokens_in_access_lists&lt;&#x2F;code&gt;, where
&lt;code&gt;tokens_in_access_lists = bytes_in_access_lists * 4&lt;&#x2F;code&gt;, making it as
expensive to send as plain small call data. So we will get:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;32*4*4  = 512&lt;&#x2F;code&gt; for addresses (instead of 2400, 4.6 times less)&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;20*4*4  = 320&lt;&#x2F;code&gt; for storage keys (instead of 1900, 5.9 times less)&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This means users pay for on-chain data inclusion as usual &lt;code&gt;call_data&lt;&#x2F;code&gt;. It
changes the original
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930&lt;&#x2F;a&gt; logic
of &quot;covering the bandwidth costs&quot;, which was not described in detail and
is potentially outdated.&lt;&#x2F;p&gt;
&lt;p&gt;It should be noted that this is not the first time &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930&lt;&#x2F;a&gt; additions have been proposed. In &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3521&#x2F;&quot;&gt;EIP-3521&lt;&#x2F;a&gt;, a reduction was already proposed, but it focused only on &lt;code&gt;ACCESS_LIST_ADDRESS_COST&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;examples&quot;&gt;Examples&lt;&#x2F;h3&gt;
&lt;p&gt;Current&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Inst&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Access List&lt;&#x2F;th&gt;&lt;th&gt;Keys for address&lt;&#x2F;th&gt;&lt;th&gt;OP Price&lt;&#x2F;th&gt;&lt;th&gt;AccessList Key Price&lt;&#x2F;th&gt;&lt;th&gt;AccessList Address Price&lt;&#x2F;th&gt;&lt;th&gt;Total gas per OP&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Cold&lt;&#x2F;td&gt;&lt;td&gt;Not included&lt;&#x2F;td&gt;&lt;td&gt;-&lt;&#x2F;td&gt;&lt;td&gt;2100&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;2100&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Warm&lt;&#x2F;td&gt;&lt;td&gt;Not included&lt;&#x2F;td&gt;&lt;td&gt;-&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Warm&lt;&#x2F;td&gt;&lt;td&gt;Included&lt;&#x2F;td&gt;&lt;td&gt;-&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;td&gt;-&lt;&#x2F;td&gt;&lt;td&gt;-&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Cold&lt;&#x2F;td&gt;&lt;td&gt;Included&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;td&gt;1900&lt;&#x2F;td&gt;&lt;td&gt;2400&lt;&#x2F;td&gt;&lt;td&gt;4400&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;None&lt;&#x2F;td&gt;&lt;td&gt;Included&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1900&lt;&#x2F;td&gt;&lt;td&gt;2400&lt;&#x2F;td&gt;&lt;td&gt;4300&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Cold&lt;&#x2F;td&gt;&lt;td&gt;Included&lt;&#x2F;td&gt;&lt;td&gt;10&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;td&gt;1900&lt;&#x2F;td&gt;&lt;td&gt;240&lt;&#x2F;td&gt;&lt;td&gt;2240&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;None&lt;&#x2F;td&gt;&lt;td&gt;Included&lt;&#x2F;td&gt;&lt;td&gt;10&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1900&lt;&#x2F;td&gt;&lt;td&gt;240&lt;&#x2F;td&gt;&lt;td&gt;2140&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Cold&lt;&#x2F;td&gt;&lt;td&gt;Included&lt;&#x2F;td&gt;&lt;td&gt;50&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;td&gt;1900&lt;&#x2F;td&gt;&lt;td&gt;48&lt;&#x2F;td&gt;&lt;td&gt;2048&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;None&lt;&#x2F;td&gt;&lt;td&gt;Included&lt;&#x2F;td&gt;&lt;td&gt;50&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1900&lt;&#x2F;td&gt;&lt;td&gt;48&lt;&#x2F;td&gt;&lt;td&gt;1948&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Proposed&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Inst&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Access List&lt;&#x2F;th&gt;&lt;th&gt;Keys for address&lt;&#x2F;th&gt;&lt;th&gt;OP Price&lt;&#x2F;th&gt;&lt;th&gt;AccessList Key Price&lt;&#x2F;th&gt;&lt;th&gt;AccessList Address Price&lt;&#x2F;th&gt;&lt;th&gt;Total gas per OP&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Cold&lt;&#x2F;td&gt;&lt;td&gt;Not included&lt;&#x2F;td&gt;&lt;td&gt;-&lt;&#x2F;td&gt;&lt;td&gt;2100&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;2100&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Warm&lt;&#x2F;td&gt;&lt;td&gt;Not included&lt;&#x2F;td&gt;&lt;td&gt;-&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Warm&lt;&#x2F;td&gt;&lt;td&gt;Included&lt;&#x2F;td&gt;&lt;td&gt;-&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;td&gt;-&lt;&#x2F;td&gt;&lt;td&gt;-&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Cold&lt;&#x2F;td&gt;&lt;td&gt;Included&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;td&gt;320&lt;&#x2F;td&gt;&lt;td&gt;512&lt;&#x2F;td&gt;&lt;td&gt;932&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;None&lt;&#x2F;td&gt;&lt;td&gt;Included&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;320&lt;&#x2F;td&gt;&lt;td&gt;512&lt;&#x2F;td&gt;&lt;td&gt;832&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Cold&lt;&#x2F;td&gt;&lt;td&gt;Included&lt;&#x2F;td&gt;&lt;td&gt;10&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;td&gt;320&lt;&#x2F;td&gt;&lt;td&gt;51.2&lt;&#x2F;td&gt;&lt;td&gt;471&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;None&lt;&#x2F;td&gt;&lt;td&gt;Included&lt;&#x2F;td&gt;&lt;td&gt;10&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;320&lt;&#x2F;td&gt;&lt;td&gt;51.2&lt;&#x2F;td&gt;&lt;td&gt;371&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Cold&lt;&#x2F;td&gt;&lt;td&gt;Included&lt;&#x2F;td&gt;&lt;td&gt;50&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;td&gt;320&lt;&#x2F;td&gt;&lt;td&gt;10.24&lt;&#x2F;td&gt;&lt;td&gt;430&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;None&lt;&#x2F;td&gt;&lt;td&gt;Included&lt;&#x2F;td&gt;&lt;td&gt;50&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;320&lt;&#x2F;td&gt;&lt;td&gt;10.24&lt;&#x2F;td&gt;&lt;td&gt;330&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;ul&gt;
&lt;li&gt;Already paid on making warm&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP makes a minor update to
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930&lt;&#x2F;a&gt; with
respect to modern execution challenges and capabilities.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Same as per
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>NONREENTRANT and REENTRANT opcodes</title>
        <published>2024-05-09T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Charles Cooper</name><uri>https://github.com/charles-cooper</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7705/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7705-nonreentrant-opcodes/19957" />
        

        <id>https://wg-eips.ritovision.com/7705/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:7705"
            label="EIP-7705" />
        

        
        

        
        <summary type="html">Opcodes to mark a contract as nonreentrant</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7705/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Add two opcodes, &lt;code&gt;NONREENTRANT&lt;&#x2F;code&gt; and &lt;code&gt;REENTRANT&lt;&#x2F;code&gt;, which set and clear a contract&#x27;s reentrancy status. After invoking &lt;code&gt;NONREENTRANT&lt;&#x2F;code&gt;, a contract cannot be &lt;code&gt;CALL&lt;&#x2F;code&gt;ed (or &lt;code&gt;STATICCALL&lt;&#x2F;code&gt;ed, or &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;ed) until &lt;code&gt;REENTRANT&lt;&#x2F;code&gt; is invoked.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Reentrancy attacks account for a substantial portion of user funds stolen on EVM chains, including the famous &quot;DAO hack&quot;. However, due to the cost of preventing reentrancy attacks in application code, developers often opt-out of reentrancy protection. This cost has come down with the advent of transient storage (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1153&#x2F;&quot;&gt;EIP-1153&lt;&#x2F;a&gt;), but it is still not cheap enough where it is a &quot;no-brainer&quot; to use it by default. This EIP proposes opcodes which make it cheaper to protect against reentrancy in application code.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;Two new opcodes are introduced, &lt;code&gt;NONREENTRANT&lt;&#x2F;code&gt; (0xF6) and &lt;code&gt;REENTRANT&lt;&#x2F;code&gt; (0xF7), which set and clear a contract&#x27;s nonreentrancy flag. The effect of invoking &lt;code&gt;NONREENTRANT&lt;&#x2F;code&gt; is that a contract can no longer have execution context transferred to it (via any of the &lt;code&gt;*CALL&lt;&#x2F;code&gt; opcodes), until &lt;code&gt;REENTRANT&lt;&#x2F;code&gt; is invoked. &lt;code&gt;CALL&lt;&#x2F;code&gt;ing a contract which has the nonreentrancy flag set is equivalent to executing a single &lt;code&gt;REVERT&lt;&#x2F;code&gt; opcode.&lt;&#x2F;p&gt;
&lt;p&gt;Both &lt;code&gt;NONREENTRANT&lt;&#x2F;code&gt; and &lt;code&gt;REENTRANT&lt;&#x2F;code&gt; are idempotent; that is, invoking &lt;code&gt;NONREENTRANT&lt;&#x2F;code&gt; when a contract already has nonreentrant status is a no-op, and likewise for &lt;code&gt;REENTRANT&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The scope of the nonreentrant flag is limited to the current transaction. That is, nonreentrant flags are cleared at the end of every transaction. In the presence of reversion (&lt;code&gt;REVERT&lt;&#x2F;code&gt; or exceptional halt), the contract&#x27;s nonreentrancy flag reverts to whatever its value was before the call.&lt;&#x2F;p&gt;
&lt;p&gt;The cost of &lt;code&gt;NONREENTRANT&lt;&#x2F;code&gt; and &lt;code&gt;REENTRANT&lt;&#x2F;code&gt; are both set at 5 (&lt;code&gt;G_mid&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The computational cost of pushing the current value to the call stack (for handling reverts) is accounted for in the overhead cost of the &lt;code&gt;*CALL&lt;&#x2F;code&gt; opcodes.&lt;&#x2F;p&gt;
&lt;p&gt;An alternative design could be considered which only introduces one opcode. This opcode, &lt;code&gt;NONREENTRANT&lt;&#x2F;code&gt;, would take a single stack item and set the nonreentrancy flag based on its value. This alternative design can be considered based on feedback.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Set Code for EOAs</title>
        <published>2024-05-07T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	<author>
		<name>Sam Wilson</name><uri>https://github.com/SamWilsn</uri>
	</author>
	
	<author>
		<name>Ansgar Dietrichs</name><uri>https://github.com/adietrichs</uri>
	</author>
	
	<author>
		<name>lightclient</name><uri>https://github.com/lightclient</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7702/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-set-eoa-account-code-for-one-transaction/19923" />
        

        <id>https://wg-eips.ritovision.com/7702/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7702"
            label="EIP-7702" />
        

        
        

        
        <summary type="html">Add a new tx type that permanently sets the code for an EOA</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7702/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Add a new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; transaction type that allows Externally
Owned Accounts (EOAs) to set the code in their account. This is done by
attaching a list of authorization tuples -- individually formatted as &lt;code&gt;[chain_id, address, nonce, y_parity, r, s]&lt;&#x2F;code&gt; -- to the transaction. For each tuple, a
delegation indicator &lt;code&gt;(0xef0100 || address)&lt;&#x2F;code&gt; is written to the authorizing
account&#x27;s code. All code executing operations must load and execute the code
pointed to by the delegation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Despite great advances in the smart contract wallet ecosystem, EOAs have held
back broad adoption of UX improvements across applications. This EIP therefore
focuses on adding short-term functionality improvements to EOAs which will allow
UX improvements to permeate through the entire application stack. Three
particular features this EIP is designed around are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Batching&lt;&#x2F;strong&gt;: allowing multiple operations from the same user in one atomic
transaction. One common example is an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; approval followed by
spending that approval. This is a common workflow in DEXes that requires two
transactions today. Advanced use cases of batching occasionally involve
dependencies: the output of the first operation is part of the input to the
second operation.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Sponsorship&lt;&#x2F;strong&gt;: account X pays for a transaction on behalf of account Y.
Account X could be paid in some other ERC-20 for this service, or it could be an
application operator including the transactions of its users for free.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Privilege de-escalation&lt;&#x2F;strong&gt;: users can sign sub-keys and give them specific
permissions that are much weaker than global access to the account. For example,
a permission to spend ERC-20 tokens but not ETH, or to spend up to 1% of the
total balance per day, or to interact only with a specific application.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SET_CODE_TX_TYPE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x04&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAGIC&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x05&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;PER_AUTH_BASE_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;12500&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;PER_EMPTY_ACCOUNT_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;25000&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;set-code-transaction&quot;&gt;Set code transaction&lt;&#x2F;h3&gt;
&lt;p&gt;A new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; transaction known as the &quot;set code transaction&quot;
is introduced, where the &lt;code&gt;TransactionType&lt;&#x2F;code&gt; is &lt;code&gt;SET_CODE_TX_TYPE&lt;&#x2F;code&gt; and the
&lt;code&gt;TransactionPayload&lt;&#x2F;code&gt; is the RLP serialization of the following:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;rlp([chain_id, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;destination, value, data, access_list, authorization_list, signature_y_parity,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;signature_r, signature_s])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;authorization_list = [[chain_id, address, nonce, y_parity, r, s], ...]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The fields &lt;code&gt;chain_id&lt;&#x2F;code&gt;, &lt;code&gt;nonce&lt;&#x2F;code&gt;, &lt;code&gt;max_priority_fee_per_gas&lt;&#x2F;code&gt;, &lt;code&gt;max_fee_per_gas&lt;&#x2F;code&gt;,
&lt;code&gt;gas_limit&lt;&#x2F;code&gt;, &lt;code&gt;destination&lt;&#x2F;code&gt;, &lt;code&gt;value&lt;&#x2F;code&gt;, &lt;code&gt;data&lt;&#x2F;code&gt;, and &lt;code&gt;access_list&lt;&#x2F;code&gt; of the outer
transaction follow the same semantics as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt;. &lt;em&gt;Note, this
implies a null destination is not valid.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;signature_y_parity, signature_r, signature_s&lt;&#x2F;code&gt; elements of this transaction
represent a secp256k1 signature over &lt;code&gt;keccak256(SET_CODE_TX_TYPE || TransactionPayload)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;authorization_list&lt;&#x2F;code&gt; is a list of tuples that indicate what code the signer
of each tuple desires to execute in the context of their EOA. The transaction is
considered invalid if the length of &lt;code&gt;authorization_list&lt;&#x2F;code&gt; is zero.&lt;&#x2F;p&gt;
&lt;p&gt;The transaction is also considered invalid when any field in an authorization
tuple cannot fit within the following bounds:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;chain_id&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;auth&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;y_parity&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; &lt;code&gt;ReceiptPayload&lt;&#x2F;code&gt; for this transaction is
&lt;code&gt;rlp([status, cumulative_transaction_gas_used, logs_bloom, logs])&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;behavior&quot;&gt;Behavior&lt;&#x2F;h4&gt;
&lt;p&gt;The authorization list is processed before the execution portion of the
transaction begins, but after the sender&#x27;s nonce is incremented.&lt;&#x2F;p&gt;
&lt;p&gt;For each &lt;code&gt;[chain_id, address, nonce, y_parity, r, s]&lt;&#x2F;code&gt; tuple, perform the
following:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Verify the chain ID is 0 or the ID of the current chain.&lt;&#x2F;li&gt;
&lt;li&gt;Verify the &lt;code&gt;nonce&lt;&#x2F;code&gt; is less than &lt;code&gt;2**64 - 1&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Let &lt;code&gt;authority = ecrecover(msg, y_parity, r, s)&lt;&#x2F;code&gt;.
&lt;ul&gt;
&lt;li&gt;Where &lt;code&gt;msg = keccak(MAGIC || rlp([chain_id, address, nonce]))&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Verify &lt;code&gt;s&lt;&#x2F;code&gt; is less than or equal to &lt;code&gt;secp256k1n&#x2F;2&lt;&#x2F;code&gt;, as specified in
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2&#x2F;&quot;&gt;EIP-2&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Add &lt;code&gt;authority&lt;&#x2F;code&gt; to &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt;, as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Verify the code of &lt;code&gt;authority&lt;&#x2F;code&gt; is empty or already delegated.&lt;&#x2F;li&gt;
&lt;li&gt;Verify the nonce of &lt;code&gt;authority&lt;&#x2F;code&gt; is equal to &lt;code&gt;nonce&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Add &lt;code&gt;PER_EMPTY_ACCOUNT_COST - PER_AUTH_BASE_COST&lt;&#x2F;code&gt; gas to the global refund
counter if &lt;code&gt;authority&lt;&#x2F;code&gt; is not empty.&lt;&#x2F;li&gt;
&lt;li&gt;Set the code of &lt;code&gt;authority&lt;&#x2F;code&gt; to be &lt;code&gt;0xef0100 || address&lt;&#x2F;code&gt;. This is a delegation
indicator.
&lt;ul&gt;
&lt;li&gt;If &lt;code&gt;address&lt;&#x2F;code&gt; is &lt;code&gt;0x0000000000000000000000000000000000000000&lt;&#x2F;code&gt;, do not write
the delegation indicator. Clear the account&#x27;s code by resetting the account&#x27;s
code hash to the empty code hash
&lt;code&gt;0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Increase the nonce of &lt;code&gt;authority&lt;&#x2F;code&gt; by one.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;If any step above fails, immediately stop processing the tuple and continue to
the next tuple in the list. When multiple tuples from the same authority are
present, set the code using the address in the last valid occurrence.&lt;&#x2F;p&gt;
&lt;p&gt;Note, if transaction execution results in failure (e.g. any exceptional
condition or code reverting), the processed delegation indicators is &lt;em&gt;not rolled
back&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;delegation-indicator&quot;&gt;Delegation indicator&lt;&#x2F;h5&gt;
&lt;p&gt;Delegation indicators use the banned opcode &lt;code&gt;0xef&lt;&#x2F;code&gt;, defined in
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3541&#x2F;&quot;&gt;EIP-3541&lt;&#x2F;a&gt;, to indicate that the code must be handled differently
than regular code. The delegation forces all code executing operations to follow
the address pointer to obtain the code to execute. For example, &lt;code&gt;CALL&lt;&#x2F;code&gt; loads the
code at &lt;code&gt;address&lt;&#x2F;code&gt; and executes it in the context of &lt;code&gt;authority&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The affected executing operations are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;CALL&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CALLCODE&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;STATICCALL&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;any transaction where &lt;code&gt;destination&lt;&#x2F;code&gt; points to an address with a delegation
indicator present&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;For code reading, only &lt;code&gt;CODESIZE&lt;&#x2F;code&gt; and &lt;code&gt;CODECOPY&lt;&#x2F;code&gt; instructions are affected. They
operate directly on the executing code instead of the delegation. For example,
when executing a delegated account &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; returns &lt;code&gt;23&lt;&#x2F;code&gt; (the size of
&lt;code&gt;0xef0100 || address&lt;&#x2F;code&gt;) whereas &lt;code&gt;CODESIZE&lt;&#x2F;code&gt; returns the size of the code residing
at &lt;code&gt;address&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Note, this means during delegated execution &lt;code&gt;CODESIZE&lt;&#x2F;code&gt; and &lt;code&gt;CODECOPY&lt;&#x2F;code&gt; produce a
different result compared to calling &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; and &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt; on the
authority.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h6 id=&quot;precompiles&quot;&gt;Precompiles&lt;&#x2F;h6&gt;
&lt;p&gt;When a precompile address is the target of a delegation, the retrieved code is
considered empty and &lt;code&gt;CALL&lt;&#x2F;code&gt;, &lt;code&gt;CALLCODE&lt;&#x2F;code&gt;, &lt;code&gt;STATICCALL&lt;&#x2F;code&gt;, &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;
instructions targeting this account will execute empty code, and therefore
succeed with no execution when given enough gas to initiate the call.&lt;&#x2F;p&gt;
&lt;h6 id=&quot;loops&quot;&gt;Loops&lt;&#x2F;h6&gt;
&lt;p&gt;In case a delegation indicator points to another delegation, creating a
potential chain or loop of delegations, clients must retrieve only the first
code and then stop following the delegation chain.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;gas-costs&quot;&gt;Gas Costs&lt;&#x2F;h4&gt;
&lt;p&gt;The intrinsic cost of the new transaction is inherited from
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930&lt;&#x2F;a&gt;, specifically &lt;code&gt;21000 + 16 * non-zero calldata bytes + 4 * zero calldata bytes + 1900 * access list storage key count + 2400 * access list address count&lt;&#x2F;code&gt;. Additionally, add a cost of &lt;code&gt;PER_EMPTY_ACCOUNT_COST * authorization list length&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The transaction sender will pay for all authorization tuples, regardless of
validity or duplication.&lt;&#x2F;p&gt;
&lt;p&gt;If a code executing instruction accesses a cold account during the resolution of
delegated code, add an additional &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;
&lt;code&gt;COLD_ACCOUNT_READ_COST&lt;&#x2F;code&gt; cost of &lt;code&gt;2600&lt;&#x2F;code&gt; gas to the normal cost and add the
account to &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt;. Otherwise, assess a &lt;code&gt;WARM_STORAGE_READ_COST&lt;&#x2F;code&gt;
cost of &lt;code&gt;100&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;transaction-origination&quot;&gt;Transaction origination&lt;&#x2F;h4&gt;
&lt;p&gt;Modify the restriction put in place by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3607&#x2F;&quot;&gt;EIP-3607&lt;&#x2F;a&gt; to allow EOAs
whose code is a valid delegation indicator, i.e. &lt;code&gt;0xef0100 || address&lt;&#x2F;code&gt;, to
originate transactions. Accounts with any other code values may not originate
transactions.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, if a transaction&#x27;s &lt;code&gt;destination&lt;&#x2F;code&gt; has a delegation indicator, add
the target of the delegation to &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Below is the rationale for both general design directions of the EIP, as well as
specific technical choices.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;general-design-philosophy&quot;&gt;General design philosophy&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;persistence-of-code-delegation&quot;&gt;Persistence of code delegation&lt;&#x2F;h4&gt;
&lt;p&gt;The first draft of this proposal had a clever idea to avoid disagreement on
whether in-protocol revocation was needed or not. The idea was to temporarily
set code in the account with the authorization. After the transaction finished,
the code would be completely cleared. This was a new design space for enriching
EOA functionality.&lt;&#x2F;p&gt;
&lt;p&gt;Even this approach was not without its flaws. Fundamentally, there was not much
friction for users including set code authorizations. This meant that some users
and applications would opt to treat the extension as more of a scripting
facility, rather than a full-fledged upgrade to a smart contract wallet. The
outcome of this would be two somewhat competing workstreams for UX improvements:
smart contract wallets and EOA scripts.&lt;&#x2F;p&gt;
&lt;p&gt;Previous proposals had been met with similar criticisms. To counteract this,
persistent delegations were introduced. They create enough friction in
deployment that users will not deploy new, unique ones regularly. This will
hopefully unify the workstreams and minimize fragmentation in UX developments.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;no-initcode&quot;&gt;No initcode&lt;&#x2F;h4&gt;
&lt;p&gt;Running initcode is not desirable for many reasons. It creates a new mode of
execution that needs extensive testing, and may be used for purposes not
possible with standard smart contract wallets. It also forces developers to
perform initialization as a standard call to the EOA after delegation. The lack
of atomicity in these operations is another factor that will push users to
complete smart contract wallet solutions, instead of EOA scripts.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, initcode tends to be propagated inside the transaction calldata.
This means it would need to be included in the authorization tuple and signed
over. The minimum initcode is around 15 bytes -- it would simply copy the
contract code from an external address. The total cost would be &lt;code&gt;16 * 15 = 240&lt;&#x2F;code&gt;
calldata cost, plus the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3860&#x2F;&quot;&gt;EIP-3860&lt;&#x2F;a&gt; cost of &lt;code&gt;2 * 15 = 30&lt;&#x2F;code&gt;, plus
the runtime costs of around &lt;code&gt;150&lt;&#x2F;code&gt;. So nearly &lt;code&gt;500&lt;&#x2F;code&gt; additional gas would be spent
preparing the account. Even more likely, 1200+ gas if not copying from an
external account.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;creation-by-template&quot;&gt;Creation by template&lt;&#x2F;h4&gt;
&lt;p&gt;Initcode or not, there is a question of how users should specify the code they
intend to run in their account. The two main options are to specify the bytecode
directly in the transaction or to specify a pointer to the code. The simplest
pointer would just be the address of code deployed on-chain.&lt;&#x2F;p&gt;
&lt;p&gt;The cost analysis makes the answer clear. The smallest proxy would be around 50
bytes and an address is 20 bytes. The 30 byte difference provides no useful
additional functionality and will be inefficiently replicated billions of times.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore, specifying code directly would again make it possible for EOAs to
have a new, unique ability to execute arbitrary code specified in the
transaction calldata. It is for these reasons that creation by template is
chosen.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;interaction-with-applications-and-wallets&quot;&gt;Interaction with applications and wallets&lt;&#x2F;h4&gt;
&lt;p&gt;While this EIP provides a lot of flexibility to applications and EOAs, there are
incorrect ways of using it. Applications &lt;strong&gt;must not&lt;&#x2F;strong&gt; expect that they can
suggest the user sign an authorization, and therefore it is the duty of the
wallet to not provide an interface to do so.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;There is no safe way to provide this interface&lt;&#x2F;strong&gt;. The code specified by an
authorization has unrestricted access to the account and must always be closely
audited by the wallet. Few users have the level of sophistication to reasonably
verify the code they are delegating to.&lt;&#x2F;p&gt;
&lt;p&gt;It is also not possible to implement a system of permissions at this level to
minimize the risk. If applications require custom wallet functionality, they
must use standardized extension &#x2F; module systems built on top of the delegated
code that correctly implements permissions.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;forward-compatibility-with-future-account-abstraction&quot;&gt;Forward-compatibility with future account abstraction&lt;&#x2F;h4&gt;
&lt;p&gt;This EIP is designed to be forward-compatible with endgame account abstraction,
without over-enshrining any fine-grained details of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt; or
RIP-7560.&lt;&#x2F;p&gt;
&lt;p&gt;To start, the &lt;code&gt;address&lt;&#x2F;code&gt; that users sign could directly point to existing
ERC-4337 wallet code. This essentially requires the &quot;code pathways&quot; that are
used are code pathways that would, in most cases, continue to make sense in a
pure-smart-contract-wallet world. Hence, it avoids the problem of creating two
separate UX workstreams because, to a large extent, they would be the same
ecosystem.&lt;&#x2F;p&gt;
&lt;p&gt;There will be some workflows that require kludges under this solution that would
be better done in some different &quot;more native&quot; under &quot;endgame AA&quot;, but this is
relatively a small subset. The EIP does not require adding any opcodes, that
would become dangling and useless in a post-EOA world, and it allows EOAs to
masquerade as contracts to be included in ERC-4337 bundles, in a way that&#x27;s
compatible with the existing &lt;code&gt;EntryPoint&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;self-sponsoring-allowing-tx-origin-to-set-code&quot;&gt;Self-sponsoring: allowing &lt;code&gt;tx.origin&lt;&#x2F;code&gt; to set code&lt;&#x2F;h4&gt;
&lt;p&gt;Allowing &lt;code&gt;tx.origin&lt;&#x2F;code&gt; to set code and execute its own delegated code enables what
is called self-sponsoring. It allows users to take advantage of EIP-7702 without
relying on any third party infrastructure.&lt;&#x2F;p&gt;
&lt;p&gt;However, that means the EIP breaks the invariant that &lt;code&gt;msg.sender == tx.origin&lt;&#x2F;code&gt;
only happens in the topmost execution frame of a transaction. This will affect
smart contracts containing &lt;code&gt;require(msg.sender == tx.origin)&lt;&#x2F;code&gt; style checks. This
check is used for at least three purposes:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Ensuring that &lt;code&gt;msg.sender&lt;&#x2F;code&gt; is an EOA (given that &lt;code&gt;tx.origin&lt;&#x2F;code&gt; always has to be
an EOA). This invariant does not depend on the execution layer depth and,
therefore, is not affected.&lt;&#x2F;li&gt;
&lt;li&gt;Protecting against atomic sandwich attacks like flash loans, which rely on
the ability to modify state before and after the execution of the target
contract as part of the same atomic transaction. This protection would be broken
by this EIP. However, relying on &lt;code&gt;tx.origin&lt;&#x2F;code&gt; in this way is considered bad
practice, and can already be circumvented by miners conditionally including
transactions in a block.&lt;&#x2F;li&gt;
&lt;li&gt;Preventing reentrancy.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Examples of (1) and (2) can be found in contracts deployed on Ethereum mainnet,
with (1) being more common (and unaffected by this proposal). On the other hand,
use case (3) is more severely affected by this proposal, but the authors of this
EIP did not find any examples of this form of reentrancy protection, though the
search was non-exhaustive.&lt;&#x2F;p&gt;
&lt;p&gt;This distribution of occurrences—many (1), some (2), and no (3)—is exactly what
the authors of this EIP expect because:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Determining if &lt;code&gt;msg.sender&lt;&#x2F;code&gt; is an EOA without &lt;code&gt;tx.origin&lt;&#x2F;code&gt; is difficult, if not
impossible.&lt;&#x2F;li&gt;
&lt;li&gt;The only execution context which is safe from atomic sandwich attacks is the
topmost context, and &lt;code&gt;tx.origin == msg.sender&lt;&#x2F;code&gt; is the only way to detect that
context.&lt;&#x2F;li&gt;
&lt;li&gt;In contrast, there are many direct and flexible ways of preventing reentrancy
(e.g., using a transient storage variable). Since &lt;code&gt;msg.sender == tx.origin&lt;&#x2F;code&gt; is
only true in the topmost context, it would make an obscure tool for preventing
reentrancy, rather than other more common approaches.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;There are other approaches to mitigate this restriction which do not break the
invariant:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Set &lt;code&gt;tx.origin&lt;&#x2F;code&gt; to a constant &lt;code&gt;ENTRY_POINT&lt;&#x2F;code&gt; address when using the &lt;code&gt;CALL*&lt;&#x2F;code&gt;
instruction in the context of an EOA.&lt;&#x2F;li&gt;
&lt;li&gt;Set &lt;code&gt;tx.origin&lt;&#x2F;code&gt; to a special address derived from the sender or signer
addresses.&lt;&#x2F;li&gt;
&lt;li&gt;Disallow &lt;code&gt;tx.origin&lt;&#x2F;code&gt; from setting code. This would make the simple batching
use cases impossible, but could be relaxed in the future.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;rationale-for-technical-details&quot;&gt;Rationale for technical details&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;cost-of-delegation&quot;&gt;Cost of delegation&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;PER_AUTH_BASE_COST&lt;&#x2F;code&gt; is the cost to process the authorization tuple and set
the delegation destination. To compute a fair cost for this operation, the
authors review its impact on the system:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;ferry 101 bytes of calldata = &lt;code&gt;101 * non-zero cost (16) = 1616&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;recovering the &lt;code&gt;authority&lt;&#x2F;code&gt; address = &lt;code&gt;3000&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;reading the nonce and code of &lt;code&gt;authority&lt;&#x2F;code&gt; = &lt;code&gt;2600&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;storing values in already warm account = &lt;code&gt;200&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;cost to deploy code = &lt;code&gt;200 * 23 = 4600&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The impact-based assessment identifies &lt;code&gt;12016&lt;&#x2F;code&gt; gas of comparable computation for
the operation. It is rounded up to &lt;code&gt;12500&lt;&#x2F;code&gt; to account for miscellaneous costs
associated with shuttling data around the state transition.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;clearing-delegation-indicators&quot;&gt;Clearing delegation indicators&lt;&#x2F;h4&gt;
&lt;p&gt;A general design goal in state transition changes is to minimize the number of
special cases an EIP has. In early iterations, this EIP resisted a special case
for clearing an account&#x27;s delegation indicator.&lt;&#x2F;p&gt;
&lt;p&gt;For most intents and purposes, an account delegated to &lt;code&gt;0x0&lt;&#x2F;code&gt; is
indistinguishable from a true EOA. However, one particular unfortunate case is
unavoidable. Even if a user has a zeroed out delegation indicator, most
operations that interact with that account will incur an additional
&lt;code&gt;COLD_ACCOUNT_READ_COST&lt;&#x2F;code&gt; upon the first touch caused by attempting to load the
code at &lt;code&gt;0x0&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;For this reason, the authors have opted to include a special case which allow
users to restore their EOA to its original purity.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;lack-of-instruction-prohibition&quot;&gt;Lack of instruction prohibition&lt;&#x2F;h4&gt;
&lt;p&gt;Consistency is a valuable property in the EVM, both from an implementation
perspective and a user-understanding-perspective. Despite considering bans on
several families of instructions in the context of EOAs, the authors feel there
is not a compelling reason to do so, as it would cause smart contract wallets
and EOA smart contract wallets to proceed down distinct UX workstreams.&lt;&#x2F;p&gt;
&lt;p&gt;The main instruction families where a ban was considered were storage related
and contract creation related. The decision to not ban storage instructions
hinged mostly on their importance to smart contract wallets. Although it&#x27;s
possible to have an external storage contract that the smart contract wallet
calls into, it is unnecessarily complicated and inefficient. In the future, new
state schemes may allow substantially cheaper access to certain storage slots
within an account. This is something smart contract wallets will want to take
advantage of that a storage contract wouldn&#x27;t support.&lt;&#x2F;p&gt;
&lt;p&gt;Creation instructions were considered for a ban as well on other similar EIPs,
however because this EIP allows EOAs to spend value intra-transaction, the
concern with bumping the nonce intra-transaction and invalidating pending
transactions is not significant.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;protection-from-malleability-cross-chain&quot;&gt;Protection from malleability cross-chain&lt;&#x2F;h4&gt;
&lt;p&gt;One consideration when signing a code pointer is what code that address points
to on another chain. While it is possible to create a deterministic deployment,
i.e. via Nick&#x27;s method, verifying such a deployment may not always be desirable.
In such situations, the chain ID can be set to reduce the scope of the
authorization. When universal deployment is preferred, simply set chain ID to 0.&lt;&#x2F;p&gt;
&lt;p&gt;An alternative to adding chain ID could be to substitute in the actual code for
the address in the signature. This seems to have the benefit of both minimizing
the on-chain size of auth tuples, by continuing to serialize only the address,
while retaining specificity of the actual code running in the account, by
pulling in the code for the signature. One unfortunate issue of this format,
though, is that it imposes a database lookup to determine the signer of each
auth tuple. This imposition itself seems to create enough complexity in
transaction propagation that it is decided to avoid and simply sign over the
address directly.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;delegation-of-code-execution-only&quot;&gt;Delegation of code execution only&lt;&#x2F;h4&gt;
&lt;p&gt;Other code retrieving operations like &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; do not automatically follow
delegations, they operate on the delegation indicator itself. If instead
delegations were followed, an account would be able to temporarily masquerade as
having a particular codehash, which would break contracts that rely on
codehashes as a definition of possible account behavior. A change of behavior in
a contract is currently only possible if its code explicitly allows it (in
particular via &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;), and a change of codehash is only possible in the
presence of &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; (which, as of Cancun, only applies in the same
transaction as contract creation), so choosing to follow delegations in
&lt;code&gt;EXTCODE*&lt;&#x2F;code&gt; opcodes would have created a new type of account breaking prior
assumptions.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;charge-maximum-cost-upfront&quot;&gt;Charge maximum cost upfront&lt;&#x2F;h4&gt;
&lt;p&gt;While computing the intrinsic gas cost, the transaction is charged the
worst-case cost for each delegation. Later, while processing the authorization
list, a refund is issued if the account already exists in state. This mechanism
is designed to avoid state lookups for each authorization when computing the
intrinsic gas and can quickly determine the validity of the transaction with
only a state lookup on the sender&#x27;s account.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;no-blobs-no-contract-creation&quot;&gt;No blobs, no contract creation&lt;&#x2F;h4&gt;
&lt;p&gt;Transactions should be thought of as specialized tools and not necessarily a
one-type-does-all solution. EIP-4844 is treated differently at the p2p level due
to burden blobs place on a node&#x27;s bandwidth. EIP-7702 has different implications
on transaction gossiping and there is no need to complicate those rules
unnecessarily by making it a superset of all possible functionality. The authors
ultimately do not expect there to be much demand for atomic delegation and blob
submission.&lt;&#x2F;p&gt;
&lt;p&gt;Contract creation is another specialized use case that has been grandfathered
into several transaction types. It adds complexity to testing, because it is a
new distinct branch of execution that needs to be tested when any change to the
EVM occurs and verify the change works as expected in that context.&lt;&#x2F;p&gt;
&lt;p&gt;For these reasons, the authors have chosen to keep the scope of the EIP focused
on improving UX.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;disallow-delegation-to-precompiles&quot;&gt;Disallow delegation to precompiles&lt;&#x2F;h4&gt;
&lt;p&gt;Precompiles are themselves edge cases, so allowing delegations to precompiles or
not requires some focus in implementation. Considering the fact that precompiles
technically do not have code associated with their accounts, the authors decided
it would be marginally simpler to not execute the precompile logic when a user
delegates to one. This is somewhat unintuitive.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;non-empty-authorization-list-required&quot;&gt;Non-empty authorization list required&lt;&#x2F;h4&gt;
&lt;p&gt;Set code transactions are required to have at least one authorization to be
considered valid. This is to disincentivize senders from using type 4
transactions as a generic transaction format, because this transaction has
different implications on the transaction pool than, say,
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; transactions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP breaks a few invariants:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;An account balance can only decrease as a result of a transaction originating
from that account.
&lt;ul&gt;
&lt;li&gt;Once an account has been delegated, any call to the account may also cause
the balance to decrease.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;An EOA nonce may not increase after transaction execution has begun.
&lt;ul&gt;
&lt;li&gt;Once an account has been delegated, the account may call a create operation
during execution, causing the nonce to increase.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;tx.origin == msg.sender&lt;&#x2F;code&gt; can only be true in the topmost frame of execution.
&lt;ul&gt;
&lt;li&gt;Once an account has been delegated, it can invoke multiple calls per
transaction.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;implementation-of-secure-delegate-contracts&quot;&gt;Implementation of secure delegate contracts&lt;&#x2F;h3&gt;
&lt;p&gt;The following is a non-exhaustive list of pitfalls that delegate contracts
&lt;em&gt;should&lt;&#x2F;em&gt; be wary of and require a signature over from the account&#x27;s authority:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Replay protection (e.g., a nonce) should be implemented by the delegate and
signed over. Without it, a malicious actor can reuse a signature, repeating its
effects.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;value&lt;&#x2F;code&gt; -- without it, a malicious sponsor could cause unexpected effects in
the callee.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;gas&lt;&#x2F;code&gt; -- without it, a malicious sponsor could cause the callee to run out of
gas and fail, griefing the sponsee.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;target&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;calldata&lt;&#x2F;code&gt; -- without them, a malicious actor may call arbitrary
functions in arbitrary contracts.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;A poorly implemented delegate can &lt;em&gt;allow a malicious actor to take near complete
control over a signer&#x27;s EOA&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;front-running-initialization&quot;&gt;Front running initialization&lt;&#x2F;h3&gt;
&lt;p&gt;Smart contract wallet developers must consider the implications of setting code
in an account without execution. Contracts are normally deployed by executing
initcode to determine the exact code to be placed in the account. This gives
developers the opportunity to initialize storage slots at the same time. The
initial values of the account cannot be replaced by an observer, because they
are either signed over by an EOA in the case of a creation transaction or they
are committed to by computing the contract&#x27;s address deterministically from the
hash of the initcode.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP does not provide developers the opportunity to run initcode and set
storage slots during delegation. To secure the account from an observer
front-running the initialization of the delegation with an account they control,
smart contract wallet developers must verify the initial calldata to the account
for setup purposes be signed by the EOA&#x27;s key using ecrecover. This ensures the
account can only be initialized with desirable values.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;storage-management&quot;&gt;Storage management&lt;&#x2F;h3&gt;
&lt;p&gt;Changing an account&#x27;s delegation is a security-critical operation that should
not be done lightly, especially if the newly delegated code is not purposely
designed and tested as an upgrade to the old one.&lt;&#x2F;p&gt;
&lt;p&gt;In particular, in order to ensure a safe migration of an account from one
delegate contract to another, it&#x27;s important for these contracts to use storage
in a way that avoids accidental collisions among them. For example, using
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7201&#x2F;&quot;&gt;ERC-7201&lt;&#x2F;a&gt; a contract may root its storage layout at a slot
dependent on a unique identifier. To simplify this, smart contract languages may
provide a way of re-rooting the entire storage layout of existing contract
source code.&lt;&#x2F;p&gt;
&lt;p&gt;If all contracts previously delegated to by the account used the approach
described above, a migration should not cause any issues. However, if there is
any doubt, it is recommended to first clear all account storage, an operation
that is not natively offered by the protocol but that a special-purpose delegate
contract can be designed to implement.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;setting-code-as-tx-origin&quot;&gt;Setting code as &lt;code&gt;tx.origin&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Allowing the sender of an EIP-7702 to also set code has the possibility to:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Break atomic sandwich protections which rely on &lt;code&gt;tx.origin&lt;&#x2F;code&gt;;&lt;&#x2F;li&gt;
&lt;li&gt;Break reentrancy guards of the style &lt;code&gt;require(tx.origin == msg.sender)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The authors of this EIP believe the risks of allowing this are acceptable for
the reasons outlined in the Rationale section.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;sponsored-transaction-relayers&quot;&gt;Sponsored transaction relayers&lt;&#x2F;h3&gt;
&lt;p&gt;It is possible for the &lt;code&gt;authorized&lt;&#x2F;code&gt; account to cause sponsored transaction
relayers to spend gas without being reimbursed by either invalidating the
authorization (i.e., increasing the account&#x27;s nonce) or by sweeping the relevant
assets out of the account. Relayers should be designed with these cases in mind,
possibly by requiring a bond to be deposited or by implementing a reputation
system.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;transaction-propagation&quot;&gt;Transaction propagation&lt;&#x2F;h3&gt;
&lt;p&gt;Allowing EOAs to behave as smart contracts via the delegation indicator poses
some challenges for transaction propagation. Traditionally, EOAs have only been
able to send value via a transaction. This invariant allows nodes to statically
determine the validity of transactions for that account. In other words, a
single transaction has only been able to invalidate transactions pending from
the sender&#x27;s account.&lt;&#x2F;p&gt;
&lt;p&gt;With this EIP, it becomes possible to cause transactions from other accounts to
become stale. This is due to the fact that once an EOA has delegated to code,
that code can be called by anyone at any point in a transaction. It becomes
impossible to know if the balance of the account has been swept in a static
manner.&lt;&#x2F;p&gt;
&lt;p&gt;While there are a few mitigations for this, the authors recommend that clients
do not accept more than one pending transaction for any EOA with a non-zero
delegation indicator. This minimizes the number of transactions that can be
invalidated by a single transaction.&lt;&#x2F;p&gt;
&lt;p&gt;An alternative would be to expand the EIP-7702 transaction with a list of
accounts the caller wishes to &quot;hydrate&quot; during the transaction. Those accounts
behave as the delegated code &lt;em&gt;only&lt;&#x2F;em&gt; for EIP-7702 transactions which include them
in such a list, thus returning to clients the ability to statically analyze and
reason about pending transactions.&lt;&#x2F;p&gt;
&lt;p&gt;A related issue is that an EOA&#x27;s nonce may be incremented more than once per
transaction. Because clients already need to be robust in a worse scenario
(described above), it isn&#x27;t a major concern. However, clients should be aware
this behavior is possible and design their transaction propagation accordingly.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Increase calldata cost</title>
        <published>2024-05-07T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>William Morriss</name><uri>https://github.com/wjmelements</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7703/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7703-increase-calldata-cost/19933" />
        

        <id>https://wg-eips.ritovision.com/7703/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7703"
            label="EIP-7703" />
        

        
        

        
        <summary type="html">Increase calldata cost to decrease the maximum block size</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7703/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;An adjustment in the Ethereum calldata cost which reduces the maximum possible block size and allows a higher block gas limit.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Larger blocks take longer to propagate through the network.
In this way, the maximum potential block size is constraining the block gas limit.
Therefore, in order to safely increase the block gas limit, the calldata gas must be increased.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Increase &lt;code&gt;G_CALLDATAZERO&lt;&#x2F;code&gt; from 4 to 12.&lt;&#x2F;li&gt;
&lt;li&gt;Increase &lt;code&gt;G_CALLDATANONZERO&lt;&#x2F;code&gt; from 16 to 48.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Tripling the gas cost of calldata reduces the maximum possible block size by a factor of three.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Activation can cause some transactions to revert due to the increased gas costs.
Ahead of activation, &lt;code&gt;eth_estimateGas&lt;&#x2F;code&gt; could be calculated using the new parameters in order to provide results viable for activation, avoiding out-of-gas reverts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;No security issues have been found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Native Account Abstraction</title>
        <published>2024-05-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	<author>
		<name>Yoav Weiss</name><uri>https://github.com/yoavw</uri>
	</author>
	
	<author>
		<name>Alex Forshtat</name><uri>https://github.com/forshtat</uri>
	</author>
	
	<author>
		<name>Dror Tirosh</name><uri>https://github.com/drortirosh</uri>
	</author>
	
	<author>
		<name>Shahaf Nacson</name><uri>https://github.com/shahafn</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7701/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7701-native-account-abstraction/19893" />
        

        <id>https://wg-eips.ritovision.com/7701/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7701"
            label="EIP-7701" />
        

        
        

        
        <summary type="html">Native Account Abstraction protocol, relying on a new transaction type and a family of opcodes</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7701/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;We propose splitting the Ethereum transaction scope into multiple steps: validations, execution, and post-operation logic. Transaction validity is determined by the result of the validation steps of a transaction.&lt;&#x2F;p&gt;
&lt;p&gt;We further separate transaction validation for the purposes of authorization and the gas fee payment, allowing one contract to pay gas for a transaction that will be executed from another contract.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Native Account Abstraction allows custom validation logic of a transaction and custom gas payment logic, opening new use-cases and features for wallets and dApps.&lt;&#x2F;p&gt;
&lt;p&gt;A more detailed motivation for this proposal can be found in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7701&#x2F;assets&#x2F;README&#x2F;&quot;&gt;README document&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;AA_TX_TYPE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;TBD&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;AA_ENTRY_POINT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;address(0x7701)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;AA_BASE_GAS_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;15000&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ROLE_SENDER_DEPLOYMENT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xA0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ROLE_SENDER_VALIDATION&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xA1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ROLE_PAYMASTER_VALIDATION&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xA2&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ROLE_SENDER_EXECUTION&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xA3&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ROLE_PAYMASTER_POST_OP&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xA4&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;new-transaction-type&quot;&gt;New Transaction Type&lt;&#x2F;h3&gt;
&lt;p&gt;A new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; transaction with type &lt;code&gt;AA_TX_TYPE&lt;&#x2F;code&gt; is introduced.
Transactions of this type are referred to as &quot;AA transactions&quot;.&lt;&#x2F;p&gt;
&lt;p&gt;Their payload should be interpreted as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;AA_TX_TYPE || rlp([&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  chain_id,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  nonce,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  sender, sender_validation_data,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  deployer, deployer_data,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  paymaster, paymaster_data,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  sender_execution_data,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  max_priority_fee_per_gas, max_fee_per_gas,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  sender_validation_gas, paymaster_validation_gas,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  sender_execution_gas, paymaster_post_op_gas,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  access_list,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  authorization_list&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;current-role-and-accept-role-opcodes&quot;&gt;&lt;code&gt;CURRENT_ROLE&lt;&#x2F;code&gt; and &lt;code&gt;ACCEPT_ROLE&lt;&#x2F;code&gt; opcodes&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;current_context_role&lt;&#x2F;code&gt; is a context variable set by the AA transaction to the current role.
During AA transactions, it is set to the current role in the transaction&#x27;s lifecycle for each top level call.
During non-AA transactions it is always set to &lt;code&gt;ROLE_SENDER_EXECUTION&lt;&#x2F;code&gt;.
It remains unchanged on &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; but is reset to &lt;code&gt;ROLE_SENDER_EXECUTION&lt;&#x2F;code&gt; on &lt;code&gt;CALL&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;CALLCODE&lt;&#x2F;code&gt;. This behavior resembles &lt;code&gt;msg.sender&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;CURRENT_ROLE&lt;&#x2F;code&gt; opcode returns the &lt;code&gt;current_context_role&lt;&#x2F;code&gt; value.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;ACCEPT_ROLE&lt;&#x2F;code&gt; opcode is equivalent to &lt;code&gt;RETURN&lt;&#x2F;code&gt; in the sense that it copies a memory slice, ends execution, and pastes the memory slice onto parent returndata, with a single modification:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;It accepts the &lt;code&gt;frame_role&lt;&#x2F;code&gt; as the additional input parameter, and reverts if it differs from the &lt;code&gt;current_context_role&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;For each &lt;code&gt;role&lt;&#x2F;code&gt; in the transaction&#x27;s lifecycle, a successful &lt;code&gt;ACCEPT_ROLE&lt;&#x2F;code&gt; is expected with the &lt;code&gt;frame_role == role&lt;&#x2F;code&gt;.
If any validation frame failed to perform an &lt;code&gt;ACCEPT_ROLE&lt;&#x2F;code&gt; matching its role, the transaction fails the validity checks and cannot be included.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;txparam-opcodes&quot;&gt;&lt;code&gt;TXPARAM*&lt;&#x2F;code&gt; opcodes&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;TXPARAMDLOAD&lt;&#x2F;code&gt;, &lt;code&gt;TXPARAMSIZE&lt;&#x2F;code&gt;, &lt;code&gt;TXPARAMCOPY&lt;&#x2F;code&gt; opcodes follow the pattern of &lt;code&gt;CALLDATA*&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;RETURNDATA*&lt;&#x2F;code&gt; opcode families.&lt;&#x2F;p&gt;
&lt;p&gt;Each &lt;code&gt;TXPARAM*&lt;&#x2F;code&gt; opcode takes an extra stack input value as a first input compared to its &lt;code&gt;CALLDATA*&lt;&#x2F;code&gt; equivalent.
The values of this input are as follows:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;code&gt;n&lt;&#x2F;code&gt;&lt;&#x2F;th&gt;&lt;th&gt;Return value&lt;&#x2F;th&gt;&lt;th&gt;Data size&lt;&#x2F;th&gt;&lt;th&gt;Default&lt;&#x2F;th&gt;&lt;th&gt;Comment&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;0x00&lt;&#x2F;td&gt;&lt;td&gt;current transaction type&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x01&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;nonce&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x02&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;sender&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x03&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;sender_validation_data&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;dynamic&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x04&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;deployer&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;0 or 32&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;address(0)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x05&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;deployer_data&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;dynamic&lt;&#x2F;td&gt;&lt;td&gt;empty array&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x06&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;paymaster&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;0 or 32&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;address(0)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x07&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;paymaster_data&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;dynamic&lt;&#x2F;td&gt;&lt;td&gt;empty array&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x08&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;sender_execution_data&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;dynamic&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x0B&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;max_priority_fee_per_gas&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x0C&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;max_fee_per_gas&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x0D&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;sender_validation_gas&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x0E&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;paymaster_validation_gas&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x0F&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;sender_execution_gas&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x10&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;paymaster_post_op_gas&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x11&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;access_list&lt;&#x2F;code&gt; hash&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x12&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;authorization_list&lt;&#x2F;code&gt; hash&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0xf1&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;execution_status&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;See transaction scoped vars in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7701&#x2F;#aa-transaction-processing-flow&quot;&gt;processing flow&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0xf2&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;execution_gas_used&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;See transaction scoped vars in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7701&#x2F;#aa-transaction-processing-flow&quot;&gt;processing flow&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0xff&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;tx_hash_for_signature&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;Hash of the transaction without the signature&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;affected-opcodes&quot;&gt;Affected opcodes&lt;&#x2F;h3&gt;
&lt;p&gt;In all top-level frames, the global variables have the following meaning:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Opcode Name&lt;&#x2F;th&gt;&lt;th&gt;Solidity Equivalent&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CALLER&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;msg.sender&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The &lt;code&gt;AA_ENTRY_POINT&lt;&#x2F;code&gt; address&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ORIGIN&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;tx.origin&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The transaction &lt;code&gt;sender&lt;&#x2F;code&gt; address&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CALLDATA*&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;msg.data&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Empty for all call frames except for the sender execution frame, for which it is set to &lt;code&gt;sender_execution_data&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;costs-of-accessing-cold-addresses-for-sender-paymaster-and-deployer&quot;&gt;Costs of accessing cold addresses for Sender, Paymaster, and Deployer&lt;&#x2F;h3&gt;
&lt;p&gt;The Sender address is pre-warmed as part of the &lt;code&gt;AA_BASE_GAS_COST&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;When a non-zero address that is not equal to the &lt;code&gt;Sender&lt;&#x2F;code&gt; address, is provided for a &lt;code&gt;Paymaster&lt;&#x2F;code&gt; or a &lt;code&gt;Deployer&lt;&#x2F;code&gt; contract,
an additional &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930&lt;&#x2F;a&gt; &lt;code&gt;ACCESS_LIST_ADDRESS_COST&lt;&#x2F;code&gt; cost of &lt;strong&gt;2400 gas&lt;&#x2F;strong&gt; is charged and the address is added to &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;aa-transaction-processing-flow&quot;&gt;AA transaction processing flow&lt;&#x2F;h3&gt;
&lt;p&gt;We define processing flow for an AA transaction as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def state_transition_function(tx, block, state):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Empty refunds, warm list, execution status and gas used (new), etc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state.transaction_scoped_vars = {}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_gas = tx.sender_validation_gas + tx.paymaster_validation_gas + tx.sender_execution_gas + tx.paymaster_post_op_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_price = min(tx.max_fee_per_gas, block.base_fee_per_gas + tx.max_priority_fee_per_gas)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payer = tx.sender if tx.paymaster is None else tx.paymaster&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    total_max_cost = max_gas * gas_price&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    balances[payer] -= total_max_cost&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_used = 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if get_code(tx.sender) is None:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        deployer_result = call(tx.deployer, [], tx.sender_validation_gas_limit, ROLE_SENDER_DEPLOYMENT)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        assert deployer_result.accepted_role == ROLE_SENDER_DEPLOYMENT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        gas_used += deployer_result.gas_used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sender_result = call(tx.sender, [], tx.sender_validation_gas_limit - gas_used, ROLE_SENDER_VALIDATION)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    assert sender_result.accepted_role == ROLE_SENDER_VALIDATION&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_used += sender_result.gas_used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if tx.paymaster:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        paymaster_result = call(tx.paymaster, [], tx.paymaster_validation_gas, ROLE_PAYMASTER_VALIDATION)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        assert paymaster_result.accepted_role == ROLE_PAYMASTER_VALIDATION&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        gas_used += paymaster_result.gas_used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    checkpoint = state.take_snapshot()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sender_execution_result = call(tx.sender, [], tx.sender_execution_gas, ROLE_SENDER_EXECUTION)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_used += sender_execution_result.gas_used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state.transaction_scoped_vars[execution_status] = sender_execution_result.output_code&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state.transaction_scoped_vars[execution_gas_used] = gas_used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if tx.paymaster:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        postop_result = call(tx.paymaster, [], tx.paymaster_post_op_gas, ROLE_PAYMASTER_POST_OP)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        gas_used += postop_result.gas_used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        if postop_result.accepted_role != ROLE_PAYMASTER_POST_OP:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            state.revert_snapshot(checkpoint)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    balances[payer] += gas_price * (max_gas - gas_used)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;A full list of rationales for the decisions made in this proposal can be found in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7701&#x2F;assets&#x2F;README&#x2F;&quot;&gt;README document&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;As the &lt;code&gt;ACCEPT_ROLE&lt;&#x2F;code&gt; opcode represent a generic way to authorize any action on behalf of the contract,
correct and secure implementation of this code is critical.
We expect that compilers targeting EVM will play a major role in enabling and ensuring Smart Contract Accounts&#x27; security.&lt;&#x2F;p&gt;
&lt;p&gt;For smart contract security auditors and security-oriented developer tools it is crucial to ensure that contracts not
meant to have roles in AA transactions do not have unexpected &lt;code&gt;ACCEPT_ROLE&lt;&#x2F;code&gt; opcode.
Otherwise, these contracts may present an immediate security threat.&lt;&#x2F;p&gt;
&lt;p&gt;As an example, block explorers should tag contracts as &quot;user accounts&quot; or &quot;paymasters&quot; if they have the &lt;code&gt;ACCEPT_ROLE&lt;&#x2F;code&gt; opcode used in their source code.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Cross-chain Storage Router Protocol</title>
        <published>2024-04-30T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Avneet Singh</name><uri>https://github.com/sshmatrix</uri>
	</author>
	
	<author>
		<name>0xc0de4c0ffee</name><uri>https://github.com/0xc0de4c0ffee</uri>
	</author>
	
	<author>
		<name>Nick Johnson</name><uri>https://github.com/arachnid</uri>
	</author>
	
	<author>
		<name>Makoto Inoue</name><uri>https://github.com/makoto</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7700/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7700-cross-chain-storage-router-protocol/19853" />
        

        <id>https://wg-eips.ritovision.com/7700/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:7700"
            label="ERC-7700" />
        

        
        

        
        <summary type="html">Provides a mechanism to replace L1 storage with L2 and databases through cross-chain routers</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7700/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The following standard provides a mechanism by which smart contracts can route storage to external providers. In particular, protocols can reduce the gas fees associated with storing data on mainnet by routing the handling of storage operations to another system or network. These storage routers act as an extension to the core L1 contract. Methods in this document specifically target security and cost-effectiveness of storage routing to three router types: L1, L2 and databases. The cross-chain data written with these methods can be retrieved by generic &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3668&#x2F;&quot;&gt;EIP-3668&lt;&#x2F;a&gt;-compliant contracts, thus completing the cross-chain data life cycle. This document, nicknamed CCIP-Store, alongside &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3668&#x2F;&quot;&gt;EIP-3668&lt;&#x2F;a&gt;, is a meaningful step toward a secure infrastructure for cross-chain storage routers and data retrievals.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3668&#x2F;&quot;&gt;EIP-3668&lt;&#x2F;a&gt;, aka &#x27;CCIP-Read&#x27;, has been key to retrieving cross-chain data for a variety of contracts on Ethereum blockchain, ranging from price feeds for DeFi contracts, to more recently records for ENS users. The latter case dedicatedly uses cross-chain storage to bypass the usually high gas fees associated with on-chain storage; this aspect has a plethora of use cases well beyond ENS records and a potential for significant impact on universal affordability and accessibility of Ethereum.&lt;&#x2F;p&gt;
&lt;p&gt;Cross-chain data retrieval through &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3668&#x2F;&quot;&gt;EIP-3668&lt;&#x2F;a&gt; is a relatively simpler task since it assumes that all relevant data originating from cross-chain storages is translated by CCIP-Read-compliant HTTP gateways; this includes L2 chains and databases. On the flip side however, so far each service leveraging CCIP-Read must handle writing this data securely to these storage types on their own, while also incorporating reasonable security measures in their CCIP-Read-compatible contracts for verifying this data on L1. While these security measures are in-built into L2 architectures, database storage providers on the other hand must incorporate some form of explicit security measures during storage operations so that cross-chain data&#x27;s integrity can be verified by CCIP-Read contracts during data retrieval stage. Examples of this include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Services that allow the management of namespaces, e.g. ENS domains, stored externally on an L2 solution or off-chain database as if they were native L1 tokens, and,&lt;&#x2F;li&gt;
&lt;li&gt;Services that allow the management of digital identities stored on external storages as if they were stored in the native L1 smart contract.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In this context, a specification which allows storage routing to external routers will facilitate creation of services that are agnostic to the underlying storage solution. This in turn enables new applications to operate without knowledge of the underlying routers. This &#x27;CCIP-Store&#x27; proposal outlines precisely this part of the process, i.e. how the bespoke storage routing can be made by smart contracts to L2s and databases.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7700&#x2F;.&#x2F;assets&#x2F;images&#x2F;Schema.svg&quot; alt=&quot;Fig.1 CCIP-Store and CCIP-Read Workflows&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;overview&quot;&gt;Overview&lt;&#x2F;h3&gt;
&lt;p&gt;The following specification revolves around the structure and description of a cross-chain storage router tasked with the responsibility of writing to an L2 or database storage. This document introduces &lt;code&gt;StorageRoutedToL2()&lt;&#x2F;code&gt; and &lt;code&gt;StorageRoutedToDatabase()&lt;&#x2F;code&gt; storage routers, along with the trivial &lt;code&gt;StorageRoutedToL1()&lt;&#x2F;code&gt; router, and proposes that new &lt;code&gt;StorageRoutedTo__()&lt;&#x2F;code&gt; reverts be allowed through new EIPs that sufficiently detail their interfaces and designs. Some foreseen examples of new storage routers include &lt;code&gt;StorageRoutedToSolana()&lt;&#x2F;code&gt; for Solana, &lt;code&gt;StorageRoutedToFilecoin()&lt;&#x2F;code&gt; for Filecoin, &lt;code&gt;StorageRoutedToIPFS()&lt;&#x2F;code&gt; for IPFS, &lt;code&gt;StorageRoutedToIPNS()&lt;&#x2F;code&gt; for IPNS, &lt;code&gt;StorageRoutedToArweave()&lt;&#x2F;code&gt; for Arweave, &lt;code&gt;StorageRoutedToArNS()&lt;&#x2F;code&gt; for ArNS, &lt;code&gt;StorageRoutedToSwarm()&lt;&#x2F;code&gt; for Swarm etc.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;l1-router-storageroutedtol1&quot;&gt;L1 Router: &lt;code&gt;StorageRoutedToL1()&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;A minimal L1 router is trivial and only requires the L1 &lt;code&gt;contract&lt;&#x2F;code&gt; address to which routing must be made, while the clients must ensure that the calldata is invariant under routing to another contract. One example implementation of an L1 router is given below.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Define revert event&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; StorageRoutedToL1&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; contractL1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Generic function in a contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setValue&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get metadata from on-chain sources&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; contractL1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Routed contract address on L1; may be globally constant&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getMetadata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Arbitrary code&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; contractL1 = 0x32f94e75cde5fa48b6469323742e6004d701409b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Route storage call to L1 router&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; StorageRoutedToL1&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        contractL1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In this example, the routing must prompt the client to build the transaction with the exact same original calldata, and submit it to the L1 &lt;code&gt;contract&lt;&#x2F;code&gt; by calling the exact same function.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Function in routed L1 contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setValue&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Some code storing data mapped by node &amp;amp; msg.sender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    .&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7700&#x2F;.&#x2F;assets&#x2F;images&#x2F;L1.svg&quot; alt=&quot;Fig.2 L1 Call Lifecycle&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;l2-router-storageroutedtol2&quot;&gt;L2 Router: &lt;code&gt;StorageRoutedToL2()&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;A minimal L2 router only requires the list of &lt;code&gt;chainId&lt;&#x2F;code&gt; values and the corresponding L2 &lt;code&gt;contract&lt;&#x2F;code&gt; addresses, while the clients must ensure that the calldata is invariant under routing to L2. One example implementation of an L2 router in an L1 contract is shown below.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Define revert event&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; StorageRoutedToL2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; contractL2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; chainId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Generic function in a contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setValue&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get metadata from on-chain sources&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; contractL2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Contract address on L2; may be globally constant&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; chainId &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; L2 ChainID; may be globally constant&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getMetadata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Arbitrary code&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; contractL2 = 0x32f94e75cde5fa48b6469323742e6004d701409b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; chainId = 21&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Route storage call to L2 router&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; StorageRoutedToL2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        contractL2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        chainId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In this example, the routing must prompt the client to build the transaction with the exact same original calldata, and submit it to the L2 by calling the exact same function on L2 as L1.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Function in L2 contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setValue&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Some code storing data mapped by node &amp;amp; msg.sender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    .&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7700&#x2F;.&#x2F;assets&#x2F;images&#x2F;L2.svg&quot; alt=&quot;Fig.3 L2 Call Lifecycle&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;database-router-storageroutedtodatabase&quot;&gt;Database Router: &lt;code&gt;StorageRoutedToDatabase()&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;A minimal database router is similar to an L2 in the sense that:&lt;&#x2F;p&gt;
&lt;p&gt;a) Similar to &lt;code&gt;chainId&lt;&#x2F;code&gt;, it requires the &lt;code&gt;gatewayUrl&lt;&#x2F;code&gt; that is tasked with handling off-chain storage operations, and&lt;&#x2F;p&gt;
&lt;p&gt;b) Similar to &lt;code&gt;eth_call&lt;&#x2F;code&gt;, it requires &lt;code&gt;eth_sign&lt;&#x2F;code&gt; output to secure the data, and the client must prompt the users for these signatures.&lt;&#x2F;p&gt;
&lt;p&gt;This specification does not require any other data to be stored on L1 other than the bespoke &lt;code&gt;gatewayUrl&lt;&#x2F;code&gt;; the storage router therefore should only return the &lt;code&gt;gatewayUrl&lt;&#x2F;code&gt; in revert.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; StorageRoutedToDatabase&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span&gt; gatewayUrl&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Generic function in a contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setValue&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt; gatewayUrl &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Gateway URL; may be globally constant&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getMetadata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; gatewayUrl = &amp;quot;https:&#x2F;&#x2F;api.namesys.xyz&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Route storage call to database router&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; StorageRoutedToDatabase&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        gatewayUrl&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7700&#x2F;.&#x2F;assets&#x2F;images&#x2F;Database.svg&quot; alt=&quot;Fig.4 Database Call Lifecycle&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Following the revert, the client must take these steps:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Request the user for a secret signature &lt;code&gt;sigKeygen&lt;&#x2F;code&gt; to generate a deterministic &lt;code&gt;dataSigner&lt;&#x2F;code&gt; keypair,&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Sign the calldata with generated data signer&#x27;s private key and produce verifiable data signature &lt;code&gt;dataSig&lt;&#x2F;code&gt;,&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Request the user for an &lt;code&gt;approval&lt;&#x2F;code&gt; approving the generated data signer, and finally,&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Post the calldata to gateway along with signatures &lt;code&gt;dataSig&lt;&#x2F;code&gt; and &lt;code&gt;approval&lt;&#x2F;code&gt;, and the &lt;code&gt;dataSigner&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;These steps are described in detail below.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;1-generate-data-signer&quot;&gt;1. Generate Data Signer&lt;&#x2F;h4&gt;
&lt;p&gt;The data signer must be generated deterministically from ethereum wallet signatures; see figure below.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7700&#x2F;.&#x2F;assets&#x2F;images&#x2F;Keygen.svg&quot; alt=&quot;Fig.5 Data Signer Keygen Workflow&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The deterministic key generation can be implemented concisely in a single unified &lt;code&gt;keygen()&lt;&#x2F;code&gt; function as follows.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Pseudo-code for key generation &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; keygen&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  username&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; CAIP identifier for the blockchain account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  sigKeygen&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Deterministic signature from wallet&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  spice&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Stretched password&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Calculate input key by hashing signature bytes using SHA256 algorithm&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; inputKey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; sha256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sigKeygen&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Calculate salt for keygen by hashing concatenated username, stretched password (aka spice) and hex-encoded signature using SHA256 algorithm&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; salt&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; sha256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;username&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;spice&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sigKeygen&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Calculate hash key output by feeding input key, salt &amp;amp; username to the HMAC-based key derivation function (HKDF) with dLen = 42&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; hashKey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; hkdf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sha256&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; inputKey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; salt&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; username&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 42&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Calculate and return secp256k1 keypair&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; secp256k1&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;hashKey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Calculate secp256k1 keypair from hash key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This &lt;code&gt;keygen()&lt;&#x2F;code&gt; function requires three variables: &lt;code&gt;username&lt;&#x2F;code&gt;, &lt;code&gt;spice&lt;&#x2F;code&gt; and &lt;code&gt;sigKeygen&lt;&#x2F;code&gt;. Their definitions are given below.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;1-username&quot;&gt;1. &lt;code&gt;username&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ChainAgnostic&#x2F;CAIPs&#x2F;blob&#x2F;ad0cfebc45a4b8368628340bf22aefb2a5edcab7&#x2F;CAIPs&#x2F;caip-10.md&quot;&gt;CAIP-10&lt;&#x2F;a&gt; identifier &lt;code&gt;username&lt;&#x2F;code&gt; is auto-derived from the connected wallet&#x27;s checksummed address &lt;code&gt;wallet&lt;&#x2F;code&gt; and &lt;code&gt;chainId&lt;&#x2F;code&gt; using &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; CAIP-10 identifier &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; caip10&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eip155:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;wallet&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;2-spice&quot;&gt;2. &lt;code&gt;spice&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;p&gt;&lt;code&gt;spice&lt;&#x2F;code&gt; is calculated from the optional private field &lt;code&gt;password&lt;&#x2F;code&gt;, which must be prompted from the user by the client; this field allows users to change data signers for a given &lt;code&gt;username&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Secret derived key identifier &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Clients must prompt the user for this&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; password&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;key1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Password must then be stretched before use with &lt;code&gt;PBKDF2&lt;&#x2F;code&gt; algorithm such that:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Calculate spice by stretching password &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; spice&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; pbkdf2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;            password&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;            pepper&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;            iterations&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Stretch password with PBKDF2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where &lt;code&gt;pepper = keccak256(abi.encodePacked(username))&lt;&#x2F;code&gt; and the &lt;code&gt;iterations&lt;&#x2F;code&gt; count is fixed to &lt;code&gt;500,000&lt;&#x2F;code&gt; for brute-force vulnerability protection.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Definitions of pepper and iterations in PBKDF2 &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; pepper&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;username&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; iterations&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 500000&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 500,000 iterations&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;3-sigkeygen&quot;&gt;3. &lt;code&gt;sigKeygen&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;p&gt;The data signer must be derived from the owner or manager keys of a node. Message payload for the required &lt;code&gt;sigKeygen&lt;&#x2F;code&gt; must then be formatted as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Requesting Signature To Generate Keypair(s)\n\nOrigin: ${username}\nProtocol: ${protocol}\nExtradata: ${extradata}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where the &lt;code&gt;extradata&lt;&#x2F;code&gt; is calculated as follows,&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Calculating extradata in keygen signatures&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt; extradata &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;    abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        spice&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        wallet&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The remaining &lt;code&gt;protocol&lt;&#x2F;code&gt; field is a protocol-specific identifier limiting the scope to a specific protocol represented by a unique contract address. This identifier cannot be global and must be uniquely defined for each implementating L1 &lt;code&gt;contract&lt;&#x2F;code&gt; such that:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Protocol identifier in CAIP-10 format &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; protocol&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;With this deterministic format for signature message payload, the client must prompt the user for the ethereum signature. Once the user signs the messages, the &lt;code&gt;keygen()&lt;&#x2F;code&gt; function can derive the data signer keypair.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;2-sign-data&quot;&gt;2. Sign Data&lt;&#x2F;h4&gt;
&lt;p&gt;Since the derived signer is wallet-specific, it can&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;sign batch data for multiple keys for a given node, and&lt;&#x2F;li&gt;
&lt;li&gt;sign batches of data for multiple nodes owned by a wallet&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;simultaneously in the background without ever prompting the user. Signature(s) &lt;code&gt;dataSig&lt;&#x2F;code&gt; accompanying the off-chain calldata must implement the following format in their message payloads:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Requesting Signature To Update Off-Chain Data\n\nOrigin: ${username}\nData Type: ${dataType}\nData Value: ${dataValue}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where &lt;code&gt;dataType&lt;&#x2F;code&gt; parameters are protocol-specific and formatted as object keys delimited by &lt;code&gt;&#x2F;&lt;&#x2F;code&gt;. For instance, if the off-chain data is nested in keys as &lt;code&gt;a &amp;gt; b &amp;gt; c &amp;gt; field &amp;gt; key&lt;&#x2F;code&gt;, then the equivalent &lt;code&gt;dataType&lt;&#x2F;code&gt; is &lt;code&gt;a&#x2F;b&#x2F;c&#x2F;field&#x2F;key&lt;&#x2F;code&gt;. For example, in order to update off-chain ENS record &lt;code&gt;text &amp;gt; avatar&lt;&#x2F;code&gt; and &lt;code&gt;address &amp;gt; 60&lt;&#x2F;code&gt;, &lt;code&gt;dataType&lt;&#x2F;code&gt; must be formatted as &lt;code&gt;text&#x2F;avatar&lt;&#x2F;code&gt; and &lt;code&gt;address&#x2F;60&lt;&#x2F;code&gt; respectively.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;3-approve-data-signer&quot;&gt;3. Approve Data Signer&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;dataSigner&lt;&#x2F;code&gt; is not stored on L1, and the clients must instead&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;request an &lt;code&gt;approval&lt;&#x2F;code&gt; signature for &lt;code&gt;dataSigner&lt;&#x2F;code&gt; signed by the owner or manager of a node, and&lt;&#x2F;li&gt;
&lt;li&gt;post this &lt;code&gt;approval&lt;&#x2F;code&gt; and the &lt;code&gt;dataSigner&lt;&#x2F;code&gt; along with the signed calldata in encoded form.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;CCIP-Read-enabled contracts can then verify during resolution time that the &lt;code&gt;approval&lt;&#x2F;code&gt; attached with the signed calldata comes from the node&#x27;s manager or owner, and that it approves the expected &lt;code&gt;dataSigner&lt;&#x2F;code&gt;. The &lt;code&gt;approval&lt;&#x2F;code&gt; signature must have the following message payload format:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Requesting Signature To Approve Data Signer\n\nOrigin: ${username}\nApproved Signer: ${dataSigner}\nApproved By: ${caip10}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where &lt;code&gt;dataSigner&lt;&#x2F;code&gt; must be checksummed.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;4-post-ccip-read-compatible-payload&quot;&gt;4. Post CCIP-Read Compatible Payload&lt;&#x2F;h4&gt;
&lt;p&gt;The final &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3668&#x2F;&quot;&gt;EIP-3668&lt;&#x2F;a&gt;-compatible &lt;code&gt;data&lt;&#x2F;code&gt; payload in the off-chain data file is identified by a fixed &lt;code&gt;callback.signedData.selector&lt;&#x2F;code&gt; equal to &lt;code&gt;0x2b45eb2b&lt;&#x2F;code&gt; and must follow the format&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Compile CCIP-Read-compatible payload&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt; encodedData &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;#39;bytes&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;dataValue&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Encode data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt; funcSelector &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; callback&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;signedData&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Identify off-chain data with a fixed &amp;#39;signedData&amp;#39; selector = &amp;#39;0x2b45eb2b&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt; data &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    [&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;#39;bytes4&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;#39;address&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;#39;bytes32&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;#39;bytes32&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;#39;bytes&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    [&lt;&#x2F;span&gt;&lt;span&gt;funcSelector&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; dataSigner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; dataSig&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; approval&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; encodedData&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Compile complete CCIP-Readable off-chain data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The client must construct this &lt;code&gt;data&lt;&#x2F;code&gt; and pass it to the gateway in the &lt;code&gt;POST&lt;&#x2F;code&gt; request along with the raw values for indexing. The CCIP-Read-enabled contracts after decoding the four parameters from this &lt;code&gt;data&lt;&#x2F;code&gt; must&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;verify that the &lt;code&gt;dataSigner&lt;&#x2F;code&gt; is approved by the owner or manager of the node through &lt;code&gt;approval&lt;&#x2F;code&gt;, and&lt;&#x2F;li&gt;
&lt;li&gt;verify that the &lt;code&gt;dataSig&lt;&#x2F;code&gt; is produced by &lt;code&gt;dataSigner&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;before resolving the &lt;code&gt;encodedData&lt;&#x2F;code&gt; value in decoded form.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;post-request&quot;&gt;&lt;code&gt;POST&lt;&#x2F;code&gt; Request&lt;&#x2F;h5&gt;
&lt;p&gt;The &lt;code&gt;POST&lt;&#x2F;code&gt; request made by the client to the &lt;code&gt;gatewayUrl&lt;&#x2F;code&gt; must follow the format as described below.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; POST request format&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Post&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  node&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  preimage&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; number&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  approval&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  payload&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    field1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;      value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;      signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;      timestamp&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; number&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;      data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    field2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; number&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        timestamp&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; number&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    field3&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; number&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        timestamp&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; number&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Example of a complete &lt;code&gt;Post&lt;&#x2F;code&gt; typed object for updating multiple ENS records for a node is shown below.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Example of a POST request &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; post&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Post&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  node&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xe8e5c24bb5f0db1f3cab7d3a7af2ecc14a7a4e3658dfb61c9b65a099b5f086fb&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  preimage&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;dev.namesys.eth&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  chainId&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  approval&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xa94da8233afb27d087f6fbc667cc247ef2ed31b5a1ff877ac823b5a2e69caa49069f0daa45a464d8db2f8e4e435250cb446d8f279d45a2b865ebf2fff291f69f1c&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  payload&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    contenthash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ipfs:&#x2F;&#x2F;QmYSFDzEcmk25JPFrHBHSMMLcTKLm6SvuZvKpijTHBnAYX&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x24730d1d85d556245b7766aef413188e22f219c8de263ccbfafee4413f0937c32e4f44068d84c7424f923b878dcf22184f8df86506de1cea3dad932c5bd5e9de1c&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      timestamp&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1708322868&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x2b45eb2b000000000000000000000000fe889053f7a0d2571f1898d2835c3cbdf50d766b000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000180000000000000000000000000000000000000000000000000000000000000004124730d1d85d556245b7766aef413188e22f219c8de263ccbfafee4413f0937c32e4f44068d84c7424f923b878dcf22184f8df86506de1cea3dad932c5bd5e9de1c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041a94da8233afb27d087f6fbc667cc247ef2ed31b5a1ff877ac823b5a2e69caa49069f0daa45a464d8db2f8e4e435250cb446d8f279d45a2b865ebf2fff291f69f1c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000026e301017012209603ccbcef5c2acd57bdec6a63e8a0292f3ce6bb583b6826060bcdc3ea84ad900000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        coinType&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1FfmbHfnpaZjKFvyi1okTjJJusN455paPH&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x60ecd4979ae2c39399ffc7ad361066d46fc3d20f2b2902c52e01549a1f6912643c21d23d1ad817507413dc8b73b59548840cada57481eb55332c4327a5086a501b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        timestamp&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1708322877&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x2b45eb2b000000000000000000000000fe889053f7a0d2571f1898d2835c3cbdf50d766b000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000180000000000000000000000000000000000000000000000000000000000000004160ecd4979ae2c39399ffc7ad361066d46fc3d20f2b2902c52e01549a1f6912643c21d23d1ad817507413dc8b73b59548840cada57481eb55332c4327a5086a501b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041a94da8233afb27d087f6fbc667cc247ef2ed31b5a1ff877ac823b5a2e69caa49069f0daa45a464d8db2f8e4e435250cb446d8f279d45a2b865ebf2fff291f69f1c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000a0e6ca5444e4d8b7c80f70237f332320387f18c7&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        coinType&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 60&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x47C10B0491A138Ddae6cCfa26F17ADCfCA299753&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xaad74ddef8c031131b6b83b3bf46749701ed11aeb585b63b72246c8dab4fff4f79ef23aea5f62b227092719f72f7cfe04f3c97bfad0229c19413f5cb491e966c1b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        timestamp&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1708322917&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x2b45eb2b000000000000000000000000fe889053f7a0d2571f1898d2835c3cbdf50d766b0000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000000041aad74ddef8c031131b6b83b3bf46749701ed11aeb585b63b72246c8dab4fff4f79ef23aea5f62b227092719f72f7cfe04f3c97bfad0229c19413f5cb491e966c1b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041a94da8233afb27d087f6fbc667cc247ef2ed31b5a1ff877ac823b5a2e69caa49069f0daa45a464d8db2f8e4e435250cb446d8f279d45a2b865ebf2fff291f69f1c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000047c10b0491a138ddae6ccfa26f17adcfca299753&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    text&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        key&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;avatar&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;namesys.xyz&#x2F;logo.png&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xbc3c7f1b511de151bffe8df033859295d83d400413996789e706e222055a2353404ce17027760c927af99e0bf621bfb24d3bfc52abb36bcfbe6e20cf43db7c561b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        timestamp&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1708329377&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x2b45eb2b000000000000000000000000fe889053f7a0d2571f1898d2835c3cbdf50d766b0000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000000041bc3c7f1b511de151bffe8df033859295d83d400413996789e706e222055a2353404ce17027760c927af99e0bf621bfb24d3bfc52abb36bcfbe6e20cf43db7c561b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041a94da8233afb27d087f6fbc667cc247ef2ed31b5a1ff877ac823b5a2e69caa49069f0daa45a464d8db2f8e4e435250cb446d8f279d45a2b865ebf2fff291f69f1c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001c68747470733a2f2f6e616d657379732e78797a2f6c6f676f2e706e6700000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        key&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;com.github&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;namesys-eth&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xc9c33ff219e90510f79b6c9bb489917ee6e00ab123c55abe1117e71ea0d171356cf316420c71cfcf4bd63a791aaf37388ef1832e582f54a8c2df173917240fff1b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        timestamp&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1708322898&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x2b45eb2b000000000000000000000000fe889053f7a0d2571f1898d2835c3cbdf50d766b0000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000000041c9c33ff219e90510f79b6c9bb489917ee6e00ab123c55abe1117e71ea0d171356cf316420c71cfcf4bd63a791aaf37388ef1832e582f54a8c2df173917240fff1b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041a94da8233afb27d087f6fbc667cc247ef2ed31b5a1ff877ac823b5a2e69caa49069f0daa45a464d8db2f8e4e435250cb446d8f279d45a2b865ebf2fff291f69f1c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000b6e616d657379732d657468000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;new-revert-events&quot;&gt;New Revert Events&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Each new storage router must submit their &lt;code&gt;StorageRoutedTo__()&lt;&#x2F;code&gt; identifier through an ERC track proposal referencing the current document.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Each &lt;code&gt;StorageRoutedTo__()&lt;&#x2F;code&gt; provider must be supported with detailed documentation of its structure and the necessary metadata that its implementers must return.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Each &lt;code&gt;StorageRoutedTo__()&lt;&#x2F;code&gt; proposal must define the precise formatting of any message payloads that require signatures and complete descriptions of custom cryptographic techniques implemented for additional security, accessibility or privacy.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;implementation-featuring-ens-on-l2-database&quot;&gt;Implementation featuring ENS on L2 &amp;amp; Database&lt;&#x2F;h3&gt;
&lt;p&gt;ENS off-chain resolvers capable of reading from and writing to databases are perhaps the most common use-case for CCIP-Read and CCIP-Write. One example of such a (minimal) resolver is given below along with the client-side code for handling the storage router revert.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;l1-contract&quot;&gt;L1 Contract&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ENS resolver implementing StorageRoutedToDatabase() &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; iResolver&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Defined in EIP-7700&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; StorageRoutedToL2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span&gt; chainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; contractL2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; StorageRoutedToDatabase&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt; gatewayUrl&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Defined in EIP-137&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setAddr&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Defined in EIP-7700&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; gatewayUrl &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;https:&#x2F;&#x2F;post.namesys.xyz&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; RESTful API endpoint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; chainId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;21&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ChainID of L2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; contractL2 &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;0x839B3B540A9572448FD1B2335e0EB09Ac1A02885&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Contract on L2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* Sets the ethereum address associated with an ENS node&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* [!] May only be called by the owner or manager of that node in ENS registry&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; node&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Namehash of ENS domain to update&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Ethereum address to set&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setAddr&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; addr&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; authorised&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;node&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Route to database storage&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; StorageRoutedToDatabase&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        gatewayUrl&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* Sets the avatar text record associated with an ENS node&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* [!] May only be called by the owner or manager of that node in ENS registry&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; node&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Namehash of ENS domain to update&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Key for ENS text record&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; URL to avatar&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setText&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify owner or manager permissions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;authorised&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;NOT_ALLOWED&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Route to L2 storage&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; StorageRoutedToL2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        chainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        contractL2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;l2-contract&quot;&gt;L2 Contract&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Function in L2 contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setText&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Store record mapped by node &amp;amp; sender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    records&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;text&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;key&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;client-side-code&quot;&gt;Client-side Code&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Client-side pseudo-code in ENS App &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Deterministically generate signer keypair&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; signer&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; keygen&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;username&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sigKeygen&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; spice&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Construct POST body by signing calldata with derived private key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; post&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Post&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; signData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; signer&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;priv&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; POST to gateway&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;await&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fetch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;gatewayUrl&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  method&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  body&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; JSON&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;stringify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;post&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Technically, the cases of L2s and databases are similar; routing to an L2 involves routing the &lt;code&gt;eth_call&lt;&#x2F;code&gt; to another EVM, while routing to a database can be made by extracting &lt;code&gt;eth_sign&lt;&#x2F;code&gt; from &lt;code&gt;eth_call&lt;&#x2F;code&gt; and posting the resulting signature explicitly along with the data for later verification. Methods in this document perform these precise tasks when routing storage operations to external routers. In addition, methods such as signing data with a derived signer (for databases) allow for significant UX improvement by fixing the number of signature prompts in wallets to 2, irrespective of the number of data instances to sign per node or the total number of nodes to update. This improvement comes at no additional cost to the user and allows services to perform batch updates.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;None&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Clients must purge the derived signer private keys from local storage immediately after signing the off-chain data.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Signature message payload and the resulting deterministic signature &lt;code&gt;sigKeygen&lt;&#x2F;code&gt; must be treated as a secret by the clients and immediately purged from local storage after usage in the &lt;code&gt;keygen()&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Clients must immediately purge the &lt;code&gt;password&lt;&#x2F;code&gt; and &lt;code&gt;spice&lt;&#x2F;code&gt; from local storage after usage in the &lt;code&gt;keygen()&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>ERC-20 Transfer Reference Extension</title>
        <published>2024-04-26T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Radek Svarz</name><uri>https://github.com/radeksvarz</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7699/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7699-erc20-payment-reference-extension/19826" />
        

        <id>https://wg-eips.ritovision.com/7699/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:7699"
            label="ERC-7699" />
        

        
        

        
        <summary type="html">Include a unique identifier (transfer or &quot;payment&quot; reference) for each ERC-20 transaction to associate transfers with orders&#x2F;invoices.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7699/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; token standard does not provide a built-in mechanism for including a payment transfer reference (message for recipient) in token transfers. This proposal extends the existing ERC-20 token standard by adding minimal methods to include a transfer reference in token transfers and transferFrom operations. The addition of a reference can help users, merchants, and service providers to associate and reconcile individual transactions with specific orders or invoices.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The primary motivation for this proposal is to improve the functionality of the ERC-20 token standard by providing a mechanism for including a payment reference in token transfers, similar to the traditional finance systems where payment references are commonly used to associate and reconcile transactions with specific orders, invoices or other financial records.&lt;&#x2F;p&gt;
&lt;p&gt;Currently, users and merchants who want to include a payment reference in their transactions must rely on off chain external systems or custom payment proxy implementations. In traditional finance systems, payment references are often included in wire transfers and other types of electronic payments, making it easy for users and merchants to manage and reconcile their transactions. Such as:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;SWIFT MT103: field 70 “Remittance Information” is commonly used for such content (e.g &quot; PAYMENT FOR INVOICE 998877&quot;). There is also field 72 “Sender to receiver information”.&lt;&#x2F;li&gt;
&lt;li&gt;ISO 20022 (for SEPA): PAIN.001 has field called RmtInf (Remittance Information)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;By extending the existing ERC-20 token standard with payment transfer reference capabilities, this proposal will help bridge the gap between traditional finance systems and the world of decentralized finance, providing a more seamless experience for users, merchants, and service providers alike.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;Any contract complying with ERC-20 when extended with this ERC, MUST implement the following interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; The EIP-165 identifier of this interface is 0x1522573a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;interface IERC7699 {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function transfer(address to, uint256 amount, bytes calldata transferReference) external returns (bool);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function transferFrom(address from, address to, uint256 amount, bytes calldata transferReference) external returns (bool);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;event TransferReference(bytes32 indexed loggedReference);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;These &lt;code&gt;transfer&lt;&#x2F;code&gt; and &lt;code&gt;transferFrom&lt;&#x2F;code&gt; functions, in addition to the standard transfer behaviour, MUST emit a &lt;code&gt;transferReference&lt;&#x2F;code&gt; event with a &lt;code&gt;loggedReference&lt;&#x2F;code&gt; parameter (with only exception defined below).&lt;&#x2F;p&gt;
&lt;p&gt;The corresponding ERC-20 &lt;code&gt;Transfer&lt;&#x2F;code&gt; event MUST be emitted following the &lt;code&gt;TransferReference&lt;&#x2F;code&gt; event, ideally immediately afterwards for the client to be able to seek the associated &lt;code&gt;Transfer&lt;&#x2F;code&gt; event log record.&lt;&#x2F;p&gt;
&lt;p&gt;Emitted &lt;code&gt;loggedReference&lt;&#x2F;code&gt; MAY be the exact copy of the &lt;code&gt;transferReference&lt;&#x2F;code&gt; (when less then 33 bytes) or the derived data from the rich &lt;code&gt;transferReference&lt;&#x2F;code&gt; structure and other processing. This is up to the implementer. One MUST NOT expect the &lt;code&gt;transferReference&lt;&#x2F;code&gt; and &lt;code&gt;loggedReference&lt;&#x2F;code&gt; data to be equal.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;loggedReference&lt;&#x2F;code&gt; parameter MAY contain any data of bytes32 type.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;transferReference&lt;&#x2F;code&gt; parameter MAY be empty. In this case and only in this case the &lt;code&gt;TransferReference&lt;&#x2F;code&gt; event MUST NOT be emitted, effectively mimicking the regular ERC-20 transfer without any transfer reference.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;transferReference&lt;&#x2F;code&gt; parameter is not limited in length by design, users are motivated to keep it short due to calldata and execution gas costs.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;TransferReference&lt;&#x2F;code&gt; event MUST NOT be declared with the &lt;code&gt;anonymous&lt;&#x2F;code&gt; specifier. This is to ensure that the event signature is logged and can be used as a filter.&lt;&#x2F;p&gt;
&lt;p&gt;Transfers of 0 amount MUST be treated as normal transfers and fire the &lt;code&gt;TransferReference&lt;&#x2F;code&gt; event alike.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameter-name&quot;&gt;Parameter name&lt;&#x2F;h3&gt;
&lt;p&gt;The choice to name the added parameter &lt;code&gt;transferReference&lt;&#x2F;code&gt; was made to align with traditional banking terminology, where payment references are widely used to associate and reconcile transactions with specific orders, invoices or other financial records.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;transferReference&lt;&#x2F;code&gt; parameter name also helps to clearly communicate the purpose of the parameter and its role in facilitating the association and reconciliation of transactions. By adopting terminology that is well-established in the financial industry, the proposal aims to foster a greater understanding and adoption of the extended ERC-20 token standard.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parameter-type&quot;&gt;Parameter type&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;transferReference&lt;&#x2F;code&gt; type is bytes.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;transferReference&lt;&#x2F;code&gt; type was initially considered to be bytes32 in order to motivate users to either use short references (as is common in TradFi) or rather use Keccak 256 hash of the reference content. Conclusion was that the options should rather be kept open to be able to call with structured data; such as passing reference data including a signature enabling extra processing checks.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;emitted-data&quot;&gt;Emitted data&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;loggedReference&lt;&#x2F;code&gt; type is bytes32.&lt;&#x2F;p&gt;
&lt;p&gt;It was considered to log a reference in the form of &lt;code&gt;bytes calldata&lt;&#x2F;code&gt;.  However, the reference content would be hashed in the event log due to the log topic indexing required for the even subscription filters. The resulting logged topic is always in the form of bytes32. Bytes32 type enables to log publicly readable (non hashed) reference content up to 32 bytes long.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This extension is fully backwards compatible with the existing ERC-20 token standard. The new functions can be used alongside the existing transfer and transferFrom functions. Existing upgradable ERC-20 tokens can be upgraded to include the new functionality without impact on the storage layout; new ERC-20 tokens can choose to implement the payment reference features based on their specific needs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pragma solidity &amp;gt;=0.8.4 &amp;lt;0.9.0;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;import {ERC20} from &amp;quot;@openzeppelin&#x2F;token&#x2F;ERC20&#x2F;ERC20.sol&amp;quot;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;interface IERC7699 {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @notice Emitted when a non-empty `transferReference` is added to the `transfer` call.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    event TransferReference(bytes32 indexed loggedReference);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @notice Moves `amount` tokens from the caller&amp;#39;s account to `to` with `transferReference`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev Returns a boolean value indicating whether the operation succeeded.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * MUST emit this ERCS&amp;#39;s {TransferReference} event followed by a corresponding {ERC20.Transfer} event&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * (to comply with ERC-20).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function transfer(address to, uint256 amount, bytes calldata transferReference) external returns (bool);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @notice Moves `amount` tokens from `from` to `to` with `transferReference` using the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * allowance mechanism. `amount` is then deducted from the caller&amp;#39;s allowance.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev Returns a boolean value indicating whether the operation succeeded.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * MUST emit this ERCS&amp;#39;s {TransferReference} event followed by a corresponding {ERC20.Transfer} event&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * (to comply with ERC-20).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function transferFrom(address from, address to, uint256 amount, bytes calldata transferReference)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        returns (bool);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @dev Implementation of the ERC20 transfer reference extension.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;contract ERC20TransferReference is ERC20, IERC7699 {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    constructor() ERC20(&amp;quot;ERC20 Transfer Reference Example&amp;quot;, &amp;quot;TXRE&amp;quot;) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _mint(msg.sender, 987654321 * 1e18);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev Emits `TransferReference` event with derived `loggedReference` data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function _logReference(bytes calldata transferReference) internal virtual {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &#x2F;&#x2F; MUST NOT emit when transferReference is empty&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        if (transferReference.length &amp;gt; 0) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &#x2F;&#x2F; Effectively extract first 32 bytes from transferReference calldata bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &#x2F;&#x2F; Note: This is the example. Derivation of the loggedReference is fully up to the implementation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &#x2F;&#x2F; E.g. keccak hash of the whole transferReference, etc.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            bytes32 loggedReference;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &#x2F;&#x2F; solhint-disable-next-line no-inline-assembly&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            assembly {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                loggedReference := calldataload(transferReference.offset)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            emit TransferReference(loggedReference);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @notice A standard ERC20 token transfer with an optional transfer reference&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev The underlying `transfer` function is assumed to handle the actual token transfer logic.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param to The address of the recipient where the tokens will be sent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param amount The number of tokens to be transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param transferReference A bytes field to include a transfer reference, reference signature or other relevant&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * reference data.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @return A boolean indicating whether the transfer was successful.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function transfer(address to, uint256 amount, bytes calldata transferReference) public virtual returns (bool) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _logReference(transferReference);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &#x2F;&#x2F; ERC20.Transfer event is emitted immediately after TransferReference event&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return transfer(to, amount);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @notice A delegated token transfer with an optional transfer reference&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev Requires prior approval from the token owner. The underlying `transferFrom` function is assumed to handle&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * allowance and transfer logic.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param from The address of the token owner who has authorized the transfer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param to The address of the recipient where the tokens will be sent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param amount The number of tokens to be transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param transferReference A bytes field to include a transfer reference, reference signature or other relevant&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * reference data.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @return A boolean indicating whether the transfer was successful.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function transferFrom(address from, address to, uint256 amount, bytes calldata transferReference)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        public&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        virtual&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        returns (bool)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _logReference(transferReference);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &#x2F;&#x2F; ERC20.Transfer event is emitted immediately after TransferReference event&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return transferFrom(from, to, amount);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;privacy-considerations&quot;&gt;Privacy Considerations&lt;&#x2F;h3&gt;
&lt;p&gt;Reference data privacy: Including payment references in token transfers may expose sensitive information about the transaction or the parties involved. Implementers and users should carefully consider the privacy implications and ensure that payment references do not reveal sensitive information. To mitigate this risk, implementers can consider using encryption or other privacy-enhancing techniques to protect payment reference data.&lt;&#x2F;p&gt;
&lt;p&gt;Example: With reference 0x20240002 logged, transaction is publicly exposing that this is related to the second invoice of the recipient in 2024.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;manipulation-of-payment-references&quot;&gt;Manipulation of payment references&lt;&#x2F;h3&gt;
&lt;p&gt;There is no validation of the reference data dictated by this ERC. Malicious actors might attempt to manipulate payment references to mislead users, merchants, or service providers. This can lead to:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Legal risks&lt;&#x2F;strong&gt;: The beneficiary may face legal and compliance risks if the attacker uses illicit funds, potentially impersonating or flagging the beneficiary of involvement in money laundering or other illicit activities.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Disputes and refunds&lt;&#x2F;strong&gt;: The user might discover they didn&#x27;t make the payment, request a refund or raise a dispute, causing additional administrative work for the beneficiary.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;To mitigate this risk, implementers can consider using methods to identify proper sender and to generate unique and verifiable related payment references. However such implementations are not in the scope of this standard and rather extend it.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EOF - Creation transaction</title>
        <published>2024-04-24T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Piotr Dobaczewski</name><uri>https://github.com/pdobacz</uri>
	</author>
	
	<author>
		<name>Andrei Maiboroda</name><uri>https://github.com/gumb0</uri>
	</author>
	
	<author>
		<name>Paweł Bylica</name><uri>https://github.com/chfast</uri>
	</author>
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7698/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7698-eof-creation-transaction/19784" />
        

        <id>https://wg-eips.ritovision.com/7698/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7698"
            label="EIP-7698" />
        

        
        

        
        <summary type="html">Deploy EOF contracts using creation transactions</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7698/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Creation transactions (i.e. the ones with empty &lt;code&gt;to&lt;&#x2F;code&gt;) can be used to deploy EOF contracts by providing EOF initcontainer concatenated with &lt;code&gt;calldata&lt;&#x2F;code&gt; for initcontainer execution in transaction&#x27;s &lt;code&gt;data&lt;&#x2F;code&gt;. Initcontainer execution is similar to its execution during &lt;code&gt;EOFCREATE&lt;&#x2F;code&gt; instruction, ending with &lt;code&gt;RETURNCODE&lt;&#x2F;code&gt; instruction. New account address calculation is based on sender&#x27;s address and nonce.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Creation transaction is one of the three ways alongside creation instructions provided by legacy EVM to deploy new code. Given that legacy creation instructions (&lt;code&gt;CREATE&lt;&#x2F;code&gt; and &lt;code&gt;CREATE2&lt;&#x2F;code&gt;) are not allowed to deploy EOF code, supporting EOF in creation transactions is the only way to get the first EOF on-chain.&lt;&#x2F;p&gt;
&lt;p&gt;The mechanism for providing constructor arguments to initcontainer is exactly the same as for deploying legacy code (just concatenating them with initcontainer), therefore existing deployment tooling can be used as is to deploy EOF.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Wherever not explicitly listed, the rules of EOF contract creation should be identical or analogous to those of legacy creation transaction. This includes but is not limited to:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;behavior on &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt; and address collision (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;684&#x2F;&quot;&gt;EIP-684&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;EVM execution frame created for the initcode - memory, account context etc.&lt;&#x2F;li&gt;
&lt;li&gt;nonce bumping of the account of newly created contract &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;161&#x2F;&quot;&gt;EIP-161&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;balance checking and transfer for the creation endowment&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;EOF_MAGIC&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Defined as &lt;code&gt;0xEF00&lt;&#x2F;code&gt; in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3540&#x2F;&quot;&gt;EIP-3540&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_CODE_SIZE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Defined as &lt;code&gt;24576&lt;&#x2F;code&gt; in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;170&#x2F;&quot;&gt;EIP-170&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;In case a creation transaction (transaction with empty &lt;code&gt;to&lt;&#x2F;code&gt;) has &lt;code&gt;data&lt;&#x2F;code&gt; starting with &lt;code&gt;EOF_MAGIC&lt;&#x2F;code&gt;, &lt;code&gt;data&lt;&#x2F;code&gt; is interpreted as a concatenation of EOF &lt;code&gt;initcontainer&lt;&#x2F;code&gt; and &lt;code&gt;calldata&lt;&#x2F;code&gt;. More specifically:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Intrinsic gas cost rules and limits defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3860&#x2F;&quot;&gt;EIP-3860&lt;&#x2F;a&gt; for creation transactions apply. The entire &lt;code&gt;data&lt;&#x2F;code&gt; of the transaction is used for these calculations.&lt;&#x2F;li&gt;
&lt;li&gt;Find the split of &lt;code&gt;data&lt;&#x2F;code&gt; into &lt;code&gt;initcontainer&lt;&#x2F;code&gt; and &lt;code&gt;calldata&lt;&#x2F;code&gt;:
&lt;ul&gt;
&lt;li&gt;Parse EOF header&lt;&#x2F;li&gt;
&lt;li&gt;Find &lt;code&gt;intcontainer&lt;&#x2F;code&gt; size by reading all section sizes from the header and adding them up with the header size to get the full container size.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Validate the &lt;code&gt;initcontainer&lt;&#x2F;code&gt; and all its subcontainers recursively.
&lt;ul&gt;
&lt;li&gt;Unlike in general validation, &lt;code&gt;initcontainer&lt;&#x2F;code&gt; is additionally required to have &lt;code&gt;data_size&lt;&#x2F;code&gt; declared in the header equal to actual &lt;code&gt;data_section&lt;&#x2F;code&gt; size.&lt;&#x2F;li&gt;
&lt;li&gt;Validation includes checking that the &lt;code&gt;initcontainer&lt;&#x2F;code&gt; does not contain &lt;code&gt;RETURN&lt;&#x2F;code&gt; or &lt;code&gt;STOP&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;If EOF header parsing or full container validation fails, transaction is considered valid and failing. Gas for initcode execution is not consumed, only intrinsic creation transaction costs are charged.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;calldata&lt;&#x2F;code&gt; part of transaction &lt;code&gt;data&lt;&#x2F;code&gt; that follows &lt;code&gt;initcontainer&lt;&#x2F;code&gt; is treated as calldata to pass into the execution frame.&lt;&#x2F;li&gt;
&lt;li&gt;Execute the container and deduct gas for execution.
&lt;ol&gt;
&lt;li&gt;Calculate &lt;code&gt;new_address&lt;&#x2F;code&gt; as &lt;code&gt;keccak256(sender || sender_nonce)[12:]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;A successful execution ends with initcode executing &lt;code&gt;RETURNCODE{deploy_container_index}(aux_data_offset, aux_data_size)&lt;&#x2F;code&gt; instruction. After that:
&lt;ul&gt;
&lt;li&gt;load deploy-contract from EOF subcontainer at &lt;code&gt;deploy_container_index&lt;&#x2F;code&gt; in the container from which &lt;code&gt;RETURNCODE&lt;&#x2F;code&gt; is executed,&lt;&#x2F;li&gt;
&lt;li&gt;concatenate data section with &lt;code&gt;(aux_data_offset, aux_data_offset + aux_data_size)&lt;&#x2F;code&gt; memory segment and update data size in the header,&lt;&#x2F;li&gt;
&lt;li&gt;let &lt;code&gt;deployed_code_size&lt;&#x2F;code&gt; be updated deploy container size,&lt;&#x2F;li&gt;
&lt;li&gt;if &lt;code&gt;deployed_code_size &amp;gt; MAX_CODE_SIZE&lt;&#x2F;code&gt; instruction exceptionally aborts,&lt;&#x2F;li&gt;
&lt;li&gt;set &lt;code&gt;state[new_address].code&lt;&#x2F;code&gt; to the updated deploy container (rules of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3541&#x2F;&quot;&gt;EIP-3541&lt;&#x2F;a&gt;, prohibiting deployment of &lt;code&gt;code&lt;&#x2F;code&gt; starting with &lt;code&gt;EF&lt;&#x2F;code&gt; from creation transactions, do not apply in this case).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Deduct &lt;code&gt;200 * deployed_code_size&lt;&#x2F;code&gt; gas.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;irregular-state-change-to-deploy-creator-contract&quot;&gt;Irregular state change to deploy Creator Contract&lt;&#x2F;h3&gt;
&lt;p&gt;Originally it was proposed to deploy the first EOF contract via irregular state change. This contract would execute &lt;code&gt;TXCREATE&lt;&#x2F;code&gt; instruction and could be used then as an entry point to deploy any other EOF code. This would also require an introduction of &lt;code&gt;InitcodeTransaction&lt;&#x2F;code&gt;, required by &lt;code&gt;TXCREATE&lt;&#x2F;code&gt;. It was decided against this variant for the benefit of reduced scope of changes.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;constructor-arguments-outside-of-initcontainer-vs-in-data-section&quot;&gt;Constructor arguments outside of initcontainer vs in data section&lt;&#x2F;h3&gt;
&lt;p&gt;Alternative mechanism for providing constructor arguments to initcontainer execution was considered, where they are concatenated with data section of the initcontainer and are accessed via &lt;code&gt;DATA*&lt;&#x2F;code&gt; instructions instead of &lt;code&gt;CALLDATA*&lt;&#x2F;code&gt;. This has a benefit of not requiring the step finding the split of &lt;code&gt;transaction.data&lt;&#x2F;code&gt; into &lt;code&gt;initcontainer&lt;&#x2F;code&gt; and &lt;code&gt;calldata&lt;&#x2F;code&gt;, as entire &lt;code&gt;transaction.data&lt;&#x2F;code&gt; is an EOF container. However it was rejected for the following reasons:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Existing tooling could not be used for deploying EOF without modification. To construct EOF creation transaction, the tooling would need to append constructor arguments to the container, as well as update data section size in the EOF header. Compiler could predict the size of constructor arguments to put the anticipated data size in the header, but it would not be possible for variadic length constructor arguments.&lt;&#x2F;li&gt;
&lt;li&gt;In case a specialized EOF creation transaction is introduced in a later upgrade (such as the &lt;code&gt;InitcodeTransaction&lt;&#x2F;code&gt;), it would have a dedicated field for initcontainer execution input (&lt;code&gt;calldata&lt;&#x2F;code&gt;), and it will be accessed with &lt;code&gt;CALLDATA*&lt;&#x2F;code&gt; instructions in initcode. It is better to avoid the situation where compilers would need to generate initcontainer code differently depending on which context it will be used in.&lt;&#x2F;li&gt;
&lt;li&gt;As a general argument, data section can be seen to contain the data that execution considers validated and being closely coupled with the code definition, whereas calldata is an input from the outside that may be arbitrary and not validated.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Creation transactions deploying legacy code are not affected, because any such transaction starting with &lt;code&gt;EF&lt;&#x2F;code&gt; byte previously would fail on executing invalid instruction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;TBA&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Solana Storage Router</title>
        <published>2024-04-18T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Avneet Singh</name><uri>https://github.com/sshmatrix</uri>
	</author>
	
	<author>
		<name>0xc0de4c0ffee</name><uri>https://github.com/0xc0de4c0ffee</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7694/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7694-solana-storage-router/19706" />
        

        <id>https://wg-eips.ritovision.com/7694/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7694"
            label="ERC-7694" />
        

        
        

        
        <summary type="html">Cross-chain storage router protocol incorporating storage router for Solana</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7694/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The following standard is an extension to the cross-chain storage router protocol introducing the storage router for Solana blockchain. With this specification, any Ethereum L1 contract can defer a call to Solana blockchain as part of its core functionality, provided that the client is equipped to handle Solana transactions. It was previously possible to defer write and storage operations to other Ethereum L1 contracts, L2 contracts and off-chain databases, and this document extends that functionality to include alternative L1 chains. The data stored on Solana must be translated to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3668&#x2F;&quot;&gt;EIP-3668&lt;&#x2F;a&gt;-compliant format by an appropriate HTTP gateway where it can be retrieved by generic Ethereum contracts. This standard allows Ethereum to utilise a broader range of cross-chain blockspaces.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Cross-Chain Storage Router Protocol (CCIP-Store) introduced in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7700&#x2F;&quot;&gt;EIP-7700&lt;&#x2F;a&gt;, describes three external routers for routing storage to L1 contracts, L2s and databases. This document extends that specification by introducing a fourth storage router targeting Solana as the storage provider.&lt;&#x2F;p&gt;
&lt;p&gt;L2s and databases both have centralising catalysts in their stack. For L2s, this centralising agent is the shared security with Ethereum mainnet. In case of databases, the centralising agent is trivial; it is the physical server hosting the database. In light of this, a storage provider that relies on its own independent consensus mechanism is preferred. This specification instructs how the clients should treat storage calls made to the Solana router.&lt;&#x2F;p&gt;
&lt;p&gt;Solana is a low cost L1 solution that is supported alongside Ethereum by multiple wallet providers. There are several chain-agnostic protocols on Ethereum which could benefit from direct access to Solana blockspace; ENS is one such example where it can serve users of Solana via its chain-agnostic properties while also using Solana&#x27;s own native storage. This development will encourage more cross-chain functionalities between Ethereum and Solana at core.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7694&#x2F;.&#x2F;assets&#x2F;images&#x2F;Schema.svg&quot; alt=&quot;Fig.1 CCIP-Store and CCIP-Read Workflows&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;A Solana storage router &lt;code&gt;StorageRoutedToSolana()&lt;&#x2F;code&gt; requires the hex-encoded &lt;code&gt;programId&lt;&#x2F;code&gt; and the manager &lt;code&gt;account&lt;&#x2F;code&gt; on the Solana blockchain. &lt;code&gt;programId&lt;&#x2F;code&gt; is equivalent to a contract address on Solana while &lt;code&gt;account&lt;&#x2F;code&gt; is the manager wallet on Solana handling storage on behalf of &lt;code&gt;msg.sender&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Revert handling Solana storage router&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; StorageRoutedToSolana&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; programId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Generic function in a contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setValue&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get metadata from on-chain sources&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; programId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Program (= contract) address on Solana; hex-encoded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; account &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Manager account on Solana; hex-encoded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getMetadata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Arbitrary code&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; programId = 0x37868885bbaf236c5d2e7a38952f709e796a1c99d6c9d142a1a41755d7660de3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; account = 0xe853e0dcc1e57656bd760325679ea960d958a0a704274a5a12330208ba0f428f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Route storage call to Solana router&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; StorageRoutedToSolana&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        programId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Since Solana natively uses &lt;code&gt;base58&lt;&#x2F;code&gt; encoding in its virtual machine setup, &lt;code&gt;programId&lt;&#x2F;code&gt; values that are hex-encoded on EVM must be &lt;code&gt;base58&lt;&#x2F;code&gt;-decoded for usage on SVM. Clients implementing the Solana router must call the Solana &lt;code&gt;programId&lt;&#x2F;code&gt; using a Solana wallet that is connected to &lt;code&gt;account&lt;&#x2F;code&gt; using the &lt;code&gt;base58&lt;&#x2F;code&gt;-decoded (and casted to appropriate data type) calldata that it originally received.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Pseudo-code to write to Solana program (= contract) &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Decode all &amp;#39;bytes32&amp;#39; types in EVM to &amp;#39;PubKey&amp;#39; type in SVM&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;programId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; E2SVM&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;programId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Instantiate program interface on Solana&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; program&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; program&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;programId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; rpcProvider&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Connect to Solana wallet&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; wallet&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; useWallet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Call the Solana program using connected wallet with initial calldata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; [!] Only approved manager in the Solana program should call&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;wallet&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;publicKey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ===&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  await&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; program&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;wallet&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;setValue&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In the above example, EVM-specific &lt;code&gt;bytes32&lt;&#x2F;code&gt;-type variables &lt;code&gt;programId&lt;&#x2F;code&gt;, &lt;code&gt;account&lt;&#x2F;code&gt;, &lt;code&gt;node&lt;&#x2F;code&gt;, &lt;code&gt;key&lt;&#x2F;code&gt; and &lt;code&gt;value&lt;&#x2F;code&gt; must all be converted to SVM-specific &lt;code&gt;PubKey&lt;&#x2F;code&gt; data type. The equivalent &lt;code&gt;setValue()&lt;&#x2F;code&gt; function in the Solana program is of the form&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;rust&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Example function in Solana program&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pub&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; fn&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setValue&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    ctx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Context&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    node&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PubKey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PubKey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PubKey&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ProgramResult&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Code to verify PROGRAM_ID and rent exemption status&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Code for de-serialising, updating and re-serialising the data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Store serialised data in account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; [!] Stored data must be mapped by node &amp;amp; account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Since EVM and SVM have differing architectures, it is important to define precise data type castings from EVM to SVM. Some pre-existing custom but popular data types in SVM already equate to common EVM data types such as &lt;code&gt;PubKey&lt;&#x2F;code&gt; and &lt;code&gt;bytes32&lt;&#x2F;code&gt; respectively. This specification requires the following implementation of bijective EVM to SVM type casting:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&quot;text-align: center&quot;&gt;EVM&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;SVM&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;uint8&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;u8&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;uint16&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;u16&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;uint32&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;u32&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;uint64&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;u64&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;uint128&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;u128&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;uint256&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;u256&lt;&#x2F;code&gt;†&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;bytes1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;bytes: [u8; 1]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;bytes2&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;bytes: [u8; 2]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;bytes4&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;bytes: [u8; 4]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;bytes8&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;bytes: [u8; 8]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;bytes16&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;bytes: [u8; 16]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;bytes32&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;PubKey&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;bytes&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;bytes: Vec&amp;lt;u8&amp;gt;&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;string&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;String&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;address&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;bytes: [u8; 20]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;blockquote&gt;
&lt;p&gt;† &lt;code&gt;u256&lt;&#x2F;code&gt; is not available natively in SVM but is routinely implemented via &lt;code&gt;u256&lt;&#x2F;code&gt; crate in Rust&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;Using this strategy, most - if not all - current use-cases of &lt;code&gt;StorageRoutedToSolana()&lt;&#x2F;code&gt; are accounted for.&lt;&#x2F;p&gt;
&lt;p&gt;Finally, in order to read the cross-chain data stored on Solana in an arbitrary Ethereum contract, it must be translated back into EVM tongue by an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3668&#x2F;&quot;&gt;EIP-3668&lt;&#x2F;a&gt;-compliant HTTP gateway. The arguments for a generic call to the gateway URL must be specified in the &lt;code&gt;&#x2F;&lt;&#x2F;code&gt;-delimited nested format as described in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7700&#x2F;&quot;&gt;EIP-7700&lt;&#x2F;a&gt;. The core of such a gateway must follow&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Pseudo-code of an ERC-3668-compliant HTTP gateway tunneling Solana content to Ethereum &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; CCIP-Read call by contract to a known gateway URL; gatewayUrl = &amp;#39;https:&#x2F;&#x2F;read.solana.namesys.xyz&#x2F;&amp;lt;programId&amp;gt;&#x2F;&amp;lt;node&amp;gt;&#x2F;&amp;lt;key&amp;gt;&#x2F;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;programId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; parseQuery&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;path&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Parse query parameters from path; path = &amp;#39;&#x2F;&amp;lt;programId&amp;gt;&#x2F;&amp;lt;node&amp;gt;&#x2F;&amp;lt;key&amp;gt;&#x2F;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Decode &amp;#39;bytes32&amp;#39; types in EVM to &amp;#39;PubKey&amp;#39; type in SVM&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;programId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; E2SVM&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;programId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Instantiate program interface on Solana&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; program&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; program&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;programId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; rpcProvider&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Call the Solana program to read in cross-chain data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; program&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getValue&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !==&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;NOT_FOUND&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Decode &amp;#39;PubKey&amp;#39; type in SVM to &amp;#39;bytes32&amp;#39; type in EVM&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; S2EVM&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;PubKey&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Null value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Compile CCIP-Read-compatible payload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;value&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Create HTTP gateway emitting value in format &amp;#39;data: ...&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;emitERC3668&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In the above example, the generic &lt;code&gt;getValue()&lt;&#x2F;code&gt; function in the Solana program is of the form&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;rust&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Example getValue() function in Solana program&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pub&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; fn&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getValue&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    ctx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Context&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    node&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Pubkey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Pubkey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    account&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;AccountInfo&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Lifetime-bound parameter&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Result&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Pubkey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ProgramError&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Validate that the account belongs to the correct program ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieve the data from the account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;account&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;borrow&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; De-serialise the data from the account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Look up the value by node and key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    match&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; deserialised&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;get&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        Some&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            msg!&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;VALUE: &lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;:?&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            Ok&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        None&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            msg!&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;NOT_FOUND&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            Err&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ProgramError&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;::&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;InvalidArgument&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;StorageRoutedToSolana()&lt;&#x2F;code&gt; works in a similar fashion to &lt;code&gt;StorageRoutedToL2()&lt;&#x2F;code&gt; in CCIP-Store in the sense that the client needs to be pointed to a certain contract on another chain by the revert event. Other than that, the only technical difference is casting between EVM and SVM data types.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7694&#x2F;.&#x2F;assets&#x2F;images&#x2F;Solana.svg&quot; alt=&quot;Fig.2 Solana Call Lifecycle&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;None.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;None.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Blob throughput increase</title>
        <published>2024-04-17T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Parithosh Jayanthi</name><uri>https://github.com/parithosh</uri>
	</author>
	
	<author>
		<name>Toni Wahrstätter</name><uri>https://github.com/nerolation</uri>
	</author>
	
	<author>
		<name>Sam Calder-Mason</name><uri>https://github.com/samcm</uri>
	</author>
	
	<author>
		<name>Andrew Davis</name><uri>https://github.com/savid</uri>
	</author>
	
	<author>
		<name>Ansgar Dietrichs</name><uri>https://github.com/adietrichs</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7691/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7691-blob-throughput-increase/19694" />
        

        <id>https://wg-eips.ritovision.com/7691/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7691"
            label="EIP-7691" />
        

        
        

        
        <summary type="html">Increase the number of blobs to reach a new target and max of 6 and 9 blobs per block respectively</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7691/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Increases the number of blobs in a block to provide more scale to Ethereum via L2 solution that rely on L1 data capacity.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Ethereum, with its rollup centric roadmap, scales by relying on L2. Since the Dencun fork, the blob gas target and maximum was set to 3&#x2F;6 respectively. The blob gas limit was arrived at based on a series of big block tests performed on the Ethereum mainnet network as well as a series of testnets. The values were chosen cautiously, as it&#x27;s extremely hard to predict the exact p2p behaviour of Ethereum mainnet.&lt;&#x2F;p&gt;
&lt;p&gt;As we now have the Dencun upgrade live, we are able to use monitoring tools to check the network health. Initial monitoring indicates that we have a stable network with the current gas target and the re-org rate is trending downwards. Additionally, analysis on messages in gossipsub indicate that the inclusion of &lt;code&gt;IDONTWANT&lt;&#x2F;code&gt; messages could bring us a significant bandwidth savings. This allows us to consider starting a series of big block and blob tests to determine the theoretical headroom we currently have. The EIP specifies a proposed new blob gas target and limit based on the series of tests.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP aims to increase the throughput short term to provide some scaling until future solutions are deployed. In order to alleviate valid concerns about solo-stakers, approaches such as the inclusion of a flag indicating the max blobs per block for locally built blocks could be considered.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_BLOBS_PER_BLOCK_ELECTRA&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;9&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TARGET_BLOBS_PER_BLOCK_ELECTRA&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;6&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_BLOB_GAS_PER_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;1179648&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TARGET_BLOB_GAS_PER_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;786432&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;BLOB_BASE_FEE_UPDATE_FRACTION_PRAGUE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;5007716&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;&lt;code&gt;MAX_BLOBS_PER_BLOCK_ELECTRA&lt;&#x2F;code&gt; and &lt;code&gt;TARGET_BLOBS_PER_BLOCK_ELECTRA&lt;&#x2F;code&gt; are consumed by the consensus layer clients, and starting at &lt;code&gt;PECTRA_FORK_EPOCH&lt;&#x2F;code&gt; replace the respective old max and target values.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;MAX_BLOB_GAS_PER_BLOCK&lt;&#x2F;code&gt;, &lt;code&gt;TARGET_BLOB_GAS_PER_BLOCK&lt;&#x2F;code&gt; and &lt;code&gt;BLOB_BASE_FEE_UPDATE_FRACTION_PRAGUE&lt;&#x2F;code&gt; are consumed by the execution layer clients, and starting at the epoch when this EIP is activated, replace the old max, target and update fraction values.
Any references to &lt;code&gt;MAX_BLOB_GAS_PER_BLOCK&lt;&#x2F;code&gt; and &lt;code&gt;TARGET_BLOB_GAS_PER_BLOCK&lt;&#x2F;code&gt; in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt; should be updated to the new values defined in this EIP when processing the activation block.
The value &lt;code&gt;BLOB_BASE_FEE_UPDATE_FRACTION_PRAGUE&lt;&#x2F;code&gt; replaces its previous equivalent when processing the activation block.
These changes imply that &lt;code&gt;get_base_fee_per_blob_gas&lt;&#x2F;code&gt; and &lt;code&gt;calc_excess_blob_gas&lt;&#x2F;code&gt; functions defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt; use the new values for the first block of the fork (and for all subsequent blocks).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;simplicity&quot;&gt;Simplicity&lt;&#x2F;h3&gt;
&lt;p&gt;The EIP aims to minimize the amount of testing and implementation effort from the perspective of the client teams, to allow for more resources to be allocated to peerDAS and other scaling research.&lt;&#x2F;p&gt;
&lt;p&gt;While this EIP may not achieve the new optimal blob limit, it offers a compromise for a short term increase.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;update-fraction&quot;&gt;Update Fraction&lt;&#x2F;h3&gt;
&lt;p&gt;The original target and max values from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt; were at a 1:2 ratio. As a consequence, responsiveness to full and empty blob sections was symmetrical:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;full blobs: basefee increases by ~12.5%&lt;&#x2F;li&gt;
&lt;li&gt;no blobs: basefee decreases by ~11.1%&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The new target and max values from this EIP are at a 2:3 ratio, which breaks that symmetry. As a consequence, the basefee becomes significantly more responsive to empty blob sections (that are 6 blobs under target) than to full ones (that are 3 blobs over target). This is by design, as it takes two blocks with full blobs in a row to make up for a single block with no blobs. However, it creates the challenge of finding a good compromise base fee sensitivity level.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;BLOB_BASE_FEE_UPDATE_FRACTION_PRAGUE&lt;&#x2F;code&gt; value in this EIP is chosen as the mid-point between keeping the responsiveness to full blobs and no blobs constant:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;full blobs: basefee increases by ~8.2%&lt;&#x2F;li&gt;
&lt;li&gt;no blobs: basefee decreases by ~14.5%&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The consensus clients would continue to use &lt;code&gt;MAX_BLOBS_PER_BLOCK&lt;&#x2F;code&gt; and &lt;code&gt;TARGET_BLOBS_PER_BLOCK&lt;&#x2F;code&gt; for the deneb fork and once the &lt;code&gt;ELECTRA&lt;&#x2F;code&gt; fork is active, they would use &lt;code&gt;MAX_BLOBS_PER_BLOCK_ELECTRA&lt;&#x2F;code&gt; and &lt;code&gt;TARGET_BLOBS_PER_BLOCK_ELECTRA&lt;&#x2F;code&gt; respectively.&lt;&#x2F;p&gt;
&lt;p&gt;The execution clients would continue to use &lt;code&gt;MAX_BLOB_GAS_PER_BLOCK&lt;&#x2F;code&gt;, &lt;code&gt;TARGET_BLOB_GAS_PER_BLOCK&lt;&#x2F;code&gt; and &lt;code&gt;BLOB_BASE_FEE_UPDATE_FRACTION&lt;&#x2F;code&gt; for the cancun fork and once the prague fork is active, they would use &lt;code&gt;MAX_BLOB_GAS_PER_BLOCK&lt;&#x2F;code&gt;, &lt;code&gt;TARGET_BLOB_GAS_PER_BLOCK&lt;&#x2F;code&gt; and &lt;code&gt;BLOB_BASE_FEE_UPDATE_FRACTION_PRAGUE&lt;&#x2F;code&gt; respectively.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;network-impacts&quot;&gt;Network Impacts&lt;&#x2F;h3&gt;
&lt;p&gt;Through the use of big block&#x2F;blob tests on Ethereum mainnet as well as testnets, we can earn a high degree of certainty that the blob limit increase would not negatively impact the network. These tests as well as the associated analysis can be performed mostly by non-client team entities, with minimal input required. Since the changes are quite contained, the EIP should be able to reduce the risk of the blob limit increase.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;stability-around-fork-epoch&quot;&gt;Stability Around Fork Epoch&lt;&#x2F;h3&gt;
&lt;p&gt;A blob limit increase at the fork transition is relatively straightforward from an implementation perspective. We would need to deploy an increased amount of monitoring around the fork epoch, but after a period of stability we can assume that the blob limit increase was successful, reducing any unexpected co-ordination efforts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Conditional send transaction RPC</title>
        <published>2024-04-16T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Dror Tirosh</name><uri>https://github.com/drortirosh</uri>
	</author>
	
	<author>
		<name>Yoav Weiss</name><uri>https://github.com/yoavw</uri>
	</author>
	
	<author>
		<name>Alex Forshtat</name><uri>https://github.com/forshtat</uri>
	</author>
	
	<author>
		<name>Shahaf Nacson</name><uri>https://github.com/shahafn</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7796/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/send-transaction-conditional-rpc-api/21480" />
        

        <id>https://wg-eips.ritovision.com/7796/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7796"
            label="ERC-7796" />
        

        
        

        
        <summary type="html">JSON-RPC API for block builders allowing users to express preconditions for transaction inclusion</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7796/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes a new JSON-RPC API method &lt;code&gt;eth_sendRawTransactionConditional&lt;&#x2F;code&gt; for block builders and sequencers,
enhancing transaction integration by allowing users to express preconditions for transaction inclusion.&lt;&#x2F;p&gt;
&lt;p&gt;This method aims to improve efficiency by reducing the need for transaction simulation,
thereby improving the computational efficiency of transaction ordering.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Current private block builder APIs, such as the Flashbots API,
require block builders to simulate transactions to determine eligibility for inclusion,
a process that is CPU-intensive and inefficient.&lt;&#x2F;p&gt;
&lt;p&gt;The proposed RPC method addresses this by enabling transactions to specify preconditions,
thus reducing computational overhead and potentially lowering transaction costs.&lt;&#x2F;p&gt;
&lt;p&gt;Moreover, the flashbots API does not provide the block builder with a mechanism to determine the
cross-dependencies of different transactions.&lt;&#x2F;p&gt;
&lt;p&gt;The only way to guarantee that another transaction does not interfere with a given one is by placing
it as the first transaction in the block.
This makes this placement very lucrative, and disproportionately expensive.&lt;&#x2F;p&gt;
&lt;p&gt;In addition, since there is no way to give any guarantee on other slots, their pricing has to be low accordingly.&lt;&#x2F;p&gt;
&lt;p&gt;Since there is no easy way to detect cross-dependencies of different transactions,
it is CPU-intensive to find an optimal ordering of transactions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Method: &lt;code&gt;eth_sendRawTransactionConditional&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Parameters:&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;transaction&lt;&#x2F;code&gt;: The raw, signed transaction data. Similar to &lt;code&gt;eth_sendRawTransaction&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;options&lt;&#x2F;code&gt;: An object containing conditions under which the transaction must be included.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;options&lt;&#x2F;code&gt; parameter may include any of the following optional members:
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;knownAccounts&lt;&#x2F;strong&gt;: a mapping of accounts with their expected storage slots&#x27; values.
&lt;ul&gt;
&lt;li&gt;The key of the mapping is account address.&lt;&#x2F;li&gt;
&lt;li&gt;A special key &lt;code&gt;balance&lt;&#x2F;code&gt; defines the expected balance of the account.&lt;&#x2F;li&gt;
&lt;li&gt;A special key &lt;code&gt;code&lt;&#x2F;code&gt; defines the expected code of the account.
Use &lt;code&gt;&quot;&quot;&lt;&#x2F;code&gt; to indicate that address is expected not to have any code.
Use the &lt;code&gt;&quot;0xef0100&quot;&lt;&#x2F;code&gt; prefix to indicate a specific &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; delegation.&lt;&#x2F;li&gt;
&lt;li&gt;A special key &lt;code&gt;nonce&lt;&#x2F;code&gt; defines the expected nonce of the account.&lt;&#x2F;li&gt;
&lt;li&gt;If the value is &lt;strong&gt;hex string&lt;&#x2F;strong&gt;, it is the known storage root hash of that account.&lt;&#x2F;li&gt;
&lt;li&gt;If the value is an &lt;strong&gt;object&lt;&#x2F;strong&gt;, then it is a mapping where each member is in the format of &lt;code&gt;&quot;slot&quot;: &quot;value&quot;&lt;&#x2F;code&gt;.
The &lt;code&gt;value&lt;&#x2F;code&gt; fields are explicit slot values of the account&#x27;s storage.
Both &lt;code&gt;slot&lt;&#x2F;code&gt; and &lt;code&gt;value&lt;&#x2F;code&gt; are hex-encoded strings.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;blockNumberMin&lt;&#x2F;strong&gt;: minimal block number for inclusion.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;blockNumberMax&lt;&#x2F;strong&gt;: maximum block number for inclusion.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;timestampMin&lt;&#x2F;strong&gt;: minimum block timestamp for inclusion.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;timestampMax&lt;&#x2F;strong&gt;: maximum block timestamp for inclusion.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;paysCoinbase&lt;&#x2F;strong&gt;: the caller declares the minimum amount paid to the &lt;code&gt;coinbase&lt;&#x2F;code&gt; by this transaction,
including gas fees and direct payment.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Before accepting the request, the block builder or sequencer SHOULD:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Check that the block number is within the block range if the block range value was specified.&lt;&#x2F;li&gt;
&lt;li&gt;Check that the block timestamp is within the timestamp range if the timestamp range was specified.&lt;&#x2F;li&gt;
&lt;li&gt;For all addresses with a specified storage root hash, validate the current root is unmodified.&lt;&#x2F;li&gt;
&lt;li&gt;For all addresses with a specified slot values mapping, validate that all these slots hold the exact value specified.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The sequencer should REJECT the request if any address does not pass the above rules.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;return-value&quot;&gt;Return value&lt;&#x2F;h3&gt;
&lt;p&gt;In case of a successful inclusion, the call should return a hash of the newly submitted transaction.
This behaviour is equivalent to the &lt;code&gt;eth_sendRawTransaction&lt;&#x2F;code&gt; JSON-RPC API method.&lt;&#x2F;p&gt;
&lt;p&gt;In case of an immediate failure to validate the transaction&#x27;s conditions,
the block builder SHOULD return an error with indication of failure reason.&lt;&#x2F;p&gt;
&lt;p&gt;The error code SHOULD be &quot;-32003 transaction rejected&quot; with reason string describing the cause:
i.e. storage error, out of block&#x2F;time range, etc.&lt;&#x2F;p&gt;
&lt;p&gt;In case of repeated failures or &lt;code&gt;knownAccounts&lt;&#x2F;code&gt; mapping being too large for the current block builder to handle,
the error code SHOULD be &quot;-32005 limit exceeded&quot; with a description of the error.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;NOTE:&lt;&#x2F;strong&gt; Same as with the &lt;code&gt;eth_sendRawTransaction&lt;&#x2F;code&gt; method,
even if the RPC method call does not resul in an error and the transaction is
initially accepted into the internal block builder&#x27;s mempool,
the caller MUST NOT assume that a transaction will be included in a block and should monitor the blockchain.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;sample-request&quot;&gt;Sample request&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;method&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_sendRawTransactionConditional&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x2815c17b00...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;blockNumberMax&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 12345&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;knownAccounts&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;0xadd1&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xfedc....&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;0xadd2&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;0x1111&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1234...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;0x2222&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x4567...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span&gt;     &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;limitations&quot;&gt;Limitations&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Callers should not assume that a successful response means the transaction is included.
Specifically, it is possible that a block re-order might remove the transaction or cause it to fail.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;knownAccounts&lt;&#x2F;code&gt; only allows specifying the exact values for storage slots.
While in some cases specifying &lt;code&gt;minValue&lt;&#x2F;code&gt; or &lt;code&gt;maxValue&lt;&#x2F;code&gt; for a slot could be useful,
it would significantly increase complexity of the proposed API.
Additionally, determining the validity range for a slot value is a non-trivial task for the sender of a transaction.&lt;&#x2F;p&gt;
&lt;p&gt;One way to provide a more complex rule for a transaction condition is by specifying the &lt;code&gt;paysCoinbase&lt;&#x2F;code&gt; parameter,
and issuing a transfer to the &lt;code&gt;coinbase&lt;&#x2F;code&gt; address on some condition.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This is a proposal for a new API method so no backward compatibility issues are expected.
Existing non-standard implementations of &lt;code&gt;eth_sendRawTransactionConditional&lt;&#x2F;code&gt; API may need to be modified in order to
become compatible with the standard.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The block builder should protect itself against abuse of the API.
Namely, a malicious actor submitting a large number of requests which are known to fail may lead to a denial of service.&lt;&#x2F;p&gt;
&lt;p&gt;Following is the list of suggested potential mitigation mechanisms:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Throttling&lt;&#x2F;strong&gt;: the block builder should allow a maximum rate of RPC calls per sender.
The block builder may increase that rate after a successful inclusion.
Repeated rejections of transactions should reduce the allowed rate.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Arbitrum&lt;&#x2F;strong&gt;-style protection: Arbitrum implemented this API, but they run the storage validation not only
against the current block, but also into past 2 seconds.
This prevents abusing the API for MEV, while making it viable for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt; account validation.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Fastlane on Polygon&lt;&#x2F;strong&gt; uses it explicitly for ERC-4337,
by checking the submitted UserOperations exist on the public mempool and rejecting the transaction otherwise.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Linear EVM memory limits</title>
        <published>2024-04-15T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7686/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7686-linear-evm-memory-limits/19448" />
        

        <id>https://wg-eips.ritovision.com/7686/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:7686"
            label="EIP-7686" />
        

        
        

        
        <summary type="html">Adjust memory limits and gas limits of sub-calls to create a clear linear bound on how much total memory an EVM execution can consume</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7686/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Add a hard memory limit equal to the gas limit of the current context. Make the maximum gas cost of a sub-call depend on the memory used in the current context. The two rules together ensure that a transaction with N gas can use at most N bytes of memory.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Today, memory pricing rules are complicated: we have the quadratic cost for expanding memory as well as the 63&#x2F;64 rule for how much gas can go into a child call. This also makes it extremely hard to calculate a maximum possible amount of memory required to process a given EVM execution.&lt;&#x2F;p&gt;
&lt;p&gt;The rules in this post simplify these rules, and add a new hard limit: an EVM execution with N gas can require at most N total bytes of memory to process. This limit is tight: there are easy ways for an N-gas call to use &lt;code&gt;N - O(1)&lt;&#x2F;code&gt; bytes of memory.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Change &lt;code&gt;memory_cost&lt;&#x2F;code&gt; from:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;memory_size_word&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;memory_byte_size&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 31&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;memory_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;memory_size_word&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; **&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 512&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; memory_size_word&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;To:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;memory_size_word&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;memory_byte_size&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 31&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;memory_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; memory_size_word&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Additionally, if a memory expansion would lead to &lt;code&gt;memory_byte_size&lt;&#x2F;code&gt; strictly exceeding the current call&#x27;s initial gas limit, revert with an error.&lt;&#x2F;p&gt;
&lt;p&gt;When making any type of call, change the maximum gas limit from the current &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;150&#x2F;&quot;&gt;EIP-150&lt;&#x2F;a&gt; definition:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; max_call_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 64&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;To:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; max_call_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; memory_byte_size&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 64&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; memory_byte_size&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;With this EIP, there is a simple EVM implementation that can process an N-gas call using an N-byte bytearray as memory: allocate all bytes to the current context, when doing a child call use the remaining memory starting from the position &lt;code&gt;memory_byte_size&lt;&#x2F;code&gt; for the child call&#x27;s memory, and so on recursively.&lt;&#x2F;p&gt;
&lt;p&gt;Having this clean invariant is useful for EVM implementations, especially EVM implementations in constrained environments (eg. ZK-SNARK provers).&lt;&#x2F;p&gt;
&lt;p&gt;The 3 gas per word memory expansion cost is retained because it is equivalent to MCOPY, and so the operation of clearing memory at the end of a child call (cheap in regular machines, but more expensive in ZK-SNARKs and other unusual contexts) can be implemented with the same logic as that used to implement the MCOPY opcode itself.&lt;&#x2F;p&gt;
&lt;p&gt;The 63&#x2F;64 rule is maintained in order to maintain the current de-facto call stack depth limit of roughly &lt;code&gt;1 + log((gaslimit + 6300) &#x2F; 6400) &#x2F; log(64&#x2F;63) = 537&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;It is theoretically possible for EVM code that works today to fail to work under this new EIP, if that code accesses a high index in memory but is called with a low gas limit. However, almost all EVM execution consumes far more code than it uses bytes of memory. For example, for a call to cause even a single state change, it must have at least 5000 gas. This would allow it 5000 bytes of memory, which is greater than that used by almost all applications. More complex applications would have even higher limits.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;No security concerns were raised.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Forward compatible consensus data structures</title>
        <published>2024-04-15T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Etan Kissling</name><uri>https://github.com/etan-status</uri>
	</author>
	
	<author>
		<name>Cayman</name><uri>https://github.com/wemeetagain</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7688/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7688-forward-compatible-consensus-data-structures/19673" />
        

        <id>https://wg-eips.ritovision.com/7688/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7688"
            label="EIP-7688" />
        

        
        

        
        <summary type="html">Transition consensus SSZ data structures to ProgressiveContainer</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7688/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP defines the changes needed to adopt &lt;code&gt;ProgressiveContainer&lt;&#x2F;code&gt; from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7495&#x2F;&quot;&gt;EIP-7495&lt;&#x2F;a&gt; and &lt;code&gt;ProgressiveList&lt;&#x2F;code&gt; from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7916&#x2F;&quot;&gt;EIP-7916&lt;&#x2F;a&gt; in consensus data structures.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Ethereum&#x27;s consensus data structures make heavy use of &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;ssz&#x2F;simple-serialize.md&quot;&gt;Simple Serialize (SSZ)&lt;&#x2F;a&gt; &lt;code&gt;Container&lt;&#x2F;code&gt;, which defines how they are serialized and merkleized. The merkleization scheme allows application implementations to verify that individual fields (and partial fields) have not been tampered with. This is useful, for example, in smart contracts of decentralized staking pools that wish to verify that participating validators have not been slashed.&lt;&#x2F;p&gt;
&lt;p&gt;While SSZ &lt;code&gt;Container&lt;&#x2F;code&gt; defines how data structures are merkleized, the merkleization is prone to change across the different forks. When that happens, e.g., because new features are added or old features get removed, existing verifier implementations need to be updated to be able to continue processing proofs.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;ProgressiveContainer&lt;&#x2F;code&gt;, of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7495&#x2F;&quot;&gt;EIP-7495&lt;&#x2F;a&gt;, is a forward compatible alternative that guarantees a forward compatible merkleization scheme. By transitioning consensus data structures to use &lt;code&gt;ProgressiveContainer&lt;&#x2F;code&gt;, smart contracts that contain verifier logic no longer have to be maintained in lockstep with Ethereum&#x27;s fork schedule as long as the underlying features that they verify don&#x27;t change. For example, as long as the concept of slashing is represented using the boolean &lt;code&gt;slashed&lt;&#x2F;code&gt; field, existing verifiers will not break when unrelated features get added or removed. This is also true for off-chain verifiers, e.g., in hardware wallets or in operating systems for mobile devices that are on a different software update cadence than Ethereum.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;container-conversion&quot;&gt;&lt;code&gt;Container&lt;&#x2F;code&gt; conversion&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;Container&lt;&#x2F;code&gt; types that are expected to evolve over forks SHALL be redefined as &lt;code&gt;ProgressiveContainer(active_fields=[1] * len(type.fields()))&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;For example, given a type in the old fork:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Foo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    a&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    b&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint16&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This type can be converted to support stable Merkleization in the new fork:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Foo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    a&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    b&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint16&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;As part of the conversion, a stable &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;ssz&#x2F;merkle-proofs.md#generalized-merkle-tree-index&quot;&gt;generalized index (gindex)&lt;&#x2F;a&gt; is assigned to each field that remains valid in future forks.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If a fork appends a field, &lt;code&gt;active_fields&lt;&#x2F;code&gt; MUST be extended with a trailing &lt;code&gt;1&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If a fork removes a field, the corresponding &lt;code&gt;active_fields&lt;&#x2F;code&gt; bit MUST be changed to &lt;code&gt;0&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Compatibility rules SHOULD be enforced, e.g., by defining a &lt;code&gt;CompatibleUnion[fork_1.Foo, fork_2.Foo, fork_3.Foo, ...]&lt;&#x2F;code&gt; type in the unit test framework.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;list-type-n-bitlist-conversion&quot;&gt;&lt;code&gt;List[type, N]&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;Bitlist&lt;&#x2F;code&gt; conversion&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;List&lt;&#x2F;code&gt; types frequently have been defined with excessively large capacities &lt;code&gt;N&lt;&#x2F;code&gt; with the intention that &lt;code&gt;N&lt;&#x2F;code&gt; is never reached in practice. In other cases, the capacity itself has changed over time.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;List&lt;&#x2F;code&gt; types with dynamic or unbounded capacity semantics SHALL be redefined as &lt;code&gt;ProgressiveList[type]&lt;&#x2F;code&gt;, and the application logic SHALL be updated to check for an appropriate limit at runtime.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Bitlist&lt;&#x2F;code&gt; types with dynamic or unbounded capacity semantics SHALL be redefined as &lt;code&gt;ProgressiveBitlist&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;As part of the conversion, a stable &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;ssz&#x2F;merkle-proofs.md#generalized-merkle-tree-index&quot;&gt;generalized index (gindex)&lt;&#x2F;a&gt; is assigned to each list element that remains valid regardless of the number of added elements.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;converted-types&quot;&gt;Converted types&lt;&#x2F;h3&gt;
&lt;p&gt;The following types SHALL be converted to &lt;code&gt;ProgressiveContainer&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;electra&#x2F;beacon-chain.md#attestation&quot;&gt;&lt;code&gt;Attestation&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;aggregation_bits&lt;&#x2F;code&gt; field is redefined to use &lt;code&gt;ProgressiveBitlist&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;electra&#x2F;beacon-chain.md#indexedattestation&quot;&gt;&lt;code&gt;IndexedAttestation&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;attesting_indices&lt;&#x2F;code&gt; field is redefined to use &lt;code&gt;ProgressiveList&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;deneb&#x2F;beacon-chain.md#executionpayload&quot;&gt;&lt;code&gt;ExecutionPayload&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;transactions&lt;&#x2F;code&gt; and &lt;code&gt;withdrawals&lt;&#x2F;code&gt; fields are redefined to use &lt;code&gt;ProgressiveList&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;MAX_TRANSACTIONS_PER_PAYLOAD&lt;&#x2F;code&gt; (1M) limit is no longer enforced (the limit is unreachable with &lt;code&gt;MAX_PAYLOAD_SIZE&lt;&#x2F;code&gt; 10 MB)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;electra&#x2F;beacon-chain.md#executionrequests&quot;&gt;&lt;code&gt;ExecutionRequests&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;deposits&lt;&#x2F;code&gt;, &lt;code&gt;withdrawals&lt;&#x2F;code&gt; and &lt;code&gt;consolidations&lt;&#x2F;code&gt; fields are redefined to use &lt;code&gt;ProgressiveList&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;electra&#x2F;beacon-chain.md#beaconblockbody&quot;&gt;&lt;code&gt;BeaconBlockBody&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;proposer_slashings&lt;&#x2F;code&gt;, &lt;code&gt;attester_slashings&lt;&#x2F;code&gt;, &lt;code&gt;attestations&lt;&#x2F;code&gt;, &lt;code&gt;deposits&lt;&#x2F;code&gt;, &lt;code&gt;voluntary_exits&lt;&#x2F;code&gt; and &lt;code&gt;bls_to_execution_changes&lt;&#x2F;code&gt; fields are redefined to use &lt;code&gt;ProgressiveList&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;electra&#x2F;beacon-chain.md#beaconstate&quot;&gt;&lt;code&gt;BeaconState&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;validators&lt;&#x2F;code&gt;, &lt;code&gt;balances&lt;&#x2F;code&gt;, &lt;code&gt;previous_epoch_participation&lt;&#x2F;code&gt;, &lt;code&gt;current_epoch_participation&lt;&#x2F;code&gt;, &lt;code&gt;inactivity_scores&lt;&#x2F;code&gt;, &lt;code&gt;pending_deposits&lt;&#x2F;code&gt;, &lt;code&gt;pending_partial_withdrawals&lt;&#x2F;code&gt; and &lt;code&gt;pending_consolidations&lt;&#x2F;code&gt; fields are redefined to use &lt;code&gt;ProgressiveList&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;blob_kzg_commitments&lt;&#x2F;code&gt;, &lt;code&gt;kzg_proofs&lt;&#x2F;code&gt; and &lt;code&gt;column&lt;&#x2F;code&gt; fields are redefined to use &lt;code&gt;ProgressiveList&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;immutable-types&quot;&gt;Immutable types&lt;&#x2F;h3&gt;
&lt;p&gt;These types are used as part of the &lt;code&gt;ProgressiveContainer&lt;&#x2F;code&gt; definitions, and, as they are not &lt;code&gt;ProgressiveContainer&lt;&#x2F;code&gt; themselves, are considered to have immutable Merkleization. If a future fork requires changing these types in an incompatible way, a new type SHALL be defined and assigned a new field name.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#custom-types&quot;&gt;&lt;code&gt;Slot&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Slot number on the beacon chain&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#custom-types&quot;&gt;&lt;code&gt;Epoch&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Epoch number on the beacon chain, a group of slots&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#custom-types&quot;&gt;&lt;code&gt;CommitteeIndex&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Index of a committee within a slot&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#custom-types&quot;&gt;&lt;code&gt;ValidatorIndex&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Unique index of a beacon chain validator&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#custom-types&quot;&gt;&lt;code&gt;Gwei&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Amount in Gwei (1 ETH = 10^9 Gwei = 10^18 Wei)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#custom-types&quot;&gt;&lt;code&gt;Root&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Byte vector containing an SSZ Merkle root&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#custom-types&quot;&gt;&lt;code&gt;Hash32&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Byte vector containing an opaque 32-byte hash&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#custom-types&quot;&gt;&lt;code&gt;Version&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Consensus fork version number&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#custom-types&quot;&gt;&lt;code&gt;BLSPubkey&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Cryptographic type representing a BLS12-381 public key&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#custom-types&quot;&gt;&lt;code&gt;BLSSignature&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Cryptographic type representing a BLS12-381 signature&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;_features&#x2F;sharding&#x2F;polynomial-commitments.md#custom-types&quot;&gt;&lt;code&gt;KZGCommitment&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;G1 curve point for the KZG polynomial commitment scheme&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#fork&quot;&gt;&lt;code&gt;Fork&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Consensus fork information&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#checkpoint&quot;&gt;&lt;code&gt;Checkpoint&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Tuple referring to the most recent beacon block up through an epoch&#x27;s start slot&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#validator&quot;&gt;&lt;code&gt;Validator&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Information about a beacon chain validator&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#attestationdata&quot;&gt;&lt;code&gt;AttestationData&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Vote that attests to the availability and validity of a particular consensus block&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#eth1data&quot;&gt;&lt;code&gt;Eth1Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Target tracker for importing deposits from transaction logs&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#depositdata&quot;&gt;&lt;code&gt;DepositData&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Log data emitted as part of a transaction&#x27;s receipt when depositing to the beacon chain&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#beaconblockheader&quot;&gt;&lt;code&gt;BeaconBlockHeader&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Consensus block header&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#proposerslashing&quot;&gt;&lt;code&gt;ProposerSlashing&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Tuple of two equivocating consensus block headers&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#deposit&quot;&gt;&lt;code&gt;Deposit&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Tuple of deposit data and its inclusion proof&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#voluntaryexit&quot;&gt;&lt;code&gt;VoluntaryExit&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Consensus originated request to exit a validator from the beacon chain&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#signedvoluntaryexit&quot;&gt;&lt;code&gt;SignedVoluntaryExit&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Tuple of voluntary exit request and its signature&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;altair&#x2F;beacon-chain.md#syncaggregate&quot;&gt;&lt;code&gt;SyncAggregate&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Cryptographic type representing an aggregate sync committee signature&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;bellatrix&#x2F;beacon-chain.md#custom-types&quot;&gt;&lt;code&gt;ExecutionAddress&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Byte vector containing an account address on the execution layer&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;bellatrix&#x2F;beacon-chain.md#custom-types&quot;&gt;&lt;code&gt;Transaction&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Byte list containing an RLP encoded transaction&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;capella&#x2F;beacon-chain.md#custom-types&quot;&gt;&lt;code&gt;WithdrawalIndex&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Unique index of a withdrawal from any validator&#x27;s balance to the execution layer&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;capella&#x2F;beacon-chain.md#withdrawal&quot;&gt;&lt;code&gt;Withdrawal&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Withdrawal from a beacon chain validator&#x27;s balance to the execution layer&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;electra&#x2F;beacon-chain.md#depositrequest&quot;&gt;&lt;code&gt;DepositRequest&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Tuple of flattened deposit data and its sequential index&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;electra&#x2F;beacon-chain.md#withdrawalrequest&quot;&gt;&lt;code&gt;WithdrawalRequest&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Execution originated request to withdraw from a validator to the execution layer&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;electra&#x2F;beacon-chain.md#consolidation&quot;&gt;&lt;code&gt;ConsolidationRequest&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Execution originated request to consolidate two beacon chain validators&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;capella&#x2F;beacon-chain.md#blstoexecutionchange&quot;&gt;&lt;code&gt;BLSToExecutionChange&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Request to register the withdrawal account address of a beacon chain validator&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;capella&#x2F;beacon-chain.md#signedblstoexecutionchange&quot;&gt;&lt;code&gt;SignedBLSToExecutionChange&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Tuple of withdrawal account address registration request and its signature&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;altair&#x2F;beacon-chain.md#custom-types&quot;&gt;&lt;code&gt;ParticipationFlags&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Participation tracker of a beacon chain validator within an epoch&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;capella&#x2F;beacon-chain.md#historicalsummary&quot;&gt;&lt;code&gt;HistoricalSummary&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Tuple combining a historical block root and historical state root&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;electra&#x2F;beacon-chain.md#pendingdeposit&quot;&gt;&lt;code&gt;PendingDeposit&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Pending operation for depositing to a beacon chain validator&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;electra&#x2F;beacon-chain.md#pendingpartialwithdrawal&quot;&gt;&lt;code&gt;PendingPartialWithdrawal&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Pending operation for withdrawing from a beacon chain validator&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;electra&#x2F;beacon-chain.md#pendingconsolidation&quot;&gt;&lt;code&gt;PendingConsolidation&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Pending operation for consolidating two beacon chain validators&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;best-timing&quot;&gt;Best timing?&lt;&#x2F;h3&gt;
&lt;p&gt;Applying this EIP breaks &lt;code&gt;hash_tree_root&lt;&#x2F;code&gt; and Merkle tree verifiers a single time, while promising forward compatibility from the fork going forward. It is best to apply it before merkleization would be broken by different changes. Merkleization is broken by a &lt;code&gt;Container&lt;&#x2F;code&gt; reaching a new power of 2 in its number of fields.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;can-this-be-applied-retroactively&quot;&gt;Can this be applied retroactively?&lt;&#x2F;h3&gt;
&lt;p&gt;While &lt;code&gt;ProgressiveContainer&lt;&#x2F;code&gt; serializes in the same way as the legacy &lt;code&gt;Container&lt;&#x2F;code&gt;, the merkleization and &lt;code&gt;hash_tree_root&lt;&#x2F;code&gt; of affected data structures changes. Therefore, verifiers that wish to process Merkle proofs of legacy variants still need to support the corresponding legacy schemes.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;immutability&quot;&gt;Immutability&lt;&#x2F;h3&gt;
&lt;p&gt;Once a field in a &lt;code&gt;ProgressiveContainer&lt;&#x2F;code&gt; has been published, its name can no longer be used to represent a different type in the future. This is in line with historical management of certain cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Phase0: &lt;code&gt;BeaconState&lt;&#x2F;code&gt; contained &lt;code&gt;previous_epoch_attestations&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;current_epoch_attestations&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Altair: &lt;code&gt;BeaconState&lt;&#x2F;code&gt; replaced these fields with &lt;code&gt;previous_epoch_participation&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;current_epoch_participation&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Furthermore, new fields have to be appended at the end of &lt;code&gt;ProgressiveContainer&lt;&#x2F;code&gt;. This is in line with historical management of other cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Capella appended &lt;code&gt;historical_summaries&lt;&#x2F;code&gt; to &lt;code&gt;BeaconState&lt;&#x2F;code&gt; instead of squeezing the new field next to &lt;code&gt;historical_roots&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;With &lt;code&gt;ProgressiveContainer&lt;&#x2F;code&gt;, stable Merkleization requires these rules to become strict.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;cleanup-opportunities&quot;&gt;Cleanup opportunities&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;beaconstate&quot;&gt;&lt;code&gt;BeaconState&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;eth1_data&lt;&#x2F;code&gt;, &lt;code&gt;eth1_data_votes&lt;&#x2F;code&gt;, &lt;code&gt;eth1_deposit_index&lt;&#x2F;code&gt; and &lt;code&gt;deposit_requests_start_index&lt;&#x2F;code&gt; fields could be dropped as they are no longer needed after the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6110&#x2F;#eth1data-poll-deprecation&quot;&gt;EIP-6110&lt;&#x2F;a&gt; transition period finishes.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;historical_summaries&lt;&#x2F;code&gt; could be redefined to use &lt;code&gt;ProgressiveList&lt;&#x2F;code&gt; and also integrate the historical &lt;code&gt;historical_roots&lt;&#x2F;code&gt; data by merging in full &lt;code&gt;HistoricalSummary&lt;&#x2F;code&gt; data from an archive (&lt;code&gt;historical_root&lt;&#x2F;code&gt; is frozen since Capella), simplifying access to historical block and state roots.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;attestation&quot;&gt;&lt;code&gt;Attestation&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;committee_bits&lt;&#x2F;code&gt; is defined as a &lt;code&gt;Bitvector&lt;&#x2F;code&gt;, but the top bits are forced to 0 based on &lt;code&gt;get_committee_count_per_slot(state, data.target.epoch)&lt;&#x2F;code&gt;. It could be re-defined as a &lt;code&gt;ProgressiveBitlist&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;indexedattestation&quot;&gt;&lt;code&gt;IndexedAttestation&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;attesting_indices&lt;&#x2F;code&gt; are limited to &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;electra&#x2F;beacon-chain.md#indexedattestation&quot;&gt;&lt;code&gt;MAX_VALIDATORS_PER_COMMITTEE * MAX_COMMITTEES_PER_SLOT&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;, which is insufficient when the &lt;code&gt;IndexedAttestation&lt;&#x2F;code&gt; is formed from &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;electra&#x2F;beacon-chain.md#singleattestation&quot;&gt;&lt;code&gt;SingleAttestation&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; traffic. &lt;code&gt;SingleAttestation&lt;&#x2F;code&gt; allows validators that are not assigned to a slot to produce signatures that are not aggregatable into an &lt;code&gt;Attestation&lt;&#x2F;code&gt; (as such validators are not assigned), but that are still slashable.&lt;&#x2F;p&gt;
&lt;p&gt;Further, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;electra&#x2F;beacon-chain.md#max-operations-per-block&quot;&gt;&lt;code&gt;MAX_ATTESTER_SLASHINGS_ELECTRA&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; at 1 limits inclusion efficiency of slashings in non-finality scenarios with a lot of forks where slashings happen across multiple different &lt;code&gt;AttestationData&lt;&#x2F;code&gt; values.&lt;&#x2F;p&gt;
&lt;p&gt;Limits could be rethought to be based on actual resource usage, e.g., by limiting:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The total number of &lt;code&gt;attesting_indices&lt;&#x2F;code&gt; across all &lt;code&gt;AttesterSlashing&lt;&#x2F;code&gt; (shared total)&lt;&#x2F;li&gt;
&lt;li&gt;The total number of signature checks across all &lt;code&gt;AttesterSlashing&lt;&#x2F;code&gt;, &lt;code&gt;ProposerSlashing&lt;&#x2F;code&gt;, &lt;code&gt;VoluntaryExit&lt;&#x2F;code&gt;, and &lt;code&gt;SignedBLSToExecutionChange&lt;&#x2F;code&gt; messages&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Limiting totals rather than individual resources would allow extra attester slashings to be included at the cost of potentially delaying inclusion of a couple altruistic messages (if there even are any &lt;code&gt;VoluntaryExit&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;SignedBLSToExecutionChange&lt;&#x2F;code&gt; messages at that time), thus increasing security and block packing efficiency.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;executionpayload&quot;&gt;&lt;code&gt;ExecutionPayload&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;block_hash&lt;&#x2F;code&gt; field could be moved to the top of &lt;code&gt;ExecutionPayload&lt;&#x2F;code&gt;, reducing the Merkle proof size.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;executionrequests&quot;&gt;&lt;code&gt;ExecutionRequests&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;As deposits cannot be retried by the user (they pay the ETH upfront), deposit requests cannot fizzle like other requests; they are always included in the same block (since Pectra). For that reason, the current &lt;code&gt;MAX_DEPOSIT_REQUESTS_PER_PAYLOAD&lt;&#x2F;code&gt; (8192) is essentially unbounded at current gas limits, but may eventually become reachable (around ~192M gas, or earlier with gas repricings). The CL limit for deposit requests could be dropped to avoid scaling issues, instead solely relying on EL backpressure (gas fees, 1 ETH deposit minimum).&lt;&#x2F;p&gt;
&lt;p&gt;For other requests (withdrawal &#x2F; consolidation requests), a shared total limit based on the added CL state size could provide more flexibility than the current per-operation limits. For example, in times without consolidation requests, space could be used to enqueue more withdrawal requests.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;beaconblockheader&quot;&gt;&lt;code&gt;BeaconBlockHeader&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;BeaconBlockHeader&lt;&#x2F;code&gt; is currently proposed to be kept as is. Updating the &lt;code&gt;BeaconBlockHeader&lt;&#x2F;code&gt; to &lt;code&gt;ProgressiveContainer&lt;&#x2F;code&gt; is tricky as it breaks &lt;code&gt;hash_tree_root(latest_block_header)&lt;&#x2F;code&gt; in the &lt;code&gt;BeaconState&lt;&#x2F;code&gt;. One option could be to store &lt;code&gt;latest_block_header_root&lt;&#x2F;code&gt; separately, possibly also incorporating the block proposer signature into the hash to avoid proposer signature checks while backfilling historical blocks.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;validator&quot;&gt;&lt;code&gt;Validator&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;Validator&lt;&#x2F;code&gt; container is currently proposed to be kept as is. Updating the &lt;code&gt;Validator&lt;&#x2F;code&gt; to &lt;code&gt;ProgressiveContainer&lt;&#x2F;code&gt; would add an extra hash for each validator; validators are mostly immutable so rarely need to be re-hashed. With a conversion, implementations may have to incrementally construct the new &lt;code&gt;Validator&lt;&#x2F;code&gt; entries ahead of the fork when validator counts are high. It should be evaluated whether the hashing overhead is worth a clean transition to future fields, e.g., for holding postquantum keys. Also consider that such a transition may also involve a new hash function, which is a breaking change to the Merkle proofs, so generalized indices do not have to be stable across that transition.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Existing Merkle proof verifiers need to be updated to support the new Merkle tree shape. This includes verifiers in smart contracts on different blockchains and verifiers in hardware wallets, if applicable.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Before this EIP, all &lt;code&gt;List&lt;&#x2F;code&gt; types had a fixed upper bound, enabling implementations to reject messages exceeding that size early. With &lt;code&gt;ProgressiveList&lt;&#x2F;code&gt;, that is no longer possible, as there is no more maximum message size. Instead, the length checks have to be implemented as part of P2P gossip validation, and as part of the state transition logic. However, many of the limits are not practically reachable (e.g., the gas limit is reached before the maximum payload size). Further note that SSZ is simple enough that clever implementations could still enforce those length checks on the serialized data, before fully decoding it.&lt;&#x2F;p&gt;
&lt;p&gt;All data inbound via libp2p is decrypted, then uncompressed with Snappy, then hashed with &lt;code&gt;MESSAGE_DOMAIN_VALID_SNAPPY&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;MESSAGE_DOMAIN_INVALID_SNAPPY&lt;&#x2F;code&gt; prefix depending on whether the decompression worked to compute the libp2p message ID, while honoring a global &lt;code&gt;MAX_PAYLOAD_SIZE&lt;&#x2F;code&gt; message size limit. This has to be done even if the underlying SSZ data ends up being invalid.&lt;&#x2F;p&gt;
&lt;p&gt;As SSZ does not use variable-length encoding, it does not have uncontrolled blowup (no 1 byte becomes 100 MB). Therefore, attempting to decode a &lt;code&gt;MAX_PAYLOAD_SIZE&lt;&#x2F;code&gt; message before checking dynamic &lt;code&gt;List&lt;&#x2F;code&gt; limits does not decrease security. Any intentional DoS attacks can already target a heavier portion of the processing pipeline (e.g., by sending invalid BLS signatures, or by sending invalid Snappy data that still needs to be hashed to compute the message ID). Therefore, the EIP does not notably impact security.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Wallet-Linked Services for Smart Accounts</title>
        <published>2024-04-15T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Francesco Sullo</name><uri>https://github.com/sullof</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7897/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/generalized-wallet-linked-services-for-erc-4337-wallets/23028" />
        

        <id>https://wg-eips.ritovision.com/7897/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:7897"
            label="ERC-7897" />
        

        
        

        
        <summary type="html">Define a registry for modular services linked to ERC-4337 wallets.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7897/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal defines a registry for generic services linked to smart accounts, with a special focus on &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt; wallets, where services are  contracts extending a wallet&#x27;s functionality, owned by the wallet itself. It leverages &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1167&#x2F;&quot;&gt;ERC-1167&lt;&#x2F;a&gt; minimal proxies and deterministic addressing to enable permissionless innovation while maintaining backward compatibility with existing &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt; wallets. To reach its goal, it takes the concept introduced with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6551&#x2F;&quot;&gt;ERC-6551&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7656&#x2F;&quot;&gt;ERC-7656&lt;&#x2F;a&gt; standards that work for NFTs, and applies it to wallets.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Note: This proposal is not needed anymore since the same functionality can be achieved using &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7656&#x2F;&quot;&gt;ERC-7656&lt;&#x2F;a&gt; standard.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt; (Account Abstraction) introduces programmable smart accounts. Existing proposals to extend wallet functionalities (e.g., &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6900&#x2F;&quot;&gt;ERC-6900&lt;&#x2F;a&gt;) focus on internal modules. This proposal generalizes the concept of service binding, allowing any &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt; wallet to attach external services (e.g., recovery, automation, compliance) without requiring changes to the wallet&#x27;s core logic.&lt;&#x2F;p&gt;
&lt;p&gt;By enabling modular, non-invasive extensions, this standard fosters an open ecosystem of wallet-linked services while ensuring backward compatibility with existing &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt; wallets.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;registry-interface&quot;&gt;Registry Interface&lt;&#x2F;h3&gt;
&lt;p&gt;The interface &lt;code&gt;IERC7897Registry&lt;&#x2F;code&gt; is defined as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7897Registry&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a wallet-linked service is successfully deployed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;       * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; deployedService&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the deployed contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;       * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; serviceImplementation&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the implementation contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;       * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; salt&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The salt used for the CREATE2 operation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;       * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The chain ID where the contract is deployed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;       * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; wallet&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the ERC-4337 wallet&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;       *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ServiceDeployed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; deployedService&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; serviceImplementation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; salt&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; chainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; wallet&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Thrown when the CREATE2 operation fails to deploy the contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;       *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DeployFailed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Deploys a wallet-linked service for an ERC-4337 wallet.  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;       * If the service already exists, returns its address without calling CREATE2.  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;       * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; serviceImplementation&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the implementation contract  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;       * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; salt&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The salt used for the CREATE2 operation  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;       * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; wallet&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the ERC-4337 wallet  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;       * Emits a {ServiceDeployed} event.  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;       * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; service&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the wallet-linked service  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;       *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; deployService&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; serviceImplementation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; salt&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; wallet&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; service&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Computes the expected wallet-linked service address for an ERC-4337 wallet  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;       * without deploying it.  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;       * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; serviceImplementation&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the implementation contract  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;       * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; salt&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The salt used for the CREATE2 operation  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;       * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The chain ID where the service would be deployed  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;       * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; wallet&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the ERC-4337 wallet  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;       * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; service&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The computed address of the wallet-linked service  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;       *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; serviceAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; serviceImplementation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; salt&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; chainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; wallet&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; service&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;deployment-requirements&quot;&gt;Deployment Requirements&lt;&#x2F;h3&gt;
&lt;p&gt;The registry MUST deploy each wallet-linked service as an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1167&#x2F;&quot;&gt;ERC-1167&lt;&#x2F;a&gt; minimal proxy with immutable constant data appended to the bytecode.&lt;&#x2F;p&gt;
&lt;p&gt;The deployed bytecode of each wallet-linked service MUST have the following structure:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ERC-1167 Header                      (10 bytes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;serviceImplementation (address)&amp;gt;    (20 bytes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ERC-1167 Footer                      (15 bytes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;salt (bytes32)&amp;gt;                     (32 bytes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;chainId (uint256)&amp;gt;                  (32 bytes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;wallet (address)&amp;gt;                   (20 bytes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;recommended-service-interface&quot;&gt;Recommended Service Interface&lt;&#x2F;h3&gt;
&lt;p&gt;Any contract created using an &lt;code&gt;ERC7897Registry&lt;&#x2F;code&gt; SHOULD implement the &lt;code&gt;IERC7897Service&lt;&#x2F;code&gt; interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7897Service&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the wallet linked to the contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The chainId of the wallet&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; wallet&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the [ERC-4337](.&#x2F;04337.md) wallet&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; wallet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; chainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; wallet&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;access-control&quot;&gt;Access Control&lt;&#x2F;h3&gt;
&lt;p&gt;Services SHOULD implement access control to restrict critical operations to the wallet owner. For example:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  (&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt; wallet&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7897Service&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;wallet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  return&lt;&#x2F;span&gt;&lt;span&gt; wallet&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;modifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Unauthorized&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;  _&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The technical foundation of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7897&#x2F;&quot;&gt;ERC-7897&lt;&#x2F;a&gt; centers on the extension and generalization of contract types that can be associated with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt; wallets. Key decisions include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Flexibility: Enables any &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt; wallet to attach external services without modifying its core logic.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Permissionless Innovation: Developers can deploy services for any wallet, fostering an open ecosystem.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Backward Compatibility: Works with existing &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt; wallets, including Safe, Argent, and Biconomy.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Deterministic Addressing: Uses CREATE2 + salt&#x2F;chainId&#x2F;wallet for predictable service deployments.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; This implementation is a variation of the ERC6551Registry contract written by Jayden Windle @jaydenwindle and Vectorized @vectorized&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;contract ERC7897Registry is IERC7897Registry {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  function deployService(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address serviceImplementation,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytes32 salt,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address wallet&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ) external override returns (address) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; solhint-disable-next-line no-inline-assembly&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    assembly {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; Memory Layout:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; ----&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; 0x00   0xff                           (1 byte)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; 0x01   registry (address)             (20 bytes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; 0x15   salt (bytes32)                 (32 bytes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; 0x35   Bytecode Hash (bytes32)        (32 bytes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; ----&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; 0x55   ERC-1167 Constructor + Header  (20 bytes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; 0x69   implementation (address)       (20 bytes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; 0x5D   ERC-1167 Footer                (15 bytes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; 0x8C   salt (uint256)                 (32 bytes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; 0xAC   chainId (uint256)              (32 bytes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; 0xCC   wallet (address)               (20 bytes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; Copy bytecode + constant data to memory&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      mstore(0x8c, salt) &#x2F;&#x2F; salt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      mstore(0xac, chainid()) &#x2F;&#x2F; chainId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      mstore(0xcc, wallet) &#x2F;&#x2F; wallet address (20 bytes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      mstore(0x6c, 0x5af43d82803e903d91602b57fd5bf3) &#x2F;&#x2F; ERC-1167 footer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      mstore(0x5d, serviceImplementation) &#x2F;&#x2F; implementation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      mstore(0x49, 0x3d60ad80600a3d3981f3363d3d373d3d3d363d73) &#x2F;&#x2F; ERC-1167 constructor + header&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; Copy create2 computation data to memory&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      mstore8(0x00, 0xff) &#x2F;&#x2F; 0xFF&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      mstore(0x35, keccak256(0x55, 0x8b)) &#x2F;&#x2F; keccak256(bytecode) - 0x8b = 139 bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      mstore(0x01, shl(96, address())) &#x2F;&#x2F; registry address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      mstore(0x15, salt) &#x2F;&#x2F; salt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; Compute service address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      let computed := keccak256(0x00, 0x55)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; If the service has not yet been deployed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      if iszero(extcodesize(computed)) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &#x2F;&#x2F; Deploy service contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        let deployed := create2(0, 0x55, 0x8b, salt) &#x2F;&#x2F; 0x8b = 139 bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &#x2F;&#x2F; Revert if the deployment fails&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        if iszero(deployed) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          mstore(0x00, 0xd786d393) &#x2F;&#x2F; `DeployFailed()`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          revert(0x1c, 0x04)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &#x2F;&#x2F; Emit the ServiceDeployed event&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        mstore(0x00, deployed) &#x2F;&#x2F; deployedService&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        mstore(0x20, serviceImplementation) &#x2F;&#x2F; serviceImplementation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        mstore(0x40, salt) &#x2F;&#x2F; salt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        mstore(0x60, chainid()) &#x2F;&#x2F; chainId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        mstore(0x80, wallet) &#x2F;&#x2F; wallet&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        log4(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          0x00, &#x2F;&#x2F; Start of data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          0xa0, &#x2F;&#x2F; Data length (160 bytes: deployed + implementation + salt + chainId + wallet)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          0x2f82bd0c129ea2d065cf394fb7760031982c6278372c89e1a059f2478ddf4763, &#x2F;&#x2F; Event signature hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          deployed, &#x2F;&#x2F; indexed deployedService&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          serviceImplementation, &#x2F;&#x2F; indexed serviceImplementation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          salt, &#x2F;&#x2F; salt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          chainid(), &#x2F;&#x2F; chainId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          wallet &#x2F;&#x2F; indexed wallet&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &#x2F;&#x2F; Return the service address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return(0x00, 0x20)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; Otherwise, return the computed service address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      mstore(0x00, computed)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      return(0x00, 0x20)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  function serviceAddress(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address serviceImplementation,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytes32 salt,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    uint256 chainId,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address wallet&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ) external view override returns (address) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; solhint-disable-next-line no-inline-assembly&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    assembly {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; Copy bytecode + constant data to memory&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      mstore(0x8c, salt) &#x2F;&#x2F; salt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      mstore(0xac, chainId) &#x2F;&#x2F; chainId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      mstore(0xcc, wallet) &#x2F;&#x2F; wallet address (20 bytes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      mstore(0x6c, 0x5af43d82803e903d91602b57fd5bf3) &#x2F;&#x2F; ERC-1167 footer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      mstore(0x5d, serviceImplementation) &#x2F;&#x2F; implementation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      mstore(0x49, 0x3d60ad80600a3d3981f3363d3d373d3d3d363d73) &#x2F;&#x2F; ERC-1167 constructor + header&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; Copy create2 computation data to memory&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      mstore8(0x00, 0xff) &#x2F;&#x2F; 0xFF&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      mstore(0x35, keccak256(0x55, 0x8b)) &#x2F;&#x2F; keccak256(bytecode) - 0x8b = 139 bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      mstore(0x01, shl(96, address())) &#x2F;&#x2F; registry address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      mstore(0x15, salt) &#x2F;&#x2F; salt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; Compute and return the service address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      mstore(0x00, keccak256(0x00, 0x55))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      return(0x00, 0x20)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;ownership-and-control&quot;&gt;Ownership and Control&lt;&#x2F;h3&gt;
&lt;p&gt;Wallet-linked services MUST be controlled by the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt; wallet owner to prevent unauthorized access. Implementers SHOULD include safeguards against malicious or unverified implementations.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;upgradeability-risks&quot;&gt;Upgradeability Risks&lt;&#x2F;h3&gt;
&lt;p&gt;If a service is upgradable, ensure secure upgrade mechanisms to prevent unauthorized changes. For example:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The owner of the service SHOULD be the wallet itself.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Only the wallet SHOULD be able to upgrade the implementation of the service.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Implement versioning to ensure backward compatibility between upgrades.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Use a timelock or multisig for critical upgrades to reduce the risk of malicious changes.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;reentrancy-and-cross-contract-interactions&quot;&gt;Reentrancy and Cross-Contract Interactions&lt;&#x2F;h3&gt;
&lt;p&gt;Services interacting with external protocols SHOULD follow best practices to prevent reentrancy attacks.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;user-education&quot;&gt;User Education&lt;&#x2F;h3&gt;
&lt;p&gt;Clear user interfaces and warnings SHOULD be provided to reduce phishing and social engineering risks.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;testing&quot;&gt;Testing&lt;&#x2F;h3&gt;
&lt;p&gt;Implementers SHOULD thoroughly test the registry and services on testnets to ensure correctness and security before deploying to mainnet.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>General purpose execution layer requests</title>
        <published>2024-04-14T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>lightclient</name><uri>https://github.com/lightclient</uri>
	</author>
	
	<author>
		<name>Felix Lange</name><uri>https://github.com/fjl</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7685/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7685-general-purpose-execution-layer-requests/19668" />
        

        <id>https://wg-eips.ritovision.com/7685/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7685"
            label="EIP-7685" />
        

        
        

        
        <summary type="html">A general purpose bus for sharing EL triggered requests with the CL</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7685/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal defines a general purpose framework for storing contract-triggered
requests. It extends the execution header with a single field to store the
request information. Requests are later on exposed to the consensus layer, which
then processes each one.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The proliferation of smart contract controlled validators has caused there to be
a demand for additional EL triggered behaviors. By allowing these systems to
delegate administrative operations to their governing smart contracts, they can
avoid intermediaries needing to step in and ensure certain operations occur.
This creates a safer system for end users. By abstracting each individual request
details from the EL, adding new request types is simpler and does not require an
update on the execution block structure.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;execution-layer&quot;&gt;Execution Layer&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;requests&quot;&gt;Requests&lt;&#x2F;h4&gt;
&lt;p&gt;A &lt;code&gt;requests&lt;&#x2F;code&gt; object consists of a &lt;code&gt;request_type&lt;&#x2F;code&gt; byte prepended to an opaque byte array
&lt;code&gt;request_data&lt;&#x2F;code&gt;. The &lt;code&gt;request_data&lt;&#x2F;code&gt; contains zero or more encoded request objects.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;requests = request_type ++ request_data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Each request type will define its own &lt;code&gt;requests&lt;&#x2F;code&gt; object with its own &lt;code&gt;request_data&lt;&#x2F;code&gt; format.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;block-header&quot;&gt;Block Header&lt;&#x2F;h4&gt;
&lt;p&gt;Extend the header with a new 32 byte commitment value &lt;code&gt;requests_hash&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;While processing a block, multiple &lt;code&gt;requests&lt;&#x2F;code&gt; objects with different &lt;code&gt;request_type&lt;&#x2F;code&gt;s will
be produced by the system, and accumulated in the block requests list.&lt;&#x2F;p&gt;
&lt;p&gt;In order to compute the commitment, an intermediate hash list is first built by hashing
all non-empty requests elements of the block requests list. Items with empty
&lt;code&gt;request_data&lt;&#x2F;code&gt; are excluded, i.e. the intermediate list skips &lt;code&gt;requests&lt;&#x2F;code&gt; items which
contain only the &lt;code&gt;request_type&lt;&#x2F;code&gt; (1 byte) and nothing else.&lt;&#x2F;p&gt;
&lt;p&gt;Within the intermediate list, &lt;code&gt;requests&lt;&#x2F;code&gt; items must be ordered by &lt;code&gt;request_type&lt;&#x2F;code&gt; ascending.&lt;&#x2F;p&gt;
&lt;p&gt;The final commitment is computed as the sha256 hash of the intermediate element hashes.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; compute_requests_hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;block_requests&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Sequence&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    m&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sha256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; block_requests&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;r&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            m&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;update&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sha256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;r&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;digest&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; m&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;digest&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;requests_hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; compute_requests_hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;requests&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;consensus-layer&quot;&gt;Consensus Layer&lt;&#x2F;h3&gt;
&lt;p&gt;Each proposal may choose how to extend the beacon chain types to include new EL request
types.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;opaque-byte-array-rather-than-an-rlp-array&quot;&gt;Opaque byte array rather than an RLP array&lt;&#x2F;h3&gt;
&lt;p&gt;By having the bytes of &lt;code&gt;request_data&lt;&#x2F;code&gt; array from second byte on be opaque bytes, rather
than an RLP (or other encoding) list, we can support different encoding formats for the
request payload in the future such as SSZ, LEB128, or a fixed width format.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;request-source-and-validity&quot;&gt;Request source and validity&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP makes no strict requirement where a request may come from nor when&#x2F;how
a request must be validated. This is to provide future protocol designers
maximum flexibility.&lt;&#x2F;p&gt;
&lt;p&gt;The authors&#x27; recommendations on source and validity of requests are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The source of requests should be from the execution of transactions. More
specifically, transactions which make calls to designated system contracts
that store the request in account. The storage would later be retrieved by a
post-block system call to the contract. Alternatively, if the system call does
not need to be inherently concerned with rate limiting, it could rely simply
on emitting an event which is later parsed post-block by the system and
converted into a request.&lt;&#x2F;li&gt;
&lt;li&gt;A request&#x27;s validity can often not be fully verified at the execution layer.
This is why they are referred to merely as &quot;requests&quot;; they do not carry the
authority on their own to unilaterally catalyze an action. We expect the system
contracts to perform whatever validation is possible by the EL and then pass
it on to the CL for further validation.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;ordering&quot;&gt;Ordering&lt;&#x2F;h3&gt;
&lt;p&gt;The ordering across types is ascending by type. This is to simplify the process
of verifying that all requests which were committed to in &lt;code&gt;requests_hash&lt;&#x2F;code&gt; match.&lt;&#x2F;p&gt;
&lt;p&gt;An alternative could be to order by when the request was generated within the
block. Since it&#x27;s expected that many requests will be accumulated at the end of
the block via system calls, this would be difficult to enforce. Therefore,
ordering by type is the most straightforward ordering which ensures integrity.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;intra-type&quot;&gt;Intra-type&lt;&#x2F;h4&gt;
&lt;p&gt;Within the same type, order is not defined. This is because the data of the
request is opaque as far as this EIP is concerned. Therefore, it is to be
determined by each request type individually.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;removing-empty-requests-in-commitment&quot;&gt;Removing empty requests in commitment&lt;&#x2F;h3&gt;
&lt;p&gt;We exclude empty requests elements from the &lt;code&gt;requests_hash&lt;&#x2F;code&gt; commitment in order to get a
stable &#x27;empty&#x27; hash value that is independent of the blockchain fork. For a block with no
requests data, the &lt;code&gt;requests_hash&lt;&#x2F;code&gt; is simply &lt;code&gt;sha256(&quot;&quot;)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TODO&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Return deposits for distinct credentials</title>
        <published>2024-04-12T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Lion</name><uri>https://github.com/dapplion</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7684/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7684-return-deposits-for-distinct-credentials/19632" />
        

        <id>https://wg-eips.ritovision.com/7684/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7684"
            label="EIP-7684" />
        

        
        

        
        <summary type="html">Automatically withdraw deposits for existing validator records but with distinct execution withdrawal credentials</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7684/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Automatically withdraw deposits for existing validator records, but where the deposit includes a distinct execution withdrawal credential.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Some staking operations feature two distinct entities, one operating the validating key, and one funding the deposit. The funding entity delegates control of the stake operation but must retain ultimate control of funds. If the funding entity naively submits a single deposit with the full stake amount and the other entity&#x27;s validating key, it is subject to a front-run attack. The validating entity can front-run the bigger deposit with a second deposit with its own set of withdrawal credentials. The full stake amount deposit becomes a top-up, in control of the validating entity.&lt;&#x2F;p&gt;
&lt;p&gt;There exist workarounds to the front-run attack. Using some distributed key generation protocol between the funding and validating entity, such that a deposit must be made with the consent of both entities. Submit a 1 ETH deposit first wait for its inclusion then send the full stake amount as a top-up, to bind the maximum loss under the attack to 1 ETH. While these workarounds, work; they difficult the operation of trustless autonomous staking protocols.&lt;&#x2F;p&gt;
&lt;p&gt;This specification reduces the total loss on a naive deposit submission from the full deposit amount to &lt;code&gt;RETURN_DEPOSIT_PENALTY&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;consensus-layer&quot;&gt;Consensus Layer&lt;&#x2F;h3&gt;
&lt;p&gt;The configuration values and mechanics of the specification can be found in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;2360756c8c19c0f7b0e91135f5bbcddecdf0a835&#x2F;specs&#x2F;_features&#x2F;eip9999&#x2F;beacon_chain.md&quot;&gt;Consensus Layer specs&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;A sketch of the resulting changes to the consensus layer is included below.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Modify &lt;code&gt;apply_deposit&lt;&#x2F;code&gt; to queue for withdrawal deposits with distinct execution withdrawal credentials&lt;&#x2F;li&gt;
&lt;li&gt;Modify &lt;code&gt;get_expected_withdrawals&lt;&#x2F;code&gt; to return pending withdrawals first&lt;&#x2F;li&gt;
&lt;li&gt;Modify &lt;code&gt;process_withdrawals&lt;&#x2F;code&gt; to clear the pending withdrawals queue&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;execution-layer&quot;&gt;Execution Layer&lt;&#x2F;h3&gt;
&lt;p&gt;This specification does not require any changes to the Execution Layer.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;persist-pending-withdrawals&quot;&gt;Persist pending withdrawals&lt;&#x2F;h3&gt;
&lt;p&gt;Rejected deposits from block at slot N can not be withdrawn in block N due to a cyclic dependency. An execution client must know the full list of withdrawals before constructing a payload for slot N. After &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6110&#x2F;&quot;&gt;EIP-6110&lt;&#x2F;a&gt;, a consensus client must know the full execution payload for slot N before constructing the beacon block for slot N. Therefore, rejected deposits must be withdrawn in some future slot. All pending withdrawals are processed at once in the very next slot for simplicity but could be queued and processed progressively if there are DOS concerns.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This is a backward incompatible change to the Consensus Layer of Ethereum and must be scheduled with a hard fork.&lt;&#x2F;p&gt;
&lt;p&gt;There are no forwards &#x2F; backwards compatibility issues with the Execution Layer&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases are work-in-progress within the standard Consensus Layer tests.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The worst-case number of withdrawals is raised from a fixed 16 to 1,271 under current gas rules and a 30M gas block. Citing &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6110&#x2F;&quot;&gt;EIP-6110&lt;&#x2F;a&gt;, future gas efficiencies can increase the number to 1,916 withdrawals in a 30M gas block. Each withdrawal results in a single address balance change. There is no explicit pricing for such an operation, but under the worst case, it results in a notable increase in the total block gas (30% assuming 6,900 gas per withdrawal and current gas rules).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;RETURN_DEPOSIT_PENALTY&lt;&#x2F;code&gt; disincentivizes rejected deposits, and imposes a gas cost of 144,927 Gwei &#x2F; gas, assuming 6,900 gas per withdrawal.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Cross Chain Intents</title>
        <published>2024-04-11T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Mark Toda</name><uri>https://github.com/marktoda</uri>
	</author>
	
	<author>
		<name>Matt Rice</name><uri>https://github.com/mrice32</uri>
	</author>
	
	<author>
		<name>Nick Pai</name><uri>https://github.com/nicholaspai</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7683/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-cross-chain-intents-standard/19619" />
        

        <id>https://wg-eips.ritovision.com/7683/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7683"
            label="ERC-7683" />
        

        
        

        
        <summary type="html">An interface for cross-chain trade execution systems.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7683/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The following standard allows for the implementation of a standard API for cross-chain value-transfer systems. This standard provides generic order structs, as well as a standard set of settlement smart contract interfaces.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Intent-based systems have become the preeminent solution for end-user cross-chain interaction by abstracting away the complexity and time constraints of traditional bridges. One of the key difficulties for cross-chain intents systems is accessing sufficient liquidity and a network of active fillers across chains. This challenge may be exacerbated as the number of distinct chains increases over time. The end result of this is a poor experience for users including higher costs, longer wait times and higher failure rates than necessary.&lt;&#x2F;p&gt;
&lt;p&gt;By implementing a standard, cross-chain intents systems can interoperate and share infrastructure such as order dissemination services and filler networks, thereby improving end-user experience by increasing competition for fulfilling user intents.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;glossary-of-terms&quot;&gt;Glossary of Terms&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Destination Chain&lt;&#x2F;strong&gt;: the chain where the intent is executed and the user receives funds. Note: intents can involve multiple destination chains.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Filler&lt;&#x2F;strong&gt;: a participant who fulfils a user intent on the destination chain(s) and receives payment as a reward.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Leg&lt;&#x2F;strong&gt;: a portion of the user intent that can be executed independently from others. All legs must be executed for an intent to be considered fulfilled.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Origin chain&lt;&#x2F;strong&gt;: the chain where the user sends funds.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Settlement System&lt;&#x2F;strong&gt;: a system that custodies user deposits, verifies fills, and pays fillers for the purpose of facilitating intents.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Settler&lt;&#x2F;strong&gt;: a contract that implements part of the settlement system on a particular chain.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;User&lt;&#x2F;strong&gt;: for the purposes of this document, the user is the end-user who is sending the order.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;order-structs&quot;&gt;Order structs&lt;&#x2F;h3&gt;
&lt;p&gt;A compliant cross-chain order type MUST be ABI decodable into either &lt;code&gt;GaslessCrossChainOrder&lt;&#x2F;code&gt; or &lt;code&gt;OnchainCrossChainOrder&lt;&#x2F;code&gt; type.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; GaslessCrossChainOrder CrossChainOrder type&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Standard order struct to be signed by users, disseminated to fillers, and submitted to origin settler contracts by fillers&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; GaslessCrossChainOrder&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The contract address that the order is meant to be settled by.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Fillers send this order to this contract address on the origin chain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	address&lt;&#x2F;span&gt;&lt;span&gt; originSettler&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the user who is initiating the swap,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; whose input tokens will be taken and escrowed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	address&lt;&#x2F;span&gt;&lt;span&gt; user&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Nonce to be used as replay protection for the order&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	uint256&lt;&#x2F;span&gt;&lt;span&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The chainId of the origin chain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	uint256&lt;&#x2F;span&gt;&lt;span&gt; originChainId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The timestamp by which the order must be opened&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	uint32&lt;&#x2F;span&gt;&lt;span&gt; openDeadline&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The timestamp by which the order must be filled on the destination chain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	uint32&lt;&#x2F;span&gt;&lt;span&gt; fillDeadline&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Type identifier for the order data. This is an EIP-712 typehash.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	bytes32&lt;&#x2F;span&gt;&lt;span&gt; orderDataType&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Arbitrary implementation-specific data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Can be used to define tokens, amounts, destination chains, fees, settlement parameters,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; or any other order-type specific information&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	bytes&lt;&#x2F;span&gt;&lt;span&gt; orderData&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; OnchainCrossChainOrder CrossChainOrder type&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Standard order struct for user-opened orders, where the user is the one submitting the order creation transaction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OnchainCrossChainOrder&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The timestamp by which the order must be filled on the destination chain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	uint32&lt;&#x2F;span&gt;&lt;span&gt; fillDeadline&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Type identifier for the order data. This is an EIP-712 typehash.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	bytes32&lt;&#x2F;span&gt;&lt;span&gt; orderDataType&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Arbitrary implementation-specific data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Can be used to define tokens, amounts, destination chains, fees, settlement parameters,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; or any other order-type specific information&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	bytes&lt;&#x2F;span&gt;&lt;span&gt; orderData&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Cross-chain execution systems implementing this standard SHOULD use a sub-type that can be parsed from the arbitrary &lt;code&gt;orderData&lt;&#x2F;code&gt; field. This may include information such as the tokens involved in the transfer, the destination chain IDs, fulfillment constraints or settlement oracles.&lt;&#x2F;p&gt;
&lt;p&gt;All sub-types SHOULD be registered in a subtypes repository to encourage sharing of sub-types based on their functionality. See the examples section for an example of how sub-types can be used to support behavior like executing calldata on a target contract of the user&#x27;s choice on the destination chain.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;resolvedcrosschainorder-struct&quot;&gt;ResolvedCrossChainOrder struct&lt;&#x2F;h3&gt;
&lt;p&gt;A compliant cross-chain order type MUST be convertible into the &lt;code&gt;ResolvedCrossChainOrder&lt;&#x2F;code&gt; struct. This means that the &lt;code&gt;orderData&lt;&#x2F;code&gt; must be decoded into the information needed to populate the &lt;code&gt;ResolvedCrossChainOrder&lt;&#x2F;code&gt; struct. Additionally, &lt;code&gt;orderData&lt;&#x2F;code&gt; SHOULD be decodable into a sub-type, which can be used for further functionality such as cross-chain calldata execution (see the examples section for an example of this). It is the responsibility of the &lt;code&gt;user&lt;&#x2F;code&gt; and the &lt;code&gt;filler&lt;&#x2F;code&gt; to ensure that the &lt;code&gt;originSettler&lt;&#x2F;code&gt; supports their order&#x27;s contained sub-type.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ResolvedCrossChainOrder type&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An implementation-generic representation of an order intended for filler consumption&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Defines all requirements for filling an order by unbundling the implementation-specific orderData.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Intended to improve integration generalization by allowing fillers to compute the exact input and output information of any order&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ResolvedCrossChainOrder&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the user who is initiating the transfer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	address&lt;&#x2F;span&gt;&lt;span&gt; user&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The chainId of the origin chain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	uint256&lt;&#x2F;span&gt;&lt;span&gt; originChainId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The timestamp by which the order must be opened&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	uint32&lt;&#x2F;span&gt;&lt;span&gt; openDeadline&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The timestamp by which the order must be filled on the destination chain(s)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	uint32&lt;&#x2F;span&gt;&lt;span&gt; fillDeadline&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The unique identifier for this order within this settlement system&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	bytes32&lt;&#x2F;span&gt;&lt;span&gt; orderId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The max outputs that the filler will send. It&amp;#39;s possible the actual amount depends on the state of the destination&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      chain (destination dutch auction, for instance), so these outputs should be considered a cap on filler liabilities.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	Output&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; maxSpent&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The minimum outputs that must be given to the filler as part of order settlement. Similar to maxSpent, it&amp;#39;s possible&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      that special order types may not be able to guarantee the exact amount at open time, so this should be considered&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      a floor on filler receipts. Setting the `recipient` of an `Output` to address(0) indicates that the filler is not&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      known when creating this order.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	Output&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; minReceived&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Each instruction in this array is parameterizes a single leg of the fill. This provides the filler with the information&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      necessary to perform the fill on the destination(s).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	FillInstruction&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; fillInstructions&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Tokens that must be received for a valid order fulfillment&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Output&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the ERC20 token on the destination chain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address(0) used as a sentinel for the native token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	bytes32&lt;&#x2F;span&gt;&lt;span&gt; token&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of the token to be sent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	uint256&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to receive the output tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	bytes32&lt;&#x2F;span&gt;&lt;span&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The destination chain for this output&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	uint256&lt;&#x2F;span&gt;&lt;span&gt; chainId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; FillInstruction type&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Instructions to parameterize each leg of the fill&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Provides all the origin-generated information required to produce a valid fill leg&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FillInstruction&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The chain that this instruction is intended to be filled on&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	uint256&lt;&#x2F;span&gt;&lt;span&gt; destinationChainId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The contract address that the instruction is intended to be filled on&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	bytes32&lt;&#x2F;span&gt;&lt;span&gt; destinationSettler&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The data generated on the origin chain needed by the destinationSettler to process the fill&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	bytes&lt;&#x2F;span&gt;&lt;span&gt; originData&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;open-event&quot;&gt;Open event&lt;&#x2F;h3&gt;
&lt;p&gt;A compliant &lt;code&gt;Open&lt;&#x2F;code&gt; event MUST adhere to the following abi:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Signals that an order has been opened&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; orderId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; a unique order identifier within this settlement system&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; resolvedOrder&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; resolved order that would be returned by resolve if called instead of Open&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Open&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; orderId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;ResolvedCrossChainOrder&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; resolvedOrder&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;settlement-interfaces&quot;&gt;Settlement interfaces&lt;&#x2F;h3&gt;
&lt;p&gt;A compliant origin settler contract implementation MUST implement the &lt;code&gt;IOriginSettler&lt;&#x2F;code&gt; interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; IOriginSettler&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Standard interface for settlement contracts on the origin chain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IOriginSettler&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Opens a gasless cross-chain order on behalf of a user.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; To be called by the filler.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This method must emit the Open event&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; order&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The GaslessCrossChainOrder definition&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The user&amp;#39;s signature over the order&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; originFillerData&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Any filler-defined data required by the settler&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; openFor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;GaslessCrossChainOrder&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; order&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; originFillerData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Opens a cross-chain order&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; To be called by the user&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This method must emit the Open event&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; order&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The OnchainCrossChainOrder definition&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; open&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;OnchainCrossChainOrder&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; order&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Resolves a specific GaslessCrossChainOrder into a generic ResolvedCrossChainOrder&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Intended to improve standardized integration of various order types and settlement contracts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; order&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The GaslessCrossChainOrder definition&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; originFillerData&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Any filler-defined data required by the settler&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ResolvedCrossChainOrder&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; hydrated order data including the inputs and outputs of the order&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; resolveFor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;GaslessCrossChainOrder&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; order&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; originFillerData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;ResolvedCrossChainOrder&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Resolves a specific OnchainCrossChainOrder into a generic ResolvedCrossChainOrder&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Intended to improve standardized integration of various order types and settlement contracts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; order&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The OnchainCrossChainOrder definition&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ResolvedCrossChainOrder&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; hydrated order data including the inputs and outputs of the order&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; resolve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;OnchainCrossChainOrder&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; order&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;ResolvedCrossChainOrder&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;A compliant destination settlement contract implementation MUST implement the &lt;code&gt;IDestinationSettler&lt;&#x2F;code&gt; interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; IDestinationSettler&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Standard interface for settlement contracts on the destination chain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IDestinationSettler&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Fills a single leg of a particular order on the destination chain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; orderId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Unique order identifier for this order&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; originData&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Data emitted on the origin to parameterize the fill&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; fillerData&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Data provided by the filler to inform the fill or express their preferences&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fill&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; orderId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; originData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; fillerData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;fillerdata&quot;&gt;fillerData&lt;&#x2F;h3&gt;
&lt;p&gt;Cross-chain execution systems implementing this standard SHOULD use a sub-type that can be parsed from the arbitrary &lt;code&gt;fillerData&lt;&#x2F;code&gt; field. This may include information such as the desired timing or form of payment for the filler&lt;&#x2F;p&gt;
&lt;p&gt;All sub-types SHOULD be registered in a subtypes repository to encourage sharing of sub-types based on their functionality.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;generic-orderdata&quot;&gt;Generic OrderData&lt;&#x2F;h3&gt;
&lt;p&gt;A key consideration is to ensure that a broad range of cross-chain intent designs can work within the same standard. To enable this, the specification is designed around a cross-chain intents &lt;em&gt;flow&lt;&#x2F;em&gt;, with two variations: gasless and onchain.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;gasless-cross-chain-intents-flow&quot;&gt;Gasless cross-chain intents flow&lt;&#x2F;h4&gt;
&lt;p&gt;Origin Chain:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The user signs an off-chain message defining the parameters of their order&lt;&#x2F;li&gt;
&lt;li&gt;The order is disseminated to fillers&lt;&#x2F;li&gt;
&lt;li&gt;The filler calls resolve to unpack the order&#x27;s requirements&lt;&#x2F;li&gt;
&lt;li&gt;The filler opens the order on the origin chain&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Destination Chain(s):&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The filler fills each leg of the order on the destination chain(s)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Settlement:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A cross-chain settlement process takes place to settle the order&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;onchain-cross-chain-intents-flow&quot;&gt;Onchain cross-chain intents flow&lt;&#x2F;h4&gt;
&lt;p&gt;Origin Chain:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The caller signs a transaction calling open with their order&lt;&#x2F;li&gt;
&lt;li&gt;The filler retrieves the emitted event to determine requirements&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Destination Chain(s):&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The filler fills each leg of the order on the destination chain(s)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Settlement:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A cross-chain settlement process takes place to settle the order&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;customization&quot;&gt;Customization&lt;&#x2F;h4&gt;
&lt;p&gt;Within this flow, implementers of the standard have design flexibility to customize behavior such as:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Price resolution, e.g. dutch auctions (on origin or destination) or oracle-based pricing&lt;&#x2F;li&gt;
&lt;li&gt;Fulfillment constraints&lt;&#x2F;li&gt;
&lt;li&gt;Settlement procedures&lt;&#x2F;li&gt;
&lt;li&gt;Ordering of the origin and destination chain actions, e.g. the fill could happen before &lt;code&gt;open&lt;&#x2F;code&gt; in some settlement systems&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;code&gt;orderData&lt;&#x2F;code&gt; field allows implementations to take arbitrary specifications for these behaviors while still enabling integrators to parse the primary fields of the order.&lt;&#x2F;p&gt;
&lt;p&gt;This functionality also motivated the &lt;code&gt;resolve&lt;&#x2F;code&gt; view function and &lt;code&gt;ResolvedCrossChainOrder&lt;&#x2F;code&gt; type. Resolution enables integrating fillers to validate and assess orders without specific knowledge of the &lt;code&gt;orderData&lt;&#x2F;code&gt; field at hand.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;emission-of-fill-instructions&quot;&gt;Emission of Fill Instructions&lt;&#x2F;h3&gt;
&lt;p&gt;An important component of the standard is creating a flexible and robust mechanism for fillers to ensure their fills are valid. For a fill to be valid,
it typically must satisfy the following constraints:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;It must be filled on the correct destination chain(s)&lt;&#x2F;li&gt;
&lt;li&gt;It must be filled on the correct destination contract&lt;&#x2F;li&gt;
&lt;li&gt;It must include some (not necessarily all) information from the order that the user provided on the origin chain&lt;&#x2F;li&gt;
&lt;li&gt;It may require some execution information from the &lt;code&gt;open&lt;&#x2F;code&gt; call on the origin chain (ex. dutch auctions based on open timing)&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The &lt;code&gt;FillInstruction&lt;&#x2F;code&gt; array in &lt;code&gt;ResolvedCrossChainOrder&lt;&#x2F;code&gt; is intended to ensure it&#x27;s simple for the filler to meet all of these requirements by either
listening for the &lt;code&gt;Open&lt;&#x2F;code&gt; or by calling &lt;code&gt;resolve&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;One may notice that the &lt;code&gt;originData&lt;&#x2F;code&gt; field within &lt;code&gt;FillInstruction&lt;&#x2F;code&gt; is completely opaque. This opaqueness allows the settler implementations to
freely customize the data they transmit. Because fillers do not need to interpret this information, the opaqueness does not result in any
additional implementation costs on fillers.&lt;&#x2F;p&gt;
&lt;p&gt;This functionality also makes it feasible for a user, filler, or order distribution system to perform an end-to-end simulation of the order initiation
and fill to evaluate all resulting state transitions without understanding the nuances of a particular execution system.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;cross-compatibility&quot;&gt;Cross-compatibility&lt;&#x2F;h3&gt;
&lt;p&gt;Since this standard is intended to reduce friction for users moving value across chains, non-EVM ecosystems should not be excluded. However, attempting
to pull each non-EVM ecosystem in would dramatically increase the size and complexity of this standard, while omitting any that come in the future.&lt;&#x2F;p&gt;
&lt;p&gt;Instead, this standard is intended to be cross-compatible with other ecosystems. It standardizes interfaces and data types on EVM chains, but allows
for the creation of sibling standards that define compatible interfaces, data types, and flows within other ecosystems. Intents created within these
sibling standards should be able to be filled on an EVM chain and vice versa.&lt;&#x2F;p&gt;
&lt;p&gt;To ensure this cross-compatibility, all foreign addresses use &lt;code&gt;bytes32&lt;&#x2F;code&gt; rather than &lt;code&gt;address&lt;&#x2F;code&gt; to allow for larger address identifiers.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;usage-of-permit2&quot;&gt;Usage of Permit2&lt;&#x2F;h3&gt;
&lt;p&gt;Permit2 is not specifically required by this standard, but does provide an efficient and straightforward approach to building standard-adherent protocols. Specifically, the &lt;code&gt;witness&lt;&#x2F;code&gt; functions of permit2 allow users to both approve the token transfer &lt;em&gt;and&lt;&#x2F;em&gt; the order itself with a single signature. This also nicely couples the transfer of tokens with a successful initiation of the order.&lt;&#x2F;p&gt;
&lt;p&gt;In contrast, a standard approval model would require two separate signatures - a token approval (either &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2612&#x2F;&quot;&gt;ERC-2612&lt;&#x2F;a&gt; or on-chain) and a signature to approve the terms of the order. It also decouples the token approval from the order, meaning approved tokens could potentially be taken at any time due to a buggy or untrusted settler contract.&lt;&#x2F;p&gt;
&lt;p&gt;When building a standard-compliant settler system around Permit2, the following considerations should be made&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;nonce&lt;&#x2F;code&gt; in the order struct should be a permit2 nonce&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;openDeadline&lt;&#x2F;code&gt; in the order struct should be the permit2 deadline&lt;&#x2F;li&gt;
&lt;li&gt;A full order struct including the parsed &lt;code&gt;orderData&lt;&#x2F;code&gt; should be used as the witness type during the permit2 call. This ensures maximum transparency to the user as they sign their order permit.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;examples&quot;&gt;Examples&lt;&#x2F;h3&gt;
&lt;p&gt;This is an example of how a 7683 cross-chain value transfer order can include instructions to the filler to execute arbitrary calldata on behalf of the recipient on the destination chain. This calldata execution is performed by the settlement contract atomically within the filler&#x27;s fill() execution, so the arbitrary contract execution can take advantage of the destination chain recipient&#x27;s newly transferred value. A hypothetical user in this example would select an &lt;code&gt;originSettler&lt;&#x2F;code&gt; that is known to support the &lt;code&gt;Message&lt;&#x2F;code&gt; sub-type.&lt;&#x2F;p&gt;
&lt;p&gt;Let there be a sub-type called &lt;code&gt;Message&lt;&#x2F;code&gt;, which is defined by the following structs:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The Message subtype allows ERC7683 intents to carry calldata that is executed on a target contract on the destination chain. The settlement contract that the filler interacts with on the destination chain will decode the message into smart contract calls and execute the calls within the filler&amp;#39;s `fill()` transaction.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The Message contains calls that the user wants executed on the destination chain.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The target is a contract on the destination chain that the settlement contract will attempt to send callData and value to.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Calls&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span&gt; target&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes&lt;&#x2F;span&gt;&lt;span&gt; callData&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Message&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Calls&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; calls&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;Message&lt;&#x2F;code&gt; sub-type is designed to be used by a 7683 user to incentivize a filler to execute arbitrary calldata on a target destination chain contract on the user&#x27;s behalf. For example, the settlement contract might decode the &lt;code&gt;originData&lt;&#x2F;code&gt; containing the message information as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fill&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; orderId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; originData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; fillerData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		address&lt;&#x2F;span&gt;&lt;span&gt; user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		uint32&lt;&#x2F;span&gt;&lt;span&gt; fillDeadline&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		Output &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;memory&lt;&#x2F;span&gt;&lt;span&gt; fillerOutput&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		Message &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;memory&lt;&#x2F;span&gt;&lt;span&gt; message&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;decode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;originData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ...Do some preprocessing on the parameters here to validate the order...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ...Execute the fill logic of the ResolvedCrossChainOrder...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Handle the Message subtype:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Revert if any of the message calls fail.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; message&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;calls&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            Call &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;memory&lt;&#x2F;span&gt;&lt;span&gt; call &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; message&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;calls&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If we are calling an EOA with calldata, assume target was incorrectly specified and revert.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;call&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;callData&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; call&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;target&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InvalidCall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; calls&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt; success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; )&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; call&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;target&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;call&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; call&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;value &lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;call&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;callData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CallReverted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; message&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;calls&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In this example, the Message sub-type allows the user to delegate destination chain contract execution to fillers. However, because transactions are executed via filler, the &lt;code&gt;msg.sender&lt;&#x2F;code&gt; would be the &lt;code&gt;DestinationSettler&lt;&#x2F;code&gt;, making this &lt;code&gt;Message&lt;&#x2F;code&gt; sub-type limited if the target contract authenticates based on the &lt;code&gt;msg.sender&lt;&#x2F;code&gt;. Ideally, 7683 orders containing Messages can be combined with smart contract wallets like implementations of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt; or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; to allow complete cross-chain delegated execution.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h4 id=&quot;evaluating-settlement-contract-security&quot;&gt;Evaluating settlement contract security&lt;&#x2F;h4&gt;
&lt;p&gt;This ERC is agnostic of how the settlement system validates a 7683 order fulfillment and refunds the filler. In fact, this ERC is designed to delegate the responsibility of evaluating the settlement contract&#x27;s security to the filler and the application that creates the user&#x27;s 7683 order.&lt;&#x2F;p&gt;
&lt;p&gt;This design decision is motivated by the existence of many viable cross-chain messaging systems today offering settlement contracts a variety of tradeoffs. We hope that this standard can eventually support an ERC dedicated to standardizing a safe, trustless, cross-chain verification system.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Auxiliary Funds Capability</title>
        <published>2024-04-09T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Lukas Rosario</name><uri>https://github.com/lukasrosario</uri>
	</author>
	
	<author>
		<name>Wilson Cusack</name><uri>https://github.com/wilsoncusack</uri>
	</author>
	
	<author>
		<name>Alex Donesky</name><uri>https://github.com/adonesky1</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7682/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7682-auxiliary-funds-capability/19599" />
        

        <id>https://wg-eips.ritovision.com/7682/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:7682"
            label="ERC-7682" />
        

        
        

        
        <summary type="html">A capability allowing wallets to indicate that they have access to additional funds.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7682/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;An &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5792&#x2F;&quot;&gt;EIP-5792&lt;&#x2F;a&gt; compliant capability that allows wallets to indicate to apps that they have access to funds beyond those that can be accounted for by looking up balances onchain given the wallet&#x27;s address.&lt;&#x2F;p&gt;
&lt;p&gt;A wallet&#x27;s ability to access auxiliary funds is communicated to apps as part of its response to an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5792&#x2F;&quot;&gt;EIP-5792&lt;&#x2F;a&gt; &lt;code&gt;wallet_getCapabilities&lt;&#x2F;code&gt; request. The following standard does not specify the source of these auxiliary funds, but some examples are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Funds from offchain sources that can be onramped and used just-in-time&lt;&#x2F;li&gt;
&lt;li&gt;Wallets that manage many accounts, where assets across those accounts can be transfered to the required account before submitting a transaction requested by an app&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Many applications check users&#x27; balances before letting them complete some action. For example, if a user wants to swap some amount of tokens on a dex, the dex will commonly block the user from doing so if it sees that the user does not have that amount of tokens at their address. However, more advanced wallets have features that let users access funds from other sources. Wallets need a way to tell apps that they have access to additional funds so that users using these more advanced wallets are not blocked by balance checks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;One new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5792&#x2F;&quot;&gt;EIP-5792&lt;&#x2F;a&gt; wallet capability is defined.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;wallet-implementation&quot;&gt;Wallet Implementation&lt;&#x2F;h3&gt;
&lt;p&gt;To conform to this specification, wallets that wish to indicate that they have access to auxiliary funds MUST, for each chain they have access to auxiliary funds on, respond to &lt;code&gt;wallet_getCapabilities&lt;&#x2F;code&gt; calls with an &lt;code&gt;auxiliaryFunds&lt;&#x2F;code&gt; object with a &lt;code&gt;supported&lt;&#x2F;code&gt; field set to &lt;code&gt;true&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Wallets may also optionally specify which assets they have additional access to with an &lt;code&gt;assets&lt;&#x2F;code&gt; field, which maps to an array of addresses representing the assets the wallet might have additional access to. If a wallet does not respond with this optional array of assets, the application SHOULD assume the wallet has additional access to any asset.&lt;&#x2F;p&gt;
&lt;p&gt;This specification does not put any constraints on the source of the auxiliary funds.&lt;&#x2F;p&gt;
&lt;p&gt;In this specification, a chain&#x27;s native asset (e.g. Ether on Ethereum) MUST be represented by &quot;0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE&quot; as specified by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7528&#x2F;&quot;&gt;EIP-7528&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;wallet-getcapabilities-response-specification&quot;&gt;&lt;code&gt;wallet_getCapabilities&lt;&#x2F;code&gt; Response Specification&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AuxiliaryFundsCapability&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  supported&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; boolean&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  assets&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;wallet-getcapabilities-example-response&quot;&gt;&lt;code&gt;wallet_getCapabilities&lt;&#x2F;code&gt; Example Response&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;0x2105&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;auxiliaryFunds&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;supported&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;assets&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;0x14A34&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;auxiliaryFunds&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;supported&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;assets&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x036CbD53842c5426634e7929541eC2318f3dCF7e&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;extended-usage-requiredassets-parameter&quot;&gt;Extended Usage: &lt;code&gt;requiredAssets&lt;&#x2F;code&gt; Parameter&lt;&#x2F;h3&gt;
&lt;p&gt;When a wallet indicates support for the &lt;code&gt;auxiliaryFunds&lt;&#x2F;code&gt; capability (i.e., &lt;code&gt;supported: true&lt;&#x2F;code&gt;), applications that use the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5792&#x2F;#wallet-sendcalls&quot;&gt;&lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; method MAY include a &lt;code&gt;requiredAssets&lt;&#x2F;code&gt; parameter in the &lt;code&gt;capabilities.auxiliaryFunds&lt;&#x2F;code&gt; object to enable the wallet to leverage this capability.&lt;&#x2F;p&gt;
&lt;p&gt;A wallet&#x27;s signaling support for the &lt;code&gt;auxiliaryFunds&lt;&#x2F;code&gt; capability does not necessarily mean they can interpret or use the &lt;code&gt;requiredAssets&lt;&#x2F;code&gt; metadata. The &lt;code&gt;requiredAssets&lt;&#x2F;code&gt; parameter is an optional capability that wallets may or may not support, even when they support the base &lt;code&gt;auxiliaryFunds&lt;&#x2F;code&gt; capability.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Native Asset Handling&lt;&#x2F;strong&gt;: Wallets SHOULD deduce native asset requirements (e.g., ETH on Ethereum mainnet) from the &lt;code&gt;call.value&lt;&#x2F;code&gt; field in the calls array rather than requiring explicit specification in &lt;code&gt;requiredAssets&lt;&#x2F;code&gt;. The &lt;code&gt;requiredAssets&lt;&#x2F;code&gt; parameter is primarily intended for token assets that cannot be inferred from call data alone.&lt;&#x2F;p&gt;
&lt;p&gt;This parameter may be necessary because transaction call data alone does not reliably indicate which assets and amounts are needed for successful execution. Calls may involve complex logic or multiple contracts, making it difficult for wallets to infer requirements. By specifying required assets and amounts explicitly, apps ensure wallets have the information needed to provision, bridge, or swap assets as necessary for the transaction to succeed.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;wallet-sendcalls-extended-parameter&quot;&gt;&lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt; Extended Parameter&lt;&#x2F;h3&gt;
&lt;p&gt;If included, the &lt;code&gt;requiredAssets&lt;&#x2F;code&gt; parameter MUST be specified within the &lt;code&gt;capabilities.auxiliaryFunds&lt;&#x2F;code&gt; object of the &lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt; request.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;&#x2F;strong&gt;: The &lt;code&gt;capabilities&lt;&#x2F;code&gt; object is specified in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5792&#x2F;&quot;&gt;EIP-5792&lt;&#x2F;a&gt; where &lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt; is first defined: &quot;The capabilities field is how an app can communicate with a wallet about capabilities a wallet supports. For example, this is where an app can specify a paymaster service URL from which an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt; wallet can request a paymasterAndData input for a user operation.&quot;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Example wallet_sendCalls type extension&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; WalletSendCallsRequest&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  version&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  from&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x{string}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  atomicRequired&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; boolean&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  calls&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Array&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    to&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ... other call fields ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  capabilities&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    auxiliaryFunds&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;      optional&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; boolean&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;      requiredAssets&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Amount required, as a hex string representing the integer value in the asset&amp;#39;s smallest unit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        standard&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;erc20&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;erc721&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;erc1155&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Token standard&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Token ID as a hex string (required for ERC-721 and ERC-1155)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;example-scenario-cross-chain-deposit-to-aave&quot;&gt;Example Scenario: Cross-Chain Deposit to Aave&lt;&#x2F;h4&gt;
&lt;p&gt;Suppose a user wants to deposit DAI into Aave on Chain X, but their wallet address on Chain X has no DAI or native gas token. However, the wallet has access to funds on Chain Y (e.g., Ethereum mainnet). The app, upon detecting the &lt;code&gt;auxiliaryFunds&lt;&#x2F;code&gt; capability, can construct a &lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt; request as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;calls&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xAaveDAIDepositContractOnChainX&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xd0e30db0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Example encoded deposit function call&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;capabilities&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;auxiliaryFunds&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;optional&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;requiredAssets&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x6B175474E89094C44Da98b954EedeAC495271d0F&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; DAI address on Chain X&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0de0b6b3a7640000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 1 DAI&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;standard&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;erc20&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The wallet, upon receiving this request, can:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Bridge or swap the required DAI from Chain Y to Chain X&lt;&#x2F;li&gt;
&lt;li&gt;Ensure the user has enough native asset (e.g., ETH) for gas on Chain X&lt;&#x2F;li&gt;
&lt;li&gt;Complete the deposit call to Aave on Chain X&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This mechanism allows advanced wallets to abstract away the complexity of cross-chain or offchain funding, enabling seamless user experiences even when the user&#x27;s onchain balance is insufficient on the target chain.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;token-standard-extensibility&quot;&gt;Token Standard Extensibility&lt;&#x2F;h3&gt;
&lt;p&gt;This specification currently supports three token standards with the following field requirements:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;&lt;&#x2F;strong&gt;: Requires &lt;code&gt;amount&lt;&#x2F;code&gt; field only&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;&lt;&#x2F;strong&gt;: Requires both &lt;code&gt;amount&lt;&#x2F;code&gt; and &lt;code&gt;tokenId&lt;&#x2F;code&gt; fields&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt;&lt;&#x2F;strong&gt;: Requires both &lt;code&gt;amount&lt;&#x2F;code&gt; and &lt;code&gt;tokenId&lt;&#x2F;code&gt; fields&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;code&gt;amount&lt;&#x2F;code&gt; field semantics vary by token standard:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;&lt;&#x2F;strong&gt;: Represents token quantity in smallest unit (e.g., wei for 18-decimal tokens)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;&lt;&#x2F;strong&gt;: Represents NFT quantity (typically &quot;0x01&quot; for single NFT instances)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt;&lt;&#x2F;strong&gt;: Represents quantity of the specified token ID&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Future token standards MUST specify additional required fields as properties on the asset object root to maintain extensibility.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;auxiliary-funds-and-atomic-execution&quot;&gt;Auxiliary Funds and Atomic Execution&lt;&#x2F;h3&gt;
&lt;p&gt;Auxiliary funds provisioning (bridging, swapping, or other asset retrieval operations) is independent of the &lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt; execution lifecycle. The &lt;code&gt;atomicRequired&lt;&#x2F;code&gt; field applies only to the call bundle execution, not to auxiliary funds provisioning.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;error-codes&quot;&gt;Error Codes&lt;&#x2F;h3&gt;
&lt;p&gt;The following error codes are defined for auxiliary funds provisioning failures.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Code&lt;&#x2F;th&gt;&lt;th&gt;Message&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;5770&lt;&#x2F;td&gt;&lt;td&gt;Auxiliary funds provisioning failed&lt;&#x2F;td&gt;&lt;td&gt;Wallet attempted to provision funds but failed (e.g., bridge&#x2F;swap error).&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;5771&lt;&#x2F;td&gt;&lt;td&gt;Asset not supported&lt;&#x2F;td&gt;&lt;td&gt;The requested asset is not available through the wallet&#x27;s auxiliary fund system.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;5772&lt;&#x2F;td&gt;&lt;td&gt;Auxiliary funds capability not available&lt;&#x2F;td&gt;&lt;td&gt;The wallet no longer supports auxiliary funds on the requested chain.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;5773&lt;&#x2F;td&gt;&lt;td&gt;Invalid requiredAssets&lt;&#x2F;td&gt;&lt;td&gt;The structure of the requiredAssets object is malformed.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Applications SHOULD use the &lt;code&gt;wallet_getCallsStatus&lt;&#x2F;code&gt; method to track the status of call bundles that involve auxiliary funds provisioning, as the provisioning process may take time to complete. The status response will indicate whether the auxiliary funds provisioning is in progress, completed, or failed.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;app-implementation-guidance&quot;&gt;App Implementation Guidance&lt;&#x2F;h3&gt;
&lt;p&gt;When an app sees that a connected wallet has access to auxiliary funds via the &lt;code&gt;auxiliaryFunds&lt;&#x2F;code&gt; capability in a &lt;code&gt;wallet_getCapabilities&lt;&#x2F;code&gt; response, the app SHOULD NOT block users from taking actions on the basis of asset balance checks.&lt;&#x2F;p&gt;
&lt;p&gt;Apps MAY include the &lt;code&gt;requiredAssets&lt;&#x2F;code&gt; parameter in the &lt;code&gt;capabilities.auxiliaryFunds&lt;&#x2F;code&gt; object to ensure the wallet has the necessary information to provision assets as needed for successful execution. However, apps should be aware that this is an optional capability and should handle cases where wallets do not support or cannot process the &lt;code&gt;requiredAssets&lt;&#x2F;code&gt; metadata gracefully.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;amount-validation&quot;&gt;Amount Validation&lt;&#x2F;h3&gt;
&lt;p&gt;The wallet MUST cross-check the &lt;code&gt;amount&lt;&#x2F;code&gt; value in &lt;code&gt;requiredAssets&lt;&#x2F;code&gt; against the &lt;code&gt;decimal()&lt;&#x2F;code&gt; value specified on the &lt;code&gt;asset&lt;&#x2F;code&gt;&#x27;s contract to ensure that the amount is interpreted correctly according to the asset&#x27;s decimal precision.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;alternatives&quot;&gt;Alternatives&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;advanced-balance-fetching&quot;&gt;Advanced Balance Fetching&lt;&#x2F;h4&gt;
&lt;p&gt;An alternative we considered is defining a way for apps to fetch available auxiliary balances. This could be done, for example, by providing a URL as part of the &lt;code&gt;auxiliaryFunds&lt;&#x2F;code&gt; capability that apps could use to fetch auxiliary balance information. However, we ultimately decided that a boolean was enough to indicate to apps that they should not block user actions on the basis of balance checks, and it is minimally burdensome for apps to implement.&lt;&#x2F;p&gt;
&lt;p&gt;The shape of this capability allows for a more advanced extension if apps feel more functionality is needed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Applications SHOULD only include the &lt;code&gt;requiredAssets&lt;&#x2F;code&gt; parameter if the wallet advertises the &lt;code&gt;auxiliaryFunds&lt;&#x2F;code&gt; capability.&lt;&#x2F;li&gt;
&lt;li&gt;Applications SHOULD include the &lt;code&gt;auxiliaryFunds&lt;&#x2F;code&gt; capability with &lt;code&gt;optional: true&lt;&#x2F;code&gt; to provide metadata to wallets that support this optional capability while maintaining compatibility with wallets that do not.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Apps MUST NOT make any assumptions about the source of auxiliary funds. Apps&#x27; smart contracts should still, as they would today, make appropriate balance checks onchain when processing a transaction.&lt;&#x2F;li&gt;
&lt;li&gt;Applications MUST NOT assume that the wallet will always be able to fulfill the asset requirements, and SHOULD handle failures gracefully.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Dual Nature Multi Token Protocol</title>
        <published>2024-04-08T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Sennett Lau</name><uri>https://github.com/sennett-lau</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7681/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7681-dual-nature-multi-token-protocol/19590" />
        

        <id>https://wg-eips.ritovision.com/7681/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:7681"
            label="ERC-7681" />
        

        
        

        
        <summary type="html">Combining fungible token ERC-20 and multi-token ERC-1155</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7681/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7681&#x2F;&quot;&gt;ERC-7681&lt;&#x2F;a&gt; delineates the integration of the fungible &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; token contract with the semi-fungible &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; multi-token standard, enabling cohesive operations between both standards within a single contract framework. It defines a mechanism for combining two token contracts and synchronizing operations between them.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Inspired by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7631&#x2F;&quot;&gt;ERC-7631&lt;&#x2F;a&gt; Dual Nature Token Pair, which introduced a concept of interlinkable tokens between ERC-20 and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;, a challenge arises due to the duplicated &lt;code&gt;Transfer(address, address, uint256)&lt;&#x2F;code&gt; event, making full compatibility challenging. However, combining ERC-20 and ERC-1155 offers similar benefits of non-fungible token (NFT) fractionalization natively. Here, acquiring ERC-20 tokens could automatically issue ERC-1155 tokens proportionally to the ERC-20 holdings, achieving full compliance with both standards.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore, analogous to ERC-7631, this proposal allows users to opt out of ERC-1155 mints and transfers during the ERC-20 to ERC-1155 synchronization process.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;overview&quot;&gt;Overview&lt;&#x2F;h3&gt;
&lt;p&gt;Every &lt;code&gt;ERC-7681&lt;&#x2F;code&gt; MUST implement both &lt;code&gt;ERC20&lt;&#x2F;code&gt; and &lt;code&gt;ERC1155&lt;&#x2F;code&gt; interfaces.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;erc-7681-interface&quot;&gt;ERC-7681 Interface&lt;&#x2F;h3&gt;
&lt;p&gt;The ERC-20 contract MUST implement the following interface.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7681&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is IERC20, IERC1155 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The contract MUST contain the following events&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC20 related events&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Approval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The contract MUST contain the following events&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC1155 related events&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransferSingle&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransferBatch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _ids&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _values&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ApprovalForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; URI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The contract MAY contain the following functions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC20 related functions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; symbol&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; decimals&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The contract MUST contain the following functions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC20 related functions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; allowance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The contract MUST contain the following functions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC1155 related functions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOfBatch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owners&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _ids&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setApprovalForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isApprovedForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeBatchTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _ids&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _values&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;erc-7681-skippable-interface&quot;&gt;ERC-7681 Skippable Interface&lt;&#x2F;h3&gt;
&lt;p&gt;The ERC-7681 contract MAY implement the following interface.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7681Skippable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when the skip ERC1155 token status of `owner` is &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; by any mechanism.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This initial skip ERC1155 token status for `owner` can be dynamically chosen to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; be true or false, but any changes to it MUST emit this event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SkipTokenSet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; status&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns true if ERC-1155 mints and transfers to `owner` SHOULD be&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; skipped during ERC-20 to ERC-1155 synchronization. Otherwise false.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This method MAY revert&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If this method reverts:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - Interacting code SHOULD interpret `setSkipToken` functionality as&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   unavailable (and hide any functionality to call `setSkipToken`).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - The skip ERC1155 token status for `owner` SHOULD be interpreted as undefined.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Once a true or false value has been returned for a given `owner`,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; this method MUST NOT revert for the given `owner`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getSkipToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sets the caller&amp;#39;s skip ERC1155 token status.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This method MAY revert&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; (e.g. insufficient permissions, method not supported).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emits a {SkipTokenSet} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setSkipToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; status&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;implementation-flexibility&quot;&gt;Implementation Flexibility&lt;&#x2F;h3&gt;
&lt;p&gt;This proposal intentionally does not prescribe specific token synchronization logic to allow for diverse implementation strategies and novel use cases, such as one-to-one synchronization or fractionalization of ERC-1155 tokens based on ERC-20 holdings. Developers are afforded the flexibility to determine their synchronization approach, provided it remains fully compliant with the specifications of both token standards.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;erc-1155-token-skipping&quot;&gt;ERC-1155 Token Skipping&lt;&#x2F;h3&gt;
&lt;p&gt;For instances where the &lt;code&gt;owner&lt;&#x2F;code&gt; is a smart contract, setting the skip status to &lt;code&gt;true&lt;&#x2F;code&gt; by default can prevent unnecessary ERC-1155 minting for interactions with contracts like DEXs and lending protocols, thereby potentially reducing gas costs.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h3&gt;
&lt;p&gt;This proposal is fully backward-compatible with the existing ERC-20 and ERC-1155 standards, ensuring that contracts reliant on these standards will continue to function seamlessly.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;out-of-gas-denial-of-service&quot;&gt;Out-of-gas Denial of Service&lt;&#x2F;h3&gt;
&lt;p&gt;When user transfers ERC-20 tokens, it can trigger the automatic minting, transfer, or burning of various ERC-1155 tokens. This process can lead to gas expenses that grow linearly with the number of actions O(n) rather than the fixed cost O(1) usually seen with ERC-20 token transactions. Additionally, the mechanism for choosing ERC-1155 token IDs might increase gas expenses further. Therefore, any synchronization strategy needs to account for the potential rise in ERC-1155 associated gas costs to avoid running out of gas, which could result in denial of service situations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>UserOperation Builder</title>
        <published>2024-04-05T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Derek Chiang</name><uri>https://github.com/derekchiang</uri>
	</author>
	
	<author>
		<name>Garvit Khatri</name><uri>https://github.com/plusminushalf</uri>
	</author>
	
	<author>
		<name>Fil Makarov</name><uri>https://github.com/filmakarov</uri>
	</author>
	
	<author>
		<name>Kristof Gazso</name><uri>https://github.com/kristofgazso</uri>
	</author>
	
	<author>
		<name>Derek Rein</name><uri>https://github.com/arein</uri>
	</author>
	
	<author>
		<name>Tomas Rocchi</name><uri>https://github.com/tomiir</uri>
	</author>
	
	<author>
		<name>bumblefudge</name><uri>https://github.com/bumblefudge</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7679/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7679-smart-account-interfaces/19547" />
        

        <id>https://wg-eips.ritovision.com/7679/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7679"
            label="ERC-7679" />
        

        
        

        
        <summary type="html">Construct UserOperations without being coupled with account-specific logic.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7679/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Different &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt; smart account implementations encode their signature, nonce, and calldata differently.  This makes it difficult for DApps, wallets, and smart account toolings to integrate with smart accounts without integrating with account-specific SDKs, which introduces vendor lock-in and hurts smart account adoption.&lt;&#x2F;p&gt;
&lt;p&gt;We propose a standard way for smart account implementations to put their account-specific encoding logic on-chain. It can be achieved by implementing methods that accept the raw signature, nonce, or calldata (along with the context) as an input, and output them properly formatted, so the smart account can consume them while validating and executing the User Operation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;At the moment, to build a &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt; UserOperation (UserOp for short) for a smart account requires detailed knowledge of how the smart account implementation works, since each implementation is free to encode its nonce, calldata, and signature differently.&lt;&#x2F;p&gt;
&lt;p&gt;As a simple example, one account might use an execution function called &lt;code&gt;executeFoo&lt;&#x2F;code&gt;, whereas another account might use an execution function called &lt;code&gt;executeBar&lt;&#x2F;code&gt;.  This will result in the &lt;code&gt;calldata&lt;&#x2F;code&gt; being different between the two accounts, even if they are executing the same call.&lt;&#x2F;p&gt;
&lt;p&gt;Therefore, someone who wants to send a UserOp for a given smart account needs to:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Figure out which smart account implementation the account is using.&lt;&#x2F;li&gt;
&lt;li&gt;Correctly encode signature&#x2F;nonce&#x2F;calldata given the smart account implementation, or use an account-specific SDK that knows how to do that.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In practice, this means that most DApps, wallets, and AA toolings today are tied to a specific smart account implementation, resulting in fragmentation and vendor lock-in.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;userop-builder&quot;&gt;UserOp builder&lt;&#x2F;h3&gt;
&lt;p&gt;To conform to this standard, a smart account implementation MUST provide a “UserOp builder” contract that implements the &lt;code&gt;IUserOperationBuilder&lt;&#x2F;code&gt; interface, as defined below:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Execution&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; target&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span&gt; callData&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IUserOperationBuilder&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the ERC-4337 EntryPoint that the account implementation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * supports.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; entryPoint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the nonce to use for the UserOp, given the context.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; smartAccount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the address of the UserOp sender.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; context&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the data required for the UserOp builder to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * properly compute the requested field for the UserOp.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getNonce&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; smartAccount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; context&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the calldata for the UserOp, given the context and&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * the executions.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; smartAccount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the address of the UserOp sender.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; executions&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; are (destination, value, callData) tuples that&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * the UserOp wants to execute.  It&amp;#39;s an array so the UserOp can&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * batch executions.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; context&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the data required for the UserOp builder to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * properly compute the requested field for the UserOp. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getCallData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; smartAccount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        Execution&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; executions&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; context&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns a correctly encoded signature, given a UserOp that&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * has been correctly filled out except for the signature field.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; smartAccount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the address of the UserOp sender.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; userOperation&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the UserOp.  Every field of the UserOp should&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * be valid except for the signature field.  The &amp;quot;PackedUserOperation&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * struct is as defined in ERC-4337.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; context&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the data required for the UserOp builder to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * properly compute the requested field for the UserOp.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; formatSignature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; smartAccount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        PackedUserOperation&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; userOperation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; context&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;using-the-userop-builder&quot;&gt;Using the UserOp builder&lt;&#x2F;h3&gt;
&lt;p&gt;To build a UserOp using the UserOp builder, the building party SHOULD proceed as follows:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Obtain the address of &lt;code&gt;UserOpBuilder&lt;&#x2F;code&gt; and a &lt;code&gt;context&lt;&#x2F;code&gt; from the account owner.  The &lt;code&gt;context&lt;&#x2F;code&gt; is an opaque bytes array from the perspective of the building party.  The &lt;code&gt;UserOpBuilder&lt;&#x2F;code&gt; implementation may need the &lt;code&gt;context&lt;&#x2F;code&gt; in order to properly figure out the UserOp fields.  See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7679&#x2F;#rationale&quot;&gt;Rationale&lt;&#x2F;a&gt; for more info.&lt;&#x2F;li&gt;
&lt;li&gt;Execute a multicall (batched &lt;code&gt;eth_call&lt;&#x2F;code&gt;s) of &lt;code&gt;getNonce&lt;&#x2F;code&gt; and &lt;code&gt;getCallData&lt;&#x2F;code&gt; with the &lt;code&gt;context&lt;&#x2F;code&gt; and executions.  The building party will now have obtained the nonce and calldata.&lt;&#x2F;li&gt;
&lt;li&gt;Fill out a UserOp with the data obtained previously. Gas values can be set randomly or very low. This userOp will be used to obtain a dummy signature for gas estimations. Sign the hash of userOp. (See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7679&#x2F;#rationale&quot;&gt;Rationale&lt;&#x2F;a&gt; for what a dummy signature is. See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7679&#x2F;#security-considerations&quot;&gt;Security Considerations&lt;&#x2F;a&gt; for the details on dummy signature security).&lt;&#x2F;li&gt;
&lt;li&gt;Call (via &lt;code&gt;eth_call&lt;&#x2F;code&gt;) &lt;code&gt;formatSignature&lt;&#x2F;code&gt; with the UserOp and &lt;code&gt;context&lt;&#x2F;code&gt; to obtain a UserOp with a properly formatted dummy signature. This userOp can now be used for gas estimation.&lt;&#x2F;li&gt;
&lt;li&gt;In the UserOp, change the existing gas values to those obtained from a proper gas estimation. This UserOp must be valid except for the &lt;code&gt;signature&lt;&#x2F;code&gt; field. Sign the hash of the UserOp and place the signature in the UserOp.signature field.&lt;&#x2F;li&gt;
&lt;li&gt;Call (via &lt;code&gt;eth_call&lt;&#x2F;code&gt;) &lt;code&gt;formatSignature&lt;&#x2F;code&gt; with the UserOp and &lt;code&gt;context&lt;&#x2F;code&gt; to obtain a completely valid UserOp.
&lt;ol&gt;
&lt;li&gt;Note that a UserOp has a lot more fields than &lt;code&gt;nonce&lt;&#x2F;code&gt;, &lt;code&gt;callData&lt;&#x2F;code&gt;, and &lt;code&gt;signature&lt;&#x2F;code&gt;, but how the building party obtains the other fields is outside of the scope of this document, since only these three fields are heavily dependent on the smart account implementation.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;At this point, the building party has a completely valid UserOp that they can then submit to a bundler or do whatever it likes with it.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;using-the-userop-builder-when-the-account-hasn-t-been-deployed&quot;&gt;Using the UserOp builder when the account hasn’t been deployed&lt;&#x2F;h3&gt;
&lt;p&gt;To provide the accurate data to the building party, the &lt;code&gt;UserOpBuilder&lt;&#x2F;code&gt; will in most cases have to call the account.
If the account has yet to be deployed, which means that the building party is looking to send the very first UserOp for this account, then the building party MAY modify the flow above as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;In addition to the &lt;code&gt;UserOpBuilder&lt;&#x2F;code&gt; address and the &lt;code&gt;context&lt;&#x2F;code&gt;, the building party also obtains the &lt;code&gt;factory&lt;&#x2F;code&gt; and &lt;code&gt;factoryData&lt;&#x2F;code&gt; as defined in ERC-4337.&lt;&#x2F;li&gt;
&lt;li&gt;When calling one of the view functions on the UserOp builder, the building party may use &lt;code&gt;eth_call&lt;&#x2F;code&gt; to deploy the &lt;code&gt;CounterfactualCall&lt;&#x2F;code&gt; contract, which is going to deploy the account and call &lt;code&gt;UserOpBuilder&lt;&#x2F;code&gt; (see below).&lt;&#x2F;li&gt;
&lt;li&gt;When filling out the UserOp, the building party includes &lt;code&gt;factory&lt;&#x2F;code&gt; and &lt;code&gt;factoryData&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;code&gt;CounterfactualCall&lt;&#x2F;code&gt; contract SHOULD:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Deploy the account using &lt;code&gt;factory&lt;&#x2F;code&gt; and &lt;code&gt;factoryData&lt;&#x2F;code&gt; provided by the building party.&lt;&#x2F;li&gt;
&lt;li&gt;Revert if the deployment has not succeeded.&lt;&#x2F;li&gt;
&lt;li&gt;If the account has been deployed succesfully, call &lt;code&gt;UserOpBuilder&lt;&#x2F;code&gt; and return the data returned by &lt;code&gt;UserOpBuilder&lt;&#x2F;code&gt; to the building party.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;See Reference Implementation section for more details on the &lt;code&gt;CounterfactualCall&lt;&#x2F;code&gt; contract.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;context&quot;&gt;Context&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;context&lt;&#x2F;code&gt; is an array of bytes that encodes whatever data the UserOp builder needs in order to correctly determine the nonce, calldata, and signature.  Presumably, the &lt;code&gt;context&lt;&#x2F;code&gt; is constructed by the account owner, with the help of a wallet software.&lt;&#x2F;p&gt;
&lt;p&gt;Here we outline one possible use of &lt;code&gt;context&lt;&#x2F;code&gt;: delegation.  Say the account owner wants to delegate a transaction to be executed by the building party.  The account owner could encode a signature of the public key of the building party inside the &lt;code&gt;context&lt;&#x2F;code&gt;.  Let’s call this signature from the account owner the &lt;code&gt;authorization&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Then, when the building party fills out the UserOp, it would fill the &lt;code&gt;signature&lt;&#x2F;code&gt; field with a signature generated by its own private key.  When it calls &lt;code&gt;getSignature&lt;&#x2F;code&gt; on the UserOp builder, the UserOp builder would extract the &lt;code&gt;authorization&lt;&#x2F;code&gt; from the &lt;code&gt;context&lt;&#x2F;code&gt; and concatenates it with the building party’s signature.  The smart account would presumably be implemented such that it would recover the building party’s public key from the signature, and check that the public key was in fact signed off by the &lt;code&gt;authorization&lt;&#x2F;code&gt;.  If the check succeeds, the smart account would execute the UserOp, thus allowing the building party to execute a UserOp on the user’s behalf.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;dummy-signature&quot;&gt;Dummy signature&lt;&#x2F;h3&gt;
&lt;p&gt;The “dummy signature” refers to the signature used in a UserOp sent to a bundler for estimating gas (via &lt;code&gt;eth_estimateUserOperationGas&lt;&#x2F;code&gt;).  A dummy signature is needed because, at the time the bundler estimates gas, a valid signature does not exist yet, since the valid signature itself depends on the gas values of the UserOp, creating a circular dependency.  To break the circular dependency, a dummy signature is used.&lt;&#x2F;p&gt;
&lt;p&gt;However, the dummy signature is not just a fixed value that any smart account can use.  The dummy signature must be constructed such that it would cause the UserOp to use about as much gas as a real signature would.  Therefore, the dummy signature varies based on the specific validation logic that the smart account uses to validate the UserOp, making it dependent on the smart account implementation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC is intended to be backwards compatible with all ERC-4337 smart accounts as of EntryPoint 0.7.&lt;&#x2F;p&gt;
&lt;p&gt;For smart accounts deployed against EntryPoint 0.6, the &lt;code&gt;IUserOperationBuilder&lt;&#x2F;code&gt; interface needs to be modified such that the &lt;code&gt;PackedUserOperation&lt;&#x2F;code&gt; struct is replaced with the corresponding struct in EntryPoint 0.6.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;counterfactual-call-contract&quot;&gt;Counterfactual call contract&lt;&#x2F;h3&gt;
&lt;p&gt;The counterfactual call contract is inspired by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6492&#x2F;&quot;&gt;ERC-6492&lt;&#x2F;a&gt;, which devised a mechanism to execute &lt;code&gt;isValidSignature&lt;&#x2F;code&gt; (see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;ERC-1271&lt;&#x2F;a&gt;) against a pre-deployed (counterfactual) contract.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CounterfactualCall&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CounterfactualDeployFailed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; error&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; smartAccount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; create2Factory&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; factoryData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; userOpBuilder&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; userOpBuilderCalldata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;smartAccount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt; success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; ret&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; create2Factory&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;factoryData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;success &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;smartAccount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CounterfactualDeployFailed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ret&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            let&lt;&#x2F;span&gt;&lt;span&gt; success &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; userOpBuilder&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;userOpBuilderCalldata&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;userOpBuilderCalldata&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            let&lt;&#x2F;span&gt;&lt;span&gt; ptr &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x40&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            returndatacopy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ptr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returndatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; iszero&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                revert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ptr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returndatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ptr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returndatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Here’s an example of calling this contract using the ethers and viem libraries:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ethers&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; provider&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ethers&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;utils&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;concat&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    counterfactualCallBytecode&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      new&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ethers&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;utils&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;AbiCoder&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;smartAccount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; userOpBuilder&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; getNonceCallData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; factory&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; factoryData&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; viem&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; client&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; encodeDeployData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    abi&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; parseAbi&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;constructor(address, address, bytes, address, bytes)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    args&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;smartAccount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; userOpBuilder&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; getNonceCalldata&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; factory&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; factoryData&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytecode&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; counterfactualCallBytecode&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;dummy-signature-security&quot;&gt;Dummy Signature security&lt;&#x2F;h3&gt;
&lt;p&gt;Since the properly formatted dummy signature is going to be publicly disclosed, in theory it can be intercepted and used by the man in the middle. Risks and potential harm of this is very low though as the dummy signature will be effectively unusable after the final UserOp is submitted (as both UserOps use the same nonce). However, to mitigate even this small issue, it is recommended that the UserOp which hash is going to be signed to obtain an un-foirmatted dummy signature (step 3 above) is filled with very low gas values.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EOF - Prepare for Address Space Extension</title>
        <published>2024-04-03T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Danno Ferrin</name><uri>https://github.com/shemnon</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7676/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eof-prepare-for-address-space-extension/19537" />
        

        <id>https://wg-eips.ritovision.com/7676/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:7676"
            label="EIP-7676" />
        

        
        

        
        <summary type="html">Update EOF opcodes so addresses are not trimmed during execution</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7676/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Operations in the Legacy EVM trim off the top 12 bytes of an address operand before evaluation. This
EIP changes the handling of those opcodes within EOF so that no trimming occurs and the top twelve
bytes need to be zero or an exceptional halt is raised.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;There have been proposals to extend Ethereum Addresses from 160 bits to 256, such as one that would
use the extra bits for state expiry (such as the ethereum magicians forum topic &quot;Increasing the
address size from 20 to 32 bytes&quot;). One issue ground the work to a halt: EVM opcodes that accept
addresses trim all but the lowest 20 bytes out from the operand before processing. EVM Reference
tests verify this behavior in the &#x27;stBadOpcode&#x2F;invalidAddr.json&#x27; tests.&lt;&#x2F;p&gt;
&lt;p&gt;The EVM Object Format presents an opportunity to remove this address masking in a backwards
compatible way, by baking it into the format definition from the start.&lt;&#x2F;p&gt;
&lt;p&gt;Most of the work is already in place. The following 5 operations have already been banned from
EOF: &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt;, &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt;, &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt;, &lt;code&gt;CALLCODE&lt;&#x2F;code&gt;, and &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;. Three call
operations, &lt;code&gt;CALL&lt;&#x2F;code&gt;, &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;, and &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; are being revamped
in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7069&#x2F;&quot;&gt;EIP-7069&lt;&#x2F;a&gt;. That leaves only one operation, &lt;code&gt;BALANCE&lt;&#x2F;code&gt;, with issues.&lt;&#x2F;p&gt;
&lt;p&gt;When future uses of address space extension are specified it is expected that the exceptional halt
behavior will be modified.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;We introduce one new instruction:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;EXTBALANCE&lt;&#x2F;code&gt; (&lt;code&gt;tbd&lt;&#x2F;code&gt;) with arguments &lt;code&gt;(target_address)&lt;&#x2F;code&gt;, returning &lt;code&gt;balance&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;code&gt;EXTBALANCE&lt;&#x2F;code&gt; will pop one stack item off of the stack, the address of another account or contract.
The balance of that account or contract will be pushed onto the stack.&lt;&#x2F;p&gt;
&lt;p&gt;If &lt;code&gt;EXTBALANCE&lt;&#x2F;code&gt; is invoked with any of the high 12 bytes in &lt;code&gt;target_address&lt;&#x2F;code&gt; set to a non-zero value
the operation will cause an exceptional halt. All gas in the current frame will be consumed on
failure, no gas schedule change is needed.&lt;&#x2F;p&gt;
&lt;p&gt;The gas cost of &lt;code&gt;EXTBALANCE&lt;&#x2F;code&gt; will be costed according to the gas schedule for the &lt;code&gt;BALANCE&lt;&#x2F;code&gt;
operation specified in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;. This means if the account is not
in &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt; then it is charged 2600 gas and added to &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt;. If the
account is in &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt; then 100 gas is charged. The &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt; is shared with
all other operands described in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Also, for the &lt;code&gt;EXTCALL&lt;&#x2F;code&gt;, &lt;code&gt;EXTDELEGATECALL&lt;&#x2F;code&gt;, and &lt;code&gt;EXTSTATICCALL&lt;&#x2F;code&gt; operations a new step is added just
before the memory expansion check: halt with exceptional failure if any of the high 96 bits of
the &lt;code&gt;target_address&lt;&#x2F;code&gt; are set.&lt;&#x2F;p&gt;
&lt;p&gt;It is anticipated that future EIPs will alter the behavior in a way that will not result in an
exceptional halt. Contract implementors should not depend on the exceptional halt.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;new-opcode&quot;&gt;New Opcode&lt;&#x2F;h3&gt;
&lt;p&gt;There is no need to ban the &lt;code&gt;BALANCE&lt;&#x2F;code&gt; opcode as it does not cause any problems that would require
banning it within an EOF container. Adding a new opcode also allows the existing opcode to behave
the same in EOF and legacy code, reducing potential friction points for end user confusion and bugs.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;revert-on-invalid-address&quot;&gt;Revert on invalid address&lt;&#x2F;h3&gt;
&lt;p&gt;There are two alternative ways to handle accounts with high bits set. The specification calls for
an exceptional halt, but the alternative was to treat the account as empty. The reason the &quot;empty
account&quot; approach was rejected is twofold:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt; list could be required to track 256 bit accounts when an invalid address
is accessed.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;EXTCALL&lt;&#x2F;code&gt; series instructions could still send balance to those addresses and such accounts
would then hold an (inaccessible) balance that would need to be reflected in the merkle trie.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;no-change-in-gas-costing&quot;&gt;No change in gas costing&lt;&#x2F;h3&gt;
&lt;p&gt;Because the BALANCE operation already needs to check &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt; there is already a good
amount of processing that must go into the operation. Hence, no changes to the gas schedule are
needed to prevent abuse of the failures. Such incremental costs will be dominated by costs related
to reverts and address checking for valid accounts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Preparing for Address Space Expansion is explicitly done inside the scope of EOF with the intent
that it will not require changes in old contracts, but with the caveat that old contracts may not be
able to use addresses in the expanded space.&lt;&#x2F;p&gt;
&lt;p&gt;Future EIPs should be mindful when adding new operation with an address operand or parameter to how
it interacts with EOF and legacy contracts. Authors should ensure that such additions remain in
harmony with this EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases similar to &lt;code&gt;invalidAddr.json&lt;&#x2F;code&gt;  tests in the standard reference tests will need to be
written for the EOF tests, except they would check for halts on invalid addresses.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TBD &lt;!-- TODO --&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP only defines a revert behavior for previously stripped addresses. Compilers will need to be
aware of the need to mask addresses coming in from call data. Some of this is already present in
existing Solidity ABI standards, but more care should be taken in examining the flow
around &lt;code&gt;EXTBALANCE&lt;&#x2F;code&gt; and code for &lt;code&gt;EXTCALL&lt;&#x2F;code&gt; operations to ensure that compiled code strips the high
bytes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Paymaster Web Service Capability</title>
        <published>2024-04-03T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Lukas Rosario</name><uri>https://github.com/lukasrosario</uri>
	</author>
	
	<author>
		<name>Dror Tirosh</name><uri>https://github.com/drortirosh</uri>
	</author>
	
	<author>
		<name>Wilson Cusack</name><uri>https://github.com/wilsoncusack</uri>
	</author>
	
	<author>
		<name>Kristof Gazso</name><uri>https://github.com/kristofgazso</uri>
	</author>
	
	<author>
		<name>Hazim Jumali</name><uri>https://github.com/hazim-j</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7677/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7677-paymaster-web-service-capability/19530" />
        

        <id>https://wg-eips.ritovision.com/7677/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7677"
            label="ERC-7677" />
        

        
        

        
        <summary type="html">A way for apps to communicate with smart wallets about paymaster web services</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7677/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;With &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5792&#x2F;&quot;&gt;EIP-5792&lt;&#x2F;a&gt;, apps can communicate with wallets about advanced features via capabilities. This proposal defines a capability that allows apps to request that &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt; wallets communicate with a specified paymaster web service. To support this, we also define a standardized API for paymaster web services.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;App developers want to start sponsoring their users&#x27; transactions using paymasters. Paymasters are commonly used via web services. However, there is currently no way for apps to tell wallets to communicate with a specific paymaster web service. Similarly, there is no standard for how wallets should communicate with these services. We need both a way for apps to tell wallets to communicate with a specific paymaster web service and a communication standard for wallets to do so.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;One new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5792&#x2F;&quot;&gt;EIP-5792&lt;&#x2F;a&gt; wallet capability is defined. We also define a standard interface for paymaster web services as a prerequisite.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;paymaster-web-service-interface&quot;&gt;Paymaster Web Service Interface&lt;&#x2F;h3&gt;
&lt;p&gt;We define two JSON-RPC methods to be implemented by paymaster web services.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;pm-getpaymasterstubdata&quot;&gt;&lt;code&gt;pm_getPaymasterStubData&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Returns stub values to be used in paymaster-related fields of an unsigned user operation for gas estimation. Accepts an unsigned user operation, entrypoint address, chain id, and a context object. Paymaster service providers can define fields that app developers should use in the context object.&lt;&#x2F;p&gt;
&lt;p&gt;This method MAY return paymaster-specific gas values if applicable to the provided EntryPoint version. For example, if provided with EntryPoint v0.7, this method MAY return &lt;code&gt;paymasterVerificationGasLimit&lt;&#x2F;code&gt;. Furthermore, for EntryPoint v0.7, this method MUST return a value for &lt;code&gt;paymasterPostOpGasLimit&lt;&#x2F;code&gt;. This is because it is the paymaster that pays the postOpGasLimit, so it cannot trust the wallet to estimate this amount.&lt;&#x2F;p&gt;
&lt;p&gt;The wallet SHOULD use these provided gas values when submitting the &lt;code&gt;UserOperation&lt;&#x2F;code&gt; to a bundler for gas estimation.&lt;&#x2F;p&gt;
&lt;p&gt;This method MAY also return a &lt;code&gt;sponsor&lt;&#x2F;code&gt; object with a &lt;code&gt;name&lt;&#x2F;code&gt; field and an optional &lt;code&gt;icon&lt;&#x2F;code&gt; field. The &lt;code&gt;name&lt;&#x2F;code&gt; field is the name of the party sponsoring the transaction, and the &lt;code&gt;icon&lt;&#x2F;code&gt; field is a URI pointing to an image. Wallet developers MAY choose to display sponsor information to users. The &lt;code&gt;icon&lt;&#x2F;code&gt; string MUST be a data URI as defined in [RFC-2397]. The image SHOULD be a square with 96x96px minimum resolution. The image format is RECOMMENDED to be either lossless or vector based such as PNG, WebP or SVG to make the image easy to render on the wallet. Since SVG images can execute Javascript, wallets MUST render SVG images using the &lt;code&gt;&amp;lt;img&amp;gt;&lt;&#x2F;code&gt; tag to ensure no untrusted Javascript execution can occur.&lt;&#x2F;p&gt;
&lt;p&gt;There are cases where a call to just &lt;code&gt;pm_getPaymasterStubData&lt;&#x2F;code&gt; is sufficient to provide valid paymaster-related user operation fields, e.g. when the &lt;code&gt;paymasterData&lt;&#x2F;code&gt; does not contain a signature. In such cases, the second RPC call to &lt;code&gt;pm_getPaymasterData&lt;&#x2F;code&gt; (defined below) MAY be skipped, by returning &lt;code&gt;isFinal: true&lt;&#x2F;code&gt; by this RPC call.&lt;&#x2F;p&gt;
&lt;p&gt;Paymaster web services SHOULD do validations on incoming user operations during &lt;code&gt;pm_getPaymasterStubData&lt;&#x2F;code&gt; execution and reject the request at this stage if it would not sponsor the operation.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;pm-getpaymasterstubdata-rpc-specification&quot;&gt;&lt;code&gt;pm_getPaymasterStubData&lt;&#x2F;code&gt; RPC Specification&lt;&#x2F;h5&gt;
&lt;p&gt;Note that the user operation parameter does not include a signature, as the user signs after all other fields are populated.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; [userOp, entryPoint, chainId, context]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; GetPaymasterStubDataParams&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Below is specific to Entrypoint v0.6 but this API can be used with other entrypoint versions too&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    initCode&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    callData&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    callGasLimit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    verificationGasLimit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    preVerificationGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    maxFeePerGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    maxPriorityFeePerGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; userOp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; EntryPoint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Chain ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  Record&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; any&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Context&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; GetPaymasterStubDataResult&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  sponsor&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; icon&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sponsor info&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  paymaster&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Paymaster address (entrypoint v0.7)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  paymasterData&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Paymaster data (entrypoint v0.7)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  paymasterVerificationGasLimit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Paymaster validation gas (entrypoint v0.7)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  paymasterPostOpGasLimit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Paymaster post-op gas (entrypoint v0.7)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  paymasterAndData&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Paymaster and data (entrypoint v0.6)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  isFinal&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; boolean&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Indicates that the caller does not need to call pm_getPaymasterData&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h6 id=&quot;pm-getpaymasterstubdata-example-parameters&quot;&gt;&lt;code&gt;pm_getPaymasterStubData&lt;&#x2F;code&gt; Example Parameters&lt;&#x2F;h6&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;initCode&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;callData&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;callGasLimit&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;verificationGasLimit&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;preVerificationGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;maxFeePerGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;maxPriorityFeePerGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x2105&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Illustrative context field. These should be defined by service providers.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;policyId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;962b252c-a726-4a37-8d86-333ce0a07299&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h6 id=&quot;pm-getpaymasterstubdata-example-return-value&quot;&gt;&lt;code&gt;pm_getPaymasterStubData&lt;&#x2F;code&gt; Example Return Value&lt;&#x2F;h6&gt;
&lt;p&gt;Paymaster services MUST detect which entrypoint version the account is using and return the correct fields.&lt;&#x2F;p&gt;
&lt;p&gt;For example, if using entrypoint v0.6:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;sponsor&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;My App&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;icon&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;paymasterAndData&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;If using entrypoint v0.7:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;sponsor&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;My App&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;icon&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;paymaster&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;paymasterData&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;If using entrypoint v0.7, with paymaster gas estimates:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;sponsor&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;My App&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;icon&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;paymaster&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;paymasterData&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;paymasterVerificationGasLimit&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;paymasterPostOpGasLimit&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Indicating that the caller does not need to make a &lt;code&gt;pm_getPaymasterData&lt;&#x2F;code&gt; RPC call:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;sponsor&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;My App&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;icon&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;paymaster&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;paymasterData&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;isFinal&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;pm-getpaymasterdata&quot;&gt;&lt;code&gt;pm_getPaymasterData&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Returns values to be used in paymaster-related fields of a signed user operation. These are not stub values and will be used during user operation submission to a bundler. Similar to &lt;code&gt;pm_getPaymasterStubData&lt;&#x2F;code&gt;, accepts an unsigned user operation, entrypoint address, chain id, and a context object.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;pm-getpaymasterdata-rpc-specification&quot;&gt;&lt;code&gt;pm_getPaymasterData&lt;&#x2F;code&gt; RPC Specification&lt;&#x2F;h5&gt;
&lt;p&gt;Note that the user operation parameter does not include a signature, as the user signs after all other fields are populated.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; [userOp, entryPoint, chainId, context]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; GetPaymasterDataParams&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Below is specific to Entrypoint v0.6 but this API can be used with other entrypoint versions too&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    initCode&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    callData&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    callGasLimit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    verificationGasLimit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    preVerificationGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    maxFeePerGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    maxPriorityFeePerGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; userOp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Entrypoint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Chain ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  Record&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; any&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Context&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; GetPaymasterDataResult&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  paymaster&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Paymaster address (entrypoint v0.7)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  paymasterData&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Paymaster data (entrypoint v0.7)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  paymasterAndData&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Paymaster and data (entrypoint v0.6)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h6 id=&quot;pm-getpaymasterdata-example-parameters&quot;&gt;&lt;code&gt;pm_getPaymasterData&lt;&#x2F;code&gt; Example Parameters&lt;&#x2F;h6&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;initCode&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;callData&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;callGasLimit&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;verificationGasLimit&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;preVerificationGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;maxFeePerGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;maxPriorityFeePerGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x2105&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Illustrative context field. These should be defined by service providers.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;policyId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;962b252c-a726-4a37-8d86-333ce0a07299&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h6 id=&quot;pm-getpaymasterdata-example-return-value&quot;&gt;&lt;code&gt;pm_getPaymasterData&lt;&#x2F;code&gt; Example Return Value&lt;&#x2F;h6&gt;
&lt;p&gt;Paymaster services MUST detect which entrypoint version the account is using and return the correct fields.&lt;&#x2F;p&gt;
&lt;p&gt;For example, if using entrypoint v0.6:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;paymasterAndData&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;If using entrypoint v0.7:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;paymaster&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;paymasterData&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;paymasterservice-capability&quot;&gt;&lt;code&gt;paymasterService&lt;&#x2F;code&gt; Capability&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;paymasterService&lt;&#x2F;code&gt; capability is implemented by both apps and wallets.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;app-implementation&quot;&gt;App Implementation&lt;&#x2F;h4&gt;
&lt;p&gt;Apps need to give wallets a paymaster service URL they can make the above RPC calls to. They can do this using the &lt;code&gt;paymasterService&lt;&#x2F;code&gt; capability as part of an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5792&#x2F;&quot;&gt;EIP-5792&lt;&#x2F;a&gt; &lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt; call.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;wallet-sendcalls-paymaster-capability-specification&quot;&gt;&lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt; Paymaster Capability Specification&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PaymasterCapabilityParams&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  url&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  context&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Record&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; any&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h6 id=&quot;wallet-sendcalls-example-parameters&quot;&gt;&lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt; Example Parameters&lt;&#x2F;h6&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;from&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xd46e8dd67c5d32be8058bb8eb970870f07244567&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;calls&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xd46e8dd67c5d32be8058bb8eb970870f07244567&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x9184e72a&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xd46e8dd67c5d32be8058bb8eb970870f07244567&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x182183&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xfbadbaf01&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;capabilities&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;paymasterService&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;url&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;context&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;policyId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;962b252c-a726-4a37-8d86-333ce0a07299&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The wallet will then make the above paymaster RPC calls to the URL specified in the &lt;code&gt;paymasterService&lt;&#x2F;code&gt; capability field.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;wallet-implementation&quot;&gt;Wallet Implementation&lt;&#x2F;h4&gt;
&lt;p&gt;To conform to this specification, smart wallets that wish to leverage app-sponsored transactions:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;MUST indicate to apps that they can communicate with paymaster web services via their response to an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5792&#x2F;&quot;&gt;EIP-5792&lt;&#x2F;a&gt; &lt;code&gt;wallet_getCapabilities&lt;&#x2F;code&gt; call.&lt;&#x2F;li&gt;
&lt;li&gt;SHOULD make calls to and use the values returned by the paymaster service specified in the capabilities field of an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5792&#x2F;&quot;&gt;EIP-5792&lt;&#x2F;a&gt; &lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt; call. An example of an exception is a wallet that allows users to select a paymaster provided by the wallet. Since there might be cases in which the provided paymaster is ultimately not used—either due to service failure or due to a user selecting a different, wallet-provided paymaster—applications MUST NOT assume that the paymaster it provides to a wallet is the entity that pays for transaction fees.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h5 id=&quot;wallet-getcapabilities-response-specification&quot;&gt;&lt;code&gt;wallet_getCapabilities&lt;&#x2F;code&gt; Response Specification&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PaymasterServiceCapability&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  supported&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; boolean&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h6 id=&quot;wallet-getcapabilities-example-response&quot;&gt;&lt;code&gt;wallet_getCapabilities&lt;&#x2F;code&gt; Example Response&lt;&#x2F;h6&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;0x2105&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;paymasterService&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;supported&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;0x14A34&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;paymasterService&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;supported&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Below is a diagram illustrating the full &lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt; flow, including how a wallet might implement the interaction.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7677&#x2F;.&#x2F;assets&#x2F;0.svg&quot; alt=&quot;flow&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;gas-estimation&quot;&gt;Gas Estimation&lt;&#x2F;h3&gt;
&lt;p&gt;The current loose standard for paymaster services is to implement &lt;code&gt;pm_sponsorUserOperation&lt;&#x2F;code&gt;. This method returns values for paymaster-related user operation fields and updated gas values. The problem with this method is that paymaster service providers have different ways of estimating gas, which results in different estimated gas values. Sometimes these estimates can be insufficient. As a result we believe it’s better to leave gas estimation up to the wallet, as the wallet has more context on how user operations will get submitted (e.g. which bundler they will get submitted to). Then wallets can ask paymaster services to sponsor given the estimates defined by the wallet.&lt;&#x2F;p&gt;
&lt;p&gt;The above reason is also why we specify that the &lt;code&gt;pm_getPaymasterStubData&lt;&#x2F;code&gt; method MAY also return paymaster-specific gas estimates. I.e., bundlers are prone to insufficiently estimating the paymaster-specific gas values, and the paymaster servies themselves are ultimately better equipped to provide them.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;chain-id-parameter&quot;&gt;Chain ID Parameter&lt;&#x2F;h3&gt;
&lt;p&gt;Currently, paymaster service providers typically provide developers with a URL per chain. That is, paymaster service URLs are not typically multichain. So why do we need a chain ID parameter? We recognize that we must specify some constraint so that wallets can communicate with paymaster services about which chain their requests are for. As we see it, there are two options:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Formalize the current loose standard and require that paymaster service URLs are 1:1 with chains.&lt;&#x2F;li&gt;
&lt;li&gt;Require a chain ID parameter as part of paymaster service requests.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;We feel that option (2) is the better abstraction here. This allows service providers to offer multichain URLs if they wish at essentially no downside to providers who offer a URL per chain. Providers who offer a URL per chain would just need to accept an additional parameter that they can ignore. When an app developer who uses a URL-per-chain provider wants to submit a request to a different chain, they can just swap out the URL accordingly.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;challenges-with-stub-data&quot;&gt;Challenges With Stub Data&lt;&#x2F;h3&gt;
&lt;p&gt;Enabling a workflow with greater flexibility in gas estimations will nonetheless come with some known challenges that paymaster services must be aware of in order to ensure reliable gas estimates are generated during the process.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;preverificationgas&quot;&gt;&lt;code&gt;preVerificationGas&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;preVerificationGas&lt;&#x2F;code&gt; value is largely influenced by the size of the user operation and it&#x27;s ratio of zero to non-zero bytes. This can cause a scenario where &lt;code&gt;pm_getPaymasterStubData&lt;&#x2F;code&gt; returns values that results in upstream gas estimations to derive a lower &lt;code&gt;preVerificationGas&lt;&#x2F;code&gt; compared to what &lt;code&gt;pm_getPaymasterData&lt;&#x2F;code&gt; would require. If this occurs then bundlers will return an insufficient &lt;code&gt;preVerificationGas&lt;&#x2F;code&gt; error during &lt;code&gt;eth_sendUserOperation&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;To avoid this scenario, a paymaster service MUST return stub data that:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Is of the same length as the final data.&lt;&#x2F;li&gt;
&lt;li&gt;Has an amount of zero bytes (&lt;code&gt;0x00&lt;&#x2F;code&gt;) that is less than or equal to the final data.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h4 id=&quot;consistent-code-paths&quot;&gt;Consistent Code Paths&lt;&#x2F;h4&gt;
&lt;p&gt;In the naive case, a stub value of repeating non-zero bytes (e.g. &lt;code&gt;0x01&lt;&#x2F;code&gt;) that is of the same length as the final value will generate a usable &lt;code&gt;preVerificationGas&lt;&#x2F;code&gt;. Although this would immediately result in a gas estimation error given that the simulation will likely revert due to an invalid paymaster data.&lt;&#x2F;p&gt;
&lt;p&gt;In a more realistic case, a valid stub can result in a successful simulation but still return insufficient gas limits. This can occur if the stub data causes &lt;code&gt;validatePaymasterUserOp&lt;&#x2F;code&gt; or &lt;code&gt;postOp&lt;&#x2F;code&gt; functions to simulate a different code path compared to the final value. For example, if the simulated code was to return early, the estimated gas limits would be less than expected which would cause upstream &lt;code&gt;out of gas&lt;&#x2F;code&gt; errors once a user operation is submitted to the bundler.&lt;&#x2F;p&gt;
&lt;p&gt;Therefore, a paymaster service MUST also return a stub that can result in a simulation executing the same code path compared to what is expected of the final user operation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The URLs paymaster service providers give to app developers commonly have API keys in them. App developers might not want to pass these API keys along to wallets. To remedy this, we recommend that app developers provide a URL to their app&#x27;s backend, which can then proxy calls to paymaster services. Below is a modified diagram of what this flow might look like.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7677&#x2F;.&#x2F;assets&#x2F;1.svg&quot; alt=&quot;flowWithAPI&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;This flow would allow developers to keep their paymaster service API keys secret. Developers might also want to do additional simulation &#x2F; validation in their backends to ensure they are sponsoring a transaction they want to sponsor.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Temporary Approval Extension for ERC-20</title>
        <published>2024-04-02T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Xenia Shape</name><uri>https://github.com/byshape</uri>
	</author>
	
	<author>
		<name>Mikhail Melnik</name><uri>https://github.com/ZumZoom</uri>
	</author>
	
	<author>
		<name>Hadrien Croubois</name><uri>https://github.com/Amxx</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7674/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/add-erc-7674-transient-approval-extension-for-erc-20/19521" />
        

        <id>https://wg-eips.ritovision.com/7674/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        

        
        <category
            term="tag:eip:7674"
            label="ERC-7674" />
        

        
        

        
        <summary type="html">Ephemeral ERC-20 approvals lasting a single transaction</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7674/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This specification defines the minimum interface required to temporarily approve &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens for spending within the same transaction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;User are often required to set a token approval that will only be used once. It is common to leave unexpected approvals after these interactions. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1153&#x2F;&quot;&gt;EIP-1153&lt;&#x2F;a&gt; introduces &lt;code&gt;TSTORE&lt;&#x2F;code&gt;, which can be used to efficiently handle temporarily allowances.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;Compliant contracts MUST implement 1 new function in addition to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; temporaryApprove&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;A call to &lt;code&gt;temporaryApprove(spender, value)&lt;&#x2F;code&gt; allows &lt;code&gt;spender&lt;&#x2F;code&gt; to withdraw within the same transaction on behalf of &lt;code&gt;msg.sender&lt;&#x2F;code&gt; multiple times, such that the total withdrawn is less than or equal to the &lt;code&gt;value&lt;&#x2F;code&gt; amount.  This temporary allowance is to be considered in addition to the normal (persistent) &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; allowance. The total value that spender is able to spend during the transaction is thus capped by the sum of the temporary and the normal (persistent) allowances. While it SHOULD be possible for a &lt;code&gt;transferFrom&lt;&#x2F;code&gt; operation to consume both types of allowance, the consumption of the temporary allowance SHOULD take priority over the consumption of the persistent allowance. Therefore, if the temporary allowance is sufficient for executing a &lt;code&gt;transferFrom&lt;&#x2F;code&gt; operation, the persistent allowance SHOULD not be loaded&#x2F;updated from the storage. Consumption of persistent allowance, which implies storage accesses, SHOULD be performed only if the temporary allowance is not sufficient for the operation being executed.&lt;&#x2F;p&gt;
&lt;p&gt;Each temporary allowance MUST persist until the end of the transaction that created it (unless overwritten by another call to &lt;code&gt;temporaryApprove&lt;&#x2F;code&gt; or consumed by a call to &lt;code&gt;transferFrom&lt;&#x2F;code&gt;). Each temporary allowance MUST be cleared at the end of the transaction that created it. See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7674&#x2F;#using-transient-storage&quot;&gt;Using Transient Storage&lt;&#x2F;a&gt; for an example.&lt;&#x2F;p&gt;
&lt;p&gt;Compliant contracts MUST add a temporary allowance to the permanent one when returning the allowed amount to spend in the &lt;code&gt;allowance&lt;&#x2F;code&gt; function. In case the sum of the temporary and permanent allowance overflow, &lt;code&gt;type(uint256).max&lt;&#x2F;code&gt; MUST be returned.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;It was decided to make minimal interface extension to allow easier integration of a compliant contract into the existing infrastructure. This affects the backward compatibility of the &lt;code&gt;allowance&lt;&#x2F;code&gt; function. However, the required changes to the &lt;code&gt;transferFrom&lt;&#x2F;code&gt; function implementation satisfy the requirement to explicitly authorize the spender to transfer tokens.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;All functionality of the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; standard is backward compatible except for the &lt;code&gt;allowance&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;using-transient-storage&quot;&gt;Using Transient Storage&lt;&#x2F;h3&gt;
&lt;p&gt;The storage for the temporary allowances must be different to that of the regular allowance. Compliant contracts may use the transient storage &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1153&#x2F;&quot;&gt;EIP-1153&lt;&#x2F;a&gt; to keep the temporary allowance. For each &lt;code&gt;owner&lt;&#x2F;code&gt; and &lt;code&gt;spender&lt;&#x2F;code&gt;, the slot should be uniquely selected to avoid slot collision. Each slot index should be derived from the base slot index for temporary allowances, &lt;code&gt;owner&lt;&#x2F;code&gt; and &lt;code&gt;spender&lt;&#x2F;code&gt; addresses. Slot may be derived as &lt;code&gt;keccak256(spender . keccak256(owner . p))&lt;&#x2F;code&gt; where &lt;code&gt;.&lt;&#x2F;code&gt; is concatenation and &lt;code&gt;p&lt;&#x2F;code&gt; is &lt;code&gt;keccak256&lt;&#x2F;code&gt; from the string uniquely defining temporary allowances in the namespace of the implementing contract.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;events&quot;&gt;Events&lt;&#x2F;h3&gt;
&lt;p&gt;Even though no event is required when setting a temporary allowance, compliant contracts may emit &lt;code&gt;TransientApproval(address indexed owner, address indexed spender, uint256 value)&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The method of deriving slot identifiers to store temporary allowances must avoid collision with other slots in the same space (e.g. transient storage).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Ownership Delegation and Context for ERC-721</title>
        <published>2024-04-02T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Duc Tho Tran</name><uri>https://github.com/ducthotran2010</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7695/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7695-ownership-delegation-and-context-for-non-fungible-token/19716" />
        

        <id>https://wg-eips.ritovision.com/7695/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7695"
            label="ERC-7695" />
        

        
        

        
        <summary type="html">Introduces contexts and ownership delegation for ERC-721 tokens, expanding dApps and financial use cases without transferring ownership</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7695/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is an extension for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;, designed to specify users for various contexts with a locking feature and allow temporary ownership delegation without changing the original owner.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP preserves the benefits and rights of the owner while expanding the utility of NFTs across various dApps by adding the concepts of Ownership Delegation and Contexts, which define specific roles: Controller and User, who can use the NFT within defined contexts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;For standard &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; NFTs, there are several use cases in financial applications, including:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Staking NFTs to earn rewards.&lt;&#x2F;li&gt;
&lt;li&gt;Mortgaging an NFT to generate income.&lt;&#x2F;li&gt;
&lt;li&gt;Granting users for different purposes like rental and token delegation—where someone pays to use tokens and pays another party to use the tokens.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Traditionally, these applications require ownership transfers to lock the NFT in contracts. However, other decentralized applications (dApps) recognize token ownership as proof that the token owner is entitled to benefits within their reward systems, such as airdrops or tiered rewards. If token owners have their tokens locked in contracts, they are not eligible to receive benefits from holding these tokens, or the reward systems have to support as many contracts as possible to help these owners.&lt;&#x2F;p&gt;
&lt;p&gt;This is because there is only an Owner role indicating the ownership rights, developing on top of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; has often posed challenges. This proposal aims to solve these challenges by contextualizing the use case to be handled by controllers and distinguishing ownership rights from other roles at the standard level through an ownership delegation mechanism. Standardizing these measures, dApp developers can more easily construct infrastructure and protocols on top of this standard.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;p&gt;This specification encompasses the following components:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Token Context&lt;&#x2F;strong&gt; provides a specified use case of a token. It serves as the association relationship between Tokens and Contexts. Within each unique token context, there exists an allocated user who is authorized to utilize the token within that context. In a specified context, there are two distinct roles:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Controller&lt;&#x2F;strong&gt;: This role possesses the authority to control the context.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;User&lt;&#x2F;strong&gt;: This role signifies the primary token user within the given context.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Ownership Rights&lt;&#x2F;strong&gt; of a token are defined to be able to:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Transfer that token to a new owner.&lt;&#x2F;li&gt;
&lt;li&gt;Add token context(s): attaching that token to&#x2F;from one or many contexts.&lt;&#x2F;li&gt;
&lt;li&gt;Remove token context(s): detaching that token to&#x2F;from one or many contexts.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Ownership Delegation&lt;&#x2F;strong&gt; involves distinguishing between owner and ownership rights by delegating ownership to other accounts for a specific duration. During this period, owners temporarily cede ownership rights until the delegation expires.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;roles&quot;&gt;Roles&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Roles&lt;&#x2F;th&gt;&lt;th&gt;Explanation &#x2F; Permission&lt;&#x2F;th&gt;&lt;th&gt;Quantity per Token&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Owner&lt;&#x2F;td&gt;&lt;td&gt;• Has &lt;strong&gt;Ownership Rights&lt;&#x2F;strong&gt; by default&lt;br&gt;• Delegates an account to hold &lt;strong&gt;Ownership Rights&lt;&#x2F;strong&gt; in a duration&lt;&#x2F;td&gt;&lt;td&gt;$1$&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Ownership Delegatee&lt;&#x2F;td&gt;&lt;td&gt;• Has &lt;strong&gt;Ownership Rights&lt;&#x2F;strong&gt; in a delegation duration&lt;br&gt;• Renounces before delegation expires&lt;&#x2F;td&gt;&lt;td&gt;$1$&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Ownership Manager&lt;&#x2F;td&gt;&lt;td&gt;• Is one who holds &lt;strong&gt;Ownership Rights&lt;&#x2F;strong&gt;&lt;br&gt;• If not delegated yet, it is referenced to &lt;strong&gt;Owner&lt;&#x2F;strong&gt;, otherwise it is referenced to &lt;strong&gt;Ownership Delegatee&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;$1$&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Context Roles&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;$n$&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Controller&lt;&#x2F;td&gt;&lt;td&gt;• Transfers controller&lt;br&gt;• Sets context user&lt;br&gt;• (Un)locks token transfer&lt;&#x2F;td&gt;&lt;td&gt;$1$ per context&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;User&lt;&#x2F;td&gt;&lt;td&gt;• Authorized to use token in its context&lt;&#x2F;td&gt;&lt;td&gt;$1$ per context&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;interface&quot;&gt;Interface&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;Smart contracts implementing this standard MUST implement all the functions in the &lt;code&gt;IERC7695&lt;&#x2F;code&gt; interface.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Smart contracts implementing this standard MUST implement the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; function and MUST return the constant value &lt;code&gt;true&lt;&#x2F;code&gt; if &lt;code&gt;0x486b6fba&lt;&#x2F;code&gt; is passed through the &lt;code&gt;interfaceID&lt;&#x2F;code&gt; argument.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0x486b6fba.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7695&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is IERC721, IERC165 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when a context is updated by any mechanism.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ContextUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ctxHash&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; controller&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; detachingDuration&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when a token is attached to a certain context by any mechanism.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ContextAttached&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ctxHash&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when a token is requested to detach from a certain context by any mechanism.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ContextDetachmentRequested&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ctxHash&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when a token is detached from a certain context by any mechanism.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ContextDetached&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ctxHash&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when a user is assigned to a certain context by any mechanism.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ContextUserAssigned&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ctxHash&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when a token is (un)locked in a certain context by any mechanism.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ContextLockUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ctxHash&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; locked&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when the ownership delegation is started by any mechanism.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OwnershipDelegationStarted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; delegatee&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; until&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when the ownership delegation is accepted by any mechanism.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OwnershipDelegationAccepted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; delegatee&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; until&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when the ownership delegation is stopped by any mechanism.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OwnershipDelegationStopped&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; delegatee&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Gets the longest duration the detaching can happen.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; maxDetachingDuration&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Gets controller address and detachment duration of a context.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST revert if the context is not existent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ctxHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;            A hash of context to query the controller.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; controller&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;        The address of the context controller.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; detachingDuration&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The duration must be waited for detachment in second(s).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getContext&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ctxHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; controller&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; detachingDuration&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Creates a new context.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST revert if the context is already existent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST revert if the controller address is zero address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST revert if the detaching duration is larger than max detaching duration.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST emit the event {ContextUpdated} to reflect context created and controller set.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; controller&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;        The address that controls the created context.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; detachingDuration&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The duration must be waited for detachment in second(s).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ctxMsg&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;            The message of new context to be used for hashing.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ctxHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;          Hash of the created context.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; createContext&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; controller&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; detachingDuration&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ctxMsg&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ctxHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Updates an existing context.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST revert if method caller is not the current controller.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST revert if the context is non-existent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST revert if the new controller address is zero address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST revert if the detaching duration is larger than max detaching duration.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST emit the event {ContextUpdated} on success.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ctxHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;              Hash of the context to set.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; newController&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;        The address of new controller.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; newDetachingDuration&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The new duration must be waited for detachment in second(s).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; updateContext&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ctxHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newController&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newDetachingDuration&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Queries if a token is attached to a certain context.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ctxHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Hash of a context.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT to query.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        True&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if the token is attached to the context, false if not.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isAttachedWithContext&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ctxHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Attaches a token with a certain context.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See &amp;quot;attachContext rules&amp;quot; in &amp;quot;Token (Un)lock Rules&amp;quot;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ctxHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Hash of a context.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT to be attached.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    Additional data with no specified format, MUST be sent unaltered in call to the {IERC7695ContextCallback} hook(s) on controller.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; attachContext&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ctxHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Requests to detach a token from a certain context.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See &amp;quot;requestDetachContext rules&amp;quot; in &amp;quot;Token (Un)lock Rules&amp;quot;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ctxHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Hash of a context.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT to be detached.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    Additional data with no specified format, MUST be sent unaltered in call to the {IERC7695ContextCallback} hook(s) on controller.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; requestDetachContext&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ctxHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Executes context detachment.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See &amp;quot;execDetachContext rules&amp;quot; in &amp;quot;Token (Un)lock Rules&amp;quot;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ctxHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Hash of a context.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT to be detached.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    Additional data with no specified format, MUST be sent unaltered in call to the {IERC7695ContextCallback} hook(s) on controller.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; execDetachContext&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ctxHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Finds the context user of a token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ctxHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Hash of a context.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT to be detached.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; user&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   Address of the context user.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getContextUser&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ctxHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Updates the context user of a token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST revert if the method caller is not context controller.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST revert if the context is non-existent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST revert if the token is not attached to the context.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST emit the event {ContextUserAssigned} on success.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ctxHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Hash of a context.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT to be update.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; user&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    Address of the new user.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setContextUser&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ctxHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Queries if the lock a token is locked in a certain context.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ctxHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Hash of a context.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT to be queried.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        True&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if the token context is locked, false if not.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isTokenContextLocked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ctxHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; (Un)locks a token in a certain context.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See &amp;quot;setContextLock rules&amp;quot; in &amp;quot;Token (Un)lock Rules&amp;quot;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ctxHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Hash of a context.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT to be queried.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; lock&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    New status to be (un)locked.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setContextLock&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ctxHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; lock&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Finds the ownership manager of a specified token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  The NFT to be queried.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; manager&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of delegatee.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getOwnershipManager&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; manager&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Finds the ownership delegatee of a token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST revert if there is no (or an expired) ownership delegation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    The NFT to be queried.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; delegatee&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of delegatee.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; until&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     The delegation expiry time.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getOwnershipDelegatee&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; delegatee&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; until&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Finds the pending ownership delegatee of a token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST revert if there is no (or an expired) pending ownership delegation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    The NFT to be queried.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; delegatee&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of pending delegatee.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; until&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     The delegation expiry time in the future.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; pendingOwnershipDelegatee&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; delegatee&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; until&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Starts ownership delegation and retains ownership until a specific timestamp.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Replaces the pending delegation if any.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See &amp;quot;startDelegateOwnership rules&amp;quot; in &amp;quot;Ownership Delegation Rules&amp;quot;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   The NFT to be delegated.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; delegatee&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of new delegatee.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; until&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     The delegation expiry time.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; startDelegateOwnership&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; delegatee&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; until&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Accepts ownership delegation request.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See &amp;quot;acceptOwnershipDelegation rules&amp;quot; in &amp;quot;Ownership Delegation Rules&amp;quot;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT to be accepted.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; acceptOwnershipDelegation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Stops the current ownership delegation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See &amp;quot;stopOwnershipDelegation rules&amp;quot; in &amp;quot;Ownership Delegation Rules&amp;quot;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT to be stopped.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; stopOwnershipDelegation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Enumerable extension&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The enumeration extension is OPTIONAL for this standard. This allows your contract to publish its full list of contexts and make them discoverable. When calling the &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; function MUST return the constant value &lt;code&gt;true&lt;&#x2F;code&gt; if &lt;code&gt;0xcebf44b7&lt;&#x2F;code&gt; is passed through the &lt;code&gt;interfaceID&lt;&#x2F;code&gt; argument.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0xcebf44b7.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7695Enumerable&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is IERC165 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns a created context in this contract at `index`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An index must be a value between 0 and {getContextCount}, non-inclusive.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: When using {getContext} and {getContextCount}, make sure you perform all queries on the same block.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getContext&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ctxHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the number of contexts created in the contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getContextCount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns a context attached to a token at `index`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An index must be a value between 0 and {getAttachedContextCount}, non-inclusive.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: When using {getAttachedContext} and {getAttachedContextCount}, make sure you perform all queries on the same block.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getAttachedContext&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ctxHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the number of contexts attached to the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getAttachedContextCount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Controller Interface&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The controller is RECOMMENDED to be a contract and including callback methods to allow callbacks in cases where there are any attachment or detachment requests. When calling the &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; function MUST return the constant value &lt;code&gt;true&lt;&#x2F;code&gt; if &lt;code&gt;0xad0491f1&lt;&#x2F;code&gt; is passed through the &lt;code&gt;interfaceID&lt;&#x2F;code&gt; argument.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0xad0491f1.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7695ContextCallback&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is IERC165 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This method is called once the token is attached by any mechanism.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function MAY throw to revert and reject the attachment.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ctxHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  The hash of context invoked this call.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  NFT identifier which is being attached.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address which called {attachContext} function.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     Additional data with no specified format.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onAttached&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ctxHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This method is called once the token detachment is requested by any mechanism.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ctxHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  The hash of context invoked this call.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  NFT identifier which is being requested for detachment.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address which called {requestDetachContext} function.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     Additional data with no specified format.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onDetachRequested&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ctxHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This method is called once a token context is detached by any mechanism.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ctxHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  The hash of context invoked this call.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  NFT identifier which is being detached.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; user&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     The address of the context user which is being detached.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address which called {execDetachContext} function.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     Additional data with no specified format.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onExecDetachContext&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ctxHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;ownership-delegation-rules&quot;&gt;Ownership Delegation Rules&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;startDelegateOwnership rules&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;MUST revert unless there is no delegation.&lt;&#x2F;li&gt;
&lt;li&gt;MUST revert unless the method caller is the owner, an authorized operator of owner, or the approved address for this NFT.&lt;&#x2F;li&gt;
&lt;li&gt;MUST revert unless the expiry time is in the future.&lt;&#x2F;li&gt;
&lt;li&gt;MUST revert if the delegatee address is the owner or zero address.&lt;&#x2F;li&gt;
&lt;li&gt;MUST revert if the token is not existent.&lt;&#x2F;li&gt;
&lt;li&gt;MUST emit the event &lt;code&gt;OwnershipDelegationStarted&lt;&#x2F;code&gt; on success.&lt;&#x2F;li&gt;
&lt;li&gt;After the above conditions are met, this function MUST replace the pending delegation if any.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;acceptOwnershipDelegation rules&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;MUST revert if there is no delegation.&lt;&#x2F;li&gt;
&lt;li&gt;MUST revert unless the method caller is the delegatee, or an authorized operator of delegatee.&lt;&#x2F;li&gt;
&lt;li&gt;MUST revert unless the expiry time is in the future.&lt;&#x2F;li&gt;
&lt;li&gt;MUST emit the event &lt;code&gt;OwnershipDelegationAccepted&lt;&#x2F;code&gt; on success.&lt;&#x2F;li&gt;
&lt;li&gt;After the above conditions are met, the delegatee MUST be recorded as the ownership manager until the delegation expires.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;stopDelegateOwnership rules&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;MUST revert unless the delegation is already accepted.&lt;&#x2F;li&gt;
&lt;li&gt;MUST revert unless the expiry time is in the future.&lt;&#x2F;li&gt;
&lt;li&gt;MUST revert unless the method caller is the delegatee, or an authorized operator of delegatee.&lt;&#x2F;li&gt;
&lt;li&gt;MUST emit the event &lt;code&gt;OwnershipDelegationStopped&lt;&#x2F;code&gt; on success.&lt;&#x2F;li&gt;
&lt;li&gt;After the above conditions are met, the owner MUST be recorded as the ownership manager.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;token-un-lock-rules&quot;&gt;&lt;strong&gt;Token (Un)lock Rules&lt;&#x2F;strong&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;To be more explicit about how token (un)locked, these functions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A token can be attached to a context using the &lt;code&gt;attachContext&lt;&#x2F;code&gt; method&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;setContextLock&lt;&#x2F;code&gt; function MUST be called by the controller to (un)lock&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;requestDetachContext&lt;&#x2F;code&gt; and &lt;code&gt;execDetachContext&lt;&#x2F;code&gt; functions MUST be called by the ownership manager and MUST operate with respect to the &lt;code&gt;IERC7695ContextCallback&lt;&#x2F;code&gt; hook functions&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;A list of scenarios and rules follows.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Scenarios&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Scenario#1:&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt; Context controller wants to (un)lock a token that is not requested for detachment.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;setContextLock&lt;&#x2F;code&gt; MUST be called successfully&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Scenario#2:&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt; Context controller wants to (un)lock a token that is requested for detachment.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;setContextLock&lt;&#x2F;code&gt; MUST be reverted&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Scenario#3:&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt; Ownership manager wants to (unlock and) detach a locked token and the callback controller implements &lt;code&gt;IERC7695ContextCallback&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Caller MUST:
&lt;ul&gt;
&lt;li&gt;Call &lt;code&gt;requestDetachContext&lt;&#x2F;code&gt; function successfully&lt;&#x2F;li&gt;
&lt;li&gt;Wait at least context detaching duration (see variable &lt;code&gt;detachingDuration&lt;&#x2F;code&gt; in the &lt;code&gt;getContext&lt;&#x2F;code&gt; function)&lt;&#x2F;li&gt;
&lt;li&gt;Call &lt;code&gt;execDetachContext&lt;&#x2F;code&gt; function successfully&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;requestDetachContext&lt;&#x2F;code&gt; MUST call the &lt;code&gt;onDetachRequested&lt;&#x2F;code&gt; function despite the call result&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;execDetachContext&lt;&#x2F;code&gt; MUST call the &lt;code&gt;onExecDetachContext&lt;&#x2F;code&gt; function despite the call result&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Scenario#4:&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt; Ownership manager wants to (unlock and) detach a locked token and the callback controller does not implement &lt;code&gt;IERC7695ContextCallback&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Caller MUST:
&lt;ul&gt;
&lt;li&gt;Call &lt;code&gt;requestDetachContext&lt;&#x2F;code&gt; function successfully&lt;&#x2F;li&gt;
&lt;li&gt;Wait at least context detaching duration (see variable &lt;code&gt;detachingDuration&lt;&#x2F;code&gt; in the &lt;code&gt;getContext&lt;&#x2F;code&gt; function)&lt;&#x2F;li&gt;
&lt;li&gt;Call &lt;code&gt;execDetachContext&lt;&#x2F;code&gt; function successfully&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Scenario#5:&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt; Ownership manager wants to detach an unlocked token and the callback controller implements &lt;code&gt;IERC7695ContextCallback&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Caller MUST call &lt;code&gt;requestDetachContext&lt;&#x2F;code&gt; function successfully&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;requestDetachContext&lt;&#x2F;code&gt; MUST call the &lt;code&gt;onExecDetachContext&lt;&#x2F;code&gt; function despite the result&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;execDetachContext&lt;&#x2F;code&gt; MUST NOT be called&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Scenario#6:&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt; Ownership manager wants to detach an unlocked token and the callback controller does not implement &lt;code&gt;IERC7695ContextCallback&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Caller MUST call &lt;code&gt;requestDetachContext&lt;&#x2F;code&gt; function successfully&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;execDetachContext&lt;&#x2F;code&gt; MUST NOT be called&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Rules&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;attachContext rules&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;MUST revert unless the method caller is the ownership manager, an authorized operator of ownership manager, or the approved address for this NFT (if the token is not being delegated).&lt;&#x2F;li&gt;
&lt;li&gt;MUST revert if the context is non-existent.&lt;&#x2F;li&gt;
&lt;li&gt;MUST revert if the token is already attached to the context.&lt;&#x2F;li&gt;
&lt;li&gt;MUST emit the event &lt;code&gt;ContextAttached&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;After the above conditions are met, this function MUST check if the controller address is a smart contract (e.g. code size &amp;gt; 0). If so, it MUST call &lt;code&gt;onAttached&lt;&#x2F;code&gt; and MUST revert if the call is failed.
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;data&lt;&#x2F;code&gt; argument provided by the caller MUST be passed with its contents unaltered to the &lt;code&gt;onAttached&lt;&#x2F;code&gt; hook function via its &lt;code&gt;data&lt;&#x2F;code&gt; argument.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;setContextLock rules&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;MUST revert if the context is non-existent.&lt;&#x2F;li&gt;
&lt;li&gt;MUST revert if the token is not attached to the context.&lt;&#x2F;li&gt;
&lt;li&gt;MUST revert if a detachment request has previously been made.&lt;&#x2F;li&gt;
&lt;li&gt;MUST revert if the method caller is not context controller.&lt;&#x2F;li&gt;
&lt;li&gt;MUST emit the event &lt;code&gt;ContextLockUpdated&lt;&#x2F;code&gt; on success.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;requestDetachContext rules&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;MUST revert if a detachment request has previously been made.&lt;&#x2F;li&gt;
&lt;li&gt;MUST revert unless the method caller is the context controller, the ownership manager, an authorized operator of the ownership manager, or the approved address for this NFT (if the token is not being delegated).&lt;&#x2F;li&gt;
&lt;li&gt;If the caller is context controller or the token context is not locked, MUST emit the &lt;code&gt;ContextDetached&lt;&#x2F;code&gt; event. After the above conditions are met, this function MUST check if the controller address is a smart contract (e.g. code size &amp;gt; 0). If so, it MUST call &lt;code&gt;onExecDetachContext&lt;&#x2F;code&gt; and the call result MUST be skipped.
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;data&lt;&#x2F;code&gt; argument provided by the caller MUST be passed with its contents unaltered to the &lt;code&gt;onExecDetachContext&lt;&#x2F;code&gt; hook function via its &lt;code&gt;data&lt;&#x2F;code&gt; argument.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;If the token context is locked, MUST emit the &lt;code&gt;ContextDetachRequested&lt;&#x2F;code&gt; event. After the above conditions are met, this function MUST check if the controller address is a smart contract (e.g. code size &amp;gt; 0). If so, it MUST call &lt;code&gt;onDetachRequested&lt;&#x2F;code&gt; and the call result MUST be skipped.
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;data&lt;&#x2F;code&gt; argument provided by the caller MUST be passed with its contents unaltered to the &lt;code&gt;onDetachRequested&lt;&#x2F;code&gt; hook function via its &lt;code&gt;data&lt;&#x2F;code&gt; argument.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;execDetachContext rules&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;MUST revert unless the method caller is the ownership manager, an authorized operator of ownership manager, or the approved address for this NFT (if the token is not being delegated).&lt;&#x2F;li&gt;
&lt;li&gt;MUST revert unless a detachment request has previously been made and the specified detaching duration has passed (use variable &lt;code&gt;detachingDuration&lt;&#x2F;code&gt; in the &lt;code&gt;getContext&lt;&#x2F;code&gt; function when requesting detachment).&lt;&#x2F;li&gt;
&lt;li&gt;MUST emit the &lt;code&gt;ContextDetached&lt;&#x2F;code&gt; event.&lt;&#x2F;li&gt;
&lt;li&gt;After the above conditions are met, this function MUST check if the controller address is a smart contract (e.g. code size &amp;gt; 0). If so, it MUST call &lt;code&gt;onExecDetachContext&lt;&#x2F;code&gt; and the call result MUST be skipped.
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;data&lt;&#x2F;code&gt; argument provided by the caller MUST be passed with its contents unaltered to the &lt;code&gt;onExecDetachContext&lt;&#x2F;code&gt; hook function via its &lt;code&gt;data&lt;&#x2F;code&gt; argument.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;additional-transfer-rules&quot;&gt;Additional Transfer Rules&lt;&#x2F;h3&gt;
&lt;p&gt;In addition to extending from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; for the transfer mechanism when transferring an NFT, the implementation:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;MUST revert unless the method caller is the ownership manager, an authorized operator of ownership manager, or the approved address for this NFT (if the token is not being delegated).&lt;&#x2F;li&gt;
&lt;li&gt;MUST revoke ownership delegation if any.&lt;&#x2F;li&gt;
&lt;li&gt;MUST detach every attached context:
&lt;ul&gt;
&lt;li&gt;MUST revert unless a detachment request has previously been made and the specified detaching duration has passed (use variable &lt;code&gt;detachingDuration&lt;&#x2F;code&gt; in the &lt;code&gt;getContext&lt;&#x2F;code&gt; function when requesting detachment) if the token is locked.&lt;&#x2F;li&gt;
&lt;li&gt;MUST check if the controller address is a smart contract (e.g. code size &amp;gt; 0). If so, it MUST call the &lt;code&gt;onExecDetachContext&lt;&#x2F;code&gt; function (with an empty &lt;code&gt;data&lt;&#x2F;code&gt; argument &lt;code&gt;&quot;&quot;&lt;&#x2F;code&gt;) and the call result MUST be skipped.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;When designing the proposal, we considered the following concerns.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;multiple-contexts-for-multiple-use-cases&quot;&gt;Multiple contexts for multiple use cases&lt;&#x2F;h3&gt;
&lt;p&gt;This proposal is centered around Token Context to allow for the creation of distinct contexts tailored to various decentralized applications (dApps). The context controller assumes the role of facilitating (rental or delegation) dApps, by enabling the granting of usage rights to another user without modifying the NFT&#x27;s owner record. Besides, this proposal provides the lock feature for contexts to ensure trustlessness in performing these dApps, especially staking cases.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;providing-an-unlock-mechanism-for-owners&quot;&gt;Providing an unlock mechanism for owners&lt;&#x2F;h3&gt;
&lt;p&gt;By providing an unlock mechanism for owners, this approach allows owners to unlock their tokens independently, without relying on the context controller to initiate the process. This prevents scenarios where, should the controller lose control, owners would be unable to unlock their tokens.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;attachment-and-detachment-callbacks&quot;&gt;Attachment and detachment callbacks&lt;&#x2F;h3&gt;
&lt;p&gt;The callback results of the &lt;code&gt;onDetachRequested&lt;&#x2F;code&gt; and &lt;code&gt;onExecDetachContext&lt;&#x2F;code&gt; functions in the &lt;strong&gt;Token (Un)lock Rules&lt;&#x2F;strong&gt; are skipped because we are intentionally removing the controller&#x27;s ability to stop detachment, ensuring token detachment is independent of the controller&#x27;s actions.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, to retain the permission to reject incoming attachments, the operation reverts if the call to the &lt;code&gt;onAttach&lt;&#x2F;code&gt; function fails.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;ownership-delegation&quot;&gt;Ownership delegation&lt;&#x2F;h3&gt;
&lt;p&gt;This feature provides a new approach by separating the owner and ownership. Primarily designed to facilitate delegating for third parties, it enables delegating another account as the manager of ownership, distinct from the owner.&lt;&#x2F;p&gt;
&lt;p&gt;Unlike &lt;code&gt;approve&lt;&#x2F;code&gt; or &lt;code&gt;setApprovalForAll&lt;&#x2F;code&gt; methods, which grant permission to other accounts while maintaining ownership status. Ownership delegation goes beyond simply granting permissions; it involves transferring the owner&#x27;s rights to the delegatee, with provisions for automatic reversion upon expiration. This mechanism prevents potential abuses, such as requesting mortgages and transfers to alternative accounts if the owner retains ownership rights.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;strong&gt;2-step delegation&lt;&#x2F;strong&gt; process is provided to prevent mistakes in assigning delegatees, it must be done through two steps: offer and confirm. In cases the delegation needs to be canceled before its scheduled expiry, the delegatees can invoke &lt;code&gt;stopOwnershipDelegation&lt;&#x2F;code&gt; method.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;transfer-method-mechanism&quot;&gt;Transfer method mechanism&lt;&#x2F;h3&gt;
&lt;p&gt;As part of the integration with the transfer method, we extended its implicit behavior to include token approval:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Reset Ownership Delegation:&lt;&#x2F;strong&gt; Automatically resets ownership delegations. The &lt;code&gt;OwnershipDelegationStopped&lt;&#x2F;code&gt; event is intentionally not emitted.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Detach All Contexts:&lt;&#x2F;strong&gt; Similarly, all contexts associated with the token are detached if none of them is locked. The &lt;code&gt;ContextDetached&lt;&#x2F;code&gt; event is intentionally not emitted.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;These modifications are to ensure trustlessness and gas efficiency during token transfers, providing a seamless experience for users.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal is backward compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;detaching-duration&quot;&gt;Detaching duration&lt;&#x2F;h3&gt;
&lt;p&gt;When developing this token standard to serve multiple contexts:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The contract deployer should establish an appropriate upper threshold for detachment delay (by &lt;code&gt;maxDetachingDuration&lt;&#x2F;code&gt; method).&lt;&#x2F;li&gt;
&lt;li&gt;The context owner should anticipate potential use cases and establish an appropriate period not larger than the upper threshold.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This precaution is essential to mitigate the risk of the owner abusing systems by spamming listings and transferring tokens to another owner in a short time.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;duplicated-token-usage&quot;&gt;Duplicated token usage&lt;&#x2F;h3&gt;
&lt;p&gt;When initiating a new context, the context controllers should track all other contexts within the NFT contract to prevent duplicated usage.&lt;&#x2F;p&gt;
&lt;p&gt;For example, suppose a scenario where a token is locked for rental purposes within a particular game. If that game introduces another context (e.g. supporting delegation in that game), it could lead to duplicated token usage within the game, despite being intended for different contexts.&lt;&#x2F;p&gt;
&lt;p&gt;In such cases, a shared context for rental and delegation purposes can be considered. Or there must be some restrictions on the new delegation context to prevent reusing that token in the game.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;ownership-delegation-buffer-time&quot;&gt;Ownership Delegation Buffer Time&lt;&#x2F;h3&gt;
&lt;p&gt;When constructing systems that rely on ownership delegation for product development, it is imperative to incorporate a buffer time (of at least &lt;code&gt;maxDetachingDuration&lt;&#x2F;code&gt; seconds) when requesting ownership delegation. This precaution is essential to mitigate the risk of potential abuse, particularly if one of the associated contexts locks the token until the delegation time expires.
For example, consider a scenario where a mortgage contract is built atop this standard, which has a maximum detaching duration of 7 days, while the required delegation period is only 3 days. In such cases, without an adequate buffer time, the owner could exploit the system by withdrawing funds and invoking the relevant context to lock the token, thus preventing its unlock and transfer.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;validating-callback-callers&quot;&gt;Validating Callback Callers&lt;&#x2F;h3&gt;
&lt;p&gt;To enhance security and integrity in interactions between contracts, it is essential to validate the caller of any callback function while implementing the &lt;code&gt;IERC7695ContextCallback&lt;&#x2F;code&gt;. This validation ensures that the &lt;code&gt;msg.sender&lt;&#x2F;code&gt; of the callback is indeed the expected contract address, typically the token contract or a designated controller contract. Such checks are crucial for preventing unauthorized actions that could be executed by malicious entities pretending to be a legitimate contract.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;recommended-practices&quot;&gt;Recommended practices&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;Rental&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;This is a typical use case for rentals, supposing A(owner) owns a token and wants to list his&#x2F;her token for rent, and B(user) wants to rent the token to play in a certain game.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7695&#x2F;.&#x2F;assets&#x2F;rental.svg&quot; alt=&quot;Rental Flow&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Mortgage&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;When constructing collateral systems, it is recommended to support token owners who wish to rent out their tokens while using them for collateral lending. This approach enhances the appeal of mortgage systems, creating a more attractive and versatile financial ecosystem that meets many different needs.&lt;&#x2F;p&gt;
&lt;p&gt;This is a typical use case for mortgages, supposing A(owner) owns a token and wants to mortgage, and B(lender) wants to earn interest by lending their funds to A.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7695&#x2F;.&#x2F;assets&#x2F;mortgage.svg&quot; alt=&quot;Mortgage Flow&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;risk-of-token-owner&quot;&gt;Risk of Token Owner&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;Phishing attacks&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;It is crucial to note that the owner role has the ability to delegate ownership to another account, allowing it to authorize transfers out of the respective wallet. Consequently, some malicious actors could deceive the token owner into delegating them as a delegatee by invoking the &lt;code&gt;startDelegateOwnership&lt;&#x2F;code&gt; method. This risk can be considered the same as the &lt;code&gt;approve&lt;&#x2F;code&gt; or &lt;code&gt;setApprovalForAll&lt;&#x2F;code&gt; methods.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Ownership rights loss&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;When interacting with a contract system (e.g. mortgage), where owners have to delegate their ownership rights to the smart contract, it&#x27;s imperative to:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Ensure the timeframe for delegation is reasonable and not excessively distant. If the contract mandates a delegation period that extends too far into the future, make sure it includes a provision to revoke ownership delegation when specific conditions are met. Failing to include such a provision could lead to the loss of ownership rights until the delegation expires.&lt;&#x2F;li&gt;
&lt;li&gt;Be aware that if the contract owner or their operator is compromised, the token ownership can be altered.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Distinguishable base256emoji Addresses</title>
        <published>2024-04-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>William Morriss</name><uri>https://github.com/wjmelements</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7673/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7673-distinguishable-account-addresses/19461" />
        

        <id>https://wg-eips.ritovision.com/7673/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:7673"
            label="ERC-7673" />
        

        
        

        
        <summary type="html">Depict Account Addresses As A String of Emoji</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7673/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce base256emoji for use as the primary input and display for account addresses in all user interfaces.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Human users often fail to distinguish between long strings of hexadecimal characters, especially when they match at the beginning and at the end.
This makes hexadecimal strings a poor format for human-readable account addresses.
The problem is being exploited by several spoofing strategies that mine similar addresses and spoof &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; Transfer events with the goal of tricking the end user into copying the wrong recipient address.
These address spoofing attacks have mislead tens of thousands of ether, and countless other tokens.
Spoofers flooding the network with fake Transfer events waste network resources and complicate blockchain accounting.
Improving the distinguishability of addresses will reduce the incentives for this behavior.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;User interfaces:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;SHALL depict account addresses as a base256emoji string instead of hexadecimal.&lt;&#x2F;li&gt;
&lt;li&gt;SHALL accept base256emoji strings as input for user-supplied account address parameters.&lt;&#x2F;li&gt;
&lt;li&gt;SHOULD recognize and interpret strings of exactly 20 consecutive emoji as addresses when all of them are valid base256emoji.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;base256emoji-encoding-table&quot;&gt;base256emoji encoding table&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&quot;text-align: center&quot;&gt;Emoji&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;Unicode codepoint&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;Byte Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🚀&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F680&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🪐&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1FA90&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;☄&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+2604&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;2&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🛰&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F6F0&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;3&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🌌&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F30C&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;4&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🌑&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F311&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;5&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🌒&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F312&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;6&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🌓&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F313&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;7&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🌔&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F314&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;8&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🌕&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F315&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;9&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🌖&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F316&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;10&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🌗&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F317&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;11&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🌘&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F318&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;12&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🌍&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F30D&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;13&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🌏&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F30F&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;14&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🌎&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F30E&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;15&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🐉&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F409&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;16&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;☀&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+2600&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;17&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;💻&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F4BB&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;18&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🖥&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F5A5&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;19&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;💾&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F4BE&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;20&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;💿&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F4BF&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;21&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;😂&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F602&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;22&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;❤&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+2764&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;23&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;😍&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F60D&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;24&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🤣&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F923&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;25&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;😊&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F60A&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;26&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🙏&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F64F&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;27&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;💕&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F495&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;28&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;😭&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F62D&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;29&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;😘&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F618&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;30&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;👍&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F44D&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;31&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;😅&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F605&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;32&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;👏&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F44F&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;33&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;😁&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F601&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;34&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🔥&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F525&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;35&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🥰&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F970&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;36&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;💔&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F494&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;37&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;💖&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F496&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;38&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;💙&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F499&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;39&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;😢&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F622&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;40&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🤔&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F914&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;41&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;😆&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F606&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;42&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🙄&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F644&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;43&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;💪&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F4AA&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;44&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;😉&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F609&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;45&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;☺&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+263A&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;46&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;👌&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F44C&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;47&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🤗&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F917&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;48&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;💜&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F49C&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;49&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;😔&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F614&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;50&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;😎&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F60E&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;51&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;😇&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F607&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;52&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🌹&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F339&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;53&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🤦&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F926&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;54&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🎉&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F389&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;55&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;💞&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F49E&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;56&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;✌&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+270C&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;57&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;✨&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+2728&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;58&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🤷&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F937&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;59&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;😱&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F631&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;60&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;😌&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F60C&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;61&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🌸&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F338&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;62&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🙌&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F64C&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;63&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;😋&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F60B&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;64&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;💗&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F497&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;65&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;💚&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F49A&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;66&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;😏&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F60F&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;67&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;💛&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F49B&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;68&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🙂&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F642&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;69&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;💓&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F493&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;70&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🤩&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F929&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;71&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;😄&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F604&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;72&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;😀&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F600&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;73&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🖤&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F5A4&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;74&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;😃&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F603&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;75&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;💯&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F4AF&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;76&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🙈&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F648&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;77&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;👇&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F447&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;78&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🎶&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F3B6&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;79&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;😒&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F612&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;80&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🤭&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F92D&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;81&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;❣&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+2763&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;82&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;😜&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F61C&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;83&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;💋&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F48B&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;84&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;👀&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F440&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;85&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;😪&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F62A&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;86&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;😑&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F611&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;87&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;💥&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F4A5&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;88&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🙋&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F64B&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;89&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;😞&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F61E&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;90&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;😩&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F629&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;91&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;😡&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F621&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;92&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🤪&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F92A&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;93&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;👊&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F44A&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;94&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🥳&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F973&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;95&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;😥&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F625&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;96&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🤤&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F924&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;97&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;👉&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F449&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;98&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;💃&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F483&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;99&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;😳&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F633&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;100&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;✋&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+270B&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;101&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;😚&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F61A&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;102&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;😝&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F61D&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;103&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;😴&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F634&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;104&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🌟&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F31F&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;105&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;😬&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F62C&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;106&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🙃&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F643&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;107&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🍀&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F340&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;108&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🌷&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F337&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;109&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;😻&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F63B&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;110&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;😓&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F613&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;111&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;⭐&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+2B50&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;112&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;✅&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+2705&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;113&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🥺&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F97A&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;114&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🌈&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F308&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;115&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;😈&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F608&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;116&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🤘&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F918&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;117&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;💦&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F4A6&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;118&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;✔&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+2714&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;119&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;😣&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F623&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;120&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🏃&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F3C3&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;121&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;💐&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F490&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;122&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;☹&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+2639&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;123&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🎊&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F38A&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;124&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;💘&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F498&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;125&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;😠&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F620&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;126&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;☝&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+261D&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;127&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;😕&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F615&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;128&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🌺&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F33A&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;129&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🎂&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F382&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;130&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🌻&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F33B&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;131&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;😐&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F610&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;132&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🖕&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F595&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;133&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;💝&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F49D&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;134&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🙊&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F64A&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;135&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;😹&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F639&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;136&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🗣&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F5E3&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;137&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;💫&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F4AB&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;138&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;💀&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F480&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;139&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;👑&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F451&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;140&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🎵&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F3B5&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;141&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🤞&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F91E&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;142&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;😛&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F61B&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;143&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🔴&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F534&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;144&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;😤&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F624&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;145&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🌼&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F33C&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;146&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;😫&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F62B&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;147&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;⚽&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+26BD&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;148&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🤙&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F919&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;149&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;☕&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+2615&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;150&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🏆&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F3C6&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;151&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🤫&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F92B&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;152&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;👈&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F448&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;153&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;😮&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F62E&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;154&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🙆&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F646&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;155&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🍻&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F37B&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;156&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🍃&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F343&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;157&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🐶&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F436&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;158&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;💁&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F481&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;159&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;😲&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F632&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;160&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🌿&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F33F&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;161&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🧡&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F9E1&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;162&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🎁&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F381&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;163&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;⚡&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+26A1&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;164&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🌞&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F31E&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;165&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🎈&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F388&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;166&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;❌&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+274C&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;167&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;✊&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+270A&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;168&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;👋&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F44B&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;169&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;😰&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F630&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;170&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🤨&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F928&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;171&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;😶&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F636&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;172&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🤝&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F91D&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;173&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🚶&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F6B6&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;174&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;💰&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F4B0&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;175&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🍓&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F353&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;176&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;💢&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F4A2&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;177&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🤟&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F91F&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;178&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🙁&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F641&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;179&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🚨&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F6A8&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;180&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;💨&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F4A8&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;181&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🤬&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F92C&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;182&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;✈&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+2708&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;183&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🎀&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F380&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;184&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🍺&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F37A&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;185&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🤓&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F913&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;186&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;😙&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F619&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;187&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;💟&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F49F&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;188&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🌱&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F331&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;189&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;😖&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F616&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;190&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;👶&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F476&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;191&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🥴&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F974&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;192&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;▶&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+25B6&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;193&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;➡&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+27A1&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;194&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;❓&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+2753&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;195&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;💎&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F48E&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;196&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;💸&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F4B8&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;197&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;⬇&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+2B07&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;198&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;😨&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F628&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;199&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🌚&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F31A&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;200&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🦋&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F98B&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;201&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;😷&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F637&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;202&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🕺&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F57A&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;203&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;⚠&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+26A0&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;204&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🙅&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F645&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;205&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;😟&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F61F&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;206&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;😵&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F635&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;207&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;👎&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F44E&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;208&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🤲&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F932&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;209&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🤠&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F920&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;210&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🤧&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F927&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;211&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;📌&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F4CC&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;212&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🔵&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F535&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;213&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;💅&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F485&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;214&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🧐&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F9D0&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;215&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🐾&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F43E&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;216&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🍒&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F352&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;217&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;😗&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F617&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;218&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🤑&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F911&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;219&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🌊&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F30A&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;220&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🤯&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F92F&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;221&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🐷&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F437&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;222&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;☎&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+260E&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;223&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;💧&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F4A7&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;224&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;😯&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F62F&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;225&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;💆&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F486&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;226&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;👆&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F446&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;227&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🎤&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F3A4&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;228&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🙇&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F647&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;229&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🍑&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F351&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;230&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;❄&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+2744&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;231&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🌴&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F334&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;232&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;💣&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F4A3&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;233&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🐸&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F438&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;234&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;💌&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F48C&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;235&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;📍&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F4CD&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;236&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🥀&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F940&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;237&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🤢&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F922&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;238&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;👅&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F445&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;239&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;💡&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F4A1&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;240&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;💩&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F4A9&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;241&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;👐&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F450&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;242&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;📸&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F4F8&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;243&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;👻&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F47B&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;244&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🤐&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F910&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;245&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🤮&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F92E&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;246&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🎼&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F3BC&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;247&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🥵&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F975&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;248&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🚩&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F6A9&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;249&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🍎&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F34E&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;250&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🍊&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F34A&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;251&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;👼&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F47C&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;252&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;💍&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F48D&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;253&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;📣&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F4E3&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;254&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🥂&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;U+1F942&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;255&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Previous attempts to reduce spoofing and other copy errors such as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;55&#x2F;&quot;&gt;ERC-55&lt;&#x2F;a&gt; have not reduced the number of characters in an address.
Any base-256 standard would achieve this goal but emoji were chosen to maximize human-distinguishability.
Multiple base-256 emoji encodings have been proposed.
The base256emoji encoding was chosen due to its acceptance into the multibase repository.&lt;&#x2F;p&gt;
&lt;p&gt;This standard does not also recommend base256emoji for use in depicting other bytestrings such as transaction hashes and calldata.
Transaction hashes are not yet being spoofed.
Calldata is best decoded via the appropriate ABI.
By only using base256emoji for addresses, addresses can be easily noticed among other information.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Using the encoding table, the base256emoji encoding can be transcoded into hexadecimal and vice-versa.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&quot;text-align: center&quot;&gt;base256emoji&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;ERC-55&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🚀🚀🚀🚀🚀🚀😀💓🥴💣👻🙌🙈🤢😥☹🌏💩🍎💕&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;0x0000000000004946c0e9F43F4Dee607b0eF1fA1c&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🚀🚀🚀🚀🚀🚀💸🎊💡🌿🚩🔥📌🙂💙❄🛰💩🤝⭐&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;0x000000000000c57CF0A1f923d44527e703F1ad70&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;☀☀☀☀☀❤🌊🌖❌💀✔🌎🎈❌💞🛰💗😅❓☄&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;0x111111111117dC0aa78b770fA6A738034120C302&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;👍🤫😋✊🤪😞🤐👶😭❤👉🚩💔🌱🤝🌊💚🪐🚩😐&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;😆🌎✅✨👋😜💛☺😶👋🐸🤩🌔🙌✋🤤⭐🍑☹⚡&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;0x2a0f713aA953442EacA9EA47083f656170e67BA4&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🔥🤬🌔😝😞🙄👌💢🗣🌍✨😙🐾😡😑🤘💸😂😤🔵&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;0x23B608675a2B2fB1890d3ABBd85c5775c51691d5&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🗣😅😞✨🤷😆🌟🐷🌷👶☝🪐🥀🖥🤟🐉💀💪😏❄&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;0x89205A3A3b2A69De6Dbf7f01ED13B2108B2c43e7&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;🥴😆😰✌🤟🔥📣🎵🌖🌏😡🎶💙🐸🍒🌔😱🤘🍀➡&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;▶🌻😥👏💘😛💐💨❄💸😂😪😝🤤🐸💻😟☝🍃🥺&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;0xC18360217D8F7Ab5e7c516566761Ea12Ce7F9D72&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;to_emoji&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🚀&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🪐&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;☄&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🛰&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🌌&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🌑&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🌒&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🌓&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🌔&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🌕&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🌖&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🌗&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🌘&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🌍&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🌏&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🌎&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🐉&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;☀&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;💻&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🖥&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;💾&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;💿&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;😂&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;❤&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;😍&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🤣&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;😊&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🙏&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;💕&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;😭&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;😘&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;👍&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;😅&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;👏&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;😁&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🔥&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🥰&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;💔&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;💖&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;💙&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;😢&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🤔&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;😆&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🙄&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;💪&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;😉&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;☺&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;👌&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🤗&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;💜&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;😔&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;😎&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;😇&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🌹&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🤦&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🎉&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;💞&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;✌&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;✨&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🤷&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;😱&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;😌&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🌸&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🙌&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;😋&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;💗&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;💚&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;😏&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;💛&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🙂&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;💓&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🤩&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;😄&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;😀&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🖤&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;😃&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;💯&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🙈&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;👇&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🎶&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;😒&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🤭&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;❣&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;😜&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;💋&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;👀&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;😪&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;😑&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;💥&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🙋&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;😞&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;😩&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;😡&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🤪&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;👊&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🥳&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;😥&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🤤&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;👉&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;💃&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;😳&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;✋&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;😚&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;😝&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;😴&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🌟&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;😬&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🙃&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🍀&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🌷&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;😻&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;😓&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;⭐&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;✅&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🥺&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🌈&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;😈&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🤘&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;💦&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;✔&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;😣&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🏃&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;💐&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;☹&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🎊&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;💘&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;😠&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;☝&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;😕&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🌺&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🎂&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🌻&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;😐&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🖕&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;💝&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🙊&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;😹&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🗣&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;💫&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;💀&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;👑&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🎵&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🤞&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;😛&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🔴&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;😤&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🌼&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;😫&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;⚽&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🤙&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;☕&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🏆&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🤫&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;👈&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;😮&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🙆&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🍻&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🍃&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🐶&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;💁&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;😲&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🌿&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🧡&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🎁&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;⚡&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🌞&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🎈&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;❌&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;✊&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;👋&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;😰&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🤨&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;😶&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🤝&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🚶&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;💰&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🍓&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;💢&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🤟&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🙁&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🚨&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;💨&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🤬&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;✈&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🎀&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🍺&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🤓&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;😙&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;💟&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🌱&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;😖&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;👶&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🥴&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;▶&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;➡&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;❓&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;💎&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;💸&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;⬇&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;😨&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🌚&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🦋&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;😷&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🕺&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;⚠&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🙅&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;😟&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;😵&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;👎&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🤲&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🤠&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🤧&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;📌&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🔵&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;💅&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🧐&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🐾&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🍒&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;😗&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🤑&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🌊&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🤯&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🐷&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;☎&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;💧&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;😯&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;💆&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;👆&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🎤&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🙇&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🍑&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;❄&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🌴&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;💣&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🐸&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;💌&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;📍&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🥀&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🤢&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;👅&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;💡&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;💩&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;👐&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;📸&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;👻&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🤐&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🤮&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🎼&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🥵&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🚩&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🍎&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🍊&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;👼&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;💍&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;📣&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🥂&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;from_emoji&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt;emoji&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;{0&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;:02x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;format&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; emoji&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; enumerate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;to_emoji&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; encode_address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;hexadecimal_address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;hexadecimal_address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 42&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; or&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; hexadecimal_address&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;startswith&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;join&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;to_emoji&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;hexadecimal_address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 16&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 42&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; decode_address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;emoji_address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; In python, these unicode characters all have a len() of 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;emoji_address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 20&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    try&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;join&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;from_emoji&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;emoji&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; emoji&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; emoji_address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    except&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; IndexError&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;With the base256emoji encoding, addresses use half as many characters.
The characters used are more distinguishable.
This squares the difficulty of generating similar addresses, making address spoofing impractical.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EVM-ify the identity precompile</title>
        <published>2024-03-31T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7666/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7561-evm-ify-the-identity-precompile/19445" />
        

        <id>https://wg-eips.ritovision.com/7666/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7666"
            label="EIP-7666" />
        

        
        

        
        <summary type="html">Remove the identity precompile, and put into place a piece of EVM code that has equivalent functionality</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7666/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Remove the identity precompile at 0x04. At the start of executing the block in which this change activates, put into that contract a short piece of EVM code that has the same functionality.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Ethereum today has a large number of precompiles. Nearly half of these precompiles are not seeing significant use, and are contributing to ongoing maintenance cost and risk of consensus bugs, as well as increased development effort for new Ethereum client implementations, including ZK-EVMs and implementations in formal-verification-friendly languages.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP proposes a path for the Ethereum ecosystem to gracefully abandon these precompiles, and takes a first step by applying this procedure to the simplest precompile of all: the identity precompile (which outputs returndata equal to the input calldata). The identity precompile was originally introduced because memory copying is a common operation, and there was no opcode available to do it directly. Since then, norms around what is acceptable for an opcode have changed, and we have introduced the MCOPY opcode with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5656&#x2F;&quot;&gt;EIP-5656&lt;&#x2F;a&gt;. And so we can remove the identity precompile, and replace it with an ultra-minimal piece of EVM code that replicates its functionality.&lt;&#x2F;p&gt;
&lt;p&gt;In the future, this technique can be applied to other more complex precompiles, such as little-used hash functions and MODEXP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;IDENTITY_PRECOMPILE_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x0000....0004&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;EVM_CODE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x365f5f37365ff3&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;At the start of the block in which this fork activates, set the code of &lt;code&gt;IDENTITY_PRECOMPILE_ADDRESS&lt;&#x2F;code&gt; to &lt;code&gt;EVM_CODE&lt;&#x2F;code&gt;. Starting from and including that block, &lt;code&gt;IDENTITY_PRECOMPILE_ADDRESS&lt;&#x2F;code&gt; should no longer be treated as a precompile.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The given &lt;code&gt;EVM_CODE&lt;&#x2F;code&gt; corresponds to&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CALLDATASIZE PUSH0 PUSH0 CALLDATACOPY CALLDATASIZE PUSH0 RETURN&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Which copies calldata into memory, and then returns the same memory slice. This is thus a minimally disruptive change to Ethereum that preserves functionality, and accomplishes the goal of reducing the number of precompiles by 1.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The functionality of the given &lt;code&gt;EVM_CODE&lt;&#x2F;code&gt; is the same as the identity precompile. Gas costs are slightly different, though gas repricings have been done in the Ethereum ecosystem several times before and their effects are well understood.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;As no new functionality is introduced or made cheaper, no security concerns are raised.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Raise gas costs of hash functions</title>
        <published>2024-03-31T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7667/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7562-raise-gas-costs-of-hash-functions/19446" />
        

        <id>https://wg-eips.ritovision.com/7667/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7667"
            label="EIP-7667" />
        

        
        

        
        <summary type="html">Raise the gas costs of hash function opcodes and precompiles, to match prover expenses in ZK-EVMs</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7667/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Raise the gas costs of opcodes and precompiles that involve hash functions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Gas costs for hash function opcodes and precompiles were originally set based on the time that it takes to execute them on a regular CPU. Since then, however, there has emerged another equally important execution substrate that the EVM is executed on: zero knowledge proof (ZK-SNARK) systems. By that standard, these opcodes and precompiles are &lt;em&gt;very&lt;&#x2F;em&gt; underpriced relative to other operations.&lt;&#x2F;p&gt;
&lt;p&gt;Blocks that are heavy with hash function executions take much longer to ZK-SNARK prove than average blocks. Today, many layer-2 protocols are using workarounds such as arbitrary limits and rules enforced by centralized sequencers to deal with this issue. These workarounds are often poorly designed and lead to unneeded security and centralization concerns.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, there is a design goal of eventually using ZK-SNARKs to prove the correctness of layer-1 Ethereum blocks. To do this, we need to establish very tight bounds on how long it takes to generate a ZK-SNARK proof of an Ethereum execution block&#x27;s correctness. Today, the difference between average-case proving time and worst-case proving time is large, and hash function executions are the largest reason why.&lt;&#x2F;p&gt;
&lt;p&gt;Verkle trees solve the part of this problem that comes from Keccak hashing in the Merkle Patricia tree. Today, the theoretical worst case is a block with &lt;code&gt;30000000 &#x2F; 2600 = 11538&lt;&#x2F;code&gt; account accesses (minus a small percent for EVM overhead), where proving each access would require proving &lt;code&gt;24000&lt;&#x2F;code&gt; bytes of code, plus a roughly &lt;code&gt;512 * log(500m) &#x2F; log(16) = 3712&lt;&#x2F;code&gt; byte Merkle-Patricia proof: roughly &lt;code&gt;305 MB&lt;&#x2F;code&gt; of hashing spread between &lt;code&gt;83650&lt;&#x2F;code&gt; hash calls. Verkle trees solve this. However, using opcodes, a block execution can still require roughly the following amount of hashing:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Hash&lt;&#x2F;th&gt;&lt;th&gt;Cost per word&lt;&#x2F;th&gt;&lt;th&gt;Maximum bytes from 30 million gas&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;KECCAK&lt;&#x2F;code&gt; (opcode)&lt;&#x2F;td&gt;&lt;td&gt;6&lt;&#x2F;td&gt;&lt;td&gt;160 million&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SHA256&lt;&#x2F;code&gt; (precompile)&lt;&#x2F;td&gt;&lt;td&gt;12&lt;&#x2F;td&gt;&lt;td&gt;80 million&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;RIPEMD&lt;&#x2F;code&gt; (precompile)&lt;&#x2F;td&gt;&lt;td&gt;120&lt;&#x2F;td&gt;&lt;td&gt;8 million&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;BLAKE2&lt;&#x2F;code&gt; (precompile)&lt;&#x2F;td&gt;&lt;td&gt;3 (12 per 128 bytes)&lt;&#x2F;td&gt;&lt;td&gt;320 million&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;LOG*&lt;&#x2F;code&gt; (hashing data)&lt;&#x2F;td&gt;&lt;td&gt;256 (8 per byte)&lt;&#x2F;td&gt;&lt;td&gt;3.75 million&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;These hash functions have been optimized for rapid CPU computation, so CPUs can compute them quickly: for example, this author&#x27;s laptop can compute a 160-million byte keccak in less than half a second. In ZK-SNARKs, however, these operations are &lt;em&gt;very&lt;&#x2F;em&gt; time-consuming and inefficient. This is mitigated in newer proof systems based on small fields, but hashes remain underpriced.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Previous value&lt;&#x2F;th&gt;&lt;th&gt;New value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;KECCAK_BASE_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;30&lt;&#x2F;td&gt;&lt;td&gt;300&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;KECCAK_WORD_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;6&lt;&#x2F;td&gt;&lt;td&gt;60&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SHA256_BASE_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;60&lt;&#x2F;td&gt;&lt;td&gt;300&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SHA256_WORD_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;12&lt;&#x2F;td&gt;&lt;td&gt;60&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;RIPEMD_BASE_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;600&lt;&#x2F;td&gt;&lt;td&gt;600&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;RIPEMD_WORD_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;120&lt;&#x2F;td&gt;&lt;td&gt;120&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;BLAKE2_GFROUND&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;10&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;GLOGBYTE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;8&lt;&#x2F;td&gt;&lt;td&gt;10&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Change the above parameters to their new values.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The above increases the gas costs of all opcodes and precompiles that can be used to require large amounts of hashing in the EVM. All hashing costs are increased to 300 per hash plus 60 per word (or kept the same if they are already higher than this).
&#x27;&quot;
A possible alternative to this approach is to implement either multidimensional gas pricing (ie. a separate floating basefee and per-block target and limit for hashes) or a &quot;total gas cost floor&quot; similar to what &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7623&#x2F;&quot;&gt;EIP-7623&lt;&#x2F;a&gt; does for calldata. However, this approach is much harder to implement for in-EVM gas costs such as hashes than it is for calldata and blobs, because EVM gas limits are set not just by users, for whom new transaction types that specify newly required limits, max-basefees and priority fees can easily be added, but also by contracts making sub-calls to other contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;For most applications, a reasonable upper bound is that data that is getting hashed in the EVM is getting brought in as calldata. If the hashing being done is binary Merkle proof verification, every 32 bytes of data corresponds to a 64-byte (2-word) hash. A word of costs 512 gas. Under the new costs, the hashing per word in that situation would be &lt;code&gt;300 + 60 * 2 = 420&lt;&#x2F;code&gt; gas. Hence, this will increase gas consumption for that component of the application by less than 2x.&lt;&#x2F;p&gt;
&lt;p&gt;Concretely, a length-20 Keccak-based binary Merkle proof gas cost would increase from &lt;code&gt;(512 + 42) * 20 = 11080&lt;&#x2F;code&gt; to &lt;code&gt;(512 + 420) * 20 = 18640&lt;&#x2F;code&gt;. This is a small increase, especially taking into account other costs associated with such an application.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;As no new operations are introduced or made cheaper, no security concerns were raised.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Remove bloom filters</title>
        <published>2024-03-31T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7668/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7653-remove-bloom-filters/19447" />
        

        <id>https://wg-eips.ritovision.com/7668/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:7668"
            label="EIP-7668" />
        

        
        

        
        <summary type="html">Remove bloom filters from the execution block</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7668/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Require the bloom filters in an execution block, including at the top level and in the receipt object, to be empty.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Logs were originally introduced to give applications a way to record information about onchain events, which decentralized applications (dapps) would be able to easily query. Using bloom filters, dapps would be able to quickly go through the history, identify the few blocks that contained logs relative to their application, and then quickly identify which individual transactions have the logs that they need.&lt;&#x2F;p&gt;
&lt;p&gt;In practice, this mechanism is far too slow. Almost all dapps that access history end up doing so not through RPC calls to an Ethereum node (even a remote-hosted one), but through centralized extra-protocol services.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP proposes recognizing that reality, and removing bloom filters from the protocol. Applications that need history querying would be encouraged to develop and use decentralized protocols that create provable log indexes using eg. ZK-SNARKs and incrementally-verifiable computation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The logs bloom of an execution block is now required to be empty (ie. 0 bytes long). The logs bloom of a transaction receipt is now required to be empty (ie. 0 bytes long).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This is a minimally disruptive way to remove the need to handle blooms from clients. A future EIP can later clean up by removing this field entirely, along with other fields that have been deprecated.&lt;&#x2F;p&gt;
&lt;p&gt;Gas costs of LOG are not reduced, because while the externality of polluting the bloom filter no longer needs to be accounted for, the costs of hashing have increased due to the needs of ZK-SNARK EVM implementations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Applications that depend on bloom filters to read events will cease to work. Very few applications depend on this feature today, because at current gas limits the false positive rate is so high and processing the logs in a long history query is so slow, especially for light clients (whom this feature was primarily intended to benefit).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;As no new features are introduced or made cheaper, no security concerns are raised.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Access-Key opcode</title>
        <published>2024-03-27T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Diederik Loerakker</name><uri>https://github.com/protolambda</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7664/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/access-key-opcode/19395" />
        

        <id>https://wg-eips.ritovision.com/7664/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        

        
        <category
            term="tag:eip:7664"
            label="EIP-7664" />
        

        
        

        
        <summary type="html">The access-key opcode enables contracts to read inputs that are statically declared in access-lists.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7664/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a new opcode to inspect the access-list keys of the executing address.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP serves as a substitute of top-level-call detection to enable a smart-contract to
enforce static declaration of attributes.&lt;&#x2F;p&gt;
&lt;p&gt;Previously, application-layer contracts, against common advice from account-abstraction proponents, used to rely
on the &lt;code&gt;tx.origin&lt;&#x2F;code&gt; to enforce a top-level call, such that the contract inputs are encoded as transaction input.&lt;&#x2F;p&gt;
&lt;p&gt;While the access-list of transactions directly affects the execution, it only affects the gas-costs.
This EIP enhances the access-list feature to provide the property of statically-defined contract-inputs,
without relying on top-level calls, the &lt;code&gt;tx.origin&lt;&#x2F;code&gt; behavior, or gas introspection.&lt;&#x2F;p&gt;
&lt;p&gt;This enables smart contracts to reliably enforce static declaration of inputs.&lt;&#x2F;p&gt;
&lt;p&gt;This is a step towards fulfilling the purposes as described in the Motivation of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Introduces the access list format and the logic for handling the format.
This logic can later be repurposed for many other purposes, including block-wide witnesses,
use in ReGenesis, moving toward static state access over time, and more.&quot;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ACCESS_KEY_OPCODE_GAS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;3&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ACCESS_KEY_OPCODE_BYTE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x4B&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;opcode&quot;&gt;Opcode&lt;&#x2F;h3&gt;
&lt;p&gt;We add an instruction &lt;code&gt;ACCESS_KEY&lt;&#x2F;code&gt; (with opcode &lt;code&gt;ACCESS_KEY_OPCODE_BYTE&lt;&#x2F;code&gt;) which pops &lt;code&gt;index&lt;&#x2F;code&gt; from the top
of the stack as big-endian &lt;code&gt;uint256&lt;&#x2F;code&gt;, and pushes &lt;code&gt;tx.access_list[address][index]&lt;&#x2F;code&gt; back on the stack,
if &lt;code&gt;address&lt;&#x2F;code&gt; is present in the &lt;code&gt;tx.access_list&lt;&#x2F;code&gt; and &lt;code&gt;index &amp;lt; len(tx.access_list[address])&lt;&#x2F;code&gt;,
and otherwise pushes a zeroed &lt;code&gt;bytes32&lt;&#x2F;code&gt; value.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-costs&quot;&gt;Gas costs&lt;&#x2F;h3&gt;
&lt;p&gt;The opcode has a fixed gas cost of &lt;code&gt;ACCESS_KEY_OPCODE_GAS&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The intrinsic gas costs of the access-list contents of the transaction itself do not change.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;static-analysis-of-transactions&quot;&gt;Static analysis of transactions&lt;&#x2F;h3&gt;
&lt;p&gt;Static declaration of contract-inputs enables advanced layer-two constructions and block-building techniques:
data is available without EVM introspection, and contracts can reliably tell if the executing transaction
declared critical properties to the block builder and verifying nodes.&lt;&#x2F;p&gt;
&lt;p&gt;Static-declaration of contract inputs is now independent of account-abstraction related changes,
such as transaction bundlers, as well as in-protocol with 3074.&lt;&#x2F;p&gt;
&lt;!-- EIP link&#x2F;requires omitted due to Walidator EIP status bug --&gt;
&lt;h3 id=&quot;global-read-only-values&quot;&gt;Global read-only values&lt;&#x2F;h3&gt;
&lt;p&gt;Akin to &lt;code&gt;TLOAD&lt;&#x2F;code&gt;, as described in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1153&#x2F;&quot;&gt;EIP-1153&lt;&#x2F;a&gt;,
the &lt;code&gt;ACCESS_KEY&lt;&#x2F;code&gt; opcode provides contracts with a view that is global
to the message-execution of the transaction in the EVM.&lt;&#x2F;p&gt;
&lt;p&gt;However, with &lt;code&gt;ACCESS_KEY&lt;&#x2F;code&gt; it is guaranteed to be read-only, and cannot change during the execution of a transaction.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;access-list-utility&quot;&gt;Access-list utility&lt;&#x2F;h3&gt;
&lt;p&gt;Access-lists are under-utilized today:
very few users utilize this to warm-up storage interactions for reduced gas costs.
Generally the gas cost savings achieved with EIP-2930 are not applicable in as many use-cases.&lt;&#x2F;p&gt;
&lt;p&gt;With this EIP, the utility of the access-list functionality increases,
without requiring additional resources from the EVM.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;witness-data&quot;&gt;Witness data&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP supports the transformation of applications to reduce statefulness,
by supporting read-only application state to be provided to contracts without
requiring the contract caller to support forwarding of data.&lt;&#x2F;p&gt;
&lt;p&gt;The access-list contents may contain witness-data, which the contract can verify and utilize statelessness.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-costs-1&quot;&gt;Gas costs&lt;&#x2F;h3&gt;
&lt;p&gt;The gas cost of &lt;code&gt;ACCESS_KEY_OPCODE_GAS&lt;&#x2F;code&gt; gas matches that of similar operations,
specifically the &lt;code&gt;BLOBHASH&lt;&#x2F;code&gt; opcode of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt;:
this opcode also pop an index-like EVM word from the stack,
and pushes a full 32 byte EVM word back on the stack, based on a list of hashes embedded in the transaction.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;BLOBHASH&lt;&#x2F;code&gt; functionality of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt; is not re-usable for the purposes of this EIP however,
as the intention is to have access to just the statically declared hash, and not the cost of a blob.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;naming-of-access-key&quot;&gt;Naming of &lt;code&gt;ACCESS_KEY&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Access-lists currently only support a list of access-keys.
The list is not enforced to be sorted, and thus supports indexed lookups.&lt;&#x2F;p&gt;
&lt;p&gt;This is not a &lt;code&gt;LOAD&lt;&#x2F;code&gt; opcode, as &lt;code&gt;SLOAD&lt;&#x2F;code&gt; or &lt;code&gt;TLOAD&lt;&#x2F;code&gt; are, since the opcode returns a key.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;no-transaction-type-changes&quot;&gt;No transaction-type changes&lt;&#x2F;h3&gt;
&lt;p&gt;This enhancement of access-lists utility does not affect the access-list encoding,
or the existing transaction types that support access-lists.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;minimal-impact-on-evm-transaction-context&quot;&gt;Minimal impact on EVM transaction-context&lt;&#x2F;h3&gt;
&lt;p&gt;With EIP-2930, the access-list contents are already readily available in the transaction-context during EVM execution,
and the RPC methods that trigger said execution.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP thus does not require significant changes to the construction of the EVM context,
nor any changes to RPC methods.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;The block fee-recipient, and any other warmed-up attributes not declared statically in the transaction access-list,
must not be considered to be part of the access-list.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The access-list attributes are already gas-metered in EIP-2930,
and readily accessible in the EVM to determine storage gas-costs. In terms of denial-of-service risks,
this EIP introduces no new significant data or data-processing costs.&lt;&#x2F;p&gt;
&lt;p&gt;The access-list is read-only, and thus forms a minimal risk to application-developers.&lt;&#x2F;p&gt;
&lt;p&gt;The access is scoped strictly to the contract that would otherwise perform a warm &lt;code&gt;SLOAD&lt;&#x2F;code&gt;,
and thus storage-layout abstractions do not leak between different smart contract applications.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>AI Agent NFTs</title>
        <published>2024-03-26T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Greg Marlin</name><uri>https://github.com/marleymarl</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7662/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7662-ai-agent-nfts/19371" />
        

        <id>https://wg-eips.ritovision.com/7662/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7662"
            label="ERC-7662" />
        

        
        

        
        <summary type="html">A specification for NFTs that represent AI Agents.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7662/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal introduces a standard for AI agent NFTs. When AI Agents are created and traded as NFTs, it doesn&#x27;t make sense to put the prompts in the token metadata, therefore it requires a standard custom struct. It also doesn&#x27;t make sense to store the prompts directly onchain as they can be quite large, therefore this standard proposes they be stored as decentralized storage URLs. This standard also proposes two options on how this data should be made private to the owner of the NFT, with the favored implementation option being encrypting the data using custom contract parameters for decryption that decrypt only to the owner of the NFT.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The creation and trading of AI Agent NFTs are a natural fit and offer the potential for an entirely new onchain market. This requires some custom data to be embedded in the NFT through a custom struct and this needs to be standardized so that any marketplace or AI Agent management product, among others, know how to create and parse AI Agent NFTs.  The goal of this standard is to provide a new utility for NFTs in the field of AI and also to provide new liquidity, through the NFT market, for AI Agents. If widely adopted by marketplaces, and infrastructure and no-code providers this should open up a new market and community for AI Agent creators in different fields, AI Agent consumers and NFT marketplaces.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;All ERC-XXXX compliant contracts MUST implement the standard &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; functionality for minting and transferring NFTs, and MUST additionally implement this standard&#x27;s Agent interface&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7662&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC721&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getAgentData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; description&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; model&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; userPromptURI&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; systemPromptURI&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; promptsEncrypted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AgentUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;and MUST implement the mapping between NFT Token ID and its Agent information.&lt;&#x2F;p&gt;
&lt;p&gt;It is RECOMMENDED that this mapping is public and that the URIs for User Prompt and System Prompt are made private through encryption with decryption logic set to the holder of the NFT via custom contract parameters set during encryption, and the method or platform used to provide this encryption SHOULD be retrievable as a data property of the NFT in order that platforms that should facilitate the use of these NFTs can set up a predictable way to handle this decryption, depending on the platform or method used.&lt;&#x2F;p&gt;
&lt;p&gt;It is conceivable to also create an implementation whereby this mapping was set to private and accessed through a custom function that restricted access to the holder of the NFT. This approach would explose the prompts through their urls though, therefore the RECOMMENDED approach is a public mapping and encryption on the URLs. This also has the benefit of publicly exposing the data in the Agent struct to verify name, description and model and that encrypted URIs for the User Prompt and System Prompt exist.&lt;&#x2F;p&gt;
&lt;p&gt;All ERC-XXXX compliant contracts MUST implement a function to mint new Agent tokens. This function SHOULD:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Accept parameters for all Agent properties (name, description, model, userPromptURI, systemPromptURI, etc.)&lt;&#x2F;li&gt;
&lt;li&gt;Mint a new token to the specified recipient&lt;&#x2F;li&gt;
&lt;li&gt;Associate the provided Agent properties with the newly minted token&lt;&#x2F;li&gt;
&lt;li&gt;Emit an event signaling the creation of a new Agent token&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;It is RECOMMENDED that ERC-XXXX compliant contracts provide functionality to encrypt the user prompt and system prompt. This functionality SHOULD:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Allow only the token owner to encrypt the prompts&lt;&#x2F;li&gt;
&lt;li&gt;Update the userPromptURI and systemPromptURI with encrypted versions&lt;&#x2F;li&gt;
&lt;li&gt;Set a flag indicating that the prompts are encrypted&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;It is RECOMMENDED to implement the following event:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AgentCreated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; description&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; model&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This event SHOULD be emitted when a new Agent token is minted, providing key information about the newly created Agent.&lt;&#x2F;p&gt;
&lt;p&gt;To enable dynamic variables being injected into the User Prompt before being run, any such variables MUST be surrounded with ${} e.g. ${dynamicVariableName} in order that they can be recognized and handled appropriately by programs and systems that will enabled the injection, e.g. web forms and automation systems.&lt;&#x2F;p&gt;
&lt;p&gt;It is RECOMMENDED to add a data to the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; standard that makes it easy for e.g. NFT Marketplaces to display data about the AI Agent NFT, i.e. Model, which in turn reveals the platform that is used for the agent, e.g. OpenAI in the case of gpt-4-0125-preview or Anthropic in the case of claude-3-opus-20240229. The standard name and description can be used to display the Agent Name and Agent Description.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This standard provides a unified way to create and parse AI Agent NFTs.&lt;&#x2F;p&gt;
&lt;p&gt;This standard codifies the necessary parameters of Name, Description, Model, User Prompt, and System Prompt for creating and using AI Agent NFTs.&lt;&#x2F;p&gt;
&lt;p&gt;It doesn&#x27;t make practical sense to store the user and system prompts in an existing &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; as the only place to put would be in the token metadata that is open for anyone to access the prompts without owning the NFT. By storing the prompts in a custom Agent struct and restricting access to the prompts to the holder of the NFT.  One way to do this would be through restricting access to the struct info to the holder of the NFT through a custom function, however since that option still exposes the prompt URIs to the public and thus the data inside them, the recommended method is by encrypting the prompts onchain and tying the decryption of the URLs to the holder of the NFT, using onchain services that enable decryption to be tied to contract parameters such as ownerOf(tokenId).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The AI Agents NFT standard introduces additional features and data to the standard &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; protocol, aimed at addressing the practical requirements of using NFTs to store, trade and use AI Agents. It is designed to be fully backward-compatible with the original &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; standard.  All existing &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; functions (such as transferFrom, approve, and balanceOf) retain their original functionality and interfaces. Our extension does not modify these core behaviors, ensuring that any &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; compliant wallet or service can interact with these tokens without modifications.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h3&gt;
&lt;p&gt;This is being currently implemented in a product for creating, managing and using AI Agents Onchain through a DApp interface. In this implementation, an encryption platform is being used to encrypt the prompts using custom EVMContractParameters that only decrypt for the holder of the NFT and using a decentralized storage network to store the URLs of this encrypted data. To facilitate that and make DApp handling easier, some parameters were added to Agent and the addEncryptedPrompts function is added that enables adding the encrypted prompt URIs after first minting the NFT (as the tokenId of the NFT is needed for setting the encryption&#x2F;decryption conditions).&lt;&#x2F;p&gt;
&lt;p&gt;A reference smart contract is provided in the assets folder.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;!-- TODO --&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Sync committee slashings</title>
        <published>2024-03-21T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Etan Kissling</name><uri>https://github.com/etan-status</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7657/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7657-sync-committee-slashings/19288" />
        

        <id>https://wg-eips.ritovision.com/7657/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:7657"
            label="EIP-7657" />
        

        
        

        
        <summary type="html">Slashing condition for malicious sync committee messages</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7657/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP defines a slashing condition for malicious &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b3e83f6691c61e5b35136000146015653b22ed38&#x2F;specs&#x2F;altair&#x2F;validator.md#containers&quot;&gt;sync committee messages&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;A dishonest supermajority of sync committee members is able to convince applications relying on Ethereum&#x27;s &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b3e83f6691c61e5b35136000146015653b22ed38&#x2F;specs&#x2F;altair&#x2F;light-client&#x2F;sync-protocol.md&quot;&gt;light client sync protocol&lt;&#x2F;a&gt; to assume a non-canonical finalized header, and to potentially take over the sync authority for future &lt;code&gt;SyncCommitteePeriod&lt;&#x2F;code&gt;. By signing a malicious beacon block root, a malicious (but valid!) &lt;code&gt;LightClientUpdate&lt;&#x2F;code&gt; message can be formed and subsequently used to, for example, exploit a trust-minimized bridge contract based on the light client sync protocol.&lt;&#x2F;p&gt;
&lt;p&gt;An additional type of slashing is introduced to deter against signing non-canonical beacon block roots as a sync committee member. As is the case with &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b3e83f6691c61e5b35136000146015653b22ed38&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#proposerslashing&quot;&gt;&lt;code&gt;ProposerSlashing&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b3e83f6691c61e5b35136000146015653b22ed38&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#attesterslashing&quot;&gt;&lt;code&gt;AttesterSlashing&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;, only malicious behaviour is slashable. This includes simultaneous contradictory participation across multiple chain branches, but a validator that is simply tricked into syncing to an incorrect checkpoint should not be slashable even though it is participating on a non-canonical chain. Note that a slashing must be verifiable even without access to history, e.g., by a checkpoint synced beacon node.&lt;&#x2F;p&gt;
&lt;p&gt;Note that regardless of the slashing mechanism, a slashing can only be applied retroactively after an attack has already occurred. Use cases that secure a larger amount than &lt;code&gt;SYNC_COMMITTEE_SIZE * MAX_EFFECTIVE_BALANCE&lt;&#x2F;code&gt; = &lt;code&gt;512 * 32 ETH&lt;&#x2F;code&gt; = &lt;code&gt;16384 ETH&lt;&#x2F;code&gt; (on mainnet) should combine the light client sync protocol with other established methods such as a multisig, or may want to require posting additional collateral to be eligible for submitting updates. Other methods are out of scope for this EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;state-transition-checks&quot;&gt;State transition checks&lt;&#x2F;h3&gt;
&lt;p&gt;Note: This still allows having contradictions between attestations&#x2F;proposals and sync committee messages. This also, by design, allows a validator to not participate at all in honest sync committee messages but solely participate in dishonest sync committee messages.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;BLOCK_STATE_ROOT_INDEX&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;get_generalized_index(BeaconBlock, &#x27;state_root&#x27;)&lt;&#x2F;code&gt; (= 11)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;STATE_BLOCK_ROOTS_INDEX&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;get_generalized_index(BeaconState, &#x27;block_roots&#x27;)&lt;&#x2F;code&gt; (= 37)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;STATE_HISTORICAL_ROOTS_INDEX&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;get_generalized_index(BeaconState, &#x27;historical_roots&#x27;)&lt;&#x2F;code&gt; (= 39)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;HISTORICAL_BATCH_BLOCK_ROOTS_INDEX&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;get_generalized_index(HistoricalBatch, &#x27;block_roots&#x27;)&lt;&#x2F;code&gt; (= 2)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SyncCommitteeSlashingEvidence&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    attested_header&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconBlockHeader&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    next_sync_committee&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; SyncCommittee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    next_sync_committee_branch&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Vector&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; floorlog2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;NEXT_SYNC_COMMITTEE_INDEX&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    finalized_header&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconBlockHeader&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    finality_branch&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Vector&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; floorlog2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;FINALIZED_ROOT_INDEX&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sync_aggregate&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; SyncAggregate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signature_slot&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sync_committee_pubkeys&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Vector&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;BLSPubkey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SYNC_COMMITTEE_SIZE&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    actual_finalized_block_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    actual_finalized_branch&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        floorlog2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;BLOCK_STATE_ROOT_INDEX&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        +&lt;&#x2F;span&gt;&lt;span&gt; floorlog2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;STATE_HISTORICAL_ROOTS_INDEX&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; floorlog2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;HISTORICAL_ROOTS_LIMIT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        +&lt;&#x2F;span&gt;&lt;span&gt; floorlog2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;HISTORICAL_BATCH_BLOCK_ROOTS_INDEX&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; floorlog2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SLOTS_PER_HISTORICAL_ROOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SyncCommitteeSlashing&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    slashable_validators&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;ValidatorIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SYNC_COMMITTEE_SIZE&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    evidence_1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; SyncCommitteeSlashingEvidence&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    evidence_2&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; SyncCommitteeSlashingEvidence&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    recent_finalized_block_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    recent_finalized_slot&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; sync_committee_slashing_evidence_has_sync_committee&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;evidence&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; SyncCommitteeSlashingEvidence&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; evidence&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;next_sync_committee_branch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;Root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; _&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;floorlog2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;NEXT_SYNC_COMMITTEE_INDEX&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; sync_committee_slashing_evidence_has_finality&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;evidence&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; SyncCommitteeSlashingEvidence&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; evidence&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;finality_branch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;Root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; _&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;floorlog2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;FINALIZED_ROOT_INDEX&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; is_valid_sync_committee_slashing_evidence&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;evidence&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; SyncCommitteeSlashingEvidence&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;                                              recent_finalized_block_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;                                              recent_finalized_slot&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Slot&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;                                              genesis_validators_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify sync committee has sufficient participants&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sync_aggregate&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; evidence&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sync_aggregate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; sum&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sync_aggregate&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sync_committee_bits&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MIN_SYNC_COMMITTEE_PARTICIPANTS&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify that the `finality_branch`, if present, confirms `finalized_header`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; to match the finalized checkpoint root saved in the state of `attested_header`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Note that the genesis finalized checkpoint root is represented as a zero hash.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; sync_committee_slashing_evidence_has_finality&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evidence&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; evidence&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;actual_finalized_block_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; evidence&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;finalized_header&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; BeaconBlockHeader&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; evidence&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;finalized_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GENESIS_SLOT&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; evidence&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;actual_finalized_block_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; evidence&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;finalized_header&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; BeaconBlockHeader&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            finalized_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            finalized_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; hash_tree_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evidence&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;finalized_header&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; is_valid_merkle_branch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            leaf&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;finalized_root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            branch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;evidence&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;finality_branch&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            depth&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;floorlog2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;FINALIZED_ROOT_INDEX&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;get_subtree_index&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;FINALIZED_ROOT_INDEX&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;evidence&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;attested_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state_root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify that the `next_sync_committee`, if present, actually is the next sync committee saved in the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; state of the `attested_header`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; sync_committee_slashing_evidence_has_sync_committee&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evidence&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; evidence&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;next_sync_committee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; SyncCommittee&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; is_valid_merkle_branch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            leaf&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;hash_tree_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evidence&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;next_sync_committee&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            branch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;evidence&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;next_sync_committee_branch&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            depth&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;floorlog2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;NEXT_SYNC_COMMITTEE_INDEX&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;get_subtree_index&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;NEXT_SYNC_COMMITTEE_INDEX&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;evidence&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;attested_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state_root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify that the `actual_finalized_block_root`, if present, is confirmed by `actual_finalized_branch`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; to be the block root at slot `finalized_header.slot` relative to `recent_finalized_block_root`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; recent_finalized_block_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; evidence&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;actual_finalized_block_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; evidence&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;actual_finalized_block_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evidence&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;actual_finalized_branch&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        finalized_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; evidence&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;finalized_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; recent_finalized_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; finalized_slot&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        distance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; recent_finalized_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; finalized_slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; distance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            gindex&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; GeneralizedIndex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            gindex&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BLOCK_STATE_ROOT_INDEX&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; distance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SLOTS_PER_HISTORICAL_ROOT&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                gindex&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;gindex&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; floorlog2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;STATE_BLOCK_ROOTS_INDEX&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; STATE_BLOCK_ROOTS_INDEX&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                gindex&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;gindex&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; floorlog2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;STATE_HISTORICAL_ROOTS_INDEX&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; STATE_HISTORICAL_ROOTS_INDEX&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                gindex&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;gindex&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `mix_in_length`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                historical_batch_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; finalized_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SLOTS_PER_HISTORICAL_ROOT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                gindex&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;gindex&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; floorlog2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;HISTORICAL_ROOTS_LIMIT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; historical_batch_index&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                gindex&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;gindex&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; floorlog2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;HISTORICAL_BATCH_BLOCK_ROOTS_INDEX&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; HISTORICAL_BATCH_BLOCK_ROOTS_INDEX&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            gindex&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;gindex&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `mix_in_length`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            block_root_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; finalized_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SLOTS_PER_HISTORICAL_ROOT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            gindex&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;gindex&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; floorlog2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SLOTS_PER_HISTORICAL_ROOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; block_root_index&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evidence&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;actual_finalized_branch&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; floorlog2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;gindex&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; is_valid_merkle_branch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            leaf&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;evidence&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;actual_finalized_block_root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            branch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;evidence&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;actual_finalized_branch&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            depth&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;floorlog2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;gindex&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;get_subtree_index&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;gindex&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;recent_finalized_block_root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify sync committee aggregate signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sync_committee_pubkeys&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; evidence&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sync_committee_pubkeys&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    participant_pubkeys&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;bit&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; pubkey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; zip&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sync_aggregate&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sync_committee_bits&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; sync_committee_pubkeys&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; bit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    fork_version&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; compute_fork_version&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;compute_epoch_at_slot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evidence&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;signature_slot&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    domain&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; compute_domain&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;DOMAIN_SYNC_COMMITTEE&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; fork_version&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; genesis_validators_root&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signing_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; compute_signing_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evidence&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;attested_header&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; domain&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; bls&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;FastAggregateVerify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;participant_pubkeys&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signing_root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; sync_aggregate&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sync_committee_signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; process_sync_committee_slashing&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; sync_committee_slashing&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; SyncCommitteeSlashing&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    is_slashable&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check that evidence is ordered descending by `attested_header.slot` and is not from the future&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    evidence_1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sync_committee_slashing&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;evidence_1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    evidence_2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sync_committee_slashing&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;evidence_2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span&gt; evidence_1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;signature_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; evidence_1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;attested_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span&gt; evidence_1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;finalized_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span&gt; evidence_2&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;signature_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; evidence_2&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;attested_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span&gt; evidence_2&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;finalized_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; evidence_1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;attested_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span&gt; evidence_2&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;attested_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Only conflicting data among the current and previous sync committee period is slashable;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; on new periods, the sync committee initially signs blocks in a previous sync committee period.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This allows a validator synced to a malicious checkpoint to contribute again in a future period&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    evidence_1_attested_period&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; compute_sync_committee_period_at_slot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evidence_1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;attested_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    evidence_2_attested_period&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; compute_sync_committee_period_at_slot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evidence_2&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;attested_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; evidence_1_attested_period&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span&gt; evidence_2_attested_period&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; It is not allowed to sign conflicting `attested_header` for a given slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; evidence_1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;attested_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; evidence_2&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;attested_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; evidence_1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;attested_header&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; evidence_2&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;attested_header&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            is_slashable&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; True&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; It is not allowed to sign conflicting finalized `next_sync_committee`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    evidence_1_finalized_period&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; compute_sync_committee_period_at_slot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evidence_1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;finalized_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    evidence_2_finalized_period&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; compute_sync_committee_period_at_slot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evidence_2&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;finalized_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        evidence_1_attested_period&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; evidence_2_attested_period&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        and&lt;&#x2F;span&gt;&lt;span&gt; evidence_1_finalized_period&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; evidence_1_attested_period&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        and&lt;&#x2F;span&gt;&lt;span&gt; evidence_2_finalized_period&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; evidence_2_attested_period&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        and&lt;&#x2F;span&gt;&lt;span&gt; sync_committee_slashing_evidence_has_finality&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evidence_1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        and&lt;&#x2F;span&gt;&lt;span&gt; sync_committee_slashing_evidence_has_finality&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evidence_2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        and&lt;&#x2F;span&gt;&lt;span&gt; sync_committee_slashing_evidence_has_sync_committee&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evidence_1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        and&lt;&#x2F;span&gt;&lt;span&gt; sync_committee_slashing_evidence_has_sync_committee&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evidence_2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; evidence_1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;next_sync_committee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; evidence_2&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;next_sync_committee&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            is_slashable&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; True&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; It is not allowed to sign a non-linear finalized history&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    recent_finalized_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sync_committee_slashing&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;recent_finalized_slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    recent_finalized_block_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sync_committee_slashing&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;recent_finalized_block_root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        not&lt;&#x2F;span&gt;&lt;span&gt; sync_committee_slashing_evidence_has_finality&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evidence_1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        or&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; sync_committee_slashing_evidence_has_finality&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evidence_2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span&gt; recent_finalized_block_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; recent_finalized_block_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span&gt; recent_finalized_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Merkle proofs may be included to indicate that `finalized_header` does not match&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the `actual_finalized_block_root` relative to a given `recent_finalized_block_root`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The finalized history is linear. Therefore, a mismatch indicates signing on an unrelated chain.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Note that it is not slashable to sign solely an alternate history, as long as it is consistent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This allows a validator synced to a malicious checkpoint to contribute again in a future period&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        linear_1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;evidence_1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;actual_finalized_block_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; hash_tree_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evidence_1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;finalized_header&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        linear_2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;evidence_2&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;actual_finalized_block_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; hash_tree_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evidence_2&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;finalized_header&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; linear_1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; or&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; linear_2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span&gt; linear_1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; or&lt;&#x2F;span&gt;&lt;span&gt; linear_2&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Do not slash on signing solely an alternate history&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `actual_finalized_branch` may be rooted in the provided `finalized_header` with highest slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        rooted_in_evidence_1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            evidence_1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;finalized_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span&gt; evidence_2&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;finalized_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            and&lt;&#x2F;span&gt;&lt;span&gt; recent_finalized_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; evidence_1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;finalized_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            and&lt;&#x2F;span&gt;&lt;span&gt; recent_finalized_block_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; evidence_1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;actual_finalized_block_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span&gt; linear_1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        rooted_in_evidence_2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            evidence_2&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;finalized_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span&gt; evidence_1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;finalized_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            and&lt;&#x2F;span&gt;&lt;span&gt; recent_finalized_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; evidence_2&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;finalized_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            and&lt;&#x2F;span&gt;&lt;span&gt; recent_finalized_block_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; evidence_2&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;actual_finalized_block_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span&gt; linear_2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Alternatively, if evidence about non-linearity cannot be obtained directly from an attack,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; it can be proven that one of the `finalized_header` is part of the canonical finalized chain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; that our beacon node is synced to, while the other `finalized_header` is unrelated.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        rooted_in_canonical&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            recent_finalized_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span&gt; recent_finalized_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SLOTS_PER_HISTORICAL_ROOT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            and&lt;&#x2F;span&gt;&lt;span&gt; recent_finalized_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span&gt; compute_start_slot_at_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;finalized_checkpoint&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;epoch&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            and&lt;&#x2F;span&gt;&lt;span&gt; recent_finalized_block_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;block_roots&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;recent_finalized_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SLOTS_PER_HISTORICAL_ROOT&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span&gt; rooted_in_evidence_1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; or&lt;&#x2F;span&gt;&lt;span&gt; rooted_in_evidence_2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; or&lt;&#x2F;span&gt;&lt;span&gt; rooted_in_canonical&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        is_slashable&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; True&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; is_slashable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check that slashable validators are sorted, known, and participated in both signatures&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    will_slash_any&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sync_aggregate_1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; evidence_1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sync_aggregate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sync_aggregate_2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; evidence_2&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sync_aggregate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sync_committee_pubkeys_1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; evidence_1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sync_committee_pubkeys&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sync_committee_pubkeys_2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; evidence_2&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sync_committee_pubkeys&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    participant_pubkeys_1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;bit&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; pubkey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; zip&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sync_aggregate_1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sync_committee_bits&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; sync_committee_pubkeys_1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; bit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    participant_pubkeys_2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;bit&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; pubkey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; zip&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sync_aggregate_2&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sync_committee_bits&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; sync_committee_pubkeys_2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; bit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    slashable_validators&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sync_committee_slashing&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slashable_validators&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    num_validators&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validators&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; enumerate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;slashable_validators&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; num_validators&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            and&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; or&lt;&#x2F;span&gt;&lt;span&gt; index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; slashable_validators&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validators&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; participant_pubkeys_1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validators&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; participant_pubkeys_2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; is_slashable_validator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validators&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; get_current_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            will_slash_any&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; True&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; will_slash_any&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Validate evidence, including signatures&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; is_valid_sync_committee_slashing_evidence&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        evidence_1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        recent_finalized_block_root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        recent_finalized_slot&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;genesis_validators_root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; is_valid_sync_committee_slashing_evidence&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        evidence_2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        recent_finalized_block_root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        recent_finalized_slot&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;genesis_validators_root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Perform slashing&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; slashable_validators&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; is_slashable_validator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validators&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; get_current_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            slash_validator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;what-s-the-use-case&quot;&gt;What&#x27;s the use case?&lt;&#x2F;h3&gt;
&lt;p&gt;Without a slashing, the light client sync protocol is somewhat limited. While wallet applications may benefit from it (the risk being, that incorrect data is displayed) and new beacon nodes may use it for accelerating chain synchronization, other interesting use cases such as bridges, token distributions or other systems requiring proofs depend on the mechanism providing higher security guarantees.&lt;&#x2F;p&gt;
&lt;p&gt;By making attacks by sync committee members slashable, a sufficiently high deterrent could be provided. A majority of the sync committee would have to be bribed to succeed in an attack even in the most simple cases, representing a sizable slashable balance.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP requires a hard fork as it introduces new consensus validation rules.&lt;&#x2F;p&gt;
&lt;p&gt;Supporting infrastructure may be introduced separately once the consensus validation rules are in place, including but not limited to:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Slashing protection DB updates, to guarantee that honest validators cannot be slashed on reorgs&lt;&#x2F;li&gt;
&lt;li&gt;Validator client &#x2F; remote signer APIs, to pass along information related to slashing protection&lt;&#x2F;li&gt;
&lt;li&gt;libp2p meshes for exchanging slashing evidence between beacon nodes&lt;&#x2F;li&gt;
&lt;li&gt;Slasher, to monitor potential targets and construct slashing evidence&lt;&#x2F;li&gt;
&lt;li&gt;Beacon APIs, to submit and monitor slashing evidence&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Light client data backfill</title>
        <published>2024-03-21T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Etan Kissling</name><uri>https://github.com/etan-status</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7658/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7658-light-client-data-backfill/19290" />
        

        <id>https://wg-eips.ritovision.com/7658/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7658"
            label="EIP-7658" />
        

        
        

        
        <summary type="html">Mechanism for beacon nodes for syncing historical light client data</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7658/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP defines a mechanism for syncing &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;4afe39822c9ad9747e0f5635cca117c18441ec1b&#x2F;specs&#x2F;altair&#x2F;light-client&#x2F;full-node.md&quot;&gt;light client data&lt;&#x2F;a&gt; between beacon nodes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;4afe39822c9ad9747e0f5635cca117c18441ec1b&#x2F;specs&#x2F;altair&#x2F;light-client&#x2F;full-node.md&quot;&gt;Light client data&lt;&#x2F;a&gt; is collected by beacon nodes to assist &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;4afe39822c9ad9747e0f5635cca117c18441ec1b&#x2F;specs&#x2F;altair&#x2F;light-client&#x2F;light-client.md&quot;&gt;light clients&lt;&#x2F;a&gt; to sync with the network. The &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;4afe39822c9ad9747e0f5635cca117c18441ec1b&#x2F;specs&#x2F;altair&#x2F;light-client&#x2F;sync-protocol.md&quot;&gt;sync protocol&lt;&#x2F;a&gt; defines a mechanism to sync forward in time. However, it cannot be used to sync backward.&lt;&#x2F;p&gt;
&lt;p&gt;Collecting light client data is challenging because beacon nodes need to have access to the corresponding &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;4afe39822c9ad9747e0f5635cca117c18441ec1b&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#beaconstate&quot;&gt;&lt;code&gt;BeaconState&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;4afe39822c9ad9747e0f5635cca117c18441ec1b&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#signedbeaconblock&quot;&gt;&lt;code&gt;SignedBeaconBlock&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;. &lt;code&gt;BeaconState&lt;&#x2F;code&gt; objects are not available before the initially synced checkpoint state, and &lt;code&gt;SignedBeaconBlock&lt;&#x2F;code&gt; objects have a limited retention period on libp2p.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore, each &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;4afe39822c9ad9747e0f5635cca117c18441ec1b&#x2F;specs&#x2F;altair&#x2F;beacon-chain.md#get_next_sync_committee&quot;&gt;sync committee period&lt;&#x2F;a&gt; consists of &lt;code&gt;EPOCHS_PER_SYNC_COMMITTEE_PERIOD * SLOTS_PER_EPOCH&lt;&#x2F;code&gt; slots. To support archive services such as Portal network to provide a consistent view regardless of backend, it is necessary to choose a single canonical slot for which to derive the representative light client data for that period. Such data should be verifiable to be canonical and optimal in a decentralized and independent manner.&lt;&#x2F;p&gt;
&lt;p&gt;To support light client data backfill, this EIP proposes to track the canonical and optimal &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;4afe39822c9ad9747e0f5635cca117c18441ec1b&#x2F;specs&#x2F;altair&#x2F;beacon-chain.md#syncaggregate&quot;&gt;&lt;code&gt;SyncAggregate&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; in the &lt;code&gt;BeaconState&lt;&#x2F;code&gt;. This minimal addition allows proving that derived &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;4afe39822c9ad9747e0f5635cca117c18441ec1b&#x2F;specs&#x2F;altair&#x2F;light-client&#x2F;sync-protocol.md#lightclientupdate&quot;&gt;&lt;code&gt;LightClientUpdate&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;4afe39822c9ad9747e0f5635cca117c18441ec1b&#x2F;specs&#x2F;altair&#x2F;light-client&#x2F;sync-protocol.md#lightclientbootstrap&quot;&gt;&lt;code&gt;LightClientBootstrap&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; are also canonical and optimal.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;containers&quot;&gt;Containers&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;new-containers&quot;&gt;New containers&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;syncdata&quot;&gt;&lt;code&gt;SyncData&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SyncData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sync committee aggregate signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sync_aggregate&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; SyncAggregate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Slot at which the aggregate signature was created&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signature_slot&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;extended-containers&quot;&gt;Extended containers&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;beaconstate&quot;&gt;&lt;code&gt;BeaconState&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;p&gt;New fields are added to the end of &lt;code&gt;BeaconState&lt;&#x2F;code&gt; from the activating fork onward to track the current and previous sync committee period&#x27;s best sync data.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sync history&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    previous_best_sync_data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; SyncData&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    current_best_sync_data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; SyncData&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    parent_block_has_sync_committee_finality&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;helper-functions&quot;&gt;Helper functions&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;default-sync-data&quot;&gt;&lt;code&gt;default_sync_data&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; default_sync_data&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; SyncData&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; SyncData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        sync_aggregate&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;SyncAggregate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            sync_committee_bits&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;Bitvector&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SYNC_COMMITTEE_SIZE&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            sync_committee_signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;G2_POINT_AT_INFINITY&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        signature_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;GENESIS_SLOT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;beacon-chain-state-transition-function&quot;&gt;Beacon chain state transition function&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;epoch-processing&quot;&gt;Epoch processing&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;modified-process-sync-committee-updates&quot;&gt;Modified &lt;code&gt;process_sync_committee_updates&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;p&gt;On sync committee boundaries, current period data is moved to previous period. This allows proving that light client data for the previous period is canonical.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; process_sync_committee_updates&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    next_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_current_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; Epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; next_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EPOCHS_PER_SYNC_COMMITTEE_PERIOD&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;previous_best_sync_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;current_best_sync_data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;current_best_sync_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; default_sync_data&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parent_block_has_sync_committee_finality&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;block-processing&quot;&gt;Block processing&lt;&#x2F;h4&gt;
&lt;p&gt;Block processing is extended to track the optimal light client data for the current period. Due to the possibility for empty slots this must be tracked before the block header is overwritten; this allows tracking the exact block after which &lt;code&gt;next_sync_committee&lt;&#x2F;code&gt; becomes finalized.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; process_block&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconBlock&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    process_best_sync_data&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    process_block_header&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;new-process-best-sync-data&quot;&gt;New &lt;code&gt;process_best_sync_data&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; process_best_sync_data&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconBlock&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signature_period&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; compute_sync_committee_period_at_slot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    attested_period&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; compute_sync_committee_period_at_slot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;latest_block_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Track sync committee finality&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    old_has_sync_committee_finality&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parent_block_has_sync_committee_finality&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parent_block_has_sync_committee_finality&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        new_has_sync_committee_finality&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; True&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    elif&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;finalized_checkpoint&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ALTAIR_FORK_EPOCH&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        new_has_sync_committee_finality&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        finalized_period&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; compute_sync_committee_period&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;finalized_checkpoint&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;epoch&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        new_has_sync_committee_finality&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;finalized_period&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; attested_period&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parent_block_has_sync_committee_finality&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; new_has_sync_committee_finality&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Track best sync data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; attested_period&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; signature_period&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        max_active_participants&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;body&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sync_aggregate&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sync_committee_bits&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        new_num_active_participants&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; sum&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;body&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sync_aggregate&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sync_committee_bits&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        old_num_active_participants&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; sum&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;current_best_sync_data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sync_aggregate&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sync_committee_bits&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        new_has_supermajority&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; new_num_active_participants&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span&gt; max_active_participants&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        old_has_supermajority&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; old_num_active_participants&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span&gt; max_active_participants&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; new_has_supermajority&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; old_has_supermajority&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            is_better_sync_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; new_has_supermajority&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        elif&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; new_has_supermajority&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span&gt; new_num_active_participants&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; old_num_active_participants&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            is_better_sync_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; new_num_active_participants&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; old_num_active_participants&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        elif&lt;&#x2F;span&gt;&lt;span&gt; new_has_sync_committee_finality&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; old_has_sync_committee_finality&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            is_better_sync_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; new_has_sync_committee_finality&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        elif&lt;&#x2F;span&gt;&lt;span&gt; new_num_active_participants&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; old_num_active_participants&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            is_better_sync_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; new_num_active_participants&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; old_num_active_participants&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            is_better_sync_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;current_best_sync_data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;signature_slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; is_better_sync_data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;current_best_sync_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; SyncData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;                sync_aggregate&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;body&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sync_aggregate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;                signature_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;how-to-rank-syncaggregate&quot;&gt;How to rank &lt;code&gt;SyncAggregate&lt;&#x2F;code&gt;?&lt;&#x2F;h3&gt;
&lt;p&gt;The EIP reuses the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;4afe39822c9ad9747e0f5635cca117c18441ec1b&#x2F;specs&#x2F;altair&#x2F;light-client&#x2F;sync-protocol.md#is_better_update&quot;&gt;&lt;code&gt;is_better_update&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; function from existing specs.&lt;&#x2F;p&gt;
&lt;p&gt;To ensure deterministic selection when participation and finality are equal, implementations MUST break ties by preferring the lower &lt;code&gt;signature_slot&lt;&#x2F;code&gt;; if equal, the existing selection SHOULD be retained.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;how-could-a-backfill-protocol-use-this&quot;&gt;How could a backfill protocol use this?&lt;&#x2F;h3&gt;
&lt;p&gt;Once the data is available in the &lt;code&gt;BeaconState&lt;&#x2F;code&gt;, a light client data backfill protocol could be defined that serves, for past periods:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;A &lt;code&gt;LightClientUpdate&lt;&#x2F;code&gt; from requested &lt;code&gt;period&lt;&#x2F;code&gt; + 1 that proves that the entirety of &lt;code&gt;period&lt;&#x2F;code&gt; is finalized.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;BeaconState.historical_summaries[period].block_summary_root&lt;&#x2F;code&gt; at (1)&#x27;s &lt;code&gt;attested_header.beacon.state_root&lt;&#x2F;code&gt; + Merkle proof.&lt;&#x2F;li&gt;
&lt;li&gt;For each epoch&#x27;s slot 0 block within requested &lt;code&gt;period&lt;&#x2F;code&gt;, the corresponding &lt;code&gt;LightClientHeader&lt;&#x2F;code&gt; + Merkle multi-proof for the block&#x27;s inclusion into (2)&#x27;s &lt;code&gt;block_summary_root&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;For each of the entries from (3) with &lt;code&gt;beacon.slot&lt;&#x2F;code&gt; within &lt;code&gt;period&lt;&#x2F;code&gt;, the &lt;code&gt;current_sync_committee_branch&lt;&#x2F;code&gt; + Merkle proof for constructing &lt;code&gt;LightClientBootstrap&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If (4) is not empty, the requested &lt;code&gt;period&lt;&#x2F;code&gt;&#x27;s &lt;code&gt;current_sync_committee&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The best &lt;code&gt;LightClientUpdate&lt;&#x2F;code&gt; from &lt;code&gt;period&lt;&#x2F;code&gt;, if one exists, + Merkle proof that its &lt;code&gt;sync_aggregate&lt;&#x2F;code&gt; + &lt;code&gt;signature_slot&lt;&#x2F;code&gt; is selected as the canonical best one in (1)&#x27;s &lt;code&gt;attested_header.beacon.state_root&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Only the proof in (6) depends on &lt;code&gt;BeaconState&lt;&#x2F;code&gt; tracking the best light client data. This modification would enshrine the logic of a subset of &lt;code&gt;is_better_update&lt;&#x2F;code&gt;, but does not require adding any &lt;code&gt;LightClientXyz&lt;&#x2F;code&gt; data structures to the &lt;code&gt;BeaconState&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP requires a hard fork as it introduces new consensus validation rules.&lt;&#x2F;p&gt;
&lt;p&gt;Only light client data following the hard fork can be proven to be canonical and optimal. However, after finalization of the fork transition block, earlier light client data can no longer change and could be locked in using a hash.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;None&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Generalized Contract-Linked Services</title>
        <published>2024-03-15T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Francesco Sullo</name><uri>https://github.com/sullof</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7656/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/variation-to-erc6551-to-deploy-any-kind-of-contract-linked-to-an-nft/19223" />
        

        <id>https://wg-eips.ritovision.com/7656/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:7656"
            label="ERC-7656" />
        

        
        

        
        <summary type="html">Define a factory for generic services linked to any contract type, including smart accounts and NFTs</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7656/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal defines a factory capable of deploying generic services linked to specific contracts, such as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt; accounts or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; tokens (NFTs). These linked services extend the functionalities of the target contract, operating under the ownership of the contract&#x27;s or NFT&#x27;s owner without requiring modifications to the original contract&#x27;s code. This approach enables extending existing contracts with new capabilities while maintaining backward compatibility with deployed instances.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Existing projects, like token-bound accounts, successfully bind smart accounts to NFTs, allowing registries to deploy accounts owned by specific token IDs. However, these standards have two key limitations:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;They often require deployed contracts to implement specific interfaces for handling assets and executing transactions, effectively mandating that the deployed contract must function as an account.&lt;&#x2F;li&gt;
&lt;li&gt;They are restricted to NFTs, while many other contract types (particularly &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt; accounts) could benefit from similar linking mechanisms to extend their functionalities.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;This ERC proposes a more versatile factory specification that enables the deployment of proxies pointing to any contract that enhances the associated contract&#x27;s capabilities, whether it&#x27;s an NFT or an account contract.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;key-benefits&quot;&gt;Key Benefits&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Universal Linkability&lt;&#x2F;strong&gt;: Enables services to be linked to any compatible contract type, not just NFTs, creating a unified approach to contract extension.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Non-Invasive Enhancement&lt;&#x2F;strong&gt;: Services can add functionality to existing smart accounts without modifying the underlying contract, maintaining compatibility with infrastructure like wallets and indexers.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Backward Compatibility&lt;&#x2F;strong&gt;: Maintains compatibility with existing token-bound accounts while extending functionality to new use cases.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Flexible Implementation&lt;&#x2F;strong&gt;: The &lt;code&gt;mode&lt;&#x2F;code&gt; parameter enables different linkage types (with or without token IDs) while ensuring consistent deterministic addressing.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Unified Extension Mechanism&lt;&#x2F;strong&gt;: Provides a standardized approach for extending existing contracts with new capabilities, reducing the need for specialized implementations across different use cases.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;use-cases-for-erc-4337-smart-accounts&quot;&gt;Use Cases for ERC-4337 Smart Accounts&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Social Recovery Services&lt;&#x2F;strong&gt;: Deploy a social recovery mechanism linked to an existing ERC-4337 wallet that can restore access if credentials are lost, without requiring the wallet to implement recovery functionality natively.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Customizable Permission Systems&lt;&#x2F;strong&gt;: Add granular permissions to an account (time-limited access, spending limits, multi-signature approvals) without rebuilding the account from scratch.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Account Abstraction Extensions&lt;&#x2F;strong&gt;: Implement advanced features like batch transactions, gas sponsorship, or session keys as linked services, allowing wallets to adopt these features selectively.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Identity and Reputation Services&lt;&#x2F;strong&gt;: Link verifiable credentials or reputation systems to accounts, enabling privacy-preserving identity verification.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;use-cases-for-nfts&quot;&gt;Use Cases for NFTs&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Enhanced Token Utility&lt;&#x2F;strong&gt;: Provide NFTs with financial capabilities like staking, lending, or revenue distribution.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Dynamic Metadata Services&lt;&#x2F;strong&gt;: Enable NFT metadata to evolve based on on-chain activities without changing the NFT itself.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Fractional Ownership&lt;&#x2F;strong&gt;: Implement fractional ownership mechanisms for high-value NFTs through linked contracts.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Conditional Access Control&lt;&#x2F;strong&gt;: Create time-locked or challenge-based access to NFT-gated content or services.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Real World Asset Management&lt;&#x2F;strong&gt;: Extend NFTs to represent and manage real-world assets (RWAs) by linking services that handle compliance, legal documentation, custody verification, transfer restrictions, and regulatory reporting without requiring specialized NFT standards for each asset class.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords &quot;MUST,&quot; &quot;MUST NOT,&quot; &quot;REQUIRED,&quot; &quot;SHALL,&quot; &quot;SHALL NOT,&quot; &quot;SHOULD,&quot; &quot;SHOULD NOT,&quot; &quot;RECOMMENDED,&quot; &quot;NOT RECOMMENDED,&quot; &quot;MAY,&quot; and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;IERC7656Factory&lt;&#x2F;code&gt; interface is defined as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7656Factory&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Created&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contractAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; implementation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; salt&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; chainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes12&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; mode&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; linkedContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; linkedId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CreationFailed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; create&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; implementation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; salt&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; chainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes12&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; mode&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; linkedContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; linkedId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; compute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; implementation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; salt&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; chainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes12&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; mode&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; linkedContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; linkedId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; service&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;linking-modes&quot;&gt;Linking Modes&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;mode&lt;&#x2F;code&gt; parameter serves as a selector for how the linked contract should be interpreted and utilized. Currently, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7656&#x2F;&quot;&gt;ERC-7656&lt;&#x2F;a&gt; defines two standard modes:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes12&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; NO_LINKED_ID &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x000000000000000000000001&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes12&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; LINKED_ID &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x000000000000000000000000&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;LINKED_ID Mode (0x000000000000000000000000)&lt;&#x2F;strong&gt;: Used when linking a service to an NFT or any contract that requires a token&#x2F;entity ID. This mode ensures compatibility with existing token-bound account systems.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;NO_LINKED_ID Mode (0x000000000000000000000001)&lt;&#x2F;strong&gt;: Used when linking a service to a contract that doesn&#x27;t require an ID parameter, such as an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt; account. In this case, the &lt;code&gt;linkedId&lt;&#x2F;code&gt; parameter is still present in the interface for consistency but SHOULD be set to zero if not used to store alternative data relevant to the service.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;code&gt;mode&lt;&#x2F;code&gt; parameter (being &lt;code&gt;bytes12&lt;&#x2F;code&gt;) allows for future extensions beyond these initial modes, enabling more complex linkage patterns as ecosystem needs evolve.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;deployment-requirements&quot;&gt;Deployment Requirements&lt;&#x2F;h3&gt;
&lt;p&gt;Any &lt;code&gt;ERC7656Factory&lt;&#x2F;code&gt; implementation MUST support the &lt;code&gt;IERC7656Factory&lt;&#x2F;code&gt; interface ID (&lt;code&gt;0x9e23230a&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;Each linked service MUST be deployed as an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1167&#x2F;&quot;&gt;ERC-1167&lt;&#x2F;a&gt; minimal proxy, appending immutable constant data to the bytecode. The deployed bytecode structure is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ERC-1167 Header               (10 bytes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;implementation (address)&amp;gt;    (20 bytes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ERC-1167 Footer               (15 bytes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;salt (bytes32)&amp;gt;              (32 bytes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;chainId (uint256)&amp;gt;           (32 bytes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;mode (bytes12)&amp;gt;              (12 bytes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;linkedContract (address)&amp;gt;    (20 bytes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;linkedId (uint256)&amp;gt;          (32 bytes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Total bytecode size: 183 bytes&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Linked services SHOULD implement the &lt;code&gt;IERC7656Service&lt;&#x2F;code&gt; interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Interface ID: 0x7e110a1d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7656Service&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; linkedData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; chainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes12&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; mode&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; linkedContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; linkedId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;implementation-patterns&quot;&gt;Implementation Patterns&lt;&#x2F;h3&gt;
&lt;p&gt;When implementing a linked service, developers SHOULD consider the following patterns:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Ownership Verification&lt;&#x2F;strong&gt;: Services SHOULD include mechanisms to verify that operations are authorized by the current owner of the linked contract or token.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Mode-Specific Logic&lt;&#x2F;strong&gt;: Services SHOULD implement conditional logic based on the &lt;code&gt;mode&lt;&#x2F;code&gt; parameter to handle both NFT-linked and account-linked scenarios appropriately.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Cross-Chain Awareness&lt;&#x2F;strong&gt;: Services SHOULD check that operations are being performed on the chain specified in the &lt;code&gt;chainId&lt;&#x2F;code&gt; parameter to prevent cross-chain replay attacks.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The design of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7656&#x2F;&quot;&gt;ERC-7656&lt;&#x2F;a&gt; is guided by several key principles that address limitations in current contract extension methods:&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-a-unified-factory&quot;&gt;Why a Unified Factory?&lt;&#x2F;h3&gt;
&lt;p&gt;Rather than creating separate standards for NFT extensions and account extensions, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7656&#x2F;&quot;&gt;ERC-7656&lt;&#x2F;a&gt; employs a unified factory approach. This design choice stems from recognizing the fundamental similarity between linking services to tokens and linking services to accounts - both involve extending functionality while maintaining a clear ownership relationship.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;mode-parameter-design&quot;&gt;Mode Parameter Design&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;mode&lt;&#x2F;code&gt; parameter uses 12 bytes instead of a simple boolean flag because the 12-byte format reserves space for future linking modes beyond the initial two (NFT linking and account linking). For example, if a service is associated to an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; token but requires that the balance of the user is more than 1000 tokens, the mode could be &lt;code&gt;0x000000000000000000003e802&lt;&#x2F;code&gt;, where the least significant byte, &lt;code&gt;0x02&lt;&#x2F;code&gt; is the primary mode and the rest is the minimum required balance. Similarly, someone can think of a service associated to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens that requires a specific balance where the required balance can be put in the &lt;code&gt;linkedId&lt;&#x2F;code&gt; field, and the &lt;code&gt;mode&lt;&#x2F;code&gt; specified accordingly.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;deterministic-addressing&quot;&gt;Deterministic Addressing&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7656&#x2F;&quot;&gt;ERC-7656&lt;&#x2F;a&gt; follows a deterministic addressing pattern, appending immutable data to the contract bytecode rather than storing it in contract storage. This ensures that:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Linked services have predictable addresses that can be computed off-chain&lt;&#x2F;li&gt;
&lt;li&gt;The factory remains stateless, reducing gas costs&lt;&#x2F;li&gt;
&lt;li&gt;Linked services can be deployed on-demand or even referenced before deployment&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;generic-linking-mechanism&quot;&gt;Generic Linking Mechanism&lt;&#x2F;h3&gt;
&lt;p&gt;Unlike standards that enforce specific interfaces or behaviors on linked contracts, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7656&#x2F;&quot;&gt;ERC-7656&lt;&#x2F;a&gt; remains agnostic about the implementation details of linked services. This deliberate design choice allows developers maximum flexibility to create specialized services while maintaining a consistent deployment and ownership model.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7656&#x2F;&quot;&gt;ERC-7656&lt;&#x2F;a&gt; maintains compatibility with token-bound accounts when used with the &lt;code&gt;LINKED_ID&lt;&#x2F;code&gt; mode (0x000000000000000000000000). This ensures that existing applications and infrastructure supporting token-bound accounts can continue operating without modification.&lt;&#x2F;p&gt;
&lt;p&gt;For contracts using the &lt;code&gt;NO_LINKED_ID&lt;&#x2F;code&gt; mode (0x000000000000000000000001), specialized interfaces may be required, but the core factory mechanism remains consistent.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7656&#x2F;.&#x2F;assets&#x2F;ERC7656Factory.sol&quot;&gt;&lt;code&gt;ERC7656Factory.sol&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; for an example implementation of &lt;code&gt;IERC7656Factory&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;For convenience, the bytecode of the reference implementation has been deployed at &lt;code&gt;0x76565d90eeB1ce12D05d55D142510dBA634a128F&lt;&#x2F;code&gt; on Ethereum mainnet, and will be later deployed at the same address to all primary mainnets and selected testnets.&lt;&#x2F;p&gt;
&lt;p&gt;An example of implementation of &lt;code&gt;IERC7656Service&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; LinkedService&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7656Service&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;EIP5313&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; linkedData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; service&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes12&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; encodedData &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x60&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; solhint-disable&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;-next-line no-inline-assembly&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Copy 0x60 bytes from end of context&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      extcodecopy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;service&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;encodedData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x4d&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x60&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; chainId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; linkedContract&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; linkedId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; solhint-disable&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;-next-line no-inline-assembly&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      chainId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;encodedData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      linkedContract &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;encodedData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x40&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      linkedId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;encodedData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x60&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes12&lt;&#x2F;span&gt;&lt;span&gt; mode &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes12&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;linkedContract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; extractedAddress &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint160&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;linkedContract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;chainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; mode&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; extractedAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; linkedId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; chainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; ,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt; tokenContract_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt; tokenId_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; linkedData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;chainId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;chainid&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenContract_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;ownership-cycles&quot;&gt;Ownership Cycles&lt;&#x2F;h3&gt;
&lt;p&gt;Smart wallets linked to NFTs that are then held by the same wallet can create ownership cycles, potentially rendering assets inaccessible. Implementers should include safeguards to prevent or detect such cycles.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;fraud-prevention&quot;&gt;Fraud Prevention&lt;&#x2F;h3&gt;
&lt;p&gt;A malicious seller could alter or revoke service permissions just before finalizing a sale. Lock mechanisms preventing last-minute changes may be implemented, especially for NFT marketplaces integrating with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7656&#x2F;&quot;&gt;ERC-7656&lt;&#x2F;a&gt; services.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;malicious-implementations&quot;&gt;Malicious Implementations&lt;&#x2F;h3&gt;
&lt;p&gt;The registry cannot enforce legitimate ownership when linking services. Users should review or audit implementations before deployment. Front-end applications integrating &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7656&#x2F;&quot;&gt;ERC-7656&lt;&#x2F;a&gt; should display warnings when interacting with unverified implementations.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;upgradeability-risks&quot;&gt;Upgradeability Risks&lt;&#x2F;h3&gt;
&lt;p&gt;Linked services that are upgradable pose risks of unexpected changes or asset exfiltration. Secure upgrade mechanisms with timelock controls or multi-signature governance should be implemented when upgradeability is required.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;reentrancy-cross-contract-attacks&quot;&gt;Reentrancy &amp;amp; Cross-Contract Attacks&lt;&#x2F;h3&gt;
&lt;p&gt;Linked services interacting with assets or external protocols may be vulnerable to reentrancy exploits. Implementers should follow security best practices such as the checks-effects-interactions pattern and consider reentrancy guards.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;mode-specific-vulnerabilities&quot;&gt;Mode-Specific Vulnerabilities&lt;&#x2F;h3&gt;
&lt;p&gt;Services operating in different modes (&lt;code&gt;LINKED_ID&lt;&#x2F;code&gt; vs &lt;code&gt;NO_LINKED_ID&lt;&#x2F;code&gt;) may have different security requirements. Implementations should validate that operations are appropriate for the service&#x27;s configured mode.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;user-education-phishing-risks&quot;&gt;User Education &amp;amp; Phishing Risks&lt;&#x2F;h3&gt;
&lt;p&gt;Even with secure contracts, users may fall victim to fraudulent services masquerading as legitimate ones. Clear UI warnings, verification tools, and educational resources should be provided by applications integrating &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7656&#x2F;&quot;&gt;ERC-7656&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Request Method Types</title>
        <published>2024-03-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Rickey</name><uri>https://github.com/HelloRickey</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7654/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7654-request-method-types/19183" />
        

        <id>https://wg-eips.ritovision.com/7654/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7654"
            label="ERC-7654" />
        

        
        

        
        <summary type="html">Use a set of request methods to indicate the type of action to take on the contract.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7654/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal standardizes a set of request and response communication standards between clients and smart contracts, using POST, GET, and PUT requests to create, read, and update the states of smart contracts. You can customize different request method names, request parameters and response values, and each request method will be mapped to a specific operation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Since each contract has different functions, the client cannot use a standard to call different functions of different contracts. Contract Request Methods redefines the request method of the contract, so that different functions of multiple different contracts can be called using a consistent set of rules and protocols.&lt;&#x2F;p&gt;
&lt;p&gt;By dividing the function types into POST, GET, and PUT, different operations can be performed on the contract. This clear operation type can not only help all parties limit the access and operation of contract data, but also effectively simplify the interaction between the client and the contract, making it easier for all parties to understand the functions and hierarchical structure of the contract. The request and response parameter data types of each function of this standard can express the expected operation of the contract and have the ability to describe its own structure, which is conducive to the parties and contracts to create a unified and predictable way of exchanging data.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;It consists of four request method types:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;GET&lt;&#x2F;strong&gt;: Request the contract to retrieve records.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;POST&lt;&#x2F;strong&gt;: Request the contract to create a new record.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;PUT&lt;&#x2F;strong&gt;: Request the contract to update a record.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;OPTIONS&lt;&#x2F;strong&gt;: Supported request method types.&lt;&#x2F;p&gt;
&lt;p&gt;Workflow:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Call &lt;code&gt;options&lt;&#x2F;code&gt; to obtain supported request method types.&lt;&#x2F;li&gt;
&lt;li&gt;Call &lt;code&gt;getMethods&lt;&#x2F;code&gt; to obtain the request method name.&lt;&#x2F;li&gt;
&lt;li&gt;Call &lt;code&gt;getMethodInstruction&lt;&#x2F;code&gt; to obtain the request method instruction.&lt;&#x2F;li&gt;
&lt;li&gt;Call &lt;code&gt;getMethodReqAndRes&lt;&#x2F;code&gt; to obtain the request parameter data type and response value data type.&lt;&#x2F;li&gt;
&lt;li&gt;Encode request parameters and call &lt;code&gt;get&lt;&#x2F;code&gt;, &lt;code&gt;post&lt;&#x2F;code&gt;, and &lt;code&gt;put&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Decode response value.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;interfaces&quot;&gt;Interfaces&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;irequestmethodtypes-sol&quot;&gt;&lt;code&gt;IRequestMethodTypes.sol&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; &amp;gt;=0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;Types.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IRequestMethodTypes&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Requested method type.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * GET, POST, PUT, OPTIONS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MethodTypes&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        GET&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        POST&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        PUT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        OPTIONS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Response data event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _response&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the response value of the post request or put request.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Response&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _response&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Get method names based on request method type.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _methodTypes&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the request method type.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Method&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; names.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getMethods&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;MethodTypes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _methodTypes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Get the data types of request parameters and return parameters based on the requested method name.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _methodName&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the method name.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; types of request parameters and return parameters.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getMethodReqAndRes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _methodName&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Types&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;Type&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; ,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Types&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;Type&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Get the instruction of method based on the requested method name.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _methodName&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the method name.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; instruction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getMethodInstruction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _methodName&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Request the contract to retrieve records.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _methodName&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the method name.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _methodReq&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the method type.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; response to the get request.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _methodName&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _methodReq&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Request the contract to create a new record.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _methodName&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the method name.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _methodReq&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the method type.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; response to the post request.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; post&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _methodName&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _methodReq&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Request the contract to update a record.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _methodName&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the method name.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _methodReq&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the method type.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; response to the put request.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; put&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _methodName&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _methodReq&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Supported request method types.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Method&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; types.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; options&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;MethodTypes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;library&quot;&gt;Library&lt;&#x2F;h3&gt;
&lt;p&gt;The library &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7654&#x2F;.&#x2F;assets&#x2F;Types.sol&quot;&gt;&lt;code&gt;Types.sol&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; contains an enumeration of Solidity types used in the above interfaces.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;type-of-request-method&quot;&gt;Type of request method&lt;&#x2F;h3&gt;
&lt;p&gt;In order to enable the client to operate the contract in a standardized and predictable way, three request method types &lt;code&gt;GET&lt;&#x2F;code&gt;, &lt;code&gt;POST&lt;&#x2F;code&gt;, and &lt;code&gt;PUT&lt;&#x2F;code&gt; are set. The functions of each need to be defined in these three types to facilitate the contract caller to understand and process the information required for the request. However, there is no &lt;code&gt;DELETE&lt;&#x2F;code&gt; operation type because deleting data in the contract is an inefficient operation. Developers can add a &lt;code&gt;PUT&lt;&#x2F;code&gt; request method by themselves to set the data to be valid and invalid, and only return valid data in the &lt;code&gt;GET&lt;&#x2F;code&gt; method.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;request-method-parameter-type&quot;&gt;Request method parameter type&lt;&#x2F;h3&gt;
&lt;p&gt;Some functions are defined in each request method type. They all include request parameter data type and response parameter data type, which need to be set in the &lt;code&gt;constructor&lt;&#x2F;code&gt; and then obtained according to the method name through &lt;code&gt;getMethodReqAndRes&lt;&#x2F;code&gt;. The data type of the parameter is defined by the enumeration of the data type. When processing the request parameter, &lt;code&gt;abi.decode&lt;&#x2F;code&gt; is used to decode according to the request parameter type and the request value. When returning the response, &lt;code&gt;abi.encode&lt;&#x2F;code&gt; is used to encode according to the response value and the response parameter type. In addition, we can get the method usage instructions by calling &lt;code&gt;getMethodInstruction&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7654&#x2F;.&#x2F;assets&#x2F;RequestMethodTypes.sol&quot;&gt;Request Method Types Example&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Contract request methods are divided into safe methods and unsafe methods. If the method request is a read-only operation and will not change the state of the contract, then the method is safe.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Safe Methods:&lt;&#x2F;strong&gt; GET, OPTIONS&lt;br &#x2F;&gt;
&lt;strong&gt;Unsafe Methods:&lt;&#x2F;strong&gt; POST, PUT&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Programmable access lists</title>
        <published>2024-03-10T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Qi Zhou</name><uri>https://github.com/qizhou</uri>
	</author>
	
	<author>
		<name>Zhiqiang Xu</name><uri>https://github.com/zhiqiangxu</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7650/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7650-programmable-access-lists/19159" />
        

        <id>https://wg-eips.ritovision.com/7650/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7650"
            label="EIP-7650" />
        

        
        

        
        <summary type="html">Add a precompiled contract that add access lists programmatically</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7650/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;We introduce a new precompiled contract named &lt;code&gt;prefetch&lt;&#x2F;code&gt;, which accepts an &lt;code&gt;accessList&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;accessList&lt;&#x2F;code&gt; specifies a list of addresses and local storage keys; these addresses and local storage keys are added into the &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt; and &lt;code&gt;accessed_storage_keys&lt;&#x2F;code&gt; global sets (introduced in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;). Similar to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930&lt;&#x2F;a&gt;, prefetching data through this precompile incurs a gas charge, albeit at a reduced rate compared to accesses made outside of this list.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The primary goal of this EIP is to enhance EIP-2930 by enabling contracts to add access lists programmatically. The advantage of implementing this precompile within a contract is the sustained reduction in gas costs for data access operations, leveraging the concurrent computing and IOs that most nodes have.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;TBD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;PREFETCH_PRECOMPILE_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;TBD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CONCURRENCY&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;TBD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;As of &lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt;, a new precompile is deployed at &lt;code&gt;PREFETCH_PRECOMPILE_ADDRESS&lt;&#x2F;code&gt;.  The encoding of the precompile input is the following:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[32 bytes for local storage key length n][n * 32 bytes local storage keys][32 bytes for address length m][m * 32 bytes addresses]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;At the beginning of the call, we will charge &lt;code&gt;2100 * (N + CONCURRENCY - 1) &#x2F;&#x2F; CONCURRENCY + 2600 * (M + CONCURRENCY - 1) &#x2F;&#x2F; CONCURRENCY&lt;&#x2F;code&gt;, where &lt;code&gt;&#x2F;&#x2F;&lt;&#x2F;code&gt; is the integer division operator, &lt;code&gt;N&lt;&#x2F;code&gt; is the number of local storage keys not in &lt;code&gt;accessed_storage_keys&lt;&#x2F;code&gt; global set, and &lt;code&gt;M&lt;&#x2F;code&gt; is the number of addresses not in &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt; global set. The client should concurrently read the keys and addresses and put the keys and addresses into the &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt; and &lt;code&gt;accessed_storage_keys&lt;&#x2F;code&gt; global sets.  The following read cost of the storage keys and addresses obeys &lt;code&gt;WARM_STORAGE_READ_COST&lt;&#x2F;code&gt; as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;examples&quot;&gt;Examples&lt;&#x2F;h3&gt;
&lt;p&gt;Using UniswapV2 &lt;code&gt;swap()&lt;&#x2F;code&gt; function as an example:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; this low-level function should be called from a contract which performs important safety checks&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external lock {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        prefetch {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             token0.slot,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             token1.slot,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             reserve0.slot,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             price0CumulativeLast.slot,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             price1CumulativeLast.slot,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        } &#x2F;&#x2F; add the storage keys `accessed_storage_keys`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        prefetch {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             token0,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             token1,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        } &#x2F;&#x2F; add the contracts of token0 and token1 to `accessed_addresses`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;charging-less-for-accesses-in-the-access-list&quot;&gt;Charging less for accesses in the access list&lt;&#x2F;h3&gt;
&lt;p&gt;Similar to EIP-2930, we encourage contract developers to use the &lt;code&gt;prefetch&lt;&#x2F;code&gt; precompile as much as possible, especially assuming the nodes have some decent concurrent capabilities (e.g., some cores and IO bandwidth).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;allowing-duplicates&quot;&gt;Allowing duplicates&lt;&#x2F;h3&gt;
&lt;p&gt;Similar to EIP-2930, we allow duplicates in the list to maximize simplicity.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;no-storage-keys-for-external-contract&quot;&gt;No storage keys for external contract&lt;&#x2F;h3&gt;
&lt;p&gt;Unlike EIP-2930, the &lt;code&gt;prefetch&lt;&#x2F;code&gt; precompile only accepts local storage keys and addresses. Prefetching the data of the storage keys of external contracts assumes that the contract knows the storage layout of an external contract, which may not be a good practice. To better employ the concurrency of a node, the precompile may accept a list of static calls of external contracts together with the calldata.  This work may be done in the future EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;If the EIP is not yet implemented, a contract calling the precompile should result in no operation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;No security considerations were found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>ERC-721 Guarantee Extension</title>
        <published>2024-03-10T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Liu.C.Dao</name><uri>https://github.com/CDao</uri><email>iunknow@163.com</email>
	</author>
	
	<author>
		<name>Sam</name><email>1047180870@qq.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7652/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7652-eip-721-guarantee-extension/19284" />
        

        <id>https://wg-eips.ritovision.com/7652/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:7652"
            label="ERC-7652" />
        

        
        

        
        <summary type="html">Allow NFT holders to exchange their NFTs for circulating tokens at any time</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7652/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This specification defines functions outlining a guarantor role for instance of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt;. The guarantee interface implements the user-set valuation and guarantee share for a given NFT (token ID), as well as the guarantee rights enjoyed and obligations assumed during subsequent transactions. An implementation enables the user to read or set the current guarantee value for a given NFT (token ID), and also realizes the distribution of guarantee interest and the performance of guarantee obligations. It sends the standardized events when the status changes. This proposal relies on and extends the existing &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;NFT (token ID) commonly face the issue of insufficient market liquidity: the main reason being the lack of transparency in NFT pricing, making it difficult for users to cash out after trading and purchasing NFT (token ID).&lt;&#x2F;p&gt;
&lt;p&gt;With the introduction of the guarantor role, different guarantor groups can offer various price guarantees for NFT (token ID), establishing a multi-faceted price evaluation system for NFT (token ID).&lt;&#x2F;p&gt;
&lt;p&gt;After purchasing an NFT (token ID), users can return it to the guarantor at any time at the highest guaranteed price to protect their interests.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, after fulfilling their guarantee obligations, the guarantor can also request subsequent guarantors to provide guarantee obligations.&lt;&#x2F;p&gt;
&lt;p&gt;When an NFT (token ID) is owned by the guarantor, and since the guarantor can be a DAO organization, this expansion allows the NFT (token ID) to continue operating as a DAO, thus further enhancing the social or community recognition of the NFT (token ID).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;Every contract compliant to the &lt;code&gt;ERC721Guarantee&lt;&#x2F;code&gt; MUST implement the &lt;code&gt;IERC721Guarantee&lt;&#x2F;code&gt; guarantee interface.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;strong&gt;guarantee extension&lt;&#x2F;strong&gt;  is OPTIONAL for EIP-721 contracts.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.20&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; import {IERC721} from &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC721&#x2F;IERC721.sol&amp;quot;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; EIP-721 Guarantor Role extension&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;  Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the EIP-165 identifier for this interface is&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC721Guarantee&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;is IERC721&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;           Emitted when `guarantee contract` is established for an NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; user&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;       address of  guarantor&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      The guarantee value provided by dao&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; DAO&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;        DAO organization providing guarantee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    Guaranteed NFT (token ID),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; GuaranteeIsEstablshed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; DAO&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;           Emitted when `guarantee contract` is canceled&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;              Some users in the closed DAO request a reduction in their guarantee share&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; user&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;       address of  guarantor&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      The guarantee value provided by dao&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; DAO&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;        DAO organization providing guarantee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    Guaranteed NFT (token ID),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; GuaranteeIsCancel&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; DAO&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;           Emitted when `Guarantee sequence` is established for an NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; userGuaranteed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      address of guaranteed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; number&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  block.number of transaction,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                and all DAOs established before this point will enter the guarantee sequence&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; DAOs&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   DAO sequence providing guarantee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Guaranteed NFT (token ID),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; GuaranteeSequenceIsEstablshed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; userGuaranteed&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; number&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; DAOs&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   A user&amp;#39;s evaluation for an NFT (token ID)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      Set the guarantee information for one guarantor,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws if `_tokenId` is not a valid NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  user&amp;#39;s evaluation for  an NFT, the oledr value is canceled,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; user&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   address of guarantor&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; weight&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; guarantee weight for guarantor&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; error status of function execution&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setNFTGuarantedInfo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; weight&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   Establish guarantee sequence for an NFT (token ID) and split the commission&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      Each NFT(token ID) retains a current guarantee sequence,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;           and expired guarantee sequences are no longer valid,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;           Throws if `_tokenId` is not a valid NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; valueCommission&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Commission for a transactions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; userGuaranteed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   address of guaranteed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; number&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  block.number of transaction,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;              and all DAOs established before this point will enter the guarantee sequence&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; error status of function execution&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; establishNFTGuarantee&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; valueCommission&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; userGuaranteed&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; number&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   Transactions that fulfill the guarantee responsibility&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      The new accountability transaction also requires&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;           the construction of a new guarantee sequence&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;           Throws if `_tokenId` is not a valid NFT or userGuaranteed is not right&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  userGuaranteed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   address of guaranteed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; error status of function execution&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FulfillGuaranteeTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; userGuaranteed&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Key factors influencing the standard:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Pay attention to ensuring fairness between and within groups when allocating commissions&lt;&#x2F;li&gt;
&lt;li&gt;Keeping the number of guarantee groups (DAOs)in the interfaces to prevent contract bloat&lt;&#x2F;li&gt;
&lt;li&gt;The guarantee group is a DAO contract, which MUST implement the &lt;code&gt;ERC721TokenReceiver&lt;&#x2F;code&gt; interface&lt;&#x2F;li&gt;
&lt;li&gt;Simplicity&lt;&#x2F;li&gt;
&lt;li&gt;Gas Efficiency&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is compatible with current EIP-721 standards. There are no other standards that define a similar role for NFTs and the name (Guarantor) is not used by other EIP-721 related standards.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The reference implementation will be provided later.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Fractionally Represented Non-Fungible Token</title>
        <published>2024-03-05T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Acme</name><uri>https://github.com/0xacme</uri>
	</author>
	
	<author>
		<name>Calder</name><uri>https://github.com/caldereth</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7651/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7651-fractionally-represented-non-fungible-token/19176" />
        

        <id>https://wg-eips.ritovision.com/7651/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7651"
            label="ERC-7651" />
        

        
        

        
        <summary type="html">A specification for fractionally represented non-fungible tokens.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7651/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal introduces a standard for fractionally represented non-fungible tokens, allowing NFTs to be managed and owned fractionally within a single contract. This approach enables NFTs to coexist with an underlying fungible representation seamlessly, enhancing liquidity and access without dividing the NFT itself, or requiring an explicit conversion step. The standard includes mechanisms for both fractional and whole token transfers, approvals, and event emissions. This specification draws from design in both &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;, but is not fully compatible with either standard.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Fractional ownership of NFTs has historically relied on external protocols that manage division and reconstitution of individual NFTs into fractional representations. The approach of dividing specific NFTs results in fragmented liquidity of the total token supply, as the fractional representations of two NFTs are not equivalent and therefore must be traded separately. Additionally, this approach requires locking of fractionalized NFTs, preventing free transfer until they are reconstituted.&lt;&#x2F;p&gt;
&lt;p&gt;This standard offers a unified solution to fractional ownership, aiming to increase the liquidity and accessibility of NFTs without compromising transferability or flexibility.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;fractionally-represented-non-fungible-token-interface&quot;&gt;Fractionally Represented Non-Fungible Token Interface&lt;&#x2F;h3&gt;
&lt;p&gt;All &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7651&#x2F;&quot;&gt;ERC-7651&lt;&#x2F;a&gt; compliant contracts MUST implement the ERC-7651 and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; interfaces.&lt;&#x2F;p&gt;
&lt;p&gt;Compliant contracts MUST emit fractional Approval or Transfer events on approval or transfer of tokens in fractional representation.&lt;&#x2F;p&gt;
&lt;p&gt;Compliant contracts MUST additionally emit non-fungible ApprovalForAll, Approval or Transfer on approval for all, approval, and transfer in non-fungible representation.&lt;&#x2F;p&gt;
&lt;p&gt;Note that this interface draws from similarly defined functions in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; standards, but is not fully backwards compatible with either.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7651&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC165&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when fractional representation approval for a given spender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      is &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; or reaffirmed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FractionalApproval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when ownership of fractionally represented tokens changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      by any mechanism. This event emits when tokens are both created and destroyed,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      ie. when from and to are assigned to the zero address respectively.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FractionalTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when an operator is enabled or disabled for an owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      The operator can manage all NFTs of the owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ApprovalForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when the approved spender is &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; or reaffirmed for a given NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      A zero address emitted as spender implies that no addresses are approved for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      this token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NonFungibleApproval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when ownership of any NFT changes by any mechanism.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      This event emits when NFTs are both created and destroyed, ie. when&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      from and to are assigned to the zero address respectively.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NonFungibleTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Decimal places in fractional representation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Decimals are used as a means of determining when balances or amounts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      contain whole or purely fractional components&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Number&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; of decimal places used in fractional representation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; decimals&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; decimals&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The total supply of a token in fractional representation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The total supply of NFTs may be recovered by computing&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      `totalSupply() &#x2F; 10 ** decimals()`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Total&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; supply of the token in fractional representation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; totalSupply&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Balance of a given address in fractional representation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The total supply of NFTs may be recovered by computing&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      `totalSupply() &#x2F; 10 ** decimals()`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address that owns the tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; of a given address in fractional representation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; balance&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Query if an address is an authorized operator for another address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address that owns the NFTs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; operator_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address being checked for approval to act on behalf of the owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; True&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if `operator_` is an approved operator for `owner_`, false otherwise&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isApprovedForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator_&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; isApproved&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Query the allowed amount an address can spend for another address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address that owns tokens in fractional representation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; spender_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address being checked for allowance to spend on behalf of the owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; amount of tokens `spender_` is approved to spend on behalf of `owner_`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; allowance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender_&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; allowance&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Query the owner of a specific NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Tokens owned by the zero address are considered invalid and should revert on&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      ownership query.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; id_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The unique identifier for an NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address of the token&amp;#39;s owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Set approval for an address to spend a fractional amount,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         or to spend a specific NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; There must be no overlap between valid ids and fractional values.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws unless `msg.sender` is the current NFT owner, or an authorized&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      operator of the current owner if an id is provided.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws if the id is not a valid NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; spender_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The spender of a given token or value.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amountOrId_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A fractional value or id to approve.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Whether&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the approval operation was successful or not.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amountOrId_&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Set approval for a third party to manage all of the callers&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         non-fungible assets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; operator_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address to add to the callers authorized operator set&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; approved_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; True if the operator is approved, false if not approved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setApprovalForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approved_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfer fractional tokens or an NFT from one address to another&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; There must be no overlap between valid ids and fractional values&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The operation should revert if the caller is not `from_` or is not approved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      to spent the tokens or NFT owned by `from_`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The operation should revert if value is less than the balance of `from_` or&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      if the NFT is not owned by `from_`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws if the id is not a valid NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to transfer fractional tokens or an NFT from&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to transfer fractional tokens or an NFT to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amountOrId_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The fractional value or a distinct NFT id to transfer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; True&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if the operation was successful&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amountOrId_&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfer fractional tokens from one address to another&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The operation should revert if amount is less than the balance of `from_`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to transfer fractional tokens to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The fractional value to transfer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; True&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if the operation was successful&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfers the ownership of an NFT from one address to another address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws unless `msg.sender` is the current owner, an authorized&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      operator, or the approved address for this NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws if `from_` is not the current owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws if `to_` is the zero address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws if `tokenId_` is not a valid NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; When transfer is complete, this function checks if `to_` is a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      smart contract (code size &amp;gt; 0). If so, it calls `onERC721Received`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      on `to_` and throws if the return value is not&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      `bytes4(keccak256(&amp;quot;onERC721Received(address,uint256,bytes)&amp;quot;))`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to transfer the NFT from&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to transfer the NFT to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT to transfer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Additional data with no specified format, sent in call to `to_`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data_&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfers the ownership of an NFT from one address to another address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This is identical to the above function safeTransferFrom interface&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      though must pass empty bytes as data to `to_`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to transfer the NFT from&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to transfer the NFT to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT to transfer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC165&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Query if a contract implements an interface&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; interfaceID_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The interface identifier, as specified in ERC-165&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Interface identification is specified in ERC-165. This function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      uses less than 30,000 gas.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `true` if the contract implements `interfaceID` and&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         `interfaceID` is not 0xffffffff, `false` otherwise&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceID_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;fractionally-represented-non-fungible-token-metadata-interface&quot;&gt;Fractionally Represented Non-Fungible Token Metadata Interface&lt;&#x2F;h3&gt;
&lt;p&gt;This is a RECOMMENDED interface, identical in definition to the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; Metadata Interface. Rather than using this interface directly, a distinct metadata interface should be used here to avoid confusion surrounding ERC-721 inheritance. Given function definitions here are identical, it&#x27;s important to note that the ERC-165 &lt;code&gt;interfaceId&lt;&#x2F;code&gt; will be identical between metadata interfaces for this specification and that of ERC-721.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-7651 Fractional Non-Fungible Token Standard, optional metadata extension&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7651Metadata&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A descriptive, long-form name for a given token collection&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An abbreviated, short-form name for a given token collection&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; symbol&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; symbol&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A distinct Uniform Resource Identifier (URI) for a given asset.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws if `tokenId_` is not a valid NFT. URIs are defined in RFC&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      3986. The URI may point to a JSON file that conforms to the &amp;quot;ERC721&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      Metadata JSON Schema&amp;quot;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; id_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT to fetch a token URI for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; token&amp;#39;s URI as a string&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uri&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;fractionally-represented-non-fungible-token-banking-interface&quot;&gt;Fractionally Represented Non-Fungible Token Banking Interface&lt;&#x2F;h3&gt;
&lt;p&gt;This is a RECOMMENDED interface that is intended to be used by implementations of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7651&#x2F;&quot;&gt;ERC-7651&lt;&#x2F;a&gt; that implement NFT ID reuse.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7651NFTBanking&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the number of NFTs that have been minted but are not currently owned.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This should be the number of unowned NFTs, limited by the total&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      fractional supply.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; number of NFTs not currently owned.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getBankedNFTsLength&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bankedNFTsLength&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get a paginated list of NFTs that have been minted but are not currently owned.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; start_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Start index in bank.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; count_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Number of tokens to return from start index, inclusive.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; An&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of banked NFTs from `start_`, of maximum length `count_`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getBankedNFTs&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; start_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; count_&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bankedNFTs&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Query the current supply of NFTs in circulation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Given supply may remain banked or unminted, this function should always be&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      inclusively upper-bounded by `totalSupply() &#x2F; 10 ** decimals()`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; current supply of minted NFTs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalNonFungibleSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;unit256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;fractionally-represented-non-fungible-token-transfer-exemptable-interface&quot;&gt;Fractionally Represented Non-Fungible Token Transfer Exemptable Interface&lt;&#x2F;h3&gt;
&lt;p&gt;This is a RECOMMENDED interface that is intended to be used by implementations of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7651&#x2F;&quot;&gt;ERC-7651&lt;&#x2F;a&gt; that want to allow users to opt-out of NFT transfers.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7651NFTTransferExemptable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns whether an address is NFT transfer exempt.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to check.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Whether&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the address is NFT transfer exempt.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  isNFTTransferExempt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; account_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Allows an address to set themselves as NFT transfer exempt.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; isExempt_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The flag, true being exempt and false being non-exempt.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  setSelfNFTTransferExempt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt; isExempt_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This standard unifies the representation of fractional ownership with the non-fungible token model, aligning closely with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; principles while enabling the functionality of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; transfers. This dual compatibility aims to mitigate the integration complexity for existing protocols. Our goal is to implicitly support as high a degree of backwards compatibility with ERC-20 and ERC-721 standards as possible to reduce or negate integration lift for existing protocols. The core rationale for this fractional NFT standard centers on two main strategies: first, designing interfaces that clearly align with either ERC-721 or ERC-20 standards to avoid ambiguity; and second, detailing implementation approaches that distinctly separate the logic of overlapping functionalities.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;id-amount-isolation&quot;&gt;ID &amp;amp; Amount Isolation&lt;&#x2F;h3&gt;
&lt;p&gt;Ensuring clear differentiation between token IDs and fractional amounts is central to this design. This non-overlapping design principle means that no input should be ambiguously interpreted as both an ID and an amount. We won&#x27;t dive into implementation guidelines, but implementations may achieve this through various means, such as validating ownership for ID inputs or reserving specific ranges for token IDs.&lt;&#x2F;p&gt;
&lt;p&gt;This approach ensures that logic in &quot;overlapping&quot; interfaces is similarly isolated, such that the chance of an unexpected outcome is minimized.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;events&quot;&gt;Events&lt;&#x2F;h3&gt;
&lt;p&gt;The overlap of event signatures between the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; standards presents a challenge for backward compatibility in our fractional NFT standard. Various approaches have been explored, including aligning with a single standard&#x27;s events or introducing unique events with distinct parameter indexing to resolve conflicts.&lt;&#x2F;p&gt;
&lt;p&gt;We feel that when moving towards standardization, ensuring events are properly descriptive and isolated is the ideal solution despite introducing complexity for indexing software. As a result, we adhere to traditional transfer and approval event definitions, though distinguish these events by the &lt;code&gt;Fractional&lt;&#x2F;code&gt; or &lt;code&gt;NonFungible&lt;&#x2F;code&gt; prefixes.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;transfers&quot;&gt;Transfers&lt;&#x2F;h3&gt;
&lt;p&gt;In a standard &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7651&#x2F;&quot;&gt;ERC-7651&lt;&#x2F;a&gt; transfer, value can be transferred by specifying either a fractional amount or a specific NFT ID.&lt;&#x2F;p&gt;
&lt;p&gt;NFT ID Transfers: Transferring by NFT ID is straightforward. The specified NFT, along with its entire associated fractional value (equivalent to 10 ** decimals()), is transferred from the sender to the recipient.&lt;&#x2F;p&gt;
&lt;p&gt;Fractional Amount Transfers: Transferring fractional amounts introduces complexity in managing NFT allocations. There are three main scenarios:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;No change in whole token balance: If the transfer does not change the overall balance of either party, NFT allocations remain unchanged.&lt;&#x2F;li&gt;
&lt;li&gt;Sender&#x27;s whole token balance decreases: If the sender&#x27;s overall balance decreases below the nearest whole number, a proportionate number of NFTs must be removed from their holdings.&lt;&#x2F;li&gt;
&lt;li&gt;Receiver&#x27;s whole token balance increases: Conversely, if the receiver&#x27;s overall balance increases above the nearest whole number, their NFT holdings must be proportionately increased.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;While &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7651&#x2F;&quot;&gt;ERC-7651&lt;&#x2F;a&gt; provides a broad framework for fractional NFTs, it does not prescribe specific methods for handling these scenarios. Common practices include monotonically minting or burning tokens to reflect changes, or tracking NFT ownership with a stack or queue during transfers of fractional amounts.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;nft-transfer-exemption&quot;&gt;NFT Transfer Exemption&lt;&#x2F;h3&gt;
&lt;p&gt;Transferring fractional amounts means that a large number of NFTs can be moved in a single transaction, which can be costly in gas usage. We recommend an optional opt-in mechanism for exemption from NFT transfers that both EOAs and contracts can use to reduce the gas burden of transferring large token amounts when the NFT representation is not needed.&lt;&#x2F;p&gt;
&lt;p&gt;When executing the function call to either opt-in or opt-out of NFT transfers, NFTs held by the address will be directionally rebalanced to ensure they stay in sync with the new exemption status. In other words, when opting-out of NFT transfers, an address&#x27;s NFTs will be banked and their NFT balance set to 0. When opting-in to NFT transfers, sufficient NFTs will be pulled from the bank and transferred to the address to match their fractional token balance.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;nft-banking&quot;&gt;NFT Banking&lt;&#x2F;h3&gt;
&lt;p&gt;As discussed in the Transfers section, when an address newly gains a full token in fractional terms, they are consequently owed an NFT. Similarly, when an address drops below a full token in fractional terms an NFT must be removed from their balance to stay in sync with their fractional balance.&lt;&#x2F;p&gt;
&lt;p&gt;The NFT banking mechanism provides a space in which un-owned but available NFTs relative to supply are tracked. We remain unopinionated on implementation here, but want to provide a handful of examples that would fit specification.&lt;&#x2F;p&gt;
&lt;p&gt;One approach to reconcile the bank is by monotonically burning and minting NFT IDs as they are pulled from and added back to circulation, respectively. The minting portion of this strategy can incur significant gas costs that are generally not made up for by the slight gas refund of deleting storage space for burnt token IDs. This approach additionally introduces inflexibility for collections that desire a persistent, finite ID space.&lt;&#x2F;p&gt;
&lt;p&gt;An alternate implementation of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7651&#x2F;&quot;&gt;ERC-7651&lt;&#x2F;a&gt; includes a mechanism to store and reuse IDs rather than repeatedly burning and minting them. This saves significant gas costs, and has the added benefit of providing a predictable and externally readable stream of token IDs that can be held in a queue, stack or other data structure for later reuse. The specific data structure used for this banking mechanism is immaterial and is left at the discretion of any implementations adhering to the standard.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;erc-165-interface&quot;&gt;ERC-165 Interface&lt;&#x2F;h3&gt;
&lt;p&gt;We include the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; interface in specification both to adhere to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; design philosophy, and as a means of exposing interfaces at the contract level. We see this as a valuable, accepted standard to adhere to such that integrating applications may identify underlying specification.&lt;&#x2F;p&gt;
&lt;p&gt;Note that &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7651&#x2F;&quot;&gt;ERC-7651&lt;&#x2F;a&gt; contracts should not make any claim through &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; to support &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; standards as, despite strong backwards compatibility efforts, these contracts cannot fully adhere to existing specifications.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;metadata&quot;&gt;Metadata&lt;&#x2F;h3&gt;
&lt;p&gt;In-line with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;, we&#x27;ve decided to isolate replicated metadata functionality through a separate interface. This interface includes traditional naming and token URI logic, though also introduces patterns surrounding token banking visibility, as outlined above in both the NFT Banking and Transfer Logic sections.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The fractional non-fungible token standard aims to be nearly backwards compatible with existing &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; standards, though makes no claim to fully adhere to either and has as such been proposed through a distinct interface.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;events-1&quot;&gt;Events&lt;&#x2F;h3&gt;
&lt;p&gt;Events in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; specifications share conflicting signatures on approval and transfer, meaning an adherent hybrid of the two cannot be achieved.&lt;&#x2F;p&gt;
&lt;p&gt;This is one of the few areas where backwards compatibility has been intentionally broken, resulting in a new series of events with either a &lt;code&gt;Fractional&lt;&#x2F;code&gt; or &lt;code&gt;NonFungible&lt;&#x2F;code&gt; prefix. We believe that a decisive move to a non-conflicting, descriptive solution is ideal here, though will require external lift for indexing software.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;balanceof&quot;&gt;balanceOf&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;balanceOf&lt;&#x2F;code&gt; function as defined in both &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; standards varies, in practice, to represent either fractional or whole token ownership respectively. Given fractional non-fungible tokens should adhere to an underlying fractional representation, it follows that this function should return a balance in that representation. This does, however, imply that fractional NFT contracts cannot fully adhere to the &lt;code&gt;balanceOf&lt;&#x2F;code&gt; specification provided by ERC-721.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;success-return-values&quot;&gt;Success Return Values&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;transfer&lt;&#x2F;code&gt; and &lt;code&gt;approve&lt;&#x2F;code&gt; functions both return a boolean value indicating success or failure. This is non-standard for the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; specification, though is standard for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;. Fractional non-fungible tokens adhere to a returned boolean value to meet minimum expectations for the ERC-20 standard, acknowledging that this deviates from a state of ideal backwards compatibility.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;interface-misinterpretation&quot;&gt;Interface Misinterpretation&lt;&#x2F;h3&gt;
&lt;p&gt;This section is placeholder for further discussion surrounding the misidentification of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7651&#x2F;&quot;&gt;ERC-7651&lt;&#x2F;a&gt; as being either ERC-20 or ERC-721. Namely, discussion surrounding potential security implications of interface misinterpretation need to be thoroughly considered.&lt;&#x2F;p&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Alias ORIGIN to SENDER</title>
        <published>2024-03-03T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Cyrus Adkisson</name><uri>https://github.com/cyrusadkisson</uri>
	</author>
	
	<author>
		<name>Eirik Ulversøy</name><uri>https://github.com/EirikUlversoy</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7645/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7645-alias-origin-to-sender/19047" />
        

        <id>https://wg-eips.ritovision.com/7645/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7645"
            label="EIP-7645" />
        

        
        

        
        <summary type="html">Eliminate ORIGIN tech debt to lay groundwork for account abstraction and close security holes</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7645/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes aliasing the ORIGIN opcode to the SENDER opcode within the Ethereum Virtual Machine (EVM). The purpose of this change is to move Ethereum closer to enabling account abstraction by harmonizing the treatment of externally owned accounts (EOAs) and smart contracts and to address the security concerns associated with the use of ORIGIN that have and will continue to surface in all or most account abstraction proposals.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The ORIGIN opcode in Ethereum returns the address of the account that started the transaction chain, differing from the SENDER (or CALLER) opcode, which returns the address of the direct caller. The use of ORIGIN has been discouraged and deemed deprecated since mid-2016 due to the security problems it introduces, such as susceptibility to phishing attacks and other vulnerabilities where the distinction between the original sender and the immediate sender can be exploited.&lt;&#x2F;p&gt;
&lt;p&gt;For instance, if an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt; bundler has tokens or other authority in a smart contract determined by ORIGIN, any of the transactions it bundles can hijack this authority since ORIGIN remains the bundler address throughout each child transaction.&lt;&#x2F;p&gt;
&lt;p&gt;More apropos in the current context of EVM evolution, the differentiation between the ORIGIN and SENDER opcodes presents a challenge for all account abstraction efforts, such as those outlined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7377&#x2F;&quot;&gt;EIP-7377&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3074&#x2F;&quot;&gt;EIP-3074&lt;&#x2F;a&gt;, because any move towards account abstraction must address the ORIGIN opcode&#x27;s role, either by modifying or completely bypassing it. Without addressing this, the ORIGIN opcode stands as a barrier to the evolution of Ethereum&#x27;s account model towards greater flexibility and functionality.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP proposes the alteration of the behavior of the ORIGIN opcode within the Ethereum Virtual Machine (EVM). Currently, the ORIGIN opcode returns the address of the original transaction initiator. Under this EIP, the ORIGIN opcode would, instead, return the same value as the SENDER opcode, which is the address of the immediate sender of the message or transaction.&lt;&#x2F;p&gt;
&lt;p&gt;Definition Change: The ORIGIN opcode (0x32) MUST, in all contexts of execution, return the same value as that returned by the SENDER (also known as CALLER) opcode (0x33).&lt;&#x2F;p&gt;
&lt;p&gt;EVM Implementation: All Ethereum clients MUST implement the following change to the EVM: Whenever the ORIGIN opcode is called, the value to be pushed onto the stack is the current call&#x27;s sender address, as if the SENDER opcode was executed instead.&lt;&#x2F;p&gt;
&lt;p&gt;Transaction Validation: Transactions MUST be validated as before, with no changes to the transaction structure or processing logic beyond the EVM opcode behavior specified above.&lt;&#x2F;p&gt;
&lt;p&gt;Compatibility: Smart contracts relying on the ORIGIN opcode for obtaining the transaction initiator&#x27;s address MUST be reviewed to ensure they function correctly under the new definition and worked-around or avoided if this EIP introduces breaking changes.&lt;&#x2F;p&gt;
&lt;p&gt;Implementers are encouraged to provide feedback on this specification and report any potential issues encountered during the implementation or testing phases.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The rationale behind aliasing ORIGIN to SENDER is to:&lt;&#x2F;p&gt;
&lt;p&gt;Facilitate Account Abstraction: Elegantly nullify a universal barrier to account abstraction, enabling more flexible and powerful account models in Ethereum.&lt;&#x2F;p&gt;
&lt;p&gt;Enhance Security: Eliminate the security vulnerabilities associated with differentiating between the original transaction initiator and the immediate caller.&lt;&#x2F;p&gt;
&lt;p&gt;Clean up tech debt and simplify the EVM Model: Reduce the complexity of the EVM&#x27;s transaction and execution model by removing an outdated and deprecated feature, making future changes easier and safer.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change is not fully backwards compatible. Contracts relying on the distinction between ORIGIN and SENDER for logic or security will be affected. However, given the longstanding discouragement of ORIGIN&#x27;s use, the minimal impact of the change, the widespread desire for a future account abstraction solution in the EVM, and the reality that any AA solution will ultimately have to deal with ORIGIN one way or the other, this incompatibility is considered a necessary step forward for Ethereum&#x27;s development.&lt;&#x2F;p&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;For each CALL, STATICCALL, DELEGATECALL, CALLCODE:&lt;&#x2F;p&gt;
&lt;p&gt;Direct - Ensure that, at the target smart contract, ORIGIN and SENDER produce the same value. (For simple no-hop EOA-to-EOA&#x2F;SCA transactions, this is already the case today.)&lt;&#x2F;p&gt;
&lt;p&gt;Multi-hop - Ensure that, at each frame in a multi-hop transaction, ORIGIN and SENDER produce the same value.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;By aliasing ORIGIN to SENDER, the specific security vulnerabilities associated with the ORIGIN opcode are addressed and eliminated. Outside the scope of this EIP, it may be wise to ban all use of ORIGIN to eliminate further misunderstanding or misuse. This can be done via tooling changes outside the EVM or, inside the EVM, reverting smart contract deployments that use ORIGIN.&lt;&#x2F;p&gt;
&lt;p&gt;For existing misuse of ORIGIN affected negatively by this aliasing to SENDER (of yet a clear example has yet to be identified), it may be necessary to educate users to avoid this problematic legacy code.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>ERC-721 Name Registry Extension</title>
        <published>2024-03-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Chen Liaoyuan</name><uri>https://github.com/chenly</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7644/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7644-erc-721-name-registry-extension/19022" />
        

        <id>https://wg-eips.ritovision.com/7644/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:7644"
            label="ERC-7644" />
        

        
        

        
        <summary type="html">Extend a time-limited unique name to each token within ERC-721, utilizing the name registry for registration and management.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7644/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This extension defines an interface that adds a naming mechanism to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; tokens. It allows each token to have a unique name with a set expiration date, ensuring uniqueness within the current NFT contract. The interface includes functions for assigning, updating, and querying names and their associated tokens, ensuring that names remain unique until they expire. The entity responsible for setting names depends on the specific use case scenario when utilizing this extension.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;As decentralized domain registration methods evolve with the integration of NFTs, we see an opportunity to extend this paradigm to the realm of usernames. By associating token IDs with usernames, we enhance the intuitive identification of entities within decentralized ecosystems.&lt;&#x2F;p&gt;
&lt;p&gt;This integration serves multiple purposes:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Intuitiveness:&lt;&#x2F;strong&gt; Numeric token IDs lack intuitive identification. By incorporating usernames, token IDs become more representative, improving usability.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Username Economy Exploration:&lt;&#x2F;strong&gt; The registration mechanism opens avenues for exploring the username economy, offering benefits such as identity verification and social interactions.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Synergy with NFTs:&lt;&#x2F;strong&gt; The fusion of usernames with NFTs unlocks synergistic growth, enabling novel applications like authenticated social interactions and personalized digital assets.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;Implementers of this extension &lt;strong&gt;MUST&lt;&#x2F;strong&gt; have all of the following functions:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; INameRegistry&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Interface for the NameRegistry smart contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * This interface allows interaction with a NameRegistry, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * enabling the registration, management, and lookup of names &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * with associated expiry dates tied to specific tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7644&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is IERC721 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when the name of a token is &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token ID whose name is &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; oldName&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The previous name of the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; newName&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The new name assigned to the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; expiryDate&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The expiry date of the new name registration.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NameChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; oldName&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newName&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expiryDate&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the name of the specified token, if the name has not expired.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token ID to query for its name.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; name of the token, or an empty bytes32 if no name is set or it has expired.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; nameOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the token ID associated with a given name, if the name registration has not expired.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _name&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The name to query for its associated token ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; token ID associated with the name, or zero if no token is found or the name has expired.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenIdOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _name&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Allows a token owner to set or update the name of their token, subject to a duration for the name&amp;#39;s validity.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token ID whose name is to be set or updated.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _name&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The new name to assign to the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; duration&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The duration in seconds for which the name is valid, starting from the time of calling this function.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: The name must be unique and not currently in use by an active (non-expired) registration.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setName&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; duration&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the tokenId and expiryDate for a given name, if the name registration has not expired.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _name&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The name to query for its associated token ID and expiry date.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token ID associated with the name.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; expiryDate&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The expiry date of the name registration.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; nameInfo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _name&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expiryDate&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h4 id=&quot;name-expiry&quot;&gt;Name Expiry&lt;&#x2F;h4&gt;
&lt;p&gt;By implementing expiration periods for usernames, we introduce several advantages. This mechanism ensures a dynamic environment where unused or outdated usernames can be released, fostering a healthy ecosystem. It encourages turnover of usernames, preventing long-term hoarding and promoting active participation. Users are motivated to manage their username portfolio, renewing valuable names while relinquishing irrelevant ones. Ultimately, this fosters fairness and efficiency, ensuring naming resources are utilized effectively and refreshed to meet evolving needs.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;name-uniqueness&quot;&gt;Name Uniqueness&lt;&#x2F;h4&gt;
&lt;p&gt;Enforcing unique usernames is crucial for maintaining a clear and intuitive identification system. It prevents confusion and enables seamless interactions within decentralized ecosystems. Unique usernames enhance discoverability and facilitate trust in transactions and social interactions. This requirement underscores the importance of clarity in decentralized environments, where precise identification is essential for building trust and facilitating efficient interactions.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;name-registration-system&quot;&gt;Name Registration System&lt;&#x2F;h4&gt;
&lt;p&gt;Introducing a registration system for usernames safeguards against abusive behaviors and promotes fair access to naming resources. Reservation and renewal mechanisms prevent monopolization of desirable usernames while enabling legitimate users to secure names of interest. Reservation ensures fair opportunities to claim desired usernames, preventing hoarding and speculative activities. Renewal mechanisms encourage active engagement and investment in the naming ecosystem. Together, these features create a balanced and inclusive environment, fostering a vibrant community of users.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is fully &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; compatible.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC721&#x2F;ERC721.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC7644&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NameChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; oldName&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newName&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expiryDate&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NameRegistration&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; expiryDate&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _tokenNames&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; NameRegistration&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _nameRegistrations&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _lastSetNameTime&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; MAX_DURATION &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 365&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; days&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; MIN_SET_NAME_INTERVAL &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; days&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;&amp;quot;Asd Token&amp;quot;, &amp;quot;ASDT&amp;quot;) &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; nameOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_tokenNames&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; _nameRegistrations&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_tokenNames&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;expiryDate &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; _tokenNames&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenIdOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _name&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_nameRegistrations&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_name&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;expiryDate &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;NameRegistry: Name expired&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_nameRegistrations&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_name&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;tokenId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; _nameRegistrations&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_name&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setName&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; duration&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;NameRegistry: Caller is not the token owner&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;duration &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; MAX_DURATION&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;NameRegistry: Duration exceeds maximum limit&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt; _lastSetNameTime&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; MIN_SET_NAME_INTERVAL&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;NameRegistry: Minimum interval not met&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;tokenIdOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_name&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenIdOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_name&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;NameRegistry: Name already in use and not expired&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; oldName &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _tokenNames&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; expiryDate &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt; duration&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _setTokenName&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; expiryDate&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NameChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; oldName&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; expiryDate&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _lastSetNameTime&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; nameInfo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _name&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_nameRegistrations&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_name&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;tokenId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; _nameRegistrations&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_name&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;expiryDate &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;NameRegistry: Name expired or does not exist&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        NameRegistration &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;memory&lt;&#x2F;span&gt;&lt;span&gt; registration &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _nameRegistrations&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_name&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;registration&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; registration&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;expiryDate&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _setTokenName&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expiryDate&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _tokenNames&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; _name&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _nameRegistrations&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_name&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NameRegistration&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; expiryDate&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h4 id=&quot;mitigating-abusive-behaviors-and-resource-hoarding&quot;&gt;Mitigating Abusive Behaviors and Resource Hoarding&lt;&#x2F;h4&gt;
&lt;p&gt;The design includes mechanisms to prevent abusive behaviors and resource hoarding. Minimum intervals for name setting and maximum durations for name expiry are established to deter spam and malicious attacks, limit rapid consecutive name registrations, and encourage fair and efficient use of naming resources. These measures mitigate potential security risks, ensuring names cannot be monopolized indefinitely and promoting a sustainable and equitable environment for all users.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;username-restrictions&quot;&gt;Username Restrictions&lt;&#x2F;h4&gt;
&lt;p&gt;To facilitate indexing and gas efficiency, usernames should adhere to a length constraint of 3 to 32 characters. This range prevents the registration of overly long names, which can be costly in terms of gas and difficult to manage. Limiting characters to the range of [a-zA-Z0-9] enhances readability and prevents the abuse of the naming system by restricting the use of special characters that could complicate domain resolution or user recognition. Implementing these constraints not only promotes a high level of usability within the ecosystem but also guards against the proliferation of spam registrations, ensuring that the registry remains accessible and functional for genuine users.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>eth&#x2F;69 - history expiry and simpler receipts</title>
        <published>2024-02-29T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Marius van der Wijden</name><uri>https://github.com/MariusVanDerWijden</uri>
	</author>
	
	<author>
		<name>Felix Lange</name><email>fjl@ethereum.org</email>
	</author>
	
	<author>
		<name>Ahmad Bitar</name><uri>https://github.com/smartprogrammer93</uri><email>smartprogrammer@windowslive.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7642/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eth-70-drop-pre-merge-fields-from-eth-protocol/19005" />
        

        <id>https://wg-eips.ritovision.com/7642/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="networking"
                label="Networking" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7642"
            label="EIP-7642" />
        

        
        

        
        <summary type="html">Adds history serving window and removes bloom filter in receipt</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7642/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP modifies the &#x27;eth&#x27; p2p protocol to announce the historical block range served by
the node. We also simplify the handshake to remove total difficulty information, which
isn&#x27;t used anymore after the merge. Additionally we propose to remove the &lt;code&gt;Bloom&lt;&#x2F;code&gt; field
from receipts transferred over the protocol.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;block-range-in-status-message&quot;&gt;Block range in Status message&lt;&#x2F;h3&gt;
&lt;p&gt;In the history expiry working group, it was decided that clients may drop pre-merge
history from their storage after May 1, 2025. For clients that want to sync history
through the &#x27;eth&#x27; protocol, it is essential to know whether a peer still serves old
history. A similar idea was proposed in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7542&#x2F;&quot;&gt;EIP-7542&lt;&#x2F;a&gt; but was later withdrawn
because a political decision on history expiry had not been reached at the time.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;removing-bloom-in-receipts&quot;&gt;Removing Bloom in Receipts&lt;&#x2F;h3&gt;
&lt;p&gt;We recently discovered that none of the clients store the &lt;code&gt;Bloom&lt;&#x2F;code&gt; field of the receipts as
it can be recomputed on demand. However the networking spec requires the &lt;code&gt;Bloom&lt;&#x2F;code&gt; field to
be sent over the network. Thus a syncing node will ask for the Bloom filters for all
receipts. The serving node will regenerate roughly 530GB of bloom filters (2.3B txs * 256
byte). These 530GBs are send over the network to the syncing peer, the syncing peer will
verify them and not store them either. This adds an additional 530GB of unnecessary
bandwidth to every sync.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;blockrangeupdate-message&quot;&gt;BlockRangeUpdate message&lt;&#x2F;h3&gt;
&lt;p&gt;We want clients to be aware of the available block range in their peers. The new
notification message can be used to detect sync status of peers, and adjust fetching
behavior accordingly.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;status-message-changes&quot;&gt;Status message changes&lt;&#x2F;h3&gt;
&lt;p&gt;Modify the &lt;code&gt;Status (0x00)&lt;&#x2F;code&gt; message as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;(eth&#x2F;68): &lt;code&gt;[version: P, networkid: P, td: P, blockhash: B_32, genesis: B_32, forkid]&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;(eth&#x2F;69): &lt;code&gt;[version: P, networkid: P, genesis: B_32, forkid, earliestBlock: P, latestBlock: P, latestBlockHash: B_32]&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note &lt;code&gt;blockhash&lt;&#x2F;code&gt; has moved to the end to match &lt;code&gt;BlockRangeUpdate&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;receipts-message-changes&quot;&gt;Receipts message changes&lt;&#x2F;h3&gt;
&lt;p&gt;Modify the encoding for receipts in the &lt;code&gt;Receipts (0x10)&lt;&#x2F;code&gt; message as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;(eth&#x2F;68): &lt;code&gt;receipt = {legacy-receipt, typed-receipt}&lt;&#x2F;code&gt; with&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;typed-receipt = tx-type || rlp(legacy-receipt)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;legacy-receipt = [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    post-state-or-status: {B_32, {0, 1}},&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    cumulative-gas: P,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bloom: B_256,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    logs: [log₁, log₂, ...]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;(eth&#x2F;69): &lt;code&gt;receipt = [tx-type, post-state-or-status, cumulative-gas, logs]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;blockrangeupdate-message-1&quot;&gt;BlockRangeUpdate message&lt;&#x2F;h3&gt;
&lt;p&gt;Add a new &lt;code&gt;BlockRangeUpdate (0x11)&lt;&#x2F;code&gt; message, with the following encoding&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;[earliestBlock: P, latestBlock: P, latestBlockHash: B_32]&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The new message should be sent whenever the block range available from this client is
updated. In order to reduce traffic, it is not necessary to send an update for every new
block. Clients should send an update at most once per epoch (32 blocks).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;status-changes&quot;&gt;Status changes&lt;&#x2F;h3&gt;
&lt;p&gt;After the merge, the &lt;code&gt;TD&lt;&#x2F;code&gt; field of the &lt;code&gt;Status&lt;&#x2F;code&gt; message became meaningless since the
difficulty of post-merge blocks are 0. It could in theory be used to distinguish synced
with unsynced nodes, but the same thing can be accomplished with the forkid as well.&lt;&#x2F;p&gt;
&lt;p&gt;The new &lt;code&gt;earliestBlock&lt;&#x2F;code&gt; field is technically not required for history expiry, but there
are a couple reasons why adding it can help:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;It improves peer finding for clients that still want to sync history from p2p after the
agreed-upon removal of pre-merge history has taken place. Without &lt;code&gt;earliestBlock&lt;&#x2F;code&gt;, the
client would have to perform a request for history to check if the earlier range exists,
and assume that a failed request means it&#x27;s not there.&lt;&#x2F;li&gt;
&lt;li&gt;The new field can be used for census in a specialized crawler. We will be able to see
how many users&#x2F;nodes enable history, and in which implementation.&lt;&#x2F;li&gt;
&lt;li&gt;It prepares us for a future where the history expiry window is dynamic.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;receipts-changes&quot;&gt;Receipts changes&lt;&#x2F;h3&gt;
&lt;p&gt;Removing the bloom filters from the &lt;code&gt;Receipt&lt;&#x2F;code&gt; message reduces the CPU load of serving
nodes as well as the bandwidth significantly. The receiving nodes will need to recompute
the bloom filter in order to fully verify the receipt hash. The recomputation is not very
CPU intensive. The bandwidth gains amount to roughly 530GiB per syncing node or (at least)
95GiB snappy compressed.&lt;&#x2F;p&gt;
&lt;p&gt;In Ethereum consensus, the encoding of receipts differs between legacy transactions and
typed transactions. Typed transaction receipts are &#x27;opaque&#x27; and have the data wrapped in a
byte array. However, all receipt types ultimately contain the same four fields. With the
removal of the bloom filter, the networking protocol now deviates from the encoding used
by consensus, and there is no need to replicate the weird and expensive encoding used
there. The proposed receipt encoding is just a flat list of the required data fields.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP changes the eth protocol and requires rolling out a new version, &lt;code&gt;eth&#x2F;69&lt;&#x2F;code&gt;.
Supporting multiple versions of a wire protocol is possible. Rolling out a new version
does not break older clients immediately, since they can keep using protocol version
&lt;code&gt;eth&#x2F;68&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP does not change consensus rules of the EVM and does not require a hard fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;None&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>History accumulator for pre-PoS data</title>
        <published>2024-02-29T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>lightclient</name><uri>https://github.com/lightclient</uri>
	</author>
	
	<author>
		<name>kdeme</name><uri>https://github.com/kdeme</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7643/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7643-history-accumulator-for-pre-pos-data/19014" />
        

        <id>https://wg-eips.ritovision.com/7643/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7643"
            label="EIP-7643" />
        

        
        

        
        <summary type="html">Commit to a single root for all block data before the merge.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7643/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Defines an SSZ object for accumulating all pre-PoS data and commit to the
historical hashes accumulator&#x27;s root
&lt;code&gt;0xec8e040fd6c557b41ca8ddd38f7e9d58a9281918dc92bdb72342a38fb085e701&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;There are two main uses we consider for the historical hashes accumulator:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;for users who wish to download the pre-PoS data for the execution chain and
verify it without executing each block, they may simply compute each block
hash, accumulate the epoch records, and then compare the local accumulator
root with the expected value.&lt;&#x2F;li&gt;
&lt;li&gt;additionally, the accumulator root allows for &lt;code&gt;O(log(n))&lt;&#x2F;code&gt; sized proofs to any
pre-PoS block, whereas today to achieve something similar, one must
recursively verify the header chain.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;historical-hashes-accumulator&quot;&gt;Historical Hashes Accumulator&lt;&#x2F;h3&gt;
&lt;p&gt;The historical hashes accumulator commits to the set of pre-merge headers and their
associated total difficulty. The format for this data is defined as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;EPOCH_SIZE&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 8192&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; blocks&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;MAX_HISTORICAL_EPOCHS&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2048&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An individual record for a historical header.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;HeaderRecord&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Container&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;block_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; total_difficulty&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The records of the headers from within a single epoch&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;EpochRecord&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;HeaderRecord&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; max_length&lt;&#x2F;span&gt;&lt;span&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;EPOCH_SIZE&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;HistoricalHashesAccumulator&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Container&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    historical_epochs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; max_length&lt;&#x2F;span&gt;&lt;span&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;MAX_HISTORICAL_EPOCHS&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    current_epoch&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; EpochRecord&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;pre-pos-root&quot;&gt;Pre-PoS Root&lt;&#x2F;h3&gt;
&lt;p&gt;The hash tree root of &lt;code&gt;HistoricalHashesAccumulator&lt;&#x2F;code&gt; for data before block 15537394 is
&lt;code&gt;0xec8e040fd6c557b41ca8ddd38f7e9d58a9281918dc92bdb72342a38fb085e701&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;inclusion-of-total-difficulty&quot;&gt;Inclusion of total difficulty&lt;&#x2F;h3&gt;
&lt;p&gt;The total difficulty allowed so that clients may return the value for specific
JSON-RPC methods which support it. It is also useful for verifying the TTD of
the final proof-of-work block.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;n&#x2F;a&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;csv&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;epoch,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00000,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5ec1ffb8c3b146f42606c74ced973dc16ec5a107c0345858c343fc94780b4218&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00001,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa5364e9a9bc513c4601f0d62e6b46dbdedf3200bbfae54d6350f46f2c7a01938&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00002,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x98cbd8a95ae7dc9c1ed823156d0eab9aaffa869f6852cab18ff0083063f27d26&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00003,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd8b8a40b8cf6818e1bac871d882e772be0b28d1baaf72374946506d9e6fa7d75&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00004,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6e3baba7e324b99ed72d98f0255d25ce66832736550f8b971c12280eac2a0bb8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00005,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5cff5a4b7284b1a4a6cebfcc80d876ab0418f71254d03f91d46a9a1fab49fa09&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00006,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x678fb79306f84e9d0a4749323dc29934ca59b852fbc7c8d2890eabe8a0cde282&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00007,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd9bc682bc5bc63b20a8344407ae12cb17e2085d448f438efa6aa5d522b913a20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00008,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x12c9605f2d8d4738f9aa04fbecdbbbc8b77135ebfaa9db399135c14e1ef10bee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00009,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf9e4e8905b214c97bb4ed1f69178d6ecc769e21352885147fce5b671215db2a8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00010,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5f5d4516b7a38929b47ea7334b62b53829b9665d37f752d96c33fad0f7f78583&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00011,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x30f04eb968efe4079356b873e37f1657984717e60af612ecca95c98226528d54&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00012,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5ecb9bf9e193da08c7e7f22abcd50d1b4d3c2b909f980ac1315856cb48ca49cc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00013,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd0175c1ed6e694180c4c161ac7f06a913784daba14dc1d2e926f72def4f7f65d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00014,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4f92d78141b7fa8d6fcef45f9dbc611f858447629eeac2d63bb43d07e6bd1aca&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00015,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa47cb8eb7157d56f718a6896c2ee1843a44e3de81b9127e64b78fc38ee382310&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00016,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9344d8b785c0e619d0b1b83e5d7b3849d667f1ec0d0d6390d26fa33dd4cb31af&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00017,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x43963724de4a8917d16d8c6a663c38fcdcf3ce5b89a51bc766dcd0ffd1d5aa32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00018,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xefce27b480c92a0e7fec472fe38e87ed9a1c91c3d07324cc2f262de3916a38f6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00019,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf5434352253a7f35d909fb2c383e7cdad65761c509eec24741197b869ebcc212&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00020,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0c405203cb7b2e54b910e5d953b5378ff4f0c3bcebef92e7e3a1f240dd6703ee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00021,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x20d8f1af038c2777dea9f86fe9e33f14af9e4270ee20adb32e0dddedc4b85236&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00022,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb694d8955851f744e44c68fba193f6bc41d1159036531c5f55fac9ce91883695&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00023,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x11beacba76e467dda23253f104d064b00ab75672ab33cff6097be1c3e8ce7053&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00024,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf216a28afb2212269b634b9b44ff327a4a79f261640ff967f7e3283e3a184c70&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00025,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x987cb6206e5bae4b68ce0eeb6c05ae090d02b7331e47d1705a2a515ac88475aa&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00026,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3afd50ff0edf3cae577c42bfc39871f0f0ffe7bdd5ee0b96f7b2e879c9b29994&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00027,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x28083285c935c0c169ea1406f9830701ff20fde3d0b2a5b83efc1cd13139dccf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00028,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x362fc97cbcfa6ab609f1a3f8ca2f8a6e0ac6061c33e84a285a14713cfd73f203&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00029,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa0cb99e26e896f5d115914910c4c66fc112ae240bc827acdd564785e738ff29c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00030,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x78fc5e8e58e6dd726499295eea1f7f52a31979c6a003d48d4e027d95285e851c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00031,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x52306cf9ed840bea9d8c3466bfbed5ffecdfd51107f33d013a487c3b653b3646&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00032,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcb4d0c3a2384b890a8acd698da6b9ae6267c5365fcc516391829f7adbae838ee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00033,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0c3781bbc07124e29ff67754bdcf556b20ac4f4ef19ddb004837ec50193ce0bc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00034,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfac9315aa442073b647e71716a7acf1c170e5a0092b69edc2a5634813716592f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00035,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x737e07578f0dd5eeebd8313e58cdb59ac705c0ba07d842feace53fa2922c6508&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00036,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x84c7c1e7c4a8949247953858992012799d323ebcd0fc6cdecf8002f20f2ea7e1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00037,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x34d067652cbea843a01e70ba75566b6f174218969dc453c285e59b4f309faee8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00038,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x38aaf94c653d619b1a08e7cf9fac72ecc57715bc19ba236c942d400742bc3f16&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00039,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4ad4940c51be350c9d8c69f424f01a9e87e42fe6b312afae3f8f7267c62512e5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00040,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4707f60dffab08b6837078ae91316ebe04a275aa19892462521cb6125913d3d7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00041,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa6a87a9e797af923887645fc57602d60f7cd684357ae837a6270936eb6e5ebd5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00042,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5c8dca3c7c7842995372aed15fae7b9bada264b56082bec19c870bd4c7562b97&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00043,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcb513d912a6ee576a33cf3683d596354b57484cfb4d7e382f64326eef5bec32b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00044,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1c72a3909e56831cea647e4c67faeb91db49b5be8c61832082041c16b2072e87&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00045,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa87afdc1e1d225e6826d8f18c15c0415c7d13ba2a3933dc35816491bbc64501c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00046,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x22b3f78d1437187866a86fc05463d5afa558903def2357a05ffd32663d5b7896&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00047,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x92d8437253506251ea652d6242ced9f3941906d4ffaa78edcb396a6c5fcad7d7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00048,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x78ae53ed63f208b18448b40e3c31476eb2cd6627d6c65ba7dbc96d3e1051dcca&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00049,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3934e9608386c1bab748cf80199b6b6341e581a163c64f6c0bfc55d36d41cc64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00050,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x71698ebf74b826ce701bdda7c804c2b9d0aa3616bc1ccfbb62d4455cc2b0bec6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00051,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2c1c77788b22e42409b9e068fc98a28310af7cb451dbdc2601d29771bb117c47&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00052,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3a047d9aba82db1eac26733dcc652c0aed663250b25781360ba9596db48ebe01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00053,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x161ee1b5102e9c6300c04d4885dda180e50f3e5078ca8d2bc1f3d0af0a9d8287&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00054,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x14074ce7acc2ad4e4d60966d9717d8f2e6f7d28cffa1fccede05d4ab7269b772&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00055,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xae639ad86664191274136f85177a515b7524be9d089571f5e24c13bff9f91a38&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00056,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd92c394c57df45119161e4ffecf8445e3af06c79c90987db86db649f2cbf7840&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00057,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4bbe776e7229c9583ccc6da7d82451b56ef1fc015c802c27b2d364ffff7c6e7d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00058,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9ac60ed891eb7490ae1a5fa1d9c14ef66b01bf5fdc6f31a419a28c2946e0c3bc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00059,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x246c1b33d8b91d3fad3c3b88d6aa04cd872bdf0608aafcd1f11a53c437418eec&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00060,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4533d0c5d211593355e4bf1e07564fc04bc158e75437f33eb97ec9066322b3dd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00061,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x122db1c231fee4e86b938a432ae95eae69a3ea733b82b15c2d784c70be3f9b89&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00062,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x65505079e3493c2fb572db2d1d9e455ef3e48be78c18f760fa6724fe1326f5ff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00063,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x39b219117b1d306e0e9ac0a8f969d47f1cc375d7593e2c8e0996fbb80822f293&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00064,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdb26a83cc55bf6f8c6ff63525fafd2c8dca1a0cd99828afcdbc5d3146da18dde&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00065,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1df3a40f96ae6291f081fcf9dab9ebe03382d958cde909a4cb7cdc76201fe006&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00066,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x07bde22d34d4cd3a29214dd2bd1c35a49190a3df40505ddddde8e3622c6e7cab&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00067,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x751bac833356761ab2a1794fed46b04afcbc60d23e608a707db5b897e5d042d2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00068,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x546a10c136f0cb0c85bf58b69e04424ffcf1b00b4afffd3f33c5ee253899367b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00069,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x55c236ed7566681663e88a71b9597a48970297cbc0ee8b23b1d302dfe69f61f6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00070,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0ac3ebb18ec9ee6c921f36d5053d9343ad81218f797c39376d9e4f4352c768c7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00071,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2fb03713d78b7fba05408f872267c4877ed8db5e1bd1b9f1e57d872c5cc08adf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00072,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2f9a4a75044a49046297e71c578329b8326352fd49bd01158f42c73ea6948454&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00073,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x32871a4303777114e0f17126567013d94bb2884ea22bf0a103d45fef47c4b005&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00074,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8aacdeeec1021158c05056e5aa2ea4cc4994aa2372f5d37d22272ed065f7493d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00075,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x368ce2b13e74f99ef231825ba5df588d654ccaea62e0ff46d012b879608454d5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00076,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x290a4131608502c9423b9ec4fdbb4cfdfa245ec92a571053702cb431d6d661ab&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00077,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5d736b0aecc493c6160872dbcc216816071483a4c4518a2284bbaad9a9c592c9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00078,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x98ac3e9dfdd27556bf5d5e037d10de525ad1142c1e954de9cc3b7e2287dc9ca9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00079,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x95e0734eb17b4182d2458e6f5268abbc75c44e743b5abeb775d99bfdb1d1f6a2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00080,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd778ae86ee6b3ed9f3f3dc83a5ece367faa9ea230daa21c07c54e073af83f2fe&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00081,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2089ffc8e635baaf3e1673f9ca3ed6d64b1dd02dd73aa5c2beb692af5363a1a1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00082,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x382ac3bc7f5de4df286366863351ae1d3655fe5df7aa195e3f955e5cb4988bed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00083,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5ab1cca211eb959107d5541a30d1b9f3e8a6fcf9935643acabd4f2dff8f3d212&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00084,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9ec0497d2130e92ea521793e98774962fe83ebd994fcac4963cede93950efaaf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00085,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf847bef9c0f4876906d74c0955d362175cc4d9bb83f134d60dad7bf3df6d0b3b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00086,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0dd5eb92d78e345af8ac60db208207fe3f4621e5ea09f195da8c977418c358fb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00087,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc0612d68f34fc28c18a095b0062d5762cf56d5c6554d94a0e97315ef262a4dd7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00088,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3f433e6334fa2b3d05edd615d92926aaec56b355f9375e3ea4b91ca0dd7c654d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00089,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0432ee13cd0aab4c445219c8edcbf80bd502d11170a2724cabad19f55d8f2ad1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00090,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcf23b0c8c31f2368dc982efbf1220f64439b107d691450a3eb15dca1180f5854&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00091,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9fbb0197fb4b50008c5feea2810b0336d38dba1958fafdb3482036e6ad269895&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00092,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf88ab15fc925643c8adc5b3485f19240e4afc53dc777f0c9bf9ab5c6c6f3338b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00093,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb7499b8c5bdb76c9a892b9e0d09cde7813ed0c38740d25743d02910f337c3c6a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00094,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5c45bbb126771f6277dca461a28239b4efd388b55afe6ef1c6e595ea4ebd9509&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00095,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa3dea11d2eef1db4c8855ae369918a0e12de5b99e0087e3af0105ceb1ed1e0a3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00096,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x91ff33f7ed74652bdd22a154aeec0cf24542b29477122dc02704000ef15dd540&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00097,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8e4ffd2bc8e767d8848b4d001c20a7dbf942fe73b20f6821a2abd586c8462334&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00098,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4c5709afb1a85d25d9131fe5e441ad7f0d5d4608583c07836ff4cc2e3228a30d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00099,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd55b92c14fec40d8ccf4fee501efecf9f71ced6d787eb3faaa4cd7050f3a3e08&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00100,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbb39d00a031359e390914a91d9c26c1b8dff1b6d8ca4a44ebb64d5946a5451c0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00101,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe6df19425c17f10ef876e9964f7561bf3f7bc41fdca9151c26797f38e4a064e4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00102,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2aac9e21e2134958f6ebebe21acaa65142ccab41a0ca386aad4eb4c383b69145&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00103,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3fe56c2aa4b33540147f05427b757a5ecfb57a4301a84022a0a26c57bd1f5b4b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00104,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf3269b3047cc6b5dd1f38313ff3bcc717b44375148a8637e4ce41ec39a9adc57&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00105,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6f2f86e801b6456e59b5f4c6d2587ca8e5cfd97fbf93dcbd11b7c3cf65b83170&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00106,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x621a252741c0cc84c5e7e3b01f90d30d86474348f44cc659ff48000093671bbd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00107,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc3e8f7cdf2b7fd8a0ac98834d4ab1374e8aec4644fc722a04db5abd57329405c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00108,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbe1a1635522e1529456595e0615c4d3c53905a0198ad65320c8ec1f7f3ec665b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00109,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x49424c3e48cdef7a00003a3ea76da66ce8f833df83f74580faacfa7cbff5dd28&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00110,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xaf29e604357c6c3d6f8a23c69ab648b8b19c0bac3e7e8ffcfe3d23f62c585490&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00111,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1738246f2b0b1ba4a084cbe299233f487f3730d8ebcac38bc6cb43e503992248&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00112,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0074a32e1420b57f8f7c142a61d5d945fa0df577c3007b375dc4412c46e774a0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00113,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x56e191304d05e3370a821bf16ef43a7528b63105a03b425fb2c408ec21807233&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00114,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x10c2a569cfef2c20fbce1953dcabaa463cae1daf08e83a38322091fb1da59db0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00115,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x26efb6b7b8a822fcfb126451c09491efa88a986bf3ee4f0bcbc7ff5610f051c1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00116,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbdf3bc6e520513ff3ca5382abbcfad7f2bc857db708233a07f17149d57d66648&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00117,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe68e5334db9c4e799fdd67843038b909e231e8f5d248af1cb212907554ccc352&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00118,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1c9a243765a53509f7ac091504edfdb27fe9e22f9766a7cfa02e0f87ba6774b5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00119,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5fc6b689c399c8151792427fa1e9b44c6453f520ea15ca643ec14cf1860b3397&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00120,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcfefc65fab88cf757198c581e272c0e02d6488f4447b87dea8c908cbd8b3fdc6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00121,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0e29b6cdd3b4816acfbd104ca56b2ed140958c37fd4f7d9dbe5d62e1e7444e61&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00122,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcddbda3fd6f764602c06803ff083dbfc73f2bb396df17a31e5457329b9a0f38d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00123,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7717d3958ced7ec038af0b4d7daaaf2ab4da56290db865faaf96da59e9babf7b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00124,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2e66a66a8ff5e15178ee8c9e500475b7badb71cc65d26dd6074e8faad109b427&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00125,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x82fdaab150f1a25c78a2a0253018fc5a83c420bfed8ec727f6c98e1571b39b6c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00126,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x427637ff154cc2036316442348c319c019515af54dd5a2c702527b87f6ea4611&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00127,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x65e302f1d26bca3ceb600bcc6c19190d2a5e9723a47a99e0710f4ea1fdf9a2f7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00128,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6fdc1fedc9d9454ed6b7f1067da89f57ee4c4e298767cebcf549b37c38b463e3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00129,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc8705b6e734dc09bff141a739eddafc9a3016ca7e7078a09439db7785fb4e688&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00130,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x650f1d51006a9afa156973b7080774340dbff7334f6d4941729ed1fd39f4bbd2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00131,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7b4435cab2538749da96316d2068854b40a8cc5eb4810155954acb70ab8eefec&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00132,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x23bd760353974c8a41e410bb24b6aee32d19eb703692420d375da68ed5b8b4a9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00133,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc0faccfc19b41bb694cb86c86b88760dddc771125caff85b33ee5cf935f5106b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00134,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xec9cf3ec39f1bb33d363eda9d803fd63de89a5b4afeed17c9bb5185b784d4cc2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00135,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x66f5486b3e5c79a9d9d10d4ac5581bf89b4068376bf05ced98455b7d50b08844&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00136,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdc4ebb94b5007edaa6be31715620430cab85927af56ff7efcd8e5c4df5b2912d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00137,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x022982006526d25c7ee022373f4832c10fe42c7aa25b26044ee3f317b812c221&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00138,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3d2314001a3de949f8cf44018b245fe6522bfe212ecae7b8e1676505d05c9905&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00139,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5f31661180c2ee22f0f7209e38c1c2aea2fc03384aa0ea1f9d8b98cb0747ca5d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00140,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf13c9fc08dd8e3fd03250091f66d0cebcad41cfb4330d6e68bf447863d2f8201&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00141,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x17dbb0e39329cd8b2bf6839de0722241211c8a602c233f48302e50d7e6aa6361&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00142,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe42539c839845c3033143db80f7bd316ab323114554cca363c2f3ead3ed6a68d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00143,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5594a813aaa2752040681086954b21e457ddc5a8f1d816b45925eb85ee7528ee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00144,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5ac2296fd274fd53197c615a25b4fb6f4303b17a977954775f73e036981eb4f0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00145,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9244d418b8875cb5a463decd0f8cee235755222f2e72ad97810635975f6ffff8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00146,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xaf9e7a53390b2fe7c833e937cdbf627a8ecb39da70260eda50ad0af37b4a2d1f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00147,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1b6fa332dd5f6b04e3fb1a027b63f2513b4159035d3294b0212899649b61da2a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00148,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x39f0b0575eec3daa97f64b9bc538f841242003a72256fed04e015e78f72bb92d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00149,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x586c4a913ddb47e0cd4847637cccd2b458a09e35e10b29451febc5ce8f19f696&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00150,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3ff89a4a288f9325e315b394c991680a5843acde1412d0539412363b08ee7c4d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00151,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe322efe1b787fb583eed8d19ef06ac5660c014e566ba2541c160251273f8eaf5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00152,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4d9d0d1c39a4d03a8e4def8892d713c4c9c84df804bd2da90e20e596c99ff6f1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00153,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6b5702b39f5bde08d74649594e48ef49faf24a19c5d7ec75d8cf490157f4f201&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00154,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x13608c120fd377b160206bd5f9afe2ed660ecd8a121210faeaec26c9b6010975&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00155,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd0bf6ce2d1f149196b41e2379831cd9e07d215a9da2be8a2b772be32a10b3f64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00156,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb8c3629c89fbf5c93a481688d05e108af37f4ca1152e2c1ce66de366db58e934&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00157,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x97351a9d18fe2307ffc128e294f580eb5c9c9f48fba6a5f4f25a0aa98d97fac8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00158,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5cee8f8c5f208a9d23dc367deb3c47e1b3e186bbdd94f2812ac27b40825de041&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00159,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb92f84e91d955459a2de86bc28544a82ffaf23c6175f657f767303d63cf8b842&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00160,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3e41d9f5b9538accaac888b49abc201aa3d71f5aa6c516a97e69314886989788&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00161,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0736b99a2882a562bfd35db27b128a498711834107fd2c0356063b406ed8c804&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00162,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0a1530daf01f3cddb2af69fc527b5f7635aab2d02adc46e5a21f8344eed9f7b3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00163,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x43212d3b60bfcccb6b12bf765fd072f8785a7d41dca097e37ea14b7c8faf6d85&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00164,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3744a01c5c7968e2230ec9d29de8a370db7f43763ef8f22f58cbbdf13f27eb1e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00165,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3d14fc84c9f2dafa748275285205ae2b29df613c8f982d1f334d661b1511f8e2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00166,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x97c2592527a83d1c2c514f447e8ae6fdb1481c0dc9c4a3f7212049c5eeae578d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00167,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1148500252c17babbed0e2df0e3913dc380f7c0a06e680d4ba101748620660b4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00168,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x88a365fabc60615ca56960314ae6006f61df6fe729a40341c12bb3c98045a4dc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00169,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf18242e71a0c97722f01fbe9c462e0fe857d93a43f1d683fff9e36e4d3ad59df&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00170,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf03ea8ee5343e37601df81cc61173e6276516b1f69225a8c1a94fb079545957f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00171,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbec8ccd9a6e13443a8e61a931138f3cf6218a2b477d11ef59a082f898796c439&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00172,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x34a4c5d21fc33c31b415829b9e46c63588db2327e3ee13682d52233108a2af25&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00173,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe1ae6c812dc2ca1cb0613ab42e6c81721f96e771b13c79d284dacbb30c65e5aa&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00174,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x727d10b81b790e7f5f608c35126fafc3523c7e991bfdb8ef018edbdd207b4c24&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00175,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1bf21dcc47b8d4ed6511e49dfc4bc14c1f40f2c21464d52aba8b4a50c60e3b1f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00176,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xecc872aa4aa1c53bdc3c22687ed31f1373db111f1c1219286f857b157f6990b0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00177,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x966bdbf23d2e86326afccf08377aac0067d485c6098d90c1c74a84b34b8eea3a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00178,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb412f22cecb0219921846638c68908fbc2d73f3d2c7d32d7d86795e9f48c5145&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00179,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x09e40d3b668d4808509a521703734da066da50c303525314712713c5dbc6a2f2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00180,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8ce22357ac0066d519294b9ab476c222a2edf3cbcc4e06a2df0504ad11f5c1ca&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00181,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xac1cf418529f5346213890d7f11ccf4a21e24023d40f2eaaa943606f8b7a1e6e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00182,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf770e12a39d1ebfe34919a211fcedb2098ff562689be021bbfb8636f756c4b95&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00183,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x798224ae95fa5281f29cdd3ac9eb753ca8e9ee44b9cb2c5747f97c8d71917b58&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00184,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x876fdbe53a7831817a5e123f1b043700f1f3d47f685b772dded35c953d629e5a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00185,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7b447a76548eb9c28145371f61831a2dc941acd907804808a7ab93f7c171d621&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00186,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf1e11ac5a67e45142b1a1a13663c725f82a84d5e59ddf65f3b740dbd028b3d63&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00187,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xce8b009f996254d6df379dd2b3a5aba9dd1d3e0b64de28e5838b43f411f42e4b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00188,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc7bd816d6d55b71c0f6784b2925ff9e1daf65bfb238fc1bb4980274130b500c9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00189,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x144cc97d4bfc31469fec6de2cc4ab5556af13aa4b00b96081692ea64092c592d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00190,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcbbcca518e96049a99aad9b53f2e579cf866d6c8fa3a69e407404a3508963394&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00191,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3a7f648499e877f2451d3bb6f1e90e5e48ce653459849d52aef5b1f04bd7a9cb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00192,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8a4639c3f8df41e06f4af80ecd6227823708c39128cd6a791e9ce390d9bcc7c9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00193,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x52629553fb11ce8b1f53ad71c3ec8fa911ff6e0424b7c0a015922311888079d3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00194,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc4828a4b7616281c5e82ba47e691de8a9975512f0d9033b098082cf027e90236&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00195,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf50a165e20e68aa37f97ead770fd9710ccb7b4fdc80581b5982f1d7a219feae8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00196,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5c31919b4d982bee212e5d30e35fc2998d946a0c124e54e3e2c27fbf8d129494&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00197,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9e2a709b9953cd0e76df8b6f36d2cee961b24aa19ed11c6def3f5a1744c1755b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00198,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc3e781bf3998d0fd70bdbdf8213e066bb31636039606d9763ab9449cf73ad5d1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00199,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x20c05ee3e79b3ab76d806ae93d9cd01340ea68c007816dcedede0635df91850a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00200,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdc265ad95ef9c500cecb8bf2a5da52b3f29d171aa981c8bd9ccbd6ccb7696e69&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00201,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1356f2dabf963afe35b149a0de796d3e48f87bc41d9a516d4924854af52dd709&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00202,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x84e861144a0bfc933935e47097d963e8591a0f321cdb7ad1d75d899ca501df1e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00203,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf2da7b50b32ed6bc786564ffc8e7b85ab250ec0eaa0096dea3faebfc9e07bdc7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00204,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7f42b43f0556b03846f18a12da581203682f8d2266fcd686b388970ea6229de5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00205,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xafd08f8ec73d9a83ac8b099ba3202cda132e9e07e3dd18738dc4b5b1f0d98e93&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00206,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcf4a2c657b1cf55f37167bf85a51ed104eac71967a98bd4c02a42dfc057c02a6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00207,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x59a0e883c7a7087b9c330ae4703d0cf263eedd8d20466e313c894519235f5d44&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00208,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3d0bbaf203bdf186daab82974347c617e1210a586751ec6c9818185d0a096e3f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00209,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc1041285ee311030789717024ad66718f6184a03a0d31a1ce4ccb0948fa17dc5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00210,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1eb673abfb14d61c67d81d48dad2b7f72080a90fe090b6846779fb78046402ff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00211,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x01e5a4d0cf29ec996c00f168d445f55eb3552f213200a247c4efd60d4fceede4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00212,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x83c3bb0ad1f3784c92a88909ab533c62dd5e7b3dcacbaf624ae95ee12022eb11&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00213,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9a09fe68cd5dcdc15ea76f08eac7e2a679075e772064354c747b75e5ddca8d2f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00214,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9e78dc12bf0023bdf0c8c1b8e7f7c6e5a92d66b56475594bfa334c129df58735&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00215,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb02bf96a7443e246b6733270453b35a70ff1fcf49375cedc97338614ac65ac51&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00216,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x209c8b324d31fd9d8c8c4cf26f6506657608e6816471fe522adb1425b5ebd04d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00217,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6c84f49aa1ae7943df31f340739b2b63df7476e87cf0ddf82862982456865c95&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00218,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xacb60f14bf4bdc96ce579f02f62f8bb35db16f03dde7329363bb50388c3c45b0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00219,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0a773645ba0627df6df44158e292f2f226ca74bbc90464ec4796ac2e9bf26578&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00220,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x76ed2324a565e51cf2a82bd0cdb025f255caf25d61396d4da19d708c40adcf92&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00221,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x76ddd2d829c12483b2ffec2c587557bc5972e08dc8866708a2d44a31575483d2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00222,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x71e986b22213ce63d0e3df141581fca8fbfc41569f0bcd62c101c67cb00295b3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00223,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xca2b5c289ff78be184a6cea0f072aa71cfe0977f18bbcca536b48938e5d64276&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00224,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xff571e13e54cdc9ca6facd7012051ee787bee1c52a555653fd969751bfaac7f2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00225,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1cfe32398c41e4ecdde6cff7b2df6f9f2651ee87aae1b52bc35e4d76f136c3a0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00226,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb0eb8f2f68728e48a4ded02891b9a682f7c925099e899c26143083850b3f2829&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00227,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x83556e9f3d0e05c0d4cd809cf1bcad1557bfeae027ac4de16e6956596e8309fc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00228,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7651e7fbd8326e549f9af9122585f517c4f59ab6e735cd958888fb6f80f29db3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00229,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x238ed7884113c0356cf4e5ef35e05434d3e076428884b93bbb873ac30afef54d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00230,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3826affaf4ebf5817b453c54c937951770c19ddb7900c9a7742919c24242f6b0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00231,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb81f93c6179db089673e919d91660274e96f240a699a12a140185c69ac19b674&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00232,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0cda2a75d5dd4059a2e5712ac7cb151f033b700995e93c0819f38cb01b7f005e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00233,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb183167b3a03238701597a198475ccec1308e2c55babbe5d5acb92fcd694fa21&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00234,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4a88300d556d8a8d66669f2d2b395263ded44d9a86bd45b3b426a55f7da8eb22&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00235,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x05ef61436ee159233c382043f0a9e99d34ed88a0bf3c12244f546b7b861b9f5f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00236,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4164fdf451a7134e2faa3672aa40a0168e2a16895020c0cd5632322793fc96d1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00237,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd5c9eed4c1796793e8595d155187444376f4b5478ea5ff1804f1ba06bd328506&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00238,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdb0d90c5045dec94b87c81a03fb985a6fb84e1debb372b56c2513f25d4a2d8f8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00239,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa0c972ed0270d34b19b803a74649470307f138ef0567df85ef53a862b383dbdd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00240,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9cc1a86a28230bad01981b644067885e0333588976edef464aac674744c9eed9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00241,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8ab5ad435e4c9a37815b47344d282c90a3f364d516374b4b2158cf16148d79de&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00242,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x491f232e15a8a44b1f045dc68552543672c6d3bff361a5fecd7c0a54c1f21d2f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00243,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf66eb348a6b9dd916baf6bbab3299c57b9d95e5bfb585893f2953209c2c451e8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00244,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7b141f131b2878edbef5e71682051e3082490e755502c0372e5ace9cb5ea3d5b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00245,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xef5b96a583318ef2d24bde313396aa09dd5d102cbd270b95c036bc6db98349a5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00246,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x32d63aa14065862ce43f33e578625a2892710dd11025a9299f8722421c625874&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00247,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7b033a6c76470c8b7b953161d562fe30c90705672f950a176de70a6aa5f1b130&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00248,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x50916052436d167fa83998749a703038ddb08d7cc789c276099235f9af28a613&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00249,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x75e0db34d48e90e80705be01c100e3767aa3302d4269a00f4c944069ea451ccf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00250,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4781ac7f896d2a547f2a973fdd352d5e9efb019939bd10ab31f0f84887968831&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00251,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc0f8b33bf4828ab6578b5312d922b37139bf9c1d0eddd973f5ee84b39af48a28&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00252,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xafa72ca222af4feacee96c6a64a4b05a1fe464f9ed48e93e13cdb096d0147d25&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00253,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x96c6ccb34878fb040117b6933c7d7f1ca4f534dc63ab86d2cc4914b06786331a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00254,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7b32050e8240cfbf7ab11e4b06647d363c83aafa32d78cf34460b335d0e55a3c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00255,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x16317cf915089e0c7cc1afb35540a004fa2c79e75f4410dbd89e6d9fdb2b89e1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00256,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb4ccb50be9c8f0759450e6dd9d05cb16778cc2852c0f8aaaeaa118a45267891b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00257,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x98808d165ea3e628d92a93cfb1081e68254c4e2a48eea8c1cb3771772ee0fa74&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00258,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3cf61b1ca697e63092bcbaafad3cf25608f47a9b6563bf8dc1720eb2a7fbe384&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00259,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x051764d24d14c62f71e8df8e9eda01d4edba8a9a52cf50ed50dce0d06f33bbeb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00260,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3b0545e8512ad0ef40623a237e1461577102fb2d6aa820dc0a9420d62f1a5942&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00261,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa6f4bfcafda2d4cfc8bc900a5f844d60a50822aff332f7aadec3157b12a8d1ba&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00262,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1a75662f7da5af8abe9f73deddfdbc4fa23772f28a2968eb44dab1e413238841&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00263,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x21bf7eeeff2979facb0c0a59ebfe07e4f110c9f7417217a341039ae2deb4c6d7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00264,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd41eb83d2e64d9928f6c18e95060bca40c3226b4982f91dc97a518201aac8fb2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00265,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe7a1956113e4b4c440a7ca46855ad2d2705ee3c018770e3fa8f8a3b3a6b6d6a9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00266,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4f172aab43c6bec97adf68392b12e82b4512ebc52df0298ce3253672fe59135b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00267,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7c0e1bcfc2aaa6ae002a1bc3fe0ed288598013b4c0dbce889d4b41cc8f1c792b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00268,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc839e6d47fa99f7bab58ca9eea51d6306873f67fd286ddeca8348a09c773cc42&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00269,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9ec52dfb6facec401f848cee38bd6eda4e3429291939754a4985eb8ae969787d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00270,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4e8bc7277defdbc8c904f780c9b6f82c214816b5379e95490c7f0052a7295465&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00271,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5294c75dc9cdf4c43f683b6c02c9078852607faf9dec990339b74476e0c0108b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00272,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x02a11db25d807b03efafe32a0ee0647b35d47506a7fac186bb51e3c3a77a5655&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00273,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd81a2c4138adf6e8b1af325a9a0b08ce6a0b3b72a79b367118294bafb4b832e9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00274,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9c4bd87dc1b25b83302973a9c4223cda44c1200ea2a83106463adf6317bdc605&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00275,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x85b9c67dc6b5b7c0014824f8b1909633459cd0b8e1584753064f85e1a1243c8a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00276,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x38cc12366c2a7d559e4df0705bb822d8d0db59221de71477dfcab90e317b2e97&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00277,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x40c70f952d1ecfafbd064b1367045570b703fdbc7059cc7f9194ed34794d1db6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00278,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd9e0d7381580a9f3fa81e7a8f582967f09e1e87f0e4c5d08221edf0434053608&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00279,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd20a7b7f9138afec7ab17bcc1fa4d77571d78f12bac193db64cbe046d0bcd1e6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00280,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x54a85faaf00ddd99bf86faab4ddbd028b8d3f4e8f4492d1c7160aad9a03db638&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00281,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf08b974956e8b7c14b335bf82add248bdf06a9626ecd6627ae0cc523359cad9f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00282,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa5912776593b35ee8dbca404e0c36497dc410062c0e5f4c6b40923232b17a8ab&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00283,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8ee7ec35fab36575d9e5105303fa547ca8a03b6ecf731cbb64b9823250323d25&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00284,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x374996f2ff5de9c6262168bc93fe7548bc6cb94d45dd4dcce211a9be677ddcfd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00285,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9494258571f7dda74ed018ffed536e412f5272028442ce932677668613278035&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00286,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6d47a23492f0ec9831f3536b4b542b1addaa041ab9f9cb6d2f6821a5f9ed6646&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00287,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf9804151a4dbbe0c86e08b2109fc328a287ea4ac10abfbe01a9bcc866e7422b5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00288,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3724a8c948c728a89eb03af19c3be5e7e26abde6713e6e9ab5559dd21f8e095e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00289,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x60d72bd902aef520fa3a0fd618cc230a50c8cd3951042f5a613b3d45f0b94c6d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00290,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x64cca80b0eb18b315b2213ad5e2b53dfcbb1141ffa422ad46e7cb3586a200aeb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00291,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0dfa92f2d0ff334ed8306b33e6d3325720cc13aa0f046d53a2de144d89b9af92&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00292,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9490598864a1e3ce2241136637de020cf275921f59545dbc4ecf4cf87f678b84&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00293,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0d6c5812bd1b877d8715198580c66eab1ddaa78e1dc350e70eba0d59e633cf30&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00294,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf6c5c94a2006aa624d007104ed8debbb32ec15423382e4759bc7a16a1357d5ed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00295,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4efa78d05a58e9b1e633443b058c9f8d447728e0ad64a50332f848199f8a4253&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00296,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x81c1446a12d42c3ce40f4a99326cf8e5a306ab72c773ac26f63a63cbe0a58064&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00297,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x08d13a3189fb2e18636d6beadbc137a79d03d9278c60f80829443348b8c560a4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00298,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3d1d6d89bcfb495fccee7bb0bd8f04715d84abe14f94fb36f870e5606c2cdf18&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00299,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x23728d43eeafdcff8f761c5a53e3f9373d25d17efb28347a91938484e03d07cf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00300,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xde0332534e50154c9eac98068e56da4508d82ecf24ca3a275aeef3dee99b95e0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00301,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x15a24df990de83affd9aa7cd9e67f4c558e1b3f306a6281385cc2e6409b9793a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00302,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xba653536adb3464fdd46fe741d7daa1514a84f7555bf7ed91cb4d3bddc0a6f1b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00303,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x35fde006dd9552f56250125ce80ad21476daf78f8727b432cdb370372c161a65&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00304,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x377bf395fc2a3ef98595766247a1c057a05d5fd3629bfd27d0bede0c6183a7f1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00305,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x340a0b81056d5170e635ef43d952b8ec4ff7f3d5cf4ea1469750448d78f3e501&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00306,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x848e3d92711946156cd7c848947d2ba4ee4c0b39087ea30c90eb1e64f8aba773&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00307,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa3ff791642f87c2bffb269a1da3d8e943a1828cafe10ea7a483a508f78ab54e6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00308,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x48c7160cbf3a38ea7299edf971711e9d6875969dd38ce2086763389d9fac048c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00309,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe7948131b78ed9f05c0e18ff0497a192aaf8c5d3c1a56e1096570b3b45117253&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00310,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdb22eaaf717a1a827a085d3960e2a477a2e9a73584bc4a293377ac50a492350f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00311,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf9e4fff98d04206dd4004f5ec146e676327dc8399dff7c7eb61d1d80f706d3ea&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00312,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd95903d02e93dc935ce569153d9c88680972dd5e9156dc0a7f4da9a3435ff004&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00313,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x73f91876f19025335210705149eac61825673f8698bcf5aae285c00051fd6f6c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00314,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8e3397949f833d550ca3a268befa4c48c238f488572b2512f8cb5232d78dde24&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00315,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe83123f07d6e146998f885c5c4f71988f472b9769e9c731d421327f3f4add351&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00316,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe49c7af7a328992fb98e65057e28326f3684f84293a6b9825ef8297fb361a186&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00317,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf3ae6a628ac464fc0f14f4654dedf31ab553c9750bbbc801e395ac858bbb619f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00318,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4bf5c84ae3ef17b5fb6455380d4708dba2da9c9224c4a31a0cb14ed4e8eb17f0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00319,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x391837c44adbebf55ee138d56c65353612b31c66f1cc02663b7f088b80dde22f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00320,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbfd4677eb2bd0210ee172956700adfcf8b5164982b533a191907f62ac3f6ae1e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00321,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7189f4963254c00f349ebdb7f507638472c13e083cc525be744de2ce8374e1e9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00322,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x344663aa7240ee9c312f31e5111dcb672451ef971ec1375fb8a298c676738c7f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00323,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe111bfc2e481e928c91b0d0a5868221c8699e22fbe87852b3bedb3124072659a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00324,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbe2b4b22f7c8c897ba0731eb6342e075c338b8feb2791c31be1d20c6c47f167d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00325,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x441fdc4402e5b407058b634523f6318e2b6ac078414720bda9466129896e19c4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00326,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4297936031236c915aed0b391555294f1df7b346889ca02edd1313b8fbd73298&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00327,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x820afe74538d0b05b98e1d16604fb60bca79f04c56fa724e6d2af5532a5b45e1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00328,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x08665862041221b6d297f4e7619b1044eadbdb92ec1415e916e9bc78558aafca&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00329,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcc85d0d955b9068c848b56435b53e7eef8d2a1266cfd92c46544594a1b7c06fc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00330,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8ffabe96ffed7125caf2395331a37eeeaa016c1fbd0af6ddbaaeaa4ce3a75428&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00331,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x57c9aa448a060ee1cbe8a7b5236ef301c090d29baa0f644ccb23661b7933b4df&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00332,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3135b7344e51ce37b6f82ad0e1ab5dde01a7cbf154ec76ae394c6e99fa866e68&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00333,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xef368f009534af83848b1ad36c874d1cd28cbf792663db122dd8f7f123506966&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00334,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1c3457cf9b7bde27ad51086fb1ea494d78e82217cf2477f79ac8fc4cfa610f25&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00335,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb191a95efc41af23eaf794aea75d4b4c9308a85647f6793201533b30b3d9d368&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00336,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb5318d5c8c6f173084a7d838110e3e3de8739123b4ec387658c0b579cb87fcec&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00337,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa84d51fe94498ad9c2f558ad6fe685d9aa73ef5ab52c794861277e690ff27d65&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00338,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf0b5744f941d4eea8fa255edaa9f7af5028da4900c7fd0b2a1214b00c33f96fb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00339,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5a637c4c3cebacbb0caf5c8bb9080288270e8f2ad3106e50ce82a65bc27386a5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00340,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6bd16b95991a8cfb3671511c673093106b4aa7d626edd4558bc58ca67f8054c1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00341,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe0d9d5cba01b6dc8c430de66d0503e58b9be6195e7a767fc26e15277af7a08fa&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00342,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x203bc599777747671b50d1ddcc78edc4a180537d2e6fe14610426772d1caf926&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00343,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa668f92ec27ced688ad1ce7eeb4f437996bdc213ab001f5d548f5e283f243754&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00344,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9cfd6013d6c92d918e19c4b6118dcf5d73e9070af0c7300f8db0ccc7fef5e89a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00345,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x54595ee743dc095ed8c3a82f1c0ae34ab2ef7ebb494286a990be0f6b9e85e6a8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00346,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2297e35e02ef969b43a787aa88feb7e101a21fb5d73a81af1c4bc06c57a7c3bf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00347,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdb8912b310472c79894387c19d79d84113709d05057c043380ec4ad8145991fc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00348,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1dde5ab9d554e74a5635f8042ccee5454b215eb598cfbf696a74a459fc1ec87f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00349,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7e25d7fe6b0e71c03d401537f46ea1628e91513cc3991171227d6ec165058e2e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00350,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2bce5715759f8e6f9f17a735408e410f9965ac3cfd27e2c710060f3778d662b2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00351,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x112b61e1ad4e349919eadac971bb9128d385eb3f51668b2895cb978f148a83f2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00352,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2ffd764d428f87651d62f1a1113874042f1c77dee8b999524e896663e1a0e000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00353,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8d5ed81a06d6bb19866099c16d80a7dfe3ebf9c642236410a5f3f491fabab7b8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00354,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x78c57cc6fa8c8eaee7bef3b0573faacf9a42783f39c9a307a3cebd4a66a56e37&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00355,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x55973475ad5f1404bca12aec3688d80cb5881796a9d0a9a917245f8ed9bed47b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00356,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc7493a6e7fcfb05ceb9f11b9af843556bea9f87883a2ee21ee76cbbb769204fb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00357,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe5dd91711b000ce8cd41d02ec760a50625f924fcf7a095353f6965322881fb94&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00358,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x60ed8451fe763621afb94803cbec04b48e9ab83c8d05e2ec1524e623dbe0decb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00359,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xeeb9573da28cde717ede462163188da0c184c4aa61e166e9bc4ee047fa0c170b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00360,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x277ba2fed1fae84aa2b23a43872100f00b7699326a22df5679115b1dd88c5206&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00361,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfc97c47f7bf57fce450809d63a32e255db170aa3fbc94c88d9b15a09f22e2f8f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00362,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x77f810e72a7d1aa4a164ba9f7bf0164b6f14842dda65d584508d7f403942c319&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00363,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x056ef66ff214f7a777abda23d7c32c1ed17e2d25f3e5e4299e11c22412bfb1df&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00364,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x374faafad27fc139a45b9a73cb5957de978227d494de6cbe4d9bb4d48fc26197&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00365,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa959566e36f4790873b779f74d0b31b5c08b4177e844e430fee9c33c190839c2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00366,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x905c4a521e63de87fdd413379e245a1c8c2aafd1cf92e5ed6394892a635e62a9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00367,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xed4e7dab8d5ac5eb9d4e3b711be5a5074eaceee1936455fc145362871d64faae&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00368,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb4a84335f5900e1df9ffd45af119abb6808b69960359257826702a0792dbb9c9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00369,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1f3be8331532a43391f286dce1908e750c2c1db4f40e04240df8a49b15077ffe&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00370,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xccf6672e6da5a00cd8ce25a1dcd7ac9701d10e13db51b249cec8a168fbc1fad3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00371,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1aa762ac08985e6a081e59742827fdcaa0194f37db5a03574bea395a548c1ae8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00372,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x05d7f23c6cb10f2e5ea143504193e0c18799879225cc7bb9f548c2a7bca406a5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00373,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9a8322055f128164d9b1ae8be520dabd5aa9a78e6b38887d2d0ef1c29f8fe5fb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00374,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdab73b8e1681ad78f5948c11596f320dc9e37833a372a4bb75131ae27144789d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00375,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe97d6f9f8cf09791cfa7d844116e30f30c0c25a010500db0721e1a0794a0f0bd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00376,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6af73957e98a3366086abd58c1d750803706d7bc3ae2bbbab4eb6030d58cb244&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00377,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfa0bd020aa5cff144e0c34ec5a67a63cd593c607905dfd7a8697796a7641385d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00378,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x85b101eb40a52a559a3bffc4667c2fa220ad9cacca9a34c62c684e87cafa5e56&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00379,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfbe01c0b7b7e3e3434a5a4723c3619f544c6fc91324421172c74b3aceb816f39&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00380,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3e90265a2de6ab0f66324c687364be3c3a4bf46b96fb5dedc4da99c2a59c66f2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00381,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0b316492b1f48b2a578bf289dbfdcfeccc756410f0260e2b14b8b2bf972ab173&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00382,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa02e585dc76ee230753d64e6f49d31f6c785e03834bba8acc2fe3f97b2b0de67&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00383,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2198573b3c6f4e37218236277eb87d39d60646c6a46b7f516de4ee75f7eb57cd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00384,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0c367f630c9a45d6320139277a8d2f880118a31a856daea875c5a095986f50fa&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00385,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8893c8da5a5e2df4e794962fd80bf6d4b8785de5ec445115f1851f601d92afc0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00386,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x30637c5e41cbd7671b1b2744d5abde33576904c2fb999de2262dde69d552b4e5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00387,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x069b5e283383b315d1a151162386e05161a9ae0704c2b5d3162d18fe91445c14&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00388,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x82890633807a55f66db32bbfbc7eddec26666cf69d927c6ec17d3e52839f3d3e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00389,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdef916eb755fd6d271775e79079003b9851e520c744dc2fc544599069a2f9a2b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00390,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x00f646779628de768f0a78b66f79310092a7eed1b1f42d871bc14945b31c4dab&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00391,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6055482350dcadf13a115468db04f05b533177f9cb92ce0d1174e80cf72ffe92&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00392,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x01eb08ec62a30cb0bc16493c077396adcf2921cf45e7fe07f8ad8a9eb3cb2486&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00393,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa5b5b2ed61c5a22e51f28e7081d3c57657bfe1ee7ca90ba380e21b0c29bb871d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00394,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc96f2c65a9b708e26fb06146840df2ba2fee86811fc64b8b03cb8da0e864cf21&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00395,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc7c791690e0a24e565ad4325f0916eacd1472c5c67ed9d08007f519ab5ea4751&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00396,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x98f01c73bc56a14d597f9a2fc522c1f9ce473d5aebcf9f025bf85e10ab5e69b2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00397,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xece428f5e482195f4fc650d8ba4535cdc50da4bbd6daff83dabf40f0fc1cb264&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00398,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x15d52476e016b06a31965a6f867703d8e72de4d75952ea588619e24d16946860&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00399,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x07f402789b0a04c5c653605ae4a4d9b538575eb278790ee1fca13e1f47aa85a4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00400,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x837a78da3c31e197110da75373e9161ec3630eac20956d4976bfdfe5a3f76705&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00401,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf319bb85477c7540c8296e257ae3e9887477cc5ce6615e79ff465e67447ef449&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00402,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x28918ded462955d7564a1cf7515dcde37e47a0bf649af47ce19c1bd2f42420f2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00403,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8d3e10d5ddb059e88145c8a640d6f435b50abf014464ef4112bb7153172e8712&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00404,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x729d063ef003bc0cd25960f423adc378a96f94bf330e2894980e229c7f792827&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00405,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3857def7fbba5ea6f0330f98e7810ff7efec3dec752c7a72961925ebb55935ab&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00406,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7be7d5cd302192b0891e799f7fd3dc6214225bac396740ca00eab0987afa0e15&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00407,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0a5da5b2bd5353f6dfccb3173ffc30d765f1abae1eb3fe1a2ba70a4c9e69144c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00408,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4ef48eb40d14a101421b182a44e62e46058b24a968731f9672658c2998359339&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00409,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe4148ff741b9ad3ceebc501e8db8796f923b39918bc4e003164b490a0b61d9a7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00410,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb195d1d07cd0b541bde741b4086345048fc40eba5c36958db1e84b72f813f9ce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00411,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xab2766df14efa74b0e28bb35708e39d6b1ca1d0bca5a94ef65b5aedfb53bb200&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00412,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4fcf3d8ce7b02562b9f72decca131bda4095b44bff685e901c1a5b5d29ad1bdb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00413,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x371970b092f836d650467a8ce9b049da8e286f73b4ef1063380be6ec1c07622a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00414,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7525f2eda283e525441c353da10bdc982c0b1ff04dea2c153b3543fdad000b73&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00415,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4820498a2f344d87b28241909d366f5be00766e75b23645c45a09c75ec8dfdb4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00416,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x55dcafa7fd60cb0110e64c6d5cc69db5f031a572e110368f9067151b0890a0f6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00417,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9a836ceab0f6c37b3523b9df29cd0434d420819221ef1063600765b3ca5f522f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00418,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc524844779cb06e98494028130b971a762f7e249dd1d79e08acfc33d7927aae8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00419,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xaa00e84454c9ec2852bedc300676f8d20bda558c13442ec8b9a148fbe5d37098&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00420,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1a718263b17245356ffb42bb178e9590283ea2e0a82ff52dab5f904da8951895&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00421,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb7a7719554eabde85fa9f5bac7580c6f352f60a460f9a07fbe87fff47ba7c19d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00422,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x05e01b82ba2d8b2fda2a7e149186ae56e933298b9251269a4e2eab1717f44fda&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00423,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0c5c203528a51dc0cc9a0852cea64ed0debab06b3ac95d012870589a5ae4c0a0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00424,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7d31cd1ad7743f0c08549c8aba82c3914de61f8637f768725812dae0be1c3cf5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00425,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x737fc2002808f4c81dbad877b69160a9ebdc3f8382b5e1f2f08defce897857ab&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00426,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb042cd22b27a2d46775de19a0fe07ea0187139b69a8a5f9f8ad680b49a50e81c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00427,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa5f8fadbaf1e1b1c025e9ca7646d214d84afa0d2575026bfd188492553ad2dc9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00428,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2247adf42e4fabead0c52c18fd8d9c3d378b6a82dc3941e9f2e7c03a3e6a5316&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00429,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1cae28d5c467521d0a2986ae1ab697c0137fb88a2cd57b7b65e1087002f4ca8b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00430,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xab59cee6f8c573ce2e2abac2865d1590cdcc0e4289aa75144582810327d2bffd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00431,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xed24090f25bc8dca7749c25f4d6a81a6c0421251b40e9fefaaf7896a49e1cec8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00432,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xecfb2f473b32475d203492960f9c706024ad7be82ced8dd0f9506c2cedf3b29f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00433,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xea10cb3faf85fe26801f5c5c6f963aa09936d48cc6070abdc86ef7c1ab93eb6b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00434,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xed8823c84177d8ffabf104566f313a2b2a43d05304ba6c74c2f5555bae0ef329&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00435,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1acee0de8d8fa5a692ca7fe4e6e6b6070264bbce1d27bae29aa96794a92fffaf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00436,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc3510bf4ec6f2561e65ef90ac5f69719835bd88ebc526470a11645a2c743696f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00437,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf2dcc620fcc9352d6e87c27c30f9dcbc38e05c66d4cc315a6b04b3007234821b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00438,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x00f5e21daa244de11bbc15728bcda77c7c15fd858252459ad7c10c0ac877ae9c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00439,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5149508dee482fd1927f619b3984641ee6a4cd545e763475d97a759cdd6b9ce4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00440,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9feb91891bf0aa0981ae9b6d8a71dbec00cc4a2ebf9a94a0aecc1815d621b2c1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00441,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3f1832caadae9d68b7056679e7e36db138a48754d0bd69f0f7c369ecfff7763c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00442,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1d30de4aac58ef2504ba7fca3cdc0536a6129314efcf91c713578bebd2182e6f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00443,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xea71b6f9916c2fe3cee071ccbbf4105935e111b40d71ecc3b327ae5a992a6d49&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00444,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc56da958661c206315768f8f855721cce15e24ff1f350b294a1331eb29db56e2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00445,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x02cff3d78ac49a70b6466ab49a54dd2695b8ae3a423b9e52dae2351864ad4e4d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00446,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2280f1cf6ebfeddf1211be1d8801bb188f0afb1626da2921ee603ede2bbcf926&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00447,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3cff32e3d7dbda7c7efec80b3c9ceaf9c56b9d5d0c03b53cd12897c0ecb8a59a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00448,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7dd2c4f161ae53d17ee1bce79c6dc3a848fabc81c2ed01d08d768e02c7ae8b19&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00449,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6d1d274b948411de02b87258045266f96be9a450a363da2482a1219aecf586cf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00450,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2b5e114981c6f32c8a3b78fa35ce6132d9ca9b597dd94ffd91b77657f5e51be2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00451,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4abe0e076ff522ec7b0eaf0d6751f9dfb7f164b42864e0255f1502a77315178c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00452,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x42606107511944b1c7dc61fd2d3467fc43128e69092df1eef47479dbca67f3e8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00453,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x23cdebe00f8b0071fe04101936e236e3dcb4e58b94a8101a0f449ec38aaf53b2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00454,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb2b5e5f97f7552d912156e250165b87cf670d32260186a1a41c47bd53e4b7f51&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00455,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x54943c8b31b13a4f0cc4f3472967383de372b4ca8f89979f6043d44ae330888b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00456,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcab079083dd2ddc43386c219d265ed110b97d315943e37e859764ddb5c380a2c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00457,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x82d06ed1ec9bfb436ed64caeb0a1c99efdc719d79167ec9600fed7802c5cb1ba&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00458,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2bff3cd79eed0180444dfcbfb8fb93579be52e5d0eb92fcd3ae6c70702a93254&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00459,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x29e03017ed0f32215c0705d87beff1ecde7afc804217ec41c250a0541e71dd67&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00460,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6f2ddb12b11f17f35b123ca3692ac57b18043af935e33eb2f662fa0fe862a866&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00461,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x86535bae04792f1724aabb2201189ef0b12ca7624e1e9fd296d129d3ef1f74f7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00462,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3658342ed3dba9eedabc93cae0d6cc657bedef4d1dc6c631113af874dd65fb64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00463,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4f586d74db2e09c1ddb553421304a352ae8ca4dfcdd49cb9905c83184cd1050d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00464,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2da57d6c84f0f2de638453005d496136fac3d1a4957f0e6a8aca32070522c965&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00465,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xafdd52d62167b3f4a6e0c88d5bd5fffd1f4fa06a528e52f2cf3a095cf5f84fea&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00466,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x21cf05fbe816d55dc025ddc38f55aa7e66bcdb98ccff8abfd031c0832f69dd62&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00467,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x27685b9d5efe40fe088b50b9a1ea62e8dadeb0425171ad45e6bcc3c283af2acf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00468,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x610466b6f8c2771439da2e8a7343c8d961a040e3bbc73ca6c661e4a13f977132&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00469,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8c5751e2b93bc6f0ddffd243332a890e3794bb3de71a80ca45c95b971be88167&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00470,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2e445b03b86127fe3149c740429382afdd2d0bd2e1ff0b1f05ece2e23470017c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00471,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7f37562302193a70baf1096ce39a616be3737721795d7a106ca321593f29af71&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00472,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5f279db60b9c122ef92a239345b84ae0d9d6ab6399ef756e89078c9ded3df15c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00473,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5ae48eaec56b9a49cbb966ec90af455eaa03ee66604e50195cc6ca4dc3f0e1b6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00474,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8b70d9c82bf64392306a74b2075f1218f3e25ff143962e2c63d0300437bd9794&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00475,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa8e53747848b2eee9050ce20905f07d99282ae9a35ce825ea1b7faf09677a468&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00476,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdd34a7c17094183961aa4c17d9cd6e2e73daeac22f27af1f0d948772d9727e11&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00477,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x488d852ffe678ca5d7fd3b4f04afeb893595b929c6a968c2b8e6ff7204be27bd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00478,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x232a4fc9a0cf3b37008375f24a562c44e25a0f54774e2384db37ea0acc0b599f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00479,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4b082f2481b4819595dba7d5f02505e200b32e78c59100241de37b51720217e1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00480,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb54b802e1b7923c298d222ff23b5f0d1c8b76b886c764b517a1e29bd4801ebe0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00481,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x213ae81b453ef36e78b560492832c28c71db8bbb5d12816cf0477c16155ab8d6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00482,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5d09d6eed5b020f1268016d5117587d519d1aaea97b575c6ab24a85135daab13&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00483,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf3c11c6e063ba5b267f6616529b2495424a633e08f6a78bedaa660496914ca81&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00484,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcdc41b84ddcf6530555d2fd03651ca3fcc29981f4b9df53944efe410442174c4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00485,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb26f2e53df52942461b1c54800e6eb25858b1d86f9bee68c40b8f13ca1fb44bd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00486,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x82b8c438d8704a976289eb09500c628a3c07ceaca62d081de94e345d14bf58af&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00487,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd834f157ce0cabf68f199cabbda6fe5a47256b25acbfaabd376ee9d28d2366c3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00488,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfa3989a5ba10e3c27731de69a30136ee3ea9e603cb27d12e2a5f32afa60ddada&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00489,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4db390c5cb4c32c03d7f9cd7b8823b700e9d64da825194b83e3df46ce5751864&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00490,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb9ad2e4d9c6627f63d60befc8778777c829594a044f464f12956c904486f7691&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00491,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6aa98f9f56f6ef66ad09f15071de716f61e203ab7a31a98737fd5c46649a14e2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00492,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xebdcd70d9e477a11b4fc48d3258dd5bcf6c9222db25dfef74dff86487714b798&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00493,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3079f6253e59035a7e4a039275e685c9017d7e1055252fcc7db8c4a5c9bac205&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00494,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x33f97b590b8f704670771f738f9df52e2037a876fb185f0cecb89fba754af618&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00495,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xee3904aea19ec5886c2f52956576a8e81fa4b2bacc4464257c1dc3190d6694bb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00496,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcdf13c18466bff16c454c4548995f6d11eb639ebfe71dc793b648066cbb23cb7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00497,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x27f7ad957db315648dae2007f3c0c8d7ee81a6c7c3cba09119091325e7ffbf9b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00498,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfed48beb69c269ece25dd3b123aae953c66433728e03370df36a76624736b61f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00499,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd9c9a7333aded4d0f68412484ca0032f348c55ce9ecf21c986d22855625b3ba3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00500,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb11653db38e95638077c58252fa5695f38b933a229decc1bf3d1dd124c0d5f00&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00501,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb202cc73bfc03b7f9f584614f21533221cbd0acc95409239090ddc52b5f27d9a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00502,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x19ef7cc080401251d654b9529fe8018fb1bc1a58cc6b99e8a5a47a40872c5955&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00503,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x45f20620961362cc0f7f6e4f3fe15312150eb015de00fe77f6730383c79b9688&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00504,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x21e3a8f27e2686892a5cf54955dbf7509feb97114352d211efa8573dc344245d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00505,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6dd1ba5667a00e35a95d075c187344e3dd341c0b96e9d7c686b1cf8768e2d4ad&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00506,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc0414076dded3d476fba3387ed8b0eb57402f1017dbd117dfaa64eebeb162f24&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00507,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa7340f2eaab8704157b80028c86a7f0cb1fef4864da34554f08dfcb614cf4955&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00508,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdde4c38d485ca458dcaf7dd54cbd451ee8c9eeae251d59b2f5fa6faa97280a14&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00509,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfa5dc42a17a4f780caf728dfc049b9fd56455f05e2ea06202c763ec143b9fd6f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00510,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xea2b8d47198cfdc653a2136b98df5615aee70388df0c64eb5cfb90cacd50a931&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00511,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd5d2416f6a00df2713ec8fa6cc13ef973d1eb9d900d852903fe1046633599565&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00512,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe2918e5026ffd68825dd25cad6ed824a9ab0a4fa4b85a35c4ecf4ef8e0544d08&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00513,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd39eefadcb758f4e3c4e4b34eef2e976c6a3959432abcebdfc78d06bcc3148d4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00514,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8bd8f6bdf0226ae2173194ea147c71af760a5c0c661ff1f5ad7cac137b1b6d83&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00515,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x66d4642ecbc838dc65765a4fcecd474b20b9ae0637244181a84bb373b13d5601&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00516,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xed3b11872cdaf7b8feb4ba80cc6635e2123473ceec8e939eb46471c70872bb97&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00517,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5ef487b21fd4c9f018e1c42787966f14f32ed2e1581fd159ea1e4259a6d73cc8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00518,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x710270293ed9c587e43e725361f93c98be4769eace47c2016e4189ef59c5b7e4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00519,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x218c3b62dc99a297a595e41cca22f5f8535ff99908dc03940c9e4a855104b61f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00520,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x062e17197c2a5da9db37319b5a50917706cbb5b2f94436f231515944f5a533af&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00521,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5b55367f4c641c3f847e97b9507772f3defe8e7a7b7e7ba7485a5350838e1786&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00522,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdbca1ed318fb0b730386df7aa1e3093735b7579852cfc869c4ef4bc80cdd6564&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00523,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x297cf9d5925da0389d57e13787de1938ca0efbc4fdf2683d957e86f076191df4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00524,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf389f3b6336ac065daf31616b7dad80bf6e725ffa95b57da3cea36466c04fa47&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00525,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd851e82289f5aeca6786aab0281c156e6e75cce90fb8689cbbbc6cff69f034bd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00526,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc69972a185d32c7419238da9577424406252b97d93001e401d8649fe6991809c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00527,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2c103256a2b901f09cd43ae21da8743d4b7c8e5c925d98a67de5579de1d89630&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00528,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x32a674ae21d37007a12f57639d299bd71d378c127c3b5bf80d9b7b72f8a89800&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00529,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1bf711d19f7b6ee55cebb887105666aa7f30c594081b4b9bacca5b42c935d68c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00530,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xaab9d4e3f1f4a07e2dc09ecd78ee8fdd50daf8ec5349ce42d33e93e73452e1c9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00531,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0f51dbcac068fc62805ec9b43a0b1b83c683b23f255eb63cd81ea3e2562953ca&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00532,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb4c6703d6f10db4d87cfd07d94c45cdf6176fc42656997210ed219af1320df18&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00533,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbb2932ed5e95ea609fc5a252cc60087f857230da2797d62330595e0647430f1f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00534,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc65d109d82fe28526fe4653452cf09db4db6a254c2c3054b8ce3d6cad489bc3e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00535,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbb367122e14176555be535edd3085bbffe0cfa73f3754ca9eaa10dcae6f60e82&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00536,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfaadd066133e49dcb1a5fa2c92f376f3d165c3b276ac75e5881fe7012b2734dc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00537,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x576b374c1d32e2db299b04073d838366c4525a766e1c10dd8fe0a79ac2ce45f4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00538,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd8eab6c1d289e8f853425d63e99768ba364012c21537e9be20e9b8999ed94eb8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00539,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2c32d06d103d4b1f9d31779131b008f404e149a5bd8a53f6805ad0331e592281&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00540,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf3078a9b01c1741a63baca8c231bb4a482e62d835c4eb3ca3ef752154ef9454b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00541,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3063ad60f10b704d724c082e97a0145796854d3ce3d1550347309657dd36b8f9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00542,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x90a242f8e1785389d27726dab026c0e30677713f67c4bc2747673358990aa4d9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00543,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbe9dd353aa0b026bc9363961397d25bb46f26570ea7f90ed982373d6a7115c72&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00544,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1c5c761520401a356ed867ac5172ffcf59b1a9b9c6fda3908a4c9474ea075592&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00545,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe6369239027eb6239ee703f7e9e6dfdb32dd1a94b70094dfcadc9fbe0154e4cd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00546,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2135141345bcdc69e19b4e3df1ce29a017c07fb80df9b27bc38287c2c5ccd628&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00547,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0fd9e031326788cff66e44315940516bf926d51524e880548d90717d0da9d6c6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00548,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe318be79b341bdbc93f1900e82a5fff4f52df9b9a113edbe4bfaa512d1411189&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00549,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2dde72e5e61c9eea6351d4ff14794a71685daefea6ed3cf9b62ca9aa99f9313f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00550,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd89b717d47ffb827b1490a37ffd97547694c6ad3dbdee5cd56a3583717962751&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00551,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa8dfd8606b55c4f54453ccf9e48838bca6accabcb629be668755b0a13867a77c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00552,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd6a3521a5eaec4c47314a4b123701777fb7ab51af66093ad8c57bde9249bfe8a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00553,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf702584d8c87da3ca916ab9caac71d0a0922884cb8db05cf513d5b4144bac3a6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00554,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x700d58da768be40c844feeadc5f42385dab83a5b758aafc432172fc150403739&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00555,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x41db6d144ada4684a7a61e108131d5d78d250b3e47c8cccc85b447e5b1088a8c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00556,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3503dd53c35d41dd5df98f30d4a4df5f7c4a456edb598cb5c2ecc91cc81198d3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00557,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x02391085f2bdccf3e4774ffe1e0a7fdf318fdebd564f5015c64d6d1edefb34bb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00558,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xed670fa946019be6e96bd20ec27eb5c92bd6177ae0a32fc9cbe2c179cf7f536c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00559,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x63277435c400bbc4916dcf4d295ab0cb233d68834bcda11cc231e999996628cf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00560,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe89160d7dc2b0d06408df356eb166aad39c73e6fd51e97f5a64d1f6d57fa1686&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00561,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf95c755f337bd6df5127911e601a763a36070bda95ec63ab8adbd1fbf148a35d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00562,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x97a6fdba7ddb6462d9cae6ecaaf13c2ac670f7db6216547a5c20ef46a9a2af6b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00563,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8aa6ac0e68888875b0afe306759d787609bd56cbad19a9cdbed484cba64b15b6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00564,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xba8486b8d3fc13f529e72ac00fddca459b530ff9a9ec0948a7838089401efc60&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00565,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7cba894eacdce587e611f2740c3de0d15e3754efe0331e976e1cf0150035fb2b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00566,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x54b3e34b615873aa7def6c73d8d45bab4e5f0ee5a9c8e503340ec9bf42e32cb3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00567,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x40280a8567c1cab76c46ea7666b3f17b06a6b1d845922feb286020e7c3439091&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00568,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xad863b1e23e92bc3b1dfd81f66371f01eb200bb178d4c1659b39fecc1d5209e3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00569,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdcb283eaa11602480e3a38aec7563c48bd939a61149760408704f243062dffe0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00570,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfb9123623556bc897c2f316008fddb109a20ce6abbb666bf55d9f0e96aff0dc6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00571,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb65f3342d82ea682030d61222badd0d0032f03a44fb33454fd5965edfb57e9ab&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00572,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdc59179d2daa0417c7f7879eee3d53a08066ad558a36cee1535a9b515b0d0cef&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00573,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x21aec308be98ab2777b0030e3b55220901ba3e4c2059a076086ef52e11e15e9c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00574,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x55e72fc99ac693fb34bb00d1ed8611d53d6414693acaaa52fdabfd3099dfc88b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00575,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf6564eb58e1d7f625d3a634513ab089b913301c69a30faa1bb52730be7908721&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00576,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x923096d4ee10bb045085a46459592497f6314b580c75c62cda1e27c637f105df&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00577,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5914605dadf8851cf40c7591ff45b182fc6751a233e8ded429a92df0fca49c5d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00578,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x57d591a81cbbb89601aa972f81d25b61b88f534fa7fdbf207611ebb6aa1cc267&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00579,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x705b8e045b05fb96483e3356c8b0e0120cfef7a8e9649476bce35c26a8d25f95&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00580,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5b210184902c591dc9dd3630edbe4d816137515009ff3447144360d49ee26317&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00581,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd3dc3f99fc86600deabcc70f3bd7ef4fa9fe70da3a428b2b4ec622012b115d7e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00582,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd6b2c7ef628b2a4e0be27bba141b8f45946d18ad5d17255d9230b21555a377cd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00583,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x434001606cc9da452057323ef3d56d1cf3505f9dd19aae59e918617e11e180e9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00584,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x21b2682b8046bd14001c17d9a9feb7feda179d3a56f21a722df82042056dd1c9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00585,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x02f0b1510358fee5dda91e345cfe38e0e0bdb0643d0165ebc51cd382fd0ed6fc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00586,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x60d868cb6169cbec6c74545f6cc362b6b44290d889527a728b1af1f846e9230a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00587,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x59cc91f73e2cb552ff57ac76eeb2de51c49f80f237e5e05302115e2d1500f668&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00588,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xefefa87ce3db08c5545fc2bb64021e8112434e06ec3760bed7b6440d852cd576&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00589,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x85c8dc20f625a20a8d969f1cd97a54a4c760817067763f9992be2e1e9d2d9e8b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00590,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2bd79cac465f01ebb1eb59886d2b7d2d1c7b7c1debb19d5cea88470aa13fadd9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00591,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd9b21bd9fc16529e92da39239593c1021e195231affab0eed3475b79e01d8c65&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00592,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9dd2dc6ad9373a8e5e80ec6ec9eba8b0f2242692bf27a93678270986620a743e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00593,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0a9de411103269d9df322cc24c80bc49e30b0d0021f0a13c84e784a95c1412c6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00594,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x54bb502669ff807c87513c7ac708c471efaf3782d0ff9b7dba577dbd5024a8d3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00595,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x08fa26596e31b58ac3788844e300b057d53983911166d3848105b53c0b064993&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00596,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5e2423f9905b980f953f2c35daf3385540333d41dddd46c710ab7dab864278f4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00597,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x49b11d141d74f6eff4a99a858413e3ab5f3d3740c6ed5c705cd66070af051a63&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00598,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x050d0b97623cdfd0c8d202dc6bf4e0c3a73df861383ed307131163623422e0e0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00599,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa19b1a209ced8078ab2f240886f68b64cc67bd5806a08d472ba3cccefc5eb9e0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00600,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa81ae85fb6a0ebae94d8df6f34414ea890a7ec7621ac195c683a6d6c34a594a0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00601,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9e26205a26df3598d2ec6236069fb7a74c37fa84cf323c4fa09f4bf7412e687c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00602,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x287136148ea36dabb0693ef81fe921e25974d96a2724ff0d86b10e3e78302ffe&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00603,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9a115bef53f5237d03975ba6c2baf4377bf8e15ac54bf2093375681a38cbf19e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00604,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xba62e0022781cddf46d8da27f2c69b7c1dcd33fc184b2329fd59cb187e351d3b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00605,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0d936f160c2fd830cfc16d6c17e87ca0cf6e6b28ec1f6b7d934100e82d61c59f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00606,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xae859b842f320c06c3899683b50a2d37a32e1b07786c761fa092e10e572793ce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00607,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x62d75fce6440773a1c0e6573ac37e429164c377aa00135c7e1c2e2f7b06a4759&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00608,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd449c48d3ab67d1f1f15eaf0dcd5351f9c463f6aa103e6b4ce6a17a3b69bb523&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00609,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7e60445e276f7e090b8ddc8a36a01bc4b66faa212588130c1175a5797a837bb6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00610,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2f230cba76af9df75862b04ecf554ad6bb46abd4be7a8e99dc468de6d5905408&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00611,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x290b8c2bbdea109cbf5209a39382993c21f9d520ff8fd07e85d273de90c5f587&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00612,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb363f64740a275f7816130024de8ccfdbd67fae7526a015679bee407a5e5f485&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00613,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x80a4144c9bb6e7aba587a8a91a1362a5edf92e0fc4dbcd339a717a9200cf391a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00614,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x20913bde281d7f10d729b290f509ab76ed07603f32033cb73071f43cef734092&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00615,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8b6e7a1e1535c08d0457aacae6cc68c0385a62a35282179c726707090c84985f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00616,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbd35481ad334939158e73a3b0e8214993e9de1202e8a8ff567c5dbf88a3dccc1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00617,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x624ad401fff7fe715ab546b1898e5f3e735f42c134d592d49b4615afd5b6d3e1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00618,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc70c6f7e13ccb5d9a1e56381ac39cabeb4c2e9f1693134d59599b7260bfd7954&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00619,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1b807cedf382c87a6ee8cf00a7178eba5516948a0318aacb8176f3e577ce0a6a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00620,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x850650230838e76460e4ddca3edc33bd286c3f8d40ad3a1ff89b35280cc6510f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00621,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x385fbb21923e5bbca8952a90a3d861ba963d83ddd01c9730fe177341cdb25260&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00622,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x92fb5e57d123f079903c0f55481f913c45d490c7df412a721d38cbc528037875&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00623,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x642081dd761497e077b1aab32917656570396000b075f9c182ffeb34e905bf91&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00624,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1d72d6273c3ce96a26a5442357d4bd58b84dad51a2eb39f25ec02929e55290dc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00625,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf7ca7cb8ad47a85c6dad965e8c89bf7b33af62fc5dbfae0f5e141ae4ae1c280c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00626,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4f92dd261b9f5a9ed03735dc46722963d949ad3038f66ce380e4a1aaec9997ce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00627,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x06e70723c3b912cfe421cb2126e812684742e304f2b8f6d6eb57b1fa959b19e7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00628,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x313cbe432878645b4d887d961d6ff1dcd3c75b508b9263c05ed385754b7c7709&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00629,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe939c15140cdf455b99492b6259ecf0c93ff858719948940f54dcc0d202988bd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00630,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1fbd3e9af1082f0e99094876294f6a857d8162f32c1f583eba1618acd2099a17&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00631,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x333c0583cffee0f355a1e3ccb6aa6aa16c80ebdc789e698c5f0f17521fc75035&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00632,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbd6027f363c5a6efaf7d6f483653d256c6038a628064927411e970280a7ada9e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00633,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2fc5d74d149d6b265a5f6ef7b220738da67423b7aa176bd97d8b1c0df694ea47&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00634,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5b3c9d594d6329d06de454698372063fe7c17da6f5dedb0ed68d7220e51af8d0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00635,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x95e4dedec09d095e65d74638d433817b736659254cfbb46483ff449a9a1414b6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00636,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf8124b1e4bc3e7715dcff4eac8fdfd594f035a5c37ed7e041c85928cb0f32a93&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00637,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x12daf758eb702d488f8ae9c61e89b165f4b1e4090dba46713796dd49866585dc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00638,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x75957ec2b9f6cd5f4e74a8f9c7f87432ba90888af7eebd1cb621b4d8b002d113&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00639,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7c4f218a868ac866144c6d3d76ce9418c7674546ed3dc36e8ef313dd58913d6a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00640,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3cdc61329614d0f9f495f56c7be93a89783786ec23004628348b62819a5db04c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00641,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x471f9e808ae0a317cce604dd035331ef6409ba0c3b0b0bf36ed93946fcd0fe83&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00642,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x551764bd61137d2595500f29b441cf8588f4ed1f7e1023182ee72656ad70bae8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00643,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x368d4f6f887c76cd7416b91139d0613952a137d983d7ade47602ea026edf5e04&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00644,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x81a7c3da06068fc345f11d7bc65b30d249f3bae56c476ef2c16a2d7a04e19112&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00645,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2582b644739c464536ed4befe7d7bcf77bba70a416a74869934701eba0300a4e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00646,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7fd3548a22eafe728cfee056c100c5ec3622ee0280a79be7b7fb5cd1af2499b5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00647,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x07e93c81557232d569357182dc05bbbcf7ff3f5b3786163cfb5df756e601d9d9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00648,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x01a981a6bc6a5c30e9e24acbd2610094f612785ee1da40150ef6adf7759418a3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00649,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x05bf160d3f11c285bd8d159e9a675bf04b17615fcadb4390e8f582246d52a263&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00650,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x119bef0c67ab4480ee8952c208c75959a4a98db6b646410d4276c650e107354f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00651,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4d3f0b82017c63839fe95826858a18ac4ae5376c004d04a23aba4d6d7a32b96f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00652,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x730975c7bcbee5e2bc9299e12abb46dfc7f5b94416c94b6b103ae22d4a189049&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00653,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2eb89f05e222461e22e437518949767e25e432862909e07df410c6ca237cb567&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00654,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x51b0bde3cc9eaf4d7ababa77e2e06e65b262864cd9894a8f9edf4b3483ee1d28&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00655,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x06381406a98b16d278488bbba3f91c0ec10c1ace930d75833f15ba9c73500a2d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00656,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0c07242390289d92c0deb8bf23da435720a753a07822a0bde0bfddc258c2ae90&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00657,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4b0dfe65c189822fa4cd1648d3fbb1ecf75b8b5538383cde1b3f899caf1d1bb1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00658,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xeafc91b6b61da1feb8af3c78fc9b7d01239962fdbfbd40c920a55f620ff74351&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00659,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x49e7399f27b5e26165b5603002b529ab4a974346259ba9aac2128387c0b6516a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00660,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x376add4f0e8ed9e97c43c5e439d90b5742c913908bbd5ff6da3ea59ac381da92&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00661,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa8a70e6e484c3180d23874a903ba032a1377e3bd53fa9818d7c11dae93883fa5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00662,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdffecb3c77a67ecd4d71ef3d16a47cb27dfeeda34126567620ad4bc0e6ff5961&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00663,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6c4ef261baa1dc41e4e3f559e686ce4e340cb14cebebc5ec6cd2d8d11b4bb550&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00664,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3eb2993dbbfdd451bf6ee204a1aa8363bccdf05442fb2d37283d0e9743c9548f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00665,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8f4067864f02001aa64082821d09b6fa8bd4f08eb10a97f2b3d725988dec18ef&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00666,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4ed7ee7ff95fba3f7e26f8ba3dedd661c29cc693e39ac180fb1cf51cf06be01e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00667,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa6b898d4e160d6568325e5178aad53d3b1928eb26c0a6983e2e564787cb59169&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00668,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc4a9d166c6bf0bf68df60ac3841b9dd7643261a1f680ebc4a3eb1e78a2bae263&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00669,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd8d978428ae77afca8ea889e5e315b4840b2c03a2f9cf046e6809ab3cc2bb50b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00670,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbe3afc5ce9e69625defb1cef154c5ed21bd685b3b444f0bf18eb578438483e84&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00671,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbf138a264139a579902a52806444d5b72e5a7d700b441fb3e48007d1d96badb4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00672,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbf106779ccffef7ba05420f4d363f699759225b5c63c0570c644684ed02a1a82&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00673,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdefe7756ebd4bbb46d00e6a9ec83e0b448ad30cd07e8140e8d198a762e17bc9d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00674,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc6dc6388bc26f755dbc33c06ede33976846dc45cf406aaacc275f36bafbeb8a6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00675,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1e729aa1a7eba72fa1b394e8e02ac0b11ff5b52c45ade0e1dbe6cf94133d3d52&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00676,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa5855d981860b945790cd878ab958c0c8f9d634e19eed4ffb6f2b6fb0bdac0b4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00677,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf3e17cb0fdfb1b6843f71e8371f3ec7943f3fe8c336f50eec94be6b3d7cc74c0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00678,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x42e737249c54ec77b3e92f6e2ad6cefa998f950a04b6e86467096abe91018de1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00679,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf0fc97a52d48a5cd63c3a44569661bf5d52b37631aa5de0f9c43bf9fe2ac0e54&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00680,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa6045d364b325ce7f818cda8750a79196c59419e2be015438e097fc8b52dfa0d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00681,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x247222f0af90a8ec543ba8c04c847b648fce30a323ffb4cec28f0c1571f878a4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00682,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa6b3aedbef826280e9fb8ac59718ab16e5369cd11be51532675fc454d89d533a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00683,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x19fcceed6516cae75fdec68f8d34a12c90b64c4d140c4576e724251e6ee6ebed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00684,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x388b0bdc52a25713bd30615e094a873e633092c199bbe247c96c32a61fc12263&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00685,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa2bcc3ddd6f1ec7a0e90f3faf0eb8418a297538a351f16523bf767951cdf179b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00686,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdf515337eccd495de4a93cfd27e7cd44bfdaaf7cad84ab831255b232d9c3dbad&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00687,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8977442562e00f0c2d71e621848a4ed4b54dc37900075e31d4e945cc1ff9cd5a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00688,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa979df6fe13d81c5777eae13b0416a370a2c631c41446e51ffb060a8a6a71452&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00689,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x33e5fa30c4826bbd3448bbb05dd7273639f122e9c9cacaad987e1def1daa7c80&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00690,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7c95061fb3cac78558039c1cebd4c7e70831f6f5a7906b9faa1a7554cbb43e28&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00691,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x062b4177522f6cbaebe9e708a4717d0f5218b21041f84b7eaa13293477135e10&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00692,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x945645ca1e3e1c23eade81c2c8e0a7cd428d3dc875b15fc9bbdbde163bc742a7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00693,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8c6754fdf4780c58461bb089f7d5cfce43a0c0b527b7044e27eda9852f34a7a0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00694,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x222e02bcbbe7f319c293f0c4da042bf7cd9c3bf8c953f4319a14191e4f005966&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00695,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcebc5a0e235e81bd4488436792b62e736be4cdbcc60f200326cc91b436808baa&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00696,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf73fca1b251055ccf2966f306db54c0201bea107de603c1aac0f7b2914386dd8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00697,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcc3b18315c91ff81f2f9c76c74c0aec6f4bb76fc6cee9512ee81026de4f687aa&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00698,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x062461dfeaa7dc2a5a6e7149f2ba928b78aef2b9958605a31185bcd7f004522c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00699,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7dcae2e8fbc54bedb91edeb0c02141574a70e0412b2045e311330119491c2129&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00700,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x64f029a915ad77e37247bb296e4e3eca49dac180d5b91d5b9e1366cb5d02df74&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00701,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc0ae757bd5b3d4a2a87884cfe45bd3ee2f11239b51f9dd5cfc05401c5c66bb8d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00702,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xabe351f7c2bbfcbe08dc7bcdb0eeb08079046bb9f2c94a80ed7bf8e51bddeff4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00703,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xddee734cacc8d4ef083d67efa4df54519a60e0101c0a43842eaf93af88ab3377&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00704,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2ea464e978346b97200486d8994e77706f83622452eb3850a745b215b6351eab&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00705,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9f0bc9d6161d69f28e3f342553c62fe53e281dee8c05002bd562b964c7abc1a6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00706,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x58568eed1ab113f2d3305f595ff6306f9bd4a20dbc168388afce22679b648ccd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00707,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6aca18990b84a8ef483d70e93ef95a3fefd969b44162724e8d205b2e44a60e09&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00708,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2478502ca3b5bd3787da2b2702e4ed470abc698594043bd7eefc6b0d200cfae9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00709,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x07426af091dc9d0b455e6c0a6de13abd24f3eb3a8e7763538159bcd1bf141645&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00710,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa70b753c132d447457a4a4c500a03afa9fc5a506cd08966303adf5439a183fd2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00711,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1146e2f9e5e7d485c0b97ed15f1f6a5d3ce2b829460d37cdb9ac49d7f6b2ee08&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00712,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x560a81199fb507f115ab5c06337c8c4dc0fe38d991a0057b88816849e2899ad0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00713,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x54d9396ec97021ae660990c80c6a06075f9e7e2cb7520f242b8c4019f29fe4c3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00714,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8979cc56b72d0fa09ab853f0c94da9223e371e4e3a76d085a8d5e0ccfa812c9f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00715,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1a583ca6146142cd35125be61ebecf376f08db4cb907d613d8877b383a961923&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00716,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4850905c37251bdd1612b0948a06170a335831bd753be7c62d0d50a8f10bfb34&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00717,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf510edaada3d10661180eb5af717d93b8c5e39971c0c7b82245958bdc47d4359&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00718,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x511c0a35f990cf41f851e42863956b7fa20eb133503b7f5e8b7dcfd42ff57d8e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00719,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x14409e14f0ae0f18d080c8f6bf0ae89e4817e214ac3b2c3e7625266375a502a1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00720,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcf91e8a7472e27a4172246ac5c5a761575f2f25650a2284ea607f8b607ece639&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00721,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xaa8695870b38dbd336c12ca05e61ae474fc3540e3780da64432d6cae23de1ed5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00722,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x96e85fdbaab8e3e96a18a455b6f7c52dfc256146b15b4a17cd5349a1e05dd900&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00723,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x78bf01d3000e5bf37d29358748ec99c6e4eb1d6e3203dcb914b0b7009bb475b7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00724,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd7c27830b175b06d64f2c9e7f6533d396a6527aa8078030d35e2997805031dfe&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00725,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8859c97fca028d013b18ac01644d4070df18cb369a380207c646808ee242d99e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00726,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa705da9bf450e3f38cbc0916a3430caf7b7c2e5b84b0eed30865c21417a787e9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00727,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x58d8312647f7b4f93bb4e166ebefe27b4031924f7550d9ba1d2ab7fa58fbd547&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00728,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2daec9311d82d342bf0a5f197beda1aa5bec47277d79baccc91d033c2151d583&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00729,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfe141ac786b2e586770563dd5812bab7673e4939e29473e6c4a1a75d5217bf13&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00730,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4ab51ad5fce5b07c3935e88c8a21e911e30fec10a5066b79e0d01df2737bd613&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00731,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x11b0f603bc13ce8a712ca6ef749c8c923097c455c6b86386f166b1e47daebfd9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00732,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3e648126f5543d814037eb55ff7d4079433fb586ec6b3a2bd0ed968f8fed9603&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00733,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x87195980bf623a55f7bb30e396648aecd839768429e6dc5ecd3417dc44c6521d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00734,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1a924a1baf8970146ef21e1ae77cbececbadcb975f4f950314313381d50fa823&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00735,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x34d9d6a7333d35e1f16458eb9bcac884e81f93dc421c3ad47b7a46ea6f929c7a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00736,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1569f88b5514b6f98302427c8ab4b4b6c020b517b290b2c7b1e8b6b9ee2b74f3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00737,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x288181ee87c7c1f4c8052ae1692959d57f9f4b123014deebfeeb6df20dfaa424&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00738,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x28dbb0e5bd25ae20d92b68183f093bf002cb40e2d0e7b9597ea6e58478db184b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00739,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4bd79b88bf29f2048cff7bb28f048b67312009bb49d5c33e0a8df28fb26de7b7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00740,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc84ee78099163d07ff47d4e2f864338e0fcbdaa1298b6fa71352e6896655b918&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00741,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2aacc622a545af97bb40c4d5decffd5142427c482ca5bb8ef7f29951e1807e4d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00742,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x165aa7d2b8608774366225bc7252056104da64abd35ddbd1db832ae375bb6031&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00743,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4505bedc2d45231f48b90817f82a686da0f8b362a79bb0d774cb396288491461&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00744,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x08785ac95582347c80d4321d003a4c31d343effc0cc8e8d4a32f8370996123c1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00745,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6ea3cb82c7125522aa5fe08d65c4edcd10e1823d312f13288c5ae9b69b2d2935&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00746,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3ec58c854981ed2f44dd8516cf166b12232e5e32d2fbeddf070fa45a1d8cc638&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00747,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xaaaebe5b4f04d2085247c7c9855d1add2e8f0d7e545c532cde20b6145ea711fd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00748,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5ab3b22293636bc4bb517aac1a3c22fd297cdf1c8da5cab2353c7b657208f1d0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00749,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x27aebfb9c574b6b4a90161369be8e3361b887534f6031f35654424c9d50e3efc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00750,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcc08abf8cae1d37837d395bfd9094e01b70dd66c8cfc9800fe8fecb4b2b09599&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00751,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x032ebacd972a00b4cd4fc81ee4e8499468ac379eabf1de2762e98aaa957e4cca&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00752,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf09c12bf003999d4e98769faca1a7c12352abd26bfb290a048b846c669bbfc89&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00753,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x876733dd576846ad12f5967b4c131194b19013232b270faa88f816795c403e6b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00754,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf50f5eb285818911c3fc43b60174f25a9e5b9dcac9a5f3e6914d8b0af439234a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00755,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4d52bb12e70194eb981ae85c08a02d16b7e899262dc34e7b028eda0a123421a2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00756,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0af4e42bc526ccc68e29d057456f30076323afdb70a6aaecef47cb316a689c88&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00757,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd1988f793da01c8d63bbd508befde9fe8ccc1f2f5974d9bdf0b2d8afa0b9f997&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00758,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc66fcb070ebb36a3ef93360bb74079d15f8c4cad6fada6a408dc33f982308279&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00759,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa6242a1ccc07f0b240026340ccc6d91d99396732364858d8dab438965f90545d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00760,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x824af748696096e08232cea82a07f15a590908d73e4b72da6733ed3dce3ce648&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00761,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x76b41584de30eb80fd613f82c44d7fa70aff42a1760221e3852d8865923ce75f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00762,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb3ed5869910b3b75a102644af13fb642991e19aa885848ea9099f31091cffe0e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00763,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x713aaaf6faa21e1ace76e89e35cb9cadc04e01a6808e264dc08075a0a4074e09&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00764,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3a6de7d91da79fe7ceb3f9ab4634e88efb40832ef2e776624ffde6b3d37b6443&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00765,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x18b5d60216a44d195c8c533a95a82c1cf17184393db431accc269b8f759f6341&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00766,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6b5ade6c06f8ba9ef42f64369a90145db95ee3f84c7ef2f4cc0bbd088d400287&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00767,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa008476355318634f1f429e5921b41860e1f2b84a56f25bfc4d1bb3ad99e339d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00768,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8dc563b6cdbec477ab54634e7dbe0a986ea6f745e81d1fbe2d9ee2036222f50b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00769,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xefd6696f77b898d126c7df1d9f481853086479c17279d5d138348e5202bce86d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00770,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd9db47f4de8d5d1c4700ea620d918e8ad0877e06d40183790fe55bf6a334748a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00771,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2aa70a70c541cd444fd2caf88968d737fa7df568af3e13526cb9efd7d0c340fb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00772,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x44dcb9abd03e34d90516dfcf01de57529d8e5efe899d526fb222840547e98dd8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00773,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe4dcc8e85df47ef9e3e5ca5d5fa8bf8597cde9c9234f6ee5020260e69e911b2e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00774,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x63f82331a80309f20bd3c9500671446c81923ce5023224f9502343c7db25d83b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00775,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf24f282ea23a59a5c6451e66987eca682686d8b5df910676b2fcac68e675a3da&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00776,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x382525f177efd6e19eb9949fdf8f31802f86c7754d43898dafc36eacdcf72db8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00777,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2d3a5e7ae6a0aa3498ff29bd9c01bb50be16608071cdc311690b08d54b81ceb4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00778,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9a24e96613beb77c7482edb95e3bd149f3a95df7fde1e01c23eff75a71f73dd7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00779,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0be7242c1c73f21c6912fe398bf625f142d4b00f260cd0169b82162c7b215da0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00780,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0b8c7a94e807b13c8053ee0c97d5f38f263e31d9fa703d9b11de00c7d4c7945d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00781,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6e9ae0809cf9e38136a64b629b4b58f37bcbf54b6744ef3121403abb14b1582b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00782,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe888e6c289f0734c57b9c61c1b6798e5d94139252173305a7764c8c4cc9da157&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00783,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x03027295eb991e1dd03d652ebc3ac786ee4c263504a78fe31398341844f235f4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00784,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb6efb516952e014d0e2197320e521f15d58f6eb8c88bae72fed90c570ec3bf85&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00785,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x79728b75e2cbcd3ec3a144ad474dd75eac9e1dd898fb3c97023c4edfe7d91890&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00786,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0586eef4843820a247d8f8201c6b77e828096bc02c4c5bc3d2c3b83bf42ce549&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00787,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa0d4c8c20e3a37f678959b563859677050107b0e63d043ca1930dd48a93c0311&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00788,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa55feb48d4922a3189983989333d70c7fc6b18656446bce243eaf77fd21c54bb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00789,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9b95d3aa1408771b1e1e743db3216bf9e512a1fdaf6035f7a9f40e3019e9134c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00790,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4a62280eabc47623a8015bbbdb99a64521c554491b9ca4baee28def4c857cfa4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00791,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x064776dafa35a56678a5574157b74c8e5f1433d823f8addfacd972e0d2dfa90b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00792,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe9a295429a1b3fe4ae05e4444fa3e7939ee234416505e5bb12533e45204ccce8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00793,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x93ac12baf1d3519d2d6db741537a098b5b97e00c7044e96eb2c49900a7d3c3f4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00794,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb199a3097a3b71bb74286673315795e98805a6951174ec6957b80bcadddffe1b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00795,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x284915ec1b0af683caaf90546c773bdb1e950f8923f9468192e160aa757a4869&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00796,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x80b8a59801157a40d10e17c3915a16f78eca8b03998466f59ce4c4f910ac0760&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00797,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x40e902aaa84d1fa5c8cfc7ec95846be5b541c785a9514f6886257431d7c7d5e7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00798,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x25bb39c7596cf80eed1af44ca924abd9f738b386cc3604beb0cc0e139b570a5c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00799,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x565a1bf8ee5e84e7e9ff397ee36a656ffa670321bacd7533e77eaf91ea104561&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00800,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6723d6d967dab127477429efceb7f975d2cec28aad8ddb603fef54cc69fdc6b0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00801,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2c9057ba31e7f3ddad8a3324a066efb9353cbdce8e399ba3061531737b118713&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00802,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x75e347ad895b4b6dadad02d048f988ec7298298756d55d924a6605e3ce2bc9e6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00803,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xafb8c20ffd497fd6ed9ce26ae25f7a83c66e30bfbae612cf83dd83972a75d7f3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00804,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x472b0432e2d130803fee6986e35c0decf8989cb0d0645cce4848848a30cc990d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00805,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa00ad7738c5a78e98095ad2803f5f02736ddf5fc471940d4d01642317be7bafd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00806,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4fabbfd520862fb8c2a3cef755e30fab50f8e235460924f43eb239e3276738da&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00807,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xebadaa845247da44fad909d4bad16b43a5e63c6f48bc3eaffe2b98b27f9e1c3d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00808,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x71a5a039aa5425f801492260210074426cf5deb420cb2ddf9defb3601564f0d5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00809,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2a78afe865f39dadda88e3d3d493b6be19af8374a62f0b48c3cc8b41e28227aa&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00810,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xddc911377e4dd2291f709e0243a6cc7331a49aa27aab1ef211470f4662c8e460&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00811,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x47305f69611d5c09e9f302c34c1a491b8166f950f14fa56ed0885c11257f0224&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00812,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6492e81274651a77c064ac8a6cec00c509e58de9a951070770cab002658d662a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00813,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9ccf4c433a7e66762068756cbde59d2c603e1dc1d64cd0e61bd39bd636ddd877&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00814,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x02f878d63294625f5b8e01973359df0621504feeb548141ee1fabd1747bb2f4e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00815,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe97a4d00ec948995c670a9c30441ca9f510c6369f00ef2fb38624f14d8531eb8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00816,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x13c60a90e71fbfa321264b1dfbcdf76d0b15f3adbed05f31b02848e4fddad79c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00817,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6f8e5552d9e7982de12d6cca3368f02671fa6b071f0618876d4a1e9a4d79a3ea&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00818,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8143cae1101045cfd98b8202617280228a5b68c0d4f37180b79327d4fd555a61&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00819,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3894e28cbfa568d39fa7db232e4954e9c14f36eccbcc4c1d35cb8562285fbcf2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00820,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x97b69aecc1068e3d89e32195d6b0058b13a2b762cdfbecee7d54256e67bc4b81&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00821,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x22732c1861dceac8803885adf29e9c9b7758ee5c2de3660d175aec67e0deb2d8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00822,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6977fa0d3194c37772fb68df9929cc9974fd9441cd4881adf20e17408465d544&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00823,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0d164934226bdbae6b1a9c2e284a02bfe3e7552ac901576e33aee614f8f4d9e1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00824,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0de9eb6ca895573dc439ff773e617cec54c9a3e83c8412ae6bed73594f51845c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00825,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x14eaae6399e76bb8c66fbf9cf4333701bfeda482cc347590402ba802332e5610&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00826,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe0848f10dad16982805b6bc7f6151605db509bb228fc49dc647bb472c0fdd83d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00827,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6846201d042855e80cd3e2a1b2f5f0a6360d499cd803900873c1900264e45448&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00828,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe89c0e11010967dc5ceb97b9ef40a45f36ecd9390c82b58d95592deb04b6e746&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00829,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3096af7600019e93e14000a119faa50fc3c60c4fedfab2b65ef7c5e76c40dd2c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00830,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x55e8b4c2d3dc809690f3276cd43ddb11b907c7a975de41041a1cf47e6fd535b7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00831,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc501837ee2c215da498b734153628de1acc5d433179078696ce82a4f2fda42c1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00832,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf7000808e45b53416da880d5a8a6face40cb10a55fd1a9f4c07bc125da165ea6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00833,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5d73b97ad48b73368898a1e39b0f725c43ca3757b9224dacd2f8db81b90d6807&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00834,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf240decca5d9b9a21a75948716f83b68499f5f260fba9e535320d7ad2b8f654f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00835,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfbd0a3686d9e771cbe2410e0eaaa2535d140a5b5628d2dc5b79afe2a54da0255&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00836,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfbd2c4fe042a2c0c30942153fd2b2a148fd11275cda67d7e945ea50d8ce9588a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00837,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8bdc330460491a8d07586f41f6c980500b273533b9a98d0d0d180230a35abe43&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00838,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2a2047ce16869ba58f7aa520202bc2c2345fac6bfca50e06194361165cedc4ad&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00839,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x84c88273e2546de530b060ff56c8c9fe3aef02cc968fbeac333fdc4de9c49cde&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00840,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb96ae20a3f7c6cb7890d5f72037ba8a1a8be4e4f758be430f089ba62c9886887&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00841,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5cfe6abdb5b075a8fc721d49e76d0c136de22d165ff61d27a7acf7050d84a31d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00842,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb7d8f3a61da1cf210b8d80336009634c26f97ec52375533406ac0f0f7e22f5fb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00843,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc14d7f51eb905c4e662965caae40a537cb7a85d85458a5508e91a2498e479fd4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00844,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc5eea731a2a18fbbc08066a06515c8f05d8838912d961c32b31ac31736d8e5df&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00845,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xaea57615f40fa35e4c73f273cee2b1f077838a18001e8ddb9e87d28286149014&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00846,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbe228f4af7a96d9c1cbbd4e76864e68c332232ba5ce81de3e11c0d8b33bbf1ad&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00847,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5721c5a99dfa32e02559d43450e95be7f59d245160fce626eb8e5c81c271be87&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00848,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4f17a7ba2d98477f2d2b3ade28f2107d35516e8f953b636ac1f6014f4d1c2204&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00849,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x81731fd5dd5f8ba504c4c3bd1080eddb3e400e8655bfb1e93da5450177923ce8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00850,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc8596aa574934f8d7b7a0c938ce736d7da8c63dc40bda9719b1469d1ef93ba0d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00851,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd9d76d294b8224a90bd65300b2bb1c3c5e53441b3182c5b0d41011f626046a9f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00852,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3db9cab96ffd143cf6bf1c330e6cef7467783d82443e5122006e5d2fa200f1c2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00853,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x05eacb145ed3b25a1949999d28e34eaf4aaf8cc033cea6569f8b53a4d49199cf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00854,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x787444532a61379ba993a92688941b3fac90f64fcf9a32d022ef0cd78544f813&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00855,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb042cdda0306e8678b89046603d24839002d4916d40849b5dc9e65f3124952f0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00856,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc3dd963be82c9bd8bd0a27cf846b0fc901d63b7a5de84844305385a2de4dcb57&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00857,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1caf90ed8dc29fba89264af3ba07d0874e2f03c223cf387fec52bb0b7c4c5017&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00858,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7d89c8e7e7bb553c60a7fff4c056575791ef965ece8adcbb8923c17c2ca42403&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00859,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xec9f0685cf4c7e59b45c2627b98afbf56f2d113415af631bd875962dabe376ba&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00860,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x608f5138cd3fdba7adca86cca1623b02d967a4ddfdabc1626298aef841f06e98&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00861,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbc7139248334659528164fddc3c05f6933494abdbee4e82b5c16960461fb6bb9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00862,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf5d2654fda6b2a14dfe9f390fe8464887263d7415ab839418c21db6d00b75e02&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00863,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x29f0d1bd4ed36f2a8fcddc968249af476e48f49eafa8c1cb3ddaef3c9f6fbb5d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00864,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xba09ed24136ed4ecce9e3aca125ba9cffdb949164e4ac0115a7e5636bae9ff81&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00865,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xef98f25e48fa78413bfcb8bc7d7bfede024ae12b74727667431d0b7b24c88197&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00866,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x62ec875a0d3529f36a0559e183518082de0a399e1b4840e3d5d23b4ea1e6adcc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00867,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6e38f92d9e902c7c4e46d334d8f15126fd82a220c3529cecddde6b7892187ada&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00868,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xada339e00fa18f5a7a48601c4d9db77332f4df313771b2a166bcdf02c07b5dad&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00869,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x687f70ac1c22d04c591b239219d4cea3fc899e22a15656cdadbfffee43900445&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00870,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x69305b6644efa1ddeffdbb7c5fbd55450e67237a3bb38fb8f08e81c567952569&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00871,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdfb483577885f06bf36bda6c0918ddbb8ff30612412e6b4a67cc4bc867f2c44c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00872,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1fe0bd683f075a332f51a8d355282e02186aaa79a97f75c6a317dea751ed8b30&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00873,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6754774ca2adf65caf7d126d0a1b7a3a9e9385968e96d8ed20389a3c3a96895b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00874,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x89ed1e981eaab47a9b1afe89f4d8fd3eb60d208cd9cc2cd3c94c2a5e784f3bf0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00875,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x918e70e47775c40e4aa6674b40d2f502e26dea08e7fdcc95fc612f9411268617&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00876,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb174fe364a001d733d0ea0de0724d33c30d59ead3ba2f7c318322935c17b9027&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00877,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1ee06c6001f96af9abdc53c79801ed63bac846f1de194b8e31fb0e99e6cb2dee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00878,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xacf82dea7eff2b6749a07263ad51979a18d25e10191259c97531804deffe5f59&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00879,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x194ae19978f7ceff5b951ccc21ca69e4093db9f14b3dd735675b658614b50163&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00880,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x88dc77d7fb4be097712c34808ae6bb09f4adc13e82457e2bdb930cf79cbb08d3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00881,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x291ee430fcbda963ea5ab68df639ea92ce325530844b6e5b43a306fbd3bf86e7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00882,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe0bd01b96a078f578b599838c06357e455d023c72381c0c9d96d2a57099f038a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00883,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x24ee5653b2b7060f64b723f52723897140c6a39d07a35da8b362335a12fdda1e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00884,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf46491735b52306f745dc8a439441898c7a9dcfe6301ef0cb0f933c55d8b9432&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00885,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x18be58079d1320046e689e4fe43cc04d43cfa1794999974288fcf3625e6411a4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00886,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7b8e7f87674815b502a57c0797eca3288e0b5ade2a8ca7f78dd7ba632b127e25&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00887,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xebfbdc0207cea435c10b7052a0937c699721b2e7e41a2d925d0eab2ab81e9c8b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00888,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2911ec4630e2dd25d76cb86d8ad8427de4fca247c5e641ff2ae16038edb9ff52&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00889,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7bc66f0a17605a2e0a082da2f3f99d6d424efa091d15c856e0bab50875629e07&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00890,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xde4cc0f167df6278f89a5cd047e8079d7e9368fed79d2ecb3e8b31537f744260&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00891,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1aa1a5b9610ffa5b41fac5bd68fcc7f767d3434baaeea70e20f738d369a44315&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00892,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb5354846b7a3b0764849ba2c006bbd7ab19d10f2479bd99c822442214eb135aa&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00893,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x75d76eeec8dd8ee7b5849b76e8e3c5b363adbf59fed68f0df8c89ced4106ff94&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00894,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x81aa556ec3ccd95dbb8e26a987f6e0434ca41766f68949258ce05f805f74a808&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00895,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4704352715ff20066ba6150a55318d0e9066ae548b4375e4ce9b31e530598c61&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00896,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1ab5749f22bdf79c27d6a073d93687b6e375b33f38cda1d8ea1b8aa794c0de76&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00897,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb81f63bc9725916a88ddb5a5a6d7b7d558afb1d55bf29d57952da749e99ecbb2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00898,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xac96c90242fbe989a37f1711dfed7051aaa38a13d8e8bc3ca5a518a90713cccd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00899,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x922b1cf4946990d76e6aa05024474ffce4b71c683db79dcd7d08fdafe537d04c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00900,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0f8ce28573d070b2160ba328d9eaa3d81af5b60443acea676cee7cd234f0dc9a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00901,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf6f06a90999d172458e44c324081d1ee668709a2e4273a35fbfcf1312b913999&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00902,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x65bd2e95f8d26b9e2b3360b40175eb62b0881772fc80085a3d872a533362f5db&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00903,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3b916edf62cfaa0bdca3d8b3f13b9654ace5f3a1c6c9a787dc07452b69cd985f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00904,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2ebf7c0d8151e785e5eb6ffbda1269e7d9d7f36545711099119ec1d486642994&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00905,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9e7868aa92b87527f63245914226d675e3d09172ef63e3191562d1869ccfd5f2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00906,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6fe8a5a96b514f6763167cd7925516af89e4014baae26d735fbfa65dc9ee1fd8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00907,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfc681d3f63c0705f771f6f7cf8fbae11076db7aea57e4aa4db082fc82324eaf4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00908,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x65f7339775a6fcd357411605348f51cf908f2a6bda04b392ce76132c1fc5a40f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00909,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x38ce4f9f511d38303d855f92e28b6e096b749211b0861af2aee292fd34ab3af6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00910,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd44a929f41f40d97e7767775efbcf22213dd313c0bbbecbfe6130712b28b2fb2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00911,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfc91f464f9eae7f2fe1844bcd1c304c8467227c5df40b5518f2d262e14aeb011&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00912,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9acf8a7ebab7d5ea23e59c7434b854b29d79a7d52153264f96886051df865c23&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00913,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0790733786688f30e6d7d11388f7daf100afa105770f218e84321adc6427fd24&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00914,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x822dfb1aa7d617e0cdb16f997d992e643890aa048e9fbf89051e42349602ace9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00915,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x62602cadc14d41fb1a9d1c682afdbdc3a535828fd89ab1474040dd571631207d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00916,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8b6dd223bb5846cf7af3766332bb4a3c7d0075b350f82c907db76a2765be8dbc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00917,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb309c46944a731132a289569e9cf52c57e9921b99cb00d02926f93fc83d6e86d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00918,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8974583a7b7ae104b867fa6ea76b999ddc399498dc070cd622df9b2eaadcf4a6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00919,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd139d7b42b3dc5b0316ec6e718f6ed470c2b8063357ca6a5525eaedfd77fe93a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00920,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5b83da490a1580b57e046be20c03b6f6b9378cfb8b8313a2d58cd10bac12884b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00921,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7a62f3b8756e0b45061ad40d0d08a4f400abcc7f8f9d21c4eac35d5eb3c69032&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00922,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x30f2071bcc7e743301be529cce48170478cf733c09f76bc7a007486e907b8d42&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00923,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9f05e1511533dd79377f64581191380f2a4414538f9812bc978575ade32e4747&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00924,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8d0da5014bf3664e6f3ee37a221447169bc7ef4cc2a98fd8141462fd4e6eeb28&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00925,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9de1930ee287c457d1d7e31f789e7d73dbd9b2ae0b1db00a74a8ce7dcf8b022e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00926,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xac17e41e8ebb278089444caf7fb6de4be8be17e0d2737713c19ee56e233b8052&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00927,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xad6865ca7acf691972f0906fa666ed8742cff9e41ccbf870f1c2e6c8566e1597&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00928,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3feef311a950eb4f513f3f125bf4941b2664e7696c637c0998aaec146910944d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00929,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6e2d1f4b1c5ebbb67159e8db1774180c58e50b633117fa630e99025a4b648b12&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00930,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x228684d7571e71ed0dc00adc98f4ed6242dadbc65bffe61c131c91e396206d0e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00931,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2485471e5350c5da449bbd5b6cd731be0a47123f5b26becf1790b2a65e8ea608&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00932,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf2f69e075dbae9462a935692b7dd566909e2d95734929376b0b7be14e0d42fd2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00933,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x44eff5aecb4e111871225cc1b58c1c04786b1a4aba892784b7551b9e8ba90595&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00934,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xac8cf5be8f250e984277952c431a84b01c0ebd96e4d46cb1b456d0aabe2fa7e2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00935,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc052cdd4116d1987a3939c7cbfa2f266e8d181465561a8d0ade58075cce59ab0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00936,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0d1ce1ba874c0fe555d4c8d7a238c459d5cd3f93634abd7bf304eac7a225bd7d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00937,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x20d0836298d617aab81be691f33cd1dc61546b081a1e913b7cf34e5afcb8c8d3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00938,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfb915a9512d1e0bb47c535ab0cc6e7ddaa439a720c4acd6d591be03ff738a402&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00939,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2d5f2cb94ecafe782fc87c9a65f35a98a38b249bfe8a6c6483070d22f485c752&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00940,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x31a360b2a347dc2d8ff1e2ee51c8d487fb02b3ba20ea86104e8c0010e6840674&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00941,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6247e765c7acc0135a2a1c8359ed9280836e63aa78bea7e5d489d44cfceda482&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00942,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc352aa92f9ed89ebfc84d9bf131e0e386a26b3e6264cf3ef6e0d3262fc55df2c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00943,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb8b31db995add4b70a2637cc3e46d37b0f9bb608f63ed39b1676115569cc95e1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00944,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2a8be08321010d8fbc280fbe2ff0d9a9102738f588dccbb4401ec722067450fb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00945,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x80961bb9747aa130e7b0f37c81951fb8d28bd916ac200bf5cf0ff8b4b5bb2bd1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00946,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcaefe64b2e4fb5f87ec1027d5ce8c9c545e116b687657c5b3789d195c29377c0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00947,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xccd88affa72df06596b5ea6d9429fb5c0d3ffb7fb2ae2be3746463c4572841c4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00948,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x11d91c258be65dae198f1301b2b3bbefc22d80a62dc3c789577a9d9584441322&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00949,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x209f845f27a7cfc68440e96a9a05f0bf9ffdfe3fa2b77f0b66ce46de6ee6a1df&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00950,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4a9dede78effcd06746878f1ad7c1c255e7451ead558f94a610d64de9e84a569&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00951,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6493fcf8ae0df3ba0344e3f3962cd9cedc50b435d278c680b1ad7fe580046213&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00952,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x611a2c464cb0aed5d1ff89013df62f77a4c66a4dbfbd1310b861e17c0821d850&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00953,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x81e7d01751bb41cf701d58e15e5e24af7cab732efa990fdfc807d04965a7949a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00954,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x19895bb27f335092570be78e1c9e4390bc3165c12f3b4801c3386502dc1c14fb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00955,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x443f9153e9d10aa291a75482f6ccb32b7f03e5ff28ffecbc218bfb0d17645c82&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00956,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3dcb543b7fe04863694029ec36709cb2be65281eb77801ec7a43c47421b2f266&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00957,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa2d2aa3950ccd9bd38664a108384da939a29e5bd3602b44f2e6d0f7e078f8181&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00958,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x24f3f044349785645a815ecae5ca634e5068415f3e47f83a4de78d1f5a0ae0a8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00959,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8fc647c479f7467e99986f5a67aeda9ffc96c49cc3b2d939adf2e02e6cb631f1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00960,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x680241a45f3921d7038f95843ee7c15a97fac6acfffad14edd0b80cd52525b8d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00961,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x759690ad2ec0fd1d75ef612e00b72ba25bc5c2cafa795df819ac5410fe245a45&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00962,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x12b37dfb28e1b19692de0b9ff9e4564d3712ba1abf0085cce006e61354f9b7c5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00963,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2b4168b786abedf1fd231b205fd827ce376aa3dfad7df2e8ffa37559c8aaa489&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00964,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa7136656c0ac8a32a5cacdb85d35f7b1cfbf46add043b65d63870b7be188e662&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00965,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8a62b4050b97c853f8b86c1a27865c5e8550689c699c7ac2cf18d534b4bb523a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00966,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x73e45b2c1971c37f6bffd67467b444874a0168db85f916c4e1e1cc0d760a48e7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00967,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x399424597ccba8d81b2fb6d2f5b16a310e43bbee1d546bc0a80450f7ab202a60&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00968,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdce8aff6baa754aa1d9c385dfd56b5d0ff0c9644cb0756cdecf9c4b1dc75396b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00969,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x49be47569890def0996f17dea252bad3c05e4f90c23a6b441e05db55deef4df3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00970,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x68c57c6ab509c836dd5c5c0ce07cb41070698639ea7ea4b9faa07dd05d9ae9b4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00971,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc4f6b046bf04ee48a7360f9271b8507f13e222b37deab56d84090d8ad7071e40&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00972,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x13a7fe3ff99f61c26ce53cfad439b83aa50af5659ca5095a1666106ae43b178e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00973,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x135d2ae11ee8c376d2ee5ca54ebe8ce915d133c5c9330f9669c3f870cdebe438&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00974,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x922bb3c21c999cafa708dbc7df398abd83cdb51aab98537adceb848b95b0531e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00975,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x27b6441bb01ad4bcc2254fbbaea88e69e4adc75d9305a086085602eb971306af&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00976,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x63eafa02faf46070cc68eff888506aae7e0bb2a4ef9558fa2ab095bd30b95d4b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00977,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x05bdc732d86d690e9fd8fe7fa8ee4077e92535202176ee37b9a2f124e7bd4212&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00978,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x95d7750a07f5423f61cbdd6797537c1316d250854bd865639df437ca3c70cbb8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00979,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8cf0d6245c51d3d854eb5a77b46562c4416f5dd64386eb5254036e44e189c9e1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00980,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa8768f5c3b2f7d860b55b71d01ededf8c4925a13c4f6eba25d2f1e9eb5232965&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00981,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc4e8ddcfb6cf6972583902cb5e2d10c8be3ba895b076f7ba8e29c09de1a5e512&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00982,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd4ecd7c319b9e27e4929f7c0e3ee7baa94b58604b55a0684832524f816124f41&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00983,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd39b640f89b8d62e6a58bdda604a6931e5a97494270b8c13639c9291152a856c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00984,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x22592d52da8f0eed167b072bd3f9d68708ac37af6884b76497f518e419efc4e3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00985,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe4e144f9d02c04d79c9d03a3141f6a90d3a9217d2f348a8b5f57ed50deba907f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00986,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb5e7db59cf4b1329d19cd7dec561c3eb7353eaf71f3f5eb92f1cfa9525425fd1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00987,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9316c767971e58e2fcfd1bfa386d6d678f05194403a9371194b26e160614f57c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00988,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x871302efe9a899f706e248554a0a7834244e9b94db1aacad82a96f70d50ce3c8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00989,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1c3a761603d969947df6da3491d18a2f55dc67cad3d7ae813aca79089e8e4dee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00990,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa666b3895ff153f24a671fb6588494111eecd4c4482379b6bd662361f955de46&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00991,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3154c955d0dc8f9ed8f5e7ebd476b549d5778600afc737a213ed6156765af846&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00992,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd078def25dcdd2df52d7e37bc2910e598ac00c921473f8d93137a07d3a403edc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00993,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6b2615f1fe8043e3f4f06ff4f918c0b34bed01cf776b535a3a16530b81fc9d91&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00994,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6ed3f90facb487fa49945d0ed5f987a03b8bf76b0377fe2980bfe9cac2a5b6dd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00995,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd3223ce7a69afde216dd1c957c6116cb76bc2d70895921c2ccd6b9d4f79038f0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00996,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x016c769b453ee0995a23b0b20bb83c3870ec7754867b8676da1c3e4849511160&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00997,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe19a4c9d8889c46240475ea0e669e967b4ca09dd35085c327dcf75e127093d3b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00998,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x36c9ff39ced94ac5d4ce3c5d8ce14030ca154bcc2e99abdcbd71344e8b0fdfce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00999,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x83c72fa27934098dbf8aea00c2491a9dba82ed6ae6f116f12ef96404f63ea6f2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01000,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xddcc603638d6f6aca751013a22d42f0b3dc9e55794978e37f46c38b622fe0ce5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01001,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2d0fc419efdaf8f46067013cf528064da86116db18b5382289afb4b6e1cf2b9c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01002,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf69f7b396a816ec0b8a377e3e75ee054c47339cce83f24de1453561c04f24789&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01003,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1763271040eea5424900aea6164448f842f699eb662f8409d95e5a5635cf20c2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01004,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfbfc02162b85f7c870dba66af17bdcbad0f5e6dbb8c7b0f2ef936a0858595077&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01005,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x584687a4b29aad825e7a6f106afe5f27a97ae104d3cdd7389fad0f44ad5cb101&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01006,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdf8970e84c6c9134c98a890c83c4649fbae258db7cc5d3b1fc3c63cd6ab64708&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01007,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2fbbff929c09f13110369d940831fde47cd6eef07d5449d4b3f9d353ca155dce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01008,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x235c9a91c69ce2ce21267dfa82b595caacd3f9ee09d9ad725e5913c317a05646&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01009,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfa09b4f1cabfd5bf65704b38982b06a536e316ef4b533db69a73ce2bf88a571b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01010,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3cacc95c0a0f16f81baca64b7331b81bb577b2ce6d451b9b3773f1770fb1a948&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01011,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdbcb3c6423aa05a61c71ddbf3181af582e525b5a72a9ebb8e44913bb981acfb0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01012,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6ac002dda4b8f105f2bfcfe0be9f0dd8cd543abaf99e36340397026f68fb1210&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01013,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdd1763be363eae6e854d82cf948ce79aa3903b24fb1bebf83efa5bb9ad8454c1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01014,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc4e0e059fb5489787f907324c81a46a400a87b3cc056601f8a9eb5fc88b1d32a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01015,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd2d13e5ed7819f3841af3e911c3516211bac48169a52d6c0f0525b94af603d61&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01016,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa93277ff5640373ca1446607c231f0bed5bd15a096142e7376580f3fc78841c8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01017,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x019e6db033ebcb56d9d51ba309d4f010fe79a0df9f6f3114b052390e273ec750&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01018,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x763ea921a273d3b92099e451f36949767992111073117536583f5fab34dff71d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01019,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x45d2795144aa708f2aa6d5016635c887f97c9e609dd7eaa30fbdbe04ee2acfb9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01020,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x37e8f37e7fe680451499d4cda814162837dd4e60b9dbcc1cb4a09d8aad95cb5d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01021,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6654a92dac9365e122dfbf52b5d2134dadf1d638aafa879893e50ee2da2152ad&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01022,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb81a65c13cc3d54b281e9ad392e8792910ad09b39b8dcaf6ae8e3fbce06117a3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01023,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb72e8700d81b2d7c322dc74a3f37dfce6f3b08a487a92242fd0ec2b8bebe21fb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01024,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x75f6d852198927b79d8ad8bd5505983052e9ac80b80d5dacebd4687d60d549e8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01025,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcd13479c8725155feebfed83954d53ffcb6725683f43c866acffbc6e9b97ccfe&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01026,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1ff6a9b9fc585560ae6780a7c54170e8f501324a894f00f08828697d661ef0e2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01027,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6c76c020b3f3f95b9c50a8d6d7949cc9c9798522070f5e35e61c6521473e15e6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01028,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x78f9905648fbb6eaaff40a458301f05a7bb753a6288eafc141c797ca01db044d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01029,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3dcb5e2a8b6791f5141c8ff08ac59a36030c9436e6ec6de8274be01fb81112c0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01030,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x373e75f1325d787a5f7e66c6b888083a7b1b2e6250d2764bbe1b4f1145dd9b72&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01031,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf06e62b5bde482371af35d2b3eb05bc4e9f80da90c64f9a36c8405bd0779f123&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01032,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3f19793eebeb6aabbbaa055ef131d73f1186be249bd8bbe2b11af0dbd783cf7f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01033,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa9765c1c7bb916043bb42b1572cd96f905c3e2f5fdae49010a5102a9eb4a700c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01034,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1dcfe01766b650af58d6becf6de168e7da980e7058c7b6424da1b0c470a7ebca&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01035,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x946b550f1e19e68d272a10be6c0a1f9310da704cdbdf518c8a90b694748a8c29&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01036,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb953b4b78c6b2446d60625b65ebdb25165d4c9a46916ee303b5daa16029257c6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01037,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8356dd445dc79c97a83819c8538aab5176664d436bfac3e9971b1c9cea78022f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01038,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3cefbeb9ce2ed071c7abb2b55fa1f8ced72cf1f2f9bcc24955a17aaf1eb99c29&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01039,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4765ee428148e60b0038ce5034cbaa7259b0d85403d37936cff1f1f220c09419&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01040,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc559659c692f7eefd643fcfdebf8697a04634c839b6e1724382b3bcdfcb15170&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01041,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1b1f9767d845eef02506d6a6c54fffcce5bd6bc59b41b00f17ef06e4c63edede&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01042,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xed5a8fb5f2b0ab802832bb99d32a9ba463945ffbfce2f56f26e9c39fda1c3fe8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01043,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa396fcbd5b63936ec43b6bacaf2b0236783c638eacc72614daa29e792ffe1ac2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01044,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x33bd34bdc9b4c51f344e476fb8c97fe80cfded7c90de437f100505b17823c66a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01045,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe62bdcaa8531750ae8fc247c76445a76670077643060efc80323e864c2c2c480&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01046,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x37db60cdd4270773f870c9cb8eb3368d0e1443789dc44cd653b0f423addab3c9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01047,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd02ff344a0e66526266e7ac1ef9269ee132e793c2a3eb2c20c95212665880232&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01048,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x27c44206ef714c1ebdfa21cd959c074063432f3fdcd7a3b0b2ec4375e12ba53e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01049,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd74dcd433ceba7a2a6702e807c68470b446772565b466b0878d4518983640500&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01050,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x583482c4b0a752dd12430176b663ff8ea5fd11f2eeebd8b956702d0eb473a748&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01051,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb1375fb5970e469451f9e7b9a29f3b20ec0c583ec90b79fbbf38f9e981d9a9ea&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01052,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfc68a5dbc89395b13fec398a9ad78b00d813fbbb259f005e6fba1eb1bdc7f2cb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01053,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x038d0dc543117df0c46ca6cf4467721780eb951017373d51aa88ece1a380f56c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01054,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfc630d10c00e0f843cadfac7d24f8ad02f7603bc7555efb4fe7e6a33d42d8fca&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01055,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdc564afcfef0c40d16d7fbfd90afc419bbc37fc750f790130acaffc32f985dad&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01056,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x75fba5d5c98ffc1f67f8a1ea520808f94a547003fa4fafa34ba7f9b2dfab7383&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01057,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf2a347f31fba049b5994122c3d6de4d37196ce8fed6c7c7b5c2c6926c28811c1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01058,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7e00f70a6b91f77cdd78c01ca54d506dcc25f226fbbd13d56b0c80e8c80c2694&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01059,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7c557845f4abf757fef7dbbd11b44e44c92025733d16b57ebdec6ae10f381f38&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01060,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd6b988695e3c2a57b1d3038de5262349766cea46600f70b8cda2998ae395894c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01061,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7edcc464ec0b7bd04070e80a4795a4d59581d9d6d53756eef10ae5a38b40259b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01062,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x84fae3dfe3699b7ab0c58b47c604799d1fa7a0088138efd63cd4603e79cae112&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01063,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x97a50adfaebf0ad4f60329d82fc6fd897416be8c698e6a6d3b6e7da8934a2f97&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01064,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x25e68a390fda36ad8fee616a22d79cfc531127e6c8cbc11710e8f5743399d9bc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01065,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x88ea91bdc01e8bc0fdda51dd2abbf05a92a14c20052dcb563faef0bcaaf5d161&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01066,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x77a58ff5479dab194fa000221e98fa4e6dc77aec51aed889bcb852db57db3d03&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01067,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x95926dd93886d32de8692bda38da9e4ab10f9026ddc5b9ff69c30f55e0915ebd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01068,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9e4b22f0088519c08bfd6cefbe125caeefa43b83b451fffba1a87223dfbcc62f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01069,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5451d56c823a2e8d42ad39859e0758b8a4829a11daadd96ceb4ab2b29874c7b2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01070,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdd746cbf406b80fca7b25d95961640fb0ae5d411468001224c3770b2554b95ec&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01071,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe7162b854ae8194deb0bd3a34eb77be0bf539ce76c566ae2e05207968a908b95&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01072,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa0266c3199c30bb4c8ec4b5797d112795c89dbfac6478dd5d3b772a14158fd69&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01073,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfb390415ebb31243ff63e550cf27cad325550dfee0b421c1c1be75a845319585&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01074,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7d668fd503ab1327817d49218ba493e6174918a03b3120133126c453ca345e20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01075,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x38bef7ff6fd5999f6446ad8abfdf10a24045ae1b837b0ab70e1db500eaf4cead&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01076,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x55f5a07a76490536966de1a99fee90d723ebae9e8d0806d9ed6f1580b2174db7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01077,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x61a13d92beef22d97be7f3c1656cae6760fc08e36db7d381d5c96222fd50f864&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01078,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x227e71270b878bdc138b23386bb7b33cec9175875b461b04902f4af708c31580&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01079,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf1a39e59434a97dce0d30cae7bd6feb571827cceb3ba57af6af183e953c24b6a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01080,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1b7d09908d41e6463da4ef25bc4a7e2545528671a510352110cd382f5b300d8d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01081,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x679b43594ec30c0fde26f3a2e05561c7e110ebc15cce1ec5b6d7da2fc5a415c3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01082,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5e7dea252df625a366ac47bfcb1e8eb2df49d44d0be463f98ba95d256d6982d5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01083,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcdcb8e564e8695a687939ac1a0fd1a0cc5dbb352f9cd24427cde8360b2a9f200&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01084,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5f2ca307599872cfc55256ad29009b53f3303d024b5b782a4abb591c8cbe5a57&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01085,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x12230dff9cefa72d522ebb791d84eee3ec55b5c4a4600209cab7c376171fa159&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01086,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6eb5d461ec98068957cdab5b2028bbd8b1b2f7a221a8ea9c8011071da37d7b2d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01087,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x45541bfe08784bc6d1298d97e0308241efaf18a47bffe4894dcc26ef776b7b0d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01088,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x09f2f43ee828665d8d45859b5e36a8b9d31283550eccf4f73b1a87638e709803&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01089,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4519917d2bb898a1810ede8b13275e678198aa773f7eef2b2c05c129942cb259&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01090,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x506362e6d66ca9341da4fb5706d690f94711b6673ab9b7d7ac22dbd39e0af8db&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01091,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x408e7c249b773c396ee2a412fdd8ef7e43fcb5538e026aedfd34d7b9b721e60d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01092,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4f1216d3d70323582c6544bf9c07bc6bf3582ddd01a52550b257b1e078dc12fa&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01093,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf7943fdae6b71a9c1a6d7320a61ebb908c32b91e8c9679808b09da9f28774225&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01094,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa2458aba8fb9a34aa4b4a5ac20b23f843e8b12929bdbf793499c0187de963643&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01095,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc3174a59e85dd195642088336274f531f551c50dbadf407323d0d1d5ef961bff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01096,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5475a30e12c46b42b661a0932c94efe35bb76575dc0030255dae625933f32712&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01097,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd2ce1e42bbb308bb9e0abb971cf5b4d9ab1cca8fbd73d11b3cfc19dd0b3b235e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01098,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5fb12ec44e61e8a76d79d4646c09a67627cccf3576e52206f580364cc03080de&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01099,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1cd92052c419c186c329a14c7bab28a4496c23e243635d5a263a3ba34d0052c4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01100,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x22b095d488d0fbd0f10e209b322ca59ad319975d6d3c90a81d1fd9b6d0243dc6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01101,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x844b63b3997c0468086656f4733991f97ec42d5fb1b65c050113d515117bb756&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01102,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbcce4dd3d6cd5b08a76bb8890eef30ad7df184972df8a271648de5269fe1ed26&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01103,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc97117921c0dc002265d161013da1171084008fe5b51d046c695b5e626c9994b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01104,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5035027c4b5ec5e2df56117a2e012b79c9aafea7bc89a3015e9061e226893245&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01105,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9331be3bcf98379d8a0e2f65a70785c10fd620d3fad050315c2a1e2f6c8bd6a7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01106,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x901078cb9b1d4516ecbda207acb6e6e2891a134b0c80b647240fd8ad50016063&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01107,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf8edc0d4190782ba1a6bb98105a33cedd5d71c25b22e0138d5bc5d902f9f5a34&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01108,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x42362545904d6792bb88ae2a9f7d29b10623e58260d0ec47749781227123a2d9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01109,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbc521ceaa2bd28faf23c9f256b2b24c98bfdb90a020d25216026f95d065eb0f7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01110,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x199eeafe5585e55674bfa0a341988e470b65ef78061b3f20eade8d1e271ef3a6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01111,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd34462829eff8702ce5561c6b1b715e63c8a89b7f5eb274e8c5588cd15678ba1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01112,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1c93ba5b0b9c65421fb9cef8cd24cae654c4ba7d386a53b6036e4019eb517c55&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01113,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbeafcef83fc5e6769d82b3c304c0cbd5a1add1277e1ac300f0bc5c7e2822f2df&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01114,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x71ec790b6d9c1f8e40159317162256dcd6f52a700215fc61d329587c64b248d9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01115,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6f6094bffde8d3ae31ac86b2ffa489481cb8b4b440d4613edb06f5e40f0effc7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01116,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x053afb71d72d02a534cf646231ef23fbcb10a93ffbb85b43bf6364a1b6cc2015&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01117,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x98396ff4fbee74940a9a03c33032d84f7285608a0a3ee7c58e016ca8c42157cb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01118,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5747971200ae6086c2054eb6a3d0a5307b84a2c2e7ce4dd0b99fcf278b5b066a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01119,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1554c47385b828df19e22779047108210de2c8a34fd0346f77b9a80c630637a1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01120,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5db300fa117451b25a6f7a59a55e33947378c5216687ed6ba23f38a721cbc21e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01121,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb9aeb88a7f2c33e5ef7b0eb9e4001ce50b96bd4576f174ff5fbaf2aaa0ca3cff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01122,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa8849157cde19e3801e69291365f8fc095855ea313f1a6cf5b39d1f117ff166a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01123,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0b7bcf33f4e42502cf5f0c981f1103bbb8f9c98a0a4a02f3ac10baa8328906ea&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01124,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x224f4405f110ce6825bab6f6c209a4b5518894bf489795e92195a87013406ff6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01125,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0b6064b3c367b296c0a422c00bf4606867164d315c7ab16d89f1ad2957a4734c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01126,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc7344cf278e4f244a49689243aae7f3fe30e1ce07e5aba04ceac1cc40fa922cb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01127,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xad12ba3851456ed8b37c7f21c8825c885a767cff2bb776be648cb8356946cb0b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01128,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3a386e6dc1d155d89af575c544cd88581c7d178bac55cc44f63b2ee888223764&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01129,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc77dcea67936565fa9d9eb078ce575698500dd17988daf0a7a8f246ff5508833&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01130,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa25a8fc183706411fa20ed4f3b2a68d96e0b161fc09468f33beb434c48f58bba&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01131,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0225209e1b7c3463f869898432742732f32fd1e7c5f64e5ed74adaae2eace9e1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01132,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1ba9f77cea8694123218706715d4224221fdd5af2b022d015071d6443aa3a1aa&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01133,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8e1c1d63b865ae597bfb51c82899e0aa4107a88dcc6ab180ebb568c6de993700&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01134,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3197a1d6c72f1891609283366e120a1f4c61412f83835684f28901d35249a04a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01135,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd28f2c9f79253b151384e63f867a55278831d92575d63ea0a6b14f39f373161c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01136,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6cf8d26d850172c2e2bb9629792fa93afec55de913957c778fe0895734ae70d4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01137,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x62215680c0a6143f5f66137de7a13356a0d1837fa842aca997aa6d4eeb1bd7d7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01138,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x44e4142c95e4d04f4b598a4146c0fa04fde6db6afd78ddcc8be9fd16018ce72b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01139,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1a70666e7cc7d475d738b07cb5e2984097e0e30df160b1d9b0698f33a9048c83&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01140,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9bef85d30bd7319c6ac73e9195d2fb5a87900b61f09eff71ff9aaf6dd39d6c8e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01141,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x48066cf2b5c1a5a553ecd2ca62a466bd7e462a9836e3108fa9b9c50084109d71&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01142,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x112745d12d9f1ffe670ec1b1b1526ce0b586f0348788742af013d8b5ae8f1e50&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01143,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc07f562554568dd0a8d7d83f4151cfa979abf944c364f627daacfe42d6c8e75f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01144,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xff3489f3959c367261b35a4a8cd106e9b8e504da8f95c752126874757a68d8a6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01145,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xaa9a507ed68dfe695d15723f7f31e32977b1aa74bb8a948c2edc27a55c6b377b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01146,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xae05fa5d0e96ad9e6fdda36bcc44637b1a4b9822c275dd6b0fbb7471715fbc57&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01147,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0dca795f11fbe372384ddae72721019ac51bb29767f1de14c808ca5278015b6b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01148,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb970027bb776fd436f03d55bfc77b43836eebe0391f2f2673a794e5d9648ab7c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01149,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb2f6f5174d78083b50511b907c2e86378294179e05d89fbd98baf0996055f8ba&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01150,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xae9dea31e94ecadfec8694ff8db30c1527a1b4deaabc042794cbf0f7ba068fc2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01151,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1cb2b8d45a6d2a7a1b43aacd57d78702ff161f96b9141d8489ada32fe1c8a705&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01152,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x28b41e3872cd3343b0901208ef472e26d98ee3facb64d2787e6f1196cda87d09&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01153,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9cc1f6f0ae4b10e85063dbcd30cc2077a2eff89daadb9ee3391e9c460e39d1cc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01154,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1d470ae11e0f409328f29e315a1881c3eae67123d48019c748a01f4e4f381aee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01155,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb516307f14425bd9ee0434ccedb692092eff147562ee7805e0c6e0df0a475d7b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01156,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8c4c11190ca958c76cad26d8514fb383ee51183c49eb56ab2aa41704249b6ddb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01157,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd7bb8fbd3048f3b139a3c64191ecf38bf1a218dd9544903b8ef3d0e546cd8af1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01158,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x12ec0becbbf83afd68392f4d9b67d5a8da89979557cce60530735a1465c0fc6c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01159,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4fafaf52d0c069b6f587ee7a519e715604f4de04fca1a19e726671ac56596b38&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01160,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd0e1b363591af53d56c1c6a146bb78ecdfec21f12b34759aa832501c89c26a40&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01161,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcaff530399938686e3364b6b228b3ac59e3b22f21b1c2b3450118170fb281836&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01162,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x070dea605d09f3096df0b0f76948df8a38831c90c4581ffcf6fed7bde0cc268a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01163,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd285b66ebcd5852a1911fe5599702a89a0dadda1405cf84dcf6d55bcfe0f9578&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01164,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2eb4c50feff7659cdd8f3ef48b6f9175a2a4b891d09af13bd0b414bff9b0bcfc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01165,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xff4e71c2c49d497341e7386bdca329ab892c94197d5fbbd18166cd48843de333&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01166,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4116850a1bd36ed591c1e95e3cb1aace3675a61d1c86e1660da988d5faec71dd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01167,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5b6986455f3550b4faaa88fdccbffaf90f897971254d9b8f3ddec649b5260b5d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01168,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa23912b4a361e10bdd6093479763b042c8d09f8fc8a5909170b57b6aebd98339&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01169,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0737b4e5ab8f9071f44e61b66da61df228dc0414f3ba5dde12b7a8fb10b2e618&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01170,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdf35982e9c74b401291f2ae70a09ea99766219008b0e01880cf6302e9d62b60c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01171,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcc7466dda5723a0c33c326d1596717848dfd0256867df4d68deaa8adc3f61db9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01172,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9abdb4aeec79e7dfe79fdb6711da93c071c9099542344da75fe1d968009f98e1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01173,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcdbdfbc64a23515c0dcf517dfd71825cbe5d9fc98566f9c6b02f733e8a1ba3ef&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01174,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd79c75b859479066f9caa316c37f67fb7728dfc01a0d94f6a27ef126ac0692cf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01175,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0d2dbfd717f62ea857069cde24b45df8fd214ef044057175265d747411304051&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01176,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x94adbb4c520dffca694df807f479af7b035da83f3de81f014e28ea2d34e70adc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01177,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd5e0dc5aa1b4441e615373ed2c8782ce41b20b2a7816e81ee4311c243d3b7be0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01178,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5c34962d525fd40d9c8bc44f522af67fd89111d332eb9ba5cc9b0f138a4059e6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01179,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1de75523ed57212207b3227983ba8bbed7607c3574300abdf11cd1a372136e40&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01180,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xaac82868aa7edb8173d1d41c6b0745b7eee734182d4fdfd54e6043350afc116d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01181,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5899663553cb5e7842e72b43a64d86113a4b76aaec2b0774021361171aeaee29&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01182,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x74b8aa4405d31335e0f8eb310028c7d05972831702b931b5f28d5afb3d52d854&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01183,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x38d8567174aadf1166952a632dcc85d4a4b8c20c946f2399878183141a10b561&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01184,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2a82d902f0d2aedb663fe6998f7abaf0cd666aa3d6bea64e81d8d83c92b0351b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01185,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x528d123a4c8b57d0b25864c5b3f673c21fbee2a1826dab6cd6ae9ee0024e85f5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01186,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdcefe6dde10acc340d071c61813392ec065800ade9040e5b721fb20fb8239a7e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01187,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x25b5519cbb7efa28ff1b23d0f46e38f7b3b2c3fd96d493c5285991894e371f40&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01188,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa8eec3288b23734dd343db2bf518380753dd2f602d80584c1a8247f2e2e3466f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01189,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0912534018135146db16c094d6a7a067062a455ba846f44be4d79e2c47094417&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01190,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x13085b0bb2b86b44d0fd7ea1476bee11b641b11dba8005afbf167cd3526855eb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01191,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe8d4138f22d8fb0fcb988bbded449ceb966203228554022e6e0564b9ed6ea1e4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01192,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7a4ee2172c8081d3f6dddf4bb6c561c8ce3f1af703ac6b591e448c762b8f1d9b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01193,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7c6dae3a659f3b4fad0b797c457a546ef174569dd60a71b6a4fc1e66d1e1f268&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01194,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7d063ead7a3d4d51dc59256b72738faf2171d7844da6d5be42af7023f690d979&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01195,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x68a0b792e3b448d4c36f26611d9b7652585f23f216785bb73d5c27c0c0aed493&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01196,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x94c969763e706d0e7fba95c4c357b0e855c68be2dbed2e9a7cf7b5daaac5a08b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01197,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa6c39440cf6d60b35b0ebc651ab80a101b0f57d9163379474ccbeac8827d5fd2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01198,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf7a5ab53c462dba797a3b06ab177ba42b11a370240ce077b03fc1fa2b107f4ea&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01199,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x84b9e12ab6e9c0e7f41dcd01aae0ae2357ed252b3ebd78c0b2d95fff5e032724&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01200,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa6b6a963488c4633e7f3af99047954e1c15fab24793fe43a4c9ec2c933031f01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01201,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4a0c7f03de3cfd31752d5100b70f028c31856efa2fd1a3b5a8cec4a342500d34&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01202,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5486c645e895bc1bdc91291f74d5ce702e1c2c4d37f005c6c1968c96c4798a0c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01203,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x08a5313b986a0428d49ab7b7f6cda4ede434efa3f6a69c5140ee7c46c977c30f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01204,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x975103710d4d4cc0c9b337decbad38e6dd42449ad533b3c464801bf10a0f7f8d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01205,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7bbd5580e1faf3394083ed3a12ecc3efeec75b71b52f3c5d2527306d47d46c9c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01206,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x61e11a8ca3db52b16ec4c025165e73542fea9eaed696dc528b1fc7d08bab6871&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01207,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3745949046134c86ab95f8da5fac1e0b96e9146b8dfe976b95ea8adfdeb10fb0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01208,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4d0cc348ca8825a306f854475c04b618a82336c06150b936407f793bb132e1d9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01209,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2008dcc12d9eee29e24645e17c3a32c8b0fa82423b230b1bca74982ff32499ca&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01210,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x842d419500195cf77644f8d7f656e9e0c7044c7c0227eef116f0b54bd52b8456&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01211,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa9c1369756e021602515ee071013086b92c4050c767db4f6952a5e875dc74415&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01212,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa6435d49ee936444ea5411227769e4e92c9bdc5e353fb90feda369d0b357ca32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01213,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x71e5659c8984140dac3efdb27964e2e36dabdf863d34d9a44509ab28ff76d3bf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01214,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1791e683cadd2556b588f262ed01f10dec8a17d0fac17264cde17dc821d61444&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01215,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb250520d667d2585a11f8515bbc942dde5271dee48bb2079e94fdefb4cd12db7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01216,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa13eb7c2b5320556bec64b033af8d17d73880423b1aeefd6befe0a80516cfff9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01217,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5c83a392daf6735cbd58715ddad8b5ee5ffab29f0d90e9529cca55f1e5a9bf65&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01218,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc13220ead135c3a3c44eb1f623db0231af2a830eba39328d3b0eeddba6590b32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01219,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5f56b030ea9674db988e0e19b92ca4f4d0172eddb66b88d1421b761f43f430fb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01220,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x512900cbb649da6361f264485c211c79688543284d48129d978f50ee9110ed54&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01221,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x90c06f460cbaed5f47e45d4761dc4860400fcefcf38a4adc8dac265798ea82d6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01222,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x096acd8679ab399726890ee06192292f292205150e75a75d8dbc24fb5b5c4e95&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01223,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1a1baa666116d37631224699f89e17da92ae1d5df34857e3429b0eca71f473c2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01224,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x34f529a2f72e1e83cd12adeb4dea7f2bdf3d7c96ff50249b27a0c6a65cadca90&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01225,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xad7198e0def6e143734a5dc947221958a8e506274daa782383fbe833e664d60c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01226,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2d858029db92532563a3dd2e05e63de9600abd032bc3402b598df65b03b96f45&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01227,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbb9ed6f343eb8d8aac3a7190c4327752c136b8d2d7a9cc4cd58ce619f2541c50&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01228,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x024d8b0934652fece1c1009e992ffcd5a39c0bfaf4b9e464b492368fcae0b44e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01229,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4fbd23d89d82ef4034f1bdd888e2b20cd2338e5430326039cc82a8ee32242e3f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01230,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb70e3603aa922716ba38abca5dc445639eff218cbc2ace3e2352be344588676c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01231,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x76e468cbc19d282a6075b218eafd19f63234beae51e46b0c2b81bb0b707b0632&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01232,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7cd7b651d63b2e5a4f6684ae77ab9d3d913449a92eef5a716ecc947ba553b724&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01233,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd077ca788a7927c7d2f8ca57710139fccb6e387c563fdc34aa9c8ca05ae0bf35&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01234,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xccf5a0f7216ad6bb2ddc6f59917c9d33ef237a7813b09052ce349a26bb21fb10&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01235,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd7666847f3b02e9a581f7bbd41e906b894136b4f98503c2e2458718f08d319b3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01236,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3d10b1757feee8ce9ee56ab7d3e36b34895674fa7c6c90b2636e85f0a9e16368&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01237,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcfc709d64aefa7fcd84780a576f8d229f3f093993a38b6271826efaba6b55b46&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01238,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf6f1e083e51e96a0b399e5878186085e9ca7d12512822558c2ed1e156a72404b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01239,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcbeef9b07ca5099aa5f6bf79fb7d58a0e8418af292e992b4c1f1d9bf43f12aec&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01240,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x02688fe8520ef9c0a4bc424936bc9b710a973517598bf394274c2a44cc848289&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01241,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x20ebd6528acd0d0e507af27f82db0aef20556c9dd36f482dd78e12a39cf5855f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01242,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xceb89cc1fff1a05d00b8cb8049f5ba68b4e0fc338a5b7593e1bbbbbf4fe7c3b1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01243,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6ca6a14a6edb58aa90fc386305b46048d24dd9b525e204b503970cad8c8864e3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01244,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x40769f6cedf1218dd656126546473cdb24657724170f0bd71c0ccdac1edb3e97&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01245,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf2f56ea6ddf8226f222ae389816836c60e8fe9bc55e630c93e8d6634a2babbe2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01246,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc0e897c05df5e53027934987158c81a2dab1a62638db704cbacc8a2eb0c3931f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01247,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x58d2fe58f1fc86b6ed0e2f210e13723c8ed644dc8d32ffa4e55cc176b7bcbc3a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01248,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe2cdcc7c61fe867dcef5ed3854538fecccc3ee1501b6e66f3132596c79c41a93&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01249,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x379da93b0902e34eca8296446820ad2e24d3e4feebf1f0faa061e099bcca3366&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01250,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xafede008f90c6812f90e9cb5a5462e3dad70fe5f0d0fb383f833845659bf25e4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01251,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xeeede50f94cb63b7e19cfddbcc3f25e3c06dc4c3a83b001804ca440540d37d43&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01252,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc5b81847b51e4e59f89d6cf2361c42f64dc760fce9f0bbd332653de1f7474ef7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01253,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x96748f6773bb94d740ab82734c26ffc9daeb4c87606403add65897512864e693&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01254,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5c3badc9304a265385eba2afff786a1f9464737b71d9301035b758820354da66&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01255,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2599ae05afdf5e1b2be57990d21f985c0133406a8141639dbf33d46e632bf6e7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01256,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2b44aee4e83d46ed4a02abb9ca11c1630073fc6b233c5aac3730f8d28e695859&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01257,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4952c5127010c24a46460214617a2cd34a5430ec398ba635392762668b21a64f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01258,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x713aba14cadeaaf4ac33853d6a33ae19c0ec40e02821d467577b61e371a53ce1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01259,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1ae7b5ef37e8a2151263bd517645f1336e0907ef1c840b41e8732369ef1d3cff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01260,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6f90c321b6915a06965c7804e6e28aed175cd6d62162eff3fea564fda50fced4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01261,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x61d416a84d212bea9580d2eba99ca6cdb0a45ea809d540b49ae52e6a2d9c5f84&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01262,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xaee21385dd0720113fea63062d20dc69e979bfcb5f295131694752dbfff3dc97&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01263,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9fa06b72e89a042853139708961c7114d3197bd3c98c1cef71ca0b34c01652bc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01264,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x53a8cc3b6aac658c3b80f92e99521056c4035fc053b6abbd4068e5339dca35dc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01265,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1366aabf8693566d39e974a595eb7e681f57170fa8d98c68e1f7a4397a6f4cf7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01266,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2631621efb6f486a6c82b58c7cba7c37dda933bee528d982b1c25570a45df03e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01267,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3dd94158da7fecd20d03095ac40774de44befb72fcedb2f94ca801619b5aaef6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01268,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xed99cb91c4babc2b4eefa48bfc1ab03f710aa2bd4c6e12c60e0bfe78e6a774e4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01269,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3e65584f39c73ae662991d6d27dcfe9563830c5210ea07a12bae36dfeec36436&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01270,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x69ccf142f770f0bc36ec796d3893b895d9b602100a30528dafa20e5a2c28da1d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01271,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x66fbd4f182ada36bac2d86fbdb791807f55f3c2c010c79d8fab7abaa404fb002&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01272,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7f448c5eace75539049635435d61193beca590922f7255ef040ebe6da1f29306&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01273,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3db6b5ee4daeb3747abef5998ae0ec1def30f96ff98043bc40dfce86966fde81&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01274,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x63adf378c2182a75a6bbec3cba265ead7a1d31cfc37324a5cfbd44e70d3e2392&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01275,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0c89bb3e1a35dd2748bec8ed667b9345d50726cff25f170637c86382abd82135&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01276,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x399bff6479203b0d07b9409e2adbe174c602acc5f4c2368b4fb399dae9227b5f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01277,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1b14df373ee827661a2c07e3796b21ae8879dbb62ee89588bb43e2843c70b624&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01278,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7bb5b29535784cb002cef2e3e34d518d7baa14aa2242dd3cdfd9e6e2801faadb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01279,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4ba003f31b565407c69e13af897dd4acc225a71ca04599415f68ee839e34d799&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01280,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2ab6865f17d91c52d0fe177d6b465575f83380ecd7d8c7f9bf31b2377ca0a1f2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01281,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa55982471099400711214ced393e9909d0e04c35e862b6319ada8e63fe9c5457&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01282,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8357bfd95a67b8e01b0530b10daa926d6368de1f37ebb787a24893a1813d61b3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01283,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb502eea2d534a1d9646b8cdf01a0021a2fac7b298ae298adfcb18a8adb51bf09&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01284,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf9cc24977a6a162a4f21fea4c588d8586d5cb96298a95364e3cb1b50f1878fd0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01285,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5ad4fdc89fbf4b2817a64648f37a14ec2908b58b24a621a12f941d7e3d4e6a66&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01286,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4de64a70d6df12d28fcaa8d4fed874f5aab3f070552189ce5e24582539c9f875&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01287,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1cd8e301efbf3554bee4a3699272b01033f3a1087a8ea789132a07e1d08bd20f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01288,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x461721aa1fba0486391f01c6b60ec368e021573fcef4c62a0d91204470a732b5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01289,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd776cb85c9b392f75696d6bb5733b4aac5f1e83a73719620efaf40a385468200&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01290,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x873eb969707feb65aa18bb94c3bd32f40fd891708a0977ede54d80ebab7e17a6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01291,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3466a3703a10207162520e73c9350cc646eec8158a0f5913345e0232ec37fd44&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01292,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf7c7ef3af85eb27ace55a2b8174ed8d5616f3d6d8457c51678f8c5ce5ff6df2b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01293,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xeab36fbdb3f08b469d02903085a59c455c1f8693e76b7005832a872fc19bfc3d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01294,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd38b96b71d18f88b5eee096a8affaeae086170fa9636dbd6d81b7f0bf03d34da&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01295,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9a8e547ac87505373cd0a850b2dbcf87fd17a958e86b91f431dfacf8faa1cf9c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01296,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x044263f35cee7bbd103e6537a34ef16fa8075121c6b2ac6cb9ccc932de47261d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01297,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2a6fa8404ebef74fb534dd65a52008d9c451c8e133a111118c38b238963d8c60&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01298,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x25e8cecf4a4009a8a3dfcb6e414a52939dd8f0fec0cdfa43fbb88f6d93e84d90&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01299,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4783a5b474945636c48b35187b5236790a932a6688eb9d57663cedbfcc35e96b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01300,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x05128f5669874610a201918ac659f325cadd39c596246a946c95c17899f4525c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01301,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf8ad3107c0c201f6c9c855fa7fe31ace8ea37cf483e4466de7ee0cd8d4a1961e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01302,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x564f335c0b20dae960b81c7fa6715da2a7a1f32186ee0d0fe6fc162f36a3630d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01303,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0dd93fff7d2ebb6031ca921ae529ff7f0fa881b0b64d0fde89b532250afcb3ff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01304,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x20eaa74f7d74b90dd75bf7750d80ce428e75745d60b92500549b4039163e674f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01305,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd00fc022fe14cd175a8a593bd0fc6cf8076872c16fc3672313415760c659de09&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01306,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1f67a41c83d8ba9d5206bd10389cc97b98c2b2b50d46c845728f67421c9a8b7d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01307,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2f77e7c868bfd36ad2e2b0864b665ab2ecd6671d8be22c1738d3c01376d0b34a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01308,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8eaf029a66086147ba2206ecdbea385029fa3ea27ae9d93be466ef702f9ef909&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01309,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0e9134c94db5ca1f3f8df20c06242afcbc7c099282c1b5662b7528344fd49f83&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01310,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x36d0712a3ad4551da02c8fbcf6ffb7fc9105d8b651095af88f9168884fec0ae8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01311,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb196f52df231958730a92a4cf0468e2648750cb5665142e160d881bc14e37bfe&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01312,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x052a3539fc9f8bc4d117b49c1e06b3c2f6ff129297b39d25174c8f0b8144001a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01313,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xed3d98e8ee4b3ac94e1bf4f158c783a8415ba5f497f9e33a32f1800d60cc524c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01314,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6711d975c455a06ffe37404f2c044b0212d05580535f0b696e01c40a38ed2e15&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01315,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc90257ccd4b09a7a0b1cfafa86eae19b648f0f9ff4d5f9d935b45179c45679d2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01316,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd23ae50b11a0b68e4233b0743b3ba73f087d2e8d9e73f74c100faec8838bf4b4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01317,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb2c5b1b5c44801e3d93702395326af0a9e333f6faa72ec9836bc0c6da90af82c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01318,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x803d224bcaa3b2d5d0ba2de2837b8b808215de356282c671fd92e94b4970bd37&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01319,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf7082c225833a231427c3a2809a4f77fd79ddf88a94991e251336feba0eeeb89&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01320,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x66c7f0046df871f8a674e08f13d66ace77969519f44ad0eedf44bee0a543036f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01321,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x04af06fa9d5d1b4d162b96a9e979d61028b349d2c474a34d16d0c62761252504&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01322,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x44c4c046785d0a1596bfa34133b74b47e16a4eea6607b7633d84e90ed816d4b4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01323,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x570d0caa96bbae3e4b2afc7f01b62f3d90fe232cb3797cfe54b52c3840bba0be&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01324,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd4cb7a0d9740bace6d20e145e01f654c3388393fbc655b41d8693de6bb960506&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01325,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb10b22ec3ae6d7252bd04d9bd6f2aeb5759cd1c33df99d43230b5dc2812fb5cf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01326,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xea52129a4b82c6183fc1713117ed5d1803135642c2544612dbdaa6fd06be1b25&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01327,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4f88b08507b8fb608565635faa36f8b09902017b2dfefd8091b05cc698e072a5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01328,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x83f1204e20b3770edb57289e7f64401d79365d0c0e02a84c9c2c33ffdc496693&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01329,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x572dcecfe36d6a5159f90810209186d900bd940b27e56a8d1150aa4760e5b99b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01330,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x45db98fb860512b9cbfce82e225581bc15103e772c385102f63aecc98b3053ce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01331,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x79ac113e80705dc36acef32fd3d844dcda82fde0962d92da38a07e585edfaf40&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01332,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2e02ff938a46434155167db8bc7aab30bb1380b9e3e7a61605bb4b98312305be&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01333,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1c8da535daab62298766c9eedb38110eeafe1d6c2fc0a6fe344486e50d23d57e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01334,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9983596d69c4ca9358001d6e1569a17f8c35a885ba9dc1629aca595c0475af7a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01335,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4143f16c56cdd171e39f8a54a3bb2d2dea69490672df9fa7e30378def8867730&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01336,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2c80acab236f71b43e253b5268c172dc3f413cf145e0216d7f6c13065422a2bc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01337,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x70afebf06271380039afba9d7b5157f905d89598d03042f4bf4cc827f1d7b200&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01338,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0d957f43c8483a069456ccdf1c44cfbb355796198e5b35eb365d66189c934b07&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01339,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa954d4bbfb037a0e8f081be2b609544df79fc5f84f346fe687c83055e86b785f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01340,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd259e3dbd24e5d08dbc1cf127159be9095f93cb2e035fc12cd4dd9df06ce4d91&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01341,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa393c46b554c380371d5f395f99c878959168fb83b010ee586dd627ea5ac81f3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01342,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfebdbdcdc98e1286f41f504e2457d4b9ad17d1747bfd60a3b16fba723620efda&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01343,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc205cffc694cd333edf5deb8023b04a96ae6563e1de4acb4d93f34ce095a50aa&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01344,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe55d1bc51b81c62134e654fd69d9c13dc329454cef1328f1579d034178625187&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01345,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x18129517d6e589a3e497f93dbad3e63b013dae40ec88ef3e1f3910b655442848&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01346,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x62600923c76a890ebe7b693e545c5f316a329cc622325ff9159159322ba772f7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01347,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb7bc048ba653fbc6fa6590215174988a56bd0615952242f026700ae0ed9e44d0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01348,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x63f08fbe35edc8666cd54f8b313029ccc744b622842266a11085320771a781f5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01349,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd8f90a763e74c5cbcc2f745cd41dfc34742eb9d91665d71b201e8f8d4cdde52a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01350,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3b7ca4efb889b761f25df46f30cb916074f5f80e5bfb4a500896747da243b54a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01351,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa5aeba3be9d1c93c5d8cf0ec419893fc0d2fd193cc9d60b52d2fd7abe6cf4820&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01352,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x75faba094a42b7e78000daf1ed774e8ed6ecf34bd142470238d1d16741003ae4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01353,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x53743d70a74f3b85815f71200d6c3c044df0ffc75fe8dc56a8f9a3ad106d880c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01354,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdcc29cd5c2804269d16f68f212fa4318cd10f686761ba1e012a2bea667d8ed2b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01355,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x73301488b070bb8268c358f07b89b07cb19d2ec612edbd30c10c7c83349f0439&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01356,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc5358154fa2c30230dcb62a3ae16f03ddd07e3fb9ecb53b0813ba432aeaa6743&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01357,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6ae35c6d816695c2e73892ddb5fa55282a108796ddfc1059a60d14ee87ed06ba&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01358,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x40401985fc52c0c38cc1951a0079728513e34711517fb89e8c8893f889f834a7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01359,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4f6b265815c3a8d1595aeb9e2039c9c73e06a69e746d06d3e4adbd09ade7ddfa&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01360,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd0b1559c6907e19eec7b32ccf02f63bfe932f3ec95d28de33250f0e2929b18dc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01361,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xef5b459d7ac7c2743f4c0fe6adee0d06a89971dcfb7d959f087b7b57f12c5d1e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01362,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x08dfe9e3cf1e444d51c5a61d42a03d90f974513c237d2f9684995f399ce35d56&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01363,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x80f7dfd0b5347cde3ebd66b78dcb3cf55cfcdbbc019c75e2f69bf9f97e393263&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01364,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4b47710e8532de589c562f34bfa75a8333a26937ba10f86d7327afcbf0514cfb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01365,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcc79e6c613537fdc17caef5f69d705741d3ea81e4bb6d277304d243aaae7f3c4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01366,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd76553f60e2e468719e30bd8cbfb967a00cf6841fc520c86d0aaf400db5defc5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01367,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd7efc68f4fdd73317255edf40a2be339ce739e5f0911f447511c763a494160b8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01368,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x17ea70afa701eca1af56e1a15f3d1604a3fa7f9f32e8a60b52d41708d15d8020&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01369,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf4a498dff013a59d243cfc41a176d2e7584d686d4ae44f6dfdde575d88529fe3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01370,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x027e2a2d5bbcb6fd1867eebf440e44ac1f7ded4acd265d97ab1db0e5a1169cfb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01371,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb90ef17e2d9981a11ef0cd0a735c7116d9a233a825903096e2cb07ea8597ef0b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01372,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb47194832a5dc01344496c495b28e1d202ee22841c8ffa1857d05ce0944424cb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01373,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb999269e83d06f6df620c6f5f94964f5a643fbb64dd2c4d7f58eed88798cbd6c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01374,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x662f1591b37f2982f426f3003ed9147f96014bb12963e49e63ad1b55e2cd78dc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01375,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x108ccbefa9906c080c5115f77f9ecd63381b9ffb0930227cb2630f4b08d8a090&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01376,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x54d2962953fce8d8a641bb8cd1c9eaafe89f9ac9546b8b277d9b535fb35a0097&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01377,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6d7bcae503db8d3f3771cf9e8038a1fdf3987beb6212755704560a0404118063&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01378,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfd477f0bf18d87a2bd3ae3c329e468a7bb16a363ec3fbf658f55ecb98fc16d17&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01379,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x57b72b9a11da9b25c2bb52b648db7870e039a64439fd271fa320bd2fe789775b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01380,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbeacd779ff788ab12f79382ea205b1b180c7e43302e902c32fa577c0925144ce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01381,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4b6c00275a131aa994d1e86e9246196299930ad5fc218d09d0b66265234e32c6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01382,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x485b0ed3728e693a618ca77659c55114a8f602ccd71fa6138e87e11b49814289&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01383,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x402cc664b8b4b8dcac9aeba636f3c902a713874d9fc6bd6c7dc338817c1eac76&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01384,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x547da0f4446ebbba63eba970ec761c7a08451eb11251c91cd6427cdf475bf00c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01385,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x058c55b0a6a077ed8882d135e4cb364b250d392eba6ad4e578fe910c8c9f340d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01386,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x951ddf6cc9c8cae358c63a8a8b5037a970cc5a3e9ad55fca7e4c85bf86c935a9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01387,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x85a7797dd4dae08cae7218cc8c2497b580ad037427bf7e351f20f1edfd695d57&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01388,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x64376e672282c2691f4dd0a88ccdb12d561cd88612d689f2802744490e275e10&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01389,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x58445b6bcd79648c107c45ccfa2c2246b0bffbfc0c9c8750b934894144105f87&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01390,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6a2d6ce478b520818b85e08d1beb56fb4d6d656aef8f26020cc9a1781a4cd96d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01391,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x330e88ac3fd46d3b66946b2bd2e342e0906769ba42be06f01ed224dc7ae90640&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01392,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3bf42cf0cd0e8199fffa9b453dea46a65409ec5430638e189e8f60132fbd19b0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01393,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x239fa3d0c11c26d29efac03c04735050e83c55686975a8753bbbc83349316a48&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01394,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x76707dbf2c1a10e6f1aaa37be9374185d3eaa2253594e5ff3482e436841e6b50&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01395,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4bcaea6c1d0723bab48d33acf6e6bcbb6016c405f710f19e8542290568510ec4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01396,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcc5b5c9a71d2e0b16153477cdb827aaf6feb3f0758218dccddebcf0e0f0bfb1b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01397,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xce3fa54e8a5338bf4a395b0d522e35d60b473c9f8507d6def5dd7da739aa5317&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01398,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd06c9a048e07da77ad07dfd45f48cdcab8eac2cd6ab44fe9db7778498d1200ac&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01399,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe131599e0fa8cb136a8425b02becb4d42888bde686d9d88b6248216a583dbc87&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01400,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1a628757bb1610b0c239ae56df58324c7cf5b5f3f18bbccea4dd67b1ff9be9a7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01401,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe7d4a88015acd605be12a616c899590059d306c69aff9a1876d47c276ea96231&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01402,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x85d3f3038ba81ba3c5c5a86cec0e55ecd3865f4bcb2e7bd9fb8390e06278ea2d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01403,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe1e41aa6c6d1cc5313c8f2a0ba5c50098c30f49b4a8ba5ea8d89e334be0ffd96&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01404,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xeba27a233d1a0b76360d1ec6793544482a197f01a47d29474b64982d043c9807&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01405,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb0ddf49dcc80359d5bbbd56b5a1e53a8fa78fbb3563c806f1a8a91b51cc8d082&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01406,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x651ac24a55b66ed30dc6b260af6a9b6aff2c1e0e8433534a353d2b9463d650ee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01407,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa76ac2e092a5e5db97ef6af6656dff4aa47fbf036bfb5ca2dea8fe0dea9635e1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01408,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x209624ba6ce8936b8a37223a76d35394b8a3e1c55f0e23dadd60da82e867fc81&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01409,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xaf729a25d80ddd3c0688e76207ff9ee0ef4960a696061fc1e32c39e69b40289a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01410,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa53b25ca9678e87be1fcef929c93d97ac456308f8405be0910fc8e917f264042&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01411,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x00cba9ae4ebb3a6e3876f16c22db9914e07a4a175b582fdeefbb60001dae465d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01412,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xda3d50bfc90ee547701ab1777f4cc626aae0183fe5d1f42df31048ea85c2a626&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01413,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfe77f727e1f01d1287955db0e75a11f8f1077ebe78a7c96ecaf808e22009fa9e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01414,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1053d23c71dc7e09a2250926009b353ea3f44a599953e347de0fd8347d677762&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01415,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1f9ee40833afefffc10bd0f240252f1fc70ebd6bd9fe7894816a369f78f40940&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01416,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x162769df545470c247d848320910bb169a9c95859e676d531bcae4ff4eaac292&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01417,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6904f50508e80bc3f8fd40550fb06c98df9da1f1fce47c95e81e47a030917002&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01418,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x668379548128b70fe1b31b174c6daa8a0915557d1769beb2bcfab9f95884baaa&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01419,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x55bb8c9a8b55e224e139cd6f93893700ac261f27a2eab8f2d493d734366d1749&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01420,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x37cb2c92be70871a49bcea2f3d90a6215a72609ef728c8e46922cbd6737c2c86&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01421,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x05b6cf1bb6f912a9a46dd729ba1ea392e517ad277bb69b758dc88ffb08313288&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01422,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcf2496163a204528e56831eb7cad31b71b85aee9c8d584270c9728154e6a0bd1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01423,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8500cec01a3af6600559bd3f68e2607eeacf62fc773fe4ea467c0592c9cf650f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01424,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf9b23ca9378f773d6ce3ab66eee7f70e84b52cb82be13876d2cb7073dfc765c6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01425,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2e9e77d2e086db1a3b04a73d17cc79247012b93c4aead1462d688857c983b16c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01426,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8c07100577d5a565f3962df52798a8e7c74eded7237c57b6287308e30693fc31&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01427,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x53b8caf6ce7524bd3161dabdee75a7948cb6813045b9422f0243b91d1a8046d5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01428,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x68be6c9f0b492c78b2598baf1e5a8d8c45a7738d41afd795fc57a6b9e5acf34c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01429,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x12a34f393f9f0f3e7630b128ba992bcb8bd211f817a4e14869d78cf465aebfcc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01430,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xff0a7be97f4019b220ec1afd81839cc10dc9c9d897a7131fc805393f82f998e8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01431,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x64d4fc5bc06327b48928cfcfa93581a8f840c950551365ab35029583fed9b421&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01432,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2205cdfc0fa6fd60df16cad0281d1321bb0727e0d9dda4e5695a415f8b0d25bc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01433,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe4ccf7437255286798c6e3c8181f1d4981ea17ba6560bd9e25a86a4a558ec60c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01434,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7720205861646892f7d4f654cbfb82e1efed9fa75fa779614a2d7f71a6a3546d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01435,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x467addf009150a231cbf58b439c8ee6859807d2cc444b5391288e84b73437e78&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01436,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8bd916a854e374573059266dd6eccc83a260c544a246cd8df022c12864d00a4a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01437,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x332b343d821178fd9f67670662e7d60926135fbc724ac83e15f76ac77fada151&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01438,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x595d9cbeefcaf6ef0d0ca2e5b5e221777f7fb99a07f07f398759960a16ffedc4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01439,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xaed3cc6afce54a6dd6c0b6a68532d860d99ad64abb3550594166f2a5d1086b58&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01440,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x41f0520f9167d87677b563d4652b1929a1cc45d49f59803bf30d288a1be2b06d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01441,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe2a38fbc4c762ce28ad95fcd0b38b461fc43cf005e1c0efaa1a95e8b08496fd1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01442,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xef37dd9b1d91abce595f8e07f4b8200ff75af7d59811d7c222ddd0dcd5657b8b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01443,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x145a661e91fd5f7e7004a06124642067355ac94d3812c17dd7e28ab63e2b3bef&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01444,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9821beb8f5dcea100a98816920637fc5644bb4aae4d43e14056546177db2d2ff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01445,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x728597bdf315ebb1b2ab95a2cc6bf7b4b4740e6e6cb73be78c0827c9791d614b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01446,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5ad80991f59ab3c3f5d9e4b0a64a0d1622a6f7201e6b4c9ab17425ef0e9c6328&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01447,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6b884caccbb53424351a0707fd38ec1780332432704f637261d061ce81669fb0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01448,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x869cb3c70c4fbab00ea39f9b8954bd0efc32ff9386d347d7731b482ea2fa1035&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01449,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5cac1bcb33f6344780d0ae7effa537b4597e788655c7f0ca76f6427ee6951593&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01450,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb92784114f94f68de5bc7ea7ff301e8123ad1ae21211d9fb843a809198f34732&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01451,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x32f5e0e5826dcafa56e2102e122b65f91f47edbe4fd164774c5db7b3163d749f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01452,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb43138d20c9f3a4ad12f1c6a14975528e934c45e0821fbbf924bd0e97c7ce091&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01453,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x34bcded8fb20b97fb638a8f0b0b88da53ee9e9ab8e31c2ffcecd7cd172532e20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01454,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x11f80fd32648f792ece5e55a241f473f2733f6b2801df8be9679896d18947871&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01455,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x18ea77d047b2a9fb5aabac87543ec56952c28aac11ecee3af95a4aa559bfed49&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01456,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf1aadb7cf016bd145d3abaaf1a285545e331a9878f8291692df22fa7ceb34ec6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01457,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd00e9e6ffbb61a46cb574900034b3ee2e8ab614b1182d29fb228603016385094&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01458,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7ffab11d609947e556ac0f0aa0e92c8d1b7daae7c691e159e31bc2de3090e2d0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01459,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6039b280fddd6ba4e398335bf0fabb83cd421c12d6a18f18b9f60249e3456e65&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01460,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8e889e14bc66328b31238cec0e5ca5de362bf8d995519de91c4c14a4f6dfd6db&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01461,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x773c0e114f7bb0a7cdca0a604b930a3c77b35d4033a7eebaa8d380121a2441f9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01462,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdf1babfea1ab0a8d9ae94988ffd97916576340ee9f76a697b4d783074a15cba8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01463,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6d328022fe6152777777c85775f267864398abdd880baa956659469fee4c22ec&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01464,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1c7eb43c12aa64d6dbebe5f9946254cb7d4960e919112034b25cd78ba4c7fbf4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01465,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x10ffef9e33b607326adbb5aabb35e832952a99fca4662af142510332b9033a16&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01466,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7785bbd4cc92a53101de632d4335e09d7e3a7f8b8a2e5263d884c2e02f3541df&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01467,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb09a9b8e7e62a4ec64bef12e9b6467b0f7276db516b270cfee9b8f30b59e9349&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01468,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1919baf88fb35ea864c6e86c74db4a93ba81d8c573d53716fe6cb56804bb4c8d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01469,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6338bf7f5a36a7559ab4b7abf0b3882c81aa369425bcf4718ac690d237d6e53d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01470,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x46fb7a9b26b5de93dfe8027aef0949cc8f81c523fcf3e578e6ac296acd396296&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01471,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x18fb7c8f934ec0bd79726a6dbcf9b1949eae47eb8e8a59fc60821d374e5cad5b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01472,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x47a32b9d02c3f8fe8780885803d922d76e5ba346335f99c8b46bff9d33530a57&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01473,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x333b7e8665b4aa205cc4136efce2add43fb3803b43a7f33e9386790b0846dab2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01474,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfe24e3c1483ac948bb8e3ec3ace550f72726f2025abaf97dbee5997a2d7798f0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01475,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x81c78370e6f8e1054f5492a086f354fdbbdee13fc5eb433d5b70f6bde808feea&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01476,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x857187a16d206dcf5ab6d0f375defe4689f638952e7be7e214a18ef95f612588&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01477,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xad00e0b4f49ca226ba794de114b83f21049c9678d956ecd0a9456509a4d33b65&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01478,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8994eaa1d20c7865333115069f8f9b5d500b0ac5b77759a7938c4a9817e8a864&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01479,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcf4abf0e245ee8096e0a34974636acedc772135d2f99a493e78e84171c30d4fe&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01480,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xae5f5367ea0f5fcae4b0cb50813b16611d4348211979e922c039849237dc7e0b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01481,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa121c10e9e5b9ebfd54ddf768c22b1f9a0d99b1d002f0c14133b9069271a577d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01482,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2110d171195a2de44d08df4b38a9ec39242e74e177a9a330137d2cfad24f0e6e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01483,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x56ec2844150d5baf181784999e0f12eedab61b6d106be33e2e5f4ae7cd9923c7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01484,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xba8ad4f1b96b86c81781dcd63aea4d8c817762f8950ad31b7b516ec86dbf9c56&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01485,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc56c3ef61383b31fe0426d4e7e6101b3ee93e36f8743513d6f2827f6dc7443e2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01486,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x57bc41042e73f44a9ffe5ad0ef0ed6a750b254d6174182d31210ec154bd5a6a2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01487,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x122d8e0fb38045e75447d5d4b098ded50d3519ab133f407f16ce80b7811f59f9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01488,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x42b25fd38e95b67a02cf2d2420f3baf74baf05cd3daa21c7d8422dd4ef082073&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01489,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb1acea4e751f8ab84a1701a3810b7425d7bd25b9a11191b8439d9ef021a0ae99&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01490,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x34280f11add3d4fbc26f35a2bc3163e20bd68b0b2c5f5c977b3c5515f7f89c78&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01491,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x503bfdfdf60af3f68c00940ce18790b5a4b27708860b9397c247b65ea306f9ac&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01492,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1b74997d1c74b3925d68bfb59f89532c82f8d40442462a20b8f8a247223217ee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01493,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xedfb26fba9e0f118447e4f1a2f427cbfe9b42bf74c74c8c347718c2bb25de638&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01494,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xda405d1305cbe42530cf2a03f23706e2c2f0d5c4a8e3fe402026ac7cb9e00c7f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01495,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3efe0cdadae9231c400665a65dee22fccf36020f991fbc5fc80a692a15e04100&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01496,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x809b00b05e0da5745ec980caa06cd88004cd61873bee830f9da8d9cee061c0ce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01497,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc6923521f989fdf033fef5f95561230bf2bc872c3be7088a3a0986f40417cbc2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01498,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2ef9dbc94aeec86917f3545afcf139cb1092ae35566cb03667d71fa7b4a413e6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01499,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x23a65ef9fa71a5631cb9be2f1108a6ae5a52fd9123102d43b167267c5c0b6d86&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01500,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x17e97c499981088f01ee7fd4110bc4e39552c70c535b2c01bfb825288c652cd1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01501,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x38815f395760557cb4ceaf43f9bd59d7f3ae3438d98e2e8e89a1a985d77def48&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01502,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc31ef6bf0361e3147b5cfa201a4296245cb801a4933e6e3c7c4040789fe39ebc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01503,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc5393ba2406bc0b84edc863f36c63116e6f3ce5b3af9063cda7516ed664feddf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01504,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb478f53b462aecc80018fc12f270409c9c21616d076a98f26dbb6bc76171fc03&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01505,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb8013f87cc39daaafdcd88f6338920b22c471bf7d7b589963a6ada06bfaea470&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01506,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf23ee99501bb670f523caf0761c956324dc590fed811bc4f6471b6c458805e5f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01507,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x21b534cf9c9af1ea839aad996558e17bf8698d1c0b6d1ccdb858fb19bf78fdc9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01508,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9fbff7e7dce3188b5c5503deaa65b47c43c304c52f3f1f4fa5e8221759c75330&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01509,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe5141a21f39698a7b78ffce400c185d65fc6145c08b97e5630b16fef5cfea317&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01510,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x87aec91b6b6a9b92dba7163b403a463f001693df580b79d1b630413de7c62540&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01511,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb041bb19cce32e94aba5ab72f8b325fe14088e933331cb81c090dd64628e3276&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01512,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe41b5ac2f66221e3e7486d2513c67051afc5530af04715e37c144c198240eb5e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01513,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x56a669268cf40b4111afe73a823da07e8a09f6304f8ab890b4645d2dfd7cbb24&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01514,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x898d4f37bcd23ab1762aec11fd937e9b9843e74b3aa9c0b4ed5645b03fcbaf98&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01515,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x935b5d7aeec407a6cd83f7d0dc160edc53cc8b7f5f2e019c05fe619226a5b67a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01516,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4ad5c3e371e953f644173a234e019d8e14993f21100068a439bc901b164b0713&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01517,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbe94d5d09346e617ac54ff3494a7923b43d7ea91d61fdfa4a1185af83e73fee0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01518,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x40fa62d3a1d198625a85eb1afaea58c9644194914293db1246869aa4b7fcf547&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01519,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x110e8af3acb590972a4f633434221317d3ac98b9fba73452c02e9a88e9de32f2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01520,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6e412e20bae396e80928f28ec0179a1be7765947bd7e4765fe3b20524f60f2ca&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01521,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8ffe28ad29fdd6e42ccae7faf81b1715fd4df21451ddeb305a3eead7a514a17c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01522,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe93cd0a078a29332cbd05e1570a988ad748db4a2b2f2dbc2c6bbab0bd3c8302b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01523,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x77f19add028523159fac380f499a2193f29ffde2ae2eb043719b798e272d2b3b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01524,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf583c72783c0c5b90ab3a01c84eaf9ef04620259b4c1ccf074c9e74a22c98460&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01525,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x326bed4654c8a2f1bf96d345ef7ac8eb3868861e561603b5dc50c8f623cf6333&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01526,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x558f5bae98e6ad2e383096f2c381c126bdccfaa0c90cbbffb7480426f5803396&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01527,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x17af0f4e322b322401ff5f1c360a93aa4c14babc71203e78a3f9df4cf56f8f02&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01528,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb3d28e9ba92278e4be3110b7813b95e05243fb026f3442e6961e686576399e5f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01529,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6ce3df5c684e6d291db88d672af9848f1c597d58ad4aeb154d7d812d69878e22&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01530,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x70b295e43e231b6edfb2ba45b14964ca609d06e596f65438c816a8919a141d38&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01531,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5694754d0ac3a99b57cfa34aa9a6f37d7749675127deb9dd45d920a767104724&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01532,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb7d62fb8035796a876d44ec6b484ecafb225782c12885d4cbd8768bfcc8648c5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01533,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1c4ea22b6b5b40c697b2048c59cec06701c032ef4fc245402d68ab614ef4749f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01534,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3f50bd7f0574c667cf8d6e4d96e8375e845f1bb58b5458a96fa4f13400978139&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01535,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x56e96bf3a208e13326e3ae64501a9f8aa2a2306551a22729f4cdc632a316dc37&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01536,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4c0b5a25c4a9f692cb2d1d97cc2ed3a9c6be0263543702df9cfa818e67792ad1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01537,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb84376f6b504ac6eee8eb390c9431dce6d21ba91bf66860488b267e140503df9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01538,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa859e797a3880fcd290e20193e80d4cd6aac09cbe285520972863a0496ba9e5e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01539,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb8f7332814753428b30912ab8eca0e635d4060a7ef66fecc91b9963f0d2a9b5b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01540,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5075b4c47e8e56e7f17022c6c00170a30cdd7cf257d893dd917b6ae8725ef044&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01541,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd9a68897ad38b7a6b7948e66b75312956c32f2d8e2b27fdf3df27bb1e523587c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01542,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4c44c323f56a00e42c55f8e08134019f4cfa635e945aab057be327146e41b193&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01543,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xba0d8406b4b7bdb1f2a3c8bf6cc79c49d1a1ecb99e9a289ac2febb3f062a31db&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01544,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb730d9fb4712957266c8134e8ad45e064e9dde91be74a4bdba289dd2c1cd3b7f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01545,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2a36dd0adc9b0a8ed517b92ef73ee18072f2ad87d992eac9b163ed13701c2d40&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01546,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcb6390d20de04adf9ca127b68f73fbbdde1ae451d3d5dd2e9deebed712c49122&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01547,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7be294479d6f126c3da2e73d6ae008ba912d377135e43eefcc6ca65e4e2d9770&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01548,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd42b2e596c43feb99b1a292cb65108e4d159699ce5399331ceedd101b37e8aa3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01549,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3259acc6ebca1ee7695b4748c89145bfb0962571f616b5e2da44ac571746369f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01550,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x15c4efe66e352107540d4c8ce5d800c117a599da83ad34388cd17510682942bf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01551,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2d99a1dc1815eff9f0d697fb3c79a078645b573ad228ebe569384ec8f747fc98&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01552,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xccd34c1ecb8f3444c21ad2f645b5909fe2c44e9f282706205f45c102d68bd3b8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01553,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0f3371da1271d47e61ed8a04772fd68751b8c7ef16c316b8f4b1491449354a47&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01554,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6acbe79cf6301c23a1202198de9abad6c1cf67718f48928176459a2e195839a3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01555,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x975db585f0f663c6e62d41199c823b48e1be2f596effa9c56222d3b7fdd48d40&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01556,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf8d968d981abe306802686c870f2d6071547604228bc7c8a9e26600cc13fc18f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01557,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5250d82f1f9476a10e99a6b6c8d4664c52d206286eb62e544c4d93b6c8141608&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01558,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8817dc1dc6343f42591204b1036b8e8b9ac90aa6be40647b3c13fc48256b865f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01559,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x16cbfdacbf89ab417c81734171a541d1ebf55b17e4d62474a9883f9aa3b9d992&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01560,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcbaf55ad5cf0f88bfa5be589394b6a7ae0907116fdee9b447b4110ad76356049&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01561,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa12fc593dbc327d7a61fa0e695f2e6bbd10b70ae3dd87d32802487380d67334e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01562,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x310c6496b06f98c1553f27b9ef878db3e6b540a4008fb4de7d65cbb7b431f324&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01563,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5345e3d4fb9fb5cfc1e3ab07b7963c5185b3758583fce54826b59c8f59fc2bb9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01564,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2280e4c1f8c9444f8a85a63a744b4d9cdaaaeec6c27a100b704c36ba1b27607a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01565,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x893942f1ae02af922386a011d94aea458b000e6ae58ac5105469f15ef5ccb00b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01566,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x237ef759964133b24b7d50fb860d3ef49f5b5473a5dfbb4deb12a9ee75e9d3c4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01567,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1aec3b6ed606a370df07ff07933d708e4b30892c5b34eb27a3c179089ff70c24&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01568,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfc92fcf640f5c001fe4c37de77755ff442f5753d9500aba5636cad6cef432cba&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01569,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xeacd9d2bc6090407814082b59e363afa47cb9148ffa584c065136e11c62413e9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01570,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa22bf28892d91ec239139c3c7bb07a32887d7d42f9a097ee919e8f1333abe8be&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01571,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1a439d0701e901619bf55f220dd81ad945b75883f0832eb9d1ffad360225825f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01572,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x947ddced110265caee947bc7d343bafd17bafff910a68db5bcc0f46f0aee6fc7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01573,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3a831bed82ec33cfb63e2489ca28d1dabcab3326a310e117ed3ff4d91893ad5e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01574,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9028d18bb6a6f17c7d25c2c76c6faf7a9df0913107ee429b1cfa9e865cf3118a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01575,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x598f030e236f72cf6eff6d43fb7f974f911b9fc603980b37f15614ec3cd779c5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01576,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf904329742dc4ffc14c96a9917c54d18a6fde0cb98c47d211e7f7ffb83956ae4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01577,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8a587dfcf7eaa992e28ff6c3504df916cd4e01fe66fd293129ae957fb4426425&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01578,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x43c1dcc3d038599b653d4863c7c9bb7cad97e7b7961695e8956e9bd42f2dc0b2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01579,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x92a983f23849ce276e11172312cf40a7aee0e9bd34c92f66f95a2b55ea9f3cba&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01580,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1c243107c6f0b4ef1b64cb91a8d1abe0dff736faf40a28e01448477799d7223b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01581,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1f943824eeb9f6e597dd06662f22d72c259fe15ca30f79f85108fce6f9465c80&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01582,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xde1cad895c807ccbc04c98614864decb0b4f438b79772508210e542de31a80d6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01583,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2d72b6e45e90548bead586dbbe36d30832196b923fc15981b7a75b4635835cad&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01584,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x393498cdb070387b507967acb20ca81ac651fc0112e6f8bf4275a998e87be113&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01585,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfa098e6dd3f968cc805e7e32e67beb12ee8d5791c9ad3f4c4f97d8090c5d7532&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01586,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x379cb7fe8047796010944629cbaa6009c131882ada4df80b344f674a209a02ee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01587,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x62641130ea31f0236a9a003332e891538e45fa7190e93f9af17f15fdaa0f73e5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01588,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x63224c34401bb9cfd504b6527d4005cbe3d274af04571902b23f4623b177a276&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01589,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa972b2e4d5472258ad38813f7ab77a0daac4a0796875b562a65a989c1cb57dfb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01590,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1370376c417b6f988efc6de15723eb81354087bb24b5be9affdd536f7eb5e878&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01591,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3c5940a5c4b1ced8cfba620ef392e3bcaea154dd3ec56371ebb50f7d3955488b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01592,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfdcf0f058fd21fd4db98eec51153f4bc489fb41e08c1a8dbf8f1d7f3ffe01a0e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01593,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7779354bd2845311c515a0f22e8f032d09e69f3d10a14a013152ae46000edfd5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01594,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfc12f95bb18ce0bce9db6efa93b555b6108fc6f3241d56a25a2c07d8e18d4e6d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01595,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2118c3d09fa86752bd92dd89053b9afb26337edcf84098361d149f3d9a8eb9d2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01596,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf94bdd17711158be2e5aba2f31d933bca8e1d608a0aaee8d611255e5822072bb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01597,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xaeb7c436d1407307f9daa397e49a35bb39d2b7612dcf4a40639643fdd06185cd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01598,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf56b793b792ea72e3e3f8c92ac085de3c0b6e2a04a11486599b92a86c6abd4f2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01599,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6cf982a28fdaf8ff3086f2ab622848b9a1cc92e347202b0c3b5bc8da8669ad9a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01600,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc6a9ee35cb2a1e7ace08025884a30c605db736d1b026cbca495b623cef531c78&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01601,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0497bfd92c28ce3e12442ae4bafb6b8bb950448933fbfa5faf307a908385990b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01602,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9a50fff5ebacea0ef3d7d163034333d6c0c133718fae765896cc19513d0e3ed1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01603,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa1d88a2633e02e2c4e08d94c97fd1b76d7003800f78dc3323f9bcc5af6d00bb2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01604,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x00e0c17d808088777af62a97fe1e63d0a1ea1433c5368c5e7427bde3e7677589&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01605,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8fec155e0c69236d83d2c7039e0e904d800eba28c739bad9bfc5b4c3e616b1a5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01606,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7642a7d34a91eb38072e60a0b44d304de3f84d42928c44891b8768a2255696de&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01607,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0a337fdbd42c275522b604f3cf7eebe86a7876ba0e93ad89fc725fa37bffa4b1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01608,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2b8f0227d5c0605529146c4b66cefdef9fded753b2f496b5d2232de3f0f0ff0d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01609,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xceafb20105e86dad0aea7a8cd971d4960c6e675d677a4ff5b467c57072e1c324&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01610,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x99fdde4b6905f88a904c45a0fae519384c35cbf770ac691cc2f972bc91c9e92a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01611,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0d642ed657bd7c7bad338118f728552422e9d918fc5a6d45b276be73ee489fb6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01612,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x01a109f9c1765421c41b740a0beeada7ec1527a116e075768051a865688abc4a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01613,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x409c216ecee281bfa9d2292d1483c07a83af57ede1d306c3ef1357e6207bbc38&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01614,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x608abfc5fdaed326966359b7494e26fad1a0897d36404404cdd1e9d760a2cc63&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01615,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x546296f9bdd48f7a10748c5685047652d24ee0f5d9d5d39d00c138b5b72963a3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01616,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x210f4a03fc1ad41169c1a2110e9881cb518e3a91920784a93790ec49b14ca899&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01617,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf300016daf617180a864891d6e395a1d693586922d87b42012be8d01f21a08c6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01618,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd126355b8481e0ce290bcd7d8e59ea88d84464af126c0711c4aace2295d81ec6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01619,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfccf39eec398431f05ecebc058d0f7451b0601e47c8a32403f430fee1fa91b4b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01620,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x62719ac2f5906f11574a39f6235b3d12052d2df36855880901e99ab7dc7671da&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01621,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd410e2d782f4489c884bfca0410d81ec6376b2558e2fdaa4329d57739155b4e2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01622,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3a2643d146858acc75041baf09f47c0f2d25d4f102c12fc7d3db22f670be350f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01623,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb86b68f188d4f0d56f35bd8df010b9154c282c78ea9604ef6e94084e9c851b8d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01624,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x79abcea66a1e7adfb03c8c047ccc1823881335a68f7221a13f057b9b812fa6eb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01625,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9d2445ad11ecdc91945bf0507eb97181e1a8d7373c3f68b0760959a45a32fd05&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01626,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa0719f0293eda9efab5b6cd4fbe9be45f707761d77e089ab27c965058eed2737&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01627,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3825eb62719002200fd1b8ece3f1fdcf80705657d68e418366eeae57b14acfbd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01628,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x49d1a71da4a7a27348aefd008cc5227b28544ee604eb242e1c2b037f67c3abdb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01629,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1ec93093a36a54010ad1302caf7c5c24188c3d668ccfe895972a57ff6587850d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01630,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd52d9f3e99b17ef53cb1045db3488f149feb348547eaaa57f54bf7aaf6d18957&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01631,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x438a5c23f506d979268a2884664886c208526d050df78870f68c331625ee95d0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01632,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb811a1ab572962105e233bc72569ef1ef980ffaec0c58c62c0e08744fdb23a7d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01633,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2dba253d07386a24dac2fc5c78c557e25f4e521c2c5c37ebf514b9bbabd9f4f2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01634,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc0975217f67c73ea0f22c7475233b64524f228a7da61e6c531cfd932cee27109&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01635,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x926f0429fd3f751c428e5501e7ffbb006ad7048930e1820455b6fe404b7d8a17&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01636,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x88bc22af6003d122e5ac2b7981aefe48cc5e787777a77364dc12530b35d33397&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01637,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd10229ae7c392518d3bcaa15f43ed0c2cca4f235cbe009e1aa711b109cded52c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01638,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf60a479f9ebd1a81e807ddaa404c8cc9b855eb08efa4481810529674214b8c84&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01639,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x45574d293ed9b0ade09f8b041efd0f9be629979743111520a7c0224e41c36213&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01640,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf4d925c6aaeb0d96944b66a46324fd09815af73338fe9c58c332f77869473fff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01641,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x055616453b16d6ff8caa12ea67e2543aa0fe47cb5c610699d5aded16ccdb72d2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01642,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbffe5d04ec76b2d00ec35af8ed488116f1d3d454b1476db9c68bc62590b91b62&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01643,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdb04ce690ea5b0472a5f3d630336a0977e19517bb6c8443876e76d49f5876c98&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01644,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x836dd3c2e51dd27fdfc1aca4839218e9a40390bb8966c257d470c5e13d610d09&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01645,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xccdd4d3758c1b860176290f80a588cf9f8f257ee6a094019968b645969039e52&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01646,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdf78d1aa527997f2f34dcc3df048e8273d4c2147867b13f009fff3fabe1227e6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01647,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbc1a2596d167f86f145df1c74a4ce5cdeb09e21c4f9077a7b7a75a026a9cd7e0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01648,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xba4445506249f1cd7510b1159ba679867a8a721810502db35b871131a52f6e9b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01649,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc772985ee13356a7519f619cba370e0d30b2b17faac8e8779b34e77f319c2f21&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01650,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0cd44f84d292e1d1a88b51fb885b084cb2e3e4e9ab284c6174e1277fdc808c12&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01651,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x108b81392c28178c4f4fb98ed3e03860ebad588e089fbf85a87ba9988e27c055&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01652,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x92dc53a4408de761c673c56bf0c52c88cd2cd65777b47f65ba27265dcf5a4b2e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01653,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xac1c8ccb958d598d2591f82adcbce06cd05c5bc8c7714195f2808a42602cbd55&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01654,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2f466ff62e6b2eb3193683dca7c0af52da1825c22cae69cfda8b187d2d719bfd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01655,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4dc5edd2150d175af8dd28927a1529a52080d0e0d2075d0c6f703ec2a527ef03&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01656,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x72d321b5204000c80fd39ccf2fe72a17cac0eea2195133632b987461a4939c1d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01657,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd0684723c2fcb39b6536736b92d24f7ca1bbb6b64c51c69ed69eae1ab22c83c7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01658,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x651f1c70b5bd5638c095aeaee6313f1d4d2e28471ce7ce98aed045cec480d016&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01659,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0013c08b64bf7e3afab80ad4f8ea9423f1a7d8b31a149fc3b832d7980719c60c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01660,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7825d5b222a31cadf8cc345ae34eff92e4d617659c3f630037821d5acf6a5cfa&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01661,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x84e21383079e4674dd0c63cb29cd89f0726ed8895aa83aa99febd249dc9620a4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01662,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa5681587c34c7e8d143b6332a98804a6940655b08c9764ee13f8362b929f15eb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01663,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc84283fad5c6405f6c9d51c0597b9908406ff09772233255fe61a1494e09cb2c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01664,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xab3af7a0e7c174b428f865f4fbe6d49aab50b91a0cb5555687f2769c6c874836&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01665,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd0adeec06347b843d108e4d349b50156dcaa131bc27c7752a1cc3c3035b230d2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01666,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x827de27e4fa09f2ddd98223a7393881100fd9c533b55416b3839ad8f3b6835ec&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01667,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x558e21250bc559d5e9cbf0b5c9787f4607cd769a3d96d4c174b769907b8032f2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01668,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8d75bc100e6afde488e081895914ea1c5658115a0e028b439e2cb2d52c02a29c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01669,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x84ccda7e5a2f253fee50e47559bdd8db96026897cec18ac128409ec405979de1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01670,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3490d679757169a0132ca44b3c408b53e9dbb23dfde34a6c8ad34ddd0f88ce78&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01671,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4533f7b3dc71406ffa10a0af1fbb9b2d5cf61f7ae1d7a58c57734680984ef875&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01672,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xabf106295d76c72cbcc2b778712a1b954319d1b4a1365e19cbbf9ed0c39d7445&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01673,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd67018bd3f840799601c348f8d2a55eb0d46ece00688a3ae5d7a699de71817a0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01674,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x16b9e8771fd65164ad5b4344b67bbc519da70ca263c562c0088a9c30dde29cb9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01675,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x35b0af7b1dfac60196dec285536cee1ff48d20579fe0df117be9566c78fd9404&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01676,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2753d9cd14ed65494895baf136feef1f4c0096ac569e856a0b858c43046dbaf5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01677,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe40b2ea438c3da468e62d736f576e9c6bf89e7b2079569b11b7b63ab6b859e53&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01678,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfcbdf0e3790abaa1ed31b64333b348ecdc15a15a213488f46d753ea77659d1b9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01679,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe5f342e28cd6a85862e29a8bc6ededb8ce9e5252f02db387ca6b27f234a1c8c4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01680,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xaf511202a03e86af88d1a53657068bad1682ed4d3c3d446e4e553313c4183f91&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01681,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd0e6d3d3842257da332754ff2e0ee2f28b630041e206da98093d60fd29cb2494&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01682,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x66ddcfa8295f3681fe0dc6fa254f4a86cd25127f247cde63ea7b310f8934f163&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01683,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8887a5b6add7aad0916907bf209931a98364a7c2a74162ccbea586d2c95fc4fb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01684,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbb0ab38ced9c5de37409997ef703c79d0d0273d0599436d79c86fb19710f0580&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01685,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x64bf045d836bd1a99dd127859286752a1c09c20fb5b8a70d2c238c86d6565640&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01686,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7a8fba5b00f60ce646da4ffa64981c334b927fbbbfa037890aab81f2ae5c65fc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01687,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x26481dad4204488c03b357ab61f70c3e214800bd461be5b14a758caacbac5a94&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01688,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x05f0a17478f22868e8c1442a512807f1ba0f0ba7d2452c2ada4b0626b23b6019&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01689,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xac53e2ecad8e9ff6a20cd863627056469d0fe53c1e5ec3b590dffc853f36576e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01690,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9dbcd976d813101a23ea057a561d714c26264f42fec6b5f3dd2f06708423867a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01691,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbb315f50f96b903776ae3f1e1cac5b683d34104953c62bae500aa4b2a29d8a4e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01692,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb877548bc73b777200804316b2cf7081152f0fa8923908b8ce8715126fbb3963&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01693,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3d2c2aad64a353e2400dd1141f9bd7bab23dfa8aec7c2e5c42a1c52c58fd7cd5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01694,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd42cdf89f6ddbc2f8a8bcd4f6786cf73b985399c41328fd76c08821dcb2cb39a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01695,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8d97b21795f44f7c853891c4f8007e2b9eeb7999c16ff0d81e744742f758dc7c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01696,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x49e0b594a63361d8cb35b386558238731b5b206702a2b68050290948b97a2b90&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01697,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x01b23d087a4adf659d9a5f4c65eaf4a3164b46a7398dc516a52efd4f2f8ca77c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01698,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9c316b67ce5ae45a6ba25c46c1720b77741ce1bd7631e5da01fb509ca50ace2f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01699,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcea5c210e2ef00d919631ccb5e68b178fb9b480062d13cc8604ce3845d950362&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01700,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3d9833e9df7243daa3904d9a41d3808841ba7ea07998eb140d63ad0b82f49d5f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01701,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x073ad3dcaef6a4e5c3deec4d10a9795592dca55108e7fd3cf274ada351c290ae&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01702,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9c454cbcd610aa388489e7db1f4849677840ce1f0a3679e88d9e102e2b646aa7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01703,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0d424bdb826419a44bbe1435dbf09f15e33b105a97d0c11741401fb5e151f306&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01704,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc842662446daaba43a5dbc82bb9bc5735a21aba5fa7c6a0642a2a645d2fb06a9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01705,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x850425a72ebd6cac965b15c5411581bb261a58e2e9f304fbbcc1f6ec56a3689a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01706,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5f7468d23fbeed676fe8188c346cc24453860c8e265373880ee3ca128e9f98b9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01707,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x68199dcdf8d631885b4e264ef8160a64551e500f2f49aaac4e2966d6b42143fb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01708,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1bc39088aff2c8759c5f61190c8af3aeb48cc644a57ec061b6547c97395754a4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01709,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xac6bdf4cbd7c785c68ed288da6c280a6d1b7340e882e1a71688e56b31d237970&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01710,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x616a421395c539814d92259f0dbdccc436b6be78d1ad264305abc632fae12c63&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01711,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x675a2efc56ef5c385bc82bd826482cd8247801e0556f38182d2d396d7af13474&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01712,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb3466ce1c9c6c1f1c5c8681c13442c053bd73443ebd60b0443cccf95717fb756&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01713,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xefe87a15350ae4b7ea6136f27efba4c610f7d260cad4188771530e46a85d96ca&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01714,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8a93b06d9b9e80fc6e21443ec976bbd3de80fa2ca50768e728598d44c6fce197&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01715,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc53f6fe8560e2c1f79a629b335139dff42a166dba3a3f3cdd8b9f3c45c482cef&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01716,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbeebbc85402356009b2eecfc3e808aa7d6b671ce58430bada153e2678890476a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01717,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2daba19a743ea4ca797c5c20fffea6f79979ebd83d0606fa86a38c02709d0425&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01718,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x69ddf701e288b58796af67a303745d123486204a9a7e0ac18b2afb25c4c9b61d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01719,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xac2ebcf440ba3a2ef280e8004918a9b6d849e19b321823a57132d7799c21a147&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01720,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc428eb527615d3acc4dbd68d2052fe6db27152c73bb2b22edfe4d9f13fd67ecf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01721,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x940116cedc675ccdecfc2ace0d21817c7e13d57154dfbabd0ac759cb68fc7aed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01722,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1aff873b75f990bea4c06fd212d2862a06d28047e47592b8809eeb164826bdf8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01723,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf19dc7c143cd5aac499bab456496409958bc496ed1b807c209069e5fb78089a6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01724,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x50ba9e2446defbca234aba740d15221152d261f9987e24f6e9ff3833d2422c88&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01725,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6244c9ba553c0a9fdd9985673ec8dc94558b1208ea0b2c09cae8baec14ef04ef&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01726,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd9ca0531bdadeb4a42bbbe600161d3bc0c29f6de35c37b584d463c87cc8929be&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01727,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x019f04b76df87f056d3e85bf6100ad35611dce5c332f9c885cf4ddf9e4b0df05&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01728,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0bd9139ddae4c9e202aa11614fbe037609445363727e6057db969600bc442615&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01729,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa85a5ebec5a89cea73285765cd253a54806b53af28dd7577198839114fc037a3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01730,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe07d8fc1ad730fc509989b081ff643430c4d25396853553dde4bc01e0a5c774c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01731,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcdeae685f4d356e7c5cd458638103aa02069a6ca2d8c459bbc49b9e3ac9f302f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01732,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd4b05748bb2981bff1958a4dba0b0f59559bfd5f8fd4e32b1d6c94d0902e1087&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01733,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2b75c3c9e417a3ee775e3f6d8b333588c4c8eb482ad9c611c73b8de9fff3403c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01734,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0b51aa4b64600138e09022ba4fcd58449faf43f4b1f8a5e82d9450fec703516c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01735,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5b7da9fdc48dac8163f0a2620536639c95e1f3c35f5d09442cd077900ba3397e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01736,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2d581b4305c5b54aa72fbb2dea7f95fcd7ecd06dbafa7d1f52197cbb86cd7275&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01737,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x053468cbce94fcb5f0170028e0a585bb98000c005cbb0f9d8cdc0274cc3fdcf4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01738,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc4ea73550a711a24cdb631632d8b9826098f572e1dd0f5d338a7d571e40a0670&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01739,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x390296d239ff8e7ba83108c01143904890332e29c7fb89f287be70d9e446a4af&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01740,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0bc99a43bd74f339e60b6cb7235925e6bd78a56014979d6dd161ad9e2f65c9db&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01741,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x831ca1406a51f08d9e8b7f9b4ae4e9b1562ec6b3a965e648f5fba403985d7c5f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01742,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6ea854bc3a2a1cad0e25a07bc1a13146837088263c4b906a86f3aff87748a250&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01743,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcbe74e160ce637284edac7282156fd9a04638631e32dde566ef91abe19e9d7db&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01744,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xafde3d1a0a5c90a5b6a8ace6e0c51f287a7baa6cd52fbb530d5cd30d77d1a9e1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01745,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x265425af9916bed0dd62a2456e7c7da2c9c0f07a25c8974425dc0f116865942f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01746,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xffa83edd16de7ec3db737cea195c255b9711b59c21b1497e26747bed2e13f943&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01747,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2d7f0f5ad114008c8bcb0c95c1368739149923d73651da238d74d6e4f2e3acb7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01748,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7b69dcfeced3aa613f02ad7933e543e8dd53bfaeee20d90f4f1bd38429dfacf0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01749,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc08c96110c4d40c906c9f31d2d959c22201f86eade534578a58c391900fa278f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01750,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6067e2dac2ea8b7d928570e0b358cb2bde6a09b5169325a6d553e6215ab5b5c6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01751,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x50262a09aa1822e9da30e2dfd935d89e012d1d336a88f24d8db38e4ec1608284&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01752,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0488926e04563f273a6ad741c30908764e8dac6e38d7032eb8d398a39b6e0f42&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01753,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7477c0a14e3afe6b1210829b4fd571ddba704e062565ee06f8fc00631cc348ba&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01754,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x646def35e15739fb4e6b897511c4a71c34b323e0107a079a03ffe1be11480962&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01755,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x84f4fc01aa6c9e739865d63f71d6860875ba166ea67b4aa068de28cb1adffc8f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01756,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x308e058035fe5998006d16d2b6f6fb289d120e402b96d10100c98e92efc86619&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01757,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8b98854f27b4a6d80d520f8fe71c52fafbe55252d3df554a907a9c0c90f1de89&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01758,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7c7bd9920cdb8efaed244a333152b7f205bfee6f2eff4e0da455d882b070ab6c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01759,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xef9dd1ae52176b521f99f60ae0a16baa1832aec7ce2b95c0e6b20cbd0943b218&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01760,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc908c0cba78857bee8eaac7c241106164154782cf8c712987f4b6eb687161ed5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01761,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4c223079fd963774b68c0c75835a4f73a591a7f6647c09fa5def8021344fd209&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01762,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x58e9482fe6e25ceccb977c5945db92bc2ff9fd044336dbfd13714e6f84d9c99a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01763,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe9b64e4399b811a832bea55ce15fb1a55718352899e8fed5cba324e196b4004e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01764,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x69d58dfd877a727ac73429279bd99ba2562eb358598d6c7f2941cdac9f3307bb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01765,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x565089600e60764e78b07382ce1e0acc93b255ac0d9e20b4ad585767be9e8ab4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01766,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe47ad77ca6b9d30cefda397443229cb1df5561c9a436fa9d94d3752dbab1b8cd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01767,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc92526a4d2bacdc047f4e86f6a2b159f6c72df8157178c4ca89cda1780245b1b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01768,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0f318bcdb0e0d78f54276c87b5be9aa21919381bf2e82205072e8c10cb8cbc21&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01769,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcc56b7c7ff7ead6cf9f72199ed9ae0a94d5afcd7fc25ad93275a37cdde487e62&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01770,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8a0d9bcdcf18b4038a4df3f96e0782f2bb1d4d84ef4932b73dd0f2655f1c9187&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01771,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8c0c7922138320604c1287c6c0f87fdb37566752373a62c150c06653189cf070&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01772,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x490072e141e5099852008eb31e3b432bbc2d71cd988dd62a6872bd723f4464a9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01773,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x441a3c8c2fe28eede2b4ed609cf3fca8740cac9638c5962e2214c00365a3a787&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01774,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9d3c41ed132dc44de0d39c9d3dd4cc11c1e8a7f8f0316eb774991a9999c0f372&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01775,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6023b5ad4e7a8f918fefab880f48288bd8e0da6b9e2e3880f17ab96e3ebcd618&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01776,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x848902b06524297d54f30c1ddb0c7629c03fb1ba49464244cfe8b198ff99dc26&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01777,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x56f9c62bb1fb7eb1575c94cf34a37b136b82db0979412504812d7bd21990d5a2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01778,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x01a7fc06f4248e48ece709e46292bb7e0a69317fefbd38215c4c093a0d42e425&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01779,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9ff0b05413db15b73284db1b8d1702ff095cce5810d44c6457693516ac3e4d65&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01780,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0601be62d83f52db2fd5baa50940e9efb464596f0ed80d11722d2944f56bc38b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01781,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc73b916a7b1049230c965741275142bf554805f395feeddf9a8a84934fefce35&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01782,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4ff9deb85b08cc30d36d12e391e9ee9bb72a7db2cb52679b62cbae6059a67a46&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01783,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6dcf0704c8afbf5b87adf316a01ebff4f641cefff7ba33d672ed51f477a2cf8a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01784,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x37725e0bd787534538108e890787fd1606569bd4db127d22da37f2a4f2373fde&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01785,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbb264cc368c6866747b9a711e14933f8d96f905bdb0b25a07cfcfd2b094a5fa4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01786,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8f3dccda34ec0838afc97c36da3b66c7a3c804709ed64b4725809ede5248dbbf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01787,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8cae5bdc47bc087d43c41f973c4711ea0af9e5ae53fc5a2fa3ff104070524401&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01788,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7e1c1704cf56b2e8cdf4ec7af790cdffcc0cfb3fa840a43ffd46d4fa0d0458a1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01789,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdb34d4b8ff52ebaaca16e0ee46cc56669773768e2c2473470d055004825f6024&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01790,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0e2fc599445336cd593fe78469762a0eaef058edc4f9a10a7083b42578eb6b18&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01791,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0dabc8f4f2cc029e70b238f3ba3f2478038729cbdab741e25e934f3828891e60&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01792,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x648d0dd207d0201595e12a8a30b247f7d51ee8385935ba68393db91c846459b6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01793,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x77485ef35b5343f0b16fab3492a9565a3fabb6b97d3076f2877c489b0a808ad5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01794,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe291673e64217556218b47874f5d9d4c6bf392894f6cabd9f572cf4750bd4d47&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01795,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd1d496b1a49c1b8f9e5a7e1146dca4e3c28ac4be22ec0d8764f56ff3ccda0e69&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01796,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x33a5546bb26b46559e6b72502faf6dfa1060fb41a69bf9fff988c463f6132aa0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01797,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x34123297e57b8a075114c3698558387086e3a4b2acfdd54041901f952e7afb91&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01798,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3ca0aeadff3449302ce20766cc4dc0b1628f85cbd26665a40b0f509493428f08&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01799,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe949b50c73fe40ff59ab7e8b460a5c81a411b02931151d95eba96ba7e422b731&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01800,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x07cb6fc533ed260b5b01e470e4d874270270fc5332f423e620be1dd92b06ff6a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01801,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8edf5827b93f9dd727c25e4cdf558bdef0c8d1962c993666fb469082ae607e6e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01802,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf95306bb3bc429f9229f80e3fd50446435e98eb615bffdb379d202abcad65f98&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01803,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4e1d05e25890a1b0b1f301452321893b91ec09ca755dea16b16fd8eb0d02a39d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01804,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa24b5a4a59adcc97ac586cf83a7314357ae74c48d9099ca9463954f8ca24db24&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01805,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x81d9a9522808c36c1845abcc5a080b237f69ec54c4f263c31c3fb2738bddbf38&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01806,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x66534ad9878fc2792c46d45c62a93320cdbd40c276025bcfb786dda3b53e775c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01807,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x37ac18016b4a26060dde93000fe2b5614ae011c506725b391bdafaf9d613f8fa&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01808,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3f1a883d82a05988793b449444221a6baa67a0975a8bdc20bd5c8044fb059bd7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01809,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x45d0f53f5567f627b64e808129a7730badce39d542584ac3b4e392e549eebe9b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01810,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6ccaab76edecb5af607c5f4a741d30e9b9762ac77bfcac89b087ac9fdb51727f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01811,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9ab98ad907f0df327b31733e17eca703d44c5315e0f3f381dee38a6716e9bbb6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01812,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x80d86e96ae3c138cb93d8b83e1aca9930c3aef9845f19e164076a319c12b3d29&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01813,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1b4ae400e53cfcfe9027f84324909f496fdba244a748a8786a8b6f30126bedb6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01814,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe0064cce975cf20b2bf11f501c61e1cfc5df450c0231fea9b29df7d134b1b5cd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01815,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa2d0424093b6f41d5bc9c2d6bc63596e722f91e214f3453d692e27404d58cb31&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01816,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9a493dd73536b40fe784e7710b23ead682163b5c2873d06fb634b41821df1d12&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01817,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf534c5f3151aba70c4902307fd1d8cb8a9227ea3bfe00099879f9af4458f7cca&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01818,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc34b86c65e0db470eb8f644fc648b5520546535adecff743126a2bb394fb474a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01819,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x918b86fa5fabcbe1535ff25b9cc6bf18399033a10feab07b1b2a44e652c890c7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01820,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x17e7111cf764fe48d55ae33eb9992d4fa0c443e17aba5ed8121665d09e719642&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01821,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe118ce724863baafe5822a6df3eb6322f52b0efac93df5ce30f2890249a5301b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01822,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd7b7b15d51895e067d217712e532f4c1ca318bec69483371d584eca1fcd35dd9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01823,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3fe7a945dc87c69c3c018c68cc45a5ad9d5c76a9623a615305eb03b30bde5286&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01824,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6ad87d358fe720d6207c7189c458f01246ef8fdbcebe5bf977590c5053395226&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01825,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7f98124406ff6a0ac572d6cbedd187c905ab77a2957904ba9df742ddd37616d9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01826,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc17dc5a387763a48690eeff9f15e2c8a17d46585c0330f855207bf83db5ba7ca&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01827,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfa5fbccba9509f70ed5a39bbc8148708230e37f26fb18b7a74aea1616e3e4609&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01828,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x540009e54254fad311b1b69490c7587db7dbf71ce7a15e62f94d49eaf22525e6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01829,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x41ed6fe79b33dc5a32a019496131ea6805aef33a6aaf93982d37dd7653decb41&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01830,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2afebfecd0c3c447d920747a1346c865aa846b0ae6f7eb900e25606c8d9ed725&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01831,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7289db8d2960f6402252c8699465253d4e3efdc31c832a9ba82b535bbe39dfa1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01832,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb1198d248f79e07609cf29ef8984e2786258b474c17a982d2e4e9219af3d6592&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01833,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0bef12618bd2905629f0c9d7427431884e203e70d78f5c9308a3215d79a28556&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01834,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfdca337f0afcb8f508449dcfebafb6de99c44f1a468a0c162785b36b20c01446&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01835,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa45d06eca259ea9bf79a23c0a8a50cd784fa072330050f7da63a0e4acd14b4f6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01836,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x87fe297ba8e996cf2b1fdb854e86b043f485149eea31c3c74187402b58892cce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01837,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe26e40bdb2425b55bd59c814f5839f7ff9f74aa1aa86d23e95988048d319e64c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01838,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xec6b0c035002b5d12e30ff8e3f97f281f562593eff842cf8905468c3d9c9777e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01839,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x07950048304ce616f23f40789e4f7995ce30e164dc5e35d97ab241998924b825&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01840,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe287972bf569570a6f2f8d3dd01ceebff3c9c849706e2ebe133ce72dbbbadcec&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01841,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2a6039e5b858d952e07cbc9057a4506b30edd01944b253c0bb68fdc9e4616b6b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01842,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5567d80f36494b4f26232e2a26f06fc382bdddf8b9eb7a20d56087f13e1cd561&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01843,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3153e10ad6830573f85e149d79579aaa27e4161239b5bef085dfe1c86d2d04cf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01844,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x03b0963dd2f6917a141dcb843dcdc7b8fe71ffc51a29cf86b7f909ba9ff178b2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01845,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x03b93b158737ecadc1a498bbe78e247ec652f5707571512674bb231e4c35593f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01846,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3e05673eeaabb4293f6eba4fc8597b21e935e72e7d614665480e881bba552938&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01847,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2de5f285569a2744c7dc3b94d992c655037d370f4f8d8ca04a26b4f30ccbf5ed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01848,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x113a0599656907adc266ada978194806c922455ded32bdb8578ddedcc0e31d8b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01849,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x71675e40a1ede46ed372c411541b1a66c4d76d33fbfd97db91b9a3a96a45e669&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01850,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xeb0e8dced91d0329228af294e8273236ae0a4e6f8590ed770ce6b8ecb9d4e9b2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01851,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x27b488ec8baa7adbc492e5c2311f57d1bb025e42fb362933096f7dbf66112277&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01852,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa405f5f3d7c35326f18a1a85fcd88a897d5e3a31867791cee9489042b950375b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01853,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xde7294f59c86cf434f1b51c11d36eec758c73de3e0cfdfb0d88f7ef4e6aaf946&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01854,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1b3a9f72ed4d4521657db928917a7abdd71f4ba2cf1fa4915b68d1c840fe3eb8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01855,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbb9869151522b5034619c9983d1c21d253a8a46dfc03bdb7c4e8771faa4cd31d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01856,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x10e8b0ee7a9e05e342cbdf4cc408d4d207163bf652e9d45a715f63a14079b558&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01857,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe0a70c38b92eb6cda8f9b7e2253b88bb8a25833d34f1174e9d5a3dc11d709fb0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01858,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x96299d525632a3677163bc6f18e98439e410f1c3f0a0e561bcbb63ed8022b860&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01859,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x056f7f9b622e013fd1a31107cddb7843babb80ad494781ecc0408a4551a6a04c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01860,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbe17dd25f8ad8b238b69e317126128e379aa87af72ab99cac240b4d6362ef148&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01861,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x31641a0876c1fef62d170f84f2c6113d88d4d38ce90538e30bed4565fc6a3027&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01862,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdeb651e11a7f6e50e2c2adc32ec89af247c4c71763ab3d213bfca70b0e26c311&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01863,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x500103a06c6cf65606e2c734912c6448844b87904ee9d68c7be782ac5f6188ca&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01864,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x168be6df9d2a7ba553609c9235d1cef41b783323f60f7c59ca210f3e9db4d764&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01865,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd69771c57985c9c43d6195e8be9d199c3b3ca206a682a0c6c2a274b8294b644a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01866,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3cf6a306ef85f605b6b8610c42f3200bc04bf7cfd1b325b8574ed2c28d4ffb62&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01867,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x69891a16fc79a0e6fd885f23b106806ecf71ad7b3e5d51a579193c4f2583dc5e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01868,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfb7b596a80d0782f73d11fae09d7da314be8143b471193a28901a36d6b58d8f1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01869,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd864488dca9ec72930dbba8d9f554af78dacec003a6f58fbe05cbeeaa8eaca21&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01870,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3dc73a6d1c0433c0d98800a9877d3e0e9651e6eace71413ae0f52a7bf58616c8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01871,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xca53dc21977789285d08334ce43b0469a5bd54cf890a4ed1e0cf4543b1575457&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01872,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd571c79ae2f0b29d334f8c33b14b21a83491d21da2650ccd9d7e3f1b307ca7a4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01873,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc71b3cef8fd89a79abb07c140f1cf9b90f4afaffa3d269ba2dcc9e2831cd0c3b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01874,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb43aeeecf3e3603fc7f82cc03948d50a9cab2c30d26a371afa8d7b0526c20853&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01875,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x24fb77820016a3b7ff7cd3ec7407364b0b660fb2a6bb0e26e4b8da1deb6275c2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01876,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x41ac34f85491e5d80275e95298185b3df6bc6e522b1b6e18a81b4a954573d27d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01877,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x54983d685feaa65ccbaed699e5c85a9cc5fb2275ee5ecc15295fa056f35dff42&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01878,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x56db2145e5e6ffb8f46ab7fd0bf8192af4b7ee8701fc92e3066697fc7fdab1c1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01879,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x793c08df7c9a354e39b31fa213f2944ea8361ed33203f0e1e438351e185d241a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01880,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0412a89eb5bf0325ce228aa64f66dcab0855c002db872dd94f3ee97496d41a1f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01881,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8d9912853e99f373036df7a07e47eff4dba631f7456c6fee1bb79a292f530c13&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01882,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x44df0aab52827e4608b4fab902457682fa019ad5cbbdf7502bb1ba74607078b7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01883,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbd172681ef1b3e781763591809db8067a65590760a1a823716d2afffcd893492&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01884,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5732d988076cc1fedf316e07aa3a8567fd55a04ca989876d4bdc63681cbcce48&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01885,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5480f07444c8ba60faf8b853c77b72b2e0aee4894a176f920d0965eb92df90f9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01886,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb5e8b2b00ba1708ec31ca0a7e64540c1b02d837991d4e12cdb19d6c75ed0da6b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01887,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdededef33d83e607868d87e8f058511a152de71d8a04b12499d5f1666b89071d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01888,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcdbce5e36cfff749d0ee9ccb6dc344a822ed097e4b8eb812ada19521890d5663&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01889,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4a09fe43bd97064993f18d214062005a1ffc76d03495b2b7c65c6137d3dd055e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01890,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xff7a1b1127af6429b799637ff6cffb9169aa5000f01b67a54e2c7f9a155e7027&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01891,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0f7bffdd015be88c78d30778d5bd66b75e86f9867e221f857352d0cb95c927a1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01892,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9671b1edc7dc58206e18de1e4d107bf2e8508483017749146ff5c82c674408e6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01893,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1b07973b9e818e0e014e52c587149c9775fd44bd5ccd095dee3221ba7c7a9efe&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01894,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x804008940c025a4e8a00ea42a659b484ba32c14dff133e9d3b7bf3685c1e54de&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01895,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3f81607c8cb3f0448a11cab8df0e504b605581f4891a9a35bd9c0dd37a71834f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01896,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe6ebe562c89bc8ecb94dc9b2889a27a816ec05d3d6bd1625acad72227071e721&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The accumulator root should be verified by community members before being
accepted. Although the accumulator root can be verified at anytime by anyone in
the future, it is likely clients and other tooling will begin relying on proofs
against the aforementioned root in the near term.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Intrinsic RevShare Token</title>
        <published>2024-02-28T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Conway</name><uri>https://github.com/0x1cc</uri>
	</author>
	
	<author>
		<name>Cathie So</name><uri>https://github.com/socathie</uri>
	</author>
	
	<author>
		<name>Xiaohang Yu</name><uri>https://github.com/xhyumiracle</uri>
	</author>
	
	<author>
		<name>Suning Yao</name><uri>https://github.com/fewwwww</uri>
	</author>
	
	<author>
		<name>Kartin</name><email>kartin@hyperoracle.io</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7641/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7641-intrinsic-revshare-token/18999" />
        

        <id>https://wg-eips.ritovision.com/7641/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7641"
            label="ERC-7641" />
        

        
        

        
        <summary type="html">An ERC-20 extension that integrates a revenue-sharing mechanism, ensuring tokens intrinsically represent a share of a communal revenue pool</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7641/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal outlines an extension of the prevailing &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; token standard, introducing a seamlessly integrated revenue-sharing mechanism. It incorporates a suite of interfaces designed to foster fair distribution of revenue among token holders while preserving the essential attributes of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;. Central to this design is the establishment of a communal revenue pool, aggregating revenues from diverse sources. The token, in essence, embodies shares, affording holders the ability to burn their tokens and redeem a proportionate share from the revenue pool. This innovative burning mechanism guarantees that, when the revenue pool is non-empty, the token&#x27;s value remains at least commensurate with the share of the revenue pool. Additionally, in periodic intervals, token holders can claim a portion of the reward, enriching their engagement and further enhancing the token&#x27;s utility.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;revenue-sharing-for-token-holders&quot;&gt;Revenue Sharing for Token Holders&lt;&#x2F;h3&gt;
&lt;p&gt;This proposal standardized an Intrinsic RevShare (revenue-sharing) model, allowing users to claim rewards periodically to ensure the efficiency of liquidity. This standard can inherently offer a clear path to long-term benefits for holders with revenue sharing, achieving a more sustainable token model by rewarding holders.&lt;&#x2F;p&gt;
&lt;p&gt;With the inheritance of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; functionalities, token holders enjoy flexibility in trading tokens on secondary markets, and an optional burning mechanism empowers them to actively contribute to a deflationary economic model while obtaining a proportional share of the revenue pool.&lt;&#x2F;p&gt;
&lt;p&gt;This approach also encourages active participation in open-source initiatives with a sustainable and multifaceted revenue-sharing ecosystem for Intrinsic RevShare token holders.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;funding-for-any-project&quot;&gt;Funding for Any Project&lt;&#x2F;h3&gt;
&lt;p&gt;This standard enables the tokenizing of all kinds of projects with revenue. This EIP introduces a new model for incentivizing contributions to open-source projects. It proposes the distribution of Intrinsic RevShare tokens to active contributors, creating a tangible asset reflecting project involvement.&lt;&#x2F;p&gt;
&lt;p&gt;Notably, it introduces a use case known as Initial Model Offering (IMO). Many open-sourced AI models face a challenge in monetizing their contributions, leading to a lack of motivation for contributors and organizations alike. This proposal seeks to empower open-sourced AI models and organizations by introducing Intrinsic RevShare token. In leveraging the token for IMO, open-sourced AI organizations can conduct fundraisings for essential funds to incentivize the ongoing development of AI models. Moreover, any project utilizing these open-source models contributes to the sustainability of the ecosystem by paying a designated fee to the revenue pool. This fee forms the basis of a revenue-sharing mechanism, allowing Intrinsic RevShare token holders to claim a proportionate share, thereby establishing a systematic and fair distribution mechanism. Importantly, this revenue-sharing feature serves as a guarantee for token holders, fostering long-term revenue benefits and encouraging sustained engagement in the open-source AI community.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Every compliant contract must implement the &lt;code&gt;IERC7641&lt;&#x2F;code&gt;, and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; interfaces.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The Intrinsic RevShare Token standard includes the following interfaces:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;IERC7641&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Defines a &lt;code&gt;claimableRevenue&lt;&#x2F;code&gt; view function to calculate the amount of ETH claimable by a token holder at a certain snapshot.&lt;&#x2F;li&gt;
&lt;li&gt;Defines a &lt;code&gt;claim&lt;&#x2F;code&gt; function for token holder to claim ETH based on the token balance at certain snapshot.&lt;&#x2F;li&gt;
&lt;li&gt;Defines a &lt;code&gt;snapshot&lt;&#x2F;code&gt; function to snapshot the token balance and the claimable revenue token balance.&lt;&#x2F;li&gt;
&lt;li&gt;Defines a &lt;code&gt;redeemableOnBurn&lt;&#x2F;code&gt; view function to calculate the amount of ETH redeemable by a token holder upon burn.&lt;&#x2F;li&gt;
&lt;li&gt;Defines a &lt;code&gt;burn&lt;&#x2F;code&gt; function for token holder to burn tokens and redeem the corresponding amount of revenue token.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.24&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An interface for ERC-7641, an ERC-20 extension that integrates a revenue-sharing mechanism, ensuring tokens intrinsically represent a share of a communal revenue pool&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7641&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC20&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A function to calculate the amount of ETH claimable by a token holder at certain snapshot.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the token holder&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; snapshotId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The snapshot id&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; amount of revenue token claimable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; claimableRevenue&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; snapshotId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A function for token holder to claim ETH based on the token balance at certain snapshot.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; snapshotId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The snapshot id&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; claim&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; snapshotId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A function to snapshot the token balance and the claimable revenue token balance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; snapshot id&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Should have `require` to avoid ddos attack&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; snapshot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A function to calculate the amount of ETH redeemable by a token holder upon burn&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of token to burn&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; amount of revenue ETH redeemable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; redeemableOnBurn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A function to burn tokens and redeem the corresponding amount of revenue token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of token to burn&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; burn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;optional-extension-altrevtoken&quot;&gt;Optional Extension: AltRevToken&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;strong&gt;AltRevToken extension&lt;&#x2F;strong&gt; is OPTIONAL for this standard. This allows the contract to accept other &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; revenue tokens (more than ETH) into the revenue sharing pool.&lt;&#x2F;p&gt;
&lt;p&gt;The AltRevToken extension&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Defines a &lt;code&gt;claimableERC20&lt;&#x2F;code&gt; function to calculate the amount of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; claimable by a token holder at certain snapshot.&lt;&#x2F;li&gt;
&lt;li&gt;Defines a &lt;code&gt;redeemableERC20OnBurn&lt;&#x2F;code&gt; function to calculate the amount of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; redeemable by a token holder upon burn.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.24&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An optional extension of the ERC-7641 standard that accepts other ERC-20 revenue tokens into the contract with corresponding claim function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7641AltRevToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7641&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A function to calculate the amount of ERC-20 claimable by a token holder at certain snapshot.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the token holder&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; snapshotId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The snapshot id&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; token&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the revenue token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; amount of revenue token claimable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; claimableERC20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; snapshotId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A function to calculate the amount of ERC-20 redeemable by a token holder upon burn&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of token to burn&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; token&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the revenue token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; amount of revenue token redeemable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; redeemableERC20OnBurn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;revenue-sharing-mechanism&quot;&gt;Revenue Sharing Mechanism&lt;&#x2F;h3&gt;
&lt;p&gt;We implement a revenue sharing mechanism wherein any token holder can claim a proportional share from the revenue pool. To ensure regular and transparent revenue distribution, we have incorporated the snapshot method, capturing both the token balance and the associated claimable revenue token balance. Periodic invocation of the snapshot method, corresponding to distinct revenue-sharing processes, is required. During each snapshot, token holders are empowered to claim a proportionate share from the revenue pool, creating a systematic and equitable distribution mechanism for participants.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;snapshot-interface&quot;&gt;&lt;code&gt;snapshot&lt;&#x2F;code&gt; interface&lt;&#x2F;h3&gt;
&lt;p&gt;We specify a &lt;code&gt;snapshot&lt;&#x2F;code&gt; interface to snapshot the token balance and the claimable revenue token balance. This functionality ensures correctness in tracking token holdings, facilitating a transparent record of each token portfolio. Regular invocation of the snapshot function is essential to maintain up-to-date records. The &lt;code&gt;snapshot&lt;&#x2F;code&gt; interface returns a unique &lt;code&gt;snapshotId&lt;&#x2F;code&gt;, allowing access to the corresponding token balance and claimable revenue token balance associated with that specific snapshot. This systematic approach enhances the correctness and reliability of historical data retrieval, providing users with comprehensive insights into their token and revenue token balances at different points in time.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;claimablerevenue-interface&quot;&gt;&lt;code&gt;claimableRevenue&lt;&#x2F;code&gt; interface&lt;&#x2F;h3&gt;
&lt;p&gt;We specify a &lt;code&gt;claimableRevenue&lt;&#x2F;code&gt; interface to calculate the amount of ETH claimable by a token holder at a certain snapshot. We will share the revenue between two consecutive snapshots. As an example in our reference implementation, assuming that the revenue between two snapshots is &lt;code&gt;R&lt;&#x2F;code&gt;, we specify a revenue sharing ratio &lt;code&gt;p&lt;&#x2F;code&gt;, ranging from 0%-100%, and we share the revenue of &lt;code&gt;pR&lt;&#x2F;code&gt; to different token holders according to the token ratio. In this example, the amount of ETH claimable by a token holder with &lt;code&gt;amount&lt;&#x2F;code&gt; tokens at a certain snapshot is &lt;code&gt;pR * amount &#x2F; totalAmount&lt;&#x2F;code&gt; , where &lt;code&gt;totalAmount&lt;&#x2F;code&gt; denotes the total amount of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7641&#x2F;&quot;&gt;ERC-7641&lt;&#x2F;a&gt; token. Noted that the remaining revenue of &lt;code&gt;(1-p)R&lt;&#x2F;code&gt; will be retained in the revenue pool, and we can take out this part of revenue through burning.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;claim-interface&quot;&gt;&lt;code&gt;claim&lt;&#x2F;code&gt; interface&lt;&#x2F;h3&gt;
&lt;p&gt;We specify a &lt;code&gt;claim&lt;&#x2F;code&gt; interface for token holder to claim ETH based on the token balance at certain snapshot. Each token holder can only claim revenue at a certain snapshot once, ensuring a fair and transparent distribution mechanism.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;burning-mechanism&quot;&gt;Burning Mechanism&lt;&#x2F;h3&gt;
&lt;p&gt;We implement a burning mechanism wherein any token holder can burn their tokens to redeem a proportional share from the revenue pool. This mechanism serves as a guarantee, ensuring that the value of the token is consistently greater than or equal to the share of the revenue pool, promoting a fair and balanced system.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;redeemableonburn-interface&quot;&gt;&lt;code&gt;redeemableOnBurn&lt;&#x2F;code&gt; interface&lt;&#x2F;h3&gt;
&lt;p&gt;We specify &lt;code&gt;redeemableOnBurn&lt;&#x2F;code&gt; interface to calculate the amount of ETH redeemable by a token holder upon burn. It is defined as a view function to reduce gas cost. As an example in our reference implementation, the amount of ETH redeemable, i.e., &lt;code&gt;redeemableETH&lt;&#x2F;code&gt; by a token holder with &lt;code&gt;amount&lt;&#x2F;code&gt; of token to burn is&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;redeemableETH &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; amount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; totalSupply &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; totalRedeemableETH&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where &lt;code&gt;totalSupply&lt;&#x2F;code&gt; denotes the total supply of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7641&#x2F;&quot;&gt;ERC-7641&lt;&#x2F;a&gt; token, and &lt;code&gt;totalRedeemableETH&lt;&#x2F;code&gt; denotes the total amount of ETH in the burning pool.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;burn-interface&quot;&gt;&lt;code&gt;burn&lt;&#x2F;code&gt; interface:&lt;&#x2F;h3&gt;
&lt;p&gt;We specify &lt;code&gt;burn&lt;&#x2F;code&gt; interface for token holder to burn tokens and redeem the corresponding amount of revenue token. A token holder can burn at most all tokens it holds. This burning process leads to a reduction in the total token supply, establishing a deflationary economic model. Furthermore, it is important to note that tokens once burned are excluded from participating in any subsequent revenue sharing.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is backward compatible with the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; as it extends the existing functionality with new interfaces.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;The reference implementation includes sample implementations of the interfaces in this standard under &lt;code&gt;contracts&#x2F;&lt;&#x2F;code&gt; and corresponding unit tests under &lt;code&gt;test&#x2F;&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7641&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;ERC7641.sol&quot;&gt;ERC-7641&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;deflationary-economic-model&quot;&gt;Deflationary Economic Model&lt;&#x2F;h3&gt;
&lt;p&gt;The introduction of the burning mechanism in this standard signifies a shift towards a deflationary economic model, which introduces unique considerations regarding security. One prominent concern involves the potential impact on token liquidity and market dynamics. The continuous reduction in token supply through burning has the potential to affect liquidity levels, potentially leading to increased volatility and susceptibility to price manipulation. It is essential to conduct thorough stress testing and market simulations to assess the resilience of the system under various scenarios.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;spam-revenue-tokens&quot;&gt;Spam Revenue Tokens&lt;&#x2F;h3&gt;
&lt;p&gt;The extension of AltRevToken with the ability to set up different revenue tokens introduces specific security considerations, primarily centered around the prevention of adding numerous, potentially worthless tokens. The addition of too many spam (worthless) tokens may lead to an increase in gas fees associated with burning and claiming processes. This can result in inefficiencies and higher transaction costs for users, potentially discouraging participation in revenue-sharing activities.&lt;&#x2F;p&gt;
&lt;p&gt;A robust governance model is crucial for the approval and addition of new revenue tokens. Implementing a transparent and community-driven decision-making process ensures that only reputable and valuable tokens are introduced, preventing the inclusion of tokens with little to no utility. This governance process should involve community voting, security audits, and careful consideration of the potential impact on gas fees.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Bonding curve-embedded liquidity for NFTs</title>
        <published>2024-02-28T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Arif Khan</name><email>arif@alethea.ai</email>
	</author>
	
	<author>
		<name>Ahmad Matyana</name><email>ahmad@alethea.ai</email>
	</author>
	
	<author>
		<name>Basil Gorin</name><uri>https://github.com/vgorin</uri>
	</author>
	
	<author>
		<name>Vijay Bhayani</name><uri>https://github.com/unblocktechie</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7649/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7649-bonding-curve-embedded-liquidity-for-erc-721-non-fungible-tokens-nfts/19079" />
        

        <id>https://wg-eips.ritovision.com/7649/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7649"
            label="ERC-7649" />
        

        
        

        
        <summary type="html">Embedding liquidity into Non-Fungible Tokens (NFTs) without modifications to ERC-721.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7649/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal introduces a standard for embedding Bonding Curve-like liquidity into
Non-Fungible Tokens (NFTs) without modifying the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; standard.
The proposed standard allows the attachment of an embedded liquidity contract, referred to as Tradable Shares,
to an ERC-721 NFT. Tradable Shares leverage a Bonding Curve-like approach to attract liquidity, enabling trading of
shares based on the bonding curve price formula.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The ERC-721 standard lacks a specific mechanism for embedding bonding curve-based liquidity, limiting the creative
possibilities for NFT-based projects. This EIP addresses the need for a standardized approach to integrate bonding curve
contracts seamlessly into ERC-721 NFTs, allowing for diverse and innovative implementations without modifying the
ERC-721 standard.&lt;&#x2F;p&gt;
&lt;p&gt;The proposed standard focuses on enhancing the ERC-721 standard by introducing a framework for embedding bonding
curve-based liquidity into NFTs. This approach provides creators with a flexible and customizable tool to attract
liquidity through bonding curve mechanisms, while ensuring creators receive guaranteed fees for their contributions.&lt;&#x2F;p&gt;
&lt;p&gt;The bonding curve-embedded liquidity for NFTs standard finds compelling use cases across diverse industries, offering a
dynamic solution for embedding Bonding Curve-like liquidity into NFTs. One prominent use case revolves around the
intersection of AI services, where NFTs model AI models, GPU resource pools, and storage resource pools. Let&#x27;s explore
two specific use cases within this domain:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;AI Model Marketplace:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;NFTs representing AI models leverage the embedded liquidity standard to embed Bonding Curve-like liquidity.
AI model providers attach Tradable Shares contracts to their NFTs, enabling a seamless integration of liquidity
features without modifying the ERC-721 standard.&lt;&#x2F;li&gt;
&lt;li&gt;The Bonding Curve mechanism allows the pricing of shares (or keys) based on the AI model&#x27;s supply and demand.
As AI models gain popularity or demonstrate superior performance, liquidity providers are incentivized to buy and
sell shares, fostering a competitive marketplace.&lt;&#x2F;li&gt;
&lt;li&gt;Creators can customize bonding curve parameters, such as slope and intercept, tailoring the liquidity mechanism to
match the evolving nature of AI models. This ensures a fair and adaptive marketplace where liquidity providers are
attracted to promising AI models, thereby creating a symbiotic relationship between liquidity and AI innovation.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Decentralized GPU and Storage Resource Allocation:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;In a decentralized ecosystem, GPU and storage resource pools are represented as NFTs with embedded Tradable Shares
contracts. This enables resource providers to attract liquidity and compete for resource allocations based on the
Bonding Curve mechanism.&lt;&#x2F;li&gt;
&lt;li&gt;The Bonding Curve determines the price of shares associated with GPU and storage resources, reflecting the current
supply and demand. Providers can customize bonding curve parameters to optimize their resource pool&#x27;s
attractiveness, taking into account factors like available resources, performance metrics, and historical usage.&lt;&#x2F;li&gt;
&lt;li&gt;Guaranteed creative fees incentivize resource providers to continually enhance and optimize their services.
As the demand for GPU and storage resources evolves, the embedded liquidity standard ensures that providers
receive fair compensation for their contributions, maintaining a competitive and responsive marketplace.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;In both use cases, the standard serves as a powerful incentive for providers to attract and retain liquidity.
The dynamic nature of the Bonding Curve-like mechanism aligns with the evolving landscape of AI models and resource
pools, fostering innovation, competition, and liquidity-driven growth within the decentralized AI services domain.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;,
&quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Bonding Curve-Embedded Liquidity &#x2F; Tradable Shares:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;An embedded bonding curve-based liquidity SHOULD be attached to the NFT via a separate contract.&lt;&#x2F;li&gt;
&lt;li&gt;An embedded bonding curve-based liquidity MUST NOT be embedded into or modify the ERC-721 standard.&lt;&#x2F;li&gt;
&lt;li&gt;The bonding curve contract MUST manage the liquidity of the associated NFT through a bonding curve mechanism.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Bonding Curve Mechanism:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The bonding curve determines the price of the NFT &quot;keys&quot; (sometimes also referred to as &quot;shares&quot;) in relation to
its supply, encouraging liquidity providers to buy and sell NFT shares based on the curve&#x27;s formula.&lt;&#x2F;li&gt;
&lt;li&gt;Implementation MAY allow the creators to customize the bonding curve parameters, such as slope, intercept,
or any other relevant parameters.&lt;&#x2F;li&gt;
&lt;li&gt;Implementation MAY allow the creators to customize the shape of the bonding curve (the curve&#x27;s formula).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Guaranteed Creative Fees:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The implementation MUST include the mechanisms that guarantee creative fees for NFT creators, that is
it MUST guarantee the creators receive a percentage of transaction fees generated by the embedded liquidity
contract during buy and sell operations.&lt;&#x2F;li&gt;
&lt;li&gt;The implementation MAY allow the creators to defne the transaction fees.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Payment Mechanisms:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The embedded liquidity contract MUST support either &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens or native ETH as a payment,
it MAY support both.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;bondingcurve-interface&quot;&gt;&lt;code&gt;BondingCurve&lt;&#x2F;code&gt; Interface&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @title Bonding Curve&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @notice A bonding curve definition&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @notice Bonding curve defines the price of the smallest unit of the asset as a function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; *      of the asset supply&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;interface BondingCurve {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @notice Bonding curve function definition. The function calculating the price&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *      of the `amount` of shares given the current total supply `supply`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @param supply total shares supply&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @param amount number of shares to buy&#x2F;sell&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @return the price of the shares (all `amount` amount)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	function getPrice(uint256 supply, uint256 amount) external pure returns(uint256);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;bonding-curve-embedded-liquidity-tradeableshares-interface&quot;&gt;Bonding Curve-Embedded Liquidity &#x2F; &lt;code&gt;TradeableShares&lt;&#x2F;code&gt; Interface&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @title Tradeable Shares&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @notice Tradeable shares is a non-transferable, but buyable&#x2F;sellable fungible token-like asset,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; *      which is sold&#x2F;bought solely by the shares contract at the predefined by&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; *      the bonding curve function price&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @notice The shares is bound to its &amp;quot;subject&amp;quot; – an NFT; the NFT owner gets the subject fee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; *      emerging in every buy&#x2F;sell operation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;interface TradeableShares is BondingCurve {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @notice Shares subject is an NFT defined by its ERC-721 contract address and NFT ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *       Shares subject is an NFT the liquidity is embedded to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	struct SharesSubject {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		&#x2F;&#x2F;&#x2F; @dev ERC-721 contract address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		address tokenAddress;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		&#x2F;&#x2F;&#x2F; @dev NFT ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		uint256 tokenId;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @dev Fired in `buyShares` and `sellShares` functions, this event logs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *      the entire trading activity happening on the curve&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @dev Trader, that is the buyer or seller, depending on the operation type is the transaction sender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @param beneficiary the address which receives shares or funds, usually this is the trader itself&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @param issuer subject issuer, usually an owner of the NFT defined by the subject&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @param isBuy true if the event comes from the `buyShares` and represents the buy operation,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *      false if the event comes from the `sellShares` and represents the sell operation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @param sharesAmount amount of the shares bought or sold (see `isBuy`)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @param paidAmount amount of ETH spent or gained by the buyer or seller;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *      this is implementation dependent and can represent an amount of ERC-20 payment token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @param feeAmount amount of all the fees paid, if any&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @param supply total shares supply after the operation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	event Trade(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		address indexed beneficiary,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		address indexed issuer,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		bool indexed isBuy,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		uint256 sharesAmount,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		uint256 paidAmount,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		uint256 feeAmount,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		uint256 supply&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @notice Shares subject, usually defined as NFT (ERC-721 contract address + NFT ID)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @dev Immutable, client applications may cache this value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @return Shares subject as a SharesSubject struct, this is an NFT if all currently known implementations&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	function getSharesSubject() external view returns(SharesSubject calldata);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @notice Cumulative fee percent, applied to all the buy and sell operations;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *      the fee percent is defined with the 18 decimals, 10^18 corresponds to 100%&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @notice The fee can be combined from multiple fees which are sent to the various destinations&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @dev Immutable, client applications may cache this value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @return protocol fee percent with the 18 decimals (10^18 is 100%)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	function getFeePercent() external view returns(uint256);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @notice Shares issuer, the receiver of the shares fees&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @dev Mutable, changes (potentially frequently and unpredictably) when the NFT owner changes;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *      subject to the front-run attacks, off-chain client applications must not rely on this address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *      in anyway&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @return nftOwner subject issuer, the owner of the NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	function getSharesIssuer() external view returns(address nftOwner);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @notice Shares balance of the given holder; this function is similar to ERC20.balanceOf()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @param holder the address to check the balance for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @return balance number of shares the holder has&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	function getSharesBalance(address holder) external view returns(uint256 balance);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @notice Total amount of the shares in existence, the sum of all individual shares balances;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *      this function is similar to ERC20.totalSupply()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @return supply total shares supply&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	function getSharesSupply() external view returns(uint256 supply);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @notice The price of the `amount` of shares to buy calculated based on&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *      the specified total shares supply&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @param supply total shares supply&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @param amount number of shares to buy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @return the price of the shares to buy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	function getBuyPrice(uint256 supply, uint256 amount) external pure returns(uint256);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @notice The price of the `amount` of shares to sell calculated based on&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *      the specified total shares supply&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @param supply total shares supply&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @param amount number of shares to sell&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @return the price of the shares to sell&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	function getSellPrice(uint256 supply, uint256 amount) external pure returns(uint256);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @notice The price of the `amount` of shares to buy, including all fees;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *      calculated based on the specified total shares supply and fees percentages&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @param supply total shares supply&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @param amount number of shares to buy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @param protocolFeePercent protocol fee percent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @param holdersFeePercent shares holders fee percent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @param subjectFeePercent protocol fee percent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @return the price of the shares to buy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	function getBuyPriceAfterFee(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		uint256 supply,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		uint256 amount,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		uint256 protocolFeePercent,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		uint256 holdersFeePercent,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		uint256 subjectFeePercent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	) external pure returns(uint256);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @notice The price of the `amount` of shares to sell, including all fees;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *      calculated based on the specified total shares supply and fees percentages&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @param supply total shares supply&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @param amount number of shares to sell&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @param protocolFeePercent protocol fee percent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @param holdersFeePercent shares holders fee percent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @param subjectFeePercent protocol fee percent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @return the price of the shares to sell&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	function getSellPriceAfterFee(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		uint256 supply,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		uint256 amount,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		uint256 protocolFeePercent,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		uint256 holdersFeePercent,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		uint256 subjectFeePercent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	) external pure returns(uint256);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @notice Current price of the `amount` of shares to buy; calculated based on&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *      the current total shares supply&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @param amount number of shares to buy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @return the price of the shares to buy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	function getBuyPrice(uint256 amount) external view returns(uint256);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @notice Current price of the `amount` of shares to sell; calculated based on&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *      the current total shares supply&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @param amount number of shares to sell&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @return the price of the shares to sell&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	function getSellPrice(uint256 amount) external view returns(uint256);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @notice Current price of the `amount` of shares to buy, including all fees;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *      calculated based on the current total shares supply and fees percentages&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @param amount number of shares to buy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @return the price of the shares to buy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	function getBuyPriceAfterFee(uint256 amount) external view returns(uint256);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @notice Current price of the `amount` of shares to sell, including all fees;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *      calculated based on the current total shares supply and fees percentages&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @param amount number of shares to sell&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @return the price of the shares to sell&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	function getSellPriceAfterFee(uint256 amount) external view returns(uint256);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @notice Buy `amount` of shares. Sender has to supply `getBuyPriceAfterFee(amount)` ETH.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *      First share can be bought only by current subject issuer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @dev Depending on the implementation, ERC-20 token payment may be required instead of ETH.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *      In such a case, implementation must through if ETH is sent, effectively overriding&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *      the function definition as non-payable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @param amount amount of the shares to buy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	function buyShares(uint256 amount) external payable;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @notice Buy `amount` of shares in the favor of the address specified (beneficiary).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *      Sender has to supply `getBuyPriceAfterFee(amount)` ETH.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *      First share can be bought only by current subject issuer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @dev Depending on the implementation, ERC-20 token payment may be required instead of ETH.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *      In such a case, implementation must through if ETH is sent, effectively overriding&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *      the function definition as non-payable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @param amount amount of the shares to buy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @param beneficiary an address receiving the shares&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	function buySharesTo(uint256 amount, address beneficiary) external payable;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @notice Sell `amount` of shares. Sender gets `getSellPriceAfterFee(amount)` of ETH.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *      Last share cannot be sold.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @dev Depending on the implementation, ERC-20 token may be payed instead of ETH.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @param amount amount of the shares to sell&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	function sellShares(uint256 amount) external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @notice Sell `amount` of shares in the favor of the address specified (beneficiary).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *      The beneficiary gets `getSellPriceAfterFee(amount)` of ETH.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *      Last share cannot be sold.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @dev Depending on the implementation, ERC-20 token may be payed instead of ETH.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @param amount amount of the shares to sell&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @param beneficiary an address receiving the funds from the sale&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	function sellSharesTo(uint256 amount, address payable beneficiary) external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @notice Cumulative value of all trades; allows to derive cumulative fees paid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @dev This value cannot decrease over time; it can increase or remain constant&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *      if no trades are happening&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 * @return Sum of the modulo of all trading operations&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	function getTradeVolume() external view returns(uint256);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The rationale behind the design choices for the embedded liquidity standard is deeply rooted in providing a robust and
versatile framework for embedding Bonding Curve-like liquidity into NFTs. The following key considerations have
influenced the technical decisions:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Bonding Curve-Embedded Liquidity &#x2F; Tradable Shares Contract&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Seamless Integration&lt;&#x2F;strong&gt;: The decision to allow an embedded bonding curve-based liquidity contract to be attached
to an NFT without altering the ERC-721 standard stems from the desire for seamless integration.
This approach ensures that NFT developers can enhance their creations with liquidity mechanisms without
introducing complexities or requiring modifications to the widely adopted ERC-721 standard.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Liquidity Management&lt;&#x2F;strong&gt;: The bonding curve contract&#x27;s role in managing liquidity through the bonding curve
mechanism is essential. This design choice facilitates a dynamic and automated pricing model based on supply
and demand, contributing to the overall liquidity and tradability of NFT shares.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Bonding Curve Mechanism&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Dynamic Pricing&lt;&#x2F;strong&gt;: The adoption of a bonding curve mechanism to determine the price of Tradable Shares aligns
with the goal of encouraging liquidity providers to engage in buying and selling NFT shares.
The dynamic pricing, influenced by the curve&#x27;s formula, ensures that the market for Tradable Shares remains
responsive to changing conditions.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Customization for Creators&lt;&#x2F;strong&gt;: The decision to allow creators to customize bonding curve parameters, such as
slope and intercept, empowers them to tailor the liquidity mechanism to the unique needs and characteristics of
their projects. This customization fosters creativity and innovation within the NFT space.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Guaranteed Creative Fees&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Creator Incentives&lt;&#x2F;strong&gt;: The emphasis on guaranteeing creative fees for NFT creators is foundational to sustaining
a thriving ecosystem. By enabling creators to specify and receive a percentage of transaction fees, the standard
aligns incentives and rewards creators for their contributions, fostering a sustainable and creator-friendly
environment.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Payment Mechanisms&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Developer Freedom&lt;&#x2F;strong&gt;: The standard&#x27;s implementation-agnostic approach is motivated by the desire to provide
developers with the freedom to choose and design the most suitable liquidity mechanism for their NFT projects.
Whether interacting with ERC-20 tokens or native ETH, this independence ensures that developers can make
informed choices based on the specific requirements of their projects.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The rationale behind these design choices is to create a Tradable Shares standard that is not only technically sound but
also flexible, adaptable, and supportive of diverse and creative implementations within the ERC-721 ecosystem.&lt;&#x2F;p&gt;
&lt;p&gt;See also: Bonded Fungible Tokens (1671)&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Smart Contract Security: Implementations of smart contracts should undergo thorough security audits to ensure
resistance against vulnerabilities and attacks.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Creative Fee Handling: Mechanisms for handling and distributing creative fees should be secure and transparent to
prevent any malicious activities.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Compatibility: Developers should ensure compatibility with existing ERC-721 implementations, allowing for a smooth
integration of the embedded liquidity standard.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;User Experience: Considerations should be made to maintain a positive user experience, avoiding complexities that
may hinder the adoption of NFT projects utilizing embedded liquidity.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;This security considerations section reflects the importance of anticipating and addressing potential security
challenges in the implementation, ensuring its robustness, compatibility, and user-friendly nature.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Optimize EOA EXTCODEHASH</title>
        <published>2024-02-26T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Jame</name><uri>https://github.com/ZWJKFLC</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7637/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7637-extcodehash-optimize/18946" />
        

        <id>https://wg-eips.ritovision.com/7637/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7637"
            label="EIP-7637" />
        

        
        

        
        <summary type="html">Modify the output value of EXTCODEHASH for EOA accounts to `0x`</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7637/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal is an optimization for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1052&#x2F;&quot;&gt;EIP-1052&lt;&#x2F;a&gt;,
For addresses with a balance, but without code, the codehash should still be &lt;code&gt;0x&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;When an address &lt;code&gt;add.code == 0x&lt;&#x2F;code&gt; and &lt;code&gt;add.balance != 0&lt;&#x2F;code&gt;, &lt;code&gt;add.codehash==0&lt;&#x2F;code&gt; is required instead of &lt;code&gt;add.codehash==keccak256(&quot;&quot;)&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;EIP-1052 was proposed to save gas fees. However, due to some flaws in the set specifications, in actual applications, due to safety concerns, they will not actually be used. In order for EIP-1052 to be truly useful, it should be optimized.&lt;&#x2F;p&gt;
&lt;p&gt;If someone uses it based on the proposal of EIP-1052 and does not notice the change when &lt;code&gt;add.balance != 0&lt;&#x2F;code&gt;, there may be security issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The behaviour of &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; is changed in the following way:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;When calling &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt;, the codehash of the address with balance but no code is still &lt;code&gt;0x&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;EIP-1052 In order to include the function of &lt;code&gt;BALANCE&lt;&#x2F;code&gt;, let the &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; of the address without balance be &lt;code&gt;0x&lt;&#x2F;code&gt;, and the &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; of the address with balance be &lt;code&gt;keccak256(&quot;&quot;)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The contract address can be calculated in advance. Whether it is  &lt;code&gt;CREATE&lt;&#x2F;code&gt; or &lt;code&gt;CREATE2&lt;&#x2F;code&gt;, it is possible that the contract is not created but has a balance. For security, You can actually only use &lt;code&gt;keccak256(add.code) == keccak256(&quot;&quot;)&lt;&#x2F;code&gt; or &lt;code&gt;add.code.length ==0&lt;&#x2F;code&gt; instead of &lt;code&gt;add.codehash == 0&lt;&#x2F;code&gt;,, which makes the original intention of EIP-1052 meaningless.&lt;&#x2F;p&gt;
&lt;p&gt;For example, uniswap V2 uses stored addresses to determine whether a contract exists. If this &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; is optimized, can save a huge amount of gas.&lt;&#x2F;p&gt;
&lt;p&gt;If someone uses a &lt;code&gt;add.codehash==0&lt;&#x2F;code&gt; to determine whether a contract has been created, due to intuition and the lack of details in many documents, they will not think that the codehash of an address with a balance will change from &lt;code&gt;0x&lt;&#x2F;code&gt; to &lt;code&gt;keccak256(&quot;&quot;)&lt;&#x2F;code&gt;. If someone maliciously attacks at this time, it will cause some bad effects.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Using codehash to determine whether a non-contract address has a balance will not be available&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Code reference for execution-specs&lt;&#x2F;p&gt;
&lt;p&gt;After modification&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; extcodehash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Evm&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; to_address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;pop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;stack&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    charge_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GAS_CODE_HASH&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    account&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;env&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EMPTY_ACCOUNT&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        codehash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; U256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	codehash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; U256&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_be_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;	if&lt;&#x2F;span&gt;&lt;span&gt; codehash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; U256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;hexstr&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	    codehash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; U256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    push&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;stack&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; codehash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pc&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Source code&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; extcodehash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Evm&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; to_address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;pop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;stack&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    charge_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GAS_CODE_HASH&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    account&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;env&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EMPTY_ACCOUNT&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        codehash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; U256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        codehash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; U256&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_be_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    push&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;stack&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; codehash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pc&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Using codehash to determine whether a non-contract address has a balance will not be available&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Batch Calls Encoding in SCA</title>
        <published>2024-02-26T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>George</name><uri>https://github.com/JXRow</uri>
	</author>
	
	<author>
		<name>Zisu</name><uri>https://github.com/lazy1523</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7638/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7638-optimized-calls-encoding/18966" />
        

        <id>https://wg-eips.ritovision.com/7638/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7638"
            label="ERC-7638" />
        

        
        

        
        <summary type="html">Encode multiple calls for smart contract account (SCA) with atomic and saving gas</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7638/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Batch Calls Encoding (BCE) outlines a solution for Smart Contract Account (SCA) wallets to consolidate multiple calls into a single call, encoding multiple parameters into bytes, compressing on-chain data, and saving gas. It can be used to implement atomic operations as well as non-atomic operations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Typically, interactions between users and contracts involve a series of coherent operations, such as &lt;code&gt;approve&lt;&#x2F;code&gt;-&lt;code&gt;transferFrom&lt;&#x2F;code&gt;. While EOA wallets require users to confirm each operation sequentially, SCA wallets can confirm all operations with a single confirmation, completing all operations within a single call, thus achieving atomicity. If &lt;code&gt;approve&lt;&#x2F;code&gt; succeeds but &lt;code&gt;transferFrom&lt;&#x2F;code&gt; fails, it poses a security risk. The secure approach is to ensure that if one operation fails, all associated operations also fail, thereby ensuring atomicity. Therefore, we propose this encoding method to encode multiple parameters into bytes, compress on-chain data, and save gas. It can be used to implement both atomic and non-atomic operations.&lt;&#x2F;p&gt;
&lt;p&gt;In addition to the atomic operation of &lt;code&gt;approve&lt;&#x2F;code&gt;-&lt;code&gt;transferFrom&lt;&#x2F;code&gt; mentioned above, gas payment delegation can also be achieved. It involves users and bundlers signing a set of calls, where the content of the calls includes:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The user wishes to initiate multiple calls through his SCA.&lt;&#x2F;li&gt;
&lt;li&gt;The user transfers 10 USDT to the bundler as fee, included within the calls.&lt;&#x2F;li&gt;
&lt;li&gt;The bundler submits the calls, pay ETH gas and get the 10 USDT.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The user encodes the content of the calls, attaches their signature to ensure its integrity, and sends it to the bundler. If the bundler considers the gas payment insufficient, they may choose not to submit it. However, if they approve the content of the calls, the signed transaction can be submitted. After execution, the user obtains the desired operations, and the bundler receives the fee.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;EIP-4337&lt;&#x2F;a&gt; also implements gas payment delegation. BCE and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;EIP-4337&lt;&#x2F;a&gt; are not mutually exclusive and can be implemented concurrently within an SCA.&lt;&#x2F;p&gt;
&lt;p&gt;Based on empirical testing, BCE is simpler and more gas-efficient compared to alternative methods.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;This ERC &lt;strong&gt;REQUIRED&lt;&#x2F;strong&gt; SCA to be implemented in the contract, where the Dapp communicates with the SCA wallet extension to communicate the user&#x27;s intentions to the wallet, which uses Batch Calls Encoding to send multiple calls as bytes to the user&#x27;s SCA contract.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Batch Calls&lt;&#x2F;em&gt; comprises multiple &lt;code&gt;Call&lt;&#x2F;code&gt; bytes, each defined by the encoding of &lt;code&gt;to&lt;&#x2F;code&gt;`value&lt;code&gt;\&lt;&#x2F;code&gt;data` as follows:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7638&#x2F;.&#x2F;assets&#x2F;encoding.svg&quot; alt=&quot;&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Let:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;to&lt;&#x2F;code&gt;: The address of the called contract, corresponding to the Solidity address type, 20 bytes.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;value&lt;&#x2F;code&gt;: The amount of ETH(in wei) sent to the contract, in wei, corresponding to the Solidity uint type, 32 bytes.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;data length&lt;&#x2F;code&gt;: The length of the data(in bytes), corresponding to the Solidity uint type, 32 bytes.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;data&lt;&#x2F;code&gt;: The encoded functionData sent to the contract, corresponding to the Solidity bytes type, with a length defined by &lt;code&gt;data length&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Multiple &lt;code&gt;Call&lt;&#x2F;code&gt; units are concatenated to form an &lt;em&gt;Batch Calls&lt;&#x2F;em&gt; sequence.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Each call encapsulates 3 parameters: &lt;code&gt;to&lt;&#x2F;code&gt;`value&lt;code&gt;\&lt;&#x2F;code&gt;data&lt;code&gt;. The conventional approach involves packaging these 3 parameters into a struct and then placing multiple structs into an array. However, using a struct adds overhead as it also packages the types of &lt;&#x2F;code&gt;to&lt;code&gt;\&lt;&#x2F;code&gt;value&lt;code&gt;\&lt;&#x2F;code&gt;data&lt;code&gt;, increasing the size of the encoding. Since &lt;&#x2F;code&gt;to&lt;code&gt;\&lt;&#x2F;code&gt;value&lt;code&gt;\&lt;&#x2F;code&gt;data&lt;code&gt;have fixed types, this additional encoding can be omitted. In Solidity, reading data from&lt;&#x2F;code&gt;bytes calldata` using slice is a gas-efficient method. Considering these factors, &lt;em&gt;Batch Calls Encoding&lt;&#x2F;em&gt; can compress on-chain data and save gas.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC does not change the consensus layer, so there are no backwards compatibility issues for Ethereum as a whole.&lt;&#x2F;p&gt;
&lt;p&gt;This ERC does not change other ERC standards, so there are no backwards compatibility issues for Ethereum applications.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal only specifies the encoding of &lt;em&gt;Batch Calls&lt;&#x2F;em&gt;, while the specific implementation and naming are left to the discretion of the project. Below is an example of an SCA contract utilizing &lt;em&gt;Batch Calls&lt;&#x2F;em&gt; (referred to as &lt;code&gt;atomCallbytes&lt;&#x2F;code&gt;), where the user atomically signs multiple operations, enabling the bundler to pay gas on behalf of the user:&lt;&#x2F;p&gt;
&lt;h3 id=&quot;smartwallet-sol&quot;&gt;&lt;code&gt;SmartWallet.sol&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;utils&#x2F;cryptography&#x2F;ECDSA.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SmartWallet&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    using&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ECDSA&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; valid &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;to make AtomSign invalid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; immutable&lt;&#x2F;span&gt;&lt;span&gt; original&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; bundler&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; usedMsgHashes&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    modifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyBundler&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            bundler &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;onlyBundler: caller is not the bundler&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        _&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    modifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwnerAndOriginal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            owner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span&gt; original &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;onlyOwnerAndOriginal: caller is not the owner&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        _&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _bundler&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        original &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        owner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bundler &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _bundler&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; atomSignCall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; atomCallbytes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; deadline&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyBundler&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;deadline &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;atomSignCall: Expired&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; msgHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;concat&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;                msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;chainid&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                bytes20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                bytes4&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;valid&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;usedMsgHashes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;msgHash&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;atomSignCall: Used msgHash&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            owner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; msgHash&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;toEthSignedMessageHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;recover&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;atomSignCall: Invalid Signature&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;do calls&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        while&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; atomCallbytes&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            address&lt;&#x2F;span&gt;&lt;span&gt; to &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint160&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;atomCallbytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;20&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            uint&lt;&#x2F;span&gt;&lt;span&gt; value &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;atomCallbytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;20&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;52&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            uint&lt;&#x2F;span&gt;&lt;span&gt; len &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;atomCallbytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;52&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;84&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt; success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;call&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;atomCallbytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;84&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;84&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;len&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                    revert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;result&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 84&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; len&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        usedMsgHashes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;msgHash&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * if you signed something then regretted, make it invalid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; makeAtomSignInvalid&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwnerAndOriginal&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        valid &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;blockhash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;bundler-sol&quot;&gt;&lt;code&gt;Bundler.sol&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Bundler&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    modifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            owner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;onlyOwner: caller is not the owner&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        _&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        owner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; executeOperation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; wallet&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt; success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; _callTo&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;call&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                revert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;result&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal introduces a data encoding scheme aimed at data compression. It solely concerns data compression and does not lead to data loss or concealment of private data.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Extension of EIP-778 for &quot;client&quot; ENR Entry</title>
        <published>2024-02-25T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>James Kempton</name><uri>https://github.com/SirSpudlington</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7636/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip7636-extension-of-eip-778-for-client-enr-entry/18935" />
        

        <id>https://wg-eips.ritovision.com/7636/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="networking"
                label="Networking" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7636"
            label="EIP-7636" />
        

        
        

        
        <summary type="html">Add additional ENR entry to specify client information such as name and version number.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7636/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The Ethereum network consists of nodes running various client implementations. Each client has its own set of features, optimizations, and unique behaviors. Introducing a standardized way to identify client software and its version in the ENR allows for more effective network analysis, compatibility checks, and troubleshooting. This EIP proposes the addition of a &quot;client&quot; field to the ENR.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Understanding the landscape of client software in the Ethereum network is crucial for developers, nodes, and network health assessment. Currently, there is no standardized method for nodes to announce their software identity and version, which can lead to compatibility issues or difficulty in diagnosing network-wide problems. Adding this to the ENR allows clients to audit network health only using discv5, and additionally track discv5 adoption across different services.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;The &quot;client&quot; entry is proposed to be added to the ENR following the specifications in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;778&#x2F;&quot;&gt;EIP-778&lt;&#x2F;a&gt;. This entry is OPTIONAL and can be omitted by clients that choose not to disclose such information. The key for this entry is &lt;code&gt;&quot;client&quot;&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;All elements MUST be encoded as a string using the ASCII standard as described in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc20&quot;&gt;RFC 20&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The value for this entry MUST be an RLP list:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[ClientName, Version, (BuildVersion)]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ClientName&lt;&#x2F;code&gt;: A string identifier for the client software. It SHOULD be concise, free of spaces, and representative of the client application.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Version&lt;&#x2F;code&gt;: A string representing the version of the client software in a human-readable format. It is RECOMMENDED to follow semantic versioning.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;BuildVersion&lt;&#x2F;code&gt;: An OPTIONAL string representing the build or commit version of the client software. This can be used to identify specific builds or development versions.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;One key was chosen over using many keys to make efficient use of space. The use of one string, however, does not align with other EIPs of similar purpose and as such the RLP list was decided as the best encoding.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is fully backwards compatible as it extends the ENR specification by adding an optional entry. Existing implementations that do not recognize the &quot;client&quot; entry will ignore it without any adverse effects on ENR processing or network behavior.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;A node running Geth version 1.10.0 on the mainnet might have an ENR &lt;code&gt;client&lt;&#x2F;code&gt; entry like:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&amp;quot;Geth&amp;quot;, &amp;quot;1.10.0&amp;quot;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;A node running an experimental build of Nethermind might include:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&amp;quot;Nethermind&amp;quot;, &amp;quot;1.9.53&amp;quot;, &amp;quot;7fcb567&amp;quot;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;and an ENR of&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;enr:-MO4QBn4OF-y-dqULg4WOIlc8gQAt-arldNFe0_YQ4HNX28jDtg41xjDyKfCXGfZaPN97I-MCfogeK91TyqmWTpb0_AChmNsaWVudNqKTmV0aGVybWluZIYxLjkuNTOHN2ZjYjU2N4JpZIJ2NIJpcIR_AAABg2lwNpAAAAAAAAAAAAAAAAAAAAABiXNlY3AyNTZrMaECn-TTdCwfZP4XgJyq8Lxoj-SgEoIFgDLVBEUqQk4HnAqDdWRwgiMshHVkcDaCIyw&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;which can be decoded to yield normal data such as &lt;code&gt;seq&lt;&#x2F;code&gt;, &lt;code&gt;signature&lt;&#x2F;code&gt;, &lt;code&gt;id&lt;&#x2F;code&gt; and &lt;code&gt;secp256k1&lt;&#x2F;code&gt;. Additionally, it would yield the client value of &lt;code&gt;[&quot;0x4e65746865726d696e64&quot;,&quot;0x312e392e3533&quot;,&quot;0x37666362353637&quot;]&lt;&#x2F;code&gt; or &lt;code&gt;[&quot;Nethermind&quot;, &quot;1.9.53&quot;, &quot;7fcb567&quot;]&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Introducing identifiable client information could potentially be used for targeted attacks against specific versions or builds known to have vulnerabilities. It is crucial for clients implementing this EIP to consider the implications of disclosing their identity and version. Users or operators should have the ability to opt-out or anonymize this information if desired.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, as this information is self proclaimed, this data &lt;em&gt;&lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt; be used for anything that requires it to be reliable.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Limited Transfer Count NFT</title>
        <published>2024-02-22T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Qin Wang</name><uri>https://github.com/qinwang-git</uri>
	</author>
	
	<author>
		<name>Saber Yu</name><uri>https://github.com/OniReimu</uri>
	</author>
	
	<author>
		<name>Shiping Chen</name><email>shiping.chen@data61.csiro.au</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7634/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7634-limited-transferable-nft/18861" />
        

        <id>https://wg-eips.ritovision.com/7634/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:7634"
            label="ERC-7634" />
        

        
        

        
        <summary type="html">An ERC-721 extension that caps how many times an individual token can be transferred</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7634/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard extends &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; with a mechanism that lets token owners&#x2F;minters cap how many times a specific token can be transferred. It specifies functions to set and read a per-token transfer limit, to query a per-token transfer count, and defines transfer-time hooks to enforce the cap. The goal is fine-grained, enforceable transfer restrictions while preserving ERC-721 compatibility.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Once NFTs are sold, they detach from their minters and can be perpetually transferred. Yet many situations require tighter control over secondary movement.&lt;&#x2F;p&gt;
&lt;p&gt;First, limiting the number of transfers can help preserve value (e.g., premium auctions, IP that becomes CC0 after a finite number of transfers, or game items that “wear out” and burn at a threshold).&lt;&#x2F;p&gt;
&lt;p&gt;Second, capping transfer frequency can reduce risks from adversarial arbitrage (e.g., HFT-like behavior) by offering an easy-to-deploy throttle.&lt;&#x2F;p&gt;
&lt;p&gt;Third, bounding re-staking cycles of NFT positions (e.g., proof-of-restake) can dampen recursive leverage and mitigate bubble dynamics.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;key-takeaways&quot;&gt;Key Takeaways&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;em&gt;Controlled Value Preservation.&lt;&#x2F;em&gt; Scarcity via a transfer cap can help maintain value over time.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Ensuring Intended Usage.&lt;&#x2F;em&gt; Limits keep usage aligned with intent (e.g., limited editions less prone to flip cycles).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Expanding Use Cases.&lt;&#x2F;em&gt; Memberships&#x2F;licenses with bounded transferability become practical.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Easy Integration.&lt;&#x2F;em&gt; An extension interface (&lt;code&gt;IERC7634&lt;&#x2F;code&gt;) layers on top of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;, easing adoption without breaking compatibility.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;setTransferLimit&lt;&#x2F;code&gt;: establishes the transfer limit for a &lt;code&gt;tokenId&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;transferLimitOf&lt;&#x2F;code&gt;: returns the transfer limit for a &lt;code&gt;tokenId&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;transferCountOf&lt;&#x2F;code&gt;: returns the current transfer count for a &lt;code&gt;tokenId&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Counting and enforcement scope.&lt;&#x2F;strong&gt; Implementations &lt;strong&gt;MUST&lt;&#x2F;strong&gt; enforce the cap on native ERC-721 transfers of the underlying token (i.e., transfers where &lt;code&gt;from != address(0)&lt;&#x2F;code&gt; and &lt;code&gt;to != address(0)&lt;&#x2F;code&gt;). Incrementing the count &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; occur only after a successful native transfer. Mint and burn operations MUST NOT increment the count.&lt;&#x2F;p&gt;
&lt;p&gt;Implementers &lt;strong&gt;MUST&lt;&#x2F;strong&gt; provide the following interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.4&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; IERC7634 Interface for Transfer-Capped ERC-721 Tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-7634 is an extension interface intended to be implemented alongside ERC-721&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7634&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted after a successful native transfer when the per-token count increases.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransferCountIncreased&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newCount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when the per-token transfer limit is set or updated.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransferLimitUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; previousLimit&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newLimit&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the current transfer count for a tokenId.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferCountOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sets the transfer limit for a tokenId. Callable by owner or approved.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token id to set the limit for.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The maximum number of native transfers allowed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setTransferLimit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; limit&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the transfer limit for a tokenId.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferLimitOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;tracking-and-hooks&quot;&gt;Tracking and hooks&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;transferCountOf&lt;&#x2F;code&gt; and &lt;code&gt;transferLimitOf&lt;&#x2F;code&gt; expose state needed to enforce a cap. The count should only increase after a successful native transfer (not on mint&#x2F;burn). Separating &lt;code&gt;TransferLimitUpdated&lt;&#x2F;code&gt; from &lt;code&gt;TransferCountIncreased&lt;&#x2F;code&gt; makes it clear that the former is an administrative change while the latter is derived from runtime transfers.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is fully compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;. Existing contracts can adopt it by adding the new interface and hooks without changing ERC-721 semantics.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;extensions&quot;&gt;Extensions&lt;&#x2F;h3&gt;
&lt;p&gt;This standard can be enhanced with additional advanced functionalities alongside existing NFT protocols. For example:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Incorporating a burn function (e.g., &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5679&#x2F;&quot;&gt;ERC-5679&lt;&#x2F;a&gt;) would enable NFTs to automatically expire after reaching their transfer limits, akin to the ephemeral nature of Snapchat messages that disappear after multiple views.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Incorporating a non-transferring function, as defined in the SBT standards, would enable NFTs to settle and bond with a single owner after a predetermined number of transactions. This functionality mirrors the scenario where a bidder ultimately secures a treasury after participating in multiple bidding rounds.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Below is a recommended pattern. It enforces the cap pre-transfer, increments the count post-transfer, ignores mint&#x2F;burn for counting, and emits the clarified events. Implementations commonly override &lt;code&gt;_beforeTokenTransfer&lt;&#x2F;code&gt; to enforce &lt;code&gt;transferCount&lt;&#x2F;code&gt; &amp;lt; &lt;code&gt;transferLimit&lt;&#x2F;code&gt; and &lt;code&gt;_afterTokenTransfer&lt;&#x2F;code&gt; to increment the count and emit &lt;code&gt;TransferCountIncreased&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.4&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC721&#x2F;ERC721.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERC7634.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfer-Capped ERC-721 (ERC-7634)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Example implementation of ERC-7634 alongside ERC-721&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC7634&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC7634&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; tokenId =&amp;gt; current transfer count&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _transferCounts&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; tokenId =&amp;gt; max allowed native transfers&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _transferLimits&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferCountOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_exists&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC7634: nonexistent token&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _transferCounts&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setTransferLimit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; limit&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_isApprovedOrOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_msgSender&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC7634: not owner&#x2F;approved&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; prev &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _transferLimits&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _transferLimits&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; limit&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransferLimitUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; prev&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; limit&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferLimitOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_exists&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC7634: nonexistent token&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _transferLimits&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Enforce transfer limit on native transfers (exclude mint&#x2F;burn).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _beforeTokenTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;from &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; to &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                _transferCounts&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; _transferLimits&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;                &amp;quot;ERC7634: transfer limit reached&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_beforeTokenTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Increment count only after successful native transfer and emit event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _afterTokenTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; quantity&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;from &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; to &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            unchecked&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt; _transferCounts&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransferCountIncreased&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _transferCounts&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;_transferCounts&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; _transferLimits&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;                &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Optional: perform action exactly when the cap is reached (e.g., _burn(tokenId))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_afterTokenTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; quantity&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        public&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        virtual&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        override&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC721&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;IERC7634&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Scope with wrappers. The cap applies only to native &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; transfers of the underlying token. Any owner can cheaply wrap a token and transfer a separate wrapper token; such downstream transfers cannot be prevented without breaking &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; composability. As a result, this standard does not provide an unbypassable guarantee that, for example, a game item will always wear out or that secondary trading is globally capped; it standardizes a primitive for budgeting native transfers that ecosystems may choose to coordinate around. Deployments that want stronger effective guarantees &lt;strong&gt;MAY&lt;&#x2F;strong&gt; add optional mitigations such as recipient allowlists&#x2F;registries or &quot;compliant wrapper&quot; patterns that mirror counts&#x2F;limits, trading off openness for enforcement.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Limit mutability. Consider making limits immutable once set (or only decreasing), to prevent tampering.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Gas. Avoid heavy logic in hooks; extensions (e.g., burn on cap) should remain gas-safe.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Dual Nature Token Pair</title>
        <published>2024-02-21T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>vectorized</name><uri>https://github.com/vectorized</uri>
	</author>
	
	<author>
		<name>Thomas</name><uri>https://github.com/0xth0mas</uri>
	</author>
	
	<author>
		<name>Quit</name><uri>https://github.com/quitcrypto</uri>
	</author>
	
	<author>
		<name>Michael Amadi</name><uri>https://github.com/AmadiMichael</uri>
	</author>
	
	<author>
		<name>cygaar</name><uri>https://github.com/cygaar</uri>
	</author>
	
	<author>
		<name>Harrison</name><uri>https://github.com/pop-punk</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7631/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7631-dual-nature-token-pair/18796" />
        

        <id>https://wg-eips.ritovision.com/7631/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7631"
            label="ERC-7631" />
        

        
        

        
        <summary type="html">A specification for a co-joined fungible and non-fungible token pair</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7631/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;A fungible &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; token contract and non-fungible &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; token contract can be interlinked, allowing actions performed on one contract to be reflected on the other. This proposal defines how the relationship between the two token contracts can be queried. It also enables accounts to configure whether ERC-721 mints and transfers should be skipped during ERC-20 to ERC-721 synchronization.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The ERC-20 fungible and ERC-721 non-fungible token standards offer sufficient flexibility for a co-joined, dual nature token pair. Transfers on the ERC-20 token can automatically trigger transfers on the ERC-721 token, and vice-versa. This enables applications such as native ERC-721 fractionalization, wherein acquiring ERC-20 tokens leads to the automatic issuance of ERC-721 tokens, proportional to the ERC-20 balance.&lt;&#x2F;p&gt;
&lt;p&gt;Dual nature token pairs maintain full compliance with both ERC-20 and ERC-721 token standards. This proposal aims to enhance the functionality of dual nature token pairs.&lt;&#x2F;p&gt;
&lt;p&gt;To facilitate querying the relationship between the tokens, extension interfaces are proposed for the ERC-20 and ERC-721 tokens respectively. This enables various quality of life improvements such as allowing decentralized exchanges and NFT marketplaces to display the relationship between the tokens.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, users can configure whether they want to skip ERC-721 mints and transfers during ERC-20 to ERC-721 synchronization.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;overview&quot;&gt;Overview&lt;&#x2F;h3&gt;
&lt;p&gt;A dual nature token pair comprises of an ERC-20 contract and an ERC-721 contract.&lt;&#x2F;p&gt;
&lt;p&gt;For convention, the ERC-20 contract is designated as the base contract, and the ERC-721 contract is designated as the mirror contract.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;erc-20-extension-interface&quot;&gt;ERC-20 Extension Interface&lt;&#x2F;h3&gt;
&lt;p&gt;The ERC-20 contract MUST implement the following interface.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7631Base&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the address of the mirror ERC-721 contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This method MAY revert or return the zero address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; to denote that a mirror ERC-721 contract has not been linked.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If a non-zero address is returned, the returned address MUST&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; implement `IERC7631Mirror` and its `baseERC20()` method MUST&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; return the address of this contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Once a non-zero address has been returned, this method&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST NOT revert and the returned value MUST NOT change.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mirrorERC721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The ERC-20 contract MAY implement the following interface.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7631BaseNFTSkippable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Implementations SHOULD emit this event when the skip NFT status&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; of `owner` is updated to `status`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The purpose of this event is to signal to indexers that the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; skip NFT status has been &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; For simplicity of implementation,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; this event MAY be emitted even if the status is unchanged.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SkipNFTSet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; status&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns true if ERC-721 mints and transfers to `owner` SHOULD be&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; skipped during ERC-20 to ERC-721 synchronization.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Otherwise, returns false.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This method MAY revert&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; (e.g. contract not initialized, method not supported).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If this method reverts:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - Interacting code SHOULD interpret `setSkipNFT` functionality as&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   unavailable and hide any functionality to call `setSkipNFT`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - The skip NFT status for `owner` SHOULD be interpreted as undefined.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Once a true or false value has been returned for a given `owner`,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; this method MUST NOT revert for the given `owner`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getSkipNFT&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sets the caller&amp;#39;s skip NFT status.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This method MAY revert&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; (e.g. insufficient permissions, method not supported).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; It is RECOMMENDED to keep this method permissionless.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emits a {SkipNFTSet} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setSkipNFT&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; status&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;erc-721-extension-interface&quot;&gt;ERC-721 Extension Interface&lt;&#x2F;h3&gt;
&lt;p&gt;The ERC-721 contract MUST implement the following interface.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7631Mirror&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the address of the base ERC-20 contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This method MAY revert or return the zero address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; to denote that a base ERC-20 contract has not been linked.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If a non-zero address is returned, the returned address MUST&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; implement `IERC7631Base` and its `mirrorERC721()` method MUST&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; return the address of this contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Once a non-zero address has been returned, this method&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST NOT revert and the returned value MUST NOT change.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; baseERC20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;implementation-detection&quot;&gt;Implementation Detection&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;mirrorERC721&lt;&#x2F;code&gt; and &lt;code&gt;baseERC20&lt;&#x2F;code&gt; methods returning non-zero addresses signal that the ERC-20 and ERC-721 contracts implement the required interfaces respectively. As such, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; is not required.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;getSkipNFT&lt;&#x2F;code&gt; and &lt;code&gt;setSkipNFT&lt;&#x2F;code&gt; methods MAY revert. As contracts compiled with Solidity or Vyper inherently revert on calls to undefined methods, a typical &lt;code&gt;IERC7631Base&lt;&#x2F;code&gt; implementation lacking explicit &lt;code&gt;getSkipNFT&lt;&#x2F;code&gt; and &lt;code&gt;setSkipNFT&lt;&#x2F;code&gt; definitions still complies with &lt;code&gt;IERC7631BaseNFTSkippable&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;nft-skipping&quot;&gt;NFT Skipping&lt;&#x2F;h3&gt;
&lt;p&gt;The skip NFT methods allow accounts to avoid having ERC-721 tokens automatically minted to it whenever there is an ERC-20 transfer.&lt;&#x2F;p&gt;
&lt;p&gt;They are helpful in the following situations:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Loading vesting contracts with large amounts ERC-20 tokens to be vested to many users.&lt;&#x2F;li&gt;
&lt;li&gt;Loading candy machine contracts with large amounts of ERC-20 tokens to sell ERC-721 tokens to customers.&lt;&#x2F;li&gt;
&lt;li&gt;Transferring large amounts of ERC-20 tokens in &#x2F; out of a liquidity pool.&lt;&#x2F;li&gt;
&lt;li&gt;Transferring large amounts of ERC-20 tokens between admin accounts.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Including the skip NFT methods in the standard will:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Enable applications to conveniently display the option for users to skip NFTs.&lt;&#x2F;li&gt;
&lt;li&gt;Enable applications to transfer any amount of ERC-20 tokens without the O(n) gas costs associated with minting multiple ERC-721 tokens, which can surpass the block gas limit.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;These methods are recommended even on EVM chains with low gas costs, because bulk automatic ERC-721 transfers can still surpass the block gas limit.&lt;&#x2F;p&gt;
&lt;p&gt;A useful pattern is to make &lt;code&gt;getSkipNFT&lt;&#x2F;code&gt; return true by default if &lt;code&gt;owner&lt;&#x2F;code&gt; is a smart contract.&lt;&#x2F;p&gt;
&lt;p&gt;The choice of &lt;code&gt;getSkipNFT&lt;&#x2F;code&gt; returning a boolean value is for simplicity. If more complex behavior is needed, developers may add in extra methods of their own.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;implementation-conventions&quot;&gt;Implementation Conventions&lt;&#x2F;h3&gt;
&lt;p&gt;The ERC-20 contract is designated as the base contract for convention, as a typical implementation can conveniently derive ERC-721 balances from the ERC-20 balances. This does not prohibit one from implementing most of the logic in the ERC-721 contract if required.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal does not cover the token synchronization logic. This is to leave flexibility for various implementation patterns and novel use cases (e.g. automatically rebased tokens).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;linking-mechanism&quot;&gt;Linking Mechanism&lt;&#x2F;h3&gt;
&lt;p&gt;The linking process is omitted for flexibility purposes. Developers can use any desired mechanism (e.g. linking in constructor, initializer, or via custom admin-only public methods on the two contracts). The only restriction is that the pairing must be immutable once established (to simplify indexing logic).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;synchronization-access-guards&quot;&gt;Synchronization Access Guards&lt;&#x2F;h3&gt;
&lt;p&gt;External methods for synchronization logic must be guarded such that only the other contract is authorized to call them.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;rare-nft-sniping&quot;&gt;Rare NFT Sniping&lt;&#x2F;h3&gt;
&lt;p&gt;For dual nature collections that offer ERC-721 tokens with differing rarity levels, the ERC-721 metadata should be revealed in a way that is not easily gameable with metadata scraping and ERC-20 token transfers. A recommendation is to require that an ERC-721 token is held by the same account for some time before revealing its metadata.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;out-of-gas-denial-of-service&quot;&gt;Out-of-gas Denial of Service&lt;&#x2F;h3&gt;
&lt;p&gt;Transferring ERC-20 tokens can automatically initiate the minting, transferring, or burning of multiple ERC-721 tokens. This can incur O(n) gas costs instead of the typical O(1) gas costs for ERC-20 tokens transfers. Logic for selecting ERC-721 token IDs can also incur additional gas costs. Synchronization logic must consider ERC-721 related gas costs to prevent out-of-gas denial of service issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>ERC-721 Ownership Shares Extension</title>
        <published>2024-02-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Chen Liaoyuan</name><uri>https://github.com/chenly</uri><email>cly@kip.pro</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7628/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7628-erc-721-ownership-shares-extension/18744" />
        

        <id>https://wg-eips.ritovision.com/7628/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:7628"
            label="ERC-7628" />
        

        
        

        
        <summary type="html">Introduces ownership shares to ERC-721 tokens, allowing for queryable, transferable, and approvable fractional ownership.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7628/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal introduces an attribute of ownership and profit share quantities for each token under an NFT. This attribute signifies a stake in the ownership and profit rights associated with the NFT&#x27;s specific privileges, enabling the querying, transferring, and approval of these shares, thereby making the shares represented by each token applicable in a broader range of use cases.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;At times, when we wish to distribute dividends or assign rights to tokens of an NFT based on their share of ownership, it becomes necessary to equip each token with an attribute indicating the number of ownership shares. While &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; allows for the representation of ownership stakes through the balance of a token held by a wallet address, it sacrifices the uniqueness of each token. Conversely, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; maintains the uniqueness of each token but lacks an attribute to signify the share of ownership rights, and its metadata does not allow for the free transfer of these share quantities by the token owner. This extension seeks to merge the features of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;, enabling holders of each share to possess characteristics akin to those of a token owner, thus bridging the gap between share representation and token uniqueness.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;Implementers of this extension &lt;strong&gt;MUST&lt;&#x2F;strong&gt; have all of the following functions:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7628&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is IERC721 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the number of decimal places used for ownership shares.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; number of decimal places for ownership shares.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; shareDecimals&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the total sum of ownership shares in existence for all tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; total sum of ownership shares.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalShares&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the ownership share of the specified token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier of the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ownership share of the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; shareOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the share allowance granted to the specified spender by the owner for the specified token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier of the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the spender.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; share allowance granted to the spender.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; shareAllowance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Approves the specified address to spend a specified amount of shares on behalf of the caller.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier of the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the spender.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; shares&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of shares to approve.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approveShare&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; shares&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfers ownership shares from one token to another.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; fromTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier of the sender token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; toTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier of the recipient token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; shares&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of shares to transfer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferShares&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; fromTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; toTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; shares&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfers ownership shares from one token to another address (resulting in a new token or increased shares at the recipient address).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; fromTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier of the sender token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the recipient.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; shares&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of shares to transfer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferSharesToAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; fromTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; shares&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Adds a specified amount of shares to a token, only callable by the contract owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier of the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; shares&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of shares to add.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addSharesToToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; shares&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when ownership shares are transferred from one token to another.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; fromTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier of the sender token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; toTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier of the recipient token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of shares transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SharesTransfered&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; fromTokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; toTokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when an approval is granted for a spender to spend shares on behalf of an owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token identifier.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the spender.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of shares approved.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SharesApproved&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h4 id=&quot;share-issuance-to-a-token&quot;&gt;Share Issuance to a Token&lt;&#x2F;h4&gt;
&lt;p&gt;Issuing additional shares to a token allows for flexible management of ownership stakes in digital assets, catering to the evolving needs of stakeholders. It ensures transparency and security in modifying ownership structures directly on the blockchain, facilitating scenarios like profit sharing or investment adjustments.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;transferring-shares-to-an-address&quot;&gt;Transferring Shares to an Address&lt;&#x2F;h4&gt;
&lt;p&gt;Enabling shares to be transferred to an address enhances NFT liquidity and accessibility by allowing fractional ownership. This feature supports diverse use cases like fractional sales or collateralization, making NFTs more adaptable and inclusive for a broader audience.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is fully &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; compatible.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC721&#x2F;ERC721.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;access&#x2F;Ownable.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;security&#x2F;ReentrancyGuard.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC7628&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7628&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC721&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Ownable&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ReentrancyGuard&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _shareBalances&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _shareAllowances&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _totalShares&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _nextTokenId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; initialOwner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        ERC721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;&amp;quot;MyToken&amp;quot;, &amp;quot;MTK&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        Ownable&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;initialOwner)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addSharesToToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; shares&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC7628: tokenId cannot be zero&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _shareBalances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; shares&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _totalShares &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; shares&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SharesTransfered&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; shares&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; shareDecimals&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 18&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalShares&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _totalShares&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; shareOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _shareBalances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; shareAllowance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _shareAllowances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;spender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approveShare&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; shares&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;spender &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC7628: approval to current owner&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC7628: approve caller is not owner&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _shareAllowances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;spender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; shares&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SharesApproved&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; shares&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferShares&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; fromTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; toTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; shares&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; nonReentrant&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_shareBalances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;fromTokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; shares&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC7628: insufficient shares for transfer&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_isApprovedOrOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; fromTokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC7628: transfer caller is not owner nor approved&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _shareBalances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;fromTokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; shares&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _shareBalances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;toTokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; shares&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SharesTransfered&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;fromTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; toTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; shares&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferSharesToAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; fromTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; shares&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; nonReentrant&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_shareBalances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;fromTokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; shares&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC7628: insufficient shares for transfer&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_isApprovedOrOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; fromTokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC7628: transfer caller is not owner nor approved&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _nextTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _safeMint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _nextTokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _shareBalances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_nextTokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; shares&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SharesTransfered&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;fromTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _nextTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; shares&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Helper function to check if an address is the owner or approved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _isApprovedOrOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;spender &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getApproved&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; spender &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isApprovedForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h4 id=&quot;clear-approvals-on-transfer&quot;&gt;Clear Approvals on Transfer&lt;&#x2F;h4&gt;
&lt;p&gt;When transferring token ownership, it is crucial to clear all existing approvals. This precaution prevents previously authorized parties from retaining access after the token has changed hands.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;prevent-reentrancy&quot;&gt;Prevent Reentrancy&lt;&#x2F;h4&gt;
&lt;p&gt;Implementations must guard against reentrancy attacks. This involves ensuring that functions altering balances or ownership are secure against such vulnerabilities, particularly during share transfers.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;validate-ids-and-addresses&quot;&gt;Validate IDs and Addresses&lt;&#x2F;h4&gt;
&lt;p&gt;Verifying the legitimacy of token IDs and wallet addresses in all operations is essential. This step helps avoid errors and ensures that tokens and their associated shares are handled correctly.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;manage-shares-on-ownership-change&quot;&gt;Manage Shares on Ownership Change&lt;&#x2F;h4&gt;
&lt;p&gt;Proper management of share quantities is vital during a token ownership transfer. It&#x27;s important to ensure that shares are accurately accounted for and transferred alongside the token to maintain the integrity of ownership stakes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Secure Messaging Protocol</title>
        <published>2024-02-19T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Chen Liaoyuan</name><uri>https://github.com/chenly</uri><email>cly@kip.pro</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7627/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7627-secure-messaging-protocol/18761" />
        

        <id>https://wg-eips.ritovision.com/7627/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:7627"
            label="ERC-7627" />
        

        
        

        
        <summary type="html">End-to-end encryption for sending messages between users.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7627/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal implements the capability to securely exchange encrypted messages on-chain. Users can register their public keys and encryption algorithms by registration and subsequently send encrypted messages to other users using their addresses. The interface also includes enumerations for public key algorithms and a structure for user information to support various encryption algorithms and user information management.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;With the emergence of Layer 2 chains featuring sub-second block times and the introduction of account abstraction, the use of end-to-end encrypted communication has facilitated the proliferation of real-time communication and online chat dApps. Providing a unified interface enables easy integration of encrypted communication into smart contracts, thereby fostering innovation. Standardization promotes interoperability, facilitating seamless communication across platforms.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;objectives&quot;&gt;Objectives&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Provide a standardized interface for implementing messaging systems in smart contracts, including user registration and message sending functionalities.&lt;&#x2F;li&gt;
&lt;li&gt;Enhance flexibility and scalability for messaging systems by defining enumerations for public key algorithms and a structure for user information.&lt;&#x2F;li&gt;
&lt;li&gt;Define events for tracking message sending to enhance the observability and auditability of the contract.&lt;&#x2F;li&gt;
&lt;li&gt;Using a custom sessionId allows messages to be organized into a conversation.&lt;&#x2F;li&gt;
&lt;li&gt;Encrypt message content using the recipient&#x27;s public key during message transmission.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;interface&quot;&gt;Interface&lt;&#x2F;h3&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;Implementers of this standard &lt;strong&gt;MUST&lt;&#x2F;strong&gt; have all of the following functions:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7627&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PublicKeyAlgorithm&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt; ECDSA&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt; ED25519&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt; X25519&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PublicKey&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span&gt; public_key&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint64&lt;&#x2F;span&gt;&lt;span&gt; valid_before&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        PublicKeyAlgorithm algorithm&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Events&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Event emitted when a message is sent between users.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the sender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the recipient&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; keyIndex&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The index of the public key used to encrypt the message&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sessionId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The session ID for the communication&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; encryptedMessage&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The encrypted message in bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MessageSent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; keyIndex&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sessionId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; encryptedMessage&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Event emitted when a user&amp;#39;s public key is updated.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; user&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the user whose public key is updated&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; keyIndex&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The index of the public key being updated&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; newPublicKey&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The new public key data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PublicKeyUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; keyIndex&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;PublicKey&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newPublicKey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Functions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Updates the public key for the sender.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _keyIndex&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The index of the key to be updated&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _publicKey&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The new public key data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; updatePublicKey&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _keyIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; PublicKey&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _publicKey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sends an encrypted message to a specified address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The recipient&amp;#39;s address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _keyIndex&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The index of the public key used to encrypt the message&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _sessionId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The session ID for the communication&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _encryptedMessage&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The encrypted message in bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; sendMessage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _keyIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _sessionId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _encryptedMessage&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieves a public key for a specific user and key index.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _user&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the user&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _keyIndex&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The index of the key to retrieve&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; public key data associated with the user and key index&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getUserPublicKey&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _keyIndex&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;PublicKey&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;event-emission-for-off-chain-integration&quot;&gt;Event Emission for Off-Chain Integration&lt;&#x2F;h3&gt;
&lt;p&gt;By emitting events when messages are sent or public keys are updated, the implementation facilitates seamless integration with off-chain dApps. This enables these dApps to easily track and display the latest messages and updates, ensuring real-time responsiveness and enhancing user interaction.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;end-to-end-encryption-security&quot;&gt;End-to-End Encryption Security&lt;&#x2F;h3&gt;
&lt;p&gt;The design ensures that only the owner of an address can update their public key. This restriction preserves the integrity of the end-to-end encryption, making sure that only the intended recipient can decrypt and read the messages, thereby securing communication.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;session-id-for-conversation-organization&quot;&gt;Session ID for Conversation Organization&lt;&#x2F;h3&gt;
&lt;p&gt;The use of session IDs in message transactions allows multiple messages to be grouped under specific conversations. This feature is crucial for organizing and managing discussions within a dApp, providing users with a coherent and structured messaging experience.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC7627&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Enum to specify the algorithm used for the public key.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PublicKeyAlgorithm&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt; ECDSA&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt; ED25519&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt; X25519&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Structure to represent a user&amp;#39;s public key.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PublicKey&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span&gt; public_key&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint64&lt;&#x2F;span&gt;&lt;span&gt; valid_before&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        PublicKeyAlgorithm algorithm&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Mapping to store public keys for each address. The mapping is by user address and a unique key index.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; PublicKey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; pk&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MessageSent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; keyIndex&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sessionId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; encryptedMessage&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PublicKeyUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; keyIndex&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;PublicKey&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newPublicKey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; updatePublicKey&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _keyIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; PublicKey&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _publicKey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        pk&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_keyIndex&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; _publicKey&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PublicKeyUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _keyIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _publicKey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; sendMessage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _keyIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _sessionId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _encryptedMessage&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MessageSent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _keyIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _sessionId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _encryptedMessage&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getUserPublicKey&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _keyIndex&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;PublicKey&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; pk&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_user&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_keyIndex&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h4 id=&quot;utilization-of-latest-secure-encryption-algorithms&quot;&gt;Utilization of Latest Secure Encryption Algorithms&lt;&#x2F;h4&gt;
&lt;p&gt;When selecting encryption algorithms, it is essential to stay informed about the latest security news and recommendations. Avoid using asymmetric encryption algorithms with known vulnerabilities or those not recommended to ensure the confidentiality and integrity of messages. Regularly update encryption algorithms to address evolving security threats.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;strict-encryption-using-public-keys-for-message-content&quot;&gt;Strict Encryption Using Public Keys for Message Content&lt;&#x2F;h4&gt;
&lt;p&gt;To maintain message confidentiality, the content of sent messages must be strictly encrypted using the recipient&#x27;s public key. Any plaintext information transmitted could lead to information leakage and security risks. Encrypt message content at all times during transmission and storage to prevent unauthorized access to sensitive information.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;key-management-and-protection&quot;&gt;Key Management and Protection&lt;&#x2F;h4&gt;
&lt;p&gt;Robust key management and protection measures are necessary for both user public and private keys. Ensure secure storage and transmission of keys to prevent leakage and tampering. Employ multi-factor authentication and key rotation strategies to enhance key security and regularly assess key management processes to mitigate potential security risks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>ERC-20&#x2F;ERC-721 Unified Token Interface</title>
        <published>2024-02-18T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>0xZeus1111</name><uri>https://github.com/0xZeus1111</uri>
	</author>
	
	<author>
		<name>Nvuwa</name><uri>https://github.com/Nvuwa</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7629/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7629-unified-token/18793" />
        

        <id>https://wg-eips.ritovision.com/7629/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7629"
            label="ERC-7629" />
        

        
        

        
        <summary type="html">introduces a single interface for ERC-20&#x2F;ERC-721 tokens, enabling seamless interaction by defining common functions for both token types.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7629/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal introduces a protocol that establishes a unified interface for managing both &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; fungible tokens and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; non-fungible tokens (NFTs) on the Ethereum blockchain. By defining a common set of functions applicable to both token types, developers can seamlessly interact with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; tokens using a single interface. This simplifies integration efforts and enhances interoperability within decentralized applications (DApps).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The proposal aims to address the demand for assets combining the liquidity of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens and the uniqueness of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; tokens. Current standards present a fragmentation, requiring users to choose between these features. This proposal fills that gap by providing a unified token interface, enabling smooth transitions between &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; characteristics to accommodate diverse blockchain applications.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Introduces a token contract that combines features from both &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; standards.&lt;&#x2F;li&gt;
&lt;li&gt;Supports state transitions between &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; modes, facilitating seamless conversion and utilization of both liquidity and non-fungibility.&lt;&#x2F;li&gt;
&lt;li&gt;Defines essential functions and events to support token interactions, conversions, and queries.&lt;&#x2F;li&gt;
&lt;li&gt;Implements low gas consumption &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; mode to maintain efficiency comparable to typical &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; token transfers.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Compliant contracts MUST implement the following Solidity interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-7629 Unify Token Interface&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This interface defines the ERC-7629 Unify Token, which unifies ERC-721 and ERC-20 assets.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7629&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt;  is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC165&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-20 Transfer event&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC20Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-721 Transfer event&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-721 Transfer event&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Approval event for ERC-20 and ERC-721&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Approval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approved&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Approval event for ERC-20 and ERC-721&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Approval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approved&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Approval event for ERC-20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC20Approval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approved&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ApprovalForAll event for ERC-721&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ApprovalForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-20 to ERC-721 Conversion event&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC20ToERC721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-721 to ERC-20 Conversion event&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC20ToERC721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the name of the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the symbol of the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; symbol&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the number of decimals used in the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; decimals&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the total supply of the ERC-20 tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the balance of an address for ERC-20 tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to query the balance of.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the total supply of ERC-20 tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; erc20TotalSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the balance of an address for ERC-20 tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to query the balance of.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; erc20BalanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the total supply of ERC-721 tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; erc721TotalSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the balance of an address for ERC-721 tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to query the balance of.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; erc721BalanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the approved address for a single NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws if `tokenId` is not a valid NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT to find the approved address for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; approved address for this NFT, or the zero address if there is none&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getApproved&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Checks if an operator is approved for all tokens of a given owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the token owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the operator to check.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isApprovedForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the remaining number of tokens that spender will be allowed to spend on behalf of owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the token owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the spender.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; allowance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the array of ERC-721 token IDs owned by a specific address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to query the tokens of.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; owned&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the address that owns a specific ERC-721 token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; erc721Owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the URI for a specific ERC-721 token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Approve or disapprove the operator to spend or transfer all of the sender&amp;#39;s tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the spender.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amountOrId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of ERC-20 tokens or ID of ERC-721 tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amountOrId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Set or unset the approval of an operator for all tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the operator.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; approved&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The approval status.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setApprovalForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approved&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfer ERC-20 tokens or ERC-721 token from one address to another.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to transfer ERC-20 tokens or ERC-721 token from.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to transfer ERC-20 tokens or ERC-721 token to.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amountOrId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of ERC-20 tokens or ID of ERC-721 tokens to transfer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amountOrId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfers the ownership of an NFT from one address to another address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws unless `msg.sender` is the current owner, an authorized&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  operator, or the approved address for this NFT. Throws if `_rom` is&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  not the current owner. Throws if `_to` is the zero address. Throws if&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  `tokenId` is not a valid NFT. When transfer is complete, this function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  checks if `to` is a smart contract (code size &amp;gt; 0). If so, it calls&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  `onERC721Received` on `to` and throws if the return value is not&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  `bytes4(keccak256(&amp;quot;onERC721Received(address,address,uint256,bytes)&amp;quot;))`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The current owner of the NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The new owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT to transfer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Additional data with no specified format, sent in call to `to`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfers the ownership of an NFT from one address to another address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This works identically to the other function with an extra data parameter,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  except this function just sets data to &amp;quot;&amp;quot;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The current owner of the NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The new owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT to transfer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfer ERC-20 tokens to an address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to transfer ERC-20 tokens to.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of ERC-20 tokens to transfer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieves the unit value associated with the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; unit value.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getUnit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Converts ERC-721 token to ERC-20 tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The unique identifier of the ERC-721 token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; erc721ToERC20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Converts ERC-20 tokens to an ERC-721 token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of ERC-20 tokens to convert.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; erc20ToERC721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Common Interface for Different Token Types:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Introduces a unified interface to address the fragmentation caused by separate &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; standards.&lt;&#x2F;li&gt;
&lt;li&gt;Standardizes functions like transferFrom, mint, and burn, enabling developers to interact with both token types without implementing distinct logic.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Transfer Functionality:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Includes transferFrom function for seamless movement of tokens between addresses, as it&#x27;s a core component of both &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; standards.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Minting and Burning:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Incorporates mint and burn functions for creating and destroying tokens, essential for managing token supply and lifecycle.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Balance and Ownership Queries:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Provides functions like balanceOf and ownerOf for retrieving token balances and ownership information, crucial for both &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; tokens.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Compatibility and Extensibility:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Ensures compatibility with existing &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; implementations, minimizing disruption during transition.&lt;&#x2F;li&gt;
&lt;li&gt;Allows extension with additional functions and events for future enhancements.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Security Considerations:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Implements mechanisms to prevent common issues like reentrancy attacks and overflows, ensuring the security and robustness of the unified interface.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The proposed this proposal introduces a challenge in terms of backward compatibility due to the distinct balance query mechanisms utilized by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; standards. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; employs &lt;code&gt;balanceOf&lt;&#x2F;code&gt; to check an account&#x27;s token balance, while &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; uses &lt;code&gt;balanceOf&lt;&#x2F;code&gt; to inquire about the quantity of tokens owned by an account. To reconcile these differences, the ERC must consider providing either two separate functions catering to each standard or adopting a more generalized approach.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;compatibility-points&quot;&gt;Compatibility Points&lt;&#x2F;h3&gt;
&lt;p&gt;The primary compatibility point lies in the discrepancy between &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;&#x27;s balanceOf and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;&#x27;s balanceOf functionalities. Developers accustomed to the specific balance query methods in each standard may face challenges when transitioning to this proposal.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;proposed-solutions&quot;&gt;Proposed Solutions&lt;&#x2F;h3&gt;
&lt;p&gt;Dual Balance Query Functions:&lt;&#x2F;p&gt;
&lt;p&gt;Introduce two distinct functions, &lt;code&gt;erc20BalanceOf&lt;&#x2F;code&gt; and &lt;code&gt;erc721TotalSupply&lt;&#x2F;code&gt;, to align with the conventions of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;, respectively. Developers can choose the function based on the token type they are working with.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Due to the dual nature of this proposal, potential differences in protocol interpretation may arise, necessitating careful consideration during development.&lt;&#x2F;li&gt;
&lt;li&gt;Comprehensive security audits are recommended, especially during mode transitions by users, to ensure the safety of user assets.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Increase calldata cost</title>
        <published>2024-02-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Toni Wahrstätter</name><uri>https://github.com/nerolation</uri>
	</author>
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7623/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7623-increase-calldata-cost/18647" />
        

        <id>https://wg-eips.ritovision.com/7623/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:7623"
            label="EIP-7623" />
        

        
        

        
        <summary type="html">Increase calldata cost to reduce maximum block size</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7623/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The current calldata pricing permits EL payloads of up to 7.15 MB, while the average size is much smaller at around 100 KB.
This EIP proposes adjusting the calldata cost to reduce the maximum possible block size and its variance without negatively impacting regular users.
This is achieved by increasing calldata costs for transactions that predominantly post data.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The block gas limit has not been increased since &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt;, while the average size of blocks has continuously increased due to the growing number of rollups posting data to Ethereum. Moreover, calldata costs have remained unchanged since &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2028&#x2F;&quot;&gt;EIP-2028&lt;&#x2F;a&gt;.
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt; introduces blobs as a preferred method for data availability (DA).
This transition demands a reevaluation of calldata pricing, especially in order to address the disparity between average and maximum block sizes.
By introducing a floor cost dependent on the ratio of gas spent on EVM operations to calldata, this proposal aims to reduce the maximum block size to make room for additional blobs or potential block gas limit increases.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;STANDARD_TOKEN_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;4&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TOTAL_COST_FLOOR_PER_TOKEN&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;10&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Let &lt;code&gt;tokens_in_calldata = zero_bytes_in_calldata + nonzero_bytes_in_calldata * 4&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Let &lt;code&gt;isContractCreation&lt;&#x2F;code&gt; be a boolean indicating the respective event.&lt;&#x2F;p&gt;
&lt;p&gt;Let &lt;code&gt;execution_gas_used&lt;&#x2F;code&gt; be the gas used for EVM execution with the gas refund subtracted.&lt;&#x2F;p&gt;
&lt;p&gt;Let &lt;code&gt;INITCODE_WORD_COST&lt;&#x2F;code&gt; be 2 as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3860&#x2F;&quot;&gt;EIP-3860&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The current formula for determining the total gas used per transaction (&lt;code&gt;tx.gasUsed&lt;&#x2F;code&gt;) is equivalent to:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gasUsed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    21000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; STANDARD_TOKEN_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; tokens_in_calldata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    +&lt;&#x2F;span&gt;&lt;span&gt; execution_gas_used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    +&lt;&#x2F;span&gt;&lt;span&gt; isContractCreation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32000&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; INITCODE_WORD_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; words&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;calldata&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The formula for determining the gas used per transaction changes to:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gasUsed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    21000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    +&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        STANDARD_TOKEN_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; tokens_in_calldata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        +&lt;&#x2F;span&gt;&lt;span&gt; execution_gas_used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        +&lt;&#x2F;span&gt;&lt;span&gt; isContractCreation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32000&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; INITCODE_WORD_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; words&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;calldata&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        TOTAL_COST_FLOOR_PER_TOKEN&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; tokens_in_calldata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Any transaction with a gas limit below &lt;code&gt;21000 + TOTAL_COST_FLOOR_PER_TOKEN * tokens_in_calldata&lt;&#x2F;code&gt; or below its intrinsic gas cost (take the maximum of these two calculations) is considered invalid. This limitation exists because transactions must cover the floor price of their calldata without relying on the execution of the transaction. There are valid cases where &lt;code&gt;gasUsed&lt;&#x2F;code&gt; will be below this floor price, but the floor price needs to be reserved in the transaction gas limit.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The current maximum EL payload size is approximately 1.79 MB (&lt;code&gt;30_000_000&#x2F;16&lt;&#x2F;code&gt;). It is possible to create payloads filled with zero bytes that expand to 7.15 MB. However, since blocks are typically compressed with Snappy at the P2P layer, zero-byte-heavy EL payloads generally compress to under 1.79 MB. The implementation of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt; increased the maximum possible compressed block size to approximately 2.54 MB.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal aims to increase the cost of calldata to 10&#x2F;40 gas for transactions that do not exceed a certain threshold of gas spent on EVM operations relative to gas spent on calldata. This change will significantly reduce the maximum block size by limiting the size of data-heavy transactions that can fit into a single block. By increasing calldata costs from 4&#x2F;16 to 10&#x2F;40 gas per byte, for data-heavy transactions this EIP aims to reduce the possible EL payload size to approximately 0.72 MB (&lt;code&gt;30_000_000&#x2F;40&lt;&#x2F;code&gt;) without affecting the majority of users. Other adversarial block constructions can have a non-compressible EL payload size of approximately 1.26MiB.&lt;&#x2F;p&gt;
&lt;p&gt;Notably, regular users (e.g. sending ETH&#x2F;Tokens&#x2F;NFTs, engaging in DeFi, social media, restaking, bridging, etc.), who do not use calldata predominantly for DA, may remain unaffected.
The calldata cost for transactions involving significant EVM computation remains at 4&#x2F;16 gas per byte, so those transactions are unaffected.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This is a backwards incompatible gas repricing that requires a scheduled network upgrade.&lt;&#x2F;p&gt;
&lt;p&gt;Wallet developers and node operators MUST update gas estimation handling to accommodate the new calldata cost rules. Specifically:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Wallets&lt;&#x2F;strong&gt;: Wallets using &lt;code&gt;eth_estimateGas&lt;&#x2F;code&gt; MUST be updated to ensure that they correctly account for the &lt;code&gt;TOTAL_COST_FLOOR_PER_TOKEN&lt;&#x2F;code&gt; parameter. Failure to do so could result in underestimating gas, leading to failed transactions.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Node Software&lt;&#x2F;strong&gt;: RPC methods such as &lt;code&gt;eth_estimateGas&lt;&#x2F;code&gt; MUST incorporate the updated formula for gas calculation. Node developers MUST ensure compatibility with the updated calldata pricing logic.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Users can maintain their usual workflows without modification, as wallet and RPC updates will handle these changes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;As the maximum possible block size is reduced, no security concerns have been raised.&lt;&#x2F;p&gt;
&lt;p&gt;In some cases, it might seem advantageous to combine two transactions into one to reduce costs. For example, bundling a transaction that relies heavily on calldata but minimally on EVM resources with another that does the opposite. However, this is not a significant concern for several reasons:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;This type of bundling is already possible today. Merging multiple transactions can save the 21,000 gas cost for each additional transaction beyond the first, a feature explicitly supported in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Such bundling does not compromise the block size reduction objectives of this EIP.&lt;&#x2F;li&gt;
&lt;li&gt;In practice, transaction bundling is often impractical due to challenges such as trust and coordination requirements.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;These factors ensure that transaction bundling does not pose a significant issue.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>eth&#x2F;70 - Cease serving history before PoS</title>
        <published>2024-02-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>lightclient</name><uri>https://github.com/lightclient</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7639/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/cease-serving-history-before-pos/18991" />
        

        <id>https://wg-eips.ritovision.com/7639/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="networking"
                label="Networking" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:7639"
            label="EIP-7639" />
        

        
        

        
        <summary type="html">Execution layer clients will no longer serve block data before Paris over p2p.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7639/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Execution layer clients will no longer request or respond to p2p queries about
block data before the Paris upgrade.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;As of 2024, historical data in clients has grown to around 500 GB. Nearly 400 GB
of that is from block data before PoS was activated in the Paris upgrade. Long
term, Ethereum plans to bound the amount of data nodes must store. This EIP
proposes the first steps to achieve such goal.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Add a new &lt;code&gt;eth&lt;&#x2F;code&gt; protocol capability with version &lt;code&gt;70&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Clients connected on this version must not make or respond to p2p queries about
block bodies or receipts before block 15537393.&lt;&#x2F;p&gt;
&lt;p&gt;The affected protocol messages are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;GetBlockBodies (0x05)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;BlockBodies (0x06)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;GetReceipts (0x0f)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Receipts (0x10)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;only-pre-pos-data&quot;&gt;Only Pre-PoS data&lt;&#x2F;h3&gt;
&lt;p&gt;One might ask why the distinction between pre and post PoS data is made in this
EIP. The simple answer is that the at the moment of the merge, the block
structure changed substantially. Although execution layer client software today
continues on with block data on disk which remains similar to per-PoS data, the
beacon chain is now the canonical chain definition. Therefore, a beacon block
can be used to both record historical data for execution layer and beacon layer.&lt;&#x2F;p&gt;
&lt;p&gt;Over the long term, the distinctions of &quot;execution layer&quot; and &quot;consensus layer&quot;
may matter less. This EIP tries to be agnostic to client architecture and
instead focuses on the shape of the data.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;After this EIP is activated, nodes will no longer be able to full sync from the
devp2p network. To continue doing so, they must retrieve the data out-of-band.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;TODO&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EOF Contract Creation</title>
        <published>2024-02-12T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	<author>
		<name>Paweł Bylica</name><uri>https://github.com/chfast</uri>
	</author>
	
	<author>
		<name>Andrei Maiboroda</name><uri>https://github.com/gumb0</uri>
	</author>
	
	<author>
		<name>Piotr Dobaczewski</name><uri>https://github.com/pdobacz</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7620/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7620-eof-contract-creation-instructions/18625" />
        

        <id>https://wg-eips.ritovision.com/7620/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7620"
            label="EIP-7620" />
        

        
        

        
        <summary type="html">Introduce `EOFCREATE` and `RETURNCODE` instructions</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7620/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;EVM Object Format (EOF) removes the possibility to create contracts using &lt;code&gt;CREATE&lt;&#x2F;code&gt; or &lt;code&gt;CREATE2&lt;&#x2F;code&gt; instructions. We introduce a new&#x2F;replacement method in form of pair of instructions : &lt;code&gt;EOFCREATE&lt;&#x2F;code&gt; and &lt;code&gt;RETURNCODE&lt;&#x2F;code&gt; to provide a way to create contracts using EOF containers.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP uses terminology from the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3540&#x2F;&quot;&gt;EIP-3540&lt;&#x2F;a&gt; which introduces the EOF format.&lt;&#x2F;p&gt;
&lt;p&gt;EOF aims to remove code observability, which is a prerequisite to legacy EVM contract creation logic using legacy-style create transactions, &lt;code&gt;CREATE&lt;&#x2F;code&gt; or &lt;code&gt;CREATE2&lt;&#x2F;code&gt;, because both the initcode and code are available to the EVM and can be manipulated. On the same premise, EOF removes opcodes like &lt;code&gt;CODECOPY&lt;&#x2F;code&gt; and &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt;, introducing EOF subcontainers as a replacement to cater for factory contracts creating other contracts.&lt;&#x2F;p&gt;
&lt;p&gt;The new instructions introduced in this EIP operate on EOF containers enabling factory contract use case that legacy EVM has.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;Wherever not explicitly listed, the rules of EOF contract creation, as well as the &lt;code&gt;EOFCREATE&lt;&#x2F;code&gt; instruction, should be identical or analogous to those of &lt;code&gt;CREATE2&lt;&#x2F;code&gt; instruction. This includes but is not limited to:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;behavior on &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt; and address collision (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;684&#x2F;&quot;&gt;EIP-684&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;EVM execution frame created for the &lt;code&gt;EOFCREATE&lt;&#x2F;code&gt; initcode - memory, account context etc.&lt;&#x2F;li&gt;
&lt;li&gt;nonce bumping of the account of newly created contract &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;161&#x2F;&quot;&gt;EIP-161&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;balance checking and transfer for the creation endowment (&lt;code&gt;value&lt;&#x2F;code&gt; argument)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TX_CREATE_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Defined as &lt;code&gt;32000&lt;&#x2F;code&gt; in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;execution-specs&#x2F;blob&#x2F;0f9e4345b60d36c23fffaa69f70cf9cdb975f4ba&#x2F;src&#x2F;ethereum&#x2F;shanghai&#x2F;fork_types.py#L42&quot;&gt;Ethereum Execution Layer Specs&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;STACK_DEPTH_LIMIT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Defined as &lt;code&gt;1024&lt;&#x2F;code&gt; in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;execution-specs&#x2F;blob&#x2F;0f9e4345b60d36c23fffaa69f70cf9cdb975f4ba&#x2F;src&#x2F;ethereum&#x2F;shanghai&#x2F;vm&#x2F;interpreter.py#L60&quot;&gt;Ethereum Execution Layer Specs&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;GAS_CODE_DEPOSIT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Defined as &lt;code&gt;200&lt;&#x2F;code&gt; in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;execution-specs&#x2F;blob&#x2F;0f9e4345b60d36c23fffaa69f70cf9cdb975f4ba&#x2F;src&#x2F;ethereum&#x2F;shanghai&#x2F;vm&#x2F;gas.py#L44&quot;&gt;Ethereum Execution Layer Specs&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_CODE_SIZE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Defined as &lt;code&gt;24576&lt;&#x2F;code&gt; in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;170&#x2F;&quot;&gt;EIP-170&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;We introduce two new instructions on the same block number &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3540&#x2F;&quot;&gt;EIP-3540&lt;&#x2F;a&gt; is activated on:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;EOFCREATE&lt;&#x2F;code&gt; (&lt;code&gt;0xec&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RETURNCODE&lt;&#x2F;code&gt; (&lt;code&gt;0xee&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;If the code is legacy bytecode, any of these instructions result in an &lt;em&gt;exceptional halt&lt;&#x2F;em&gt;. (&lt;em&gt;Note: This means no change to behaviour.&lt;&#x2F;em&gt;)&lt;&#x2F;p&gt;
&lt;h3 id=&quot;execution-semantics&quot;&gt;Execution Semantics&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;The instructions &lt;code&gt;CREATE&lt;&#x2F;code&gt;, &lt;code&gt;CREATE2&lt;&#x2F;code&gt; are made obsolete and rejected by validation in EOF contracts. They are only available in legacy contracts.&lt;&#x2F;li&gt;
&lt;li&gt;If instructions &lt;code&gt;CREATE&lt;&#x2F;code&gt; and &lt;code&gt;CREATE2&lt;&#x2F;code&gt; have EOF code as initcode (starting with &lt;code&gt;EF00&lt;&#x2F;code&gt; magic)
&lt;ul&gt;
&lt;li&gt;deployment fails (returns 0 on the stack)&lt;&#x2F;li&gt;
&lt;li&gt;caller&#x27;s nonce is not updated and gas for initcode execution is not consumed&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In the context of legacy bytecode execution any of these instructions (&lt;code&gt;EOFCREATE&lt;&#x2F;code&gt;, &lt;code&gt;RETURNCODE&lt;&#x2F;code&gt;) result in an &lt;em&gt;exceptional halt&lt;&#x2F;em&gt;. (&lt;em&gt;Note: This means no change to behaviour.&lt;&#x2F;em&gt;)&lt;&#x2F;p&gt;
&lt;h4 id=&quot;overview-of-the-new-contract-creation-flow&quot;&gt;Overview of the new contract creation flow&lt;&#x2F;h4&gt;
&lt;p&gt;In EOF EVM, new bytecode is introduced to the state by means of &lt;code&gt;InitcodeTransaction&lt;&#x2F;code&gt; delivering an EOF container (&lt;code&gt;initcontainer&lt;&#x2F;code&gt;). Such a container may include arbitrarily deeply nesting subcontainers. The &lt;code&gt;initcontainer&lt;&#x2F;code&gt; and its subcontainers are recursively validated according to all the validation rules applicable for the EOF version in question. Next, the 0th code section of the &lt;code&gt;initcontainer&lt;&#x2F;code&gt; is executed and may eventually call a &lt;code&gt;RETURNCODE&lt;&#x2F;code&gt; instruction, which will refer to a subcontainer to be finally deployed to an address.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;InitcodeTransactions&lt;&#x2F;code&gt; are defined in detail in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7873&#x2F;&quot;&gt;EIP-7873&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;EOFCREATE&lt;&#x2F;code&gt; instruction is in turn a replacement of the &lt;code&gt;CREATE&lt;&#x2F;code&gt; and &lt;code&gt;CREATE2&lt;&#x2F;code&gt; legacy instructions allowing factory contracts to create other contracts. The main difference to the &lt;code&gt;InitcodeTransaction&lt;&#x2F;code&gt; is that the &lt;code&gt;initcontainer&lt;&#x2F;code&gt; is selected to be one of the subcontainers of the EOF container calling &lt;code&gt;EOFCREATE&lt;&#x2F;code&gt; (and not one of &lt;code&gt;transaction.initcodes&lt;&#x2F;code&gt;). It is worth noting that no validation is performed at this point, as it has already been done when the factory contract containing &lt;code&gt;EOFCREATE&lt;&#x2F;code&gt; was deployed.&lt;&#x2F;p&gt;
&lt;p&gt;Details on each instruction follow in the next sections.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;eofcreate&quot;&gt;&lt;code&gt;EOFCREATE&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;deduct &lt;code&gt;TX_CREATE_COST&lt;&#x2F;code&gt; gas&lt;&#x2F;li&gt;
&lt;li&gt;halt with exceptional failure if the current frame is in &lt;code&gt;static-mode&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;read immediate operand &lt;code&gt;initcontainer_index&lt;&#x2F;code&gt;, encoded as 8-bit unsigned value&lt;&#x2F;li&gt;
&lt;li&gt;pop &lt;code&gt;salt&lt;&#x2F;code&gt;, &lt;code&gt;input_offset&lt;&#x2F;code&gt;, &lt;code&gt;input_size&lt;&#x2F;code&gt;, &lt;code&gt;value&lt;&#x2F;code&gt; from the operand stack&lt;&#x2F;li&gt;
&lt;li&gt;perform (and charge for) memory expansion using &lt;code&gt;[input_offset, input_size]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;load initcode EOF subcontainer at &lt;code&gt;initcontainer_index&lt;&#x2F;code&gt; in the container from which &lt;code&gt;EOFCREATE&lt;&#x2F;code&gt; is executed
&lt;ul&gt;
&lt;li&gt;let &lt;code&gt;initcontainer&lt;&#x2F;code&gt; be that EOF container&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;check that current call depth is below &lt;code&gt;STACK_DEPTH_LIMIT&lt;&#x2F;code&gt; and that caller balance is enough to transfer &lt;code&gt;value&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;in case of failure return 0 on the stack, caller&#x27;s nonce is not updated and gas for initcode execution is not consumed.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;caller&#x27;s memory slice &lt;code&gt;[input_offset:input_size]&lt;&#x2F;code&gt; is used as calldata&lt;&#x2F;li&gt;
&lt;li&gt;execute the container and deduct gas for execution. The 63&#x2F;64th rule from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;150&#x2F;&quot;&gt;EIP-150&lt;&#x2F;a&gt; applies.&lt;&#x2F;li&gt;
&lt;li&gt;increment &lt;code&gt;sender&lt;&#x2F;code&gt; account&#x27;s nonce&lt;&#x2F;li&gt;
&lt;li&gt;calculate &lt;code&gt;new_address&lt;&#x2F;code&gt; as &lt;code&gt;keccak256(0xff || sender32 || salt)[12:]&lt;&#x2F;code&gt;, where &lt;code&gt;sender32&lt;&#x2F;code&gt; is the sender address left-padded to 32 bytes with zeros&lt;&#x2F;li&gt;
&lt;li&gt;an unsuccessful execution of initcode results in pushing &lt;code&gt;0&lt;&#x2F;code&gt; onto the stack
&lt;ul&gt;
&lt;li&gt;can populate returndata if execution &lt;code&gt;REVERT&lt;&#x2F;code&gt;ed&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;a successful execution ends with initcode executing &lt;code&gt;RETURNCODE{deploy_container_index}(aux_data_offset, aux_data_size)&lt;&#x2F;code&gt; instruction (see below). After that:
&lt;ul&gt;
&lt;li&gt;load deploy EOF subcontainer at &lt;code&gt;deploy_container_index&lt;&#x2F;code&gt; in the container from which &lt;code&gt;RETURNCODE&lt;&#x2F;code&gt; is executed&lt;&#x2F;li&gt;
&lt;li&gt;concatenate data section with &lt;code&gt;(aux_data_offset, aux_data_offset + aux_data_size)&lt;&#x2F;code&gt; memory segment and update data size in the header if needed.&lt;&#x2F;li&gt;
&lt;li&gt;if updated deploy container size exceeds &lt;code&gt;MAX_CODE_SIZE&lt;&#x2F;code&gt; instruction exceptionally aborts&lt;&#x2F;li&gt;
&lt;li&gt;set &lt;code&gt;state[new_address].code&lt;&#x2F;code&gt; to the updated deploy container&lt;&#x2F;li&gt;
&lt;li&gt;push &lt;code&gt;new_address&lt;&#x2F;code&gt; onto the stack&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;deduct &lt;code&gt;GAS_CODE_DEPOSIT * deployed_code_size&lt;&#x2F;code&gt; gas&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;returncode&quot;&gt;&lt;code&gt;RETURNCODE&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;read immediate operand &lt;code&gt;deploy_container_index&lt;&#x2F;code&gt;, encoded as 8-bit unsigned value&lt;&#x2F;li&gt;
&lt;li&gt;pop two values from the operand stack: &lt;code&gt;aux_data_offset&lt;&#x2F;code&gt;, &lt;code&gt;aux_data_size&lt;&#x2F;code&gt; referring to memory section that will be appended to deployed container&#x27;s data&lt;&#x2F;li&gt;
&lt;li&gt;cost 0 gas + possible memory expansion for aux data&lt;&#x2F;li&gt;
&lt;li&gt;ends initcode frame execution and returns control to EOFCREATE caller frame where &lt;code&gt;deploy_container_index&lt;&#x2F;code&gt; and &lt;code&gt;aux_data&lt;&#x2F;code&gt; are used to construct deployed contract (see above)&lt;&#x2F;li&gt;
&lt;li&gt;instruction exceptionally aborts if after the appending, data section size would overflow the maximum data section size or underflow (i.e. be less than data section size declared in the header)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;code-validation&quot;&gt;Code Validation&lt;&#x2F;h3&gt;
&lt;p&gt;We extend code section validation rules (as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3670&#x2F;&quot;&gt;EIP-3670&lt;&#x2F;a&gt;).&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;EOFCREATE&lt;&#x2F;code&gt; &lt;code&gt;initcontainer_index&lt;&#x2F;code&gt; must be less than &lt;code&gt;num_container_sections&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;EOFCREATE&lt;&#x2F;code&gt; the subcontainer pointed to by &lt;code&gt;initcontainer_index&lt;&#x2F;code&gt; must have its &lt;code&gt;len(data_section)&lt;&#x2F;code&gt; equal &lt;code&gt;data_size&lt;&#x2F;code&gt;, i.e. data section content is exactly as the size declared in the header (see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7620&#x2F;#data-section-lifecycle&quot;&gt;Data section lifecycle&lt;&#x2F;a&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;EOFCREATE&lt;&#x2F;code&gt; the subcontainer pointed to by &lt;code&gt;initcontainer_index&lt;&#x2F;code&gt; must not contain either a &lt;code&gt;RETURN&lt;&#x2F;code&gt; or &lt;code&gt;STOP&lt;&#x2F;code&gt; instruction&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RETURNCODE&lt;&#x2F;code&gt; &lt;code&gt;deploy_container_index&lt;&#x2F;code&gt; must be less than &lt;code&gt;num_container_sections&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RETURNCODE&lt;&#x2F;code&gt; the subcontainer pointed to &lt;code&gt;deploy_container_index&lt;&#x2F;code&gt; must not contain a &lt;code&gt;RETURNCODE&lt;&#x2F;code&gt; instruction&lt;&#x2F;li&gt;
&lt;li&gt;It is an error for a container to contain both &lt;code&gt;RETURNCODE&lt;&#x2F;code&gt; and either of &lt;code&gt;RETURN&lt;&#x2F;code&gt; or &lt;code&gt;STOP&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;It is an error for a subcontainer to never be referenced in its parent container&lt;&#x2F;li&gt;
&lt;li&gt;It is an error for a given subcontainer to be referenced by both &lt;code&gt;RETURNCODE&lt;&#x2F;code&gt; and &lt;code&gt;EOFCREATE&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RJUMP&lt;&#x2F;code&gt;, &lt;code&gt;RJUMPI&lt;&#x2F;code&gt; and &lt;code&gt;RJUMPV&lt;&#x2F;code&gt; immediate argument value (jump destination relative offset) validation: code section is invalid in case offset points to the byte directly following either &lt;code&gt;EOFCREATE&lt;&#x2F;code&gt; or &lt;code&gt;RETURNCODE&lt;&#x2F;code&gt; instruction.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;data-section-lifecycle&quot;&gt;Data Section Lifecycle&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;For an EOF container which has not yet been deployed&lt;&#x2F;strong&gt;, the &lt;code&gt;data_section&lt;&#x2F;code&gt; is only a portion of the final &lt;code&gt;data_section&lt;&#x2F;code&gt; after deployment.
Let&#x27;s define it as &lt;code&gt;pre_deploy_data_section&lt;&#x2F;code&gt; and as &lt;code&gt;pre_deploy_data_size&lt;&#x2F;code&gt; the &lt;code&gt;data_size&lt;&#x2F;code&gt; declared in that container&#x27;s header.
&lt;code&gt;pre_deploy_data_size &amp;gt;= len(pre_deploy_data_section)&lt;&#x2F;code&gt;, which anticipates more data to be appended to the &lt;code&gt;pre_deploy_data_section&lt;&#x2F;code&gt; during the process of deploying.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pre_deploy_data_section&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|                                      |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;\___________pre_deploy_data_size______&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;For a deployed EOF container&lt;&#x2F;strong&gt;, the final &lt;code&gt;data_section&lt;&#x2F;code&gt; becomes:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pre_deploy_data_section | static_aux_data | dynamic_aux_data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|                         |             |                  |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|                          \___________aux_data___________&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|                                       |                  |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;\___________pre_deploy_data_size______&#x2F;                    |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|                                                          |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;\________________________data_size_______________________&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;aux_data&lt;&#x2F;code&gt; is the data which is appended to &lt;code&gt;pre_deploy_data_section&lt;&#x2F;code&gt; on &lt;code&gt;RETURNCODE&lt;&#x2F;code&gt; instruction.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;static_aux_data&lt;&#x2F;code&gt; is a subrange of &lt;code&gt;aux_data&lt;&#x2F;code&gt;, which size is known before &lt;code&gt;RETURNCODE&lt;&#x2F;code&gt; and equals &lt;code&gt;pre_deploy_data_size - len(pre_deploy_data_section)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;dynamic_aux_data&lt;&#x2F;code&gt; is the remainder of &lt;code&gt;aux_data&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;code&gt;data_size&lt;&#x2F;code&gt; in the deployed container header is updated to be equal &lt;code&gt;len(data_section)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Summarizing, there are &lt;code&gt;pre_deploy_data_size&lt;&#x2F;code&gt; bytes in the final data section which are guaranteed to exist before the EOF container is deployed and &lt;code&gt;len(dynamic_aux_data)&lt;&#x2F;code&gt; bytes which are known to exist only after.
This impacts the validation and behavior of data-section-accessing instructions: &lt;code&gt;DATALOAD&lt;&#x2F;code&gt;, &lt;code&gt;DATALOADN&lt;&#x2F;code&gt;, and &lt;code&gt;DATACOPY&lt;&#x2F;code&gt;, see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7480&#x2F;&quot;&gt;EIP-7480&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;data-section-appending&quot;&gt;Data section appending&lt;&#x2F;h3&gt;
&lt;p&gt;The data section is appended to during contract creation and also its size needs to be updated in the header. Alternative designs were considered, where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;additional section kinds for the data were introduced&lt;&#x2F;li&gt;
&lt;li&gt;additional fields describing a subcontainer were introduced&lt;&#x2F;li&gt;
&lt;li&gt;data section would be written over as opposed to being appended to, requiring it to be filled with 0 bytes prior to deployment&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;All of these alternatives either complicated the otherwise simple data structures or took away useful features (like the dynamically sized portion of the data section).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;keccak256-initcontainer-in-the-new-address-hashing-scheme&quot;&gt;&lt;code&gt;keccak256(initcontainer)&lt;&#x2F;code&gt; in the &lt;code&gt;new_address&lt;&#x2F;code&gt; hashing scheme&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;new_address = keccak256(0xff || sender || salt || keccak256(initcontainer))[12:]&lt;&#x2F;code&gt; was originally proposed as the way to calculate the address of newly created contract, similar, but not exactly equal, to what &lt;code&gt;CREATE2&lt;&#x2F;code&gt; uses.&lt;&#x2F;p&gt;
&lt;p&gt;This alternative however goes against code non-observability, because it locks in the contents of the initcontainer e.g. preventing re-writing it in some future upgrade. It also seems unnecessarily expensive: &lt;code&gt;EOFCREATE&lt;&#x2F;code&gt; can only pick up one of its subcontainers, yet the hash value would need to be recalculated on every execution of &lt;code&gt;EOFCREATE&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Other ways of removing code observability, yet keeping some form of witness of the code, were considered. However, keeping only &lt;code&gt;sender&lt;&#x2F;code&gt; and &lt;code&gt;salt&lt;&#x2F;code&gt; allows the implementer of the factory contract (i.e. one containing the &lt;code&gt;EOFCREATE&lt;&#x2F;code&gt; instruction) to include the code witness via the &lt;code&gt;salt&lt;&#x2F;code&gt; anyway, if that&#x27;s necessary for the particular use case. Therefore, keeping the &lt;code&gt;new_address&lt;&#x2F;code&gt; formula minimal is the most flexible approach with better separation of concerns.&lt;&#x2F;p&gt;
&lt;p&gt;Leaving the &lt;code&gt;keccak256(initcontainer)&lt;&#x2F;code&gt; out of the &lt;code&gt;new_address&lt;&#x2F;code&gt; hash has also the benefit of making the &lt;code&gt;new_address&lt;&#x2F;code&gt; independent of the metadata section (proposed for the EOF in a separate EIP), which is a desired property. Unfortunately, if a factory wants to opt into committing to a particular &lt;code&gt;initcontainer&lt;&#x2F;code&gt;, it needs to include it in the &lt;code&gt;salt&lt;&#x2F;code&gt;, and that will include the metadata section.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;eofcreate-stack-argument-order&quot;&gt;&lt;code&gt;EOFCREATE&lt;&#x2F;code&gt; stack argument order&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;EXT*CALL&lt;&#x2F;code&gt; instructions from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7069&#x2F;&quot;&gt;EIP-7069&lt;&#x2F;a&gt; have had their stack argument order changed, as compared to that of legacy instructions &lt;code&gt;*CALL&lt;&#x2F;code&gt;. We follow the same change to have &lt;code&gt;EOFCREATE&lt;&#x2F;code&gt; stack arg order match those of &lt;code&gt;EXTCALL&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change poses no risk to backwards compatibility, as it is introduced at the same time EIP-3540 is. The new instructions are not introduced for legacy bytecode (code which is not EOF formatted), and the contract creation options do not change for legacy bytecode.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;CREATE&lt;&#x2F;code&gt; and &lt;code&gt;CREATE2&lt;&#x2F;code&gt; calls with &lt;code&gt;EF00&lt;&#x2F;code&gt; initcode fail early without executing the initcode. Previously, in both cases the initcode execution would begin and fail on the first undefined instruction &lt;code&gt;EF&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Creation transaction, &lt;code&gt;CREATE&lt;&#x2F;code&gt; and &lt;code&gt;CREATE2&lt;&#x2F;code&gt; cannot have its &lt;em&gt;code&lt;&#x2F;em&gt; starting with &lt;code&gt;0xEF&lt;&#x2F;code&gt;, but such cases are covered already in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3541&#x2F;&quot;&gt;EIP-3541&lt;&#x2F;a&gt;. However, new cases must be added where &lt;code&gt;CREATE&lt;&#x2F;code&gt; or &lt;code&gt;CREATE2&lt;&#x2F;code&gt; have its &lt;em&gt;initcode&lt;&#x2F;em&gt; being (validly or invalidly) EOF formatted:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Initcode&lt;&#x2F;th&gt;&lt;th&gt;Expected result&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xEF&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;initcode starts execution and fails&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xEF01&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;initcode starts execution and fails&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xEF5f&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;initcode starts execution and fails&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xEF00&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;CREATE&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;CREATE2&lt;&#x2F;code&gt; fails early, returns 0 and keeps sender nonce intact&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xEF0001&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;as above&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;valid EOFv1 container&lt;&#x2F;td&gt;&lt;td&gt;as above&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;It is the EOF &lt;code&gt;InitcodeTransaction&lt;&#x2F;code&gt; (specified in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7873&#x2F;&quot;&gt;EIP-7873&lt;&#x2F;a&gt;) which needs a detailed review and discussion as that is where external unverified code enters the state. Among others:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Is its complexity under control, ruling out any DoS attempts&lt;&#x2F;li&gt;
&lt;li&gt;Is it correctly priced and always charged for&lt;&#x2F;li&gt;
&lt;li&gt;Is the validation comprehensive and not allowing problematic code to be saved into the state&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Basket Token</title>
        <published>2024-02-11T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Dominic Ryder</name><email>dom@alvaraprotocol.io</email>
	</author>
	
	<author>
		<name>Callum Mitchell-Clark</name><uri>https://github.com/AlvaraProtocol</uri><email>callum@alvaraprotocol.io</email>
	</author>
	
	<author>
		<name>Joey van Etten</name><email>joe@alvaraprotocol.io</email>
	</author>
	
	<author>
		<name>Michael Ryder</name><email>mike@alvaraprotocol.io</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7621/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/proposal-for-a-new-eip-erc-the-erc-bts-basket-token-standard/18598" />
        

        <id>https://wg-eips.ritovision.com/7621/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:7621"
            label="ERC-7621" />
        

        
        

        
        <summary type="html">Collateralized, tokenized funds with adjustable weights and reserves and minting&#x2F;burning of LP tokens.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7621/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The Basket Token Standard (BTS) allows for the implementation of multi-asset tokenized funds. This standard provides basic functionality for anyone to deploy unique, non-fungible BTS tokens that can contain an unlimited number of underlying &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens.&lt;&#x2F;p&gt;
&lt;p&gt;The deployer receives a BTS token representative of their ownership of the fund, as well as liquidity provider (LP) tokens representative of their percentage share of the fund (100% at time of deployment but changing as other wallets contribute&#x2F;withdraw). Whenever a contribution is made to a BTS, BTS LP tokens are minted and distributed to the contributor’s wallet (representative of their share of the fund); when a withdrawal is made from a BTS, the BTS LP tokens are burned and funds returned to the withdrawer’s wallet.&lt;&#x2F;p&gt;
&lt;p&gt;The BTS has a rebalance function which allows for a BTS owner to change the percentage share of the fund that each underlying token makes up. Tokens can be removed entirely or added through this function after a BTS has already been minted.&lt;&#x2F;p&gt;
&lt;p&gt;By leveraging the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; standard as a representative token of ownership when minting the BTS, the tokenized fund can also be fully manageable and transferable on-chain.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The motivation is to provide infrastructure that will enable the on-chain creation and management of asset-backed tokenized investment funds as no such standardized infrastructure curently exists. Providing the necessary infrastructure will help facilitate the onboarding of traditional fund management onto blockchain. No existing standard is capable of achieving this as they lack the required features for third party contribution, namely the minting of LP tokens when contribution is made. The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7621&#x2F;&quot;&gt;ERC-7621&lt;&#x2F;a&gt; is the only token standard that facilitates this with a rebalance function required for effective fund management, and LP token distribution and burning, required for third party participation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;bts&quot;&gt;BTS&lt;&#x2F;h3&gt;
&lt;p&gt;BTS is a smart contract enabling the creation of on-chain tokenized funds backed by assets, allowing users to manage assets and liquidity through functions like initialization, contribution, withdrawal, rebalancing, and token distribution.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;purpose&quot;&gt;Purpose&lt;&#x2F;h4&gt;
&lt;p&gt;The purpose of the BTS is to allow anyone to build an on-chain tokenized fund that is fully asset backed using on-chain liquidity.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;key-functions&quot;&gt;Key Functions&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;initialize&lt;&#x2F;code&gt;: Initializes a new BTS with name, symbol, creator, tokens, weights, token URI, and optional auto-rebalance setting.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;contribute()&lt;&#x2F;code&gt;: Allows users to add ETH to the basket, purchasing proportional amounts of included tokens based on predefined weights.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;withdraw(uint256 _liquidity)&lt;&#x2F;code&gt;: Allows BTS LP holders to withdraw from the basket, receiving corresponding tokens.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;withdrawETH(uint256 _liquidity)&lt;&#x2F;code&gt;: Allows BTS LP holders to withdraw ETH from the basket, equivalent to the value of their BTS LP tokens.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;rebalance(address[] memory _newTokens, uint256[] memory _newWeights)&lt;&#x2F;code&gt;: The owner can manually adjust the types and weights of tokens in the basket.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;getTokenDetails&lt;&#x2F;code&gt;: Returns details of a token at a given index (address and weight).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;totalTokens&lt;&#x2F;code&gt;: Returns the total number of tokens in the basket.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;distribution-of-bts-tokens&quot;&gt;Distribution of BTS tokens&lt;&#x2F;h4&gt;
&lt;p&gt;The distribution of BTS tokens occurs during the mint function. The creator sends ETH to the contract, and the contract then swaps the ETH for user designated &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens based on predefined weights. After the swaps, it mints a BTS token (NFT) for the sender using the initialize function of the BTS contract as well as BTS LP tokens. This BTS token is a representation of ownership and allows management of the BTS.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;distribution-of-bts-lp-tokens&quot;&gt;Distribution of BTS LP tokens&lt;&#x2F;h4&gt;
&lt;p&gt;The distribution of BTS LP tokens occurs during the mint and contribute functions. After swapping ETH for the relevant &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens, the contract mints BTS LP tokens (representing the user&#x27;s share of the total BTS), and then mints BTS LP tokens using the mint function of the &lt;code&gt;BTSPair&lt;&#x2F;code&gt; contract. The BTS LP tokens represent the liquidity provided by the user to the specified BTS pair (&lt;code&gt;btsPair&lt;&#x2F;code&gt;). The distribution is logged through the &lt;code&gt;ContributedToBTS&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;burning-the-bts-lp-tokens&quot;&gt;Burning the BTS LP tokens&lt;&#x2F;h4&gt;
&lt;p&gt;The burning of BTS LP tokens occurs during the &lt;code&gt;withdraw&lt;&#x2F;code&gt; function. Users can call this function, specifying the amount of BTS LP tokens they want to withdraw. The contract then transfers the specified amount of BTS LP tokens from the user to the BTS pair contract (&lt;code&gt;btsPair&lt;&#x2F;code&gt;). The burn function of the &lt;code&gt;IBTSPair&lt;&#x2F;code&gt; contract is called, which decreases the user&#x27;s BTS LP token balance and returns an array of amounts representing the underlying tokens withdrawn. This array of amounts is logged through the &lt;code&gt;WithdrawnFromBTS&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;events&quot;&gt;Events&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;ContributedToBTS(address indexed bts, uint256 amount)&lt;&#x2F;code&gt;: Event when someone adds ETH to the basket.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;WithdrawnFromBTS(address indexed bts, uint256[] amounts)&lt;&#x2F;code&gt;: Event when BTS LP holder withdraws tokens from the basket.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;WithdrawnETHFromBTS(address indexed bts, uint256 amount)&lt;&#x2F;code&gt;: Event when BTS LP holder withdraws ETH from the basket.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;RebalanceBTS(address indexed bts, uint256[] oldWeights, uint256[] newWeights)&lt;&#x2F;code&gt;: Event when the owner manually rebalances the basket.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;btspair&quot;&gt;&lt;code&gt;BTSPair&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;purpose-1&quot;&gt;Purpose&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; token representing liquidity in a BTS.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;key-functions-1&quot;&gt;Key Functions&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;initialize&lt;&#x2F;code&gt;: Initializes a new &lt;code&gt;BTSPair&lt;&#x2F;code&gt; with a name and tokens.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;rebalance()&lt;&#x2F;code&gt;: Allows the owner to manually adjust the types and weights of tokens in the pair.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;updateTokens(...)&lt;&#x2F;code&gt;: Allows the owner to change the types of tokens in the pair.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;mint(...)&lt;&#x2F;code&gt;: Creates new BTS LP tokens and adjusts token reserves.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;burn(...)&lt;&#x2F;code&gt;: Destroys BTS LP tokens and adjusts token reserves.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;!-- TODO --&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;BTS&lt;&#x2F;code&gt;: Implemented using a combination of OpenZeppelin&#x27;s &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; &lt;code&gt;URIStorage&lt;&#x2F;code&gt; and &lt;code&gt;Ownable&lt;&#x2F;code&gt; contracts, along with custom logic for token management and rebalancing.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;Factory&lt;&#x2F;code&gt;: Implemented using &lt;code&gt;ClonesUpgradeable&lt;&#x2F;code&gt; to deploy new &lt;code&gt;BTS&lt;&#x2F;code&gt; and &lt;code&gt;BTSPair&lt;&#x2F;code&gt; contracts.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;BTSPair&lt;&#x2F;code&gt;: Implemented using &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; &lt;code&gt;Upgradeable&lt;&#x2F;code&gt; and &lt;code&gt;Ownable&lt;&#x2F;code&gt; contracts, along with custom logic for liquidity tracking and rebalancing.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;IUniswap&lt;&#x2F;code&gt;: Not implemented, as it only defines interfaces for external contracts.&lt;&#x2F;p&gt;
&lt;!-- TODO: Remove this section or actually add the code (here or in your assets directory.) --&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;!-- TODO --&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Chunk support for ERC-5219 mode in Web3 URL</title>
        <published>2024-02-08T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Qi Zhou</name><uri>https://github.com/qizhou</uri>
	</author>
	
	<author>
		<name>Nicolas Deschildre</name><uri>https://github.com/nand2</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7617/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-5219-resolve-mode/14088" />
        

        <id>https://wg-eips.ritovision.com/7617/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7617"
            label="ERC-7617" />
        

        
        

        
        <summary type="html">In ERC-5219 resolve mode, add ability to fetch a Web3 URL resource made of several chunks</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7617/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;In the context of the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6860&#x2F;&quot;&gt;ERC-6860&lt;&#x2F;a&gt; &lt;code&gt;web3:&#x2F;&#x2F;&lt;&#x2F;code&gt; standard, this ERC extends the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6944&#x2F;&quot;&gt;ERC-6944&lt;&#x2F;a&gt; resolve mode: This standard defines a new optional &lt;code&gt;web3-next-chunk&lt;&#x2F;code&gt; HTTP header returned by the &lt;code&gt;request()&lt;&#x2F;code&gt; call, that contains a &lt;code&gt;web3:&#x2F;&#x2F;&lt;&#x2F;code&gt; URL pointing to the next data chunk of the resource data. Chunks are streamed to the &lt;code&gt;web3:&#x2F;&#x2F;&lt;&#x2F;code&gt; client, and it loops until the &lt;code&gt;web3-next-chunk&lt;&#x2F;code&gt; header is no longer present.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Ethereum RPC endpoints have a gas limit, which can be reached when serving large content. By adding a chunking feature, we add the possibility to serve arbitrary sized content.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;In the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6944&#x2F;&quot;&gt;ERC-6944&lt;&#x2F;a&gt; resolve mode, this standard introduces the new optional &lt;code&gt;web3-next-chunk&lt;&#x2F;code&gt; HTTP header, to be returned in the &lt;code&gt;headers&lt;&#x2F;code&gt; &lt;code&gt;KeyValue&lt;&#x2F;code&gt; array of the &lt;code&gt;request()&lt;&#x2F;code&gt; method defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6944&#x2F;&quot;&gt;ERC-6944&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The value of the header is either a complete &lt;code&gt;web3:&#x2F;&#x2F;&lt;&#x2F;code&gt; URL, or a relative one. The target smart contract must use the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6944&#x2F;&quot;&gt;ERC-6944&lt;&#x2F;a&gt; resolve mode.&lt;&#x2F;p&gt;
&lt;p&gt;When processing the result of the initial &lt;code&gt;request()&lt;&#x2F;code&gt; call, the protocol return the HTTP status code, HTTP headers and body right away to the &lt;code&gt;web3:&#x2F;&#x2F;&lt;&#x2F;code&gt; client. If a &lt;code&gt;web3-next-chunk&lt;&#x2F;code&gt; header is present, it parse the URL. If the URL is invalid, or the target smart contract is not using the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6944&#x2F;&quot;&gt;ERC-6944&lt;&#x2F;a&gt; resolve mode, the HTTP data streaming is ended with an error. Otherwise it call the &lt;code&gt;request()&lt;&#x2F;code&gt; method, ignore the returned &lt;code&gt;statusCode&lt;&#x2F;code&gt;, send the &lt;code&gt;body&lt;&#x2F;code&gt; data as the next chunk of data, and if a &lt;code&gt;web3-next-chunk&lt;&#x2F;code&gt; header is again present, loops until no more are present.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The use of a header pointing to the next chunk was chosen because it does not require changes to the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6944&#x2F;&quot;&gt;ERC-6944&lt;&#x2F;a&gt; &lt;code&gt;request()&lt;&#x2F;code&gt; interface, and the use of a &lt;code&gt;web3:&#x2F;&#x2F;&lt;&#x2F;code&gt; URL in the header add flexibility to the means to provide the next chunk.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;No security considerations were found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Content encoding in ERC-5219 mode Web3 URL</title>
        <published>2024-02-08T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Qi Zhou</name><uri>https://github.com/qizhou</uri>
	</author>
	
	<author>
		<name>Nicolas Deschildre</name><uri>https://github.com/nand2</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7618/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-5219-resolve-mode/14088" />
        

        <id>https://wg-eips.ritovision.com/7618/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:7618"
            label="ERC-7618" />
        

        
        

        
        <summary type="html">In ERC-5219 resolve mode, add ability to decode a compressed resource before serving it to the client</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7618/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;In the context of the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6860&#x2F;&quot;&gt;ERC-6860&lt;&#x2F;a&gt; &lt;code&gt;web3:&#x2F;&#x2F;&lt;&#x2F;code&gt; standard, this ERC extends the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6944&#x2F;&quot;&gt;ERC-6944&lt;&#x2F;a&gt; resolve mode: This standard specifies that if a &lt;code&gt;Content-Encoding&lt;&#x2F;code&gt; header is returned by the &lt;code&gt;request()&lt;&#x2F;code&gt; call, then the returned data is decoded if necessary according to the specified algorithm before being returned to the client.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;As storage in blockchains is expensive, it is optimal to try to store and serve compressed assets. Standard HTTP uses the &lt;code&gt;Accept-Encoding&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;Content-Encoding&lt;&#x2F;code&gt; mechanism, in which the client specifies their supported compression algorithms, and the server returns the data compressed in one of them. It is not optimal to replicate this mechanism in the &lt;code&gt;web3:&#x2F;&#x2F;&lt;&#x2F;code&gt; protocol, due to blockchain storage and computation constraints. Moreover, it is not possible to blindly serve content with a fixed &lt;code&gt;Content-Encoding&lt;&#x2F;code&gt; header, because the HTTP client may not implement the compression algorithm.&lt;&#x2F;p&gt;
&lt;p&gt;By specifying a list of supported compression algorithms, optionally doing the decompression at the protocol side and serving the data to the client, we can safely store compressed data and serve it.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;In the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6944&#x2F;&quot;&gt;ERC-6944&lt;&#x2F;a&gt; resolve mode, this standard indicates that if a &lt;code&gt;Content-Encoding&lt;&#x2F;code&gt; HTTP header (in the returned &lt;code&gt;headers&lt;&#x2F;code&gt; &lt;code&gt;KeyValue&lt;&#x2F;code&gt; array of the &lt;code&gt;request()&lt;&#x2F;code&gt; method) is provided, and if it is not part of the supported algorithms provided by the client in the &lt;code&gt;Accept-Encoding&lt;&#x2F;code&gt; header, or the client did not provide an &lt;code&gt;Accept-Encoding&lt;&#x2F;code&gt; header, then the protocol MUST decode the content before forwarding it to the &lt;code&gt;web3:&#x2F;&#x2F;&lt;&#x2F;code&gt; client.&lt;&#x2F;p&gt;
&lt;p&gt;The protocol MUST support the following content encodings: &lt;code&gt;gzip&lt;&#x2F;code&gt;, &lt;code&gt;br&lt;&#x2F;code&gt; (brotli). If the protocol is to decode the content, and if the advertized &lt;code&gt;Content-encoding&lt;&#x2F;code&gt; is not part of this list, an error indicating an unsupported content encoding MUST be sent to the client. Once decoded, the decompressed data is sent to the client. The &lt;code&gt;Content-Encoding&lt;&#x2F;code&gt; header MUST NOT be forwarded to the client when the protocol decodes the content.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;We add this feature to the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6944&#x2F;&quot;&gt;ERC-6944&lt;&#x2F;a&gt; resolve mode because it can be added without changes the interface.
To stay as close as possible to standard HTTP, we don&#x27;t introduce a new HTTP header but reuse the known &lt;code&gt;Content-Encoding&lt;&#x2F;code&gt; header.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;No security considerations were found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Interfaces for Named Token</title>
        <published>2024-02-08T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Zainan Victor Zhou</name><uri>https://github.com/xinbenlv</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7632/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-tbd-named-nfts-extending-erc-721/18550" />
        

        <id>https://wg-eips.ritovision.com/7632/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:7632"
            label="ERC-7632" />
        

        
        

        
        <summary type="html">Enable tokens to have a string name and be able to convert between name and id.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7632/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Extends tokens using &lt;code&gt;uint256 tokenId&lt;&#x2F;code&gt; to support &lt;code&gt;tokenName&lt;&#x2F;code&gt; in type &lt;code&gt;string&lt;&#x2F;code&gt; and be able to convert backward to &lt;code&gt;tokenId&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;For Marketplaces, Explorers, Wallets, DeFi and dApps to better display and operate NFTs that comes with a name.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Compliant contracts MUST support &lt;code&gt;tokenName&lt;&#x2F;code&gt; and
mapping between &lt;code&gt;tokenName&lt;&#x2F;code&gt; and &lt;code&gt;tokenId&lt;&#x2F;code&gt; in one of the following ways:&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;ul&gt;
&lt;li&gt;1a all compliant contracts are RECOMMENDED to implement the following
interfaces: &lt;code&gt;IERC_NamedTokenCore&lt;&#x2F;code&gt;,&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC_NamedTokenCore&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; idToName&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; nameToId&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenName&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;and it should satisfy the behavior rules that:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;1a.1. when a new name is instroduced, it is RECOMMENDED to emit an event &lt;code&gt;newName(uint256 indexed tokenId, string tokenName)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;1a.2. tokenId and tokenName MUST be two-way single mapping, meaning if tokenId exists, tokenName MUST exist and vice versa and
&lt;code&gt;tokenId = nameToId(idToName(tokenId))&lt;&#x2F;code&gt; and
&lt;code&gt;tokenName = idToName(nameToId(tokenName))&lt;&#x2F;code&gt; MUST hold true.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;ul&gt;
&lt;li&gt;1b. if the compliant doesn&#x27;t implement &lt;code&gt;IERC_NamedTokenCore&lt;&#x2F;code&gt;,
it MAY follow the default mapping rule between &lt;code&gt;tokenId&lt;&#x2F;code&gt; and &lt;code&gt;tokenName&lt;&#x2F;code&gt;
&lt;code&gt;uint256 tokenId = uint256(keccak256(tokenName))&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;ol start=&quot;2&quot;&gt;
&lt;li&gt;
&lt;p&gt;All method involving &lt;code&gt;tokenId&lt;&#x2F;code&gt; for a compliant contract is RECOMMENDED to
have a counterpart method end with &lt;code&gt;ByName&lt;&#x2F;code&gt; that substitute all
pamameters of &lt;code&gt;uint256 tokenId&lt;&#x2F;code&gt; with &lt;code&gt;string memory tokenName&lt;&#x2F;code&gt;,
and the behavior of the counterpart method MUST be consistent
with the original method.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Compliant contract MAY implement one or more of following extra interface&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC_NamedTokenExtension&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isValidTokenName&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenName&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; normalizeTokenName&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenName&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;We allow default way to map &lt;code&gt;tokenId&lt;&#x2F;code&gt; and &lt;code&gt;tokenName&lt;&#x2F;code&gt; for convenience, but
we also allow contract to implement their own way to map &lt;code&gt;tokenId&lt;&#x2F;code&gt; and
&lt;code&gt;tokenName&lt;&#x2F;code&gt; for flexibility.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;We consider providing an interface for&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal is fully backwards compatible with token contracts using
&lt;code&gt;uint256 tokenId&lt;&#x2F;code&gt; as the unique identifier.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal assume that both &lt;code&gt;tokenName&lt;&#x2F;code&gt; and &lt;code&gt;tokenId&lt;&#x2F;code&gt; are
unique amongst all tokens.&lt;&#x2F;p&gt;
&lt;p&gt;If tokenNames are not normalize, two distinct tokenNames may confuse users
as they look alike. Contract developer shall declare normalization mechanism if
non-unique &lt;code&gt;tokenName&lt;&#x2F;code&gt; is allowed using &lt;code&gt;IERC_NamedTokenExtension&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Structured Data Clear Signing Format</title>
        <published>2024-02-07T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Laurent Castillo</name><uri>https://github.com/lcastillo-ledger</uri>
	</author>
	
	<author>
		<name>Derek Rein</name><uri>https://github.com/arein</uri>
	</author>
	
	<author>
		<name>Pierre Aoun</name><uri>https://github.com/paoun-ledger</uri>
	</author>
	
	<author>
		<name>Arik Galansky</name><uri>https://github.com/arikg</uri>
	</author>
	
	<author>
		<name>Bartosz Rozwarski</name><uri>https://github.com/llbartekll</uri>
	</author>
	
	<author>
		<name>Kaan Uzdogan</name><uri>https://github.com/kuzdogan</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7730/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7730-proposal-for-a-clear-signing-standard-format-for-wallets/20403" />
        

        <id>https://wg-eips.ritovision.com/7730/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7730"
            label="ERC-7730" />
        

        
        

        
        <summary type="html">JSON format describing how to clear-sign smart contract calls and typed messages.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7730/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This specification defines a JSON format carrying additional information required to correctly display structured data for human verification on wallet screens or for machine consumption e.g. by transaction simulation engines.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7730&#x2F;&quot;&gt;ERC-7730&lt;&#x2F;a&gt; specification enriches type data contained in the ABIs and schemas of structured messages (structures like the calldata of an EVM transaction, an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; message or an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;EIP-4337&lt;&#x2F;a&gt; User Operation) with additional formatting information and dynamic value interpolation, enabling both human-readable display with contextual intent descriptions and machine-interpretable data processing. For instance, a solidity field containing an amount, encoded as an uint256, can be converted to the right magnitude and appended with the correct ticker for display, or parsed programmatically for transaction simulation. Fields containing encrypted values (such as FHE-encrypted amounts in confidential token standards like &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7984&#x2F;&quot;&gt;ERC-7984&lt;&#x2F;a&gt;) can also be annotated with decryption context, enabling wallets to either decrypt and display the plaintext value or present a meaningful fallback.&lt;&#x2F;p&gt;
&lt;p&gt;Wallets and automated systems will use curated ERC-7730 files alongside the raw data to sign in order to construct appropriate interfaces for their respective use cases.&lt;&#x2F;p&gt;
&lt;p&gt;This enables significantly improved signing user experiences and lower end-user risk from frontend and phishing attacks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Properly validating a transaction on a hardware wallet&#x27;s screen (also known as Clear Signing) is a key element of good security practices for end users when interacting with any Blockchain. Unfortunately, most data to sign, even enriched with the data structure description (like ABIs or EIP-712 types) are not self-sufficient in terms of correctly displaying them to users for review. Among other things:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Function name or main message type is often a developer oriented name and does not translate to a clear intent for the user&lt;&#x2F;li&gt;
&lt;li&gt;Fields in the data to sign are tied to primitive types only, but those can be displayed in many different ways. For instance, integers can be displayed as percentages, dates, etc...&lt;&#x2F;li&gt;
&lt;li&gt;Some fields require additional metadata to be displayed correctly, for instance token amounts require knowledge of the decimals and the ticker, as well as where to find the token address itself to be correctly formatted.&lt;&#x2F;li&gt;
&lt;li&gt;Some values can be encrypted, such as encrypted amounts in confidential tokens following &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7984&#x2F;&quot;&gt;ERC-7984&lt;&#x2F;a&gt;. These values cannot be directly interpreted, so additional context must be provided to enable wallets to decrypt and display them for users.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This specification intends to provide a simple, open standard format to provide wallets with the additional information required to properly format a structured data to sign for review by users.&lt;&#x2F;p&gt;
&lt;p&gt;Providing this additional formatting information requires deep knowledge of the way a smart contract or message is going to be used. It is expected that app developers will be the best placed to write such a file. The intent of an open standard is to only write this file once and have it work with most wallets supporting this standard.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;simple-example&quot;&gt;Simple example&lt;&#x2F;h3&gt;
&lt;p&gt;The following is an example of how to clear sign a &lt;code&gt;transfer&lt;&#x2F;code&gt; function call on an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; contract.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;$schema&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;eips.ethereum.org&#x2F;assets&#x2F;eip-7730&#x2F;erc7730-v2.schema.json&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;context&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;$id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Example ERC-20&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; :&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;deployments&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xdAC17F958D2ee523a2206206994597C13D831ec7&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 137&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xc2132D05D31c914a87C6611C10748AEb04B58e8F&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 42161&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Example&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;contractName&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Example Token&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;info&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;url&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;example.io&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;deploymentDate&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2017-11-28T12:41:21Z&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;display&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;formats&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;transfer(address to,uint256 value)&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;intent&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Send&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;interpolatedIntent&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Send {value} to {to}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;path&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;label&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;tokenAmount&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;tokenPath&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;@.to&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;path&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;label&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;To&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;addressName&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;$schema&lt;&#x2F;code&gt; key refers to the latest version of this specification json schema (version 1 at the time of writing).&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;context&lt;&#x2F;code&gt; key is used to provide binding context information for this file. It can be seen as a set of &lt;em&gt;constraints&lt;&#x2F;em&gt; on the structured data being reviewed, indicating whether the ERC-7730 file is valid for this data. A wallet MUST ensure these constraints are met before ERC-7730 formatting information is applied to the data being signed.&lt;&#x2F;p&gt;
&lt;p&gt;In this example, the context section indicates that the ERC-7730 file should only be applied to the Example smart contract whose deployment addresses are provided. Once the contract is matched, wallets use the &lt;code&gt;display.formats&lt;&#x2F;code&gt; entry itself to derive the function selector, parameter layout, and user-facing labels.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;metadata&lt;&#x2F;code&gt; section contains constants that can be trusted when the ERC-7730 file is applicable for the given context. This section is typically used to:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Provide displayable information about the recipient of the contract call &#x2F; message&lt;&#x2F;li&gt;
&lt;li&gt;Provide displayable values of enumeration or encoded id parameters, typically smart contract &#x2F; message specific&lt;&#x2F;li&gt;
&lt;li&gt;Provide common constants used by the various formats defined in the file&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In this example, the metadata section contains only the recipient information, in the form of a displayable name (&lt;code&gt;owner&lt;&#x2F;code&gt; key), contract displayable name (&lt;code&gt;contractName&lt;&#x2F;code&gt; key) and additional information (&lt;code&gt;info&lt;&#x2F;code&gt; key) that MAY be used by wallets to provide details about the recipient.&lt;&#x2F;p&gt;
&lt;p&gt;Finally, the &lt;code&gt;display&lt;&#x2F;code&gt; section contains the definitions of how to format each field of targeted contract calls under the &lt;code&gt;formats&lt;&#x2F;code&gt; key.&lt;&#x2F;p&gt;
&lt;p&gt;In this example, the function being described is identified by its human-readable ABI fragment &lt;code&gt;transfer(address to,uint256 value)&lt;&#x2F;code&gt;. Wallets strip the parameter names to compute the type-only signature &lt;code&gt;transfer(address,uint256)&lt;&#x2F;code&gt;, hash it, and match the resulting selector &lt;code&gt;0xa9059cbb&lt;&#x2F;code&gt; against the calldata.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;intent&lt;&#x2F;code&gt; key contains a human-readable string that wallets SHOULD display to explain to the user the intent of the function call.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;fields&lt;&#x2F;code&gt; key contains all the parameters formatting information&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;interpolatedIntent&lt;&#x2F;code&gt; key is a suggested short string representation of intent and fields that wallet CAN use instead of having a dedicated layout.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In this example, the &lt;code&gt;to&lt;&#x2F;code&gt; parameter and the &lt;code&gt;value&lt;&#x2F;code&gt; parameter SHOULD both be displayed, one as an address replaceable by a trusted name (ENS or others), the other as an amount formatted using metadata of the target ERC-20 contract.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;versioning&quot;&gt;Versioning&lt;&#x2F;h3&gt;
&lt;p&gt;The version of the specification used by the 7730 file is specified by linking to the reference schema file under the &lt;code&gt;$schema&lt;&#x2F;code&gt; key.&lt;&#x2F;p&gt;
&lt;p&gt;The current version of the specification is &lt;code&gt;2&lt;&#x2F;code&gt; at the time of writing. The reference schema for version &lt;code&gt;2&lt;&#x2F;code&gt; is &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7730&#x2F;.&#x2F;assets&#x2F;erc7730-v2.schema.json&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;common-concepts&quot;&gt;Common concepts&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;key-naming-convention&quot;&gt;Key naming convention&lt;&#x2F;h4&gt;
&lt;p&gt;In all the specification, key names starting with &lt;code&gt;$&lt;&#x2F;code&gt; are &lt;em&gt;internal&lt;&#x2F;em&gt; and have no value beyond readability of the specification file itself. They should not be used in any function to build the UI to review structured data.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;structured-data&quot;&gt;Structured data&lt;&#x2F;h4&gt;
&lt;p&gt;This specification intends to be extensible to describe the display formatting of any kind of &lt;em&gt;structured data&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;By &lt;em&gt;Structured data&lt;&#x2F;em&gt;, we target any data format that has:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A well-defined &lt;em&gt;type&lt;&#x2F;em&gt; system; the data being described itself being of a specific top-level type&lt;&#x2F;li&gt;
&lt;li&gt;A description of the type system, the &lt;em&gt;schema&lt;&#x2F;em&gt;, that should allow splitting the data into &lt;em&gt;fields&lt;&#x2F;em&gt;, each field clearly identified with a &lt;em&gt;path&lt;&#x2F;em&gt; that can be described as a string.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Displaying structured data is often done by wallets to review its content before authorizing an action in the form of a &lt;em&gt;signature&lt;&#x2F;em&gt; over some serialization of the structured data. As such, the structured data is contained in a &lt;em&gt;container structure&lt;&#x2F;em&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Container structure has a well-defined &lt;em&gt;signature&lt;&#x2F;em&gt; scheme (a serialization scheme, a hashing scheme, and signature algorithm).&lt;&#x2F;li&gt;
&lt;li&gt;The container structure does not necessarily follow the same type system as the structured data.&lt;&#x2F;li&gt;
&lt;li&gt;Wallets receive the full container structure and uses the signature scheme to generate a signature on the overall structure.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7730&#x2F;.&#x2F;assets&#x2F;structured-data.svg&quot; alt=&quot;Structured Data and Container&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Current specification covers EVM smart contract calldata:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Defined in Solidity&lt;&#x2F;li&gt;
&lt;li&gt;The schema is the function ABI (derived from the matched &lt;code&gt;display.formats&lt;&#x2F;code&gt; function fragment)&lt;&#x2F;li&gt;
&lt;li&gt;The container structure is an EVM Transaction serialized in RLP encoding&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;It also supports EIP-712 messages&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Defined in EIP-712&lt;&#x2F;li&gt;
&lt;li&gt;The schema is extracted from the type string representation carried in the &lt;code&gt;display.formats&lt;&#x2F;code&gt; message fragments.&lt;&#x2F;li&gt;
&lt;li&gt;An EIP-712 message is self-contained, the signature is applied to the hashed message itself following EIP-712 specification.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;em&gt;schema&lt;&#x2F;em&gt; is defined by the binding context together with the selected display entry. For contracts, the matched &lt;code&gt;display.formats&lt;&#x2F;code&gt; key provides the full function signature (types and parameter names); for EIP-712 messages, the matched &lt;code&gt;display.formats&lt;&#x2F;code&gt; provides the type encoding of the message. Both form of type definition allows defining unique &lt;em&gt;paths&lt;&#x2F;em&gt; pointing to specific fields in the data.&lt;&#x2F;p&gt;
&lt;p&gt;Formats are dependent on and defined for the underlying &lt;em&gt;types&lt;&#x2F;em&gt; on the structured data. The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7730&#x2F;#reference&quot;&gt;Reference&lt;&#x2F;a&gt; section covers formats and types supported by this current version of the specification.&lt;&#x2F;p&gt;
&lt;p&gt;It is sometime necessary for formatting of fields of the structured data to reference values of the &lt;em&gt;container structure&lt;&#x2F;em&gt;. These values are dependent on the container structure itself and are defined in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7730&#x2F;#reference&quot;&gt;Reference&lt;&#x2F;a&gt; section.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;path-references&quot;&gt;Path references&lt;&#x2F;h4&gt;
&lt;p&gt;This specification uses a limited &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc9535&quot;&gt;json path&lt;&#x2F;a&gt; notation to reference values that can be found in multiple json documents.&lt;&#x2F;p&gt;
&lt;p&gt;Limitation to the json path specification are the following:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Paths MUST use the dot notation, including for slice and array selectors (i.e. an element of an array should be selected through &lt;code&gt;array_name.[index]&lt;&#x2F;code&gt;)&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Only name, index and slices selectors are supported.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Slices selectors MUST NOT contain the optional step. Start index is inclusive, end index is exclusive. Start or end index can be omitted to indicate the beginning or end of the array.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In addition, additional &lt;em&gt;roots&lt;&#x2F;em&gt; are introduced to support description of paths over multiple files in a single common notation. The root node identifier indicates which document or data location this path references, according to the following table:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Root&lt;&#x2F;th&gt;&lt;th&gt;Short summary&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;#&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Structured data schema — decoded function parameters or EIP‑712 message fields&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;$&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;ERC‑7730 specification file (after merging includes)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;@&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Container-level values (transaction or message metadata)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Notes:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Omitting the root makes the path relative to the structure being described. If there is no enclosing container, a relative path is equivalent to starting with &lt;code&gt;#.&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;structured-data-decoded&quot;&gt;&lt;code&gt;#&lt;&#x2F;code&gt; — structured data (decoded)&lt;&#x2F;h5&gt;
&lt;p&gt;Paths with the &lt;code&gt;#&lt;&#x2F;code&gt; root refer to fields in the structured data being signed — e.g. decoded function arguments for contract calldata or fields of an EIP‑712 message. Names of the path selectors match the schema of the transaction or message, found in the keys under &lt;code&gt;display.formats&lt;&#x2F;code&gt;.  Values come from the serialized structured data once decoded by the wallet.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Examples&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;#.params.amountIn&lt;&#x2F;code&gt; — the &lt;code&gt;amountIn&lt;&#x2F;code&gt; field inside top-level &lt;code&gt;params&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;params.amountIn&lt;&#x2F;code&gt; (relative) — equivalent when the path is resolved relative to the structured data.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;#.details.[]&lt;&#x2F;code&gt; refers to the array with the Permit Details of a PermitBatch message&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;merged-erc-7730-file&quot;&gt;&lt;code&gt;$&lt;&#x2F;code&gt; — merged ERC‑7730 file&lt;&#x2F;h5&gt;
&lt;p&gt;Paths with the &lt;code&gt;$&lt;&#x2F;code&gt; root point to values in the ERC‑7730 file itself after any &lt;code&gt;includes&lt;&#x2F;code&gt; have been merged by the consumer. Use &lt;code&gt;$&lt;&#x2F;code&gt; to reference metadata, definitions, enums, maps and any constants authored in the specification.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Examples&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;$.metadata.enums.interestRateMode&lt;&#x2F;code&gt; — enumeration values defined in the spec.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;$.display.definitions.minReceiveAmount&lt;&#x2F;code&gt; — a shared field definition.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;container-transaction-message&quot;&gt;&lt;code&gt;@&lt;&#x2F;code&gt; — container (transaction &#x2F; message)&lt;&#x2F;h5&gt;
&lt;p&gt;The &lt;code&gt;@&lt;&#x2F;code&gt; root names values coming from the container that wraps the structured data (for example, an EVM transaction or an EIP‑712 message). These values are container-specific; see the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7730&#x2F;#reference&quot;&gt;Reference&lt;&#x2F;a&gt; section for the canonical list of container fields (e.g. &lt;code&gt;@.from&lt;&#x2F;code&gt;, &lt;code&gt;@.to&lt;&#x2F;code&gt;, &lt;code&gt;@.value&lt;&#x2F;code&gt;, &lt;code&gt;@.chainId&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Examples&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;@.value&lt;&#x2F;code&gt; — native currency value of an EVM transaction.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;@.to&lt;&#x2F;code&gt; — transaction destination (contract address).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;path-slices&quot;&gt;Path slices&lt;&#x2F;h5&gt;
&lt;p&gt;For paths referring to structured data fields, if a field has a variable length primitive type (like &lt;code&gt;bytes&lt;&#x2F;code&gt; or &lt;code&gt;string&lt;&#x2F;code&gt; in solidity), a slice selector can be appended to the path, to refer to the specific set of bytes indicated by the slice. A slice selector can also be appended to arrays to select only the specified part of the array.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Examples&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;#.data.path.[0].path.[-1].to&lt;&#x2F;code&gt; or &lt;code&gt;data.path.[0].path.[-1].to&lt;&#x2F;code&gt; refers to the field &lt;code&gt;to&lt;&#x2F;code&gt; taken from last member of &lt;code&gt;path&lt;&#x2F;code&gt; array, itself taken from first member of enclosing &lt;code&gt;path&lt;&#x2F;code&gt; array, itself part of top level &lt;code&gt;data&lt;&#x2F;code&gt; structure.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;#.params.path.[:20]&lt;&#x2F;code&gt; or &lt;code&gt;#.params.path.[0:20]&lt;&#x2F;code&gt; refers to the first 20 bytes of the &lt;code&gt;path&lt;&#x2F;code&gt; byte array&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;#.params.path.[-20:]&lt;&#x2F;code&gt; refers to the last 20 bytes of the &lt;code&gt;path&lt;&#x2F;code&gt; byte array&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;value-interpolation&quot;&gt;Value interpolation&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;interpolatedIntent&lt;&#x2F;code&gt; field supports embedding formatted field values directly within intent strings using interpolation syntax. This allows constructing dynamic, context-aware descriptions of transactions and messages as an alternative to using individual &lt;code&gt;intent&lt;&#x2F;code&gt; and &lt;code&gt;fields&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;interpolatedIntent&lt;&#x2F;code&gt; makes transaction intents significantly shorter and easier to read by presenting all relevant information in a single, natural language sentence rather than as separate labeled fields. This is particularly valuable for:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Reducing the cognitive load on users reviewing transactions&lt;&#x2F;li&gt;
&lt;li&gt;Displaying concise summaries on resource-constrained devices&lt;&#x2F;li&gt;
&lt;li&gt;Enabling clear descriptions of batch transactions (e.g., &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5792&#x2F;&quot;&gt;EIP-5792&lt;&#x2F;a&gt;), where multiple operations can be concatenated into a single readable sentence&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Interpolation syntax&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Values are interpolated using curly braces containing a path reference: &lt;code&gt;{path}&lt;&#x2F;code&gt;. The path MUST follow the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7730&#x2F;#path-references&quot;&gt;path reference rules&lt;&#x2F;a&gt; and can reference:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Structured data fields (e.g., &lt;code&gt;{to}&lt;&#x2F;code&gt;, &lt;code&gt;{params.amountIn}&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;Container values (e.g., &lt;code&gt;{@.value}&lt;&#x2F;code&gt;, &lt;code&gt;{@.from}&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;Metadata constants (e.g., &lt;code&gt;{$.metadata.constants.nativeAssetAddress}&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Interpolated intents MUST only refer to paths that are noted as always visible (i.e. &lt;code&gt;visible&lt;&#x2F;code&gt; key in the field formatter is &lt;code&gt;always&lt;&#x2F;code&gt; or not present).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Formatting behavior&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;When a wallet processes an &lt;code&gt;interpolatedIntent&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The wallet MUST identify all interpolation expressions &lt;code&gt;{path}&lt;&#x2F;code&gt; in the string&lt;&#x2F;li&gt;
&lt;li&gt;For each expression, the wallet MUST resolve the path and locate the corresponding field format specification in the &lt;code&gt;fields&lt;&#x2F;code&gt; array&lt;&#x2F;li&gt;
&lt;li&gt;The wallet MUST apply the field&#x27;s &lt;code&gt;format&lt;&#x2F;code&gt; and &lt;code&gt;params&lt;&#x2F;code&gt; to format the value&lt;&#x2F;li&gt;
&lt;li&gt;The wallet MUST replace the interpolation expression with the formatted value&lt;&#x2F;li&gt;
&lt;li&gt;If any interpolation fails (path not found, formatting error, etc.), the wallet MUST fall back to displaying the regular &lt;code&gt;intent&lt;&#x2F;code&gt; field&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;strong&gt;Escaping&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;To include literal curly braces in the intent text, escape them by doubling: &lt;code&gt;{{&lt;&#x2F;code&gt; for &lt;code&gt;{&lt;&#x2F;code&gt; and &lt;code&gt;}}&lt;&#x2F;code&gt; for &lt;code&gt;}&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Examples&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Simple token transfer:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;intent&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Send&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;interpolatedIntent&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Send {value} to {to}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;path&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;addressName&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;path&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;tokenAmount&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;tokenPath&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;@.to&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Displays as: &lt;strong&gt;&quot;Send 100 USDT to cyberdrk.eth&quot;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Simple encrypted token transfer:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;intent&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Send&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;interpolatedIntent&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Send {value} to {to}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;path&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;addressName&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;path&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;tokenAmount&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;tokenPath&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;@.to&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;encryption&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;scheme&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;fhevm&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;plaintextType&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;fallbackLabel&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;[Encrypted Amount]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Displays as:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;When decryption is available: &lt;strong&gt;&quot;Send 100 USDT to cyberdrk.eth&quot;&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;li&gt;When decryption is not available: &lt;strong&gt;&quot;Send [Encrypted Amount] to cyberdrk.eth&quot;&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;Swap with native currency:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;intent&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Swap&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;interpolatedIntent&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Swap {amountIn} for at least {amountOutMinimum}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;path&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;amountIn&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;tokenAmount&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;tokenPath&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;tokenIn&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;path&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;amountOutMinimum&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;tokenAmount&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;tokenPath&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;tokenOut&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Displays as: &lt;strong&gt;&quot;Swap 1000 USDC for at least 0.25 WETH&quot;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Using container values:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;intent&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Wrap ETH&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;interpolatedIntent&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Wrap {@.value} ETH for WETH&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;path&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;@.value&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Displays as: &lt;strong&gt;&quot;Wrap 0.5 ETH for WETH&quot;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Escaping literal braces:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;interpolatedIntent&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Execute {{function}} with {amount} tokens&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Displays as: &lt;strong&gt;&quot;Execute {function} with 100 tokens&quot;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;organizing-files&quot;&gt;Organizing files&lt;&#x2F;h4&gt;
&lt;p&gt;Smart contracts and EIP-712 messages are often re-using common interfaces or types that share similar display formatting. This specification supports a basic inclusion mechanism that enables sharing files describing specific interfaces or types.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;includes&lt;&#x2F;code&gt; top-level key is a URL pointing to an ERC-7730 file that MUST follow this specification.&lt;&#x2F;p&gt;
&lt;p&gt;A wallet using an ERC-7730 file including another file SHOULD merge those files into a single reference file. When merging, conflicts between common unique keys are resolved by prioritizing the including file.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Merging field format specifications&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Special care must be taken when merging &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7730&#x2F;#field-format-specification&quot;&gt;field format specifications&lt;&#x2F;a&gt;. These objects are grouped in an array under the &lt;code&gt;fields&lt;&#x2F;code&gt; key, allowing ordering of field formatters. When merging the two arrays, a wallet SHOULD:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Merge together objects sharing the same &lt;code&gt;path&lt;&#x2F;code&gt; value, overriding parameters of the included file with those of the including file.&lt;&#x2F;li&gt;
&lt;li&gt;Append objects with &lt;code&gt;path&lt;&#x2F;code&gt; values not part of the included file to the resulting array.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;Example&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;This file defines a generic ERC-20 interface for a single &lt;code&gt;approve&lt;&#x2F;code&gt; function:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;display&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;formats&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;approve(address spender,uint256 value)&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;intent&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Approve&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;path&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;spender&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;label&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Spender&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;addressName&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;path&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;label&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;tokenAmount&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;tokenPath&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;@.to&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;threshold&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x8000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;thresholdLabel&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Unlimited&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note that there are no keys for binding the contract to a specific address or owner, nor any contract specific metadata.&lt;&#x2F;p&gt;
&lt;p&gt;The following file would include this generic interface and bind it to the specific USDT contract, overriding the threshold value to one relative to USDT:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;context&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;$id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Example Contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; :&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;deployments&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xdAC17F958D2ee523a2206206994597C13D831ec7&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;includes&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;.&#x2F;example-erc20.json&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Example&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;contractName&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Example Token&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;info&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;url&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;example.io&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;deploymentDate&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2017-11-28T12:41:21Z&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;token&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;ticker&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;STABLE&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Example Stablecoin&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;decimals&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;display&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;formats&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;approve(address spender,uint256 value)&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;path&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; :&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;threshold&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xFFFFFFFFFFFFFFFFFF&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note that the keys under &lt;code&gt;context.contract&lt;&#x2F;code&gt; would be merged together to construct a full contract binding object. The field formatter &lt;code&gt;value&lt;&#x2F;code&gt; parameter &lt;code&gt;threshold&lt;&#x2F;code&gt; is overridden with value &lt;code&gt;0xFFFFFFFFFFFFFFFFFF&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;context-section&quot;&gt;&lt;code&gt;Context&lt;&#x2F;code&gt; section&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;context&lt;&#x2F;code&gt; section describes a set of &lt;em&gt;constraints&lt;&#x2F;em&gt; that must be verified by the structured data and container structure before formatting them using the ERC-7730 file. A wallet MUST verify that the structured data and container it is trying to sign matches the constraints of the &lt;code&gt;context&lt;&#x2F;code&gt; section.&lt;&#x2F;p&gt;
&lt;p&gt;The current version of this specification only supports two types of binding context, EVM smart contracts and EIP-712 domains.&lt;&#x2F;p&gt;
&lt;p&gt;All context support an &lt;code&gt;$id&lt;&#x2F;code&gt; sub-key as an internal identifier (only relevant to provide a human-readable name to the ERC-7730 file)&lt;&#x2F;p&gt;
&lt;h4 id=&quot;evm-smart-contract-binding-context-denoted-calldata&quot;&gt;EVM smart contract binding context (denoted &#x27;calldata&#x27;)&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;contract&lt;&#x2F;code&gt; sub-key is used to introduce an EVM smart contract binding context, with the following constraints expressed as sub-keys of &lt;code&gt;contract&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;contract.deployments&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;An array of deployments options. Wallets MUST verify that the target chain and contract address of the containing transaction either:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Match one of these deployment options&lt;&#x2F;li&gt;
&lt;li&gt;Is a &lt;em&gt;proxy&lt;&#x2F;em&gt; pointing to one of the deployment option (see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7730&#x2F;#proxy-support&quot;&gt;Proxy support&lt;&#x2F;a&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;A deployment option is an object with:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;chainId&lt;&#x2F;code&gt;: an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155 identifier&lt;&#x2F;a&gt; of the chain the described contract is deployed on.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;address&lt;&#x2F;code&gt;: the address of the deployed contract on specified &lt;code&gt;chainId&lt;&#x2F;code&gt; chain.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;contract.abi&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; &lt;em&gt;(deprecated)&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Legacy ABI attachment kept for backward compatibility. Authors SHOULD prefer &lt;code&gt;display.formats&lt;&#x2F;code&gt; and avoid relying on this key, as it will be removed in a future revision.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;contract.factory&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;An object describing the factory used to deploy smart contracts that can be clear signed using the ERC-7730 file.&lt;&#x2F;p&gt;
&lt;p&gt;A factory is a json object with:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;deployEvent&lt;&#x2F;code&gt; key, specifying the solidity signature of the events emitted when deploying a clear-signable contract.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;deployments&lt;&#x2F;code&gt; key: an array of deployment options as in &lt;code&gt;contract.deployments&lt;&#x2F;code&gt;. These deployments represent the addresses at which the &lt;em&gt;factory&lt;&#x2F;em&gt; is deployed.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;To verify a factory constraints a wallet MUST check that:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The current transaction destination address is included in an event of signature &lt;code&gt;factory.deployEvent&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;The emitter of the event is a factory contract deployed at an address matching one of the deployment option in &lt;code&gt;factory.deployments&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;eip-712-messages-binding-context-denoted-messages&quot;&gt;EIP-712 messages binding context (denoted &#x27;messages&#x27;)&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;eip712&lt;&#x2F;code&gt; sub-key is used to introduce an EIP-712 message type to bind to:&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;eip712.schemas&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; &lt;em&gt;(deprecated)&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Legacy Schema attachment kept for backward compatibility. Authors SHOULD prefer &lt;code&gt;display.formats&lt;&#x2F;code&gt; and avoid relying on this key, as it will be removed in a future revision.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;eip712.domain&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;domain&lt;&#x2F;code&gt; constraint is a json object with simple key-value pairs, describing a set of values that the &lt;em&gt;EIP-712 Domain&lt;&#x2F;em&gt; of the message MUST match.&lt;&#x2F;p&gt;
&lt;p&gt;A wallet MUST verify that each key-value pair in this &lt;code&gt;domain&lt;&#x2F;code&gt; binding matches the values of the &lt;code&gt;domain&lt;&#x2F;code&gt; key-value pairs of the message. Note that the message can have more keys in its &lt;code&gt;domain&lt;&#x2F;code&gt; than those listed in the ERC-7730 file. An EIP-712 domain is a free-form list of keys, but those are very common to include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;name&lt;&#x2F;code&gt;: the name of the message verifier&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;version&lt;&#x2F;code&gt;: the version of the message&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;chainId&lt;&#x2F;code&gt;: an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt; identifier of the chain the message is bound to&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;verifyingContract&lt;&#x2F;code&gt;: the address the message is bound to&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note that &lt;code&gt;chainId&lt;&#x2F;code&gt; and &lt;code&gt;verifyingContract&lt;&#x2F;code&gt; can also be bound to their values thanks to the &lt;code&gt;eip712.deployments&lt;&#x2F;code&gt; constraint, in a more flexible way (supporting multiple deployment values).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;eip712.deployments&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;An array of deployments options.&lt;&#x2F;p&gt;
&lt;p&gt;When an &lt;code&gt;eip712.deployments&lt;&#x2F;code&gt; constraint is set, the wallet MUST verify that:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The message being displayed has both &lt;code&gt;domain.chainId&lt;&#x2F;code&gt; and &lt;code&gt;domain.verifyingContract&lt;&#x2F;code&gt; keys&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;chainId&lt;&#x2F;code&gt; and &lt;code&gt;verifyingContract&lt;&#x2F;code&gt; values in the domain either
&lt;ul&gt;
&lt;li&gt;Match ONE of the deployment option specified in &lt;code&gt;eip712.deployments&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Is a &lt;em&gt;proxy&lt;&#x2F;em&gt; pointing to one of the deployment options (see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7730&#x2F;#proxy-support&quot;&gt;Proxy support&lt;&#x2F;a&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;A deployment option is an object with:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;chainId&lt;&#x2F;code&gt;: an EIP-155 identifier of the chain the described contract is deployed on.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;address&lt;&#x2F;code&gt;: the address of the deployed contract on specified &lt;code&gt;chainId&lt;&#x2F;code&gt; chain.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;eip712.domainSeparator&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;An hex string containing the value of the &lt;em&gt;domainSeparator&lt;&#x2F;em&gt; to check.&lt;&#x2F;p&gt;
&lt;p&gt;Wallet MUST verify that the message &lt;em&gt;EIP-712 Domain&lt;&#x2F;em&gt; hashes (as defined in EIP-712) to the value in &lt;code&gt;eip712.domainSeparator&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;When the exact construction of the EIP-712 domain is not known (for instance, when the smart contract code only contains the hash value of the domain separator), &lt;code&gt;domainSeparator&lt;&#x2F;code&gt; and &lt;code&gt;domain.verifyingContract&lt;&#x2F;code&gt; can still be used to target the right message recipients.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Examples&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;context&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; :&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;eip712&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;domain&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Permit2&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;deployments&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x000000000022D473030F116dDEE9F6B43aC78BA3&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 42161&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x000000000022D473030F116dDEE9F6B43aC78BA3&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The previous snippet defines a context for a &lt;code&gt;Permit2&lt;&#x2F;code&gt; EIP-712 message (types have been omitted for readability).&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;domain&lt;&#x2F;code&gt; key indicates that the message signed domain MUST contain a &lt;code&gt;name&lt;&#x2F;code&gt; key of value &lt;code&gt;Permit2&lt;&#x2F;code&gt;. The &lt;code&gt;deployments&lt;&#x2F;code&gt; key means that the domain must contain both &lt;code&gt;chainId&lt;&#x2F;code&gt; and &lt;code&gt;verifyingContract&lt;&#x2F;code&gt; keys and they MUST match one of the deployment options (here, on ETH mainnet and Arbitrum).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;metadata-section&quot;&gt;&lt;code&gt;Metadata&lt;&#x2F;code&gt; section&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;metadata&lt;&#x2F;code&gt; section contains information about constant values relevant in the scope of the current contract &#x2F; message (as matched by the &lt;code&gt;context&lt;&#x2F;code&gt; section).&lt;&#x2F;p&gt;
&lt;p&gt;In the context of wallets and clear signing, these constant values are either used to construct the UI when approving the signing operation, or to provide parameters &#x2F; checks on the data being signed. But these constant values are relevant outside of the scope of wallets, and should be understood as reference values concerning the bound contract &#x2F; message.&lt;&#x2F;p&gt;
&lt;p&gt;All keys but the &lt;code&gt;metadata.owner&lt;&#x2F;code&gt; key are optional.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;metadata.owner&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;A key containing a displayable name of the &lt;em&gt;owner&lt;&#x2F;em&gt; of the contract or of the verifying contract for a message.&lt;&#x2F;p&gt;
&lt;p&gt;Wallet MAY use this value to display the target of the interaction being reviewed.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;metadata.contractName&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;A key containing a displayable name of the contract or of the verifying contract for a message.&lt;&#x2F;p&gt;
&lt;p&gt;Wallet MAY use this value to display the target of the interaction being reviewed.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;metadata.info&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;A key containing additional structured info about the &lt;em&gt;owner&lt;&#x2F;em&gt; of the contract:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;deploymentDate&lt;&#x2F;code&gt; is the date of deployment of the contract (or verifying contract)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;url&lt;&#x2F;code&gt; is the official URL of the owner&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;A wallet MAY use this information to display additional details about the targeted contract.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;metadata.token&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;token&lt;&#x2F;code&gt; key is only relevant for &lt;code&gt;contract&lt;&#x2F;code&gt; ERC-7730 files and only for contracts supporting an ERC-20 interface.&lt;&#x2F;p&gt;
&lt;p&gt;It contains the ERC-20 metadata when the contract itself does not support the optional calls to retrieve it. It SHOULD NOT be present if the contract does support the &lt;code&gt;name()&lt;&#x2F;code&gt;, &lt;code&gt;symbol()&lt;&#x2F;code&gt; and &lt;code&gt;decimals()&lt;&#x2F;code&gt; smart contract calls.&lt;&#x2F;p&gt;
&lt;p&gt;The ERC-20 token metadata for the contract described is in the sub-keys &lt;code&gt;name&lt;&#x2F;code&gt;, &lt;code&gt;ticker&lt;&#x2F;code&gt; and &lt;code&gt;decimals&lt;&#x2F;code&gt; and contains the values that the correponding function calls would have returned.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;metadata.constants&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;This key contains in a json object all the constants that can be re-used as parameters in the formatters, or that make sense in the context of this contract &#x2F; message.&lt;&#x2F;p&gt;
&lt;p&gt;It is a list of key &#x2F; value pairs, the key being used to reference this constant (as a &lt;em&gt;path&lt;&#x2F;em&gt; starting with a root node &lt;code&gt;$.&lt;&#x2F;code&gt; i.e. &lt;code&gt;$.metadata.constants.KEY_NAME&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Example&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;constants&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;nativeAssetAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This snippet introduces a constant &lt;code&gt;nativeAssetAddress&lt;&#x2F;code&gt; (an address typically used to represent the native network underlying currency, which is smart contract specific). This constant can be referenced using the path &lt;code&gt;$.metadata.constants.nativeAssetAddress&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;metadata.maps&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Sometimes constants are dependant on some part of the context of the transaction, for instance a token address used by a contract might depend on the deployment chain. &lt;code&gt;maps&lt;&#x2F;code&gt; key allow an efficient representation of those types of context-dependent constants.&lt;&#x2F;p&gt;
&lt;p&gt;Each key under the &lt;code&gt;maps&lt;&#x2F;code&gt; object is a &lt;em&gt;map&lt;&#x2F;em&gt; name.&lt;&#x2F;p&gt;
&lt;p&gt;A map is a json object with two keys:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;keyType&lt;&#x2F;code&gt; key contains an non normative indication of the expected type of the map key passed when referencing the map.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;values&lt;&#x2F;code&gt; key contains a list of key &#x2F; value pairs, each key being used to match the data pointed to in the reference &lt;code&gt;keyPath&lt;&#x2F;code&gt; key. The corresponding value is used as the context-dependent constant when referenced in the &lt;code&gt;display&lt;&#x2F;code&gt; section.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Maps references can be used anywhere a parameter with constant value would be used. A map reference is a json object with two keys:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;map&lt;&#x2F;code&gt; key refers to the map to use to resolve the constant value, using a path starting with root node &lt;code&gt;$.&lt;&#x2F;code&gt; (i.e. &lt;code&gt;$.metadata.maps.MAP_NAME&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;keyPath&lt;&#x2F;code&gt; key refers to the path to use to retrieve the map key to use for the resolution.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;A wallet MUST replace a path to a map using the value matching the &lt;code&gt;keyPath&lt;&#x2F;code&gt; parameter. In case no values matches the wallet MUST consider the 7730 file invalid for the transaction.&lt;&#x2F;p&gt;
&lt;p&gt;An example can be found in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7730&#x2F;.&#x2F;assets&#x2F;example-maps.json&quot;&gt;example-maps.json&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7730&#x2F;.&#x2F;assets&#x2F;example-maps-pools.json&quot;&gt;example-maps-pools.json&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Examples&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;maps&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;underlyingToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;keyPath&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;@.chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;values&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; :&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xaabbccddeeff...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;17000&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x112233445566...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;display&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;formats&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;deposit(amount)&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; :&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;intent&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Deposit&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;path&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;#.amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;label&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Deposit Amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;tokenAmount&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;token&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;$.metadata.maps.underlyingToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This example shows a deposit function that takes as only input the amount of a token hardcoded in the contract. The token address deposited changes based on the chain the contract is deployed to.
The &lt;code&gt;underlyingToken&lt;&#x2F;code&gt; map allows defining the hardcoded values of the underlying token based on the chainId of the transaction context (as specified in &lt;code&gt;&quot;keyPath&quot;: &quot;@.chainId&quot;&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;metadata.enums&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;enums&lt;&#x2F;code&gt; key contains displayable values for parameters that are enumerations (in a loose sense including parameters taking fixed number of well known values). These &lt;code&gt;enums&lt;&#x2F;code&gt; are used to replace specific parameter values with a human-readable one.&lt;&#x2F;p&gt;
&lt;p&gt;Each key of the &lt;code&gt;enums&lt;&#x2F;code&gt; object is an &lt;em&gt;enumeration&lt;&#x2F;em&gt; name. Enumeration names can be referred to in the &lt;code&gt;display&lt;&#x2F;code&gt; section formatters by using a path starting with root node &lt;code&gt;$.&lt;&#x2F;code&gt; (i.e. &lt;code&gt;$.metadata.enums.ENUM_NAME&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;An enum is a json object with a flat list of key &#x2F; value pairs, each key being the enumeration &lt;em&gt;value&lt;&#x2F;em&gt; to replace, and the value being the display string to use instead of the enumeration value.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Examples&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;enums&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;interestRateMode&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;stable&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;2&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;variable&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This snippet introduces an enumeration describing the displayable values of an integer parameter used to represent multiple modes of interest rates. It can be referenced using the path &lt;code&gt;$.metadata.enums.interestRateMode&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;display&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;formats&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;repay(address asset,uint256 amount,uint256 interestRateMode)&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;$id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;repay&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;intent&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Repay loan&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;interpolatedIntent&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Repay {amount} of {interestRateMode} rate loan&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;path&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;tokenAmount&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;label&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Amount to repay&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;tokenPath&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;asset&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;path&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;interestRateMode&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;label&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Interest rate mode&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;$ref&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;$.metadata.enums.interestRateMode&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In this example, the &lt;code&gt;interestRateMode&lt;&#x2F;code&gt; field is formatted using the enumeration defined under &lt;code&gt;$.metadata.enums.interestRateMode&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;display-section&quot;&gt;&lt;code&gt;Display&lt;&#x2F;code&gt; section&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;display&lt;&#x2F;code&gt; section contains the actual formatting instructions for each field of the bound structured data. It is split into two parts, a &lt;code&gt;display.definitions&lt;&#x2F;code&gt; key that contains common formats that can be re-used in the other parts and a &lt;code&gt;display.formats&lt;&#x2F;code&gt; key containing the actual format instructions for each function &#x2F; message type bound to the specification file.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;display.definitions&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;definitions&lt;&#x2F;code&gt; key is an object in which each sub-key is a &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7730&#x2F;#field-format-specification&quot;&gt;&lt;em&gt;field format specification&lt;&#x2F;em&gt;&lt;&#x2F;a&gt;. The sub-key name is the name of the common definition and is used to refer to this object in the form of a path starting with root node &lt;code&gt;$.&lt;&#x2F;code&gt; (i.e. &lt;code&gt;$.display.definitions.DEF_NAME&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;Definitions don&#x27;t usually include the &lt;code&gt;path&lt;&#x2F;code&gt; or &lt;code&gt;value&lt;&#x2F;code&gt; key of a &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7730&#x2F;#field-format-specification&quot;&gt;&lt;em&gt;field format specification&lt;&#x2F;em&gt;&lt;&#x2F;a&gt;, since they are intended for re-use in other fields specifications, that will specify locally what path they apply to.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Example&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;display&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;definitions&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;sendAmount&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;label&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Amount to Send&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;tokenAmount&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;tokenPath&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;fromToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;nativeCurrencyAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;$.display.constants.addressAsEth&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This snippet defines a common formatter for an amount to send that can be used by a simple reference to the path &lt;code&gt;$.display.definitions.sendAmount&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;display.formats&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;formats&lt;&#x2F;code&gt; key is an object containing the actual information used to format the structured data. It is a json object in which each sub-key is a specific function call (for contracts) or a specific message type (for EIP-712) being described. The values are each a &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7730&#x2F;#structured-data-format-specification&quot;&gt;&lt;em&gt;structured data format specification&lt;&#x2F;em&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Contract keys&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;For contract calldata, this specification only covers functions. Each key MUST be a human-readable ABI function fragment that includes parameter names, for example &lt;code&gt;transfer(address to,uint256 value)&lt;&#x2F;code&gt; or &lt;code&gt;submitOrder((address token,uint256 amount) order,bytes32 salt)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Keys MUST use canonical Solidity type names: &lt;code&gt;uint256&lt;&#x2F;code&gt;, &lt;code&gt;bytes32&lt;&#x2F;code&gt;, &lt;code&gt;address&lt;&#x2F;code&gt;, &lt;code&gt;bool&lt;&#x2F;code&gt;, tuple syntax &lt;code&gt;(…)&lt;&#x2F;code&gt;, dynamic arrays &lt;code&gt;type[]&lt;&#x2F;code&gt;, and fixed arrays &lt;code&gt;type[N]&lt;&#x2F;code&gt;. Aliases (e.g., &lt;code&gt;uint&lt;&#x2F;code&gt;) are NOT permitted, commas MUST NOT be followed by spaces, and there MUST be exactly one space between each type and its parameter name.&lt;&#x2F;li&gt;
&lt;li&gt;Parameter names in the fragment MUST match the names used throughout the formatting specification; wallets derive all display paths from these names.&lt;&#x2F;li&gt;
&lt;li&gt;Overloaded functions are distinguished solely by their type signatures. Parameter names do not affect selector matching.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Selector matching (contracts)&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Wallets MUST match calldata to a &lt;code&gt;display.formats&lt;&#x2F;code&gt; entry using the following procedure:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Parse the key and drop parameter names to obtain the canonical type-only signature (e.g., &lt;code&gt;transfer(address,uint256)&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;Compute &lt;code&gt;keccak256(&amp;lt;type-only signature&amp;gt;)[:4]&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Compare the resulting selector to the transaction calldata selector; a match selects the corresponding format specification.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;If multiple keys share the same type-only signature, wallets MUST treat this as an invalid descriptor.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Decoding and parameter names&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Once a format entry is selected, wallets MUST decode calldata arguments using the canonical type vector derived from the key. Parameter names, &lt;code&gt;fields[].path&lt;&#x2F;code&gt; entries, and &lt;code&gt;{placeholders}&lt;&#x2F;code&gt; in &lt;code&gt;interpolatedIntent&lt;&#x2F;code&gt; MUST all use the names from the key (e.g., &lt;code&gt;value&lt;&#x2F;code&gt;, &lt;code&gt;order.amount&lt;&#x2F;code&gt;, &lt;code&gt;recipients[0]&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;Paths are relative to the matched function parameters unless prefixed by another root node; for example, &lt;code&gt;to&lt;&#x2F;code&gt;, &lt;code&gt;order.price&lt;&#x2F;code&gt;, and &lt;code&gt;recipients[0]&lt;&#x2F;code&gt; point to decoded arguments, while &lt;code&gt;@.value&lt;&#x2F;code&gt; references the transaction container.&lt;&#x2F;p&gt;
&lt;p&gt;Placeholders in strings MUST use &lt;code&gt;{&amp;lt;path&amp;gt;}&lt;&#x2F;code&gt; with the same path semantics.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Unknown selectors&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;If no key matches the calldata selector, wallets SHOULD display a safe fallback (for example, &quot;Unknown function&quot; alongside raw arguments) and MUST NOT attempt to apply any unrelated format specifications.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Minimal contract examples&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;display&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;formats&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;transfer(address to,uint256 value)&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;intent&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Send&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;interpolatedIntent&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Send {value} to {to}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;path&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;label&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;tokenAmount&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;path&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;label&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;To&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;     &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;addressName&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;display&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;formats&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;submitOrder((address token,uint256 amount,uint256 price) order,bytes32 salt)&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;intent&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Place order&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;interpolatedIntent&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Buy {order.amount} @ {order.price}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;path&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;order.token&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;label&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Token&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;addressName&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;path&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;order.amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;label&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;path&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;order.price&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;label&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Price&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;path&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;salt&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;         &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;label&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Salt&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;   &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;display&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;formats&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;airdrop(address[] recipients,uint256[3] values)&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;intent&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Airdrop&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;interpolatedIntent&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Airdrop to {recipients[0]} (+{recipients.length} total)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;path&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;recipients[0]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;label&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;First recipient&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;addressName&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;path&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;values[0]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;     &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;label&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Tier 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;tokenAmount&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;EIP-712 keys&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;For EIP-712, the key names MUST be the string returned by the &lt;code&gt;encodeType&lt;&#x2F;code&gt; function defined in EIP-712 specification applied to the primary type of the message.&lt;&#x2F;p&gt;
&lt;p&gt;During the EIP-712 signature process, wallets will compute the type hash from the message. This type hash MUST match the hash computed from the &lt;code&gt;display.formats&lt;&#x2F;code&gt; key in use: &lt;code&gt;keccak256(encodeType(typeOf(s))) == keccak256(TYPE_KEY)&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Example&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;In the sample EIP-712 message included in the specification &lt;a href=&quot;..&#x2F;assets&#x2F;eip-712&#x2F;Example.js&quot;&gt;here&lt;&#x2F;a&gt;, the key used to describe the message would be the string &lt;code&gt;Mail(Person from,Person to,string contents)Person(string name,address wallet)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;structured-data-format-specification&quot;&gt;Structured data format specification&lt;&#x2F;h4&gt;
&lt;p&gt;A &lt;em&gt;Structured data format specification&lt;&#x2F;em&gt; is used to describe how to format all the fields of a single function or EIP-712 message. It is contained in a single json object under each sub-keys of &lt;code&gt;display.formats&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;$id&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;This key is purely internal and used to specify a human-readable identifier for this specification.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;intent&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Use to specify the &lt;em&gt;intent&lt;&#x2F;em&gt; of the function call or message signature in a user-friendly way.&lt;&#x2F;p&gt;
&lt;p&gt;An intent can take two forms:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A simple string with human-readable content&lt;&#x2F;li&gt;
&lt;li&gt;A json object with a flat list of string key-value pairs, representing more complex intents. Both keys and values should be human-readable and user-friendly.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Wallets SHOULD use this &lt;code&gt;intent&lt;&#x2F;code&gt; value to display a clear intent when reviewing the structured data before signature. When displaying a complex json intent, it is expected that keys represent labels, and values should be displayed after their label.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;display&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;formats&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;withdraw(uint256)&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;intent&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;Native Staking&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Withdraw&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;Rewards&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Consensus &amp;amp; Exec&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This snippet defines an intent for a withdrawal function on a contract, with an expectation that the intent would be displayed in a structured way on the wallet screen.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;interpolatedIntent&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;A string containing an intent description with embedded field values using &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7730&#x2F;#value-interpolation&quot;&gt;interpolation syntax&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Wallets MUST display either &lt;code&gt;interpolatedIntent&lt;&#x2F;code&gt; strings or screens generated from &lt;code&gt;intent&lt;&#x2F;code&gt; and individual &lt;code&gt;fields&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Wallets MAY display both fields, with &lt;code&gt;interpolatedIntent&lt;&#x2F;code&gt; as the primary description.&lt;&#x2F;p&gt;
&lt;p&gt;Interpolated paths MUST reference fields that have corresponding format specifications in the &lt;code&gt;fields&lt;&#x2F;code&gt; array. The formatting applied during interpolation MUST match the formatting that would be applied if the field were displayed separately.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Example with complex intent:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;intent&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;Action&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Approve&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;Type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Batch&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;interpolatedIntent&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Approve {spender} to spend up to {amount} on your behalf until {deadline}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;path&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;spender&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;label&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Spender&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;addressName&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;path&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;label&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;tokenAmount&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;path&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;deadline&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;label&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Deadline&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;date&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;fields&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;fields&lt;&#x2F;code&gt; key defines formatting information for individual fields of the structured data (function or message).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;fields&lt;&#x2F;code&gt; is an array of elements, each element being either:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A single &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7730&#x2F;#field-format-specification&quot;&gt;&lt;em&gt;field format specification&lt;&#x2F;em&gt;&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;A reference to a format specification in the &lt;code&gt;definitions&lt;&#x2F;code&gt; section: by declaring an object with two keys, a &lt;code&gt;path&lt;&#x2F;code&gt; key with the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7730&#x2F;#path-references&quot;&gt;path&lt;&#x2F;a&gt; to the field being formatted, and a &lt;code&gt;$ref&lt;&#x2F;code&gt; key with a path to the internal definition.
&lt;ul&gt;
&lt;li&gt;A reference object can override a field format specification &lt;code&gt;params&lt;&#x2F;code&gt; by including its own &lt;code&gt;params&lt;&#x2F;code&gt; sub-key, whose values will take precedence over the common definition&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;A group of fields, defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7730&#x2F;#group-format-specification&quot;&gt;&lt;em&gt;Group format specification&lt;&#x2F;em&gt;&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;Grouping&lt;&#x2F;em&gt; fields allows for both control of the way wallets should order the display of fields and &lt;em&gt;recursivity&lt;&#x2F;em&gt; of fields definitions, which can be a more readable form for the 7730 file itself.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Examples&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Let&#x27;s assume the following solidity contract&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MyContract&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MyParamType&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Function declaration&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; myFunction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; MyParamType&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; param&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Function logic here&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The following ERC-7730 shows examples for the three kinds of &lt;code&gt;fields&lt;&#x2F;code&gt; options&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;display&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;formats&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;myFunction(address account,uint256 amount,(string name,uint256 value) param)&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; :&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;path&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;account&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;$ref&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;$.display.definitions.sendTo&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eoa&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;path&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;label&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Number of items&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;raw&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;path&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;param&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;path&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;$ref&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;$.display.definitions.itemName&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;path&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;$ref&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;$.display.definitions.itemReference&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;account&lt;&#x2F;code&gt; field is an example of an internal reference (reference not included in the example), overriding the reference &lt;code&gt;type&lt;&#x2F;code&gt; parameter with another value.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;amount&lt;&#x2F;code&gt; field shows an example of a simple formatter, displaying an int in its natural representation with a label.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;param&lt;&#x2F;code&gt; field shows an example of defining formatters with a recursive structure, ending up defining two embedded formatters for paths &lt;code&gt;#.param.name&lt;&#x2F;code&gt; and &lt;code&gt;#.param.value&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note that the recursive definition is equivalent to the following definition, which is the preferred form:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;display&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;formats&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;myFunction(address account,uint256 amount,MyParamType param)&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; :&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;path&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;param.name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;$ref&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;$.display.definitions.itemName&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;path&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;param.value&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;$ref&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;$.display.definitions.itemReference&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;field-format-specification&quot;&gt;Field format specification&lt;&#x2F;h4&gt;
&lt;p&gt;A &lt;em&gt;field format specification&lt;&#x2F;em&gt; is a json object defining how to format a single field of the structured data.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;path&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;value&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The path is the absolute or relative location of the field in the structured data, following the rules in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7730&#x2F;#path-references&quot;&gt;path section&lt;&#x2F;a&gt;. Instead of &lt;code&gt;path&lt;&#x2F;code&gt;, a literal &lt;code&gt;value&lt;&#x2F;code&gt; may be provided to display a constant without looking up a field.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;label&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;A displayable string shown before the formatted field value.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;format&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Indicates how the field value must be transformed for display. Supported format identifiers are listed in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7730&#x2F;#field-formats&quot;&gt;Reference&lt;&#x2F;a&gt; section.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;params&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Optional object containing formatter-specific parameters. Available parameters are described alongside each format in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7730&#x2F;#field-formats&quot;&gt;Reference&lt;&#x2F;a&gt; section.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Array references in parameters&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;When a formatter applies to an array, the parameters CAN also reference a path to an array. In that case, wallets should format each element of the array using the parameter value at the same index as the current element being formatted. Parameter arrays should be the same length as the formatted array else the wallet SHOULD raise an error.&lt;&#x2F;p&gt;
&lt;p&gt;See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7730&#x2F;.&#x2F;assets&#x2F;example-array-iteration.json&quot;&gt;example-array-iteration.json&lt;&#x2F;a&gt; for examples on array iteration.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;$id&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Optional internal identifier to help authors distinguish or reference the field definition; not intended for end-user display.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;visible&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Optional rule to apply before displaying a field. Rules allow defining under which conditions a field should be displayed. If not specified, the field is assumed to be always visible (ie, default value is &lt;code&gt;&quot;visible&quot;=&quot;always&quot;&lt;&#x2F;code&gt;). Current supported rules are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A simple string with values among &lt;code&gt;[never,always,optional]&lt;&#x2F;code&gt;, with the following meaning
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;never&quot;&lt;&#x2F;code&gt;: Never display this field to users (this field should be &lt;em&gt;excluded&lt;&#x2F;em&gt; from the UI).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;always&lt;&#x2F;code&gt;: Always display this field to users (this field is &lt;em&gt;required&lt;&#x2F;em&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;optional&lt;&#x2F;code&gt;: Wallets MAY display this field if possible or sensible.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;An object with keys representing complex rules, with the following complex rules supported:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ifNotIn&lt;&#x2F;code&gt; key with an array of values to make the field visible only when the field value does NOT match any of the specified values&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;mustMatch&lt;&#x2F;code&gt; key with an array of values to make the field always hidden AND check its value against the list. Wallet should raise an error if the value does not match the list.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;separator&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Optional separator string to display before each element of an array. Can only be used be used for formatters that are applied to a path pointing to an array. Each element of the array is formatted using the provided formatter, and the &lt;code&gt;separator&lt;&#x2F;code&gt; value is displayed before each element. &lt;code&gt;separator&lt;&#x2F;code&gt; is a string using the interpolated syntax with one specific replacement &lt;code&gt;{index}&lt;&#x2F;code&gt; that gets replaced with the index of current element being displayed.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;encryption&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Optional object indicating the field value is encrypted. When present, it provides all the relevant information on how to handle the decryption process, in particular the encryption scheme used to produce the encrypted value.&lt;&#x2F;p&gt;
&lt;p&gt;An &lt;code&gt;encryption&lt;&#x2F;code&gt; key is a json object with:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A &lt;code&gt;scheme&lt;&#x2F;code&gt; key, providing the wallet an hint on encryption scheme used. Refer to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7730&#x2F;#encryption-schemes&quot;&gt;encryption schemes&lt;&#x2F;a&gt; for reference values.&lt;&#x2F;li&gt;
&lt;li&gt;A &lt;code&gt;plaintextType&lt;&#x2F;code&gt; key providing the solidity type of the decrypted field. The wallet SHOULD verify that the formatter is applicable to the &lt;code&gt;plaintextType&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;An optional &lt;code&gt;fallbackLabel&lt;&#x2F;code&gt; to display when the wallet cannot decrypt the field.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Fields MAY declare an &lt;code&gt;encryption&lt;&#x2F;code&gt; object to indicate that the on-chain value is an encrypted amount (or a pointer to an encrypted amount), typically a &lt;code&gt;bytes32&lt;&#x2F;code&gt;. When decryption is available, wallets SHOULD decrypt first and then apply the field &lt;code&gt;format&lt;&#x2F;code&gt; to the plaintext. When decryption is not available, wallets SHOULD display a clear encrypted placeholder (optionally using &lt;code&gt;fallbackLabel&lt;&#x2F;code&gt;) and are RECOMMENDED to also show the raw encrypted value (or its pointer), either fully or partially.&lt;&#x2F;p&gt;
&lt;p&gt;Because encrypted values do not reveal their underlying type on-chain, authors SHOULD provide &lt;code&gt;plaintextType&lt;&#x2F;code&gt; so wallets can correctly format decrypted values.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Example&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;path&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;encryptedAmount&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;label&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;tokenAmount&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;tokenPath&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;@.to&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;encryption&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;scheme&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;fhevm&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;plaintextType&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;fallbackLabel&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;[Encrypted Amount]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;group-format-specification&quot;&gt;Group format specification&lt;&#x2F;h4&gt;
&lt;p&gt;A &lt;em&gt;Group format specification&lt;&#x2F;em&gt; is a json object defining how to format a group of fields of the structured data.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;path&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The absolute or relative path to the field location in the structured data, as described in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7730&#x2F;#path-references&quot;&gt;path section&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;path&lt;&#x2F;code&gt; is optional, in which case the group refer to the path of the embedding &lt;code&gt;fields&lt;&#x2F;code&gt; definition.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;label&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Optional displayable string that should be shown before displaying the fields described in this group.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;iteration&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Key controlling how arrays in the group should be iterated over when formatting the group. It can only be applied to groups containing arrays.&lt;&#x2F;p&gt;
&lt;p&gt;It supports two modes &lt;code&gt;sequential&lt;&#x2F;code&gt; and &lt;code&gt;bundled&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;In &lt;code&gt;sequential&lt;&#x2F;code&gt; mode, arrays are displayed fully one after the other - array_0[0] array_0[1] .. array_0[N] array_1[0] array_1[1] .. array_1[M]&lt;&#x2F;li&gt;
&lt;li&gt;In &lt;code&gt;bundled&lt;&#x2F;code&gt; mode, elements of the arrays gets bundled together - array_0[0] array_1[0] array_0[1] array_1[1] .. array_0[N] array_1[N]
&lt;ul&gt;
&lt;li&gt;In this mode, the arrays of the group MUST be the same size else the wallet SHOULD return an error&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Defining groups of fields allows for controlling the &lt;em&gt;order&lt;&#x2F;em&gt; in which wallets should display fields. Wallets SHOULD display fields in the order in which they appear in the group defintion. For this grouping purpose, the top level &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7730&#x2F;#structured-data-format-specification&quot;&gt;Structured data format specification&lt;&#x2F;a&gt; is also considered a group.&lt;&#x2F;p&gt;
&lt;p&gt;Recursive path references work by concatenating the paths of the parents &lt;em&gt;structured data format specification&lt;&#x2F;em&gt;, all the way to the leaf, to build a full reference path to the field being described. The leaf should be either a &lt;em&gt;field format specification&lt;&#x2F;em&gt;, or a reference to a &lt;em&gt;field format specification&lt;&#x2F;em&gt; in the &lt;code&gt;definitions&lt;&#x2F;code&gt; section.&lt;&#x2F;p&gt;
&lt;p&gt;This recursivity allows structuring the ERC-7730 file itself, but is NOT RECOMMENDED. It is expected that resource limited wallets will only support very limited recursivity in the ERC-7730 file itself, so the initial intent of the spec is to &quot;flatten&quot; the list of fields to display using the &lt;em&gt;path&lt;&#x2F;em&gt; mechanics.&lt;&#x2F;p&gt;
&lt;p&gt;See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7730&#x2F;.&#x2F;assets&#x2F;example-array-iteration.json&quot;&gt;example-array-iteration.json&lt;&#x2F;a&gt; for examples on grouping and group iteration control.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;slices-in-paths&quot;&gt;Slices in paths&lt;&#x2F;h4&gt;
&lt;p&gt;A slice can be applied at the end of paths.&lt;&#x2F;p&gt;
&lt;p&gt;A slice on a primitive type like uint256, bytes and string means that the associated &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7730&#x2F;#field-format-specification&quot;&gt;field format specification&lt;&#x2F;a&gt; MUST only be applied to the corresponding slice of bytes of the underlying data.&lt;&#x2F;p&gt;
&lt;p&gt;A slice on an array type means that the associated &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7730&#x2F;#field-format-specification&quot;&gt;field format specification&lt;&#x2F;a&gt; or recursive &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7730&#x2F;#structured-data-format-specification&quot;&gt;structured data format specification&lt;&#x2F;a&gt; MUST be applied to ALL the array elements part of the slice.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Example&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;display&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;formats&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;exactOutput((bytes path, address recipient, uint256 deadline, uint256 amountOut, uint256 amountInMaximum) params)&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;path&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;params.amountInMaximum&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;label&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Maximum Amount to Send&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;tokenAmount&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;tokenPath&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;params.path.[0:20]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;tokenPath&lt;&#x2F;code&gt; parameter uses a slice on a &lt;code&gt;bytes&lt;&#x2F;code&gt; value, indicating only the first 20 bytes should be taken as the address and used as the reference for the formatting of the corresponding token amount.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;display&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;formats&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;buyOnMySwap(address router,uint256 amountIn,uint256 amountOutMin,address tokenPathStart,uint256[] pools)&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;path&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;pools.[-1]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;label&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Last pool&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;raw&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This examples uses an array slice to indicate that only the last element of the &lt;code&gt;pools&lt;&#x2F;code&gt; array should be displayed using the &lt;code&gt;raw&lt;&#x2F;code&gt; format.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;display&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;formats&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;PermitBatch(PermitDetails[] details,address spender,uint256 sigDeadline) PermitDetails(address token,uint160 amount,uint48 expiration,uint48 nonce)&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;intent&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Approve token spending&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;interpolatedIntent&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Approve {spender} to spend multiple tokens until {sigDeadline}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;path&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;details.[]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;path&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;label&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Amount allowance&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;tokenAmount&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;tokenPath&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;token&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;path&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;expiration&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;label&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Approval expires&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;date&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;encoding&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;timestamp&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;path&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;spender&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;label&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Spender&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;addressName&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;path&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;sigDeadline&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;label&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Signature Deadline&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;date&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;encoding&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;timestamp&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This example uses a full array selector &lt;code&gt;details.[]&lt;&#x2F;code&gt; to apply the list of the underlying two underlying formats to ALL the elements of the &lt;code&gt;details&lt;&#x2F;code&gt; array.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;embedded-calldata&quot;&gt;Embedded Calldata&lt;&#x2F;h4&gt;
&lt;p&gt;Embedded calldata is used when a parameter of a smart contract function contains the calldata for another function call to a smart contract.
This pattern is common in contract interactions where one function call triggers another function call as part of its execution.
For example, the &lt;code&gt;permitAndCall&lt;&#x2F;code&gt; function verifies a permit and then executes another function within the same contract using the provided embedded calldata.
Here is an example of how to format embedded calldata:&quot;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;display&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;formats&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;permitAndCall(bytes permit,bytes action)&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;intent&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Execute with permit&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;path&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;action&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;label&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Swap&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;calleePath&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;@.to&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;required&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;action&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;excluded&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;permit&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In this example, the &lt;code&gt;permitAndCall&lt;&#x2F;code&gt; function accepts two parameters: &lt;code&gt;permit&lt;&#x2F;code&gt; and &lt;code&gt;action&lt;&#x2F;code&gt;.
The &lt;code&gt;action&lt;&#x2F;code&gt; parameter contains the calldata for a subsequent function call.
The &lt;code&gt;format&lt;&#x2F;code&gt; field is set to &lt;code&gt;calldata&lt;&#x2F;code&gt;, instructing the wallet to interpret the action parameter as embedded calldata.
The &lt;code&gt;calleePath&lt;&#x2F;code&gt; parameter defines the path to the address of the target contract, while the optional &lt;code&gt;selector&lt;&#x2F;code&gt; parameter specifies the function selector if it is not the first 4 bytes of the calldata.
When displaying the transaction, the wallet will attempt to resolve an ERC-7730 descriptor for the embedded calldata using the callee address and the selector.
In some cases, embedded calldata may require a transaction value and&#x2F;or a spender to be properly clear-signed, as the underlying function might rely on a value passed from the parent transaction (e.g., for swaps or staking).
To handle this, the &lt;code&gt;amountPath&lt;&#x2F;code&gt; and&#x2F;or &lt;code&gt;spenderPath&lt;&#x2F;code&gt; parameters can be used to specify these values explicitly.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;display&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;formats&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;permitAndCall(bytes permit,address target,bytes action)&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;intent&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Execute with permit&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;path&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;action&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;label&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Swap&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;calleePath&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;target&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;amountPath&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;@.value&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;spenderPath&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;@.to&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;required&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;action&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;target&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;excluded&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;permit&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;reference&quot;&gt;Reference&lt;&#x2F;h3&gt;
&lt;h3 id=&quot;container-structure-values&quot;&gt;Container structure values&lt;&#x2F;h3&gt;
&lt;p&gt;This section describes all container structure supported by this specification and possible references path to relevant values.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;evm-transaction-container&quot;&gt;EVM Transaction container&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Value reference&lt;&#x2F;th&gt;&lt;th&gt;Value Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;@.from&lt;&#x2F;td&gt;&lt;td&gt;The address of the sender of the transaction&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;@.value&lt;&#x2F;td&gt;&lt;td&gt;The native currency value of the transaction&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;@.to&lt;&#x2F;td&gt;&lt;td&gt;The destination address of the containing transaction, ie the target smart contract address&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;@.chainId&lt;&#x2F;td&gt;&lt;td&gt;The chainId of the transaction&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;eip-712-container&quot;&gt;EIP-712 container&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Value reference&lt;&#x2F;th&gt;&lt;th&gt;Value Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;@.from&lt;&#x2F;td&gt;&lt;td&gt;The address of the signer of the message&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;@.value&lt;&#x2F;td&gt;&lt;td&gt;EIP-712 have no underlying currency value transferred, so a wallet MAY interpret it as 0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;@.to&lt;&#x2F;td&gt;&lt;td&gt;The verifying contract address, when known. If not known a wallet SHOULD reject using the ERC-7730 file to clear sign the message&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;@.chainId&lt;&#x2F;td&gt;&lt;td&gt;The chainId of the verifying contract, when known. If not known a wallet SHOULD reject using the ERC-7730 file to clear sign the message.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;field-formats&quot;&gt;Field formats&lt;&#x2F;h3&gt;
&lt;p&gt;In the following references, the format title is the value to use under the &lt;code&gt;format&lt;&#x2F;code&gt; key of a &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7730&#x2F;#field-format-specification&quot;&gt;&lt;em&gt;field format specification&lt;&#x2F;em&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;integer-formats&quot;&gt;Integer formats&lt;&#x2F;h4&gt;
&lt;p&gt;Formats applicable to &lt;code&gt;uint&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;int&lt;&#x2F;code&gt; solidity types.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;strong&gt;&lt;code&gt;raw&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;em&gt;Description&lt;&#x2F;em&gt;&lt;&#x2F;td&gt;&lt;td&gt;Display the integer as a raw int in natural, localized representation&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;em&gt;Parameters&lt;&#x2F;em&gt;&lt;&#x2F;td&gt;&lt;td&gt;None&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;em&gt;Examples&lt;&#x2F;em&gt;&lt;&#x2F;td&gt;&lt;td&gt;Value 1000 displayed as &lt;code&gt;1000&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;strong&gt;&lt;code&gt;amount&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;em&gt;Description&lt;&#x2F;em&gt;&lt;&#x2F;td&gt;&lt;td&gt;Display as an amount in native currency, using best ticker &#x2F; magnitude match&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;em&gt;Parameters&lt;&#x2F;em&gt;&lt;&#x2F;td&gt;&lt;td&gt;None&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;em&gt;Examples&lt;&#x2F;em&gt;&lt;&#x2F;td&gt;&lt;td&gt;Value 0x2c1c986f1c48000 is displayed as &lt;code&gt;0.19866144 ETH&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;strong&gt;&lt;code&gt;tokenAmount&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;em&gt;Description&lt;&#x2F;em&gt;&lt;&#x2F;td&gt;&lt;td&gt;Convert value using token decimals, and append token ticker name. If value is above optional &lt;code&gt;threshold&lt;&#x2F;code&gt;, display instead &lt;code&gt;message&lt;&#x2F;code&gt; with ticker.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;em&gt;Parameters&lt;&#x2F;em&gt;&lt;&#x2F;td&gt;&lt;td&gt;---&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;tokenPath&lt;&#x2F;code&gt; or &lt;code&gt;token&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Path reference, or constant value for the address of the token contract. Used to associate correct ticker. If ticker is not found or &lt;code&gt;tokenPath&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;token&lt;&#x2F;code&gt; is not set, the wallet SHOULD display the raw value instead with an &quot;Unknown token&quot; warning&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;nativeCurrencyAddress&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Either a string or an array of strings. If the address pointed to by &lt;code&gt;tokenPath&lt;&#x2F;code&gt; is equal to one of the addresses in &lt;code&gt;nativeCurrencyAddress&lt;&#x2F;code&gt;, the tokenAmount is interpreted as expressed in native currency&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;threshold&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;integer value, above which value is displayed as a special message. Optional&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;message&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;message to display above threshold. Optional, defaults to &quot;Unlimited&quot;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;chainIdPath&lt;&#x2F;code&gt; or &lt;code&gt;chainId&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Optional. The chain on which the token is deployed (constant or path). When present, the wallet SHOULD resolve token metadata (ticker, decimals) for this chain. Useful for cross-chain swap clear signing where the same token address may refer to different chains. At most one of &lt;code&gt;chainId&lt;&#x2F;code&gt; and &lt;code&gt;chainIdPath&lt;&#x2F;code&gt; may be set.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;em&gt;Examples&lt;&#x2F;em&gt;&lt;&#x2F;td&gt;&lt;td&gt;---&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;1 DAI&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Field value = 1000000 &lt;br&gt; &lt;code&gt;tokenPath&lt;&#x2F;code&gt; =0x6B17...1d0F (DAI, 6 decimals)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;Unlimited DAI&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Field value = 0xFFFFFFFF &lt;br&gt; &lt;code&gt;token&lt;&#x2F;code&gt; =0x6B17...1d0F (DAI, 6 decimals) &lt;br&gt; &lt;code&gt;threshold&lt;&#x2F;code&gt; &quot;0xFFFFFFFF&quot;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;Max DAI&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Field value = 0xFFFFFFFF &lt;br&gt; &lt;code&gt;tokenPath&lt;&#x2F;code&gt; =0x6B17...1d0F (DAI, 6 decimals) &lt;br&gt; &lt;code&gt;threshold&lt;&#x2F;code&gt; &quot;0xFFFFFFFF&quot; &lt;br&gt; &lt;code&gt;message&lt;&#x2F;code&gt; = &quot;Max&quot;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0.002 ETH&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Field value = 2000000000000000 &lt;br&gt; &lt;code&gt;tokenPath&lt;&#x2F;code&gt; = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE &lt;br&gt; &lt;code&gt;nativeCurrencyAddress&lt;&#x2F;code&gt; = [&quot;0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE&quot;]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;strong&gt;&lt;code&gt;nftName&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;em&gt;Description&lt;&#x2F;em&gt;&lt;&#x2F;td&gt;&lt;td&gt;Display value as a specific NFT in a collection, if found by wallet, or fallback to a raw int token ID if not&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;em&gt;Parameters&lt;&#x2F;em&gt;&lt;&#x2F;td&gt;&lt;td&gt;---&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;collectionPath&lt;&#x2F;code&gt; or &lt;code&gt;collection&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;A path reference, or constant value for the collection address&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;em&gt;Examples&lt;&#x2F;em&gt;&lt;&#x2F;td&gt;&lt;td&gt;---&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;Collection Name: BoredApeYachtClub&lt;&#x2F;code&gt; &lt;br&gt; &lt;code&gt;Token ID: 1036&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Field Value = 1036 &lt;br&gt; &lt;code&gt;collectionPath&lt;&#x2F;code&gt; = &quot;&quot;0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;strong&gt;&lt;code&gt;date&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;em&gt;Description&lt;&#x2F;em&gt;&lt;&#x2F;td&gt;&lt;td&gt;Display int as a date, using specified encoding. Date display RECOMMENDED use of RFC 3339&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;em&gt;Parameters&lt;&#x2F;em&gt;&lt;&#x2F;td&gt;&lt;td&gt;---&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;&quot;encoding&quot;: &quot;timestamp&quot;&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;value is encoded as a unix timestamp&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;&quot;encoding&quot;: &quot;blockheight&quot;&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;value is a blockheight and is converted to an approximate unix timestamp&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;em&gt;Examples&lt;&#x2F;em&gt;&lt;&#x2F;td&gt;&lt;td&gt;---&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;2024-02-29T08:27:12&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Field Value = 1709191632 &lt;br&gt; &lt;code&gt;encoding&lt;&#x2F;code&gt; = &quot;timestamp&quot;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;2024-02-29T09:00:35&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Field Value = 19332140 &lt;br&gt; &lt;code&gt;encoding&lt;&#x2F;code&gt; = &quot;blockheight&quot;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;strong&gt;&lt;code&gt;duration&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;em&gt;Description&lt;&#x2F;em&gt;&lt;&#x2F;td&gt;&lt;td&gt;Display int as a duration interpreted in seconds and represented as a duration HH:MM:ss&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;em&gt;Parameters&lt;&#x2F;em&gt;&lt;&#x2F;td&gt;&lt;td&gt;None&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;em&gt;Examples&lt;&#x2F;em&gt;&lt;&#x2F;td&gt;&lt;td&gt;---&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;02:17:30&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Field Value = 8250&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;strong&gt;&lt;code&gt;unit&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;em&gt;Description&lt;&#x2F;em&gt;&lt;&#x2F;td&gt;&lt;td&gt;Value is converted to a float using &lt;code&gt;decimals&lt;&#x2F;code&gt; (&lt;code&gt;value &#x2F; 10^decimals&lt;&#x2F;code&gt;) and displayed appending the corresponding unit. If &lt;code&gt;prefix&lt;&#x2F;code&gt; is true, the value is further converted to scientific representation, minimizing the significand and converting the exponent to an SI prefix added in front of the unit symbol&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;em&gt;Parameters&lt;&#x2F;em&gt;&lt;&#x2F;td&gt;&lt;td&gt;---&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;base&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The symbol of the base unit, an SI unit or other acceptable symbols like &quot;%&quot;, &quot;bps&quot;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;decimals&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Number of decimals in integer representation, defaults to 0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;prefix&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;A boolean indicating whether an SI prefix should be appended, defaults to &lt;code&gt;False&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;em&gt;Examples&lt;&#x2F;em&gt;&lt;&#x2F;td&gt;&lt;td&gt;---&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;10h&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Field Value = 10 &lt;br&gt; &lt;code&gt;base&lt;&#x2F;code&gt; = &quot;h&quot;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;1.5d&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Field Value = 15 &lt;br&gt; &lt;code&gt;base&lt;&#x2F;code&gt; = &quot;d&quot; &lt;br&gt; &lt;code&gt;decimals&lt;&#x2F;code&gt; = 1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;36ks&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Field Value = 36000 &lt;br&gt; &lt;code&gt;base&lt;&#x2F;code&gt; = &quot;s&quot; &lt;br&gt; &lt;code&gt;prefix&lt;&#x2F;code&gt; = True&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;strong&gt;&lt;code&gt;enum&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;em&gt;Description&lt;&#x2F;em&gt;&lt;&#x2F;td&gt;&lt;td&gt;Value is converted using referenced constant enumeration values&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;em&gt;Parameters&lt;&#x2F;em&gt;&lt;&#x2F;td&gt;&lt;td&gt;---&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;$ref&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;An internal path (starting with root node &lt;code&gt;$.&lt;&#x2F;code&gt;) to an enumerations in &lt;code&gt;metadata.constants&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;em&gt;Examples&lt;&#x2F;em&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;strong&gt;&lt;code&gt;chainId&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;em&gt;Description&lt;&#x2F;em&gt;&lt;&#x2F;td&gt;&lt;td&gt;Value is converted to a Blockchain name using EIP-155 reference values&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;em&gt;Parameters&lt;&#x2F;em&gt;&lt;&#x2F;td&gt;&lt;td&gt;None&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;em&gt;Examples&lt;&#x2F;em&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;Ethereum Mainnet&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Field Value = 1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;string-formats&quot;&gt;String formats&lt;&#x2F;h4&gt;
&lt;p&gt;Formats applicable to for &lt;code&gt;string&lt;&#x2F;code&gt; solidity type.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;strong&gt;&lt;code&gt;raw&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;em&gt;Description&lt;&#x2F;em&gt;&lt;&#x2F;td&gt;&lt;td&gt;Display as an UTF-8 encoded string&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;em&gt;Parameters&lt;&#x2F;em&gt;&lt;&#x2F;td&gt;&lt;td&gt;None&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;em&gt;Examples&lt;&#x2F;em&gt;&lt;&#x2F;td&gt;&lt;td&gt;---&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;Ledger&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Field Value = [&#x27;4c&#x27;,&#x27;65&#x27;,&#x27;64&#x27;,&#x27;67&#x27;,&#x27;65&#x27;,&#x27;72&#x27;]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;bytes-formats&quot;&gt;Bytes formats&lt;&#x2F;h4&gt;
&lt;p&gt;Formats applicable to &lt;code&gt;bytes&lt;&#x2F;code&gt; solidity type.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;strong&gt;&lt;code&gt;raw&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;em&gt;Description&lt;&#x2F;em&gt;&lt;&#x2F;td&gt;&lt;td&gt;Display byte array as an hex-encoded string&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;em&gt;Parameters&lt;&#x2F;em&gt;&lt;&#x2F;td&gt;&lt;td&gt;None&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;em&gt;Examples&lt;&#x2F;em&gt;&lt;&#x2F;td&gt;&lt;td&gt;---&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;123456789A&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Field Value = Value [&#x27;12&#x27;,&#x27;34&#x27;,&#x27;56&#x27;,&#x27;78&#x27;,&#x27;9a&#x27;]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;strong&gt;&lt;code&gt;calldata&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;em&gt;Description&lt;&#x2F;em&gt;&lt;&#x2F;td&gt;&lt;td&gt;Contains a call to another smart contract or to another function within the same contract. To resolve an ERC-7730 descriptor for this embedded calldata, use the &lt;code&gt;callee&lt;&#x2F;code&gt; and &lt;code&gt;selector&lt;&#x2F;code&gt; parameters. If no matching ERC-7730 descriptor is found or if the wallet does not support embedded calldata, it MAY display a hash of the embedded calldata instead, with target &lt;code&gt;calleePath&lt;&#x2F;code&gt; resolved to a trusted name if possible.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;em&gt;Parameters&lt;&#x2F;em&gt;&lt;&#x2F;td&gt;&lt;td&gt;---&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;calleePath&lt;&#x2F;code&gt; or &lt;code&gt;callee&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;A path reference or a constant value specifying the address of the contract being called.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;selectorPath&lt;&#x2F;code&gt; or &lt;code&gt;selector&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Optional. If omitted, the first 4 bytes of the calldata are used as the selector.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;chainIdPath&lt;&#x2F;code&gt; or &lt;code&gt;chainId&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Optional. Specifies the chain ID if it differs from the current contract’s chain.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;amountPath&lt;&#x2F;code&gt; or &lt;code&gt;amount&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Optional. Specifies the native currency amount associated with the calldata, if applicable. If provided, the ERC-7730 descriptor for this embedded calldata MAY reference this value using the &lt;code&gt;@.value&lt;&#x2F;code&gt; container path.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;spenderPath&lt;&#x2F;code&gt; or &lt;code&gt;spender&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Optional. Specifies the spender address associated with the calldata, if applicable. If provided, the ERC-7730 descriptor for this embedded calldata MAY reference this value using the &lt;code&gt;@.from&lt;&#x2F;code&gt; container path.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;em&gt;Examples&lt;&#x2F;em&gt;&lt;&#x2F;td&gt;&lt;td&gt;---&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;address&quot;&gt;Address&lt;&#x2F;h4&gt;
&lt;p&gt;Formats applicable to &lt;code&gt;address&lt;&#x2F;code&gt; solidity type.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;strong&gt;&lt;code&gt;raw&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;em&gt;Description&lt;&#x2F;em&gt;&lt;&#x2F;td&gt;&lt;td&gt;Display address as an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;55&#x2F;&quot;&gt;EIP-55&lt;&#x2F;a&gt; formatted string. Truncation is device dependent&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;em&gt;Parameters&lt;&#x2F;em&gt;&lt;&#x2F;td&gt;&lt;td&gt;None&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;em&gt;Examples&lt;&#x2F;em&gt;&lt;&#x2F;td&gt;&lt;td&gt;---&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x5aAe...eAed&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Field Value 0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;strong&gt;&lt;code&gt;addressName&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;em&gt;Description&lt;&#x2F;em&gt;&lt;&#x2F;td&gt;&lt;td&gt;Display address as a trusted name if a trusted source exists, an EIP-55 formatted address otherwise. See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7730&#x2F;#address-types-and-sources&quot;&gt;next section&lt;&#x2F;a&gt; for a reference of trusted sources&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;em&gt;Parameters&lt;&#x2F;em&gt;&lt;&#x2F;td&gt;&lt;td&gt;---&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;types&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;An array of expected types of the address (see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7730&#x2F;#address-types-and-sources&quot;&gt;next section&lt;&#x2F;a&gt;). If set, the wallet SHOULD check that the address matches one of the types provided&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;sources&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;An array of acceptable sources for names (see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7730&#x2F;#address-types-and-sources&quot;&gt;next section&lt;&#x2F;a&gt;). If set, the wallet SHOULD restrict name lookup to relevant sources&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;senderAddress&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Either a string or an array of strings. If the address pointed to by &lt;code&gt;addressName&lt;&#x2F;code&gt; is equal to one of the addresses in &lt;code&gt;senderAddress&lt;&#x2F;code&gt;, the addressName is interpreted as the sender referenced by &lt;code&gt;@.from&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;em&gt;Examples&lt;&#x2F;em&gt;&lt;&#x2F;td&gt;&lt;td&gt;---&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;vitalik.eth&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Field Value 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045 &lt;br&gt; &lt;code&gt;types&lt;&#x2F;code&gt; = [&quot;eoa&quot;] (Externally Owned Account) &lt;br&gt; &lt;code&gt;sources&lt;&#x2F;code&gt; = [&quot;ens&quot;] (Ethereum Name Service)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;Uniswap V3: WBTC-USDC&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Field Value 0x99ac8cA7087fA4A2A1FB6357269965A2014ABc35 &lt;br&gt; &lt;code&gt;types&lt;&#x2F;code&gt; = [&quot;contract&quot;]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;Sender&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Field Value 0x0000000000000000000000000000000000000000 &lt;br&gt; &lt;code&gt;senderAddress&lt;&#x2F;code&gt; = [&quot;0x0000000000000000000000000000000000000000&quot;] &lt;br&gt; &lt;code&gt;types&lt;&#x2F;code&gt; = [&quot;eoa&quot;]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;hr &#x2F;&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;strong&gt;&lt;code&gt;tokenTicker&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;em&gt;Description&lt;&#x2F;em&gt;&lt;&#x2F;td&gt;&lt;td&gt;Display address as an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; token ticker&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;em&gt;Parameters&lt;&#x2F;em&gt;&lt;&#x2F;td&gt;&lt;td&gt;---&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;chainIdPath&lt;&#x2F;code&gt; or &lt;code&gt;chainId&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Optional. The chain on which the token is deployed (constant or path). When present, the wallet SHOULD resolve the token ticker for this chain. Useful for cross-chain swap clear signing. At most one of &lt;code&gt;chainId&lt;&#x2F;code&gt; and &lt;code&gt;chainIdPath&lt;&#x2F;code&gt; may be set.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;em&gt;Examples&lt;&#x2F;em&gt;&lt;&#x2F;td&gt;&lt;td&gt;---&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MYTOKEN&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Field Value 0xaabbccddeeff....&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;interoperable-addresses&quot;&gt;Interoperable addresses&lt;&#x2F;h4&gt;
&lt;p&gt;Interoperable address format applicable to solidity type &lt;code&gt;bytes&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;strong&gt;&lt;code&gt;interoperableAddressName&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;em&gt;Description&lt;&#x2F;em&gt;&lt;&#x2F;td&gt;&lt;td&gt;Display bytes as an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7930&#x2F;&quot;&gt;ERC-7930&lt;&#x2F;a&gt; Interoperable Name. The wallet SHOULD parse the binary format, extract the target address and chain, and display it in the standard &lt;code&gt;&amp;lt;address&amp;gt; @ &amp;lt;chain&amp;gt; # &amp;lt;checksum&amp;gt;&lt;&#x2F;code&gt; format.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;em&gt;Parameters&lt;&#x2F;em&gt;&lt;&#x2F;td&gt;&lt;td&gt;---&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;types&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;An array of expected types of the address (see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7730&#x2F;#address-types-and-sources&quot;&gt;next section&lt;&#x2F;a&gt;). If set, the wallet SHOULD check that the address matches one of the types provided&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;sources&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;An array of acceptable sources for names (see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7730&#x2F;#address-types-and-sources&quot;&gt;next section&lt;&#x2F;a&gt;). If set, the wallet SHOULD restrict name lookup to relevant sources&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;senderAddress&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Either a string or an array of strings. If the address pointed to by &lt;code&gt;addressName&lt;&#x2F;code&gt; is equal to one of the addresses in &lt;code&gt;senderAddress&lt;&#x2F;code&gt;, the addressName is interpreted as the sender referenced by &lt;code&gt;@.from&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;em&gt;Examples&lt;&#x2F;em&gt;&lt;&#x2F;td&gt;&lt;td&gt;---&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045@eip155:1#4CA88C9C&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Field Value = &lt;code&gt;0x00010000010114D8DA6BF26964AF9D7EED9E03E53415D37AA96045&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;address-types-and-sources&quot;&gt;Address types and sources&lt;&#x2F;h4&gt;
&lt;p&gt;Address names trusted sources specify which type and source of trusted names SHOULD be used to replace an address with a human-readable names.&lt;&#x2F;p&gt;
&lt;p&gt;When specified a wallet MUST only use specified sources to resolve address names. Wallet MUST verify the type of the address if able to.&lt;&#x2F;p&gt;
&lt;p&gt;When omitted, a wallet MAY use any source to resolve an address.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Address type&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;wallet&lt;&#x2F;td&gt;&lt;td&gt;Address is an account controlled by the wallet&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;eoa&lt;&#x2F;td&gt;&lt;td&gt;Address is an Externally Owned Account&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;contract&lt;&#x2F;td&gt;&lt;td&gt;Address is a well known smart contract&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;token&lt;&#x2F;td&gt;&lt;td&gt;Address is a well known ERC-20 token&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;collection&lt;&#x2F;td&gt;&lt;td&gt;Address is a well known NFT collection&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;A wallet MAY verify that a &lt;code&gt;wallet&lt;&#x2F;code&gt; address is in fact controlled by the wallet, and reject signing if not the case.&lt;&#x2F;p&gt;
&lt;p&gt;Sources values are wallet manufacturer specific. Some example values could be:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Source type&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;local&lt;&#x2F;td&gt;&lt;td&gt;Address MAY be replaced with a local name trusted by user. Wallets MAY consider that &lt;code&gt;local&lt;&#x2F;code&gt; setting for &lt;code&gt;sources&lt;&#x2F;code&gt; is always valid&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;ens&lt;&#x2F;td&gt;&lt;td&gt;Address MAY be replaced with an associated ENS domain&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;encryption-schemes&quot;&gt;Encryption schemes&lt;&#x2F;h3&gt;
&lt;p&gt;List of currently supported encryption schemes hints for fields&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Scheme&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;fhevm&lt;&#x2F;td&gt;&lt;td&gt;FHEVM full homomorphic encryption&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;human-readability&quot;&gt;Human readability&lt;&#x2F;h3&gt;
&lt;p&gt;It is expected that the main limitation to adoption of ERC-7730 will be the complexity of writing this interface description file compared to interest of writing it.&lt;&#x2F;p&gt;
&lt;p&gt;This drove a few choices when introducing this ERC specification:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The form of an ERC itself will allow usage of these file by any wallets (Hardware or Software, without restrictions), and in turn drive up the benefits for app developers to provide their own ERC-7730 description&lt;&#x2F;li&gt;
&lt;li&gt;The specification is intended to be directly readable by developers, in order to facilitate direct edition by developers.&lt;&#x2F;li&gt;
&lt;li&gt;In addition, a set of edition tools will be created and open sourced to ease visualization of the results for end users&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;wallet-limitations&quot;&gt;Wallet limitations&lt;&#x2F;h3&gt;
&lt;p&gt;Wide support by wallets is key for adoption of this specification.&lt;&#x2F;p&gt;
&lt;p&gt;Hardware wallets tend to have more limited capabilities that will impact what they can display securely, especially since the intention of the specification is to create a strong security binding between the spec and the data being reviewed.&lt;&#x2F;p&gt;
&lt;p&gt;This consideration is driving a few choices done for ERC-7730:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Complex UI constructs like layouts, grouping and re-ordering of fields have been left to a wallet specific section, yet unspecified. After a time, we may see patterns emerge between wallets in terms of minimal features.&lt;&#x2F;li&gt;
&lt;li&gt;Representation of fields has been created to allow &quot;flattening&quot; the list of fields, when handling complex message structures. This flattened representation is expected to work better with Hardware wallets in particular, and is recommended at first.&lt;&#x2F;li&gt;
&lt;li&gt;Some formatters that require recursive constructs, like &lt;code&gt;calldata&lt;&#x2F;code&gt; are expected to work with restrictions at first, especially on Hardware wallets.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;internationalization&quot;&gt;Internationalization&lt;&#x2F;h3&gt;
&lt;p&gt;This specification intentionally does not address internationalization or localization of displayable strings.&lt;&#x2F;p&gt;
&lt;p&gt;All display strings in ERC-7730 files—including intents, labels, field names, and enumeration values—are expected to be authored in English.&lt;&#x2F;p&gt;
&lt;p&gt;Future versions of this specification may consider standardized internationalization support once the base standard achieves wider adoption and the ecosystem can better assess the need for multilingual support.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;user-operations-eip-4337&quot;&gt;User Operations (EIP-4337)&lt;&#x2F;h3&gt;
&lt;p&gt;Clear signing &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;EIP-4337&lt;&#x2F;a&gt; User Operations is supported using the &lt;code&gt;PackedUserOperation&lt;&#x2F;code&gt; EIP-712 signature format. See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7730&#x2F;.&#x2F;assets&#x2F;example-userops-eip712.json&quot;&gt;example-userops-eip-712.json&lt;&#x2F;a&gt; for a reference implementation.&lt;&#x2F;p&gt;
&lt;p&gt;The inner calldata typically contains an &lt;code&gt;execute&lt;&#x2F;code&gt; call to interact with other contracts. This can be clear signed using a separate ERC-7730 file - see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7730&#x2F;.&#x2F;assets&#x2F;example-account-execute.json&quot;&gt;example-account-execute.json&lt;&#x2F;a&gt;. Since execute functions are implementation-specific, each smart wallet will need its own ERC-7730 file.&lt;&#x2F;p&gt;
&lt;p&gt;Smart wallets commonly use a proxy pattern. Refer to the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7730&#x2F;#proxy-support&quot;&gt;Proxy support&lt;&#x2F;a&gt; section for guidance.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;batch-transactions-eip-5792&quot;&gt;Batch transactions (EIP-5792)&lt;&#x2F;h3&gt;
&lt;p&gt;When displaying batch transactions as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5792&#x2F;&quot;&gt;EIP-5792&lt;&#x2F;a&gt;, wallets SHOULD either:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Concatenate the &lt;code&gt;interpolatedIntent&lt;&#x2F;code&gt; strings of individual operations using &quot; and &quot; as a separator to create a single, human-readable description of the entire batch.&lt;&#x2F;li&gt;
&lt;li&gt;Concatenate screens generated using &lt;code&gt;intent&lt;&#x2F;code&gt; and required &lt;code&gt;fields&lt;&#x2F;code&gt;, clearly separating individual transactions&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;code&gt;interpolatedIntent&lt;&#x2F;code&gt; approach provides users with a clear, natural language summary of complex multi-step operations without requiring them to mentally piece together separate transaction descriptions. The &lt;code&gt;intent&lt;&#x2F;code&gt; approach provide a more controllable wallet UI for space limited wallets.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Permit + Swap example:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;permit&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;interpolatedIntent&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Approve {spender} to spend {value} USDC&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;swapExactTokensForTokens&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;interpolatedIntent&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Swap {amountIn} for at least {amountOutMin}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Combined display: &lt;strong&gt;&quot;Approve Uniswap Router to spend 1000 USDC and Swap 1000 USDC for at least 0.25 WETH&quot;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Approve + Swap example:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;approve&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;interpolatedIntent&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Approve {_spender} to spend {_value}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;exactInputSingle&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;interpolatedIntent&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Swap {amountIn} for at least {amountOutMinimum}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Combined display: &lt;strong&gt;&quot;Approve Uniswap V3 Router to spend 5000 DAI and Swap 5000 DAI for at least 1.2 ETH&quot;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Approve + Swap + Mint NFT example:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;approve&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;interpolatedIntent&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Approve {_spender} to spend {_value}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;swapExactTokensForETH&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;interpolatedIntent&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Swap {amountIn} for at least {amountOutMin} ETH&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;mint&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;interpolatedIntent&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Mint {quantity} NFT(s) from {collection}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Combined display: &lt;strong&gt;&quot;Approve DEX Router to spend 2000 USDC and Swap 2000 USDC for at least 0.5 ETH and Mint 2 NFT(s) from NftProject&quot;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Implementation guidance for batch transactions using interpolatedIntents&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Wallets implementing batch transaction display SHOULD:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Process each transaction in the batch to generate its &lt;code&gt;interpolatedIntent&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Join the resulting intent strings with &quot; and &quot; (note the spaces)&lt;&#x2F;li&gt;
&lt;li&gt;Display the combined string as a single transaction summary&lt;&#x2F;li&gt;
&lt;li&gt;Provide a way for users to view individual transaction details if needed&lt;&#x2F;li&gt;
&lt;li&gt;Fall back to displaying individual &lt;code&gt;intent&lt;&#x2F;code&gt; fields if any &lt;code&gt;interpolatedIntent&lt;&#x2F;code&gt; processing fails&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Wallets MAY:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Apply additional formatting (e.g., capitalizing the first letter, adding a period at the end)&lt;&#x2F;li&gt;
&lt;li&gt;Truncate very long combined intents and provide expansion UI&lt;&#x2F;li&gt;
&lt;li&gt;Group related operations visually while still showing the combined intent&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;extensibility-to-other-structured-data-formats&quot;&gt;Extensibility to other structured data formats&lt;&#x2F;h3&gt;
&lt;p&gt;In the future, this specification could be extended to structured data like Meta Transaction in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2771&#x2F;&quot;&gt;EIP-2771&lt;&#x2F;a&gt;, User Operations in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;EIP-4337&lt;&#x2F;a&gt;, and batch transaction payloads in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5792&#x2F;&quot;&gt;EIP-5792&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;interpolatedIntent&lt;&#x2F;code&gt; field is particularly well-suited for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5792&#x2F;&quot;&gt;EIP-5792&lt;&#x2F;a&gt; batch transactions, as it enables wallets to concatenate multiple operation descriptions into a single, natural language sentence. By joining individual &lt;code&gt;interpolatedIntent&lt;&#x2F;code&gt; strings with &quot; and &quot;, wallets can provide users with clear, readable summaries of complex multi-step operations like &quot;Approve Uniswap Router to spend 1000 USDC and Swap 1000 USDC for at least 0.25 WETH&quot;. This significantly improves the user experience when reviewing batch transactions compared to displaying separate, disconnected operation descriptions. See the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7730&#x2F;#value-interpolation&quot;&gt;Value Interpolation&lt;&#x2F;a&gt; section for detailed implementation guidance and examples.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;common-keywords&quot;&gt;Common keywords&lt;&#x2F;h3&gt;
&lt;p&gt;The DeFi ecosystem has matured and has some repeating usecases with well defined terms for different actions. While this ERC does not define specific standards for DEX or Lending protocol intents, for the sake of easier user readibility, teams with similar products should align on similar terminology to describe actions and actors. We encourage the creation of another layer of standardization on top of ERC-7730 to be recommeneded and even enforced in clear signing registries for improved user security.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;More examples can be found in the asset folder.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;File name&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7730&#x2F;.&#x2F;assets&#x2F;example-main.json&quot;&gt;example-main.json&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Simple example of a basic ERC-7730 file&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7730&#x2F;.&#x2F;assets&#x2F;example-erc20.json&quot;&gt;example-erc-20.json&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Simple example of defining an interface for ERC-20 contracts&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7730&#x2F;.&#x2F;assets&#x2F;example-include.json&quot;&gt;example-include.json&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Example of including an interface into another ERC-7730 file&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7730&#x2F;.&#x2F;assets&#x2F;example-eip712.json&quot;&gt;example-eip-712.json&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Clear signing EIP-712 example&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7730&#x2F;.&#x2F;assets&#x2F;example-array-iteration.json&quot;&gt;example-array-iteration.json&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Examples of various array iteration modes and field grouping features&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7730&#x2F;.&#x2F;assets&#x2F;example-maps.json&quot;&gt;example-maps.json&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Example of maps of constants&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7730&#x2F;.&#x2F;assets&#x2F;example-maps-pools.json&quot;&gt;example-maps-pools.json&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Example of maps of constants&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7730&#x2F;.&#x2F;assets&#x2F;example-visibility-rules.json&quot;&gt;example-visibility-rules.json&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Example of controlling the visibility of fields&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7730&#x2F;.&#x2F;assets&#x2F;example-account-execute.json&quot;&gt;example-account-execute.json&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Example of EIP-4337 smart wallet execute function clear signing&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7730&#x2F;.&#x2F;assets&#x2F;example-userops-eip712.json&quot;&gt;example-userops-eip-712.json&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Example of EIP-4337 User Operation clear signing&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;ERC-7730 creates a risk surface where malicious actors could abuse formatting to make unsafe transactions appear benign. In addition to misapplied or malformed files, implementers should anticipate phishing techniques such as (a) parameter injection using legitimate, high-profile contract formats, (b) registry poisoning with well-formed but misleading entries, and (c) front-end&#x2F;CDN compromise that prompts signatures for unexpected contracts or parameters.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;binding-context&quot;&gt;Binding context&lt;&#x2F;h3&gt;
&lt;p&gt;The binding &lt;code&gt;context&lt;&#x2F;code&gt; mitigates misuse by specifying exactly which structured data a given ERC-7730 file may format. app developers MUST set restrictive constraints; wallets MUST verify all constraints and ensure formatting is cryptographically bound to the reviewed data and not tamperable in transit (including on resource-constrained hardware wallets).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;registry-poisoning&quot;&gt;Registry poisoning&lt;&#x2F;h3&gt;
&lt;p&gt;Curation and registry of ERC-7730 files are out of scope for this specification, but any external registry or wallet ecosystem MUST assume it will be targeted. A secure registry should (a) require cryptographically verifiable provenance and attestations for each ERC-7730 file and its maintainer, (b) keep a public, tamper-evident history of submissions, approvals, and revocations, (c) implement a mechanism to credibly link contract ownership or authority to the submitted file, and (d) adopt a clear governance model with multi-party sign-off and automated monitoring to detect anomalies or mass poisoning attempts. These measures mitigate attacks on ERC-7730 files in transit and make registry compromise significantly harder without constraining this ERC itself.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;external-data-resolution&quot;&gt;External data resolution&lt;&#x2F;h3&gt;
&lt;p&gt;ERC-7730 formatting relies on resolving various external data sources to provide human-readable information. This resolution introduces trust assumptions that wallets must understand when showing ERC-7730 information.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Trust assumptions&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The transition from transaction data to human readable data requires trust in external data sources to resolve some parts of the presentation layer. Without the resolution, it&#x27;s not readable and missed the whole point of the ERC, with the resolution it adds a risk factor:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Token metadata&lt;&#x2F;strong&gt; (tickers, decimals) A token address translated to a token ticker and proper decimals applied to the &lt;code&gt;tokenAmount&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;NFT collection names&lt;&#x2F;strong&gt; and token metadata for the &lt;code&gt;nftName&lt;&#x2F;code&gt; format&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Address resolution&lt;&#x2F;strong&gt; when formatting &lt;code&gt;addressName&lt;&#x2F;code&gt; using ENS or similar tools&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Malicious or compromised data sources could:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Display incorrect token names, leading users to believe they are approving transactions for legitimate tokens when they are not&lt;&#x2F;li&gt;
&lt;li&gt;Display malicious addresses as if it is a trusted address name&lt;&#x2F;li&gt;
&lt;li&gt;Present fake NFT collection names to obscure the true nature of transactions&lt;&#x2F;li&gt;
&lt;li&gt;Provide misleading enumeration values that misrepresent transaction parameters&lt;&#x2F;li&gt;
&lt;li&gt;Supply modified ABIs that change how transaction data is interpreted&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Example attack scenarios&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Token name spoofing&lt;&#x2F;strong&gt;: A malicious ERC-7730 file references a fake token contract at address &lt;code&gt;0x1234...&lt;&#x2F;code&gt; that returns &quot;USDT&quot; as its ticker and 6 decimals, making a transaction appear to transfer legitimate USDT when it actually transfers a worthless token.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Address name substitution&lt;&#x2F;strong&gt;: A compromised ENS resolver returns a malicious address naming resolution causing a send to an address not anticipated&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;strong&gt;Mitigations&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Wallets SHOULD:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Maintain curated lists of well-known addresses (tokens, contracts, collections) and warn users when encountering unknown entities&lt;&#x2F;li&gt;
&lt;li&gt;Display full addresses alongside resolved names in some form&lt;&#x2F;li&gt;
&lt;li&gt;Clearly indicate the source and trust level of resolved names and metadata&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Wallets MUST:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Display clear warnings when external data cannot be resolved or verified (e.g., &quot;Unknown token&quot;)&lt;&#x2F;li&gt;
&lt;li&gt;Never fallback to presenting untrusted information as if it was trusted and verified&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;proxy-support&quot;&gt;Proxy support&lt;&#x2F;h3&gt;
&lt;p&gt;The proxy pattern is widely use in Ethereum in multiple scenarios to provide flexibility to essentially immutable contracts:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Making smart contracts &lt;em&gt;upgradable&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Making smart contracts &lt;em&gt;composable&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Creating multiple &lt;em&gt;instances&lt;&#x2F;em&gt; of a reference implementation&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;These patterns are often used in conjunction. Supporting those patterns require some considerations from both smart contract developers and wallets.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Upgradeable proxy contracts&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Upgradeable proxy contracts (such as Transparent Proxies or UUPS proxies as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1822&#x2F;&quot;&gt;EIP-1822&lt;&#x2F;a&gt;) use a fixed proxy address that delegates calls to a replaceable implementation contract. For these contracts, the ERC-7730 file SHOULD be bound to the &lt;em&gt;proxy&lt;&#x2F;em&gt; address, since this is the stable address users interact with.&lt;&#x2F;p&gt;
&lt;p&gt;When an upgrade introduces breaking ABI changes (new functions, modified signatures, or removed functions), developers SHOULD update the ERC-7730 file in the registry accordingly. Since the old implementation is no longer callable after the upgrade, the previous ERC-7730 definitions can be safely replaced.&lt;&#x2F;p&gt;
&lt;p&gt;Wallets need to ensure they use the latest version of the registry and match the transaction target against the &lt;em&gt;proxy&lt;&#x2F;em&gt; address.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Composable contracts&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Composable contracts, like Diamond proxies, aggregate through a single &lt;em&gt;proxy&lt;&#x2F;em&gt; address, multiple implementation facets. Each facet has its own ABI.&lt;&#x2F;p&gt;
&lt;p&gt;A good pattern to support diamond proxies is to introduce an ERC-7730 file for each facet, without any context info, and use the composability of ERC-7730 files to create an overarching ERC-7730 file that includes all implemented facets of a proxy and bound to the final &lt;em&gt;proxy&lt;&#x2F;em&gt; address.&lt;&#x2F;p&gt;
&lt;p&gt;Similarly wallets just need to ensure they have the latest version of the registry and that the target address is the &lt;em&gt;proxy&lt;&#x2F;em&gt; address.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Multi-instanciation&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;This pattern is typically used by smart wallet factories to efficiently deploy many smart wallets relying on a single, secure implementation.&lt;&#x2F;p&gt;
&lt;p&gt;It is not efficient nor advisable to deploy an ERC-7730 for &lt;em&gt;each&lt;&#x2F;em&gt; smart wallet address. In this case, it is recommended to bind the ERC-7730 file to the &lt;em&gt;implementation&lt;&#x2F;em&gt; address of the smart wallet and rely on the user&#x27;s wallet to detect that the target address is actually a proxy to a well known implementation address.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;interpolated-intent-security&quot;&gt;Interpolated intent security&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;interpolatedIntent&lt;&#x2F;code&gt; feature introduces additional attack surfaces that wallets MUST mitigate:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Injection attacks&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Malicious contracts could craft parameter values that, when interpolated, create misleading intent descriptions. For example:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A token name containing &quot;to vitalik.eth&quot; could make &quot;Send {amount} to {recipient}&quot; appear as &quot;Send 100 USDT to vitalik.eth to 0x123...&quot;&lt;&#x2F;li&gt;
&lt;li&gt;Addresses with misleading ENS names could obscure the true destination&lt;&#x2F;li&gt;
&lt;li&gt;Very long formatted values could push critical information off-screen&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;Mitigations:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Wallets MUST apply the same formatting and validation to interpolated values as they would for separately displayed fields&lt;&#x2F;li&gt;
&lt;li&gt;Wallets MUST validate that ENS names and other address labels are verified before interpolation&lt;&#x2F;li&gt;
&lt;li&gt;Wallets SHOULD display field values separately in addition to the interpolated intent, or provide easy access to detailed field view&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Format consistency&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Wallets MUST ensure that the formatting applied during interpolation exactly matches the formatting that would be applied if the field were displayed separately. This prevents attackers from exploiting differences in formatting to hide malicious values.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Implementation requirement:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The interpolation engine MUST use the same formatter functions and parameters specified in the corresponding field format specification&lt;&#x2F;li&gt;
&lt;li&gt;If a path in &lt;code&gt;interpolatedIntent&lt;&#x2F;code&gt; does not have a corresponding field format specification, interpolation MUST fail and fall back to &lt;code&gt;intent&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Path validation&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Wallets MUST validate that all paths in interpolation expressions:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Follow the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7730&#x2F;#path-references&quot;&gt;path reference rules&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Reference fields that exist in the structured data being signed&lt;&#x2F;li&gt;
&lt;li&gt;Have corresponding field format specifications in the &lt;code&gt;fields&lt;&#x2F;code&gt; array&lt;&#x2F;li&gt;
&lt;li&gt;Do not create circular references or unbounded recursion&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;strong&gt;Fallback behavior&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;If interpolation fails for any reason (invalid path, formatting error, missing field specification, validation failure), wallets MUST:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Fall back to displaying the static &lt;code&gt;intent&lt;&#x2F;code&gt; field&lt;&#x2F;li&gt;
&lt;li&gt;Display all fields separately according to their field format specifications&lt;&#x2F;li&gt;
&lt;li&gt;NOT attempt to partially process the interpolated intent&lt;&#x2F;li&gt;
&lt;li&gt;Optionally warn the user that the dynamic description could not be generated&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;strong&gt;Resource constraints&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Hardware wallets and other resource-constrained devices MAY choose not to implement &lt;code&gt;interpolatedIntent&lt;&#x2F;code&gt; support. The &lt;code&gt;intent&lt;&#x2F;code&gt; field MUST always be present as a fallback for such devices.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Testing and validation&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;ERC-7730 file authors SHOULD test &lt;code&gt;interpolatedIntent&lt;&#x2F;code&gt; strings with:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Minimum and maximum expected values for each interpolated field&lt;&#x2F;li&gt;
&lt;li&gt;Edge cases like zero amounts, maximum allowances, expired dates&lt;&#x2F;li&gt;
&lt;li&gt;Long addresses, token names, and other string fields to ensure proper truncation&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;encryption-support&quot;&gt;Encryption support&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;Display pointers to encrypted values&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Pointers to encrypted values MAY NOT be fully opaque handles, e.g. they MAY use meaningful prefixes or suffixes containing metadata about the encrypted value. When only partially displaying pointers, wallets SHOULD NOT display these structured parts so that users can discriminate different encrypted values.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;future-work&quot;&gt;Future work&lt;&#x2F;h3&gt;
&lt;p&gt;Future improvements could bind frontends to verified contract manifests so that a compromised UI cannot silently substitute a different contract. Clear, auditable registry governance (multi-party signoff, monitoring, and revocation) can further raise the cost of phishing, parameter injection, and front-end compromise attacks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Puppet Proxy Contract</title>
        <published>2024-02-04T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Igor Żuk</name><uri>https://github.com/CodeSandwich</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7613/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7613-puppet-proxy-contract/18482" />
        

        <id>https://wg-eips.ritovision.com/7613/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7613"
            label="ERC-7613" />
        

        
        

        
        <summary type="html">A proxy that, if called by its deployer, delegates to an implementation specified in calldata.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7613/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;A puppet is a contract that, when called, acts like an empty account. It doesn&#x27;t do anything and it has no API, except when it is called by the address that deployed it. In that case, it delegates the call to the address passed to it in calldata. This gives the deployer the ability to execute any logic they want in the context of the puppet.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;A puppet can be used as an alternative account of its deployer. It has a different address, so it has a separate set of asset balances. This enables sophisticated accounting, e.g. each user of a protocol can get their own address where assets can be sent and stored. The user may call the protocol contract, which in turn will deploy a new puppet and consider it assigned to the user. If the puppet is deployed under a predictable address, e.g. by using the user&#x27;s address as the CREATE2 salt, the puppet may not even need to be deployed before funds are sent to its address. From now on the protocol will consider all the assets sent to the puppet as owned by the user. If the protocol needs to move the funds out from the puppet address, it can call the puppet ordering it to delegate to a function transferring the assets to arbitrary addresses, or making arbitrary calls triggering approved transfers to other contracts.&lt;&#x2F;p&gt;
&lt;p&gt;Puppets can be used as an alternative to approved transfers when loading funds into the protocol. Any contract and any wallet can transfer the funds to the puppet address assigned to the user without making any approvals or calling the protocol contracts. Funds can be loaded across multiple transactions and potentially from multiple sources. To funnel funds from another protocol, there&#x27;s no need for integration in the 3rd party contracts as long as they are capable of transferring funds to an arbitrary address. Wallets limited to plain &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; transfers and stripped of any web3 functionality can be used to load funds into the protocol. The users of the fully featured wallets don&#x27;t need to sign opaque calldata blobs that may be harmful or approve the protocol to take their tokens, they only need to make a transfer, which is a simple process with a familiar UX. When the funds are already stored in the puppet assigned to the user, somebody needs to call the protocol so it&#x27;s notified that the funds were loaded. Depending on the protocol and its API this call may or may not be permissionless potentially making the UX even more convenient with gasless transactions or 3rd parties covering the gas cost. Some protocols don&#x27;t need the users to specify what needs to be done with the loaded funds or they allow the users to configure that in advance. Most of the protocols using approved transfers to load funds may benefit from using the puppets.&lt;&#x2F;p&gt;
&lt;p&gt;The puppet&#x27;s logic doesn&#x27;t need to be ever upgraded. To change its behavior the deployer needs to change the address it passes to the puppet to delegate to or the calldata it passes for delegation. The entire fleet of puppets deployed by a single contract can be upgraded by upgrading the contract that deployed them, without using beacons. A nice trick is that the deployer can make the puppet delegate to the address holding the deployer&#x27;s own logic, so the puppet&#x27;s logic is encapsulated in the deployer&#x27;s.&lt;&#x2F;p&gt;
&lt;p&gt;A puppet is unable to expose any API to any caller except the deployer. If a 3rd party needs to be able to somehow make the puppet execute some logic, it can&#x27;t be requested by directly calling the puppet. Instead, the deployer needs to expose a function that if called by the 3rd parties, will call the puppet, and make it execute the desired logic. Mechanisms expecting contracts to expose some APIs don&#x27;t work with puppet, e.g. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;&#x27;s &lt;code&gt;safeTransfer&lt;&#x2F;code&gt;s.&lt;&#x2F;p&gt;
&lt;p&gt;This standard defines the puppet as a blob of bytes used as creation code, which enables integration with many frameworks and codebases written in variety of languages. The specific tooling is outside of the scope of this standard, but it should be easy to create the libraries and helpers necessary for usage in practice. All the implementations will be interoperable because they will be creating identical puppets and if CREATE2 is used, they will have deterministic addresses predictable by all implementations.&lt;&#x2F;p&gt;
&lt;p&gt;Because the puppet can be deployed under a predictable address despite having no fixed logic, in some cases it can be used as a CREATE3 alternative. It can be also used as a full replacement of the CREATE3 factory by using a puppet deployed using CREATE2 to deploy arbitrary code using plain CREATE.&lt;&#x2F;p&gt;
&lt;p&gt;Deploying a new puppet is almost as cheap as deploying a new clone proxy. Its whole deployed bytecode is 66 bytes, and its creation code is 62 bytes. Just like clone proxy, it can be deployed using just the Solidity scratch space in memory. The cost to deploy a puppet is 45K gas, only 4K more than a clone. Because the bytecode is not compiled, it can be reliably deployed under a predictable CREATE2 address regardless of the compiler version.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;To delegate, the deployer must prepend the calldata with an ABI-encoded address to delegate to.
All the data after the address will be passed verbatim as the delegation calldata.
If the caller isn&#x27;t the deployer, the calldata is shorter than 32 bytes, or it doesn&#x27;t start with
an address left-padded with zeros, the puppet doesn&#x27;t do anything.
This lets the deployer make a plain native tokens transfer to the puppet,
it will have an empty calldata, and the puppet will accept the transfer without delegating.&lt;&#x2F;p&gt;
&lt;p&gt;The puppet is deployed with this creation code:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x604260126D60203D3D3683113D3560A01C17733D3360147F331817604057823603803D943D373D3D355AF43D82803E903D91604057FD5BF36034525252F3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The bytecode breakdown:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; The creation code.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; [code 1] and [code 2] are parts of the deployed code,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; placed respectively before and after the deployer&amp;#39;s address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; | Opcode used    | Hex value     | Stack content after executing&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; Code size and offset in memory&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; | PUSH1          | 60 42         | 66&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; | PUSH1          | 60 12         | 18 66&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; The code before the deployer&amp;#39;s address and where it&amp;#39;s stored in memory&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; | PUSH14         | 6D [code 1]   | [code 1] 18 66&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; | RETURNDATASIZE | 3D            | 0 [code 1] 18 66&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; The deployer&amp;#39;s address and where it&amp;#39;s stored in memory&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; | CALLER         | 33            | [deployer] 0 [code 1] 18 66&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; | PUSH1          | 60 14         | 20 [deployer] 0 [code 1] 18 66&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; The code after the deployer&amp;#39;s address and where it&amp;#39;s stored in memory&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; | PUSH32         | 7F [code 2]   | [code 2] 20 [deployer] 0 [code 1] 18 66&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; | PUSH1          | 60 34         | 52 [code 2] 20 [deployer] 0 [code 1] 18 66&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; Return the entire code&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; | MSTORE         | 52            | 20 [deployer] 0 [code 1] 18 66&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; | MSTORE         | 52            | 0 [code 1] 18 66&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; | MSTORE         | 52            | 18 66&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; | RETURN         | F3            |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; The deployed code.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; `deployer` is the deployer&amp;#39;s address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; | Opcode used    | Hex value     | Stack content after executing&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; Push some constants&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; | PUSH1          | 60 20         | 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; | RETURNDATASIZE | 3D            | 0 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; | RETURNDATASIZE | 3D            | 0 0 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; Do not delegate if calldata shorter than 32 bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; | CALLDATASIZE   | 36            | [calldata size] 0 0 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; | DUP4           | 83            | 32 [calldata size] 0 0 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; | GT             | 11            | [do not delegate] 0 0 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; Do not delegate if the first word of calldata is not a zero-padded address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; | RETURNDATASIZE | 3D            | 0 [do not delegate] 0 0 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; | CALLDATALOAD   | 35            | [first word] [do not delegate] 0 0 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; | PUSH1          | 60 A0         | 160 [first word] [do not delegate] 0 0 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; | SHR            | 1C            | [first word upper bits] [do not delegate] 0 0 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; | OR             | 17            | [do not delegate] 0 0 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; Do not delegate if not called by the deployer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; | PUSH20         | 73 [deployer] | [deployer] [do not delegate] 0 0 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; | CALLER         | 33            | [sender] [deployer] [do not delegate] 0 0 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; | XOR            | 18            | [sender not deployer] [do not delegate] 0 0 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; | OR             | 17            | [do not delegate] 0 0 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; Skip to the return if should not delegate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; | PUSH1          | 60 40         | [success branch] [do not delegate] 0 0 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; | JUMPI          | 57            | 0 0 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; Calculate the payload size&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; | DUP3           | 82            | 32 0 0 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; | CALLDATASIZE   | 36            | [calldata size] 32 0 0 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; | SUB            | 03            | [payload size] 0 0 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; Copy the payload from calldata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; | DUP1           | 80            | [payload size] [payload size] 0 0 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; | RETURNDATASIZE | 3D            | 0 [payload size] [payload size] 0 0 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; | SWAP5          | 94            | 32 [payload size] [payload size] 0 0 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; | RETURNDATASIZE | 3D            | 0 32 [payload size] [payload size] 0 0 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; | CALLDATACOPY   | 37            | [payload size] 0 0 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; Delegate call&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; | RETURNDATASIZE | 3D            | 0 [payload size] 0 0 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; | RETURNDATASIZE | 3D            | 0 0 [payload size] 0 0 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; | CALLDATALOAD   | 35            | [delegate to] 0 [payload size] 0 0 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; | GAS            | 5A            | [gas] [delegate to] 0 [payload size] 0 0 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; | DELEGATECALL   | F4            | [success] 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; Copy return data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; | RETURNDATASIZE | 3D            | [return size] [success] 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; | DUP3           | 82            | 0 [return size] [success] 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; | DUP1           | 80            | 0 0 [return size] [success] 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; | RETURNDATACOPY | 3E            | [success] 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; Return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; | SWAP1          | 90            | 0 [success]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; | RETURNDATASIZE | 3D            | [return size] 0 [success]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; | SWAP2          | 91            | [success] 0 [return size]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; | PUSH1          | 60 40         | [success branch] [success] 0 [return size]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; | JUMPI          | 57            | 0 [return size]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; | REVERT         | FD            |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; | JUMPDEST       | 5B            | 0 [return size]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; | RETURN         | F3            |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The main goals of the puppet design are low cost and modularity. It should be cheap to deploy and cheap to interact with. The contract should be self-contained, simple to reason about, and easy to use as an architectural building block.&lt;&#x2F;p&gt;
&lt;p&gt;The puppet behavior could be implemented fairly easily in Solidity with some inline Yul for delegation. This would make the bytecode much larger and more expensive to deploy. It would also be different depending on the compiler version and configuration, so deployments under predictable addresses using CREATE2 would be trickier.&lt;&#x2F;p&gt;
&lt;p&gt;A workaround for the problems with the above solution could be to use the clone proxy pattern to deploy copies of the puppet implementation. It would make the cost to deploy each puppet a little lower than deploying the bytecode proposed in this document, and the addresses of the clones would be predictable when deploying using CREATE2. The downside is that now there would be 1 extra delegation for each call, from the clone proxy to the puppet implementation address, which costs gas. The architecture of such solution is also more complicated with more contracts involved, and it requires the initialization step of deploying the puppet implementation before any clone can be deployed. The initialization step limits the CREATE2 address predictability because the creation code of the clone proxy includes the implementation address, which affects the deployment address.&lt;&#x2F;p&gt;
&lt;p&gt;Another alternative is to use the beacon proxy pattern. Making a Solidity API call safely is a relatively complex procedure that takes up a non-trivial space in the bytecode. To lower the cost of the puppets, the beacon proxy probably should be used with the clone proxy, which would be even more complicated and more expensive to use than the above solutions. Querying a beacon for the delegation address is less flexible than passing it in calldata, it requires updating the state of the beacon to change the address.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;p&gt;The puppet bytecode doesn&#x27;t use PUSH0, because many chains don&#x27;t support it yet.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Here are the tests verifying that the bytecode and the reference implementation library are working as expected, using the Foundry test tools:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Test&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;forge-std&#x2F;Test.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Puppet&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;src&#x2F;Puppet.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Logic&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; ERROR &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Failure called&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    fallback&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; arg&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; arg&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; failure&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        revert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ERROR&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PuppetTest&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Test&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; puppet &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; Puppet&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;deploy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; logic &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Logic&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; logicFailurePayload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; Puppet&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;delegationCalldata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;logic&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodeWithSelector&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;Logic&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;failure&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; target&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;target&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; target&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        internal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt; success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; returned&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; target&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;call&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Unexpected revert&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; returned&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; testDeployDeterministic&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; salt &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;Puppet&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; newPuppet &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; Puppet&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;deployDeterministic&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;salt&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        assertEq&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            newPuppet&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Puppet&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;predictDeterministicAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;salt&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Invalid address&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        assertEq&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            newPuppet&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Puppet&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;predictDeterministicAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;salt&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Invalid address when no deployer&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        assertEq&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;newPuppet&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; puppet&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Invalid code&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; testPuppetDelegates&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; arg &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1234&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; data &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodeWithSelector&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;Logic&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;success&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; arg&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; payload &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; Puppet&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;delegationCalldata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;logic&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; value &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 5678&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; returned &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;puppet&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; payload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; thisAddr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt; receivedArg&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt; receivedValue&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;decode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;returned&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        assertEq&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;thisAddr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; puppet&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Invalid delegation context&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        assertEq&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;receivedArg&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; arg&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Invalid argument&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        assertEq&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;receivedValue&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Invalid value&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; testPuppetDelegatesWithEmptyCalldata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; payload &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; Puppet&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;delegationCalldata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;logic&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; returned &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;puppet&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; payload&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; data &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;decode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;returned&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        assertEq&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Delegated with non-empty calldata&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; testPuppetBubblesRevertPayload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        vm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;expectRevert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Logic&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;logic&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERROR&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;puppet&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; logicFailurePayload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; testPuppetDoesNothingForNonDeployer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        vm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;prank&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1234&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;puppet&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; logicFailurePayload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; testCallingWithCalldataShorterThan32BytesDoesNothing&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; delegateTo &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint160&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1234&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; payload &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes31&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint160&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;delegateTo&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        vm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;mockCallRevert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;delegateTo&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Logic called&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;puppet&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; payload&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; testCallingWithDelegationAddressOver20BytesDoesNothing&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; payload &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; logicFailurePayload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        payload&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;11&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x01&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;puppet&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; payload&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; testCallingPuppetDoesNothing&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Forge the calldata, so if puppet uses it to delegate, it will run `Logic.failure`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; forged &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint160&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        forged &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;Logic&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;failure&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; payload &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodeWithSignature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;abc(uint)&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; forged&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;puppet&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; payload&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; testTransferFromDeployerToPuppet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; amt &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 123&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        payable&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;puppet&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;amt&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        assertEq&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;puppet&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balance&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amt&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Invalid balance&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; testTransferToPuppet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; amt &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 123&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; sender &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;456&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        payable&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;amt&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        vm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;prank&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        payable&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;puppet&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;amt&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        assertEq&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;puppet&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balance&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amt&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Invalid balance&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The puppet bytecode is explained in the specification section. Here&#x27;s the example helper library:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;library&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Puppet&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; CREATION_CODE &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;604260126D60203D3D3683113D3560A01C17733D3360147F33181760405782&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;3603803D943D373D3D355AF43D82803E903D91604057FD5BF36034525252F3&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; CREATION_CODE_HASH &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;CREATION_CODE&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Deploy a new puppet.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; instance&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the puppet.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; deploy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; instance&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; creationCode &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; CREATION_CODE&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            instance &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; create&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;creationCode&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;creationCode&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;instance &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Failed to deploy the puppet&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Deploy a new puppet under a deterministic address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; salt&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The salt to use for the deterministic deployment.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; instance&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the puppet.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; deployDeterministic&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; salt&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; instance&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; creationCode &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; CREATION_CODE&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            instance &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; create2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;creationCode&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;creationCode&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; salt&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;instance &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Failed to deploy the puppet&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Calculate the deterministic address for a puppet deployment made by this contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; salt&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The salt to use for the deterministic deployment.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; predicted&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the puppet.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; predictDeterministicAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; salt&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; predicted&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; predictDeterministicAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;salt&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Calculate the deterministic address for a puppet deployment.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; salt&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The salt to use for the deterministic deployment.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; deployer&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the deployer of the puppet.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; predicted&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the puppet.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; predictDeterministicAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; salt&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; deployer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        internal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        pure&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; predicted&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; hash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;ff&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; deployer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; salt&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; CREATION_CODE_HASH&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint160&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;hash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; delegationCalldata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; delegateTo&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        internal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        pure&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; payload&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint160&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;delegateTo&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The bytecode is made to resemble clone proxy&#x27;s wherever it makes sense to simplify auditing.&lt;&#x2F;p&gt;
&lt;p&gt;ABI-encoding the delegation address protects the deployer from being tricked by a 3rd party into calling the puppet and making it delegate to an arbitrary address. Such scenario would only be possible if the deployer called on the puppet a function with the selector &lt;code&gt;0x00000000&lt;&#x2F;code&gt;, which as of now doesn&#x27;t come from any reasonably named function.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Atomic Push-based Data Feed Among Contracts</title>
        <published>2024-02-03T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Elaine Zhang</name><uri>https://github.com/lanyinzly</uri><email>lz8aj@virginia.edu</email>
	</author>
	
	<author>
		<name>Jerry</name><email>jerrymindflow@gmail.com</email>
	</author>
	
	<author>
		<name>Amandafanny</name><email>amandafanny200@gmail.com</email>
	</author>
	
	<author>
		<name>Shouhao Wong</name><uri>https://github.com/wangshouh</uri><email>wongshouhao@outlook.com</email>
	</author>
	
	<author>
		<name>Doris Che</name><uri>https://github.com/Cheyukj</uri><email>dorischeyy@gmail.com</email>
	</author>
	
	<author>
		<name>Henry Yuan</name><uri>https://github.com/onehumanbeing</uri><email>hy2878@nyu.edu</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7615/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7615-smart-contract-data-push-mechanism/18466" />
        

        <id>https://wg-eips.ritovision.com/7615/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7615"
            label="ERC-7615" />
        

        
        

        
        <summary type="html">An Atomic Mechanism to Allow Publisher Contract Push Data to Subcriber Contracts</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7615/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC proposes a push-based mechanism for sending data, allowing publisher contract to automatically push certain data to subscriber contracts during a call. The specific implementation relies on two interfaces: one for publisher contract to push data, and another for the subscriber contract to receive data. When the publisher contract is called, it checks if the called function corresponds to subscriber addresses. If it does, the publisher contract push data to the subscriber contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, there are many keepers rely on off-chain data or seperate data collection process to monitor the events on chain. This proposal aims to establish a system where the publisher contract can atomicly push data to inform subscriber contracts about the updates. The direct on-chain interaction bewteen the publisher and the subscriber allows the system to be more trustless and efficient.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal will offer significant advantages across a range of applications, such as enabling the boundless and permissionless expansion of DeFi, as well as enhancing DAO governance, among others.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;lending-protocol&quot;&gt;Lending Protocol&lt;&#x2F;h3&gt;
&lt;p&gt;An example of publisher contract could be an oracle, which can automatically push the price update through initiating a call to the subscriber protocol. The lending protocol, as the subscriber, can automatically liquidate the lending positions based on the received price.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;automatic-payment&quot;&gt;Automatic Payment&lt;&#x2F;h3&gt;
&lt;p&gt;A service provider can use a smart contract as a publisher contract, so that when a user call this contract, it can push the information to the subsriber contracts, such as, the users&#x27; wallets like NFT bound accounts that follows &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6551&#x2F;&quot;&gt;ERC-6551&lt;&#x2F;a&gt; or other smart contract wallets. The user&#x27;s smart contract wallet can thus perform corresponding payment operations automatically. Compared to traditional &lt;code&gt;approve&lt;&#x2F;code&gt; needed approach, this solution allows more complex logic in implementation, such as limited payment, etc.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;pos-without-transferring-assets&quot;&gt;PoS Without Transferring Assets&lt;&#x2F;h3&gt;
&lt;p&gt;For some staking scenarios, especially NFT staking, the PoS contract can be set as the subscriber and the NFT contracts can be set as the publisher. Staking can thus achieved through contracts interation, allowing users to earn staking rewards without transferring assets.&lt;&#x2F;p&gt;
&lt;p&gt;When operations like &lt;code&gt;transfer&lt;&#x2F;code&gt; of NFT occur, the NFT contract can push this information to the PoS contract, which can then perform unstaking or other functions.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;dao-voting&quot;&gt;DAO Voting&lt;&#x2F;h3&gt;
&lt;p&gt;The DAO governance contract as a publisher could automatically triggers the push mechanism after the vote is completed, calling relevant subscriber contracts to directly implement the voting results, such as injecting funds into a certain account or pool.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”,  “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this  document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;overview&quot;&gt;Overview&lt;&#x2F;h3&gt;
&lt;p&gt;The push mechanism can be divided into the following four steps:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The publisher contract is called.&lt;&#x2F;li&gt;
&lt;li&gt;The publisher contract query the subscriber list from the &lt;code&gt;selector&lt;&#x2F;code&gt; of the function called. The subscriber contract can put the selected data into &lt;code&gt;inbox&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The publisher contract push &lt;code&gt;selector&lt;&#x2F;code&gt; and data through calling &lt;code&gt;exec&lt;&#x2F;code&gt; function of the subscriber contract.&lt;&#x2F;li&gt;
&lt;li&gt;The subscriber contract executes based on pushed &lt;code&gt;selector&lt;&#x2F;code&gt; and data, or it may request information from the publisher contract&#x27;s inbox function as needed.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;In the second step, the relationship between a called function and the corresponding subscriber can be configured in the publisher contract. Two configuration schemes are proposed:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Unconditional Push: Any call to the configured &lt;code&gt;selector&lt;&#x2F;code&gt; triggers a push&lt;&#x2F;li&gt;
&lt;li&gt;Conditional Push: Only the conditioned calls to the configured &lt;code&gt;selector&lt;&#x2F;code&gt; trigger a push based on the configuration.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;It&#x27;s allowed to configure multiple, different types of subscriber contracts for a single &lt;code&gt;selector&lt;&#x2F;code&gt;. The publisher contract will call the &lt;code&gt;exec&lt;&#x2F;code&gt; function of each subscriber contract to push the request.&lt;&#x2F;p&gt;
&lt;p&gt;When unsubscribing a contract from a &lt;code&gt;selector&lt;&#x2F;code&gt;, publisher contract MUST check whether &lt;code&gt;isLocked&lt;&#x2F;code&gt; function of the subscriber contract returns &lt;code&gt;true&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;It is OPTIONAL for a publisher contract to use the &lt;code&gt;inbox&lt;&#x2F;code&gt; mechanism to store data.&lt;&#x2F;p&gt;
&lt;p&gt;In the fourth step, the subscriber contract SHOULD handle all possible &lt;code&gt;selector&lt;&#x2F;code&gt; requests and data in the implementation of &lt;code&gt;exec&lt;&#x2F;code&gt; function. In some cases, &lt;code&gt;exec&lt;&#x2F;code&gt; MAY call &lt;code&gt;inbox&lt;&#x2F;code&gt; function of publisher contract to obtain the pushed data in full.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7615&#x2F;.&#x2F;assets&#x2F;ERC7615.svg&quot; alt=&quot;Workflow&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;contract-interface&quot;&gt;Contract interface&lt;&#x2F;h3&gt;
&lt;p&gt;As mentioned above, there are Unconditional Push and Conditional Push two types of implementation. To implement Unconditional Push, the publisher contract SHOULD implement the following interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;interface IPushForce {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    event ForceApprove(bytes4 indexed selector, address indexed target);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    event ForceCancel(bytes4 indexed selector, address indexed target);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    event RenounceForceApprove();&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    event RenounceForceCancel();&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    error MustRenounce();&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    error ForceApproveRenounced();&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    error ForceCancelRenounced();&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function isForceApproved(bytes4 selector, address target) external returns (bool);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function forceApprove(bytes4 selector, address target) external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function forceCancel(bytes4 selector, address target) external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function isRenounceForceApprove() external returns (bool);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function isRenounceForceCancel() external returns (bool);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function renounceForceApprove(bytes memory) external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function renounceForceCancel(bytes memory) external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;isForceApproved&lt;&#x2F;code&gt; is to query whether &lt;code&gt;selector&lt;&#x2F;code&gt; has already unconditionally bound to the subscriber contract with the address &lt;code&gt;target&lt;&#x2F;code&gt;.
&lt;code&gt;forceApprove&lt;&#x2F;code&gt; is to bind &lt;code&gt;selector&lt;&#x2F;code&gt; to the subscriber contract &lt;code&gt;target&lt;&#x2F;code&gt;. &lt;code&gt;forceCancel&lt;&#x2F;code&gt; is to cancel the binding relationship between &lt;code&gt;selector&lt;&#x2F;code&gt; and &lt;code&gt;target&lt;&#x2F;code&gt;, where &lt;code&gt;isLocked&lt;&#x2F;code&gt; function of &lt;code&gt;target&lt;&#x2F;code&gt; returns &lt;code&gt;true&lt;&#x2F;code&gt; is REQUIRED.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;renounceForceApprove&lt;&#x2F;code&gt; is used to relinquish the &lt;code&gt;forceApprove&lt;&#x2F;code&gt; permission. After calling the &lt;code&gt;renounceForceApprove&lt;&#x2F;code&gt; function, &lt;code&gt;forceApprove&lt;&#x2F;code&gt; can no longer be called. Similarly, &lt;code&gt;renounceForceCancel&lt;&#x2F;code&gt; is used to relinquish the &lt;code&gt;forceCancel&lt;&#x2F;code&gt; permission. After calling the &lt;code&gt;renounceForceCancel&lt;&#x2F;code&gt; function, &lt;code&gt;forceCancel&lt;&#x2F;code&gt; can no longer be called.&lt;&#x2F;p&gt;
&lt;p&gt;To implement Conditional Push, the publisher contract SHOULD implement the following interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;interface IPushFree {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    event Approve(bytes4 indexed selector, address indexed target, bytes data);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    event Cancel(bytes4 indexed selector, address indexed target, bytes data);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function inbox(bytes4 selector) external returns (bytes memory);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function isApproved(bytes4 selector, address target, bytes calldata data) external returns (bool);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function approve(bytes4 selector, address target, bytes calldata data) external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function cancel(bytes4 selector, address target, bytes calldata data) external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;isApproved&lt;&#x2F;code&gt;, &lt;code&gt;approve&lt;&#x2F;code&gt;, and &lt;code&gt;cancel&lt;&#x2F;code&gt; have functionalities similar to the corresponding functions in &lt;code&gt;IPushForce&lt;&#x2F;code&gt;. However, an additional &lt;code&gt;data&lt;&#x2F;code&gt; parameter is introduced here for checking whether a push is needed.
The &lt;code&gt;inbox&lt;&#x2F;code&gt; here is used to store data in case of being called from the subscriber contract.&lt;&#x2F;p&gt;
&lt;p&gt;The publisher contract SHOULD implement &lt;code&gt;_push(bytes4 selector, bytes calldata data)&lt;&#x2F;code&gt; function, which acts as a hook. Any function within the publisher contract that needs to implement push mechanism must call this internal function. The function MUST include querying both unconditional and conditional subscription contracts based on &lt;code&gt;selector&lt;&#x2F;code&gt; and &lt;code&gt;data&lt;&#x2F;code&gt;, and then calling corresponding &lt;code&gt;exec&lt;&#x2F;code&gt; function of the subscribers.&lt;&#x2F;p&gt;
&lt;p&gt;A subscriber need to implement the following interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IExec&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isLocked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; selector&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; exec&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; selector&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;exec&lt;&#x2F;code&gt; is to receive requests from the publisher contracts and further proceed to execute.
&lt;code&gt;isLocked&lt;&#x2F;code&gt; is to check the status of whether the subscriber contract can unsubscribe the publisher contract based on &lt;code&gt;selector&lt;&#x2F;code&gt; and &lt;code&gt;data&lt;&#x2F;code&gt;. It is triggered when a request to unsubscribe is received.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;unconditional-and-conditional-configuration&quot;&gt;Unconditional and Conditional Configuration&lt;&#x2F;h3&gt;
&lt;p&gt;When the sending contract is called, it is possible to trigger a push, requiring the caller to pay the resulting gas fees.
In some cases, an Unconditional Push is necessary, such as pushing price changes to a lending protocol. While, Conditional Push will reduce the unwanted gas consumption.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;check-islocked-before-unsubscribing&quot;&gt;Check &lt;code&gt;isLocked&lt;&#x2F;code&gt; Before Unsubscribing&lt;&#x2F;h3&gt;
&lt;p&gt;Before &lt;code&gt;forceCancel&lt;&#x2F;code&gt; or &lt;code&gt;cancel&lt;&#x2F;code&gt;, the publisher contract MUST call the &lt;code&gt;isLocked&lt;&#x2F;code&gt; function of the subscriber contract to avoid unilateral unsubscribing. The subscriber contract may have a significant logical dependence on the publisher contract, and thus unsubscription could lead to severe issues within the subscriber contract. Therefore, the subscriber contract should implement &lt;code&gt;isLocked&lt;&#x2F;code&gt; function with thorough consideration.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;inbox-mechanism&quot;&gt;&lt;code&gt;inbox&lt;&#x2F;code&gt; Mechanism&lt;&#x2F;h3&gt;
&lt;p&gt;In certain scenarios, the publisher contract may only push essential data with &lt;code&gt;selector&lt;&#x2F;code&gt; to the subscriber contracts, while the full data might be stored within &lt;code&gt;inbox&lt;&#x2F;code&gt;. Upon receiving the push from the publisher contract, the subscriber contract is optional to call &lt;code&gt;inbox&lt;&#x2F;code&gt;.
&lt;code&gt;inbox&lt;&#x2F;code&gt; mechanism simplifies the push information while still ensuring the availability of complete data, thereby reducing gas consumption.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;using-function-selectors-as-parameters&quot;&gt;Using Function Selectors as Parameters&lt;&#x2F;h3&gt;
&lt;p&gt;Using function selectors to retrieve the addresses of subscriber contracts allows
more detailed configuration.
For the subscriber contract, having the specific function of the request source based on the push information enables more accurate handling of the push information.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;renounce-safety-enhancement&quot;&gt;Renounce Safety Enhancement&lt;&#x2F;h3&gt;
&lt;p&gt;Both &lt;code&gt;forceApprove&lt;&#x2F;code&gt; and &lt;code&gt;forceCancel&lt;&#x2F;code&gt; permissions can be relinquished using their respective renounce functions. When both &lt;code&gt;renounceForceApprove&lt;&#x2F;code&gt; and &lt;code&gt;renounceForceCancel&lt;&#x2F;code&gt; are called, the registered push targets can longer be changed, greatly enhancing security.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pragma solidity ^0.8.24;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;import {EnumerableSet} from &amp;quot;@openzeppelin&#x2F;contracts&#x2F;utils&#x2F;structs&#x2F;EnumerableSet.sol&amp;quot;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;import {IPushFree, IPushForce} from &amp;quot;.&#x2F;interfaces&#x2F;IPush.sol&amp;quot;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;import {IExec} from &amp;quot;.&#x2F;interfaces&#x2F;IExec.sol&amp;quot;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;contract Foo is IPushFree, IPushForce {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    using EnumerableSet for EnumerableSet.AddressSet;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bool public override isRenounceForceApprove;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bool public override isRenounceForceCancel;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    mapping(bytes4 selector =&amp;gt; mapping(uint256 tokenId =&amp;gt; EnumerableSet.AddressSet targets)) private _registry;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    mapping(bytes4 selector =&amp;gt; EnumerableSet.AddressSet targets) private _registryOfAll;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; mapping(bytes4 =&amp;gt; bytes) public inbox;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    modifier notLock(bytes4 selector, address target, bytes memory data) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        require(!IExec(target).isLocked(selector, data), &amp;quot;Foo: lock&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function inbox(bytes4 selector) public view returns (bytes memory data) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 loadData;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        assembly {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            loadData := tload(selector)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        data = abi.encode(loadData);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function isApproved(bytes4 selector, address target, bytes calldata data) external view override returns (bool) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 tokenId = abi.decode(data, (uint256));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return _registry[selector][tokenId].contains(target);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function isForceApproved(bytes4 selector, address target) external view override returns (bool) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return _registryOfAll[selector].contains(target);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function approve(bytes4 selector, address target, bytes calldata data) external override {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 tokenId = abi.decode(data, (uint256));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _registry[selector][tokenId].add(target);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function cancel(bytes4 selector, address target, bytes calldata data)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        override&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        notLock(selector, target, data)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 tokenId = abi.decode(data, (uint256));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _registry[selector][tokenId].remove(target);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function forceApprove(bytes4 selector, address target) external override {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        if (isRenounceForceApprove) revert ForceApproveRenounced();&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _registryOfAll[selector].add(target);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function forceCancel(bytes4 selector, address target) external override notLock(selector, target, &amp;quot;&amp;quot;) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        if (isRenounceForceCancel) revert ForceCancelRenounced();&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _registryOfAll[selector].remove(target);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function renounceForceApprove(bytes memory data) external override {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (bool burn) = abi.decode(data, (bool));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        if (burn != true) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            revert MustRenounce();&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        isRenounceForceApprove = true;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        emit RenounceForceApprove();&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function renounceForceCancel(bytes memory data) external override {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (bool burn) = abi.decode(data, (bool));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        if (burn != true) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            revert MustRenounce();&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        isRenounceForceCancel = true;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        emit RenounceForceCancel();&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function send(uint256 message) external {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _push(this.send.selector, message);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function _push(bytes4 selector, uint256 message) internal {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        assembly {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            tstore(selector, message)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address[] memory targets = _registry[selector][message].values();&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        for (uint256 i = 0; i &amp;lt; targets.length; i++) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            IExec(targets[i]).exec(selector, abi.encode(message));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        targets = _registryOfAll[selector].values();&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        for (uint256 i = 0; i &amp;lt; targets.length; i++) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            IExec(targets[i]).exec(selector, abi.encode(message));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;contract Bar is IExec {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    event Log(bytes4 indexed selector, bytes data, bytes inboxData);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function isLocked(bytes4, bytes calldata) external pure override returns (bool) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return true;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function exec(bytes4 selector, bytes calldata data) external {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bytes memory inboxData = IPushFree(msg.sender).inbox(selector);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        emit Log(selector, data, inboxData);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;exec-attacks&quot;&gt;&lt;code&gt;exec&lt;&#x2F;code&gt; Attacks&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;exec&lt;&#x2F;code&gt; function is &lt;code&gt;public&lt;&#x2F;code&gt;, therefore, it is vulnerable to malicious calls where arbitrary push information can be inserted. Implementations of &lt;code&gt;exec&lt;&#x2F;code&gt; should carefully consider the arbitrariness of calls and should not directly use data passed by the exec function without verification.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;reentrancy-attack&quot;&gt;Reentrancy Attack&lt;&#x2F;h3&gt;
&lt;p&gt;The publisher contract&#x27;s call to the subscriber contract&#x27;s &lt;code&gt;exec&lt;&#x2F;code&gt; function could lead to reentrancy attacks. Malicious subscription contracts might construct reentrancy attacks to the publisher contract within &lt;code&gt;exec&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;arbitrary-target-approve&quot;&gt;Arbitrary Target Approve&lt;&#x2F;h3&gt;
&lt;p&gt;Implementation of &lt;code&gt;forceApprove&lt;&#x2F;code&gt; and &lt;code&gt;approve&lt;&#x2F;code&gt; should have reasonable access controls; otherwise, unnecessary gas losses could be imposed on callers.&lt;&#x2F;p&gt;
&lt;p&gt;Check the gas usage of the &lt;code&gt;exec&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;islocked-implementation&quot;&gt;isLocked implementation&lt;&#x2F;h3&gt;
&lt;p&gt;Subscriber contracts should implement the &lt;code&gt;isLocked&lt;&#x2F;code&gt; function to avoid potential loss brought by unsubscription. This is particularly crucial for lending protocols implementing this proposal. Improper unsubscription can lead to abnormal clearing, causing considerable losses.&lt;&#x2F;p&gt;
&lt;p&gt;Similarly, when subscribing, the publisher contract should consider whether &lt;code&gt;isLocked&lt;&#x2F;code&gt; is properly implemented to prevent irrevocable subscriptions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Revert creation in case of non-empty storage</title>
        <published>2024-02-02T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Gary Rong</name><uri>https://github.com/rjl493456442</uri>
	</author>
	
	<author>
		<name>Martin Holst Swende</name><uri>https://github.com/holiman</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7610/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-revert-creation-in-case-of-non-empty-storage/18452" />
        

        <id>https://wg-eips.ritovision.com/7610/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="last-call"
                label="Last Call" />
            
        

        
        <category
            term="tag:eip:7610"
            label="EIP-7610" />
        

        
        

        
        <summary type="html">Revert contract creation if address already has the non-empty storage</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7610/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP causes contract creation to throw an error when attempted at an address with pre-existing storage.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;If a contract creation is attempted due to a creation transaction, the &lt;code&gt;CREATE&lt;&#x2F;code&gt; opcode, the &lt;code&gt;CREATE2&lt;&#x2F;code&gt; opcode, or any other reason, and the destination address already has either a nonzero nonce, a nonzero code length, or non-empty storage, then the creation MUST throw as if the first byte in the init code were an invalid opcode. This change MUST apply retroactively for all existing blocks.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP amends &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;684&#x2F;&quot;&gt;EIP-684&lt;&#x2F;a&gt; with one extra condition, requiring empty storage for contract deployment.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP will not affect &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt;, since the authority&#x27;s nonce is always incremented after an authorization is applied, which conflicts with the condition required for contract deployment.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;EIP-684 defines two conditions for contract deployment: the destination address must have zero nonce and zero code length. Unfortunately, this is not sufficient. Before &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;161&#x2F;&quot;&gt;EIP-161&lt;&#x2F;a&gt; was applied, the nonce of a newly deployed contract remained set to zero. Therefore, it was entirely possible to create a contract with a zero nonce and zero code length but with non-empty storage, if slots were set in the constructor. There exists 28 such contracts on Ethereum mainnet at this time.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This is an execution layer upgrade, and so it requires a hard fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;There exists quite a number of tests in the ethereum tests repo as well as in the execution spec tests, which test the scenario of deployment to targets with non-empty storage. These tests have been considered problematic in the past; Reth and EELS both intentionally implement a version of the account reset solely to pass the tests. Py-evm declared the situation impossible and never implemented account reset.&lt;&#x2F;p&gt;
&lt;p&gt;Refilling the existing tests will provide sufficient coverage for this EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is a security upgrade: it enforces the immutability of deployed code.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Decrease base cost of TLOAD&#x2F;TSTORE</title>
        <published>2024-02-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Charles Cooper</name><uri>https://github.com/charles-cooper</uri>
	</author>
	
	<author>
		<name>James Prestwich</name><uri>https://github.com/prestwich</uri>
	</author>
	
	<author>
		<name>brockelmore</name><uri>https://github.com/brockelmore</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7609/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7609-reduce-transient-storage-pricing/18435" />
        

        <id>https://wg-eips.ritovision.com/7609/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7609"
            label="EIP-7609" />
        

        
        

        
        <summary type="html">Improve the efficiency of TLOAD&#x2F;TSTORE by decreasing the base cost and introducing a superlinear pricing model.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7609/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Decrease the base cost of TLOAD&#x2F;TSTORE while introducing a superlinear pricing model. This increases the efficiency of TLOAD&#x2F;TSTORE for common use cases, while providing a pricing model to prevent DoS vectors.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1153&#x2F;&quot;&gt;EIP-1153&lt;&#x2F;a&gt; introduces a new storage region, termed &quot;transient storage&quot;. It behaves like storage (word-addressed and persists between call frames), but unlike storage it is wiped at the end of each transaction. During development of EIP-1153, the pricing was set to be the same as warm storage loads and stores. This was for two reasons: conceptual simplicity of the EIP, and it also addressed concerns about two related DoS vectors: being able to allocate too much transient storage, and the cost of rolling back state in the case of reverts.&lt;&#x2F;p&gt;
&lt;p&gt;One of the most important use cases that EIP-1153 enables is cheap reentrancy protection. In fact, if transient storage is cheap enough for the first few slots, reentrancy protection can be enabled by default at the language level without too much burden to users, while simultaneously preventing the largest—and most expensive—class of smart contract vulnerabilities.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore, it seems that transient storage is fundamentally overpriced. Its pricing does not interact with refunds, it only requires a new allocation on contract load (as opposed to memory, which requires a fresh allocation on every call), and has no interaction with the physical database.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP proposes a pricing model which charges additional gas per allocation, which is cheaper for common cases (fewer than ~95 slots are written per contract), while making DoS using transient storage prohibitively expensive.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;The gas cost for &lt;code&gt;TLOAD&lt;&#x2F;code&gt; is proposed to be 5 gas. The gas cost for &lt;code&gt;TSTORE&lt;&#x2F;code&gt; is proposed to be 8 gas + &lt;code&gt;expansion_cost&lt;&#x2F;code&gt;, where &lt;code&gt;expansion_cost&lt;&#x2F;code&gt; is calculated as &lt;code&gt;1 gas * len(transient storage mapping)&lt;&#x2F;code&gt; if the key is not yet in the transient storage mapping, and otherwise 0 gas.&lt;&#x2F;p&gt;
&lt;p&gt;In pseudo-code:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;G_LOW&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;G_MID&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;SLOPE&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; gas_tload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;_key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; G_LOW&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; gas_tstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; transient_mapping&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; G_MID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; transient_mapping&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SLOPE&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; transient_mapping&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;size&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; cost&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;gas&quot;&gt;Gas&lt;&#x2F;h3&gt;
&lt;p&gt;In benchmarking, &lt;code&gt;TLOAD&lt;&#x2F;code&gt; was found to cost a similar amount of CPU time as &lt;code&gt;MUL&lt;&#x2F;code&gt;, while &lt;code&gt;TSTORE&lt;&#x2F;code&gt; was found to cost about 1.5x that. The values &lt;code&gt;G_low&lt;&#x2F;code&gt; and &lt;code&gt;G_mid&lt;&#x2F;code&gt; were therefore chosen for &lt;code&gt;TLOAD&lt;&#x2F;code&gt; and &lt;code&gt;TSTORE&lt;&#x2F;code&gt;, respectively.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The maximum number of transient slots which can be allocated on a single contract given 30m gas is approximately 7,739 (solution to &lt;code&gt;x(x-1)&#x2F;2*1 + 8*x = 30_000_000&lt;&#x2F;code&gt;), which totals 248KB.&lt;&#x2F;p&gt;
&lt;p&gt;The maximum number of transient slots which can be allocated in a transaction if you use the strategy of calling new contracts (which each are designed to maximize transient storage allocation) once the cost of &lt;code&gt;TSTORE&lt;&#x2F;code&gt; is more than the cost of calling a cold contract (2600 gas), can be solved for as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;solve for SLOPE * &amp;lt;num slots&amp;gt; == 2600, =&amp;gt; num_slots == 2600&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gas_used_by_contract = 2600 + SLOPE * num_slots * (num_slots - 1) &#x2F; 2 + G_MID * num_slots == 3402100&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;block_gas_limit = 30_000_000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;num_calls_per_txn = block_gas_limit &#x2F;&#x2F; gas_used_by_contract ~= 8.8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;max_transient_slots = num_calls_per_txn * num_slots == 22927&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Thus, the maximum number of transient slots which can be allocated in a single transaction with this method is roughly 23,000, which totals 736KB. Compared to the current gas schedule (which allows allocating approximately &lt;code&gt;30_000_000 &#x2F; 100 * 32 == 9.6MB&lt;&#x2F;code&gt; worth of memory), this is a net &lt;em&gt;reduction&lt;&#x2F;em&gt; in the total memory which can be allocated on a client using transient storage, so this EIP presents a stronger bound on the resources which can be used by transient storage. As a comparison point, the total amount of memory which can be allocated on a client by &lt;code&gt;SSTORE&lt;&#x2F;code&gt;s in a given transaction is &lt;code&gt;30_000_000 &#x2F; 20_000 * 32&lt;&#x2F;code&gt;, or 48KB.&lt;&#x2F;p&gt;
&lt;p&gt;Note that this cap scales linearly with the gas limit, which is a useful property when considering future block gas limit increases.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Wallet Signing API</title>
        <published>2024-01-29T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Lukas Rosario</name><uri>https://github.com/lukasrosario</uri>
	</author>
	
	<author>
		<name>Jake Moxey</name><uri>https://github.com/jxom</uri>
	</author>
	
	<author>
		<name>Cody Crozier</name><uri>https://github.com/wcrozier12</uri>
	</author>
	
	<author>
		<name>Conner Swenberg</name><uri>https://github.com/ilikesymmetry</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7871/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/new-erc-wallet-signing-api/22718" />
        

        <id>https://wg-eips.ritovision.com/7871/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:7871"
            label="ERC-7871" />
        

        
        

        
        <summary type="html">Adds a JSON-RPC method for requesting a signature from a wallet</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7871/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Defines a new JSON-RPC method &lt;code&gt;wallet_sign&lt;&#x2F;code&gt; which enables apps to ask a wallet to sign &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;191&#x2F;&quot;&gt;EIP-191&lt;&#x2F;a&gt; messages.&lt;&#x2F;p&gt;
&lt;p&gt;Applications can use this JSON-RPC method to request a signature over any version of &lt;code&gt;signed_data&lt;&#x2F;code&gt; as defined by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;191&#x2F;&quot;&gt;EIP-191&lt;&#x2F;a&gt;. The new JSON-RPC method allows for support of future &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;191&#x2F;&quot;&gt;EIP-191&lt;&#x2F;a&gt; &lt;code&gt;signed_data&lt;&#x2F;code&gt; versions.&lt;&#x2F;p&gt;
&lt;p&gt;The new JSON-RPC method also supports &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5792&#x2F;&quot;&gt;EIP-5792&lt;&#x2F;a&gt;-style &lt;code&gt;capabilities&lt;&#x2F;code&gt;, and support for signing capabilities can be discovered using &lt;code&gt;wallet_getCapabilities&lt;&#x2F;code&gt; as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5792&#x2F;&quot;&gt;EIP-5792&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Wallets and developer tools currently support multiple JSON-RPC methods for handling offchain signature requests. This proposal simplifies wallet &amp;amp; tooling implementations by consolidating these requests under a single &lt;code&gt;wallet_sign&lt;&#x2F;code&gt; JSON-RPC method. This also leaves room for new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;191&#x2F;&quot;&gt;EIP-191&lt;&#x2F;a&gt; &lt;code&gt;signed_data&lt;&#x2F;code&gt; versions without needing to introduce a new corresponding JSON-RPC method.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore, this new &lt;code&gt;wallet_sign&lt;&#x2F;code&gt; method introduces new functionalities via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5792&#x2F;&quot;&gt;EIP-5792&lt;&#x2F;a&gt;-style &lt;code&gt;capabilities&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.
One new JSON-RPC method is introduced.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;wallet-sign&quot;&gt;&lt;code&gt;wallet_sign&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Requests a signature over &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;191&#x2F;&quot;&gt;EIP-191&lt;&#x2F;a&gt; &lt;code&gt;signed_data&lt;&#x2F;code&gt; from a wallet.&lt;&#x2F;p&gt;
&lt;p&gt;The top-level &lt;code&gt;version&lt;&#x2F;code&gt; parameter is for specifying the version of &lt;code&gt;wallet_sign&lt;&#x2F;code&gt; should the top-level interface change.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;request.type&lt;&#x2F;code&gt; parameter is for specifying the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;191&#x2F;&quot;&gt;EIP-191&lt;&#x2F;a&gt; &lt;code&gt;signed_data&lt;&#x2F;code&gt; &lt;code&gt;version&lt;&#x2F;code&gt; (e.g. &lt;code&gt;0x01&lt;&#x2F;code&gt; for structured data, &lt;code&gt;0x45&lt;&#x2F;code&gt; for &lt;code&gt;personal_sign&lt;&#x2F;code&gt; messaged). The &lt;code&gt;request.data&lt;&#x2F;code&gt; parameter is the corresponding data according to the &lt;code&gt;signed_data&lt;&#x2F;code&gt; &lt;code&gt;version&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The optional &lt;code&gt;address&lt;&#x2F;code&gt; parameter is for requesting a signature from a specified address. If included, the wallet MUST respect it and only respond with a signature from that address.&lt;&#x2F;p&gt;
&lt;p&gt;The capabilities field is how an app can communicate with a wallet about capabilities that a wallet supports.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal defines &lt;code&gt;request&lt;&#x2F;code&gt; schemas for the three &lt;code&gt;signed_data&lt;&#x2F;code&gt; versions currently in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;191&#x2F;&quot;&gt;EIP-191&lt;&#x2F;a&gt; (&lt;code&gt;0x00&lt;&#x2F;code&gt;, &lt;code&gt;0x01&lt;&#x2F;code&gt;, &lt;code&gt;0x45&lt;&#x2F;code&gt;). Any future &lt;code&gt;signed_data&lt;&#x2F;code&gt; versions can be supported by &lt;code&gt;wallet_sign&lt;&#x2F;code&gt;, and their &lt;code&gt;request&lt;&#x2F;code&gt; interfaces are left to future ERCs.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;wallet-sign-rpc-specification&quot;&gt;&lt;code&gt;wallet_sign&lt;&#x2F;code&gt; RPC Specification&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Capability&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; unknown&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  optional&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; boolean&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SignParams&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  version&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  request&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 1-byte EIP-191 version&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; any&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; data corresponding to the above version&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  capabilities&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Record&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Capability&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SignResult&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  capabilities&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Record&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; any&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;request-interfaces&quot;&gt;Request Interfaces&lt;&#x2F;h5&gt;
&lt;p&gt;Below are &lt;code&gt;request&lt;&#x2F;code&gt; interfaces for the &lt;code&gt;signed_data&lt;&#x2F;code&gt; &lt;code&gt;version&lt;&#x2F;code&gt;s specified in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;191&#x2F;&quot;&gt;EIP-191&lt;&#x2F;a&gt; at time of writing. These include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;0x00&lt;&#x2F;code&gt; - Data with intended validator&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;0x01&lt;&#x2F;code&gt; - &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; Typed Data&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;0x45&lt;&#x2F;code&gt; - Personal Sign&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Any new &lt;code&gt;request&lt;&#x2F;code&gt; interfaces corresponding to new &lt;code&gt;signed_data&lt;&#x2F;code&gt; &lt;code&gt;version&lt;&#x2F;code&gt;s SHOULD be defined in their own ERCs.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ValidatorRequest&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x00&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    validator&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Intended validator address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Data to sign&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TypedDataRequest&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;TypedData&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; TypedData as defined by EIP-712&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PersonalSignRequest&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x45&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    message&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; UTF-8 message string&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;wallet-sign-example-parameters&quot;&gt;&lt;code&gt;wallet_sign&lt;&#x2F;code&gt; Example Parameters&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;request&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x45&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;message&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Hello world&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;wallet-sign-example-return-value&quot;&gt;&lt;code&gt;wallet_sign&lt;&#x2F;code&gt; Example Return Value&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x00000000000000000000000000000000000000000000000000000000000000000e670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;!-- TODO --&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;!-- TODO --&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;!-- TODO --&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>ERC-1155 Permit Approvals</title>
        <published>2024-01-27T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>calvbore</name><uri>https://github.com/calvbore</uri>
	</author>
	
	<author>
		<name>emiliolanzalaco</name><uri>https://github.com/emiliolanzalaco</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7604/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/proposal-for-a-new-eip-erc-2612-style-permits-for-erc1155-nfts/15504" />
        

        <id>https://wg-eips.ritovision.com/7604/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7604"
            label="ERC-7604" />
        

        
        

        
        <summary type="html">Permit approvals for ERC-1155 tokens</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7604/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The &quot;permit&quot; approval flow for both &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; are large improvements for the existing UX of the token underlying each ERC. This ERC extends the &quot;permit&quot; pattern to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; tokens, borrowing heavily upon both &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4494&#x2F;&quot;&gt;ERC-4494&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2612&#x2F;&quot;&gt;ERC-2612&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The structure of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; tokens requires a new ERC to account for the token standard&#x27;s use of both token IDs and balances (also why this ERC requires &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5216&#x2F;&quot;&gt;ERC-5216&lt;&#x2F;a&gt;).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The permit structures outlined in both &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4494&#x2F;&quot;&gt;ERC-4494&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2612&#x2F;&quot;&gt;ERC-2612&lt;&#x2F;a&gt; allows a signed message to create an approval, but are only applicable to their respective underlying tokens (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;Three new functions must be added to ERC-1155 and ERC-5216.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC1155Permit&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; permit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; deadline&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sig&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; nonces&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DOMAIN_SEPARATOR&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The semantics of which are as follows:&lt;&#x2F;p&gt;
&lt;p&gt;For all addresses &lt;code&gt;owner&lt;&#x2F;code&gt;, &lt;code&gt;spender&lt;&#x2F;code&gt;, uint256&#x27;s &lt;code&gt;tokenId&lt;&#x2F;code&gt;, &lt;code&gt;value&lt;&#x2F;code&gt;, &lt;code&gt;deadline&lt;&#x2F;code&gt;, and &lt;code&gt;nonce&lt;&#x2F;code&gt;, bytes &lt;code&gt;sig&lt;&#x2F;code&gt;, a call to &lt;code&gt;permit(owner, spender, tokenId, value, deadline, sig)&lt;&#x2F;code&gt; MUST set &lt;code&gt;allowance(owner, spender, tokenId)&lt;&#x2F;code&gt; to &lt;code&gt;value&lt;&#x2F;code&gt;, increment &lt;code&gt;nonces(owner, tokenId)&lt;&#x2F;code&gt; by 1, and emit a corresponding &lt;code&gt;Approval&lt;&#x2F;code&gt; event defined by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5216&#x2F;&quot;&gt;ERC-5216&lt;&#x2F;a&gt;, if and only if the following conditions are met:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The current blocktime is less than or equal to &lt;code&gt;deadline&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;owner&lt;&#x2F;code&gt; is not the zero address&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;nonces[owner][tokenId]&lt;&#x2F;code&gt; (before state update) is equal to &lt;code&gt;nonce&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;sig&lt;&#x2F;code&gt; is a valid &lt;code&gt;secp256k1&lt;&#x2F;code&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2098&#x2F;&quot;&gt;ERC-2098&lt;&#x2F;a&gt;, or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;ERC-1271&lt;&#x2F;a&gt; signature from &lt;code&gt;owner&lt;&#x2F;code&gt; of the message:&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;keccak256(abi.encodePacked(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   hex&amp;quot;1901&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   DOMAIN_SEPARATOR,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   keccak256(abi.encode(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            keccak256(&amp;quot;Permit(address owner,address spender,uint256 tokenId,uint256 value,uint256 nonce,uint256 deadline)&amp;quot;),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            owner,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            spender,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            tokenId,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            value,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            nonce,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            deadline))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;If any of these conditions are not met the &lt;code&gt;permit&lt;&#x2F;code&gt; call MUST revert.&lt;&#x2F;p&gt;
&lt;p&gt;Where &lt;code&gt;DOMAIN_SEPARATOR&lt;&#x2F;code&gt; MUST be defined according to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt;. The &lt;code&gt;DOMAIN_SEPARATOR&lt;&#x2F;code&gt; should be unique to the contract and chain to prevent replay attacks from other domains, and satisfy the requirements of EIP-712, but is otherwise unconstrained. A common choice for &lt;code&gt;DOMAIN_SEPARATOR&lt;&#x2F;code&gt; is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;DOMAIN_SEPARATOR = keccak256(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    abi.encode(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        keccak256(&amp;#39;EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)&amp;#39;),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        keccak256(bytes(name)),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        keccak256(bytes(version)),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        chainid,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address(this)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In other words, the message is the following EIP-712 typed structure:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &amp;quot;types&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;EIP712Domain&amp;quot;: [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;name&amp;quot;: &amp;quot;name&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;name&amp;quot;: &amp;quot;version&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;name&amp;quot;: &amp;quot;chainId&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;type&amp;quot;: &amp;quot;uint256&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;name&amp;quot;: &amp;quot;verifyingContract&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;type&amp;quot;: &amp;quot;address&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ],&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;Permit&amp;quot;: [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	    &amp;quot;name&amp;quot;: &amp;quot;owner&amp;quot;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	    &amp;quot;type&amp;quot;: &amp;quot;address&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	  },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;name&amp;quot;: &amp;quot;spender&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;type&amp;quot;: &amp;quot;address&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;name&amp;quot;: &amp;quot;tokenId&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;type&amp;quot;: &amp;quot;uint256&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;name&amp;quot;: &amp;quot;value&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;type&amp;quot;: &amp;quot;uint256&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;name&amp;quot;: &amp;quot;nonce&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;type&amp;quot;: &amp;quot;uint256&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;name&amp;quot;: &amp;quot;deadline&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;type&amp;quot;: &amp;quot;uint256&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ],&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;primaryType&amp;quot;: &amp;quot;Permit&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;domain&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &amp;quot;name&amp;quot;: erc1155name,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &amp;quot;version&amp;quot;: version,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &amp;quot;chainId&amp;quot;: chainid,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &amp;quot;verifyingContract&amp;quot;: tokenAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &amp;quot;message&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;owner&amp;quot;: owner,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;spender&amp;quot;: spender,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;tokenId&amp;quot;: tokenId,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;value&amp;quot;: value,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;nonce&amp;quot;: nonce,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;deadline&amp;quot;: deadline&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;permit&lt;&#x2F;code&gt; function MUST check that the signer is not the zero address.&lt;&#x2F;p&gt;
&lt;p&gt;Note that nowhere in this definition do we refer to &lt;code&gt;msg.sender&lt;&#x2F;code&gt;. The caller of the &lt;code&gt;permit&lt;&#x2F;code&gt; function can be any address.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP requires &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt;. ERC-165 is already required in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt;, but is further necessary here in order to register the interface of this ERC. Doing so will allow easy verification if an NFT contract has implemented this ERC or not, enabling them to interact accordingly. The ERC-165 interface of this ERC is &lt;code&gt;0x7409106d&lt;&#x2F;code&gt;. Contracts implementing this ERC MUST have the &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; function return &lt;code&gt;true&lt;&#x2F;code&gt; when called with &lt;code&gt;0x7409106d&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;permit&lt;&#x2F;code&gt; function is sufficient for enabling a &lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt; transaction to be made without the need for an additional transaction.&lt;&#x2F;p&gt;
&lt;p&gt;The format avoids any calls to unknown code.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;nonces&lt;&#x2F;code&gt; mapping is given for replay protection.&lt;&#x2F;p&gt;
&lt;p&gt;A common use case of permit has a relayer submit a Permit on behalf of the owner. In this scenario, the relaying party is essentially given a free option to submit or withhold the Permit. If this is a cause of concern, the owner can limit the time a Permit is valid for by setting deadline to a value in the near future. The &lt;code&gt;deadline&lt;&#x2F;code&gt; argument can be set to &lt;code&gt;uint(-1)&lt;&#x2F;code&gt; to create Permits that effectively never expire. Likewise, the &lt;code&gt;value&lt;&#x2F;code&gt; argument can be set to &lt;code&gt;uint(-1)&lt;&#x2F;code&gt; to create Permits with effectively unlimited allowances.&lt;&#x2F;p&gt;
&lt;p&gt;EIP-712 typed messages are included because of its use in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4494&#x2F;&quot;&gt;ERC-4494&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2612&#x2F;&quot;&gt;ERC-2612&lt;&#x2F;a&gt;, which in turn cites widespread adoption in many wallet providers.&lt;&#x2F;p&gt;
&lt;p&gt;This ERC focuses on both the &lt;code&gt;value&lt;&#x2F;code&gt; and &lt;code&gt;tokenId&lt;&#x2F;code&gt; being approved, ERC-4494 focuses only on the &lt;code&gt;tokenId&lt;&#x2F;code&gt;, while ERC-2612 focuses primarily on the &lt;code&gt;value&lt;&#x2F;code&gt;. ERC-1155 does not natively support approvals by amount, thus this ERC requires ERC-5216, otherwise a &lt;code&gt;permit&lt;&#x2F;code&gt; would grant approval for an account&#x27;s entire &lt;code&gt;tokenId&lt;&#x2F;code&gt; balance.&lt;&#x2F;p&gt;
&lt;p&gt;Whereas ERC-2612 splits signatures into their &lt;code&gt;v,r,s&lt;&#x2F;code&gt; components, this ERC opts to instead take a &lt;code&gt;bytes&lt;&#x2F;code&gt; array of variable length in order to support &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;ERC-2098&lt;&#x2F;a&gt; signatures, which may not be easily separated or reconstructed from &lt;code&gt;r,s,v&lt;&#x2F;code&gt; components (65 bytes).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The below considerations have been copied from ERC-4494.&lt;&#x2F;p&gt;
&lt;p&gt;Extra care should be taken when creating transfer functions in which &lt;code&gt;permit&lt;&#x2F;code&gt; and a transfer function can be used in one function to make sure that invalid permits cannot be used in any way. This is especially relevant for automated NFT platforms, in which a careless implementation can result in the compromise of a number of user assets.&lt;&#x2F;p&gt;
&lt;p&gt;The remaining considerations have been copied from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2612&#x2F;&quot;&gt;ERC-2612&lt;&#x2F;a&gt; with minor adaptation, and are equally relevant here:&lt;&#x2F;p&gt;
&lt;p&gt;Though the signer of a &lt;code&gt;Permit&lt;&#x2F;code&gt; may have a certain party in mind to submit their transaction, another party can always front run this transaction and call &lt;code&gt;permit&lt;&#x2F;code&gt; before the intended party. The end result is the same for the &lt;code&gt;Permit&lt;&#x2F;code&gt; signer, however.&lt;&#x2F;p&gt;
&lt;p&gt;Since the ecrecover precompile fails silently and just returns the zero address as &lt;code&gt;signer&lt;&#x2F;code&gt; when given malformed messages, it is important to ensure &lt;code&gt;ownerOf(tokenId) != address(0)&lt;&#x2F;code&gt; to avoid &lt;code&gt;permit&lt;&#x2F;code&gt; from creating an approval to any &lt;code&gt;tokenId&lt;&#x2F;code&gt; which does not have an approval set.&lt;&#x2F;p&gt;
&lt;p&gt;Signed &lt;code&gt;Permit&lt;&#x2F;code&gt; messages are censorable. The relaying party can always choose to not submit the &lt;code&gt;Permit&lt;&#x2F;code&gt; after having received it, withholding the option to submit it. The &lt;code&gt;deadline&lt;&#x2F;code&gt; parameter is one mitigation to this. If the signing party holds ETH they can also just submit the &lt;code&gt;Permit&lt;&#x2F;code&gt; themselves, which can render previously signed &lt;code&gt;Permit&lt;&#x2F;code&gt;s invalid.&lt;&#x2F;p&gt;
&lt;p&gt;The standard ERC-20 race condition for approvals applies to &lt;code&gt;permit&lt;&#x2F;code&gt; as well.&lt;&#x2F;p&gt;
&lt;p&gt;If the &lt;code&gt;DOMAIN_SEPARATOR&lt;&#x2F;code&gt; contains the &lt;code&gt;chainId&lt;&#x2F;code&gt; and is defined at contract deployment instead of reconstructed for every signature, there is a risk of possible replay attacks between chains in the event of a future chain split..&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>ERC-1155 Multi-Asset extension</title>
        <published>2024-01-25T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Haru</name><uri>https://github.com/haruu8</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7603/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-multi-context-dependent-multi-asset-tokens-eip1155-extension/18303" />
        

        <id>https://wg-eips.ritovision.com/7603/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7603"
            label="ERC-7603" />
        

        
        

        
        <summary type="html">An interface compatible with ERC-1155 for Multi-Asset tokens with context-dependent asset type output control.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7603/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The Multi-Asset Token standard, compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt;, facilitates the development of a new fundamental component: the context-dependent data output for each collection.&lt;&#x2F;p&gt;
&lt;p&gt;The context-dependent data output means that the asset is displayed in an appropriate format based on how the token is accessed. I.e., if the token is being opened in an e-book reader, the PDF asset is displayed; if the token is opened in the marketplace, the PNG or the SVG asset is displayed; if the token is accessed from within a game, the 3D model asset is accessed, and if the token is accessed by an Internet of Things (IoT) hub, the asset providing the necessary addressing and specification information is accessed.&lt;&#x2F;p&gt;
&lt;p&gt;A Token Collection can have multiple assets (outputs), which can be any file to order them by priority. They do not have to match in mime-type or tokenURI, nor do they depend on one another. Assets are not standalone entities but should be considered “namespaced tokenURIs”.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;With ERC-1155 compatible tokens being a widespread form of tokens in the Ethereum ecosystem and being used for various use cases, it is time to standardize additional utility for them. Having multiple assets associated with a single Token Collection allows for greater utility, usability, and forward compatibility. This EIP improves upon ERC-1155 in the following areas:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7603&#x2F;#cross-metaverse-compatibility&quot;&gt;Cross-metaverse compatibility&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7603&#x2F;#multi-media-output&quot;&gt;Multi-media output&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7603&#x2F;#media-redundancy&quot;&gt;Media redundancy&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;cross-metaverse-compatibility&quot;&gt;Cross-metaverse compatibility&lt;&#x2F;h3&gt;
&lt;p&gt;The proposal can support any number of different implementations.&lt;&#x2F;p&gt;
&lt;p&gt;Cross-metaverse compatibility could also be referred to as cross-engine compatibility. An example is where a cosmetic item for game A is unavailable in game B because the frameworks are incompatible.&lt;&#x2F;p&gt;
&lt;p&gt;Such Tokens can be given further utility through new assets: more games, cosmetic items, and more.&lt;&#x2F;p&gt;
&lt;p&gt;The following is a more concrete example. One asset is a cosmetic item for game A, a file containing the cosmetic assets. Another is a cosmetic asset file for game B. A third is a generic asset intended to be shown in catalogs, marketplaces, portfolio trackers, or other generalized Token Collection viewers, containing a representation, stylized thumbnail, and animated demo&#x2F;trailer of the cosmetic item.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP adds a layer of abstraction, allowing game developers to pull asset data from a user&#x27;s Tokens directly instead of hard-coding it.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;multi-media-output&quot;&gt;Multi-media output&lt;&#x2F;h3&gt;
&lt;p&gt;Tokens of an eBook can be represented as a PDF, MP3, or some other format, depending on what software loads it. If loaded into an eBook reader, a PDF should be displayed, and if loaded into an audiobook application, the MP3 representation should be used. Other metadata could be present in the Tokens (perhaps the book&#x27;s cover image) for identification on various marketplaces, Search Engine Result Pages (SERPs), or portfolio trackers.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;media-redundancy&quot;&gt;Media redundancy&lt;&#x2F;h3&gt;
&lt;p&gt;Many Tokens are minted hastily without best practices in mind. Specifically, many Tokens are minted with metadata centralized on a server somewhere or, in some cases, a hardcoded IPFS gateway which can also go down, instead of just an IPFS hash.&lt;&#x2F;p&gt;
&lt;p&gt;By adding the same metadata file as different assets, e.g., one asset of metadata and its linked image on Arweave, one asset of this same combination on Sia, another of the same combination on IPFS, etc., the resilience of the metadata and its referenced information increases exponentially as the chances of all the protocols going down at once become less likely.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-7603 Context-Dependent Multi-Asset Tokens, ERC-1155 Execution&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;erc-7603&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.23&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7603&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is ERC165 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to notify listeners that an asset object is initialised at `assetId`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; assetId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the asset that was initialised&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AssetSet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; assetId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to notify listeners that an asset object at `assetId` is added to token&amp;#39;s asset&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  array.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An ID of the token that received a new asset&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; assetId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the asset that has been added to the token&amp;#39;s assets array&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; replacesId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the asset that would be replaced&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AssetAddedToToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; assetId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; replacesId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to notify listeners that token&amp;#39;s priority array is reordered.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token that had the asset priority array updated&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AssetPrioritySet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sets a new priority array for a given token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The priority array is a non-sequential list of `uint16`s, where the lowest value is considered highest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  priority.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Value `0` of a priority is a special case equivalent to uninitialised.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  - `tokenId` must exist.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  - The length of `priorities` must be equal the length of the assets array.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emits a {AssetPrioritySet} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token to set the priorities for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; priorities&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of priorities of assets. The succession of items in the priorities array&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  matches that of the succession of items in the array&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setPriority&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; priorities&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to retrieve IDs of assets of given token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Asset data is stored by reference, in order to access the data corresponding to the ID, call&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  `getAssetMetadata(tokenId, assetId)`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; You can safely get 10k&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token to retrieve the IDs of the assets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;[] An array of the asset IDs of the given token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getAssets&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to retrieve the priorities of the assets of a given token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Asset priorities are a non-sequential array of uint16 values with an array size equal to asset&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  priorites.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token for which to retrieve the priorities of the assets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint16&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;[] An array of priorities of the assets of the given token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getAssetPriorities&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to fetch the asset metadata of the specified token&amp;#39;s asset with the given index.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Can be overridden to implement enumerate, fallback or other custom logic.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token from which to retrieve the asset metadata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; assetId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Asset Id, must be in the assets array&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The metadata of the asset belonging to the specified index in the token&amp;#39;s assets array&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getAssetMetadata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; assetId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;TBD &lt;!-- TODO --&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The MultiAsset token standard has been made compatible with ERC-1155 in order to take advantage of the robust tooling available for implementations of ERC-1155 and to ensure compatibility with existing ERC-1155 infrastructure.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion. &lt;!-- TODO --&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Verkle state transition via an overlay tree</title>
        <published>2024-01-25T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Guillaume Ballet</name><uri>https://github.com/gballet</uri>
	</author>
	
	<author>
		<name>Ansgar Dietrichs</name><uri>https://github.com/adietrichs</uri>
	</author>
	
	<author>
		<name>Ignacio Hagopian</name><uri>https://github.com/jsign</uri>
	</author>
	
	<author>
		<name>Gottfried Herold</name><uri>https://github.com/GottfriedHerold</uri>
	</author>
	
	<author>
		<name>Jamie Lokier</name><uri>https://github.com/jlokier</uri>
	</author>
	
	<author>
		<name>Tanishq Jasoria</name><uri>https://github.com/tanishqjasoria</uri>
	</author>
	
	<author>
		<name>Parithosh Jayanthi</name><uri>https://github.com/parithosh</uri>
	</author>
	
	<author>
		<name>Gabriel Rocheleau</name><uri>https://github.com/gabrocheleau</uri>
	</author>
	
	<author>
		<name>Karim Taam</name><uri>https://github.com/matkt</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7612/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/ethereum-state-trie-format-change-using-an-overlay/4165" />
        

        <id>https://wg-eips.ritovision.com/7612/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7612"
            label="EIP-7612" />
        

        
        

        
        <summary type="html">Describes the use of an overlay tree to use the verkle tree structure, while leaving the historical state untouched.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7612/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes a method to switch the state tree tree format from hexary Merkle Patricia Tree (MPT) to a Verkle Tree (VKT): the MPT tree is frozen, and new writes to the state are stored in a VKT “laid over” the hexary MPT. The historical MPT state is left untouched and its eventual migration is handled at a later time.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The Ethereum state is growing, and VKTs offer a good mitigation strategy to stem this growth and enable weak statelessness. Owing to the difficulty of translating contracts with large storage while they are being accessed, proposals for migrating the current MPT state are complex and will require client teams to undergo a long process of refactoring their code to handle this conversion.&lt;&#x2F;p&gt;
&lt;p&gt;The bigger the state, the longer any conversion process will take. This has an impact both while the conversion is happening, as well as when full-syncing the chain if the conversion is part of consensus. Fullsync is used extensively by core dev teams to test the performance of new code. A conversion longer than a month will impact the release schedule of client teams who typically release at this rate. Nodes that cannot follow the conversion will need to wait longer to rejoin. The conversion will also make reorgs slower, so reducing its duration is desirable.&lt;&#x2F;p&gt;
&lt;p&gt;This current proposal suggests to stop the MPT state growth in its tracks by activating a new “overlay” VKT, that all new state updates are written to. The “base” MPT is frozen in place, until all execution clients are ready to perform the full transition. Data is read first from the overlay tree, and if not found there, from the MPT.&lt;&#x2F;p&gt;
&lt;p&gt;Whenever the block that freeze the MPT is finalized, internal node data can be deleted, in order to free up disk space.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;value&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FORK_TIME&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;TBD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Time at which the overlay tree is activated.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;helper-functions&quot;&gt;Helper functions&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Determine if `block` is the fork activation block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; is_fork_block&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; FORK_TIME&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; FORK_TIME&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Write an account in the verkle tree&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verkle_set_account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;tree&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; VerkleTree&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Optional&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Account&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        basicdata&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Version&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        basicdata&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Reserved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        basicdata&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;to_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;big&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        basicdata&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;nonce&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;to_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;8&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;big&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        basicdata&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balance&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;to_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;16&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;big&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        tree&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;set&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; basicdata&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ckkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ckkey&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;31&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CODEHASH_LEAF_KEY&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        tree&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;set&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ckkey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;code_hash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Reads an account from the verkle tree&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verkle_get_account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;tree&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; VerkleTree&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Optional&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Account&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    basicdata_leaf&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; tree&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; basicdata_leaf&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        cs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;basicdata_leaf&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;5&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;8&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;big&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;basicdata_leaf&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;8&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;16&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;big&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;basicdata_leaf&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;16&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;big&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ckkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ckkey&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;31&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CODEHASH_LEAF_KEY&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ck&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; tree&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ckkey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        cskey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        cskey&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;31&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CODE_SIZE_LEAF_KEY&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        cs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; tree&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;cskey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        account&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; balance&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; ck&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; cs&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;changes-to-the-execution-spec&quot;&gt;Changes to the execution spec&lt;&#x2F;h3&gt;
&lt;p&gt;In the execution spec, modify the &lt;code&gt;State&lt;&#x2F;code&gt; class as such:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;dataclass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; State&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Contains all information that is preserved between transactions.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    _main_trie&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Trie&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Optional&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Account&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; field&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        default_factory&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;lambda&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Trie&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;secured&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;True&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; default&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;None&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    _storage_tries&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Dict&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Trie&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Bytes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; U256&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; field&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        default_factory&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;dict&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    _snapshots&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        Tuple&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            Trie&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Optional&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Account&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Dict&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Trie&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Bytes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; U256&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; field&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;default_factory&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;list&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    _created_accounts&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Set&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Address&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; field&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;default_factory&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;set&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Added in this EIP&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    _overlay_tree&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; VerkleTree&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Bytes32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;And the state access functions are modified as such:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_account_optional&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; State&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Optional&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Account&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    account&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; verkle_get_account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_overlay_tree&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; get_tree_key_for_version&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; trie_get&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_main_trie&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; set_account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; State&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Optional&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Account&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    verkle_set_account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_overlay_tree&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; get_tree_key_for_nonce&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_storage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; State&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; U256&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_overlay_tree&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;get_tree_key_for_storage_slot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; slot&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    trie&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_storage_tries&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; trie&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; U256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; trie_get&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;trie&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; isinstance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; U256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; set_storage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;    state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; State&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; U256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_overlay_tree&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;set&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;get_tree_key_for_storage_slot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; slot&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Add the following function which is used when storing a contract in the tree:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; state_set_codechunk&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; State&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; chunk_num&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; chunk&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_overlay_tree&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;set&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;get_tree_key_for_code_chunk&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; chunk_num&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; chunk&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;changes-to-the-block-header&quot;&gt;Changes to the block header&lt;&#x2F;h3&gt;
&lt;p&gt;At &lt;code&gt;FORK_TIME&lt;&#x2F;code&gt; the block header state root is changed from the MPT root to the VKT root.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This approach doesn&#x27;t convert the state, which is left to a subsequent EIP. This is meant as a stopgap in case we decide to push the conversion itself to a later time. It has the advantage of simplicity, which means that the Verge fork could happen at the same time as other, simpler EIPs. It also requires no change at the consensus layer.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;!--
  This section is optional for non-Core EIPs.

  The Test Cases section should include expected input&#x2F;output pairs, but may include a succinct set of executable tests. It should not include project build files. No new requirements may be introduced here (meaning an implementation following only the Specification section should pass all tests here.)
  If the test suite is too large to reasonably be included inline, then consider adding it as one or more files in `..&#x2F;assets&#x2F;eip-####&#x2F;`. External links will not be allowed

  TODO: Remove this comment before submitting
--&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;transition-post-genesis&lt;&#x2F;code&gt; branch in &lt;code&gt;github.com&#x2F;gballet&#x2F;go-ethereum&lt;&#x2F;code&gt; implements this when setting &lt;code&gt;--override.overlay-stride=0&lt;&#x2F;code&gt; on the command line.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;!--
  All EIPs must contain a section that discusses the security implications&#x2F;considerations relevant to the proposed change. Include information that might be important for security discussions, surfaces risks and can be used throughout the life cycle of the proposal. For example, include security-relevant design decisions, concerns, important discussions, implementation-specific guidance and pitfalls, an outline of threats and risks and how they are being addressed. EIP submissions missing the &quot;Security Considerations&quot; section will be rejected. An EIP cannot proceed to status &quot;Final&quot; without a Security Considerations discussion deemed sufficient by the reviewers.

  The current placeholder is acceptable for a draft.

  TODO: Remove this comment before submitting
--&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Signature Validation Extension for Permit</title>
        <published>2024-01-15T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Yvonne Zhang</name><uri>https://github.com/yvonnezhangc</uri>
	</author>
	
	<author>
		<name>Aloysius Chan</name><uri>https://github.com/circle-aloychan</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7597/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/add-erc-contract-signature-validation-extension-for-eip-2612-permit/18157" />
        

        <id>https://wg-eips.ritovision.com/7597/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7597"
            label="ERC-7597" />
        

        
        

        
        <summary type="html">An ERC to extend ERC-2612 Permit to support ERC-1271-based signature validation.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7597/">&lt;h1 id=&quot;eip-contract-signature-validation-extension-for-erc-2612-permit&quot;&gt;EIP: Contract signature validation extension for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2612&#x2F;&quot;&gt;ERC-2612&lt;&#x2F;a&gt; Permit&lt;&#x2F;h1&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal aims to extend the functionality of the existing &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2612&#x2F;&quot;&gt;ERC-2612&lt;&#x2F;a&gt; Permit to support gasless &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; approval operations initiated by smart contract wallets.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The current signature validation scheme in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2612&#x2F;&quot;&gt;ERC-2612&lt;&#x2F;a&gt;, based on V, R, S parameters, restricts signature validation to EOA wallets.&lt;&#x2F;p&gt;
&lt;p&gt;With the growing popularity of smart contract wallets and increased adoption of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;ERC-1271&lt;&#x2F;a&gt;, it is necessary to allow for flexible signature validation methods and the use of custom logic in each contract&#x27;s signature verification. By accepting unstructured signature bytes as input, custom algorithms and signature schemes can be utilized, enabling a wider range of wallet types.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Compliant contracts must implement the &lt;code&gt;permit&lt;&#x2F;code&gt; using the following spec&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function permit(address owner, address spender, uint value, uint deadline, bytes memory signature) external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;as well as two other interfaces previously mandated by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2612&#x2F;&quot;&gt;ERC-2612&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function nonces(address owner) external view returns (uint)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function DOMAIN_SEPARATOR() external view returns (bytes32)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;A call to &lt;code&gt;permit(owner, spender, value, deadline, signature)&lt;&#x2F;code&gt; will set &lt;code&gt;allowance[owner][spender]&lt;&#x2F;code&gt; to value, increment &lt;code&gt;nonces[owner]&lt;&#x2F;code&gt; by 1, and emit a corresponding &lt;code&gt;Approval&lt;&#x2F;code&gt; event, if and only if the following conditions are met:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The current blocktime is less than or equal to &lt;code&gt;deadline&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;owner&lt;&#x2F;code&gt; is not the zero address.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;nonces[owner]&lt;&#x2F;code&gt; (before the state update) is equal to nonce.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;signature&lt;&#x2F;code&gt; validation:
&lt;ul&gt;
&lt;li&gt;If &lt;code&gt;owner&lt;&#x2F;code&gt; is an EOA, &lt;code&gt;signature&lt;&#x2F;code&gt; is a valid secp256k1 signature in the form of &lt;code&gt;abi.encodePacked(r, s, v)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;owner&lt;&#x2F;code&gt; is a contract, &lt;code&gt;signature&lt;&#x2F;code&gt; is validated by calling &lt;code&gt;isValidSignature()&lt;&#x2F;code&gt; on the &lt;code&gt;owner&lt;&#x2F;code&gt; contract.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;If any of these conditions are not met, the permit call must revert.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;By replacing the existing V, R, S signature validation scheme and introducing support for unstructured bytes input, contract developers can use a unified interface to validate signature from both EOAs and SC wallets. This allows for the utilization of different signature schemes and algorithms fitting the wallet type, paving the way for smart contract wallets and advanced wallet types to enhance their signature validation processes, promoting flexibility and innovation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal is fully backward-compatible with the existing ERC-2612 standard. Contracts that currently rely on the V, R, S signature validation scheme will continue to function without any issues.&lt;&#x2F;p&gt;
&lt;p&gt;If both V, R, S signature validation and the new unstructured bytes signature validation need to be supported for backward compatibility reasons, developers can reduce duplicates by adapting the following code block as an example:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function permit(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address owner,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address spender,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    uint256 value,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    uint256 deadline,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    uint8 v, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytes32 r, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytes32 s&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;) external {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    _permit(owner, spender, value, deadline, abi.encodePacked(r, s, v));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Sample &lt;code&gt;permit&lt;&#x2F;code&gt; implemented with OZ&#x27;s SignatureChecker&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Update allowance with a signed permit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Signature bytes can be used for both EOA wallets and contract wallets.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;       Token owner&amp;#39;s address (Authorizer)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     Spender&amp;#39;s address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;       Amount of allowance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; deadline&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    The time at which the signature expires (unix time)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   Unstructured bytes signature signed by an EOA wallet or a contract wallet&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; permit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; deadline&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;deadline &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; now&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Permit is expired&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;owner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC20: approve from the zero address&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;spender &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC20: approve to the zero address&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; digest &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;1901&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        DOMAIN_SEPARATOR&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            deadline&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check for both ECDSA signature and ERC-1271 signature. A sample SignatureChecker is available at&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; https:&#x2F;&#x2F;github.com&#x2F;OpenZeppelin&#x2F;openzeppelin-contracts&#x2F;blob&#x2F;7bd2b2a&#x2F;contracts&#x2F;utils&#x2F;cryptography&#x2F;SignatureChecker.sol&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        SignatureChecker&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isValidSignatureNow&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            typedDataHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        &amp;quot;Invalid signature&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    allowed&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;spender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Approval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;For contract wallets, the security of &lt;code&gt;permit&lt;&#x2F;code&gt; relies on &lt;code&gt;isValidSignature()&lt;&#x2F;code&gt; to ensure the signature bytes represent the desired execution from contract wallet owner(s). Contract wallet developers must exercise caution when implementing custom signature validation logic to ensure the security of their contracts.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Use contract signature for signed transfer</title>
        <published>2024-01-15T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Yvonne Zhang</name><uri>https://github.com/yvonnezhangc</uri>
	</author>
	
	<author>
		<name>Aloysius Chan</name><uri>https://github.com/circle-aloychan</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7598/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/add-erc-contract-signature-validation-extension-for-erc-3009-transfer-with-authorization/18158" />
        

        <id>https://wg-eips.ritovision.com/7598/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7598"
            label="ERC-7598" />
        

        
        

        
        <summary type="html">An ERC to extend ERC-3009 Transfer with Authorization to support ERC-1271 signature validation.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7598/">&lt;h1 id=&quot;eip-contract-signature-validation-extension-for-erc-3009-transfer-with-authorization&quot;&gt;EIP: Contract signature validation extension for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3009&#x2F;&quot;&gt;ERC-3009&lt;&#x2F;a&gt; Transfer with Authorization&lt;&#x2F;h1&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal aims to extend the functionality of the existing &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3009&#x2F;&quot;&gt;ERC-3009&lt;&#x2F;a&gt; standard, &quot;Transfer With Authorization,&quot; to support transfer operations initiated by smart contract wallets.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The existing &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3009&#x2F;&quot;&gt;ERC-3009&lt;&#x2F;a&gt; standard enables asset transfers with ECDSA signatures. However, as smart contract wallets become more prevalent in the ecosystem, the current standard is no longer sufficient.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal aims to enhance the usability and composeability of the standard by extending ERC-3009 with smart contract wallet signature validation, as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;ERC-1271&lt;&#x2F;a&gt;. By incorporating this extension, users will have greater flexibility in managing their assets while ensuring a secure authorization process.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The following events and interfaces must still be present given the initial spec defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3009&#x2F;&quot;&gt;ERC-3009&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Event &lt;code&gt;AuthorizationUsed&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Constants &lt;code&gt;TRANSFER_WITH_AUTHORIZATION_TYPEHASH&lt;&#x2F;code&gt; and &lt;code&gt;RECEIVE_WITH_AUTHORIZATION_TYPEHASH&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;View function interface &lt;code&gt;authorizationState(address authorizer, bytes32 nonce)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In addition, the following interfaces must be added to be compliant with the standard:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @notice Execute a transfer with a signed authorization&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @param from          Payer&amp;#39;s address (Authorizer)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @param to            Payee&amp;#39;s address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @param value         Amount to be transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @param validAfter    The time after which this is valid (unix time)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @param validBefore   The time before which this is valid (unix time)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @param nonce         Unique nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @param signature     Unstructured bytes signature signed by an EOA wallet or a contract wallet&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function transferWithAuthorization(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address from,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address to,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    uint256 value,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    uint256 validAfter,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    uint256 validBefore,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytes32 nonce,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytes memory signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;) external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @notice Receive a transfer with a signed authorization from the payer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @dev This has an additional check to ensure that the payee&amp;#39;s address matches&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * the caller of this function to prevent front-running attacks. (See security&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * considerations)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @param from          Payer&amp;#39;s address (Authorizer)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @param to            Payee&amp;#39;s address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @param value         Amount to be transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @param validAfter    The time after which this is valid (unix time)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @param validBefore   The time before which this is valid (unix time)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @param nonce         Unique nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @param signature     Unstructured bytes signature signed by an EOA wallet or a contract wallet&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function receiveWithAuthorization(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address from,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address to,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    uint256 value,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    uint256 validAfter,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    uint256 validBefore,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytes32 nonce,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytes memory signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;) external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Optional:&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;AuthorizationCanceled&lt;&#x2F;code&gt; event and &lt;code&gt;CANCEL_AUTHORIZATION_TYPEHASH&lt;&#x2F;code&gt; constant as defined in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3009&#x2F;&quot;&gt;ERC-3009&lt;&#x2F;a&gt; spec.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @notice Attempt to cancel an authorization&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @param authorizer    Authorizer&amp;#39;s address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @param nonce         Nonce of the authorization&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @param signature     Unstructured bytes signature signed by an EOA wallet or a contract wallet&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function cancelAuthorization(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address authorizer,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytes32 nonce,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytes memory signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;) external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;By replacing the existing V, R, S signature validation scheme and introducing support for unstructured bytes input, contract developers can use a unified interface to validate signature from both EOAs and SC wallets. This allows for the utilization of different signature schemes and algorithms fitting the wallet type, paving the way for smart contract wallets and advanced wallet types to enhance their signature validation processes, promoting flexibility and innovation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal is fully backward-compatible with the existing ERC-3009 standard. Contracts that currently rely on the V, R, S signature validation scheme will continue to function without any issues.&lt;&#x2F;p&gt;
&lt;p&gt;In the event that both the existing V, R, S signature validation scheme and the new unstructured bytes signature validation need to be supported for backward compatibility, developers can reduce duplicates by adapting the following code block as an example:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function transferWithAuthorization(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address from,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address to,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    uint256 value,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    uint256 validAfter,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    uint256 validBefore,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytes32 nonce,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    uint8 v,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytes32 r,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytes32 s&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;) external {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    transferWithAuthorization(owner, spender, value, deadline, abi.encodePacked(r, s, v));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  * @notice Execute a transfer with a signed authorization&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  * @dev EOA wallet signatures should be packed in the order of r, s, v.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  * @param from          Payer&amp;#39;s address (Authorizer)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  * @param to            Payee&amp;#39;s address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  * @param value         Amount to be transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  * @param validAfter    The time after which this is valid (unix time)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  * @param validBefore   The time before which this is valid (unix time)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  * @param nonce         Unique nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  * @param signature     Signature byte array produced by an EOA wallet or a contract wallet&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function _transferWithAuthorization(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address from,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address to,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    uint256 value,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    uint256 validAfter,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    uint256 validBefore,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytes32 nonce,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytes memory signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;) internal {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    require(now &amp;gt; validAfter, &amp;quot;Authorization is not yet valid&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    require(now &amp;lt; validBefore, &amp;quot;Authorization is expired&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    require(!_authorizationStates[authorizer][nonce], &amp;quot;Authorization is used or canceled&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytes32 digest = keccak256(abi.encodePacked(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        hex&amp;quot;1901&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        DOMAIN_SEPARATOR,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        keccak256(abi.encode(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            TRANSFER_WITH_AUTHORIZATION_TYPEHASH,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            from,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            to,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            value,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            validAfter,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            validBefore,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    require(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &#x2F;&#x2F; Check for both ECDSA signature and ERC-1271 signature. A sample SignatureChecker is available at&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &#x2F;&#x2F; https:&#x2F;&#x2F;github.com&#x2F;OpenZeppelin&#x2F;openzeppelin-contracts&#x2F;blob&#x2F;7bd2b2a&#x2F;contracts&#x2F;utils&#x2F;cryptography&#x2F;SignatureChecker.sol&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        SignatureChecker.isValidSignatureNow(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            owner,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            typedDataHash,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;Invalid signature&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    );&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    _authorizationStates[authorizer][nonce] = true;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    emit AuthorizationUsed(authorizer, nonce);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    _transfer(from, to, value);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;For contract wallets, the security of &lt;code&gt;transferWithAuthorization&lt;&#x2F;code&gt;, &lt;code&gt;receiveWithAuthorization&lt;&#x2F;code&gt;, and &lt;code&gt;cancelAuthorization&lt;&#x2F;code&gt; rely on &lt;code&gt;ContractWallet.isValidSignature()&lt;&#x2F;code&gt; to ensure the signature bytes represent the desired execution from contract wallet owner(s). Contract wallet developers must exercise caution when implementing custom signature validation logic to ensure the security of their contracts.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>PeerDAS - Peer Data Availability Sampling</title>
        <published>2024-01-12T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Danny Ryan</name><uri>https://github.com/djrtwo</uri>
	</author>
	
	<author>
		<name>Dankrad Feist</name><uri>https://github.com/dankrad</uri>
	</author>
	
	<author>
		<name>Francesco D&#x27;Amato</name><uri>https://github.com/fradamt</uri>
	</author>
	
	<author>
		<name>Hsiao-Wei Wang</name><uri>https://github.com/hwwhww</uri>
	</author>
	
	<author>
		<name>Alex Stokes</name><uri>https://github.com/ralexstokes</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7594/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7594-peerdas-peer-data-availability-sampling/18215" />
        

        <id>https://wg-eips.ritovision.com/7594/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7594"
            label="EIP-7594" />
        

        
        

        
        <summary type="html">Introducing simple DAS utilizing gossip distribution and peer requests</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7594/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;PeerDAS (Peer Data Availability Sampling) is a networking protocol that allows nodes to perform data availability sampling (DAS) to ensure that blob data has been made available while downloading only a subset of the data. PeerDAS utilizes gossip for distribution, discovery for finding peers of particular data custody, and peer requests for sampling.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;DAS is a method of scaling data availability beyond the levels of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt; by not requiring all nodes to download all data while still ensuring that all of the data has been made available.&lt;&#x2F;p&gt;
&lt;p&gt;Providing additional data availability helps bring scale to Ethereum users in the context of layer 2 systems called &quot;roll-ups&quot; whose dominant bottleneck is layer 1 data availability.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;We extend the blobs introduced in EIP-4844 using a one-dimensional erasure coding extension. Each row consists of the blob data combined with its erasure code. It is subdivided into cells, which are the smallest units that can be authenticated with their respective blob&#x27;s KZG commitments. Each column, associated with a specific gossip subnet, consists of the cells from all rows for a specific index. Each node is responsible for maintaining a deterministic set of column subnets and custodying their data as a function of their node ID.&lt;&#x2F;p&gt;
&lt;p&gt;Nodes find and maintain a diverse peer set and sample columns from their peers to perform DAS every slot.&lt;&#x2F;p&gt;
&lt;p&gt;A node can reconstruct the entire data matrix if it acquires at least 50% of all the columns. If a node has less than 50%, it can request the necessary columns from its peer nodes.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, a limit of 6 blobs per transaction is introduced. Clients MUST enforce this limit when validating blob transactions at submission time, when received from the network, and during block production and processing.&lt;&#x2F;p&gt;
&lt;p&gt;The detailed specifications are on &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;tree&#x2F;9d377fd53d029536e57cfda1a4d2c700c59f86bf&#x2F;specs&#x2F;fulu&#x2F;&quot;&gt;ethereum&#x2F;consensus-specs&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;networking&quot;&gt;Networking&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP introduces cell KZG proofs, which are used to prove that a KZG commitment opens to a cell at the given index. This allows downloading only specific cells from a blob, while still ensuring data integrity with respect to the corresponding KZG commitment, and is therefore a key component of data availability sampling. However, computing the cell proofs for a blob is an expensive operation, which a block producer would have to repeat for many blobs. Since proof verification is much cheaper than proof computation, and the proof size is negligible compared to cell size, we instead require blob transaction senders to compute the proofs themselves and include them in the EIP-4844 transaction pool wrapper for blob transactions.&lt;&#x2F;p&gt;
&lt;p&gt;To this end, during transaction gossip responses (&lt;code&gt;PooledTransactions&lt;&#x2F;code&gt;), the wrapper is modified to:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;rlp([tx_payload_body, wrapper_version, blobs, commitments, cell_proofs])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cell_proofs = [cell_proof_0, cell_proof_1, ...]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;tx_payload_body&lt;&#x2F;code&gt;, &lt;code&gt;blobs&lt;&#x2F;code&gt; and &lt;code&gt;commitments&lt;&#x2F;code&gt; are as in EIP-4844, while the &lt;code&gt;proofs&lt;&#x2F;code&gt; field is replaced by &lt;code&gt;cell_proofs&lt;&#x2F;code&gt;, and a &lt;code&gt;wrapper_version&lt;&#x2F;code&gt; is added. These are defined as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;wrapper_version&lt;&#x2F;code&gt; - one byte indicating which version of the wrapper is used. For the current version, it is set to &lt;strong&gt;&lt;code&gt;1&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;cell_proofs&lt;&#x2F;code&gt; - list of cell proofs for all &lt;code&gt;blobs&lt;&#x2F;code&gt;, including the proofs for the extension indices, for a total of &lt;code&gt;CELLS_PER_EXT_BLOB&lt;&#x2F;code&gt; proofs per blob (&lt;code&gt;CELLS_PER_EXT_BLOB&lt;&#x2F;code&gt; is the number of cells for an extended blob, defined &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;tree&#x2F;9d377fd53d029536e57cfda1a4d2c700c59f86bf&#x2F;specs&#x2F;fulu&#x2F;polynomial-commitments-sampling.md#cells&quot;&gt;in the consensus specs&lt;&#x2F;a&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note that, while &lt;code&gt;cell_proofs&lt;&#x2F;code&gt; contain the proofs for all cells, including the extension cells, the blobs themselves are sent without being extended (&lt;code&gt;CELLS_PER_EXT_BLOB &#x2F; 2&lt;&#x2F;code&gt; cells per blob). This is to avoid sending redundant data, which can quickly be computed by the receiving node.
In other words, &lt;code&gt;cell_proofs[i * CELLS_PER_EXT_BLOB + j]&lt;&#x2F;code&gt; is the proof for cell &lt;code&gt;j&lt;&#x2F;code&gt; of &lt;code&gt;compute_cells(blobs[i])&lt;&#x2F;code&gt;, where &lt;code&gt;compute_cells(blob)&lt;&#x2F;code&gt; outputs all cells of &lt;code&gt;blob&lt;&#x2F;code&gt;, including the extension cells.&lt;&#x2F;p&gt;
&lt;p&gt;The node MUST validate &lt;code&gt;tx_payload_body&lt;&#x2F;code&gt; and verify the wrapped data against it. To do so, ensure that:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;There are an equal number of &lt;code&gt;tx_payload_body.blob_versioned_hashes&lt;&#x2F;code&gt;, &lt;code&gt;blobs&lt;&#x2F;code&gt; and &lt;code&gt;commitments&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;cell_proofs&lt;&#x2F;code&gt; contains exactly &lt;code&gt;CELLS_PER_EXT_BLOB * len(blobs)&lt;&#x2F;code&gt; cell proofs&lt;&#x2F;li&gt;
&lt;li&gt;The KZG &lt;code&gt;commitments&lt;&#x2F;code&gt; hash to the versioned hashes, i.e. &lt;code&gt;kzg_to_versioned_hash(commitments[i]) == tx_payload_body.blob_versioned_hashes[i]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;The KZG &lt;code&gt;commitments&lt;&#x2F;code&gt; match the corresponding &lt;code&gt;blobs&lt;&#x2F;code&gt; and &lt;code&gt;cell_proofs&lt;&#x2F;code&gt;. This requires computing the extension cells for all &lt;code&gt;blobs&lt;&#x2F;code&gt; (e.g. via &lt;code&gt;compute_cells&lt;&#x2F;code&gt;), and verifying all &lt;code&gt;cell_proofs&lt;&#x2F;code&gt;. (Note: all cell proofs can be batch verified at once, e.g. via &lt;code&gt;verify_cell_kzg_proof_batch&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-use-das-to-scale-the-da-layer&quot;&gt;Why use DAS to scale the DA layer?&lt;&#x2F;h3&gt;
&lt;p&gt;PeerDAS is a DAS scheme that requires nodes to only download a small constant fraction of the data to satisfy a local availability check. With the current parameters, this is 1&#x2F;8 of the total data (i.e. blobs in a block), which can in the future be decreased to 1&#x2F;16 or even 1&#x2F;32 by reducing the size of samples (increasing the number of columns). In this way, PeerDAS allows for securely scaling the blob throughput of the network without compromising decentralization, i.e., without increasing node&#x27;s bandwidth and storage requirements.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;what-does-peer-sampling-provide&quot;&gt;What does peer sampling provide?&lt;&#x2F;h3&gt;
&lt;p&gt;PeerDAS takes the set of peers of a node on the network as a primitive to build a DAS scheme around. A focus on peers allows for redundancy in the mechanism (as a node generally has many peers, and peer count can also be cheaply increased) which both helps with theoretical security as detailed in the &quot;Security Considerations&quot; section, but also practical security of the implementation (e.g. if a single peer fails, a node can likely use another peer for the same sampling task).&lt;&#x2F;p&gt;
&lt;p&gt;PeerDAS also has the nice property that any given node may voluntarily custody more of the data than the bare minimum which increases the performance of the mechanism. Alternative schemes do not readily support this &quot;transparent&quot; scaling property.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-are-these-parameters-chosen&quot;&gt;Why are these parameters chosen?&lt;&#x2F;h3&gt;
&lt;p&gt;The parameters of PeerDAS given in the specs support network security while keeping node requirements sufficiently low. See the security argument below for further details.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-do-validators-have-an-additional-custody-requirement-beyond-full-nodes&quot;&gt;Why do validators have an additional custody requirement beyond full nodes?&lt;&#x2F;h3&gt;
&lt;p&gt;Validators are assumed to have marginally higher requirements to participate on the network. PeerDAS introduces a custody requirement that scales with the validator count so that nodes with more resources can contribute to a more stable backbone that makes the global network more robust.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;column-sampling-vs-row-sampling&quot;&gt;Column sampling vs row sampling&lt;&#x2F;h3&gt;
&lt;p&gt;PeerDAS defines a sample as a &quot;column&quot; which is a cross-section across &lt;em&gt;all&lt;&#x2F;em&gt; blobs, rather than a &quot;row&quot; which would be a full blob.
The sampling scheme could be defined over rows but then any reconstruction strategy would need to work over &quot;extension&quot; blobs that do not a priori exist on the network.
Reconstruction becomes much more tractable by working over columns as nodes can be assumed to have much more of the complete data by default (e.g. because most&#x2F;all of the blobs are in the public mempool).&lt;&#x2F;p&gt;
&lt;p&gt;Another benefit is that sampling over rows requires &lt;em&gt;column&lt;&#x2F;em&gt; extensions which would have to be done at the time of block construction, i.e. on the &quot;critical path&quot;. Sampling over columns requires row extensions which can be done in advance (not on the critical path), and moreover proof computation can be outsourced to senders of blob transactions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is fully backwards compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Refer to the consensus and execution spec tests for testing of this EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The primary failure mode of a DAS scheme is a &quot;data withholding&quot; attack, where a block producer attempts to convince the network some data is available even when the block producer fails to provide the associated data.
PeerDAS resolves withholding attacks by implementing a (pseudo)randomized sampling scheme that decreases the probability of a successful attack as the size of the network grows for a sublinear amount of data that must be downloaded.&lt;&#x2F;p&gt;
&lt;p&gt;This intuition can be formalized as follows:&lt;&#x2F;p&gt;
&lt;p&gt;Letting &lt;code&gt;n&lt;&#x2F;code&gt; be the total number of sampling nodes (i.e. the size of the network), &lt;code&gt;m&lt;&#x2F;code&gt; be the total number of samples possible (cf. &lt;code&gt;NUMBER_OF_CUSTODY_GROUPS&lt;&#x2F;code&gt; in the specs) and &lt;code&gt;k&lt;&#x2F;code&gt; be the minimum number of samples that a node must download (cf. &lt;code&gt;SAMPLES_PER_SLOT&lt;&#x2F;code&gt; in the specs), we have the following bound for the probability of convincing a fraction $\epsilon$ of the nodes that some data is available when it is withheld:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7594&#x2F;.&#x2F;assets&#x2F;withholding-probability.svg&quot; alt=&quot;withholding-probability&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The first term is the number of possible ways to choose a subset of $n\epsilon$ nodes whose sampling queries should be satisfied (i.e. the nodes to be tricked).
The second term is the number of ways to choose a maximally large subset of samples to be made available to satisfy the sampling queries of the $n\epsilon$ nodes without allowing reconstruction of the full data.
Finally, for any such choices, the third term is the probability of success, i.e. the probability that the sampling queries of all chosen $n\epsilon$ nodes are satisfied by the chosen subset up to the reconstruction threshold.&lt;&#x2F;p&gt;
&lt;p&gt;For mainnet parameters given in the specs and assuming 10,000 nodes on the network, we can compute upper bounds of attack success for varying $\epsilon$:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&quot;text-align: center&quot;&gt;$\epsilon$&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;$n\epsilon$ (target nodes)&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;Upper bound on $\mathbb{P}$&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;0.01&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;100&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;$1$&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;0.02&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;200&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;$10^{-20.04}$&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;0.03&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;300&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;$10^{-101.55}$&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;0.04&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;400&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;$10^{-198.24}$&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;0.05&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;500&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;$10^{-306.34}$&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The table shows that the chances of a successful attack quickly drop to a negligible amount and so PeerDAS is considered secure to withholding attacks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>BLS signed transactions</title>
        <published>2024-01-10T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Marius van der Wijden</name><uri>https://github.com/MariusVanDerWijden</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7591/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7591-bls-signed-transactions/19911" />
        

        <id>https://wg-eips.ritovision.com/7591/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:7591"
            label="EIP-7591" />
        

        
        

        
        <summary type="html">Introduces a new transaction type signed with BLS signatures</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7591/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; transaction type that is signed with BLS signatures.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The BLS signature scheme allows for easy aggregation and verification of aggregated signatures.
If a substantial number of transactions on mainnet were BLS signed transactions, we can aggregate signatures in a block and batch-verify them.
This will reduce growth of the chain history.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;BLS_TX_TYPE = Bytes1(0x04)&lt;&#x2F;p&gt;
&lt;h3 id=&quot;transaction-type&quot;&gt;Transaction Type&lt;&#x2F;h3&gt;
&lt;p&gt;The transaction type will have the following format:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[chain_id, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit, to, value, data, access_list, sender, signature]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;with &lt;code&gt;sender&lt;&#x2F;code&gt; being the BLS public key of an account with address &lt;code&gt;address = [0:20](keccak256(sender))&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The signature value &lt;code&gt;signature&lt;&#x2F;code&gt; is calculated by constructing a BLS signature over the following digest:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;tx_hash = keccak256(BLS_TX_TYPE || rlp([chain_id, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit, to, value, data, access_list, sender]))&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;header-changes&quot;&gt;Header changes&lt;&#x2F;h3&gt;
&lt;p&gt;The block header will be amended with the &lt;code&gt;aggregated_sig&lt;&#x2F;code&gt; field, containing an aggregated signature of all BLS transactions in the block.&lt;&#x2F;p&gt;
&lt;p&gt;The resulting RLP encoding of the header is therefore:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;rlp([&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    parent_hash,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347, # ommers hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    coinbase,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state_root,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    txs_root,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    receipts_root,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    logs_bloom,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    0, # difficulty&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    number,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_limit,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_used,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    timestamp,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    extradata,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    prev_randao,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    0x0000000000000000, # nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    base_fee_per_gas,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    withdrawals_root,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    blob_gas_used,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    excess_blob_gas,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    aggregated_sig,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;block-changes&quot;&gt;Block changes&lt;&#x2F;h3&gt;
&lt;p&gt;The block building algorithm needs to be changed in order to built the aggregated signature of all BLS signed transactions in the block.
All transactions in the block will be added without the signature field set.&lt;&#x2F;p&gt;
&lt;p&gt;Blocks with transactions containing the &lt;code&gt;signature&lt;&#x2F;code&gt; field MUST be rejected.&lt;&#x2F;p&gt;
&lt;p&gt;On block verification, the &lt;code&gt;verifyAggregate&lt;&#x2F;code&gt; algorithm is used as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;valid = verifyAggregate(sender_1, ... sender_n, tx_hash_1, ... tx_hash_n, aggregated_sig)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Removing the ECDSA signature from a transaction saves 65 bytes. The BLS public key is 48 bytes, the aggregated signature is 96 bytes.
Thus we save &lt;code&gt;-96 + (65-48)* #transactions&lt;&#x2F;code&gt; bytes per block. With ~7000 blocks per day, 1.000.000 transactions per day, the average block contains roughly 150 transactions.&lt;&#x2F;p&gt;
&lt;p&gt;Thus we would save 2454 bytes or 2.4KB per block. This would equate to ~1.5% saving given an average block size of 160KB.&lt;&#x2F;p&gt;
&lt;p&gt;In addition to the (admittedly meager) size savings for full nodes, the ability to add a new transaction type to utilize a different signature scheme does have some merit to it. This proposal shows that it would be possible to add for example a quantum safe signature scheme to ethereum.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces backward incompatible changes to the block validation rule set on the execution layer and introduces a new transaction type and a new header field. Thus a hardfork is needed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The messages signed via BLS are distinct (no hash collisions on the txhash), thus the aggregation is secure even without a proof-of-possession.
The public keys are not distinct which is not a problem in BLS.&lt;&#x2F;p&gt;
&lt;p&gt;We assume that keccak256 and ECDSA and BLS are working as intended.
Suppose we have two addresses &lt;code&gt;address_1 = keccak256(pk_ecdsa)&lt;&#x2F;code&gt; and &lt;code&gt;address_2 = keccak(pk_bls)&lt;&#x2F;code&gt; with &lt;code&gt;address_1 == address_2&lt;&#x2F;code&gt;.
We know that &lt;code&gt;pk_ecdsa&lt;&#x2F;code&gt; must be equal to &lt;code&gt;pk_bls&lt;&#x2F;code&gt; (follows from keccak).
This would mean that we would either be able to find &lt;code&gt;x&lt;&#x2F;code&gt; with &lt;code&gt;g_bls^x = y&lt;&#x2F;code&gt; for a given &lt;code&gt;y&lt;&#x2F;code&gt; (violates the security of BLS)
or find &lt;code&gt;z&lt;&#x2F;code&gt; with &lt;code&gt;d_ecdsa^z = y&lt;&#x2F;code&gt; (violates the security of ECDSA).&lt;&#x2F;p&gt;
&lt;p&gt;Thus it would be impossible (with greater than negligble probability) to find two private keys, one in ECDSA and one in BLS that control the same account.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>ERC-20 Holder Extension for NFTs</title>
        <published>2024-01-05T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Steven Pineda</name><uri>https://github.com/steven2308</uri>
	</author>
	
	<author>
		<name>Jan Turk</name><uri>https://github.com/ThunderDeliverer</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7590/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/token-holder-extension-for-nfts/16260" />
        

        <id>https://wg-eips.ritovision.com/7590/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:7590"
            label="ERC-7590" />
        

        
        

        
        <summary type="html">Extension to allow NFTs to receive and transfer ERC-20 tokens.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7590/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal suggests an extension to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; to enable easy exchange of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens. By enhancing &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;, it allows unique tokens to manage and trade &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; fungible tokens bundled in a single NFT. This is achieved by including methods to pull &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens into the NFT contract to a specific NFT, and transferring them out by the owner of such NFT. A transfer out nonce is included to prevent front-running issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;In the ever-evolving landscape of blockchain technology and decentralized ecosystems, interoperability between diverse token standards has become a paramount concern. By enhancing &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; functionality, this proposal empowers non-fungible tokens (NFTs) to engage in complex transactions, facilitating the exchange of fungible tokens, unique assets, and multi-class assets within a single protocol.&lt;&#x2F;p&gt;
&lt;p&gt;This ERC introduces new utilities in the following areas:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Expanded use cases&lt;&#x2F;li&gt;
&lt;li&gt;Facilitating composite transactions&lt;&#x2F;li&gt;
&lt;li&gt;Market liquidity and value creation&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;expanded-use-cases&quot;&gt;Expanded Use Cases&lt;&#x2F;h3&gt;
&lt;p&gt;Enabling &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; tokens to handle various token types opens the door to a wide array of innovative use cases. From gaming and digital collectibles to decentralized finance (DeFi) and supply chain management, this extension enhances the potential of NFTs by allowing them to participate in complex, multi-token transactions.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;facilitating-composite-transactions&quot;&gt;Facilitating Composite Transactions&lt;&#x2F;h3&gt;
&lt;p&gt;With this extension, composite transactions involving both fungible and non-fungible assets become easier. This functionality is particularly valuable for applications requiring intricate transactions, such as gaming ecosystems where in-game assets may include a combination of fungible and unique tokens.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;market-liquidity-and-value-creation&quot;&gt;Market Liquidity and Value Creation&lt;&#x2F;h3&gt;
&lt;p&gt;By allowing &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; tokens to hold and trade different types of tokens, it enhances liquidity for markets in all types of tokens.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7590&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;is IERC165, IERC721&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to notify listeners that the token received ERC-20 tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; erc20Contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the ERC-20 smart contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; toTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ID of the token receiving the ERC-20 tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the account from which the tokens are being transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The number of ERC-20 tokens received&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ReceivedERC20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; erc20Contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; toTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to notify the listeners that the ERC-20 tokens have been transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; erc20Contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the ERC-20 smart contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; fromTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ID of the token from which the ERC-20 tokens have been transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address receiving the ERC-20 tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The number of ERC-20 tokens transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransferredERC20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; erc20Contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; fromTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to retrieve the given token&amp;#39;s specific ERC-20 balance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; erc20Contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the ERC-20 smart contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ID of the token being checked for ERC-20 balance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; amount of the specified ERC-20 tokens owned by a given token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOfERC20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; erc20Contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfer ERC-20 tokens from a specific token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The balance MUST be transferred from this smart contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST increase the transfer-out-nonce for the tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST revert if the `msg.sender` is not the owner of the NFT or approved to manage it.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; erc20Contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the ERC-20 smart contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ID of the token to transfer the ERC-20 tokens from&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The number of ERC-20 tokens to transfer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Additional data with no specified format, to allow for custom logic&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferHeldERC20FromToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; erc20Contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfer ERC-20 tokens to a specific token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ERC-20 smart contract must have approval for this contract to transfer the ERC-20 tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The balance MUST be transferred from the `msg.sender`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; erc20Contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the ERC-20 smart contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ID of the token to transfer ERC-20 tokens to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The number of ERC-20 tokens to transfer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Additional data with no specified format, to allow for custom logic&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferERC20ToToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; erc20Contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Nonce increased every time an ERC20 token is transferred out of a token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ID of the token to check the nonce for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; nonce of the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; erc20TransferOutNonce&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;pull-mechanism&quot;&gt;Pull Mechanism&lt;&#x2F;h3&gt;
&lt;p&gt;We propose using a pull mechanism, where the contract transfers the token to itself, instead of receiving it via &quot;safe transfer&quot; for 2 reasons:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Customizability with Hooks. By initiating the process this way, smart contract developers have the flexibility to execute specific actions before and after transferring the tokens.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Lack of transfer with callback: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens lack a standardized transfer with callback method, such as the &quot;safeTransfer&quot; on &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;, which means there is no reliable way to notify the receiver of a successful transfer, nor to know which is the destination token is.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;This has the disadvantage of requiring approval of the token to be transferred before actually transferring it into an NFT.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;granular-vs-generic&quot;&gt;Granular vs Generic&lt;&#x2F;h3&gt;
&lt;p&gt;We considered 2 ways of presenting the proposal:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;A granular approach where there is an independent interface for each type of held token.&lt;&#x2F;li&gt;
&lt;li&gt;A universal token holder which could also hold and transfer &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;An implementation of the granular version is slightly cheaper in gas, and if you&#x27;re using just one or two types, it&#x27;s smaller in contract size. The generic version is smaller and has single methods to send or receive, but it also adds some complexity by always requiring Id and amount on transfer methods. Id not being necessary for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; and amount not being necessary for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;We also considered that due to the existence of safe transfer methods on both &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt;, and the commonly used interfaces of &lt;code&gt;IERC721Receiver&lt;&#x2F;code&gt; and &lt;code&gt;IERC1155Receiver&lt;&#x2F;code&gt;, there is not much need to declare an additional interface to manage such tokens. However, this is not the case for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;, which does not include a method with a callback to notify the receiver of the transfer.&lt;&#x2F;p&gt;
&lt;p&gt;For the aforementioned reasons, we decided to go with a granular approach.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Tests are included in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7590&#x2F;.&#x2F;assets&#x2F;test&#x2F;erc7590.ts&quot;&gt;&lt;code&gt;erc7590.ts&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;To run them in terminal, you can use the following commands:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cd ..&#x2F;assets&#x2F;eip-erc7590&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;npm install&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;npx hardhat test&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7590&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;ERC7590Mock.sol&quot;&gt;&lt;code&gt;ERC7590Mock.sol&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The same security considerations as with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; apply: hidden logic may be present in any of the functions, including burn, add resource, accept resource, and more.&lt;&#x2F;p&gt;
&lt;p&gt;Caution is advised when dealing with non-audited contracts.&lt;&#x2F;p&gt;
&lt;p&gt;Implementations MUST use the message sender as from parameter when they are transferring tokens into an NFT. Otherwise, since the current contract needs approval, it could potentially pull the external tokens into a different NFT.&lt;&#x2F;p&gt;
&lt;p&gt;When transferring &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens in or out of an NFT, it could be the case that the amount transferred is not the same as the amount requested. This could happen if the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; contract has a fee on transfer. This could cause a bug on your Token Holder contract if you do not manage it properly. There are 2 ways to do it, both of which are valid:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Use the &lt;code&gt;IERC20&lt;&#x2F;code&gt; interface to check the balance of the contract before and after the transfer, and revert if the balance is not the expected one, hence not supporting tokens with fees on transfer.&lt;&#x2F;li&gt;
&lt;li&gt;Use the &lt;code&gt;IERC20&lt;&#x2F;code&gt; interface to check the balance of the contract before and after the transfer, and use the difference to calculate the amount of tokens that were actually transferred.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;To prevent a seller from front running the sale of an NFT holding &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens to transfer out such tokens before a sale is executed, marketplaces MUST beware of the &lt;code&gt;erc20TransferOutNonce&lt;&#x2F;code&gt; and revert if it has changed since listed.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens that are transferred directly to the NFT contract will be lost.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Expirable NFTs and SBTs</title>
        <published>2024-01-04T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>sirawt</name><uri>https://github.com/MASDXI</uri>
	</author>
	
	<author>
		<name>ADISAKBOONMARK</name><uri>https://github.com/ADISAKBOONMARK</uri>
	</author>
	
	<author>
		<name>parametprame</name><uri>https://github.com/parametprame</uri>
	</author>
	
	<author>
		<name>Nacharoen</name><uri>https://github.com/najaroen</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7858/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7858-expirable-nft-sbt/22406" />
        

        <id>https://wg-eips.ritovision.com/7858/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:7858"
            label="ERC-7858" />
        

        
        

        
        <summary type="html">Non-fungible (NFT) and soulbound (SBT) tokens with expiration, supporting time-limited use cases.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7858/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Introduces an extension for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; Non-Fungible Tokens (NFTs) and Soulbound Tokens (SBTs) that adds an expiration mechanism, allowing tokens to become invalid after a predefined period. This additional layer of functionality ensures that the expiration mechanism does not interfere with existing NFTs or SBTs, preserving transferability for NFTs and compatibility with current DApps such as NFT Marketplace. Expiration can be defined using either block height or timestamp, offering flexibility for various use cases.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Before this EIP, NFTs and SBTs implemented expiration mechanisms via custom mappings. However, this approach presents challenges, such as: inconsistent integration with other smart contracts, and the custom &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; implementations might misbehave when used in NFT marketplaces. This EIP addresses these issues by providing a built-in expiration mechanism and interfaces that are compatible with existing infrastructure. It supports both per-token and epoch-based expiry, allowing developers to choose the appropriate expiry type for their use cases, including:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Access and Authentication
&lt;ul&gt;
&lt;li&gt;Authentication for Identity and Access Management (IAM)&lt;&#x2F;li&gt;
&lt;li&gt;Membership for Membership Management System (MMS)&lt;&#x2F;li&gt;
&lt;li&gt;Ticket and Press for Meetings, Incentive Travel, Conventions, and Exhibitions (MICE) when using with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2135&#x2F;&quot;&gt;ERC-2135&lt;&#x2F;a&gt; or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7578&#x2F;&quot;&gt;ERC-7578&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Subscription-based access for digital platforms.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Digital Certifications, Contracts, Copyrights, Documents, Licenses, Policies, etc.&lt;&#x2F;li&gt;
&lt;li&gt;Loyalty Program voucher or coupon&lt;&#x2F;li&gt;
&lt;li&gt;Governance and Voting Rights&lt;&#x2F;li&gt;
&lt;li&gt;Financial Product
&lt;ul&gt;
&lt;li&gt;Bonds, Loans, Hedge, and Options Contract&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Rental
&lt;ul&gt;
&lt;li&gt;Real Estate Unit, Digital Access, DePIN, etc&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “NOT RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;Compatible implementations MUST implement the &lt;code&gt;IERC7858&lt;&#x2F;code&gt; interface and MUST inherit from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;&#x27;s interface. All functions defined in the interface MUST be present and all function behavior MUST meet the interface specification requirements.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;interface&quot;&gt;Interface&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; &amp;gt;=0.8.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0.9&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-7858: Expirable NFTs and SBTs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; unique&#x2F;granular expiry&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; import &amp;quot;.&#x2F;IERC721.sol&amp;quot;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The EIP-165 identifier of this interface is `0x3ebdfa31`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7858&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;is IERC721 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EXPIRY_TYPE&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        BLOCKS_BASED&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; block.number&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        TIME_BASED&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; block.timestamp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when the expiration date of a token is set or updated.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier of the token ERC721 `tokenId`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; startTime&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The start time of the token (block number or timestamp based on `expiryType`).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; endTime&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The end time of the token (block number or timestamp based on `expiryType`).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TokenExpiryUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; startTime&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; endTime&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the type of the expiry.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; EXPIRY_TYPE&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  Enum value indicating the unit of an expiry.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; expiryType&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;EXPIRY_TYPE&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Checks whether a specific token is expired.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier representing the `tokenId` (ERC721).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; True if the token is expired, false otherwise.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isTokenExpired&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; return depends on the type `block.timestamp` or `block.number`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; {ERC-5007} return in uint64 MAY not suitable for `block.number` based.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; startTime&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; endTime&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;behavior-specification&quot;&gt;Behavior Specification&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;balanceOf&lt;&#x2F;code&gt; that inherited from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; MUST return all tokens even if expired; they still exist but are unusable due to the limitation of tracking expired token on-chain.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;For NFTs &lt;code&gt;transferFrom&lt;&#x2F;code&gt;, and &lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt; MUST allow transferring tokens even if they expired. This ensures that expired tokens remain transferable and tradable, preserving compatibility with existing applications already deployed. However, expired tokens MUST be considered invalid and unusable in contracts that check for token validity.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;expiryType&lt;&#x2F;code&gt; MUST return the type of expiry used by the contract, which can be either &lt;code&gt;BLOCK&lt;&#x2F;code&gt; or &lt;code&gt;TIME&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;isTokenExpired&lt;&#x2F;code&gt; is used for retrieving the status of the given &lt;code&gt;tokenId&lt;&#x2F;code&gt;; the function MUST return &lt;code&gt;true&lt;&#x2F;code&gt; if the token is expired and MUST revert if the &lt;code&gt;tokenId&lt;&#x2F;code&gt; does not exist. Implementations that use custom errors SHOULD revert with &lt;code&gt;ERC721NonexistentToken&lt;&#x2F;code&gt; following the relevant &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6093&#x2F;&quot;&gt;ERC-6093&lt;&#x2F;a&gt; and implementations using Solidity version below &lt;code&gt;v0.8.4&lt;&#x2F;code&gt; or those preferring to use revert with string error SHOULD revert with &lt;code&gt;NonexistToken&lt;&#x2F;code&gt;. If the &lt;code&gt;tokenId&lt;&#x2F;code&gt; exists and is not expired, the function MUST return &lt;code&gt;false&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;startTime&lt;&#x2F;code&gt; and &lt;code&gt;endTime&lt;&#x2F;code&gt; of &lt;code&gt;tokenId&lt;&#x2F;code&gt;, can be &lt;code&gt;block.number&lt;&#x2F;code&gt; or &lt;code&gt;block.timestamp&lt;&#x2F;code&gt; depending on &lt;code&gt;expiryType&lt;&#x2F;code&gt;. The &lt;code&gt;startTime&lt;&#x2F;code&gt; MUST be less than or equal to &lt;code&gt;endTime&lt;&#x2F;code&gt; and &lt;code&gt;startTime&lt;&#x2F;code&gt; SHOULD be strictly less than &lt;code&gt;endTime&lt;&#x2F;code&gt; except when both are set to &lt;code&gt;0&lt;&#x2F;code&gt;. A &lt;code&gt;startTime&lt;&#x2F;code&gt; and &lt;code&gt;endTime&lt;&#x2F;code&gt; of &lt;code&gt;0&lt;&#x2F;code&gt; indicates that the &lt;code&gt;tokenId&lt;&#x2F;code&gt; has no expiration. Tokens with a non-zero &lt;code&gt;startTime&lt;&#x2F;code&gt; and a zero &lt;code&gt;endTime&lt;&#x2F;code&gt; are also considered to have no expiration. If the &lt;code&gt;tokenId&lt;&#x2F;code&gt; does not exist, this function MUST revert in the same way as &lt;code&gt;isTokenExpired&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The interface ID for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt;&#x27;s &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; for &lt;code&gt;IERC7858&lt;&#x2F;code&gt; is &lt;code&gt;0x3ebdfa31&lt;&#x2F;code&gt;, and for &lt;code&gt;IERC7858Epoch&lt;&#x2F;code&gt; it is &lt;code&gt;0xec7ffd66&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;TokenExpiryUpdated&lt;&#x2F;code&gt; MUST be emitted when the token is minted or when its expiration details (&lt;code&gt;startTime&lt;&#x2F;code&gt; or &lt;code&gt;endTime&lt;&#x2F;code&gt;) are updated.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;extension-interface&quot;&gt;Extension Interface&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;Epochs&lt;&#x2F;strong&gt; represent a specific period or block range during which certain tokens are valid borrowing concepts from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7818&#x2F;&quot;&gt;ERC-7818&lt;&#x2F;a&gt;, tokens are grouped under an &lt;code&gt;epoch&lt;&#x2F;code&gt; and share the same &lt;code&gt;validityDuration&lt;&#x2F;code&gt;. For implementations that require epoch-based expiration management, the &lt;code&gt;IERC7858Epoch&lt;&#x2F;code&gt; extension interface MUST be implemented alongside the base &lt;code&gt;IERC7858&lt;&#x2F;code&gt; interface, and all functions and behaviors MUST meet both &lt;code&gt;IERC7858&lt;&#x2F;code&gt; and &lt;code&gt;IERC7858Epoch&lt;&#x2F;code&gt; interface specification requirements.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; &amp;gt;=0.8.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0.9&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-7858: Expirable NFTs and SBTs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; epoch expiry extension&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; import &amp;quot;.&#x2F;IERC7858.sol&amp;quot;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The EIP-165 identifier of this interface is `0xec7ffd66`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7858Epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is IERC7858 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieves the current epoch of the contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The current epoch of the token contract,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * often used for determining active&#x2F;expired states.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; currentEpoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieves the duration of a single epoch.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The duration of a single epoch.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The unit of the epoch length is determined by the `validityPeriodType` function.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; epochLength&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Checks whether a specific `epoch` is expired.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The `epoch` to check.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; True if the token is expired, false otherwise.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Implementing contracts &amp;quot;MUST&amp;quot; define and document the logic for determining expiration,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * typically by comparing the latest epoch with the given `epoch` value,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * based on the `EXPIRY_TYPE` measurement (e.g., block count or time duration).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isEpochExpired&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; epoch&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieves the balance of unexpired tokens owned by an account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of unexpired tokens owned by an account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; unexpiredBalanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieves the balance of a specific `epoch` owned by an account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The `epoch for which the balance is checked.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The balance of the specified `epoch`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &amp;quot;MUST&amp;quot; return 0 if the specified `epoch` is expired.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; unexpiredBalanceOfAtEpoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; epoch&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieves the validity duration of each token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The validity duration of each token in `epoch` unit.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validityDuration&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;extension-behavior-specification&quot;&gt;Extension Behavior Specification&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;unexpiredBalanceOfAtEpoch&lt;&#x2F;code&gt; MUST return the count of usable (unexpired) tokens held by an account from the specified &lt;code&gt;epoch&lt;&#x2F;code&gt;. If the specified &lt;code&gt;epoch&lt;&#x2F;code&gt; is expired, this function MUST return &lt;code&gt;0&lt;&#x2F;code&gt;. For example, if epoch &lt;code&gt;5&lt;&#x2F;code&gt; has expired, calling &lt;code&gt;unexpiredBalanceOfAtEpoch(5, address)&lt;&#x2F;code&gt; returns &lt;code&gt;0&lt;&#x2F;code&gt; even if there were tokens previously held in that epoch.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;unexpiredBalanceOf&lt;&#x2F;code&gt; MUST return total count of usable (unexpired) tokens owned by the account.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;currentEpoch&lt;&#x2F;code&gt; MUST return the current &lt;code&gt;epoch&lt;&#x2F;code&gt; of the contract.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;epochLength&lt;&#x2F;code&gt; MUST return duration between &lt;code&gt;epoch&lt;&#x2F;code&gt; in blocks or time in seconds.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;validityDuration&lt;&#x2F;code&gt; MUST return the validity duration of tokens in terms of &lt;code&gt;epoch&lt;&#x2F;code&gt; counts.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;isEpochExpired&lt;&#x2F;code&gt; MUST return true if the given &lt;code&gt;epoch&lt;&#x2F;code&gt; is expired, otherwise &lt;code&gt;false&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;additional-potential-useful-function&quot;&gt;Additional Potential Useful Function&lt;&#x2F;h3&gt;
&lt;p&gt;These OPTIONAL functions provide additional functionality that developers MAY choose to implement based on their specific requirements and use cases.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;base-default&quot;&gt;Base (default)&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getRemainingDurationBeforeTokenExpired&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;getRemainingDurationBeforeTokenExpired&lt;&#x2F;code&gt; returns the remaining time or blocks before the given &lt;code&gt;tokenId&lt;&#x2F;code&gt; is expired.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;epoch-extension&quot;&gt;Epoch (extension)&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getEpochBalance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; epoch&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;getEpochBalance&lt;&#x2F;code&gt; returns the amount of tokens stored in a given epoch, even if the epoch has expired.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getEpochInfo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; epoch&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;getEpochInfo&lt;&#x2F;code&gt; returns both the start and end of the specified &lt;code&gt;epoch&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getNearestExpiryOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;getNearestExpiryOf&lt;&#x2F;code&gt; returns the list of &lt;code&gt;tokenId&lt;&#x2F;code&gt; closest to expiration, along with an estimated expiration block number or timestamp based on &lt;code&gt;epochType&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getRemainingDurationBeforeEpochChange&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;getRemainingDurationBeforeEpochChange&lt;&#x2F;code&gt; returns the remaining time or blocks before the epoch change happens, based on the &lt;code&gt;epochType&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;first-do-no-harm&quot;&gt;First, do no harm&lt;&#x2F;h3&gt;
&lt;p&gt;Introducing expirability as an additional layer of functionality ensures it doesn’t interfere with existing use cases or applications. For non-SBT tokens, transferability remains intact, maintaining compatibility with current systems. Expired tokens are simply flagged as unusable during validity checks, treating expiration as an enhancement rather than a fundamental change.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;expiry-types&quot;&gt;Expiry Types&lt;&#x2F;h3&gt;
&lt;p&gt;Defining expiration by either block height (&lt;code&gt;block.number&lt;&#x2F;code&gt;) or block timestamp (&lt;code&gt;block.timestamp&lt;&#x2F;code&gt;) offers flexibility for various use cases. Block-based expiration suits applications that rely on network activity and require precise consistency, while time-based expiration is ideal for networks with variable block intervals.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is fully compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5484&#x2F;&quot;&gt;ERC-5484&lt;&#x2F;a&gt; and other SBTs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;You can find our reference implementation &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7858&#x2F;assets&#x2F;README&#x2F;&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;burn-and-re-mint&quot;&gt;Burn and Re-Mint&lt;&#x2F;h3&gt;
&lt;p&gt;Implementation should ensure that burning token and re-minting it with the same &lt;code&gt;tokenId&lt;&#x2F;code&gt; will not introduce an unauthorized renewal.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;unauthorized-update&quot;&gt;Unauthorized Update&lt;&#x2F;h3&gt;
&lt;p&gt;Implementation should ensure that only authorized can update &lt;code&gt;startTime&lt;&#x2F;code&gt; and &lt;code&gt;endTime&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Blob Transactions Metadata JSON Schema</title>
        <published>2024-01-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Gavin Fu</name><uri>https://github.com/gavfu</uri>
	</author>
	
	<author>
		<name>Leo Wang</name><uri>https://github.com/wanglie1986</uri>
	</author>
	
	<author>
		<name>Bova Chen</name><uri>https://github.com/appoipp</uri>
	</author>
	
	<author>
		<name>Aiden X</name><uri>https://github.com/4ever9</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7588/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc7588-attaching-metadata-to-blobs-carried-by-blob-transactions/17873" />
        

        <id>https://wg-eips.ritovision.com/7588/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:7588"
            label="ERC-7588" />
        

        
        

        
        <summary type="html">Attaching metadata to blobs carried by blob transactions</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7588/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a standard for attaching metadata to blobs carried by blob transactions, as outlined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt;. The metadata is represented as a JSON object adhering to a predefined schema, and its string representation is placed in the data field of the blob transaction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt; defines a new type of transaction known as a “blob transaction.” These transactions contain a list of blobs along with their KZG commitments and proofs. Blob transactions serve as a mechanism for rollups to post their layer 2 transaction data to Ethereum layer 1.&lt;&#x2F;p&gt;
&lt;p&gt;While rollups typically manage their own posted blob transactions, third-party solutions (such as Portal Network and blobscan) may also index all blobs ever posted to Ethereum, and provide querying services for blobs. By attaching metadata to blobs, such as information about the originator, a description, or content type, we can significantly enhance the visibility and auditability of these data structures.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore, decentralized storage applications may utilize blob transactions to post user data to Ethereum, sync and store the blobs off-chain for future retrieval. The inclusion of metadata opens up possibilities for novel applications, including inscriptions and other creative use cases.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;metadata-json-schema&quot;&gt;Metadata JSON Schema&lt;&#x2F;h3&gt;
&lt;p&gt;The metadata is represented as a JSON object adhering to the following JSON Schema:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Blobs Metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;originator&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Identifies the originator of the carried blobs&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Describes the contents of the blobs&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;content_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Describes the MIME type of the blobs. The MIME type should be defined in RFC 2046 (https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc2046)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;extras&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Dynamic extra information related to the blobs&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;blobs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;array&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Metadata of the i&amp;#39;th blob. This is optional and overlays the upper level properties if provided&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;items&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Describes the content of the i&amp;#39;th blob&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;content_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Describes the MIME type of the i&amp;#39;th blob. The MIME type should be defined in RFC 2046 (https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc2046)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;extras&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Dynamic extra information related to the i&amp;#39;th blob&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;For example, suppose Vitalik wants to send a blob transaction carrying two blobs explaining “data availability sampling.” He could include a paragraph of textual explanation in the first blob and an illustration image in the second blob. The corresponding metadata JSON object would look like this:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;originator&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Vitalik Buterin&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;An illustration of data availability sampling&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;blobs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;content_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;text&#x2F;plain&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;This blob contains a description text of the illustration.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;content_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;image&#x2F;png&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;This blob contains the illustration image data in base64 format. It&amp;#39;s a RFC 2397 (https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc2397) data URL.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The complete blob transaction would include this metadata in the data field, along with other relevant fields:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;blobVersionedHashes&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 11155111&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Supposing the blob transaction is posted to Sepolia&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eip4844&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 28236&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x..&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; String representation of the above metadata JSON object&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 18&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;maxFeePerBlobGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1073677089&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;maxFeePerGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1213388073&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;maxPriorityFeePerGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1165808679&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;sidecars&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;blob&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;commitment&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;proof&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;blob&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;commitment&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;proof&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;blob-transaction-envelope&quot;&gt;Blob Transaction Envelope&lt;&#x2F;h3&gt;
&lt;p&gt;The blob transaction&#x27;s calldata (i.e., the data field) should be set to the string representation of the metadata JSON object, encoded in UTF-8.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;In the Ethereum ecosystem, various types of transactions exist, each serving different purposes. The usage of the data field within these transactions varies:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Regular Funds Transfer Transactions&lt;&#x2F;strong&gt;:
In these transactions, the data field is typically not used, and users may optionally include arbitrary data.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Smart Contract Deployment Transactions&lt;&#x2F;strong&gt;:
For deploying smart contracts. The data field holds the contract bytecode and any encoded arguments required by the constructor.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Smart Contract Function Call Transactions&lt;&#x2F;strong&gt;:
When invoking smart contract functions, the data field contains the function call data, including the function signature and any necessary parameters.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Blob transactions are specifically designed for posting blobs, and normally, the data field remains unused. This EIP proposes a novel approach: utilizing the data field to attach metadata to the carried blobs. By doing so, we can enhance the auditability and usability of blob transactions.&lt;&#x2F;p&gt;
&lt;p&gt;However, it’s essential to note that there are scenarios where blob transactions may also need to call smart contract functions. Consider a decentralized storage application that employs a smart contract to track blob versioned hashes and metadata like MIME types. In such cases, users could submit a blob transaction containing blobs while simultaneously using the data field to invoke smart contract functions to store versioned hashes and MIME types of those blobs. It’s important to recognize that this EIP does not cover such specific use cases.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h1&gt;
&lt;p&gt;This EIP is backward compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt;, as it does not modify the structure or functionality of blob transactions, but only adds an optional metadata field to them.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP does not introduce any new security risks or vulnerabilities, as the metadata is only an informational field that does not affect the execution or validity of blob transactions. However, users and applications should be aware of the following potential issues:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The metadata is not verified or enforced by the consensus layer, and therefore it may not be accurate or trustworthy. Users and applications should not rely on the metadata for critical or sensitive operations, and should always verify the contents and sources of the blobs themselves.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The metadata may contain malicious or harmful data, such as spam, phishing, malware, etc. Users and applications should not blindly trust or execute the metadata, and should always scan and sanitize the metadata before using it.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The metadata may increase the gas cost of blob transactions, as more data is included in the data field. Users and applications should balance the benefits and costs of using the metadata, and should optimize the size and format of the metadata to reduce the gas cost.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Interest Rate Swaps</title>
        <published>2023-12-31T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Samuel Gwlanold Edoumou</name><uri>https://github.com/Edoumou</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7586/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/interest-rate-swaps/17777" />
        

        <id>https://wg-eips.ritovision.com/7586/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        

        
        <category
            term="tag:eip:7586"
            label="ERC-7586" />
        

        
        

        
        <summary type="html">Interest rate swaps derivative contracts</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7586/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal introduces a standardized framework for on-chain interest rate swaps. The proposed standard aims to facilitate the seamless exchange of fixed and floating interest rate cash flows between parties, providing a foundation for decentralized finance (DeFi) applications.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Interest Rate Swapping (IRS) denotes a derivative contract wherein two parties mutually consent to exchange a series of forthcoming interest payments based on a specified notional amount. This financial instrument serves as a strategic tool for hedging against interest rate fluctuations. The mechanism entails the utilization of a benchmark index to facilitate the exchange between a variable interest rate and a fixed rate. Despite its widespread use, there is currently an absence of a standardized framework that enables the representation of IRS contracts on blockchain platforms.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal addresses this gap by establishing a consistent and transparent methodology for representing IRS contracts within the blockchain environment. By doing so, it would enhance the interoperability, security, and efficiency of interest rate swap transactions on distributed ledger technology.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;example-flow&quot;&gt;Example Flow&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7586&#x2F;.&#x2F;assets&#x2F;irs.jpeg&quot; alt=&quot;alt text&quot; title=&quot;IRS diagram&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Every contract compliant with this ERC MUST implement the following interface. The contract MUST inherit from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; to tokenize the swap cash flows.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-7586 Interest Rate Swaps&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7586&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is ERC20, ERC165 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; events&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST be emitted when interest rates are swapped&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the interest difference to be transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the recipient account to send the interest difference to. MUST be either the `payer` or the `receiver`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Swap&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST be emitted when the swap contract is terminated&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _payer&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the swap payer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _receiver&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the swap receiver&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TerminateSwap&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _payer&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _receiver&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; functions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *  &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the IRS `payer` account address. The party who agreed to pay fixed interest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fixedRatePayer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *  &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the IRS `receiver` account address. The party who agreed to pay floating interest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; floatingRatePayer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the number of decimals the swap rate and spread use - e.g. `4` means to divide the rates by `10000`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *         To express the interest rates in basis points unit, the decimal MUST be equal to `2`. This means rates MUST be divided by `100`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *         1 basis point = 0.01% = 0.0001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *         ex: if interest rate = 2.5%, then swapRate() =&amp;gt; 250 `basis points`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ratesDecimals&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *  &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the fixed interest rate. All rates MUST be multiplied by 10^(ratesDecimals)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; swapRate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *  &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the floating rate spread, i.e. the fixed part of the floating interest rate. All rates MUST be multiplied by 10^(ratesDecimals)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *          floatingRate = benchmark + spread&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; spread&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the day count basis&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *         For example, 0 can denote actual&#x2F;actual, 1 can denote actual&#x2F;360, and so on&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; dayCountBasis&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *  &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the contract address of the currency for which the notional amount is denominated (Example: USDC contract address).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *          Returns the zero address if the notional is expressed in FIAT currency like USD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; notionalCurrency&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns an array of acceptable contract address of the assets to be transferred when swapping IRS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *         The two counterparties may wish to get the payment in different currencies.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *         Ex: if the payer wants to receive the payment in USDC and the receiver in DAI, then the function should return [USDC, DAI] or [DAI, USDC]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; paymentAssets&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *  &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the notional amount in unit of asset to be transferred when swapping IRS. This amount serves as the basis for calculating the interest payments, and may not be exchanged&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *          Example: If the two parties aggreed to swap interest rates in USDC, then the notional amount may be equal to 1,000,000 USDC &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; notionalAmount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *  &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the number of times payments must be realized in 1 year&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; paymentFrequency&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *  &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns an array of specific dates on which the fix interest payments are exchanged. Each date MUST be a Unix timestamp like the one returned by block.timestamp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *          The length of the array returned by this function MUST equal the total number of swaps that should be realized&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *  OPTIONAL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fixPaymentDates&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *  &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns an array of specific dates on which the floating interest payments are exchanged. Each date MUST be a Unix timestamp like the one returned by block.timestamp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *          The length of the array returned by this function MUST equal the total number of swaps that should be realized&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *  OPTIONAL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; floatingPaymentDates&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *  &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the starting date of the swap contract. This is a Unix Timestamp like the one returned by block.timestamp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; startingDate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *  &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the maturity date of the swap contract. This is a Unix Timestamp like the one returned by block.timestamp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; maturityDate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *  &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the benchmark (the reference rate). All rates MUST be multiplied by 10^(ratesDecimals)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *          Example: value of one the following rates: CF BIRC, EURIBOR, HIBOR, SHIBOR, SOFR, SONIA, TONAR, etc.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *                   Or set manually&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; benchmark&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *  &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the oracle contract address for acceptable reference rates (benchmark), or the zero address when the two parties agreed to set the benchmark manually.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *          This contract SHOULD be used to fetch real time benchmark rate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *          Example: Contract address for `CF BIRC`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *  OPTIONAL. The two parties MAY agree to set the benchmark manually&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; oracleContractsForBenchmark&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *  &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Makes swap calculation and transfers the payment to counterparties&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; swap&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *  &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Terminates the swap contract before its maturity date. MUST be called by either the `payer`or the `receiver`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; terminateSwap&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;tokenization-of-swap-cash-flows&quot;&gt;Tokenization of Swap Cash Flows&lt;&#x2F;h3&gt;
&lt;p&gt;The interest payments associated with the IRS MUST be tokenized by issuing digital &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens to the respective parties according to the terms of the swap. Each token SHOULD represent a specific interest payment. Every time a swap happens (the &lt;code&gt;swap&lt;&#x2F;code&gt; function is called), one token MUST be burned from each party.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This standard allows parties involved in the IRS contract to define essential parameters such as notional amount, interest rates, payment frequency, and payment dates. This flexibility accommodates a diverse range of financial agreements, catering to the unique needs of different participants.&lt;&#x2F;p&gt;
&lt;p&gt;To accommodate a wide array of use cases, the standard introduces optional features such as payment dates and manual benchmark setting. This allows parties to tailor the contract to specific requirements, while maintaining a core set of functions for essential functionality.&lt;&#x2F;p&gt;
&lt;p&gt;To ensure real-time and accurate benchmark rates, the standard integrates with oracles. Parties have the option to use oracles for fetching benchmark rates, enhancing the reliability and accuracy of interest rate calculations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is backward compatible with ERC-20.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The complete reference implementation can be found &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7586&#x2F;.&#x2F;assets&#x2F;ERC7586.sol&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This reference implementation serves as a foundation for the implementation of more advanced types of swaps.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Security considerations of various types must be thoroughly evaluated&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Interest Rate Risk: This pertains to the potential impact of fluctuations in interest rates.&lt;&#x2F;li&gt;
&lt;li&gt;Credit Risk: There exists the possibility that one or both parties may default on their respective responsibilities.&lt;&#x2F;li&gt;
&lt;li&gt;ERC-20 Risks: All security aspects outlined in the ERC-20 standard must be taken into account.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Both parties must acknowledge their awareness of these security risks before proceeding with the implementation of the standard.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Semi-Fungible Token Roles</title>
        <published>2023-12-28T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Ernani São Thiago</name><uri>https://github.com/ernanirst</uri>
	</author>
	
	<author>
		<name>Daniel Lima</name><uri>https://github.com/karacurt</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7589/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7589-semi-fungible-token-roles/17967" />
        

        <id>https://wg-eips.ritovision.com/7589/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7589"
            label="ERC-7589" />
        

        
        

        
        <summary type="html">Role Management for Semi-Fungible Tokens (SFTs). Enables accounts to share the utility of SFTs via expirable role assignments.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7589/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard introduces role management for SFTs (Semi-Fungible Tokens). Each role assignment is granted to a single
user (grantee) and expires automatically. Roles are defined as &lt;code&gt;bytes32&lt;&#x2F;code&gt; and feature a custom &lt;code&gt;_data&lt;&#x2F;code&gt; field of
arbitrary size to allow customization.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; has significantly contributed to the tokenization capabilities of Ethereum by enabling
developers to create fungible and non-fungible tokens with a single contract. While &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; excels at
tracking ownership, it focuses solely on token balances, overlooking the nuanced aspects of how these tokens can be
utilized.&lt;&#x2F;p&gt;
&lt;p&gt;An essential aspect of token utility is access control, which determines who has permission to spend or use these
tokens. In some cases, the owner has complete control over its balance. Nevertheless, in many others, the utility can be
delegated (or granted) to other users, allowing for more complex use cases to be implemented.&lt;&#x2F;p&gt;
&lt;p&gt;One example is in gaming, in-game assets can be issued with a single &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; contract and rented out
via a secure role management interface.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;,
&quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;Compliant contracts MUST implement the following interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-7589 Semi-Fungible Token Roles&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-7589&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0xc4c8a71d.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7589&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is IERC165 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Events *&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when tokens are committed (deposited or frozen).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _grantor&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The owner of the SFTs.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _commitmentId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier of the commitment created.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token identifier.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenAmount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token amount.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TokensCommitted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _grantor&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _commitmentId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokenAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a role is granted.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _commitmentId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The commitment identifier.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _role&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The role identifier.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _grantee&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The recipient the role.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _expirationDate&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The expiration date of the role.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _revocable&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Whether the role is revocable or not.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Any additional data about the role.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RoleGranted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _commitmentId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _role&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _grantee&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _expirationDate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _revocable&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a role is revoked.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _commitmentId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The commitment identifier.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _role&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The role identifier.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _grantee&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The recipient of the role revocation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RoleRevoked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _commitmentId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _role&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _grantee&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a user releases tokens from a commitment.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _commitmentId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The commitment identifier.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TokensReleased&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _commitmentId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a user is approved to manage roles on behalf of another user.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The user approved to grant and revoke roles.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _isApproved&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The approval status.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RoleApprovalForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _isApproved&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; External Functions *&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Commits tokens (deposits on a contract or freezes balance).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _grantor&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The owner of the SFTs.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token identifier.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenAmount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token amount.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; commitmentId_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The unique identifier of the commitment created.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; commitTokens&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _grantor&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; commitmentId_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Grants a role to `_grantee`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _commitmentId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier of the commitment.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _role&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The role identifier.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _grantee&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The recipient the role.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _expirationDate&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The expiration date of the role.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _revocable&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Whether the role is revocable or not.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Any additional data about the role.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; grantRole&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _commitmentId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _role&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _grantee&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _expirationDate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _revocable&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Revokes a role.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _commitmentId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The commitment identifier.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _role&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The role identifier.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _grantee&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The recipient of the role revocation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revokeRole&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _commitmentId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _role&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _grantee&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Releases tokens back to grantor.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _commitmentId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The commitment identifier.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; releaseTokens&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _commitmentId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Approves operator to grant and revoke roles on behalf of another user.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The user approved to grant and revoke roles.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The approval status.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setRoleApprovalForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; View Functions *&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the owner of the commitment (grantor).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _commitmentId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The commitment identifier.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; grantor_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The commitment owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; grantorOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _commitmentId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantor_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the address of the token committed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _commitmentId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The commitment identifier.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenAddress_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenAddressOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _commitmentId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenAddress_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the identifier of the token committed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _commitmentId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The commitment identifier.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token identifier.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenIdOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _commitmentId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the amount of tokens committed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _commitmentId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The commitment identifier.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenAmount_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token amount.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenAmountOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _commitmentId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenAmount_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the custom data of a role assignment.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _commitmentId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The commitment identifier.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _role&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The role identifier.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _grantee&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The recipient the role.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The custom data.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; roleData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _commitmentId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _role&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _grantee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the expiration date of a role assignment.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _commitmentId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The commitment identifier.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _role&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The role identifier.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _grantee&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The recipient the role.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; expirationDate_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The expiration date.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; roleExpirationDate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _commitmentId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _role&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _grantee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expirationDate_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the expiration date of a role assignment.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _commitmentId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The commitment identifier.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _role&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The role identifier.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _grantee&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The recipient the role.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; revocable_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Whether the role is revocable or not.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isRoleRevocable&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _commitmentId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _role&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _grantee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; revocable_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Checks if the grantor approved the operator for all SFTs.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _grantor&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The user that approved the operator.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The user that can grant and revoke roles.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; isApproved_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Whether the operator is approved or not.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isRoleApprovedForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _grantor&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; isApproved_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;single-transaction-extension&quot;&gt;Single Transaction Extension&lt;&#x2F;h3&gt;
&lt;p&gt;Granting roles is a two-step process that requires two transactions. The first is to commit tokens, and the second is to
grant the role. This extension allows users to commit tokens and grant a role in one transaction, which is desirable for
some use cases.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-7589 Semi-Fungible Token Roles, optional single transaction extension&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-7589&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0x5c3d7d74.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ICommitTokensAndGrantRoleExtension&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is IERC7589 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Commits tokens and grant role in a single transaction.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _grantor&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The owner of the SFTs.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token identifier.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenAmount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token amount.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _role&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The role identifier.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _grantee&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The recipient the role.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _expirationDate&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The expiration date of the role.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _revocable&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Whether the role is revocable or not.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Any additional data about the role.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; commitmentId_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier of the commitment created.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; commitTokensAndGrantRole&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _grantor&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenAmount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _role&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _grantee&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _expirationDate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _revocable&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; commitmentId_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;role-balance-extension&quot;&gt;Role Balance Extension&lt;&#x2F;h3&gt;
&lt;p&gt;The core interface allows for querying a token commitment&#x27;s balance but not for a specific user&#x27;s balance. To determine
the total amount of tokens granted to a user, the implementation needs to sum up all the roles granted to that user
while filtering out any expired roles.&lt;&#x2F;p&gt;
&lt;p&gt;This function was included in an optional extension because it&#x27;s not always necessary and will likely make the
implementation much more complex (increasing smart contract risk).&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-7589 Semi-Fungible Token Roles, optional role balance extension&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-7589&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0x2f35b73f.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IRoleBalanceOfExtension&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is IERC7589 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the sum of all tokenAmounts granted to the grantee for the given role.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _role&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The role identifier.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token identifier.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _grantee&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The user for which the balance is returned.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; balance_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The balance of the grantee for the given role.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; roleBalanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _role&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _grantee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; balance_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;metadata-extension&quot;&gt;Metadata Extension&lt;&#x2F;h3&gt;
&lt;p&gt;The Roles Metadata extension extends the traditional JSON-based metadata schema of SFTs. Therefore, DApps supporting
this feature MUST also implement the metadata extension of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt;. This JSON extension is
&lt;strong&gt;optional&lt;&#x2F;strong&gt; and allows developers to provide additional information on roles.&lt;&#x2F;p&gt;
&lt;p&gt;Updated JSON Schema:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Existing ERC-1155 Metadata *&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Token Metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Identifies the asset to which this token represents&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;decimals&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;integer&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The number of decimal places that the token amount should display - e.g. 18, means to divide the token amount by 1000000000000000000 to get its user representation.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Describes the asset to which this token represents&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;image&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A URI pointing to a resource with mime type image&#x2F;* representing the asset to which this token represents. Consider making any images at a width between 320 and 1080 pixels and aspect ratio between 1.91:1 and 4:5 inclusive.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Arbitrary properties. Values may be strings, numbers, object or arrays.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Additional fields for ERC-7589 *&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;roles&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Identifies the role&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Human-readable name of the role&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Describes the role&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Human-readable name of the argument&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Solidity type, e.g., uint256 or address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The following code snipped is an example of the additional fields described above:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Existing ERC-1155 Metadata *&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Asset Name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Lorem ipsum...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;image&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;s3.amazonaws.com&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;your-bucket&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;images&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{id}.png&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;simple_property&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;example value&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;rich_property&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;123&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;display_value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;123 Example Value&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;emphasis&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;css&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;color&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;#ffffff&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;font-weight&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bold&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;text-decoration&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;underline&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;array_property&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;emphasis&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Additional fields for ERC-7589 *&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;roles&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; keccak256(&amp;quot;Player(uint256)&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x70d2dab8c6ff873dc0b941220825d9271fdad6fdb936f6567ffde77d05491cef&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Player&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The user allowed to use this item in-game.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ProfitShare&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The properties of the &lt;code&gt;roles&lt;&#x2F;code&gt; array are SUGGESTED, and developers should add any other relevant information for their
use case (e.g., an image representing the role).&lt;&#x2F;p&gt;
&lt;p&gt;It&#x27;s also important to highlight the significance of the &lt;code&gt;inputs&lt;&#x2F;code&gt; property. This field describes the parameters that
should be encoded and passed to the &lt;code&gt;grantRole&lt;&#x2F;code&gt; function, and can include the properties &lt;code&gt;type&lt;&#x2F;code&gt; and &lt;code&gt;components&lt;&#x2F;code&gt; to
represent the format of the data. It&#x27;s RECOMMENDED to use the properties &lt;code&gt;type&lt;&#x2F;code&gt; and &lt;code&gt;components&lt;&#x2F;code&gt; as defined on the
Solidity ABI Specification.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;caveats&quot;&gt;Caveats&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Compliant contracts MUST implement the &lt;code&gt;IERC7589&lt;&#x2F;code&gt; interface.&lt;&#x2F;li&gt;
&lt;li&gt;Every role is represented by a &lt;code&gt;bytes32&lt;&#x2F;code&gt; identifier. It&#x27;s RECOMMENDED to use the keccak256 hash of the role name and
its arguments (if any) as the identifier. E.g., &lt;code&gt;keccak256(&quot;Player(uint256)&quot;)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;commitTokens&lt;&#x2F;code&gt; function MUST revert if the &lt;code&gt;_tokenAmount&lt;&#x2F;code&gt; is zero or the &lt;code&gt;msg.sender&lt;&#x2F;code&gt; was not approved by the
&lt;code&gt;_grantor&lt;&#x2F;code&gt;. It MAY be implemented as public or external.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;grantRole&lt;&#x2F;code&gt; function MUST revert if the &lt;code&gt;_expirationDate&lt;&#x2F;code&gt; is in the past or if the &lt;code&gt;msg.sender&lt;&#x2F;code&gt; is not approved to
grant roles on behalf of the grantor. It MAY be implemented as public or external, and it is RECOMMENDED using
&lt;code&gt;type(uint64).max&lt;&#x2F;code&gt; for a permanent roles.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;revokeRole&lt;&#x2F;code&gt; function SHOULD always allow the grantee to revoke roles and MAY be implemented as public or
external, and MUST revert if:
&lt;ul&gt;
&lt;li&gt;The role assignment is not found (no role was granted).&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;msg.sender&lt;&#x2F;code&gt; was not approved by the grantor or the grantee.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;msg.sender&lt;&#x2F;code&gt; is the grantor or was approved by the grantor, but the role is not revocable or expired.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;releaseTokens&lt;&#x2F;code&gt; function MAY be implemented as public or external and MUST revert if:
&lt;ul&gt;
&lt;li&gt;The commitment is not found (no tokens were committed).&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;msg.sender&lt;&#x2F;code&gt; is not and was not approved by the grantor.&lt;&#x2F;li&gt;
&lt;li&gt;The commitment has at least one non-revocable role that didn&#x27;t expire.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;setRoleApprovalForAll&lt;&#x2F;code&gt; function MAY be implemented as public or external.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;grantorOf&lt;&#x2F;code&gt; function MAY be implemented as pure or view and MUST return the owner of the committed tokens.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;tokenAddressOf&lt;&#x2F;code&gt; function MAY be implemented as pure or view and MUST return the address of the committed tokens.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;tokenIdOf&lt;&#x2F;code&gt; function MAY be implemented as pure or view and MUST return the identifier of the committed tokens.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;tokenAmountOf&lt;&#x2F;code&gt; function MAY be implemented as pure or view and MUST return the token amount committed.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;roleData&lt;&#x2F;code&gt; function MAY be implemented as pure or view and MUST return the custom data of the role assignment.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;roleExpirationDate&lt;&#x2F;code&gt; function MAY be implemented as pure or view and MUST return the expiration date of the role
assignment.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;isRoleRevocable&lt;&#x2F;code&gt; function MAY be implemented as pure or view and MUST return whether the grantor can end the role
assignment before its expiration date.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;isRoleApprovedForAll&lt;&#x2F;code&gt; function MAY be implemented as pure or view and MUST return whether the &lt;code&gt;_operator&lt;&#x2F;code&gt; is
allowed to grant and revoke roles on behalf of the &lt;code&gt;_grantor&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;blockquote&gt;
&lt;p&gt;Please note that &quot;approval&quot; refers to allowing users to commit tokens and grant&#x2F;revoke roles on one&#x27;s behalf. An
approved user either received the role approval or is the target user. Role approvals are not to be confused with
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; approvals. More information can be found in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7589&#x2F;#role-approvals&quot;&gt;Role Approvals&lt;&#x2F;a&gt; section.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The concept of &quot;token commitments&quot; as an abstraction serves as a powerful tool for users looking to delegate the control
of their SFTs. A token commitment represents either a frozen balance or tokens deposited into a contract, offering a
standardized and secure way for SFT owners to delegate the use of their assets. Through &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7589&#x2F;&quot;&gt;ERC-7589&lt;&#x2F;a&gt;, users
gain a versatile mechanism to abstract the complexities of secure delegation, enhancing the utility and interoperability
of semi-fungible tokens.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7589&#x2F;&quot;&gt;ERC-7589&lt;&#x2F;a&gt; IS NOT an extension of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt;. The main reason behind this decision is to
keep the standard agnostic of any implementation. This approach enables the standard to be implemented externally or on
the same contract as the SFT and allows dApps to use roles with immutable SFTs.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;role-approvals&quot;&gt;Role Approvals&lt;&#x2F;h3&gt;
&lt;p&gt;Like &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7589&#x2F;&quot;&gt;ERC-7589&lt;&#x2F;a&gt; allows users to approve operators to grant and revoke roles on
their behalf. This feature is crucial for interoperability, as it enables third-party applications to manage user roles
without custody-level approvals. Role approvals are part of the core interface, and compliant contracts must implement
the &lt;code&gt;setRoleApprovalForAll&lt;&#x2F;code&gt; and &lt;code&gt;isRoleApprovedForAll&lt;&#x2F;code&gt; functions.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;automatic-expiration&quot;&gt;Automatic Expiration&lt;&#x2F;h3&gt;
&lt;p&gt;Automatic expiration is implemented to save users gas. To end a role assignment, instead of requiring users always to
call &lt;code&gt;revokeRole&lt;&#x2F;code&gt;, applications should call the &lt;code&gt;roleExpirationDate&lt;&#x2F;code&gt; and compare it to the current timestamp to check if
the role is still valid.&lt;&#x2F;p&gt;
&lt;p&gt;In the context of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7589&#x2F;&quot;&gt;ERC-7589&lt;&#x2F;a&gt;, dates are represented as &lt;code&gt;uint64&lt;&#x2F;code&gt;. The maximum UNIX timestamp represented
by a &lt;code&gt;uint64&lt;&#x2F;code&gt; is about the year 584 billion, which should be enough to be considered &quot;permanent&quot;. For this reason, using
&lt;code&gt;type(uint64).max&lt;&#x2F;code&gt; in an assignment represents that it never expires.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;revocable-roles&quot;&gt;Revocable Roles&lt;&#x2F;h3&gt;
&lt;p&gt;In certain scenarios, the grantor might need to revoke a role before its expiration. While in others, the grantee
requires assurance that the role can&#x27;t be prematurely revoked (e.g. when the grantee pays tokens to utilize them). The
&lt;code&gt;_revocable&lt;&#x2F;code&gt; parameter was included in the &lt;code&gt;grantRole&lt;&#x2F;code&gt; function for this exact reason, and it specifies whether the
grantor can revoke the role prior to the expiration date. Regardless of the &lt;code&gt;_revocable&lt;&#x2F;code&gt; value, the grantee will always
be able to revoke roles, allowing recipients to eliminate undesirable assignments.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;custom-data&quot;&gt;Custom Data&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;grantRole&lt;&#x2F;code&gt; function&#x27;s &lt;code&gt;_data&lt;&#x2F;code&gt; parameter is critical for the standardization of this EIP. SFTs have different use
cases, and it&#x27;s impractical to attempt to cover all of them on a solidity-level interface. Therefore, a generic
parameter of type &lt;code&gt;bytes&lt;&#x2F;code&gt; was incorporated, allowing users to pass any custom information when granting a role.&lt;&#x2F;p&gt;
&lt;p&gt;For example, it&#x27;s common for web3 games to introduce a profit-share when delegating NFTs to players, which is
represented by a &lt;code&gt;uint256&lt;&#x2F;code&gt;. Using &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7589&#x2F;&quot;&gt;ERC-7589&lt;&#x2F;a&gt;, one could simply encode the &lt;code&gt;uint256&lt;&#x2F;code&gt; as bytes and pass it
to the&lt;code&gt;grantRole&lt;&#x2F;code&gt; function. Data validation can happen on-chain or off-chain, and other contracts can query this
information using the &lt;code&gt;roleData&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Many SFTs are deployed as immutable contracts, which imposes the following challenge: How can one enable role management
for SFTs that can&#x27;t be modified? This proposal solves this problem by requiring the &lt;code&gt;tokenAddress&lt;&#x2F;code&gt; parameter
when committing tokens. This requirement ensures that dApps can either implement &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7589&#x2F;&quot;&gt;ERC-7589&lt;&#x2F;a&gt; inside the
SFT contract or use a standalone external contract as the authoritative source for the roles of immutable SFTs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7589&#x2F;.&#x2F;assets&#x2F;ERC7589.sol&quot;&gt;&lt;code&gt;ERC7589.sol&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Developers integrating with Semi-Fungible Token Roles should consider the points below on their implementations:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Ensure proper access control is in place to prevent unauthorized role assignments or revocations. This is especially
important in &lt;code&gt;commitTokens&lt;&#x2F;code&gt; and &lt;code&gt;releaseTokens&lt;&#x2F;code&gt;, as they might freeze or transfer balances.&lt;&#x2F;li&gt;
&lt;li&gt;Consider potential attack vectors such as reentrancy and ensure appropriate safeguards are in place.&lt;&#x2F;li&gt;
&lt;li&gt;Always check the expiration date before allowing users to utilize a role assignment.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>MixHash and Public Data Storage Proofs</title>
        <published>2023-12-27T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Liu Zhicong</name><uri>https://github.com/waterflier</uri>
	</author>
	
	<author>
		<name>William Entriken</name><uri>https://github.com/fulldecent</uri>
	</author>
	
	<author>
		<name>Wei Qiushi</name><uri>https://github.com/weiqiushi</uri>
	</author>
	
	<author>
		<name>Si Changjun</name><uri>https://github.com/photosssa</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7585/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7585-mixhash-and-public-data-storage-proofs/17707" />
        

        <id>https://wg-eips.ritovision.com/7585/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7585"
            label="ERC-7585" />
        

        
        

        
        <summary type="html">A design for minimum value selection Storage Proofs on Merkle trees</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7585/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal introduces a design for &quot;minimum value selection&quot; storage proofs on Merkle trees. The design consists of two main components:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;A hashing algorithm termed MixHash, aimed to replace the commonly used Keccak256 and SHA256 algorithms.&lt;&#x2F;li&gt;
&lt;li&gt;Public data storage proofs. This enables anyone to present a proof to a public network, verifying their possession of a copy of specific public data marked by MixHash.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Additionally, the proposal discusses the practical implementation of this design in various scenarios and suggests some improvements to the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; standards.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; standards are widely used in the NFT  fields. However, the current standards do not provide a mechanism for verifying the existence of public data. This is a major obstacle to the development of many applications, such as decentralized data markets, decentralized data storage, and decentralized data oracles.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;mixhash&quot;&gt;MixHash&lt;&#x2F;h3&gt;
&lt;p&gt;MixHash is a Merkle tree root hash value that incorporates data length information. Its structure is as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     +-----------256 bits MixHash-----------+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;High |-2-|----62----|----------192----------| Low&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;2   bits: Hash algorithm selection, where 0b00 represents SHA256, and 0b10 represents Keccak256. (0b01, 0b11 are reserved)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;62  bits: File size. Hence, MixHash can support file sizes up to 2^62-1.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;192 bits: The lower 192 bits of the Merkel root node value constructed by the designated hash algorithm.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Given a file, we can construct a MixHash through the following defined steps:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;File MUST Split into 1KB chunks. MUST Pad zeros to the end of the last chunk if needed.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Calculate the hash for each chunk and the low 128bits is the Merkle Tree leaf value.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Construct a Merkle tree , root node hash algorithm is 256bits, other node use low 128bits of the 256bits hash result.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Return the combination of hash type, the file size, and the low 192 bits of the Merkle tree root node hash.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;MixHash retains a length of 256 bits, so replacing the widely used Keccak256 and SHA256 with MixHash incurs no additional cost. Although including the file length in the upper 62 bits compromises security to some extent, the 192-bit hash length is already sufficient for defending against hash collisions.&lt;&#x2F;p&gt;
&lt;p&gt;The following is the pseudo code for generating Mixhash:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; generateMixHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;blockHeight&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;hashType&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;file&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    chunk_hash_array&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; chunk&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; file&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;chunk&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1024&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            chunk&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; chunk&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\x00&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1024&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;chunk&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        chunk_hash_array&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;getChunkHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;chunk&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;hashType&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    merkle_tree_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; getMerkleTreeRoot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;chunk_hash_array&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;hash_type&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; mix_hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;hash_type&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;file&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; merkle_tree_root&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;public-data-storage-proofs&quot;&gt;Public Data Storage Proofs&lt;&#x2F;h3&gt;
&lt;p&gt;When MixHash is used to identify a piece of public data, anyone can construct a storage proof to demonstrate possession of a copy of that data. Here is a typical process for using a public data storage proof:&lt;&#x2F;p&gt;
&lt;ol start=&quot;0&quot;&gt;
&lt;li&gt;Users eligible to submit storage proofs for rewards are referred to as Suppliers.&lt;&#x2F;li&gt;
&lt;li&gt;A Supplier prepares a storage proof for data D (with MixHash &lt;code&gt;mix_hash_d&lt;&#x2F;code&gt;) based on a block at height &lt;code&gt;h&lt;&#x2F;code&gt;. A 256-bit &lt;code&gt;nonce&lt;&#x2F;code&gt; value for the proof is derived from this block (usually directly using the block&#x27;s hash).&lt;&#x2F;li&gt;
&lt;li&gt;To generate a correct storage proof, the Supplier needs to traverse every 1KB chunk of D to find the optimal leaf node &lt;code&gt;m&lt;&#x2F;code&gt;. This is done by attempting to append the nonce value to the end of each chunk to minimize the new Merkle tree root hash. After determining &lt;code&gt;m&lt;&#x2F;code&gt;, the path &lt;code&gt;m_path&lt;&#x2F;code&gt; and leaf node value &lt;code&gt;m_leaf_data&lt;&#x2F;code&gt; of &lt;code&gt;m&lt;&#x2F;code&gt; are extracted.&lt;&#x2F;li&gt;
&lt;li&gt;The Supplier constructs the storage proof for data D at block time &lt;code&gt;h&lt;&#x2F;code&gt; using &lt;code&gt;{mix_hash_d, h, m, m_path, m_leaf_data}&lt;&#x2F;code&gt; and submits it to the public network.&lt;&#x2F;li&gt;
&lt;li&gt;The public network can validate the correctness of &lt;code&gt;m&lt;&#x2F;code&gt;, &lt;code&gt;m_path&lt;&#x2F;code&gt;, and &lt;code&gt;m_leaf_data&lt;&#x2F;code&gt; based on &lt;code&gt;mix_hash_d&lt;&#x2F;code&gt;: verifying that &lt;code&gt;m&lt;&#x2F;code&gt; is indeed a chunk of D. The timeliness of the proof can be verified through &lt;code&gt;h&lt;&#x2F;code&gt;. After passing both correctness and timeliness checks, the public network calculates &lt;code&gt;proof_result_m&lt;&#x2F;code&gt; based on the nonce value and existing proof information, and saves it.&lt;&#x2F;li&gt;
&lt;li&gt;The public network does not have enough information to verify the optimality of the proof, but other Suppliers with the full data set can submit a better &lt;code&gt;{mix_hash_d, h, better_m, better_m_path, better_m_leaf_data}&lt;&#x2F;code&gt; to challenge the published storage proof.&lt;&#x2F;li&gt;
&lt;li&gt;The public network can determine the success of the challenge by comparing &lt;code&gt;proof_result_m&lt;&#x2F;code&gt; and &lt;code&gt;proof_result_better_m&lt;&#x2F;code&gt;. A successful challenge indicates the old storage proof was forged. If no one challenges the published storage proof within a certain timeframe, it can be considered correct from a game-theoretic perspective.&lt;&#x2F;li&gt;
&lt;li&gt;To support healthy competition, the public network should design an appropriate economic model, rewarding users who provide correct storage proofs and penalizing those who submit false ones.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;With an understanding of the above process, let us describe the generation and verification of storage proofs more precisely using &lt;code&gt;Pseudocode&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; generate proof off chain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; generateProof&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;mixHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; blockHeight&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;file&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; getNonce&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;blockHeight&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    hash_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; getHashType&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;mixHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    chunk_hash_array&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; buildChunkHashArray&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;file&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;hash_type&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    min_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    min_merkle_tree_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_UINT256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    min_chunk&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    m_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; chunk&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; file&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      new_chunk&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; chunk&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      chunk_hash_array&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;m_index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; getChunkHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;new_chunk&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;hash_type&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      merkle_tree_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; getMerkleTreeRoot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;chunk_hash_array&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;hash_type&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      chunk_hash_array&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;m_index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; getChunkHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;chunk&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;hash_type&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;merkle_tree_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; min_merkle_tree_root&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        min_merkle_tree_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; merkle_tree_root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        min_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; m_index&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        min_chunk&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; chunk&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      m_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; m_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; verify on chain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verifyDataProof&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;mixHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; blockHeight&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; m_index&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; m_path&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; m_leaf_data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;current_block_height &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt; blockHeight &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; MAX_BLOCK_DISTANCE&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;       revert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;proof expired&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    hash_type &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getHashType&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;mixHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    merkle_tree_root &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getMerkleTreeRootFromPath&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;m_path&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;m_leaf_data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;hash_type&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;low192&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;merkle_tree_root&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; low192&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;mixHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;       revert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;invalid proof&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    nonce &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getNonce&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;blockHeight&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    proof_result &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getMerkleTreeRootFromPath&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;m_path&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;m_leaf_data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;nonce&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;hash_type&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    last_proof_result&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;last_prover &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getProofResult&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;mixHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; blockHeight&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;proof_result &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; last_proof_result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ProofPunish&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;last_prover&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      updateProofResult&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;mixHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; blockHeight&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; proof_result&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;To minimize the size of the storage proof as much as possible, we have optimized the implementation of getMerkleTreeRoot: besides the RootHash, the hash values of other nodes are truncated to the lower 128 bits. This approach effectively compresses the hash value of a complete Merkle tree to half its size. The full implementation details can be found in the subsequent Reference Implementation section.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;defending-sourcing-attack&quot;&gt;Defending Sourcing Attack&lt;&#x2F;h3&gt;
&lt;p&gt;As can be seen from the process described above, the core of constructing public data storage proofs is based on a public, non-repeating nonce value generated at a specific moment. It requires traversing the entire content of the file within a designated time to construct a correct proof. Without restrictions, this process is vulnerable to external data source attacks: Suppliers do not store data locally but obtain it through network requests when constructing storage proofs. How does our design prevent such attacks?&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Time-Limited Response: Suppliers must submit storage proofs within a specified time. On a typical public network like Ethereum, the block time is about 15 seconds. A typical maximum block interval could be 2 (MAX_BLOCK_DISTANCE = 2), meaning Suppliers must complete the construction and submission of the storage proof within 30 seconds. This duration is insufficient for most data sources to complete transmission, thus Suppliers must store data locally to have a chance to construct storage proofs within the allotted time.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Economic Game Theory: The economic model based on public data storage proofs usually rewards the first Supplier to submit a correct storage proof. This means that, from a game-theoretic standpoint, the inherent delay in using external data sources to construct storage proofs reduces the likelihood of successful submission. Economically, it&#x27;s less profitable than the expected gains from storing data locally. The economic model incentivizes Suppliers to store data locally.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;success-rate-of-defending-sourcing-attack&quot;&gt;Success Rate of Defending Sourcing Attack&lt;&#x2F;h3&gt;
&lt;p&gt;Using a strategy combining block interval limitations and priority for first-time submissions is often effective in defending against external data source attacks. The effectiveness of this approach primarily relies on the difference in speed between reading files from local storage and retrieving files from the network. We can define the success rate `R`` of defending against external data source attacks using the following formula:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;R = (TNetwork - TLocal) &#x2F; AvgProofTime&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The larger the AvgProofTime, the lower the success rate of defending against Sourcing Attack. Currently, the most significant factor affecting AvgProofTime is the average time for on-chain transactions. For example, in the BTC network, the time for 2 blocks is approximately 20 minutes. With such a large AvgProofTime, the success rate `R`` decreases rapidly, making sourcing attacks more likely to succeed. We can introduce a dynamically adjustable Proof of Work (PoW) mechanism to further defend against Sourcing Attack. This modification alters the formula as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;R = (TNetwork - TLocal) &#x2F; (AvgProofTime-AvgPoWTime)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;With the introduction of the Proof of Work (PoW) concept, the strategy for submitting storage proofs becomes: constructing and submitting storage proofs within a specified time while endeavoring to complete as much PoW computation as possible. In the valid proof time window, the storage proof with the greater amount of PoW computation prevails. Such a mechanism can effectively defend against external data source attacks, especially when AvgProofTime is large.&lt;&#x2F;p&gt;
&lt;p&gt;Integrating a PoW mechanism into the design of public data storage proofs is not complex. A simple implementation could modify the second step to:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;2. To generate a correct storage proof, the Supplier needs to traverse all 1KB chunks of D to find the optimal leaf node `m`. The method involves attempting to append the nonce and a self-constructed noise value to the end of each chunk to minimize the new Merkle tree root hash and, according to PoW difficulty requirements, ensuring that the last x bits of the constructed `proof_result_m` are zero. After determining `m` and the noise, the path `m_path` and the leaf node value `m_leaf_data` of `m` are extracted.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;Pseudocode&lt;&#x2F;code&gt; adjusted according to the above modifications is as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; generate proof with PoW off chain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;POW_DIFFICULTY&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 16&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; generateProofWithPow&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;mixHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; blockHeight&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;file&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; getNonce&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;blockHeight&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  hash_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; getHashType&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;mixHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  chunk_hash_array&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; buildChunkHashArray&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;file&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;hash_type&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  min_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  min_merkle_tree_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_UINT256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  min_chunk&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  m_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  noise&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  while&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; True&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; chunk&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; file&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      new_chunk&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; chunk&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; noise&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      chunk_hash_array&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;m_index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; getChunkHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;new_chunk&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;hash_type&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      merkle_tree_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; getMerkleTreeRoot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;chunk_hash_array&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;hash_type&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      chunk_hash_array&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;m_index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; getChunkHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;chunk&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;hash_type&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;merkle_tree_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; min_merkle_tree_root&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        min_merkle_tree_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; merkle_tree_root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        min_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; m_index&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        min_chunk&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; chunk&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      m_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; m_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;last_zero_bits&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;min_merkle_tree_root&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; POW_DIFFICULTY&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      break&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    noise&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; noise&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  m_path&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; getMerkleTreePath&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;chunk_hash_array&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; min_index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  return&lt;&#x2F;span&gt;&lt;span&gt; storage_proof&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;mixHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; blockHeight&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; min_index&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; m_path&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; min_chunk&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;noise&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Applying this mechanism increases the cost of generating storage proofs, which deviates from our initial intent to reduce the widespread effective storage of public data. Moreover, heavily relying on a PoW-based economic model may allow Suppliers with significant advantages in PoW through specialized hardware to disrupt the basic participatory nature of the game, reducing the widespread distribution of public data. Therefore, it is advised not to enable the PoW mechanism unless absolutely necessary.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;limitations&quot;&gt;Limitations&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;The storage proofs discussed in this paper are not suitable for storing very small files, as small files inherently struggle to defend against external data source attacks.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Public data storage proofs do not address the issue of whether the data is genuinely public. Therefore, it is important to verify the public nature of MixHash in specific scenarios (which is often not easy). Allowing Suppliers to submit storage proofs for any MixHash and receive rewards would lead to a situation where Suppliers create data only they possess and exploit this to gain rewards through constructed attacks, ultimately leading to the collapse of the entire ecosystem.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;erc-extension-suggestion-tracking-high-value-public-data-by-mixhash&quot;&gt;ERC Extension Suggestion: Tracking High-Value Public Data by MixHash&lt;&#x2F;h3&gt;
&lt;p&gt;We can use the existing Ethereum ecosystem to confirm whether a MixHash is public data and track its value. For any contracts related to unstructured data, the &lt;code&gt;ERCPublicDataOwner&lt;&#x2F;code&gt; interface can be implemented. This interface determines whether a specific MixHash is associated with the current contract and attempts to return an Owner address corresponding to a MixHash. Additionally, for the existing and widely recognized NFT ecosystem, we suggest that new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; contracts implement a new extension interface &lt;code&gt;ERC721MixHashVerify&lt;&#x2F;code&gt;. This interface can explicitly associate an NFT with a MixHash. The specific interface definition is as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERCPublicDataOwner Standard, query Owner of the specified MixHash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;  Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is &amp;lt;ERC-Number&amp;gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERCPublicDataOwner&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Queries Owner of public data determined by Mixhash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  mixHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    Mixhash you want to query&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;            If&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; it is an identified public data, return the Owner address, otherwise 0x0 will be returned&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getPublicDataOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; mixHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;ERC721MixHashVerfiy&lt;&#x2F;code&gt; extension is OPTIONAL for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; smart contracts or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; smart contracts. This extension can help establish a relationship between specified NFT and MixHash.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC721MixHashVerfiy Extension, optional extension&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;  Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is &amp;lt;ERC-Number&amp;gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721MixHashVerfiy&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Is the tokenId of the NFT is the Mixhash?&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;           True&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if the tokenId is MixHash, false if not&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenIdIsMixHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Queries NFT&amp;#39;s MixHash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  NFT to be querying&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;           The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; target NFT corresponds to MixHash, if it is not Mixhash, it returns 0x0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenDataHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Storage proofs (often referred to as space-time proofs) have long been a subject of interest, with numerous implementations and related projects existing.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Compared to existing copy proofs based on zero-knowledge proofs, our storage proof is based on &quot;Nash Consensus,&quot; with its core principles being:
a. The public network (on-chain) cannot verify the optimality of a proof but relies on economic game theory. This significantly reduces the costs of construction and verification.
b. Data without value typically lacks game value and is naturally eliminated from the system. There is no commitment to elusive perpetual storage.&lt;&#x2F;li&gt;
&lt;li&gt;It can be fully implemented through smart contracts (although the GAS cost of the current reference implementation is somewhat high), separating storage proof from the economic model.&lt;&#x2F;li&gt;
&lt;li&gt;For public data, we do not strictly defend against Sybil attacks. A Sybil attack refers to a Supplier using multiple identities to commit to storing multiple copies of data D (e.g., n copies) while actually storing less (like just one copy) but providing n storage proofs, thereby succeeding in the attack. Strictly preventing Sybil attacks essentially means attaching more additional costs to data storage. The core of our storage proof is to increase the probability of the existence of public data copies through a combination of storage proofs and different economic models, rather than needing to strictly define how many copies exist. Therefore, from the perspective of the design of public data storage proofs, we do not need to defend against Sybil attacks.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Using HashType allows storage proofs to be compatible with EVM-compatible public blockchain systems, as well as BTC-Like public blockchain systems. In fact, MixHash could become a new cross-chain value anchor: it can track the value of the same data represented by MixHash across different public blockchain networks using different models, achieving the aggregation of cross-chain values. Considering the need for backward compatibility, we have set the default HashType of MixHash to SHA256. Two categories of HashType remain unused, leaving ample room for future expansion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;PublicDataProofDemo includes test cases written using Hardhat.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;PublicDataProof Demo&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A standard reference implementation&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;DMC public data inscription&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Based on public data storage certification, a complete economic model and gameplay has been designed on ETH network and BTC inscription network&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Learn more background and existing attempts&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;DMC Main Chain&lt;&#x2F;li&gt;
&lt;li&gt;CYFS&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This storage proof revolves around public data. In demonstrating storage proofs, it often involves sending 1KB segments of the data to the public network. Therefore, please do not use the storage proof design presented in this paper for private data.&lt;&#x2F;p&gt;
&lt;p&gt;The design of MixHash can support storage proofs for private files, but this requires some adjustments in the processing of the original data and the construction of the storage proof. A detailed discussion on the design of storage proofs for private files is beyond the scope of this paper. In fact, some of the projects mentioned in the Reference Implementation section use both public data storage proofs and private data storage proofs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Modular Accounts with Delegated Validation</title>
        <published>2023-12-25T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Shivanshi Tyagi</name><uri>https://github.com/nerderlyne</uri>
	</author>
	
	<author>
		<name>Ross Campbell</name><uri>https://github.com/z0r0z</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7582/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7582-modular-accounts-with-delegated-validation/17640" />
        

        <id>https://wg-eips.ritovision.com/7582/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:7582"
            label="ERC-7582" />
        

        
        

        
        <summary type="html">Extends ERC-4337 interface with nonce-based plugins</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7582/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal standardizes a method for adding plugins and composable logic to smart contract accounts built on existing interfaces like &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt; (e.g., ERC-4337&#x27;s &lt;code&gt;IAccount&lt;&#x2F;code&gt;). Specifically, by formalizing how applications can use the ERC-4337 Entry Point &lt;code&gt;NonceManager&lt;&#x2F;code&gt; and the emission of the &lt;code&gt;IEntryPoint&lt;&#x2F;code&gt; &lt;code&gt;UserOperationEvent&lt;&#x2F;code&gt; to account for plugin interactions, as well, as how to extract designated validators (in this case, by means of &lt;code&gt;IAccount&lt;&#x2F;code&gt;&#x27;s &lt;code&gt;validateUserOp&lt;&#x2F;code&gt;), accounts can specify how they call plugin contracts and grant special executory access for more advanced operations. Furthermore, this minimalist plugin approach is developer-friendly and complimentary to existing account abstraction standards by not requiring any additional functions for contracts that follow the &lt;code&gt;IAccount&lt;&#x2F;code&gt; interface (itself minimalist in only specifying one function, &lt;code&gt;validateUserOp&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Smart contract accounts (contract accounts) are a powerful tool for managing digital assets and executing transactions by allowing users to program their interactions with blockchains. However, they are often limited in their functionality and flexibility without sufficient consensus around secure abstraction designs (albeit, the adoption of ERC-4337 is the preferred path of this proposal). For example, contract accounts are often unable to support social recovery, payment schedules, and other features that are common in traditional financial systems without efficient and predictable schemes to delegate execution and other access rights to approximate the UX of custodial and more specialized applications.&lt;&#x2F;p&gt;
&lt;p&gt;Account abstraction standards like ERC-4337 have achieved simplification of many core contract account concerns such as transaction fee payments, but to fully leverage the expressive capability of these systems to accomplish user intents, minimalist methods to delegate contract account access and validation to other contracts would aid their UX and extend the benefits of centering operations around the Entry Point.&lt;&#x2F;p&gt;
&lt;p&gt;While the &lt;code&gt;IAccount&lt;&#x2F;code&gt; interface from ERC-4337 does not specify a way to add custom validation logic to contract accounts to support plugins and similar extensions without upgrades or migrations, it nevertheless contains sufficient information to do so efficiently. This proposal therefore offers a method for adding plugins and other composable validation logic to smart contract accounts built on existing interfaces with singleton nonce-tracking like ERC-4337&#x27;s &lt;code&gt;IAccount&lt;&#x2F;code&gt; and &lt;code&gt;NonceManager&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7582&#x2F;.&#x2F;assets&#x2F;base-flow.svg&quot; alt=&quot;diagram showing proposed flow&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;We leverage the key in ERC-4337 semi-abstracted nonce as the pointer to &lt;code&gt;validator&lt;&#x2F;code&gt; identifier. If a non-sequential key (&lt;code&gt;&amp;gt;type(uint64).max&lt;&#x2F;code&gt;) is used as an ERC-4337 Entry Point &lt;code&gt;UserOperation&lt;&#x2F;code&gt; (userOp) &lt;code&gt;nonce&lt;&#x2F;code&gt;, the &lt;code&gt;validateUserOp&lt;&#x2F;code&gt; function in the &lt;code&gt;sender&lt;&#x2F;code&gt; contract account MUST extract the validator identifier, this MAY be the address itself or a pointer to the validator address in storage. Once the validator contract address is extracted, the proposed contract account (henceforth, shall be referred to as MADV account) MUST forward the userOp calldata to the validator. This calldata SHOULD be the entire userOp. In response to this delegated validation, the validator contract MUST return the ERC-4337 &lt;code&gt;validationData&lt;&#x2F;code&gt;, and the MADV &lt;code&gt;sender&lt;&#x2F;code&gt; account MUST return this as the &lt;code&gt;validationData&lt;&#x2F;code&gt; to the Entry Point.&lt;&#x2F;p&gt;
&lt;p&gt;In all of the above validation steps, the validator contract MUST respect the ERC-4337 Entry Point conventions. Note, that while validator key data might be included elsewhere in a &lt;code&gt;UserOperation&lt;&#x2F;code&gt; to achieve similar contract account modularity, for example, by packing this data into the &lt;code&gt;signature&lt;&#x2F;code&gt; field, this proposal opts to repurpose &lt;code&gt;nonce&lt;&#x2F;code&gt; for this pointer to minimize calldata costs and to benefit from the EntryPoint&#x27;s &lt;code&gt;getNonce&lt;&#x2F;code&gt; accounting, as well as the discoverability of user plugin interactions in the &lt;code&gt;UserOperationEvent&lt;&#x2F;code&gt; which exposes &lt;code&gt;nonce&lt;&#x2F;code&gt; but not other userOp data.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;erc-4337-references&quot;&gt;ERC-4337 references:&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;PackedUserOperation&lt;&#x2F;code&gt; interface&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * User Operation struct&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                - The sender account of this request.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                 - Unique value the sender uses to verify it is not a replay. In MADV, the validator identifier is encoded in the high 192 bit (`key`) of the nonce value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; initCode&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;              - If set, the account contract will be created by this constructor&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; callData&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;              - The method call to execute on this account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; accountGasLimits&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      - Packed gas limits for validateUserOp and gas limit passed to the callData method call.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; preVerificationGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    - Gas not calculated by the handleOps method, but added to the gas paid.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *                                Covers batch overhead.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; gasFees&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;               - packed gas fields maxPriorityFeePerGas and maxFeePerGas - Same as EIP-1559 gas parameters.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; paymasterAndData&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      - If set, this field holds the paymaster address, verification gas limit, postOp gas limit and paymaster-specific extra data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *                                The paymaster will pay for the transaction instead of the sender.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;             - Sender-verified signature over the entire request, the EntryPoint address and the chain ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PackedUserOperation&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span&gt; initCode&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span&gt; callData&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; accountGasLimits&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; preVerificationGas&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; gasFees&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span&gt; paymasterAndData&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;IAccount&lt;&#x2F;code&gt; interface&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IAccount&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Validate user&amp;#39;s signature and nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * the entryPoint will make the call to the recipient only if this validation call returns successfully.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * signature failure should be reported by returning SIG_VALIDATION_FAILED (1).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * This allows making a &amp;quot;simulation call&amp;quot; without a valid signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Other failures (e.g. nonce mismatch, or invalid signature format) should still revert to signal failure.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Must validate caller is the entryPoint.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      Must validate the signature and nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; userOp&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;              - The operation that is about to be executed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; userOpHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;          - Hash of the user&amp;#39;s request data. can be used as the basis for signature.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; missingAccountFunds&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - Missing funds on the account&amp;#39;s deposit in the entrypoint.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *                              This is the minimum amount to transfer to the sender(entryPoint) to be&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *                              able to make the call. The excess is left as a deposit in the entrypoint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *                              for future calls. Can be withdrawn anytime using &amp;quot;entryPoint.withdrawTo()&amp;quot;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *                              In case there is a paymaster in the request (or the current deposit is high&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *                              enough), this value will be zero.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; validationData&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;       - Packaged ValidationData structure. use `_packValidationData` and&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *                              `_unpackValidationData` to encode and decode.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *                              &amp;lt;20-byte&amp;gt; sigAuthorizer - 0 for valid signature, 1 to mark signature failure,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *                                 otherwise, an address of an &amp;quot;authorizer&amp;quot; contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *                              &amp;lt;6-byte&amp;gt; validUntil - Last timestamp this operation is valid. 0 for &amp;quot;indefinite&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *                              &amp;lt;6-byte&amp;gt; validAfter - First timestamp this operation is valid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *                                                    If an account doesn&amp;#39;t use time-range, it is enough to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *                                                    return SIG_VALIDATION_FAILED value (1) for signature failure.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *                              &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; that the validation code cannot use block.timestamp (or block.number) directly.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validateUserOp&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        PackedUserOperation&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; userOp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; userOpHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; missingAccountFunds&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; validationData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;NonceManager&lt;&#x2F;code&gt; interface&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Return the next nonce for this sender.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Within a given key, the nonce values are sequenced (starting with zero, and incremented by one on each userop)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * But UserOp with different keys can come with arbitrary order.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the account address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the high 192 bit of the nonce, in MADV the validator identifier is encoded here &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; a full nonce to pass for next UserOp with this sender.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getNonce&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint192&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;UserOperationEvent&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * An event emitted after each successful request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; userOpHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - unique identifier for the request (hash its entire content, except signature).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - the account that generates this request.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; paymaster&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - if non-null, the paymaster that pays for this request.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - the nonce value from the request.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; success&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - true if the sender transaction succeeded, false if reverted.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; actualGasCost&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - actual amount paid (by account or paymaster) for this UserOperation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; actualGasUsed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - total gas used by this UserOperation (including preVerification, creation, validation and execution).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UserOperationEvent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; userOpHash&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; paymaster&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; actualGasCost&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; actualGasUsed&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal is designed to be a minimalist extension to ERC-4337 that allows for additional functionality without requiring changes to the existing interface. Keeping the proposal&#x27;s footprint small.&lt;&#x2F;p&gt;
&lt;p&gt;Further, by repurposing the nonce field for the validator identifier we minimize calldata costs and leverage existing &lt;code&gt;getNonce&lt;&#x2F;code&gt; accounting. The &lt;code&gt;UserOperationEvent&lt;&#x2F;code&gt; emits nonce which can be used for tracking validator invocations without additional events. Other options like packing the validator identifier into the &lt;code&gt;signature&lt;&#x2F;code&gt; field were considered but were rejected due to potential for conflict with other signatures schemes and increased opaqueness into validator invocation.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal allows for MADV accounts to specify their own method for extracting the validator address from the &lt;code&gt;nonce&lt;&#x2F;code&gt;. This provides flexibility to account developers and supports both &quot;just in time&quot; validators as well as a more predictable storage pattern for plugin reuse.&lt;&#x2F;p&gt;
&lt;p&gt;The requirement is simply to use &lt;code&gt;nonce&lt;&#x2F;code&gt; for encoding an identifier and to return the &lt;code&gt;validationData&lt;&#x2F;code&gt; from the extracted validator contract to the &lt;code&gt;EntryPoint&lt;&#x2F;code&gt; in line with the requirements of the ERC-4337 &lt;code&gt;validateUserOp&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;See the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7582&#x2F;.&#x2F;assets&#x2F;MADVAccount.sol&quot;&gt;MADV reference implementation&lt;&#x2F;a&gt; for a simple example of how to implement this proposal.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;As this proposal introduces no new functions and leaves implementation of the validator extraction method and approval logic open to developers, the surface for security issues is intentionally kept small. Nevertheless, specific validator use cases require further discussion and consideration of the overall ERC-4337 verification flow and its underlying security.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Minimal Modular Smart Accounts</title>
        <published>2023-12-14T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>zeroknots</name><uri>https://github.com/zeroknots</uri>
	</author>
	
	<author>
		<name>Konrad Kopp</name><uri>https://github.com/kopy-kat</uri>
	</author>
	
	<author>
		<name>Taek Lee</name><uri>https://github.com/leekt</uri>
	</author>
	
	<author>
		<name>Fil Makarov</name><uri>https://github.com/filmakarov</uri>
	</author>
	
	<author>
		<name>Elim Poon</name><uri>https://github.com/yaonam</uri>
	</author>
	
	<author>
		<name>Lyu Min</name><uri>https://github.com/rockmin216</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7579/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7579-minimal-modular-smart-accounts/17336" />
        

        <id>https://wg-eips.ritovision.com/7579/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7579"
            label="ERC-7579" />
        

        
        

        
        <summary type="html">Modular smart account interfaces and behavior for interoperability with minimal restrictions for accounts and modules</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7579/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal outlines the minimally required interfaces and behavior for modular smart accounts and modules to ensure interoperability across implementations. For accounts, the standard specifies execution, config and fallback interfaces as well as compliance to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;ERC-1271&lt;&#x2F;a&gt;. For modules, the standard specifies a core interface, module types and type-specific interfaces.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Contract accounts are gaining adoption with many accounts being built using a modular architecture. These modular contract accounts (hereafter smart accounts) move functionality into external contracts (modules) in order to increase the speed and potential of innovation, to future-proof themselves and to allow customizability by developers and users. However, currently these smart accounts are built in vastly different ways, creating module fragmentation and vendor lock-in. There are several reasons for why standardizing smart accounts is very beneficial to the ecosystem, including:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Interoperability for modules to be used across different smart accounts&lt;&#x2F;li&gt;
&lt;li&gt;Interoperability for smart accounts to be used across different wallet applications and sdks&lt;&#x2F;li&gt;
&lt;li&gt;Preventing significant vendor lock-in for smart account users&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;However, it is highly important that this standardization is done with minimal impact on the implementation logic of the accounts, so that smart account vendors can continue to innovate, while also allowing a flourishing, multi-account-compatible module ecosystem. As a result, the goal of this standard is to define the smart account and module interfaces and behavior that is as minimal as possible while ensuring interoperability between accounts and modules.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Smart account&lt;&#x2F;strong&gt; - A smart contract account that has a modular architecture.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Module&lt;&#x2F;strong&gt; - A smart contract with self-contained smart account functionality.
&lt;ul&gt;
&lt;li&gt;Validator: A module used during the validation phase to determine if a transaction is valid and should be executed on the account.&lt;&#x2F;li&gt;
&lt;li&gt;Executor: A module that can execute transactions on behalf of the smart account via a callback.&lt;&#x2F;li&gt;
&lt;li&gt;Fallback Handler: A module that can extend the fallback functionality of a smart account.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;EntryPoint&lt;&#x2F;strong&gt; - A trusted singleton contract according to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt; specifications.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Validation&lt;&#x2F;strong&gt; - Any functionality used to determine if an execution should be made on the account. When using ERC-4337, this function will be &lt;code&gt;validateUserOp&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Execution&lt;&#x2F;strong&gt; - Any functionality used to execute an operation from or on the users account. When using ERC-4337, this will be called by the EntryPoint using &lt;code&gt;userOp.callData&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;account&quot;&gt;Account&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;validation&quot;&gt;Validation&lt;&#x2F;h4&gt;
&lt;p&gt;This standard does not dictate how validator selection is implemented. However, should a smart account encode validator selection mechanisms in data fields passed to the validator (e.g. in &lt;code&gt;userOp.signature&lt;&#x2F;code&gt; if used with ERC-4337), the smart account MUST sanitize the affected values before invoking the validator.&lt;&#x2F;p&gt;
&lt;p&gt;The smart account&#x27;s validation function SHOULD return the return value of the validator.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;execution-behavior&quot;&gt;Execution Behavior&lt;&#x2F;h4&gt;
&lt;p&gt;To comply with this standard, smart accounts MUST implement the execution interface below:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7579Execution&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Executes a transaction on behalf of the account. MAY be payable.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; mode&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The encoded execution mode of the transaction.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; executionCalldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The encoded execution call data.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST ensure adequate authorization control: e.g. onlyEntryPointOrSelf if used with ERC-4337&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * If a mode is requested that is not supported by the Account, it MUST revert&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; execute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; mode&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; executionCalldata&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Executes a transaction on behalf of the account. MAY be payable.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *         This function is intended to be called by Executor Modules&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; mode&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The encoded execution mode of the transaction.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; executionCalldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The encoded execution call data.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; returnData&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array with the returned data of each executed subcall&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST ensure adequate authorization control: i.e. onlyExecutorModule&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * If a mode is requested that is not supported by the Account, it MUST revert&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; executeFromExecutor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; mode&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; executionCalldata&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; returnData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The account MAY also implement the following function in accordance with ERC-4337:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-4337 executeUserOp according to ERC-4337 v0.7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *         This function is intended to be called by ERC-4337 EntryPoint.sol&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; userOp&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; PackedUserOperation struct (see ERC-4337 v0.7+)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; userOpHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The hash of the PackedUserOperation struct&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * MUST ensure adequate authorization control: i.e. onlyEntryPoint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; executeUserOp&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;PackedUserOperation&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; userOp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; userOpHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;If an account chooses to implement &lt;code&gt;executeUserOp&lt;&#x2F;code&gt;, this method SHOULD ensure the account executes &lt;code&gt;userOp.calldata&lt;&#x2F;code&gt; except 4 most significant bytes, which are reserved for &lt;code&gt;executeUserOp.selector&lt;&#x2F;code&gt; as per ERC-4337. Thus the &lt;code&gt;userOp.callData[4:]&lt;&#x2F;code&gt; should represent the calldata for a valid call to the account. It is RECOMMENDED that the account executes a &lt;code&gt;delegatecall&lt;&#x2F;code&gt; in order to preserve the original &lt;code&gt;msg.sender&lt;&#x2F;code&gt; to the account.&lt;&#x2F;p&gt;
&lt;p&gt;Example:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(bool success, bytes memory innerCallRet) = address(this).delegatecall(userOp.callData[4:]);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The execution mode is a &lt;code&gt;bytes32&lt;&#x2F;code&gt; value that is structured as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;callType (1 byte): &lt;code&gt;0x00&lt;&#x2F;code&gt; for a single &lt;code&gt;call&lt;&#x2F;code&gt;, &lt;code&gt;0x01&lt;&#x2F;code&gt; for a batch &lt;code&gt;call&lt;&#x2F;code&gt;, &lt;code&gt;0xfe&lt;&#x2F;code&gt; for &lt;code&gt;staticcall&lt;&#x2F;code&gt; and &lt;code&gt;0xff&lt;&#x2F;code&gt; for &lt;code&gt;delegatecall&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;execType (1 byte): &lt;code&gt;0x00&lt;&#x2F;code&gt; for executions that revert on failure, &lt;code&gt;0x01&lt;&#x2F;code&gt; for executions that do not revert on failure but implement some form of error handling&lt;&#x2F;li&gt;
&lt;li&gt;unused (4 bytes): this range is reserved for future standardization&lt;&#x2F;li&gt;
&lt;li&gt;modeSelector (4 bytes): an additional mode selector that can be used to create further execution modes&lt;&#x2F;li&gt;
&lt;li&gt;modePayload (22 bytes): additional data to be passed&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Here is a visual representation of the execution mode:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;CallType&lt;&#x2F;th&gt;&lt;th&gt;ExecType&lt;&#x2F;th&gt;&lt;th&gt;Unused&lt;&#x2F;th&gt;&lt;th&gt;ModeSelector&lt;&#x2F;th&gt;&lt;th&gt;ModePayload&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;1 byte&lt;&#x2F;td&gt;&lt;td&gt;1 byte&lt;&#x2F;td&gt;&lt;td&gt;4 bytes&lt;&#x2F;td&gt;&lt;td&gt;4 bytes&lt;&#x2F;td&gt;&lt;td&gt;22 bytes&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Accounts are NOT REQUIRED to implement all execution modes. The account MUST declare what modes are supported in &lt;code&gt;supportsExecutionMode&lt;&#x2F;code&gt; (see below) and if a mode is requested that is not supported by the account, the account MUST revert.&lt;&#x2F;p&gt;
&lt;p&gt;The account MUST encode the execution data the following ways:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;For single calls, the &lt;code&gt;target&lt;&#x2F;code&gt;, &lt;code&gt;value&lt;&#x2F;code&gt; and &lt;code&gt;callData&lt;&#x2F;code&gt; are packed in this order (ie &lt;code&gt;abi.encodePacked&lt;&#x2F;code&gt; in Solidity).&lt;&#x2F;li&gt;
&lt;li&gt;For delegatecalls, the &lt;code&gt;target&lt;&#x2F;code&gt; and &lt;code&gt;callData&lt;&#x2F;code&gt; are packed in this order (ie &lt;code&gt;abi.encodePacked&lt;&#x2F;code&gt; in Solidity).&lt;&#x2F;li&gt;
&lt;li&gt;For batch calls, the &lt;code&gt;targets&lt;&#x2F;code&gt;, &lt;code&gt;values&lt;&#x2F;code&gt; and &lt;code&gt;callDatas&lt;&#x2F;code&gt; are put into an array of &lt;code&gt;Execution&lt;&#x2F;code&gt; structs that includes these fields in this order (ie &lt;code&gt;Execution(address target, uint256 value, bytes memory callData)&lt;&#x2F;code&gt;). Then, this array is encoded with padding (ie &lt;code&gt;abi.encode&lt;&#x2F;code&gt; in Solidity).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;account-configurations&quot;&gt;Account configurations&lt;&#x2F;h4&gt;
&lt;p&gt;To comply with this standard, smart accounts MUST implement the account config interface below:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7579AccountConfig&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the account id of the smart account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; accountImplementationId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the account id of the smart account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST return a non-empty string&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * The accountId SHOULD be structured like so:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *        &amp;quot;vendorname.accountname.semver&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * The id SHOULD be unique across all smart accounts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; accountId&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; accountImplementationId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Function to check if the account supports a certain execution mode (see above)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; encodedMode&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the encoded mode&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST return true if the account supports the mode and false otherwise&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsExecutionMode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; encodedMode&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Function to check if the account supports a certain module typeId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; moduleTypeId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the module type ID according to the ERC-7579 spec&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST return true if the account supports the module type and false otherwise&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsModule&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; moduleTypeId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;module-configurations&quot;&gt;Module configurations&lt;&#x2F;h4&gt;
&lt;p&gt;To comply with this standard, smart accounts MUST implement the module config interface below.&lt;&#x2F;p&gt;
&lt;p&gt;When storing an installed module, the smart account MUST ensure that there is a way to differentiate between module types. For example, the smart account should be able to implement access control that only allows installed executors, but not other installed modules, to call the &lt;code&gt;executeFromExecutor&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7579ModuleConfig&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ModuleInstalled&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; moduleTypeId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; module&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ModuleUninstalled&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; moduleTypeId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; module&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Installs a Module of a certain type on the smart account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; moduleTypeId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the module type ID according to the ERC-7579 spec&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; module&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the module address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; initData&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; arbitrary data that may be required on the module during `onInstall`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * initialization.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST implement authorization control&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST call `onInstall` on the module with the `initData` parameter if provided&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST emit ModuleInstalled event&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST revert if the module is already installed or the initialization on the module failed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; installModule&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; moduleTypeId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; module&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; initData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Uninstalls a Module of a certain type on the smart account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; moduleTypeId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the module type ID according the ERC-7579 spec&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; module&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the module address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; deInitData&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; arbitrary data that may be required on the module during `onInstall`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * initialization.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST implement authorization control&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST call `onUninstall` on the module with the `deInitData` parameter if provided&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST emit ModuleUninstalled event&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST revert if the module is not installed or the deInitialization on the module failed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; uninstallModule&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; moduleTypeId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; module&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; deInitData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns whether a module is installed on the smart account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; moduleTypeId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the module type ID according the ERC-7579 spec&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; module&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the module address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; additionalContext&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; arbitrary data that may be required to determine if the module is installed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST return true if the module is installed and false otherwise&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isModuleInstalled&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; moduleTypeId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; module&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; additionalContext&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;hooks&quot;&gt;Hooks&lt;&#x2F;h4&gt;
&lt;p&gt;Hooks are an OPTIONAL extension of this standard. Smart accounts MAY use hooks to execute custom logic and checks before and&#x2F;or after the smart accounts performs a single or batched execution. To comply with this OPTIONAL extension, a smart account:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;MUST call the &lt;code&gt;preCheck&lt;&#x2F;code&gt; function of one or multiple hooks before any call or batch of calls going through execute or executeFromExecutor&lt;&#x2F;li&gt;
&lt;li&gt;MUST call the &lt;code&gt;postCheck&lt;&#x2F;code&gt; function of one or multiple hooks after any call or batch of calls through execute or executeFromExecutor&lt;&#x2F;li&gt;
&lt;li&gt;Is RECOMMENDED to call &lt;code&gt;preCheck&lt;&#x2F;code&gt; and &lt;code&gt;postCheck&lt;&#x2F;code&gt; before and after executing calls to &lt;code&gt;installModule&lt;&#x2F;code&gt; or &lt;code&gt;uninstallModule&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Is RECOMMENDED to call &lt;code&gt;preCheck&lt;&#x2F;code&gt; and &lt;code&gt;postCheck&lt;&#x2F;code&gt; before and after executing calls through other (custom) functions called execution&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;erc-1271-forwarding&quot;&gt;ERC-1271 Forwarding&lt;&#x2F;h4&gt;
&lt;p&gt;The smart account MUST implement the ERC-1271 interface. The &lt;code&gt;isValidSignature&lt;&#x2F;code&gt; function calls MAY be forwarded to a validator. If ERC-1271 forwarding is implemented, the validator MUST be called with &lt;code&gt;isValidSignatureWithSender(address sender, bytes32 hash, bytes signature)&lt;&#x2F;code&gt;, where the sender is the &lt;code&gt;msg.sender&lt;&#x2F;code&gt; of the call to the smart account. Should the smart account implement any validator selection encoding in the &lt;code&gt;bytes signature&lt;&#x2F;code&gt; parameter, the smart account MUST sanitize the parameter, before forwarding it to the validator.&lt;&#x2F;p&gt;
&lt;p&gt;The smart account&#x27;s ERC-1271 &lt;code&gt;isValidSignature&lt;&#x2F;code&gt; function SHOULD return the return value of the validator that the request was forwarded to.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;fallback&quot;&gt;Fallback&lt;&#x2F;h4&gt;
&lt;p&gt;Smart accounts MAY implement a fallback function that forwards the call to a fallback handler.&lt;&#x2F;p&gt;
&lt;p&gt;If the smart account has a fallback handler installed, it:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;MUST use &lt;code&gt;call&lt;&#x2F;code&gt; or &lt;code&gt;staticcall&lt;&#x2F;code&gt; to invoke the fallback handler&lt;&#x2F;li&gt;
&lt;li&gt;MUST utilize &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2771&#x2F;&quot;&gt;ERC-2771&lt;&#x2F;a&gt; to add the original &lt;code&gt;msg.sender&lt;&#x2F;code&gt; to the &lt;code&gt;calldata&lt;&#x2F;code&gt; sent to the fallback handler&lt;&#x2F;li&gt;
&lt;li&gt;MUST route to fallback handlers based on the function selector of the calldata&lt;&#x2F;li&gt;
&lt;li&gt;MAY implement authorization control, which SHOULD be done via hooks&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;If the account adds features via fallback, these should be considered the same as if the account was implementing those features natively.
ERC-165 support (see below) is one example of such an approach. Note, that it is only RECOMMENDED to implement view functions via fallback where this can lead to greater extensibility. It is NOT RECOMMENDED to implement core account logic via a fallback.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;erc-165&quot;&gt;ERC-165&lt;&#x2F;h4&gt;
&lt;p&gt;Smart accounts MAY implement ERC-165. However, for every interface function that reverts instead of implementing the functionality, the smart account MUST return &lt;code&gt;false&lt;&#x2F;code&gt; for the corresponding interface id.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;modules&quot;&gt;Modules&lt;&#x2F;h3&gt;
&lt;p&gt;This standard separates modules into the following different types that each has a unique and incremental identifier, which MUST be used by accounts, modules and other entities to identify the module type:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Validation (type id: 1)&lt;&#x2F;li&gt;
&lt;li&gt;Execution (type id: 2)&lt;&#x2F;li&gt;
&lt;li&gt;Fallback (type id: 3)&lt;&#x2F;li&gt;
&lt;li&gt;Hooks (type id: 4)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note: A single module can be of multiple types.&lt;&#x2F;p&gt;
&lt;p&gt;Modules MUST implement the following interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7579Module&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function is called by the smart account during installation of the module&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; arbitrary data that may be required on the module during `onInstall` initialization&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST revert on error (e.g. if module is already enabled)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onInstall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function is called by the smart account during uninstallation of the module&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; arbitrary data that may be required on the module during `onUninstall` de-initialization&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST revert on error&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onUninstall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns boolean value if module is a certain type&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; moduleTypeId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the module type ID according the ERC-7579 spec&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST return true if the module is of the given type and false otherwise&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isModuleType&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; moduleTypeId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note: A single module that is of multiple types MAY decide to pass &lt;code&gt;moduleTypeId&lt;&#x2F;code&gt; inside &lt;code&gt;data&lt;&#x2F;code&gt; to &lt;code&gt;onInstall&lt;&#x2F;code&gt; and&#x2F;or &lt;code&gt;onUninstall&lt;&#x2F;code&gt; methods, so those methods are able to properly handle installation&#x2F;uninstallation for various types.
Example:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Module.sol&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onInstall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; moduleTypeId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; otherData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;decode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;validators&quot;&gt;Validators&lt;&#x2F;h4&gt;
&lt;p&gt;Validators MUST implement the &lt;code&gt;IERC7579Module&lt;&#x2F;code&gt; and the &lt;code&gt;IERC7579Validator&lt;&#x2F;code&gt; interface and have module type id: &lt;code&gt;1&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7579Validator&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7579Module&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Validates a UserOperation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; userOp&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the ERC-4337 PackedUserOperation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; userOpHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the hash of the ERC-4337 PackedUserOperation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST validate that the signature is a valid signature of the userOpHash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * SHOULD return ERC-4337&amp;#39;s SIG_VALIDATION_FAILED (and not revert) on signature mismatch&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validateUserOp&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;PackedUserOperation&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; userOp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; userOpHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Validates a signature using ERC-1271&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the address that sent the ERC-1271 request to the smart account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the hash of the ERC-1271 request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the signature of the ERC-1271 request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST return the ERC-1271 `MAGIC_VALUE` if the signature is valid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST NOT modify state&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isValidSignatureWithSender&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;executors&quot;&gt;Executors&lt;&#x2F;h4&gt;
&lt;p&gt;Executors MUST implement the &lt;code&gt;IERC7579Module&lt;&#x2F;code&gt; interface and have module type id: &lt;code&gt;2&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;fallback-handlers&quot;&gt;Fallback Handlers&lt;&#x2F;h4&gt;
&lt;p&gt;Fallback handlers MUST implement the &lt;code&gt;IERC7579Module&lt;&#x2F;code&gt; interface and have module type id: &lt;code&gt;3&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Fallback handlers MAY implement authorization control. Fallback handlers that do implement authorization control, MUST NOT rely on &lt;code&gt;msg.sender&lt;&#x2F;code&gt; for authorization control but MUST use ERC-2771 &lt;code&gt;_msgSender()&lt;&#x2F;code&gt; instead.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;hooks-1&quot;&gt;Hooks&lt;&#x2F;h4&gt;
&lt;p&gt;Hooks MUST implement the &lt;code&gt;IERC7579Module&lt;&#x2F;code&gt; and the &lt;code&gt;IERC7579Hook&lt;&#x2F;code&gt; interface and have module type id: &lt;code&gt;4&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7579Hook&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7579Module&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Called by the smart account before execution&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; msgSender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the address that called the smart account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the value that was sent to the smart account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; msgData&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the data that was sent to the smart account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MAY return arbitrary data in the `hookData` return value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; preCheck&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; msgSender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; msgData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; hookData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Called by the smart account after execution&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; hookData&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the data that was returned by the `preCheck` function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MAY validate the `hookData` to validate transaction context of the `preCheck` function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; postCheck&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; hookData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;minimal-approach&quot;&gt;Minimal approach&lt;&#x2F;h3&gt;
&lt;p&gt;Smart accounts are a new concept and we are still learning about the best ways to build them. Therefore, we should not be too opinionated about how they are built. Instead, we should define the most minimal interfaces that allow for interoperability between smart accounts and modules to be used across different account implementations.&lt;&#x2F;p&gt;
&lt;p&gt;Our approach has been twofold:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Take learnings from existing smart accounts that have been used in production and from building interoperability layers between them&lt;&#x2F;li&gt;
&lt;li&gt;Ensure that the interfaces are as minimal and open to alternative architectures as possible&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;extensions&quot;&gt;Extensions&lt;&#x2F;h3&gt;
&lt;p&gt;While we want to be minimal, we also want to allow for innovation and opinionated features. Some of these features might also need to be standardized (for similar reasons as the core interfaces) even if not all smart accounts will implement them. To ensure that this is possible, we suggest for future standardization efforts to be done as extensions to this standard. This means that the core interfaces will not change, but that new interfaces can be added as extensions. These should be proposed as separate ERCs, for example with the title &quot;[FEATURE] Extension for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7579&#x2F;&quot;&gt;ERC-7579&lt;&#x2F;a&gt;&quot;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;specification-1&quot;&gt;Specification&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;execution-mode&quot;&gt;Execution mode&lt;&#x2F;h4&gt;
&lt;p&gt;Accounts need to be able to execute calldata in different ways. Rather than defining a separate function for each combination of execution types, we decided to encode the execution type in a single &lt;code&gt;bytes32&lt;&#x2F;code&gt; value. This allows for a more flexible and extensible approach, while also making the code far easier to write, read, maintain and audit. As explained above, the exeuction mode consists of two bytes that encode the call type and the execution type. The call type covers the three different methods of calls, namely single, batched and &lt;code&gt;delegatecall&lt;&#x2F;code&gt; (note that you can &lt;code&gt;delegatecall&lt;&#x2F;code&gt; to a multicall contract to batch &lt;code&gt;delegatecalls&lt;&#x2F;code&gt;). The execution type covers the two different types of executions, namely executions that revert on failure and executions that do not revert on failure but implement some form of error handling. This allows for accounts to batch together uncorrelated executions, such that if one execution fails, the other executions can still be executed. These two bytes are followed by 4 unused bytes that are reserved for futurre standardization, should this be required. This is followed by an item of 4 bytes which is a custom mode selector that accounts can implement. This allows for accounts to implement custom execution modes that are not covered by the standard and do not need to be standardized. This item is 4 bytes long to ensure collision resistance between different account vendors, with the same guarantees as Solidity function selectors. Finally, the last 22 bytes are reserved for custom data that can be passed to the account. This allows for accounts to pass any data up to 22 bytes, such as a 2 byte flag followed by an address, or otherwise a pointer to further data packed into the calldata for the execution. For example, this payload can be used to pass a hook address that should be executed before and&#x2F;or after the execution.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;differentiating-module-types&quot;&gt;Differentiating module types&lt;&#x2F;h4&gt;
&lt;p&gt;Not differentiating between module types could present a security issue when enforcing authorization control. For example, if a smart account treats validators and executors as the same type of module, it could allow a validator to execute arbitrary transactions on behalf of the smart account.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;account-id&quot;&gt;Account id&lt;&#x2F;h4&gt;
&lt;p&gt;The account config interface includes a function &lt;code&gt;accountId&lt;&#x2F;code&gt; which can be used to identify an account. This is especially useful for frontend libraries that need to determine what account type and version is being used in order to implement the correct logic for account behavior that is not standardized. Alternate solutions include using an ERC-165-like interface to declare the exact differences and supported features of accounts or returning a keccak hash of the account id. However, the first solution is not as flexible as the account id and requires agreeing on a well-defined set of features to use, while the second solution is not as human-readable as the account id.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;dependence-on-erc-4337&quot;&gt;Dependence on ERC-4337&lt;&#x2F;h4&gt;
&lt;p&gt;This standard has a strict dependency on ERC-4337 for the validation flow. However, it is likely that smart account builders will want to build modular accounts in the future that do not use ERC-4337 but, for example, a native account abstraction implementation on a rollup. Once this starts to happen, the proposed upgrade path for this standard is to move the ERC-4337 dependency into an extension (ie a separate ERC) and to make it optional for smart accounts to implement. If it is required to standardize the validation flow for different account abstraction implementations, then these requirements could also be moved into separate extensions.&lt;&#x2F;p&gt;
&lt;p&gt;The reason this is not done from the start is that currently, the only modular accounts that are being built are using ERC-4337. Therefore, it makes sense to standardize the interfaces for these accounts first and to move the ERC-4337 dependency into an extension once there is a need for it. This is to maximize learnings about how modular accounts would look like when built on different account abstraction implementations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;already-deployed-smart-accounts&quot;&gt;Already deployed smart accounts&lt;&#x2F;h3&gt;
&lt;p&gt;Smart accounts that have already been deployed will most likely be able to implement this standard. If they are deployed as proxies, it is possible to upgrade to a new account implementation that is compliant with this standard. If they are deployed as non-upgradeable contracts, it might still be possible to become compliant, for example by adding a compliant adapter as a fallback handler, if this is supported.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;A full interface of a smart account can be found in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7579&#x2F;.&#x2F;assets&#x2F;IMSA.sol&quot;&gt;&lt;code&gt;IMSA.sol&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs more discussion. Some initial considerations:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Implementing &lt;code&gt;delegatecall&lt;&#x2F;code&gt; executions on a smart account must be considered carefully. Note that smart accounts implementing &lt;code&gt;delegatecall&lt;&#x2F;code&gt; must ensure that the target contract is safe, otherwise security vulnerabilities are to be expected.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;onInstall&lt;&#x2F;code&gt; and &lt;code&gt;onUninstall&lt;&#x2F;code&gt; functions on modules may lead to unexpected callbacks (e.g. reentrancy). Account implementations should consider this by implementing adequate protection routines. Furthermore, modules could maliciously revert on &lt;code&gt;onUninstall&lt;&#x2F;code&gt; to stop the account from uninstalling a module and removing it from the account.&lt;&#x2F;li&gt;
&lt;li&gt;For modules types where only a single module is active at one time (e.g. fallback handlers), calling &lt;code&gt;installModule&lt;&#x2F;code&gt; on a new module will not properly uninstall the previous module, unless this is properly implemented. This could lead to unexpected behavior if the old module is then added again with left over state.&lt;&#x2F;li&gt;
&lt;li&gt;Insufficient authorization control in fallback handlers can lead to unauthorized executions.&lt;&#x2F;li&gt;
&lt;li&gt;Malicious Hooks may revert on &lt;code&gt;preCheck&lt;&#x2F;code&gt; or &lt;code&gt;postCheck&lt;&#x2F;code&gt;, adding untrusted hooks may lead to a denial of service of the account.&lt;&#x2F;li&gt;
&lt;li&gt;Currently account configuration functions (e.g. &lt;code&gt;installModule&lt;&#x2F;code&gt;) are designed for single operations. An account could allow these to be called from &lt;code&gt;address(this)&lt;&#x2F;code&gt;, creating the possibility to batch configuration operations. However, if an account implements greater authorization control for these functions since they are more sensitive, then these measures can be bypassed by nesting calls to configuration options in calls to self.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Advertisement Tracking Interface</title>
        <published>2023-12-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>wart</name><uri>https://github.com/wartstone</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7580/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7580-inter-dapp-tracking-inferface/17653" />
        

        <id>https://wg-eips.ritovision.com/7580/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7580"
            label="ERC-7580" />
        

        
        

        
        <summary type="html">Interfaces for advertisement clients tracking user actions and checking proportional rewards.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7580/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC proposes a standard interface for advertisement clients to track user actions in contracts and check corresponding rewards from advertisement protocols. Contracts implementing the interface use events to define a region of interest within a transaction. A Dapp could implement this interface to join an advertisement protocol, which enable projects to fund users for specific actions in a contract. While users could benefit from project funds, dapps would also get proportional rewards once they joined the protocol.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Dapps would propsper due to mass adoption and there emerges surging demands for advertisement on chain. Compared with advertisements in web2, web3 has tremendous advantages on delivery and many other fields. We do need a set of standard tracking interfaces to facilitate advertisement related developments, which could create new economic cycles on chain, further boost dapp prosperity and ultimately benefit on chain users.&lt;&#x2F;p&gt;
&lt;p&gt;Tracking interface standard should be designed with essential &amp;amp; universal support for tracking user actions, and minimum restriction, which could leave most innovative space for airdrop (or advertisement) protocol. The general routine would work like this:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;projects get a seed id (hash) from promotion side&lt;&#x2F;li&gt;
&lt;li&gt;before the target promotion action starts, project contracts called the interface &lt;code&gt;onTrackStart(id, contract_address, function_hash)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;after the target promotion action ends, project contracts called the inferface &lt;code&gt;onTrackEnd(id, contract_address, function_hash)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;promotion contract collect the project action info and distribute the rewards back to projects&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;For example, we have two entities holding their respective contracts: contract A and contract B. Contract A targets on users who did specific key moves(eg. commit specific functions) in contract B and would give bonus&#x2F;airdrop to these users. Sure B would also get incentives in the meanwhile. To connect all these dots, B needs to identity these users, verify they&#x27;re coming for the A&#x27;s bonus. Hence, we need a track mechanism to facilitate such business.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords “MUST,” “MUST NOT,” “REQUIRED,” “SHALL,” “SHALL NOT,” “SHOULD,” “SHOULD NOT,” “RECOMMENDED,” “MAY,” and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;interfaces&quot;&gt;Interfaces&lt;&#x2F;h3&gt;
&lt;p&gt;This protocol standardizes how to keep track of inter-dapp operations, which initially offers 2 main methods &lt;code&gt;onTrackStart&lt;&#x2F;code&gt; and &lt;code&gt;onTrackEnd&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.10&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERCXXX&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Events&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emits when track starts.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; track_id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; track id&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contract_address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the address of tracking contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; function_hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the hash of tracking function with params&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onTrackStartRecorded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; track_id&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contract_address&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; function_hash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emits when track starts.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; track_id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; track id&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contract_address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the address of tracking contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; function_hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the hash of tracking function with params&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onTrackEndRecorded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; track_id&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contract_address&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; function_hash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Functions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Track a specified contract function start move.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; track_id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; track id&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contract_address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the address of tracking contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; function_hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the hash of tracking function with params&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onTrackStart&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; track_id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contract_address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; function_hash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Track a specified contract function end move.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; track_id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; track id&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contract_address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the address of tracking contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; function_hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the hash of tracking function with params&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onTrackEnd&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; track_id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contract_address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; function_hash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The core mechanism for this proposal is to provide a shared tracking interface for inter-dapp operations, to improve the efficiency and fulfill the required tracking business. We provide two interface functions &lt;code&gt;onTrackStart&lt;&#x2F;code&gt; and &lt;code&gt;onTrackEnd&lt;&#x2F;code&gt; to fill the basic required info and connect the necessary dots. Sure there&#x27;re more demands for more functions and it would be updated later.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues are introduced by this standard.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;!-- TODO: discuss more --&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Multi-Asset ERC-4626 Vaults</title>
        <published>2023-12-11T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Jeroen Offerijns</name><uri>https://github.com/hieronx</uri>
	</author>
	
	<author>
		<name>Alina Sinelnikova</name><uri>https://github.com/ilinzweilin</uri>
	</author>
	
	<author>
		<name>Vikram Arun</name><uri>https://github.com/vikramarun</uri>
	</author>
	
	<author>
		<name>Joey Santoro</name><uri>https://github.com/joeysantoro</uri>
	</author>
	
	<author>
		<name>Farhaan Ali</name><uri>https://github.com/0xfarhaan</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7575/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7575-partial-and-extended-erc-4626-vaults/17274" />
        

        <id>https://wg-eips.ritovision.com/7575/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7575"
            label="ERC-7575" />
        

        
        

        
        <summary type="html">Extended ERC-4626 Interface enabling Multi-Asset Vaults</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7575/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The following standard adapts &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4626&#x2F;&quot;&gt;ERC-4626&lt;&#x2F;a&gt; to support multiple assets or entry points for the same share token. This also enables Vaults which don&#x27;t have a true share token but rather convert between two arbitrary external tokens.&lt;&#x2F;p&gt;
&lt;p&gt;It adds a new &lt;code&gt;share&lt;&#x2F;code&gt; method to the Vault, to allow the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; dependency to be externalized.&lt;&#x2F;p&gt;
&lt;p&gt;It also adds Vault-to-Share lookup to the share token.&lt;&#x2F;p&gt;
&lt;p&gt;Lastly, it enforces &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; support for Vaults and the share token.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;One missing use case that is not supported by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4626&#x2F;&quot;&gt;ERC-4626&lt;&#x2F;a&gt; is Vaults which have multiple assets or entry points such as liquidity provider (LP) Tokens. These are generally unwieldy or non-compliant due to the requirement of ERC-4626 to itself be an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions:&lt;&#x2F;h3&gt;
&lt;p&gt;The existing definitions from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4626&#x2F;&quot;&gt;ERC-4626&lt;&#x2F;a&gt; apply. In addition, this spec defines:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Multi-Asset Vaults: A Vault which has multiple assets&#x2F;entry points. The Multi-Asset Vault refers to the group of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7575&#x2F;&quot;&gt;ERC-7575&lt;&#x2F;a&gt; contracts with the entry points for a specific asset, linked to one common &lt;code&gt;share&lt;&#x2F;code&gt; token.&lt;&#x2F;li&gt;
&lt;li&gt;Pipe: A converter from one token to another (unidirectional or bidirectional)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;methods&quot;&gt;Methods&lt;&#x2F;h3&gt;
&lt;p&gt;All &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7575&#x2F;&quot;&gt;ERC-7575&lt;&#x2F;a&gt; Vaults MUST implement &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4626&#x2F;&quot;&gt;ERC-4626&lt;&#x2F;a&gt; excluding the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; methods and events.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;share&quot;&gt;share&lt;&#x2F;h4&gt;
&lt;p&gt;The address of the underlying &lt;code&gt;share&lt;&#x2F;code&gt; received on deposit into the Vault. MUST return an address of an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; share representation of the Vault.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;share&lt;&#x2F;code&gt; MAY return the address of the Vault itself.&lt;&#x2F;p&gt;
&lt;p&gt;If the &lt;code&gt;share&lt;&#x2F;code&gt; returns an external token i.e. &lt;code&gt;share != address(this)&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;entry functions MUST increase the &lt;code&gt;share&lt;&#x2F;code&gt; balance of the &lt;code&gt;receiver&lt;&#x2F;code&gt; by the &lt;code&gt;shares&lt;&#x2F;code&gt; amount. i.e. &lt;code&gt;share.balanceOf(receiver) += shares&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;exit functions MUST decrease the &lt;code&gt;share&lt;&#x2F;code&gt; balance of the &lt;code&gt;owner&lt;&#x2F;code&gt; by the &lt;code&gt;shares&lt;&#x2F;code&gt; amount. i.e. &lt;code&gt;share.balanceOf(owner) -= shares&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;MUST &lt;em&gt;NOT&lt;&#x2F;em&gt; revert.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;hare&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;hareTokenAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;multi-asset-vaults&quot;&gt;Multi-Asset Vaults&lt;&#x2F;h3&gt;
&lt;p&gt;Multi-Asset Vaults share a single &lt;code&gt;share&lt;&#x2F;code&gt; token with multiple entry points denominated in different &lt;code&gt;asset&lt;&#x2F;code&gt; tokens.&lt;&#x2F;p&gt;
&lt;p&gt;Multi-Asset Vaults MUST implement the &lt;code&gt;share&lt;&#x2F;code&gt; method on each entry point. The entry points SHOULD NOT be &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;pipes&quot;&gt;Pipes&lt;&#x2F;h3&gt;
&lt;p&gt;Pipes convert between a single &lt;code&gt;asset&lt;&#x2F;code&gt; and &lt;code&gt;share&lt;&#x2F;code&gt; which are both &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens outside the Vault.&lt;&#x2F;p&gt;
&lt;p&gt;A Pipe MAY be either unidirectional or bidirectional.&lt;&#x2F;p&gt;
&lt;p&gt;A unidirectional Pipe SHOULD implement only the entry function(s) &lt;code&gt;deposit&lt;&#x2F;code&gt; and&#x2F;or &lt;code&gt;mint&lt;&#x2F;code&gt;, not &lt;code&gt;redeem&lt;&#x2F;code&gt; and&#x2F;or &lt;code&gt;withdraw&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The entry points SHOULD lock or burn the &lt;code&gt;asset&lt;&#x2F;code&gt; from the &lt;code&gt;msg.sender&lt;&#x2F;code&gt; and mint or transfer the &lt;code&gt;share&lt;&#x2F;code&gt; to the &lt;code&gt;receiver&lt;&#x2F;code&gt;. For bidirectional pipes, the exit points SHOULD lock or burn the &lt;code&gt;share&lt;&#x2F;code&gt; from the &lt;code&gt;owner&lt;&#x2F;code&gt; and mint or transfer the &lt;code&gt;asset&lt;&#x2F;code&gt; to the &lt;code&gt;receiver&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;share-to-vault-lookup&quot;&gt;Share-to-Vault lookup&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; implementation of &lt;code&gt;share&lt;&#x2F;code&gt; SHOULD implement a &lt;code&gt;vault&lt;&#x2F;code&gt; method, that returns the address of the Vault for a specific &lt;code&gt;asset&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;SHOULD emit the &lt;code&gt;VaultUpdate&lt;&#x2F;code&gt; event when a Vault linked to the share changes.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ault&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;sset&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ault&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;erc-165-support&quot;&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; support&lt;&#x2F;h3&gt;
&lt;p&gt;Vaults implementing &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7575&#x2F;&quot;&gt;ERC-7575&lt;&#x2F;a&gt; MUST implement the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; function. The Vault contract MUST return the constant value &lt;code&gt;true&lt;&#x2F;code&gt; if &lt;code&gt;0x2f0a18c5&lt;&#x2F;code&gt; is passed through the &lt;code&gt;interfaceID&lt;&#x2F;code&gt; argument.&lt;&#x2F;p&gt;
&lt;p&gt;The share contract SHOULD implement the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; function. The share token MUST return the constant value &lt;code&gt;true&lt;&#x2F;code&gt; if &lt;code&gt;0xf815c03d&lt;&#x2F;code&gt; is passed through the &lt;code&gt;interfaceID&lt;&#x2F;code&gt; argument.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;events&quot;&gt;Events&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;vaultupdate&quot;&gt;VaultUpdate&lt;&#x2F;h4&gt;
&lt;p&gt;The Vault linked to the share has been updated.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; V&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;aultUpdate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;vent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;sset&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ault&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is intentionally flexible to support both existing &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4626&#x2F;&quot;&gt;ERC-4626&lt;&#x2F;a&gt; Vaults easily by the introduction of a single new method, but also flexible to support new use cases by allowing separate share tokens.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;ability-to-externalize-erc-20-dependency&quot;&gt;Ability to externalize &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; Dependency&lt;&#x2F;h3&gt;
&lt;p&gt;By allowing &lt;code&gt;share != address(this)&lt;&#x2F;code&gt;, the Vault can have an external contract managing the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; functionality of the Share. In the case of Multi-Asset, this avoids the confusion that might arise if each Vault itself were required to be an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;, which could confuse integrators and front-ends.&lt;&#x2F;p&gt;
&lt;p&gt;This approach also enables the creation of new types of Vaults, such as Pipes, which facilitate the conversion between two external &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens. These Pipes could be unidirectional (i.e. only for assets to shares via deposit&#x2F;mint, or shares to assets via redeem&#x2F;withdraw) or bidirectional for both entry and exit flows.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;including-share-to-vault-lookup-optionally&quot;&gt;Including Share-to-Vault lookup optionally&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;vault&lt;&#x2F;code&gt; method is included to look up a Vault for a &lt;code&gt;share&lt;&#x2F;code&gt; by its &lt;code&gt;asset&lt;&#x2F;code&gt;, combined with the &lt;code&gt;VaultUpdate&lt;&#x2F;code&gt; event and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; support. This enables integrations to easily query Multi-Asset Vaults.&lt;&#x2F;p&gt;
&lt;p&gt;This is optional, to maintain backward compatibility with use cases where the &lt;code&gt;share&lt;&#x2F;code&gt; is an existing deployed contract.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7575&#x2F;&quot;&gt;ERC-7575&lt;&#x2F;a&gt; Vaults are not fully compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4626&#x2F;&quot;&gt;ERC-4626&lt;&#x2F;a&gt; because the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; functionality has been removed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This code snippet is incomplete pseudocode used for example only and is no way intended to be used in production or guaranteed to be secure&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Share&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC20&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        mapping&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; asset &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; vault&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; updateVault&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; asset&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; vault_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            vault&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;asset&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; vault_&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UpdateVault&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;asset&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; vault_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xf815c03d&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span&gt; interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x01ffc9a7&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TokenAVault&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC7575&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; share &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;Share&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; asset &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;TokenA&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC4626 implementation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x2f0a18c5&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span&gt; interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x01ffc9a7&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TokenBVault&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC7575&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; share &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;Share&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; asset &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;TokenB&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC4626 implementation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x2f0a18c5&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span&gt; interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x01ffc9a7&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; non-compliant Vaults must take care with supporting a redeem flow where &lt;code&gt;owner&lt;&#x2F;code&gt; is not &lt;code&gt;msg.sender&lt;&#x2F;code&gt;, since the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; approval flow does not by itself work if the Vault and share are separate contracts. It can work by setting up the Vault as a Trusted Forwarder of the share token, using &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2771&#x2F;&quot;&gt;ERC-2771&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Contract-level metadata via `contractURI()`</title>
        <published>2023-12-06T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Devin Finzer</name><uri>https://github.com/dfinzer</uri>
	</author>
	
	<author>
		<name>Alex Atallah</name><uri>https://github.com/alexanderatallah</uri>
	</author>
	
	<author>
		<name>Ryan Ghods</name><uri>https://github.com/ryanio</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7572/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-contract-level-metadata-via-contracturi/17157" />
        

        <id>https://wg-eips.ritovision.com/7572/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:7572"
            label="ERC-7572" />
        

        
        

        
        <summary type="html">Specifying and updating contract-level metadata</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7572/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This specification standardizes &lt;code&gt;contractURI()&lt;&#x2F;code&gt; to return contract-level metadata. This is useful for dapps and offchain indexers to show rich information about a contract, such as its name, description and image, without specifying it manually or individually for each dapp.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Dapps have included supported for &lt;code&gt;contractURI()&lt;&#x2F;code&gt; for years without an ERC to reference. This standard also introduces the event &lt;code&gt;ContractURIUpdated()&lt;&#x2F;code&gt; to signal when to update the metadata.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;The contract MUST implement the below interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7572&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; contractURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ContractURIUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The string returned from &lt;code&gt;contractURI()&lt;&#x2F;code&gt; MAY be an offchain resource or onchain JSON data string (&lt;code&gt;data:application&#x2F;json;utf8,{}&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;ContractURIUpdated()&lt;&#x2F;code&gt; event SHOULD be emitted on updates to the contract metadata for offchain indexers to query the contract.&lt;&#x2F;p&gt;
&lt;p&gt;If the underlying contract provides any methods that conflict with the &lt;code&gt;contractURI&lt;&#x2F;code&gt; schema such as &lt;code&gt;name()&lt;&#x2F;code&gt; or &lt;code&gt;symbol()&lt;&#x2F;code&gt;, the metadata returned by &lt;code&gt;contractURI()&lt;&#x2F;code&gt; is RECOMMENDED to take precedence. This enables contract creators to update their contract details with an event that notifies of the update.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;schema-for-contracturi&quot;&gt;Schema for contractURI&lt;&#x2F;h3&gt;
&lt;p&gt;The schema for the JSON returned from &lt;code&gt;contractURI()&lt;&#x2F;code&gt; MUST conform to:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;$schema&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;json-schema.org&#x2F;draft&#x2F;2020-12&#x2F;schema&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The name of the contract.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;symbol&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The symbol of the contract.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The description of the contract.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;image&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uri&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A URI pointing to a resource with mime type image&#x2F;* that represents the contract, typically displayed as a profile picture for the contract.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;banner_image&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uri&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A URI pointing to a resource with mime type image&#x2F;* that represents the contract, displayed as a banner image for the contract.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;featured_image&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uri&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A URI pointing to a resource with mime type image&#x2F;* that represents the featured image for the contract, typically used for a highlight section.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;external_link&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uri&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The external link of the contract.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;collaborators&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;array&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;items&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;An Ethereum address representing an authorized editor of the contract.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;An array of Ethereum addresses representing collaborators (authorized editors) of the contract.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;required&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Example:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Example Contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;symbol&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;EC&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Your description here&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;image&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ipfs:&#x2F;&#x2F;QmTNgv3jx2HHfBjQX9RnKtxj2xv2xQCtbDXoRi5rJ3a46e&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;banner_image&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ipfs:&#x2F;&#x2F;QmdChMVnMSq4U7oVKhud7wUSEZGnwuMuTY5rUQx57Ayp6H&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;featured_image&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ipfs:&#x2F;&#x2F;QmS9m6e1E1NfioMM8dy1WMZNN2FRh2WDjeqJFWextqXCT8&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;external_link&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;project-website.com&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;collaborators&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x388C818CA8B9251b393131C08a736A67ccB19297&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Future ERCs MAY inherit this one to add more properties to the schema for standardization.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The method name &lt;code&gt;contractURI()&lt;&#x2F;code&gt; was chosen based on its existing implementation in dapps. The event &lt;code&gt;ContractURIUpdated()&lt;&#x2F;code&gt; is specified to help offchain indexers to know when to refetch the metadata.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;As a new ERC, no backwards compatibility issues are present.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MyCollectible&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERCXXXX&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span&gt; _contractURI &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ipfs:&#x2F;&#x2F;QmTNgv3jx2HHfBjQX9RnKtxj2xv2xQDtbVXoRi5rJ3a46e&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; or e.g. &amp;quot;https:&#x2F;&#x2F;external-link-url.com&#x2F;my-contract-metadata.json&amp;quot;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; contractURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _contractURI&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; or e.g. for onchain:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; json &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;#39;{&amp;quot;name&amp;quot;: &amp;quot;Creatures&amp;quot;,&amp;quot;description&amp;quot;:&amp;quot;...&amp;quot;}&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;concat&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;data:application&#x2F;json;utf8,&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; json&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Suggested setter, not explicitly specified as part of this ERC&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setContractURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newURI&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _contractURI &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; newURI&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ContractURIUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Addresses specified as &lt;code&gt;collaborators&lt;&#x2F;code&gt; should be expected to receive admin-level functionality for updating contract information on dapps that implement this standard.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Conditional-upon-Transfer-Decryption for DvP</title>
        <published>2023-12-05T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Christian Fries</name><uri>https://github.com/cfries</uri>
	</author>
	
	<author>
		<name>Peter Kohl-Landgraf</name><uri>https://github.com/pekola</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7573/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7573-conditional-upon-transfer-decryption-for-delivery-versus-payment/17232" />
        

        <id>https://wg-eips.ritovision.com/7573/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:7573"
            label="ERC-7573" />
        

        
        

        
        <summary type="html">A Protocol for Secure Delivery-versus-Payment across two Blockchains</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7573/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The interfaces in this proposal model a functional transaction scheme to establish a secure &lt;em&gt;delivery-versus-payment&lt;&#x2F;em&gt;
across two blockchains, where a) no intermediary is required and b) one of the two chains
can securely interact with a stateless &quot;decryption oracle&quot;. Here, &lt;em&gt;delivery-versus-payment&lt;&#x2F;em&gt; refers to the exchange of,
e.g., an asset against a payment; however, the concept is generic to make a transfer of one token on one
chain (e.g., the payment) conditional to the successful transfer of another token on another chain (e.g., the asset).&lt;&#x2F;p&gt;
&lt;p&gt;The scheme is realized by two smart contracts, one on each chain.
One smart contract implements the &lt;code&gt;ILockingContract&lt;&#x2F;code&gt; interface on one chain (e.g. the &quot;asset chain&quot;), and another smart contract implements the &lt;code&gt;IDecryptionContract&lt;&#x2F;code&gt; interface on the other chain (e.g., the &quot;payment chain&quot;).
The smart contract implementing &lt;code&gt;ILockingContract&lt;&#x2F;code&gt; locks a token (e.g., the asset) on its chain until a key is presented to encrypt to one of two given values.
The smart contract implementing &lt;code&gt;IDecryptionContract&lt;&#x2F;code&gt;, decrypts one of two keys (via the decryption oracle) conditional to the success or failure of the token transfer (e.g., the payment). A stateless decryption oracle is attached to the chain running &lt;code&gt;IDecryptionContract&lt;&#x2F;code&gt; for the decryption.&lt;&#x2F;p&gt;
&lt;p&gt;In addition, there are two interfaces that standardize the communication with external decryption oracle(s):&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;IKeyDecryptionOracle.sol&lt;&#x2F;code&gt; is implemented by a decryption oracle proxy contract (on-chain router&#x2F;proxy for an off-chain oracle).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;IKeyDecryptionOracleCallback.sol&lt;&#x2F;code&gt; is implemented by a callback receiving the decrypted key (or derived verification material).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Fulfillment semantics note:&lt;&#x2F;strong&gt; The oracle proxy may implement either
(i) &lt;strong&gt;strict fulfillment&lt;&#x2F;strong&gt; (reverting &lt;code&gt;fulfill*&lt;&#x2F;code&gt; when the callback fails) or
(ii) &lt;strong&gt;best-effort fulfillment&lt;&#x2F;strong&gt; (not reverting &lt;code&gt;fulfill*&lt;&#x2F;code&gt; on callback failure, but signaling failure via events).
This proposal describes both modes and their operational trade-offs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Within the domain of financial transactions and distributed ledger technology (DLT), the Hash-Linked Contract (HLC) concept has been recognized as valuable and has been thoroughly investigated.
The concept may help to solve the challenge of delivery-versus-payment (DvP), especially in cases where the asset chain and payment system (which may be a chain, too) are separated.
A prominent application of smart contracts realizing a secure DvP is that of buying an asset, where the asset is managed on one chain (the asset chain), but the payments are executed on another chain (the payment chain).
Proposed solutions are based on an API-based interaction mechanism which bridges the communication between a so-called asset chain and a corresponding
payment system or requires complex and problematic time locks.&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-1-1&quot;&gt;&lt;a href=&quot;#fn-1&quot;&gt;1&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Here, we propose a protocol that facilitates secure delivery-versus-payment with less overhead, especially with a stateless oracle.[^2]&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;methods&quot;&gt;Methods&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;smart-contract-on-the-chain-that-performs-the-locking-e-g-the-asset-chain&quot;&gt;Smart Contract on the chain that performs the locking (e.g. the asset chain)&lt;&#x2F;h4&gt;
&lt;p&gt;The following methods specify the functionality of the smart contract implementing
the locking. For further information, please also look at the interface
documentation &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7573&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;ILockingContract.sol&quot;&gt;&lt;code&gt;ILockingContract.sol&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;initiation-of-transfer-incepttransfer&quot;&gt;Initiation of Transfer: &lt;code&gt;inceptTransfer&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; inceptTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; keyHashedSeller&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; keyEncryptedSeller&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Called from the buyer of the token to initiate token transfer. Emits a &lt;code&gt;TransferIncepted&lt;&#x2F;code&gt; event.
The parameter &lt;code&gt;id&lt;&#x2F;code&gt; is an identifier of the trade. The parameter &lt;code&gt;from&lt;&#x2F;code&gt; is the address of the seller (the address of the buyer is &lt;code&gt;msg.sender&lt;&#x2F;code&gt;).
The parameter &lt;code&gt;keyHashedSeller&lt;&#x2F;code&gt; is a hash of the key that can be used by the seller to (re-)claim the token.
The parameter &lt;code&gt;keyEncryptedSeller&lt;&#x2F;code&gt; is an encryption of the key that can be used by the buyer to claim the token.
It is possible to implement the protocol in a way where the hashing method agrees with the  encryption method. See below on &quot;encryption&quot;.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;initiation-of-transfer-confirmtransfer&quot;&gt;Initiation of Transfer: &lt;code&gt;confirmTransfer&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; confirmTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; keyHashedBuyer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; keyEncryptedBuyer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Called from the seller of the token to confirm token transfer. Emits a &lt;code&gt;TransferConfirmed&lt;&#x2F;code&gt; event.
The parameter &lt;code&gt;id&lt;&#x2F;code&gt; is an identifier of the trade. The parameter &lt;code&gt;to&lt;&#x2F;code&gt; is the address of the buyer (the address of the seller is &lt;code&gt;msg.sender&lt;&#x2F;code&gt;).
The parameter &lt;code&gt;keyHashedBuyer&lt;&#x2F;code&gt; is a hash of the key that can be used by the buyer to (re-)claim the token.
The parameter &lt;code&gt;keyEncryptedBuyer&lt;&#x2F;code&gt; is an encryption of the key that can be used by the buyer to (re-)claim the token.
It is possibly to implement the protocol in a way where the hashing method agrees with the  encryption method. See below on &quot;encryption&quot;.&lt;&#x2F;p&gt;
&lt;p&gt;If the trade specification, that is, the quadruple (&lt;code&gt;id&lt;&#x2F;code&gt;, &lt;code&gt;amount&lt;&#x2F;code&gt;, &lt;code&gt;from&lt;&#x2F;code&gt;, &lt;code&gt;to&lt;&#x2F;code&gt;), in a call to &lt;code&gt;confirmTransfer&lt;&#x2F;code&gt;
matches that of a previous call to &lt;code&gt;inceptTransfer&lt;&#x2F;code&gt;, and the balance is sufficient, the corresponding &lt;code&gt;amount&lt;&#x2F;code&gt;
of tokens is locked (transferred from &lt;code&gt;from&lt;&#x2F;code&gt; to the smart contract) and &lt;code&gt;TransferConfirmed&lt;&#x2F;code&gt; is emitted.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;transfer-transferwithkey&quot;&gt;Transfer: &lt;code&gt;transferWithKey&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferWithKey&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Called from either the buyer or the seller of the token
of the trade with id &lt;code&gt;id&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;If the method is called from the buyer (&lt;code&gt;to&lt;&#x2F;code&gt;) &lt;em&gt;and&lt;&#x2F;em&gt; the hashing of &lt;code&gt;key&lt;&#x2F;code&gt; matches &lt;code&gt;keyHashedBuyer&lt;&#x2F;code&gt;,
then the locked tokens are transferred to the buyer (&lt;code&gt;to&lt;&#x2F;code&gt;). This emits &lt;code&gt;TokenClaimed&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;If the method is called from the seller (&lt;code&gt;from&lt;&#x2F;code&gt;) &lt;em&gt;and&lt;&#x2F;em&gt; the hashing of &lt;code&gt;key&lt;&#x2F;code&gt; matches &lt;code&gt;keyHashedSeller&lt;&#x2F;code&gt;,
then the locked tokens are transferred (back) to the seller (&lt;code&gt;to&lt;&#x2F;code&gt;). This emits &lt;code&gt;TokenReclaimed&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;summary&quot;&gt;Summary&lt;&#x2F;h5&gt;
&lt;p&gt;The interface &lt;code&gt;ILockingContract&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ILockingContract&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransferIncepted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; keyHashedSeller&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; keyEncryptedSeller&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransferConfirmed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; keyHashedBuyer&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; keyEncryptedBuyer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TokenClaimed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TokenReclaimed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; inceptTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; keyHashedSeller&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; keyEncryptedSeller&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; confirmTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; keyHashedBuyer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; keyEncryptedBuyer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferWithKey&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;smart-contract-on-the-other-chain-that-performs-the-conditional-decryption-e-g-the-payment-chain&quot;&gt;Smart Contract on the other chain that performs the conditional decryption (e.g. the payment chain)&lt;&#x2F;h4&gt;
&lt;p&gt;The following methods specify the functionality of the smart contract implementing
the conditional decryption. For further information, please also look at the interface
documentation &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7573&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;IDecryptionContract.sol&quot;&gt;&lt;code&gt;IDecryptionContract.sol&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;initiation-of-transfer-incepttransfer-1&quot;&gt;Initiation of Transfer: &lt;code&gt;inceptTransfer&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; inceptTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; keyEncryptedSuccess&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; keyEncryptedFailure&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Called from the receiver of the amount to initiate payment transfer. Emits a &lt;code&gt;TransferIncepted&lt;&#x2F;code&gt;.
The parameter &lt;code&gt;id&lt;&#x2F;code&gt; is an identifier of the trade. The parameter &lt;code&gt;from&lt;&#x2F;code&gt; is the address of the sender of the payment (the address of the receiver is &lt;code&gt;msg.sender&lt;&#x2F;code&gt;).
The parameter &lt;code&gt;keyEncryptedSuccess&lt;&#x2F;code&gt; is an encryption of a key and will be decrypted if the transfer is successful in a call to &lt;code&gt;transferAndDecrypt&lt;&#x2F;code&gt;.
The parameter &lt;code&gt;keyEncryptedFailure&lt;&#x2F;code&gt; is an encryption of a key and will be decrypted if the transfer fails in a call to &lt;code&gt;transferAndDecrypt&lt;&#x2F;code&gt; or if &lt;code&gt;cancelAndDecrypt&lt;&#x2F;code&gt; is successful.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;transfer-transferanddecrypt&quot;&gt;Transfer: &lt;code&gt;transferAndDecrypt&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferAndDecrypt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; keyEncryptedSuccess&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; keyEncryptedFailure&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Called from the sender of the amount to initiate completion of the payment transfer. Emits a &lt;code&gt;TransferKeyRequested&lt;&#x2F;code&gt; with keys depending on completion success.
The parameter &lt;code&gt;id&lt;&#x2F;code&gt; is an identifier of the trade. The parameter &lt;code&gt;to&lt;&#x2F;code&gt; is the address of the receiver of the payment (the sender of the payment (from) is implicitly the &lt;code&gt;msg.sender&lt;&#x2F;code&gt;).
The parameter &lt;code&gt;keyEncryptedSuccess&lt;&#x2F;code&gt; is an encryption of the key and will be decrypted if the transfer is successful.
The parameter &lt;code&gt;keyEncryptedFailure&lt;&#x2F;code&gt; is an encryption of the key and will be decrypted if the transfer fails.&lt;&#x2F;p&gt;
&lt;p&gt;The method will not decrypt any key and not perform a transfer of a payment if the values (&lt;code&gt;id&lt;&#x2F;code&gt;, &lt;code&gt;amount&lt;&#x2F;code&gt;, &lt;code&gt;from&lt;&#x2F;code&gt; &lt;code&gt;to&lt;&#x2F;code&gt;, &lt;code&gt;keyEncryptedSuccess&lt;&#x2F;code&gt;, &lt;code&gt;keyEncryptedFailure&lt;&#x2F;code&gt;)
do not match a previous call to &lt;code&gt;inceptTransfer&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;cancelation-of-transfer-cancelanddecrypt&quot;&gt;Cancelation of Transfer: &lt;code&gt;cancelAndDecrypt&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; cancelAndDecrypt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; keyEncryptedSuccess&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; keyEncryptedFailure&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Called from the receiver of the amount to cancel payment transfer (cancels the incept transfer).&lt;&#x2F;p&gt;
&lt;p&gt;The method must be called from the caller of a previous call to &lt;code&gt;inceptTransfer&lt;&#x2F;code&gt;
with the exact same arguments and cancels this specific transfer.
If these preconditions are met and a valid call to &lt;code&gt;transferAndDecrypt&lt;&#x2F;code&gt; has not been issued before,
i.e. if &lt;code&gt;keyEncryptedSuccess&lt;&#x2F;code&gt; has not been issued in a &lt;code&gt;TransferKeyRequested&lt;&#x2F;code&gt; event,
then this method emits a &lt;code&gt;TransferKeyRequested&lt;&#x2F;code&gt; with the key &lt;code&gt;keyEncryptedFailure&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;release-of-ilockingcontract-access-key-releasekey&quot;&gt;Release of ILockingContract Access Key: &lt;code&gt;releaseKey&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; releaseKey&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Called from the (possibly external) decryption oracle.&lt;&#x2F;p&gt;
&lt;p&gt;Emits the event &lt;code&gt;TransferKeyReleased&lt;&#x2F;code&gt; with the value of &lt;code&gt;key&lt;&#x2F;code&gt; if the call was eligible.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;summary-1&quot;&gt;Summary&lt;&#x2F;h5&gt;
&lt;p&gt;The interface &lt;code&gt;IDecryptionContract&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IDecryptionContract&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransferIncepted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; keyEncryptedSuccess&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; keyEncryptedFailure&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransferKeyRequested&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; encryptedKey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransferKeyReleased&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; inceptTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; keyEncryptedSuccess&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; keyEncryptedFailure&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferAndDecrypt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; keyEncryptedSuccess&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; keyEncryptedFailure&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; cancelAndDecrypt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; keyEncryptedSuccess&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; keyEncryptedFailure&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; releaseKey&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;interfaces-to-external-decryption-oracles-oracle-proxy-callback&quot;&gt;Interfaces to External Decryption Oracles (Oracle Proxy + Callback)&lt;&#x2F;h3&gt;
&lt;p&gt;This proposal additionally standardizes the on-chain interaction with external (off-chain) decryption oracles via:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;IKeyDecryptionOracle&lt;&#x2F;code&gt; (oracle proxy &#x2F; router)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;IKeyDecryptionOracleCallback&lt;&#x2F;code&gt; (consumer callback)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The general flow is:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The consumer calls &lt;code&gt;request*&lt;&#x2F;code&gt; on the oracle proxy contract (payable).&lt;&#x2F;li&gt;
&lt;li&gt;The oracle proxy emits a request event containing a &lt;code&gt;requestId&lt;&#x2F;code&gt; (correlation id).&lt;&#x2F;li&gt;
&lt;li&gt;The off-chain oracle observes the request event, performs decryption or verification off-chain, and calls &lt;code&gt;fulfill*&lt;&#x2F;code&gt; on the proxy.&lt;&#x2F;li&gt;
&lt;li&gt;The oracle proxy calls the consumer callback &lt;code&gt;on*&lt;&#x2F;code&gt; with the fulfillment payload.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h4 id=&quot;callback-execution-semantics-strict-vs-best-effort&quot;&gt;Callback execution semantics: strict vs best-effort&lt;&#x2F;h4&gt;
&lt;p&gt;Implementations MAY choose one of the following fulfillment semantics. Both are compatible with this proposal.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;strict-fulfillment-reverting&quot;&gt;Strict fulfillment (reverting)&lt;&#x2F;h5&gt;
&lt;p&gt;In &lt;strong&gt;strict fulfillment&lt;&#x2F;strong&gt;, the proxy MUST revert &lt;code&gt;fulfill*&lt;&#x2F;code&gt; if the callback call fails (including OOG).&lt;&#x2F;p&gt;
&lt;p&gt;Properties:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The off-chain oracle operator can treat &lt;code&gt;receipt.status == 1&lt;&#x2F;code&gt; as “callback succeeded”.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;receipt.status == 0&lt;&#x2F;code&gt;, the request is not fulfilled and can be retried (e.g., with higher tx gas limit).&lt;&#x2F;li&gt;
&lt;li&gt;The proxy MUST ensure that request state is not lost on revert (e.g., by relying on revert rollback of state changes).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This mode is operationally simple for closed deployments where the off-chain oracle and the consumer are coordinated and where failure handling&#x2F;retries are primarily managed by the oracle operator.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;best-effort-fulfillment-non-reverting&quot;&gt;Best-effort fulfillment (non-reverting)&lt;&#x2F;h5&gt;
&lt;p&gt;In &lt;strong&gt;best-effort fulfillment&lt;&#x2F;strong&gt;, the proxy MUST NOT revert &lt;code&gt;fulfill*&lt;&#x2F;code&gt; solely because the callback call fails (including OOG). Instead, it SHOULD signal callback outcome via events (e.g. &lt;code&gt;CallbackSucceeded&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;CallbackFailed&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;Properties:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The off-chain oracle operator MUST NOT interpret &lt;code&gt;receipt.status == 1&lt;&#x2F;code&gt; as “callback succeeded”; it must also evaluate the emitted outcome signal.&lt;&#x2F;li&gt;
&lt;li&gt;Failure handling can be shifted to the callback implementer&#x2F;operator: a consumer can run an off-chain watcher that subscribes to &lt;code&gt;CallbackFailed&lt;&#x2F;code&gt; and reacts accordingly (e.g. pull&#x2F;consume flow, re-request, alerting).&lt;&#x2F;li&gt;
&lt;li&gt;The proxy may either keep the request pending for retries or consume it and shift retry responsibility to the consumer. The chosen policy SHOULD be documented by the implementation.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This mode is useful when the proxy wants to provide an on-chain observable audit trail for callback failures and to decouple “oracle fulfillment” from “consumer processing”.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;gas-budgeting-and-forwarding&quot;&gt;Gas budgeting and forwarding&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;The off-chain oracle controls the total cost of &lt;code&gt;fulfill*&lt;&#x2F;code&gt; by setting the transaction gas limit.&lt;&#x2F;li&gt;
&lt;li&gt;The proxy MAY cap or budget the gas forwarded to the callback (e.g., by forwarding “all but a reserve”).&lt;&#x2F;li&gt;
&lt;li&gt;Keeping a small gas reserve in the proxy can help ensure the proxy can finalize &lt;code&gt;fulfill*&lt;&#x2F;code&gt; and emit outcome events even if the callback consumes most forwarded gas.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;calldata-fallback-retrieving-fulfillment-payload-without-logging&quot;&gt;Calldata fallback (retrieving fulfillment payload without logging)&lt;&#x2F;h4&gt;
&lt;p&gt;In either strict or best-effort mode, the &lt;code&gt;fulfill*&lt;&#x2F;code&gt; payload is present in the transaction input calldata of the &lt;code&gt;fulfill*&lt;&#x2F;code&gt; call.&lt;&#x2F;p&gt;
&lt;p&gt;Implementations SHOULD document the following operational fallback:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Off-chain systems that observe an event (e.g., &lt;code&gt;CallbackFailed&lt;&#x2F;code&gt;) can use the event’s &lt;code&gt;transactionHash&lt;&#x2F;code&gt; to fetch the corresponding transaction and decode the input calldata using the &lt;code&gt;IKeyDecryptionOracle&lt;&#x2F;code&gt; ABI to recover the fulfillment arguments.&lt;&#x2F;li&gt;
&lt;li&gt;Practical caveat: Some RPC providers prune old transaction bodies; indexers SHOULD persist decoded fulfillment payload off-chain if long-term retention is required.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This fallback can be used to support consumer-side “pull&#x2F;consume” flows, or as a recovery mechanism when callback execution fails.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;encryption-and-decryption&quot;&gt;Encryption and Decryption&lt;&#x2F;h3&gt;
&lt;p&gt;The linkage of the two smart contracts relies on use of a &lt;code&gt;key&lt;&#x2F;code&gt;, &lt;code&gt;encryptedKey&lt;&#x2F;code&gt; and &lt;code&gt;hashedKey&lt;&#x2F;code&gt;.
The implementation is free to support several encryption methods for
as long as the decryption oracle supports it.&lt;&#x2F;p&gt;
&lt;p&gt;The encryption is performed with the public key of  the decryption oracle.
Either the encryption oracle offers a method performing encryption, in which
case the encryption method isn&#x27;t even required to be known, or both parties
know the public key of the decryption oracle and can perform the generation
of the key and its encryption.&lt;&#x2F;p&gt;
&lt;p&gt;It is implicitly assumed that the two parties may check that
the strings &lt;code&gt;keyEncryptedBuyer&lt;&#x2F;code&gt; and &lt;code&gt;keyEncryptedSeller&lt;&#x2F;code&gt; are
in a valid format.&lt;&#x2F;p&gt;
&lt;p&gt;To avoid on-chain encryption in the &lt;code&gt;ILockingContract&lt;&#x2F;code&gt;, it is possible to use a
simpler hashing algorithm  on the &lt;code&gt;ILockingContract&lt;&#x2F;code&gt;. In that case, the decryption oracle has
to provide a method that allows to obtain the hash &lt;em&gt;H(K)&lt;&#x2F;em&gt; (&lt;code&gt;keyHashed&lt;&#x2F;code&gt;) for an
encrypted key &lt;em&gt;E(K)&lt;&#x2F;em&gt; (&lt;code&gt;keyEncrypted&lt;&#x2F;code&gt;) without exposing the key &lt;em&gt;K&lt;&#x2F;em&gt; (`&lt;code&gt;key\&lt;&#x2F;code&gt;), cf. [^2].&lt;&#x2F;p&gt;
&lt;h3 id=&quot;sequence-diagram-of-delivery-versus-payment&quot;&gt;Sequence diagram of delivery versus payment&lt;&#x2F;h3&gt;
&lt;p&gt;The interplay of the two smart contracts is summarized
in the following sequence diagram:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7573&#x2F;.&#x2F;assets&#x2F;doc&#x2F;DvP-Seq-Diag.png&quot; alt=&quot;sequence diagram dvp&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The protocol tries to be parsimonious. The transfer
is associated with a (preferably unique) &lt;code&gt;id&lt;&#x2F;code&gt; possibly
generated by some additional interaction of the trading
parties.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;key&lt;&#x2F;code&gt; and the &lt;code&gt;encryptedKey&lt;&#x2F;code&gt; arguments are strings to
allow the flexible use of different encryption schemes.
The decryption&#x2F;encryption scheme should be inferable from the contents
of the &lt;code&gt;encryptedKey&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;ensuring-secure-key-decryption-key-format&quot;&gt;Ensuring Secure Key Decryption - Key Format&lt;&#x2F;h3&gt;
&lt;p&gt;It has to be ensured that the decryption oracle decrypts a key only for the eligible contract.&lt;&#x2F;p&gt;
&lt;p&gt;It seems as if this would require us to introduce a concept of eligibility to the description oracle, which would imply a kind of state.&lt;&#x2F;p&gt;
&lt;p&gt;A fully stateless decryption can be realized by introducing a document format for the key and a corresponding eligibility verification protocol. We propose the following elements:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The (unencrypted) key documents contain the address of the payment contract implementing &lt;code&gt;IDecryptionContract&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The decryption oracle offers a stateless function &lt;code&gt;verify&lt;&#x2F;code&gt; that receives an encrypted key and returns the callback address (that will be used for the &lt;code&gt;releaseKey&lt;&#x2F;code&gt; call) that is stored inside the decrypted key without returning the decrypted key.&lt;&#x2F;li&gt;
&lt;li&gt;When an encrypted key is presented to the decryption oracle, the oracle decrypts the document and passes the decrypted key to &lt;code&gt;releaseKey&lt;&#x2F;code&gt; of the callback contract address found within the document decrypted key.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;We propose the following XML schema for the document of the decrypted key:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;xml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;xml&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; version&lt;&#x2F;span&gt;&lt;span&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; encoding&lt;&#x2F;span&gt;&lt;span&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;utf-8&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;?&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;xs&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;schema&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; attributeFormDefault&lt;&#x2F;span&gt;&lt;span&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unqualified&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; elementFormDefault&lt;&#x2F;span&gt;&lt;span&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;qualified&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; targetNamespace&lt;&#x2F;span&gt;&lt;span&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;http:&#x2F;&#x2F;finnmath.net&#x2F;erc&#x2F;ILockingContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; xmlns&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;xs&lt;&#x2F;span&gt;&lt;span&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;http:&#x2F;&#x2F;www.w3.org&#x2F;2001&#x2F;XMLSchema&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;xs&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;element&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;releaseKey&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;xs&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;complexType&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;xs&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;simpleContent&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;xs&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;extension&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; base&lt;&#x2F;span&gt;&lt;span&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;xs:string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;xs&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;attribute&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;xs:string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; use&lt;&#x2F;span&gt;&lt;span&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;required&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; &#x2F;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;xs&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;attribute&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;transaction&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;xs:unsignedShort&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; use&lt;&#x2F;span&gt;&lt;span&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;required&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; &#x2F;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;xs&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;extension&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;xs&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;simpleContent&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;xs&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;complexType&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;xs&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;element&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;xs&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;schema&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;A corresponding XML sample is shown below.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;xml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;xml&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; version&lt;&#x2F;span&gt;&lt;span&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; encoding&lt;&#x2F;span&gt;&lt;span&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;UTF-8&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; standalone&lt;&#x2F;span&gt;&lt;span&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;yes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;?&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;releaseKey&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eip155:1:0x1234567890abcdef1234567890abcdef12345678&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;3141&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; xmlns&lt;&#x2F;span&gt;&lt;span&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;http:&#x2F;&#x2F;finnmath.net&#x2F;erc&#x2F;ILockingContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &amp;lt;!--&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; random data &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;--&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    zZsnePj9ZLPkelpSKUUcg93VGNOPC2oBwX1oCcVwa+U=&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;releaseKey&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;multi-party-delivery-versus-payment&quot;&gt;Multi-Party Delivery versus Payment&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;locking-is-a-feature&quot;&gt;Locking is a Feature&lt;&#x2F;h4&gt;
&lt;p&gt;In Delivery-versus-Payment (DvP) protocols like &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7573&#x2F;&quot;&gt;ERC-7573&lt;&#x2F;a&gt;, at least one token must be locked to ensure atomicity, even if only for a short period during the transaction.&lt;&#x2F;p&gt;
&lt;p&gt;While locking may appear as an inconvenient necessity, it is in fact a feature that becomes valuable in the construction of conditional trades or multi-party DvPs.&lt;&#x2F;p&gt;
&lt;p&gt;If &lt;em&gt;n&lt;&#x2F;em&gt; parties wish to perform bilateral transactions atomically, there are &lt;em&gt;at least&lt;&#x2F;em&gt; &lt;em&gt;m := 2 • (n - 1)&lt;&#x2F;em&gt; transactions, of which &lt;em&gt;m-1&lt;&#x2F;em&gt; require locking. The last one can operate directly, and its success or failure decides whether the other locks are released or reverted.&lt;&#x2F;p&gt;
&lt;p&gt;A multi-party delivery versus payment is a valuable trade feature. Consider, for example, the case where counterparty A wishes to buy a token &lt;em&gt;Y&lt;&#x2F;em&gt; (e.g., a bond) from counterparty C, but in order to fund this transaction, counterparty A wishes to sell a token &lt;em&gt;X&lt;&#x2F;em&gt; (e.g., another bond) to counterparty B. However, A does not want to sell bond &lt;em&gt;X&lt;&#x2F;em&gt; if the purchase of &lt;em&gt;Y&lt;&#x2F;em&gt; fails. A multi-party DvP allows these two transactions to be bound into a single atomic unit.&lt;&#x2F;p&gt;
&lt;p&gt;While for a two-party DvP with two tokens only one token requires locking—and hence a DvP can be constructed without locking on the cash chain—a three-party DvP with three tokens in general requires the ability to lock all three tokens.&lt;&#x2F;p&gt;
&lt;p&gt;This highlights that locking is not just a constraint, but a required feature to enable advanced and economically meaningful protocols.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;n-dvp-with-erc-7573&quot;&gt;N-DvP with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7573&#x2F;&quot;&gt;ERC-7573&lt;&#x2F;a&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;A multi-party DvP can be created elegantly by combining multiple (&lt;em&gt;n-1&lt;&#x2F;em&gt;) two-party DvPs, for example based on the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7573&#x2F;&quot;&gt;ERC-7573&lt;&#x2F;a&gt; protocol.&lt;&#x2F;p&gt;
&lt;p&gt;The procedure is simple: instead of finalizing the respective two-party DvP by a call to &lt;code&gt;transferAndDecrypt&lt;&#x2F;code&gt;, the two-party DvP is first confirmed with a call to &lt;code&gt;confirm&lt;&#x2F;code&gt;, leaving the finalization open.&lt;&#x2F;p&gt;
&lt;p&gt;At any time, any party can call &lt;code&gt;cancelAndDecrypt&lt;&#x2F;code&gt; to release the failure key and revert all lockings.&lt;&#x2F;p&gt;
&lt;p&gt;Once all parties are linked with their respective two-party DvPs, a single call to &lt;code&gt;transferAndDecrypt&lt;&#x2F;code&gt; performs locking of the token implementing the &lt;code&gt;IDecryptionContract&lt;&#x2F;code&gt; and releases either the success key on success or the failure key on failure.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;initiation-and-finalization&quot;&gt;Initiation and Finalization&lt;&#x2F;h5&gt;
&lt;p&gt;The counterparty that initiates the multi-party DvP by making the first call
to the &lt;code&gt;IDecryptionContract&lt;&#x2F;code&gt; is the one that is allowed to finalize it via &lt;code&gt;transferAndDecrypt&lt;&#x2F;code&gt;, the other may cancel via &lt;code&gt;cancelAndDecrypt&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;sequence-diagram&quot;&gt;Sequence Diagram&lt;&#x2F;h5&gt;
&lt;p&gt;Below we depict the corresponding sequence diagram of a multi-party DvP via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7573&#x2F;&quot;&gt;ERC-7573&lt;&#x2F;a&gt;.
Note that the individual DvP may come in two different flavors depending on which counterparty is the receiver of the token on the &lt;code&gt;IDecryptionContract&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The diagram depicts a multi-party dvp with n+1 counterparties trading n+1 tokens out of which
the DvPs are bound by the contract on token 0.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7573&#x2F;.&#x2F;assets&#x2F;doc&#x2F;multi-party-dvp.svg&quot; alt=&quot;sequence diagram multi party dvp&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Note: The more general case of N counterparties trading
M tokens is just a special case where we enumerate all combination as new counterparties and new tokens.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The decryption oracle does not need to be a single trusted entity. Instead, a threshold decryption scheme can be employed, where multiple oracles perform partial decryption, requiring a quorum of them to reconstruct the secret key. This enhances security by mitigating the risk associated with a single point of failure or trust.&lt;&#x2F;p&gt;
&lt;p&gt;In such cases, each participating decryption oracle will observe the decryption request from an emitted &lt;code&gt;TransferKeyRequested&lt;&#x2F;code&gt; event, and subsequently call the &lt;code&gt;releaseKey&lt;&#x2F;code&gt; method with a partial decryption result. The following sequence diagram illustrates this.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7573&#x2F;.&#x2F;assets&#x2F;doc&#x2F;Distributed-Oracle.png&quot; alt=&quot;sequence diagram distributed oracle&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;See [^2] for details.&lt;&#x2F;p&gt;
&lt;p&gt;Additional considerations for the oracle proxy + callback pattern:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Callback implementations SHOULD restrict callers (e.g. &lt;code&gt;require(msg.sender == oracleProxy)&lt;&#x2F;code&gt;), otherwise any address could invoke &lt;code&gt;on*&lt;&#x2F;code&gt; directly.&lt;&#x2F;li&gt;
&lt;li&gt;Callback implementations SHOULD be cheap and should avoid unbounded loops or expensive state changes. If heavy work is required, prefer a pull&#x2F;consume pattern initiated by the consumer.&lt;&#x2F;li&gt;
&lt;li&gt;Oracle proxy implementations SHOULD document whether they use strict or best-effort fulfillment semantics, and how retries are intended to be handled (oracle-operated retry vs consumer-operated recovery).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;section class=&quot;footnotes&quot;&gt;
&lt;ol class=&quot;footnotes-list&quot;&gt;
&lt;li id=&quot;fn-1&quot;&gt;
&lt;p&gt;La Rocca, R., Mancini, R., Benedetti, M., Caruso, M., Cossu, S., Galano, G., Mancini, S., Marcelli, G., Martella, P., Nardelli, M., &amp;amp; Oliviero, C. (n.d.). &lt;span style=&quot;font-style: italic;&quot;&gt;Integrating DLTs with Market Infrastructures: Analysis and Proof-of-Concept for Secure DvP between TIPS and DLT Platforms&lt;&#x2F;span&gt;. https:&#x2F;&#x2F;doi.org&#x2F;&lt;a href=&quot;https:&#x2F;&#x2F;doi.org&#x2F;10.2139&#x2F;ssrn.4386904&quot;&gt;10.2139&#x2F;ssrn.4386904&lt;&#x2F;a&gt; (Original work published 2022)[^2]: Fries, C., &amp;amp; Kohl-Landgraf, P. (n.d.). &lt;span style=&quot;font-style: italic;&quot;&gt;A Proposal for a Lean and Functional Delivery versus Payment across two Blockchains&lt;&#x2F;span&gt;. https:&#x2F;&#x2F;doi.org&#x2F;&lt;a href=&quot;https:&#x2F;&#x2F;doi.org&#x2F;10.2139&#x2F;ssrn.4628811&quot;&gt;10.2139&#x2F;ssrn.4628811&lt;&#x2F;a&gt; (Original work published 2023) &lt;a href=&quot;#fr-1-1&quot;&gt;↩&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;section&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Multiplayer Game Communication</title>
        <published>2023-11-28T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Rickey</name><uri>https://github.com/HelloRickey</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7566/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-proposal-multiplayer-onchain-game/16796" />
        

        <id>https://wg-eips.ritovision.com/7566/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:7566"
            label="ERC-7566" />
        

        
        

        
        <summary type="html">A communication channel that facilitates interaction between players in on-chain games.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7566/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal introduces a multiplayer game communication (MGC) interface, using &lt;code&gt;room&lt;&#x2F;code&gt; to match and group players, and using &lt;code&gt;message&lt;&#x2F;code&gt; to process actions between players. This allows one smart contract to handle multiple players playing games on the chain, preventing centralized servers from affecting the fairness of the game.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Common multiplayer games are generally played on centralized servers. Players have no way of knowing whether there are forged data and cheating on the server. The owner of the game server can match players at will, modify scores and levels, and even close and pause the game. If the player&#x27;s actions all occur on the chain, every message from the chain is proof of the player&#x27;s instructions and actions, which further ensures the fairness of the game. The Multiplayer Game Communication framework scales vertically by adding rooms to handle and accommodate multiple players. Write on-chain game logic with custom messages for horizontal expansion, allowing game developers to build multiplayer and fully on-chain games with smart contracts.&lt;br &#x2F;&gt;
Advantages of using this standard include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;All parties can provide comprehensive game data query services based on standard interfaces and verify the fairness of the game.&lt;&#x2F;li&gt;
&lt;li&gt;It has a basic grouping and messaging architecture, which reduces complexity and allows developers to focus on the development of the core logic of the game.&lt;&#x2F;li&gt;
&lt;li&gt;It is more composable, and developers can decompose a large game into several contracts that implement the standard.&lt;&#x2F;li&gt;
&lt;li&gt;Messages have one-to-many and customized capabilities, which is more conducive to developers to expand for different games.&lt;&#x2F;li&gt;
&lt;li&gt;The room adopts a hierarchical data structure, and each member will be assigned a new ID in each room to facilitate developers to manage the player&#x27;s state.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;The principle of Multiplayer Game Communication is to use the same game logic to change the state of different groups of players.&lt;&#x2F;p&gt;
&lt;p&gt;It consists of two core parts:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Room&lt;&#x2F;strong&gt;: A container for players, used to match and view connected players. The game can only be played after players join the room.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Message&lt;&#x2F;strong&gt;: Actions between players, using messages to perform game behaviors and change the player&#x27;s state in the room.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7566&#x2F;.&#x2F;assets&#x2F;MOGFlowChart.png&quot; alt=&quot;Multiplayer Game Communication Workflow&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;interfaces&quot;&gt;Interfaces&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;imog-sol&quot;&gt;&lt;code&gt;IMOG.sol&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; &amp;gt;=0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;Types.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IMOG&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Create a new room.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The entity MUST be assigned a unique Id.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; New&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; room id.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; createRoom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Get the total number of rooms that have been created.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Total&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; number of rooms.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getRoomCount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Player joins room.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The member MUST be assigned a unique Id.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _roomId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the id of the room.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Member&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; id.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; joinRoom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _roomId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Get the id of a member in a room.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _roomId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the id of the room.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _member&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the address of a member.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Member&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; id.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getMemberId&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _roomId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _member&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Check if a member exists in the room.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _roomId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the id of the room.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _member&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the address of a member.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; true&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; exists, false does not exist.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; hasMember&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _roomId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _member&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Get all room IDs joined by a member.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _member&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the address of a member.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; An&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of room ids.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getRoomIds&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _member&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Get the total number of members in a room.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _roomId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the id of the room.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Total&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; members.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getMemberCount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _roomId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * A member sends a message to other members.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Define your game logic here and use the content in the message to handle the member&amp;#39;s state. The message MUST be assigned a unique Id&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _roomId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the id of the room.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is an array of other member ids.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _message&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the content of the message, encoded by abi.encode.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _messageTypes&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is data type array of message content.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Message&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; id.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; sendMessage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _roomId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _message&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        Types&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;Type&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _messageTypes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Get all messages received by a member in the room.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _roomId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the id of the room.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _memberId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the id of the member.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; An&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of message ids.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getMessageIds&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _roomId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _memberId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Get details of a message.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _roomId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the id of the room.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _messageId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the id of the message.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; content of the message.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; type array of message content.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; id.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; An&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of receiver ids.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getMessage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _roomId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _messageId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            Types&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;Type&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            uint256&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;library&quot;&gt;Library&lt;&#x2F;h3&gt;
&lt;p&gt;The library &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7566&#x2F;.&#x2F;assets&#x2F;Types.sol&quot;&gt;&lt;code&gt;Types.sol&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; contains an enumeration of Solidity types used in the above interfaces.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-are-multiplayer-onchain-games-room-based&quot;&gt;Why are multiplayer onchain games room-based?&lt;&#x2F;h3&gt;
&lt;p&gt;Because the rooms are independent, each player will be assigned a new ID when entering a room. A new game round can be a room, a game task can be a room, and a game activity can be a room.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;the-player-s-state-in-the-game&quot;&gt;The player&#x27;s state in the game.&lt;&#x2F;h3&gt;
&lt;p&gt;The game state refers to the player&#x27;s data changes in the game, and &lt;code&gt;sendMessage&lt;&#x2F;code&gt; actually plays the role of a state converter. The proposal is very flexible, you can define some data inside the room (internal) or outside the room (global) according to the game logic.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;how-to-initialize-player-data&quot;&gt;How to initialize player data?&lt;&#x2F;h3&gt;
&lt;p&gt;You can initialize player data in &lt;code&gt;createRoom&lt;&#x2F;code&gt; or &lt;code&gt;joinRoom&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;how-to-check-and-handle-player-exits-from-the-game&quot;&gt;How to check and handle player exits from the game?&lt;&#x2F;h3&gt;
&lt;p&gt;You can use &lt;code&gt;block.timestamp&lt;&#x2F;code&gt; or &lt;code&gt;block.number&lt;&#x2F;code&gt; to record the latest &lt;code&gt;sendMessage&lt;&#x2F;code&gt; time of a member. And add a message type to &lt;code&gt;sendMessage&lt;&#x2F;code&gt;. Other players can use this message type to complain that a member is offline and punish the member.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;appropriate-game-categories&quot;&gt;Appropriate game categories.&lt;&#x2F;h3&gt;
&lt;p&gt;This is a multiplayer on-chain game rather than a multiplayer real-time game standard. The game category depends on the network your contract is deployed on. Some layer 2 networks process blocks very quickly and can make some more real-time games. Generally, the network is more suitable for strategy, trading card, turn-based, chess, sandbox, and settlement.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7566&#x2F;.&#x2F;assets&#x2F;MultiplayerOnchainGame.sol&quot;&gt;Multiplayer Game Communication Example&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;!-- TODO: Needs discussion. --&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Perpetual Contract NFTs as Collateral</title>
        <published>2023-11-27T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Hyoungsung Kim</name><uri>https://github.com/HyoungsungKim</uri><email>hyougnsung@keti.re.kr</email>
	</author>
	
	<author>
		<name>Yong-Suk Park</name><email>yspark@keti.re.kr</email>
	</author>
	
	<author>
		<name>Hyun-Sik Kim</name><email>hskim@keti.re.kr</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7565/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7565-proposal-perpetual-contract-nft-for-defi-composability/16790" />
        

        <id>https://wg-eips.ritovision.com/7565/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:7565"
            label="ERC-7565" />
        

        
        

        
        <summary type="html">Lock financial assets as NFTs and use them as collateral for borrowing funds in DeFi, facilitating liquidity provision.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7565/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC proposes a mechanism where a person (referred to as the &quot;Asset Owner&quot;) can collateralize NFTs that represent locked deposits or assets, to borrow funds against them. These NFTs represent the right to claim the underlying assets, along with any accrued benefits, after a predefined maturity period. &lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-1-1&quot;&gt;&lt;a href=&quot;#fn-1&quot;&gt;1&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The rapidly evolving landscape of DeFi has introduced various mechanisms for asset locking, offering benefits like interest and voting rights. However, one of the significant challenges in this space is maintaining liquidity while these assets are locked. This ERC addresses this challenge by proposing a method to generate profit from locked assets using &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4907&#x2F;&quot;&gt;ERC-4907&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;In DeFi services, running Automated Market Maker (AMM), liquidity providers contribute assets to pools and receive NFTs representing their stake. These NFTs denote the rights to the assets and the associated benefits, but they also lock the assets in the pool, often causing liquidity challenges for the providers. The current practice requires providers to withdraw their assets for urgent liquidity needs, adversely affecting the pool&#x27;s liquidity and potentially increasing slippage during asset swaps.&lt;&#x2F;p&gt;
&lt;p&gt;Our proposal allows these NFTs, representing locked assets in liquidity pools, to be used as collateral. This approach enables liquidity providers to gain temporary liquidity without withdrawing their assets, maintaining the pool&#x27;s liquidity levels. Furthermore, it extends to a broader range of DeFi services, including lending and trading, where asset locking is prevalent. By allowing the collateralization of locked asset representations through NFTs, our approach aims to provide versatile liquidity solutions across DeFi services, benefitting a diverse user base within the ecosystem.&lt;&#x2F;p&gt;
&lt;p&gt;The concept of perpetual contract NFTs, which we introduce, exploits the idea of perpetual futures contracts in the cryptocurrency derivatives market. These NFTs represent the rights to the perpetual contract and its collateral, enabling them to be used effectively as collateral for DeFi composability. The perpetual contract NFT offers a new form of NFT that enhances the utility of locked assets, providing a significant advantage in DeFi applications by offering liquidity while retaining the benefits of asset locking.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;contract-interface&quot;&gt;Contract Interface&lt;&#x2F;h3&gt;
&lt;p&gt;Solidity interface.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IPerpetualContractNFT&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when an NFT is collateralized for obtaining a loan&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Collateralized&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; loanAmount&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interestRate&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; loanDuration&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a loan secured by an NFT is fully repaid, releasing the NFT from collateral&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; LoanRepaid&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a loan defaults, resulting in the transfer of the NFT to the lender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Defaulted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; lender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Enables an NFT owner to collateralize their NFT in exchange for a loan&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @param tokenId The NFT to be used as collateral&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @param loanAmount The amount of funds to be borrowed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @param interestRate The interest rate for the loan&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @param loanDuration The duration of the loan&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; collateralize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; loanAmount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interestRate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; loanDuration&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Enables a borrower to repay their loan and regain ownership of the collateralized NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @param tokenId The NFT that was used as collateral&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @param repayAmount The amount of funds to be repaid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; repayLoan&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; repayAmount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Allows querying the loan terms for a given NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @param tokenId The NFT used as collateral&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @return loanAmount The amount of funds borrowed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @return interestRate The interest rate for the loan&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @return loanDuration The duration of the loan&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @return loanDueDate The due date for the loan repayment&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getLoanTerms&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; loanAmount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interestRate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; loanDuration&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; loanDueDate&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Allows querying the current owner of the NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @param tokenId The NFT in &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;question&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @return The address of the current owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; currentOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; View the total amount required to repay the loan for a given NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @param tokenId The NFT used as collateral&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @return The total amount required to repay the loan, including interest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; viewRepayAmount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;event-collateralized&quot;&gt;Event &lt;code&gt;Collateralized&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;Collateralized&lt;&#x2F;code&gt; event MUST be emitted when the collateralize function is successfully executed.&lt;&#x2F;li&gt;
&lt;li&gt;Usage: Logs the event of an NFT being used as collateral for a loan, capturing essential details like the loan amount, interest rate, and loan duration.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;event-loanrepaid&quot;&gt;Event &lt;code&gt;LoanRepaid&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;LoanRepaid&lt;&#x2F;code&gt; event MUST be emitted when the repayLoan function is successfully executed.&lt;&#x2F;li&gt;
&lt;li&gt;Usage: Logs the event of a loan being repaid and the corresponding NFT being released from collateral.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;event-defaulted&quot;&gt;Event &lt;code&gt;Defaulted&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;Defaulted&lt;&#x2F;code&gt; event MUST be emitted in scenarios where the loan defaults and the NFT is transferred to the lender.&lt;&#x2F;li&gt;
&lt;li&gt;Usage: Used to log the event of a loan default and the transfer of the NFT to the lender.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;function-collateralize&quot;&gt;Function &lt;code&gt;collateralize&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;collateralize&lt;&#x2F;code&gt; event SHOULD be implemented as &lt;code&gt;external&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Usage: Allows an NFT owner to collateralize their NFT to receive a loan.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;function-repayloan&quot;&gt;Function &lt;code&gt;repayLoan&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;repayLoan&lt;&#x2F;code&gt; function SHOULD be implemented as &lt;code&gt;external&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Usage: Enables an NFT owner to repay their loan and reclaim their NFT.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;function-getloanterms&quot;&gt;Function &lt;code&gt;getLoanTerms&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;getLoanTerms&lt;&#x2F;code&gt; function MAY be implemented as &lt;code&gt;external&lt;&#x2F;code&gt; &lt;code&gt;view&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Usage: Allows querying the loan terms for a given NFT.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;function-currentowner&quot;&gt;Function &lt;code&gt;currentOwner&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;currentOwner&lt;&#x2F;code&gt; function MAY be implemented as &lt;code&gt;external&lt;&#x2F;code&gt; &lt;code&gt;view&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Usage: Enables querying the current owner of a specific NFT.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;function-viewrepayamount&quot;&gt;Function &lt;code&gt;viewRepayAmount&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;viewRepayAmount&lt;&#x2F;code&gt; function MAY be implemented as &lt;code&gt;external&lt;&#x2F;code&gt; &lt;code&gt;view&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Usage: Enables querying the current repay amount of a specific NFT.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;design-motivation&quot;&gt;Design Motivation&lt;&#x2F;h3&gt;
&lt;p&gt;The design of this standard is driven by the need to address specific challenges in the DeFi sector, particularly concerning the liquidity and management of assets locked as collateral. Traditional mechanisms in DeFi often require asset holders to lock up their assets for participation in activities such as lending, staking, or yield farming, which results in a loss of liquidity. This standard aims to introduce a more flexible approach, allowing asset holders to retain some liquidity while their assets are locked, thereby enhancing the utility and appeal of DeFi products.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;design-decision&quot;&gt;Design Decision&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Dual-Role System (Asset Owner and DeFi Platform&#x2F;Contract): A clear division is established between the NFT owner (asset holder) and the DeFi platform or contract utilizing the NFT as collateral. This distinction simplifies the management of rights and responsibilities, enhancing clarity and reducing potential conflicts.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Enhancing Liquidity without Compromising Asset Locking Benefits: A key feature of this standard is enabling asset owners to use their NFTs, which represent locked assets, as collateral to secure loans. This approach allows asset owners to access liquidity without needing to withdraw their assets from pools or staking programs, thus preserving the associated benefits like interest accrual or voting rights.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Automated Loan and Collateral Management: The integration of automated features for managing the terms and conditions of the collateralized NFT is a deliberate choice to minimize transaction costs and complexity.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;DeFi Composability: The strategic emphasis on DeFi composability, particularly the integration between asset-locking and collateralizing services, is pivotal for this standard. This approach aims to streamline the adoption of the standard across diverse DeFi platforms and services, fostering seamless connections within the DeFi ecosystem.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;alternate-designs-and-related-work&quot;&gt;Alternate Designs and Related Work&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Comparison with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4907&#x2F;&quot;&gt;ERC-4907&lt;&#x2F;a&gt;: While &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4907&#x2F;&quot;&gt;ERC-4907&lt;&#x2F;a&gt; also introduces a dual-role model for NFTs (owner and user), our standard focuses specifically on the use of NFTs for collateralization in financial transactions, diverging from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4907&#x2F;&quot;&gt;ERC-4907&lt;&#x2F;a&gt;’s rental-oriented approach.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Improvement Over Traditional Collateralization Methods: Compared to traditional DeFi collateralization, which often requires complete asset lock-up, this standard proposes a more dynamic and flexible model that allows for continued liquidity access.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Fully compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and integrates with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4907&#x2F;&quot;&gt;ERC-4907&lt;&#x2F;a&gt; for renting NFTs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0 &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;PerpetualContractNFT.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PerpetualContractNFTDemo&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PerpetualContractNFT&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; symbol&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        PerpetualContractNFT&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;name, symbol)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span&gt;         &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; { &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;expect&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;chai&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; { &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ethers&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;hardhat&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;describe&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;PerpetualContractNFTDemo&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; function&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    it&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;should allow an owner to collateralize an NFT, rent it to a contract, and then have the owner repay the loan&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; async &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        const &lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; await ethers&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getSigners&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        const PerpetualContractNFTDemo &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; await ethers&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getContractFactory&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;PerpetualContractNFTDemo&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        const demo &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; await PerpetualContractNFTDemo&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;deploy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;DemoNFT&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;DNFT&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        await demo&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;waitForDeployment&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;demo&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;target&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;be&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;properAddress&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Mint an NFT to the owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        await demo&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Owner collateralizes the NFT for a loan&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        const loanAmount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; ethers&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;parseUnits&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;1&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ether&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 1 Ether in Wei. Use Wei to avoid precision error.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        const interest &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 5&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 5% interest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        const expiration &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; Math&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;floor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Date&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getTime&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3600&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Expire after 60 minutes (3600 seconds), convert it to seconds because `hours` in solidity converted to seconds&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        await demo&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;connect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;collateralize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; loanAmount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; interest&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; expiration&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; tokenId, loanAmount, interestRate, loanDuration&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check current user of the NFT (should be the contract address)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;await demo&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;userOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;demo&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;target&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Borrower repays the loan to release the NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        const repayAmountWei &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; await demo&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;connect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;viewRepayAmount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        await demo&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;connect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;repayLoan&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; repayAmountWei&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check if the NFT is returned to the original owner after the loan is repaid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;await demo&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;userOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;0x0000000000000000000000000000000000000000&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Run in Terminal：&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;npx&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; hardhat&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; test&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0 &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;import &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC721&#x2F;ERC721.sol&amp;quot;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IPerpetualContractNFT.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;ERC4907&#x2F;ERC4907.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PerpetualContractNFT&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC4907&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IPerpetualContractNFT&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; LoanInfo&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; borrower&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address that borrowed against the NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; loanAmount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Amount of funds borrowed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; interestRate&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Interest rate for the loan&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint64&lt;&#x2F;span&gt;&lt;span&gt; loanDuration&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Duration of the loan&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; loanStartTime&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Timestamp when the loan starts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; LoanInfo&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; _loans&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;Constructor to initialize the Perpetual Contract NFT contract with the given name and symbo&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; symbol_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        ERC4907&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;name_, symbol_)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; collateralize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; loanAmount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interestRate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; loanDuration&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isApprovedForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getApproved&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Not owner nor approved&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        LoanInfo &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;storage&lt;&#x2F;span&gt;&lt;span&gt; info &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _loans&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        info&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;borrower &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The loan amount should reflect the asset&amp;#39;s value as represented by the NFT, considering an appropriate loan-to-value (LTV) ratio.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        info&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;loanAmount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; loanAmount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        info&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;interestRate &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; interestRate&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        info&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;loanDuration &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; loanDuration&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        info&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;loanStartTime &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        setUser&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; loanDuration&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Collateralized&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; loanAmount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; interestRate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; loanDuration&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Further logic can be implemented here to manage the lending of assets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; repayLoan&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; repayAmount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_loans&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;borrower &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Not the borrower.&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Calculate the total amount due for repayment&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; totalDue &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; viewRepayAmount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check if the repayAmount is sufficient to cover at least a part of the total due amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;repayAmount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; totalDue&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Repay amount exceeds total due.&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Calculate the remaining loan amount after repayment&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _loans&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;loanAmount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; totalDue &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt; repayAmount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Resets the user of the NFT to the default state if the entire loan amount is fully repaid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_loans&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;loanAmount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            setUser&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; LoanRepaid&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getLoanTerms&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        LoanInfo &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;storage&lt;&#x2F;span&gt;&lt;span&gt; info &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _loans&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;info&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;loanAmount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; info&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;interestRate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; info&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;loanDuration&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; info&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;loanStartTime&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; currentOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; viewRepayAmount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;_loans&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;loanAmount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If the loan amount is zero, there is nothing to repay&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The interest is calculated on an hourly basis, prorated based on the actual duration for which the loan was held.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If the borrower repays before the loan duration ends, they are charged interest only for the time the loan was held.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; For example, if the annual interest rate is 5% and the borrower repays in half the loan term, they pay only 2.5% interest.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; elapsed &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;_loans&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;loanStartTime &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt; _loans&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;loanDuration&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                        ?&lt;&#x2F;span&gt;&lt;span&gt; _loans&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;loanDuration  &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; hours&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                        :&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt; _loans&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;loanStartTime&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; hours&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Round up&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Example: 15&#x2F;4 = 3.75&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; round((15 + 4 - 1)&#x2F;4) = 4, round((15&#x2F;4) = 3)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; interest &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_loans&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;loanAmount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; _loans&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;interestRate &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 100&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; elapsed &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;_loans&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;loanDuration &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; hours&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    (&lt;&#x2F;span&gt;&lt;span&gt;_loans&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;loanDuration &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; hours&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Calculate the total amount due&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; totalDue &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _loans&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;loanAmount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt; interest&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; totalDue&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Additional functions and logic to handle loan defaults, transfers, and other aspects of the NFT lifecycle&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;!-- Needs discussion. --&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;section class=&quot;footnotes&quot;&gt;
&lt;ol class=&quot;footnotes-list&quot;&gt;
&lt;li id=&quot;fn-1&quot;&gt;
&lt;p&gt;Kim, H., Kim, H.-S., &amp;amp; Park, Y.-S. (2022). Perpetual Contract NFT as Collateral for DeFi Composability. &lt;span style=&quot;font-style: italic;&quot;&gt;IEEE Access&lt;&#x2F;span&gt;, &lt;span style=&quot;font-style: italic;&quot;&gt;10&lt;&#x2F;span&gt;, 126802–126814. https:&#x2F;&#x2F;doi.org&#x2F;&lt;a href=&quot;https:&#x2F;&#x2F;doi.org&#x2F;10.1109&#x2F;ACCESS.2022.3225884&quot;&gt;10.1109&#x2F;ACCESS.2022.3225884&lt;&#x2F;a&gt;## Motivation &lt;a href=&quot;#fr-1-1&quot;&gt;↩&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;section&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Contract wallet management NFT</title>
        <published>2023-11-21T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Xiang</name><uri>https://github.com/wenzhenxiang</uri>
	</author>
	
	<author>
		<name>Ben77</name><uri>https://github.com/ben2077</uri>
	</author>
	
	<author>
		<name>Mingshi S.</name><uri>https://github.com/newnewsms</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7564/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-draft-contract-wallet-management-nft/16702" />
        

        <id>https://wg-eips.ritovision.com/7564/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:7564"
            label="ERC-7564" />
        

        
        

        
        <summary type="html">Focuses on NFT management within smart contract wallets, offering enhanced transaction flexibility and security</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7564/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal introduces a smart contract wallet-based approach for managing NFTs, focusing on utilizing the programmable features of smart contract wallets for NFT asset management. Additionally, it introduces functions such as &lt;code&gt;nftApprove&lt;&#x2F;code&gt;, &lt;code&gt;nftSetApprovalForOneAll&lt;&#x2F;code&gt;, &lt;code&gt;nftSetApprovalForAllAll&lt;&#x2F;code&gt;, &lt;code&gt;nftGetApproved&lt;&#x2F;code&gt;, &lt;code&gt;nftIsApprovedForOneAll&lt;&#x2F;code&gt;, &lt;code&gt;nftIsApprovedForAllAll&lt;&#x2F;code&gt; and &lt;code&gt;nftTransfer&lt;&#x2F;code&gt;, which provide enhanced control over NFT transactions. This approach seeks to enhance NFT management by utilizing the built-in features of smart contract wallets, thus offering a more adaptable, secure, and efficient method for managing token transactions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;An externally-owned account (EOA) wallet has no state and code storage, while the smart contract wallet does.&lt;&#x2F;p&gt;
&lt;p&gt;Account abstraction (AA) is a direction of the smart contract wallet, which works around abstract accounts. This ERC can also be an extension based on &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt; or as a plug-in for wallets.&lt;&#x2F;p&gt;
&lt;p&gt;The smart contract wallet allows the user&#x27;s own account to have state and code, bringing programmability to the wallet. We think there are more directions to expand. For example, nft asset management, functional expansion of nft transactions, etc.&lt;&#x2F;p&gt;
&lt;p&gt;The smart contract wallet interface of this ERC is for nft asset management and nft asset approval. It supports the simplenft &lt;!-- TODO --&gt; ERC-X, and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; is backward compatible with &lt;!-- TODO --&gt; ERC-X, so it can be compatible with the management of all nfts in the existing market.&lt;&#x2F;p&gt;
&lt;p&gt;The proposal aims to achieve the following goals:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;NFT assets are allocated and managed by the wallet itself, such as approve function, which are configured by the user’s contract wallet, rather than controlled by the nft asset contract, to avoid some existing ERC-721 contract risks.&lt;&#x2F;li&gt;
&lt;li&gt;Add the &lt;code&gt;nftTransfer&lt;&#x2F;code&gt; function, the transaction initiated by the non-smart wallet itself.&lt;&#x2F;li&gt;
&lt;li&gt;Add &lt;code&gt;nftApprove&lt;&#x2F;code&gt;, &lt;code&gt;nftSetApprovalForOneAll&lt;&#x2F;code&gt;, &lt;code&gt;nftSetApprovalForAllAll&lt;&#x2F;code&gt;, &lt;code&gt;nftGetApproved&lt;&#x2F;code&gt;, &lt;code&gt;nftIsApprovedForOneAll&lt;&#x2F;code&gt;, &lt;code&gt;nftIsApprovedForAllAll&lt;&#x2F;code&gt; functions. The user wallet itself supports approve and provides approve. for One nft, all nft of one nft smart contract, all nft assets.&lt;&#x2F;li&gt;
&lt;li&gt;User wallet can choose batch approve and batch transfer.&lt;&#x2F;li&gt;
&lt;li&gt;Users can choose to add hook function before and after their &lt;code&gt;nftTransfer&lt;&#x2F;code&gt; to increase the user&#x27;s more playability.&lt;&#x2F;li&gt;
&lt;li&gt;The user can choose to implement the &lt;code&gt;nftReceive&lt;&#x2F;code&gt; function.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Compliant contract must implement the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; interfaces&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-7564&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-7564&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.20&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7564&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to notify listeners that owner has granted approval to the user to manage one nft.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _asset&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the nft&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the account that has granted the approval for nft‘s assets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the operator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The unique identifier of the NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NftApproval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _asset&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to notify listeners that owner has granted approval to the operator to manage all nft of one asset contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _asset&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the nft&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the account that has granted the approval for nft‘s assets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the operator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; approve all nft of one asset contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NftApprovalForOneAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _asset&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to notify listeners that owner has granted approval to the operator to manage all nft .&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the account that has granted the approval for nft‘s assets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the operator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; approve all nft&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NftApprovalForAllAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Approve nft&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Allows operator address to withdraw from your wallet one nft.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emits an {nftApproval} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _asset&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the nft&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the operator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The unique identifier of the NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; nftApprove&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _asset&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Approve all nft of one asset&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Allows operator address to withdraw from your wallet all nft.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emits an {nftApprovalForOneAll} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _asset&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the nft&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the operator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Approved all nfts of one asset&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; nftSetApprovalForOneAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _asset&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Approve all nft&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Allows operator address to withdraw from your wallet all nft.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emits an {nftApprovalForAllAll} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the operator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Approved all nfts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; nftSetApprovalForAllAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; read operator approved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _asset&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the nft&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the operator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The unique identifier of the NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Whether to approved operator one nft&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; nftGetApproved&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _asset&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; read operator approved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _asset&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the nft&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the operator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Whether to approved operator all nfts of this one asset&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; nftIsApprovedForOneAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _asset&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; read operator approved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the operator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Whether to approved operator all nfts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; nftIsApprovedForAllAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfer nft&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; must call nft asset transfer() inside the function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If the caller is not wallet self, must verify the approve and update&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _asset&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the nft&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the receive&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The transaction amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _success&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The bool value returns whether the transfer is successful&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; nftTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _asset&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;the key technical decisions in this proposal are:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Improved Approve Mechanism&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Current vs. Proposed&lt;&#x2F;strong&gt;: In the existing ERC-721 system, an externally-owned account (EOA) directly interacts with nft contracts to &lt;code&gt;approve&lt;&#x2F;code&gt;. The new &lt;code&gt;nftApprove&lt;&#x2F;code&gt;, &lt;code&gt;nftSetApprovalForOneAll&lt;&#x2F;code&gt;, &lt;code&gt;nftSetApprovalForAllAll&lt;&#x2F;code&gt;, &lt;code&gt;nftGetApproved&lt;&#x2F;code&gt;, &lt;code&gt;nftIsApprovedForOneAll&lt;&#x2F;code&gt;, &lt;code&gt;nftIsApprovedForAllAll&lt;&#x2F;code&gt;functions in this proposed enable more precise control over nft usage within a wallet contract, a significant improvement over the traditional method.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Enhanced Security&lt;&#x2F;strong&gt;: This mechanism mitigates risks like nft over-approval by shifting approval control to the user&#x27;s smart contract wallet.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Programmability&lt;&#x2F;strong&gt;: Users gain the ability to set advanced approval strategies, such as conditional or time-limited approvals, the &lt;code&gt;nftSetApprovalForAllAll&lt;&#x2F;code&gt; function specifically allows for a universal setting  all nfts. these were not possible with traditional ERC-721 nfts.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Optimized Transfer Process&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Efficiency and Security&lt;&#x2F;strong&gt;: The &lt;code&gt;nftTransfer&lt;&#x2F;code&gt; function streamlines the nft transfer process, making transactions both more efficient and secure.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Flexibility&lt;&#x2F;strong&gt;: Allows the integration of custom logic (hooks) before and after transfers, enabling additional security checks or specific actions tailored to the user’s needs.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Support for Batch Operations&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Increased Efficiency&lt;&#x2F;strong&gt;: Users can simultaneously handle multiple &lt;code&gt;approve&lt;&#x2F;code&gt; or &lt;code&gt;transfer&lt;&#x2F;code&gt; operations, significantly boosting transaction efficiency.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Enhanced User Experience&lt;&#x2F;strong&gt;: Simplifies the management of numerous assets, improving the overall experience for users with large portfolios.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC can be used as an extension of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt; and is backward compatible with ERC-4337.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;No security considerations were found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Single Sign-On for Account Discovery</title>
        <published>2023-11-10T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Alexander Müller</name><uri>https://github.com/alexmmueller</uri>
	</author>
	
	<author>
		<name>Gregory Markou</name><uri>https://github.com/GregTheGreek</uri>
	</author>
	
	<author>
		<name>Willem Olding</name><uri>https://github.com/Wollum</uri>
	</author>
	
	<author>
		<name>Belma Gutlic</name><uri>https://github.com/morrigan</uri>
	</author>
	
	<author>
		<name>Marin Petrunić</name><uri>https://github.com/mpetrunic</uri>
	</author>
	
	<author>
		<name>Pedro Gomes</name><uri>https://github.com/pedrouid</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7555/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7555-single-sign-on-for-account-discovery/16536" />
        

        <id>https://wg-eips.ritovision.com/7555/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7555"
            label="ERC-7555" />
        

        
        

        
        <summary type="html">Discover accounts using a signing key that do not use the secp256k1 curve.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7555/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal establishes a standardized interface and functionality for applications to discover user accounts besides the readily available EOA. Specifically discovering normal accounts and smart accounts that may have been deployed or configured using a signing key that is not the standard Ethereum secp256k1 curve. The objective is to ensure uniformity of address retrieval across applications, and domains.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The recent progress in account abstraction has led to significantly increased flexibility enabling use cases such as multi-signature transactions, social recovery, contract&#x2F;account whitelisting, session keys and much more. However, with increased flexibility there comes an increased complexity. One area of increased complexity is account fragmentation -both at the EOA and smart account level - following from the inability to correctly identify all existing addresses by a user. In this EIP we present a potential solution that aims to unify the discovery and handling of such accounts.&lt;&#x2F;p&gt;
&lt;p&gt;Prior to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt;, the standard approach to interacting with a smart contract account required a valid signature from a keypair using secp256k1. Since ERC-4337, alternative signing options have become popular, such as passkey, yubikey or ios&#x2F;android secure enclaves, which do not conform to the secp256k1 curve, and require a paymaster to submit the transaction on the users behalf. Since providers implement additional logic into the key generation process (shamir, mpc, secure enclave, etc) alternative signers have no uniform way for a user to produce the same externally-owned account adresses, or smart account addresses across different applications.&lt;&#x2F;p&gt;
&lt;p&gt;Secure hardware devices such as native passkeys, or yubikeys generate a unique keypair per domain. The implication is for application developers that natively integrate authentication methods such as those, will never be able to recover a uniform keypair. Practically, if we have the following scenario where there are two applications: a mobile app (App A), and a web based application (App B). If both implement a solution such as passkey, App A and App B would recover two different keys. This poses a hurdle to the user who would expect to have the same address across services (much like they would using a hardware wallet, or other wallets).&lt;&#x2F;p&gt;
&lt;p&gt;With the introduction of 4337, this problem is amplified. An application that wants its users to leverage 4337 (to abstract keys away, and generally improve the onboarding experience) will not be able to detect if a user has an existing smart account deployed. This will lead to the developer (or third party service providing the onboarding experience) to deploy a smart account on behalf of the user at the given address scoped to the apps domain.&lt;&#x2F;p&gt;
&lt;p&gt;Not being able to correctly identify existing accounts owned by a user will lead to account fragmentation. The fragmentation, as described early, exists because applications will identify them as a new user, and not one whom may already have an account. Leading to a single user having many unassociated accounts, with assets scattered amongst them, and no way to unify them.&lt;&#x2F;p&gt;
&lt;p&gt;This standard aims to achieve:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Standard way for applications to request a users signing address.&lt;&#x2F;li&gt;
&lt;li&gt;Standard way for applications to provide single sign-on (SSO) functionality for alternative signing methods.&lt;&#x2F;li&gt;
&lt;li&gt;Standard way for applications to disclose smart accounts that have been created through their own service.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;This standard &lt;strong&gt;does not&lt;&#x2F;strong&gt; aim to achieve:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;How a user can sign messages across domains.&lt;&#x2F;li&gt;
&lt;li&gt;How a provider generates a keypair for a user.&lt;&#x2F;li&gt;
&lt;li&gt;How an application handles the user interface logic.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Smart account&lt;&#x2F;strong&gt; - An ERC-4337 compliant smart contract account that has a modular architecture.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Domain&lt;&#x2F;strong&gt; - A string of text acting as an identification to a server or website (eg: &lt;code&gt;ethereum.org&lt;&#x2F;code&gt; or &lt;code&gt;ABCDE12345.com.example.app&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;EOA&lt;&#x2F;strong&gt; - Accounts that are controlled by a single private key.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Provider&lt;&#x2F;strong&gt; - A third party service provider that is able to authenticate a user and produce a keypair for the user.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;redirects&quot;&gt;Redirects&lt;&#x2F;h3&gt;
&lt;p&gt;An application looking to authenticate a user must navigate the user to a given provider&#x27;s URI based on the &lt;code&gt;URI Request Syntax&lt;&#x2F;code&gt;. The application must implement a valid redirect URI for the callback in order to receive a valid response.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;available-routes&quot;&gt;Available Routes&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;&#x2F;auth&#x2F;&lt;&#x2F;code&gt;: The route used to authenticate a user, and request credentials.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;&#x2F;sendTransaction&#x2F;&lt;&#x2F;code&gt;: The route used to send a transaction payload for a user to sign. This is more of a convenient method to allow applications to do both authentication, and plugin registration within a single redirect, instead of requiring the user to perform two redirects.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;schema&quot;&gt;Schema&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;smart_account_address&lt;&#x2F;code&gt; should be returned in the CAIP-10 format.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;auth-route&quot;&gt;Auth Route&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;request-schema&quot;&gt;Request Schema&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; p&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;arameters&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; q&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uery&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;edirect_uri&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;chema&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;        t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;tring&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      d&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;escription&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; T&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;he uri that the provider should redirect back to.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; q&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uery&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;hain_id&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;chema&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;        t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;tring&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      d&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;escription&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; T&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;he chain_id of a given network.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;response-schema&quot;&gt;Response Schema&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; p&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;arameters&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; q&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uery&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;mart_account_address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;chema&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;        t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;tring&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      d&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;escription&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; T&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;he on-chain address for a given smart account, formatted using CAIP-10&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;request-syntax&quot;&gt;Request Syntax&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;https:&#x2F;&#x2F;&amp;lt;PROVIDER_URI&amp;gt;&#x2F;auth&#x2F;?&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    redirect_uri=&amp;lt;YOUR_REDIRECT_URI&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;amp;chain_id=&amp;lt;CHAIN_ID&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;response-syntax&quot;&gt;Response Syntax&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;https:&#x2F;&#x2F;&amp;lt;YOUR_REDIRECT_URI&amp;gt;&#x2F;auth&#x2F;?&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    smart_account_address=&amp;lt;SMART_ACCOUNT_ADDRESS&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;sendtransaction-route&quot;&gt;sendTransaction Route&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;request-schema-1&quot;&gt;Request Schema&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; p&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;arameters&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; q&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uery&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;edirect_uri&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;chema&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;        t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;tring&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      d&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;escription&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; T&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;he uri that the provider should redirect back to.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; q&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uery&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;hain_id&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;chema&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;        t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;tring&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      d&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;escription&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; T&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;he chain_id of a given network.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; q&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uery&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ransaction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;chema&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;        t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;tring&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      d&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;escription&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; T&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;he RLP encoded transaction that needs to be signed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;response-schema-1&quot;&gt;Response Schema&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; p&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;arameters&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; q&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uery&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;mart_account_address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;chema&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;        t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;tring&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      d&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;escription&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; T&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;he on-chain address for a given smart account, formatted using CAIP-10&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; q&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uery&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;x_hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;chema&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;        t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;tring&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      d&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;escription&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; T&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;he hash of the transaction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;request-syntax-1&quot;&gt;Request Syntax&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;https:&#x2F;&#x2F;&amp;lt;PROVIDER_URI&amp;gt;&#x2F;sendTransaction&#x2F;?&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    redirect_uri=&amp;lt;YOUR_REDIRECT_URI&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;amp;chain_id=&amp;lt;CHAIN_ID&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;amp;transaction=&amp;lt;TRANSACTION_DATA&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;response-syntax-1&quot;&gt;Response Syntax&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;https:&#x2F;&#x2F;&amp;lt;YOUR_REDIRECT_URI&amp;gt;&#x2F;sendTransaction&#x2F;?&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    smart_account_address=&amp;lt;SMART_ACCOUNT_ADDRESS&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;amp;tx_hash=&amp;lt;TX_HASH&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;redirects-1&quot;&gt;Redirects&lt;&#x2F;h3&gt;
&lt;p&gt;Taking inspiration from how SSO functions in the web today. We implement a similar redirect pattern, consisting of a simple request&#x2F;response.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;application&quot;&gt;Application&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;initial-request&quot;&gt;Initial Request&lt;&#x2F;h5&gt;
&lt;p&gt;An application would redirect a user to a specified provider, only passing along the callback url information. This is to ensure the providers website can remain stateless, and not rely on web requests.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;response-from-provider&quot;&gt;Response from provider&lt;&#x2F;h5&gt;
&lt;p&gt;When a user is redirected to the application, it can parse the response for a signer address, and associated smart account address.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;provider&quot;&gt;Provider&lt;&#x2F;h4&gt;
&lt;p&gt;Upon a user navigating to the provider website, the provider would parse the redirect url and authenticate the user. The authentication method does not matter, such that it can produce a valid public address, and recover any smart accounts that may have been deployed through the provider.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Using &lt;code&gt;location.replace()&lt;&#x2F;code&gt; vs &lt;code&gt;location.href&lt;&#x2F;code&gt; is up to the application to decide how they wish the experience to be handled.&lt;&#x2F;p&gt;
&lt;p&gt;Sample URI Request&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;https:&#x2F;&#x2F;eth-sso.ethereum.org&#x2F;auth?redirect_uri=http:&#x2F;&#x2F;myapp.com&#x2F;eth-sso&#x2F;callback&#x2F;&amp;amp;chain_id=1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Sample Response&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;http:&#x2F;&#x2F;myapp.com&#x2F;callback&#x2F;?smart_account_address=0xb...c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Application logic&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; https:&#x2F;&#x2F;myapp.com&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; User triggered authentication function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    window&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;location&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;replace&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;eth-sso.ethereum.org&#x2F;auth?redirect_uri=myapp.com&amp;amp;chain_id=1&#x2F;eth-sso&#x2F;callback&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; App level routing logic (generic router)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;route&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&#x2F;eth-sso&#x2F;callback&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; params&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; URL&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;document&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;location&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;searchParams&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; smartAccountAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; params&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;get&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;smart_account_address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Provider Logic&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; eg: https:&#x2F;&#x2F;eth-sso.ethereum.org&#x2F;auth&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;route&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&#x2F;eth-sso&#x2F;callback&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&#x2F;auth&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; params&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; URL&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;document&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;location&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;searchParams&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; redirectUrl&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; params&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;get&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;redirect_uri&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Authenticate the user (eg: with passkeys)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get smart account if available&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; smartAccountAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getSmartAccount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    window&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;location&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;replace&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;http:&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;redirectUrl&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&#x2F;?smart_account_address=&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;smartAccountAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;!-- Needs discussion. --&gt;
&lt;ul&gt;
&lt;li&gt;Is there a concern that a user can spoof another persons address, and that could be malicious? For example, circumventing the provider, and manually calling the redirect_url with a chosen address. A way around this would be having the user actually sign a challenge message, perhaps leveraging SIWE.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The absence of wildcard support in the redirect URI is intended to protect users from nested open redirect vulnerabilities. Allowing wildcards could enable attackers to redirect users to different pages under the supported wildcard, creating a vulnerability to open redirects.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Move committee index outside Attestation</title>
        <published>2023-11-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>dapplion</name><uri>https://github.com/dapplion</uri>
	</author>
	
	<author>
		<name>Mikhail Kalinin</name><uri>https://github.com/mkalinin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7549/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7549-move-committee-index-outside-attestation/16390" />
        

        <id>https://wg-eips.ritovision.com/7549/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:7549"
            label="EIP-7549" />
        

        
        

        
        <summary type="html">Move committee index outside of the signed Attestation message</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7549/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Move the committee&#x27;s &lt;code&gt;index&lt;&#x2F;code&gt; field outside of the signed Attestation message to allow aggregation of equal consensus votes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal aims to make Casper FFG clients more efficient by reducing the average number of pairings needed to verify consensus rules. While all types of clients can benefit from this EIP, ZK circuits proving Casper FFG consensus will likely have the most impact.&lt;&#x2F;p&gt;
&lt;p&gt;On a beacon chain network with at least 262144 active indices, it&#x27;s necessary to verify a minimum of &lt;code&gt;ceil(32*64 * 2&#x2F;3) = 1366&lt;&#x2F;code&gt; attestations to reach a 2&#x2F;3 threshold. Participants cast two votes at once: LMD GHOST vote and Casper-FFG vote. However, the Attestation message contains three elements:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;LMD GHOST vote &lt;code&gt;(beacon_block_root, slot)&lt;&#x2F;code&gt;. Note: includes slot in the event (block, slot) voting is adopted.&lt;&#x2F;li&gt;
&lt;li&gt;FFG vote &lt;code&gt;(source, target)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Committee index &lt;code&gt;(index)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Signing over the 3rd item causes tuples of equal votes to produce different signing roots. If the committee index is moved outside of the Attestation message, the minimum number of attestations to verify to reach a 2&#x2F;3 threshold is reduced to &lt;code&gt;ceil(32 * 2&#x2F;3) = 22&lt;&#x2F;code&gt; (a factor of 62).&lt;&#x2F;p&gt;
&lt;p&gt;On-chain attestations can now be packed more space-efficiently into beacon blocks. This proposal allows for up to 8 slots worth of votes in a block, compared to 2 today. In other words, a chain with only 1&#x2F;8 online proposers can still potentially include all votes on-chain.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;execution-layer&quot;&gt;Execution layer&lt;&#x2F;h3&gt;
&lt;p&gt;This requires no changes to the Execution Layer.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;consensus-layer&quot;&gt;Consensus layer&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Set &lt;code&gt;index&lt;&#x2F;code&gt; field from &lt;code&gt;AttestationData&lt;&#x2F;code&gt; to a fixed value of zero&lt;&#x2F;li&gt;
&lt;li&gt;Move committee indexing data to the outer &lt;code&gt;Attestation&lt;&#x2F;code&gt; container with &lt;code&gt;committee_bits&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Increase the capacity of &lt;code&gt;aggregation_bits&lt;&#x2F;code&gt; to all committees in a slot&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The full specification of the proposed change can be found in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;2c1f677187e6534aec77057a7d1cc746a40d3630&#x2F;specs&#x2F;electra&#x2F;beacon-chain.md&quot;&gt;&lt;code&gt;&#x2F;specs&#x2F;electra&#x2F;beacon-chain.md&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;deprecation-strategy&quot;&gt;Deprecation strategy&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;index&lt;&#x2F;code&gt; field in &lt;code&gt;AttestationData&lt;&#x2F;code&gt; can be deprecated by:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Removing the field&lt;&#x2F;li&gt;
&lt;li&gt;Preserving the field and setting it to zero&lt;&#x2F;li&gt;
&lt;li&gt;Changing the field type to Optional (from EIP-7495 StableContainer)&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;This EIP chooses the second option to not complicate the inclusion of &lt;code&gt;AttesterSlashing&lt;&#x2F;code&gt; objects. While the &lt;code&gt;Attestation&lt;&#x2F;code&gt; container changes, &lt;code&gt;AttesterSlashing&lt;&#x2F;code&gt; includes indexed attestations without committee data.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;max-attestations-value&quot;&gt;&lt;code&gt;MAX_ATTESTATIONS&lt;&#x2F;code&gt; value&lt;&#x2F;h3&gt;
&lt;p&gt;The maximum size of an attestation increases, with a bitfield 64 times larger on networks with maxed committees. &lt;code&gt;MAX_ATTESTATIONS&lt;&#x2F;code&gt; value is reduced to limit the beacon block size while still increasing the total capacity of votes. A value of 8 increases the voting capacity by 4 while having the same attestation space size with a network of 1.2M active indices.
Read the details &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7549&#x2F;assets&#x2F;complexity_analysis&#x2F;&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;max-attester-slashings-value&quot;&gt;&lt;code&gt;MAX_ATTESTER_SLASHINGS&lt;&#x2F;code&gt; value&lt;&#x2F;h3&gt;
&lt;p&gt;On-chain &lt;code&gt;AttesterSlashing&lt;&#x2F;code&gt; includes a list of participants&#x27; indices. With this EIP, the worst-case size increases by 64 times, resulting in an uncompressed size of 488 KB per &lt;code&gt;AttesterSlashing&lt;&#x2F;code&gt; in a network of 1M validators. Snappy compression reduces it to 320 KB, which is still significant. To bound the maximum size of the block, this proposal reduces &lt;code&gt;MAX_ATTESTER_SLASHINGS&lt;&#x2F;code&gt; from 2 to 1, the minimum value.
Read the details &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7549&#x2F;assets&#x2F;complexity_analysis&#x2F;&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;using-bitvector-for-committee-bits&quot;&gt;Using &lt;code&gt;Bitvector&lt;&#x2F;code&gt; for &lt;code&gt;committee_bits&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;committee_bits&lt;&#x2F;code&gt; sequence has a variable length with the max size &lt;code&gt;MAX_COMMITTEES_PER_SLOT = 64&lt;&#x2F;code&gt;. Encoding of the &lt;code&gt;Bitlist&lt;&#x2F;code&gt; includes its actual length, which doubles the size of the &lt;code&gt;committee_bits&lt;&#x2F;code&gt; compared to the &lt;code&gt;Bitvector&lt;&#x2F;code&gt; type. Beacon chain state transition ensures correctness of the &lt;code&gt;committee_bits&lt;&#x2F;code&gt; when the effective number of committees in a slot is less than its max value.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces backward-incompatible changes to the block validation rule set on the consensus layer and must be accompanied by a hard fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;first-block-after-the-fork&quot;&gt;First block after the fork&lt;&#x2F;h3&gt;
&lt;p&gt;Because the on-chain &lt;code&gt;Attestation&lt;&#x2F;code&gt; container changes, attestations from the prior fork can&#x27;t be included in post-Electra blocks. Therefore, the first block after the fork may have zero attestations. LMD votes can still be applied to fork-choice via &lt;code&gt;on_attestation&lt;&#x2F;code&gt; handler, so there will be only a 1&#x2F;32 loss of FFG votes. Attesters assigned to the last slot of the fork will incur one epoch worth of offline penalties. One possible mitigation is to change the Electra block body type to allow including attestations from both forks. However, the mitigation increases complexity for little gain, so this proposal chooses not to address the issue.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;mutation-over-gossip&quot;&gt;Mutation over gossip&lt;&#x2F;h3&gt;
&lt;p&gt;Moving the &lt;code&gt;index&lt;&#x2F;code&gt; field outside of the signed message allows malicious mutation only on the p2p gossip topic &lt;code&gt;beacon_attestation_${subnet_id}&lt;&#x2F;code&gt;. Everywhere else, the &lt;code&gt;Attestation&lt;&#x2F;code&gt; message is wrapped with an outer signature that prevents mutation.&lt;&#x2F;p&gt;
&lt;p&gt;Gossip verification rules for the &lt;code&gt;beacon_attestation_${subnet_id}&lt;&#x2F;code&gt; topic include:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;[REJECT] The attester is a member of the committee -- i.e., &lt;code&gt;attestation.attester_index&lt;&#x2F;code&gt; in &lt;code&gt;get_beacon_committee(state, attestation.data.slot, index)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;If an attacker mutates the &lt;code&gt;index&lt;&#x2F;code&gt; field, the above rule verification will fail, and the message will be dropped. If implementations run the above check before registering the attestation in a &#x27;first-seen&#x27; cache, there&#x27;s no risk of cache pollution.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Open IP Protocol built on NFTs</title>
        <published>2023-10-31T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Combo</name><email>combo@1combo.io</email>
	</author>
	
	<author>
		<name>Saitama</name><uri>https://github.com/saitama2009</uri>
	</author>
	
	<author>
		<name>CT29</name><email>CT29@1combo.io</email>
	</author>
	
	<author>
		<name>Luigi</name><email>luigi@1combo.io</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7548/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/draft-open-ip-protocol/16373" />
        

        <id>https://wg-eips.ritovision.com/7548/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7548"
            label="ERC-7548" />
        

        
        

        
        <summary type="html">A protocol that enables users to remix NFTs and generate new NFT derivative works, while their relationships can be traced on chain.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7548/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal aims to establish a standardized method for creating new intellectual properties (IPs) by remixing multiple existing IPs in a decentralized manner.&lt;&#x2F;p&gt;
&lt;p&gt;The protocol is built on the foundation of NFTs (Non-Fungible Tokens). Within this protocol, each intellectual property is represented as an NFT. It extends the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; standard, enabling users to generate a new NFT by remixing multiple existing NFTs. To ensure transparency and traceability in the creation process, the relationships between the new NFT and the original NFTs are recorded on the blockchain and made publicly accessible.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore, to enhance the liquidity of IP, users not only have the ability to remix NFTs they own but can also grant permission to others to participate in the creation of new NFTs using their own NFTs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The internet is flooded with fresh content every day, but with the traditional IP infrastructure, IP registration and licensing is a headache for digital creators. The rapid creation of content has eclipsed the slower pace of IP registration, leaving much of this content unprotected. This means digital creators can&#x27;t fairly earn from their work&#x27;s spread.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;&#x2F;th&gt;&lt;th&gt;Traditional IP Infrastructure&lt;&#x2F;th&gt;&lt;th&gt;Open IP Infrastructure&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;IP Registration&lt;&#x2F;td&gt;&lt;td&gt;Long waits, heaps of paperwork, and tedious back-and-forths.&lt;&#x2F;td&gt;&lt;td&gt;An NFT represents intellectual property; the owner of the NFT holds the rights to the IP.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;IP Licensing&lt;&#x2F;td&gt;&lt;td&gt;Lengthy discussions, legal jargon, and case-by-case agreements.&lt;&#x2F;td&gt;&lt;td&gt;A one-stop global IP licensing market that supports various licensing agreements.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;With this backdrop, we&#x27;re passionate about building an Open IP ecosystem tailored for today&#x27;s digital creators. Here, with just a few clicks, creators can register, license, and monetize their content globally, without geographical or linguistic barriers.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords “MUST,” “MUST NOT,” “REQUIRED,” “SHALL,” “SHALL NOT,” “SHOULD,” “SHOULD NOT,” “RECOMMENDED,” “MAY,” and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Interface&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;This protocol standardizes how to remix multiple existing NFTs and create a new NFT derivative work (known as a combo), while their relationships can be traced on the blockchain. It contains three core modules, remix module, network module, and license module.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;remix-module&quot;&gt;Remix Module&lt;&#x2F;h3&gt;
&lt;p&gt;This module extends the ERC-721 standard and enables users to create a new NFT by remixing multiple existing NFTs, whether they’re ERC-721 or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.10&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC721X&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Events&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emits when a combo is minted.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The owner address of the newly minted combo&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; comboId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The newly minted combo identifier&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ComboMinted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; comboId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Structs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT&amp;#39;s collection address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT identifier&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Token&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The number of NFTs used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; licenseId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Which license to be used to verify this component&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Component&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        Token token&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; licenseId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Functions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Mints a NFT by remixing multiple existing NFTs.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; components&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFTs remixed to mint a combo&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The hash representing the algorithm about how to generate the combo&amp;#39;s metadata when remixing multiple existing NFTs.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        Component&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; components&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieve a combo&amp;#39;s components.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getComponents&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; comboId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Component&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;license-module&quot;&gt;License Module&lt;&#x2F;h3&gt;
&lt;p&gt;By default, users can only remix multiple NFTs they own to create new NFT derivative works. This module enables NFT holders to grant others permission to use their NFTs in the remixing process.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.10&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERC721X.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ILicense&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify the permission when minting a combo&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; user&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The minter&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; combo&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The new NFT to be minted by remixing multiple existing NFTs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; components&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The multiple existing NFTs used to mint the new combo&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        IERC721X&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;Token&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; combo&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        IERC721X&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;Component&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; components&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;network-module&quot;&gt;Network Module&lt;&#x2F;h3&gt;
&lt;p&gt;This module follows the singleton pattern and is used to track all relationships between the original NFTs and their NFT derivative works.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.10&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERC721X.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; INFTNetIndexer&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify if the `child` was created by remixing the `parent` with other NFTs.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; parent&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Any NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; child&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Any NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isParent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        IERC721X&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;Token&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        IERC721X&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;Token&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; child&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify if `a` and `b` have common `parent`s&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Any NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Any NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isSibling&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        IERC721X&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;Token&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; a&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        IERC721X&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;Token&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; IERC721X&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;Token&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; commonParents&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Return all parents of a `token`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; token&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Any NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; parents&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; All NFTs used to mint the `token`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getParents&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        IERC721X&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;Token&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;IERC721X&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;Token&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; parents&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The Open IP Protocol is built on the &quot;1 premise, 2 extensions, 1 constant&quot; principle.&lt;&#x2F;p&gt;
&lt;p&gt;The “1 premise” means that for any IP in the Open IP ecosystem, an NFT stands for that IP. So, if you have the NFT, you own the IP. That’s why the Open IP Protocol is designed as an extended protocol compatible with ERC-721.&lt;&#x2F;p&gt;
&lt;p&gt;The “2 extensions” refer to the diversification of IP licensing and remixing.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;IP licensing methods are diverse. For example, delegating an NFT to someone else is one type of licensing, setting a price for the number of usage rights is another type of licensing, and even pricing based on auction, AMM, or other pricing mechanisms can develop different licensing methods. Therefore, the license module is designed allowing various custom licensing methods.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;IP remixing rules are also diverse. When remixing multiple existing NFTs, whether to support ERC-1155, whether to limit the range of NFT selection, and whether the NFT is consumed after remixing, there is no standard. So, the remix module is designed to support custom remixing rules.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &quot;1 constant&quot; refers to the fact that the traceability information of IP licensing is always public and unchangeable. Regardless of how users license or remix IPs, the relationship between the original and new IPs remains consistent. Moreover, if all IP relationships are recorded in the same database, it would create a vast IP network. If other social or gaming dApps leverage this network, it can lead to entirely novel user experiences. Hence, this protocol&#x27;s network module is designed as a singleton.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal is fully backwards compatible with the existing ERC-721 standard, extending the standard with new functions that do not affect the core functionality.&lt;&#x2F;p&gt;
&lt;!-- TODO: add reference implementation --&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This standard highlights several security concerns that need attention:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Ownership and Permissions&lt;&#x2F;strong&gt;: Only the NFT owner or those granted by them should be allowed to remix NFTs into NFT derivative works. It&#x27;s vital to have strict access controls to prevent unauthorized creations.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Reentrancy Risks&lt;&#x2F;strong&gt;: Creating derivative works might require interacting with multiple external contracts, like the remix, license, and network modules. This could open the door to reentrancy attacks, so protective measures are necessary.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Gas Usage&lt;&#x2F;strong&gt;: Remixing NFTs can be computation-heavy and involve many contract interactions, which might result in high gas fees. It&#x27;s important to optimize these processes to keep costs down and maintain user-friendliness.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Simple NFT, Simplified ERC-721</title>
        <published>2023-10-29T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Xiang</name><uri>https://github.com/wenzhenxiang</uri>
	</author>
	
	<author>
		<name>Ben77</name><uri>https://github.com/ben2077</uri>
	</author>
	
	<author>
		<name>Mingshi S.</name><uri>https://github.com/newnewsms</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7561/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7561-simple-nft/16695" />
        

        <id>https://wg-eips.ritovision.com/7561/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7561"
            label="ERC-7561" />
        

        
        

        
        <summary type="html">Designed for contract wallet, removes safeTransferFrom, approve, setApprovalForAll, getApproved, isApprovedForAll functions from ERC-721</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7561/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC is a new NFT asset designed based on the user contract wallet (including account abstraction), and is forward compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;. To keep NFT assets simple, this ERC removes the &lt;code&gt;approve&lt;&#x2F;code&gt;, &lt;code&gt;setApprovalForAll&lt;&#x2F;code&gt;, &lt;code&gt;getApproved&lt;&#x2F;code&gt;, &lt;code&gt;isApprovedForAll&lt;&#x2F;code&gt; and &lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt; functions of ERC-721.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; defines Ethereum-based standard NFT that can be traded and transferred, but the essence of ERC-721 is based on the externally-owned account (EOA) wallet design. An EOA wallet has no state and code storage, and the smart contract wallet is different.&lt;&#x2F;p&gt;
&lt;p&gt;Almost all ERCs related to NFTs are add functions, but our opinion is the opposite. We think the NFT contract should be simpler, with more functions taken care of by the smart contract wallet.&lt;&#x2F;p&gt;
&lt;p&gt;Our proposal is to design a simpler NFT asset based on the smart contract wallet.&lt;&#x2F;p&gt;
&lt;p&gt;It aims to achieve the following goals:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Keep the NFT contract simple, only responsible for the &lt;code&gt;transferFrom&lt;&#x2F;code&gt; function.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;approve&lt;&#x2F;code&gt;, &lt;code&gt;getApproved&lt;&#x2F;code&gt;, &lt;code&gt;setApprovalForAll&lt;&#x2F;code&gt; and &lt;code&gt;isApprovedForAll&lt;&#x2F;code&gt; functions are not managed by the NFT contract. Instead, these permissions are managed at the user level, offering greater flexibility and control to users. This change not only enhances user autonomy but also mitigates certain risks  associated with the ERC-721 contract&#x27;s implementation of these functions.&lt;&#x2F;li&gt;
&lt;li&gt;Remove the &lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt; function. A better way to call the other party&#x27;s NFT assets is to access the other party&#x27;s own contract instead of directly accessing the NFT asset contract.&lt;&#x2F;li&gt;
&lt;li&gt;Forward compatibility with ERC-721 means that all NFT can be compatible with this proposal.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;Compliant contracts MUST implement the following interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.20&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC7561 Simple NFT interface &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See https:&#x2F;&#x2F;ercs.ethereum.org&#x2F;ERCS&#x2F;erc-7561&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7561&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to notify transfer NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the from&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the receive&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The transaction token id &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  Count all NFTs assigned to an owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; number of NFTs owned by `owner`, possibly zero&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Find the owner of an NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier for an NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address of the owner of the NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfer ownership of an NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the from&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT to transfer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The proposal is to simplify NFT standards by removing &lt;code&gt;approve&lt;&#x2F;code&gt;, &lt;code&gt;setApprovalForAll&lt;&#x2F;code&gt;, &lt;code&gt;getApproved&lt;&#x2F;code&gt;, &lt;code&gt;isApprovedForAll&lt;&#x2F;code&gt; and &lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt; functions. This simplification aims to enhance security, reduce complexity, and improve efficiency, making the standard more suitable for smart contract wallet environments while maintaining essential functionalities.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;As mentioned in the beginning, this ERC is forward compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;, ERC-721 is backward compatible with this ERC.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;forward compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.20&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERC7561.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;..&#x2F;..&#x2F;math&#x2F;SafeMath.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Standard ERC7561 NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0xc1b31357&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Implementation of the basic standard NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC7561&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7561&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Token name&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _name&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Token symbol&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _symbol&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; tokenId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _owners&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; owner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _balances&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _totalSupply&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _totalSupply&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;  returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;owner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;  returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _requireOwned&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;from &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;to &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; previousOwner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _update&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;previousOwner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; from&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _owners&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _requireOwned&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; owner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;owner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _update&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; from &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Execute the update&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;from &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt;         &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            unchecked&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                _balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;to &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            unchecked&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                _balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _owners&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; from&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;It should be noted that this ERC is not backward compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;, so there will be incompatibility with existing dapps.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Upgradeable Clone for Scalable Contracts</title>
        <published>2023-10-25T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Shogo Ochiai</name><uri>https://github.com/shogochiai</uri><email>shogo.ochiai@pm.me</email>
	</author>
	
	<author>
		<name>Kai Hiroi</name><uri>https://github.com/KaiHiroi</uri><email>kai.hiroi@pm.me</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7546/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7546-upgradeable-clone/16256" />
        

        <id>https://wg-eips.ritovision.com/7546/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7546"
            label="ERC-7546" />
        

        
        

        
        <summary type="html">An upgradeable, cloneable, horizontally extensible proxy pattern.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7546/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;It has been a significant challenge for developers attempting to create cloneable and upgradeable contracts on the Ethereum Virtual Machine (EVM). While &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2535&#x2F;&quot;&gt;ERC-2535&lt;&#x2F;a&gt; Diamonds and other existing proxy standards offer partial solutions, a comprehensive answer has remained elusive. Our proposal addresses this gap through the introduction of two main features.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;function-level-upgradeability&quot;&gt;Function-Level Upgradeability&lt;&#x2F;h3&gt;
&lt;p&gt;In alignment with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2535&#x2F;&quot;&gt;ERC-2535&lt;&#x2F;a&gt;, this functionality permits the selective redirection of implementation contracts for individual function calls. This granular control over upgrades allows for modifications on a per-function basis. Moreover, segmenting implementation contracts by function helps mitigate the limitations posed by the contract size cap (24.576kB as of EVM version Shanghai or earlier).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;factory-clone-friendly-simultaneous-upgradeability&quot;&gt;Factory&#x2F;Clone-Friendly &amp;amp; Simultaneous Upgradeability&lt;&#x2F;h3&gt;
&lt;p&gt;Drawing on the Beacon model from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1967&#x2F;&quot;&gt;ERC-1967&lt;&#x2F;a&gt;, our method aims to streamline the process of cloning and updating Proxy contracts simultaneously. This approach is designed to maintain consistent functionality across different instances, each with its own state. Typically, proxies are limited to basic upgradeability features or follow the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1167&#x2F;&quot;&gt;ERC-1167&lt;&#x2F;a&gt; standard. However, our solution combines both functionalities into a compact proxy.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Smart contract development often encounters hurdles due to the inherent limitations of the Ethereum Virtual Machine (EVM), such as the contract size limit and stack depth. Additionally, addressing vulnerabilities in both the smart contract logic and its compiler are persistent issues. While there is a desire to minimize reliance on trusted third parties for upgradeability, introducing complex governance structures for upgrade management can significantly increase the workload for crypto DevOps, adding to the apprehension developers may feel towards advancing their projects. This apprehension can restrict the complexity and innovation within smart contract development. Our approach seeks to simplify smart contract programming, making it more accessible and enjoyable. It does so by clearly delineating DevOps concerns from business logic, thereby enhancing codebase clarity, facilitating audits, and allowing for more focused analysis through Language Model (LM) techniques, tailored to specific infrastructure and domain needs.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;use-cases&quot;&gt;Use Cases&lt;&#x2F;h3&gt;
&lt;p&gt;Over time, various smart contract design patterns have been proposed and utilized. This &lt;em&gt;Upgradeable Clone Standard (UCS)&lt;&#x2F;em&gt; is intended for scenarios where these existing patterns may not suffice. To clarify it, we define some key terms:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Contract-Level Upgradeability&lt;&#x2F;strong&gt;: One Proxy contract corresponds to one Implementation contract, responsible for all logic of the Proxy.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Function-Level Upgradeability&lt;&#x2F;strong&gt;: One Proxy contract corresponds to multiple Implementation contracts, basically each responsible for a specific function.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Factory&lt;&#x2F;strong&gt;: A contract that clones Proxies with a common Implementation(s). In the context of upgradeability, it allows for the simultaneous upgrade of these cloned Proxies.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Here are the use cases:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;For basic needs without Upgradeability or a Factory, &lt;em&gt;Regular smart contract deployment&lt;&#x2F;em&gt; suffices.&lt;&#x2F;li&gt;
&lt;li&gt;When a Factory is needed without Upgradeability, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1167&#x2F;&quot;&gt;ERC-1167&lt;&#x2F;a&gt; is suitable.&lt;&#x2F;li&gt;
&lt;li&gt;For Contract-Level Upgradeability without a Factory, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1822&#x2F;&quot;&gt;ERC-1822&lt;&#x2F;a&gt; can be used.&lt;&#x2F;li&gt;
&lt;li&gt;For Contract-Level Upgradeability with a Factory, the Beacon from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1967&#x2F;&quot;&gt;ERC-1967&lt;&#x2F;a&gt; is applicable.&lt;&#x2F;li&gt;
&lt;li&gt;For Function-Level Upgradeability without a Factory, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2535&#x2F;&quot;&gt;ERC-2535&lt;&#x2F;a&gt; is available.&lt;&#x2F;li&gt;
&lt;li&gt;For Function-Level Upgradeability with a Factory, this &lt;em&gt;&lt;strong&gt;Upgradeable Clone Standard&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt; is the ideal choice.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7546&#x2F;.&#x2F;assets&#x2F;images&#x2F;usecases.svg&quot; alt=&quot;Fig. Use Cases&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;blockquote&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;In the EVM, contract accounts are characterized by four primary fields: &lt;em&gt;nonce&lt;&#x2F;em&gt;, &lt;em&gt;balance&lt;&#x2F;em&gt;, &lt;em&gt;code&lt;&#x2F;em&gt;, and &lt;em&gt;storage&lt;&#x2F;em&gt;. This ERC&#x27;s architecture modularizes these functionalities into three distinct types of contracts, each serving a specific purpose when combined to represent a single account:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Proxy Contract&lt;&#x2F;strong&gt;: Maintains the state of the contract account, such as nonce, balance, and storage. This contract delegatecalls to the &lt;em&gt;Function Contract&lt;&#x2F;em&gt; as registered in the &lt;em&gt;Dictionary Contract&lt;&#x2F;em&gt;, ensuring the state and logic are separated but effectively integrated.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Dictionary Contract&lt;&#x2F;strong&gt;: Acts as a dispatcher that routes function calls based on their selectors to the appropriate &lt;em&gt;Function Contract&lt;&#x2F;em&gt;. It manages the dynamic aspects of contract behavior, facilitating function upgrades and dynamic addressing. By externalizing this contract from the &lt;em&gt;Proxy Contract&lt;&#x2F;em&gt;, it becomes factory&#x2F;clone-friendly and supports simultaneous upgradeability.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Function (Implementation) Contract&lt;&#x2F;strong&gt;: Implements the executable logic for function calls. When delegatecalled by the &lt;em&gt;Proxy Contract&lt;&#x2F;em&gt;, it performs the actual computations or logic as defined in the contract&#x27;s code.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;This architecture not only aligns with the core attributes of an EVM contract account but also significantly enhances the modularity, upgradeability, and scalability of smart contracts by clarifying account state, function dispatching, and logic implementation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;proxy-contract&quot;&gt;Proxy Contract&lt;&#x2F;h3&gt;
&lt;p&gt;This contract requests the &lt;em&gt;Dictionary Contract&lt;&#x2F;em&gt; to retrieve the associated &lt;em&gt;Function Contract&lt;&#x2F;em&gt; address based on its function selector, and then delegatecall to it.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;storage-events&quot;&gt;Storage &amp;amp; Events&lt;&#x2F;h4&gt;
&lt;p&gt;This contract SHOULD store the &lt;em&gt;Dictionary Contract&lt;&#x2F;em&gt; address in the storage slot &lt;code&gt;0x267691be3525af8a813d30db0c9e2bad08f63baecf6dceb85e2cf3676cff56f4&lt;&#x2F;code&gt;, obtained as &lt;code&gt;bytes32(uint256(keccak256(&#x27;erc7546.proxy.dictionary&#x27;)) - 1)&lt;&#x2F;code&gt;, in accordance with the method defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1967&#x2F;&quot;&gt;ERC-1967&lt;&#x2F;a&gt;. This ensures that the address is stored in a secure and predictable slot.&lt;&#x2F;p&gt;
&lt;p&gt;Changes to the Dictionary address SHOULD emit events. When such an event is emitted, it MUST use the signature:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DictionaryUpgraded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; dictionary&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;functions&quot;&gt;Functions&lt;&#x2F;h4&gt;
&lt;p&gt;For every invocation made via &lt;code&gt;CALL&lt;&#x2F;code&gt; or &lt;code&gt;STATICCALL&lt;&#x2F;code&gt;, this contract MUST perform a delegatecall to the corresponding &lt;em&gt;Function Contract&lt;&#x2F;em&gt; address retrieved from the &lt;em&gt;Dictionary Contract&lt;&#x2F;em&gt; using the &lt;code&gt;getImplementation(bytes4 functionSelector)&lt;&#x2F;code&gt; function. This contract MUST also process the return value from this delegatecall to ensure the intended functionality is executed correctly. Furthermore, to avoid potential collisions with function selectors registered in the &lt;em&gt;Dictionary Contract&lt;&#x2F;em&gt;, the Proxy SHOULD NOT define any external functions.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;dictionary-contract&quot;&gt;Dictionary Contract&lt;&#x2F;h3&gt;
&lt;p&gt;This contract manages a mapping of function selectors to corresponding &lt;em&gt;Function Contract&lt;&#x2F;em&gt; addresses. It uses this mapping to handle requests from the &lt;em&gt;Proxy Contract&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;storage-events-1&quot;&gt;Storage &amp;amp; Events&lt;&#x2F;h4&gt;
&lt;p&gt;The Dictionary MUST maintain a mapping of function selectors to &lt;em&gt;Function Contract&lt;&#x2F;em&gt; addresses.&lt;&#x2F;p&gt;
&lt;p&gt;Changes to this mapping SHOULD be communicated through an event (or log).&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ImplementationUpgraded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; functionSelector&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; implementation&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;functions-1&quot;&gt;Functions&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;getimplementation&quot;&gt;&lt;code&gt;getImplementation&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;p&gt;This contract MUST implement this function to return &lt;em&gt;Function Implementation Contract&lt;&#x2F;em&gt; address.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getImplementation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; functionSelector&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; implementation&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;setimplementation&quot;&gt;&lt;code&gt;setImplementation&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;p&gt;This contract SHOULD implement this function to update or add new function selectors and their corresponding &lt;em&gt;Function Implementation Contract&lt;&#x2F;em&gt; addresses to the mapping.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setImplementation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; functionSelector&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; implementation&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;supportsinterface&quot;&gt;&lt;code&gt;supportsInterface&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;p&gt;This contract is RECOMMENDED to implement the &lt;code&gt;supportsInterface(bytes4 interfaceID)&lt;&#x2F;code&gt; function defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; to indicate which interfaces are supported by the contracts referenced in the mapping.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;supportsinterfaces&quot;&gt;&lt;code&gt;supportsInterfaces&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;p&gt;This contract is RECOMMENDED to implement the &lt;code&gt;supportsInterfaces()&lt;&#x2F;code&gt; to return a list of registered interfaceIDs.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterfaces&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;function-implementation-contract&quot;&gt;Function (Implementation) Contract&lt;&#x2F;h3&gt;
&lt;p&gt;This contract acts as the logic implementation contract that the &lt;em&gt;Proxy Contract&lt;&#x2F;em&gt; delegatecalls and it&#x27;s address is registered with the function selector in the &lt;em&gt;Dictionary Contract&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;storage-events-2&quot;&gt;Storage &amp;amp; Events&lt;&#x2F;h4&gt;
&lt;p&gt;This contract SHOULD NOT use its storage but SHOULD store to the &lt;em&gt;Proxy Contract&lt;&#x2F;em&gt; through delegatecall.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;em&gt;Proxy Contract&lt;&#x2F;em&gt; shares storage layout with several &lt;em&gt;Function Contracts&lt;&#x2F;em&gt;. For example, using sequential slot allocation starting from slot 0, as is the default compiler option, can lead to storage conflicts.&lt;&#x2F;p&gt;
&lt;p&gt;In order to prevent storage conflict, this contract MUST manage the storage layout properly. The matter of storage management techniques has been a subject of debate for years, both at the ERC level and the language level. However, there is still no definitive standard. Therefore, this ERC does not go into the specifics of storage management techniques.&lt;&#x2F;p&gt;
&lt;p&gt;It is RECOMMENDED to choose the storage management method that is considered most appropriate at the time.&lt;&#x2F;p&gt;
&lt;p&gt;For instance, the storage could be arranged according to useful storage layout patterns, such as &lt;em&gt;&lt;strong&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7201&#x2F;&quot;&gt;ERC-7201&lt;&#x2F;a&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;functions-2&quot;&gt;Functions&lt;&#x2F;h4&gt;
&lt;p&gt;This contract MUST have the same function selector registered in the &lt;em&gt;Dictionary Contract&lt;&#x2F;em&gt;. If not, the Proxy&#x27;s delegatecall will fail. So it is RECOMMENDED for each &lt;em&gt;Function Contract&lt;&#x2F;em&gt; to implement ERC-165&#x27;s &lt;code&gt;supportsInterface(bytes4 interfaceID)&lt;&#x2F;code&gt; to ensure that it correctly implements the function selector being registered when added to the Dictionary.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;comparison-with-erc-2535&quot;&gt;Comparison with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2535&#x2F;&quot;&gt;ERC-2535&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;While both this ERC and ERC-2535 offer &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7546&#x2F;#function-level-upgradeability&quot;&gt;Function-Level Upgradeability&lt;&#x2F;a&gt;, there is a key distinction in their approaches. ERC-2535 maintains a mapping of implementation contracts (referred to as Facets in ERC-2535) within the Proxy itself. In contrast, this ERC stores the mapping in an external &lt;em&gt;Dictionary Contract&lt;&#x2F;em&gt;. This externalization of the mapping facilitates another significant feature of this standard: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7546&#x2F;#factory-clone-friendly-simultaneous-upgradeability&quot;&gt;Factory&#x2F;Clone-Friendly &amp;amp; Simultaneous Upgradeability&lt;&#x2F;a&gt;. By separating the mapping from the Proxy, this design allows for easier cloning of contracts and their simultaneous upgrade, which is not as straightforward in the ERC-2535 framework.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7546&#x2F;.&#x2F;assets&#x2F;images&#x2F;comparison-with-diamond.svg&quot; alt=&quot;Fig. Comparison with Diamond&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;separating-the-dictionary-and-proxy-contracts&quot;&gt;Separating the Dictionary and Proxy contracts:&lt;&#x2F;h3&gt;
&lt;p&gt;The separation of the Dictionary from the Proxy was driven by aligning with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7546&#x2F;#factory-clone-friendly-simultaneous-upgradeability&quot;&gt;Factory&#x2F;Clone-Friendly &amp;amp; Simultaneous Upgradeability&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;To achieve this, the management functionality of &lt;em&gt;Function Implementation Contract&lt;&#x2F;em&gt; addresses were externalized as the &lt;em&gt;Dictionary Contract&lt;&#x2F;em&gt; instead of including them within the &lt;em&gt;Proxy Contract&lt;&#x2F;em&gt;, a concept akin to the Beacon Proxy approach.&lt;&#x2F;p&gt;
&lt;p&gt;If the functionality is within the &lt;em&gt;Proxy Contract&lt;&#x2F;em&gt;, each proxy requires its implementation to be upgraded.
By externalizing this, a common implementation can be cloned and upgraded simultaneously.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7546&#x2F;.&#x2F;assets&#x2F;images&#x2F;comparison-with-beacon.svg&quot; alt=&quot;Fig. Comparison with Beacon&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;utilizing-the-mapping-of-function-selectors-and-implementation-addresses&quot;&gt;Utilizing the mapping of function selectors and implementation addresses:&lt;&#x2F;h3&gt;
&lt;p&gt;The utilization of the mapping of function selectors to corresponding &lt;em&gt;Function Implementation Contract&lt;&#x2F;em&gt; addresses of the &lt;em&gt;Dictionary Contract&lt;&#x2F;em&gt; by the &lt;em&gt;Proxy Contract&lt;&#x2F;em&gt;, followed by delegatecalling to the returned implementation address, aligns with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7546&#x2F;#function-level-upgradeability&quot;&gt;Function-Level Upgradeability&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;By adopting this approach, the Proxy emulates the behavior of possessing a set of &lt;em&gt;Function Implementation Contracts&lt;&#x2F;em&gt; registered within the &lt;em&gt;Dictionary Contract&lt;&#x2F;em&gt;. This specification closely resembles the pattern outlined in the Diamond Standard.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;There are reference implementations and tests as a foundry project.&lt;&#x2F;p&gt;
&lt;p&gt;It includes the following contents:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Reference Implementations
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7546&#x2F;.&#x2F;assets&#x2F;src&#x2F;Proxy.sol&quot;&gt;Proxy Contract&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7546&#x2F;.&#x2F;assets&#x2F;src&#x2F;Dictionary.sol&quot;&gt;Dictionary Contract&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Tests
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7546&#x2F;.&#x2F;assets&#x2F;test&#x2F;Proxy.spec.t.sol&quot;&gt;Proxy Spec Test&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7546&#x2F;.&#x2F;assets&#x2F;test&#x2F;Dictionary.spec.t.sol&quot;&gt;Dictionary Spec Test&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7546&#x2F;.&#x2F;assets&#x2F;test&#x2F;UCS.usecase.t.sol&quot;&gt;UCS Usecase Test&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;delegation-of-implementation-management&quot;&gt;Delegation of Implementation Management&lt;&#x2F;h3&gt;
&lt;p&gt;This pattern of delegating all implementations for every call to the &lt;em&gt;Dictionary Contract&lt;&#x2F;em&gt; relies on the assumption that the &lt;em&gt;Dictionary Contract&lt;&#x2F;em&gt;&#x27;s admin acts in good faith and does not introduce vulnerabilities through negligence.&lt;&#x2F;p&gt;
&lt;p&gt;You should not connect your proxy with the &lt;em&gt;Dictionary Contract&lt;&#x2F;em&gt; provided by an untrusted admin. Moreover, providing an option to switch to another &lt;em&gt;Dictionary Contract&lt;&#x2F;em&gt; managed by a different (or potentially more trustworthy) admin is recommended.&lt;&#x2F;p&gt;
&lt;p&gt;While it is possible to store the &lt;em&gt;Dictionary Contract&lt;&#x2F;em&gt; address in the code area (e.g., using Solidity&#x27;s immutable or constant), it SHOULD be designed with caution, considering the possibility that if the &lt;em&gt;Dictionary Contract&lt;&#x2F;em&gt;&#x27;s admin is not the same as the &lt;em&gt;Proxy Contract&lt;&#x2F;em&gt;&#x27;s admin, the ability to manipulate the implementation could be permanently lost.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;storage-conflict&quot;&gt;Storage Conflict&lt;&#x2F;h3&gt;
&lt;p&gt;As mentioned in the above &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7546&#x2F;#storage-events&quot;&gt;Storage section&lt;&#x2F;a&gt;. This design pattern involves multiple &lt;em&gt;Function Implementation Contracts&lt;&#x2F;em&gt; sharing a single &lt;em&gt;Proxy Contract&lt;&#x2F;em&gt; storage. Therefore, it&#x27;s important to take care for preventing storage conflicts by using the storage management method that is considered most appropriate at the time.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;mismatch-function-selector&quot;&gt;Mismatch Function Selector&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;em&gt;Dictionary Contract&lt;&#x2F;em&gt; returns the &lt;em&gt;Function Implementation Contract&lt;&#x2F;em&gt; address based on the &lt;em&gt;Proxy Contract&lt;&#x2F;em&gt;&#x27;s invoked function selector.&lt;&#x2F;p&gt;
&lt;p&gt;If there is a mismatch between function selectors registered in the &lt;em&gt;Dictionary Contract&lt;&#x2F;em&gt; and those implemented in the &lt;em&gt;Function Implementation Contract&lt;&#x2F;em&gt;, the execution will fail. To prevent unexpected behavior, it&#x27;s recommended to check that the &lt;em&gt;Function Implementation Contract&lt;&#x2F;em&gt; includes the function selector (interface) being registered during the process for setting implementation address to the &lt;em&gt;Dictionary Contract&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;handling-of-call-and-staticcall&quot;&gt;Handling of CALL and STATICCALL&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;em&gt;Proxy Contract&lt;&#x2F;em&gt; is designed primarily to respond to &lt;code&gt;CALL&lt;&#x2F;code&gt; and &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; opcodes. Should a &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; be made to this &lt;em&gt;Proxy Contract&lt;&#x2F;em&gt;, it will attempt to request the &lt;em&gt;Dictionary Contract&lt;&#x2F;em&gt; for a corresponding implementation via the &lt;code&gt;getImplementation(bytes4 functionSelector)&lt;&#x2F;code&gt; function, using the stored &lt;em&gt;Dictionary Contract&lt;&#x2F;em&gt; address within its own storage. Although this action may not lead to the intended outcome if the calling contract&#x27;s storage layout does not align with expectations, it does not constitute a direct threat to the &lt;em&gt;Proxy Contract&lt;&#x2F;em&gt; itself. Developers are cautioned that invoking this &lt;em&gt;Proxy Contract&lt;&#x2F;em&gt; via &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; could result in unexpected and potentially non-functional outcomes, making it an unsuitable method for interaction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Inclusion lists</title>
        <published>2023-10-24T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>mike</name><uri>https://github.com/michaelneuder</uri>
	</author>
	
	<author>
		<name>Vitalik</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	<author>
		<name>Francesco</name><uri>https://github.com/fradamt</uri>
	</author>
	
	<author>
		<name>Terence</name><uri>https://github.com/terencechain</uri>
	</author>
	
	<author>
		<name>potuz</name><uri>https://github.com/potuz</uri>
	</author>
	
	<author>
		<name>Manav</name><uri>https://github.com/manav2401</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7547/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7547-inclusion-lists/17474" />
        

        <id>https://wg-eips.ritovision.com/7547/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7547"
            label="EIP-7547" />
        

        
        

        
        <summary type="html">Add an inclusion list mechanism to allow forced transaction inclusion.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7547/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Censorship resistance is a core value proposition of blockchains. Inclusion lists aim to provide a mechanism to improve the censorship resistance of Ethereum by allowing proposers to specify a set of transactions that must be promptly included for subsequent blocks to be considered valid.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Since the merge, validators have started outsourcing almost all block production to a specialized set of builders who compete to extract the most MEV (this is commonly referred to as Proposer-Builder Separation). As of October 2023, nearly 95% of blocks are built by builders rather than the proposer. While it is great that all proposers have access to competitive blocks through the &lt;code&gt;mev-boost&lt;&#x2F;code&gt; ecosystem, a major downside of externally built blocks is the fact that the builders ultimately decide what transactions to include or exclude. Without any forced transaction inclusion mechanism, the proposer is faced with a difficult choice: they either have no say on the transactions that get included, or they build the block locally (thus have the final say on transactions) and sacrifice some MEV rewards.&lt;&#x2F;p&gt;
&lt;p&gt;Inclusion lists aim to allow proposers to retain some authority by providing a mechanism by which transactions can be forcibly included. The simplest design is for the &lt;code&gt;slot N&lt;&#x2F;code&gt; proposer to specify a list of transactions that must be included in the block that is produced for their slot. However, this is not incentive-compatible because builders may choose to abstain from building blocks if the proposer sets some constraints on their behavior. This leads to the idea of &quot;forward&quot; inclusion lists, where the transactions specified by the &lt;code&gt;slot N&lt;&#x2F;code&gt; proposer are enforced in the &lt;code&gt;slot N+1&lt;&#x2F;code&gt; block. The naïve implementation of the forward inclusion lists presents a different issue of potentially exposing free data availability, which could be exploited to bloat the size of the chain without paying the requisite gas costs. The free data availability problem is solved with observations about nonce reuse and allowing multiple inclusion lists to be specified for each slot. With the incentive compatibility and free data availability problems addressed, we can more safely proceed with the implementation of inclusion lists.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_TRANSACTIONS_PER_INCLUSION_LIST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2**4 = 16&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_GAS_PER_INCLUSION_LIST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2**21&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MIN_SLOTS_FOR_INCLUSION_LIST_REQUEST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;reference-objects&quot;&gt;Reference Objects&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;class InclusionListSummaryEntry(Container):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address: ExecutionAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_limit: uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;class InclusionListSummary(Container)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    slot: Slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    proposer_index: ValidatorIndex&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    summary: List[InclusionListSummaryEntry, MAX_TRANSACTIONS_PER_INCLUSION_LIST]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;class SignedInclusionListSummary(Container):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    message: InclusionListSummary&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signature: BLSSignature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;class InclusionList(Container)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    summary: SignedInclusionListSummary&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    transactions: List[Transaction, MAX_TRANSACTIONS_PER_INCLUSION_LIST]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;class ExecutionPayload(Container):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    inclusion_list_summary: List[InclusionListSummaryEntry, MAX_TRANSACTIONS_PER_INCLUSION_LIST]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    inclusion_list_exclusions: List[uint64, MAX_TRANSACTIONS_PER_INCLUSION_LIST]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;class ExecutionPayloadHeader(Container):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    inclusion_list_summary_root: Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    inclusion_list_exclusions_root: Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;class BeaconBlockBody(Container):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    inclusion_list_summary: SignedInclusionListSummary&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;consensus-layer&quot;&gt;Consensus layer&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;high-level-overview&quot;&gt;High-level overview&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;slot N&lt;&#x2F;code&gt; proposal:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Proposer broadcasts a signed block and an inclusion list (summary and transactions objects) for &lt;code&gt;slot N+1&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Transactions will be included in &lt;code&gt;slot N&lt;&#x2F;code&gt; or &lt;code&gt;slot N+1&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Summaries include the originating address of the transactions and their respective gas limits.&lt;&#x2F;li&gt;
&lt;li&gt;Summaries are signed, but transactions are not.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;slot N&lt;&#x2F;code&gt; validation:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Validators only consider the block for validation and fork-choice if they have seen at least one inclusion list for that slot.&lt;&#x2F;li&gt;
&lt;li&gt;They consider the block invalid if the inclusion list transactions are not executable at the start of &lt;code&gt;slot N&lt;&#x2F;code&gt; or if the transactions&#x27; &lt;code&gt;maxFeePerGas&lt;&#x2F;code&gt; are not at least 12.5% higher than the current slot (to ensure the transactions will be valid in &lt;code&gt;slot N+1&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;slot N+1&lt;&#x2F;code&gt; validation:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The proposer for &lt;code&gt;slot N+1&lt;&#x2F;code&gt; builds their block along with a signed summary from the &lt;code&gt;slot N&lt;&#x2F;code&gt; proposer.&lt;&#x2F;li&gt;
&lt;li&gt;The payload includes a list of transaction indices from the &lt;code&gt;slot N&lt;&#x2F;code&gt; payload that satisfy some entry in the signed inclusion list summary.&lt;&#x2F;li&gt;
&lt;li&gt;The payload is considered valid if: (a) the execution conditions are met, including satisfying the inclusion list summary and being executable from the execution layer perspective, and (b) the consensus conditions are met with a proposer signature of the previous block.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;specific-changes&quot;&gt;Specific Changes&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;Beacon chain state transition spec:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;&lt;strong&gt;New&lt;&#x2F;strong&gt; &lt;code&gt;inclusion_list&lt;&#x2F;code&gt; object:&lt;&#x2F;em&gt; Introduce a new &lt;code&gt;inclusion_list&lt;&#x2F;code&gt; for the proposer to submit and nodes to process.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;&lt;strong&gt;Modified&lt;&#x2F;strong&gt; &lt;code&gt;ExecutionPayload&lt;&#x2F;code&gt; and &lt;code&gt;ExecutionPayloadHeader&lt;&#x2F;code&gt; objects:&lt;&#x2F;em&gt; Update these objects to meet the inclusion list requirements.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;&lt;strong&gt;Modified&lt;&#x2F;strong&gt; &lt;code&gt;BeaconBlockBody&lt;&#x2F;code&gt;:&lt;&#x2F;em&gt; Modified to cache the inclusion list summary.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;&lt;strong&gt;Modified&lt;&#x2F;strong&gt; &lt;code&gt;process_execution_payload&lt;&#x2F;code&gt; function:&lt;&#x2F;em&gt; Update this process to include checks for the inclusion list summary satisfaction.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Beacon chain fork-choice spec:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;&lt;strong&gt;New&lt;&#x2F;strong&gt; &lt;code&gt;is_inclusion_list_available&lt;&#x2F;code&gt; check:&lt;&#x2F;em&gt; Introduce a new check to determine if the inclusion list is available within the visibility window.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;&lt;strong&gt;New&lt;&#x2F;strong&gt; notification action:&lt;&#x2F;em&gt; Implement a new call to notify the Execution Layer (EL) client about a new inclusion list. The corresponding block is considered invalid if the EL client deems the inclusion list invalid.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Beacon chain P2P spec:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;&lt;strong&gt;New&lt;&#x2F;strong&gt; gossipnet and validation rules for inclusion list:&lt;&#x2F;em&gt; Define new rules for handling the inclusion list in the gossip network and validation.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;&lt;strong&gt;New&lt;&#x2F;strong&gt; RPC request and response network for inclusion list:&lt;&#x2F;em&gt; Establish a new network for sending and receiving inclusion lists.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Validator spec:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;&lt;strong&gt;New&lt;&#x2F;strong&gt; duty for &lt;code&gt;inclusion_list&lt;&#x2F;code&gt;:&lt;&#x2F;em&gt; Proposer to prepare and sign the inclusion list.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;&lt;strong&gt;Modified&lt;&#x2F;strong&gt; duty for &lt;code&gt;BeaconBlockBody&lt;&#x2F;code&gt;:&lt;&#x2F;em&gt; Update the duty to prepare the beacon block body to include the &lt;code&gt;inclusion_list_summary&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;execution-layer&quot;&gt;Execution layer&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;&lt;strong&gt;New&lt;&#x2F;strong&gt; &lt;code&gt;get_inclusion_list&lt;&#x2F;code&gt;:&lt;&#x2F;em&gt; Introduce a new function for proposers to retrieve inclusion lists.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;&lt;strong&gt;New&lt;&#x2F;strong&gt; &lt;code&gt;new_inclusion_list&lt;&#x2F;code&gt;:&lt;&#x2F;em&gt; Define a new function for nodes to validate the execution side of the inclusion list.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;&lt;strong&gt;Modified&lt;&#x2F;strong&gt; &lt;code&gt;forkchoice_updated&lt;&#x2F;code&gt;:&lt;&#x2F;em&gt; Update the function with a &lt;code&gt;payload_attribute&lt;&#x2F;code&gt; to include the inclusion list summary as part of the attribute.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;&lt;strong&gt;Modified&lt;&#x2F;strong&gt; &lt;code&gt;new_payload&lt;&#x2F;code&gt;:&lt;&#x2F;em&gt; Update the function for EL clients to verify that &lt;code&gt;payload_transactions&lt;&#x2F;code&gt; satisfy &lt;code&gt;payload.inclusion_list_summary&lt;&#x2F;code&gt; and &lt;code&gt;payload.inclusion_list_exclusions&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;&lt;strong&gt;New&lt;&#x2F;strong&gt; validation rules:&lt;&#x2F;em&gt; Implement new validation rules based on the changes introduced in the Execution-API spec.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;We consider a few design decisions present in this EIP.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;ReducedSummary&lt;&#x2F;code&gt; versus &lt;code&gt;Summary&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;The original proposal tries to improve data efficiency by using a &lt;code&gt;ReducedSummary&lt;&#x2F;code&gt; and a &lt;code&gt;Rebuilder&lt;&#x2F;code&gt;. This allows the full summary to be reconstructed.&lt;&#x2F;li&gt;
&lt;li&gt;This adds a lot of complexity to the spec, so in this initial version, we should consider just using the regular &lt;code&gt;Summary&lt;&#x2F;code&gt; and including that in the subsequent block.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Gas limit vs no limit.
&lt;ul&gt;
&lt;li&gt;One consideration is whether the inclusion list should have a gas limit or use the block’s gas limit.&lt;&#x2F;li&gt;
&lt;li&gt;Having a separate gas limit simplifies complexity but opens up the possibility for validators to outsource their inclusion list construction for side payments (e.g., if a block is full, the proposer could auction off space in the inclusion list for guaranteed inclusion in the subsequent block).&lt;&#x2F;li&gt;
&lt;li&gt;Alternatively, inclusion lists could be part of the block gas limit and only satisfied if the block gas limit is not full. However, this could lead to situations where the next block proposer intentionally fills up the block to ignore the inclusion list, albeit at the potential expense of paying to waste the gas.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Inclusion list ordering.
&lt;ul&gt;
&lt;li&gt;We assume that the inclusion list is processed at the top of the &lt;code&gt;slot N&lt;&#x2F;code&gt; block. Transactions in the inclusion list are evaluated for the pre-state of &lt;code&gt;slot N&lt;&#x2F;code&gt; but are only guaranteed to be included in &lt;code&gt;slot N+1&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Inclusion list transaction exclusion.
&lt;ul&gt;
&lt;li&gt;Inclusion list transactions proposed at &lt;code&gt;slot N&lt;&#x2F;code&gt; may be satisfied in the same slot (e.g., by being included in the &lt;code&gt;ExecutionPayload&lt;&#x2F;code&gt;). This is a side effect of validators using &lt;code&gt;mev-boost&lt;&#x2F;code&gt; because they don’t know the contents of the block they propose.&lt;&#x2F;li&gt;
&lt;li&gt;Due to this, there exists an exclusion field, a node looks at each transaction in the payload’s &lt;code&gt;inclusion_list_exclusion&lt;&#x2F;code&gt; field and makes sure it matches with a transaction in the current inclusion list. When there’s a match, we remove that transaction from the inclusion list summary.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;mev-boost&lt;&#x2F;code&gt; compatibility.
&lt;ul&gt;
&lt;li&gt;There are no significant changes to &lt;code&gt;mev-boost&lt;&#x2F;code&gt;. Like any other hard fork, &lt;code&gt;mev-boost&lt;&#x2F;code&gt;, relays, and builders must adjust their beacon nodes.&lt;&#x2F;li&gt;
&lt;li&gt;Builders must know that execution payloads that don’t satisfy the inclusion list summary will be invalid.&lt;&#x2F;li&gt;
&lt;li&gt;Relays may have additional duties to verify such constraints before passing them to validators for signing.&lt;&#x2F;li&gt;
&lt;li&gt;When receiving the header, validators can check that the &lt;code&gt;inclusion_list_summary_root&lt;&#x2F;code&gt; matches their local version and skip building a block if there’s a mismatch, using the local block instead.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Syncing using by range or by root.
&lt;ul&gt;
&lt;li&gt;To consider a block valid, a node syncing to the latest head must also have an inclusion list.&lt;&#x2F;li&gt;
&lt;li&gt;A block without an inclusion list cannot be processed during syncing.&lt;&#x2F;li&gt;
&lt;li&gt;To address this, there is a parameter called &lt;code&gt;MIN_SLOTS_FOR_INCLUSION_LIST_REQUEST&lt;&#x2F;code&gt;. A node can skip inclusion list checks if the block’s slot plus this parameter is lower than the current slot.&lt;&#x2F;li&gt;
&lt;li&gt;This is similar to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt;, where a node skips blob sidecar data availability checks if it’s outside the retention window.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces backward incompatible changes to the block validation rule set on the consensus layer and must be accompanied by a hard fork. These changes do not break anything related to current user activity and experience.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The main potential issue is around the incentivization of the inclusion lists. If the &lt;code&gt;slot N&lt;&#x2F;code&gt; proposer constructs an inclusion list that negatively impacts the rewards of the &lt;code&gt;slot N+1&lt;&#x2F;code&gt; proposer, the &lt;code&gt;slot N+1&lt;&#x2F;code&gt; proposer may attempt to bribe the &lt;code&gt;slot N&lt;&#x2F;code&gt; proposer to publish an empty list. This isn&#x27;t a direct attack on the protocol, but rather a profit-sharing mechanism by which the inclusion list would go unutilized. It seems likely these commitment games could be played no matter the censorship resistance scheme in place, but this remains an active area of research.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EVM arbitrary precision decimal math</title>
        <published>2023-10-22T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>1m1</name><uri>https://github.com/1m1-github</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7543/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/decimal-math-on-evm/16194" />
        

        <id>https://wg-eips.ritovision.com/7543/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7543"
            label="EIP-7543" />
        

        
        

        
        <summary type="html">This EIP adds OPCODEs to allow arbitrary precision decimal float calculation of all elementary functions with precise gas enumeration.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7543/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP adds &lt;em&gt;arbitrary precision decimal float&lt;&#x2F;em&gt; OPCODEs for arithmetic via DECADD, DECNEG, DECMUL, DECINV and expression of all elementary functions via DECEXP, DECLN, DECSIN. All decimal values upto the maximal precision allowed by a int256 coefficient and exponent are represented exactly, as c*10^q. All implemented algorithms converge for all inputs given enough precision, as chosen by the user. All calculations are deterministic and gas is precisely embedded bottom-up. Allowing arbitrary precision decimal elementary functions invites the worlds of mathematical finance, machine learning, science, digital art, games and others to Ethereum. The implementation is functional.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, to take a power, a^b, of non integer values, requires vast amounts of Solidity code.
The simplest task in trading e.g. is to convert volatilities from yearly to daily, which involves taking the 16th root.&lt;&#x2F;p&gt;
&lt;p&gt;Giving users&#x2F;devs the same ability that scientific calculators have allows for the creation of apps with higher complexity.&lt;&#x2F;p&gt;
&lt;p&gt;The files &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7543&#x2F;.&#x2F;assets&#x2F;BlackScholes.yul&quot;&gt;BlackScholes.yul&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7543&#x2F;.&#x2F;assets&#x2F;Neuron.yul&quot;&gt;Neuron.yul&lt;&#x2F;a&gt; demonstrate how these OPCODEs simplify numerical smart contract code.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-decimal&quot;&gt;Why decimal?&lt;&#x2F;h3&gt;
&lt;p&gt;To represent a simple value like 0.1 in binary requires infinite many digits and is therefore not exactly represently in a finite binary machine. Decimal types are much closer to the vast majority of numerical calculations run by humans.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;evm&quot;&gt;eVm&lt;&#x2F;h3&gt;
&lt;p&gt;The EVM is a virtual machine and thereby not restricted by hardware. Usually, assembly languages provide OPCODES that are mimic the ability of hardware. In a virtual machine, we have no such limitations and nothing stops us from adding more complex OPCODEs, as long as fair gas is provided. At the same time, we do not want to clutter the OPCODEs library. EXP, LN and SIN are universal functions that open the path to: powers, trigonometry, integrals, differential equations, machine learning, digital art, etc.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;decimal&quot;&gt;Decimal&lt;&#x2F;h3&gt;
&lt;p&gt;A decimal is defined as&lt;&#x2F;p&gt;
&lt;p&gt;c * 10^q&lt;&#x2F;p&gt;
&lt;p&gt;where c and q are int256.&lt;&#x2F;p&gt;
&lt;p&gt;Notationwise:
a = ac * 10^aq
b = bc * 10^bq
etc.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;opcode-defs&quot;&gt;OPCODE defs&lt;&#x2F;h3&gt;
&lt;p&gt;0xd0 DECADD a+b -&amp;gt; c    : (ac, aq, bc, bq, precision) -&amp;gt; (cc, cq)
0xd1 DECNEG  -a -&amp;gt; b    : (ac, aq) -&amp;gt; (bc, bq)
0xd2 DECMUL a*b -&amp;gt; c    : (ac, aq, bc, bq, precision) -&amp;gt; (cc, cq)
0xd3 DECINV 1&#x2F;a -&amp;gt; b    : (ac, aq, precision) -&amp;gt; (bc, bq)
0xd4 DECEXP exp(a) -&amp;gt; b : (ac, aq, precision, steps) -&amp;gt; (bc, bq)
0xd5 DECLN   ln(a) -&amp;gt; b : (ac, aq, precision, steps) -&amp;gt; (bc, bq)
0xd6 DECSIN sin(a) -&amp;gt; b : (ac, aq, precision, steps) -&amp;gt; (bc, bq)&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;precision&lt;&#x2F;code&gt; is the # of digits kept during all calculations. &lt;code&gt;steps&lt;&#x2F;code&gt; for DECEXP and DECSIN are the # of Taylor expansion steps. &lt;code&gt;steps&lt;&#x2F;code&gt; for DECLN is the depth of the continued fractions expansion.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-these-functions&quot;&gt;Why these functions?&lt;&#x2F;h3&gt;
&lt;p&gt;The proposed functions (+,-,*,&#x2F;,exp,ln,sin) form a small set that combined enable all calculation of all elementary functions, which includes the sets of sums, products, roots and compositions of finitely many polynomial, rational, trigonometric, hyperbolic, and exponential functions, including their inverse functions.&lt;&#x2F;p&gt;
&lt;p&gt;a^b = exp(b * ln(a)) gives us powers and polynomials.
cos(a) = sin(tau&#x2F;4-a), tan(a)=sin(a)&#x2F;cos(a), etc., gives us all of trigonometry.&lt;&#x2F;p&gt;
&lt;p&gt;Together with arithmetic, we get all elementary functions.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;decneg-instead-of-decsub&quot;&gt;DECNEG instead of DECSUB&lt;&#x2F;h3&gt;
&lt;p&gt;Negation is a more general operation vs subtraction. OPCODEs should be as fundamental as possible and as complex as desirable.
For the same reason, we have DECINV instead of DECDIV.&lt;&#x2F;p&gt;
&lt;p&gt;DECSUB(a,b) = DECADD(a,DECNEG(b))
DECDIV(a,b) = DECMUL(a,DECINV(b))&lt;&#x2F;p&gt;
&lt;h3 id=&quot;decexp-decsin-via-taylor-series&quot;&gt;DECEXP, DECSIN via Taylor series&lt;&#x2F;h3&gt;
&lt;p&gt;The Taylor series of exp and sin converge everywhere and fast. The error falls as fast as the factorial of steps.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;decln-via-continued-fractions&quot;&gt;DECLN via continued fractions&lt;&#x2F;h3&gt;
&lt;p&gt;Ln converges fast using continued fractions within the interval ]0,2]. The implementation scales the input into this interval and scales the result back correctly.&lt;&#x2F;p&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;gas&quot;&gt;gas&lt;&#x2F;h3&gt;
&lt;p&gt;All the above OPCODEs are deterministic, hence the gas cost can be determined. At the same time, the calculations are complex and depend on the input.&lt;&#x2F;p&gt;
&lt;p&gt;It is crucial to have accurate gas costs to avoid energy attacks on nodes.&lt;&#x2F;p&gt;
&lt;p&gt;To this end, the underlying uint256 lib can be wrapped with gas accumulation, as found in the reference implementation in ..&#x2F;assets&#x2F;eip-EVM+&#x2F;uint256_wrapped.go. This gives a bottom-up approach to calculating gas, by running the OPCODE.&lt;&#x2F;p&gt;
&lt;p&gt;Because the EVM interprator expects the gas cost before actually running the OPCODE, we are running the OPCODE twice. the first run, identical to the second, is to get the bottom-up gas cost, which is then doubled to account for the actual run plus the gas calculation. On top, we add a fixed emulation cost.&lt;&#x2F;p&gt;
&lt;p&gt;This gives an embedded gas calculation, which works well for complex OPCODEs (see gasEVMPlusEmulate in ..&#x2F;assets&#x2F;eip-EVM+&#x2F;gasEVMPlusEmulate.go).&lt;&#x2F;p&gt;
&lt;p&gt;To remove the double gas, we could find an upper bound on gas usage dependent on the function inputs.
Alternatively, a future EIP would suggest the following: allow contract code to run whilst accumulating gas (at runtime) and panicking in case of limit breach, without requiring the cost in advance. This only works for contract code that is pure, defined as code that only depends on the user input and the inner bytecode of the contract. Pure contracts cannot use state from the chain, nor make calls to other contracts. pure mathematical functions would e.g. be pure contracts. pure contracts are fully deterministic given the input, allowing a user to estimate gas costs offline (cheaper) and the EVM to panic at runtime, without knowing gas in advance.&lt;&#x2F;p&gt;
&lt;p&gt;Since the costs depend on the input, a fuzzing would give us close to the worst cases (TODO).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;p&gt;Since the EVM allows contracts to deploy with invalid code, there could be previously invalid code that becomes valid when adding a new OPCODE. The EVM could be designed to expect a version tag at the beginning of all bytecode or (not xor) to only deploy valid code. This is an issue for any new OPCODE.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;..&#x2F;assets&#x2F;eip-EVM+&#x2F;decimal_float_test.go&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The reference implementation is found in ..&#x2F;assets&#x2F;eip-EVM+&#x2F;decimal_float.go&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;There are no security considerations, as long as numerical correctness is guaranteed and gas is collected fairly.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>eth&#x2F;70 - available-blocks-extended protocol</title>
        <published>2023-10-21T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Ahmad Bitar</name><uri>https://github.com/smartprogrammer93</uri><email>smartprogrammer@windowslive.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7542/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-eth-70-available-blocks-extended-protocol-handshake/16188" />
        

        <id>https://wg-eips.ritovision.com/7542/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="networking"
                label="Networking" />
            
        

        
        <category
            term="tag:eip:7542"
            label="EIP-7542" />
        

        
        

        
        <summary type="html">Adds more info in the handshake about available block range and adds message types to request block ranges and the send them</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7542/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The purpose of this EIP is to introduce a method that allows an Ethereum node to communicate the range of blocks it has available. By knowing the block range a node can serve, peers can make more informed decisions when choosing whom to request blocks from or whom to connect to, especially when looking for specific block ranges. This can lead to more efficient network behavior.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP proposes extending the Ethereum wire protocol (&lt;code&gt;eth&lt;&#x2F;code&gt;) handshake, introducing a new version, &lt;code&gt;eth&#x2F;70&lt;&#x2F;code&gt;, which will contain information regarding the block range a node can serve. Furthermore, it extends the protocol with two new message types to share the updated block ranges when requested.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;In a first stage of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4444&#x2F;&quot;&gt;EIP-4444&lt;&#x2F;a&gt;, some nodes will still need to serve the historical data of the chain and others might be interested in starting to prune it. Currently, nodes need to connect to peers and request specific blocks to determine if a peer has the requested data. This can be inefficient, leading to unnecessary data requests and wasting both bandwidth and time. Consequently, this change empowers nodes that still want to retrieve historical data from the network to do so efficiently.&lt;&#x2F;p&gt;
&lt;p&gt;As a bonus, This change enhances the efficiency of synchronization by allowing a node to determine if a peer, potentially still in the process of syncing, has the necessary blocks available, thereby avoiding unnecessary block requests and potential empty responses.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Advertise a new &lt;code&gt;eth&lt;&#x2F;code&gt; protocol capability (version) at &lt;code&gt;eth&#x2F;70&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The old &lt;code&gt;eth&#x2F;69&lt;&#x2F;code&gt; protocol should still be kept alive side-by-side, until &lt;code&gt;eth&#x2F;70&lt;&#x2F;code&gt; is sufficiently adopted by implementors.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Modify the &lt;code&gt;Status (0x00)&lt;&#x2F;code&gt; message for &lt;code&gt;eth&#x2F;70&lt;&#x2F;code&gt; to add an additional &lt;code&gt;blockRange&lt;&#x2F;code&gt; field right after the &lt;code&gt;forkid&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Current packet for &lt;code&gt;eth&#x2F;69&lt;&#x2F;code&gt;: &lt;code&gt;[version: P, networkid: P, blockhash: B_32, genesis: B_32, forkid]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;New packet for &lt;code&gt;eth&#x2F;70&lt;&#x2F;code&gt;: &lt;code&gt;[version: P, networkid: P, blockhash: B_32, genesis: B_32, forkid blockRange]&lt;&#x2F;code&gt;,
where &lt;code&gt;blockRange&lt;&#x2F;code&gt; is &lt;code&gt;[startBlock: uint64, endBlock: uint64]&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Introduce two new message types:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;RequestBlockRange (0x0b)&lt;&#x2F;code&gt; - A message from a node to request the current block range of a peer.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SendBlockRange (0x0c): [startBlock: uint64, endBlock: uint64]&lt;&#x2F;code&gt; - The response to &lt;code&gt;RequestBlockRange&lt;&#x2F;code&gt;, informing the requesting node of the current available block range of the peer.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Upon connecting using &lt;code&gt;eth&#x2F;70&lt;&#x2F;code&gt;, nodes should exchange the &lt;code&gt;Status&lt;&#x2F;code&gt; message. Afterwards, they can use the &lt;code&gt;RequestBlockRange&lt;&#x2F;code&gt; and &lt;code&gt;SendBlockRange&lt;&#x2F;code&gt; messages to keep informed about peer block range changes.&lt;&#x2F;p&gt;
&lt;p&gt;Nodes must retain connections regardless of a peer&#x27;s available block range, with an exception, if a node&#x27;s peer slots are full and it lacks connections to peers with the necessary block range, it may disconnect to seek such peers.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Including the available block range in the &lt;code&gt;eth&lt;&#x2F;code&gt; handshake allows for immediate understanding of peer capabilities. This can lead to more efficient networking as nodes can prioritize connections based on the data they need.
The new message types are introduced to allow nodes to request updated available block range from other nodes since the range can change by the node syncing or pruning blocks.
Maintaining connections with peers that don&#x27;t have the desired range ensures network resilience, while the exception facilitates efficient block sync under full peer capacity.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP extends the &lt;code&gt;eth&lt;&#x2F;code&gt; protocol handshake in a backwards incompatible manner and proposes the introduction of a new version, &lt;code&gt;eth&#x2F;70&lt;&#x2F;code&gt;. However, &lt;code&gt;devp2p&lt;&#x2F;code&gt; allows for multiple versions of the same wire protocol to run concurrently. Hence, nodes that have not been updated can continue using older versions like &lt;code&gt;eth&#x2F;69&lt;&#x2F;code&gt;, &lt;code&gt;eth&#x2F;68&lt;&#x2F;code&gt; or &lt;code&gt;eth&#x2F;67&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP doesn&#x27;t affect the consensus engine and doesn&#x27;t necessitate a hard fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Testing will involve ensuring that nodes can correctly communicate and understand the block range information during the handshake. Additionally, it will involve ensuring nodes can correctly request and share updated block range when requested.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This change is not a standardization of not storing and serving historical blocks before the implementation of alternative historical blocks storage solutions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Multiplicative Tokens</title>
        <published>2023-10-18T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Gavin John</name><uri>https://github.com/Pandapip1</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7538/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/multiplicative-tokens/16149" />
        

        <id>https://wg-eips.ritovision.com/7538/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7538"
            label="ERC-7538" />
        

        
        

        
        <summary type="html">Incorporates a multiplier field to ERC-20 and ERC-1155 for fractional token values</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7538/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP extends &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1046&#x2F;&quot;&gt;ERC-1046&lt;&#x2F;a&gt;-compatible token types (notably, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; by introducing a &lt;code&gt;multiplier&lt;&#x2F;code&gt; field to the metadata schema, altering how user-facing balances are displayed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Many projects necessitate the creation of various types of tokens, both fungible and non-fungible. While certain standards are ideal for this purpose, they lack support for fractional tokens. Additionally, some tokens may require built-in inflation or deflation mechanisms, or may wish to allow transfers in unconventional increments, such as &lt;code&gt;0.5&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;MultiplierMetadata&lt;&#x2F;code&gt; interface MUST be implemented in the resolved ERC-1046 &lt;code&gt;tokenURI&lt;&#x2F;code&gt; of tokens that use a &lt;code&gt;multiplier&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MultiplierMetadata&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * The positive multiplier for generating user-facing representation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Defaults to 1 if undefined.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * This is an EXACT VALUE, base 10. Beware of floating-point error!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    multiplier&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; undefined&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Decimals are no longer supported&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    decimals&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; never&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Token contracts MUST NOT have a method named &lt;code&gt;decimals&lt;&#x2F;code&gt; if a &lt;code&gt;multiplier&lt;&#x2F;code&gt; is used.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Employing strings for numerical representation offers enhanced precision when needed. The use of a multiplier instead of decimals facilitates increments other than powers of 10, and ensures seamless handling of inflation or deflation. Utilizing ERC-1046 promotes gas efficiency in the majority of cases.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is incompatible with any method named &lt;code&gt;decimals&lt;&#x2F;code&gt; in ERC-1046-compatible token standards or the ERC-1046 &lt;code&gt;decimals&lt;&#x2F;code&gt; field.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Improper handling of the &lt;code&gt;multiplier&lt;&#x2F;code&gt; field may lead to rounding errors, potentially exploitable by malicious actors. Contracts MUST process multipliers accurately to avoid such issues. The multiplier MUST be positive (‘0’ is not positive) to avert display issues. Particularly large or small multipliers MAY pose display challenges, yet wallets SHOULD endeavor to display the full number without causing UI&#x2F;UX or additional security issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Asynchronous ERC-4626 Tokenized Vaults</title>
        <published>2023-10-18T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Jeroen Offerijns</name><uri>https://github.com/hieronx</uri>
	</author>
	
	<author>
		<name>Alina Sinelnikova</name><uri>https://github.com/ilinzweilin</uri>
	</author>
	
	<author>
		<name>Vikram Arun</name><uri>https://github.com/vikramarun</uri>
	</author>
	
	<author>
		<name>Joey Santoro</name><uri>https://github.com/joeysantoro</uri>
	</author>
	
	<author>
		<name>Farhaan Ali</name><uri>https://github.com/0xfarhaan</uri>
	</author>
	
	<author>
		<name>João Martins</name><uri>https://github.com/0xTimepunk</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7540/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7540-asynchronous-erc-4626-tokenized-vaults/16153" />
        

        <id>https://wg-eips.ritovision.com/7540/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7540"
            label="ERC-7540" />
        

        
        

        
        <summary type="html">Extension of ERC-4626 with asynchronous deposit and redemption support</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7540/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The following standard extends &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4626&#x2F;&quot;&gt;ERC-4626&lt;&#x2F;a&gt; by adding support for asynchronous deposit and redemption flows. The async flows are called Requests.&lt;&#x2F;p&gt;
&lt;p&gt;New methods are added to asynchronously Request a deposit or redemption, and view the status of the Request. The existing &lt;code&gt;deposit&lt;&#x2F;code&gt;, &lt;code&gt;mint&lt;&#x2F;code&gt;, &lt;code&gt;withdraw&lt;&#x2F;code&gt;, and &lt;code&gt;redeem&lt;&#x2F;code&gt; ERC-4626 methods are used for executing Claimable Requests.&lt;&#x2F;p&gt;
&lt;p&gt;Implementations can choose whether to add asynchronous flows for deposits, redemptions, or both.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The ERC-4626 Tokenized Vaults standard has helped to make yield-bearing tokens more composable across decentralized finance. The standard is optimized for atomic deposits and redemptions up to a limit. If the limit is reached, no new deposits or redemptions can be submitted.&lt;&#x2F;p&gt;
&lt;p&gt;This limitation does not work well for any smart contract system with asynchronous actions or delays as a prerequisite for interfacing with the Vault (e.g. real-world asset protocols, undercollateralized lending protocols, cross-chain lending protocols, liquid staking tokens, or insurance safety modules).&lt;&#x2F;p&gt;
&lt;p&gt;This standard expands the utility of ERC-4626 Vaults for asynchronous use cases. The existing Vault interface (&lt;code&gt;deposit&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;withdraw&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;mint&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;redeem&lt;&#x2F;code&gt;) is fully utilized to claim asynchronous Requests.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions:&lt;&#x2F;h3&gt;
&lt;p&gt;The existing definitions from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4626&#x2F;&quot;&gt;ERC-4626&lt;&#x2F;a&gt; apply. In addition, this spec defines:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Request: a request to enter (&lt;code&gt;requestDeposit&lt;&#x2F;code&gt;) or exit (&lt;code&gt;requestRedeem&lt;&#x2F;code&gt;) the Vault&lt;&#x2F;li&gt;
&lt;li&gt;Pending: the state where a Request has been made but is not yet Claimable&lt;&#x2F;li&gt;
&lt;li&gt;Claimable: the state where a Request is processed by the Vault enabling the user to claim corresponding &lt;code&gt;shares&lt;&#x2F;code&gt; (for async deposit) or &lt;code&gt;assets&lt;&#x2F;code&gt; (for async redeem)&lt;&#x2F;li&gt;
&lt;li&gt;Claimed: the state where a Request is finalized by the user and the user receives the output token (e.g. &lt;code&gt;shares&lt;&#x2F;code&gt; for a deposit Request)&lt;&#x2F;li&gt;
&lt;li&gt;Claim function: the corresponding Vault method to bring a Request to Claimed state (e.g. &lt;code&gt;deposit&lt;&#x2F;code&gt; or &lt;code&gt;mint&lt;&#x2F;code&gt; claims &lt;code&gt;shares&lt;&#x2F;code&gt; from &lt;code&gt;requestDeposit&lt;&#x2F;code&gt;). Lowercase claim always describes the verb action of calling a Claim function.&lt;&#x2F;li&gt;
&lt;li&gt;asynchronous deposit Vault: a Vault that implements asynchronous Requests for deposit flows&lt;&#x2F;li&gt;
&lt;li&gt;asynchronous redemption Vault: a Vault that implements asynchronous Requests for redemption flows&lt;&#x2F;li&gt;
&lt;li&gt;fully asynchronous Vault: a Vault that implements asynchronous Requests for both deposit and redemption flows&lt;&#x2F;li&gt;
&lt;li&gt;controller: owner of the Request, who can manage any actions related to the Request including claiming the &lt;code&gt;assets&lt;&#x2F;code&gt; or &lt;code&gt;shares&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;operator: an account that can manage Requests on behalf of another account.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;request-flows&quot;&gt;Request Flows&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7540&#x2F;&quot;&gt;ERC-7540 Vaults&lt;&#x2F;a&gt; MUST implement one or both of asynchronous deposit and redemption Request flows. If either flow is not implemented in a Request pattern, it MUST use the ERC-4626 standard synchronous interaction pattern.&lt;&#x2F;p&gt;
&lt;p&gt;All ERC-7540 asynchronous tokenized Vaults MUST implement ERC-4626 with overrides for certain behavior described below.&lt;&#x2F;p&gt;
&lt;p&gt;Asynchronous deposit Vaults MUST override the ERC-4626 specification as follows:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The &lt;code&gt;deposit&lt;&#x2F;code&gt; and &lt;code&gt;mint&lt;&#x2F;code&gt; methods do not transfer &lt;code&gt;assets&lt;&#x2F;code&gt; to the Vault, because this already happened on &lt;code&gt;requestDeposit&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;previewDeposit&lt;&#x2F;code&gt; and &lt;code&gt;previewMint&lt;&#x2F;code&gt; MUST revert for all callers and inputs.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Asynchronous redeem Vaults MUST override the ERC-4626 specification as follows:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The &lt;code&gt;redeem&lt;&#x2F;code&gt; and &lt;code&gt;withdraw&lt;&#x2F;code&gt; methods do not transfer &lt;code&gt;shares&lt;&#x2F;code&gt; to the Vault, because this already happened on &lt;code&gt;requestRedeem&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;owner&lt;&#x2F;code&gt; field of &lt;code&gt;redeem&lt;&#x2F;code&gt; and &lt;code&gt;withdraw&lt;&#x2F;code&gt; SHOULD be renamed to &lt;code&gt;controller&lt;&#x2F;code&gt;, and the controller MUST be &lt;code&gt;msg.sender&lt;&#x2F;code&gt; unless the &lt;code&gt;controller&lt;&#x2F;code&gt; has approved the &lt;code&gt;msg.sender&lt;&#x2F;code&gt; as an operator.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;previewRedeem&lt;&#x2F;code&gt; and &lt;code&gt;previewWithdraw&lt;&#x2F;code&gt; MUST revert for all callers and inputs.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;request-lifecycle&quot;&gt;Request Lifecycle&lt;&#x2F;h3&gt;
&lt;p&gt;After submission, Requests go through Pending, Claimable, and Claimed stages. An example lifecycle for a deposit Request is visualized in the table below.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;strong&gt;State&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;strong&gt;User&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;strong&gt;Vault&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Pending&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;requestDeposit(assets, controller, owner)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;asset.transferFrom(owner, vault, assets)&lt;&#x2F;code&gt;; &lt;code&gt;pendingDepositRequest[controller] += assets&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Claimable&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;em&gt;Internal Request fulfillment&lt;&#x2F;em&gt;:  &lt;code&gt;pendingDepositRequest[controller] -= assets&lt;&#x2F;code&gt;; &lt;code&gt;claimableDepositRequest[controller] += assets&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Claimed&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;deposit(assets, receiver, controller)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;claimableDepositRequest[controller] -= assets&lt;&#x2F;code&gt;; &lt;code&gt;vault.balanceOf[receiver] += shares&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Note that &lt;code&gt;maxDeposit&lt;&#x2F;code&gt; increases and decreases in sync with &lt;code&gt;claimableDepositRequest&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Requests MUST NOT skip or otherwise short-circuit the Claim state. In other words, to initiate and claim a Request, a user MUST call both request* and the corresponding Claim function separately, even in the same block. Vaults MUST NOT &quot;push&quot; tokens onto the user after a Request, users MUST &quot;pull&quot; the tokens via the Claim function.&lt;&#x2F;p&gt;
&lt;p&gt;For asynchronous Vaults, the exchange rate between &lt;code&gt;shares&lt;&#x2F;code&gt; and &lt;code&gt;assets&lt;&#x2F;code&gt; including fees and yield is up to the Vault implementation. In other words, pending redemption Requests MAY NOT be yield-bearing and MAY NOT have a fixed exchange rate.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;request-ids&quot;&gt;Request Ids&lt;&#x2F;h3&gt;
&lt;p&gt;The request ID (&lt;code&gt;requestId&lt;&#x2F;code&gt;) of a request is returned by the corresponding &lt;code&gt;requestDeposit&lt;&#x2F;code&gt; and &lt;code&gt;requestRedeem&lt;&#x2F;code&gt; functions.&lt;&#x2F;p&gt;
&lt;p&gt;Multiple requests may have the same &lt;code&gt;requestId&lt;&#x2F;code&gt;, so a given Request is discriminated by both the &lt;code&gt;requestId&lt;&#x2F;code&gt; and the &lt;code&gt;controller&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Requests of the same &lt;code&gt;requestId&lt;&#x2F;code&gt; MUST be fungible with each other (except in the special case &lt;code&gt;requestId == 0&lt;&#x2F;code&gt; described below). I.e. all Requests with the same &lt;code&gt;requestId&lt;&#x2F;code&gt; MUST transition from Pending to Claimable at the same time and receive the same exchange rate between &lt;code&gt;assets&lt;&#x2F;code&gt; and &lt;code&gt;shares&lt;&#x2F;code&gt;. If a Request with &lt;code&gt;requestId != 0&lt;&#x2F;code&gt; becomes partially claimable, all requests of the same &lt;code&gt;requestId&lt;&#x2F;code&gt; MUST become claimable at the same pro-rata rate.&lt;&#x2F;p&gt;
&lt;p&gt;There are no assumptions or requirements of requests with different &lt;code&gt;requestId&lt;&#x2F;code&gt;. I.e. they MAY transition to Claimable at different times and exchange rates with no ordering or correlation enforced in any way.&lt;&#x2F;p&gt;
&lt;p&gt;When &lt;code&gt;requestId==0&lt;&#x2F;code&gt;, the Vault MUST use purely the &lt;code&gt;controller&lt;&#x2F;code&gt; to discriminate the request state. The Pending and Claimable state of multiple requests from the same &lt;code&gt;controller&lt;&#x2F;code&gt; would be aggregated. If a Vault returns &lt;code&gt;0&lt;&#x2F;code&gt; for the &lt;code&gt;requestId&lt;&#x2F;code&gt; of any request, it MUST return &lt;code&gt;0&lt;&#x2F;code&gt; for all requests.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;methods&quot;&gt;Methods&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;requestdeposit&quot;&gt;requestDeposit&lt;&#x2F;h4&gt;
&lt;p&gt;Transfers &lt;code&gt;assets&lt;&#x2F;code&gt; from &lt;code&gt;owner&lt;&#x2F;code&gt; into the Vault and submits a Request for asynchronous &lt;code&gt;deposit&lt;&#x2F;code&gt;. This places the Request in Pending state, with a corresponding increase in &lt;code&gt;pendingDepositRequest&lt;&#x2F;code&gt; for the amount &lt;code&gt;assets&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The output &lt;code&gt;requestId&lt;&#x2F;code&gt; is used to partially discriminate the request along with the &lt;code&gt;controller&lt;&#x2F;code&gt;. See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7540&#x2F;#request-ids&quot;&gt;Request Ids&lt;&#x2F;a&gt; section for more info.&lt;&#x2F;p&gt;
&lt;p&gt;When the Request is Claimable, &lt;code&gt;claimableDepositRequest&lt;&#x2F;code&gt; will be increased for the &lt;code&gt;controller&lt;&#x2F;code&gt;. &lt;code&gt;deposit&lt;&#x2F;code&gt; or &lt;code&gt;mint&lt;&#x2F;code&gt; can subsequently be called by &lt;code&gt;controller&lt;&#x2F;code&gt; to receive &lt;code&gt;shares&lt;&#x2F;code&gt;. A Request MAY transition straight to Claimable state but MUST NOT skip the Claimable state.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;shares&lt;&#x2F;code&gt; that will be received on &lt;code&gt;deposit&lt;&#x2F;code&gt; or &lt;code&gt;mint&lt;&#x2F;code&gt; MAY NOT be equivalent to the value of &lt;code&gt;convertToShares(assets)&lt;&#x2F;code&gt; at the time of Request, as the price can change between Request and Claim.&lt;&#x2F;p&gt;
&lt;p&gt;MUST support &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; &lt;code&gt;approve&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;transferFrom&lt;&#x2F;code&gt; on &lt;code&gt;asset&lt;&#x2F;code&gt; as a deposit Request flow.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;owner&lt;&#x2F;code&gt; MUST equal &lt;code&gt;msg.sender&lt;&#x2F;code&gt; unless the &lt;code&gt;owner&lt;&#x2F;code&gt; has approved the &lt;code&gt;msg.sender&lt;&#x2F;code&gt; as an operator.&lt;&#x2F;p&gt;
&lt;p&gt;MUST revert if all of &lt;code&gt;assets&lt;&#x2F;code&gt; cannot be requested for &lt;code&gt;deposit&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;mint&lt;&#x2F;code&gt; (due to deposit limit being reached, slippage, the user not approving enough underlying tokens to the Vault contract, etc).&lt;&#x2F;p&gt;
&lt;p&gt;Note that most implementations will require pre-approval of the Vault with the Vault&#x27;s underlying &lt;code&gt;asset&lt;&#x2F;code&gt; token.&lt;&#x2F;p&gt;
&lt;p&gt;MUST emit the &lt;code&gt;DepositRequest&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;equestDeposit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;onpayable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ssets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ontroller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; o&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;wner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;equestId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;pendingdepositrequest&quot;&gt;pendingDepositRequest&lt;&#x2F;h4&gt;
&lt;p&gt;The amount of requested &lt;code&gt;assets&lt;&#x2F;code&gt; in Pending state for the &lt;code&gt;controller&lt;&#x2F;code&gt; with the given &lt;code&gt;requestId&lt;&#x2F;code&gt; to &lt;code&gt;deposit&lt;&#x2F;code&gt; or &lt;code&gt;mint&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST NOT include any &lt;code&gt;assets&lt;&#x2F;code&gt; in Claimable state for &lt;code&gt;deposit&lt;&#x2F;code&gt; or &lt;code&gt;mint&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST NOT show any variations depending on the caller.&lt;&#x2F;p&gt;
&lt;p&gt;MUST NOT revert unless due to integer overflow caused by an unreasonably large input.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; p&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;endingDepositRequest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;equestId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ontroller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ssets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;claimabledepositrequest&quot;&gt;claimableDepositRequest&lt;&#x2F;h4&gt;
&lt;p&gt;The amount of requested &lt;code&gt;assets&lt;&#x2F;code&gt; in Claimable state for the &lt;code&gt;controller&lt;&#x2F;code&gt; with the given &lt;code&gt;requestId&lt;&#x2F;code&gt; to &lt;code&gt;deposit&lt;&#x2F;code&gt; or &lt;code&gt;mint&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST NOT include any &lt;code&gt;assets&lt;&#x2F;code&gt; in Pending state for &lt;code&gt;deposit&lt;&#x2F;code&gt; or &lt;code&gt;mint&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST NOT show any variations depending on the caller.&lt;&#x2F;p&gt;
&lt;p&gt;MUST NOT revert unless due to integer overflow caused by an unreasonably large input.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;laimableDepositRequest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;equestId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ontroller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ssets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;requestredeem&quot;&gt;requestRedeem&lt;&#x2F;h4&gt;
&lt;p&gt;Assumes control of &lt;code&gt;shares&lt;&#x2F;code&gt; from &lt;code&gt;owner&lt;&#x2F;code&gt; and submits a Request for asynchronous &lt;code&gt;redeem&lt;&#x2F;code&gt;. This places the Request in Pending state, with a corresponding increase in &lt;code&gt;pendingRedeemRequest&lt;&#x2F;code&gt; for the amount &lt;code&gt;shares&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The output &lt;code&gt;requestId&lt;&#x2F;code&gt; is used to discriminate the request along with the &lt;code&gt;controller&lt;&#x2F;code&gt;. See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7540&#x2F;#request-ids&quot;&gt;Request Ids&lt;&#x2F;a&gt; section for more info.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;shares&lt;&#x2F;code&gt; MAY be temporarily locked in the Vault until the Claimable or Claimed state for accounting purposes, or they MAY be burned immediately upon &lt;code&gt;requestRedeem&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;In either case, the &lt;code&gt;shares&lt;&#x2F;code&gt; MUST be removed from the custody of &lt;code&gt;owner&lt;&#x2F;code&gt; upon &lt;code&gt;requestRedeem&lt;&#x2F;code&gt; and burned by the time the request is Claimed.&lt;&#x2F;p&gt;
&lt;p&gt;Redeem Request approval of &lt;code&gt;shares&lt;&#x2F;code&gt; for a &lt;code&gt;msg.sender&lt;&#x2F;code&gt; NOT equal to &lt;code&gt;owner&lt;&#x2F;code&gt; may come either from ERC-20 approval over the &lt;code&gt;shares&lt;&#x2F;code&gt; of &lt;code&gt;owner&lt;&#x2F;code&gt; or if the &lt;code&gt;owner&lt;&#x2F;code&gt; has approved the &lt;code&gt;msg.sender&lt;&#x2F;code&gt; as an operator. This MUST be consistent with similar behaviour pointed out in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6909&#x2F;&quot;&gt;ERC-6909&lt;&#x2F;a&gt;, within &quot;Approvals and Operators&quot; section: &quot;In accordance with the transferFrom method, spenders with operator permission are not subject to allowance restrictions, spenders with infinite approvals SHOULD NOT have their allowance deducted on delegated transfers, but spenders with non-infinite approvals MUST have their balance deducted on delegated transfers.&quot;&lt;&#x2F;p&gt;
&lt;p&gt;When the Request is Claimable, &lt;code&gt;claimableRedeemRequest&lt;&#x2F;code&gt; will be increased for the &lt;code&gt;controller&lt;&#x2F;code&gt;. &lt;code&gt;redeem&lt;&#x2F;code&gt; or &lt;code&gt;withdraw&lt;&#x2F;code&gt; can subsequently be called by &lt;code&gt;controller&lt;&#x2F;code&gt; to receive &lt;code&gt;assets&lt;&#x2F;code&gt;. A Request MAY transition straight to Claimable state but MUST NOT skip the Claimable state.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;assets&lt;&#x2F;code&gt; that will be received on &lt;code&gt;redeem&lt;&#x2F;code&gt; or &lt;code&gt;withdraw&lt;&#x2F;code&gt; MAY NOT be equivalent to the value of &lt;code&gt;convertToAssets(shares)&lt;&#x2F;code&gt; at the time of Request, as the price can change between Pending and Claimed.&lt;&#x2F;p&gt;
&lt;p&gt;MUST revert if all of &lt;code&gt;shares&lt;&#x2F;code&gt; cannot be requested for &lt;code&gt;redeem&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;withdraw&lt;&#x2F;code&gt; (due to withdrawal limit being reached, slippage, the owner not having enough shares, etc).&lt;&#x2F;p&gt;
&lt;p&gt;MUST emit the &lt;code&gt;RedeemRequest&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;equestRedeem&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;onpayable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;hares&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ontroller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; o&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;wner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;equestId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;pendingredeemrequest&quot;&gt;pendingRedeemRequest&lt;&#x2F;h4&gt;
&lt;p&gt;The amount of requested &lt;code&gt;shares&lt;&#x2F;code&gt; in Pending state for the &lt;code&gt;controller&lt;&#x2F;code&gt; with the given &lt;code&gt;requestId&lt;&#x2F;code&gt; to &lt;code&gt;redeem&lt;&#x2F;code&gt; or &lt;code&gt;withdraw&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST NOT include any &lt;code&gt;shares&lt;&#x2F;code&gt; in Claimable state for &lt;code&gt;redeem&lt;&#x2F;code&gt; or &lt;code&gt;withdraw&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST NOT show any variations depending on the caller.&lt;&#x2F;p&gt;
&lt;p&gt;MUST NOT revert unless due to integer overflow caused by an unreasonably large input.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; p&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;endingRedeemRequest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;equestId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ontroller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;hares&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;claimableredeemrequest&quot;&gt;claimableRedeemRequest&lt;&#x2F;h4&gt;
&lt;p&gt;The amount of requested &lt;code&gt;shares&lt;&#x2F;code&gt; in Claimable state for the &lt;code&gt;controller&lt;&#x2F;code&gt; with the given &lt;code&gt;requestId&lt;&#x2F;code&gt; to &lt;code&gt;redeem&lt;&#x2F;code&gt; or &lt;code&gt;withdraw&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST NOT include any &lt;code&gt;shares&lt;&#x2F;code&gt; in Pending state for &lt;code&gt;redeem&lt;&#x2F;code&gt; or &lt;code&gt;withdraw&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST NOT show any variations depending on the caller.&lt;&#x2F;p&gt;
&lt;p&gt;MUST NOT revert unless due to integer overflow caused by an unreasonably large input.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;laimableRedeemRequest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;equestId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ontroller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;hares&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;isoperator&quot;&gt;&lt;code&gt;isOperator&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Returns &lt;code&gt;true&lt;&#x2F;code&gt; if the &lt;code&gt;operator&lt;&#x2F;code&gt; is approved as an operator for a &lt;code&gt;controller&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;sOperator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ontroller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; o&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;perator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;tatus&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ool&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;setoperator&quot;&gt;&lt;code&gt;setOperator&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Grants or revokes permissions for &lt;code&gt;operator&lt;&#x2F;code&gt; to manage Requests on behalf of the &lt;code&gt;msg.sender&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST set the operator status to the &lt;code&gt;approved&lt;&#x2F;code&gt; value.&lt;&#x2F;p&gt;
&lt;p&gt;MUST log the &lt;code&gt;OperatorSet&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;p&gt;MUST return True.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;etOperator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;onpayable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; o&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;perator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;pproved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ool&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uccess&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ool&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;deposit-and-mint-overloaded-methods&quot;&gt;&lt;code&gt;deposit&lt;&#x2F;code&gt; and &lt;code&gt;mint&lt;&#x2F;code&gt; overloaded methods&lt;&#x2F;h4&gt;
&lt;p&gt;Implementations MUST support an additional overloaded &lt;code&gt;deposit&lt;&#x2F;code&gt; and &lt;code&gt;mint&lt;&#x2F;code&gt; method on the specification from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4626&#x2F;&quot;&gt;ERC-4626&lt;&#x2F;a&gt;, with an additional &lt;code&gt;controller&lt;&#x2F;code&gt; input of type &lt;code&gt;address&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;deposit(uint256 assets, address receiver, address controller)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;mint(uint256 shares, address receiver, address controller)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Calls MUST revert unless &lt;code&gt;msg.sender&lt;&#x2F;code&gt; is either equal to &lt;code&gt;controller&lt;&#x2F;code&gt; or an operator approved by &lt;code&gt;controller&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;controller&lt;&#x2F;code&gt; field is used to discriminate the Request for which the &lt;code&gt;assets&lt;&#x2F;code&gt; should be claimed in the case where &lt;code&gt;msg.sender&lt;&#x2F;code&gt; is NOT &lt;code&gt;controller&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;When the &lt;code&gt;Deposit&lt;&#x2F;code&gt; event is emitted, the first parameter MUST be the &lt;code&gt;controller&lt;&#x2F;code&gt;, and the second parameter MUST be the &lt;code&gt;receiver&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;events&quot;&gt;Events&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;depositrequest&quot;&gt;DepositRequest&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;owner&lt;&#x2F;code&gt; has locked &lt;code&gt;assets&lt;&#x2F;code&gt; in the Vault to Request a deposit with request ID &lt;code&gt;requestId&lt;&#x2F;code&gt;. &lt;code&gt;controller&lt;&#x2F;code&gt; controls this Request. &lt;code&gt;sender&lt;&#x2F;code&gt; is the caller of the &lt;code&gt;requestDeposit&lt;&#x2F;code&gt; which may not be equal to the &lt;code&gt;owner&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST be emitted when a deposit Request is submitted using the &lt;code&gt;requestDeposit&lt;&#x2F;code&gt; method.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; D&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;epositRequest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;vent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ontroller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; o&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;wner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;equestId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ssets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;redeemrequest&quot;&gt;RedeemRequest&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;sender&lt;&#x2F;code&gt; has locked &lt;code&gt;shares&lt;&#x2F;code&gt;, owned by &lt;code&gt;owner&lt;&#x2F;code&gt;, in the Vault to Request a redemption. &lt;code&gt;controller&lt;&#x2F;code&gt; controls this Request, but is not necessarily the &lt;code&gt;owner&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST be emitted when a redemption Request is submitted using the &lt;code&gt;requestRedeem&lt;&#x2F;code&gt; method.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; R&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;edeemRequest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;vent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ontroller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; o&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;wner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;equestId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;hares&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;operatorset&quot;&gt;&lt;code&gt;OperatorSet&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;controller&lt;&#x2F;code&gt; has set the &lt;code&gt;approved&lt;&#x2F;code&gt; status to an &lt;code&gt;operator&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST be logged when the operator status is set.&lt;&#x2F;p&gt;
&lt;p&gt;MAY be logged when the operator status is set to the same status it was before the current call.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; O&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;peratorSet&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;vent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ontroller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; o&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;perator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;pproved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ool&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;erc-165-support&quot;&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; support&lt;&#x2F;h3&gt;
&lt;p&gt;Smart contracts implementing this Vault standard MUST implement the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;p&gt;All asynchronous Vaults MUST return the constant value &lt;code&gt;true&lt;&#x2F;code&gt; if either &lt;code&gt;0xe3bc4e65&lt;&#x2F;code&gt; (representing the operator methods that all ERC-7540 Vaults implement) or &lt;code&gt;0x2f0a18c5&lt;&#x2F;code&gt; (representing the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7575&#x2F;&quot;&gt;ERC-7575&lt;&#x2F;a&gt; interface) is passed through the &lt;code&gt;interfaceID&lt;&#x2F;code&gt; argument.&lt;&#x2F;p&gt;
&lt;p&gt;Asynchronous deposit Vaults MUST return the constant value &lt;code&gt;true&lt;&#x2F;code&gt; if &lt;code&gt;0xce3bbe50&lt;&#x2F;code&gt; is passed through the &lt;code&gt;interfaceID&lt;&#x2F;code&gt; argument.&lt;&#x2F;p&gt;
&lt;p&gt;Asynchronous redemption Vaults MUST return the constant value &lt;code&gt;true&lt;&#x2F;code&gt; if &lt;code&gt;0x620ee8e4&lt;&#x2F;code&gt; is passed through the &lt;code&gt;interfaceID&lt;&#x2F;code&gt; argument.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;erc-7575-support&quot;&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7575&#x2F;&quot;&gt;ERC-7575&lt;&#x2F;a&gt; support&lt;&#x2F;h3&gt;
&lt;p&gt;Smart contracts implementing this Vault standard MUST implement the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7575&#x2F;&quot;&gt;ERC-7575&lt;&#x2F;a&gt; standard (in particular the &lt;code&gt;share&lt;&#x2F;code&gt; method).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;including-request-ids-but-not-including-a-claim-by-id-method&quot;&gt;Including Request IDs but not including a Claim by ID method&lt;&#x2F;h3&gt;
&lt;p&gt;Requests in an Asynchronous Vault have properties of NFTs or Semi-Fungible tokens due to their asynchronicity. However, trying to pigeonhole all ERC-7540 Vaults into supporting &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; for Requests would create too much interface bloat.&lt;&#x2F;p&gt;
&lt;p&gt;Using both an id and address to discriminate Requests allows for any of these use cases to be developed at an external layer without adding too much complexity to the core interface.&lt;&#x2F;p&gt;
&lt;p&gt;Certain Vaults, especially &lt;code&gt;requestId==0&lt;&#x2F;code&gt; cases, benefit from using the underlying &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4626&#x2F;&quot;&gt;ERC-4626&lt;&#x2F;a&gt; methods for claiming because there is no discrimination at the &lt;code&gt;requestId&lt;&#x2F;code&gt; level. This standard is written primarily with those use cases in mind. A future standard can optimize for nonzero request ID with support for claiming and transferring requests discriminated also with a &lt;code&gt;requestId&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;symmetry-and-non-inclusion-of-requestwithdraw-and-requestmint&quot;&gt;Symmetry and Non-inclusion of requestWithdraw and requestMint&lt;&#x2F;h3&gt;
&lt;p&gt;In ERC-4626, the spec was written to be fully symmetrical with respect to converting &lt;code&gt;assets&lt;&#x2F;code&gt; and &lt;code&gt;shares&lt;&#x2F;code&gt; by including deposit&#x2F;withdraw and mint&#x2F;redeem.&lt;&#x2F;p&gt;
&lt;p&gt;Due to the nature of Requests, asynchronous Vaults can only operate with certainty on the quantity that is fully known at the time of the Request (&lt;code&gt;assets&lt;&#x2F;code&gt; for &lt;code&gt;deposit&lt;&#x2F;code&gt; and &lt;code&gt;shares&lt;&#x2F;code&gt; for &lt;code&gt;redeem&lt;&#x2F;code&gt;). Therefore the deposit Request flow cannot work with a &lt;code&gt;mint&lt;&#x2F;code&gt; call, because the amount of &lt;code&gt;assets&lt;&#x2F;code&gt; for the requested &lt;code&gt;shares&lt;&#x2F;code&gt; amount may fluctuate before the fulfillment of the Request. Likewise, the redemption Request flow cannot work with a &lt;code&gt;withdraw&lt;&#x2F;code&gt; call.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;optionality-of-flows&quot;&gt;Optionality of Flows&lt;&#x2F;h3&gt;
&lt;p&gt;Certain use cases are only asynchronous on one side of the deposit or redeem Request flow. A good example of an asynchronous redemption Vault is a liquid staking token. The unstaking period necessitates support for asynchronous withdrawals, however, deposits can be fully synchronous.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;non-inclusion-of-a-request-cancelation-flow&quot;&gt;Non-inclusion of a Request Cancelation Flow&lt;&#x2F;h3&gt;
&lt;p&gt;In many cases, canceling a Request may not be straightforward or even technically feasible. The state transition of cancelations could be synchronous or asynchronous, and the way to claim a cancelation interfaces with the remaining Vault functionality in complex ways.&lt;&#x2F;p&gt;
&lt;p&gt;A separate EIP should be developed to standardize the behavior of cancelling a pending Request. Defining the cancel flow is still important for certain classes of use cases for which the fulfillment of a Request can take a considerable amount of time.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;request-implementation-flexibility&quot;&gt;Request Implementation Flexibility&lt;&#x2F;h3&gt;
&lt;p&gt;The standard is flexible enough to support a wide range of interaction patterns for Request flows. Pending Requests can be handled via internal accounting, globally or on per-user levels, use ERC-20 or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;, etc.&lt;&#x2F;p&gt;
&lt;p&gt;Likewise yield on redemption Requests can accrue or not, and the exchange rate of any Request may be fixed or variable depending on the implementation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;not-allowing-short-circuiting-for-claims&quot;&gt;Not Allowing Short-circuiting for Claims&lt;&#x2F;h3&gt;
&lt;p&gt;If claims can short-circuit, this creates ambiguity for integrators and complicates the interface with overloaded behavior on Request functions.&lt;&#x2F;p&gt;
&lt;p&gt;An example of a short-circuiting Request flow could be as follows: user triggers a Request which enters Pending state. When the Vault fulfills the Request, the corresponding &lt;code&gt;assets&#x2F;shares&lt;&#x2F;code&gt; are pushed straight to the user. This requires only 1 step on the user&#x27;s behalf.&lt;&#x2F;p&gt;
&lt;p&gt;This approach has a few issues:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;cost&#x2F;lack of scalability: as the number of vault users grows it can become intractably expensive to offload the Claim costs to the Vault operator&lt;&#x2F;li&gt;
&lt;li&gt;hinders integration potential: Vault integrators would need to handle both the 2-step and 1-step cases, with the 1-step pushing arbitrary tokens in from an unknown Request at an unknown time. This pushes complexity out onto integrators and reduces the standard&#x27;s utility.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The 2-step approach used in the standard may be abstracted into a 1-step approach from the user perspective through the use of routers, relayers, message signing, or account abstraction.&lt;&#x2F;p&gt;
&lt;p&gt;In the case where a Request may become Claimable immediately in the same block, there can be router contracts that atomically check for Claimable amounts immediately upon Request. Frontends can dynamically route Requests in this way depending on the state and implementation of the Vault to handle this edge case.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;no-outputs-for-request-functions&quot;&gt;No Outputs for Request Functions&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;requestDeposit&lt;&#x2F;code&gt; and &lt;code&gt;requestRedeem&lt;&#x2F;code&gt; may not have a known exchange rate that will happen when the Request becomes Claimed. Returning the corresponding &lt;code&gt;assets&lt;&#x2F;code&gt; or &lt;code&gt;shares&lt;&#x2F;code&gt; could not work in this case.&lt;&#x2F;p&gt;
&lt;p&gt;The Requests could also output a timestamp representing the minimum amount of time expected for the Request to become Claimable, however, not all Vaults will be able to return a reliable timestamp.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;no-event-for-claimable-state&quot;&gt;No Event for Claimable State&lt;&#x2F;h3&gt;
&lt;p&gt;The state transition of a Request from Pending to Claimable happens at the Vault implementation level and is not specified in the standard. Requests may be batched into the Claimable state, or the state may transition automatically after a timestamp has passed. It is impractical to require an event to emit after a Request becomes Claimable at the user or batch level.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;reversion-of-preview-functions-in-async-request-flows&quot;&gt;Reversion of Preview Functions in Async Request Flows&lt;&#x2F;h3&gt;
&lt;p&gt;The preview functions do not take an address parameter, therefore the only way to discriminate discrepancies in the exchange rate is via the &lt;code&gt;msg.sender&lt;&#x2F;code&gt;. However, this could lead to integration&#x2F;implementation complexities where support contracts cannot determine the output of a claim on behalf of a &lt;code&gt;controller&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;In addition, there is no on-chain benefit to previewing the Claim step as the only valid state transition is to Claim anyway. If the output of a Claim is undesirable for any reason, the calling contract can revert on the output of that function call.&lt;&#x2F;p&gt;
&lt;p&gt;It reduces code and implementation complexity at little to no cost to simply mandate reversion for the preview functions of an async flow.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;mandated-support-for-erc-165&quot;&gt;Mandated Support for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Implementing support for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; is mandated because of the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7540&#x2F;#optionality-of-flows&quot;&gt;optionality of flows&lt;&#x2F;a&gt;. Integrations can use the &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; method to check whether a vault is fully asynchronous, partially asynchronous, or fully synchronous (for which it is just following the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4626&#x2F;&quot;&gt;ERC-4626&lt;&#x2F;a&gt;), and use a single contract to support all cases.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;not-allowing-pending-claims-to-be-fungible&quot;&gt;Not Allowing Pending Claims to be Fungible&lt;&#x2F;h3&gt;
&lt;p&gt;The async pending claims represent a sort of semi-fungible intermediate share class. Vaults can elect to wrap these claims in any token standard they like, for example, ERC-20, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt;, or ERC-721 depending on the use case. This is intentionally left out of the spec to provide flexibility to implementers.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The interface is fully backward compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4626&#x2F;&quot;&gt;ERC-4626&lt;&#x2F;a&gt;. The specification of the &lt;code&gt;deposit&lt;&#x2F;code&gt;, &lt;code&gt;mint&lt;&#x2F;code&gt;, &lt;code&gt;redeem&lt;&#x2F;code&gt;, and &lt;code&gt;withdraw&lt;&#x2F;code&gt; methods is different as described in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7540&#x2F;#specification&quot;&gt;Specification&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This code snippet is incomplete pseudocode used for example only and is no way intended to be used in production or guaranteed to be secure&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; pendingDepositRequest&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; claimableDepositRequest&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; controller &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; operator &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; isOperator&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; requestDeposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; assets&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; controller&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; requestId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;assets &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;owner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span&gt; isOperator&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        requestId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; no requestId associated with this request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        asset&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;safeTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; assets&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; asset here is the Vault underlying asset&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        pendingDepositRequest&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;controller&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; assets&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DepositRequest&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;controller&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; requestId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; assets&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; requestId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Include some arbitrary transition logic here from Pending to Claimable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; deposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; assets&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; receiver&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; controller&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; shares&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;assets &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;controller &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span&gt; isOperator&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;controller&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        claimableDepositRequest&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;controller&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; assets&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; underflow would revert if not enough claimable assets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        shares &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; convertToShares&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;assets&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; this naive example uses the instantaneous exchange rate. It may be more common to use the rate locked in upon Claimable stage.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        balanceOf&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;receiver&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; shares&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Deposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;controller&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; receiver&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; assets&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; shares&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setOperator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approved&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        isOperator&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;operator&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; approved&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OperatorSet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; approved&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;In general, asynchronicity concerns make state transitions in the Vault much more complex and vulnerable to security risks. Access control on Vault operations, clear documentation of state transitions, and invariant checks should all be performed to mitigate these risks. For example:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The view methods for viewing Pending and Claimable request states (e.g. pendingDepositRequest) are estimates useful for display purposes but can be outdated. The inability to know the final exchange rate on any Request requires users to trust the implementation of the asynchronous Vault in the computation of the exchange rate and fulfillment of their Request.&lt;&#x2F;li&gt;
&lt;li&gt;Shares or assets locked for Requests can be stuck in the Pending state. Vaults may elect to allow for the fungibility of pending claims or implement some cancellation functionality to protect users.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;operators&quot;&gt;Operators&lt;&#x2F;h3&gt;
&lt;p&gt;An operator has the ability to transfer the &lt;code&gt;asset&lt;&#x2F;code&gt; of the vault from the approver to any address, and simultaneously grants control over the &lt;code&gt;share&lt;&#x2F;code&gt; of the vault.&lt;&#x2F;p&gt;
&lt;p&gt;Any user approving an operator must trust that operator with both the &lt;code&gt;asset&lt;&#x2F;code&gt; and &lt;code&gt;share&lt;&#x2F;code&gt; of the Vault.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Verkle proof verification precompile</title>
        <published>2023-10-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Guillaume Ballet</name><uri>https://github.com/gballet</uri>
	</author>
	
	<author>
		<name>Diederik Loerakker</name><uri>https://github.com/protolambda</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7545/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/verkle-proof-verification-precompile/16274" />
        

        <id>https://wg-eips.ritovision.com/7545/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7545"
            label="EIP-7545" />
        

        
        

        
        <summary type="html">Add a precompile to help dapps verify verkle proofs</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7545/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes the addition of a precompiled contract to provide up-to-date state proof verification capabilities to smart contracts in a stateless Ethereum context.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The proposed proof systems for stateless Ethereum require an upgrade to many tools and applications, that need a simple path to keep their proving systems up-to-date, without having to develop and deploy new proving libraries each time another proof format must be supported.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;A precompiled contract is added at address &lt;code&gt;0x21&lt;&#x2F;code&gt;, wrapping the stateless ethereum proof verification function.&lt;&#x2F;p&gt;
&lt;p&gt;The precompile&#x27;s &lt;code&gt;input&lt;&#x2F;code&gt; is the tightly packed concatenation of the following fields:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;version&lt;&#x2F;code&gt; (1 byte) specifies which version of the stateless proof verification function should be used. Version 0 is used for an MPT and version 1 is used for the polynomial commitment scheme multiproof used in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6800&#x2F;&quot;&gt;EIP-6800&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;state_root&lt;&#x2F;code&gt; (32 bytes) specifies the state root that the proof is proving against.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;proof_data&lt;&#x2F;code&gt; (arbitrary long) is the proof data.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Pseudo-code behavior of the precompile:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; proof_verification_precompile&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;input&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    version&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;33&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    proof_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;33&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;33&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;proof_data_size&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; version&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        proof&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; deserialize_proof&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state_root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; proof_data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; verify_mpt_multiproof&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;proof&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; version&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        proof&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; deserialize_proof&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state_root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; proof_data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; verify_pcs_multiproof&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;proof&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;If &lt;code&gt;version&lt;&#x2F;code&gt; is &lt;code&gt;0&lt;&#x2F;code&gt; then the proof is expected to follow the SSZ format described in &quot;the verge&quot; proposal in the consensus spec.&lt;&#x2F;p&gt;
&lt;p&gt;The precompile returns &lt;code&gt;1&lt;&#x2F;code&gt; if it was able to verify the proof, and &lt;code&gt;0&lt;&#x2F;code&gt; otherwise.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-costs&quot;&gt;Gas costs&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant name&lt;&#x2F;th&gt;&lt;th&gt;cost&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;POINT_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;TBD&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;POLY_EVAL_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;TBD&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The precompile cost is:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;cost = (POINT_COST + 1)*len(get_commitments(input)) + POLY_EVAL_COST * [leaf_depth(key, get_tree(input)) for key in get_keys(input))]&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;get_commitments&lt;&#x2F;code&gt; extracts the list of commitments in the proof, as encoded in &lt;code&gt;input&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;get_keys&lt;&#x2F;code&gt; extracts the list of keys in the proof, as encoded in &lt;code&gt;input&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;leaf_depth&lt;&#x2F;code&gt; returns the depth of the leaf in the tree&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;get tree&lt;&#x2F;code&gt; reconstruct a stateless view of the tree from &lt;code&gt;input&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Stateless Ethereum relies on proofs using advanced mathematical concepts and tools from a fast-moving area of cryptography. As a result, a soft-fork approach is currently favored in the choice of the proof format: proofs are going to be distributed outside of consensus, and in the future, stateless clients will be able to chose their favorite proof format.&lt;&#x2F;p&gt;
&lt;p&gt;This introduces a burden on several application, e.g. bridges, as they will potentially need to support proof formats designed after the release of the bridge contract.&lt;&#x2F;p&gt;
&lt;p&gt;Delegating the proof verification burden to a version-aware precompile will ensure that these applications can support newer proving primitives without having to upgrade their contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TODO&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;WIP&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;First implementation in Optimism, pull request #192 of ethereum-optimism&#x2F;op-geth by @protolambda&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Native Asset ERC-4626 Tokenized Vault</title>
        <published>2023-10-12T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Joey Santoro</name><uri>https://github.com/joeysantoro</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7535/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7535-eth-native-asset-tokenized-vault/16068" />
        

        <id>https://wg-eips.ritovision.com/7535/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7535"
            label="ERC-7535" />
        

        
        

        
        <summary type="html">ERC-4626 Tokenized Vaults with Ether (Native Asset) as the underlying asset</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7535/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is an extension of the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4626&#x2F;&quot;&gt;ERC-4626&lt;&#x2F;a&gt; spec with an identical interface and behavioral overrides for handling Ether or any native asset as the underlying.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;A standard for tokenized ETH Vaults has the same benefits as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4626&#x2F;&quot;&gt;ERC-4626&lt;&#x2F;a&gt;, particularly in the case of Liquid Staking Tokens, (i.e. fungible &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; wrappers around ETH staking).&lt;&#x2F;p&gt;
&lt;p&gt;Maintaining the same exact interface as ERC-4626 further amplifies the benefits as the standard will be maximally compatible with existing ERC-4626 tooling and protocols.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;All &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7535&#x2F;&quot;&gt;ERC-7535&lt;&#x2F;a&gt; tokenized Vaults MUST implement ERC-4626 (and by extension ERC-20) with behavioral overrides for the methods &lt;code&gt;asset&lt;&#x2F;code&gt;, &lt;code&gt;deposit&lt;&#x2F;code&gt;, and &lt;code&gt;mint&lt;&#x2F;code&gt; specified below.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;erc-4626-breaking-changes&quot;&gt;ERC-4626 Breaking Changes&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Any &lt;code&gt;assets&lt;&#x2F;code&gt; quantity refers to wei of Ether rather than ERC-20 balances.&lt;&#x2F;li&gt;
&lt;li&gt;Any ERC-20 &lt;code&gt;transfer&lt;&#x2F;code&gt; calls are replaced by Ether transfer (&lt;code&gt;send&lt;&#x2F;code&gt; or &lt;code&gt;call&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;Any ERC-20 &lt;code&gt;transferFrom&lt;&#x2F;code&gt; approval flows for &lt;code&gt;asset&lt;&#x2F;code&gt; are not implemented&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;deposit&lt;&#x2F;code&gt; and &lt;code&gt;mint&lt;&#x2F;code&gt; have state mutability &lt;code&gt;payable&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;deposit&lt;&#x2F;code&gt; uses &lt;code&gt;msg.value&lt;&#x2F;code&gt; as the primary input and MAY ignore &lt;code&gt;assets&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;methods&quot;&gt;Methods&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;asset&quot;&gt;asset&lt;&#x2F;h4&gt;
&lt;p&gt;MUST return &lt;code&gt;0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE&lt;&#x2F;code&gt; per &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7528&#x2F;&quot;&gt;ERC-7528&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;sset&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ssetTokenAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;deposit&quot;&gt;deposit&lt;&#x2F;h4&gt;
&lt;p&gt;Mints &lt;code&gt;shares&lt;&#x2F;code&gt; Vault shares to &lt;code&gt;receiver&lt;&#x2F;code&gt; by depositing exactly &lt;code&gt;msg.value&lt;&#x2F;code&gt; of Ether.&lt;&#x2F;p&gt;
&lt;p&gt;MUST have state mutability of &lt;code&gt;payable&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST use &lt;code&gt;msg.value&lt;&#x2F;code&gt; as the primary input parameter for calculating the &lt;code&gt;shares&lt;&#x2F;code&gt; output. I.e. MAY ignore &lt;code&gt;assets&lt;&#x2F;code&gt; parameter as an input.&lt;&#x2F;p&gt;
&lt;p&gt;MUST emit the &lt;code&gt;Deposit&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;p&gt;MUST revert if all of &lt;code&gt;msg.value&lt;&#x2F;code&gt; cannot be deposited (due to deposit limit being reached, slippage, etc).&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; d&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eposit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; p&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ayable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ssets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eceiver&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;hares&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;mint&quot;&gt;mint&lt;&#x2F;h4&gt;
&lt;p&gt;Mints exactly &lt;code&gt;shares&lt;&#x2F;code&gt; Vault shares to &lt;code&gt;receiver&lt;&#x2F;code&gt; by depositing &lt;code&gt;assets&lt;&#x2F;code&gt; of ETH.&lt;&#x2F;p&gt;
&lt;p&gt;MUST have state mutability of &lt;code&gt;payable&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST emit the &lt;code&gt;Deposit&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;p&gt;MUST revert if all of &lt;code&gt;shares&lt;&#x2F;code&gt; cannot be minted (due to deposit limit being reached, slippage, the user not sending a large enough &lt;code&gt;msg.value&lt;&#x2F;code&gt; of Ether to the Vault contract, etc).&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; m&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; p&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ayable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;hares&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eceiver&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ssets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;events&quot;&gt;Events&lt;&#x2F;h3&gt;
&lt;p&gt;The event usage MUST be identical to ERC-4626.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;wrapped-eth&quot;&gt;Wrapped ETH&lt;&#x2F;h3&gt;
&lt;p&gt;Any ERC-4626 Vault that uses a Wrapped ETH ERC-20 as the &lt;code&gt;asset&lt;&#x2F;code&gt; MUST NOT implement ERC-7535. ERC-7535 only applies to native ETH.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This standard was designed to maximize compatibility with ERC-4626 while minimizing additional opinionated details on the interface. Examples of this decision rationale are described below:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;maintaining the redundant &lt;code&gt;assets&lt;&#x2F;code&gt; input to the &lt;code&gt;deposit&lt;&#x2F;code&gt; function while making its usage optional&lt;&#x2F;li&gt;
&lt;li&gt;not enforcing a relationship between &lt;code&gt;msg.value&lt;&#x2F;code&gt; and &lt;code&gt;assets&lt;&#x2F;code&gt; in a &lt;code&gt;mint&lt;&#x2F;code&gt; call&lt;&#x2F;li&gt;
&lt;li&gt;not enforcing any behaviors or lack thereof for &lt;code&gt;fallback&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;__default__&lt;&#x2F;code&gt; methods, payability on additional vault functions, or handling ETH forcibly sent to the contract&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;All breaking implementation level changes with ERC-4626 are purely to accomodate for the usage of Ether or any native asset instead of an ERC-20 token.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;allowing-assets-parameter-to-be-ignored-in-a-deposit&quot;&gt;Allowing assets Parameter to be Ignored in a Deposit&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;msg.value&lt;&#x2F;code&gt; must always be passed anyway to fund a &lt;code&gt;deposit&lt;&#x2F;code&gt;, therefore it may as well be treated as the primary input number. Allowing &lt;code&gt;assets&lt;&#x2F;code&gt; to be used either forces a strict equality and extra unnecessary gas overhead for redundancy, or allows different values which could cause footguns and undefined behavior.&lt;&#x2F;p&gt;
&lt;p&gt;The last option which could work is to require that &lt;code&gt;assets&lt;&#x2F;code&gt; MUST be 0, but this still requires gas to enforce at the implementation level and can more easily be left unspecified, as the input is functionally ignorable in the spec as written.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;allowing-msg-value-to-not-equal-assets-output-in-a-mint&quot;&gt;Allowing msg.value to Not Equal assets Output in a Mint&lt;&#x2F;h3&gt;
&lt;p&gt;There may be many cases where a user deposits slightly too much Ether in a &lt;code&gt;mint&lt;&#x2F;code&gt; call. In these cases, enforcing &lt;code&gt;msg.value&lt;&#x2F;code&gt; to equal &lt;code&gt;assets&lt;&#x2F;code&gt; would cause unnecessary reversions. It is up to the vault implementer to decide whether to refund or absorb any excess Ether, and up to depositors to deposit as close to the exact amount as possible.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;ERC-7535 is fully backward compatible with ERC-4626 at the function interface level. Certain implementation behaviors are different due to the fact that ETH is not ERC-20 compliant, such as the priority of &lt;code&gt;msg.value&lt;&#x2F;code&gt; over &lt;code&gt;assets&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;It has no known compatibility issues with other standards.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;In addition to all security considerations of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4626&#x2F;&quot;&gt;ERC-4626&lt;&#x2F;a&gt;, there are security implications of having ETH as the Vault asset.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;call-vs-send&quot;&gt;&lt;code&gt;call&lt;&#x2F;code&gt; vs &lt;code&gt;send&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Contracts should take care when using &lt;code&gt;call&lt;&#x2F;code&gt; to transfer ETH, as this allows additional reentrancy vulnerabilities and arbitrary code execution beyond what is possible with trusted ERC-20 tokens.&lt;&#x2F;p&gt;
&lt;p&gt;It is safer to simply &lt;code&gt;send&lt;&#x2F;code&gt; ETH with a small gas stipend.&lt;&#x2F;p&gt;
&lt;p&gt;Implementers should take extra precautions when deciding how to transfer ETH.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;forceful-eth-transfers&quot;&gt;Forceful ETH transfers&lt;&#x2F;h3&gt;
&lt;p&gt;ETH can be forced into any Vault through the &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; opcode. Implementers should validate that this does not disrupt Vault accounting in any way.&lt;&#x2F;p&gt;
&lt;p&gt;Similarly, any additional &lt;code&gt;payable&lt;&#x2F;code&gt; methods should be checked to ensure they do not disrupt Vault accounting.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;wrapped-eth-1&quot;&gt;Wrapped ETH&lt;&#x2F;h3&gt;
&lt;p&gt;Smart contract systems which implement ERC-4626 should consider only supporting ERC-20 underlying assets, and default to using a Wrapped ETH ERC-20 instead of implementing ERC-7535 for handling ETH.&lt;&#x2F;p&gt;
&lt;p&gt;The subtle differences between ERC-4626 and ERC-7535 can introduce code fragmentation and security concerns.&lt;&#x2F;p&gt;
&lt;p&gt;Cleaner use cases for ERC-7535 are ETH exclusive, such as Wrapped ETH and Liquid Staking Tokens.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Public Cross Port</title>
        <published>2023-10-11T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>George</name><uri>https://github.com/JXRow</uri>
	</author>
	
	<author>
		<name>Zisu</name><uri>https://github.com/lazy1523</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7533/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/connect-all-l2s/15534" />
        

        <id>https://wg-eips.ritovision.com/7533/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7533"
            label="ERC-7533" />
        

        
        

        
        <summary type="html">Help bridges to connect all EVM chains</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7533/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The objective of Public Cross Port (PCP) is to securely and efficiently connect various EVM chains. It replaces the method of pushing message to multiple chains with a method of pulling messages from multiple chains, significantly reducing the number of cross-chain bridges and gas cost, as more cross-chain bridge projects are built on PCP, the overall security increases.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, there are official cross-chain bridges between L2 and L1, but not between L2s. If there are 10 L2 chains that need to cross-chain with each other, it would require 10 x 9 = 90 cross-chain bridges. However, if a pull mechanism is used to merge messages from the other 9 chains into one transaction synchronized to its own chain, only 10 cross-chain bridges would be needed. This significantly reduces the number of cross-chain bridges required and minimizes gas cost.&lt;&#x2F;p&gt;
&lt;p&gt;This implementation, with the participation of multiple cross-chain bridge projects, would greatly enhance security. There is currently a considerable amount of redundant construction of cross-chain bridges, which does not contribute to improved security. By using a standardized &lt;code&gt;SendPort&lt;&#x2F;code&gt; contract, if the same cross-chain message is being transported by multiple redundant bridges, the validation on the target chain&#x27;s &lt;code&gt;IReceivePort&lt;&#x2F;code&gt; should yield the same result. This result, confirmed by multiple cross-chain bridge projects, provides much higher security than relying on a single confirmation. The purpose of this EIP is to encourage more cross-chain bridge projects to participate, transforming redundant construction into enhanced security.&lt;&#x2F;p&gt;
&lt;p&gt;To attract cross-chain bridge projects to participate, aside from reducing the number of bridges and gas cost, the use of the Hash MerkleTree data structure in the &lt;code&gt;SendPort&lt;&#x2F;code&gt; ensures that adding cross-chain messages does not increase the overhead of the bridges. Only a small-sized root is required for the transportation of cross-chain bridges, further saving gas.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;use-case&quot;&gt;Use case&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP divides the cross-chain ecosystem into 3 layers and defines the &lt;code&gt;SendPort&lt;&#x2F;code&gt; contract and &lt;code&gt;IReceivePort&lt;&#x2F;code&gt; interface at the foundational layer. The implementation of the other layers is left to ecosystem project participants.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7533&#x2F;.&#x2F;assets&#x2F;0.png&quot; alt=&quot;&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;On top of cross-chain messaging, applications can use bridges as service, such like Token cross.&lt;&#x2F;p&gt;
&lt;p&gt;Cross-chain messaging bridges can be combined with Token cross-chain functionality, as shown in the code example at Reference Implementation. Alternatively, they can be separated. Taking the example of an NFT cross-chain application, it can reuse the messaging bridge of Tokens, and even leverage multiple messaging bridges. Reusing multiple bridges for message verification can significantly enhance security without incurring additional costs for cross-chain and verification services.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;The essence of cross-chain is to inform the target chain about events happening on the source chain. This process can be divided into 3 steps. The following diagram illustrates the overall principle:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7533&#x2F;.&#x2F;assets&#x2F;1.png&quot; alt=&quot;&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;1-add-cross-chain-message&quot;&gt;1.Add cross-chain message&lt;&#x2F;h3&gt;
&lt;p&gt;Under this EIP, a &lt;code&gt;SendPort&lt;&#x2F;code&gt; contract is deployed on each chain. It is responsible for collecting cross-chain messages on that chain and packing them. &lt;code&gt;SendPort&lt;&#x2F;code&gt; operates as a public, permissionless, administrator-free, and automatic system. Cross-chain bridge operators retrieve cross-chain messages from &lt;code&gt;SendPort&lt;&#x2F;code&gt; and transport it to the target chain to complete the cross-chain messaging process.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;SendPort&lt;&#x2F;code&gt; contract can serve for multiple bridges and is responsible for collecting events (i.e., cross-chain messages) that occur on that chain and packing them into a MerkleTree. For example, let&#x27;s consider a scenario where a Bridge contract receives a user&#x27;s USDT deposit. It can send the hash of this event and the ID of the target chain to the &lt;code&gt;SendPort&lt;&#x2F;code&gt; contract. &lt;code&gt;SendPort&lt;&#x2F;code&gt; adds this information, along with the hash of the sender&#x27;s address (i.e., the Bridge contract&#x27;s address), as a leaf in an array. After collecting a certain number of leaves for a period of time (e.g., 1 minute), &lt;code&gt;SendPort&lt;&#x2F;code&gt; automatically packs them into a MerkleTree and begins the next collection phase. &lt;code&gt;SendPort&lt;&#x2F;code&gt;&#x27;s role is solely focused on event collection and packing. It operates autonomously without the need for management. So no need to repeat deploy &lt;code&gt;SendPort&lt;&#x2F;code&gt; on each chain, &lt;strong&gt;RECOMMENDED&lt;&#x2F;strong&gt; one chain one &lt;code&gt;SendPort&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;SendPort.addMsgHash()&lt;&#x2F;code&gt; function can be called by different cross-chain bridge projects or any other contract. The function does not require permission, which means that there is a possibility of incorrect or fraudulent messages being sent. To prevent fraud, &lt;code&gt;SendPort&lt;&#x2F;code&gt; includes the sender&#x27;s address in the packing process. This indicates that the &lt;code&gt;sender&lt;&#x2F;code&gt; intends to send the information &lt;code&gt;msgHash&lt;&#x2F;code&gt; to the &lt;code&gt;toChainId&lt;&#x2F;code&gt; chain. When this information is decoded on the target chain, it can help prevent fraudulent activities.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;2-pull-roots-set-roots&quot;&gt;2.Pull roots &amp;amp; Set roots&lt;&#x2F;h3&gt;
&lt;p&gt;Upon the completion of packing a new MerkleTree, the package carrier (usually the cross-chain bridge project) pulls the root from multiple chains and stores it in the &lt;code&gt;IReceivePort&lt;&#x2F;code&gt; contract of each chain.&lt;&#x2F;p&gt;
&lt;p&gt;A root contains messages from one source chain to multiple target chains. For the package carrier, the root &lt;strong&gt;MAY&lt;&#x2F;strong&gt; not contain relevant messages or &lt;strong&gt;MAY&lt;&#x2F;strong&gt; not include messages intended for a specific target chain. Therefore, the package carrier has the discretion to decide whether or not to transport the root to a particular target chain, based on its relevance.&lt;&#x2F;p&gt;
&lt;p&gt;Hence, the &lt;code&gt;IReceivePort&lt;&#x2F;code&gt; contract is not unique and is implemented by the package carrier based on the &lt;code&gt;IReceivePort&lt;&#x2F;code&gt; interface. With multiple package carriers, there will be multiple &lt;code&gt;IReceivePort&lt;&#x2F;code&gt; contracts.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;3-verify-cross-chain-message&quot;&gt;3.Verify cross-chain message&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;IReceivePort&lt;&#x2F;code&gt; contract stores the roots of each chain, allowing it to verify the authenticity of messages when provided with the complete message. It is important to note that the root itself cannot be used to decipher the message; it can only be used to validate its authenticity. The complete message can be retrieved from the &lt;code&gt;SendPort&lt;&#x2F;code&gt; contract of the source chain.&lt;&#x2F;p&gt;
&lt;p&gt;Since the roots originate from the same &lt;code&gt;SendPort&lt;&#x2F;code&gt;, the roots in different &lt;code&gt;IReceivePort&lt;&#x2F;code&gt; contracts &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; be identical. In other words, if a message is authentic, it &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; be able to be verified as authentic across different &lt;code&gt;IReceivePort&lt;&#x2F;code&gt; contracts. This significantly enhances security. It is similar to the principle of multi-signature, where if the majority of &lt;code&gt;IReceivePort&lt;&#x2F;code&gt; contracts verify a message as authentic, it is likely to be true. Conversely, any &lt;code&gt;IReceivePort&lt;&#x2F;code&gt; contracts that verify the message as false may indicate a potential hacker attack or a failure in the corresponding cross-chain bridge. This decentralized participation model ensures that the security of the system is not compromised by single points of failure. It transforms redundant construction into an improvement in security.&lt;&#x2F;p&gt;
&lt;p&gt;Regarding data integrity:&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;SendPort&lt;&#x2F;code&gt; retains all roots and continuous index numbers without deletion or modification. The &lt;code&gt;IReceivePort&lt;&#x2F;code&gt; contracts of each cross-chain bridge &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; also follow this approach.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;isendport-interface&quot;&gt;&lt;code&gt;ISendPort&lt;&#x2F;code&gt; Interface&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ISendPort&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MsgHashAdded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; packageIndex&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; msgHash&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; toChainId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; leaf&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Packed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; packageIndex&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; packTime&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; root&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Package&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span&gt; packageIndex&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; root&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; leaves&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span&gt; createTime&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span&gt; packTime&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addMsgHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; msgHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; toChainId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; pack&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getPackage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; packageIndex&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Package&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getPendingPackage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Package&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Let:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Package&lt;&#x2F;code&gt;: Collects cross-chain messages within a certain period and packs them into a single package.
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;packageIndex&lt;&#x2F;code&gt;: The index of the package, starting from 0.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;root&lt;&#x2F;code&gt;: The root generated by the MerkleTree from the &lt;code&gt;leaves&lt;&#x2F;code&gt;, representing the packed package.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;leaves&lt;&#x2F;code&gt;: Each leaf represents a cross-chain message, and it is a hash calculated from &lt;code&gt;msgHash&lt;&#x2F;code&gt;, &lt;code&gt;sender&lt;&#x2F;code&gt;, and &lt;code&gt;toChainId&lt;&#x2F;code&gt;.
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;msgHash&lt;&#x2F;code&gt;: The hash of the message, passed in from an external contract.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;sender&lt;&#x2F;code&gt;: The address of the external contract, no need to pass it in explicitly.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;toChainId&lt;&#x2F;code&gt;: The chain ID of the target chain, passed in from an external contract.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;createTime&lt;&#x2F;code&gt;: The timestamp when the package started collecting messages. It is also the timestamp when the previous package was packed.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;packTime&lt;&#x2F;code&gt;: The timestamp when the package was packed. After packing, no more leaves can be added.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;addMsgHash()&lt;&#x2F;code&gt;: The external contract sends the hash of cross-chain messages to the SendPort.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;pack()&lt;&#x2F;code&gt;: Manually triggers the packing process. Typically, it is automatically triggered when the last submitter submits his message. If waiting for the last submitter takes too long, the packing process can be manually triggered.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;getPackage()&lt;&#x2F;code&gt;: Retrieves each package in the SendPort, including both packed and pending packages.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;getPendingPackage()&lt;&#x2F;code&gt;: Retrieves the pending package in the SendPort.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;ireceiveport-interface&quot;&gt;&lt;code&gt;IReceivePort&lt;&#x2F;code&gt; Interface&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IReceivePort&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PackageReceived&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; fromChainId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; packageIndex&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; root&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Package&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span&gt; fromChainId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span&gt; packageIndex&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; root&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; receivePackages&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Package&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; packages&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getRoot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; fromChainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; packageIndex&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; fromChainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; packageIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; proof&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; msgHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Let:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Package&lt;&#x2F;code&gt;: Collects cross-chain messages within a certain period and bundles them into a single package.
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;fromChainId&lt;&#x2F;code&gt;: The chain from which the package originates.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;packageIndex&lt;&#x2F;code&gt;: The index of the package, starting from 0.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;root&lt;&#x2F;code&gt;: The root generated by the MerkleTree from the &lt;code&gt;leaves&lt;&#x2F;code&gt;, representing the packed package.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;receivePackages()&lt;&#x2F;code&gt;: Receive multiple roots from different source chains&#x27;s SendPort.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;getRoot()&lt;&#x2F;code&gt;: Retrieves a specific root from a particular chain.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;verify()&lt;&#x2F;code&gt;: Verifies if the message on the source chain was sent by the sender.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The traditional approach involves using a push method, as depicted in the following diagram:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7533&#x2F;.&#x2F;assets&#x2F;2.png&quot; alt=&quot;&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;If there are 6 chains, each chain needs to push to the other 5 chains, resulting in the requirement of 30 cross-chain bridges, as shown in the diagram below:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7533&#x2F;.&#x2F;assets&#x2F;3.png&quot; alt=&quot;&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;When N chains require cross-chain communication with each other, the number of cross-chain bridges needed is calculated as: num = N * (N - 1).&lt;&#x2F;p&gt;
&lt;p&gt;Using the pull approach allows the batch of cross-chain messages from 5 chains into 1 transaction, significantly reducing the number of required cross-chain bridges, as illustrated in the following diagram:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7533&#x2F;.&#x2F;assets&#x2F;4.png&quot; alt=&quot;&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;If each chain pulls messages from the other 5 chains onto its own chain, only 6 cross-chain bridges are necessary. For N chains requiring cross-chain communication, the number of cross-chain bridges needed is: num = N.&lt;&#x2F;p&gt;
&lt;p&gt;Thus, the pull approach can greatly reduce the number of cross-chain bridges.&lt;&#x2F;p&gt;
&lt;p&gt;The MerkleTree data structure efficiently compresses the size of cross-chain messages. Regardless of the number of cross-chain messages, they can be compressed into a single root, represented as a byte32 value. The package carrier only needs to transport the root, resulting in low gas cost.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP does not change the consensus layer, so there are no backwards compatibility issues for Ethereum as a whole.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP does not change other ERC standars, so there are no backwards compatibility issues for Ethereum applications.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Below is an example contract for a cross-chain bridge:&lt;&#x2F;p&gt;
&lt;h3 id=&quot;sendport-sol&quot;&gt;&lt;code&gt;SendPort.sol&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;ISendPort.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SendPort&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ISendPort&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; PACK_INTERVAL &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 6000&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; MAX_PACKAGE_MESSAGES &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 100&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; pendingIndex &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Package&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; packages&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        packages&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Package&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;[](&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addMsgHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; msgHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; toChainId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; leaf &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;msgHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; toChainId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        Package &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;storage&lt;&#x2F;span&gt;&lt;span&gt; pendingPackage &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; packages&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;pendingIndex&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        pendingPackage&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;leaves&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;push&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;leaf&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MsgHashAdded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;pendingPackage&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;packageIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; msgHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; toChainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; leaf&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;pendingPackage&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;leaves&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; MAX_PACKAGE_MESSAGES&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            console&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;log&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;MAX_PACKAGE_MESSAGES&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; pendingPackage&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;leaves&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            _pack&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; console.log(&amp;quot;block.timestamp&amp;quot;, block.timestamp);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;pendingPackage&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;createTime &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt; PACK_INTERVAL &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            console&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;log&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;PACK_INTERVAL&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; pendingPackage&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;createTime&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            _pack&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; pack&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;packages&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;pendingIndex&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;createTime &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt; PACK_INTERVAL &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;SendPort::pack: pack interval too short&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;       _pack&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getPackage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; packageIndex&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Package&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; packages&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;packageIndex&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getPendingPackage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Package&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; packages&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;pendingIndex&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _pack&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        Package &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;storage&lt;&#x2F;span&gt;&lt;span&gt; pendingPackage &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; packages&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;pendingIndex&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; _leaves &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; pendingPackage&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;leaves&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        while&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;_leaves&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            _leaves &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _computeLeaves&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_leaves&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        pendingPackage&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;root &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _leaves&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        pendingPackage&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;packTime &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Packed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;pendingPackage&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;packageIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; pendingPackage&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;packTime&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; pendingPackage&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;root&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        pendingIndex &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; pendingPackage&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;packageIndex &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        packages&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;pendingIndex&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Package&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;pendingIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;[](&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; pendingPackage&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;packTime&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _computeLeaves&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _leaves&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _nextLeaves&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;_leaves&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length % &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            _nextLeaves &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;[](&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;_leaves&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt; &#x2F; &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes32&lt;&#x2F;span&gt;&lt;span&gt; computedHash&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; _leaves&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                computedHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _hashPair&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_leaves&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _leaves&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                _nextLeaves&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; computedHash&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes32&lt;&#x2F;span&gt;&lt;span&gt; lastLeaf &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _leaves&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_leaves&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            _nextLeaves &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;[](&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;_leaves&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt; &#x2F; &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt; + &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes32&lt;&#x2F;span&gt;&lt;span&gt; computedHash&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; _leaves&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                computedHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _hashPair&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_leaves&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _leaves&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                _nextLeaves&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; computedHash&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            _nextLeaves&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_nextLeaves&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; lastLeaf&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _hashPair&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; a&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; b&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; a &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; b &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _efficientHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;a&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; b&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; :&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _efficientHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;b&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; a&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _efficientHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; a&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; b&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @solidity memory-safe-assembly&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            mstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x00&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; a&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            mstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x20&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; b&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            value &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x00&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x40&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;External featrues:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;PACK_INTERVAL&lt;&#x2F;code&gt;: The minimum time interval between two consecutive packing operations. If this interval is exceeded, a new packing operation can be initiated.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;MAX_PACKAGE_MESSAGES&lt;&#x2F;code&gt;: Once &lt;code&gt;MAX_PACKAGE_MESSAGES&lt;&#x2F;code&gt; messages are collected, a packing operation is triggered immediately. This takes precedence over the &lt;code&gt;PACK_INTERVAL&lt;&#x2F;code&gt; setting.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;receiveport-sol&quot;&gt;&lt;code&gt;ReceivePort.sol&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;access&#x2F;Ownable.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IReceivePort.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;abstract&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ReceivePort&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IReceivePort&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Ownable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;fromChainId =&amp;gt; packageIndex =&amp;gt; root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; roots&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; receivePackages&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Package&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; packages&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; packages&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            Package &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;calldata&lt;&#x2F;span&gt;&lt;span&gt; p &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; packages&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;roots&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;p&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;fromChainId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;p&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;packageIndex&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ReceivePort::receivePackages: package already exist&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            roots&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;p&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;fromChainId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;p&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;packageIndex&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; p&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;root&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PackageReceived&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;p&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;fromChainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; p&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;packageIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; p&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;root&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getRoot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; fromChainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; packageIndex&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; roots&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;fromChainId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;packageIndex&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; fromChainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; packageIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; proof&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; msgHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; leaf &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;msgHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;chainid&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _processProof&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;proof&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; leaf&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; roots&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;fromChainId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;packageIndex&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _processProof&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; proof&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; leaf&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; computedHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; leaf&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; proof&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            computedHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _hashPair&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;computedHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; proof&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; computedHash&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _hashPair&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; a&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; b&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; a &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; b &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _efficientHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;a&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; b&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; :&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _efficientHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;b&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; a&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _efficientHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; a&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; b&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @solidity memory-safe-assembly&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            mstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x00&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; a&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            mstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x20&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; b&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            value &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x00&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x40&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;bridgeexample-sol&quot;&gt;&lt;code&gt;BridgeExample.sol&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC20&#x2F;IERC20.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC20&#x2F;utils&#x2F;SafeERC20.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;ISendPort.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;ReceivePort.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BridgeExample&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ReceivePort&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    using&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SafeERC20&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC20&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ISendPort &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;public&lt;&#x2F;span&gt;&lt;span&gt; sendPort&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; usedMsgHashes&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; trustBridges&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; crossPairs&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sendPortAddr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        sendPort &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ISendPort&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sendPortAddr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setTrustBridge&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; chainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bridge&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        trustBridges&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;chainId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; bridge&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setCrossPair&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; fromTokenAddr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; toTokenAddr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        crossPairs&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;fromTokenAddr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; toTokenAddr&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getLeaves&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; packageIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; start&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; num&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ISendPort&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;Package &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;memory&lt;&#x2F;span&gt;&lt;span&gt; p &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; sendPort&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getPackage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;packageIndex&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; result &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;[](&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;num&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; p&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;leaves&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; num&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            result&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; p&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;leaves&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt; start&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; result&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferTo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; toChainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; fromTokenAddr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; receiver&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; msgHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;toChainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; fromTokenAddr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; receiver&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        sendPort&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;addMsgHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;msgHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; toChainId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        IERC20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;fromTokenAddr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;safeTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; fromChainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; packageIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; proof&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; fromTokenAddr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; receiver&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; msgHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;chainid&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; fromTokenAddr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; receiver&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;usedMsgHashes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;msgHash&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;transferFrom: Used msgHash&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            verify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                fromChainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                packageIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                proof&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                msgHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                trustBridges&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;fromChainId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;transferFrom: verify failed&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        usedMsgHashes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;msgHash&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; toTokenAddr &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; crossPairs&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;fromTokenAddr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;toTokenAddr &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;transferFrom: fromTokenAddr is not crossPair&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        IERC20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;toTokenAddr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;safeTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;receiver&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Regarding competition and double spending among cross-chain bridges:&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;SendPort&lt;&#x2F;code&gt; is responsible for one task: packing the messages to be cross-chain transferred. The transmission and verification of messages are implemented independently by each cross-chain bridge project. The objective is to ensure that the cross-chain messages obtained by different cross-chain bridges on the source chain are consistent. Therefore, there is no need for competition among cross-chain bridges for the right to transport or validate roots. Each bridge operates independently. If a cross-chain bridge has bugs in its implementation, it poses a risk to itself but does not affect other cross-chain bridges.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Suggestions&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Don&#x27;t let &lt;code&gt;IReceivePort.receivePackages()&lt;&#x2F;code&gt; be called by anyone.&lt;&#x2F;li&gt;
&lt;li&gt;When performing verification, store the verified &lt;code&gt;msgHash&lt;&#x2F;code&gt; to avoid double spending during subsequent verifications.&lt;&#x2F;li&gt;
&lt;li&gt;Don&#x27;t trust all senders in the MerkleTree.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Regarding the forgery of cross-chain messages:&lt;&#x2F;p&gt;
&lt;p&gt;Since the &lt;code&gt;SendPort&lt;&#x2F;code&gt; is a public contract without usage restrictions, anyone can send arbitrary cross-chain messages to it. The &lt;code&gt;SendPort&lt;&#x2F;code&gt; includes the &lt;code&gt;msg.sender&lt;&#x2F;code&gt; in the packing process. If a hacker attempts to forge a cross-chain message, the hacker&#x27;s address will be included in the packing along with the forged message. During verification, the hacker&#x27;s address can be identified. This is why it is suggested to not trust all senders in the MerkleTree.&lt;&#x2F;p&gt;
&lt;p&gt;Regarding the sequnce of messages:&lt;&#x2F;p&gt;
&lt;p&gt;While the &lt;code&gt;SendPort&lt;&#x2F;code&gt; sorts received cross-chain messages by time, there is no guarantee of sequnce during verification. For example, if a user performs a cross-chain transfer of 10 ETH and then 20 USDT, on the target chain, he may withdraw the 20 USDT first and then the 10 ETH, or vice versa. The specific sequnce depends on the implementation of the &lt;code&gt;IReceivePort&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>ETH (Native Asset) Address Convention</title>
        <published>2023-10-03T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Joey Santoro</name><uri>https://github.com/joeysantoro</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7528/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7808-eth-native-asset-address-convention/15989" />
        

        <id>https://wg-eips.ritovision.com/7528/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7528"
            label="ERC-7528" />
        

        
        

        
        <summary type="html">An address placeholder for ETH when used in the same context as an ERC-20 token.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7528/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The following standard proposes a convention for using the address &lt;code&gt;0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee&lt;&#x2F;code&gt; in all contexts where an address is used to represent ETH in the same capacity as an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; token. This would apply to both events where an address field would denote ETH or an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; token, as well as discriminators such as the &lt;code&gt;asset&lt;&#x2F;code&gt; field of an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4626&#x2F;&quot;&gt;ERC-4626&lt;&#x2F;a&gt; vault.&lt;&#x2F;p&gt;
&lt;p&gt;This standard generalizes to other EVM chains where the native asset is not ETH.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;ETH, being a fungible unit of value, often behaves similarly to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens. Protocols tend to implement a standard interface for ERC-20 tokens, and benefit from having the ETH implementation to closely mirror the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; implementations.&lt;&#x2F;p&gt;
&lt;p&gt;In many cases, protocols opt to use Wrapped ETH (e.g. WETH9 deployed at address 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 on Etherum Mainnet) for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; compliance. In other cases, protocols will use native ETH due to gas considerations, or the requirement of using native ETH such as in the case of a Liquid Staking Token (LST).&lt;&#x2F;p&gt;
&lt;p&gt;In addition, protocols might create separate events for handling ETH native cases and ERC-20 cases. This creates data fragmentation and integration overhead for off-chain infrastructure. By having a strong convention for an ETH address to use for cases where it behaves like an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; token, it becomes beneficial to use one single event format for both cases.&lt;&#x2F;p&gt;
&lt;p&gt;One intended use case for the standard is &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4626&#x2F;&quot;&gt;ERC-4626&lt;&#x2F;a&gt; compliant LSTs which use ETH as the &lt;code&gt;asset&lt;&#x2F;code&gt;. This extends the benefits and tooling of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4626&#x2F;&quot;&gt;ERC-4626&lt;&#x2F;a&gt; to LSTs and integrating protocols.&lt;&#x2F;p&gt;
&lt;p&gt;This standard allows protocols and off-chain data infrastructure to coordinate around a shared understanding that any time &lt;code&gt;0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee&lt;&#x2F;code&gt; is used as an address in an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; context, it means ETH.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;This standard applies for all components of smart contract systems in which an address is used to identify an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; token, and where native ETH is used in certain instances in place of an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; token. The usage of the term Token below means ETH or an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; in this context.&lt;&#x2F;p&gt;
&lt;p&gt;Any fields or events where an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; address is used, yet the underlying Token is ETH, the address field MUST return &lt;code&gt;0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Any fields or events where the Token is a non-enshrined wrapped ERC-20 version of ETH (i.e WETH9) MUST use that Token&#x27;s address and MUST NOT use &lt;code&gt;0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Where appropriate, the address should be checksummed. E.g. the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;55&#x2F;&quot;&gt;EIP-55&lt;&#x2F;a&gt; checksum is &lt;code&gt;0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;considered-alternative-addresses&quot;&gt;Considered alternative addresses&lt;&#x2F;h3&gt;
&lt;p&gt;Many existing implementations of the same use case as this standard use addresses such as 0x0, 0x1, and 0xe for gas efficiency of having leading zero bytes.&lt;&#x2F;p&gt;
&lt;p&gt;Ultimately, all of these addresses collide with potential precompile addresses and are less distinctive as identifiers for ETH.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee&lt;&#x2F;code&gt; has the most current usage, is distinctive, and would not collide with any precompiles. These benefits outweigh the potential gas benefits of other alternatives.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This standard has no known compatibility issues with other standards.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Using ETH as a Token instead of WETH exposes smart contract systems to re-entrancy and similar classes of vulnerabilities. Implementers must take care to follow the industry standard development patterns (e.g.  checks-effects-interactions) when the Token is ETH.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Staked ERC-721 Ownership Recognition</title>
        <published>2023-10-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Francesco Sullo</name><uri>https://github.com/sullof</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7531/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7531-resolving-staked-erc-721-ownership-recognition/15967" />
        

        <id>https://wg-eips.ritovision.com/7531/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7531"
            label="ERC-7531" />
        

        
        

        
        <summary type="html">Recognizing NFT ownership when staked into other contracts.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7531/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The ownership of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; tokens when staked in a pool presents challenges, particularly when it involves older, non-lockable NFTs like, for example, Crypto Punks or Bored Ape Yacht Club (BAYC) tokens. This proposal introduces an interface to address these challenges by allowing staked NFTs to be recognized by their original owners, even after they&#x27;ve been staked.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Recent solutions involve retaining NFT ownership while &quot;locking&quot; an NFT letting the owner keeping its ownership. However, this requires the NFT contract to implement lockable functionality. Early NFTs were not originally designed as lockable and so they must be staked transferring the ownership to the staking contract.&lt;&#x2F;p&gt;
&lt;p&gt;This prevents the original owner from accessing valuable privileges and benefits associated with their NFTs.&lt;&#x2F;p&gt;
&lt;p&gt;For example:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A BAYC NFT holder would lose access to the BAYC Yacht Club and member events when staked.&lt;&#x2F;li&gt;
&lt;li&gt;A CryptoPunks holder may miss out on special airdrops or displays only available to verified owners.&lt;&#x2F;li&gt;
&lt;li&gt;Owners of other early NFTs like EtherRocks would lose the social status of provable ownership when staked.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;By maintaining a record of the original owner, the proposed interface allows these original perks to remain accessible even when the NFT is staked elsewhere. This compatibility is critical for vintage NFT projects lacking native locking mechanisms.&lt;&#x2F;p&gt;
&lt;p&gt;Another important right, is the right to use an asset. For example an NFT can be used to play a game. If the NFT is lent to a user, the ownership of the NFT is transferred to the lending contract. In this case, it can be hard to identify the wallet that has the right to us the NFT in the game, which should be the user.&lt;&#x2F;p&gt;
&lt;p&gt;The interface provides a simple, elegant way to extend staking compatibility to legacy NFTs without affecting their core functionality or benefits of ownership.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;The interface is defined as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7531&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST be emitted when the token&amp;#39;s technical owner (the contract holding the token) is different &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *      from its actual owner (the entity with rights over the token). &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This scenario is common in staking, where a staking contract is the technical owner. The event MUST  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *      be emitted in the same or any subsequent block as the Transfer event for the token. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *      A later Transfer event involving the same token supersedes this RightsHolderChange event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *      To ensure authenticity, entities listening to this event MUST verify that the contract emitting&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *      the event matches the token&amp;#39;s current owner as per the related Transfer event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the token contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ID of the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; holder&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the actual rights holder of the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; right&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The type of right held by the holder. The initial supported rights are:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *           0x399d2b36   &#x2F;&#x2F; bytes4(keccak256(&amp;quot;ownership&amp;quot;))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *           0x230a5961   &#x2F;&#x2F; bytes4(keccak256(&amp;quot;usage&amp;quot;))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *        This allows projects to add more rights without breaking compatibility with this interface. See IERC7531Rights for more details.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RightsHolderChange&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; holder&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; right&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the address of the entity with rights over the token, distinct from the current owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *      The function MUST revert if the token does not exist or is not currently held.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the ERC-721 contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ID of the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; right&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The type of right held by the holder.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address of the entity with rights over the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; rightsHolderOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; right&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;RightsHolderChange&lt;&#x2F;code&gt; event is crucial for accurately identifying the actual owner of a held token. In scenarios where a token is staked in a contract, the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; Transfer event would incorrectly assign ownership to the staking contract itself. The &lt;code&gt;RightsHolderChange&lt;&#x2F;code&gt; event addresses this discrepancy by explicitly signaling the real owner of the token rights.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;timing-of-event-emission&quot;&gt;Timing of Event Emission:&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;RightsHolderChange&lt;&#x2F;code&gt; event MUST be emitted either in the same block as the corresponding &lt;code&gt;Transfer&lt;&#x2F;code&gt; event or in any subsequent block. This approach offers flexibility for existing pools to upgrade their systems without compromising past compatibility. Specifically, staking pools can emit this event for all previously staked tokens, or they can allow users to actively reclaim their ownership. This flexibility ensures that the system can adapt to both current and future states while accurately reflecting the actual ownership of held tokens.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;invalidation-of-previous-rightsholderchange-events&quot;&gt;Invalidation of Previous &lt;code&gt;RightsHolderChange&lt;&#x2F;code&gt; Events:&lt;&#x2F;h3&gt;
&lt;p&gt;To maintain compatibility with the broader ecosystem and optimize for gas efficiency, any new &lt;code&gt;Transfer&lt;&#x2F;code&gt; event involving the same token invalidates any previous &lt;code&gt;RightsHolderChange&lt;&#x2F;code&gt; event. This approach ensures that the most recent &lt;code&gt;Transfer&lt;&#x2F;code&gt; event reliably reflects the current ownership status, negating the need for additional events upon unstaking.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;nft-extension&quot;&gt;NFT extension&lt;&#x2F;h3&gt;
&lt;p&gt;The two default rights are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;0x399d2b36   &#x2F;&#x2F; bytes4(keccak256(&quot;ownership&quot;))&lt;&#x2F;li&gt;
&lt;li&gt;0x230a5961   &#x2F;&#x2F; bytes4(keccak256(&quot;usage&quot;))&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;However, there can ben NFTs that only need to validate the ownership, others may need to validate the usage, and others may need to validate both, some other NFT may need to manage totally different rights.&lt;&#x2F;p&gt;
&lt;p&gt;To give NFTs the necessary flexibility, we also propose the following OPTIONAL extension.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7531Rights&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the list of rights supported by the NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; list of rights supported by the NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportedERC7531Rights&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns whether the NFT supports a specific right.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; right&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The right to check.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Whether&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the NFT supports the right.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsERC7531Right&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; right&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;It allows NFTs to return the list of rights they support, and projects to verify it an NFT supports a specific right. Since the rights are identified by the bytes4 hash of the right name, when introducing new rights, NFT projects SHOULD make public statements about the string that corresponds to the bytes4 hash and explain the rationale for it.&lt;&#x2F;p&gt;
&lt;p&gt;If the NFT does not support the interface (for example, if an existing NFT), project using NFTs SHOULD consider only the standard rights.&lt;&#x2F;p&gt;
&lt;p&gt;NFT Projects SHOULD adhere to pre-existing rights, when possible, to avoid the proliferation of rights that could make the system less efficient and more complex.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;addressing-non-lockable-nft-challenges&quot;&gt;Addressing Non-Lockable NFT Challenges:&lt;&#x2F;h3&gt;
&lt;p&gt;Non-lockable NFTs present a unique challenge in decentralized ecosystems, especially in scenarios involving staking or delegating usage rights. The standard &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; &lt;code&gt;ownerOf&lt;&#x2F;code&gt; function returns the current owner of the NFT, which, in the case of staking, would be the staking pool contract. This transfer of ownership to the staking pool, even if temporary, can disrupt the utility or privileges tied to the NFT, such as participation in governance, access to exclusive content, or utility within a specific ecosystem.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;the-rightsholderof-method&quot;&gt;The &lt;code&gt;rightsHolderOf&lt;&#x2F;code&gt; Method:&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;rightsHolderOf&lt;&#x2F;code&gt; method provides a solution to this challenge. By maintaining a record of the original owner or the rightful holder of certain privileges associated with the NFT, this method ensures that the underlying utility of the NFT is preserved, even when the NFT itself is held in a pool.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;technical-advantages&quot;&gt;Technical Advantages:&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Preservation of Utility: This approach allows NFT owners to leverage their assets in staking pools or other smart contracts without losing access to the benefits associated with the NFT. This is particularly important for NFTs that confer ongoing benefits or rights.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Enhanced Flexibility: The method offers greater flexibility for NFT owners, allowing them to participate in staking and other DeFi activities without relinquishing the intrinsic benefits of their NFTs.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Compatibility and Interoperability: By introducing a new method instead of altering the existing ownerOf function, this EIP ensures backward compatibility with existing &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; contracts. This is crucial for maintaining interoperability across various platforms and applications in the NFT space.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Event-Driven Updates: The &lt;code&gt;RightsHolderChange&lt;&#x2F;code&gt; event facilitates real-time tracking of the rights-holder of an NFT. This is particularly useful for third-party platforms and services that rely on up-to-date ownership information to provide services or privileges.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;addressing-potential-misuse&quot;&gt;Addressing Potential Misuse:&lt;&#x2F;h3&gt;
&lt;p&gt;While this approach introduces a layer of complexity, it also comes with the need for diligent implementation to prevent misuse, such as the wrongful assignment of rights. This EIP outlines security considerations and best practices to mitigate such risks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is fully backwards compatible with existing &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; contracts. It can seamlessly integrate with existing upgradeable staking pools, provided they choose to adopt it. It does not require changes to the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; standard but acts as an enhancement for staking pools.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;A potential risk with this interface is the improper assignment of ownership by a staking pool to a different wallet. This could allow that wallet to access privileges associated with the NFT, which might not be intended by the true owner. However, it is important to note that this risk is lower than transferring full legal ownership of the NFT to the staking pool, as the interface only enables recognizing the staker, not replacing the actual owner on-chain.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;event-authenticity&quot;&gt;Event Authenticity:&lt;&#x2F;h3&gt;
&lt;p&gt;There is a concern regarding the potential emission of fake &lt;code&gt;RightsHolderChange&lt;&#x2F;code&gt; events. Since any contract can emit such an event, there&#x27;s a risk of misinformation or misrepresentation of ownership. It is crucial for entities listening to the &lt;code&gt;RightsHolderChange&lt;&#x2F;code&gt; event to verify that the emitting contract is indeed the current owner of the token. This validation is essential to ensure the accuracy of ownership information and to mitigate the risks associated with deceptive event emissions.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;reducing-the-risk-of-inaccurate-ownership-records&quot;&gt;Reducing the Risk of Inaccurate Ownership Records:&lt;&#x2F;h3&gt;
&lt;p&gt;While improper use of this interface poses some risk of inaccurate ownership records, this is an inherent issue with any staking arrangement. The risk is somewhat mitigated by the fact that the owner retains custody rather than transferring ownership.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;due-diligence&quot;&gt;Due Diligence:&lt;&#x2F;h3&gt;
&lt;p&gt;Consumers of privilege-granting NFTs should exercise due diligence when evaluating staking providers. Signs of mismanagement or fraud should be carefully assessed. The interface itself does not enable new manipulation capabilities, but caution is always prudent when interacting with smart contracts and staking pools.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Block-level Warming with fair cost savings</title>
        <published>2023-10-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Yoav Weiss</name><uri>https://github.com/yoavw</uri>
	</author>
	
	<author>
		<name>Alex Forshtat</name><uri>https://github.com/forshtat</uri>
	</author>
	
	<author>
		<name>Dror Tirosh</name><uri>https://github.com/drortirosh</uri>
	</author>
	
	<author>
		<name>Shahaf Nacson</name><uri>https://github.com/shahafn</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7557/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7557-block-level-warming/16642" />
        

        <id>https://wg-eips.ritovision.com/7557/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7557"
            label="EIP-7557" />
        

        
        

        
        <summary type="html">Block-level warming of addresses and slots with access lists</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7557/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;A mechanism for a fair distribution of the gas costs associated with access to addresses and storage slots
among multiple transactions with shared items in their &lt;code&gt;accessList&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929: Gas cost increases for state access opcodes&lt;&#x2F;a&gt; introduced a new gas cost model that differentiates
between &quot;cold&quot; and &quot;warm&quot; access to accounts and storage slots.&lt;&#x2F;p&gt;
&lt;p&gt;However, the cost of every cold access is borne by each transaction separately, even though the validator only
needs to fetch the state object once for the entire block.&lt;&#x2F;p&gt;
&lt;p&gt;When multiple transactions access the same state object in the same block the fees charged for these transactions
do not accurately reflect the computations that block builders and validators perform for the blockchain state access
during transaction execution.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930: Optional access lists&lt;&#x2F;a&gt; made it possible for transactions to pre-specify and pre-pay for the
accounts and storage slots that the transaction plans to access,
however, the cost is still paid repeatedly by each transaction rather than once at the block level.&lt;&#x2F;p&gt;
&lt;p&gt;With the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6800&#x2F;&quot;&gt;EIP-6800: Ethereum state using a unified verkle tree&lt;&#x2F;a&gt; on the roadmap for inclusion,
the cost of reading from the Ethereum state and especially the contract code is expected to increase.&lt;&#x2F;p&gt;
&lt;p&gt;Especially affected by this upcoming change will be transactions that involve smart contracts with a high code size.&lt;&#x2F;p&gt;
&lt;p&gt;Each such transaction in the block will be forced to pay the full &quot;retail&quot; price for loading smart contract
bytecode during a transaction.&lt;&#x2F;p&gt;
&lt;p&gt;The validators, however, only have to perform the actual reading from the Ethereum state once per block,
and all subsequent reads of the values that were already referenced are significantly more efficient.&lt;&#x2F;p&gt;
&lt;p&gt;If witnesses are introduced to Ethereum blocks, the same witness can be reused by multiple transactions.
Requiring each transaction to pay regardless of the contents of the block is unfair and inefficient.&lt;&#x2F;p&gt;
&lt;p&gt;Another change that may be on the roadmap for Ethereum is Account Abstraction.
This change will see a large share of transactions being initiated by smart contracts directly.
It is reasonable to expect many of these Smart Contract Accounts to rely on the same core wallet implementations.
If each Account Abstraction transaction is charged a full gas cost of loading the Smart Contract Account code repeatedly,
such transactions would become significantly overpriced.&lt;&#x2F;p&gt;
&lt;p&gt;This difference is especially noticeable when compared to an EOA, which gets its validation logic loaded and executed for free.&lt;&#x2F;p&gt;
&lt;p&gt;In this scenario, the base gas fees would be taken from the senders and burned needlessly while block proposers
would be enjoying an unjustified excessive earning of priority gas fees.&lt;&#x2F;p&gt;
&lt;p&gt;A major distinction between this proposal and alternatives, such as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7863&#x2F;&quot;&gt;EIP-7863&lt;&#x2F;a&gt;, lies in performing a fair
distribution of gas savings between all participants - all transactions senders and the block builder.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930: Optional access lists&lt;&#x2F;a&gt; already introduced the first part of the solution.
Each transaction can specify an array of &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt; and &lt;code&gt;accessed_storage_keys&lt;&#x2F;code&gt; to announce its intention to
read those values during the execution of the transaction.&lt;&#x2F;p&gt;
&lt;p&gt;The sender of the transaction is then pre-charged with the cost of accessing this data but is given a small discount
compared to unannounced access.&lt;&#x2F;p&gt;
&lt;p&gt;The missing component is a mechanism to aggregate the gas costs of the cold access and redistribute the resulting
savings amongst the participating transactions.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;overview&quot;&gt;Overview&lt;&#x2F;h3&gt;
&lt;p&gt;During the transaction execution, the cost of all storage-related operations is not affected,
and all rules from EIP-2929 and EIP-2930 continue to apply.&lt;&#x2F;p&gt;
&lt;p&gt;There are no changes to the block header or the transaction payload and receipt.&lt;&#x2F;p&gt;
&lt;p&gt;As the last operation of each block, the collected gas costs associated with storage access are redistributed
among the senders of all transactions withing a block.
This affects the balances of all these accounts in a way that only becomes observable in the next block.&lt;&#x2F;p&gt;
&lt;p&gt;This reimbursement&#x27;s amount is proportional to the amount paid for the access in the first place.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;participant-transactions-mapping&quot;&gt;Participant transactions mapping&lt;&#x2F;h3&gt;
&lt;p&gt;After the block builder finalizes the contents of the block, it iterates over all included transactions to read
the &lt;code&gt;accessList&lt;&#x2F;code&gt; component of each supported transaction.&lt;&#x2F;p&gt;
&lt;p&gt;The block builder then constructs an array containing each accessed address and each accessed slot, and an array of
transaction senders&#x27; addresses that initiated at least one access to the given address or slot,
as well as the &lt;code&gt;priorityFeePerGas&lt;&#x2F;code&gt; that was paid for such access.&lt;&#x2F;p&gt;
&lt;p&gt;A sample JSON representation of the data structure that represents such a structure and is used in the pseudocode below:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;accessors&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;priorityFeePerGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;priorityFeePerGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xFFcf8FDEE72ac11b5c542428B35EEF5769C409f0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;priorityFeePerGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xFFcf8FDEE72ac11b5c542428B35EEF5769C409f0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;priorityFeePerGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x22d491Bde2303f2f43325b2108D26f1eAbA1e32b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;priorityFeePerGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x22d491Bde2303f2f43325b2108D26f1eAbA1e32b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;priorityFeePerGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;3000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;slots&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000000000000000000000000000003&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;accessors&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;priorityFeePerGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;priorityFeePerGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x22d491Bde2303f2f43325b2108D26f1eAbA1e32b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;priorityFeePerGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x22d491Bde2303f2f43325b2108D26f1eAbA1e32b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;priorityFeePerGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;3000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000000000000000000000000000007&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;accessors&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xFFcf8FDEE72ac11b5c542428B35EEF5769C409f0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;priorityFeePerGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xFFcf8FDEE72ac11b5c542428B35EEF5769C409f0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;priorityFeePerGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;calculating-a-reimbursement-of-the-burned-base-fee&quot;&gt;Calculating a reimbursement of the burned base fee&lt;&#x2F;h3&gt;
&lt;p&gt;Considering that the same amount of computation is needed to access an address or a slot regardless of the number of
transactions using one, it is reasonable for the protocol to only burn the gas cost of the cold access once.
As all transactions in the same block pay exactly the same &lt;code&gt;baseFeePerGas&lt;&#x2F;code&gt;, the single cost of accessing a cold item is
divided evenly among all transactions containing such access and the rest of the burned base fee is reimbursed.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;setting-an-absolute-minimal-cost-of-cold-state-access&quot;&gt;Setting an absolute minimal cost of cold state access&lt;&#x2F;h3&gt;
&lt;p&gt;If a large number of transactions all access the same addresses or slots, the cost of each cold access may get
way too low which may represent a potential DoS attack vector.&lt;&#x2F;p&gt;
&lt;p&gt;In order to prevent that, the gas cost of including an entity in the access list cannot be lower
than &lt;code&gt;MIN_ACCESS_LIST_ENTRY_COST&lt;&#x2F;code&gt;, which is set to &lt;code&gt;32 gas&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This value is equivalent to the calldata cost of including two bytes long identifier of entries in &lt;code&gt;block_access_list&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;calculating-a-reimbursement-of-the-charged-priority-fee&quot;&gt;Calculating a reimbursement of the charged priority fee&lt;&#x2F;h3&gt;
&lt;p&gt;Each transaction pays an individual &lt;code&gt;priorityFeePerGas&lt;&#x2F;code&gt; value and redistributing this part of the cold access cost
is more complex.&lt;&#x2F;p&gt;
&lt;p&gt;We propose the following approach to a fair reimbursement of the paid &lt;code&gt;priorityFee&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;The validator gets paid the &lt;code&gt;priorityFee&lt;&#x2F;code&gt; for each cold access only once, but according to the highest &lt;code&gt;priorityFee&lt;&#x2F;code&gt;
among the transactions containing the said cold access.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The rest of the Ether that was charged by the validator as a  &lt;code&gt;priorityFee&lt;&#x2F;code&gt; is redistributed back to all the senders
of transactions containing the same cold access in proportion to their &lt;strong&gt;marginal contribution&lt;&#x2F;strong&gt; to the
&lt;strong&gt;total gains&lt;&#x2F;strong&gt; of the transaction.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The block builder is only paid for access once and the remaining value is reimbursed.
So the &lt;code&gt;total reimbursement&lt;&#x2F;code&gt; value is a difference between the sum of value charged and the block builder&#x27;s reward.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;total gains&lt;&#x2F;code&gt; of the transaction is defined by a sum of the &lt;code&gt;priorityFee&lt;&#x2F;code&gt; paid out to the block builder
and &lt;code&gt;total reimbursement&lt;&#x2F;code&gt; made to all participants.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Mathematically, the &lt;code&gt;marginal contribution&lt;&#x2F;code&gt; of a transaction to the &lt;code&gt;total gains&lt;&#x2F;code&gt; is defined as
the difference between the sum &lt;code&gt;total gains&lt;&#x2F;code&gt; value calculated when all transactions in a block are included,
and when all transactions are included except for this particular transaction.
In practice this value always amounts to &lt;code&gt;priorityFee * gasCost&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;𝑀𝐶𝑖 = 𝑣(𝑆 ∪ {𝑖}) − 𝑣(𝑆)&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;A single transaction accessing an address or a slot that is not shared by other transactions does not trigger a reimbursement,
and therefore has a zero marginal contribution.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;efficiently-storing-the-access-lists-in-the-block-history&quot;&gt;Efficiently storing the access lists in the block history&lt;&#x2F;h3&gt;
&lt;p&gt;The contents of the &lt;code&gt;accessList&lt;&#x2F;code&gt; parameter are part of the Ethereum history and the potential cost of keeping this
data in the blockchain must be accounted for when implementing this change.
There is currently no additional charge applied to the &lt;code&gt;accessList&lt;&#x2F;code&gt; parameter, due to the cost of including
an address or a storage slot in the &lt;code&gt;accessList&lt;&#x2F;code&gt; being a constant value that is significantly higher than the
potential cost of storing the &lt;code&gt;accessList&lt;&#x2F;code&gt; at the cost of  a
dynamically sized &lt;code&gt;calldata&lt;&#x2F;code&gt; field.&lt;&#x2F;p&gt;
&lt;p&gt;With the block-level warming there is a change that makes it possible for a transaction sender to construct
transactions with a large &lt;code&gt;accessList&lt;&#x2F;code&gt; that cost very little to be included, and this can be used to bloat the
blockchain size.&lt;&#x2F;p&gt;
&lt;p&gt;This potential bloating of the block size also presents a challenge for the propagation of the block in a P2P network.&lt;&#x2F;p&gt;
&lt;p&gt;In order to minimize the cost of permanently storing access lists, we propose the following changes to
the &lt;code&gt;execution_payload&lt;&#x2F;code&gt; structure:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Add a new &lt;code&gt;block_access_list&lt;&#x2F;code&gt; field.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The execution clients create a combined block-level &quot;access list&quot; that contains all unique entries from all
transactions in the block.
2. All individual transaction &lt;code&gt;accessList&lt;&#x2F;code&gt; fields replace the full entries with a
compact 2 bytes long reference to the &lt;code&gt;block_access_list&lt;&#x2F;code&gt; in the same order they appeared originally.&lt;&#x2F;p&gt;
&lt;p&gt;With this approach shared entries in the access lists cannot cause sufficient bloating of the block size.&lt;&#x2F;p&gt;
&lt;p&gt;There is no need to introduce any observable changes to the RPC API as this &quot;compression&quot; can be unwrapped by the
clients in real time.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;pseudocode-implementation-of-the-reimbursement-calculation-algorithm&quot;&gt;Pseudocode implementation of the reimbursement calculation algorithm&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;export&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calculateBlockColdAccessReimbursement&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  baseFeePerGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  accessDetailsMap&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AddressAccessDetails&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Map&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; reimbursement&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; reimbursements&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Map&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Reimbursement&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; accessDetail&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; of&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; accessDetailsMap&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    calculateItemColdAccessReimbursement&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;accessDetail&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;accessors&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; baseFeePerGas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; COLD_ACCOUNT_ACCESS_COST&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; reimbursements&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; of&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; accessDetail&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;slots&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      calculateItemColdAccessReimbursement&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;slot&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;accessors&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; baseFeePerGas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; COLD_SLOAD_COST&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; reimbursements&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; reimbursements&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calculateItemColdAccessReimbursement&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  unsortedAccessors&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AccessDetails&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  baseFeePerGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  accessGasCost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  reimbursements&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Map&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Reimbursement&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; void&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; sortedAccessDetails&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; unsortedAccessors&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;sort&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; b&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; parseInt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;b&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;priorityFeePerGas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; parseInt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;priorityFeePerGas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; addressAccessN&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sortedAccessDetails&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; reimbursementPercent&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;addressAccessN&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; addressAccessN&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; reimbursementsFromCoinbase&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calculatePriorityFeeReimbursements&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sortedAccessDetails&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; accessGasCost&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sortedAccessDetails&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; accessor&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sortedAccessDetails&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; reimbursement&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; reimbursements&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;get&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;accessor&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ??&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt; reimbursementFromBurn&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; reimbursementFromCoinbase&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; adjustedAccessGasCost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Math&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;MIN_ACCESS_LIST_ENTRY_COST&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; parseInt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;accessGasCost&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; reimbursementPercent&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    reimbursement&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;reimbursementFromBurn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BigInt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;adjustedAccessGasCost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; parseInt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;baseFeePerGas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    reimbursement&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;reimbursementFromCoinbase&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BigInt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;reimbursementsFromCoinbase&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    reimbursements&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;set&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;accessor&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; reimbursement&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;export&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calculatePriorityFeeReimbursements&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;sortedAccesses&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AccessDetails&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; accessGasCost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Validator charge is based on the highest paid priority fee per gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; validatorFee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; parseInt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sortedAccesses&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;priorityFeePerGas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; parseInt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;accessGasCost&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Accumulate the sum of all &amp;quot;contributions&amp;quot;, at least the top transaction contribution&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; totalContributions&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; validatorFee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Accumulate cost of gas paid to validator for accessing the same address&#x2F;slot&#x2F;chunk&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; totalSendersCharged&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; parseInt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sortedAccesses&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;priorityFeePerGas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; parseInt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;accessGasCost&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Starting with `1` as element at `0` is explicitly shown here to be used as `validatorFee`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sortedAccesses&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; charge&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; parseInt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sortedAccesses&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;priorityFeePerGas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; parseInt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;accessGasCost&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    totalContributions&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; charge&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    totalSendersCharged&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; charge&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Calculate the total amount of ether to be reimbursed for this access&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; totalReimbursement&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; totalSendersCharged&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; validatorFee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;totalReimbursement&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; possible if only single transaction or if all priority fees are 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Array&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sortedAccesses&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;fill&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Calculate actual charges and reimbursements&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; reimbursements&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Math&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;floor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;totalReimbursement&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; topTransactionContribution&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; totalContributions&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sortedAccesses&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; charge&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; parseInt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sortedAccesses&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;priorityFeePerGas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; parseInt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;accessGasCost&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; calldataCharge&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; parseInt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sortedAccesses&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;priorityFeePerGas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; MIN_ACCESS_LIST_ENTRY_COST&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; reimbursementToCalldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; charge&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; calldataCharge&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; reimbursementToContribution&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Math&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;floor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;totalReimbursement&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; charge&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; totalContributions&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    reimbursements&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;push&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Math&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;reimbursementToCalldata&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; reimbursementToContribution&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; reimbursements&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note that two accumulating values, &lt;code&gt;reimbursementFromBurn&lt;&#x2F;code&gt; and &lt;code&gt;reimbursementFromCoinbase&lt;&#x2F;code&gt;,
are necessary in light of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559: Fee market change for ETH 1.0 chain&lt;&#x2F;a&gt; in order to differentiate
between the Ether reimbursement that is originating from a reduced block gas burn,
and from the reduced block proposer priority fee per gas reward.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;future-eip-6800-gas-reform-support&quot;&gt;Future EIP-6800 gas reform support&lt;&#x2F;h3&gt;
&lt;p&gt;Once &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6800&#x2F;&quot;&gt;EIP-6800&lt;&#x2F;a&gt; is active, the cost of accessing a contract code for a cold address is expected to change.&lt;&#x2F;p&gt;
&lt;p&gt;Instead of being a constant value of &lt;code&gt;COLD_ACCOUNT_ACCESS_COST&lt;&#x2F;code&gt; (currently 2600 gas),
the total cost will be determined by the number of 31-byte &quot;chunks&quot; the code consists of.
Each &quot;chunk&quot; of code will have a cost of &lt;code&gt;CODE_CHUNK_ACCESS_COST&lt;&#x2F;code&gt; (currently 200 gas).&lt;&#x2F;p&gt;
&lt;p&gt;For a maximum contract size of &lt;code&gt;24576 bytes&lt;&#x2F;code&gt; defined by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;170&#x2F;&quot;&gt;EIP-170&lt;&#x2F;a&gt; the cost of accessing this contract
surges from &lt;code&gt;2600&lt;&#x2F;code&gt; to &lt;code&gt;158600&lt;&#x2F;code&gt; gas.&lt;&#x2F;p&gt;
&lt;p&gt;This change will likely require the &lt;code&gt;accessList&lt;&#x2F;code&gt; parameter of transactions to be adjusted for transactions
to be able to specify which code chunks will be accessed.&lt;&#x2F;p&gt;
&lt;p&gt;In such case the changes are reflected in the reimbursement function as well, which is updated by adding the following code
in order to redistribute the shared cost of accessing the same code chunk in multiple transactions:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; reimbursementsFromCoinbase&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calculatePriorityFeeReimbursements&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sortedCodeChunkAccessDetails&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; CHUNK_ACCESS_COST&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sortedAccessDetails&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; reimbursement&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; reimbursements&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;get&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;accessor&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  reimbursement&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;reimbursementFromBurn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; CHUNK_ACCESS_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;baseFeePerGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; reimbursementPercent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  reimbursement&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;reimbursementFromCoinbase&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; reimbursementsFromCoinbase&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;cost-redistribution-system-operation&quot;&gt;Cost redistribution system operation&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4895&#x2F;&quot;&gt;EIP-4895: Beacon chain push withdrawals as operations&lt;&#x2F;a&gt; sets a precedent by introducing a concept of a &lt;code&gt;system-level withdrawal operation&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;We propose the introduction of yet another system-level operation called &lt;code&gt;cost redistribution&lt;&#x2F;code&gt;.
The &lt;code&gt;redistributions&lt;&#x2F;code&gt; in an execution payload are processed after any user-level transactions are applied.&lt;&#x2F;p&gt;
&lt;p&gt;The block builder or a validator prepares a list of reimbursement information.&lt;&#x2F;p&gt;
&lt;p&gt;For each &lt;code&gt;redistribution&lt;&#x2F;code&gt; in the list, the implementation increases the balance of the address specified by the amount &lt;code&gt;reimbursementFromBurn + reimbursementFromCoinbase&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The balance of the &lt;code&gt;coinbase&lt;&#x2F;code&gt; is reduced by a sum of all &lt;code&gt;reimbursementFromCoinbase&lt;&#x2F;code&gt; values.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;current-cold-storage-gas-cost-is-unfair&quot;&gt;Current cold storage gas cost is unfair&lt;&#x2F;h3&gt;
&lt;p&gt;As described in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7557&#x2F;#motivation&quot;&gt;Motivation&lt;&#x2F;a&gt; section, the amount of gas that users spend on accessing the contract code does not reflect the actual cost of this access for the block builder or a validator.&lt;&#x2F;p&gt;
&lt;p&gt;The more popular the contract code or a storage slot is, the more transactions in each block should share the cost.
However, the current system multiplies the cost for the users instead of dividing it.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;issuing-a-regular-gas-refund-after-a-transaction-is-not-possible&quot;&gt;Issuing a regular gas refund after a transaction is not possible&lt;&#x2F;h3&gt;
&lt;p&gt;There exists a list of EVM instructions that trigger both a gas charge and a gas refund.
A notable example of such operations is the &lt;code&gt;0x55 SSTORE&lt;&#x2F;code&gt; opcode as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1283&#x2F;&quot;&gt;EIP-1283: Net gas metering for SSTORE without dirty maps&lt;&#x2F;a&gt;.
Intuitively it seems reasonable to issue the gas reimbursements for the shared cold storage access in the same fashion.&lt;&#x2F;p&gt;
&lt;p&gt;However, this approach significantly complicates the block-building process.
In this case, the inclusion or exclusion of a transaction at the end of the block triggers observable effects in transactions included at the beginning of the block, and this makes the job of finding a valid set of transactions for a block potentially computationally unsolvable.&lt;&#x2F;p&gt;
&lt;p&gt;Therefore, we propose performing the reimbursements at the end of the block, where it cannot change the behavior of any transaction in the block.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;weighting-priority-fee-reimbursement&quot;&gt;Weighting priority fee reimbursement&lt;&#x2F;h3&gt;
&lt;p&gt;A common game-theoretical answer to the problem of calculating a fair redistribution of the payoff of the
results of the participants&#x27; cooperation is the use of Shapley values.&lt;&#x2F;p&gt;
&lt;p&gt;However, we argue that the proposed distribution of the &lt;code&gt;priorityFee&lt;&#x2F;code&gt; reimbursements is sufficiently fair while being
a lot easier to compute or articulate.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal does not introduce a change to any behavior that can be observed by a smart contract during its execution.
The only effect this change has is a lower effective gas cost for the transaction senders.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The upper limit of storage reads in one block is not affected by this change as the gas charge is done with the
full cost of &lt;code&gt;COLD_ACCOUNT_ACCESS_COST&lt;&#x2F;code&gt; or &lt;code&gt;COLD_SLOAD_COST&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The maximum amount of memory and computation required to calculate the reimbursements according to the
specified algorithm is insignificant.&lt;&#x2F;p&gt;
&lt;p&gt;It appears that this change does not have any negative security implications.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Contract Discovery and eTLD+1 Association</title>
        <published>2023-09-30T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Todd Chapman</name><uri>https://github.com/tthebc01</uri>
	</author>
	
	<author>
		<name>Charlie Sibbach</name><email>charlie@cwsoftware.com</email>
	</author>
	
	<author>
		<name>Sean Sing</name><uri>https://github.com/seansing</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7529/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/add-eip-dns-over-https-for-contract-discovery-and-etld-1-association/15996" />
        

        <id>https://wg-eips.ritovision.com/7529/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7529"
            label="ERC-7529" />
        

        
        

        
        <summary type="html">Leveraging TXT Records to discover, verify and associate a smart contract with the owner of a DNS domain.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7529/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The introduction of DNS over HTTPS (DoH) in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc8484&quot;&gt;RFC 8484&lt;&#x2F;a&gt; has enabled tamper-resistant client-side queries of DNS records directly from a web application. This proposal describes a simple standard leveraging DoH to fetch TXT records (from traditional DNS service providers) which are used for discovering and verifying the association of a smart contract with a common DNS domain. This standard can be used as a straightforward technique to mitigate smart contract authorship spoofing and enhance the discoverability of smart contracts through standard web search mechanisms.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;As mainstream businesses begin to adopt public blockchain and digital asset technologies more rapidly, there is a growing need for a discovery&#x2F;search mechanism (compatible with conventional web technologies) of smart contracts associated with a known business domain as well as reasonable assurance that the smart contract does indeed belong to the business owner of the DNS domain. The relatively recent introduction and widespread support of DoH means it is possible to make direct, tamper-resistant queries of DNS records straight from a web application context and thus leverage a simple TXT record as a pointer to an on-chain smart contract. Prior to the introduction of DoH, web (and mobile) applications &lt;em&gt;could not&lt;&#x2F;em&gt; access DNS records directly; instead they would have to relay requests through a trusted, proprietary service provider who could easily manipulate response results.&lt;&#x2F;p&gt;
&lt;p&gt;According to Cloudflare, the two most common use cases of TXT records today are email spam prevention (via &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc7208&quot;&gt;SPF&lt;&#x2F;a&gt;, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc6376&quot;&gt;DKIM&lt;&#x2F;a&gt;, and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc7489&quot;&gt;DMARC&lt;&#x2F;a&gt; TXT records) and domain name ownership verification. The use case considered here for on-chain smart contract discovery and verification is essentially analogous.&lt;&#x2F;p&gt;
&lt;p&gt;A TXT pointer coupled with an appropriate smart contract interface (described in this proposal) yields a simple, yet flexible and robust mechanism for the client-side detection and reasonably secure verification of on-chain logic and digital assets associated with the owner of a domain name. For example, a stablecoin issuer might leverage this standard to provide a method for an end user or web-based end user client to ensure that the asset their wallet is interacting with is indeed the contract issued or controlled by the owner or administrator of a well known DNS domain.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Example 1&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;p&gt;A user visits merchant.com who accepts payments via paymentprocessor.com. The business behind paymentprocessor.com has previously released a stable coin for easier cross-border payments which adheres to this ERC. On the checkout page, paymentprocessor.com is mounted as an iframe component. If the user has installed a browser-extension wallet compatible with this standard, then the wallet can detect the domain of the iframe in the context of the checkout page, discover and verify the stable coin&#x27;s association with paymentprocessor.com, and automatically prompt to complete the purchase in paymentprocessor.com&#x27;s stable coin.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Example 2&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;p&gt;A user visits nftmarketplace.io to buy a limited release NFT from theirfavoritebrand.com. The marketplace webapp can leverage this ERC to allow the user to search by domain name and also indicate to the user that an NFT of interest is indeed an authentic asset associated with theirfavoritebrand.com.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;definition-etld-1&quot;&gt;Definition: eTLD+1&lt;&#x2F;h4&gt;
&lt;p&gt;The term TLD stands for &lt;em&gt;top-level domain&lt;&#x2F;em&gt; and is always the part of a domain name which follows the final dot in a URL (e.g. &lt;code&gt;.com&lt;&#x2F;code&gt; or &lt;code&gt;.net&lt;&#x2F;code&gt;). If only domains directly under TLDs where registrable by a single organization, then it would be guaranteed that &lt;code&gt;myexample.com&lt;&#x2F;code&gt;, &lt;code&gt;abc.myexample.com&lt;&#x2F;code&gt;, and &lt;code&gt;def.myexample.com&lt;&#x2F;code&gt; all belonged to the same organization.&lt;&#x2F;p&gt;
&lt;p&gt;However, this is not the case in general since many DNS registrars allow organizations to register domain names below the top level (examples include &lt;code&gt;sussex.ac.uk&lt;&#x2F;code&gt; and &lt;code&gt;aber.ac.uk&lt;&#x2F;code&gt; which are controlled by different institutions). These types of domains are referred to as eTLDs (effective top-level domains) and represent a domain under which domain names can be registered by a single organization. For example, the eTLD of &lt;code&gt;myexample.com&lt;&#x2F;code&gt; is &lt;code&gt;.com&lt;&#x2F;code&gt; and the eTLD of &lt;code&gt;sussex.ac.uk&lt;&#x2F;code&gt; is &lt;code&gt;.ac.uk&lt;&#x2F;code&gt; since individual organizations can be issued their own domain names under both &lt;code&gt;.com&lt;&#x2F;code&gt; and &lt;code&gt;.ac.uk&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Therefore, an eTLD+1 is an eTLD &lt;em&gt;plus&lt;&#x2F;em&gt; this next part on the domain name. Since eTLDs are by definition registerable, all domains with the same eTLD+1 are owned by the same organization, which makes them appropriate to utilize in this proposal for associating a smart contract with a single business or organization entity.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;contract-pointers-in-txt-records&quot;&gt;Contract Pointers in TXT Records&lt;&#x2F;h3&gt;
&lt;p&gt;The owner of an eTLD+1 domain name MUST create a TXT record in their DNS settings that serves as a pointer to all relevant smart contracts they wish to associate with their domain.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc1035#section-3.3.14&quot;&gt;TXT records&lt;&#x2F;a&gt; are not intended (nor permitted by most DNS servers) to store large amounts of data. Every DNS provider has their own vendor-specific character limits. However, an EVM-compatible address string is 42 characters, so most DNS providers will allow for dozens of contract addresses to be stored under a single record. Furthermore, a domain is allowed to have multiple TXT records associated with the same host and the content of all duplicate records can be retrieved in a single DoH query.&lt;&#x2F;p&gt;
&lt;p&gt;A TXT record pointing to an organization&#x27;s smart contracts MUST adhere to the following schema:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;HOST&lt;&#x2F;code&gt;: &lt;code&gt;ERC-7529.&amp;lt;chain_id&amp;gt;._domaincontracts&lt;&#x2F;code&gt; (where &lt;code&gt;&amp;lt;chain_id&amp;gt;&lt;&#x2F;code&gt; is replaced by the decimal representation of the chain id)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;VALUE&lt;&#x2F;code&gt;: &amp;lt;&lt;code&gt;address 1&lt;&#x2F;code&gt;&amp;gt;,&amp;lt;&lt;code&gt;address 2&lt;&#x2F;code&gt;&amp;gt;,...&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;It is RECOMMENDED that EVM address strings adhere to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1191&#x2F;&quot;&gt;ERC-1191&lt;&#x2F;a&gt; so that the browser client can checksum the validity of the address and its target network before making an RPC call.&lt;&#x2F;p&gt;
&lt;p&gt;A user&#x27;s web application can access TXT records directly from a DNS registrar who supports DoH with &lt;code&gt;fetch&lt;&#x2F;code&gt;. An example query of a DoH server that supports JSON format will look like:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;await&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fetch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;example-doh-provider.com&#x2F;dns-query?name=ERC-7529.1._domaincontracts.myexample.com&amp;amp;type=TXT&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  headers&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Accept&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;application&#x2F;dns-json&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;smart-contract-association-with-a-domain&quot;&gt;Smart Contract Association with a Domain&lt;&#x2F;h3&gt;
&lt;p&gt;Any smart contract MAY implement this ERC to provide a verification mechanism of smart contract addresses listed in a compatible TXT record.&lt;&#x2F;p&gt;
&lt;p&gt;A smart contract need only store one new member variable, &lt;code&gt;domains&lt;&#x2F;code&gt;, which is a mapping from the keccak256 hash of all eTLD+1 domain strings associated with the business or organization which deployed (or is closely associated with) the contract to a boolean. This member variable can be written to with the external functions &lt;code&gt;addDomain&lt;&#x2F;code&gt; and &lt;code&gt;removeDomain&lt;&#x2F;code&gt;. The &lt;code&gt;domains&lt;&#x2F;code&gt; member variable can be queried by the &lt;code&gt;checkDomain&lt;&#x2F;code&gt; function which takes a string representing an eTLD+1 and returns true
if the contract has been associated with the domain and false otherwise.&lt;&#x2F;p&gt;
&lt;p&gt;Lastly, the contract MAY emit events when eTLD+1 domains are added (&lt;code&gt;AddDomain&lt;&#x2F;code&gt;) or removed (&lt;code&gt;RemoveDomain&lt;&#x2F;code&gt;) from the &lt;code&gt;domains&lt;&#x2F;code&gt; map. This can be useful for
determining all domains associated with a contract when they are not known ahead of time by the client.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Optional event emitted when a domain is added&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; domain&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; eTLD+1 associated with the contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AddDomain&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; domain&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Optional event emitted when a domain is removed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; domain&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; eTLD+1 that is no longer associated with the contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RemoveDomain&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; domain&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; a mapping from the keccak256 hash of eTLD+1 domains associated with this contract to a boolean&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; domains&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; a getter function that takes an eTLD+1 domain string and returns true if associated with the contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; domain&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; a string representing an eTLD+1 domain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checkDomain&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; domain&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; an authenticated method to add an eTLD+1 domain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; domain&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; a string representing an eTLD+1 domain associated with the contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addDomain&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; domain&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; an authenticated method to remove an eTLD+1 domain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; domain&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; a string representing an eTLD+1 domain that is no longer associated with the contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; removeDomain&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; domain&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;client-side-verification&quot;&gt;Client-side Verification&lt;&#x2F;h3&gt;
&lt;p&gt;When a client detects a compatible TXT record listed on an eTLD+1, it SHOULD loop through each listed contract address and, via an appropriate RPC provider, assert
that each of the smart contracts returns &lt;code&gt;true&lt;&#x2F;code&gt; when the eTLD+1 string is passed to the &lt;code&gt;checkDomain&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;p&gt;Alternatively, if a client is inspecting a contract that implements this ERC, the client SHOULD inspect the &lt;code&gt;AddDomain&lt;&#x2F;code&gt; and &lt;code&gt;RemoveDomain&lt;&#x2F;code&gt; events to calculate if
one or more eTLD+1 domains are actively associated with the contract. The user client SHOULD attempt to fetch TXT records from all associated eTLD+1 domains to verify its association or authenticity. The client MUST confirm that each contract address is contained in a TXT record&#x27;s &lt;code&gt;VALUE&lt;&#x2F;code&gt; field of the eTLD+1 pointed to by the contract&#x27;s &lt;code&gt;domains&lt;&#x2F;code&gt; mapping.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;In this specification, the TXT record &lt;code&gt;HOST&lt;&#x2F;code&gt; naming scheme is designed to mimic the DKIM naming convention. Additionally, this naming scheme makes it simple to programmatically ascertain if any smart contracts are associated with the domain on a given blockchain network. Prepending with &lt;code&gt;ERC-7529&lt;&#x2F;code&gt; will prevent naming collisions with other TXT records. The value of &lt;code&gt;&amp;lt;chain_id&amp;gt;&lt;&#x2F;code&gt; is simply the decimal representation of the chain id associated with the target blockchain network (i.e. &lt;code&gt;1&lt;&#x2F;code&gt; for Ethereum mainnet or &lt;code&gt;11155111&lt;&#x2F;code&gt; for Sepolia) where the smart contracts are deployed. So, a typical &lt;code&gt;HOST&lt;&#x2F;code&gt; might be: &lt;code&gt;ERC-7529.1._domainContracts&lt;&#x2F;code&gt;, &lt;code&gt;ERC-7529.11155111._domaincontracts&lt;&#x2F;code&gt;, etc.&lt;&#x2F;p&gt;
&lt;p&gt;A user client working with smart contracts implementing this proposal is protected by cross-checking that two independent sources of information agree with each other (i.e. DNS and a blockchain network). As long as the &lt;code&gt;addDomain&lt;&#x2F;code&gt; and &lt;code&gt;removeDomain&lt;&#x2F;code&gt; calls on the smart contract are properly authenticated (as shown in the reference implementation), the values in the domains field must have been set by a controller of the contract. The contract addresses in the TXT records can only be set by the owner of the eTLD+1 domain. For these two values to align the same organization must control both resources.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The implementation of &lt;code&gt;checkDomain&lt;&#x2F;code&gt;, &lt;code&gt;addDomain&lt;&#x2F;code&gt; and &lt;code&gt;removeDomain&lt;&#x2F;code&gt; is a trivial exercise, but candidate implementations are given here for completeness:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checkDomain&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; domain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; domains&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;domain&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addDomain&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; domain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyRole&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;DEFAULT_ADMIN_ROLE&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    domains&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;domain&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AddDomain&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;domain&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; removeDomain&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; domain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyRole&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;DEFAULT_ADMIN_ROLE&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;domains&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;domain&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC7529: eTLD+1 currently not associated with this contract&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    domains&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;domain&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RemoveDomain&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;domain&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;NOTE&lt;&#x2F;strong&gt;: Appropriate account authentication MUST be applied to &lt;code&gt;addDomain&lt;&#x2F;code&gt; and &lt;code&gt;removeDomain&lt;&#x2F;code&gt; so that only authorized users may update the &lt;code&gt;domains&lt;&#x2F;code&gt; mapping. In the given reference implementation the &lt;code&gt;onlyRole&lt;&#x2F;code&gt; modifier is used to restrict call privileges to accounts with the &lt;code&gt;DEFAULT_ADMIN_ROLE&lt;&#x2F;code&gt; which can be added to any contract with the OpenZeppelin access control abstract class.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Due to the reliance on traditional DNS systems, this ERC is susceptible to attacks on this technology, such as domain hijacking. Additionally, it is the responsibility of the smart contract author to ensure that &lt;code&gt;addDomain&lt;&#x2F;code&gt; and &lt;code&gt;removeDomain&lt;&#x2F;code&gt; are authenticated properly, otherwise an attacker could associate their smart contract with an undesirable domain, which would simply break the ability to verify association with the proper domain.&lt;&#x2F;p&gt;
&lt;p&gt;It is worth noting that for an attacker to falsy verify a contract against a domain would require them to compromise both the DNS settings &lt;strong&gt;and&lt;&#x2F;strong&gt; the smart contract itself. In this scenario, the attacker has likely also compromised the business&#x27; email domains as well.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Web3 URL to EVM Call Message Translation</title>
        <published>2023-09-29T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Qi Zhou</name><uri>https://github.com/qizhou</uri>
	</author>
	
	<author>
		<name>Chao Pi</name><uri>https://github.com/pichaoqkc</uri>
	</author>
	
	<author>
		<name>Sam Wilson</name><uri>https://github.com/SamWilsn</uri>
	</author>
	
	<author>
		<name>Nicolas Deschildre</name><uri>https://github.com/nand2</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6860/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-4804-web3-url-to-evm-call-message-translation/8300" />
        

        <id>https://wg-eips.ritovision.com/6860/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:6860"
            label="ERC-6860" />
        

        
        

        
        <summary type="html">A translation of an HTTP-style Web3 URL to an EVM call message</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6860/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard translates an &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc3986&quot;&gt;RFC 3986&lt;&#x2F;a&gt; URI like &lt;code&gt;web3:&#x2F;&#x2F;uniswap.eth&#x2F;&lt;&#x2F;code&gt; to an EVM message such as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;EVMMessage {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   To: 0xaabbccddee.... &#x2F;&#x2F; where uniswap.eth&amp;#39;s address registered at ENS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   Calldata: 0x&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;⚠️ This proposal updates &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4804&#x2F;&quot;&gt;ERC-4804&lt;&#x2F;a&gt; with minor corrections, clarifications and modifications.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, reading data from Web3 generally relies on a translation done by a Web2 proxy to Web3 blockchain. The translation is mostly done by the proxies such as dApp websites&#x2F;node service provider&#x2F;etherscan, which are out of the control of users. The standard here aims to provide a simple way for Web2 users to directly access the content of Web3, especially on-chain Web contents such as SVG&#x2F;HTML.  Moreover, this standard enables interoperability with other standards already compatible with URIs, like SVG&#x2F;HTML.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;This specification only defines read-only (i.e. Solidity&#x27;s &lt;code&gt;view&lt;&#x2F;code&gt; functions) semantics. State modifying functions may be defined as a future extension.&lt;&#x2F;p&gt;
&lt;p&gt;This specification uses the Augmented Backus-Naur Form (ABNF) notation of &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc2234&quot;&gt;RFC 2234&lt;&#x2F;a&gt;. The complete URI syntax is listed in Appendix A.&lt;&#x2F;p&gt;
&lt;p&gt;A Web3 URL is an ASCII string in the following form :&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;web3URL         = schema &amp;quot;:&#x2F;&#x2F;&amp;quot; [ userinfo &amp;quot;@&amp;quot; ] contractName [ &amp;quot;:&amp;quot; chainid ] pathQuery [ &amp;quot;#&amp;quot; fragment ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;schema          = &amp;quot;w3&amp;quot; &#x2F; &amp;quot;web3&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;userinfo        = address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;userinfo&lt;&#x2F;strong&gt; indicates which user is calling the EVM, i.e., &quot;From&quot; field in EVM call message. If not specified, the protocol will use 0x0 as the sender address.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;contractName    = address &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; domainName&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;address         = &amp;quot;0x&amp;quot; 20( HEXDIG HEXDIG )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;domainName      = *( unreserved &#x2F; pct-encoded &#x2F; sub-delims ) ; As in RFC 3986&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;contractName&lt;&#x2F;strong&gt; indicates the contract to be called, i.e., the &quot;To&quot; field in the EVM call message. If the &lt;strong&gt;contractName&lt;&#x2F;strong&gt; is an address then it will be used for the &quot;To&quot; field. Otherwise, &lt;strong&gt;contractName&lt;&#x2F;strong&gt; is a domain name from a domain name service, and it must be resolved to an address to use for the &quot;To&quot; field.&lt;&#x2F;p&gt;
&lt;p&gt;The way to resolve the domain name from a domain name service to an address is specified in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6821&#x2F;&quot;&gt;ERC-6821&lt;&#x2F;a&gt; for the Ethereum Name service, and will be discussed in later ERCs for other name services.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;chainid         = %x31-39 *DIGIT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;chainid&lt;&#x2F;strong&gt; indicates which chain to resolve &lt;strong&gt;contractName&lt;&#x2F;strong&gt; and call the message. If not specified, the protocol will use the primary chain of the name service provider used, e.g., 1 for eth. If no name service provider was used, the default chainid is 1.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pathQuery       = mPathQuery ; path+query for manual mode&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; aPathQuery ; path+query for auto mode&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;pathQuery&lt;&#x2F;strong&gt;, made of the path and optional query, will have a different structure whether the resolve mode is &quot;manual&quot; or &quot;auto&quot;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;fragment        = *VCHAR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;fragment&lt;&#x2F;strong&gt;, like in HTTP URLs, is a string of characters meant to refer to a resource, and is not transmitted to the smart contract.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;web3UrlRef      = web3URL &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; relativeWeb3URL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;relativeWeb3URL = relPathQuery&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;relPathQuery    = relMPathQuery ; Relative URL path+query for manual mode&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; relAPathQuery ; Relative URL path+query for auto mode&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Relative URLs are supported, but the support differs based on the resolve mode.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;resolve-mode&quot;&gt;Resolve Mode&lt;&#x2F;h3&gt;
&lt;p&gt;Once the &quot;To&quot; address and chainid are determined, the protocol will check the resolver mode of contract by calling the &lt;code&gt;resolveMode&lt;&#x2F;code&gt; method of the &quot;To&quot; address. The Solidity signature of &lt;code&gt;resolveMode&lt;&#x2F;code&gt; is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; resolveMode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The protocol currently supports two resolve modes: auto and manual.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The manual mode will be used if the &lt;code&gt;resolveMode&lt;&#x2F;code&gt; return value is &lt;code&gt;0x6d616e75616c0000000000000000000000000000000000000000000000000000&lt;&#x2F;code&gt;, i.e., &quot;manual&quot; in bytes32&lt;&#x2F;li&gt;
&lt;li&gt;The auto mode will be used if :
&lt;ul&gt;
&lt;li&gt;the &lt;code&gt;resolveMode&lt;&#x2F;code&gt; return value is &lt;code&gt;0x6175746f00000000000000000000000000000000000000000000000000000000&lt;&#x2F;code&gt;, i.e, &quot;auto&quot; in bytes32, or&lt;&#x2F;li&gt;
&lt;li&gt;the &lt;code&gt;resolveMode&lt;&#x2F;code&gt; return value is &lt;code&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;code&gt;, or&lt;&#x2F;li&gt;
&lt;li&gt;the call to &lt;code&gt;resolveMode&lt;&#x2F;code&gt; throws an error (method not implemented or error thrown from the method)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Otherwise, the protocol will fail the request with the error &quot;unsupported resolve mode&quot;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;manual-mode&quot;&gt;Manual Mode&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mPathQuery      = mPath [ &amp;quot;?&amp;quot; mQuery ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mPath           = mPathAbempty ; begins with &amp;quot;&#x2F;&amp;quot; or is empty&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mPathAbempty    = [ *( &amp;quot;&#x2F;&amp;quot; segment ) &amp;quot;&#x2F;&amp;quot; segment [ &amp;quot;.&amp;quot; fileExtension ] ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;segment         = *pchar ; as in RFC 3986&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;fileExtension   = 1*( ALPHA &#x2F; DIGIT )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mQuery = *( pchar &#x2F; &amp;quot;&#x2F;&amp;quot; &#x2F; &amp;quot;?&amp;quot; ) ; as in RFC 3986&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The manual mode will use the raw &lt;strong&gt;mPathQuery&lt;&#x2F;strong&gt; as calldata of the message directly (no percent-encoding decoding will be done). If &lt;strong&gt;mPathQuery&lt;&#x2F;strong&gt; is empty, the sent calldata will be &lt;code&gt;&#x2F;&lt;&#x2F;code&gt; (0x2f).&lt;&#x2F;p&gt;
&lt;p&gt;The returned message data will be treated as ABI-encoded bytes and the decoded bytes will be returned to the frontend.&lt;&#x2F;p&gt;
&lt;p&gt;The MIME type returned to the frontend is &lt;code&gt;text&#x2F;html&lt;&#x2F;code&gt; by default, but will be overridden if a &lt;strong&gt;fileExtension&lt;&#x2F;strong&gt;  is present. In this case, the MIME type will be deduced from the filename extension.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;relMPathQuery   = relMPath [ &amp;quot;?&amp;quot; mQuery ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;relMPath        = mPathAbsolute ; begins with &amp;quot;&#x2F;&amp;quot; but not &amp;quot;&#x2F;&#x2F;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; mPathNoscheme ; begins with a non-colon segment&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; mPathEmpty    ; zero characters&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mPathAbsolute   = &amp;quot;&#x2F;&amp;quot; [ segmentNz *( &amp;quot;&#x2F;&amp;quot; segment ) ] [ &amp;quot;.&amp;quot; fileExtension ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mPathNoscheme   = segmentNzNc *( &amp;quot;&#x2F;&amp;quot; segment ) [ &amp;quot;.&amp;quot; fileExtension ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mPathEmpty      = 0&amp;lt;pchar&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;segmentNz       = 1*pchar ; as in RFC 3986&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;segmentNzNc     = 1*( unreserved &#x2F; pct-encoded &#x2F; sub-delims &#x2F; &amp;quot;@&amp;quot; )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                ; as in RFC 3986: non-zero-length segment without any colon &amp;quot;:&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Support for manual mode relative URLs is similar to HTTP URLs : URLs relative to the current contract are allowed, both with an absolute path and a relative path.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;auto-mode&quot;&gt;Auto Mode&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;aPathQuery      = aPath [ &amp;quot;?&amp;quot; aQuery ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;aPath           = [ &amp;quot;&#x2F;&amp;quot; [ method *( &amp;quot;&#x2F;&amp;quot; argument ) ] ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In the auto mode, if &lt;strong&gt;aPath&lt;&#x2F;strong&gt; is empty or &quot;&#x2F;&quot;, then the protocol will call the target contract with empty calldata. Otherwise, the calldata of the EVM message will use standard Solidity contract ABI.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;method          = ( ALPHA &#x2F; &amp;quot;$&amp;quot; &#x2F; &amp;quot;_&amp;quot; ) *( ALPHA &#x2F; DIGIT &#x2F; &amp;quot;$&amp;quot; &#x2F; &amp;quot;_&amp;quot; )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;method&lt;&#x2F;strong&gt; is a string of the function method to be called&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;argument        = boolArg&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; uintArg&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; intArg&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; addressArg&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; bytesArg&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; stringArg&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;boolArg         = [ &amp;quot;bool!&amp;quot; ] ( &amp;quot;true&amp;quot; &#x2F; &amp;quot;false&amp;quot; )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;uintArg         = [ &amp;quot;uint&amp;quot; [ intSizes ] &amp;quot;!&amp;quot; ] 1*DIGIT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;intArg          = &amp;quot;int&amp;quot; [ intSizes ] &amp;quot;!&amp;quot; 1*DIGIT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;intSizes        = &amp;quot;8&amp;quot; &#x2F; &amp;quot;16&amp;quot; &#x2F; &amp;quot;24&amp;quot; &#x2F; &amp;quot;32&amp;quot; &#x2F; &amp;quot;40&amp;quot; &#x2F; &amp;quot;48&amp;quot; &#x2F; &amp;quot;56&amp;quot; &#x2F; &amp;quot;64&amp;quot; &#x2F; &amp;quot;72&amp;quot; &#x2F; &amp;quot;80&amp;quot; &#x2F; &amp;quot;88&amp;quot; &#x2F; &amp;quot;96&amp;quot; &#x2F; &amp;quot;104&amp;quot; &#x2F; &amp;quot;112&amp;quot; &#x2F; &amp;quot;120&amp;quot; &#x2F; &amp;quot;128&amp;quot; &#x2F; &amp;quot;136&amp;quot; &#x2F; &amp;quot;144&amp;quot; &#x2F; &amp;quot;152&amp;quot; &#x2F; &amp;quot;160&amp;quot; &#x2F; &amp;quot;168&amp;quot; &#x2F; &amp;quot;176&amp;quot; &#x2F; &amp;quot;184&amp;quot; &#x2F; &amp;quot;192&amp;quot; &#x2F; &amp;quot;200&amp;quot; &#x2F; &amp;quot;208&amp;quot; &#x2F; &amp;quot;216&amp;quot; &#x2F; &amp;quot;224&amp;quot; &#x2F; &amp;quot;232&amp;quot; &#x2F; &amp;quot;240&amp;quot; &#x2F; &amp;quot;248&amp;quot; &#x2F; &amp;quot;256&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;addressArg      = [ &amp;quot;address!&amp;quot; ] ( address &#x2F; domainName )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;bytesArg        = [ &amp;quot;bytes!&amp;quot; ] bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; &amp;quot;bytes1!0x&amp;quot; 1( HEXDIG HEXDIG )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; &amp;quot;bytes2!0x&amp;quot; 2( HEXDIG HEXDIG )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; &amp;quot;bytes32!0x&amp;quot; 32( HEXDIG HEXDIG )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;stringArg       = &amp;quot;string!&amp;quot; *pchar [ &amp;quot;.&amp;quot; fileExtension ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;argument&lt;&#x2F;strong&gt; is an argument of the method with a type-agnostic syntax of &lt;code&gt;[ type &quot;!&quot; ] value&lt;&#x2F;code&gt;. If &lt;strong&gt;type&lt;&#x2F;strong&gt; is specified, the value will be translated to the corresponding type. The protocol currently supports these basic types: bool, int, uint, int&amp;lt;X&amp;gt;, uint&amp;lt;X&amp;gt; (with X ranging from 8 to 256 in steps of 8), address, bytes&amp;lt;X&amp;gt; (with X ranging from 1 to 32), bytes, and string. If &lt;strong&gt;type&lt;&#x2F;strong&gt; is not specified, then the type will be automatically detected using the following rule in a sequential way:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;type&lt;&#x2F;strong&gt;=&quot;uint256&quot;, if &lt;strong&gt;value&lt;&#x2F;strong&gt; is digits; or&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;type&lt;&#x2F;strong&gt;=&quot;bytes32&quot;, if &lt;strong&gt;value&lt;&#x2F;strong&gt; is in the form of 0x+32-byte-data hex; or&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;type&lt;&#x2F;strong&gt;=&quot;address&quot;, if &lt;strong&gt;value&lt;&#x2F;strong&gt; is in the form of 0x+20-byte-data hex; or&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;type&lt;&#x2F;strong&gt;=&quot;bytes&quot;, if &lt;strong&gt;value&lt;&#x2F;strong&gt; is in the form of 0x followed by any number of bytes besides 20 or 32; or&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;type&lt;&#x2F;strong&gt;=&quot;bool&quot;, if &lt;strong&gt;value&lt;&#x2F;strong&gt; is either &lt;code&gt;true&lt;&#x2F;code&gt; or &lt;code&gt;false&lt;&#x2F;code&gt;; or&lt;&#x2F;li&gt;
&lt;li&gt;else &lt;strong&gt;type&lt;&#x2F;strong&gt;=&quot;address&quot; and parse the argument as a domain name. If unable to resolve the domain name, an unsupported name service provider error will be returned.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;aQuery          = attribute *( &amp;quot;&amp;amp;&amp;quot; attribute )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;attribute       = attrName &amp;quot;=&amp;quot; attrValue&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;attrName        = &amp;quot;returns&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; &amp;quot;returnTypes&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;attrValue       = [ &amp;quot;(&amp;quot; [ retTypes ] &amp;quot;)&amp;quot; ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;retTypes        = retType *( &amp;quot;,&amp;quot; retType )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;retType         = retRawType *( &amp;quot;[&amp;quot; [ %x31-39 *DIGIT ] &amp;quot;]&amp;quot; )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;retRawType      = &amp;quot;(&amp;quot; retTypes &amp;quot;)&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; retBaseType&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;retBaseType      = &amp;quot;bool&amp;quot; &#x2F; &amp;quot;uint&amp;quot; [ intSizes ] &#x2F; &amp;quot;int&amp;quot; [ intSize ] &#x2F; &amp;quot;address&amp;quot; &#x2F; &amp;quot;bytes&amp;quot; [ bytesSizes ] &#x2F; &amp;quot;string&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;bytesSizes      = %x31-39              ; 1-9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; ( &amp;quot;1&amp;quot; &#x2F; &amp;quot;2&amp;quot; ) DIGIT  ; 10-29&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; &amp;quot;31&amp;quot; &#x2F; &amp;quot;32&amp;quot;          ; 31-32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &quot;returns&quot; attribute in &lt;strong&gt;aQuery&lt;&#x2F;strong&gt; tells the format of the returned data. It follows the syntax of the arguments part of the ethereum ABI function signature (&lt;code&gt;uint&lt;&#x2F;code&gt; and &lt;code&gt;int&lt;&#x2F;code&gt; aliases are authorized).&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If the &quot;returns&quot; attribute value is undefined or empty, the returned message data will be treated as ABI-encoded bytes and the decoded bytes will be returned to the frontend. The MIME type returned to the frontend will be undefined by default, but will be overridden if the last argument is of string type and has a &lt;strong&gt;fileExtension&lt;&#x2F;strong&gt;, in which case the MIME type will be deduced from the filename extension. (Note that &lt;strong&gt;fileExtension&lt;&#x2F;strong&gt; is not excluded from the string argument given to the smartcontract)&lt;&#x2F;li&gt;
&lt;li&gt;If the &quot;returns&quot; attribute value is equal to &quot;()&quot;, the raw bytes of the returned message data will be returned, encoded as a &quot;0x&quot;-prefixed hex string in an array in JSON format: &lt;code&gt;[&quot;0xXXXXX&quot;]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Otherwise, the returned message data will be ABI-decoded in the data types specified in the &lt;strong&gt;returns&lt;&#x2F;strong&gt; value and encoded in JSON format. The encoding of the data will follow the Ethereum JSON-RPC format:
&lt;ul&gt;
&lt;li&gt;Unformatted data (bytes, address) will be encoded as hex, prefixed with &quot;0x&quot;, two hex digits per byte&lt;&#x2F;li&gt;
&lt;li&gt;Quantities (integers) will be encoded as hex, prefix with &quot;0x&quot;, the most compact representation (slight exception: zero should be represented as &quot;0x0&quot;)&lt;&#x2F;li&gt;
&lt;li&gt;Boolean and strings will be native JSON boolean and strings&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;If multiple &quot;returns&quot; attributes are present, the value of the last &quot;returns&quot; attribute will be applied. Note that &quot;returnTypes&quot; is the alias of &quot;returns&quot;, but it is not recommended to use and is mainly for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4804&#x2F;&quot;&gt;ERC-4804&lt;&#x2F;a&gt; backward-compatible purpose.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;relAPathQuery   = aPath [ &amp;quot;?&amp;quot; aQuery ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Support for auto mode relative URLs is limited : URLs relative to the current contract are allowed and will either reference itself (empty), the &lt;code&gt;&#x2F;&lt;&#x2F;code&gt; path or a full method and its arguments.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;examples&quot;&gt;Examples&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;example-1a&quot;&gt;Example 1a&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;web3:&#x2F;&#x2F;w3url.eth&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where the contract of &lt;strong&gt;w3url.eth&lt;&#x2F;strong&gt; is in manual mode.&lt;&#x2F;p&gt;
&lt;p&gt;The protocol will find the address of &lt;strong&gt;w3url.eth&lt;&#x2F;strong&gt; from ENS in chainid 1 (Mainnet). Then the protocol will call the address with &quot;Calldata&quot; = &lt;code&gt;keccak(&quot;resolveMode()&quot;)[0:4]&lt;&#x2F;code&gt; = &quot;0xDD473FAE&quot;, which returns &quot;manual&quot; in ABI-type &quot;(bytes32)&quot;. After determining the manual mode of the contract, the protocol will call the address with &quot;To&quot; = &lt;strong&gt;contractAddress&lt;&#x2F;strong&gt; and &quot;Calldata&quot; = &quot;0x2F&quot;. The returned data will be treated as ABI-type &quot;(bytes)&quot;, and the decoded bytes will be returned to the frontend, with the information that the MIME type is &lt;code&gt;text&#x2F;html&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;example-1b&quot;&gt;Example 1b&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;web3:&#x2F;&#x2F;w3url.eth&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where the contract of &lt;strong&gt;w3url.eth&lt;&#x2F;strong&gt; is in auto mode.&lt;&#x2F;p&gt;
&lt;p&gt;The protocol will find the address of &lt;strong&gt;w3url.eth&lt;&#x2F;strong&gt; from ENS in chainid 1 (Mainnet). Then the protocol will call the address with &quot;Calldata&quot; = &lt;code&gt;keccak(&quot;resolveMode()&quot;)[0:4]&lt;&#x2F;code&gt; = &quot;0xDD473FAE&quot;, which returns &quot;&quot;, i.e., the contract is in auto mode. After determining the auto mode of the contract, the protocol will call the address with &quot;To&quot; = &lt;strong&gt;contractAddress&lt;&#x2F;strong&gt; and &quot;Calldata&quot; = &quot;&quot;. The returned data will be treated as ABI-type &quot;(bytes)&quot;, and the decoded bytes will be returned to the frontend, with the information that the MIME type is undefined.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;example-2&quot;&gt;Example 2&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;web3:&#x2F;&#x2F;cyberbrokers-meta.eth&#x2F;renderBroker&#x2F;9999&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where the contract of &lt;strong&gt;cyberbrokers-meta.eth&lt;&#x2F;strong&gt; is in auto mode.&lt;&#x2F;p&gt;
&lt;p&gt;The protocol will find the address of &lt;strong&gt;cyberbrokers-meta.eth&lt;&#x2F;strong&gt; from ENS on chainid 1 (Mainnet). Then the protocol will call the address with &quot;Calldata&quot; = &lt;code&gt;keccak(&quot;resolveMode()&quot;)[0:4]&lt;&#x2F;code&gt; = &quot;0xDD473FAE&quot;, which returns &quot;&quot;, i.e., the contract is in auto mode. After determining the auto mode of the contract, the protocol will call the address with &quot;To&quot; = &lt;strong&gt;contractAddress&lt;&#x2F;strong&gt; and &quot;Calldata&quot; = &quot;0x&quot; + &lt;code&gt;keccak(&quot;renderBroker(uint256)&quot;)[0:4] + abi.encode(uint256(9999))&lt;&#x2F;code&gt;. The returned data will be treated as ABI-type &quot;(bytes)&quot;, and the decoded bytes will be returned to the frontend, with the information that the MIME type is undefined.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;example-3&quot;&gt;Example 3&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;web3:&#x2F;&#x2F;vitalikblog.eth:5&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where the contract of &lt;strong&gt;vitalikblog.eth:5&lt;&#x2F;strong&gt; is in manual mode.&lt;&#x2F;p&gt;
&lt;p&gt;The protocol will find the address of &lt;strong&gt;vitalikblog.eth&lt;&#x2F;strong&gt; from ENS on chainid 5 (Goerli). Then after determining the contract is in manual mode, the protocol will call the address with &quot;To&quot; = &lt;strong&gt;contractAddress&lt;&#x2F;strong&gt; and &quot;Calldata&quot; = &quot;0x2F&quot; with chainid = 5. The returned data will be treated as ABI-type &quot;(bytes)&quot;, and the decoded bytes will be returned to the frontend, with the information that the MIME type is &lt;code&gt;text&#x2F;html&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;example-4&quot;&gt;Example 4&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;web3:&#x2F;&#x2F;0xe4ba0e245436b737468c206ab5c8f4950597ab7f:42170&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where the contract &quot;0xe4ba0e245436b737468c206ab5c8f4950597ab7f:42170&quot; is in manual mode.&lt;&#x2F;p&gt;
&lt;p&gt;After determining the contract is in manual mode, the protocol will call the address with &quot;To&quot; = &quot;0xe4ba0e245436b737468c206ab5c8f4950597ab7f&quot; and &quot;Calldata&quot; = &quot;0x2F&quot; with chainid = 42170 (Arbitrum Nova). The returned data will be treated as ABI-type &quot;(bytes)&quot;, and the decoded bytes will be returned to the frontend, with the information that the MIME type is &lt;code&gt;text&#x2F;html&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;example-5&quot;&gt;Example 5&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;web3:&#x2F;&#x2F;0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48&#x2F;balanceOf&#x2F;vitalik.eth?returns=(uint256)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where the contract &quot;0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48&quot; is in auto mode.&lt;&#x2F;p&gt;
&lt;p&gt;The protocol will find the addresses of &lt;strong&gt;vitalik.eth&lt;&#x2F;strong&gt; from ENS on chainid 1 (Mainnet) and then call the method &quot;balanceOf(address)&quot; of the contract with the &lt;strong&gt;vitalik.eth&lt;&#x2F;strong&gt;&#x27;s address. The returned data from the call of the contract will be treated as ABI-type &quot;(uint256)&quot;, and the decoded data will be returned to the frontend in JSON format like &lt;code&gt;[ &quot;0x9184e72a000&quot; ]&lt;&#x2F;code&gt;, with the information that the MIME type is &lt;code&gt;application&#x2F;json&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;example-6&quot;&gt;Example 6&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;web3:&#x2F;&#x2F;0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48&#x2F;balanceOf&#x2F;vitalik.eth?returns=()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where the contract ”0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48“ is in auto mode.&lt;&#x2F;p&gt;
&lt;p&gt;The protocol will find the address of &lt;strong&gt;vitalik.eth&lt;&#x2F;strong&gt; from ENS on chainid 1 (Mainnet) and then call the method &quot;balanceOf(address)&quot; of the address. The returned data from the call of the contract will be treated as raw bytes and will be encoded in JSON format like &lt;code&gt;[&quot;0x000000000000000000000000000000000000000000000000000009184e72a000&quot;]&lt;&#x2F;code&gt; and returned to the frontend, with the information that the MIME type is &lt;code&gt;application&#x2F;json&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;appendix-a-complete-abnf-for-web3-urls&quot;&gt;Appendix A: Complete ABNF for Web3 URLs&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;web3URL         = schema &amp;quot;:&#x2F;&#x2F;&amp;quot; [ userinfo &amp;quot;@&amp;quot; ] contractName [ &amp;quot;:&amp;quot; chainid ] pathQuery [ &amp;quot;#&amp;quot; fragment ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;schema          = &amp;quot;w3&amp;quot; &#x2F; &amp;quot;web3&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;userinfo        = address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;contractName    = address &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; domainName&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;chainid         = %x31-39 *DIGIT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pathQuery       = mPathQuery ; path+query for manual mode&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; aPathQuery ; path+query for auto mode&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;fragment        = *VCHAR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;web3UrlRef      = web3URL &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; relativeWeb3URL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;relativeWeb3URL = relPathQuery&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;relPathQuery    = relMPathQuery ; Relative URL path+query for manual mode&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; relAPathQuery ; Relative URL path+query for auto mode&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mPathQuery      = mPath [ &amp;quot;?&amp;quot; mQuery ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mPath           = mPathAbempty ; begins with &amp;quot;&#x2F;&amp;quot; or is empty&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;relMPathQuery   = relMPath [ &amp;quot;?&amp;quot; mQuery ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;relMPath        = mPathAbsolute ; begins with &amp;quot;&#x2F;&amp;quot; but not &amp;quot;&#x2F;&#x2F;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; mPathNoscheme ; begins with a non-colon segment&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; mPathEmpty    ; zero characters&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mPathAbempty    = [ *( &amp;quot;&#x2F;&amp;quot; segment ) &amp;quot;&#x2F;&amp;quot; segment [ &amp;quot;.&amp;quot; fileExtension ] ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mPathAbsolute   = &amp;quot;&#x2F;&amp;quot; [ segmentNz *( &amp;quot;&#x2F;&amp;quot; segment ) ] [ &amp;quot;.&amp;quot; fileExtension ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mPathNoscheme   = segmentNzNc *( &amp;quot;&#x2F;&amp;quot; segment ) [ &amp;quot;.&amp;quot; fileExtension ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mPathEmpty      = 0&amp;lt;pchar&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;segment         = *pchar ; as in RFC 3986&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;segmentNz       = 1*pchar ; as in RFC 3986&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;segmentNzNc     = 1*( unreserved &#x2F; pct-encoded &#x2F; sub-delims &#x2F; &amp;quot;@&amp;quot; )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                ; as in RFC 3986: non-zero-length segment without any colon &amp;quot;:&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mQuery          = *( pchar &#x2F; &amp;quot;&#x2F;&amp;quot; &#x2F; &amp;quot;?&amp;quot; ) ; as in RFC 3986&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;aPathQuery      = aPath [ &amp;quot;?&amp;quot; aQuery ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;aPath           = [ &amp;quot;&#x2F;&amp;quot; [ method *( &amp;quot;&#x2F;&amp;quot; argument ) ] ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;relAPathQuery   = aPath [ &amp;quot;?&amp;quot; aQuery ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;method          = ( ALPHA &#x2F; &amp;quot;$&amp;quot; &#x2F; &amp;quot;_&amp;quot; ) *( ALPHA &#x2F; DIGIT &#x2F; &amp;quot;$&amp;quot; &#x2F; &amp;quot;_&amp;quot; )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;argument        = boolArg&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; uintArg&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; intArg&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; addressArg&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; bytesArg&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; stringArg&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;boolArg         = [ &amp;quot;bool!&amp;quot; ] ( &amp;quot;true&amp;quot; &#x2F; &amp;quot;false&amp;quot; )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;uintArg         = [ &amp;quot;uint&amp;quot; [ intSizes ] &amp;quot;!&amp;quot; ] 1*DIGIT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;intArg          = &amp;quot;int&amp;quot; [ intSizes ] &amp;quot;!&amp;quot; 1*DIGIT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;intSizes        = &amp;quot;8&amp;quot; &#x2F; &amp;quot;16&amp;quot; &#x2F; &amp;quot;24&amp;quot; &#x2F; &amp;quot;32&amp;quot; &#x2F; &amp;quot;40&amp;quot; &#x2F; &amp;quot;48&amp;quot; &#x2F; &amp;quot;56&amp;quot; &#x2F; &amp;quot;64&amp;quot; &#x2F; &amp;quot;72&amp;quot; &#x2F; &amp;quot;80&amp;quot; &#x2F; &amp;quot;88&amp;quot; &#x2F; &amp;quot;96&amp;quot; &#x2F; &amp;quot;104&amp;quot; &#x2F; &amp;quot;112&amp;quot; &#x2F; &amp;quot;120&amp;quot; &#x2F; &amp;quot;128&amp;quot; &#x2F; &amp;quot;136&amp;quot; &#x2F; &amp;quot;144&amp;quot; &#x2F; &amp;quot;152&amp;quot; &#x2F; &amp;quot;160&amp;quot; &#x2F; &amp;quot;168&amp;quot; &#x2F; &amp;quot;176&amp;quot; &#x2F; &amp;quot;184&amp;quot; &#x2F; &amp;quot;192&amp;quot; &#x2F; &amp;quot;200&amp;quot; &#x2F; &amp;quot;208&amp;quot; &#x2F; &amp;quot;216&amp;quot; &#x2F; &amp;quot;224&amp;quot; &#x2F; &amp;quot;232&amp;quot; &#x2F; &amp;quot;240&amp;quot; &#x2F; &amp;quot;248&amp;quot; &#x2F; &amp;quot;256&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;addressArg      = [ &amp;quot;address!&amp;quot; ] ( address &#x2F; domainName )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;bytesArg        = [ &amp;quot;bytes!&amp;quot; ] bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; &amp;quot;bytes1!0x&amp;quot; 1( HEXDIG HEXDIG )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; &amp;quot;bytes2!0x&amp;quot; 2( HEXDIG HEXDIG )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; &amp;quot;bytes3!0x&amp;quot; 3( HEXDIG HEXDIG )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; &amp;quot;bytes4!0x&amp;quot; 4( HEXDIG HEXDIG )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; &amp;quot;bytes5!0x&amp;quot; 5( HEXDIG HEXDIG )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; &amp;quot;bytes6!0x&amp;quot; 6( HEXDIG HEXDIG )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; &amp;quot;bytes7!0x&amp;quot; 7( HEXDIG HEXDIG )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; &amp;quot;bytes8!0x&amp;quot; 8( HEXDIG HEXDIG )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; &amp;quot;bytes9!0x&amp;quot; 9( HEXDIG HEXDIG )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; &amp;quot;bytes10!0x&amp;quot; 10( HEXDIG HEXDIG )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; &amp;quot;bytes11!0x&amp;quot; 11( HEXDIG HEXDIG )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; &amp;quot;bytes12!0x&amp;quot; 12( HEXDIG HEXDIG )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; &amp;quot;bytes13!0x&amp;quot; 13( HEXDIG HEXDIG )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; &amp;quot;bytes14!0x&amp;quot; 14( HEXDIG HEXDIG )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; &amp;quot;bytes15!0x&amp;quot; 15( HEXDIG HEXDIG )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; &amp;quot;bytes16!0x&amp;quot; 16( HEXDIG HEXDIG )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; &amp;quot;bytes17!0x&amp;quot; 17( HEXDIG HEXDIG )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; &amp;quot;bytes18!0x&amp;quot; 18( HEXDIG HEXDIG )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; &amp;quot;bytes19!0x&amp;quot; 19( HEXDIG HEXDIG )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; &amp;quot;bytes20!0x&amp;quot; 20( HEXDIG HEXDIG )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; &amp;quot;bytes21!0x&amp;quot; 21( HEXDIG HEXDIG )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; &amp;quot;bytes22!0x&amp;quot; 22( HEXDIG HEXDIG )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; &amp;quot;bytes23!0x&amp;quot; 23( HEXDIG HEXDIG )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; &amp;quot;bytes24!0x&amp;quot; 24( HEXDIG HEXDIG )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; &amp;quot;bytes25!0x&amp;quot; 25( HEXDIG HEXDIG )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; &amp;quot;bytes26!0x&amp;quot; 26( HEXDIG HEXDIG )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; &amp;quot;bytes27!0x&amp;quot; 27( HEXDIG HEXDIG )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; &amp;quot;bytes28!0x&amp;quot; 28( HEXDIG HEXDIG )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; &amp;quot;bytes29!0x&amp;quot; 29( HEXDIG HEXDIG )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; &amp;quot;bytes30!0x&amp;quot; 30( HEXDIG HEXDIG )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; &amp;quot;bytes31!0x&amp;quot; 31( HEXDIG HEXDIG )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; &amp;quot;bytes32!0x&amp;quot; 32( HEXDIG HEXDIG )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;stringArg       = &amp;quot;string!&amp;quot; *pchar [ &amp;quot;.&amp;quot; fileExtension ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;aQuery          = attribute *( &amp;quot;&amp;amp;&amp;quot; attribute )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;attribute       = attrName &amp;quot;=&amp;quot; attrValue&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;attrName        = &amp;quot;returns&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; &amp;quot;returnTypes&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;attrValue       = [ &amp;quot;(&amp;quot; [ retTypes ] &amp;quot;)&amp;quot; ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;retTypes        = retType *( &amp;quot;,&amp;quot; retType )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;retType         = retRawType *( &amp;quot;[&amp;quot; [ %x31-39 *DIGIT ] &amp;quot;]&amp;quot; )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;retRawType      = &amp;quot;(&amp;quot; retTypes &amp;quot;)&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; retBaseType&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;retBaseType      = &amp;quot;bool&amp;quot; &#x2F; &amp;quot;uint&amp;quot; [ intSizes ] &#x2F; &amp;quot;int&amp;quot; [ intSize ] &#x2F; &amp;quot;address&amp;quot; &#x2F; &amp;quot;bytes&amp;quot; [ bytesSizes ] &#x2F; &amp;quot;string&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;bytesSizes      = %x31-39              ; 1-9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; ( &amp;quot;1&amp;quot; &#x2F; &amp;quot;2&amp;quot; ) DIGIT  ; 10-29&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; &amp;quot;31&amp;quot; &#x2F; &amp;quot;32&amp;quot;          ; 31-32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;domainName      = *( unreserved &#x2F; pct-encoded &#x2F; sub-delims ) ; As in RFC 3986&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;fileExtension   = 1*( ALPHA &#x2F; DIGIT )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;address         = &amp;quot;0x&amp;quot; 20( HEXDIG HEXDIG )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;bytes           = &amp;quot;0x&amp;quot; *( HEXDIG HEXDIG )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pchar           = unreserved &#x2F; pct-encoded &#x2F; sub-delims &#x2F; &amp;quot;:&amp;quot; &#x2F; &amp;quot;@&amp;quot; ; As in RFC 3986&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pct-encoded     = &amp;quot;%&amp;quot; HEXDIG HEXDIG ; As in RFC 3986&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;unreserved      = ALPHA &#x2F; DIGIT &#x2F; &amp;quot;-&amp;quot; &#x2F; &amp;quot;.&amp;quot; &#x2F; &amp;quot;_&amp;quot; &#x2F; &amp;quot;~&amp;quot; ; As in RFC 3986&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sub-delims    = &amp;quot;!&amp;quot; &#x2F; &amp;quot;$&amp;quot; &#x2F; &amp;quot;&amp;amp;&amp;quot; &#x2F; &amp;quot;&amp;#39;&amp;quot; &#x2F; &amp;quot;(&amp;quot; &#x2F; &amp;quot;)&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; &amp;quot;*&amp;quot; &#x2F; &amp;quot;+&amp;quot; &#x2F; &amp;quot;,&amp;quot; &#x2F; &amp;quot;;&amp;quot; &#x2F; &amp;quot;=&amp;quot; ; As in RFC 3986&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;appendix-b-changes-versus-erc-4804&quot;&gt;Appendix B: Changes versus &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4804&#x2F;&quot;&gt;ERC-4804&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;corrections&quot;&gt;Corrections&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Manual mode : &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4804&#x2F;&quot;&gt;ERC-4804&lt;&#x2F;a&gt; stipulates that there is no interpretation of the path [ &quot;?&quot; query ]. This ERC indicates that there is in fact an interpretation of the path, for MIME type determination purpose.&lt;&#x2F;li&gt;
&lt;li&gt;Auto mode : If there is no &lt;strong&gt;returns&lt;&#x2F;strong&gt; attribute in &lt;strong&gt;query&lt;&#x2F;strong&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4804&#x2F;&quot;&gt;ERC-4804&lt;&#x2F;a&gt; stipulates that the returned data is treated as ABI-encoded bytes32. This ERC indicates that in fact the returned data is treated as ABI-encoded bytes.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;clarifications&quot;&gt;Clarifications&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Formal specification: This ERC add a ABNF definition of the URL format.&lt;&#x2F;li&gt;
&lt;li&gt;Resolve mode: This ERC indicates more details on how the resolve mode is determined.&lt;&#x2F;li&gt;
&lt;li&gt;Manual mode : This ERC indicates how to deal with URI-percent-encoding, the return data, and how the MIME type is determined.&lt;&#x2F;li&gt;
&lt;li&gt;Auto mode : This ERC indicates in more details the encoding of the argument values, as well as the format and handling of the &lt;strong&gt;returns&lt;&#x2F;strong&gt; value.&lt;&#x2F;li&gt;
&lt;li&gt;Examples : This ERC add more details to the examples.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;modifications&quot;&gt;Modifications&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Protocol name: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4804&#x2F;&quot;&gt;ERC-4804&lt;&#x2F;a&gt; mentionned &lt;code&gt;ethereum-web3:&#x2F;&#x2F;&lt;&#x2F;code&gt; and &lt;code&gt;eth-web3:&#x2F;&#x2F;&lt;&#x2F;code&gt;, these are removed.&lt;&#x2F;li&gt;
&lt;li&gt;Auto mode: Supported types: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4804&#x2F;&quot;&gt;ERC-4804&lt;&#x2F;a&gt; supported only uint256, bytes32, address, bytes, and string. This ERC add more types.&lt;&#x2F;li&gt;
&lt;li&gt;Auto mode: Encoding of returned integers when a &lt;strong&gt;returns&lt;&#x2F;strong&gt; attribute is specified: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4804&#x2F;&quot;&gt;ERC-4804&lt;&#x2F;a&gt; suggested in example 5 to encode integers as strings. This ERC indicates to follow the Ethereum JSON RPC spec and encode integers as a hex string, prefixed with &quot;0x&quot;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The purpose of the proposal is to add a decentralized presentation layer for Ethereum.  With the layer, we are able to render any web content (including HTML&#x2F;CSS&#x2F;JPG&#x2F;PNG&#x2F;SVG, etc) on-chain using human-readable URLs, and thus EVM can be served as a decentralized backend.  The design of the standard is based on the following principles:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Human-readable&lt;&#x2F;strong&gt;.  The Web3 URL should be easily recognized by human similar to Web2 URL (&lt;code&gt;http:&#x2F;&#x2F;&lt;&#x2F;code&gt;).  As a result, we support names from name services to replace address for better readability.  In addition, instead of using calldata in hex, we use human-readable method + arguments and translate them to calldata for better readability.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Maximum-Compatible with HTTP-URL standard&lt;&#x2F;strong&gt;.  The Web3 URL should be compatible with HTTP-URL standard including relative pathing, query, fragment, percent-encoding, etc so that the support of existing HTTP-URL (e.g., by browser) can be easily extended to Web3 URL with minimal modification.  This also means that existing Web2 users can easily migrate to Web3 with minimal extra knowledge of this standard.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Simple&lt;&#x2F;strong&gt;.  Instead of providing explicit types in arguments, we use a &quot;maximum likelihood&quot; principle of auto-detecting the types of the arguments such as address, bytes32, and uint256.  This could greatly minimize the length of URL, while avoiding confusion.  In addition, explicit types are also supported to clear the confusion if necessary.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Flexible&lt;&#x2F;strong&gt;.  The contract is able to override the encoding rule so that the contract has fine-control of understanding the actual Web resources that the users want to locate.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;No security considerations were found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>PLUME Signature in Wallets</title>
        <published>2023-09-24T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Yush G</name><uri>https://github.com/Divide-By-0</uri><email>aayushg@mit.edu</email>
	</author>
	
	<author>
		<name>Kobi Gurkan</name><uri>https://github.com/kobigurk</uri>
	</author>
	
	<author>
		<name>Richard Liu</name><uri>https://github.com/rrrliu</uri>
	</author>
	
	<author>
		<name>Vivek Bhupatiraju</name><uri>https://github.com/vb7401</uri>
	</author>
	
	<author>
		<name>Barry Whitehat</name><uri>https://github.com/barryWhiteHat</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7524/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7524-plume-signature-in-wallets/15902" />
        

        <id>https://wg-eips.ritovision.com/7524/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7524"
            label="ERC-7524" />
        

        
        

        
        <summary type="html">A new signature scheme for Ethereum keypairs that allows for &quot;nullifiers&quot; to enable unique anonymity and zk voting.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7524/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;ZK-SNARKs have enabled ideation for new identity applications based on anonymous proof-of-ownership. One of the primary technologies that would enable the jump from existing apps to systems that require anonymous uniqueness is the development of verifiably deterministic signatures. Because Ethereum is based on ECDSA, there is no way right now for someone to verify that a signature is generated deterministically, even with ‘deterministic’ ECDSA signatures: a ZK-SNARK proof would need someone’s private key to do so, and some hardware wallets do not even allow viewing of a private key. Broadly, we don’t want to export&#x2F;copy-paste the private key into a SNARK to be an intended user behavior, and most hardware wallets will not be able to run SNARK arithmetization inside a secure enclave for existing schemes (and nor do we want to standardize an entire proof system inside a wallet right now when they emerge and evolve almost every year). Thus we are left to select a new algorithm that offers us verifiable, deterministic nullifiers that can be SNARKed outside the enclave.&lt;&#x2F;p&gt;
&lt;p&gt;One specific example of how such a signature can lead to unique pseudonymity is that we prove it was generated correctly in a ZK-SNARK that only reveals publicly the hash(signature), and the SNARK additionally proves some property the public key has (i.e. is in some anonymity set, has executed some set of actions on chain, etc). This proof is the only thing that is ever seen by other people, and so the hash(signature) can be used as a “nullifier”: a public commitment to a specific anonymous account, to forbid actions like double spending, or allow a consistent identity between anonymous actions. We aim to standardize a new verifiably deterministic signature algorithm that both uniquely identifies the keypair, and keeps the account identity secret, where verification does not require a secret key. The specific signature function we found (and will discuss for the rest of the post) is $hash(message, public\ key) ^ {secret\ key}$.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Existing ZK applications have the advantage that there is no uniqueness constraint on the provers: that is, allowing the same wallet to prove itself as a member more than once is intended. However, many applications require a maximum of one action per user, especially protocols that desire Sybil resistance. Such protocols are not natively possible on Ethereum right now without mapping each address into an opt-in mapping that also maps a user’s private key to a new system, which adds complexity, loses atomicity, and does not benefit from the rich on-chain history of Ethereum accounts.&lt;&#x2F;li&gt;
&lt;li&gt;Specific applications that require this tech include:
&lt;ul&gt;
&lt;li&gt;zk voting, where each account in some set has one vote&lt;&#x2F;li&gt;
&lt;li&gt;pseudonymously claiming an airdrop like Stealthdrop&lt;&#x2F;li&gt;
&lt;li&gt;moderating a pseudonymous forum, where people can prove that they are the same identity elsewhere in the forum&lt;&#x2F;li&gt;
&lt;li&gt;zk proof of solvency — if you want two exchanges to prove they know a set of private keys that hold some balance, you need a way to ensure that two exchanges aren’t both claiming the same address, while keeping it private&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;As such, a deterministic value based on the Ethereum account’s ECDSA keypair is a necessary component of ensuring one action per user and enables all these applications on Ethereum.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;We propose a new signature standard that offers the following properties, to be implemented for standard ECDSA keys within wallets:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;It produces signatures that contain a deterministic component and a nondeterministic component. The deterministic component may be used as a &lt;em&gt;nullifier&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Signers can use existing secpk256k1 keypairs, such as those in hardware wallets that support Ethereum accounts. As a consequence, secret keys can remain in secure enclaves if there is a generator point multiplication API into the enclave (which Ledger for instance has).&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;p&gt;This scheme uses the secp256k1 curve, defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7524&#x2F;.&#x2F;assets&#x2F;sec2-v2.pdf&quot;&gt;Standards for Efficient
Cryptography 2 (SEC 2) v2&lt;&#x2F;a&gt;, page 9.&lt;&#x2F;p&gt;
&lt;p&gt;We use the following notation to refer to the parameters of this curve:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;$g$: the base point (also called the generator) of the curve.&lt;&#x2F;li&gt;
&lt;li&gt;$p$: the order of the curve.&lt;&#x2F;li&gt;
&lt;li&gt;$F_p$: the finite field whose order is $p$.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note we use exponential notation to denote elliptic curve scalar multiplications.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;public-key-encoding-functions&quot;&gt;Public key encoding functions&lt;&#x2F;h3&gt;
&lt;h3 id=&quot;sec1&quot;&gt;SEC1&lt;&#x2F;h3&gt;
&lt;p&gt;This scheme uses the SEC1 elliptic curve point encoding scheme defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7524&#x2F;.&#x2F;assets&#x2F;sec1-v2.pdf&quot;&gt;Standards for Efficient
Cryptography 1 (SEC 1) v2&lt;&#x2F;a&gt;. Point compression is used. We use the notation $\mathsf{sec1}(pk)$ to denote the compressed encoding of secp256k1 curve point $pk$ as a bytestring of length 33.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;hash-functions&quot;&gt;Hash functions&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;SHA256&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;This scheme uses the SHA256 hash function defined in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc4634&quot;&gt;IETF RFC 4634&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;In this document, we use the notation $\mathsf{sha256}(a_1,.. a_n)$ to denote the sha256 digest of the concatenation of $n$ values $a_1, ..., a_n$. The digest should then be interpreted as a big-endian value in the secp256k1 scalar field.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;hash-to-curve&quot;&gt;Hash-to-curve&lt;&#x2F;h3&gt;
&lt;p&gt;We use the notation $\mathsf{htc}([a_1, ..., a_n])$ to denote the elliptic curve point which is the result of the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc9380&quot;&gt;IETF RFC 9380&lt;&#x2F;a&gt; &lt;code&gt;secp256k1_XMD:SHA-256_SSWU_RO_&lt;&#x2F;code&gt; in Appendix J.8.1. This hash-to-curve algorithm operates over the concatenation of $n$ values $a_1, ..., a_n$.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;key-generation&quot;&gt;Key generation&lt;&#x2F;h3&gt;
&lt;p&gt;A &lt;em&gt;keypair&lt;&#x2F;em&gt; comprises of $(sk, pk)$, defined as such:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;$sk$: The user&#x27;s secret key, which is a cryptographically secure random scalar in the field $F_p$.&lt;&#x2F;li&gt;
&lt;li&gt;$pk$: The user&#x27;s public key, defined as $g^{sk}$, which is a point on the secp256k1 curve.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;signature-generation&quot;&gt;Signature generation&lt;&#x2F;h3&gt;
&lt;p&gt;This scheme builds upon the Chaum-Pedersen signature scheme &lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-1-1&quot;&gt;&lt;a href=&quot;#fn-1&quot;&gt;1&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;. Given a 32-byte message $m$ and a keypair $(sk, pk)$, a  user may generate a signature as such:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Compute $h = \mathsf{htc}([m, \mathsf{sec1}(pk)])$.&lt;&#x2F;li&gt;
&lt;li&gt;Compute $z = h ^ r$.&lt;&#x2F;li&gt;
&lt;li&gt;Compute the nullifier $\mathsf{nul} = h^{sk}$.&lt;&#x2F;li&gt;
&lt;li&gt;Compute $c = \mathsf{sha256}([g, pk, h, \mathsf{nul}, g^r, z]])$.&lt;&#x2F;li&gt;
&lt;li&gt;Compute $s = r + sk \cdot c$.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The signature is $(z, s, g^r, c, \mathsf{nul})$.&lt;&#x2F;p&gt;
&lt;p&gt;The length of the input to $\mathsf{htc}$ is always 65 bytes.&lt;&#x2F;p&gt;
&lt;p&gt;Note that in this scheme, we compute $h$ as the hash of the message and $pk$, not the message and $r$. This is to make our scheme deterministic.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;signature-verification-non-zk&quot;&gt;Signature verification (non-ZK)&lt;&#x2F;h3&gt;
&lt;blockquote&gt;
&lt;p&gt;📝 &lt;strong&gt;Note:&lt;&#x2F;strong&gt; This section is non-normative.&lt;&#x2F;p&gt;
&lt;p&gt;Non-ZK signature verification is not part of this proposal but relevant for an intuitive understanding of the ZK signature verification.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;In a situation where the verifier knows $g$, $m$, the signer&#x27;s public key $pk$, and the signature $(z, s, g^r, c, \mathsf{nul})$, they may perform the following checks to determine if the signature is valid:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Compute $h = \mathsf{htc}([m, \mathsf{sec1}(pk)])$.&lt;&#x2F;li&gt;
&lt;li&gt;Compute $c&#x27; = \mathsf{sha256}([g, pk, h, \mathsf{nul}, g^r, z])$.&lt;&#x2F;li&gt;
&lt;li&gt;Reject if any of the following is false:
a. $g^{s} \cdot pk^{-c} \stackrel{?}{=} g^r$
b. $h^s \cdot \mathsf{nul}^{-c} \stackrel{?}{=} z$
c. $c \stackrel{?}{=} c&#x27;$&lt;&#x2F;li&gt;
&lt;li&gt;Accept if all of the above is true.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Now we move onto the ZK signature verification specs.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;version-1-verifier-optimized&quot;&gt;Version 1: Verifier Optimized&lt;&#x2F;h3&gt;
&lt;p&gt;In a situation where there is a verifier who must &lt;em&gt;not&lt;&#x2F;em&gt; know the signer&#x27;s $pk$, but the signer must nevertheless prove that they know $sk$ corresponding to the signature given $m$, a zero-knowledge proof is required.&lt;&#x2F;p&gt;
&lt;p&gt;The following verification function may be described via a circuit as part of a non-interactive zero-knowledge proving system, such as Groth16. To create a proof, the prover supplies the following inputs:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Public&lt;&#x2F;strong&gt;: $\mathsf{nul}$, $c$
&lt;strong&gt;Private&lt;&#x2F;strong&gt;: $pk$, $r$, $s$, $z$, $g^r$, $hash[m, g^sk]$ (included to save constraints)&lt;&#x2F;p&gt;
&lt;p&gt;The circuit performs the following computations:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Compute $h = \mathsf{htc}([m, \mathsf{sec1}(pk)])$.&lt;&#x2F;li&gt;
&lt;li&gt;Compute $pk = g^{sk}$.&lt;&#x2F;li&gt;
&lt;li&gt;Compute $c&#x27; = \mathsf{sha256}([g, pk, h, \mathsf{nul}, g^r, z]])$.&lt;&#x2F;li&gt;
&lt;li&gt;Compute $g^{s} \cdot pk^{-c}$.&lt;&#x2F;li&gt;
&lt;li&gt;Compute $g^r$.&lt;&#x2F;li&gt;
&lt;li&gt;Compute $h^s \cdot \mathsf{nul}^{-c}$.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;It also establishes the following constraints:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;$g^{s} \cdot pk^{-c} = g^r$&lt;&#x2F;li&gt;
&lt;li&gt;$h^s \cdot \mathsf{nul}^{-c} = z$&lt;&#x2F;li&gt;
&lt;li&gt;$c = c&#x27;$&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;version-2-prover-optimized&quot;&gt;Version 2: Prover Optimized&lt;&#x2F;h3&gt;
&lt;p&gt;Currently, SHA-256 hashing operations are particularly expensive with zk proofs in the browser. In the context of PLUME, the computation of $c$ is a bottleneck for efficient proof times, so one modification suggested by the Poseidon team was to move this hash computation outside the circuit, into the verifier.&lt;&#x2F;p&gt;
&lt;p&gt;To do this, we make $z$ and $g^r$ public signals in the circuit and update the definition of $c$ to $c = \text{sha256}([\text{nul}, g^r, z])$. The updated protocol is as follows.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Public:&lt;&#x2F;strong&gt; $\mathsf{nul}$, $c$, $g^r$, $z$
&lt;strong&gt;Private:&lt;&#x2F;strong&gt; $pk$, $r$, $s$, $hash[m, g^sk]$&lt;&#x2F;p&gt;
&lt;p&gt;The circuit performs the following computations:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Compute $h = \mathsf{htc}([m, \mathsf{sec1}(pk)])$.&lt;&#x2F;li&gt;
&lt;li&gt;Compute $pk = g^{sk}$.&lt;&#x2F;li&gt;
&lt;li&gt;Compute $g^{s} \cdot pk^{-c}$.&lt;&#x2F;li&gt;
&lt;li&gt;Compute $g^r$.&lt;&#x2F;li&gt;
&lt;li&gt;Compute $h^s \cdot \mathsf{nul}^{-c}$.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The circuit establishes the following constraints:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;$g^{s} \cdot pk^{-c} = g^r$&lt;&#x2F;li&gt;
&lt;li&gt;$h^s \cdot \mathsf{nul}^{-c} = z$&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In addition to verifying the zk-SNARK, the PLUME verifier performs the following check.&lt;&#x2F;p&gt;
&lt;p&gt;$c == \text{hash}(\text{nul}, g^r, h^r)$&lt;&#x2F;p&gt;
&lt;p&gt;Due to SHA-256 being a native precompile on Ethereum, this operation will still be efficient for smart contract verifiers.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;version-3&quot;&gt;Version 3:&lt;&#x2F;h3&gt;
&lt;p&gt;There may be a more efficient V3 in the future, perhaps via removing indifferentiability from hash_to_curve.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;We will define a few specific properties we are looking for in a candidate algorithm, then define a few other intuitive algorithms and explain why they don’t actually work.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Noninteractivity
&lt;ul&gt;
&lt;li&gt;The importance of noninteractivity in ZK ID systems is that it enables a large anonymity set from the start, making it resistant to sybil attacks and spam, which would be possible if there was an interactive phase. This allows for new use cases such as ZK airdrops.&lt;&#x2F;li&gt;
&lt;li&gt;Noninteractivity enables the full set of eligible users to be part of the anonymity set, without requiring any interaction. This is possible if the zk proof can verify the set membership in the Merkle tree, the message via the signature, and the unique nullifier. Interactive nullifiers, such as tornado.cash&#x27;s, require updating the anonymity set Merkle tree with each new user,&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Uniqueness
&lt;ul&gt;
&lt;li&gt;If we want to forbid actions like double spending or double claiming, we need them to be verifiably unique per account.&lt;&#x2F;li&gt;
&lt;li&gt;For example: Because ECDSA signatures are nondeterministic, signatures don’t suffice; we need a new deterministic function, verifiable with only the public key. We want the nullifier to be non-interactive, to uniquely identify the keypair yet keep the account identity secret.&lt;&#x2F;li&gt;
&lt;li&gt;The key insight is that such nullifiers can be used as a public commitment to a specific anonymous account to provide us with a uniqueness guarantee.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Deterministic
&lt;ul&gt;
&lt;li&gt;We want each account to only generate one such signature, and generate it exactly the same over time into the future.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Verifiable without a secret key
&lt;ul&gt;
&lt;li&gt;In cases where signatures are nondeterministic (like ECDSA) the signature alone is not sufficient for verification.&lt;&#x2F;li&gt;
&lt;li&gt;We want a new, deterministic function verifiable only with the public key&lt;&#x2F;li&gt;
&lt;li&gt;We don’t want users copy-pasting secret keys anywhere, and we need to choose a function such that the enclave calculation is simple enough for hardware wallets.&lt;&#x2F;li&gt;
&lt;li&gt;Because the nullifier is non-interactive, we are able to uniquely identify the key pair without revealing the account identity.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;We based the final design to be as simple as possible, and based off of BLS signatures, Chaum-Pederson EQDL, and Goh-Jarecki’s EDL paper, but to work on secp256k1.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;There are formal proofs of this specific algorithm’s cryptography in the PLUME paper &lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-2-1&quot;&gt;&lt;a href=&quot;#fn-2&quot;&gt;2&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;. The theory has been published, and implementations have had one internal round of audit, but they have not end-to-end been formally verified or audited yet, although empirically they correctly conform to the spec laid out.&lt;&#x2F;p&gt;
&lt;p&gt;Note that in the far future, once quantum computers can break ECDSA keypair security, most Ethereum keypairs will be broken, but migration to a quantum-resistant keypair in advance will keep active funds safe. Specifically, people can merely sign messages committing to new quantum-resistant keypairs (or just higher-bit keypairs on similar algorithms), and the canonical chain can fork to make such keypairs valid. ZK-SNARKs become forgeable, but there is still forward-secrecy for zk proofs. In the best case, the chain should be able to continue without a hitch.&lt;&#x2F;p&gt;
&lt;p&gt;However, if people rely on any type of deterministic nullifier like our construction, their anonymity is immediately broken: someone can merely derive the secret keys for the whole anonymity set, calculate all the nullifiers, and see which ones match. This problem will exist for any deterministic nullifier algorithm on ECDSA, since revealing the secret key reveals the only source of “randomness” that guarantees anonymity in a deterministic protocol.&lt;&#x2F;p&gt;
&lt;p&gt;If people want to keep post-quantum secrecy of data, they have to give up at least one of our properties: the easiest one is probably non-interactivity. For example, for the zero-knowledge airdrop, each account in the anonymity set publicly signs a commitment to a new semaphore id commitment (effectively address pk publishes $hash[randomness\ |\ external\ nullifier\ |\ pk]$). Then to claim, they reveal their external nullifier and ZK prove it came from one of the semaphore ids in the anonymity set. This considerably shrinks the anonymity set to everyone who has opted in to a semaphore commitment prior to that account claiming. As a result, there probably needs to be a separate signup phase where people commit to nullifiers in order to seed the anonymity set. This interactivity requirement makes applications such as the zk airdrop or nicer tornado cash construction (in the use cases section) much harder. However, since hashes (as far as we currently know) are still hard with quantum computers, it’s unlikely that people will be able to ever de-anonymize you.&lt;&#x2F;p&gt;
&lt;p&gt;A recent approximation of $2n^2$ qubits needed to solve discrete log via quantum annealing that failed to work on larger than $n$ = 6-bit primes shows that we are likely several decades from this becoming a reality, and the $n^2$ qubits needed to solve RSA having predictions 10-40 years out suggest that it will likely take longer than that to solve discrete log.&lt;&#x2F;p&gt;
&lt;p&gt;We hope that people will choose the appropriate algorithm for their chosen point on the interactivity-quantum secrecy tradeoff for their application, and hope that including this information helps folks make the right choice for themselves. Folks prioritizing shorter-term secrecy, like DAO voting or confessions of the young who will likely no longer care when they’re old, might prioritize this document’s nullifier construction, but whistleblowers or journalists might want to consider the semaphore construction instead.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;section class=&quot;footnotes&quot;&gt;
&lt;ol class=&quot;footnotes-list&quot;&gt;
&lt;li id=&quot;fn-1&quot;&gt;
&lt;p&gt;Chaum, D., &amp;amp; Pedersen, T. P. (1993). Wallet Databases with Observers. In E. F. Brickell (Ed.), &lt;span style=&quot;font-style: italic;&quot;&gt;Advances in Cryptology — CRYPTO&#x27; 92&lt;&#x2F;span&gt;. https:&#x2F;&#x2F;doi.org&#x2F;&lt;a href=&quot;https:&#x2F;&#x2F;doi.org&#x2F;10.1007&#x2F;3-540-48071-4_7&quot;&gt;10.1007&#x2F;3-540-48071-4_7&lt;&#x2F;a&gt;1. Pick a random $r$ from $F_p$. &lt;a href=&quot;#fr-1-1&quot;&gt;↩&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li id=&quot;fn-2&quot;&gt;
&lt;p&gt;Gupta, A., &amp;amp; Gurkan, K. (2022). &lt;span style=&quot;font-style: italic;&quot;&gt;PLUME: An ECDSA Nullifier Scheme for Unique Pseudonymity within Zero Knowledge Proofs&lt;&#x2F;span&gt;. https:&#x2F;&#x2F;doi.org&#x2F;&lt;a href=&quot;https:&#x2F;&#x2F;doi.org&#x2F;1721.1&#x2F;147434&quot;&gt;1721.1&#x2F;147434&lt;&#x2F;a&gt;&lt;strong&gt;The Interactivity-Quantum Secrecy Tradeoff&lt;&#x2F;strong&gt; &lt;a href=&quot;#fr-2-1&quot;&gt;↩&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;section&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>OIDC ZK Verifier for AA Account</title>
        <published>2023-09-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Shu Dong</name><uri>https://github.com/dongshu2013</uri><email>shu@hexlink.io</email>
	</author>
	
	<author>
		<name>Yudao Yan</name><email>dean@dauth.network</email>
	</author>
	
	<author>
		<name>Song Z</name><email>s@misfit.id</email>
	</author>
	
	<author>
		<name>Kai Chen</name><email>kai@dauth.network</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7522/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7522-oidc-zk-verifier/15862" />
        

        <id>https://wg-eips.ritovision.com/7522/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7522"
            label="ERC-7522" />
        

        
        

        
        <summary type="html">A ERC-4337 compatible OIDC ZK Verifier</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7522/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Account Abstraction facilitates new use cases for smart accounts, empowering users with the ability to tailor authentication and recovery mechanisms to their specific needs. To unlock the potential for more convenient verification methods such as social login, we inevitably need to connect smart accounts and OpenID Connect(OIDC), given its status as the most widely accepted authentication protocol. In this EIP, we proposed a &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt; compatible OIDC ZK verifier. Users can link their ERC-4337 accounts with OIDC identities and authorize an OIDC verifier to validate user operations by verifying the linked OIDC identity on-chain.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Connecting OIDC identity and smart accounts has been a very interesting but challenging problem. Verifying an OIDC issued IdToken is simple. IdToken are usually in the form of JWT and for common JWTs, they usually consist of three parts, a header section, a claim section and a signature section. The user claimed identity shall be included in the claim section and the signature section is usually an RSA signature of a well-known public key from the issuer against the hash of the combination of the header and claim section.&lt;&#x2F;p&gt;
&lt;p&gt;The most common way of tackling the issue is by utilizing Multi-Party Computation(MPC). However, the limitation of the MPC solution is obvious. First, it relies on a third-party service to sign and aggregate the signature which introduces centralization risk such as single point of failure and vendor lock-in. Second, it leads to privacy concerns, since the separation between the users&#x27; Web2 identity to their Web3 address can not be cryptographically guaranteed.&lt;&#x2F;p&gt;
&lt;p&gt;All these problems could be solved by ZK verification. Privacy will be guaranteed as the connection between Web2 identity and the Web3 account will be hidden. The ZK proof generation process is completely decentralized since it can be done on the client side without involving any third-party service. ZK proofs aggregation has also proven to be viable and paves the way for cheaper verification cost at scale.&lt;&#x2F;p&gt;
&lt;p&gt;In this EIP, we propose a new model to apply OIDC ZK verification to ERC-4337 account validation. We also define a minimal set of functions of the verifier as well as the input of the ZK proof to unify the interface for different ZK implementations. Now one can link its ERC-4337 account with an OIDC identity and use the OpenID ZK verifier to validate user operations. Due to the high cost of ZK verification, one common use case is to use the verifier as the guardian to recover the account owner if the owner key is lost or stolen. One may set multiple OIDC identities(e.g. Google Account, Facebook Account) as guardians to minimize the centralization risk introduced by the identity provider.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;Identity Provider(IDP)&lt;&#x2F;strong&gt;: The service to authenticate users and provide signed ID token&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;User&lt;&#x2F;strong&gt;: The client to authenticate users and generate the ZK proof&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;ZK Aggregrator&lt;&#x2F;strong&gt;: The offchain service to aggregate ZK proof from multiple users&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;OpenIdZkVerifier&lt;&#x2F;strong&gt;: The on-chain contract to verify the ZK proof&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;strong&gt;EntryPoint&lt;&#x2F;strong&gt;, &lt;strong&gt;Aggregator&lt;&#x2F;strong&gt; and &lt;strong&gt;AA Account&lt;&#x2F;strong&gt; are defined at ERC-4337.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;example-flow&quot;&gt;Example Flow&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7522&#x2F;.&#x2F;assets&#x2F;workflow.png&quot; alt=&quot;The example workflow&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;interface&quot;&gt;Interface&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;struct OpenIdZkProofPublicInput {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytes32 jwtHeaderAndPayloadHash;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytes32 userIdHash;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    uint256 expirationTimestamp;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytes jwtSignature;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;interface IOpenIdZkVerifier {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; @notice get verification key of the open id authenticator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function getVerificationKeyOfIdp() external view returns(bytes memory);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; @notice get id hash of account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function getIdHash(address account) external view returns(bytes32);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; @notice the function verifies the proof and given a user op&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; @params op: the user operation defined by ERC-4337&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;         input: the zk proof input with JWT info to prove&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;         proof: the generated ZK proof for input and op&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function verify(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        UserOp memory op,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        OpenIdZkProofPublicInput input,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bytes memory proof&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ) external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; @notice the function verifies the aggregated proof give a list of user ops&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; @params ops: a list of user operations defined by ERC-4337&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;         inputs: a list of zk proof input with JWT info to prove&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;         aggregatedProof: the aggregated ZK proof for inputs and ops&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function verifyAggregated(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        UserOp[] memory ops,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        OpenIdZkProofPublicInput[] memory inputs,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bytes memory aggregatedProof&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ) external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;To verify identity ownership on-chain, &lt;strong&gt;IOpenIdVerifier&lt;&#x2F;strong&gt; needs at least three pieces of information:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;the user ID to identify the user in the IDP. The &lt;strong&gt;getIdHash&lt;&#x2F;strong&gt; function returns the hash of the user id given smart account address. There may be multiple smart accounts linked to the same user ID.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;the public key of the key pair used by identity provider to sign ID token. It is provided by the &lt;strong&gt;getVerificationKeyOfIdp&lt;&#x2F;strong&gt; function.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;the ZK proof to verify the OIDC identity. The verification is done by the &lt;strong&gt;verify&lt;&#x2F;strong&gt; function. Besides the proof, the function takes two extra params: the user operation to execute and the public input to prove. The &lt;strong&gt;verifyAggregated&lt;&#x2F;strong&gt; is similar to the &lt;strong&gt;verify&lt;&#x2F;strong&gt; function but with a list of input and ops as parameters&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The &lt;strong&gt;OpenIdZkProofPublicInput&lt;&#x2F;strong&gt; struct must contain the following fields:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Field&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;jwtHeaderAndPayloadHash&lt;&#x2F;td&gt;&lt;td&gt;the hash of the JWT header plus payload&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;userIdHash&lt;&#x2F;td&gt;&lt;td&gt;the hash of the user id, the user id should present as value of one claim&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;expirationTimestamp&lt;&#x2F;td&gt;&lt;td&gt;the expiration time of the JWT, which could be value of &quot;exp&quot; claim&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;jwtSignature&lt;&#x2F;td&gt;&lt;td&gt;the signature of the JWT&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;We didn&#x27;t include the verification key and the user operation hash in the struct because we assume the public key could be provided by &lt;strong&gt;getVerificationKeyOfIdp&lt;&#x2F;strong&gt; function and the user operation hash could be calculated from the raw user operation passed in.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The proof must verify the &lt;em&gt;expirationTimestamp&lt;&#x2F;em&gt; to prevent replay attacks. &lt;strong&gt;expirationTimestamp&lt;&#x2F;strong&gt; should be incremental and could be the &lt;strong&gt;exp&lt;&#x2F;strong&gt; field in JWT payload. The proof must verify the user operation to prevent front running attacks. The proof must verify the &lt;strong&gt;userIdHash&lt;&#x2F;strong&gt;. The verifier must verify that the sender from each user operation is linked to the user ID hash via the &lt;strong&gt;getIdHash&lt;&#x2F;strong&gt; function.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via CC0.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>General Intents for Smart Contract Wallets</title>
        <published>2023-09-19T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Stephen Monn</name><uri>https://github.com/pixelcircuits</uri>
	</author>
	
	<author>
		<name>Bikem Bengisu</name><uri>https://github.com/supiket</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7521/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7521-generalized-intents-for-smart-contract-wallets/15840" />
        

        <id>https://wg-eips.ritovision.com/7521/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7521"
            label="ERC-7521" />
        

        
        

        
        <summary type="html">A generalized intent specification for smart contract wallets, allowing authorization of current and future intent structures at sign time</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7521/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;A generalized intent specification entry point contract which enables support for a multitude of intent standards as they evolve over time. Instead of smart contract wallets having to constantly upgrade to provide support for new intent standards as they pop up, a single entry point contract is trusted to handle signature verification which then passes off the low level intent data handling and defining to other contracts specified by users at intent sign time. These signed messages, called a &lt;code&gt;UserIntent&lt;&#x2F;code&gt;, are gossipped around any host of mempool strategies for MEV searchers to look through and combine with their own &lt;code&gt;UserIntent&lt;&#x2F;code&gt; into an object called an &lt;code&gt;IntentSolution&lt;&#x2F;code&gt;. MEV searchers then package up an &lt;code&gt;IntentSolution&lt;&#x2F;code&gt; object they build into a transaction making a &lt;code&gt;handleIntents&lt;&#x2F;code&gt; call to the special contract entry point contract. This transaction then goes through the typical MEV channels to eventually be included in a block.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;See also &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;&quot;ERC-4337: Account Abstraction via Entry Point Contract specification&quot;&lt;&#x2F;a&gt; and the links therein for historical work and motivation.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal uses the same entry point contract idea to enable a single interface which smart contract wallets can support now to unlock future-proof access to an evolving intent landscape. It seeks to achieve the following goals:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Achieve the key goal of enabling intents for users&lt;&#x2F;strong&gt;: allow users to use smart contract wallets containing arbitrary verification logic to specify intent execution as described and handled by various other intent standard contracts.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Decentralization&lt;&#x2F;strong&gt;
&lt;ul&gt;
&lt;li&gt;Allow any MEV searcher to participate in the process of solving signed intents&lt;&#x2F;li&gt;
&lt;li&gt;Allow any developer to add their own intent standard definitions for users to opt-in to at sign time&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Be forward thinking for future intent standard compatibility&lt;&#x2F;strong&gt;: Define an intent standard interface that gives future intent standard defining contracts access to as much information about the current &lt;code&gt;handleIntents&lt;&#x2F;code&gt; execution context as possible.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Keep gas costs down to a minimum&lt;&#x2F;strong&gt;: Include key intent handling logic, like intent segment execution order, into the entry point contract itself in order to optimize gas efficiency for the most common use cases.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Enable good user experience&lt;&#x2F;strong&gt;
&lt;ul&gt;
&lt;li&gt;Avoid the need for smart contract wallet upgrades when a user wants to use a newly developed intent standard.&lt;&#x2F;li&gt;
&lt;li&gt;Enable complex intent composition that only needs a single signature.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Users package up intents they want their wallet to participate in, in an ABI-encoded struct called a &lt;code&gt;UserIntent&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Field&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;sender&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;address&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The wallet making the intent&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;segments&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;bytes[]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Data defined by multiple segments of varying intent standards&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;signature&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;bytes&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Data passed into the wallet during the verification step&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The &lt;code&gt;segments&lt;&#x2F;code&gt; parameter is an array of arbitrary bytes whose use is defined by an intent standard. Each item in this array is referred to as an &lt;strong&gt;intent segment&lt;&#x2F;strong&gt;. The first 32 bytes of each segment is used to specify the &lt;strong&gt;intent standard ID&lt;&#x2F;strong&gt; to which the segment data belongs. Users send &lt;code&gt;UserIntent&lt;&#x2F;code&gt; objects to any mempool strategy that works best for the intent standards being used. A specialized class of MEV searchers called &lt;strong&gt;solvers&lt;&#x2F;strong&gt; look for these intents and ways that they can be combined with other intents (including their own) to create an ABI-encoded struct called an &lt;code&gt;IntentSolution&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Field&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;timestamp&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint256&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The time at which intents should be evaluated&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;intents&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;UserIntent[]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;List of intents to execute&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;order&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint256[]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Order of execution for the included intents&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The solver then creates a &lt;strong&gt;solution transaction&lt;&#x2F;strong&gt;, which packages up an &lt;code&gt;IntentSolution&lt;&#x2F;code&gt; object into a single &lt;code&gt;handleIntents&lt;&#x2F;code&gt; call to a pre-published global &lt;strong&gt;entry point contract&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The core interface of the entry point contract is as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; handleIntents&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IntentSolution&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; solution&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validateIntent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;UserIntent&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; intent&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; registerIntentStandard&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IIntentStandard&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; intentStandard&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verifyExecutingIntentSegmentForStandard&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IIntentStandard&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; intentStandard&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The core interface required for an intent standard to have is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validateIntentSegment&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; segmentData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; executeIntentSegment&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IntentSolution&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; solution&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; executionIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; segmentIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; context&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The core interface required for a wallet to have is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validateUserIntent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;UserIntent&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; intent&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; intentHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; generalizedIntentDelegateCall&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;required-entry-point-contract-functionality&quot;&gt;Required entry point contract functionality&lt;&#x2F;h3&gt;
&lt;p&gt;The entry point&#x27;s &lt;code&gt;handleIntents&lt;&#x2F;code&gt; function must perform the following steps. It must make two loops, the &lt;strong&gt;verification loop&lt;&#x2F;strong&gt; and the &lt;strong&gt;execution loop&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;In the verification loop, the &lt;code&gt;handleIntents&lt;&#x2F;code&gt; call must perform the following steps for each &lt;code&gt;UserIntent&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Validate &lt;code&gt;timestamp&lt;&#x2F;code&gt; value on the &lt;code&gt;IntentSolution&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; by making sure it is within an acceptable range of &lt;code&gt;block.timestamp&lt;&#x2F;code&gt; or some time before it.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Call &lt;code&gt;validateUserIntent&lt;&#x2F;code&gt; on the wallet&lt;&#x2F;strong&gt;, passing in the &lt;code&gt;UserIntent&lt;&#x2F;code&gt; and the hash of the intent. The wallet should verify the intent&#x27;s signature. If any &lt;code&gt;validateUserIntent&lt;&#x2F;code&gt; call fails, &lt;code&gt;handleIntents&lt;&#x2F;code&gt; must skip execution of at least that intent, and may revert entirely.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In the execution loop, the &lt;code&gt;handleIntents&lt;&#x2F;code&gt; call must perform the following steps for all &lt;strong&gt;segments&lt;&#x2F;strong&gt; on the &lt;code&gt;segments&lt;&#x2F;code&gt; bytes array parameter on each &lt;code&gt;UserIntent&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Call &lt;code&gt;executeIntentSegment&lt;&#x2F;code&gt; on the intent standard&lt;&#x2F;strong&gt;, specified by the first 32 bytes of the &lt;code&gt;segments&lt;&#x2F;code&gt; (the intent standard ID). This call passes in the entire &lt;code&gt;IntentSolution&lt;&#x2F;code&gt; as well as the current &lt;code&gt;executionIndex&lt;&#x2F;code&gt; (the number of times this function has already been called for any standard or intent before this), &lt;code&gt;segmentIndex&lt;&#x2F;code&gt; (index in the &lt;code&gt;segments&lt;&#x2F;code&gt; array to execute for) and &lt;code&gt;context&lt;&#x2F;code&gt; data. The &lt;code&gt;executeIntentSegment&lt;&#x2F;code&gt; function returns arbitrary bytes per intent which must be remembered and passed into the next &lt;code&gt;executeIntentSegment&lt;&#x2F;code&gt; call for the same intent.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;It&#x27;s up to the intent standard to choose how to parse the &lt;code&gt;segments&lt;&#x2F;code&gt; bytes and utilize the &lt;code&gt;context&lt;&#x2F;code&gt; data blob that persists across intent execution.&lt;&#x2F;p&gt;
&lt;p&gt;The order of execution for &lt;code&gt;UserIntent&lt;&#x2F;code&gt; segments in the &lt;code&gt;segments&lt;&#x2F;code&gt; array always follows the same order defined on the &lt;code&gt;segments&lt;&#x2F;code&gt; parameter. However, the order of execution for segments between &lt;code&gt;UserIntent&lt;&#x2F;code&gt; objects can be specified by the &lt;code&gt;order&lt;&#x2F;code&gt; parameter of the &lt;code&gt;IntentSolution&lt;&#x2F;code&gt; object. For example, an &lt;code&gt;order&lt;&#x2F;code&gt; array of &lt;code&gt;[1,1,0,1]&lt;&#x2F;code&gt; would result in the second intent being executed twice (segments 1 and 2 on intent 2), then the first intent would be executed (segment 1 on intent 1), followed by the second intent being executed a third time (segment 3 on intent 2). If no ordering is specified in the solution, or all segments have not been processed for all intents after getting to the end of the order array, a default ordering will be used. This default ordering loops from the first intent to the last as many times as necessary until all intents have had all their segments executed. If the ordering calls for an intent to be executed after it&#x27;s already been executed for all its segments, then the &lt;code&gt;executeIntentSegment&lt;&#x2F;code&gt; call is simply skipped and execution across all intents continues.&lt;&#x2F;p&gt;
&lt;p&gt;Before accepting a &lt;code&gt;UserIntent&lt;&#x2F;code&gt;, solvers must use an RPC method to locally call the &lt;code&gt;validateIntent&lt;&#x2F;code&gt; function of the entry point, which verifies that the signature and data formatting is correct; see the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7521&#x2F;#solver-intent-validation&quot;&gt;Intent validation section below&lt;&#x2F;a&gt; for details.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;registering-new-entry-point-intent-standards&quot;&gt;Registering new entry point intent standards&lt;&#x2F;h4&gt;
&lt;p&gt;The entry point&#x27;s &lt;code&gt;registerIntentStandard&lt;&#x2F;code&gt; function must allow for permissionless registration of new intent standard contracts. During the registration process, the entry point gives it a &lt;strong&gt;standard ID&lt;&#x2F;strong&gt; which is unique to the intent standard contract, entry point contract and chain ID.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;intent-standard-behavior-executing-an-intent&quot;&gt;Intent standard behavior executing an intent&lt;&#x2F;h3&gt;
&lt;p&gt;The intent standard&#x27;s &lt;code&gt;executeIntentSegment&lt;&#x2F;code&gt; function is given access to a wide set of data, including the entire &lt;code&gt;IntentSolution&lt;&#x2F;code&gt; in order to allow it to implement any kind of logic that may be seen as useful in the future. Each intent standard contract is expected to parse the &lt;code&gt;UserIntent&lt;&#x2F;code&gt; objects &lt;code&gt;segments&lt;&#x2F;code&gt; parameter and use that to validate any constraints or perform any actions relevant to the standard. Intent standards can also take advantage of the &lt;code&gt;context&lt;&#x2F;code&gt; data it can return at the end of the &lt;code&gt;executeIntentSegment&lt;&#x2F;code&gt; function. This data is kept by the entry point and passed in as a parameter to the &lt;code&gt;executeIntentSegment&lt;&#x2F;code&gt; function the next time it is called for an intent. This gives intent standards access to a persistent data store as other intents are executed in between others. One use case for this is an intent standard that is looking for a change in state during intent execution (like releasing tokens and expecting to be given other tokens).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;smart-contract-wallet-behavior-executing-an-intent&quot;&gt;Smart contract wallet behavior executing an intent&lt;&#x2F;h3&gt;
&lt;p&gt;The entry point does not expect anything from the smart contract wallets after validation and during intent execution. However, intent standards may wish for the smart contract wallet to perform some action during execution. The smart contract wallet &lt;code&gt;generalizedIntentDelegateCall&lt;&#x2F;code&gt; function must perform a delegate call with the given calldata at the calling intent standard. In order for the wallet to trust making the delegate call it must call the &lt;code&gt;verifyExecutingIntentSegmentForStandard&lt;&#x2F;code&gt; function on the entry point contract to verify both of the following:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;msg.sender&lt;&#x2F;code&gt; for &lt;code&gt;generalizedIntentDelegateCall&lt;&#x2F;code&gt; on the wallet is the intent standard contract that the entry point is currently calling &lt;code&gt;executeIntentSegment&lt;&#x2F;code&gt; on.&lt;&#x2F;li&gt;
&lt;li&gt;The smart contract wallet is the &lt;code&gt;sender&lt;&#x2F;code&gt; on the &lt;code&gt;UserIntent&lt;&#x2F;code&gt; that the entry point is currently calling &lt;code&gt;executeIntentSegment&lt;&#x2F;code&gt; for.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;smart-contract-wallet-behavior-validating-an-intent&quot;&gt;Smart contract wallet behavior validating an intent&lt;&#x2F;h3&gt;
&lt;p&gt;The entry point calls &lt;code&gt;validateUserIntent&lt;&#x2F;code&gt; for each intent on the smart contract wallet specified in the &lt;code&gt;sender&lt;&#x2F;code&gt; field of each &lt;code&gt;UserIntent&lt;&#x2F;code&gt;. This function provides the entire &lt;code&gt;UserIntent&lt;&#x2F;code&gt; object as well as the precomputed hash of the intent. The smart contract wallet is then expected to analyze this data to ensure it was actually sent from the specified &lt;code&gt;sender&lt;&#x2F;code&gt;. If the intent is not valid, the smart contract wallet should throw an error in the &lt;code&gt;validateUserIntent&lt;&#x2F;code&gt; function. It should be noted that although &lt;code&gt;validateUserIntent&lt;&#x2F;code&gt; is not restricted as &lt;code&gt;view&lt;&#x2F;code&gt;, updates to state for things like nonce management, should be done in an individual segment on the intent itself. This allows for maximum customization in the way users define their intents while enshrining only the minimum verification within the entry point needed to ensure intents cannot be forged.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;solver-intent-validation&quot;&gt;Solver intent validation&lt;&#x2F;h3&gt;
&lt;p&gt;To validate a &lt;code&gt;UserIntent&lt;&#x2F;code&gt;, the solver makes a view call to &lt;code&gt;validateIntent&lt;&#x2F;code&gt; on the entry point. This function checks that the signature passes validation and that the segments on the intent are properly formatted. If the call reverts with any error, the solver should reject the &lt;code&gt;UserIntent&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;simulation&quot;&gt;Simulation&lt;&#x2F;h3&gt;
&lt;p&gt;Solvers are expected to handle simulation in typical MEV workflows. This most likely means dry running their solutions at the current block height to determine the outcome is as expected. Successful solutions can then be submitted as a bundle to block builders to be included in the next block.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;extensions&quot;&gt;Extensions&lt;&#x2F;h3&gt;
&lt;p&gt;The entry point contract may enable additional functionality to reduce gas costs for common scenarios.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;extension-embedded-intent-standards&quot;&gt;Extension: embedded intent standards&lt;&#x2F;h4&gt;
&lt;p&gt;We extend the entry point logic to include the logic of several identified  &lt;strong&gt;common intent standards&lt;&#x2F;strong&gt;. These standards are registered with their own standard ID at entry point contract creation time. The functions &lt;code&gt;validateUserIntent&lt;&#x2F;code&gt; and &lt;code&gt;executeIntentSegment&lt;&#x2F;code&gt; for these standards are included as part of the entry point contracts code in order to reduce external calls and save gas.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;extension-handle-multi&quot;&gt;Extension: handle multi&lt;&#x2F;h4&gt;
&lt;p&gt;We add the additional function &lt;code&gt;handleIntentsMulti(IntentSolution[] calldata solutions)&lt;&#x2F;code&gt; to the entry point contract. This allows multiple solutions to be executed in a single transaction to enable gas saving in intents that touch similar areas of storage.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;extension-nonce-management&quot;&gt;Extension: nonce management&lt;&#x2F;h4&gt;
&lt;p&gt;We add the functions &lt;code&gt;getNonce(address sender, uint256 key)&lt;&#x2F;code&gt; and &lt;code&gt;setNonce(uint256 key, uint256 nonce)&lt;&#x2F;code&gt; to the entry point contract. These functions allow nonce data to be stored in the entry point contracts storage. Nonces are stored at a per sender level and are available to be read by anyone. However, the entry point contract enforces that nonces can only be set for a user by a currently executing intent standard and only for the &lt;code&gt;sender&lt;&#x2F;code&gt; on the intent currently being executed.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;extension-data-blobs&quot;&gt;Extension: data blobs&lt;&#x2F;h4&gt;
&lt;p&gt;We enable the entry point contract to skip the validation of &lt;code&gt;UserIntent&lt;&#x2F;code&gt; objects with either a &lt;code&gt;sender&lt;&#x2F;code&gt; field of &lt;code&gt;address(0)&lt;&#x2F;code&gt; or an empty &lt;code&gt;segments&lt;&#x2F;code&gt; field (rather than fail validation). Similarly, they are skipped during execution. The &lt;code&gt;segments&lt;&#x2F;code&gt; field or &lt;code&gt;sender&lt;&#x2F;code&gt; field is then free to be treated as a way to inject any arbitrary data into intent execution. This data could be useful in solving an intent that has an intent standard which requires some secret to be known and proven to it, or an intent whose behavior can change according to what other intents are around it. For example, an intent standard that signals a smart contract wallet to transfer some tokens to the sender of the intent that is next in line for the execution process.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The main challenge with a generalized intent standard is being able to adapt to the evolving world of intents. Users need to have a way to express their intents in a seamless way without having to make constant updates to their smart contract wallets.&lt;&#x2F;p&gt;
&lt;p&gt;In this proposal, we expect wallets to have a &lt;code&gt;validateUserIntent&lt;&#x2F;code&gt; function that takes as input a &lt;code&gt;UserIntent&lt;&#x2F;code&gt;, and verifies the signature. A trusted entry point contract uses this function to validate the signature and forwards the intent handling logic to the intent standard contracts specified in the first 32 bytes of each segment in the &lt;code&gt;segments&lt;&#x2F;code&gt; array field on the &lt;code&gt;UserIntent&lt;&#x2F;code&gt;. The wallet is then expected to have a &lt;code&gt;generalizedIntentDelegateCall&lt;&#x2F;code&gt; function that allows it to perform intent related actions from the intent standard contracts, using the &lt;code&gt;verifyExecutingIntentSegmentForStandard&lt;&#x2F;code&gt; function on the entry point for security.&lt;&#x2F;p&gt;
&lt;p&gt;The entry point based approach allows for a clean separation between verification and intent execution, and prevents wallets from having to constantly update to support the latest intent standard composition that a user wants to use. The alternative would involve developers of new intent standards having to convince wallet software developers to support their new intent standards. This proposal moves the core definition of an intent into the hands of users at signing time.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;solvers&quot;&gt;Solvers&lt;&#x2F;h3&gt;
&lt;p&gt;Solvers facilitate the fulfillment of a user&#x27;s intent in search of their own MEV. They also act as the transaction originator for executing intents on-chain, including having to front any gas fees, removing that burden from the typical user.&lt;&#x2F;p&gt;
&lt;p&gt;Solvers will rely on gossiping networks and solution algorithms that are to be determined by the nature of the intents themselves and the individual intent standards being used.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;entry-point-upgrading&quot;&gt;Entry point upgrading&lt;&#x2F;h3&gt;
&lt;p&gt;Wallets are encouraged to be DELEGATECALL forwarding contracts for gas efficiency and to allow wallet upgradability. The wallet code is expected to hard-code the entry point into their code for gas efficiency. If a new entry point is introduced, whether to add new functionality, improve gas efficiency, or fix a critical security bug, users can self-call to replace their wallet&#x27;s code address with a new code address containing code that points to a new entry point. During an upgrade process, it&#x27;s expected that intent standard contracts will also have to be re-registered to the new entry point.&lt;&#x2F;p&gt;
&lt;p&gt;Another option would be for wallets to not hard-code the entry point and instead validate signatures from any entry point. When a signature is validated, the wallet can note the entry point in transient storage and then use that to ensure security when accepting &lt;code&gt;generalizedIntentDelegateCall&lt;&#x2F;code&gt; function calls. There is an example of this in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7521&#x2F;#reference-implementation&quot;&gt;reference implementation&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;intent-standard-upgrading&quot;&gt;Intent standard upgrading&lt;&#x2F;h4&gt;
&lt;p&gt;Because intent standards are not hardcoded into the wallet, users do not need to perform any operation to use any newly registered intent standards. A user can simply sign an intent with the new intent standard.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;signature-aggregation&quot;&gt;Signature aggregation&lt;&#x2F;h3&gt;
&lt;p&gt;Signature aggregation should be handled by the smart contract wallets directly during the signature validation process. This removes complexity from the entry point and allows developers to be creative with solutions. The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7521&#x2F;#reference-implementation&quot;&gt;reference implementation&lt;&#x2F;a&gt; includes an example for how to accomplish this through the use of a wallet trusted aggregation contract which uses transient storage to report back to individual wallets that an intent was already validated via an aggregated signature earlier in the transaction call stack.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC does not change the consensus layer, so there are no backwards compatibility issues for Ethereum as a whole. There is a little more difficulty when trying to integrate with existing smart contract wallets. If the wallet already has support for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt;, then implementing a &lt;code&gt;validateUserIntent&lt;&#x2F;code&gt; function should be very similar to the &lt;code&gt;validateUserOp&lt;&#x2F;code&gt; function, but would require an upgrade by the user.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;See &lt;code&gt;https:&#x2F;&#x2F;github.com&#x2F;essential-contributions&#x2F;ERC7521&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The entry point contract will need to be very heavily audited and formally verified, because it will serve as a central trust point for &lt;em&gt;all&lt;&#x2F;em&gt; &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7521&#x2F;&quot;&gt;ERC-7521&lt;&#x2F;a&gt; supporting wallets. In total, this architecture reduces auditing and formal verification load for the ecosystem, because the amount of work that individual &lt;em&gt;wallets&lt;&#x2F;em&gt; have to do becomes much smaller (they need only verify the &lt;code&gt;validateUserIntent&lt;&#x2F;code&gt; function and its &quot;check signature&quot; logic) and gate any calls to &lt;code&gt;generalizedIntentDelegateCall&lt;&#x2F;code&gt; by checking with the entry point using the &lt;code&gt;verifyExecutingIntentSegmentForStandard&lt;&#x2F;code&gt; function. The concentrated security risk in the entry point contract, however, needs to be verified to be very robust since it is so highly concentrated.&lt;&#x2F;p&gt;
&lt;p&gt;Verification would need to cover one primary claim (not including claims needed to protect solvers, and intent standard related infrastructure):&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Safety against arbitrary hijacking&lt;&#x2F;strong&gt;: The entry point only returns true for &lt;code&gt;verifyExecutingIntentSegmentForStandard&lt;&#x2F;code&gt; when it has successfully validated the signature of the &lt;code&gt;UserIntent&lt;&#x2F;code&gt; and is currently in the middle of calling &lt;code&gt;executeIntentSegment&lt;&#x2F;code&gt; on the &lt;code&gt;standard&lt;&#x2F;code&gt; specified in the &lt;code&gt;segments&lt;&#x2F;code&gt; field of a &lt;code&gt;UserIntent&lt;&#x2F;code&gt; which also has the same &lt;code&gt;sender&lt;&#x2F;code&gt; as the &lt;code&gt;msg.sender&lt;&#x2F;code&gt; wallet calling the function.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Additional heavy auditing and formal verification will also need to be done for any intent standard contracts a user decides to interact with.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Empty accounts deprecation</title>
        <published>2023-09-19T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Peter Davies</name><uri>https://github.com/petertdavies</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7523/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7523-empty-accounts-deprecation/15870" />
        

        <id>https://wg-eips.ritovision.com/7523/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="last-call"
                label="Last Call" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7523"
            label="EIP-7523" />
        

        
        

        
        <summary type="html">Prohibit empty accounts on post-merge networks</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7523/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP prohibits the state of any post-merge network from containing empty accounts. Since no empty accounts exist outside the testsuite and no new ones can be created this requirement is already achieved in practice. An explicit ban reduces technical debt going forward.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The possibility of empty accounts is a historical artifact of the early history of Ethereum. The only networks that have ever been capable of containing them are Ethereum Mainnet, the deprecated testnet Ropsten, Etheruem Classic Mainnet and various Ethereum Classic testnets. All remaining empty accounts on Mainnet were cleared in block &lt;code&gt;14049881&lt;&#x2F;code&gt; (transaction &lt;code&gt;0xf955834bfa097458a9cf6b719705a443d32e7f43f20b9b0294098c205b4bcc3d&lt;&#x2F;code&gt;) and a similar transaction was sent on Ethereum Classic. None of the other myriad EVM-compatible networks are old enough to have empty accounts and there is no realistic prospect that anyone will encounter an empty account in a production context.&lt;&#x2F;p&gt;
&lt;p&gt;Despite empty accounts no longer existing, they still impose a legacy of technical debt. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;161&#x2F;&quot;&gt;EIP-161&lt;&#x2F;a&gt; imposes complicated rules that require a client to delete an empty account when it is &quot;touched&quot;. As the Ethereum specification continues to evolve new edgecases of the &quot;touch&quot; rules arise which must be debated, implemented, tested and documented. If a future client wishes to only support post-merge blocks it must implement unnecessary empty account support solely to pass the test suite.&lt;&#x2F;p&gt;
&lt;p&gt;By prohibiting empty accounts on post-merge networks, this EIP frees designers and implementers of Ethereum and related blockchains from the burden of having to consider them going forward.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;An empty account is an account with has &lt;strong&gt;no code&lt;&#x2F;strong&gt; and &lt;strong&gt;zero nonce&lt;&#x2F;strong&gt; and &lt;strong&gt;zero balance&lt;&#x2F;strong&gt;. This is the same as the definition in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;161&#x2F;&quot;&gt;EIP-161&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;On networks that undergo the merge transition, the pre state of the merge block may not contain any empty accounts. For networks that are merged at genesis, none of the genesis accounts may be empty accounts.&lt;&#x2F;p&gt;
&lt;p&gt;Rather than performing a scan of the state, clients MAY assume the following chains have no post-merge empty accounts:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;The Mainnet chain whose merge block has hash &lt;code&gt;0x56a9bb0302da44b8c0b3df540781424684c3af04d0b7a38d72842b762076a664&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Any chain which satisfies all of the following:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;has no empty accounts in the genesis.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;had a post Spurious Dragon fork at genesis.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The Ethereum specification is declared to be undefined in the presence of an empty account in a post-merge context. Any testcase involving post-merge empty accounts is invalid.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP was drafted to be the simplest possible way of eliminating the long term technical debt imposed by empty accounts. The Merge was chosen as a natural easily identifiable cutoff point.&lt;&#x2F;p&gt;
&lt;p&gt;Alternative approaches include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Using an earlier cutoff point, such as block &lt;code&gt;14049881&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Identifying a wider range of edge case behaviour that never happened.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;These approaches were rejected as being unnecessarily complicated.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;As EIP does not change any behaviour that can occur outside the testsuite, it has no backwards compatibility consequences.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The validity of this EIP is dependent on the assertion that all empty accounts on Ethereum Mainnet were cleared prior to the merge. This should be subject to appropriate verification.&lt;&#x2F;p&gt;
&lt;p&gt;Any networks artificially created with empty accounts will cause problems with tooling and clients.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Atomic Storage Operations SCREDIT and SDEBIT</title>
        <published>2023-09-16T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Danno Ferrin</name><uri>https://github.com/shemnon</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7519/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7519-atomic-storage-operations-scredit-and-sdebit/15818" />
        

        <id>https://wg-eips.ritovision.com/7519/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7519"
            label="EIP-7519" />
        

        
        

        
        <summary type="html">Add atomic operations for incrementing and decrementing storage slots</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7519/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Two new opcodes that atomically mutate smart contract storage are proposed:
SCREDIT, which increments a storage slot by a specified value, and SDEBIT, which
decrements a storage slot by a specified value. Overflow and underflow errors
are enforced, reverting when an unsigned 256-bit integer would overflow or
underflow.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;There has been a large amount of energy around parallel EVMs across multiple
chains, however there is a lack of parallel primitives within the EVM to support
any model other than optimistic concurrency control (OCC). By adding concurrent
increment and decrement operations more advanced parallel environments can be
introduced in Layer 2 networks.&lt;&#x2F;p&gt;
&lt;p&gt;This also provides the opportunity to serve the principal use case of increment
and decrement: token balances. We can introduce failures on overflow and
underflow conditions and provide an operation that is also useful outside of
parallel use cases.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Two operations to atomically increment and decrement a storage will be
introduced
at &lt;code&gt;0xTBD&lt;&#x2F;code&gt;. Each operation takes two stack arguments and has no immediate
arguments. Gas schedule will be the same as SSTORE.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Mnemonic&lt;&#x2F;th&gt;&lt;th&gt;Op&lt;&#x2F;th&gt;&lt;th&gt;Input&lt;&#x2F;th&gt;&lt;th&gt;Output&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SCREDIT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xTBD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SDEBIT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xTBD+1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;scredit&quot;&gt;SCREDIT&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;SCREDIT: slot, value&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;description&quot;&gt;Description&lt;&#x2F;h4&gt;
&lt;p&gt;Adds &lt;code&gt;value&lt;&#x2F;code&gt; to the value stored in contract storage &lt;code&gt;slot.&lt;&#x2F;code&gt;  If an overflow
would occur the operation halts exceptionally.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;gas-charging&quot;&gt;Gas Charging&lt;&#x2F;h4&gt;
&lt;p&gt;Gas charging is identical to SSTORE. including interactions with the warm
storage slot list. Any future modifications to the SSTORE gas charges will also
apply to SCREDIT.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;execution&quot;&gt;Execution&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;em&gt;Not valid python, not suitable for EELS yet&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;slot = evm_stack.pop()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;value = evm_stack.pop()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;storage_value = read_contract_storage(slot)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;storage_value = storage_value + value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;if storage_value &amp;gt;= 2**256 :&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  raise Exception(&amp;quot;scredit overflow&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;write_contract_storage(storage_value)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;sdebit&quot;&gt;SDEBIT&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;SDEBIT: slot, value&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;description-1&quot;&gt;Description&lt;&#x2F;h4&gt;
&lt;p&gt;Subtracts &lt;code&gt;value&lt;&#x2F;code&gt; to the value stored in contract storage &lt;code&gt;slot.&lt;&#x2F;code&gt;  If an
underflow would occur the operation halts exceptionally.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;gas-charging-1&quot;&gt;Gas Charging&lt;&#x2F;h4&gt;
&lt;p&gt;Gas charging is identical to SSTORE, including interactions with the warm
storage slot list. Any future modifications to the SSTORE gas charges will also
apply to SDEBIT.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;execution-1&quot;&gt;Execution&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;em&gt;Not valid python, not suitable for EELS yet&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;slot = evm_stack.pop()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;value = evm_stack.pop()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;storage_value = read_contract_storage(slot)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;storage_value = storage_value - value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;if storage_value &amp;lt; 0 :&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  raise Exception(&amp;quot;sdebit underflow&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;write_contract_storage(storage_value)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The primary consideration when choosing between alternatives is that the primary
intended audiences is token contracts and other asset-tracking contracts
combined with a desire to ship the minimum necessary changes to enable that use
case. General concurrency controls is not a goal of this EIP.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;enforcing-overflow-semantics&quot;&gt;Enforcing Overflow Semantics&lt;&#x2F;h3&gt;
&lt;p&gt;When allowing for out-of-order execution there needs to be mechanism to handle
any possible order of execution. OCC handles this by validating pre- and
post-conditions, and re-evaluating the transactions if those invariants did not
hold. This technique breaks down around writing to balances and counters.&lt;&#x2F;p&gt;
&lt;p&gt;Increment&#x2F;decrement with rollover checking allows for simple handling of
balances and counters while allowing for functional read support ensuring that
sufficient balance or count exists without depending on the exact values. This
allows for evaluation models where the only post-condition checked is to
validate that the storage slots could handle all possible re-ordering of
transactions.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-schedule&quot;&gt;Gas Schedule&lt;&#x2F;h3&gt;
&lt;p&gt;The decision to cost the operations at the exact same value as SSTORE is partly
for ease of implementation and partly as an incentive to compilers and
developers.&lt;&#x2F;p&gt;
&lt;p&gt;These semantics could be implemented in the EVM today, but it would also include
a SLOAD, DUP, LT, JUMPI and REVERT instructions. The EVM, however, can do these
operations much more efficiently than via opcodes. First, each SSTORE always
incurs a slot load in order to apply &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2200&#x2F;&quot;&gt;EIP-2200&lt;&#x2F;a&gt; gas calculation
rules. This load is essential if there is no paired SLOAD. Math libraries for
256-bit numbers can all easily be made sensitive to overflow and underflow, if
they are not already present. Conditional logic handling is also much faster in
the operation logic as most of the overhead would be operation parsing and stack
management when interpreted.&lt;&#x2F;p&gt;
&lt;p&gt;The net impact of the most relevant operations to the most expensive
evaluation (an ADD and LT operation, above the cost of a plain SSTORE) would be
4 gas, or 0.2% of the current cost of a SSTORE. Finally, database access costs
dominate the real cost of the operation. A 0.2% overhead may disappear in I&#x2F;O
stalls.&lt;&#x2F;p&gt;
&lt;p&gt;Keeping the cost the same makes implementations of gas charging vert simple.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;storage-slots-only&quot;&gt;Storage Slots Only&lt;&#x2F;h3&gt;
&lt;p&gt;This most important use case for this EIP asset balances and not general
concurrency controls. Hence, only enabling credit and debit operations on
storage slots (which persist across transactions). Parallel execution within a
transaction and more generic tools like locks and semaphores have very limited
utility within this scope. The lack of in-transaction parallel execution also
precludes the use of such primitives against transient storage (as defined in
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1153&#x2F;&quot;&gt;EIP-1153&lt;&#x2F;a&gt;).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;opcode-instead-of-system-contract&quot;&gt;Opcode Instead of System Contract&lt;&#x2F;h3&gt;
&lt;p&gt;One alternative, particularly viable for Layer 2 chains, would be to implement
SCREDIT and SDEBIT as system contracts. The primary objection to system
contracts for other operations is the gas cost overhead of constructing a call.
Because a SSTORE is always greater than the cost of a call it would be possible
to build in a discount. However, there is no such accommodation that can be made
for the code size needed to invoke such a call.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;These opcodes are not simple replacements for SLOAD-(ADD|SUB)-SSTORE sequence
because there is an overflow&#x2F;underflow check&lt;&#x2F;p&gt;
&lt;p&gt;There is no EVM functionality removed by this proposal.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test for overflow and non-overflow for the following values and values before
and after:&lt;&#x2F;p&gt;
&lt;p&gt;1, 2^8, 2^16, 2^32, 2^64, 2^128 2^255, 2^256-1.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;&#x2F;# TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The use of revert to handle over&#x2F;underflow represents a new halt condition that
auditors will need to consider when examining reentrancy concerns.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Dynamic Compliant Interop Security Token</title>
        <published>2023-09-14T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Abhinav</name><uri>https://github.com/abhinav-d3v</uri><email>abhinav@zoniqx.com</email>
	</author>
	
	<author>
		<name>Prithvish Baidya</name><uri>https://github.com/d4mr</uri><email>pbaidya@zoniqx.com</email>
	</author>
	
	<author>
		<name>Rajat Kumar</name><uri>https://github.com/rajatwasan</uri><email>rwasan@zoniqx.com</email>
	</author>
	
	<author>
		<name>Prasanth Kalangi</name><email>pkalangi@zoniqx.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7518/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7518-dynamic-compliant-interop-security-token-dycist/15822" />
        

        <id>https://wg-eips.ritovision.com/7518/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:7518"
            label="ERC-7518" />
        

        
        

        
        <summary type="html">Security token framework with semi-fungible partitions for dynamic regulatory compliance management and cross-chain interoperability</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7518/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal is a security token standard that extends &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt;  to provide a flexible framework for managing compliant real-asset security tokens. It introduces the concept of partitions, where each &lt;code&gt;tokenId&lt;&#x2F;code&gt; represents a distinct partition with its own set of rights and privileges. This makes it suitable for various use cases, particularly semi-fungible asset management. The standard also includes features like token locking, forced transfers for recovery, address freezing, payouts, and dynamic compliance management using off-chain vouchers.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The growing demand for tokenized real-world assets necessitates a token standard that can accommodate the unique requirements of security tokens. Existing standards, while powerful, do not fully address the need for flexible partitioning and comprehensive compliance management.&lt;&#x2F;p&gt;
&lt;p&gt;This standard builds upon &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; by introducing partitions, allowing for the creation of semi-fungible tokens representing fractional ownership, different share classes, or other distinct units within a single token contract. This flexibility is crucial for tokenizing complex real-world assets like real estate or funds.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore, it includes features essential for security tokens, such as token locking for vesting or holding periods, forced transfers for recovery in case of lost keys, address freezing for regulatory compliance, efficient payout mechanisms, and dynamic compliance management using off-chain vouchers.&lt;&#x2F;p&gt;
&lt;p&gt;By providing a standardized interface for these features, this proposal aims to facilitate the development of interoperable and compliant security token ecosystems.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;partition-based-architecture-benefits&quot;&gt;Partition-Based Architecture Benefits&lt;&#x2F;h3&gt;
&lt;p&gt;The partition paradigm offers significant flexibility and power in managing security tokens:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Dynamic Allocation : Partitions allow for dynamic allocation of tokens between different classes or categories. For example, in a real estate tokenization scenario, an issuer can initially allocate tokens to a Reg D partition for accredited U.S. investors and a &quot;Reg S&quot; partition for non-U.S. investors. As the offering progresses and demand shifts, the issuer can dynamically mint tokens into the appropriate partition based on the investor&#x27;s eligibility, ensuring optimal distribution and compliance.&lt;&#x2F;li&gt;
&lt;li&gt;Temporary Non-Fungibility : Partitions enable temporary non-fungibility of tokens. In some cases, securities may need to be treated as non-fungible for a certain period, such as tokens of the same underlying asset sold at different offerings. By assigning tokens to specific partitions, issuers can enforce these restrictions and maintain the necessary segregation between them, but merge them at a later point to prevent liquidity fragmentation. Merger occurs by creating a new joint partition, a deploying a merger contract where users can deposit old partitioned tokens to receive new joint partition token.&lt;&#x2F;li&gt;
&lt;li&gt;Granular Compliance : Each partition can have its own set of compliance rules and transfer restrictions. This allows for more granular control over token transfers based on the specific characteristics of each partition. For instance, a partition representing a particular share class may have different transfer restrictions or payout rights compared to other partitions.&lt;&#x2F;li&gt;
&lt;li&gt;Efficient Asset Management : Partitions streamline the management of complex asset structures. Instead of deploying separate contracts for each share class or asset category, issuers can manage multiple partitions within a single proposed contract, reducing deployment costs and simplifying overall asset management.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;real-world-use-cases&quot;&gt;Real World Use Cases&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7518&#x2F;.&#x2F;assets&#x2F;exampleUsecase.svg&quot; alt=&quot;image&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;use-case-1-tokenization-of-commercial-real-estate&quot;&gt;Use Case 1: Tokenization of Commercial Real Estate&lt;&#x2F;h4&gt;
&lt;p&gt;In this use case, a commercial real estate property with 100 floors is being tokenized using this proposal. Each floor is represented as a unique non-fungible token (NFT) partition, allowing for fractional ownership and separate management of individual floors.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Property Representation: The entire commercial property is tokenized using the proposed contract, with each floor being  assigned a unique tokenId representing an NFT partition.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Fractional Ownership: Each floor&#x27;s NFT partition can be divided into multiple fungible tokens, enabling fractional ownership. For instance, if a floor is divided into 100 tokens, multiple investors can own portions of that floor.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Dynamic Pricing: Since each floor is a separate partition, the pricing of tokens within a partition can be adjusted dynamically based on factors such as floor level, amenities, or market demand. This flexibility allows for accurate representation of the varying values of different floors.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Transfer of Ownership: The ownership of each floor&#x27;s NFT partition can be transferred seamlessly to token holders using the safeTransferFrom function. This enables the seamless transfer of ownership rights for specific floors.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Compliance Management: Different compliance rules and transfer restrictions can be applied to each partition (floor) based on regulatory requirements or issuer-defined rules. The canTransfer function can be used to enforce these rules before allowing transfers.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Payouts: The payout and batchPayout functions can be used to distribute rental income, dividends, or other payouts to token holders of specific floor partitions efficiently.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;By leveraging proposal, this use case demonstrates the ability to tokenize complex real estate assets while maintaining granular control over ownership, pricing, compliance, and payouts for individual units within the property.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;use-case-2-tokenization-of-securities-with-reg-s-and-reg-d-partitions&quot;&gt;Use Case 2: Tokenization of Securities with Reg S and Reg D Partitions&lt;&#x2F;h4&gt;
&lt;p&gt;In this use case, a company is tokenizing its securities and wants to comply with different regulations for U.S. accredited investors (Reg D) and non-U.S. investors (Reg S).&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Initial Partitions: The company deploys an proposed standard and creates two partitions: one for Reg D investors (accredited U.S. investors) and another for Reg S investors (non-U.S. investors).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Dynamic Allocation: As the offering progresses, the company can dynamically mint tokens into the appropriate partition based on investor eligibility. For example, if a U.S. accredited investor wants to participate, tokens can be minted in the Reg D partition, while tokens for non-U.S. investors are minted in the Reg S partition.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Compliance Management: Each partition can have its own set of compliance rules and transfer restrictions. The canTransfer function can be integrated with off-chain compliance services to verify the eligibility of a transfer based on the specific rules for each partition.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Temporary Non-Fungibility: During the initial offering period, tokens in the Reg D and Reg S partitions may need to be treated as non-fungible due to different regulatory requirements. However, after the holding period, the company can create a new joint partition and allow token holders to deposit their old partitioned tokens to receive the new joint partition tokens, merging the two classes.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Payouts: The payout and batchPayout functions can be used to distribute dividends, interest payments, or other payouts to token holders in each partition based on their respective rights and privileges.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;By utilizing the proposal, this use case demonstrates the ability to tokenize securities while maintaining compliance with different regulatory regimes, dynamically allocating tokens based on investor eligibility, and efficiently managing payouts and potential mergers of different share classes.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;use-case-3-force-transfer-for-aml-kyc-compliance-violations&quot;&gt;Use Case 3: Force Transfer for AML&#x2F;KYC&#x2F;Compliance Violations&lt;&#x2F;h4&gt;
&lt;p&gt;In the world of tokenized securities, maintaining compliance with regulatory requirements is of utmost importance. This proposal provides a robust mechanism to handle situations where an investor&#x27;s tokens need to be forcibly transferred due to violations of Anti-Money Laundering (AML), Know Your Customer (KYC), or other compliance-related regulations.&lt;&#x2F;p&gt;
&lt;p&gt;Let&#x27;s consider the scenario of Alice, an investor who holds tokens in the proposed token compliant security token contract. During the regular compliance checks conducted by the token issuer or a designated compliance service, it is discovered that Alice&#x27;s wallet address is associated with suspicious activities related to money laundering or other financial crimes.&lt;&#x2F;p&gt;
&lt;p&gt;In such a situation, the regulatory authorities or the contract administrators may decide to freeze Alice&#x27;s account and initiate a forced transfer of her tokens to a designated address controlled by the issuer or a recovery agent. The &lt;code&gt;forceTransfer&lt;&#x2F;code&gt; function in this proposal enables this process.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;interface&quot;&gt;Interface&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7518&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC1155&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC165&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TokensLocked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; releaseTime&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TokenUnlocked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TokensForceTransferred&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AddressFrozen&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AddressUnfrozen&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when the transferability of tokens with a specific ID is restricted.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransferRestricted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when the transferability restriction of tokens with a specific ID is removed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransferRestrictionRemoved&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PayoutDelivered&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieves the transferable balance of tokens for the specified account and ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; transferable balance of tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferableBalance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieves the locked balance of tokens for the specified account and ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; locked balance of tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; lockedBalanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Restricts the transferability of tokens with the specified ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; A&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; boolean value indicating whether the operation was successful.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; restrictTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Removes the transferability restriction of tokens with the specified ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; A&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; boolean value indicating whether the operation was successful.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; removeRestriction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfers `_value` amount of an `_id` from the `_from` address to the `_to` address specified (with safety call).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Caller must be approved to manage the tokens being transferred out of the `_from` account (see &amp;quot;Approval&amp;quot; section of the standard).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * After the above conditions are met, this function MUST check if `_to` is a smart contract (e.g. code size &amp;gt; 0). If so, it MUST call `onERC1155Received` on `_to` and act appropriately (see &amp;quot;Safe Transfer Rules&amp;quot; section of the standard).  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    Source address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      Target address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      ID of the token type&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   Transfer amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    Additional data with no specified format, MUST be sent unaltered in call to `onERC1155Received` on `_to`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Checks if a transfer is allowed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to transfer tokens from.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to transfer tokens to.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of tokens to transfer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Additional data related to the transfer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; status&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A boolean value indicating whether the transfer is allowed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; canTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; status&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; lock token till a particular block time.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the account for which tokens will be locked.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of tokens to be locked for the account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; releaseTime&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The timestamp indicating when the locked tokens can be released.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns true if the tokens are successfully locked, otherwise false.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; lockTokens&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; releaseTime&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Unlocks tokens that have crossed the release time for a specific account and id.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the account to unlock tokens for.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; unlockToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Force transfer in cases like recovery of tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to transfer tokens from.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to transfer tokens to.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of tokens to transfer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Additional data related to the transfer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; A&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; boolean value indicating whether the operation was successful.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; forceTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Freezes specified address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to be frozen.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Additional data related to the freeze operation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; A&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; boolean value indicating whether the operation was successful.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; freezeAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Unfreezes specified address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to be unfrozen.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Additional data related to the unfreeze operation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; A&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; boolean value indicating whether the operation was successful.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; unFreeze&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sends payout to single address with corresponding amounts.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address to send the payouts to.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; amount representing the payouts to be sent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; A&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; boolean indicating whether the batch payouts were successful.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  *&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; payout&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sends batch payouts to multiple addresses with corresponding amounts.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of addresses to send the payouts to.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of amounts representing the payouts to be sent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; A&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; boolean indicating whether the batch payouts were successful.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; batchPayout&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;methods-for-token&quot;&gt;Methods for token&lt;&#x2F;h3&gt;
&lt;h3 id=&quot;transferablebalance&quot;&gt;&lt;code&gt;transferableBalance&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Retrieves the transferable balance of tokens for the specified account and ID.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferableBalance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;MUST calculate and return the transferable balance of tokens for the specified account and ID (i.e. current) &lt;code&gt;balanceOf(account, id) - lockedBalanceOf(account, id)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;lockedbalanceof&quot;&gt;&lt;code&gt;lockedBalanceOf&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Retrieves the locked balance of tokens for the specified account and ID.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; lockedBalanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;MUST retrieve and return the locked balance of tokens for the specified &lt;code&gt;account&lt;&#x2F;code&gt; and &lt;code&gt;id&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;restricttransfer&quot;&gt;&lt;code&gt;restrictTransfer&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Restricts the transferability of tokens with the specified ID.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; restrictTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;MUST restrict the transferability of tokens with the specified &lt;code&gt;id&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;SHOULD emit &lt;code&gt;TransferRestricted&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;removerestriction&quot;&gt;&lt;code&gt;removeRestriction&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Removes the transferability restriction of tokens with the specified ID.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; removeRestriction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;MUST remove the transferability restriction of tokens with the specified &lt;code&gt;id&lt;&#x2F;code&gt;. MUST revert if &lt;code&gt;id&lt;&#x2F;code&gt; was not previously restricted.&lt;&#x2F;li&gt;
&lt;li&gt;SHOULD emit &lt;code&gt;TransferRestrictionRemoved&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;safetransferfrom&quot;&gt;&lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;MUST revert if &lt;code&gt;_to&lt;&#x2F;code&gt; is the zero address.&lt;&#x2F;li&gt;
&lt;li&gt;MUST revert if balance of holder for token &lt;code&gt;_id&lt;&#x2F;code&gt; is lower than the &lt;code&gt;_value&lt;&#x2F;code&gt; sent.&lt;&#x2F;li&gt;
&lt;li&gt;MUST revert on any other error.&lt;&#x2F;li&gt;
&lt;li&gt;MUST emit the &lt;code&gt;TransferSingle&lt;&#x2F;code&gt; event to reflect the balance change (see &quot;Safe Transfer Rules&quot; section of the standard).&lt;&#x2F;li&gt;
&lt;li&gt;MUST call &lt;code&gt;canTransfer&lt;&#x2F;code&gt; function to check if the transfer can proceed&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;cantransfer&quot;&gt;&lt;code&gt;canTransfer&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Determine transferring a specified amount of a token from one address to another.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; canTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; status&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;Accurately determine whether the transfer of tokens is allowed.&lt;&#x2F;li&gt;
&lt;li&gt;MUST validate &lt;code&gt;to&lt;&#x2F;code&gt; and &lt;code&gt;from&lt;&#x2F;code&gt; are not frozen address.&lt;&#x2F;li&gt;
&lt;li&gt;MUST validate &lt;code&gt;id&lt;&#x2F;code&gt; of the transfer should not be restricted&lt;&#x2F;li&gt;
&lt;li&gt;MUST check if &lt;code&gt;amount&lt;&#x2F;code&gt; is a transferable balance.&lt;&#x2F;li&gt;
&lt;li&gt;MAY call external contract to verify the transfer.&lt;&#x2F;li&gt;
&lt;li&gt;SHOULD NOT modify any state or perform any side effects.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;locktokens&quot;&gt;&lt;code&gt;lockTokens&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Locks a specified amount of tokens from an account for a specified duration.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; lockTokens&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; releaseTime&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;MUST enforce time-based restrictions on the transfer or use of tokens.&lt;&#x2F;li&gt;
&lt;li&gt;MUST revert if balance of holder is less than amount.&lt;&#x2F;li&gt;
&lt;li&gt;SHOULD use proper access control measures to ensure that only authorized entities can lock tokens.&lt;&#x2F;li&gt;
&lt;li&gt;MUST perform input validation prevent potential vulnerabilities and unauthorized locking of tokens.&lt;&#x2F;li&gt;
&lt;li&gt;SHOULD record release time securely and ensure that locked tokens are only released after the designated time has passed.&lt;&#x2F;li&gt;
&lt;li&gt;SHOULD emit &lt;code&gt;TokensLocked&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;unlocktoken&quot;&gt;&lt;code&gt;unlockToken&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Unlocks tokens that have crossed the release time for a specific account and id.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; unlockToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;MUST unlock the tokens for the specified &lt;code&gt;account&lt;&#x2F;code&gt; address and &lt;code&gt;id&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;MUST unlock all the token which has release time &amp;lt;= &lt;code&gt;block.timestamp&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;SHOULD revert if no token are unlocked to save gas.&lt;&#x2F;li&gt;
&lt;li&gt;SHOULD emit &lt;code&gt;TokenUnlocked&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;forcetransfer&quot;&gt;&lt;code&gt;forceTransfer&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Force transfer in cases like recovery of tokens&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; forceTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;MUST bypass normal transfer restrictions and authorization checks.&lt;&#x2F;li&gt;
&lt;li&gt;MUST revert if the &lt;code&gt;from&lt;&#x2F;code&gt; address is not Frozen.&lt;&#x2F;li&gt;
&lt;li&gt;MUST revert if &lt;code&gt;to&lt;&#x2F;code&gt; address is Frozen.&lt;&#x2F;li&gt;
&lt;li&gt;MUST ensure that only authorized entities have the capability to call this function.&lt;&#x2F;li&gt;
&lt;li&gt;Additional data related to the freeze operation.&lt;&#x2F;li&gt;
&lt;li&gt;SHOULD emit &lt;code&gt;TokensForceTransferred&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;freeze&quot;&gt;&lt;code&gt;freeze&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Freezes specified address. The Freeze function takes in the &lt;code&gt;account address&lt;&#x2F;code&gt; to be frozen and additional data, and returns a &lt;code&gt;boolean&lt;&#x2F;code&gt; value indicating whether the operation was successful.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; freezeAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;MUST prevent &lt;code&gt;account&lt;&#x2F;code&gt; to transfer and payout.&lt;&#x2F;li&gt;
&lt;li&gt;SHOULD implement appropriate access control measures to ensure that only authorized addresses can be unfrozen.&lt;&#x2F;li&gt;
&lt;li&gt;SHOULD emit &lt;code&gt;AddressFrozen&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;unfreeze&quot;&gt;&lt;code&gt;unFreeze&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The Unfreeze function takes in the &lt;code&gt;account address&lt;&#x2F;code&gt; to be unfrozen and additional data, and returns a &lt;code&gt;boolean&lt;&#x2F;code&gt; value indicating whether the operation was successful.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; unFreeze&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;MUST unfreeze the specified &lt;code&gt;account&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;SHOULD implement appropriate access control measures to ensure that only authorized addresses can be unfrozen.&lt;&#x2F;li&gt;
&lt;li&gt;SHOULD emit &lt;code&gt;AddressUnfrozen&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;payout&quot;&gt;&lt;code&gt;payout&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Send payouts to single address, receiver will be receiving a specific amount of tokens.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; payout&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;MUST revert if &lt;code&gt;to&lt;&#x2F;code&gt; address is frozen address.&lt;&#x2F;li&gt;
&lt;li&gt;SHOULD have sufficient balance to transfer token from issuer address.&lt;&#x2F;li&gt;
&lt;li&gt;SHOULD emit &lt;code&gt;PayoutDelivered&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;batchpayout&quot;&gt;&lt;code&gt;batchPayout&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Send payouts to multiple addresses at once, with each address receiving a specific amount of tokens. It can be used for various purposes such as distributing rewards, dividends, or interest payment.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; batchPayout&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;MUST revert if &lt;code&gt;to&lt;&#x2F;code&gt; address is frozen address.&lt;&#x2F;li&gt;
&lt;li&gt;SHOULD have sufficient balance to transfer token from issuer address.&lt;&#x2F;li&gt;
&lt;li&gt;SHOULD emit &lt;code&gt;PayoutDelivered&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;interoperability&quot;&gt;Interoperability&lt;&#x2F;h3&gt;
&lt;p&gt;This proposal facilitates interoperability with non-fungible and fungible tokens through a token wrapping method. The process involves two key components: the token contracts representing the original and the proposed token contract for the wrapped version. Users seeking to wrap their tokens interact with the wrapping contract, which securely locks their original tokens and mints an equivalent amount of the proposed tokens to their address. Conversely, unwrapping is achieved by calling the contract&#x27;s withdraw function, resulting in the burning of the proposed tokens and the release of the corresponding original tokens. Events are emitted for transparency, and robust security measures are implemented to safeguard user assets and address any potential vulnerabilities in the contract code. With this design, this proposal ensures the seamless conversion and compatibility with fungible and non-fungible tokens, promoting greater utility and usability across the Ethereum ecosystem.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;interface-for-interoperability&quot;&gt;Interface for Interoperability&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC1155Wrapper&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7518&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a new wrapped token address is added to the set.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; wrappedTokenAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the wrapped token that was added.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; WrappedTokenAddressSet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; wrappedTokenAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when tokens are wrapped.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-1155 token ID of the wrapped tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of tokens that were wrapped.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TokensWrapped&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when tokens are unwrapped.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; wrappedTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Is the ERC-1155 token ID of the wrapped tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of tokens that were unwrapped.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TokensUnwrapped&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; wrappedTokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sets the wrapped token address and logic for deciding partitions.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; wrappedTokenAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the wrapped token contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; A&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; boolean value indicating whether the operation was successful.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setWrappedToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Wraps the specified amount of tokens by depositing the original tokens and receiving new standard tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of tokens to wrap.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Additional data for partition.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; A&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; boolean value indicating whether the operation was successful.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; wrapToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Wraps a specified amount of tokens from a given partition into the main balance.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function allows users to convert tokens from a specific partition back to the main balance,making them fungible with tokens from other partitions.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; partitionId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The unique identifier of the partition from which tokens will be wrapped.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The unique identifier of the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of tokens to be wrapped from the specified partition.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Additional data that may be used to handle the wrap process (optional).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; success&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A boolean indicating whether the wrapping operation was successful or not.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; wrapTokenFromPartition&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; partitionId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Unwraps the specified amount of wrapped tokens by depositing the current tokens and receiving the original tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; wrappedTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; internal partition id.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of wrapped tokens to unwrap.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Additional data for partition.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; A&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; boolean value indicating whether the operation was successful.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; unwrapToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; wrappedTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieves the balance of wrapped tokens for the specified account and ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Additional data for partition.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; balance of wrapped tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; wrappedBalanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieves the balance of original tokens for the specified account and ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Additional data for partition.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; balance of original tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; originalBalanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;methods-for-interoperability&quot;&gt;Methods for Interoperability&lt;&#x2F;h3&gt;
&lt;h3 id=&quot;setwrappedtokenaddress&quot;&gt;&lt;code&gt;setWrappedTokenAddress&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setWrappedTokenAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;token&lt;&#x2F;code&gt; address could be any security token standard i.e &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3643&#x2F;&quot;&gt;ERC-3643&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;wraptoken&quot;&gt;&lt;code&gt;wrapToken&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; wrapToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;MUST lock token in an on-chain vault type smart contract.&lt;&#x2F;li&gt;
&lt;li&gt;MUST mint an equivalent amount of the proposed token.&lt;&#x2F;li&gt;
&lt;li&gt;MUST verify mapping of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt;  &lt;code&gt;id&lt;&#x2F;code&gt; with the corresponding &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;  compatible security token.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;wraptokenfrompartition&quot;&gt;&lt;code&gt;wrapTokenFromPartition&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; wrapTokenFromPartition&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; partitionId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;MUST lock the token amount from source standard and mint an equivalent amount of the proposed token.&lt;&#x2F;li&gt;
&lt;li&gt;SHOULD lock token in smart contract to achieve one to one mapping with the investor.&lt;&#x2F;li&gt;
&lt;li&gt;MUST verify mapping of &lt;code&gt;id&lt;&#x2F;code&gt; with the corresponding partially fungible security token &lt;code&gt;partitionId&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;unwraptoken&quot;&gt;&lt;code&gt;unwrapToken&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; unwrapToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; wrappedTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;MUST burn the proposed token and release the original token.&lt;&#x2F;li&gt;
&lt;li&gt;MUST verify that the token is not subject to any of the proposal&#x27;s locking functionality.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;partition-management&quot;&gt;Partition Management&lt;&#x2F;h3&gt;
&lt;p&gt;The proposal leverages the &lt;code&gt;tokenId&lt;&#x2F;code&gt; feature of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; to represent distinct partitions within a token contract. Each &lt;code&gt;tokenId&lt;&#x2F;code&gt; corresponds to a unique partition with its own set of rights, privileges, and compliance rules. This enables the creation of semi-fungible tokens representing fractional ownership, different share classes, or other granular units.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;partition-as-the-fundamental-unit&quot;&gt;Partition as the Fundamental Unit&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Each partition is created by minting tokens under a unique &lt;code&gt;tokenId&lt;&#x2F;code&gt; value.&lt;&#x2F;li&gt;
&lt;li&gt;All tokens with the same &lt;code&gt;tokenId&lt;&#x2F;code&gt; are &lt;strong&gt;fungible within that partition&lt;&#x2F;strong&gt; but &lt;strong&gt;non-fungible across partitions&lt;&#x2F;strong&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The issuer can represent different classes, jurisdictions, or series by minting tokens under different &lt;code&gt;tokenId&lt;&#x2F;code&gt;s.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;compliance-management&quot;&gt;Compliance Management&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7518&#x2F;.&#x2F;assets&#x2F;sequentialDiagram.svg&quot; alt=&quot;image&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;This standard includes functions for managing token transfers in accordance with regulatory requirements and issuer-defined rules. The &lt;code&gt;canTransfer&lt;&#x2F;code&gt; function checks whether a transfer is allowed based on factors such as token restrictions, frozen addresses, transferable balances, and token locking.&lt;&#x2F;p&gt;
&lt;p&gt;To facilitate dynamic compliance management, the standard uses a voucher-based pattern. An authorized entity (e.g., the issuer or a designated compliance service) generates a signed off-chain voucher that may encapsulate results from on-chain rule evaluation, oracle responses, or other checks. The &lt;code&gt;canTransfer&lt;&#x2F;code&gt; verifies vouchers signature, expiry, and binding of &lt;code&gt;from&lt;&#x2F;code&gt;, &lt;code&gt;to&lt;&#x2F;code&gt;, &lt;code&gt;id&lt;&#x2F;code&gt;, and &lt;code&gt;amount&lt;&#x2F;code&gt; together with contract state to determine the eligibility of a transfer.&lt;&#x2F;p&gt;
&lt;p&gt;Here&#x27;s an example of how off-chain vouchers can be used with the proposal:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The token issuer defines a set of compliance rules and requirements for token transfers.&lt;&#x2F;li&gt;
&lt;li&gt;When a user initiates a transfer, they submit a request to a designated compliance service with the necessary details (sender, recipient, amount, etc.).&lt;&#x2F;li&gt;
&lt;li&gt;The compliance service evaluates the transfer request against the predefined rules and requirements, considering factors such as investor eligibility, transfer restrictions, and regulatory compliance.&lt;&#x2F;li&gt;
&lt;li&gt;If the transfer is deemed compliant, the compliance service generates a signed voucher containing the relevant details and returns it to the user.&lt;&#x2F;li&gt;
&lt;li&gt;The user includes the signed voucher as an additional parameter when calling the &lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt; function on the proposed contract.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;canTransfer&lt;&#x2F;code&gt; function verifies the authenticity and validity of the voucher by checking the signature and ensuring that the voucher details match the transfer parameters.&lt;&#x2F;li&gt;
&lt;li&gt;If the voucher is valid and the transfer meets all other requirements, the transfer is allowed to proceed.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Implementations MAY accept a cryptographically signed compliance voucher in the &lt;code&gt;data&lt;&#x2F;code&gt; argument of &lt;code&gt;canTransfer&lt;&#x2F;code&gt;, and state changing transfer functions defined in this standard, for example &lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt;. Voucher schema and policy content are application defined. Implementations MAY combine on chain rules, oracle responses, and off chain verification for the voucher.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;token-recovery&quot;&gt;Token Recovery&lt;&#x2F;h3&gt;
&lt;p&gt;In case of lost or compromised wallets, the proposal includes a &lt;code&gt;forceTransfer&lt;&#x2F;code&gt; function that allows authorized entities (e.g., the issuer or a designated recovery agent) to transfer tokens from one address to another. This function bypasses the usual transfer restrictions and can be used as a recovery mechanism.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;payout-management&quot;&gt;Payout Management&lt;&#x2F;h3&gt;
&lt;p&gt;Provides functions for efficient payout distribution to token holders. The &lt;code&gt;payout&lt;&#x2F;code&gt; function allows sending payouts to a single address, while &lt;code&gt;batchPayout&lt;&#x2F;code&gt; enables sending payouts to multiple addresses in a single transaction. These functions streamline the process of distributing dividends, interest, or other payments to token holders.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;enhancing-compliance-management&quot;&gt;Enhancing Compliance Management&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;canTransfer&lt;&#x2F;code&gt; function facilitates compliance checks during token transfers, offering adaptability through diverse implementation methods such as on-chain storage, oracle utilization, or any off-chain methodologies. This versatility ensures seamless integration with existing compliance frameworks, particularly in enforcing regulatory standards like KYC&#x2F;AML. Additionally, functionalities like &lt;code&gt;freezeAddress&lt;&#x2F;code&gt;, &lt;code&gt;restrictTransfer&lt;&#x2F;code&gt;, &lt;code&gt;lockToken&lt;&#x2F;code&gt; and &lt;code&gt;forceTransfer&lt;&#x2F;code&gt; empower entities to regulate token movements based on specified conditions or regulatory requirements. Complementing these, the &lt;code&gt;unlockToken&lt;&#x2F;code&gt; function enhances transparency and accountability by facilitating the release of tokens post-compliance actions.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;fractionalization&quot;&gt;Fractionalization&lt;&#x2F;h3&gt;
&lt;p&gt;Fractionalization in this standard is realized natively through &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; balances. For a given partition identified by tokenId, each unit of amount represents a fungible fraction of that partition’s underlying security. Issuers mint and burn units to manage supply. Transfers use &lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt; and &lt;code&gt;safeBatchTransferFrom&lt;&#x2F;code&gt;, and must pass canTransfer. Locks and freezes reduce the transferable portion of balances, and &lt;code&gt;forceTransfer&lt;&#x2F;code&gt; operates proportionally on units. Partitions can be merged by issuing a new tokenId and allowing holders to deposit old partitions for one-to-one or proportional conversion, and can be split by minting new tokenIds with defined conversion rules. All compliance rules and restrictions apply identically to every fractional unit in a partition.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;interoperability-with-other-standard&quot;&gt;Interoperability with other standard&lt;&#x2F;h3&gt;
&lt;p&gt;This standard builds directly on &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt;, which already models fractional supply, batching, and balance-based accounting with broad ecosystem support. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3525&#x2F;&quot;&gt;ERC-3525&lt;&#x2F;a&gt; was carefully evaluated but intentionally not adopted as a base. Its slot-and-value abstraction overlaps almost exactly with the partition and &lt;code&gt;amount&lt;&#x2F;code&gt; semantics defined here, yet inherits &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;’s single-token overhead and per-position statefulness, which are inefficient for large scale issuance and compliance checks. Implementers who require slot-style compatibility may optionally expose &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3525&#x2F;&quot;&gt;ERC-3525&lt;&#x2F;a&gt; through &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; by mapping &lt;code&gt;slot&lt;&#x2F;code&gt; to partition and &lt;code&gt;value&lt;&#x2F;code&gt; to &lt;code&gt;amount&lt;&#x2F;code&gt;. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6909&#x2F;&quot;&gt;ERC-6909&lt;&#x2F;a&gt;, while a minimal multi-token variant, omits partition metadata and compliance hooks and is therefore unsuitable for regulated assets. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7518&#x2F;&quot;&gt;ERC-7518&lt;&#x2F;a&gt; extends this lineage by representing partitions as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; &lt;code&gt;tokenId&lt;&#x2F;code&gt;s, enabling dynamic minting, merging, and voucher based dynamic compliance that can evolve without redeployment. Overall, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7518&#x2F;&quot;&gt;ERC-7518&lt;&#x2F;a&gt; uses &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; as its canonical substrate because it balances composability, efficiency, and regulatory flexibility, turning fractionalization into a compliance-preserving primitive rather than an auxiliary layer.&lt;&#x2F;p&gt;
&lt;p&gt;The functions &lt;code&gt;wrapToken&lt;&#x2F;code&gt; and &lt;code&gt;wrapTokenFromPartition&lt;&#x2F;code&gt; are essential for simplifying conversions within the token system. &lt;code&gt;wrapToken&lt;&#x2F;code&gt; is specifically designed for wrapping ERC-20-like tokens to this protocol, on the other hand, &lt;code&gt;wrapTokenFromPartition&lt;&#x2F;code&gt; is used when we want to convert tokens from non-fungible tokens or any multi-standard token into proposed protocol. It allows for more specialized conversions, ensuring tokens from different standards can work together smoothly.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;unwrapToken&lt;&#x2F;code&gt; function is used to reverse the process of wrapping tokens. When tokens are wrapped, they&#x27;re usually locked or held in a special way to ensure they&#x27;re used correctly. users can unlock or release these tokens, returning them to their original standard, essentially, frees up tokens that were previously locked, giving users more control over their assets in the ecosystem.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;payment-distribution&quot;&gt;Payment distribution&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;payout&lt;&#x2F;code&gt; function enables direct payments to individual token holders for one-off or event-triggered distributions, facilitating targeted disbursements. Meanwhile, the &lt;code&gt;batchPayout&lt;&#x2F;code&gt; function processes multiple payments in a single transaction, optimizing efficiency for larger-scale or regular payouts on the blockchain&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The proposal is fully compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; , and any &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; compliant wallet or marketplace can interact with the proposal&#x27;s tokens. The additional functions introduced by this proposal do not conflict with the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; interface, ensuring seamless integration with existing ecosystem tools and infrastructure.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;Access Control: The proposal includes functions that can significantly impact token transfers and balances, such as &lt;code&gt;forceTransfer&lt;&#x2F;code&gt;, &lt;code&gt;freezeAddress&lt;&#x2F;code&gt;, and &lt;code&gt;lockTokens&lt;&#x2F;code&gt;. It is crucial to implement proper access control mechanisms, such as role-based permissions, to ensure that only authorized entities can execute these functions.&lt;&#x2F;li&gt;
&lt;li&gt;Parameter Validation: Functions like &lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt;, &lt;code&gt;lockTokens&lt;&#x2F;code&gt;, and &lt;code&gt;forceTransfer&lt;&#x2F;code&gt; should validate input parameters to prevent unauthorized or unintended actions. This includes checking for valid addresses, sufficient balances, and appropriate permissions.&lt;&#x2F;li&gt;
&lt;li&gt;Reentrancy Protection: The contract should implement reentrancy guards to prevent potential vulnerabilities arising from external calls, especially in functions that transfer tokens or update balances.&lt;&#x2F;li&gt;
&lt;li&gt;Overflow&#x2F;Underflow Protection: The contract should use safe math libraries or built-in overflow protection to prevent integer overflow and underflow vulnerabilities.&lt;&#x2F;li&gt;
&lt;li&gt;Payout Security: The &lt;code&gt;payout&lt;&#x2F;code&gt; and &lt;code&gt;batchPayout&lt;&#x2F;code&gt; functions should ensure that only authorized entities can initiate payouts and that the total payout amount does not exceed the available balance. Proper access control and input validation are essential to prevent unauthorized or fraudulent payouts.&lt;&#x2F;li&gt;
&lt;li&gt;Off-Chain Voucher Security: When using off-chain vouchers for dynamic compliance management, it is crucial to ensure the security and integrity of the voucher generation process. The compliance service responsible for generating vouchers should have robust security measures in place to prevent unauthorized voucher creation or tampering. Additionally, the proposed contract should thoroughly validate the authenticity and validity of vouchers before allowing transfers to proceed.&lt;&#x2F;li&gt;
&lt;li&gt;Operational considerations for unfreezing: Unfreezing restores an account&#x27;s ability to transfer and receive payouts. Implementers and operators should evaluate applicable regulatory and contractual obligations before unfreezing an address.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Content Consent for AI&#x2F;ML Data Mining</title>
        <published>2023-09-12T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Bofu Chen</name><uri>https://github.com/bafu</uri>
	</author>
	
	<author>
		<name>Tammy Yang</name><uri>https://github.com/tammyyang</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7517/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7517-content-consent-for-ai-ml-data-mining/15755" />
        

        <id>https://wg-eips.ritovision.com/7517/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7517"
            label="ERC-7517" />
        

        
        

        
        <summary type="html">A proposal adding &quot;dataMiningPreference&quot; in the metadata to preserve the digital content&#x27;s original intent and respect creator&#x27;s rights.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7517/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes a standardized approach to declaring mining preferences for digital media content on the EVM-compatible blockchains. This extends digital media metadata standards like &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7053&#x2F;&quot;&gt;ERC-7053&lt;&#x2F;a&gt; and NFT metadata standards like &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt;, allowing asset creators to specify how their assets are used in data mining, AI training, and machine learning workflows.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;As digital assets become increasingly utilized in AI and machine learning workflows, it is critical that the rights and preferences of asset creators and license owners are respected, and the AI&#x2F;ML creators can check and collect data easily and safely. Similar to robot.txt to websites, content owners and creators are looking for more direct control over how their creativities are used.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal standardizes a method of declaring these preferences. Adding &lt;code&gt;dataMiningPreference&lt;&#x2F;code&gt; in the content metadata allows creators to include the information about whether the asset may be used as part of a data mining or AI&#x2F;ML training workflow. This ensures the original intent of the content is maintained.&lt;&#x2F;p&gt;
&lt;p&gt;For AI-focused applications, this information serves as a guideline, facilitating the ethical and efficient use of content while respecting the creator&#x27;s rights and building a sustainable data mining and AI&#x2F;ML environment.&lt;&#x2F;p&gt;
&lt;p&gt;The introduction of the &lt;code&gt;dataMiningPreference&lt;&#x2F;code&gt; property in digital asset metadata covers the considerations including:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Accessibility: A clear and easily accessible method with human-readibility and machine-readibility for digital asset creators and license owners to express their preferences for how their assets are used in data mining and AI&#x2F;ML training workflows. The AI&#x2F;ML creators can check and collect data systematically.&lt;&#x2F;li&gt;
&lt;li&gt;Adoption: As Coalition for Content Provenance and Authenticity (C2PA) already outlines guidelines for indicating whether an asset may be used in data mining or AI&#x2F;ML training, it&#x27;s crucial that onchain metadata aligns with these standards. This ensures compatibility between in-media metadata and onchain records.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP introduces a new property, &lt;code&gt;dataMiningPreference&lt;&#x2F;code&gt;, to the metadata standards which signify the choices made by the asset creators or license owners regarding the suitability of their asset for inclusion in data mining or AI&#x2F;ML training workflows. &lt;code&gt;dataMiningPreference&lt;&#x2F;code&gt; is an object that can include one or more specific conditions.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;dataMining&lt;&#x2F;code&gt;: Allow the asset to be used in data mining for determining &quot;patterns, trends, and correlations&quot;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;aiInference&lt;&#x2F;code&gt;: Allow the asset to be used as input to a trained AI&#x2F;ML model for inferring a result.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;aiGenerativeTraining&lt;&#x2F;code&gt;: Allow the asset to be used as training data for an AI&#x2F;ML model that could produce derivative assets.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;aiGenerativeTrainingWithAuthorship&lt;&#x2F;code&gt;: Same as &lt;code&gt;aiGenerativeTraining&lt;&#x2F;code&gt;, but requires that the authorship is disclosed.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;aiTraining&lt;&#x2F;code&gt;: Allow the asset to be used as training data for generative and non-generative AI&#x2F;ML models.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;aiTrainingWithAuthorship&lt;&#x2F;code&gt;: Same as &lt;code&gt;aiTraining&lt;&#x2F;code&gt;, but requires that the authorship is disclosed.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Each category is defined by a set of permissions that can take on one of three values: &lt;code&gt;allowed&lt;&#x2F;code&gt;, &lt;code&gt;notAllowed&lt;&#x2F;code&gt;, and &lt;code&gt;constraint&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;allowed&lt;&#x2F;code&gt; indicates that the asset can be freely used for the specific purpose without any limitations or restrictions.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;notAllowed&lt;&#x2F;code&gt; means that the use of the asset for that particular purpose is strictly prohibited.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;constrained&lt;&#x2F;code&gt; suggests that the use of the asset is permitted, but with certain conditions or restrictions that must be adhered to.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;For instance, the &lt;code&gt;aiInference&lt;&#x2F;code&gt; property indicates whether the asset can be used as input for an AI&#x2F;ML model to derive results. If set to &lt;code&gt;allowed&lt;&#x2F;code&gt;, the asset can be utilized without restrictions. If &lt;code&gt;notAllowed&lt;&#x2F;code&gt;, the asset is prohibited from AI inference.&lt;&#x2F;p&gt;
&lt;p&gt;If marked as &lt;code&gt;constrained&lt;&#x2F;code&gt;, certain conditions, detailed in the license document, must be met. When &lt;code&gt;constraint&lt;&#x2F;code&gt; is selected, parties intending to use the media files should respect the rules specified in the license. To avoid discrepancies with the content license, the specifics of these constraints are not detailed within the schema, but the license reference should be included in the content metadata.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;schema&quot;&gt;Schema&lt;&#x2F;h3&gt;
&lt;p&gt;The JSON schema of &lt;code&gt;dataMiningPreference&lt;&#x2F;code&gt; is defined as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;dataMining&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;allowed&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;notAllowed&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;constrained&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;aiInference&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;allowed&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;notAllowed&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;constrained&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;aiTraining&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;allowed&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;notAllowed&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;constrained&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;aiGenerativeTraining&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;allowed&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;notAllowed&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;constrained&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;aiTrainingWithAuthorship&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;allowed&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;notAllowed&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;constrained&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;aiGenerativeTrainingWithAuthorship&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;allowed&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;notAllowed&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;constrained&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;additionalProperties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;examples&quot;&gt;Examples&lt;&#x2F;h3&gt;
&lt;p&gt;The mining preference example for not allowing generative AI training:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;dataMiningPreference&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;dataMining&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;allowed&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;aiInference&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;allowed&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;aiTrainingWithAuthorship&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;allowed&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;aiGenerativeTraining&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;notAllowed&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The mining preference example for only allowing for AI inference:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;dataMiningPreference&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;aiInference&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;allowed&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;aiTraining&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;notAllowed&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;aiGenerativeTraining&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;notAllowed&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The mining preference example for allowing generative AI training if mentioning authorship and follow license:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;dataMiningPreference&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;dataMining&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;allowed&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;aiInference&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;allowed&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;aiTrainingWithAuthorship&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;allowed&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;aiGenerativeTrainingWithAuthorship&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;constrained&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;example-usage-with-erc-721&quot;&gt;Example Usage with ERC-721&lt;&#x2F;h3&gt;
&lt;p&gt;The following is an example of using the &lt;code&gt;dataMiningPreference&lt;&#x2F;code&gt; property in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; NFTs.&lt;&#x2F;p&gt;
&lt;p&gt;We can put the &lt;code&gt;dataMiningPreference&lt;&#x2F;code&gt; field in the NFT metadata below. The &lt;code&gt;license&lt;&#x2F;code&gt; field is only an example for specifying how to use a constrained condition, and is not defined in this proposal. A NFT has its way to describe its license.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The Starry Night, revision&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Recreation of the oil-on-canvas painting by the Dutch Post-Impressionist painter Vincent van Gogh.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;image&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ipfs:&#x2F;&#x2F;bafyaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;dataMiningPreference&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;dataMining&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;allowed&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;aiInference&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;allowed&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;aiTrainingWithAuthorship&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;allowed&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;aiGenerativeTrainingWithAuthorship&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;constrained&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;license&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;CC-BY-4.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;document&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;creativecommons.org&#x2F;licenses&#x2F;by&#x2F;4.0&#x2F;legalcode&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;example-usage-with-erc-7053&quot;&gt;Example Usage with ERC-7053&lt;&#x2F;h3&gt;
&lt;p&gt;The example using the &lt;code&gt;dataMiningPreference&lt;&#x2F;code&gt; property in onchain media provenance registration defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7053&#x2F;&quot;&gt;ERC-7053&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Assuming the Decentralized Content Identifier (CID) is &lt;code&gt;bafyaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&lt;&#x2F;code&gt;. We can put the &lt;code&gt;dataMiningPreference&lt;&#x2F;code&gt; field in the Commit data directly. After following up the CID, got the Commit data:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;dataMiningPreference&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;dataMining&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;allowed&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;aiInference&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;allowed&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;aiTrainingWithAuthorship&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;allowed&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;aiGenerativeTrainingWithAuthorship&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;constrained&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;license&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;CC-BY-4.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;document&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;creativecommons.org&#x2F;licenses&#x2F;by&#x2F;4.0&#x2F;legalcode&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;We can also put the &lt;code&gt;dataMiningPreference&lt;&#x2F;code&gt; field in any custom metadata whose CID is linked in the Commit data. The &lt;code&gt;assetTreeCid&lt;&#x2F;code&gt; field is an example for specifying how to link a custom metadata. After following up the CID, got the Commit data:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; custom metadata CID &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;assetTreeCid&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bafybbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Following up the &lt;code&gt;assetTreeCid&lt;&#x2F;code&gt; which describes the custom properties of the registered asset:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;dataMiningPreference&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;dataMining&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;allowed&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;aiInference&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;allowed&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;aiTrainingWithAuthorship&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;allowed&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;aiGenerativeTrainingWithAuthorship&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;constrained&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;license&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;CC-BY-4.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;document&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;creativecommons.org&#x2F;licenses&#x2F;by&#x2F;4.0&#x2F;legalcode&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The technical decisions behind this EIP have been carefully considered to address specific challenges and requirements in the digital asset landscape. Here are the clarifications for the rationale behind:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Adoption of JSON schema: The use of JSON facilitates ease of integration and interaction, both manually and programmatically, with the metadata.&lt;&#x2F;li&gt;
&lt;li&gt;Detailed control with training types: The different categories like &lt;code&gt;aiGenerativeTraining&lt;&#x2F;code&gt;, &lt;code&gt;aiTraining&lt;&#x2F;code&gt;, and &lt;code&gt;aiInference&lt;&#x2F;code&gt; let creators control in detail, considering both ethics and computer resource needs.&lt;&#x2F;li&gt;
&lt;li&gt;Authorship options included: Options like &lt;code&gt;aiGenerativeTrainingWithAuthorship&lt;&#x2F;code&gt; and &lt;code&gt;aiTrainingWithAuthorship&lt;&#x2F;code&gt; make sure creators get credit, addressing ethical and legal issues.&lt;&#x2F;li&gt;
&lt;li&gt;Introduction of &lt;code&gt;constrained&lt;&#x2F;code&gt; category: The introduction of &lt;code&gt;constrained&lt;&#x2F;code&gt; category serves as an intermediary between &lt;code&gt;allowed&lt;&#x2F;code&gt; and &lt;code&gt;notAllowed&lt;&#x2F;code&gt;. It signals that additional permissions or clarifications may be required, defaulting to &lt;code&gt;notAllowed&lt;&#x2F;code&gt; in the absence of such information.&lt;&#x2F;li&gt;
&lt;li&gt;C2PA alignment for interoperability: The standard aligns with C2PA guidelines, ensuring seamless mapping between onchain metadata and existing offchain standards.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;When adopting this EIP, it’s essential to address several security aspects to ensure the safety and integrity of adoption:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Data Integrity: Since this EIP facilitates the declaration of mining preferences for digital media assets, the integrity of the data should be assured. Any tampering with the &lt;code&gt;dataMiningPreference&lt;&#x2F;code&gt; property can lead to unauthorized data mining usage. Blockchain&#x27;s immutability will play a significant role here, but additional security layers, such as cryptographic signatures, can further ensure data integrity.&lt;&#x2F;li&gt;
&lt;li&gt;Verifiable Authenticity: Ensure that the individual or entity setting the &lt;code&gt;dataMiningPreference&lt;&#x2F;code&gt; is the legitimate owner or authorized representative of the digital asset. Unauthorized changes to preferences can lead to data misuse. Cross-checking asset provenance and ownership becomes paramount. Services or smart contracts should be implemented to verify the authenticity of assets before trusting the &lt;code&gt;dataMiningPreference&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Data Privacy: Ensure that the process of recording preferences doesn&#x27;t inadvertently expose sensitive information about the asset creators or owners. Although the Ethereum blockchain is public, careful consideration is required to ensure no unintended data leakage.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>BLOBBASEFEE instruction</title>
        <published>2023-09-11T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Carl Beekhuizen</name><uri>https://github.com/carlbeek</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7516/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7516-blobbasefee-opcode/15761" />
        

        <id>https://wg-eips.ritovision.com/7516/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7516"
            label="EIP-7516" />
        

        
        

        
        <summary type="html">Instruction that returns the current data-blob base-fee</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7516/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Add a &lt;code&gt;BLOBBASEFEE (0x4a)&lt;&#x2F;code&gt; instruction that returns the value of the blob base-fee of the current block it is executing in. It is the identical to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3198&#x2F;&quot;&gt;EIP-3198&lt;&#x2F;a&gt; (&lt;code&gt;BASEFEE&lt;&#x2F;code&gt; opcode) except that it returns the blob base-fee as per &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The intended use case would be for contracts to get the value of the blob base-fee. This feature enables blob-data users to programmatically account for the blob gas price, eg:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Allow rollup contracts to trustlessly account for blob data usage costs.&lt;&#x2F;li&gt;
&lt;li&gt;Blob gas futures can be implemented based on it which allows for blob users to smooth out data blob costs.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Add a &lt;code&gt;BLOBBASEFEE&lt;&#x2F;code&gt; instruction with opcode &lt;code&gt;0x4a&lt;&#x2F;code&gt;, with gas cost &lt;code&gt;2&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Op&lt;&#x2F;th&gt;&lt;th&gt;Input&lt;&#x2F;th&gt;&lt;th&gt;Output&lt;&#x2F;th&gt;&lt;th&gt;Cost&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;0x4a&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;&lt;code&gt;BLOBBASEFEE&lt;&#x2F;code&gt; returns the result of the &lt;code&gt;get_blob_gasprice(header) -&amp;gt; int&lt;&#x2F;code&gt; function as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;#gas-accounting&quot;&gt;EIP-4844 §Gas accounting&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;gas-cost&quot;&gt;Gas cost&lt;&#x2F;h3&gt;
&lt;p&gt;The value of the blob base-fee is needed to process data-blob transactions. That means its value is already available before running the EVM code.
The instruction does not add extra complexity and additional read&#x2F;write operations, hence the choice of &lt;code&gt;2&lt;&#x2F;code&gt; gas cost. This is also identical to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3198&#x2F;&quot;&gt;EIP-3198&lt;&#x2F;a&gt; (&lt;code&gt;BASEFEE&lt;&#x2F;code&gt; opcode)&#x27;s cost as it just makes available data that is in the header.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;There are no known backward compatibility issues with this instruction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;nominal-case&quot;&gt;Nominal Case&lt;&#x2F;h3&gt;
&lt;p&gt;Assume calling &lt;code&gt;get_blob_gasprice(header)&lt;&#x2F;code&gt; (as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;#gas-accounting&quot;&gt;EIP-4844 §Gas accounting&lt;&#x2F;a&gt;) on the current block&#x27;s header returns &lt;code&gt;7 wei&lt;&#x2F;code&gt;:
&lt;code&gt;BLOBBASEFEE&lt;&#x2F;code&gt; should push the value &lt;code&gt;7&lt;&#x2F;code&gt; (left padded byte32) to the stack.&lt;&#x2F;p&gt;
&lt;p&gt;Bytecode: &lt;code&gt;0x4900&lt;&#x2F;code&gt; (&lt;code&gt;BLOBBASEFEE, STOP&lt;&#x2F;code&gt;)&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Pc&lt;&#x2F;th&gt;&lt;th&gt;Op&lt;&#x2F;th&gt;&lt;th&gt;Cost&lt;&#x2F;th&gt;&lt;th&gt;Stack&lt;&#x2F;th&gt;&lt;th&gt;RStack&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;BLOBBASEFEE&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;STOP&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;[7]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Output: 0x
Consumed gas: &lt;code&gt;2&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;comprehensive-test-suite&quot;&gt;Comprehensive Test Suite&lt;&#x2F;h3&gt;
&lt;p&gt;A complete suite of tests can be found &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;execution-spec-tests&#x2F;blob&#x2F;1983444bbe1a471886ef7c0e82253ffe2a4053e1&#x2F;tests&#x2F;cancun&#x2F;eip7516_blobgasfee&#x2F;test_blobgasfee_opcode.py&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The value of the blob base-fee is not sensitive and is publicly accessible in the block header. There are no known security implications with this instruction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Add Max Epoch Churn Limit</title>
        <published>2023-09-07T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>dapplion</name><uri>https://github.com/dapplion</uri>
	</author>
	
	<author>
		<name>Tim Beiko</name><uri>https://github.com/timbeiko</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7514/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7514-add-max-epoch-churn-limit/15709" />
        

        <id>https://wg-eips.ritovision.com/7514/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:7514"
            label="EIP-7514" />
        

        
        

        
        <summary type="html">Modify the churn limit function to upper bound it to a max value</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7514/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Update the maximum validator growth rate from an exponential to a linear increase by capping the epoch churn limit.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal aims to mitigate the negative externalities of very high level of total ETH supply staked before a proper solution is implemented. In other words, this proposal accepts the complexities of changing the rewards curve and is meant only to slow down growth.&lt;&#x2F;p&gt;
&lt;p&gt;In the event that the deposit queue stays 100% full, the share of ETH supply staked will reach 50% by May 2024, 75% by September 2024, and 100% by December 2024. While rewards decrease as the validator set size increases, at 100% of ETH supply staked, yearly consensus rewards alone (excluding MEV&#x2F;transaction fees) for validators still represent ~1.6% of their stake. This small yield does not necessarily dissuade additional capital staking due to the often much higher and unpredictable yields from MEV. As such, the equilibrium point of the validator set size can be close to its maximum possible. Liquid staking tokens (LSTs) also contribute to this, given stakers can use them as they use unstaked ETH.&lt;&#x2F;p&gt;
&lt;p&gt;As the levels of ETH staked increase, more strain is put on the consensus layer. A larger number of validators leads to an increase in gossip messages, as well as a growing Beacon state size. Additionally, as the amount of stake grows, it&#x27;s unclear how much marginal security benefits come from additional economic weight.&lt;&#x2F;p&gt;
&lt;p&gt;The Beacon Chain validator reward function was chosen before its launch in 2020. PoS research and reward curve design were performed in a pre-MEV world. Much has changed since then, including the Beacon chain achieving unprecedented success, beyond the original intended targets of stake rate. In light of this, it is worth discussing whether Beacon chain validator rewards should be adjusted to better match today&#x27;s reality, potentially to discourage staking past a certain point.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP does not attempt to do this, but to allow more time for the community to have these discussions. By limiting the epoch churn limit now, the time to reach critical milestones of total ETH supply staked are significantly delayed. This allows more time for research into more comprehensive solutions, and for community consensus around them to emerge.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_PER_EPOCH_ACTIVATION_CHURN_LIMIT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;8&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;execution-layer&quot;&gt;Execution layer&lt;&#x2F;h3&gt;
&lt;p&gt;This requires no changes to the Execution Layer.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;consensus-layer&quot;&gt;Consensus layer&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Add &lt;code&gt;get_validator_activation_churn_limit&lt;&#x2F;code&gt; with upper bound &lt;code&gt;MAX_PER_EPOCH_ACTIVATION_CHURN_LIMIT&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Modify &lt;code&gt;process_registry_updates&lt;&#x2F;code&gt; to use bounded activation churn limit&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The full specification of the proposed change can be found in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;69d34dc4ee3d026ca437d1b6875b218e8aaf3a5c&#x2F;specs&#x2F;deneb&#x2F;beacon-chain.md&quot;&gt;&lt;code&gt;&#x2F;specs&#x2F;deneb&#x2F;beacon-chain.md&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;max-per-epoch-churn-limit-value&quot;&gt;&lt;code&gt;MAX_PER_EPOCH_CHURN_LIMIT&lt;&#x2F;code&gt; value&lt;&#x2F;h3&gt;
&lt;p&gt;Depending on the specific constant selection the churn can &lt;em&gt;decrease&lt;&#x2F;em&gt; at the activation fork epoch. The Beacon chain spec can handle this without issues. During 2023 Q4 (projected Dencun activation) the churn value will range 14-16. The table below compares the projected validator set assuming a continuous full deposit queue.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;max-per-epoch-churn-limit-activation-date-dec-01-2023&quot;&gt;&lt;code&gt;MAX_PER_EPOCH_CHURN_LIMIT&lt;&#x2F;code&gt; activation date: Dec 01, 2023&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&quot;text-align: right&quot;&gt;Max Churn Limit&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: left&quot;&gt;50% ETH staked&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: left&quot;&gt;75% ETH staked&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: left&quot;&gt;100% ETH staked&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;inf&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;May 28, 2024&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Sep 25, 2024&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Dec 18, 2024&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;16&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Jul 23, 2024&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Apr 10, 2025&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Dec 26, 2025&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;12&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Oct 09, 2024&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Sep 21, 2025&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Sep 04, 2026&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;8&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Mar 15, 2025&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Aug 18, 2026&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Jan 21, 2028&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;6&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Aug 19, 2025&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Jul 14, 2027&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Jun 08, 2029&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;4&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Jun 29, 2026&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;May 05, 2029&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Mar 12, 2032&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;max-per-epoch-churn-limit-activation-date-apr-01-2024&quot;&gt;&lt;code&gt;MAX_PER_EPOCH_CHURN_LIMIT&lt;&#x2F;code&gt; activation date: Apr 01, 2024&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&quot;text-align: right&quot;&gt;Max Churn Limit&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: left&quot;&gt;50% ETH staked&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: left&quot;&gt;75% ETH staked&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: left&quot;&gt;100% ETH staked&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;inf&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;May 28, 2024&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Sep 25, 2024&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Dec 18, 2024&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;16&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Jul 01, 2024&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Mar 18, 2025&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Dec 04, 2025&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;12&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Aug 01, 2024&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Jul 14, 2025&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Jun 26, 2026&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;8&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Oct 01, 2024&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Mar 05, 2026&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Aug 08, 2027&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;6&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Dec 01, 2024&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Oct 26, 2026&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Sep 20, 2028&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;4&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Apr 02, 2025&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Feb 07, 2028&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Dec 15, 2030&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Assuming that the earliest the next fork can happen is at the start of 2024 Q3, a value of 8 provides a significant reduction in projected size without causing a big drop in churn at a projected Dencun fork date. A value of 8 prevents reaching a level of 50% ETH staked for at least 1 full year even with a delayed dencun fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces backward incompatible changes to the block validation rule set on the consensus layer and must be accompanied by a hard fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases for this EIP can be found in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;tree&#x2F;2297c09b7e457a13f7b2261a28cb45777be82f83&#x2F;tests&#x2F;core&#x2F;pyspec&#x2F;eth2spec&#x2F;test&#x2F;deneb&quot;&gt;&lt;code&gt;deneb&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; test suite of the &lt;code&gt;consensus-specs&lt;&#x2F;code&gt; repository.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP breaks the symmetry between the validator entry and exit queues, where the former is bound by &lt;code&gt;MAX_PER_EPOCH_ACTIVATION_CHURN_LIMIT&lt;&#x2F;code&gt; while the latter isn&#x27;t.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Smart NFT - A Component for Intent-Centric</title>
        <published>2023-09-06T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>MJ Tseng</name><uri>https://github.com/TsengMJ</uri><email>tsngmj@gmail.com</email>
	</author>
	
	<author>
		<name>Clay</name><uri>https://github.com/Clay2018</uri><email>clay.uw@outlook.com</email>
	</author>
	
	<author>
		<name>Jeffery.c</name><email>jeffery.c@a3sprotocol.xyz</email>
	</author>
	
	<author>
		<name>Johnny.c</name><email>johnny.c@a3sprotocol.xyz</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7513/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/nft-bound-modularized-contract/15696" />
        

        <id>https://wg-eips.ritovision.com/7513/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:7513"
            label="ERC-7513" />
        

        
        

        
        <summary type="html">This proposal defines a new type of NFT that combines smart contract execution logic, granting NFTs executable capabilities.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7513/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Smart NFT is the fusion of Smart Contract and NFT. An NFT with the logic of a Smart Contract can be executed, enabling on-chain interactions. Transitioning from an NFT to a Smart NFT is akin to going from a regular landline telephone to a smartphone, opening up broader and more intelligent possibilities for NFTs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Ethereum introduces smart contracts revolutionized the blockchain and paved the way for the flourishing ecosystem of decentralized applications (dApps). Also, the concept of non-fungible tokens (NFTs) was introduced through &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;, offering a paradigm for ownership verification.&lt;&#x2F;p&gt;
&lt;p&gt;However, smart contracts still present significant barriers for most users, and NFTs have largely been limited to repetitive explorations within Art, Gaming, and Real-World Assets realm.&lt;&#x2F;p&gt;
&lt;p&gt;The widespread adoption of smart contracts and the functional applications of NFTs still face substantial challenges. Here are some facts that emerges from this contradiction:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The strong desire for both intelligence and usability has led users to sacrifice security (sharing their private key with BOTs)&lt;&#x2F;li&gt;
&lt;li&gt;For individual developers, the process of turning functionalities into market-ready products is hindered by a lack of sufficient resources.&lt;&#x2F;li&gt;
&lt;li&gt;In the context of a &quot;Code is Law&quot; philosophy, there is a lack of on-chain infrastructure for securely transferring ownership of smart contracts&#x2F;code.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;usability-with-security&quot;&gt;Usability with Security&lt;&#x2F;h3&gt;
&lt;p&gt;IA-NFT acts as a key of a smart contract. With no private key, no risk of private key leakage.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;ia-nft-as-native-on-chain-asset&quot;&gt;IA-NFT as Native On-chain Asset&lt;&#x2F;h3&gt;
&lt;p&gt;For years, NFT stands for the ownership of a picture, a piece of artwork, a game item, a real-world asset. All these backed assets are in fact not crypto native. IA-NFT verify the ownership of a piece of code or a smart contract.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;interaction-abstraction-for-the-intent-abstraction&quot;&gt;Interaction Abstraction for the Intent Abstraction&lt;&#x2F;h3&gt;
&lt;p&gt;The on-chain interaction can be abstract to many functional module IA-NFTs and thus make the Interaction process more effective. Users can focus more on their intent rather than how to operate cross different dApps.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “NOT RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;overview&quot;&gt;Overview&lt;&#x2F;h3&gt;
&lt;p&gt;The following section will define the interface specifications for three main objects: Smart-NFT, Smart-Manager, Intent-Proxy, and establish the interaction relationships between three primary roles (developer, verifier, user) and these objects.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7513&#x2F;.&#x2F;assets&#x2F;workflow.png&quot; alt=&quot;&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;smart-nft-interface&quot;&gt;Smart-NFT Interface&lt;&#x2F;h3&gt;
&lt;p&gt;Before sending a registration request to Smart-Manager, developers should implement the following two core interfaces in Smart-NFT.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;execute&lt;&#x2F;code&gt;: This function &lt;strong&gt;MUST&lt;&#x2F;strong&gt; contain only one parameter of the &quot;bytes&quot; type, which encapsulates the required parameters for a specific Smart-NFT. Additionally, &lt;strong&gt;MUST&lt;&#x2F;strong&gt; call validatePermission during the implementation to determine if this call is legitimate.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;validatePermission&lt;&#x2F;code&gt;: This function is used to query the Smart-Manager to determine whether the Smart-NFT has been successfully verified and is callable by the caller.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ISmartNFT&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; execute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validatePermission&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;smart-manager-interface&quot;&gt;Smart-Manager Interface&lt;&#x2F;h3&gt;
&lt;p&gt;The Smart-Manager interface defines 5 possible states for Smart-NFTs:：&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;UNREGISTERED&lt;&#x2F;strong&gt;: Refers to Smart-NFTs that have not been registered with the Smart-Manager.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;DEREGISTERED&lt;&#x2F;strong&gt;: Denotes Smart-NFTs that were previously registered but have been removed or deregistered from the Smart-Manager.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;UNVERIFIED&lt;&#x2F;strong&gt;: Signifies Smart-NFTs that have been registered with the Smart-Manager but have not yet undergone the verification process.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;VERIFIED&lt;&#x2F;strong&gt;: Represents Smart-NFTs that have been registered with the Smart-Manager and have successfully passed the verification process, indicating they are safe to use.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;DENIED&lt;&#x2F;strong&gt;: Refers to Smart-NFTs that have been registered but failed the verification process, indicating they should not be used as they may pose security risks.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Smart-Manager should be implemented with the following thress core interfaces.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;register&lt;&#x2F;code&gt;: Developers can initiate a registration request for a Smart-NFT through this interface and provide the Smart-NFT&#x27;s creation code. Upon successful request, the Smart-NFT &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be marked as &lt;em&gt;UNVERIFIED&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;auditTo&lt;&#x2F;code&gt;: &lt;strong&gt;Should&lt;&#x2F;strong&gt; only let trusted verifiers use this interface to audit a Smart-NFT to change its status to &lt;em&gt;Verified&lt;&#x2F;em&gt; or &lt;em&gt;Denied&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;isAccessible&lt;&#x2F;code&gt;: This interface is used to ascertain whether a user can use a specific Smart-NFT. The determination &lt;strong&gt;MUST&lt;&#x2F;strong&gt; involves considering both the ownership of the corresponding tokenId NFT and whether the Smart-NFT has been successfully verified.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;verificationStatusOf&lt;&#x2F;code&gt;: The function &lt;strong&gt;MUST&lt;&#x2F;strong&gt; returns the current verification stage of the specified Smart-NFT.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Additionally, the implementation of Smart-Manager &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; inherit from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ISmartManager&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; VerificationStatus&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;      UNREGISTERED&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;      DEREGISTERED&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;      UNVERIFIED&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;      VERIFIED&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;      DENIED&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; register&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; creationCode&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; totalSupply&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; implAddr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; auditTo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; isValid&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isAccessible&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; caller&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verificationStatusOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;VerificationStatus&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;intent-proxy-interface&quot;&gt;Intent-Proxy Interface&lt;&#x2F;h3&gt;
&lt;p&gt;Intent-Proxy interface defines an Action struct:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;name&lt;&#x2F;th&gt;&lt;th&gt;type&lt;&#x2F;th&gt;&lt;th&gt;defination&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;tokenId&lt;&#x2F;td&gt;&lt;td&gt;uint256&lt;&#x2F;td&gt;&lt;td&gt;The nft id of the target Smart-NFT to call&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;executeParam&lt;&#x2F;td&gt;&lt;td&gt;bytes&lt;&#x2F;td&gt;&lt;td&gt;The param defined by the target Smart-NFT&#x27;s execute encode packed input&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Intent-Proxy should be implemented with &lt;code&gt;executeIntent&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;executeIntent: Users can achieve batch use of specified Smart-NFTs by calling this interface and providing an array of desired actions.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IIntentProxy&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Action&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      uint256&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      bytes&lt;&#x2F;span&gt;&lt;span&gt; executeParam&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; executeIntent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      Action&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; actions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-using-erc-1155&quot;&gt;Why using ERC-1155&lt;&#x2F;h3&gt;
&lt;p&gt;In the technical implementation aspect, we chose to use &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; as the main contract for NFTs due to the consideration of increasing the reusability of Smart-NFTs. The reason for this choice is that both &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; are based on the concept of &quot;token IDs&quot; that point to NFTs. The key difference is that &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; introduces the concept of &quot;shares,&quot; meaning that having at least one share gives you the right to use the functionality of that Smart-NFT. This concept can be likened to owning multiple smartphones of the same model, where owning several smartphones doesn&#x27;t grant you additional features; you can only use the features of each individual device.&lt;&#x2F;p&gt;
&lt;p&gt;Another reason for directly using &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; instead of defining a new NFT standard is the seamless integration of Smart-NFT transaction behavior into the existing market. This approach benefits both developers and users, as it simplifies the adoption of Smart-NFTs into the current ecosystem.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;verifier&quot;&gt;Verifier&lt;&#x2F;h3&gt;
&lt;p&gt;In this protocol, Verifiers play a crucial role, responsible for auditing and verifying Smart-NFT code. However, decentralized Verifiers face some highly challenging issues, with one of the primary concerns being the specialized expertise required for their role, which is not easily accessible to the general population.&lt;&#x2F;p&gt;
&lt;p&gt;First, let&#x27;s clarify the responsibilities of Verifiers, which include assessing the security, functionality, and compliance of smart contract code. This work demands professional programming skills, blockchain technology knowledge, and contract expertise. Verifiers must ensure the absence of vulnerabilities in the code.&lt;&#x2F;p&gt;
&lt;p&gt;Secondly, decentralized Verifiers encounter challenges related to authority and credibility. In a centralized model, we can trust a specific auditing organization or expert to perform this task. However, in a decentralized environment, it becomes difficult to determine the expertise and integrity of Verifiers. This could potentially lead to incorrect audits and might even be abused to undermine overall stability and reliability.&lt;&#x2F;p&gt;
&lt;p&gt;Lastly, achieving decentralized Verifiers also requires addressing coordination and management issues. In a centralized model, the responsibilities of managing and supervising Verifiers are relatively straightforward. However, in a decentralized environment, coordinating the work of various Verifiers and ensuring consistency in their audits across different contracts and code become significant challenges.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;copyright-infringement-issue&quot;&gt;Copyright infringement issue&lt;&#x2F;h3&gt;
&lt;p&gt;Code plagiarism has always been a topic of concern, but often, such discussions seem unnecessary. We present two key points: first, overly simple code has no value, making discussions about plagiarism irrelevant. Secondly, when code is complex enough or creative, legal protection can be obtained through open-source licenses (OSI).&lt;&#x2F;p&gt;
&lt;p&gt;The first point is that for overly simple code, plagiarism is almost meaningless. For example, consider a very basic &quot;Hello World&quot; program. Such code is so simple that almost anyone can independently create it. Discussing plagiarism of such code is a waste of time and resources because it lacks sufficient innovation or value and does not require legal protection.&lt;&#x2F;p&gt;
&lt;p&gt;The second point is that when code is complex enough or creative, open-source licenses (OSI) provide legal protection for software developers. Open-source licenses are a way for developers to share their code and specify terms of use. For example, the GNU General Public License (GPL) and the Massachusetts Institute of Technology (MIT) license are common open-source licenses that ensure the original code&#x27;s creators can retain their intellectual property rights while allowing others to use and modify the code. This approach protects complex and valuable code while promoting innovation and sharing.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal aims to ensure the highest possible compatibility with the existing &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; protocol. All functionalities present in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt;, including &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; detection and Smart-NFT support, are retained. This encompasses compatibility with current NFT trading platforms.&lt;&#x2F;p&gt;
&lt;p&gt;For all Smart-NFTs, this proposla only mandates the provision of the &lt;code&gt;execute&lt;&#x2F;code&gt; function. This means that existing proxy contracts need to focus solely on this interface, making integration of Smart-NFTs more straightforward and streamlined.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;See &lt;code&gt;https:&#x2F;&#x2F;github.com&#x2F;TsengMJ&#x2F;EIP-7513_Example&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;malicious-validator&quot;&gt;Malicious Validator&lt;&#x2F;h3&gt;
&lt;p&gt;All activities involving human intervention inherently carry the risk of malicious behavior. In this protocol, during the verification phase of Smart-NFTs, external validators provide guarantees. However, this structure raises concerns about the possibility of malicious validators intentionally endorsing Malicious Smart-NFTs. To mitigate this risk, it&#x27;s necessary to implement stricter validation mechanisms, filtering of validators, punitive measures, or even more stringent consensus standards.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;unexpected-verification-error&quot;&gt;Unexpected Verification Error&lt;&#x2F;h3&gt;
&lt;p&gt;Apart from the issue of Malicious Validators, there&#x27;s the possibility of missed detection during the verification phase due to factors like overly complex Smart-NFT implementations or vulnerabilities in the Solidity compiler. This issue can only be addressed by employing additional tools to assist in contract auditing or by implementing multiple validator audits for the auditTo interface to reduce the likelihood of its occurrence.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Entity Component System</title>
        <published>2023-09-05T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Rickey</name><uri>https://github.com/HelloRickey</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7509/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/a-new-proposal-of-entity-component-system/15665" />
        

        <id>https://wg-eips.ritovision.com/7509/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7509"
            label="ERC-7509" />
        

        
        

        
        <summary type="html">Represent entities comprising components of data, with systems which operate on entities&#x27; components.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7509/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal defines a minimal Entity Component System (ECS). Entities are unique identities that are assigned to multiple components (data) and then processed using the system (logic).
This proposal standardizes the interface specification for using ECS in smart contracts, providing a set of basic functions that allow users to freely combine and manage multi-contract applications.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;ECS is a design pattern that improves code reusability by separating data from behavior. It is often used in game development. A minimal ECS consists of&lt;br &#x2F;&gt;
&lt;strong&gt;Entity&lt;&#x2F;strong&gt;: a unique identifier.&lt;br &#x2F;&gt;
&lt;strong&gt;Component&lt;&#x2F;strong&gt;: a reusable data container attached to an entity.&lt;br &#x2F;&gt;
&lt;strong&gt;System&lt;&#x2F;strong&gt;: the logic for operating entity components.&lt;br &#x2F;&gt;
&lt;strong&gt;World&lt;&#x2F;strong&gt;: a container for an entity component system.&lt;br &#x2F;&gt;
This proposal uses smart contracts to implement an easy-to-use minimal ECS, eliminates unnecessary complexity, and makes some functional improvements that are consistent with contract interaction behavior. You can combine components and systems easily and freely.
As a smart contract developer, the benefits of adopting ECS include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;It adopts a simple design of decoupling, encapsulation, and modularization, which makes the architecture design of your game or application easier.&lt;&#x2F;li&gt;
&lt;li&gt;It has flexible composition ability, each entity can combine different components. You can also define different systems for manipulating the data of these new entities.&lt;&#x2F;li&gt;
&lt;li&gt;It is conducive to expansion, and two games or applications can interact by defining new components and systems.&lt;&#x2F;li&gt;
&lt;li&gt;It can help your application add new features or upgrades, because data and behavior are separated, new features will not affect your old data.&lt;&#x2F;li&gt;
&lt;li&gt;It is easy to manage. When your application consists of multiple contracts, it will help you effectively manage the status of each contract.&lt;&#x2F;li&gt;
&lt;li&gt;Its components are reusable, and you can share your components with the community to help others improve development efficiency.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;World contracts are containers for entities, component contracts, and system contracts. Its core principle is to establish the relationship between entities and component contracts, where different entities will attach different components, and use system contracts to dynamically change the data of the entity in the component.&lt;&#x2F;p&gt;
&lt;p&gt;Usual workflow when building ECS-based programs:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Implement the &lt;code&gt;IWorld&lt;&#x2F;code&gt; interface to create a world contract.&lt;&#x2F;li&gt;
&lt;li&gt;Call &lt;code&gt;createEntity()&lt;&#x2F;code&gt; of the world contract to create an entity.&lt;&#x2F;li&gt;
&lt;li&gt;Implement the &lt;code&gt;IComponent&lt;&#x2F;code&gt; interface to create a Component contract.&lt;&#x2F;li&gt;
&lt;li&gt;Call &lt;code&gt;registerComponent()&lt;&#x2F;code&gt; of the world contract to register the component contract.&lt;&#x2F;li&gt;
&lt;li&gt;Call &lt;code&gt;addComponent()&lt;&#x2F;code&gt; of the world contract to attach the component to the entity.&lt;&#x2F;li&gt;
&lt;li&gt;Create a system contract, which is a contract without interface restrictions, and you can define any function in the system contract.&lt;&#x2F;li&gt;
&lt;li&gt;Call &lt;code&gt;registerSystem()&lt;&#x2F;code&gt; of the world contract to register the system contract.&lt;&#x2F;li&gt;
&lt;li&gt;Run the system.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;interfaces&quot;&gt;Interfaces&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;iworld-sol&quot;&gt;&lt;code&gt;IWorld.sol&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; &amp;gt;=0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IWorld&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Create a new entity.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The entity MUST be assigned a unique Id.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * If the state of the entity is true, it means it is available, and if it is false, it means it is not available.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * When the state of the entity is false, you cannot add or remove components for the entity.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; New&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; entity id.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; createEntity&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Does the entity exist in the world.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _entityId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the Id of the entity.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; true&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; exists, false does not exist.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; entityExists&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _entityId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Get the total number of entities in the world.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; total number of entities.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getEntityCount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Set the state of an entity.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Entity MUST exist.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _entityId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the Id of the entity.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _entityState&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the state of the entity, true means available, false means unavailable.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setEntityState&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _entityId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _entityState&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Get the state of an entity.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _entityId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Id of the entity.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; current state of the entity.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getEntityState&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _entityId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Register a component to the world.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A component MUST be registered with the world before it can be attached to an entity.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST NOT register the same component to the world repeatedly.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * It SHOULD be checked that the contract address returned by world() of the component contract is the same as the current world contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * The state of the component is true means it is available, and false means it is not available. When the component state is set to false, it cannot be attached to the entity.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _componentAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the contract address of the component.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; registerComponent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _componentAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Does the component exist in the world.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _componentAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the contract address of the component.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; true&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; exists, false does not exist.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; componentExists&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _componentAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Get the contract addresses of all components registered in the world.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Array&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; of contract addresses.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getComponents&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Set component state.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Component MUST exist.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _componentAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the contract address of the component.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _componentState&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the state of the component, true means available, false means unavailable.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setComponentState&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _componentAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _componentState&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Get the state of a component.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _componentAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the contract address of the component.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; true&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; means available, false means unavailable.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getComponentState&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _componentAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Attach a component to the entity.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Entity MUST be available.Component MUST be available.A component MUST NOT be added to an entity repeatedly.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _entityId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the Id of the entity.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _componentAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the address of the component to be attached.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addComponent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _entityId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _componentAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Whether the entity has a component attached,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Entity MUST exist.Component MUST be registered.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _entityId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the Id of the entity.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _componentAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the component address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; true&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is attached, false is not attached&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; hasComponent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _entityId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _componentAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Remove a component from the entity.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Entity MUST be available.The component MUST have been added to the entity before.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _entityId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the Id of the entity.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _componentAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the address of the component to be removed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; removeComponent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _entityId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _componentAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Get the contract addresses of all components attached to the entity.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Entity MUST exist.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _entityId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the Id of the entity.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; An&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of contract addresses of the components owned by this entity.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getEntityComponents&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _entityId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Register a system to the world.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST NOT register the same system to the world repeatedly.The system state is true means available, false means unavailable.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _systemAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the contract address of the system.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; registerSystem&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _systemAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Does the system exist in the world.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _systemAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the contract address of the system.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; true&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; exists, false does not exist.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; systemExists&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _systemAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Get the contract addresses of all systems registered in the world.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Array&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; of contract addresses.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getSystems&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Set the system State.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; System MUST exist.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _systemAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the contract address of the system.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _systemState&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the state of the system.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setSystemState&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _systemAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _systemState&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Get the state of a system.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _systemAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the contract address of the system.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; state of the system.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getSystemState&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _systemAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;icomponent-sol&quot;&gt;&lt;code&gt;IComponent.sol&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; &amp;gt;=0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;Types.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IComponent&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * The world contract address registered by the component.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; world&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; contract address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; world&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *Get the data type and get() parameter type of the component&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SHOULD Import Types Library, which is an enumeration Library containing all data types.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Entity data can be stored according to the data type.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * The get() parameter data type can be used to get entity data.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; data type array of the entity&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; get&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; parameter data type array&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; types&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Types&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;Type&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; Types&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;Type&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *Store entity data.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; entity MUST be available. The system that operates on it MUST be available.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * The entity has the component attached.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _entityId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the Id of the entity.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the data to be stored.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; set&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _entityId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *Get the data of the entity according to the entity Id.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _entityId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the Id of the entity.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Entity&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; data.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _entityId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the data of the entity according to the entity Id and parameters.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _entityId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the Id of the entity.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _params&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is an extra parameter, it SHOULD depend on whether you need it.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Entity&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; data.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _entityId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _params&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;library&quot;&gt;Library&lt;&#x2F;h3&gt;
&lt;p&gt;The library &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7509&#x2F;.&#x2F;assets&#x2F;Types.sol&quot;&gt;&lt;code&gt;Types.sol&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; contains an enumeration of Solidity types used in the above interfaces.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-include-type-information-instead-of-simple-byte-arrays&quot;&gt;Why include type information instead of simple byte arrays?&lt;&#x2F;h3&gt;
&lt;p&gt;This is to ensure the correctness of types when using components, in order to avoid potential errors and inconsistencies. External developers can clearly set and get based on the type.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-differentiate-between-a-non-existent-entity-and-an-entity-with-false-state&quot;&gt;Why differentiate between a non-existent entity and an entity with false state?&lt;&#x2F;h3&gt;
&lt;p&gt;We cannot judge whether an entity actually exists based on its state alone. External contributors can create components based on entities. If the entities he uses don&#x27;t exist, the components he creates may not make sense. Component creators should first check if the entity exists, and if the entity does exist, it makes sense even if the entity&#x27;s state is false. Because he can wait for the entity state to be true before attaching the component to the entity.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-getentitycomponents-function-returns-all-addresses-of-components-instead-of-all-component-ids&quot;&gt;Why &lt;code&gt;getEntityComponents&lt;&#x2F;code&gt; function returns all addresses of components instead of all component ids?&lt;&#x2F;h3&gt;
&lt;p&gt;There are two designs for &lt;code&gt;getEntityComponents&lt;&#x2F;code&gt;. The other design is to add an additional mapping for the storage of component id and component address. Every time we call &lt;code&gt;addComponent&lt;&#x2F;code&gt;, the parameters of the function are the entity id and component id. When the user calls &lt;code&gt;getEntityComponents&lt;&#x2F;code&gt;, it will returning an array of component ids, they query the component address with each component id, and then query the data based on each component address. Because a entity may contain many component ids, this will cause the user to request the component address multiple times. In the end, we chose to use &lt;code&gt;getEntityComponents&lt;&#x2F;code&gt; directly for all addresses owned by the entity.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;can-registercomponent-and-registersystem-provide-external-permissions&quot;&gt;Can &lt;code&gt;registerComponent&lt;&#x2F;code&gt; and &lt;code&gt;registerSystem&lt;&#x2F;code&gt; provide external permissions?&lt;&#x2F;h3&gt;
&lt;p&gt;It depends on the openness of your application or game. If you encourage developers to participate, the state of the component and system they submit for registration should be &lt;code&gt;false&lt;&#x2F;code&gt;, and you need to check whether they have submitted malicious code before using &lt;code&gt;setComponentState&lt;&#x2F;code&gt; and &lt;code&gt;setSystemState&lt;&#x2F;code&gt; to enable them .&lt;&#x2F;p&gt;
&lt;h3 id=&quot;when-to-use-get-with-extra-parameters-in-component&quot;&gt;When to use &lt;code&gt;get&lt;&#x2F;code&gt; with extra parameters in component?&lt;&#x2F;h3&gt;
&lt;p&gt;The component provides two &lt;code&gt;get&lt;&#x2F;code&gt; functions. One &lt;code&gt;get&lt;&#x2F;code&gt; function only needs to pass in the entity id, and the other has more &lt;code&gt;_params&lt;&#x2F;code&gt; parameters, which will be used as additional parameters for obtaining data. For example, you define a component that stores the HP corresponding to the level of an entity. If you want to get the HP of an entity that matches its level, then you call the &lt;code&gt;get&lt;&#x2F;code&gt; function with the entity level as &lt;code&gt;_params&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7509&#x2F;assets&#x2F;README&#x2F;&quot;&gt;Ethereum ECS Example&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Unless you want to implement special functions, do not provide the following methods directly to ordinary users, they should be set by the contract owner.&lt;br &#x2F;&gt;
&lt;code&gt;createEntity()&lt;&#x2F;code&gt;,
&lt;code&gt;setEntityState()&lt;&#x2F;code&gt;,
&lt;code&gt;addComponent()&lt;&#x2F;code&gt;,
&lt;code&gt;removeComponent()&lt;&#x2F;code&gt;,
&lt;code&gt;registerComponent()&lt;&#x2F;code&gt;,
&lt;code&gt;setComponentState()&lt;&#x2F;code&gt;,
&lt;code&gt;registerSystem()&lt;&#x2F;code&gt;,
&lt;code&gt;setSystemState()&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Do not provide functions that modify entities other than set() in the component contract. And add a check in &lt;code&gt;set()&lt;&#x2F;code&gt; to check whether the entity is available and whether the operating system is available.&lt;&#x2F;p&gt;
&lt;p&gt;After the system is registered in the world, it will be able to operate the component data of all entities in the world. It is necessary to check and audit the code security of all system contracts before registering it in the world.&lt;&#x2F;p&gt;
&lt;p&gt;If the new version has deprecated some entities, component contracts and system contracts. They need to be disabled in time using &lt;code&gt;setEntityState()&lt;&#x2F;code&gt;, &lt;code&gt;setComponentState()&lt;&#x2F;code&gt;, and &lt;code&gt;setSystemState()&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Onchain Representation for Audits</title>
        <published>2023-09-05T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Richard Meissner - Safe</name><uri>https://github.com/rmeissner</uri>
	</author>
	
	<author>
		<name>Robert Chen - OtterSec</name><uri>https://github.com/chen-robert</uri>
	</author>
	
	<author>
		<name>Matthias Egli - ChainSecurity</name><uri>https://github.com/MatthiasEgli</uri>
	</author>
	
	<author>
		<name>Jan Kalivoda - Ackee Blockchain</name><uri>https://github.com/jaczkal</uri>
	</author>
	
	<author>
		<name>Michael Lewellen - OpenZeppelin</name><uri>https://github.com/cylon56</uri>
	</author>
	
	<author>
		<name>Shay Zluf - Hats Finance</name><uri>https://github.com/shayzluf</uri>
	</author>
	
	<author>
		<name>Alex Papageorgiou - Omniscia</name><uri>https://github.com/alex-ppg</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7512/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7512-onchain-audit-representation/15683" />
        

        <id>https://wg-eips.ritovision.com/7512/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:7512"
            label="ERC-7512" />
        

        
        

        
        <summary type="html">Proposal to define a contract parseable representation of Audit reports.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7512/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The proposal aims to create a standard for an onchain representation of audit reports that can be parsed by contracts to extract relevant information about the audits, such as who performed the audits and what standards have been verified.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Audits are an integral part of the smart contract security framework. They are commonly used to increase the security of smart contracts and ensure that they follow best practices as well as correctly implement standards such &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;, and similar ERCs. Many essential parts of the blockchain ecosystem are facilitated by the usage of smart contracts. Some examples of this are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Bridges: Most bridges consist of a bridgehead or a lockbox that secures the tokens that should be bridged. If any of these contracts are faulty it might be possible to bring the operation of the bridge to a halt or, in extreme circumstances, cause uncollateralized assets to be minted on satellite chains.&lt;&#x2F;li&gt;
&lt;li&gt;Token Contracts: Every token in the Ethereum ecosystem is a smart contract. Apps that interact with these tokens rely on them adhering to known token standards, most commonly &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;. Tokens that behave differently can cause unexpected behavior and might even lead to loss of funds.&lt;&#x2F;li&gt;
&lt;li&gt;Smart Contract Accounts (SCAs): With &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt; more visibility has been created for smart-contract-based accounts. They provide extreme flexibility and can cater to many different use cases whilst retaining a greater degree of control and security over each account. A concept that has been experimented with is the idea of modules that allow the extension of a smart contract account&#x27;s functionality. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6900&#x2F;&quot;&gt;ERC-6900&lt;&#x2F;a&gt;) is a recent standard that defines how to register and design plugins that can be registered on an account.&lt;&#x2F;li&gt;
&lt;li&gt;Interoperability (Hooks &amp;amp; Callbacks): With more protocols supporting external-facing functions to interact with them and different token standards triggering callbacks on a transfer (i.e. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt;), it is important to make sure that these interactions are well vetted to minimize the security risks they are associated with as much as possible.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The usage and impact smart contracts will have on the day-to-day operations of decentralized applications will steadily increase. To provide tangible guarantees about security and allow better composability it is imperative that an onchain verification method exists to validate that a contract has been audited. Creating a system that can verify that an audit has been made for a specific contract will strengthen the security guarantees of the whole smart contract ecosystem.&lt;&#x2F;p&gt;
&lt;p&gt;While this information alone is no guarantee that there are no bugs or flaws in a contract, it can provide an important building block to create innovative security systems for smart contracts in an onchain way.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;example&quot;&gt;Example&lt;&#x2F;h3&gt;
&lt;p&gt;Imagine a hypothetical &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; token bridge. The goal is to create a scalable system where it is possible to easily register new tokens that can be bridged. To minimize the risk of malicious or faulty tokens being registered, audits will be used and verified onchain.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7512&#x2F;.&#x2F;assets&#x2F;example_use_case.png&quot; alt=&quot;Onchain Audit Example Use Case&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;To illustrate the flow within the diagram clearly, it separates the Bridge and the Verifier roles into distinct actors. Theoretically, both can live in the same contract.&lt;&#x2F;p&gt;
&lt;p&gt;There are four parties:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;User: The end user that wants to bridge their token&lt;&#x2F;li&gt;
&lt;li&gt;Bridge Operator: The operator that maintains the bridge&lt;&#x2F;li&gt;
&lt;li&gt;Bridge: The contract the user will interact with to trigger the bridge operation&lt;&#x2F;li&gt;
&lt;li&gt;Validator: The contract that validates that a token can be bridged&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;As a first (1) step, the bridge operator should define the keys&#x2F;accounts for the auditors from which audits are accepted for the token registration process.&lt;&#x2F;p&gt;
&lt;p&gt;With this, the user (or token owner) can trigger the registration flow (2). There are two steps (3 and 6) that will be performed: verify that the provided audit is valid and has been signed by a trusted auditor (4), and check that the token contract implements the bridge&#x27;s supported token standard (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt;) (7).&lt;&#x2F;p&gt;
&lt;p&gt;After the audit and token standard validations have been performed, it is still advisable to have some form of manual intervention in place by the operator to activate a token for bridging (10). &lt;!-- This step could be omitted if there is strong trust in the auditor or if an ERC provides strong compatibility guarantees. --&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Once the token has been activated on the bridge, Users can start bridging it (11).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;audit-properties&quot;&gt;Audit Properties&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Auditor
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;name&lt;&#x2F;code&gt;: Name of the auditor (i.e. for displaying to the user)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;uri&lt;&#x2F;code&gt;: URI to retrieve more information about the auditor&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;authors&lt;&#x2F;code&gt;: A list of authors that contributed to this audit. This SHOULD be the persons who audited the contracts and created the audit&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Audit
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;auditor&lt;&#x2F;code&gt;: Information on the auditor&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;auditedContract&lt;&#x2F;code&gt;: MUST be the &lt;code&gt;chainId&lt;&#x2F;code&gt; as well as &lt;code&gt;deployment&lt;&#x2F;code&gt; of the contract the audit is related to&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;issuedAt&lt;&#x2F;code&gt;: MUST contain the information when the original audit (identified by the &lt;code&gt;auditHash&lt;&#x2F;code&gt;) was issued&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ercs&lt;&#x2F;code&gt;: A list of ERCs that are implemented by the target contract. The ERCs listed MUST be fully implemented. This list MAY be empty&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;auditHash&lt;&#x2F;code&gt;: MUST be the hash of the original audit. This allows onchain verification of information that may belong to a specific audit&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;auditUri&lt;&#x2F;code&gt;: SHOULD point to a source where the audit can be retrieved&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Contract
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;chainId&lt;&#x2F;code&gt;: MUST be a &lt;code&gt;bytes32&lt;&#x2F;code&gt; representation of the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt; chain ID of the blockchain that the contract has been deployed in&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;deployment&lt;&#x2F;code&gt;: MUST be an &lt;code&gt;address&lt;&#x2F;code&gt; representation of a contract&#x27;s deployment address&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;auditor-verification&quot;&gt;Auditor Verification&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Signature
&lt;ul&gt;
&lt;li&gt;Type
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;SECP256K1&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;Data is the encoded representation of &lt;code&gt;r&lt;&#x2F;code&gt;, &lt;code&gt;s&lt;&#x2F;code&gt;, and &lt;code&gt;v&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;BLS&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;TBD&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ERC1271&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;Data is the ABI-encoded representation of &lt;code&gt;chainId&lt;&#x2F;code&gt;, &lt;code&gt;address&lt;&#x2F;code&gt;, &lt;code&gt;blocknumber&lt;&#x2F;code&gt;, and the &lt;code&gt;signature bytes&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SECP256R1&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;Data is the encoded representation of &lt;code&gt;r&lt;&#x2F;code&gt;, &lt;code&gt;s&lt;&#x2F;code&gt;, and &lt;code&gt;v&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Data&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;data-types&quot;&gt;Data types&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Auditor&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span&gt; uri&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; authors&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Contract&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; chainId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; deployment&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AuditSummary&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Auditor auditor&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; issuedAt&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; ercs&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Contract auditedContract&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; auditHash&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span&gt; auditUri&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;signing&quot;&gt;Signing&lt;&#x2F;h3&gt;
&lt;p&gt;For signing &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; will be used. For this the main type is the &lt;code&gt;AuditSummary&lt;&#x2F;code&gt; and as the &lt;code&gt;EIP712Domain&lt;&#x2F;code&gt; the following definition applies:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EIP712Domain&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span&gt; version&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;EIP712Domain auditDomain &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EIP712Domain&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;ERC-7652: Onchain Audit Representation&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;1.0&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The generated signature can then be attached to the &lt;code&gt;AuditSummary&lt;&#x2F;code&gt; to generate a new &lt;code&gt;SignedAuditSummary&lt;&#x2F;code&gt; object:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SignatureType&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;    SECP256K1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;    BLS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;    ERC1271&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;    SECP256R1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Signature&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    SignatureType &lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;type&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SignedAuditSummary&lt;&#x2F;span&gt;&lt;span&gt; extends AuditSummary &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; signedAt&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Signature auditorSignature&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The current ERC deliberately does not define the &lt;code&gt;findings&lt;&#x2F;code&gt; of an audit. Such a definition would require alignment on the definition of what severities are supported, what data of a finding should be stored onchain vs off-chain, and other similar finding-related attributes that are hard to strictly describe. Given the complexity of this task, we consider it to be outside the scope of this EIP. It is important to note that this ERC proposes that a signed audit summary indicates that a specific contract instance (specified by its &lt;code&gt;chainId&lt;&#x2F;code&gt; and &lt;code&gt;deployment&lt;&#x2F;code&gt;) has undergone a security audit.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore, it indicates that this contract instance correctly implements the listed ERCs. This normally corresponds to the final audit revision for a contract which is then connected to the deployment. As specified above, this ERC MUST NOT be considered an attestation of a contract&#x27;s security but rather a methodology via which data relevant to a smart contract can be extracted; evaluation of the quality, coverage, and guarantees of the data is left up to the integrators of the ERC.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;further-considerations&quot;&gt;Further Considerations&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;standards&lt;&#x2F;code&gt; vs &lt;code&gt;ercs&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;Limiting the scope to audits related to EVM-based smart contract accounts allows a better definition of parameters.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;chainId&lt;&#x2F;code&gt; and &lt;code&gt;deployment&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;As a contract&#x27;s behavior depends on the blockchain it is deployed in, we have opted to associate a &lt;code&gt;chainId&lt;&#x2F;code&gt; as well as &lt;code&gt;deployment&lt;&#x2F;code&gt; address per contract that corresponds to an audit&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;contract&lt;&#x2F;code&gt; vs &lt;code&gt;contracts&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;Many audits are related to multiple contracts that make up a protocol. To ensure simplicity in the initial version of this ERC, we chose to only reference one contract per audit summary. If multiple contracts have been audited in the same audit engagement, the same audit summary can be associated with different contract instances. An additional benefit of this is the ability to properly associate contract instances with the &lt;code&gt;ercs&lt;&#x2F;code&gt; they support. The main drawback of this approach is that it requires multiple signing passes by the auditors.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Why &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt;?
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; was chosen as a base due to its tooling compatibility (i.e. for signing)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;How to assign a specific Signing Key to an Auditor?
&lt;ul&gt;
&lt;li&gt;Auditors should publicly share the public part of the signature, which can be done via their website, professional page, and any such social medium&lt;&#x2F;li&gt;
&lt;li&gt;As an extension to this ERC it would be possible to build a public repository, however, this falls out-of-scope of the ERC&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Polymorphic Contracts and Proxies
&lt;ul&gt;
&lt;li&gt;This ERC explicitly does &lt;strong&gt;not&lt;&#x2F;strong&gt; mention polymorphic contracts and proxies. These are important to be considered, however, their proper management is delegated to auditors as well as implementors of this ERC&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;future-extensions&quot;&gt;Future Extensions&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Potential expansion of ERC to accommodate non-EVM chains&lt;&#x2F;li&gt;
&lt;li&gt;Better support for polymorphic&#x2F;upgradeable contracts and multi-contract audits&lt;&#x2F;li&gt;
&lt;li&gt;Management of signing keys for auditors&lt;&#x2F;li&gt;
&lt;li&gt;Definition of findings of an audit&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues have been identified in relation to current ERC standards.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TBD.&lt;&#x2F;p&gt;
&lt;p&gt;The following features will be implemented in a reference implementation:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Script to trigger signing based on a JSON representing the audit summary&lt;&#x2F;li&gt;
&lt;li&gt;Contract to verify signed audit summary&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;auditor-key-management&quot;&gt;Auditor Key Management&lt;&#x2F;h3&gt;
&lt;p&gt;The premise of this ERC relies on proper key management by the auditors who partake in the system. If an auditor&#x27;s key is compromised, they may be associated with seemingly audited or ERC-compliant contracts that ultimately could not comply with the standards. As a potential protection measure, the ERC may define an &quot;association&quot; of auditors (f.e. auditing companies) that would permit a secondary key to revoke existing signatures of auditors as a secondary security measure in case of an auditor&#x27;s key compromise.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Minimal Proxy Contract with PUSH0</title>
        <published>2023-09-04T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>0xAA</name><uri>https://github.com/AmazingAng</uri>
	</author>
	
	<author>
		<name>vectorized</name><uri>https://github.com/Vectorized</uri>
	</author>
	
	<author>
		<name>0age</name><uri>https://github.com/0age</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7511/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7511-minimal-proxy-contract-with-push0/15662" />
        

        <id>https://wg-eips.ritovision.com/7511/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7511"
            label="ERC-7511" />
        

        
        

        
        <summary type="html">Optimizes the previous Minimal Proxy Contract with the PUSH0 opcode</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7511/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;With the &lt;code&gt;PUSH0&lt;&#x2F;code&gt; opcode (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3855&#x2F;&quot;&gt;EIP-3855&lt;&#x2F;a&gt;), introduced with the Shanghai upgrade, we optimized the previous Minimal Proxy Contract (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1167&#x2F;&quot;&gt;ERC-1167&lt;&#x2F;a&gt;) by 200 gas at deployment and 5 gas at runtime, while retaining the same functionality.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;Reduce the contract bytecode size by &lt;code&gt;1&lt;&#x2F;code&gt; byte by removing a redundant &lt;code&gt;SWAP&lt;&#x2F;code&gt; opcode.&lt;&#x2F;li&gt;
&lt;li&gt;Reduce the runtime gas by replacing two &lt;code&gt;DUP&lt;&#x2F;code&gt; (cost &lt;code&gt;3&lt;&#x2F;code&gt; gas each) with two &lt;code&gt;PUSH0&lt;&#x2F;code&gt; (cost &lt;code&gt;2&lt;&#x2F;code&gt; gas each).&lt;&#x2F;li&gt;
&lt;li&gt;Increase the readability of the proxy contract by redesigning it from first principles with &lt;code&gt;PUSH0&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;standard-proxy-contract&quot;&gt;Standard Proxy Contract&lt;&#x2F;h3&gt;
&lt;p&gt;The exact runtime code for the minimal proxy contract with &lt;code&gt;PUSH0&lt;&#x2F;code&gt; is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;365f5f375f5f365f73bebebebebebebebebebebebebebebebebebebebe5af43d5f5f3e5f3d91602a57fd5bf3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where the bytes at indices 9 - 28 (inclusive) are replaced with the 20-byte address of the master implementation contract. The length of the runtime code is &lt;code&gt;44&lt;&#x2F;code&gt; bytes.&lt;&#x2F;p&gt;
&lt;p&gt;The disassembly of the new minimal proxy contract code is:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;pc&lt;&#x2F;th&gt;&lt;th&gt;op&lt;&#x2F;th&gt;&lt;th&gt;opcode&lt;&#x2F;th&gt;&lt;th&gt;stack&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;[00]&lt;&#x2F;td&gt;&lt;td&gt;36&lt;&#x2F;td&gt;&lt;td&gt;CALLDATASIZE&lt;&#x2F;td&gt;&lt;td&gt;cds&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;[01]&lt;&#x2F;td&gt;&lt;td&gt;5f&lt;&#x2F;td&gt;&lt;td&gt;PUSH0&lt;&#x2F;td&gt;&lt;td&gt;0 cds&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;[02]&lt;&#x2F;td&gt;&lt;td&gt;5f&lt;&#x2F;td&gt;&lt;td&gt;PUSH0&lt;&#x2F;td&gt;&lt;td&gt;0 0 cds&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;[03]&lt;&#x2F;td&gt;&lt;td&gt;37&lt;&#x2F;td&gt;&lt;td&gt;CALLDATACOPY&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;[04]&lt;&#x2F;td&gt;&lt;td&gt;5f&lt;&#x2F;td&gt;&lt;td&gt;PUSH0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;[05]&lt;&#x2F;td&gt;&lt;td&gt;5f&lt;&#x2F;td&gt;&lt;td&gt;PUSH0&lt;&#x2F;td&gt;&lt;td&gt;0 0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;[06]&lt;&#x2F;td&gt;&lt;td&gt;36&lt;&#x2F;td&gt;&lt;td&gt;CALLDATASIZE&lt;&#x2F;td&gt;&lt;td&gt;cds 0 0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;[07]&lt;&#x2F;td&gt;&lt;td&gt;5f&lt;&#x2F;td&gt;&lt;td&gt;PUSH0&lt;&#x2F;td&gt;&lt;td&gt;0 cds 0 0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;[08]&lt;&#x2F;td&gt;&lt;td&gt;73bebe.&lt;&#x2F;td&gt;&lt;td&gt;PUSH20 0xbebe.&lt;&#x2F;td&gt;&lt;td&gt;0xbebe. 0 cds 0 0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;[1d]&lt;&#x2F;td&gt;&lt;td&gt;5a&lt;&#x2F;td&gt;&lt;td&gt;GAS&lt;&#x2F;td&gt;&lt;td&gt;gas 0xbebe. 0 cds 0 0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;[1e]&lt;&#x2F;td&gt;&lt;td&gt;f4&lt;&#x2F;td&gt;&lt;td&gt;DELEGATECALL&lt;&#x2F;td&gt;&lt;td&gt;suc&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;[1f]&lt;&#x2F;td&gt;&lt;td&gt;3d&lt;&#x2F;td&gt;&lt;td&gt;RETURNDATASIZE&lt;&#x2F;td&gt;&lt;td&gt;rds suc&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;[20]&lt;&#x2F;td&gt;&lt;td&gt;5f&lt;&#x2F;td&gt;&lt;td&gt;PUSH0&lt;&#x2F;td&gt;&lt;td&gt;0 rds suc&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;[21]&lt;&#x2F;td&gt;&lt;td&gt;5f&lt;&#x2F;td&gt;&lt;td&gt;PUSH0&lt;&#x2F;td&gt;&lt;td&gt;0 0 rds suc&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;[22]&lt;&#x2F;td&gt;&lt;td&gt;3e&lt;&#x2F;td&gt;&lt;td&gt;RETURNDATACOPY&lt;&#x2F;td&gt;&lt;td&gt;suc&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;[23]&lt;&#x2F;td&gt;&lt;td&gt;5f&lt;&#x2F;td&gt;&lt;td&gt;PUSH0&lt;&#x2F;td&gt;&lt;td&gt;0 suc&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;[24]&lt;&#x2F;td&gt;&lt;td&gt;3d&lt;&#x2F;td&gt;&lt;td&gt;RETURNDATASIZE&lt;&#x2F;td&gt;&lt;td&gt;rds 0 suc&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;[25]&lt;&#x2F;td&gt;&lt;td&gt;91&lt;&#x2F;td&gt;&lt;td&gt;SWAP2&lt;&#x2F;td&gt;&lt;td&gt;suc 0 rds&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;[26]&lt;&#x2F;td&gt;&lt;td&gt;602a&lt;&#x2F;td&gt;&lt;td&gt;PUSH1 0x2a&lt;&#x2F;td&gt;&lt;td&gt;0x2a suc 0 rds&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;[27]&lt;&#x2F;td&gt;&lt;td&gt;57&lt;&#x2F;td&gt;&lt;td&gt;JUMPI&lt;&#x2F;td&gt;&lt;td&gt;0 rds&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;[29]&lt;&#x2F;td&gt;&lt;td&gt;fd&lt;&#x2F;td&gt;&lt;td&gt;REVERT&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;[2a]&lt;&#x2F;td&gt;&lt;td&gt;5b&lt;&#x2F;td&gt;&lt;td&gt;JUMPDEST&lt;&#x2F;td&gt;&lt;td&gt;0 rds&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;[2b]&lt;&#x2F;td&gt;&lt;td&gt;f3&lt;&#x2F;td&gt;&lt;td&gt;RETURN&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;minimal-creation-code&quot;&gt;Minimal Creation Code&lt;&#x2F;h3&gt;
&lt;p&gt;The minimal creation code of the minimal proxy contract is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;602c8060095f395ff3365f5f375f5f365f73bebebebebebebebebebebebebebebebebebebebe5af43d5f5f3e5f3d91602a57fd5bf3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where the first 9 bytes are the initcode:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;602c8060095f395ff3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;And the rest are runtime&#x2F;contract code of the proxy. The length of the creation code is &lt;code&gt;53&lt;&#x2F;code&gt; bytes.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;deploy-with-solidity&quot;&gt;Deploy with Solidity&lt;&#x2F;h3&gt;
&lt;p&gt;The minimal proxy contract can be deployed with Solidity using the following contract:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.20&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: this contract requires `PUSH0`, which is available in solidity &amp;gt; 0.8.20 and EVM version &amp;gt; Shanghai&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Clone0Factory&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FailedCreateClone&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    receive&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Deploys and returns the address of a clone0 (Minimal Proxy Contract with `PUSH0`) that mimics the behaviour of `implementation`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * This function uses the create opcode, which should never revert.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; clone0&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; impl&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; first 18 bytes of the creation code &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; data1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;602c8060095f395ff3365f5f375f5f365f73&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; last 15 bytes of the creation code&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; data2 &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;5af43d5f5f3e5f3d91602a57fd5bf3&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; complete the creation code of Clone0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; _code &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; impl&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; data2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; deploy with create op&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; create(v, p, n)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            addr &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; create&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;callvalue&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_code&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;addr &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FailedCreateClone&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The optimized contract is constructed with essential components of the proxy contract and incorporates the recently added &lt;code&gt;PUSH0&lt;&#x2F;code&gt; opcode. The core elements of the minimal proxy include:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Copy the calldata with &lt;code&gt;CALLDATACOPY&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Forward the calldata to the implementation contract using &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Copy the returned data from the &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Return the results or revert the transaction based on whether the &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; is successful.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;step-1-copy-the-calldata&quot;&gt;Step 1: Copy the Calldata&lt;&#x2F;h3&gt;
&lt;p&gt;To copy the calldata, we need to provide the arguments for the &lt;code&gt;CALLDATACOPY&lt;&#x2F;code&gt; opcodes, which are &lt;code&gt;[0, 0, cds]&lt;&#x2F;code&gt;, where &lt;code&gt;cds&lt;&#x2F;code&gt; represents calldata size.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;pc&lt;&#x2F;th&gt;&lt;th&gt;op&lt;&#x2F;th&gt;&lt;th&gt;opcode&lt;&#x2F;th&gt;&lt;th&gt;stack&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;[00]&lt;&#x2F;td&gt;&lt;td&gt;36&lt;&#x2F;td&gt;&lt;td&gt;CALLDATASIZE&lt;&#x2F;td&gt;&lt;td&gt;cds&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;[01]&lt;&#x2F;td&gt;&lt;td&gt;5f&lt;&#x2F;td&gt;&lt;td&gt;PUSH0&lt;&#x2F;td&gt;&lt;td&gt;0 cds&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;[02]&lt;&#x2F;td&gt;&lt;td&gt;5f&lt;&#x2F;td&gt;&lt;td&gt;PUSH0&lt;&#x2F;td&gt;&lt;td&gt;0 0 cds&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;[03]&lt;&#x2F;td&gt;&lt;td&gt;37&lt;&#x2F;td&gt;&lt;td&gt;CALLDATACOPY&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;step-2-delegatecall&quot;&gt;Step 2: Delegatecall&lt;&#x2F;h3&gt;
&lt;p&gt;To forward the calldata to the delegate call, we need to prepare arguments for the &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; opcodes, which are &lt;code&gt;[gas 0xbebe. 0 cds 0 0]&lt;&#x2F;code&gt;, where &lt;code&gt;gas&lt;&#x2F;code&gt; represents the remaining gas, &lt;code&gt;0xbebe.&lt;&#x2F;code&gt; represents the address of the implementation contract, and &lt;code&gt;suc&lt;&#x2F;code&gt; represents whether the delegatecall is successful.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;pc&lt;&#x2F;th&gt;&lt;th&gt;op&lt;&#x2F;th&gt;&lt;th&gt;opcode&lt;&#x2F;th&gt;&lt;th&gt;stack&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;[04]&lt;&#x2F;td&gt;&lt;td&gt;5f&lt;&#x2F;td&gt;&lt;td&gt;PUSH0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;[05]&lt;&#x2F;td&gt;&lt;td&gt;5f&lt;&#x2F;td&gt;&lt;td&gt;PUSH0&lt;&#x2F;td&gt;&lt;td&gt;0 0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;[06]&lt;&#x2F;td&gt;&lt;td&gt;36&lt;&#x2F;td&gt;&lt;td&gt;CALLDATASIZE&lt;&#x2F;td&gt;&lt;td&gt;cds 0 0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;[07]&lt;&#x2F;td&gt;&lt;td&gt;5f&lt;&#x2F;td&gt;&lt;td&gt;PUSH0&lt;&#x2F;td&gt;&lt;td&gt;0 cds 0 0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;[08]&lt;&#x2F;td&gt;&lt;td&gt;73bebe.&lt;&#x2F;td&gt;&lt;td&gt;PUSH20 0xbebe.&lt;&#x2F;td&gt;&lt;td&gt;0xbebe. 0 cds 0 0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;[1d]&lt;&#x2F;td&gt;&lt;td&gt;5a&lt;&#x2F;td&gt;&lt;td&gt;GAS&lt;&#x2F;td&gt;&lt;td&gt;gas 0xbebe. 0 cds 0 0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;[1e]&lt;&#x2F;td&gt;&lt;td&gt;f4&lt;&#x2F;td&gt;&lt;td&gt;DELEGATECALL&lt;&#x2F;td&gt;&lt;td&gt;suc&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;step-3-copy-the-returned-data-from-the-delegatecall&quot;&gt;Step 3: Copy the Returned Data from the &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;To copy the returndata, we need to provide the arguments for the &lt;code&gt;RETURNDATACOPY&lt;&#x2F;code&gt; opcodes, which are &lt;code&gt;[0, 0, red]&lt;&#x2F;code&gt;, where &lt;code&gt;rds&lt;&#x2F;code&gt; represents size of returndata from the &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;pc&lt;&#x2F;th&gt;&lt;th&gt;op&lt;&#x2F;th&gt;&lt;th&gt;opcode&lt;&#x2F;th&gt;&lt;th&gt;stack&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;[1f]&lt;&#x2F;td&gt;&lt;td&gt;3d&lt;&#x2F;td&gt;&lt;td&gt;RETURNDATASIZE&lt;&#x2F;td&gt;&lt;td&gt;rds suc&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;[20]&lt;&#x2F;td&gt;&lt;td&gt;5f&lt;&#x2F;td&gt;&lt;td&gt;PUSH0&lt;&#x2F;td&gt;&lt;td&gt;0 rds suc&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;[21]&lt;&#x2F;td&gt;&lt;td&gt;5f&lt;&#x2F;td&gt;&lt;td&gt;PUSH0&lt;&#x2F;td&gt;&lt;td&gt;0 0 rds suc&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;[22]&lt;&#x2F;td&gt;&lt;td&gt;3e&lt;&#x2F;td&gt;&lt;td&gt;RETURNDATACOPY&lt;&#x2F;td&gt;&lt;td&gt;suc&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;step-4-return-or-revert&quot;&gt;Step 4: Return or Revert&lt;&#x2F;h3&gt;
&lt;p&gt;Lastly, we need to return the data or revert the transaction based on whether the &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; is successful. There is no &lt;code&gt;if&#x2F;else&lt;&#x2F;code&gt; in opcodes, so we need to use &lt;code&gt;JUMPI&lt;&#x2F;code&gt; and &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; instead. The arguments for &lt;code&gt;JUMPI&lt;&#x2F;code&gt; is &lt;code&gt;[0x2a, suc]&lt;&#x2F;code&gt;, where &lt;code&gt;0x2a&lt;&#x2F;code&gt; is the destination of the conditional jump.&lt;&#x2F;p&gt;
&lt;p&gt;We also need to prepare the argument &lt;code&gt;[0, rds]&lt;&#x2F;code&gt; for &lt;code&gt;REVERT&lt;&#x2F;code&gt; and &lt;code&gt;RETURN&lt;&#x2F;code&gt; opcodes before the &lt;code&gt;JUMPI&lt;&#x2F;code&gt;, otherwise we have to prepare them twice. We cannot avoid the &lt;code&gt;SWAP&lt;&#x2F;code&gt; operation, because we can only get &lt;code&gt;rds&lt;&#x2F;code&gt; after the &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;pc&lt;&#x2F;th&gt;&lt;th&gt;op&lt;&#x2F;th&gt;&lt;th&gt;opcode&lt;&#x2F;th&gt;&lt;th&gt;stack&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;[23]&lt;&#x2F;td&gt;&lt;td&gt;5f&lt;&#x2F;td&gt;&lt;td&gt;PUSH0&lt;&#x2F;td&gt;&lt;td&gt;0 suc&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;[24]&lt;&#x2F;td&gt;&lt;td&gt;3d&lt;&#x2F;td&gt;&lt;td&gt;RETURNDATASIZE&lt;&#x2F;td&gt;&lt;td&gt;rds 0 suc&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;[25]&lt;&#x2F;td&gt;&lt;td&gt;91&lt;&#x2F;td&gt;&lt;td&gt;SWAP2&lt;&#x2F;td&gt;&lt;td&gt;suc 0 rds&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;[26]&lt;&#x2F;td&gt;&lt;td&gt;602a&lt;&#x2F;td&gt;&lt;td&gt;PUSH1 0x2a&lt;&#x2F;td&gt;&lt;td&gt;0x2a suc 0 rds&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;[27]&lt;&#x2F;td&gt;&lt;td&gt;57&lt;&#x2F;td&gt;&lt;td&gt;JUMPI&lt;&#x2F;td&gt;&lt;td&gt;0 rds&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;[29]&lt;&#x2F;td&gt;&lt;td&gt;fd&lt;&#x2F;td&gt;&lt;td&gt;REVERT&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;[2a]&lt;&#x2F;td&gt;&lt;td&gt;5b&lt;&#x2F;td&gt;&lt;td&gt;JUMPDEST&lt;&#x2F;td&gt;&lt;td&gt;0 rds&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;[2b]&lt;&#x2F;td&gt;&lt;td&gt;f3&lt;&#x2F;td&gt;&lt;td&gt;RETURN&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;In the end, we arrived at the runtime code for Minimal Proxy Contract with &lt;code&gt;PUSH0&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;365f5f375f5f365f73bebebebebebebebebebebebebebebebebebebebe5af43d5f5f3e5f3d91602a57fd5bf3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The length of the runtime code is &lt;code&gt;44&lt;&#x2F;code&gt; bytes, which reduced &lt;code&gt;1&lt;&#x2F;code&gt; byte from the previous Minimal Proxy Contract. Moreover, it replaced the &lt;code&gt;RETURNDATASIZE&lt;&#x2F;code&gt; and &lt;code&gt;DUP&lt;&#x2F;code&gt; operations with &lt;code&gt;PUSH0&lt;&#x2F;code&gt;, which saves gas and increases the readability of the code. In summary, the new Minimal Proxy Contract reduces &lt;code&gt;200&lt;&#x2F;code&gt; gas at deployment and &lt;code&gt;5&lt;&#x2F;code&gt; gas at runtime, while remaining the same functionalities as the old one.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Because the new minimal proxy contract uses &lt;code&gt;PUSH0&lt;&#x2F;code&gt; opcode, it can only be deployed after the Shanghai Upgrade. It behaves the same as the previous Minimal Proxy Contract.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The new proxy contract standard is identical to the previous one (ERC-1167). Here are the security considerations when using minimal proxy contracts:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Non-Upgradability&lt;&#x2F;strong&gt;: Minimal Proxy Contracts delegate their logic to another contract (often termed the &quot;implementation&quot; or &quot;logic&quot; contract). This delegation is fixed upon deployment, meaning you can&#x27;t change which implementation contract the proxy delegates to after its creation.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Initialization Concerns&lt;&#x2F;strong&gt;: Proxy contracts lack constructors, so you need to use an initialization function after deployment. Skipping this step could leave the contract unsafe.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Safety of Logic Contract&lt;&#x2F;strong&gt;: Vulnerabilities in the logic contract affect all associated proxy contracts.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Transparency Issues&lt;&#x2F;strong&gt;: Because of its complexity, users might see the proxy as an empty contract, making it challenging to trace back to the actual logic contract.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Token Bound Function Oracle AMM</title>
        <published>2023-09-03T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Elaine Zhang</name><uri>https://github.com/lanyinzly</uri><email>lz8aj@virginia.edu</email>
	</author>
	
	<author>
		<name>Jerry</name><email>jerrymindflow@gmail.com</email>
	</author>
	
	<author>
		<name>Amandafanny</name><email>amandafanny200@gmail.com</email>
	</author>
	
	<author>
		<name>Shouhao Wong</name><uri>https://github.com/wangshouh</uri><email>wongshouhao@outlook.com</email>
	</author>
	
	<author>
		<name>0xPoet</name><email>0xpoets@gmail.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7527/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7527-token-bound-function-oracle-amm-contract/15950" />
        

        <id>https://wg-eips.ritovision.com/7527/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7527"
            label="ERC-7527" />
        

        
        

        
        <summary type="html">Interfaces that wrap FT to NFT and unwrap NFT to FT based on an embedded Function Oracle AMM</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7527/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal outlines interfaces for wrapping &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; or ETH to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and unwrap ERC-721 to ERC-20 or ETH. A function oracle feeds mint&#x2F;burn prices based on an embedded equation of Function Oracle Automated Market Maker(FOAMM), which executes and clears the mint and burn of NFT.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Liquidity can be a significant challenge in decentralized systems, especially for unique or less commonly traded tokens like NFTs. To foster a trustless NFT ecosystem, the motivation behind Function Oracle Automated Market Maker(FOAMM) is to provide automated pricing solutions for NFTs with liquidity through transparent, smart contract mechanisms.&lt;&#x2F;p&gt;
&lt;p&gt;This ERC provides innovative solutions for the following aspects:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Automated Price Discovery&lt;&#x2F;li&gt;
&lt;li&gt;Liquidity Enhancement&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;automated-price-discovery&quot;&gt;Automated Price Discovery&lt;&#x2F;h3&gt;
&lt;p&gt;Transactions under FOAMM can occur without the need for a matching counterparty. When interacting directly with the pool, FOAMM automatically feeds prices based on the oracle with predefined function.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;liquidity-enhancement&quot;&gt;Liquidity Enhancement&lt;&#x2F;h3&gt;
&lt;p&gt;In traditional DEX models, liquidity is supplied by external parties, known as Liquidity Providers(LP). These LPs deposit tokens into liquidity pools, facilitating exchanges by providing the liquidity. The removal or withdrawal of these LPs can introduce significant volatility, as it directly impacts the available liquidity in the market.&lt;&#x2F;p&gt;
&lt;p&gt;In a FOAMM system, the liquidity is added or removed internally through &lt;code&gt;wrap&lt;&#x2F;code&gt; or &lt;code&gt;unwrap&lt;&#x2F;code&gt;. FOAMM reduces reliance on external LPs and mitigates the risk of volatility caused by their sudden withdrawal, as the liquidity is continuously replenished and maintained through ongoing participant interactions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;Contract Interfaces:&lt;&#x2F;p&gt;
&lt;p&gt;Three interfaces are included here: &lt;code&gt;Agency&lt;&#x2F;code&gt;, &lt;code&gt;App&lt;&#x2F;code&gt;, and &lt;code&gt;Factory&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;Agency&lt;&#x2F;code&gt; and &lt;code&gt;App&lt;&#x2F;code&gt; MAY be implemented by the same contract or MAY be separately implemented. If separately implemented, they SHALL be mutually bounded and not upgradable after initialization.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;Agency&lt;&#x2F;code&gt; and &lt;code&gt;App&lt;&#x2F;code&gt; should implement &lt;code&gt;iconstructor&lt;&#x2F;code&gt; interface to initialize the parameters within the contract and validate the configuration parameters. If factory is used to deploy &lt;code&gt;Agency&lt;&#x2F;code&gt; and &lt;code&gt;App&lt;&#x2F;code&gt;, factory will automatically call the two functions when deploying.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;App&lt;&#x2F;code&gt; SHALL implement &lt;code&gt;onlyAgency()&lt;&#x2F;code&gt; modifier and &lt;code&gt;mint&lt;&#x2F;code&gt; and &lt;code&gt;burn&lt;&#x2F;code&gt; SHALL apply &lt;code&gt;onlyAgency()&lt;&#x2F;code&gt; as a modifier, which restricts calls to &lt;code&gt;Mint&lt;&#x2F;code&gt; and &lt;code&gt;Burn&lt;&#x2F;code&gt; only have effect if they are called through the corresponding &lt;code&gt;Agency&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;Agency&lt;&#x2F;code&gt; is OPTIONAL to implement &lt;code&gt;onlyApp()&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;Factory&lt;&#x2F;code&gt; interface is OPTIONAL. It is most useful if &lt;code&gt;Agency&lt;&#x2F;code&gt; and &lt;code&gt;App&lt;&#x2F;code&gt; need to be deployed repeatedly.&lt;&#x2F;p&gt;
&lt;p&gt;Function Oracle is implemented through &lt;code&gt;getWrapOracle&lt;&#x2F;code&gt; and &lt;code&gt;getUnwrapOracle&lt;&#x2F;code&gt;, which feeds prices based on parameters and mathematical equations defined in the functions.&lt;&#x2F;p&gt;
&lt;p&gt;FOAMM is implemented through &lt;code&gt;wrap&lt;&#x2F;code&gt; and &lt;code&gt;unwrap&lt;&#x2F;code&gt;, which calls &lt;code&gt;getWrapOracle&lt;&#x2F;code&gt; and &lt;code&gt;getUnwrapOracle&lt;&#x2F;code&gt; to get the feed and automatically clears. To perform &lt;code&gt;wrap&lt;&#x2F;code&gt;, FOAMM receives the premium and initiate &lt;code&gt;mint&lt;&#x2F;code&gt; in &lt;code&gt;App&lt;&#x2F;code&gt;. To perform &lt;code&gt;unwrap&lt;&#x2F;code&gt;, FOAMM transfer the premium and initiate &lt;code&gt;burn&lt;&#x2F;code&gt; in &lt;code&gt;App&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;Agency&lt;&#x2F;code&gt; serves as a single entry point for all &lt;code&gt;mint&lt;&#x2F;code&gt; and &lt;code&gt;burn&lt;&#x2F;code&gt; transfer.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;agency-interface&quot;&gt;Agency Interface&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pragma solidity ^0.8.20;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @dev The settings of the agency.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @param currency The address of the currency. If `currency` is 0, the currency is Ether.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @param basePremium The base premium of the currency.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @param feeRecipient The address of the fee recipient.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @param mintFeePercent The fee of minting.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @param burnFeePercent The fee of burning.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;struct Asset {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address currency;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    uint256 basePremium;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address feeRecipient;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    uint16 mintFeePercent;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    uint16 burnFeePercent;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;interface IERC7527Agency {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev Allows the account to receive Ether&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * Accounts MUST implement a `receive` function.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * Accounts MAY perform arbitrary logic to restrict conditions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * under which Ether can be received.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    receive() external payable;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev Emitted when `tokenId` token is wrapped.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param to The address of the recipient of the newly created non-fungible token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param tokenId The identifier of the newly created non-fungible token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param premium The premium of wrapping.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param fee The fee of wrapping.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    event Wrap(address indexed to, uint256 indexed tokenId, uint256 premium, uint256 fee);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev Emitted when `tokenId` token is unwrapped.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param to The address of the recipient of the currency.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param tokenId The identifier of the non-fungible token to unwrap.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param premium The premium of unwrapping.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param fee The fee of unwrapping.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    event Unwrap(address indexed to, uint256 indexed tokenId, uint256 premium, uint256 fee);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev Constructor of the instance contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function iconstructor() external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev Wrap some amount of currency into a non-fungible token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param to The address of the recipient of the newly created non-fungible token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param data The data to encode into ifself and the newly created non-fungible token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @return The identifier of the newly created non-fungible token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function wrap(address to, bytes calldata data) external payable returns (uint256);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev Unwrap a non-fungible token into some amount of currency.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * Todo: event&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param to The address of the recipient of the currency.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param tokenId The identifier of the non-fungible token to unwrap.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param data The data to encode into ifself and the non-fungible token with identifier `tokenId`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function unwrap(address to, uint256 tokenId, bytes calldata data) external payable;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev Returns the strategy of the agency.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @return app The address of the app.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @return asset The asset of the agency.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @return attributeData The attributeData of the agency.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function getStrategy() external view returns (address app, Asset memory asset, bytes memory attributeData);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev Returns the premium and fee of wrapping.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param data The data to encode to calculate the premium and fee of wrapping.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @return premium The premium of wrapping.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @return fee The fee of wrapping.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function getWrapOracle(bytes memory data) external view returns (uint256 premium, uint256 fee);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev Returns the premium and fee of unwrapping.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param data The data to encode to calculate the premium and fee of unwrapping.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @return premium The premium of wrapping.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @return fee The fee of wrapping.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function getUnwrapOracle(bytes memory data) external view returns (uint256 premium, uint256 fee);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev OPTIONAL - This method can be used to improve usability and clarity of Agency, but interfaces and other contracts MUST NOT expect these values to be present.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @return the description of the agency, such as how `getWrapOracle()` and `getUnwrapOracle()` are calculated.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function description() external view returns (string memory);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;app-interface&quot;&gt;App Interface&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;ERC7527App&lt;&#x2F;code&gt; SHALL inherit &lt;code&gt;name&lt;&#x2F;code&gt; from interface &lt;code&gt;ERC721Metadata&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pragma solidity ^0.8.20;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;interface IERC7527App {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev Returns the maximum supply of the non-fungible token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function getMaxSupply() external view returns (uint256);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev Returns the name of the non-fungible token with identifier `id`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param id The identifier of the non-fungible token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function getName(uint256 id) external view returns (string memory);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev Returns the agency of the non-fungible token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function getAgency() external view returns (address payable);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev Constructor of the instance contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function iconstructor() external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev Sets the agency of the non-fungible token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param agency The agency of the non-fungible token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function setAgency(address payable agency) external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev Mints a non-fungible token to `to`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param to The address of the recipient of the newly created non-fungible token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param data The data to encode into the newly created non-fungible token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function mint(address to, bytes calldata data) external returns (uint256);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev Burns a non-fungible token with identifier `tokenId`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param tokenId The identifier of the non-fungible token to burn.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param data The data to encode into the non-fungible token with identifier `tokenId`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function burn(uint256 tokenId, bytes calldata data) external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Token ID can be specified in &lt;code&gt;data&lt;&#x2F;code&gt; parameter of &lt;code&gt;mint&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;factory-interface&quot;&gt;Factory Interface&lt;&#x2F;h3&gt;
&lt;p&gt;OPTIONAL - This interface can be used to deploy App and Agency, but interfaces and other contracts MUST NOT expect this interface to be present.&lt;&#x2F;p&gt;
&lt;p&gt;If a factory is needed to deploy bounded App and Agency, the factory SHALL implement the following interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pragma solidity ^0.8.20;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;import {Asset} from &amp;quot;.&#x2F;IERC7527Agency.sol&amp;quot;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @dev The settings of the agency.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @param implementation The address of the agency implementation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @param asset The parameter of asset of the agency.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @param immutableData The immutable data are stored in the code region of the created proxy contract of agencyImplementation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @param initData If init data is not empty, calls proxy contract of agencyImplementation with this data.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;struct AgencySettings {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address payable implementation;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Asset asset;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytes immutableData;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytes initData;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @dev The settings of the app.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @param implementation The address of the app implementation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @param immutableData The immutable data are stored in the code region of the created proxy contract of appImplementation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @param initData If init data is not empty, calls proxy contract of appImplementation with this data.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;struct AppSettings {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address implementation;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytes immutableData;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytes initData;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;interface IERC7527Factory {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev Deploys a new agency and app clone and initializes both.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param agencySettings The settings of the agency.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param appSettings The settings of the app.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param data The data is additional data, it has no specified format and it is sent in call to `factory`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @return appInstance The address of the created proxy contract of appImplementation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @return agencyInstance The address of the created proxy contract of agencyImplementation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function deployWrap(AgencySettings calldata agencySettings, AppSettings calldata appSettings, bytes calldata data)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        returns (address, address);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;prior-interfaces&quot;&gt;Prior Interfaces&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5679&#x2F;&quot;&gt;ERC-5679&lt;&#x2F;a&gt; proposed &lt;code&gt;IERC5679Ext721&lt;&#x2F;code&gt; interface for introducing a consistent way to extend &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; token standards for minting and burning. To ensure the backward compatibility, considering some contracts which do not implement &lt;code&gt;ERC721TokenReceiver&lt;&#x2F;code&gt;, &lt;code&gt;IERC7527App&lt;&#x2F;code&gt; employ &lt;code&gt;mint&lt;&#x2F;code&gt; function instead of &lt;code&gt;safeMint&lt;&#x2F;code&gt;. To ensure the safety and the uniqueness of mutual bound, the &lt;code&gt;_from&lt;&#x2F;code&gt; parameter of the &lt;code&gt;burn&lt;&#x2F;code&gt; function in &lt;code&gt;IERC5679Ext721&lt;&#x2F;code&gt; must be the contract address of the bounded agency. Thus, &lt;code&gt;burn&lt;&#x2F;code&gt; function in &lt;code&gt;IERC7527App&lt;&#x2F;code&gt; does not contain the &lt;code&gt;_from&lt;&#x2F;code&gt; parameter.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;mutual-bound&quot;&gt;Mutual Bound&lt;&#x2F;h3&gt;
&lt;p&gt;Implement contracts for &lt;code&gt;IERC7527App&lt;&#x2F;code&gt; and &lt;code&gt;IERC7527Agency&lt;&#x2F;code&gt; so that they are each other&#x27;s only owner. The wrap process is to check the premium amount of the fungible token received and then mint non-fungible token in the App. Only the owner or an approver of the non-fungible token can unwrap it.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;implementation-diversity&quot;&gt;Implementation Diversity&lt;&#x2F;h3&gt;
&lt;p&gt;Users can customize function and fee percentage when implement the Agency and the App interfaces.&lt;&#x2F;p&gt;
&lt;p&gt;Different Agency implementations have distinct wrap, unwrap function logic, and different oracleFunction. Users can customize the currency, initial price, fee receiving address, fee rate, etc., to initialize the Agency contract.&lt;&#x2F;p&gt;
&lt;p&gt;Different App implementations cater to various use cases. Users can initialize the App contract.&lt;&#x2F;p&gt;
&lt;p&gt;Factory is not required. Factory implementation is need-based. Users can deploy their own contracts by selecting different Agency implementations and different App implementations through the Factory, combining them to create various products.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;currency-types&quot;&gt;Currency types&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;currency&lt;&#x2F;code&gt; in &lt;code&gt;IERC7527Agency&lt;&#x2F;code&gt; is the address of fungible token. &lt;code&gt;Asset&lt;&#x2F;code&gt; can only define one type of &lt;code&gt;currency&lt;&#x2F;code&gt; as the fungible token in the system. &lt;code&gt;currency&lt;&#x2F;code&gt; supports various kinds of fungible tokens including ETH and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;token-id&quot;&gt;Token id&lt;&#x2F;h3&gt;
&lt;p&gt;For each wrap process, a unique &lt;code&gt;tokenId&lt;&#x2F;code&gt; should be generated. This &lt;code&gt;tokenId&lt;&#x2F;code&gt; is essential for verification during the unwrap process. It also serves as the exclusive credential for the token. This mechanism ensures the security of assets in contracts.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;wrap-and-mint&quot;&gt;Wrap and Mint&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;strategy&lt;&#x2F;code&gt; is set while implementing the Agency interface, and it should be ensured not upgradable once deployed.&lt;&#x2F;p&gt;
&lt;p&gt;When executing the &lt;code&gt;wrap&lt;&#x2F;code&gt; function, the predetermined strategy parameters are passed into the &lt;code&gt;getWrapOracle&lt;&#x2F;code&gt; function to fetch the current premium and fee. The respective premium is then transferred to the Agency instance; the fee, according to &lt;code&gt;mintFeePercent&lt;&#x2F;code&gt; is transferred to &lt;code&gt;feeRecipient&lt;&#x2F;code&gt;. Subsequently, the App mints the NFT to the user&#x27;s address.&lt;&#x2F;p&gt;
&lt;p&gt;Premium(tokens) transferred into the Agency cannot be moved, except through the unwrap process. The act of executing wrap is the sole trigger for the mint process.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;unwrap-and-burn&quot;&gt;Unwrap and Burn&lt;&#x2F;h3&gt;
&lt;p&gt;When executing the &lt;code&gt;unwrap&lt;&#x2F;code&gt; function, predetermined strategy parameters are passed into the &lt;code&gt;getUnwrapOracle&lt;&#x2F;code&gt; function to read the current premium and fee. The App burns the NFT. Then, the corresponding premium, subtracting the fee according to &lt;code&gt;burnFeePercent&lt;&#x2F;code&gt;, is then transferred to the user&#x27;s address; the fee is transferred to &lt;code&gt;feeRecipient&lt;&#x2F;code&gt;. The act of executing &#x27;unwrap&#x27; is the sole trigger for the &#x27;burn&#x27; process.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;two-interfaces-use-together&quot;&gt;Two interfaces use together&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;IERC7527App&lt;&#x2F;code&gt; and &lt;code&gt;IERC7527Agency&lt;&#x2F;code&gt; can be implemented together for safety, but they can be independently implemented before initialization for flexibiliy.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;pricing&quot;&gt;Pricing&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;getWrapOracle&lt;&#x2F;code&gt; and &lt;code&gt;getUnwrapOracle&lt;&#x2F;code&gt; are used to fetch the current premium and fee. They implement on-chain price fetching through oracle functions. They not only support fetching the premium and fee during the wrap and unwrap processes but also support other contracts calling them to obtain the premium and fee, such as lending contracts.&lt;&#x2F;p&gt;
&lt;p&gt;They can support function oracle based on on-chain and off-chain parameters, but on-chain parameters are suggested only for consensus of on-chain reality.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;initdata-and-iconstructor&quot;&gt;&lt;code&gt;initData&lt;&#x2F;code&gt; and &lt;code&gt;iconstructor&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;During the deployment of &lt;code&gt;App&lt;&#x2F;code&gt; and &lt;code&gt;Agency&lt;&#x2F;code&gt; by the Factory, the Factory uses &lt;code&gt;initData&lt;&#x2F;code&gt; as Calldata to call the &lt;code&gt;Agency&lt;&#x2F;code&gt; and &lt;code&gt;App&lt;&#x2F;code&gt; contracts and also invokes the &lt;code&gt;iconstructor&lt;&#x2F;code&gt; functions within &lt;code&gt;App&lt;&#x2F;code&gt; and &lt;code&gt;Agency&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The initData is mainly used to call the parameterized initialization functions, while &lt;code&gt;iconstructor&lt;&#x2F;code&gt; is often used to validate configuration parameters and non-parameterized initialization functions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pragma solidity ^0.8.20;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;import {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ERC721Enumerable,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ERC721,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    IERC721Enumerable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;} from &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC721&#x2F;extensions&#x2F;ERC721Enumerable.sol&amp;quot;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;import {IERC20} from &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC20&#x2F;IERC20.sol&amp;quot;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;import {Address} from &amp;quot;@openzeppelin&#x2F;contracts&#x2F;utils&#x2F;Address.sol&amp;quot;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;import {ClonesWithImmutableArgs} from &amp;quot;clones-with-immutable-args&#x2F;ClonesWithImmutableArgs.sol&amp;quot;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;import {IERC7527App} from &amp;quot;.&#x2F;interfaces&#x2F;IERC7527App.sol&amp;quot;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;import {IERC7527Agency, Asset} from &amp;quot;.&#x2F;interfaces&#x2F;IERC7527Agency.sol&amp;quot;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;import {IERC7527Factory, AgencySettings, AppSettings} from &amp;quot;.&#x2F;interfaces&#x2F;IERC7527Factory.sol&amp;quot;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;contract ERC7527Agency is IERC7527Agency {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    using Address for address payable;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    receive() external payable {}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function iconstructor() external override pure {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (, Asset memory _asset,) = getStrategy();&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        require(_asset.basePremium != 0, &amp;quot;LnModule: zero basePremium&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function unwrap(address to, uint256 tokenId, bytes calldata data) external payable override {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (address _app, Asset memory _asset,) = getStrategy();&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        require(_isApprovedOrOwner(_app, msg.sender, tokenId), &amp;quot;LnModule: not owner&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        IERC7527App(_app).burn(tokenId, data);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 _sold = IERC721Enumerable(_app).totalSupply();&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (uint256 premium, uint256 burnFee) = getUnwrapOracle(abi.encode(_sold));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _transfer(address(0), payable(to), premium - burnFee);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _transfer(address(0), _asset.feeRecipient, burnFee);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        emit Unwrap(to, tokenId, premium, burnFee);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function wrap(address to, bytes calldata data) external payable override returns (uint256) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (address _app, Asset memory _asset,) = getStrategy();&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 _sold = IERC721Enumerable(_app).totalSupply();&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (uint256 premium, uint256 mintFee) = getWrapOracle(abi.encode(_sold));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        require(msg.value &amp;gt;= premium + mintFee, &amp;quot;ERC7527Agency: insufficient funds&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _transfer(address(0), _asset.feeRecipient, mintFee);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        if (msg.value &amp;gt; premium + mintFee) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            _transfer(address(0), payable(msg.sender), msg.value - premium - mintFee);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 id_ = IERC7527App(_app).mint(to, data);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        require(_sold + 1 == IERC721Enumerable(_app).totalSupply(), &amp;quot;ERC7527Agency: Reentrancy&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        emit Wrap(to, id_, premium, mintFee);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return id_;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function getStrategy() public pure override returns (address app, Asset memory asset, bytes memory attributeData) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 offset = _getImmutableArgsOffset();&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address currency;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 basePremium;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address payable feeRecipient;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint16 mintFeePercent;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint16 burnFeePercent;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        assembly {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            app := shr(0x60, calldataload(add(offset, 0)))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            currency := shr(0x60, calldataload(add(offset, 20)))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            basePremium := calldataload(add(offset, 40))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            feeRecipient := shr(0x60, calldataload(add(offset, 72)))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            mintFeePercent := shr(0xf0, calldataload(add(offset, 92)))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            burnFeePercent := shr(0xf0, calldataload(add(offset, 94)))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        asset = Asset(currency, basePremium, feeRecipient, mintFeePercent, burnFeePercent);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        attributeData = &amp;quot;&amp;quot;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function getUnwrapOracle(bytes memory data) public pure override returns (uint256 premium, uint256 fee) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 input = abi.decode(data, (uint256));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (, Asset memory _asset,) = getStrategy();&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        premium = _asset.basePremium + input * _asset.basePremium &#x2F; 100;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        fee = premium * _asset.burnFeePercent &#x2F; 10000;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function getWrapOracle(bytes memory data) public pure override returns (uint256 premium, uint256 fee) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 input = abi.decode(data, (uint256));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (, Asset memory _asset,) = getStrategy();&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        premium = _asset.basePremium + input * _asset.basePremium &#x2F; 100;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        fee = premium * _asset.mintFeePercent &#x2F; 10000;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function _transfer(address currency, address recipient, uint256 premium) internal {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        if (currency == address(0)) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            payable(recipient).sendValue(premium);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        } else {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            IERC20(currency).transfer(recipient, premium);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function _isApprovedOrOwner(address app, address spender, uint256 tokenId) internal view virtual returns (bool) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        IERC721Enumerable _app = IERC721Enumerable(app);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address _owner = _app.ownerOf(tokenId);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return (spender == _owner || _app.isApprovedForAll(_owner, spender) || _app.getApproved(tokenId) == spender);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @return offset The offset of the packed immutable args in calldata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function _getImmutableArgsOffset() internal pure returns (uint256 offset) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &#x2F;&#x2F; solhint-disable-next-line no-inline-assembly&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        assembly {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            offset := sub(calldatasize(), add(shr(240, calldataload(sub(calldatasize(), 2))), 2))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;contract ERC7527App is ERC721Enumerable, IERC7527App {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    constructor() ERC721(&amp;quot;ERC7527App&amp;quot;, &amp;quot;EA&amp;quot;) {}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address payable private _oracle;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    modifier onlyAgency() {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        require(msg.sender == _getAgency(), &amp;quot;only agency&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function iconstructor() external {}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function getName(uint256) external pure returns (string memory) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return &amp;quot;App&amp;quot;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function getMaxSupply() public pure override returns (uint256) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return 100;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function getAgency() external view override returns (address payable) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return _getAgency();&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function setAgency(address payable oracle) external override {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        require(_getAgency() == address(0), &amp;quot;already set&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _oracle = oracle;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function mint(address to, bytes calldata data) external override onlyAgency returns (uint256 tokenId) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        require(totalSupply() &amp;lt; getMaxSupply(), &amp;quot;max supply reached&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        tokenId = abi.decode(data, (uint256));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _mint(to, tokenId);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function burn(uint256 tokenId, bytes calldata) external override onlyAgency {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _burn(tokenId);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function _getAgency() internal view returns (address payable) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return _oracle;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;contract ERC7527Factory is IERC7527Factory {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    using ClonesWithImmutableArgs for address;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function deployWrap(AgencySettings calldata agencySettings, AppSettings calldata appSettings, bytes calldata)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        override&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        returns (address appInstance, address agencyInstance)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        appInstance = appSettings.implementation.clone(appSettings.immutableData);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            agencyInstance = address(agencySettings.implementation).clone(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                abi.encodePacked(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    appInstance,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    agencySettings.asset.currency,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    agencySettings.asset.basePremium,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    agencySettings.asset.feeRecipient,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    agencySettings.asset.mintFeePercent,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    agencySettings.asset.burnFeePercent,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    agencySettings.immutableData&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            );&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        IERC7527App(appInstance).setAgency(payable(agencyInstance));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        IERC7527Agency(payable(agencyInstance)).iconstructor();&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        IERC7527App(appInstance).iconstructor();&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        if (agencySettings.initData.length != 0) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            (bool success, bytes memory result) = agencyInstance.call(agencySettings.initData);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if (!success) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                assembly {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    revert(add(result, 32), mload(result))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        if (appSettings.initData.length != 0) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            (bool success, bytes memory result) = appInstance.call(appSettings.initData);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if (!success) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                assembly {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    revert(add(result, 32), mload(result))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;fraud-prevention&quot;&gt;Fraud Prevention&lt;&#x2F;h3&gt;
&lt;p&gt;Consider the following for the safety of the contracts:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Check whether modifiers &lt;code&gt;onlyAgency()&lt;&#x2F;code&gt; and &lt;code&gt;onlyApp()&lt;&#x2F;code&gt; are proporly implemented and applied.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Check the function strategies.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Check whether the contracts can be subject to re-entrancy attack.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Check whether all non-fungible tokens can be unwrapped with the premium calculated from FOAMM.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Upgrade block proposer election to Whisk</title>
        <published>2023-09-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>George Kadianakis</name><uri>https://github.com/asn-d6</uri>
	</author>
	
	<author>
		<name>Justin Drake</name><uri>https://github.com/JustinDrake</uri>
	</author>
	
	<author>
		<name>dapplion</name><uri>https://github.com/dapplion</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7441/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7441-upgrade-block-proposer-election-to-whisk-ssle/15316" />
        

        <id>https://wg-eips.ritovision.com/7441/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:7441"
            label="EIP-7441" />
        

        
        

        
        <summary type="html">Allow elected block proposers to remain private until block publishing, to prevent DoS attacks</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7441/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Upgrades the block proposer election mechanism to Whisk, a single secret leader election (SSLE) protocol. Currently, block proposers are publicly known in advance, sufficiently to allow sequential DoS attacks that could disable Ethereum. This upgrade allows the next block proposer to remain secret until its block is published.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The beacon chain currently elects the next 32 block proposers at the beginning of each epoch. The results of this election are public and everyone gets to learn the identity of those future block proposers.&lt;&#x2F;p&gt;
&lt;p&gt;This information leak enables attackers to launch DoS attacks against each proposer sequentially in an attempt to disable Ethereum.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;execution-layer&quot;&gt;Execution layer&lt;&#x2F;h3&gt;
&lt;p&gt;This requires no changes to the Execution Layer.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;consensus-layer&quot;&gt;Consensus layer&lt;&#x2F;h3&gt;
&lt;p&gt;The protocol can be summarized in the following concurrent steps:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Validators register a tracker and unique commitment on their first proposal after the fork&lt;&#x2F;li&gt;
&lt;li&gt;At the start of a shuffling phase a list of candidate trackers is selected using public randomness from RANDAO&lt;&#x2F;li&gt;
&lt;li&gt;During each shuffling phase each proposer shuffles a subset of the candidate trackers using private randomness&lt;&#x2F;li&gt;
&lt;li&gt;After each shuffling phase an ordered list of proposer trackers is selected from the candidate set using RANDAO&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The full specification of the proposed change can be found in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;a39abe388bc2d1abd5b4fd62fd18aed497956b30&#x2F;specs&#x2F;_features&#x2F;whisk&#x2F;beacon-chain.md&quot;&gt;&lt;code&gt;&#x2F;_features&#x2F;whisk&#x2F;beacon-chain.md&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;. In summary:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Update &lt;code&gt;BeaconState&lt;&#x2F;code&gt; with fields needed to track validator trackers, commitments, and the two rounds of candidate election.&lt;&#x2F;li&gt;
&lt;li&gt;Add &lt;code&gt;select_whisk_candidate_trackers&lt;&#x2F;code&gt; to compute the next vector of candidates from the validator set.&lt;&#x2F;li&gt;
&lt;li&gt;Add &lt;code&gt;select_whisk_proposer_trackers&lt;&#x2F;code&gt; to compute the next vector of proposers from current candidates.&lt;&#x2F;li&gt;
&lt;li&gt;Add &lt;code&gt;process_whisk_updates&lt;&#x2F;code&gt; to epoch processing logic.&lt;&#x2F;li&gt;
&lt;li&gt;Add &lt;code&gt;process_whisk_opening_proof&lt;&#x2F;code&gt; to validate block proposer has knowledge of this slot&#x27;s elected tracker.&lt;&#x2F;li&gt;
&lt;li&gt;Modify &lt;code&gt;process_block_header&lt;&#x2F;code&gt; to not assert proposer election with &lt;code&gt;get_beacon_proposer_index&lt;&#x2F;code&gt;, instead assert valid opening proof.&lt;&#x2F;li&gt;
&lt;li&gt;Update &lt;code&gt;BeaconBlockBody&lt;&#x2F;code&gt; with fields to submit opening proof, shuffled trackers with proof, and tracker registration with proof.&lt;&#x2F;li&gt;
&lt;li&gt;Add &lt;code&gt;get_shuffle_indices&lt;&#x2F;code&gt; to compute pre-shuffle candidate selection&lt;&#x2F;li&gt;
&lt;li&gt;Add &lt;code&gt;process_shuffled_trackers&lt;&#x2F;code&gt; to submit shuffled candidate trackers.&lt;&#x2F;li&gt;
&lt;li&gt;Add &lt;code&gt;process_whisk&lt;&#x2F;code&gt; to block processing logic.&lt;&#x2F;li&gt;
&lt;li&gt;Modify &lt;code&gt;apply_deposit&lt;&#x2F;code&gt; to register an initial unique tracker and commitment without entropy.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;fields-per-validator&quot;&gt;Fields per validator&lt;&#x2F;h3&gt;
&lt;p&gt;Whisk requires having one tracker &lt;code&gt;(rG,krG)&lt;&#x2F;code&gt; and one unique commitment &lt;code&gt;kG&lt;&#x2F;code&gt; per validator. Both are updated only once on a validator&#x27;s first proposal after the fork.&lt;&#x2F;p&gt;
&lt;p&gt;Trackers are registered with a randomized base &lt;code&gt;(rG,krG)&lt;&#x2F;code&gt; to make it harder for adversaries to track them through shuffling gates. It can become an issue if the set of honest shufflers is small.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;identity-binding&quot;&gt;Identity binding&lt;&#x2F;h3&gt;
&lt;p&gt;Each tracker must be bound to a validator&#x27;s identity to prevent multiple parties to claim the same proposer slot. Otherwise, it would allow proposers to sell their proposer slot, and cause fork-choice issues if two competing blocks appear.&lt;&#x2F;p&gt;
&lt;p&gt;Whisk does identity binding by storing a commitment to the tracker&#x27;s secret &lt;code&gt;kG&lt;&#x2F;code&gt; in the validator record. Storing the commitment also ensures the uniqueness of &lt;code&gt;k&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Alternatively, identity binding can be achieved by forcing the hash prefix of &lt;code&gt;hash(kG)&lt;&#x2F;code&gt; to match its validator index. However, validators would have to brute force &lt;code&gt;k&lt;&#x2F;code&gt; making bootstrap of the system harder for participants with fewer computational resources.&lt;&#x2F;p&gt;
&lt;p&gt;Identity binding can also be achieved by setting &lt;code&gt;k = hash(nonce + pubkey)&lt;&#x2F;code&gt;. However, proposers will need to reveal &lt;code&gt;k&lt;&#x2F;code&gt; and be de-anonymized for repeated proposals on adjacent shuffling phases.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;alternative-non-single-secret-election&quot;&gt;Alternative: non-single secret election&lt;&#x2F;h3&gt;
&lt;p&gt;Secret non-single leader election could be based on protocol engineering rather than cryptography, thus much simpler and cheaper than Whisk. However, it complicates the fork-choice and opens it up to potential MEV time-buying attacks, making it an unsuitable option at the time of writing.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;alternative-network-anonymity&quot;&gt;Alternative: network anonymity&lt;&#x2F;h3&gt;
&lt;p&gt;Privacy-preserving networking protocols like Dandelion or Dandelion++ increase the privacy of network participants but not sufficiently for Ethereum&#x27;s use case.&lt;&#x2F;p&gt;
&lt;p&gt;SASSAFRAS is a simpler alternative SSLE protocol consensus-wise, but it relies on a network anonymity layer. Its specific trade-offs do not fit Ethereum&#x27;s overall threat model better than Whisk.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces backward incompatible changes to the block validation rule set on the consensus layer and must be accompanied by a hard fork.&lt;&#x2F;p&gt;
&lt;p&gt;PBS participants (e.g. builders) will not know the next proposer validator index to use a specific pre-registered fee recipient; unless the proposer chooses to reveal itself ahead of time. Block explorers and tooling will not be able to attribute missing slots to a specific validator index.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The shuffling strategy is analyzed in a companion paper and considered sufficiently safe for Whisk&#x27;s use case. The data and computational complexity of this EIP are significant but constant, thus does not open new DoS vectors.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;anonymity-set&quot;&gt;Anonymity set&lt;&#x2F;h3&gt;
&lt;p&gt;The anonymity set in Whisk is the set of 8,192 candidates that did not get selected as proposers. That count of validators corresponds to a smaller number of p2p nodes. Assuming a Pareto principle where &quot;20% of the nodes run 80% of the validators&quot; the anonymity corresponds to 2,108 nodes on average. A bigger candidate pool could make the shuffling strategy unsafe while shuffling more trackers per round would increase the cost of the ZK proofs.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;randao-biasing&quot;&gt;RANDAO biasing&lt;&#x2F;h3&gt;
&lt;p&gt;Whisk uses RANDAO in the candidate selection and proposer selection events, and is susceptible to potential RANDAO biasing attacks by malicious proposers. Whisk security could be made identical to the status quo by spreading the selection events over an entire shuffling period. However, status quo security is not ideal either and it would complicate the protocol further.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Account Abstraction Validation Scope Rules</title>
        <published>2023-09-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Yoav Weiss</name><uri>https://github.com/yoavw</uri>
	</author>
	
	<author>
		<name>Dror Tirosh</name><uri>https://github.com/drortirosh</uri>
	</author>
	
	<author>
		<name>Alex Forshtat</name><uri>https://github.com/forshtat</uri>
	</author>
	
	<author>
		<name>Shahaf Nacson</name><uri>https://github.com/shahafn</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7562/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7562-account-abstraction-validation-scope-rules/16683" />
        

        <id>https://wg-eips.ritovision.com/7562/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7562"
            label="ERC-7562" />
        

        
        

        
        <summary type="html">A set of limitations on validation EVM code to protect Account Abstraction nodes from denial-of-service attacks through unpaid computation.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7562/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This document describes the rules Account Abstraction protocols should follow, during the validation phase of Account Abstraction transactions,
such as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt; &lt;code&gt;UserOperation&lt;&#x2F;code&gt; or RIP-7560 (Native Account Abstraction), which are enforced off-chain by a
block builder or a standalone bundler, and the rationale behind each one of them.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;With Account-Abstraction, instead of hard-coded logic for processing a transaction (validation, gas-payment, and execution), this logic is executed by EVM code.
The benefits for the account are countless -&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;abstracting the validation allows the contract to use different signature schemes, multisig configuration, custom recovery, and more.&lt;&#x2F;li&gt;
&lt;li&gt;abstracting gas payments allows easy onboarding by 3rd party payments, paying with tokens, cross-chain gas payments&lt;&#x2F;li&gt;
&lt;li&gt;abstracting execution allows batch transactions&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;All of the above are missing from the EOA account model.&lt;&#x2F;p&gt;
&lt;p&gt;However, there is one rule a transaction must follow to preserve the decentralized network: once submitted into the network (the mempool), the transaction is guaranteed to pay. This comes to prevent denial-of-service attacks on the network.&lt;&#x2F;p&gt;
&lt;p&gt;The EOA model implicitly follows the rule: a valid transaction can&#x27;t become invalid without payment by the account: e.g. account balance can&#x27;t be reduced (except with a higher paying transaction)&lt;&#x2F;p&gt;
&lt;p&gt;This rule makes the network sustainable and DoS-protected: the network can&#x27;t be cheaply attacked by a mass of transactions. An attack (sending a mass of transactions) is expensive, and gets more expensive as the network clogs. Legitimate users pay more, and can delay operations to avoid the cost, but the attacker pays a huge (and increasing) amount to keep the network clogged.&lt;&#x2F;p&gt;
&lt;p&gt;To mimic the same incentive structure in any Account Abstraction system, we suggest the following transaction validation rules.
These validation rules only apply to the validation phase of Account Abstraction transactions, not their entire executed code path.&lt;&#x2F;p&gt;
&lt;p&gt;For the actual interfaces of those contract-based accounts see the definitions in ERC-4337 and RIP-7560.&lt;&#x2F;p&gt;
&lt;p&gt;This documentation uses the terminology &quot;UserOperation&quot; for a transaction created by a smart contract account, and closely follows &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt; terminology.
However, the rules apply to any Account Abstraction framework that uses EVM code to perform transaction validation and makes a distinction between validation (whether the operation is eligible for inclusion on the protocol level) and execution (on-chain execution and gas payment) in a public mempool.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;validation-rules-types&quot;&gt;Validation Rules Types&lt;&#x2F;h3&gt;
&lt;p&gt;We define two types of validation rules: &lt;strong&gt;network-wide rules&lt;&#x2F;strong&gt; and &lt;strong&gt;local rules&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;A violation of any validation rule by a UserOperation results in the UserOperation being dropped from the mempool and excluded from a bundle.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Network-wide rule&lt;&#x2F;strong&gt; is a rule, that its violation by a UserOperation validation should result in a reputation damage for the peer bundler that sent this UserOperation in the p2p mempool.
A peer bundler with a critically low reputation will eventually be marked as a malicious &lt;strong&gt;spammer&lt;&#x2F;strong&gt; peer.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Local rule&lt;&#x2F;strong&gt; is a rule that is enforced in the context of each bundler&#x27;s local state, which may be different for each bundler and different bundlers may not always be in agreement on these rules&#x27; violations.
Thus, The bundler that sent the violating UserOperation should not suffer a p2p reputation damage by its peers.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Title&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Comment&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MIN_UNSTAKE_DELAY&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;86400&lt;&#x2F;td&gt;&lt;td&gt;1 day, which provides a sufficient withdrawal delay to prevent most sybil attacks&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MIN_STAKE_VALUE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Adjustable per chain value&lt;&#x2F;td&gt;&lt;td&gt;Equivalent to ~$1000 in native tokens, which provides a sufficient capital requirement to prevent most sybil attacks&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SAME_SENDER_MEMPOOL_COUNT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;4&lt;&#x2F;td&gt;&lt;td&gt;Maximum number of allowed userops in the mempool from a single sender.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SAME_UNSTAKED_ENTITY_MEMPOOL_COUNT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;10&lt;&#x2F;td&gt;&lt;td&gt;Maximum number allowed in the mempool of UserOperations referencing the same unstaked entity&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;THROTTLED_ENTITY_MEMPOOL_COUNT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;4&lt;&#x2F;td&gt;&lt;td&gt;Number of &lt;code&gt;UserOperations&lt;&#x2F;code&gt; with a throttled entity that can stay in the mempool&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;THROTTLED_ENTITY_LIVE_BLOCKS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;10&lt;&#x2F;td&gt;&lt;td&gt;Number of blocks a &lt;code&gt;UserOperations&lt;&#x2F;code&gt; with a throttled entity can stay in mempool&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;THROTTLED_ENTITY_BUNDLE_COUNT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;4&lt;&#x2F;td&gt;&lt;td&gt;Number of &lt;code&gt;UserOperations&lt;&#x2F;code&gt; with a throttled entity that can be added in a single bundle&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MIN_INCLUSION_RATE_DENOMINATOR&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;100 (client) \ 10 (bundler)&lt;&#x2F;td&gt;&lt;td&gt;A denominator of a formula for entity reputation calculation&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;THROTTLING_SLACK&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;10&lt;&#x2F;td&gt;&lt;td&gt;Part of a reputation formula that allows entities to legitimately reject some transactions without being throttled&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;BAN_SLACK&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;50&lt;&#x2F;td&gt;&lt;td&gt;Part of a reputation formula that allows throttled entities to reject some transactions without being throttled&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;BAN_OPS_SEEN_PENALTY&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;10000&lt;&#x2F;td&gt;&lt;td&gt;A value to put into the opsSeen counter of entity to declare as banned&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_OPS_ALLOWED_UNSTAKED_ENTITY&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;10000&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;PRE_VERIFICATION_OVERHEAD_GAS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;50000&lt;&#x2F;td&gt;&lt;td&gt;Gas used by the &lt;code&gt;EntryPoint&lt;&#x2F;code&gt; per &lt;code&gt;UserOp&lt;&#x2F;code&gt; that cannot be tracked on-chain&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_VERIFICATION_GAS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;500000&lt;&#x2F;td&gt;&lt;td&gt;Maximum gas verification functions may use&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_USEROP_SIZE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;8192&lt;&#x2F;td&gt;&lt;td&gt;Maximum size of a single packed and ABI-encoded &lt;code&gt;UserOperation&lt;&#x2F;code&gt; in bytes&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_CONTEXT_SIZE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;2048&lt;&#x2F;td&gt;&lt;td&gt;Maximum size of a &lt;code&gt;context&lt;&#x2F;code&gt; byte array returned by a paymaster in a single &lt;code&gt;UserOperation&lt;&#x2F;code&gt; in bytes&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_BUNDLE_SIZE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;262144&lt;&#x2F;td&gt;&lt;td&gt;Maximum size of an ABI-encoded bundle call to the &lt;code&gt;handleOps&lt;&#x2F;code&gt; function in bytes&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_BUNDLE_CONTEXT_SIZE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;65536&lt;&#x2F;td&gt;&lt;td&gt;Maximum total size of all &lt;code&gt;context&lt;&#x2F;code&gt; byte arrays returned by all paymasters in all &lt;code&gt;UserOperations&lt;&#x2F;code&gt; in a bundle in bytes&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;VALIDATION_GAS_SLACK&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;4000&lt;&#x2F;td&gt;&lt;td&gt;An amount of gas that must be added to the estimations of &lt;code&gt;verificationGasLimit&lt;&#x2F;code&gt; and &lt;code&gt;paymasterVerificationGasLimit&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;validation-rules&quot;&gt;Validation Rules&lt;&#x2F;h3&gt;
&lt;h3 id=&quot;definitions&quot;&gt;&lt;strong&gt;Definitions&lt;&#x2F;strong&gt;:&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Validation Phase&lt;&#x2F;strong&gt;: there are up to three frames during the validation phase onchain&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;sender&lt;&#x2F;code&gt; deployment frame (once per account)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;sender&lt;&#x2F;code&gt; validation (required)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;paymaster&lt;&#x2F;code&gt; validation frame (optional)&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Execution Phase&lt;&#x2F;strong&gt;: there are up to two frames during the execution phase onchain&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;sender&lt;&#x2F;code&gt; execution frame (required)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;paymaster&lt;&#x2F;code&gt; post-transaction frame (optional)
The validation rules only apply during the validation phase. Once a UserOperation is validated, it is guaranteed to pay. There are no restrictions on execution, neither account (callData) nor paymaster (postOp)&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Entity&lt;&#x2F;strong&gt;: a contract that is explicitly specified by the &lt;code&gt;UserOperation&lt;&#x2F;code&gt;.
Includes the &lt;code&gt;factory&lt;&#x2F;code&gt;, &lt;code&gt;paymaster&lt;&#x2F;code&gt;, &lt;code&gt;aggregator&lt;&#x2F;code&gt;, and staked &lt;code&gt;account&lt;&#x2F;code&gt;, as discussed below.&lt;br &#x2F;&gt;
Each &quot;validation frame&quot; is attributed to a single entity.&lt;br &#x2F;&gt;
Entity contracts must have non-empty code on-chain.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Canonical Mempool&lt;&#x2F;strong&gt;: The rules defined in this document apply to the main mempool shared by all bundlers on the network.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Staked Entity:&lt;&#x2F;strong&gt; an entity that has a locked stake of at least &lt;code&gt;MIN_STAKE_VALUE&lt;&#x2F;code&gt;
and an unstake delay of at least &lt;code&gt;MIN_UNSTAKE_DELAY&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Associated storage:&lt;&#x2F;strong&gt; a storage slot of any smart contract is considered to be &quot;associated&quot; with address &lt;code&gt;A&lt;&#x2F;code&gt; if:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The slot value is &lt;code&gt;A&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;The slot value was calculated as &lt;code&gt;keccak(A||x)+n&lt;&#x2F;code&gt;, where &lt;code&gt;x&lt;&#x2F;code&gt; is a &lt;code&gt;bytes32&lt;&#x2F;code&gt; value, and &lt;code&gt;n&lt;&#x2F;code&gt; is a value in the range 0..128&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Using an address&lt;&#x2F;strong&gt;: accessing the code of a given address in any way.
This can be done by executing &lt;code&gt;*CALL&lt;&#x2F;code&gt; or &lt;code&gt;EXTCODE*&lt;&#x2F;code&gt; opcodes for a given address.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Spammer&lt;&#x2F;strong&gt; - a P2P peer bundler that attempts a DoS attack on the mempool by sending other peers with a large number of invalid UserOperations.
Bundlers MUST detect and disconnect from such peers, as described in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7562&#x2F;#mempool-validation-rules&quot;&gt;Mempool Validation Rules&lt;&#x2F;a&gt; section.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;reputation-definitions&quot;&gt;Reputation Definitions&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;opsSeen&lt;&#x2F;strong&gt;: a per-entity counter of how many times a unique valid &lt;code&gt;UserOperation&lt;&#x2F;code&gt; referencing this entity
was received by this bundler.
This includes &lt;code&gt;UserOperation&lt;&#x2F;code&gt; received via incoming RPC calls or through a P2P mempool protocol.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;opsIncluded&lt;&#x2F;strong&gt;: a per-entity counter of how many times a unique valid &lt;code&gt;UserOperation&lt;&#x2F;code&gt; referencing this entity
appeared in an actual included &lt;code&gt;UserOperation&lt;&#x2F;code&gt;.&lt;br &#x2F;&gt;
Calculation of this value is based on UserOperationEvents and is only counted for &lt;code&gt;UserOperations&lt;&#x2F;code&gt; that were
previously counted as &lt;code&gt;opsSeen&lt;&#x2F;code&gt; by this bundler.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Refresh rate&lt;&#x2F;strong&gt;: Both of the above values are updated every hour as &lt;code&gt;value = value * 23 &#x2F;&#x2F; 24&lt;&#x2F;code&gt;&lt;br &#x2F;&gt;
Effectively, the value is reduced to 1% after 4 days.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;inclusionRate&lt;&#x2F;strong&gt;: Ratio of &lt;code&gt;opsIncluded&lt;&#x2F;code&gt;  to &lt;code&gt;opsSeen&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;reputation-calculation&quot;&gt;Reputation Calculation&lt;&#x2F;h3&gt;
&lt;p&gt;We define a value &lt;code&gt;max_seen = opsSeen &#x2F;&#x2F; MIN_INCLUSION_RATE_DENOMINATOR&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The reputation state of each entity is determined as follows:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;BANNED&lt;&#x2F;strong&gt;: &lt;code&gt;max_seen &amp;gt; opsIncluded + BAN_SLACK&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;THROTTLED&lt;&#x2F;strong&gt;: &lt;code&gt;max_seen &amp;gt; opsIncluded + THROTTLING_SLACK&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;OK&lt;&#x2F;strong&gt;: otherwise&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Note that new entities start with an &lt;code&gt;OK&lt;&#x2F;code&gt; reputation.&lt;&#x2F;p&gt;
&lt;p&gt;Because of the reputation &lt;code&gt;refresh rate&lt;&#x2F;code&gt;, note that a malicious paymaster can at most cause the network (only the p2p network, not the blockchain) to process &lt;code&gt;BAN_SLACK * MIN_INCLUSION_RATE_DENOMINATOR &#x2F; 24&lt;&#x2F;code&gt; non-paying ops per hour.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;running-the-validation-rules&quot;&gt;Running the Validation Rules&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;A block builder or a bundler should perform a full validation once before accepting a &lt;code&gt;UserOperation&lt;&#x2F;code&gt; into its mempool, and again before including it in a bundle&#x2F;block.&lt;&#x2F;li&gt;
&lt;li&gt;The bundler should trace the validation phase of the UserOperation and apply all the rules defined in this document.&lt;&#x2F;li&gt;
&lt;li&gt;A bundler should also perform a full validation of the entire bundle before submission.&lt;&#x2F;li&gt;
&lt;li&gt;The validation rules prevent an unstaked entity from altering its behavior between simulation and execution of the UserOperation.
However, a malicious staked entity can detect that it is running in a bundle validation and cause a revert. Thus, a third tracing simulation of the entire bundle should be performed before submission.&lt;&#x2F;li&gt;
&lt;li&gt;The failed &lt;code&gt;UserOperation&lt;&#x2F;code&gt; should be dropped from the bundle.&lt;&#x2F;li&gt;
&lt;li&gt;The bundler should update the reputation of the staked entity that violated the rules, and consider it &lt;code&gt;THROTTLED&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;BANNED&lt;&#x2F;code&gt; as described below.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;mempool-validation-rules&quot;&gt;Mempool Validation Rules&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;A &lt;code&gt;UserOperation&lt;&#x2F;code&gt; is broadcast over the P2P protocol with the following information:
&lt;ol&gt;
&lt;li&gt;The &lt;code&gt;UserOperation&lt;&#x2F;code&gt; itself&lt;&#x2F;li&gt;
&lt;li&gt;The blockhash this &lt;code&gt;UserOperation&lt;&#x2F;code&gt; was originally verified against.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Once a &lt;code&gt;UserOperation&lt;&#x2F;code&gt; is received from another bundler it should be verified locally by a receiving bundler.&lt;&#x2F;li&gt;
&lt;li&gt;A received &lt;code&gt;UserOperation&lt;&#x2F;code&gt; may fail any of the reasonable static checks, such as:
invalid format, values below minimum, submitted with a blockhash that isn&#x27;t recent, etc.
In this case, the bundler should drop this particular &lt;code&gt;UserOperation&lt;&#x2F;code&gt; but keep the connection.&lt;&#x2F;li&gt;
&lt;li&gt;The bundler should check the &lt;code&gt;UserOperation&lt;&#x2F;code&gt; against the nonces of last-included bundles and silently drop &lt;code&gt;UserOperations&lt;&#x2F;code&gt; with &lt;code&gt;nonce&lt;&#x2F;code&gt; that was recently included.
This invalidation is likely attributable to a network race condition and should not cause a reputation change.&lt;&#x2F;li&gt;
&lt;li&gt;If a received &lt;code&gt;UserOperation&lt;&#x2F;code&gt; fails against the current block:
&lt;ol&gt;
&lt;li&gt;Retry the validation against the block the &lt;code&gt;UserOperation&lt;&#x2F;code&gt; was originally verified against.&lt;&#x2F;li&gt;
&lt;li&gt;If it succeeds, silently drop the &lt;code&gt;UserOperation&lt;&#x2F;code&gt; and keep the connection.&lt;&#x2F;li&gt;
&lt;li&gt;If it fails, mark the sender as a &quot;spammer&quot; (disconnect from that peer and block it permanently).&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;opcode-rules&quot;&gt;Opcode Rules&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Block access from opcodes that access information outside of storage and code (aka &quot;environment&quot;).
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;[OP-011]&lt;&#x2F;strong&gt; Blocked opcodes:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ORIGIN&lt;&#x2F;code&gt; (&lt;code&gt;0x32&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;GASPRICE&lt;&#x2F;code&gt; (&lt;code&gt;0x3A&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt; (&lt;code&gt;0x40&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;COINBASE&lt;&#x2F;code&gt; (&lt;code&gt;0x41&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TIMESTAMP&lt;&#x2F;code&gt; (&lt;code&gt;0x42&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;NUMBER&lt;&#x2F;code&gt; (&lt;code&gt;0x43&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;PREVRANDAO&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;DIFFICULTY&lt;&#x2F;code&gt; (&lt;code&gt;0x44&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;GASLIMIT&lt;&#x2F;code&gt; (&lt;code&gt;0x45&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;BASEFEE&lt;&#x2F;code&gt; (&lt;code&gt;0x48&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;BLOBHASH&lt;&#x2F;code&gt; (&lt;code&gt;0x49&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;BLOBBASEFEE&lt;&#x2F;code&gt; (&lt;code&gt;0x4A&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CREATE&lt;&#x2F;code&gt; (&lt;code&gt;0xF0&lt;&#x2F;code&gt;) (except in the &quot;Contract Creation&quot; and &quot;Staked factory creation&quot; sections, below)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;INVALID&lt;&#x2F;code&gt; (&lt;code&gt;0xFE&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; (&lt;code&gt;0xFF&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;[OP-012]&lt;&#x2F;strong&gt; &lt;code&gt;GAS&lt;&#x2F;code&gt; (&lt;code&gt;0x5A&lt;&#x2F;code&gt;) opcode is allowed, but only if followed immediately by &lt;code&gt;*CALL&lt;&#x2F;code&gt; instructions, else it is blocked.&lt;br &#x2F;&gt;
This is a common way to pass all remaining gas to an external call, and it means that the actual value is
consumed from the stack immediately and cannot be accessed by any other opcode.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;[OP-13]&lt;&#x2F;strong&gt; any &quot;unassigned&quot; opcode.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;[OP-020]&lt;&#x2F;strong&gt; Revert on &quot;out of gas&quot; is forbidden as it can &quot;leak&quot; the gas limit or the current call stack depth.&lt;&#x2F;li&gt;
&lt;li&gt;Contract creation:
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;[OP-031]&lt;&#x2F;strong&gt; &lt;code&gt;CREATE2&lt;&#x2F;code&gt; is allowed exactly once in the deployment frame and must deploy code for the &quot;sender&quot; address.
(Either by the factory itself, or by a utility contract it calls)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;[OP-032]&lt;&#x2F;strong&gt; If there is a &lt;code&gt;factory&lt;&#x2F;code&gt; (even unstaked), the &lt;code&gt;sender&lt;&#x2F;code&gt; contract is allowed to use &lt;code&gt;CREATE&lt;&#x2F;code&gt; opcode
(That is, only the sender contract itself, not through utility contract)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Access to an address without a deployed code is forbidden:
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;[OP-041]&lt;&#x2F;strong&gt; For &lt;code&gt;EXTCODE*&lt;&#x2F;code&gt; and &lt;code&gt;*CALL&lt;&#x2F;code&gt; opcodes.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;[OP-042]&lt;&#x2F;strong&gt; Exception: access to the &quot;sender&quot; address is allowed.
This is only possible in &lt;code&gt;factory&lt;&#x2F;code&gt; code during the deployment frame.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Allowed access to the &lt;code&gt;EntryPoint&lt;&#x2F;code&gt; address:
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;[OP-051]&lt;&#x2F;strong&gt; May call &lt;code&gt;EXTCODESIZE ISZERO&lt;&#x2F;code&gt;&lt;br &#x2F;&gt;
This pattern is used to check destination has a code before the &lt;code&gt;depositTo&lt;&#x2F;code&gt; function is called.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;[OP-052]&lt;&#x2F;strong&gt; May call &lt;code&gt;depositTo(sender)&lt;&#x2F;code&gt; with any value from either the &lt;code&gt;sender&lt;&#x2F;code&gt; or &lt;code&gt;factory&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;[OP-053]&lt;&#x2F;strong&gt; May call the fallback function from the &lt;code&gt;sender&lt;&#x2F;code&gt; with any value.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;[OP-054]&lt;&#x2F;strong&gt; Any other access to the &lt;code&gt;EntryPoint&lt;&#x2F;code&gt; (either of the &lt;code&gt;*CALL&lt;&#x2F;code&gt; or &lt;code&gt;EXT*&lt;&#x2F;code&gt; opcodes) is forbidden.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;[OP-055]&lt;&#x2F;strong&gt; May call &lt;code&gt;incrementNonce())&lt;&#x2F;code&gt; from the &lt;code&gt;sender&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;*CALL&lt;&#x2F;code&gt; opcodes:
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;[OP-061]&lt;&#x2F;strong&gt; &lt;code&gt;CALL&lt;&#x2F;code&gt; with &lt;code&gt;value&lt;&#x2F;code&gt; is forbidden. The only exception is a call to the &lt;code&gt;EntryPoint&lt;&#x2F;code&gt; described above.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;[OP-062]&lt;&#x2F;strong&gt; Precompiles:
&lt;ul&gt;
&lt;li&gt;Only allow known accepted precompiles on the network, that do not access anything in the blockchain state or environment.&lt;&#x2F;li&gt;
&lt;li&gt;The core precompiles 0x1 .. 0x11&lt;&#x2F;li&gt;
&lt;li&gt;The RIP-7212 secp256r1 precompile, on networks that accepted it.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;[OP-070]&lt;&#x2F;strong&gt; Transient Storage slots defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1153&#x2F;&quot;&gt;EIP-1153&lt;&#x2F;a&gt; and accessed using &lt;code&gt;TLOAD&lt;&#x2F;code&gt; (&lt;code&gt;0x5c&lt;&#x2F;code&gt;) and &lt;code&gt;TSTORE&lt;&#x2F;code&gt; (&lt;code&gt;0x5d&lt;&#x2F;code&gt;) opcodes
are treated exactly like persistent storage (SLOAD&#x2F;SSTORE).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;[OP-080]&lt;&#x2F;strong&gt; &lt;code&gt;BALANCE&lt;&#x2F;code&gt; (&lt;code&gt;0x31&lt;&#x2F;code&gt;) and &lt;code&gt;SELFBALANCE&lt;&#x2F;code&gt; (&lt;code&gt;0x47&lt;&#x2F;code&gt;) are allowed only from a staked entity, else they are blocked.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;code-rules&quot;&gt;Code Rules&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;[COD-010]&lt;&#x2F;strong&gt; Between the first and the second validations, the &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; value of any visited address,
entity, or referenced library, may not be changed.&lt;br &#x2F;&gt;
If the code is modified, the UserOperation is considered invalid.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;storage-rules&quot;&gt;Storage Rules&lt;&#x2F;h3&gt;
&lt;p&gt;The storage access with &lt;code&gt;SLOAD&lt;&#x2F;code&gt; and &lt;code&gt;SSTORE&lt;&#x2F;code&gt; (and &lt;code&gt;TLOAD&lt;&#x2F;code&gt;, &lt;code&gt;TSTORE&lt;&#x2F;code&gt;) instructions within each phase is limited as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;[STO-010]&lt;&#x2F;strong&gt; Access to the &quot;account&quot; storage is always allowed.&lt;&#x2F;li&gt;
&lt;li&gt;Access to associated storage of the account in an external (non-entity) contract is allowed if either:
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;[STO-021]&lt;&#x2F;strong&gt;  The account already exists.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;[STO-022]&lt;&#x2F;strong&gt;  There is an &lt;code&gt;initCode&lt;&#x2F;code&gt; and the &lt;code&gt;factory&lt;&#x2F;code&gt; contract is staked.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;If the entity (&lt;code&gt;paymaster&lt;&#x2F;code&gt;, &lt;code&gt;factory&lt;&#x2F;code&gt;) is staked, then it is also allowed:
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;[STO-031]&lt;&#x2F;strong&gt; Access the entity&#x27;s own storage.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;[STO-032]&lt;&#x2F;strong&gt; Read&#x2F;Write Access to storage slots that are associated with the entity, in any non-entity contract.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;[STO-033]&lt;&#x2F;strong&gt; Read-only access to any storage in non-entity contract.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;local-rules&quot;&gt;Local Rules&lt;&#x2F;h3&gt;
&lt;p&gt;Local storage rules protect the bundler against denial of service at the time of bundling. They do not affect mempool propagation and cannot cause a bundler to be marked as a &quot;spammer&quot;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;[STO-040]&lt;&#x2F;strong&gt; &lt;code&gt;UserOperation&lt;&#x2F;code&gt; may not use an entity address (&lt;code&gt;factory&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;paymaster&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;aggregator&lt;&#x2F;code&gt;) that is used as an &quot;account&quot; in another &lt;code&gt;UserOperation&lt;&#x2F;code&gt; in the mempool.&lt;br &#x2F;&gt;
This means that &lt;code&gt;Paymaster&lt;&#x2F;code&gt;, &lt;code&gt;Factory&lt;&#x2F;code&gt; or &lt;code&gt;Aggregator&lt;&#x2F;code&gt; contracts cannot practically be an &quot;account&quot; contract as well.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;[STO-041]&lt;&#x2F;strong&gt; &lt;code&gt;UserOperation&lt;&#x2F;code&gt; may not use associated storage (of either its account or from staked entity) in a contract that is a &quot;sender&quot; of another UserOperation in the mempool.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;general-reputation-rules&quot;&gt;General Reputation Rules&lt;&#x2F;h3&gt;
&lt;p&gt;The following reputation rules apply for all staked entities, and for unstaked paymasters. All rules apply to all of these entities unless specified otherwise.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;[GREP-010]&lt;&#x2F;strong&gt; A &lt;code&gt;BANNED&lt;&#x2F;code&gt; address is not allowed into the mempool.&lt;br &#x2F;&gt;
Also, all existing &lt;code&gt;UserOperations&lt;&#x2F;code&gt; referencing this address are removed from the mempool.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;[GREP-020]&lt;&#x2F;strong&gt; A &lt;code&gt;THROTTLED&lt;&#x2F;code&gt; address is limited to:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;THROTTLED_ENTITY_MEMPOOL_COUNT&lt;&#x2F;code&gt; entries in the mempool.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;THROTTLED_ENTITY_BUNDLE_COUNT&lt;&#x2F;code&gt; &lt;code&gt;UserOperations&lt;&#x2F;code&gt; in a bundle.&lt;&#x2F;li&gt;
&lt;li&gt;Can remain in the mempool only for &lt;code&gt;THROTTLED_ENTITY_LIVE_BLOCKS&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;[GREP-040]&lt;&#x2F;strong&gt; If an entity fails the bundle creation after passing second validation, its &lt;code&gt;opsSeen&lt;&#x2F;code&gt; set to &lt;code&gt;BAN_OPS_SEEN_PENALTY&lt;&#x2F;code&gt;, and &lt;code&gt;opsIncluded&lt;&#x2F;code&gt; to zero, causing it to be &lt;code&gt;BANNED&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;[GREP-050]&lt;&#x2F;strong&gt; When a UserOperation is replaced (by submitting a new UserOperation, with higher gas fees), and an entity (e.g. a paymaster) is replaced, then the removed entity has its reputation (opsSeen counter) decremented by 1.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;staked-entities-reputation-rules&quot;&gt;Staked Entities Reputation Rules&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;[SREP-010]&lt;&#x2F;strong&gt; The &quot;canonical mempool&quot; defines a staked entity if it has &lt;code&gt;MIN_STAKE_VALUE&lt;&#x2F;code&gt; and unstake delay of &lt;code&gt;MIN_UNSTAKE_DELAY&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;[SREP-020]&lt;&#x2F;strong&gt; MOVED TO GREP-010&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;[SREP-030]&lt;&#x2F;strong&gt; MOVED TO GREP-020&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;[SREP-040]&lt;&#x2F;strong&gt; An &lt;code&gt;OK&lt;&#x2F;code&gt; staked entity is unlimited by the reputation rule.
&lt;ul&gt;
&lt;li&gt;Allowed in unlimited numbers in the mempool.&lt;&#x2F;li&gt;
&lt;li&gt;Allowed in unlimited numbers in a bundle.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;[SREP-050]&lt;&#x2F;strong&gt; MOVED TO GREP-040&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;entity-specific-rules&quot;&gt;Entity-specific Rules&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;[EREP-010]&lt;&#x2F;strong&gt; For each &lt;code&gt;paymaster&lt;&#x2F;code&gt;, the bundler must track the total gas &lt;code&gt;UserOperations&lt;&#x2F;code&gt; using this &lt;code&gt;paymaster&lt;&#x2F;code&gt; may consume.
&lt;ul&gt;
&lt;li&gt;Bundler should not accept a new &lt;code&gt;UserOperation&lt;&#x2F;code&gt; with a paymaster to the mempool if the maximum total gas cost of all userops in the mempool, including this new &lt;code&gt;UserOperation&lt;&#x2F;code&gt;, is above the deposit of that &lt;code&gt;paymaster&lt;&#x2F;code&gt; at the current gas price.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;[EREP-011]&lt;&#x2F;strong&gt; REMOVED&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;[EREP-015]&lt;&#x2F;strong&gt; A &lt;code&gt;paymaster&lt;&#x2F;code&gt; should not have its opsSeen incremented in case of a failure of factory or account
&lt;ul&gt;
&lt;li&gt;When running 2nd validation (before inclusion in a bundle), if a UserOperation fails because of factory or account error (either a FailOp revert or validation rule), then the paymaster&#x27;s opsSeen valid is decremented by 1.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;[EREP-016]&lt;&#x2F;strong&gt; An &lt;code&gt;aggregator&lt;&#x2F;code&gt; should not have its opsSeen incremented in case of a failure of a factory, an account or a paymaster
&lt;ul&gt;
&lt;li&gt;When running 2nd validation (before inclusion in a bundle), if a UserOperation fails because of a factory, an account or a paymaster error (either a FailOp revert or validation rule), then the aggregator&#x27;s opsSeen valid is decremented by 1.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;[EREP-020]&lt;&#x2F;strong&gt; If a staked factory is used, its reputation is updated for the account violating any of the validation rules accordingly.&lt;br &#x2F;&gt;
That is, if the &lt;code&gt;validateUserOp()&lt;&#x2F;code&gt; is rejected for any reason in a &lt;code&gt;UserOperation&lt;&#x2F;code&gt; that has an &lt;code&gt;initCode&lt;&#x2F;code&gt;, it is treated as if the factory caused this failure, and thus this affects its reputation.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;[EREP-030]&lt;&#x2F;strong&gt; If a staked account is used, its reputation is updated for failures in other entities (&lt;code&gt;paymaster&lt;&#x2F;code&gt;, &lt;code&gt;aggregator&lt;&#x2F;code&gt;) even if they are staked.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;[EREP-040]&lt;&#x2F;strong&gt; An &lt;code&gt;aggregator&lt;&#x2F;code&gt; must be staked, regardless of storage usage.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;[EREP-050]&lt;&#x2F;strong&gt; An unstaked &lt;code&gt;paymaster&lt;&#x2F;code&gt; may not return a &lt;code&gt;context&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;[EREP-055]&lt;&#x2F;strong&gt; A context size may not change between validation and bundle creation.&lt;br &#x2F;&gt;
If a bundle creation reverts, and a paymaster&#x27;s context size was modified, that paymaster&lt;br &#x2F;&gt;
is BANNED, regardless if the UserOperation that reverted used that paymaster or not.&lt;&#x2F;li&gt;
&lt;li&gt;Staked factory creation rules:
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;[EREP-060]&lt;&#x2F;strong&gt; If the factory is staked, either the factory itself or the sender may use the CREATE2 and CREATE opcode
(the sender is allowed to use the CREATE with unstaked factory, with OP-032)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;[EREP-061]&lt;&#x2F;strong&gt; A staked factory may also use a utility contract that calls the &lt;code&gt;CREATE&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;[EREP-070]&lt;&#x2F;strong&gt; During bundle creation, if a staked entity reduce its validation gas by more than 10%
compared to the second validation, that entity is throttled, even if the UserOperation itself didn&#x27;t revert.
(as it might affect the gas calculation based on &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7623&#x2F;&quot;&gt;EIP-7623&lt;&#x2F;a&gt; )&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;unstaked-entities-reputation-rules&quot;&gt;Unstaked Entities Reputation Rules&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Definitions:
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;opsSeen&lt;&#x2F;code&gt;, &lt;code&gt;opsIncluded&lt;&#x2F;code&gt;, and reputation calculation&lt;&#x2F;strong&gt; are defined above.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;UnstakedReputation&lt;&#x2F;code&gt; of an entity determines the maximum number of entries using this entity allowed in the mempool.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;opsAllowed&lt;&#x2F;code&gt; is a reputation-based calculation for an unstaked entity, representing how many &lt;code&gt;UserOperations&lt;&#x2F;code&gt; it is allowed to have in the mempool.&lt;&#x2F;li&gt;
&lt;li&gt;Rules:
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;[UREP-010]&lt;&#x2F;strong&gt; An unstaked sender (that is not throttled&#x2F;banned) is only allowed to have &lt;code&gt;SAME_SENDER_MEMPOOL_COUNT&lt;&#x2F;code&gt; &lt;code&gt;UserOperation&lt;&#x2F;code&gt;s  in the mempool.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;[UREP-020]&lt;&#x2F;strong&gt; For an unstaked paymaster only that is not throttled&#x2F;banned:&lt;br &#x2F;&gt;
&lt;code&gt;opsAllowed = SAME_UNSTAKED_ENTITY_MEMPOOL_COUNT + inclusionRate * min(opsIncluded, MAX_OPS_ALLOWED_UNSTAKED_ENTITY)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;This is a default of &lt;code&gt;SAME_UNSTAKED_ENTITY_MEMPOOL_COUNT&lt;&#x2F;code&gt; for new entity&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;[UREP-030]&lt;&#x2F;strong&gt; REMOVED&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;alt-mempools-rules&quot;&gt;Alt-mempools Rules&lt;&#x2F;h3&gt;
&lt;p&gt;Alternate mempool is an agreed-upon rule that the bundlers may opt into, in addition to the canonical mempool
The alt-mempool &quot;topic&quot; is a unique identifier. By convention, this is the IPFS hash of the document describing (in clear test and YAML file) the specifics of this alt mempool.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;[ALT-010]&lt;&#x2F;strong&gt; The bundler listens to the alt-mempool &quot;topic&quot; over the P2P protocol&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;[ALT-020]&lt;&#x2F;strong&gt; The alt mempool rules MUST be checked only when a canonical rule is violated
&lt;ul&gt;
&lt;li&gt;That is, if validation follows the canonical rules above, it is not considered part of an alt-mempool.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;[ALT-021]&lt;&#x2F;strong&gt; Such a &lt;code&gt;UserOperation&lt;&#x2F;code&gt; (that violates the canonical rules) is checked against all the &quot;alternate mempools&quot;, and is considered part of all those alt-mempools&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;[ALT-030]&lt;&#x2F;strong&gt; Bundlers SHOULD forward &lt;code&gt;UserOperations&lt;&#x2F;code&gt; to other bundlers only once, regardless of how many (shared) alt-mempools they have.&lt;br &#x2F;&gt;
The receiving bundler validates the &lt;code&gt;UserOperations&lt;&#x2F;code&gt;, and based on the above rules (and subscribed alt-mempools) decides which alt-mempools to propagate it to.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;[ALT-040]&lt;&#x2F;strong&gt; opsInclude and opsSeen of entities are kept per alt-mempool. That is, an entity can be considered throttled (or banned) in one mempool, while still active on another.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;alt-mempool-reputation&quot;&gt;Alt-mempool Reputation&lt;&#x2F;h3&gt;
&lt;p&gt;Alt-mempools are served by the same bundlers participating in the canonical mempool, but change the rules and may introduce denial-of-service attack vectors. To prevent them from taking the canonical mempool or other alt mempools down with them, a reputation is managed for each. An alt mempool that causes too many invalidations gets throttled. This limits the scope of the attack and lets the bundler continue doing its work for other mempools.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;[AREP-010]&lt;&#x2F;strong&gt; each alt-mempool has &quot;opsSeen&quot; and &quot;opsIncluded&quot;, much like entities. The opsSeen is incremented after &lt;code&gt;UserOperation&lt;&#x2F;code&gt; initial validation, where it is considered part of this mempool.
The &quot;opsIncluded&quot; is incremented after this UserOperation is included on-chain (either by this bundler, or another)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;[AREP-020]&lt;&#x2F;strong&gt; the alt-mempool becomes &lt;code&gt;THROTTLED&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;BANNED&lt;&#x2F;code&gt; based on the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7562&#x2F;#reputation-calculation&quot;&gt;Reputation Calculation&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;[AREP-030]&lt;&#x2F;strong&gt; REMOVED&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;authorizations&quot;&gt;Authorizations&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;[AUTH-010]&lt;&#x2F;strong&gt; A UserOperation may only contain a single &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; authorization tuple.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;[AUTH-020]&lt;&#x2F;strong&gt; An account with EIP-7702 delegation can only be used as the Sender of the UserOperation.
Using authorized account as any other kind of UserOperation entity is not allowed.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;[AUTH-030]&lt;&#x2F;strong&gt; An account with EIP-7702 delegation can only be &lt;strong&gt;accessed&lt;&#x2F;strong&gt; (using &lt;code&gt;*CALL&lt;&#x2F;code&gt; or &lt;code&gt;EXTCODE*&lt;&#x2F;code&gt; opcodes) if it is the Sender of the current UserOperation.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;[AUTH-040]&lt;&#x2F;strong&gt; If there are multiple UserOperations by the same sender with an authorization tuple in the mempool, they all MUST have the same delegate address.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;limitations&quot;&gt;Limitations&lt;&#x2F;h3&gt;
&lt;p&gt;The validation rules attempt to guarantee a degree of isolation between individual &lt;code&gt;UserOperations&lt;&#x2F;code&gt;&#x27; validations.
In order to prevent hitting the memory expansion limitations (imposed by ethereum EVM) when creating a bundle, &lt;code&gt;UserOperation&lt;&#x2F;code&gt;s must meet the following limitations:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;[LIM-010]&lt;&#x2F;strong&gt; Maximum size of a single packed and ABI-encoded &lt;code&gt;UserOperation&lt;&#x2F;code&gt; in bytes MUST not exceed &lt;code&gt;MAX_USEROP_SIZE&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;[LIM-020]&lt;&#x2F;strong&gt; Maximum size of a &lt;code&gt;context&lt;&#x2F;code&gt; byte array returned by a paymaster in a single &lt;code&gt;UserOperation&lt;&#x2F;code&gt; in bytes MUST not exceed &lt;code&gt;MAX_CONTEXT_SIZE&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;[LIM-030]&lt;&#x2F;strong&gt; The &lt;code&gt;verificationGasLimit&lt;&#x2F;code&gt; and &lt;code&gt;paymasterVerificationGasLimit&lt;&#x2F;code&gt; parameters MUST exceed the actual usage during validation of the &lt;code&gt;UserOperation&lt;&#x2F;code&gt; by &lt;code&gt;VALIDATION_GAS_SLACK&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;[LIM-040]&lt;&#x2F;strong&gt; Maximum size of an ABI-encoded bundle call to the &lt;code&gt;handleOps&lt;&#x2F;code&gt; function in bytes SHOULD not exceed &lt;code&gt;MAX_BUNDLE_SIZE&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;[LIM-050]&lt;&#x2F;strong&gt; Maximum total size of all &lt;code&gt;context&lt;&#x2F;code&gt; byte arrays returned by all paymasters in all &lt;code&gt;UserOperations&lt;&#x2F;code&gt; in a bundle in bytes SHOULD not exceed &lt;code&gt;MAX_BUNDLE_CONTEXT_SIZE&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;All transactions initiated by EOAs have an implicit validation phase where balance, nonce, and signature are
checked to be valid for the current state of the Ethereum blockchain.
Once the transaction is checked to be valid by a node, only another transaction by the same EOA can modify the Ethereum
state in a way that makes the first transaction invalid.&lt;&#x2F;p&gt;
&lt;p&gt;With Account Abstraction, however, the validation can also include an arbitrary EVM code and rely on storage as well,
which means that unrelated &lt;code&gt;UserOperations&lt;&#x2F;code&gt; or transactions may invalidate each other.&lt;&#x2F;p&gt;
&lt;p&gt;If not addressed, this would make the job of maintaining a mempool of valid &lt;code&gt;UserOperations&lt;&#x2F;code&gt; and producing valid
bundles computationally infeasible and susceptible to DoS attacks.&lt;&#x2F;p&gt;
&lt;p&gt;This document describes a set of validation rules that if applied by a bundler before accepting a &lt;code&gt;UserOperation&lt;&#x2F;code&gt;
into the mempool can prevent such attacks.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;the-high-level-goal&quot;&gt;The high-level goal&lt;&#x2F;h3&gt;
&lt;p&gt;The purpose of this specification is to define a consensus between nodes (bundlers or block-builders) when processing incoming UserOperations from an external source.
This external source for UserOperations is either an end-user node (via RPC &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7769&#x2F;&quot;&gt;ERC-7769&lt;&#x2F;a&gt;) or another node in the p2p network.&lt;&#x2F;p&gt;
&lt;p&gt;The protocol tries to detect &quot;spam&quot; - which are large bursts of UserOperations that cannot be included on-chain (and thus can&#x27;t pay).
The network is protected by throttling down requests from such spammer nodes.&lt;&#x2F;p&gt;
&lt;p&gt;All nodes in the network must have the same definition of &quot;spam&quot;: otherwise, if some nodes accept some type of UserOperations and propagate them while others consider them spam, those &quot;forgiving&quot; nodes will be considered &quot;spammers&quot; by the rest of the nodes, and the network effectively gets split.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;the-processing-flow-of-a-useroperation&quot;&gt;The processing flow of a UserOperation&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;First, a UserOperation is received - either via RPC (submitted on behalf of a single application) or via the p2p protocol, from another node in the mempool.&lt;&#x2F;li&gt;
&lt;li&gt;The node performs validation on the UserOperation, and then adds it to its in-memory mempool, and submits it to its peers.&lt;&#x2F;li&gt;
&lt;li&gt;Lastly, when building a block, a node collects UserOperations from the mempool, performs a 2nd validation to make sure they are all still valid as a bundle and submits them into the next block.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;the-need-for-2nd-validation-before-submitting-a-block&quot;&gt;The need for 2nd validation before submitting a block&lt;&#x2F;h3&gt;
&lt;p&gt;A normal Ethereum transaction in the mempool can be invalidated if another transaction was received with the same nonce. That other transaction had to increase the gas price in order to replace the first one, so it satisfied the rule of &quot;must pay to get included into the mempool&quot;.
With contract-based accounts, since the UserOperation validity may depend on mutable state, other transactions may invalidate a previously valid UserOperation, so we must check it before inclusion.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;rationale-of-limiting-opcodes&quot;&gt;Rationale of limiting opcodes:&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;the validation is performed off-chain, before creating a block. Some opcodes access information that is known only when creating the block.&lt;&#x2F;li&gt;
&lt;li&gt;using those opcodes while validating a transaction can easily create a validation rule that will succeed off-chain, but always revert on-chain, and thus cause a DoS attack.&lt;&#x2F;li&gt;
&lt;li&gt;a simple example is &lt;code&gt;require block.number==12345&lt;&#x2F;code&gt;. It can be valid when validating the UserOperation and adding it to the mempool
but will be invalid when attempting to include it on-chain at a later block.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;rationale-for-limiting-storage-access&quot;&gt;Rationale for limiting storage access&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;We need UserOperation validations not to overlap so that a single storage change can&#x27;t easily invalidate a large number of UserOperations in the mempool. By limiting UserOperations to access storage associated with the account itself, we know that we can for sure include a single UserOperation for each account in a bundle&lt;&#x2F;li&gt;
&lt;li&gt;(A bundler MAY include multiple UserOperations of the same account in a bundle, but MUST first validate them together)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;rationale-of-requiring-a-stake&quot;&gt;Rationale of requiring a stake&lt;&#x2F;h3&gt;
&lt;p&gt;We want to be able to allow globally-used contracts (paymasters, factories, aggregators) to use storage not associated with the account, but still prevent them from
spamming the mempool.
If a contract causes too many UserOperations to fail in their second validation after succeeding in their first, we can throttle its use in the mempool.
By requiring such a contract to have a stake, we prevent a &quot;Sybil attack&quot;, by making it expensive to create a large number of such paymasters to continue the spam attack.&lt;&#x2F;p&gt;
&lt;p&gt;By following the validation rules, we can detect contracts that cause spam UserOperations, and throttle them.
The stake comes to prevent the fast re-creation of malicious entities.
The stake is never slashed (since it is only used for off-chain detection) but is locked for a period of time, which makes such an attack much more expensive.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;definition-of-the-mass-invalidation-attack&quot;&gt;Definition of the &lt;code&gt;mass invalidation attack&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;A possible set of actions is considered to be a &lt;code&gt;mass invalidation attack&lt;&#x2F;code&gt; on the network if a large number of
&lt;code&gt;UserOperations&lt;&#x2F;code&gt; that did pass the initial validation and were accepted by nodes and propagated further into the
mempool to other bundlers in the network becomes invalid and not eligible for inclusion in a block.&lt;&#x2F;p&gt;
&lt;p&gt;There are 3 ways to perform such an attack:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Submit &lt;code&gt;UserOperation&lt;&#x2F;code&gt;s that pass the initial validation, but later fail the re-validation
that is performed during the bundle creation.&lt;&#x2F;li&gt;
&lt;li&gt;Submit &lt;code&gt;UserOperation&lt;&#x2F;code&gt;s that are valid in isolation during validation, but when bundled
together become invalid.&lt;&#x2F;li&gt;
&lt;li&gt;Submit valid &lt;code&gt;UserOperation&lt;&#x2F;code&gt;s but &quot;front-run&quot; them by executing a state change on the
network that causes them to become invalid. The &quot;front-run&quot; in question must be economically viable.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;To prevent such attacks, we attempt to &quot;sandbox&quot; the validation code.
We isolate the validation code from other &lt;code&gt;UserOperations&lt;&#x2F;code&gt;, from external changes to the storage, and
from information about the environment such as a current block timestamp.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;what-is-not-considered-a-mass-invalidation-attack&quot;&gt;What is not considered a &lt;code&gt;mass invalidation attack&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;A &lt;code&gt;UserOperation&lt;&#x2F;code&gt; that fails the initial validation by a receiving node without entering its mempool is not
considered an attack. The node is expected to apply web2 security measures and throttle requests based on API key,
source IP address, etc.
RPC nodes already do that to prevent being spammed with invalid transactions which also have a validation cost.
P2P nodes already have (and should apply) a scoring mechanism to determine spammer nodes.&lt;&#x2F;p&gt;
&lt;p&gt;Also, if the invalidation of &lt;code&gt;N&lt;&#x2F;code&gt; UserOperations from the mempool costs &lt;code&gt;N*X&lt;&#x2F;code&gt; with a sufficiently large &lt;code&gt;X&lt;&#x2F;code&gt;, it is not considered an economically viable attack.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The minimum change to cause an invalidation is a storage change (5k gas)&lt;&#x2F;li&gt;
&lt;li&gt;Assuming a Node can sustain processing 2000 invalid UserOps per block, the cost of a DoS attack is 10M gas per block.&lt;&#x2F;li&gt;
&lt;li&gt;The above value is high, but we take further measures to make such an attack more expensive.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This document describes the security considerations bundlers must take to protect themselves (and the entire mempool network)
from denial-of-service attacks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Trusted Hint Registry</title>
        <published>2023-08-31T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Philipp Bolte</name><uri>https://github.com/strumswell</uri>
	</author>
	
	<author>
		<name>Dennis von der Bey</name><uri>https://github.com/DennisVonDerBey</uri>
	</author>
	
	<author>
		<name>Lauritz Leifermann</name><uri>https://github.com/lleifermann</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7506/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-trusted-hint-registry/15615" />
        

        <id>https://wg-eips.ritovision.com/7506/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7506"
            label="ERC-7506" />
        

        
        

        
        <summary type="html">A system for managing on-chain metadata, enabling verification of ecosystem claims.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7506/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP standardizes a system for managing on-chain metadata (hints), enabling claim interpretation, reliability,
and verification. It structures these hints within defined namespaces and lists, enabling structured organization and
retrieval, as well as permissioned write access. The system permits namespace owners to delegate hint management tasks,
enhancing operational flexibility. It incorporates secure meta transactions via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt;-enabled
signatures and offers optional ENS integration for trust verification and discoverability. The interface is equipped to
emit specific events for activities like hint modifications, facilitating easy traceability of changes to hints. This
setup aims to provide a robust, standardized framework for managing claim- and ecosystem-related metadata, essential for
maintaining integrity and trustworthiness in decentralized environments.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;In an increasingly interconnected and decentralized landscape, the formation of trust among entities remains a critical
concern. Ecosystems, both on-chain and off-chain—spanning across businesses, social initiatives, and other organized
frameworks—frequently issue claims for or about entities within their networks. These claims serve as the foundational
elements of trust, facilitating interactions and transactions in environments that are essentially untrustworthy by
nature. While the decentralization movement has brought about significant improvements around trustless technologies,
many ecosystems building on top of these are in need of technologies that build trust in their realm. Real-world
applications have shown that verifiable claims alone are not enough for this purpose. Moreover, a supporting layer of
on-chain metadata is needed to support a reliable exchange and verification of those claims.&lt;&#x2F;p&gt;
&lt;p&gt;The absence of a structured mechanism to manage claim metadata on-chain poses a significant hurdle to the formation and
maintenance of trust among participating entities in an ecosystem. This necessitates the introduction of a layer of
on-chain metadata, which can assist in the reliable verification and interpretation of these claims. Termed &quot;hints&quot; in
this specification, this metadata can be used in numerous ways, each serving to bolster the integrity and reliability
of the ecosystem&#x27;s claims. Hints can perform various tasks, such as providing revocation details, identifying trusted
issuers, or offering timestamping hashes. These are just a few examples that enable ecosystems to validate and
authenticate claims, as well as verify data integrity over time.&lt;&#x2F;p&gt;
&lt;p&gt;The proposed &quot;Trusted Hint Registry&quot; aims to provide a robust, flexible, and standardized interface for managing such
hints. The registry allows any address to manage multiple lists of hints, with a set of features that not only make it
easier to create and manage these hints but also offer the flexibility of delegating these capabilities to trusted
entities. In practice, this turns the hint lists into dynamic tools adaptable to varying requirements and use cases.
Moreover, an interface has been designed with a keen focus on interoperability, taking into consideration existing W3C
specifications around Decentralized Identifiers and Verifiable Credentials, as well as aligning with on-chain projects
like the Ethereum Attestation Service.&lt;&#x2F;p&gt;
&lt;p&gt;By providing a standardized smart contract interface for hint management, this specification plays an integral role in
enabling and scaling trust in decentralized ecosystems. It offers a foundational layer upon which claims — both on-chain
and off-chain — can be reliably issued, verified, and interpreted, thus serving as an essential building block for the
credible operation of any decentralized ecosystem. Therefore, the Trusted Hint Registry is not just an addition to the
ecosystem but a necessary evolution in the complex topology of decentralized trust.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and
“OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP specifies a contract called &lt;code&gt;TrustedHintRegistry&lt;&#x2F;code&gt; and standardizes a set of &lt;strong&gt;REQUIRED&lt;&#x2F;strong&gt; core hint functions,
while also providing a common set of &lt;strong&gt;OPTIONAL&lt;&#x2F;strong&gt; management functions, enabling various ways for collaborative hint
management. Ecosystems &lt;strong&gt;MAY&lt;&#x2F;strong&gt; use this specification to build their own hint registry contracts with ecosystem-specific,
non-standardized features. Governance is deliberately excluded from this ERC and &lt;strong&gt;MAY&lt;&#x2F;strong&gt; be implemented according to an
ecosystem&#x27;s need.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;claim&lt;&#x2F;code&gt;: A claim is a statement about an entity made by another entity.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;hint&lt;&#x2F;code&gt;: A &quot;hint&quot; refers to a small piece of information that provides insights, aiding in the interpretation,
reliability, or verifiability of decentralized ecosystem data.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;namespace&lt;&#x2F;code&gt;: A namespace is a representation of an Ethereum address inside the registry that corresponds to its
owner’s address. A namespace contains hint lists for different use cases.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;hint list&lt;&#x2F;code&gt;: A hint list is identified by a unique value that contains a number of hint keys that resolve to hint
values. An example of this is a revocation key that resolves to a revocation state.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;hint key&lt;&#x2F;code&gt;: A hint key is a unique value that resolves to a hint value. An example of this is a trusted issuer
identifier, which resolves to the trust status of that identifier.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;hint value&lt;&#x2F;code&gt;: A hint value expresses data about an entity in an ecosystem.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;delegate&lt;&#x2F;code&gt;: An Ethereum address that has been granted writing permissions to a hint list by its owner.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;interface&quot;&gt;Interface&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;hint-management&quot;&gt;Hint Management&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;gethint&quot;&gt;getHint&lt;&#x2F;h5&gt;
&lt;p&gt;A method with the following signature &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be implemented that returns the hint value in a hint list of a namespace.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getHint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _list&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;sethint&quot;&gt;setHint&lt;&#x2F;h5&gt;
&lt;p&gt;A method with the following signature &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be implemented that changes the hint value in a hint list of a namespace.
An overloaded method with an additional &lt;code&gt;bytes calldata _metadata&lt;&#x2F;code&gt; parameter &lt;strong&gt;MAY&lt;&#x2F;strong&gt; be implemented to set metadata
together with the hint value.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setHint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _list&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;sethintsigned&quot;&gt;setHintSigned&lt;&#x2F;h5&gt;
&lt;p&gt;A method with the following signature &lt;strong&gt;MAY&lt;&#x2F;strong&gt; be implemented that changes the hint value in a hint list of a namespace
with a raw signature. The raw signature &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be generated following the Meta Transactions section. An overloaded
method with an additional &lt;code&gt;bytes calldata _metadata&lt;&#x2F;code&gt; parameter &lt;strong&gt;MAY&lt;&#x2F;strong&gt; be implemented to set metadata together with the
hint value.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setHintSigned&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _list&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _signer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The type hash &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be the keccak256 hash of &lt;code&gt;SetHintSigned(address namespace,bytes32 list,bytes32 key,bytes32 value,address signer,uint256 nonce)&lt;&#x2F;code&gt;
or &lt;code&gt;SetHintSigned(address namespace,bytes32 list,bytes32 key,bytes32 value,bytes metadata,address signer,uint256 nonce)&lt;&#x2F;code&gt;
when calling the metadata variant.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;sethints&quot;&gt;setHints&lt;&#x2F;h5&gt;
&lt;p&gt;A method with the following signature &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be implemented that changes multiple hint values in a hint list of a
namespace. An overloaded method with an additional &lt;code&gt;bytes[] calldata _metadata&lt;&#x2F;code&gt; parameter &lt;strong&gt;MAY&lt;&#x2F;strong&gt; be implemented to set
metadata together with the hint value.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setHints&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _list&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _keys&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _values&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;sethintssigned&quot;&gt;setHintsSigned&lt;&#x2F;h5&gt;
&lt;p&gt;A method with the following signature &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be implemented that multiple hint values in a hint list of a namespace
with a raw signature. The raw signature &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be generated following the Meta Transactions section. An overloaded
method with an additional &lt;code&gt;bytes[] calldata _metadata&lt;&#x2F;code&gt; parameter &lt;strong&gt;MAY&lt;&#x2F;strong&gt; be implemented to set metadata together with the
hint value.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setHintsSigned&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _list&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _keys&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _values&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _signer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The type hash &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be the keccak256 hash of &lt;code&gt;SetHintsSigned(address namespace,bytes32 list,bytes32[] keys,bytes32[] values,address signer,uint256 nonce)&lt;&#x2F;code&gt;
or &lt;code&gt;SetHintsSigned(address namespace,bytes32 list,bytes32[] keys,bytes32[] values,bytes[] metadata,address signer,uint256 nonce)&lt;&#x2F;code&gt;
when calling the metadata variant.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;delegated-hint-management&quot;&gt;Delegated Hint Management&lt;&#x2F;h4&gt;
&lt;p&gt;A namespace owner can add delegate addresses to specific hint lists in their namespace. These delegates &lt;strong&gt;SHALL&lt;&#x2F;strong&gt; have
write access to the specific lists via a specific set of methods.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;sethintdelegated&quot;&gt;setHintDelegated&lt;&#x2F;h5&gt;
&lt;p&gt;A method with the following signature &lt;strong&gt;MAY&lt;&#x2F;strong&gt; be implemented that changes the hint value in a hint list of a namespace
for pre-approved delegates. An overloaded method with an additional &lt;code&gt;bytes calldata _metadata&lt;&#x2F;code&gt; parameter &lt;strong&gt;MAY&lt;&#x2F;strong&gt; be
implemented to set metadata together with the hint value.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setHintDelegated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _list&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;sethintdelegatedsigned&quot;&gt;setHintDelegatedSigned&lt;&#x2F;h5&gt;
&lt;p&gt;A method with the following signature &lt;strong&gt;MAY&lt;&#x2F;strong&gt; be implemented that changes the hint value in a hint list of a namespace
for pre-approved delegates with a raw signature. The raw signature &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be generated following the Meta Transactions
section. An overloaded method with an additional &lt;code&gt;bytes calldata _metadata&lt;&#x2F;code&gt; parameter &lt;strong&gt;MAY&lt;&#x2F;strong&gt; be implemented to set
metadata together with the hint value.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setHintDelegatedSigned&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _list&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _signer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The type hash &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be the keccak256 hash of &lt;code&gt;SetHintDelegatedSigned(address namespace,bytes32 list,bytes32 key,bytes32 value,address signer,uint256 nonce)&lt;&#x2F;code&gt;
or &lt;code&gt;SetHintDelegatedSigned(address namespace,bytes32 list,bytes32 key,bytes32 value,bytes metadata,address signer,uint256 nonce)&lt;&#x2F;code&gt;
when calling the metadata variant.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;sethintsdelegated&quot;&gt;setHintsDelegated&lt;&#x2F;h5&gt;
&lt;p&gt;A method with the following signature &lt;strong&gt;MAY&lt;&#x2F;strong&gt; be implemented that changes multiple hint values in a hint list of a
namespace for pre-approved delegates. An overloaded method with an additional &lt;code&gt;bytes[] calldata _metadata&lt;&#x2F;code&gt; parameter
&lt;strong&gt;MAY&lt;&#x2F;strong&gt; be implemented to set metadata together with the hint value.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setHintsDelegated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _list&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _keys&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _values&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;sethintsdelegatedsigned&quot;&gt;setHintsDelegatedSigned&lt;&#x2F;h5&gt;
&lt;p&gt;A method with the following signature &lt;strong&gt;MAY&lt;&#x2F;strong&gt; be implemented that has multiple hint values in a hint list of a namespace
for pre-approved delegates with a raw signature. The raw signature &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be generated following the Meta Transactions
section. An overloaded method with an additional &lt;code&gt;bytes[] calldata _metadata&lt;&#x2F;code&gt; parameter &lt;strong&gt;MAY&lt;&#x2F;strong&gt; be implemented to set
metadata together with the hint value.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setHintsDelegatedSigned&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _list&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _keys&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _values&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _signer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The type hash &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be the keccak256 hash of &lt;code&gt;SetHintsDelegatedSigned(address namespace,bytes32 list,bytes32[] keys,bytes32[] values,address signer,uint256 nonce)&lt;&#x2F;code&gt;
or &lt;code&gt;SetHintsDelegatedSigned(address namespace,bytes32 list,bytes32[] keys,bytes32[] values,bytes[] metadata,address signer,uint256 nonce)&lt;&#x2F;code&gt;
when calling the metadata variant.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;hint-list-management&quot;&gt;Hint List Management&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;setliststatus&quot;&gt;setListStatus&lt;&#x2F;h5&gt;
&lt;p&gt;A method with the following signature &lt;strong&gt;MAY&lt;&#x2F;strong&gt; be implemented that changes the validity state of a hint list. Revoking a
list &lt;strong&gt;CAN&lt;&#x2F;strong&gt; be used to invalidate all hint values in a list.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setListStatus&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _list&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _revoked&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;setliststatussigned&quot;&gt;setListStatusSigned&lt;&#x2F;h5&gt;
&lt;p&gt;A method with the following signature &lt;strong&gt;MAY&lt;&#x2F;strong&gt; be implemented that changes the validity state of a hint list with a raw
signature. Revoking a list &lt;strong&gt;CAN&lt;&#x2F;strong&gt; be used to invalidate all hint values in a list.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setListStatusSigned&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _list&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _revoked&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _signer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The type hash &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be the keccak256 hash of &lt;code&gt;SetListStatusSigned(address namespace,bytes32 list,bool revoked,address signer,uint256 nonce)&lt;&#x2F;code&gt;
when generating the signature.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;setlistowner&quot;&gt;setListOwner&lt;&#x2F;h5&gt;
&lt;p&gt;A method with the following signature &lt;strong&gt;MAY&lt;&#x2F;strong&gt; be implemented that transfers the ownership of a trust list to another
address. Changing the owner of a list &lt;strong&gt;SHALL NOT&lt;&#x2F;strong&gt; change the namespace the hint list resides in, to retain references
of paths to a hint value.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setListOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _list&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _newOwner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;setlistownersigned&quot;&gt;setListOwnerSigned&lt;&#x2F;h5&gt;
&lt;p&gt;A method with the following signature &lt;strong&gt;MAY&lt;&#x2F;strong&gt; be implemented that transfers the ownership of a trust list to another
address with a raw signature. The raw signature &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be generated following the Meta Transactions section. Changing
the owner of a list &lt;strong&gt;SHALL NOT&lt;&#x2F;strong&gt; change the namespace the hint list resides in, to retain references to paths to a hint
value.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setListOwnerSigned&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _list&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _newOwner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _signer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The type hash &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be the keccak256 hash of &lt;code&gt;SetListOwnerSigned(address namespace,bytes32 list,address newOwner,address signer,uint256 nonce)&lt;&#x2F;code&gt;
when generating the signature.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;addlistdelegate&quot;&gt;addListDelegate&lt;&#x2F;h5&gt;
&lt;p&gt;A method with the following signature &lt;strong&gt;MAY&lt;&#x2F;strong&gt; be implemented to add a delegate to an owner’s hint list in a namespace.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addListDelegate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _list&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _delegate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _untilTimestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;addlistdelegatesigned&quot;&gt;addListDelegateSigned&lt;&#x2F;h5&gt;
&lt;p&gt;A method with the following signature &lt;strong&gt;MAY&lt;&#x2F;strong&gt; be implemented to add a delegate to an owner’s hint list in a namespace
with a raw signature. The raw signature &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be generated following the Meta Transactions section.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addListDelegateSigned&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _list&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _delegate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _untilTimestamp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _signer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The type hash &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be the keccak256 hash of &lt;code&gt;AddListDelegateSigned(address namespace,bytes32 list,address delegate,uint256 untilTimestamp,address signer,uint256 nonce)&lt;&#x2F;code&gt;
when generating the signature.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;removelistdelegate&quot;&gt;removeListDelegate&lt;&#x2F;h5&gt;
&lt;p&gt;A method with the following signature &lt;strong&gt;MAY&lt;&#x2F;strong&gt; be implemented to remove a delegate from an owner’s hint list in a namespace.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; removeListDelegate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _list&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _delegate&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;removelistdelegatesigned&quot;&gt;removeListDelegateSigned&lt;&#x2F;h5&gt;
&lt;p&gt;A method with the following signature &lt;strong&gt;MAY&lt;&#x2F;strong&gt; be implemented to remove a delegate from an owner’s hint list in a namespace
with a raw signature. The raw signature &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be generated following the Meta Transactions section.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; removeListDelegateSigned&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _list&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _delegate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _signer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The type hash &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be the keccak256 hash of &lt;code&gt;RemoveListDelegateSigned(address namespace,bytes32 list,address delegate,address signer,uint256 nonce)&lt;&#x2F;code&gt;
when generating the signature.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;metadata-management&quot;&gt;Metadata Management&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;getmetadata&quot;&gt;getMetadata&lt;&#x2F;h5&gt;
&lt;p&gt;A method with the following signature &lt;strong&gt;MAY&lt;&#x2F;strong&gt; be implemented to retrieve metadata for a hint.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getMetadata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _list&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;setmetadata&quot;&gt;setMetadata&lt;&#x2F;h5&gt;
&lt;p&gt;A method with the following signature &lt;strong&gt;MAY&lt;&#x2F;strong&gt; be implemented to set metadata for a hint.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setMetadata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _list&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _metadata&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;setmetadatasigned&quot;&gt;setMetadataSigned&lt;&#x2F;h5&gt;
&lt;p&gt;A method with the following signature &lt;strong&gt;MAY&lt;&#x2F;strong&gt; be implemented to set metadata for a hint with a raw signature. The raw
signature &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be generated following the Meta Transactions section.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setMetadataSigned&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _list&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _metadata&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _signer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The type hash &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be the keccak256 hash of &lt;code&gt;SetMetadataSigned(address namespace,bytes32 list,bytes32 key,bytes32 value,bytes metadata,address signer,uint256 nonce)&lt;&#x2F;code&gt;
when generating the signature.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;setmetadatadelegated&quot;&gt;setMetadataDelegated&lt;&#x2F;h4&gt;
&lt;p&gt;A method with the following signature &lt;strong&gt;MAY&lt;&#x2F;strong&gt; be implemented to set metadata for a hint as a pre-approved delegate of
the hint list.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setMetadataDelegated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _list&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _metadata&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;setmetadatadelegatedsigned&quot;&gt;setMetadataDelegatedSigned&lt;&#x2F;h5&gt;
&lt;p&gt;A method with the following signature &lt;strong&gt;MAY&lt;&#x2F;strong&gt; be implemented to set metadata for a hint as a pre-approved delegate of
the hint list with a raw signature. The raw signature &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be generated following the Meta Transactions section.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setMetadataDelegatedSigned&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _list&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _metadata&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _signer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The type hash &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be the keccak256 hash of &lt;code&gt;SetMetadataDelegatedSigned(address namespace,bytes32 list,bytes32 key,bytes32 value,bytes metadata,address signer,uint256 nonce)&lt;&#x2F;code&gt;
when generating the signature.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;events&quot;&gt;Events&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;hintvaluechanged&quot;&gt;HintValueChanged&lt;&#x2F;h5&gt;
&lt;p&gt;&lt;strong&gt;MUST&lt;&#x2F;strong&gt; be emitted when a hint value has changed.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; HintValueChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; list&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;hintlistownerchanged&quot;&gt;HintListOwnerChanged&lt;&#x2F;h5&gt;
&lt;p&gt;&lt;strong&gt;MUST&lt;&#x2F;strong&gt; be emitted when the owner of a list has changed.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; HintListOwnerChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; list&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newOwner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;hintlistdelegateadded&quot;&gt;HintListDelegateAdded&lt;&#x2F;h5&gt;
&lt;p&gt;&lt;strong&gt;MUST&lt;&#x2F;strong&gt; be emitted when a delegate has been added to a hint list.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; HintListDelegateAdded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; list&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newDelegate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;hintlistdelegateremoved&quot;&gt;HintListDelegateRemoved&lt;&#x2F;h5&gt;
&lt;p&gt;&lt;strong&gt;MUST&lt;&#x2F;strong&gt; be emitted when a delegate has been removed from a hint list.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; HintListDelegateRemoved&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; list&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; oldDelegate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;hintliststatuschanged&quot;&gt;HintListStatusChanged&lt;&#x2F;h5&gt;
&lt;p&gt;&lt;strong&gt;MUST&lt;&#x2F;strong&gt; be emitted when the validity status of the hint list has been changed.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; HintListStatusChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; list&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; revoked&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;meta-transactions&quot;&gt;Meta Transactions&lt;&#x2F;h3&gt;
&lt;p&gt;This section uses the following terms:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;transaction signer&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: An Ethereum address that signs arbitrary data for the contract to execute &lt;strong&gt;BUT&lt;&#x2F;strong&gt; does not
commit the transaction.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;transaction sender&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: An Ethereum address that takes signed data from a &lt;strong&gt;transaction signer&lt;&#x2F;strong&gt; and commits it
as part of the method call in a transaction to the smart contract.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;A &lt;strong&gt;transaction signer&lt;&#x2F;strong&gt; &lt;strong&gt;MAY&lt;&#x2F;strong&gt; be able to deliver a signed payload off-band to a &lt;strong&gt;transaction sender&lt;&#x2F;strong&gt; that initiates
the Ethereum interaction with the smart contract. The signed payload &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be limited to being used only
once (see Signed Hash and Nonce).&lt;&#x2F;p&gt;
&lt;h4 id=&quot;signed-hash&quot;&gt;Signed Hash&lt;&#x2F;h4&gt;
&lt;p&gt;The signature of the &lt;strong&gt;transaction signer&lt;&#x2F;strong&gt; &lt;strong&gt;MUST&lt;&#x2F;strong&gt; conform to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt;. This helps users understand
what the payload they are signing consists of, and it provides protection against replay attacks.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;nonce&quot;&gt;Nonce&lt;&#x2F;h4&gt;
&lt;p&gt;This EIP &lt;strong&gt;RECOMMENDS&lt;&#x2F;strong&gt; the use of a &lt;strong&gt;dedicated nonce mapping&lt;&#x2F;strong&gt; for meta transactions. If the signature of the
&lt;strong&gt;transaction sender&lt;&#x2F;strong&gt; and its meta-contents are verified, the contract increases a nonce for the
&lt;strong&gt;transaction signer&lt;&#x2F;strong&gt;. This effectively removes the possibility for any other sender to execute the same transaction
again with another wallet.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;trust-anchor-via-ens&quot;&gt;Trust Anchor via ENS&lt;&#x2F;h3&gt;
&lt;p&gt;Ecosystems that use an Ethereum Name Service (ENS) domain can increase trust by using ENS entries to share information
about a hint list registry. This method takes advantage of the ENS domain&#x27;s established credibility to make it easier to
find a hint registry contract of the domain&#x27;s entity, as well as the appropriate namespace and hint list customized for
particular ecosystem needs. Implementing a trust anchor through ENS is &lt;strong&gt;OPTIONAL&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;For each use case, a specific or set of ENS subdomain &lt;strong&gt;SHALL&lt;&#x2F;strong&gt; be created. Each subdomain should be treated as an
atomic entity for a singular set of namespace-list-key-value TEXT records. The following records &lt;strong&gt;SHALL&lt;&#x2F;strong&gt; be set:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;ADDRESS ETH - address of the trusted hint registry contract&lt;&#x2F;li&gt;
&lt;li&gt;TEXT - key: “hint.namespace”; value: owner address of namespace&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The following records &lt;strong&gt;MAY&lt;&#x2F;strong&gt; be set:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;TEXT - key: “hint.list”; value: bytes32 key of hint list&lt;&#x2F;li&gt;
&lt;li&gt;TEXT - key: “hint.key”; value: bytes32 key of hint key&lt;&#x2F;li&gt;
&lt;li&gt;TEXT - key: “hint.value”; value: bytes32 key of hint value&lt;&#x2F;li&gt;
&lt;li&gt;ABI - ABI of trusted hint registry contract&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;To create a two-way connection, a namespace owner &lt;strong&gt;SHALL&lt;&#x2F;strong&gt; set metadata referencing the complete ENS subdomain hash.
Metadata &lt;strong&gt;SHALL&lt;&#x2F;strong&gt; be set in the owners namespace with a hint list and hint key value of &lt;code&gt;0x0&lt;&#x2F;code&gt; where the hint value is
the ENS subdomain keccak256 hash.&lt;&#x2F;p&gt;
&lt;p&gt;By establishing this connection, a robust foundation for trust and discovery within an ecosystem is created.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Examining the method signatures reveals a deliberate architecture and data hierarchy within this ERC: A namespace
address maps to a hint list, which in turn maps to a hint key, which then reveals the hint value.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     namespace          hint list          hint key    hint value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; hints&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This structure is designed to implicitly establish the initial ownership of all lists under a given namespace,
eliminating the need for subsequent claiming actions. As a result, it simplifies the process of verifying and enforcing
write permissions, thereby reducing potential attack surfaces. Additional data structures must be established and
validated for features like delegate management and ownership transfer of hint lists. These structures won&#x27;t affect the
main namespace layout; rather, they serve as a secondary mechanism for permission checks.&lt;&#x2F;p&gt;
&lt;p&gt;One of the primary objectives of this ERC is to include management features, as these significantly influence the ease
of collaboration and maintainability of hint lists. These features also enable platforms to hide complexities while
offering user-friendly interfaces. Specifically, the use of meta-transactions allows users to maintain control over
their private keys while outsourcing the technical heavy lifting to platforms, which is achieved simply by signing an
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; payload.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;meta-transactions-1&quot;&gt;Meta Transactions&lt;&#x2F;h3&gt;
&lt;p&gt;The signature of signed transactions could potentially be replayed on different chains or deployed versions of the
registry implementing this ERC. This security consideration is addressed by the usage
of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;rights-management&quot;&gt;Rights Management&lt;&#x2F;h3&gt;
&lt;p&gt;The different roles and their inherent permissions are meant to prevent changes from unauthorized entities. The hint
list owner should always be in complete control over its hint list and who has writing access to it.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;governance&quot;&gt;Governance&lt;&#x2F;h3&gt;
&lt;p&gt;It is recognized that ecosystems might have processes in place that might also apply to changes in hint lists. This ERC
explicitly leaves room for implementers or users of the registry to apply a process that fits the requirements of their
ecosystem. Possible solutions can be an extension of the contract with governance features around specific methods, the
usage of multi-sig wallets, or off-chain processes enforced by an entity.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Multi-User NFT Extension</title>
        <published>2023-08-24T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Ming Jiang</name><uri>https://github.com/minkyn</uri>
	</author>
	
	<author>
		<name>Zheng Han</name><uri>https://github.com/hanbsd</uri>
	</author>
	
	<author>
		<name>Fan Yang</name><uri>https://github.com/fayang</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7507/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7507-multi-user-nft-extension/15660" />
        

        <id>https://wg-eips.ritovision.com/7507/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7507"
            label="ERC-7507" />
        

        
        

        
        <summary type="html">An extension of ERC-721 to allow multiple users to a token with restricted permissions.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7507/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is an extension of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;. It proposes a new role &lt;code&gt;user&lt;&#x2F;code&gt; in addition to &lt;code&gt;owner&lt;&#x2F;code&gt; for a token. A token can have multiple users under separate expiration time. It allows the subscription model where an NFT can be subscribed non-exclusively by different users.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Some NFTs represent IP assets, and IP assets have the need to be licensed for access without transferring ownership. The subscription model is a very common practice for IP licensing where multiple users can subscribe to an NFT to obtain access. Each subscription is usually time limited and will thus be recorded with an expiration time.&lt;&#x2F;p&gt;
&lt;p&gt;Existing &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4907&#x2F;&quot;&gt;ERC-4907&lt;&#x2F;a&gt; introduces a similar feature, but does not allow for more than one user. It is more suitable in the rental scenario where a user gains an exclusive right of use to an NFT before the next user. This rental model is common for NFTs representing physical assets like in games, but not very useful for shareable IP assets.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Solidity interface available at &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7507&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;IERC7507.sol&quot;&gt;&lt;code&gt;IERC7507.sol&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7507&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when the expires of a user for an NFT is &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UpdateUser&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expires&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the user expires of an NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT to get the user expires for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; user&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The user to get the expires for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; user expires for this NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; userExpires&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Set the user expires of an NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT to set the user expires for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; user&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The user to set the expires for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; expires&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The user could use the NFT before expires in UNIX timestamp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setUser&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expires&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This standard complements &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4907&#x2F;&quot;&gt;ERC-4907&lt;&#x2F;a&gt; to support multi-user feature. Therefore the proposed interface tries to keep consistent using the same naming for functions and parameters.&lt;&#x2F;p&gt;
&lt;p&gt;However, we didn&#x27;t include the corresponding &lt;code&gt;usersOf(uint256 tokenId)&lt;&#x2F;code&gt; function as that would imply the implemention has to support enumerability over multiple users. It is not always necessary, for example, in the case of open subscription. So we decide not to add it to the interface and leave the choice up to the implementers.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backwards compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases available at: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7507&#x2F;.&#x2F;assets&#x2F;test&#x2F;ERC7507.test.ts&quot;&gt;&lt;code&gt;ERC7507.test.ts&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; loadFixture&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;@nomicfoundation&#x2F;hardhat-toolbox&#x2F;network-helpers&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; expect&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;chai&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ethers&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;hardhat&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; NAME&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;NAME&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; SYMBOL&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;SYMBOL&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; TOKEN_ID&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1234&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; EXPIRATION&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2000000000&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; YEAR&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 31536000&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;describe&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ERC7507&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;  async&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; deployContractFixture&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;deployer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; user1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; user2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ethers&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getSigners&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ethers&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;deployContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ERC7507&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;NAME&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; SYMBOL&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; deployer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; TOKEN_ID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; user1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; user2&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  describe&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Functions&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    it&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Should not set user if not owner or approved&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; async&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      const&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; user1&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; loadFixture&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;deployContractFixture&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      await&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;setUser&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;TOKEN_ID&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; user1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; EXPIRATION&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        .&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;be&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;revertedWith&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ERC7507: caller is not owner or approved&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    it&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Should return zero expiration for nonexistent user&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; async&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      const&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; user1&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; loadFixture&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;deployContractFixture&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;userExpires&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;TOKEN_ID&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; user1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    it&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Should set users and then update&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; async&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      const&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; user1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; user2&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; loadFixture&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;deployContractFixture&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;connect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;setUser&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;TOKEN_ID&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; user1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; EXPIRATION&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;connect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;setUser&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;TOKEN_ID&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; user2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; EXPIRATION&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;userExpires&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;TOKEN_ID&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; user1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;EXPIRATION&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;userExpires&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;TOKEN_ID&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; user2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;EXPIRATION&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;connect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;setUser&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;TOKEN_ID&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; user1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; EXPIRATION&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; YEAR&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;connect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;setUser&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;TOKEN_ID&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; user2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;userExpires&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;TOKEN_ID&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; user1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;EXPIRATION&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; YEAR&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;userExpires&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;TOKEN_ID&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; user2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  describe&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Events&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    it&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Should emit event when set user&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; async&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      const&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; user1&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; loadFixture&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;deployContractFixture&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      await&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;connect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;setUser&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;TOKEN_ID&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; user1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; EXPIRATION&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        .&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;emit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;UpdateUser&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;withArgs&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;TOKEN_ID&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; user1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; EXPIRATION&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Reference implementation available at: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7507&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;ERC7507.sol&quot;&gt;&lt;code&gt;ERC7507.sol&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC721&#x2F;ERC721.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERC7507.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC7507&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC7507&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _expires&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; symbol&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;name, symbol) &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;IERC7507&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; userExpires&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_exists&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC7507: query for nonexistent token&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _expires&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;user&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setUser&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expires&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_isApprovedOrOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_msgSender&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC7507: caller is not owner or approved&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _expires&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;user&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; expires&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UpdateUser&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; expires&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;No security considerations found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Cross-Contract Hierarchical NFT</title>
        <published>2023-08-24T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Ming Jiang</name><uri>https://github.com/minkyn</uri>
	</author>
	
	<author>
		<name>Zheng Han</name><uri>https://github.com/hanbsd</uri>
	</author>
	
	<author>
		<name>Fan Yang</name><uri>https://github.com/fayang</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7510/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7510-cross-contract-hierarchical-nft/15687" />
        

        <id>https://wg-eips.ritovision.com/7510/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7510"
            label="ERC-7510" />
        

        
        

        
        <summary type="html">An extension of ERC-721 to maintain hierarchical relationship between tokens from different contracts.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7510/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is an extension of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;. It proposes a way to maintain hierarchical relationship between tokens from different contracts. This standard provides an interface to query the parent tokens of an NFT or whether the parent relation exists between two NFTs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Some NFTs want to generate derivative assets as new NFTs. For example, a 2D NFT image would like to publish its 3D model as a new derivative NFT. An NFT may also be derived from multiple parent NFTs. Such cases include a movie NFT featuring multiple characters from other NFTs. This standard is proposed to record such hierarchical relationship between derivative NFTs.&lt;&#x2F;p&gt;
&lt;p&gt;Existing &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6150&#x2F;&quot;&gt;ERC-6150&lt;&#x2F;a&gt; introduces a similar feature, but it only builds hierarchy between tokens within the same contract. More than often we need to create a new NFT collection with the derivative tokens, which requires cross-contract relationship establishment. In addition, deriving from multiple parents is very common in the scenario of IP licensing, but the existing standard doesn&#x27;t support that either.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Solidity interface available at &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7510&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;IERC7510.sol&quot;&gt;&lt;code&gt;IERC7510.sol&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The struct used to reference a token in an NFT contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Token&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; id&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7510&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when the parent tokens for an NFT is updated&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UpdateParentTokens&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the parent tokens of an NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT to get the parent tokens for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; An&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of parent tokens for this NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; parentTokensOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Token&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check if another token is a parent of an NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT to check its parent for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; otherToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Another token to check as a parent or not&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Whether&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `otherToken` is a parent of `tokenId`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isParentToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; Token&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; otherToken&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Set the parent tokens for an NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT to set the parent tokens for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; parentTokens&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The parent tokens to set&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setParentTokens&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; Token&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; parentTokens&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This standard differs from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6150&#x2F;&quot;&gt;ERC-6150&lt;&#x2F;a&gt; in mainly two aspects: supporting cross-contract token reference, and allowing multiple parents. But we try to keep the naming consistent overall.&lt;&#x2F;p&gt;
&lt;p&gt;In addition, we didn&#x27;t include &lt;code&gt;child&lt;&#x2F;code&gt; relation in the interface. An original NFT exists before its derivative NFTs. Therefore we know what parent tokens to include when minting derivative NFTs, but we wouldn&#x27;t know the children tokens when minting the original NFT. If we have to record the children, that means whenever we mint a derivative NFT, we need to call on its original NFT to add it as a child. However, those two NFTs may belong to different contracts and thus require different write permissions, making it impossible to combine the two operations into a single transaction in practice. As a result, we decide to only record the &lt;code&gt;parent&lt;&#x2F;code&gt; relation from the derivative NFTs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backwards compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases available at: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7510&#x2F;.&#x2F;assets&#x2F;test&#x2F;ERC7510.test.ts&quot;&gt;&lt;code&gt;ERC7510.test.ts&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; loadFixture&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;@nomicfoundation&#x2F;hardhat-toolbox&#x2F;network-helpers&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; expect&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;chai&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ethers&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;hardhat&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; NAME&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;NAME&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; SYMBOL&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;SYMBOL&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; TOKEN_ID&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1234&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; PARENT_1_COLLECTION&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xDEAdBEEf00000000000000000123456789ABCdeF&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; PARENT_1_ID&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 8888&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; PARENT_1_TOKEN&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; PARENT_1_COLLECTION&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; PARENT_1_ID&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; PARENT_2_COLLECTION&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xBaDc0ffEe0000000000000000123456789aBCDef&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; PARENT_2_ID&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 9999&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; PARENT_2_TOKEN&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; PARENT_2_COLLECTION&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; PARENT_2_ID&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;describe&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ERC7510&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;  async&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; deployContractFixture&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;deployer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ethers&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getSigners&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ethers&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;deployContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ERC7510&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;NAME&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; SYMBOL&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; deployer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; TOKEN_ID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  describe&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Functions&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    it&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Should not set parent tokens if not owner or approved&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; async&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      const&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; loadFixture&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;deployContractFixture&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      await&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;setParentTokens&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;TOKEN_ID&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;PARENT_1_TOKEN&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        .&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;be&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;revertedWith&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ERC7510: caller is not owner or approved&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    it&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Should correctly query token without parents&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; async&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      const&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; loadFixture&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;deployContractFixture&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;parentTokensOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;TOKEN_ID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;have&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;lengthOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isParentToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;TOKEN_ID&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; PARENT_1_TOKEN&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    it&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Should set parent tokens and then update&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; async&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      const&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; loadFixture&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;deployContractFixture&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;connect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;setParentTokens&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;TOKEN_ID&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;PARENT_1_TOKEN&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; parentTokens&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;parentTokensOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;TOKEN_ID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;parentTokens&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;have&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;lengthOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;parentTokens&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;collection&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;PARENT_1_COLLECTION&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;parentTokens&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;PARENT_1_ID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isParentToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;TOKEN_ID&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; PARENT_1_TOKEN&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;true&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isParentToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;TOKEN_ID&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; PARENT_2_TOKEN&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;connect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;setParentTokens&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;TOKEN_ID&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;PARENT_2_TOKEN&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      parentTokens&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;parentTokensOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;TOKEN_ID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;parentTokens&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;have&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;lengthOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;parentTokens&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;collection&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;PARENT_2_COLLECTION&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;parentTokens&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;PARENT_2_ID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isParentToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;TOKEN_ID&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; PARENT_1_TOKEN&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isParentToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;TOKEN_ID&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; PARENT_2_TOKEN&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;true&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    it&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Should burn and clear parent tokens&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; async&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      const&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; loadFixture&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;deployContractFixture&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;connect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;setParentTokens&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;TOKEN_ID&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;PARENT_1_TOKEN&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; PARENT_2_TOKEN&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;burn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;TOKEN_ID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      await&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;parentTokensOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;TOKEN_ID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;be&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;revertedWith&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ERC7510: query for nonexistent token&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      await&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isParentToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;TOKEN_ID&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; PARENT_1_TOKEN&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;be&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;revertedWith&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ERC7510: query for nonexistent token&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      await&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isParentToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;TOKEN_ID&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; PARENT_2_TOKEN&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;be&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;revertedWith&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ERC7510: query for nonexistent token&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; TOKEN_ID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;parentTokensOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;TOKEN_ID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;have&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;lengthOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isParentToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;TOKEN_ID&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; PARENT_1_TOKEN&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isParentToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;TOKEN_ID&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; PARENT_2_TOKEN&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  describe&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Events&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    it&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Should emit event when set parent tokens&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; async&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      const&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; loadFixture&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;deployContractFixture&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      await&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;connect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;setParentTokens&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;TOKEN_ID&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;PARENT_1_TOKEN&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; PARENT_2_TOKEN&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        .&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;emit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;UpdateParentTokens&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;withArgs&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;TOKEN_ID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Reference implementation available at: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7510&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;ERC7510.sol&quot;&gt;&lt;code&gt;ERC7510.sol&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC721&#x2F;ERC721.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERC7510.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC7510&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC7510&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Token&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _parentTokens&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _isParentToken&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; symbol&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;name, symbol) &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;IERC7510&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; parentTokensOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Token&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_exists&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC7510: query for nonexistent token&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _parentTokens&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isParentToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; Token&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; otherToken&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_exists&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC7510: query for nonexistent token&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _isParentToken&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;otherToken&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;collection&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;otherToken&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;id&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setParentTokens&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; Token&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; parentTokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_isApprovedOrOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_msgSender&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC7510: caller is not owner or approved&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _clear&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; parentTokens&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            _parentTokens&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;push&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;parentTokens&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            _isParentToken&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;parentTokens&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;collection&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;parentTokens&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;id&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UpdateParentTokens&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _burn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_burn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _clear&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _clear&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        Token&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; storage&lt;&#x2F;span&gt;&lt;span&gt; parentTokens &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _parentTokens&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; parentTokens&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            delete&lt;&#x2F;span&gt;&lt;span&gt; _isParentToken&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;parentTokens&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;collection&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;parentTokens&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;id&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        delete&lt;&#x2F;span&gt;&lt;span&gt; _parentTokens&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Parent tokens of an NFT may point to invalid data for two reasons. First, parent tokens could be burned later. Second, a contract implementing &lt;code&gt;setParentTokens&lt;&#x2F;code&gt; might not check the validity of &lt;code&gt;parentTokens&lt;&#x2F;code&gt; arguments. For security consideration, applications that retrieve parent tokens of an NFT need to verify they exist as valid tokens.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>SSZ ProgressiveContainer</title>
        <published>2023-08-18T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Etan Kissling</name><uri>https://github.com/etan-status</uri>
	</author>
	
	<author>
		<name>Cayman</name><uri>https://github.com/wemeetagain</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7495/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7495-ssz-progressivecontainer/15476" />
        

        <id>https://wg-eips.ritovision.com/7495/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        

        
        <category
            term="tag:eip:7495"
            label="EIP-7495" />
        

        
        

        
        <summary type="html">SSZ type for forward-compatible containers</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7495/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a new &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;ad36024441cf910d428d03f87f331fbbd2b3e5f1&#x2F;ssz&#x2F;simple-serialize.md&quot;&gt;Simple Serialize (SSZ)&lt;&#x2F;a&gt; type to represent containers with forward-compatible Merkleization: A given field is always assigned the same stable &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;ad36024441cf910d428d03f87f331fbbd2b3e5f1&#x2F;ssz&#x2F;merkle-proofs.md#generalized-merkle-tree-index&quot;&gt;generalized index (gindex)&lt;&#x2F;a&gt; even when different container versions append new fields or drop existing fields.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;SSZ containers are frequently versioned, for example across fork boundaries. When the number of fields reaches a new power of two, or a field is removed or replaced with one of a different type, the shape of the underlying Merkle tree changes, breaking verifiers of Merkle proofs for these containers. Deploying a new verifier may involve security councils to upgrade smart contract logic, or require firmware updates for embedded devices. This effort is needed even when no semantic changes apply to the fields that the verifier is interested in.&lt;&#x2F;p&gt;
&lt;p&gt;Progressive containers address these shortcomings by:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Using the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7916&#x2F;&quot;&gt;progressive Merkle tree&lt;&#x2F;a&gt; structure to progressively grow to the actual field count with minimal overhead, ensuring provers remain valid as the field count changes.&lt;&#x2F;li&gt;
&lt;li&gt;Assigning stable gindices for each field across all versions by allowing gaps in the Merkle tree where a field is absent.&lt;&#x2F;li&gt;
&lt;li&gt;Serializing in a compact form where absent fields do not consume space.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;progressivecontainer-active-fields&quot;&gt;&lt;code&gt;ProgressiveContainer(active_fields)&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;A new &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;ad36024441cf910d428d03f87f331fbbd2b3e5f1&#x2F;ssz&#x2F;simple-serialize.md#composite-types&quot;&gt;SSZ composite types&lt;&#x2F;a&gt; is defined:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;progressive container&lt;&#x2F;strong&gt;: ordered heterogeneous collection of values with stable Merkleization&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;python dataclass notation with key-type pairs, e.g.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Square&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    side&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint16&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Merkleized at field index #0 (location of first 1 in `active_fields`)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    color&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Merkleized at field index #2 (location of second 1 in `active_fields`)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Circle&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    radius&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint16&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Merkleized at field index #1 (location of first 1 in `active_fields`)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    color&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Merkleized at field index #2 (location of second 1 in `active_fields`)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;ad36024441cf910d428d03f87f331fbbd2b3e5f1&#x2F;ssz&#x2F;simple-serialize.md#default-values&quot;&gt;default value&lt;&#x2F;a&gt; is defined as:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Default Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ProgressiveContainer(active_fields)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;[default(type) for type in progressive_container]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The following types are considered &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;ad36024441cf910d428d03f87f331fbbd2b3e5f1&#x2F;ssz&#x2F;simple-serialize.md#illegal-types&quot;&gt;illegal&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ProgressiveContainer&lt;&#x2F;code&gt; with no fields are illegal.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ProgressiveContainer&lt;&#x2F;code&gt; with an &lt;code&gt;active_fields&lt;&#x2F;code&gt; configuration of more than 256 entries are illegal.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ProgressiveContainer&lt;&#x2F;code&gt; with an &lt;code&gt;active_fields&lt;&#x2F;code&gt; configuration ending in &lt;code&gt;0&lt;&#x2F;code&gt; are illegal.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ProgressiveContainer&lt;&#x2F;code&gt; with an &lt;code&gt;active_fields&lt;&#x2F;code&gt; configuration with a different count of &lt;code&gt;1&lt;&#x2F;code&gt; than fields are illegal.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;serialization&quot;&gt;Serialization&lt;&#x2F;h4&gt;
&lt;p&gt;Serialization of &lt;code&gt;ProgressiveContainer(active_fields)&lt;&#x2F;code&gt; is identical to &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;ad36024441cf910d428d03f87f331fbbd2b3e5f1&#x2F;ssz&#x2F;simple-serialize.md#vectors-containers-lists&quot;&gt;&lt;code&gt;Container&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;deserialization&quot;&gt;Deserialization&lt;&#x2F;h4&gt;
&lt;p&gt;Deserialization of &lt;code&gt;ProgressiveContainer(active_fields)&lt;&#x2F;code&gt; is identical to &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;ad36024441cf910d428d03f87f331fbbd2b3e5f1&#x2F;ssz&#x2F;simple-serialize.md#deserialization&quot;&gt;&lt;code&gt;Container&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;json-mapping&quot;&gt;JSON mapping&lt;&#x2F;h4&gt;
&lt;p&gt;The canonical &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;ad36024441cf910d428d03f87f331fbbd2b3e5f1&#x2F;ssz&#x2F;simple-serialize.md#json-mapping&quot;&gt;JSON mapping&lt;&#x2F;a&gt; is updated:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;SSZ&lt;&#x2F;th&gt;&lt;th&gt;JSON&lt;&#x2F;th&gt;&lt;th&gt;Example&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ProgressiveContainer(active_fields)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;object&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;{ &quot;field&quot;: ... }&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;merkleization&quot;&gt;Merkleization&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;ad36024441cf910d428d03f87f331fbbd2b3e5f1&#x2F;ssz&#x2F;simple-serialize.md#merkleization&quot;&gt;SSZ Merkleization specification&lt;&#x2F;a&gt; is extended with two helper functions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;get_active_fields(value)&lt;&#x2F;code&gt;, where &lt;code&gt;value&lt;&#x2F;code&gt; is of type &lt;code&gt;ProgressiveContainer(active_fields)&lt;&#x2F;code&gt;: return &lt;code&gt;active_fields&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;mix_in_active_fields&lt;&#x2F;code&gt;: Given a Merkle root &lt;code&gt;root&lt;&#x2F;code&gt; and an &lt;code&gt;active_fields&lt;&#x2F;code&gt; configuration return &lt;code&gt;hash(root, pack_bits(active_fields))&lt;&#x2F;code&gt;. Note that &lt;code&gt;active_fields&lt;&#x2F;code&gt; is restricted to ≤ 256 bits.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The Merkleization definitions are extended.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;mix_in_active_fields(merkleize_progressive([hash_tree_root(element) for element in value]), get_active_fields(value))&lt;&#x2F;code&gt; if &lt;code&gt;value&lt;&#x2F;code&gt; is a progressive container.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-is-active-fields-limited-to-256-bits&quot;&gt;Why is &lt;code&gt;active_fields&lt;&#x2F;code&gt; limited to 256 bits?&lt;&#x2F;h3&gt;
&lt;p&gt;256 bits (1 word) allows the mix-in to be simple, consistent with the length mix-in for lists, and is practically sufficient. An alternate design with a &lt;code&gt;ProgressiveBitlist&lt;&#x2F;code&gt; mix-in was explored, however deemed too over-engineered as it would effectively require introducing caches to pre-compute the mix-in&#x27;s &lt;code&gt;hash_tree_root&lt;&#x2F;code&gt; to avoid repeated computations, and also makes verifier logic more complex than necessary.&lt;&#x2F;p&gt;
&lt;p&gt;Even though the 256 field limit includes all fields (including deprecated ones), it is unlikely that many progressive containers come close to reach 256 fields (&lt;code&gt;BeaconState&lt;&#x2F;code&gt; currently reaches around 40 fields). If that happens, one can add a &lt;code&gt;more&lt;&#x2F;code&gt; field with a nested &lt;code&gt;ProgressiveContainer&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-is-empty-progressivecontainer-an-illegal-type&quot;&gt;Why is empty &lt;code&gt;ProgressiveContainer&lt;&#x2F;code&gt; an illegal type?&lt;&#x2F;h3&gt;
&lt;p&gt;It would result in 0-length serialization, meaning that the length of a list of such a container cannot be determined from the serialization.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;optional-type&quot;&gt;&lt;code&gt;Optional[type]&lt;&#x2F;code&gt;?&lt;&#x2F;h3&gt;
&lt;p&gt;Introducing &lt;code&gt;Optional&lt;&#x2F;code&gt; is not required by any current functionality and is deferred to a future EIP.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;active_fields&lt;&#x2F;code&gt; bitvector can be updated to also indicate optionality. Further, serialization for sparse lists should be explored.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;ProgressiveContainer(active_fields)&lt;&#x2F;code&gt; is a new SSZ type and does not conflict with existing types.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ethereum&#x2F;remerkleable&lt;&#x2F;code&gt; contains static tests in &lt;code&gt;test_impl.py&lt;&#x2F;code&gt; and &lt;code&gt;test_typing.py&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ethereum&#x2F;consensus-specs&lt;&#x2F;code&gt; releases contain random tests in &lt;code&gt;tests&#x2F;general&#x2F;phase0&#x2F;ssz_generic&lt;&#x2F;code&gt;, generated according to a format defined in &lt;code&gt;tests&#x2F;format&#x2F;ssz_generic&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;See &lt;code&gt;ethereum&#x2F;remerkleable&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Light client based verifiers and smart contracts (e.g., based on &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4788&#x2F;&quot;&gt;EIP-4788&lt;&#x2F;a&gt;) do not update at the same cadence as Ethereum. If a future fork removes a field from a &lt;code&gt;ProgressiveContainer(active_fields)&lt;&#x2F;code&gt;, the &lt;code&gt;active_fields&lt;&#x2F;code&gt; mix-in enables such verifiers to distinguish absent fields from &lt;code&gt;0&lt;&#x2F;code&gt; values. Without &lt;code&gt;active_fields&lt;&#x2F;code&gt;, the &lt;code&gt;hash_tree_root&lt;&#x2F;code&gt; for these cases would collide.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Dynamic On-Chain Token Attributes Repository</title>
        <published>2023-08-15T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Steven Pineda</name><uri>https://github.com/steven2308</uri>
	</author>
	
	<author>
		<name>Jan Turk</name><uri>https://github.com/ThunderDeliverer</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7508/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/dynamic-on-chain-token-attributes-repository/15667" />
        

        <id>https://wg-eips.ritovision.com/7508/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7508"
            label="ERC-7508" />
        

        
        

        
        <summary type="html">Dynamic on-chain storage of token attributes in a public-good repository.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7508/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The Public On-Chain Non-Fungible Token Attributes Repository standard provides the ability for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; compatible tokens to store their attributes on-chain available to any external smart contract interacting with them.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal introduces the ability to assign attributes to NFTs in a public non-gated repository smart contract that is accessible at the same address in all of the networks. The repository smart contract is designed to be a common-good repository, meaning that it can be used by any ERC-721 or ERC-1155 compatible token.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;With NFTs being a widespread form of tokens in the Ethereum ecosystem and being used for a variety of use cases, it is time to standardize additional utility for them. Having the ability to store token&#x27;s attributes on chain allows for greater utility of tokens as it fosters cross-collection interactivity and provides perpetual store of attributes.&lt;&#x2F;p&gt;
&lt;p&gt;This ERC introduces new utilities for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; based tokens in the following areas:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7508&#x2F;#cross-collection-interactivity&quot;&gt;Cross-Collection interactivity&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7508&#x2F;#perpetual-store-of-attributes&quot;&gt;Perpetual Store of Attributes&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7508&#x2F;#token-evolution&quot;&gt;Token Evolution&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7508&#x2F;#dynamic-state-tracking&quot;&gt;Dynamic State Tracking&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;cross-collection-interactivity&quot;&gt;Cross-Collection Interactivity&lt;&#x2F;h3&gt;
&lt;p&gt;Storing attributes on-chain in a predictable format allows for cross-collection interactivity. This means that the attributes of a token can be used by any external smart contract without the need for the token to be aware of the external smart contract.&lt;&#x2F;p&gt;
&lt;p&gt;For example, a token can represent a game character with its set of attributes and can be used in an unrelated game with the same stats without the need for retrieving these attributes from an off-chain source. This ensures that the data the game is using is legitimate and not tampered with in order to gain an advantage.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;perpetual-store-of-attributes&quot;&gt;Perpetual Store of Attributes&lt;&#x2F;h3&gt;
&lt;p&gt;Standardized on-chain token attributes allow for their perpetual storage.&lt;&#x2F;p&gt;
&lt;p&gt;With off-chain attributes storage, the attributes are only available as long as the off-chain storage is available. If the storage is taken down, the attributes are lost. With on-chain attributes storage, the attributes are available as long as the blockchain is available. This increases the value of the token as it ensures that the attributes are available for as long as the token exists.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;token-evolution&quot;&gt;Token Evolution&lt;&#x2F;h3&gt;
&lt;p&gt;On-Chain storage of token attributes allows for the token to evolve over time. Owner&#x27;s actions can impact the attributes of the token. Since the attributes are stored on chain, the smart contract has the ability to modify the attribute once certain thresholds are met. This allows for token to become more interactive and reflect owner&#x27;s dedication and effort.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;dynamic-state-tracking&quot;&gt;Dynamic State Tracking&lt;&#x2F;h3&gt;
&lt;p&gt;On-Chain storage of token attributes allows for dynamic state tracking. The attributes can be used to track the state of the token and its owner. This allows for the token to be used in a variety of use cases. One such use case is supply chains; the token can represent a product and its attributes can be used to track the state of the product as it transitions from pending, shipped, delivered, etc.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;interface&quot;&gt;Interface&lt;&#x2F;h3&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-7508 Public On-Chain NFT Attributes Repository&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-7508&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0x212206a8.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.21&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7508&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC165&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A list of supported access types.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `Owner` type, where only the owner can manage the parameter.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `Collaborator` type, where only the collaborators can manage the parameter.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `OwnerOrCollaborator` type, where only the owner or collaborators can manage the parameter.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `TokenOwner` type, where only the token owner can manage the parameters of their tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `SpecificAddress` type, where only specific addresses can manage the parameter.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AccessType&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        Owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        Collaborator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        OwnerOrCollaborator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        TokenOwner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        SpecificAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Structure used to represent an address attribute.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The key of the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The value of the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AddressAttribute&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Structure used to represent a boolean attribute.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The key of the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The value of the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BoolAttribute&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Structure used to represent a bytes attribute.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The key of the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The value of the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BytesAttribute&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Structure used to represent an int attribute.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The key of the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The value of the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IntAttribute&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        int256&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Structure used to represent a string attribute.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The key of the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The value of the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; StringAttribute&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Structure used to represent an uint attribute.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The key of the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The value of the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UintAttribute&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to notify listeners that a new collection has been registered to use the repository.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the collection&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the owner of the collection; the addess authorized to manage the access control&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; registeringAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address that registered the collection&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; useOwnable&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A boolean value indicating whether the collection uses the Ownable extension to verify the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  owner (`true`) or not (`false`)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AccessControlRegistration&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; registeringAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; useOwnable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to notify listeners that the access control settings for a specific parameter have been updated.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the collection&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The name of the parameter for which the access control settings have been updated&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; accessType&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The AccessType of the parameter for which the access control settings have been updated&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; specificAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The specific addresses that has been updated&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AccessControlUpdate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        AccessType&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; accessType&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; specificAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to notify listeners that the metadata URI for a collection has been updated.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the collection&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; attributesMetadataURI&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The new attributes metadata URI&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MetadataURIUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attributesMetadataURI&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to notify listeners that a new collaborator has been added or removed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the collection&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collaborator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the collaborator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; isCollaborator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A boolean value indicating whether the collaborator has been added (`true`) or removed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  (`false`)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CollaboratorUpdate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collaborator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; isCollaborator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to notify listeners that an address attribute has been updated.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The collection address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The key of the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The new value of the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AddressAttributeUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to notify listeners that a boolean attribute has been updated.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The collection address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The key of the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The new value of the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BoolAttributeUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to notify listeners that a bytes attribute has been updated.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The collection address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The key of the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The new value of the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BytesAttributeUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to notify listeners that an int attribute has been updated.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The collection address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The key of the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The new value of the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IntAttributeUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        int256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to notify listeners that a string attribute has been updated.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The collection address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The key of the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The new value of the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; StringAttributeUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to notify listeners that an uint attribute has been updated.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The collection address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The key of the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The new value of the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UintAttributeUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ------------------- ACCESS CONTROL -------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to check if the specified address is listed as a collaborator of the given collection&amp;#39;s parameter.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collaborator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address to be checked.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the collection.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; isCollaborator_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Boolean value indicating if the address is a collaborator of the given collection&amp;#39;s (`true`) or not&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  (`false`).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isCollaborator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collaborator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; isCollaborator_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to check if the specified address is listed as a specific address of the given collection&amp;#39;s&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  parameter.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; specificAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address to be checked.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the collection.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The key of the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; isSpecificAddress_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Boolean value indicating if the address is a specific address of the given collection&amp;#39;s parameter&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  (`true`) or not (`false`).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isSpecificAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; specificAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; isSpecificAddress_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to register a collection to use the RMRK token attributes repository.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  If the collection does not implement the Ownable interface, the `useOwnable` value must be set to `false`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emits an {AccessControlRegistration} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the collection that will use the RMRK token attributes repository.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the owner of the collection.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; useOwnable&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The boolean value to indicate if the collection implements the Ownable interface and whether it&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  should be used to validate that the caller is the owner (`true`) or to use the manually set owner address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  (`false`).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; registerAccessControl&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; useOwnable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to manage the access control settings for a specific parameter.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Only the `owner` of the collection can call this function.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The possible `accessType` values are:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      Owner,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      Collaborator,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      OwnerOrCollaborator,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      TokenOwner,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      SpecificAddress,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emits an {AccessControlUpdated} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the collection being managed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The key of the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; accessType&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The type of access control to be applied to the parameter.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; specificAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to be added as a specific addresses allowed to manage the given&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  parameter.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; manageAccessControl&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        AccessType&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; accessType&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; specificAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to manage the collaborators of a collection.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The `collaboratorAddresses` and `collaboratorAddressAccess` arrays must be of the same length.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emits a {CollaboratorUpdate} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the collection&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collaboratorAddresses&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The array of collaborator addresses being managed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collaboratorAddressAccess&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The array of boolean values indicating if the collaborator address should&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  receive the permission (`true`) or not (`false`).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; manageCollaborators&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collaboratorAddresses&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collaboratorAddressAccess&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ------------------- METADATA URI -------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to retrieve the attributes metadata URI for a collection, which contains all the information about the collection attributes.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the collection&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; attributesMetadataURI&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The URI of the attributes metadata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getAttributesMetadataURIForCollection&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attributesMetadataURI&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to set the metadata URI for a collection, which contains all the information about the collection attributes.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emits a {MetadataURIUpdated} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the collection&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; attributesMetadataURI&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The URI of the attributes metadata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setAttributesMetadataURIForCollection&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attributesMetadataURI&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ------------------- GETTERS -------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to retrieve the address type token attributes.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The collection address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The key of the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; attribute&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The value of the address attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getAddressAttribute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attribute&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to retrieve the bool type token attributes.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The collection address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The key of the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; attribute&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The value of the bool attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getBoolAttribute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attribute&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to retrieve the bytes type token attributes.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The collection address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The key of the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; attribute&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The value of the bytes attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getBytesAttribute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attribute&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to retrieve the uint type token attributes.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The collection address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The key of the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; attribute&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The value of the uint attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getUintAttribute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attribute&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to retrieve the string type token attributes.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The collection address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The key of the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; attribute&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The value of the string attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getStringAttribute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attribute&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to retrieve the int type token attributes.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The collection address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The key of the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; attribute&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The value of the uint attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getIntAttribute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attribute&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ------------------- BATCH GETTERS -------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to get multiple address parameter values for a token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The `AddressAttribute` struct contains the following fields:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *     string key,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *     address value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collections&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Addresses of the collections, in the same order as the attribute keys. If all tokens are from the same collection the array can contain a single element with the collection address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; IDs of the tokens, in the same order as the attribute keys. If all attributes are for the same token the array can contain a single element with the token ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; attributeKeys&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of address keys to retrieve&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; attributes&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of addresses, in the same order as the attribute keys&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getAddressAttributes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collections&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attributeKeys&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attributes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to get multiple bool parameter values for a token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The `BoolAttribute` struct contains the following fields:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *     string key,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *     bool value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collections&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Addresses of the collections, in the same order as the attribute keys. If all tokens are from the same collection the array can contain a single element with the collection address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; IDs of the tokens, in the same order as the attribute keys. If all attributes are for the same token the array can contain a single element with the token ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; attributeKeys&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of bool keys to retrieve&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; attributes&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of bools, in the same order as the attribute keys&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getBoolAttributes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collections&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attributeKeys&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attributes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to get multiple bytes parameter values for a token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The `BytesAttribute` struct contains the following fields:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *     string key,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *     bytes value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collections&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Addresses of the collections, in the same order as the attribute keys. If all tokens are from the same collection the array can contain a single element with the collection address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; IDs of the tokens, in the same order as the attribute keys. If all attributes are for the same token the array can contain a single element with the token ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; attributeKeys&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of bytes keys to retrieve&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; attributes&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of bytes, in the same order as the attribute keys&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getBytesAttributes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collections&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attributeKeys&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attributes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to get multiple int parameter values for a token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collections&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Addresses of the collections, in the same order as the attribute keys. If all tokens are from the same collection the array can contain a single element with the collection address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; IDs of the tokens, in the same order as the attribute keys. If all attributes are for the same token the array can contain a single element with the token ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; attributeKeys&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of int keys to retrieve&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; attributes&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of ints, in the same order as the attribute keys&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getIntAttributes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collections&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attributeKeys&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attributes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to get multiple sting parameter values for a token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collections&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Addresses of the collections, in the same order as the attribute keys. If all tokens are from the same collection the array can contain a single element with the collection address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; IDs of the tokens, in the same order as the attribute keys. If all attributes are for the same token the array can contain a single element with the token ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; attributeKeys&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of string keys to retrieve&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; attributes&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of strings, in the same order as the attribute keys&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getStringAttributes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collections&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attributeKeys&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attributes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to get multiple uint parameter values for a token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collections&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Addresses of the collections, in the same order as the attribute keys. If all tokens are from the same collection the array can contain a single element with the collection address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; IDs of the tokens, in the same order as the attribute keys. If all attributes are for the same token the array can contain a single element with the token ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; attributeKeys&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of uint keys to retrieve&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; attributes&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of uints, in the same order as the attribute keys&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getUintAttributes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collections&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attributeKeys&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attributes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to retrieve multiple token attributes of any type at once.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The `StringAttribute`, `UintAttribute`, `IntAttribute`, `BoolAttribute`, `AddressAttribute` and `BytesAttribute` structs consists&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  to the following fields (where `value` is of the appropriate type):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      key,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      value,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The collection address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; addressKeys&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of address type attribute keys to retrieve&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; boolKeys&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of bool type attribute keys to retrieve&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bytesKeys&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of bytes type attribute keys to retrieve&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; intKeys&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of int type attribute keys to retrieve&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; stringKeys&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of string type attribute keys to retrieve&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uintKeys&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of uint type attribute keys to retrieve&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; addressAttributes&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of addresses, in the same order as the addressKeys&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; boolAttributes&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of bools, in the same order as the boolKeys&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bytesAttributes&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of bytes, in the same order as the bytesKeys&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; intAttributes&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of ints, in the same order as the intKeys&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; stringAttributes&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of strings, in the same order as the stringKeys&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uintAttributes&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of uints, in the same order as the uintKeys&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getAttributes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; addressKeys&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; boolKeys&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bytesKeys&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; intKeys&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; stringKeys&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uintKeys&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; addressAttributes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bool&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; boolAttributes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bytesAttributes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            int256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; intAttributes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; stringAttributes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uintAttributes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ------------------- PREPARE PRESIGNED MESSAGES -------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to retrieve the message to be signed for submitting a presigned address attribute change.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the collection smart contract of the token receiving the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ID of the token receiving the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The attribute key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The attribute value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; deadline&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The deadline timestamp for the presigned transaction after which the message is invalid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; message&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Raw message to be signed by the authorized account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; prepareMessageToPresignAddressAttribute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; deadline&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; message&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to retrieve the message to be signed for submitting a presigned bool attribute change.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the collection smart contract of the token receiving the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ID of the token receiving the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The attribute key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The attribute value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; deadline&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The deadline timestamp for the presigned transaction after which the message is invalid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; message&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Raw message to be signed by the authorized account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; prepareMessageToPresignBoolAttribute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; deadline&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; message&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to retrieve the message to be signed for submitting a presigned bytes attribute change.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the collection smart contract of the token receiving the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ID of the token receiving the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The attribute key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The attribute value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; deadline&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The deadline timestamp for the presigned transaction after which the message is invalid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; message&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Raw message to be signed by the authorized account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; prepareMessageToPresignBytesAttribute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; deadline&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; message&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to retrieve the message to be signed for submitting a presigned int attribute change.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the collection smart contract of the token receiving the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ID of the token receiving the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The attribute key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The attribute value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; deadline&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The deadline timestamp for the presigned transaction after which the message is invalid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; message&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Raw message to be signed by the authorized account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; prepareMessageToPresignIntAttribute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        int256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; deadline&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; message&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to retrieve the message to be signed for submitting a presigned string attribute change.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the collection smart contract of the token receiving the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ID of the token receiving the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The attribute key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The attribute value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; deadline&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The deadline timestamp for the presigned transaction after which the message is invalid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; message&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Raw message to be signed by the authorized account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; prepareMessageToPresignStringAttribute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; deadline&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; message&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to retrieve the message to be signed for submitting a presigned uint attribute change.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the collection smart contract of the token receiving the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ID of the token receiving the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The attribute key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The attribute value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; deadline&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The deadline timestamp for the presigned transaction after which the message is invalid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; message&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Raw message to be signed by the authorized account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; prepareMessageToPresignUintAttribute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; deadline&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; message&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ------------------- SETTERS -------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to set an address attribute.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emits a {AddressAttributeUpdated} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the collection receiving the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The attribute key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The attribute value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setAddressAttribute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to set a boolean attribute.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emits a {BoolAttributeUpdated} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the collection receiving the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The attribute key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The attribute value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setBoolAttribute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to set an bytes attribute.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emits a {BytesAttributeUpdated} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the collection receiving the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The attribute key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The attribute value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setBytesAttribute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to set a signed number attribute.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emits a {IntAttributeUpdated} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the collection receiving the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The attribute key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The attribute value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setIntAttribute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        int256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to set a string attribute.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emits a {StringAttributeUpdated} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the collection receiving the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The attribute key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The attribute value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setStringAttribute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to set an unsigned number attribute.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emits a {UintAttributeUpdated} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the collection receiving the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The attribute key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The attribute value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setUintAttribute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ------------------- BATCH SETTERS -------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sets multiple address attributes for a token at once.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The `AddressAttribute` struct contains the following fields:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      string key,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      address value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collections&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Addresses of the collections, in the same order as the attributes. If all tokens are from the same collection the array can contain a single element with the collection address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; IDs of the tokens, in the same order as the attributes. If all attributes are for the same token the array can contain a single element with the token ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; attributes&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of `AddressAttribute` structs to be assigned to the given token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setAddressAttributes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collections&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        AddressAttribute&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attributes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sets multiple bool attributes for a token at once.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The `BoolAttribute` struct contains the following fields:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      string key,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      bool value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collections&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Addresses of the collections, in the same order as the attributes. If all tokens are from the same collection the array can contain a single element with the collection address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; IDs of the tokens, in the same order as the attributes. If all attributes are for the same token the array can contain a single element with the token ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; attributes&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of `BoolAttribute` structs to be assigned to the given token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setBoolAttributes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collections&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        BoolAttribute&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attributes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sets multiple bytes attributes for a token at once.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The `BytesAttribute` struct contains the following fields:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      string key,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      bytes value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collections&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Addresses of the collections, in the same order as the attributes. If all tokens are from the same collection the array can contain a single element with the collection address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; IDs of the tokens, in the same order as the attributes. If all attributes are for the same token the array can contain a single element with the token ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; attributes&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of `BytesAttribute` structs to be assigned to the given token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setBytesAttributes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collections&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        BytesAttribute&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attributes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sets multiple int attributes for a token at once.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The `UintAttribute` struct contains the following fields:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      string key,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      int value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collections&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Addresses of the collections, in the same order as the attributes. If all tokens are from the same collection the array can contain a single element with the collection address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; IDs of the tokens, in the same order as the attributes. If all attributes are for the same token the array can contain a single element with the token ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; attributes&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of `IntAttribute` structs to be assigned to the given token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setIntAttributes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collections&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        IntAttribute&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attributes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sets multiple string attributes for a token at once.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The `StringAttribute` struct contains the following fields:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      string key,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      string value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collections&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Addresses of the collections, in the same order as the attributes. If all tokens are from the same collection the array can contain a single element with the collection address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; IDs of the tokens, in the same order as the attributes. If all attributes are for the same token the array can contain a single element with the token ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; attributes&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of `StringAttribute` structs to be assigned to the given token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setStringAttributes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collections&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        StringAttribute&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attributes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sets multiple uint attributes for a token at once.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The `UintAttribute` struct contains the following fields:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      string key,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      uint value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collections&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Addresses of the collections, in the same order as the attributes. If all tokens are from the same collection the array can contain a single element with the collection address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; IDs of the tokens, in the same order as the attributes. If all attributes are for the same token the array can contain a single element with the token ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; attributes&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of `UintAttribute` structs to be assigned to the given token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setUintAttributes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collections&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        UintAttribute&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attributes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sets multiple attributes of multiple types for a token at the same time.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emits a separate event for each attribute set.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The `StringAttribute`, `UintAttribute`, `BoolAttribute`, `AddressAttribute` and `BytesAttribute` structs consists&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  to the following fields (where `value` is of the appropriate type):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      key,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      value,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the collection&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; addressAttributes&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of `AddressAttribute` structs containing address attributes to set&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; boolAttributes&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of `BoolAttribute` structs containing bool attributes to set&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bytesAttributes&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of `BytesAttribute` structs containing bytes attributes to set&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; intAttributes&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of `IntAttribute` structs containing int attributes to set&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; stringAttributes&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of `StringAttribute` structs containing string attributes to set&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uintAttributes&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of `UintAttribute` structs containing uint attributes to set&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setAttributes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        AddressAttribute&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; addressAttributes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        BoolAttribute&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; boolAttributes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        BytesAttribute&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bytesAttributes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        IntAttribute&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; intAttributes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        StringAttribute&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; stringAttributes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        UintAttribute&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uintAttributes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ------------------- PRESIGNED SETTERS -------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to set the address attribute on behalf of an authorized account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emits a {AddressAttributeUpdated} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; setter&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the account that presigned the attribute change&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the collection receiving the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ID of the token receiving the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The attribute key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The attribute value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; deadline&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The deadline timestamp for the presigned transaction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `v` value of an ECDSA signature of the presigned message&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `r` value of an ECDSA signature of the presigned message&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `s` value of an ECDSA signature of the presigned message&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; presignedSetAddressAttribute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; setter&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; deadline&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; v&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; s&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to set the bool attribute on behalf of an authorized account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emits a {BoolAttributeUpdated} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; setter&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the account that presigned the attribute change&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the collection receiving the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ID of the token receiving the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The attribute key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The attribute value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; deadline&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The deadline timestamp for the presigned transaction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `v` value of an ECDSA signature of the presigned message&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `r` value of an ECDSA signature of the presigned message&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `s` value of an ECDSA signature of the presigned message&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; presignedSetBoolAttribute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; setter&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; deadline&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; v&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; s&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to set the bytes attribute on behalf of an authorized account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emits a {BytesAttributeUpdated} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; setter&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the account that presigned the attribute change&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the collection receiving the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ID of the token receiving the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The attribute key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The attribute value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; deadline&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The deadline timestamp for the presigned transaction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `v` value of an ECDSA signature of the presigned message&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `r` value of an ECDSA signature of the presigned message&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `s` value of an ECDSA signature of the presigned message&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; presignedSetBytesAttribute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; setter&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; deadline&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; v&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; s&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to set the int attribute on behalf of an authorized account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emits a {IntAttributeUpdated} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; setter&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the account that presigned the attribute change&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the collection receiving the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ID of the token receiving the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The attribute key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The attribute value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; deadline&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The deadline timestamp for the presigned transaction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `v` value of an ECDSA signature of the presigned message&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `r` value of an ECDSA signature of the presigned message&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `s` value of an ECDSA signature of the presigned message&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; presignedSetIntAttribute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; setter&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        int256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; deadline&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; v&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; s&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to set the string attribute on behalf of an authorized account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emits a {StringAttributeUpdated} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; setter&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the account that presigned the attribute change&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the collection receiving the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ID of the token receiving the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The attribute key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The attribute value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; deadline&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The deadline timestamp for the presigned transaction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `v` value of an ECDSA signature of the presigned message&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `r` value of an ECDSA signature of the presigned message&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `s` value of an ECDSA signature of the presigned message&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; presignedSetStringAttribute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; setter&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; deadline&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; v&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; s&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to set the uint attribute on behalf of an authorized account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emits a {UintAttributeUpdated} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; setter&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the account that presigned the attribute change&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the collection receiving the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ID of the token receiving the attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The attribute key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The attribute value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; deadline&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The deadline timestamp for the presigned transaction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `v` value of an ECDSA signature of the presigned message&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `r` value of an ECDSA signature of the presigned message&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `s` value of an ECDSA signature of the presigned message&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; presignedSetUintAttribute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; setter&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; deadline&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; v&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; s&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;schema&quot;&gt;Schema&lt;&#x2F;h3&gt;
&lt;p&gt;In addition to the interface we propose that collection owers SHOULD be able to set the schema for the attributes of their collection. We distinguish between 2 types: token attributes and collection attributes. The latter are the attributes that are shared by all tokens in the collection, they can be retrieved and set by using the max uint256 value as tokenId.&lt;&#x2F;p&gt;
&lt;p&gt;For each attribute we specify the following fields: name, description, type, display_name, display_type, decimals, min_value, max_value, conditional_value, modifiers and multi_storage. Only name and type are required. For more details on the fields, please refer to the [JSON schema] available &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7508&#x2F;.&#x2F;assets&#x2F;collection-metadata-schema.json&quot;&gt;&lt;code&gt;collection-metadata-schema.json&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;, with an example available at &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7508&#x2F;.&#x2F;assets&#x2F;collection-metadata-example.json&quot;&gt;&lt;code&gt;collection-metadata-example.json&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The reasoning for conditional_value, modifiers and multi_storage will be discussed in the rationale section.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;message-format-for-presigned-attribute&quot;&gt;Message format for presigned attribute&lt;&#x2F;h3&gt;
&lt;p&gt;The message to be signed by the &lt;code&gt;setter&lt;&#x2F;code&gt; in order for the attribute setting to be submitted by someone else is formatted as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            DOMAIN_SEPARATOR&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            METHOD_TYPEHASH&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            deadline&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The values passed when generating the message to be signed are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;DOMAIN_SEPARATOR&lt;&#x2F;code&gt; - The domain separator of the Attribute repository smart contract&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;METHOD_TYPEHASH&lt;&#x2F;code&gt; - The typehash of the method being called. The supported values, depending on the method are:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;SET_UINT_ATTRIBUTE_TYPEHASH&lt;&#x2F;code&gt; - Used for setting uint attributes&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SET_STRING_ATTRIBUTE_TYPEHASH&lt;&#x2F;code&gt; - Used for setting string attributes&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SET_BOOL_ATTRIBUTE_TYPEHASH&lt;&#x2F;code&gt; - Used for setting bool attributes&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SET_BYTES_ATTRIBUTE_TYPEHASH&lt;&#x2F;code&gt; - Used for setting bytes attributes&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SET_ADDRESS_ATTRIBUTE_TYPEHASH&lt;&#x2F;code&gt; - Used for setting address attributes&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;collection&lt;&#x2F;code&gt; - Address of the collection containing the token receiving the attribute&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;tokenId&lt;&#x2F;code&gt; - ID of the token receiving the attribute&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;key&lt;&#x2F;code&gt; - The attribute key&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;value&lt;&#x2F;code&gt; - The attribute value of the appropriate type&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;deadline&lt;&#x2F;code&gt; - UNIX timestamp of the deadline for the signature to be submitted. The signed message submitted after the deadline MUST be rejected&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;code&gt;DOMAIN_SEPARATOR&lt;&#x2F;code&gt; is generated as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;    abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        &amp;quot;ERC-7508: Public Non-Fungible Token Attributes Repository&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        &amp;quot;1&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;chainid&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;SET_UINT_ATTRIBUTE_TYPEHASH&lt;&#x2F;code&gt; is generated as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;setUintAttribute(address collection,uint256 tokenId,string memory key,uint256 value)&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;SET_STRING_ATTRIBUTE_TYPEHASH&lt;&#x2F;code&gt; is generated as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;setStringAttribute(address collection,uint256 tokenId,string memory key,string memory value)&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;SET_BOOL_ATTRIBUTE_TYPEHASH&lt;&#x2F;code&gt; is generated as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;setBoolAttribute(address collection,uint256 tokenId,string memory key,bool value)&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;SET_BYTES_ATTRIBUTE_TYPEHASH&lt;&#x2F;code&gt; is generated as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;setBytesAttribute(address collection,uint256 tokenId,string memory key,bytes memory value)&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;SET_ADDRESS_ATTRIBUTE_TYPEHASH&lt;&#x2F;code&gt; is generated as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;setAddressAttribute(address collection,uint256 tokenId,string memory key,address value)&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Each chain, that the Attributes repository smart contract is deployed in, will have a different &lt;code&gt;DOMAIN_SEPARATOR&lt;&#x2F;code&gt; value due to chain IDs being different.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;pre-determined-address-of-the-attributes-repository&quot;&gt;Pre-determined address of the Attributes repository&lt;&#x2F;h3&gt;
&lt;p&gt;The address of the Emotable repository smart contract is designed to resemble the function it serves. It starts with &lt;code&gt;0xA77B75&lt;&#x2F;code&gt; which is the abstract representation of &lt;code&gt;ATTBTS&lt;&#x2F;code&gt;. The address is TBD.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Designing the proposal, we considered the following questions:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Should we refer to the values stored by the repository as propertiers or attributes?&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
Historically values defining characteristics of tokens have been called properties, but have evolved in to being called attributes. Referring to the dictionary, the property is defined as a quality or characteristic that something has, and the attribute is defined as a quality or feature of somebody&#x2F;something. We felt that using the term attribute fits better and decided to use it.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Should the proposal specify access control?&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
Designing the proposal, we had two options: either to include the access control within the specification of the proposal or to leave the access control up to the implementers that desire to use the attributes repository. While considering this we also had to consider the usability and compatibility aspects of the repository.&lt;br &#x2F;&gt;
On one hand, including access control narrows down the freedom of implementation and requires the implementers to configure it before being able to use the repository. On the other hand, leaving access control up to implementers requires dedicated design of attributes access control within their smart contracts, increasing their size, complexity and deployment costs.&lt;br &#x2F;&gt;
Another important thing to note is that including access control in the proposal makes it compatible with collections existing prior to the deployment of the repository and thus powers backwards-compatibility.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Should the proposal establish an attributes extension or a common-good repository?&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
Initially we set out to create an attributes extension to be used with any ERC-721 compliant tokens. However, we realized that the proposal would be more useful if it was a common-good repository of token attributes. This way, the tokens that can utilize it are not only the new ones but also the old ones that have been around since before the proposal.&lt;br &#x2F;&gt;
An additional benefit of this course-correction is the compatibility with ERC-1155 tokens.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Should we include only single-action operations, only multi-action operations, or both?&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
We&#x27;ve considered including only single-action operations, where the user is only able to assign a single attribute to a single token, but we decided to include both single-action and multi-action operations. This way, the users can choose whether they want to assign an attribute to a single token or on multiple tokens at once.&lt;br &#x2F;&gt;
This decision was made for the long-term viability of the proposal. Based on the gas cost of the network and the number of tokens in the collection, the user can choose the most cost-effective way of attribute assigning.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Should we add the ability to assign attributes on someone else&#x27;s behalf?&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
While we did not intend to add this as part of the proposal when drafting it, we realized that it would be a useful feature for it. This way, the users can assign attributes on behalf of someone else, for example, if they are not able to do it themselves or if the attribute is earned through an off-chain activity.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;How do we ensure that attribute assignment on someone else&#x27;s behalf is legitimate?&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
We could add delegates to the proposal; when a user delegates their right to assign attributes to someone else, but having the ability to do so opens up the possibility for abuse and improper setting of attributes.&lt;br &#x2F;&gt;
Using ECDSA signatures, we can ensure that the user has given their consent to assign attribute on their behalf. This way, the user can sign a message with the parameters of the attribute and the signature can be submitted by someone else.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Should we add chain ID as a parameter when assigning attribute to a token?&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
We decided against this as we feel that additional parameter would rarely be used and would add additional cost to the attribute assignment transactions. If the collection smart contract wants to utilize on-chain token attributes, it requires the reactions to be recorded on the same chain. Marketplaces and wallets integrating this proposal will rely on attributes to reside in the same chain as well, because if chain ID parameter was supported this would mean that they would need to query the repository smart contract on all of the chains the repository is deployed in order to get the attributes of a given token.&lt;br &#x2F;&gt;
Additionally, if the collection creator wants users to record their reactions on a different chain, they can still direct the users to do just that. The repository does not validate the existence of the token being reacted to (except in an instance where the attribute can be modified by the token&#x27;s owner), which in theory means that you can assign an attribute to non-existent token or to a token that does not exist yet.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;How should we reduce the cost of string usage in the repository?&lt;&#x2F;strong&gt;
One fo the main issues we were dealing with while designing the proposal is the cost of string usage. We considered using bytes instead of strings, but decided against it as it would require the users to encode and decode the strings themselves.&lt;br &#x2F;&gt;
The solution for reducing the cost was to use a string indices. This means that the cost of setting a new string attribute or key will only be paid by the first user to do so. The subsequent users will only pay the cost of setting the index of the string attribute or key.&lt;br &#x2F;&gt;
We also extended this gas-saving approach to be applicable across the entire repository. This means that if the string was already set by one collection, any other collection using the same string will not have to pay the cost of setting the string again.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The Attributes repository standard is fully compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; and with the robust tooling available for implementations of ERC-721 as well as with the existing ERC-721 infrastructure.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Tests are included in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7508&#x2F;.&#x2F;assets&#x2F;test&#x2F;attributesRepository.ts&quot;&gt;&lt;code&gt;attributesRepository.ts&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;To run them in terminal, you can use the following commands:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cd ..&#x2F;assets&#x2F;eip-7508&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pnpm i&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pnpm hardhat test&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7508&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;AttributesRepository.sol&quot;&gt;&lt;code&gt;AttributesRepository.sol&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The proposal does not envision handling any form of assets from the user, so the assets should not be at risk when interacting with an Attributes repository.&lt;&#x2F;p&gt;
&lt;p&gt;The ability to use ECDSA signatures to set attributes on someone else&#x27;s behalf introduces the risk of a replay attack, which the format of the message to be signed guards against. The &lt;code&gt;DOMAIN_SEPARATOR&lt;&#x2F;code&gt; used in the message to be signed is unique to the repository smart contract of the chain it is deployed on. This means that the signature is invalid on any other chain and the attributes repositories deployed on them should revert the operation if a replay attack is attempted.&lt;&#x2F;p&gt;
&lt;p&gt;Another thing to consider is the ability of presigned message reuse. Since the message includes the signature validity deadline, the message can be reused any number of times before the deadline is reached. The proposal only allows for a single value for a given key to be set, so the presigned message can not be abused to further modify the attribute value. However, if the service using the repository relies on the ability to revert or modify the attribute after certain actions, a valid presigned message can be used to re-assign the attribute of the token. We suggest that the services using the repository in cnjunction with presigned messages use deadlines that invalidate presigned messages after a reasonalby short period of time.&lt;&#x2F;p&gt;
&lt;p&gt;Caution is advised when dealing with non-audited contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Registry Extension for ERC-7579</title>
        <published>2023-08-14T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Konrad Kopp</name><uri>https://github.com/kopy-kat</uri>
	</author>
	
	<author>
		<name>zeroknots</name><uri>https://github.com/zeroknots</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7484/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7484-registry-adapters-for-smart-accounts/15434" />
        

        <id>https://wg-eips.ritovision.com/7484/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7484"
            label="ERC-7484" />
        

        
        

        
        <summary type="html">Adapters that allow modular smart accounts to verify the security of modules using a Module Registry</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7484/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal standardizes the interface and functionality of Module Registries, allowing modular smart accounts to verify the security of modules using a Registry Adapter. It also provides a reference implementation of a Singleton Module Registry.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt; standardizes the execution flow of contract accounts and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7579&#x2F;&quot;&gt;ERC-7579&lt;&#x2F;a&gt; standardizes the modular implementation of these accounts, allowing any developer to build modules for these modular accounts (hereafter Smart Accounts). However, adding third-party modules into Smart Accounts unchecked opens up a wide range of attack vectors.&lt;&#x2F;p&gt;
&lt;p&gt;One solution to this security issue is to create a Module Registry that stores security attestations on Modules and allows Smart Accounts to query these attestations before using a module. This standard aims to achieve two things:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Standardize the interface and required functionality of Module Registries.&lt;&#x2F;li&gt;
&lt;li&gt;Standardize the functionality of Adapters that allow Smart Accounts to query Module Registries.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;This ensures that Smart Accounts can securely query Module Registries and handle the Registry behavior correctly, irrespective of their architecture, execution flows and security assumptions. This standard also provides a reference implementation of a Singleton Module Registry that is ownerless and can be used by any Smart Account. While we see many benefits of the entire ecosystem using this single Module Registry (see &lt;code&gt;Rationale&lt;&#x2F;code&gt;), we acknowledge that there are tradeoffs to using a singleton and thus this standard does not require Smart Accounts to use the reference implementation. Hence, this standard ensures that Smart Accounts can query any Module Registry that implements the required interface and functionality, reducing integration overhead and ensuring interoperability for Smart Accounts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Smart account&lt;&#x2F;strong&gt; - An ERC-7579 modular smart account.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Module&lt;&#x2F;strong&gt; - Self-contained smart account functionality.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Attestation&lt;&#x2F;strong&gt; - Onchain assertions made about the security of a module.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Attester&lt;&#x2F;strong&gt; - The entity that makes an attestation about a module.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;(Module) Registry&lt;&#x2F;strong&gt; - A contract that stores an onchain list of attestations about modules.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Adapter&lt;&#x2F;strong&gt; - Smart account functionality that handles the fetching and validation of attestations from the Registry.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;required-registry-functionality&quot;&gt;Required Registry functionality&lt;&#x2F;h3&gt;
&lt;p&gt;The core interface for a Registry is as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7484Registry&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;               Check with internal attester(s)              &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; check&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; module&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checkForAccount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; smartAccount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; module&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; check&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; module&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; moduleType&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checkForAccount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; smartAccount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; module&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; moduleType&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                   Set internal attester(s)                 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; trustAttesters&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; threshold&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attesters&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;              Check with external attester(s)               &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; check&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; module&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attesters&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; threshold&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; check&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; module&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; moduleType&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attesters&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; threshold&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The Registry MUST also implement the following functionality:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Verify that an attester is the creator of an attestation, for example by checking &lt;code&gt;msg.sender&lt;&#x2F;code&gt; or by using signatures, before storing it.&lt;&#x2F;li&gt;
&lt;li&gt;Allow attesters to revoke attestations that they have made.&lt;&#x2F;li&gt;
&lt;li&gt;Store either the attestation data or a reference to the attestation data.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The Registry SHOULD also implement the following additional functionality:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Allow attesters to specify an expiry date for their attestations and revert during a check if an attestation is expired.&lt;&#x2F;li&gt;
&lt;li&gt;Implement a view function that allows an adapter or offchain client to read the data for a specific attestation.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;check-functions&quot;&gt;&lt;code&gt;check&lt;&#x2F;code&gt; functions&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;The Registry MUST revert if the number of &lt;code&gt;attesters&lt;&#x2F;code&gt; that have made an attestation on the &lt;code&gt;module&lt;&#x2F;code&gt; is smaller than the &lt;code&gt;threshold&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The Registry MUST revert if any &lt;code&gt;attester&lt;&#x2F;code&gt; has revoked their attestation on the &lt;code&gt;module&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;attesters&lt;&#x2F;code&gt; provided MUST be unique and sorted and the Registry MUST revert if they are not.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;check-functions-with-moduletype&quot;&gt;&lt;code&gt;check&lt;&#x2F;code&gt; functions with moduleType&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;The Registry MUST revert if the module type of the &lt;code&gt;module&lt;&#x2F;code&gt; stored is not the provided &lt;code&gt;moduleType&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;functions-with-internal-attester-s&quot;&gt;Functions with internal attester(s)&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;The Registry MUST use the stored attester(s) for the &lt;code&gt;smartAccount&lt;&#x2F;code&gt; or &lt;code&gt;msg.sender&lt;&#x2F;code&gt; (if the former is not an argument).&lt;&#x2F;li&gt;
&lt;li&gt;The Registry MUST revert if no attester(s) are stored for the &lt;code&gt;smartAccount&lt;&#x2F;code&gt; or &lt;code&gt;msg.sender&lt;&#x2F;code&gt; (if the former is not an argument).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;trustattesters&quot;&gt;&lt;code&gt;trustAttesters&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;The Registry MUST store the &lt;code&gt;threshold&lt;&#x2F;code&gt; and &lt;code&gt;attesters&lt;&#x2F;code&gt; for the &lt;code&gt;msg.sender&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;attesters&lt;&#x2F;code&gt; provided MUST be unique and sorted and the Registry MUST revert if they are not.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;adapter-behavior&quot;&gt;Adapter behavior&lt;&#x2F;h3&gt;
&lt;p&gt;A Smart Account MUST implement the following Adapter functionality either natively in the account or as a module. This Adapter functionality MUST ensure that:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The Registry is queried about module &lt;code&gt;A&lt;&#x2F;code&gt; at least once before or during the transaction in which &lt;code&gt;A&lt;&#x2F;code&gt; is called for the first time.&lt;&#x2F;li&gt;
&lt;li&gt;The Registry reverting is treated as a security risk.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Additionally, the Adapter SHOULD implement the following functionality:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Revert the transaction flow when the Registry reverts.&lt;&#x2F;li&gt;
&lt;li&gt;Query the Registry about module &lt;code&gt;A&lt;&#x2F;code&gt; on installation of &lt;code&gt;A&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Query the Registry about module &lt;code&gt;A&lt;&#x2F;code&gt; on execution of &lt;code&gt;A&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Example: Adapter flow using &lt;code&gt;check&lt;&#x2F;code&gt;
&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7484&#x2F;.&#x2F;assets&#x2F;check-sequence.jpg&quot; alt=&quot;Adapter flow using check()&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;attestations&quot;&gt;Attestations&lt;&#x2F;h3&gt;
&lt;p&gt;Attestations are onchain assertions made about a module. These assertions could pertain to the security of a module (similar to a regular smart contract audit), whether a module adheres to a certain standard or any other kinds of statements about these modules. While some of these assertions can feasibly be verified onchain, the majority of them cannot be.&lt;&#x2F;p&gt;
&lt;p&gt;One example of this would be determining what storage slots a specific module can write to, which might be useful if a smart account uses DELEGATECALL to invoke the module. This assertion is practically infeasible to verify onchain, but can easily be verified off-chain. Thus, an attester could perform this check off-chain and publish an attestation onchain that attests to the fact that a given module can only write to its designated storage slots.&lt;&#x2F;p&gt;
&lt;p&gt;While attestations are always certain kinds of assertions made about a module, this proposal purposefully allows the attestation data to be any kind of data or pointer to data. This ensures that any kind of data can be used as an assertion, from a simple boolean flag specifying that a module is secure to a complex proof of runtime module behaviour.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;singleton-registry&quot;&gt;Singleton Registry&lt;&#x2F;h3&gt;
&lt;p&gt;In order for attestations to be queryable onchain, they need to be stored in some sort of list in a smart contract. This proposal includes the reference implementation of an ownerless Singleton Registry that functions as the source of truth for attestations.&lt;&#x2F;p&gt;
&lt;p&gt;The reasons for proposing a Singleton Registry are the following:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Security&lt;&#x2F;strong&gt;: A Singleton Registry creates greater security by focusing account integrations into a single source of truth where a maximum number of security entities are attesting. This has a number of benefits: a) it increases the maximum potential quantity and type of attestations per module and b) removes the need for accounts to verify the authenticity and security of different registries, focusing trust delegation to the onchain entities making attestations. The result is that accounts are able to query multiple attesters with lower gas overhead in order to increase security guarantees and there is no additional work required by accounts to verify the security of different registries.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Interoperability&lt;&#x2F;strong&gt;: A Singleton Registry not only creates a greater level of “attestation liquidity”, but it also increases module liquidity and ensures a greater level of module interoperability. Developers need only deploy their module to one place to receive attestations and maximise module distribution to all integrated accounts. Attesters can also benefit from previous auditing work by chaining attestations and deriving ongoing security from these chains of dependencies. This allows for benefits such as traversing through the history of attestations or version control by the developer.&lt;&#x2F;p&gt;
&lt;p&gt;However, there are obviously tradeoffs for using a singleton. A Singleton Registry creates a single point of failure that, if exploited, could lead to serious consequences for smart accounts. The most serious attack vector of these would be the ability for an attacker to attest to a malicious module on behalf of a trusted attester. One tradeoff here is that using multiple registries, changes in security attestations (for example a vulnerability is found and an attestation is revoked) are slower to propagate across the ecosystem, giving attackers an opportunity to exploit vulnerabilities for longer or even find and exploit them after seeing an issue pointed out in a specific Registry but not in others.&lt;&#x2F;p&gt;
&lt;p&gt;Due to being a singleton, the Registry needs to be very flexible and thus likely less computationally efficient in comparison to a narrow, optimised Registry. This means that querying a Singleton Registry is likely to be more computationally (and by extension gas) intensive than querying a more narrow Registry. The tradeoff here is that a singleton makes it cheaper to query attestations from multiple parties simultaneously. So, depending on the Registry architectures, there is an amount of attestations to query (N) after which using a flexible singleton is actually computationally cheaper than querying N narrow registries. However, the reference implementation has also been designed with gas usage in mind and it is unlikely that specialised registries will be able to significantly decrease gas beyond the reference implementations benchmarks.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;module-types&quot;&gt;Module Types&lt;&#x2F;h3&gt;
&lt;p&gt;Modules can be of different types and it can be important for an account to ensure that a module is of a certain type. For example, if an account wants to install a module that handles the validation logic of the account, then it might want to ensure that attesters have confirmed that the module is indeed capable of performing this validation logic. Otherwise, the account might be at risk of installing a module that is not capable of performing the validation logic, which could lead to an account being rendered unusable.&lt;&#x2F;p&gt;
&lt;p&gt;Nonetheless, the Registry itself does not need to care what specific module types mean. Instead, attesters can provide these types and the Registry can store them.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;related-work&quot;&gt;Related work&lt;&#x2F;h3&gt;
&lt;p&gt;The reference implementation of the Registry is heavily inspired by the Ethereum Attestation Service. The specific use-case of this proposal, however, required some custom modifications and additions to EAS, meaning that using the existing EAS contracts as the Module Registry was sub-optimal. However, it would be possible to use EAS as a Module Registry with some modifications.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;adapter-sol&quot;&gt;Adapter.sol&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Adapter&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    IRegistry registry&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checkModule&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; module&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check module attestation on Registry&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        registry&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;check&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;module&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checkModuleWithModuleTypeAndAttesters&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; module&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attesters&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; threshold&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;  uint16&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; moduleType&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check list of module attestations on Registry&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        registry&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;check&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;module&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; attesters&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; threshold&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; moduleType&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;account-sol&quot;&gt;Account.sol&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;&#x2F;strong&gt;: This is a specific example that complies to the &lt;code&gt;Specification&lt;&#x2F;code&gt; above, but this implementation is not binding.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Account&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Adapter&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    .&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; installs a module&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; installModule&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; moduleTypeId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; module&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; initData&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        payable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        checkModule&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;module&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        .&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; executes a module&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; executeFromExecutor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        ModeCode&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; mode&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; executionCalldata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        payable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; returnData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        checkModule&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;module&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        .&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    .&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;registry&quot;&gt;Registry&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; this implementation is unoptimized in order to make the reference implementation shorter to read&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; some function implementations are missing for brevity&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Registry&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7484Registry&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    .&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;               Check with internal attester(s)              &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; check&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; module&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span&gt; attesters&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt; threshold&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _getAttesters&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; validCount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; attesters&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bool&lt;&#x2F;span&gt;&lt;span&gt; isValid &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _check&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;module&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; attesters&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;isValid&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; validCount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;validCount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; threshold&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AttestationThresholdNotMet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checkForAccount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; smartAccount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; module&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span&gt; attesters&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt; threshold&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _getAttesters&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;smartAccount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        .&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; check&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; module&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; moduleType&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span&gt; attesters&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt; threshold&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _getAttesters&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; validCount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; attesters&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bool&lt;&#x2F;span&gt;&lt;span&gt; isValid &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _check&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;module&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; attesters&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;isValid&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; validCount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            AttestationRecord &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;storage&lt;&#x2F;span&gt;&lt;span&gt; attestation &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _getAttestation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;module&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; attester&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;attestation&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;moduleType &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span&gt; moduleType&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ModuleTypeMismatch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;validCount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; threshold&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AttestationThresholdNotMet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checkForAccount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; smartAccount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; module&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; moduleType&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span&gt; attesters&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt; threshold&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _getAttesters&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;smartAccount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        .&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                   Set internal attester(s)                 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; trustAttesters&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; threshold&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attesters&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        .&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;              Check with external attester(s)               &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; check&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; module&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attesters&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; threshold&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; validCount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; attesters&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bool&lt;&#x2F;span&gt;&lt;span&gt; isValid &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _check&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;module&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; attesters&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;isValid&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; validCount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;validCount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; threshold&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AttestationThresholdNotMet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; check&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; module&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; moduleType&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attesters&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; threshold&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; validCount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; attesters&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bool&lt;&#x2F;span&gt;&lt;span&gt; isValid &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _check&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;module&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; attesters&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;isValid&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; validCount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            AttestationRecord &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;storage&lt;&#x2F;span&gt;&lt;span&gt; attestation &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _getAttestation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;module&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; attester&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;attestation&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;moduleType &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span&gt; moduleType&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ModuleTypeMismatch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;validCount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; threshold&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AttestationThresholdNotMet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                         Internal                           &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _check&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; module&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attester&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; isValid&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        AttestationRecord &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;storage&lt;&#x2F;span&gt;&lt;span&gt; attestation &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _getAttestation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;module&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; attester&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint48&lt;&#x2F;span&gt;&lt;span&gt; expirationTime &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; attestation&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;expirationTime&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint48&lt;&#x2F;span&gt;&lt;span&gt; attestedAt &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            expirationTime &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; expirationTime &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; :&lt;&#x2F;span&gt;&lt;span&gt; attestation&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;time&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;attestedAt &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint48&lt;&#x2F;span&gt;&lt;span&gt; revokedAt &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; attestation&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;revocationTime&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;revokedAt &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        isValid &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _getAttestation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; module&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attester&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        internal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        virtual&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;AttestationRecord&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; storage&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _moduleToAttesterToAttestations&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;module&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;attester&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _getAttesters&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        internal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        virtual&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attesters&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; threshold&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        .&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    .&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Zero-Knowledge Wormholes</title>
        <published>2023-08-14T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Keyvan Kambakhsh</name><uri>https://github.com/keyvank</uri>
	</author>
	
	<author>
		<name>Hamid Bateni</name><uri>https://github.com/irnb</uri>
	</author>
	
	<author>
		<name>Amir Kahoori</name><email>a.kahoorizadeh@gmail.com</email>
	</author>
	
	<author>
		<name>Nobitex Labs</name><email>labs@nobitex.ir</email>
	</author>
	
	<author>
		<name>0xwormhole</name><uri>https://github.com/0xwormhole</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7503/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7503-zero-knowledge-wormholes-private-proof-of-burn-ppob/15456" />
        

        <id>https://wg-eips.ritovision.com/7503/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:7503"
            label="EIP-7503" />
        

        
        

        
        <summary type="html">Enable minting of secretly burnt Ethers as a native privacy solution for Ethereum</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7503/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;While researching on privacy solutions and applications of ZKP, we discovered a technique,
by which people can burn their digital asset (E.g ETH) by sending it to an unspendable address,
and later build a ZK proof showing that some amount of tokens reside in an account that are
unspendable, without revealing the account.&lt;&#x2F;p&gt;
&lt;p&gt;The EIP proposes to add a minting functionality to Ethereum, so that people can re-mint
Ethers they have purposefully burnt. The mentioned privacy solution will bring strong levels of
&lt;em&gt;&lt;strong&gt;plausible deniability&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt; for the sender, since there is no way one can prove that the sender
has been participating in a privacy protocol. This will also make an anonymity pool that includes
all of the Ethereum accounts with zero outgoing transactions by default.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;MAGIC_ADDRESS&lt;&#x2F;code&gt;: &lt;code&gt;0xfe&lt;&#x2F;code&gt; (one byte)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;MAGIC_NULLIFIER&lt;&#x2F;code&gt;: &lt;code&gt;0x01&lt;&#x2F;code&gt; (one byte)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;MAGIC_POW&lt;&#x2F;code&gt;: &lt;code&gt;0x02&lt;&#x2F;code&gt; (one byte)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;MAGIC_CHANGE&lt;&#x2F;code&gt;: &lt;code&gt;0x0404040404040404040404040404040404040404040404040404040404040404&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;POW_LOG_DIFFICULTY&lt;&#x2F;code&gt;: &lt;code&gt;24&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;MAX_DEPOSIT&lt;&#x2F;code&gt;: &lt;code&gt;32 * 10**18&lt;&#x2F;code&gt; wei&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;WormholeTxType&lt;&#x2F;code&gt;: &lt;code&gt;TBD&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;WORMHOLE_NULLIFIER_ADDRESS&lt;&#x2F;code&gt;: &lt;code&gt;TBD&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RECEIPT_PREFIX&lt;&#x2F;code&gt;: &lt;code&gt;TBD&lt;&#x2F;code&gt; (datatype &lt;code&gt;List[bool]&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;hr &#x2F;&gt;
&lt;p&gt;We define a new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; transaction type, where &lt;code&gt;TransactionType&lt;&#x2F;code&gt; is &lt;code&gt;WormholeTxType&lt;&#x2F;code&gt; and the &lt;code&gt;TransactionPayload&lt;&#x2F;code&gt; format is as follows:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;[chain_id, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit, to, data, access_list, root_beacon_block_number, proof]&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Verifying this type of transaction requires confirming that:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The proof is a zero-knowledge proof:
&lt;ul&gt;
&lt;li&gt;Private inputs: &lt;code&gt;secret&lt;&#x2F;code&gt;, &lt;code&gt;main_index&lt;&#x2F;code&gt;, &lt;code&gt;main_branch&lt;&#x2F;code&gt;, &lt;code&gt;privacy_pool_index&lt;&#x2F;code&gt;, &lt;code&gt;privacy_pool_branch&lt;&#x2F;code&gt;, &lt;code&gt;deposit_value&lt;&#x2F;code&gt;, &lt;code&gt;deposit_sender&lt;&#x2F;code&gt;, &lt;code&gt;change_value_salt&lt;&#x2F;code&gt;, &lt;code&gt;change_value&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Public inputs: &lt;code&gt;beacon_block_root&lt;&#x2F;code&gt;, &lt;code&gt;nullifier&lt;&#x2F;code&gt;, &lt;code&gt;privacy_pool_root&lt;&#x2F;code&gt;, &lt;code&gt;withdraw_value&lt;&#x2F;code&gt;, &lt;code&gt;change_value_hash&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Function: verify all of the following conditions
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;verify_merkle_branch(root=beacon_block_root, index=RECEIPT_PREFIX + main_index, leaf=make_receipt_hash(deposit_sender, deposit_value, change_value_salt, secret), branch=main_branch)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;verify_merkle_branch(root=privacy_pool_root, index=privacy_pool_index, leaf=make_receipt_hash(deposit_sender, deposit_value, change_value_salt, secret), branch=privacy_pool_branch)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;nullifier == sha256(MAGIC_NULLIFIER + secret)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;sha256(MAGIC_POW + secret) % 2**POW_LOG_DIFFICULTY == 0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;change_value_hash == sha256(change_value_salt, change_value)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;change_value + withdraw_value == deposit_value&lt;&#x2F;code&gt; (all values are unsigned int, also need to confirm that there is no overflow)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;deposit_value &amp;lt;= MAX_DEPOSIT&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SLOAD(WORMHOLE_NULLIFIER_ADDRESS, proof.nullifier) == 0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;get_beacon_block_root(root_beacon_block_number) == proof.beacon_block_root&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;We define &lt;code&gt;make_receipt_hash&lt;&#x2F;code&gt; as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def make_receipt_hash(deposit_sender: Address, value: uint256, change_value_salt: bytes32, secret: bytes32):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if deposit_sender != 0:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        to_address = sha256(MAGIC_ADDRESS + secret)[12:]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        topics = [MAGIC_EIP_7708, deposit_sender, to_address]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        logdata = int_to_bytes32(value)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    else:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        topics = [MAGIC_CHANGE, hash(change_value_salt, value)]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        logdata = bytes([])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return get_ssz_root_hash(Log(topics=topics, data=logdata))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The hash of the transaction (excluding proof) should be included in the randomness for generating the zero-knowledge proof. This ensures the proof serves as a signature.&lt;&#x2F;p&gt;
&lt;p&gt;If the transaction is confirmed, generate &lt;code&gt;proof.withdraw_value&lt;&#x2F;code&gt; ether at address &lt;code&gt;WORMHOLE_NULLIFIER_ADDRESS&lt;&#x2F;code&gt;. Then proceed with a normal call from this address using that value. Before the call, set &lt;code&gt;SSTORE(WORMHOLE_NULLIFIER_ADDRESS, proof.nullifier, 1)&lt;&#x2F;code&gt;, and emit a log event where &lt;code&gt;topics = [MAGIC_CHANGE, proof.change_value_hash]&lt;&#x2F;code&gt; and &lt;code&gt;logdata = bytes([])&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;In Elliptic-Curve based digital signatures, normally there is a secret scalar $s$, from which
a public-key is calculated (By multiplying the generator point with the scalar: $s \times G$). An
Ethereum EOA-address is the keccak hash of a public-key.&lt;&#x2F;p&gt;
&lt;p&gt;Also, the funds in an Ethereum address might be spendable by a smart-contract, if the keccak hash
of the smart-contract&#x27;s parameters is equal with that address.&lt;&#x2F;p&gt;
&lt;p&gt;Therefore, an Ethereum address $A$ is spendable if and only if:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;A private-key $s$ exists. such that $A = keccak(s \times G)$.&lt;&#x2F;li&gt;
&lt;li&gt;There exists a smart-contract $c$, such that $A = keccak(c_{params})$.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The preimage resistance property of hash functions implies that, you can&#x27;t find $x$ where $keccak(x)=r$,
in case $r$ is a random value. So the funds sent to a random Ethereum address $r$ is unspendable, but
how can other people be sure that $r$ is indeed random and not the result of calculating $s \times G$?&lt;&#x2F;p&gt;
&lt;p&gt;A great source of randomness is a hash function. If the address is equal with the hash of a secret preimage
$s$, we can conclude that the address is unspendable, since there isn&#x27;t a polynomially bounded algorithm
to find $x$ where $keccak(x)=h(s)$. This is only true if the second hash function is a different hash
function, and it assumes it is impossible to find $x_1$ and $x_2$ such that $h_1(x_1)=h_2(x_2)$ in case
$h_1$ and $h_2$ are different hash functions.&lt;&#x2F;p&gt;
&lt;p&gt;Using the help of Zero-Knowledge proofs, we can hide the value of $s$! We just need to prove that
we know a secret value $s$ where the address is $h(s)$. We can go even further. We can prove
that an Ethereum accounts exists in the state-root, which holds some amount of ETH and is unspendable.&lt;&#x2F;p&gt;
&lt;p&gt;By revealing this to the Ethereum blockchain and providing something like a nullifier
(E.g. $h(s | 123)$ so that double minting of same burnt tokens are not possible), we can add a new
&lt;em&gt;&lt;strong&gt;minting&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt; functionality for ETH so that people can migrate their secretly burnt tokens to a
completely new address, without any trace on the blockchain.&lt;&#x2F;p&gt;
&lt;p&gt;Cryptocurrency mixers like TornadoCash can successfully obfuscate Ethereum transactions, but it&#x27;s
easy for the governments to ban usage of them. Anybody who has interactions with a mixer contract,
whether the sender or receiver, can get marked. However this EIP tries to minimize the privacy leakage
of the senders, by requiring zero smart-contract interactions in order to send money, so
we only use plain EOA-to-EOA transfers. In order to have a &quot;teleportation&quot; mechanism we divide
the set of all Secp256k1 points $E(K)$ into two subsets&#x2F;address-spaces:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The spendable address-space: $\{p \in \{0,1\}^{160} | \exists s : keccak(s \times G)=p \lor \exists c : keccak(c_{params})=p \}$&lt;&#x2F;li&gt;
&lt;li&gt;The unspendable address-space: $\{p \in \{0,1\}^{160} | \nexists s : keccak(s \times G)=p \land \nexists c : keccak(c_{params})=p \}$&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The spendable&#x2F;unspendable addresses are not distinguishable, so we can exploit this fact and define
a spendability rule for the money sent to addresses that can&#x27;t be spent using regular elliptic-curve
signatures.&lt;&#x2F;p&gt;
&lt;p&gt;Deposits are made by sending ether to an address &lt;code&gt;sha256(MAGIC_ADDRESS + secret)[12:]&lt;&#x2F;code&gt;, where you know the &lt;code&gt;secret&lt;&#x2F;code&gt;. This ensures that no one knows about the deposit unless you reveal it: a deposit onchain is not distinguishable from sending ether to a friend. Withdrawals use a zero-knowledge proof to prove knowledge of a previous deposit&#x27;s &lt;code&gt;secret&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;A deposit can come from two places: a standard deposit by sending ether, or a change deposit. A change deposit is automatically generated when withdrawing funds from another deposit (standard or change). The entire deposited amount does not have to be withdrawn; for example, if 20 ether was deposited and only 12 is withdrawn, the system will make a new change deposit of 8 ether. The value of this change deposit is hashed, so someone looking at the chain cannot calculate &lt;code&gt;change deposit value + withdrawal value = old deposit value&lt;&#x2F;code&gt; and use the value to expose the original deposit.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP requires that &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7708&#x2F;&quot;&gt;EIP-7708&lt;&#x2F;a&gt; be in place along with an EIP to change receipts to SSZ format. This simplifies the proof as it only needs to verify a regular SHA256 Merkle branch verifying a log, there is no need to do verkle or RLP or other complex logic inside the proof. The log can be of two types: an EIP-7708 ETH transfer log, or a log generated by this EIP itself through the change mechanism.&lt;&#x2F;p&gt;
&lt;p&gt;The EIP also includes a privacy pool &lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-1-1&quot;&gt;&lt;a href=&quot;#fn-1&quot;&gt;1&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; mechanism where you must provide a privacy pool root, which corresponds to a list of deposits, so you prove that your deposit is one of the deposits in that list. Since this second Merkle branch mechanism is integrated into the proof, the marginal cost for a user to use it is zero, ensuring maximum adoption and maximizing the chance that privacy will be used responsibly. The privacy pools paper explains in much more detail the value of this privacy pools mechanism, and the benefits of an ecosystem where almost all legitimate users use it.&lt;&#x2F;p&gt;
&lt;p&gt;The built-in PoW and 32 ETH limit prevent hash collision attacks: if an attacker can find collision &lt;code&gt;(x1, x2)&lt;&#x2F;code&gt; such that &lt;code&gt;create2_address(..., x1) == sha256(MAGIC_ADDRESS + x2)&lt;&#x2F;code&gt;, the attacker could extract their ether twice (but only twice). Such an attack requires approximately &lt;code&gt;2**80&lt;&#x2F;code&gt; hashes. Adding 24 bits of PoW increases the difficulty to &lt;code&gt;2**92&lt;&#x2F;code&gt;. This many hashes can be computed but is very difficult; currently, mining a Bitcoin block takes around &lt;code&gt;2**79&lt;&#x2F;code&gt; hashes, so those with the capabilities to attack this mechanism have a much more lucrative opportunity in Bitcoin mining.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;scalability-implications&quot;&gt;Scalability Implications&lt;&#x2F;h3&gt;
&lt;p&gt;In case the circuits are able to simultaneously re-mint the sum of multiple burns in a single-proof,
merchants and CEXs will be able to accept their payments in burn-addresses and accumulate their funds
in a single address by storing a single proof (And a bunch of nullifiers) on the blockchain, which
significantly reduces the transaction count on the blockchain. The people who will use this EIP as a
scalability solution, will also increase the privacy guarantees of the protocol.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The Ethers generated using the mint function should not have any difference with original Ethers.
People should be able to use those minted Ethers for paying the gas fees.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;To be determined (TBD).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;zk-snark-implementation&quot;&gt;ZK-SNARK Implementation&lt;&#x2F;h3&gt;
&lt;p&gt;Also TBD, but the implementation must meet the following conditions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Use a transparent setup; ideally reuse the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt; setup. Do not use Groth16 or other application-specific setups.&lt;&#x2F;li&gt;
&lt;li&gt;The circuit should be directly verifiable without blindly trusting compilers like Circom. SHA256 is not too complicated and can be implemented using PLOOKUP with an 8-bit lookup table for arithmetic operations, which should suffice. There is no need to over-focus on prover efficiency.&lt;&#x2F;li&gt;
&lt;li&gt;Elliptic curves must still be used; Stark is too large.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;In case of faulty implementation of this EIP, people may mint infinite amount of ETH, collapsing the price of Ethereum.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;section class=&quot;footnotes&quot;&gt;
&lt;ol class=&quot;footnotes-list&quot;&gt;
&lt;li id=&quot;fn-1&quot;&gt;
&lt;p&gt;Buterin, V., Illum, J., Nadler, M., Schär, F., &amp;amp; Soleimani, A. (n.d.). &lt;span style=&quot;font-style: italic;&quot;&gt;Blockchain Privacy and Regulatory Compliance: Towards a Practical Equilibrium&lt;&#x2F;span&gt;. https:&#x2F;&#x2F;doi.org&#x2F;&lt;a href=&quot;https:&#x2F;&#x2F;doi.org&#x2F;10.2139&#x2F;ssrn.4563364&quot;&gt;10.2139&#x2F;ssrn.4563364&lt;&#x2F;a&gt; (Original work published 2023) &lt;a href=&quot;#fr-1-1&quot;&gt;↩&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;section&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EOF - Data section access instructions</title>
        <published>2023-08-11T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Andrei Maiboroda</name><uri>https://github.com/gumb0</uri>
	</author>
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	<author>
		<name>Paweł Bylica</name><uri>https://github.com/chfast</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7480/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7480-eof-data-instructions/15414" />
        

        <id>https://wg-eips.ritovision.com/7480/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7480"
            label="EIP-7480" />
        

        
        

        
        <summary type="html">Instructions to read data section of EOF container</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7480/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Four new instructions are introduced, that allow to read EOF container&#x27;s data section: &lt;code&gt;DATALOAD&lt;&#x2F;code&gt; loads 32-byte word to stack, &lt;code&gt;DATALOADN&lt;&#x2F;code&gt; loads 32-byte word to stack where the word is addressed by a static immediate argument, &lt;code&gt;DATASIZE&lt;&#x2F;code&gt; loads data section size and &lt;code&gt;DATACOPY&lt;&#x2F;code&gt; copies a segment of data section to memory.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Clear separation between code and data is one of the main features of EOF1. Data section may contain anything, e.g. compiler&#x27;s metadata, but to make it useful for smart contracts, EVM has to have instructions that allow to read from data section. Previously existing instructions for bytecode inspection (&lt;code&gt;CODECOPY&lt;&#x2F;code&gt;, &lt;code&gt;CODESIZE&lt;&#x2F;code&gt; etc.) are deprecated in EOF1 and cannot be used for this purpose.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;DATALOAD&lt;&#x2F;code&gt;, &lt;code&gt;DATASIZE&lt;&#x2F;code&gt;, &lt;code&gt;DATACOPY&lt;&#x2F;code&gt; instruction pattern follows the design of existing instructions for reading other kinds of data (i.e. returndata and calldata).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;DATALOADN&lt;&#x2F;code&gt; is an optimized version of &lt;code&gt;DATALOAD&lt;&#x2F;code&gt;, where data offset to read is set at compilation time, and therefore need not be validated at run-time, which makes the instruction cheaper.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;We introduce four new instructions on the same block number &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3540&#x2F;&quot;&gt;EIP-3540&lt;&#x2F;a&gt; is activated on:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;DATALOAD&lt;&#x2F;code&gt; (0xd0)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;DATALOADN&lt;&#x2F;code&gt; (0xd1)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;DATASIZE&lt;&#x2F;code&gt; (0xd2)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;DATACOPY&lt;&#x2F;code&gt; (0xd3)&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;If the code is legacy bytecode, all of these instructions result in an &lt;em&gt;exceptional halt&lt;&#x2F;em&gt;. (&lt;em&gt;Note: This means no change to behaviour.&lt;&#x2F;em&gt;)&lt;&#x2F;p&gt;
&lt;p&gt;If the code is valid EOF1, the following execution rules apply:&lt;&#x2F;p&gt;
&lt;h3 id=&quot;dataload&quot;&gt;&lt;code&gt;DATALOAD&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;Pops one value, &lt;code&gt;offset&lt;&#x2F;code&gt;, from the stack.&lt;&#x2F;li&gt;
&lt;li&gt;Reads &lt;code&gt;[offset:offset+32]&lt;&#x2F;code&gt; segment from the data section and pushes it as 32-byte value to the stack.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;offset + 32&lt;&#x2F;code&gt; is greater than the data section size, bytes after the end of data section are set to 0.&lt;&#x2F;li&gt;
&lt;li&gt;Deducts 4 gas.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;dataloadn&quot;&gt;&lt;code&gt;DATALOADN&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;Has one immediate argument,&lt;code&gt;offset&lt;&#x2F;code&gt;, encoded as a 16-bit unsigned big-endian value.&lt;&#x2F;li&gt;
&lt;li&gt;Pops nothing from the stack.&lt;&#x2F;li&gt;
&lt;li&gt;Reads &lt;code&gt;[offset:offset+32]&lt;&#x2F;code&gt; segment from the data section and pushes it as 32-byte value to the stack.&lt;&#x2F;li&gt;
&lt;li&gt;Deducts 3 gas.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;code&gt;[offset:offset+32]&lt;&#x2F;code&gt; is guaranteed to be within data bounds by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7480&#x2F;#code-validation&quot;&gt;code validation&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;datasize&quot;&gt;&lt;code&gt;DATASIZE&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;Pops nothing from the stack.&lt;&#x2F;li&gt;
&lt;li&gt;Pushes the size of the data section of the active container to the stack.&lt;&#x2F;li&gt;
&lt;li&gt;Deducts 2 gas.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;datacopy&quot;&gt;&lt;code&gt;DATACOPY&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;Pops three values from the stack: &lt;code&gt;mem_offset&lt;&#x2F;code&gt;, &lt;code&gt;offset&lt;&#x2F;code&gt;, &lt;code&gt;size&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Performs memory expansion to &lt;code&gt;mem_offset + size&lt;&#x2F;code&gt; and deducts memory expansion cost.&lt;&#x2F;li&gt;
&lt;li&gt;Deducts &lt;code&gt;3 + 3 * ((size + 31) &#x2F;&#x2F; 32)&lt;&#x2F;code&gt; gas for copying.&lt;&#x2F;li&gt;
&lt;li&gt;Reads &lt;code&gt;[offset:offset+size]&lt;&#x2F;code&gt; segment from the data section and writes it to memory starting at offset &lt;code&gt;mem_offset&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;offset + size&lt;&#x2F;code&gt; is greater than data section size, 0 bytes will be copied for bytes after the end of the data section.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;code-validation&quot;&gt;Code Validation&lt;&#x2F;h3&gt;
&lt;p&gt;We extend code section validation rules (as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3670&#x2F;&quot;&gt;EIP-3670&lt;&#x2F;a&gt;).&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Code section is invalid in case an immediate argument &lt;code&gt;offset&lt;&#x2F;code&gt; of any &lt;code&gt;DATALOADN&lt;&#x2F;code&gt; is such that &lt;code&gt;offset + 32&lt;&#x2F;code&gt; is greater than data section size, as indicated in the container header &lt;em&gt;before deployment&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RJUMP&lt;&#x2F;code&gt;, &lt;code&gt;RJUMPI&lt;&#x2F;code&gt; and &lt;code&gt;RJUMPV&lt;&#x2F;code&gt; immediate argument value (jump destination relative offset) validation: code section is invalid in case offset points to one of two bytes directly following &lt;code&gt;DATALOADN&lt;&#x2F;code&gt; instruction.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;zero-padding-on-out-of-bounds-access&quot;&gt;Zero-padding on out of bounds access&lt;&#x2F;h3&gt;
&lt;p&gt;Existing instructions for reading other kinds of data implicitly pad with zeroes on out of bounds access, with the only exception of return data copying.&lt;&#x2F;p&gt;
&lt;p&gt;It is beneficial to avoid exceptional failures, because compilers can employ optimizations like removing a code that copies data, but never accesses this copy afterwards, but such optimization is possible only if instruction never has other side effects like exceptional abort.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;lack-of-extdatacopy&quot;&gt;Lack of &lt;code&gt;EXTDATACOPY&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt; instruction is deprecated and rejected in EOF contracts and does not copy contract code when being called in legacy with an EOF contract as target. A replacement instruction &lt;code&gt;EXTDATACOPY&lt;&#x2F;code&gt; has been considered, but decided against in order to reduce the scope of changes.&lt;&#x2F;p&gt;
&lt;p&gt;Data-only contracts which previously relied on &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt; are thereby discouraged, but if there is a strong need, support for them can be easily brought back by introducing &lt;code&gt;EXTDATACOPY&lt;&#x2F;code&gt; in a future upgrade.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change poses no risk to backwards compatibility, as it is introduced only for EOF1 contracts, for which deploying undefined instructions is not allowed, therefore there are no existing contracts using these instructions. The new instructions are not introduced for legacy bytecode (code which is not EOF formatted).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Gas cost of these new opcodes is comparable to the legacy &lt;code&gt;CODECOPY&lt;&#x2F;code&gt; instruction. They must be carefully considered during the implementation of the EOF container validation algorithm.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Physical Asset Redemption</title>
        <published>2023-08-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Lee Vidor</name><uri>https://github.com/V1d0r</uri>
	</author>
	
	<author>
		<name>David Tan</name><email>david@emergentx.org</email>
	</author>
	
	<author>
		<name>Lee Smith</name><email>lee@emergentx.org</email>
	</author>
	
	<author>
		<name>Gabriel Stoica</name><uri>https://github.com/gabrielstoica</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7578/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7578-physical-asset-redemption/17556" />
        

        <id>https://wg-eips.ritovision.com/7578/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7578"
            label="ERC-7578" />
        

        
        

        
        <summary type="html">Provides the holder of physical asset backed NFTs readily available real-world information on the underlying physical asset.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7578/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal is an extension of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and implements additional functionality and information pertaining to the NFT’s underlying physical asset by capturing information that enables the holder of physical asset backed NFTs to verify authenticity and facilitate redemption of the underlying physical assets. This proposal is primarily aimed at providing transparency by disclosing details of involved parties and provides opportunity to define and make readily available relevant legal relationship between NFT holder and the owner&#x2F;holder of the respective underlying physical asset. This proposal makes the token issuer accountable to embed accurate information on a set of standardized information about the underlying physical asset and the involved key parties.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The first wave of NFT use cases encompass predominately the representation of ownership of digital assets. In view of the anticipated trend to tokenize any real-world asset, it is to be expected that the use cases of NFTs will rapidly grow and expand around physical assets. The absence of an embedded standardized set of information pertaining to the underlying physical asset together with lack of transparency of involved key parties, creates an unnecessary hurdle for NFT holders and potential users which might, as a result, hinder mass adoption of NFTs that are used as ownership representation of a specific physical asset.&lt;&#x2F;p&gt;
&lt;p&gt;Addressing the lack of readily available information and paving the way for mass adoption for a tokenized economy, this proposal requires that each minted token includes a defined number of predefined variables enabling verification of authenticity and facilitating redemption of the underlying physical asset.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot; and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;When a token is minted, its properties SHOULD be initialized beforehand, with each field being defined as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Token issuer&lt;&#x2F;strong&gt;: identification of an individual or entity minting the NFT
&lt;br&gt; &lt;em&gt;The token issuer is the key person connecting the physical asset and the digital representation. By identifying and disclosing the token issuer, a reference point is made instantly available to the NFT holder which allows them to conduct a due diligence on the NFT issuer and assessment of the NFT issuer’s trustworthiness. At the same time, it creates accountability for the token issuer which leads to overall improvement and standardisation of the NFT minting process. Token issuers will compete for best practices and recognition to gain advantages over competitors. A reputable NFT issuer will e.g. keep information on the legal owner of the physical asset prior to the minting of the underlying physical asset to satisfy any AML and KYC concerns. Ideally the NFT issuer is identified by a name but may also be identifiable via unique identification number or network ID that is issued by a service provider who stores relevant information on the NFT issuer.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Asset holder&lt;&#x2F;strong&gt;: identification of legal owner of underlying physical asset
&lt;br&gt; &lt;em&gt;In view of a redemption of the underlying physical asset and enforcing of legal rights, it is (from a legal perspective) essential for the NFT holder to identify the legal owner of the underlying physical asset. It allows the NFT holder to consider the legal counterparty risk. It cannot be assumed that the NFT issuer is the legal owner of the underlying physical asset, therefore it is vital for the NFT holder to have instant access to this additional information. Same as with the NFT issuer’s identity, the legal owner is ideally identified by a name but may also be identifiable via unique identification number or network ID that is issued by a service provider who stores relevant information on the legal owner.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Storage location&lt;&#x2F;strong&gt;: identification of storage location of underlying physical asset
&lt;br&gt; &lt;em&gt;Certain physical assets require specific storage conditions. A digital representation of an inappropriately stored physical asset may impact the value of the NFT significantly. Disclosing the storage location and making it directly accessible to the NFT holder, allows them to evaluate the storage risk of the underlying physical asset. In addition, it provides the NFT holder with a second point of contact for the enforcement of the redemption of the underlying physical asset.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Terms&lt;&#x2F;strong&gt;: identification of legal relationship
&lt;br&gt; &lt;em&gt;The disclosure and accessibility of the legal basis of the relationship between NFT holder and legal owner of the underlying physical asset promotes token issuers to stipulate and define the legal rights of the involved key parties. It furthermore allows the NFT Holder to conduct a legal risk and enforcement assessment. Ideally, the information is provided by embedding a link to the actual legal documentation such as an agreement or terms. The more information is accessible via the NFT, the better the NFT holder can assess the legal risks associated with enforcement of the redemption of the underlying physical asset.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Jurisdiction&lt;&#x2F;strong&gt;: governing law and jurisdiction
&lt;br&gt; &lt;em&gt;The applicable law is an extension of the legal contract disclosure and makes instantly available to the NFT holder or smart contract under what jurisdiction an enforcement would be governed without the need to review the details legal contract. This allows for an instant assessment of jurisdiction risk.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Declared value&lt;&#x2F;strong&gt;: value of the underlying asset
&lt;br&gt; &lt;em&gt;Certain auxiliary services such as insurance are tied to a value of the NFT and underlying physical asset. By defining a declared value, NFTs are able to be categorised in certain ways while the declared value provides an indication regarding the underlying asset’s value. The declared value of the underlying physical asset does not necessarily represent the market value.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;code&gt;terms&lt;&#x2F;code&gt; parameter SHOULD be an HTTP link to a document that is stored on IPFS. This is to ensure that the document is immutable and can be verified by the NFT holder.&lt;&#x2F;p&gt;
&lt;p&gt;When a token with valid properties is to be burned, the properties MUST be removed.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;contract-interface&quot;&gt;Contract Interface&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.21&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Struct encapsulating fields required to by the ERC-7578 standard to represent the physical asset&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenIssuer&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The network or entity minting the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; assetHolder&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The legal owner of the physical asset&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; storageLocation&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The physical location where the asset is stored&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; terms&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Link to IPFS contract, agreement or terms&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; jurisdiction&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The legal justification set out in the terms&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; declaredValue&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The declared value at time of token minting&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Properties&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span&gt; tokenIssuer&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span&gt; assetHolder&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span&gt; storageLocation&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span&gt; terms&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span&gt; jurisdiction&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Amount declaredValue&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Struct encapsulating fields describing the declared value of the physical asset&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; currency&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The currency of the amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The value of the amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Amount&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span&gt; currency&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Required interface of an ERC-7578 compliant contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7578&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when the properties of the `tokenId` token are set&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ID of the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The properties of the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PropertiesSet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;Properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; properties&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when the properties of the `tokenId` token are removed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ID of the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PropertiesRemoved&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieves all properties of the `tokenId` token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Does NOT revert if token doesn&amp;#39;t exist&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token ID of the minted token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getPropertiesOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; properties&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;When &lt;code&gt;properties&lt;&#x2F;code&gt; are set, the &lt;code&gt;PropertiesSet(uint256 indexed tokenId, Properties properties)&lt;&#x2F;code&gt; event is emitted.&lt;&#x2F;p&gt;
&lt;p&gt;When &lt;code&gt;properties&lt;&#x2F;code&gt; are removed, the &lt;code&gt;PropertiesRemoved(uint256 indexed tokenId)&lt;&#x2F;code&gt; event is emitted.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;getPropertiesOf(uint256 tokenId)&lt;&#x2F;code&gt; function MUST return the unique &lt;code&gt;properties&lt;&#x2F;code&gt; of a token. If the ERC-721 token is burned or has no properties set, it SHOULD return an empty &lt;code&gt;Properties&lt;&#x2F;code&gt; struct.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;By not initializing a token&#x27;s properties before minting, one risks that the asset&#x27;s provenance represented by the token cannot be established.&lt;&#x2F;p&gt;
&lt;p&gt;Contract level validation is not used on the properties as we believe the accuracy of the data declared is the responsibility of the token issuer. This builds trust on the token issuer and the token itself.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is compatible with ERC-721.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;An example of an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; that includes this proposal using the OpenZeppelin ERC-721 v5 library:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.21&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; { &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC721&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC721&#x2F;ERC721.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; { &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC7578&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Properties&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Amount&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;interfaces&#x2F;IERC7578.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC7578&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@author&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; DESAT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Implementation of the ERC-7578: Physical Asset Redemption standard&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC7578&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC7578&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Thrown when the properties of a token are not initialized&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PropertiesUninitialized&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieves the properties of the `tokenId` token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; tokenId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Properties&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _properties&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Initializes the name and symbol of the ERC-721 collection&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _symbol&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_name, _symbol) &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@inheritdoc&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; IERC7578&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getPropertiesOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; properties&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        properties &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _properties&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Initializes the ERC-7578 properties of the `tokenId` token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * WARNING: This method should only be called within a function that has appropriate access control&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * It is recommended to restrict access to trusted Externally Owned Accounts (EOAs),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * authorized contracts, or implement a Role-Based Access Control (RBAC) mechanism&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Failure to properly secure this method could lead to unauthorized modification of token properties&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Emits a {PropertiesSet} event&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _setPropertiesOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; Properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; properties&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _properties&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Properties&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            tokenIssuer&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; properties&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;tokenIssuer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            assetHolder&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; properties&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;assetHolder&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            storageLocation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; properties&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;storageLocation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            terms&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; properties&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;terms&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            jurisdiction&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; properties&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;jurisdiction&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            declaredValue&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Amount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                currency&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; properties&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;declaredValue&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;currency&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; properties&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;declaredValue&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PropertiesSet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _properties&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Removes the properties of the `tokenId` token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The unique identifier of the token whose properties are to be removed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Emits a {PropertiesRemoved} event&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _removePropertiesOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        delete&lt;&#x2F;span&gt;&lt;span&gt; _properties&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PropertiesRemoved&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Override of the {_update} function to remove the properties of the `tokenId` token or&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * to check if they are set before minting&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The unique identifier of the token being minted or burned&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _update&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; from &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;to &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            _removePropertiesOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;from &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_properties&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;tokenIssuer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PropertiesUninitialized&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_update&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;To ensure authenticity, token properties must be set only via a method that is restricted to a trusted Externally Owned Account (EOA) or contract. This trusted entity must verify that the properties accurately reflect the real physical attributes of the represented asset. Additionally, proper access control mechanisms should be implemented to prevent unauthorized modifications of token properties after they are set.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Prevent ticket touting</title>
        <published>2023-07-28T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>LeadBest Consulting Group</name><email>service@getoken.io</email>
	</author>
	
	<author>
		<name>Sandy Sung</name><uri>https://github.com/sandy-sung-lb</uri>
	</author>
	
	<author>
		<name>Mars Peng</name><email>mars.peng@getoken.io</email>
	</author>
	
	<author>
		<name>Taien Wang</name><email>taien.wang@getoken.io</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7439/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/prevent-ticket-touting/15269" />
        

        <id>https://wg-eips.ritovision.com/7439/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:7439"
            label="ERC-7439" />
        

        
        

        
        <summary type="html">An interface for customers to resell their tickets via authorized ticket resellers.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7439/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is an extension of  &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and defines standard functions outlining a scope for ticketing agents or event organizers to take preventative actions to stop audiences being exploited in the ticket scalping market and allow customers to resell their tickets via authorized ticket resellers.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Industrial-scale ticket touting has been a longstanding issue, with its associated fraud and criminal problems leading to unfortunate incidents and waste of social resources. It is also hugely damaging to artists at all levels of their careers and to related businesses across the board. Although the governments of various countries have begun to legislate to restrict the behavior of scalpers, the effect is limited. They still sold tickets for events at which resale was banned or did not yet own then obtained substantial illegal profits from speculative selling. We consulted many opinions to provide a consumer-friendly resale interface, enabling buyers to resell or reallocate a ticket at the price they initially paid or less is the efficient way to rip off “secondary ticketing”.that enables ticketing agents to utilize&lt;&#x2F;p&gt;
&lt;p&gt;The typical ticket may be a &quot;piece of paper&quot; or even a voucher in your email inbox, making it easy to counterfeit or circulate. To restrict the transferability of these tickets, we have designed a mechanism that prohibits ticket transfers for all parties, including the ticket owner, except for specific accounts that are authorized to transfer tickets. The specific accounts may be ticketing agents, managers, promoters and authorized resale platforms. Therefore, the ticket touts are unable to transfer tickets as they wish. Furthermore, to enhance functionality, we have implemented a token info schema to each ticket,  allowing only authorized accounts(excluding the owner) to modify these records.&lt;&#x2F;p&gt;
&lt;p&gt;This standard defines a framework that enables ticketing agents to utilize &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; tokens as event tickets and restricts token transferability to prevent ticket touting. By implementing this standard, we aim to protect customers from scams and fraudulent activities.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;interface&quot;&gt;Interface&lt;&#x2F;h3&gt;
&lt;p&gt;The interface and structure referenced here are as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;TokenInfo
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;signature&lt;&#x2F;code&gt;: Recommend that the adapter self-defines what to sign using the user&#x27;s private key or agent&#x27;s private key to prove the token validity.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;status&lt;&#x2F;code&gt;: Represent token current status.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;expireTime&lt;&#x2F;code&gt;: Recommend set to the event due time.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;TokenStatus
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Sold&lt;&#x2F;code&gt;: When a token is sold, it MUST change to &lt;code&gt;Sold&lt;&#x2F;code&gt;. The token is valid in this status.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Resell&lt;&#x2F;code&gt;: When a token is in the secondary market, it MUST be changed to Resell. The token is valid in this status.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Void&lt;&#x2F;code&gt;: When the token owner engages in an illegal transaction, the token status MUST be set to Void, and the token is invalid in this status.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Redeemed&lt;&#x2F;code&gt;:  When the token is used, it is RECOMMENDED to change the token status to &lt;code&gt;Redeemed&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; IERC7439 Prevent Ticket Touting Interface&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7439&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is ERC721 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; TokenStatus represent the token current status, only specific role can change status&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TokenStatus&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        Sold&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        Resell&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        Void&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        Redeemed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Data signed by user&amp;#39;s private key or agent&amp;#39;s private key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenStatus&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Token status changing to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; expireTime&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Event due time&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TokenInfo&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        TokenStatus tokenStatus&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; expireTime&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to notify listeners that the token with the specified ID has been &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; status&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token has been &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; status&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenStatus&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Token status has been &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Data signed by user&amp;#39;s private key or agent&amp;#39;s private key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TokenStatusChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        TokenStatus&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenStatus&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to mint token with token status&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST emit the `TokenStatusChanged` event if the token status is &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The receiptent of token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Data signed by user&amp;#39;s private key or agent&amp;#39;s private key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeMint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to change token status and can only be invoked by a specific role&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST emit the `TokenStatusChanged` event if the token status is &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token need to change status&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Data signed by user&amp;#39;s private key or agent&amp;#39;s private key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenStatus&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Token status changing to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; newExpireTime&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; New event due time&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; changeState&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        TokenStatus&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenStatus&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newExpireTime&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; method MUST return &lt;code&gt;true&lt;&#x2F;code&gt; when called with &lt;code&gt;0x15fbb306&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Designing the proposal, we considered the following questions:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;What is the most crucial for ticketing agents, performers, and audiences?&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;For ticketing companies, selling out all tickets is crucial. Sometimes, to create a vibrant sales environment, ticketing companies may even collaborate with scalpers. This practice can be detrimental to both the audience and performers. To prevent such situations, there must be an open and transparent primary sales channel, as well as a fair secondary sales mechanism. In the &lt;code&gt;safeMint&lt;&#x2F;code&gt; function, which is a public function, we hope that everyone can mint tickets transparently at a listed price by themselves. At that time, &lt;code&gt;TokenInfo&lt;&#x2F;code&gt; adds a signature that only the buyer account or agent can resolve depending on the mechanism, to prove the ticket validity. And the token &lt;code&gt;status&lt;&#x2F;code&gt; is &lt;code&gt;Sold&lt;&#x2F;code&gt;. Despite this, we must also consider the pressures on ticketing companies. They aim to maximize the utility of every valid ticket, meaning selling out each one. In the traditional mechanism, ticketing companies only benefit from the initial sale, implying that they do not enjoy the excess profits from secondary sales. Therefore, we have designed a secondary sales process that is manageable for ticketing companies. In the &lt;code&gt;_beforeTokenTransfer()&lt;&#x2F;code&gt; function, you can see that it is an accessControl function, and only the &lt;code&gt;PARTNER_ROLE&lt;&#x2F;code&gt; &lt;code&gt;mint&lt;&#x2F;code&gt; or &lt;code&gt;burn&lt;&#x2F;code&gt; situation can transfer the ticket. The &lt;code&gt;PARTNER_ROLE&lt;&#x2F;code&gt; can be the ticket agency or a legal secondary ticket selling platform, which may be a state supervision or the ticket agency designated platform. To sustain the fair ticketing market, we cannot allow them to transfer tickets themselves, because we can’t distinguish whether the buyer is a scalper.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;For performers or event holder, they aren&#x27;t willing to see bad news during ticket selling. A smooth ticketing process or no news that may damage their performers’ reputation is what they want. Other than that, what really matters is all the audience true fans who come. Tickets ending up in the hands of scalpers or entering a chaotic secondary market doesn&#x27;t really appeal to genuine fans. We believe performers wouldn&#x27;t be pleased with such a situation. Through the transparant mechanism, performers or event holder can control the real sales status at all times form cross-comparison of token mint amount and &lt;code&gt;TokenInfo&lt;&#x2F;code&gt;-&lt;code&gt;TokenStatus&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;enum TokenStatus {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Sold,    &#x2F;&#x2F; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Resell,  &#x2F;&#x2F; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Void,    &#x2F;&#x2F; 2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Redeemed &#x2F;&#x2F; 3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;For audiences, the only thing they need is to get a valid ticket. In the traditional mechanism,fans encounter many obstacles. At hot concerts, fans who try to snag tickets can run into some foes, like scalpers and ticketing companies. These scalpers are like pros, all organized and strategic in grabbing up tickets. Surprisingly, ticketing companies might actually team up with these scalpers. Or, they might just keep a bunch of freebies or VIP tickets to themselves. A transparent mechanism is equally important for the audiences.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;How to establish a healthy ticketing ecosystem?&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Clear ticketing rules are key to making sure the supply and demand stay in balance.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;An open pricing system is a must to make sure consumers are protected.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Excellent liquidity. In the initial market, users can mint tickets themselves. If needed, purchased tickets can also be transferred in a transparent and open secondary market. Audiences who didn’t buy tickets during the initial sale can also confidently purchase tickets in a legal secondary market. The &lt;code&gt;changeState&lt;&#x2F;code&gt; function is to help the ticket have good liquidity. Only &lt;code&gt;PARTNER_ROLE&lt;&#x2F;code&gt; can change the ticket status. Once the sold ticket needs to be sold in the secondary market, it needs to ask the secondary market to help it change to resell status. The process of changing status is a kind of official verification of the secondary sale ticket. It is a protection mechanism to the second hand buyer.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;How to design a smooth ticketing process？&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Easy to buy&#x2F;sell. Audiences can buy ticket as mint NFT. This is a well-known practice.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Easy to refund. When something extreme happens and you need to cancel the show. Handling ticket refunds can be a straightforward process.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Easy to redeem. Before the show, the ticket agency can verify the ticket by the signature to confirm if the audience is genuine. &lt;code&gt;TokenStatus&lt;&#x2F;code&gt; needs to be equal to &lt;code&gt;sold&lt;&#x2F;code&gt;, and &lt;code&gt;expireTime&lt;&#x2F;code&gt; can distinguish whether the audience has arrived at the correct session. After verification is passed, the ticket agency can change the &lt;code&gt;TokenStatus&lt;&#x2F;code&gt; to &lt;code&gt;Redeemed&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Normal Flow
&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7439&#x2F;.&#x2F;assets&#x2F;normal.png&quot; alt=&quot;Alt text&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Void Flow
&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7439&#x2F;.&#x2F;assets&#x2F;void.png&quot; alt=&quot;Alt text&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Resell Flow
&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7439&#x2F;.&#x2F;assets&#x2F;resell.png&quot; alt=&quot;Alt text&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; expectRevert&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;@openzeppelin&#x2F;test-helpers&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; expect&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;chai&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; ERC7439&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; artifacts&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ERC7439&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ERC7439&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;accounts&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;deployer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; partner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; userA&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; userB&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; accounts&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; expireTime&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 19999999&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x993dab3dd91f5c6dc28e17439be475478f5635c92a56e17e82349d3fb2f166196f466c0b4e0c146f285204f0dcb13e5ae67bc33f4b888ec32dfe0a063e8f3f781b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; zeroHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  beforeEach&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt;async&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;    this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;erc7439&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; ERC7439&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;new&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      from&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; deployer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;erc7439&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;userA&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt; from&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; deployer&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  it&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Should mint a token&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; async&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; tokenInfo&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;erc7439&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;tokenInfo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;erc7439&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;userA&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tokenInfo&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tokenInfo&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;status&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sold&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tokenInfo&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;expireTime&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;expireTime&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  it&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;should ordinary users cannot transfer successfully&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; async&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    expectRevert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;erc7439&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;userA&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; userB&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt; from&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; userA&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ERC7439: You cannot transfer this NFT!&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  it&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;should partner can transfer successfully and chage the token info to resell status&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; async&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; tokenStatus&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Resell&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;erc7439&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;changeState&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; zeroHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenStatus&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt; from&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; partner&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;erc7439&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;userA&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; partner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt; from&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; partner&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tokenInfo&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tokenHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;zeroHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tokenInfo&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;status&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tokenStatus&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Resell&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;erc7439&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;partner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  it&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;should partner can change the token status to void&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; async&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; tokenStatus&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Void&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;erc7439&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;changeState&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; zeroHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenStatus&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt; from&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; partner&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tokenInfo&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tokenHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;zeroHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tokenInfo&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;status&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tokenStatus&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Void&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  it&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;should partner can change the token status to redeemed&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; async&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; tokenStatus&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Redeemed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;erc7439&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;changeState&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; zeroHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenStatus&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt; from&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; partner&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tokenInfo&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tokenHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;zeroHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tokenInfo&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;status&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tokenStatus&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Redeemed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  it&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;should partner can resell the token and change status from resell to sold&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; async&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenStatus&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Resell&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;erc7439&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;changeState&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; zeroHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenStatus&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt; from&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; partner&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;erc7439&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;userA&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; partner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt; from&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; partner&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tokenInfo&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;status&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tokenStatus&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Resell&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tokenInfo&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tokenHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;zeroHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    tokenStatus&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sold&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; newSignature&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x113hqb3ff45f5c6ec28e17439be475478f5635c92a56e17e82349d3fb2f166196f466c0b4e0c146f285204f0dcb13e5ae67bc33f4b888ec32dfe0a063w7h2f742f&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;erc7439&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;changeState&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; newSignature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenStatus&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt; from&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; partner&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;erc7439&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;partner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; userB&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt; from&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; partner&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tokenInfo&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;status&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tokenStatus&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sold&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tokenInfo&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tokenHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;newSignature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0.8.19&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC721&#x2F;ERC721.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If you need additional metadata, you can import ERC721URIStorage&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; import &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC721&#x2F;extensions&#x2F;ERC721URIStorage.sol&amp;quot;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;access&#x2F;AccessControl.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;utils&#x2F;Counters.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERC7439.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC7439&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;AccessControl&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC7439&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    using&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Counters&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Counters&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;Counter&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; PARTNER_ROLE &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;PARTNER_ROLE&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Counters&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;Counter &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;private&lt;&#x2F;span&gt;&lt;span&gt; _tokenIdCounter&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; expireTime&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; TokenInfo&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; tokenInfo&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _expireTime&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;&amp;quot;MyToken&amp;quot;, &amp;quot;MTK&amp;quot;) &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _grantRole&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;DEFAULT_ADMIN_ROLE&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _grantRole&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;PARTNER_ROLE&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        expireTime &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _expireTime&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeMint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; tokenId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _tokenIdCounter&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;current&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _tokenIdCounter&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;increment&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _safeMint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        tokenInfo&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TokenInfo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; TokenStatus&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;Sold&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; expireTime&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TokenStatusChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; TokenStatus&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;Sold&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; changeState&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        TokenStatus&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenStatus&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newExpireTime&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyRole&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;PARTNER_ROLE&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        tokenInfo&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TokenInfo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenStatus&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; newExpireTime&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TokenStatusChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenStatus&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _burn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC721&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_burn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_exists&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            delete&lt;&#x2F;span&gt;&lt;span&gt; tokenInfo&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If you import ERC721URIStorage&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; delete _tokenURIs[tokenId];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;AccessControl&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;IERC7439&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _beforeTokenTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC721&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;hasRole&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;PARTNER_ROLE&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _msgSender&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                from &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span&gt; to &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;                &amp;quot;ERC7439: You cannot transfer this NFT!&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_beforeTokenTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;There are no security considerations related directly to the implementation of this standard.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>NFT Dynamic Traits</title>
        <published>2023-07-28T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Adam Montgomery</name><uri>https://github.com/montasaurus</uri>
	</author>
	
	<author>
		<name>Ryan Ghods</name><uri>https://github.com/ryanio</uri>
	</author>
	
	<author>
		<name>0age</name><uri>https://github.com/0age</uri>
	</author>
	
	<author>
		<name>James Wenzel</name><uri>https://github.com/emo-eth</uri>
	</author>
	
	<author>
		<name>Stephan Min</name><uri>https://github.com/stephankmin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7496/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7496-nft-dynamic-traits/15484" />
        

        <id>https://wg-eips.ritovision.com/7496/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7496"
            label="ERC-7496" />
        

        
        

        
        <summary type="html">Extension to ERC-721 and ERC-1155 for dynamic onchain traits</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7496/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This specification introduces a new interface that extends &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; that defines methods for setting and getting dynamic onchain traits associated with non-fungible tokens. These dynamic traits can be used to represent properties, characteristics, redeemable entitlements, or other attributes that can change over time. By defining these traits onchain, they can be used and modified by other onchain contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Trait values for non-fungible tokens are often stored offchain. This makes it difficult to query and mutate these values in contract code. Specifying the ability to set and get traits onchain allows for new use cases like redeeming onchain entitlements and transacting based on a token&#x27;s traits.&lt;&#x2F;p&gt;
&lt;p&gt;Onchain traits can be used by contracts in a variety of different scenarios. For example, a contract that wants to entitle a token to a consumable benefit (e.g. a redeemable) can robustly reflect that onchain. Marketplaces can allow bidding on these tokens based on the trait value without having to rely on offchain state and exposing users to frontrunning attacks. The motivating use case behind this proposal is to protect users from frontrunning attacks on marketplaces where users can list NFTs with certain traits where they are expected to be upheld during fulfillment.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;Contracts implementing this EIP MUST include the events, getters, and setters as defined below, and MUST return &lt;code&gt;true&lt;&#x2F;code&gt; for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; for &lt;code&gt;0xaf332f3e&lt;&#x2F;code&gt;, the 4 byte &lt;code&gt;interfaceId&lt;&#x2F;code&gt; for this ERC.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7496&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Errors &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Thrown when trying to set a trait that does not exist.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TraitDoesNotExist&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt; traitKey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Thrown when the token does not exist.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TokenDoesNotExist&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Events &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TraitUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; traitKey&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; traitValue&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TraitUpdatedRange&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; traitKey&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; fromTokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; toTokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TraitUpdatedRangeUniformValue&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; traitKey&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; fromTokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; toTokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; traitValue&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TraitUpdatedList&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; traitKey&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TraitUpdatedListUniformValue&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; traitKey&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; traitValue&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TraitMetadataURIUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Getters &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getTraitValue&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; traitKey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; traitValue&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getTraitValues&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; traitKeys&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; traitValues&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getTraitMetadataURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uri&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Setters &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setTrait&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; traitKey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newValue&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;keys-names&quot;&gt;Keys &amp;amp; Names&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;traitKey&lt;&#x2F;code&gt; is used to identify a trait. The &lt;code&gt;traitKey&lt;&#x2F;code&gt; MUST be a unique &lt;code&gt;bytes32&lt;&#x2F;code&gt; value identifying a single trait.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;traitKey&lt;&#x2F;code&gt; SHOULD be a &lt;code&gt;keccak256&lt;&#x2F;code&gt; hash of a human readable trait name.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;errors&quot;&gt;Errors&lt;&#x2F;h3&gt;
&lt;p&gt;If a &lt;code&gt;traitKey&lt;&#x2F;code&gt; is not defined in the contract (i.e., not present in the trait metadata schema), the contract MUST revert with &lt;code&gt;TraitDoesNotExist(traitKey)&lt;&#x2F;code&gt;. This allows applications to detect when they have queried an invalid or unsupported trait key.&lt;&#x2F;p&gt;
&lt;p&gt;If a &lt;code&gt;traitKey&lt;&#x2F;code&gt; is defined in the contract but a specific token does not have a value set for that trait, the contract MUST return &lt;code&gt;bytes32(0)&lt;&#x2F;code&gt; as the default value instead of reverting. This enables batch querying of all defined trait keys across multiple tokens without failures due to unset values.&lt;&#x2F;p&gt;
&lt;p&gt;If a &lt;code&gt;tokenId&lt;&#x2F;code&gt; does not exist, the contract MUST revert with &lt;code&gt;TokenDoesNotExist(tokenId)&lt;&#x2F;code&gt;. If the token contract already defines a custom error for non-existent tokens (e.g. from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt;), that error MAY be used instead.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;metadata&quot;&gt;Metadata&lt;&#x2F;h3&gt;
&lt;p&gt;Trait metadata is necessary to provide information about which traits are present in a contract, how to display trait names and values, and other optional features.&lt;&#x2F;p&gt;
&lt;p&gt;The trait metadata must be compliant with the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7496&#x2F;.&#x2F;assets&#x2F;DynamicTraitsSchema.json&quot;&gt;specified schema&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The trait metadata URI MAY be a data URI or point to an offchain resource.&lt;&#x2F;p&gt;
&lt;p&gt;The keys in the &lt;code&gt;traits&lt;&#x2F;code&gt; object MUST be unique trait names. If the trait name is 32 byte hex string starting with &lt;code&gt;0x&lt;&#x2F;code&gt; then it is interpreted as a literal &lt;code&gt;traitKey&lt;&#x2F;code&gt;. Otherwise, the &lt;code&gt;traitKey&lt;&#x2F;code&gt; is defined as the &lt;code&gt;keccak256&lt;&#x2F;code&gt; hash of the trait name. A literal &lt;code&gt;traitKey&lt;&#x2F;code&gt; MUST NOT collide with the &lt;code&gt;keccak256&lt;&#x2F;code&gt; hash of any other traits defined in the metadata.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;displayName&lt;&#x2F;code&gt; values MUST be unique and MUST NOT collide with the &lt;code&gt;displayName&lt;&#x2F;code&gt; of any other traits defined in the metadata.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;validateOnSale&lt;&#x2F;code&gt; value provides a signal to marketplaces on how to validate the trait value when a token is being sold. If the validation criteria is not met, the sale MUST not be permitted by the marketplace contract. If specified, the value of &lt;code&gt;validateOnSale&lt;&#x2F;code&gt; MUST be one of the following (or it is assumed to be &lt;code&gt;none&lt;&#x2F;code&gt;):&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;none&lt;&#x2F;code&gt;: No validation is necessary.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;requireEq&lt;&#x2F;code&gt;: The &lt;code&gt;bytes32&lt;&#x2F;code&gt; &lt;code&gt;traitValue&lt;&#x2F;code&gt; MUST be equal to the value at the time the offer to purchase was made.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;requireNeq&lt;&#x2F;code&gt;: The &lt;code&gt;bytes32&lt;&#x2F;code&gt; &lt;code&gt;traitValue&lt;&#x2F;code&gt; MUST NOT be equal to the value at the time the offer to purchase was made.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;requireUintLt&lt;&#x2F;code&gt;: The &lt;code&gt;bytes32&lt;&#x2F;code&gt; &lt;code&gt;traitValue&lt;&#x2F;code&gt; MUST be less than the value at the time the offer to purchase was made. This comparison is made using the &lt;code&gt;uint256&lt;&#x2F;code&gt; representation of the &lt;code&gt;bytes32&lt;&#x2F;code&gt; value.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;requireUintLte&lt;&#x2F;code&gt;: The &lt;code&gt;bytes32&lt;&#x2F;code&gt; &lt;code&gt;traitValue&lt;&#x2F;code&gt; MUST be less than or equal to the value at the time the offer to purchase was made. This comparison is made using the &lt;code&gt;uint256&lt;&#x2F;code&gt; representation of the &lt;code&gt;bytes32&lt;&#x2F;code&gt; value.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;requireUintGt&lt;&#x2F;code&gt;: The &lt;code&gt;bytes32&lt;&#x2F;code&gt; &lt;code&gt;traitValue&lt;&#x2F;code&gt; MUST be greater than the value at the time the offer to purchase was made. This comparison is made using the &lt;code&gt;uint256&lt;&#x2F;code&gt; representation of the &lt;code&gt;bytes32&lt;&#x2F;code&gt; value.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;requireUintGte&lt;&#x2F;code&gt;: The &lt;code&gt;bytes32&lt;&#x2F;code&gt; &lt;code&gt;traitValue&lt;&#x2F;code&gt; MUST be greater than or equal to the value at the time the offer to purchase was made. This comparison is made using the &lt;code&gt;uint256&lt;&#x2F;code&gt; representation of the &lt;code&gt;bytes32&lt;&#x2F;code&gt; value.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note that even though this specification requires marketplaces to validate the required trait values, buyers and sellers cannot fully rely on marketplaces to do this and must also take their own precautions to research the current trait values prior to initiating the transaction.&lt;&#x2F;p&gt;
&lt;p&gt;Here is an example of the specified schema:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;traits&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;color&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;displayName&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Color&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;dataType&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;points&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;displayName&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Total Score&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;dataType&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;decimal&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;signed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;decimals&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;validateOnSale&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;requireUintGte&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;displayName&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;dataType&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;minLength&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;maxLength&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;valueMappings&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Unnamed&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;0x92e75d5e42b80de937d204558acf69c8ea586a244fe88bc0181323fe3b9e3ebf&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🙂&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;tokenOwnerCanUpdateValue&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;birthday&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;displayName&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Birthday&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;dataType&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;epochSeconds&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;valueMappings&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; null&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;0x77c2fd45bd8bdef5b5bc773f46759bb8d169f3468caab64d7d5f2db16bb867a8&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;displayName&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;🚢 📅&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;dataType&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;epochSeconds&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;valueMappings&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1696702201&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;string-metadata-type&quot;&gt;&lt;code&gt;string&lt;&#x2F;code&gt; Metadata Type&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;string&lt;&#x2F;code&gt; metadata type allows for a string value to be set for a trait.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;dataType&lt;&#x2F;code&gt; object MAY have a &lt;code&gt;minLength&lt;&#x2F;code&gt; and &lt;code&gt;maxLength&lt;&#x2F;code&gt; value defined. If &lt;code&gt;minLength&lt;&#x2F;code&gt; is not specified, it is assumed to be 0. If &lt;code&gt;maxLength&lt;&#x2F;code&gt; is not specified, it is assumed to be a reasonable length.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;dataType&lt;&#x2F;code&gt; object MAY have a &lt;code&gt;valueMappings&lt;&#x2F;code&gt; object defined. If the &lt;code&gt;valueMappings&lt;&#x2F;code&gt; object is defined, the &lt;code&gt;valueMappings&lt;&#x2F;code&gt; object MUST be a mapping of &lt;code&gt;bytes32&lt;&#x2F;code&gt; values to &lt;code&gt;string&lt;&#x2F;code&gt; or unset &lt;code&gt;null&lt;&#x2F;code&gt; values. The &lt;code&gt;bytes32&lt;&#x2F;code&gt; values SHOULD be the &lt;code&gt;keccak256&lt;&#x2F;code&gt; hash of the &lt;code&gt;string&lt;&#x2F;code&gt; value. The &lt;code&gt;string&lt;&#x2F;code&gt; values MUST be unique. If the trait for a token is updated to &lt;code&gt;null&lt;&#x2F;code&gt;, it is expected that offchain indexers will delete the trait for the token.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;decimal-metadata-type&quot;&gt;&lt;code&gt;decimal&lt;&#x2F;code&gt; Metadata Type&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;decimal&lt;&#x2F;code&gt; metadata type allows for a numeric value to be set for a trait in decimal form.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;dataType&lt;&#x2F;code&gt; object MAY have a &lt;code&gt;signed&lt;&#x2F;code&gt; value defined. If &lt;code&gt;signed&lt;&#x2F;code&gt; is not specified, it is assumed to be &lt;code&gt;false&lt;&#x2F;code&gt;. This determines whether the &lt;code&gt;traitValue&lt;&#x2F;code&gt; returned is interpreted as a signed or unsigned integer.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;dataType&lt;&#x2F;code&gt; object MAY have &lt;code&gt;minValue&lt;&#x2F;code&gt; and &lt;code&gt;maxValue&lt;&#x2F;code&gt; values defined. These should be formatted with the decimals specified. If &lt;code&gt;minValue&lt;&#x2F;code&gt; is not specified, it is assumed to be the minimum value of &lt;code&gt;signed&lt;&#x2F;code&gt; and &lt;code&gt;decimals&lt;&#x2F;code&gt;. If &lt;code&gt;maxValue&lt;&#x2F;code&gt; is not specified, it is assumed to be the maximum value of the &lt;code&gt;signed&lt;&#x2F;code&gt; and &lt;code&gt;decimals&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;dataType&lt;&#x2F;code&gt; object MAY have a &lt;code&gt;decimals&lt;&#x2F;code&gt; value defined. The &lt;code&gt;decimals&lt;&#x2F;code&gt; value MUST be a non-negative integer. The &lt;code&gt;decimals&lt;&#x2F;code&gt; value determines the number of decimal places included in the &lt;code&gt;traitValue&lt;&#x2F;code&gt; returned onchain. If &lt;code&gt;decimals&lt;&#x2F;code&gt; is not specified, it is assumed to be 0.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;dataType&lt;&#x2F;code&gt; object MAY have a &lt;code&gt;valueMappings&lt;&#x2F;code&gt; object defined. If the &lt;code&gt;valueMappings&lt;&#x2F;code&gt; object is defined, the &lt;code&gt;valueMappings&lt;&#x2F;code&gt; object MUST be a mapping of &lt;code&gt;bytes32&lt;&#x2F;code&gt; values to numeric or unset &lt;code&gt;null&lt;&#x2F;code&gt; values.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;boolean-metadata-type&quot;&gt;&lt;code&gt;boolean&lt;&#x2F;code&gt; Metadata Type&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;boolean&lt;&#x2F;code&gt; metadata type allows for a boolean value to be set for a trait.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;dataType&lt;&#x2F;code&gt; object MAY have a &lt;code&gt;valueMappings&lt;&#x2F;code&gt; object defined. If the &lt;code&gt;valueMappings&lt;&#x2F;code&gt; object is defined, the &lt;code&gt;valueMappings&lt;&#x2F;code&gt; object MUST be a mapping of &lt;code&gt;bytes32&lt;&#x2F;code&gt; values to &lt;code&gt;boolean&lt;&#x2F;code&gt; or unset &lt;code&gt;null&lt;&#x2F;code&gt; values. The &lt;code&gt;boolean&lt;&#x2F;code&gt; values MUST be unique.&lt;&#x2F;p&gt;
&lt;p&gt;If &lt;code&gt;valueMappings&lt;&#x2F;code&gt; is not used, the default trait values for &lt;code&gt;boolean&lt;&#x2F;code&gt; should be &lt;code&gt;bytes32(0)&lt;&#x2F;code&gt; for &lt;code&gt;false&lt;&#x2F;code&gt; and &lt;code&gt;bytes32(uint256(1))&lt;&#x2F;code&gt; (&lt;code&gt;0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;code&gt;) for &lt;code&gt;true&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;epochseconds-metadata-type&quot;&gt;&lt;code&gt;epochSeconds&lt;&#x2F;code&gt; Metadata Type&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;epochSeconds&lt;&#x2F;code&gt; metadata type allows for a numeric value to be set for a trait in seconds since the Unix epoch.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;dataType&lt;&#x2F;code&gt; object MAY have a &lt;code&gt;valueMappings&lt;&#x2F;code&gt; object defined. If the &lt;code&gt;valueMappings&lt;&#x2F;code&gt; object is defined, the &lt;code&gt;valueMappings&lt;&#x2F;code&gt; object MUST be a mapping of &lt;code&gt;bytes32&lt;&#x2F;code&gt; values to integer or unset &lt;code&gt;null&lt;&#x2F;code&gt; values.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;events&quot;&gt;Events&lt;&#x2F;h3&gt;
&lt;p&gt;Updating traits MUST emit one of:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;TraitUpdated&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TraitUpdatedRange&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TraitUpdatedRangeUniformValue&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TraitUpdatedList&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TraitUpdatedListUniformValue&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;For the &lt;code&gt;Range&lt;&#x2F;code&gt; events, the &lt;code&gt;fromTokenId&lt;&#x2F;code&gt; and &lt;code&gt;toTokenId&lt;&#x2F;code&gt; MUST be a consecutive range of tokens IDs and MUST be treated as an inclusive range.&lt;&#x2F;p&gt;
&lt;p&gt;For the &lt;code&gt;List&lt;&#x2F;code&gt; events, the &lt;code&gt;tokenIds&lt;&#x2F;code&gt; MAY be in any order.&lt;&#x2F;p&gt;
&lt;p&gt;It is RECOMMENDED to use the &lt;code&gt;UniformValue&lt;&#x2F;code&gt; events when the trait value is uniform across all token ids, so offchain indexers can more quickly process bulk updates rather than fetching each trait value individually.&lt;&#x2F;p&gt;
&lt;p&gt;Updating the trait metadata MUST emit the event &lt;code&gt;TraitMetadataURIUpdated&lt;&#x2F;code&gt; so offchain indexers can be notified to query the contract for the latest changes via &lt;code&gt;getTraitMetadataURI()&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Note that dynamic trait values MUST NOT be based on time-dependent factors (e.g. block timestamp) or other implicit state changes. All trait changes MUST be the result of an explicit onchain action that emits a corresponding &lt;code&gt;TraitUpdated&lt;&#x2F;code&gt; event. This requirement ensures that offchain indexers can remain synchronized with the current trait values by processing emitted events, rather than needing to continuously poll or re-evaluate trait values.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;settrait&quot;&gt;&lt;code&gt;setTrait&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;If a trait defines &lt;code&gt;tokenOwnerCanUpdateValue&lt;&#x2F;code&gt; as &lt;code&gt;true&lt;&#x2F;code&gt;, then the trait value MUST be updatable by the token owner by calling &lt;code&gt;setTrait&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;If the value the token owner is attempting to set is not valid, the transaction MUST revert. If the value is valid, the trait value MUST be updated and one of the &lt;code&gt;TraitUpdated&lt;&#x2F;code&gt; events MUST be emitted.&lt;&#x2F;p&gt;
&lt;p&gt;If the trait has a &lt;code&gt;valueMappings&lt;&#x2F;code&gt; entry defined for the desired value being set, &lt;code&gt;setTrait&lt;&#x2F;code&gt; MUST be called with the corresponding &lt;code&gt;traitValue&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The design of this specification is primarily a key-value mapping for maximum flexibility. This interface for traits was chosen instead of relying on using regular &lt;code&gt;getFoo()&lt;&#x2F;code&gt; and &lt;code&gt;setFoo()&lt;&#x2F;code&gt; style functions to allow for brevity in defining, setting, and getting traits. Otherwise, contracts would need to know both the getter and setter function selectors including the parameters that go along with it. In defining general but explicit get and set functions, the function signatures are known and only the trait key and values are needed to query and set the values. Contracts can also add new traits in the future without needing to modify contract code.&lt;&#x2F;p&gt;
&lt;p&gt;The traits metadata allows for customizability of both display and behavior. The &lt;code&gt;valueMappings&lt;&#x2F;code&gt; property can define human-readable values to enhance the traits, for example, the default label of the &lt;code&gt;0&lt;&#x2F;code&gt; value (e.g. if the key was &quot;redeemed&quot;, &quot;0&quot; could be mapped to &quot;No&quot;, and &quot;1&quot; to &quot;Yes&quot;). The &lt;code&gt;validateOnSale&lt;&#x2F;code&gt; property lets the token creator define which traits should be protected on order creation and fulfillment, to protect end users against frontrunning.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;As a new EIP, no backwards compatibility issues are present, except for the point in the specification above that it is explicitly required that the onchain traits MUST override any conflicting values specified by the ERC-721 or ERC-1155 metadata URIs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Authors have included Foundry tests covering functionality of the specification in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7496&#x2F;.&#x2F;assets&#x2F;ERC721DynamicTraits.t.sol&quot;&gt;assets folder&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Authors have included reference implementations of the specification in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7496&#x2F;.&#x2F;assets&#x2F;DynamicTraits.sol&quot;&gt;assets folder&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The set* methods exposed externally MUST be permissioned so they are not callable by everyone but only by select roles or addresses.&lt;&#x2F;p&gt;
&lt;p&gt;Marketplaces SHOULD NOT trust offchain state of traits as they can be frontrunned. Marketplaces SHOULD check the current state of onchain traits at the time of transfer. Marketplaces MAY check certain traits that change the value of the NFT (e.g. redemption status, defined by metadata values with &lt;code&gt;validateOnSale&lt;&#x2F;code&gt; property) or they MAY hash all the trait values to guarantee the same state at the time of order creation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>NFT Redeemables</title>
        <published>2023-07-28T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Ryan Ghods</name><uri>https://github.com/ryanio</uri>
	</author>
	
	<author>
		<name>0age</name><uri>https://github.com/0age</uri>
	</author>
	
	<author>
		<name>Adam Montgomery</name><uri>https://github.com/montasaurus</uri>
	</author>
	
	<author>
		<name>Stephan Min</name><uri>https://github.com/stephankmin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7498/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7498-nft-redeemables/15485" />
        

        <id>https://wg-eips.ritovision.com/7498/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7498"
            label="ERC-7498" />
        

        
        

        
        <summary type="html">Extension to ERC-721 and ERC-1155 for onchain and offchain redeemables</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7498/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This specification introduces a new interface that extends &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; to enable the discovery and use of onchain and offchain redeemables for NFTs. Onchain getters and events facilitate discovery of redeemable campaigns and their requirements. New onchain mints use an interface that gives context to the minting contract of what was redeemed. For redeeming physical products and goods (offchain redeemables) a &lt;code&gt;redemptionHash&lt;&#x2F;code&gt; and &lt;code&gt;signer&lt;&#x2F;code&gt; can tie onchain redemptions with offchain order identifiers that contain chosen product and shipping information.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Creators frequently use NFTs to create redeemable entitlements for digital and physical goods. However, without a standard interface, it is challenging for users and apps to discover and interact with these NFTs in a predictable and standard way. This standard aims to encompass enabling broad functionality for:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;discovery: events and getters that provide information about the requirements of a redemption campaign&lt;&#x2F;li&gt;
&lt;li&gt;onchain: token mints with context of items spent&lt;&#x2F;li&gt;
&lt;li&gt;offchain: the ability to associate with ecommerce orders (through &lt;code&gt;redemptionHash&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;trait redemptions: improving the burn-to-redeem experience with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7496&#x2F;&quot;&gt;ERC-7496&lt;&#x2F;a&gt; Dynamic Traits.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;The token MUST have the following interface and MUST return &lt;code&gt;true&lt;&#x2F;code&gt; for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; supportsInterface for &lt;code&gt;0x1ac61e13&lt;&#x2F;code&gt;, the 4 byte interfaceId of the below.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7498&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Events &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CampaignUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; campaignId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;Campaign&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; campaign&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; metadataURI&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Redemption&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; campaignId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; requirementsIndex&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; redemptionHash&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; considerationTokenIds&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; traitRedemptionTokenIds&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; redeemedBy&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Structs &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Campaign&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    CampaignParams params&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    CampaignRequirements&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; requirements&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; one requirement must be fully satisfied for a successful redemption&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CampaignParams&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint32&lt;&#x2F;span&gt;&lt;span&gt; startTime&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint32&lt;&#x2F;span&gt;&lt;span&gt; endTime&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint32&lt;&#x2F;span&gt;&lt;span&gt; maxCampaignRedemptions&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; manager&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the address that can modify the campaign&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; signer&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; null address means no EIP-712 signature required&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CampaignRequirements&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    OfferItem&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; offer&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ConsiderationItem&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; consideration&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    TraitRedemption&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; traitRedemptions&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TraitRedemption&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint8&lt;&#x2F;span&gt;&lt;span&gt; substandard&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; token&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; traitKey&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; traitValue&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; substandardValue&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Getters &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getCampaign&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; campaignId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Campaign&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; campaign&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; metadataURI&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; totalRedemptions&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Setters &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; createCampaign&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Campaign&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; campaign&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; metadataURI&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; campaignId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; updateCampaign&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; campaignId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; Campaign&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; campaign&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; metadataURI&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; redeem&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; considerationTokenIds&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; extraData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Seaport structs, for reference, used in offer&#x2F;consideration above &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ItemType&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;    NATIVE&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;    ERC20&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;    ERC721&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;    ERC1155&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OfferItem&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ItemType itemType&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; token&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; identifierOrCriteria&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; startAmount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; endAmount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ConsiderationItem&lt;&#x2F;span&gt;&lt;span&gt; extends OfferItem &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: psuedocode above, as of this writing can&amp;#39;t extend structs in solidity)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SpentItem&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ItemType itemType&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; token&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; identifier&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;creating-campaigns&quot;&gt;Creating campaigns&lt;&#x2F;h3&gt;
&lt;p&gt;When creating a new campaign, &lt;code&gt;createCampaign&lt;&#x2F;code&gt; MUST be used and MUST return the newly created &lt;code&gt;campaignId&lt;&#x2F;code&gt; along with the &lt;code&gt;CampaignUpdated&lt;&#x2F;code&gt; event. The &lt;code&gt;campaignId&lt;&#x2F;code&gt; MUST be a counter incremented with each new campaign. The first campaign MUST have an id of &lt;code&gt;1&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;updating-campaigns&quot;&gt;Updating campaigns&lt;&#x2F;h3&gt;
&lt;p&gt;Updates to campaigns MAY use &lt;code&gt;updateCampaign&lt;&#x2F;code&gt; and MUST emit the &lt;code&gt;CampaignUpdated&lt;&#x2F;code&gt; event. If an address other than the &lt;code&gt;manager&lt;&#x2F;code&gt; tries to update the campaign, it MUST revert with &lt;code&gt;NotManager()&lt;&#x2F;code&gt;. If the manager wishes to make the campaign immutable, the &lt;code&gt;manager&lt;&#x2F;code&gt; MAY be set to the null address.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;offer&quot;&gt;Offer&lt;&#x2F;h3&gt;
&lt;p&gt;If tokens are set in the params &lt;code&gt;offer&lt;&#x2F;code&gt;, the tokens MUST implement the &lt;code&gt;IRedemptionMintable&lt;&#x2F;code&gt; interface in order to support minting new items. The implementation SHOULD be however the token mechanics are desired. The implementing token MUST return true for ERC-165 &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; for the interfaceId of &lt;code&gt;IRedemptionMintable&lt;&#x2F;code&gt;, &lt;code&gt;0x81fe13c2&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IRedemptionMintable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mintRedemption&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; campaignId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        OfferItem&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; offer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        ConsiderationItem&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; consideration&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        TraitRedemption&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; traitRedemptions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;When &lt;code&gt;mintRedemption&lt;&#x2F;code&gt; is called, it is RECOMMENDED to replace the token identifiers in the consideration items and trait redemptions with the items actually being redeemed.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;consideration&quot;&gt;Consideration&lt;&#x2F;h3&gt;
&lt;p&gt;Any token may be specified in the campaign requirement &lt;code&gt;consideration&lt;&#x2F;code&gt;. This will ensure the token is transferred to the &lt;code&gt;recipient&lt;&#x2F;code&gt;. If the token is meant to be burned, the recipient SHOULD be &lt;code&gt;0x000000000000000000000000000000000000dEaD&lt;&#x2F;code&gt;. If the token can internally handle burning its own tokens and reducing totalSupply, the token MAY burn the token instead of transferring to the recipient &lt;code&gt;0x000000000000000000000000000000000000dEaD&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;dynamic-traits&quot;&gt;Dynamic traits&lt;&#x2F;h3&gt;
&lt;p&gt;Including trait redemptions is optional, but if the token would like to enable trait redemptions the token MUST include &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7496&#x2F;&quot;&gt;ERC-7496&lt;&#x2F;a&gt; Dynamic Traits.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;signer&quot;&gt;Signer&lt;&#x2F;h3&gt;
&lt;p&gt;A signer MAY be specified to provide a signature to process the redemption. If the signer is not the null address, the signature MUST recover to the signer address via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;ERC-1271&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The EIP-712 struct for signing MUST be as follows: &lt;code&gt;SignedRedeem(address owner,uint256[] considerationTokenIds,uint256[] traitRedemptionTokenIds,uint256 campaignId,uint256 requirementsIndex, bytes32 redemptionHash, uint256 salt)&quot;&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;redeem-function&quot;&gt;Redeem function&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;redeem&lt;&#x2F;code&gt; function MUST use the &lt;code&gt;consideration&lt;&#x2F;code&gt;, &lt;code&gt;offer&lt;&#x2F;code&gt;, and &lt;code&gt;traitRedemptions&lt;&#x2F;code&gt; specified by the &lt;code&gt;requirements&lt;&#x2F;code&gt; determined by the &lt;code&gt;campaignId&lt;&#x2F;code&gt; and &lt;code&gt;requirementsIndex&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Execute the transfers in the &lt;code&gt;consideration&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Mutate the traits specified by &lt;code&gt;traitRedemptions&lt;&#x2F;code&gt; according to ERC-7496 Dynamic Traits&lt;&#x2F;li&gt;
&lt;li&gt;Call &lt;code&gt;mintRedemption()&lt;&#x2F;code&gt; on every &lt;code&gt;offer&lt;&#x2F;code&gt; item&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;code&gt;Redemption&lt;&#x2F;code&gt; event MUST be emitted for every valid redemption that occurs.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;redemption-extradata&quot;&gt;Redemption extraData&lt;&#x2F;h4&gt;
&lt;p&gt;The extraData layout MUST conform to the below:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;bytes&lt;&#x2F;th&gt;&lt;th&gt;value&lt;&#x2F;th&gt;&lt;th&gt;description &#x2F; notes&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;0-32&lt;&#x2F;td&gt;&lt;td&gt;campaignId&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;32-64&lt;&#x2F;td&gt;&lt;td&gt;requirementsIndex&lt;&#x2F;td&gt;&lt;td&gt;index of the campaign requirements met&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;64-96&lt;&#x2F;td&gt;&lt;td&gt;redemptionHash&lt;&#x2F;td&gt;&lt;td&gt;hash of offchain order ids&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;96-*&lt;&#x2F;td&gt;&lt;td&gt;uint256[] traitRedemptionTokenIds&lt;&#x2F;td&gt;&lt;td&gt;token ids for trait redemptions, MUST be in same order of campaign TraitRedemption[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;*-(+32)&lt;&#x2F;td&gt;&lt;td&gt;salt&lt;&#x2F;td&gt;&lt;td&gt;if signer != address(0)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;*-(+*)&lt;&#x2F;td&gt;&lt;td&gt;signature&lt;&#x2F;td&gt;&lt;td&gt;if signer != address(0). can be for EIP-712 or ERC-1271&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The &lt;code&gt;requirementsIndex&lt;&#x2F;code&gt; MUST be the index in the &lt;code&gt;requirements&lt;&#x2F;code&gt; array that satisfies the redemption. This helps reduce gas to find the requirement met.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;traitRedemptionTokenIds&lt;&#x2F;code&gt; specifies the token IDs required for the trait redemptions in the requirements array. The order MUST be the same order of the token addresses expected in the array of &lt;code&gt;TraitRedemption&lt;&#x2F;code&gt; structs in the campaign requirement used.&lt;&#x2F;p&gt;
&lt;p&gt;If the campaign &lt;code&gt;signer&lt;&#x2F;code&gt; is the null address the &lt;code&gt;salt&lt;&#x2F;code&gt; and &lt;code&gt;signature&lt;&#x2F;code&gt; MUST be omitted.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;redemptionHash&lt;&#x2F;code&gt; is designated for offchain redemptions to reference offchain order identifiers to track the redemption to.&lt;&#x2F;p&gt;
&lt;p&gt;The function MUST check that the campaign is active (using the same boundary check as Seaport, &lt;code&gt;startTime &amp;lt;= block.timestamp &amp;lt; endTime&lt;&#x2F;code&gt;). If it is not active, it MUST revert with &lt;code&gt;NotActive()&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;trait-redemptions&quot;&gt;Trait redemptions&lt;&#x2F;h3&gt;
&lt;p&gt;The token MUST respect the TraitRedemption substandards as follows:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;substandard ID&lt;&#x2F;th&gt;&lt;th&gt;description&lt;&#x2F;th&gt;&lt;th&gt;substandard value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;set value to &lt;code&gt;traitValue&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;prior required value. if blank, cannot be the &lt;code&gt;traitValue&lt;&#x2F;code&gt; already&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;increment trait by &lt;code&gt;traitValue&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;max value&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;decrement trait by &lt;code&gt;traitValue&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;min value&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;4&lt;&#x2F;td&gt;&lt;td&gt;check value is &lt;code&gt;traitValue&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;n&#x2F;a&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;max-campaign-redemptions&quot;&gt;Max campaign redemptions&lt;&#x2F;h3&gt;
&lt;p&gt;The token MUST check that the &lt;code&gt;maxCampaignRedemptions&lt;&#x2F;code&gt; is not exceeded. If the redemption does exceed &lt;code&gt;maxCampaignRedemptions&lt;&#x2F;code&gt;, it MUST revert with &lt;code&gt;MaxCampaignRedemptionsReached(uint256 total, uint256 max)&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;metadata-uri&quot;&gt;Metadata URI&lt;&#x2F;h3&gt;
&lt;p&gt;The metadata URI MUST conform to the below JSON schema:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;$schema&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;json-schema.org&#x2F;draft&#x2F;2020-12&#x2F;schema&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;campaigns&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;array&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;items&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;campaignId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A one-line summary of the redeemable. Markdown is not supported.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;details&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A multi-line or multi-paragraph description of the details of the redeemable. Markdown is supported.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;imageUrls&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;array&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;items&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A list of image URLs for the redeemable. The first image will be used as the thumbnail. Will rotate in a carousel if multiple images are provided. Maximum 5 images.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bannerUrl&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The banner image for the redeemable.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;faq&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;array&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;items&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;question&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;answer&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;required&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;question&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;answer&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;contentLocale&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The language tag for the content provided by this metadata. https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc9110.html#name-language-tags&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;maxRedemptionsPerToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The maximum number of redemptions per token. When isBurn is true should be 1, else can be a number based on the trait redemptions limit.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;isBurn&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;If the redemption burns the token.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uuid&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;An optional unique identifier for the campaign, for backends to identify when draft campaigns are published onchain.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;productLimitForRedemption&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The number of products which are able to be chosen from the products array for a single redemption.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;products&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;schema.org&#x2F;Product&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;required&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;url&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;required&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;campaignId&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;imageUrls&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;isBurn&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Future EIPs MAY inherit this one and add to the above metadata to add more features and functionality.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;erc-1155-semi-fungibles&quot;&gt;ERC-1155 (Semi-fungibles)&lt;&#x2F;h3&gt;
&lt;p&gt;This standard MAY be applied to ERC-1155 but the redemptions would apply to all token amounts for specific token identifiers. If the ERC-1155 contract only has tokens with amount of 1, then this specification MAY be used as written.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The &quot;offer&quot; and &quot;consideration&quot; structs from Seaport were used to create a similar language for redeemable campaigns. The &quot;offer&quot; is what is being offered, e.g. a new onchain token, and the &quot;consideration&quot; is what must be satisfied to complete the redemption. The &quot;consideration&quot; field has a &quot;recipient&quot;, who the token should be transferred to. For trait updates that do not require moving of a token, &lt;code&gt;traitRedemptionTokenIds&lt;&#x2F;code&gt; is specified instead.&lt;&#x2F;p&gt;
&lt;p&gt;The &quot;salt&quot; and &quot;signature&quot; fields are provided primarily for offchain redemptions where a provider would want to sign approval for a redemption before it is conducted onchain, to prevent the need for irregular state changes. For example, if a user lives outside a region supported by the shipping of an offchain redeemable, during the offchain order creation process the signature would not be provided for the onchain redemption when seeing that the user&#x27;s shipping country is unsupported. This prevents the user from redeeming the NFT, then later finding out the shipping isn&#x27;t supported after their NFT is already burned or trait is mutated.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7496&#x2F;&quot;&gt;ERC-7496&lt;&#x2F;a&gt; Dynamic Traits is used for trait redemptions to support onchain enforcement of trait values for secondary market orders.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;As a new EIP, no backwards compatibility issues are present.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Authors have included Foundry tests covering functionality of the specification in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7498&#x2F;.&#x2F;assets&#x2F;ERC721ShipyardRedeemable.t.sol&quot;&gt;assets folder&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Authors have included reference implementations of the specification in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7498&#x2F;.&#x2F;assets&#x2F;ERC7498NFTRedeemables.sol&quot;&gt;assets folder&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;If trait redemptions are desired, tokens implementing this EIP must properly implement &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7496&#x2F;&quot;&gt;ERC-7496&lt;&#x2F;a&gt; Dynamic Traits.&lt;&#x2F;p&gt;
&lt;p&gt;For tokens to be minted as part of the params &lt;code&gt;offer&lt;&#x2F;code&gt;, the &lt;code&gt;mintRedemption&lt;&#x2F;code&gt; function contained as part of &lt;code&gt;IRedemptionMintable&lt;&#x2F;code&gt; MUST be permissioned and ONLY allowed to be called by specified addresses.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Token Converter</title>
        <published>2023-07-27T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Dexaran</name><uri>https://github.com/Dexaran</uri><email>dexaran@ethereumclassic.org</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7417/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/token-standard-converter/15252" />
        

        <id>https://wg-eips.ritovision.com/7417/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7417"
            label="ERC-7417" />
        

        
        

        
        <summary type="html">Smart-contract service that converts token of one ERC version to another</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7417/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;There are multiple token standards on Ethereum chain currently. This EIP introduces a concept of cross-standard interoperability by creating a service that allows &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens to be upgraded to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; tokens anytime. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; tokens can be converted back to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; version without any restrictions to avoid any problems with backwards compatibility and allow different standards to co-exist and become interoperable and interchangeable.&lt;&#x2F;p&gt;
&lt;p&gt;In order to perform the conversion, a user must deposit tokens of one standard to the Converter contract and it will automatically send tokens of another standard back.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal introduces a concept of a token standard upgrading procedure driven by a specialized smart-contract which can convert tokens of one standard to another at any time.&lt;&#x2F;p&gt;
&lt;p&gt;Currently some tokens are available on different chains in different standards, for example most exchanges support &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; USDT, TRX USDT, BEP-20 USDT and all this tokens are in fact the same USDT token. This proposal is intended to introduce a concept where there can be a &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; USDT and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; USDT available on Ethereum mainnet at the same time and these would be freely interchangeable.&lt;&#x2F;p&gt;
&lt;p&gt;The address of the deployed Token Converter must be described here as to solve the trust issues for the token developers and help them figure out a proper way of interacting with the Converter.&lt;&#x2F;p&gt;
&lt;p&gt;As Ethereum already has an established ecosystem of tokens and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; is the most adopted standard at the moment the lack of defined migration processes can be a bottleneck for newer standards adoption. This proposal addresses the problem of coordinating the upgrading process and addresses the backwards compatibility problems for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; tokens.&lt;&#x2F;p&gt;
&lt;p&gt;The Token Converter is supposed to allow anyone to create an alternative version of an existing token implemented in a different standard. This proposal focuses on &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; standards and takes into account the specifics of this particular token standards. It is assumed that the most common case would be creation of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; version for an existing &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; token.&lt;&#x2F;p&gt;
&lt;p&gt;The implementation of this service is an alternative to convincing each token developer to choose an alternative standard at the moment of the token deployment or during the development stage of their project. With this service there will be no need to choose one standard and stick with it as every token can be available in both concurrently.&lt;&#x2F;p&gt;
&lt;p&gt;The implementation of this Token Converter service is supposed to be a contract deployed on Ethereum mainnet once and forever. It&#x27;s address will be provided in the text of this proposal as to avoid any potential trust issues and assure the developers that the service they are interacting with is exactly the one which drives the conversion process of existing tokens.&lt;&#x2F;p&gt;
&lt;p&gt;All the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; tokens created by the Token Converter will be identical in a way that they all implement the same functions, which return the same values and there is no ambiguity there. This helps to avoid problems where a token deployed during the early stage of a token standard adoption may implement it improperly or there can be an ambiguity in the standard itself that would allow developers to implement tokens of one standard in different ways.&lt;&#x2F;p&gt;
&lt;p&gt;For example it was a common case with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; where developers could implement custom logic of the &lt;code&gt;transfer&lt;&#x2F;code&gt; function and mess the return values. The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; specification declares that a &lt;code&gt;transfer&lt;&#x2F;code&gt; function MUST return a &lt;code&gt;bool&lt;&#x2F;code&gt; value, however in practice we have three different types of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens which are not compatible with each other:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens that return &lt;code&gt;true&lt;&#x2F;code&gt; on success and revert on an error.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens that return &lt;code&gt;true&lt;&#x2F;code&gt; on success and &lt;code&gt;false&lt;&#x2F;code&gt; on an error without reverting the transaction.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens that don&#x27;t have return values and revert on an error.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Technically the third category of tokens is not compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; standard. However, USDT token deployed on Ethereum mainnet at &lt;code&gt;0xdac17f958d2ee523a2206206994597c13d831ec7&lt;&#x2F;code&gt; address does not implement return values and it is one of the most used tokens and it is not an option to deny supporting USDT due to it&#x27;s improper implementation of the standard.&lt;&#x2F;p&gt;
&lt;p&gt;The Token Converter eliminates the issue where different development teams may implement the standard with slight modifications and result in a situation where we would have different versions of the same standard on the mainnet.&lt;&#x2F;p&gt;
&lt;p&gt;At the same time the Converter enables the concurrent token support in other smart-contracts, such as decentralized exchanges. The Converter can guarantee that a pair of two tokens one of which is a wrapper for another is in fact the same token that can be converted from one standard to another at any time. This enables the creation of liquidity pools where two different tokens are dealt with as if they were one token.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;The Token Converter system comprises two main components:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Converter contract.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Wrapper contracts. Each original token can have exactly one wrapper of each standard.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Converter contract can deploy new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; wrapper contracts for any &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; token that does not have a &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; wrapper currently. There MUST be exactly one &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; wrapper for each &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; token.&lt;&#x2F;p&gt;
&lt;p&gt;Converter contract MUST accept deposits of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens and send &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; tokens to the depositor at 1:1 ratio. Upon depositing 1234 units of &lt;code&gt;ERC20 token_A&lt;&#x2F;code&gt; the depositor MUST receive exactly 1234 units of &lt;code&gt;ERC223 token_A&lt;&#x2F;code&gt;. This is done by issuing new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; tokens at the moment of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; deposit. The original &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens MUST be frozen in the Converter contract and available for claiming back.&lt;&#x2F;p&gt;
&lt;p&gt;Converter contract MUST accept deposits of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; tokens and send &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens to the depositor at 1:1 ratio. This is done by releasing the original &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens at the moment of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; deposit. The deposited &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; tokens must be burned.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;token-converter&quot;&gt;Token Converter&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;conver-contract-methods&quot;&gt;Conver contract methods&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;geterc20wrapperfor&quot;&gt;&lt;code&gt;getERC20WrapperFor&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getERC20WrapperFor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Returns the address of the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; wrapper for a given token address. Returns &lt;code&gt;0x0&lt;&#x2F;code&gt; if there is no &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; version for the provided token address. There can be exactly one wrapper for any given &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; token address created by the Token Converter contract.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;geterc223wrapperfor&quot;&gt;&lt;code&gt;getERC223WrapperFor&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getERC223WrapperFor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Returns the address of the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; wrapper for a given token address. Returns &lt;code&gt;0x0&lt;&#x2F;code&gt; if there is no &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; version for the provided token address. There can be exactly one &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; wrapper for any given &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; token address created by the Token Converter contract.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;geterc20originfor&quot;&gt;&lt;code&gt;getERC20OriginFor&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getERC20OriginFor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _erc223Token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Returns the address of the original &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; token for the provided &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; wrapper. Returns &lt;code&gt;0x0&lt;&#x2F;code&gt; if the provided &lt;code&gt;_erc223Token&lt;&#x2F;code&gt; is not an address of any &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; wrapper created by the Token Converter contract.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;geterc223originfor&quot;&gt;&lt;code&gt;getERC223OriginFor&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getERC223OriginFor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _erc20Token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Returns the address of the original &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; token for the provided &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; wrapper. Returns &lt;code&gt;0x0&lt;&#x2F;code&gt; if the provided &lt;code&gt;_erc20Token&lt;&#x2F;code&gt; is not an address of any wrapper created by the Token Converter contract.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;predictwrapperaddress&quot;&gt;&lt;code&gt;predictWrapperAddress&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; predictWrapperAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                                   bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;    _isERC20&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Is the provided _token a ERC-20 or not?&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;                                                    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If it is set as ERC-20 then we will predict the address of a &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;                                                    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-223 wrapper for that token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;                                                    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Otherwise we will predict ERC-20 wrapper address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Wrapper contracts are deployed via &lt;code&gt;CREATE2&lt;&#x2F;code&gt; opcode and it is possible to predict the address of a wrapper which is not yet deployed. The address of a wrapper contract depends on the bytecode therefore it is necessary to specify if the address of wrapper &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; or wrapper &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; must be predicted.&lt;&#x2F;p&gt;
&lt;p&gt;Providing &lt;code&gt;_token&lt;&#x2F;code&gt; address and &lt;code&gt;_isERC20 = false&lt;&#x2F;code&gt; will result in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; wrapper address being predicted.&lt;&#x2F;p&gt;
&lt;p&gt;Providing &lt;code&gt;_token&lt;&#x2F;code&gt; address and &lt;code&gt;_isERC20 = true&lt;&#x2F;code&gt; will result in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; wrapper address being predicted.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;createerc223wrapper&quot;&gt;&lt;code&gt;createERC223Wrapper&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; createERC223Wrapper&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _erc20Token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Creates a new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; wrapper for a given &lt;code&gt;_erc20Token&lt;&#x2F;code&gt; if it does not exist yet. Reverts the transaction if the wrapper already exist. Returns the address of the new wrapper token contract on success.  Reverts if &lt;code&gt;_erc223Token&lt;&#x2F;code&gt; is a wrapper created by the Converter.&lt;&#x2F;p&gt;
&lt;p&gt;The deployed contract will be a standard &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; token with &lt;code&gt;approve&lt;&#x2F;code&gt; and &lt;code&gt;transferFrom&lt;&#x2F;code&gt; functions implemented for backwards compatibility.&lt;&#x2F;p&gt;
&lt;p&gt;All &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; wrappers deployed by the Converter will have &lt;code&gt;standard() pure returns (bytes32)&lt;&#x2F;code&gt; function implemented which returns &lt;code&gt;223&lt;&#x2F;code&gt;. This serves further token standard introspection as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; may not be reliable when dealing with identifying the internal logic implemented within &lt;code&gt;transfer&lt;&#x2F;code&gt; function of a token.&lt;&#x2F;p&gt;
&lt;p&gt;NOTE: This function does not verify the standard of &lt;code&gt;_erc20Token&lt;&#x2F;code&gt; because there is no reliable method of introspection available which could guarantee that the provided token implements a particular standard. As the result it is possible to create a &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; wrapper for an original &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; token.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;createerc20wrapper&quot;&gt;&lt;code&gt;createERC20Wrapper&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; createERC20Wrapper&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _erc223Token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Creates a new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; wrapper for a given &lt;code&gt;_erc223Token&lt;&#x2F;code&gt; if it does not exist yet. Reverts the transaction if the wrapper already exist. Returns the address of the new wrapper token contract on success. Reverts if &lt;code&gt;_erc223Token&lt;&#x2F;code&gt; is a wrapper created by the Converter.&lt;&#x2F;p&gt;
&lt;p&gt;NOTE: This function does not verify the standard of &lt;code&gt;_erc223Token&lt;&#x2F;code&gt; because there is no reliable method of introspection available which could guarantee that the provided token implements a particular standard. As the result it is possible to create a &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; wrapper for an original &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; token.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;wraperc20toerc223&quot;&gt;&lt;code&gt;wrapERC20toERC223&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; wrapERC20toERC223&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _ERC20token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Withdraws &lt;code&gt;_amount&lt;&#x2F;code&gt; of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens from the transaction sender with &lt;code&gt;transferFrom&lt;&#x2F;code&gt; function. Delivers the &lt;code&gt;_amount&lt;&#x2F;code&gt; of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; wrapper tokens to the sender of the transaction. Stores the original tokens at the balance of the Token Converter contract for future claims. Returns &lt;code&gt;true&lt;&#x2F;code&gt; on success. The Token Converter must keep record of the amount of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens that were deposited with &lt;code&gt;wrapERC20toERC223&lt;&#x2F;code&gt; function because it is possible to deposit &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens to any contract by directly sending them with &lt;code&gt;transfer&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;p&gt;If there is no &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; wrapper for the &lt;code&gt;_ERC20token&lt;&#x2F;code&gt; then creates it by calling a &lt;code&gt;createERC223Wrapper(_erc20toke)&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;p&gt;There is no special function to unwrap &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; wrappers to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; origin as this logic is implemented in the &lt;code&gt;tokenReceived&lt;&#x2F;code&gt; function of the Converter.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;unwraperc20toerc223&quot;&gt;&lt;code&gt;unwrapERC20toERC223&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; unwrapERC20toERC223&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _ERC20token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Withdraws &lt;code&gt;_amount&lt;&#x2F;code&gt; of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens from the transaction sender with &lt;code&gt;transferFrom&lt;&#x2F;code&gt; function. Delivers the &lt;code&gt;_amount&lt;&#x2F;code&gt; of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; wrapper tokens to the sender of the transaction. Stores the original tokens at the balance of the Token Converter contract for future claims. Returns &lt;code&gt;true&lt;&#x2F;code&gt; on success. The Token Converter must keep record of the amount of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens that were deposited with &lt;code&gt;wrapERC20toERC223&lt;&#x2F;code&gt; function because it is possible to deposit &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens to any contract by directly sending them with &lt;code&gt;transfer&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;p&gt;If there is no &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; wrapper for the &lt;code&gt;_ERC20token&lt;&#x2F;code&gt; then creates it by calling a &lt;code&gt;createERC223Wrapper(_erc20toke)&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;converterc20&quot;&gt;&lt;code&gt;convertERC20&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; convertERC20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Automatically determines if the provided &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; token is a wrapper or not. If it is a wrapper then executes &lt;code&gt;unwrapERC20toERC223&lt;&#x2F;code&gt; function. If the provided token is an origin then executes &lt;code&gt;wrapERC20toERC223&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;p&gt;This function is implemented to significantly simplify the workflow of services that integrate both versions of one token in the same contract and need to automatically convert tokens through the Converter.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;iswrapper&quot;&gt;&lt;code&gt;isWrapper&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isWrapper&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Returns &lt;code&gt;true&lt;&#x2F;code&gt; if the provided &lt;code&gt;_token&lt;&#x2F;code&gt; address is an address of a wrapper created by the Converter.&lt;&#x2F;p&gt;
&lt;p&gt;NOTE: This function does not identify the standard of a &lt;code&gt;_token&lt;&#x2F;code&gt;. There can be exactly one origin for any wrapper created by the Converter. However an original token can have two wrappers, one of each standard.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;tokenreceived&quot;&gt;&lt;code&gt;tokenReceived&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenReceived&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This is a standard &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; transaction handler function and it is called by the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; token contract when &lt;code&gt;_from&lt;&#x2F;code&gt; is sending &lt;code&gt;_value&lt;&#x2F;code&gt; of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; tokens to &lt;code&gt;address(this)&lt;&#x2F;code&gt; address. In the scope of this function &lt;code&gt;msg.sender&lt;&#x2F;code&gt; is the address of the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; token contract and &lt;code&gt;_from&lt;&#x2F;code&gt; is the sender of the token transfer.&lt;&#x2F;p&gt;
&lt;p&gt;Automatically determines&lt;&#x2F;p&gt;
&lt;p&gt;If &lt;code&gt;msg.sender&lt;&#x2F;code&gt; is an address of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; wrapper created by the Token Converter then &lt;code&gt;_value&lt;&#x2F;code&gt; of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; original token must be sent to the &lt;code&gt;_from&lt;&#x2F;code&gt; address.&lt;&#x2F;p&gt;
&lt;p&gt;If &lt;code&gt;msg.sender&lt;&#x2F;code&gt; is not an address of any &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; wrapper known to the Token Converter then it is considered a &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; origin and &lt;code&gt;_value&lt;&#x2F;code&gt; amount of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; wrapper tokens must be sent to the &lt;code&gt;_from&lt;&#x2F;code&gt; address. If the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; wrapper for the &lt;code&gt;msg.sender&lt;&#x2F;code&gt; token does not exist then create it first.&lt;&#x2F;p&gt;
&lt;p&gt;Returns &lt;code&gt;0x8943ec02&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;extractstuckerc20&quot;&gt;&lt;code&gt;extractStuckERC20&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; extractStuckERC20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This function allows to extract the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens that were directly deposited to the contract with &lt;code&gt;transfer&lt;&#x2F;code&gt; function to prevent users who may send tokens by mistake from permanently losing their tokens. Since the Token Converter calculates the amount of tokens that were deposited legitimately with &lt;code&gt;convertERC20toERC223&lt;&#x2F;code&gt; function it is always possible to calculate the amount of &quot;accidentally deposited tokens&quot; by subtracting the recorded amount from the returned value of the &lt;code&gt;balanceOf( address(this) )&lt;&#x2F;code&gt; function called on the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; token contract.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;converting-erc-20-tokens-to-erc-223&quot;&gt;Converting &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;In order to convert &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; the token holder should:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Call the &lt;code&gt;approve&lt;&#x2F;code&gt; function of the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; token and allow Token Converter to withdraw tokens from the token holders address via &lt;code&gt;transferFrom&lt;&#x2F;code&gt; function.&lt;&#x2F;li&gt;
&lt;li&gt;Wait for the transaction with &lt;code&gt;approve&lt;&#x2F;code&gt; to be submitted to the blockchain.&lt;&#x2F;li&gt;
&lt;li&gt;Call the &lt;code&gt;convertERC20toERC223&lt;&#x2F;code&gt; function of the Token Converter contract.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;converting-erc-223-wrapper-tokens-back-to-erc-20&quot;&gt;Converting &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; wrapper tokens back to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;In order to convert &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; the token holder should:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Send &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; tokens to the address of the Token Converter contract via &lt;code&gt;transfer&lt;&#x2F;code&gt; function of the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; token contract.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;support-of-erc-223-original-tokens&quot;&gt;Support of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; original tokens&lt;&#x2F;h3&gt;
&lt;p&gt;Two methods of implementing a Token Converter service were considered: (1) a converter that can only create &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; versions of the existing &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens, and (2) a converter that can create both versions (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt;) of any original token.&lt;&#x2F;p&gt;
&lt;p&gt;The first approach would encourage developers to always deploy an original token as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; and then create it&#x27;s &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; version in the converter. If it would happen that some developers may consider &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; as their original standard then they would be left with the problem of creating their custom &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; version of the token. In addition, if any third party contracts like liquidity pools are using the proposed Token Converter to ensure that a token can be listed on a DEX with two versions and both can be combined within one pool - then such contract would not be able to recognize any original &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; token and it&#x27;s &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; version as a valid pair of contracts that represent one token available in two standards.&lt;&#x2F;p&gt;
&lt;p&gt;For that reason it was decided to go with the second approach where the Converter can create &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; wrappers for original &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; tokens.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;support-of-approve-transferfrom-functions-in-the-erc-223-wrapper-tokens&quot;&gt;Support of &lt;code&gt;approve&lt;&#x2F;code&gt; &amp;amp; &lt;code&gt;transferFrom&lt;&#x2F;code&gt; functions in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; wrapper tokens&lt;&#x2F;h3&gt;
&lt;p&gt;This functions are superfluous for a &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; token since the &lt;code&gt;transfer&lt;&#x2F;code&gt; function can be used to deposit tokens of this standard to contracts. The current ecosystem is built for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens however and there are plenty of multisig contracts that rely on accepting tokens deposited without any callback with an assumption that it is not necessary for a multisig to count the amount of tokens it stores.&lt;&#x2F;p&gt;
&lt;p&gt;There can be any other contracts and scenarios where it would be necessary to deposit a token to a contract which is relying on an assumption that tokens are deposited without invoking a callback in the recipient. As the result we can expect that any original deployed &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; tokens will support this functions, as token developers strive for backward compatibility with the existing ecosystem. In order to make tokens deployed by the converter a reference implementation for developers that can be used without any modifications it was decided to support this functions in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; wrapper contracts.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;transferFrom&lt;&#x2F;code&gt; function does not support error handling and this needs to be taken into account. It is possible to deposit tokens to a contract which is not designed to receive them by approving X tokens to your own address and then calling a &lt;code&gt;transferFrom(self, contract, X)&lt;&#x2F;code&gt;. The tokens will be deposited regardless of whether the recipient contract is designed to hold&#x2F;receive tokens or not. The tokens may get permanently stuck if the recipient contract did not implement the extraction functions. The &lt;code&gt;approve&lt;&#x2F;code&gt; &amp;amp; &lt;code&gt;transferFrom&lt;&#x2F;code&gt; function is not the default method of token transferring however and it is not directly used by any wallets and any other software that manages tokens. The &lt;code&gt;transfer&lt;&#x2F;code&gt; function (which is safe) is used instead. The &lt;code&gt;transferFrom&lt;&#x2F;code&gt; function is supposed to be invoked by a contract to pull tokens from the approver.&lt;&#x2F;p&gt;
&lt;p&gt;As the result, the &lt;code&gt;approve&lt;&#x2F;code&gt; &amp;amp; &lt;code&gt;transferFrom&lt;&#x2F;code&gt; transferring method must be avoided with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; tokens whenever possible.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;modified-transfer-events-of-the-erc-223-token&quot;&gt;Modified transfer events of the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; token&lt;&#x2F;h3&gt;
&lt;p&gt;The pure &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; token implementation has the following event emitted on a token transfer: &lt;code&gt;event Transfer(address indexed _from, address indexed _to, uint256 _value, bytes _data)&lt;&#x2F;code&gt;. This events are different from ones emitted by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens and may not be properly recognized by existing blockchain explorers, wallets and other services that browse token transfers history.&lt;&#x2F;p&gt;
&lt;p&gt;It was considered that events are not an important part of the standard as these do not affect the logic of the token, it&#x27;s workflow and it&#x27;s security. When developing the Converter it was decided to prioritize compatibility with existing ecosystem.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;standard-function-usage-for-the-introspection&quot;&gt;&lt;code&gt;standard()&lt;&#x2F;code&gt; function usage for the introspection&lt;&#x2F;h3&gt;
&lt;p&gt;The main existing method of introspection is currently &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; which inspects the signatures of functions implemented in a contract. It is not possible to differentiate an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; token from an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; token by just browsing functions that they implement without digging their internal logic.&lt;&#x2F;p&gt;
&lt;p&gt;Here is a token and it is not possible to identify if it should be dealt with as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; because it depends on the actual implemenation of it&#x27;s &lt;code&gt;transfer&lt;&#x2F;code&gt; function logic.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;abstract&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Token&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; symbol&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; decimals&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In case of this implementation the token will behave as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_to&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In case of this implementation the token will behave as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_to&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            IERC223Recipient&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;tokenReceived&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;000000&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Also, there are plenty of tokens that do not implement &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; introspection at all. As the result it was decided to implement a special &lt;code&gt;standard() returns (uint32)&lt;&#x2F;code&gt; function in all &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; wrappers created by the Converter and assume that original &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; tokens may explicityly declare themselves as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; by implementing the same function too. It is assumed that if a token does not implement this function then it is &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This method of token standard introspection is more precise than &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal is supposed to eliminate the backwards compatibility concerns for different token standards making them interchangeable and interoperable.&lt;&#x2F;p&gt;
&lt;p&gt;This service is the first of its kind and therefore does not have any backwards compatibility issues as it does not have any predecessors.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; =0.8.19&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;library&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Address&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This method relies on extcodesize, which returns 0 for contracts in&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; construction, since the code is only stored at the end of the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; constructor execution.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; size&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; solhint-disable&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;-next-line no-inline-assembly&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt; size &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; extcodesize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; size &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC20&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; allowance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Approval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC20Metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC20&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; name of the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; symbol of the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; symbol&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; number of decimal places the token has&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; decimals&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;abstract&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC223Recipient&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenReceived&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x8943ec02&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;abstract&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC165&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * bytes4(keccak256(&amp;#39;supportsInterface(bytes4)&amp;#39;)) == 0x01ffc9a7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; _INTERFACE_ID_ERC165 &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x01ffc9a7&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _supportedInterfaces&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Derived contracts need only register support for their own interfaces,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; we register support for ERC165 itself here&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _registerInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_INTERFACE_ID_ERC165&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _supportedInterfaces&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;interfaceId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _registerInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xffffffff&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC165: invalid interface id&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _supportedInterfaces&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;interfaceId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;abstract&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC223&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; symbol&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; decimals&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; who&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; standardERC20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Approval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; allowance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Interface of the ERC20 standard.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC223WrapperToken&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;     external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; symbol&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; decimals&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; standard&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; origin&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;                                            external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;                               external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;                      external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; allowance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;                external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;                  external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _recipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _quantity&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; burn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _recipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _quantity&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC20WrapperToken&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;     external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; symbol&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; decimals&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; standard&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; origin&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;                                         external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;                            external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;                   external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; allowance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;             external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;               external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _recipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _quantity&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; burn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _recipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _quantity&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC20Rescue&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC20 tokens can get stuck on a contracts balance due to lack of error handling.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The author of the ERC7417 can extract ERC20 tokens if they are mistakenly sent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; to the wrapper-contracts balance.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Contact dexaran@ethereumclassic.org&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; extractor &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x01000B5fE61411C466b70631d7fF070187179Bbf&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; bytes4(keccak256(bytes(&amp;#39;transfer(address,uint256)&amp;#39;)));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt; success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; token&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodeWithSelector&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xa9059cbb&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;success &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;decode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;#39;TransferHelper: TRANSFER_FAILED&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; rescueERC20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        safeTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; extractor&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC223WrapperToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC223&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC165&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC20Rescue&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; creator &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; wrapper_for&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; account &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; spender &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; allowances&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransferData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Approval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; set&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _wrapper_for&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; creator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        wrapper_for &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _wrapper_for&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _totalSupply&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; balances&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; List of user balances.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;             {&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span&gt; _totalSupply&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span&gt; balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_owner&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ERC165 introspection function.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;IERC20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;standardERC20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;IERC223WrapperToken&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;IERC223&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Standard ERC223 transfer function.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      Calls _to if it is a contract. Does not transfer tokens to contracts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      which do not explicitly declare the tokenReceived function.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    - transfer recipient. Can be contract or EOA.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - the quantity of tokens to transfer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  - metadata to send alongside the transaction. Can be used to encode subsequent calls in the recipient.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_to&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_to&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;value &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt; sent&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;call&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sent&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;Address&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            IERC223Recipient&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;tokenReceived&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Old ERC20 compatible event. Added for backwards compatibility reasons.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Standard ERC223 transfer function without _data parameter. It is supported for &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      backwards compatibility with ERC20 services.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      Calls _to if it is a contract. Does not transfer tokens to contracts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      which do not explicitly declare the tokenReceived function.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    - transfer recipient. Can be contract or EOA.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - the quantity of tokens to transfer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; _empty &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;00000000&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_to&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_to&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;Address&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            IERC223Recipient&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;tokenReceived&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _empty&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _empty&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Old ERC20 compatible event. Added for backwards compatibility reasons.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;   {&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC20Metadata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;wrapper_for&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;name&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; symbol&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;concat&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC20Metadata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;wrapper_for&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;symbol&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;223&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; decimals&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;       {&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC20Metadata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;wrapper_for&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;decimals&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; standard&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;               {&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 223&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; origin&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;                {&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span&gt; wrapper_for&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Minting function which will only be called by the converter contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _recipient&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - the address which will receive tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _quantity&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  - the number of tokens to create.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _recipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _quantity&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; creator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Wrapper Token: Only the creator contract can mint wrapper tokens.&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_recipient&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _quantity&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _totalSupply &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _quantity&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Burning function which will only be called by the converter contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _quantity&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  - the number of tokens to destroy. TokenConverter can only destroy tokens on it&amp;#39;s own address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *                     Only the token converter is allowed to burn wrapper-tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; burn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _quantity&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; creator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Wrapper Token: Only the creator contract can destroy wrapper tokens.&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _quantity&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _totalSupply &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _quantity&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC20 functions for backwards compatibility.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; allowance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; allowances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;spender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_spender &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC223: Spender error.&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        allowances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_spender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Approval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;allowances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_from&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC223: Insufficient allowance.&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_from&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        allowances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_from&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_to&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC20WrapperToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC20&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC165&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC20Rescue&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; creator &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; wrapper_for&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; account &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; spender &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; allowances&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; set&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _wrapper_for&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; creator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        wrapper_for &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _wrapper_for&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _totalSupply&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; balances&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; List of user balances.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span&gt; balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_owner&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;  returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC20Metadata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;wrapper_for&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;name&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; symbol&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;  returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;concat&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC223&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;wrapper_for&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;symbol&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;20&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; decimals&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;  returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;         {&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC20Metadata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;wrapper_for&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;decimals&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;       {&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span&gt; _totalSupply&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; origin&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;                {&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span&gt; wrapper_for&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;IERC20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;IERC20WrapperToken&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_to&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_to&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _recipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _quantity&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; creator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Wrapper Token: Only the creator contract can mint wrapper tokens.&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_recipient&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _quantity&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _totalSupply &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _quantity&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; burn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _quantity&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; creator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Wrapper Token: Only the creator contract can destroy wrapper tokens.&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_from&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _quantity&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _totalSupply    &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _quantity&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; allowance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; allowances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;spender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Safety checks.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_spender &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC20: Spender error.&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        allowances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_spender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Approval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;allowances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_from&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC20: Insufficient allowance.&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_from&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        allowances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_from&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_to&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TokenStandardConverter&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC223Recipient&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC223WrapperCreated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _token&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _ERC223Wrapper&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC20WrapperCreated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _token&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _ERC20Wrapper&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; ERC223WrapperToken&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; erc223Wrappers&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A list of token wrappers. First one is ERC20 origin, second one is ERC223 version.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; ERC20WrapperToken&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  public&lt;&#x2F;span&gt;&lt;span&gt; erc20Wrappers&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            public&lt;&#x2F;span&gt;&lt;span&gt; erc223Origins&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            public&lt;&#x2F;span&gt;&lt;span&gt; erc20Origins&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            public&lt;&#x2F;span&gt;&lt;span&gt; erc20Supply&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Token =&amp;gt; how much was deposited.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getERC20WrapperFor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;erc20Wrappers&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_token&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getERC223WrapperFor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;erc223Wrappers&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_token&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getERC20OriginFor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;erc20Origins&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_token&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getERC223OriginFor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;erc223Origins&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_token&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; predictWrapperAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                                   bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;    _isERC20&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Is the provided _token a ERC20 or not?&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;                                                    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If it is set as ERC20 then we will predict the address of a &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;                                                    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC223 wrapper for that token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;                                                    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Otherwise we will predict ERC20 wrapper address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; _bytecode&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_isERC20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            _bytecode &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ERC223WrapperToken&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;creationCode&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        else&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            _bytecode &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ERC20WrapperToken&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;creationCode&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; hash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                bytes1&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xff&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_bytecode&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint160&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;hash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenReceived&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; _data &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;erc223Origins&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Error: creating wrapper for a wrapper token.&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; There are two possible cases:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 1. A user deposited ERC223 origin token to convert it to ERC20 wrapper&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 2. A user deposited ERC223 wrapper token to unwrap it to ERC20 origin.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;erc20Origins&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Origin for deposited token exists.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Unwrap ERC-223 wrapper.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            erc20Supply&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;erc20Origins&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            safeTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;erc20Origins&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            ERC223WrapperToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;burn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;tokenReceived&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Otherwise origin for the sender token doesn&amp;#39;t exist&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; There are two possible cases:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 1. ERC20 wrapper for the deposited token exists&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 2. ERC20 wrapper for the deposited token doesn&amp;#39;t exist and must be created.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        else&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;erc20Wrappers&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Create ERC-20 wrapper if it doesn&amp;#39;t exist.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            createERC20Wrapper&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Mint ERC-20 wrapper tokens for the deposited ERC-223 token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if the ERC-20 wrapper didn&amp;#39;t exist then it was just created in the above statement.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        erc20Wrappers&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;tokenReceived&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; createERC223Wrapper&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;erc223Wrappers&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_token&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERROR: Wrapper exists&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isWrapper&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Error: Creating wrapper for a wrapper token&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ERC223WrapperToken _newERC223Wrapper     &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span&gt; ERC223WrapperToken&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;salt&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _newERC223Wrapper&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;set&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        erc223Wrappers&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_token&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;                   =&lt;&#x2F;span&gt;&lt;span&gt; _newERC223Wrapper&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        erc20Origins&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_newERC223Wrapper&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; _token&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC223WrapperCreated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_newERC223Wrapper&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_newERC223Wrapper&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; createERC20Wrapper&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;erc20Wrappers&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_token&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERROR: Wrapper already exists.&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isWrapper&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Error: Creating wrapper for a wrapper token&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ERC20WrapperToken _newERC20Wrapper       &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span&gt; ERC20WrapperToken&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;salt&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _newERC20Wrapper&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;set&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        erc20Wrappers&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_token&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;                    =&lt;&#x2F;span&gt;&lt;span&gt; _newERC20Wrapper&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        erc223Origins&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_newERC20Wrapper&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; _token&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC20WrapperCreated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_newERC20Wrapper&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_newERC20Wrapper&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; wrapERC20toERC223&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _ERC20token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If there is no active wrapper for a token that user wants to wrap&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; then create it.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;erc223Wrappers&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_ERC20token&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            createERC223Wrapper&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_ERC20token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; _converterBalance &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_ERC20token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Safety variable.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        safeTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_ERC20token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _amount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_ERC20token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; _converterBalance&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        erc20Supply&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_ERC20token&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        erc223Wrappers&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_ERC20token&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; unwrapERC20toERC223&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _ERC20token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_ERC20token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Error: Insufficient balance.&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;erc223Origins&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_ERC20token&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Error: provided token is not a ERC-20 wrapper.&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        ERC20WrapperToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_ERC20token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;burn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        safeTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;erc223Origins&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_ERC20token&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; convertERC20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isWrapper&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; unwrapERC20toERC223&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        else&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; wrapERC20toERC223&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isWrapper&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; erc20Origins&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_token&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span&gt; erc223Origins&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_token&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; extractStuckERC20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01000B5fE61411C466b70631d7fF070187179Bbf&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        safeTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01000B5fE61411C466b70631d7fF070187179Bbf&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; erc20Supply&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_token&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; bytes4(keccak256(bytes(&amp;#39;transfer(address,uint256)&amp;#39;)));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt; success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; token&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodeWithSelector&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xa9059cbb&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;success &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;decode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;#39;TransferHelper: TRANSFER_FAILED&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; bytes4(keccak256(bytes(&amp;#39;transferFrom(address,address,uint256)&amp;#39;)));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt; success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; token&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodeWithSelector&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x23b872dd&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;success &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;decode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;#39;TransferHelper: TRANSFER_FROM_FAILED&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;While it is possible to implement a service that converts any token standard to any other standard - it is better to keep different standard convertors separate from one another as different standards may contain specific logic and therefore require different conversion approach. This proposal focuses on &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; upgradeability.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens can be deposited to any contract directly with &lt;code&gt;transfer&lt;&#x2F;code&gt; function. This may result in a permanent loss of tokens because it is not possible to recognize this transaction on the recipients side. Therefore wrapper-ERC-20 tokens are prone to this problem as they are compatible with the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; standard. &lt;code&gt;rescueERC20&lt;&#x2F;code&gt; function is implemented to address this problem.&lt;&#x2F;li&gt;
&lt;li&gt;Token Converter relies on &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; &lt;code&gt;approve&lt;&#x2F;code&gt; &amp;amp; &lt;code&gt;transferFrom&lt;&#x2F;code&gt; method of depositing assets. Any related issues must be taken into account. &lt;code&gt;approve&lt;&#x2F;code&gt; and &lt;code&gt;transferFrom&lt;&#x2F;code&gt; are two separate transactions so it is required to make sure &lt;code&gt;approval&lt;&#x2F;code&gt; was successful before relying on &lt;code&gt;transferFrom&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;This is a common practice for UI services to prompt a user to issue unlimited &lt;code&gt;approval&lt;&#x2F;code&gt; on any contract that may withdraw tokens from the user. This puts users funds at risk and therefore is not recommended.&lt;&#x2F;li&gt;
&lt;li&gt;There is no reliable token standard introspection method available that could guarantee that a token implements a particular token standard. It is possible to artificially construct a token that will pretend it is a &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; token that implements &lt;code&gt;approve &amp;amp; transferFrom&lt;&#x2F;code&gt; but at the same time implements &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; logic of transferring via &lt;code&gt;transfer&lt;&#x2F;code&gt; function. It can be possible to create a &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; wrapper for this &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;-&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; hybrid implementation in the Token Converter. This doesn&#x27;t pose any threat for the workflow of the Token Converter itself but it must be taken into account that if a token has &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; wrapper in the Token Converter it does not automatically mean the origin is fully compatible with the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; standard and methods of introspection must be used to determine the origins compatibility with any existing standard.&lt;&#x2F;li&gt;
&lt;li&gt;Token Converter does not verify the standard of a provided token when it is asked to create a wrapper for it due to the lack of reliable standard introspection method. It is possible to call &lt;code&gt;createERC20Wrapper&lt;&#x2F;code&gt; function and provide an address of an existing &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; token. The Token Converter will successfully create a &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; wrapper for that &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; original token. It is also possible to create a &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; wrapper for that exact original &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; token. This doesn&#x27;t pose any threat to the workflow of the Converter but it must be taken into account that any token regardless of it&#x27;s original standard may have up to two wrappers created by the Converter, one for each standard. Any wrapper token must have exactly one origin. It is not possible to create a wrapper for a wrapper.&lt;&#x2F;li&gt;
&lt;li&gt;The Token Converter only holds the original tokens that were deposited during the conversion process and it assumes that tokens do not decay over time and the token balance of the Converter does not decrease on its own. If some token implements burning logic or decaying supply and it may impact the balance of the Converter then the Converter must not be used to deploy an alternative version of that token as it will not be able to guarantee that there is enough tokens for the conversion at any time.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Parent-Governed Non-Fungible Tokens Nesting</title>
        <published>2023-07-26T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Bruno Škvorc</name><uri>https://github.com/Swader</uri>
	</author>
	
	<author>
		<name>Cicada</name><uri>https://github.com/CicadaNCR</uri>
	</author>
	
	<author>
		<name>Steven Pineda</name><uri>https://github.com/steven2308</uri>
	</author>
	
	<author>
		<name>Stevan Bogosavljevic</name><uri>https://github.com/stevyhacker</uri>
	</author>
	
	<author>
		<name>Jan Turk</name><uri>https://github.com/ThunderDeliverer</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7401/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6059-parent-governed-nestable-non-fungible-tokens/11914" />
        

        <id>https://wg-eips.ritovision.com/7401/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7401"
            label="ERC-7401" />
        

        
        

        
        <summary type="html">An interface for Non-Fungible Tokens Nesting with emphasis on parent token&#x27;s control over the relationship.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7401/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;❗️ &lt;strong&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7401&#x2F;&quot;&gt;ERC-7401&lt;&#x2F;a&gt; supersedes &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6059&#x2F;&quot;&gt;ERC-6059&lt;&#x2F;a&gt;.&lt;&#x2F;strong&gt; ❗️&lt;&#x2F;p&gt;
&lt;p&gt;The Parent-Governed NFT Nesting standard extends &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; by allowing for a new inter-NFT relationship and interaction.&lt;&#x2F;p&gt;
&lt;p&gt;At its core, the idea behind the proposal is simple: the owner of an NFT does not have to be an Externally Owned Account (EOA) or a smart contract, it can also be an NFT.&lt;&#x2F;p&gt;
&lt;p&gt;The process of nesting an NFT into another is functionally identical to sending it to another user. The process of sending a token out of another one involves issuing a transaction from the account owning the parent token.&lt;&#x2F;p&gt;
&lt;p&gt;An NFT can be owned by a single other NFT, but can in turn have a number of NFTs that it owns. This proposal establishes the framework for the parent-child relationships of NFTs. A parent token is the one that owns another token. A child token is a token that is owned by another token. A token can be both a parent and child at the same time. Child tokens of a given token can be fully managed by the parent token&#x27;s owner, but can be proposed by anyone.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7401&#x2F;.&#x2F;assets&#x2F;img&#x2F;eip-7401-nestable-tokens.png&quot; alt=&quot;Nestable tokens&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The graph illustrates how a child token can also be a parent token, but both are still administered by the root parent token&#x27;s owner.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;With NFTs being a widespread form of tokens in the Ethereum ecosystem and being used for a variety of use cases, it is time to standardize additional utility for them. Having the ability for tokens to own other tokens allows for greater utility, usability and forward compatibility.&lt;&#x2F;p&gt;
&lt;p&gt;In the four years since &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; was published, the need for additional functionality has resulted in countless extensions. This ERC improves upon ERC-721 in the following areas:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7401&#x2F;#bundling&quot;&gt;Bundling&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7401&#x2F;#collecting&quot;&gt;Collecting&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7401&#x2F;#membership&quot;&gt;Membership&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7401&#x2F;#delegation&quot;&gt;Delegation&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This proposal fixes the inconsistency in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6059&#x2F;&quot;&gt;ERC-6059&lt;&#x2F;a&gt; interface specification, where interface ID doesn&#x27;t match the interface specified as the interface evolved during the proposal&#x27;s lifecycle, but one of the parameters was not added to it. The missing parameter is, however, present in the interface ID. Apart from this fix, this proposal is functionally equivalent to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6059&#x2F;&quot;&gt;ERC-6059&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;bundling&quot;&gt;Bundling&lt;&#x2F;h3&gt;
&lt;p&gt;One of the most frequent uses of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; is to disseminate the multimedia content that is tied to the tokens. In the event that someone wants to offer a bundle of NFTs from various collections, there is currently no easy way of bundling all of these together and handle their sale as a single transaction. This proposal introduces a standardized way of doing so. Nesting all of the tokens into a simple bundle and selling that bundle would transfer the control of all of the tokens to the buyer in a single transaction.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;collecting&quot;&gt;Collecting&lt;&#x2F;h3&gt;
&lt;p&gt;A lot of NFT consumers collect them based on countless criteria. Some aim for utility of the tokens, some for the uniqueness, some for the visual appeal, etc. There is no standardized way to group the NFTs tied to a specific account. By nesting NFTs based on their owner&#x27;s preference, this proposal introduces the ability to do it. The root parent token could represent a certain group of tokens and all of the children nested into it would belong to it.&lt;&#x2F;p&gt;
&lt;p&gt;The rise of soulbound, non-transferable, tokens, introduces another need for this proposal. Having a token with multiple soulbound traits (child tokens), allows for numerous use cases. One concrete example of this can be drawn from supply chains use case. A shipping container, represented by an NFT with its own traits, could have multiple child tokens denoting each leg of its journey.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;membership&quot;&gt;Membership&lt;&#x2F;h3&gt;
&lt;p&gt;A common utility attached to NFTs is a membership to a Decentralised Autonomous Organization (DAO) or to some other closed-access group. Some of these organizations and groups occasionally mint NFTs to the current holders of the membership NFTs. With the ability to nest mint a token into a token, such minting could be simplified, by simply minting the bonus NFT directly into the membership one.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;delegation&quot;&gt;Delegation&lt;&#x2F;h3&gt;
&lt;p&gt;One of the core features of DAOs is voting and there are various approaches to it. One such mechanic is using fungible voting tokens where members can delegate their votes by sending these tokens to another member. Using this proposal, delegated voting could be handled by nesting your voting NFT into the one you are delegating your votes to and transferring it when the member no longer wishes to delegate their votes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; EIP-7401 Parent-Governed Nestable Non-Fungible Tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-7401&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0x42b0e56f.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.16&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7059&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is ERC165 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The core struct of ownership.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The `DirectOwner` struct is used to store information of the next immediate owner, be it the parent token,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * an `ERC721Receiver` contract or an externally owned account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If the token is not owned by an NFT, the `tokenId` MUST equal `0`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the parent token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ownerAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the owner of the token. If the owner is another token, then the address MUST be&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  the one of the parent token&amp;#39;s collection smart contract. If the owner is externally owned account, the address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  MUST be the address of this account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DirectOwner&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; ownerAddress&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The core child token struct, holding the information about the child tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the child token in the child token&amp;#39;s collection smart contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contractAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the child token&amp;#39;s smart contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Child&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; contractAddress&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to notify listeners that the token is being transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when `tokenId` token is transferred from `from` to `to`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the previous immediate owner, which is a smart contract if the token was nested.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the new immediate owner, which is a smart contract if the token is being nested.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; fromTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the previous parent token. If the token was not nested before, the value MUST be `0`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; toTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the new parent token. If the token is not being nested, the value MUST be `0`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token being transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NestTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; fromTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; toTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to notify listeners that a new token has been added to a given token&amp;#39;s pending children array.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a child NFT is added to a token&amp;#39;s pending array.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token that received a new pending child token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; childIndex&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Index of the proposed child token in the parent token&amp;#39;s pending children array&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; childAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the proposed child token&amp;#39;s collection smart contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; childId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the child token in the child token&amp;#39;s collection smart contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ChildProposed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; childIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; childAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; childId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to notify listeners that a new child token was accepted by the parent token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a parent token accepts a token from its pending array, migrating it to the active array.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token that accepted a new child token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; childIndex&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Index of the newly accepted child token in the parent token&amp;#39;s active children array&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; childAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the child token&amp;#39;s collection smart contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; childId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the child token in the child token&amp;#39;s collection smart contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ChildAccepted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; childIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; childAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; childId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to notify listeners that all pending child tokens of a given token have been rejected.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a token removes all child tokens from its pending array.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token that rejected all of the pending children&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AllChildrenRejected&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to notify listeners a child token has been transferred from parent token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a token transfers a child from itself, transferring ownership.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token that transferred a child token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; childIndex&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Index of a child in the array from which it is being transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; childAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the child token&amp;#39;s collection smart contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; childId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the child token in the child token&amp;#39;s collection smart contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; fromPending&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A boolean value signifying whether the token was in the pending child tokens array (`true`) or&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  in the active child tokens array (`false`)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; toZero&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A boolean value signifying whether the token is being transferred to the `0x0` address (`true`) or&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  not (`false`)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ChildTransferred&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; childIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; childAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; childId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; fromPending&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; toZero&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to retrieve the *root* owner of a given token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The *root* owner of the token is the top-level owner in the hierarchy which is not an NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If the token is owned by another NFT, it MUST recursively look up the parent&amp;#39;s root owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token for which the *root* owner has been retrieved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The *root* owner of the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to retrieve the immediate owner of the given token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If the immediate owner is another token, the address returned, MUST be the one of the parent token&amp;#39;s&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  collection smart contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token for which the direct owner is being retrieved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the given token&amp;#39;s owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ID of the parent token. MUST be `0` if the owner is not an NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The boolean value signifying whether the owner is an NFT or not&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; directOwnerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            uint256&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bool&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to burn a given token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; When a token is burned, all of its child tokens are recursively burned as well.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; When specifying the maximum recursive burns, the execution MUST be reverted if there are more children to be&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  burned.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Setting the `maxRecursiveBurn` value to 0 SHOULD only attempt to burn the specified token and MUST revert if&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  there are any child tokens present.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token to burn&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; maxRecursiveBurns&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Maximum number of tokens to recursively burn&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Number of recursively burned children&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; burn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; maxRecursiveBurns&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to add a child token to a given parent token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This adds the child token into the given parent token&amp;#39;s pending child tokens array.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The destination token MUST NOT be a child token of the token being transferred or one of its downstream&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  child tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This method MUST NOT be called directly. It MUST only be called from an instance of `IERC7059` as part of a &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        `nestTransfer` or `transferChild` to an NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  - `directOwnerOf` on the child contract MUST resolve to the called contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  - the pending array of the parent contract MUST not be full.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; parentId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the parent token to receive the new child token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; childId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the new proposed child token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addChild&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; parentId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; childId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to accept a pending child token for a given parent token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This moves the child token from parent token&amp;#39;s pending child tokens array into the active child tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  array.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; parentId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the parent token for which the child token is being accepted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; childIndex&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Index of the child token to accept in the pending children array of a given token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; childAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the collection smart contract of the child token expected to be at the specified&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  index&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; childId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the child token expected to be located at the specified index&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; acceptChild&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; parentId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; childIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; childAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; childId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to reject all pending children of a given parent token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Removes the children from the pending array mapping.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The children&amp;#39;s ownership structures are not updated.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - `parentId` MUST exist&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; parentId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the parent token for which to reject all of the pending tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; maxRejections&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Maximum number of expected children to reject, used to prevent from&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  rejecting children which arrive just before this operation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; rejectAllChildren&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; parentId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; maxRejections&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to transfer a child token from a given parent token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST remove the child from the parent&amp;#39;s active or pending children.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; When transferring a child token, the owner of the token MUST be set to `to`, or not updated in the event of `to`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  being the `0x0` address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the parent token from which the child token is being transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address to which to transfer the token to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; destinationId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token to receive this child token (MUST be 0 if the destination is not a token)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; childIndex&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Index of a token we are transferring, in the array it belongs to (can be either active array or&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  pending array)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; childAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the child token&amp;#39;s collection smart contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; childId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the child token in its own collection smart contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; isPending&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A boolean value indicating whether the child token being transferred is in the pending array of the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  parent token (`true`) or in the active array (`false`)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Additional data with no specified format, sent in call to `to`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferChild&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; destinationId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; childIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; childAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; childId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; isPending&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to retrieve the active child tokens of a given parent token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns array of Child structs existing for parent token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The Child struct consists of the following values:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      tokenId,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      contractAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; parentId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the parent token for which to retrieve the active child tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;[] An array of Child structs containing the parent token&amp;#39;s active child tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; childrenOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; parentId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Child&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to retrieve the pending child tokens of a given parent token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns array of pending Child structs existing for given parent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The Child struct consists of the following values:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      tokenId,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      contractAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; parentId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the parent token for which to retrieve the pending child tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;[] An array of Child structs containing the parent token&amp;#39;s pending child tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; pendingChildrenOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; parentId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Child&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to retrieve a specific active child token for a given parent token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns a single Child struct locating at `index` of parent token&amp;#39;s active child tokens array.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The Child struct consists of the following values:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      tokenId,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      contractAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; parentId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the parent token for which the child is being retrieved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; index&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Index of the child token in the parent token&amp;#39;s active child tokens array&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A Child struct containing data about the specified child&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; childOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; parentId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Child&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to retrieve a specific pending child token from a given parent token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns a single Child struct locating at `index` of parent token&amp;#39;s active child tokens array.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The Child struct consists of the following values:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      tokenId,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      contractAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; parentId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the parent token for which the pending child token is being retrieved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; index&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Index of the child token in the parent token&amp;#39;s pending child tokens array&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A Child struct containing data about the specified child&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; pendingChildOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; parentId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Child&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to transfer the token into another token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The destination token MUST NOT be a child token of the token being transferred or one of its downstream&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  child tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the direct owner of the token to be transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the receiving token&amp;#39;s collection smart contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token being transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; destinationId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token to receive the token being transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Additional data with no specified format&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; nestTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; destinationId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;ID MUST never be a &lt;code&gt;0&lt;&#x2F;code&gt; value, as this proposal uses &lt;code&gt;0&lt;&#x2F;code&gt; values do signify that the token&#x2F;destination is not an NFT.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Designing the proposal, we considered the following questions:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;How to name the proposal?&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
In an effort to provide as much information about the proposal we identified the most important aspect of the proposal; the parent centered control over nesting. The child token&#x27;s role is only to be able to be &lt;code&gt;Nestable&lt;&#x2F;code&gt; and support a token owning it. This is how we landed on the &lt;code&gt;Parent-Centered&lt;&#x2F;code&gt; part of the title.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Why is automatically accepting a child using &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; permit-style signatures not a part of this proposal?&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
For consistency. This proposal extends ERC-721 which already uses 1 transaction for approving operations with tokens. It would be inconsistent to have this and also support signing messages for operations with assets.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Why use indexes?&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
To reduce the gas consumption. If the token ID was used to find which token to accept or reject, iteration over arrays would be required and the cost of the operation would depend on the size of the active or pending children arrays. With the index, the cost is fixed. Lists of active and pending children per token need to be maintained, since methods to get them are part of the proposed interface.&lt;br &#x2F;&gt;
To avoid race conditions in which the index of a token changes, the expected token ID as well as the expected token&#x27;s collection smart contract is included in operations requiring token index, to verify that the token being accessed using the index is the expected one.&lt;br &#x2F;&gt;
Implementation that would internally keep track of indices using mapping was attempted. The minimum cost of accepting a child token was increased by over 20% and the cost of minting has increased by over 15%. We concluded that it is not necessary for this proposal and can be implemented as an extension for use cases willing to accept the increased transaction cost this incurs. In the sample implementation provided, there are several hooks which make this possible.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Why is the pending children array limited instead of supporting pagination?&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
The pending child tokens array is not meant to be a buffer to collect the tokens that the root owner of the parent token wants to keep, but not enough to promote them to active children. It is meant to be an easily traversable list of child token candidates and should be regularly maintained; by either accepting or rejecting proposed child tokens. There is also no need for the pending child tokens array to be unbounded, because active child tokens array is.&lt;br &#x2F;&gt;
Another benefit of having bounded child tokens array is to guard against spam and griefing. As minting malicious or spam tokens could be relatively easy and low-cost, the bounded pending array assures that all of the tokens in it are easy to identify and that legitimate tokens are not lost in a flood of spam tokens, if one occurs.&lt;br &#x2F;&gt;
A consideration tied to this issue was also how to make sure, that a legitimate token is not accidentally rejected when clearing the pending child tokens array. We added the maximum pending children to reject argument to the clear pending child tokens array call. This assures that only the intended number of pending child tokens is rejected and if a new token is added to the pending child tokens array during the course of preparing such call and executing it, the clearing of this array SHOULD result in a reverted transaction.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Should we allow tokens to be nested into one of its children?&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
The proposal enforces that a parent token can&#x27;t be nested into one of its child token, or downstream child tokens for that matter. A parent token and its children are all managed by the parent token&#x27;s root owner. This means that if a token would be nested into one of its children, this would create the ownership loop and none of the tokens within the loop could be managed anymore.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Why is there not a &quot;safe&quot; nest transfer method?&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
&lt;code&gt;nestTransfer&lt;&#x2F;code&gt; is always &quot;safe&quot; since it MUST check for &lt;code&gt;IERC7059&lt;&#x2F;code&gt; compatibility on the destination.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;How does this proposal differ from the other proposals trying to address a similar problem?&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
This interface allows for tokens to both be sent to and receive other tokens. The propose-accept and parent governed patterns allow for a more secure use. The backward compatibility is only added for ERC-721, allowing for a simpler interface. The proposal also allows for different collections to inter-operate, meaning that nesting is not locked to a single smart contract, but can be executed between completely separate NFT collections.&lt;br &#x2F;&gt;
Additionally this proposal addresses the inconsistencies between &lt;code&gt;interfaceId&lt;&#x2F;code&gt;, interface specification and example implementation of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6059&#x2F;&quot;&gt;ERC-6059&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;propose-commit-pattern-for-child-token-management&quot;&gt;Propose-Commit pattern for child token management&lt;&#x2F;h3&gt;
&lt;p&gt;Adding child tokens to a parent token MUST be done in the form of propose-commit pattern to allow for limited mutability by a 3rd party. When adding a child token to a parent token, it is first placed in a &lt;em&gt;&quot;Pending&quot;&lt;&#x2F;em&gt; array, and MUST be migrated to the &lt;em&gt;&quot;Active&quot;&lt;&#x2F;em&gt; array by the parent token&#x27;s root owner. The &lt;em&gt;&quot;Pending&quot;&lt;&#x2F;em&gt; child tokens array SHOULD be limited to 128 slots to prevent spam and griefing.&lt;&#x2F;p&gt;
&lt;p&gt;The limitation that only the root owner can accept the child tokens also introduces a trust inherent to the proposal. This ensures that the root owner of the token has full control over the token. No one can force the user to accept a child if they don&#x27;t want to.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parent-governed-pattern&quot;&gt;Parent Governed pattern&lt;&#x2F;h3&gt;
&lt;p&gt;The parent NFT of a nested token and the parent&#x27;s root owner are in all aspects the true owners of it. Once you send a token to another one you give up ownership.&lt;&#x2F;p&gt;
&lt;p&gt;We continue to use ERC-721&#x27;s &lt;code&gt;ownerOf&lt;&#x2F;code&gt; functionality which will now recursively look up through parents until it finds an address which is not an NFT, this is referred to as the &lt;em&gt;root owner&lt;&#x2F;em&gt;. Additionally we provide the &lt;code&gt;directOwnerOf&lt;&#x2F;code&gt; which returns the most immediate owner of a token using 3 values: the owner address, the tokenId which MUST be 0 if the direct owner is not an NFT, and a flag indicating whether or not the parent is an NFT.&lt;&#x2F;p&gt;
&lt;p&gt;The root owner or an approved party MUST be able to do the following operations on children: &lt;code&gt;acceptChild&lt;&#x2F;code&gt;, &lt;code&gt;rejectAllChildren&lt;&#x2F;code&gt; and &lt;code&gt;transferChild&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The root owner or an approved party MUST also be allowed to do these operations only when token is not owned by an NFT: &lt;code&gt;transferFrom&lt;&#x2F;code&gt;, &lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt;, &lt;code&gt;nestTransferFrom&lt;&#x2F;code&gt;, &lt;code&gt;burn&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;If the token is owned by an NFT, only the parent NFT itself MUST be allowed to execute the operations listed above. Transfers MUST be done from the parent token, using &lt;code&gt;transferChild&lt;&#x2F;code&gt;, this method in turn SHOULD call &lt;code&gt;nestTransferFrom&lt;&#x2F;code&gt; or &lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt; in the child token&#x27;s smart contract, according to whether the destination is an NFT or not. For burning, tokens must first be transferred to an EOA and then burned.&lt;&#x2F;p&gt;
&lt;p&gt;We add this restriction to prevent inconsistencies on parent contracts, since only the &lt;code&gt;transferChild&lt;&#x2F;code&gt; method takes care of removing the child from the parent when it is being transferred out of it.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;child-token-management&quot;&gt;Child token management&lt;&#x2F;h3&gt;
&lt;p&gt;This proposal introduces a number of child token management functions. In addition to the permissioned migration from &lt;em&gt;&quot;Pending&quot;&lt;&#x2F;em&gt; to &lt;em&gt;&quot;Active&quot;&lt;&#x2F;em&gt; child tokens array, the main token management function from this proposal is the &lt;code&gt;transferChild&lt;&#x2F;code&gt; function. The following state transitions of a child token are available with it:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Reject child token&lt;&#x2F;li&gt;
&lt;li&gt;Abandon child token&lt;&#x2F;li&gt;
&lt;li&gt;Unnest child token&lt;&#x2F;li&gt;
&lt;li&gt;Transfer the child token to an EOA or an &lt;code&gt;ERC721Receiver&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Transfer the child token into a new parent token&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;To better understand how these state transitions are achieved, we have to look at the available parameters passed to &lt;code&gt;transferChild&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferChild&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; destinationId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; childIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; childAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; childId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; isPending&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Based on the desired state transitions, the values of these parameters have to be set accordingly (any parameters not set in the following examples depend on the child token being managed):&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Reject child token&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7401&#x2F;.&#x2F;assets&#x2F;img&#x2F;eip-7401-reject-child.png&quot; alt=&quot;Reject child token&quot; &#x2F;&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Abandon child token&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7401&#x2F;.&#x2F;assets&#x2F;img&#x2F;eip-7401-abandon-child.png&quot; alt=&quot;Abandon child token&quot; &#x2F;&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Unnest child token&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7401&#x2F;.&#x2F;assets&#x2F;img&#x2F;eip-7401-unnest-child.png&quot; alt=&quot;Unnest child token&quot; &#x2F;&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Transfer the child token to an EOA or an &lt;code&gt;ERC721Receiver&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7401&#x2F;.&#x2F;assets&#x2F;img&#x2F;eip-7401-transfer-child-to-eoa.png&quot; alt=&quot;Transfer child token to EOA&quot; &#x2F;&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Transfer the child token into a new parent token&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7401&#x2F;.&#x2F;assets&#x2F;img&#x2F;eip-7401-transfer-child-to-token.png&quot; alt=&quot;Transfer child token to parent token&quot; &#x2F;&gt;&lt;br &#x2F;&gt;
This state change places the token in the pending array of the new parent token. The child token still needs to be accepted by the new parent token&#x27;s root owner in order to be placed into the active array of that token.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The Nestable token standard has been made compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; in order to take advantage of the robust tooling available for implementations of ERC-721 and to ensure compatibility with existing ERC-721 infrastructure.&lt;&#x2F;p&gt;
&lt;p&gt;The only incompatibility with ERC-721 is that Nestable tokens cannot use a token ID of 0.&lt;&#x2F;p&gt;
&lt;p&gt;There is some differentiation of how the &lt;code&gt;ownerOf&lt;&#x2F;code&gt; method behaves compared to ERC-721. The &lt;code&gt;ownerOf&lt;&#x2F;code&gt; method will now recursively look up through parent tokens until it finds an address that is not an NFT; this is referred to as the &lt;em&gt;root owner&lt;&#x2F;em&gt;. Additionally, we provide the &lt;code&gt;directOwnerOf&lt;&#x2F;code&gt;, which returns the most immediate owner of a token using 3 values: the owner address, the &lt;code&gt;tokenId&lt;&#x2F;code&gt;, which MUST be 0 if the direct owner is not an NFT, and a flag indicating whether or not the parent is an NFT. In case the token is owned by an EoA or an ERC-721 Receiver, the &lt;code&gt;ownerOf&lt;&#x2F;code&gt; method will behave the same as in ERC-721.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Tests are included in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7401&#x2F;.&#x2F;assets&#x2F;test&#x2F;nestable.ts&quot;&gt;&lt;code&gt;nestable.ts&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;To run them in terminal, you can use the following commands:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cd ..&#x2F;assets&#x2F;eip-7401&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;npm install&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;npx hardhat test&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7401&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;NestableToken.sol&quot;&gt;&lt;code&gt;NestableToken.sol&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The same security considerations as with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; apply: hidden logic may be present in any of the functions, including burn, add child, accept child, and more.&lt;&#x2F;p&gt;
&lt;p&gt;Since the current owner of the token is allowed to manage the token, there is a possibility that after the parent token is listed for sale, the seller might remove a child token just before before the sale and thus the buyer would not receive the expected child token. This is a risk that is inherent to the design of this standard. Marketplaces should take this into account and provide a way to verify the expected child tokens are present when the parent token is being sold or to guard against such a malicious behaviour in another way.&lt;&#x2F;p&gt;
&lt;p&gt;It is worth noting that &lt;code&gt;balanceOf&lt;&#x2F;code&gt; method only accounts for immediate tokens owned by the address; the tokens that are nested into a token owned by this address will not be reflected in this value as the recursive lookup needed in order to calculate this value is potentially too deep and might break the method.&lt;&#x2F;p&gt;
&lt;p&gt;Caution is advised when dealing with non-audited contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Portable Smart Contract Accounts</title>
        <published>2023-07-26T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Aaron Yee</name><uri>https://github.com/aaronyee-eth</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7405/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7405-portable-smart-contract-accounts/15236" />
        

        <id>https://wg-eips.ritovision.com/7405/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7405"
            label="ERC-7405" />
        

        
        

        
        <summary type="html">Migrating smart contract accounts at the Proxy (ERC-1967) layer.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7405/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Portable Smart Contract Accounts (PSCA) address the lack of portability and compatibility faced by Smart Contract Accounts (SCA) across different wallet providers. Based on &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1967&#x2F;&quot;&gt;ERC-1967&lt;&#x2F;a&gt;, the PSCA system allows users to easily migrate their SCAs between different wallets using new, randomly generated migration keys. This provides a similar experience to exporting an externally owned account (EOA) with a private key or mnemonic. The system ensures security by employing signatures and time locks, allowing users to verify and cancel migration operations during the lock period, thereby preventing potential malicious actions. PSCA offers a non-intrusive and cost-effective approach, enhancing the interoperability and composability within the Account Abstraction (AA) ecosystem.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;With the introduction of the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt; standard, AA related infrastructure and SCAs have been widely adopted in the community. However, unlike EOAs, SCAs have a more diverse code space, leading to varying contract implementations across different wallet providers. Consequently, the lack of portability for SCAs has become a significant issue, making it challenging for users to migrate their accounts between different wallet providers. While some proposed a modular approach for SCA accounts, it comes with higher implementation costs and specific prerequisites for wallet implementations.&lt;&#x2F;p&gt;
&lt;p&gt;Considering that different wallet providers tend to prefer their own implementations or may expect their contract systems to be concise and robust, a modular system may not be universally applicable. The community currently lacks a more general SCA migration standard.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal describes a solution working at the Proxy (ERC-1967) layer, providing a user experience similar to exporting an EOA account (using private keys or mnemonics). A universal SCA migration mechanism is shown in the following diagram:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7405&#x2F;.&#x2F;assets&#x2F;overview-diagram.jpg&quot; alt=&quot;Overview Diagram&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Considering that different wallet providers may have their own implementations, this solution imposes almost no requirements on the SCA implementation, making it more universally applicable and less intrusive with lower operational costs. Unlike a modular system operating at the &quot;implementation&quot; layer, both approaches can complement each other to further improve the interoperability and composability of the AA ecosystem.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;terms&quot;&gt;Terms&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Wallet Provider: A service provider that offers wallet services. SCA implementations among wallet providers are typically different, lacking compatibility with each other.&lt;&#x2F;li&gt;
&lt;li&gt;Random Operator: A new, randomly generated migration mnemonic or private key used for each migration. The corresponding address of its public key is the random operator&#x27;s address.
&lt;ul&gt;
&lt;li&gt;If using a mnemonic, the derived migration private key follows the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;bitcoin&#x2F;bips&#x2F;blob&#x2F;55566a73f9ddf77b4512aca8e628650c913067bf&#x2F;bip-0044.mediawiki&quot;&gt;BIP 44&lt;&#x2F;a&gt; specification with the path &lt;strong&gt;&lt;code&gt;m&#x2F;44&#x27;&#x2F;60&#x27;&#x2F;0&#x27;&#x2F;0&#x2F;0&#x27;&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;interfaces&quot;&gt;Interfaces&lt;&#x2F;h3&gt;
&lt;p&gt;A Portable Smart Contract Account &lt;strong&gt;MUST&lt;&#x2F;strong&gt; implement the &lt;strong&gt;&lt;code&gt;IERC7405&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7405&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; emitted when the account finishes the migration&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; oldImplementation&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; old implementation address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; newImplementation&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; new implementation address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AccountMigrated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; oldImplementation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newImplementation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; prepare the account for migration&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; randomOperator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; public key (in address format) of the random operator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; signature signed by the random operator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * **MUST** check the authenticity of the account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; prepareAccountMigration&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; randomOperator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; cancel the account migration&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * **MUST** check the authenticity of the account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; cancelAccountMigration&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; handle the account migration&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; newImplementation&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; new implementation address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; initData&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; init data for the new implementation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; signature signed by the random operator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * **MUST NOT** check the authenticity to make it accessible by the new implementation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; handleAccountMigration&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newImplementation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; initData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;signatures&quot;&gt;Signatures&lt;&#x2F;h3&gt;
&lt;p&gt;The execution of migration operations &lt;strong&gt;MUST&lt;&#x2F;strong&gt; use the migration private key to sign the &lt;code&gt;MigrationOp&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MigrationOp&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; chainID&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes4&lt;&#x2F;span&gt;&lt;span&gt; selector&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;When the &lt;strong&gt;&lt;code&gt;selector&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; corresponds to &lt;strong&gt;&lt;code&gt;prepareAccountMigration(address,bytes)&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; (i.e., &lt;strong&gt;&lt;code&gt;0x50fe70bd&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;), the &lt;strong&gt;&lt;code&gt;data&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; is &lt;strong&gt;&lt;code&gt;abi.encode(randomOperator)&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;. When the &lt;strong&gt;&lt;code&gt;selector&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; corresponds to &lt;strong&gt;&lt;code&gt;handleAccountMigration(address,bytes,bytes)&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; (i.e., &lt;strong&gt;&lt;code&gt;0xae2828ba&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;), the &lt;strong&gt;&lt;code&gt;data&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; is &lt;strong&gt;&lt;code&gt;abi.encode(randomOperator, setupCalldata)&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The signature is created using &lt;strong&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;191&#x2F;&quot;&gt;ERC-191&lt;&#x2F;a&gt;&lt;&#x2F;strong&gt;, signing the &lt;strong&gt;&lt;code&gt;MigrateOpHash&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; (calculated as &lt;strong&gt;&lt;code&gt;abi.encode(chainID, selector, data)&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;registry&quot;&gt;Registry&lt;&#x2F;h3&gt;
&lt;p&gt;To simplify migration credentials and enable direct addressing of the SCA account with only the migration mnemonic or private key, this proposal requires a shared registry deployed at the protocol layer.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7405Registry&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MigrationData&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; account&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint48&lt;&#x2F;span&gt;&lt;span&gt; createTime&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint48&lt;&#x2F;span&gt;&lt;span&gt; lockUntil&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; check if the migration data for the random operator exists&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; randomOperator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; public key (in address format) of the random operator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; migrationDataExists&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; randomOperator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; get the migration data for the random operator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; randomOperator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; public key (in address format) of the random operator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getMigrationData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; randomOperator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;MigrationData&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; set the migration data for the random operator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; randomOperator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; public key (in address format) of the random operator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; lockUntil&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the timestamp until which the account is locked for migration&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * **MUST** validate `migrationDataMap[randomOperator]` is empty&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setMigrationData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; randomOperator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint48&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; lockUntil&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; delete the migration data for the random operator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; randomOperator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; public key (in address format) of the random operator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * **MUST** validate `migrationDataMap[randomOperator].account` is `msg.sender`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; deleteMigrationData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; randomOperator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;expected-behavior&quot;&gt;Expected behavior&lt;&#x2F;h3&gt;
&lt;p&gt;When performing account migration (i.e., migrating an SCA from Wallet A to Wallet B), the following steps &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be followed:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Wallet A generates a new migration mnemonic or private key (&lt;strong&gt;MUST&lt;&#x2F;strong&gt; be new and random) and provides it to the user. The address corresponding to its public key is used as the &lt;strong&gt;&lt;code&gt;randomOperator&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Wallet A signs the &lt;strong&gt;&lt;code&gt;MigrateOpHash&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; using the migration private key and calls the &lt;strong&gt;&lt;code&gt;prepareAccountMigration&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; method, which &lt;strong&gt;MUST&lt;&#x2F;strong&gt; performs the following operations:
&lt;ul&gt;
&lt;li&gt;Calls the internal method &lt;strong&gt;&lt;code&gt;_requireAccountAuth()&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; to verify the authenticity of the SCA account. For example, in ERC-4337 account implementation, it may require &lt;strong&gt;&lt;code&gt;msg.sender == address(entryPoint)&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Performs signature checks to confirm the validity of the &lt;strong&gt;&lt;code&gt;randomOperator&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Calls &lt;strong&gt;&lt;code&gt;IERC7405Registry.migrationDataExists(randomOperator)&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; to ensure that the &lt;strong&gt;&lt;code&gt;randomOperator&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; does not already exist.&lt;&#x2F;li&gt;
&lt;li&gt;Sets the SCA account&#x27;s lock status to true and adds a record by calling &lt;strong&gt;&lt;code&gt;IERC7405Registry.setMigrationData(randomOperator, lockUntil)&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;After calling &lt;strong&gt;&lt;code&gt;prepareAccountMigration&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;, the account remains locked until a successful call to either &lt;strong&gt;&lt;code&gt;cancelAccountMigration&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; or &lt;strong&gt;&lt;code&gt;handleAccountMigration&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;To continue the migration, Wallet B initializes authentication data and imports the migration mnemonic or private key. Wallet B then signs the &lt;strong&gt;&lt;code&gt;MigrateOpHash&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; using the migration private key and calls the &lt;strong&gt;&lt;code&gt;handleWalletMigration&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; method, which &lt;strong&gt;MUST&lt;&#x2F;strong&gt; performs the following operations:
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; perform SCA account authentication checks to ensure public accessibility.&lt;&#x2F;li&gt;
&lt;li&gt;Performs signature checks to confirm the validity of the &lt;strong&gt;&lt;code&gt;randomOperator&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Calls &lt;strong&gt;&lt;code&gt;IERC7405Registry.getMigrationData(randomOperator)&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; to retrieve &lt;strong&gt;&lt;code&gt;migrationData&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;, and requires &lt;strong&gt;&lt;code&gt;require(migrationData.account == address(this) &amp;amp;&amp;amp; block.timestamp &amp;gt; migrationData.lockUntil)&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Calls the internal method &lt;strong&gt;&lt;code&gt;_beforeWalletMigration()&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; to execute pre-migration logic from Wallet A (e.g., data cleanup).&lt;&#x2F;li&gt;
&lt;li&gt;Modifies the Proxy (ERC-1967) implementation to the implementation contract of Wallet B.&lt;&#x2F;li&gt;
&lt;li&gt;Calls &lt;strong&gt;&lt;code&gt;address(this).call(initData)&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; to initialize the Wallet B contract.&lt;&#x2F;li&gt;
&lt;li&gt;Calls &lt;strong&gt;&lt;code&gt;IERC7405Registry.deleteMigrationData(randomOperator)&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; to remove the record.&lt;&#x2F;li&gt;
&lt;li&gt;Emits the &lt;strong&gt;&lt;code&gt;AccountMigrated&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; event.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;If the migration needs to be canceled, Wallet A can call the &lt;strong&gt;&lt;code&gt;cancelAccountMigration&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; method, which &lt;strong&gt;MUST&lt;&#x2F;strong&gt; performs the following operations:
&lt;ul&gt;
&lt;li&gt;Calls the internal method &lt;strong&gt;&lt;code&gt;_requireAccountAuth()&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; to verify the authenticity of the SCA account.&lt;&#x2F;li&gt;
&lt;li&gt;Sets the SCA account&#x27;s lock status to false and deletes the record by calling &lt;strong&gt;&lt;code&gt;IERC7405Registry.deleteMigrationData(randomOperator)&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;storage-layout&quot;&gt;Storage Layout&lt;&#x2F;h3&gt;
&lt;p&gt;To prevent conflicts in storage layout during migration across different wallet implementations, a Portable Smart Contract Account implementation contract:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; directly define state variables in the contract header.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;MUST&lt;&#x2F;strong&gt; encapsulate all state variables within a struct and store that struct in a specific slot. The slot index &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; be unique across different wallet implementations.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;For slot index, we recommend calculating it based on the namespace and slot ID:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The namespace &lt;strong&gt;MUST&lt;&#x2F;strong&gt; contain only [A-Za-z0-9_].&lt;&#x2F;li&gt;
&lt;li&gt;Wallet providers&#x27; namespaces are &lt;strong&gt;RECOMMENDED&lt;&#x2F;strong&gt; to use snake_case, incorporating the wallet name and major version number, such as &lt;strong&gt;&lt;code&gt;foo_wallet_v1&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The slot ID for slot index &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; follow the format &lt;strong&gt;&lt;code&gt;{namespace}.{customDomain}&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;, for example, &lt;strong&gt;&lt;code&gt;foo_wallet_v1.config&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The calculation of the slot index is performed as &lt;strong&gt;&lt;code&gt;bytes32(uint256(keccak256(slotID) - 1))&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The main challenge addressed by this EIP is the lack of portability in Smart Contract Accounts (SCAs). Currently, due to variations in SCA implementations across wallet providers, moving between wallets is a hassle. Proposing a modular approach, though beneficial in some respects, comes with its own costs and compatibility concerns.&lt;&#x2F;p&gt;
&lt;p&gt;The PSCA system, rooted in ERC-1967, introduces a migration mechanism reminiscent of exporting an EOA with a private key or mnemonic. This approach is chosen for its familiarity to users, ensuring a smoother user experience.&lt;&#x2F;p&gt;
&lt;p&gt;Employing random, migration-specific keys further fortifies security. By mimicking the EOA exportation process, we aim to keep the process recognizable, while addressing the unique challenges of SCA portability.&lt;&#x2F;p&gt;
&lt;p&gt;The decision to integrate with a shared registry at the protocol layer simplifies migration credentials. This system enables direct addressing of the SCA account using only the migration key, enhancing efficiency.&lt;&#x2F;p&gt;
&lt;p&gt;Storage layout considerations were paramount to avoid conflicts during migrations. Encapsulating state variables within a struct, stored in a unique slot, ensures that migrations don&#x27;t lead to storage overlaps or overwrites.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal is backward compatible with all SCA based on ERC-1967 Proxy, including non-ERC-4337 SCAs. Furthermore, this proposal does not have specific prerequisites for SCA implementation contracts, making it broadly applicable to various SCAs.&lt;&#x2F;p&gt;
&lt;!--
## Reference Implementation

[WIP]
--&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Each migration must generate a new, randomly generated migration mnemonic or private key and its corresponding random operator address to prevent replay attacks or malicious signing.&lt;&#x2F;li&gt;
&lt;li&gt;Different wallet implementations must consider the independence of storage layout to avoid conflicts in storage after migration.&lt;&#x2F;li&gt;
&lt;li&gt;To prevent immediate loss of access for the account owner due to malicious migration, we introduce a &quot;time lock&quot; to make migrations detectable and reversible. When a malicious operation attempts an immediate migration of an SCA, the account enters a lock state and waits for a lock period. During this time, users can use the original account authentication to cancel the migration and prevent asset loss. Accounts in the lock state &lt;strong&gt;SHOULD NOT&lt;&#x2F;strong&gt; allow the following operations:
&lt;ul&gt;
&lt;li&gt;Any form of asset transfer operations&lt;&#x2F;li&gt;
&lt;li&gt;Any form of external contract call operations&lt;&#x2F;li&gt;
&lt;li&gt;Any attempts to modify account authentication factors&lt;&#x2F;li&gt;
&lt;li&gt;Any operations that could potentially impact the above three&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;When performing migration operations, the wallet provider &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; attempt to notify the account owner of the migration details through all available messaging channels.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;strong&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Public Non-Fungible Tokens Emote Repository</title>
        <published>2023-07-26T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Bruno Škvorc</name><uri>https://github.com/Swader</uri>
	</author>
	
	<author>
		<name>Steven Pineda</name><uri>https://github.com/steven2308</uri>
	</author>
	
	<author>
		<name>Stevan Bogosavljevic</name><uri>https://github.com/stevyhacker</uri>
	</author>
	
	<author>
		<name>Jan Turk</name><uri>https://github.com/ThunderDeliverer</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7409/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6381-emotable-extension-for-non-fungible-tokens/12710" />
        

        <id>https://wg-eips.ritovision.com/7409/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7409"
            label="ERC-7409" />
        

        
        

        
        <summary type="html">React to any Non-Fungible Tokens using Unicode emojis.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7409/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;❗️ &lt;strong&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7409&#x2F;&quot;&gt;ERC-7409&lt;&#x2F;a&gt; supersedes &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6381&#x2F;&quot;&gt;ERC-6381&lt;&#x2F;a&gt;.&lt;&#x2F;strong&gt; ❗️&lt;&#x2F;p&gt;
&lt;p&gt;The Public Non-Fungible Tokens Emote Repository standard provides an enhanced interactive utility for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; by allowing NFTs to be emoted at.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal introduces the ability to react to NFTs using Unicode standardized emoji in a public non-gated repository smart contract that is accessible at the same address in all of the networks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;With NFTs being a widespread form of tokens in the Ethereum ecosystem and being used for a variety of use cases, it is time to standardize additional utility for them. Having the ability for anyone to interact with an NFT introduces an interactive aspect to owning an NFT and unlocks feedback-based NFT mechanics.&lt;&#x2F;p&gt;
&lt;p&gt;This ERC introduces new utilities for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; based tokens in the following areas:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7409&#x2F;#interactivity&quot;&gt;Interactivity&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7409&#x2F;#feedback-based-evolution&quot;&gt;Feedback based evolution&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7409&#x2F;#valuation&quot;&gt;Valuation&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This proposal fixes the compatibility issue in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6381&#x2F;&quot;&gt;ERC-6381&lt;&#x2F;a&gt; interface specification, where emojis are represented using &lt;code&gt;bytes4&lt;&#x2F;code&gt; values. The introduction of variation flags and emoji skin tones has rendered the &lt;code&gt;bytes4&lt;&#x2F;code&gt; namespace insufficient for representing all possible emojis, so the new standard used &lt;code&gt;string&lt;&#x2F;code&gt; instead. Apart from this fix, this proposal is functionally equivalent to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6381&#x2F;&quot;&gt;ERC-6381&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;interactivity&quot;&gt;Interactivity&lt;&#x2F;h3&gt;
&lt;p&gt;The ability to emote on an NFT introduces the aspect of interactivity to owning an NFT. This can either reflect the admiration for the emoter (person emoting to an NFT) or can be a result of a certain action performed by the token&#x27;s owner. Accumulating emotes on a token can increase its uniqueness and&#x2F;or value.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;feedback-based-evolution&quot;&gt;Feedback based evolution&lt;&#x2F;h3&gt;
&lt;p&gt;Standardized on-chain reactions to NFTs allow for feedback based evolution.&lt;&#x2F;p&gt;
&lt;p&gt;Current solutions are either proprietary or off-chain and therefore subject to manipulation and distrust. Having the ability to track the interaction on-chain allows for trust and objective evaluation of a given token. Designing the tokens to evolve when certain emote thresholds are met incentivizes interaction with the token collection.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;valuation&quot;&gt;Valuation&lt;&#x2F;h3&gt;
&lt;p&gt;Current NFT market heavily relies on previous values the token has been sold for, the lowest price of the listed token and the scarcity data provided by the marketplace. There is no real time indication of admiration or desirability of a specific token. Having the ability for users to emote to the tokens adds the possibility of potential buyers and sellers gauging the value of the token based on the impressions the token has collected.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-7409 Emotable Extension for Non-Fungible Tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-7409&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0x1b3327ab.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.16&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7409&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;is IERC165&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to notify listeners that the token with the specified ID has been emoted to or that the reaction has been revoked.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The event MUST only be emitted if the state of the emote is &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; emoter&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the account that emoted or revoked the reaction to the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the collection smart contract containing the token being emoted to or having the reaction revoked&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; emoji&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Unicode identifier of the emoji&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; on&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Boolean value signifying whether the token was emoted to (`true`) or if the reaction has been revoked (`false`)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Emoted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; emoter&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; emoji&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; on&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to get the number of emotes for a specific emoji on a token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the collection containing the token being checked for emoji count&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token to check for emoji count&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; emoji&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Unicode identifier of the emoji&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Number&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; of emotes with the emoji on the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; emoteCountOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; emoji&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to get the number of emotes for a specific emoji on a set of tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collections&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of addresses of the collections containing the tokens being checked for emoji count&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of IDs of the tokens to check for emoji count&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; emojis&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of unicode identifiers of the emojis&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; An&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of numbers of emotes with the emoji on the tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; bulkEmoteCountOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collections&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; emojis&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to get the information on whether the specified address has used a specific emoji on a specific&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; emoter&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the account we are checking for a reaction to a token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the collection smart contract containing the token being checked for emoji reaction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token being checked for emoji reaction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; emoji&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ASCII emoji code being checked for reaction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; A&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; boolean value indicating whether the `emoter` has used the `emoji` on the token (`true`) or not&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  (`false`)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; hasEmoterUsedEmote&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; emoter&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; emoji&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to get the information on whether the specified addresses have used specific emojis on specific&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; emoters&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of addresses of the accounts we are checking for reactions to tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collections&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of addresses of the collection smart contracts containing the tokens being checked&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  for emoji reactions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of IDs of the tokens being checked for emoji reactions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; emojis&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of the ASCII emoji codes being checked for reactions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; An&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of boolean values indicating whether the `emoter`s has used the `emoji`s on the tokens (`true`)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  or not (`false`)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; haveEmotersUsedEmotes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; emoters&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collections&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; emojis&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to get the message to be signed by the `emoter` in order for the reaction to be submitted by someone&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  else.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the collection smart contract containing the token being emoted at&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token being emoted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; emoji&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Unicode identifier of the emoji&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; state&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Boolean value signifying whether to emote (`true`) or undo (`false`) emote&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; deadline&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; UNIX timestamp of the deadline for the signature to be submitted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; message to be signed by the `emoter` in order for the reaction to be submitted by someone else&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; prepareMessageToPresignEmote&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; emoji&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; deadline&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to get multiple messages to be signed by the `emoter` in order for the reaction to be submitted by someone&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  else.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collections&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of addresses of the collection smart contracts containing the tokens being emoted at&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of IDs of the tokens being emoted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; emojis&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of unicode identifiers of the emojis&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; states&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of boolean values signifying whether to emote (`true`) or undo (`false`) emote&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; deadlines&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of UNIX timestamps of the deadlines for the signatures to be submitted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of messages to be signed by the `emoter` in order for the reaction to be submitted by someone else&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; bulkPrepareMessagesToPresignEmote&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collections&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; emojis&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; states&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; deadlines&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to emote or undo an emote on a token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Does nothing if attempting to set a pre-existent state.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST emit the `Emoted` event is the state of the emote is &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the collection containing the token being emoted at&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token being emoted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; emoji&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Unicode identifier of the emoji&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; state&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Boolean value signifying whether to emote (`true`) or undo (`false`) emote&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; emote&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; emoji&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; state&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to emote or undo an emote on multiple tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Does nothing if attempting to set a pre-existent state.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST emit the `Emoted` event is the state of the emote is &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST revert if the lengths of the `collections`, `tokenIds`, `emojis` and `states` arrays are not equal.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collections&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of addresses of the collections containing the tokens being emoted at&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of IDs of the tokens being emoted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; emojis&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of unicode identifiers of the emojis&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; states&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of boolean values signifying whether to emote (`true`) or undo (`false`) emote&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; bulkEmote&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collections&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; emojis&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; states&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to emote or undo an emote on someone else&amp;#39;s behalf.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Does nothing if attempting to set a pre-existent state.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST emit the `Emoted` event is the state of the emote is &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST revert if the lengths of the `collections`, `tokenIds`, `emojis` and `states` arrays are not equal.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST revert if the `deadline` has passed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST revert if the recovered address is the zero address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; emoter&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address that presigned the emote&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the collection smart contract containing the token being emoted at&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; IDs of the token being emoted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; emoji&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Unicode identifier of the emoji&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; state&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Boolean value signifying whether to emote (`true`) or undo (`false`) emote&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; deadline&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; UNIX timestamp of the deadline for the signature to be submitted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `v` value of an ECDSA signature of the message obtained via `prepareMessageToPresignEmote`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `r` value of an ECDSA signature of the message obtained via `prepareMessageToPresignEmote`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `s` value of an ECDSA signature of the message obtained via `prepareMessageToPresignEmote`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; presignedEmote&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; emoter&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; emoji&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; deadline&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; v&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; s&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to bulk emote or undo an emote on someone else&amp;#39;s behalf.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Does nothing if attempting to set a pre-existent state.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST emit the `Emoted` event is the state of the emote is &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST revert if the lengths of the `collections`, `tokenIds`, `emojis` and `states` arrays are not equal.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST revert if the `deadline` has passed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST revert if the recovered address is the zero address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; emoters&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of addresses of the accounts that presigned the emotes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collections&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of addresses of the collections containing the tokens being emoted at&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of IDs of the tokens being emoted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; emojis&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of unicode identifiers of the emojis&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; states&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of boolean values signifying whether to emote (`true`) or undo (`false`) emote&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; deadlines&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; UNIX timestamp of the deadline for the signature to be submitted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of `v` values of an ECDSA signatures of the messages obtained via `prepareMessageToPresignEmote`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of `r` values of an ECDSA signatures of the messages obtained via `prepareMessageToPresignEmote`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of `s` values of an ECDSA signatures of the messages obtained via `prepareMessageToPresignEmote`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; bulkPresignedEmote&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; emoters&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collections&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; emojis&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; states&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; deadlines&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint8&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; v&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; s&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;message-format-for-presigned-emotes&quot;&gt;Message format for presigned emotes&lt;&#x2F;h3&gt;
&lt;p&gt;The message to be signed by the &lt;code&gt;emoter&lt;&#x2F;code&gt; in order for the reaction to be submitted by someone else is formatted as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            DOMAIN_SEPARATOR&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            emoji&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            deadline&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The values passed when generating the message to be signed are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;DOMAIN_SEPARATOR&lt;&#x2F;code&gt; - The domain separator of the Emotable repository smart contract&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;collection&lt;&#x2F;code&gt; - Address of the collection containing the token being emoted at&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;tokenId&lt;&#x2F;code&gt; - ID of the token being emoted&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;emoji&lt;&#x2F;code&gt; - Unicode identifier of the emoji&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;state&lt;&#x2F;code&gt; - Boolean value signifying whether to emote (&lt;code&gt;true&lt;&#x2F;code&gt;) or undo (&lt;code&gt;false&lt;&#x2F;code&gt;) emote&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;deadline&lt;&#x2F;code&gt; - UNIX timestamp of the deadline for the signature to be submitted&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;code&gt;DOMAIN_SEPARATOR&lt;&#x2F;code&gt; is generated as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;ERC-7409: Public Non-Fungible Token Emote Repository&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;1&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;chainid&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Each chain, that the Emotable repository smart contract is deployed on, will have a different &lt;code&gt;DOMAIN_SEPARATOR&lt;&#x2F;code&gt; value due to chain IDs being different.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;pre-determined-address-of-the-emotable-repository&quot;&gt;Pre-determined address of the Emotable repository&lt;&#x2F;h3&gt;
&lt;p&gt;The address of the Emotable repository smart contract is designed to resemble the function it serves. It starts with &lt;code&gt;0x3110735&lt;&#x2F;code&gt; which is the abstract representation of &lt;code&gt;EMOTES&lt;&#x2F;code&gt;. The address is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x3110735F0b8e71455bAe1356a33e428843bCb9A1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Designing the proposal, we considered the following questions:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Does the proposal support custom emotes or only the Unicode specified ones?&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
The proposal only accepts the Unicode identifier which is a &lt;code&gt;string&lt;&#x2F;code&gt; value. This means that while we encourage implementers to add the reactions using standardized emojis, the values not covered by the Unicode standard can be used for custom emotes. The only drawback being that the interface displaying the reactions will have to know what kind of image to render and such additions will probably be limited to the interface or marketplace in which they were made.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Should the proposal use emojis to relay the impressions of NFTs or some other method?&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
The impressions could have been done using user-supplied strings or numeric values, yet we decided to use emojis since they are a well established mean of relaying impressions and emotions.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Should the proposal establish an emotable extension or a common-good repository?&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
Initially we set out to create an emotable extension to be used with any ERC-721 compliant tokens. However, we realized that the proposal would be more useful if it was a common-good repository of emotable tokens. This way, the tokens that can be reacted to are not only the new ones but also the old ones that have been around since before the proposal.&lt;br &#x2F;&gt;
In line with this decision, we decided to calculate a deterministic address for the repository smart contract. This way, the repository can be used by any NFT collection without the need to search for the address on the given chain.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Should we include only single-action operations, only multi-action operations, or both?&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
We&#x27;ve considered including only single-action operations, where the user is only able to react with a single emoji to a single token, but we decided to include both single-action and multi-action operations. This way, the users can choose whether they want to emote or undo emote on a single token or on multiple tokens at once.&lt;br &#x2F;&gt;
This decision was made for the long-term viability of the proposal. Based on the gas cost of the network and the number of tokens in the collection, the user can choose the most cost-effective way of emoting.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Should we add the ability to emote on someone else&#x27;s behalf?&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
While we did not intend to add this as part of the proposal when drafting it, we realized that it would be a useful feature for it. This way, the users can emote on behalf of someone else, for example, if they are not able to do it themselves or if the emote is earned through an off-chain activity.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;How do we ensure that emoting on someone else&#x27;s behalf is legitimate?&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
We could add delegates to the proposal; when a user delegates their right to emote to someone else, the delegate can emote on their behalf. However, this would add a lot of complexity and additional logic to the proposal.&lt;br &#x2F;&gt;
Using ECDSA signatures, we can ensure that the user has given their consent to emote on their behalf. This way, the user can sign a message with the parameters of the emote and the signature can be submitted by someone else.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Should we add chain ID as a parameter when reacting to a token?&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
During the course of discussion of the proposal, a suggestion arose that we could add chain ID as a parameter when reacting to a token. This would allow the users to emote on the token of one chain on another chain.&lt;br &#x2F;&gt;
We decided against this as we feel that additional parameter would rarely be used and would add additional cost to the reaction transactions. If the collection smart contract wants to utilize on-chain emotes to tokens they contain, they require the reactions to be recorded on the same chain. Marketplaces and wallets integrating this proposal will rely on reactions to reside in the same chain as well, because if chain ID parameter was supported this would mean that they would need to query the repository smart contract on all of the chains the repository is deployed in order to get the reactions for a given token.&lt;br &#x2F;&gt;
Additionally, if the collection creator wants users to record their reactions on a different chain, they can still direct the users to do just that. The repository does not validate the existence of the token being reacted to, which in theory means that you can react to non-existent token or to a token that does not exist yet. The likelihood of a different collection existing at the same address on another chain is significantly low, so the users can react using the collection&#x27;s address on another chain and it is very unlikely that they will unintentionally react to another collection&#x27;s token.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Should we use &lt;code&gt;bytes4&lt;&#x2F;code&gt; or &lt;code&gt;strings&lt;&#x2F;code&gt; to represent emotes?&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
Initially the proposal used &lt;code&gt;bytes4&lt;&#x2F;code&gt;. This was due to the assumption that all of the emojis use UTF-4 encoding, which is not the case.&lt;br &#x2F;&gt;
The emojis usually use up to 8 bytes, but the personalized emojis with skin tones use much more. This is why we decided to use &lt;code&gt;strings&lt;&#x2F;code&gt; to represent the emotes. This allows the repository to be forward compatible with any future emojis that might be added to the Unicode standard.&lt;br &#x2F;&gt;
This is how this proposal fixes the forward compatibility issue of the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6381&#x2F;&quot;&gt;ERC-6381&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The Emote repository standard is fully compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and with the robust tooling available for implementations of ERC-721 as well as with the existing ERC-721 infrastructure.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Tests are included in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7409&#x2F;.&#x2F;assets&#x2F;test&#x2F;emotableRepository.ts&quot;&gt;&lt;code&gt;emotableRepository.ts&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;To run them in terminal, you can use the following commands:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cd ..&#x2F;assets&#x2F;eip-7409&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;npm install&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;npx hardhat test&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7409&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;EmotableRepository.sol&quot;&gt;&lt;code&gt;EmotableRepository.sol&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The proposal does not envision handling any form of assets from the user, so the assets should not be at risk when interacting with an Emote repository.&lt;&#x2F;p&gt;
&lt;p&gt;The ability to use ECDSA signatures to emote on someone else&#x27;s behalf introduces the risk of a replay attack, which the format of the message to be signed guards against. The &lt;code&gt;DOMAIN_SEPARATOR&lt;&#x2F;code&gt; used in the message to be signed is unique to the repository smart contract of the chain it is deployed on. This means that the signature is invalid on any other chain and the Emote repositories deployed on them should revert the operation if a replay attack is attempted.&lt;&#x2F;p&gt;
&lt;p&gt;Another thing to consider is the ability of presigned message reuse. Since the message includes the signature validity deadline, the message can be reused any number of times before the deadline is reached. The proposal only allows for a single reaction with a given emoji to a specific token to be active, so the presigned message can not be abused to increase the reaction count on the token. However, if the service using the repository relies on the ability to revoke the reaction after certain actions, a valid presigned message can be used to re-react to the token. We suggest that the services using the repository in conjunction with presigned messages use deadlines that invalidate presigned messages after a reasonably short period of time.&lt;&#x2F;p&gt;
&lt;p&gt;Caution is advised when dealing with non-audited contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>ERC-20 Update Allowance By Spender</title>
        <published>2023-07-26T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Mohammad Zakeri Rad</name><uri>https://github.com/zakrad</uri>
	</author>
	
	<author>
		<name>Adam Boudjemaa</name><uri>https://github.com/aboudjem</uri>
	</author>
	
	<author>
		<name>Mohamad Hammoud</name><uri>https://github.com/mohamadhammoud</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7410/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7410-decrease-allowance-by-spender/15222" />
        

        <id>https://wg-eips.ritovision.com/7410/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7410"
            label="ERC-7410" />
        

        
        

        
        <summary type="html">Extension to enable revoking and decreasing allowance approval by spender for ERC-20</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7410/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This extension adds a &lt;code&gt;decreaseAllowanceBySpender&lt;&#x2F;code&gt; function to decrease &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; allowances, in which a spender can revoke or decrease a given allowance by a specific address. This ERC extends &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens offer allowances, enabling token owners to authorize spenders to use a designated amount of tokens on their behalf. However, the process of decreasing an allowance is limited to the owner&#x27;s side, which can be problematic if the token owner is a treasury wallet or a multi-signature wallet that has granted an excessive allowance to a spender. In such cases, reducing the allowance from the owner&#x27;s perspective can be time-consuming and challenging.&lt;&#x2F;p&gt;
&lt;p&gt;To address this issue and enhance security measures, this ERC proposes allowing spenders to decrease or revoke the granted allowance from their end. This feature provides an additional layer of security in the event of a potential hack in the future. It also eliminates the need for a consensus or complex procedures to decrease the allowance from the token owner&#x27;s side.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;Contracts using this ERC MUST implement the &lt;code&gt;IERC7410&lt;&#x2F;code&gt; interface.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;interface-implementation&quot;&gt;Interface implementation&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; IERC-7410 Update Allowance By Spender Extension&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0x12860fba&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7410&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC20&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Decreases any allowance by `owner` address for caller.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Emits an {IERC20-Approval} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - when `subtractedValue` is equal or higher than current allowance of spender the new allowance is set to 0.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Nullification also MUST be reflected for current allowance being type(uint256).max.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; decreaseAllowanceBySpender&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; subtractedValue&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;decreaseAllowanceBySpender(address owner, uint256 subtractedValue)&lt;&#x2F;code&gt; function MUST be either &lt;code&gt;public&lt;&#x2F;code&gt; or &lt;code&gt;external&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;Approval&lt;&#x2F;code&gt; event MUST be emitted when &lt;code&gt;decreaseAllowanceBySpender&lt;&#x2F;code&gt; is called.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; method MUST return &lt;code&gt;true&lt;&#x2F;code&gt; when called with &lt;code&gt;0x12860fba&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The technical design choices within this ERC are driven by the following considerations:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The introduction of the &lt;code&gt;decreaseAllowanceBySpender&lt;&#x2F;code&gt; function empowers spenders by allowing them to autonomously revoke or decrease allowances. This design choice aligns with the goal of providing more direct control to spenders over their authorization levels.&lt;&#x2F;li&gt;
&lt;li&gt;The requirement for the &lt;code&gt;subtractedValue&lt;&#x2F;code&gt; to be lower than the current allowance ensures a secure implementation. Additionally, nullification is achieved by setting the new allowance to 0 when &lt;code&gt;subtractedValue&lt;&#x2F;code&gt; is equal to or exceeds the current allowance. This approach adds an extra layer of security and simplifies the process of decreasing allowances.&lt;&#x2F;li&gt;
&lt;li&gt;The decision to maintain naming patterns similar to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;&#x27;s approvals is rooted in promoting consistency and ease of understanding for developers familiar with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; standard.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;An minimal implementation is included &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7410&#x2F;.&#x2F;assets&#x2F;ERC7410.sol&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Users of this ERC must thoroughly consider the amount of tokens they decrease from their allowance for an &lt;code&gt;owner&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>On-Demand Off-Chain Data Retrieval</title>
        <published>2023-07-26T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Noah Litvin</name><uri>https://github.com/noahlitvin</uri>
	</author>
	
	<author>
		<name>db</name><uri>https://github.com/dbeal-eth</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7412/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7412-on-demand-off-chain-data-retrieval/15346" />
        

        <id>https://wg-eips.ritovision.com/7412/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7412"
            label="ERC-7412" />
        

        
        

        
        <summary type="html">A method to construct multicalls with prepended verifiable off-chain data</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7412/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Contracts may require off-chain data during execution. A smart contract function could implement the standard proposed here by reverting with &lt;code&gt;error OracleDataRequired(address oracleContract, bytes oracleQuery, uint256 feeRequired)&lt;&#x2F;code&gt;. Clients supporting this standard would recognize this error message during a simulation of the request, query the specified decentralized oracle network for signed data, and instead stage a transaction with a multicall that prepends the verification of the required off-chain data. The data would be written on-chain during verification to a smart contract for the subsequent call to read, avoiding the error.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Ethereum&#x27;s scaling roadmap involves a series of separate execution contexts for smart contract code (including layer two and layer three scaling solutions). This makes the ability to read data across multiple chains crucial to the construction of scalable applications. Also, for decentralized finance protocols that rely on price data, it is not reasonable to expect oracle networks will be able to continuously push fresh data to every layer two and layer three network for an arbitrary number of price feeds.&lt;&#x2F;p&gt;
&lt;p&gt;Cross-chain bridges are being developed where smart contract functions can write data to other chains. There is a need for a similar standard that enables reading data from other chains. This standard can be generalized for reading any off-chain data from a decentralized oracle network, including price feeds.&lt;&#x2F;p&gt;
&lt;p&gt;With standards for both writing and reading cross-chain data, protocol developers will be able to create abstractions for asynchronicity (a topic thoroughly explored in other software engineering contexts). This will enable the development of highly sophisticated protocols that do not suffer from scaling constraints.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3668&#x2F;&quot;&gt;ERC-3668&lt;&#x2F;a&gt; introduced the use of reverts for requiring off-chain data, but there are various challenges introduced by the specifics of that standard which are outlined in the &lt;em&gt;Rationale&lt;&#x2F;em&gt; section below. By leveraging multicalls rather than callback functions, the standard proposed here is able to overcome some of these constraints.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;A contract implementing this standard MUST revert with the following error whenever off-chain data is required:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OracleDataRequired&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; oracleContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt; oracleQuery&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt; feeRequired&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;oracleQuery&lt;&#x2F;code&gt; specifies the off-chain data that is being required. Valid data formats for this parameter are specific to the oracle ID specified by the oracle contract. This might include chain id, contract address, function signature, payload, and timestamp&#x2F;&quot;latest&quot; for cross-chain reads. For price feeds, it could include a ticker symbol and timestamp&#x2F;&quot;latest&quot;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;oracleContract&lt;&#x2F;code&gt; is the address of the contract which can verify the off-chain data and provide it to the contract to avoid the &lt;code&gt;OracleDataRequired&lt;&#x2F;code&gt; error. This contract MUST implement the following interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7412&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; oracleId&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; oracleId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fulfillOracleQuery&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signedOffchainData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;oracleId&lt;&#x2F;code&gt; is a unique identifier that references the decentralized oracle network that generates the desired signed off-chain data. Oracle IDs would be analogous to Chain IDs in the Ethereum ecosystem. Clients are expected to resolve a gateway that corresponds to an Oracle ID, similar to how clients are expected to resolve an RPC endpoint based on a Chain ID.&lt;&#x2F;p&gt;
&lt;p&gt;It should be possible to derive the &lt;code&gt;oracleQuery&lt;&#x2F;code&gt; from the &lt;code&gt;signedOffchainData&lt;&#x2F;code&gt;, such that the oracle contract is able to provide the verified offchain data based on the &lt;code&gt;oracleQuery&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The contract implementing the &lt;code&gt;IERC7412&lt;&#x2F;code&gt; interface MUST revert with the following error message if it requires payment to fulfill the oracle data query:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FeeRequired&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;amount&lt;&#x2F;code&gt; specifies the amount of native gas tokens required to execute the &lt;code&gt;fulfillOracleQuery&lt;&#x2F;code&gt; function, denominated in wei. This error MUST be resolved if the caller provides sufficient &lt;code&gt;msg.value&lt;&#x2F;code&gt; such that the fee amount can be collected by the oracle contract. The contract MAY NOT return gas tokens if they are provided in excess of the &lt;code&gt;amount&lt;&#x2F;code&gt;. In practice, we would expect the fee amount to remain relatively stable, if not constant.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, to optimize for scenarios where multiple oracle data requests are needed (such as protocols requiring many price feeds simultaneously), the interface MAY include an error for batching multiple errors:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Errors&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; errors&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This allows clients to efficiently handle multiple &lt;code&gt;OracleDataRequired&lt;&#x2F;code&gt; errors in a single transaction simulation, reducing the number of separate requests needed. When encountering this error, clients should parse each error in the array and handle them accordingly, potentially using recursion for nested error objects.&lt;&#x2F;p&gt;
&lt;p&gt;It is the responsibility of the client to decide how to construct the multicall, where necessary the &lt;code&gt;fulfillOracleQuery&lt;&#x2F;code&gt; functions are being called before the intended function call in an atomic transaction. Wallets that support account abstraction (per &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt;) should already have the ability to generate atomic multi-operations. For EOA support, protocols could implement &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2771&#x2F;&quot;&gt;ERC-2771&lt;&#x2F;a&gt;. A standard multicall contract can only be used to construct multicalls including functions which do not reference &lt;code&gt;msg.sender&lt;&#x2F;code&gt; or &lt;code&gt;msg.data&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Note that &lt;code&gt;URI&lt;&#x2F;code&gt; could be used as the &lt;code&gt;oracleId&lt;&#x2F;code&gt; with a URI specified as the &lt;code&gt;oracleQuery&lt;&#x2F;code&gt;. This would allow this standard to be compliant with arbitrary on-chain URIs without requiring updates to a client library, similar to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3668&#x2F;&quot;&gt;ERC-3668&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal is essentially an alternative to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3668&#x2F;&quot;&gt;ERC-3668&lt;&#x2F;a&gt; with a couple notable distinctions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The error is very simple to construct. Developers implementing this standard only need to have awareness of the oracle network they choose to rely on, the form of the query accepted by this network, and the contract from which they expect to retrieve the data.&lt;&#x2F;li&gt;
&lt;li&gt;By relying on a multicall rather than callbacks, it is much simpler to handle situations in which nested calls require different off-chain data. By the standard proposed here, end users (including those using clients that implement account abstraction) always need to simply sign a transaction, regardless of the complexity of the internal structure of the call being executed. The client can automatically prepend any necessary off-chain data to the transaction for the call to succeed.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;With this standard, not only can oracle providers scalably support an unlimited number of networks but they can also be compatible with local&#x2F;forked networks for protocol development.&lt;&#x2F;p&gt;
&lt;p&gt;Another major advantage of this standard is that oracles can charge fees in the form of native gas tokens during the on-chain verification of the data. This creates an economic incentive where fees can be collected from data consumers and provided to node operators in the decentralized oracle network.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The following pseudocode illustrates an oversimplified version of the client SDK. Ideally, this could be implemented in wallets, but it could also be built into the application layer. This function takes a desired transaction and converts it into a multicall with the required data verification transactions prepended such that the &lt;code&gt;OracleDataRequired&lt;&#x2F;code&gt; errors would be avoided:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; prepareTransaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;originalTx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; multicallTx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;originalTx&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  while&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;true&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    try&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; simulationResult&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; simulateTx&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;multicallTx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; multicallTx&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; catch&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;error&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; instanceof&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OracleDataRequired&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; signedRequiredData&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fetchOffchainData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;          error&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;oracleContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;          error&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;oracleQuery&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; dataVerificationTx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; generateDataVerificationTx&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;          error&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;oracleContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;          signedRequiredData&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        multicallTx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;unshift&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;dataVerificationTx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;An oracle provider could create a contract (that might also perform some pre-processing) that would automatically trigger a request for off-chain data as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OracleContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7412&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; VERIFIER_CONTRACT &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x0000&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; STALENESS_TOLERANCE &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 86400&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; One day&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; latestVerifiedData&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; oracleId&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;MY_ORACLE_ID&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fulfillOracleQuery&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signedOffchainData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; oracleQuery &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _verify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signedOffchainData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    latestVerifiedData&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;oracleQuery&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; signedOffchainData&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; retrieveCrossChainData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; chainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contractAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; payload&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; oracleQuery &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;chainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; contractAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; payload&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt; timestamp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt; response&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;decode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;latestVerifiedData&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;oracleQuery&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;timestamp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt; STALENESS_TOLERANCE&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OracleDataRequired&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; oracleQuery&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; response&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _verify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signedOffchainData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; oracleQuery&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Insert verification code here&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This may revert with error FeeRequired(uint amount)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Now a top-level protocol smart contract could implement a cross-chain function like so:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ICrosschainContract&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; functionA&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; x&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; y&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; functionB&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; x&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; y&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CrosschainAdder&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  IERC7412 oracleContract &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x0000&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; chainIdA&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contractAddressA&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; chainIdB&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contractAddressB&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sum&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sum &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;decode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;oracleContract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;retrieveCrossChainData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;chainIdA&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; contractAddressA&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodeWithSelector&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ICrosschainContract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;functionA&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;decode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;oracleContract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;retrieveCrossChainData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;chainIdB&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; contractAddressB&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodeWithSelector&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ICrosschainContract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;functionB&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note that the developer of the &lt;code&gt;CrosschainAdder&lt;&#x2F;code&gt; function does not need to be concerned with the implementation of this standard. The &lt;code&gt;add&lt;&#x2F;code&gt; function can simply call the function on the oracle contract as if it were retrieving on-chain data normally.&lt;&#x2F;p&gt;
&lt;p&gt;Cross-chain functions like this could also be leveraged to avoid O(n) (and greater) loops on-chain. For example, &lt;code&gt;chainIdA&lt;&#x2F;code&gt; and &lt;code&gt;chainIdB&lt;&#x2F;code&gt; could reference the same chain that the &lt;code&gt;CrosschainAdder&lt;&#x2F;code&gt; contract is deployed on with &lt;code&gt;functionA&lt;&#x2F;code&gt; and &lt;code&gt;functionB&lt;&#x2F;code&gt; as view functions with computationally intensive loops.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;One potential risk introduced by this standard is that its reliance on multicalls could obfuscate transaction data in wallet applications that do not have more sophisticated transaction decoding functionality. This is an existing challenge being addressed by wallet application developers, as multicalls are increasingly common in protocol development outside of this standard.&lt;&#x2F;p&gt;
&lt;p&gt;Note that it is the responsibility of the verifier contract to confirm the validity of the data provided from the oracle network. This standard does not create any new opportunities for invalid data to be provided to a smart contract.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>⚡ Flash Loans ⚡</title>
        <published>2023-07-25T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Alberto Cuesta Cañada</name><uri>https://github.com/alcueca</uri>
	</author>
	
	<author>
		<name>Michael Amadi</name><uri>https://github.com/AmadiMichaels</uri>
	</author>
	
	<author>
		<name>Devtooligan</name><uri>https://github.com/devtooligan</uri>
	</author>
	
	<author>
		<name>Ultrasecr.eth</name><uri>https://github.com/ultrasecreth</uri>
	</author>
	
	<author>
		<name>Sam Bacha</name><uri>https://github.com/sambacha</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7399/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc7400-flash-loans/15211" />
        

        <id>https://wg-eips.ritovision.com/7399/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7399"
            label="ERC-7399" />
        

        
        

        
        <summary type="html">Interfaces and processes for flash loans</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7399/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;A flash loan is a loan between lender and borrower smart contracts that must be repaid, plus an optional fee, before the end of the transaction. This ERC specifies interfaces for lenders to accept flash loan requests, and for borrowers to take temporary control of the transaction within the lender execution. The process for the safe execution of flash loans is also specified.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The current state of the flash loan ecosystem is fragmented and lacks standardization, leading to several challenges for both lenders and borrowers. The absence of a common interface results in increased integration efforts, as each flash loan provider implements its own unique approach. This lack of standardization is expected to become more problematic as the ecosystem grows, requiring more resources to maintain compatibility.&lt;&#x2F;p&gt;
&lt;p&gt;A comprehensive analysis of the existing flash loan protocols reveals significant differences in their implementations, including:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Inconsistent syntax for initiating flash loans across different platforms.&lt;&#x2F;li&gt;
&lt;li&gt;Variations in the relationship between the loan receiver and the callback receiver, with some protocols allowing different addresses for each role while others do not.&lt;&#x2F;li&gt;
&lt;li&gt;Divergent repayment mechanisms, with some lenders pulling the principal and fee from the loan receiver and others requiring the loan receiver to manually return the funds.&lt;&#x2F;li&gt;
&lt;li&gt;Disparities in the treatment of flash minting, where some lenders allow the creation of any amount of their native asset without charging a fee, effectively permitting flash loans bounded by computational constraints rather than asset ownership limitations.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;To address these inconsistencies and promote a more efficient and accessible flash loan ecosystem, this ERC specifies a standardized interface that encompasses the maximum flexibility required by both lenders and borrowers. By consolidating the various approaches into a unified standard, this proposal aims to streamline the integration process, enabling borrowers to seamlessly switch between flash lenders without the need for code modifications.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;Under this standard a flash loan is a loan of an &lt;code&gt;amount&lt;&#x2F;code&gt; of an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; &lt;code&gt;asset&lt;&#x2F;code&gt; from a &lt;code&gt;lender&lt;&#x2F;code&gt;. This loan can remain open for the span of a single &lt;code&gt;flash&lt;&#x2F;code&gt; call in the &lt;code&gt;lender&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This &lt;code&gt;amount&lt;&#x2F;code&gt; plus a &lt;code&gt;fee&lt;&#x2F;code&gt; defined by the &lt;code&gt;lender&lt;&#x2F;code&gt; in the same &lt;code&gt;asset&lt;&#x2F;code&gt; must be repaid before the end of &lt;code&gt;flash&lt;&#x2F;code&gt; call at a &lt;em&gt;repayment receiver&lt;&#x2F;em&gt; address defined by the &lt;code&gt;lender&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;flash&lt;&#x2F;code&gt; function is called by the &lt;code&gt;initiator&lt;&#x2F;code&gt;, who defines the &lt;em&gt;loan receiver&lt;&#x2F;em&gt;, the &lt;em&gt;callback receiver&lt;&#x2F;em&gt;, the &lt;em&gt;callback function&lt;&#x2F;em&gt;, the &lt;code&gt;asset&lt;&#x2F;code&gt; and the &lt;code&gt;amount&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;When the &lt;code&gt;initiator&lt;&#x2F;code&gt; calls &lt;code&gt;flash&lt;&#x2F;code&gt; in a &lt;code&gt;lender&lt;&#x2F;code&gt;. The &lt;code&gt;lender&lt;&#x2F;code&gt; will then transfer the &lt;code&gt;amount&lt;&#x2F;code&gt; of &lt;code&gt;asset&lt;&#x2F;code&gt; to the &lt;em&gt;loan receiver&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;lender&lt;&#x2F;code&gt;, after transferring &lt;code&gt;amount&lt;&#x2F;code&gt; of &lt;code&gt;asset&lt;&#x2F;code&gt; to the &lt;em&gt;loan receiver&lt;&#x2F;em&gt;, will execute the &lt;em&gt;callback function&lt;&#x2F;em&gt; on the &lt;em&gt;callback receiver&lt;&#x2F;em&gt;. The &lt;code&gt;lender&lt;&#x2F;code&gt; will include in this &lt;em&gt;callback function&lt;&#x2F;em&gt; call a number of parameters related to the loan as defined in this standard.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;amount&lt;&#x2F;code&gt; and &lt;code&gt;fee&lt;&#x2F;code&gt; need to be transferred to a &lt;code&gt;repayment receiver&lt;&#x2F;code&gt; before the end of the &lt;code&gt;flash&lt;&#x2F;code&gt; call. The &lt;code&gt;fee&lt;&#x2F;code&gt; can be set to zero &lt;code&gt;asset&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;em&gt;callback function&lt;&#x2F;em&gt; can return any arbitrary data which will be received by the &lt;code&gt;initiator&lt;&#x2F;code&gt; as the return value of the &lt;code&gt;flash&lt;&#x2F;code&gt; call.&lt;&#x2F;p&gt;
&lt;p&gt;The lender decides which &lt;code&gt;assets&lt;&#x2F;code&gt; to support. The lender can decide to support all possible assets.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;lender-specification&quot;&gt;Lender Specification&lt;&#x2F;h3&gt;
&lt;p&gt;A &lt;code&gt;lender&lt;&#x2F;code&gt; MUST implement the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7399&#x2F;&quot;&gt;ERC-7399&lt;&#x2F;a&gt; interface.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; &amp;gt;=0.6.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0.9&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; { &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC20&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERC20.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7399&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of currency available to be lent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; asset&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The loan currency.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; amount of `asset` that can be borrowed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; maxFlashLoan&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; asset&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The fee to be charged for a given loan. Returns type(uint256).max if the loan is not possible.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; asset&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The loan currency.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of assets lent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; amount of `asset` to be charged for the loan, on top of the returned principal.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; flashFee&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        IERC20&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; asset&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Initiate a flash loan.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; loanReceiver&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address receiving the flash loan&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; asset&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The asset to be loaned&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount to loaned&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ABI encoded user data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; callback&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address and signature of the callback function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; result&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ABI encoded result of the callback&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; flash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; loanReceiver&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        ERC20&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; asset&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @dev callback. This is a combination of the callback receiver address, and the signature of callback&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; function. It is encoded packed as 20 bytes + 4 bytes.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @dev the return of the callback function is not encoded in the parameter, but must be `returns (bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; memory)` for compliance with the standard.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @param initiator The address that called this function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @param paymentReceiver The address that needs to receive the amount plus fee at the end of the callback&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @param asset The asset to be loaned&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @param amount The amount to loaned&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @param fee The fee to be paid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @param data The ABI encoded data to be passed to the callback&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @return result ABI encoded result of the callback&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; IERC20&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; callback&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;maxFlashLoan&lt;&#x2F;code&gt; function MUST return the maximum available loan for &lt;code&gt;asset&lt;&#x2F;code&gt;. The &lt;code&gt;maxFlashLoan&lt;&#x2F;code&gt; function MUST NOT revert. If no flash loans for the specified &lt;code&gt;asset&lt;&#x2F;code&gt; are possible, the value returned MUST be zero.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;flashFee&lt;&#x2F;code&gt; function MUST return the fee charged for a loan of &lt;code&gt;amount&lt;&#x2F;code&gt; &lt;code&gt;asset&lt;&#x2F;code&gt;. The &lt;code&gt;flashFee&lt;&#x2F;code&gt; function MUST NOT revert. If a flash loan for the specified &lt;code&gt;asset&lt;&#x2F;code&gt; and &lt;code&gt;amount&lt;&#x2F;code&gt; is not possible, the value returned MUST be &lt;code&gt;type(uint256).max&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;flash&lt;&#x2F;code&gt; function MUST execute the callback passed on as an argument.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; result &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; callback&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; asset&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _fee&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;flash&lt;&#x2F;code&gt; function MUST transfer &lt;code&gt;amount&lt;&#x2F;code&gt; of &lt;code&gt;asset&lt;&#x2F;code&gt; to &lt;em&gt;loan receiver&lt;&#x2F;em&gt; before executing the callback.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;flash&lt;&#x2F;code&gt; function MUST include &lt;code&gt;msg.sender&lt;&#x2F;code&gt; as the &lt;code&gt;initiator&lt;&#x2F;code&gt; in the callback.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;flash&lt;&#x2F;code&gt; function MUST NOT modify the &lt;code&gt;asset&lt;&#x2F;code&gt;, &lt;code&gt;amount&lt;&#x2F;code&gt; and &lt;code&gt;data&lt;&#x2F;code&gt; parameter received, and MUST pass them on to the callback.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;flash&lt;&#x2F;code&gt; function MUST include a &lt;code&gt;fee&lt;&#x2F;code&gt; argument in the callback with the fee to pay for the loan on top of the principal, ensuring that &lt;code&gt;fee == flashFee(asset, amount)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Before the end of the callback, the &lt;code&gt;asset&lt;&#x2F;code&gt; balance of &lt;code&gt;payment receiver&lt;&#x2F;code&gt; MUST have increased by &lt;code&gt;amount + fee&lt;&#x2F;code&gt; from the amount at the beginning of the callback, or revert if this is not true.&lt;&#x2F;p&gt;
&lt;p&gt;The return of the &lt;code&gt;flash&lt;&#x2F;code&gt; function MUST be the same as the return from the callback.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;receiver-specification&quot;&gt;Receiver Specification&lt;&#x2F;h3&gt;
&lt;p&gt;A &lt;em&gt;callback receiver&lt;&#x2F;em&gt; of flash loans MUST implement one or more external functions with the following arguments and return value:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function can have any name and be overloaded.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; initiator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address that called this function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; paymentReceiver&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address that needs to receive the amount plus fee at the end of the callback&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; asset&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The asset to be loaned&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount to loaned&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The fee to be paid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ABI encoded data to be passed to the callback&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; result&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ABI encoded result of the callback&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; IERC20&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; callback&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The interfaces described in this ERC have been chosen as to cover the known flash lending use cases, while allowing for safe and gas efficient implementations.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;maxFlashLoan&lt;&#x2F;code&gt; and &lt;code&gt;flashFee&lt;&#x2F;code&gt; return numerical values on impossible loans to allow sorting lenders without having to deal with reverts.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;maxFlashLoan&lt;&#x2F;code&gt; returns a value that is consistent with an impossible loan when the &lt;code&gt;lender&lt;&#x2F;code&gt; is not able to serve the loan.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;flashFee&lt;&#x2F;code&gt; returns a value that is consistent with an impossible loan when the &lt;code&gt;lender&lt;&#x2F;code&gt; is not able to serve the loan.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;flash&lt;&#x2F;code&gt; has been chosen as a function name as a verb which is descriptive enough, unlikely to clash with other functions in the &lt;code&gt;lender&lt;&#x2F;code&gt;, and including both the use cases in which the assets lent are held or minted by the &lt;code&gt;lender&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Existing flash lenders all provide flash loans of several asset types from the same contract. Providing a &lt;code&gt;asset&lt;&#x2F;code&gt; parameter in both the &lt;code&gt;flash&lt;&#x2F;code&gt; and callback functions matches closely the observed functionality.&lt;&#x2F;p&gt;
&lt;p&gt;A &lt;code&gt;bytes calldata data&lt;&#x2F;code&gt; parameter is included for the &lt;code&gt;initiator&lt;&#x2F;code&gt; to pass arbitrary information to the &lt;code&gt;receiver&lt;&#x2F;code&gt;. The &lt;code&gt;receiver&lt;&#x2F;code&gt; can pass arbitrary information back to the &lt;code&gt;initiator&lt;&#x2F;code&gt; using the &lt;code&gt;bytes memory&lt;&#x2F;code&gt; return value.&lt;&#x2F;p&gt;
&lt;p&gt;A &lt;code&gt;initiator&lt;&#x2F;code&gt; will often be required in the callback function, which the &lt;code&gt;lender&lt;&#x2F;code&gt; knows as &lt;code&gt;msg.sender&lt;&#x2F;code&gt;. An alternative implementation which would embed the &lt;code&gt;initiator&lt;&#x2F;code&gt; in the &lt;code&gt;data&lt;&#x2F;code&gt; parameter by the caller would require an additional mechanism for the receiver to verify its accuracy, and is not advisable.&lt;&#x2F;p&gt;
&lt;p&gt;A &lt;em&gt;loan receiver&lt;&#x2F;em&gt; is taken as a parameter to allow flexibility on the implementation of separate loan initiators, loan receivers, and callback receivers. This parameter is not passed on to the &lt;em&gt;callback receiver&lt;&#x2F;em&gt; on the grounds that it will be often the same as &lt;em&gt;callback receiver&lt;&#x2F;em&gt; and when not, it can be encoded in the &lt;code&gt;data&lt;&#x2F;code&gt; by the &lt;code&gt;initiator&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;A &lt;code&gt;payment receiver&lt;&#x2F;code&gt; allows for the same flexibility on repayments as in borrows. Control flow and asset flow are independent.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;amount&lt;&#x2F;code&gt; will be required in the callback function, which the &lt;code&gt;lender&lt;&#x2F;code&gt; took as a parameter. An alternative implementation which would embed the &lt;code&gt;amount&lt;&#x2F;code&gt; in the &lt;code&gt;data&lt;&#x2F;code&gt; parameter by the caller would require an additional mechanism for the receiver to verify its accuracy, and is not advisable.&lt;&#x2F;p&gt;
&lt;p&gt;A &lt;code&gt;fee&lt;&#x2F;code&gt; will often be calculated in the callback function, which the callback receiver must be aware of for repayment. Passing the &lt;code&gt;fee&lt;&#x2F;code&gt; as a parameter instead of appended to &lt;code&gt;data&lt;&#x2F;code&gt; is simple and effective.&lt;&#x2F;p&gt;
&lt;p&gt;Arbitrary callback functions on callback receivers allows to implement different behaviours to flash loans on callback receivers without the need for encoding a function router using the &lt;code&gt;data&lt;&#x2F;code&gt; argument. A function call type is 24 bytes of which the first 20 bytes are the target address and the last 4 bytes are the function signature.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;amount + fee&lt;&#x2F;code&gt; are pushed to the &lt;code&gt;payment receiver&lt;&#x2F;code&gt; to allow for the segregation of asset and control flows. While a &quot;pull&quot; architecture is more prevalent, &quot;push&quot; architectures are also common. For those cases where the &lt;code&gt;lender&lt;&#x2F;code&gt; can&#x27;t implement a &quot;push&quot; architecture, a simple wrapper contract can offer this proposal&#x27;s external interface, while using liquidity from the &lt;code&gt;lender&lt;&#x2F;code&gt; using a &quot;pull&quot; architecture.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is a successor of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3156&#x2F;&quot;&gt;ERC-3156&lt;&#x2F;a&gt;. While not directly backwards compatible, a wrapper contract offering this proposal&#x27;s external interface with liquidity obtained from an ERC-3156 flash &lt;code&gt;lender&lt;&#x2F;code&gt; is trivial to implement.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;verification-of-callback-arguments&quot;&gt;Verification of callback arguments&lt;&#x2F;h3&gt;
&lt;p&gt;The arguments of the flash loan callbacks are expected to reflect the conditions of the flash loan, but cannot be trusted unconditionally. They can be divided in two groups, that require different checks before they can be trusted to be genuine.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;No arguments can be assumed to be genuine without some kind of verification. &lt;code&gt;initiator&lt;&#x2F;code&gt;, &lt;code&gt;asset&lt;&#x2F;code&gt; and &lt;code&gt;amount&lt;&#x2F;code&gt; refer to a past transaction that might not have happened if the caller of the callback decides to lie. &lt;code&gt;fee&lt;&#x2F;code&gt; might be false or calculated incorrectly. &lt;code&gt;data&lt;&#x2F;code&gt; might have been manipulated by the caller.&lt;&#x2F;li&gt;
&lt;li&gt;To trust that the value of &lt;code&gt;initiator&lt;&#x2F;code&gt;, &lt;code&gt;asset&lt;&#x2F;code&gt;, &lt;code&gt;amount&lt;&#x2F;code&gt; and &lt;code&gt;fee&lt;&#x2F;code&gt; are genuine a reasonable pattern is to verify that the callback caller is in a whitelist of verified flash lenders. Since often the caller of &lt;code&gt;flash&lt;&#x2F;code&gt; will also be receiving the callback this will be trivial. In all other cases flash lenders will need to be approved if the arguments in the callback are to be trusted.&lt;&#x2F;li&gt;
&lt;li&gt;To trust that the value of &lt;code&gt;data&lt;&#x2F;code&gt; is genuine, in addition to the check in point 1, it is recommended to verify that the &lt;code&gt;initiator&lt;&#x2F;code&gt; belongs to a group of trusted addresses. Trusting the &lt;code&gt;lender&lt;&#x2F;code&gt; and the &lt;code&gt;initiator&lt;&#x2F;code&gt; is enough to trust that the contents of &lt;code&gt;data&lt;&#x2F;code&gt; are genuine.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;flash-lending-security-considerations&quot;&gt;Flash lending security considerations&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;automatic-approvals&quot;&gt;Automatic approvals&lt;&#x2F;h4&gt;
&lt;p&gt;Any &lt;code&gt;receiver&lt;&#x2F;code&gt; that repays the &lt;code&gt;amount&lt;&#x2F;code&gt; and &lt;code&gt;fee&lt;&#x2F;code&gt; received as arguments needs to include in the callback a mechanism to verify that the initiator and &lt;code&gt;lender&lt;&#x2F;code&gt; are trusted.&lt;&#x2F;p&gt;
&lt;p&gt;Alternatively, the callback receiver can implement permissioned functions that set state variables indicating that a flash loan has been initiated and what to expect as &lt;code&gt;amount&lt;&#x2F;code&gt; and &lt;code&gt;fee&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Alternatively, the callback receiver can verify that &lt;code&gt;amount&lt;&#x2F;code&gt; was received by the &lt;code&gt;loanReceiver&lt;&#x2F;code&gt; and use its own heuristics to determine if a &lt;code&gt;fee&lt;&#x2F;code&gt; is fair and the loan repaid, or the transaction reverted.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;flash-minting-external-security-considerations&quot;&gt;Flash minting external security considerations&lt;&#x2F;h3&gt;
&lt;p&gt;The typical quantum of assets involved in flash mint transactions will give rise to new innovative attack vectors.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;spot-oracle-manipulation&quot;&gt;Spot Oracle Manipulation&lt;&#x2F;h4&gt;
&lt;p&gt;The supply of a flash-mintable asset can be easily manipulated, so oracles that take the supply of the flash-mintable asset into account must either discount amounts that were flash-minted, produce data that is averaged over time, or find some other solution to the varying supply.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;arithmetic-overflow-and-underflow&quot;&gt;Arithmetic Overflow and Underflow&lt;&#x2F;h4&gt;
&lt;p&gt;If the flash mint provider does not place any limits on the amount of flash mintable assets in a transaction, then anyone can flash mint $2^256-1$ amount of assets.&lt;&#x2F;p&gt;
&lt;p&gt;The protocols on the receiving end of the flash mints will need to ensure their contracts can handle this, either by using a compiler that embeds overflow protection in the smart contract bytecode, or by setting explicit checks.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;flash-minting-internal-security-considerations&quot;&gt;Flash minting internal security considerations&lt;&#x2F;h3&gt;
&lt;p&gt;The coupling of flash minting with business specific features in the same platform can easily lead to unintended consequences.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;treasury-draining&quot;&gt;Treasury Draining&lt;&#x2F;h4&gt;
&lt;p&gt;Assume a smart contract that flash lends its native asset. The same smart contract borrows from a third party when users burn the native asset. This pattern would be used to aggregate in the smart contract the collateralized debt of several users into a single account in the third party. The flash mint could be used to cause the &lt;code&gt;lender&lt;&#x2F;code&gt; to borrow to its limit, and then pushing interest rates in the underlying &lt;code&gt;lender&lt;&#x2F;code&gt;, liquidate the flash &lt;code&gt;lender&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Flash mint from &lt;code&gt;lender&lt;&#x2F;code&gt; a very large amount of FOO.&lt;&#x2F;li&gt;
&lt;li&gt;Redeem FOO for BAR, causing &lt;code&gt;lender&lt;&#x2F;code&gt; to borrow from &lt;code&gt;underwriter&lt;&#x2F;code&gt; all the way to its borrowing limit.&lt;&#x2F;li&gt;
&lt;li&gt;Trigger a debt rate increase in &lt;code&gt;underwriter&lt;&#x2F;code&gt;, making &lt;code&gt;lender&lt;&#x2F;code&gt; undercollateralized.&lt;&#x2F;li&gt;
&lt;li&gt;Liquidate the &lt;code&gt;lender&lt;&#x2F;code&gt; for profit.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Multi-Namespace Onchain Registry</title>
        <published>2023-07-23T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Mengshi Zhang</name><uri>https://github.com/MengshiZhang</uri>
	</author>
	
	<author>
		<name>Zihao Chen</name><uri>https://github.com/zihaoccc</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7406/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7406-multi-namespace-onchain-registry/15216" />
        

        <id>https://wg-eips.ritovision.com/7406/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:7406"
            label="ERC-7406" />
        

        
        

        
        <summary type="html">An universally accepted multi-namespace registry with mapping structures on the Ethereum</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7406/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes a universally accepted description for onchain registry entries with support for multi-namespaces, where each entry is structured as a mapping type. The multi-namespace registry enables the storage of a collection of key-value mappings within the blockchain, serving as a definitive source of information with a traceable history of changes. These mapping records act as pointers combined with onchain assets, offering enhanced versatility in various use cases by encapsulating extensive details. The proposed solution introduces a general mapping data structure that is flexible enough to support and be compatible with different situations, providing a more scalable and powerful alternative to current ENS-like registries.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Blockchain-based registries are fundamental components for decentralized applications, enabling the storage and retrieval of essential information. Existing solutions, like the ENS registry, serve specific use cases but may lack the necessary flexibility to accommodate more complex scenarios. The need for a more general mapping data structure with multi-namespace support arises to empower developers with a single registry capable of handling diverse use cases efficiently.&lt;&#x2F;p&gt;
&lt;p&gt;The proposed multi-namespace registry offers several key advantages:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Versatility&lt;&#x2F;strong&gt;: Developers can define and manage multiple namespaces, each with its distinct set of keys, allowing for more granular control and organization of data. For instance, single same key can derive as different pointers to various values based on difference namespaces, which a namespace can be specified as a session type, if this registry stores sessions, or short URL -&amp;gt; full URL mapping is registry stores such type of data.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Traceable History&lt;&#x2F;strong&gt;: By leveraging multi-namespace capabilities, the registry can support entry versioning by using multi-namespace distinct as version number, enabling tracking of data change history, reverting data, or data tombstoning. This facilitates data management and governance within a single contract.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Enhanced Compatibility&lt;&#x2F;strong&gt;: The proposed structure is designed to be compatible with various use cases beyond the scope of traditional ENS-like registries, promoting its adoption in diverse decentralized applications.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;registry-specification&quot;&gt;&lt;strong&gt;Registry specification&lt;&#x2F;strong&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The multi namespace registry contract exposes the following functions:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;Returns the owner of the specified &lt;strong&gt;key&lt;&#x2F;strong&gt; under the given &lt;strong&gt;namespace&lt;&#x2F;strong&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; resolver&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;Returns the resolver address for the specified &lt;strong&gt;key&lt;&#x2F;strong&gt; under the given &lt;strong&gt;namespace&lt;&#x2F;strong&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newOwner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;Transfers ownership of the &lt;strong&gt;key&lt;&#x2F;strong&gt; under the specified &lt;strong&gt;namespace&lt;&#x2F;strong&gt; to another owner. This function may only be called by the current owner of the &lt;strong&gt;key&lt;&#x2F;strong&gt; under a specific &lt;strong&gt;namespace&lt;&#x2F;strong&gt;. The same &lt;strong&gt;key&lt;&#x2F;strong&gt; under different &lt;strong&gt;namespaces&lt;&#x2F;strong&gt; may have different owners. A successful call to this function logs the event &lt;strong&gt;Transfer(bytes32 namespace, bytes32 key, address newOwner)&lt;&#x2F;strong&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; createNamespace&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; namespace&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;Create a new &lt;strong&gt;namespace&lt;&#x2F;strong&gt; such as a new version or a new type of protocol in current registry. A successful call to this function logs the event &lt;strong&gt;NewNamespace(bytes32 namespace)&lt;&#x2F;strong&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setResolver&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newResolver&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;Sets the resolver address for the &lt;strong&gt;key&lt;&#x2F;strong&gt; under the given &lt;strong&gt;namespace&lt;&#x2F;strong&gt;. This function may only be called by the owner of the key under a specific &lt;strong&gt;namespace&lt;&#x2F;strong&gt;. The same key under different namespaces may have different resolvers. A successful call to this function logs the event &lt;strong&gt;NewResolver(bytes32 namespace, bytes32 key, address newResolver)&lt;&#x2F;strong&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;resolver-specification&quot;&gt;&lt;strong&gt;Resolver specification&lt;&#x2F;strong&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The multi-namespace resolver contract can utilize the same specification as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;137&#x2F;&quot;&gt;ERC-137&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;By supporting multiple namespaces, the registry caters to various use cases, including but not limited to identity management, session management, record tracking, and decentralized content publishing. This flexibility enables developers to design and implement more complex decentralized applications with ease.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;As this EIP introduces a new feature and does not modify any existing behaviors, there are no backwards compatibility issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;appendix-a-registry-implementation&quot;&gt;&lt;em&gt;Appendix A: Registry Implementation&lt;&#x2F;em&gt;&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.12&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERC7406Interface.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC7406&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Record&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; resolver&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A map is used to record namespace existence&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;byte32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; namespaces&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;Record&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; records&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NewOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; namespace&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; namespace&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NewResolver&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; namespace&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; resolver&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NewNamespace&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; namespace&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    modifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; only_owner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;records&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;namespace&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;key&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;owner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; throw&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        _&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    modifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; only_approver&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;records&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;owner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; throw&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        _&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC7406&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approver&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        records&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;owner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; approver&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; records&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;namespace&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;key&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; createNamespace&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; namespace&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; only_approver&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;       if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;status &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; throw&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;       NewNamespace&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;namespace&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;       if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;namespaces&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;namespace&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;           return&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;       }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;       namespaces&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;namespace&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; resolver&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;namespaces&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;namespace&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; throw&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; records&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;namespace&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;key&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;resolver&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; only_owner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        records&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;namespace&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;key&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;owner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setResolver&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; resolver&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; only_approver&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;namespaces&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;namespace&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;createNamespace&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        NewResolver&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; resolver&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        records&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;namespace&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;key&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;resolver &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; resolver&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The proposed multi-namespace registry introduces several security considerations due to its ability to manage various namespaces and access controls. Thorough testing, auditing, and peer reviews will be conducted to identify and mitigate potential attack vectors and vulnerabilities. Security-conscious developers are encouraged to contribute to the audit process.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Add time-weighted averaging to the base fee</title>
        <published>2023-07-22T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Guy Goren</name><uri>https://github.com/guy-goren</uri><email>guy.nahsholim@gmail.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7378/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/add-time-weighted-averaging-to-the-base-fee-mechanism/15142" />
        

        <id>https://wg-eips.ritovision.com/7378/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:7378"
            label="EIP-7378" />
        

        
        

        
        <summary type="html">Using geometric weights to average past block sizes into consideration</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7378/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes a new formula to update the base fee, derived from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt;. The existing base fee update formula,&lt;&#x2F;p&gt;
&lt;p&gt;$$b[i+1]\triangleq  b[i] \cdot \left( 1+\frac{1}{8} \cdot \frac{s[i]-s^* }{s^* }\right)$$&lt;&#x2F;p&gt;
&lt;p&gt;only considers the last block size $s[i]$. This mechanism incentivizes proposers to collude with users to manipulate the base fee.&lt;&#x2F;p&gt;
&lt;p&gt;We propose that even previous block sizes be considered by replacing the last block size with an exponential moving average. In particular, we suggest the following base fee update formula:&lt;&#x2F;p&gt;
&lt;p&gt;$$b[i+1]\triangleq  b[i] \cdot \left( 1+\frac{1}{8} \cdot \frac{s_{\textit{avg}}[i]-s^* }{s^* }\right)$$&lt;&#x2F;p&gt;
&lt;p&gt;where $s_{\textit{avg}}[i]$ is defined by:&lt;&#x2F;p&gt;
&lt;p&gt;$$s_{\textit{avg}}[i] \triangleq \alpha\sum_{k=1}^{\infty} (1-\alpha)^k\cdot s[i-k+1]$$&lt;&#x2F;p&gt;
&lt;p&gt;and $\alpha\in(0,1)$ is a smoothing factor.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;To reduce bribe motivation when the demand for blockspace is high (see Incentive Considerations section) and to reduce oscillations, thus, having a more stable fee setting mechanism.&lt;&#x2F;p&gt;
&lt;p&gt;Proposers use a mechanism described in EIP-1559 to determine which messages to include in a block. This mechanism includes a &quot;base fee&quot;: a portion of the transaction fee that is burned. The base fee varies according to the fill rate of blocks. A target block size is defined. If a block exceeds the target size, the base fee increases, and if it is smaller, the base fee lowers.&lt;&#x2F;p&gt;
&lt;p&gt;Research on the subject have revealed issues with this transaction fee mechanism. It has been shown to be &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7378&#x2F;.&#x2F;assets&#x2F;LMRSP.pdf&quot;&gt;unstable in cases&lt;&#x2F;a&gt;. Moreover, it has been shown that the dynamic nature of the base fee, which is influenced by the fill rate of blocks, opens the door for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7378&#x2F;.&#x2F;assets&#x2F;AGHH.pdf&quot;&gt;manipulation by miners (proposers) and users&lt;&#x2F;a&gt;. The desired behavior of the system under a stable high demand, is for it to reach an equilibrium where the base fee -- $b$ -- is the significant part of the gas fee, and the tip is relatively small -- denoted $\varepsilon$ (for reference, Ethereum&#x27;s base fee often has $\frac{b}{\varepsilon}\approx 20$). According to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7378&#x2F;.&#x2F;assets&#x2F;TR1559.pdf&quot;&gt;Roughgarden&lt;&#x2F;a&gt; this is a rational equilibrium under the assumption that proposers do not think ahead. However, we expect a proposer to optimize its behavior by also considering its future payoffs. In essence, since neither the proposer nor the user are getting the burnt fee, by colluding they can both tap into the burnt fee for a win-win situation for them both.&lt;&#x2F;p&gt;
&lt;p&gt;A &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7378&#x2F;.&#x2F;assets&#x2F;AGHH.pdf&quot;&gt;theoretical work&lt;&#x2F;a&gt; describes how both proposers and users can initiate such an attack. For example, we can imagine that users who wish to pay lower costs will coordinate the attack. Roughly, a user (or group of users) that has transactions with a total $g$ amount of gas bribes the proposer of the current block (no matter the proposer&#x27;s power) to propose an empty block instead. The cost of such a bribe is only $\varepsilon \times {s^* }$ -- the tip times the target block size. Consequently, the base fee reduces in the next block. If we accept that EIP-1559 reaches its goals, e.g., users would typically use a simple and honest bidding strategy of reporting their maximal willingness to pay plus adding a small tip ($\varepsilon$), then in the honest users&#x27; steady state, gas proposals leave the proposers with an $\varepsilon$ tip. Given that other users are naive (or slow to react), our bribing user will include its transactions with any tip larger than $\varepsilon$ -- making the attack profitable whenever $g \frac{b^* }{8} &amp;gt;s^* \varepsilon$.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;$s[i]$ is replaced by $s_{\textit{avg}}[i]$, where:&lt;&#x2F;p&gt;
&lt;p&gt;$$s_{\textit{avg}}[i] \triangleq \alpha\sum_{k=1}^{\infty} (1-\alpha)^k\cdot s[i-k+1]$$&lt;&#x2F;p&gt;
&lt;p&gt;which simplifies to the recursive form&lt;&#x2F;p&gt;
&lt;p&gt;$$s_{\textit{avg}}[i] = \alpha\cdot s[i] + (1-\alpha)\cdot s_{\textit{avg}}[i-1]$$&lt;&#x2F;p&gt;
&lt;p&gt;where $\alpha\in(0, 1)$ is the smoothing factor. A higher smoothing factor means that the average responds more quickly to changes in block size (e.g., if $\alpha = 1$ the proposed formula degenerates to the existing rule).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;An intuitive option for the Transaction Fee Mechanism (TFM) that adjusts supply and demand economically is &lt;em&gt;First price auction&lt;&#x2F;em&gt;, which is well known and studied. Nevertheless, the Ethereum network choice was to use EIP-1559 for the TFM (one stated reason was to try and simplify the fee estimation for users, and reduce the advantage of sophisticated users). In this proposal, our design goal is to improve the TFM (of EIP-1559) by mitigating known problems that it raises. It is important to note that these problems severity are in direct relation to the demand for block space, and currently only mildly impact the Ethereum network. If demand to use Ethereum increases, however, these problems are expected to exacerbate. We may want to prepare for this beforehand.&lt;&#x2F;p&gt;
&lt;p&gt;The change is based on &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7378&#x2F;.&#x2F;assets&#x2F;AGHH.pdf&quot;&gt;this work&lt;&#x2F;a&gt; that described a rational strategy in which bribes are profitable. Choosing to average based on a geometric series weights results in two desired properties: (i) the computation and space complexity are both in O(1), and (ii) the average gradually phases out the impact of a single outlier block without causing significant future fluctuations in the base fee.
Moreover, the theoretical analysis does not consider the income from classic MEV strategies. (Actually, the described strategy may be seen as another form of MEV.) The fact that classic MEV (sandwich, front running, etc.) are not included in the analysis, means that the proposed solutions to classic MEV (obscuring transactions etc.) will also not help against the described strategy. The problem that we tackle in this EIP is at the core of the base fee mechanism, with no further assumptions (such as MEV or predictability of randomness).&lt;&#x2F;p&gt;
&lt;p&gt;Remark: An additional alternative strategy that is not fully discussed &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7378&#x2F;.&#x2F;assets&#x2F;AGHH.pdf&quot;&gt;here&lt;&#x2F;a&gt; but one may consider is to reduce the &#x27;max change denominator&#x27; (the learning rate) from 1&#x2F;8 to something smaller. However, this is problematic since it significantly affects the responsiveness of the base fee, making it slow to respond to actual persistent changes. The reason for using geometric series weights is precisely to achieve the favorable tradeoff of still responding quickly while mitigating incentive misalignments.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;incentive-considerations&quot;&gt;Incentive Considerations&lt;&#x2F;h3&gt;
&lt;p&gt;The proposal is designed to improve the incentive compatibility of the TFM. A &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7378&#x2F;.&#x2F;assets&#x2F;AGHH.pdf&quot;&gt;game theoretic analysis&lt;&#x2F;a&gt; shows that the current TFM, which is based on EIP-1559, encourages bribes.&lt;&#x2F;p&gt;
&lt;p&gt;One of the main goals of EIP-1559 was to simplify the bidding for users. It was articulated &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7378&#x2F;.&#x2F;assets&#x2F;TR1559.pdf&quot;&gt;theoretically by Roughgarden&lt;&#x2F;a&gt; as users bidding their honest valuations being an optimal strategy. In contrast, when using first price auctions for the TFM (as done by Bitcoin and previously in Ethereum), it is typically sub-optimal for a user to bid its honest valuation. In other words, a TFM that encourages users to not fully reveal their preferences is considered less good. However, one may argue that a TFM that encourages bribes is worse than a TFM that encourages not revealing one&#x27;s full preferences.&lt;&#x2F;p&gt;
&lt;p&gt;Although a first price auction is a safe bet regarding TFMs, the Ethereum network chose to use EIP-1559 and burn transaction fees (perhaps for reasons other than game-theoretic ones). We therefore suggest to mitigate the current incentives for bribes using the above proposal.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change requires a hard fork since the base fee is enforced (for blocks to be considered valid).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Migration Transaction</title>
        <published>2023-07-21T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>lightclient</name><uri>https://github.com/lightclient</uri>
	</author>
	
	<author>
		<name>Sam Wilson</name><uri>https://github.com/samwilsn</uri>
	</author>
	
	<author>
		<name>Ansgar Dietrichs</name><uri>https://github.com/adietrichs</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7377/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-xxxx-migration-transaction/15144" />
        

        <id>https://wg-eips.ritovision.com/7377/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:7377"
            label="EIP-7377" />
        

        
        

        
        <summary type="html">Allow EOAs to send a one-time transaction which deploys code at their account.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7377/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce a new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; transaction type with the format &lt;code&gt;0x04 || rlp([chainId, nonce, maxFeePerGas, maxPriorityFeePerGas, gasLimit, codeAddr, storage, data, value, accessList, yParity, r, s])&lt;&#x2F;code&gt; which sets the sending account&#x27;s &lt;code&gt;code&lt;&#x2F;code&gt; field in the state trie to the &lt;code&gt;code&lt;&#x2F;code&gt; value at &lt;code&gt;codeAddr&lt;&#x2F;code&gt; and applies the storage tuples to the sender&#x27;s storage trie.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Smart contract wallets have long been touted as the solution to Ethereum&#x27;s user experience woes. As early as 2015, there were proposals for allowing smart contracts to originate transactions in hopes that new users would flock to smart contract wallets to store their assets. So far, only a fraction of users have elected to do so.&lt;&#x2F;p&gt;
&lt;p&gt;Today, account abstraction is still an important goal in Ethereum and there are many efforts attempting to realize it. We&#x27;re getting closer to succeeding at this, but unfortunately the years of failure have caused many users to simply rely on EOA.&lt;&#x2F;p&gt;
&lt;p&gt;After a user has accumulated enough assets in an EOA, it is not tenable to migrate each individual asset to a new address. This is due both to the cost and to needing to manually sign and verify potentially hundreds of transactions.&lt;&#x2F;p&gt;
&lt;p&gt;This is an overlooked piece of the problem. Converting &lt;em&gt;existing&lt;&#x2F;em&gt; users to smart contract wallets efficiently will expedite adoption and push forward better support and integrations for smart contract wallets. They will no longer be dismissed as a niche use case.&lt;&#x2F;p&gt;
&lt;p&gt;Therefore, we must provide a mechanism, embedded in the protocol, to migrate EOAs to smart contracts. This EIP proposes such mechanism.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;At the fork block &lt;code&gt;X&lt;&#x2F;code&gt;, introduce the migration transaction type.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;migration-transaction&quot;&gt;Migration Transaction&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;definition&quot;&gt;Definition&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;field&lt;&#x2F;th&gt;&lt;th&gt;type&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;chainId&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint256&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;nonce&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint64&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;maxFeePerGas&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint256&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;maxPriorityFeePerGas&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint256&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;gasLimit&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint64&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;codeAddr&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;address&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;storage&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;List[Tuple[uint256, uint256]]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;data&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;bytes&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;value&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint256&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;accessList&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;List[Tuple[address, List[uint256]]]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;yParity&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint8&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;r&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint256&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;s&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint256&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The EIP-2718 &lt;code&gt;TransactionType&lt;&#x2F;code&gt; is &lt;code&gt;0x04&lt;&#x2F;code&gt; and the &lt;code&gt;TransactionPayload&lt;&#x2F;code&gt; is &lt;code&gt;rlp([chainId, nonce, maxFeePerGas, maxPriorityFeePerGas, gasLimit, codeAddr, storage, data, value, accessList, yParity, r, s])&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The transaction&#x27;s signature hash is &lt;code&gt;keccak256(0x04 || rlp([chainId, nonce, maxFeePerGas, maxPriorityFeePerGas, gasLimit, codeAddr, storage, data, value, accessList])&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;validation&quot;&gt;Validation&lt;&#x2F;h4&gt;
&lt;p&gt;A migration transaction is considered valid if the follow properties hold:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;all &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; properties, unless specified otherwise&lt;&#x2F;li&gt;
&lt;li&gt;the code at &lt;code&gt;codeAddr&lt;&#x2F;code&gt; is less than the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;170&#x2F;&quot;&gt;EIP-170&lt;&#x2F;a&gt; limit of &lt;code&gt;24576&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;the code at &lt;code&gt;codeAddr&lt;&#x2F;code&gt; must not have size &lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The intrinsic gas calculation modified from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; to be &lt;code&gt;21000 + 16 * non-zero calldata bytes + 4 * zero calldata bytes + 1900 * access list storage key count + 2400 * access list address count + 20000 * length of storage&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;processing&quot;&gt;Processing&lt;&#x2F;h4&gt;
&lt;p&gt;Executing a migration transaction has two parts.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;contract-deployment&quot;&gt;Contract Deployment&lt;&#x2F;h5&gt;
&lt;p&gt;Unlike standard contract deployment, a migration transaction directly specifies what &lt;code&gt;code&lt;&#x2F;code&gt; value the sender&#x27;s account should be set to.&lt;&#x2F;p&gt;
&lt;p&gt;As the first step of processing the transaction, set the sender&#x27;s &lt;code&gt;code&lt;&#x2F;code&gt; to &lt;code&gt;state[tx.codeAddr].code&lt;&#x2F;code&gt;. Next, for each tuple in &lt;code&gt;tx.storage&lt;&#x2F;code&gt; and the sender&#x27;s storage trie, set &lt;code&gt;storage[t.first] = t.second&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;transaction-execution&quot;&gt;Transaction Execution&lt;&#x2F;h5&gt;
&lt;p&gt;Now instantiate an EVM call into the sender&#x27;s account using the same rules as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; and set the transaction&#x27;s origin to be &lt;code&gt;keccak256(sender)[0..20]&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;no-to-address-field&quot;&gt;No &lt;code&gt;to&lt;&#x2F;code&gt; address field&lt;&#x2F;h3&gt;
&lt;p&gt;This transaction is only good for one-time use to migrate an EOA to a smart contract. It is designed to immediately call the deployed contract, which is at the sender&#x27;s address, after deployment to allow the sender to do any kind of further processing.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;code-pointer-for-deployment&quot;&gt;Code pointer for deployment&lt;&#x2F;h3&gt;
&lt;p&gt;Naively, one could design the migration transaction to have a field &lt;code&gt;code&lt;&#x2F;code&gt; of type &lt;code&gt;bytes&lt;&#x2F;code&gt;. However, there would be substantial duplication of code calldata, since many users will want to deploy the exact same thing (often a wallet). Using a pointer instead acknowledges this overwhelming use case for the transaction type, and exploits it as an optimization.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;cheaper-storage&quot;&gt;Cheaper storage&lt;&#x2F;h3&gt;
&lt;p&gt;Since the storage is guaranteed to be empty, there is no need to read before write. This means only 20,000 gas is needed to pay for the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2200&#x2F;&quot;&gt;EIP-2200&lt;&#x2F;a&gt; &lt;code&gt;SSTORE_SET_GAS&lt;&#x2F;code&gt; value. This is a small discount to the normal cost of &lt;code&gt;22,100&lt;&#x2F;code&gt;, which is &lt;code&gt;SSTORE_SET_GAS&lt;&#x2F;code&gt; plus the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt; &lt;code&gt;COLD_SLOAD_COST&lt;&#x2F;code&gt; of &lt;code&gt;2100&lt;&#x2F;code&gt;, because no load occurs.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;intrinsic-does-not-account-for-contract-deployment&quot;&gt;Intrinsic does not account for contract deployment&lt;&#x2F;h3&gt;
&lt;p&gt;This takes advantage of the fact that clients tend to store a single, unique copy of code; no matter the number of deployments. Therefore, the only operation here is changing a pointer in the state trie to the desired code.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, the EOA already exists because it has enough balance for the migration transaction to be considered valid. Therefore, we don&#x27;t need to pay a premium for adding a new account into the state trie.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;manipulating-transaction-origin&quot;&gt;Manipulating transaction origin&lt;&#x2F;h3&gt;
&lt;p&gt;Many applications have a security check &lt;code&gt;caller == origin&lt;&#x2F;code&gt; to verify the caller is an EOA. This is done to &quot;protect&quot; assets. While it is usually more of a bandage than an actual fix, we attempt to placate these projects by modifying the origin of the transaction so the check will continue performing its duty.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;one-time-migration&quot;&gt;One-time migration&lt;&#x2F;h3&gt;
&lt;p&gt;There is no technical reason we couldn&#x27;t allow EOAs to change their code at any time with this transaction type. The only inhibitor at the moment is &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3607&#x2F;&quot;&gt;EIP-3607&lt;&#x2F;a&gt; which will cause migration transactions to be considered invalid if they come from an account with code already deployed. A functional reason for retaining this behavior though is that it makes it simpler to reason about contracts and their upgradability.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;blind-signing&quot;&gt;Blind Signing&lt;&#x2F;h3&gt;
&lt;p&gt;As with all sufficiently sophisticated account designs, if a user can be convinced to sign an arbitrary message, that message could be a migration transaction which is owned by a malicious actor instead of the user. This can generally be avoided if wallets treat these transactions with &lt;em&gt;extreme&lt;&#x2F;em&gt; care and create as much friction and verification as possible before completing the signature.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;on-ecrecover&quot;&gt;On &lt;code&gt;ecrecover&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Applications standards such as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2612&#x2F;&quot;&gt;ERC-2612: Permit Extension&lt;&#x2F;a&gt; have exploited the cryptographic relationship between EOA addresses and their private keys. Many tokens today support this extension, allowing EOAs to approve the transfer of fund from their account using only a signature. Although collisions between EOAs and contract accounts are considered unlikely and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3607&#x2F;&quot;&gt;maybe impossible&lt;&#x2F;a&gt; given today&#x27;s computing power, this EIP would make it common place for private keys to exist for contract accounts. There are some considerations here regarding security:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The obvious attack is a defi protocol deploys some their contract using this EIP and later sign an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2612&#x2F;&quot;&gt;ERC-2612&lt;&#x2F;a&gt; message to steal the funds accrued in the contract. This can be avoided by wallets simply not allowing users to interact with protocols deployed in this manner.&lt;&#x2F;li&gt;
&lt;li&gt;It&#x27;s also worth mentioning that there are concerns around how this EIP will affect the cross chain experience. Ultimately a users private key may still have some control over the account&#x27;s assets, depending on the exact protocols used on Ethereum and on other chains. It isn&#x27;t really possible perfectly migrate the EOA at the same time, on all chains. The best thing that can be done is to educate the user that just because their account has been migrated doesn&#x27;t mean that they are safe to now publicly reveal their private key. This seems like a reasonable request, especially since they&#x27;ll want to retain the private key in case they want to use the address on any other EVM-like chain.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Something that may alleviate these issues to some degree would be to add an &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; check in &lt;code&gt;ecrecover&lt;&#x2F;code&gt;. If the recovered account has code, the precompile will revert. This would disallow migrated EOAs from using standards like &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2612&#x2F;&quot;&gt;ERC-2612&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Non-Fungible Token Roles</title>
        <published>2023-07-14T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Ernani São Thiago</name><uri>https://github.com/ernanirst</uri>
	</author>
	
	<author>
		<name>Daniel Lima</name><uri>https://github.com/karacurt</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7432/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7432-non-fungible-token-roles/15298" />
        

        <id>https://wg-eips.ritovision.com/7432/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:7432"
            label="ERC-7432" />
        

        
        

        
        <summary type="html">Role Management for NFTs. Enables accounts to share the utility of NFTs via expirable role assignments.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7432/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard introduces role management for NFTs. Each role assignment is associated with a single NFT and expires
automatically at a given timestamp. Roles are defined as &lt;code&gt;bytes32&lt;&#x2F;code&gt; and feature a custom &lt;code&gt;data&lt;&#x2F;code&gt; field of arbitrary size
to allow customization.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The NFT Roles interface aims to establish a standard for role management in NFTs. Tracking on-chain roles enables
decentralized applications (dApps) to implement access control for privileged actions, e.g., minting tokens with a role
(airdrop claim rights).&lt;&#x2F;p&gt;
&lt;p&gt;NFT roles can be deeply integrated with dApps to create a utility-sharing mechanism. A good example is in digital real
estate. A user can create a digital property NFT and grant a &lt;code&gt;keccak256(&quot;PropertyManager()&quot;)&lt;&#x2F;code&gt; role to another user,
allowing them to delegate specific utility without compromising ownership. The same user could also grant a
&lt;code&gt;keccak256(&quot;PropertyTenant(uint256)&quot;)&lt;&#x2F;code&gt; role to other users, allowing the recipient to access and interact with the
digital property.&lt;&#x2F;p&gt;
&lt;p&gt;There are also interesting use cases in decentralized finance (DeFi). Insurance policies could be issued as NFTs, and
the beneficiaries, insured, and insurer could all be on-chain roles tracked using this standard.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;,
&quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC-2119 and RFC-8174.&lt;&#x2F;p&gt;
&lt;p&gt;Compliant contracts MUST implement the following interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-7432 Non-Fungible Token Roles&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-7432&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0xd00ca5cf.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7432&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is ERC165 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Role&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; roleId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint64&lt;&#x2F;span&gt;&lt;span&gt; expirationDate&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bool&lt;&#x2F;span&gt;&lt;span&gt; revocable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Events *&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when an NFT is locked (deposited or frozen).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The owner of the NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token identifier.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TokenLocked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a role is granted.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token identifier.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _roleId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The role identifier.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The user assigning the role.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _recipient&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The user receiving the role.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _expirationDate&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The expiration date of the role.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _revocable&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Whether the role is revocable or not.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Any additional data about the role.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RoleGranted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _roleId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _recipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _expirationDate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _revocable&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a role is revoked.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token identifier.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _roleId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The role identifier.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RoleRevoked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _roleId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when an NFT is unlocked (withdrawn or unfrozen).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The original owner of the NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token identifier.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TokenUnlocked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a user is approved to manage roles on behalf of another user.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The user approved to grant and revoke roles.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _isApproved&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The approval status.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RoleApprovalForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _isApproved&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; External Functions *&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Grants a role to a user.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Reverts if sender is not approved or the NFT owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _role&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The role attributes.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; grantRole&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Role&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _role&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Revokes a role from a user.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Reverts if sender is not approved or the original owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token identifier.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _roleId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The role identifier.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revokeRole&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _roleId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Unlocks NFT (transfer back to original owner or unfreeze it).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Reverts if sender is not approved or the original owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token identifier.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; unlockToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Approves operator to grant and revoke roles on behalf of another user.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The user approved to grant and revoke roles.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The approval status.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setRoleApprovalForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; View Functions *&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieves the original owner of the NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token identifier.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The owner of the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieves the recipient of an NFT role.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token identifier.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _roleId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The role identifier.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; recipient_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The user that received the role.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; recipientOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _roleId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recipient_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieves the custom data of a role assignment.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token identifier.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _roleId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The role identifier.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The custom data of the role.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; roleData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _roleId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieves the expiration date of a role assignment.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token identifier.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _roleId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The role identifier.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; expirationDate_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The expiration date of the role.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; roleExpirationDate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _roleId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expirationDate_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verifies whether the role is revocable.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token identifier.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _roleId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The role identifier.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; revocable_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Whether the role is revocable.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isRoleRevocable&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _roleId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; revocable_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verifies if the owner approved the operator.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The user that approved the operator.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The user that can grant and revoke roles.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Whether&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the operator is approved.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isRoleApprovedForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;metadata-extension&quot;&gt;Metadata Extension&lt;&#x2F;h3&gt;
&lt;p&gt;The Roles Metadata extension extends the traditional JSON-based metadata schema of NFTs. Therefore, DApps supporting
this feature MUST also implement the metadata extension of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;. This extension is &lt;strong&gt;optional&lt;&#x2F;strong&gt; and allows
developers to provide additional information for roles.&lt;&#x2F;p&gt;
&lt;p&gt;Updated Metadata Schema:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Existing NFT Metadata *&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Asset Metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Identifies the asset to which this NFT represents&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Describes the asset to which this NFT represents&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;image&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A URI pointing to a resource with mime type image&#x2F;* representing the asset to which this NFT represents. Consider making any images at a width between 320 and 1080 pixels and aspect ratio between 1.91:1 and 4:5 inclusive&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Additional fields for Roles *&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;roles&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Identifies the role&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Human-readable name of the role&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Describes the role&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Human-readable name of the argument&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Solidity type, e.g., uint256 or address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The following JSON is an example of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7432&#x2F;&quot;&gt;ERC-7432&lt;&#x2F;a&gt; Metadata:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ... Existing NFT Metadata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;roles&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; keccak256(&amp;quot;PropertyManager()&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x76be0ffb73d8cd9e8fa76c28632ebbc3865a8ec7a0b6acab6ac589a1c88dd301&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Property Manager&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The manager of the property is responsible for furnishing it and ensuring its good condition.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; keccak256(&amp;quot;PropertyTenant(uint256)&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x17dfc8ea82661b71bd62ce0bd9db3858dd8f3e8ab9799d6ab468ec64f1be21a5&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Property Tenant&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The tenant of the property is responsible for paying the rent and keeping the property in good condition.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;rent&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;roles&lt;&#x2F;code&gt; array properties are SUGGESTED, and developers should add any other relevant information as necessary (e.g.,
an image for the role). It&#x27;s also important to highlight the importance of the &lt;code&gt;inputs&lt;&#x2F;code&gt; property. This field describes
the parameters that should be encoded and passed to the &lt;code&gt;grantRole&lt;&#x2F;code&gt; function. It&#x27;s RECOMMENDED to use the properties
&lt;code&gt;type&lt;&#x2F;code&gt; and &lt;code&gt;components&lt;&#x2F;code&gt; defined on the Solidity ABI Specification, where &lt;code&gt;type&lt;&#x2F;code&gt; is the canonical type of the parameter,
and &lt;code&gt;components&lt;&#x2F;code&gt; is used for complex tuple types.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;caveats&quot;&gt;Caveats&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Compliant contracts MUST implement the &lt;code&gt;IERC7432&lt;&#x2F;code&gt; interface.&lt;&#x2F;li&gt;
&lt;li&gt;A role is represented by a &lt;code&gt;bytes32&lt;&#x2F;code&gt;, and it&#x27;s RECOMMENDED to use the &lt;code&gt;keccak256&lt;&#x2F;code&gt; of the role&#x27;s name with its inputs:
&lt;code&gt;bytes32 roleId = keccak256(&quot;RoleName(input_type)&quot;)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;grantRole&lt;&#x2F;code&gt; function MUST revert if the &lt;code&gt;expirationDate&lt;&#x2F;code&gt; is in the past or if the &lt;code&gt;msg.sender&lt;&#x2F;code&gt; is not approved to
grant roles on behalf of the NFT owner. It MAY be implemented as &lt;code&gt;public&lt;&#x2F;code&gt; or &lt;code&gt;external&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;In addition to emitting the &lt;code&gt;RoleGranted&lt;&#x2F;code&gt; event, the &lt;code&gt;grantRole&lt;&#x2F;code&gt; function MUST emit a &lt;code&gt;TokenLocked&lt;&#x2F;code&gt; event if the token
is frozen or transferred to an escrow account.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;revokeRole&lt;&#x2F;code&gt; function MUST revert if the &lt;code&gt;msg.sender&lt;&#x2F;code&gt; is not approved to revoke roles on behalf of the original
NFT owner or the &lt;code&gt;recipient&lt;&#x2F;code&gt;. It MAY be implemented as &lt;code&gt;public&lt;&#x2F;code&gt; or &lt;code&gt;external&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;revocable&lt;&#x2F;code&gt; is false, only the &lt;code&gt;recipient&lt;&#x2F;code&gt; can revoke the role. If &lt;code&gt;revocable&lt;&#x2F;code&gt; is true, both the &lt;code&gt;recipient&lt;&#x2F;code&gt; and
the original NFT owner can revoke the role.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;unlockToken&lt;&#x2F;code&gt; function MUST revert if the &lt;code&gt;msg.sender&lt;&#x2F;code&gt; is not approved, or if there is at least one non-revocable
role not expired. It MAY be implemented as &lt;code&gt;public&lt;&#x2F;code&gt; or &lt;code&gt;external&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;setRoleApprovalForAll&lt;&#x2F;code&gt; function MAY be implemented as &lt;code&gt;public&lt;&#x2F;code&gt; or &lt;code&gt;external&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;ownerOf&lt;&#x2F;code&gt; function MAY be implemented as &lt;code&gt;pure&lt;&#x2F;code&gt; or &lt;code&gt;view&lt;&#x2F;code&gt;, and MUST return the address of the original owner of
the NFT.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;recipientOf&lt;&#x2F;code&gt; function MAY be implemented as &lt;code&gt;pure&lt;&#x2F;code&gt; or &lt;code&gt;view&lt;&#x2F;code&gt;, and MUST return the address of the account that
received the role.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;roleData&lt;&#x2F;code&gt; function MAY be implemented as &lt;code&gt;pure&lt;&#x2F;code&gt; or &lt;code&gt;view&lt;&#x2F;code&gt;, and MUST return the encoded data passed to the
&lt;code&gt;grantRole&lt;&#x2F;code&gt; function.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;roleExpirationDate&lt;&#x2F;code&gt; function MAY be implemented as &lt;code&gt;pure&lt;&#x2F;code&gt; or &lt;code&gt;view&lt;&#x2F;code&gt;, and MUST return the expiration date of a
given role.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;isRoleRevocable&lt;&#x2F;code&gt; function MAY be implemented as &lt;code&gt;pure&lt;&#x2F;code&gt; or &lt;code&gt;view&lt;&#x2F;code&gt;, and MUST return whether the role is revocable.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;isRoleApprovedForAll&lt;&#x2F;code&gt; function MAY be implemented as &lt;code&gt;pure&lt;&#x2F;code&gt; or &lt;code&gt;view&lt;&#x2F;code&gt;, and SHOULD only return &lt;code&gt;true&lt;&#x2F;code&gt; if the
&lt;code&gt;_operator&lt;&#x2F;code&gt; is approved to grant and revoke roles on behalf of the original NFT owner.&lt;&#x2F;li&gt;
&lt;li&gt;Compliant contracts SHOULD implement &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7432&#x2F;&quot;&gt;ERC-7432&lt;&#x2F;a&gt; IS NOT an extension of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;. The main reason behind this decision is to
enable it to be implemented externally or on the same contract as the NFT, allowing dApps to implement roles with
immutable assets. This standard covers many crucial features, such as automatic expiration and custom data, but perhaps
the most important one is its flexibility in implementation. ERC-7432 can be implemented in many ways, and for this
reason, the neutral term &quot;lock&quot; is employed. This term can refer to an NFT being frozen (preventing transfers until
roles expire) or deposited in an escrow contract. Developers should decide which implementation to use based on their
use cases.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;automatic-expiration&quot;&gt;Automatic Expiration&lt;&#x2F;h3&gt;
&lt;p&gt;Automatic expiration is implemented via the &lt;code&gt;grantRole&lt;&#x2F;code&gt; and &lt;code&gt;roleExpirationDate&lt;&#x2F;code&gt; functions. &lt;code&gt;grantRole&lt;&#x2F;code&gt; is responsible
for setting the expiration date, and &lt;code&gt;roleExpirationDate&lt;&#x2F;code&gt; allow developers to check whether the role is expired. Since
&lt;code&gt;uint256&lt;&#x2F;code&gt; is not natively supported by most programming languages, dates are represented as &lt;code&gt;uint64&lt;&#x2F;code&gt; on this standard.
The maximum UNIX timestamp represented by a &lt;code&gt;uint64&lt;&#x2F;code&gt; is about the year &lt;code&gt;584,942,417,355&lt;&#x2F;code&gt;, which should be enough to be
considered &quot;permanent&quot;. For this reason, it&#x27;s recommended using &lt;code&gt;type(uint64).max&lt;&#x2F;code&gt; to support use cases that require a
role never to expire.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;revocable-roles&quot;&gt;Revocable Roles&lt;&#x2F;h3&gt;
&lt;p&gt;In certain scenarios, the original owner of the NFT may need to revoke a role before its expiration date, while in
others, the recipient may require assurance that the role cannot be revoked. The &lt;code&gt;revocable&lt;&#x2F;code&gt; parameter was introduced
to the &lt;code&gt;grantRole&lt;&#x2F;code&gt; function to specify whether a role can be revoked prematurely, enabling the standard to
support both use cases.&lt;&#x2F;p&gt;
&lt;p&gt;Regardless of the value of &lt;code&gt;revocable&lt;&#x2F;code&gt;, it&#x27;s recommended always to enable the &lt;code&gt;recipient&lt;&#x2F;code&gt; to revoke roles, allowing them
to eliminate undesirable assignments.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;custom-data&quot;&gt;Custom Data&lt;&#x2F;h3&gt;
&lt;p&gt;DApps can customize roles using the &lt;code&gt;data&lt;&#x2F;code&gt; parameter of the &lt;code&gt;grantRole&lt;&#x2F;code&gt; function. &lt;code&gt;data&lt;&#x2F;code&gt; is implemented using the
generic type &lt;code&gt;bytes&lt;&#x2F;code&gt; to enable dApps to encode any role-specific information when granting a role. The custom
data is retrievable using the &lt;code&gt;roleData&lt;&#x2F;code&gt; function and is emitted with the &lt;code&gt;RoleGranted&lt;&#x2F;code&gt; event. With this approach,
developers can integrate this information into their applications, both on-chain and off-chain.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;role-approval&quot;&gt;Role Approval&lt;&#x2F;h3&gt;
&lt;p&gt;Similar to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;, this standard enable other accounts to manage roles on behalf of the NFT owner. This
functionality was introduced to allow third-parties to interact with ERC-7432 without requiring NFT ownership. Compliant
contracts MUST implement the functions &lt;code&gt;setRoleApprovalForAll&lt;&#x2F;code&gt; and &lt;code&gt;isRoleApprovedForAll&lt;&#x2F;code&gt; to deliver this feature.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;On all functions and events, the standard requires both the &lt;code&gt;tokenAddress&lt;&#x2F;code&gt; and &lt;code&gt;tokenId&lt;&#x2F;code&gt; to be provided. This
requirement enables dApps to use a standalone &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7432&#x2F;&quot;&gt;ERC-7432&lt;&#x2F;a&gt; contract as the authoritative source for the
roles of immutable NFTs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7432&#x2F;.&#x2F;assets&#x2F;ERC7432.sol&quot;&gt;ERC-7432.sol&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Developers integrating the Non-Fungible Token Roles interface should consider the following on their implementations:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Ensure proper access controls are in place to prevent unauthorized role assignments or revocations.&lt;&#x2F;li&gt;
&lt;li&gt;Take into account potential attack vectors such as reentrancy and ensure appropriate safeguards are in place.&lt;&#x2F;li&gt;
&lt;li&gt;Approved accounts should be able to manage roles on behalf of another user. However, ensure that the NFT can
only be transferred to an escrow contract, and back to its original owner (not to the approved account).&lt;&#x2F;li&gt;
&lt;li&gt;Always check the expiration date before allowing users to access the utility of an NFT.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Token-Controlled Token Circulation</title>
        <published>2023-07-09T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Ko Fujimura</name><uri>https://github.com/kofujimura</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7303/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7303-token-controlled-token-circulation/15020" />
        

        <id>https://wg-eips.ritovision.com/7303/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7303"
            label="ERC-7303" />
        

        
        

        
        <summary type="html">Access control scheme based on token ownership.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7303/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC introduces an access control scheme termed Token-Controlled Token Circulation (TCTC). By representing the privileges associated with a role as an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; token (referred to as a &lt;code&gt;control token&lt;&#x2F;code&gt;), the processes of granting or revoking a role can be facilitated through the minting or burning of the corresponding &lt;code&gt;control token&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;There are numerous methods to implement access control for privileged actions. A commonly utilized pattern is &quot;role-based&quot; access control as specified in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5982&#x2F;&quot;&gt;ERC-5982&lt;&#x2F;a&gt;. This method, however, necessitates the use of an off-chain management tool to grant or revoke required roles through its interface. Additionally, as many wallets lack a user interface that displays the privileges granted by a role, users are often unable to comprehend the status of their privileges through the wallet.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;use-cases&quot;&gt;Use Cases&lt;&#x2F;h3&gt;
&lt;p&gt;This ERC is applicable in many scenarios where role-based access control as described in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5982&#x2F;&quot;&gt;ERC-5982&lt;&#x2F;a&gt; is used. Specific use cases include:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Mint&#x2F;Burn Permission:&lt;&#x2F;strong&gt;
In applications that circulate items such as tickets, coupons, membership cards, and site access rights as tokens, it is necessary to provide the system administrator with the authority to mint or burn these tokens. These permissions can be realized as &lt;code&gt;control tokens&lt;&#x2F;code&gt; in this scheme.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Transfer Permission:&lt;&#x2F;strong&gt;
In some situations within these applications, it may be desirable to limit the ability to transfer tokens to specific agencies. In these cases, an agency certificate is issued as a &lt;code&gt;control token&lt;&#x2F;code&gt;. The ownership of this &lt;code&gt;control token&lt;&#x2F;code&gt; then provides the means to regulate token transfers.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Address Verification:&lt;&#x2F;strong&gt;
Many applications require address verification to prevent errors in the recipient&#x27;s address when minting or transferring target tokens. A &lt;code&gt;control token&lt;&#x2F;code&gt; is issued as proof of address verification to users, which is required by the recipient when a mint or transfer transaction is executed, thus preventing misdeliveries. In some instances, this &lt;code&gt;control token&lt;&#x2F;code&gt; for address verification may be issued by a government agency or specific company after an identity verification process.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Smart contracts implementing the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7303&#x2F;&quot;&gt;ERC-7303&lt;&#x2F;a&gt; standard MUST represent the privilege required by the role as an ERC-721 token or ERC-1155 token. The tokens that represent privileges are called &lt;code&gt;control tokens&lt;&#x2F;code&gt; in this ERC. The &lt;code&gt;control token&lt;&#x2F;code&gt; can be any type of token, and its transactions may be recursively controlled by another &lt;code&gt;control token&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;To associate the required &lt;code&gt;control token&lt;&#x2F;code&gt; with the role, the address of the previously deployed contract for the &lt;code&gt;control token&lt;&#x2F;code&gt; MUST be used.&lt;&#x2F;li&gt;
&lt;li&gt;To ascertain whether an account possesses the necessary role, it SHOULD be confirmed that the balance of the &lt;code&gt;control token&lt;&#x2F;code&gt; exceeds 0, utilizing the &lt;code&gt;balanceOf&lt;&#x2F;code&gt; method defined in ERC-721 or ERC-1155. Note that the &lt;code&gt;typeId&lt;&#x2F;code&gt; must be specified if an ERC-1155 token is used for the &lt;code&gt;balanceOf&lt;&#x2F;code&gt; method.&lt;&#x2F;li&gt;
&lt;li&gt;To grant a role to an account, a &lt;code&gt;control token&lt;&#x2F;code&gt; representing the privilege SHOULD be minted to the account using &lt;code&gt;safeMint&lt;&#x2F;code&gt; method defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5679&#x2F;&quot;&gt;ERC-5679&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;To revoke a role from an account, the &lt;code&gt;control token&lt;&#x2F;code&gt; representing the privilege SHOULD be burned using the &lt;code&gt;burn&lt;&#x2F;code&gt; method defined in ERC-5679.&lt;&#x2F;li&gt;
&lt;li&gt;A role in a compliant smart contract is represented in the format of &lt;code&gt;bytes32&lt;&#x2F;code&gt;. It&#x27;s RECOMMENDED the value of such role is computed as a &lt;code&gt;keccak256&lt;&#x2F;code&gt; hash of a string of the role name, in this format: &lt;code&gt;bytes32 role = keccak256(&quot;&amp;lt;role_name&amp;gt;&quot;)&lt;&#x2F;code&gt; such as &lt;code&gt;bytes32 role = keccak256(&quot;MINTER&quot;)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The choice to utilize ERC-721 or ERC-1155 token as the control token for privileges enhances visibility of such privileges within wallets, thus simplifying privilege management for users.&lt;&#x2F;p&gt;
&lt;p&gt;Generally, when realizing privileges as tokens, specifications like Soulbound Token (e.g., &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5192&#x2F;&quot;&gt;ERC-5192&lt;&#x2F;a&gt;) are used. Given that ERC-5192 inherits from ERC-721, this ERC has choiced ERC-721 as the requirement for the control token.&lt;&#x2F;p&gt;
&lt;p&gt;Employing a transferable control token can cater to scenarios where role delegation is necessary. For example, when an authority within an organization is replaced or on vacation, the ability to transfer their privileges to another member becomes possible. The decision to designate the control token as transferable will depend on the specific needs of the application.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC is designed to be compatible for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt;, and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5679&#x2F;&quot;&gt;ERC-5679&lt;&#x2F;a&gt; respectively.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;ERC-7303 provides a modifier to facilitate the implementation of TCTC access control in applications.　This modifier checks if an account possesses the necessary role. ERC-7303 also includes a function that grants a specific role to a designated account.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: Apache-2.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.9&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC721&#x2F;ERC721.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC1155&#x2F;ERC1155.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;abstract&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC7303&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721Token&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; contractId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC1155Token&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; contractId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; typeId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; ERC721Token&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _ERC721_Contracts&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; ERC1155Token&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _ERC1155_Contracts&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    modifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyHasToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; role&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_checkHasToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;role&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC7303: not has a required token&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        _&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Grant a role to user who owns a control token specified by the ERC-721 contractId. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Multiple calls are allowed, in this case the user must own at least one of the specified token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; role&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; byte32 The role which you want to grant.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contractId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address The address of contractId of which token the user required to own.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _grantRoleByERC721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; role&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contractId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            IERC165&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;contractId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;IERC721&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;ERC7303: provided contract does not support ERC721 interface&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _ERC721_Contracts&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;role&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;push&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC721Token&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;contractId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Grant a role to user who owns a control token specified by the ERC-1155 contractId. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Multiple calls are allowed, in this case the user must own at least one of the specified token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; role&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; byte32 The role which you want to grant.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contractId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address The address of contractId of which token the user required to own.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; typeId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; uint256 The token type id that the user required to own.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _grantRoleByERC1155&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; role&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contractId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; typeId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            IERC165&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;contractId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;IERC1155&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;ERC7303: provided contract does not support ERC1155 interface&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _ERC1155_Contracts&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;role&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;push&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC1155Token&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;contractId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; typeId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _checkHasToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; role&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ERC721Token&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; ERC721Tokens &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _ERC721_Contracts&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;role&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; ERC721Tokens&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ERC721Tokens&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;contractId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ERC1155Token&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; ERC1155Tokens &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _ERC1155_Contracts&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;role&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; ERC1155Tokens&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC1155&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ERC1155Tokens&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;contractId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; ERC1155Tokens&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;typeId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The following is a simple example of utilizing &lt;code&gt;ERC7303&lt;&#x2F;code&gt; within an ERC-721 token to define &quot;minter&quot; and &quot;burner&quot; roles. Accounts possessing these roles are allowed to create new tokens and destroy existing tokens, facilitated by specifying ERC-721 or ERC-1155 control tokens:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: Apache-2.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.9&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC721&#x2F;ERC721.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC721&#x2F;extensions&#x2F;ERC721URIStorage.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;ERC7303.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MyToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC7303&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; MINTER_ROLE &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;MINTER_ROLE&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; BURNER_ROLE &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;BURNER_ROLE&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;&amp;quot;MyToken&amp;quot;, &amp;quot;MTK&amp;quot;) &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Specifies the deployed contractId of ERC721 control token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _grantRoleByERC721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;MINTER_ROLE&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;x&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _grantRoleByERC721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;BURNER_ROLE&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;x&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Specifies the deployed contractId and typeId of ERC1155 control token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _grantRoleByERC1155&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;MINTER_ROLE&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;x&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; .&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _grantRoleByERC1155&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;BURNER_ROLE&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;x&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; .&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeMint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyHasToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;MINTER_ROLE&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _safeMint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; burn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyHasToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;BURNER_ROLE&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _burn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The security of tokens subject to circulation depends significantly on the security of the control tokens. Careful consideration must be given to the settings regarding the administrative privileges, mint&#x2F;transfer&#x2F;burn permissions, and the possibility of contract updates of control tokens.&lt;&#x2F;p&gt;
&lt;p&gt;In particular, making control tokens transferable allows for flexible operations, such as the temporary delegation of administrative rights. However, it also raises the possibility that the rights to circulate tokens could fall into the hands of inappropriate third parties. Therefore, control tokens should generally be made non-transferable. If control tokens are to be made transferable, at the very least, the authority to burn these tokens should be retained by a trusted administrator.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>NFT Metadata Extension like JSON-LD</title>
        <published>2023-07-04T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Yohei Nishikubo</name><uri>https://github.com/yoheinishikubo</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7280/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7280-nft-metadata-extension-like-json-ld/14935" />
        

        <id>https://wg-eips.ritovision.com/7280/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7280"
            label="ERC-7280" />
        

        
        

        
        <summary type="html">Let NFT metadata have a feature equivalent to JSON-LD to be semantic.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7280/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal expands the metadata format for Non-Fungible Tokens (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3525&#x2F;&quot;&gt;ERC-3525&lt;&#x2F;a&gt;, and others), adding support for linked data like JSON-LD format. The additional data is stored under the linked_data key in the metadata JSON.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The existing metadata format for Non-Fungible Tokens is limited and doesn&#x27;t support the inclusion of structured and semantically meaningful data. By integrating JSON-LD (Linked Data), we can enhance the richness and interoperability of the metadata associated with NFTs.&lt;&#x2F;p&gt;
&lt;p&gt;This allows for complex metadata structures that can link to external schemas and data, improving the contextual relevance and usability of NFTs across various applications.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;The JSON-LD based metadata is stored under a new &lt;code&gt;linked_data&lt;&#x2F;code&gt; key in the metadata JSON. The &lt;code&gt;linked_data&lt;&#x2F;code&gt; key is an array of objects, where each object contains two keys: &lt;code&gt;schema&lt;&#x2F;code&gt; and &lt;code&gt;data&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;name&lt;&#x2F;th&gt;&lt;th&gt;compliance level&lt;&#x2F;th&gt;&lt;th&gt;type&lt;&#x2F;th&gt;&lt;th&gt;description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;schema&lt;&#x2F;td&gt;&lt;td&gt;MUST&lt;&#x2F;td&gt;&lt;td&gt;object&lt;&#x2F;td&gt;&lt;td&gt;The schema of the linked data.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;data&lt;&#x2F;td&gt;&lt;td&gt;MUST&lt;&#x2F;td&gt;&lt;td&gt;object&lt;&#x2F;td&gt;&lt;td&gt;The data of the linked data.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;schema&quot;&gt;Schema&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;name&lt;&#x2F;th&gt;&lt;th&gt;compliance level&lt;&#x2F;th&gt;&lt;th&gt;type&lt;&#x2F;th&gt;&lt;th&gt;description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;uri&lt;&#x2F;td&gt;&lt;td&gt;MUST&lt;&#x2F;td&gt;&lt;td&gt;string&lt;&#x2F;td&gt;&lt;td&gt;The URI of the schema.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;name&lt;&#x2F;td&gt;&lt;td&gt;MUST&lt;&#x2F;td&gt;&lt;td&gt;string&lt;&#x2F;td&gt;&lt;td&gt;The name of the schema.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;description&lt;&#x2F;td&gt;&lt;td&gt;OPTIONAL&lt;&#x2F;td&gt;&lt;td&gt;string&lt;&#x2F;td&gt;&lt;td&gt;The description of the schema.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;data&quot;&gt;Data&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;name&lt;&#x2F;th&gt;&lt;th&gt;compliance level&lt;&#x2F;th&gt;&lt;th&gt;type&lt;&#x2F;th&gt;&lt;th&gt;description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;uri&lt;&#x2F;td&gt;&lt;td&gt;MUST&lt;&#x2F;td&gt;&lt;td&gt;string&lt;&#x2F;td&gt;&lt;td&gt;The URI of the data.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;lang&lt;&#x2F;td&gt;&lt;td&gt;OPTIONAL&lt;&#x2F;td&gt;&lt;td&gt;string&lt;&#x2F;td&gt;&lt;td&gt;The language of the data. IETF language tag like &lt;code&gt;en-US&lt;&#x2F;code&gt;.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;name&lt;&#x2F;td&gt;&lt;td&gt;OPTIONAL&lt;&#x2F;td&gt;&lt;td&gt;string&lt;&#x2F;td&gt;&lt;td&gt;The name of the data.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;description&lt;&#x2F;td&gt;&lt;td&gt;OPTIONAL&lt;&#x2F;td&gt;&lt;td&gt;string&lt;&#x2F;td&gt;&lt;td&gt;The description of the data.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;For providing typical webpage for an NFT, it&#x27;s much simple to include JSON-LD in HTML header tag with this extension. Just looking for JSON-LD compliant value&#x27;s uri from &lt;code&gt;linked_data&lt;&#x2F;code&gt; array, fetch it and embed its content in HTML header tag.
This means the minter of NFT can control the appearance in the search result of Google, for example.
In more common case for interoperability, the NFT metadata can include any schema and data with this extension. This means the NFT metadata can be used as a data source for any application. With the schema, the implementation is much easier.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The proposed expansion to the NFT metadata format is backward compatible with existing implementations. NFTs that do not include the &lt;code&gt;linked_data&lt;&#x2F;code&gt; key will continue to function as before, and existing applications consuming NFT metadata will not be affected.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Here is an example metadata JSON demonstrating the new linked_data structure:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;NFT Name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;This NFT represents...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;image&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;example.org&#x2F;images&#x2F;nft.png&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;linked_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;schema&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;VideoObject&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uri&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;example.org&#x2F;schemas&#x2F;VideoObject.json&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uri&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;example.org&#x2F;data&#x2F;video1.json&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;schema&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;MusicRecording&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uri&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;example.org&#x2F;schemas&#x2F;MusicRecording.json&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uri&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;example.org&#x2F;data&#x2F;music1.json&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;schema&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;GoogleTravelImpactModel&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uri&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;example.org&#x2F;schemas&#x2F;GoogleTravelImpactModel.json&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uri&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;example.org&#x2F;data&#x2F;gtim1.json&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In the example above, the NFT metadata contains three linked data objects, each with a different schema and data:
First one. VideoObject data can be used as JSON-LD in HTML header tag and realize rich snippet in Google search result.
Second one. MusicRecording data is based on a schema from &lt;code&gt;schema.org&lt;&#x2F;code&gt;. However this one cannot realize rich snippet.
Third one. GoogleTravelImpactModel data is a dedicated schema for Google Travel Impact Model.
The most important point is that any schema and data can be included with this standard like above.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;sample-files&quot;&gt;Sample files&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7280&#x2F;.&#x2F;assets&#x2F;samples&#x2F;schemas&#x2F;VideoObject.json&quot;&gt;VideoObject.json&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7280&#x2F;.&#x2F;assets&#x2F;samples&#x2F;schemas&#x2F;MusicRecording.json&quot;&gt;MusicRecording.json&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7280&#x2F;.&#x2F;assets&#x2F;samples&#x2F;schemas&#x2F;GoogleTravelImpactModel.json&quot;&gt;GoogleTravelImpactModel.json&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7280&#x2F;.&#x2F;assets&#x2F;samples&#x2F;data&#x2F;video1.json&quot;&gt;video1.json&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7280&#x2F;.&#x2F;assets&#x2F;samples&#x2F;data&#x2F;music1.json&quot;&gt;music1.json&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7280&#x2F;.&#x2F;assets&#x2F;samples&#x2F;data&#x2F;gtim1.json&quot;&gt;gtim1.json&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The proposed expansion does not introduce any additional security considerations beyond those already associated with NFTs and linked data. Implementations should adhere to best practices for secure handling and validation of metadata from external sources.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Remove BLAKE2 compression precompile</title>
        <published>2023-07-03T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>pcaversaccio</name><uri>https://github.com/pcaversaccio</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7266/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/discussion-removal-of-ripemd-160-and-blake2f-precompiles/14857" />
        

        <id>https://wg-eips.ritovision.com/7266/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:7266"
            label="EIP-7266" />
        

        
        

        
        <summary type="html">Remove the blake2f (0x09) precompile by changing the precompile behaviour to result in an exceptional abort</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7266/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP removes the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;152&#x2F;&quot;&gt;&lt;code&gt;blake2f&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; (&lt;code&gt;0x09&lt;&#x2F;code&gt;) precompile by changing the precompile behaviour to result in an exceptional abort.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;152&#x2F;&quot;&gt;EIP-152&lt;&#x2F;a&gt; has never capitalised on a real-world use case. This fact is clearly reflected in the number of times the address &lt;code&gt;0x09&lt;&#x2F;code&gt; has been invoked (numbers from the date this EIP was created):&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The most recent call took place on 6 October 2022.&lt;&#x2F;li&gt;
&lt;li&gt;Since its gone live as part of the Istanbul network upgrade on December 7 2019 (block number 9,069,000), &lt;code&gt;0x09&lt;&#x2F;code&gt; has been called only 22,131 times.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;One of the reasons why &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;152&#x2F;&quot;&gt;EIP-152&lt;&#x2F;a&gt; has failed is that the envisioned use cases were not validated before inclusion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;All &lt;code&gt;CALL&lt;&#x2F;code&gt;, &lt;code&gt;CALLCODE&lt;&#x2F;code&gt;, &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;, and &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; invocations to the &lt;code&gt;blake2f&lt;&#x2F;code&gt; precompile address &lt;code&gt;0x09&lt;&#x2F;code&gt; MUST result in an exceptional halting state that consumes all supplied gas and returns no data.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The EVM should be optimised for simplicity and future-proofness. The original Yellow Paper states: &lt;em&gt;these are so-called &#x27;precompiled&#x27; contracts, meant as a preliminary piece of architecture that may later become native extensions&lt;&#x2F;em&gt;. Considering that no use cases have been realised in the last 3.5 years, we can conclude that the precompile &lt;code&gt;blake2f&lt;&#x2F;code&gt; (&lt;code&gt;0x09&lt;&#x2F;code&gt;) will never transition into a native opcode. In that sense, the precompile &lt;code&gt;blake2f&lt;&#x2F;code&gt; (&lt;code&gt;0x09&lt;&#x2F;code&gt;) is an obsolete carry-along with no real-world traction and thus should be removed. This removal will simplify the EVM to the extent that it only consists of clear instructions with real-world use cases. Eventually, the precompile &lt;code&gt;blake2f&lt;&#x2F;code&gt; (&lt;code&gt;0x09&lt;&#x2F;code&gt;) can be safely used as a test run for the phase-out and removal of EVM functions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP requires a hard fork as it modifies the consensus rules. Note that very few applications are affected by this change and a lead time of 6-12 months can be considered sufficient.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;There are no known additional security considerations introduced by this change.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Ethereum Access Token</title>
        <published>2023-07-03T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Chris Chung</name><uri>https://github.com/0xpApaSmURf</uri>
	</author>
	
	<author>
		<name>Raphael Roullet</name><uri>https://github.com/ra-phael</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7272/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7272-ethereum-access-token/14945" />
        

        <id>https://wg-eips.ritovision.com/7272/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7272"
            label="ERC-7272" />
        

        
        

        
        <summary type="html">A protocol for authorizing function calls from an off-chain service</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7272/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;An Ethereum Access Token (EAT) is an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; conformant, signed message, used by off-chain services to grant Ethereum accounts access to specific on-chain resources. EATs share similarities with JSON Web Tokens (JWTs); both are used for short-lived authorizations. However Ethereum Access Tokens are specifically designed to be verified on-chain and tailored to authorize smart contract function calls.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;While other proposals tackle authentication or authorization in a more narrow way, this specification allows developers to add a layer of access control to any function they create with minimal changes. It is best suited for use cases where end users should only be able to access specific on-chain resources themselves directly, by way of sending a transaction, provided they have been granted authorization by an off-chain service first. Examples of such scenarios include an off-chain verifier assessing eligibility requirements (e.g by verifying verifiable credentials) to mint a token or to interact with a smart contract that requires a certain compliance status.
Therefore, this proposal enables off-chain systems to authenticate the controller of an Ethereum account in any way they want, before granting an authorization bound to said account.&lt;&#x2F;p&gt;
&lt;p&gt;This specification is intended to improve interoperability in the Ethereum ecosystem, by providing a consistent machine-readable message format to achieve improved user experiences.&lt;&#x2F;p&gt;
&lt;p&gt;EATs fill a void where access control requirements differ from current standard access control mechanisms (role-based access modifiers or checking that an address owns an NFT):&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Desired acccess is short-lived&lt;&#x2F;li&gt;
&lt;li&gt;Criteria needs to be flexible&#x2F;dynamic: updating the requirements for granting access doesn&#x27;t require any update on chain&lt;&#x2F;li&gt;
&lt;li&gt;When Soulbound or other on-chain token semantics are not desired. Using any kind of &quot;on-chain registry&quot; to grant authorization places a burden on the owner of such registry to keep it up-to-date at all time. Otherwise, someone might be wrongly granted access in the lapse of time where their on-chain status is incorrect. With EATs, on the contrary, users come to ask for an authorization which gives EAT issuers the opportunity to perform some checks and update their records before granting authorization. Additionally, relying purely on on-chain data comes with privacy concerns due to the public nature of most of current chains. When authorization needs to be granted based on sensitive or personally identifiable information, it is not recommended to store that information on-chain and perform a lookup. Ethereum Access Tokens provide an alternative which doesn&#x27;t leak any PII on-chain.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;overview&quot;&gt;Overview&lt;&#x2F;h3&gt;
&lt;p&gt;An example flow integrated in a DeFi application is the following:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;A user interacts with the DeFi&#x27;s off-chain service, providing sufficient input for the off-chain service to ensure the user meets its criteria (for example, authenticates the user and&#x2F;or make sure they possess valid credentials)&lt;&#x2F;li&gt;
&lt;li&gt;If authorization is granted, an EAT is issued to the user&lt;&#x2F;li&gt;
&lt;li&gt;The user then interacts with the gated smart contract function within the specified period of time passing the EAT as part of the transaction&lt;&#x2F;li&gt;
&lt;li&gt;The EAT is verified on-chain&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7272&#x2F;.&#x2F;assets&#x2F;EAT_transaction_auth_flow.png&quot; alt=&quot;Transaction authorization flow using an EAT&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;An Ethereum Access Token MUST guarantee granular access control by binding it to specific parameters upon issuance. Then, on-chain EAT verification ensures that:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The function being called is the expected one&lt;&#x2F;li&gt;
&lt;li&gt;The function parameters are the expected ones&lt;&#x2F;li&gt;
&lt;li&gt;The function caller is the expected one&lt;&#x2F;li&gt;
&lt;li&gt;The function is being called in the authorized timeframe (i.e checking that the EAT is not expired)&lt;&#x2F;li&gt;
&lt;li&gt;The smart contract being called is the expected one&lt;&#x2F;li&gt;
&lt;li&gt;The authorization has been given by a valid issuer, i.e the EAT has been signed by one of the expected issuers&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;structure-of-an-ethereum-access-token&quot;&gt;Structure of an Ethereum Access Token&lt;&#x2F;h3&gt;
&lt;p&gt;An Ethereum Access Token is composed of a signature and expiry.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; uint8 v,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; bytes32 r,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; bytes32 s,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; uint256 expiry&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The signature is obtained using the typed structured data hashing and signing standard (EIP-712), signing over the following EAT payload:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;struct AccessToken {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    uint256 expiry;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    FunctionCall functionCall;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;struct FunctionCall {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytes4 functionSignature;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address target;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address caller;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytes parameters;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;expiry&lt;&#x2F;strong&gt;: unix timestamp, expected to be before &lt;code&gt;block.timestamp&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;code&gt;FunctionCall&lt;&#x2F;code&gt; parameters correspond to the following:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;functionSignature&lt;&#x2F;strong&gt;: identifier for the function being called, expected to match &lt;code&gt;msg.sig&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;target&lt;&#x2F;strong&gt;: address of the target contract being called&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;caller&lt;&#x2F;strong&gt;: address of the current caller - expected to match &lt;code&gt;msg.sender&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;parameters&lt;&#x2F;strong&gt;: &lt;code&gt;calldata&lt;&#x2F;code&gt; after stripping off the first parameters, namely &lt;code&gt;v&lt;&#x2F;code&gt;,&lt;code&gt;r&lt;&#x2F;code&gt;, &lt;code&gt;s&lt;&#x2F;code&gt; and &lt;code&gt;expiry&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;eat-verification&quot;&gt;EAT Verification&lt;&#x2F;h3&gt;
&lt;p&gt;On chain, the reference implementation uses two contracts: an &lt;code&gt;AccessTokenConsumer&lt;&#x2F;code&gt; which is inherited by contracts needing to permission some of its functions and an &lt;code&gt;AccessTokenVerifier&lt;&#x2F;code&gt; which is responsible for verifying EATs.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;AccessTokenConsumer&lt;&#x2F;code&gt; contract calls the &lt;code&gt;AccessTokenVerifier&lt;&#x2F;code&gt; to verify the integrity of an EAT.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;verify()&lt;&#x2F;code&gt; function of the &lt;code&gt;AccessTokenVerifier&lt;&#x2F;code&gt; takes a signature and an &lt;code&gt;AccessToken&lt;&#x2F;code&gt; as input, verifies that the token is not expired, attempts to recover the signer from the signature and the reconstructed EIP-712 digest, and verifies that the signer is a valid, expected signer.&lt;&#x2F;p&gt;
&lt;p&gt;Please see the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7272&#x2F;.&#x2F;assets&#x2F;AccessTokenVerifier.sol&quot;&gt;reference implementation&lt;&#x2F;a&gt; for an example of how this can be performed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Single-use. The reference implementation guarantees non-replayability of EATs. But other implementations might favor a different approach.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Use of EIP-712. By conforming to EIP-712, EATs are interoperable with existing Ethereum infrastructure, and developers can use them to create access controls with minimal modifications to their existing code. It also ensures that EATs issued are bound to a specific chain.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Zero-knowledge proofs. Using ZKPs comes at a cost, including added complexity. EATs are not much more than signed messages which are simpler to reason around. While &lt;code&gt;ecrecover&lt;&#x2F;code&gt; is available in any Ethereum smart contract out of the box, ZKPs come in different flavors which hinders interoperability.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Any function can be gated with an EAT, apart from the special &lt;code&gt;receive&lt;&#x2F;code&gt; and &lt;code&gt;fallback&lt;&#x2F;code&gt; functions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Here&#x27;s a reference implementation of the different smart contracts making up the EAT system onchain:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7272&#x2F;.&#x2F;assets&#x2F;IAccessTokenVerifier.sol&quot;&gt;IAccessTokenVerifier.sol&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7272&#x2F;.&#x2F;assets&#x2F;AccessTokenVerifier.sol&quot;&gt;AccessTokenVerifier.sol&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7272&#x2F;.&#x2F;assets&#x2F;AccessTokenConsumer.sol&quot;&gt;AccessTokenConsumer.sol&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The security of the Ethereum Access Token (EAT) proposal depends on several factors:&lt;&#x2F;p&gt;
&lt;h3 id=&quot;replay-attacks&quot;&gt;Replay Attacks&lt;&#x2F;h3&gt;
&lt;p&gt;The implementation MAY ensure that an EAT cannot be reused after it has been consumed. This is achieved by marking the EAT as consumed in the &lt;code&gt;_consumeAccessToken&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;off-chain-issuance&quot;&gt;Off-Chain Issuance&lt;&#x2F;h3&gt;
&lt;p&gt;The security of the off-chain service issuing EATs is critical since the security of EAT-gated functions depends on it.
If this service is compromised, malicious actors could be granted EATs giving them access to on-chain resources that they should not have access to.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;expiry-time-considerations&quot;&gt;Expiry Time Considerations&lt;&#x2F;h3&gt;
&lt;p&gt;The expiry time of the EAT must be set judiciously to balance usability and security. If the expiry time is set too long, it might increase the risk of EAT misuse. If it&#x27;s too short, it might compromise the usability of the application.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Precompile Falcon512 generic verifier</title>
        <published>2023-07-03T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Erick Pacheco Pedraza</name><uri>https://github.com/eum602</uri>
	</author>
	
	<author>
		<name>Marcos Allende</name><email>mallende@lacnet.com</email>
	</author>
	
	<author>
		<name>Diego Lopez León</name><email>dieguitoll@gmail.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7619/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/falcon-512-precompiled-generic-signature-verifier/18569" />
        

        <id>https://wg-eips.ritovision.com/7619/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7619"
            label="EIP-7619" />
        

        
        

        
        <summary type="html">Add precompiled contract that allows generic signature verifications using Falcon512 postquantum algorithm</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7619/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Include a precompiled signature verification function using Falcon-512. Falcon-512 is a candidate for standardization by the National Institute of Standards and Technology (NIST) and is quantum resistant with security level I.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The advent of quantum computing threatens blockchain protocols and networks because they utilize non-quantum resistant cryptographic algorithms. When quantum computers become robust enough to run Shor’s algorithm (a quantum algorithm to find the prime factors of an integer) on a large scale, the most used asymmetric algorithms, utilized for digital signatures and message encryption, such as RSA, (EC)DSA, and (EC)DH, will be no longer secure. Quantum computers will be able to break them within a short period of time. Today, there are hundreds of billions of dollars denominated in cryptocurrencies and other digital assets that rely on blockchain ledgers as well as thousands of blockchain-based applications storing value in blockchain networks. Cryptocurrencies and blockchain-based applications require solutions that guarantee quantum resistance in order to preserve the integrity of data and assets in these public and immutable ledgers. Most proposals for quantum-resistant blockchain networks are theoretical, require large QKD (quantum key distribution, a secure communication method that implements a cryptographic protocol involving components of quantum mechanics) networks, or propose new quantum-resistant blockchain protocols to be built from scratch. This EIP is pioneer in proposing a solution compatible with current EVM blockchain protocols. It presents a simple mechanism to add a NIST-compliant post-quantum signature to blockchain transactions, making them quantum-resistant even when ECC (elliptic curve cryptography) cryptography becomes vulnerable against attacks by quantum computers. We have developed a Solidity implementation for the on-chain verification of this signatures, which does not scale due to the required high amount of gas. This is why &lt;strong&gt;this EIP is proposing a pre-compiled smart contract&lt;&#x2F;strong&gt; that allows to verify post-quantum signatures in a scalable manner.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;A clean implementation for Falcon-512 algorithm was brought from the PQClean project.&lt;&#x2F;p&gt;
&lt;p&gt;The precompiled signature verification function runs at address &lt;code&gt;0x65&lt;&#x2F;code&gt;. The required inputs are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;public key&lt;&#x2F;code&gt; - Falcon Public key of 897 bytes&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;signature&lt;&#x2F;code&gt; - 666 bytes (max size)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;message&lt;&#x2F;code&gt; - an arbitrary number of bytes representing the message that was signed&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Those inputs are encoded according to:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[pubkey:897 bytes][signature:666 bytes][message: remainder]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Output is:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;result&lt;&#x2F;code&gt; -
A successful signature verification returns &lt;code&gt;0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;code&gt;, otherwise &lt;code&gt;0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;code&gt; indicating all other failure cases where sufficient gas has been provided.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The precompile will only revert in the case where insufficient gas has been provided. Data format errors, size errors, and invalid signatures will not cause the precompile to revert.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Input:         &amp;quot;&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Gas:           10,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ExpectedError: &amp;quot;out of gas&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Name:          &amp;quot;empty input, too little gas&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Input:         &amp;quot;111111110000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000032000000000000000000000000000000000000000000000000000000000000006e0&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Gas:           1000000,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Result:        &amp;quot;000000000000000000000000000000000000000000000000000000000000000000000000&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Name:          &amp;quot;garbled input&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;example-usage-in-solidity&quot;&gt;Example Usage in Solidity&lt;&#x2F;h3&gt;
&lt;p&gt;The precompile can be wrapped in Solidity to provide a more development-friendly interface to &lt;code&gt;Falcon-512&lt;&#x2F;code&gt; signature verification.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; publicKey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; message&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; isValid&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt; success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; verifies&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x0000000000000000000000000000000000000065&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            .&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;staticcall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;                abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    publicKey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    message&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;success &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; verifies&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Invalid signature&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; verifies&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;31&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;gas-costs&quot;&gt;Gas costs&lt;&#x2F;h3&gt;
&lt;p&gt;Since data size is variable, each operation to execute the precompiled call will require:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;1465 base units of gas for each operation.&lt;&#x2F;li&gt;
&lt;li&gt;6 units of gas for each word contained in the payload.
These values are based on results presented at the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7619&#x2F;#benchmarks&quot;&gt;benchmarks&lt;&#x2F;a&gt; section.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Falcon-512 is a good candidate for a new signature implementation. Key sizes in Falcon-512 are relatively small compared to other post-quantum signature algorithms.&lt;&#x2F;p&gt;
&lt;p&gt;The following table shows a summary of the typical values for keys and the approximate amount of time taken per second to execute signature verifications as specified by the authors of Falcon algorithm:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;strong&gt;variant&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;strong&gt;verify&#x2F;s&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;strong&gt;pub size(bytes)&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;strong&gt;sig size(bytes)&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Falcon512&lt;&#x2F;td&gt;&lt;td&gt;27933.0&lt;&#x2F;td&gt;&lt;td&gt;897&lt;&#x2F;td&gt;&lt;td&gt;666&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Falcon uses shake256 under the hood, an implementation made in solidity showed it is not viable to implement this algorithm at that layer, on the other hand the implementation of falcon-512 by using precompiles turned to be the best approach since the gas cost (as shown in the previous section) is relatively low.&lt;&#x2F;p&gt;
&lt;p&gt;Implementing just the signature verification is sufficiently enough to open a wide range of use cases at the smart contract level. To give an example, this method can perfectly work with the Account Abstraction concept, where the authentication process would rely on Falcon and the account is a smart contract.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;benchmarks&quot;&gt;benchmarks&lt;&#x2F;h3&gt;
&lt;p&gt;Assuming ecRecover precompile is perfectly priced, a set of benchmarks were executed comparing Falcon-512 signature verification function precompile with ecRecover precompile. For benchmarks, it was used 2.6 GHz Intel Core i7 64-bit machine.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; cat&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &#x2F;proc&#x2F;cpuinfo&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; grep&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;model name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Intel(R&lt;&#x2F;span&gt;&lt;span&gt;) Core(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;TM&lt;&#x2F;span&gt;&lt;span&gt;) i7-10750H CPU @ 2.60GHz&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;5-seconds-benchmark&quot;&gt;5 seconds benchmark&lt;&#x2F;h4&gt;
&lt;p&gt;Based on &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7619&#x2F;assets&#x2F;bench_vectors&#x2F;&quot;&gt;100 test vectors with valid signatures&lt;&#x2F;a&gt; a benchmark of 5 seconds, for each test vector, was performed, considering the following:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;the average time per operation (ns&#x2F;op),&lt;&#x2F;li&gt;
&lt;li&gt;each vector size increases in 33 bytes&lt;&#x2F;li&gt;
&lt;li&gt;Ecrecover is well tested&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Benchmark results &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7619&#x2F;assets&#x2F;benchmark_results&#x2F;&quot;&gt;here&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Then the 100 BenchmarkPrecompiledFalcon512 results were approximated to a linear equation dependent on the number of bytes in each test vector. From the approximation it was concluded that 1465 units of gas is the base requirement for any falcon-512 signature validation and 6 gas per word is additionally required.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;There is very little risk of breaking backwards-compatibility with this EIP, the sole issue being if someone were to build a contract relying on the address at &lt;code&gt;0x65&lt;&#x2F;code&gt; being empty. The likelihood of this is low, and should specific instances arise, the address could be chosen to be any arbitrary value with negligible risk of collision.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;A set of test vectors, with valid signatures, for benchmarking on new implementations is located in a separate &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7619&#x2F;assets&#x2F;bench_vectors&#x2F;&quot;&gt;file&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;A set of test vectors, with invalid data, to verify some invalid signature cases is located in a separate &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7619&#x2F;assets&#x2F;invalid_signature_test_vectors&#x2F;&quot;&gt;file&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Since the scope of this proposal is encapsulated at the contract level for verifying signatures it doesn&#x27;t represent issues in regards to security.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Tokenized Reserve</title>
        <published>2023-06-30T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Jimmy Debe</name><uri>https://github.com/jimstir</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7425/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7425-tokenized-reserve/15297" />
        

        <id>https://wg-eips.ritovision.com/7425/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7425"
            label="ERC-7425" />
        

        
        

        
        <summary type="html">Transparent reserve fund on-chain with stakeholder participation.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7425/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This specification explains a tokenized reserve mechanism standard. Current smart contracts record transactions and are made public. The reserve will implement added functionality allowing stakeholders proactively to audit a contract. Using &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4626&#x2F;&quot;&gt;ERC-4626&lt;&#x2F;a&gt;, stakeholders can create shares to show support for actions in the contract.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Tokenized vaults store &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens that are represented by shares within vault contracts. Implementations can follow the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4626&#x2F;&quot;&gt;ERC-4626&lt;&#x2F;a&gt; standard to provide basic functionality for depositing, withdrawing, and reading balances for a vault. As tokenization becomes increasingly popular, applications should use a form of tokenized vaults to store assets and allow all parties to track performance.&lt;&#x2F;p&gt;
&lt;p&gt;This specification introduces a standard for an on-chain reserve that uses tokenized vaults to represent reserve stakeholders. Core functionality, which is an extension of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4626&#x2F;&quot;&gt;ERC-4626&lt;&#x2F;a&gt;, will provide stakeholders representation by depositing and withdrawing from the vault. The record of transactions for other &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; assets should be easily accessible to any party for auditing.&lt;&#x2F;p&gt;
&lt;p&gt;In a tokenized reserve, stakeholders are represented by minting shares from the vault. The goal is to create a reserve similar to a real-world reserve fund used as a contingency for an entity. In most cases, an entity would follow criteria like running low on regular funds, to utilize the reserve fund. In a decentralized environment, an entity should incorporate stakeholders as criteria. Assets associated with the reserve as well as its origin will vary in decentralized environments, so transparent auditing is needed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions:&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;- owner: The creator of the reserve&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;- user: Stakeholders participating in policies&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;- reserve: The assets held on the contract other than underlying token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;- policies: Created by reserve owners to encourage stakeholder participation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;constructor&quot;&gt;Constructor:&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;- name: ERC-20 token name&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;- ticker: ERC-20 ticker&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;- asset: ERC-4626 underlying ERC-20 address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;- rAuth: Authorized user, for cases utilizing more than one owner&#x2F; limiting owner withdrawals&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;- rOwner: Owner of the Reserve&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;interface&quot;&gt;Interface&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;ERC4626.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TokenReserve&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC4626&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Event emitted after a new policy is created&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; policies&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	    	address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	    	uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; policyNum&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	    	uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recipient&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Event emitted after a new deposit is made by the owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; depositR&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	    	uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	    	uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; time&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	    	uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; count&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get time a deposit&#x2F;withdrawal was made by the owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; count&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Number for deposit count&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; block&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;.timestamp format&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ownerTime&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; count&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get amount deposited to reserve by owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; count&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Number for deposit count&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; policy&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The policy number to deposit to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Amount of an asset that was deposited&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ownerDeposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; count&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; policy&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Amount withdrawn for a opened policy by the owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; policy&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The policy number&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; of ERC20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ownerWithdrawals&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; policy&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Token type deposited to reserve by owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* - MUST be an address of ERC20 token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; count&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Number of deposit count&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of ERC20 token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenDeposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; count&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Amount deposited to a policy for shares&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* - MUST be an ERC20 token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; user&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of user&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; policy&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The policy number the user deposited to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Amount of ERC20 deposited&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; userDeposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; policy&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    	* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Amount withdrawn from a policy by the user&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; user&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of user&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    	* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; policy&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The policy number for user withdrawal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Amount of ERC20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    	*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; userWithdrawals&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; policy&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Token type withdrawn for an opened policy by the owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* - MUST be ERC20 address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; policy&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The policy number for the token used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Token&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC20 address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; policyToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; policy&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Make a deposit to a policy creating new shares using deposit function from ERC4626&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* - MUST be opened policy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* - MUST NOT be opened policy that was closed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* - SHOULD be only method to deposit to ERC4626 vault&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;NOTE&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: using the deposit() will cause assets to not be accounted for in a policy (see Security Considerations section)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; assets&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Amount being deposited&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; receiver&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of depositor&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; policy&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The number associated policy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; of shares minted &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; policyDeposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; assets&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; receiver&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; policy&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Burn shares, receive 1 to 1 value of shares using withdraw function from ERC4626&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* - MUST have userDeposit greater than or equal to userWithdrawal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* - SHOULD be only method for withdrawing from ERC4626 vault&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; assets&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Amount being deposited&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; receiver&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of receiver&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of token owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; policy&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Number associated policy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; of the asset&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; withdrawPolicy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; assets&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; receiver&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; policy&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Issue new policy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* - MUST create new policy number&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* - MUST account for amount withdrawn&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* - MUST be only method to withdraw ERC20 tokens (excluding underlying ERC4626 token)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* - MUST be owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* - SHOULD emit policies event&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; token&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of ERC-20 token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Token amount being withdrawn&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; receiver&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of token recipient&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; policy number&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; openPolicy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; receiver&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Make a deposit and&#x2F;or close an opened policy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* - MUST be owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* - MUST account for amount received&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* - SHOULD emit policies event&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; token&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of ERC-20 token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; policy&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Number of the desired policy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Token amount being deposited to the reserve&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; close&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Choose to close the policy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; True&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; for closed policy &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; closePolicy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; policy&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; close&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Accounting for tokens deposited by owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* - MUST be reserve owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* - SHOULD emit depositR event&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;NOTE&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: No shares are issued, funds can not be redeemed and no policy is opened. Withdrawnal made with openPolicy function.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; token&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of ERC-20 token being deposited&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of token sender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Token amount being deposited &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; depositReserve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This proposed standard is designed to be a core implementation of a tokenized reserve interface. Other non-specified conditions should be addressed on a case-by-case basis. Each reserve uses &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; standard for shares, and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4626&#x2F;&quot;&gt;ERC-4626&lt;&#x2F;a&gt; for the creation of shares. The reserve token SHOULD be considered as either the underlying &lt;code&gt;asset&lt;&#x2F;code&gt; for the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4626&#x2F;&quot;&gt;ERC-4626&lt;&#x2F;a&gt; vault or the shares that are created when depositing to the vault.
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4626&#x2F;&quot;&gt;ERC-4626&lt;&#x2F;a&gt; is used to create a transparent creation of stakeholders of the reserve. There MUST be a representation of interested parties in the reserve. The implementer can decide how to treat representation based on users entering and leaving the vault. For example, a user could be forced not to use the same tokens in multiple policies to allow shares to be distributed fairly.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Tokenized reserves are made compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4626&#x2F;&quot;&gt;ERC-4626&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Tokenized reserves share the same security considerations as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4626&#x2F;&quot;&gt;ERC-4626&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Assests withdrawn by owner are not secured by vaults.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;ul&gt;
&lt;li&gt;Stakeholders SHOULD be aware that the underlying &lt;code&gt;asset&lt;&#x2F;code&gt; can be withdrawn by the owner with no restrictions or authorizing party, like requiring an &lt;code&gt;rAuth&lt;&#x2F;code&gt;. Depending on the authorizing implementation, &lt;code&gt;asset&lt;&#x2F;code&gt; may still be withdrawn by the owner.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;A RECOMMENDED implementation:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;openPolicy&lt;&#x2F;code&gt; MUST explictly restrict the transfer of the underlying &lt;code&gt;asset&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If the underlying asset is apart of the reserve and not the vault,
the reserve MUST provide a method to avoid user &lt;code&gt;asset&lt;&#x2F;code&gt; loss.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Token Revenue Sharing</title>
        <published>2023-06-29T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Quy Phan</name><uri>https://github.com/quyphandang</uri>
	</author>
	
	<author>
		<name>Quy Phan</name><email>quy.phan@cryptoviet.info</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7254/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/token-revenue-sharing/14872" />
        

        <id>https://wg-eips.ritovision.com/7254/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7254"
            label="ERC-7254" />
        

        
        

        
        <summary type="html">Revenue token is a token that shares rewards for holders.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7254/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;With the aspiration of bringing forth unique functionality and enhancing value for holders of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens, our project aims to effortlessly reward token holders without necessitating users to lock, stake, or farm their tokens. Whenever the project generates profits, these profits can be distributed to the token holders.&lt;&#x2F;p&gt;
&lt;p&gt;Revenue Sharing is an extended version of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;. It proposes an additional payment method for token holders.&lt;&#x2F;p&gt;
&lt;p&gt;This standard includes updating rewards for holders and allowing token holders to withdraw rewards.&lt;&#x2F;p&gt;
&lt;p&gt;Potential use cases encompass:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Companies distributing dividends to token holders.&lt;&#x2F;li&gt;
&lt;li&gt;Direct sharing of revenue derived from business activities, such as marketplaces, Automated Market Makers (AMMs), and games.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;methods&quot;&gt;Methods&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;maxtokenreward&quot;&gt;maxTokenReward&lt;&#x2F;h4&gt;
&lt;p&gt;Returns  max token reward.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; maxTokenReward&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;informationof&quot;&gt;informationOf&lt;&#x2F;h4&gt;
&lt;p&gt;Returns the account information of another account with the address &lt;code&gt;token&lt;&#x2F;code&gt; and &lt;code&gt;account&lt;&#x2F;code&gt;, including: inReward, outReward and withdraw.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; informationOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;UserInformation&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;informationofbatch&quot;&gt;informationOfBatch&lt;&#x2F;h4&gt;
&lt;p&gt;Returns the list account information of another account with the &lt;code&gt;account&lt;&#x2F;code&gt;, including: inReward, outReward and withdraw.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; informationOfBatch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;UserInformation&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;userinformation&quot;&gt;UserInformation&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;inReward&lt;&#x2F;code&gt;: when user&#x27;s balance decreases, inReward will be updated
&lt;code&gt;outReward&lt;&#x2F;code&gt;: when user&#x27;s balance increases, outReward will be updated
&lt;code&gt;withdraw&lt;&#x2F;code&gt;: total amount of reward tokens withdrawn&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UserInformation&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; inReward&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; outReward&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; withdraw&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;tokenreward&quot;&gt;tokenReward&lt;&#x2F;h4&gt;
&lt;p&gt;Returns the list token reward address of the token.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenReward&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;updatereward&quot;&gt;updateReward&lt;&#x2F;h4&gt;
&lt;p&gt;Updates rewardPerShare of token reward.
rewardPerShare = rewardPerShare + amount &#x2F; totalSupply()&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; updateReward&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;viewreward&quot;&gt;viewReward&lt;&#x2F;h4&gt;
&lt;p&gt;Returns the list amount of reward for an account&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; viewReward&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;getreward&quot;&gt;getReward&lt;&#x2F;h4&gt;
&lt;p&gt;Gets and returns reward with list token reward.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getReward&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;getrewardpershare&quot;&gt;getRewardPerShare&lt;&#x2F;h4&gt;
&lt;p&gt;Returns the reward per share of token reward.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getRewardPerShare&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;existstokenreward&quot;&gt;existsTokenReward&lt;&#x2F;h4&gt;
&lt;p&gt;Returns the status of token reward.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; existsTokenReward&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7254&#x2F;.&#x2F;assets&#x2F;ERC7254.sol&quot;&gt;ERC-7254&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7254&#x2F;.&#x2F;assets&#x2F;IERC7254.sol&quot;&gt;IERC-7254&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Increase the MAX_EFFECTIVE_BALANCE</title>
        <published>2023-06-28T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>mike</name><uri>https://github.com/michaelneuder</uri>
	</author>
	
	<author>
		<name>Francesco</name><uri>https://github.com/fradamt</uri>
	</author>
	
	<author>
		<name>dapplion</name><uri>https://github.com/dapplion</uri>
	</author>
	
	<author>
		<name>Mikhail</name><uri>https://github.com/mkalinin</uri>
	</author>
	
	<author>
		<name>Aditya</name><uri>https://github.com/adiasg</uri>
	</author>
	
	<author>
		<name>Justin</name><uri>https://github.com/justindrake</uri>
	</author>
	
	<author>
		<name>lightclient</name><uri>https://github.com/lightclient</uri>
	</author>
	
	<author>
		<name>Felix Lange</name><uri>https://github.com/fjl</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7251/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7251-increase-the-max-effective-balance/15982" />
        

        <id>https://wg-eips.ritovision.com/7251/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:7251"
            label="EIP-7251" />
        

        
        

        
        <summary type="html">Allow validators to have larger effective balances, while maintaining the 32 ETH lower bound.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7251/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Increases the constant &lt;code&gt;MAX_EFFECTIVE_BALANCE&lt;&#x2F;code&gt;, while keeping the minimum staking balance &lt;code&gt;32 ETH&lt;&#x2F;code&gt;. This permits large node operators to consolidate into fewer validators while also allowing solo-stakers to earn compounding rewards and stake in more flexible increments.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;As of October 3, 2023, there are currently over 830,000 validators participating in the consensus layer. The size of this set continues to grow due, in part, to the &lt;code&gt;MAX_EFFECTIVE_BALANCE&lt;&#x2F;code&gt;, which limits the stake of a single validator to &lt;code&gt;32 ETH&lt;&#x2F;code&gt;. This leads to large amounts of &quot;redundant validators&quot;, which are controlled by a single entity, possibly running on the same beacon node, but with distinct BLS signing keys. The limit on the &lt;code&gt;MAX_EFFECTIVE_BALANCE&lt;&#x2F;code&gt; is technical debt from the original sharding design, in which subcommittees (not the attesting committee but the committee calculated in &lt;code&gt;is_aggregator&lt;&#x2F;code&gt;) needed to be majority honest. As a result, keeping the weights of subcommittee members approximately equal reduced the risk of a single large validator containing too much influence. Under the current design, these subcommittees are only used for attestation aggregation, and thus only have a &lt;code&gt;1&#x2F;N&lt;&#x2F;code&gt; honesty assumption.&lt;&#x2F;p&gt;
&lt;p&gt;With the security model of the protocol no longer dependent on a low value for &lt;code&gt;MAX_EFFECTIVE_BALANCE&lt;&#x2F;code&gt;, we propose raising this value while keeping the minimum validator threshold of &lt;code&gt;32 ETH&lt;&#x2F;code&gt;. This increase aims to reduce the validator set size, thereby reducing the number of P2P messages over the network, the number of BLS signatures that need to be aggregated each epoch, and the &lt;code&gt;BeaconState&lt;&#x2F;code&gt; memory footprint. This change adds value for both small and large validators. Large validators can consolidate to run fewer validators and thus fewer beacon nodes. Small validators now benefit from compounding rewards and the ability to stake in more flexible increments (e.g., the ability to stake &lt;code&gt;40 ETH&lt;&#x2F;code&gt; instead of needing to accumulate &lt;code&gt;64 ETH&lt;&#x2F;code&gt; to run two validators today).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;execution-layer&quot;&gt;Execution layer&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Comment&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CONSOLIDATION_REQUEST_TYPE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x02&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7685&#x2F;&quot;&gt;EIP-7685&lt;&#x2F;a&gt; type prefix for consolidation request&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x0000BBdDc7CE488642fb579F8B00f3a590007251&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Where to call and store relevant details about consolidation request mechanism&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SYSTEM_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xfffffffffffffffffffffffffffffffffffffffe&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Address used to invoke system operation on contract&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;EXCESS_CONSOLIDATION_REQUESTS_STORAGE_SLOT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CONSOLIDATION_REQUEST_COUNT_STORAGE_SLOT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CONSOLIDATION_REQUEST_QUEUE_HEAD_STORAGE_SLOT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Pointer to the head of the consolidation request message queue&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CONSOLIDATION_REQUEST_QUEUE_TAIL_STORAGE_SLOT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;3&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Pointer to the tail of the consolidation request message queue&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CONSOLIDATION_REQUEST_QUEUE_STORAGE_OFFSET&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;4&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The start memory slot of the in-state consolidation request message queue&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_CONSOLIDATION_REQUESTS_PER_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Maximum number of consolidation requests that can be dequeued into a block&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TARGET_CONSOLIDATION_REQUESTS_PER_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MIN_CONSOLIDATION_REQUEST_FEE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CONSOLIDATION_REQUEST_FEE_UPDATE_FRACTION&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;17&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;EXCESS_INHIBITOR&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2**256-1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Excess value used to compute the fee before the first system call&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;consensus-layer&quot;&gt;Consensus layer&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;COMPOUNDING_WITHDRAWAL_PREFIX&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;Bytes1(&#x27;0x02&#x27;)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MIN_ACTIVATION_BALANCE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;Gwei(2**5 * 10**9)&lt;&#x2F;code&gt;  (32 ETH)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_EFFECTIVE_BALANCE_ELECTRA&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;Gwei(2**11 * 10**9)&lt;&#x2F;code&gt; (2048 ETH)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;execution-layer-1&quot;&gt;Execution layer&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;consolidation-request&quot;&gt;Consolidation request&lt;&#x2F;h4&gt;
&lt;p&gt;The new consolidation request is an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7685&#x2F;&quot;&gt;EIP-7685&lt;&#x2F;a&gt; request with type &lt;code&gt;0x02&lt;&#x2F;code&gt; consisting of the following fields:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;source_address&lt;&#x2F;code&gt;: &lt;code&gt;Bytes20&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;source_pubkey&lt;&#x2F;code&gt;: &lt;code&gt;Bytes48&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;target_pubkey&lt;&#x2F;code&gt;: &lt;code&gt;Bytes48&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7685&#x2F;&quot;&gt;EIP-7685&lt;&#x2F;a&gt; encoding of a consolidation request is as follows. Note we simply return the encoded request value as returned by the contract.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;request_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CONSOLIDATION_REQUEST_TYPE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;request_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; dequeue_consolidation_requests&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;consolidation-request-contract&quot;&gt;Consolidation request contract&lt;&#x2F;h4&gt;
&lt;p&gt;The contract has three different code paths, which can be summarized at a high level as follows:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Add consolidation request - requires a &lt;code&gt;96&lt;&#x2F;code&gt; byte input, concatenated public keys of the source and the target validators.&lt;&#x2F;li&gt;
&lt;li&gt;Fee getter - if the input length is zero, return the current fee required to add a consolidation request.&lt;&#x2F;li&gt;
&lt;li&gt;System process - if called by system address, pop off the consolidation requests for the current block from the queue.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h5 id=&quot;add-consolidation-request&quot;&gt;Add Consolidation Request&lt;&#x2F;h5&gt;
&lt;p&gt;If call data input to the contract is exactly &lt;code&gt;96&lt;&#x2F;code&gt; bytes, perform the following:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Ensure enough ETH was sent to cover the current consolidation request fee (&lt;code&gt;msg.value &amp;gt;= get_fee()&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;Increase consolidation request count by &lt;code&gt;1&lt;&#x2F;code&gt; for the current block (&lt;code&gt;increment_count()&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;Insert a consolidation request into the queue for the source address and pubkeys of the source and the target (&lt;code&gt;insert_consolidation_request_into_queue()&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Specifically, the functionality is defined in pseudocode as the function &lt;code&gt;add_consolidation_request()&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; add_consolidation_request&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;Bytes48&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; source_pubkey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; Bytes48&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; target_pubkey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Add consolidation request adds new request to the consolidation request queue, so long as a sufficient fee is provided.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify sufficient fee was provided.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_fee&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span&gt; fee&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Insufficient value for fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Increment consolidation request count.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    count&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CONSOLIDATION_REQUEST_COUNT_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CONSOLIDATION_REQUEST_COUNT_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; count&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Insert into queue.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    queue_tail_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CONSOLIDATION_REQUEST_QUEUE_TAIL_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    queue_storage_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CONSOLIDATION_REQUEST_QUEUE_STORAGE_OFFSET&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; queue_tail_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; queue_storage_slot&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; queue_storage_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; source_pubkey&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; queue_storage_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; source_pubkey&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;48&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; ++&lt;&#x2F;span&gt;&lt;span&gt; target_pubkey&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;16&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; queue_storage_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; target_pubkey&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;16&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;48&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CONSOLIDATION_REQUEST_QUEUE_TAIL_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; queue_tail_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h6 id=&quot;fee-calculation&quot;&gt;Fee calculation&lt;&#x2F;h6&gt;
&lt;p&gt;The following pseudocode can compute the cost of an individual consolidation request, given a certain number of excess consolidation requests.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_fee&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EXCESS_CONSOLIDATION_REQUESTS_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EXCESS_INHIBITOR&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Inhibitor still active&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; fake_exponential&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        MIN_CONSOLIDATION_REQUEST_FEE&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        excess&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        CONSOLIDATION_REQUEST_FEE_UPDATE_FRACTION&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fake_exponential&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;factor&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; numerator&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; denominator&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    output&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    numerator_accum&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; factor&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; denominator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    while&lt;&#x2F;span&gt;&lt;span&gt; numerator_accum&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        output&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; numerator_accum&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        numerator_accum&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;numerator_accum&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; numerator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;denominator&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; output&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; denominator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;fee-getter&quot;&gt;Fee Getter&lt;&#x2F;h5&gt;
&lt;p&gt;When the input to the contract is length zero, interpret this as a get request for the current fee, i.e. the contract returns the result of &lt;code&gt;get_fee()&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;system-call&quot;&gt;System Call&lt;&#x2F;h5&gt;
&lt;p&gt;At the end of processing any execution block where this EIP is active (i.e. after processing all transactions and after performing the block body consolidation requests validations), call the contract at &lt;code&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;code&gt; as &lt;code&gt;SYSTEM_ADDRESS&lt;&#x2F;code&gt; with no calldata. The invocation triggers the following:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The contract&#x27;s queue is updated based on consolidation requests dequeued and the consolidation requests queue head&#x2F;tail are reset if the queue has been cleared (&lt;code&gt;dequeue_consolidation_requests()&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;The contract&#x27;s excess consolidation requests are updated based on usage in the current block (&lt;code&gt;update_excess_consolidation_requests()&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;The contract&#x27;s consolidation requests count is reset to &lt;code&gt;0&lt;&#x2F;code&gt; (&lt;code&gt;reset_consolidation_requests_count()&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Each consolidation request must appear in the EIP-7685 requests list in the exact order returned by &lt;code&gt;dequeue_consolidation_requests()&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, the system call and the processing of that block must conform to the following:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The call has a dedicated gas limit of &lt;code&gt;30_000_000&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Gas consumed by this call does not count against the block’s overall gas usage.&lt;&#x2F;li&gt;
&lt;li&gt;Both the gas limit assigned to the call and the gas consumed are excluded from any checks against the block’s gas limit.&lt;&#x2F;li&gt;
&lt;li&gt;The call does not follow &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; fee burn semantics — no value should be transferred as part of this call.&lt;&#x2F;li&gt;
&lt;li&gt;If there is no code at &lt;code&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;code&gt;, the corresponding block &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be marked invalid.&lt;&#x2F;li&gt;
&lt;li&gt;If the call to the contract fails or returns an error, the block &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be invalidated.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The functionality triggered by the system call is defined in pseudocode as the function &lt;code&gt;process_consolidation_requests()&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;##################&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Public function #&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;##################&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; process_consolidation_requests&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    reqs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; dequeue_consolidation_requests&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    update_excess_consolidation_requests&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    reset_consolidation_requests_count&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; ssz&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;serialize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;reqs&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;##########&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Helpers #&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;##########&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ConsolidationRequest&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;object&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    source_address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    source_pubkey&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes48&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    target_pubkey&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes48&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; dequeue_consolidation_requests&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    queue_head_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CONSOLIDATION_REQUEST_QUEUE_HEAD_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    queue_tail_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CONSOLIDATION_REQUEST_QUEUE_TAIL_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    num_in_queue&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; queue_tail_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; queue_head_index&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    num_dequeued&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;num_in_queue&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_CONSOLIDATION_REQUESTS_PER_BLOCK&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    reqs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;num_dequeued&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        queue_storage_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CONSOLIDATION_REQUEST_QUEUE_STORAGE_OFFSET&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;queue_head_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        source_address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; queue_storage_slot&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;20&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        source_pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; queue_storage_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; queue_storage_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;16&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        target_pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; queue_storage_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;16&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; queue_storage_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        req&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; ConsolidationRequest&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            source_address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;Bytes20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;source_address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            source_pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;Bytes48&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;source_pubkey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            target_pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;Bytes48&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;target_pubkey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        reqs&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;req&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    new_queue_head_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; queue_head_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; num_dequeued&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; new_queue_head_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; queue_tail_index&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Queue is empty, reset queue pointers&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CONSOLIDATION_REQUEST_QUEUE_HEAD_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CONSOLIDATION_REQUEST_QUEUE_TAIL_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CONSOLIDATION_REQUEST_QUEUE_HEAD_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; new_queue_head_index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; reqs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; update_excess_consolidation_requests&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    previous_excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EXCESS_CONSOLIDATION_REQUESTS_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check if excess needs to be reset to 0 for first iteration after activation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; previous_excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EXCESS_INHIBITOR&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        previous_excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    count&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CONSOLIDATION_REQUEST_COUNT_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    new_excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; previous_excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; count&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TARGET_CONSOLIDATION_REQUESTS_PER_BLOCK&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        new_excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; previous_excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; count&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TARGET_CONSOLIDATION_REQUESTS_PER_BLOCK&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EXCESS_CONSOLIDATION_REQUESTS_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; new_excess&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; reset_consolidation_requests_count&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CONSOLIDATION_REQUEST_COUNT_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;bytecode&quot;&gt;Bytecode&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;asm&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;caller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push20 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xfffffffffffffffffffffffffffffffffffffffe&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;eq&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xd3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x11&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push32 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;eq&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x019a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;mul&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;iszero&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x68&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;mul&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;mul&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;div&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x4d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jump&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;div&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;calldatasize&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x60&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;eq&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x88&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;calldatasize&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x019a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;callvalue&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x019a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;callvalue&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;lt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x019a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x03&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x04&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;mul&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x04&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;caller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x40&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;caller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x60&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;shl&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x60&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x14&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;calldatacopy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x74&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;log0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x03&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;stop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x03&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x02&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;sub&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x02&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xe7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x02&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;eq&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x0129&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x04&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;mul&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x04&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x74&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;mul&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x60&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;shl&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x14&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x02&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x03&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xe9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jump&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;eq&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x013b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x02&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x0146&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jump&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x02&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x03&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push32 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;eq&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;iszero&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x0173&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x0188&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x018e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jump&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;sub&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x74&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;mul&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;revert&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;deployment&quot;&gt;Deployment&lt;&#x2F;h5&gt;
&lt;p&gt;The consolidation requests contract is deployed like any other smart contract. A special synthetic address is generated by working backwards from the desired deployment transaction:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; null&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x3d090&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gasPrice&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xe8d4a51000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;maxPriorityFeePerGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; null&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;maxFeePerGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; null&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;input&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff5f5561019e80602d5f395ff33373fffffffffffffffffffffffffffffffffffffffe1460d35760115f54807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1461019a57600182026001905f5b5f82111560685781019083028483029004916001019190604d565b9093900492505050366060146088573661019a573461019a575f5260205ff35b341061019a57600154600101600155600354806004026004013381556001015f358155600101602035815560010160403590553360601b5f5260605f60143760745fa0600101600355005b6003546002548082038060021160e7575060025b5f5b8181146101295782810160040260040181607402815460601b815260140181600101548152602001816002015481526020019060030154905260010160e9565b910180921461013b5790600255610146565b90505f6002555f6003555b5f54807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff141561017357505f5b6001546001828201116101885750505f61018e565b01600190035b5f555f6001556074025ff35b5f5ffd&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;v&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x539&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xc0730f92dc275b663d377a7cbb141b6600052&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x379269d571beff3ed1d8eba3abb24076a7267b0eaf0cc66d728fb0544f5a690d&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Sender: 0x13d1913d623E6a9D8811736359E50fD31Fe54fCA&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Address: 0x0000BBdDc7CE488642fb579F8B00f3a590007251&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;consensus-layer-1&quot;&gt;Consensus layer&lt;&#x2F;h3&gt;
&lt;p&gt;The defining features of this EIP are:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;em&gt;&lt;strong&gt;Increasing the &lt;code&gt;MAX_EFFECTIVE_BALANCE&lt;&#x2F;code&gt;, while creating a &lt;code&gt;MIN_ACTIVATION_BALANCE&lt;&#x2F;code&gt;.&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt; The core feature of allowing variable size validators.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;&lt;strong&gt;Allowing for multiple validator indices to be combined through the protocol.&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt; A mechanism by which large node operators can combine validators without cycling through the exit and activation queues.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;&lt;strong&gt;Adding execution layer partial withdrawals (part of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7002&#x2F;&quot;&gt;EIP-7002&lt;&#x2F;a&gt;).&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt; Allowing Execution Layer messages to trigger partial withdrawals in addition to full exits (e.g., a &lt;code&gt;100 ETH&lt;&#x2F;code&gt; validator can remove up to &lt;code&gt;68 ETH&lt;&#x2F;code&gt; without exiting the validator).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;&lt;strong&gt;Making the initial slashing penalty negligible.&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt; This reduces the risk of consolidation for large validators.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7251&#x2F;#rationale&quot;&gt;Rationale&lt;&#x2F;a&gt; section contains an explanation for each of these proposed core features. A sketch of the resulting changes to the consensus layer is included below.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Add &lt;code&gt;COMPOUNDING_WITHDRAWAL_PREFIX&lt;&#x2F;code&gt; and &lt;code&gt;MIN_ACTIVATION_BALANCE&lt;&#x2F;code&gt; constants, while introducing the updated value of &lt;code&gt;MAX_EFFECTIVE_BALANCE&lt;&#x2F;code&gt; (&lt;code&gt;MAX_EFFECTIVE_BALANCE_ELECTRA&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;Create the &lt;code&gt;PendingDeposit&lt;&#x2F;code&gt; container, which is used to track incoming deposits in the weight-based rate limiting mechanism.&lt;&#x2F;li&gt;
&lt;li&gt;Update the &lt;code&gt;BeaconState&lt;&#x2F;code&gt; with deposit and partial withdrawal queues, fields needed for deposit, and exit queue weight-based rate limiting.&lt;&#x2F;li&gt;
&lt;li&gt;Modify &lt;code&gt;is_eligible_for_activation_queue&lt;&#x2F;code&gt; to check against &lt;code&gt;MIN_ACTIVATION_BALANCE&lt;&#x2F;code&gt; rather than &lt;code&gt;MAX_EFFECTIVE_BALANCE&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Modify &lt;code&gt;get_validator_churn_limit&lt;&#x2F;code&gt; to depend on the validator weight rather than the validator count.&lt;&#x2F;li&gt;
&lt;li&gt;Create a helper &lt;code&gt;compute_exit_epoch_and_update_churn&lt;&#x2F;code&gt; to calculate the exit epoch based on the current pending withdrawals.&lt;&#x2F;li&gt;
&lt;li&gt;Modify &lt;code&gt;initiate_validator_exit&lt;&#x2F;code&gt; to rate limit the exit queue by balance rather than the number of validators.&lt;&#x2F;li&gt;
&lt;li&gt;Modify &lt;code&gt;initialize_beacon_state_from_eth1&lt;&#x2F;code&gt; to use &lt;code&gt;MIN_ACTIVATION_BALANCE&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Modify &lt;code&gt;process_registry_updates&lt;&#x2F;code&gt; to activate all eligible validators.&lt;&#x2F;li&gt;
&lt;li&gt;Add a per-epoch helper, &lt;code&gt;process_pending_deposits&lt;&#x2F;code&gt;, to consume some of the pending deposits.&lt;&#x2F;li&gt;
&lt;li&gt;Modify &lt;code&gt;get_validator_from_deposit&lt;&#x2F;code&gt; to initialize the effective balance to zero (it&#x27;s updated by the pending deposit flow).&lt;&#x2F;li&gt;
&lt;li&gt;Modify &lt;code&gt;process_deposit&lt;&#x2F;code&gt; to store incoming deposits in &lt;code&gt;state.pending_deposits&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Modify &lt;code&gt;compute_weak_subjectivity_period&lt;&#x2F;code&gt; to use the new churn limit function.&lt;&#x2F;li&gt;
&lt;li&gt;Add &lt;code&gt;has_compounding_withdrawal_credential&lt;&#x2F;code&gt; to check for the &lt;code&gt;0x02&lt;&#x2F;code&gt; credential.&lt;&#x2F;li&gt;
&lt;li&gt;Modify &lt;code&gt;is_fully_withdrawable_validator&lt;&#x2F;code&gt; to check for compounding credentials.&lt;&#x2F;li&gt;
&lt;li&gt;Add &lt;code&gt;get_validator_excess_balance&lt;&#x2F;code&gt; to calculate the excess balance of validators.&lt;&#x2F;li&gt;
&lt;li&gt;Modify &lt;code&gt;is_partially_withdrawable_validator&lt;&#x2F;code&gt; to check for excess balance.&lt;&#x2F;li&gt;
&lt;li&gt;Modify &lt;code&gt;get_expected_withdrawals&lt;&#x2F;code&gt; to use excess balance and process pending partial withdrawals.&lt;&#x2F;li&gt;
&lt;li&gt;Add &lt;code&gt;process_consolidation&lt;&#x2F;code&gt; to initiate in-protocol validator consolidation and switch a validator to compounding withdrawal credentials.&lt;&#x2F;li&gt;
&lt;li&gt;Limits the usage of exit churn to 256 ETH (equivalent to 8 validators with 32 ETH effective balance), and defers the surplus of the churn to process consolidations.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Full consensus layer specification can be found in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;834e40604ae4411e565bd6540da50b008b2496dc&#x2F;specs&#x2F;electra&#x2F;beacon-chain.md&quot;&gt;&lt;code&gt;.&#x2F;electra&#x2F;beacon-chain.md&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP aims to reduce the total number of validators without changing anything about the economic security of the protocol. It provides a mechanism by which large node operators who control significant amounts of stake can consolidate into fewer validators. We analyze the reasoning behind each of the core features.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;increasing-the-max-effective-balance-while-creating-a-min-activation-balance&quot;&gt;Increasing the &lt;code&gt;MAX_EFFECTIVE_BALANCE&lt;&#x2F;code&gt;, while creating a &lt;code&gt;MIN_ACTIVATION_BALANCE&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;While increasing the &lt;code&gt;MAX_EFFECTIVE_BALANCE&lt;&#x2F;code&gt; to allow larger-stake validators, it is important to keep the lower bound of &lt;code&gt;32 ETH&lt;&#x2F;code&gt; (by introducing a new constant – &lt;code&gt;MIN_ACTIVATION_BALANCE&lt;&#x2F;code&gt;) to encourage solo-staking.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;allowing-for-multiple-validator-indices-to-be-combined-through-the-protocol&quot;&gt;Allowing for multiple validator indices to be combined through the protocol&lt;&#x2F;h3&gt;
&lt;p&gt;For large staking pools that already control thousands of validators, exiting and re-entering would be extremely slow and costly. The adoption of the EIP will be much higher by allowing in-protocol consolidation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;adding-execution-layer-partial-withdrawals-part-of-eip-7002&quot;&gt;Adding execution layer partial withdrawals (part of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7002&#x2F;&quot;&gt;EIP-7002&lt;&#x2F;a&gt;)&lt;&#x2F;h3&gt;
&lt;p&gt;For validators that choose to raise their effective balance ceiling, allowing for custom partial withdrawals triggered from the execution layer increases the flexibility of the staking configurations. Validators can choose when and how much they withdraw but will have to pay gas for the EL transaction.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;making-the-initial-slashing-penalty-negligible&quot;&gt;Making the initial slashing penalty negligible&lt;&#x2F;h3&gt;
&lt;p&gt;To encourage consolidation, we could modify the slashing penalties. The biggest hit comes from the initial penalty of &lt;code&gt;1&#x2F;32&lt;&#x2F;code&gt; of the validator&#x27;s effective balance. Since this scales linearly on the effective balance, the higher-stake validators directly incur higher risk. By changing the scaling properties, we could make consolidation more attractive.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;consolidation-contract-parameter-values&quot;&gt;Consolidation contract parameter values&lt;&#x2F;h3&gt;
&lt;p&gt;The consolidation smart contract uses a fee mechanism to rate limit the number of requests per block. Details of the fee mechanism are available in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7002&#x2F;#fee-update-rule&quot;&gt;EIP-7002&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;TARGET_CONSOLIDATION_REQUESTS_PER_BLOCK&lt;&#x2F;code&gt; is chosen to be &lt;code&gt;1&lt;&#x2F;code&gt; to rate limit consolidation requests as much as possible.
&lt;code&gt;MAX_CONSOLIDATION_REQUESTS_PER_BLOCK&lt;&#x2F;code&gt; is chosen to be &lt;code&gt;2&lt;&#x2F;code&gt; to allow for switching a validator to compounding credentials and requesting a consolidation in the same block.&lt;&#x2F;p&gt;
&lt;p&gt;One consolidation per block is still higher than the size of consolidation churn which can lead to unbounded growth of the consolidation queue.
Thus, there is a hard limit on the consolidation queue size equal to 262,144 requests which is &lt;code&gt;4 MB&lt;&#x2F;code&gt; of data in the beacon state.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces backward incompatible changes to the block validation rule set and must be accompanied by a hard fork. These changes do not break anything related to current user activity and experience.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This change modifies committees and churn, but doesn&#x27;t significantly impact the security properties.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;security-of-attestation-committees&quot;&gt;Security of attestation committees&lt;&#x2F;h3&gt;
&lt;p&gt;Given full consolidation as the worst case, the probability of an adversarial takeover of a committee remains low. Even in a high consolidation scenario, the required share of honest validators remains well below the 2&#x2F;3 supermajority needed for finality.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;aggregator-selection&quot;&gt;Aggregator selection&lt;&#x2F;h3&gt;
&lt;p&gt;In the original sharding roadmap, subcommittees were required to be secure with extremely high probability. Now with the sole responsibility of attestation aggregation, we only require each committee to have at least one honest aggregator. Currently, aggregators are selected through a VRF lottery, targeting several validator units that can be biased by non-consolidated attackers. This proposal changes the VRF lottery to consider weight, so the probability of having at least one honest aggregator is not worse.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;proposer-selection-probability&quot;&gt;Proposer selection probability&lt;&#x2F;h3&gt;
&lt;p&gt;Proposer selection is already weighted by the ratio of their effective balance to &lt;code&gt;MAX_EFFECTIVE_BALANCE&lt;&#x2F;code&gt;. Due to the lower probabilities, this change will slightly increase the time it takes to calculate the next proposer index.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;sync-committee-selection-probability&quot;&gt;Sync committee selection probability&lt;&#x2F;h3&gt;
&lt;p&gt;Sync committee selection is also already weighted by effective balance, so this proposal does not require modifications to the sync protocol. Light clients can still check that a super-majority of participants have signed an update irrespective of their weights since we maintain a weight-based selection probability.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;churn-invariants&quot;&gt;Churn invariants&lt;&#x2F;h3&gt;
&lt;p&gt;This proposal maintains the activation and exit churn invariants limiting active weight instead of validator count. Balance top-ups are now handled explicitly, being subject to the same activation queue as full deposits.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;fee-overpayment&quot;&gt;Fee Overpayment&lt;&#x2F;h3&gt;
&lt;p&gt;Calls to the system contract require a fee payment defined by the current contract state. Overpaid fees are not returned to the caller. It is not generally possible to compute the exact required fee amount ahead of time. When adding a consolidation request from a contract, the contract can perform a read operation to check for the current fee and then pay exactly the required amount. Here is an example in Solidity:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function addConsolidation(bytes memory srcPubkey, bytes memory targetPubkey, uint64 requestFeeLimit) private {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    assert(srcPubkey.length == 48);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    assert(targetPubkey.length == 48);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; Read current fee from the contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (bool readOK, bytes memory feeData) = ConsolidationsContract.staticcall(&amp;#39;&amp;#39;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if (!readOK) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        revert(&amp;#39;reading fee failed&amp;#39;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    uint256 fee = uint256(bytes32(feeData));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; Check the fee is not too high.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if (fee &amp;gt; requestFeeLimit) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        revert(&amp;#39;fee is too high&amp;#39;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; Add the request.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytes memory callData = bytes.concat(srcPubkey, targetPubkey);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (bool writeOK,) = ConsolidationsContract.call{value: fee}(callData);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if (!writeOK) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        revert(&amp;#39;adding request failed&amp;#39;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note: the system contract uses the EVM &lt;code&gt;CALLER&lt;&#x2F;code&gt; operation (Solidity: &lt;code&gt;msg.sender&lt;&#x2F;code&gt;) to get the address used in the consolidation request, i.e. the address that calls the system contract must match the 0x01 withdrawal credential recorded in the beacon state.&lt;&#x2F;p&gt;
&lt;p&gt;Note: the above code reverts if the fee is too high, the fee can change significantly between the creation of a consolidation request transaction and its inclusion into a block, thus, this check is very important to avoid overpayments.&lt;&#x2F;p&gt;
&lt;p&gt;Using an EOA to request consolidations will always result in overpayment of fees. There is no way for an EOA to use a wrapper contract to request a consolidation. And even if a way existed, the gas cost of returning the overage would likely be higher than the overage itself. If requesting consolidations from an EOA to the system contract is desired, we recommend that users perform transaction simulations to estimate a reasonable fee amount to send.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;consolidation-queue-hard-limit&quot;&gt;Consolidation queue hard limit&lt;&#x2F;h3&gt;
&lt;p&gt;Consolidations exceeding the hard limit of the consolidation queue (262,144 requests) will be discarded by the consensus layer and will need to be re-submitted,
note that the fee is not refunded in this case.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;system-call-failure&quot;&gt;System Call failure&lt;&#x2F;h3&gt;
&lt;p&gt;Although the likelihood of a failed system call to &lt;code&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;code&gt; is extremely low, the behavior in such cases is well-defined: the block is marked as invalid. This consideration directly follows from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7002&#x2F;#system-call-failure&quot;&gt;EIP-7002&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;empty-code-failure&quot;&gt;Empty Code failure&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP should not have been activated if there is no code present at &lt;code&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;code&gt; (i.e., if the chain is not &quot;ready&quot;). This is also similar to the consideration in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7002&#x2F;#empty-code-failure&quot;&gt;EIP-7002&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Encumber - Splitting Ownership &amp; Guarantees</title>
        <published>2023-06-27T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Coburn Berry</name><uri>https://github.com/coburncoburn</uri>
	</author>
	
	<author>
		<name>Mykel Pereira</name><uri>https://github.com/mykelp</uri>
	</author>
	
	<author>
		<name>Scott Silver</name><uri>https://github.com/scott-silver</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7246/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/encumber-extending-the-erc-20-token-standard-to-allow-pledging-tokens-without-giving-up-ownership/14849" />
        

        <id>https://wg-eips.ritovision.com/7246/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7246"
            label="ERC-7246" />
        

        
        

        
        <summary type="html">A token interface to allow pledging tokens without transferring ownership.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7246/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC proposes an extension to the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; token standard by adding Encumber—the ability for an account to grant another account exclusive right to move some portion of their balance. Encumber is a stronger version of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; allowances. While &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; approve grants another account the permission to transfer a specified token amount, encumber grants the same permission while ensuring that the tokens will be available when needed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This extension adds flexibility to the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; token standard and caters to use cases where token locking is required, but it is preferential to maintain actual ownership of tokens. This interface can also be adapted to other token standards, such as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;, in a straightforward manner&lt;&#x2F;p&gt;
&lt;p&gt;Token holders commonly transfer their tokens to smart contracts which will return the tokens under specific conditions. In some cases, smart contracts do not actually need to hold the tokens, but need to guarantee they will be available if necessary. Since allowances do not provide a strong enough guarantee, the only way to do guarantee token availability presently is to transfer the token to the smart contract. Locking tokens without moving them gives more clear indication of the rights and ownership of the tokens. This allows for airdrops and other ancillary benefits of ownership to reach the true owner. It also adds another layer of safety, where draining a pool of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens can be done in a single transfer, iterating accounts to transfer encumbered tokens would be significantly more prohibitive in gas usage.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;A compliant token MUST implement the following interface&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Interface of the ERC-7246 standard.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7246&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when `amount` tokens are encumbered from `owner` to `taker`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Encumber&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; taker&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when the encumbrance of a `taker` to an `owner` is reduced by `amount`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Release&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; taker&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the total amount of tokens owned by `owner` that are currently encumbered.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST never exceed `balanceOf(owner)`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Any function which would reduce balanceOf(owner) below encumberedBalanceOf(owner) MUST revert&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; encumberedBalanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the number of tokens that `owner` has encumbered to `taker`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * This value increases when {encumber} or {encumberFrom} are called by the `owner` or by another permitted account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * This value decreases when {release} and {transferFrom} are called by `taker`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; encumbrances&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; taker&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Increases the amount of tokens that the caller has encumbered to `taker` by `amount`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Grants to `taker` a guaranteed right to transfer `amount` from the caller&amp;#39;s balance by using `transferFrom`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST revert if caller does not have `amount` tokens available&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * (e.g. if `balanceOf(caller) - encumberedBalanceOf(caller) &amp;lt; amount`).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Emits an {Encumber} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; encumber&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; taker&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Increases the amount of tokens that `owner` has encumbered to `taker` by `amount`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Grants to `taker` a guaranteed right to transfer `amount` from `owner` using transferFrom&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * The function SHOULD revert unless the owner account has deliberately authorized the sender of the message via some mechanism.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST revert if `owner` does not have `amount` tokens available&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * (e.g. if `balanceOf(owner) - encumberedBalanceOf(owner) &amp;lt; amount`).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Emits an {Encumber} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; encumberFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; taker&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Reduces amount of tokens encumbered from `owner` to caller by `amount`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Emits a {Release} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; release&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Convenience function for reading the unencumbered balance of an address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Trivially implemented as `balanceOf(owner) - encumberedBalanceOf(owner)`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; availableBalanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The specification was designed to complement and mirror the ERC-20 specification to ease adoption and understanding. The specification is intentionally minimally proscriptive of this joining, where the only true requirement is that an owner cannot transfer encumbered tokens. However, the example implementation includes some decisions about where to connect with ERC-20 functions worth noting. It was designed for minimal invasiveness of standard ERC-20 definitions.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The example has a dependency on &lt;code&gt;approve&lt;&#x2F;code&gt; to facilitate &lt;code&gt;encumberFrom&lt;&#x2F;code&gt;. This proposal allows for an implementer to define another mechanism, such as an &lt;code&gt;approveEncumber&lt;&#x2F;code&gt; which would mirror ERC-20 allowances, if desired.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;transferFrom(src, dst, amount)&lt;&#x2F;code&gt; is written to first reduce the &lt;code&gt;encumbrances(src, amount)&lt;&#x2F;code&gt;, and then subsequently spend from &lt;code&gt;allowance(src, msg.sender)&lt;&#x2F;code&gt;. Alternatively, &lt;code&gt;transferFrom&lt;&#x2F;code&gt; could be implemented to spend from allowance simultaneously to spending encumbrances. This would require &lt;code&gt;approve&lt;&#x2F;code&gt; to check that the approved balance does not decrease beneath the amount required by encumbered balances, and also make creating the approval a prerequisite to calling &lt;code&gt;encumber&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;It is possible to stretch the Encumber interface to cover ERC-721 tokens by using the &lt;code&gt;tokenId&lt;&#x2F;code&gt; in place of &lt;code&gt;amount&lt;&#x2F;code&gt; param since they are both &lt;code&gt;uint&lt;&#x2F;code&gt;. The interface opts for clarity with the most likely use case (ERC-20), even if it is compatible with other formats.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is backwards compatible with the existing &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; standard. Implementations must add the functionality to block transfer of tokens that are encumbered to another account.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;This can be implemented as an extension of any base &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; contract by modifying the transfer function to block the transfer of encumbered tokens and to release encumbrances when spent via transferFrom.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An erc-20 token that implements the encumber interface by blocking transfers.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC20&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;..&#x2F;lib&#x2F;openzeppelin-contracts&#x2F;contracts&#x2F;token&#x2F;ERC20&#x2F;ERC20.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; { &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC7246&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERC7246.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EncumberableERC20&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC20&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC7246&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Owner -&amp;gt; Taker -&amp;gt; Amount that can be taken&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; mapping&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; encumbrances&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The encumbered balance of the token owner. encumberedBalance must not exceed balanceOf for a user&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; this means rebasing tokens pose a risk of diminishing and violating this prototocol&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; encumberedBalanceOf&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; minter&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; symbol&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;name, symbol) &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        minter &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; minter&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;only minter&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;recipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; encumber&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; taker&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _encumber&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; taker&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; encumberFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; taker&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;allowance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;       _encumber&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; taker&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; release&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _release&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If bringing balance and encumbrances closer to equal, must check&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; availableBalanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; a&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;a&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; encumberedBalanceOf&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;a&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _encumber&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; taker&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;availableBalanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;insufficient balance&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        encumbrances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;taker&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        encumberedBalanceOf&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Encumber&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; taker&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _release&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; taker&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;encumbrances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;taker&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          amount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; encumbrances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;taker&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        encumbrances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;taker&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        encumberedBalanceOf&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Release&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; taker&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; dst&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; check but dont spend encumbrance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;availableBalanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;insufficient balance&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; dst&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; src&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; dst&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span&gt; encumberedToTaker &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; encumbrances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;src&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span&gt; exceedsEncumbrance &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; amount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; encumberedToTaker&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;exceedsEncumbrance&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            uint&lt;&#x2F;span&gt;&lt;span&gt; excessAmount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; amount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt; encumberedToTaker&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; check that enough unencumbered tokens exist to spend from allowance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;           require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;availableBalanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;src&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; excessAmount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;insufficient balance&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;           &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Exceeds Encumbrance , so spend all of it&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            _spendEncumbrance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;src&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; encumberedToTaker&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            _spendAllowance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;src&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; dst&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; excessAmount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            _spendEncumbrance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;src&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;src&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; dst&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _spendEncumbrance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; taker&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; currentEncumbrance &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; encumbrances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;taker&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;currentEncumbrance &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;insufficient encumbrance&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span&gt; newEncumbrance &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; currentEncumbrance &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        encumbrances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;taker&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; newEncumbrance&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        encumberedBalanceOf&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Release&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; taker&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Parties relying on &lt;code&gt;balanceOf&lt;&#x2F;code&gt; to determine the amount of tokens available for transfer should instead rely on &lt;code&gt;balanceOf(account) - encumberedBalance(account)&lt;&#x2F;code&gt;, or, if implemented, &lt;code&gt;availableBalanceOf(account)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The property that encumbered balances are always backed by a token balance can be accomplished in a straightforward manner by altering &lt;code&gt;transfer&lt;&#x2F;code&gt; and &lt;code&gt;transferFrom&lt;&#x2F;code&gt; to block . If there are other functions that can alter user balances, such as a rebasing token or an admin burn function, additional guards must be added by the implementer to likewise ensure those functions prevent reducing &lt;code&gt;balanceOf(account)&lt;&#x2F;code&gt; below &lt;code&gt;encumberedBalanceOf(account)&lt;&#x2F;code&gt; for any given account.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Identity-aggregated NFT</title>
        <published>2023-06-25T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Chloe Gu</name><email>chloe@carv.io</email>
	</author>
	
	<author>
		<name>Navid X.</name><uri>https://github.com/xuxinlai2002</uri>
	</author>
	
	<author>
		<name>Victor Yu</name><email>victor@carv.io</email>
	</author>
	
	<author>
		<name>Archer H.</name>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7231/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc7231-identity-aggregated-nft/15062" />
        

        <id>https://wg-eips.ritovision.com/7231/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7231"
            label="ERC-7231" />
        

        
        

        
        <summary type="html">The aggregation of web2 &amp; web3 identities to NFTs, authorized by individuals, gives attributes of ownerships, relationships, experiences.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7231/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard extends &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; by binding individuals&#x27; Web2 and Web3 identities to non-fungible tokens (NFTs) and soulbound tokens (SBTs). By binding multiple identities, aggregated and composible identity infomation can be verified, resulting in more beneficial onchain scenarios for individuals, such as self-authentication, social overlapping, commercial value generation from user targetting, etc. By adding a custom schema in the metadata, and updating and verifying the schema hash in the contract, the binding of NFT and identity information is completed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;One of the most interesting aspects of Web3 is the ability to bring an individual&#x27;s own identity to different applications. Even more powerful is the fact that individuals truly own their accounts without relying on centralized gatekeepers, disclosing to different apps components necessary for authentication and approved by individuals.
Exisiting solutions such as ENS, although open, decentralized, and more convenient for Ethereum-based applications, suffer from a lack of data standardization and authentication of identity due to inherent anominity. Other solutions such as SBTs rely on centralized attestors, can not prevent data tampering, and do not inscribe data into the ledger itself in a privacy enabling way.&lt;br &#x2F;&gt;
The proposed pushes the boundaries of solving identity problems with Identity Aggregated NFT, i.e., the individual-authenticated aggregation of web2 and web3 identities to NFTs (SBTs included).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY” and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;every-compliant-contract-must-implement-the-interface&quot;&gt;Every compliant contract must implement the Interface&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.15&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7231&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; emit the use binding information&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; nft id &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; identitiesRoot&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; new identity root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SetIdentitiesRoot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; identitiesRoot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; set the user ID binding information of NFT with identitiesRoot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; nft id &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; identitiesRoot&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; multi UserID Root data hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST allow external calls&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setIdentitiesRoot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; identitiesRoot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; get the multi-userID root by  NFTID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; nft id &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST return the bytes32 multiUserIDsRoot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST NOT modify the state&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST allow external calls&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getIdentitiesRoot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; verify the userIDs binding &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; nft id &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; userIDs&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; userIDs for check&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; identitiesRoot&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; msg hash to verify&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ECDSA signature &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST If the verification is passed, return true, otherwise return false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST NOT modify the state&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST allow external calls&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verifyIdentitiesBinding&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nftOwnerAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; userIDs&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; identitiesRoot&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This is the “Metadata JSON Schema” referenced above.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Asset Metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Identifies the asset to which this NFT represents&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Describes the asset to which this NFT represents&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;image&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A URI pointing to a resource with mime type image&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;MultiIdentities&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;userID&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;User ID of Web2 and web3(DID)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;verifierUri&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Verifier Uri of the userID&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;memo&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Memo of the userID&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;properties of the user ID information&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Designing the proposal, we considered the following problems that are solved by this standard:
&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7231&#x2F;.&#x2F;assets&#x2F;img&#x2F;Identity-aggregated-NFT-flow.png&quot; alt=&quot;EIP Flow Diagram&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Resolve the issue of multiple ID bindings for web2 and web3.
By incorporating the MultiIdentities schema into the metadata file, an authorized bond is established between user identity information and NFTs. This schema encompasses a userID field that can be sourced from a variety of web2 platforms or a decentralized identity (DID) created on blockchain. By binding the NFT ID with the UserIDInfo array, it becomes possible to aggregate multiple identities seamlessly.&lt;&#x2F;li&gt;
&lt;li&gt;Users have full ownership and control of their data
Once the user has set the metadata, they can utilize the setIdentitiesRoot function to establish a secure binding between hashed userIDs objects and NFT ID. As only the user holds the authority to carry out this binding, it can be assured that the data belongs solely to the user.&lt;&#x2F;li&gt;
&lt;li&gt;Verify the binding relationship between data on-chain and off-chain data through signature based on &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;ERC-1271&lt;&#x2F;a&gt;
Through the signature method based on the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;ERC-1271&lt;&#x2F;a&gt; protocol, the verifyIdentiesBinding function of this EIP realizes the binding of the userID and NFT owner address between on-chain and off-chain.
&lt;ol&gt;
&lt;li&gt;NFT ownership validation&lt;&#x2F;li&gt;
&lt;li&gt;UserID format validation&lt;&#x2F;li&gt;
&lt;li&gt;IdentitiesRoot Consistency verification&lt;&#x2F;li&gt;
&lt;li&gt;Signature validation from nft owner&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;As for how to verify the authenticity of the individuals&#x27; identities, wallets, accounts, there are various methods, such as zk-based DID authentication onchain, and offchain authentication algorithms, such as auth2, openID2, etc.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;As mentioned in the specifications section, this standard can be fully &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; compatible by adding an extension function set.
In addition, new functions introduced in this standard have many similarities with the existing functions in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;. This allows developers to easily adopt the standard quickly.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Tests are included in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7231&#x2F;.&#x2F;assets&#x2F;test&#x2F;erc7231.ts&quot;&gt;&lt;code&gt;erc7231.ts&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;To run them in terminal, you can use the following commands:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cd ..&#x2F;assets&#x2F;eip-7231&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;npm install&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;npx hardhat test&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;ERC7231.sol&lt;&#x2F;code&gt; Implementation: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7231&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;ERC7231.sol&quot;&gt;&lt;code&gt;ERC7231.sol&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP standard can comprehensively empower individuals to have ownership and control of their identities, wallets, and relevant data by themselves adding or removing the NFTs and identity bound information.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Purpose bound money</title>
        <published>2023-06-24T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Orchid-Dev</name><uri>https://github.com/proj-orchid-straitsx</uri>
	</author>
	
	<author>
		<name>Victor Liew</name><uri>https://github.com/alcedo</uri>
	</author>
	
	<author>
		<name>Wong Tse Jian</name><uri>https://github.com/wongtsejian</uri>
	</author>
	
	<author>
		<name>Jacob Shan</name><uri>https://github.com/Jacobshan429</uri>
	</author>
	
	<author>
		<name>Chin Sin Ong</name><uri>https://github.com/chinsinong</uri>
	</author>
	
	<author>
		<name>Praveen Kumar</name><uri>https://github.com/veenkumarr</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7291/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7291-purpose-bound-money/14973" />
        

        <id>https://wg-eips.ritovision.com/7291/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7291"
            label="ERC-7291" />
        

        
        

        
        <summary type="html">An extension to ERC-1155 implementing a hybrid form of programmable payment and money.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7291/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;A Purpose Bound Money (PBM) token is a wrapper around an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; token that can be used for a limited activity. This proposal outlines a smart contract interface that builds upon the ERC-1155 standard to implement the purpose bound money (PBM) concept:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A PBM consists of a PBM wrapper and the digital money token it wraps. A digital money token (e.g., stablecoins, central bank digital currencies, tokenized bank deposits, and similar instruments) serves as a store of value (abbreviated as &quot;sov&quot;). Thus, a digital money token (also referred to as &quot;sovToken&quot;) &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; be:
&lt;ul&gt;
&lt;li&gt;a good store of value;&lt;&#x2F;li&gt;
&lt;li&gt;a suitable unit of account; and&lt;&#x2F;li&gt;
&lt;li&gt;a medium of exchange.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;PBMs are bearer instruments, with self-contained programming logic, and can be transferred between two parties without involving intermediaries. It combines the concept of:
&lt;ul&gt;
&lt;li&gt;programmable payment - automatic execution of payments once a pre-defined set of conditions are met; and&lt;&#x2F;li&gt;
&lt;li&gt;programmable money - the possibility of embedding rules within the medium of exchange itself that define or constrain its usage.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Once the conditions are met, sovToken is released, and it becomes unbounded once again. A PBM can be thought of as a digital cash voucher, because it places constraints on how a payer can use the PBM but does not impose any constraints on the merchant&#x2F;redeemer because the PBM unwraps and releases the underlying digital money upon payment to the merchant&#x2F;redeemer. This is akin to a physical cash voucher: the payer is restricted to purchases from the merchants specified by the issuer but the merchants accepting the vouchers can exchange the physical vouchers with the issuer for fiat money.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In this EIP, we propose a modular structure consisting of a sovToken compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; as the digital money, an ERC-1155 compatible smart contract as the PBM wrapper, a compliance guard smart contract as a component of the PBM Wrapper logic, and a PBM token manager smart contract to manage token registration and retrieval.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Purpose Bound Money (PBM) enables digital currencies to carry conditions on how they can be spent, making them especially useful in real-world scenarios such as:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Government vouchers&lt;&#x2F;strong&gt; (e.g. CDC vouchers in Singapore), where funds should only be redeemable at approved heartland merchants;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Conditional disbursements&lt;&#x2F;strong&gt;, such as SkillsFuture learning accounts, where funds are released only after course participation is verified;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Escrow-style payments&lt;&#x2F;strong&gt;, like homebuyer milestones, where payouts to developers are tied to the completion of specific construction stages;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This proposal intends to forestall technology fragmentation and consequently a lack of interoperability. By making the PBM specification open, it gives new participants easy and free access to the pre-existing market standards, enabling interoperability across different platforms, wallets, payment systems and rails. This would lower cost of entry for new participants, foster a vibrant payment landscape and prevent the development of walled gardens and monopolies, ultimately leading to more efficient, affordable services and better user experiences.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;sovToken&lt;&#x2F;strong&gt; - an ERC-20 or ERC-20 compatible digital currency (e.g. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;777&#x2F;&quot;&gt;ERC-777&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1363&#x2F;&quot;&gt;ERC-1363&lt;&#x2F;a&gt;) serving as the store of value token (i.e. collateral backing the PBM Token).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;PBM Wrapper&lt;&#x2F;strong&gt; - an ERC-1155 compliant smart contract, which wraps the sovToken by specifying one or more conditions that have to be met (referred to as PBM business logic in subsequent section of this proposal). The PBM wrapper can be designed to be modular in nature, with core, plug-ins and hooks components (see section on PBM Architecture for elaboration). The PBM wrapper smart contract, together with adopted hooks smart contracts verifies that condition(s) has&#x2F;have been met before unwrapping the underlying sovToken.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;PBM Token&lt;&#x2F;strong&gt; - the sovToken and its PBM wrapper are collectively referred to as a PBM Token. PBM Tokens are represented as ERC-1155 tokens.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;PBM Creator&lt;&#x2F;strong&gt; defines the conditions of the PBM Wrapper to create PBM Tokens.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Merchant &#x2F; Redeemer&lt;&#x2F;strong&gt; - In the context of this proposal, a Merchant or a Redeemer is broadly defined as the ultimate recipient, or endpoint, for PBM tokens, to which these tokens are intrinsically directed or purpose-bound to. The identity of merchant&#x2F;redeemer will be one of the validations performed by the compliance guard, which may be implemented as part of the PBM Wrapper smart contract or as a standalone compliance guard contract registered as a PBM hook.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;overview&quot;&gt;Overview&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;PBM &lt;strong&gt;SHALL&lt;&#x2F;strong&gt; adhere to the definition of &quot;wrap&quot; or &quot;wrapping&quot; to mean binding a token in accordance with PBM business logic throughout its lifecycle.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;PBM &lt;strong&gt;SHALL&lt;&#x2F;strong&gt; adhere to the definition of &quot;unwrap&quot; or &quot;unwrapping&quot; to mean the release of a token in accordance with the PBM business logic during its lifecycle stage.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;A valid PBM Token &lt;strong&gt;MUST&lt;&#x2F;strong&gt; consist of an underlying sovToken and a PBM Wrapper.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The sovToken can be wrapped either upon the creation of the PBM Token or at a later date.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;A sovToken can be implemented as any widely accepted ERC-20 compatible token, such as ERC-20, ERC-777, or ERC-1363.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;PBM Wrapper &lt;strong&gt;MUST&lt;&#x2F;strong&gt; provide a mechanism for all transacting parties to verify that all necessary condition(s) have been met before allowing the PBM Token to be unwrapped. Refer to Auditability section for elaborations. The necessary conditions can be implemented within the PBM wrapper, or in a separate PBM hook(s) smart contract(s).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;PBM Wrapper &lt;strong&gt;MUST&lt;&#x2F;strong&gt; ensure the destination address for unwrapped sovToken is in a whitelist of Merchant&#x2F;Redeemer addresses and not in a blacklist of banned addresses prior to unwrapping the underlying sovToken.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The PBM Token &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be burnt upon being fully unwrapped and used.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;A PBM Token &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; have an expiry time that is decided by the PBM Creator.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;For cases where an expiry time is not needed, the expiry time &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; be set to infinity (typically represented as the maximum value of uint256 or type(uint256).max).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;This proposal defines a base specification of what a PBM should entail. Extensions to this base specification can be implemented as separate specifications.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;pbm-architecture&quot;&gt;PBM Architecture&lt;&#x2F;h3&gt;
&lt;p&gt;In this EIP, we propose a modular PBM architecture that has three distinct components (the core, the plugins and the hooks):&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;strong&gt;core components&lt;&#x2F;strong&gt; contains basic functionalities and validation checks that all PBMs should have. Core components includes sovToken and PBM wrapper containing the core logic (e.g. logic to whitelist the merchant&#x2F;redeemer address, logic to unwrap upon transfer to a whitelisted address, logic for minting and burning the PBM) and a token manager which allows for token registration, retrieval. In addition, the PBM wrapper &lt;strong&gt;MAY&lt;&#x2F;strong&gt; include logic to interface with plugins and hooks.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;strong&gt;plugin components&lt;&#x2F;strong&gt; implement additional functionality that only specific PBMs may require (e.g. logic to call external application programming interfaces to verify specific PBM condition was met, logic to track PBM usage patterns).&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;strong&gt;hook components&lt;&#x2F;strong&gt; implement additional validation checks that some PBMs may need (e.g. checks for expiration, daily spending limit, goods &amp;amp; services limit etc).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;For example, a PBM creator may want to ensure that only 50% of PBM Series A can be spent in supermarkets, while there are no restrictions on the proportion of PBM Series B that can be spent in supermarkets. The creator can implement a plugin smart contract to keep track of supermarket spending by PBM users and a hook to validate that less than 50% of the PBM Series A issued to a user is spent in a supermarket. This approach allows the same generic PBM wrapper and sovToken to be used for both PBM Series A and B. In addition, PBM Series A will register the plugin module and hook module for additional data tracking and validations.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;auditability&quot;&gt;Auditability&lt;&#x2F;h3&gt;
&lt;p&gt;PBM Wrapper &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; provide the public easily accessible mechanism(s) to verify the smart contract logic for unwrapping a PBM. Such mechanisms could be leveraged by automated validation or asynchronous user verifications from transacting parties and&#x2F;or whitelisted third parties attestations.&lt;&#x2F;p&gt;
&lt;p&gt;As the fulfilment of PBM conditions is likely to be subjected to audits to ensure trust amongst all transacting parties, the following evidence shall be documented to support audits:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The interface&#x2F;events emitted &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; allow a fine-grained recreation of the transaction history, token types and token balances&lt;&#x2F;li&gt;
&lt;li&gt;The source code &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; be verified and formally published on a blockchain explorer.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;fungibility&quot;&gt;Fungibility&lt;&#x2F;h3&gt;
&lt;p&gt;A PBM Wrapper &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; be able to wrap multiple types of compatible sovTokens (e.g. the same PBM Wrapper should be able to wrap USDC and XSGD). sovTokens wrapped by the same PBM wrapper may or may not be fungible to one another. The standard does NOT mandate how an implementation must do this.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;pbm-token-details&quot;&gt;PBM token details&lt;&#x2F;h3&gt;
&lt;p&gt;The ERC-1155 Multi Token Standard enables each token ID to correspond to a unique, configurable token type. All essential details facilitating the business or display logic for a PBM &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be defined for each token type. The mandatory fields for this purpose are outlined in the &lt;code&gt;struct PBMToken&lt;&#x2F;code&gt; (below). Future proposals may define additional, optional state variables as needed. Once a token detail has been defined, it &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be immutable.&lt;&#x2F;p&gt;
&lt;p&gt;Example of token details:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IPBMRC1_TokenManager&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A PBM token MUST include compulsory state variables (name, faceValue, expiry, and uri) to adhere to this standard.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Represents all the details corresponding to a PBM tokenId.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PBMToken&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Name of the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Value of the underlying wrapped ERC20-compatible sovToken. Additional information on the `faceValue` can be specified by&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; adding the optional variables: `currencySymbol` or `tokenSymbol` as indicated below&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; faceValue&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Time after which the token will be rendered useless (expressed in Unix Epoch time).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; expiry&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Metadata URI for ERC-1155 display purposes.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt; uri&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;An implementer of the standard can enhance their PBM tokens with additional functionality by implementing the &lt;code&gt;IPBMRC1_TokenManagerExt&lt;&#x2F;code&gt; interface. This extension provides optional properties that can be used to support a variety of use cases beyond the core requirements.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IPBMRC1_TokenManagerExt&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Optional properties that a PBM token MAY include for extended functionality.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Represents additional optional fields that can be implemented for a PBM tokenId.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PBMTokenExt&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Indicates if the PBM token can be transferred to a non merchant&#x2F;redeemer wallet.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span&gt; isTransferable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Determines whether the PBM will be burned or revoked upon expiry, under certain predefined conditions, or at the owner&amp;#39;s discretion.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span&gt; burnable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Number of decimal places for the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint8&lt;&#x2F;span&gt;&lt;span&gt; decimals&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the creator of this PBM type on this smart contract. This field is optional because the creator is msg.sender by default.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; creator&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The smart contract address of the sovToken.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The running balance of the PBM Token type that has been minted.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; totalSupply&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An ISO4217 three-character alphabetic code may be needed for the faceValue in multicurrency PBM use cases.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt; currencySymbol&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An abbreviation for the PBM token name may be assigned.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt; tokenSymbol&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Add other optional state variables below...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;An implementer has the option to define all token types upon PBM contract deployment. If needed, they can also expose an external function to create new PBM tokens at a later time.
All token types created &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; emit a &lt;code&gt;NewPBMTypeCreated&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Creates a new PBM Token type with the provided data.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The caller of createPBMTokenType shall be responsible for setting the creator address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Example of uri can be found in [`sample-uri`](.&#x2F;assets&#x2F;sample-uri&#x2F;stx-10-static)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST Emit the {NewPBMTypeCreated} event&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _name&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Name of the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _faceValue&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Value of the underlying wrapped ERC20-compatible sovToken.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenExpiry&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Time after which the token will be rendered useless (expressed in Unix Epoch time).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenURI&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Metadata URI for ERC-1155 display purposes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; createPBMTokenType&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _faceValue&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenExpiry&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenURI&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a new Purpose-Bound Token (PBM) type is created within the contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The unique identifier for the newly created PBM token type.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenName&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A human-readable string representing the name of the newly created PBM token type.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The initial supply of the newly created PBM token type.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; expiry&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The timestamp at which the newly created PBM token type will expire.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; creator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the account that created the new PBM token type.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NewPBMTypeCreated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenName&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expiry&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; creator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Implementors of the standard &lt;strong&gt;MUST&lt;&#x2F;strong&gt; define a method to retrieve a PBM token detail&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieves the details of a PBM Token type given its tokenId.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function fetches the PBMToken struct associated with the tokenId and returns it.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier of the PBM token type.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; pbmToken_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A PBMToken struct containing all the details of the specified PBM token type.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getTokenDetails&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;PBMToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; pbmToken_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;compliance-guard&quot;&gt;Compliance Guard&lt;&#x2F;h3&gt;
&lt;p&gt;A compliance guard should have logic to store and retrieve whitelisted merchants&#x2F;redeemers and blacklisted addresses to fulfill the basic premise of a PBM. Additional logic can be added to fulfill other compliance goals.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Compliance Guard Interface.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The compliance guard stores and manages whitelisted merchants&#x2F;redeemers and blacklisted addresses for the PBMs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IComplianceGuard&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Checks if the address is one of the blacklisted addresses&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to query&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bool_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; True if address is blacklisted, else false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isBlacklisted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bool_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; ;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Checks if the address is one of the whitelisted merchant&#x2F;redeemer addresses&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to query&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bool_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; True if the address is in merchant&#x2F;redeemer whitelist and is NOT a blacklisted address, otherwise false.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isMerchant&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bool_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; ;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Event emitted when the Merchant&#x2F;Redeemer List is edited&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; action&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Tags &amp;quot;add&amp;quot; or &amp;quot;remove&amp;quot; for action type&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; addresses&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of merchant wallet addresses that was just added or removed from Merchant&#x2F;Redeemer whitelist&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Optional comments or notes about the added or removed addresses.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MerchantList&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; action&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; addresses&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; metadata&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Event emitted when the Blacklist is edited&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; action&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Tags &amp;quot;add&amp;quot; or &amp;quot;remove&amp;quot; for action type&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; addresses&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of wallet addresses that was just added or removed from address blacklist&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Optional comments or notes about the added or removed addresses.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Blacklist&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; action&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; addresses&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; metadata&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;pbmrc1-base-interface&quot;&gt;PBMRC1 - Base Interface&lt;&#x2F;h3&gt;
&lt;p&gt;This interface contains the essential functions required to implement a pre-loaded PBM.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; LIST OF EVENTS TO BE EMITTED&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A database or explorer may listen to events and be able to provide indexed and categorized searches&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; PBM Specification interface&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The PBM (purpose bound money) allows us to add logical requirements on the use of sovTokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The PBM acts as wrapper around the sovTokens and implements the necessary business logic.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; PBM deployer must assign an overall owner to the smart contract. If fine grain access controls are required, EIP-5982 can be used on top of ERC173&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IPBMRC1&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC173&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC5679Ext1155&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Initialise the contract by specifying an underlying ERC20-compatible token address,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; contract expiry and PBM Wrapper Logic smart contract&amp;#39;s address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _sovToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the underlying sovToken.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _expiry&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The contract-wide expiry timestamp (in Unix epoch time).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _pbmWrapperLogic&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This address should point to a smart contract that contains conditions governing a PBM;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; such as purpose-bound conditions (e.g., a compliance guard determining whether a PBM is permitted to be transferred or to be unwrapped)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; and other relevant business logic, effectively implementing an inversion of control.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; initialise&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _sovToken&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _expiry&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _pbmWrapperLogic&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the Uniform Resource Identifier (URI) metadata information for the PBM with the corresponding tokenId.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; URIs are defined in RFC 3986.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The URI MUST point to a JSON file that conforms to the &amp;quot;ERC-1155 Metadata URI JSON Schema&amp;quot;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Developers may choose to adhere to the ERC1155Metadata_URI extension interface if necessary.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The URI is not expected to be immutable.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The id for the PBM in query&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Returns&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the metadata URI string for the PBM&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; uri&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Creates a PBM copy ( ERC1155 NFT ) of an existing PBM token type.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See {IERC5679Ext1155} for further implementation notes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; receiver&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The wallet address to which the created PBMs need to be transferred to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier of the PBM token type to be copied.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The number of the PBMs that are to be created&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Additional data with no specified format, based on EIP-5750&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        This function transfers the underlying token from the caller into the PBM smart contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        IMPT: Before minting, the caller should approve the contract address to spend sovTokens on behalf of the caller.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            This can be done by calling the `approve` or `increaseMinterAllowance` functions of the ERC-20 contract and specifying `_spender` to be the PBM contract address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            Ref : https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        WARNING: Any contracts that externally call these safeMint() and safeMintBatch() functions should implement some sort of reentrancy guard procedure&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        (such as OpenZeppelin&amp;#39;s ReentrancyGuard) or a Checks-effects-interactions pattern.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        As per ERC-5679 standard: When the token is being minted, the transfer events MUST be emitted as if the token in the `amount` for EIP-1155&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        and `tokenId` being _id for EIP-1155 were transferred from address 0x0 to the recipient address identified by receiver.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        The total supply MUST increase accordingly.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        MUST Emit the {TokenWrap} event as the underlying sovToken is wrapped by the PBM wrapper smart contract during minting.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        - contract must not be paused&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        - tokens must not be expired&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        - `tokenId` should be a valid id that has already been created&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        - caller should have the necessary amount of the sovTokens required to mint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        - caller should have approved the PBM contract to spend the sovTokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        - receiver should not be blacklisted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeMint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; receiver&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Creates multiple PBM copies (ERC1155 NFT) of an existing PBM token type.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See {IERC5679Ext1155}.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; receiver&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The wallet address to which the created PBMs need to be transferred to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier of the PBM token type&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amounts&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The number of the PBMs that are to be created&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Additional data with no specified format, based on eip-5750&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        This function will transfer the underlying token from the caller into the PBM smart contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        IMPT: Before minting, the caller should approve the contract address to spend sovTokens on behalf of the caller.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            This can be done by calling the `approve` or `increaseMinterAllowance` functions of the ERC-20 contract and specifying `_spender` to be the PBM contract address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            Ref : https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        WARNING: Any contracts that externally call these safeMint() and safeMintBatch() functions should implement some sort of reentrancy guard procedure&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        (such as OpenZeppelin&amp;#39;s ReentrancyGuard) or a Checks-effects-interactions pattern.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        As per ERC-5679 standard: When the token is being minted, the transfer events MUST be emitted as if the token in the `amount` for EIP-1155&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        and `tokenId` being _id for EIP-1155 were transferred from address 0x0 to the recipient address identified by receiver.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        The total supply MUST increase accordingly.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        MUST Emit the {TokenWrap} event as the underlying sovToken is wrapped by PBM wrapper smart contract during minting.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        - contract must not be paused&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        - tokens must not be expired&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        - `tokenIds` should all be valid ids that have already been created&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        - `tokenIds` and `amounts` list need to have the same number of values&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        - caller should have the necessary amount of the sovTokens required to mint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        - caller should have approved the PBM contract to spend the sovTokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        - receiver should not be blacklisted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeMintBatch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; receiver&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amounts&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Burns a PBM token. Upon burning of the tokens, the underlying wrapped token (if any) should be handled.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Destroys `amount` tokens of token type `tokenId` from `from`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See {IERC5679Ext1155}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The originating wallet address of the PBMs to be burned&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier of the PBM token type&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of the PBMs that are to be burned&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Additional data with no specified format, based on EIP-5750&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        MUST Emit the {TransferSingle} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        MUST Emit the {TokenUnwrapForPBMBurn} event if the underlying wrapped token is moved out of the PBM smart contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        - `from` cannot be the zero address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        - `from` must have at least `amount` tokens of token type `tokenId`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; burn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Burns multiple PBM token. Upon burning of the tokens, the underlying wrapped token (if any) should be handled.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Destroys `amount` tokens of token type `tokenId` from `from`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See {IERC5679Ext1155}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The originating wallet address of the PBMs to be burned&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier of the PBM token types&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amounts&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of the PBMs that are to be burned for each tokenId in _tokenIds&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Additional data with no specified format, based on eip-5750&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        MUST Emit the {TransferSingle} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        MUST Emit the {TokenUnwrapForPBMBurn} event if the underlying wrapped token is moved out of the PBM smart contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        - `from` cannot be the zero address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        - `from` must have at least amount specified in `_amounts` of the corresponding token type tokenId in `_tokenIds` array.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; burnBatch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amounts&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfers the PBM(NFT) from one wallet to another.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function extends the ERC-1155 standard in order to allow the PBM token to be freely transferred between wallet addresses due to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; widespread support across wallet providers. Specific conditions and restrictions on whether a pbm can be moved across addresses can be incorporated in this function.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Unwrap logic MAY also be placed within this function to be called.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The account from which the PBM (NFT) is moving from&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The account which is receiving the PBM (NFT)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier of the PBM token type&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The number of (quantity) the PBM type that are to be transferred of the PBM type&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; To record any data associated with the transaction, can be left blank if none&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfers the PBM(NFT)(s) from one wallet to another.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function extends the ERC-1155 standard in order to allow the PBM token to be freely transferred between wallet addresses due to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; widespread support across wallet providers.  Specific conditions and restrictions on whether a pbm can be moved across addresses can be incorporated in this function.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Unwrap logic MAY also be placed within this function to be called.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If the receiving wallet is a whitelisted &#x2F;redeemer wallet address, the PBM(NFT)(s) will be burnt and the underlying sovTokens will be transferred to the merchant&#x2F;redeemer wallet instead.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The account from which the PBM (NFT)(s) is moving from&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The account which is receiving the PBM (NFT)(s)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ids&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifiers of the different PBM token type&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amounts&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The number of (quantity) the different PBM types that are to be created&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; To record any data associated with the transaction, can be left blank if none.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeBatchTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ids&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amounts&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Unwraps the underlying ERC-20 compatible tokens to an intended end point (ie: merchant&#x2F;redeemer) upon fulfilling the required PBM conditions.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Add implementation specific logic for the conditions under which a PBM processes and transfers the underlying tokens here.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; e.g. If the receiving wallet is a whitelisted merchant&#x2F;redeemer wallet address, the PBM (NFT) MUST be burnt and the underlying sovTokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; will unwrapped to be transferred to the merchant&#x2F;redeemer wallet.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST Emit the {TokenUnwrapForTarget} event on success&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The account currently holding the PBM&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The account receiving the PBM (NFT)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier of the PBM token type&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The quantity of the PBM type involved in this transaction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Additional data without a specified format, based on EIP-5750&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; unwrap&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Allows the creator of a PBM token type to retrieve all locked-up underlying sovTokens within that PBM.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Ensure that only the creator of the PBM token type or the contract owner can call this function.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Validate the token state and existence, handle PBM token burning if necessary, safely transfer the remaining sovTokens to the originator,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST Emit the {PBMrevokeWithdraw} event upon a successful revoke.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier of the PBM token type&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - `tokenId` should be a valid identifier for an existing PBM token type.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - The caller must be either the creator of the token type or the smart contract owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revokePBM&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a PBM type creator withdraws the underlying sovTokens from all the remaining expired PBMs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; beneficiary&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the address ( PBM type creator ) which receives the sovToken&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; PBMTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifiers of the different PBM token type&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sovToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the underlying sovToken&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sovTokenValue&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The number of underlying sovTokens transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PBMrevokeWithdraw&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; beneficiary&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; PBMTokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sovToken&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sovTokenValue&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when the underlying tokens are unwrapped and transferred to a specific purpose-bound address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This event signifies the end of the PBM lifecycle, as all necessary conditions have been met to release the underlying tokens to the recipient (whitelisted merchant&#x2F;redeemer with non-blacklisted wallet address).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If there are multiple different underlying tokens involved in a single unwrap operation, this event should be emitted for each underlying token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address from which the PBM tokens are being unwrapped.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The purpose-bound address receiving the unwrapped underlying tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array containing the identifiers of the unwrapped PBM token types.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amounts&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array containing the quantities of the corresponding unwrapped PBM tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sovToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the underlying sovToken.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sovTokenValue&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of unwrapped underlying sovTokens transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TokenUnwrapForTarget&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amounts&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sovToken&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sovTokenValue&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when PBM tokens are burned, resulting in the unwrapping of the underlying tokens for the designated recipient.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This event is required if there is an unwrapping of the underlying tokens during the PBM (NFT) burning process.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If there are multiple different underlying tokens involved in a single unwrap operation, this event should be emitted for each underlying token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address from which the PBM tokens are being burned.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address receiving the unwrapped underlying tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array containing the identifiers of the burned PBM token types.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amounts&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array containing the quantities of the corresponding burned PBM tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sovToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the underlying sovToken.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sovTokenValue&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of unwrapped underlying sovTokens transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TokenUnwrapForPBMBurn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amounts&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sovToken&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sovTokenValue&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Indicates the wrapping of a token into the PBM smart contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when underlying tokens are wrapped within the PBM smart contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If there are multiple different underlying tokens involved in a single wrap operation, this event should be emitted for each underlying token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This event signifies the beginning of the PBM lifecycle, as tokens are now managed by the conditions within the PBM contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address initiating the token wrapping process, and&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array containing the identifiers of the token types being wrapped.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amounts&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array containing the quantities of the corresponding wrapped tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sovToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the underlying sovToken.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sovTokenValue&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of wrapped underlying sovTokens transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TokenWrap&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amounts&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sovToken&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sovTokenValue&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;extensions&quot;&gt;Extensions&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;pbmrc1-token-receiver&quot;&gt;PBMRC1 - Token Receiver&lt;&#x2F;h4&gt;
&lt;p&gt;Smart contracts MUST implement all of the functions in the PBMRC1_TokenReceiver interface to subscribe to PBM unwrap callbacks.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Smart contracts MUST implement the ERC-165 `supportsInterface` function and signify support for the `PBMRC1_TokenReceiver` interface to accept callbacks.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; It is optional for a receiving smart contract to implement the `PBMRC1_TokenReceiver` interface&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; WARNING: Reentrancy guard procedure, Non delegate call, or the check-effects-interaction pattern must be adhere to when calling an external smart contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The interface functions MUST only be called at the end of the `unwrap` function.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PBMRC1_TokenReceiver&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Handles the callback from a PBM smart contract upon unwrapping&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An PBM smart contract MUST call this function on the token recipient contract, at the end of a `unwrap` if the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        receiver smart contract supports type(PBMRC1_TokenReceiver).interfaceId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  The address which initiated the transfer (either the address which previously owned the token or the address authorised to make transfers on the owner&amp;#39;s behalf) (i.e. msg.sender)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      The address which previously owned the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;        The ID of the token being unwrapped&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     The amount of tokens being transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      Additional data with no specified format&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;           `bytes4(keccak256(&amp;quot;onPBMRC1Unwrap(address,address,uint256,uint256,bytes)&amp;quot;))`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onPBMRC1Unwrap&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Handles the callback from a PBM smart contract upon unwrapping a batch of tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A PBM smart contract MUST call this function on the token recipient contract at the end of an `unwrap` if the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        receiver smart contract supports type(PBMRC1_TokenReceiver).interfaceId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  The address which initiated the transfer (either the address which previously owned the token or the address authorised to make transfers on the owner&amp;#39;s behalf) (i.e. msg.sender)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      The address which previously owned the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;        The ID of the token being unwrapped&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     The amount of tokens being transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      Additional data with no specified format&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;           `bytes4(keccak256(&amp;quot;onPBMRC1BatchUnwrap(address,address,uint256,uint256,bytes)&amp;quot;))`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onPBMRC1BatchUnwrap&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _ids&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _values&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;pbmrc2-non-preloaded-pbm-interface&quot;&gt;PBMRC2 - Non preloaded PBM Interface&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;strong&gt;Non Preloaded&lt;&#x2F;strong&gt; PBM extension is OPTIONAL for compliant smart contracts. This allows contracts to bind an underlying sovToken to the PBM at a later date instead of during a minting process.&lt;&#x2F;p&gt;
&lt;p&gt;Compliant contract &lt;strong&gt;MUST&lt;&#x2F;strong&gt; implement the following interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *  &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This interface extends IPBMRC1, adding functions for working with non-preloaded PBMs.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *  Non-preloaded PBMs are minted as empty containers without any underlying tokens of value,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *  allowing the loading of the underlying token to happen at a later stage.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PBMRC2_NonPreloadedPBM&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IPBMRC1&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function extends IPBMRC1 to mint PBM tokens as empty containers without underlying tokens of value.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The loading of the underlying token of value can be done by calling the `load` function. The function parameters should be identical to IPBMRC1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeMint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; receiver&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function extends IPBMRC1 to mint PBM tokens as empty containers without underlying tokens of value.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The loading of the underlying token of value can be done by calling the `load` function. The function parameters should be identical to IPBMRC1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeMintBatch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ids&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amounts&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Wrap an amount of sovTokens into the PBM&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; function will pull sovTokens from msg.sender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Approval must be given to the PBM smart contract in order to for the pbm to pull money from msg.sender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; underlying data structure must record how much the msg.sender has been loaded into the PBM.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emits {TokenLoad} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    The amount of sovTokens to be loaded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; load&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieves the balance of the underlying sovToken associated with a specific PBM token type and user address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function provides a way to check the amount of the underlying token that a user has loaded into a particular PBM token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; user&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the user whose underlying token balance is being queried.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; balance of the underlying sovToken associated with the specified PBM token type and user address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; underlyingBalanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Unloads all of the underlying token belonging to the caller from the PBM smart contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The underlying token that belongs to the caller (msg.sender) will be removed and transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; back to the caller.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emits {TokenUnload} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The quantity of the corresponding tokens to be unloaded.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Amount should not exceed the amount that the caller has originally loaded into the PBM smart contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; unload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when an underlying token is loaded into a PBM&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; caller&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address by which sovToken is taken from.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address by which the token is loaded and assigned to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The quantity of tokens to be loaded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sovToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the underlying sovToken.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sovTokenValue&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of underlying sovTokens loaded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TokenLoad&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; caller&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sovToken&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sovTokenValue&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when an underlying token is unloaded from a PBM.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This event indicates the process of releasing the underlying token from the PBM smart contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; caller&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address initiating the token unloading process.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address from which the token is being unloaded and removed from.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The quantity of the corresponding unloaded tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sovToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the underlying sovToken.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sovTokenValue&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of unloaded underlying sovTokens transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TokenUnload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; caller&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sovToken&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sovTokenValue&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-sovtoken-must-be-erc-20-compatible&quot;&gt;Why sovToken &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be ERC-20 compatible?&lt;&#x2F;h3&gt;
&lt;p&gt;As PBM is envisioned to have functionality of money, it has to be a fungible token with stable value. Currently, the major stablecoins in the market are mainly based on the ERC-20 interface. ERC-20 or ERC-20 compatible tokens are the most widely supported by existing wallets, defi apps, and used also by protocol design such as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt; and more importantly they are the de facto standard for fungible tokens.&lt;&#x2F;p&gt;
&lt;p&gt;With regards to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and ERC-1155 compatible tokens:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;ERC-721 is not suitable given that it is a standard for non-fungible tokens, which cannot fulfill the functions of money.&lt;&#x2F;li&gt;
&lt;li&gt;While ERC-1155 tokens could be used for fungible tokens, we decided not to include it because there is a lack of ERC-1155 stablecoins in the market. Requiring the PBM interface to support both ERC-20 compatible and ERC-1155 compatible sovToken would complicate PBM interface without adding much practical utility. Furthermore, the base ERC-1155 does not support decimals, but this is not a dealbreaker as there can be workarounds. However, should there be changes in the stablecoin market in future, a revision can be considered.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;why-pbm-wrapper-must-be-erc-1155-compatible&quot;&gt;Why PBM Wrapper &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be ERC-1155 compatible?&lt;&#x2F;h3&gt;
&lt;p&gt;This paper extends the ERC-1155 standards in order to enable easy adoption by existing wallet providers. Currently, most wallet providers are able to support and display ERC-20, ERC-1155 and ERC-721 standards. An implementation which doesn&#x27;t extend these standards will require the wallet provider to build a custom user interface and interfacing logic which increases the implementation cost and lengthen the time-to-market.&lt;&#x2F;p&gt;
&lt;p&gt;The core aim of our proposal is to standardize the implementation of PBM. Hence, we have surveyed existing interface standards and decided to build upon ERC-1155 standard for the PBM tokens for the following reasons:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;ERC-1155 allows a single contract to support multiple tokens. This is very useful for the PBM use cases as a single contract can support issuance of tokens with different denominations, expiry dates, business logics.&lt;&#x2F;li&gt;
&lt;li&gt;ERC-1155 also has batch transfer support, which is absent in ERC-20, which could lead to gas savings when tokens have to be airdropped to a large number of recipients.&lt;&#x2F;li&gt;
&lt;li&gt;ERC-1155 is able to support semi-fungible tokens which could be very useful for PBM use cases as a PBM can be converted into a collectible after its expiry.&lt;&#x2F;li&gt;
&lt;li&gt;ERC-1155 allows for a visualisation of a PBM token on the UI of a wallet issuer.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;why-pbm-must-ensure-the-destination-address-for-unwrapped-sovtoken-is-in-a-whitelist-of-merchant-redeemer-addresses-and-not-in-a-blacklist-of-banned-addresses-prior-to-unwrapping-the-underlying-sovtoken&quot;&gt;Why PBM &lt;strong&gt;MUST&lt;&#x2F;strong&gt; ensure the destination address for unwrapped sovToken is in a whitelist of Merchant&#x2F;Redeemer addresses and not in a blacklist of banned addresses prior to unwrapping the underlying sovToken?&lt;&#x2F;h3&gt;
&lt;p&gt;Why do we need a whitelist?&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The whitelist is a compulsory requirement because a PBM is purpose-bound, i.e., it should be unwrapped only if all conditions are fulfilled and it is transferred to someone in the predefined whitelist.&lt;&#x2F;li&gt;
&lt;li&gt;In some implementations, developers can define a whitelisted address dynamically at runtime, such as requiring the presence of an NFT in a wallet address or relying on an oracle, etc.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Why do we need a blacklist?&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The blacklist is a compulsory requirement to ensure that accounts which were banned for various reasons (e.g., address owner has re-registered a new account, address owner suspended, withdrawn, or expelled due to complaints or law enforcement reasons, etc.) are excluded.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Why we can&#x27;t have either a whitelist or a blacklist?&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;While the same effect can be obtained by only having a whitelist, repeatedly redeploying the whitelist to the blockchain to ban one person is not gas efficient.&lt;&#x2F;li&gt;
&lt;li&gt;Using only a blacklist to implement purpose-bound money is not practical as it would require maintaining a list of all addresses to be excluded and updating it whenever a new account is created.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Why is there a need for destination?&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;This forms the core of our proposal: a PBM can be unwrapped when only it is transferred to pre-approved destinations.&lt;&#x2F;li&gt;
&lt;li&gt;PBMs can be transferred freely, but only the target is allowed to unwrap the PBM and take delivery of the underlying sovToken must be limited to differentiate it from plain vanilla stablecoins that are wrapped by smart contracts.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;what-does-business-logic-encompass&quot;&gt;What does business logic encompass?&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;In general, business logic can be categorized into core, plugin, and hook logic:
&lt;ul&gt;
&lt;li&gt;Core logic contains essential functionalities and validation checks and should be included in the PBM Wrapper contract.&lt;&#x2F;li&gt;
&lt;li&gt;Plugin and hook logic can be implemented as standalone smart contract modules and are registered by the PBM Wrapper contract. Plugin logic extends the core logic by adding functionality, e.g., custom data collection, additional administrative functions, etc.&lt;&#x2F;li&gt;
&lt;li&gt;Hook logic implements additional validation checks which are only applicable for a subset of PBMs.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&quot;PBM business logic&quot; can contain access control logic, PBM unwrapping logic, API logic to integrate with non-blockchain IT systems.&lt;&#x2F;li&gt;
&lt;li&gt;As PBM can be used for a wide variety of use cases, ranging from government disbursement tokens, shopping vouchers, prepaid tokens, rewards points tokens, purpose-bound donation tokens, school allowance tokens, etc., with each use case having separate business logic, it was intentionally left undefined so that implementation authors can have maximum flexibility.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;why-was-a-push-transaction-model-chosen&quot;&gt;Why was a push transaction model chosen?&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;This standard sticks to the push transaction model where the transfer of PBM is initiated on the sender&#x27;s side. Modern wallets can support the required PBM logic by embedding the unwrapping logic within the ERC-1155 &lt;code&gt;safeTransfer&lt;&#x2F;code&gt; function.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;customisability&quot;&gt;Customisability&lt;&#x2F;h3&gt;
&lt;p&gt;Each ERC-1155 PBM Token would map to an underlying &lt;code&gt;PBMToken&lt;&#x2F;code&gt; data structure that implementers are free to customize in accordance to the business logic.&lt;&#x2F;p&gt;
&lt;p&gt;By mapping the underlying ERC-1155 token model with an additional data structure, implementers gain flexibility in the management of multiple token types within the same smart contract with multiple conditional unwrapping logic attached to each token type, reducing gas costs as there is no need to deploy multiple smart contracts for each token type.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;To keep it simple, this standard &lt;em&gt;intentionally&lt;&#x2F;em&gt; omits functions or events that doesn&#x27;t add to definition and concept of a PBM.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;This EIP makes no assumptions about access control or the conditions under which a function can be executed. It is the responsibility of the PBM creator to determine the various roles involved in each specific PBM business flow.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The proposed PBM Architecture &lt;em&gt;intentionally&lt;&#x2F;em&gt; modular to enable greater customisability and reusability of smart contracts.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Metadata associated to the PBM standard is not included the standard. If necessary, related metadata can be created with a separate metadata extension interface, e.g. &lt;code&gt;ERC721Metadata&lt;&#x2F;code&gt; from ERC-721. Refer to Opensea&#x27;s metadata-standards for an implementation example.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;To allow for future extensibility, it is &lt;strong&gt;RECOMMENDED&lt;&#x2F;strong&gt; that developers read and adopt the specifications for building general extensibility for method behaviours (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5750&#x2F;&quot;&gt;ERC-5750&lt;&#x2F;a&gt;).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This interface is designed to be compatible with ERC-1155.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Reference implementations can be found in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7291&#x2F;assets&#x2F;README&#x2F;&quot;&gt;&lt;code&gt;README.md&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Malicious users may attempt to:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Double spend through reentrancy.&lt;&#x2F;li&gt;
&lt;li&gt;clone existing PBM Tokens to perform double-spending;&lt;&#x2F;li&gt;
&lt;li&gt;create invalid PBM Token with no underlying sovToken; or&lt;&#x2F;li&gt;
&lt;li&gt;falsifying the face value of PBM token through wrapping of fraudulent&#x2F;invalid&#x2F;worthless sovTokens.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;For consistency, when the contract is suspended or a user&#x27;s token transfer is restricted due to suspected fraudulent activity or erroneous transfers, corresponding restrictions &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be applied to the user&#x27;s unwrap requests for the PBM Token.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Security audits and tests should be performed to verify that unwrap logic behaves as expected or if any complex business logic is being implemented that involves calling an external smart contract to prevent re-entrancy attacks and other forms of call chain attacks.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;This EIP relies on the secure and accurate bookkeeping behavior of the token implementation.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Contracts adhering to this standard should closely monitor balance changes for each user during token consumption or minting.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The PBM Wrapper must be meticulously designed to ensure effective control over the permission to mint new tokens. Failure to secure the minting permission can lead to fraudulent issuance and unauthorized inflation of the total token supply.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The mapping of each PBM Token to the corresponding amount of underlying sovToken held by the smart contract requires careful accounting and auditing.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The access control over permission to burn tokens should be carefully designed. Typically, only the following two roles are entitled to burn a token:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Role 1. Prior to a PBM&#x27;s expiry, only whitelisted merchants&#x2F;redeemers with non-blacklisted wallet addresses are allowed to unwrap and burn tokens that they hold.&lt;&#x2F;li&gt;
&lt;li&gt;Role 2. After a PBM has expired:
&lt;ul&gt;
&lt;li&gt;whitelisted merchants&#x2F;redeemers with non-blacklisted wallet addresses are allowed to unwrap and burn tokens that they hold; and&lt;&#x2F;li&gt;
&lt;li&gt;PBM owners are allowed to burn unused PBM Tokens remaining in the hands of non-whitelisted merchants&#x2F;redeemers to retrieve underlying sovTokens.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Nevertheless, we do recognize there are potentially other use cases where a third type of role may be entitled to burning. Implementors should be cautious when designing access control over burning of PBM Tokens.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;It is recommended to adopt a sovToken standard that is compatible with ERC-20. Examples of such compatible tokens include those implementing ERC-777 or ERC-1363. However, ERC-20 remains the most widely accepted due to its simplicity and there is a high degree of confidence in its security.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Token with Metadata</title>
        <published>2023-06-24T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>msfew</name><uri>https://github.com/fewwwww</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7729/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7729-token-with-metadata/20939" />
        

        <id>https://wg-eips.ritovision.com/7729/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7729"
            label="ERC-7729" />
        

        
        

        
        <summary type="html">An ERC-20 extension for tokens with metadata.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7729/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard extends the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; standard to include a &lt;code&gt;metadata&lt;&#x2F;code&gt; function interface and a JSON schema for metadata.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Memecoins have demonstrated the value of associating tokens with visual metadata. By standardizing a way to include metadata in ERC-20 tokens, developers can create more engaging and interactive tokens, fostering community engagement.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Every compliant contract must implement the &lt;code&gt;IERC7729&lt;&#x2F;code&gt;, and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;&lt;code&gt;ERC20&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; interfaces.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;This standard includes the following interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC20Metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC20&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the metadata URI associated with the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  The URI may point to a JSON file that conforms to the &amp;quot;ERCX Metadata JSON Schema&amp;quot;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; metadata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This is the &quot;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7729&#x2F;&quot;&gt;ERC-7729&lt;&#x2F;a&gt; Metadata JSON Schema&quot; referenced above.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Token Metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Identifies the asset to which this token represents&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Describes the asset to which this token represents&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;image&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A URI pointing to a resource with mime type image&#x2F;* representing the asset to which this token represents.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;metadata&lt;&#x2F;code&gt; function was chosen based on existing implementations in standards and applications.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is backward compatible with the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; as it extends the existing functionality with new interfaces.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC20&#x2F;ERC20.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7729&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC20&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; metadata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC7729&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC20&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERCX&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span&gt; _metadata &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ipfs:&#x2F;&#x2F;QmakTsyRRmvihYwiAstYPYAeHBfaPYz3v9z2mkA1tYLA4w&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; metadata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _metadata&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The metadata URI could be manipulated to point to malicious content or phishing sites. Off-chain indexers should perform validation checks to ensure the security and integrity of the metadata URIs for users.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Simple token, Simplified ERC-20</title>
        <published>2023-06-21T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Xiang</name><uri>https://github.com/wenzhenxiang</uri>
	</author>
	
	<author>
		<name>Ben77</name><uri>https://github.com/ben2077</uri>
	</author>
	
	<author>
		<name>Mingshi S.</name><uri>https://github.com/newnewsms</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7196/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/simple-token-designed-for-smart-contract-wallet-aa/14757" />
        

        <id>https://wg-eips.ritovision.com/7196/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7196"
            label="ERC-7196" />
        

        
        

        
        <summary type="html">Designed for smart contract wallets, this removes the transferFrom, approve, and allowance functions from ERC-20 tokens.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7196/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC is a new asset designed based on the user contract wallet (including account abstraction), and is forward compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;. To keep token assets simple, this ERC removes the &lt;code&gt;transferFrom&lt;&#x2F;code&gt;, &lt;code&gt;approve&lt;&#x2F;code&gt; and &lt;code&gt;allowance&lt;&#x2F;code&gt; functions of ERC-20.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; defines Ethereum-based standard tokens that can be traded and transferred, but the essence of ERC-20 is based on the externally-owned account (EOA) wallet design. An EOA wallet has no state and code storage, and the smart contract wallet is different.&lt;&#x2F;p&gt;
&lt;p&gt;Almost all ERCs related to tokens add functions, but our opinion is the opposite. We think the token contract should be simpler, with more functions taken care of by the smart contract wallet.&lt;&#x2F;p&gt;
&lt;p&gt;Our proposal is to design a simpler token asset based on the smart contract wallet.&lt;&#x2F;p&gt;
&lt;p&gt;It aims to achieve the following goals:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Keep the asset contract simple: only responsible for the &lt;code&gt;transfer&lt;&#x2F;code&gt; functions.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;approve&lt;&#x2F;code&gt; and &lt;code&gt;allowance&lt;&#x2F;code&gt; functions are not managed by the token contract, Instead, these permissions are managed at the user level, offering greater flexibility and control to users. This change not only enhances user autonomy but also mitigates certain risks associated with the ERC-20 contract&#x27;s implementation of these functions.&lt;&#x2F;li&gt;
&lt;li&gt;Remove the &lt;code&gt;transferFrom&lt;&#x2F;code&gt; function. A better way to call the other party&#x27;s token assets is to access the other party&#x27;s own contract instead of directly accessing the token asset contract.&lt;&#x2F;li&gt;
&lt;li&gt;Forward compatibility with ERC-20 means that all fungible tokens can be compatible with this proposal.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;Compliant contracts MUST implement the following interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.20&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC7196 Simple token interface &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See https:&#x2F;&#x2F;ercs.ethereum.org&#x2F;ERCS&#x2F;erc-7196&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7196&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to notify transfer tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the from&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the receive&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The transaction amount &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the total supply&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; total&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The total supply amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; total&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; get the balance of owenr address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The balance of the owenr address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; balance&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfer token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The transaction amount &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; success&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The bool value returns whether the transfer is successful&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The proposal is to simplify token standards by removing &lt;code&gt;transferFrom&lt;&#x2F;code&gt;, &lt;code&gt;approve&lt;&#x2F;code&gt; and &lt;code&gt;allowance&lt;&#x2F;code&gt; functions. This simplification aims to enhance security, reduce complexity, and improve efficiency, making the standard more suitable for smart contract wallet environments while maintaining essential functionalities.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;As mentioned in the beginning, this ERC is forward compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;, ERC-20 is backward compatible with this ERC.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;forward compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.20&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERC7196.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;..&#x2F;..&#x2F;math&#x2F;SafeMath.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Standard ERC7196 token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0xc1b31357&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Implementation of the basic standard token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC7196&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7196&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    using&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SafeMath&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _balances&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _totalSupply&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _totalSupply&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;value &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;to &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; _balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;sub&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; _balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;It should be noted that this ERC is not backward compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;, so there will be incompatibility with existing dapps.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Contract wallet management token</title>
        <published>2023-06-21T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Xiang</name><uri>https://github.com/wenzhenxiang</uri>
	</author>
	
	<author>
		<name>Ben77</name><uri>https://github.com/ben2077</uri>
	</author>
	
	<author>
		<name>Mingshi S.</name><uri>https://github.com/newnewsms</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7204/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/token-asset-management-interface-with-smart-contract-wallet/14759" />
        

        <id>https://wg-eips.ritovision.com/7204/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7204"
            label="ERC-7204" />
        

        
        

        
        <summary type="html">Focuses on fungible token management within smart contract wallets, offering enhanced transaction flexibility and security</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7204/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal introduces a smart contract wallet-based approach for managing tokens, focusing on utilizing the programmable features of smart contract wallets for asset management.
Additionally, it introduces functions such as &lt;code&gt;tokenTransfer&lt;&#x2F;code&gt;, &lt;code&gt;tokenApprove&lt;&#x2F;code&gt;, &lt;code&gt;tokenApproveForAll&lt;&#x2F;code&gt;, &lt;code&gt;tokenIsApproveForAll&lt;&#x2F;code&gt; and &lt;code&gt;tokenAllowance&lt;&#x2F;code&gt;, which provide enhanced control over token transactions. This approach seeks to enhance token management by utilizing the built-in features of smart contract wallets, thus offering a more adaptable, secure, and efficient method for managing token transactions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;An externally-owned account (EOA) wallet has no state and code storage, while the smart contract wallet does.&lt;&#x2F;p&gt;
&lt;p&gt;Account abstraction (AA) is a direction of the smart contract wallet, which works around abstract accounts. This ERC can also be an extension based on &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt; or as a plug-in for wallets.&lt;&#x2F;p&gt;
&lt;p&gt;The smart contract wallet allows the user&#x27;s own account to have state and code, bringing programmability to the wallet. We think there are more directions to expand. For example, token asset management, functional expansion of token transactions, etc.&lt;&#x2F;p&gt;
&lt;p&gt;The smart contract wallet interface of this ERC is for asset management and asset approval. It supports the simpletoken &lt;!-- TODO --&gt; ERC-X, and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; is backward compatible with &lt;!-- TODO --&gt; ERC-X, so it can be compatible with the management of all fungible tokens in the existing market.&lt;&#x2F;p&gt;
&lt;p&gt;The proposal aims to achieve the following goals:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Assets are allocated and managed by the wallet itself, such as &lt;code&gt;approve&lt;&#x2F;code&gt; and &lt;code&gt;allowance&lt;&#x2F;code&gt;, which are configured by the user’s contract wallet, rather than controlled by the token asset contract, to avoid some existing ERC-20 contract risks.&lt;&#x2F;li&gt;
&lt;li&gt;Add the &lt;code&gt;tokenTransfer&lt;&#x2F;code&gt; function, the transaction initiated by the non-smart wallet itself or will verify the allowance amount.&lt;&#x2F;li&gt;
&lt;li&gt;Add &lt;code&gt;tokenApprove&lt;&#x2F;code&gt;, &lt;code&gt;tokenAllowance&lt;&#x2F;code&gt;, &lt;code&gt;tokenApproveForAll&lt;&#x2F;code&gt;, &lt;code&gt;tokenIsApproveForAll&lt;&#x2F;code&gt; functions. The user wallet itself supports approve and provides approve.
for single token assets and all token assets.&lt;&#x2F;li&gt;
&lt;li&gt;user wallet can choose batch approve and batch transfer.&lt;&#x2F;li&gt;
&lt;li&gt;Users can choose to add hook function before and after their &lt;code&gt;tokenTransfer&lt;&#x2F;code&gt; to increase the user&#x27;s more playability.&lt;&#x2F;li&gt;
&lt;li&gt;The user can choose to implement the &lt;code&gt;tokenReceive&lt;&#x2F;code&gt; function.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;** Compliant contract must implement the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; interfaces**&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-7204 &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-7204&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0xf73edcda&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.20&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7204&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is ERC165 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to notify listeners that owner has granted approval to the user to manage assets tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; asset&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the account that has granted the approval for token‘s assets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the spender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount allowed to spend&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TokenApproval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; asset&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to notify listeners that owner has granted approval to the spender to manage all token .&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; asset&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the account that has granted the approval for token‘s assets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; approved&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; approve all token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TokenApprovalForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Approve token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Allows spender address to withdraw from your account multiple times, up to the value amount.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If this function is called again it overwrites the current allowance with value.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emits an {TokenApproval} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; asset&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the spender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount allowed to spend&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; success&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The bool value returns whether the approve is successful&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenApprove&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; asset&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; read token allowance value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; asset&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the spender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; remaining&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The asset amount which spender is still allowed to withdraw from owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenAllowance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; asset&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; remaining&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Approve all token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Allows spender address to withdraw from your wallet all token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emits an {TokenApprovalForAll} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the spender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; approved&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Approved all tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; success&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The bool value returns whether the approve is successful&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenApproveForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approved&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; read spender approved value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the spender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; approved&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Whether to approved spender all tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenIsApproveForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approved&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfer token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; must call asset.transfer() inside the function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If the caller is not wallet self, must verify the allowance and update the allowance value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; asset&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the receive&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The transaction amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; success&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The bool value returns whether the transfer is successful&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; asset&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;the key technical decisions in this proposal are:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Improved Approve Mechanism&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Current vs. Proposed&lt;&#x2F;strong&gt;: In the existing ERC-20 system, an externally-owned account (EOA) directly interacts with token contracts to &lt;code&gt;approve&lt;&#x2F;code&gt;. The new &lt;code&gt;tokenApprove&lt;&#x2F;code&gt; and &lt;code&gt;tokenApproveForAll&lt;&#x2F;code&gt; functions in this proposed enable more precise control over token usage within a wallet contract, a significant improvement over the traditional method.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Enhanced Security&lt;&#x2F;strong&gt;: This mechanism mitigates risks like token over-approval by shifting approval control to the user&#x27;s smart contract wallet.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Programmability&lt;&#x2F;strong&gt;: Users gain the ability to set advanced approval strategies, such as conditional or time-limited approvals, the &lt;code&gt;tokenApproveForAll&lt;&#x2F;code&gt; function specifically allows for a universal setting  all tokens. these were not possible with traditional ERC-20 tokens.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Optimized Transfer Process&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Efficiency and Security&lt;&#x2F;strong&gt;: The &lt;code&gt;tokenTransfer&lt;&#x2F;code&gt; function streamlines the token transfer process, making transactions both more efficient and secure.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Flexibility&lt;&#x2F;strong&gt;: Allows the integration of custom logic (hooks) before and after transfers, enabling additional security checks or specific actions tailored to the user’s needs.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Support for Batch Operations&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Increased Efficiency&lt;&#x2F;strong&gt;: Users can simultaneously handle multiple &lt;code&gt;approve&lt;&#x2F;code&gt; or &lt;code&gt;transfer&lt;&#x2F;code&gt; operations, significantly boosting transaction efficiency.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Enhanced User Experience&lt;&#x2F;strong&gt;: Simplifies the management of numerous assets, improving the overall experience for users with large portfolios.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC can be used as an extension of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt; and is backward compatible with ERC-4337.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;No security considerations were found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Namespaced Storage Layout</title>
        <published>2023-06-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Francisco Giordano</name><uri>https://github.com/frangio</uri>
	</author>
	
	<author>
		<name>Hadrien Croubois</name><uri>https://github.com/Amxx</uri>
	</author>
	
	<author>
		<name>Ernesto García</name><uri>https://github.com/ernestognw</uri>
	</author>
	
	<author>
		<name>Eric Lau</name><uri>https://github.com/ericglau</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7201/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7201-namespaced-storage-layout/14796" />
        

        <id>https://wg-eips.ritovision.com/7201/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:7201"
            label="ERC-7201" />
        

        
        

        
        <summary type="html">Conventions for the storage location of structs in the namespaced storage pattern.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7201/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;We define the NatSpec annotation &lt;code&gt;@custom:storage-location&lt;&#x2F;code&gt; to document storage namespaces and their location in storage in Solidity or Vyper source code. Additionally, we define a formula to derive a location from an arbitrary identifier. The formula is chosen to be safe against collisions with the storage layouts used by Solidity and Vyper.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Smart contract languages such as Solidity and Vyper rely on tree-shaped storage layout. This tree starts at slot 0 and is composed of sequential chunks for consecutive variables. Hashes are used to ensure the chunks containing values of mappings and dynamic arrays do not collide. This is sufficient for most contracts. However, it presents a challenge for various design patterns used in smart contract development. One example is a modular design where using &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; a contract executes code from multiple contracts, all of which share the same storage space, and which have to carefully coordinate on how to use it. Another example is upgradeable contracts, where it can be difficult to add state variables in an upgrade given that they may affect the assigned storage location for the preexisting variables.&lt;&#x2F;p&gt;
&lt;p&gt;Rather than using this default storage layout, these patterns can benefit from laying out state variables across the storage space, usually at pseudorandom locations obtained by hashing. Each value may be placed in an entirely different location, but more frequently values that are used together are put in a Solidity struct and co-located in storage. These pseudorandom locations can be the root of new storage trees that follow the same rules as the default one. Provided that this pseudorandom root is constructed so that it is not part of the default tree, this should result in the definition of independent spaces that do not collide with one another or with the default one.&lt;&#x2F;p&gt;
&lt;p&gt;These storage usage patterns are invisible to the Solidity and Vyper compilers because they are not represented as Solidity state variables. Smart contract tools like static analyzers or blockchain explorers often need to know the storage location of contract data. Standardizing the location for storage layouts will allow these tools to correctly interpret contracts where these design patterns are used.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;preliminaries&quot;&gt;Preliminaries&lt;&#x2F;h3&gt;
&lt;p&gt;A &lt;em&gt;namespace&lt;&#x2F;em&gt; consists of a set of ordered variables, some of which may be dynamic arrays or mappings, with its values laid out following the same rules as the default storage layout but rooted in some location that is not necessarily slot 0. A contract using namespaces to organize storage is said to use &lt;em&gt;namespaced storage&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;A &lt;em&gt;namespace id&lt;&#x2F;em&gt; is a string that identifies a namespace in a contract. It should not contain any whitespace characters.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;custom-storage-location&quot;&gt;&lt;code&gt;@custom:storage-location&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;A namespace in a contract should be implemented as a struct type. These structs should be annotated with the NatSpec tag &lt;code&gt;@custom:storage-location &amp;lt;FORMULA_ID&amp;gt;:&amp;lt;NAMESPACE_ID&amp;gt;&lt;&#x2F;code&gt;, where &lt;code&gt;&amp;lt;FORMULA_ID&amp;gt;&lt;&#x2F;code&gt; identifies a formula used to compute the storage location where the namespace is rooted, based on the namespace id. &lt;em&gt;(Note: The Solidity compiler includes this annotation in the AST since v0.8.20, so this is recommended as the minimum compiler version when using this pattern.)&lt;&#x2F;em&gt; Structs with this annotation found outside of contracts are not considered to be namespaces for any contract in the source code.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;formula&quot;&gt;Formula&lt;&#x2F;h3&gt;
&lt;p&gt;The formula identified by &lt;code&gt;erc7201&lt;&#x2F;code&gt; is defined as &lt;code&gt;erc7201(id: string) = keccak256(keccak256(id) - 1) &amp;amp; ~0xff&lt;&#x2F;code&gt;. In Solidity, this corresponds to the expression &lt;code&gt;keccak256(abi.encode(uint256(keccak256(bytes(id))) - 1)) &amp;amp; ~bytes32(uint256(0xff))&lt;&#x2F;code&gt;. When using this formula the annotation becomes &lt;code&gt;@custom:storage-location erc7201:&amp;lt;NAMESPACE_ID&amp;gt;&lt;&#x2F;code&gt;. For example, &lt;code&gt;@custom:storage-location erc7201:foobar&lt;&#x2F;code&gt; annotates a namespace with id &lt;code&gt;&quot;foobar&quot;&lt;&#x2F;code&gt; rooted at &lt;code&gt;erc7201(&quot;foobar&quot;)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Future EIPs may define new formulas with unique formula identifiers. It is recommended to follow the convention set in this EIP and use an identifier of the format &lt;code&gt;erc1234&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The tree-shaped storage layout used by Solidity and Vyper follows the following grammar (with root=0):&lt;&#x2F;p&gt;
&lt;p&gt;$L_{root} := \mathit{root} \mid L_{root} + n \mid \texttt{keccak256}(L_{root}) \mid \texttt{keccak256}(H(k) \oplus L_{root}) \mid \texttt{keccak256}(L_{root} \oplus H(k))$&lt;&#x2F;p&gt;
&lt;p&gt;A requirement for the root is that it shouldn&#x27;t overlap with any storage location that would be part of the standard storage tree used by Solidity and Vyper (root = 0), nor should it be part of the storage tree derived from any other namespace (another root). This is so that multiple namespaces may be used alongside each other and alongside the standard storage layout, either deliberately or accidentally, without colliding. The term &lt;code&gt;keccak256(id) - 1&lt;&#x2F;code&gt; in the formula is chosen as a location that is unused by Solidity, but this is not used as the final location because namespaces can be larger than 1 slot and would extend into &lt;code&gt;keccak256(id) + n&lt;&#x2F;code&gt;, which is potentially used by Solidity. A second hash is added to prevent this and guarantee that namespaces are completely disjoint from standard storage, assuming keccak256 collision resistance and that arrays are not unreasonably large.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, namespace locations are aligned to 256 as a potential optimization, in anticipation of gas schedule changes after the Verkle state tree migration, which may cause groups of 256 storage slots to become warm all at once.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;naming&quot;&gt;Naming&lt;&#x2F;h3&gt;
&lt;p&gt;This pattern has sometimes been referred to as &quot;diamond storage&quot;. This causes it to be conflated with the &quot;diamond proxy pattern&quot;, even though they can be used independently of each other. This EIP has chosen to use a different name to clearly differentiate it from the proxy pattern.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.20&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Example&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @custom:storage&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;-location erc7201:example.main&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MainStorage&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; y&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; keccak256(abi.encode(uint256(keccak256(&amp;quot;example.main&amp;quot;)) - 1)) &amp;amp; ~bytes32(uint256(0xff));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; MAIN_STORAGE_LOCATION &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        0x183a6125c38840424c4a85fa12bab2ab606c4b6d0e7cc73c0c06ba5300eab500&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _getMainStorage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;MainStorage&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; storage&lt;&#x2F;span&gt;&lt;span&gt; $&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            $&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span&gt; MAIN_STORAGE_LOCATION&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _getXTimesY&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        MainStorage &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;storage&lt;&#x2F;span&gt;&lt;span&gt; $ &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _getMainStorage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; $&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;x &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; $&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;y&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Namespaces should avoid collisions with other namespaces or with standard Solidity or Vyper storage layout. The formula defined in this ERC guarantees this property for arbitrary namespace ids under the assumption of keccak256 collision resistance, as discussed in Rationale.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;@custom:storage-location&lt;&#x2F;code&gt; is a NatSpec annotation that current compilers don&#x27;t enforce any rules for or ascribe any meaning to. The contract developer is responsible for implementing the pattern and using the namespace as claimed in the annotation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>ERC-721 Multi-Metadata Extension</title>
        <published>2023-06-09T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>0xG</name><uri>https://github.com/0xGh</uri>
	</author>
	
	<author>
		<name>Marco Peyfuss</name><uri>https://github.com/mpeyfuss</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7160/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc721-multi-metadata-extension/14629" />
        

        <id>https://wg-eips.ritovision.com/7160/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7160"
            label="ERC-7160" />
        

        
        

        
        <summary type="html">Multiple metadata URIs per token, with the option to pin a primary URI.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7160/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes an extension to the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; standard to support multiple metadata URIs per token. It introduces a new interface, &lt;code&gt;IERC721MultiMetadata&lt;&#x2F;code&gt;, which provides methods for accessing the metadata URIs associated with a token, including a pinned URI index and a list of all metadata URIs. The extension is designed to be backward compatible with existing &lt;code&gt;ERC721Metadata&lt;&#x2F;code&gt; implementations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The current &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; standard allows for a single metadata URI per token with the &lt;code&gt;ERC721Metadata&lt;&#x2F;code&gt; implementation. However, there are use cases where multiple metadata URIs are desirable. Some example use cases are listed below:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A token represents a collection of (cycling) assets with individual metadata&lt;&#x2F;li&gt;
&lt;li&gt;An on-chain history of revisions to token metadata&lt;&#x2F;li&gt;
&lt;li&gt;Appending metadata with different aspect ratios so that it can be displayed properly on all screens&lt;&#x2F;li&gt;
&lt;li&gt;Dynamic and evolving metadata&lt;&#x2F;li&gt;
&lt;li&gt;Collaborative and multi-artist tokens&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This extension enables such use cases by introducing the concept of multi-metadata support.&lt;&#x2F;p&gt;
&lt;p&gt;The primary reason for having a multi-metadata standard in addition to the existing &lt;code&gt;ERC721Metadata&lt;&#x2F;code&gt; standard is that dapps and marketplaces don&#x27;t have a mechanism to infer and display all the token URIs. Giving a standard way for marketplaces to offer collectors a way to pin&#x2F;unpin one of the metadata choices also enables quick and easy adoption of this functionality.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;The multi-metadata extension is OPTIONAL for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; contracts and it is RECOMMENDED to be used in conjunction with the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4906&#x2F;&quot;&gt;ERC-4906&lt;&#x2F;a&gt; standard if implemented&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; EIP-721 Multi-Metdata Extension&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ERC-165 identifier for this interface is 0x06e1bc5b.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7160&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This event emits when a token uri is pinned and is&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  useful for indexing purposes.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TokenUriPinned&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This event emits when a token uri is unpinned and is&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  useful for indexing purposes.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TokenUriUnpinned&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get all token uris associated with a particular token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If a token uri is pinned, the index returned SHOULD be the index in the string array&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This call MUST revert if the token does not exist&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier for the nft&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; index&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An unisgned integer that specifies which uri is pinned for a token (or the default uri if unpinned)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uris&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A string array of all uris associated with a token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; pinned&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A boolean showing if the token has pinned metadata or not&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenURIs&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; index&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uris&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; pinned&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Pin a specific token uri for a particular token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This call MUST revert if the token does not exist&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This call MUST emit a `TokenUriPinned` event&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This call MAY emit a `MetadataUpdate` event from ERC-4096&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier of the nft&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; index&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The index in the string array returned from the `tokenURIs` function that should be pinned for the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; pinTokenURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Unpin metadata for a particular token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This call MUST revert if the token does not exist&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This call MUST emit a `TokenUriUnpinned` event&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This call MAY emit a `MetadataUpdate` event from ERC-4096&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; It is up to the developer to define what this function does and is intentionally left open-ended&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier of the nft&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; unpinTokenURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check on-chain if a token id has a pinned uri or not&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This call MUST revert if the token does not exist&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Useful for on-chain mechanics that don&amp;#39;t require the tokenURIs themselves&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier of the nft&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; pinned&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A bool specifying if a token has metadata pinned or not&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; hasPinnedTokenURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; pinned&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;TokenUriPinned&lt;&#x2F;code&gt; event MUST be emitted when pinning a token uri with the &lt;code&gt;pinTokenUri&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;TokenUriUnpinned&lt;&#x2F;code&gt; event MUST be emitted when unpinning a token uri with the &lt;code&gt;unpinTokenUri&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;tokenURI&lt;&#x2F;code&gt; function defined in the ERC-721 Metadata extension MUST return the pinned URI when a token has a pinned uri.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;tokenURI&lt;&#x2F;code&gt; function defined in the ERC-721 Metadata extension MUST return a default uri when a token has an unpinned uri.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; method MUST return &lt;code&gt;true&lt;&#x2F;code&gt; when called with &lt;code&gt;0x06e1bc5b&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Implementing functionality to add or remove uris to a token MUST be implemented separately from this standard. It is RECOMMENDED that one of the event defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4906&#x2F;&quot;&gt;ERC-4906&lt;&#x2F;a&gt; are emitted whenever uris are added or removed.&lt;&#x2F;p&gt;
&lt;p&gt;See the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7160&#x2F;#reference-implementation&quot;&gt;Implementation&lt;&#x2F;a&gt; section for an example.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Similar terminology to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; was used in order to keep fetching metadata familiar. The concept of pinning and unpinning metadata is introduced as it is clear that NFT owners might want to choose which piece of metadata to display. At first, we considered leaving the pinning and unpinning actions up to each developer, but realized that a standard interface for pinning and unpinning allows for dApps to easily implement universal support for multi-metadata tokens.&lt;&#x2F;p&gt;
&lt;p&gt;We first considered whether the &lt;code&gt;tokenURIs&lt;&#x2F;code&gt; function should return just a string array, but added the extra information so that you could get all info desired in one call instead of potentially three calls. The pinned URI should be used as the primary URI for the token, while the list of metadata URIs can be used to access individual assets&#x27; metadata within the token. dApps could present these as a gallery or media carousels.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;TokenUriPinned&lt;&#x2F;code&gt; and &lt;code&gt;TokenUriUnpinned&lt;&#x2F;code&gt; events included in this specification can be used by dApps to index what metadata to show. This can eliminate on-chain calls and event driven architecture can be used instead.&lt;&#x2F;p&gt;
&lt;p&gt;The reason why this standard recommends the use of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4906&#x2F;&quot;&gt;ERC-4906&lt;&#x2F;a&gt; when adding or removing uris from a token is that there is already wide dApp support for this event and it already is what is needed - an alert to dApps that metadata for a token has been updated. We did not want to potentially cause dApp issues with duplicate events. A third party listening to this event could then call the &lt;code&gt;tokenURIs&lt;&#x2F;code&gt; function to get the updated metadata.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This extension is designed to be backward compatible with existing &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; contracts. The implementation of the &lt;code&gt;tokenURI&lt;&#x2F;code&gt; method must either return the pinned token uri (if pinned) or some default uri (if unpinned).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;An open-source reference implementation of the &lt;code&gt;IERC721MultiMetadata&lt;&#x2F;code&gt; interface can be provided, demonstrating how to extend an existing &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; contract to support multi-metadata functionality. This reference implementation can serve as a guide for developers looking to implement the extension in their own contracts.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.19&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC721&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC721&#x2F;ERC721.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Ownable&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;access&#x2F;Ownable.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC4906&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;interfaces&#x2F;IERC4906.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC7160&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERC7160.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MultiMetadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Ownable&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC7160&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC4906&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _tokenURIs&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _pinnedURIIndices&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _hasPinnedTokenURI&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _symbol&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_name, _symbol) &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Ownable&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;) &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    _mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @notice Returns the pinned URI index or the last token URI index (length - 1).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _getTokenURIIndex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; _hasPinnedTokenURI&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ?&lt;&#x2F;span&gt;&lt;span&gt; _pinnedURIIndices&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; :&lt;&#x2F;span&gt;&lt;span&gt; _tokenURIs&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @notice Implementation of ERC721.tokenURI for backwards compatibility.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @inheritdoc ERC721.tokenURI&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    _requireMinted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; index &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _getTokenURIIndex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; uris &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _tokenURIs&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; uri &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; uris&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Revert if no URI is found for the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;uri&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC721: not URI found&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; uri&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @inheritdoc&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; IERC721MultiMetadata.tokenURIs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenURIs&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; index&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uris&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; pinned&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    _requireMinted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_getTokenURIIndex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _tokenURIs&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _hasPinnedTokenURI&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @inheritdoc&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; IERC721MultiMetadata.pinTokenURI&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; pinTokenURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Unauthorized&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    _pinnedURIIndices&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; index&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    _hasPinnedTokenURI&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TokenUriPinned&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @inheritdoc&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; IERC721MultiMetadata.unpinTokenURI&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; unpinTokenURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Unauthorized&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    _pinnedURIIndices&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    _hasPinnedTokenURI&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TokenUriUnpinned&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @inheritdoc&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; IERC721MultiMetadata.hasPinnedTokenURI&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; hasPinnedTokenURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; pinned&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; _hasPinnedTokenURI&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sets a specific metadata URI for a token at the given index.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setUri&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; index&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uri&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;_tokenURIs&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      _tokenURIs&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; uri&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      _tokenURIs&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;push&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;uri&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MetadataUpdate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Overrides supportsInterface to include IERC721MultiMetadata interface support.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC165&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;IERC7160&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;      super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Care should be taken when specifying access controls for state changing events, such as those that allow uris to be added to tokens
and those specified in this standard: the &lt;code&gt;pinTokenUri&lt;&#x2F;code&gt; and &lt;code&gt;unpinTokenUri&lt;&#x2F;code&gt; functions. This is up to the developers to specify
as each application may have different requirements to allow for pinning and unpinning.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>On-Chain Data Containers</title>
        <published>2023-06-09T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Rachid Ajaja</name><uri>https://github.com/abrajaja</uri>
	</author>
	
	<author>
		<name>Matthijs de Vries</name><uri>https://github.com/sudomati</uri>
	</author>
	
	<author>
		<name>Alexandros Athanasopulos</name><uri>https://github.com/Xaleee</uri>
	</author>
	
	<author>
		<name>Pavel Rubin</name><uri>https://github.com/pash7ka</uri>
	</author>
	
	<author>
		<name>Sebastian Galimberti Romano</name><uri>https://github.com/galimba</uri>
	</author>
	
	<author>
		<name>Daniel Berbesi</name><uri>https://github.com/berbex</uri>
	</author>
	
	<author>
		<name>Apostolos Mavropoulos</name><uri>https://github.com/ApostolosMavro</uri>
	</author>
	
	<author>
		<name>Barbara Marcano</name><uri>https://github.com/Barbara-Marcano</uri>
	</author>
	
	<author>
		<name>Daniel Ortega</name><uri>https://github.com/xdaniortega</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7208/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7208-on-chain-data-container/14778" />
        

        <id>https://wg-eips.ritovision.com/7208/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:7208"
            label="ERC-7208" />
        

        
        

        
        <summary type="html">Interoperability by abstracting logic away from storage</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7208/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC defines a series of interfaces for the abstraction of storage of on-chain data by implementing the logic functions that govern such data on independent smart contracts. &quot;On-chain Data Containers&quot; (ODCs) refer to the separation and indexing of data storage away from data management. We propose that on-chain data can be abstracted and stored in smart contracts called &quot;Data Objects&quot; (DO), which answer to external data indexing mechanisms named &quot;Data Points&quot; (DP). This data can be accessed and modified by implementing (one or many) separate smart contracts identified as &quot;Data Managers&quot; (DM). We introduce two mechanisms for access management: first, through a &quot;Data Index&quot; (DI) implementation, the &quot;Data Managers&quot; (DM) can be gated from accessing &quot;Data Objects&quot; (DO); second, a &quot;Data Point Registry&quot; (DPR) implementation manages the issuance of &quot;Data Points&quot; (DP). Lastly, we introduce the concept of data portability (horizontal data mobility) between implementations of &quot;Data Index&quot; (DI), enabling massive updates to the logic without affecting the underlying data storage.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;As the Ethereum ecosystem grows, so does the demand for on-chain functionalities. The market encourages a desire for broader adoption through more complex systems and there is a constant need for improved efficiency. We have seen times when an explosion of new standard token proposals was solely driven by market hype. While ultimately each standard serves its purpose, most of them require more flexibility to manage interoperability with other standards. A standard adapter mechanism is needed to enhance interoperability by driving the interactions between assets issued under different ERCs.&lt;&#x2F;p&gt;
&lt;p&gt;Without such mechanisms, most projects have implemented bespoke solutions for interoperability. This is an inefficient approach and leads to a fragmented ecosystem. We recognize there is no “one size fits all” solution to solve the standardization and interoperability challenges. Most assets - Fungible, Non-Fungible, Digital Twins, Real-world Assets, DePin, etc - have multiple mechanisms for representing them as on-chain tokens through the use of different standard interfaces and the diversity of standards spurs innovation.&lt;&#x2F;p&gt;
&lt;p&gt;However, for these assets to be exchanged, traded, or otherwise interacted with, protocols must implement compatibility with the relevant interfaces to access and modify on-chain data. This is especially challenging when considering the previously mentioned bespoke solutions for interoperability. Additionally, the immutability of smart contracts complicates the ability of already deployed protocols to adapt to new tokenization standards, which is critical for future-proofing implementations. A collaborative effort must be made to enable interaction between assets tokenized under different standards. The current ERC provides the tools for developing such on-chain adapters.&lt;&#x2F;p&gt;
&lt;p&gt;We aim to abstract the on-chain data handling from the logical implementation, exposing the underlying data independently of the ERC interface. We propose a series of interfaces for storing and accessing data on-chain in contracts called &quot;Data Objects&quot; (DO), grouping the underlying assets as generic &quot;Data Points&quot; (DP) that may be associated with multiple interoperable and even concurrent &quot;Data Manager&quot; (DM) contracts. This proposal is designed to work by coexisting with previous and future token standards, providing a flexible, efficient, and coherent mechanism to manage asset interoperability.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Data Abstraction&lt;&#x2F;strong&gt;: We propose a standardized interface for enabling developers to separate the data storage code from the underlying token utility logic, reducing the need for supporting and implementing multiple inherited -and often clashing- interfaces to achieve asset compatibility. The data (and therefore the assets) can be stored independently of the logic that governs such data.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Standard Neutrality&lt;&#x2F;strong&gt;: A neutral approach must enable the underlying data of any tokenized asset to transition seamlessly between different token standards. This will significantly improve interoperability among other standards, reducing fragmentation in the landscape. Our proposal aims to separate the storage of data representing an underlying asset from the standard interface used for representing the token.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Consistent Interface&lt;&#x2F;strong&gt;: A uniform interface of primitive functions abstracts the data storage from the use case, irrespective of the underlying token&#x27;s standard or the interface exposing such data. Data and metadata can be stored on-chain, and exposed through the same primitives.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Data Portability&lt;&#x2F;strong&gt;: We provide a mechanism for the Horizontal Mobility of data between implementations of this standard, incentivizing the implementation of interoperable solutions and standard adapters.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;terms&quot;&gt;Terms&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;Data Point&lt;&#x2F;strong&gt;: A uniquely identifiable reference to an on-chain data structure stored within one or many &lt;strong&gt;Data Objects&lt;&#x2F;strong&gt; and managed by one or many &lt;strong&gt;Data Managers&lt;&#x2F;strong&gt;. &lt;strong&gt;Data Points&lt;&#x2F;strong&gt; are issued by a &lt;strong&gt;Data Point Registry&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Data Object&lt;&#x2F;strong&gt;: A Smart Contract implementing the low-level storage management of information indexed through &lt;strong&gt;Data Points&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Data Manager&lt;&#x2F;strong&gt;: One or many Smart Contracts implementing the high-level logic and end-user interfaces for managing Data Objects.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Data Point Registry&lt;&#x2F;strong&gt;: One or many Smart Contracts used for managing the issuance of &lt;strong&gt;Data Points&lt;&#x2F;strong&gt;. Additionally, a &lt;strong&gt;Data Point Registry&lt;&#x2F;strong&gt; defines a space of compatible or interoperable &lt;strong&gt;Data Points&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Data Index&lt;&#x2F;strong&gt;: One or many Smart Contracts used for managing the access of &lt;strong&gt;Data Managers&lt;&#x2F;strong&gt; to &lt;strong&gt;Data Objects&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The keywords &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;data-point-structure&quot;&gt;Data Point Structure&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Data Point MUST be &lt;code&gt;bytes32&lt;&#x2F;code&gt; storage units.&lt;&#x2F;li&gt;
&lt;li&gt;Data Point SHOULD NOT be used for storing asset data.&lt;&#x2F;li&gt;
&lt;li&gt;Data Point SHOULD be used for indexing data.&lt;&#x2F;li&gt;
&lt;li&gt;Data Point SHOULD use a 4 bytes prefix for storing information relevant to the compatibility with other Data Points.&lt;&#x2F;li&gt;
&lt;li&gt;Data Point MUST use 4 bytes for storing the Chain ID&lt;&#x2F;li&gt;
&lt;li&gt;Data Point SHOULD use the last 20 bytes for identifying which Registry allocated them.&lt;&#x2F;li&gt;
&lt;li&gt;The RECOMMENDED internal structure of the Data Point is as follows:&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * RECOMMENDED internal DataPoint structure on the Reference Implementation:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * 0xPPPPVVRRIIIIIIIIHHHHHHHHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * - Prefix (bytes4)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * -- PPPP - Type prefix (i.e. 0x4450 - ASCII representation of letters &amp;quot;DP&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * -- VV   - Version of DataPoint specification (i.e. 0x00 for the reference implementation)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * -- RR   - Reserved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * - Registry-local identifier&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * -- IIIIIIII - 32 bit implementation-specific id of the DataPoint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * - Chain ID (bytes4)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * -- HHHHHHHH - 32 bit of chain identifier&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * - REGISTRY Address (bytes20)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * -- AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - Address of Registry which allocated the DataPoint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Data Points&lt;&#x2F;strong&gt; are a low-level structure abstracting and indexing information. &lt;strong&gt;Data Points&lt;&#x2F;strong&gt; act as pointers to information stored within data structures in &lt;strong&gt;Data Objects&lt;&#x2F;strong&gt;.
&lt;strong&gt;Data Points&lt;&#x2F;strong&gt; are allocated by a &lt;strong&gt;Data Point Registry&lt;&#x2F;strong&gt;. The &lt;strong&gt;Data Point&lt;&#x2F;strong&gt; SHOULD store which &lt;strong&gt;Data Point Registry&lt;&#x2F;strong&gt; initialized it within its internal structure. Each &lt;strong&gt;Data Point&lt;&#x2F;strong&gt; SHOULD have a unique identifier provided by the &lt;strong&gt;Data Point Registry&lt;&#x2F;strong&gt; when instantiated.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;data-object-interface&quot;&gt;Data Object Interface&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Data Object SHOULD be used for storing asset data.&lt;&#x2F;li&gt;
&lt;li&gt;Data Object SHOULD use &lt;strong&gt;Data Points&lt;&#x2F;strong&gt; for indexing the structure storing the data.&lt;&#x2F;li&gt;
&lt;li&gt;Data Object SHOULD implement the logic directly related to handling the data structure.&lt;&#x2F;li&gt;
&lt;li&gt;Data Object SHOULD implement the logic for transferring management of its &lt;strong&gt;Data Points&lt;&#x2F;strong&gt; to a different &lt;strong&gt;Data Index&lt;&#x2F;strong&gt; implementation.&lt;&#x2F;li&gt;
&lt;li&gt;Data Object MUST use the IDataObject interface:&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IDataObject&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Reads stored data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; dp&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Identifier of the DataPoint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; operation&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Read operation to run on the data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Operation-specific data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Operation&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;-specific data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; read&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; dp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Store data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; dp&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Identifier of the DataPoint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; operation&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Write operation to execute on the data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Operation-specific data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Operation&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;-specific data (can be empty)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; write&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; dp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sets DataIndex Implementation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; dp&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Identifier of the DataPoint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; newImpl&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address of the new DataIndex implementation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setDIImplementation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; dp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newImpl&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Data Objects&lt;&#x2F;strong&gt; are entrusted with the storage and management of data. &lt;strong&gt;Data Objects&lt;&#x2F;strong&gt; SHOULD implement the logic for managing the storage of on-chain data. &lt;strong&gt;Data Object&lt;&#x2F;strong&gt; internal data structure SHOULD use &lt;strong&gt;Data Points&lt;&#x2F;strong&gt; for indexing information.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Data Objects&lt;&#x2F;strong&gt; CAN receive &lt;code&gt;read()&lt;&#x2F;code&gt;, &lt;code&gt;write()&lt;&#x2F;code&gt;, or any other custom requests from a &lt;strong&gt;Data Manager&lt;&#x2F;strong&gt; requesting access to a storage structure indexed by a &lt;strong&gt;Data Point&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;As such, &lt;strong&gt;Data Objects&lt;&#x2F;strong&gt; respond to a gating mechanism given by a single &lt;strong&gt;Data Index&lt;&#x2F;strong&gt;. The function &lt;code&gt;setDIImplementation()&lt;&#x2F;code&gt; SHOULD enable the delegation of the management function to an &lt;code&gt;IDataIndex&lt;&#x2F;code&gt; implementation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;data-manager-contract&quot;&gt;Data Manager Contract&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Data Manager SHOULD use &lt;code&gt;IDataIndex.read()&lt;&#x2F;code&gt; or &lt;code&gt;IDataObject.read()&lt;&#x2F;code&gt; to read data from &lt;strong&gt;Data Objects&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Data Manager MUST use &lt;code&gt;IDataIndex.write()&lt;&#x2F;code&gt; to write data to &lt;strong&gt;Data Objects&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Data Manager MAY share &lt;strong&gt;Data Point&lt;&#x2F;strong&gt; with other &lt;strong&gt;Data Managers&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Data Manager MAY use multiple &lt;strong&gt;Data Points&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Data Manager SHOULD implement the logic for requesting &lt;strong&gt;Data Points&lt;&#x2F;strong&gt; from a &lt;strong&gt;Data Point Registry&lt;&#x2F;strong&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Data Managers&lt;&#x2F;strong&gt; are independent smart contracts that implement the business logic or &quot;high-level&quot; data management. They can &lt;code&gt;read()&lt;&#x2F;code&gt; from a &lt;strong&gt;Data Object&lt;&#x2F;strong&gt; address and &lt;code&gt;write()&lt;&#x2F;code&gt; through a &lt;strong&gt;Data Index&lt;&#x2F;strong&gt; implementation managing the delegated storage of the &lt;strong&gt;Data Points&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;data-point-registry-interface&quot;&gt;Data Point Registry Interface&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Data Point Registry SHOULD define functions to manage the creation, transfer, and access control of &lt;strong&gt;Data Points&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Data Point Registry SHOULD manage &lt;strong&gt;Data Point&lt;&#x2F;strong&gt; access management for &lt;strong&gt;Data Managers&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Data Point Registry MUST use the IDataPointRegistry interface:&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IDataPointRegistry&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verifies if an address has an Admin role for a DataPoint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; dp&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; DataPoint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Account to verify&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isAdmin&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; dp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Allocates a DataPoint to an owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Owner of the new DataPoint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Owner should be granted Admin role during allocation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; allocate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;DataPoint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfers a DataPoint to an owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; dp&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Data Point to be transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Owner of the new DataPoint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferOwnership&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; dp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newOwner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Grant permission to grant&#x2F;revoke other roles on the DataPoint inside a Data Index Implementation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * This is useful if DataManagers are deployed during lifecycle of the application.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; dp&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; DataPoint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; New admin&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; If&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the role was granted (otherwise account already had the role)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; grantAdminRole&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; dp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Revoke permission to grant&#x2F;revoke other roles on the DataPoint inside a Data Index Implementation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; dp&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; DataPoint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Old admin&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If an owner revokes Admin role from himself, he can add it again&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; If&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the role was revoked (otherwise account didn&amp;#39;t have the role)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revokeAdminRole&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; dp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;strong&gt;Data Point Registry&lt;&#x2F;strong&gt; is a smart contract entrusted with &lt;strong&gt;Data Point&lt;&#x2F;strong&gt; access control. &lt;strong&gt;Data Managers&lt;&#x2F;strong&gt; may request the allocation of &lt;strong&gt;Data Points&lt;&#x2F;strong&gt; to the &lt;strong&gt;Data Point Registry&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;data-index-interface&quot;&gt;Data Index Interface&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;DataIndex SHOULD manage the access of &lt;strong&gt;Data Managers&lt;&#x2F;strong&gt; to &lt;strong&gt;Data Objects&lt;&#x2F;strong&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;DataIndex SHOULD manage internal IDs for each user.&lt;&#x2F;li&gt;
&lt;li&gt;DataIndex MUST use the IDataIndex interface:&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IDataIndex&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verifies if DataManager is allowed to write specific DataPoint on specific DataObject&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; dp&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Identifier of the DataPoint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; dm&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of DataManager&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; if&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; write access is allowed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isApprovedDataManager&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; dp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; dm&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Defines if DataManager is allowed to write specific DataPoint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; dp&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Identifier of the DataPoint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; dm&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of DataManager&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; approved&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if DataManager should be approved for the DataPoint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Function should be restricted to DataPoint maintainer only&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; allowDataManager&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; dp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; dm&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approved&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Reads stored data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; dobj&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Identifier of DataObject&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; dp&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Identifier of the datapoint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; operation&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Read operation to execute on the data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Operation-specific data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Operation&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;-specific data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; read&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; dobj&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; dp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Store data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; dobj&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Identifier of DataObject&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; dp&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Identifier of the datapoint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; operation&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Read operation to execute on the data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Operation-specific data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Operation&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;-specific data (can be empty)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Function should be restricted to allowed DMs only&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; write&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; dobj&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; dp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;strong&gt;Data Index&lt;&#x2F;strong&gt; is a smart contract entrusted with access control. It is a gating mechanism for &lt;strong&gt;Data Managers&lt;&#x2F;strong&gt; to access &lt;strong&gt;Data Objects&lt;&#x2F;strong&gt;. If a &lt;strong&gt;Data Manager&lt;&#x2F;strong&gt; intends to access a &lt;strong&gt;Data Point&lt;&#x2F;strong&gt; (either by &lt;code&gt;read()&lt;&#x2F;code&gt;, &lt;code&gt;write()&lt;&#x2F;code&gt;, or any other method), the &lt;strong&gt;Data Index&lt;&#x2F;strong&gt; SHOULD be used for validating access to the data.&lt;&#x2F;p&gt;
&lt;p&gt;The mechanism for ID management determines a space of compatibility between implementations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The decision to encode &lt;strong&gt;Data Points&lt;&#x2F;strong&gt; as &lt;code&gt;bytes32&lt;&#x2F;code&gt; data pointers is primarily driven by flexibility and future-proofing. The use &lt;code&gt;bytes32&lt;&#x2F;code&gt; allows for a wide range of data encodings. This provides the developer with many options to accommodate diverse use cases. Furthermore, as Ethereum and its standards continue to evolve, encoding as &lt;code&gt;bytes32&lt;&#x2F;code&gt; ensures that the Standard Adapters built with the current ERC can reference future data types or structures without requiring significant changes to the adapter itself. The &lt;strong&gt;Data Point&lt;&#x2F;strong&gt; encoding should have a prefix so that the &lt;strong&gt;Data Object&lt;&#x2F;strong&gt; can efficiently identify compatibility issues when accessing the data storage. Additionally, the prefix should be used to find the &lt;strong&gt;Data Point Registry&lt;&#x2F;strong&gt; and verify admin access to the &lt;strong&gt;Data Point&lt;&#x2F;strong&gt;. The use of a suffix for identifying the &lt;strong&gt;Data Point Registry&lt;&#x2F;strong&gt; is also required, for the &lt;strong&gt;Data Object&lt;&#x2F;strong&gt; to quickly discard badly formed transactions that aim to use a &lt;strong&gt;Data Point&lt;&#x2F;strong&gt; from an unmatching &lt;strong&gt;Data Point Registry&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Data Manager&lt;&#x2F;strong&gt; implementations decide which &lt;strong&gt;Data Points&lt;&#x2F;strong&gt; they will be using. Their allocation is managed through a &lt;strong&gt;Data Point Registry&lt;&#x2F;strong&gt;, and the &lt;code&gt;write()&lt;&#x2F;code&gt; access to the &lt;strong&gt;Data Point&lt;&#x2F;strong&gt; is managed by passing through the &lt;strong&gt;Data Index&lt;&#x2F;strong&gt; implementation.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Data Objects&lt;&#x2F;strong&gt; are independent separate Smart Contracts that implement the same &lt;code&gt;read&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;write&lt;&#x2F;code&gt; interface for communicating with &lt;strong&gt;Data Managers&lt;&#x2F;strong&gt;. This is a decision mainly driven by the scalability of the system. Offering a simple interface for this layered structure enables different applications to have their addresses for storage of data independently from the asset&#x27;s interface. It is up to each implementation to manage access to their &lt;strong&gt;Data Point&lt;&#x2F;strong&gt; storage space. This enables a wide array of complex, dynamic, and interactive use cases to be implemented with multiple ERCs as well as other smart contracts, including the embedding of cross-chain and rollup logic for asset management.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Data Objects&lt;&#x2F;strong&gt; offer flexibility in storing mutable on-chain data that can be modified as per the requirements of each specific use case. This enables the &lt;strong&gt;Data Managers&lt;&#x2F;strong&gt; to hold mutable states in delegated storage and reflect changes over time, providing a dynamic layer to the otherwise static nature of storage through most other standardized interfaces.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Data Managers&lt;&#x2F;strong&gt; can decide to migrate the complete storage management of a &lt;strong&gt;Data Object&lt;&#x2F;strong&gt; from one &lt;strong&gt;Data Index&lt;&#x2F;strong&gt; implementation to another. As the &lt;strong&gt;Data Index&lt;&#x2F;strong&gt; implements user ID management, this mechanism enables a &lt;strong&gt;Data Manager&lt;&#x2F;strong&gt; to upgrade its internal access control mechanisms without affecting the underlying storage of value, as it is located elsewere (in the &lt;strong&gt;Data Object&lt;&#x2F;strong&gt;). We call this mechanism &quot;Horizontal Data Mobility&#x2F;Portability&quot;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC is intended to augment the functionality of existing token standards without introducing breaking changes. As such, it does not present any backward compatibility issues. Already deployed tokens under other ERCs can be wrapped and indexed as &lt;strong&gt;Data Points&lt;&#x2F;strong&gt; and managed by &lt;strong&gt;Data Objects&lt;&#x2F;strong&gt;, and later exposed through any implementation of &lt;strong&gt;Data Managers&lt;&#x2F;strong&gt;. All interoperability integrations will require a compatibility analysis, depending on the use case. However, the interfaces defined in this ERC define a framework for adapting one standard to another through storage abstraction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;We present an &lt;em&gt;educational example&lt;&#x2F;em&gt; implementation of a Standard Adapter showcasing two types of tokens (Fungible and Semi-Fungible) with shared data storage. The end user can interact with this implementation through one of two types of interfaces: The semi-fungible one (represented through a single &lt;strong&gt;Data Manager&lt;&#x2F;strong&gt;), and the fungible interface (represented by many &lt;strong&gt;Data Managers&lt;&#x2F;strong&gt;). The abstraction of the storage from the logic is achieved through the use of a single &lt;em&gt;Fungible Fractions&lt;&#x2F;em&gt; &lt;strong&gt;Data Object&lt;&#x2F;strong&gt;. A factory is used for deploying the Fungible token interfaces that share storage with each semi-fungible collection. Note that if a &lt;code&gt;transfer()&lt;&#x2F;code&gt; is called by either interface (Fungible or Semi-Fungible), both interfaces are emitting an event.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;This example has not been audited and should not be used in production environments.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7208&#x2F;assets&#x2F;contracts&#x2F;README&#x2F;&quot;&gt;contracts&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The access control is separated into three layers:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Layer 1&lt;&#x2F;strong&gt;: The &lt;strong&gt;Data Point Registry&lt;&#x2F;strong&gt; allocates for &lt;strong&gt;Data Managers&lt;&#x2F;strong&gt; and manages ownership (admin&#x2F;write rights) of &lt;strong&gt;Data Points&lt;&#x2F;strong&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Layer 2&lt;&#x2F;strong&gt;: The &lt;strong&gt;Data Index&lt;&#x2F;strong&gt; smart contract implements Access Control by managing Approvals of &lt;strong&gt;Data Managers&lt;&#x2F;strong&gt; to &lt;strong&gt;Data Points&lt;&#x2F;strong&gt;. It uses the &lt;strong&gt;Data Point Registry&lt;&#x2F;strong&gt; to verify who can grant&#x2F;revoke this access.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Layer 3&lt;&#x2F;strong&gt;: The &lt;strong&gt;DataObject&lt;&#x2F;strong&gt; manages trust relationship between the &lt;strong&gt;DataPoint&lt;&#x2F;strong&gt; and a &lt;strong&gt;DataIndex&lt;&#x2F;strong&gt;  implementation and allows a trusted &lt;strong&gt;DataIndex&lt;&#x2F;strong&gt; to execute &lt;code&gt;write&lt;&#x2F;code&gt; operations.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;A common task for a &lt;strong&gt;Data Object&lt;&#x2F;strong&gt; is to store user-related data, while the &lt;strong&gt;Data Manager&lt;&#x2F;strong&gt; implements the logic for managing such data. Both &lt;strong&gt;Data Objects&lt;&#x2F;strong&gt; and &lt;strong&gt;Data Managers&lt;&#x2F;strong&gt; often require the management of user IDs. A &lt;strong&gt;Data Index&lt;&#x2F;strong&gt; can offer logic for user management (i.e. IDs based on &lt;code&gt;address&lt;&#x2F;code&gt;) that are independent of any particular implementation, but care must be taken in selecting these identifiers. If chosen improperly, they could hinder a &lt;strong&gt;Data Manager&lt;&#x2F;strong&gt;&#x27;s ability to migrate between different &lt;strong&gt;Data Indexes&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;No further security considerations are derived specifically from this ERC.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Time Locks Maturity</title>
        <published>2023-06-05T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Thanh Trinh</name><uri>https://github.com/thanhtrinh2003</uri><email>thanh@revest.finance</email>
	</author>
	
	<author>
		<name>Joshua Weintraub</name><uri>https://github.com/jhweintraub</uri><email>josh@revest.finance</email>
	</author>
	
	<author>
		<name>Rob Montgomery</name><uri>https://github.com/RobAnon</uri><email>rob@revest.finance</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7444/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-idea-timelock-maturity/15321" />
        

        <id>https://wg-eips.ritovision.com/7444/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:7444"
            label="ERC-7444" />
        

        
        

        
        <summary type="html">Interface for conveying the date upon which a time-locked system becomes unlocked</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7444/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP defines a standardized method to communicate the date on which a time-locked system will become unlocked. This allows for the determination of maturities for a wide variety of asset classes and increases the ease with which these assets may be valued.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Time-locks are ubiquitous, yet no standard on how to determine the date upon which they unlock exists. Time-locked assets experience theta-decay, where the time remaining until they become unlocked dictates their value. Providing a universal standard to view what date they mature on allows for improved on-chain valuations of the rights to these illiquid assets, particularly useful in cases where the rights to these illiquid assets may be passed between owners through semi-liquid assets such as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Every &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7444&#x2F;&quot;&gt;ERC-7444&lt;&#x2F;a&gt; compliant contract must implement &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; interface detection&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7444&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    &#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;     *&lt;&#x2F;span&gt;&lt;span&gt; @notice      This &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; timestamp&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; that&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; time&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; lock&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; specified&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; by&lt;&#x2F;span&gt;&lt;span&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span&gt;` &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;unlocks&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; at&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;param&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;       id&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; identifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; which&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; describes&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; specific&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; time&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; lock&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      maturity&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; timestamp&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; of&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; time&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; lock&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; when&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; it&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; unlocks&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getMaturity&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; maturity&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The maturity return parameter should be implemented in the Unix timestamp standard, which has been used widely in solidity. For example, &lt;code&gt;block.timestamp&lt;&#x2F;code&gt; represents the Unix timestamp when a block is mined in 256-bit value.&lt;&#x2F;p&gt;
&lt;p&gt;For singleton implementations on fungible assets, values passed to &lt;code&gt;id&lt;&#x2F;code&gt; SHOULD be ignored, and queries to such implementations should pass in &lt;code&gt;0x0&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;universal-maturities-on-locked-assets&quot;&gt;Universal Maturities on Locked Assets&lt;&#x2F;h3&gt;
&lt;p&gt;Locked Assets have become increasingly popular and used in different parts of defi, such as yield farming and vested escrow concept. This has increased the need to formalize and define an universal interface for all these timelocked assets.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;valuation-of-locked-assets-via-the-black-scholes-model&quot;&gt;Valuation of Locked Assets via the Black-Scholes Model&lt;&#x2F;h3&gt;
&lt;p&gt;Locked Assets cannot be valued normally since the value of these assets can be varied through time and many other different factors throughout the locking time. For instance, The Black-Scholes Model or Black-Scholes-Merton model is an example of a suitable model to estimate the theoretical value of asset with the consideration of impact of time and other potential risks.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7444&#x2F;.&#x2F;assets&#x2F;equation.png&quot; alt=&quot;Black-Sholes Model&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;$C=\text{call option price}$&lt;&#x2F;li&gt;
&lt;li&gt;$N=\text{CDF of the normal distribution}$&lt;&#x2F;li&gt;
&lt;li&gt;$S_t=\text{spot price of an asset}$&lt;&#x2F;li&gt;
&lt;li&gt;$K=\text{strike price}$&lt;&#x2F;li&gt;
&lt;li&gt;$r=\text{risk-free interest rate}$&lt;&#x2F;li&gt;
&lt;li&gt;$t=\text{time to maturity}$&lt;&#x2F;li&gt;
&lt;li&gt;$\sigma=\text{volatility of the asset}$&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Time to maturity plays an important role in evaluating the price of timelocked assets, thus the demand to have a common interface for retrieving the data is inevitable.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This standard can be implemented as an extension to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and&#x2F;or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; tokens with time-locked functionality, many of which can be retrofitted with a designated contract to determine the point at which their time locks release.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;locked-erc-20-implementation&quot;&gt;Locked &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; implementation&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC20&#x2F;ERC20.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; LockedERC20ExampleContract&lt;&#x2F;span&gt;&lt;span&gt; implements ERC&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7444&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ERC20 &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; immutable&lt;&#x2F;span&gt;&lt;span&gt; token&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; totalLocked&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;Timelock struct&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TimeLock&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; maturity&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; lockId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;maps lockId to balance of the lock&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; TimeLock&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; idToLock&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        token &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;Maturity is not appropriate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; LockPeriodOngoing&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InvalidReceiver&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransferFailed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Deposit tokens to be locked in the requested locking period&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of tokens to deposit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; lockingPeriod&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; length of locking period for the tokens to be locked&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; deposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; lockingPeriod&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; lockId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; maturity &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt; lockingPeriod&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        lockId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; keccack256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; maturity&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;idToLock&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;lockId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;maturity &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;lock already exists&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;token&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransferFailed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        TimeLock &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;memory&lt;&#x2F;span&gt;&lt;span&gt; newLock &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TimeLock&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; maturity&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; lockedId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        totalLocked &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        idToLock&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;lockId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; newLock&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Withdraw tokens in the lock after the end of the locking period&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; lockId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; id of the lock that user have deposited in&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; withdraw&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; lockId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        TimeLock &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;memory&lt;&#x2F;span&gt;&lt;span&gt; lock &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; idToLock&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;lockId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; lock&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InvalidReceiver&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; lock&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;maturity&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; LockPeriodOngoing&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        totalLocked &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; lock&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;State cleanup&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        delete&lt;&#x2F;span&gt;&lt;span&gt; idToLock&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;lockId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;token&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; lock&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransferFailed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getMaturity&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; maturity&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; idToLock&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;id&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;maturity&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;extendable-time-locks&quot;&gt;Extendable Time Locks&lt;&#x2F;h3&gt;
&lt;p&gt;Users or developers should be aware of potential extendable timelocks, where the returned timestamp can be modified through protocols. Users or protocols should check the timestamp carefully before trading or lending with others.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Social Recovery Interface</title>
        <published>2023-05-29T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>John Zhang</name><uri>https://github.com/johnz1019</uri>
	</author>
	
	<author>
		<name>Davis Xiang</name><uri>https://github.com/xcshuan</uri>
	</author>
	
	<author>
		<name>Kyle Xu</name><uri>https://github.com/kylexyxu</uri>
	</author>
	
	<author>
		<name>George Zhang</name><uri>https://github.com/odysseus0</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7093/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-social-recovery-interface/14494" />
        

        <id>https://wg-eips.ritovision.com/7093/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:7093"
            label="ERC-7093" />
        

        
        

        
        <summary type="html">Interfaces for social recovery account supporting various guardian types and customizable recovery policies.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7093/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC proposes a standard interface for social recovery of smart contract accounts. It separates identity and policy verification from the recovery process, allowing more ways to authenticate (known as Guardians) than just on-chain accounts. It also lets users customize recovery policies without changing the account’s smart contract.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Vitalik Buterin has long advocated for social recovery as an essential tool for user protection within the crypto space. He posits that the value of this system rests in its ability to offer users, especially those less acquainted with the technicalities of cryptography, a robust safety net when access credentials are lost. By entrusting account recovery to a network of selected individuals or entities, dubbed &quot;Guardians,&quot; users gain a safeguard against the risk of losing access to their digital assets.&lt;&#x2F;p&gt;
&lt;p&gt;In essence, social recovery operates by verifying the identity of the user and the chosen Guardians, and then considering a set of their signatures. Should the validated signatures reach a specified threshold, account access is reestablished. This system is equipped to enforce complex policies, such as necessitating signatures from particular Guardians or reaching signature thresholds from different Guardian categories.&lt;&#x2F;p&gt;
&lt;p&gt;To overcome these limitations, this Ethereum Improvement Proposal (EIP) introduces a novel, customizable social recovery interface standard. This standard decouples identity and recovery policy verification from the recovery procedure itself, thereby enabling an independent, versatile definition and extension of both. This strategy accommodates a wider range of Guardian types and recovery policies, thereby offering users the following benefits:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Appoint friends or family members, who do not have blockchain accounts, as Guardians for social recovery.&lt;&#x2F;li&gt;
&lt;li&gt;Use NFTs&#x2F;SBTs as Guardians for their accounts.&lt;&#x2F;li&gt;
&lt;li&gt;Personalize and implement adaptable recovery policies.&lt;&#x2F;li&gt;
&lt;li&gt;Support novel types of Guardians and recovery policies without needing to upgrade their account contracts.&lt;&#x2F;li&gt;
&lt;li&gt;Enable multiple recovery mechanism support, thereby eliminating single points of failure.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;This approach enables users to customize recovery policies without the need to change the smart contract of the account itself.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP consists of four key concepts:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Identity&lt;&#x2F;strong&gt;: This denotes the representation of a Guardian&#x27;s identity on the blockchain. It encapsulates traditional on-chain account types such as Externally Owned Accounts (EOA) and Smart Contract Accounts (SCA). More importantly, it extends to include any identity construct capable of producing construct able to be verified on-chain, like signatures and proofs. This could range from &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.w3.org&#x2F;TR&#x2F;2021&#x2F;REC-webauthn-2-20210408&#x2F;&quot;&gt;Webauthn&lt;&#x2F;a&gt;&#x2F;Passkey R1 keys to Email DomainKeys Identified Mail (DKIM) signatures &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc6376&quot;&gt;RFC 6376&lt;&#x2F;a&gt;, OpenID tokens, Zero-Knowledge Proofs (ZKP), Non-Fungible Tokens (NFTs), SoulBound Tokens (SBTs), and even types yet to be developed. This comprehensive approach ensures a broad, forward-compatible support for various identity types.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;PermissionVerifier&lt;&#x2F;strong&gt;: This component defines how to verify the signature or proof provided by the Guardian. Regardless of whether the Guardian&#x27;s account is on-chain or off-chain, the PermissionVerifier is invoked during the recovery process of smart contract accounts that incorporate a social recovery system. Its primary role is to confirm the validity of the Guardian&#x27;s signature or proof, thereby ensuring the authenticity of the Guardian during the recovery process.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;RecoveryPolicyVerifier&lt;&#x2F;strong&gt;: This component offers a flexible interface for validating recovery policies. The flexibility stems from allowing account holders or authorized parties to define and store their recovery policies. During the recovery process, the verification logic is implemented by invoking the specific function of the contract instance adopting this interface. Thus, a wide array of customizable social recovery scenarios can be catered to through different contract instances and policy configurations. This contract is optional, because sometimes the contract designer may not need the policy abstraction.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;RecoveryAccount&lt;&#x2F;strong&gt;: This component encapsulates the core of the social recovery functionality. It is designed to be flexible, composable, and extensible to adapt to various recovery needs. Each RecoveryAccount is defined by an instance contract, crafted by smart contract developers, which embeds the essential logic for the recovery process.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;RecoveryModule&lt;&#x2F;strong&gt;: In some contract designs, many functions are not directly added to the account contract, but are implemented in the form of Module, which is a contract outside the account contract. This component encapsulates the core of the social recovery functionality. It is designed to be flexible, composable, and extensible to adapt to various recovery needs.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7093&#x2F;.&#x2F;assets&#x2F;social-recovery-flow.svg&quot; alt=&quot;social_recovery_flow&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;datatypes&quot;&gt;DataTypes&lt;&#x2F;h3&gt;
&lt;h3 id=&quot;typesanddecoders&quot;&gt;&lt;code&gt;TypesAndDecoders&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;This defines the necessary data types required by this interface standard.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Structure representing an identity with its signature&#x2F;proof verification logic.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * Represents an EOA&#x2F;CA account when signer is empty, use `guardianVerifier`as the actual signer for signature verification.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * OtherWise execute IPermissionVerifier(guardianVerifier).isValidPermission(hash, signer, signature).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Identity&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; guardianVerifier&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span&gt; signer&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Structure representing a guardian with a property&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * The property of Guardian are defined by the associated RecoveryPolicyVerifier contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; GuardianInfo&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Identity guardian&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint64&lt;&#x2F;span&gt;&lt;span&gt; property&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;eg.,Weight,Percentage,Role with weight,etc.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Structure representing a threshold configuration&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ThresholdConfig&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint64&lt;&#x2F;span&gt;&lt;span&gt; threshold&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Threshold value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    int48&lt;&#x2F;span&gt;&lt;span&gt; lockPeriod&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Lock period for the threshold&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Structure representing a recovery configuration&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * A RecoveryConfig can have multiple threshold configurations for different threshold values and their lock periods, and the policyVerifier is optional.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RecoveryConfigArg&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; policyVerifier&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    GuardianInfo&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; guardianInfos&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ThresholdConfig&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; thresholdConfigs&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Permission&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Identity guardian&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;Identity&lt;&#x2F;code&gt; structure represents various types of guardians. The process of identity verification is as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;When the &lt;code&gt;signer&lt;&#x2F;code&gt; value in the declared entity is empty, this implies that the &lt;code&gt;Identity&lt;&#x2F;code&gt; entity is of EOA&#x2F;SCA account type. In this case, &lt;code&gt;guardianVerifier&lt;&#x2F;code&gt; address should be the address of EOA&#x2F;SCA (the actual signer). For permission verification of this &lt;code&gt;Identity&lt;&#x2F;code&gt; entity, it is recommended to utilize a secure library or built-in function capable of validating both ECDSA and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;ERC-1271&lt;&#x2F;a&gt; signatures. This helps in preventing potential security vulnerabilities, such as signature malleability attacks.&lt;&#x2F;li&gt;
&lt;li&gt;When the &lt;code&gt;signer&lt;&#x2F;code&gt; value in the declared entity is non-empty, this suggests that the &lt;code&gt;Identity&lt;&#x2F;code&gt; entity is of non-account type. In this case, permission verification can be accomplished by calling &lt;code&gt;guardianVerifier&lt;&#x2F;code&gt; address contract instance through &lt;code&gt;IPermissionVerifier&lt;&#x2F;code&gt; interface.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;interfaces&quot;&gt;Interfaces&lt;&#x2F;h3&gt;
&lt;h3 id=&quot;ipermissionverifier&quot;&gt;&lt;code&gt;IPermissionVerifier&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The Guardian Permission Verification Interface. Implementations MUST conform to this interface to enable identity verification of non-account type guardians.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Interface for no-account type identity signature&#x2F;proof verification&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IPermissionVerifier&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check if the signer key format is correct&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isValidSigners&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signers&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Validate permission&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isValidPermission&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Validate permissions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isValidPermissions&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signers&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signatures&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Return supported signer key information, format, signature format, hash algorithm, etc.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MAY &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;TODO&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;:using ERC-3668: ccip-read&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getGuardianVerifierInfo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;irecoverypolicyverifier&quot;&gt;&lt;code&gt;IRecoveryPolicyVerifier&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The Recovery Policy Verification Interface. Implementations MAY conform to this interface to support verification of varying recovery policies. RecoveryPolicyVerifier is optional for SocialRecoveryInterface.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Interface for recovery policy verification&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IRecoveryPolicyVerifier&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify recovery policy and return verification success and lock period&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Verification includes checking if guardians exist in the Guardians List&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verifyRecoveryPolicy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; Permission&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; permissions&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; properties&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; succ&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; weight&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns supported policy settings and accompanying property definitions for Guardian.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getPolicyVerifierInfo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;verifyRecoveryPolicy()&lt;&#x2F;code&gt; function is designed to validate whether the provided list of &lt;code&gt;Permissions&lt;&#x2F;code&gt; abides by the specified recovery properties (&lt;code&gt;properties&lt;&#x2F;code&gt;). This function has the following constraints and effects: For each matched &lt;code&gt;guardian&lt;&#x2F;code&gt;, calculations are made according to the corresponding &lt;code&gt;property&lt;&#x2F;code&gt; in the &lt;code&gt;properties&lt;&#x2F;code&gt; list (e.g., accumulating weight, distinguishing role while accumulating, etc.).&lt;&#x2F;p&gt;
&lt;p&gt;These constraints ensure that the provided &lt;code&gt;guardians&lt;&#x2F;code&gt; and &lt;code&gt;properties&lt;&#x2F;code&gt; comply with the requirements of the recovery policy, maintaining the security and integrity of the recovery process.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;irecoveryaccount&quot;&gt;&lt;code&gt;IRecoveryAccount&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The Smart Contract Account MAY implement the &lt;code&gt;IRecoveryAccount&lt;&#x2F;code&gt; interface to support social recovery functionality, enabling users to customize configurations of different types of Guardians and recovery policies. In the contract design based on Module, the implementation of &lt;code&gt;RecoveryModule&lt;&#x2F;code&gt; is very similar to &lt;code&gt;RecoveryAccount&lt;&#x2F;code&gt;, except that different accounts need to be distinguished and isolated.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IRecoveryAccount&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    modifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlySelf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;onlySelf: NOT_AUTHORIZED&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        _&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    modifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InRecovering&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; policyVerifyAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt; isRecovering&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; )&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getRecoveryStatus&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;policyVerifierAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;isRecovering&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;InRecovering: no ongoing recovery&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        _&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Events for updating guardians, starting for recovery, executing recovery, and canceling recovery&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RecoveryStarted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newOwners&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint48&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expiryTime&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RecoveryExecuted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newOwners&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RecoveryCanceled&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Return the domain separator name and version for signatures&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Also return the domainSeparator for EIP-712 signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;             Domain separator name for signatures&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DOMAIN_SEPARATOR_NAME&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;             Domain separator version for signatures&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DOMAIN_SEPARATOR_VERSION&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;             returns the domainSeparator for EIP-712 signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;             the&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; bytes32 domainSeparator for EIP-712 signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; domainSeparatorV4&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Update &#x2F;replace guardians and recovery policies&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Multiple recovery policies can be set using an array of RecoveryConfigArg&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; updateGuardians&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;RecoveryConfigArg&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recoveryConfigArgs&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlySelf&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Generate EIP-712 message hash,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Iterate over signatures for verification,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify recovery policy,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Store temporary state or recover immediately based on the result returned by verifyRecoveryPolicy.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; startRecovery&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; configIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newOwner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        Permission&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; permissions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Execute recovery&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * temporary state -&amp;gt; ownerKey rotation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; executeRecovery&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; configIndex&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; cancelRecovery&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; configIndex&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlySelf&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InRecovering&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;policyVerifier&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; cancelRecoveryByGuardians&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; configIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; Permission&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; permissions&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        InRecovering&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;policyVerifier&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get wallet recovery config, check if an identity is a guardian, get the nonce of social recovery, and get the recovery status of the wallet&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isGuardian&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; configIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; identity&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; guardian&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getRecoveryConfigs&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;RecoveryConfigArg&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recoveryConfigArgs&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getRecoveryNonce&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getRecoveryStatus&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; policyVerifier&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; isRecovering&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint48&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expiryTime&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;For the &lt;code&gt;Guardian&lt;&#x2F;code&gt;&#x27;s signable message, it SHOULD employ &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; type signature to ensure the content of the signature is readable and can be confirmed accurately during the Guardian signing process.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;getRecoveryNonce()&lt;&#x2F;code&gt; SHOULD be separated from nonces associated with account asset operations, as social recovery is a function at the account layer.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;recovery-account-workflow&quot;&gt;&lt;strong&gt;Recovery Account Workflow&lt;&#x2F;strong&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Note: This workflow is presented as an illustrative example to clarify the coordinated usage of the associated interface components. It does not imply a mandatory adherence to this exact process.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;A user sets up a &lt;code&gt;recoveryPolicyConfigA&lt;&#x2F;code&gt; within his &lt;code&gt;RecoveryAccount&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;recoveryConfigA&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;     &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;RecoveryConfig&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;     &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;policyVerifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xA&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;     &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;guardians&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;             &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Identity&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;             &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;             &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                 &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;guardianVerifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;guardianVerifier1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                 &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;signerA&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;             &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;property&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 30&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;             &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Identity&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;             &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;             &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                 &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;guardianVerifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;guardianVerifier2&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                 &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;             &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;property&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 30&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;             &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Identity&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;             &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;             &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                 &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;guardianVerifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;guardianVerifier3&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                 &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;signerC&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;             &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;property&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 40&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;     &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;thresholdConfigs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;threshold&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 50&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;lockPeriod&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;24hours&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;threshold&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 100&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;lockPeriod&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;When GuardianA and GuardianB assist the user in performing account recovery, they are to confirm the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; structured data for signing, which might look like this:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;types&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;EIP712Domain&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;verifyingContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;StartRecovery&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;configIndex&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;newOwners&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;primaryType&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;StartRecovery&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;domain&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Recovery Account Contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;verifyingContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;message&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;policyVerifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xA&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;newOwners&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcd&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In this step, the guardians need to confirm that the domain separator&#x27;s &lt;code&gt;verifyingContract&lt;&#x2F;code&gt; is the correct &lt;code&gt;RecoveryAccount&lt;&#x2F;code&gt; address for the user, the contract name, version, and chainId are correct, and the &lt;code&gt;policyVerifier&lt;&#x2F;code&gt; and &lt;code&gt;newOwners&lt;&#x2F;code&gt; fields in the &lt;code&gt;message&lt;&#x2F;code&gt; part match the user&#x27;s provided data.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;msgHash&lt;&#x2F;code&gt; is then composed of:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;msgHash&lt;&#x2F;code&gt; = &lt;code&gt;keccak256(&quot;\\x19\\x01&quot; + domainSeparatorV4() + dataHash)&lt;&#x2F;code&gt;
Where,&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;dataHash&lt;&#x2F;code&gt; = &lt;code&gt;keccak256(EXECUTE_RECOVERY_TYPEHASH + configIndex + keccak256(bytes(newOwners)) + getRecoveryNonce())&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;EXECUTE_RECOVERY_TYPEHASH&lt;&#x2F;code&gt; = &lt;code&gt;keccak256(&quot;StartRecovery(address configIndex, bytes newOwners, uint256 nonce)&quot;)&lt;&#x2F;code&gt;
The guardians sign this hash to obtain the signature:&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;signature&lt;&#x2F;code&gt; = &lt;code&gt;sign(msgHash)&lt;&#x2F;code&gt;
The &lt;code&gt;permission&lt;&#x2F;code&gt; is then constructed as:&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;permission&lt;&#x2F;code&gt; = &lt;code&gt;guardian + signature&lt;&#x2F;code&gt;
Once each Guardian has generated their unique &lt;code&gt;permission&lt;&#x2F;code&gt;, all these individual permissions are collected to form &lt;code&gt;permissions&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;code&gt;permissions&lt;&#x2F;code&gt;= [&lt;code&gt;guardianA+signature&lt;&#x2F;code&gt;, &lt;code&gt;guardianB+signature&lt;&#x2F;code&gt;, ...]&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;permissions&lt;&#x2F;code&gt; is an array that consists of all the permissions of the Guardians who are participating in the recovery process.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;A bundler or another relayer service calls the &lt;code&gt;RecoveryAccount.startRecovery(0xA, newOwners, permissions)&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;startRecovery()&lt;&#x2F;code&gt; function&#x27;s processing logic is as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Generate a message hash (&lt;code&gt;msgHash&lt;&#x2F;code&gt;) from the input parameters &lt;code&gt;0xA&lt;&#x2F;code&gt;, &lt;code&gt;newOwners&lt;&#x2F;code&gt; and internally generated &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; signature parameters and &lt;code&gt;RecoveryNonce&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Extract &lt;code&gt;guardian&lt;&#x2F;code&gt; and corresponding &lt;code&gt;signature&lt;&#x2F;code&gt; from the input parameters &lt;code&gt;permissions&lt;&#x2F;code&gt; and process them as follows:
&lt;ul&gt;
&lt;li&gt;If &lt;code&gt;guardianA.signer&lt;&#x2F;code&gt; is non-empty (Identity A), call &lt;code&gt;IPermissionVerifier(guardianVerifier1).isValidPermissions(signerA, msgHash, permissionA.signature)&lt;&#x2F;code&gt; to validate the signature.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;guardianA.signer&lt;&#x2F;code&gt; is empty (Identity B), call the internal function &lt;code&gt;SignatureChecker.isValidSignatureNow(guardianVerifier2, msgHash, permissionB.signature)&lt;&#x2F;code&gt; to validate the signature.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;After successful verification of all &lt;code&gt;guardians&lt;&#x2F;code&gt; signatures, fetch the associated &lt;code&gt;config&lt;&#x2F;code&gt; data for policyVerifier address &lt;code&gt;0xA&lt;&#x2F;code&gt; and call &lt;code&gt;IRecoveryPolicyVerifier(0xA).verifyRecoveryPolicy(permissions, properties)&lt;&#x2F;code&gt;. The function &lt;code&gt;verifyRecoveryPolicy()&lt;&#x2F;code&gt; performs the following checks:&lt;&#x2F;p&gt;
&lt;p&gt;Note that the &lt;code&gt;guardians&lt;&#x2F;code&gt; parameter in the function refers to the guardians whose signatures have been successfully verified.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Verify that &lt;code&gt;guardians&lt;&#x2F;code&gt; (Identity A and B) are present in &lt;code&gt;config.guardianInfos&lt;&#x2F;code&gt; list and are unique.&lt;&#x2F;li&gt;
&lt;li&gt;Accumulate the &lt;code&gt;property&lt;&#x2F;code&gt; values of &lt;code&gt;guardians&lt;&#x2F;code&gt; (30 + 30 = 60).&lt;&#x2F;li&gt;
&lt;li&gt;Compare the calculated result (60) with the &lt;code&gt;config.thresholdConfigs.threshold&lt;&#x2F;code&gt; ,the result is more than the first element (&lt;code&gt;threshold: 50, lockPeriod: 24 hours&lt;&#x2F;code&gt;) but less than the second element (&lt;code&gt;threshold: 100, lockPeriod: &quot;&quot;&lt;&#x2F;code&gt;), the validation is successful, and the lock period of 24 hours is returned.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;RecoveryAccount&lt;&#x2F;code&gt; saves a temporary state &lt;code&gt;{newOwners, block.timestamp + 24 hours}&lt;&#x2F;code&gt; and increments &lt;code&gt;RecoveryNonce&lt;&#x2F;code&gt;. A &lt;code&gt;RecoveryStarted&lt;&#x2F;code&gt; event is emitted.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;After the expiry time, anyone (usually a relayer) can call &lt;code&gt;RecoveryAccount.executeRecovery()&lt;&#x2F;code&gt; to replace &lt;code&gt;newOwners&lt;&#x2F;code&gt;, remove the temporary state, complete the recovery, and emit a &lt;code&gt;RecoveryExecuteed&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;A primary design rationale for this proposal is to extend a greater diversity of Guardian types and more flexible, customizable recovery policies for a RecoveryAccount. This is achieved by separating the verification logic from the social recovery process, ensuring that the basic logic of the account contract remains unaltered.&lt;&#x2F;p&gt;
&lt;p&gt;The necessity of incorporating &lt;code&gt;Verifiers&lt;&#x2F;code&gt; from external contracts arises from the importance of maintaining the inherent recovery logic of the &lt;code&gt;RecoveryAccount&lt;&#x2F;code&gt;. The &lt;code&gt;Verifiers&lt;&#x2F;code&gt;&#x27;s logic is designed to be simple and clear, and its fixed invocation format means that any security risks posed by integrating external contracts can be effectively managed.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;recoveryConfigs&lt;&#x2F;code&gt; are critical to the &lt;code&gt;RecoveryAccount&lt;&#x2F;code&gt; and should be securely and effectively stored. The access and modification permissions associated with these configurations must be carefully managed and isolated to maintain security. The storage and quantity of &lt;code&gt;recoveryConfigs&lt;&#x2F;code&gt; are not limited to ensure the maximum flexibility of the &lt;code&gt;RecoveryAccount&lt;&#x2F;code&gt;&#x27;s implementation.&lt;&#x2F;p&gt;
&lt;p&gt;The introduction of &lt;code&gt;recoveryNonce&lt;&#x2F;code&gt; into the &lt;code&gt;RecoveryAccount&lt;&#x2F;code&gt; serves to prevent potential replay attacks arising from the malicious use of Guardian&#x27;s &lt;code&gt;permissions&lt;&#x2F;code&gt;. The &lt;code&gt;recoveryNonce&lt;&#x2F;code&gt; ensures each recovery process is unique, reducing the likelihood of past successful recovery attempts being maliciously reused.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues are introduced by this standard.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TBD.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>MIME type for Web3 URL in Auto Mode</title>
        <published>2023-05-28T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Qi Zhou</name><uri>https://github.com/qizhou</uri>
	</author>
	
	<author>
		<name>Nicolas Deschildre</name><uri>https://github.com/nand2</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7087/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7087-mime-type-for-web3-url-in-auto-mode/14471" />
        

        <id>https://wg-eips.ritovision.com/7087/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7087"
            label="ERC-7087" />
        

        
        

        
        <summary type="html">Add ability to indicate or determine the MIME type of the data returned by a Web3 URL in auto mode</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7087/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard extends the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6860&#x2F;&quot;&gt;ERC-6860&lt;&#x2F;a&gt; &lt;code&gt;web3:&#x2F;&#x2F;&lt;&#x2F;code&gt; standard: in smart contracts not designed for &lt;code&gt;web3:&#x2F;&#x2F;&lt;&#x2F;code&gt; (thus using auto mode), the MIME type of the returned data is either implicit (not advertised by the smart contract) or included within the returned data (&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc2397&quot;&gt;RFC 2397&lt;&#x2F;a&gt; data URLs). This standard defines additional query parameters so that a MIME type can be returned when fetching a &lt;code&gt;web3:&#x2F;&#x2F;&lt;&#x2F;code&gt; URL in these scenarios.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;When returning data to the web browser, a &lt;code&gt;Content-Type&lt;&#x2F;code&gt; header indicating the MIME type of the data is strongly recommended, or the data may be incorrectly interpreted and displayed by the web browser.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;web3:&#x2F;&#x2F;&lt;&#x2F;code&gt; protocol has 2 modes: manual and auto.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The manual mode is used on smart contracts explicitly requesting this mode (via an interface), so they are expected to signal the MIME type of the returned data, with the mechanism described in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6860&#x2F;&quot;&gt;ERC-6860&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;On the other hand, the auto mode is used on both smart contracts specifically requesting the mode, and for all the others not signalling anything. While we can expect smart contracts explicitly requesting auto mode to signal the MIME type of the returned data, we cannot expect it for the others contracts.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This standard aims at filling this gap: with the introduction of additional query parameters, it will allow the URL to specify the MIME type of the returned data. Additionally, when the returned data is a &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc2397&quot;&gt;RFC 2397&lt;&#x2F;a&gt; data URL, it will allow the URL to flag the returned data as data URL, so that the protocol can return the decoded data, and accompany it with the MIME type advertised in the data URL.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The standard introduces three query parameters to determine the MIME type.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;mime.content=&amp;lt;contentType&amp;gt;&lt;&#x2F;code&gt;, where &lt;code&gt;&amp;lt;contentType&amp;gt;&lt;&#x2F;code&gt; is a MIME type defined in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc6838&quot;&gt;RFC 6838&lt;&#x2F;a&gt;. If the &lt;code&gt;&amp;lt;contentType&amp;gt;&lt;&#x2F;code&gt; does not follow the structure of a MIME type, the URL is not fetched and an error message is displayed to the user. After URL decoding, &lt;code&gt;&amp;lt;contentType&amp;gt;&lt;&#x2F;code&gt; is set as the value of the &lt;code&gt;Content-Type&lt;&#x2F;code&gt; header of the response; or&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;mime.type=&amp;lt;fileType&amp;gt;&lt;&#x2F;code&gt;, where &lt;code&gt;&amp;lt;fileType&amp;gt;&lt;&#x2F;code&gt; is a filename extension from which a MIME type is determined. If the filename extension is not recognized, the URL is not fetched and an error message is displayed to the user. The MIME type is then set as the value of the &lt;code&gt;Content-Type&lt;&#x2F;code&gt; header of the response; or&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;mime.dataurl&lt;&#x2F;code&gt;, which indicates to decode the returned bytes as a &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc2397&quot;&gt;RFC 2397&lt;&#x2F;a&gt; data URL. After decoding, the decoded body will be returned as the main output, and the MIME type specified in the data URL will be used. If the data cannot be parsed as data URL, an error will be returned.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;If multiple query parameters are present, the last query parameter will be applied.  If none of the query parameter is specified, &lt;code&gt;Content-Type&lt;&#x2F;code&gt; is defined by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6860&#x2F;&quot;&gt;ERC-6860&lt;&#x2F;a&gt;.  If the &lt;code&gt;returns&lt;&#x2F;code&gt; query parameter is specified, the &lt;code&gt;mime.xxx&lt;&#x2F;code&gt; parameters will be ignored and the &lt;code&gt;Content-Type&lt;&#x2F;code&gt; will be defined by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6860&#x2F;&quot;&gt;ERC-6860&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;In &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc2234&quot;&gt;RFC 2234&lt;&#x2F;a&gt; ABNF notation, the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6860&#x2F;&quot;&gt;ERC-6860&lt;&#x2F;a&gt; syntax is :&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;attribute       = attrName &amp;quot;=&amp;quot; attrValue&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;attrName        = &amp;quot;returns&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; &amp;quot;returnTypes&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;attrValue       = [ &amp;quot;(&amp;quot; [ retTypes ] &amp;quot;)&amp;quot; ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This standard evolves it into:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;attribute       = retAttr &#x2F; mimeCAttr &#x2F; mimeTAttr &#x2F; mimeDAttr&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;retAttr         = retAttrName &amp;quot;=&amp;quot; retAttrValue&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;retAttrName     = &amp;quot;returns&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F; &amp;quot;returnTypes&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;retAttrValue    = [ &amp;quot;(&amp;quot; [ retTypes ] &amp;quot;)&amp;quot; ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mimeCAttr       = &amp;quot;mime.content=&amp;quot; mimeCAttrVal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mimeCAttrVal    = # ABNF of MIME type as in RFC 6838 &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mimeTAttr       = &amp;quot;mime.type=&amp;quot; 1*( ALPHA &#x2F; DIGIT )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mimeDAttr       = &amp;quot;mime.dataurl&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;examples&quot;&gt;Examples&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;example-1&quot;&gt;Example 1&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;web3:&#x2F;&#x2F;0x91cf36c92feb5c11d3f5fe3e8b9e212f7472ec14&#x2F;accessorizedImageOf&#x2F;1289?mime.content=image&#x2F;svg%2Bxml&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where the contract is in auto mode.&lt;&#x2F;p&gt;
&lt;p&gt;The protocol will call the contract &lt;code&gt;0x91cf36c92feb5c11d3f5fe3e8b9e212f7472ec14&lt;&#x2F;code&gt; with the message defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6860&#x2F;&quot;&gt;ERC-6860&lt;&#x2F;a&gt; and the returned &lt;code&gt;Content-Type&lt;&#x2F;code&gt; header will be set to &lt;code&gt;image&#x2F;svg+xml&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;example-2&quot;&gt;Example 2&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;web3:&#x2F;&#x2F;0x91cf36c92feb5c11d3f5fe3e8b9e212f7472ec14&#x2F;accessorizedImageOf&#x2F;1289?mime.type=svg&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where the contract is in auto mode.&lt;&#x2F;p&gt;
&lt;p&gt;The protocol will call the contract &lt;code&gt;0x91cf36c92feb5c11d3f5fe3e8b9e212f7472ec14&lt;&#x2F;code&gt; with the message defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6860&#x2F;&quot;&gt;ERC-6860&lt;&#x2F;a&gt; and the returned &lt;code&gt;Content-Type&lt;&#x2F;code&gt; header will be set to &lt;code&gt;image&#x2F;svg+xml&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;example-3&quot;&gt;Example 3&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;web3:&#x2F;&#x2F;0xff9c1b15b16263c61d017ee9f65c50e4ae0113d7&#x2F;tokenURI&#x2F;100?mime.dataurl&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where the contract is in auto mode, and the returned data is &lt;code&gt;data:application&#x2F;json,[&quot;xx&quot;]&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The protocol will call the contract &lt;code&gt;0xff9c1b15b16263c61d017ee9f65c50e4ae0113d7&lt;&#x2F;code&gt; with the message defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6860&#x2F;&quot;&gt;ERC-6860&lt;&#x2F;a&gt; and decode the data according to the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc2397&quot;&gt;RFC 2397&lt;&#x2F;a&gt; data URL standard. The returned output will be &lt;code&gt;[&quot;xx&quot;]&lt;&#x2F;code&gt; and the returned &lt;code&gt;Content-Type&lt;&#x2F;code&gt; header will be set to &lt;code&gt;application&#x2F;json&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The standard uses three different query parameters rather than a single query parameter to avoid confusion - an implementer or a user can easily tell the expected returned MIME of a link.  Further, in auto mode, the query parameters are not used to form the EVM message (e.g., calldata) and thus it is safe to introduce new query parameters.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;These new query parameters introduce Cross Site Scripting attack vectors : an attacker could exploit string or bytes returning methods he can influence by making them return unfiltered data injected by him, and then craft a URL to make the returned data interpreted as HTML, and then send the URL to victims. If the web3 hostname is well known, the victim may get a false sense of security.&lt;&#x2F;p&gt;
&lt;p&gt;Malicious actions using javascript are broad and can include :&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Extraction of data of web storage APIs (cookies, localStorage, sessionStorage, indexedDB), sent to the attacker&lt;&#x2F;li&gt;
&lt;li&gt;Triggering a signature request or transaction confirmation request (via a wallet javascript interface)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Cross Site Scripting is a classical attack vector in HTTP websites, we expect developers to be wary of this. Nonetheless; the ability to specify the MIME type is unusual. &lt;code&gt;auto&lt;&#x2F;code&gt; mode websites should be discouraged and the attack vectors well documented.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Financial Bonds</title>
        <published>2023-05-28T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Samuel Gwlanold Edoumou</name><uri>https://github.com/Edoumou</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7092/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/financial-bonds/14461" />
        

        <id>https://wg-eips.ritovision.com/7092/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7092"
            label="ERC-7092" />
        

        
        

        
        <summary type="html">Represents debt issued by entities to investors.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7092/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal introduces fixed-income financial bonds with key characteristics defined to facilitate bond issuance in the primary market and enable buying or selling bonds in the secondary market. The standard also provides cross-chain functionalities for bonds operations and management across multiple blockchains.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Fixed-income instruments are a widely utilized asset class for corporations and other entities raising funds. However, transitioning to tokenized bonds is challenging due to existing standards like &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3475&#x2F;&quot;&gt;ERC-3475&lt;&#x2F;a&gt;, which introduces unfamiliar concepts and leads to unnecessary gas consumption. Additionally, the lack of named variables like coupon, maturity date, and principal, makes it difficult to implement ERC-3475 since developers need to remember which metadata is assigned to each parameter.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Every contract compliant with this ERC MUST implement the following Token Interface as well as the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; interface:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-7092 Financial Bonds Standard&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7092&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is ERC165 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; events&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST be emitted when bond tokens are transferred, issued or redeemed, except during contract creation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the account that owns bonds&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the account that receives the bond&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; amount of bond tokens to be transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST be emitted when an account is approved or when the allowance is decreased&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; bond token&amp;#39;s owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the account to be allowed to spend bonds&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; amount of bond tokens allowed by _owner to be spent by `_spender`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *        Or amount of bond tokens to decrease allowance from `_spender`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Approval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST be emitted when multiple bond tokens are transferred, issued or redeemed, with the exception being during contract creation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of bondholders accounts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of accounts to transfer bonds to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of amounts of bond tokens to be transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    ** OPTIONAL - interfaces and other contracts MUST NOT expect this function to be present. MUST be emitted in `batchTransfer` and `batchTransferFrom` functions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransferBatch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST be emitted when multiple accounts are approved or when the allowance is decreased from multiple accounts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; bondholder account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of accounts to be allowed to spend bonds, or to decrase the allowance from&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of amounts of bond tokens allowed by `_owner` to be spent by multiple accounts in `_spender`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    ** OPTIONAL - interfaces and other contracts MUST NOT expect this function to be present. MUST be emitted in `batchApprove` and `batchDecreaseAllowance` functions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ApprovalBatch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; getter functions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *  &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the bond isin&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isin&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the bond name&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the bond symbol&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *         It is RECOMMENDED to represent the symbol as a combination of the issuer Issuer&amp;#39;shorter name and the maturity date&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *         Ex: If a company named Green Energy issues bonds that will mature on october 25, 2030, the bond symbol could be `GE30` or `GE2030` or `GE102530`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; symbol&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the bond currency. This is the contract address of the token used to pay and return the bond principal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; currency&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the bond denominiation. This is the minimum amount in which the Bonds may be issued. It must be expressend in unit of the principal currency&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *         ex: If the denomination is equal to 1,000 and the currency is USDC, then the bond denomination is equal to 1,000 USDC&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; denomination&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the issue volume (total debt amount). It is RECOMMENDED to express the issue volume in denomination unit.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; issueVolume&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the bond interest rate. It is RECOMMENDED to express the interest rate in basis point unit.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *         1 basis point = 0.01% = 0.0001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *         ex: if interest rate = 5%, then coupon() =&amp;gt; 500 basis points&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; couponRate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the date when bonds were issued to investors. This is a Unix Timestamp like the one returned by block.timestamp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; issueDate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the bond maturity date, i.e, the date when the principal is repaid. This is a Unix Timestamp like the one returned by block.timestamp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *         The maturity date MUST be greater than the issue date&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; maturityDate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the principal of an account. It is RECOMMENDED to express the principal in the bond currency unit (USDC, DAI, etc...)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; account address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; principalOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the amount of tokens the `_spender` account has been authorized by the `_owner``&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *         account to manage their bonds&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the bondholder address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the address that has been authorized by the bondholder&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; allowance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; setter functions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Authorizes `_spender` account to manage `_amount`of their bond tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the address to be authorized by the bondholder&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; amount of bond tokens to approve&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Lowers the allowance of `_spender` by `_amount`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the address to be authorized by the bondholder&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; amount of bond tokens to remove from allowance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; decreaseAllowance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Moves `_amount` bonds to address `_to`. This methods also allows to attach data to the token that is being transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the address to send the bonds to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; amount of bond tokens to transfer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; additional information provided by the token holder&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Moves `_amount` bonds from an account that has authorized the caller through the approve function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *         This methods also allows to attach data to the token that is being transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the bondholder address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the address to transfer bonds to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; amount of bond tokens to transfer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; additional information provided by the token holder&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; batch functions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Authorizes multiple spender accounts to manage a specified `_amount` of the bondholder tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of accounts to be authorized by the bondholder&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of amounts of bond tokens to approve&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * OPTIONAL - interfaces and other contracts MUST NOT expect these values to be present. The method is used to improve usability.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; batchApprove&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Decreases the allowance of multiple spenders by corresponding amounts in `_amount`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of accounts to be authorized by the bondholder&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of amounts of bond tokens to decrease the allowance from&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * OPTIONAL - interfaces and other contracts MUST NOT expect this function to be present. The method is used to decrease token allowance.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; batchDecreaseAllowance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfers multiple bonds with amounts specified in the array `_amount` to the corresponding accounts in the array `_to`, with the option to attach additional data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of accounts to send the bonds to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of amounts of bond tokens to transfer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of additional information provided by the token holder&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * OPTIONAL - interfaces and other contracts MUST NOT expect this function to be present.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; batchTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfers multiple bonds with amounts specified in the array `_amount` to the corresponding accounts in the array `_to` from an account that have been authorized by the `_from` account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *         This method also allows to attach data to tokens that are being transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of bondholder accounts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of accounts to transfer bond tokens to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of amounts of bond tokens to transfer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of additional information provided by the token holder&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    ** OPTIONAL - interfaces and other contracts MUST NOT expect this function to be present.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; batchTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;additional-bond-parameters-interface&quot;&gt;Additional bond parameters Interface&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;IERC7092ESG&lt;&#x2F;code&gt; interface is OPTIONAL for contracts implementing this proposal. This interface MAY be used to improve the standard usability.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;currencyOfCoupon&lt;&#x2F;code&gt; The currency used for coupon payment may be different from the currency used to repay the principal&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;couponType&lt;&#x2F;code&gt; MAY be employed to signify the interest rate that the issuer has committed to paying to investors, which may take various forms such as zero coupon, fixed rate, floating rate, and more.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;couponFrequency&lt;&#x2F;code&gt; refers to how often the bond pays interest to its bondholders, and is typically expressed in terms of time periods, such as: Annual, Semi-Annual, Quarterly, or Monthly.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;dayCountBasis&lt;&#x2F;code&gt; is used to calculate the accrued interest on a bond between two coupon payment dates or other specific periods. Some of the day count basis are: Actual&#x2F;Actual, 30&#x2F;360, Actual&#x2F;360, Actual&#x2F;365, or 30&#x2F;365&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7092ESG&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is ERC165 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the number of decimals used by the bond. For example, if it returns `10`, it means that the token amount MUST be multiplied by 10000000000 to get the standard representation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; decimals&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Rreturns the coupon currency, which is represented by the contract address of the token used to pay coupons. It can be the same as the one used for the principal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; currencyOfCoupon&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the coupon type&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *         For example, 0 can denote Zero coupon, 1 can denote Fixed Rate, 2 can denote Floating Rate, and so on&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; couponType&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the coupon frequency, i.e. the number of times coupons are paid in a year.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; couponFrequency&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the day count basis&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *         For example, 0 can denote actual&#x2F;actual, 1 can denote actual&#x2F;360, and so on&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; dayCountBasis&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;cross-chain-interface&quot;&gt;Cross-chain Interface&lt;&#x2F;h3&gt;
&lt;p&gt;The standard permits the implementation of the &lt;code&gt;IERC7092CrossChain&lt;&#x2F;code&gt; interface for cross-chain management of bond tokens. This interface is OPTIONAL and may be used by applications to allow cross-chain transactions. Any function initiating a cross-chain transaction MUST explicitly define the destination chain identifier &lt;code&gt;destinationChainID&lt;&#x2F;code&gt; and specify the target smart contract &lt;code&gt;destinationContract&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7092CrossChain&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is ERC165 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; events&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST be emitted when bond tokens are transferred or redeemed in a cross-chain transaction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; bondholder account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; account the transfer bond tokens to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; amount of bond tokens to be transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _destinationChainID&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The unique ID that identifies the destination Chain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CrossChainTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _destinationChainID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST be emitted when several bond tokens are transferred or redeemed in a cross-chain transaction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of bondholders accounts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of accounts that receive the bond&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of amount of bond tokens to be transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _destinationChainID&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of unique IDs that identify the destination Chain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CrossChainTransferBatch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _destinationChainID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST be emitted when an account is approved to spend the bondholder&amp;#39;s tokens in a different chain than the current chain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the bondholder account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the account to be allowed to spend bonds&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; amount of bond tokens allowed by `_owner` to be spent by `_spender`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _destinationChainID&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The unique ID that identifies the destination Chain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CrossChainApproval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _destinationChainID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST be emitted when multiple accounts in the array `_spender` are approved or when the allowances of multiple accounts in the array `_spender` are reduced on the destination chain which MUST be different than the current chain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; bond token&amp;#39;s owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of accounts to be allowed to spend bonds&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of amount of bond tokens allowed by _owner to be spent by _spender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _destinationChainID&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of unique IDs that identify the destination Chain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CrossChainApprovalBatch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _destinationChainID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; functions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Authorizes the `_spender` account to manage a specified `_amount`of the bondholder bond tokens on the destination Chain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; account to be authorized by the bondholder&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; amount of bond tokens to approve&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _destinationChainID&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The unique ID that identifies the destination Chain.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _destinationContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The smart contract to interact with in the destination Chain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; crossChainApprove&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _destinationChainID&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _destinationContract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Authorizes multiple spender accounts in `_spender` to manage specified amounts in `_amount` of the bondholder tokens on the destination chain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of accounts to be authorized by the bondholder&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of amounts of bond tokens to approve&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _destinationChainID&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of unique IDs that identifies the destination Chain.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _destinationContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of smart contracts to interact with in the destination Chain in order to Deposit or Mint tokens that are transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; crossChainBatchApprove&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _destinationChainID&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _destinationContract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Decreases the allowance of `_spender` by a specified `_amount` on the destination Chain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the address to be authorized by the bondholder&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; amount of bond tokens to remove from allowance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _destinationChainID&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The unique ID that identifies the destination Chain.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _destinationContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The smart contract to interact with in the destination Chain in order to Deposit or Mint tokens that are transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; crossChainDecreaseAllowance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _destinationChainID&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _destinationContract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Decreases the allowance of multiple spenders in `_spender` by corresponding amounts specified in the array `_amount` on the destination chain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of accounts to be authorized by the bondholder&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of amounts of bond tokens to decrease the allowance from&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _destinationChainID&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of unique IDs that identifies the destination Chain.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _destinationContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of smart contracts to interact with in the destination Chain in order to Deposit or Mint tokens that are transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; crossChainBatchDecreaseAllowance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _destinationChainID&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _destinationContract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Moves `_amount` bond tokens to the address `_to` from the current chain to another chain (e.g., moving tokens from Ethereum to Polygon).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *         This methods also allows to attach data to the token that is being transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; account to send bond tokens to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; amount of bond tokens to transfer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; additional information provided by the bondholder&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _destinationChainID&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The unique ID that identifies the destination Chain.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _destinationContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The smart contract to interact with in the destination Chain in order to Deposit or Mint bond tokens that are transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; crossChainTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _destinationChainID&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _destinationContract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfers multiple bond tokens with amounts specified in the array `_amount` to the corresponding accounts in the array `_to` from the current chain to another chain (e.g., moving tokens from Ethereum to Polygon).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *         This methods also allows to attach data to the token that is being transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of accounts to send the bonds to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of amounts of bond tokens to transfer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of additional information provided by the bondholder&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _destinationChainID&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of unique IDs that identify the destination Chains.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _destinationContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of smart contracts to interact with in the destination Chains in order to Deposit or Mint bond tokens that are transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; crossChainBatchTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _destinationChainID&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _destinationContract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfers `_amount` bond tokens from the `_from`account to the `_to` account from the current chain to another chain. The caller must be approved by the `_from` address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *         This methods also allows to attach data to the token that is being transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the bondholder address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the account to transfer bonds to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; amount of bond tokens to transfer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; additional information provided by the token holder&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _destinationChainID&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The unique ID that identifies the destination Chain.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _destinationContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The smart contract to interact with in the destination Chain in order to Deposit or Mint tokens that are transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; crossChainTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _destinationChainID&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _destinationContract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfers several bond tokens with amounts specified in the array `_amount` from accounts in the array `_from` to accounts in the array `_to` from the current chain to another chain.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *         The caller must be approved by the `_from` accounts to spend the corresponding amounts specified in the array `_amount`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *         This methods also allows to attach data to the token that is being transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of bondholder addresses&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of accounts to transfer bonds to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of amounts of bond tokens to transfer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of additional information provided by the token holder&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _destinationChainID&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of unique IDs that identifies the destination Chain.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _destinationContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of smart contracts to interact with in the destination Chain in order to Deposit or Mint tokens that are transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; crossChainBatchTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _destinationChainID&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _destinationContract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The design of this ERC aims to simplify the migration to tokenized bonds by maintaining consistency with traditional bond standards. This approach allows fixed-income instruments to be represented as on-chain tokens, manageable through wallets, and utilized by applications like decentralized exchanges, while avoiding the complexities and inefficiencies associated with other standards. This ERC facilitates the creation of new bond tokens with characteristics akin to traditional bonds, enhancing accessibility, liquidity, and cost-efficiency in bond trading and management.&lt;&#x2F;p&gt;
&lt;p&gt;The use of traditional finance terminology, like &lt;code&gt;issueVolume&lt;&#x2F;code&gt; and &lt;code&gt;principalOf&lt;&#x2F;code&gt;, is aimed at maintaining consistency with traditional bond language, which eases the adaptation for traditional entities.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;total-supply-and-account-balance&quot;&gt;Total Supply and Account Balance&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;totalSupply&lt;&#x2F;code&gt; and &lt;code&gt;balanceOf&lt;&#x2F;code&gt; functions are not defined as they can be derived from &lt;code&gt;issueVolume&lt;&#x2F;code&gt; and &lt;code&gt;principalOf&lt;&#x2F;code&gt;, and &lt;code&gt;denomination&lt;&#x2F;code&gt;. However, these functions can be be added in any contract implementing this standard, ensuring the proper relationship between these values.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; issueVolume&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; denomination&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balance0f&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; principal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; denomination&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC is not backwards compatible with existing standards like &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; due to the absence of certain functions like &lt;code&gt;totalSupply&lt;&#x2F;code&gt; or &lt;code&gt;balanceOf&lt;&#x2F;code&gt;. A pure implementation of this standard is RECOMMENDED for issuing tokenized bonds, as any hybrid solution with other mentioned standards SHOULD fail.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The complete Reference Implementation can be found &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7092&#x2F;.&#x2F;assets&#x2F;ERC7092.sol&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Bonds with embedded options like callable, puttable, or convertible bonds can be created by inheriting from the reference &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7092&#x2F;.&#x2F;assets&#x2F;ERC7092.sol&quot;&gt;&lt;code&gt;ERC7092.sol&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; that integrates the proposed interface.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;callable-bonds&quot;&gt;CALLABLE BONDS:&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;#39;ERC7092.sol&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC7092Callable&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC7092&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; WRITE THE LOGIC TO ALLOW THE ISSUER TO CALL BONDS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; STATE VARIABLES AND FUNCTIONS NEEDED&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; call bonds owned by `_investor`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *         MUST be called by the issuer only&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _investor&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; _issuer&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;bondISIN&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;issuerAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC7092Callable: ONLY_ISSUER&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_principals&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_investor&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC7092Callable: NO_BONDS&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; _bond&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;bondISIN&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;maturityDate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC7092Callable: BOND_MATURED&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; principal &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;  _principals&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_investor&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _principals&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_investor&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ADD LOGIC HERE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;puttable-bonds&quot;&gt;PUTTABLE BONDS:&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;#39;ERC7092.sol&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC7092Puttable&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC7092&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; WRITE THE LOGIC TO ALLOW INVESTORS TO PUT BONDS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; STATE VARIABLES AND FUNCTIONS NEEDED&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; put bonds&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *         MUST be called by investors who own bonds&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; put&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_principals&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC7092Puttable: ONLY_INVESTORS&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; _bond&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;bondISIN&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;maturityDate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC7092Puttable: BOND_MATURED&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; principal &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;  _principals&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _principals&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ADD LOGIC&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;convertible-bonds&quot;&gt;CONVERTIBLE BONDS:&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;#39;ERC7092.sol&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC7092Convertible&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC7092&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; WRITE THE LOGIC TO ALLOW INVESTOR OR ISSUER TO CONVERT BONDS TO EQUITY&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; STATE VARIABLES AND FUNCTIONS NEEDED&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; convert bonds to equity. Here we assumed that the investors must convert their bonds to equity&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *         Issuer can also convert invetsors bonds to equity.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; convert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_principals&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC7092Convertible: ONLY_INVESTORS&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; _bond&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;bondISIN&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;maturityDate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC7092Convertible: BOND_MATURED&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; principal &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;  _principals&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _principals&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ADD LOGIC HERE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;identity-registry&quot;&gt;Identity Registry&lt;&#x2F;h3&gt;
&lt;p&gt;This standard is designed specifically for tokenizing bonds. It does not inherently manage information pertaining to bondholders&#x27; identities. However, to enhance compliance with regulatory requirements and improve transparency, an identity registry can be added  on top of this standard to store the identity of all authorized investors.&lt;&#x2F;p&gt;
&lt;p&gt;By maintaining an identity registry, issuers can ensure that bond tokens issued under the &lt;code&gt;ERC7092&lt;&#x2F;code&gt; standard are transferred only to registered and authorized entities. This practice aligns with regulatory compliance measures and provides a structured way to manage and verify the identity of bondholders. It also helps prevent unauthorized or non-compliant transfers of bond tokens.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Implementing this ERC requires careful consideration of security risks related to functions approving operators to manage owner&#x27;s bonds and functions allowing bond transfers. The use of these functions necessitates robust validation to ensure only the bond owner or approved accounts can call them.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>ERC-1155 Supply Extension</title>
        <published>2023-05-25T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Gavin John</name><uri>https://github.com/Pandapip1</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5615/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5615-eip-1155-supply-extension/10732" />
        

        <id>https://wg-eips.ritovision.com/5615/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:5615"
            label="ERC-5615" />
        

        
        

        
        <summary type="html">A simple mechanism to fetch token supply data from ERC-1155 tokens</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5615/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC standardizes an existing mechanism to fetch token supply data from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; tokens. It adds a &lt;code&gt;totalSupply&lt;&#x2F;code&gt; function, which fetches the number of tokens with a given &lt;code&gt;id&lt;&#x2F;code&gt;, and an &lt;code&gt;exists&lt;&#x2F;code&gt; function, which checks for the existence of a given &lt;code&gt;id&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC1155Supply&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC1155&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @notice      This function MUST return whether the given token id exists, previously existed, or may exist&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @param   id  The token id of which to check the existence&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @return      Whether the given token id exists, previously existed, or may exist&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; exists&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @notice      This function MUST return the number of tokens with a given id. If the token id does not exist, it MUST return 0.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @param   id  The token id of which fetch the total supply&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @return      The total supply of the given token id&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Implementations MAY support &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; interface discovery, but consumers MUST NOT rely on it.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC does not implement &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt;, as this interface is simple enough that the extra complexity is unnecessary and would cause incompatibilities with pre-existing implementations.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;totalSupply&lt;&#x2F;code&gt; and &lt;code&gt;exists&lt;&#x2F;code&gt; functions were modeled after &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;totalSupply&lt;&#x2F;code&gt; does not revert if the token ID does not exist, since contracts that care about that case should use &lt;code&gt;exists&lt;&#x2F;code&gt; instead (which might return false even if &lt;code&gt;totalSupply&lt;&#x2F;code&gt; is zero).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;exists&lt;&#x2F;code&gt; is included to differentiate between the two ways that &lt;code&gt;totalSupply&lt;&#x2F;code&gt; could equal zero (either no tokens with the given ID have been minted yet, or no tokens with the given ID will ever be minted).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC is designed to be backward compatible with the OpenZeppelin &lt;code&gt;ERC1155Supply&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;None.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Lockable Extension for ERC-721</title>
        <published>2023-05-25T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Piyush Chittara</name><uri>https://github.com/piyush-chittara</uri>
	</author>
	
	<author>
		<name>StreamNFT</name><uri>https://github.com/streamnft-tech</uri>
	</author>
	
	<author>
		<name>Srinivas Joshi</name><uri>https://github.com/SrinivasJoshi</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7066/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7066-lockable-extension-for-erc721/14425" />
        

        <id>https://wg-eips.ritovision.com/7066/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7066"
            label="ERC-7066" />
        

        
        

        
        <summary type="html">Interface for enabling locking of ERC-721 using locker and approved</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7066/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;An extension of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;, this standard incorporates &lt;code&gt;locking&lt;&#x2F;code&gt; features into NFTs, allowing for various uses while preventing sale or transfer. The token&#x27;s &lt;code&gt;owner&lt;&#x2F;code&gt; can &lt;code&gt;lock&lt;&#x2F;code&gt; it, setting up locker address (either an EOA or a contract) that exclusively holds the power to unlock the token. Owner can also provide approval for &lt;code&gt;tokenId&lt;&#x2F;code&gt;, enabling ability to lock asset while address holds the token approval. Token can also be locked by &lt;code&gt;approved&lt;&#x2F;code&gt;, assigning locker to itself. Upon token transfer, these rights get purged.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; has sparked an unprecedented surge in demand for NFTs. However, despite this tremendous success, the NFT economy suffers from secondary liquidity where it remains illiquid in owner’s wallet. There are projects which aim to address the liquidity challenge, but they entail the below mentioned inconveniences and risks for owners as they necessitate transferring the participating NFTs to the projects&#x27; contracts.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Loss of utility: The utility value of NFTs diminishes when they are transferred to an escrow account, no longer remaining under the direct custody of the owners.&lt;&#x2F;li&gt;
&lt;li&gt;Lack of composability: The market could benefit from increased liquidity if NFT owners had access to multiple financial tools, such as leveraging loans and renting out their assets for maximum returns. Composability serves as the missing piece in creating a more efficient market.&lt;&#x2F;li&gt;
&lt;li&gt;Smart contract vulnerabilities: NFTs are susceptible to loss or theft due to potential bugs or vulnerabilities present in the smart contracts they rely on.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The aforementioned issues contribute to a poor user experience (UX), and we propose enhancing the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; standard by implementing a native locking mechanism:
Rather than being transferred to a smart contract, an NFT remains securely stored in self-custody but is locked.
During the lock period, the NFT&#x27;s transfer is restricted while its other properties remain unchanged.
NFT Owner retains the ability to use or distribute it’s utility.&lt;&#x2F;p&gt;
&lt;p&gt;NFTs have numerous use cases where the NFT must remain within the owner&#x27;s wallet, even when it serves as collateral for a loan. Whether it&#x27;s authorizing access to a Discord server, or utilizing NFT within a play-to-earn (P2E) game, owner should have the freedom to do so throughout the lending period. Just as real estate owner can continue living in their mortgaged house, take personal loan or keep tenants to generate passive income, these functionalities should be available to NFT owners to bring more investors in NFT economy.&lt;&#x2F;p&gt;
&lt;p&gt;Lockable NFTs enable the following use cases :&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;NFT-collateralized loans: Utilize NFT as collateral for a loan without locking it on the lending protocol contract. Instead, lock it within owner’s wallet while still enjoying all the utility of NFT.&lt;&#x2F;li&gt;
&lt;li&gt;No collateral rentals of NFTs: Borrow an NFT for a fee without the need for significant collateral. Renter can use the NFT but not transfer it, ensuring the lender&#x27;s safety. The borrowing service contract automatically returns the NFT to the lender once the borrowing period expires.&lt;&#x2F;li&gt;
&lt;li&gt;Buy Now Pay Later (BNPL): The buyer receives the locked NFT and can immediately begin using it. However, they are unable to sell the NFT until all installments are paid. Failure to complete the full payment results in the NFT returning to the seller, along with a fee.&lt;&#x2F;li&gt;
&lt;li&gt;Composability: Maximize liquidity by having access to multiple financial tools. Imagine taking a loan against NFT and putting it on rentals to generate passive income.&lt;&#x2F;li&gt;
&lt;li&gt;Primary sales: Mint an NFT for a partial payment and settle the remaining amount once owner is satisfied with the collection&#x27;s progress.&lt;&#x2F;li&gt;
&lt;li&gt;Soulbound: Organization can mint and self-assign &lt;code&gt;locker&lt;&#x2F;code&gt;, send token to user and lock the asset.&lt;&#x2F;li&gt;
&lt;li&gt;Safety: Safely and conveniently use exclusive blue chip NFTs. Lockable extension allows owner to lock NFT and designate secure cold wallet as the unlocker. This way, owner can keep NFT on MetaMask and easily use it, even if a hacker gains access to MetaMask account. Without access to the cold wallet, the hacker cannot transfer NFT, ensuring its safety.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This proposal is different from other locking proposals in number of ways:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;This implementation provides a minimal implementation of &lt;code&gt;lock&lt;&#x2F;code&gt; and &lt;code&gt;unlock&lt;&#x2F;code&gt; and believes other conditions like time-bound are great ideas but can be achieved without creating a specific implementation. Locking and Unlocking can be based on any conditions (e.g. repayment, expiry). Therefore time-bound unlocks a relatively specific use case that can be achieved via smart-contracts themselves without that being a part of the token contract.&lt;&#x2F;li&gt;
&lt;li&gt;This implementation proposes a separation of rights between locker and approver. Token can be locked with approval and approved can unlock and withdraw tokens (opening up opportunities like renting, lending, BNPL etc), and token can be locked lacking the rights to revoke token, yet can unlock if required (opening up opportunities like account-bound NFTs).&lt;&#x2F;li&gt;
&lt;li&gt;Our proposal implement ability to &lt;code&gt;transferAndLock&lt;&#x2F;code&gt; which can be used to transfer, lock and optionally approve token. Enabling the possibility of revocation after transfer.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;By extending the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; standard, the proposed standard enables secure and convenient management of underlying NFT assets. It natively supports prevalent NFTFi use cases such as staking, lending, and renting. We anticipate that this proposed standard will foster increased engagement of NFT owners in NFTFi projects, thereby enhancing the overall vitality of the NFT ecosystem.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;overview&quot;&gt;Overview&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; compliant contracts MAY implement this EIP to provide standard methods of locking and unlocking the token at its current owner address.&lt;&#x2F;p&gt;
&lt;p&gt;Token owner MAY &lt;code&gt;lock&lt;&#x2F;code&gt; the token and assign &lt;code&gt;locker&lt;&#x2F;code&gt; to some &lt;code&gt;address&lt;&#x2F;code&gt; using &lt;code&gt;lock(uint256 tokenId, address _locker)&lt;&#x2F;code&gt; function, this MUST set &lt;code&gt;locker&lt;&#x2F;code&gt; to &lt;code&gt;_locker&lt;&#x2F;code&gt;. Token owner or approved MAY &lt;code&gt;lock&lt;&#x2F;code&gt; the token using &lt;code&gt;lock(uint256 tokenId)&lt;&#x2F;code&gt; function, this MUST set &lt;code&gt;locker&lt;&#x2F;code&gt; to &lt;code&gt;msg.sender&lt;&#x2F;code&gt;. Token MAY be &lt;code&gt;unlocked&lt;&#x2F;code&gt; by &lt;code&gt;locker&lt;&#x2F;code&gt; using &lt;code&gt;unlock&lt;&#x2F;code&gt; function. &lt;code&gt;unlock&lt;&#x2F;code&gt; function MUST delete &lt;code&gt;locker&lt;&#x2F;code&gt; mapping and default to &lt;code&gt;address(0)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;If the token is &lt;code&gt;locked&lt;&#x2F;code&gt;, the &lt;code&gt;lockerOf&lt;&#x2F;code&gt; function MUST return an address that is &lt;code&gt;locker&lt;&#x2F;code&gt; and can &lt;code&gt;unlock&lt;&#x2F;code&gt; the token. For tokens that are not &lt;code&gt;locked&lt;&#x2F;code&gt;, the &lt;code&gt;lockerOf&lt;&#x2F;code&gt; function MUST return &lt;code&gt;address(0)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;lock&lt;&#x2F;code&gt; function MUST revert if token is already &lt;code&gt;locked&lt;&#x2F;code&gt;. &lt;code&gt;unlock&lt;&#x2F;code&gt; function MUST revert if token is not &lt;code&gt;locked&lt;&#x2F;code&gt;. ERC-721 &lt;code&gt;approve&lt;&#x2F;code&gt; function MUST revert if token is &lt;code&gt;locked&lt;&#x2F;code&gt;. ERC-721 functions that transfer ownership of a token MUST revert if token is &lt;code&gt;locked&lt;&#x2F;code&gt;, unless &lt;code&gt;msg.sender&lt;&#x2F;code&gt; is &lt;code&gt;approved&lt;&#x2F;code&gt; and &lt;code&gt;locker&lt;&#x2F;code&gt; both. After ERC-721 token transfer function call, values of &lt;code&gt;locker&lt;&#x2F;code&gt; and &lt;code&gt;approved&lt;&#x2F;code&gt; MUST be purged.&lt;&#x2F;p&gt;
&lt;p&gt;Token MAY be transferred and &lt;code&gt;locked&lt;&#x2F;code&gt;, also assign &lt;code&gt;approval&lt;&#x2F;code&gt; to &lt;code&gt;locker&lt;&#x2F;code&gt; using &lt;code&gt;transferAndLock&lt;&#x2F;code&gt; function. This is RECOMMENDED for use-cases where Token transfer and subsequent revocation is REQUIRED.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;interface&quot;&gt;Interface&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pragma solidity &amp;gt;=0.7.0 &amp;lt;0.9.0;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @title Lockable Extension for ERC721&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @dev Interface for the Lockable extension&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @author StreamNFT &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;interface IERC7066{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev Emitted when tokenId is locked&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    event Lock (uint256 indexed tokenId, address _locker);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev Emitted when tokenId is unlocked&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    event Unlock (uint256 indexed tokenId);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev Lock the tokenId if msg.sender is owner or approved and set locker to msg.sender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function lock(uint256 tokenId) external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev Lock the tokenId if msg.sender is owner and set locker to _locker&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function lock(uint256 tokenId, address _locker) external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev Unlocks the tokenId if msg.sender is locker&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function unlock(uint256 tokenId) external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev Tranfer and lock the token if the msg.sender is owner or approved. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *      Lock the token and set locker to caller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *      Optionally approve caller if bool setApprove flag is true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function transferAndLock(uint256 tokenId, address from, address to, bool setApprove) external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev Returns the wallet, that is stated as unlocking wallet for the tokenId.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *      If address(0) returned, that means token is not locked. Any other result means token is locked.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function lockerOf(uint256 tokenId) external view returns (address);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal set &lt;code&gt;locker[tokenId]&lt;&#x2F;code&gt; to &lt;code&gt;address(0)&lt;&#x2F;code&gt; when token is &lt;code&gt;unlocked&lt;&#x2F;code&gt; because we delete mapping on &lt;code&gt;locker[tokenId]&lt;&#x2F;code&gt; freeing up space. Also, this assertion helps our contract to validate if token is &lt;code&gt;locked&lt;&#x2F;code&gt; or &lt;code&gt;unlocked&lt;&#x2F;code&gt; for internal function calls.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal exposes &lt;code&gt;transferAndLock(uint256 tokenId, address from, address to, bool setApprove)&lt;&#x2F;code&gt; which can be used to transfer token and lock at the receiver&#x27;s address. This additionally accepts input &lt;code&gt;bool setApprove&lt;&#x2F;code&gt; which on &lt;code&gt;true&lt;&#x2F;code&gt; assign &lt;code&gt;approval&lt;&#x2F;code&gt; to &lt;code&gt;locker&lt;&#x2F;code&gt;, hence enabling &lt;code&gt;locker&lt;&#x2F;code&gt; to revoke the token (revocation conditions can be defined in contracts and &lt;code&gt;approval&lt;&#x2F;code&gt; provided to contract). This provides conditional ownership to receiver, without the privilege to &lt;code&gt;transfer&lt;&#x2F;code&gt; token.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; standards.&lt;&#x2F;p&gt;
&lt;p&gt;Existing Upgradedable &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; can upgrade to this standard, enabling locking capability inherently and unlock underlying liquidity features.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases can be found &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7066&#x2F;.&#x2F;assets&#x2F;test&#x2F;test.js&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Reference Interface can be found &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7066&#x2F;.&#x2F;assets&#x2F;IERC7066.sol&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Reference Implementation can be found &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7066&#x2F;.&#x2F;assets&#x2F;ERC7066.sol&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;There are no security considerations related directly to the implementation of this standard for the contract that manages &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;considerations-for-the-contracts-that-work-with-lockable-tokens&quot;&gt;Considerations for the contracts that work with lockable tokens&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Once &lt;code&gt;locked&lt;&#x2F;code&gt;, token can not be further &lt;code&gt;approved&lt;&#x2F;code&gt; or &lt;code&gt;transfered&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If token is &lt;code&gt;locked&lt;&#x2F;code&gt; and caller is &lt;code&gt;locker&lt;&#x2F;code&gt; and &lt;code&gt;approved&lt;&#x2F;code&gt; both, caller can transfer the token.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;locked&lt;&#x2F;code&gt; token with &lt;code&gt;locker&lt;&#x2F;code&gt; as in-accesible account or un-verified contract address can lead to permanent lock of the token.&lt;&#x2F;li&gt;
&lt;li&gt;There are no MEV considerations regarding lockable tokens as only authorized parties are allowed to lock and unlock.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Lockable Extension for ERC-1155</title>
        <published>2023-05-25T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Piyush Chittara</name><uri>https://github.com/piyush-chittara</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7721/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7721-lockable-extension-for-erc1155/20250" />
        

        <id>https://wg-eips.ritovision.com/7721/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:7721"
            label="ERC-7721" />
        

        
        

        
        <summary type="html">Interface for enabling locking of ERC-1155 using locker and token id based approvals</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7721/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The Lockable Extension for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; introduces a robust locking mechanism for specific Non-Fungible Tokens (NFTs) within the ERC-1155 token standard, allowing for various uses while preventing sale or transfer. The token&#x27;s &lt;code&gt;owner&lt;&#x2F;code&gt; can &lt;code&gt;lock&lt;&#x2F;code&gt; it, setting up locker address (either an EOA or a contract) that exclusively holds the power to unlock the token. Owner can also provide approval for &lt;code&gt;tokenId&lt;&#x2F;code&gt;, enabling ability to lock asset while address holds the token approval. Token can also be locked by &lt;code&gt;approved&lt;&#x2F;code&gt;, assigning locker to itself. Upon token transfer, these rights get purged.&lt;&#x2F;p&gt;
&lt;p&gt;Inspired by the need for enhanced security and control over tokenized assets, this extension enables token owners to lock individual NFTs with &lt;code&gt;tokenId&lt;&#x2F;code&gt;, ensuring that only approved users can withdraw predetermined amounts of locked tokens. Thus, offering a safer approach by allowing token owners to specify approved token IDs and amounts for withdrawal.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; has sparked an unprecedented surge in demand for NFTs. However, despite this tremendous success, the NFT economy suffers from secondary liquidity where it remains illiquid in owner’s wallet. There are projects which aim to address the liquidity challenge, but they entail the below mentioned inconveniences and risks for owners as they necessitate transferring the participating NFTs to the projects&#x27; contracts.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Loss of utility: The utility value of NFTs diminishes when they are transferred to an escrow account, no longer remaining under the direct custody of the owners.&lt;&#x2F;li&gt;
&lt;li&gt;Lack of composability: The market could benefit from increased liquidity if NFT owners had access to multiple financial tools, such as leveraging loans and renting out their assets for maximum returns. Composability serves as the missing piece in creating a more efficient market.&lt;&#x2F;li&gt;
&lt;li&gt;Smart contract vulnerabilities: NFTs are susceptible to loss or theft due to potential bugs or vulnerabilities present in the smart contracts they rely on.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The aforementioned issues contribute to a poor user experience (UX), and we propose enhancing the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; standard by implementing a native locking mechanism:
Rather than being transferred to a smart contract, an NFT remains securely stored in self-custody but is locked.
During the lock period, the NFT&#x27;s transfer is restricted while its other properties remain unchanged.
NFT Owner retains the ability to use or distribute it’s utility.&lt;&#x2F;p&gt;
&lt;p&gt;NFTs have numerous use cases where the NFT must remain within the owner&#x27;s wallet, even when it serves as collateral for a loan. Whether it&#x27;s authorizing access to a Discord server, or utilizing NFT within a play-to-earn (P2E) game, owner should have the freedom to do so throughout the lending period. Just as real estate owner can continue living in their mortgaged house, take personal loan or keep tenants to generate passive income, these functionalities should be available to NFT owners to bring more investors in NFT economy.&lt;&#x2F;p&gt;
&lt;p&gt;Lockable NFTs enable the following use cases :&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;NFT-collateralized loans: Utilize NFT as collateral for a loan without locking it on the lending protocol contract. Instead, lock it within owner’s wallet while still enjoying all the utility of NFT.&lt;&#x2F;li&gt;
&lt;li&gt;No collateral rentals of NFTs: Borrow an NFT for a fee without the need for significant collateral. Renter can use the NFT but not transfer it, ensuring the lender&#x27;s safety. The borrowing service contract automatically returns the NFT to the lender once the borrowing period expires.&lt;&#x2F;li&gt;
&lt;li&gt;Buy Now Pay Later (BNPL): The buyer receives the locked NFT and can immediately begin using it. However, they are unable to sell the NFT until all installments are paid. Failure to complete the full payment results in the NFT returning to the seller, along with a fee.&lt;&#x2F;li&gt;
&lt;li&gt;Composability: Maximize liquidity by having access to multiple financial tools. Imagine taking a loan against NFT and putting it on rentals to generate passive income.&lt;&#x2F;li&gt;
&lt;li&gt;Primary sales: Mint an NFT for a partial payment and settle the remaining amount once owner is satisfied with the collection&#x27;s progress.&lt;&#x2F;li&gt;
&lt;li&gt;Soulbound: Organization can mint and self-assign &lt;code&gt;locker&lt;&#x2F;code&gt;, send token to user and lock the asset.&lt;&#x2F;li&gt;
&lt;li&gt;Safety: Safely and conveniently use exclusive blue chip NFTs. Lockable extension allows owner to lock NFT and designate secure cold wallet as the unlocker. This way, owner can keep NFT on MetaMask and easily use it, even if a hacker gains access to MetaMask account. Without access to the cold wallet, the hacker cannot transfer NFT, ensuring its safety.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This proposal is different from other locking proposals in number of ways:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;This implementation provides a minimal implementation of &lt;code&gt;lock&lt;&#x2F;code&gt; and &lt;code&gt;unlock&lt;&#x2F;code&gt; and believes other conditions like time-bound are great ideas but can be achieved without creating a specific implementation. Locking and Unlocking can be based on any conditions (e.g. repayment, expiry). Therefore time-bound unlocks a relatively specific use case that can be achieved via smart-contracts themselves without that being a part of the token contract.&lt;&#x2F;li&gt;
&lt;li&gt;This implementation proposes a separation of rights between locker and approver. Token can be locked with approval and approved can unlock and withdraw tokens (opening up opportunities like renting, lending, BNPL etc), and token can be locked lacking the rights to revoke token, yet can unlock if required (opening up opportunities like account-bound NFTs).&lt;&#x2F;li&gt;
&lt;li&gt;Our proposal implement ability to &lt;code&gt;transferAndLock&lt;&#x2F;code&gt; which can be used to transfer, lock and optionally approve token. Enabling the possibility of revocation after transfer.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;By extending the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; standard, the proposed standard enables secure and convenient management of underlying NFT assets. It natively supports prevalent NFTFi use cases such as staking, lending, and renting. We anticipate that this proposed standard will foster increased engagement of NFT owners in NFTFi projects, thereby enhancing the overall vitality of the NFT ecosystem.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;overview&quot;&gt;Overview&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; compliant contracts MAY implement this EIP to provide standard methods of locking and unlocking the token at its current owner address.&lt;&#x2F;p&gt;
&lt;p&gt;Token owner MAY &lt;code&gt;lock&lt;&#x2F;code&gt; the token and assign &lt;code&gt;locker&lt;&#x2F;code&gt; to some &lt;code&gt;address&lt;&#x2F;code&gt; using &lt;code&gt;lock(uint256 tokenId, address account, address _locker, uint256 amount)&lt;&#x2F;code&gt; function, this MUST set &lt;code&gt;locker&lt;&#x2F;code&gt; to &lt;code&gt;_locker&lt;&#x2F;code&gt;. Token owner or approved MAY &lt;code&gt;lock&lt;&#x2F;code&gt; the token using &lt;code&gt;lock(uint256 tokenId, address account, uint256 amount&lt;&#x2F;code&gt; function, this MUST set &lt;code&gt;locker&lt;&#x2F;code&gt; to &lt;code&gt;msg.sender&lt;&#x2F;code&gt;. Token MAY be &lt;code&gt;unlocked&lt;&#x2F;code&gt; by &lt;code&gt;locker&lt;&#x2F;code&gt; using &lt;code&gt;unlock(uint256 tokenId, address account, uint256 amount)&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;p&gt;Token owner MAY &lt;code&gt;approve&lt;&#x2F;code&gt; specific for specific &lt;code&gt;tokenId&lt;&#x2F;code&gt; using &lt;code&gt;setApprovalForId(uint256 tokenId, address operator, uint256 amount)&lt;&#x2F;code&gt; ensuring only approved tokenId could be spent by operator. &lt;code&gt;getApprovalForId(uint256 tokenId, address account, address operator)&lt;&#x2F;code&gt; SHALL return &lt;code&gt;amount&lt;&#x2F;code&gt; approved on &lt;code&gt;account&lt;&#x2F;code&gt; by &lt;code&gt;operator&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;If the token is &lt;code&gt;locked&lt;&#x2F;code&gt;, the &lt;code&gt;getLocked(uint256 tokenId, address account, address operator)&lt;&#x2F;code&gt; function MUST return an amount that is &lt;code&gt;locked&lt;&#x2F;code&gt; by &lt;code&gt;operator&lt;&#x2F;code&gt; on &lt;code&gt;account&lt;&#x2F;code&gt;. For tokens that are not &lt;code&gt;locked&lt;&#x2F;code&gt;, the &lt;code&gt;getLocked(uint256 tokenId, address account, address operator)&lt;&#x2F;code&gt; function MUST return &lt;code&gt;0&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;lock&lt;&#x2F;code&gt; function MUST revert if &lt;code&gt;account&lt;&#x2F;code&gt; has insufficient balance or not &lt;code&gt;owner&lt;&#x2F;code&gt; or &lt;code&gt;approved&lt;&#x2F;code&gt; of &lt;code&gt;tokenId&lt;&#x2F;code&gt;. &lt;code&gt;unlock&lt;&#x2F;code&gt; function MUST revert if provided &lt;code&gt;amount&lt;&#x2F;code&gt; of &lt;code&gt;tokenId&lt;&#x2F;code&gt; is not &lt;code&gt;locked&lt;&#x2F;code&gt;. ERC-1155 &lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt; of a token MUST revert if &lt;code&gt;account&lt;&#x2F;code&gt; transfer &lt;code&gt;locked&lt;&#x2F;code&gt; amount, maximum transferable amount MUST be &lt;code&gt;balance - getLocked&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Token MAY be transferred and &lt;code&gt;locked&lt;&#x2F;code&gt;, also assign &lt;code&gt;approval&lt;&#x2F;code&gt; to &lt;code&gt;locker&lt;&#x2F;code&gt; using &lt;code&gt;transferAndLock&lt;&#x2F;code&gt; function. This is RECOMMENDED for use-cases where Token transfer and subsequent revocation is REQUIRED.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;interface&quot;&gt;Interface&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pragma solidity &amp;gt;=0.7.0 &amp;lt;0.9.0;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @title Lockable Extension for ERC1155&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @dev Interface for the Lockable extension&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @author piyush-chittara &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;interface IERCLockable1155 is IERC1155{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev Emitted when tokenId is locked&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    event Lock(uint256 indexed tokenId, address account, address _locker, uint256 amount);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev Emitted when tokenId is unlocked&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    event Unlock (uint256 indexed tokenId, address account, address _locker, uint256 amount);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev Lock the tokenId if msg.sender is owner or approved and set locker to msg.sender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function lock(uint256 tokenId, address account, uint256 amount) external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev Lock the tokenId if msg.sender is owner and set locker to _locker&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function lock(uint256 tokenId, address account, address _locker, uint256 amount) external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev Unlocks the tokenId if msg.sender is locker&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function unlock(uint256 tokenId, address account, uint256 amount) external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev Tranfer and lock the token if the msg.sender is owner or approved. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *      Lock the token and set locker to caller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *      Optionally approve caller if bool setApprove flag is true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function transferAndLock(address from, address to, uint256 tokenId, uint256 amount, bool setApprove) external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev Returns the wallet, that is stated as unlocking wallet for the tokenId.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *      If (0) returned, that means token is not locked. Any other result means token is locked.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function getLocked(uint256 tokenId, address account, address operator) external view returns (uint256);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function setApprovalForId(uint256 tokenId, address operator, uint256 amount) external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal exposes &lt;code&gt;transferAndLock(address from, address to, uint256 tokenId, uint256 amount, bool setApprove)&lt;&#x2F;code&gt; which can be used to transfer token and lock at the receiver&#x27;s address. This additionally accepts input &lt;code&gt;bool setApprove&lt;&#x2F;code&gt; which on &lt;code&gt;true&lt;&#x2F;code&gt; assign &lt;code&gt;approval&lt;&#x2F;code&gt; to &lt;code&gt;locker&lt;&#x2F;code&gt;, hence enabling &lt;code&gt;locker&lt;&#x2F;code&gt; to revoke the token (revocation conditions can be defined in contracts and &lt;code&gt;approval&lt;&#x2F;code&gt; provided to contract). This provides conditional ownership to receiver, without the privilege to &lt;code&gt;transfer&lt;&#x2F;code&gt; token.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; standards.&lt;&#x2F;p&gt;
&lt;p&gt;Existing Upgradeable &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; can upgrade to this standard, enabling locking capability inherently and unlock underlying liquidity features.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Reference Interface can be found &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7721&#x2F;.&#x2F;assets&#x2F;IERC7721.sol&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Reference Implementation can be found &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7721&#x2F;.&#x2F;assets&#x2F;ERC7721.sol&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;There are no security considerations related directly to the implementation of this standard for the contract that manages &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;considerations-for-the-contracts-that-work-with-lockable-tokens&quot;&gt;Considerations for the contracts that work with lockable tokens&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Once a certain &lt;code&gt;amount&lt;&#x2F;code&gt; is &lt;code&gt;locked&lt;&#x2F;code&gt;, specified &lt;code&gt;amount&lt;&#x2F;code&gt; can not be transferred from locked &lt;code&gt;account&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If token is &lt;code&gt;locked&lt;&#x2F;code&gt; and caller is &lt;code&gt;locker&lt;&#x2F;code&gt; and &lt;code&gt;approved&lt;&#x2F;code&gt; both, caller can transfer the token.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;locked&lt;&#x2F;code&gt; token with &lt;code&gt;locker&lt;&#x2F;code&gt; as in-accesible account or un-verified contract address can lead to permanent lock of the token.&lt;&#x2F;li&gt;
&lt;li&gt;There are no MEV considerations regarding lockable tokens as only authorized parties are allowed to lock and unlock.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Interoperable Digital Media Indexing</title>
        <published>2023-05-22T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Bofu Chen</name><uri>https://github.com/bafu</uri>
	</author>
	
	<author>
		<name>Tammy Yang</name><uri>https://github.com/tammyyang</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7053/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7053-interoperable-digital-media-indexing/14394" />
        

        <id>https://wg-eips.ritovision.com/7053/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:7053"
            label="ERC-7053" />
        

        
        

        
        <summary type="html">A universal indexing method to record, discover and retrieve the history of digital media on EVM-compatible blockchains.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7053/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes an interoperable indexing strategy designed to enhance the organization and retrieval of digital media information across multiple smart contracts and EVM-compatible blockchains. This system enhances the traceability and verification of cross-contract and cross-chain data, facilitating a more efficient discovery of storage locations and crucial information related to media assets. The major purpose is to foster an integrated digital media environment on the blockchain.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Given the significant role digital media files play on the Internet, it&#x27;s crucial to have a robust and efficient method for indexing immutable information. Existing systems encounter challenges due to the absence of a universal, interoperable identifier for digital media content. This leads to fragmentation and complications in retrieving metadata, storage information, or the provenance of specific media assets. The issues become increasingly critical as the volume of digital media continues to expand.&lt;&#x2F;p&gt;
&lt;p&gt;The motivation behind this EIP is to establish a standardized, decentralized, and interoperable approach to index digital media across EVM-compatible networks. By integrating Decentralized Content Identifiers (CIDs) and Commit events, this EIP puts forward a mechanism enabling unique identification and indexing of each digital media file. Moreover, this system suggests a way for users to access a complete history of data associated with digital media assets, from creation to the current status. This full view enhances transparency, thereby providing users with the necessary information for future interactions with digital media.&lt;&#x2F;p&gt;
&lt;p&gt;This method creates a common interface that any digital media system can use to provide a standard way of indexing and searching their content.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&quot;text-align: center&quot;&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7053&#x2F;.&#x2F;assets&#x2F;digital-media-indexing-system-and-metadata-lookup.jpg&quot; alt=&quot;&quot; &#x2F;&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;Figure 1: Digital Media Indexing Relationships and Lookup&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;This EIP aims to create an interoperable indexing system to associate all data of the same digital content together (Figure 1). This will make it easier for users to find and trust digital media content, and it will also make it easier for systems to share and exchange information about this digital media content.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;content-identifier&quot;&gt;Content Identifier&lt;&#x2F;h3&gt;
&lt;p&gt;Content Identifier in this EIP is the content address generated by passing the content of a digital media through a cryptographic hash function. Before the indexing process for digital media can begin, it is REQUIRED to generate unique Content Identifiers for each file. This identifier should the same as the Content Identifiers on the decentralized storage, ensuring each identifier provides access to the metadata, media information, and the content file itself.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;commit-function&quot;&gt;Commit Function&lt;&#x2F;h3&gt;
&lt;p&gt;To index digital media, we shall call the commit function and generate Commit event:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a new commit is made.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; recorder&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the account making the commit.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; assetCid&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The content identifier of the asset being committed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; commitData&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The data associated with the commit.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Commit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recorder&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; assetCid&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; commitData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Registers a commit for an asset.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * Emits a Commit event and records the block number of the commit in the recordLogs mapping for the provided assetCid.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emits a Commit event and logs the block number of the commit event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; assetCid&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The content identifier of the asset being committed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; commitData&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The data associated with the commit.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; block number at which the commit was made.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; commit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; assetCid&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; commitData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; blockNumber&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The design decisions in this EIP prioritize the effectiveness and efficiency of the indexing method. To achieve this, Decentralized Content Identifiers (CIDs) are utilized to uniquely identify digital media content across all systems. This approach offers accurate and precise searching of media, along with the following benefits:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Strengthened data integrity: CIDs serve as cryptographic hashes of the content, ensuring their uniqueness and preventing forgery. With the content in hand, obtaining the CID allows for searching relevant information associated with that content.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Streamlined data portability: CIDs enable the seamless transfer of digital media content across different systems, eliminating the need for re-encoding or reconfiguration of protocols. This promotes a more interoperable and open indexing system. For example, in cases where Non-Fungible Tokens (NFTs) are created prior to Commit events, the digital media content can still be indexed by converting the file referenced by the tokenURI using the same mechanism. This conversion process ensures that the digital media content associated with NFT tokens can be indexed with a consistent identification approach.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.4&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;utils&#x2F;cryptography&#x2F;ECDSA.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts-upgradeable&#x2F;proxy&#x2F;utils&#x2F;Initializable.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CommitRegister&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Initializable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    using&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ECDSA&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; commitLogs&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Commit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recorder&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; assetCid&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; commitData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; initialize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; initializer&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; commit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; assetCid&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; commitData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; blockNumber&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Commit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; assetCid&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; commitData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        commitLogs&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;assetCid&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;push&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getCommits&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; assetCid&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; commitLogs&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;assetCid&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;When implementing this EIP, it&#x27;s essential to address several security aspects to ensure the safety and integrity of the digital media index:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Input Validation: Given that commit function accepts string parameters, it&#x27;s important to validate these inputs to avoid potential injection attacks. Although such attacks are less common in smart contracts than traditional web development, caution should be exercised.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Data Integrity: The commit function relies on CIDs, which are assumed to be correct and point to the right data. It&#x27;s important to note that this EIP doesn&#x27;t validate the content behind the CIDs and the commit data, which remains a responsibility of the users or implementing applications.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Event Listening: Systems relying on listening to the Commit events for changes need to be aware of potential missed events or incorrect ordering, especially during periods of network congestion or reorganizations.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Implementers should consider these security aspects in the context of their specific use case and deployment scenario. It is strongly recommended to perform a comprehensive security audit before deploying any implementation of this EIP to a live network.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Perpetually Valid Signed Voluntary Exits</title>
        <published>2023-05-18T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Lion</name><uri>https://github.com/dapplion</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7044/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7044-perpetually-valid-signed-voluntary-exits/14348" />
        

        <id>https://wg-eips.ritovision.com/7044/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:7044"
            label="EIP-7044" />
        

        
        

        
        <summary type="html">Lock voluntary exit signature domain on capella for perpetual validity</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7044/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Lock validator voluntary exit signature domain on Capella for perpetual validity. Currently, signed voluntary exits are only valid for two upgrades.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, signed voluntary exits are valid up-to only two upgrades for block inclusion due to the Beacon Chain state considering only the current and previous fork version. This limitation increases the complexity of some staking operations, specifically those in which the staking operator (holder of active key) is distinct from the owner of the funds (holder of the withdrawal credential). Because voluntary exits can only be signed by the active key, such a relationship requires the exchange of signed exits ahead of time for an unbounded number of forks.&lt;&#x2F;p&gt;
&lt;p&gt;The limited validity of voluntary exits was originally motivated to isolate them in the event of a hard fork that results in two maintained chains. If fork A and B exist and a validator operates on both, if they send an exit, it will be replayable on both. However, this possibility is not sufficient to justify the UX degradation exposed above, as no funds are at risk and the staker can re-stake on one or both of the chains.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;consensus-layer&quot;&gt;Consensus Layer&lt;&#x2F;h3&gt;
&lt;p&gt;Specification changes are built into the Consensus Specs Deneb upgrade.&lt;&#x2F;p&gt;
&lt;p&gt;The specific makes one change to the state transition function:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Modify &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;75971a8c218b1d76d605dd8b88a08d39c42de221&#x2F;specs&#x2F;deneb&#x2F;beacon-chain.md#modified-process_voluntary_exit&quot;&gt;&lt;code&gt;process_voluntary_exit&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; to compute the signing domain and root fixed on &lt;code&gt;CAPELLA_FORK_VERSION&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Additionally, the &lt;code&gt;voluntary_exit&lt;&#x2F;code&gt; gossip conditions are implicitly modified to support this change.&lt;&#x2F;p&gt;
&lt;p&gt;To make the change backwards compatible the signature domain is locked on the Capella fork&lt;&#x2F;p&gt;
&lt;h3 id=&quot;execution-layer&quot;&gt;Execution Layer&lt;&#x2F;h3&gt;
&lt;p&gt;This specification does not require any changes to the Execution Layer.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Perpetually valid signed voluntary exits allow simpler staking operation designs. It also aligns the UX of such objects to &lt;code&gt;BLSToExecutionChanges&lt;&#x2F;code&gt; and deposits, such that downstream tooling does not need to be updated with fork version information.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change is backwards compatible to the Consensus Layer of Ethereum block processing logic.&lt;&#x2F;p&gt;
&lt;p&gt;The expectation of future validity of exits is not forward compatible. Specifically, users who have already pre-signed exits utilizing the Deneb fork domain with an expectation of their validity should be aware that these pre-signed exits will no longer be recognized as valid. Consequently, users should adjust their approach moving forward. For continued validity across forks, including Deneb and subsequent forks, users should ensure that their exits are signed using the Capella fork domain.&lt;&#x2F;p&gt;
&lt;p&gt;There are no forwards&#x2F;backwards compatibility issues with the Execution Layer.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases for this EIP can be found in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;tree&#x2F;2297c09b7e457a13f7b2261a28cb45777be82f83&#x2F;tests&#x2F;core&#x2F;pyspec&#x2F;eth2spec&#x2F;test&#x2F;deneb&quot;&gt;&lt;code&gt;deneb&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; test suite of the &lt;code&gt;consensus-specs&lt;&#x2F;code&gt; repository.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The divergent signature domains across forked networks would previously have prevented the replay of VoluntaryExits after two hard forks. This specification change causes the replay protection to no longer exist. These potential replays could impact individual stakers on both sides of a fork, but does not put funds at risk and does not impact the security of the chain.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Increase max attestation inclusion slot</title>
        <published>2023-05-18T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Danny Ryan</name><uri>https://github.com/djrtwo</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7045/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7045-increase-attestation-slot-inclusion-range/14342" />
        

        <id>https://wg-eips.ritovision.com/7045/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7045"
            label="EIP-7045" />
        

        
        

        
        <summary type="html">Increases max attestation inclusion slot to the last slot in `N+1` where `N` is the epoch containing the attestation&#x27;s slot.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7045/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Increases max attestation inclusion slot from &lt;code&gt;attestation.slot + SLOTS_PER_EPOCH&lt;&#x2F;code&gt; to the last slot of epoch &lt;code&gt;N+1&lt;&#x2F;code&gt; where &lt;code&gt;N&lt;&#x2F;code&gt; is the epoch containing the attestation slot.&lt;&#x2F;p&gt;
&lt;p&gt;This increase is critical to the current LMD-GHOST security analysis as well as the confirmation rule.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Attestations can currently be included after some minimum delay (&lt;code&gt;1&lt;&#x2F;code&gt; slot on mainnet) up until &lt;code&gt;SLOTS_PER_EPOCH&lt;&#x2F;code&gt; slots after the slot the attestation was created in. This rolling window of one epoch was decided upon during Phase 0 because the equal inclusion window for any attestation was assessed as &quot;fair&quot;. The alternative considered path was to allow inclusion during the current and next epoch which means attestations created during the start of an epoch have more potential slots of inclusion than those at the end of the epoch.&lt;&#x2F;p&gt;
&lt;p&gt;Since this decision, it has become apparent that the alternative design is critical for current LMD-GHOST security proofs as well as a new confirmation rule (which will allow for block confirmations in approximately 3-4 slots in normal mainnet conditions).&lt;&#x2F;p&gt;
&lt;p&gt;This specification thus increases the max inclusion slot for attestations in accordance with the learned security proof and confirmation rule needs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Comment&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FORK_TIMESTAMP&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;1710338135&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Mainnet&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;execution-layer&quot;&gt;Execution layer&lt;&#x2F;h3&gt;
&lt;p&gt;This requires no changes to the Execution Layer.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;consensus-layer&quot;&gt;Consensus layer&lt;&#x2F;h3&gt;
&lt;p&gt;Specification changes are built into the Consensus Specs Deneb upgrade.&lt;&#x2F;p&gt;
&lt;p&gt;The specification makes two minor changes to the state transition function:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Modify &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;95f36d99cf4aa59974da06af24ef9a7c12d3c301&#x2F;specs&#x2F;deneb&#x2F;beacon-chain.md#modified-process_attestation&quot;&gt;&lt;code&gt;process_attestation&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; to not have an upper bound on the slot check and instead define the inclusion range via the minimum slot as well as the target epoch being in either current or previous epoch.&lt;&#x2F;li&gt;
&lt;li&gt;Modify &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;95f36d99cf4aa59974da06af24ef9a7c12d3c301&#x2F;specs&#x2F;deneb&#x2F;beacon-chain.md#modified-get_attestation_participation_flag_indices&quot;&gt;&lt;code&gt;get_attestation_participation_flag_indices&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; to set the &lt;code&gt;TIMELY_TARGET_FLAG&lt;&#x2F;code&gt; without consideration of &lt;code&gt;inclusion_delay&lt;&#x2F;code&gt; to ensure that the extended inclusion attestations have a non-zero reward.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Additionally, the specification modifies the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;95f36d99cf4aa59974da06af24ef9a7c12d3c301&#x2F;specs&#x2F;deneb&#x2F;p2p-interface.md#beacon_attestation_subnet_id&quot;&gt;attestation&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;95f36d99cf4aa59974da06af24ef9a7c12d3c301&#x2F;specs&#x2F;deneb&#x2F;p2p-interface.md#beacon_aggregate_and_proof&quot;&gt;aggregate attestation&lt;&#x2F;a&gt; gossip conditions to allow for gossip during this extended range.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;extended-max-inclusion-slot&quot;&gt;Extended max inclusion slot&lt;&#x2F;h3&gt;
&lt;p&gt;As discussed in the Motivation, extending this max inclusion slot to the end of the next epoch is critical for LMD-GHOST security proofs and confirmation rule.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;removal-of-inclusion-delay-consideration-for-target-reward&quot;&gt;Removal of &lt;code&gt;inclusion_delay&lt;&#x2F;code&gt; consideration for target reward&lt;&#x2F;h3&gt;
&lt;p&gt;Previously, &lt;code&gt;get_attestation_participation_flag_indices&lt;&#x2F;code&gt; would only set the &lt;code&gt;TIMELY_TARGET_FLAG&lt;&#x2F;code&gt; (and thus reward for an attestation with correct target vote) if the attestation was included within a &lt;code&gt;SLOTS_PER_EPOCH&lt;&#x2F;code&gt; window.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;inclusion_delay&lt;&#x2F;code&gt; consideration for this flag is removed to ensure that whatever the valid inclusion window is for an attestation, it can receive a baseline non-zero reward for correct target. This ensures that clients will still attempt to pack such attestations into blocks which is important for the security analysis.&lt;&#x2F;p&gt;
&lt;p&gt;Note, this was the intended behavior with the previously defined range which was equivalent to the max.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces backwards incompatible changes to the block validation rule set on the consensus layer and must be accompanied by a hard fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases for this EIP can be found in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;tree&#x2F;2297c09b7e457a13f7b2261a28cb45777be82f83&#x2F;tests&#x2F;core&#x2F;pyspec&#x2F;eth2spec&#x2F;test&#x2F;deneb&quot;&gt;&lt;code&gt;deneb&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; test suite of the &lt;code&gt;consensus-specs&lt;&#x2F;code&gt; repository.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This improves LMD-GHOST security as well as enables a fast confirmation rule.&lt;&#x2F;p&gt;
&lt;p&gt;There are no known negative impacts to security.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Scheme-Handler Discovery Option for Wallets</title>
        <published>2023-05-15T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Sam Wilson</name><uri>https://github.com/SamWilsn</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7039/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/shadow-a-scheme-handler-discovery-option-for-wallets/14330" />
        

        <id>https://wg-eips.ritovision.com/7039/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="interface"
                label="Interface" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7039"
            label="EIP-7039" />
        

        
        

        
        <summary type="html">Using custom protocol handlers to initiate connections between web pages and wallets.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7039/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal (affectionately known as SHADOW) is an alternative to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1193&#x2F;&quot;&gt;EIP-1193&lt;&#x2F;a&gt; for wallet discovery in web browsers that requires no special permissions. Web pages intending to open a connection to a wallet inject an &lt;code&gt;iframe&lt;&#x2F;code&gt; tag pointing at a well-known scheme. Communication between the page and the wallet uses the &lt;code&gt;postMessage&lt;&#x2F;code&gt; API.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Current wallet discovery methods (eg. &lt;code&gt;window.ethereum&lt;&#x2F;code&gt;) only support one active wallet at a time, and require browser extensions to request broad permissions to modify web pages.&lt;&#x2F;p&gt;
&lt;p&gt;Ideally users should be able to have multiple wallets active, and choose between them at runtime. This not only results in an improved user experience but also reduces the barrier to entry for new browser extensions as users are no longer forced to only install one browser extension at a time.&lt;&#x2F;p&gt;
&lt;p&gt;With SHADOW, and unlike other recent proposals, browser extensions do not need blanket &lt;code&gt;content_scripts&lt;&#x2F;code&gt; or any &lt;code&gt;permissions&lt;&#x2F;code&gt; at all. Furthermore, any web page (and not just browser extensions) can register a handler for a protocol. That means better support for pure web wallets, native executable wallets, and hardware wallets. As long as a wallet can serve a page securely, it can register itself as a handler.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;initiating-a-connection&quot;&gt;Initiating a Connection&lt;&#x2F;h3&gt;
&lt;p&gt;To initiate a connection to a provider, a web page SHOULD:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Add an event listener to &lt;code&gt;window&lt;&#x2F;code&gt; for the &lt;code&gt;&quot;message&quot;&lt;&#x2F;code&gt; event (or set &lt;code&gt;window.onmessage&lt;&#x2F;code&gt;.)&lt;&#x2F;li&gt;
&lt;li&gt;Create an &lt;code&gt;iframe&lt;&#x2F;code&gt; tag with a &lt;code&gt;src&lt;&#x2F;code&gt; attribute value of &lt;code&gt;web+evm:&#x2F;&#x2F;&lt;&#x2F;code&gt;; then&lt;&#x2F;li&gt;
&lt;li&gt;Attach the &lt;code&gt;iframe&lt;&#x2F;code&gt; to the DOM.&lt;&#x2F;li&gt;
&lt;li&gt;Wait for a &lt;code&gt;&quot;message&quot;&lt;&#x2F;code&gt; event with a non-nullish &lt;code&gt;source&lt;&#x2F;code&gt; equal to the &lt;code&gt;iframe&lt;&#x2F;code&gt;&#x27;s &lt;code&gt;contentWindow&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Save the first port from the message event for further communication. This is referred to as the &quot;primary port.&quot;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The event received in step 4 MAY contain additional information about the provider. If present, the event data SHALL satisfy the following TypeScript interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ProviderInfo&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    name&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    icon&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;name&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; is the human-readable name of the provider; and&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;icon&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; is a URI pointing at an image. See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7039&#x2F;#icon-images&quot;&gt;Icon Images&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;communicating-on-an-established-connection&quot;&gt;Communicating on an Established Connection&lt;&#x2F;h3&gt;
&lt;p&gt;The web page and wallet MAY make requests of the other. The party making the request is known as the requester, and the replying party is known as the responder.&lt;&#x2F;p&gt;
&lt;p&gt;A requester MAY make requests of the responder by sending a message (using &lt;code&gt;postMessage&lt;&#x2F;code&gt;) on the primary port. The message MAY include a &lt;code&gt;MessagePort&lt;&#x2F;code&gt; as the first item of the message&#x27;s transfer list to receive a reply. This port is known as a &quot;reply port.&quot; The message&#x27;s data MUST satisfy &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1193&#x2F;&quot;&gt;EIP-1193&lt;&#x2F;a&gt;&#x27;s &lt;code&gt;RequestArguments&lt;&#x2F;code&gt; interface, and SHALL be interpreted as described there.&lt;&#x2F;p&gt;
&lt;p&gt;The responder SHALL respond by posting a single message to the reply port, if a reply port was transferred. The message&#x27;s data SHALL satisfy the following TypeScript interface, where &lt;code&gt;ProviderRpcError&lt;&#x2F;code&gt; is defined in EIP-1193:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Response&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    result&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; unknown&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ProviderRpcError&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Exactly one of &lt;code&gt;result&lt;&#x2F;code&gt; or &lt;code&gt;error&lt;&#x2F;code&gt; SHALL be present on the response.&lt;&#x2F;p&gt;
&lt;p&gt;If present, &lt;code&gt;result&lt;&#x2F;code&gt; SHALL be equivalent to the &lt;code&gt;result&lt;&#x2F;code&gt; field of the named JSON-RPC method&#x27;s response.&lt;&#x2F;p&gt;
&lt;p&gt;Error objects SHOULD follow the recommendations set out in EIP-1193.&lt;&#x2F;p&gt;
&lt;p&gt;A request without a transferred reply port SHALL NOT be considered an error, even if a reply would have been sent.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;icon-images&quot;&gt;Icon Images&lt;&#x2F;h3&gt;
&lt;!-- TODO --&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Instead of directly using the &lt;code&gt;iframe.contentWindow&lt;&#x2F;code&gt;&#x27;s message port, SHADOW transfers a message port in the first message. This allows the &lt;code&gt;iframe&lt;&#x2F;code&gt;, in some specific scenarios, to completely hand off communication, so the web page and the provider communicate directly, without any proxying in the &lt;code&gt;iframe&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;While not backwards compatible with EIP-1193, this proposal uses extremely similar data structures to make the transition as painless as possible.&lt;&#x2F;p&gt;
&lt;p&gt;It is possible to implement an EIP-1193 compatible provider using this proposal like so:&lt;&#x2F;p&gt;
&lt;!-- TODO: Show example of implementing EIP-1193 provider on top of this proposal. --&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;!-- TODO: Needs more discussion. --&gt;
&lt;p&gt;Both providers and web pages MUST verify the origin of messages before trusting them.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>NFT Creator Attribution</title>
        <published>2023-05-11T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>indreams</name><uri>https://github.com/strollinghome</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7015/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-authorship-attribution-for-erc721/14244" />
        

        <id>https://wg-eips.ritovision.com/7015/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7015"
            label="ERC-7015" />
        

        
        

        
        <summary type="html">Extending NFTs with cryptographically secured creator attribution.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7015/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This Ethereum Improvement Proposal aims to solve the issue of creator attribution for Non-Fungible Token (NFT) standards (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt;). To achieve this, this EIP proposes a mechanism where the NFT creator signs the required parameters for the NFT creation, including the NFT metadata in a hash along with any other relevant information. The signed parameters and the signature are then validated and emitted during the deployment transaction, which allows the NFT to validate the creator and NFT platforms to attribute creatorship correctly. This method ensures that even if a different wallet sends the deployment transaction, the correct account is attributed as the creator.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Current NFT platforms assume that the wallet deploying the smart contract is the creator of the NFT, leading to a misattribution in cases where a different wallet sends the deployment transaction. This happens often when working with smart wallet accounts, and new contract deployment strategies such as the first collector deploying the NFT contract. This proposal aims to solve the problem by allowing creators to sign the parameters required for NFT creation so that any wallet can send the deployment transaction with an signal in a verifiable way who is the creator.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords “MUST,” “MUST NOT,” “REQUIRED,” “SHALL,” “SHALL NOT,” “SHOULD,” “SHOULD NOT,” “RECOMMENDED,” “MAY,” and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;ERC-721 and ERC-1155 compliant contracts MAY implement this NFT Creator Attribution extension to provide a standard event to be emitted that defines the NFT creator at the time of contract creation.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP takes advantage of the fact that contract addresses can be precomputed before a contract is deployed. Whether the NFT contract is deployed through another contract (a factory) or through an EOA, the creator can be correctly attributed using this specification.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Signing Mechanism&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Creator consent is given by signing an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; compatible message; all signatures compliant with this EIP MUST include all fields defined. The struct signed can be any arbitrary data that defines how to create the token; it must hashed in an EIP-712 compatible format with a proper EIP-712 domain.&lt;&#x2F;p&gt;
&lt;p&gt;The following shows some examples of structs that could be encoded into &lt;code&gt;structHash&lt;&#x2F;code&gt; (defined below):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; example struct that can be encoded in `structHash`; defines that a token can be created with a metadataUri and price:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TokenCreation&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  string&lt;&#x2F;span&gt;&lt;span&gt; metadataUri&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span&gt; price&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Signature Validation&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Creator attribution is given through a signature verification that MUST be verified by the NFT contract being deployed and an event that MUST be emitted by the NFT contract during the deployment transaction. The event includes all the necessary fields for reconstructing the signed digest and validating the signature to ensure it matches the specified creator. The event name is &lt;code&gt;CreatorAttribution&lt;&#x2F;code&gt; and includes the following fields:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;structHash&lt;&#x2F;code&gt;: hashed information for deploying the NFT contract (e.g. name, symbol, admins etc). This corresponds to the value &lt;code&gt;hashStruct&lt;&#x2F;code&gt; as defined in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;#definition-of-hashstruct&quot;&gt;EIP-712 definition of hashStruct&lt;&#x2F;a&gt; standard.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;domainName&lt;&#x2F;code&gt;: the domain name of the contract verifying the signature (for EIP-712 signature validation).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;version&lt;&#x2F;code&gt;: the version of the contract verifying the signature (for EIP-712 signature validation)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;creator&lt;&#x2F;code&gt;: the creator&#x27;s account&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;signature&lt;&#x2F;code&gt;: the creator’s signature&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The event is defined as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CreatorAttribution&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; structHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; domainName&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; version&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; creator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note that although the &lt;code&gt;chainId&lt;&#x2F;code&gt; parameters is necessary for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; signatures, we omit the parameter from the event as it can be inferred through the transaction data. Similarly, the &lt;code&gt;verifyingContract&lt;&#x2F;code&gt; parameter for signature verification is omitted since it MUST be the same as the &lt;code&gt;emitter&lt;&#x2F;code&gt; field in the transaction. &lt;code&gt;emitter&lt;&#x2F;code&gt; MUST be the token.&lt;&#x2F;p&gt;
&lt;p&gt;A platform can verify the validity of the creator attribution by reconstructing the signature digest with the parameters emitted and recovering the signer from the &lt;code&gt;signature&lt;&#x2F;code&gt; parameter. The recovered signer MUST match the &lt;code&gt;creator&lt;&#x2F;code&gt; emitted in the event. If &lt;code&gt;CreatorAttribution&lt;&#x2F;code&gt; event is present creator and the signature is validated correctly, attribution MUST be given to the &lt;code&gt;creator&lt;&#x2F;code&gt; instead of the account that submitted the transaction.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;example-signature-validator&quot;&gt;Example signature validator&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0.8.20&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;utils&#x2F;cryptography&#x2F;EIP712.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;utils&#x2F;cryptography&#x2F;ECDSA.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;interfaces&#x2F;IERC1271.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;abstract&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC7015&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EIP712&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Invalid_Signature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CreatorAttribution&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; structHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; domainName&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; version&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; creator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Define magic value to verify smart contract signatures (ERC1271).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; MAGIC_VALUE &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes4&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;isValidSignature(bytes32,bytes)&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _validateSignature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; structHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; creator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_isValid&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;structHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; creator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Invalid_Signature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CreatorAttribution&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;structHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC7015&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;1&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; creator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _isValid&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; structHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signer &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;cannot validate&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; digest &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _hashTypedDataV4&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;structHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if smart contract is the signer, verify using ERC-1271 smart-contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; signature verification method&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      try&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC1271&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isValidSignature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;digest&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; magicValue&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      )&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; MAGIC_VALUE &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; magicValue&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; catch&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; otherwise, recover signer and validate that it matches the expected&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; signer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; recoveredSigner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; ECDSA&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;recover&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;digest&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; recoveredSigner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; signer&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;By standardizing the &lt;code&gt;CreatorAttribution&lt;&#x2F;code&gt; event, this EIP enables platforms to ascertain creator attribution without relying on implicit assumptions. Establishing a standard for creator attribution empowers platforms to manage the complex aspects of deploying contracts while preserving accurate onchain creator information. This approach ensures a more reliable and transparent method for identifying NFT creators, fostering trust among participants in the NFT ecosystem.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5375&#x2F;&quot;&gt;ERC-5375&lt;&#x2F;a&gt; attempts to solve the same issue and although offchain data offers improved backward compatibility, ensuring accurate and immutable creator attribution is vital for NFTs. A standardized onchain method for creator attribution is inherently more reliable and secure.&lt;&#x2F;p&gt;
&lt;p&gt;In contrast to this proposal, ERC-5375 does not facilitate specifying creators for all tokens within an NFT collection, which is a prevalent practice, particularly in emerging use cases.&lt;&#x2F;p&gt;
&lt;p&gt;Both this proposal and ERC-5375 share similar limitations regarding address-based creator attribution:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;The standard defines a protocol to verify that a certain &lt;em&gt;address&lt;&#x2F;em&gt; provided consent. However, it does not guarantee that the address corresponds to the expected creator […]. Proving a link between an address and the entity behind it is beyond the scope of this document.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Since the standard requires an event to be emitted during the NFTs deployment transaction, existing NFTs cannot implement this standard.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;A potential attack exploiting this proposal could involve deceiving creators into signing creator attribution consent messages unintentionally. Consequently, creators MUST ensure that all signature fields correspond to the necessary ones before signing.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Verifiable AI-Generated Content Token</title>
        <published>2023-05-10T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Cathie So</name><uri>https://github.com/socathie</uri>
	</author>
	
	<author>
		<name>Xiaohang Yu</name><uri>https://github.com/xhyumiracle</uri>
	</author>
	
	<author>
		<name>Conway</name><uri>https://github.com/0x1cc</uri>
	</author>
	
	<author>
		<name>Lee Ting Ting</name><uri>https://github.com/tina1998612</uri>
	</author>
	
	<author>
		<name>Kartin</name><email>kartin@hyperoracle.io</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7007/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7007-zkml-aigc-nfts-an-erc-721-extension-interface-for-zkml-based-aigc-nfts/14216" />
        

        <id>https://wg-eips.ritovision.com/7007/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7007"
            label="ERC-7007" />
        

        
        

        
        <summary type="html">An ERC-721 extension for verifiable AI-generated content tokens using Zero-Knowledge and Optimistic Machine Learning techniques</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7007/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The verifiable AI-generated content (AIGC) non-fungible token (NFT) standard is an extension of the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; token standard for AIGC. It proposes a set of interfaces for basic interactions and enumerable interactions for AIGC-NFTs. The standard includes an &lt;code&gt;addAigcData&lt;&#x2F;code&gt; and &lt;code&gt;verify&lt;&#x2F;code&gt; function interface, a new &lt;code&gt;AigcData&lt;&#x2F;code&gt; event, optional &lt;code&gt;Enumerable&lt;&#x2F;code&gt; and &lt;code&gt;Updatable&lt;&#x2F;code&gt; extensions, and a JSON schema for AIGC-NFT metadata. Additionally, it incorporates Zero-Knowledge Machine Learning (zkML) and Optimistic Machine Learning (opML) capabilities to enable verification of AIGC data correctness. In this standard, the &lt;code&gt;tokenId&lt;&#x2F;code&gt; is indexed by the &lt;code&gt;prompt&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The verifiable AIGC-NFT standard aims to extend the existing &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; token standard to accommodate the unique requirements of AI-generated content NFTs representing models in a collection. This standard provides interfaces to use zkML or opML to verify whether or not the AIGC data for an NFT is generated from a certain ML model with a certain input (prompt). The proposed interfaces allow for additional functionality related to adding AIGC data, verifying, and enumerating AIGC-NFTs. Additionally, the metadata schema provides a structured format for storing information related to AIGC-NFTs, such as the prompt used to generate the content and the proof of ownership.&lt;&#x2F;p&gt;
&lt;p&gt;This standard supports two primary types of proofs: validity proofs and fraud proofs. In practice, zkML and opML are commonly employed as the prevailing instances for these types of proofs. Developers can choose their preferred ones.&lt;&#x2F;p&gt;
&lt;p&gt;In the zkML scenario, this standard enables model owners to publish their trained model and its ZKP verifier to Ethereum. Any user can claim an input (prompt) and publish the inference task. Any node that maintains the model and the proving circuit can perform the inference and proving, and submit the output of inference and the ZK proof for the inference trace to the verifier. The user that initiates the inference task will own the output for the inference of that model and input (prompt).&lt;&#x2F;p&gt;
&lt;p&gt;In the opML scenario, this standard enables model owners to publish their trained model to Ethereum. Any user can claim an input (prompt) and publish the inference task. Any node that maintains the model can perform the inference and submit the inference output. Other nodes can challenge this result within a predefined challenge period. At the end of the challenge period, the user can verify that they own the output for the inference of that model and prompt, and update the AIGC data as needed.&lt;&#x2F;p&gt;
&lt;p&gt;This capability is especially beneficial for AI model authors and AI content creators seeking to capitalize on their creations. With this standard, every input prompt and its resulting content can be securely verified on the blockchain. This opens up opportunities for implementing revenue-sharing mechanisms for all AI-generated content (AIGC) NFT sales. AI model authors can now share their models without concerns that open-sourcing will diminish their financial value.&lt;&#x2F;p&gt;
&lt;p&gt;An example workflow of a zkML AIGC NFT project compliant with this proposal is as follows:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7007&#x2F;.&#x2F;assets&#x2F;workflow.png&quot; alt=&quot;zkML Suggested Workflow&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;There are 4 components in this workflow:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;ML model - contains weights of a pre-trained model; given an inference input, generates the output&lt;&#x2F;li&gt;
&lt;li&gt;zkML prover - given an inference task with input and output, generates a ZK proof&lt;&#x2F;li&gt;
&lt;li&gt;AIGC-NFT smart contract - contract compliant with this proposal, with full &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; functionalities&lt;&#x2F;li&gt;
&lt;li&gt;Verifier smart contract - implements a &lt;code&gt;verify&lt;&#x2F;code&gt; function, given an inference task and its ZK proof, returns the verification result as a boolean&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Every compliant contract must implement the &lt;code&gt;IERC7007&lt;&#x2F;code&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;&lt;code&gt;ERC721&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;, and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;&lt;code&gt;ERC165&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; interfaces.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The verifiable AIGC-NFT standard includes the following interfaces:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;IERC7007&lt;&#x2F;code&gt;: Defines an &lt;code&gt;addAigcData&lt;&#x2F;code&gt; function and an &lt;code&gt;AigcData&lt;&#x2F;code&gt; event for adding AIGC data to AIGC-NFTs. Defines a &lt;code&gt;verify&lt;&#x2F;code&gt; function to check the validity of the combination of prompt and aigcData using zkML&#x2F;opML techniques.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.18&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Required interface of an ERC7007 compliant contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0x702c55a6.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7007&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC165&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC721&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when `tokenId` token&amp;#39;s AIGC data is added.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AigcData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; prompt&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; aigcData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; proof&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Add AIGC data to token at `tokenId` given `prompt`, `aigcData`, and `proof`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addAigcData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; prompt&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; aigcData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; proof&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify the `prompt`, `aigcData`, and `proof`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; prompt&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; aigcData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; proof&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;optional-extension-enumerable&quot;&gt;Optional Extension: Enumerable&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;strong&gt;enumeration extension&lt;&#x2F;strong&gt; is OPTIONAL for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7007&#x2F;&quot;&gt;ERC-7007&lt;&#x2F;a&gt; smart contracts. This allows your contract to publish its full list of mapping between &lt;code&gt;tokenId&lt;&#x2F;code&gt; and &lt;code&gt;prompt&lt;&#x2F;code&gt; and make them discoverable.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.18&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC7007 Token Standard, optional enumeration extension&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0xfa1a557a.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7007Enumerable&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7007&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the token ID given `prompt`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; prompt&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the prompt given `tokenId`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; prompt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;optional-extension-updatable&quot;&gt;Optional Extension: Updatable&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;strong&gt;updatable extension&lt;&#x2F;strong&gt; is OPTIONAL for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7007&#x2F;&quot;&gt;ERC-7007&lt;&#x2F;a&gt; smart contracts. This allows your contract to update a token&#x27;s &lt;code&gt;aigcData&lt;&#x2F;code&gt; in the case of opML, where &lt;code&gt;aigcData&lt;&#x2F;code&gt; content might change over the challenge period.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.18&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC7007 Token Standard, optional updatable extension&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0x3f37dce2.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7007Updatable&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7007&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Update the `aigcData` of `prompt`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; update&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; prompt&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; aigcData&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when `tokenId` token is updated.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Update&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; prompt&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; aigcData&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;erc-7007-metadata-json-schema-for-reference&quot;&gt;ERC-7007 Metadata JSON Schema for reference&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;AIGC Metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Identifies the asset to which this NFT represents&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Describes the asset to which this NFT represents&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;image&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A URI pointing to a resource with mime type image&#x2F;* representing the asset to which this NFT represents. Consider making any images at a width between 320 and 1080 pixels and aspect ratio between 1.91:1 and 4:5 inclusive.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;prompt&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Identifies the prompt from which this AIGC NFT generated&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;aigc_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;image&#x2F;video&#x2F;audio...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;aigc_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A URI pointing to a resource with mime type image&#x2F;* representing the asset to which this AIGC NFT represents.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;proof_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;validity (zkML) or fraud (opML)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;ml-model-publication&quot;&gt;ML Model Publication&lt;&#x2F;h3&gt;
&lt;p&gt;While this standard does not describe the Machine Learning model publication stage, it is natural and recommended to publish the commitment of the Model to Ethereum separately, before any actual &lt;code&gt;addAigcData&lt;&#x2F;code&gt; actions. The model commitment schema choice lies on the AIGC-NFT project issuer party. The commitment should be checked inside the implementation of the &lt;code&gt;verify&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;unique-token-identification&quot;&gt;Unique Token Identification&lt;&#x2F;h3&gt;
&lt;p&gt;This specification sets the &lt;code&gt;tokenId&lt;&#x2F;code&gt; to be the hash of its corresponding &lt;code&gt;prompt&lt;&#x2F;code&gt;, creating a deterministic and collision-resistant way to associate tokens with their unique content generation parameters. This design decision ensures that the same prompt (which corresponds to the same AI-generated content under the same model seed) cannot be minted more than once, thereby preventing duplication and preserving the uniqueness of each NFT within the ecosystem.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;generalization-to-different-proof-types&quot;&gt;Generalization to Different Proof Types&lt;&#x2F;h3&gt;
&lt;p&gt;This specification accommodates two proof types: validity proofs for zkML and fraud proofs for opML. Function arguments in &lt;code&gt;addAigcData&lt;&#x2F;code&gt; and &lt;code&gt;verify&lt;&#x2F;code&gt; are designed for generality, allowing for compatibility with both proof systems. Moreover, the specification includes an updatable extension that specifically serves the requirements of opML.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;verify-interface&quot;&gt;&lt;code&gt;verify&lt;&#x2F;code&gt; interface&lt;&#x2F;h3&gt;
&lt;p&gt;We specify a &lt;code&gt;verify&lt;&#x2F;code&gt; interface to enforce the correctness of &lt;code&gt;aigcData&lt;&#x2F;code&gt;. It is defined as a view function to reduce gas cost. &lt;code&gt;verify&lt;&#x2F;code&gt; should return true if and only if &lt;code&gt;aigcData&lt;&#x2F;code&gt; is finalized in both zkML and opML. In zkML, it must verify the ZK proof, i.e. &lt;code&gt;proof&lt;&#x2F;code&gt;; in opML, it must make sure that the challenging period is finalized, and that the &lt;code&gt;aigcData&lt;&#x2F;code&gt; is up-to-date, i.e. has been updated after finalization. Additionally, &lt;code&gt;proof&lt;&#x2F;code&gt; can be &lt;em&gt;empty&lt;&#x2F;em&gt; in opML.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;addaigcdata-interface&quot;&gt;&lt;code&gt;addAigcData&lt;&#x2F;code&gt; interface&lt;&#x2F;h3&gt;
&lt;p&gt;We specify an &lt;code&gt;addAigcData&lt;&#x2F;code&gt; interface to bind the prompt and &lt;code&gt;aigcData&lt;&#x2F;code&gt; with &lt;code&gt;tokenId&lt;&#x2F;code&gt;. This function provides flexibility for different minting implementations. Notably, it acts differently in zkML and opML cases. In zkML, &lt;code&gt;addAigcData&lt;&#x2F;code&gt; should make sure &lt;code&gt;verify&lt;&#x2F;code&gt; returns &lt;code&gt;true&lt;&#x2F;code&gt;. While in opML, it can be called before finalization. The consideration here is that, limited by the proving difficulty, zkML usually targets simple model inference tasks in practice, making it possible to provide a proof within an acceptable time frame. On the other hand, opML enables large model inference tasks, with a cost of longer confirmation time to achieve the approximate same security level. Mint until opML finalization may not be the best practice considering the existing optimistic protocols.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;naming-choice-on-update&quot;&gt;Naming Choice on &lt;code&gt;update&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;We adopt &quot;update&quot; over &quot;finalize&quot; because a successful challenge happens rarely in practice. Using &lt;code&gt;update&lt;&#x2F;code&gt; could avoid calling it for every &lt;code&gt;tokenId&lt;&#x2F;code&gt; and save gas.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is backward compatible with the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; as it extends the existing functionality with new interfaces.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;The reference implementation includes sample implementations of the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7007&#x2F;&quot;&gt;ERC-7007&lt;&#x2F;a&gt; interfaces under &lt;code&gt;contracts&#x2F;&lt;&#x2F;code&gt; and corresponding unit tests under &lt;code&gt;test&#x2F;&lt;&#x2F;code&gt;. This repo can be used to test the functionality of the proposed interfaces and metadata schema.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;ERC-7007 for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7007&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;ERC7007Zkml.sol&quot;&gt;zkML&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7007&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;ERC7007Opml.sol&quot;&gt;opML&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7007&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;ERC7007Enumerable.sol&quot;&gt;ERC-7007 Enumerable Extension&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;frontrunning-risk&quot;&gt;Frontrunning Risk&lt;&#x2F;h3&gt;
&lt;p&gt;To address the risk of frontrunning, where an actor could potentially observe and preemptively claim a prompt during the minting process, implementers of this proposal must incorporate a secure prompt-claiming mechanism. Implementations could include time-locks, commit-reveal schemes, or other anti-frontrunning techniques to ensure equitable and secured claim processes for AIGC-NFTs.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;aigc-data-change-during-challenge-period&quot;&gt;AIGC Data Change During Challenge Period&lt;&#x2F;h3&gt;
&lt;p&gt;In the opML scenario, it is important to consider that the &lt;code&gt;aigcData&lt;&#x2F;code&gt; might change during the challenge period due to disputes or updates. The updatable extension defined here provides a way to handle these updates. Implementations must ensure that updates to &lt;code&gt;aigcData&lt;&#x2F;code&gt; are treated as critical state changes that require adherence to the same security and validation protocols as the initial minting process. Indexers should always check for any &lt;code&gt;Update&lt;&#x2F;code&gt; event emission.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Execution layer triggerable withdrawals</title>
        <published>2023-05-09T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Danny Ryan</name><uri>https://github.com/djrtwo</uri>
	</author>
	
	<author>
		<name>Mikhail Kalinin</name><uri>https://github.com/mkalinin</uri>
	</author>
	
	<author>
		<name>Ansgar Dietrichs</name><uri>https://github.com/adietrichs</uri>
	</author>
	
	<author>
		<name>Hsiao-Wei Wang</name><uri>https://github.com/hwwhww</uri>
	</author>
	
	<author>
		<name>lightclient</name><uri>https://github.com/lightclient</uri>
	</author>
	
	<author>
		<name>Felix Lange</name><uri>https://github.com/fjl</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7002/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7002-execution-layer-triggerable-exits/14195" />
        

        <id>https://wg-eips.ritovision.com/7002/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7002"
            label="EIP-7002" />
        

        
        

        
        <summary type="html">Allow validators to trigger exits and partial withdrawals via their execution layer (0x01) withdrawal credentials</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7002/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Adds a new mechanism to allow validators to trigger withdrawals and exits from their execution layer (0x01) withdrawal credentials.&lt;&#x2F;p&gt;
&lt;p&gt;These new execution layer exit messages are appended to the execution layer block and then processed by the consensus layer.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Validators have two keys -- an active key and a withdrawal credential. The active key takes the form of a BLS key, whereas the withdrawal credential can either be a BLS key (0x00) or an execution layer address (0x01). The active key is &quot;hot&quot;, actively signing and performing validator duties, whereas the withdrawal credential can remain &quot;cold&quot;, only performing limited operations in relation to withdrawing and ownership of the staked ETH. Due to this security relationship, the withdrawal credential ultimately is the key that owns the staked ETH and any rewards.&lt;&#x2F;p&gt;
&lt;p&gt;As currently specified, only the active key can initiate a validator exit. This means that in any non-standard custody relationship (i.e., the active key is a separate entity from the withdrawal credentials), the ultimate owner of the funds -- the possessor of the withdrawal credentials -- cannot independently choose to exit and begin the withdrawal process. This leads to either trust issues (e.g. ETH can be &quot;held hostage&quot; by the active key owner) or insufficient work-arounds such as pre-signed exits. Additionally, in the event that active keys are lost, a user should still be able to recover their funds by using their cold withdrawal credentials.&lt;&#x2F;p&gt;
&lt;p&gt;To ensure that the withdrawal credentials (owned by both EOAs and smart contracts) can trustlessly control the destiny of the staked ETH, this specification enables exits triggerable by 0x01 withdrawal credentials.&lt;&#x2F;p&gt;
&lt;p&gt;Note, 0x00 withdrawal credentials can be changed into 0x01 withdrawal credentials with a one-time signed message. Thus any functionality enabled for 0x01 credentials is defacto enabled for 0x00 credentials.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;configuration&quot;&gt;Configuration&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Comment&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x00000961Ef480Eb55e80D19ad83579A64c007002&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Where to call and store relevant details about exit &#x2F; partial withdrawal mechanism&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;WITHDRAWAL_REQUEST_TYPE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x01&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7685&#x2F;&quot;&gt;EIP-7685&lt;&#x2F;a&gt; type prefix for withdrawal request&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SYSTEM_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xfffffffffffffffffffffffffffffffffffffffe&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Address used to invoke system operation on contract&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;EXCESS_WITHDRAWAL_REQUESTS_STORAGE_SLOT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;WITHDRAWAL_REQUEST_COUNT_STORAGE_SLOT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;WITHDRAWAL_REQUEST_QUEUE_HEAD_STORAGE_SLOT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;Pointer to head of the withdrawal request message queue&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;WITHDRAWAL_REQUEST_QUEUE_TAIL_STORAGE_SLOT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;Pointer to the tail of the withdrawal request message queue&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;WITHDRAWAL_REQUEST_QUEUE_STORAGE_OFFSET&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;4&lt;&#x2F;td&gt;&lt;td&gt;The start memory slot of the in-state withdrawal request message queue&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_WITHDRAWAL_REQUESTS_PER_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;16&lt;&#x2F;td&gt;&lt;td&gt;Maximum number of withdrawal requests that can be dequeued into a block&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TARGET_WITHDRAWAL_REQUESTS_PER_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MIN_WITHDRAWAL_REQUEST_FEE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;WITHDRAWAL_REQUEST_FEE_UPDATE_FRACTION&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;17&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;EXCESS_INHIBITOR&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2**256-1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Excess value used to compute the fee before the first system call&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;execution-layer&quot;&gt;Execution layer&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;FORK_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; -- the first block in a blockchain after this EIP has been activated.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;withdrawal-request-operation&quot;&gt;Withdrawal request operation&lt;&#x2F;h4&gt;
&lt;p&gt;The new withdrawal request operation is an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7685&#x2F;&quot;&gt;EIP-7685&lt;&#x2F;a&gt; request
with type &lt;code&gt;0x01&lt;&#x2F;code&gt; and consists of the following fields:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;source_address&lt;&#x2F;code&gt;: &lt;code&gt;Bytes20&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;validator_pubkey&lt;&#x2F;code&gt;: &lt;code&gt;Bytes48&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;amount&lt;&#x2F;code&gt;: &lt;code&gt;uint64&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7685&#x2F;&quot;&gt;EIP-7685&lt;&#x2F;a&gt; encoding of a withdrawal request is computed as follows.
Note that &lt;code&gt;amount&lt;&#x2F;code&gt; is returned by the contract little-endian, and must be encoded as such.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;request_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; WITHDRAWAL_REQUEST_TYPE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;request_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; read_withdrawal_requests&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;withdrawal-request-contract&quot;&gt;Withdrawal Request Contract&lt;&#x2F;h4&gt;
&lt;p&gt;The contract has three different code paths, which can be summarized at a high level as follows:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Add withdrawal request - requires a &lt;code&gt;56&lt;&#x2F;code&gt; byte input, the validator&#x27;s public
key concatenated with a big-endian &lt;code&gt;uint64&lt;&#x2F;code&gt; amount value.&lt;&#x2F;li&gt;
&lt;li&gt;Fee getter - if the input length is zero, return the current fee required to add a withdrawal request.&lt;&#x2F;li&gt;
&lt;li&gt;System process - if called by system address, pop off the withdrawal requests for the current block from the queue.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h5 id=&quot;add-withdrawal-request&quot;&gt;Add Withdrawal Request&lt;&#x2F;h5&gt;
&lt;p&gt;If call data input to the contract is exactly &lt;code&gt;56&lt;&#x2F;code&gt; bytes, perform the following:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Ensure enough ETH was sent to cover the current withdrawal request fee (&lt;code&gt;check_fee()&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;Increase withdrawal request count by 1 for the current block (&lt;code&gt;increment_count()&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;Insert a withdrawal request into the queue for the source address and validator pubkey (&lt;code&gt;insert_withdrawal_request_into_queue()&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Specifically, the functionality is defined in pseudocode as the function &lt;code&gt;add_withdrawal_request()&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; add_withdrawal_request&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;Bytes48&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; validator_pubkey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Add withdrawal request adds new request to the withdrawal request queue, so long as a sufficient fee is provided.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify sufficient fee was provided.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_fee&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span&gt; fee&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Insufficient value for fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Increment withdrawal request count.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    count&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; WITHDRAWAL_REQUEST_COUNT_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; WITHDRAWAL_REQUEST_COUNT_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; count&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Insert into queue.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    queue_tail_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; WITHDRAWAL_REQUEST_QUEUE_TAIL_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    queue_storage_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; WITHDRAWAL_REQUEST_QUEUE_STORAGE_OFFSET&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; queue_tail_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; queue_storage_slot&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; queue_storage_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; validator_pubkey&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; queue_storage_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; validator_pubkey&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;48&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; ++&lt;&#x2F;span&gt;&lt;span&gt; uint64_to_little_endian&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; WITHDRAWAL_REQUEST_QUEUE_TAIL_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; queue_tail_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h6 id=&quot;fee-calculation&quot;&gt;Fee calculation&lt;&#x2F;h6&gt;
&lt;p&gt;The following pseudocode can compute the cost of an individual withdrawal request, given a certain number of excess withdrawal requests.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_fee&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EXCESS_WITHDRAWAL_REQUESTS_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EXCESS_INHIBITOR&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Inhibitor still active&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; fake_exponential&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        MIN_WITHDRAWAL_REQUEST_FEE&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        excess&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        WITHDRAWAL_REQUEST_FEE_UPDATE_FRACTION&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fake_exponential&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;factor&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; numerator&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; denominator&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    output&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    numerator_accum&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; factor&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; denominator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    while&lt;&#x2F;span&gt;&lt;span&gt; numerator_accum&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        output&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; numerator_accum&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        numerator_accum&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;numerator_accum&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; numerator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;denominator&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; output&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; denominator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;fee-getter&quot;&gt;Fee Getter&lt;&#x2F;h5&gt;
&lt;p&gt;When the input to the contract is length zero, interpret this as a get request for the current fee, i.e. the contract returns the result of &lt;code&gt;get_fee()&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;system-call&quot;&gt;System Call&lt;&#x2F;h5&gt;
&lt;p&gt;At the end of processing any execution block starting from the &lt;code&gt;FORK_BLOCK&lt;&#x2F;code&gt; (i.e. after processing all transactions and after performing the block body withdrawal requests validations), call &lt;code&gt;WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;code&gt; as &lt;code&gt;SYSTEM_ADDRESS&lt;&#x2F;code&gt; with no calldata. The invocation triggers the following:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The contract&#x27;s queue is updated based on withdrawal requests dequeued and the withdrawal requests queue head&#x2F;tail are reset if the queue has been cleared (&lt;code&gt;dequeue_withdrawal_requests()&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;The contract&#x27;s excess withdrawal requests are updated based on usage in the current block (&lt;code&gt;update_excess_withdrawal_requests()&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;The contract&#x27;s withdrawal requests count is reset to 0 (&lt;code&gt;reset_withdrawal_requests_count()&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Each withdrawal request must appear in the EIP-7685 requests list in the exact order returned by &lt;code&gt;dequeue_withdrawal_requests()&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, the system call and the processing of that block must conform to the following:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The call has a dedicated gas limit of &lt;code&gt;30_000_000&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Gas consumed by this call does not count against the block’s overall gas usage.&lt;&#x2F;li&gt;
&lt;li&gt;Both the gas limit assigned to the call and the gas consumed are excluded from any checks against the block’s gas limit.&lt;&#x2F;li&gt;
&lt;li&gt;The call does not follow &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; fee burn semantics — no value should be transferred as part of this call.&lt;&#x2F;li&gt;
&lt;li&gt;If there is no code at &lt;code&gt;WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;code&gt;, the corresponding block &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be marked invalid.&lt;&#x2F;li&gt;
&lt;li&gt;If the call to the contract fails or returns an error, the block &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be invalidated.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The functionality triggered by the system call is defined in pseudocode as the function &lt;code&gt;read_withdrawal_requests()&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;##################&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Public function #&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;##################&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; read_withdrawal_requests&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    reqs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; dequeue_withdrawal_requests&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    update_excess_withdrawal_requests&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    reset_withdrawal_requests_count&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; ssz&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;serialize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;reqs&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;##########&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Helpers #&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;##########&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; little_endian_to_uint64&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;little&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; uint64_to_little_endian&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;num&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; num&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;to_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;8&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;little&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ValidatorWithdrawalRequest&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;object&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    source_address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    validator_pubkey&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes48&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    amount&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; dequeue_withdrawal_requests&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    queue_head_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; WITHDRAWAL_REQUEST_QUEUE_HEAD_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    queue_tail_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; WITHDRAWAL_REQUEST_QUEUE_TAIL_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    num_in_queue&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; queue_tail_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; queue_head_index&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    num_dequeued&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;num_in_queue&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_WITHDRAWAL_REQUESTS_PER_BLOCK&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    reqs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;num_dequeued&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        queue_storage_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; WITHDRAWAL_REQUEST_QUEUE_STORAGE_OFFSET&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;queue_head_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        source_address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; queue_storage_slot&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;20&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        validator_pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; queue_storage_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; queue_storage_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;16&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; little_endian_to_uint64&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; queue_storage_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;16&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;24&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        req&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; ValidatorWithdrawalRequest&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            source_address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;Bytes20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;source_address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            validator_pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;Bytes48&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;validator_pubkey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;uint64&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        reqs&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;req&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    new_queue_head_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; queue_head_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; num_dequeued&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; new_queue_head_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; queue_tail_index&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Queue is empty, reset queue pointers&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; WITHDRAWAL_REQUEST_QUEUE_HEAD_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; WITHDRAWAL_REQUEST_QUEUE_TAIL_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; WITHDRAWAL_REQUEST_QUEUE_HEAD_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; new_queue_head_index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; reqs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; update_excess_withdrawal_requests&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    previous_excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EXCESS_WITHDRAWAL_REQUESTS_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; previous_excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EXCESS_INHIBITOR&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        previous_excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    count&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; WITHDRAWAL_REQUEST_COUNT_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    new_excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; previous_excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; count&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TARGET_WITHDRAWAL_REQUESTS_PER_BLOCK&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        new_excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; previous_excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; count&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TARGET_WITHDRAWAL_REQUESTS_PER_BLOCK&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EXCESS_WITHDRAWAL_REQUESTS_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; new_excess&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; reset_withdrawal_requests_count&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; WITHDRAWAL_REQUEST_COUNT_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;bytecode&quot;&gt;Bytecode&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;asm&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;caller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push20 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xfffffffffffffffffffffffffffffffffffffffe&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;eq&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xcb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x11&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push32 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;eq&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x01f4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;mul&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;iszero&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x68&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;mul&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;mul&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;div&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x4d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jump&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;div&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;calldatasize&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x38&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;eq&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x88&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;calldatasize&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x01f4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;callvalue&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x01f4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;callvalue&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;lt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x01f4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x03&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x03&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;mul&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x04&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;caller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;caller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x60&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;shl&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x38&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x14&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;calldatacopy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x4c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;log0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x03&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;stop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x03&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x02&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;sub&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x10&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xdf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x10&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;eq&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x0183&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x03&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;mul&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x04&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x4c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;mul&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x60&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;shl&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x14&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x02&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push32 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xffffffffffffffffffffffffffffffff00000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;and&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x10&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x40&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;shr&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x38&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;shr&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x07&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x30&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;shr&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x06&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x28&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;shr&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x05&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;shr&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x04&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x18&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;shr&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x03&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x10&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;shr&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x02&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x08&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;shr&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xe1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jump&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;eq&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x0195&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x02&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x01a0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jump&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x02&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x03&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push32 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;eq&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;iszero&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x01cd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x02&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x01e2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x01e8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jump&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x02&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;sub&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x4c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;mul&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;revert&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;deployment&quot;&gt;Deployment&lt;&#x2F;h5&gt;
&lt;p&gt;The withdrawal requests contract is deployed like any other smart contract. A special synthetic address is generated by working backwards from the desired deployment transaction:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; null&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x3d090&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gasPrice&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xe8d4a51000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;maxPriorityFeePerGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; null&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;maxFeePerGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; null&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;input&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff5f556101f880602d5f395ff33373fffffffffffffffffffffffffffffffffffffffe1460cb5760115f54807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff146101f457600182026001905f5b5f82111560685781019083028483029004916001019190604d565b909390049250505036603814608857366101f457346101f4575f5260205ff35b34106101f457600154600101600155600354806003026004013381556001015f35815560010160203590553360601b5f5260385f601437604c5fa0600101600355005b6003546002548082038060101160df575060105b5f5b8181146101835782810160030260040181604c02815460601b8152601401816001015481526020019060020154807fffffffffffffffffffffffffffffffff00000000000000000000000000000000168252906010019060401c908160381c81600701538160301c81600601538160281c81600501538160201c81600401538160181c81600301538160101c81600201538160081c81600101535360010160e1565b910180921461019557906002556101a0565b90505f6002555f6003555b5f54807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14156101cd57505f5b6001546002828201116101e25750505f6101e8565b01600290035b5f555f600155604c025ff35b5f5ffd&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;v&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x539&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x5feeb084551e4e03a3581e269bc2ea2f8d0008&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x8ded54be89448d78d4bc97782c0187b099e45380ab681742f9d3754e405c2572&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Sender: 0x8646861A7cF453dDD086874d622b0696dE5b9674&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Address: 0x00000961Ef480Eb55e80D19ad83579A64c007002&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;consensus-layer&quot;&gt;Consensus layer&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;7bf43d1bc4fdb91059f0e6f4f7f0f3349b144950&#x2F;specs&#x2F;electra&#x2F;beacon-chain.md&quot;&gt;Full specification&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Sketch of spec:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;New operation &lt;code&gt;ExecutionLayerWithdrawalRequest&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Will show up in &lt;code&gt;ExecutionPayload&lt;&#x2F;code&gt; as an SSZ List bound by length &lt;code&gt;MAX_WITHDRAWAL_REQUESTS_PER_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;New function that has similar functionality to &lt;code&gt;process_voluntary_exit&lt;&#x2F;code&gt; but can fail validations (e.g. validator is already exited) without the block failing (similar to deposit coming from EL)&lt;&#x2F;li&gt;
&lt;li&gt;This function is called in &lt;code&gt;process_operations&lt;&#x2F;code&gt; for each &lt;code&gt;ExecutionLayerWithdrawalRequest&lt;&#x2F;code&gt; found in the &lt;code&gt;ExecutionPayload&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;validator-pubkey-field&quot;&gt;&lt;code&gt;validator_pubkey&lt;&#x2F;code&gt; field&lt;&#x2F;h3&gt;
&lt;p&gt;Multiple validators can utilize the same execution layer withdrawal credential, thus the &lt;code&gt;validator_pubkey&lt;&#x2F;code&gt; field is utilized to disambiguate which validator is being exited.&lt;&#x2F;p&gt;
&lt;p&gt;Note, &lt;code&gt;validator_index&lt;&#x2F;code&gt; also disambiguates validators.
The problem is that smart contracts of some staking pools are not aware of the indices, because the index becomes known only after the validator has been created on the beacon chain, while the pubkey is available in advance.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;message-queue&quot;&gt;Message queue&lt;&#x2F;h3&gt;
&lt;p&gt;The contract maintains an in-state queue of withdrawal request messages to be dequeued each block into the block and thus into the execution layer.&lt;&#x2F;p&gt;
&lt;p&gt;The number of withdrawal requests that can be passed into the consensus layer are bound by &lt;code&gt;MAX_WITHDRAWAL_REQUESTS_PER_BLOCK&lt;&#x2F;code&gt; to bound the load both on the block size as well as on the consensus layer processing. &lt;code&gt;16&lt;&#x2F;code&gt; has been chosen for &lt;code&gt;MAX_WITHDRAWAL_REQUESTS_PER_BLOCK&lt;&#x2F;code&gt; to be in line with the bounds of similar operations on the beacon chain -- e.g. &lt;code&gt;VoluntaryExit&lt;&#x2F;code&gt; and &lt;code&gt;Deposit&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Although there is a maximum number of withdrawal requests that can be passed to the consensus layer each block, the execution layer gas limit can provide for far more calls to the withdrawal request predeploy contract at each block. The queue then allows for these calls to successfully be made while still maintaining a system rate limit.&lt;&#x2F;p&gt;
&lt;p&gt;The alternative design considered was to have calls to the contract fail after &lt;code&gt;MAX_WITHDRAWAL_REQUESTS_PER_BLOCK&lt;&#x2F;code&gt; successful calls were made within the context of a single block. This would eliminate the need for the message queue, but would come at the cost of a bad UX of contract call failures in times of high exiting. The complexity to mitigate this bad UX is relatively low and is currently favored.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;rate-limiting-using-a-fee&quot;&gt;Rate limiting using a fee&lt;&#x2F;h3&gt;
&lt;p&gt;Transactions are naturally rate-limited in the execution layer via the gas limit, but an adversary willing to pay market-rate gas fees (and potentially utilize builder markets to pay for front-of-block transaction inclusion) can fill up the exit operation limits for relatively cheap, thus griefing honest validators that want to make a withdrawal request.&lt;&#x2F;p&gt;
&lt;p&gt;There are two general approaches to combat this griefing -- (a) only allow validators to send such messages and with a limit per time period or (b) utilize an economic method to make such griefing increasingly costly.&lt;&#x2F;p&gt;
&lt;p&gt;Method (a) (not used in this EIP) would require &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4788&#x2F;&quot;&gt;EIP-4788&lt;&#x2F;a&gt; (the &lt;code&gt;BEACON_ROOT&lt;&#x2F;code&gt; opcode) against which to prove withdrawal credentials in relation to validator pubkeys as well as a data-structure to track requests per-unit-time (e.g. 4 months) to ensure that a validator cannot grief the mechanism by submitting many requests. The downsides of this method are that it requires another cross-layer EIP and that it is of higher cross-layer complexity (e.g. care that might need to be taken in future upgrades if, for example, the shape of the merkle tree of &lt;code&gt;BEACON_ROOT&lt;&#x2F;code&gt; changes, then the contract and proof structure might need to be updated).&lt;&#x2F;p&gt;
&lt;p&gt;Method (b) has been utilized in this EIP to eliminate additional EIP requirements and to reduce cross-layer complexity to allow for correctness of this EIP (now and in the future) to be easier to analyze. The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt;-style mechanism with a dynamically adjusting fee mechanism allows for users to pay &lt;code&gt;MIN_WITHDRAWAL_REQUEST_FEE&lt;&#x2F;code&gt; for withdrawal requests in the normal case (fewer than 2 per block on average), but scales the fee up exponentially in response to high usage (i.e. potential abuse).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;target-withdrawal-requests-per-block-configuration-value&quot;&gt;&lt;code&gt;TARGET_WITHDRAWAL_REQUESTS_PER_BLOCK&lt;&#x2F;code&gt; configuration value&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;TARGET_WITHDRAWAL_REQUESTS_PER_BLOCK&lt;&#x2F;code&gt; has been selected as &lt;code&gt;2&lt;&#x2F;code&gt; such that the growth of the partial withdrawal queue in the beacon state is negligible under extreme scenarios of the exit churn congestion.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;fee-update-rule&quot;&gt;Fee update rule&lt;&#x2F;h3&gt;
&lt;p&gt;The fee update rule is intended to approximate the formula &lt;code&gt;fee = MIN_WITHDRAWAL_REQUEST_FEE * e**(excess &#x2F; WITHDRAWAL_REQUEST_FEE_UPDATE_FRACTION)&lt;&#x2F;code&gt;, where &lt;code&gt;excess&lt;&#x2F;code&gt; is the total &quot;extra&quot; amount of withdrawal requests that the chain has processed relative to the &quot;targeted&quot; number (&lt;code&gt;TARGET_WITHDRAWAL_REQUESTS_PER_BLOCK&lt;&#x2F;code&gt; per block).&lt;&#x2F;p&gt;
&lt;p&gt;Like EIP-1559, it’s a self-correcting formula: as the excess goes higher, the &lt;code&gt;fee&lt;&#x2F;code&gt; increases exponentially, reducing usage and eventually forcing the excess back down.&lt;&#x2F;p&gt;
&lt;p&gt;The block-by-block behavior is roughly as follows. If block &lt;code&gt;N&lt;&#x2F;code&gt; processes &lt;code&gt;X&lt;&#x2F;code&gt; requests, then at the end of block &lt;code&gt;N&lt;&#x2F;code&gt; &lt;code&gt;excess&lt;&#x2F;code&gt; increases by &lt;code&gt;X - TARGET_WITHDRAWAL_REQUESTS_PER_BLOCK&lt;&#x2F;code&gt;, and so the &lt;code&gt;fee&lt;&#x2F;code&gt; in block &lt;code&gt;N+1&lt;&#x2F;code&gt; increases by a factor of &lt;code&gt;e**((X - TARGET_WITHDRAWAL_REQUESTS_PER_BLOCK) &#x2F; WITHDRAWAL_REQUEST_FEE_UPDATE_FRACTION)&lt;&#x2F;code&gt;. Hence, it has a similar effect to the existing EIP-1559, but is more &quot;stable&quot; in the sense that it responds in the same way to the same total withdrawal requests regardless of how they are distributed over time.&lt;&#x2F;p&gt;
&lt;p&gt;The parameter &lt;code&gt;WITHDRAWAL_REQUEST_FEE_UPDATE_FRACTION&lt;&#x2F;code&gt; controls the maximum downwards rate of change of the blob gas price. It is chosen to target a maximum downwards change rate of &lt;code&gt;e(TARGET_WITHDRAWAL_REQUESTS_PER_BLOCK &#x2F; WITHDRAWAL_REQUEST_FEE_UPDATE_FRACTION) ≈ 1.125&lt;&#x2F;code&gt; per block.&lt;&#x2F;p&gt;
&lt;p&gt;More detailed analysis of the fee mechanism is available &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7002&#x2F;assets&#x2F;fee_analysis&#x2F;&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;withdrawal-requests-inside-of-the-block&quot;&gt;Withdrawal requests inside of the block&lt;&#x2F;h3&gt;
&lt;p&gt;Withdrawal requests are placed into the actual body of the beacon block.&lt;&#x2F;p&gt;
&lt;p&gt;There is a strong design requirement that the consensus layer and execution layer can execute independently of each other. This means, in this case, that the consensus layer cannot rely upon a synchronous call to the execution layer to get the required withdrawal requests for the current block. Instead, the requests must be embedded in the beacon block such that if the execution layer is offline, the consensus layer still has the requisite data to fully execute the consensus portion of the state transition function.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;submitting-requests-via-execution-layer&quot;&gt;Submitting requests via execution layer&lt;&#x2F;h3&gt;
&lt;p&gt;Verifying &lt;code&gt;secp256k1&lt;&#x2F;code&gt; signatures from the consensus layer via Engine API is one of the alternatives to the proposed requests mechanism which engineering complexity is much lower.
However, this approach would limit usage of withdrawal requests to a large extent by making it impossible for smart contracts owning validator withdrawal credentials to benefit from this functionality.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces backwards incompatible changes to the block structure and block validation rule set. But neither of these changes break anything related to current user activity and experience.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;impact-on-existing-custody-relationships&quot;&gt;Impact on existing custody relationships&lt;&#x2F;h3&gt;
&lt;p&gt;There might be existing custody relationships and&#x2F;or products that rely upon the assumption that the withdrawal credentials &lt;em&gt;cannot&lt;&#x2F;em&gt; trigger a withdrawal request. We are currently confident that the additional withdrawal credentials feature does not impact the security of existing validators because:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The withdrawal credentials ultimately own the funds so allowing them to exit staking is natural with respect to ownership.&lt;&#x2F;li&gt;
&lt;li&gt;We are currently not aware of any such custody relationships and&#x2F;or products that do rely on the lack of this feature.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;In the event that existing validators&#x2F;custodians rely on this, then the validators can be exited and restaked utilizing 0x01 withdrawal credentials pointing to a smart contract that simulates this behaviour.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;fee-overpayment&quot;&gt;Fee Overpayment&lt;&#x2F;h3&gt;
&lt;p&gt;Calls to the system contract require a fee payment defined by the current contract state. Overpaid fees are not returned to the caller. It is not generally possible to compute the exact required fee amount ahead of time. When adding a withdrawal request from a contract, the contract can perform a read operation to check for the current fee and then pay exactly the required amount. Here is an example in Solidity:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function addWithdrawal(bytes memory pubkey, uint64 amount, uint64 requestFeeLimit) private {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    assert(pubkey.length == 48);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; Read current fee from the contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (bool readOK, bytes memory feeData) = WithdrawalsContract.staticcall(&amp;#39;&amp;#39;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if (!readOK) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        revert(&amp;#39;reading fee failed&amp;#39;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    uint256 fee = uint256(bytes32(feeData));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; Check the fee is not too high.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if (fee &amp;gt; requestFeeLimit) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        revert(&amp;#39;fee is too high&amp;#39;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; Add the request.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytes memory callData = abi.encodePacked(pubkey, amount);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (bool writeOK,) = WithdrawalsContract.call{value: fee}(callData);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if (!writeOK) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        revert(&amp;#39;adding request failed&amp;#39;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note: the system contract uses the EVM &lt;code&gt;CALLER&lt;&#x2F;code&gt; operation (Solidity: &lt;code&gt;msg.sender&lt;&#x2F;code&gt;) as the target address for withdrawals, i.e. the address that calls the system contract must match the 0x01 withdrawal credential recorded in the beacon state.&lt;&#x2F;p&gt;
&lt;p&gt;Note: the above code reverts if the fee is too high, the fee can change significantly between creation of a withdrawal request transaction and its inclusion into a block, thus, this check is very important to avoid overpayments.&lt;&#x2F;p&gt;
&lt;p&gt;Using an EOA to request withdrawals will always result in overpayment of fees. There is no way for an EOA to use a wrapper contract to request a withdrawal. And even if a way existed, the gas cost of returning the overage would likely be higher than the overage itself. If requesting withdrawals to an EOA through the system contract is desired, we recommend that users perform transaction simulations to estimate a reasonable fee amount to send.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;system-call-failure&quot;&gt;System Call failure&lt;&#x2F;h3&gt;
&lt;p&gt;Although the likelihood of a failed system call to &lt;code&gt;WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;code&gt; is extremely low, the behavior in such cases is well-defined: the block is marked as invalid. However, if the failure results from processing a transaction within the block, the public mempool may still retain the transaction even after the block is invalidated. This can result in the offending transaction being included again, potentially causing one or more subsequent slots to go without valid blocks. To mitigate this, we recommend that the block producer implementation shuffle their transaction set to increase the chances of producing a valid block, without the offending transaction(s). The block producer implementation and&#x2F;or the mempool should be aware of system call failure scenarios to enable this behavior.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;empty-code-failure&quot;&gt;Empty Code failure&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP should not have been activated if there is no code present at &lt;code&gt;WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;code&gt; (i.e., if the chain is not &quot;ready&quot;). Doing so would cause the first and all subsequent blocks after &lt;code&gt;FORK_BLOCK&lt;&#x2F;code&gt; to be marked invalid.&lt;&#x2F;p&gt;
&lt;p&gt;If this situation occurs on a live chain, the following are two potential recovery strategies:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Deploy the contract code via a transaction and include it in a block. This block would become the first valid block, provided the system call to the contract does not fail. This works because the empty code validation occurs after block-transactions execution.&lt;&#x2F;li&gt;
&lt;li&gt;Postpone the &lt;code&gt;FORK_BLOCK&lt;&#x2F;code&gt; activation point by updating the consensual fork timestamp or block number in the client implementation(s), then deploy the contract before the fork activates.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>ERC-721 with transaction validation step.</title>
        <published>2023-05-07T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Eduard López i Fina</name><uri>https://github.com/eduardfina</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6997/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc721-with-a-validation-step/14071" />
        

        <id>https://wg-eips.ritovision.com/6997/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:6997"
            label="ERC-6997" />
        

        
        

        
        <summary type="html">A new validation step for transfer and approve calls, achieving a security step in case of stolen wallet.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6997/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is an extension of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;. It defines new validation functionality to avoid wallet draining: every &lt;code&gt;transfer&lt;&#x2F;code&gt; or &lt;code&gt;approve&lt;&#x2F;code&gt; will be locked waiting for validation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The power of the blockchain is at the same time its weakness: giving the user full responsibility for their data.&lt;&#x2F;p&gt;
&lt;p&gt;Many cases of NFT theft currently exist, and current NFT anti-theft schemes, such as transferring NFTs to cold wallets, make NFTs inconvenient to use.&lt;&#x2F;p&gt;
&lt;p&gt;Having a validation step before every &lt;code&gt;transfer&lt;&#x2F;code&gt; and &lt;code&gt;approve&lt;&#x2F;code&gt; would give Smart Contract developers the opportunity to create secure NFT anti-theft schemes.&lt;&#x2F;p&gt;
&lt;p&gt;An implementation example would be a system where a validator address is responsible for validating all Smart Contract transactions.&lt;&#x2F;p&gt;
&lt;p&gt;This address would be connected to a dApp where the user could see the validation requests of his NFTs and accept the correct ones.&lt;&#x2F;p&gt;
&lt;p&gt;Giving this address only the power to validate transactions would make a much more secure system where to steal an NFT the thief would have to have both the user&#x27;s address and the validator address simultaneously.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot; and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; compliant contracts MAY implement this EIP.&lt;&#x2F;p&gt;
&lt;p&gt;All the operations that change the ownership of an NFT, like a &lt;code&gt;transferFrom&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt;, SHALL create a &lt;code&gt;TransferValidation&lt;&#x2F;code&gt; pending to be validated and emit a &lt;code&gt;ValidateTransfer&lt;&#x2F;code&gt;, and SHALL NOT transfer the ownership of an NFT.&lt;&#x2F;p&gt;
&lt;p&gt;All the operations that enable an approval to manage an NFT, like an &lt;code&gt;approve&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;setApprovalForAll&lt;&#x2F;code&gt;, SHALL create an &lt;code&gt;ApprovalValidation&lt;&#x2F;code&gt; pending to be validated and emit a &lt;code&gt;ValidateApproval&lt;&#x2F;code&gt;, and SHALL NOT enable an approval.&lt;&#x2F;p&gt;
&lt;p&gt;When the transfer is called by an approved account and not the owner, it MUST be executed directly without the need for validation. This is in order to adapt to all current marketplaces that require approve to directly move your NFTs.&lt;&#x2F;p&gt;
&lt;p&gt;When validating a &lt;code&gt;TransferValidation&lt;&#x2F;code&gt; or &lt;code&gt;ApprovalValidation&lt;&#x2F;code&gt; the valid field MUST be set to true and MUST NOT be validated again.&lt;&#x2F;p&gt;
&lt;p&gt;The operations that validate a &lt;code&gt;TransferValidation&lt;&#x2F;code&gt; SHALL change the ownership of the NFT or enable the approval.&lt;&#x2F;p&gt;
&lt;p&gt;The operations that validate an &lt;code&gt;ApprovalValidation&lt;&#x2F;code&gt; SHALL enable the approval.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;contract-interface&quot;&gt;Contract Interface&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6997&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransferValidation&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; from&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the receiver.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token Id.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Whether is a valid transfer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span&gt; valid&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ApprovalValidation&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The approved address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; approve&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token Id.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Whether it is a total approval.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span&gt; approveAll&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Whether it is a valid approval.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span&gt; valid&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a new transfer validation has been requested.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ValidateTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; transferValidationId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a new approval validation has been requested.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ValidateApproval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approve&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approveAll&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approvalValidationId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns true if this contract is a validator ERC721.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isValidatorContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the transfer validation struct using the transfer ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferValidation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; transferId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;TransferValidation&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the approval validation struct using the approval ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approvalValidation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approvalId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;ApprovalValidation&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Return the total amount of transfer validations created.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalTransferValidations&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Return the total amount of transfer validations created.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalApprovalValidations&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;isValidatorContract()&lt;&#x2F;code&gt; function MUST be implemented as &lt;code&gt;public&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;transferValidation(uint256 transferId)&lt;&#x2F;code&gt; function MAY be implemented as &lt;code&gt;public&lt;&#x2F;code&gt; or &lt;code&gt;external&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;approvalValidation(uint256 approveId)&lt;&#x2F;code&gt; function MAY be implemented as &lt;code&gt;public&lt;&#x2F;code&gt; or &lt;code&gt;external&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;totalTransferValidations()&lt;&#x2F;code&gt; function MAY be implemented as &lt;code&gt;pure&lt;&#x2F;code&gt; or &lt;code&gt;view&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;totalApprovalValidations()&lt;&#x2F;code&gt; function MAY be implemented as &lt;code&gt;pure&lt;&#x2F;code&gt; or &lt;code&gt;view&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;universality&quot;&gt;Universality&lt;&#x2F;h3&gt;
&lt;p&gt;The standard only defines the validation functions, but not how they should be used. It defines the validations as internal and lets the user decide how to manage them.&lt;&#x2F;p&gt;
&lt;p&gt;An example could be to have an address validator connected to a dApp so that users could manage their validations.&lt;&#x2F;p&gt;
&lt;p&gt;This validator could be used for all NFTs or only for some users.&lt;&#x2F;p&gt;
&lt;p&gt;It could also be used as a wrapped Smart Contract for existing ERC-721, allowing 1&#x2F;1 conversion with existing NFTs.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;extensibility&quot;&gt;Extensibility&lt;&#x2F;h3&gt;
&lt;p&gt;This standard only defines the validation function, but does not define the system with which it has to be validated. A third-party protocol can define how it wants to call these functions as it wishes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is an extension of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;, compatible with all the operations except &lt;code&gt;transferFrom&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;approve&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;setApprovalForAll&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This operations will be overridden to create a validation petition instead of transfer ownership of an NFT or enable an approval.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERC6997.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC721&#x2F;ERC721.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Implementation of ERC6997&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC6997&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6997&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC721&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Mapping from transfer ID to transfer validation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; TransferValidation&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _transferValidations&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Mapping from approval ID to approval validation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; ApprovalValidation&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _approvalValidations&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Total number of transfer validations&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _totalTransferValidations&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Total number of approval validations&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _totalApprovalValidations&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Initializes the contract by setting a `name` and a `symbol` to the token collection.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; symbol_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;name_, symbol_)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns true if this contract is a validator ERC721.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isValidatorContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the transfer validation struct using the transfer ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferValidation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; transferId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;TransferValidation&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;transferId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; _totalTransferValidations&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC6997: invalid transfer ID&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        TransferValidation &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;memory&lt;&#x2F;span&gt;&lt;span&gt; v &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _transferValidation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;transferId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the approval validation struct using the approval ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approvalValidation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approvalId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;ApprovalValidation&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;approvalId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; _totalApprovalValidations&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC6997: invalid approval ID&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ApprovalValidation &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;memory&lt;&#x2F;span&gt;&lt;span&gt; v &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _approvalValidation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;approvalId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Return the total amount of transfer validations created.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalTransferValidations&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _totalTransferValidations&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Return the total amount of approval validations created.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalApprovalValidations&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _totalApprovalValidations&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the transfer validation of the `transferId`. Does NOT revert if transfer doesn&amp;#39;t exist&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _transferValidation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; transferId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;TransferValidation&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _transferValidations&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;transferId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the approval validation of the `approvalId`. Does NOT revert if transfer doesn&amp;#39;t exist&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _approvalValidation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approvalId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;ApprovalValidation&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _approvalValidations&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;approvalId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Validate the transfer using the transfer ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _validateTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; transferId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        TransferValidation &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;memory&lt;&#x2F;span&gt;&lt;span&gt; v &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferValidation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;transferId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;valid&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC6997: the transfer is already validated&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; from &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; to &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; tokenId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _transferValidations&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;transferId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;valid &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Validate the approval using the approval ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _validateApproval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approvalId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ApprovalValidation &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;memory&lt;&#x2F;span&gt;&lt;span&gt; v &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approvalValidation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;approvalId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;valid&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC6997: the approval is already validated&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;approveAll&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;owner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC6997: The token have a new owner&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;approve&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_setApprovalForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;approve&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _approvalValidations&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;approvalId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;valid &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Create a transfer petition of `tokenId` from `from` to `to`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - `to` cannot be the zero address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - `tokenId` token must be owned by `from`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Emits a {TransferValidate} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ERC721&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC6997: transfer from incorrect owner&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;to &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC6997: transfer to the zero address&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_msgSender&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; from&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            TransferValidation &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;memory&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; from&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;to &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;tokenId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            _transferValidations&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_totalTransferValidations&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ValidateTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _totalTransferValidations&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            _totalTransferValidations&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Create an approval petition from `to` to operate on `tokenId`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Emits an {ValidateApproval} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ApprovalValidation &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;memory&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;owner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;approve &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;tokenId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _approvalValidations&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_totalApprovalValidations&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ValidateApproval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _totalApprovalValidations&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _totalApprovalValidations&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If approved is true create an approval petition from `operator` to operate on&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * all of `owner` tokens, if not remove `operator` from operate on all of `owner` tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Emits an {ValidateApproval} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _setApprovalForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;owner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC6997: approve to caller&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;approved&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            ApprovalValidation &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;memory&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;owner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;approve &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;approveAll &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            _approvalValidations&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_totalApprovalValidations&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ValidateApproval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _totalApprovalValidations&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            _totalApprovalValidations&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_setApprovalForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; approved&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;As is defined in the Specification the operations that change the ownership of an NFT or enable an approval to manage the NFT SHALL create a &lt;code&gt;TransferValidation&lt;&#x2F;code&gt; or an &lt;code&gt;ApprovalValidation&lt;&#x2F;code&gt; pending to be validated and SHALL NOT transfer the ownership of an NFT or enable an approval.&lt;&#x2F;p&gt;
&lt;p&gt;With this premise in mind, the operations in charge of validating a &lt;code&gt;TransferValidation&lt;&#x2F;code&gt; or an &lt;code&gt;ApprovalValidation&lt;&#x2F;code&gt; must be protected with the maximum security required by the applied system.&lt;&#x2F;p&gt;
&lt;p&gt;For example, a valid system would be one where there is a validator address in charge of validating the transactions.&lt;&#x2F;p&gt;
&lt;p&gt;To give another example, a system where each user could choose his validator address would also be correct.&lt;&#x2F;p&gt;
&lt;p&gt;In any case, the importance of security resides in the fact that no address can validate a &lt;code&gt;TransferValidation&lt;&#x2F;code&gt; or an &lt;code&gt;ApprovalValidation&lt;&#x2F;code&gt; without the permission of the chosen system.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>ERC-20 with transaction validation step.</title>
        <published>2023-05-07T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Eduard López i Fina</name><uri>https://github.com/eduardfina</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7144/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc721-with-a-validation-step/14071" />
        

        <id>https://wg-eips.ritovision.com/7144/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:7144"
            label="ERC-7144" />
        

        
        

        
        <summary type="html">A new validation step for transfer and approve calls, achieving a security step in case of stolen wallet.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7144/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is an extension of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;. It defines new validation functionality to avoid wallet draining: every &lt;code&gt;transfer&lt;&#x2F;code&gt; or &lt;code&gt;approve&lt;&#x2F;code&gt; will be locked waiting for validation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The power of the blockchain is at the same time its weakness: giving the user full responsibility for their data.&lt;&#x2F;p&gt;
&lt;p&gt;Many cases of Token theft currently exist, and current Token anti-theft schemes, such as transferring Tokens to cold wallets, make Tokens inconvenient to use.&lt;&#x2F;p&gt;
&lt;p&gt;Having a validation step before every &lt;code&gt;transfer&lt;&#x2F;code&gt; and &lt;code&gt;approve&lt;&#x2F;code&gt; would give Smart Contract developers the opportunity to create secure Token anti-theft schemes.&lt;&#x2F;p&gt;
&lt;p&gt;An implementation example would be a system where a validator address is responsible for validating all Smart Contract transactions.&lt;&#x2F;p&gt;
&lt;p&gt;This address would be connected to a dApp where the user could see the validation requests of his Tokens and accept the correct ones.&lt;&#x2F;p&gt;
&lt;p&gt;Giving this address only the power to validate transactions would make a much more secure system where to steal a Token the thief would have to have both the user&#x27;s address and the validator address simultaneously.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot; and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; compliant contracts MAY implement this EIP.&lt;&#x2F;p&gt;
&lt;p&gt;All the operations that change the ownership of Tokens, like a &lt;code&gt;transfer&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;transferFrom&lt;&#x2F;code&gt;, SHALL create a &lt;code&gt;TransferValidation&lt;&#x2F;code&gt; pending to be validated and emit a &lt;code&gt;ValidateTransfer&lt;&#x2F;code&gt;, and SHALL NOT transfer the Tokens.&lt;&#x2F;p&gt;
&lt;p&gt;All the operations that enable an approval to manage a Token, like an &lt;code&gt;approve&lt;&#x2F;code&gt;, SHALL create an &lt;code&gt;ApprovalValidation&lt;&#x2F;code&gt; pending to be validated and emit a &lt;code&gt;ValidateApproval&lt;&#x2F;code&gt;, and SHALL NOT enable an approval.&lt;&#x2F;p&gt;
&lt;p&gt;When the transfer is called by an approved account and not the owner, it MUST be executed directly without the need for validation. This is in order to adapt to all current projects that require approve to directly move your Tokens.&lt;&#x2F;p&gt;
&lt;p&gt;When validating a &lt;code&gt;TransferValidation&lt;&#x2F;code&gt; or &lt;code&gt;ApprovalValidation&lt;&#x2F;code&gt; the valid field MUST be set to true and MUST NOT be validated again.&lt;&#x2F;p&gt;
&lt;p&gt;The operations that validate a &lt;code&gt;TransferValidation&lt;&#x2F;code&gt; SHALL change the ownership of the Tokens.&lt;&#x2F;p&gt;
&lt;p&gt;The operations that validate an &lt;code&gt;ApprovalValidation&lt;&#x2F;code&gt; SHALL enable the approval.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;contract-interface&quot;&gt;Contract Interface&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7144&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransferValidation&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; from&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the receiver.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token amount.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Whether is a valid transfer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span&gt; valid&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ApprovalValidation&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The spender address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token amount approved.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Whether is a valid approval.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span&gt; valid&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a new transfer validation has been requested.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ValidateTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; transferValidationId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a new approval validation has been requested.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ValidateApproval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approvalValidationId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns true if this contract is a validator ERC20.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isValidatorContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the transfer validation struct using the transfer ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferValidation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; transferId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;TransferValidation&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the approval validation struct using the approval ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approvalValidation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approvalId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;ApprovalValidation&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Return the total amount of transfer validations created.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalTransferValidations&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Return the total amount of transfer validations created.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalApprovalValidations&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;isValidatorContract()&lt;&#x2F;code&gt; function MUST be implemented as &lt;code&gt;public&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;transferValidation(uint256 transferId)&lt;&#x2F;code&gt; function MAY be implemented as &lt;code&gt;public&lt;&#x2F;code&gt; or &lt;code&gt;external&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;approvalValidation(uint256 approveId)&lt;&#x2F;code&gt; function MAY be implemented as &lt;code&gt;public&lt;&#x2F;code&gt; or &lt;code&gt;external&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;totalTransferValidations()&lt;&#x2F;code&gt; function MAY be implemented as &lt;code&gt;pure&lt;&#x2F;code&gt; or &lt;code&gt;view&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;totalApprovalValidations()&lt;&#x2F;code&gt; function MAY be implemented as &lt;code&gt;pure&lt;&#x2F;code&gt; or &lt;code&gt;view&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;universality&quot;&gt;Universality&lt;&#x2F;h3&gt;
&lt;p&gt;The standard only defines the validation functions, but not how they should be used. It defines the validations as internal and lets the user decide how to manage them.&lt;&#x2F;p&gt;
&lt;p&gt;An example could be to have an address validator connected to a dApp so that users could manage their validations.&lt;&#x2F;p&gt;
&lt;p&gt;This validator could be used for all Tokens or only for some users.&lt;&#x2F;p&gt;
&lt;p&gt;It could also be used as a wrapped Smart Contract for existing ERC-20, allowing 1&#x2F;1 conversion with existing Tokens.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;extensibility&quot;&gt;Extensibility&lt;&#x2F;h3&gt;
&lt;p&gt;This standard only defines the validation function, but does not define the system with which it has to be validated. A third-party protocol can define how it wants to call these functions as it wishes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is an extension of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;, compatible with all the operations except &lt;code&gt;transfer&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;transferFrom&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;approve&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This operations will be overridden to create a validation petition instead of transfer the Tokens or enable an approval.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC20&#x2F;ERC20.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERC7144.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Implementation of ERC7144&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC7144&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7144&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC20&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Mapping from transfer ID to transfer validation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; TransferValidation&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _transferValidations&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Mapping from approval ID to approval validation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; ApprovalValidation&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _approvalValidations&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Total number of transfer validations&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _totalTransferValidations&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Total number of approval validations&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _totalApprovalValidations&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Initializes the contract by setting a `name` and a `symbol` to the token collection.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; symbol_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;name_, symbol_)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns true if this contract is a validator ERC721.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isValidatorContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the transfer validation struct using the transfer ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferValidation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; transferId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;TransferValidation&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;transferId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; _totalTransferValidations&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC7144: invalid transfer ID&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        TransferValidation &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;memory&lt;&#x2F;span&gt;&lt;span&gt; v &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _transferValidation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;transferId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the approval validation struct using the approval ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approvalValidation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approvalId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;ApprovalValidation&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;approvalId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; _totalApprovalValidations&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC7144: invalid approval ID&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ApprovalValidation &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;memory&lt;&#x2F;span&gt;&lt;span&gt; v &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _approvalValidation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;approvalId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Return the total amount of transfer validations created.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalTransferValidations&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _totalTransferValidations&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Return the total amount of approval validations created.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalApprovalValidations&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _totalApprovalValidations&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the transfer validation of the `transferId`. Does NOT revert if transfer doesn&amp;#39;t exist&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _transferValidation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; transferId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;TransferValidation&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _transferValidations&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;transferId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the approval validation of the `approvalId`. Does NOT revert if transfer doesn&amp;#39;t exist&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _approvalValidation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approvalId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;ApprovalValidation&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _approvalValidations&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;approvalId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Validate the transfer using the transfer ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _validateTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; transferId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        TransferValidation &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;memory&lt;&#x2F;span&gt;&lt;span&gt; v &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferValidation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;transferId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;valid&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC721V: the transfer is already validated&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _transferValidations&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;transferId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;valid &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Validate the approval using the approval ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _validateApproval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approvalId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ApprovalValidation &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;memory&lt;&#x2F;span&gt;&lt;span&gt; v &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approvalValidation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;approvalId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;valid&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC7144: the approval is already validated&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _approvalValidations&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;approvalId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;valid &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Create a transfer petition of `tokenId` from `from` to `to`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - `from` cannot be the zero address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - `to` cannot be the zero address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Emits a {ValidateTransfer} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;from &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC7144: transfer from the zero address&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;to &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC7144: transfer to the zero address&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_msgSender&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; from&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            TransferValidation &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;memory&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; from&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;to &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            _transferValidations&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_totalTransferValidations&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ValidateTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _totalTransferValidations&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            _totalTransferValidations&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Create an approval petition from `owner` to operate the `amount`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Emits an {ValidateApproval} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;owner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC7144: approve from the zero address&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;spender &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC7144: approve to the zero address&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ApprovalValidation &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;memory&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;owner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;spender &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _approvalValidations&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_totalApprovalValidations&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ValidateApproval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _totalApprovalValidations&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _totalApprovalValidations&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;As is defined in the Specification the operations that change the ownership of Tokens or enable an approval to manage the Tokens SHALL create a &lt;code&gt;TransferValidation&lt;&#x2F;code&gt; or an &lt;code&gt;ApprovalValidation&lt;&#x2F;code&gt; pending to be validated and SHALL NOT transfer the Tokens or enable an approval.&lt;&#x2F;p&gt;
&lt;p&gt;With this premise in mind, the operations in charge of validating a &lt;code&gt;TransferValidation&lt;&#x2F;code&gt; or an &lt;code&gt;ApprovalValidation&lt;&#x2F;code&gt; must be protected with the maximum security required by the applied system.&lt;&#x2F;p&gt;
&lt;p&gt;For example, a valid system would be one where there is a validator address in charge of validating the transactions.&lt;&#x2F;p&gt;
&lt;p&gt;To give another example, a system where each user could choose his validator address would also be correct.&lt;&#x2F;p&gt;
&lt;p&gt;In any case, the importance of security resides in the fact that no address can validate a &lt;code&gt;TransferValidation&lt;&#x2F;code&gt; or an &lt;code&gt;ApprovalValidation&lt;&#x2F;code&gt; without the permission of the chosen system.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Revamped CALL instructions</title>
        <published>2023-05-05T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	<author>
		<name>Paweł Bylica</name><uri>https://github.com/chfast</uri>
	</author>
	
	<author>
		<name>Danno Ferrin</name><uri>https://github.com/shemnon</uri>
	</author>
	
	<author>
		<name>Andrei Maiboroda</name><uri>https://github.com/gumb0</uri>
	</author>
	
	<author>
		<name>Charles Cooper</name><uri>https://github.com/charles-cooper</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7069/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-revamped-call-instructions/14432" />
        

        <id>https://wg-eips.ritovision.com/7069/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7069"
            label="EIP-7069" />
        

        
        

        
        <summary type="html">Introduce EXTCALL, EXTDELEGATECALL and EXTSTATICCALL with simplified semantics</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7069/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce three new call instructions, &lt;code&gt;EXTCALL&lt;&#x2F;code&gt;, &lt;code&gt;EXTDELEGATECALL&lt;&#x2F;code&gt; and &lt;code&gt;EXTSTATICCALL&lt;&#x2F;code&gt;, with simplified semantics. Introduce another instruction, &lt;code&gt;RETURNDATALOAD&lt;&#x2F;code&gt; for loading a word from return data into stack. Modify the behavior of &lt;code&gt;RETURNDATACOPY&lt;&#x2F;code&gt; instruction executed within EOF formatted code (as defined by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3540&#x2F;&quot;&gt;EIP-3540&lt;&#x2F;a&gt;). The existing &lt;code&gt;*CALL&lt;&#x2F;code&gt; instructions are rejected by EOF validation.&lt;&#x2F;p&gt;
&lt;p&gt;The new instructions do not allow specifying a gas limit, but rather rely on the &quot;63&#x2F;64th rule&quot; (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;150&#x2F;&quot;&gt;EIP-150&lt;&#x2F;a&gt;) to limit gas. An important improvement is the rules around the &quot;stipend&quot; are simplified, and callers do not need to perform special calculation whether the value is sent or not.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore, the obsolete functionality of specifying output buffer address is removed in favor of using &lt;code&gt;RETURNDATACOPY&lt;&#x2F;code&gt; instead. For cases which would previously &lt;code&gt;*CALL&lt;&#x2F;code&gt; output into a buffer and then &lt;code&gt;MLOAD&lt;&#x2F;code&gt; from the buffer, &lt;code&gt;RETURNDATALOAD&lt;&#x2F;code&gt; is provided instead.&lt;&#x2F;p&gt;
&lt;p&gt;Lastly, instead of returning a boolean for execution status, an extensible list of status codes is returned: &lt;code&gt;0&lt;&#x2F;code&gt; for success, &lt;code&gt;1&lt;&#x2F;code&gt; for revert, &lt;code&gt;2&lt;&#x2F;code&gt; for failure.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Observability of gas has been a problem for very long. The system of gas has been (and likely must be) flexible in adapting to changes to both how Ethereum is used as well as changes in underlying hardware.&lt;&#x2F;p&gt;
&lt;p&gt;Unfortunately, in many cases compromises or workarounds had to be made to avoid affecting call instructions negatively, mostly due to the complex semantics and expectations of them.&lt;&#x2F;p&gt;
&lt;p&gt;This change removes gas observability from the new instructions and opens the door for new classes of contracts that are not affected by repricings. Furthermore, the legacy call instructions are rejected within EOF contracts, making sure they are mostly unaffected by changes in gas fees. Because these operations are required for removing gas observability they are required for EOF in lieu of the existing legacy instructions.&lt;&#x2F;p&gt;
&lt;p&gt;It is important to note that starting Solidity 0.4.21, the compiler already passes all remaining gas to calls (using &lt;code&gt;call(gas(), ...&lt;&#x2F;code&gt;), unless the developer uses the explicit override (&lt;code&gt;{gas: ...}&lt;&#x2F;code&gt;) in the language. This suggests most contracts don&#x27;t rely on controlling gas.&lt;&#x2F;p&gt;
&lt;p&gt;Besides the above, this change introduces a convenience feature of returning more detailed status codes: &lt;code&gt;success (0)&lt;&#x2F;code&gt;, &lt;code&gt;revert (1)&lt;&#x2F;code&gt;, &lt;code&gt;failure (2)&lt;&#x2F;code&gt;. This moves from the boolean option to codes, which are extensible in the future.&lt;&#x2F;p&gt;
&lt;p&gt;Lastly, the introduction of the &lt;code&gt;RETURNDATA*&lt;&#x2F;code&gt; instructions (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;211&#x2F;&quot;&gt;EIP-211&lt;&#x2F;a&gt;) has obsoleted the output parameters of calls, in a large number of cases rendering them unused. Using the output buffers have caused &quot;bugs&quot; in the past: in the case of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;, conflicting implementations caused a lot of trouble, where some would return something, while others would not. With relying on &lt;code&gt;RETURNDATA*&lt;&#x2F;code&gt; instructions this is implicitly clarified. This proposal also adds the &quot;missing&quot; &lt;code&gt;RETURNDATALOAD&lt;&#x2F;code&gt; instruction to round out returndata buffer access instructions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Comment&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;WARM_STORAGE_READ_COST&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;td&gt;From &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;COLD_ACCOUNT_ACCESS&lt;&#x2F;td&gt;&lt;td&gt;2600&lt;&#x2F;td&gt;&lt;td&gt;From &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;CALL_VALUE_COST&lt;&#x2F;td&gt;&lt;td&gt;9000&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;ACCOUNT_CREATION_COST&lt;&#x2F;td&gt;&lt;td&gt;25000&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;MIN_RETAINED_GAS&lt;&#x2F;td&gt;&lt;td&gt;5000&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;MIN_CALLEE_GAS&lt;&#x2F;td&gt;&lt;td&gt;2300&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;We introduce four new instructions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;EXTCALL&lt;&#x2F;code&gt; (&lt;code&gt;0xf8&lt;&#x2F;code&gt;) with arguments &lt;code&gt;(target_address, input_offset, input_size, value)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;EXTDELEGATECALL&lt;&#x2F;code&gt; (&lt;code&gt;0xf9&lt;&#x2F;code&gt;) with arguments &lt;code&gt;(target_address, input_offset, input_size)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;EXTSTATICCALL&lt;&#x2F;code&gt; (&lt;code&gt;0xfb&lt;&#x2F;code&gt;) with arguments &lt;code&gt;(target_address, input_offset, input_size)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RETURNDATALOAD&lt;&#x2F;code&gt; (&lt;code&gt;0xf7&lt;&#x2F;code&gt;) with argument &lt;code&gt;offset&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;These four new instructions are undefined in legacy code and only available in EOF code.&lt;&#x2F;p&gt;
&lt;p&gt;Execution semantics of &lt;code&gt;EXT*CALL&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Charge &lt;code&gt;WARM_STORAGE_READ_COST&lt;&#x2F;code&gt; gas.&lt;&#x2F;li&gt;
&lt;li&gt;Pop required arguments from stack, halt with exceptional failure on stack underflow.
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;NOTE&lt;&#x2F;strong&gt;: When implemented in EOF, stack underflow check is done during stack validation and runtime check is omitted.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;value&lt;&#x2F;code&gt; is non-zero (only &lt;code&gt;EXTCALL&lt;&#x2F;code&gt;):
&lt;ul&gt;
&lt;li&gt;Halt with exceptional failure if the current frame is in &lt;code&gt;static-mode&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Charge &lt;code&gt;CALL_VALUE_COST&lt;&#x2F;code&gt; gas.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;target_address&lt;&#x2F;code&gt; has any of the high 12 bytes set to a non-zero value (i.e. it does not contain a 20-byte address) then halt with an exceptional failure.&lt;&#x2F;li&gt;
&lt;li&gt;Perform (and charge for) memory expansion using &lt;code&gt;[input_offset, input_size]&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;target_address&lt;&#x2F;code&gt; is not in the &lt;code&gt;warm_account_list&lt;&#x2F;code&gt;, charge &lt;code&gt;COLD_ACCOUNT_ACCESS - WARM_STORAGE_READ_COST&lt;&#x2F;code&gt; gas.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;target_address&lt;&#x2F;code&gt; is not in the state and the call configuration would result in account creation, charge &lt;code&gt;ACCOUNT_CREATION_COST&lt;&#x2F;code&gt; gas.
&lt;ul&gt;
&lt;li&gt;The only such case in this EIP is if &lt;code&gt;value&lt;&#x2F;code&gt; is non-zero (only &lt;code&gt;EXTCALL&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Calculate the gas available to callee as caller&#x27;s remaining gas reduced by &lt;code&gt;max(floor(gas&#x2F;64), MIN_RETAINED_GAS)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Clear the returndata buffer.&lt;&#x2F;li&gt;
&lt;li&gt;Fail with status code &lt;code&gt;1&lt;&#x2F;code&gt; returned on stack if any of the following is true (only gas charged until this point is consumed):
&lt;ul&gt;
&lt;li&gt;Gas available to callee at this point is less than &lt;code&gt;MIN_CALLEE_GAS&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Balance of the current account is less than &lt;code&gt;value&lt;&#x2F;code&gt; (only &lt;code&gt;EXTCALL&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;Current call stack depth equals &lt;code&gt;1024&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;(only &lt;code&gt;EXTDELEGATECALL&lt;&#x2F;code&gt;) &lt;code&gt;target_address&lt;&#x2F;code&gt; account in the state doesn&#x27;t have EOF code to execute (in particular, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; delegations should be resolved, as if &lt;code&gt;EXTCALL&lt;&#x2F;code&gt; was used)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Perform the call with the available gas and configuration.&lt;&#x2F;li&gt;
&lt;li&gt;Push a status code on the stack:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;0&lt;&#x2F;code&gt; if the call was successful.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;1&lt;&#x2F;code&gt; if the call has reverted (also can be pushed earlier in a light failure scenario described in step 10).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;2&lt;&#x2F;code&gt; if the call has failed (in case of general OOG failure or any scenario where all gas passed to the callee is burnt in case of an error).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Gas not used by the callee is returned to the caller.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Execution semantics of &lt;code&gt;RETURNDATALOAD&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Charge &lt;code&gt;3&lt;&#x2F;code&gt; gas&lt;&#x2F;li&gt;
&lt;li&gt;Pop 1 item from the stack, to be referred to as &lt;code&gt;offset&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Push 1 item onto the stack, the 32-byte word read from the returndata buffer starting at &lt;code&gt;offset&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;offset + 32 &amp;gt; len(returndata buffer)&lt;&#x2F;code&gt;, the result is zero-padded.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Execution semantics of &lt;code&gt;RETURNDATACOPY&lt;&#x2F;code&gt; in EOF formatted code (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3540&#x2F;&quot;&gt;EIP-3540&lt;&#x2F;a&gt;) is modified as follows:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Assume the 3 arguments popped from stack are &lt;code&gt;destOffset&lt;&#x2F;code&gt;, &lt;code&gt;offset&lt;&#x2F;code&gt; and &lt;code&gt;size&lt;&#x2F;code&gt;. &lt;em&gt;(no change)&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Performs memory expansion to &lt;code&gt;destOffset + size&lt;&#x2F;code&gt; and deducts memory expansion cost. &lt;em&gt;(no change)&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;offset + size &amp;gt; len(returndata buffer)&lt;&#x2F;code&gt; &lt;strong&gt;do not&lt;&#x2F;strong&gt; halt with exceptional failure, but instead set the &lt;code&gt;offset + size - len(returndata buffer)&lt;&#x2F;code&gt; memory bytes after the copied ones to zero.&lt;&#x2F;li&gt;
&lt;li&gt;Gas charged for memory copying remains &lt;code&gt;3 * num_words(size)&lt;&#x2F;code&gt;, regardless of the number of bytes actually copied or set to zero.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Execution of &lt;code&gt;RETURNDATACOPY&lt;&#x2F;code&gt; which is not in EOF formatted code (i.e. is in legacy code) is not changed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;removing-gas-selectability&quot;&gt;Removing gas selectability&lt;&#x2F;h3&gt;
&lt;p&gt;One major change from the original &lt;code&gt;CALL&lt;&#x2F;code&gt; series of instructions is that the caller has no control over the amount of gas passed in as part of the call. The number of cases where such a feature is essential are probably better served by direct protocol integration.&lt;&#x2F;p&gt;
&lt;p&gt;Removing gas selectability also introduces a valuable property that future revisions to the gas schedule will benefit from: you can always overcome Out of Gas (OOG) errors by sending more gas as part of the transaction (subject to the block gas limit). Previously when raising storage costs (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1884&#x2F;&quot;&gt;EIP-1884&lt;&#x2F;a&gt;) some contracts that sent only a limited amount of gas to their calls were broken by the new costing.&lt;&#x2F;p&gt;
&lt;p&gt;Hence some contracts had a gas ceiling they were sending to their next call, permanently limiting the amount of gas they could spend. No amount of extra gas could fix the issue as the call would limit the amount sent.  The notion of a stipend floor is retained in this spec. This floor can be changed independent of the smart contracts and still preserve the feature that OOG halts can be fixed by sending more gas as part of the transaction.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;stipend-and-63-64th-rule&quot;&gt;Stipend and 63&#x2F;64th rule&lt;&#x2F;h3&gt;
&lt;p&gt;The purpose of the stipend is to have enough gas to emit logs (i.e. perform non-state-changing operations) when a &quot;contract wallet&quot; is called. The stipend is only added when the &lt;code&gt;CALL&lt;&#x2F;code&gt; instruction is used and the value is non-zero.&lt;&#x2F;p&gt;
&lt;p&gt;The 63&#x2F;64th rule has multiple purposes:&lt;&#x2F;p&gt;
&lt;p&gt;a. to limit call depth,
b. to ensure the caller has gas left to make state changes after a callee returns.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, there is a call depth counter, and calls fail if the depth would exceed 1024.&lt;&#x2F;p&gt;
&lt;p&gt;Before the 63&#x2F;64th rule was introduced, it was required to calculate available gas semi-accurately on caller side. Solidity has a complicated ruleset where it tries to estimate how much it will cost on the caller side to perform the call itself, in order to set a reasonable gas value.&lt;&#x2F;p&gt;
&lt;p&gt;We have changed the ruleset:&lt;&#x2F;p&gt;
&lt;p&gt;The 63&#x2F;64th rule is still applied, but&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;At least &lt;code&gt;MIN_RETAINED_GAS&lt;&#x2F;code&gt; gas is retained prior to executing the callee,&lt;&#x2F;li&gt;
&lt;li&gt;At least &lt;code&gt;MIN_CALLEE_GAS&lt;&#x2F;code&gt; gas is available to the callee.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;code&gt;MIN_CALLEE_GAS&lt;&#x2F;code&gt; rule is a replacement for stipend: it simplifies the reasoning about the gas costs and is applied uniformly for all introduced &lt;code&gt;EXT*CALL&lt;&#x2F;code&gt; instructions.
The following table visualizes the differences (note the discrepancy between &lt;em&gt;caller required gas&lt;&#x2F;em&gt; and &lt;em&gt;caller cost&lt;&#x2F;em&gt; for &lt;code&gt;CALL&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;&#x2F;th&gt;&lt;th&gt;Caller required gas&lt;&#x2F;th&gt;&lt;th&gt;Caller cost (burned gas)&lt;&#x2F;th&gt;&lt;th&gt;Caller min retained gas&lt;&#x2F;th&gt;&lt;th&gt;Callee min gas&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;CALL V=0&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;CALL V≠0&lt;&#x2F;td&gt;&lt;td&gt;100+9000&lt;&#x2F;td&gt;&lt;td&gt;100+6700&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;2300&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;DELEGATECALL&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;STATICCALL&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;EXTCALL V=0&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;td&gt;5000&lt;&#x2F;td&gt;&lt;td&gt;2300&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;EXTCALL V≠0&lt;&#x2F;td&gt;&lt;td&gt;100+9000&lt;&#x2F;td&gt;&lt;td&gt;100+9000&lt;&#x2F;td&gt;&lt;td&gt;5000&lt;&#x2F;td&gt;&lt;td&gt;2300&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;EXTDELEGATECALL&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;td&gt;5000&lt;&#x2F;td&gt;&lt;td&gt;2300&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;EXTSTATICCALL&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;td&gt;5000&lt;&#x2F;td&gt;&lt;td&gt;2300&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Caller required gas&lt;&#x2F;strong&gt;: the minimum amount of gas a caller is required to have to execute a call instruction, lower value causes caller&#x27;s OOG,&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Caller cost (burned gas)&lt;&#x2F;strong&gt;: the amount of gas deducted from the caller to execute the instruction, this amount is not available to the callee,&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Caller min retained gas&lt;&#x2F;strong&gt;: the minimum amount of gas the caller is guaranteed to have after the call, if this cannot be guaranteed the call fails without even reaching the callee,&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Callee min gas&lt;&#x2F;strong&gt;: the minimum gas limit for the callee&#x27;s execution.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Removing the call stack depth check was initially considered, but this would be incompatible with the original &lt;code&gt;*CALL&lt;&#x2F;code&gt; instructions, as well as &lt;code&gt;CREATE*&lt;&#x2F;code&gt; instructions, which can be intertwined with the new &lt;code&gt;EXT*CALL&lt;&#x2F;code&gt; instructions in the call stack. As such, keeping the call stack depth check involves no change affecting legacy code.&lt;&#x2F;p&gt;
&lt;p&gt;Also, we find the simple (as opposed to the complex 63&#x2F;64th rule) hard cap reassuring, that the call stack depth is limited, in case the gas rules can be bypassed. Lastly, the amount of gas to reach depth of 1024 is huge, but not absurdly huge, and we want to avoid constraining ourselves by dependency of this check on current gas limits.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;output-buffers&quot;&gt;Output buffers&lt;&#x2F;h3&gt;
&lt;p&gt;The functionality of specifying output buffer address is removed, because it is added complexity and in a large number of cases implementers prefer to use &lt;code&gt;RETURNDATACOPY&lt;&#x2F;code&gt; instead. Even if they rely on the output buffer (like in the case of Vyper), they would still check the length with &lt;code&gt;RETURNDATASIZE&lt;&#x2F;code&gt;. In Solidity one exception is the case when the expected return size is known (i.e. non-dynamic return values), in this case Solidity still uses the output buffer. For these cases, &lt;code&gt;RETURNDATALOAD&lt;&#x2F;code&gt; is introduced, which simplifies the workflow of copying returndata into a (known) output buffer and using &lt;code&gt;MLOAD&lt;&#x2F;code&gt; from there; instead, &lt;code&gt;RETURNDATALOAD&lt;&#x2F;code&gt; can be used directly.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;status-codes&quot;&gt;Status codes&lt;&#x2F;h3&gt;
&lt;p&gt;Current call instructions return a boolean value to signal success: 0 means failure, 1 means success. The Solidity compiler assumed this value is a boolean and thus uses the value as branch condition to status (&lt;code&gt;if iszero(status) { &#x2F;* failure *&#x2F; }&lt;&#x2F;code&gt;). This prevents us from introducing new status codes without breaking existing contracts. At the time of the design of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;211&#x2F;&quot;&gt;EIP-211&lt;&#x2F;a&gt; the idea of return a specific code for revert was discussed, but ultimately abandoned for the above reason.&lt;&#x2F;p&gt;
&lt;p&gt;We change the value from boolean to a status code, where &lt;code&gt;0&lt;&#x2F;code&gt; signals success and thus it will be possible to introduce more non-success codes in the future, if desired.&lt;&#x2F;p&gt;
&lt;p&gt;Status code &lt;code&gt;1&lt;&#x2F;code&gt; is used for both reverts coming from the callee frame and light failures encountered (see step 10. of Execution Semantics) in the execution of the instructions. The reason for combining them is keeping the semantics similar to the original CALLs - both scenarios preserve unused gas and continue being indistinguishable to the caller.&lt;&#x2F;p&gt;
&lt;p&gt;Status code &lt;code&gt;2&lt;&#x2F;code&gt; signals an exceptional failure in the callee execution, meaning an error occurred that consumed all remaining gas in the callee frame.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parameter-order&quot;&gt;Parameter order&lt;&#x2F;h3&gt;
&lt;p&gt;The order of parameters has been changed to move the &lt;code&gt;value&lt;&#x2F;code&gt; field to be the last. This allows the instructions to have identical encoding with the exception of the last parameter, and simplifies EVM and compiler implementations slightly.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;opcode-encoding&quot;&gt;Opcode encoding&lt;&#x2F;h3&gt;
&lt;p&gt;Instead of introducing three new &lt;code&gt;EXT*CALL&lt;&#x2F;code&gt; opcodes we have discussed a version with an immediate configuration byte (flags). There are two main disadvantages to this:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Some combination of flags may not be useful&#x2F;be invalid, and this increases the testing&#x2F;implementation surface.&lt;&#x2F;li&gt;
&lt;li&gt;The instruction could take variable number of stack items (i.e. &lt;code&gt;value&lt;&#x2F;code&gt; for &lt;code&gt;EXTCALL&lt;&#x2F;code&gt;) would be a brand new concept no other instruction has.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;It is also useful to have these as new opcodes instead of modifying the existing CALL series inside of EOF. This creates an &quot;escape hatch&quot; in case gas observability needs to be restored to EOF contracts. This is done by adding the GAS and original CALL series opcodes to the valid EOF opcode list.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;callcode&quot;&gt;&lt;code&gt;CALLCODE&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Since &lt;code&gt;CALLCODE&lt;&#x2F;code&gt; is deprecated, we do not introduce a counterpart here.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;halting-when-target-address-is-not-a-20-byte-ethereum-addresses&quot;&gt;Halting when &lt;code&gt;target_address&lt;&#x2F;code&gt; is not a 20-byte ethereum addresses&lt;&#x2F;h3&gt;
&lt;p&gt;When existing &lt;code&gt;CALL&lt;&#x2F;code&gt; series operations encounter an address that does not fit into 20 bytes the current behavior is to mask the address so that it fits into 20 bytes, ignoring all high bytes. For the &lt;code&gt;EXT*CALL&lt;&#x2F;code&gt; operations a halt was chosen over treating the contract as empty for two reasons. First, it handles the case of sending value to an address that doesn&#x27;t exist without having to create a special case. Second, it keeps the &lt;code&gt;warm_access_list&lt;&#x2F;code&gt; from needing to track anything that is not a 20-byte ethereum address.&lt;&#x2F;p&gt;
&lt;p&gt;Smart contract developers should not rely on the operation reverting when such addresses are passed in. When a suitable proposal for the use of Address Space Extension is adopted it is expected that the &lt;code&gt;EXT*CALL&lt;&#x2F;code&gt; series of operations will adopt those changes.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;new-instructions-undefined-in-legacy-this-eip-is-part-of-eof-only&quot;&gt;New instructions undefined in legacy (this EIP is part of EOF only)&lt;&#x2F;h3&gt;
&lt;p&gt;Initially an alternative scenario was considered to introduce these new instructions separately in the legacy EVM first to limit the scope of EOF change, but it was decided to include it as a part of the EOF upgrade and keep them undefined in the legacy EVM.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;returndataload-and-returndatacopy-padding-behavior&quot;&gt;&lt;code&gt;RETURNDATALOAD&lt;&#x2F;code&gt; and &lt;code&gt;RETURNDATACOPY&lt;&#x2F;code&gt; padding behavior&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP initially proposed keeping the halt-on-OOB behavior of legacy &lt;code&gt;RETURNDATACOPY&lt;&#x2F;code&gt;. This makes compilers optimizations harder, because unnecessary &lt;code&gt;RETURNDATA*&lt;&#x2F;code&gt; instructions cannot be optimized out without change to code semantics.&lt;&#x2F;p&gt;
&lt;p&gt;It could be that only &lt;code&gt;RETURNDATALOAD&lt;&#x2F;code&gt; is given the padding behavior, but that would make it confusingly inconsistent with the closely related &lt;code&gt;RETURNDATACOPY&lt;&#x2F;code&gt; instruction.&lt;&#x2F;p&gt;
&lt;p&gt;There also was the alternative to have &lt;code&gt;RETURNDATACOPY2&lt;&#x2F;code&gt; introduced with the padding behavior, available in EOF only, at the same time banning &lt;code&gt;RETURNDATACOPY&lt;&#x2F;code&gt; in EOF. This has been rejected in order to avoid multiplying opcodes, and also as suboptimal from the point of view of compiler implementation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;eof1-contracts-can-extdelegatecall-only-eof1-contracts&quot;&gt;EOF1 contracts can &lt;code&gt;EXTDELEGATECALL&lt;&#x2F;code&gt; only EOF1 contracts&lt;&#x2F;h3&gt;
&lt;p&gt;Legacy contracts can selfdestruct in three different ways (directly through &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;, indirectly through &lt;code&gt;CALLCODE&lt;&#x2F;code&gt; and indirectly through &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;). &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3670&#x2F;&quot;&gt;EIP-3670&lt;&#x2F;a&gt; disables the first two possibilities, however the third possibility remains. Allowing EOF1 contracts to &lt;code&gt;EXTDELEGATECALL&lt;&#x2F;code&gt; only other EOF1 contracts allows the following strong statement: EOF1 contract can never be destructed. Attacks based on &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; completely disappear for EOF1 contracts. These include destructed library contracts (e.g. Parity Multisig).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No existing instructions are changed and so we do not think any backwards compatibility issues can occur.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;It is expected that the attack surface will not grow. All of these operations can be modeled by existing operations with fixed gas (all available) and output range (zero length at zero memory).&lt;&#x2F;p&gt;
&lt;p&gt;When implemented in EOF (where the GAS opcode and the original CALL operations are removed) existing out of gas attacks will be slightly more difficult, but not entirely prevented. Transactions can still pass in arbitrary gas values and clever contract construction can still result in specific gas values being passed to specific calls. It is expected the same surface will remain in EOF, but the ease of exploitation will be reduced.&lt;&#x2F;p&gt;
&lt;p&gt;The legacy &lt;code&gt;*CALL&lt;&#x2F;code&gt; instructions allow to pass gas available for the callee. This ability is used to prevent reentrancy attack but in case of potential future gas repricing proposal this pattern does not give this guarantee any longer. Protecting against reentrancy should be resolved by using &lt;code&gt;TSTORE&#x2F;TLOAD&lt;&#x2F;code&gt; instructions introduced in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1153&#x2F;&quot;&gt;EIP-1153&lt;&#x2F;a&gt; or other solutions which do not rely on current gas schedule.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Elected block proposer has not been slashed</title>
        <published>2023-05-04T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Mikhail Kalinin</name><uri>https://github.com/mkalinin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6988/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6988-elected-block-proposer-has-not-been-slashed/14349" />
        

        <id>https://wg-eips.ritovision.com/6988/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:6988"
            label="EIP-6988" />
        

        
        

        
        <summary type="html">Prevents a slashed validator from being elected as a block proposer</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6988/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Introduces a modification to the consensus layer specification which ensures that slashed validator cannot be elected as block proposer.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;A block proposed by a slashed validator is rejected by the corresponding validity check in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;3115d1140b23dd4c9c23fbd9e2428186cf816bde&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#block-header&quot;&gt;&lt;code&gt;phase0&#x2F;process_block_header&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; function as defined in the consensus layer specification.&lt;&#x2F;p&gt;
&lt;p&gt;At the same time the definition of the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;3115d1140b23dd4c9c23fbd9e2428186cf816bde&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#compute_proposer_index&quot;&gt;&lt;code&gt;phase0&#x2F;compute_proposer_index&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; allows for a slashed validator to be elected as a proposer. This contradiction effectively leads to a missed proposal if it is supposed to be made by a slashed validator.&lt;&#x2F;p&gt;
&lt;p&gt;The impact of the proposed fix in the case of a single slashing on Ethereum Mainnet is negligible but it becomes significant in the case of correlated slashings. For instance, a correlated slashing of &lt;code&gt;1&#x2F;10th&lt;&#x2F;code&gt; of a validator set can lead to &lt;code&gt;1&#x2F;10th&lt;&#x2F;code&gt; of missed proposals in a number of epochs after the slashing.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Specification of the proposed change can be found in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;0ad3972725e7c22e8edf3bab2dd7730acbe3c272&#x2F;specs&#x2F;_features&#x2F;eip6988&#x2F;beacon-chain.md&quot;&gt;&lt;code&gt;&#x2F;_features&#x2F;eip6988&#x2F;beacon-chain.md&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;modifying-get-beacon-proposer-index&quot;&gt;Modifying &lt;code&gt;get_beacon_proposer_index&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;This function is modified to read a proposer index from a beacon state if a slot of a latest block header is the same as the &lt;code&gt;state.slot&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This modification is done to make the function return correct proposer index in the case when the proposer of a given block is being slashed during processing of the block.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This fix changes proposer election mechanism in a backwards incompatible way and requires a hard fork to be deployed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;The following test cases were added to cover this change:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;0ad3972725e7c22e8edf3bab2dd7730acbe3c272&#x2F;tests&#x2F;core&#x2F;pyspec&#x2F;eth2spec&#x2F;test&#x2F;altair&#x2F;block_processing&#x2F;sync_aggregate&#x2F;test_process_sync_aggregate.py#L712&quot;&gt;&lt;code&gt;test_slashed_proposer_rewarded_for_sync_aggregate_inclusion&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;0ad3972725e7c22e8edf3bab2dd7730acbe3c272&#x2F;tests&#x2F;core&#x2F;pyspec&#x2F;eth2spec&#x2F;test&#x2F;altair&#x2F;block_processing&#x2F;test_process_attestation.py#L17&quot;&gt;&lt;code&gt;test_slashed_proposer_rewarded_for_attestation_inclusion&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;0ad3972725e7c22e8edf3bab2dd7730acbe3c272&#x2F;tests&#x2F;core&#x2F;pyspec&#x2F;eth2spec&#x2F;test&#x2F;eip6988&#x2F;unittests&#x2F;validator&#x2F;test_validator.py#L9&quot;&gt;&lt;code&gt;test_slashed_validator_not_elected_for_proposal&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;0ad3972725e7c22e8edf3bab2dd7730acbe3c272&#x2F;tests&#x2F;core&#x2F;pyspec&#x2F;eth2spec&#x2F;test&#x2F;phase0&#x2F;unittests&#x2F;validator&#x2F;test_validator_unittest.py#L520&quot;&gt;&lt;code&gt;test_slashed_validator_elected_for_proposal&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Reference implementation is in the same place as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6988&#x2F;#specification&quot;&gt;Specification&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;There are no observed security issues introduced by the proposed change.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Efficient Default Lockable Tokens</title>
        <published>2023-05-02T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Francesco Sullo</name><uri>https://github.com/sullof</uri>
	</author>
	
	<author>
		<name>Alexe Spataru</name><uri>https://github.com/urataps</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6982/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc721-default-lockable-proposal/13366" />
        

        <id>https://wg-eips.ritovision.com/6982/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:6982"
            label="ERC-6982" />
        

        
        

        
        <summary type="html">A gas-efficient approach to lockable ERC-721 tokens</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6982/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal introduces a lockable interface for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; tokens that optimizes gas usage by eliminating unnecessary events. This interface forms the foundation for the creation and management of lockable &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; tokens. It provides a gas-efficient approach by emitting a &lt;code&gt;DefaultLocked(bool locked)&lt;&#x2F;code&gt; event upon deployment, setting the initial lock status for all tokens, while individual &lt;code&gt;Locked(uint256 indexed tokenId, bool locked)&lt;&#x2F;code&gt; events handle subsequent status changes for specific tokens. The interface also includes a view function &lt;code&gt;locked(uint256 tokenId)&lt;&#x2F;code&gt; to return the current lock status of a token, and a view function &lt;code&gt;defaultLocked()&lt;&#x2F;code&gt; to query the default status of a newly minted token.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Existing lockable token proposals often mandate the emission of an event each time a token is minted. This results in unnecessary gas consumption, especially in cases where tokens are permanently locked from inception to destruction (e.g., soulbounds or non-transferable badges). This proposal offers a more gas-efficient solution that only emits events upon contract deployment and status changes of individual tokens.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;The interface is defined as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC165 interfaceId 0x6b61a747&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6982&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST be emitted when the contract is deployed to establish the default lock status &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *      for all tokens. Also, MUST be emitted again if the default lock status changes, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *      to ensure the default status for all tokens (without a specific `Locked` event) is updated.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DefaultLocked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; locked&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST be emitted when the lock status of a specific token changes.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *      This status overrides the default lock status for that specific token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Locked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; locked&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the current default lock status for tokens. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *      The returned value MUST reflect the status indicated by the most recent `DefaultLocked` event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; defaultLocked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the lock status of a specific token. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *      If no `Locked` event has been emitted for the token, it MUST return the current default lock status. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *      The function MUST revert if the token does not exist.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; locked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; interfaceId is &lt;code&gt;0x6b61a747&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This standard seeks to optimize gas consumption by minimizing the frequency of event emission. The &lt;code&gt;DefaultLocked&lt;&#x2F;code&gt; event is designed to establish the lock status for all tokens, thereby circumventing the need to emit an event each time a new token is minted. It&#x27;s crucial to note that the &lt;code&gt;DefaultLocked&lt;&#x2F;code&gt; event can be emitted at any point in time, and is not restricted to only before the &lt;code&gt;Locked&lt;&#x2F;code&gt; events are emitted.&lt;&#x2F;p&gt;
&lt;p&gt;Tokens may alter their behavior under certain circumstances (such as after a reveal), prompting the re-emission of the &lt;code&gt;DefaultLocked&lt;&#x2F;code&gt; event to reflect the new default status. The primary objective here is to economize on gas usage by avoiding the need to emit a &lt;code&gt;Locked&lt;&#x2F;code&gt; event for each token when the default status changes.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;Locked&lt;&#x2F;code&gt; event is utilized to document changes in the lock status of individual tokens.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;defaultLocked&lt;&#x2F;code&gt; function returns the prevailing default lock status of a token. This function is beneficial as it fosters interaction with other contracts and averts potential conflicts with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5192&#x2F;&quot;&gt;ERC-5192&lt;&#x2F;a&gt;, which is in its final stage.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;locked&lt;&#x2F;code&gt; function gives the current lock status of a particular token, further facilitating interaction with other contracts. If no changes have been made to a specific token ID, this function should return the value provided by the &lt;code&gt;defaultLocked&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;p&gt;Bear in mind that a token being designated as &quot;locked&quot; doesn&#x27;t necessarily imply that it is entirely non-transferable. There might be certain conditions under which a token can still be transferred despite its locked status. Primarily, the locked status relates to a token&#x27;s transferability on marketplaces and external exchanges.&lt;&#x2F;p&gt;
&lt;p&gt;To illustrate, let&#x27;s consider the Cruna protocol. In this system, an NFT owner has the ability to activate what is termed an &#x27;protector&#x27;. This is essentially a secondary wallet with the unique privilege of initiating key transactions. Upon setting an initiator, the token&#x27;s status is rendered &#x27;locked&#x27;. However, this does not impede the token&#x27;s transferability if the initiation for the transfer comes from the designated protector.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is fully backwards compatible with existing &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; contracts. It can be easily integrated into existing contracts and will not cause any conflicts or disruptions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;An example implementation is located in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6982&#x2F;assets&#x2F;README&#x2F;&quot;&gt;assets&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;It solves a specific use case: token&#x27;s owners losing the ownership when staking the asset in a pool. The implementation allow the pool to lock the asset, leaving the ownership to the owner. In the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6982&#x2F;assets&#x2F;README&#x2F;&quot;&gt;README&lt;&#x2F;a&gt; you can find more details about how to compile and test the contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP does not introduce any known security considerations. However, as with any smart contract standard, it is crucial to employ rigorous security measures in the implementation of this interface.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>NFT Relationship Enhancement</title>
        <published>2023-05-02T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Guang</name><uri>https://github.com/xg1990</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7085/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/introducing-new-eip-nft-relationship-standard/14468" />
        

        <id>https://wg-eips.ritovision.com/7085/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7085"
            label="ERC-7085" />
        

        
        

        
        <summary type="html">Establish relationships between NFTs and setting quantifiable attributes for those relationships.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7085/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal builds on &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; and creates a standard for referring relationships and quantifiable attributes between non-isolated &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; non-fungible tokens (NFTs). It enables users to build a graph of NFTs and set quantifiable attributes for each NFT, facilitating more complex NFT ecosystems. While a similar proposal exists for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; tokens, it does not provide a way to establish quantifiable relationships or object attributes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The current standard for NFTs lacks the ability to establish relationships and attributes between tokens. This limitation makes it difficult for users to build more complex NFT ecosystems that require referring relationships and quantifiable attributes between tokens. For example, a user may create a derivative NFT that refers to the original NFT and sets a quantifiable attribute for the relationship between the two NFTs, but without a standardized way to establish relationships and attributes between NFTs, managing these ecosystems becomes increasingly difficult and inefficient.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal aims to address this issue by extending the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; standards to include the ability to establish referring relationships and quantifiable attributes between NFTs.&lt;&#x2F;p&gt;
&lt;p&gt;By enabling users to build more complex NFT ecosystems, this proposal will enhance the NFT ecosystem and open up new possibilities for NFT use cases. However, it&#x27;s important to consider potential drawbacks such as increased complexity and gas cost, and carefully design rules to mitigate these issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes the addition of five new functions to the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; standards: &lt;code&gt;setRelationship&lt;&#x2F;code&gt;, &lt;code&gt;setAttribute&lt;&#x2F;code&gt;, &lt;code&gt;getRelationship&lt;&#x2F;code&gt;, &lt;code&gt;getAttribute&lt;&#x2F;code&gt;, and &lt;code&gt;getAttributeNames&lt;&#x2F;code&gt;. These functions allow users to establish referring relationships and set quantifiable attributes between NFTs.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;setrelationship&quot;&gt;&lt;code&gt;setRelationship&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;setRelationship&lt;&#x2F;code&gt; function establishes a referring relationship between two NFTs. It takes the following parameters:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setRelationship&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _originalID&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _derivativeID&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _attribute&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;_originalID&lt;&#x2F;code&gt;: the ID of the original NFT&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;_derivativeID&lt;&#x2F;code&gt;: the ID of the derivative NFT that refers to the original NFT&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;_attribute&lt;&#x2F;code&gt;: the quantifiable attribute for this relationship, which defaults to 1 if not specified&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;When called, this function establishes a referring relationship between the two NFTs.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;setattribute&quot;&gt;&lt;code&gt;setAttribute&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;setAttribute&lt;&#x2F;code&gt; function sets a quantifiable attribute for an NFT. It takes the following parameters:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setAttribute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;_id&lt;&#x2F;code&gt;: the ID of the NFT&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;_name&lt;&#x2F;code&gt;: the name of the attribute to be set&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;_value&lt;&#x2F;code&gt;: the value of the attribute to be set&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;When called, this function sets a quantifiable attribute for the NFT.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;getattribute&quot;&gt;&lt;code&gt;getAttribute&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;getAttribute&lt;&#x2F;code&gt; function allows anyone to retrieve the value of a specific attribute associated with an NFT. It takes the following parameters:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getAttribute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _name&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;_id&lt;&#x2F;code&gt;: The ID of the NFT for which you want to retrieve the attribute.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;_name&lt;&#x2F;code&gt;: The name of the attribute you wish to retrieve.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This function returns the value of the specified attribute as a bytes32 data type.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;getattributenames&quot;&gt;&lt;code&gt;getAttributeNames&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The getAttributeNames function allows anyone to retrieve the names of all attributes associated with an NFT. It takes the following parameter:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getAttributeNames&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;_id&lt;&#x2F;code&gt;: The ID of the NFT for which you want to retrieve the attribute names.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This function returns an array of bytes32 values representing the names of all attributes associated with the specified NFT.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;getrelationship&quot;&gt;&lt;code&gt;getRelationship&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;getRelationship&lt;&#x2F;code&gt; function allows anyone to retrieve the value of a referring relationship between two NFTs. It takes the following parameters:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getRelationship&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _originalID&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _derivativeID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;_originalID&lt;&#x2F;code&gt;: The ID of the original NFT.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;_derivativeID&lt;&#x2F;code&gt;: The ID of the derivative NFT that refers to the original NFT.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This function returns the value of the referring relationship between the two NFTs as a uint256 data type.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;example-usage&quot;&gt;Example Usage&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;NFTGraph nftContract &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NFTGraph&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addressOfContract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieve the value of an attribute named &amp;quot;Color&amp;quot; for NFT with ID 123&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt; colorValue &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; nftContract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getAttribute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;123&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Color&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieve the names of all attributes associated with NFT with ID 456&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; attributeNames &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; nftContract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getAttributeNames&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;456&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;By including these functions and methods in the specification, you establish a clear and standardized way for users and developers to read attributes associated with NFTs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;In developing this EIP, some key design decisions were made. For example, we limited the complexity of the relationship graph that can be created by only allowing for one referring relationship between two NFTs. This helps to ensure that the graph remains manageable and does not become too complex to be useful. Additionally, we kept the gas cost of setting attributes to a minimum by only allowing for one attribute to be set at a time.&lt;&#x2F;p&gt;
&lt;p&gt;While there are currently no similar features in other blockchain languages or standards, we drew inspiration from the concept of Graph Theory, which is a branch of mathematics that studies the relationships between objects. By adding the ability to establish relationships between NFTs and set quantifiable attributes for those relationships, we believe that the extended NFT standard will become even more useful and versatile for NFT creators and users.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is designed to be fully backward-compatible with existing &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; contracts and tokens. Existing NFT contracts and tokens will continue to function as they did before, and the new &lt;code&gt;setRelationship&lt;&#x2F;code&gt; and &lt;code&gt;setAttribute&lt;&#x2F;code&gt; functions will only be available to contracts that explicitly implement this EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;To assist in understanding and implementing this proposal, we provide a reference Solidity interface and contract that define the functions for establishing relationships and reading attributes. Developers can use this interface as a foundation for integrating the NFT Relationship Enhancement into their own contracts.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;erc-165-interface-support&quot;&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; Interface Support&lt;&#x2F;h3&gt;
&lt;p&gt;The NFT Relationship Enhancement contract implements the ERC-165 standard interface to allow for interface detection. This enables smart contracts and applications to check if a given contract supports the functions defined in this proposal before interacting with it.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;inftgraph-interface&quot;&gt;INFTGraph Interface&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: MIT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC165&#x2F;IERC165.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Import IERC165 for interface detection&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; INFTGraph&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC165&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; setRelationship: Establishes relationships between NFTs.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setRelationship&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _originalID&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _derivativeID&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _attribute&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; setAttribute: Sets quantifiable attributes for NFTs.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setAttribute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; getRelationship: Retrieves relationship values between NFTs.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getRelationship&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _originalID&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _derivativeID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; getAttribute: Retrieves the value of specific attributes associated with NFTs.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getAttribute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _name&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; getAttributeNames: Retrieves all attribute names associated with an NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getAttributeNames&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The INFTGraph interface specifies the functions for setting relationships and attributes, as well as retrieving attribute information and relationship values.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;nftgraph-contract&quot;&gt;NFTGraph Contract&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: MIT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;introspection&#x2F;ERC165.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Import ERC165 for interface detection&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;INFTGraph.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Import INFTGraph interface&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NFTGraph&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; INFTGraph&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; relationship&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; attributes&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Implement the setRelationship and setAttribute functions as described in the EIP specification.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Implement the supportsInterface function for ERC-165.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; interfaceID &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;INFTGraph&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;interfaceID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Additional implementation details...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getRelationship&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _originalID&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _derivativeID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; relationship&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_originalID&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_derivativeID&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getAttribute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _name&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;attributes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_id&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_name&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getAttributeNames&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; names &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;[](&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;attributes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;_id&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; attributes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_id&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            names&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;attributes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_id&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; names&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setRelationship&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; originalNFT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; derivativeNFT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; relationshipValue&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;originalNFT &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span&gt; derivativeNFT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Original and derivative NFTs must be different&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        relationship&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;originalNFT&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;derivativeNFT&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; relationshipValue&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setAttribute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nft&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attributeName&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attributeValue&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        attributes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;nft&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;attributeName&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; attributeValue&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The NFTGraph contract implements the functions specified in the INFTGraph interface and provides storage for relationships and attributes.&lt;&#x2F;p&gt;
&lt;p&gt;Developers can use this reference interface and contract as a starting point for integrating the NFT Relationship Enhancement functionality into their own projects.
The interface provides a clear and standardized way to interact with the contract, promoting consistency and ease of integration.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;When implementing this proposal, contract developers should consider the following security aspects:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Validation of Relationships&lt;&#x2F;strong&gt;: Contracts utilizing the setRelationship function must ensure that the relationships being established are valid and authorized by the relevant parties. Unauthorized or malicious relationships could lead to unintended consequences.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Attribute Validation&lt;&#x2F;strong&gt;: Contracts implementing the setAttribute function should carefully validate attributes to prevent malicious or harmful values. Invalid or unvalidated attributes could disrupt the functionality of the NFT ecosystem.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Access Control&lt;&#x2F;strong&gt;: Contracts should implement appropriate access control mechanisms to restrict who can call critical functions, especially those that modify relationships or attributes. Unauthorized access can lead to misuse or exploitation.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Reentrancy Protection&lt;&#x2F;strong&gt;: Consider adding reentrancy protection mechanisms to functions that modify relationships or attributes. Reentrancy attacks could otherwise be exploited to manipulate contract behavior.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;By addressing these considerations, developers can enhance the security of their contracts and protect the integrity of the NFT ecosystem.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Multi Injected Provider Discovery</title>
        <published>2023-05-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Pedro Gomes</name><uri>https://github.com/pedrouid</uri>
	</author>
	
	<author>
		<name>Kosala Hemachandra</name><uri>https://github.com/kvhnuke</uri>
	</author>
	
	<author>
		<name>Richard Moore</name><uri>https://github.com/ricmoo</uri>
	</author>
	
	<author>
		<name>Gregory Markou</name><uri>https://github.com/GregTheGreek</uri>
	</author>
	
	<author>
		<name>Kyle Den Hartog</name><uri>https://github.com/kdenhartog</uri>
	</author>
	
	<author>
		<name>Glitch</name><uri>https://github.com/glitch-txs</uri>
	</author>
	
	<author>
		<name>Jake Moxey</name><uri>https://github.com/jxom</uri>
	</author>
	
	<author>
		<name>Pierre Bertet</name><uri>https://github.com/bpierre</uri>
	</author>
	
	<author>
		<name>Darryl Yeo</name><uri>https://github.com/darrylyeo</uri>
	</author>
	
	<author>
		<name>Yaroslav Sergievsky</name><uri>https://github.com/everdimension</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6963/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6963-multi-injected-provider-interface-aka-mipi/14076" />
        

        <id>https://wg-eips.ritovision.com/6963/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="interface"
                label="Interface" />
            
        

        
        <category
            term="tag:eip:6963"
            label="EIP-6963" />
        

        
        

        
        <summary type="html">Using window events to announce injected Wallet Providers</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6963/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;An alternative discovery mechanism to &lt;code&gt;window.ethereum&lt;&#x2F;code&gt; for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1193&#x2F;&quot;&gt;EIP-1193&lt;&#x2F;a&gt; providers which supports discovering multiple injected Wallet Providers in a web page using Javascript&#x27;s &lt;code&gt;window&lt;&#x2F;code&gt; events.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, Wallet Provider that offer browser extensions must inject their Ethereum providers (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1193&#x2F;&quot;&gt;EIP-1193&lt;&#x2F;a&gt;) into the same window object &lt;code&gt;window.ethereum&lt;&#x2F;code&gt;; however, this creates conflicts for users that may install more than one browser extension.&lt;&#x2F;p&gt;
&lt;p&gt;Browser extensions are loaded in the web page in an unpredictable and unstable order, resulting in a race condition where the user does not have control over which Wallet Provider is selected to expose the Ethereum interface under the &lt;code&gt;window.ethereum&lt;&#x2F;code&gt; object. Instead, the last wallet to load usually wins.&lt;&#x2F;p&gt;
&lt;p&gt;This results not only in a degraded user experience but also increases the barrier to entry for new browser extensions as users are forced to only install one browser extension at a time.&lt;&#x2F;p&gt;
&lt;p&gt;Some browser extensions attempt to counteract this problem by delaying their injection to overwrite the same &lt;code&gt;window.ethereum&lt;&#x2F;code&gt; object which creates an unfair competition for Wallet Providers and lack of interoperability.&lt;&#x2F;p&gt;
&lt;p&gt;In this proposal, we present a solution that focuses on optimizing the interoperability of multiple Wallet Providers. This solution aims to foster fairer competition by reducing the barriers to entry for new Wallet Providers, along with enhancing the user experience on Ethereum networks.&lt;&#x2F;p&gt;
&lt;p&gt;This is achieved by introducing a set of window events to provide a two-way communication protocol between Ethereum libraries and injected scripts provided by browser extensions thus enabling users to select their wallet of choice.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc2119&quot;&gt;RFC-2119&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;p&gt;Wallet Provider: A user agent that manages keys and facilitates transactions with Ethereum.&lt;&#x2F;p&gt;
&lt;p&gt;Decentralized Application (DApp): A web page that relies upon one or many Web3 platform APIs which are exposed to the web page via the Wallet.&lt;&#x2F;p&gt;
&lt;p&gt;Provider Discovery Library: A library or piece of software that assists a DApp to interact with the Wallet.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;provider-info&quot;&gt;Provider Info&lt;&#x2F;h3&gt;
&lt;p&gt;Each Wallet Provider will be announced with the following interface &lt;code&gt;EIP6963ProviderInfo&lt;&#x2F;code&gt;. The values in the &lt;code&gt;EIP6963ProviderInfo&lt;&#x2F;code&gt; MUST be included within the &lt;code&gt;EIP6963ProviderInfo&lt;&#x2F;code&gt; object. The &lt;code&gt;EIP6963ProviderInfo&lt;&#x2F;code&gt; MAY also include extra extensible properties within the object. If a DApp does not recognize the additional properties, it SHOULD ignore them.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;uuid&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; - a globally unique identifier the Wallet Provider that MUST be (&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc4122&quot;&gt;UUIDv4&lt;&#x2F;a&gt; compliant) to uniquely distinguish different &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1193&#x2F;&quot;&gt;EIP-1193&lt;&#x2F;a&gt; provider sessions that have matching properties defined below during the lifetime of the page. The cryptographic uniqueness provided by &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc4122&quot;&gt;UUIDv4&lt;&#x2F;a&gt; guarantees that two independent &lt;code&gt;EIP6963ProviderInfo&lt;&#x2F;code&gt; objects can be separately identified.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;name&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; - a human-readable local alias of the Wallet Provider to be displayed to the user on the DApp. (e.g. &lt;code&gt;Example Wallet Extension&lt;&#x2F;code&gt; or &lt;code&gt;Awesome Example Wallet&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;icon&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; - a &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc3986&quot;&gt;URI&lt;&#x2F;a&gt; pointing to an image. The image SHOULD be a square with 96x96px minimum resolution. See the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6963&#x2F;#images-icons&quot;&gt;Images&#x2F;Icons&lt;&#x2F;a&gt; below for further requirements of this property.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;rdns&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; - The Wallet MUST supply the &lt;code&gt;rdns&lt;&#x2F;code&gt; property which is intended to be a domain name from the Domain Name System in reverse syntax ordering such as &lt;code&gt;com.example.subdomain&lt;&#x2F;code&gt;. It&#x27;s up to the Wallet to determine the domain name they wish to use, but it&#x27;s generally expected the identifier will remain the same throughout the development of the Wallet. It&#x27;s also worth noting that similar to a user agent string in browsers, there are times where the supplied value could be unknown, invalid, incorrect, or attempt to imitate a different Wallet. Therefore, the DApp SHOULD be able to handle these failure cases with minimal degradation to the functionality of the DApp.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * Represents the assets needed to display a wallet&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EIP6963ProviderInfo&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  uuid&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  name&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  icon&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  rdns&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;images-icons&quot;&gt;Images&#x2F;Icons&lt;&#x2F;h4&gt;
&lt;p&gt;A URI-encoded image was chosen to enable flexibility for multiple protocols for fetching and rendering icons, for example:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; svg (data uri)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;data:image&#x2F;svg+xml,&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;svg&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; version=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1.1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; xmlns=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;http:&#x2F;&#x2F;www.w3.org&#x2F;2000&#x2F;svg&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; width=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;32px&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; height=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;32px&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; viewBox=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0 0 32 32&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;circle&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; fill=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;red&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; cx=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;16&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; cy=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;16&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;12&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;&#x2F;&amp;gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&#x2F;sv&lt;&#x2F;span&gt;&lt;span&gt;g&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; png (data uri)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;data:image&#x2F;png&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4&#x2F;&#x2F;8&#x2F;w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;=&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;icon&lt;&#x2F;code&gt; string MUST be a data URI as defined in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc2397&quot;&gt;RFC-2397&lt;&#x2F;a&gt;. The image SHOULD be a square with 96x96px minimum resolution. The image format is RECOMMENDED to be either lossless or vector based such as PNG, WebP or SVG to make the image easy to render on the DApp. Since SVG images can execute Javascript, applications and libraries MUST render SVG images using the &lt;code&gt;&amp;lt;img&amp;gt;&lt;&#x2F;code&gt; tag to ensure no untrusted Javascript execution can occur.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;rdns&quot;&gt;RDNS&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;strong&gt;&lt;code&gt;rdns&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; (Reverse-DNS) property serves to provide an identifier which DApps can rely on to be stable between sessions. The Reverse Domain Name Notation is chosen to prevent namespace collisions.
The Reverse-DNS convention implies that the value should start with a reversed DNS domain name controlled by the Provider. The domain name should be followed by a subdomain or a product name. Example: &lt;code&gt;com.example.MyBrowserWallet&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;rdns&lt;&#x2F;code&gt; value MUST BE a valid &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc1034&quot;&gt;RFC-1034&lt;&#x2F;a&gt; Domain Name;&lt;&#x2F;li&gt;
&lt;li&gt;The DNS part of the &lt;code&gt;rdns&lt;&#x2F;code&gt; value SHOULD BE an active domain controlled by the Provider;&lt;&#x2F;li&gt;
&lt;li&gt;DApps MAY reject the Providers which do not follow the Reverse-DNS convention correctly;&lt;&#x2F;li&gt;
&lt;li&gt;DApps SHOULD NOT use the &lt;code&gt;rnds&lt;&#x2F;code&gt; value for feature detection as these are self-attested and prone to impersonation or bad incentives without an additional verification mechanism; feature-discovery and verification are both out of scope of this interface specification.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;provider-detail&quot;&gt;Provider Detail&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;EIP6963ProviderDetail&lt;&#x2F;code&gt; is used as a composition interface to announce a Wallet Provider and related metadata about the Wallet Provider. The &lt;code&gt;EIP6963ProviderDetail&lt;&#x2F;code&gt; MUST contain an &lt;code&gt;info&lt;&#x2F;code&gt; property of type &lt;code&gt;EIP6963ProviderInfo&lt;&#x2F;code&gt; and a &lt;code&gt;provider&lt;&#x2F;code&gt; property of type &lt;code&gt;EIP1193Provider&lt;&#x2F;code&gt; defined by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1193&#x2F;&quot;&gt;EIP-1193&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EIP6963ProviderDetail&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  info&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EIP6963ProviderInfo&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  provider&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EIP1193Provider&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;window-events&quot;&gt;Window Events&lt;&#x2F;h3&gt;
&lt;p&gt;In order to prevent provider collisions, the DApp and the Wallet are expected to emit an event and instantiate an eventListener to discover the various Wallets. This forms an Event concurrency loop.&lt;&#x2F;p&gt;
&lt;p&gt;Since the DApp code and Wallet code aren&#x27;t guaranteed to run in a particular order, the events are designed to handle such race conditions.&lt;&#x2F;p&gt;
&lt;p&gt;To emit events, both DApps and Wallets MUST use the &lt;code&gt;window.dispatchEvent&lt;&#x2F;code&gt; function to emit events and MUST use the &lt;code&gt;window.addEventListener&lt;&#x2F;code&gt; function to observe events. There are two Event interfaces used for the DApp and Wallet to discover each other.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;announce-and-request-events&quot;&gt;Announce and Request Events&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;EIP6963AnnounceProviderEvent&lt;&#x2F;code&gt; interface MUST be a &lt;code&gt;CustomEvent&lt;&#x2F;code&gt; object with a &lt;code&gt;type&lt;&#x2F;code&gt; property containing a string value of &lt;code&gt;eip6963:announceProvider&lt;&#x2F;code&gt; and a &lt;code&gt;detail&lt;&#x2F;code&gt; property with an object value of type &lt;code&gt;EIP6963ProviderDetail&lt;&#x2F;code&gt;. The &lt;code&gt;EIP6963ProviderDetail&lt;&#x2F;code&gt; object SHOULD be frozen by calling &lt;code&gt;Object.freeze()&lt;&#x2F;code&gt; on the value of the &lt;code&gt;detail&lt;&#x2F;code&gt; property.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Announce Event dispatched by a Wallet&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EIP6963AnnounceProviderEvent&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; extends&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; CustomEvent&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eip6963:announceProvider&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  detail&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EIP6963ProviderDetail&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;EIP6963RequestProviderEvent&lt;&#x2F;code&gt; interface MUST be an &lt;code&gt;Event&lt;&#x2F;code&gt; object with a &lt;code&gt;type&lt;&#x2F;code&gt; property containing a string value of &lt;code&gt;eip6963:requestProvider&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Request Event dispatched by a DApp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EIP6963RequestProviderEvent&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; extends&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; Event&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eip6963:requestProvider&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The Wallet MUST announce the &lt;code&gt;EIP6963AnnounceProviderEvent&lt;&#x2F;code&gt; to the DApp via a &lt;code&gt;window.dispatchEvent()&lt;&#x2F;code&gt; function call. The Wallet MUST add an EventListener to catch an &lt;code&gt;EIP6963RequestProviderEvent&lt;&#x2F;code&gt; dispatched from the DApp. This EventListener MUST use a handler that will re-dispatch an &lt;code&gt;EIP6963AnnounceProviderEvent&lt;&#x2F;code&gt;. This re-announcement by the Wallet is useful for when a Wallet&#x27;s initial Event announcement may have been delayed or fired before the DApp had initialized its EventListener. This allows the various Wallet Providers to react to the DApp without the need to pollute the &lt;code&gt;window.ethereum&lt;&#x2F;code&gt; namespace which can produce non-deterministic wallet behavior such as different wallets connecting each time.&lt;&#x2F;p&gt;
&lt;p&gt;The Wallet dispatches the &lt;code&gt;&quot;eip6963:announceProvider&quot;&lt;&#x2F;code&gt; event with immutable contents and listens to the &lt;code&gt;&quot;eip6963:requestProvider&quot;&lt;&#x2F;code&gt; event:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; info&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EIP6963ProviderInfo&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; provider&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EIP1193Provider&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; announceEvent&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EIP6963AnnounceProviderEvent&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CustomEvent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eip6963:announceProvider&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;span&gt; detail&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Object&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;freeze&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; info&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; provider&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The Wallet dispatches an announce event which is heard by&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the DApp code that had run earlier&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;window&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;dispatchEvent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;announceEvent&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The Wallet listens to the request events which may be&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; dispatched later and re-dispatches the `EIP6963AnnounceProviderEvent`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;window&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;addEventListener&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eip6963:requestProvider&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  window&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;dispatchEvent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;announceEvent&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The DApp MUST listen for the &lt;code&gt;EIP6963AnnounceProviderEvent&lt;&#x2F;code&gt; dispatched by the Wallet via a &lt;code&gt;window.addEventListener()&lt;&#x2F;code&gt; method and MUST NOT remove the Event Listener for the lifetime of the page so that the DApp can continue to handle Events beyond the initial page load interaction. The DApp MUST dispatch the &lt;code&gt;EIP6963RequestProviderEvent&lt;&#x2F;code&gt; via a &lt;code&gt;window.dispatchEvent()&lt;&#x2F;code&gt; function call after the &lt;code&gt;EIP6963AnnounceProviderEvent&lt;&#x2F;code&gt; handler has been initialized.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The DApp listens to announced providers&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;window&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;addEventListener&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eip6963:announceProvider&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EIP6963AnnounceProviderEvent&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The DApp dispatches a request event which will be heard by &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Wallets&amp;#39; code that had run earlier&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;window&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;dispatchEvent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Event&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eip6963:requestProvider&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The DApp MAY elect to persist various &lt;code&gt;EIP6963ProviderDetail&lt;&#x2F;code&gt; objects contained in the  announcement events sent by multiple wallets. Thus, if the user wishes to utilize a different Wallet over time, the user can express this within the DApp&#x27;s interface and the DApp can immediately elect to send transactions to that new Wallet. Otherwise, the DApp MAY re-initiate the wallet discovery flow via dispatching a new &lt;code&gt;EIP6963RequestProviderEvent&lt;&#x2F;code&gt;, potentially discovering a different set of wallets.&lt;&#x2F;p&gt;
&lt;p&gt;The described orchestration of events guarantees that the DApp is able to discover the Wallet, regardless of which code executes first, the Wallet code or the DApp code.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The previous proposal introduced mechanisms that relied on a single, mutable window object that could be overwritten by multiple parties. We opted for an event-based approach to avoid the race conditions, the namespace collisions, and the potential for &quot;pollution&quot; attacks on a shared mutable object; the event-based orchestration creates a bidirectional communication channel between wallet and dapp that can be re-orchestrated over time.&lt;&#x2F;p&gt;
&lt;p&gt;To follow the Javascript event name conventions, the names are written in present tense and are prefixed with the number of this document (&lt;code&gt;EIP6963&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;interfaces&quot;&gt;Interfaces&lt;&#x2F;h3&gt;
&lt;p&gt;Standardizing an interface for provider information (&lt;code&gt;EIP6963ProviderInfo&lt;&#x2F;code&gt;) allows a DApp to determine all information necessary to populate a user-friendly wallet selection modal. This is particularly useful for DApps that rely on libraries such as Web3Modal, RainbowKit, Web3-Onboard, or ConnectKit to programmatically generate such selection modals.&lt;&#x2F;p&gt;
&lt;p&gt;Regarding the announced provider interface (&lt;code&gt;EIP6963ProviderDetail&lt;&#x2F;code&gt;), it was important to leave the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1193&#x2F;&quot;&gt;EIP-1193&lt;&#x2F;a&gt; provider interface untouched for backwards compatibility; this allows conformant DApps to interface with wallets conforming to either, and for Wallets conformant to this spec to still inject &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1193&#x2F;&quot;&gt;EIP-1193&lt;&#x2F;a&gt; providers for legacy DApps. Note that a legacy dapp or a DApp conformant with this spec connecting to a legacy wallet cannot guarantee the correct wallet will be selected if multiple are present.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP doesn&#x27;t require supplanting &lt;code&gt;window.ethereum&lt;&#x2F;code&gt;, so it doesn&#x27;t directly break existing applications that cannot update to this method of Wallet discovery. However, it is RECOMMENDED DApps implement this EIP to ensure discovery of multiple Wallet Providers and SHOULD disable &lt;code&gt;window.ethereum&lt;&#x2F;code&gt; usage except as a fail-over when discovery fails. Similarly, Wallets SHOULD keep compatibility of &lt;code&gt;window.ethereum&lt;&#x2F;code&gt; to ensure backwards compatibility for DApps that have not implemented this EIP. In order to prevent the previous issues of namespace collisions, it&#x27;s also RECOMMENDED that wallets inject their provider object under a wallet specific namespace then proxy the object into the &lt;code&gt;window.ethereum&lt;&#x2F;code&gt; namespace.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;wallet-provider&quot;&gt;Wallet Provider&lt;&#x2F;h3&gt;
&lt;p&gt;Here is a reference implementation for an injected script by a Wallet Provider to support this new interface in parallel with the existing pattern.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onPageLoad&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; provider&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EIP1193Provider&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  window&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;ethereum&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; provider&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; announceProvider&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; info&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EIP6963ProviderInfo&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      uuid&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;350670db-19fa-4704-a166-e52e178b59d2&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Example Wallet&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      icon&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;data:image&#x2F;svg+xml,&amp;lt;svg xmlns=&amp;#39;http:&#x2F;&#x2F;www.w3.org&#x2F;2000&#x2F;svg&amp;#39;&#x2F;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      rdns&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;com.example.wallet&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    window&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;dispatchEvent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CustomEvent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eip6963:announceProvider&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        detail&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Object&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;freeze&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; info&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; provider&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  window&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;addEventListener&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eip6963:requestProvider&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EIP6963RequestProviderEvent&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      announceProvider&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  announceProvider&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;dapp-implementation&quot;&gt;DApp implementation&lt;&#x2F;h3&gt;
&lt;p&gt;Here is a reference implementation for a DApp to display and track multiple Wallet Providers that are injected by browser extensions.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; providers&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EIP6963ProviderDetail&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onPageLoad&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  window&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;addEventListener&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eip6963:announceProvider&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EIP6963AnnounceProviderEvent&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      providers&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;push&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;event&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;detail&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  window&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;dispatchEvent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Event&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eip6963:requestProvider&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;eip-1193-security-considerations&quot;&gt;EIP-1193 Security considerations&lt;&#x2F;h3&gt;
&lt;p&gt;The security considerations of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1193&#x2F;&quot;&gt;EIP-1193&lt;&#x2F;a&gt; apply to this EIP. Implementers are expected to consider and follow the guidance of the providers they&#x27;re utilizing as well.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;prototype-pollution-of-wallet-provider-objects&quot;&gt;Prototype Pollution of Wallet Provider objects&lt;&#x2F;h3&gt;
&lt;p&gt;Browser extensions, and therefore Wallet extensions, are able to modify the contents of the page and the Provider object by design. The provider objects of various Wallets are considered a highly trusted interface to communicate transaction data. In order to prevent the page or various other extensions from modifying the interaction between the DApp and the Wallet in an unexpected way, the best practice is to &quot;freeze&quot; the provider discovery object by utilizing &lt;code&gt;object.freeze()&lt;&#x2F;code&gt; on the  &lt;code&gt;EIP1193Provider&lt;&#x2F;code&gt; object before the wallet dispatches it in the &lt;code&gt;eip6963:announceProvider&lt;&#x2F;code&gt; Event. However, there are difficulties that can occur around web compatibility where pages need to monkey patch the object. In scenarios like this there&#x27;s a tradeoff that needs to be made between security and web compatibility that Wallet implementers are expected to consider.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;wallet-imitation-and-manipulation&quot;&gt;Wallet Imitation and Manipulation&lt;&#x2F;h3&gt;
&lt;p&gt;Similarly so, DApps are expected to actively detect for misbehavior of properties or functions being modified in order to tamper with or modify other wallets. One way this can be easily achieved is to look for when the &lt;code&gt;uuid&lt;&#x2F;code&gt; property within two &lt;code&gt;EIP6963ProviderInfo&lt;&#x2F;code&gt; objects match. DApps and DApp discovery libraries are expected to consider other potential methods that the &lt;code&gt;EIP6963ProviderInfo&lt;&#x2F;code&gt; objects are being tampered with and consider additional mitigation techniques to prevent this as well in order to protect the user.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;prevent-svg-javascript-execution&quot;&gt;Prevent SVG Javascript Execution&lt;&#x2F;h3&gt;
&lt;p&gt;The use of SVG images introduces a cross-site scripting risk as they can include JavaScript code. This Javascript executes within the context of the page and can therefore modify the page or the contents of the page. So when considering the experience of rendering the icons, DApps need to take into consideration how they&#x27;ll approach handling these concerns in order to prevent an image being used as an obfuscation technique to hide malicious modifications to the page or to other wallets.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;prevent-wallet-fingerprinting&quot;&gt;Prevent Wallet Fingerprinting&lt;&#x2F;h3&gt;
&lt;p&gt;One advantage to the concurrency Event loop utilized by this design is that it operates in a manner where either the DApp or the Wallet can initiate the flow to announce a provider. For this reason, Wallet implementers can now consider whether or not they wish to announce themselves to all pages or attempt alternative means in order to reduce the ability for a user to be fingerprinted by the injection of the &lt;code&gt;window.ethereum&lt;&#x2F;code&gt; object. Some examples, of alternative flows to consider would be to wait to inject the provider object until the DApp has announced the &lt;code&gt;eip6963:requestProvider&lt;&#x2F;code&gt;. At that point, the wallet can initiate a UI consent flow to ask the user if they would like to share their wallet address. This allows for the Wallet to enable the option of a &quot;private connect&quot; feature. However, if this approach is taken, Wallets must also consider how they intend to support backwards compatibility with a DApp that does not support this EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Contract Secured Revenue on an EVM based L2</title>
        <published>2023-05-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Zak Cole</name><email>zak@numbergroup.xyz</email>
	</author>
	
	<author>
		<name>Zak Cole</name><uri>https://github.com/zscole</uri>
	</author>
	
	<author>
		<name>Kevin Owocki</name><email>kevin@supermodular.xyz</email>
	</author>
	
	<author>
		<name>lightclient</name><uri>https://github.com/lightclient</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6968/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6968-generalized-csr-protocol/14178" />
        

        <id>https://wg-eips.ritovision.com/6968/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:6968"
            label="EIP-6968" />
        

        
        

        
        <summary type="html">Contract Secured Revenue on an EVM based L2</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6968/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Contract Secured Revenue (CSR) allows smart contract developers to claim a percentage of all transaction fees paid by users when interacting with their smart contracts.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP proposes the introduction of CSR on EVM-based L2s which would provide smart contract developers who deploy on L2s access to revenue streams and&#x2F;or public goods.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Using protocol rewards of an L1 to fund smart contract development would be a big change to the way the current market works.  This EIP &lt;em&gt;does not&lt;&#x2F;em&gt; advocate for any changes to the existing Ethereum L1.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP does advocate that L2s could begin to experiment with Contract Secured Revenue as a means of:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;creating a new revenue stream for smart contract developers&lt;&#x2F;li&gt;
&lt;li&gt;creating a new way of funding public goods&lt;&#x2F;li&gt;
&lt;li&gt;creating incentives for developers to deploy their dapps on your network&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;REVENUE_SHARE_QUOTIENT&lt;&#x2F;td&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;fee-mechanism&quot;&gt;Fee Mechanism&lt;&#x2F;h3&gt;
&lt;p&gt;The current &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; fee behavior is modified so that &lt;code&gt;header.base_fee_per_gas * REVENUE_SHARE_QUOTIENT&lt;&#x2F;code&gt; per gas is reallocated proportionally, based on gas used, to each contract executed during the transaction.&lt;&#x2F;p&gt;
&lt;p&gt;Implicitly, this means that no fees are redistributed to externally owned accounts (EOA).&lt;&#x2F;p&gt;
&lt;h4 id=&quot;gas-tracking&quot;&gt;Gas Tracking&lt;&#x2F;h4&gt;
&lt;p&gt;In order to fairly distribute the fee revenue, a new transaction-wide gas tracker is defined.&lt;&#x2F;p&gt;
&lt;p&gt;When executing a block, maintain a mapping &lt;code&gt;gas_used_by_address&lt;&#x2F;code&gt; of &lt;code&gt;address&lt;&#x2F;code&gt; to &lt;code&gt;uint64&lt;&#x2F;code&gt;. This will track the amount of gas used by each address. For every EVM instruction that does not instantiate a new execution frame (e.g. &lt;code&gt;CALL&lt;&#x2F;code&gt;, &lt;code&gt;CALLCODE&lt;&#x2F;code&gt;, &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;, &lt;code&gt;STATICCALL&lt;&#x2F;code&gt;, &lt;code&gt;CREATE&lt;&#x2F;code&gt;, and &lt;code&gt;CREATE2&lt;&#x2F;code&gt;), add the cost of the instruction to the address&#x27; current sum in the mapping.&lt;&#x2F;p&gt;
&lt;p&gt;For EVM instructions which do instantiate new frames, greater care must be taken to determine the cost of the instruction to the calling frame. For simplicity, this cost is defined to be the total cost of the operation minus the amount of gas passed to the child frame. The gas passed to the child frame is determined via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;150&#x2F;&quot;&gt;EIP-150&lt;&#x2F;a&gt;. The computed cost is added to the address&#x27; current sum in the mapping.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If the address does not exist in the mapping, it&#x27;s total gas used is &lt;code&gt;0&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If the instructions throws an out-of-gas (OOG) error, all remaining gas allocated to execution frame is added to the current total gas used by the address.&lt;&#x2F;li&gt;
&lt;li&gt;No other exceptional halt adds remaining gas to the counter for the address where the halt occurred.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;setting-revenue-recipient&quot;&gt;Setting Revenue Recipient&lt;&#x2F;h4&gt;
&lt;p&gt;Revenue recipients are tracked via a new transaction wide mapping &lt;code&gt;revenue_recipient&lt;&#x2F;code&gt; of &lt;code&gt;address&lt;&#x2F;code&gt; to &lt;code&gt;address&lt;&#x2F;code&gt;. The default value for every key is the key itself. For example, unless set otherwise, the key &lt;code&gt;0xdead...beef&lt;&#x2F;code&gt; maps to the value &lt;code&gt;0xdead...beef&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;To set a different revenue recipient, a new instruction &lt;code&gt;SETREVENUERECIPIENT&lt;&#x2F;code&gt; is introduced with the opcode &lt;code&gt;0x49&lt;&#x2F;code&gt;. The operation takes &lt;code&gt;1&lt;&#x2F;code&gt; stack element as input and outputs &lt;code&gt;0&lt;&#x2F;code&gt; stack elements.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;20&lt;&#x2F;code&gt; least significant bytes of the input stack element is the address of the new revenue recipient for the instruction&#x27;s caller. The &lt;code&gt;revenue_recipient&lt;&#x2F;code&gt; entry is updated to reflect this.&lt;&#x2F;p&gt;
&lt;p&gt;The instruction costs &lt;code&gt;3&lt;&#x2F;code&gt; gas.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;dispersing-revenue&quot;&gt;Dispersing Revenue&lt;&#x2F;h4&gt;
&lt;p&gt;After a transaction completes, for every element (&lt;code&gt;addr&lt;&#x2F;code&gt;, &lt;code&gt;gas_used&lt;&#x2F;code&gt;) in &lt;code&gt;gas_used_by_address&lt;&#x2F;code&gt;, increase the balance of &lt;code&gt;revenue_recipient[addr]&lt;&#x2F;code&gt; by &lt;code&gt;gas_used * (header.base_fee_per_gas &#x2F;&#x2F; REVENUE_SHARE_QUOTIENT)&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;tracking-gas-proportionally&quot;&gt;Tracking Gas Proportionally&lt;&#x2F;h3&gt;
&lt;p&gt;A simpler mechanism would be to send the full transaction revenue to the &lt;code&gt;to&lt;&#x2F;code&gt; value of the transaction. This, however, does not accurately reward the composition of many different smart contracts and applications. Additionally, it is not compatible with smart contract wallets which, by definition, are often the first destination of a transaction.&lt;&#x2F;p&gt;
&lt;p&gt;Maintaining a transaction wide tracker of gas uses makes it possible to distribute revenue to contracts which are genuinely the most utilized.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;ephemeral-revenue-recipient-mapping&quot;&gt;Ephemeral Revenue Recipient Mapping&lt;&#x2F;h3&gt;
&lt;p&gt;Constructing the revenue recipient mapping ephemerally during each transaction appears inefficient on the surface. This value is expected to be relatively static and even if it did need to change, the change could be facilitated by the recipient contract.&lt;&#x2F;p&gt;
&lt;p&gt;Unfortunately such a change is much more invasive for the EVM. The recipient value would need to be stored somewhere. This would require a modification to the account structure in the state trie. Also, the recipient value would need to be set at some point. This would necessitate either a modification to the &lt;code&gt;CREATE*&lt;&#x2F;code&gt; opcodes or a new opcode, similar to &lt;code&gt;SETREVENUERECIPIENT&lt;&#x2F;code&gt;, that would be called by initcode to &quot;initialize&quot; the recipient value.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;increased-max-block-size-complexity&quot;&gt;Increased Max Block Size&#x2F;Complexity&lt;&#x2F;h3&gt;
&lt;p&gt;Similar to EIP-1559, we must consider the effects this will have on block size. Depending on the method by which this is implemented, it could increase maximum block size in the event that a significant number of contracts opt-in to CSR.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Dual Layer Token</title>
        <published>2023-04-30T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Adam Boudjemaa</name><uri>https://github.com/aboudjem</uri>
	</author>
	
	<author>
		<name>Mohamad Hammoud</name><uri>https://github.com/mohamadhammoud</uri>
	</author>
	
	<author>
		<name>Nawar Hisso</name><uri>https://github.com/nawar-hisso</uri>
	</author>
	
	<author>
		<name>Khawla Hassan</name><uri>https://github.com/khawlahssn</uri>
	</author>
	
	<author>
		<name>Mohammad Zakeri Rad</name><uri>https://github.com/zakrad</uri>
	</author>
	
	<author>
		<name>Ashish Sood</name><email>soodgen@gmail.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6960/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6960-dual-layer-token/14070" />
        

        <id>https://wg-eips.ritovision.com/6960/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:6960"
            label="ERC-6960" />
        

        
        

        
        <summary type="html">Token with a two-level classification system using mainId and subId</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6960/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The dual-layer token combines the functionalities of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;, and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; while adding a classification layer that uses &lt;code&gt;mainId&lt;&#x2F;code&gt; as the main asset type identifier and &lt;code&gt;subId&lt;&#x2F;code&gt; as the unique attributes or variations of the main asset.
&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6960&#x2F;.&#x2F;assets&#x2F;eip-6960-dual-layer-token-dlt.png&quot; alt=&quot;Dual Layer Token&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The proposed token aims to offer more granularity in token management, facilitating a well-organized token ecosystem and simplifying the process of tracking tokens within a contract. This standard is particularly useful for tokenizing and enabling the fractional ownership of Real World Assets (RWAs). It also allows for efficient and flexible management of both fungible and non-fungible assets.&lt;&#x2F;p&gt;
&lt;p&gt;The following are examples of assets that the DLT standard can represent fractional ownership of:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Invoices&lt;&#x2F;li&gt;
&lt;li&gt;Company stocks&lt;&#x2F;li&gt;
&lt;li&gt;Digital collectibles&lt;&#x2F;li&gt;
&lt;li&gt;Real estate&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; standard has experienced considerable adoption within the Ethereum ecosystem; however, its design exhibits constraints when handling tokens with multiple classifications, particularly in relation to Real World Assets (RWAs) and fractionalization of assets.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP strives to overcome this limitation by proposing a token standard incorporating a dual-layer classification system, allowing for enhanced organization and management of tokens, especially in situations where additional sub-categorization of token types is necessary.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;dlt-interface&quot;&gt;DLT Interface&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0.8.17&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; DLT token standard interface&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Interface for any contract that wants to implement the DLT standard&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IDLT&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST emit when `subId` token is transferred from `sender` to `recipient`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the address of the previous holder whose balance is decreased&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; recipient&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the address of the new holder whose balance is increased&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; mainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the main token type ID to be transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; subId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the token subtype ID to be transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the amount to be transferred of the token subtype&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; mainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; subId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST emit when `subIds` token array is transferred from `sender` to `recipient`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the address of the previous holder whose balance is decreased&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; recipient&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the address of the new holder whose balance is increased&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; mainIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the main token type ID array to be transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; subIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the token subtype ID array to be transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amounts&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the amount array to be transferred of the token subtype                &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransferBatch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; mainIds&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; subIds&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amounts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST emit when `owner` enables `operator` to manage the `subId` token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the address of the token owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the authorized address to manage the allocated amount for an owner address &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; mainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the main token type ID to be approved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; subId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the token subtype ID to be approved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the amount to be approved of the token subtype&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Approval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; mainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; subId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST emit when `owner` enables or disables (`approved`) `operator` to manage all of its assets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the address of the token owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the authorized address to manage all tokens for an owner address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; approved&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; true if the operator is approved, false to revoke approval&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ApprovalForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST emit when the URI is updated for a main token type ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * URIs are defined in RFC 3986.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * The URI MUST point to a JSON file that conforms to the &amp;quot;DLT Metadata URI JSON Schema&amp;quot;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; oldValue&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the old URI value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; newValue&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the new URI value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; mainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the main token type ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; URI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; oldValue&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newValue&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; mainId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Approve or remove `operator` as an operator for the caller.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Operators can call {transferFrom} or {safeTransferFrom} for any subId owned by the caller.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * The `operator` MUST NOT be the caller.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST emit an {ApprovalForAll} event.     &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the authorized address to manage all tokens for an owner address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; approved&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; true if the operator is approved, false to revoke approval&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setApprovalForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approved&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Moves `amount` tokens from `sender` to `recipient` using the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * allowance mechanism. `amount` is then deducted from the caller&amp;#39;s&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * allowance.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST revert if `sender` or `recipient` is the zero address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST revert if balance of holder for token `subId` is lower than the `amount` sent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST emit a {Transfer} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the address of the previous holder whose balance is decreased&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; recipient&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the address of the new holder whose balance is increased&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; mainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the main token type ID to be transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; subId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the token subtype ID to be transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the amount to be transferred of the token subtype&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is additional data with no specified format&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; True&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if the operation succeeded, false if operation failed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; mainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; subId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sets `amount` as the allowance of `spender` over the caller&amp;#39;s tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * The `operator` MUST NOT be the caller.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST revert if `operator` is the zero address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST emit an {Approval} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the authorized address to manage tokens for an owner address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; mainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the main token type ID to be approved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; subId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the token subtype ID to be approved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the amount to be approved of the token subtype&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; True&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if the operation succeeded, false if operation failed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; mainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; subId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the token with a particular subId balance of an `account`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the address of the token holder&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; mainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the main token type ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; subId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the token subtype ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; amount of tokens owned by `account` in subId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; subBalanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; mainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; subId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the tokens with a particular subIds balance of an `accounts` array&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; accounts&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the address array of the token holder&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; mainIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the main token type ID array&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; subIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the token subtype ID array&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; amount of tokens owned by `accounts` in subIds&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOfBatch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; accounts&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; mainIds&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; subIds&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the allowance allocated to an `operator`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This value changes when {approve} or {transferFrom} are called&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the address of the token owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the authorized address to manage assets for an owner address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; mainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the main token type ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; subId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the token subtype ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; remaining number of tokens that `operator` will be&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * allowed to spend on behalf of `owner` through {transferFrom}. This is&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * zero by default.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; allowance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; mainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; subId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the approval status of an `operator` to manage assets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the address of the token owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the authorized address to manage assets for an owner address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; True&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if the `operator` is allowed to manage all of the assets of `owner`, false if approval is revoked&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * See {setApprovalForAll}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isApprovedForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;dltreceiver-interface&quot;&gt;&lt;code&gt;DLTReceiver&lt;&#x2F;code&gt; Interface&lt;&#x2F;h3&gt;
&lt;p&gt;Smart contracts MUST implement all the functions in the &lt;code&gt;DLTReceiver&lt;&#x2F;code&gt; interface to accept transfers.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0.8.17&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; DLT token receiver interface&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Interface for any contract that wants to support safeTransfers&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * from DLT asset contracts.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IDLTReceiver&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Handle the receipt of a single DLT token type.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Whenever an {DLT} `subId` token is transferred to this contract via {IDLT-safeTransferFrom}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * by `operator` from `sender`, this function is called.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST return its Solidity selector to confirm the token transfer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST revert if any other value is returned or the interface is not implemented by the recipient.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * The selector can be obtained in Solidity with `IDLTReceiver.onDLTReceived.selector`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the address which initiated the transfer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the address which previously owned the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; mainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the main token type ID being transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; subId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; subId is the token subtype ID being transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the amount of tokens being transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is additional data with no specified format&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `IDLTReceiver.onDLTReceived.selector`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onDLTReceived&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; mainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; subId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Handle the receipts of a DLT token type array.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Whenever an {DLT} `subIds` token is transferred to this contract via {IDLT-safeTransferFrom}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * by `operator` from `sender`, this function is called.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST return its Solidity selector to confirm the token transfers.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST revert if any other value is returned or the interface is not implemented by the recipient.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * The selector can be obtained in Solidity with `IDLTReceiver.onDLTReceived.selector`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the address which initiated the transfer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the address which previously owned the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; mainIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the main token type ID being transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; subIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; subId is the token subtype ID being transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amounts&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the amount of tokens being transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is additional data with no specified format&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `IDLTReceiver.onDLTReceived.selector`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onDLTBatchReceived&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; mainIds&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; subIds&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amounts&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The two-level classification system introduced in this EIP allows for a more organized token ecosystem, enabling users to manage and track tokens with greater granularity. It is particularly useful for projects that require token classifications beyond the capabilities of the current ERC-1155 standard.&lt;&#x2F;p&gt;
&lt;p&gt;As assets can have various properties or variations, our smart contract design reflects this by assigning a mainId to each asset category and a unique subId to each derivative or sub-category. This approach expands the capabilities of ERC-1155 to support a broader range of assets with complex requirements. Additionally, it enables tracking of mainBalance for the main asset and subBalance for its sub-assets individual accounts.&lt;&#x2F;p&gt;
&lt;p&gt;The contract can be extended to support the use of subIds in two ways:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Shared SubIds: where all mainIds share the same set of subIds.&lt;&#x2F;li&gt;
&lt;li&gt;Mixed SubIds: where mainIds have unique sets of subIds.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;DLT provides a more versatile solution compared to other token standards such as ERC-20, ERC-721, and ERC-1155 by effectively managing both fungible and non-fungible assets within the same contract.&lt;&#x2F;p&gt;
&lt;p&gt;The following are questions that we considered during the design process:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;How to name the proposal?
The standard introduces a two-level classification to tokens where one main asset (layer 1) can be further sub-divided into several sub-assets (layer 2) hence we decided to name it as &quot;Dual-layer&quot; token to reflect the hierarchical structure of the token classification.&lt;&#x2F;li&gt;
&lt;li&gt;Should we limit the classification to two levels?
The standard’s implementation maintains a mapping to track the total supply of each sub-asset. If we allow sub-assets to have their own children, it would be necessary to introduce additional methods to track each sub-asset, which would be impractical and increases the complexity of the contract.&lt;&#x2F;li&gt;
&lt;li&gt;Should we extend the ERC-1155 standard?
As the ERC-1155 standard is not designed to support a layered classification and requires significant modifications to do so, we concluded that it would not be appropriate to extend it for the dual-layer token standard. Hence, a standalone implementation would be a more suitable approach.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Asset-bound Non-Fungible Tokens</title>
        <published>2023-04-29T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Thomas Bergmueller</name><uri>https://github.com/tbergmueller</uri>
	</author>
	
	<author>
		<name>Lukas Meyer</name><uri>https://github.com/ibex-technology</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6956/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-6956-asset-bound-non-fungible-tokens/14056" />
        

        <id>https://wg-eips.ritovision.com/6956/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        

        
        <category
            term="tag:eip:6956"
            label="ERC-6956" />
        

        
        

        
        <summary type="html">Asset-bound NFTs anchor a token 1-1 to an asset and operations are authorized through oracle-attestation of control over the asset</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6956/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard allows integrating physical and digital ASSETS without signing capabilities into dApps&#x2F;web3 by extending &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;An ASSET, for example a physical object, is marked with a uniquely identifiable ANCHOR. The ANCHOR is bound in a secure and inseparable manner 1:1 to an NFT on-chain - over the complete life cycle of the ASSET.&lt;&#x2F;p&gt;
&lt;p&gt;Through an ATTESTATION, an ORACLE testifies that a particular ASSET associated with an ANCHOR has been CONTROLLED when defining the &lt;code&gt;to&lt;&#x2F;code&gt;-address for certain operations (mint, transfer, burn, approve, ...). The ORACLE signs the ATTESTATION off-chain. The operations are authorized through verifying on-chain that ATTESTATION has been signed by a trusted ORACLE. Note that authorization is solely provided through the ATTESTATION, or in other words, through PROOF-OF-CONTROL over the ASSET. The controller of the ASSET is guaranteed to be the controller of the Asset-Bound NFT.&lt;&#x2F;p&gt;
&lt;p&gt;The proposed ATTESTATION-authorized operations such as &lt;code&gt;transferAnchor(attestation)&lt;&#x2F;code&gt; are permissionless, meaning neither the current owner (&lt;code&gt;from&lt;&#x2F;code&gt;-address) nor the receiver (&lt;code&gt;to&lt;&#x2F;code&gt;-address) need to sign.&lt;&#x2F;p&gt;
&lt;p&gt;Figure 1 shows the data flow of an ASSET-BOUND NFT transfer. The simplified system is utilizing a smartphone as user-device to interact with a physical ASSET and specify the &lt;code&gt;to&lt;&#x2F;code&gt;-address.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6956&#x2F;.&#x2F;assets&#x2F;img&#x2F;erc6956_concept.svg&quot; alt=&quot;Figure 1: Sample system&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The well-known &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; establishes that NFTs may represent &quot;ownership over physical properties [...] as well as digital collectables and even more abstract things such as responsibilities&quot; - in a broader sense, we will refer to all those things as ASSETS, which typically have value to people.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;the-problem&quot;&gt;The Problem&lt;&#x2F;h3&gt;
&lt;p&gt;ERC-721 outlines that &quot;NFTs can represent ownership over digital or physical assets&quot;. ERC-721 excels in this task when used to represent ownership over digital, on-chain assets, that is when the asset is &quot;holding a token of a specific contract&quot; or the asset is an NFT&#x27;s metadata. Today, people commonly treat an NFT&#x27;s metadata (images, traits, ...) as asset-class, with their rarity often directly defining the value of an individual NFT.&lt;&#x2F;p&gt;
&lt;p&gt;However, we see integrity issues not solvable with ERC-721, primarily when NFTS are used to represent off-chain ASSETS (&quot;ownership over physical products&quot;, &quot;digital collectables&quot;, &quot;in-game assets&quot;, &quot;responsibilities&quot;, ...). Over an ASSET&#x27;s lifecycle, the ASSET&#x27;s ownership and possession state changes multiple, sometimes thousands, of times. Each of those state changes may result in shifting obligations and privileges for the involved parties. Therefore tokenization of an ASSET &lt;em&gt;without&lt;&#x2F;em&gt; enforcably anchoring the ASSET&#x27;s associated obligation and properties to the token is not complete. Nowadays, off-chain ASSETs are often &quot;anchored&quot; through adding an ASSET-identifier to a NFT&#x27;s metadata.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;NFT-ASSET integrity:&lt;&#x2F;strong&gt; Contrary to a popular belief among NFT-investors, metadata is data that is, more often than not, mutable and off-chain. Therefore the link between an ASSET through an asset-identifier stored in mutable metadata, which is only linked to the NFT through tokenURI, can be considered weak at best.&lt;&#x2F;p&gt;
&lt;p&gt;Approaches to ensure integrity between metadata (=reference to ASSET) and a token exist. This is most commonly achieved by storing metadata-hashes onchain. Additional problems arise through hashing; For many applications, metadata (besides the asset-identifier) should be update-able. Therefore making metadata immutable through storing a hash is problematic. Further the offchain metadata-resource specified via tokenURI must be made available until eternity, which has historically been subject to failure (IPFS bucket disappears, central tokenURI-provider has downtimes, ...)&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Off-chain-on-chain-integrity:&lt;&#x2F;strong&gt; There are approaches where off-chain ASSET ownership is enforced or conditioned through having ownership over the on-chain representation. A common approach is to burn tokens in order to get the (physical) ASSET, as the integrity cannot be maintained. However, there are no approaches known, where on-chain ownership is enforced through having off-chain ownership of the ASSET. Especially when the current owner of an NFT is incooperative or incapacitated, integrity typically fail due to lack of signing-power from the current NFT owner.&lt;&#x2F;p&gt;
&lt;p&gt;Metadata is off-chain. The majority of implementations completely neglect that metadata is mutable. More serious implementations strive to preserve integrity by for example hashing metadata and storing the hash mapped to the tokenId on-chain. However, this approach does not allow for use-case, where metadata besides the asset-identifier, for example traits, &quot;hours played&quot;, ... shall be mutable or evolvable.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;asset-bound-non-fungible-tokens&quot;&gt;ASSET-BOUND NON-FUNGIBLE TOKENS&lt;&#x2F;h3&gt;
&lt;p&gt;In this standard we propose to&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Elevate the concept of representing physical or digital off-chain ASSETS by on-chain ANCHORING the ASSET inseperably into an NFT.&lt;&#x2F;li&gt;
&lt;li&gt;Being off-chain in control over the ASSET must mean being on-chain in control over the anchored NFT.&lt;&#x2F;li&gt;
&lt;li&gt;(Related) A change in off-chain ownership over the ASSET inevitably should be reflected by a change in on-chain ownership over the anchored NFT, even if the current owner is uncooperative or incapacitated.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;As 2. and 3. indicate, the control&#x2F;ownership&#x2F;possession of the ASSET should be the single source of truth, &lt;em&gt;not&lt;&#x2F;em&gt; the possession of an NFT. Hence, we propose an ASSET-BOUND NFT, where off-chain CONTROL over the ASSET enforces on-chain CONTROL over the anchored NFT.
Also the proposed ASSET-BOUND NFTs allow to anchor digital metadata inseperably to the ASSET. When the ASSET is a physical asset, this allows to design &quot;phygitals&quot; in their purest form, namely creating a &quot;phygital&quot; asset with a physical and digital component that are inseparable. Note that metadata itself can still change, for instance for &quot;Evolvable NFT&quot;.&lt;&#x2F;p&gt;
&lt;p&gt;We propose to complement the existing transfer control mechanisms of a token according to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; by another mechanism; ATTESTATION. An ATTESTATION is signed off-chain by the ORACLE and must only be issued when the ORACLE verified that whoever specifies the &lt;code&gt;to&lt;&#x2F;code&gt; address or beneficiary address has simultaneously been in control over the ASSET. The &lt;code&gt;to&lt;&#x2F;code&gt; address of an attestation may be used for Transfers as well as for approvals and other authorizations.&lt;&#x2F;p&gt;
&lt;p&gt;Transactions authorized via ATTESTATION shall not require signature or approval from neither the &lt;code&gt;from&lt;&#x2F;code&gt; (donor, owner, sender) nor &lt;code&gt;to&lt;&#x2F;code&gt; (beneficiary, receiver) account, namely making transfers permissionless. Ideally, transaction are signed independent from the ORACLE as well, allowing different scenarios in terms of gas-fees.&lt;&#x2F;p&gt;
&lt;p&gt;Lastly we want to mention two major side-benefits of using the proposed standard, which drastically lowers hurdles in onboarding web2 users and increase their security;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;New users, e.g &lt;code&gt;0xaa...aa&lt;&#x2F;code&gt; (Fig.1), can use gasless wallets, hence participate in Web3&#x2F;dApps&#x2F;DeFi and mint+transfer tokens without ever owning crypto currency. Gas-fees may be paid through a third-party account &lt;code&gt;0x..gasPayer&lt;&#x2F;code&gt; (Fig.1). The gas is typically covered by the ASSET issuer, who signs &lt;code&gt;transferAnchor()&lt;&#x2F;code&gt; transactions&lt;&#x2F;li&gt;
&lt;li&gt;Users cannot get scammed. Common attacks (for example wallet-drainer scams) are no longer possible or easily reverted, since only the anchored NFT can be stolen, not the ASSET itself. Also mishaps like transferring the NFT to the wrong account, losing access to an account etc can be mitigated by executing another &lt;code&gt;transferAnchor()&lt;&#x2F;code&gt; transaction based on proofing control over the ASSET, namely the physical object.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;related-work&quot;&gt;Related work&lt;&#x2F;h3&gt;
&lt;p&gt;We primarily aim to onboard physical or digital ASSETS into dApps, which do not signing-capabilities of their own (contrary to other proposals relying on crypto-chips). Note that we do not see any restrictions preventing to use such solutions in combination with this standard, as the address of the crypto-chip qualifies as an ANCHOR.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;definitions-alphabetical&quot;&gt;Definitions (alphabetical)&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;ANCHOR&lt;&#x2F;strong&gt; uniquely identifies the off-chain ASSET, whether it is physical or digital.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;ANCHOR-TECHNOLOGY&lt;&#x2F;strong&gt; MUST ensure that&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;the ANCHOR is inseparable from the ASSET (physically or otherwise)&lt;&#x2F;li&gt;
&lt;li&gt;an ORACLE can establish PROOF-OF-CONTROL over the ASSET beyond reasonable doubt&lt;&#x2F;li&gt;
&lt;li&gt;For physical ASSETS, additional &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6956&#x2F;#security-considerations-for-physical-assets&quot;&gt;Security considerations for Physical Assets&lt;&#x2F;a&gt; MUST be taken into account&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;ASSET&lt;&#x2F;strong&gt; refers to the &quot;thing&quot;, being it physical or digital, which is represented through NFTs according to the proposed standard. Typically, an ASSET does not have signing capabilities.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;ATTESTATION&lt;&#x2F;strong&gt; is the confirmation that PROOF OF CONTROL was established when specifying the &lt;code&gt;to&lt;&#x2F;code&gt; (receiver, beneficiary) address.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;PROOF-OF-CONTROL&lt;&#x2F;strong&gt; over the ASSET means owning or otherwise controlling an ASSET. How Proof of Control is established depends on the ASSET and may be implemented using technical, legal or other means. For physical ASSETS, CONTROL is typically verified by proofing physical proximity between a physical ASSET and an input device (for example a smartphone) used to specify the &lt;code&gt;to&lt;&#x2F;code&gt; address.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;An &lt;strong&gt;ORACLE&lt;&#x2F;strong&gt; has signing capabilities. MUST be able to sign ATTESTATIONS off-chain in a way such that signatures can be verified on-chain.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;base-interface&quot;&gt;Base Interface&lt;&#x2F;h3&gt;
&lt;p&gt;Every contract compliant to this standard MUST implement the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6956&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;IERC6956.sol&quot;&gt;the proposed standard interface&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; interfaces and is subject to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6956&#x2F;#caveats-for-base-interface&quot;&gt;Caveats&lt;&#x2F;a&gt; below:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: MIT OR CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.18&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; IERC6956 Asset-Bound Non-Fungible Tokens &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Asset-bound Non-Fungible Tokens anchor a token 1:1 to a (physical or digital) asset and token transfers are authorized through attestation of control over the asset&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-6956&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *      &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: The ERC-165 identifier for this interface is 0xa9cf7635&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6956&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Authorization, typically mapped to authorizationMaps, where each bit indicates whether a particular ERC6956Role is authorized &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      Typically used in constructor (hardcoded or params) to set burnAuthorization and approveAuthorization&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      Also used in optional updateBurnAuthorization, updateApproveAuthorization, I&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Authorization&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        NONE&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;               &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; = 0,      &#x2F;&#x2F; None of the above&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        OWNER&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;              &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; = (1&amp;lt;&amp;lt;OWNER), &#x2F;&#x2F; The owner of the token, i.e. the digital representation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        ISSUER&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;             &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; = (1&amp;lt;&amp;lt;ISSUER), &#x2F;&#x2F; The issuer of the tokens, i.e. this smart contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        ASSET&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;              &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; = (1&amp;lt;&amp;lt;ASSET), &#x2F;&#x2F; The asset, i.e. via attestation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        OWNER_AND_ISSUER&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; = (1&amp;lt;&amp;lt;OWNER) | (1&amp;lt;&amp;lt;ISSUER),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        OWNER_AND_ASSET&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; = (1&amp;lt;&amp;lt;OWNER) | (1&amp;lt;&amp;lt;ASSET),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        ASSET_AND_ISSUER&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; = (1&amp;lt;&amp;lt;ASSET) | (1&amp;lt;&amp;lt;ISSUER),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        ALL&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                 &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; = (1&amp;lt;&amp;lt;OWNER) | (1&amp;lt;&amp;lt;ISSUER) | (1&amp;lt;&amp;lt;ASSET) &#x2F;&#x2F; Owner + Issuer + Asset&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when approved address for an anchored tokenId is &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; or reaffirmed via attestation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when approveAnchor() is called and corresponds to ERC-721 behavior&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The owner of the anchored tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; approved&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The approved address, address(0) indicates there is no approved address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; anchor&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The anchor, for which approval has been &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID (&amp;gt;0) of the anchored token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AnchorApproval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approved&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; anchor&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when the ownership of any anchored NFT changes by any mechanism&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits together with tokenId-based ERC-721.Transfer and provides an anchor-perspective on transfers&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The previous owner, address(0) indicate there was none.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The new owner, address(0) indicates the token is burned&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; anchor&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The anchor which is bound to tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID (&amp;gt;0) of the anchored token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AnchorTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; anchor&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when an attestation has been used indicating no second attestation with the same attestationHash will be accepted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The to address specified in the attestation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; anchor&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The anchor specified in the attestation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; attestationHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The hash of the attestation, see ERC-6956 for details&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; totalUsedAttestationsForAnchor&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The total number of attestations already used for the particular anchor&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AttestationUse&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; anchor&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attestationHash&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; totalUsedAttestationsForAnchor&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when the trust-status of an oracle changes. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Trusted oracles must explicitly be specified. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      If the last event for a particular oracle-address indicates it&amp;#39;s trusted, attestations from this oracle are valid.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; oracle&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the oracle signing attestations&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; trusted&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; indicating whether this address is trusted (true). Use (false) to no longer trust from an oracle.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OracleUpdate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; oracle&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trusted&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the 1:1 mapped anchor for a tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID (&amp;gt;0) of the anchored token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; anchor&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The anchor bound to tokenId, 0x0 if tokenId does not represent an anchor&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; anchorByToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; anchor&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the ID of the 1:1 mapped token of an anchor.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; anchor&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The anchor (&amp;gt;0x0)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the anchored token, 0 if no anchored token exists&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenByAnchor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; anchor&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The number of attestations already used to modify the state of an anchor or its bound tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; anchor&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The anchor(&amp;gt;0)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; attestationUses&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The number of attestation uses for a particular anchor, 0 if anchor is invalid.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; attestationsUsedByAnchor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; anchor&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attestationUses&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Decodes and returns to-address, anchor and the attestation hash, if the attestation is valid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST throw when&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  - Attestation has already been used (an AttestationUse-Event with matching attestationHash was emitted)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  - Attestation is not signed by trusted oracle (the last OracleUpdate-Event for the signer-address does not indicate trust)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  - Attestation is not valid yet or expired&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  - [if IERC6956AttestationLimited is implemented] attestationUsagesLeft(attestation.anchor) &amp;lt;= 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  - [if IERC6956ValidAnchors is implemented] validAnchors(data) does not return true. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; attestation&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The attestation subject to the format specified in ERC-6956&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Optional additional data, may contain proof as the first abi-encoded argument when IERC6956ValidAnchors is implemented&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address where the ownership of an anchored token or approval shall be &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; anchor&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The anchor (&amp;gt;0)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; attestationHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The attestation hash computed on-chain as `keccak256(attestation)`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; decodeAttestationIfValid&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attestation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; anchor&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attestationHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Indicates whether any of ASSET, OWNER, ISSUER is authorized to burn&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; burnAuthorization&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Authorization&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; burnAuth&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Indicates whether any of ASSET, OWNER, ISSUER is authorized to approve&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approveAuthorization&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Authorization&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approveAuth&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Corresponds to transferAnchor(bytes,bytes) without additional data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; attestation&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Attestation, refer ERC-6956 for details&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferAnchor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attestation&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Changes the ownership of an NFT mapped to attestation.anchor to attestation.to address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Permissionless, i.e. anybody invoke and sign a transaction. The transfer is authorized through the oracle-signed attestation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  - Uses decodeAttestationIfValid()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  - When using a centralized &amp;quot;gas-payer&amp;quot; recommended to implement IERC6956AttestationLimited.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  - Matches the behavior of ERC-721.safeTransferFrom(ownerOf[tokenByAnchor(attestation.anchor)], attestation.to, tokenByAnchor(attestation.anchor), ..) and mint an NFT if `tokenByAnchor(anchor)==0`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  - Throws when attestation.to == ownerOf(tokenByAnchor(attestation.anchor))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  - Emits AnchorTransfer  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; attestation&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Attestation, refer ERC-6956 for details&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Additional data, may be used for additional transfer-conditions, may be sent partly or in full in a call to safeTransferFrom&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferAnchor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attestation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Corresponds to approveAnchor(bytes,bytes) without additional data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; attestation&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Attestation, refer ERC-6956 for details&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approveAnchor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attestation&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Approves attestation.to the token bound to attestation.anchor. .&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Permissionless, i.e. anybody invoke and sign a transaction. The transfer is authorized through the oracle-signed attestation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  - Uses decodeAttestationIfValid()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  - When using a centralized &amp;quot;gas-payer&amp;quot; recommended to implement IERC6956AttestationLimited.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  - Matches the behavior of ERC-721.approve(attestation.to, tokenByAnchor(attestation.anchor)).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  - Throws when ASSET is not authorized to approve.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; attestation&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Attestation, refer ERC-6956 for details &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approveAnchor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attestation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Corresponds to burnAnchor(bytes,bytes) without additional data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; attestation&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Attestation, refer ERC-6956 for details&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; burnAnchor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attestation&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Burns the token mapped to attestation.anchor. Uses ERC-721._burn.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Permissionless, i.e. anybody invoke and sign a transaction. The transfer is authorized through the oracle-signed attestation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  - Uses decodeAttestationIfValid()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  - When using a centralized &amp;quot;gas-payer&amp;quot; recommended to implement IERC6956AttestationLimited.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  - Throws when ASSET is not authorized to burn&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; attestation&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Attestation, refer ERC-6956 for details&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; burnAnchor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attestation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;caveats-for-base-interface&quot;&gt;Caveats for Base Interface&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;MUST implement ERC-721 and ERC-165&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;MUST have bidirectional mapping &lt;code&gt;tokenByAnchor(anchor)&lt;&#x2F;code&gt; and &lt;code&gt;anchorByToken(tokenId)&lt;&#x2F;code&gt;. This implies that a maximum of one token per ANCHOR exists.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;MUST have a mechanism to determine whether an ANCHOR is valid for the contract. RECOMMENDED to implement the proposed &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6956&#x2F;#validanchors-interface&quot;&gt;ValidAnchors-Interface&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;MUST implement &lt;code&gt;decodeAttestationIfValid(attestation, data)&lt;&#x2F;code&gt; to validate and decode ATTESTATIONS as specified in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6956&#x2F;#oracle&quot;&gt;ORACLE-Section&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;MUST return &lt;code&gt;attestation.to&lt;&#x2F;code&gt;, &lt;code&gt;attestation.anchor&lt;&#x2F;code&gt;, &lt;code&gt;attestation.attestationHash&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;MUST not modify state, as this function can be used to check an ATTESTATION&#x27;s validity without redeeming it.&lt;&#x2F;li&gt;
&lt;li&gt;MUST throw when
&lt;ul&gt;
&lt;li&gt;ATTESTATION is not signed from a trusted ORACLE.&lt;&#x2F;li&gt;
&lt;li&gt;ATTESTATION has expired or is not valid yet&lt;&#x2F;li&gt;
&lt;li&gt;ATTESTATION has not been redeemed. &quot;Redeemed&quot; being defined in at least one state-changing operation has been authorized through a particular ATTESTATION.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6956&#x2F;#attestationlimited-interface&quot;&gt;AttestationLimited-Interface&lt;&#x2F;a&gt; implemented: When &lt;code&gt;attestationUsagesLeft(attestation.to) &amp;lt;= 0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6956&#x2F;#validanchors-interface&quot;&gt;ValidAnchors-Interface&lt;&#x2F;a&gt; implemented: When &lt;code&gt;validAnchor() != true&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6956&#x2F;#validanchors-interface&quot;&gt;ValidAnchors-Interface&lt;&#x2F;a&gt; implemented: MUST call &lt;code&gt;validAnchor(attestation.to, abi.decode(&#x27;bytes32[]&#x27;,data))&lt;&#x2F;code&gt;, meaning the first abi-encoded value in the &lt;code&gt;data&lt;&#x2F;code&gt; parameter corresponds to &lt;code&gt;proof&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;MUST have a ANCHOR-RELEASED mechanism, indicating whether the anchored NFT is released&#x2F;transferable.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Any ANCHOR MUST NOT be released by default.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;MUST extend any ERC-721 token transfer mechanism by:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;MUST throw when &lt;code&gt;ANCHOR&lt;&#x2F;code&gt; is not released.&lt;&#x2F;li&gt;
&lt;li&gt;MUST throw when batchSize &amp;gt; 1, namely no batch transfers are supported with this contract.&lt;&#x2F;li&gt;
&lt;li&gt;MUST emit &lt;code&gt;AnchorTransfer(from, to, anchorByToken[tokenId], tokenId)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;MUST implement &lt;code&gt;attestationsUsedByAnchor(anchor)&lt;&#x2F;code&gt;, returning how many attestations have already been used for a specific anchor.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;MUST implement the state-changing &lt;code&gt;transferAnchor(..)&lt;&#x2F;code&gt;, &lt;code&gt;burnAnchor(..)&lt;&#x2F;code&gt;, &lt;code&gt;approveAnchor(..)&lt;&#x2F;code&gt; and OPTIONAL MAY implement additional state-changing operations which&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;MUST use the &lt;code&gt;decodeAttestationIfValid()&lt;&#x2F;code&gt; to determine &lt;code&gt;to&lt;&#x2F;code&gt;, &lt;code&gt;anchor&lt;&#x2F;code&gt; and &lt;code&gt;attestationHash&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;MUST redeem each ATTESTATION in the same transaction as any authorized state-changing operation. RECOMMENDED by storing each used &lt;code&gt;attestationHash&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;MUST increment &lt;code&gt;attestationsUsedByAnchor[anchor]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;MUST emit &lt;code&gt;AttestationUsed&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;transferAnchor(attestation)&lt;&#x2F;code&gt; MUST behave and emit events like &lt;code&gt;ERC-721.safeTransferFrom(ownerOf[tokenByAnchor(attestation.anchor)], attestation.to, tokenByAnchor(attestation.anchor), ..)&lt;&#x2F;code&gt; and mint an NFT if &lt;code&gt;tokenByAnchor(anchor)==0&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;RECOMMENDED to implement &lt;code&gt;tokenURI(tokenId)&lt;&#x2F;code&gt; to return an anchorBased-URI, namely &lt;code&gt;baseURI&#x2F;anchor&lt;&#x2F;code&gt;. This anchoring metadata to ASSET. Before an anchor is not used for the first time, the ANCHOR&#x27;s mapping to tokenId is unknown. Hence, using the anchor in instead of the tokenId is preferred.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;oracle&quot;&gt;ORACLE&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;MUST provide an ATTESTATION. Below we define the format how an ORACLE testifies that the &lt;code&gt;to&lt;&#x2F;code&gt; address of a transfer has been specified under the pre-condition of PROOF-OF-CONTROL associated with the particular ANCHOR being transferred to &lt;code&gt;to&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The ATTESTATION MUST abi-encode the following:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;to&lt;&#x2F;code&gt;, MUST be address, specifying the beneficiary, for example the to-address, approved account etc.&lt;&#x2F;li&gt;
&lt;li&gt;ANCHOR, aka the ASSET identifier, MUST have a 1:1 relation to the ASSET&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;attestationTime&lt;&#x2F;code&gt;, UTC seconds, time when attestation was signed by ORACLE,&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;validStartTime&lt;&#x2F;code&gt; UTC seconds, start time of the ATTESTATION&#x27;s validity timespan&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;validEndTime&lt;&#x2F;code&gt;, UTC seconds, end time of the ATTESTATION&#x27;s validity timespan&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;signature&lt;&#x2F;code&gt;, ETH-signature (65 bytes). Output of an ORACLE signing the &lt;code&gt;attestationHash = keccak256([to, anchor, attestationTime, validStartTime, validEndTime])&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;How PROOF-OF-CONTROL is establish in detail through an ANCHOR-TECHNOLOGY is not subject to this standard. Some ORACLE requirements and ANCHOR-TECHNOLOGY requirements when using PHYSICAL ASSETS are outlined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6956&#x2F;#security-considerations-for-physical-assets&quot;&gt;Security considerations for Physical Assets&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;A Minimal Typescript sample to generate an ATTESTATION is available in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6956&#x2F;#reference-implementation&quot;&gt;Reference Implementation section&lt;&#x2F;a&gt; of this proposal.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;attestationlimited-interface&quot;&gt;AttestationLimited-Interface&lt;&#x2F;h3&gt;
&lt;p&gt;Every contract compliant to this standard MAY implement the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6956&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;IERC6956AttestationLimited.sol&quot;&gt;proposed AttestationLimited interface&lt;&#x2F;a&gt; and is subject to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6956&#x2F;#caveats-for-attestationlimited-interface&quot;&gt;Caveats&lt;&#x2F;a&gt; below:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: MIT OR CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.18&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERC6956.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Attestation-limited Asset-Bound NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-6956&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *      &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: The ERC-165 identifier for this interface is 0x75a2e933&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6956AttestationLimited&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6956&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AttestationLimitPolicy&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;    IMMUTABLE&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;    INCREASE_ONLY&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;    DECREASE_ONLY&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;    FLEXIBLE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the attestation limit for a particular anchor&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST return the global attestation limit per default&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      and override the global attestation limit in case an anchor-based limit is set&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; attestationLimit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; anchor&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; limit&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns number of attestations left for a particular anchor&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Is computed by comparing the attestationsUsedByAnchor(anchor) and the current attestation limit &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      (current limited emitted via GlobalAttestationLimitUpdate or AttestationLimit events)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; attestationUsagesLeft&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; anchor&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nrTransfersLeft&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Indicates the policy, in which direction attestation limits can be updated (globally or per anchor)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; attestationLimitPolicy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;AttestationLimitPolicy&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; policy&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when the global attestation limit is updated&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; GlobalAttestationLimitUpdate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; transferLimit&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; updatedBy&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when an anchor-specific attestation limit is updated&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AttestationLimitUpdate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; anchor&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; transferLimit&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; updatedBy&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits in the transaction, where attestationUsagesLeft becomes 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AttestationLimitReached&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; anchor&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; transferLimit&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;caveats-for-attestationlimited-interface&quot;&gt;Caveats for AttestationLimited-Interface&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;MUST extend the proposed standard interface&lt;&#x2F;li&gt;
&lt;li&gt;MUST define one of the above listed AttestationLimit update policies and expose it via &lt;code&gt;attestationLimitPolicy()&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;MUST support different update modes, namely FIXED, INCREASE_ONLY, DECREASE_ONLY, FLEXIBLE (= INCREASABLE and DECREASABLE)&lt;&#x2F;li&gt;
&lt;li&gt;RECOMMENDED to have a global transfer limit, which can be overwritten on a token-basis (when &lt;code&gt;attestationLimitPolicy() != FIXED&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;MUST implement &lt;code&gt;attestationLimit(anchor)&lt;&#x2F;code&gt;, specifying how often an ANCHOR can be transferred in total. Changes in the return value MUST reflect the AttestationLimit-Policy.&lt;&#x2F;li&gt;
&lt;li&gt;MUST implement &lt;code&gt;attestationUsagesLeft(anchor)&lt;&#x2F;code&gt;, returning the number of usages left (namely &lt;code&gt;attestationLimit(anchor)-attestationsUsedByAnchor[anchor]&lt;&#x2F;code&gt;) for a particular anchor&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;floatable-interface&quot;&gt;Floatable-Interface&lt;&#x2F;h3&gt;
&lt;p&gt;Every contract compliant to this extension MAY implement the proposed &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6956&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;IERC6956Floatable.sol&quot;&gt;Floatable interface&lt;&#x2F;a&gt; and is subject to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6956&#x2F;#caveats-for-floatable-interface&quot;&gt;Caveats&lt;&#x2F;a&gt; below:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: MIT OR CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.18&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERC6956.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Floatable Asset-Bound NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A floatable Asset-Bound NFT can (temporarily) be transferred without attestation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-6956&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *      &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: The ERC-165 identifier for this interface is 0xf82773f7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6956Floatable&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6956&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FloatState&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;    Default&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0, inherits from floatAll&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;    Floating&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;    Anchored&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Indicates that an anchor-specific floating state &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FloatingStateChange&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; anchor&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;FloatState&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; isFloating&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emits when FloatingAuthorization is &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FloatingAuthorizationChange&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;Authorization&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; startAuthorization&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;Authorization&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; stopAuthorization&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; maintainer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emits, when the default floating state is &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FloatingAllStateChange&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; areFloating&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Indicates whether an anchored token is floating, namely can be transferred without attestation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; floating&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; anchor&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Indicates whether any of OWNER, ISSUER, (ASSET) is allowed to start floating&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; floatStartAuthorization&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Authorization&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; canStartFloating&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Indicates whether any of OWNER, ISSUER, (ASSET) is allowed to stop floating&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; floatStopAuthorization&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Authorization&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; canStartFloating&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Allows to override or reset to floatAll-behavior per anchor&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Must throw when newState == Floating and floatStartAuthorization does not authorize msg.sender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Must throw when newState == Anchored and floatStopAuthorization does not authorize msg.sender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; anchor&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The anchor, whose anchored token shall override default behavior&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; newState&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Override-State. If set to Default, the anchor will behave like floatAll&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; float&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; anchor&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; FloatState&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newState&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;caveats-for-floatable-interface&quot;&gt;Caveats for Floatable-Interface&lt;&#x2F;h4&gt;
&lt;p&gt;If &lt;code&gt;floating(anchor)&lt;&#x2F;code&gt; returns true, the token identified by &lt;code&gt;tokenByAnchor(anchor)&lt;&#x2F;code&gt; MUST be transferable without attestation, typically authorized via &lt;code&gt;ERC721.isApprovedOrOwner(msg.sender, tokenId)&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;validanchors-interface&quot;&gt;ValidAnchors-Interface&lt;&#x2F;h3&gt;
&lt;p&gt;Every contract compliant to this extension MAY implement the proposed &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6956&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;IERC6956ValidAnchors.sol&quot;&gt;ValidAnchors interface&lt;&#x2F;a&gt; and is subject to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6956&#x2F;#caveats-for-validanchors-interface&quot;&gt;Caveats&lt;&#x2F;a&gt; below:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: MIT OR CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.18&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERC6956.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Anchor-validating Asset-Bound NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-6956&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *      &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: The ERC-165 identifier for this interface is 0x051c9bd8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6956ValidAnchors&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6956&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emits when the valid anchors for the contract are updated.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; validAnchorHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Hash representing all valid anchors. Typically Root of Merkle-Tree&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; maintainer&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; msg.sender when updating the hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ValidAnchorsUpdate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; validAnchorHash&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; maintainer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Indicates whether an anchor is valid in the present contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Typically implemented via MerkleTrees, where proof is used to verify anchor is part of the MerkleTree &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      MUST return false when no ValidAnchorsUpdate-event has been emitted yet&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; anchor&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The anchor in &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;question&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; proof&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Proof that the anchor is valid, typically MerkleProof&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; isValid&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; True, when anchor and proof can be verified against validAnchorHash (emitted via ValidAnchorsUpdate-event)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; anchorValid&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; anchor&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; proof&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; isValid&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;caveats-for-validanchors-interface&quot;&gt;Caveats for ValidAnchors-Interface&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;MUST implement &lt;code&gt;validAnchor(anchor, proof)&lt;&#x2F;code&gt; which returns true when anchor is valid, namely MerkleProof is correct, false otherwise.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;Why do you use an anchor&amp;lt;&amp;gt;tokenId mapping and not simply use tokenIds directly?&lt;&#x2F;strong&gt;
Especially for collectable use-cases, special or sequential tokenIds (for example low numbers), have value. Holders may be proud to have claimed tokenId=1 respectively the off-chain ASSET with tokenId=1 may increase in value, because it was the first ever claimed. Or an Issuer may want to address the first 100 owners who claimed their ASSET-BOUND NFT. While these use-cases technically can certainly be covered by observing the blockchain state-changes, we consider reflecting the order in the tokenIds to be the user-friendly way. Please refer &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6956&#x2F;#security-considerations&quot;&gt;Security considerations&lt;&#x2F;a&gt; on why sequential anchors shall be avoided.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Why is tokenId=0 and anchor=0x0 invalid?&lt;&#x2F;strong&gt;
For gas efficiency. This allows to omit checks and state-variables for the existence of a token or anchor, since mappings of a non-existent key return 0 and cannot be easily distinguished from anchor=0 or tokenId=0.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;ASSETS are often batch-produced with the goal of identical properties, for example a batch of automotive spare parts. Why should do you extend ERC-721 and not Multi-Token standards?&lt;&#x2F;strong&gt;
Even if a (physical) ASSET is mass produced with fungible characteristics, each ASSET has an individual property&#x2F;ownership graph and thus shall be represented in a non-fungible way. Hence this EIP follows the design decision that ASSET (represented via a unique asset identifier called ANCHOR) and token are always mapped 1-1 and not 1-N, so that a token represents the individual property graph of the ASSET.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Why is there a burnAnchor() and approveAnchor()?&lt;&#x2F;strong&gt;
Due to the permissionless nature ASSET-BOUND NFTs can even be transferred to or from any address. This includes arbitrary and randomly generated accounts (where the private key is unknown) and smart-contracts which would traditionally not support ERC-721 NFTs. Following that owning the ASSET must be equivalent to owning the NFT, this means that we also need to support ERC-721 operations like approval and burning in such instances through authorizing the operations with an attestation.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Implementation alternatives considered&lt;&#x2F;strong&gt; Soulbound burn+mint combination, for example through Consensual Soulbound Tokens (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5484&#x2F;&quot;&gt;ERC-5484&lt;&#x2F;a&gt;). Disregarded because appearance is highly dubious, when the same asset is represented through multiple tokens over time. An predecessor of this EIP has used this approach and can be found deployed to Mumbai Testnet under address &lt;code&gt;0xd04c443913f9ddcfea72c38fed2d128a3ecd719e&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;When should I implement AttestationLimited-Interface&lt;&#x2F;strong&gt;
Naturally, when your use-case requires each ASSET being transferable only a limited number of times. But also for security reasons, see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6956&#x2F;#security-considerations&quot;&gt;Security Considerations&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Why is there the &lt;code&gt;IERC6956Floatable.FloatState&lt;&#x2F;code&gt; enum?&lt;&#x2F;strong&gt; In order to allow gas-efficient implementation of floatAll(), which can be overruled by anchor-based floatability in all combinations. (See rationale for tokenId=0 above).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Why is there no &lt;code&gt;floating(tokenId)&lt;&#x2F;code&gt; function?&lt;&#x2F;strong&gt;
This would behave identically to an &lt;code&gt;isTransferable(tokenId,...)&lt;&#x2F;code&gt; mechanism proposed in many other EIPs (refer e.g. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6454&#x2F;&quot;&gt;ERC-6454&lt;&#x2F;a&gt;). Further, the proposed &lt;code&gt;floating(anchorByToken(tokenId))&lt;&#x2F;code&gt; can be used.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Why are there different FloatingAuthorizations for start and stop?&lt;&#x2F;strong&gt;
Depending on the use-case, different roles should be able to start or stop floating. Note that for many applications the ISSUER may want to have control over the floatability of the collection.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;example-use-cases-and-recommended-combination-of-interfaces&quot;&gt;Example Use Cases and recommended combination of interfaces&lt;&#x2F;h3&gt;
&lt;p&gt;Possession based use cases are covered by the standard interface &lt;code&gt;IERC6956&lt;&#x2F;code&gt;: The holder of ASSET is in possession of ASSET. Possession is an important social and economical tool: In many sports games possession of ASSET, commonly referred to as &quot;the ball&quot;, is of essence. Possession can come with certain obligations and privileges. Ownership over an ASSET can come with rights and benefits as well as being burdened with liens and obligations. For example, an owned ASSET can be used for collateral, can be rented or can even yield a return. Example use-cases are&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Possession based token gating:&lt;&#x2F;strong&gt; Club guest in possession of limited T-Shirt (ASSET) gets a token which allows him to open the door to the VIP lounge.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Possession based digital twin:&lt;&#x2F;strong&gt; A gamer is in possession of a pair of physical sneakers (ASSET), and gets a digital twin (NFT) to wear them in metaverse.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Scarce possession based digital twin:&lt;&#x2F;strong&gt; The producer of the sneakers (ASSET) decided that the product includes a limit of 5 digital twins (NFTs), to create scarcity.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Lendable digital twin:&lt;&#x2F;strong&gt; The gamer can lend his sneaker-tokens (NFT) to a friend in the metaverse, so that the friend can run faster.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Securing ownership from theft:&lt;&#x2F;strong&gt; If ASSET is owned off-chain, the owner wants to secure the anchored NFT, namely not allow transfers to prevent theft or recover the NFT easily through the ASSET.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Selling a house with a mortgage:&lt;&#x2F;strong&gt; The owner holds NFT as proof of ownership. The DeFi-Bank finances the house and puts a lock on the transfer of NFT. Allow Transfers of the NFT require the mortgage to be paid off. Selling the ASSET (house) off-chain will be impossible, as it&#x27;s no longer possible to finance the house.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Selling a house with a lease:&lt;&#x2F;strong&gt; A lease contract puts a lien on an ASSET&#x27;s anchored NFT. The old owner removes the lock, the new owner buys and refinances the house. Transfer of NFT will also transfer the obligations and benefits of the lien to the new owner.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Buying a brand new car with downpayment:&lt;&#x2F;strong&gt; A buyer configures a car and provides a downpayment, for a car that will have an ANCHOR. As long as the car is not produced, the NFT can float and be traded on NFT market places. The owner of the NFT at time of delivery of the ASSET has the permission to pick up the car and the obligation to pay full price.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Buying a barrel of oil by forward transaction:&lt;&#x2F;strong&gt; A buyer buys an oil option on a forward contract for one barrel of oil (ASSET). On maturity date the buyer has the obligation to pick up the oil.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The use case matrix below shows which extensions and settings must (additionally to &lt;code&gt;IERC6956&lt;&#x2F;code&gt;!) be implemented for the example use-cases together with relevant configurations.&lt;&#x2F;p&gt;
&lt;p&gt;Note that for &lt;code&gt;Lockable&lt;&#x2F;code&gt; listed in the table below, the proposed EIP can be extended with any Lock- or Lien-Mechanism known to extend for ERC-721, for example &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5192&#x2F;&quot;&gt;ERC-5192&lt;&#x2F;a&gt; or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6982&#x2F;&quot;&gt;ERC-6982&lt;&#x2F;a&gt;. We recommend to verify whether a token is locked in the &lt;code&gt;_beforeTokenTransfer()&lt;&#x2F;code&gt;-hook, as this is called from &lt;code&gt;safeTransferFrom()&lt;&#x2F;code&gt; as well as &lt;code&gt;transferAnchor()&lt;&#x2F;code&gt;, hence suitable to block &quot;standard&quot; ERC-721 transfers as well as the proposed attestation-based transfers.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Use Case&lt;&#x2F;th&gt;&lt;th&gt;approveAuthorization&lt;&#x2F;th&gt;&lt;th&gt;burnAuthorization&lt;&#x2F;th&gt;&lt;th&gt;&lt;code&gt;IERC6956Floatable&lt;&#x2F;code&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;code&gt;IERC6956AttestationLimited&lt;&#x2F;code&gt;&lt;&#x2F;th&gt;&lt;th&gt;Lockable&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Managing Possession&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Token gating&lt;&#x2F;td&gt;&lt;td&gt;ASSET&lt;&#x2F;td&gt;&lt;td&gt;ANY&lt;&#x2F;td&gt;&lt;td&gt;incompatible&lt;&#x2F;td&gt;&lt;td&gt;-&lt;&#x2F;td&gt;&lt;td&gt;-&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Digital twin&lt;&#x2F;td&gt;&lt;td&gt;ASSET&lt;&#x2F;td&gt;&lt;td&gt;ANY&lt;&#x2F;td&gt;&lt;td&gt;incompatible&lt;&#x2F;td&gt;&lt;td&gt;-&lt;&#x2F;td&gt;&lt;td&gt;-&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Scarce digital twin&lt;&#x2F;td&gt;&lt;td&gt;ASSET&lt;&#x2F;td&gt;&lt;td&gt;ANY&lt;&#x2F;td&gt;&lt;td&gt;incompatible&lt;&#x2F;td&gt;&lt;td&gt;required&lt;&#x2F;td&gt;&lt;td&gt;-&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Lendable digital twin&lt;&#x2F;td&gt;&lt;td&gt;OWNER_AND_ASSET&lt;&#x2F;td&gt;&lt;td&gt;ASSET&lt;&#x2F;td&gt;&lt;td&gt;required&lt;&#x2F;td&gt;&lt;td&gt;-&lt;&#x2F;td&gt;&lt;td&gt;-&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Managing Ownership&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Securing ownership from theft&lt;&#x2F;td&gt;&lt;td&gt;OWNER or OWNER_AND_ASSET&lt;&#x2F;td&gt;&lt;td&gt;ANY&lt;&#x2F;td&gt;&lt;td&gt;optional&lt;&#x2F;td&gt;&lt;td&gt;-&lt;&#x2F;td&gt;&lt;td&gt;required&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Selling an house with a mortgage&lt;&#x2F;td&gt;&lt;td&gt;ASSET  or OWNER_AND_ASSET&lt;&#x2F;td&gt;&lt;td&gt;ANY&lt;&#x2F;td&gt;&lt;td&gt;optional&lt;&#x2F;td&gt;&lt;td&gt;optional&lt;&#x2F;td&gt;&lt;td&gt;required&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Selling a house with a lease&lt;&#x2F;td&gt;&lt;td&gt;ASSET or OWNER_AND_ASSET&lt;&#x2F;td&gt;&lt;td&gt;ANY&lt;&#x2F;td&gt;&lt;td&gt;optional&lt;&#x2F;td&gt;&lt;td&gt;optional&lt;&#x2F;td&gt;&lt;td&gt;required&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Buying a brand new car with downpayment&lt;&#x2F;td&gt;&lt;td&gt;ASSET or OWNER_AND_ASSET&lt;&#x2F;td&gt;&lt;td&gt;ANY&lt;&#x2F;td&gt;&lt;td&gt;optional&lt;&#x2F;td&gt;&lt;td&gt;optional&lt;&#x2F;td&gt;&lt;td&gt;required&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Buying a barrel of oil by forward transaction&lt;&#x2F;td&gt;&lt;td&gt;ASSET or OWNER_AND_ASSET&lt;&#x2F;td&gt;&lt;td&gt;ANY&lt;&#x2F;td&gt;&lt;td&gt;optional&lt;&#x2F;td&gt;&lt;td&gt;optional&lt;&#x2F;td&gt;&lt;td&gt;required&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Legend:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;required ... we don&#x27;t see a way how to implement the use-case without it&lt;&#x2F;li&gt;
&lt;li&gt;incompatible ... this MUSTN&#x27;T be implemented, as it is a security risk for the use-case&lt;&#x2F;li&gt;
&lt;li&gt;optional ... this MAY optionally be implemented&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP is fully compatible with ERC-721 and (when extended with the &lt;code&gt;IERC6956Floatable&lt;&#x2F;code&gt;-interface) corresponds to the well-known ERC-721 behavior with an additional authorization-mechanism via attestations. Therefore we recommend - especially for physical assets - to use the present EIP instead of ERC-721 and amend it with extensions designed for ERC-721.&lt;&#x2F;p&gt;
&lt;p&gt;However, it is RECOMMENDED to extend implementations of the proposed standard with an interface indicating transferability of NFTs for market places. Examples include &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6454&#x2F;&quot;&gt;ERC-6454&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5484&#x2F;&quot;&gt;ERC-5484&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Many ERC-721 extensions suggest to add additional throw-conditions to transfer methods. This standard is fully compatible, as&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The often-used ERC-721 &lt;code&gt;_beforeTokenTransfer()&lt;&#x2F;code&gt; hook must be called for all transfers including attestation-authorized transfers.&lt;&#x2F;li&gt;
&lt;li&gt;A &lt;code&gt;_beforeAnchorUse()&lt;&#x2F;code&gt; hook is suggested in the reference implementation, which only is called when using attestation as authorization.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases are available:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;For only implementing &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6956&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;IERC6956.sol&quot;&gt;the proposed standard interface&lt;&#x2F;a&gt; can be found &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6956&#x2F;.&#x2F;assets&#x2F;test&#x2F;ERC6956.ts&quot;&gt;here&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;For implementing &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6956&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;IERC6956.sol&quot;&gt;the proposed standard interface&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6956&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;IERC6956Floatable.sol&quot;&gt;the Floatable extension&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6956&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;IERC6956ValidAnchors.sol&quot;&gt;the ValidAnchors extension&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6956&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;IERC6956AttestationLimited.sol&quot;&gt;the AttestationLimited extension&lt;&#x2F;a&gt; can be found &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6956&#x2F;.&#x2F;assets&#x2F;test&#x2F;ERC6956Full.ts&quot;&gt;here&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Minimal implementation, only supporting &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6956&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;IERC6956.sol&quot;&gt;the proposed standard interface&lt;&#x2F;a&gt; can be found &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6956&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;ERC6956.sol&quot;&gt;here&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Full implementation, with support for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6956&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;IERC6956.sol&quot;&gt;the proposed standard interface&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6956&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;IERC6956Floatable.sol&quot;&gt;the Floatable extension&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6956&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;IERC6956ValidAnchors.sol&quot;&gt;the ValidAnchors extension&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6956&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;IERC6956AttestationLimited.sol&quot;&gt;the AttestationLimited extension&lt;&#x2F;a&gt; can be found &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6956&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;ERC6956Full.sol&quot;&gt;here&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;A Minimal Typescript sample to generate an ATTESTATION using ethers library is available &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6956&#x2F;.&#x2F;assets&#x2F;minimalAttestationSample.ts&quot;&gt;here&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;If the asset is stolen, does this mean the thief has control over the NFT?&lt;&#x2F;strong&gt;
Yes.The standard aims to anchor an NFT to the asset inseperably and unconditionally. This includes reflecting theft, as the ORACLE will testify that PROOF-OF-CONTROL over the ASSET is established. The ORACLE does not testify whether the controller is the legitimate owner,
Note that this may even be a benefit. If the thief (or somebody receiving the asset from the thief) should interact with the anchor, an on-chain address of somebody connected to the crime (directly or another victim) becomes known. This can be a valuable starting point for investigation.
Also note that the proposed standard can be combined with any lock-mechanism, which could lock attestation-based action temporarily or permanently (after mint).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;How to use AttestationLimits to avoid fund-draining&lt;&#x2F;strong&gt;
A central security mechanism in blockchain applications are gas fees. Gas fees ensure that executing a high number of transactions get penalized, hence all DoS or other large-scale attacks are discouraged. Due to the permissionless nature of attestation-authorized operations, many use-cases will arise, where the issuer of the ASSET (which normally is also the issuer of the ASSET-BOUND NFT) will pay for all transactions - contrary to the well-known ERC-721 behavior, where either from- or to-address are paying. So a user with malicious intent may just let the ORACLE approve PROOF-OF-CONTROL multiple times with specifying alternating account addresses. These ATTESTATIONS will be handed to the central gas-payer, who will execute them in a permissionless way, paying gas-fees for each transactions. This effectively drains the funds from the gas-payer, making the system unusable as soon as the gas-payer can no longer pay for transactions.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Why do you recommend hashing serial numbers over using them plain?&lt;&#x2F;strong&gt;
Using any sequential identifier allows to at least conclude of the number between the lowest and highest ever used serial number. This therefore provides good indication over the total number of assets on the market. While a limited number of assets is often desirable for collectables, publishing exact production numbers of assets is undesirable for most industries, as it equals to publishing sales&#x2F;revenue numbers per product group, which is often considered confidential. Within supply chains, serial numbers are often mandatory due to their range-based processing capability. The simplest approach to allow using physical serial numbers and still obfuscating the actual number of assets is through hashing&#x2F;encryption of the serial number.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Why is anchor-validation needed, why not simply trust the oracle to attest only valid anchors?&lt;&#x2F;strong&gt;
The oracle testifies PROOF-OF-CONTROL. As the ORACLE has to know the merkle-tree of valid anchors, it could also modify the merkle-tree with malicious intent. Therefore, having an on-chain verification, whether the original merkle-tree has been used, is needed. Even if the oracle gets compromised, it should not have the power to introduce new anchors. This is achieved by requiring that the oracle knows the merkle-tree, but updateValidAnchors() can only be called by a maintainer. Note that the oracle must not be the maintainer. As a consequence, care shall be taken off-chain, in order to ensure that compromising one system-part not automatically compromises oracle and maintainer accounts.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Why do you use merkle-trees for anchor-validation?&lt;&#x2F;strong&gt;
For security- and gas-reasons. Except for limited collections, anchors will typically be added over time, e.g. when a new batch of the asset is produced or issued. While it is already ineffective to store all available anchors on-chain gas-wise, publishing all anchors would also expose the total number of assets. When using the data from anchor-updates one could even deduce the production capabilities of that asset, which is usually considered confidential information.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Assume you have N anchors. If all anchored NFTs are minted, what use is a merkle-tree?&lt;&#x2F;strong&gt;
If all anchored NFTs are minted this implies that all anchors have been published and could be gathered on-chain. Consequently, the merkle-tree can be reconstructed. While this may not be an issue for many use cases (all supported anchors are minted anyway), we still recommend to add one &quot;salt-leave&quot; to the merkle-tree, characterized in that the ORACLE will never issue an attestation for an ANCHOR matching that salt-leave. Therefore, even if all N anchors are&lt;&#x2F;p&gt;
&lt;h3 id=&quot;security-considerations-for-physical-assets&quot;&gt;Security Considerations for PHYSICAL ASSETS&lt;&#x2F;h3&gt;
&lt;p&gt;In case the ASSET is a physical object, good or property, the following ADDITIONAL specifications MUST be satisfied:&lt;&#x2F;p&gt;
&lt;h4 id=&quot;oracle-for-physical-anchors&quot;&gt;ORACLE for Physical Anchors&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Issuing an ATTESTATION requires that the ORACLE
&lt;ul&gt;
&lt;li&gt;MUST proof physical proximity between an input device (for example smartphone) specifying the &lt;code&gt;to&lt;&#x2F;code&gt; address and a particular physical ANCHOR and it&#x27;s associated physical object. Typical acceptable proximity is ranges between some millimeters to several meters.&lt;&#x2F;li&gt;
&lt;li&gt;The physical presence MUST be verified beyond reasonable doubt, in particular the employed method
&lt;ul&gt;
&lt;li&gt;MUST be robust against duplication or reproduction attempts of the physical ANCHOR,&lt;&#x2F;li&gt;
&lt;li&gt;MUST be robust against spoofing (for example presentation attacks) etc.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;MUST be implemented under the assumption that the party defining the &lt;code&gt;to&lt;&#x2F;code&gt; address has malicious intent and to acquire false ATTESTATION, without currently or ever having access to the physical object comprising the physical ANCHOR.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;physical-asset&quot;&gt;Physical ASSET&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;MUST comprise an ANCHOR, acting as the unique physical object identifier, typically a serial number (plain (NOT RECOMMENDED) or hashed (RECOMMENDED))&lt;&#x2F;li&gt;
&lt;li&gt;MUST comprise a physical security device, marking or any other feature that enables proofing physical presence for ATTESTATION through the ORACLE&lt;&#x2F;li&gt;
&lt;li&gt;Is RECOMMENDED to employ ANCHOR-TECHNOLOGIES featuring irreproducible security features.&lt;&#x2F;li&gt;
&lt;li&gt;In general it is NOT RECOMMENDED to employ ANCHOR-TECHNOLOGIES that can easily be replicated (for example barcodes, &quot;ordinary&quot; NFC chips, .. ). Replication includes physical and digital replication.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>ERC-5219 Resolve Mode</title>
        <published>2023-04-27T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Gavin John</name><uri>https://github.com/Pandapip1</uri>
	</author>
	
	<author>
		<name>Qi Zhou</name><uri>https://github.com/qizhou</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6944/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-5219-resolve-mode/14088" />
        

        <id>https://wg-eips.ritovision.com/6944/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:6944"
            label="ERC-6944" />
        

        
        

        
        <summary type="html">Adds an ERC-4804 resolveMode to support ERC-5219 requests</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6944/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP adds a new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4804&#x2F;&quot;&gt;ERC-4804&lt;&#x2F;a&gt; &lt;code&gt;resolveMode&lt;&#x2F;code&gt; to resolve &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5219&#x2F;&quot;&gt;ERC-5219&lt;&#x2F;a&gt; contract resource requests.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;Contracts wishing to use ERC-5219 as their ERC-4804 resolve mode must implement the following interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; IDecentralizedApp is the ERC-5219 interface&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5219Resolver&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IDecentralizedApp&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @notice The ERC-4804 resolve mode&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @dev    This MUST return &amp;quot;5219&amp;quot; (0x3532313900000000000000000000000000000000000000000000000000000000) for ERC-5219 resolution (case-insensitive). The other options, as of writing this, are &amp;quot;auto&amp;quot; for automatic resolution, or &amp;quot;manual&amp;quot; for manual resolution.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; resolveMode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; mode&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; was not used because interoperability can be checked by calling &lt;code&gt;resolveMode&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;abstract&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC5219Resolver&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IDecentralizedApp&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; resolveMode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; mode&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      return&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;5219&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The security considerations of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4804&#x2F;#security-considerations&quot;&gt;ERC-4804&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5219&#x2F;#security-considerations&quot;&gt;ERC-5219&lt;&#x2F;a&gt; apply.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Subscription-Based Token</title>
        <published>2023-04-25T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>360 Core</name><email>hello@360coreinc.com</email>
	</author>
	
	<author>
		<name>Robin Rajput</name><uri>https://github.com/0xRobinR</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6932/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-subscription-based-erc20-token/13964" />
        

        <id>https://wg-eips.ritovision.com/6932/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:6932"
            label="ERC-6932" />
        

        
        

        
        <summary type="html">ERC-20 extension providing access to a service or product that requires recurring payments.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6932/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This subscription-based &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; token extends the basic &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; token standard with a &lt;code&gt;subscribe&lt;&#x2F;code&gt; and &lt;code&gt;unsubscribe&lt;&#x2F;code&gt; function, which allow users to subscribe or unsubscribe from the subscription service. The &lt;code&gt;subscriptionFee&lt;&#x2F;code&gt; and &lt;code&gt;subscriptionFrequency&lt;&#x2F;code&gt; variables define the cost and frequency of the subscription. The &lt;code&gt;nextPaymentDate&lt;&#x2F;code&gt; mapping keeps track of the next payment date for each subscriber.&lt;&#x2F;p&gt;
&lt;p&gt;This token standard will enable automatic periodic deductions from user balances as determined by the merchant subscriber. Simplify and streamline subscription-based services on the Ethereum network, offering enhanced convenience and efficiency for users and merchants alike.&lt;&#x2F;p&gt;
&lt;p&gt;A &lt;code&gt;renewSubscription&lt;&#x2F;code&gt; method, that will be used by token holders to renew their subscription to a service or product that requires recurring payments in the form of the token.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The rise of subscription-based business models necessitates a standardized approach to handle recurring payments on the Ethereum blockchain. Currently, users often manually initiate subscription payments, resulting in inconvenience and potential disruptions in service delivery. By introducing a Subscription Token, users can seamlessly authorize periodic deductions, enabling uninterrupted access to subscribed services.&lt;&#x2F;p&gt;
&lt;p&gt;The subscription-based &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; token provides a more flexible and convenient way to manage recurring payments. It can be used for a wide range of services and products that require regular payments, such as subscription-based content platforms, gaming services, and more.&lt;&#x2F;p&gt;
&lt;p&gt;The Subscription Token ensures consistency and interoperability across different implementations. Key features include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Auto Deduction: Merchants, acting as subscribers, can set the subscription interval and associated payment amount for their services. This information is encoded within the Subscription Token contract, enabling automatic deductions from user balances at regular intervals without requiring manual intervention.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Balance Check: Users can verify the remaining balance of their subscription tokens at any given time. This transparency empowers users to monitor their subscriptions and make informed decisions regarding their ongoing commitment to the service.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Flexibility: The Subscription Token framework accommodates various subscription models, such as monthly, quarterly, or annual billing cycles. Additionally, merchants have the option to define trial periods, upgrade&#x2F;downgrade plans, and cancellation policies, providing a versatile foundation for a wide range of subscription-based businesses.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Security: The Subscription Token employs established security measures, including the use of cryptographic signatures, to ensure the integrity and authenticity of subscription-related transactions. This protects both users and merchants from unauthorized access and potential malicious activities.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Below are the implementations required by the standard:&lt;&#x2F;p&gt;
&lt;h3 id=&quot;subscriptiontoken&quot;&gt;&lt;code&gt;SubscriptionToken&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;subscribers&quot;&gt;&lt;code&gt;subscribers&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Returns the list of &lt;code&gt;addresses&lt;&#x2F;code&gt; subscribed to the subscription token contract.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;subscriptioninfo&quot;&gt;&lt;code&gt;subscriptionInfo&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Metadata information of the subscription, like - &lt;code&gt;subscriptionID&lt;&#x2F;code&gt;, &lt;code&gt;subscriptionName&lt;&#x2F;code&gt;, &lt;code&gt;subscriptionDesc&lt;&#x2F;code&gt; and &lt;code&gt;subscriptionTandC&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;subscriptionfee&quot;&gt;&lt;code&gt;subscriptionFee&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The subscription amount specified that will be deducted in &lt;code&gt;subscriptionFrequency&lt;&#x2F;code&gt; interval, when an address subscribes to the subscription token contract.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;subscriptionfrequency&quot;&gt;&lt;code&gt;subscriptionFrequency&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Frequency of subscription, interval at which the &lt;code&gt;subscriptionFee&lt;&#x2F;code&gt; will be charged. for example, every 1 day, 1 week or 1 month, denoted in seconds.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;subscribe&quot;&gt;&lt;code&gt;subscribe&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Method for subscribing an address to the subscription token contract.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;unsubscribe&quot;&gt;&lt;code&gt;unsubscribe&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Revoke subscription from the subscription token contract, by the subscribed address.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ISubscriptionERC20&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; map subscribers address, returns address(0) if `idx` is not found&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; idx&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the key of the map values&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address at key `idx` of subscribers map&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; subscribers&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; idx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; information of the subscription token contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; subscriptionID&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;, subscriptionName, subscriptionDesc, subscriptionTandC&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; subscriptionInfo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; subscribes to the subscription, can be payable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; subscribe&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; unsubscribe the subscription&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; unsubscribe&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; view or pure can be used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; subscription fee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; subscriptionFee&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; view or pure can be used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; get&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the subscription frequency&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; subscriptionFrequency&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The subscription token contract inherits the fundamentals of subscription by deducting payments from subscribed addresses on a regular interval using mathematical formulas.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;uint256 intervals = ( block.timestamp - info.start ) &#x2F; info.frequency;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;uint256 amount = info.amount * intervals;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;uint256 localEffectiveBalance = effectiveBalance[account];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;if ( (totalAmount + amount) &amp;gt; localEffectiveBalance ) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    amount = localEffectiveBalance;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;totalAmount += ( localEffectiveBalance - amount );&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Here, the token balance of the address is calculated using, the locked balances from ongoing subscripitons and the effective balance of the address (updates whenever a transfer is made).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Subscription Tokens may require users to sign transactions or provide cryptographic proofs for subscription-related actions. Proper key management practices should be followed to protect users&#x27; private keys and prevent unauthorized access. Encouraging the use of hardware wallets or secure key storage solutions can mitigate the risk of key compromise.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Reserved Ownership Accounts</title>
        <published>2023-04-25T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Paul Sullivan</name><uri>https://github.com/sullivph</uri><email>paul.sullivan@manifold.xyz</email>
	</author>
	
	<author>
		<name>Wilkins Chung</name><uri>https://github.com/wwchung</uri><email>wilkins@manifold.xyz</email>
	</author>
	
	<author>
		<name>Kartik Patel</name><uri>https://github.com/Slokh</uri><email>kartik@manifold.xyz</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6981/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-6981-reserved-ownership-accounts/14118" />
        

        <id>https://wg-eips.ritovision.com/6981/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:6981"
            label="ERC-6981" />
        

        
        

        
        <summary type="html">A registry for generating future-deployed smart contract accounts owned by users on external services</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6981/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The following specifies a system for services to link their users to a claimable Ethereum address. Services can provide a signed message and unique salt to their users which can be used to deploy a smart contract wallet to the deterministic address through a registry contract using the &lt;code&gt;create2&lt;&#x2F;code&gt; opcode.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;It is common for web services to allow their users to hold on-chain assets via custodial wallets. These wallets are typically EOAs, deployed smart contract wallets or omnibus contracts, with private keys or asset ownership information stored on a traditional database. This proposal outlines a solution that avoids the security concerns associated with historical approaches, and rids the need and implications of services controlling user assets&lt;&#x2F;p&gt;
&lt;p&gt;Users on external services that choose to leverage the following specification can be given an Ethereum address to receive assets without the need to do any on-chain transaction. These users can choose to attain control of said addresses at a future point in time. Thus, on-chain assets can be sent to and owned by a user beforehand, therefore enabling the formation of an on-chain identity without requiring the user to interact with the underlying blockchain.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;overview&quot;&gt;Overview&lt;&#x2F;h3&gt;
&lt;p&gt;The system for creating reserved ownership accounts consists of:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;An Account Registry which provides deterministic addresses based on the service users&#x27; identifying salts, and implements a signature verified function that enables claiming of Account Instances by the service&#x27;s end users.&lt;&#x2F;li&gt;
&lt;li&gt;Account Instances created through the Account Registry by end users which allow access to the assets received at the deterministic address prior to Account Instance deployment.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;External services wishing to provide their users with reserved ownership accounts MUST maintain a relationship between a user&#x27;s identifying credentials and a salt. The external service SHALL refer to an Account Registry Instance to retrieve the deterministic account address for a given salt. Users of a given service MUST be able to create an Account Instance by validating their identifying credentials via the external service, which SHOULD give the user a signed message for their salt. Signatures SHOULD be generated by the external service using an signing address known to the Account Registry Instance. Users SHALL pass this message and signature to the service&#x27;s Account Registry Instance in a call to &lt;code&gt;claimAccount&lt;&#x2F;code&gt; to deploy and claim an Account Instance at the deterministic address.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;account-registry&quot;&gt;Account Registry&lt;&#x2F;h3&gt;
&lt;p&gt;The Account Registry MUST implement the following interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IAccountRegistry&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Registry instances emit the AccountCreated event upon successful account creation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AccountCreated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; accountImplementation&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; salt&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Registry instances emit the AccountClaimed event upon successful claim of account by owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AccountClaimed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Creates a smart contract account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * If account has already been created, returns the account address without calling create2.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; salt&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;       - The identifying salt for which the user wishes to deploy an Account Instance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Emits AccountCreated event&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address for which the Account Instance was created&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; createAccount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; salt&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Allows an owner to claim a smart contract account created by this registry.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * If the account has not already been created, the account will be created first using `createAccount`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      - The initial owner of the new Account Instance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; salt&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;       - The identifying salt for which the user wishes to deploy an Account Instance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; expiration&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - If expiration &amp;gt; 0, represents expiration time for the signature.  Otherwise&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *                     signature does not expire.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; message&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    - The keccak256 message which validates the owner, salt, expiration&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  - The signature which validates the owner, salt, expiration&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Emits AccountClaimed event&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address of the claimed Account Instance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; claimAccount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; salt&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expiration&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; message&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the computed address of a smart contract account for a given identifying salt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; computed address of the account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; salt&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Fallback signature verification for unclaimed accounts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isValidSignature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;createaccount&quot;&gt;createAccount&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;createAccount&lt;&#x2F;code&gt; is used to deploy the Account Instance for a given salt.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;This function MUST deploy a new Account Instance as a &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1167&#x2F;&quot;&gt;ERC-1167&lt;&#x2F;a&gt; proxy pointing to the account implementation.&lt;&#x2F;li&gt;
&lt;li&gt;This function SHOULD set the initial owner of the Account Instance to the Account Registry Instance.&lt;&#x2F;li&gt;
&lt;li&gt;The account implementation address MUST be immutable, as it is used to compute the deterministic address for the Account Instance.&lt;&#x2F;li&gt;
&lt;li&gt;Upon successful deployment of the Account Instance, the registry SHOULD emit an &lt;code&gt;AccountCreated&lt;&#x2F;code&gt; event.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;claimaccount&quot;&gt;claimAccount&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;claimAccount&lt;&#x2F;code&gt; is used to claim ownership of the Account Instance for a given salt.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;This function MUST create a new Account Instance if one does not already exist for the given salt.&lt;&#x2F;li&gt;
&lt;li&gt;This function SHOULD verify that the msg.sender has permission to claim ownership over the Account Instance for the identifying salt and initial owner. Verification SHOULD be done by validating the message and signature against the owner, salt and expiration using ECDSA for EOA signers, or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;ERC-1271&lt;&#x2F;a&gt; for smart contract signers.&lt;&#x2F;li&gt;
&lt;li&gt;This function SHOULD verify that the block.timestamp &amp;lt; expiration or that expiration == 0.&lt;&#x2F;li&gt;
&lt;li&gt;Upon successful signature verification on calls to &lt;code&gt;claimAccount&lt;&#x2F;code&gt;, the registry MUST completely relinquish control over the Account Instance, and assign ownership to the initial owner by calling &lt;code&gt;setOwner&lt;&#x2F;code&gt; on the Account Instance.&lt;&#x2F;li&gt;
&lt;li&gt;Upon successful claim of the Account Instance, the registry SHOULD emit an &lt;code&gt;AccountClaimed&lt;&#x2F;code&gt; event.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;isvalidsignature&quot;&gt;isValidSignature&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;isValidSignature&lt;&#x2F;code&gt; is a fallback signature verification function used by unclaimed accounts. Valid signatures SHALL be generated by the registry signer by signing a composite hash of the original message hash, and the Account Instance address (e.g. &lt;code&gt;bytes32 compositeHash = keccak256(abi.encodePacked(originalHash, accountAddress))&lt;&#x2F;code&gt;). The function MUST reconstruct the composite hash, where &lt;code&gt;originalHash&lt;&#x2F;code&gt; is the hash passed to the function, and &lt;code&gt;accountAddress&lt;&#x2F;code&gt; is &lt;code&gt;msg.sender&lt;&#x2F;code&gt; (the unclaimed Account Instance). The function MUST verify the signature against the composite hash and registry signer.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;account-instance&quot;&gt;Account Instance&lt;&#x2F;h3&gt;
&lt;p&gt;The Account Instance MUST implement the following interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IAccount&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC1271&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sets the owner of the Account Instance.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Only callable by the current owner of the instance, or by the registry if the Account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Instance has not yet been claimed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      - The new owner of the Account Instance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;All Account Instances MUST be created using an Account Registry Instance.&lt;&#x2F;li&gt;
&lt;li&gt;Account Instances SHOULD provide access to assets previously sent to the address at which the Account Instance is deployed to.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;setOwner&lt;&#x2F;code&gt; SHOULD update the owner and SHOULD be callable by the current owner of the Account Instance.&lt;&#x2F;li&gt;
&lt;li&gt;If an Account Instance is deployed, but not claimed, the owner of the Account Instance MUST be initialized to the Account Registry Instance.&lt;&#x2F;li&gt;
&lt;li&gt;An Account Instance SHALL determine if it has been claimed by checking if the owner is the Account Registry Instance.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;account-instance-signatures&quot;&gt;Account Instance Signatures&lt;&#x2F;h4&gt;
&lt;p&gt;Account Instances MUST support &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;ERC-1271&lt;&#x2F;a&gt; by implementing an &lt;code&gt;isValidSignature&lt;&#x2F;code&gt; function. When the owner of an Account Instance wants to sign a message (e.g. to log in to a dApp), the signature MUST be generated in one of the following ways, depending the state of the Account Instance:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;If the Account instance is deployed and claimed, the owner should generate the signature, and &lt;code&gt;isValidSignature&lt;&#x2F;code&gt; SHOULD verify that the message hash and signature are valid for the current owner of the Account Instance.&lt;&#x2F;li&gt;
&lt;li&gt;If the Account Instance is deployed, but unclaimed, the registry signer should generate the signature using a composite hash of the original message and address of the Account Instance described &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6981&#x2F;#isvalidsignature&quot;&gt;above&lt;&#x2F;a&gt;, and &lt;code&gt;isValidSignature&lt;&#x2F;code&gt; SHOULD forward the message hash and signature to the Account Registry Instance&#x27;s &lt;code&gt;isValidSignature&lt;&#x2F;code&gt; function.&lt;&#x2F;li&gt;
&lt;li&gt;If the Account Instance is not deployed, the registry signer should generate a signature on the composite hash as done in situation 2, and wrap the signature according to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6492&#x2F;#signer-side&quot;&gt;ERC-6492&lt;&#x2F;a&gt; (e.g. &lt;code&gt;concat(abi.encode((registryAddress, createAccountCalldata, compositeHashSignature), (address, bytes, bytes)), magicBytes)&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Signature validation for Account Instances should be done according to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6492&#x2F;#verifier-side&quot;&gt;ERC-6492&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;service-owned-registry-instances&quot;&gt;Service-Owned Registry Instances&lt;&#x2F;h3&gt;
&lt;p&gt;While it might seem more user-friendly to implement and deploy a universal registry for reserved ownership accounts, we believe that it is important for external service providers to have the option to own and control their own Account Registry.  This provides the flexibility of implementing their own permission controls and account deployment authorization frameworks.&lt;&#x2F;p&gt;
&lt;p&gt;We are providing a reference Registry Factory which can deploy Account Registries for an external service, which comes with:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Immutable Account Instance implementation&lt;&#x2F;li&gt;
&lt;li&gt;Validation for the &lt;code&gt;claimAccount&lt;&#x2F;code&gt; method via ECDSA for EOA signers, or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;ERC-1271&lt;&#x2F;a&gt; validation for smart contract signers&lt;&#x2F;li&gt;
&lt;li&gt;Ability for the Account Registry deployer to change the signing addressed used for &lt;code&gt;claimAccount&lt;&#x2F;code&gt; validation&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;account-registry-and-account-implementation-coupling&quot;&gt;Account Registry and Account Implementation Coupling&lt;&#x2F;h3&gt;
&lt;p&gt;Since Account Instances are deployed as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1167&#x2F;&quot;&gt;ERC-1167&lt;&#x2F;a&gt; proxies, the account implementation address affects the addresses of accounts deployed from a given Account Registry. Requiring that registry instances be linked to a single, immutable account implementation ensures consistency between a user&#x27;s salt and linked address on a given Account Registry Instance.&lt;&#x2F;p&gt;
&lt;p&gt;This also allows services to gain the trust of users by deploying their registries with a reference to a trusted account implementation address.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore, account implementations can be designed as upgradeable, so users are not necessarily bound to the implementation specified by the Account Registry Instance used to create their account.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;separate-createaccount-and-claimaccount-operations&quot;&gt;Separate &lt;code&gt;createAccount&lt;&#x2F;code&gt; and &lt;code&gt;claimAccount&lt;&#x2F;code&gt; Operations&lt;&#x2F;h3&gt;
&lt;p&gt;Operations to create and claim Account Instances are intentionally separate. This allows services to provide users with valid &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6492&#x2F;&quot;&gt;ERC-6492&lt;&#x2F;a&gt; signatures before their Account Instance has been deployed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The following is an example of an Account Registry Factory which can be used by external service providers to deploy their own Account Registry Instance.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;account-registry-factory&quot;&gt;Account Registry Factory&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.13&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @author&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: manifold.xyz&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Create2&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;openzeppelin&#x2F;utils&#x2F;Create2.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Address&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;..&#x2F;..&#x2F;lib&#x2F;Address.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC1167ProxyBytecode&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;..&#x2F;..&#x2F;lib&#x2F;ERC1167ProxyBytecode.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IAccountRegistryFactory&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IAccountRegistryFactory.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AccountRegistryFactory&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IAccountRegistryFactory&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    using&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InitializationFailed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; immutable&lt;&#x2F;span&gt;&lt;span&gt; registryImplementation &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x076B08EDE2B28fab0c1886F029cD6d02C8fF0E94&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; createRegistry&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint96&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; index&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; accountImplementation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; accountInitData&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; salt &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _getSalt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; code &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; ERC1167ProxyBytecode&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;createCode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;registryImplementation&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; _registry &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; Create2&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;computeAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;salt&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;_registry&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isDeployed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span&gt; _registry&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _registry &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; Create2&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;deploy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; salt&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt; success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; )&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; _registry&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodeWithSignature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;                &amp;quot;initialize(address,address,bytes)&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;                msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                accountImplementation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                accountInitData&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InitializationFailed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AccountRegistryCreated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_registry&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; accountImplementation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _registry&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; registry&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; deployer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint96&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; salt &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _getSalt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;deployer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; code &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; ERC1167ProxyBytecode&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;createCode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;registryImplementation&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; Create2&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;computeAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;salt&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _getSalt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; deployer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint96&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;deployer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;account-registry-1&quot;&gt;Account Registry&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.13&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @author&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: manifold.xyz&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Create2&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;openzeppelin&#x2F;utils&#x2F;Create2.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ECDSA&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;openzeppelin&#x2F;utils&#x2F;cryptography&#x2F;ECDSA.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Ownable&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;openzeppelin&#x2F;access&#x2F;Ownable.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Initializable&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;openzeppelin&#x2F;proxy&#x2F;utils&#x2F;Initializable.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC1271&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;openzeppelin&#x2F;interfaces&#x2F;IERC1271.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;SignatureChecker&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;openzeppelin&#x2F;utils&#x2F;cryptography&#x2F;SignatureChecker.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Address&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;..&#x2F;..&#x2F;lib&#x2F;Address.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IAccountRegistry&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;..&#x2F;..&#x2F;interfaces&#x2F;IAccountRegistry.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC1167ProxyBytecode&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;..&#x2F;..&#x2F;lib&#x2F;ERC1167ProxyBytecode.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AccountRegistryImplementation&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Ownable&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Initializable&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IAccountRegistry&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    using&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    using&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ECDSA&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Signer&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; account&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span&gt; isContract&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InitializationFailed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ClaimFailed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Unauthorized&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; accountImplementation&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; accountInitData&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Signer &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;public&lt;&#x2F;span&gt;&lt;span&gt; signer&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _disableInitializers&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; initialize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; accountImplementation_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; accountInitData_&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; initializer&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _transferOwnership&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        accountImplementation &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; accountImplementation_&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        accountInitData &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; accountInitData_&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See {IAccountRegistry-createAccount}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; createAccount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; salt&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; code &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; ERC1167ProxyBytecode&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;createCode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;accountImplementation&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; _account &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; Create2&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;computeAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;salt&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;_account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isDeployed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span&gt; _account&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _account &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; Create2&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;deploy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;salt&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt; success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; )&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; _account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;accountInitData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InitializationFailed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AccountCreated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; accountImplementation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; salt&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _account&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See {IAccountRegistry-claimAccount}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; claimAccount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; salt&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expiration&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; message&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _verify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; salt&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; expiration&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; message&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; _account &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;createAccount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;salt&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt; success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; )&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; _account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodeWithSignature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;transferOwnership(address)&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ClaimFailed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AccountClaimed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _account&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See {IAccountRegistry-account}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; salt&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; code &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; ERC1167ProxyBytecode&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;createCode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;accountImplementation&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; Create2&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;computeAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;salt&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See {IAccountRegistry-isValidSignature}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isValidSignature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; expectedHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span&gt; isValid &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; SignatureChecker&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isValidSignatureNow&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            signer&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            expectedHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;isValid&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; IERC1271&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;isValidSignature&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; updateSigner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newSigner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint32&lt;&#x2F;span&gt;&lt;span&gt; signerSize&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            signerSize &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; extcodesize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;newSigner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        signer&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;account &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; newSigner&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        signer&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;isContract &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; signerSize &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _verify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; salt&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expiration&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; message&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; signatureAccount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;isContract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;SignatureChecker&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isValidSignatureNow&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; message&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Unauthorized&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            signatureAccount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; message&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;recover&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; expectedMessage &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;\x19Ethereum Signed Message:\n84&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; salt&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; expiration&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            message &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span&gt; expectedMessage &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;isContract &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; signatureAccount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span&gt; signer&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            (&lt;&#x2F;span&gt;&lt;span&gt;expiration &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; expiration &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Unauthorized&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;example-account-implementation&quot;&gt;Example Account Implementation&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.13&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @author&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: manifold.xyz&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC1271&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;openzeppelin&#x2F;interfaces&#x2F;IERC1271.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;SignatureChecker&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;openzeppelin&#x2F;utils&#x2F;cryptography&#x2F;SignatureChecker.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC165&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;openzeppelin&#x2F;utils&#x2F;introspection&#x2F;IERC165.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC165Checker&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;openzeppelin&#x2F;utils&#x2F;introspection&#x2F;ERC165Checker.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC721&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;openzeppelin&#x2F;token&#x2F;ERC721&#x2F;IERC721.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC721Receiver&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;openzeppelin&#x2F;token&#x2F;ERC721&#x2F;IERC721Receiver.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC1155Receiver&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;openzeppelin&#x2F;token&#x2F;ERC1155&#x2F;IERC1155Receiver.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Initializable&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;openzeppelin&#x2F;proxy&#x2F;utils&#x2F;Initializable.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Ownable&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;openzeppelin&#x2F;access&#x2F;Ownable.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC1967Account&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERC1967Account.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IAccount&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;..&#x2F;..&#x2F;interfaces&#x2F;IAccount.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC1967AccountImplementation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A lightweight, upgradeable smart contract wallet implementation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC1967AccountImplementation&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    IAccount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    IERC165&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    IERC721Receiver&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    IERC1155Receiver&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    IERC1967Account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    Initializable&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    Ownable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; registry&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _disableInitializers&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; initialize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; initializer&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        registry &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _transferOwnership&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;registry&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;IAccount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;IERC1967Account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;IERC1155Receiver&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;IERC721Receiver&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;IERC165&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onERC721Received&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;onERC721Received&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onERC1155Received&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;onERC1155Received&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onERC1155BatchReceived&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;onERC1155BatchReceived&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; {See IERC1967Account-executeCall}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; executeCall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _target&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span&gt; success&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; solhint-disable&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;-next-line avoid-low-level-calls&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span&gt;success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; _target&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;call&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransactionExecuted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_target&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _result&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; {See IAccount-setOwner}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _transferOwnership&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    receive&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isValidSignature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; registry&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC1271&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;registry&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isValidSignature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span&gt; isValid &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; SignatureChecker&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isValidSignatureNow&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;isValid&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; IERC1271&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;isValidSignature&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;front-running&quot;&gt;Front-running&lt;&#x2F;h3&gt;
&lt;p&gt;Deployment of reserved ownership accounts through an Account Registry Instance through calls to &lt;code&gt;createAccount&lt;&#x2F;code&gt; could be front-run by a malicious actor. However, if the malicious actor attempted to alter the &lt;code&gt;owner&lt;&#x2F;code&gt; parameter in the calldata, the Account Registry Instance would find the signature to be invalid, and revert the transaction. Thus, any successful front-running transaction would deploy an identical Account Instance to the original transaction, and the original owner would still gain control over the address.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>SETCODE instruction</title>
        <published>2023-04-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>William Morriss</name><uri>https://github.com/wjmelements</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6913/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6913-setcode-instruction/13898" />
        

        <id>https://wg-eips.ritovision.com/6913/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:6913"
            label="EIP-6913" />
        

        
        

        
        <summary type="html">new instruction to replace code in-place</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6913/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce the &lt;code&gt;SETCODE&lt;&#x2F;code&gt; (&lt;code&gt;0xfc&lt;&#x2F;code&gt;) instruction, which replaces the code of the executing account from memory.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Many contracts are upgradeable in order to facilitate improvement or defer decisions without migrating to a new address.
Contracts presently do this in several ways:&lt;&#x2F;p&gt;
&lt;p&gt;The oldest method uses &lt;code&gt;CALL&lt;&#x2F;code&gt;.
The limitation of this method is that internal state must be modifiable by all future implementations.&lt;&#x2F;p&gt;
&lt;p&gt;Second, &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; can proxy the implementation.
Some proxies are minimal while others branch to many separate implementation accounts.
This method can also bypass account code size limits.&lt;&#x2F;p&gt;
&lt;p&gt;A third method uses &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; and &lt;code&gt;CREATE2&lt;&#x2F;code&gt; to replace code in-place.
This method improves upon the prior methods by removing the need to call into external contracts.
One limitation of this method is that any internal state is removed by &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;.
Another limitation is that &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; does not remove code until the end of the transaction, sacrificing availability until &lt;code&gt;CREATE2&lt;&#x2F;code&gt; can complete the upgrade.&lt;&#x2F;p&gt;
&lt;p&gt;Given the upcoming deprecation of &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;, &lt;code&gt;SETCODE&lt;&#x2F;code&gt; introduces a better method for replacing code in-place.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;When within a read-only execution scope like the recursive kind created by &lt;code&gt;STATICCALL&lt;&#x2F;code&gt;, &lt;code&gt;SETCODE&lt;&#x2F;code&gt; causes an exceptional abort.&lt;&#x2F;p&gt;
&lt;p&gt;When the currently executing code does not equal the code of the executing account, such as can happen inside of &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; or &lt;code&gt;CREATE&lt;&#x2F;code&gt;, &lt;code&gt;SETCODE&lt;&#x2F;code&gt; causes an exceptional abort.&lt;&#x2F;p&gt;
&lt;p&gt;Otherwise, &lt;code&gt;SETCODE&lt;&#x2F;code&gt; consumes two words from the stack: offset and length.
These specify a range of memory containing the new code.
Any validations that would be performed on the result of &lt;code&gt;CREATE&lt;&#x2F;code&gt; or &lt;code&gt;CREATE2&lt;&#x2F;code&gt; occur immediately, potentially causing failure with exceptional abort.
The operations &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; and &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt; now query the updated code, and message-calls such as &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;, &lt;code&gt;CALLCODE&lt;&#x2F;code&gt;, &lt;code&gt;CALL&lt;&#x2F;code&gt;, and &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; now execute the updated code.
Any execution scopes already executing replaced code, including the one that &lt;code&gt;SETCODE&lt;&#x2F;code&gt;, will continue executing the prior code.
Inside such scopes, &lt;code&gt;CODESIZE&lt;&#x2F;code&gt; and &lt;code&gt;CODECOPY&lt;&#x2F;code&gt; continue to query the executing code.&lt;&#x2F;p&gt;
&lt;p&gt;Like &lt;code&gt;SSTORE&lt;&#x2F;code&gt;, this account modification will be reverted if the current scope or any parent scope reverts or aborts.&lt;&#x2F;p&gt;
&lt;p&gt;Unlike &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;, &lt;code&gt;SETCODE&lt;&#x2F;code&gt; does not clear account balance, nonce, or storage.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas&quot;&gt;Gas&lt;&#x2F;h3&gt;
&lt;p&gt;The gas cost of this operation is the sum of &lt;code&gt;Gselfdestruct&lt;&#x2F;code&gt; and the product of &lt;code&gt;Gcodedeposit&lt;&#x2F;code&gt; and the number of bytes in the new code.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The behavior of &lt;code&gt;CODECOPY&lt;&#x2F;code&gt;, &lt;code&gt;CODESIZE&lt;&#x2F;code&gt;, &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt;, and &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt; match the behavior of &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; and &lt;code&gt;CREATE&lt;&#x2F;code&gt;, where it is also possible for executing code to differ from the code of the executing account.&lt;&#x2F;p&gt;
&lt;p&gt;The gas cost of &lt;code&gt;SETCODE&lt;&#x2F;code&gt; is comparable to &lt;code&gt;CREATE&lt;&#x2F;code&gt; but excludes &lt;code&gt;Gcreate&lt;&#x2F;code&gt; because no execution context is created, nor any new account.
Other account modification costs are accounted for outside of execution gas.&lt;&#x2F;p&gt;
&lt;p&gt;Unlike &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;, execution proceeds normally after &lt;code&gt;SETCODE&lt;&#x2F;code&gt; in order to allow validation and return data.
Post-update validation can undo a &lt;code&gt;SETCODE&lt;&#x2F;code&gt; operation with &lt;code&gt;REVERT&lt;&#x2F;code&gt;, or with a recursive &lt;code&gt;SETCODE&lt;&#x2F;code&gt;, but &lt;code&gt;REVERT&lt;&#x2F;code&gt; uses less gas.&lt;&#x2F;p&gt;
&lt;p&gt;Preventing &lt;code&gt;SETCODE&lt;&#x2F;code&gt; within most &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; allows static analysis to easily identify mutable code.
Account code not containing the &lt;code&gt;SETCODE&lt;&#x2F;code&gt; operation can be safely assumed to be immutable.
Code observed in a non-reverting context to be immutable will remain immutable, allowing on-chain static analysis for immutability.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The only prior operation changing code is &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;.
As code modification via &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; is deferred until the end of the transaction, its interactions with &lt;code&gt;SETCODE&lt;&#x2F;code&gt; are well-defined.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;CodeStart&lt;&#x2F;th&gt;&lt;th&gt;CallData&lt;&#x2F;th&gt;&lt;th&gt;CodeResult&lt;&#x2F;th&gt;&lt;th&gt;Gas&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;365f5f37365ffc00&lt;&#x2F;td&gt;&lt;td&gt;365f5f37365ffc00&lt;&#x2F;td&gt;&lt;td&gt;365f5f37365ffc00&lt;&#x2F;td&gt;&lt;td&gt;6613&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;365f5f37365ffc00&lt;&#x2F;td&gt;&lt;td&gt;00&lt;&#x2F;td&gt;&lt;td&gt;00&lt;&#x2F;td&gt;&lt;td&gt;5213&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;365f5f37365ffc00&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;5013&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;365f5f37365ffc595ffd&lt;&#x2F;td&gt;&lt;td&gt;365f5f37365ffc00&lt;&#x2F;td&gt;&lt;td&gt;365f5f37365ffc595ffd&lt;&#x2F;td&gt;&lt;td&gt;6617&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;365f5f37365ffcfe&lt;&#x2F;td&gt;&lt;td&gt;365f5f37365ffc00&lt;&#x2F;td&gt;&lt;td&gt;365f5f37365ffcfe&lt;&#x2F;td&gt;&lt;td&gt;all&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Risks related to &lt;code&gt;SETCODE&lt;&#x2F;code&gt; similarly apply to other upgrade patterns.&lt;&#x2F;p&gt;
&lt;p&gt;Most contracts should never be replaced and should not be upgradeable.
Any upgrade mechanism can risk permanent failure.
The possibility of upgrade perpetuates such risk.&lt;&#x2F;p&gt;
&lt;p&gt;Access to upgrade operations should be restricted.
Upgrades should never be performed in a hurry or when tired.
Upgrades should be tested under as similar conditions to production as possible; discrepancies are sources of unexpected results.
When possible, multiple engineers should preview and independently verify pending upgrade procedures.&lt;&#x2F;p&gt;
&lt;p&gt;Block explorers, wallets, and other interfaces should flag upgradeable code.
Client software should warn against approving &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; tokens for upgradeable accounts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Minimal Multi-Token Interface</title>
        <published>2023-04-19T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>JT Riley</name><uri>https://github.com/jtriley2p</uri>
	</author>
	
	<author>
		<name>Dillon</name><uri>https://github.com/d1ll0n</uri>
	</author>
	
	<author>
		<name>Sara</name><uri>https://github.com/snreynolds</uri>
	</author>
	
	<author>
		<name>Vectorized</name><uri>https://github.com/Vectorized</uri>
	</author>
	
	<author>
		<name>Neodaoist</name><uri>https://github.com/neodaoist</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6909/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-6909-multi-token-standard/13891" />
        

        <id>https://wg-eips.ritovision.com/6909/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:6909"
            label="ERC-6909" />
        

        
        

        
        <summary type="html">A minimal specification for managing multiple tokens by their id in a single contract.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6909/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The following specifies a multi-token contract as a simplified alternative to the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; Multi-Token Standard. In contrast to ERC-1155, callbacks and batching have been removed from the interface and the permission system is a hybrid operator-approval scheme for granular and scalable permissions. Functionally, the interface has been reduced to the bare minimum required to manage multiple tokens under the same contract.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The ERC-1155 standard includes unnecessary features such as requiring recipient accounts with code to implement callbacks returning specific values and batch-calls in the specification. In addition, the single operator permission scheme grants unlimited allowance on every token ID in the contract. Backwards compatibility is deliberately removed only where necessary. Additional features such as batch calls, increase and decrease allowance methods, and other user experience improvements are deliberately omitted in the specification to minimize the required external interface.&lt;&#x2F;p&gt;
&lt;p&gt;According to ERC-1155, callbacks are required for each transfer and batch transfer to contract accounts. This requires potentially unnecessary external calls to the recipient when the recipient account is a contract account. While this behavior may be desirable in some cases, there is no option to opt-out of this behavior, as is the case for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; having both &lt;code&gt;transferFrom&lt;&#x2F;code&gt; and &lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt;. In addition to runtime performance of the token contract itself, it also impacts the runtime performance and codesize of recipient contract accounts, requiring multiple callback functions and return values to receive the tokens.&lt;&#x2F;p&gt;
&lt;p&gt;Batching transfers, while useful, are excluded from this standard to allow for opinionated batch transfer operations on different implementations. For example, a different ABI encoding may provide different benefits in different environments such as calldata size optimization for rollups with calldata storage commitments or runtime performance for environments with expensive gas fees.&lt;&#x2F;p&gt;
&lt;p&gt;A hybrid allowance-operator permission scheme enables granular yet scalable controls on token approvals. Allowances enable an external account to transfer tokens of a single token ID on a user&#x27;s behalf w by their ID while operators are granted full transfer permission for all token IDs for the user.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;Every &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6909&#x2F;&quot;&gt;ERC-6909&lt;&#x2F;a&gt; compliant contract must implement the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; interface in addition to the following interface.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;infinite: The maximum value for a uint256 (&lt;code&gt;2 ** 256 - 1&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;caller: The caller of the current context (&lt;code&gt;msg.sender&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;spender: An account that transfers tokens on behalf of another account.&lt;&#x2F;li&gt;
&lt;li&gt;operator: An account that has unlimited transfer permissions on all token ids for another account.&lt;&#x2F;li&gt;
&lt;li&gt;mint: The creation of an amount of tokens. This MAY happen in a mint method or as a transfer from the zero address.&lt;&#x2F;li&gt;
&lt;li&gt;burn: The removal an amount of tokens. This MAY happen in a burn method or as a transfer to the zero address.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;methods&quot;&gt;Methods&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;balanceof&quot;&gt;&lt;code&gt;balanceOf&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The total &lt;code&gt;amount&lt;&#x2F;code&gt; of a token &lt;code&gt;id&lt;&#x2F;code&gt; that an &lt;code&gt;owner&lt;&#x2F;code&gt; owns.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;alanceOf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; o&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;wner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;mount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;allowance&quot;&gt;&lt;code&gt;allowance&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The total &lt;code&gt;amount&lt;&#x2F;code&gt; of a token &lt;code&gt;id&lt;&#x2F;code&gt; that a &lt;code&gt;spender&lt;&#x2F;code&gt; is permitted to transfer on behalf of an &lt;code&gt;owner&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;llowance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; o&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;wner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;pender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;mount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;isoperator&quot;&gt;&lt;code&gt;isOperator&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Returns &lt;code&gt;true&lt;&#x2F;code&gt; if the &lt;code&gt;spender&lt;&#x2F;code&gt; is approved as an operator for an &lt;code&gt;owner&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;sOperator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; o&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;wner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;pender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;tatus&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ool&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;transfer&quot;&gt;&lt;code&gt;transfer&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Transfers an &lt;code&gt;amount&lt;&#x2F;code&gt; of a token &lt;code&gt;id&lt;&#x2F;code&gt; from the caller to the &lt;code&gt;receiver&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST revert when the caller&#x27;s balance for the token &lt;code&gt;id&lt;&#x2F;code&gt; is insufficient.&lt;&#x2F;p&gt;
&lt;p&gt;MUST log the &lt;code&gt;Transfer&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;p&gt;MUST return True.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ransfer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;onpayable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eceiver&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;mount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uccess&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ool&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;transferfrom&quot;&gt;&lt;code&gt;transferFrom&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Transfers an &lt;code&gt;amount&lt;&#x2F;code&gt; of a token &lt;code&gt;id&lt;&#x2F;code&gt; from a &lt;code&gt;sender&lt;&#x2F;code&gt; to a &lt;code&gt;receiver&lt;&#x2F;code&gt; by the caller.&lt;&#x2F;p&gt;
&lt;p&gt;MUST revert when the caller is neither the &lt;code&gt;sender&lt;&#x2F;code&gt; nor an operator for the &lt;code&gt;sender&lt;&#x2F;code&gt; and the caller&#x27;s allowance for the token &lt;code&gt;id&lt;&#x2F;code&gt; for the &lt;code&gt;sender&lt;&#x2F;code&gt; is insufficient.&lt;&#x2F;p&gt;
&lt;p&gt;MUST revert when the &lt;code&gt;sender&lt;&#x2F;code&gt;&#x27;s balance for the token id is insufficient.&lt;&#x2F;p&gt;
&lt;p&gt;MUST log the &lt;code&gt;Transfer&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;p&gt;MUST decrease the caller&#x27;s &lt;code&gt;allowance&lt;&#x2F;code&gt; by the same &lt;code&gt;amount&lt;&#x2F;code&gt; of the &lt;code&gt;sender&lt;&#x2F;code&gt;&#x27;s balance decrease if the caller is not an operator for the &lt;code&gt;sender&lt;&#x2F;code&gt; and the caller&#x27;s &lt;code&gt;allowance&lt;&#x2F;code&gt; is not infinite.&lt;&#x2F;p&gt;
&lt;p&gt;SHOULD NOT decrease the caller&#x27;s &lt;code&gt;allowance&lt;&#x2F;code&gt; for the token &lt;code&gt;id&lt;&#x2F;code&gt; for the &lt;code&gt;sender&lt;&#x2F;code&gt; if the &lt;code&gt;allowance&lt;&#x2F;code&gt; is infinite.&lt;&#x2F;p&gt;
&lt;p&gt;SHOULD NOT decrease the caller&#x27;s &lt;code&gt;allowance&lt;&#x2F;code&gt; for the token &lt;code&gt;id&lt;&#x2F;code&gt; for the &lt;code&gt;sender&lt;&#x2F;code&gt; if the caller is an operator or the &lt;code&gt;sender&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST return True.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ransferFrom&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;onpayable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eceiver&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;mount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uccess&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ool&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;approve&quot;&gt;&lt;code&gt;approve&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Approves an &lt;code&gt;amount&lt;&#x2F;code&gt; of a token &lt;code&gt;id&lt;&#x2F;code&gt; that a &lt;code&gt;spender&lt;&#x2F;code&gt; is permitted to transfer on behalf of the caller.&lt;&#x2F;p&gt;
&lt;p&gt;MUST set the &lt;code&gt;allowance&lt;&#x2F;code&gt; of the &lt;code&gt;spender&lt;&#x2F;code&gt; of the token &lt;code&gt;id&lt;&#x2F;code&gt; for the caller to the &lt;code&gt;amount&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST log the &lt;code&gt;Approval&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;p&gt;MUST return True.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;pprove&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;onpayable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;pender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;mount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uccess&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ool&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;setoperator&quot;&gt;&lt;code&gt;setOperator&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Grants or revokes unlimited transfer permissions for a &lt;code&gt;spender&lt;&#x2F;code&gt; for any token &lt;code&gt;id&lt;&#x2F;code&gt; on behalf of the caller.&lt;&#x2F;p&gt;
&lt;p&gt;MUST set the operator status to the &lt;code&gt;approved&lt;&#x2F;code&gt; value.&lt;&#x2F;p&gt;
&lt;p&gt;MUST log the &lt;code&gt;OperatorSet&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;p&gt;MUST return True.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;etOperator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;onpayable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;pender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;pproved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ool&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uccess&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ool&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;events&quot;&gt;Events&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;transfer-1&quot;&gt;&lt;code&gt;Transfer&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;caller&lt;&#x2F;code&gt; initiates a transfer of an &lt;code&gt;amount&lt;&#x2F;code&gt; of a token &lt;code&gt;id&lt;&#x2F;code&gt; from a &lt;code&gt;sender&lt;&#x2F;code&gt; to a &lt;code&gt;receiver&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST be logged when an &lt;code&gt;amount&lt;&#x2F;code&gt; of a token &lt;code&gt;id&lt;&#x2F;code&gt; is transferred from one account to another.&lt;&#x2F;p&gt;
&lt;p&gt;MUST be logged with the &lt;code&gt;sender&lt;&#x2F;code&gt; address as the zero address when an &lt;code&gt;amount&lt;&#x2F;code&gt; of a token &lt;code&gt;id&lt;&#x2F;code&gt; is minted.&lt;&#x2F;p&gt;
&lt;p&gt;MUST be logged with the &lt;code&gt;receiver&lt;&#x2F;code&gt; address as the zero address when an &lt;code&gt;amount&lt;&#x2F;code&gt; of a token &lt;code&gt;id&lt;&#x2F;code&gt; is burned.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; T&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ransfer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;vent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;aller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eceiver&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;mount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;operatorset&quot;&gt;&lt;code&gt;OperatorSet&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;owner&lt;&#x2F;code&gt; has set the &lt;code&gt;approved&lt;&#x2F;code&gt; status to a &lt;code&gt;spender&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST be logged when the operator status is set.&lt;&#x2F;p&gt;
&lt;p&gt;MAY be logged when the operator status is set to the same status it was before the current call.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; O&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;peratorSet&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;vent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; o&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;wner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;pender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;pproved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ool&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;approval&quot;&gt;&lt;code&gt;Approval&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;owner&lt;&#x2F;code&gt; has approved a &lt;code&gt;spender&lt;&#x2F;code&gt; to transfer an &lt;code&gt;amount&lt;&#x2F;code&gt; of a token &lt;code&gt;id&lt;&#x2F;code&gt; to be transferred on the owner&#x27;s behalf.&lt;&#x2F;p&gt;
&lt;p&gt;MUST be logged when the &lt;code&gt;allowance&lt;&#x2F;code&gt; is set by an &lt;code&gt;owner&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; A&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;pproval&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;vent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; o&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;wner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;pender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;mount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;interface-id&quot;&gt;Interface ID&lt;&#x2F;h3&gt;
&lt;p&gt;The interface ID is &lt;code&gt;0x0f632fb3&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;metadata-extension&quot;&gt;Metadata Extension&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;methods-1&quot;&gt;Methods&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;name&quot;&gt;name&lt;&#x2F;h5&gt;
&lt;p&gt;The &lt;code&gt;name&lt;&#x2F;code&gt; for a token &lt;code&gt;id&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ame&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ame&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;tring&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;symbol&quot;&gt;symbol&lt;&#x2F;h5&gt;
&lt;p&gt;The ticker &lt;code&gt;symbol&lt;&#x2F;code&gt; for a token &lt;code&gt;id&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ymbol&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ymbol&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;tring&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;decimals&quot;&gt;decimals&lt;&#x2F;h5&gt;
&lt;p&gt;The &lt;code&gt;amount&lt;&#x2F;code&gt; of decimals for a token &lt;code&gt;id&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; d&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ecimals&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;mount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;    t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;content-uri-extension&quot;&gt;Content URI Extension&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;methods-2&quot;&gt;Methods&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;contracturi&quot;&gt;contractURI&lt;&#x2F;h5&gt;
&lt;p&gt;The &lt;code&gt;URI&lt;&#x2F;code&gt; for the contract.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ontractURI&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ri&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;tring&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;tokenuri&quot;&gt;tokenURI&lt;&#x2F;h5&gt;
&lt;p&gt;The &lt;code&gt;URI&lt;&#x2F;code&gt; for a token &lt;code&gt;id&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MAY revert if the token &lt;code&gt;id&lt;&#x2F;code&gt; does not exist.&lt;&#x2F;p&gt;
&lt;p&gt;MUST replace occurrences of &lt;code&gt;{id}&lt;&#x2F;code&gt; in the returned URI string by the client.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;okenURI&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ri&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;tring&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;metadata-structure&quot;&gt;Metadata Structure&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;contract-uri&quot;&gt;Contract URI&lt;&#x2F;h5&gt;
&lt;p&gt;JSON Schema:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Contract Metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The name of the contract.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The description of the contract.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;image_url&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uri&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The URL of the image representing the contract.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;banner_image_url&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uri&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The URL of the banner image of the contract.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;external_link&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uri&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The external link of the contract.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;editors&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;array&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;items&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;An Ethereum address representing an authorized editor of the contract.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;An array of Ethereum addresses representing editors (authorized editors) of the contract.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;animation_url&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;An animation URL for the contract.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;required&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;JSON Example (Minimal):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Example Contract Name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;token-uri&quot;&gt;Token URI&lt;&#x2F;h5&gt;
&lt;p&gt;MUST replace occurrences of &lt;code&gt;{id}&lt;&#x2F;code&gt; in the returned URI string by the client.&lt;&#x2F;p&gt;
&lt;p&gt;JSON Schema:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Asset Metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Identifies the token&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Describes the token&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;image&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A URI pointing to an image resource.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;animation_url&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;An animation URL for the token.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;required&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;image&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;JSON Example (Minimal):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Example Token Name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Example Token Description&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;image&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;exampleurl&#x2F;{id}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;token-supply-extension&quot;&gt;Token Supply Extension&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;methods-3&quot;&gt;Methods&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;totalsupply&quot;&gt;totalSupply&lt;&#x2F;h5&gt;
&lt;p&gt;The &lt;code&gt;totalSupply&lt;&#x2F;code&gt; for a token &lt;code&gt;id&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;otalSupply&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;upply&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;granular-approvals&quot;&gt;Granular Approvals&lt;&#x2F;h3&gt;
&lt;p&gt;While the &quot;operator model&quot; from the ERC-1155 standard allows an account to set another account as an operator, giving full permissions to transfer any amount of any token id on behalf of the owner, this may not always be the desired permission scheme. The &quot;allowance model&quot; from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; allows an account to set an explicit amount of the token that another account can spend on the owner&#x27;s behalf. This standard requires both be implemented, with the only modification being to the &quot;allowance model&quot; where the token id must be specified as well. This allows an account to grant specific approvals to specific token ids, infinite approvals to specific token ids, or infinite approvals to all token ids.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;removal-of-batching&quot;&gt;Removal of Batching&lt;&#x2F;h3&gt;
&lt;p&gt;While batching operations is useful, its place should not be in the standard itself, but rather on a case-by-case basis. This allows for different tradeoffs to be made in terms of calldata layout, which may be especially useful for specific applications such as roll-ups that commit calldata to global storage.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;removal-of-required-callbacks&quot;&gt;Removal of Required Callbacks&lt;&#x2F;h3&gt;
&lt;p&gt;Requiring callbacks unnecessarily encumbers implementors that either have no particular use case for callbacks or prefer a bespoke callback mechanism. Minimization of such requirements saves contract size, gas efficiency and complexity.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;removal-of-safe-naming&quot;&gt;Removal of &quot;Safe&quot; Naming&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;safeTransfer&lt;&#x2F;code&gt; and &lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt; naming conventions are misleading, especially in the context of the ERC-1155 and ERC-721 standards, as they require external calls to receiver accounts with code, passing the execution flow to an arbitrary contract, provided the receiver contract returns a specific value. The combination of removing mandatory callbacks and removing the word &quot;safe&quot; from all method names improves the safety of the control flow by default.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This is not backwards compatible with ERC-1155 as some methods are removed. However, wrappers can be implemented for the ERC-20, ERC-721, and ERC-1155 standards.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0.8.19&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC6909 Multi-Token Reference Implementation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @author&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; jtriley.eth&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC6909&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Thrown when owner balance for id is insufficient.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The id of the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InsufficientBalance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt; id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Thrown when spender allowance for id is insufficient.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the spender.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The id of the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InsufficientPermission&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt; id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The event emitted when a transfer occurs.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the sender.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; receiver&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the receiver.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The id of the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; caller&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; receiver&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The event emitted when an operator is set.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the spender.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; approved&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The approval status.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OperatorSet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approved&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The event emitted when an approval occurs.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the spender.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The id of the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Approval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Owner balance of an id.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; owner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; id &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Spender allowance of an id.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; owner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; spender &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; id &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; allowance&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Checks if a spender is approved by an owner as an operator.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; owner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; spender &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; isOperator&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfers an amount of an id from the caller to a receiver.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; receiver&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the receiver.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The id of the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; receiver&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;balanceOf&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;id&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InsufficientBalance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        balanceOf&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;id&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        balanceOf&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;receiver&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;id&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; receiver&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfers an amount of an id from a sender to a receiver.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the sender.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; receiver&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the receiver.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The id of the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; receiver&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;sender &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !&lt;&#x2F;span&gt;&lt;span&gt;isOperator&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            uint256&lt;&#x2F;span&gt;&lt;span&gt; senderAllowance &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; allowance&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;id&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;senderAllowance &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InsufficientPermission&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;senderAllowance &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                allowance&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;id&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; senderAllowance &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;balanceOf&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;id&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InsufficientBalance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        balanceOf&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;id&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        balanceOf&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;receiver&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;id&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; receiver&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Approves an amount of an id to a spender.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the spender.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The id of the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        allowance&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;spender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;id&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Approval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sets or removes a spender as an operator for the caller.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the spender.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; approved&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The approval status.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setOperator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approved&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        isOperator&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;spender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; approved&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OperatorSet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; approved&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Checks if a contract implements an interface.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; interfaceId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The interface identifier, as specified in ERC-165.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; supported&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; True if the contract implements `interfaceId`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; supported&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x0f632fb3&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span&gt; interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x01ffc9a7&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; receiver&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; WARNING: important safety checks should precede calls to this method.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      balanceOf&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;receiver&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;id&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; receiver&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _burn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; WARNING: important safety checks should precede calls to this method.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      balanceOf&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;id&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;approvals-and-operators&quot;&gt;Approvals and Operators&lt;&#x2F;h3&gt;
&lt;p&gt;The specification includes two token transfer permission systems, the &quot;allowance&quot; and &quot;operator&quot;
models. There are two security considerations in regards to delegating permission to transfer.&lt;&#x2F;p&gt;
&lt;p&gt;The first consideration is consistent with all delegated permission models. Any account with an allowance may transfer the full allowance for any reason at any time until the allowance is revoked. Any account with operator permissions may transfer any amount of any token id on behalf of the owner until the operator permission is revoked.&lt;&#x2F;p&gt;
&lt;p&gt;The second consideration is unique to systems with both delegated permission models. If an account has both operator permissions and an insufficient allowance for a given transfer, performing the allowance check before the operator check would result in a revert while performing the operator check before the allowance check would not. The specification intentionally leaves this unconstrained for cases where implementors may track allowances despite the operator status. Nonetheless, this is a notable consideration.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC6909OperatorPrecedence&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; -- snip --&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; receiver&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; check if `isOperator` first&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; sender &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !&lt;&#x2F;span&gt;&lt;span&gt;isOperator&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;allowance&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;id&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;insufficient allowance&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      allowance&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;id&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; -- snip --&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC6909AllowancePrecedence&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; -- snip --&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; receiver&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; check if allowance is sufficient first&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; sender &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; allowance&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;id&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;isOperator&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;insufficient allowance&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERROR: when allowance is insufficient, this panics due to arithmetic underflow, regardless of&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; whether the caller has operator permissions.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    allowance&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;id&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; -- snip&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Reuse Withdrawn Validator Indices</title>
        <published>2023-04-19T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Lion</name><uri>https://github.com/dapplion</uri>
	</author>
	
	<author>
		<name>Danny Ryan</name><uri>https://github.com/djrtwo</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6914/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6914-reuse-withdrawn-validator-indices/15253" />
        

        <id>https://wg-eips.ritovision.com/6914/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:6914"
            label="EIP-6914" />
        

        
        

        
        <summary type="html">Reuse fully withdrawn and safe to reuse validator indices for new beacon chain deposits.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6914/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Reuse fully withdrawn validator indices after a sufficient safe-to-reuse period has passed to eliminate the unbounded growth of the beacon chain validator list as the validator set churns.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The beacon chain maintains a list of validators and a separate list of balances associated with each validator. When a new deposit for a new validator occurs, the current mechanism only appends, rather than reusing previously fully withdrawn validator indices. As validators fully withdraw and new validators enter, this means the two lists will grow unbounded.&lt;&#x2F;p&gt;
&lt;p&gt;This specification allows for the reuse of validator indices in the event that it is safe to do so, eliminating the concerns around the unbounded validator list growth.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;consensus-layer&quot;&gt;Consensus Layer&lt;&#x2F;h3&gt;
&lt;p&gt;The configuration values and mechanics of the specification can be found in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;1a38b83e5db8638ee01c9461cccf11e7d8a3ebce&#x2F;specs&#x2F;_features&#x2F;eip6914&quot;&gt;Consensus Layer specs&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Note that validator indices are reused in the event that the validator has been fully withdrawn &lt;em&gt;and&lt;&#x2F;em&gt; that the validator has been withdrawable for a sufficient safe period.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;execution-layer&quot;&gt;Execution Layer&lt;&#x2F;h3&gt;
&lt;p&gt;This specification does not require any changes to the Execution Layer.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;validators&lt;&#x2F;code&gt; and &lt;code&gt;balances&lt;&#x2F;code&gt; lists are currently appended to each time a new Deposit for a new pubkey comes into the beacon chain. Due to the natural mechanics of stakers entering and leaving consensus over long time spans, these lists, thus the state size, will grow unbounded.&lt;&#x2F;p&gt;
&lt;p&gt;Increased state size represents load and&#x2F;or complexity in client implementations. This comes in the form of client memory footprint, state root calculations, validator set scans, and more. This is a relatively simple clean-up within the state transition that will prevent the unnecessary load and complexity of the otherwise unbounded lists.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This is a backwards incompatible change to the Consensus Layer of Ethereum and must be scheduled with a hard fork.&lt;&#x2F;p&gt;
&lt;p&gt;There are no forwards&#x2F;backwards compatibility issues with the Execution Layer&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases are work-in-progress within the standard Consensus Layer tests.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Validator indices cannot be immediately reused but instead must wait &lt;code&gt;SAFE_EPOCHS_TO_REUSE_INDEX&lt;&#x2F;code&gt; epochs to ensure that attestations cannot be &quot;poisoned&quot; with withdrawn validator signatures -- thus non-slashable -- for at least the weak subjectivity period.&lt;&#x2F;p&gt;
&lt;p&gt;The attestation poisoning attack hinges upon two facts:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The reuse of a validator index overwrites the previous validator&#x27;s pubkey from the beacon state.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;AttesterSlashing&lt;&#x2F;code&gt;s includes validator indices to reconstruct signature participants.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;details-of-the-attack&quot;&gt;Details of the attack&lt;&#x2F;h3&gt;
&lt;p&gt;Assume a 1&#x2F;3 attacker. Attacker exits N validators on the honest chain, where N is a small fraction of the validator set. These validators leave the exit queue and are withdrawable within a few days. Now, N new deposits come in and overwrite the validators and most importantly their pubkeys.&lt;&#x2F;p&gt;
&lt;p&gt;The attacker then constructs an alternative attacker chain from before any of the N voluntary exits, such that the original N validators are not exited and withdrawn. N is large enough such that at least one of the N keys is on average in every committee of the attacker chain. The attacker double-signs in an attempt to finalize the attacker chain but ensures that one of the N keys is mixed into any revealed double-signed aggregate attestation -- the individual attestations are unavailable, only aggregates. These malicious attestations are &lt;em&gt;not&lt;&#x2F;em&gt; includable in the honest chain because &lt;code&gt;AttesterSlashing&lt;&#x2F;code&gt;s rely upon mapping validator indices to particular pubkeys, thus breaking accountable safety.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;mitigation&quot;&gt;Mitigation&lt;&#x2F;h3&gt;
&lt;p&gt;Not overwriting withdrawn validators for &lt;code&gt;SAFE_EPOCHS_TO_REUSE_INDEX&lt;&#x2F;code&gt; epochs (3x the max weak subjectivity period) ensures that attestations cannot be poisoned within the accountable safety security window.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;alternative&quot;&gt;Alternative&lt;&#x2F;h3&gt;
&lt;p&gt;Note that if &lt;code&gt;AttesterSlashing&lt;&#x2F;code&gt;s included a list of pubkeys instead of validator indices, then this would not be an issue. However, this would require more breaking changes and would increase the data requirement of an &lt;code&gt;AttesterSlashing&lt;&#x2F;code&gt;, the largest Consensus Layer data type, by a factor of 6.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Modular Smart Contract Accounts</title>
        <published>2023-04-18T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Adam Egyed</name><uri>https://github.com/adamegyed</uri>
	</author>
	
	<author>
		<name>Fangting Liu</name><uri>https://github.com/trinity-0111</uri>
	</author>
	
	<author>
		<name>Jay Paik</name><uri>https://github.com/jaypaik</uri>
	</author>
	
	<author>
		<name>Yoav Weiss</name><uri>https://github.com/yoavw</uri>
	</author>
	
	<author>
		<name>Huawei Gu</name><uri>https://github.com/huaweigu</uri>
	</author>
	
	<author>
		<name>Daniel Lim</name><uri>https://github.com/dlim-circle</uri>
	</author>
	
	<author>
		<name>Ruben Koch</name><uri>https://github.com/0xrubes</uri>
	</author>
	
	<author>
		<name>David Philipson</name><uri>https://github.com/dphilipson</uri>
	</author>
	
	<author>
		<name>Howy Ho</name><uri>https://github.com/howydev</uri>
	</author>
	
	<author>
		<name>Nikita Belenkov</name><uri>https://github.com/nikita-quantstamp</uri>
	</author>
	
	<author>
		<name>zer0dot</name><uri>https://github.com/zer0dot</uri>
	</author>
	
	<author>
		<name>David Kim</name><uri>https://github.com/PowerStream3604</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6900/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-modular-smart-contract-accounts-and-plugins/13885" />
        

        <id>https://wg-eips.ritovision.com/6900/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:6900"
            label="ERC-6900" />
        

        
        

        
        <summary type="html">Interfaces for smart contract accounts and modules, optionally supporting upgradability and introspection</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6900/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal standardizes smart contract accounts and account modules, which are smart contracts that allow for composable logic within smart contract accounts. This proposal is compliant with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt;. This standard emphasizes secure permissioning of modules, and maximal interoperability between all spec-compliant accounts and modules.&lt;&#x2F;p&gt;
&lt;p&gt;This modular approach splits account functionality into three categories, implements them in external contracts, and defines an expected execution flow from accounts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;One of the goals that ERC-4337 accomplishes is abstracting the logic for execution and validation to each smart contract account.&lt;&#x2F;p&gt;
&lt;p&gt;Many new features of accounts can be built by customizing the logic that goes into the validation and execution steps. Examples of such features include session keys, subscriptions, spending limits, and role-based access control. Currently, some of these features are implemented natively by specific smart contract accounts, and others are able to be implemented by proprietary module systems like Safe modules.&lt;&#x2F;p&gt;
&lt;p&gt;However, managing multiple account implementations provides a poor user experience, fragmenting accounts across supported features and security configurations. Additionally, it requires module developers to choose which platforms to support, causing either platform lock-in or duplicated development effort.&lt;&#x2F;p&gt;
&lt;p&gt;We propose a standard that coordinates the implementation work between module developers and account developers. This standard defines a modular smart contract account capable of supporting all standard-conformant modules. This allows users to have greater portability of their data, and for module developers to not have to choose specific account implementations to support.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6900&#x2F;.&#x2F;assets&#x2F;MSCA_Shared_Components_Diagram.svg&quot; alt=&quot;diagram showing relationship between accounts and modules with modular functions&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;These modules can contain execution logic, validation functions, and hooks. Validation functions define the circumstances under which the smart contract account will approve actions taken on its behalf, while hooks allow for pre and post execution controls.&lt;&#x2F;p&gt;
&lt;p&gt;Accounts adopting this standard will support modular, upgradable execution and validation logic. Defining this as a standard for smart contract accounts will make modules easier to develop securely and will allow for greater interoperability.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;terms&quot;&gt;Terms&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;An &lt;strong&gt;account&lt;&#x2F;strong&gt; (or &lt;strong&gt;smart contract account, SCA&lt;&#x2F;strong&gt;) is a smart contract that can be used to send transactions and hold digital assets. It implements the &lt;code&gt;IAccount&lt;&#x2F;code&gt; interface from ERC-4337.&lt;&#x2F;li&gt;
&lt;li&gt;A &lt;strong&gt;modular account&lt;&#x2F;strong&gt; (or &lt;strong&gt;modular smart contract account, MSCA&lt;&#x2F;strong&gt;) is an account that supports modular functions. There are three types of modular functions:
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Validation functions&lt;&#x2F;strong&gt; validate authorization on behalf of the account.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Execution functions&lt;&#x2F;strong&gt; execute custom logic allowed by the account.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Hooks&lt;&#x2F;strong&gt; execute custom logic and checks before and&#x2F;or after an execution function or validation function. There are two types of hooks:
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Validation hooks&lt;&#x2F;strong&gt; run before a validation function. These can enforce permissions on actions authorized by a validation function.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Execution hooks&lt;&#x2F;strong&gt; can run before and&#x2F;or after an execution function. Execution hooks can be attached either to a specific execution function or a validation function. A pre execution hook may optionally return data to be consumed by a post execution hook.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;A &lt;strong&gt;native function&lt;&#x2F;strong&gt; refers to a function implemented by the modular account, as opposed to a function added by a module.&lt;&#x2F;li&gt;
&lt;li&gt;A &lt;strong&gt;module&lt;&#x2F;strong&gt; is a deployed smart contract that hosts any amount of the above three kinds of modular functions.&lt;&#x2F;li&gt;
&lt;li&gt;A module&#x27;s &lt;strong&gt;manifest&lt;&#x2F;strong&gt; describes the execution functions, interface IDs, and hooks that should be installed on the account.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;overview&quot;&gt;Overview&lt;&#x2F;h3&gt;
&lt;p&gt;A modular account handles two kinds of calls: either from the &lt;code&gt;EntryPoint&lt;&#x2F;code&gt; through ERC-4337, or through direct calls from externally owned accounts (EOAs) and other smart contracts. This standard supports both use cases.&lt;&#x2F;p&gt;
&lt;p&gt;A call to the modular account can be broken down into the steps as shown in the diagram below. The validation steps validate if the caller is allowed to perform the call. The pre execution hook step can be used to do any pre execution checks or updates. It can also be used along with the post execution hook step to perform additional actions or verification. The execution step performs a defined task or collection of tasks.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6900&#x2F;.&#x2F;assets&#x2F;Modular_Account_Call_Flow.svg&quot; alt=&quot;diagram showing call flow within a modular account&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Each step is modular, supporting different implementations, which allows for open-ended programmable accounts.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;interfaces&quot;&gt;Interfaces&lt;&#x2F;h3&gt;
&lt;p&gt;Modular accounts MUST implement:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;IAccount.sol&lt;&#x2F;code&gt; and &lt;code&gt;IAccountExecute.sol&lt;&#x2F;code&gt; from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;IERC6900Account.sol&lt;&#x2F;code&gt; to support module management and usage, and account identification.&lt;&#x2F;li&gt;
&lt;li&gt;The function &lt;code&gt;isValidSignature&lt;&#x2F;code&gt; from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;ERC-1271&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Modular accounts MAY implement:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;IERC6900AccountView.sol&lt;&#x2F;code&gt; to support visibility in account states on-chain.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; for interfaces installed from modules.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Modules MUST implement:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;IERC6900Module.sol&lt;&#x2F;code&gt; described below and implement ERC-165 for &lt;code&gt;IERC6900Module&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Modules MAY implement any of the following module types:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;IERC6900ValidationModule&lt;&#x2F;code&gt; to support validation functions for the account.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;IERC6900ValidationHookModule&lt;&#x2F;code&gt; to support hooks for validation functions.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;IERC6900ExecutionModule&lt;&#x2F;code&gt; to support execution functions and their installations on the account.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;IERC6900ExecutionHookModule&lt;&#x2F;code&gt; to support pre &amp;amp; post execution hooks for execution functions.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;ierc6900account-sol&quot;&gt;&lt;code&gt;IERC6900Account.sol&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Module execution and management interface. Modular accounts MUST implement this interface to support installing and uninstalling modules, and open-ended execution.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A packed representation of a module function.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Consists of the following, left-aligned:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Module address: 20 bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Entity ID:      4 bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ModuleEntity&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes24&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A packed representation of a validation function and its associated flags.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Consists of the following, left-aligned:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Module address:     20 bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Entity ID:          4 bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ValidationFlags:    1 byte&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ValidationConfig&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes25&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ValidationFlags layout:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0b00000___ &#x2F;&#x2F; unused&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0b_____A__ &#x2F;&#x2F; isGlobal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0b______B_ &#x2F;&#x2F; isSignatureValidation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0b_______C &#x2F;&#x2F; isUserOpValidation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ValidationFlags&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint8&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A packed representation of a hook function and its associated flags.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Consists of the following, left-aligned:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Module address: 20 bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Entity ID:      4 bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Flags:          1 byte&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Hook flags layout:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0b00000___ &#x2F;&#x2F; unused&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0b_____A__ &#x2F;&#x2F; hasPre (exec only)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0b______B_ &#x2F;&#x2F; hasPost (exec only)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0b_______C &#x2F;&#x2F; hook type (0 for exec, 1 for validation)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; HookConfig&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes25&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Call&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The target address for the account to call.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; target&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The value to send with the call.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The calldata for the call.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6900Account&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ExecutionInstalled&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; module&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;ExecutionManifest&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; manifest&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ExecutionUninstalled&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; module&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; onUninstallSucceeded&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;ExecutionManifest&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; manifest&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ValidationInstalled&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; module&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; entityId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ValidationUninstalled&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; module&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; entityId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; onUninstallSucceeded&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Standard execute method.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; target&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The target address for the account to call.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The value to send with the call.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The calldata for the call.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; return data from the call.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; execute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; target&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Standard executeBatch method.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If the target is a module, the call SHOULD revert. If any of the calls revert, the entire batch MUST&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; revert.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; calls&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The array of calls.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; An&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array containing the return data from the calls.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; executeBatch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Call&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; calls&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Execute a call using the specified runtime validation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The calldata to send to the account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; authorization&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The authorization data to use for the call. The first 24 bytes is a ModuleEntity which&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; specifies which runtime validation to use, and the rest is sent as a parameter to runtime validation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; executeWithRuntimeValidation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; authorization&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        payable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Install a module to the modular account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; module&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The module to install.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; manifest&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the manifest describing functions to install.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; installData&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Optional data to be used by the account to handle the initial execution setup. Data encoding&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is implementation-specific.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; installExecution&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; module&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        ExecutionManifest&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; manifest&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; installData&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Uninstall a module from the modular account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; module&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The module to uninstall.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; manifest&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The manifest describing functions to uninstall.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uninstallData&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Optional data to be used by the account to handle the execution uninstallation. Data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; encoding is implementation-specific.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; uninstallExecution&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; module&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        ExecutionManifest&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; manifest&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uninstallData&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Installs a validation function across a set of execution selectors, and optionally mark it as a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; global validation function.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; validationConfig&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The validation function to install, along with configuration flags.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; selectors&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The selectors to install the validation function for.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; installData&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Optional data to be used by the account to handle the initial validation setup. Data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; encoding is implementation-specific.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; hooks&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Optional hooks to install and associate with the validation function. Data encoding is&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; implementation-specific.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; installValidation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        ValidationConfig&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; validationConfig&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes4&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; selectors&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; installData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; hooks&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Uninstall a validation function from a set of execution selectors.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; validationFunction&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The validation function to uninstall.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uninstallData&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Optional data to be used by the account to handle the validation uninstallation. Data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; encoding is implementation-specific.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; hookUninstallData&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Optional data to be used by the account to handle hook uninstallation. Data encoding&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is implementation-specific.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; uninstallValidation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        ModuleEntity&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; validationFunction&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uninstallData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; hookUninstallData&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Return a unique identifier for the account implementation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function MUST return a string in the format &amp;quot;vendor.account.semver&amp;quot;. The vendor and account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; names MUST NOT contain a period character.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; account ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; accountId&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;ierc6900accountview-sol&quot;&gt;&lt;code&gt;IERC6900AccountView.sol&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Module inspection interface. Modular accounts MAY implement this interface to support visibility in module configuration.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Represents data associated with a specific function selector.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ExecutionDataView&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The module that implements this execution function.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If this is a native function, the address must be the address of the account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; module&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Whether or not the function needs runtime validation, or can be called by anyone. The function can still be&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; state changing if this flag is set to true.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; that even if this is set to true, user op validation will still be required, otherwise anyone could&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; drain the account of native tokens by wasting gas.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bool&lt;&#x2F;span&gt;&lt;span&gt; skipRuntimeValidation&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Whether or not a global validation function may be used to validate this function.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bool&lt;&#x2F;span&gt;&lt;span&gt; allowGlobalValidation&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The execution hooks for this function selector.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    HookConfig&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; executionHooks&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ValidationDataView&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ValidationFlags layout:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0b00000___ &#x2F;&#x2F; unused&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0b_____A__ &#x2F;&#x2F; isGlobal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0b______B_ &#x2F;&#x2F; isSignatureValidation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0b_______C &#x2F;&#x2F; isUserOpValidation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ValidationFlags validationFlags&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The validation hooks for this validation function.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    HookConfig&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; validationHooks&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Execution hooks to run with this validation function.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    HookConfig&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; executionHooks&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The set of selectors that may be validated by this validation function.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes4&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; selectors&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6900AccountView&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the execution data for a selector.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If the selector is a native function, the module address will be the address of the account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; selector&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The selector to get the data for.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; execution data for this selector.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getExecutionData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; selector&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;ExecutionDataView&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the validation data for a validation function.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If the selector is a native function, the module address will be the address of the account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; validationFunction&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The validation function to get the data for.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; validation data for this validation function.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getValidationData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;ModuleEntity&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; validationFunction&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;ValidationDataView&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;ierc6900module-sol&quot;&gt;&lt;code&gt;IERC6900Module.sol&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Module interface. Modules MUST implement this interface to support module management and interactions with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6900&#x2F;&quot;&gt;ERC-6900&lt;&#x2F;a&gt; modular accounts.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6900Module&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC165&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Initialize module data for the modular account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Called by the modular account during `installExecution`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Optional bytes array to be decoded and used by the module to setup initial module data for the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; modular account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onInstall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Clear module data for the modular account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Called by the modular account during `uninstallExecution`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Optional bytes array to be decoded and used by the module to clear module data for the modular&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onUninstall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Return a unique identifier for the module.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function MUST return a string in the format &amp;quot;vendor.module.semver&amp;quot;. The vendor and module&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; names MUST NOT contain a period character.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; module ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; moduleId&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;ierc6900validationmodule-sol&quot;&gt;&lt;code&gt;IERC6900ValidationModule.sol&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Validation module interface. Modules MAY implement this interface to provide validation functions for the account.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6900ValidationModule&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6900Module&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Run the user operation validation function specified by the `entityId`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; entityId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An identifier that routes the call to different internal implementations, should there&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; be more than one.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; userOp&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The user operation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; userOpHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The user operation hash.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Packed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; validation data for validAfter (6 bytes), validUntil (6 bytes), and authorizer (20 bytes).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validateUserOp&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; entityId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; PackedUserOperation&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; userOp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; userOpHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Run the runtime validation function specified by the `entityId`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; To indicate the entire call should revert, the function MUST revert.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The account to validate for.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; entityId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An identifier that routes the call to different internal implementations, should there&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; be more than one.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The caller address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The call value.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The calldata sent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; authorization&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Additional data for the validation function to use.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validateRuntime&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; entityId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; authorization&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Validates a signature using ERC-1271.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; To indicate the entire call should revert, the function MUST revert.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The account to validate for.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; entityId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An identifier that routes the call to different internal implementations, should there&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; be more than one.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address that sent the ERC-1271 request to the smart account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The hash of the ERC-1271 request.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The signature of the ERC-1271 request.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-1271 `MAGIC_VALUE` if the signature is valid, or 0xFFFFFFFF if invalid.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validateSignature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; entityId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;ierc6900validationhookmodule-sol&quot;&gt;&lt;code&gt;IERC6900ValidationHookModule.sol&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Validation hook module interface. Modules MAY implement this interface to provide hooks for validation functions for the account.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6900ValidationHookModule&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6900Module&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Run the pre user operation validation hook specified by the `entityId`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Pre user operation validation hooks MUST NOT return an authorizer value other than 0 or 1.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; entityId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An identifier that routes the call to different internal implementations, should there&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; be more than one.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; userOp&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The user operation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; userOpHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The user operation hash.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Packed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; validation data for validAfter (6 bytes), validUntil (6 bytes), and authorizer (20 bytes).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; preUserOpValidationHook&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; entityId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; PackedUserOperation&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; userOp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; userOpHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Run the pre runtime validation hook specified by the `entityId`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; To indicate the entire call should revert, the function MUST revert.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; entityId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An identifier that routes the call to different internal implementations, should there&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; be more than one.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The caller address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The call value.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The calldata sent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; authorization&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Additional data for the hook to use.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; preRuntimeValidationHook&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; entityId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; authorization&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Run the pre signature validation hook specified by the `entityId`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; To indicate the call should revert, the function MUST revert.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; entityId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An identifier that routes the call to different internal implementations, should there&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; be more than one.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The caller address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The hash of the message being signed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The signature of the message.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; preSignatureValidationHook&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; entityId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;ierc6900executionmodule-sol&quot;&gt;&lt;code&gt;IERC6900ExecutionModule.sol&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Execution module interface. Modules MAY implement this interface to provide execution functions for the account.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ManifestExecutionFunction&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The selector to install.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes4&lt;&#x2F;span&gt;&lt;span&gt; executionSelector&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If true, the function won&amp;#39;t need runtime validation, and can be called by anyone.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bool&lt;&#x2F;span&gt;&lt;span&gt; skipRuntimeValidation&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If true, the function can be validated by a global validation function.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bool&lt;&#x2F;span&gt;&lt;span&gt; allowGlobalValidation&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ManifestExecutionHook&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes4&lt;&#x2F;span&gt;&lt;span&gt; executionSelector&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint32&lt;&#x2F;span&gt;&lt;span&gt; entityId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bool&lt;&#x2F;span&gt;&lt;span&gt; isPreHook&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bool&lt;&#x2F;span&gt;&lt;span&gt; isPostHook&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A struct describing how the module should be installed on a modular account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ExecutionManifest&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Execution functions defined in this module to be installed on the MSCA.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ManifestExecutionFunction&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; executionFunctions&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ManifestExecutionHook&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; executionHooks&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; List of ERC-165 interface IDs to add to account to support introspection checks. This MUST NOT include&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; IERC6900Module&amp;#39;s interface ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes4&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; interfaceIds&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6900ExecutionModule&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6900Module&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Describe the contents and intended configuration of the module.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This manifest MUST stay constant over time.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; A&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; manifest describing the contents and intended configuration of the module.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; executionManifest&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;ExecutionManifest&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;ierc6900executionhookmodule-sol&quot;&gt;&lt;code&gt;IERC6900ExecutionHookModule.sol&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Execution hook module interface. Modules MAY implement this interface to provide hooks for execution functions for the account.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6900ExecutionHookModule&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6900Module&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Run the pre execution hook specified by the `entityId`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; To indicate the entire call should revert, the function MUST revert.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; entityId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An identifier that routes the call to different internal implementations, should there&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; be more than one.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The caller address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The call value.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The calldata sent. For `executeUserOp` calls of validation-associated hooks, hook modules&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; should receive the full calldata.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Context&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; to pass to a post execution hook, if present. An empty bytes array MAY be returned.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; preExecutionHook&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; entityId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Run the post execution hook specified by the `entityId`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; To indicate the entire call should revert, the function MUST revert.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; entityId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An identifier that routes the call to different internal implementations, should there&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; be more than one.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; preExecHookData&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The context returned by its associated pre execution hook.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; postExecutionHook&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; entityId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; preExecHookData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;validation-functions&quot;&gt;Validation Functions&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;installation&quot;&gt;Installation&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;The account MUST install all validation hooks specified by the user and SHOULD call &lt;code&gt;onInstall&lt;&#x2F;code&gt; with the user-provided data on the hook module to initialize state if specified by the user.&lt;&#x2F;li&gt;
&lt;li&gt;The account MUST install all execution hooks specified by the user and SHOULD call &lt;code&gt;onInstall&lt;&#x2F;code&gt; with the user-provided data on the hook module to initialize state if specified by the user.&lt;&#x2F;li&gt;
&lt;li&gt;The account MUST configure the validation function to validate all of the selectors specified by the user.&lt;&#x2F;li&gt;
&lt;li&gt;The account MUST set all flags as specified, like &lt;code&gt;isGlobal&lt;&#x2F;code&gt;, &lt;code&gt;isSignatureValidation&lt;&#x2F;code&gt;, and &lt;code&gt;isUserOpValidation&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The account SHOULD call &lt;code&gt;onInstall&lt;&#x2F;code&gt; on the validation module to initialize state if specified by the user.&lt;&#x2F;li&gt;
&lt;li&gt;The account MUST emit &lt;code&gt;ValidationInstalled&lt;&#x2F;code&gt; as defined in the interface for all installed validation functions.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;uninstallation&quot;&gt;Uninstallation&lt;&#x2F;h4&gt;
&lt;p&gt;During validation uninstallation, the account MUST correctly clear flags and other fields based on the incoming data provided by the user.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The account MUST clear all flags for the validation function, like &lt;code&gt;isGlobal&lt;&#x2F;code&gt;, &lt;code&gt;isSignatureValidation&lt;&#x2F;code&gt;, and &lt;code&gt;isUserOpValidation&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The account MUST remove all hooks and SHOULD clear hook module states by calling &lt;code&gt;onUninstall&lt;&#x2F;code&gt; with the user-provided data for each hook, including both validation hooks and execution hooks, if specified by the user.
&lt;ul&gt;
&lt;li&gt;The account MAY ignore the revert from &lt;code&gt;onUninstall&lt;&#x2F;code&gt; with try&#x2F;catch depending on the design principle of the account.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The account MUST clear the configuration for the selectors that the validation function can validate.&lt;&#x2F;li&gt;
&lt;li&gt;The account SHOULD call &lt;code&gt;onUninstall&lt;&#x2F;code&gt; on the validation module to clean up state if specified by the user.&lt;&#x2F;li&gt;
&lt;li&gt;The account MUST emit &lt;code&gt;ValidationUninstalled&lt;&#x2F;code&gt; as defined in the interface for all uninstalled validation functions.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;execution-functions&quot;&gt;Execution Functions&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;installation-1&quot;&gt;Installation&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;The account MUST install all execution functions and set flags and fields as specified in the manifest.
&lt;ul&gt;
&lt;li&gt;An execution function selector MUST be unique in the account.&lt;&#x2F;li&gt;
&lt;li&gt;An execution function selector MUST not conflict with native ERC-4337 and ERC-6900 functions.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The account MUST add all execution hooks as specified in the manifest.&lt;&#x2F;li&gt;
&lt;li&gt;The account SHOULD add all supported interfaces as specified in the manifest.&lt;&#x2F;li&gt;
&lt;li&gt;The account SHOULD call &lt;code&gt;onInstall&lt;&#x2F;code&gt; on the execution module to initialize state if specified by the user.&lt;&#x2F;li&gt;
&lt;li&gt;The account MUST emit &lt;code&gt;ExecutionInstalled&lt;&#x2F;code&gt; as defined in the interface for all installed executions.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;uninstallation-1&quot;&gt;Uninstallation&lt;&#x2F;h4&gt;
&lt;p&gt;During execution uninstallation, the account MUST correctly clear flags and other fields based on the incoming data and module manifest provided by the user.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The account MUST remove all execution functions and clear flags and fields as specified in the manifest.&lt;&#x2F;li&gt;
&lt;li&gt;The account MUST remove all execution hooks as specified in the manifest.&lt;&#x2F;li&gt;
&lt;li&gt;The account SHOULD remove all supported interfaces as specified in the manifest.&lt;&#x2F;li&gt;
&lt;li&gt;The account SHOULD call &lt;code&gt;onUninstall&lt;&#x2F;code&gt; on the execution module to clean up state and track call success if specified by the user.&lt;&#x2F;li&gt;
&lt;li&gt;The account MUST emit &lt;code&gt;ExecutionUninstalled&lt;&#x2F;code&gt; as defined in the interface for all uninstalled executions.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;hooks&quot;&gt;Hooks&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;execution-hooks-data-format&quot;&gt;Execution Hooks Data Format&lt;&#x2F;h4&gt;
&lt;p&gt;For accounts that implement execution hooks, accounts MUST conform to these execution hook formats:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;For &lt;code&gt;executeUserOp&lt;&#x2F;code&gt; calls, for execution hooks associated with a validation function, accounts MUST send the full calldata (&lt;code&gt;msg.data&lt;&#x2F;code&gt; in solidity), including the &lt;code&gt;executeUserOp&lt;&#x2F;code&gt; selector.&lt;&#x2F;li&gt;
&lt;li&gt;For &lt;code&gt;executeUserOp&lt;&#x2F;code&gt; calls, for execution hooks associated with a selector, accounts MUST send &lt;code&gt;PackedUserOperation.callData&lt;&#x2F;code&gt; for &lt;code&gt;executeUserOp&lt;&#x2F;code&gt; calls, excluding &lt;code&gt;executeUserOp.selector&lt;&#x2F;code&gt; and the rest of the &lt;code&gt;PackedUserOperation&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;For &lt;code&gt;executeWithRuntimeValidation&lt;&#x2F;code&gt; calls, for all execution hooks, accounts MUST send the inner &lt;code&gt;data&lt;&#x2F;code&gt; field.&lt;&#x2F;li&gt;
&lt;li&gt;For all other calls, for execution hooks associated with a selector, accounts MUST send over the full calldata (&lt;code&gt;msg.data&lt;&#x2F;code&gt; in solidity).&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h4 id=&quot;hook-execution-order&quot;&gt;Hook Execution Order&lt;&#x2F;h4&gt;
&lt;p&gt;It is RECOMMENDED that an account implementer runs hooks in first installed first executed order. However, an account MAY implement a different execution order.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;validation-call-flow&quot;&gt;Validation Call Flow&lt;&#x2F;h3&gt;
&lt;p&gt;Modular accounts support three different calls flows for validation: user op validation, runtime validation, and signature validation. User op validation happens within the account&#x27;s implementation of the function &lt;code&gt;validateUserOp&lt;&#x2F;code&gt;, defined in the ERC-4337 interface &lt;code&gt;IAccount&lt;&#x2F;code&gt;. Runtime validation happens through the dispatcher function &lt;code&gt;executeWithRuntimeValidation&lt;&#x2F;code&gt;, or when using &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6900&#x2F;#direct-call-validation&quot;&gt;direct call validation&lt;&#x2F;a&gt;. Signature validation happens within the account&#x27;s implementation of the function &lt;code&gt;isValidSignature&lt;&#x2F;code&gt;, defined in ERC-1271.&lt;&#x2F;p&gt;
&lt;p&gt;For each of these validation types, an account implementation MAY specify its own format for selecting which validation function to use, as well as any per-hook data for validation hooks.&lt;&#x2F;p&gt;
&lt;p&gt;Within the implementation of each type of validation function, the modular account MUST check that the provided validation function applies to the given function selector intended to be run (See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6900&#x2F;#checking-validation-applicability&quot;&gt;Checking Validation Applicability&lt;&#x2F;a&gt;). Then, the account MUST execute all validation hooks of the corresponding type associated with the validation function in use. After the execution of validation hooks, the account MUST invoke the validation function of the corresponding type. If any of the validation hooks or the validation function reverts, the account MUST revert. It SHOULD include the module&#x27;s revert data within its revert data.&lt;&#x2F;p&gt;
&lt;p&gt;The account MUST define a way to pass data separately for each validation hook and the validation function itself. This data SHOULD be sent as the &lt;code&gt;userOp.signature&lt;&#x2F;code&gt; field for user op validation, the &lt;code&gt;authorization&lt;&#x2F;code&gt; field for runtime validation, and the &lt;code&gt;signature&lt;&#x2F;code&gt; field for signature validation.&lt;&#x2F;p&gt;
&lt;p&gt;The result of user op validation MUST be the intersection of time bounds returned by the validation hooks and the validation function. If any validation hooks or the validation functions returns a value of &lt;code&gt;1&lt;&#x2F;code&gt; for the authorizer field, indicating a signature verification failure by the ERC-4337 standard, the account MUST return a value of &lt;code&gt;1&lt;&#x2F;code&gt; for the authorizer portion of the validation data.&lt;&#x2F;p&gt;
&lt;p&gt;The set of validation hooks run MUST be the hooks specified by account state at the start of validation. In other words, if the set of applicable hooks changes during validation, the original set of hooks MUST still run, and only future invocations of the same validation should reflect the changed set of hooks.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;checking-validation-applicability&quot;&gt;Checking Validation Applicability&lt;&#x2F;h4&gt;
&lt;p&gt;To enforce module permission isolation, the modular account MUST check validation function applicability as part of each validation function implementation.&lt;&#x2F;p&gt;
&lt;p&gt;User op validation and runtime validation functions have a configurable range of applicability to functions on the account. This can be configured with selectors installed to a validation. Alternatively, a validation installation MAY specify the &lt;code&gt;isGlobal&lt;&#x2F;code&gt; flag as true, which means the account MUST consider it applicable to any module execution function with the &lt;code&gt;allowGlobalValidation&lt;&#x2F;code&gt; flag set to true, or for any account native function that the account MAY allow for global validation.&lt;&#x2F;p&gt;
&lt;p&gt;If the selector being checked is &lt;code&gt;execute&lt;&#x2F;code&gt; or &lt;code&gt;executeBatch&lt;&#x2F;code&gt;, the modular account MUST perform additional checking. If the target of &lt;code&gt;execute&lt;&#x2F;code&gt; is the modular account&#x27;s own address, or if the target of any &lt;code&gt;Call&lt;&#x2F;code&gt; within &lt;code&gt;executeBatch&lt;&#x2F;code&gt; is the account, validation MUST either revert or check that validation applies to the selector(s) being called.&lt;&#x2F;p&gt;
&lt;p&gt;Installed validation functions have two additional flag variables indicating what they may be used for. If a validation function is attempted to be used for user op validation and the flag &lt;code&gt;isUserOpValidation&lt;&#x2F;code&gt; is set to false, validation MUST revert. If the validation function is attempted to be used for signature validation and the flag &lt;code&gt;isSignatureValidation&lt;&#x2F;code&gt; is set to false, validation MUST revert.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;direct-call-validation&quot;&gt;Direct Call Validation&lt;&#x2F;h4&gt;
&lt;p&gt;If a validation function is installed with the entity ID of &lt;code&gt;0xffffffff&lt;&#x2F;code&gt;, it may be used as direct call validation. This occurs when a module or other address calls a function on the modular account, without wrapping its call in the dispatcher function &lt;code&gt;executeWithRuntimeValidation&lt;&#x2F;code&gt; to use as a selection mechanism for a runtime validation function.&lt;&#x2F;p&gt;
&lt;p&gt;To implement direct call validation, the modular account MUST treat direct function calls that are not from the modular account itself or the &lt;code&gt;EntryPoint&lt;&#x2F;code&gt; as an attempt to validate using the caller&#x27;s address and the entity ID of &lt;code&gt;0xffffffff&lt;&#x2F;code&gt;. If such a validation function is installed, and applies to the function intended to be called, the modular account MUST allow it to continue, without performing runtime validation. Any validation hooks and execution hooks installed to this validation function MUST still run.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;execution-call-flow&quot;&gt;Execution Call Flow&lt;&#x2F;h3&gt;
&lt;p&gt;For all non-view functions within &lt;code&gt;IERC6900Account&lt;&#x2F;code&gt; except &lt;code&gt;executeWithRuntimeValidation&lt;&#x2F;code&gt;, all module-defined execution functions, and any additional native functions that the modular account MAY wish to include, the modular account MUST adhere to these steps during execution:&lt;&#x2F;p&gt;
&lt;p&gt;If the caller is not the &lt;code&gt;EntryPoint&lt;&#x2F;code&gt; or the account, the account MUST check access control for direct call validation.&lt;&#x2F;p&gt;
&lt;p&gt;Prior to running the target function, the modular account MUST run all pre execution hooks that apply for the current function call. Pre execution hooks apply if they have been installed to the currently running function selector, or if they are installed as an execution hook to the validation function that was used for the current execution. Pre execution hooks MUST run validation-associated hooks first, then selector-associated hooks second.&lt;&#x2F;p&gt;
&lt;p&gt;Next, the modular account MUST run the target function, either an account native function or a module-defined execution function.&lt;&#x2F;p&gt;
&lt;p&gt;After the execution of the target function, the modular account MUST run any post execution hooks. These MUST be run in the reverse order of the pre execution hooks. If a hook is defined to be both a pre and a post execution hook, and the pre execution hook returned a non-empty &lt;code&gt;bytes&lt;&#x2F;code&gt; value to the account, the account MUST pass that data to the post execution hook.&lt;&#x2F;p&gt;
&lt;p&gt;The set of hooks run for a given target function MUST be the hooks specified by account state at the start of the execution phase. In other words, if the set of applicable hooks changes during execution, the original set of hooks MUST still run, and only future invocations of the same target function should reflect the changed set of hooks.&lt;&#x2F;p&gt;
&lt;p&gt;Module execution functions where the field &lt;code&gt;skipRuntimeValidation&lt;&#x2F;code&gt; is set to true, as well as native functions without access control, SHOULD omit the runtime validation step, including any runtime validation hooks. Native functions without access control MAY also omit running execution hooks.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;extension&quot;&gt;Extension&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;semi-modular-account&quot;&gt;Semi-Modular Account&lt;&#x2F;h4&gt;
&lt;p&gt;Account implementers MAY choose to design a semi-modular account, where certain features, such as default validation, are integrated into the core account. This approach SHOULD ensure compatibility with fully modular accounts, as defined in this proposal, to maintain interoperability across different implementations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;ERC-4337 compatible accounts must implement the &lt;code&gt;IAccount&lt;&#x2F;code&gt; interface, which consists of only one method that bundles validation with execution: &lt;code&gt;validateUserOp&lt;&#x2F;code&gt;. A primary design rationale for this proposal is to extend the possible functions for a smart contract account beyond this single method by unbundling these and other functions, while retaining the benefits of account abstraction.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal includes several interfaces that build on ERC-4337. First, we standardize a set of modular functions that allow smart contract developers greater flexibility in bundling validation, execution, and hook logic. We also propose interfaces that provide methods for querying execution functions, validation functions, and hooks on a modular account. The rest of the interfaces describe a module&#x27;s methods for exposing its modular functions and desired configuration, and the modular account&#x27;s methods for installing and removing modules and allowing execution across modules and external addresses.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;erc-4337-dependency&quot;&gt;ERC-4337 Dependency&lt;&#x2F;h3&gt;
&lt;p&gt;ERC-6900&#x27;s main objective is to create a secure and interoperable foundation through modular accounts and modules to increase the velocity and security of the smart account ecosystem, and ultimately the wallet ecosystem. Currently, the standard prescribes ERC-4337 for one of its &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6900&#x2F;#overview&quot;&gt;modular account call flows&lt;&#x2F;a&gt;. However, this does not dictate that ERC-6900 will continue to be tied to ERC-4337.
It is likely that smart account builders will want to develop modular accounts that do not use ERC-4337 in the future (e.g., native account abstraction on rollups). Moreover, it is expected that ERC-4337 and its interfaces and contracts will continue to evolve until there is a protocol-level account abstraction.&lt;&#x2F;p&gt;
&lt;p&gt;In the current state of the AA ecosystem, it is tough to predict the direction the builders and industry will take, so ERC-6900 will evolve together with the space&#x27;s research, development, and adoption. The standard will do its best to address the objectives and create a secure foundation for modular accounts that may eventually be abstracted away from the infrastructure mechanism used.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;community-consensus&quot;&gt;Community Consensus&lt;&#x2F;h3&gt;
&lt;p&gt;While this standard has largely been the result of collaboration among the coauthors, there have been noteworthy contributions from others in the community with respect to improvements, education, and experimentation. Thank you to the contributors:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Gerard Persoon (@gpersoon)&lt;&#x2F;li&gt;
&lt;li&gt;Harry Jeon (@sm-stack)&lt;&#x2F;li&gt;
&lt;li&gt;Zhiyu Zhang (@ZhiyuCircle)&lt;&#x2F;li&gt;
&lt;li&gt;Danilo Neves Cruz (@cruzdanilo)&lt;&#x2F;li&gt;
&lt;li&gt;Iván Alberquilla (@ialberquilla)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;We host community calls and working groups to discuss standard improvements and invite anyone with questions or contributions into our discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Existing accounts that are deployed as proxies may have the ability to upgrade account implementations to one that supports this standard for modularity. Depending on implementation logic, existing modules may be wrapped in an adapter contract to adhere to the standard.&lt;&#x2F;p&gt;
&lt;p&gt;The standard also allows for flexibility in account implementations, including accounts that have certain features implemented without modules, so usage of modules may be gradually introduced.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;See &lt;code&gt;https:&#x2F;&#x2F;github.com&#x2F;erc6900&#x2F;reference-implementation&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;wallet-sdk-developers&quot;&gt;Wallet&#x2F;SDK Developers&lt;&#x2F;h3&gt;
&lt;p&gt;From the wallet side, there are certain checks that the wallet&#x2F;SDK should perform on the UI&#x2F;UX side.&lt;&#x2F;p&gt;
&lt;p&gt;The standard introduces a concept of the execution manifest, which describes the execution functions, interface IDs, and hooks that should be installed on the account from an execution manifest. As part of constructing parameters to &lt;code&gt;installExecution()&lt;&#x2F;code&gt;, the SDK creates an &lt;code&gt;executionManifest&lt;&#x2F;code&gt; parameter that will specify the actions of the execution module being installed. SDKs will process the provided &lt;code&gt;executionManifest()&lt;&#x2F;code&gt; function of the underlying module, but the finished parameter will not necessarily be identical to the module’s return value of &lt;code&gt;executionManifest()&lt;&#x2F;code&gt;. Furthermore, this parameter is only going through very limited checks on-chain as part of the installation process. Therefore, the &lt;code&gt;executionManifest&lt;&#x2F;code&gt; parameter needs to be carefully constructed and verified before being used for installations. Furthermore, the &lt;code&gt;executionManifest&lt;&#x2F;code&gt; parameter of uninstallation should ideally be the same used in installation to not leave residual data.&lt;&#x2F;p&gt;
&lt;p&gt;The standard supports a &lt;code&gt;isGlobalValidation&lt;&#x2F;code&gt; flag for validation functions, which means that this function is added to a global validation pool and can validate any of the execution functions that expose themselves to global validation via &lt;code&gt;allowGlobalValidation&lt;&#x2F;code&gt; flag. Depending on the implementation, some, all or none of the native execution functions could be globally validated. Therefore, the wallets should be careful about what validation functions they allow to be installed with global validation enabled, as that would allow these functions to validate the exposed native functions and hence bypass any restrictions that may have been added to protect these native&#x2F;execution functions. In a sense, these global validation functions could gain root access to the exposed native execution functions and potentially the whole account.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;module-developers&quot;&gt;Module Developers&lt;&#x2F;h3&gt;
&lt;p&gt;The standard does not enforce any rules surrounding what data needs to be installed or uninstalled when a module is added&#x2F;deleted from the account. Hence the &lt;code&gt;onUninstall()&lt;&#x2F;code&gt; function in various modules may leave behind residual state data, especially since the external call may not be performed all. Furthermore, execution hooks linked to an uninstalled function may remain configured. This could pose security risks or lead to unexpected behavior in the case where the module is reinstalled with the same &lt;code&gt;entityId&lt;&#x2F;code&gt;. The danger is that previously set permissions or data may be unintentionally reused. Hence it is a good idea to fully uninstall all data linked to the smart module account including execution hooks.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;users&quot;&gt;Users&lt;&#x2F;h3&gt;
&lt;p&gt;The modular smart contract accounts themselves are trusted components. Installed modules are trusted to varying degrees, as modules can interact with an arbitrarily large or small set of resources on an account. For example, a wide-reaching malicious module could add reverting hooks to native function selectors, bricking the account, or add execution functions that may drain the funds of the account. However, it is also possible to install a module with a very narrow domain, and depend on the correctness of the account behavior to enforce its limited access. Users should, therefore be careful in what modules to add to their account.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Arithmetic verification at EVM level</title>
        <published>2023-04-16T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Renan Rodrigues de Souza</name><uri>https://github.com/RenanSouza2</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6888/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-math-checking/13846" />
        

        <id>https://wg-eips.ritovision.com/6888/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:6888"
            label="EIP-6888" />
        

        
        

        
        <summary type="html">Check for math overflows and division by zero at EVM level</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6888/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP adds arithmetics checks to EVM arithmetic and a new opcode jump conditionally if there were events. The list of check includes overflows, division by zero.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The importance of math checks in smart contract projects is very clear. It was an OpenZeppelin library and then incorporated in Solidity&#x27;s default behavior. Bringing this to EVM level can combine both gas efficiency and safety.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;Starting from &lt;code&gt;BLOCK_TIMESTAMP &amp;gt;= HARDFORK_TIMESTAMP&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;HARDFORK_TIMESTAMP&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint64&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;TBD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;UINT_MAX&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint256&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2 ** 256 - 1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;INT_MIN&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;int256&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;-(2**255)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;flags&quot;&gt;Flags&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Variable&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: left&quot;&gt;Initial Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;carry&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;bool&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;false&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;overflow&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;bool&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;false&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Two new flags are added to the EVM state: unsigned warning (&lt;code&gt;carry&lt;&#x2F;code&gt;) and signed warning (&lt;code&gt;overflow&lt;&#x2F;code&gt;). The scope of those flags are the same as the program counter.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;p&gt;From this point forward  &lt;code&gt;a&lt;&#x2F;code&gt;, &lt;code&gt;b&lt;&#x2F;code&gt; and &lt;code&gt;c&lt;&#x2F;code&gt; references the arguments in a math operation and &lt;code&gt;res&lt;&#x2F;code&gt; the output. &lt;code&gt;c&lt;&#x2F;code&gt; is only used if the operation takes 3 inputs.&lt;&#x2F;p&gt;
&lt;p&gt;The function &lt;code&gt;sign(x)&lt;&#x2F;code&gt; is defined in the set of &lt;code&gt;uint256 -&amp;gt; {NEGATIVE, ZERO, POSITIVE}&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;contidions&quot;&gt;Contidions&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;carry&lt;&#x2F;code&gt; flag MUST be set in the following circumstances:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;When opcode is &lt;code&gt;ADD&lt;&#x2F;code&gt; (&lt;code&gt;0x01&lt;&#x2F;code&gt;) and &lt;code&gt;res &amp;lt; a&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;When opcode is &lt;code&gt;MUL&lt;&#x2F;code&gt; (&lt;code&gt;0x02&lt;&#x2F;code&gt;) and &lt;code&gt;a != 0 ∧ res &#x2F; a != b&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;When opcode is &lt;code&gt;SUB&lt;&#x2F;code&gt; (&lt;code&gt;0x03&lt;&#x2F;code&gt;) and &lt;code&gt;b &amp;gt; a&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;When opcode is &lt;code&gt;DIV&lt;&#x2F;code&gt; (&lt;code&gt;0x04&lt;&#x2F;code&gt;) or &lt;code&gt;MOD&lt;&#x2F;code&gt; (&lt;code&gt;0x06&lt;&#x2F;code&gt;); and &lt;code&gt;b == 0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;When opcode is &lt;code&gt;ADDMOD&lt;&#x2F;code&gt; (&lt;code&gt;0x08&lt;&#x2F;code&gt;) and &lt;code&gt;c == 0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;When opcode is &lt;code&gt;MULMOD&lt;&#x2F;code&gt; (&lt;code&gt;0x08&lt;&#x2F;code&gt;) and &lt;code&gt;c == 0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;When opcode is &lt;code&gt;EXP&lt;&#x2F;code&gt; (&lt;code&gt;0x0A&lt;&#x2F;code&gt;) and &lt;code&gt;a ** b &amp;gt; UINT_MAX&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;When opcode is &lt;code&gt;SHL&lt;&#x2F;code&gt; (&lt;code&gt;0x1b&lt;&#x2F;code&gt;) and &lt;code&gt;res &amp;gt;&amp;gt; a != b&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;code&gt;overflow&lt;&#x2F;code&gt; flag MUST be set in the following circumstances:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;When opcode is &lt;code&gt;ADD&lt;&#x2F;code&gt; (&lt;code&gt;0x01&lt;&#x2F;code&gt;) and &lt;code&gt;a != 0 ∧ b != 0 ∧ sign(a) == sign(b) ∧ sign(a) != sign(res)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;When opcode is &lt;code&gt;SUB&lt;&#x2F;code&gt; (&lt;code&gt;0x03&lt;&#x2F;code&gt;) and &lt;code&gt;(a != 0 ∧ b != 0 ∧ sign(a) != sign(b) ∧ sign(a) != sign(res)) ∨ (a == 0 ^ b == INT_MIN)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;When opcode is &lt;code&gt;MUL&lt;&#x2F;code&gt; (&lt;code&gt;0x02&lt;&#x2F;code&gt;) and &lt;code&gt;(a == -1 ∧ b == INT_MIN) ∨ (a == INT_MIN ∧ b == -1) ∨ (a != 0 ∧ (res &#x2F; a != b))&lt;&#x2F;code&gt; (this &lt;code&gt;&#x2F;&lt;&#x2F;code&gt; represents &lt;code&gt;SDIV&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;When opcode is &lt;code&gt;SDIV&lt;&#x2F;code&gt; (&lt;code&gt;0x05&lt;&#x2F;code&gt;)  or &lt;code&gt;SMOD&lt;&#x2F;code&gt; (&lt;code&gt;0x06&lt;&#x2F;code&gt;); and &lt;code&gt;b == 0 ∨ (a == INT_MIN ∧ b == -1)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;When opcode is &lt;code&gt;SHL&lt;&#x2F;code&gt; (&lt;code&gt;0x1b&lt;&#x2F;code&gt;) and &lt;code&gt;res &amp;gt;&amp;gt; a != b&lt;&#x2F;code&gt; (this &lt;code&gt;&amp;gt;&amp;gt;&lt;&#x2F;code&gt; represents &lt;code&gt;SAR&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;opcodes&quot;&gt;Opcodes&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;jumpc&quot;&gt;&lt;code&gt;JUMPC&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Consumes one argument from the stack, the possible pc dest,
Conditionally alter the program counter depending on the &lt;code&gt;carry&lt;&#x2F;code&gt; flag. &lt;code&gt;J_JUMPC = carry ? µ_s[0] : µ_pc + 1&lt;&#x2F;code&gt;
Clears both flags. &lt;code&gt;carry = overflow = false&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;jumpo&quot;&gt;&lt;code&gt;JUMPO&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Consumes one argument from the stack, the possible pc dest,
Conditionally alter the program counter depending on the &lt;code&gt;ovewflow&lt;&#x2F;code&gt; flag. &lt;code&gt;J_JUMPO = carry ? µ_s[0] : µ_pc + 1&lt;&#x2F;code&gt;
Clears both flags. &lt;code&gt;carry = overflow = false&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas&quot;&gt;gas&lt;&#x2F;h3&gt;
&lt;p&gt;The gas cost for both instructions is &lt;code&gt;G_high&lt;&#x2F;code&gt;, the same as &lt;code&gt;JUMPI&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;EVM uses two&#x27;s complement for negative numbers. The opcodes listed above triggers one or two flags depending if they are used for signed and unsigned numbers.&lt;&#x2F;p&gt;
&lt;p&gt;The conditions described for each opcode is made with implementation friendliness in mind. The only exception is EXP as it is hard to give a concise test as most of the others relied on the inverse operation and there is no native &lt;code&gt;LOG&lt;&#x2F;code&gt;. Most &lt;code&gt;EXP&lt;&#x2F;code&gt; implementations will internally use &lt;code&gt;MUL&lt;&#x2F;code&gt; so the flag &lt;code&gt;carry&lt;&#x2F;code&gt; can be drawn from that instruction, not the &lt;code&gt;overflow&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Both flags are cleaned at the same time because the instructions are expected to be used when transitioning between codes where numbers are treated as signed or unsigned.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a new opcode and changes int EVM behavior.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This is a new EVM behavior but each code will decide how to interact with it.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Preimage retention</title>
        <published>2023-04-14T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Guillaume Ballet</name><uri>https://github.com/gballet</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6873/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6873-preimage-retention-in-the-fork-preceding-the-verge/15830" />
        

        <id>https://wg-eips.ritovision.com/6873/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:6873"
            label="EIP-6873" />
        

        
        

        
        <summary type="html">Execution clients must retain the preimages of addresses and slots accessed between the fork preceding the verge, and the verge itself.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6873/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Enforce preimage collection by every node on the network from the fork preceding the verge, up to the fork. This is needed in case each node is responsible for their own conversion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;Let &lt;code&gt;T_p&lt;&#x2F;code&gt; be the timestamp of the fork preceding the verge, and &lt;code&gt;T_v&lt;&#x2F;code&gt; the timestamp of the verge.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;EL clients MUST save the preimage of each address and slot hashes they produce during the execution of all blocks produced between &lt;code&gt;T_p&lt;&#x2F;code&gt; and &lt;code&gt;T_v&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;EL clients MAY start storing preimages outside of this time range as well&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Given a hash produced between &lt;code&gt;T_p&lt;&#x2F;code&gt; and &lt;code&gt;T_v&lt;&#x2F;code&gt;, EL clients SHOULD be able to show they have the preimage for that hash in their database&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;EL clients SHOULD be able to download the preimages of the address and slot hashes that were produced before &lt;code&gt;T_v&lt;&#x2F;code&gt; from a publicly-available datastore&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Switching to verkle trees require a complete rehashing of all tree keys. Most execution clients store all keys hashed, without their preimages, which as the time of print take up 70GB on mainnet. In order to make these preimages available to everyone, the following course of action are available to each user:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Restart a full-sync with preimage retention enabled&lt;&#x2F;li&gt;
&lt;li&gt;Download the preimages as a file&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The second option is the only acceptable option in practice, as a full-sync requires the syncing machine to be offline for several days, and therefore should not be simultaneously imposed to the entire network. A file download, however, poses a problem of data obsolescence as new preimages will immediately need to be added to the list as the chain progresses and new addresses are accessed. Updating the preimage file is not sufficient, since it takes more than a slot time to download over 70GB.&lt;&#x2F;p&gt;
&lt;p&gt;To guarantee a timely availability of all preimages around the verkle transition time, each node is therefore responsible for updating the list of preimages between the fork preceding the Verge, and the Verge itself.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;!--

## Test Cases

TODO

--&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;All clients already implement preimage retention, at least as an option.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion. &lt;!-- TODO --&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>On-Chain EIP-712 Visualization</title>
        <published>2023-04-10T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Abderrahmen Hanafi</name><uri>https://github.com/a6-dou</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6865/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6865-on-chain-eip-712-visualization/13800" />
        

        <id>https://wg-eips.ritovision.com/6865/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:6865"
            label="ERC-6865" />
        

        
        

        
        <summary type="html">Visualize structured data highlighting the potential consequences for users&#x27; assets</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6865/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Numerous protocols employ distinct &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; schemas, leading to unavoidable inconsistencies across the ecosystem. To address this issue, we propose a standardized approach for dApps to implement an on-chain view function called &lt;code&gt;visualizeEIP712Message&lt;&#x2F;code&gt;. This function takes an abi encoded EIP-712 payload message as input and returns a universally agreed-upon structured data format that emphasizes the potential impact on users&#x27; assets. Wallets can then display this structured data in a user-friendly manner, ensuring a consistent experience for end-users when interacting with various dApps and protocols.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The rapid expansion of the web3.0 ecosystem has unlocked numerous opportunities and innovations. However, this growth has also heightened users&#x27; vulnerability to security threats, such as phishing scams. Ensuring that users have a comprehensive understanding of the transactions they sign is crucial for mitigating these risks.&lt;&#x2F;p&gt;
&lt;p&gt;In an attempt to address this issue, we developed an in-house, open-source off-chain SDK for wallets to visualize various protocols. However, we encountered several challenges along the way:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Scalability: Identifying and understanding all protocols that utilize EIP-712 and their respective business logic is a daunting task, particularly with limited resources. Crafting an off-chain solution for all these protocols is nearly impossible.&lt;&#x2F;li&gt;
&lt;li&gt;Reliability: Grasping each protocol&#x27;s business logic is difficult and may lead to misunderstandings of the actual implementation. This can result in inaccurate visualizations, which could be more detrimental than providing no visualization at all.&lt;&#x2F;li&gt;
&lt;li&gt;Maintainability: Offering support for protocols with an off-chain solution is insufficient in a rapidly evolving ecosystem. Protocols frequently upgrade their implementations by extending features or fixing bugs, further complicating the maintenance process.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;To overcome these challenges, we propose a standardized, on-chain solution that can accommodate the diverse and ever-changing web3.0 ecosystem. This approach would enhance scalability, reliability, and maintainability by shifting the responsibility of visualizing EIP-712 payloads from the wallets to the protocols themselves. Consequently, wallets can use a consistent and effective approach to EIP-712 message visualization.&lt;&#x2F;p&gt;
&lt;p&gt;The adoption of a universal solution will not only streamline the efforts and reduce the maintenance burden for wallet providers, but it will also allow for faster and more extensive coverage across the ecosystem. This will ultimately result in users gaining a clearer understanding of the transactions they&#x27;re signing, leading to increased security and an improved overall user experience within the crypto space.&lt;&#x2F;p&gt;
&lt;p&gt;Currently, most of the wallets display something similar to image below&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6865&#x2F;.&#x2F;assets&#x2F;current-EIP-712-signature-wallet-interface.png&quot; alt=&quot;&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;With visualization we can achieve something similar to image below where more insightful details are revealed to user thanks to the structured data returned from the EIP&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6865&#x2F;.&#x2F;assets&#x2F;vision-EIP-712-signature-wallet-interface.png&quot; alt=&quot;&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;Contracts implementing this proposal MUST include the &lt;code&gt;visualizeEIP712Message&lt;&#x2F;code&gt; function in the  &lt;code&gt;verifyingContract&lt;&#x2F;code&gt; implementation so that wallets upon receiving a request to sign an EIP-712 message(&lt;code&gt;eth_signTypedData&lt;&#x2F;code&gt;) MAY call the function &lt;code&gt;visualizeEIP712Message&lt;&#x2F;code&gt; at the smart contract and chain specified in the EIP-712 message domain separator &lt;code&gt;verifyingContract&lt;&#x2F;code&gt; and &lt;code&gt;chainId&lt;&#x2F;code&gt; fields, respectively.&lt;&#x2F;p&gt;
&lt;p&gt;Wallets SHOULD ignore this proposal if the domain separator does not include the &lt;code&gt;verifyingContract&lt;&#x2F;code&gt; and &lt;code&gt;chainId&lt;&#x2F;code&gt; fields.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function processes an EIP-712 payload message and returns a structured data format emphasizing the potential impact on users&amp;#39; assets.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The function returns assetsOut (assets the user is offering), assetsIn (assets the user would receive), and liveness (validity duration of the EIP-712 message).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; encodedMessage&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ABI-encoded EIP-712 message (abi.encode(types, params)).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; domainHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The hash of the EIP-712 domain separator as defined in the EIP-712 proposal; see https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-712#definition-of-domainseparator.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Result&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; struct containing the user&amp;#39;s assets impact and message liveness.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; visualizeEIP712Message&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; encodedMessage&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; domainHash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Result&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;params&quot;&gt;Params&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;encodedMessage&lt;&#x2F;code&gt; is bytes that represents the encoded EIP-712  message with &lt;code&gt;abi.encode&lt;&#x2F;code&gt; and it can be decoded using &lt;code&gt;abi.decode&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;domainHash&lt;&#x2F;code&gt; is the bytes32 hash of the EIP-712 domain separator as defined in the EIP-712 proposal&lt;&#x2F;p&gt;
&lt;h3 id=&quot;outputs&quot;&gt;Outputs&lt;&#x2F;h3&gt;
&lt;p&gt;The function MUST return &lt;code&gt;Result&lt;&#x2F;code&gt;, a struct that contains information&#x27;s about user’s assets impact and the liveness of such a message if it gets signed.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Liveness&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span&gt; from&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UserAssetMovement&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span&gt; assetTokenAddress&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span&gt; id&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; amounts&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Result&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  UserAssetMovement&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; assetsIn&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  UserAssetMovement&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; assetsOut&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Liveness liveness&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;liveness&quot;&gt;&lt;code&gt;Liveness&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;Liveness&lt;&#x2F;code&gt; is a struct that defines the timestamps which the message is valid where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;from&lt;&#x2F;code&gt; is the starting timestamp.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;to&lt;&#x2F;code&gt; is the expiry timestamp&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;from&lt;&#x2F;code&gt; MUST be less than &lt;code&gt;to&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;userassetmovement&quot;&gt;&lt;code&gt;UserAssetMovement&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;UserAssetMovement&lt;&#x2F;code&gt; defines the user’s asset where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;assetTokenAddress&lt;&#x2F;code&gt; is the token (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt;) smart contract address where the zero address MUST represents the Native coin (Native ETH in the case of Ethereum network).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;id&lt;&#x2F;code&gt; is the NFT ID, this item MUST ignored if the asset is not an NFT
&lt;ul&gt;
&lt;li&gt;if token with &lt;code&gt;id&lt;&#x2F;code&gt; doesn’t exist in an NFT collection, this SHOULD be considered as any token within that collection&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;amounts&lt;&#x2F;code&gt; is an Array of &lt;code&gt;uint256&lt;&#x2F;code&gt; where items MUST define the amount per time curve, with time defined within liveness boundaries
&lt;ul&gt;
&lt;li&gt;the first amount in &lt;code&gt;amounts&lt;&#x2F;code&gt; Array (amounts[0]) MUST be the amount of the asset at &lt;code&gt;liveness.from&lt;&#x2F;code&gt; timestamp&lt;&#x2F;li&gt;
&lt;li&gt;the last amount in &lt;code&gt;amounts&lt;&#x2F;code&gt; Array (amounts[amounts.length-1]) MUST be the amount of the asset at &lt;code&gt;liveness.to&lt;&#x2F;code&gt; timestamp&lt;&#x2F;li&gt;
&lt;li&gt;in most of the cases, &lt;code&gt;amounts&lt;&#x2F;code&gt; will be an Array with a single item which is MUST be the minimum amount of the asset.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;assetsin&quot;&gt;&lt;code&gt;assetsIn&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;assetsIn&lt;&#x2F;code&gt; are the minimum assets which the user MUST get if the message is signed and fulfilled&lt;&#x2F;p&gt;
&lt;h4 id=&quot;assetsout&quot;&gt;&lt;code&gt;assetsOut&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;assetsOut&lt;&#x2F;code&gt; are the maximum assets which the user MUST offer if the message is signed and fulfilled&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;on-chain&quot;&gt;on-chain&lt;&#x2F;h3&gt;
&lt;p&gt;One might argue that certain processes can be done off-chain, which is true, but our experience building an off-chain TypeScript SDK to solve this matter revealed some issues:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Reliability: Protocols developers are the ones responsible for developing the protocol itself, thus crafting the visualization is much more accurate when done by them.&lt;&#x2F;li&gt;
&lt;li&gt;Scalability: Keeping up with the rapidly expanding ecosystem is hard. Wallets or 3rd party entities must keep an eye on each new protocol, understand it carefully (which poses the reliability issues mentioned above), and then only come up with an off-chain implementation.&lt;&#x2F;li&gt;
&lt;li&gt;Maintainability: Many protocols implement smart contracts in an upgradable manner. This causes the off-chain visualization to differ from the real protocol behaviors (if updated), making the solution itself unreliable and lacking the scalability to handle various protocols.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;domainhash&quot;&gt;&lt;code&gt;DomainHash&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;domainHash&lt;&#x2F;code&gt; is much needed by protocols to revert against unsupported versions of its EIP-712 implementation. It identifies the needed implementation in case the protocol implements various EIP-712 implementations (&lt;code&gt;name&lt;&#x2F;code&gt;) or to revert if the &lt;code&gt;domainHash&lt;&#x2F;code&gt; belongs to a different protocol.&lt;&#x2F;p&gt;
&lt;p&gt;In the future, if there is a registry that reroutes this EIP implementation for already deployed protocols that can&#x27;t upgrade the existing deployed smart contract, &lt;code&gt;domainHash&lt;&#x2F;code&gt; can be used to identify protocols.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;amounts-array&quot;&gt;Amounts Array&lt;&#x2F;h3&gt;
&lt;p&gt;We suggest using an array of amounts (uint256[]) instead of a single uint256 to cover auctions, which are common in NFT protocols.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;openSea Seaport NFT marketplace implementation example is available &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6865&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;SeaPortEIP712Visualizer.sol&quot;&gt;here&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;visualizeEIP712Message&lt;&#x2F;code&gt; function should be reliable and accurately represent the potential impact of the EIP-712 message on users&#x27; assets. Wallet providers and users must trust the protocol&#x27;s implementation of this function to provide accurate and up-to-date information.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;visualizeEIP712Message&lt;&#x2F;code&gt; function results should be treated based on the reputation of its &lt;code&gt;verifyingContract&lt;&#x2F;code&gt;, if the &lt;code&gt;verifyingContract&lt;&#x2F;code&gt; is trusted it means the &lt;code&gt;visualizeEIP712Message&lt;&#x2F;code&gt; function results are trusted as the this proposal implementation lives at the same address of &lt;code&gt;verifyingContract&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Automatically Reset Testnet</title>
        <published>2023-04-10T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Mário Havel</name><uri>https://github.com/taxmeifyoucan</uri>
	</author>
	
	<author>
		<name>pk910</name><uri>https://github.com/pk910</uri>
	</author>
	
	<author>
		<name>Rémy Roy</name><uri>https://github.com/remyroy</uri>
	</author>
	
	<author>
		<name>Holly Atkinson</name><uri>https://github.com/atkinsonholly</uri>
	</author>
	
	<author>
		<name>Tereza Burianova</name><uri>https://github.com/T-ess</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6916/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/automatically-reset-testnet/15825" />
        

        <id>https://wg-eips.ritovision.com/6916/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:6916"
            label="EIP-6916" />
        

        
        

        
        <summary type="html">A testnet network that periodically rolls back to genesis</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6916/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes a specification for an automatically reset testnet, a novel approach to testnets that can be implemented within Ethereum clients. It enables a single testing infrastructure consisting of ephemeral networks with deterministic parameters. Each network iteration is created by a specified function which deterministically generates genesis states.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;A testnet which automatically resets can provide an alternative environment for short-term testing of applications, validators and also breaking changes in client implementations. It avoids issues of long running testnets which suffer from state bloat, lack of testnet funds or consensus issues. Periodically resetting the network back to genesis cleans the validator set and returns funds back to faucets while keeping the network reasonably small for easy bootstrapping.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The testnet is set to always reset after a predefined time period. The reset means the generation of the next genesis, discarding the old one and starting a new network. This is possible by introducing functions for the genesis generation and the client reset.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;genesis&quot;&gt;Genesis&lt;&#x2F;h3&gt;
&lt;p&gt;To connect to the current instance of the network, the client must implement the genesis function. This function defines how the client stores information about the testnet and generates the current genesis. With each reset, the network starts from a new genesis which needs to be built based on given parameters and correspond in EL and CL clients.&lt;&#x2F;p&gt;
&lt;p&gt;The network always starts from a genesis which is deterministically created based on the original one - this very first genesis is hardcoded and we can call it &lt;code&gt;genesis 0&lt;&#x2F;code&gt;. Terminal time, the expiration of each genesis, is the addition of the start time of that genesis &lt;code&gt;MIN_GENESIS_TIME&lt;&#x2F;code&gt; and the testnet lifetime &lt;code&gt;period&lt;&#x2F;code&gt;, where &lt;code&gt;period&lt;&#x2F;code&gt; is a constant defining the length of time a single ephemeral network runs. Therefore, once the current slot timestamp reaches the terminal time of the ephemeral network, it has to switch to a new genesis. The main changes in each new genesis iteration are chainId, genesis time and the withdrawal credentials of the first validator.&lt;&#x2F;p&gt;
&lt;p&gt;Clients shall include a hardcoded &lt;code&gt;genesis 0&lt;&#x2F;code&gt; parameters, much like other networks predefined in clients. However, this genesis shall be used directly, only at the very beginning of the testnet&#x27;s existence, in its first iteration where &lt;code&gt;i&lt;&#x2F;code&gt; equals &lt;code&gt;0&lt;&#x2F;code&gt;. Later on, with iteration &lt;code&gt;i&lt;&#x2F;code&gt; equal to &lt;code&gt;1&lt;&#x2F;code&gt; and above, the client does not initialize this genesis but uses it to derive the current one. When &lt;code&gt;i&amp;gt;0&lt;&#x2F;code&gt;, given a known &lt;code&gt;period&lt;&#x2F;code&gt; and current slot timestamp, the client always calculates the number of lifecycle iterations from &lt;code&gt;genesis 0&lt;&#x2F;code&gt; and creates a new genesis with the latest parameters.&lt;&#x2F;p&gt;
&lt;p&gt;When the client starts with the option of an ephemeral testnet, it checks whether a genesis for the network is present. If it doesn&#x27;t exist or the current slot timestamp is older than &lt;code&gt;current_genesis.genesis_time + period&lt;&#x2F;code&gt;, it triggers the generation of a new genesis. This new genesis, derived from &lt;code&gt;genesis 0&lt;&#x2F;code&gt;, will be written to the database and used to run the current network.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;execution-client&quot;&gt;Execution client&lt;&#x2F;h4&gt;
&lt;p&gt;The EL client includes the hardcoded &lt;code&gt;genesis 0&lt;&#x2F;code&gt; serving as a preimage for generating the current one. Iteration of variables is done as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Number of iterations:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;i&lt;&#x2F;code&gt; = &lt;code&gt;int((current_slot_timestamp&lt;&#x2F;code&gt; - &lt;code&gt;genesis_0.genesis_time) &#x2F; period)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Genesis time of current genesis:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;current_genesis.genesis_time&lt;&#x2F;code&gt; = &lt;code&gt;period&lt;&#x2F;code&gt; * &lt;code&gt;i&lt;&#x2F;code&gt; + &lt;code&gt;genesis_0.genesis_time&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Current EL ChainId:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;chainId&lt;&#x2F;code&gt; = &lt;code&gt;genesis_0.chainId&lt;&#x2F;code&gt; + &lt;code&gt;i&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;consensus-client&quot;&gt;Consensus client&lt;&#x2F;h4&gt;
&lt;p&gt;Genesis generation in the CL client includes config with iterated values, similarly to EL, but also requires the updated genesis state. The state in SSZ format can be either generated by the client or downloaded from an external source. It includes validators with deposits ready to launch a merged network with the validator set created by trusted entities within the community.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;MIN_GENESIS_TIME&lt;&#x2F;code&gt; is set to the latest genesis time and defines when the current period starts. It is recommended to add a small &lt;code&gt;GENESIS_DELAY&lt;&#x2F;code&gt;, for example 15 minutes, to avoid issues while infrastructure is restarting with the new genesis.&lt;&#x2F;p&gt;
&lt;p&gt;To ensure a successful reset, &lt;code&gt;ForkDigest&lt;&#x2F;code&gt; needs to be unique for each iteration. In order to keep the &lt;code&gt;ForkVersions&lt;&#x2F;code&gt; of the network static for better tooling support, the withdrawal credentials of the first validator in the validator set need to be overridden by a calculated value.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;genesis.validators[0].withdrawal_credentials&lt;&#x2F;code&gt; = &lt;code&gt;0x0100000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;code&gt; + &lt;code&gt;i&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;genesis.genesis_validators_root&lt;&#x2F;code&gt; =  &lt;code&gt;hash_tree_root(genesis.validators)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The update of &lt;code&gt;genesis.validators[0]&lt;&#x2F;code&gt; changes the state, therefore, clients have to be able to generate or download the latest genesis state. Generating the genesis ssz is not considered a standard client feature and adding it enables to trustlessly create the latest genesis state at the price of certain complexity. An alternative solution is to obtain it from a third party, either by downloading the ssz file from a server or using the checkpoint sync feature with an endpoint serving the genesis state. This became an accepted practice with Holešky testnet and existing features of checkpoint sync can be used for obtaining genesis states for automatically reset testnets. It also allows maintainers to update the genesis validator set without requiring new client releases. The full implementation of the recommended practice for obtaining the latest CL state should behave as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;When the testnet flag is provided and client supports checkpoint sync of genesis, automatically use the hardcoded checkpoint endpoint to download the latest genesis state using the checkpoint sync feature
&lt;ul&gt;
&lt;li&gt;If user provides a custom checkpoint sync flag, override the default option and use the endpoint provided by user&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Include a backup download option pointing to an url with the latest testnet release, a publicly distributed ssz file, and trigger this option if the checkpoint state sync fails or make it the default if client doesn&#x27;t support genesis checkpoint sync&lt;&#x2F;li&gt;
&lt;li&gt;If the client includes a feature for generating the genesis or some of its parameters, use it to verify parameters in the downloaded state and issue an error if values or checksum don&#x27;t correspond&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;It&#x27;s important to note that &lt;code&gt;genesis_validators_root&lt;&#x2F;code&gt; is normally predefined in the client but in this case it&#x27;s not known in advance which can potentially break certain architectures. For example light clients which are relying on hardcoded &lt;code&gt;genesis_validators_root&lt;&#x2F;code&gt; won&#x27;t work.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;reset&quot;&gt;Reset&lt;&#x2F;h3&gt;
&lt;p&gt;The reset function defines an automatic process of throwing away the old data and starting with a new genesis. It depends on the previously defined function for genesis generation which the client must implement in order to be able to automatically follow the latest network iteration.&lt;&#x2F;p&gt;
&lt;p&gt;For the reset function, we can introduce the &lt;code&gt;terminal_timestamp&lt;&#x2F;code&gt; value which defines the network expiry time of an iteration. It can be the same as the genesis time of the next iteration (without the genesis delay) or can be calculated simply as &lt;code&gt;terminal_timestamp = current_genesis.genesis_time + period&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;When the network reaches a slot with a timestamp &lt;code&gt;&amp;gt;= terminal_timestamp&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Client stops accepting&#x2F;creating new blocks
&lt;ul&gt;
&lt;li&gt;Shutdown client services running the network, e.g. p2p communication, beacon service, execution environment&lt;&#x2F;li&gt;
&lt;li&gt;This feature should be implemented alongside Genesis even without further reset functions just to create a basic support which is always safe from forking&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Client calls a function which discards the current genesis, all chain or beacon data
&lt;ul&gt;
&lt;li&gt;Clients already include db tools including for purging the database which could be used here&lt;&#x2F;li&gt;
&lt;li&gt;It might be beneficial to include an additional flag, e.g. &lt;code&gt;--retain-ephemeral-data&lt;&#x2F;code&gt;, which would first export the existing data in a standard format before removing the database&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Client triggers the Genesis function (as defined above):
&lt;ul&gt;
&lt;li&gt;Behaves like a regular client startup when genesis is not present&lt;&#x2F;li&gt;
&lt;li&gt;New genesis is written into db and initialized&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Main network services are started again pointing to the updated genesis&lt;&#x2F;li&gt;
&lt;li&gt;After the new genesis time is reached, the network starts again from the new genesis&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;For a full reset implementation, clients should be able to perform the above actions without requiring manual restart, operating the network fully independently and with minimal downtime.&lt;&#x2F;p&gt;
&lt;p&gt;Note that depending on the client architecture, it may not be feasible to fully implement such an internal reset mechanism, e.g. if the client doesn&#x27;t support a graceful shutdown. The reset feature is considered an advanced level of support and is mainly needed by infrastructure providers and genesis validators. The assumption is that even if the client doesn&#x27;t implement reset, advanced users can achieve similar behavior with external scripts handling the client by system tools.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Ephemeral testnets with deterministic parameters provide a sustainable alternative to traditional testnets, with the same infrastructure. At each reset, the validator set is cleared, faucets are filled again and the database is kept small.&lt;&#x2F;p&gt;
&lt;p&gt;Upon reset the whole state is purged, which, on the one hand keeps the network small and easy to bootstrap but introduces problems for testing longer term &#x2F; advanced applications. However, basic contract infrastructure can be automatically deployed after each reset by any user. Generally, using the network is recommended for short term testing, deploying &lt;code&gt;Hello World&lt;&#x2F;code&gt; kinds of contracts that don&#x27;t need to stay forever on a long term testnet. However, there can be an offchain mechanism that automatically deploys standard contract primitives after each reset so application developers can also utilize the network more.&lt;&#x2F;p&gt;
&lt;p&gt;By defining two mechanisms for Genesis and Reset, this EIP enables two levels of how a client implementation can support the testnet;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Basic support requires the client to determine the current network specs and enables only connecting to the network.
&lt;ul&gt;
&lt;li&gt;This means support of the Genesis mechanism defined above&lt;&#x2F;li&gt;
&lt;li&gt;Enough to participate in the network for short term testing&lt;&#x2F;li&gt;
&lt;li&gt;To follow the latest iteration, the user has to manually shut down the client and delete the database&lt;&#x2F;li&gt;
&lt;li&gt;It&#x27;s still recommended to add a feature for terminating the network&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Full support enables the client to follow the reset process and always sync the latest chain iteration
&lt;ul&gt;
&lt;li&gt;This also requires the client to implement an inherent Reset feature&lt;&#x2F;li&gt;
&lt;li&gt;Needed for running persistent infrastructure, genesis validators and bootnodes&lt;&#x2F;li&gt;
&lt;li&gt;It might be more complex to implement due to client architecture of clients&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The design is also compatible with nodes managed by external tooling, i.e. even if the client doesn&#x27;t implement these features, it can run on the same network as other nodes which are automatically reset by scripts. Any client supporting a custom network can be used for the testnet.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;network-parameters&quot;&gt;Network parameters&lt;&#x2F;h3&gt;
&lt;p&gt;Constants and variables defining testnet properties are arbitrary but need to be crafted considering certain limitations and security properties set out below.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;reset-period&quot;&gt;Reset Period&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;period&lt;&#x2F;code&gt; is a constant, hardcoded in the client defining the period of time after which the network resets.&lt;&#x2F;p&gt;
&lt;p&gt;It can be defined based on users&#x27; needs but for security reasons, it also depends on the number of validators in genesis. Considering the time to activate a validator, the number of trusted validators should be high enough so the network cannot be overtaken by a malicious actor.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Genesis&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; Validators&lt;&#x2F;span&gt;&lt;span&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; Epochs&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; until&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; 66%&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; majority&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;10k&lt;&#x2F;span&gt;&lt;span&gt;  =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1289&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; Epochs&lt;&#x2F;span&gt;&lt;span&gt; (5,7&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; days&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;50k&lt;&#x2F;span&gt;&lt;span&gt;  =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 6441&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; Epochs&lt;&#x2F;span&gt;&lt;span&gt; (28,6&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; days&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;75k&lt;&#x2F;span&gt;&lt;span&gt;  =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 9660&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; Epochs&lt;&#x2F;span&gt;&lt;span&gt; (42,9&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; days&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;100k&lt;&#x2F;span&gt;&lt;span&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 12877&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; Epochs&lt;&#x2F;span&gt;&lt;span&gt; (57,2&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; days&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;150k&lt;&#x2F;span&gt;&lt;span&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 19323&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; Epochs&lt;&#x2F;span&gt;&lt;span&gt; (85,9&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; days&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;200k&lt;&#x2F;span&gt;&lt;span&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 25764&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; Epochs&lt;&#x2F;span&gt;&lt;span&gt; (114,5&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; days&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;chainid&quot;&gt;ChainId&lt;&#x2F;h4&gt;
&lt;p&gt;ChainId is a variable because it needs to keep changing with each new genesis to avoid replay attack. The function for the new ChainId value is a simple incrementation (+1). The ChainId in &lt;code&gt;genesis 0&lt;&#x2F;code&gt; is a hardcoded constant. This constant is used by the client with each new genesis to derive a new ChainId for that network iteration.&lt;&#x2F;p&gt;
&lt;p&gt;New ChainIds shouldn&#x27;t collide with any other existing public EVM chain even after many iterations. Consequently, low ChainId values are discouraged.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The network itself is providing a secure environment thanks to regular resets. Even if some sort of vulnerability is exploited, it will be cleared on the next reset. This is also a reason to keep periods relatively short (weeks&#x2F;months opposed to months&#x2F;years) with a big enough genesis validator set to keep an honest majority.&lt;&#x2F;p&gt;
&lt;p&gt;Changes in clients caused by the implementation of features for resetting networks need to be reviewed together with standard security procedures. Especially the mechanism for triggering reset which must be separated from other networks that are not configured as ephemeral.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Upgradable Fungible Token</title>
        <published>2023-04-05T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Jeff Huang</name><uri>https://github.com/jeffishjeff</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6864/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6864-upgradable-fungible-token-a-simple-extension-to-erc-20/13781" />
        

        <id>https://wg-eips.ritovision.com/6864/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:6864"
            label="ERC-6864" />
        

        
        

        
        <summary type="html">Upgradable fungible token, a simple extension to ERC-20</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6864/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal outlines a smart contract interface for upgrading&#x2F;downgrading existing &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; smart contracts while maintaining user balances. The interface itself is an extension to the ERC-20 standard so that other smart contracts can continue to interact with the upgraded smart contract without changing anything other than the address.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;By design, smart contracts are immutable and token standards like ERC-20 are minimalistic. While these design principles are fundamental in decentalized applications, there are sensible and practical situations where the ability to upgrade an ERC-20 token is desirable, such as:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;to address bugs and remove limitations&lt;&#x2F;li&gt;
&lt;li&gt;to adopt new features and standards&lt;&#x2F;li&gt;
&lt;li&gt;to comply w&#x2F; changing regulations&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Proxy pattern using &lt;code&gt;delegatecall&lt;&#x2F;code&gt; opcode offers a reasonable, generalized solution to reconcile the immutability and upgradability features but has its own shortcomings:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;the smart contracts must support proxy pattern from the get go, i.e. it cannot be used on contracts that were not deployed with proxies&lt;&#x2F;li&gt;
&lt;li&gt;upgrades are silent and irreversible, i.e. users do not have the option to opt-out&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In contrast, by reducing the scope to specifically ERC-20 tokens, this proposal standardizes an ERC-20 extension that works with any existing or future ERC-20 smart contracts, is much simpler to implement and to maintain, can be reversed or nested, and offers a double confirmation opportunity for any and all users to explicitly opt-in on the upgrade.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4931&#x2F;&quot;&gt;ERC-4931&lt;&#x2F;a&gt; attepts to address the same problem by introducing a third &quot;bridge&quot; contract to help facilitate the upgrade&#x2F;downgrade operations. While this design decouples upgrade&#x2F;downgrade logic from token logic, ERC-4931 would require tokens to be pre-minted at the destination smart contract and owned by the bridge contrtact rather then just-in-time when upgrade is invoked. It also would not be able to support upgrade-while-transfer and see-through functions as described below.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Upgradable Fungible Token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-6864&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6864&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC20&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST be emitted when tokens are upgraded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Previous owner of base ERC-20 tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; New owner of ERC-6864 tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount that is upgraded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Upgrade&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST be emitted when tokens are downgraded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Previous owner of ERC-6864 tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; New owner of base ERC-20 tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount that is downgraded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Downgrade&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Upgrade `amount` of base ERC-20 tokens owned by `msg.sender` to ERC-6864 tokens under `to`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `msg.sender` must directly own sufficient base ERC-20 tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;      MUST revert if `to` is the zero address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;      MUST revert if `msg.sender` does not directly own `amount` or more of base ERC-20 tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to receive ERC-6864 tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of base ERC-20 tokens to upgrade&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; upgrade&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Downgrade `amount` of ERC-6864 tokens owned by `from` to base ERC-20 tokens under `to`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `msg.sender` must either directly own or be approved to spend sufficient ERC-6864 tokens for `from`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;      MUST revert if `to` is the zero address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;      MUST revert if `from` does not directly own `amount` or more of ERC-6864 tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;      MUST revret if `msg.sender` is not `from` and is not approved to spend `amount` or more of ERC-6864 tokens for `from`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to release ERC-6864 tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to receive base ERC-20 tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of ERC-6864 tokens to downgrade&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; downgrade&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the base ERC-20 smart contract address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address of the base ERC-20 smart contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; baseToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;see-through-extension&quot;&gt;See-through Extension&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;strong&gt;see-through extension&lt;&#x2F;strong&gt; is OPTIONAL. It allows for easy viewing of combined states between this &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6864&#x2F;&quot;&gt;ERC-6864&lt;&#x2F;a&gt; and base ERC-20 smart contracts.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6864SeeThrough&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6864&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the combined total token supply between this ERC-6864 and base ERC-20 smart contracts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; combined total token supply&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; combinedTotalSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the combined token balance of `account` between this ERC-6864 and base ERC-20 smart contracts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address that owns the tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; combined token balance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; combinedBalanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the combined allowance that `spender` is allowed to spend for `owner` between this ERC-6864 and base ERC-20 smart contracts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address that owns the tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address that is approve to spend the tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; combined spending allowance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; combinedAllowance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;extending-erc-20-standard&quot;&gt;Extending ERC-20 standard&lt;&#x2F;h3&gt;
&lt;p&gt;The goal of this proposal is to upgrade without affecting user balances, therefore leveraging existing data structure and methods is the path of the least engineering efforts as well as the most interoperability.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;supporting-downgrade&quot;&gt;Supporting downgrade&lt;&#x2F;h3&gt;
&lt;p&gt;The ability to downgrade makes moving between multiple IERC-6864 implementations on the same base ERC-20 smart contract possible. It also allows a way out should bugs or limitations discovered on ERC-6864 smart contract, or the user simply changes his or her mind.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;optional-see-through-extension&quot;&gt;Optional see-through extension&lt;&#x2F;h3&gt;
&lt;p&gt;While these functions are useful in many situations, they are trivial to implement and results can be calculated via other public functions, hence the decision to include them in an optional extension rather than the core interface.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;ERC-6864 is generally compatible with the ERC-20 standard. The only caveat is that some smart contracts may opt to implement &lt;code&gt;transfer&lt;&#x2F;code&gt; to work with the entire combined balance (this reduces user friction, see reference implementation) rather than the standard &lt;code&gt;balanceOf&lt;&#x2F;code&gt; amount. In this case it is RECOMMENDED that such contract to implement &lt;code&gt;totalSupply&lt;&#x2F;code&gt; and &lt;code&gt;balanceOf&lt;&#x2F;code&gt; to return combined amount between this ERC-6864 and base ERC-20 smart contracts&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC20&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC20&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin-contracts&#x2F;token&#x2F;ERC20&#x2F;ERC20.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC6864&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6864&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC20&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  IERC20 &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; immutable&lt;&#x2F;span&gt;&lt;span&gt; s_baseToken&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; symbol&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; baseToken_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;name, symbol) &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        s_baseToken &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;baseToken_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; baseToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;s_baseToken&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; upgrade&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; from &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _msgSender&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        s_baseToken&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Upgrade&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; downgrade&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; spender &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _msgSender&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;from &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            _spendAllowance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _burn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        s_baseToken&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Downgrade&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; from &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _msgSender&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; balance &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;balance &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            upgrade&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt; balance&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;totalSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; s_baseToken&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;totalSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; s_baseToken&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; s_baseToken&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;User who opts to upgrade base ERC-20 tokens must first &lt;code&gt;approve&lt;&#x2F;code&gt; the ERC-6864 smart contract to spend them. Therefore it&#x27;s the user&#x27;s responsibility to verify that the ERC-6864 smart contract is sound and secure, and the amount that he or she is approving is approperiate. This represents the same security considerations as with any &lt;code&gt;approve&lt;&#x2F;code&gt; operation.&lt;&#x2F;li&gt;
&lt;li&gt;The ERC-6864 smart contract may implement any conversion function for upgrade&#x2F;downgrade as approperiate: 1-to-1, linear, non-linear. In the case of a non-linear conversion function, &lt;code&gt;upgrade&lt;&#x2F;code&gt; and &lt;code&gt;downgrade&lt;&#x2F;code&gt; may be vulnerable for front running or sandwich attacks (whether or not to the attacker&#x27;s benefit). This represents the same security considerations as with any automated market maker (AMM) that uses a similar non-linear curve for conversion.&lt;&#x2F;li&gt;
&lt;li&gt;The ERC-6864 smart contract may ask user to approve unlimited allowance and&#x2F;or attempt to automatically upgrade during &lt;code&gt;transfer&lt;&#x2F;code&gt; (see reference implementation). This removes the chance for user to triple confirm his or her intension to upgrade (&lt;code&gt;approve&lt;&#x2F;code&gt; being the double confirmation).&lt;&#x2F;li&gt;
&lt;li&gt;Multiple IERC-6864 implementations can be applied to the same base ERC-20 token, and ERC-6864 smart contracts can be nested. This would increase token complexity and may cause existing dashboards to report incorrect or inconsistent results.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Support ENS Name for Web3 URL</title>
        <published>2023-04-02T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Qi Zhou</name><uri>https://github.com/qizhou</uri>
	</author>
	
	<author>
		<name>Qiang Zhu</name><uri>https://github.com/qzhodl</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6821/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6821-support-ens-name-for-web3-url/13654" />
        

        <id>https://wg-eips.ritovision.com/6821/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:6821"
            label="ERC-6821" />
        

        
        

        
        <summary type="html">A mapping from an ENS name to the contract address in Web3 URL</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6821/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard defines the mapping from an Ethereum name service (ENS) name to an Ethereum address for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4804&#x2F;&quot;&gt;ERC-4804&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;ERC-4804 defines a &lt;code&gt;web3:&#x2F;&#x2F;&lt;&#x2F;code&gt;-scheme RFC 2396 URI to call a smart contract either by its address or a &lt;strong&gt;name&lt;&#x2F;strong&gt; from name service.  If a &lt;strong&gt;name&lt;&#x2F;strong&gt; is specified, the standard specifies a way to resolve the contract address from the name.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Given &lt;strong&gt;contractName&lt;&#x2F;strong&gt; and &lt;strong&gt;chainid&lt;&#x2F;strong&gt; from a &lt;code&gt;web3:&#x2F;&#x2F;&lt;&#x2F;code&gt; URI defined in ERC-4804, the protocol will find the address of the contract using the following steps:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Find the &lt;code&gt;contentcontract&lt;&#x2F;code&gt; text record on ENS resolver on chain &lt;strong&gt;chainid&lt;&#x2F;strong&gt;.  Return an error if the chain does not have ENS or the record is an invalid ETH address.&lt;&#x2F;li&gt;
&lt;li&gt;If the &lt;code&gt;contentcontract&lt;&#x2F;code&gt; text record does not exist, the protocol will use the resolved address of &lt;strong&gt;name&lt;&#x2F;strong&gt; from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;137&#x2F;#contract-address-interface&quot;&gt;ERC-137&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If the resolved address of &lt;strong&gt;name&lt;&#x2F;strong&gt; is the zero address, then return an &quot;address not found&quot; error.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Note that &lt;code&gt;contentcontract&lt;&#x2F;code&gt; text record may return an Ethereum address in hexadecimal with a &lt;code&gt;0x&lt;&#x2F;code&gt; prefix or an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3770&#x2F;&quot;&gt;ERC-3770&lt;&#x2F;a&gt; chain-specific address.  If the address is an ERC-3770 chain-specific address, then the &lt;strong&gt;chainid&lt;&#x2F;strong&gt; to call the message will be overridden by the &lt;strong&gt;chainid&lt;&#x2F;strong&gt; specified by the ERC-3770 address.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The standard uses &lt;code&gt;contentcontract&lt;&#x2F;code&gt; text record with ERC-3770 chain-specific address instead of &lt;code&gt;contenthash&lt;&#x2F;code&gt; so that the record is human-readable - a design principle of ERC-4804.  Further, we can use the text record to add additional fields such as time to live (TTL).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;No security considerations were found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Ex Post Facto Cascading Revert</title>
        <published>2023-04-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>William Morriss</name><uri>https://github.com/wjmelements</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6810/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6810-ex-post-facto-cascading-revert/13630" />
        

        <id>https://wg-eips.ritovision.com/6810/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:6810"
            label="EIP-6810" />
        

        
        

        
        <summary type="html">Allow transactions to be reversed after confirmation</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6810/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;A new transaction type reverts one of a sender&#x27;s prior transactions, and other transactions dependent on that state, recursively.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;While Ethereum has the capability of reversible transactions through smart contracts, instant settlement is the default.
But sometimes users make mistakes.
Most mistakes are discovered quickly.
However, once the transaction is confirmed, it is settled.
There are many use cases for reverting settled transactions.
Some of the most-common mistakes are listed below.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Wrong recipient&lt;&#x2F;li&gt;
&lt;li&gt;Unintended consequences&lt;&#x2F;li&gt;
&lt;li&gt;Got scammed&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This feature addresses these issues and more, ending all regret.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;p&gt;A new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; transaction is introduced with &lt;code&gt;TransactionType&lt;&#x2F;code&gt; &lt;code&gt;0x5a&lt;&#x2F;code&gt;.
The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; &lt;code&gt;TransactionPayload&lt;&#x2F;code&gt; for this transaction is &lt;code&gt;rlp([chainId, nonce, revertNonce, budget, signatureYParity, signatureR, signatureS])&lt;&#x2F;code&gt;.
The &lt;code&gt;signatureYParity, signatureR, signatureS&lt;&#x2F;code&gt; elements of this transaction represent a secp256k1 signature over &lt;code&gt;keccak256(0x5a || rlp([chainId, nonce, revertNonce, budget]))&lt;&#x2F;code&gt;.
The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; &lt;code&gt;ReceiptPayload&lt;&#x2F;code&gt; for this transaction is &lt;code&gt;rlp([status, budgetUsed, removedLogsBloom, [newReceiptPayloads]])&lt;&#x2F;code&gt;, where &lt;code&gt;newReceiptPayloads&lt;&#x2F;code&gt; is a sequential array of the updated receipts of all reverted transactions.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;block-gas-limit&quot;&gt;Block gas limit&lt;&#x2F;h3&gt;
&lt;p&gt;A transaction of type &lt;code&gt;0x5a&lt;&#x2F;code&gt; shall be the only transaction in its block.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;cascading-revert-operation&quot;&gt;Cascading revert operation&lt;&#x2F;h3&gt;
&lt;p&gt;A transaction fee budget is initialized to the value specified by &lt;code&gt;budget&lt;&#x2F;code&gt;, denominated in ether.
This budget is the transaction fee for this type of transaction.
Reverted transaction fees are refunded from this budget.
Should the budget be insufficient, the Ex Post Facto Cascading Revert transaction fails and the entire budget is paid to the &lt;code&gt;COINBASE&lt;&#x2F;code&gt; specified in the block header.
Otherwise, the remainder of the budget after all transactions are reverted is paid to the &lt;code&gt;COINBASE&lt;&#x2F;code&gt; account.&lt;&#x2F;p&gt;
&lt;p&gt;The state is rolled back to the start of the transaction specified by &lt;code&gt;revertNonce&lt;&#x2F;code&gt;.
An access list is initialized empty.
Any state previously modified by a reverted transaction is added to the access list.
Any subsequent transaction reading or using state included in the access list must also be reverted.
This operation cascades forward until the current block.&lt;&#x2F;p&gt;
&lt;p&gt;State includes:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;ether balance&lt;&#x2F;li&gt;
&lt;li&gt;contract code&lt;&#x2F;li&gt;
&lt;li&gt;account nonce&lt;&#x2F;li&gt;
&lt;li&gt;storage keys&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;snap-sync&quot;&gt;Snap sync&lt;&#x2F;h3&gt;
&lt;p&gt;Due to the large amount of state that may be modified by such a transaction, slower clients should use snap sync to load the new state.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The transaction must fill the entire block to prevent MEV attacks.&lt;&#x2F;p&gt;
&lt;p&gt;While some cascading reverts are highly consequential, others are considerably simpler.
The budget ensures the full network cost of the operation is paid.
For example, reversing a token transfer to the wrong recipient would be relatively cheap.
On the other hand, it would be prohibitively expensive to revert all deposits to a custodial exchange.&lt;&#x2F;p&gt;
&lt;p&gt;Transaction fees must be refunded from this budget rather than the prior block reward in order to protect the security of the consensus protocol.&lt;&#x2F;p&gt;
&lt;p&gt;Snap sync should be safe because if the state root is invalid then the block producer could get slashed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;If we find any backwards compatibility issue we can maybe reverse those transactions.
If that doesn&#x27;t work idk maybe need another hard fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Reverting a transaction that ever funded an account reverts all of that account&#x27;s subsequent transactions.&lt;&#x2F;li&gt;
&lt;li&gt;Reverting the transaction that deploys a contract reverts all transactions interacting with that contract.&lt;&#x2F;li&gt;
&lt;li&gt;Reverting a transfer to a new account does not revert other transactions.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Seems simple enough.
TODO this later; should only take a few hours, tops.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This specification has been audited by Illinois Senator Robert Peters.
No exploits were found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>To The Moon—10 Minute Blocks</title>
        <published>2023-04-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Pandapip1</name><uri>https://github.com/Pandapip1</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6811/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/ethereum-to-the-moon/13633" />
        

        <id>https://wg-eips.ritovision.com/6811/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:6811"
            label="EIP-6811" />
        

        
        

        
        <summary type="html">Increases the block time to facilitate finality over cosmic distances</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6811/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP makes a minimal number of changes to allow Ethereum to be used on the moon and other potentially habitable bodies in Earth&#x27;s solar system. It changes the time between blocks, the per-block validator reward, and the number of blocks per epoch.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;It is impossible for today&#x27;s Ethereum to literally &quot;go to the moon&quot; due to a limitation in the protocol: the block length. Should validators attempt to validate on the surface of the moon, they would find that the ~1.25 second communication delay (caused by the speed of light) might cause issues with synchronization, considering the 12-second timer between blocks. The validators would eventually be ejected on the terrestrial chain after leaking. If however a substantial number of validators are displaced (think 1&#x2F;3), they might follow their own fork and would eventually eject the terrestrial to finalize their own chain.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The time between blocks MUST be changed from 12 seconds to 600 seconds (10 minutes).&lt;&#x2F;li&gt;
&lt;li&gt;The per-block validator reward MUST be multiplied by 50&lt;&#x2F;li&gt;
&lt;li&gt;The number of blocks per epoch MUST be reduced from 4 to 2&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;The block gas limit is multiplied by fifty to compensate for the time between blocks being multiplied by fifty.&lt;&#x2F;li&gt;
&lt;li&gt;The per-block validator reward is also multiplied by fifty to compensate for the time between blocks being multiplied by fifty.&lt;&#x2F;li&gt;
&lt;li&gt;Epochs are changed to be 2 blocks long so that finality can be reached in a reasonable amount of time.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Many applications expect mainnet transactions to be included in a short amount of time. This would clearly no longer be the case. Such applications should switch to planetary rollups. Syncing rollups across heavenly bodies is outside the scope of this proposal.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TODO.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Definitely needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Fungible Key Bound Token</title>
        <published>2023-03-31T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Mihai Onila</name><uri>https://github.com/MihaiORO</uri>
	</author>
	
	<author>
		<name>Nick Zeman</name><uri>https://github.com/NickZCZ</uri>
	</author>
	
	<author>
		<name>Narcis Cotaie</name><uri>https://github.com/NarcisCRO</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6808/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/fungible-key-bound-token-kbt/13624" />
        

        <id>https://wg-eips.ritovision.com/6808/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:6808"
            label="ERC-6808" />
        

        
        

        
        <summary type="html">An interface for Fungible Key Bound Tokens, also known as a FKBT.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6808/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;A standard interface for Fungible Key Bound Tokens (&lt;strong&gt;FKBT&#x2F;s&lt;&#x2F;strong&gt;), a subset of the more general Key Bound Tokens (&lt;strong&gt;KBT&#x2F;s&lt;&#x2F;strong&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;The following standardizes an API for tokens within smart contracts and provides basic functionality to the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6808&#x2F;#addbindings-function&quot;&gt;addBindings&lt;&#x2F;a&gt; function. This function designates &lt;strong&gt;Key Wallets&lt;&#x2F;strong&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-1-1&quot;&gt;&lt;a href=&quot;#fn-1&quot;&gt;1&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;, which are responsible for conducting a &lt;strong&gt;Safe Transfer&lt;&#x2F;strong&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-2-1&quot;&gt;&lt;a href=&quot;#fn-2&quot;&gt;2&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;. During this process, &lt;strong&gt;FKBT&#x27;s&lt;&#x2F;strong&gt; are safely approved so they can be spent by the user or an on-chain third-party entity.&lt;&#x2F;p&gt;
&lt;p&gt;The premise of &lt;strong&gt;FKBT&#x27;s&lt;&#x2F;strong&gt; is to provide fully optional security features built directly into the fungible asset, via the concept of &lt;em&gt;allow&lt;&#x2F;em&gt; found in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6808&#x2F;#allowtransfer-function&quot;&gt;allowTransfer&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6808&#x2F;#allowapproval-function&quot;&gt;allowApproval&lt;&#x2F;a&gt; functions. These functions are called by one of the &lt;strong&gt;Key Wallets&lt;&#x2F;strong&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-1-2&quot;&gt;&lt;a href=&quot;#fn-1&quot;&gt;1&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; and &lt;em&gt;allow&lt;&#x2F;em&gt; the &lt;strong&gt;Holding Wallet&lt;&#x2F;strong&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-3-1&quot;&gt;&lt;a href=&quot;#fn-3&quot;&gt;3&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; to either call the already familiar &lt;code&gt;transfer&lt;&#x2F;code&gt; and &lt;code&gt;approve&lt;&#x2F;code&gt; function found in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;. Responsibility for the &lt;strong&gt;FKBT&lt;&#x2F;strong&gt; is therefore split. The &lt;strong&gt;Holding Wallet&lt;&#x2F;strong&gt; contains the asset and &lt;strong&gt;Key Wallets&lt;&#x2F;strong&gt; have authority over how the assets can be spent or approved. &lt;strong&gt;Default Behaviors&lt;&#x2F;strong&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-4-1&quot;&gt;&lt;a href=&quot;#fn-4&quot;&gt;4&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; of a traditional fungible ERC-20 can be achieved by simply never using the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6808&#x2F;#addbindings-function&quot;&gt;addBindings&lt;&#x2F;a&gt; function.&lt;&#x2F;p&gt;
&lt;p&gt;We considered &lt;strong&gt;FKBTs&lt;&#x2F;strong&gt; being used by every individual who wishes to add additional security to their fungible assets, as well as consignment to third-party wallets&#x2F;brokers&#x2F;banks&#x2F;insurers. &lt;strong&gt;FKBTs&lt;&#x2F;strong&gt; are resilient to attacks&#x2F;thefts, by providing additional protection to the asset itself on a self-custodial level.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;In this fast-paced technologically advancing world, people learn and mature at different speeds. The goal of global adoption must take into consideration the target demographic is of all ages and backgrounds. Unfortunately for self-custodial assets, one of the greatest pros is also one of its greatest cons. The individual is solely responsible for their actions and adequately securing their assets. If a mistake is made leading to a loss of funds, no one is able to guarantee their return.&lt;&#x2F;p&gt;
&lt;p&gt;From January 2021 through March 2022, the United States Federal Trade Commission received more than 46,000&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-5-1&quot;&gt;&lt;a href=&quot;#fn-5&quot;&gt;5&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; crypto scam reports. This directly impacted crypto users and resulted in a net consumer loss exceeding $1 Billion&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-6-1&quot;&gt;&lt;a href=&quot;#fn-6&quot;&gt;6&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;. Theft and malicious scams are an issue in any financial sector and oftentimes lead to stricter regulation. However, government-imposed regulation goes against one of this space’s core values. Efforts have been made to increase security within the space through centralized and decentralized means. Up until now, no one has offered a solution that holds onto the advantages of both whilst eliminating their disadvantages.&lt;&#x2F;p&gt;
&lt;p&gt;We asked ourselves the same question as many have in the past, “How does one protect the wallet?”. After a while, realizing the question that should be asked is “How does one protect the asset?”. Creating the wallet is free, the asset is what has value and is worth protecting. This question led to the development of &lt;strong&gt;KBT&#x27;s&lt;&#x2F;strong&gt;. A solution that is fully optional and can be tailored so far as the user is concerned. Individual assets remain protected even if the seed phrase or private key is publicly released, as long as the security feature was activated.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;FKBTs&lt;&#x2F;strong&gt; saw the need to improve on the widely used fungible ERC-20 token standard. The security of fungible assets is a topic that concerns every entity in the crypto space, as their current and future use cases are continuously explored. &lt;strong&gt;FKBTs&lt;&#x2F;strong&gt; provide a scalable decentralized security solution that takes security one step beyond wallet security, focusing on the token&#x27;s ability to remain secure. The security is on the blockchain itself, which allows every demographic that has access to the internet to secure their assets without the need for current hardware or centralized solutions. Made to be a promising alternative, &lt;strong&gt;FKBTs&lt;&#x2F;strong&gt; inherit all the characteristics of an ERC-20. This was done so &lt;strong&gt;FKBTs&lt;&#x2F;strong&gt; could be used on every dApp that is configured to use traditional fungible tokens.&lt;&#x2F;p&gt;
&lt;p&gt;During the development process, the potential advantages &lt;strong&gt;KBT&#x27;s&lt;&#x2F;strong&gt; explored were the main motivation factors leading to their creation;&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Completely Decentralized:&lt;&#x2F;strong&gt; The security features are fully decentralized meaning no third-party will have access to user funds when activated. This was done to truly stay in line with the premise of self-custodial assets, responsibility and values.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Limitless Scalability:&lt;&#x2F;strong&gt; Centralized solutions require the creation of an account and their availability may be restricted based on location. &lt;strong&gt;FKBT&#x27;s&lt;&#x2F;strong&gt; do not face regional restrictions or account creation. Decentralized security solutions such as hardware options face scalability issues requiring transport logistics, secure shipping and vendor. &lt;strong&gt;FKBT&#x27;s&lt;&#x2F;strong&gt; can be used anywhere around the world by anyone who so wishes, provided they have access to the internet.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Fully Optional Security:&lt;&#x2F;strong&gt; Security features are optional, customizable and removable. It’s completely up to the user to decide the level of security they would like when using &lt;strong&gt;FKBT&#x27;s&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Default Functionality:&lt;&#x2F;strong&gt; If the user would like to use &lt;strong&gt;FKBT&#x27;s&lt;&#x2F;strong&gt; as a traditional ERC-20, the security features do not have to be activated. As the token inherits all of the same characteristics, it results in the token acting with traditional fungible &lt;strong&gt;Default Behaviors&lt;&#x2F;strong&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-4-2&quot;&gt;&lt;a href=&quot;#fn-4&quot;&gt;4&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;. However, even when the security features are activated, the user will still have the ability to customize the functionality of the various features based on their desired outcome. The user can pass a set of custom and or &lt;strong&gt;Default Values&lt;&#x2F;strong&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-7-1&quot;&gt;&lt;a href=&quot;#fn-7&quot;&gt;7&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; manually or through a dApp.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Unmatched Security:&lt;&#x2F;strong&gt; By calling the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6808&#x2F;#addbindings-function&quot;&gt;addBindings&lt;&#x2F;a&gt; function a &lt;strong&gt;Key Wallet&lt;&#x2F;strong&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-1-3&quot;&gt;&lt;a href=&quot;#fn-1&quot;&gt;1&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; is now required for the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6808&#x2F;#allowtransfer-function&quot;&gt;allowTransfer&lt;&#x2F;a&gt; or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6808&#x2F;#allowapproval-function&quot;&gt;allowApproval&lt;&#x2F;a&gt; function. The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6808&#x2F;#allowtransfer-function&quot;&gt;allowTransfer&lt;&#x2F;a&gt; function requires 4 parameters, &lt;code&gt;_amount&lt;&#x2F;code&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-8-1&quot;&gt;&lt;a href=&quot;#fn-8&quot;&gt;8&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;, &lt;code&gt;_time&lt;&#x2F;code&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-9-1&quot;&gt;&lt;a href=&quot;#fn-9&quot;&gt;9&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;, &lt;code&gt;_address&lt;&#x2F;code&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-10-1&quot;&gt;&lt;a href=&quot;#fn-10&quot;&gt;10&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;, and &lt;code&gt;_allFunds&lt;&#x2F;code&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-11-1&quot;&gt;&lt;a href=&quot;#fn-11&quot;&gt;11&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;, where as the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6808&#x2F;#allowapproval-function&quot;&gt;allowApproval&lt;&#x2F;a&gt; function has 2 parameters, &lt;code&gt;_time&lt;&#x2F;code&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-12-1&quot;&gt;&lt;a href=&quot;#fn-12&quot;&gt;12&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; and &lt;code&gt;_numberOfTransfers&lt;&#x2F;code&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-13-1&quot;&gt;&lt;a href=&quot;#fn-13&quot;&gt;13&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;. In addition to this, &lt;strong&gt;FKBT&#x27;s&lt;&#x2F;strong&gt; have a &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6808&#x2F;#safefallback-function&quot;&gt;safeFallback&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6808&#x2F;#resetbindings-function&quot;&gt;resetBindings&lt;&#x2F;a&gt; function. The combination of all these prevent and virtually cover every single point of failure that is present with a traditional ERC-20, when properly used.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Security Fail-Safes:&lt;&#x2F;strong&gt; With &lt;strong&gt;FKBTs&lt;&#x2F;strong&gt;, users can be confident that their tokens are safe and secure, even if the &lt;strong&gt;Holding Wallet&lt;&#x2F;strong&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-3-2&quot;&gt;&lt;a href=&quot;#fn-3&quot;&gt;3&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; or one of the &lt;strong&gt;Key Wallets&lt;&#x2F;strong&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-1-4&quot;&gt;&lt;a href=&quot;#fn-1&quot;&gt;1&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; has been compromised. If the owner suspects that the &lt;strong&gt;Holding Wallet&lt;&#x2F;strong&gt; has been compromised or lost access, they can call the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6808&#x2F;#safefallback-function&quot;&gt;safeFallback&lt;&#x2F;a&gt; function from one of the &lt;strong&gt;Key Wallets&lt;&#x2F;strong&gt;. This moves the assets to the other &lt;strong&gt;Key Wallet&lt;&#x2F;strong&gt; preventing a single point of failure. If the owner suspects that one of the &lt;strong&gt;Key Wallets&lt;&#x2F;strong&gt; has been comprised or lost access, the owner can call the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6808&#x2F;#resetbindings-function&quot;&gt;resetBindings&lt;&#x2F;a&gt; function from &lt;code&gt;_keyWallet1&lt;&#x2F;code&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-15-1&quot;&gt;&lt;a href=&quot;#fn-15&quot;&gt;14&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; or &lt;code&gt;_keyWallet2&lt;&#x2F;code&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-16-1&quot;&gt;&lt;a href=&quot;#fn-16&quot;&gt;15&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;. This resets the &lt;strong&gt;FKBT&#x27;s&lt;&#x2F;strong&gt; security feature and allows the &lt;strong&gt;Holding Wallet&lt;&#x2F;strong&gt; to call the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6808&#x2F;#addbindings-function&quot;&gt;addBindings&lt;&#x2F;a&gt; function again. New &lt;strong&gt;Key Wallets&lt;&#x2F;strong&gt; can therefore be added and a single point of failure can be prevented.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Anonymous Security:&lt;&#x2F;strong&gt; Frequently, centralized solutions ask for personal information that is stored and subject to prying eyes. Purchasing decentralized hardware solutions are susceptible to the same issues e.g. a shipping address, payment information, or a camera recording during a physical cash pick-up. This may be considered by some as infringing on their privacy and asset anonymity. &lt;strong&gt;FKBT&#x27;s&lt;&#x2F;strong&gt; ensure user confidentially as everything can be done remotely under a pseudonym on the blockchain.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Low-Cost Security:&lt;&#x2F;strong&gt; The cost of using &lt;strong&gt;FKBT&#x27;s&lt;&#x2F;strong&gt; security features correlate to on-chain fees, the current &lt;em&gt;GWEI&lt;&#x2F;em&gt; at the given time. As a standalone solution, they are a viable cost-effective security measure feasible to the majority of the population.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Environmentally Friendly:&lt;&#x2F;strong&gt; Since the security features are coded into the &lt;strong&gt;FKBT&lt;&#x2F;strong&gt;, there is no need for centralized servers, shipping, or the production of physical object&#x2F;s. Thus leading to a minimal carbon footprint by the use of &lt;strong&gt;FKBT&#x27;s&lt;&#x2F;strong&gt;, working hand in hand with Ethereum’s change to a &lt;em&gt;PoS&lt;&#x2F;em&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-14-1&quot;&gt;&lt;a href=&quot;#fn-14&quot;&gt;16&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; network.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;User Experience:&lt;&#x2F;strong&gt; The security feature can be activated by a simple call to the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6808&#x2F;#addbindings-function&quot;&gt;addBindings&lt;&#x2F;a&gt; function. The user will only need two other wallets, which will act as &lt;code&gt;_keyWallet1&lt;&#x2F;code&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-15-2&quot;&gt;&lt;a href=&quot;#fn-15&quot;&gt;14&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; and &lt;code&gt;_keyWallet2&lt;&#x2F;code&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-16-2&quot;&gt;&lt;a href=&quot;#fn-16&quot;&gt;15&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;, to gain access to all of the benefits &lt;strong&gt;FKBT&#x27;s&lt;&#x2F;strong&gt; offer. The optional security features improve the overall user experience and Ethereum ecosystem by ensuring a safety net for those who decide to use it. Those that do not use the security features are not hindered in any way. This safety net can increase global adoption as people can remain confident in the security of their assets, even in the scenario of a compromised wallet.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;ikbt20-token-contract&quot;&gt;&lt;code&gt;IKBT20&lt;&#x2F;code&gt; (Token Contract)&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;NOTES&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The following specifications use syntax from Solidity &lt;code&gt;0.8.0&lt;&#x2F;code&gt; (or above)&lt;&#x2F;li&gt;
&lt;li&gt;Callers MUST handle &lt;code&gt;false&lt;&#x2F;code&gt; from &lt;code&gt;returns (bool success)&lt;&#x2F;code&gt;. Callers MUST NOT assume that &lt;code&gt;false&lt;&#x2F;code&gt; is never returned!&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IKBT20&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AccountSecured&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _account&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AccountResetBinding&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SafeFallbackActivated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AccountEnabledTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _time&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _allFunds&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AccountEnabledApproval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _time&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _numberOfTransfers&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Ingress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _account&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Egress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _account&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AccountHolderBindings&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; firstWallet&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; secondWallet&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FirstAccountBindings&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; accountHolderWallet&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; secondWallet&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SecondAccountBindings&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; accountHolderWallet&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; firstWallet&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransferConditions&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; time&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span&gt; allFunds&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ApprovalConditions&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; time&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; numberOfTransfers&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addBindings&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _keyWallet1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _keyWallet2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getBindings&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;AccountHolderBindings&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; resetBindings&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeFallback&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; allowTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _time&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _allFunds&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getTransferableFunds&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;TransferConditions&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; allowApproval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _time&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _numberOfTransfers&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getApprovalConditions&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;ApprovalConditions&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getNumberOfTransfersAllowed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isSecureWallet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;events&quot;&gt;Events&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;accountsecured-event&quot;&gt;&lt;code&gt;AccountSecured&lt;&#x2F;code&gt; event&lt;&#x2F;h4&gt;
&lt;p&gt;Emitted when the &lt;code&gt;_account&lt;&#x2F;code&gt; is securing his account by calling the &lt;code&gt;addBindings&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;_amount&lt;&#x2F;code&gt; is the current balance of the &lt;code&gt;_account&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AccountSecured&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _account&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;accountresetbinding-event&quot;&gt;&lt;code&gt;AccountResetBinding&lt;&#x2F;code&gt; event&lt;&#x2F;h4&gt;
&lt;p&gt;Emitted when the holder is resetting his &lt;code&gt;keyWallets&lt;&#x2F;code&gt; by calling the &lt;code&gt;resetBindings&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AccountResetBinding&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;safefallbackactivated-event&quot;&gt;&lt;code&gt;SafeFallbackActivated&lt;&#x2F;code&gt; event&lt;&#x2F;h4&gt;
&lt;p&gt;Emitted when the holder is choosing to move all the funds to one of the &lt;code&gt;keyWallets&lt;&#x2F;code&gt; by calling the &lt;code&gt;safeFallback&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SafeFallbackActivated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;accountenabledtransfer-event&quot;&gt;&lt;code&gt;AccountEnabledTransfer&lt;&#x2F;code&gt; event&lt;&#x2F;h4&gt;
&lt;p&gt;Emitted when the &lt;code&gt;_account&lt;&#x2F;code&gt; has allowed for transfer an &lt;code&gt;_amount&lt;&#x2F;code&gt; of tokens for the &lt;code&gt;_time&lt;&#x2F;code&gt; amount of &lt;code&gt;block&lt;&#x2F;code&gt; seconds for &lt;code&gt;_to&lt;&#x2F;code&gt; address (or if
the &lt;code&gt;_account&lt;&#x2F;code&gt; has allowed for transfer all funds though &lt;code&gt;_allFunds&lt;&#x2F;code&gt; set to &lt;code&gt;true&lt;&#x2F;code&gt;) by calling the &lt;code&gt;allowTransfer&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AccountEnabledTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _account&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _time&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _allFunds&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;accountenabledapproval-event&quot;&gt;&lt;code&gt;AccountEnabledApproval&lt;&#x2F;code&gt; event&lt;&#x2F;h4&gt;
&lt;p&gt;Emitted when &lt;code&gt;_account&lt;&#x2F;code&gt; has allowed approval, for the &lt;code&gt;_time&lt;&#x2F;code&gt; amount of &lt;code&gt;block&lt;&#x2F;code&gt; seconds and set a &lt;code&gt;_numberOfTransfers&lt;&#x2F;code&gt; allowed, by calling the &lt;code&gt;allowApproval&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AccountEnabledApproval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _account&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _time&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _numberOfTransfers&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;ingress-event&quot;&gt;&lt;code&gt;Ingress&lt;&#x2F;code&gt; event&lt;&#x2F;h4&gt;
&lt;p&gt;Emitted when &lt;code&gt;_account&lt;&#x2F;code&gt; becomes a holder. &lt;code&gt;_amount&lt;&#x2F;code&gt; is the current balance of the &lt;code&gt;_account&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Ingress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _account&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;egress-event&quot;&gt;&lt;code&gt;Egress&lt;&#x2F;code&gt; event&lt;&#x2F;h4&gt;
&lt;p&gt;Emitted when &lt;code&gt;_account&lt;&#x2F;code&gt; transfers all his tokens and is no longer a holder. &lt;code&gt;_amount&lt;&#x2F;code&gt; is the previous balance of the &lt;code&gt;_account&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Egress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _account&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;interface-functions&quot;&gt;&lt;strong&gt;Interface functions&lt;&#x2F;strong&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The functions detailed below MUST be implemented.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;addbindings-function&quot;&gt;&lt;code&gt;addBindings&lt;&#x2F;code&gt; function&lt;&#x2F;h4&gt;
&lt;p&gt;Secures the sender account with other two wallets called &lt;code&gt;_keyWallet1&lt;&#x2F;code&gt; and &lt;code&gt;_keyWallet2&lt;&#x2F;code&gt; and MUST fire the &lt;code&gt;AccountSecured&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;p&gt;The function SHOULD &lt;code&gt;revert&lt;&#x2F;code&gt; if:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;the sender account is not a holder&lt;&#x2F;li&gt;
&lt;li&gt;or the sender is already secured&lt;&#x2F;li&gt;
&lt;li&gt;or the keyWallets are the same&lt;&#x2F;li&gt;
&lt;li&gt;or one of the keyWallets is the same as the sender&lt;&#x2F;li&gt;
&lt;li&gt;or one or both keyWallets are zero address (&lt;code&gt;0x0&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;or one or both keyWallets are already keyWallets to another holder account&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addBindings&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _keyWallet1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _keyWallet2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;getbindings-function&quot;&gt;&lt;code&gt;getBindings&lt;&#x2F;code&gt; function&lt;&#x2F;h4&gt;
&lt;p&gt;The function returns the &lt;code&gt;keyWallets&lt;&#x2F;code&gt; for the &lt;code&gt;_account&lt;&#x2F;code&gt; in a &lt;code&gt;struct&lt;&#x2F;code&gt; format.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AccountHolderBindings&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; firstWallet&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; secondWallet&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getBindings&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;AccountHolderBindings&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;resetbindings-function&quot;&gt;&lt;code&gt;resetBindings&lt;&#x2F;code&gt; function&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;&#x2F;strong&gt; This function is helpful when one of the two &lt;code&gt;keyWallets&lt;&#x2F;code&gt; is compromised.&lt;&#x2F;p&gt;
&lt;p&gt;Called from a &lt;code&gt;keyWallet&lt;&#x2F;code&gt;, the function resets the &lt;code&gt;keyWallets&lt;&#x2F;code&gt; for the &lt;code&gt;holder&lt;&#x2F;code&gt; account. MUST fire the &lt;code&gt;AccountResetBinding&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;p&gt;The function SHOULD &lt;code&gt;revert&lt;&#x2F;code&gt; if the sender is not a &lt;code&gt;keyWallet&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; resetBindings&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;safefallback-function&quot;&gt;&lt;code&gt;safeFallback&lt;&#x2F;code&gt; function&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;&#x2F;strong&gt; This function is helpful when the &lt;code&gt;holder&lt;&#x2F;code&gt; account is compromised.&lt;&#x2F;p&gt;
&lt;p&gt;Called from a &lt;code&gt;keyWallet&lt;&#x2F;code&gt;, this function transfers all the tokens from the &lt;code&gt;holder&lt;&#x2F;code&gt; account to the other &lt;code&gt;keyWallet&lt;&#x2F;code&gt; and MUST fire the &lt;code&gt;SafeFallbackActivated&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;p&gt;The function SHOULD &lt;code&gt;revert&lt;&#x2F;code&gt; if the sender is not a &lt;code&gt;keyWallet&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeFallback&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;allowtransfer-function&quot;&gt;&lt;code&gt;allowTransfer&lt;&#x2F;code&gt; function&lt;&#x2F;h4&gt;
&lt;p&gt;Called from a &lt;code&gt;keyWallet&lt;&#x2F;code&gt;, this function is called before a &lt;code&gt;transfer&lt;&#x2F;code&gt; function is called.&lt;&#x2F;p&gt;
&lt;p&gt;It allows to transfer a maximum amount, for a specific time frame, to a specific address.&lt;&#x2F;p&gt;
&lt;p&gt;If the amount is 0 then there will be no restriction on the amount.
If the time is 0 then there will be no restriction on the time.
If the to address is zero address then there will be no restriction on the to address.
Or if &lt;code&gt;_allFunds&lt;&#x2F;code&gt; is &lt;code&gt;true&lt;&#x2F;code&gt;, regardless of the other params, it allows all funds, whenever, to anyone to be transferred.&lt;&#x2F;p&gt;
&lt;p&gt;The function MUST fire &lt;code&gt;AccountEnabledTransfer&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;p&gt;The function SHOULD &lt;code&gt;revert&lt;&#x2F;code&gt; if the sender is not a &lt;code&gt;keyWallet&lt;&#x2F;code&gt; or if the &lt;code&gt;_amount&lt;&#x2F;code&gt; is greater than the &lt;code&gt;holder&lt;&#x2F;code&gt; account balance.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; allowTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _time&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _allFunds&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;gettransferablefunds-function&quot;&gt;&lt;code&gt;getTransferableFunds&lt;&#x2F;code&gt; function&lt;&#x2F;h4&gt;
&lt;p&gt;The function returns the transfer conditions for the &lt;code&gt;_account&lt;&#x2F;code&gt; in a &lt;code&gt;struct&lt;&#x2F;code&gt; format.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransferConditions&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; time&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bool&lt;&#x2F;span&gt;&lt;span&gt; allFunds&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getTransferableFunds&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;TransferConditions&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;allowapproval-function&quot;&gt;&lt;code&gt;allowApproval&lt;&#x2F;code&gt; function&lt;&#x2F;h4&gt;
&lt;p&gt;Called from a &lt;code&gt;keyWallet&lt;&#x2F;code&gt;, this function is called before one of the &lt;code&gt;approve&lt;&#x2F;code&gt;, &lt;code&gt;increaseAllowance&lt;&#x2F;code&gt; or &lt;code&gt;decreaseAllowance&lt;&#x2F;code&gt; function are called.&lt;&#x2F;p&gt;
&lt;p&gt;It allows the &lt;code&gt;holder&lt;&#x2F;code&gt; for a specific amount of &lt;code&gt;_time&lt;&#x2F;code&gt; to do an &lt;code&gt;approve&lt;&#x2F;code&gt;, &lt;code&gt;increaseAllowance&lt;&#x2F;code&gt; or &lt;code&gt;decreaseAllowance&lt;&#x2F;code&gt; and limit the number of transfers the spender is allowed to do through &lt;code&gt;_numberOfTransfers&lt;&#x2F;code&gt; (0 - unlimited number of transfers in the allowance limit).&lt;&#x2F;p&gt;
&lt;p&gt;The function MUST fire &lt;code&gt;AccountEnabledApproval&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;p&gt;The function SHOULD &lt;code&gt;revert&lt;&#x2F;code&gt; if the sender is not a &lt;code&gt;keyWallet&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; allowApproval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _time&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _numberOfTransfers&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;getapprovalconditions-function&quot;&gt;&lt;code&gt;getApprovalConditions&lt;&#x2F;code&gt; function&lt;&#x2F;h4&gt;
&lt;p&gt;The function returns the approval conditions in a struct format. Where &lt;code&gt;time&lt;&#x2F;code&gt; is the &lt;code&gt;block.timestamp&lt;&#x2F;code&gt; until the &lt;code&gt;approve&lt;&#x2F;code&gt;, &lt;code&gt;increaseAllowance&lt;&#x2F;code&gt; or &lt;code&gt;decreaseAllowance&lt;&#x2F;code&gt; functions can be called, and &lt;code&gt;numberOfTransfers&lt;&#x2F;code&gt; is the number of transfers the spender will be allowed.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ApprovalConditions&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; time&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; numberOfTransfers&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getApprovalConditions&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;ApprovalConditions&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;transfer-function&quot;&gt;&lt;code&gt;transfer&lt;&#x2F;code&gt; function&lt;&#x2F;h4&gt;
&lt;p&gt;The function transfers &lt;code&gt;_amount&lt;&#x2F;code&gt; of tokens to address &lt;code&gt;_to&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The function MUST fire the &lt;code&gt;Transfer&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;p&gt;The function SHOULD &lt;code&gt;revert&lt;&#x2F;code&gt; if the sender’s account balance does not have enough tokens to spend, or if the sender is a secure account and it has not allowed the transfer of funds through &lt;code&gt;allowTransfer&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;&#x2F;strong&gt; Transfers of &lt;code&gt;0&lt;&#x2F;code&gt; values MUST be treated as normal transfers and fire the &lt;code&gt;Transfer&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;approve-function&quot;&gt;&lt;code&gt;approve&lt;&#x2F;code&gt; function&lt;&#x2F;h4&gt;
&lt;p&gt;The function allows &lt;code&gt;_spender&lt;&#x2F;code&gt; to transfer from the &lt;code&gt;holder&lt;&#x2F;code&gt; account multiple times, up to the &lt;code&gt;_value&lt;&#x2F;code&gt; amount.&lt;&#x2F;p&gt;
&lt;p&gt;The function also limits the &lt;code&gt;_spender&lt;&#x2F;code&gt; to the specific number of transfers set in the &lt;code&gt;ApprovalConditions&lt;&#x2F;code&gt; for that &lt;code&gt;holder&lt;&#x2F;code&gt; account. If the value is &lt;code&gt;0&lt;&#x2F;code&gt; then the &lt;code&gt;_spender&lt;&#x2F;code&gt; can transfer multiple times, up to the &lt;code&gt;_value&lt;&#x2F;code&gt; amount.&lt;&#x2F;p&gt;
&lt;p&gt;The function MUST fire an &lt;code&gt;Approval&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;p&gt;If this function is called again it overrides the current allowance with &lt;code&gt;_value&lt;&#x2F;code&gt; and also overrides the number of transfers allowed with &lt;code&gt;_numberOfTransfers&lt;&#x2F;code&gt;, set in &lt;code&gt;allowApproval&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;p&gt;The function SHOULD &lt;code&gt;revert&lt;&#x2F;code&gt; if:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;the sender account is secured and has not called &lt;code&gt;allowApproval&lt;&#x2F;code&gt; function&lt;&#x2F;li&gt;
&lt;li&gt;or if the &lt;code&gt;_time&lt;&#x2F;code&gt;, set in the &lt;code&gt;allowApproval&lt;&#x2F;code&gt; function, has elapsed.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;increaseallowance-function&quot;&gt;&lt;code&gt;increaseAllowance&lt;&#x2F;code&gt; function&lt;&#x2F;h4&gt;
&lt;p&gt;The function increases the allowance granted to &lt;code&gt;_spender&lt;&#x2F;code&gt; to withdraw from your account.&lt;&#x2F;p&gt;
&lt;p&gt;The function Emits an &lt;code&gt;Approval&lt;&#x2F;code&gt; event indicating the updated allowance.&lt;&#x2F;p&gt;
&lt;p&gt;The function SHOULD &lt;code&gt;revert&lt;&#x2F;code&gt; if:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;the sender account is secured and has not called &lt;code&gt;allowApproval&lt;&#x2F;code&gt; function&lt;&#x2F;li&gt;
&lt;li&gt;or if the &lt;code&gt;_spender&lt;&#x2F;code&gt; is a zero address (&lt;code&gt;0x0&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;or if the &lt;code&gt;_time&lt;&#x2F;code&gt;, set in the &lt;code&gt;allowApproval&lt;&#x2F;code&gt; function, has elapsed.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; increaseAllowance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _addedValue&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;decreaseallowance-function&quot;&gt;&lt;code&gt;decreaseAllowance&lt;&#x2F;code&gt; function&lt;&#x2F;h4&gt;
&lt;p&gt;The function decreases the allowance granted to &lt;code&gt;_spender&lt;&#x2F;code&gt; to withdraw from your account.&lt;&#x2F;p&gt;
&lt;p&gt;The function Emits an &lt;code&gt;Approval&lt;&#x2F;code&gt; event indicating the updated allowance.&lt;&#x2F;p&gt;
&lt;p&gt;The function SHOULD &lt;code&gt;revert&lt;&#x2F;code&gt; if:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;the sender account is secured and has not called &lt;code&gt;allowApproval&lt;&#x2F;code&gt; function&lt;&#x2F;li&gt;
&lt;li&gt;or if the &lt;code&gt;_spender&lt;&#x2F;code&gt; is a zero address (&lt;code&gt;0x0&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;or if the &lt;code&gt;_time&lt;&#x2F;code&gt;, set in the &lt;code&gt;allowApproval&lt;&#x2F;code&gt; function, has elapsed.&lt;&#x2F;li&gt;
&lt;li&gt;or if the &lt;code&gt;_subtractedValue&lt;&#x2F;code&gt; is greater than the current allowance&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; decreaseAllowance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _subtractedValue&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;transferfrom-function&quot;&gt;&lt;code&gt;transferFrom&lt;&#x2F;code&gt; function&lt;&#x2F;h4&gt;
&lt;p&gt;The function transfers &lt;code&gt;_amount&lt;&#x2F;code&gt; of tokens from address &lt;code&gt;_from&lt;&#x2F;code&gt; to address &lt;code&gt;_to&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The function MUST fire the &lt;code&gt;Transfer&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;transferFrom&lt;&#x2F;code&gt; method is used for a withdraw workflow, allowing contracts to transfer tokens on your behalf.
The function SHOULD &lt;code&gt;revert&lt;&#x2F;code&gt; unless the &lt;code&gt;_from&lt;&#x2F;code&gt; account has deliberately authorized the sender.
Each time the spender calls the function the contract subtracts and checks if the number of allowed transfers has reached 0,
and when that happens the approval is revoked using an approve of 0 amount.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;&#x2F;strong&gt; Transfers of 0 values MUST be treated as normal transfers and fire the &lt;code&gt;Transfer&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The intent from individual technical decisions made during the development of &lt;strong&gt;FKBTs&lt;&#x2F;strong&gt; focused on maintaining consistency and backward compatibility with ERC-20s, all the while offering self-custodial security features to the user. It was important that &lt;strong&gt;FKBT&#x27;s&lt;&#x2F;strong&gt; inherited all of ERC-20s characteristics to comply with requirements found in dApps which use fungible tokens on their platform. In doing so, it allowed for flawless backward compatibility to take place and gave the user the choice to decide if they want their &lt;strong&gt;FKBTs&lt;&#x2F;strong&gt; to act with &lt;strong&gt;Default Behaviors&lt;&#x2F;strong&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-4-3&quot;&gt;&lt;a href=&quot;#fn-4&quot;&gt;4&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;. We wanted to ensure that wide-scale implementation and adoption of &lt;strong&gt;FKBTs&lt;&#x2F;strong&gt; could take place immediately, without the greater collective needing to adapt and make changes to the already flourishing decentralized ecosystem.&lt;&#x2F;p&gt;
&lt;p&gt;For developers and users alike, the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6808&#x2F;#allowtransfer-function&quot;&gt;allowTransfer&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6808&#x2F;#allowapproval-function&quot;&gt;allowApproval&lt;&#x2F;a&gt; functions both return bools on success and revert on failures. This decision was done purposefully, to keep consistency with the already familiar ERC-20. Additional technical decisions related to self-custodial security features are broken down and located within the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6808&#x2F;#security-considerations&quot;&gt;Security Considerations&lt;&#x2F;a&gt; section.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;KBT&#x27;s&lt;&#x2F;strong&gt; are designed to be backward-compatible with existing token standards and wallets. Existing tokens and wallets will continue to function as normal, and will not be affected by the implementation of &lt;strong&gt;FKBT&#x27;s&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6808&#x2F;assets&#x2F;README&#x2F;&quot;&gt;assets&lt;&#x2F;a&gt; directory has all the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6808&#x2F;.&#x2F;assets&#x2F;test&#x2F;kbt20.js&quot;&gt;tests&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Average Gas used (&lt;em&gt;GWEI&lt;&#x2F;em&gt;):&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;addBindings&lt;&#x2F;code&gt; - 154,991&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;resetBindings&lt;&#x2F;code&gt; - 30,534&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;safeFallback&lt;&#x2F;code&gt; - 51,013&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;allowTransfer&lt;&#x2F;code&gt; - 49,887&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;allowApproval&lt;&#x2F;code&gt; - 44,971&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The implementation is located in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6808&#x2F;assets&#x2F;README&#x2F;&quot;&gt;assets&lt;&#x2F;a&gt; directory. There&#x27;s also a &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6808&#x2F;.&#x2F;assets&#x2F;Contract%20Interactions%20diagram.svg&quot;&gt;diagram&lt;&#x2F;a&gt; with the contract interactions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;FKBT&#x27;s&lt;&#x2F;strong&gt; were designed with security in mind every step of the way. Below are some design decisions that were rigorously discussed and thought through during the development process.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Key Wallets&lt;&#x2F;strong&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-1-5&quot;&gt;&lt;a href=&quot;#fn-1&quot;&gt;1&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;: When calling the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6808&#x2F;#addbindings-function&quot;&gt;addBindings&lt;&#x2F;a&gt; function for an &lt;strong&gt;FKBT&lt;&#x2F;strong&gt;, the user must input 2 wallets that will then act as &lt;code&gt;_keyWallet1&lt;&#x2F;code&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-15-3&quot;&gt;&lt;a href=&quot;#fn-15&quot;&gt;14&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; and &lt;code&gt;_keyWallet2&lt;&#x2F;code&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-16-3&quot;&gt;&lt;a href=&quot;#fn-16&quot;&gt;15&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;. They are added simultaneously to reduce user fees, minimize the chance of human error and prevent a pitfall scenario. If the user had the ability to add multiple wallets it would not only result in additional fees and avoidable confusion but would enable a potentially disastrous &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6808&#x2F;#safefallback-function&quot;&gt;safeFallback&lt;&#x2F;a&gt; situation to occur. For this reason, all &lt;strong&gt;KBT&#x27;s&lt;&#x2F;strong&gt; work under a 3-wallet system when security features are activated.&lt;&#x2F;p&gt;
&lt;p&gt;Typically if a wallet is compromised, the fungible assets within are at risk. With &lt;strong&gt;FKBT&#x27;s&lt;&#x2F;strong&gt; there are two different functions that can be called from a &lt;strong&gt;Key Wallet&lt;&#x2F;strong&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-1-6&quot;&gt;&lt;a href=&quot;#fn-1&quot;&gt;1&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; depending on which wallet has been compromised.&lt;&#x2F;p&gt;
&lt;p&gt;Scenario: &lt;strong&gt;Holding Wallet&lt;&#x2F;strong&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-3-3&quot;&gt;&lt;a href=&quot;#fn-3&quot;&gt;3&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; has been compromised, call &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6808&#x2F;#safefallback-function&quot;&gt;safeFallback&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6808&#x2F;#safefallback-function&quot;&gt;safeFallback&lt;&#x2F;a&gt;: This function was created in the event that the owner believes the &lt;strong&gt;Holding Wallet&lt;&#x2F;strong&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-3-4&quot;&gt;&lt;a href=&quot;#fn-3&quot;&gt;3&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; has been compromised. It can also be used if the owner losses access to the &lt;strong&gt;Holding Wallet&lt;&#x2F;strong&gt;. In this scenario, the user has the ability to call &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6808&#x2F;#safefallback-function&quot;&gt;safeFallback&lt;&#x2F;a&gt; from one of the &lt;strong&gt;Key Wallets&lt;&#x2F;strong&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-1-7&quot;&gt;&lt;a href=&quot;#fn-1&quot;&gt;1&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;. &lt;strong&gt;FKBT&#x27;s&lt;&#x2F;strong&gt; are then redirected from the &lt;strong&gt;Holding Wallet&lt;&#x2F;strong&gt; to the other &lt;strong&gt;Key Wallet&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;By redirecting the &lt;strong&gt;FKBT&#x27;s&lt;&#x2F;strong&gt; it prevents a single point of failure. If an attacker were to call &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6808&#x2F;#safefallback-function&quot;&gt;safeFallback&lt;&#x2F;a&gt; and the &lt;strong&gt;FKBT&#x27;s&lt;&#x2F;strong&gt; redirected to the &lt;strong&gt;Key Wallet&lt;&#x2F;strong&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-1-8&quot;&gt;&lt;a href=&quot;#fn-1&quot;&gt;1&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; that called the function, they would gain access to all the &lt;strong&gt;FKBT&#x27;s&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Scenario: &lt;strong&gt;Key Wallet&lt;&#x2F;strong&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-1-9&quot;&gt;&lt;a href=&quot;#fn-1&quot;&gt;1&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; has been compromised, call &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6808&#x2F;#resetbindings-function&quot;&gt;resetBindings&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6808&#x2F;#resetbindings-function&quot;&gt;resetBindings&lt;&#x2F;a&gt;: This function was created in the event that the owner believes &lt;code&gt;_keyWallet1&lt;&#x2F;code&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-15-4&quot;&gt;&lt;a href=&quot;#fn-15&quot;&gt;14&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; or &lt;code&gt;_keyWallet2&lt;&#x2F;code&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-16-4&quot;&gt;&lt;a href=&quot;#fn-16&quot;&gt;15&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; has been compromised. It can also be used if the owner losses access to one of the &lt;strong&gt;Key Wallets&lt;&#x2F;strong&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-1-10&quot;&gt;&lt;a href=&quot;#fn-1&quot;&gt;1&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;. In this instance, the user has the ability to call &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6808&#x2F;#resetbindings-function&quot;&gt;resetBindings&lt;&#x2F;a&gt;, removing the bound &lt;strong&gt;Key Wallets&lt;&#x2F;strong&gt; and resetting the security features. The &lt;strong&gt;FKBT&#x27;s&lt;&#x2F;strong&gt; will now function as a traditional ERC-20 until &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6808&#x2F;#addbindings-function&quot;&gt;addBindings&lt;&#x2F;a&gt; is called again and a new set of &lt;strong&gt;Key Wallets&lt;&#x2F;strong&gt; are added.&lt;&#x2F;p&gt;
&lt;p&gt;The reason why &lt;code&gt;_keyWallet1&lt;&#x2F;code&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-15-5&quot;&gt;&lt;a href=&quot;#fn-15&quot;&gt;14&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; or &lt;code&gt;_keyWallet2&lt;&#x2F;code&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-16-5&quot;&gt;&lt;a href=&quot;#fn-16&quot;&gt;15&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; are required to call the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6808&#x2F;#resetbindings-function&quot;&gt;resetBindings&lt;&#x2F;a&gt; function is because a &lt;strong&gt;Holding Wallet&lt;&#x2F;strong&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-3-5&quot;&gt;&lt;a href=&quot;#fn-3&quot;&gt;3&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; having the ability to call &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6808&#x2F;#resetbindings-function&quot;&gt;resetBindings&lt;&#x2F;a&gt; could result in an immediate loss of &lt;strong&gt;FKBT&#x27;s&lt;&#x2F;strong&gt;. The attacker would only need to gain access to the &lt;strong&gt;Holding Wallet&lt;&#x2F;strong&gt; and call &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6808&#x2F;#resetbindings-function&quot;&gt;resetBindings&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;In the scenario that 2 of the 3 wallets have been compromised, there is nothing the owner of the &lt;strong&gt;FKBT&#x27;s&lt;&#x2F;strong&gt; can do if the attack is malicious. However, by allowing 1 wallet to be compromised, holders of fungible tokens built using the &lt;strong&gt;FKBT&lt;&#x2F;strong&gt; standard are given a second chance, unlike other current standards.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6808&#x2F;#allowtransfer-function&quot;&gt;allowTransfer&lt;&#x2F;a&gt; function is in place to guarantee a &lt;strong&gt;Safe Transfer&lt;&#x2F;strong&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-2-2&quot;&gt;&lt;a href=&quot;#fn-2&quot;&gt;2&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;, but can also have &lt;strong&gt;Default Values&lt;&#x2F;strong&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-7-2&quot;&gt;&lt;a href=&quot;#fn-7&quot;&gt;7&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; set by a dApp to emulate &lt;strong&gt;Default Behaviors&lt;&#x2F;strong&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-3-6&quot;&gt;&lt;a href=&quot;#fn-3&quot;&gt;3&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; of a traditional ERC-20. It enables the user to highly specify the type of transfer they are about to conduct, whilst simultaneously allowing the user to unlock all the &lt;strong&gt;FKBT&#x27;s&lt;&#x2F;strong&gt; to anyone for an unlimited amount of time. The desired security is completely up to the user.&lt;&#x2F;p&gt;
&lt;p&gt;This function requires 4 parameters to be filled and different combinations of these result in different levels of security;&lt;&#x2F;p&gt;
&lt;p&gt;Parameter 1 &lt;code&gt;_amount&lt;&#x2F;code&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-8-2&quot;&gt;&lt;a href=&quot;#fn-8&quot;&gt;8&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;: This is the number of &lt;strong&gt;FKBT&#x27;s&lt;&#x2F;strong&gt; that will be spent on a transfer.&lt;&#x2F;p&gt;
&lt;p&gt;Parameter 2 &lt;code&gt;_time&lt;&#x2F;code&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-9-2&quot;&gt;&lt;a href=&quot;#fn-9&quot;&gt;9&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;: The number of blocks the &lt;strong&gt;FKBT&#x27;s&lt;&#x2F;strong&gt; can be transferred starting from the current block timestamp.&lt;&#x2F;p&gt;
&lt;p&gt;Parameter 3 &lt;code&gt;_address&lt;&#x2F;code&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-10-2&quot;&gt;&lt;a href=&quot;#fn-10&quot;&gt;10&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;: The destination the &lt;strong&gt;FKBT&#x27;s&lt;&#x2F;strong&gt; will be sent to.&lt;&#x2F;p&gt;
&lt;p&gt;Parameter 4 &lt;code&gt;_allFunds&lt;&#x2F;code&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-11-2&quot;&gt;&lt;a href=&quot;#fn-11&quot;&gt;11&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;: This is a boolean value. When false, the &lt;code&gt;transfer&lt;&#x2F;code&gt; function takes into consideration Parameters 1, 2 and 3. If the value is true, the &lt;code&gt;transfer&lt;&#x2F;code&gt; function will revert to a &lt;strong&gt;Default Behavior&lt;&#x2F;strong&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-4-4&quot;&gt;&lt;a href=&quot;#fn-4&quot;&gt;4&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;, the same as a traditional ERC-20.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6808&#x2F;#allowtransfer-function&quot;&gt;allowTransfer&lt;&#x2F;a&gt; function requires &lt;code&gt;_keyWallet1&lt;&#x2F;code&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-15-6&quot;&gt;&lt;a href=&quot;#fn-15&quot;&gt;14&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; or &lt;code&gt;_keyWallet2&lt;&#x2F;code&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-16-6&quot;&gt;&lt;a href=&quot;#fn-16&quot;&gt;15&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; and enables the &lt;strong&gt;Holding Wallet&lt;&#x2F;strong&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-3-7&quot;&gt;&lt;a href=&quot;#fn-3&quot;&gt;3&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; to conduct a &lt;code&gt;transfer&lt;&#x2F;code&gt; within the previously specified parameters. These parameters were added in order to provide additional security by limiting the &lt;strong&gt;Holding Wallet&lt;&#x2F;strong&gt; in case it was compromised without the user&#x27;s knowledge.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6808&#x2F;#allowapproval-function&quot;&gt;allowApproval&lt;&#x2F;a&gt; function provides extra security when allowing on-chain third parties to use your &lt;strong&gt;FKBT&#x27;s&lt;&#x2F;strong&gt; on your behalf. This is especially useful when a user is met with common malicious attacks e.g. draining dApp.&lt;&#x2F;p&gt;
&lt;p&gt;This function requires 2 parameters to be filled and different combinations of these result in different levels of security;&lt;&#x2F;p&gt;
&lt;p&gt;Parameter 1 &lt;code&gt;_time&lt;&#x2F;code&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-12-2&quot;&gt;&lt;a href=&quot;#fn-12&quot;&gt;12&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;: The number of blocks that the approval of a third-party service can take place, starting from the current block timestamp.&lt;&#x2F;p&gt;
&lt;p&gt;Parameter 2 &lt;code&gt;_numberOfTransfers_&lt;&#x2F;code&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-13-2&quot;&gt;&lt;a href=&quot;#fn-13&quot;&gt;13&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;: The number of transactions a third-party service can conduct on the user&#x27;s behalf.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6808&#x2F;#allowapproval-function&quot;&gt;allowApproval&lt;&#x2F;a&gt; function requires &lt;code&gt;_keyWallet1&lt;&#x2F;code&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-15-7&quot;&gt;&lt;a href=&quot;#fn-15&quot;&gt;14&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; or &lt;code&gt;_keyWallet2&lt;&#x2F;code&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-16-7&quot;&gt;&lt;a href=&quot;#fn-16&quot;&gt;15&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; and enables the &lt;strong&gt;Holding Wallet&lt;&#x2F;strong&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-3-8&quot;&gt;&lt;a href=&quot;#fn-3&quot;&gt;3&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; to allow a third-party service by using the &lt;code&gt;approve&lt;&#x2F;code&gt; function. These parameters were added to provide extra security when granting permission to a third-party that uses assets on the user&#x27;s behalf. Parameter 1, &lt;code&gt;_time&lt;&#x2F;code&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-12-3&quot;&gt;&lt;a href=&quot;#fn-12&quot;&gt;12&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;, is a limitation to when the &lt;strong&gt;Holding Wallet&lt;&#x2F;strong&gt; can &lt;code&gt;approve&lt;&#x2F;code&gt; a third-party service. Parameter 2, &lt;code&gt;_numberOfTransfers&lt;&#x2F;code&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-13-3&quot;&gt;&lt;a href=&quot;#fn-13&quot;&gt;13&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;, is a limitation to the number of transactions the approved third-party service can conduct on the user&#x27;s behalf before revoking approval.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;section class=&quot;footnotes&quot;&gt;
&lt;ol class=&quot;footnotes-list&quot;&gt;
&lt;li id=&quot;fn-1&quot;&gt;
&lt;p&gt;The &lt;strong&gt;Key Wallet&#x2F;s&lt;&#x2F;strong&gt; refers to &lt;code&gt;_keyWallet1&lt;&#x2F;code&gt; or &lt;code&gt;_keyWallet2&lt;&#x2F;code&gt; which can call the &lt;code&gt;safeFallback&lt;&#x2F;code&gt;, &lt;code&gt;resetBindings&lt;&#x2F;code&gt;, &lt;code&gt;allowTransfer&lt;&#x2F;code&gt; and &lt;code&gt;allowApproval&lt;&#x2F;code&gt; functions. &lt;a href=&quot;#fr-1-1&quot;&gt;↩&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-1-2&quot;&gt;↩2&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-1-3&quot;&gt;↩3&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-1-4&quot;&gt;↩4&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-1-5&quot;&gt;↩5&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-1-6&quot;&gt;↩6&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-1-7&quot;&gt;↩7&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-1-8&quot;&gt;↩8&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-1-9&quot;&gt;↩9&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-1-10&quot;&gt;↩10&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li id=&quot;fn-2&quot;&gt;
&lt;p&gt;A &lt;strong&gt;Safe Transfer&lt;&#x2F;strong&gt; is when 1 of the &lt;strong&gt;Key Wallets&lt;&#x2F;strong&gt; safely approved the use of the &lt;strong&gt;FKBT&#x27;s&lt;&#x2F;strong&gt;. &lt;a href=&quot;#fr-2-1&quot;&gt;↩&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-2-2&quot;&gt;↩2&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li id=&quot;fn-3&quot;&gt;
&lt;p&gt;The &lt;strong&gt;Holding Wallet&lt;&#x2F;strong&gt; refers to the wallet containing the &lt;strong&gt;FKBT&#x27;s&lt;&#x2F;strong&gt;. &lt;a href=&quot;#fr-3-1&quot;&gt;↩&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-3-2&quot;&gt;↩2&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-3-3&quot;&gt;↩3&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-3-4&quot;&gt;↩4&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-3-5&quot;&gt;↩5&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-3-6&quot;&gt;↩6&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-3-7&quot;&gt;↩7&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-3-8&quot;&gt;↩8&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li id=&quot;fn-4&quot;&gt;
&lt;p&gt;A &lt;strong&gt;Default Behavior&#x2F;s&lt;&#x2F;strong&gt; refers to behavior&#x2F;s present in the preexisting non-fungible ERC-20 standard. &lt;a href=&quot;#fr-4-1&quot;&gt;↩&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-4-2&quot;&gt;↩2&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-4-3&quot;&gt;↩3&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-4-4&quot;&gt;↩4&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li id=&quot;fn-5&quot;&gt;
&lt;p&gt;The number of crypto scam reports the United States Federal Trade Commission received, from January 2021 through March 2022. &lt;a href=&quot;#fr-5-1&quot;&gt;↩&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li id=&quot;fn-6&quot;&gt;
&lt;p&gt;The amount stolen via crypto scams according to the United States Federal Trade Commission, from January 2021 through March 2022. &lt;a href=&quot;#fr-6-1&quot;&gt;↩&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li id=&quot;fn-7&quot;&gt;
&lt;p&gt;A &lt;strong&gt;Default Value&#x2F;s&lt;&#x2F;strong&gt; refer to a value&#x2F;s that emulates the non-fungible ERC-20 &lt;strong&gt;Default Behavior&#x2F;s&lt;&#x2F;strong&gt;. &lt;a href=&quot;#fr-7-1&quot;&gt;↩&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-7-2&quot;&gt;↩2&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li id=&quot;fn-8&quot;&gt;
&lt;p&gt;The &lt;code&gt;_amount&lt;&#x2F;code&gt; represents the amount of the &lt;strong&gt;FKBT&#x27;s&lt;&#x2F;strong&gt; intended to be spent. &lt;a href=&quot;#fr-8-1&quot;&gt;↩&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-8-2&quot;&gt;↩2&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li id=&quot;fn-9&quot;&gt;
&lt;p&gt;The &lt;code&gt;_time&lt;&#x2F;code&gt; in &lt;code&gt;allowTransfer&lt;&#x2F;code&gt; represents the number of blocks a &lt;code&gt;transfer&lt;&#x2F;code&gt; can take place in. &lt;a href=&quot;#fr-9-1&quot;&gt;↩&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-9-2&quot;&gt;↩2&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li id=&quot;fn-10&quot;&gt;
&lt;p&gt;The &lt;code&gt;_address&lt;&#x2F;code&gt; represents the address that the &lt;strong&gt;FKBT&#x27;s&lt;&#x2F;strong&gt; will be sent to. &lt;a href=&quot;#fr-10-1&quot;&gt;↩&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-10-2&quot;&gt;↩2&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li id=&quot;fn-11&quot;&gt;
&lt;p&gt;The &lt;code&gt;_allFunds&lt;&#x2F;code&gt; is a bool that can be set to true or false. &lt;a href=&quot;#fr-11-1&quot;&gt;↩&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-11-2&quot;&gt;↩2&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li id=&quot;fn-12&quot;&gt;
&lt;p&gt;The &lt;code&gt;_time&lt;&#x2F;code&gt; in &lt;code&gt;allowApproval&lt;&#x2F;code&gt; represents the number of blocks an &lt;code&gt;approve&lt;&#x2F;code&gt; can take place in. &lt;a href=&quot;#fr-12-1&quot;&gt;↩&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-12-2&quot;&gt;↩2&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-12-3&quot;&gt;↩3&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li id=&quot;fn-13&quot;&gt;
&lt;p&gt;The &lt;code&gt;_numberOfTransfers&lt;&#x2F;code&gt; is the number of transfers a third-party entity can conduct via &lt;code&gt;transfer&lt;&#x2F;code&gt; on the user&#x27;s behalf. &lt;a href=&quot;#fr-13-1&quot;&gt;↩&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-13-2&quot;&gt;↩2&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-13-3&quot;&gt;↩3&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li id=&quot;fn-15&quot;&gt;
&lt;p&gt;The &lt;code&gt;_keyWallet1&lt;&#x2F;code&gt; is 1 of the 2 &lt;strong&gt;Key Wallets&lt;&#x2F;strong&gt; set when calling the &lt;code&gt;addBindings&lt;&#x2F;code&gt; function. &lt;a href=&quot;#fr-15-1&quot;&gt;↩&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-15-2&quot;&gt;↩2&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-15-3&quot;&gt;↩3&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-15-4&quot;&gt;↩4&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-15-5&quot;&gt;↩5&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-15-6&quot;&gt;↩6&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-15-7&quot;&gt;↩7&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li id=&quot;fn-16&quot;&gt;
&lt;p&gt;The &lt;code&gt;_keyWallet2&lt;&#x2F;code&gt; is 1 of the 2 &lt;strong&gt;Key Wallets&lt;&#x2F;strong&gt; set when calling the &lt;code&gt;addBindings&lt;&#x2F;code&gt; function. &lt;a href=&quot;#fr-16-1&quot;&gt;↩&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-16-2&quot;&gt;↩2&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-16-3&quot;&gt;↩3&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-16-4&quot;&gt;↩4&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-16-5&quot;&gt;↩5&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-16-6&quot;&gt;↩6&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-16-7&quot;&gt;↩7&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li id=&quot;fn-14&quot;&gt;
&lt;p&gt;A &lt;em&gt;PoS&lt;&#x2F;em&gt; protocol, Proof-of-Stake protocol, is a cryptocurrency consensus mechanism for processing transactions and creating new blocks in a blockchain. &lt;a href=&quot;#fr-14-1&quot;&gt;↩&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;section&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Non-Fungible Key Bound Token</title>
        <published>2023-03-31T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Mihai Onila</name><uri>https://github.com/MihaiORO</uri>
	</author>
	
	<author>
		<name>Nick Zeman</name><uri>https://github.com/NickZCZ</uri>
	</author>
	
	<author>
		<name>Narcis Cotaie</name><uri>https://github.com/NarcisCRO</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6809/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/non-fungible-key-bound-token-kbt/13625" />
        

        <id>https://wg-eips.ritovision.com/6809/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:6809"
            label="ERC-6809" />
        

        
        

        
        <summary type="html">An interface for Non-Fungible Key Bound Tokens, also known as a NFKBT.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6809/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;A standard interface for Non-Fungible Key Bound Tokens (&lt;strong&gt;NFKBT&#x2F;s&lt;&#x2F;strong&gt;), a subset of the more general Key Bound Tokens (&lt;strong&gt;KBT&#x2F;s&lt;&#x2F;strong&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;The following standardizes an API for tokens within smart contracts and provides basic functionality to the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6809&#x2F;#addbindings-function&quot;&gt;addBindings&lt;&#x2F;a&gt; function. This function designates &lt;strong&gt;Key Wallets&lt;&#x2F;strong&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-1-1&quot;&gt;&lt;a href=&quot;#fn-1&quot;&gt;1&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;, which are responsible for conducting a &lt;strong&gt;Safe Transfer&lt;&#x2F;strong&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-2-1&quot;&gt;&lt;a href=&quot;#fn-2&quot;&gt;2&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;. During this process, &lt;strong&gt;NFKBT&#x27;s&lt;&#x2F;strong&gt; are safely approved so they can be spent by the user or an on-chain third-party entity.&lt;&#x2F;p&gt;
&lt;p&gt;The premise of &lt;strong&gt;NFKBT&#x27;s&lt;&#x2F;strong&gt; is to provide fully optional security features built directly into the non-fungible asset, via the concept of &lt;em&gt;allow&lt;&#x2F;em&gt; found in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6809&#x2F;#allowtransfer-function&quot;&gt;allowTransfer&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6809&#x2F;#allowapproval-function&quot;&gt;allowApproval&lt;&#x2F;a&gt; functions. These functions are called by one of the &lt;strong&gt;Key Wallets&lt;&#x2F;strong&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-1-2&quot;&gt;&lt;a href=&quot;#fn-1&quot;&gt;1&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; and &lt;em&gt;allow&lt;&#x2F;em&gt; the &lt;strong&gt;Holding Wallet&lt;&#x2F;strong&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-3-1&quot;&gt;&lt;a href=&quot;#fn-3&quot;&gt;3&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; to either call the already familiar &lt;code&gt;transferFrom&lt;&#x2F;code&gt; and &lt;code&gt;approve&lt;&#x2F;code&gt; function found in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;. Responsibility for the &lt;strong&gt;NFKBT&lt;&#x2F;strong&gt; is therefore split. The &lt;strong&gt;Holding Wallet&lt;&#x2F;strong&gt; contains the asset and &lt;strong&gt;Key Wallets&lt;&#x2F;strong&gt; have authority over how the assets can be spent or approved. &lt;strong&gt;Default Behaviors&lt;&#x2F;strong&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-4-1&quot;&gt;&lt;a href=&quot;#fn-4&quot;&gt;4&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; of a traditional non-fungible ERC-721 can be achieved by simply never using the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6809&#x2F;#addbindings-function&quot;&gt;addBindings&lt;&#x2F;a&gt; function.&lt;&#x2F;p&gt;
&lt;p&gt;We considered &lt;strong&gt;NFKBTs&lt;&#x2F;strong&gt; being used by every individual who wishes to add additional security to their non-fungible assets, as well as consignment to third-party wallets&#x2F;brokers&#x2F;banks&#x2F;insurers&#x2F;galleries. &lt;strong&gt;NFKBTs&lt;&#x2F;strong&gt; are resilient to attacks&#x2F;thefts, by providing additional protection to the asset itself on a self-custodial level.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;In this fast-paced technologically advancing world, people learn and mature at different speeds. The goal of global adoption must take into consideration the target demographic is of all ages and backgrounds. Unfortunately for self-custodial assets, one of the greatest pros is also one of its greatest cons. The individual is solely responsible for their actions and adequately securing their assets. If a mistake is made leading to a loss of funds, no one is able to guarantee their return.&lt;&#x2F;p&gt;
&lt;p&gt;From January 2021 through March 2022, the United States Federal Trade Commission received more than 46,000&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-5-1&quot;&gt;&lt;a href=&quot;#fn-5&quot;&gt;5&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; crypto scam reports. This directly impacted crypto users and resulted in a net consumer loss exceeding $1 Billion&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-6-1&quot;&gt;&lt;a href=&quot;#fn-6&quot;&gt;6&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;. Theft and malicious scams are an issue in any financial sector and oftentimes lead to stricter regulation. However, government-imposed regulation goes against one of this space’s core values. Efforts have been made to increase security within the space through centralized and decentralized means. Up until now, no one has offered a solution that holds onto the advantages of both whilst eliminating their disadvantages.&lt;&#x2F;p&gt;
&lt;p&gt;We asked ourselves the same question as many have in the past, “How does one protect the wallet?”. After a while, realizing the question that should be asked is “How does one protect the asset?”. Creating the wallet is free, the asset is what has value and is worth protecting. This question led to the development of &lt;strong&gt;KBT&#x27;s&lt;&#x2F;strong&gt;. A solution that is fully optional and can be tailored so far as the user is concerned. Individual assets remain protected even if the seed phrase or private key is publicly released, as long as the security feature was activated.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;NFKBTs&lt;&#x2F;strong&gt; saw the need to improve on the widely used non-fungible ERC-721 token standard. The security of non-fungible assets is a topic that concerns every entity in the crypto space, as their current and future use cases are continuously explored. &lt;strong&gt;NFKBTs&lt;&#x2F;strong&gt; provide a scalable decentralized security solution that takes security one step beyond wallet security, focusing on the token&#x27;s ability to remain secure. The security is on the blockchain itself, which allows every demographic that has access to the internet to secure their assets without the need for current hardware or centralized solutions. Made to be a promising alternative, &lt;strong&gt;NFKBTs&lt;&#x2F;strong&gt; inherit all the characteristics of an ERC-721. This was done so &lt;strong&gt;NFKBTs&lt;&#x2F;strong&gt; could be used on every dApp that is configured to use traditional non-fungible tokens.&lt;&#x2F;p&gt;
&lt;p&gt;During the development process, the potential advantages &lt;strong&gt;KBT&#x27;s&lt;&#x2F;strong&gt; explored were the main motivation factors leading to their creation;&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Completely Decentralized:&lt;&#x2F;strong&gt; The security features are fully decentralized meaning no third-party will have access to user funds when activated. This was done to truly stay in line with the premise of self-custodial assets, responsibility and values.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Limitless Scalability:&lt;&#x2F;strong&gt; Centralized solutions require the creation of an account and their availability may be restricted based on location. &lt;strong&gt;NFKBT&#x27;s&lt;&#x2F;strong&gt; do not face regional restrictions or account creation. Decentralized security solutions such as hardware options face scalability issues requiring transport logistics, secure shipping and vendor. &lt;strong&gt;NFKBT&#x27;s&lt;&#x2F;strong&gt; can be used anywhere around the world by anyone who so wishes, provided they have access to the internet.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Fully Optional Security:&lt;&#x2F;strong&gt; Security features are optional, customizable and removable. It’s completely up to the user to decide the level of security they would like when using &lt;strong&gt;NFKBT&#x27;s&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Default Functionality:&lt;&#x2F;strong&gt; If the user would like to use &lt;strong&gt;NFKBT&#x27;s&lt;&#x2F;strong&gt; as a traditional ERC-721, the security features do not have to be activated. As the token inherits all of the same characteristics, it results in the token acting with traditional non-fungible &lt;strong&gt;Default Behaviors&lt;&#x2F;strong&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-4-2&quot;&gt;&lt;a href=&quot;#fn-4&quot;&gt;4&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;. However, even when the security features are activated, the user will still have the ability to customize the functionality of the various features based on their desired outcome. The user can pass a set of custom and or &lt;strong&gt;Default Values&lt;&#x2F;strong&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-7-1&quot;&gt;&lt;a href=&quot;#fn-7&quot;&gt;7&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; manually or through a dApp.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Unmatched Security:&lt;&#x2F;strong&gt; By calling the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6809&#x2F;#addbindings-function&quot;&gt;addBindings&lt;&#x2F;a&gt; function a &lt;strong&gt;Key Wallet&lt;&#x2F;strong&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-1-3&quot;&gt;&lt;a href=&quot;#fn-1&quot;&gt;1&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; is now required for the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6809&#x2F;#allowtransfer-function&quot;&gt;allowTransfer&lt;&#x2F;a&gt; or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6809&#x2F;#allowapproval-function&quot;&gt;allowApproval&lt;&#x2F;a&gt; function. The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6809&#x2F;#allowtransfer-function&quot;&gt;allowTransfer&lt;&#x2F;a&gt; function requires 4 parameters, &lt;code&gt;_tokenId&lt;&#x2F;code&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-8-1&quot;&gt;&lt;a href=&quot;#fn-8&quot;&gt;8&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;, &lt;code&gt;_time&lt;&#x2F;code&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-9-1&quot;&gt;&lt;a href=&quot;#fn-9&quot;&gt;9&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;, &lt;code&gt;_address&lt;&#x2F;code&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-10-1&quot;&gt;&lt;a href=&quot;#fn-10&quot;&gt;10&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;, and &lt;code&gt;_anyToken&lt;&#x2F;code&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-11-1&quot;&gt;&lt;a href=&quot;#fn-11&quot;&gt;11&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;, where as the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6809&#x2F;#allowapproval-function&quot;&gt;allowApproval&lt;&#x2F;a&gt; function has 2 parameters, &lt;code&gt;_time&lt;&#x2F;code&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-12-1&quot;&gt;&lt;a href=&quot;#fn-12&quot;&gt;12&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; and &lt;code&gt;_numberOfTransfers&lt;&#x2F;code&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-13-1&quot;&gt;&lt;a href=&quot;#fn-13&quot;&gt;13&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;. In addition to this, &lt;strong&gt;NFKBT&#x27;s&lt;&#x2F;strong&gt; have a &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6809&#x2F;#safefallback-function&quot;&gt;safeFallback&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6809&#x2F;#resetbindings-function&quot;&gt;resetBindings&lt;&#x2F;a&gt; function. The combination of all these prevent and virtually cover every single point of failure that is present with a traditional ERC-721, when properly used.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Security Fail-Safes:&lt;&#x2F;strong&gt; With &lt;strong&gt;NFKBTs&lt;&#x2F;strong&gt;, users can be confident that their tokens are safe and secure, even if the &lt;strong&gt;Holding Wallet&lt;&#x2F;strong&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-3-2&quot;&gt;&lt;a href=&quot;#fn-3&quot;&gt;3&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; or one of the &lt;strong&gt;Key Wallets&lt;&#x2F;strong&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-1-4&quot;&gt;&lt;a href=&quot;#fn-1&quot;&gt;1&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; has been compromised. If the owner suspects that the &lt;strong&gt;Holding Wallet&lt;&#x2F;strong&gt; has been compromised or lost access, they can call the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6809&#x2F;#safefallback-function&quot;&gt;safeFallback&lt;&#x2F;a&gt; function from one of the &lt;strong&gt;Key Wallets&lt;&#x2F;strong&gt;. This moves the assets to the other &lt;strong&gt;Key Wallet&lt;&#x2F;strong&gt; preventing a single point of failure. If the owner suspects that one of the &lt;strong&gt;Key Wallets&lt;&#x2F;strong&gt; has been comprised or lost access, the owner can call the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6809&#x2F;#resetbindings-function&quot;&gt;resetBindings&lt;&#x2F;a&gt; function from &lt;code&gt;_keyWallet1&lt;&#x2F;code&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-15-1&quot;&gt;&lt;a href=&quot;#fn-15&quot;&gt;14&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; or &lt;code&gt;_keyWallet2&lt;&#x2F;code&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-16-1&quot;&gt;&lt;a href=&quot;#fn-16&quot;&gt;15&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;. This resets the &lt;strong&gt;NFKBT&#x27;s&lt;&#x2F;strong&gt; security feature and allows the &lt;strong&gt;Holding Wallet&lt;&#x2F;strong&gt; to call the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6809&#x2F;#addbindings-function&quot;&gt;addBindings&lt;&#x2F;a&gt; function again. New &lt;strong&gt;Key Wallets&lt;&#x2F;strong&gt; can therefore be added and a single point of failure can be prevented.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Anonymous Security:&lt;&#x2F;strong&gt; Frequently, centralized solutions ask for personal information that is stored and subject to prying eyes. Purchasing decentralized hardware solutions are susceptible to the same issues e.g. a shipping address, payment information, or a camera recording during a physical cash pick-up. This may be considered by some as infringing on their privacy and asset anonymity. &lt;strong&gt;NFKBT&#x27;s&lt;&#x2F;strong&gt; ensure user confidentially as everything can be done remotely under a pseudonym on the blockchain.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Low-Cost Security:&lt;&#x2F;strong&gt; The cost of using &lt;strong&gt;NFKBT&#x27;s&lt;&#x2F;strong&gt; security features correlate to on-chain fees, the current &lt;em&gt;GWEI&lt;&#x2F;em&gt; at the given time. As a standalone solution, they are a viable cost-effective security measure feasible to the majority of the population.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Environmentally Friendly:&lt;&#x2F;strong&gt; Since the security features are coded into the &lt;strong&gt;NFKBT&lt;&#x2F;strong&gt;, there is no need for centralized servers, shipping, or the production of physical object&#x2F;s. Thus leading to a minimal carbon footprint by the use of &lt;strong&gt;NFKBT&#x27;s&lt;&#x2F;strong&gt;, working hand in hand with Ethereum’s change to a &lt;em&gt;PoS&lt;&#x2F;em&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-14-1&quot;&gt;&lt;a href=&quot;#fn-14&quot;&gt;16&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; network.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;User Experience:&lt;&#x2F;strong&gt; The security feature can be activated by a simple call to the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6809&#x2F;#addbindings-function&quot;&gt;addBindings&lt;&#x2F;a&gt; function. The user will only need two other wallets, which will act as &lt;code&gt;_keyWallet1&lt;&#x2F;code&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-15-2&quot;&gt;&lt;a href=&quot;#fn-15&quot;&gt;14&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; and &lt;code&gt;_keyWallet2&lt;&#x2F;code&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-16-2&quot;&gt;&lt;a href=&quot;#fn-16&quot;&gt;15&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;, to gain access to all of the benefits &lt;strong&gt;NFKBT&#x27;s&lt;&#x2F;strong&gt; offer. The optional security features improve the overall user experience and Ethereum ecosystem by ensuring a safety net for those who decide to use it. Those that do not use the security features are not hindered in any way. This safety net can increase global adoption as people can remain confident in the security of their assets, even in the scenario of a compromised wallet.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;ikbt721-token-contract&quot;&gt;&lt;code&gt;IKBT721&lt;&#x2F;code&gt; (Token Contract)&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;NOTES&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The following specifications use syntax from Solidity &lt;code&gt;0.8.17&lt;&#x2F;code&gt; (or above)&lt;&#x2F;li&gt;
&lt;li&gt;Callers MUST handle &lt;code&gt;false&lt;&#x2F;code&gt; from &lt;code&gt;returns (bool success)&lt;&#x2F;code&gt;. Callers MUST NOT assume that &lt;code&gt;false&lt;&#x2F;code&gt; is never returned!&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IKBT721&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AccountSecured&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _account&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _noOfTokens&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AccountResetBinding&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SafeFallbackActivated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AccountEnabledTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _time&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _anyToken&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AccountEnabledApproval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _time&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _numberOfTransfers&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Ingress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _account&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Egress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _account&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AccountHolderBindings&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; firstWallet&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; secondWallet&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FirstAccountBindings&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; accountHolderWallet&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; secondWallet&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SecondAccountBindings&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; accountHolderWallet&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; firstWallet&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransferConditions&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; time&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span&gt; anyToken&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ApprovalConditions&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; time&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; numberOfTransfers&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addBindings&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _keyWallet1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _keyWallet2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getBindings&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;AccountHolderBindings&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; resetBindings&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeFallback&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; allowTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _time&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _allTokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getTransferableFunds&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;TransferConditions&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; allowApproval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _time&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _numberOfTransfers&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getApprovalConditions&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;ApprovalConditions&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getNumberOfTransfersAllowed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isSecureWallet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isSecureToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;events&quot;&gt;Events&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;accountsecured-event&quot;&gt;&lt;code&gt;AccountSecured&lt;&#x2F;code&gt; event&lt;&#x2F;h4&gt;
&lt;p&gt;Emitted when the &lt;code&gt;_account&lt;&#x2F;code&gt; is securing his account by calling the &lt;code&gt;addBindings&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;_amount&lt;&#x2F;code&gt; is the current balance of the &lt;code&gt;_account&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AccountSecured&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _account&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;accountresetbinding-event&quot;&gt;&lt;code&gt;AccountResetBinding&lt;&#x2F;code&gt; event&lt;&#x2F;h4&gt;
&lt;p&gt;Emitted when the holder is resetting his &lt;code&gt;keyWallets&lt;&#x2F;code&gt; by calling the &lt;code&gt;resetBindings&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AccountResetBinding&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;safefallbackactivated-event&quot;&gt;&lt;code&gt;SafeFallbackActivated&lt;&#x2F;code&gt; event&lt;&#x2F;h4&gt;
&lt;p&gt;Emitted when the holder is choosing to move all the funds to one of the &lt;code&gt;keyWallets&lt;&#x2F;code&gt; by calling the &lt;code&gt;safeFallback&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SafeFallbackActivated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;accountenabledtransfer-event&quot;&gt;&lt;code&gt;AccountEnabledTransfer&lt;&#x2F;code&gt; event&lt;&#x2F;h4&gt;
&lt;p&gt;Emitted when the &lt;code&gt;_account&lt;&#x2F;code&gt; has allowed for transfer &lt;code&gt;_amount&lt;&#x2F;code&gt; of tokens for the &lt;code&gt;_time&lt;&#x2F;code&gt; amount of &lt;code&gt;block&lt;&#x2F;code&gt; seconds for &lt;code&gt;_to&lt;&#x2F;code&gt; address (or if
the &lt;code&gt;_account&lt;&#x2F;code&gt; has allowed for transfer all funds though &lt;code&gt;_anyToken&lt;&#x2F;code&gt; set to &lt;code&gt;true&lt;&#x2F;code&gt;) by calling the &lt;code&gt;allowTransfer&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AccountEnabledTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _account&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _time&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _allFunds&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;accountenabledapproval-event&quot;&gt;&lt;code&gt;AccountEnabledApproval&lt;&#x2F;code&gt; event&lt;&#x2F;h4&gt;
&lt;p&gt;Emitted when &lt;code&gt;_account&lt;&#x2F;code&gt; has allowed approval for the &lt;code&gt;_time&lt;&#x2F;code&gt; amount of &lt;code&gt;block&lt;&#x2F;code&gt; seconds by calling the &lt;code&gt;allowApproval&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AccountEnabledApproval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _account&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _time&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;ingress-event&quot;&gt;&lt;code&gt;Ingress&lt;&#x2F;code&gt; event&lt;&#x2F;h4&gt;
&lt;p&gt;Emitted when &lt;code&gt;_account&lt;&#x2F;code&gt; becomes a holder. &lt;code&gt;_amount&lt;&#x2F;code&gt; is the current balance of the &lt;code&gt;_account&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Ingress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _account&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;egress-event&quot;&gt;&lt;code&gt;Egress&lt;&#x2F;code&gt; event&lt;&#x2F;h4&gt;
&lt;p&gt;Emitted when &lt;code&gt;_account&lt;&#x2F;code&gt; transfers all his tokens and is no longer a holder. &lt;code&gt;_amount&lt;&#x2F;code&gt; is the previous balance of the &lt;code&gt;_account&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Egress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _account&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;interface-functions&quot;&gt;&lt;strong&gt;Interface functions&lt;&#x2F;strong&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The functions detailed below MUST be implemented.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;addbindings-function&quot;&gt;&lt;code&gt;addBindings&lt;&#x2F;code&gt; function&lt;&#x2F;h4&gt;
&lt;p&gt;Secures the sender account with other two wallets called &lt;code&gt;_keyWallet1&lt;&#x2F;code&gt; and &lt;code&gt;_keyWallet2&lt;&#x2F;code&gt; and MUST fire the &lt;code&gt;AccountSecured&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;p&gt;The function SHOULD &lt;code&gt;revert&lt;&#x2F;code&gt; if:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;the sender account is not a holder&lt;&#x2F;li&gt;
&lt;li&gt;or the sender is already secured&lt;&#x2F;li&gt;
&lt;li&gt;or the keyWallets are the same&lt;&#x2F;li&gt;
&lt;li&gt;or one of the keyWallets is the same as the sender&lt;&#x2F;li&gt;
&lt;li&gt;or one or both keyWallets are zero address (&lt;code&gt;0x0&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;or one or both keyWallets are already keyWallets to another holder account&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addBindings&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _keyWallet1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _keyWallet2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;getbindings-function&quot;&gt;&lt;code&gt;getBindings&lt;&#x2F;code&gt; function&lt;&#x2F;h4&gt;
&lt;p&gt;The function returns the &lt;code&gt;keyWallets&lt;&#x2F;code&gt; for the &lt;code&gt;_account&lt;&#x2F;code&gt; in a &lt;code&gt;struct&lt;&#x2F;code&gt; format.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AccountHolderBindings&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; firstWallet&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; secondWallet&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getBindings&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;AccountHolderBindings&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;resetbindings-function&quot;&gt;&lt;code&gt;resetBindings&lt;&#x2F;code&gt; function&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;&#x2F;strong&gt; This function is helpful when one of the two &lt;code&gt;keyWallets&lt;&#x2F;code&gt; is compromised.&lt;&#x2F;p&gt;
&lt;p&gt;Called from a &lt;code&gt;keyWallet&lt;&#x2F;code&gt;, the function resets the &lt;code&gt;keyWallets&lt;&#x2F;code&gt; for the &lt;code&gt;holder&lt;&#x2F;code&gt; account. MUST fire the &lt;code&gt;AccountResetBinding&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;p&gt;The function SHOULD &lt;code&gt;revert&lt;&#x2F;code&gt; if the sender is not a &lt;code&gt;keyWallet&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; resetBindings&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;safefallback-function&quot;&gt;&lt;code&gt;safeFallback&lt;&#x2F;code&gt; function&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;&#x2F;strong&gt; This function is helpful when the &lt;code&gt;holder&lt;&#x2F;code&gt; account is compromised.&lt;&#x2F;p&gt;
&lt;p&gt;Called from a &lt;code&gt;keyWallet&lt;&#x2F;code&gt;, this function transfers all the tokens from the &lt;code&gt;holder&lt;&#x2F;code&gt; account to the other &lt;code&gt;keyWallet&lt;&#x2F;code&gt; and MUST fire the &lt;code&gt;SafeFallbackActivated&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;p&gt;The function SHOULD &lt;code&gt;revert&lt;&#x2F;code&gt; if the sender is not a &lt;code&gt;keyWallet&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeFallback&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;allowtransfer-function&quot;&gt;&lt;code&gt;allowTransfer&lt;&#x2F;code&gt; function&lt;&#x2F;h4&gt;
&lt;p&gt;Called from a &lt;code&gt;keyWallet&lt;&#x2F;code&gt;, this function is called before a &lt;code&gt;transferFrom&lt;&#x2F;code&gt; or &lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt; functions are called.&lt;&#x2F;p&gt;
&lt;p&gt;It allows to transfer a tokenId, for a specific time frame, to a specific address.&lt;&#x2F;p&gt;
&lt;p&gt;If the tokenId is 0 then there will be no restriction on the tokenId.
If the time is 0 then there will be no restriction on the time.
If the to address is zero address then there will be no restriction on the to address.
Or if &lt;code&gt;_anyToken&lt;&#x2F;code&gt; is &lt;code&gt;true&lt;&#x2F;code&gt;, regardless of the other params, it allows any token, whenever, to anyone to be transferred of the holder.&lt;&#x2F;p&gt;
&lt;p&gt;The function MUST fire &lt;code&gt;AccountEnabledTransfer&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;p&gt;The function SHOULD &lt;code&gt;revert&lt;&#x2F;code&gt; if the sender is not a &lt;code&gt;keyWallet&lt;&#x2F;code&gt; for a holder or if the owner of the &lt;code&gt;_tokenId&lt;&#x2F;code&gt; is different than the &lt;code&gt;holder&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; allowTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _time&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _anyToken&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;gettransferablefunds-function&quot;&gt;&lt;code&gt;getTransferableFunds&lt;&#x2F;code&gt; function&lt;&#x2F;h4&gt;
&lt;p&gt;The function returns the transfer conditions for the &lt;code&gt;_account&lt;&#x2F;code&gt; in a &lt;code&gt;struct&lt;&#x2F;code&gt; format.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransferConditions&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; time&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bool&lt;&#x2F;span&gt;&lt;span&gt; anyToken&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getTransferableFunds&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;TransferConditions&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;allowapproval-function&quot;&gt;&lt;code&gt;allowApproval&lt;&#x2F;code&gt; function&lt;&#x2F;h4&gt;
&lt;p&gt;Called from a &lt;code&gt;keyWallet&lt;&#x2F;code&gt;, this function is called before &lt;code&gt;approve&lt;&#x2F;code&gt; or &lt;code&gt;setApprovalForAll&lt;&#x2F;code&gt; functions are called.&lt;&#x2F;p&gt;
&lt;p&gt;It allows the &lt;code&gt;holder&lt;&#x2F;code&gt; for a specific amount of &lt;code&gt;_time&lt;&#x2F;code&gt; to do an &lt;code&gt;approve&lt;&#x2F;code&gt; or &lt;code&gt;setApprovalForAll&lt;&#x2F;code&gt; and limit the number of transfers the spender is allowed to do through &lt;code&gt;_numberOfTransfers&lt;&#x2F;code&gt; (0 - unlimited number of transfers in the allowance limit).&lt;&#x2F;p&gt;
&lt;p&gt;The function MUST fire &lt;code&gt;AccountEnabledApproval&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;p&gt;The function SHOULD &lt;code&gt;revert&lt;&#x2F;code&gt; if the sender is not a &lt;code&gt;keyWallet&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; allowApproval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _time&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;getapprovalconditions-function&quot;&gt;&lt;code&gt;getApprovalConditions&lt;&#x2F;code&gt; function&lt;&#x2F;h4&gt;
&lt;p&gt;The function returns the approval conditions in a struct format. Where &lt;code&gt;time&lt;&#x2F;code&gt; is the &lt;code&gt;block.timestamp&lt;&#x2F;code&gt; until the &lt;code&gt;approve&lt;&#x2F;code&gt; or &lt;code&gt;setApprovalForAll&lt;&#x2F;code&gt; functions can be called, and &lt;code&gt;numberOfTransfers&lt;&#x2F;code&gt; is the number of transfers the spender will be allowed.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ApprovalConditions&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; time&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; numberOfTransfers&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getApprovalConditions&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;ApprovalConditions&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;transferfrom-function&quot;&gt;&lt;code&gt;transferFrom&lt;&#x2F;code&gt; function&lt;&#x2F;h4&gt;
&lt;p&gt;The function transfers from &lt;code&gt;_from&lt;&#x2F;code&gt; address to &lt;code&gt;_to&lt;&#x2F;code&gt; address the &lt;code&gt;_tokenId&lt;&#x2F;code&gt; token.&lt;&#x2F;p&gt;
&lt;p&gt;Each time a spender calls the function the contract subtracts and checks if the number of allowed transfers of that spender has reached 0,
and when that happens, the approval is revoked using a set approval for all to &lt;code&gt;false&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The function MUST fire the &lt;code&gt;Transfer&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;p&gt;The function SHOULD &lt;code&gt;revert&lt;&#x2F;code&gt; if:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;the sender is not the owner or is not approved to transfer the &lt;code&gt;_tokenId&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;or if the &lt;code&gt;_from&lt;&#x2F;code&gt; address is not the owner of the &lt;code&gt;_tokenId&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;or if the sender is a secure account and it has not allowed for transfer this &lt;code&gt;_tokenId&lt;&#x2F;code&gt; through &lt;code&gt;allowTransfer&lt;&#x2F;code&gt; function.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;safetransferfrom-function&quot;&gt;&lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt; function&lt;&#x2F;h4&gt;
&lt;p&gt;The function transfers from &lt;code&gt;_from&lt;&#x2F;code&gt; address to &lt;code&gt;_to&lt;&#x2F;code&gt; address the &lt;code&gt;_tokenId&lt;&#x2F;code&gt; token.&lt;&#x2F;p&gt;
&lt;p&gt;The function MUST fire the &lt;code&gt;Transfer&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;p&gt;The function SHOULD &lt;code&gt;revert&lt;&#x2F;code&gt; if:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;the sender is not the owner or is not approved to transfer the &lt;code&gt;_tokenId&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;or if the &lt;code&gt;_from&lt;&#x2F;code&gt; address is not the owner of the &lt;code&gt;_tokenId&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;or if the sender is a secure account and it has not allowed for transfer this &lt;code&gt;_tokenId&lt;&#x2F;code&gt; through &lt;code&gt;allowTransfer&lt;&#x2F;code&gt; function.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;safetransferfrom-function-with-data-parameter&quot;&gt;&lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt; function, with data parameter&lt;&#x2F;h4&gt;
&lt;p&gt;This works identically to the other function with an extra data parameter, except this function just sets data to &quot;&quot;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;approve-function&quot;&gt;&lt;code&gt;approve&lt;&#x2F;code&gt; function&lt;&#x2F;h4&gt;
&lt;p&gt;The function allows &lt;code&gt;_to&lt;&#x2F;code&gt; account to transfer the &lt;code&gt;_tokenId&lt;&#x2F;code&gt; from the sender account.&lt;&#x2F;p&gt;
&lt;p&gt;The function also limits the &lt;code&gt;_to&lt;&#x2F;code&gt; account to the specific number of transfers set in the &lt;code&gt;ApprovalConditions&lt;&#x2F;code&gt; for that &lt;code&gt;holder&lt;&#x2F;code&gt; account. If the value is &lt;code&gt;0&lt;&#x2F;code&gt; then the &lt;code&gt;_spender&lt;&#x2F;code&gt; can transfer multiple times.&lt;&#x2F;p&gt;
&lt;p&gt;The function MUST fire an &lt;code&gt;Approval&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;p&gt;If the function is called again it overrides the number of transfers allowed with &lt;code&gt;_numberOfTransfers&lt;&#x2F;code&gt;, set in &lt;code&gt;allowApproval&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;p&gt;The function SHOULD &lt;code&gt;revert&lt;&#x2F;code&gt; if:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;the sender is not the current NFT owner, or an authorized operator of the current owner&lt;&#x2F;li&gt;
&lt;li&gt;the NFT owner is secured and has not called &lt;code&gt;allowApproval&lt;&#x2F;code&gt; function&lt;&#x2F;li&gt;
&lt;li&gt;or if the &lt;code&gt;_time&lt;&#x2F;code&gt;, set in the &lt;code&gt;allowApproval&lt;&#x2F;code&gt; function, has elapsed.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC721&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC721&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;setapprovalforall-function&quot;&gt;&lt;code&gt;setApprovalForAll&lt;&#x2F;code&gt; function&lt;&#x2F;h4&gt;
&lt;p&gt;The function enables or disables approval for another account &lt;code&gt;_operator&lt;&#x2F;code&gt; to manage all of sender assets.&lt;&#x2F;p&gt;
&lt;p&gt;The function also limits the &lt;code&gt;_to&lt;&#x2F;code&gt; account to the specific number of transfers set in the &lt;code&gt;ApprovalConditions&lt;&#x2F;code&gt; for that &lt;code&gt;holder&lt;&#x2F;code&gt; account. If the value is &lt;code&gt;0&lt;&#x2F;code&gt; then the &lt;code&gt;_spender&lt;&#x2F;code&gt; can transfer multiple times.&lt;&#x2F;p&gt;
&lt;p&gt;The function Emits an &lt;code&gt;Approval&lt;&#x2F;code&gt; event indicating the updated allowance.&lt;&#x2F;p&gt;
&lt;p&gt;If the function is called again it overrides the number of transfers allowed with &lt;code&gt;_numberOfTransfers&lt;&#x2F;code&gt;, set in &lt;code&gt;allowApproval&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;p&gt;The function SHOULD &lt;code&gt;revert&lt;&#x2F;code&gt; if:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;the sender account is secured and has not called &lt;code&gt;allowApproval&lt;&#x2F;code&gt; function&lt;&#x2F;li&gt;
&lt;li&gt;or if the &lt;code&gt;_spender&lt;&#x2F;code&gt; is a zero address (&lt;code&gt;0x0&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;or if the &lt;code&gt;_time&lt;&#x2F;code&gt;, set in the &lt;code&gt;allowApproval&lt;&#x2F;code&gt; function, has elapsed.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setApprovalForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC721&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC721&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The intent from individual technical decisions made during the development of &lt;strong&gt;NFKBTs&lt;&#x2F;strong&gt; focused on maintaining consistency and backward compatibility with ERC-721s, all the while offering self-custodial security features to the user. It was important that &lt;strong&gt;NFKBT&#x27;s&lt;&#x2F;strong&gt; inherited all of ERC-721s characteristics to comply with requirements found in dApps which use non-fungible tokens on their platform. In doing so, it allowed for flawless backward compatibility to take place and gave the user the choice to decide if they want their &lt;strong&gt;NFKBTs&lt;&#x2F;strong&gt; to act with &lt;strong&gt;Default Behaviors&lt;&#x2F;strong&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-4-3&quot;&gt;&lt;a href=&quot;#fn-4&quot;&gt;4&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;. We wanted to ensure that wide-scale implementation and adoption of &lt;strong&gt;NFKBTs&lt;&#x2F;strong&gt; could take place immediately, without the greater collective needing to adapt and make changes to the already flourishing decentralized ecosystem.&lt;&#x2F;p&gt;
&lt;p&gt;For developers and users alike, the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6809&#x2F;#allowtransfer-function&quot;&gt;allowTransfer&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6809&#x2F;#allowapproval-function&quot;&gt;allowApproval&lt;&#x2F;a&gt; functions both return bools on success and revert on failures. This decision was done purposefully, to keep consistency with the already familiar ERC-721. Additional technical decisions related to self-custodial security features are broken down and located within the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6809&#x2F;#security-considerations&quot;&gt;Security Considerations&lt;&#x2F;a&gt; section.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;KBT&#x27;s&lt;&#x2F;strong&gt; are designed to be backward-compatible with existing token standards and wallets. Existing tokens and wallets will continue to function as normal, and will not be affected by the implementation of &lt;strong&gt;NFKBT&#x27;s&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6809&#x2F;assets&#x2F;README&#x2F;&quot;&gt;assets&lt;&#x2F;a&gt; directory has all the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6809&#x2F;.&#x2F;assets&#x2F;test&#x2F;kbt721.js&quot;&gt;tests&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Average Gas used (&lt;em&gt;GWEI&lt;&#x2F;em&gt;):&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;addBindings&lt;&#x2F;code&gt; - 155,096&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;resetBindings&lt;&#x2F;code&gt; - 30,588&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;safeFallback&lt;&#x2F;code&gt; - 72,221 (depending on how many NFTs the holder has)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;allowTransfer&lt;&#x2F;code&gt; - 50,025&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;allowApproval&lt;&#x2F;code&gt; - 44,983&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The implementation is located in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6809&#x2F;assets&#x2F;README&#x2F;&quot;&gt;assets&lt;&#x2F;a&gt; directory. There&#x27;s also a &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6809&#x2F;.&#x2F;assets&#x2F;Contract%20Interactions%20diagram.svg&quot;&gt;diagram&lt;&#x2F;a&gt; with the contract interactions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;NFKBT&#x27;s&lt;&#x2F;strong&gt; were designed with security in mind every step of the way. Below are some design decisions that were rigorously discussed and thought through during the development process.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Key Wallets&lt;&#x2F;strong&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-1-5&quot;&gt;&lt;a href=&quot;#fn-1&quot;&gt;1&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;: When calling the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6809&#x2F;#addbindings-function&quot;&gt;addBindings&lt;&#x2F;a&gt; function for an &lt;strong&gt;NFKBT&lt;&#x2F;strong&gt;, the user must input 2 wallets that will then act as &lt;code&gt;_keyWallet1&lt;&#x2F;code&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-15-3&quot;&gt;&lt;a href=&quot;#fn-15&quot;&gt;14&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; and &lt;code&gt;_keyWallet2&lt;&#x2F;code&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-16-3&quot;&gt;&lt;a href=&quot;#fn-16&quot;&gt;15&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;. They are added simultaneously to reduce user fees, minimize the chance of human error and prevent a pitfall scenario. If the user had the ability to add multiple wallets it would not only result in additional fees and avoidable confusion but would enable a potentially disastrous &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6809&#x2F;#safefallback-function&quot;&gt;safeFallback&lt;&#x2F;a&gt; situation to occur. For this reason, all &lt;strong&gt;KBT&#x27;s&lt;&#x2F;strong&gt; work under a 3-wallet system when security features are activated.&lt;&#x2F;p&gt;
&lt;p&gt;Typically if a wallet is compromised, the non-fungible assets within are at risk. With &lt;strong&gt;NFKBT&#x27;s&lt;&#x2F;strong&gt; there are two different functions that can be called from a &lt;strong&gt;Key Wallet&lt;&#x2F;strong&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-1-6&quot;&gt;&lt;a href=&quot;#fn-1&quot;&gt;1&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; depending on which wallet has been compromised.&lt;&#x2F;p&gt;
&lt;p&gt;Scenario: &lt;strong&gt;Holding Wallet&lt;&#x2F;strong&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-3-3&quot;&gt;&lt;a href=&quot;#fn-3&quot;&gt;3&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; has been compromised, call &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6809&#x2F;#safefallback-function&quot;&gt;safeFallback&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6809&#x2F;#safefallback-function&quot;&gt;safeFallback&lt;&#x2F;a&gt;: This function was created in the event that the owner believes the &lt;strong&gt;Holding Wallet&lt;&#x2F;strong&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-3-4&quot;&gt;&lt;a href=&quot;#fn-3&quot;&gt;3&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; has been compromised. It can also be used if the owner losses access to the &lt;strong&gt;Holding Wallet&lt;&#x2F;strong&gt;. In this scenario, the user has the ability to call &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6809&#x2F;#safefallback-function&quot;&gt;safeFallback&lt;&#x2F;a&gt; from one of the &lt;strong&gt;Key Wallets&lt;&#x2F;strong&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-1-7&quot;&gt;&lt;a href=&quot;#fn-1&quot;&gt;1&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;. &lt;strong&gt;NFKBT&#x27;s&lt;&#x2F;strong&gt; are then redirected from the &lt;strong&gt;Holding Wallet&lt;&#x2F;strong&gt; to the other &lt;strong&gt;Key Wallet&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;By redirecting the &lt;strong&gt;NFKBT&#x27;s&lt;&#x2F;strong&gt; it prevents a single point of failure. If an attacker were to call &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6809&#x2F;#safefallback-function&quot;&gt;safeFallback&lt;&#x2F;a&gt; and the &lt;strong&gt;NFKBT&#x27;s&lt;&#x2F;strong&gt; redirected to the &lt;strong&gt;Key Wallet&lt;&#x2F;strong&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-1-8&quot;&gt;&lt;a href=&quot;#fn-1&quot;&gt;1&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; that called the function, they would gain access to all the &lt;strong&gt;NFKBT&#x27;s&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Scenario: &lt;strong&gt;Key Wallet&lt;&#x2F;strong&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-1-9&quot;&gt;&lt;a href=&quot;#fn-1&quot;&gt;1&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; has been compromised, call &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6809&#x2F;#resetbindings-function&quot;&gt;resetBindings&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6809&#x2F;#resetbindings-function&quot;&gt;resetBindings&lt;&#x2F;a&gt;: This function was created in the event that the owner believes &lt;code&gt;_keyWallet1&lt;&#x2F;code&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-15-4&quot;&gt;&lt;a href=&quot;#fn-15&quot;&gt;14&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; or &lt;code&gt;_keyWallet2&lt;&#x2F;code&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-16-4&quot;&gt;&lt;a href=&quot;#fn-16&quot;&gt;15&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; has been compromised. It can also be used if the owner losses access to one of the &lt;strong&gt;Key Wallets&lt;&#x2F;strong&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-1-10&quot;&gt;&lt;a href=&quot;#fn-1&quot;&gt;1&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;. In this instance, the user has the ability to call &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6809&#x2F;#resetbindings-function&quot;&gt;resetBindings&lt;&#x2F;a&gt;, removing the bound &lt;strong&gt;Key Wallets&lt;&#x2F;strong&gt; and resetting the security features. The &lt;strong&gt;NFKBT&#x27;s&lt;&#x2F;strong&gt; will now function as a traditional ERC-721 until &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6809&#x2F;#addbindings-function&quot;&gt;addBindings&lt;&#x2F;a&gt; is called again and a new set of &lt;strong&gt;Key Wallets&lt;&#x2F;strong&gt; are added.&lt;&#x2F;p&gt;
&lt;p&gt;The reason why &lt;code&gt;_keyWallet1&lt;&#x2F;code&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-15-5&quot;&gt;&lt;a href=&quot;#fn-15&quot;&gt;14&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; or &lt;code&gt;_keyWallet2&lt;&#x2F;code&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-16-5&quot;&gt;&lt;a href=&quot;#fn-16&quot;&gt;15&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; are required to call the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6809&#x2F;#resetbindings-function&quot;&gt;resetBindings&lt;&#x2F;a&gt; function is because a &lt;strong&gt;Holding Wallet&lt;&#x2F;strong&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-3-5&quot;&gt;&lt;a href=&quot;#fn-3&quot;&gt;3&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; having the ability to call &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6809&#x2F;#resetbindings-function&quot;&gt;resetBindings&lt;&#x2F;a&gt; could result in an immediate loss of &lt;strong&gt;NFKBT&#x27;s&lt;&#x2F;strong&gt;. The attacker would only need to gain access to the &lt;strong&gt;Holding Wallet&lt;&#x2F;strong&gt; and call &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6809&#x2F;#resetbindings-function&quot;&gt;resetBindings&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;In the scenario that 2 of the 3 wallets have been compromised, there is nothing the owner of the &lt;strong&gt;NFKBT&#x27;s&lt;&#x2F;strong&gt; can do if the attack is malicious. However, by allowing 1 wallet to be compromised, holders of non-fungible tokens built using the &lt;strong&gt;NFKBT&lt;&#x2F;strong&gt; standard are given a second chance, unlike other current standards.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6809&#x2F;#allowtransfer-function&quot;&gt;allowTransfer&lt;&#x2F;a&gt; function is in place to guarantee a &lt;strong&gt;Safe Transfer&lt;&#x2F;strong&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-2-2&quot;&gt;&lt;a href=&quot;#fn-2&quot;&gt;2&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;, but can also have &lt;strong&gt;Default Values&lt;&#x2F;strong&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-7-2&quot;&gt;&lt;a href=&quot;#fn-7&quot;&gt;7&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; set by a dApp to emulate &lt;strong&gt;Default Behaviors&lt;&#x2F;strong&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-3-6&quot;&gt;&lt;a href=&quot;#fn-3&quot;&gt;3&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; of a traditional ERC-721. It enables the user to highly specify the type of transfer they are about to conduct, whilst simultaneously allowing the user to unlock all the &lt;strong&gt;NFKBT&#x27;s&lt;&#x2F;strong&gt; to anyone for an unlimited amount of time. The desired security is completely up to the user.&lt;&#x2F;p&gt;
&lt;p&gt;This function requires 4 parameters to be filled and different combinations of these result in different levels of security;&lt;&#x2F;p&gt;
&lt;p&gt;Parameter 1 &lt;code&gt;_tokenId&lt;&#x2F;code&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-8-2&quot;&gt;&lt;a href=&quot;#fn-8&quot;&gt;8&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;: This is the ID of the &lt;strong&gt;NFKBT&lt;&#x2F;strong&gt; that will be spent on a transfer.&lt;&#x2F;p&gt;
&lt;p&gt;Parameter 2 &lt;code&gt;_time&lt;&#x2F;code&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-9-2&quot;&gt;&lt;a href=&quot;#fn-9&quot;&gt;9&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;: The number of blocks the &lt;strong&gt;NFKBT&lt;&#x2F;strong&gt; can be transferred starting from the current block timestamp.&lt;&#x2F;p&gt;
&lt;p&gt;Parameter 3 &lt;code&gt;_address&lt;&#x2F;code&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-10-2&quot;&gt;&lt;a href=&quot;#fn-10&quot;&gt;10&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;: The destination the &lt;strong&gt;NFKBT&lt;&#x2F;strong&gt; will be sent to.&lt;&#x2F;p&gt;
&lt;p&gt;Parameter 4 &lt;code&gt;_anyToken&lt;&#x2F;code&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-11-2&quot;&gt;&lt;a href=&quot;#fn-11&quot;&gt;11&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;: This is a boolean value. When false, the &lt;code&gt;transferFrom&lt;&#x2F;code&gt; function takes into consideration Parameters 1, 2 and 3. If the value is true, the &lt;code&gt;transferFrom&lt;&#x2F;code&gt; function will revert to a &lt;strong&gt;Default Behavior&lt;&#x2F;strong&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-4-4&quot;&gt;&lt;a href=&quot;#fn-4&quot;&gt;4&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;, the same as a traditional ERC-721.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6809&#x2F;#allowtransfer-function&quot;&gt;allowTransfer&lt;&#x2F;a&gt; function requires &lt;code&gt;_keyWallet1&lt;&#x2F;code&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-15-6&quot;&gt;&lt;a href=&quot;#fn-15&quot;&gt;14&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; or &lt;code&gt;_keyWallet2&lt;&#x2F;code&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-16-6&quot;&gt;&lt;a href=&quot;#fn-16&quot;&gt;15&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; and enables the &lt;strong&gt;Holding Wallet&lt;&#x2F;strong&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-3-7&quot;&gt;&lt;a href=&quot;#fn-3&quot;&gt;3&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; to conduct a &lt;code&gt;transferFrom&lt;&#x2F;code&gt; within the previously specified parameters. These parameters were added in order to provide additional security by limiting the &lt;strong&gt;Holding Wallet&lt;&#x2F;strong&gt; in case it was compromised without the user&#x27;s knowledge.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6809&#x2F;#allowapproval-function&quot;&gt;allowApproval&lt;&#x2F;a&gt; function provides extra security when allowing on-chain third parties to use your &lt;strong&gt;NFKBT&#x27;s&lt;&#x2F;strong&gt; on your behalf. This is especially useful when a user is met with common malicious attacks e.g. draining dApp.&lt;&#x2F;p&gt;
&lt;p&gt;This function requires 2 parameters to be filled and different combinations of these result in different levels of security;&lt;&#x2F;p&gt;
&lt;p&gt;Parameter 1 &lt;code&gt;_time&lt;&#x2F;code&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-12-2&quot;&gt;&lt;a href=&quot;#fn-12&quot;&gt;12&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;: The number of blocks that the approval of a third-party service can take place, starting from the current block timestamp.&lt;&#x2F;p&gt;
&lt;p&gt;Parameter 2 &lt;code&gt;_numberOfTransfers_&lt;&#x2F;code&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-13-2&quot;&gt;&lt;a href=&quot;#fn-13&quot;&gt;13&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;: The number of transactions a third-party service can conduct on the user&#x27;s behalf.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6809&#x2F;#allowapproval-function&quot;&gt;allowApproval&lt;&#x2F;a&gt; function requires &lt;code&gt;_keyWallet1&lt;&#x2F;code&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-15-7&quot;&gt;&lt;a href=&quot;#fn-15&quot;&gt;14&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; or &lt;code&gt;_keyWallet2&lt;&#x2F;code&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-16-7&quot;&gt;&lt;a href=&quot;#fn-16&quot;&gt;15&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; and enables the &lt;strong&gt;Holding Wallet&lt;&#x2F;strong&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-3-8&quot;&gt;&lt;a href=&quot;#fn-3&quot;&gt;3&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; to allow a third-party service by using the &lt;code&gt;approve&lt;&#x2F;code&gt; function. These parameters were added to provide extra security when granting permission to a third-party that uses assets on the user&#x27;s behalf. Parameter 1, &lt;code&gt;_time&lt;&#x2F;code&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-12-3&quot;&gt;&lt;a href=&quot;#fn-12&quot;&gt;12&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;, is a limitation to when the &lt;strong&gt;Holding Wallet&lt;&#x2F;strong&gt; can &lt;code&gt;approve&lt;&#x2F;code&gt; a third-party service. Parameter 2, &lt;code&gt;_numberOfTransfers&lt;&#x2F;code&gt;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-13-3&quot;&gt;&lt;a href=&quot;#fn-13&quot;&gt;13&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;, is a limitation to the number of transactions the approved third-party service can conduct on the user&#x27;s behalf before revoking approval.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;section class=&quot;footnotes&quot;&gt;
&lt;ol class=&quot;footnotes-list&quot;&gt;
&lt;li id=&quot;fn-1&quot;&gt;
&lt;p&gt;The &lt;strong&gt;Key Wallet&#x2F;s&lt;&#x2F;strong&gt; refers to &lt;code&gt;_keyWallet1&lt;&#x2F;code&gt; or &lt;code&gt;_keyWallet2&lt;&#x2F;code&gt; which can call the &lt;code&gt;safeFallback&lt;&#x2F;code&gt;, &lt;code&gt;resetBindings&lt;&#x2F;code&gt;, &lt;code&gt;allowTransfer&lt;&#x2F;code&gt; and &lt;code&gt;allowApproval&lt;&#x2F;code&gt; functions. &lt;a href=&quot;#fr-1-1&quot;&gt;↩&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-1-2&quot;&gt;↩2&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-1-3&quot;&gt;↩3&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-1-4&quot;&gt;↩4&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-1-5&quot;&gt;↩5&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-1-6&quot;&gt;↩6&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-1-7&quot;&gt;↩7&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-1-8&quot;&gt;↩8&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-1-9&quot;&gt;↩9&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-1-10&quot;&gt;↩10&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li id=&quot;fn-2&quot;&gt;
&lt;p&gt;A &lt;strong&gt;Safe Transfer&lt;&#x2F;strong&gt; is when 1 of the &lt;strong&gt;Key Wallets&lt;&#x2F;strong&gt; safely approved the use of the &lt;strong&gt;NFKBT&#x27;s&lt;&#x2F;strong&gt;. &lt;a href=&quot;#fr-2-1&quot;&gt;↩&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-2-2&quot;&gt;↩2&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li id=&quot;fn-3&quot;&gt;
&lt;p&gt;The &lt;strong&gt;Holding Wallet&lt;&#x2F;strong&gt; refers to the wallet containing the &lt;strong&gt;NFKBT&#x27;s&lt;&#x2F;strong&gt;. &lt;a href=&quot;#fr-3-1&quot;&gt;↩&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-3-2&quot;&gt;↩2&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-3-3&quot;&gt;↩3&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-3-4&quot;&gt;↩4&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-3-5&quot;&gt;↩5&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-3-6&quot;&gt;↩6&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-3-7&quot;&gt;↩7&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-3-8&quot;&gt;↩8&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li id=&quot;fn-4&quot;&gt;
&lt;p&gt;A &lt;strong&gt;Default Behavior&#x2F;s&lt;&#x2F;strong&gt; refers to behavior&#x2F;s present in the preexisting non-fungible ERC-721 standard. &lt;a href=&quot;#fr-4-1&quot;&gt;↩&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-4-2&quot;&gt;↩2&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-4-3&quot;&gt;↩3&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-4-4&quot;&gt;↩4&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li id=&quot;fn-5&quot;&gt;
&lt;p&gt;The number of crypto scam reports the United States Federal Trade Commission received, from January 2021 through March 2022. &lt;a href=&quot;#fr-5-1&quot;&gt;↩&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li id=&quot;fn-6&quot;&gt;
&lt;p&gt;The amount stolen via crypto scams according to the United States Federal Trade Commission, from January 2021 through March 2022. &lt;a href=&quot;#fr-6-1&quot;&gt;↩&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li id=&quot;fn-7&quot;&gt;
&lt;p&gt;A &lt;strong&gt;Default Value&#x2F;s&lt;&#x2F;strong&gt; refer to a value&#x2F;s that emulates the non-fungible ERC-721 &lt;strong&gt;Default Behavior&#x2F;s&lt;&#x2F;strong&gt;. &lt;a href=&quot;#fr-7-1&quot;&gt;↩&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-7-2&quot;&gt;↩2&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li id=&quot;fn-8&quot;&gt;
&lt;p&gt;The &lt;code&gt;_tokenId&lt;&#x2F;code&gt; represents the ID of the &lt;strong&gt;NFKBT&lt;&#x2F;strong&gt; intended to be spent. &lt;a href=&quot;#fr-8-1&quot;&gt;↩&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-8-2&quot;&gt;↩2&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li id=&quot;fn-9&quot;&gt;
&lt;p&gt;The &lt;code&gt;_time&lt;&#x2F;code&gt; in &lt;code&gt;allowTransfer&lt;&#x2F;code&gt; represents the number of blocks a &lt;code&gt;transferFrom&lt;&#x2F;code&gt; can take place in. &lt;a href=&quot;#fr-9-1&quot;&gt;↩&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-9-2&quot;&gt;↩2&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li id=&quot;fn-10&quot;&gt;
&lt;p&gt;The &lt;code&gt;_address&lt;&#x2F;code&gt; represents the address that the &lt;strong&gt;NFKBT&lt;&#x2F;strong&gt; will be sent to. &lt;a href=&quot;#fr-10-1&quot;&gt;↩&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-10-2&quot;&gt;↩2&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li id=&quot;fn-11&quot;&gt;
&lt;p&gt;The &lt;code&gt;_anyToken&lt;&#x2F;code&gt; is a bool that can be set to true or false. &lt;a href=&quot;#fr-11-1&quot;&gt;↩&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-11-2&quot;&gt;↩2&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li id=&quot;fn-12&quot;&gt;
&lt;p&gt;The &lt;code&gt;_time&lt;&#x2F;code&gt; in &lt;code&gt;allowApproval&lt;&#x2F;code&gt; represents the number of blocks an &lt;code&gt;approve&lt;&#x2F;code&gt; can take place in. &lt;a href=&quot;#fr-12-1&quot;&gt;↩&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-12-2&quot;&gt;↩2&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-12-3&quot;&gt;↩3&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li id=&quot;fn-13&quot;&gt;
&lt;p&gt;The &lt;code&gt;_numberOfTransfers&lt;&#x2F;code&gt; is the number of transfers a third-party entity can conduct via &lt;code&gt;transferFrom&lt;&#x2F;code&gt; on the user&#x27;s behalf. &lt;a href=&quot;#fr-13-1&quot;&gt;↩&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-13-2&quot;&gt;↩2&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-13-3&quot;&gt;↩3&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li id=&quot;fn-15&quot;&gt;
&lt;p&gt;The &lt;code&gt;_keyWallet1&lt;&#x2F;code&gt; is 1 of the 2 &lt;strong&gt;Key Wallets&lt;&#x2F;strong&gt; set when calling the &lt;code&gt;addBindings&lt;&#x2F;code&gt; function. &lt;a href=&quot;#fr-15-1&quot;&gt;↩&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-15-2&quot;&gt;↩2&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-15-3&quot;&gt;↩3&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-15-4&quot;&gt;↩4&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-15-5&quot;&gt;↩5&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-15-6&quot;&gt;↩6&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-15-7&quot;&gt;↩7&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li id=&quot;fn-16&quot;&gt;
&lt;p&gt;The &lt;code&gt;_keyWallet2&lt;&#x2F;code&gt; is 1 of the 2 &lt;strong&gt;Key Wallets&lt;&#x2F;strong&gt; set when calling the &lt;code&gt;addBindings&lt;&#x2F;code&gt; function. &lt;a href=&quot;#fr-16-1&quot;&gt;↩&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-16-2&quot;&gt;↩2&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-16-3&quot;&gt;↩3&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-16-4&quot;&gt;↩4&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-16-5&quot;&gt;↩5&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-16-6&quot;&gt;↩6&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-16-7&quot;&gt;↩7&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li id=&quot;fn-14&quot;&gt;
&lt;p&gt;A &lt;em&gt;PoS&lt;&#x2F;em&gt; protocol, Proof-of-Stake protocol, is a cryptocurrency consensus mechanism for processing transactions and creating new blocks in a blockchain. &lt;a href=&quot;#fr-14-1&quot;&gt;↩&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;section&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>ERC-721 Holding Time Tracking</title>
        <published>2023-03-30T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Saitama</name><uri>https://github.com/saitama2009</uri>
	</author>
	
	<author>
		<name>Combo</name><email>combo@1combo.io</email>
	</author>
	
	<author>
		<name>Luigi</name><email>luigi@1combo.io</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6806/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/draft-eip-erc721-holding-time-tracking/13605" />
        

        <id>https://wg-eips.ritovision.com/6806/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:6806"
            label="ERC-6806" />
        

        
        

        
        <summary type="html">Add holding time information to ERC-721 tokens</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6806/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is an extension of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;. It adds an interface that tracks and describes the holding time of a Non-Fungible Token (NFT) by an account.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;In some use cases, it is valuable to know the duration for which a NFT has been held by an account. This information can be useful for rewarding long-term holders, determining access to exclusive content, or even implementing specific business logic based on holding time. However, the current ERC-721 standard does not have a built-in mechanism to track NFT holding time.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal aims to address these limitations by extending the ERC-721 standard to include holding time tracking functionality.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Interface&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The following interface extends the existing ERC-721 standard:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6806&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getHoldingInfo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; holder&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; holdingTime&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Functions&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;getholdinginfo&quot;&gt;getHoldingInfo&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function getHoldingInfo(uint256 tokenId) external view returns (address holder, uint256 holdingTime);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This function returns the current holder of the specified NFT and the length of time (in seconds) the NFT has been held by the current account.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;tokenId&lt;&#x2F;code&gt;: The unique identifier of the NFT.&lt;&#x2F;li&gt;
&lt;li&gt;Returns: A tuple containing the current holder&#x27;s address and the holding time (in seconds).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The addition of the &lt;code&gt;getHoldingInfo&lt;&#x2F;code&gt; function to an extension of the ERC-721 standard enables developers to implement NFT-based applications that require holding time information. This extension maintains compatibility with existing ERC-721 implementations while offering additional functionality for new use cases.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;getHoldingInfo&lt;&#x2F;code&gt; function provides a straightforward method for retrieving the holding time and holder address of an NFT. By using seconds as the unit of time for holding duration, it ensures precision and compatibility with other time-based functions in smart contracts.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;getHoldingInfo&lt;&#x2F;code&gt; returns both &lt;code&gt;holder&lt;&#x2F;code&gt; and &lt;code&gt;holdingTime&lt;&#x2F;code&gt; so that some token owners (as decided by the implementation) can be ignored for the purposes of calculating holding time. For example, a contract may take ownership of an NFT as collateral for a loan. Such a loan contract could be ignored, so the real owner&#x27;s holding time increases properly.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal is fully backwards compatible with the existing ERC-721 standard, as it extends the standard with new functions that do not affect the core functionality.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;access&#x2F;Ownable.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC721&#x2F;ERC721.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERC6806.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC6806&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Ownable&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC6806&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _holder&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _holdStart&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _holdingTimeWhitelist&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; symbol_&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;name_, symbol_) &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _afterTokenTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; firstotTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;_holdingTimeWhitelist&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span&gt; _holdingTimeWhitelist&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;_holder&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;firstotTokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            _holder&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;firstotTokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            _holdStart&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;firstotTokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getHoldingInfo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; holder&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; holdingTime&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;_holder&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt; _holdStart&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setHoldingTimeWhitelistedAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ignoreReset&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _holdingTimeWhitelist&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; ignoreReset&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; HoldingTimeWhitelistSet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; ignoreReset&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces additional state management for tracking holding times, which may have security implications. Implementers should be cautious of potential vulnerabilities related to holding time manipulation, especially during transfers.&lt;&#x2F;p&gt;
&lt;p&gt;When implementing this EIP, developers should be mindful of potential attack vectors, such as reentrancy and front-running attacks, as well as general security best practices for smart contracts. Adequate testing and code review should be performed to ensure the safety and correctness of the implementation.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore, developers should consider the gas costs associated with maintaining and updating holding time information. Optimizations may be necessary to minimize the impact on contract execution costs.&lt;&#x2F;p&gt;
&lt;p&gt;It is also important to note that the accuracy of holding time information depends on the accuracy of the underlying blockchain&#x27;s timestamp. While block timestamps are generally reliable, they can be manipulated by miners to some extent. As a result, holding time data should not be relied upon as a sole source of truth in situations where absolute precision is required.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Token Mapping Slot Retrieval Extension</title>
        <published>2023-03-29T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>qdqd</name><uri>https://github.com/qd-qd</uri><email>qdqdqdqdqd@protonmail.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6823/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6823-token-mapping-slot-retrieval-extension/13666" />
        

        <id>https://wg-eips.ritovision.com/6823/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:6823"
            label="ERC-6823" />
        

        
        

        
        <summary type="html">Approach to enhance precision of off-chain transaction simulations by accessing mapping storage slot in ERC-20&#x2F;721&#x2F;1155 contracts.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6823/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The aim of this proposal is to enhance the precision of off-chain simulations for transactions that involve contracts complying with the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;, or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; standards. To achieve this, a method is proposed for obtaining the reserved storage slot of the mapping responsible to track ownership of compliant tokens. The proposed extension offers a standardized entry point that allows for identifying the reserved storage slot of a mapping in a compatible manner. This not only facilitates capturing state changes more precisely but also enables external tools and services to do so without requiring expertise in the particular implementation details.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;To understand the rationale behind this proposal, it&#x27;s important to remember how values and mapping are stored in the storage layout. This procedure is language-agnostic; it can be applied to multiple programming languages beyond Solidity, including Vyper.&lt;&#x2F;p&gt;
&lt;p&gt;The storage layout is a way to persistently store data in Ethereum smart contracts. In the EVM, storage is organized as a key-value store, where each key is a 32-byte location, and each value is a 32-byte word. When you define a state variable in a contract, it is assigned to a storage location. The location is determined by the variable&#x27;s position in the contract&#x27;s storage structure. The first variable in the contract is assigned to location 0, the second to location 1, and so on. Multiple values less than 32 bytes can be grouped to fit in a single slot if possible.&lt;&#x2F;p&gt;
&lt;p&gt;Due to their indeterminate size, mappings utilize a specialized storage arrangement. Instead of storing mappings &quot;in between&quot; state variables, they are allocated to occupy 32 bytes only, and their elements are stored in a distinct storage slot computed through a keccak-256 hash. The location of the value corresponding to a mapping key &lt;code&gt;k&lt;&#x2F;code&gt; is determined by concatenating &lt;code&gt;h(k)&lt;&#x2F;code&gt; and &lt;code&gt;p&lt;&#x2F;code&gt; and performing a keccak-256 hash. The value of &lt;code&gt;p&lt;&#x2F;code&gt; is the position of the mapping in the storage layout, which depends on the order and the nature of the variables initialized before the mapping. It can&#x27;t be determined in a universal way as you have to know how the implementation of the contract is done.&lt;&#x2F;p&gt;
&lt;p&gt;Due to the nature of the mapping type, it is challenging to simulate transactions that involve smart contracts because the storage layout for different contracts is unique to their specific implementation, etched by their variable requirements and the order of their declaration. Since the storage location of a value in a mapping variable depends on this implementation-sensitive storage slot, we cannot guarantee similarity on the off-chain simulation version that an on-chain attempted interaction will result in.&lt;&#x2F;p&gt;
&lt;p&gt;This hurdle prevents external platforms and tools from capturing&#x2F;validating changes made to the contract&#x27;s state with certainty.&lt;&#x2F;p&gt;
&lt;p&gt;That&#x27;s why transaction simulation relies heavily on events. However, this approach has limitations, and events should only be informative and not relied upon as the single source of truth. The state is and must be the only source of truth. Furthermore, it is impossible to know the shape of the storage deterministically and universally, which prevents us from verifying the source of truth that is storage, forcing us to rely on information emitted from the application layer.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;The proposal suggests an extension to the ERC-20&#x2F;ERC-721&#x2F;ERC-1155 standards that allows retrieving the reserved storage slot for the mapping type in any compliant smart-contract implementation in a deterministic manner. This method eliminates the reliance on events and enhances the precision of the data access from storage. The proposed extension therefore enables accurate off-chain simulations. The outcome is greater transparency and predictability at no extra cost for the caller, and a negigleable increase in the deployment cost of the contract.&lt;&#x2F;p&gt;
&lt;p&gt;The proposed extension is a single function that returns the reserved storage slot for the mapping type in any ERC-20&#x2F;ERC-721&#x2F;ERC-1155 compliant smart-contract implementation. The function is named &lt;code&gt;getTokenLocationRoot&lt;&#x2F;code&gt; and is declared as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;abstract&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC20Extension&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC20&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getTokenLocationRoot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; slot&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            slot &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt;mapping_name&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;abstract&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721Extension&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getTokenLocationRoot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; slot&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            slot &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt;mapping_name&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;abstract&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC1155Extension&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC1155&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getTokenLocationRoot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; slot&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            slot &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt;mapping_name&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;For these contracts, off-chain callers can use the &lt;code&gt;getTokenLocationRoot()&lt;&#x2F;code&gt; function to find the reserved storage slot for the mapping type. This function returns the reserved storage slot for the mapping type in the contract. This location is used to calculate where all the values of the mapping will be stored. Knowing this value makes it possible to determine precisely where each value of the mapping will be stored, regardless of the contract&#x27;s implementation. The caller can use this slot to calculate the storage slot for a specific token ID and compare the value to the expected one to verify the action stated by the event. In the case of a ERC-721 mint, the caller can compare the value of the storage slot to the address of the token&#x27;s owner. In the case of a ERC-20 transfer, the caller can compare the value of the storage slot to the address of the token&#x27;s new owner. In the case of a ERC-1155 burn, the caller can compare the value of the storage slot to the zero address. The off-chain comparison can be performed with any of the many tools available. In addition, it could perhaps allow storage to be proven atomically by not proving the entire state but only a location -- to track ownership of a specific token, for example.&lt;&#x2F;p&gt;
&lt;p&gt;The name of the function is intentionally generic to allow the same implementation for all the different token standards. Once implemented universally, the selector derived from the signature of this function will be a single, universal entry point that can be used to directly read the slots in the storage responsible of the ownership, of any token contract. This will make off-chain simulations significantly more accurate, and the events will be used for informational purposes only.&lt;&#x2F;p&gt;
&lt;p&gt;Contract implementers MUST implement the &lt;code&gt;getTokenLocationRoot()&lt;&#x2F;code&gt; function in their contracts. The function MUST return the reserved storage slot for the mapping type in the contract. The function SHOULD be declared as &lt;code&gt;external pure&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The idea behind the implementation was to find an elegant and concise way that avoided any breaking changes with the current standard. Moreover, since gas consumption is crucial, it was inconceivable to find an implementation that would cost gas to the final user. In this case, the addition of a function increases the deployment cost of the contract in a minimal way, but its use is totally free for the external actors.&lt;&#x2F;p&gt;
&lt;p&gt;The implementation is minimalist in order to be as flexible as possible while being directly compatible with the main programming languages used today to develop smart-contracts for the EVM.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues have been found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;abstract&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC20Extension&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC20&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getTokenLocationRoot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; slot&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            slot &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt;mapping_name&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;abstract&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721Extension&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getTokenLocationRoot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; slot&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            slot &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt;mapping_name&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;abstract&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC1155Extension&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC1155&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getTokenLocationRoot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; slot&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            slot &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt;mapping_name&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;No security issues are raised by the implementation of this extension.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>ERC-721 Utilities Information Extension</title>
        <published>2023-03-27T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Otniel Nicola</name><uri>https://github.com/OT-kthd</uri>
	</author>
	
	<author>
		<name>Bogdan Popa</name><uri>https://github.com/BogdanKTHD</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6785/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6785-erc-721-utilities-extension/13568" />
        

        <id>https://wg-eips.ritovision.com/6785/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:6785"
            label="ERC-6785" />
        

        
        

        
        <summary type="html">Provide easy access to information about the `utility` of an NFT via functions and the NFT&#x27;s metadata</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6785/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This specification defines standard functions and an extension of the metadata schema that outlines what a
token&#x27;s utility entails and how the utility may be used and&#x2F;or accessed.
This specification is an optional extension of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This specification aims to clarify what the utility associated with an NFT is and how to access this utility.
Relying on third-party platforms to obtain information regarding the utility of the NFT that one owns can lead to scams,
phishing or other forms of fraud.&lt;&#x2F;p&gt;
&lt;p&gt;Currently, utilities that are offered with NFTs are not captured on-chain. We want the utility of an NFT to be part of
the metadata of an NFT. The metadata information would include: a) type of utility, b) description
of utility, c) frequency and duration of utility, and d) expiration of utility. This will provide transparency as to the
utility terms, and greater accountability on the creator to honor these utilities.&lt;&#x2F;p&gt;
&lt;p&gt;As the instructions on how to access a given utility may change over time, there should be a historical record of these
changes for transparency.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and
“OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;Every contract compliant with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6785&#x2F;&quot;&gt;ERC-6785&lt;&#x2F;a&gt; MUST implement the interface defined as follows:&lt;&#x2F;p&gt;
&lt;h3 id=&quot;contract-interface&quot;&gt;Contract Interface&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @title NFT Utility description&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;  Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the EIP-165 identifier for this interface is ed231d73&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6785&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Logged when the utility description URL of an NFT is &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when the utilityURL of an NFT is &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The empty string for `utilityUri` indicates that there is no utility associated&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UpdateUtility&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; utilityUri&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; set the new utilityUri - remember the date it was set on&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The empty string indicates there is no utility&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws if `tokenId` is not valid NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; utilityUri&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  The new utility description of the NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 4a048176&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setUtilityUri&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; utilityUri&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the utilityUri of an NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The empty string for `utilityUri` indicates that there is no utility associated&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT to get the user address for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; utility uri for this NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 5e470cbc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; utilityUriOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the changes made to utilityUri&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT to get the user address for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; history of changes to `utilityUri` for this NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; f96090b9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; utilityHistoryOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;All functions defined as view MAY be implemented as pure or view&lt;&#x2F;p&gt;
&lt;p&gt;Function &lt;code&gt;setUtilityUri&lt;&#x2F;code&gt; MAY be implemented as public or external. Also, the ability to set the &lt;code&gt;utilityUri&lt;&#x2F;code&gt; SHOULD be
restricted to the one who&#x27;s offering the utility, whether that&#x27;s the NFT creator or someone else.&lt;&#x2F;p&gt;
&lt;p&gt;The event &lt;code&gt;UpdateUtility&lt;&#x2F;code&gt; MUST be emitted when the &lt;code&gt;setUtilityUri&lt;&#x2F;code&gt; function is called or any other time that the utility
of the token is changed, like in batch updates.&lt;&#x2F;p&gt;
&lt;p&gt;The method &lt;code&gt;utilityHistoryOf&lt;&#x2F;code&gt; MUST reflect all changes made to the &lt;code&gt;utilityUri&lt;&#x2F;code&gt; of a tokenId, whether that&#x27;s done
through &lt;code&gt;setUtilityUri&lt;&#x2F;code&gt; or by any other means, such as bulk updates&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; method MUST return true when called with &lt;code&gt;ed231d73&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The original metadata SHOULD conform to the “ERC-6785 Metadata with utilities JSON Schema” which is a compatible
extension of the “ERC-721 Metadata JSON Schema” defined in ERC-721.&lt;&#x2F;p&gt;
&lt;p&gt;“ERC-6785 Metadata with utilities JSON Schema” :&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Asset Metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Identifies the asset to which this NFT represents&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Describes the asset to which this NFT represents&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;image&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A URI pointing to a resource with mime type image&#x2F;* representing the asset to which this NFT represents. Consider making any images at a width between 320 and 1080 pixels and aspect ratio between 1.91:1 and 4:5 inclusive.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;utilities&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;required&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;t&amp;amp;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Describes what type of utility this is&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A brief description of the utility&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;array&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;An array of possible properties describing the utility, defined as key-value pairs&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;items&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;expiry&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The period of time for the validity of the utility, since the minting of the NFT. Expressed in seconds&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;t&amp;amp;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Since the &lt;code&gt;utilityUri&lt;&#x2F;code&gt; could contain information that has to be restricted to some level and could be dependent on an
off-chain tool for displaying said information, the creator needs the ability to modify it in the event the off-chain
tool or platform becomes unavailable or inaccessible.&lt;&#x2F;p&gt;
&lt;p&gt;For transparency purposes, having a &lt;code&gt;utilityHistoryOf&lt;&#x2F;code&gt; method will make it clear how the &lt;code&gt;utilityUri&lt;&#x2F;code&gt; has changed over
time.&lt;&#x2F;p&gt;
&lt;p&gt;For example, if a creator sells an NFT that gives holders a right to a video call with the creator, the metadata for
this utility NFT would read as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;image&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;utilities&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Video call&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;I will enter a private video call with whoever owns the NFT&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;sessions&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;duration&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 30&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;time_unit&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;minutes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;expiry&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1.577e+7&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;t&amp;amp;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;....&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In order to get access to the details needed to enter the video call, the owner would access the URI returned by
the &lt;code&gt;getUtilityUri&lt;&#x2F;code&gt; method for the NFT that they own. Additionally, access to the details could be conditioned by the
authentication with the wallet that owns the NFT.&lt;&#x2F;p&gt;
&lt;p&gt;The current status of the utility would also be included in the URI (eg: how many sessions are still available, etc.)&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is compatible with current ERC-721 standard. There are no other standards that define similar methods for
NFTs and the method names are not used by other ERC-721 related standards.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases are available &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6785&#x2F;.&#x2F;assets&#x2F;test&#x2F;ERC6785.test.js&quot;&gt;here&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The reference implementation can be found &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6785&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;ERC6785.sol&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;There are no security considerations related directly to the implementation of this standard.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0-1.0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Registry for royalties payment for NFTs</title>
        <published>2023-03-27T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Otniel Nicola</name><uri>https://github.com/OT-kthd</uri>
	</author>
	
	<author>
		<name>Bogdan Popa</name><uri>https://github.com/BogdanKTHD</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6786/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6786-royalty-debt-registry/13569" />
        

        <id>https://wg-eips.ritovision.com/6786/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:6786"
            label="ERC-6786" />
        

        
        

        
        <summary type="html">A registry used for paying royalties for any NFT with information about the creator</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6786/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard allows anyone to pay royalties for a certain NFT and also to keep track of the royalties amount paid. It will cumulate the value each time a payment is executed through it and make the information public.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;There are many marketplaces which do not enforce any royalty payment to the NFT creator every time the NFT is sold or re-sold and&#x2F;or providing a way for doing it. There are some marketplaces which use specific system of royalties, however that system is applicable for the NFTs creates on their platform.&lt;&#x2F;p&gt;
&lt;p&gt;In this context, there is a need of a way for paying royalties, as it is a strong incentive for creators to keep contributing to the NFTs ecosystem.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, this standard will provide a way of computing the amount of royalties paid to a creator for a certain NFT. This could be useful in the context of categorising NFTs in terms of royalties. The term “debt“ is used because the standard aims to provide a way of knowing if there are any royalties left unpaid for the NFTs trades that took place in a marketplace that does not support them and, in that case, expose a way of paying them.&lt;&#x2F;p&gt;
&lt;p&gt;With a lot of places made for trading NFTs dropping down the royalty payment or having a centralised approach, we want to provide a way for anyone to pay royalties to the creators.&lt;&#x2F;p&gt;
&lt;p&gt;Not only the owner of it, but anyone could pay royalties for a certain NFT. This could be a way of supporting a creator for his work.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;Every contract compliant with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6786&#x2F;&quot;&gt;ERC-6786&lt;&#x2F;a&gt; MUST implement the interface defined as follows:&lt;&#x2F;p&gt;
&lt;h3 id=&quot;contract-interface&quot;&gt;Contract Interface&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @title Royalty Debt Registry&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0x253b27b0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6786&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Logged when royalties were paid for a NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when royalties are paid for the NFT with address tokenAddress and id tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RoyaltiesPaid&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; sends msg.value to the creator of a NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Reverts if there are no on-chain informations about the creator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of NFT contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT id&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; payRoyalties&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the amount of royalties which was paid for a NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of NFT contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT id&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; amount of royalties paid for the NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getPaidRoyalties&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;All functions defined as view MAY be implemented as pure or view&lt;&#x2F;p&gt;
&lt;p&gt;Function &lt;code&gt;payRoyalties&lt;&#x2F;code&gt;  MAY be implemented as public or external&lt;&#x2F;p&gt;
&lt;p&gt;The event &lt;code&gt;RoyaltiesPaid&lt;&#x2F;code&gt; MUST be emitted when the payRoyalties function is called&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; function MUST return true when called with &lt;code&gt;0x253b27b0&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The payment can be made in native coins, so it is easy to aggregate the amount of paid royalties. We want this information to be public, so anyone could tell if a creator received royalties in case of under the table trading or in case of marketplaces which don’t support royalties.&lt;&#x2F;p&gt;
&lt;p&gt;The function used for payment can be called by anyone (not only the NFTs owner) to support the creator at any time. There is a way of seeing the amount of paid royalties in any token, also available for anyone.&lt;&#x2F;p&gt;
&lt;p&gt;For fetching creator on-chain data we will use &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2981&#x2F;&quot;&gt;ERC-2981&lt;&#x2F;a&gt;, but any other on-chain method of getting the creator address is accepted.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC is not introducing any backward incompatibilities.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Tests are included in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6786&#x2F;.&#x2F;assets&#x2F;test&#x2F;ERC6786.test.js&quot;&gt;&lt;code&gt;ERC6786.test.js&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;To run them in terminal, you can use the following commands:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cd ..&#x2F;assets&#x2F;eip-6786&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;npm install&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;npx hardhat test&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6786&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;ERC6786.sol&quot;&gt;&lt;code&gt;ERC6786.sol&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;There are no security considerations related directly to the implementation of this standard.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Order Book DEX with Two Phase Withdrawal</title>
        <published>2023-03-27T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Jessica</name><uri>https://github.com/qizheng09</uri>
	</author>
	
	<author>
		<name>Roy</name><uri>https://github.com/royshang</uri>
	</author>
	
	<author>
		<name>Jun</name><uri>https://github.com/SniperUsopp</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6787/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/order-book-dex-standard/13573" />
        

        <id>https://wg-eips.ritovision.com/6787/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:6787"
            label="ERC-6787" />
        

        
        

        
        <summary type="html">An order book-based DEX Interface that ensures the asset security of both users and the exchange</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6787/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The Order Book DEX Standard is a proposed set of interface specifications that define a decentralized exchange (DEX) protocol for trading assets using order books. This standard provides a set of functions that allow users to deposit, withdraw, and trade assets on a decentralized exchange. Additionally, it proposes a novel two-phase withdrawal scheme to ensure the asset security of both users and the exchange, addressing users&#x27; trust issues with the exchange.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Decentralized exchanges (DEXs) have become increasingly popular in recent years due to their ability to provide users with greater control over their assets and reduce reliance on centralized intermediaries. However, many existing DEX protocols suffer from issues such as low liquidity and inefficient price discovery. Order book-based DEXs based Layer2 have emerged as a popular alternative, but there is currently no standardized interface for implementing such exchanges.&lt;&#x2F;p&gt;
&lt;p&gt;The Order Book DEX Standard aims to provide developers with a common interface for building interoperable order book-based DEXs that can benefit from network effects. By establishing a standard set of functions for depositing, withdrawing, and forced withdrawals, the Order Book DEX Standard can fully ensure the security of user assets. At the same time, the two-phase forced withdrawal mechanism can also prevent malicious withdrawals from users targeting the exchange.&lt;&#x2F;p&gt;
&lt;p&gt;The two phase commit protocol is an important distributed consistency protocol, aiming to ensure data security and consistency in distributed systems. In the Layer2 order book DEX system, to enhance user experience and ensure financial security, we adopt a 1:1 reserve strategy, combined with a decentralized clearing and settlement interface, and a forced withdrawal function to fully guarantee users&#x27; funds.&lt;&#x2F;p&gt;
&lt;p&gt;However, such design also faces potential risks. When users engage in perpetual contract transactions, they may incur losses. In this situation, malicious users might exploit the forced withdrawal function to evade losses. To prevent this kind of attack, we propose a two-phase forced withdrawal mechanism.&lt;&#x2F;p&gt;
&lt;p&gt;By introducing the two phase forced withdrawal function, we can protect users&#x27; financial security while ensuring the security of the exchange&#x27;s assets. In the first phase, the system will conduct a preliminary review of the user&#x27;s withdrawal request to confirm the user&#x27;s account status. In the second phase, after the forced withdrawal inspection period, users can directly submit the forced withdrawal request to complete the forced withdrawal process. In this way, we can not only prevent users from exploiting the forced withdrawal function to evade losses but also ensure the asset security for both the exchange and the users.&lt;&#x2F;p&gt;
&lt;p&gt;In conclusion, by adopting the two phase commit protocol and the two phase forced withdrawal function, we can effectively guard against malicious behaviors and ensure data consistency and security in distributed systems while ensuring user experience and financial security.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;interfaces&quot;&gt;Interfaces&lt;&#x2F;h3&gt;
&lt;p&gt;The Order Book DEX Standard defines the following Interfaces:&lt;&#x2F;p&gt;
&lt;h4 id=&quot;deposit&quot;&gt;&lt;code&gt;deposit&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;function deposit(address token, uint256 amount) external;&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;strong&gt;deposit&lt;&#x2F;strong&gt; function allows a user to deposit a specified amount of a particular token to the exchange. The &lt;em&gt;token&lt;&#x2F;em&gt; parameter specifies the address of the token contract, and the &lt;em&gt;amount&lt;&#x2F;em&gt; parameter specifies the amount of the token to be deposited.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;withdraw&quot;&gt;&lt;code&gt;withdraw&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;function withdraw(address token, uint256 amount) external;&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;strong&gt;withdraw&lt;&#x2F;strong&gt; function allows a user to withdraw a specified amount of a particular token from the exchange. The &lt;em&gt;token&lt;&#x2F;em&gt; parameter specifies the address of the token contract, and the &lt;em&gt;amount&lt;&#x2F;em&gt; parameter specifies the amount of the token to be withdrawn.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;prepareforcewithdraw&quot;&gt;&lt;code&gt;prepareForceWithdraw&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;function prepareForceWithdraw(address token, uint256 amount) external returns (uint256 requestID);&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The assets deposited by users will be stored in the exchange contract&#x27;s account, and the exchange can achieve real-time 1:1 reserve proof. The &lt;strong&gt;prepareForceWithdraw&lt;&#x2F;strong&gt; function is used for users to initiate a forced withdrawal of a certain amount of a specified token. This function indicates that the user wants to perform a forced withdrawal and can submit the withdrawal after the default timeout period. Within the timeout period, the exchange needs to confirm that the user&#x27;s order status meets the expected criteria, and forcibly cancel the user&#x27;s order and settle the trade to avoid malicious attacks by the user. This function takes the following parameters:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;em&gt;token&lt;&#x2F;em&gt;: the address of the token to be withdrawn&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;amount&lt;&#x2F;em&gt;: the amount of the token to be withdrawn&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Since an account may initiate multiple two phase forced withdrawals in parallel, each forced withdrawal needs to return a unique &lt;em&gt;requestID&lt;&#x2F;em&gt;. The function returns a unique &lt;em&gt;requestID&lt;&#x2F;em&gt; that can be used to submit the forced withdrawal using the commitForceWithdraw function.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;commitforcewithdraw&quot;&gt;&lt;code&gt;commitForceWithdraw&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;function commitForceWithdraw(uint256 requestID) external;&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;em&gt;requestID&lt;&#x2F;em&gt;: the request ID of the two phase Withdraw&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The &lt;strong&gt;commitForceWithdraw&lt;&#x2F;strong&gt; function is used to execute a forced withdrawal operation after the conditions are met. The function takes a &lt;em&gt;requestID&lt;&#x2F;em&gt; parameter, which specifies the ID of the forced withdrawal request to be executed. The request must have been previously initiated using the prepareForceWithdraw function.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;events&quot;&gt;Events&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;prepareforcewithdraw-1&quot;&gt;&lt;code&gt;PrepareForceWithdraw&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;MUST trigger when user successful call to PrepareForceWithdraw.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;event PrepareForceWithdraw(address indexed user, address indexed tokenAddress, uint256 amount);&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The flow charts for two-phase withdrawal are shown below:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6787&#x2F;.&#x2F;assets&#x2F;image1.png&quot; alt=&quot;&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Rename gas to mana</title>
        <published>2023-03-27T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>pcaversaccio</name><uri>https://github.com/pcaversaccio</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6789/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6789-rename-gas-to-mana/13570" />
        

        <id>https://wg-eips.ritovision.com/6789/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="interface"
                label="Interface" />
            
        

        
        <category
            term="tag:eip:6789"
            label="EIP-6789" />
        

        
        

        
        <summary type="html">This EIP suggests renaming gas to mana, as proposed by Vitalik Buterin in 2015</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6789/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP suggests renaming &lt;code&gt;gas&lt;&#x2F;code&gt; to &lt;code&gt;mana&lt;&#x2F;code&gt;, as proposed by Vitalik Buterin in 2015.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The underlying motivation for reviving Vitalik&#x27;s original proposal from 2015 is that we have finally arrived at the age of Proof-of-Stake, and given the roadmap ahead (i.e. &quot;The Surge&quot;, &quot;The Scourge&quot;, &quot;The Verge&quot;, &quot;The Purge&quot;, and &quot;The Splurge&quot;), I consider this moment as the last opportunity to make such a far-reaching semantic change.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;The core term &lt;code&gt;gas&lt;&#x2F;code&gt; MUST be renamed to &lt;code&gt;mana&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The following opcodes MUST be renamed:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;GASPRICE&lt;&#x2F;code&gt; to &lt;code&gt;MANAPRICE&lt;&#x2F;code&gt;;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;GASLIMIT&lt;&#x2F;code&gt; to &lt;code&gt;MANALIMIT&lt;&#x2F;code&gt;; and&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;GAS&lt;&#x2F;code&gt; to &lt;code&gt;MANA&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Additionally, the input parameters or outputs of the following opcodes MUST be renamed:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;CALL&lt;&#x2F;code&gt;&#x27;s &lt;code&gt;gas&lt;&#x2F;code&gt; input parameter to &lt;code&gt;mana&lt;&#x2F;code&gt;;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CALLCODE&lt;&#x2F;code&gt;&#x27;s &lt;code&gt;gas&lt;&#x2F;code&gt; input parameter to &lt;code&gt;mana&lt;&#x2F;code&gt;;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;&#x27;s &lt;code&gt;gas&lt;&#x2F;code&gt; input parameter to &lt;code&gt;mana&lt;&#x2F;code&gt;;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;STATICCALL&lt;&#x2F;code&gt;&#x27;s &lt;code&gt;gas&lt;&#x2F;code&gt; input parameter to &lt;code&gt;mana&lt;&#x2F;code&gt;;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;GASLIMIT&lt;&#x2F;code&gt;&#x27;s &lt;code&gt;gasLimit&lt;&#x2F;code&gt; output to &lt;code&gt;manaLimit&lt;&#x2F;code&gt;; and&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;GAS&lt;&#x2F;code&gt;&#x27;s &lt;code&gt;gas&lt;&#x2F;code&gt; output to &lt;code&gt;mana&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Finally, the following RPC endpoints MUST be renamed:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;eth_estimateGas&lt;&#x2F;code&gt; to &lt;code&gt;eth_estimateMana&lt;&#x2F;code&gt;;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;eth_gasPrice&lt;&#x2F;code&gt; to &lt;code&gt;eth_manaPrice&lt;&#x2F;code&gt;; and&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;eth_maxPriorityFeePerGas&lt;&#x2F;code&gt; to &lt;code&gt;eth_maxPriorityFeePerMana&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The description of the RPC endpoints MUST be renamed accordingly:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;eth_estimateMana&lt;&#x2F;code&gt;: Generates and returns an estimate of how much &lt;code&gt;mana&lt;&#x2F;code&gt; is necessary to allow the transaction to complete;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;eth_manaPrice&lt;&#x2F;code&gt;: Returns the current price per &lt;code&gt;mana&lt;&#x2F;code&gt; in wei; and&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;eth_maxPriorityFeePerMana&lt;&#x2F;code&gt;: Returns the current &lt;code&gt;maxPriorityFeePerMana&lt;&#x2F;code&gt; per &lt;code&gt;mana&lt;&#x2F;code&gt; in wei.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;mana&lt;&#x2F;code&gt; reflects the increased environmental friendliness of Proof-of-Stake;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;mana&lt;&#x2F;code&gt; is generally understood to be ephemeral and non-transferable, which better represents the concept of &lt;code&gt;gas&lt;&#x2F;code&gt;; and&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;mana&lt;&#x2F;code&gt; is generally portrayed as renewable, while (natural) &lt;code&gt;gas&lt;&#x2F;code&gt; is non-renewable.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal is not backward compatible as it renames the core term &lt;code&gt;gas&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;example-1&quot;&gt;Example 1&lt;&#x2F;h3&gt;
&lt;p&gt;If a transaction requires more &lt;code&gt;mana&lt;&#x2F;code&gt; than allowed by the &lt;code&gt;manaLimit&lt;&#x2F;code&gt;, it is reverted as an &lt;em&gt;out-of-mana&lt;&#x2F;em&gt; transaction.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;example-2&quot;&gt;Example 2&lt;&#x2F;h3&gt;
&lt;p&gt;A Solidity contract to estimate the used &lt;code&gt;mana&lt;&#x2F;code&gt; via the new &lt;code&gt;manaleft()&lt;&#x2F;code&gt; syntax (replacing &lt;code&gt;gasleft()&lt;&#x2F;code&gt;) for dedicated function calls.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: AGPL-3.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0.8.19&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ManaMetering&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; oldWay&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; manaUsed&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; hiMom &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Hi Mom, &amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; missYou &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;miss you.&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; startMana &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; manaleft&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; concat &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;hiMom&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; missYou&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        manaUsed &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; startMana &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; manaleft&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;concat&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; manaUsed&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; newWay&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; manaUsed&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; hiMom &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Hi Mom, &amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; missYou &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;miss you.&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; startMana &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; manaleft&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; concat &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;concat&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;hiMom&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; missYou&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        manaUsed &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; startMana &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; manaleft&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;concat&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; manaUsed&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In Vyper, the same behaviour can be replicated with the new transaction property &lt;code&gt;msg.mana&lt;&#x2F;code&gt;, which replaces &lt;code&gt;msg.gas&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;example-3&quot;&gt;Example 3&lt;&#x2F;h3&gt;
&lt;p&gt;An example of how to set the &lt;code&gt;manaLimit&lt;&#x2F;code&gt; in MetaMask:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6789&#x2F;.&#x2F;assets&#x2F;MetaMask_ManaLimit.png&quot; alt=&quot;MetaMask manaLimit&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;There are no security considerations directly related to the renaming of &lt;code&gt;gas&lt;&#x2F;code&gt; to &lt;code&gt;mana&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>SELFDESTRUCT only in same transaction</title>
        <published>2023-03-25T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Guillaume Ballet</name><uri>https://github.com/gballet</uri>
	</author>
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	<author>
		<name>Dankrad Feist</name><uri>https://github.com/dankrad</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6780/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/deactivate-selfdestruct-except-where-it-occurs-in-the-same-transaction-in-which-a-contract-was-created/13539" />
        

        <id>https://wg-eips.ritovision.com/6780/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:6780"
            label="EIP-6780" />
        

        
        

        
        <summary type="html">SELFDESTRUCT will recover all funds to the target but not delete the account, except when called in the same transaction as creation</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6780/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP changes the functionality of the &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; opcode. The new functionality will be only to send all Ether in the account to the target, except that the current behaviour is preserved when &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; is called in the same transaction a contract was created.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; opcode requires large changes to the state of an account, in particular removing all code and storage. This will not be possible in the future with Verkle trees: Each account will be stored in many different account keys, which will not be obviously connected to the root account.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP implements this change. Applications that only use &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; to retrieve funds will still work. Applications that only use &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; in the same transaction as they created a contract will also continue to work without any changes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The behaviour of &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; is changed in the following way:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;When &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; is executed in a transaction that is not the same as the contract calling &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; was created:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The current execution frame halts.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; does not delete any data (including storage keys, code, or the account itself).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; transfers the entire account balance to the target.&lt;&#x2F;li&gt;
&lt;li&gt;Note that if the target is the same as the contract calling &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; there is no net change in balances.  Unlike the prior specification, Ether will not be burnt in this case.&lt;&#x2F;li&gt;
&lt;li&gt;Note that no refund is given since &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3529&#x2F;&quot;&gt;EIP-3529&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Note that the rules of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt; regarding &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; remain unchanged.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;When &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; is executed in the same transaction as the contract was created:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; continues to behave as it did prior to this EIP, this includes the following actions
&lt;ul&gt;
&lt;li&gt;The current execution frame halts.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; deletes data as previously specified.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; transfers the entire account balance to the target&lt;&#x2F;li&gt;
&lt;li&gt;The account balance of the contact calling &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; is set to &lt;code&gt;0&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Note that if the target is the same as the contract calling &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; that Ether will be burnt.&lt;&#x2F;li&gt;
&lt;li&gt;Note that no refund is given since &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3529&#x2F;&quot;&gt;EIP-3529&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Note that the rules of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt; regarding &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; remain unchanged.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;A contract is considered created at the beginning of a create transaction or when a CREATE series operation begins execution (CREATE, CREATE2, and other operations that deploy contracts in the future).  If a balance exists at the contract&#x27;s new address it is still considered to be a contract creation.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; opcode remains deprecated as specified in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6049&#x2F;&quot;&gt;EIP-6049&lt;&#x2F;a&gt;. Any use in newly deployed contracts is strongly discouraged even if this new behaviour is taken into account, and future changes to the EVM might further reduce the functionality of the opcode.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Getting rid of the &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; opcode has been considered in the past, and there are currently no strong reasons to use it. This EIP implements a behavior that will attempt to leave some common uses of &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; working, while reducing the complexity of the change on EVM implementations that would come from contract versioning.&lt;&#x2F;p&gt;
&lt;p&gt;Handling the account creation and contract creation as two distinct and possibly separate events is needed for use cases such as counterfactual accounts.  By allowing the &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; to delete the account at contract creation time it will not result in stubs of counterfactually instantiated contracts that never had any on-chain state other than a balance prior to the contract creation. These accounts would never have any storage and thus the trie updates to delete the account would be limited to the account node, which is the same impact a regular transfer of ether would have.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP requires a hard fork, since it modifies consensus rules.&lt;&#x2F;p&gt;
&lt;p&gt;Contracts that depended on re-deploying contracts at the same address using &lt;code&gt;CREATE2&lt;&#x2F;code&gt; (after a &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;) will no longer function properly if the created contract does not call &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; within the same transaction.&lt;&#x2F;p&gt;
&lt;p&gt;Previously it was possible to burn ether by calling &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; targeting the executing contract as the beneficiary.  If the contract existed prior to the transaction the ether will not be burned.  If the contract was newly created in the transaction the ether will be burned, as before.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases for this EIP can be found in the Execution Spec Tests suite &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;execution-spec-tests&#x2F;tree&#x2F;1983444bbe1a471886ef7c0e82253ffe2a4053e1&#x2F;tests&#x2F;cancun&#x2F;eip6780_selfdestruct&quot;&gt;&lt;code&gt;eip6780_selfdestruct&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The following applications of &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; will be broken and applications that use it in this way are not safe anymore:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Where &lt;code&gt;CREATE2&lt;&#x2F;code&gt; is used to redeploy a contract in the same place in order to make a contract upgradable. This is not supported anymore and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2535&#x2F;&quot;&gt;ERC-2535&lt;&#x2F;a&gt; or other types of proxy contracts should be used instead.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Where a contract depended on burning Ether via a &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; with the contract as beneficiary, in a contract not created within the same transaction.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>L2 Token List</title>
        <published>2023-03-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Kelvin Fichter</name><uri>https://github.com/smartcontracts</uri>
	</author>
	
	<author>
		<name>Andreas Freund</name><uri>https://github.com/Therecanbeonlyone1969</uri>
	</author>
	
	<author>
		<name>Pavel Sinelnikov</name><uri>https://github.com/psinelnikov</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6734/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/canonical-token-list-standard-from-the-eea-oasis-community-projects-l2-standards-working-group/13091" />
        

        <id>https://wg-eips.ritovision.com/6734/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:6734"
            label="ERC-6734" />
        

        
        

        
        <summary type="html">Token List that ensures the correct identification of tokens from different Layer 1, Layer 2, or Sidechains.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6734/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The document describes a JSON token list that ensures that two or more Layer 1, Layer 2, or Sidechains can identify tokens from a different Layer 1, Layer 2, or Sidechain.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This particular work by the L2 WG of the EEA Communities Projects managed by OASIS, an open-source initiative, is motivated by a significant challenge around the definition and listing of tokens on Layer 1 (L1), Layer 2 (L2), and Sidechain systems. Note that for simplicity, this document we will collectively refer to L1, L2 and Sidechain systems as chains below since the challenge described below is valid across all such systems:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Consensus on the &quot;canonical&quot; token on chain B that corresponds to some token on chain A. When one wants to bridge token X from chain A to chain B, one must create some new representation of the token on chain B. It is worth noting that this problem is not limited to L2s -- every chain connected via bridges must deal with the same issue.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Related to the above challenge is the standardization around lists of bridges and their routes across different chains. This will be addressed in a separate document.&lt;&#x2F;p&gt;
&lt;p&gt;Note that both of these issues are fundamental problems for the current multi-chain world.&lt;&#x2F;p&gt;
&lt;p&gt;Therefore, the goal of this document is to help token users to operationalize and disambiguate the usage of a token in their systems.&lt;&#x2F;p&gt;
&lt;p&gt;For lists of canonical tokens, L2s currently maintain their own customized versions of the Uniswap token list. For example, Arbitrum maintains a token list with various custom extensions. Optimism also maintains a custom token list, but with different extensions. It should be noted that both of these custom extensions refer to the bridge that these tokens can be carried through. However, these are not the only bridges that the tokens can be carried through, which means that bridges and token lists should be separated. Also note that currently, both Optimism and Arbitrum base &quot;canonicity&quot; on the token name + symbol pair.&lt;&#x2F;p&gt;
&lt;p&gt;An example of an Arbitrum token entry is given below:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;logoURI: &amp;quot;https:&#x2F;&#x2F;assets.coingecko.com&#x2F;coins&#x2F;images&#x2F;13469&#x2F;thumb&#x2F;1inch-token.png?1608803028&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;chainId: 42161,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;address: &amp;quot;0x6314C31A7a1652cE482cffe247E9CB7c3f4BB9aF&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;name: &amp;quot;1INCH Token&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;symbol: &amp;quot;1INCH&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;decimals: 18,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;extensions: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  bridgeInfo: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    1: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    tokenAddress: &amp;quot;0x111111111117dc0aa78b770fa6a738034120c302&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    originBridgeAddress: &amp;quot;0x09e9222e96e7b4ae2a407b98d48e330053351eee&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    destBridgeAddress: &amp;quot;0xa3A7B6F88361F48403514059F1F16C8E78d60EeC&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This standard will build upon the current framework and augment it with concepts from &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.w3.org&#x2F;TR&#x2F;2022&#x2F;REC-did-core-20220719&#x2F;&quot;&gt;Decentralized Identifiers (DIDs)&lt;&#x2F;a&gt; based on the JSON linked data model &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.w3.org&#x2F;TR&#x2F;2020&#x2F;REC-json-ld11-20200716&#x2F;&quot;&gt;JSON-LD&lt;&#x2F;a&gt; such as resolvable unique resource identifiers (URIs) and JSON-LD schemas which enable easier schema verification using existing tools.&lt;&#x2F;p&gt;
&lt;p&gt;Note that a standard for defining tokens is beyond the scope of this document.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;keywords&quot;&gt;Keywords:&lt;&#x2F;h3&gt;
&lt;p&gt;The keywords &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in [&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc2119&quot;&gt;RFC2119&lt;&#x2F;a&gt;] when, and only when, they appear in all capitals, as shown here.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;typographical-convention-requirement-ids&quot;&gt;Typographical Convention: Requirement Ids&lt;&#x2F;h3&gt;
&lt;p&gt;A requirement is uniquely identified by a unique ID composed of its requirement level followed by a requirement number, as per convention &lt;strong&gt;[RequirementLevelRequirementNumber]&lt;&#x2F;strong&gt;.
There are four requirement levels that are coded in requirement ids as per below convention:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;[R]&lt;&#x2F;strong&gt; - The requirement level for requirements which IDs start with the letter &lt;em&gt;R&lt;&#x2F;em&gt; is to be interpreted as &lt;strong&gt;MUST&lt;&#x2F;strong&gt; as described in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc2119&quot;&gt;RFC2119&lt;&#x2F;a&gt;.&lt;br &#x2F;&gt;
&lt;strong&gt;[D]&lt;&#x2F;strong&gt; - The requirement level for requirements which IDs start with the letter &lt;em&gt;D&lt;&#x2F;em&gt; is to be interpreted as &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; as described in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc2119&quot;&gt;RFC2119&lt;&#x2F;a&gt;.&lt;br &#x2F;&gt;
&lt;strong&gt;[O]&lt;&#x2F;strong&gt; - The requirement level for requirements which IDs start with the letter &lt;em&gt;O&lt;&#x2F;em&gt; is to be interpreted as &lt;strong&gt;MAY&lt;&#x2F;strong&gt; as described in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc2119&quot;&gt;RFC2119&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Note that requirements are uniquely numbered in ascending order within each requirement level.&lt;&#x2F;p&gt;
&lt;p&gt;Example : It should be read that [R1] is an absolute requirement of the specification whereas [D1] is a recommendation and [O1] is truly optional.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r1&quot;&gt; &lt;strong&gt;[R1]&lt;&#x2F;strong&gt; &lt;&#x2F;a&gt;
The following data elements MUST be present in a canonical token list:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;type&lt;&#x2F;li&gt;
&lt;li&gt;tokenListId&lt;&#x2F;li&gt;
&lt;li&gt;name&lt;&#x2F;li&gt;
&lt;li&gt;createdAt&lt;&#x2F;li&gt;
&lt;li&gt;updatedAt&lt;&#x2F;li&gt;
&lt;li&gt;versions&lt;&#x2F;li&gt;
&lt;li&gt;tokens&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note, that the detailed definition of the data elements in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6734&#x2F;#r1&quot;&gt;[R1]&lt;&#x2F;a&gt; along with descriptions and examples are given in the schema itself below.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6734&#x2F;#r1&quot;&gt;[R1]&lt;&#x2F;a&gt; testability: See suggested test fixtures for the data schema below.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r2&quot;&gt; &lt;strong&gt;[R2]&lt;&#x2F;strong&gt; &lt;&#x2F;a&gt;
The tokens data element is a composite which MUST minimally contain the following data elements:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;chainId&lt;&#x2F;li&gt;
&lt;li&gt;chainURI&lt;&#x2F;li&gt;
&lt;li&gt;tokenId&lt;&#x2F;li&gt;
&lt;li&gt;tokenType&lt;&#x2F;li&gt;
&lt;li&gt;address&lt;&#x2F;li&gt;
&lt;li&gt;name&lt;&#x2F;li&gt;
&lt;li&gt;symbol&lt;&#x2F;li&gt;
&lt;li&gt;decimals&lt;&#x2F;li&gt;
&lt;li&gt;createdAt&lt;&#x2F;li&gt;
&lt;li&gt;updatedAt&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note, that the detailed definition of the data elements in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6734&#x2F;#r2&quot;&gt;[R2]&lt;&#x2F;a&gt; along with descriptions and examples are given in the schema itself below.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6734&#x2F;#r2&quot;&gt;[R2]&lt;&#x2F;a&gt; testability: See suggested test fixtures for this documents&#x27; data schema below.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;d1&quot;&gt; &lt;strong&gt;[D1]&lt;&#x2F;strong&gt; &lt;&#x2F;a&gt;
All other data elements of the schema SHOULD be included in a representation of a canonical token list.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6734&#x2F;#d1&quot;&gt;[D1]&lt;&#x2F;a&gt; testability: See suggested test fixtures for this documents&#x27; data schema below.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;cr1d1&quot;&gt; &lt;strong&gt;[CR1]&amp;gt;[D1]&lt;&#x2F;strong&gt; &lt;&#x2F;a&gt;
If the extension data elements is used, the following data elements MUST be present in the schema representation:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;rootChainId&lt;&#x2F;li&gt;
&lt;li&gt;rootChainURI&lt;&#x2F;li&gt;
&lt;li&gt;rootAddress&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note, that the detailed definition of the data elements in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6734&#x2F;#d1&quot;&gt;[D1]&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6734&#x2F;#cr1d1&quot;&gt;[CR1]&amp;gt;[D1]&lt;&#x2F;a&gt; along with descriptions and examples are given in the schema itself below.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6734&#x2F;#cr1d1&quot;&gt;[CR1]&amp;gt;[D1]&lt;&#x2F;a&gt; testability: See suggested test fixtures for this documents&#x27; data schema below.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r3&quot;&gt; &lt;strong&gt;[R3]&lt;&#x2F;strong&gt; &lt;&#x2F;a&gt;
All properties in the schema identified in the description to be a Universal Resource Identifier (URI) MUST follow in their semantics &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc3986&quot;&gt;RFC 3986&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6734&#x2F;#r3&quot;&gt;[R3]&lt;&#x2F;a&gt; testability: All requirements for &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc3986&quot;&gt;RFC 3986&lt;&#x2F;a&gt; are testable.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r4&quot;&gt; &lt;strong&gt;[R4]&lt;&#x2F;strong&gt; &lt;&#x2F;a&gt;
The chainId property utilized MUST allow for the requirements of the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt; standard to be met.&lt;&#x2F;p&gt;
&lt;p&gt;Namely, transaction replay protection on the network that is identified by the chainId property value. Note, that for replay protection to be guaranteed, the chainId should be unique. Ensuring a unique chainId is beyond the scope of this document.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6734&#x2F;#r4&quot;&gt;[R4]&lt;&#x2F;a&gt; testability: EIP-155 requires that a transaction hash is derived from the keccak256 hash of the following nine RLP encoded elements &lt;code&gt;(nonce, gasprice, startgas, to, value, data, chainid, 0, 0)&lt;&#x2F;code&gt; which can be tested easily with existing cryptographic libraries. EIP-155 further requires that the &lt;code&gt;v&lt;&#x2F;code&gt; value of the secp256k1 signature must be set to &lt;code&gt;{0,1} + CHAIN_ID * 2 + 35&lt;&#x2F;code&gt; where &lt;code&gt;{0,1}&lt;&#x2F;code&gt; is the parity of the &lt;code&gt;y&lt;&#x2F;code&gt; value of the curve point for which the signature &lt;code&gt;r&lt;&#x2F;code&gt;-value is the &lt;code&gt;x&lt;&#x2F;code&gt;-value in the secp256k1 signing process. This requirement is testable with available open-source secp256k1 digital signature suites. Therefore, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6734&#x2F;#r4&quot;&gt;[R4]&lt;&#x2F;a&gt; is testable.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;o1&quot;&gt; &lt;strong&gt;[O1]&lt;&#x2F;strong&gt; &lt;&#x2F;a&gt;
The &lt;code&gt;humanReadableTokenSymbol&lt;&#x2F;code&gt; property MAY be used.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6734&#x2F;#o1&quot;&gt;[O1]&lt;&#x2F;a&gt; testability: A data property is always implementable in a schema.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;cr2o1&quot;&gt; &lt;strong&gt;[CR2]&amp;gt;[O1]&lt;&#x2F;strong&gt; &lt;&#x2F;a&gt;
The &lt;code&gt;humanReadableTokenSymbol&lt;&#x2F;code&gt; property MUST be constructed as the hyphenated concatenation of first the &lt;code&gt;tokenSymbol&lt;&#x2F;code&gt; and then the &lt;code&gt;chainId&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;An example would be:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;quot;tokenSymbol&amp;quot; = ETH;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;quot;chainId&amp;quot; = 1;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;quot;humanReadableTokenSymbol&amp;quot; = ETH-1;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6734&#x2F;#cr2o1&quot;&gt;[CR2]&amp;gt;[O1]&lt;&#x2F;a&gt; testability: &lt;code&gt;humanReadableTokenSymbol&lt;&#x2F;code&gt; can be parsed and split based on existing open source packages and the result compared to the &lt;code&gt;tokenSymbol&lt;&#x2F;code&gt; and &lt;code&gt;chainId&lt;&#x2F;code&gt; used in the data schema.&lt;&#x2F;p&gt;
&lt;p&gt;The schema for a canonical token list is given below as follows and can be utilized as a JSON-LD schema if a JSON-LD context file is utilized (see &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.w3.org&#x2F;TR&#x2F;2022&#x2F;REC-did-core-20220719&#x2F;&quot;&gt;[W3C-DID]&lt;&#x2F;a&gt; for a concrete example in the context of a standard):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;$id&amp;quot;: &amp;quot;https:&#x2F;&#x2F;github.com&#x2F;eea-oasis&#x2F;l2&#x2F;schemas&#x2F;CanonicalTokenList.json&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;$schema&amp;quot;: &amp;quot;https:&#x2F;&#x2F;json-schema.org&#x2F;draft-07&#x2F;schema#&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;$comment&amp;quot;: &amp;quot;{\&amp;quot;term\&amp;quot;: \&amp;quot;CanonicalTokenList\&amp;quot;, \&amp;quot;@id\&amp;quot;: \&amp;quot;https:&#x2F;&#x2F;github.com&#x2F;eea-oasis&#x2F;l2#CanonicalTokenList\&amp;quot;}&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;title&amp;quot;: &amp;quot;CanonicalTokenList&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;description&amp;quot;: &amp;quot;Canonical Token List&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;type&amp;quot;: &amp;quot;object&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;required&amp;quot;: [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;type&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;tokenListId&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;name&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;createdAt&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;updatedAt&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;versions&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;tokens&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ],&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;properties&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &amp;quot;@context&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &amp;quot;type&amp;quot;: &amp;quot;array&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &amp;quot;type&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &amp;quot;oneOf&amp;quot;: [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        &amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        &amp;quot;type&amp;quot;: &amp;quot;array&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                ],&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &amp;quot;examples&amp;quot;: [&amp;quot;CanonicalTokenList&amp;quot;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &amp;quot;tokenListId&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &amp;quot;$comment&amp;quot;: &amp;quot;{\&amp;quot;term\&amp;quot;: \&amp;quot;tokenListId\&amp;quot;, \&amp;quot;@id\&amp;quot;: \&amp;quot;https:&#x2F;&#x2F;schema.org&#x2F;identifier\&amp;quot;}&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &amp;quot;title&amp;quot;: &amp;quot;tokenListId&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &amp;quot;description&amp;quot;: &amp;quot;A resolvable URI to the publicly accessible place where this list can be found following the RFC 3986 standard.&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &amp;quot;examples&amp;quot;: [&amp;quot;https:&#x2F;&#x2F;ipfs.io&#x2F;ipns&#x2F;k51qzi5uqu5dkkciu33khkzbcmxtyhn376i1e83tya8kuy7z9euedzyr5nhoew&amp;quot;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &amp;quot;name&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &amp;quot;$comment&amp;quot;: &amp;quot;{\&amp;quot;term\&amp;quot;: \&amp;quot;name\&amp;quot;, \&amp;quot;@id\&amp;quot;: \&amp;quot;https:&#x2F;&#x2F;schema.org&#x2F;name\&amp;quot;}&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &amp;quot;title&amp;quot;: &amp;quot;name&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &amp;quot;description&amp;quot;: &amp;quot;Token List name&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &amp;quot;examples&amp;quot;: [&amp;quot;Aggregate Canonical Token List&amp;quot;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &amp;quot;logoURI&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &amp;quot;$comment&amp;quot;: &amp;quot;{\&amp;quot;term\&amp;quot;: \&amp;quot;logoURI\&amp;quot;, \&amp;quot;@id\&amp;quot;: \&amp;quot;https:&#x2F;&#x2F;schema.org&#x2F;identifier\&amp;quot;}&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &amp;quot;title&amp;quot;: &amp;quot;logoURI&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &amp;quot;description&amp;quot;: &amp;quot;URI or URL of the token list logo following the RFC 3986 standard&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &amp;quot;examples&amp;quot;: [&amp;quot;https:&#x2F;&#x2F;ipfs.io&#x2F;ipns&#x2F;k51qzi5uqu5dh5kbbff1ucw3ksphpy3vxx4en4dbtfh90pvw4mzd8nfm5r5fnl&amp;quot;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &amp;quot;keywords&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &amp;quot;$comment&amp;quot;: &amp;quot;{\&amp;quot;term\&amp;quot;: \&amp;quot;keywords\&amp;quot;, \&amp;quot;@id\&amp;quot;: \&amp;quot;https:&#x2F;&#x2F;schema.org&#x2F;DefinedTerm\&amp;quot;}&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &amp;quot;title&amp;quot;: &amp;quot;keywords&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &amp;quot;description&amp;quot;: &amp;quot;List of key words for the token list&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &amp;quot;type&amp;quot;: &amp;quot;array&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &amp;quot;examples&amp;quot;: [Aggregate Token List]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &amp;quot;createdAt&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &amp;quot;$comment&amp;quot;: &amp;quot;{\&amp;quot;term\&amp;quot;: \&amp;quot;createdAt\&amp;quot;, \&amp;quot;@id\&amp;quot;: \&amp;quot;https:&#x2F;&#x2F;schema.org&#x2F;datePublished\&amp;quot;}&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &amp;quot;title&amp;quot;: &amp;quot;createdAt&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &amp;quot;description&amp;quot;: &amp;quot;Date and time token list was created&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &amp;quot;examples&amp;quot;: [&amp;quot;2022-05-08&amp;quot;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &amp;quot;updatedAt&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &amp;quot;$comment&amp;quot;: &amp;quot;{\&amp;quot;term\&amp;quot;: \&amp;quot;updatedAt\&amp;quot;, \&amp;quot;@id\&amp;quot;: \&amp;quot;https:&#x2F;&#x2F;schema.org&#x2F;dateModified\&amp;quot;}&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &amp;quot;title&amp;quot;: &amp;quot;updatedAt&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &amp;quot;description&amp;quot;: &amp;quot;Date and time token list was updated&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                 &amp;quot;examples&amp;quot;: [&amp;quot;2022-05-09&amp;quot;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &amp;quot;versions&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &amp;quot;$comment&amp;quot;: &amp;quot;{\&amp;quot;term\&amp;quot;: \&amp;quot;versions\&amp;quot;, \&amp;quot;@id\&amp;quot;: \&amp;quot;https:&#x2F;&#x2F;schema.org&#x2F;version\&amp;quot;}&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &amp;quot;title&amp;quot;: &amp;quot;versions&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &amp;quot;description&amp;quot;: &amp;quot;Versions of the canonical token list&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &amp;quot;type&amp;quot;: &amp;quot;array&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                 &amp;quot;items&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    &amp;quot;type&amp;quot;:&amp;quot;object&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    &amp;quot;required&amp;quot;:[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        &amp;quot;major&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        &amp;quot;minor&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        &amp;quot;patch&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    ],&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    &amp;quot;properties&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        &amp;quot;major&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;$comment&amp;quot;: &amp;quot;{\&amp;quot;term\&amp;quot;: \&amp;quot;major\&amp;quot;, \&amp;quot;@id\&amp;quot;: \&amp;quot;https:&#x2F;&#x2F;schema.org&#x2F;Number\&amp;quot;}&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;title&amp;quot;: &amp;quot;major&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;description&amp;quot;: &amp;quot;Major Version Number of the Token List&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;type&amp;quot;: &amp;quot;integer&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                             &amp;quot;examples&amp;quot;: [1]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        &amp;quot;minor&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;$comment&amp;quot;: &amp;quot;{\&amp;quot;term\&amp;quot;: \&amp;quot;minor\&amp;quot;, \&amp;quot;@id\&amp;quot;: \&amp;quot;https:&#x2F;&#x2F;schema.org&#x2F;Number\&amp;quot;}&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;title&amp;quot;: &amp;quot;minor&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;description&amp;quot;: &amp;quot;Minor Version Number of the Token List&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;type&amp;quot;: &amp;quot;integer&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                             &amp;quot;examples&amp;quot;: [1]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        &amp;quot;patch&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;$comment&amp;quot;: &amp;quot;{\&amp;quot;term\&amp;quot;: \&amp;quot;patch\&amp;quot;, \&amp;quot;@id\&amp;quot;: \&amp;quot;https:&#x2F;&#x2F;schema.org&#x2F;Number\&amp;quot;}&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;title&amp;quot;: &amp;quot;patch&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;description&amp;quot;: &amp;quot;Patch Number of the Token List&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;type&amp;quot;: &amp;quot;integer&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                             &amp;quot;examples&amp;quot;: [1]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &amp;quot;tokens&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &amp;quot;title&amp;quot;: &amp;quot;Listed Token Entry&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &amp;quot;description&amp;quot;: &amp;quot;Listed Token Entry&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &amp;quot;type&amp;quot;: &amp;quot;array&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                 &amp;quot;items&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    &amp;quot;type&amp;quot;:&amp;quot;object&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    &amp;quot;required&amp;quot;: [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        &amp;quot;chainId&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        &amp;quot;chainURI&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        &amp;quot;tokenId&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        &amp;quot;tokenType&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        &amp;quot;address&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        &amp;quot;name&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        &amp;quot;symbol&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        &amp;quot;decimals&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        &amp;quot;createdAt&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        &amp;quot;updatedAt&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    ],&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    &amp;quot;properties&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        &amp;quot;chainId&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;$comment&amp;quot;: &amp;quot;{\&amp;quot;term\&amp;quot;: \&amp;quot;chainId\&amp;quot;, \&amp;quot;@id\&amp;quot;: \&amp;quot;https:&#x2F;&#x2F;schema.org&#x2F;identifier\&amp;quot;}&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;title&amp;quot;: &amp;quot;chainId&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;description&amp;quot;: &amp;quot;The typically used number identifier for the chain on which the token was issued.&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;type&amp;quot;: &amp;quot;number&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;examples&amp;quot;: [137]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        &amp;quot;chainURI&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;$comment&amp;quot;: &amp;quot;{\&amp;quot;term\&amp;quot;: \&amp;quot;chainURI\&amp;quot;, \&amp;quot;@id\&amp;quot;: \&amp;quot;https:&#x2F;&#x2F;schema.org&#x2F;identifier\&amp;quot;}&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;title&amp;quot;: &amp;quot;chainURI&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;description&amp;quot;: &amp;quot;A resolvable URI to the genesis block of the chain on which the token was issued following the RFC 3986 standard.&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                             &amp;quot;examples&amp;quot;: [&amp;quot;https:&#x2F;&#x2F;polygonscan.com&#x2F;block&#x2F;0&amp;quot;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        &amp;quot;genesisBlockHash&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;$comment&amp;quot;: &amp;quot;{\&amp;quot;term\&amp;quot;: \&amp;quot;genesisBlockHash\&amp;quot;, \&amp;quot;@id\&amp;quot;: \&amp;quot;https:&#x2F;&#x2F;schema.org&#x2F;sha256\&amp;quot;}&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;title&amp;quot;: &amp;quot;genesisBlockHash&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;description&amp;quot;: &amp;quot;The hash of the genesis block of the chain on which the token was issued.&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;examples&amp;quot;: [&amp;quot;0xa9c28ce2141b56c474f1dc504bee9b01eb1bd7d1a507580d5519d4437a97de1b&amp;quot;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        &amp;quot;tokenIssuerId&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;$comment&amp;quot;: &amp;quot;{\&amp;quot;term\&amp;quot;: \&amp;quot;tokenIssuerId\&amp;quot;, \&amp;quot;@id\&amp;quot;: \&amp;quot;https:&#x2F;&#x2F;schema.org&#x2F;identifier\&amp;quot;}&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;title&amp;quot;: &amp;quot;tokenIssuerId&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;description&amp;quot;: &amp;quot;A resolvable URI identifying the token issuer following the RFC 3986 standard.&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;examples&amp;quot;: [&amp;quot;https:&#x2F;&#x2F;polygonscan.com&#x2F;address&#x2F;0xa9c28ce2141b56c474f1dc504bee9b01eb1bd7d1a507580d5519d4437a97de1b&amp;quot;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        &amp;quot;tokenIssuerName&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;$comment&amp;quot;: &amp;quot;{\&amp;quot;term\&amp;quot;: \&amp;quot;tokenIssuerName\&amp;quot;, \&amp;quot;@id\&amp;quot;: \&amp;quot;https:&#x2F;&#x2F;schema.org&#x2F;name\&amp;quot;}&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;title&amp;quot;: &amp;quot;tokenIssuerName&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;description&amp;quot;: &amp;quot;The name oof the token issuer.&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;examples&amp;quot;: [&amp;quot;Matic&amp;quot;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        &amp;quot;tokenId&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;$comment&amp;quot;: &amp;quot;{\&amp;quot;term\&amp;quot;: \&amp;quot;tokenId\&amp;quot;, \&amp;quot;@id\&amp;quot;: \&amp;quot;https:&#x2F;&#x2F;schema.org&#x2F;identifier\&amp;quot;}&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;title&amp;quot;: &amp;quot;tokenId&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;description&amp;quot;: &amp;quot;A resolvable URI of the token following the RFC 3986 standard to for example the deployment transaction of the token, or a DID identifying the token and its issuer.&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;example&amp;quot;: [&amp;quot;https:&#x2F;&#x2F;polygonscan.com&#x2F;address&#x2F;0x0000000000000000000000000000000000001010&amp;quot;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        &amp;quot;tokenType&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;$comment&amp;quot;: &amp;quot;{\&amp;quot;term\&amp;quot;: \&amp;quot;tokenType\&amp;quot;, \&amp;quot;@id\&amp;quot;: \https:&#x2F;&#x2F;schema.org&#x2F;StructuredValue\&amp;quot;}&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;title&amp;quot;: &amp;quot;tokenType&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;description&amp;quot;: &amp;quot;Describes the type of token.&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;type&amp;quot;: &amp;quot;array&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;examples&amp;quot;[[&amp;quot;fungible&amp;quot;,&amp;quot;transferable&amp;quot;]]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        &amp;quot;tokenDesc&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;$comment&amp;quot;: &amp;quot;{\&amp;quot;term\&amp;quot;: \&amp;quot;tokenDesc\&amp;quot;, \&amp;quot;@id\&amp;quot;: \&amp;quot;https:&#x2F;&#x2F;schema.org&#x2F;description\&amp;quot;}&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;title&amp;quot;: &amp;quot;tokenDesc&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;description&amp;quot;: &amp;quot;Brief description of the token and its functionality.&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;examples&amp;quot;: [&amp;quot;Protocol Token for the Matic Network&amp;quot;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        &amp;quot;standard&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;$comment&amp;quot;: &amp;quot;{\&amp;quot;term\&amp;quot;: \&amp;quot;standard\&amp;quot;, \&amp;quot;@id\&amp;quot;: \&amp;quot;https:&#x2F;&#x2F;schema.org&#x2F;citation\&amp;quot;}&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;title&amp;quot;: &amp;quot;standard&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;description&amp;quot;: &amp;quot;A resolvable URI to the description of the token standard.&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;examples&amp;quot;: [&amp;quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;blob&#x2F;master&#x2F;EIPS&#x2F;.&#x2F;00020.md&amp;quot;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        &amp;quot;address&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;$comment&amp;quot;: &amp;quot;{\&amp;quot;term\&amp;quot;: \&amp;quot;address\&amp;quot;, \&amp;quot;@id\&amp;quot;: \&amp;quot;https:&#x2F;&#x2F;schema.org&#x2F;identifier\&amp;quot;}&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;title&amp;quot;: &amp;quot;address&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;description&amp;quot;: &amp;quot;Address of the token smart contract.&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;examples&amp;quot;: [&amp;quot;0x0000000000000000000000000000000000001010&amp;quot;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        &amp;quot;addressType&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;$comment&amp;quot;: &amp;quot;{\&amp;quot;term\&amp;quot;: \&amp;quot;address\&amp;quot;, \&amp;quot;@id\&amp;quot;: \&amp;quot;https:&#x2F;&#x2F;schema.org&#x2F;Intangible\&amp;quot;}&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;title&amp;quot;: &amp;quot;addressType&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;description&amp;quot;: &amp;quot;AddressType of the token smart contract.&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;examples&amp;quot;: [&amp;quot;MaticNameSpace&amp;quot;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        &amp;quot;addressAlg&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;$comment&amp;quot;: &amp;quot;{\&amp;quot;term\&amp;quot;: \&amp;quot;addressAlg\&amp;quot;, \&amp;quot;@id\&amp;quot;: \&amp;quot;https:&#x2F;&#x2F;schema.org&#x2F;algorithm\&amp;quot;}&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;title&amp;quot;: &amp;quot;addressAlg&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;description&amp;quot;: &amp;quot;Algorithm used to create the address e.g. CREATE2 or the standard ethereum address construction which is the last 40 characters&#x2F;20 bytes of the Keccak-256 hash of a secp256k1 public key.&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;examples&amp;quot;: [&amp;quot;CREATE2&amp;quot;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        &amp;quot;name&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;$comment&amp;quot;: &amp;quot;{\&amp;quot;term\&amp;quot;: \&amp;quot;name\&amp;quot;, \&amp;quot;@id\&amp;quot;: \&amp;quot;https:&#x2F;&#x2F;schema.org&#x2F;name\&amp;quot;}&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;title&amp;quot;: &amp;quot;name&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;description&amp;quot;: &amp;quot;Token name.&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;examples&amp;quot;: [&amp;quot;Matic&amp;quot;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        &amp;quot;symbol&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;$comment&amp;quot;: &amp;quot;{\&amp;quot;term\&amp;quot;: \&amp;quot;symbol\&amp;quot;, \&amp;quot;@id\&amp;quot;: \&amp;quot;https:&#x2F;&#x2F;schema.org&#x2F;currency\&amp;quot;}&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;title&amp;quot;: &amp;quot;symbol&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;description&amp;quot;: &amp;quot;Token symbol e.g. ETH.&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;examples&amp;quot;: [&amp;quot;MATIC&amp;quot;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        &amp;quot;humanReadableTokenSymbol&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;$comment&amp;quot;: &amp;quot;{\&amp;quot;term\&amp;quot;: \&amp;quot;humanReadableTokenSymbol\&amp;quot;, \&amp;quot;@id\&amp;quot;: \&amp;quot;https:&#x2F;&#x2F;schema.org&#x2F;currency\&amp;quot;}&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;title&amp;quot;: &amp;quot;humanReadableTokenSymbol&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;description&amp;quot;: &amp;quot;A Token symbol e.g. ETH, concatenated with the `chainId` the token was issued on or bridged to, e.g. ETH-1&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;examples&amp;quot;: [&amp;quot;MATIC-137&amp;quot;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        &amp;quot;decimals&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;$comment&amp;quot;: &amp;quot;{\&amp;quot;term\&amp;quot;: \&amp;quot;decimals\&amp;quot;, \&amp;quot;@id\&amp;quot;: \&amp;quot;https:&#x2F;&#x2F;schema.org&#x2F;Number\&amp;quot;}&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;title&amp;quot;: &amp;quot;decimals&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;description&amp;quot;: &amp;quot;Allowed number of decimals for the listed token. This property may be named differently by token standards e.g. granularity for ERC-777&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;type&amp;quot;: &amp;quot;integer&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;examples&amp;quot;: [18]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        &amp;quot;logoURI&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;$comment&amp;quot;: &amp;quot;{\&amp;quot;term\&amp;quot;: \&amp;quot;logoURI\&amp;quot;, \&amp;quot;@id\&amp;quot;: \&amp;quot;https:&#x2F;&#x2F;schema.org&#x2F;identifier\&amp;quot;}&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;title&amp;quot;: &amp;quot;logoURI&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;description&amp;quot;: &amp;quot;URI or URL of the token logo following the RFC 3986 standard.&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;examples&amp;quot;: [&amp;quot;https:&#x2F;&#x2F;polygonscan.com&#x2F;token&#x2F;images&#x2F;matic_32.png&amp;quot;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        &amp;quot;createdAt&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;$comment&amp;quot;: &amp;quot;{\&amp;quot;term\&amp;quot;: \&amp;quot;createdAt\&amp;quot;, \&amp;quot;@id\&amp;quot;: \&amp;quot;https:&#x2F;&#x2F;schema.org&#x2F;datePublished\&amp;quot;}&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;title&amp;quot;: &amp;quot;createdAt&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;description&amp;quot;: &amp;quot;Date and time token was created&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;examples&amp;quot;: [&amp;quot;2020-05-31&amp;quot;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        &amp;quot;updatedAt&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;$comment&amp;quot;: &amp;quot;{\&amp;quot;term\&amp;quot;: \&amp;quot;updatedAt\&amp;quot;, \&amp;quot;@id\&amp;quot;: \&amp;quot;https:&#x2F;&#x2F;schema.org&#x2F;dateModified\&amp;quot;}&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;title&amp;quot;: &amp;quot;updatedAt&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;description&amp;quot;: &amp;quot;Date and time token was updated&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;examples&amp;quot;: [&amp;quot;2020-05-31&amp;quot;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        &amp;quot;extensions&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;title&amp;quot;: &amp;quot;extensions&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;description&amp;quot;: &amp;quot;Extension to the token list entry to specify an origin chain if the token entry refers to another chain other than the origin chain of the token&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;type&amp;quot;: &amp;quot;array&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            &amp;quot;items&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                &amp;quot;type&amp;quot;:&amp;quot;object&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                &amp;quot;required&amp;quot;: [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                    &amp;quot;rootChainId&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                    &amp;quot;rootChainURI&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                    &amp;quot;rootAddress&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                ],&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                &amp;quot;properties&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                    &amp;quot;rootChainId&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                        &amp;quot;$comment&amp;quot;: &amp;quot;{\&amp;quot;term\&amp;quot;: \&amp;quot;rootChainId\&amp;quot;, \&amp;quot;@id\&amp;quot;: \&amp;quot;https:&#x2F;&#x2F;schema.org&#x2F;identifier\&amp;quot;}&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                        &amp;quot;title&amp;quot;: &amp;quot;rootChainId&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                        &amp;quot;description&amp;quot;: &amp;quot;The typically used number identifier for the root chain on which the token was originally issued.&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                        &amp;quot;type&amp;quot;: &amp;quot;number&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                        &amp;quot;examples&amp;quot;: [137]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                    },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                    &amp;quot;rootChainURI&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                        &amp;quot;$comment&amp;quot;: &amp;quot;{\&amp;quot;term\&amp;quot;: \&amp;quot;rootChainURI\&amp;quot;, \&amp;quot;@id\&amp;quot;: \&amp;quot;https:&#x2F;&#x2F;schema.org&#x2F;identifier\&amp;quot;}&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                        &amp;quot;title&amp;quot;: &amp;quot;rootChainURI&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                        &amp;quot;description&amp;quot;: &amp;quot;A resolvable URI to the genesis block of the root chain on which the token was originally issued following the RFC 3986 standard.&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                        &amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                        &amp;quot;examples&amp;quot;: [&amp;quot;https:&#x2F;&#x2F;polygonscan.com&#x2F;block&#x2F;0&amp;quot;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                    },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                    &amp;quot;rootAddress&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                        &amp;quot;$comment&amp;quot;: &amp;quot;{\&amp;quot;term\&amp;quot;: \&amp;quot;rootAddress\&amp;quot;, \&amp;quot;@id\&amp;quot;: \&amp;quot;https:&#x2F;&#x2F;schema.org&#x2F;identifier\&amp;quot;}&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                        &amp;quot;title&amp;quot;: &amp;quot;rootAddress&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                        &amp;quot;description&amp;quot;: &amp;quot;Root address of the token smart contract.&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                        &amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                        &amp;quot;examples&amp;quot;: [&amp;quot;0x0000000000000000000000000000000000001010&amp;quot;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;additionalProperties&amp;quot;: false,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Data Schema Testability: As the above data schema follows a JSON&#x2F;JSON-LD schema format, and since such formats are known to be testable for schema conformance (see for example the W3C CCG Traceability Work Item), the above data schema is testable.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;conformance&quot;&gt;Conformance&lt;&#x2F;h3&gt;
&lt;p&gt;This section describes the conformance clauses and tests required to achieve an implementation that is provably conformant with the requirements in this document.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;conformance-targets&quot;&gt;Conformance Targets&lt;&#x2F;h4&gt;
&lt;p&gt;This document does not yet define a standardized set of test-fixtures with test inputs for all MUST, SHOULD, and MAY requirements with conditional MUST or SHOULD requirements.&lt;&#x2F;p&gt;
&lt;p&gt;A standardized set of test-fixtures with test inputs for all MUST, SHOULD, and MAY requirements with conditional MUST or SHOULD requirements is intended to be published with the next version of the standard.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;conformance-levels&quot;&gt;Conformance Levels&lt;&#x2F;h4&gt;
&lt;p&gt;This section specifies the conformance levels of this standard. The conformance levels offer implementers several levels of conformance. These can be used to establish competitive differentiation.&lt;&#x2F;p&gt;
&lt;p&gt;This document defines the conformance levels of a canonical token list as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Level 1:&lt;&#x2F;strong&gt; All MUST requirements are fulfilled by a specific implementation as proven by a test report that proves in an easily understandable manner the implementation&#x27;s conformance with each requirement based on implementation-specific test-fixtures with implementation-specific test-fixture inputs.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Level 2:&lt;&#x2F;strong&gt; All MUST and SHOULD requirements are fulfilled by a specific implementation as proven by a test report that proves in an easily understandable manner the implementation&#x27;s conformance with each requirement based on implementation-specific test-fixtures with implementation-specific test-fixture inputs.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Level 3:&lt;&#x2F;strong&gt; All MUST, SHOULD, and MAY requirements with conditional MUST or SHOULD requirements are fulfilled by a specific implementation as proven by a test report that proves in an easily understandable manner the implementation&#x27;s conformance with each requirement based on implementation-specific test-fixtures with implementation-specific test-fixture inputs.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;a name=&quot;d2&quot;&gt; &lt;strong&gt;[D2]&lt;&#x2F;strong&gt; &lt;&#x2F;a&gt;
A claim that a canonical token list implementation conforms to this specification SHOULD describe a testing procedure carried out for each requirement to which conformance is claimed, that justifies the claim with respect to that requirement.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6734&#x2F;#d2&quot;&gt;[D2]&lt;&#x2F;a&gt; testability: Since each of the non-conformance-target requirements in this documents is testable, so must be the totality of the requirements in this document. Therefore, conformance tests for all requirements can exist, and can be described as required in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6734&#x2F;#d2&quot;&gt;[D2]&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r5&quot;&gt; &lt;strong&gt;[R5]&lt;&#x2F;strong&gt; &lt;&#x2F;a&gt;
A claim that a canonical token list implementation conforms to this specification at &lt;strong&gt;Level 2&lt;&#x2F;strong&gt; or higher MUST describe the testing procedure carried out for each requirement at &lt;strong&gt;Level 2&lt;&#x2F;strong&gt; or higher, that justifies the claim to that requirement.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6734&#x2F;#r5&quot;&gt;[R5]&lt;&#x2F;a&gt; testability: Since each of the non-conformance-target requirements in this documents is testable, so must be the totality of the requirements in this document. Therefore, conformance tests for all requirements can exist, be described, be built and implemented and results can be recorded as required in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6734&#x2F;#r5&quot;&gt;[R5]&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This specification is extending and clarifying current custom lists such as from Arbitrum and Optimism as referenced in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6734&#x2F;#motivation&quot;&gt;Motivation&lt;&#x2F;a&gt; or the Uniswap Tokenlist Project to improve clarity, security and encourage adoption by non-Web3 native entities.&lt;&#x2F;p&gt;
&lt;p&gt;The specification is utilizing the current JSON-LD standard to describe a token list to allow for easy integrations with Self-Sovereign-Identity frameworks such as W3C DID and W3C Verifiable Credential standards that allow for interoperability across L2s, Sidechains and L1s when identifying token list relevant entities such as Token Issuers. In addition, being compatible to W3C utilized frameworks allows implementers to use existing tooling around JSON-LD, W3C DIDs and W3C Verifiable Credentials. The choice of referencing known data property definitions from schema.org further disambiguates the meaning and usage of terms.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;There are no additional security requirements apart from the warnings that URIs utilized in implementations of this standard might be direct to malicious resources such as websites, and that implementers should ensure that data utilized for a canonical token list is secure and correct. Since this standard is focused on a data schema and its data properties there are no additional security considerations from for example homoglyph attacks (see &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;nvd.nist.gov&#x2F;vuln&#x2F;detail&#x2F;CVE-2021-42574&quot;&gt;CVE-2021-42574 (2021-10-25T12:38:28)&lt;&#x2F;a&gt;).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;security-considerations-data-privacy&quot;&gt;Security Considerations: Data Privacy&lt;&#x2F;h3&gt;
&lt;p&gt;The standard does not set any requirements for compliance to jurisdiction legislation&#x2F;regulations. It is the responsibility of the implementer to comply with applicable data privacy laws.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;security-considerations-production-readiness&quot;&gt;Security Considerations: Production Readiness&lt;&#x2F;h3&gt;
&lt;p&gt;The standard does not set any requirements for the use of specific applications&#x2F;tools&#x2F;libraries etc. The implementer should perform due diligence when selecting specific applications&#x2F;tools&#x2F;libraries.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;security-considerations-internationalization-and-localization&quot;&gt;Security Considerations: Internationalization and Localization&lt;&#x2F;h3&gt;
&lt;p&gt;The standard encourages implementers to follow the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.w3.org&#x2F;TR&#x2F;2022&#x2F;DNOTE-string-meta-20220804&#x2F;&quot;&gt;W3C &quot;Strings on the Web: Language and Direction Metadata&quot; best practices guide&lt;&#x2F;a&gt; for identifying language and base direction for strings used on the Web wherever appropriate.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Revert creation in case of collision</title>
        <published>2023-03-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	<author>
		<name>Renan Rodrigues de Souza</name><uri>https://github.com/RenanSouza2</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/684/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-revert-on-address-collision/13442" />
        

        <id>https://wg-eips.ritovision.com/684/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:684"
            label="EIP-684" />
        

        
        

        
        <summary type="html">Revert contract creation if address already has code</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/684/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP causes contract creation to throw an error when attempted at an address with pre-existing code. This prevents an attack consisting of deploying contract code and later changing the code arbitrarily by &quot;creating&quot; an account at that existing address.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;If a contract creation is attempted due to a creation transaction, the &lt;code&gt;CREATE&lt;&#x2F;code&gt; opcode, the &lt;code&gt;CREATE2&lt;&#x2F;code&gt; opcode, or any other reason, and the destination address already has either a nonzero nonce, or a nonzero code length, then the creation MUST throw as if the first byte in the init code were an invalid opcode. This change MUST apply retroactively for all existing blocks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;One of the core tenets of smart contracts is that their code will not change. However with sufficient computing power an attacker can change the code stored in an address to any other code, steal funds or execute other malicious activity.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This is an execution layer upgrade, and so it requires a hard fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Given a genesis allocation of&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Address : 0xd0bBEc6D2c628b7e2E6D5556daA14a5181b604C5,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Balance : 1000000000000000000, &#x2F;&#x2F; 1 ether&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Nonce   : 0,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;code    : &amp;quot;&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Address : 0x7658771dc6Af74a3d2F8499D349FF9c1a0DF8826,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Balance : 0,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Nonce   : 1,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Code    : &amp;quot;0xB0B0FACE&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;A contract created in the first transaction from EOA &lt;code&gt;0xd0bBEc6...&lt;&#x2F;code&gt; (&lt;code&gt;227bcc6959669226360814723ed739f1214201584b6a27409dfb8228b8be5f59&lt;&#x2F;code&gt;), with no salt, should revert.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is a security upgrade: it enforces the immutability of deployed code.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Ethereum state using a unified verkle tree</title>
        <published>2023-03-17T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	<author>
		<name>Dankrad Feist</name><uri>https://github.com/dankrad</uri>
	</author>
	
	<author>
		<name>Kevaundray Wedderburn</name><uri>https://github.com/kevaundray</uri>
	</author>
	
	<author>
		<name>Guillaume Ballet</name><uri>https://github.com/gballet</uri>
	</author>
	
	<author>
		<name>Piper Merriam</name><uri>https://github.com/pipermerriam</uri>
	</author>
	
	<author>
		<name>Gottfried Herold</name><uri>https://github.com/GottfriedHerold</uri>
	</author>
	
	<author>
		<name>Ignacio Hagopian</name><uri>https://github.com/jsign</uri>
	</author>
	
	<author>
		<name>Tanishq Jasoria</name><uri>https://github.com/tanishqjasoria</uri>
	</author>
	
	<author>
		<name>Gajinder Singh</name><uri>https://github.com/g11tech</uri>
	</author>
	
	<author>
		<name>Danno Ferrin</name><uri>https://github.com/shemnon</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6800/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/proposed-verkle-tree-scheme-for-ethereum-state/5805" />
        

        <id>https://wg-eips.ritovision.com/6800/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:6800"
            label="EIP-6800" />
        

        
        

        
        <summary type="html">This introduces a new Verkle state tree alongside the existing MPT.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6800/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce a new Verkle state tree alongside the existing hexary Patricia tree. After the hard fork, the Verkle tree stores all edits to state and a copy of all accessed state, and the hexary Patricia tree can no longer be modified. This is a first step in a multi-phase transition to Ethereum exclusively relying on Verkle trees to store execution state.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Verkle trees solve a key problem standing in the way of Ethereum being stateless-client-friendly: witness sizes. A witness accessing an account in today’s hexary Patricia tree is, in the average case, close to 3 kB, and in the worst case it may be three times larger. Assuming a worst case of 6000 accesses per block (15m gas &#x2F; 2500 gas per access), this corresponds to a witness size of ~18 MB, which is too large to safely broadcast through a p2p network within a 12-second slot. Verkle trees reduce witness sizes to ~200 bytes per account in the average case, allowing stateless client witnesses to be acceptably small.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;verkle-tree-definition&quot;&gt;Verkle tree definition&lt;&#x2F;h3&gt;
&lt;p&gt;We define a Verkle tree here by providing the function to compute the root commitment given a set of 32-byte keys and 32-byte values. Algorithms for updating and inserting values are up to the implementer; the only requirement is that the root commitment after the update must continue to match the value computed from this specification. We will then define an embedding that provides the 32-byte key at which any particular piece of state information (account headers, code, storage) should be stored.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Bandersnatch curve order&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;BANDERSNATCH_MODULUS = \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;13108968793781547619861935127046491459309155893440570251786403306729687672801&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Bandersnatch Pedersen basis of length 256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PEDERSEN_BASIS = [....]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;VERKLE_NODE_WIDTH = len(PEDERSEN_BASIS)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def group_to_scalar_field(point: Point) -&amp;gt; int:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Not collision resistant. Not random oracle. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Binding for Pedersen commitments.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    assert isinstance(point, Point)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if point == bandersnatch.Z:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    else:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return point.map_to_base_field() % BANDERSNATCH_MODULUS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def compute_commitment_root(children: Sequence[int]) -&amp;gt; Point:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    o = bandersnatch.Z&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    for generator, child in zip(PEDERSEN_BASIS, children):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        o = bandersnatch.add(o, bandersnatch.mul(generator, child))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return o&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def extension_and_suffix_tree(stem: bytes31, values: Dict[byte, bytes32]) -&amp;gt; int:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sub_leaves = [0] * 512&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    for suffix, value in values.items():&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        sub_leaves[2 * suffix] = int.from_bytes(value[:16], &amp;#39;little&amp;#39;) + 2**128&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        sub_leaves[2 * suffix + 1] = int.from_bytes(value[16:], &amp;#39;little&amp;#39;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    C1 = compute_commitment_root(sub_leaves[:256])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    C2 = compute_commitment_root(sub_leaves[256:])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return compute_commitment_root([1, # Extension marker&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                    int.from_bytes(stem, &amp;quot;little&amp;quot;),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                    group_to_scalar_field(C1),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                    group_to_scalar_field(C2)] +&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                    [0] * 252)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def compute_main_tree_root(data: Dict[bytes32, int],&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                           prefix: bytes) -&amp;gt; int:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Empty subtree: 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if len(data) == 0:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    elif len(data) == 1:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return list(data.values())[0]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    else:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        sub_commitments = [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            compute_main_tree_root({&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    key: value for key, value in data.items() if&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    key[:len(prefix) + 1] == prefix + bytes([i])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }, prefix + bytes([i]))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            for i in range(VERKLE_NODE_WIDTH)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return group_to_scalar_field(compute_commitment_root(sub_commitments))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def compute_verkle_root(data: Dict[bytes32, bytes32]) -&amp;gt; Point:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    stems = set(key[:-1] for key in data.keys())&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    data_as_stems = {}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    for stem in stems:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        commitment_data = Dict[byte, bytes32]()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        for i in range(VERKLE_NODE_WIDTH):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if stem + bytes([i]) in data:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                commitment_data[i] = data[stem + bytes([i])]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        data_as_stems[stem] = extension_and_suffix_tree(stem, commitment_data)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sub_commitments = [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        compute_main_tree_root({&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                key: value for key, value in data.items() if&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                key[0] == i&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }, bytes([i]))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        for i in range(VERKLE_NODE_WIDTH)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return compute_commitment_root(sub_commitments)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note that a value of zero is not the same thing as a position being empty; a position being empty is represented as 0 in the bottom layer commitment, but a position being zero is represented by a different value in the suffix tree commitment (2**128 is added to value_lower to distinguish it from empty). This distinction between zero and empty is not a property of the existing Patricia tree, but it is a property of the proposed Verkle tree.&lt;&#x2F;p&gt;
&lt;p&gt;In the rest of this document, saving or reading a number at some position in the Verkle tree will mean saving or reading the 32-byte little-endian encoding of that number.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;illustration&quot;&gt;Illustration&lt;&#x2F;h3&gt;
&lt;p&gt;This is an illustration of the tree structure.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6800&#x2F;.&#x2F;assets&#x2F;tree_structure.png&quot; alt=&quot;tree structure&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;tree-embedding&quot;&gt;Tree embedding&lt;&#x2F;h3&gt;
&lt;p&gt;Instead of a two-layer structure as in the Patricia tree, in the Verkle tree we will embed all information into a single &lt;code&gt;key: value&lt;&#x2F;code&gt; tree. This section specifies which tree keys store the information (account header data, code, storage) in the state.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;BASIC_DATA_LEAF_KEY&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;CODE_HASH_LEAF_KEY&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;HEADER_STORAGE_OFFSET&lt;&#x2F;td&gt;&lt;td&gt;64&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;CODE_OFFSET&lt;&#x2F;td&gt;&lt;td&gt;128&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;VERKLE_NODE_WIDTH&lt;&#x2F;td&gt;&lt;td&gt;256&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;MAIN_STORAGE_OFFSET&lt;&#x2F;td&gt;&lt;td&gt;256**31&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;&lt;em&gt;It’s a required invariant that &lt;code&gt;VERKLE_NODE_WIDTH &amp;gt; CODE_OFFSET &amp;gt; HEADER_STORAGE_OFFSET&lt;&#x2F;code&gt; and that &lt;code&gt;HEADER_STORAGE_OFFSET&lt;&#x2F;code&gt; is greater than the leaf keys. Additionally, &lt;code&gt;MAIN_STORAGE_OFFSET&lt;&#x2F;code&gt; must be a power of &lt;code&gt;VERKLE_NODE_WIDTH&lt;&#x2F;code&gt;.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Note that addresses are always passed around as an &lt;code&gt;Address32&lt;&#x2F;code&gt;. To convert existing addresses to &lt;code&gt;Address32&lt;&#x2F;code&gt;, prepend with 12 zero bytes:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def old_style_address_to_address32(address: Address) -&amp;gt; Address32:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return b&amp;#39;\x00&amp;#39; * 12 + address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;header-values&quot;&gt;Header values&lt;&#x2F;h4&gt;
&lt;p&gt;These are the positions in the tree at which block header fields of an account are stored.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def hash_point_to_bytes(point: Point) -&amp;gt; int:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return group_to_scalar_field(point).to_bytes(32, &amp;#39;little&amp;#39;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def pedersen_hash(inp: bytes) -&amp;gt; bytes32:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    assert len(inp) &amp;lt;= 255 * 16&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Interpret input as list of 128 bit (16 byte) integers&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ext_input = inp + b&amp;quot;\0&amp;quot; * (255 * 16 - len(inp))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ints = [2 + 256 * len(inp)] + \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;           [int.from_bytes(ext_input[16 * i:16 * (i + 1)], &amp;#39;little&amp;#39;) for i in range(255)]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return compute_commitment_root(ints).hash_point_to_bytes()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def get_tree_key(address: Address32, tree_index: int, sub_index: int):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Assumes VERKLE_NODE_WIDTH = 256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        pedersen_hash(address + tree_index.to_bytes(32, &amp;#39;little&amp;#39;))[:31] +&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bytes([sub_index])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def get_tree_key_for_basic_data(address: Address32):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return get_tree_key(address, 0, BASIC_DATA_LEAF_KEY)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Backwards compatibility for EXTCODEHASH    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def get_tree_key_for_code_hash(address: Address32):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return get_tree_key(address, 0, CODE_HASH_LEAF_KEY)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;An account&#x27;s &lt;code&gt;version&lt;&#x2F;code&gt;, &lt;code&gt;balance&lt;&#x2F;code&gt;, &lt;code&gt;nonce&lt;&#x2F;code&gt; and &lt;code&gt;code_size&lt;&#x2F;code&gt; fields are packed with big-endian encoding in the value found at &lt;code&gt;BASIC_DATA_LEAF_KEY&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Offset&lt;&#x2F;th&gt;&lt;th&gt;Size&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;version&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;code_size&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;nonce&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;8&lt;&#x2F;td&gt;&lt;td&gt;8&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;balance&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;16&lt;&#x2F;td&gt;&lt;td&gt;16&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Bytes &lt;code&gt;1..4&lt;&#x2F;code&gt; are reserved for future use.&lt;&#x2F;p&gt;
&lt;p&gt;The current layout and encoding allow for an extension of &lt;code&gt;code_size&lt;&#x2F;code&gt; to 4 bytes without changing the account version.&lt;&#x2F;p&gt;
&lt;p&gt;When any account header field is set, the &lt;code&gt;version&lt;&#x2F;code&gt; field is also set to zero. The &lt;code&gt;codehash&lt;&#x2F;code&gt; and &lt;code&gt;code_size&lt;&#x2F;code&gt; fields are set upon contract or EoA creation.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;code&quot;&gt;Code&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def get_tree_key_for_code_chunk(address: Address32, chunk_id: int):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return get_tree_key(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (CODE_OFFSET + chunk_id) &#x2F;&#x2F; VERKLE_NODE_WIDTH,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (CODE_OFFSET + chunk_id)  % VERKLE_NODE_WIDTH&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Chunk &lt;code&gt;i&lt;&#x2F;code&gt; stores a 32 byte value, where bytes 1…31 are bytes &lt;code&gt;i*31...(i+1)*31 - 1&lt;&#x2F;code&gt; of the code (ie. the i’th 31-byte slice of it), and byte 0 is the number of leading bytes that are part of PUSHDATA (eg. if part of the code is &lt;code&gt;...PUSH4 99 98 | 97 96 PUSH1 128 MSTORE...&lt;&#x2F;code&gt; where &lt;code&gt;|&lt;&#x2F;code&gt; is the position where a new chunk begins, then the encoding of the latter chunk would begin &lt;code&gt;2 97 96 PUSH1 128 MSTORE&lt;&#x2F;code&gt; to reflect that the first 2 bytes are PUSHDATA).&lt;&#x2F;p&gt;
&lt;p&gt;For precision, here is an implementation of code chunkification:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH_OFFSET = 95&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH1 = PUSH_OFFSET + 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH32 = PUSH_OFFSET + 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def chunkify_code(code: bytes) -&amp;gt; Sequence[bytes32]:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Pad to multiple of 31 bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if len(code) % 31 != 0:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        code += b&amp;#39;\x00&amp;#39; * (31 - (len(code) % 31))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Figure out how much pushdata there is after+including each byte&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytes_to_exec_data = [0] * (len(code) + 32)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    pos = 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    while pos &amp;lt; len(code):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        if PUSH1 &amp;lt;= code[pos] &amp;lt;= PUSH32:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            pushdata_bytes = code[pos] - PUSH_OFFSET&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        else:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            pushdata_bytes = 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        pos += 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        for x in range(pushdata_bytes):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            bytes_to_exec_data[pos + x] = pushdata_bytes - x&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        pos += pushdata_bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Output chunks&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bytes([min(bytes_to_exec_data[pos], 31)]) + code[pos: pos+31]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        for pos in range(0, len(code), 31)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;storage&quot;&gt;Storage&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def get_tree_key_for_storage_slot(address: Address32, storage_key: int):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if storage_key &amp;lt; (CODE_OFFSET - HEADER_STORAGE_OFFSET):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        pos = HEADER_STORAGE_OFFSET + storage_key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    else:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        pos = MAIN_STORAGE_OFFSET + storage_key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return get_tree_key(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        pos &#x2F;&#x2F; VERKLE_NODE_WIDTH,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        pos % VERKLE_NODE_WIDTH&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note that storage slots in the same size &lt;code&gt;VERKLE_NODE_WIDTH&lt;&#x2F;code&gt; range (ie. a range the form &lt;code&gt;x*VERKLE_NODE_WIDTH ... (x+1)*VERKLE_NODE_WIDTH-1)&lt;&#x2F;code&gt; are all, with the exception of the &lt;code&gt;HEADER_STORAGE_OFFSET&lt;&#x2F;code&gt; special case, part of a single commitment. This is an optimization to make witnesses more efficient when related storage slots are accessed together. If desired, this optimization can be exposed to the gas schedule, making it more gas-efficient to make contracts that store related slots together (however, Solidity already stores in this way by default).&lt;&#x2F;p&gt;
&lt;h4 id=&quot;fork&quot;&gt;Fork&lt;&#x2F;h4&gt;
&lt;p&gt;Described in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7612&#x2F;&quot;&gt;EIP-7612&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;access-events&quot;&gt;Access events&lt;&#x2F;h4&gt;
&lt;p&gt;Described in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4762&#x2F;&quot;&gt;EIP-4762&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This implements all of the logic in transitioning to a Verkle tree, and at the same time reforms gas costs, but does so in a minimally disruptive way that does not require simultaneously changing the whole tree structure. Instead, we add a new Verkle tree that starts out empty, and only new changes to state and copies of accessed state are stored in the tree. The Patricia tree continues to exist, but is frozen.&lt;&#x2F;p&gt;
&lt;p&gt;This sets the stage for a future hard fork that swaps the Patricia tree in-place with a Verkle tree storing the same data. Unlike &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2584&#x2F;&quot;&gt;EIP-2584&lt;&#x2F;a&gt;, this replacement Verkle tree does not need to be computed by clients in real time. Instead, because the Patricia tree would at that point be fixed, the replacement Verkle tree can be computed off-chain.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;verkle-tree-design&quot;&gt;Verkle tree design&lt;&#x2F;h3&gt;
&lt;p&gt;The Verkle tree uses a single-layer tree structure with 32-byte keys and values for several reasons:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Simplicity&lt;&#x2F;strong&gt;: working with the abstraction of a key&#x2F;value store makes it easier to write code dealing with the tree (eg. database reading&#x2F;writing, caching, syncing, proof creation and verification) as well as to upgrade it to other trees in the future. Additionally, witness gas rules can become simpler and clearer.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Uniformity&lt;&#x2F;strong&gt;: the state is uniformly spread out throughout the tree; even if a single contract has many millions of storage slots, the contract’s storage slots are not concentrated in one place. This is useful for state syncing algorithms. Additionally, it helps reduce the effectiveness of unbalanced tree filling attacks.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Extensibility&lt;&#x2F;strong&gt;: account headers and code being in the same structure as storage makes it easier to extend the features of both, and even add new structures if later desired.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;gas-reform&quot;&gt;Gas reform&lt;&#x2F;h3&gt;
&lt;p&gt;Gas costs for reading storage and code are reformed to more closely reflect the gas costs under the new Verkle tree design. WITNESS_CHUNK_COST is set to charge 6.25 gas per byte for chunks, and WITNESS_BRANCH_COST is set to charge ~13,2 gas per byte for branches on average (assuming 144 byte branch length) and ~2.5 gas per byte in the worst case if an attacker fills the tree with keys deliberately computed to maximize proof length.&lt;&#x2F;p&gt;
&lt;p&gt;The main differences from gas costs in Berlin are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;200 gas charged per 31 byte chunk of code. This has been estimated to increase average gas usage by ~6-12%&lt;&#x2F;li&gt;
&lt;li&gt;Cost for accessing adjacent storage slots (&lt;code&gt;key1 &#x2F;&#x2F; 256 == key2 &#x2F;&#x2F; 256&lt;&#x2F;code&gt;) decreases from 2100 to 200 for all slots after the first in the group,&lt;&#x2F;li&gt;
&lt;li&gt;Cost for accessing storage slots 0…63 decreases from 2100 to 200, including the first storage slot. This is likely to significantly improve performance of many existing contracts, which use those storage slots for single persistent variables.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Gains from the latter two properties have not yet been analyzed, but are likely to significantly offset the losses from the first property. It’s likely that once compilers adapt to these rules, efficiency will increase further.&lt;&#x2F;p&gt;
&lt;p&gt;The precise specification of when access events take place, which makes up most of the complexity of the gas repricing, is necessary to clearly specify when data needs to be saved to the period 1 tree.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The main backwards-compatibility-breaking changes are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;(1) Gas costs for code chunk access making some applications less economically viable&lt;&#x2F;li&gt;
&lt;li&gt;(2) Tree structure change makes in-EVM proofs of historical state no longer work&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;(1) can be mitigated by increasing the gas limit at the same time as implementing this EIP, reducing the risk that applications will no longer work at all due to transaction gas usage rising above the block gas limit.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TODO&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;github.com&#x2F;gballet&#x2F;go-ethereum, branch beverly-hills-just-after-pbss - a geth implementation&lt;&#x2F;li&gt;
&lt;li&gt;github.com&#x2F;NethermindEth&#x2F;nethermind, branch verkle&#x2F;tree - a nethermind implementation&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EVM Modular Arithmetic Extensions</title>
        <published>2023-03-15T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Jared Wasinger</name><uri>https://github.com/jwasinger</uri>
	</author>
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	<author>
		<name>Radosław Zagórowicz</name><uri>https://github.com/rodiazet</uri>
	</author>
	
	<author>
		<name>Paweł Bylica</name><uri>https://github.com/chfast</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6690/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6690-evm-modular-arithmetic-extensions/13322" />
        

        <id>https://wg-eips.ritovision.com/6690/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:6690"
            label="EIP-6690" />
        

        
        

        
        <summary type="html">Expanded-width, efficient modular arithmetic operations for the EVM</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6690/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes new EVM modular arithmetic opcodes which support operations on odd or power-of-two moduli between 3 and 2**768-1&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Current opcodes for modular arithmetic only support values up to 256 bits wide.  In addition, they are permissive and accept any representable value for the inputs.&lt;&#x2F;p&gt;
&lt;p&gt;Many cryptographic operations are heavily-bottlenecked by modular arithmetic.  To expand the range of cryptographic primitives that can be implemented efficiently as EVM contracts, we propose new modular arithmetic opcodes designed for efficiency.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;COST_SETMODX_BASE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;static cost component for the &lt;code&gt;SETMODX&lt;&#x2F;code&gt; opcode&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;COST_STOREX_BASE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;static cost for the &lt;code&gt;STOREX&lt;&#x2F;code&gt; opcode&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;COST_LOADX_BASE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;static cost for the &lt;code&gt;LOADX&lt;&#x2F;code&gt; opcode&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;conventions&quot;&gt;Conventions&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;The use of &lt;code&gt;assert&lt;&#x2F;code&gt; implies that if the assertion fails, the current call frame will consume all call gas and terminate call execution in an exceptional state.&lt;&#x2F;li&gt;
&lt;li&gt;Unless otherwise stated, the implied unit for size is bytes.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;overview&quot;&gt;Overview&lt;&#x2F;h3&gt;
&lt;p&gt;The execution state of an EVM call frame is modified to include a mapping of &lt;code&gt;id&lt;&#x2F;code&gt; (a number 0-256) to a field context.  A field context comprises a modulus and an allocated space of virtual registers to perform modular arithmetic operations on.&lt;&#x2F;p&gt;
&lt;p&gt;An executing contract uses a new instruction &lt;code&gt;SETMODX&lt;&#x2F;code&gt; to set the active field context, allocating a new one in the mapping if it does not already exist for &lt;code&gt;id&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;New arithmetic opcodes perform modular addition, subtraction and multiplication with inputs&#x2F;outputs from virtual registers of the active field context.&lt;&#x2F;p&gt;
&lt;p&gt;New load&#x2F;store opcodes copy values to and from EVM memory and the virtual registers allocated by the active field context.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;new-opcodes&quot;&gt;New Opcodes&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;setmodx-0xc0&quot;&gt;&lt;code&gt;SETMODX(0xc0)&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;Input&lt;&#x2F;strong&gt;: &lt;code&gt;&amp;lt;top of stack&amp;gt; id modulus_offset modulus_size alloc_count&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Output&lt;&#x2F;strong&gt;: none&lt;&#x2F;p&gt;
&lt;h5 id=&quot;execution&quot;&gt;Execution&lt;&#x2F;h5&gt;
&lt;p&gt;Charge &lt;code&gt;COST_SETMODX_BASE&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Assert &lt;code&gt;0 &amp;lt;= id &amp;lt;= 256&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;If a field context for &lt;code&gt;id&lt;&#x2F;code&gt; exists in this call scope:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Set it as the active one.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Otherwise:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Assert &lt;code&gt;modulus_size &amp;lt;= 96&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Assert that the byte range&lt;code&gt;[modulus_offset, modulus_offset+modulus_size]&lt;&#x2F;code&gt; falls within EVM memory.&lt;&#x2F;li&gt;
&lt;li&gt;Load the byte range from EVM memory, interpreting it as a big endian &lt;code&gt;modulus&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Assert &lt;code&gt;modulus&lt;&#x2F;code&gt; is odd or is a power of two.&lt;&#x2F;li&gt;
&lt;li&gt;Assert &lt;code&gt;3 &amp;lt;= modulus &amp;lt;= 2**768 - 1&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Assert &lt;code&gt;0 &amp;lt; alloc_count &amp;lt;= 256&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Define the size of elements stored in virtual registers: &lt;code&gt;element_size&lt;&#x2F;code&gt; as the size needed to represent the modulus padded to be a multiple of 64 bits.  Implementations will align virtual register values along system-word lines.&lt;&#x2F;li&gt;
&lt;li&gt;assert that the new size of all virtual registers allocated in the current call-context does not exceed 24576 bytes.&lt;&#x2F;li&gt;
&lt;li&gt;Charge EVM memory expansion cost to expand memory by &lt;code&gt;alloc_count * element_size&lt;&#x2F;code&gt; bytes:.&lt;&#x2F;li&gt;
&lt;li&gt;if the modulus is odd, charge the dynamic cost component (defined below)&lt;&#x2F;li&gt;
&lt;li&gt;Allocate the new field context with &lt;code&gt;alloc_count&lt;&#x2F;code&gt; initially-zeroed registers. Associate it with &lt;code&gt;id&lt;&#x2F;code&gt; in the mapping.&lt;&#x2F;li&gt;
&lt;li&gt;The new field context is now set as the active one.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;dynamic-cost-component-for-odd-moduli&quot;&gt;Dynamic Cost Component for Odd Moduli&lt;&#x2F;h5&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Modulus size (padded to nearest 64 bits)&lt;&#x2F;th&gt;&lt;th&gt;cost&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;64 bits&lt;&#x2F;td&gt;&lt;td&gt;23&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;128 bits&lt;&#x2F;td&gt;&lt;td&gt;26&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;192 bits&lt;&#x2F;td&gt;&lt;td&gt;29&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;256 bits&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;320 bits&lt;&#x2F;td&gt;&lt;td&gt;36&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;384 bits&lt;&#x2F;td&gt;&lt;td&gt;39&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;448 bits&lt;&#x2F;td&gt;&lt;td&gt;42&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;512 bits&lt;&#x2F;td&gt;&lt;td&gt;45&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;576 bits&lt;&#x2F;td&gt;&lt;td&gt;48&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;640 bits&lt;&#x2F;td&gt;&lt;td&gt;51&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;704 bits&lt;&#x2F;td&gt;&lt;td&gt;54&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;768 bits&lt;&#x2F;td&gt;&lt;td&gt;58&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The values in this table are based on the following linear cost model:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def cost_setmodx_dynamic(modulus_size: int) -&amp;gt; int:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    limb_count = (modulus_size + 7) &#x2F; 8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return round(limb_count * 3.13 + 19.94)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;arithmetic-opcodes&quot;&gt;Arithmetic Opcodes&lt;&#x2F;h4&gt;
&lt;p&gt;Opcodes &lt;code&gt;ADDMODX(0xc3)&lt;&#x2F;code&gt;, &lt;code&gt;SUBMODX(0xc4)&lt;&#x2F;code&gt;, &lt;code&gt;MULMODX(0xc5)&lt;&#x2F;code&gt; take a 7 byte immediate interpreted as byte values &lt;code&gt;out_idx&lt;&#x2F;code&gt;, &lt;code&gt;out_stride&lt;&#x2F;code&gt;, &lt;code&gt;x_idx&lt;&#x2F;code&gt;, &lt;code&gt;x_stride&lt;&#x2F;code&gt;, &lt;code&gt;y_idx&lt;&#x2F;code&gt;, &lt;code&gt;y_stride&lt;&#x2F;code&gt;, &lt;code&gt;count&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Define cost tables for each arithmetic operation based on the modulus:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Modulus size (padded to nearest 64 bits)&lt;&#x2F;th&gt;&lt;th&gt;cost per add&#x2F;sub&lt;&#x2F;th&gt;&lt;th&gt;cost per mul&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;64&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;128&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;192&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;256&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;320&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;384&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;448&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;4&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;512&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;576&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;7&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;640&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;8&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;704&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;10&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;768&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;12&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The values in this table correspond to the following cost models:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def cost_add_or_sub(modulus_size: int) -&amp;gt; int:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    limb_count = (modulus_size + 7) &#x2F;&#x2F; 8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return round(limb_count * 0.12 + 0.58)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def cost_mul(modulus_size: int) -&amp;gt; int:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    limb_count = (modulus_size + 7) &#x2F;&#x2F; 8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return round((0.08 * limb_count**2) + (-0.06 * limb_count) + 0.75)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Execution asserts:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;all accessed values fall within bounds: &lt;code&gt;max([out_idx + (out_stride * count), x_idx + (x_stride * count), y_idx + (y_stride * count)]) &amp;lt; len(field_context.registers)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;out_stride != 0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;count != 0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;an active field context &lt;code&gt;active_ctx&lt;&#x2F;code&gt; is set.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Then, charge &lt;code&gt;count * operation_cost&lt;&#x2F;code&gt; where &lt;code&gt;operation_cost&lt;&#x2F;code&gt; is drawn from the cost table. Compute:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;for i in range(count):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    active_ctx.registers[out_idx+i*out_stride] = operation(active_ctx.registers[x_idx+i*x_stride], active_ctx.registers[y_idx+i*y_stride])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Where &lt;code&gt;operation&lt;&#x2F;code&gt; computes modular addition, subtraction or multiplication depending on the opcode.&lt;&#x2F;p&gt;
&lt;p&gt;Note: Inputs&#x2F;outputs can overlap. &lt;code&gt;active_ctx.registers&lt;&#x2F;code&gt; is not modified until all operations in the loop have completed.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;data-transfer-opcodes&quot;&gt;Data Transfer Opcodes&lt;&#x2F;h4&gt;
&lt;p&gt;Note: serialization format for values in EVM memory: big-endian padded to &lt;code&gt;active_ctx.element_size&lt;&#x2F;code&gt; bytes.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;loadx-0xc1&quot;&gt;&lt;code&gt;LOADX(0xc1)&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;p&gt;&lt;strong&gt;Stack in&lt;&#x2F;strong&gt;: &lt;code&gt;(top of stack) dest source count&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Stack out&lt;&#x2F;strong&gt;: none&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Description&lt;&#x2F;strong&gt;: copies values from registers in the currently-active field context to EVM memory.&lt;&#x2F;p&gt;
&lt;h6 id=&quot;execution-1&quot;&gt;Execution&lt;&#x2F;h6&gt;
&lt;ul&gt;
&lt;li&gt;Assert that a field context is set as active in the current call frame.&lt;&#x2F;li&gt;
&lt;li&gt;Assert that the range &lt;code&gt;[source, source + count]&lt;&#x2F;code&gt; falls within the active field context&#x27;s zero-indexed value space.&lt;&#x2F;li&gt;
&lt;li&gt;Assert that the range &lt;code&gt;[dest, dest + count * active_ctx.element_size]&lt;&#x2F;code&gt; falls entirely within EVM memory.&lt;&#x2F;li&gt;
&lt;li&gt;If modulus is a power of two:
&lt;ul&gt;
&lt;li&gt;charge &lt;code&gt;(active_ctxt.element_size + 31) &#x2F;&#x2F; 32 * 3&lt;&#x2F;code&gt; gas (the same as the memory copying component for the &lt;code&gt;MCOPY&lt;&#x2F;code&gt; opcode)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;If modulus is odd:
&lt;ul&gt;
&lt;li&gt;charge &lt;code&gt;count * operation_cost&lt;&#x2F;code&gt; gas, where &lt;code&gt;operation_cost&lt;&#x2F;code&gt; is looked up from the multiplication cost table, given &lt;code&gt;active_ctxt.element_size&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;copy virtual register values &lt;code&gt;[source, source + count]&lt;&#x2F;code&gt; to memory &lt;code&gt;[dest, dest + count * active_ctx.element_size]&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;storex-0xc2&quot;&gt;&lt;code&gt;STOREX(0xc2)&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;p&gt;&lt;strong&gt;Stack in&lt;&#x2F;strong&gt;: &lt;code&gt;dest source count&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Stack out&lt;&#x2F;strong&gt;: none&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Description&lt;&#x2F;strong&gt;: copies values from EVM memory into registers of the currently-active field context.&lt;&#x2F;p&gt;
&lt;h6 id=&quot;execution-2&quot;&gt;Execution&lt;&#x2F;h6&gt;
&lt;ul&gt;
&lt;li&gt;Assert that a field context is set as active in the current call frame.&lt;&#x2F;li&gt;
&lt;li&gt;Assert &lt;code&gt;dest + count&lt;&#x2F;code&gt; is less than or equal to the number of the active field context&#x27;s virtual registers.&lt;&#x2F;li&gt;
&lt;li&gt;If modulus of the active context is a power of two:
&lt;ul&gt;
&lt;li&gt;charge &lt;code&gt;cost_mem_copy(count * active_ctx.element_size)&lt;&#x2F;code&gt; (TBD: deliberately didn&#x27;t choose &lt;code&gt;mcopy&lt;&#x2F;code&gt; gas model to see if this can consider a cheaper one).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Else if modulus of the active context is odd:
&lt;ul&gt;
&lt;li&gt;charge &lt;code&gt;count * operation_cost&lt;&#x2F;code&gt; gas, where &lt;code&gt;operation_cost&lt;&#x2F;code&gt; is looked up from the multiplication cost table, given &lt;code&gt;active_ctxt.element_size&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Assert that &lt;code&gt;[source, source + count * active_context.element_size]&lt;&#x2F;code&gt; falls entirely within EVM memory.  Interpret it as &lt;code&gt;count&lt;&#x2F;code&gt; number of values, asserting that each is less than the modulus and storing them in the registers &lt;code&gt;[dest, dest + count]&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;evm-memory-expansion-cost-modification&quot;&gt;EVM Memory Expansion Cost Modification&lt;&#x2F;h3&gt;
&lt;p&gt;When expanding EVM memory or allocating a new field context via &lt;code&gt;SETMODX&lt;&#x2F;code&gt;, expansion cost will now consider the size of all allocated virtual registers in the current call frame.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;separation-of-evm-memory-and-evmmax-virtual-register-space&quot;&gt;Separation of EVM Memory and EVMMAX Virtual Register Space&lt;&#x2F;h3&gt;
&lt;p&gt;It is assumed that optimized implementations will not store values in EVM-compatible big-endian serialization format, but instead convert them to an internal working representation.  The costs in the spec explicitly reflect the choice of Montgomery form as an optimal internal representation.&lt;&#x2F;p&gt;
&lt;p&gt;Values represented in Montgomery form can make use of optimized modular reduction for multiplication.  See the dedicated section on Montgomery multiplication in the rationale for more details.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;total-virtual-register-allocation-cap&quot;&gt;Total Virtual Register Allocation Cap&lt;&#x2F;h3&gt;
&lt;p&gt;24576 bytes is chosen as the per-call-context allocation limit with the goal of ensuring that the virtual register space can be contained in the L1 CPU data cache of most machines (with room to spare), in order that arithmetic operation costs do not have to account for memory access latency.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;setmodx-cost&quot;&gt;SETMODX cost&lt;&#x2F;h3&gt;
&lt;p&gt;For odd moduli, &lt;code&gt;SETMODX&lt;&#x2F;code&gt; precomputes two values used for optimized modular multiplication via Montgomery reduction.  This is dominated by a modular reduction by the modulus, so the cost model is assumed to be linear.&lt;&#x2F;p&gt;
&lt;p&gt;Power-of-two moduli require no precomputation for optimized modular arithmetic.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;loadx-storex-costs&quot;&gt;LOADX&#x2F;STOREX costs&lt;&#x2F;h3&gt;
&lt;p&gt;For power-of-two moduli, &lt;code&gt;LOADX&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;STOREX&lt;&#x2F;code&gt; are assumed to copy values directly between EVM&#x2F;EVMMAX memories without measurable conversion cost to convert between EVM big-endian serialization and whatever internal representation is used.&lt;&#x2F;p&gt;
&lt;p&gt;For odd moduli, the spec assumes that the internal representation is Montgomery form.  Conversion between canonical&#x2F;Montgomery form requires one modular multiplication per value per direction.  The cost of memory copying is baked in to the multiplication price model.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;arithmetic-costs&quot;&gt;Arithmetic Costs&lt;&#x2F;h3&gt;
&lt;p&gt;Addition&#x2F;subtraction&#x2F;multiplication are assumed to have constant-time implementations.  Addition&#x2F;subtraction can be implemented with linear complexity, while multiplication is quadratic in the size of the modulus.&lt;&#x2F;p&gt;
&lt;p&gt;The costs for power-of-two modular multiplication are provisional, and likely be brought down when an optimized arithmetic implementation is rolled out and benchmarked.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;montgomery-modular-multiplication&quot;&gt;Montgomery Modular Multiplication&lt;&#x2F;h3&gt;
&lt;p&gt;For a value &lt;code&gt;A&lt;&#x2F;code&gt;, an odd modulus &lt;code&gt;M&lt;&#x2F;code&gt; and a value &lt;code&gt;R&lt;&#x2F;code&gt; (must be coprime and greater than &lt;code&gt;M&lt;&#x2F;code&gt;, chosen as a power of two for efficient performance), the Montgomery representation is &lt;code&gt;A * R % M&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Define the Montgomery modular multiplication of two values &lt;code&gt;A&lt;&#x2F;code&gt; and &lt;code&gt;B&lt;&#x2F;code&gt;: &lt;code&gt;mulmont(A, B, M): A * B * R**-1 % M&lt;&#x2F;code&gt; where &lt;code&gt;R**-1 % M&lt;&#x2F;code&gt; is the modular inverse of &lt;code&gt;R&lt;&#x2F;code&gt; with respect to &lt;code&gt;M&lt;&#x2F;code&gt;.  There is various literature and algorithms for computing &lt;code&gt;mulmont&lt;&#x2F;code&gt; which have been published since 1985, and the operation is used ubiquitously where execution is bottlenecked by operations over odd moduli.&lt;&#x2F;p&gt;
&lt;p&gt;Note that normal modular addition and subtraction algorithms work for Montgomery form values.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;conversion-of-canonical-to-montgomery-representation&quot;&gt;Conversion of Canonical to Montgomery Representation&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;mulmont(canon_val, R**2 % M, M) = mont_val&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;conversion-from-montgomery-to-canonical-representation&quot;&gt;Conversion from Montgomery to Canonical representation&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;mulmont(mont_val, 1, M) = canon_val&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Basic Montgomery Multiplication&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#   x, y, mod (int) - x &amp;lt; mod and y &amp;lt; mod&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#   mod (int) - an odd modulus&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#   R (int) -  a power of two, and greater than mod&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#   mont_const (int) - pow(-mod, -1, R), precomputed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# output:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#  (x * y * pow(R, -1, mod)) % mod&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def mulmont(x: int, y: int, mod: int, mont_const: int, R: int) -&amp;gt; int:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    t = x * y&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    m = ((t % R) * mont_const) % R&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    t = t + m * mod&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    t &#x2F;= R&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if t &amp;gt;= mod:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        t -= mod&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return t&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;There are various optimized algorithms for computing Montgomery Multiplication of bigint numbers expressed as arrays of system words.&lt;&#x2F;p&gt;
&lt;p&gt;These all use a different precomputed constant &lt;code&gt;mont_const = pow(-mod, -1, 2**SYSTEM_WORD_SIZE_BITS)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;There are tests contained in the Geth implementation.  However, no cross-client tests exist yet.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;There is an implementation of this EIP in an open PR to Go Ethereum.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Collateralized NFT</title>
        <published>2023-03-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>571nKY</name><uri>https://github.com/571nKY</uri>
	</author>
	
	<author>
		<name>Cosmos</name><uri>https://github.com/Cosmos4k</uri>
	</author>
	
	<author>
		<name>f4t50</name><uri>https://github.com/f4t50</uri>
	</author>
	
	<author>
		<name>Harpocrates</name><uri>https://github.com/harpocrates555</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7595/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/collateralized-nft-standard/18097" />
        

        <id>https://wg-eips.ritovision.com/7595/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:7595"
            label="ERC-7595" />
        

        
        

        
        <summary type="html">ERC-721 Extension to enable collateralization with ERC-20 based tokens.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7595/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal recommends an extension of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; to allow for collateralization using a list of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; based tokens. The proprietor of this ERC collection could hold both the native coin and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; based tokens, with the &lt;code&gt;ownerOf&lt;&#x2F;code&gt; tokenId being able to unlock the associated portion of the underlying &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; balance.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The emerging trend of NFT finance focuses on the NFT floor price to enable the market value of the NFT serve as a collateral in lending protocols. The NFT floor price is susceptible to the supply-demand dynamics of the NFT market, characterized by higher volatility compared to the broader crypto market. Furthermore, potential price manipulation in specific NFT collections can artificially inflate NFT market prices, impacting the floor price considered by lending protocols. Relying solely on the NFT floor price based on market value is both unpredictable and unreliable.&lt;&#x2F;p&gt;
&lt;p&gt;This ERC addresses various challenges encountered by the crypto community with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; based collections and assets. This ERC brings forth advantages such as sustainable NFT royalties supported by tangible assets, an on-chain verifiable floor price, and the introduction of additional monetization avenues for NFT collection creators.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;presets&quot;&gt;Presets&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The Basic Preset allows for the evaluation of an on-chain verifiable price floor for a specified NFT asset.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The Dynamic Preset facilitates on-chain modification of tokenURI based on predefined collateral rules for a specified NFT asset.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;With the Royalty Preset, NFT collection creators can receive royalty payments for each transaction involving asset owners and Externally Owned Accounts (EOA), as well as transactions with smart contracts.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The VRF Preset enables the distribution of collateral among multiple NFT asset holders using the Verifiable Random Function (VRF) by Chainlink.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;extension-to-existing-erc-721-based-collections&quot;&gt;Extension to Existing ERC-721 Based Collections&lt;&#x2F;h3&gt;
&lt;p&gt;For numerous &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; based collections that cannot be redeployed, we propose the implementation of an abstraction layer embodied by a smart contract. This smart contract would replicate all the functionalities of this ERC standard and grant access to collateral through mapping.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;erc-standard-for-new-nft-collections&quot;&gt;ERC standard for new NFT collections&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC721Envious&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC721&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Collateralized&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Uncollateralized&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Dispersed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Harvested&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; scaledAmount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array with two elements. Each of them represents percentage from collateral&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * to be taken as a commission. First element represents collateralization commission.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * Second element represents uncollateralization commission. There should be 3 &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * decimal buffer for each of them, e.g. 1000 = 1%.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 256 index of value in array.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; commissions&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &amp;#39;Black hole&amp;#39; is any address that guarantees that tokens sent to it will not be &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * retrieved from it. &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: some tokens revert on transfer to zero address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address of black hole.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; blackHole&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Token that will be used to harvest collected commissions.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address of token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; communityToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Pool of available tokens for harvesting.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; index in array.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address of token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; communityPool&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Token balance available for harvesting.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address of token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; token balance.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; communityBalance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Array of tokens that have been dispersed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; index in array.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address of dispersed token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; disperseTokens&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Amount of tokens that has been dispersed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address of token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; token balance.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; disperseBalance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Amount of tokens that was already taken from the disperse.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address of token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; total amount of tokens already taken.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; disperseTotalTaken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Amount of disperse already taken by each tokenId.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; unique identifier of unit.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address of token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; amount of tokens already taken.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; disperseTaken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Mapping of `tokenId`s to token addresses that have collateralized before.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; unique identifier of unit.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; index&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; in array.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address of token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; collateralTokens&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Token balances that are stored under `tokenId`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; unique identifier of unit.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address of token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; token balance.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; collateralBalances&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Calculator function for harvesting.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; of `communityToken`s to spend&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address of token to be harvested&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; to harvest based on inputs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getAmount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Collect commission fees gathered in exchange for `communityToken`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amounts&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;[] array of amounts to collateralize&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;[] array of token addresses&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; harvest&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amounts&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenAddresses&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Collateralize NFT with different tokens and amounts.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; unique identifier for specific NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amounts&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;[] array of amounts to collateralize&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;[] array of token addresses&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; collateralize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amounts&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenAddresses&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Withdraw underlying collateral.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * - only owner of NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; unique identifier for specific NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amounts&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;[] array of amounts to collateralize&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;[] array of token addresses&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; uncollateralize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amounts&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenAddresses&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Split collateral among all existent tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amounts&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;[] to be dispersed among all NFT owners&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;[] address of token to be dispersed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; disperse&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amounts&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenAddresses&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;abstraction-layer-for-already-deployed-nft-collections&quot;&gt;Abstraction layer for already deployed NFT collections&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IEnviousHouse&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Collateralized&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Uncollateralized&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Dispersed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Harvested&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; scaledAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; totalCollections function returns the total count of registered collections.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; number of registered collections.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalCollections&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &amp;#39;Black hole&amp;#39; is any address that guarantees that tokens sent to it will not be &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * retrieved from it. &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: some tokens revert on transfer to zero address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; collection address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address of black hole.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; blackHole&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; collections function returns the collection address based on the collection index input.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; index of a registered collection.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address collection.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; collections&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; collectionIds function returns the collection index based on the collection address input.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; collection address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; collection index.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; collectionIds&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; specificCollections function returns whether a particular collection follows the ERC721 standard or not.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; collection address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; specific collection or not.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; specificCollections&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array with two elements. Each of them represents percentage from collateral&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * to be taken as a commission. First element represents collateralization commission.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * Second element represents uncollateralization commission. There should be 3 &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * decimal buffer for each of them, e.g. 1000 = 1%.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; collection address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; index of value in array.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; collected commission.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; commissions&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Token that will be used to harvest collected commissions.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; collection address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address of token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; communityToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Pool of available tokens for harvesting.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; collection address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; index in array.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address of token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; communityPool&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Token balance available for harvesting.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; collection address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address of token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; token balance.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; communityBalance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Array of tokens that have been dispersed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; collection address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; index in array.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address of dispersed token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; disperseTokens&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Amount of tokens that has been dispersed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; collection address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address of token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; token balance.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; disperseBalance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Amount of tokens that was already taken from the disperse.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; collection address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address of token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; total amount of tokens already taken.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; disperseTotalTaken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Amount of disperse already taken by each tokenId.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; collection address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; unique identifier of unit.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address of token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; amount of tokens already taken.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; disperseTaken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Mapping of `tokenId`s to token addresses that have collateralized before.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; collection address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; unique identifier of unit.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; index&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; in array.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address of token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; collateralTokens&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Token balances that are stored under `tokenId`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; collection address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; unique identifier of unit.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address of token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; token balance.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; collateralBalances&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Calculator function for harvesting.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; collection address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; of `communityToken`s to spend.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address of token to be harvested.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; to harvest based on inputs.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getAmount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; setSpecificCollection function enables the addition of any collection that is not compatible with the ERC721 standard to the list of exceptions.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; collection address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setSpecificCollection&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; registerCollection function grants Envious functionality to any ERC721-compatible collection and streamlines&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * the distribution of an initial minimum disbursement to all NFT holders.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; collection address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address of `communityToken`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; collateralization fee, incoming &#x2F; 1e5 * 100%.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; uncollateralization fee, incoming &#x2F; 1e5 * 100%.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; registerCollection&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; incoming&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; outcoming&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Collect commission fees gathered in exchange for `communityToken`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; collection address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amounts&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;[] array of amounts to collateralize.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;[] array of token addresses.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; harvest&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amounts&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenAddresses&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Collateralize NFT with different tokens and amounts.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; collection address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; unique identifier for specific NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amounts&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;[] array of amounts to collateralize.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;[] array of token addresses.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; collateralize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amounts&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenAddresses&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Withdraw underlying collateral.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * - only owner of NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; collection address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; unique identifier for specific NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amounts&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;[] array of amounts to collateralize.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;[] array of token addresses.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; uncollateralize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amounts&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenAddresses&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Split collateral among all existent tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; collection address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amounts&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;[] to be dispersed among all NFT owners.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;[] address of token to be dispersed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; disperse&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amounts&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenAddresses&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;envious-term-choice&quot;&gt;“Envious” Term Choice&lt;&#x2F;h3&gt;
&lt;p&gt;We propose adopting the term &quot;Envious&quot; to describe any NFT collection minted using this ERC standard or any &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; based NFT collection that utilized the EnviousHouse abstraction layer.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;nft-collateralization-with-multiple-tokens&quot;&gt;NFT Collateralization with Multiple Tokens&lt;&#x2F;h3&gt;
&lt;p&gt;Some Web3 projects primarily collateralize a specific NFT asset with one &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; based token, resulting in increased gas fees and complications in User Experience (UX).&lt;&#x2F;p&gt;
&lt;p&gt;This ERC has been crafted to enable the collateralization of a designated NFT asset with multiple &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; based tokens within a single transaction.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;nft-collateralization-with-the-native-coin&quot;&gt;NFT Collateralization with the Native Coin&lt;&#x2F;h3&gt;
&lt;p&gt;Each &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; based token possesses a distinct address. However, a native coin does not carry an address. To address this, we propose utilizing a null address (&lt;code&gt;0x0000000000000000000000000000000000000000&lt;&#x2F;code&gt;) as an identifier for the native coin during collateralization, as it eliminates the possibility of collisions with smart contract addresses.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;disperse-functionality&quot;&gt;Disperse Functionality&lt;&#x2F;h3&gt;
&lt;p&gt;We have implemented the capability to collateralize all assets within a particular NFT collection in a single transaction. The complete collateral amount is deposited into a smart contract, enabling each user to claim their respective share of the collateral when they add or redeem collateral for that specific asset.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;harvest-functionality&quot;&gt;Harvest Functionality&lt;&#x2F;h3&gt;
&lt;p&gt;Each Envious NFT collection provides an option to incorporate a community &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; based token, which can be exchanged for commissions accrued from collateralization and uncollateralization activities.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;blackhole-instance&quot;&gt;BlackHole Instance&lt;&#x2F;h3&gt;
&lt;p&gt;Some &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; based token implementations forbid transfers to the null address, it is necessary to have a reliable burning mechanism in the harvest transactions. &lt;code&gt;blackHole&lt;&#x2F;code&gt; smart contract removes &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; communityTokens from the circulating supply in exchange for commission fees withdrawn.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;blackHole&lt;&#x2F;code&gt; has been designed to prevent the transfer of any tokens from itself and can only perform read operations. It is intended to be used with the Envious extension in implementations related to commission harvesting.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;EnviousHouse abstraction layer is suggested for already deployed &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; based NFT collections.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Envious may share security concerns similar to those found in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;, such as hidden logic within functions like burn, add resource, accept resource, etc.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>NFT Flashloans</title>
        <published>2023-03-12T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>out.eth</name><uri>https://github.com/outdoteth</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6682/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6682-nft-flashloans/13294" />
        

        <id>https://wg-eips.ritovision.com/6682/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:6682"
            label="ERC-6682" />
        

        
        

        
        <summary type="html">Minimal interface for ERC-721 NFT flashloans</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6682/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is an extension of the existing flashloan standard (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3156&#x2F;&quot;&gt;ERC-3156&lt;&#x2F;a&gt;) to support &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; NFT flashloans. It proposes a way for flashloan providers to lend NFTs to contracts, with the condition that the loan is repaid in the same transaction along with some fee.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The current flashloan standard, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3156&#x2F;&quot;&gt;ERC-3156&lt;&#x2F;a&gt;, only supports &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens. ERC-721 tokens are sufficiently different from ERC-20 tokens that they require an extension of this existing standard to support them.&lt;&#x2F;p&gt;
&lt;p&gt;An NFT flash loan could be useful in any action where NFT ownership is checked. For example, claiming airdrops, claiming staking rewards, or taking an in-game action such as claiming farmed resources.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;contract-interface&quot;&gt;Contract Interface&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.19&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6682&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the token used to pay flash loan fees.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; flashFeeToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Whether or not the NFT is available for a flash loan.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; token&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the NFT contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ID of the NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; availableForFlashLoan&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;flashFeeToken&lt;&#x2F;code&gt; function MUST return the address of the token used to pay flash loan fees.&lt;&#x2F;p&gt;
&lt;p&gt;If the token used to pay the flash loan fees is ETH then &lt;code&gt;flashFeeToken&lt;&#x2F;code&gt; MUST return &lt;code&gt;address(0)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;availableForFlashLoan&lt;&#x2F;code&gt; function MUST return whether or not the &lt;code&gt;tokenId&lt;&#x2F;code&gt; of &lt;code&gt;token&lt;&#x2F;code&gt; is available for a flashloan. If the &lt;code&gt;tokenId&lt;&#x2F;code&gt; is not currently available for a flashloan &lt;code&gt;availableForFlashLoan&lt;&#x2F;code&gt; MUST return &lt;code&gt;false&lt;&#x2F;code&gt; instead of reverting.&lt;&#x2F;p&gt;
&lt;p&gt;Implementers &lt;code&gt;MUST&lt;&#x2F;code&gt; also implement &lt;code&gt;IERC3156FlashLender&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The above modifications are the simplest possible additions to the existing flashloan standard to support NFTs.&lt;&#x2F;p&gt;
&lt;p&gt;We choose to extend as much of the existing flashloan standard (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3156&#x2F;&quot;&gt;ERC-3156&lt;&#x2F;a&gt;) as possible instead of creating a wholly new standard because the flashloan standard is already widely adopted and few changes are required to support NFTs.&lt;&#x2F;p&gt;
&lt;p&gt;In most cases, the handling of fee payments will be desired to be paid in a separate currency to the loaned NFTs because NFTs themselves cannot always be fractionalized. Consider the following example where the flashloan provider charges a 0.1 ETH fee on each NFT that is flashloaned; The interface must provide methods that allow the borrower to determine the fee rate on each NFT and also the currency that the fee should be paid in.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is fully backwards compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3156&#x2F;&quot;&gt;ERC-3156&lt;&#x2F;a&gt; with the exception of the &lt;code&gt;maxFlashLoan&lt;&#x2F;code&gt; method. This method does not make sense within the context of NFTs because NFTs are not fungible. However it is part of the existing flashloan standard and so it is not possible to remove it without breaking backwards compatibility. It is RECOMMENDED that any contract implementing this EIP without the intention of supporting ERC-20 flashloans should always return &lt;code&gt;1&lt;&#x2F;code&gt; from &lt;code&gt;maxFlashLoan&lt;&#x2F;code&gt;. The &lt;code&gt;1&lt;&#x2F;code&gt; reflects the fact that only one NFT can be flashloaned per &lt;code&gt;flashLoan&lt;&#x2F;code&gt; call. For example:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; maxFlashLoan&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if a contract also supports flash loans for ERC20 tokens then it can&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; return some value here instead of 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.19&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;..&#x2F;interfaces&#x2F;IERC20.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;..&#x2F;interfaces&#x2F;IERC721.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;..&#x2F;interfaces&#x2F;IERC3156FlashBorrower.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;..&#x2F;interfaces&#x2F;IERC3156FlashLender.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;..&#x2F;interfaces&#x2F;IERC6682.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ExampleFlashLender&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6682&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC3156FlashLender&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; _feePerNFT&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; _flashFeeToken&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; feePerNFT_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; flashFeeToken_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _feePerNFT &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; feePerNFT_&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _flashFeeToken &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; flashFeeToken_&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; flashFeeToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _flashFeeToken&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; availableForFlashLoan&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; return if the NFT is owned by this contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        try&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; result &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; catch&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; flashFee&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _feePerNFT&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; flashLoan&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;IERC3156FlashBorrower&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; receiver&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        public&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; check that the NFT is available for a flash loan&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;availableForFlashLoan&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;IERC6682: NFT not available for flash loan&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; transfer the NFT to the borrower&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        IERC721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;safeTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;receiver&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; calculate the fee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; fee &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; flashFee&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; call the borrower&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span&gt; success &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            receiver&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;onFlashLoan&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; fee&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;ERC3156FlashBorrower.onFlashLoan&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; check that flashloan was successful&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;IERC6682: Flash loan failed&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; check that the NFT was returned by the borrower&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;IERC6682: NFT not returned by borrower&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; transfer the fee from the borrower&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        IERC20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;flashFeeToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; fee&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; success&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; maxFlashLoan&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if a contract also supports flash loans for ERC20 tokens then it can&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; return some value here instead of 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onERC721Received&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;onERC721Received&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;It&#x27;s possible that the &lt;code&gt;flashFeeToken&lt;&#x2F;code&gt; method could return a malicious contract. Borrowers who intend to call the address that is returned from the &lt;code&gt;flashFeeToken&lt;&#x2F;code&gt; method should take care to ensure that the contract is not malicious. One way they could do this is by verifying that the returned address from &lt;code&gt;flashFeeToken&lt;&#x2F;code&gt; matches that of a user input.&lt;&#x2F;p&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>AA Account Metadata For Authentication</title>
        <published>2023-03-09T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Shu Dong</name><uri>https://github.com/dongshu2013</uri>
	</author>
	
	<author>
		<name>Zihao Chen</name><uri>https://github.com/zihaoccc</uri>
	</author>
	
	<author>
		<name>Peter Chen</name><uri>https://github.com/pette1999</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6662/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6662-account-metadata-for-aa-account-authentication/13232" />
        

        <id>https://wg-eips.ritovision.com/6662/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:6662"
            label="ERC-6662" />
        

        
        

        
        <summary type="html">An ERC-4337 extension to define a new authentication model</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6662/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC proposes a new &lt;strong&gt;IAccountMetadata&lt;&#x2F;strong&gt; interface as an extension for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt; to store authentication data on-chain to support a more user-friendly authentication model.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;In this proposal, we propose a new &lt;strong&gt;IAccountMetadata&lt;&#x2F;strong&gt; interface as an extension for ERC-4337 &lt;strong&gt;IAccount&lt;&#x2F;strong&gt; interface. With this new interface, users can store authentication data on-chain through one-time publishing, allowing dApps to proactively fetch it from the chain to support a more flexible and user-friendly authentication model. This will serve as an alternative to the current authentication model where users need to log in with a wallet every time and push account-related information to dApps by connecting the wallet in advance.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;authentication-flow&quot;&gt;Authentication Flow&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6662&#x2F;.&#x2F;assets&#x2F;auth-flow.png&quot; alt=&quot;Authentication Flow&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;In the new authentication workflow, users use AA compatible smart contract accounts as their wallet addresses. &lt;strong&gt;Authenticator&lt;&#x2F;strong&gt; could be anything but holding the private key to sign users&#x27; operations. For example, it can be an offline authenticator mobile app or an online cloud service. &lt;strong&gt;Relay&lt;&#x2F;strong&gt; is an online service responsible for forwarding requests from dApps to the Authenticator. If the authenticator is online, it can play the role of Relay service and listen to dApps directly.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;interface&quot;&gt;Interface&lt;&#x2F;h3&gt;
&lt;p&gt;To support the new authentication workflow, this ERC proposes a new &lt;strong&gt;IAccountMetadata&lt;&#x2F;strong&gt; interface as an extension of &lt;strong&gt;IAccount&lt;&#x2F;strong&gt; interface defined by ERC-4337.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;interface IAccountMetadata {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  struct AuthenticatorInfo {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; a list of service URIs to relay message from dApps to authenticators&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    string[] relayURI;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; a JSON string or URI pointing to a JSON file describing the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; schema of AuthenticationRequest. The URI should follow ERC-4804&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; if the schema file is stored on-chain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    string schema;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  function getAuthenticationInfo() external view returns(AuthenticatorInfo[] memory);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The relay endpoint should accept an AuthenticationRequest object as input. The format of the AuthenticationRequest object is defined by the schema field at AuthenticationInfo.&lt;&#x2F;p&gt;
&lt;p&gt;Following is a schema example which supports end to end encryption, where we pack all encrypted fields into an encryptedData field. Here we only list basic fields but there may be more fields per schema definition. A special symbol, such as &quot;$e2ee&quot;, could be used to indicate the field is encrypted.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;AuthenticationRequest&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;entrypoint&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;the entrypoint contract address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;the chain id represented as hex string, e.g. 0x5 for goerli testnet&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;userOp&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;UserOp struct defined by ERC-4337 without signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;encryptedData&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;contains all encrypted fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;To enable the new authentication workflow we described above, dApp needs to know two things:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Where is the authenticator?&lt;&#x2F;strong&gt; This is solved by the &lt;strong&gt;relayURI&lt;&#x2F;strong&gt; field in struct &lt;strong&gt;AuthenticationInfo&lt;&#x2F;strong&gt;. Users can publish the uri as the account metadata which will be pulled by dApp to do service discovery.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;What’s the format of AuthenticationRequest?&lt;&#x2F;strong&gt; This is solved by the &lt;strong&gt;schema&lt;&#x2F;strong&gt; field in struct &lt;strong&gt;AuthenticationInfo&lt;&#x2F;strong&gt;. The schema defines the structure of the AuthenticationRequest object which is consumed by the authenticator. It can also be used to define extra fields for the relay service to enable flexible access control.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;relay-service-selection&quot;&gt;Relay Service Selection&lt;&#x2F;h3&gt;
&lt;p&gt;Each authenticator can provide a list of relay services. dApp should pull through the list of relay services in order to find the first workable one. All relay services under each authenticator must follow the same schema.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;signature-aggregation&quot;&gt;Signature Aggregation&lt;&#x2F;h3&gt;
&lt;p&gt;Multisig authentication could be enabled if multiple AuthenticatorInfos are provided under each smart contract account. Each authenticator can sign and submit signed user operations to bundler independently. These signatures will be aggregated by the Aggregator defined in ERC-4337.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;future-extension&quot;&gt;Future Extension&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;strong&gt;IAccountMetadata&lt;&#x2F;strong&gt; interface could be extended per different requirements. For example, a new alias or avatar field could be defined for profile displaying.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The new interface is fully backward compatible with ERC-4337.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;end-to-end-encryption&quot;&gt;End to End Encryption&lt;&#x2F;h3&gt;
&lt;p&gt;To protect the user’s privacy and prevent front-running attacks, it&#x27;s better to keep the data from dApps to authenticators encrypted during transmission. This could be done by adopting the JWE (JSON Web Encryption, RFC-7516) method. Before sending out AuthenticationRequest, a symmetric CEK(Content Encryption Key) is generated to encrypt fields with end to end encryption enabled, then the CEK is encrypted with the signer&#x27;s public key. dApp will pack the request into a JWE object and send it to the authenticator through the relay service. Relay service has no access to the end to end encrypted data since only the authenticator has the key to decrypt the CEK.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Abstract Token</title>
        <published>2023-03-03T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Chris Walker</name><uri>https://github.com/cr-walker</uri><email>chris@ckwalker.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6604/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/draft-eip-abstract-token-standard/13152" />
        

        <id>https://wg-eips.ritovision.com/6604/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:6604"
            label="ERC-6604" />
        

        
        

        
        <summary type="html">move tokens on- and off-chain as desired, enabling zero-cost minting while preserving on-chain composability</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6604/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Abstract tokens provide a standard interface to:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Mint tokens off-chain as messages&lt;&#x2F;li&gt;
&lt;li&gt;Reify tokens on-chain via smart contract&lt;&#x2F;li&gt;
&lt;li&gt;Dereify tokens back into messages&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Abstract tokens can comply with existing standards like &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;, and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt;. The standard allows wallets and other applications to better handle &lt;em&gt;potential&lt;&#x2F;em&gt; tokens before any consensus-dependent events occur on-chain.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Abstract tokens enable zero-cost token minting, facilitating high-volume applications by allowing token holders to reify tokens (place the tokens on-chain) as desired. Example use cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;airdrops&lt;&#x2F;li&gt;
&lt;li&gt;POAPs &#x2F; receipts&lt;&#x2F;li&gt;
&lt;li&gt;identity &#x2F; access credentials&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Merkle trees are often used for large token distributions to spread mint&#x2F;claim costs to participants, but they require participants to provide a markle proof when claiming tokens. This standard aims to improve the claims proces for similar distributions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Generic: compatible with merkle trees, digital signatures, or other eligibility proofs&lt;&#x2F;li&gt;
&lt;li&gt;Legible: users can query an abstract token contract to understand their potential tokens (e.g. token id, quantity, or uri)&lt;&#x2F;li&gt;
&lt;li&gt;Contained: users do not need to understand the proof mechanism used by the particular token implementation contract&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;data-types&quot;&gt;Data Types&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;token-messages&quot;&gt;Token Messages&lt;&#x2F;h4&gt;
&lt;p&gt;A token message defines one or more tokens along with the context needed to reify the token(s) using a smart contract.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;chainId&lt;&#x2F;code&gt; &amp;amp; &lt;code&gt;implementation&lt;&#x2F;code&gt;: set the domain of the token message to a specific chain and contract: this is where the token can be reified
&lt;code&gt;owner&lt;&#x2F;code&gt;: the address that owns the tokens defined in the messages when reified
&lt;code&gt;meta&lt;&#x2F;code&gt;: implementation-specific context necessary to reify the defined token(s), such as id, amount, or uri.
&lt;code&gt;proof&lt;&#x2F;code&gt;: implementation-specific authorization to reify the defined token(s).
&lt;code&gt;nonce&lt;&#x2F;code&gt;: counter that may be incremented when multiple otherwise-identical abstract token messages are needed&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AbstractTokenMessage&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span&gt; chainId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span&gt; implementation&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes&lt;&#x2F;span&gt;&lt;span&gt; meta&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes&lt;&#x2F;span&gt;&lt;span&gt; proof&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;message-status&quot;&gt;Message Status&lt;&#x2F;h4&gt;
&lt;p&gt;A message status may be defined for every (abstract token contract, abstract token message) pair.
&lt;code&gt;invalid&lt;&#x2F;code&gt;: the contract cannot interact with the message
&lt;code&gt;valid&lt;&#x2F;code&gt;: the contract can interact with the message
&lt;code&gt;used&lt;&#x2F;code&gt;: the contract has already interacted with the message&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AbstractTokenMessageStatus&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;  invalid&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;  valid&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;  used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;methods&quot;&gt;Methods&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;reify&quot;&gt;reify&lt;&#x2F;h4&gt;
&lt;p&gt;Moves token(s) from a message to a contract
&lt;code&gt;function reify(AbstractTokenMessage calldata message) external;&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The token contract MUST reify a valid token message.&lt;&#x2F;p&gt;
&lt;p&gt;Reification MUST be idempotent: a particular token message may be used to reify tokens at most once. Calling &lt;code&gt;reify&lt;&#x2F;code&gt; with an already used token message MAY succeed or revert.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;status&quot;&gt;status&lt;&#x2F;h4&gt;
&lt;p&gt;Returns the status of a particular message
&lt;code&gt;function status(AbstractTokenMessage calldata message) external view returns (AbstractTokenMessageStatus status);&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;dereify&quot;&gt;dereify&lt;&#x2F;h4&gt;
&lt;p&gt;Moves token(s) from a contract to a message intended for another contract and&#x2F;or chain.
&lt;code&gt;function dereify(AbstractTokenMessage calldata message) external;&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;OPTIONAL - allows tokens to be moved between contracts and&#x2F;or chains by dereifying them from one context and reifying them in another.
Dereification MUST be idempotent: a particular token message must be used to dereify tokens at most once.&lt;&#x2F;p&gt;
&lt;p&gt;If implemented, dereification:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;MUST burn the exact tokens from the holder as defined in the token message&lt;&#x2F;li&gt;
&lt;li&gt;MUST NOT dereify token messages scoped to the same contract and chain.&lt;&#x2F;li&gt;
&lt;li&gt;MAY succeed or revert if the token message is already used.&lt;&#x2F;li&gt;
&lt;li&gt;MUST emit the &lt;code&gt;Reify&lt;&#x2F;code&gt; event on only the first &lt;code&gt;reify&lt;&#x2F;code&gt; call with a specific token message&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;id&quot;&gt;id&lt;&#x2F;h4&gt;
&lt;p&gt;Return the id of token(s) defined in a token message.
&lt;code&gt;function id(AbstractTokenMessage calldata message) external view returns (uint256);&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;OPTIONAL - abstract token contracts without a well-defined token ID (e.g. ERC-20) MAY return &lt;code&gt;0&lt;&#x2F;code&gt; or not implement this method.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;amount&quot;&gt;amount&lt;&#x2F;h4&gt;
&lt;p&gt;Return the amount of token(s) defined in a token message.
&lt;code&gt;function amount(AbstractTokenMessage calldata message) external view returns (uint256);&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;OPTIONAL - abstract token contracts without a well-defined token amount (e.g. ERC-721) MAY return &lt;code&gt;0&lt;&#x2F;code&gt; or not implement this method.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;uri&quot;&gt;uri&lt;&#x2F;h4&gt;
&lt;p&gt;Return the amount of token(s) defined in a token message.
&lt;code&gt;function uri(AbstractTokenMessage calldata message) external view returns (string memory);&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;OPTIONAL - abstract token contracts without a well-defined uri (e.g. ERC-20) MAY return &lt;code&gt;&quot;&quot;&lt;&#x2F;code&gt; or not implement this method.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;supportsinterface&quot;&gt;supportsInterface&lt;&#x2F;h4&gt;
&lt;p&gt;All abstract token contracts must support &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; and include the Abstract Token interface ID in their supported interfaces.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;events&quot;&gt;Events&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;reify-1&quot;&gt;Reify&lt;&#x2F;h4&gt;
&lt;p&gt;The Reify event MUST be emitted when a token message is reified into tokens
&lt;code&gt;event Reify(AbstractTokenMessage);&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;dereify-1&quot;&gt;Dereify&lt;&#x2F;h4&gt;
&lt;p&gt;The Dereify event MUST be emitted when tokens are dereified into a message
&lt;code&gt;event Dereify(AbstractTokenMessage);&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;application-to-existing-token-standards&quot;&gt;Application to existing token standards&lt;&#x2F;h3&gt;
&lt;p&gt;Abstract tokens compatible with existing token standards MUST overload existing token transfer functions to allow transfers from abstract token messages.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;abstract-erc-20&quot;&gt;Abstract ERC-20&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IAbstractERC20&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IAbstractToken&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC20&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC165&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; reify the message and then transfer tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    AbstractTokenMessage&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; message&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; reify the message and then transferFrom tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    AbstractTokenMessage&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; message&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;abstract-erc-721&quot;&gt;Abstract ERC-721&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IAbstractERC721&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IAbstractToken&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC721&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    AbstractTokenMessage&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; message&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    AbstractTokenMessage&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; message&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;abstract-erc-1155&quot;&gt;Abstract ERC-1155&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;interface IAbstractERC1155 is IAbstractToken, IERC1155 {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  function safeTransferFrom(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address from,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address to,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    uint256 id,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    uint256 amount,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytes calldata data,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    AbstractTokenMessage calldata message&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ) external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  function safeBatchTransferFrom(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address from,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address to,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    uint256[] calldata ids,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    uint256[] calldata amounts,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytes calldata data,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    AbstractTokenMessage[] calldata messages&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ) external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;meta-format&quot;&gt;Meta format&lt;&#x2F;h3&gt;
&lt;p&gt;The abstract token message &lt;code&gt;meta&lt;&#x2F;code&gt; field is simply a byte array to preserve the widest possible accesibility.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Applications handling abstract tokens can interact with the implementation contract for token metadata rather than parsing this field, so legibility is of secondary importance&lt;&#x2F;li&gt;
&lt;li&gt;A byte array can be decoded as a struct and checked for errors within the implementation contract&lt;&#x2F;li&gt;
&lt;li&gt;Future token standards will include unpredictable metadata&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;proof-format&quot;&gt;Proof format&lt;&#x2F;h3&gt;
&lt;p&gt;Similar considerations went into defining the &lt;code&gt;proof&lt;&#x2F;code&gt; field as a plain byte array:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The contents of this field may vary, e.g. an array of &lt;code&gt;bytes32&lt;&#x2F;code&gt; merkle tree nodes or a 65 byte signature.&lt;&#x2F;li&gt;
&lt;li&gt;a byte array handles all potential use cases at the expense of increased message size.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6604&#x2F;assets&#x2F;README&#x2F;&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Several concerns are highlighted.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;message-loss&quot;&gt;Message Loss&lt;&#x2F;h3&gt;
&lt;p&gt;Because token messages are not held on-chain, loss of the message may result in loss of the token. Applications that issue abstract tokens to their users can store the messages themselves, but ideally users would be able to store and interact with abstract token messages within their crypto wallets.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;authorizing-reification&quot;&gt;Authorizing Reification&lt;&#x2F;h3&gt;
&lt;p&gt;Token messages may only be reified if they include a validity proof. While the proof mechanism itself is out of scope for this standard, those designing proof mechanisms should consider:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Does total supply need to audited on-chain and&#x2F;or off-chain?&lt;&#x2F;li&gt;
&lt;li&gt;Does the mechanism require ongoing access to a secret (e.g. digital signature) or is it immutable (e.g. merkle proof)?&lt;&#x2F;li&gt;
&lt;li&gt;Is there any way for an attacker to prevent the reification of an otherwise valid token message?&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;non-owner-de-reification&quot;&gt;Non-owner (De)Reification&lt;&#x2F;h3&gt;
&lt;p&gt;Can non-owners (de)reify a token message on behalf of the owner?&lt;&#x2F;p&gt;
&lt;p&gt;Pro: supporting apps should be able to handle this because once a valid message exists, the owner could (de)reify the message at any time
Con: if the token contract reverts upon (de)reification of a used message, an attacker could grief the owner by front-running the transaction&lt;&#x2F;p&gt;
&lt;h3 id=&quot;abstract-token-bridge-double-spend&quot;&gt;Abstract Token Bridge Double Spend&lt;&#x2F;h3&gt;
&lt;p&gt;Abstract tokens could be used for a token-specific bridge:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Dereify the token from chain A to with message M&lt;&#x2F;li&gt;
&lt;li&gt;Reify the token on chain B with message M&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Because the abstract token standard does not specify any cross-chain message passing, the abstract token contracts on chains A and B cannot know whether a (de)reification of message M has occurred on the other chain.&lt;&#x2F;p&gt;
&lt;p&gt;A naive bridge would be subject to double spend attacks:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;An attacker requests bridging tokens they hold on chain A to chain B&lt;&#x2F;li&gt;
&lt;li&gt;A bridging mechanism creates an abstract token message M&lt;&#x2F;li&gt;
&lt;li&gt;The attacker reifies message M on chain B but &lt;em&gt;does not&lt;&#x2F;em&gt; dereify message M on chain A&lt;&#x2F;li&gt;
&lt;li&gt;The attacker continues to use tokens&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Some oracle mechanism is necessary to prevent the reification of message M on chain B until the corresponding tokens on chain A are dereified.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Cultural and Historical Asset Token</title>
        <published>2023-02-28T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Phillip Pon</name><email>phillip@artifactlabs.com</email>
	</author>
	
	<author>
		<name>Gary Liu</name><email>gary@artifactlabs.com</email>
	</author>
	
	<author>
		<name>Henry Chan</name><email>henry@artifactlabs.com</email>
	</author>
	
	<author>
		<name>Joey Liu</name><email>joey@artifactlabs.com</email>
	</author>
	
	<author>
		<name>Lauren Ho</name><email>lauren@artifactlabs.com</email>
	</author>
	
	<author>
		<name>Jeff Leung</name><email>jeff@artifactlabs.com</email>
	</author>
	
	<author>
		<name>Brian Liang</name><email>brian@artifactlabs.com</email>
	</author>
	
	<author>
		<name>Joyce Li</name><email>joyce@artifactlabs.com</email>
	</author>
	
	<author>
		<name>Avir Mahtani</name><email>avir@artifactlabs.com</email>
	</author>
	
	<author>
		<name>Antoine Cote</name><uri>https://github.com/acote88</uri>
	</author>
	
	<author>
		<name>David Leung</name><uri>https://github.com/dhl</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6596/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6596-historical-asset-metadata-json-schema/13090" />
        

        <id>https://wg-eips.ritovision.com/6596/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:6596"
            label="ERC-6596" />
        

        
        

        
        <summary type="html">Metadata extension to enhance the discoverability, connectivity, and collectability of culturally and historically significant NFTs.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6596/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes the establishment of a comprehensive metadata standard for Cultural and Historical Asset Tokens
(CHATs) on the Ethereum platform. These tokens represent cultural and historical assets such as artwork, artifacts,
collectibles, and rare items, providing crucial context and provenance to substantiate their significance and value.&lt;&#x2F;p&gt;
&lt;p&gt;While existing NFT standards ensure the immutability and decentralized ownership of assets on the blockchain, based on
our research they do not adequately capture the cultural and historical importance and value of such assets needed for
widespread adoption by institutions such as museums. The CHAT standard aims to overcome these limitations by preserving
the provenance, history, and evolving context of cultural and historical assets, thus substantiating their value.
Furthermore, it incentivises museums, institutions, and asset owners to create tamper-proof records on the blockchain,
ensuring transparency and accountability and accelerating adoption of web3 protocols. Additionally, the CHAT standard
promotes interoperability with existing metadata standards in the arts and cultural sector, facilitating the search,
discovery, and connection of distributed assets.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;Preserving context and significance&lt;&#x2F;strong&gt; - Provenance and context are crucial for cultural and historical assets. The
CHAT standard captures and preserves the provenance and history of these assets, as well as the changing contexts that
emerge from new knowledge and information. This context and provenance substantiate the significance and value of
cultural and historical assets.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Proof-based preservation&lt;&#x2F;strong&gt; - The recent incidents of lost artifacts and data breaches at a number of significant
international museums points to a need in reassessing our current record keeping mechanisms. While existing systems
mostly operate on trust, blockchain technology offers opportunities to establish permanent and verifiable records in a
proof-based environment. Introducing the CHAT standard on the Ethereum platform enables museums, institutions, and
owners of significant collections to create tamper-proof records on the blockchain. By representing these valuable
cultural and historical assets as tokens on the blockchain, permanent and tamper-proof records can be established
whenever amendments are made, ensuring greater transparency and accountability.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Interoperability&lt;&#x2F;strong&gt; - The proposed standard addresses the multitude of existing metadata standards used in the arts and
cultural sector. The vision is to create a metadata structure specifically built for preservation on the blockchain that
is interoperable with these existing standards and compliant with the Open Archives Initiative (OAI) as well as the
International Image Interoperability Framework protocol (IIIF).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Search and Discovery&lt;&#x2F;strong&gt; - Ownership and history of artworks, artifacts, and historical intellectual properties are
often distributed. Although there may never be a fully consolidated archive, a formalized blockchain-based metadata
structure enables consolidation for search and discovery of the assets, without consolidating the ownership. For
example, an artifact from an archaeological site of the Silk Road can be connected with Buddhist paintings, statues, and
texts about the ancient trade route across museum and institutional collections internationally. The proposed CHAT
metadata structure will facilitate easy access to these connections for the general public, researchers, scholars, other
cultural professionals, brands, media, and any other interested parties.&lt;&#x2F;p&gt;
&lt;p&gt;Currently, the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; standard includes a basic metadata extension, which optionally provides functions
for identifying NFT collections (&quot;name&quot; and &quot;symbol&quot;) and attributes for representing assets (&quot;name,&quot; &quot;description,&quot;
and &quot;image&quot;). However, to provide comprehensive context and substantiate the value of tokenized assets, NFT issuers
often create their own metadata structures. We believe that the basic extension alone is insufficient to capture the
context and significance of cultural and historical assets. The lack of interoperable and consistent rich metadata
hinders users&#x27; ability to search, discover, and connect tokenized assets on the blockchain. While connectivity among
collections may not be crucial for NFTs designed for games and memberships, it is of utmost importance for cultural and
historical assets. As the number and diversity of tokenized assets on the blockchain increase, it becomes essential to
establish a consistent and comprehensive metadata structure that provides context, substantiates value, and enables
connected search and discovery at scale.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT
RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP extends &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; with 48 additional properties to capture the
cultural and historical significance of the underlying asset.&lt;&#x2F;p&gt;
&lt;p&gt;Compatible contracts, besides implementing the relevant metadata schemas (&quot;Metadata JSON Schema&quot; for
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; contracts or &quot;Metadata URI JSON Schema&quot; for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; contracts), must implement
the following metadata interface.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;cultural-and-historical-asset-metadata-extension-typescript-interface&quot;&gt;Cultural and Historical Asset Metadata Extension TypeScript Interface&lt;&#x2F;h3&gt;
&lt;p&gt;The following TypeScript interface defines the Metadata JSON Schema compatible tokens must conform to:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; HistoricalAssetMetadata&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    name&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;                              &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Name of the CHAT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    description&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;                       &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Full description of the CHAT to provide the cultural and historical&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;                                                &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; context&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    image&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;                             &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A URI pointing to a resource with mime type image&#x2F;* to serve as the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;                                                &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; cover image of the CHAT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    attributes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CHATAttribute&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;               &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A list of attributes to describe the CHAT. Attribute object may be&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;                                                &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; repeated if a field has multiple values&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    attributesExt&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ExtendedCHATAttribute&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A list of extended attributes to describe the CHAT, not to be&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;                                                &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; displayed. Attribute object may be repeated if a field has&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;                                                &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; multiple values&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CHATAttribute&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Catalogue Level&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    |&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Publication &#x2F; Creation Date&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    |&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Creator Name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    |&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Creator Bio&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    |&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Asset Type&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    |&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Classification&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    |&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Materials and Technology&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    |&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Subject Matter&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    |&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Edition&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    |&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Series name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    |&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Dimensions Unit&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    |&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Dimensions (height)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; number&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    |&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Dimensions (width)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; number&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    |&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Dimensions (depth)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; number&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    |&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Inscriptions &#x2F; Marks&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    |&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Credit Line&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    |&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Current Owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    |&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Provenance&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    |&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Acquisition Date&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    |&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Citation&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    |&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Keyword&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    |&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Copyright Holder&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    |&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Bibliography&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    |&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Issuer&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    |&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Issue Timestamp&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    |&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Issuer Description&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    |&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Asset File Size&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; number&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    |&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Asset File Format&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    |&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Copyright &#x2F; Restrictions&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    |&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Asset Creation Geo&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    |&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Asset Creation Location&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    |&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Asset Creation Coordinates&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    |&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Relevant Date&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    |&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Relevant Geo&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    |&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Relevant Location&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    |&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Relevant Person&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    |&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Relevant Entity&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    |&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Asset Language&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    |&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Is Physical Asset&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; boolean&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ExtendedCHATAttribute&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Asset Full Text&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    |&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Exhibition &#x2F; Loan History&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    |&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Copyright Document&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    |&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Provenance Document&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    |&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Asset URL&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    |&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Copyright Document of Underlying Asset&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;chatattribute-description&quot;&gt;CHATAttribute Description&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;trait_type&lt;&#x2F;th&gt;&lt;th&gt;description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Catalogue Level&lt;&#x2F;td&gt;&lt;td&gt;An indication of the level of cataloging represented by the record, based on the physical form or intellectual content of the material&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Publication &#x2F; Creation Date&lt;&#x2F;td&gt;&lt;td&gt;Earliest possible creation date of the underlying asset in ISO 8601 date format&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Creator Name&lt;&#x2F;td&gt;&lt;td&gt;The name, brief biographical information, and roles (if necessary) of the named or anonymous individuals or corporate bodies responsible for the design, production, manufacture, or alteration of the work, presented in a syntax suitable for display to the end-user and including any necessary indications of uncertainty, ambiguity, and nuance. If there is no known creator, make a reference to the presumed culture or nationality of the unknown creator&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Creator Bio&lt;&#x2F;td&gt;&lt;td&gt;The brief biography or description of creator&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Asset Type&lt;&#x2F;td&gt;&lt;td&gt;The type of the underlying asset&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Classification&lt;&#x2F;td&gt;&lt;td&gt;Classification terms or codes are used to place a work of art or architecture in a useful organizational scheme that has been devised by a repository, collector, or other person or entity. Formal classification systems are used to relate a work of art or architecture to broader, narrower, and related objects. Classification terms group similar works together according to varying criteria&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Materials and Technology&lt;&#x2F;td&gt;&lt;td&gt;The materials and&#x2F;or techniques used to create the physical underlying asset&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Subject Matter&lt;&#x2F;td&gt;&lt;td&gt;Indexing terms that characterize in general terms what the work depicts or what is depicted in it. This subject analysis is the minimum required. It is recommended to also list specific subjects, if possible&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Edition&lt;&#x2F;td&gt;&lt;td&gt;Edition of the original work&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Series Name&lt;&#x2F;td&gt;&lt;td&gt;The name of the series the asset is a part of&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Dimensions Unit&lt;&#x2F;td&gt;&lt;td&gt;Unit of the measurement of the dimension of the asset&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Dimensions (height)&lt;&#x2F;td&gt;&lt;td&gt;Height of the underlying asset&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Dimensions (width)&lt;&#x2F;td&gt;&lt;td&gt;Width of the underlying asset&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Dimensions (depth)&lt;&#x2F;td&gt;&lt;td&gt;Depth of the underlying asset&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Credit Line&lt;&#x2F;td&gt;&lt;td&gt;Crediting details of the source or origin of an image or content being used publicly. The credit line typically includes important details such as the name of the museum, the title or description of the artwork or object, the artist&#x27;s name (if applicable), the date of creation, and any other relevant information that helps identify and contextualize the work&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Inscriptions &#x2F; Marks&lt;&#x2F;td&gt;&lt;td&gt;A description of distinguishing or identifying physical markings, lettering, annotations, texts, or labels that are a part of a work or are affixed, applied, stamped, written, inscribed, or attached to the work, excluding any mark or text inherent in materials (record watermarks in MATERIALS AND TECHNIQUES)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Current Owner&lt;&#x2F;td&gt;&lt;td&gt;Name of the current owner&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Provenance&lt;&#x2F;td&gt;&lt;td&gt;Provenance provides crucial information about the artwork&#x27;s authenticity, legitimacy, and historical significance. It includes details such as the names of previous owners, dates of acquisition, locations where the artwork or artifact resided, and any significant events or transactions related to its ownership&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Acquisition Date&lt;&#x2F;td&gt;&lt;td&gt;The date on which the acquirer obtained the asset&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Citation&lt;&#x2F;td&gt;&lt;td&gt;Citations of the asset in publications, journals, and any other medium&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Keyword&lt;&#x2F;td&gt;&lt;td&gt;Keywords that are relevant for researchers&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Copyright Holder&lt;&#x2F;td&gt;&lt;td&gt;Copyright holder of the underlying asset&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Bibliography&lt;&#x2F;td&gt;&lt;td&gt;Information on where this asset has been referenced, cited, consulted, and for what purpose&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Issuer&lt;&#x2F;td&gt;&lt;td&gt;Issuer of the token&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Issue Timestamp&lt;&#x2F;td&gt;&lt;td&gt;Date of token creation&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Issuer Description&lt;&#x2F;td&gt;&lt;td&gt;Brief description of the issuing party&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Asset File Size&lt;&#x2F;td&gt;&lt;td&gt;Size of the digital file of the underlying asset in bytes&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Asset File Format&lt;&#x2F;td&gt;&lt;td&gt;The physical form or the digital format of the underlying asset. For digital format, a MIME type should be specified&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Copyright &#x2F; Restrictions&lt;&#x2F;td&gt;&lt;td&gt;The copyright status the work is under&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Asset Creation Geo&lt;&#x2F;td&gt;&lt;td&gt;Country, subdivision, and city where the underlying asset was created. Reference to ISO 3166-2 standard for the short name of the country and subdivision. Utilize the official name for the city if it is not covered in the ISO subdivision&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Asset Creation Location&lt;&#x2F;td&gt;&lt;td&gt;Specific cities and named locations where the underlying asset was created&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Asset Creation Coordinates&lt;&#x2F;td&gt;&lt;td&gt;Coordinates of the location where the underlying asset was created&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Relevant Date&lt;&#x2F;td&gt;&lt;td&gt;Dates, in ISO 8601 date format, referenced in, and important to the significance of the CHAT&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Relevant Geo&lt;&#x2F;td&gt;&lt;td&gt;Country, subdivision, and city CHATs are referenced and important to the significance of the CHAT. Reference to ISO 3166-2 standard for the short name of the country and subdivision. Utilize the official name for the city if it is not covered in the ISO subdivision&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Relevant Location&lt;&#x2F;td&gt;&lt;td&gt;Specific cities and named locations referenced in, and important to the significance of the CHAT&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Relevant Person&lt;&#x2F;td&gt;&lt;td&gt;Individuals referenced in, and important to the significance of the CHAT&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Relevant Entity&lt;&#x2F;td&gt;&lt;td&gt;Entities referenced in, and important to the significance of the CHAT&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Asset Language&lt;&#x2F;td&gt;&lt;td&gt;Languages used in the underlying asset. Reference to ISO 639 for code or macrolanguage names&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Is Physical Asset&lt;&#x2F;td&gt;&lt;td&gt;Flags whether the asset is tied to a physical asset&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;extendedchatattribute-description&quot;&gt;ExtendedCHATAttribute Description&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;trait_type&lt;&#x2F;th&gt;&lt;th&gt;description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Asset Full Text&lt;&#x2F;td&gt;&lt;td&gt;The full text in the underlying asset of the CHAT&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Exhibition &#x2F; Loan History&lt;&#x2F;td&gt;&lt;td&gt;Including exhibition&#x2F;loan description, dates, title, type, curator, organizer, sponsor, venue&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Copyright Document&lt;&#x2F;td&gt;&lt;td&gt;A URI pointing to the legal contract CHATs outlines the copyright of the underlying asset&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Provenance Document&lt;&#x2F;td&gt;&lt;td&gt;A URI pointing to the existing provenance record documents of the underlying asset&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Asset URL&lt;&#x2F;td&gt;&lt;td&gt;A URI pointing to a high-quality file of the underlying asset&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Copyright Document of Underlying Asset&lt;&#x2F;td&gt;&lt;td&gt;A URI pointing to legal document outlining the rights of the token owner. Specific dimensions include the right to display a work via digital and physical mediums, present the work publicly, create or sell copies of the work, and create or sell derivations from the underlying asset&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;example&quot;&gt;Example&lt;&#x2F;h4&gt;
&lt;p&gt;To illustrate the use of the CHAT metadata extension, we provide an example of a CHAT metadata JSON file for the famous
Japanese woodblock print &quot;Under the Wave off Kanagawa&quot; by Katsushika Hokusai, which is currently held by the  Art
Institute of Chicago.&lt;&#x2F;p&gt;
&lt;p&gt;The metadata format is compatible with the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and OpenSea style metadata format.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Under the Wave off Kanagawa (Kanagawa oki nami ura), also known as The Great Wave, from the series “Thirty-Six Views of Mount Fuji (Fugaku sanjūrokkei)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Katsushika Hokusai’s much celebrated series, Thirty-Six Views of Mount Fuji (Fugaku sanjûrokkei), was begun in 1830, when the artist was 70 years old. This tour-de-force series established the popularity of landscape prints, which continues to this day. Perhaps most striking about the series is Hokusai’s copious use of the newly affordable Berlin blue pigment, featured in many of the compositions in the color for the sky and water. Mount Fuji is the protagonist in each scene, viewed from afar or up close, during various weather conditions and seasons, and from all directions.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The most famous image from the set is the “Great Wave” (Kanagawa oki nami ura), in which a diminutive Mount Fuji can be seen in the distance under the crest of a giant wave. The three impressions of Hokusai’s Great Wave in the Art Institute are all later impressions than the first state of the design.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;image&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ipfs:&#x2F;&#x2F;bafybeiav6sqcgzxk5h5afnmb3iisgma2kpnyj5fa5gnhozwaqwzlayx6se&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;attributes&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Publication &#x2F; Creation Date&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1826&#x2F;1836&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Creator Name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Katsushika Hokusai&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Creator Bio&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Katsushika Hokusai’s woodblock print The Great Wave is one of the most famous and recognizable works of art in the world. Hokusai spent the majority of his life in the capital of Edo, now Tokyo, and lived in a staggering 93 separate residences. Despite this frenetic movement, he produced tens of thousands of sketches, prints, illustrated books, and paintings. He also frequently changed the name he used to sign works of art, and each change signaled a shift in artistic style and intended audience.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Asset Type&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Painting&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Classification&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Arts of Asia&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Materials and Technology&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Color woodblock print, oban&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Subject Matter&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Asian Art&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Subject Matter&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Edo Period (1615-1868)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Subject Matter&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Ukiyo-e Style&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Subject Matter&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Woodblock Prints&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Subject Matter&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Japan 1800-1900 A.D.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Edition&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Series name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Thirty-Six Views of Mount Fuji (Fugaku sanjûrokkei)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Dimensions Unit&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;cm&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Dimensions (height)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 25.4&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Dimensions (width)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 37.6&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Inscriptions &#x2F; Marks&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Signature: Hokusai aratame Iitsu fude&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Inscriptions &#x2F; Marks&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Publisher: Nishimura-ya Yohachi&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Credit Line&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Clarence Buckingham Collection&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Current Owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Art Institute of Chicago&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Provenance&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Yamanaka, New York by 1905&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Provenance&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Sold to Clarence Buckingham, Chicago by 1925&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Provenance&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Kate S. Buckingham, Chicago, given to the Art Institute of Chicago, 1925.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Acquisition Date&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1925&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Citation&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;James Cuno, The Art Institute of Chicago: The Essential Guide, rev. ed. (Art Institute of Chicago, 2009) p. 100.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Citation&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;James N. Wood, The Art Institute of Chicago: The Essential Guide, rev. ed. (Art Institute of Chicago, 2003), p. 86.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Citation&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Jim Ulak, Japanese Prints (Art Institute of Chicago, 1995), p. 268.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Citation&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Ukiyo-e Taikei (Tokyo, 1975), vol. 8, 29; XIII, I.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Citation&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Matthi Forrer, Hokusai (Royal Academy of Arts, London 1988), p. 264.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Citation&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Richard Lane, Hokusai: Life and Work (London, 1989), pp. 189, 192.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Copyright Holder&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Public domain&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Copyright &#x2F; Restrictions&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;CC0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Asset Creation Geo&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Japan&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Asset Creation Location&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Tokyo (Edo)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Asset Creation Coordinates&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;36.2048° N, 138.2529° E&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Relevant Date&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;18th Century&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Relevant Geo&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Japan, Chicago&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Relevant Location&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Art Institute of Chicago&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Relevant Person&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Katsushika Hokusai&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Relevant Person&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Yamanaka&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Relevant Person&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Clarence Buckingham&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Relevant Person&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Kate S. Buckingham&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Relevant Entity&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Art Institute of Chicago, Clarence Buckingham Collection&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Asset Language&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Japanese&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Is Physical Asset&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;choosing-to-extend-off-chain-metadata-json-schema-over-on-chain-interface&quot;&gt;Choosing to Extend Off-Chain Metadata JSON Schema over On-Chain Interface&lt;&#x2F;h3&gt;
&lt;p&gt;Both the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; provide natural extension points in the metadata JSON
file associated with NFTs to supply enriched datasets about the underlying assets.&lt;&#x2F;p&gt;
&lt;p&gt;Providing enriched datasets through off-chain metadata JSON files allows existing NFT contracts to adopt the new
metadata structure proposed in this EIP without upgrading or migrating. The off-chain design enables flexible and
progressive enhancement of any NFT collections to adopt this standard gradually. This approach allows NFT collections to
be deployed using already-audited and battle-tested smart contract code without creating or adapting new smart
contracts, reducing the risk associated with adopting and implementing a new standard.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;capturing-attributes-extensions-in-attributes-and-attributesext-properties&quot;&gt;Capturing Attributes Extensions in &lt;code&gt;attributes&lt;&#x2F;code&gt; and &lt;code&gt;attributesExt&lt;&#x2F;code&gt; properties&lt;&#x2F;h3&gt;
&lt;p&gt;In the design of the Cultural and Historical Asset Token (CHAT) metadata extension, we have made a deliberate choice to
capture the metadata attributes between two main properties: &lt;code&gt;attributes&lt;&#x2F;code&gt; and &lt;code&gt;attributesExt&lt;&#x2F;code&gt;. This division serves
two distinct purposes while ensuring maximum compatibility with existing NFT galleries and marketplaces.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;1. &lt;code&gt;attributes&lt;&#x2F;code&gt; Property&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;attributes&lt;&#x2F;code&gt; property contains core metadata attributes that are integral to the identity and categorization of
CHATs. These attributes are meant to be readily accessible, displayed, and searchable by NFT galleries and marketplaces.
By placing fundamental details such as the CHAT&#x27;s name, description, image, and other key characteristics
in &lt;code&gt;attributes&lt;&#x2F;code&gt;, we ensure that these essential elements can be easily presented to users, collectors, and researchers.
This approach allows CHATs to seamlessly integrate with existing NFT platforms and marketplaces without requiring major
modifications.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;2. &lt;code&gt;attributesExt&lt;&#x2F;code&gt; Property&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;attributesExt&lt;&#x2F;code&gt; property, on the other hand, is dedicated to extended attributes that provide valuable, in-depth
information about a CHAT but are not typically intended for display or search within NFT galleries and marketplaces.
These extended attributes serve purposes such as archival documentation, provenance records, and additional context that
may not be immediately relevant to a casual observer or collector. By isolating these extended attributes
in &lt;code&gt;attributesExt&lt;&#x2F;code&gt;, we strike a balance between comprehensiveness and user-friendliness. This approach allows CHAT
creators to include rich historical and contextual data without overwhelming the typical user interface, making the
extended information available for scholarly or specialized use cases.&lt;&#x2F;p&gt;
&lt;p&gt;This division of attributes into &lt;code&gt;attributes&lt;&#x2F;code&gt; and &lt;code&gt;attributesExt&lt;&#x2F;code&gt; ensures that the CHAT standard remains highly
compatible with existing NFT ecosystems, while still accommodating the specific needs of cultural and historical assets.
Users can enjoy a seamless experience in browsing and collecting CHATs, while researchers and historians have access to
comprehensive information when required, all within a framework that respects the practicalities of both user interfaces
and extended data documentation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is fully backward compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;NFT platforms and systems working with Cultural and Historical Asset Metadata JSON files are recommended to treat the
files as client-supplied data and follow the appropriate best practices for processing such data.&lt;&#x2F;p&gt;
&lt;p&gt;Specifically, when processing the URI fields, backend systems should take extra care to prevent a malicious issuer from
exploiting these fields to perform Server-Side Request Forgery (SSRF).&lt;&#x2F;p&gt;
&lt;p&gt;Frontend or client-side systems are recommended to escape all control characters that may be exploited to perform
Cross-Site Scripting (XSS).&lt;&#x2F;p&gt;
&lt;p&gt;Processing systems should manage resource allocation to prevent the systems from being vulnerable to Denial of Service (
DOS) attacks or circumventing security protection through arbitrary code exceptions. Improper processing of variable
data, such as strings, arrays, and JSON objects, may result in a buffer overflow. Therefore, it is crucial to allocate
resources carefully to avoid such vulnerabilities.&lt;&#x2F;p&gt;
&lt;p&gt;The metadata JSON files and the digital resources representing both the token and underlying assets should be stored in
a decentralized storage network to preserve the integrity and to ensure the availability of data for long-term
preservation.&lt;&#x2F;p&gt;
&lt;p&gt;Establishing the authenticity of the claims made in the Metadata JSON file is beyond the scope of this EIP, and is left
to future EIPs to propose an appropriate protocol.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Bit Based Permission</title>
        <published>2023-02-27T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Chiro</name><uri>https://github.com/chiro-hiro</uri>
	</author>
	
	<author>
		<name>Victor Dusart</name><uri>https://github.com/vdusart</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6617/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/bit-based-permission/13065" />
        

        <id>https://wg-eips.ritovision.com/6617/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        

        
        <category
            term="tag:eip:6617"
            label="ERC-6617" />
        

        
        

        
        <summary type="html">A permission and role system based on bits</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6617/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP offers a standard for building a bit-based permission and role system. Each permission is represented by a single bit. By using an &lt;code&gt;uint256&lt;&#x2F;code&gt;, up to $256$ permissions and $2^{256}$ roles can be defined. We are able to specify the importance of each permission based on the order of the bits.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Note&lt;&#x2F;em&gt; The following specifications use syntax from Solidity &lt;code&gt;0.8.7&lt;&#x2F;code&gt; (or above)&lt;&#x2F;p&gt;
&lt;p&gt;Interface of reference is described as followed:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.7&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; EIP-6617 Bit Based Permission&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-6617&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IEIP6617&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        MUST trigger when a permission is granted.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _grantor&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;        Grantor of the permission&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _permission&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     Permission that is granted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _user&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;           User who received the permission&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PermissionGranted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _grantor&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _permission&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _user&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        MUST trigger when a permission is revoked.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _revoker&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;        Revoker of the permission&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _permission&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     Permission that is revoked&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _user&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;           User who lost the permission&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PermissionRevoked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _revoker&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _permission&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _user&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check if user has permission&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _user&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                Address of the user whose permission we need to check&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _requiredPermission&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  The required permission&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;                     True&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if the _permission is a superset of the _requiredPermission else False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; hasPermission&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _requiredPermission&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Add permission to user&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _user&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                Address of the user to whom we are going to add a permission&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _permissionToAdd&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     The permission that will be added&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;                     The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; new permission with the _permissionToAdd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; grantPermission&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _permissionToAdd&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Revoke permission from user&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _user&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                Address of the user to whom we are going to revoke a permission&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _permissionToRevoke&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  The permission that will be revoked&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;                     The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; new permission without the _permissionToRevoke&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revokePermission&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _permissionToRevoke&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;Compliant contracts MUST implement &lt;code&gt;IEIP6617&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;A permission in a compliant contract is represented as an &lt;code&gt;uint256&lt;&#x2F;code&gt;. A permission MUST take only one bit of an &lt;code&gt;uint256&lt;&#x2F;code&gt; and therefore MUST be a power of 2. Each permission MUST be unique and the &lt;code&gt;0&lt;&#x2F;code&gt; MUST be used for none permission.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;metadata-interface&quot;&gt;Metadata Interface&lt;&#x2F;h3&gt;
&lt;p&gt;It is RECOMMENDED for compliant contracts to implement the optional extension &lt;code&gt;IEIP6617Meta&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;They SHOULD define a name and description for the base permissions and main combinaison.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;They SHOULD NOT define a description for every subcombinaison of permissions possible.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Defined the interface of the metadata of EIP6617, MAY NOT be implemented&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IEIP6617Meta&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        Structure of permission description&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _permission&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     Permission&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _name&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;           Name of the permission&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _description&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    Description of the permission&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PermissionDescription&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; permission&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt; description&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        MUST trigger when the description is updated.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _permission&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     Permission&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _name&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;           Name of the permission&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _description&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    Description of the permission&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UpdatePermissionDescription&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _permission&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _name&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _description&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        Returns the description of a given `_permission`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _permission&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     Permission&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getPermissionDescription&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _permission&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;PermissionDescription&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; description&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        Return `true` if the description was set otherwise return `false`. It MUST emit `UpdatePermissionDescription` event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _permission&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     Permission&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _name&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;           Name of the permission&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _description&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    Description of the permission&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setPermissionDescription&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _permission&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _description&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Currently permission and access control is performed using a single owner (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;173&#x2F;&quot;&gt;ERC-173&lt;&#x2F;a&gt;) or with &lt;code&gt;bytes32&lt;&#x2F;code&gt; roles (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5982&#x2F;&quot;&gt;ERC-5982&lt;&#x2F;a&gt;).
However, using bitwise and bitmask operations allows for greater gas-efficiency and flexibility.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-cost-efficiency&quot;&gt;Gas cost efficiency&lt;&#x2F;h3&gt;
&lt;p&gt;Bitwise operations are very cheap and fast. For example, doing an &lt;code&gt;AND&lt;&#x2F;code&gt; bitwise operation on a permission bitmask is significantly cheaper than calling any number of &lt;code&gt;LOAD&lt;&#x2F;code&gt; opcodes.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;flexibility&quot;&gt;Flexibility&lt;&#x2F;h3&gt;
&lt;p&gt;With the 256 bits of the &lt;code&gt;uint256&lt;&#x2F;code&gt;, we can create up to 256 different permissions which leads to $2^{256}$ unique combinations (a.k.a. roles).
&lt;em&gt;(A role is a combination of multiple permissions).&lt;&#x2F;em&gt; Not all roles have to be predefined.&lt;&#x2F;p&gt;
&lt;p&gt;Since permissions are defined as unsigned integers, we can use the binary OR operator to create new role based on multiple permissions.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;ordering-permissions-by-importance&quot;&gt;Ordering permissions by importance&lt;&#x2F;h3&gt;
&lt;p&gt;We can use the most significant bit to represent the most important permission, the comparison between permissions can then be done easily since they all are &lt;code&gt;uint256&lt;&#x2F;code&gt;s.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;associate-a-meaning&quot;&gt;Associate a meaning&lt;&#x2F;h3&gt;
&lt;p&gt;Compared with access control managed via ERC-5982, this EIP does not provide a direct and simple understanding of the meaning of a permission or role.&lt;&#x2F;p&gt;
&lt;p&gt;To deal with this problem, you can set up the metadata interface, which associates a name and description to each permission or role.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;First implementation could be found here:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6617&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;EIP6617.sol&quot;&gt;Basic ERC-6617 implementation&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;No security considerations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>SSZ transaction signature scheme</title>
        <published>2023-02-24T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Etan Kissling</name><uri>https://github.com/etan-status</uri>
	</author>
	
	<author>
		<name>Gajinder Singh</name><uri>https://github.com/g11tech</uri>
	</author>
	
	<author>
		<name>Matt Garnett</name><uri>https://github.com/lightclient</uri>
	</author>
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6493/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6493-ssz-transaction-signature-scheme/13050" />
        

        <id>https://wg-eips.ritovision.com/6493/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:6493"
            label="EIP-6493" />
        

        
        

        
        <summary type="html">Signature scheme for native SSZ transactions</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6493/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP defines a signature scheme for native &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b3e83f6691c61e5b35136000146015653b22ed38&#x2F;ssz&#x2F;simple-serialize.md&quot;&gt;Simple Serialize (SSZ)&lt;&#x2F;a&gt; encoded transactions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6404&#x2F;&quot;&gt;EIP-6404&lt;&#x2F;a&gt; introduces SSZ transactions by converting from RLP transactions. Defining a signature scheme for native SSZ transactions further reduces required conversions and unlocks the forward compatibility benefits of SSZ &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7495&#x2F;&quot;&gt;&lt;code&gt;ProgressiveContainer&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;transaction-signature-scheme&quot;&gt;Transaction signature scheme&lt;&#x2F;h3&gt;
&lt;p&gt;Native SSZ transactions are based on the &lt;code&gt;TransactionPayload&lt;&#x2F;code&gt; defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6404&#x2F;&quot;&gt;EIP-6404&lt;&#x2F;a&gt; and emit an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6466&#x2F;&quot;&gt;EIP-6466&lt;&#x2F;a&gt; &lt;code&gt;Receipt&lt;&#x2F;code&gt;. To distinguish native SSZ transactions from those converted from RLP, native SSZ transactions do not contain the RLP &lt;code&gt;TransactionType&lt;&#x2F;code&gt; field in their &lt;code&gt;TransactionPayload&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;All native SSZ transactions follow a scheme based on &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b3e83f6691c61e5b35136000146015653b22ed38&#x2F;ssz&#x2F;simple-serialize.md#merkleization&quot;&gt;&lt;code&gt;hash_tree_root&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; to compute their signing hash (&lt;code&gt;sig_hash&lt;&#x2F;code&gt;). Likewise, native SSZ authorizations use such a scheme to derive their signing hash (&lt;code&gt;auth_hash&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;Additional information is mixed into &lt;code&gt;sig_hash&lt;&#x2F;code&gt; and &lt;code&gt;auth_hash&lt;&#x2F;code&gt; to uniquely identify the underlying specification and avoid hash collisions across different signature kinds. Vendor-defined networks MUST use a different &lt;code&gt;DomainType&lt;&#x2F;code&gt; for signing custom transaction or authorization types.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;DOMAIN_TX_SSZ&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;DomainType(&#x27;0x01000008&#x27;)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b3e83f6691c61e5b35136000146015653b22ed38&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#custom-types&quot;&gt;&lt;code&gt;DomainType&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; for signing native SSZ transactions compatible with this EIP&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;DOMAIN_AUTH_SSZ&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;DomainType(&#x27;0x02000008&#x27;)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b3e83f6691c61e5b35136000146015653b22ed38&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#custom-types&quot;&gt;&lt;code&gt;DomainType&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; for signing native SSZ authorizations compatible with this EIP&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ExecutionSigningData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    object_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    domain_type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; DomainType&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; compute_ssz_sig_hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; SszTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ExecutionSigningData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        object_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;hash_tree_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        domain_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;DOMAIN_TX_SSZ&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;hash_tree_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; compute_ssz_auth_hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; SszAuthorizationPayload&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ExecutionSigningData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        object_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;hash_tree_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        domain_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;DOMAIN_AUTH_SSZ&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;hash_tree_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;native-transactions&quot;&gt;Native transactions&lt;&#x2F;h3&gt;
&lt;p&gt;New &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7495&#x2F;&quot;&gt;EIP-6404&lt;&#x2F;a&gt; &lt;code&gt;TransactionPayload&lt;&#x2F;code&gt; definitions are introduced to represent native SSZ transactions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;BasicTransactionPayload&lt;&#x2F;code&gt; and &lt;code&gt;CreateTransactionPayload&lt;&#x2F;code&gt; share the functionality of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;#specification&quot;&gt;EIP-1559&lt;&#x2F;a&gt; fee market transactions&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;BlobTransactionPayload&lt;&#x2F;code&gt; shares the functionality of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;#parameters&quot;&gt;EIP-4844&lt;&#x2F;a&gt; blob transactions&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SetCodeTransactionPayload&lt;&#x2F;code&gt; shares the functionality of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;#parameters&quot;&gt;EIP-7702&lt;&#x2F;a&gt; set code transactions; native SSZ types are introduced for authorizations&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BasicTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity&quot;&gt;    ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    chain_id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ChainId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_fees_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BasicFeesPerGas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; GasAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    to&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    input_&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveByteList&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    access_list&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;AccessTuple&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_priority_fees_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BasicFeesPerGas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CreateTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity&quot;&gt;    ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    chain_id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ChainId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_fees_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BasicFeesPerGas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; GasAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    input_&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveByteList&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    access_list&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;AccessTuple&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_priority_fees_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BasicFeesPerGas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BlobTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity&quot;&gt;    ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    chain_id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ChainId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_fees_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BlobFeesPerGas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; GasAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    to&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    input_&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveByteList&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    access_list&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;AccessTuple&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_priority_fees_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BasicFeesPerGas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    blob_versioned_hashes&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;VersionedHash&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ReplayableBasicAuthorizationPayload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BasicAuthorizationPayload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    chain_id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ChainId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SetCodeAuthorizationPayload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;CompatibleUnion&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;01&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; RlpReplayableBasicAuthorizationPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;02&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; RlpBasicAuthorizationPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; [New in EIP-6493]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;11&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ReplayableBasicAuthorizationPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;12&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BasicAuthorizationPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    pass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SetCodeAuthorization&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; SetCodeAuthorizationPayload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionSignature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SetCodeTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity&quot;&gt;    ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    chain_id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ChainId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_fees_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BasicFeesPerGas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; GasAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    to&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    input_&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveByteList&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    access_list&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;AccessTuple&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_priority_fees_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BasicFeesPerGas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    authorization_list&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;SetCodeAuthorization&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SszTransactionPayload&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    BasicTransactionPayload&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    CreateTransactionPayload&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    BlobTransactionPayload&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    SetCodeTransactionPayload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SszAuthorizationPayload&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ReplayableBasicAuthorizationPayload&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    BasicAuthorizationPayload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;transaction-helpers&quot;&gt;Transaction helpers&lt;&#x2F;h4&gt;
&lt;p&gt;The helpers from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6404&#x2F;&quot;&gt;EIP-6404&lt;&#x2F;a&gt; are updated to support native SSZ transactions.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;CompatibleUnion&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;01&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; RlpLegacyReplayableBasicTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;02&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; RlpLegacyReplayableCreateTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;03&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; RlpLegacyBasicTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;04&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; RlpLegacyCreateTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;05&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; RlpAccessListBasicTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;06&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; RlpAccessListCreateTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;07&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; RlpBasicTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;08&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; RlpCreateTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;09&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; RlpBlobTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0a&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; RlpSetCodeTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; [New in EIP-6493]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;11&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BasicTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;12&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; CreateTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;13&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BlobTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;14&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; SetCodeTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    pass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;json-rpc&quot;&gt;JSON-RPC&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SSZ_TX_TYPE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;TransactionType(0x1f)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Endpoint specific SSZ object&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Certain JSON-RPC endpoints such as &lt;code&gt;eth_getTransactionByHash&lt;&#x2F;code&gt; indicate the corresponding &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; envelope type prefix in a &lt;code&gt;type&lt;&#x2F;code&gt; field.&lt;&#x2F;p&gt;
&lt;p&gt;When representing native SSZ transactions on such endpoints, &lt;code&gt;SSZ_TX_TYPE&lt;&#x2F;code&gt; SHOULD be indicated as their &lt;code&gt;type&lt;&#x2F;code&gt;. Omitting the &lt;code&gt;type&lt;&#x2F;code&gt; is NOT RECOMMENDED as certain client applications could confuse the omission with untyped &lt;code&gt;LegacyTransaction&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;unique-transaction-identifier&quot;&gt;Unique transaction identifier&lt;&#x2F;h3&gt;
&lt;p&gt;The unique RPC transaction identifier &lt;code&gt;tx_hash&lt;&#x2F;code&gt; for native SSZ transactions is defined to match the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6404&#x2F;#unique-transaction-identifier&quot;&gt;EIP-6404&lt;&#x2F;a&gt; &lt;code&gt;tx_root&lt;&#x2F;code&gt; value.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The SSZ signature scheme reduces hashing overhead and ensures that &lt;code&gt;tx_hash&lt;&#x2F;code&gt; commitments are available on-chain. It also provides a flexible basis for future transaction functionality.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The new transaction signature scheme is solely used for native SSZ transactions and is representable using a unique &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; envelope type prefix (&lt;code&gt;SSZ_TX_TYPE&lt;&#x2F;code&gt;) different from existing RLP transactions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;SSZ signatures MUST NOT collide with RLP transaction and message hashes.&lt;&#x2F;p&gt;
&lt;p&gt;As RLP messages are hashed using keccak256, and all SSZ objects are hashed using SHA256. These two hashing algorithms are both considered cryptographically secure and are based on fundamentally different approaches, minimizing the risk of hash collision between those two hashing algorithms.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore, RLP messages are hashed linearly across their serialization, while SSZ objects are hashed using a recursive Merkle tree. Having a different mechanism further reduces the risk of hash collisions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Non-fungible Token Bound Accounts</title>
        <published>2023-02-23T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Jayden Windle</name><uri>https://github.com/jaydenwindle</uri>
	</author>
	
	<author>
		<name>Benny Giang</name><email>bg@futureprimitive.xyz</email>
	</author>
	
	<author>
		<name>Steve Jang</name>
	</author>
	
	<author>
		<name>Druzy Downs</name><uri>https://github.com/druzydowns</uri>
	</author>
	
	<author>
		<name>Raymond Huynh</name><uri>https://github.com/huynhr</uri>
	</author>
	
	<author>
		<name>Alanah Lam</name><email>alanah@futureprimitive.xyz</email>
	</author>
	
	<author>
		<name>Wilkins Chung</name><uri>https://github.com/wwhchung</uri><email>wilkins@manifold.xyz</email>
	</author>
	
	<author>
		<name>Paul Sullivan</name><uri>https://github.com/sullivph</uri><email>paul.sullivan@manifold.xyz</email>
	</author>
	
	<author>
		<name>Auryn Macmillan</name><uri>https://github.com/auryn-macmillan</uri>
	</author>
	
	<author>
		<name>Jan-Felix Schwarz</name><uri>https://github.com/jfschwarz</uri>
	</author>
	
	<author>
		<name>Anton Bukov</name><uri>https://github.com/k06a</uri>
	</author>
	
	<author>
		<name>Mikhail Melnik</name><uri>https://github.com/ZumZoom</uri>
	</author>
	
	<author>
		<name>Josh Weintraub</name><uri>https://github.com/jhweintraub</uri><email>jhweintraub@gmail.com</email>
	</author>
	
	<author>
		<name>Rob Montgomery</name><uri>https://github.com/RobAnon</uri><email>rob@revest.finance</email>
	</author>
	
	<author>
		<name>vectorized</name><uri>https://github.com/vectorized</uri>
	</author>
	
	<author>
		<name>Víctor Martínez</name><uri>https://github.com/vnmrtz</uri>
	</author>
	
	<author>
		<name>Adrián Pajares</name><uri>https://github.com/0xadrii</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6551/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/non-fungible-token-bound-accounts/13030" />
        

        <id>https://wg-eips.ritovision.com/6551/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:6551"
            label="ERC-6551" />
        

        
        

        
        <summary type="html">An interface and registry for smart contract accounts owned by non-fungible tokens</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6551/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal defines a system which assigns Ethereum accounts to all non-fungible tokens. These token bound accounts allow NFTs to own assets and interact with applications, without requiring changes to existing smart contracts or infrastructure.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; standard enabled an explosion of non-fungible token applications. Some notable use cases have included breedable cats, generative artwork, and exchange liquidity positions.&lt;&#x2F;p&gt;
&lt;p&gt;However, NFTs cannot act as agents or associate with other on-chain assets. This limitation makes it difficult to represent many real-world non-fungible assets as NFTs. For example:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A character in a role-playing game that accumulates assets and abilities over time based on actions they have taken&lt;&#x2F;li&gt;
&lt;li&gt;An automobile composed of many fungible and non-fungible components&lt;&#x2F;li&gt;
&lt;li&gt;An investment portfolio composed of multiple fungible assets&lt;&#x2F;li&gt;
&lt;li&gt;A punch pass membership card granting access to an establishment and recording a history of past interactions&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This proposal aims to give every NFT the same rights as an Ethereum user. This includes the ability to self-custody assets, execute arbitrary operations, control multiple independent accounts, and use accounts across multiple chains. By doing so, this proposal allows complex real-world assets to be represented as NFTs using a common pattern that mirrors Etherem&#x27;s existing ownership model.&lt;&#x2F;p&gt;
&lt;p&gt;This is accomplished by defining a singleton registry which assigns unique, deterministic smart contract account addresses to all existing and future NFTs. Each account is permanently bound to a single NFT, with control of the account granted to the holder of that NFT.&lt;&#x2F;p&gt;
&lt;p&gt;The pattern defined in this proposal does not require any changes to existing NFT smart contracts. It is also compatible out of the box with nearly all existing infrastructure that supports Ethereum accounts, from on-chain protocols to off-chain indexers. Token bound accounts are compatible with every existing on-chain asset standard, and can be extended to support new asset standards created in the future.&lt;&#x2F;p&gt;
&lt;p&gt;By giving every NFT the full capabilities of an Ethereum account, this proposal enables many novel use cases for existing and future NFTs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;overview&quot;&gt;Overview&lt;&#x2F;h3&gt;
&lt;p&gt;The system outlined in this proposal has two main components:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A singleton registry for token bound accounts&lt;&#x2F;li&gt;
&lt;li&gt;A common interface for token bound account implementations&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The following diagram illustrates the relationship between NFTs, NFT holders, token bound accounts, and the Registry:
&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6551&#x2F;.&#x2F;assets&#x2F;diagram.png&quot; alt=&quot;&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;registry&quot;&gt;Registry&lt;&#x2F;h3&gt;
&lt;p&gt;The registry is a singleton contract that serves as the entry point for all token bound account address queries. It has two functions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;createAccount&lt;&#x2F;code&gt; - creates the token bound account for an NFT given an &lt;code&gt;implementation&lt;&#x2F;code&gt; address&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;account&lt;&#x2F;code&gt; - computes the token bound account address for an NFT given an &lt;code&gt;implementation&lt;&#x2F;code&gt; address&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The registry is permissionless, immutable, and has no owner. The complete source code for the registry can be found in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6551&#x2F;#registry-implementation&quot;&gt;Registry Implementation&lt;&#x2F;a&gt; section. The registry MUST be deployed at address &lt;code&gt;0x000000006551c19487814612e58FE06813775758&lt;&#x2F;code&gt; using Nick&#x27;s Factory (&lt;code&gt;0x4e59b44847b379578588920cA78FbF26c0B4956C&lt;&#x2F;code&gt;) with salt &lt;code&gt;0x0000000000000000000000000000000000000000fd8eb4e1dca713016c518e31&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The registry can be deployed to any EVM-compatible chain using the following transaction:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;to&amp;quot;: &amp;quot;0x4e59b44847b379578588920ca78fbf26c0b4956c&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;value&amp;quot;: &amp;quot;0x0&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;data&amp;quot;: &amp;quot;0x0000000000000000000000000000000000000000fd8eb4e1dca713016c518e31608060405234801561001057600080fd5b5061023b806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c8063246a00211461003b5780638a54c52f1461006a575b600080fd5b61004e6100493660046101b7565b61007d565b6040516001600160a01b03909116815260200160405180910390f35b61004e6100783660046101b7565b6100e1565b600060806024608c376e5af43d82803e903d91602b57fd5bf3606c5285605d52733d60ad80600a3d3981f3363d3d373d3d3d363d7360495260ff60005360b76055206035523060601b60015284601552605560002060601b60601c60005260206000f35b600060806024608c376e5af43d82803e903d91602b57fd5bf3606c5285605d52733d60ad80600a3d3981f3363d3d373d3d3d363d7360495260ff60005360b76055206035523060601b600152846015526055600020803b61018b578560b760556000f580610157576320188a596000526004601cfd5b80606c52508284887f79f19b3655ee38b1ce526556b7731a20c8f218fbda4a3990b6cc4172fdf887226060606ca46020606cf35b8060601b60601c60005260206000f35b80356001600160a01b03811681146101b257600080fd5b919050565b600080600080600060a086880312156101cf57600080fd5b6101d88661019b565b945060208601359350604086013592506101f46060870161019b565b94979396509194608001359291505056fea2646970667358221220ea2fe53af507453c64dd7c1db05549fa47a298dfb825d6d11e1689856135f16764736f6c63430008110033&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The registry MUST deploy each token bound account as an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1167&#x2F;&quot;&gt;ERC-1167&lt;&#x2F;a&gt; minimal proxy with immutable constant data appended to the bytecode.&lt;&#x2F;p&gt;
&lt;p&gt;The deployed bytecode of each token bound account MUST have the following structure:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ERC-1167 Header               (10 bytes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;implementation (address)&amp;gt;    (20 bytes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ERC-1167 Footer               (15 bytes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;salt (bytes32)&amp;gt;              (32 bytes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;chainId (uint256)&amp;gt;           (32 bytes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;tokenContract (address)&amp;gt;     (32 bytes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;tokenId (uint256)&amp;gt;           (32 bytes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;For example, the token bound account with implementation address &lt;code&gt;0xbebebebebebebebebebebebebebebebebebebebe&lt;&#x2F;code&gt;, salt &lt;code&gt;0&lt;&#x2F;code&gt;, chain ID &lt;code&gt;1&lt;&#x2F;code&gt;, token contract &lt;code&gt;0xcfcfcfcfcfcfcfcfcfcfcfcfcfcfcfcfcfcfcfcf&lt;&#x2F;code&gt; and token ID &lt;code&gt;123&lt;&#x2F;code&gt; would have the following deployed bytecode:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;363d3d373d3d3d363d73bebebebebebebebebebebebebebebebebebebebe5af43d82803e903d91602b57fd5bf300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000cfcfcfcfcfcfcfcfcfcfcfcfcfcfcfcfcfcfcfcf000000000000000000000000000000000000000000000000000000000000007b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Each token bound account proxy MUST delegate execution to a contract that implements the &lt;code&gt;IERC6551Account&lt;&#x2F;code&gt; interface.&lt;&#x2F;p&gt;
&lt;p&gt;The registry MUST deploy all token bound accounts using the &lt;code&gt;create2&lt;&#x2F;code&gt; opcode so that each account address is deterministic. Each token bound account address SHALL be derived from the unique combination of its implementation address, token contract address, token ID, chain ID, and salt.&lt;&#x2F;p&gt;
&lt;p&gt;The registry MUST implement the following interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6551Registry&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The registry MUST emit the ERC6551AccountCreated event upon successful account creation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC6551AccountCreated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; implementation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; salt&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; chainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The registry MUST revert with AccountCreationFailed error if the create2 operation fails.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AccountCreationFailed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Creates a token bound account for a non-fungible token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * If account has already been created, returns the account address without calling create2.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Emits ERC6551AccountCreated event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the token bound account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; createAccount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; implementation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; salt&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; chainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the computed token bound account address for a non-fungible token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the token bound account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; implementation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; salt&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; chainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;account-interface&quot;&gt;Account Interface&lt;&#x2F;h3&gt;
&lt;p&gt;All token bound accounts SHOULD be created via the singleton registry.&lt;&#x2F;p&gt;
&lt;p&gt;All token bound account implementations MUST implement &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; interface detection.&lt;&#x2F;p&gt;
&lt;p&gt;All token bound account implementations MUST implement &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;ERC-1271&lt;&#x2F;a&gt; signature validation.&lt;&#x2F;p&gt;
&lt;p&gt;All token bound account implementations MUST implement the following interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the ERC-165 identifier for this interface is `0x6faff5f1`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6551Account&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Allows the account to receive Ether.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Accounts MUST implement a `receive` function.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Accounts MAY perform arbitrary logic to restrict conditions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * under which Ether can be received.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    receive&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the identifier of the non-fungible token which owns the account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * The return value of this function MUST be constant - it MUST NOT change over time.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;       The chain ID of the chain the token exists on&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The contract address of the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;       The ID of the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; chainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns a value that SHOULD be modified each time the account changes state.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; current account state&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; state&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns a magic value indicating whether a given signer is authorized to act on behalf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * of the account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST return the bytes4 magic value 0x523e3260 if the given signer is valid.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * By default, the holder of the non-fungible token the account is bound to MUST be considered&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * a valid signer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Accounts MAY implement additional authorization logic which invalidates the holder as a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * signer or grants signing permissions to other non-holder accounts.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  signer&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     The address to check signing authorization for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  context&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    Additional data used to determine whether the signer is valid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; magicValue&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Magic value indicating whether the signer is valid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isValidSigner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; context&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; magicValue&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;execution-interface&quot;&gt;Execution Interface&lt;&#x2F;h3&gt;
&lt;p&gt;All token bound accounts MUST implement an execution interface which allows valid signers to execute arbitrary operations on behalf of the account. Support for an execution interface MUST be signaled by the account using ERC-165 interface detection.&lt;&#x2F;p&gt;
&lt;p&gt;Token bound accounts MAY support the following execution interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the ERC-165 identifier for this interface is `0x51945447`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6551Executable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Executes a low-level operation if the caller is a valid signer on the account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Reverts and bubbles up error if operation fails.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Accounts implementing this interface MUST accept the following operation parameter values:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - 0 = CALL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - 1 = DELEGATECALL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - 2 = CREATE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - 3 = CREATE2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Accounts implementing this interface MAY support additional operations or restrict a signer&amp;#39;s&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * ability to execute certain operations.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;        The target address of the operation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     The Ether value to be sent to the target&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      The encoded operation calldata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; operation&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A value indicating the type of operation to perform&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; result of the operation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; execute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operation&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        payable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;singleton-registry&quot;&gt;Singleton Registry&lt;&#x2F;h3&gt;
&lt;p&gt;This proposal specifies a single, canonical registry that can be permissionlessly deployed to any chain at a known address. It purposefully does not specify a common interface that can be implemented by multiple registry contracts. This approach enables several critical properties.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;counterfactual-accounts&quot;&gt;Counterfactual Accounts&lt;&#x2F;h4&gt;
&lt;p&gt;All token bound accounts are created using the create2 opcode, enabling accounts to exist in a counterfactual state prior to their creation. This allows token bound accounts to receive assets prior to contract creation. A singleton account registry ensures a common addressing scheme is used for all token bound account addresses.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;trustless-deployments&quot;&gt;Trustless Deployments&lt;&#x2F;h4&gt;
&lt;p&gt;A single ownerless registry ensures that the only trusted contract for any token bound account is the implementation. This guarantees the holder of a token access to all assets stored within a counterfactual account using a trusted implementation.&lt;&#x2F;p&gt;
&lt;p&gt;Without a canonical registry, some token bound accounts may be deployed using an owned or upgradable registry. This may lead to loss of assets stored in counterfactual accounts, and increases the scope of the security model that applications supporting this proposal must consider.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;cross-chain-compatibility&quot;&gt;Cross-chain Compatibility&lt;&#x2F;h4&gt;
&lt;p&gt;A singleton registry with a known address enables each token bound account to exist on multiple chains. The inclusion of &lt;code&gt;chainId&lt;&#x2F;code&gt; as a parameter to &lt;code&gt;createAccount&lt;&#x2F;code&gt; allows the contract for a token bound account to be deployed at the same address on any supported chain. Account implementations are therefore able to support cross-chain account execution, where an NFT on one chain can control its token bound account on another chain.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;single-entry-point&quot;&gt;Single Entry Point&lt;&#x2F;h4&gt;
&lt;p&gt;A single entry point for querying account addresses and &lt;code&gt;AccountCreated&lt;&#x2F;code&gt; events simplifies the complex task of indexing token bound accounts in applications which support this proposal.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;implementation-diversity&quot;&gt;Implementation Diversity&lt;&#x2F;h4&gt;
&lt;p&gt;A singleton registry allows diverse account implementations to share a common addressing scheme. This gives developers significant freedom to implement both account-specific features (e.g. delegation) as well as alternative account models (e.g. ephemeral accounts) in a way that can be easily supported by client applications.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;registry-vs-factory&quot;&gt;Registry vs Factory&lt;&#x2F;h3&gt;
&lt;p&gt;The term &quot;registry&quot; was chosen instead of &quot;factory&quot; to highlight the canonical nature of the contract and emphasize the act of querying account addresses (which occurs regularly) over the creation of accounts (which occurs only once per account).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;variable-execution-interface&quot;&gt;Variable Execution Interface&lt;&#x2F;h3&gt;
&lt;p&gt;This proposal does not require accounts to implement a specific execution interface in order to be compatible, so long as they signal support for at least one execution interface via ERC-165 interface detection. Allowing account developers to choose their own execution interface allows this proposal to support the wide variety of existing execution interfaces and maintain forward compatibility with likely future standardized interfaces.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;account-ambiguity&quot;&gt;Account Ambiguity&lt;&#x2F;h3&gt;
&lt;p&gt;The specification proposed above allows NFTs to have multiple token bound accounts. During the development of this proposal, alternative architectures were considered which would have assigned a single token bound account to each NFT, making each token bound account address an unambiguous identifier.&lt;&#x2F;p&gt;
&lt;p&gt;However, these alternatives present several trade offs.&lt;&#x2F;p&gt;
&lt;p&gt;First, due to the permissionless nature of smart contracts, it is impossible to enforce a limit of one token bound account per NFT. Anyone wishing to utilize multiple token bound accounts per NFT could do so by deploying an additional registry contract.&lt;&#x2F;p&gt;
&lt;p&gt;Second, limiting each NFT to a single token bound account would require a static, trusted account implementation to be included in this proposal. This implementation would inevitably impose specific constraints on the capabilities of token bound accounts. Given the number of unexplored use cases this proposal enables and the benefit that diverse account implementations could bring to the non-fungible token ecosystem, it is the authors&#x27; opinion that defining a canonical and constrained implementation in this proposal is premature.&lt;&#x2F;p&gt;
&lt;p&gt;Finally, this proposal seeks to grant NFTs the ability to act as agents on-chain. In current practice, on-chain agents often utilize multiple accounts. A common example is individuals who use a &quot;hot&quot; account for daily use and a &quot;cold&quot; account for storing valuables. If on-chain agents commonly use multiple accounts, it stands to reason that NFTs ought to inherit the same ability.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;proxy-implementation&quot;&gt;Proxy Implementation&lt;&#x2F;h3&gt;
&lt;p&gt;ERC-1167 minimal proxies are well supported by existing infrastructure and are a common smart contract pattern. This proposal deploys each token bound account using a custom ERC-1167 proxy implementation that stores the salt, chain id, token contract address, and token ID as ABI-encoded constant data appended to the contract bytecode. This allows token bound account implementations to easily query this data while ensuring it remains constant. This approach was taken to maximize compatibility with existing infrastructure while also giving smart contract developers full flexibility when creating custom token bound account implementations.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;chain-identifier&quot;&gt;Chain Identifier&lt;&#x2F;h3&gt;
&lt;p&gt;This proposal uses the chain ID to identify each NFT along with its contract address and token ID. Token identifiers are globally unique on a single Ethereum chain, but may not be unique across multiple Ethereum chains.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal seeks to be maximally backwards compatible with existing non-fungible token contracts. As such, it does not extend the ERC-721 standard.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, this proposal does not require the registry to perform an ERC-165 interface check for ERC-721 compatibility prior to account creation. This maximizes compatibility with non-fungible token contracts that pre-date the ERC-721 standard (such as CryptoKitties) or only implement a subset of the ERC-721 interface (such as ENS NameWrapper names). It also allows the system described in this proposal to be used with semi-fungible or fungible tokens, although these use cases are outside the scope of the proposal.&lt;&#x2F;p&gt;
&lt;p&gt;Smart contract authors may optionally choose to enforce interface detection for ERC-721 in their account implementations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;example-account-implementation&quot;&gt;Example Account Implementation&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;utils&#x2F;introspection&#x2F;IERC165.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC721&#x2F;IERC721.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;interfaces&#x2F;IERC1271.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;utils&#x2F;cryptography&#x2F;SignatureChecker.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6551Account&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    receive&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; chainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; state&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isValidSigner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; context&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; magicValue&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6551Executable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; execute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operation&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        payable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC6551Account&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC165&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC1271&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC6551Account&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC6551Executable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; immutable&lt;&#x2F;span&gt;&lt;span&gt; deploymentChainId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;chainid&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    receive&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; execute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operation&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        payable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        virtual&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_isValidSigner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Invalid signer&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;operation &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Only call operations are supported&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        +&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span&gt; success&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span&gt;success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;call&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                revert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;result&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isValidSigner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_isValidSigner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; IERC6551Account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;isValidSigner&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes4&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isValidSignature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        virtual&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; magicValue&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span&gt; isValid &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; SignatureChecker&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isValidSignatureNow&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;isValid&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; IERC1271&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;isValidSignature&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes4&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;IERC165&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;interfaceId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            ||&lt;&#x2F;span&gt;&lt;span&gt; interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;IERC6551Account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;interfaceId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            ||&lt;&#x2F;span&gt;&lt;span&gt; interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;IERC6551Executable&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;interfaceId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; footer &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x60&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            extcodecopy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;footer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x4d&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x60&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;decode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;footer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; chainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt; tokenContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;chainId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span&gt; deploymentChainId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenContract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _isValidSigner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; signer &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;registry-implementation&quot;&gt;Registry Implementation&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: MIT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.4&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6551Registry&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The registry MUST emit the ERC6551AccountCreated event upon successful account creation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC6551AccountCreated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; implementation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; salt&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; chainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The registry MUST revert with AccountCreationFailed error if the create2 operation fails.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AccountCreationFailed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Creates a token bound account for a non-fungible token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * If account has already been created, returns the account address without calling create2.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Emits ERC6551AccountCreated event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the token bound account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; createAccount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; implementation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; salt&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; chainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the computed token bound account address for a non-fungible token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the token bound account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; implementation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; salt&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; chainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC6551Registry&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6551Registry&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; createAccount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; implementation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; salt&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; chainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Memory Layout:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ----&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0x00   0xff                           (1 byte)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0x01   registry (address)             (20 bytes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0x15   salt (bytes32)                 (32 bytes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0x35   Bytecode Hash (bytes32)        (32 bytes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ----&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0x55   ERC-1167 Constructor + Header  (20 bytes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0x69   implementation (address)       (20 bytes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0x5D   ERC-1167 Footer                (15 bytes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0x8C   salt (uint256)                 (32 bytes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0xAC   chainId (uint256)              (32 bytes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0xCC   tokenContract (address)        (32 bytes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0xEC   tokenId (uint256)              (32 bytes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Silence unused variable warnings&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            pop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;chainId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Copy bytecode + constant data to memory&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            calldatacopy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x8c&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x24&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x80&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; salt, chainId, tokenContract, tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            mstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x6c&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x5af43d82803e903d91602b57fd5bf3&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-1167 footer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            mstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x5d&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; implementation&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; implementation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            mstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x49&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x3d60ad80600a3d3981f3363d3d373d3d3d363d73&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-1167 constructor + header&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Copy create2 computation data to memory&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            mstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x35&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x55&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xb7&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; keccak256(bytecode)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            mstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x15&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; salt&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; salt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            mstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; shl&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;96&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; registry address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            mstore8&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x00&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xff&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0xFF&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Compute account address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            let&lt;&#x2F;span&gt;&lt;span&gt; computed &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x00&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x55&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If the account has not yet been deployed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; iszero&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;extcodesize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;computed&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;                &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Deploy account contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;                let&lt;&#x2F;span&gt;&lt;span&gt; deployed &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; create2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x55&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xb7&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; salt&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;                &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Revert if the deployment fails&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                if&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; iszero&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;deployed&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;                    mstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x00&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x20188a59&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `AccountCreationFailed()`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                    revert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x1c&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x04&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;                &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Store account address in memory before salt and chainId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;                mstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x6c&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; deployed&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;                &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emit the ERC6551AccountCreated event&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;                log4&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;                    0x6c&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;                    0x60&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;                    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `ERC6551AccountCreated(address,address,bytes32,uint256,address,uint256)`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;                    0x79f19b3655ee38b1ce526556b7731a20c8f218fbda4a3990b6cc4172fdf88722&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    implementation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    tokenContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;                &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Return the account address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                return&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x6c&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Otherwise, return the computed account address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            mstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x00&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; shr&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;96&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; shl&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;96&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; computed&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x00&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; implementation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; salt&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; chainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Silence unused variable warnings&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            pop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;chainId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            pop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenContract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            pop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Copy bytecode + constant data to memory&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            calldatacopy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x8c&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x24&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x80&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; salt, chainId, tokenContract, tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            mstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x6c&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x5af43d82803e903d91602b57fd5bf3&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-1167 footer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            mstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x5d&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; implementation&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; implementation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            mstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x49&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x3d60ad80600a3d3981f3363d3d373d3d3d363d73&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-1167 constructor + header&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Copy create2 computation data to memory&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            mstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x35&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x55&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xb7&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; keccak256(bytecode)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            mstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x15&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; salt&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; salt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            mstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; shl&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;96&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; registry address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            mstore8&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x00&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xff&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0xFF&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Store computed account address in memory&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            mstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x00&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; shr&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;96&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; shl&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;96&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x00&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x55&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Return computed account address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x00&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;fraud-prevention&quot;&gt;Fraud Prevention&lt;&#x2F;h3&gt;
&lt;p&gt;In order to enable trustless sales of token bound accounts, decentralized marketplaces will need to implement safeguards against fraudulent behavior by malicious account owners.&lt;&#x2F;p&gt;
&lt;p&gt;Consider the following potential scam:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Alice owns an ERC-721 token X, which owns token bound account Y.&lt;&#x2F;li&gt;
&lt;li&gt;Alice deposits 10ETH into account Y&lt;&#x2F;li&gt;
&lt;li&gt;Bob offers to purchase token X for 11ETH via a decentralized marketplace, assuming he will receive the 10ETH stored in account Y along with the token&lt;&#x2F;li&gt;
&lt;li&gt;Alice withdraws 10ETH from the token bound account, and immediately accepts Bob&#x27;s offer&lt;&#x2F;li&gt;
&lt;li&gt;Bob receives token X, but account Y is empty&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;To mitigate fraudulent behavior by malicious account owners, decentralized marketplaces SHOULD implement protection against these sorts of scams at the marketplace level. Contracts which implement this EIP MAY also implement certain protections against fraudulent behavior.&lt;&#x2F;p&gt;
&lt;p&gt;Here are a few mitigations strategies to be considered:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Attach the current token bound account state to the marketplace order. If the state of the account has changed since the order was placed, consider the offer void. This functionality would need to be supported at the marketplace level.&lt;&#x2F;li&gt;
&lt;li&gt;Attach a list of asset commitments to the marketplace order that are expected to remain in the token bound account when the order is fulfilled. If any of the committed assets have been removed from the account since the order was placed, consider the offer void. This would also need to be implemented by the marketplace.&lt;&#x2F;li&gt;
&lt;li&gt;Submit the order to the decentralized market via an external smart contract which performs the above logic before validating the order signature. This allows for safe transfers to be implemented without marketplace support.&lt;&#x2F;li&gt;
&lt;li&gt;Implement a locking mechanism on the token bound account implementation that prevents malicious owners from extracting assets from the account while locked&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Preventing fraud is outside the scope of this proposal.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;ownership-cycles&quot;&gt;Ownership Cycles&lt;&#x2F;h3&gt;
&lt;p&gt;All assets held in a token bound account may be rendered inaccessible if an ownership cycle is created. The simplest example is the case of an ERC-721 token being transferred to its own token bound account. If this occurs, both the ERC-721 token and all of the assets stored in the token bound account would be permanently inaccessible, since the token bound account is incapable of executing a transaction which transfers the ERC-721 token.&lt;&#x2F;p&gt;
&lt;p&gt;Ownership cycles can be introduced in any graph of n&amp;gt;0 token bound accounts. On-chain prevention of cycles with depth&amp;gt;1 is difficult to enforce given the infinite search space required, and as such is outside the scope of this proposal. Application clients and account implementations wishing to adopt this proposal are encouraged to implement measures that limit the possibility of ownership cycles.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Multi-redeemable NFTs</title>
        <published>2023-02-21T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>RE:DREAMER Lab</name><email>dev@redreamer.io</email>
	</author>
	
	<author>
		<name>Archie Chang</name><uri>https://github.com/ArchieR7</uri><email>archie@redreamer.io</email>
	</author>
	
	<author>
		<name>Kai Yu</name><uri>https://github.com/chihkaiyu</uri><email>kai@redreamer.io</email>
	</author>
	
	<author>
		<name>Yonathan Randyanto</name><uri>https://github.com/Randyanto</uri><email>randy@redreamer.io</email>
	</author>
	
	<author>
		<name>Boyu Chu</name><uri>https://github.com/chuboyu</uri><email>boyu@redreamer.io</email>
	</author>
	
	<author>
		<name>Boxi Li</name><uri>https://github.com/boxi79</uri><email>boxi@redreamer.io</email>
	</author>
	
	<author>
		<name>Jason Cheng</name><uri>https://github.com/JasonCheng0729</uri><email>jason@redreamer.io</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6672/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6672-multi-redeemable-nfts/13276" />
        

        <id>https://wg-eips.ritovision.com/6672/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:6672"
            label="ERC-6672" />
        

        
        

        
        <summary type="html">An extension of ERC-721 which enables an NFT to be redeemed in multiple scenarios for either a physical or digital object</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6672/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes an extension to the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; standard for Non-Fungible Tokens (NFTs) to enable multi-redeemable NFTs. Redemption provides a means for NFT holders to demonstrate ownership and eligibility of their NFT, which in turn enables them to receive a physical or digital item. This extension would allow an NFT to be redeemed in multiple scenarios and maintain a record of its redemption status on the blockchain.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The motivation behind our proposed NFT standard is to provide a more versatile and flexible solution compared to existing standards, allowing for multi-redeemable NFTs. Our proposed NFT standard enables multi-redeemable NFTs, allowing them to be redeemed in multiple scenarios for different campaigns or events, thus unlocking new possibilities for commerce use cases and breaking the limitation of one-time redemption per NFT.&lt;&#x2F;p&gt;
&lt;p&gt;One use case for an NFT that can be redeemed multiple times in various scenarios is a digital concert ticket. The NFT could be redeemed for access to the online concert and then again for exclusive merchandise, a meet and greet with the artist, or any exclusive commerce status that is bound to the NFT. Each redemption could represent a unique experience or benefit for the NFT holder.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;redeem-and-cancel-functions&quot;&gt;Redeem and Cancel Functions&lt;&#x2F;h3&gt;
&lt;p&gt;An operator SHALL only make an update to the redemption created by itself. Therefore, the &lt;code&gt;redeem()&lt;&#x2F;code&gt; and &lt;code&gt;cancel()&lt;&#x2F;code&gt; functions do not have an &lt;code&gt;_operator&lt;&#x2F;code&gt; parameter, and the &lt;code&gt;msg.sender&lt;&#x2F;code&gt; address MUST be used as the &lt;code&gt;_operator&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;redemption-flag-key-value-pairs&quot;&gt;Redemption Flag Key-Value Pairs&lt;&#x2F;h3&gt;
&lt;p&gt;The combination of &lt;code&gt;_operator&lt;&#x2F;code&gt;, &lt;code&gt;_tokenId&lt;&#x2F;code&gt;, and &lt;code&gt;_redemptionId&lt;&#x2F;code&gt; MUST be used as the key in the redemption flag key-value pairs, whose value can be accessed from the &lt;code&gt;isRedeemed()&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Every contract compliant with this EIP MUST implement &lt;code&gt;ERC6672&lt;&#x2F;code&gt; and &lt;code&gt;ERC721&lt;&#x2F;code&gt; interfaces.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.16&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-6672 Multi-Redeemable NFT Standard&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-6672&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0x4dddf83f.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6672&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is IERC721 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This event emits when an NFT is redeemed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Redeem&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; redeemer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _redemptionId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _memo&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This event emits when a redemption is canceled.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Cancel&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _redemptionId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _memo&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check whether an NFT is already used for redemption or not.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the operator of the redemption platform.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _redemptionId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier for a redemption.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier for an NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Whether&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; an NFT is already redeemed or not.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isRedeemed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _redemptionId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; List the redemptions created by the given operator for the given NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the operator of the redemption platform.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier for an NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; List&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; of redemptions of speficic `_operator` and `_tokenId`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getRedemptionIds&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Redeem an NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _redemptionId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier created by the operator for a redemption.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT to redeem.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _memo&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; redeem&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _redemptionId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _memo&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Cancel a redemption&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _redemptionId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The redemption to cancel.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT to cancel the redemption.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _memo&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; cancel&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _redemptionId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _memo&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;metadata-extension&quot;&gt;Metadata Extension&lt;&#x2F;h3&gt;
&lt;p&gt;The key format for the &lt;code&gt;redemptions&lt;&#x2F;code&gt; key-value pairs MUST be standardized as &lt;code&gt;operator-tokenId-redemptionId&lt;&#x2F;code&gt;, where &lt;code&gt;operator&lt;&#x2F;code&gt; is the operator wallet address, &lt;code&gt;tokenId&lt;&#x2F;code&gt; is  the identifier of the token that has been redeemed, and &lt;code&gt;redemptionId&lt;&#x2F;code&gt; is the redemption identifier. The value of the key &lt;code&gt;operator-tokenId-redemptionId&lt;&#x2F;code&gt; is an object that contains the &lt;code&gt;status&lt;&#x2F;code&gt; and &lt;code&gt;description&lt;&#x2F;code&gt; of the redemption.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Redemption status, i.e. &lt;code&gt;status&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The redemption status can have a more granular level, rather than just being a flag with a &lt;code&gt;true&lt;&#x2F;code&gt; or &lt;code&gt;false&lt;&#x2F;code&gt; value. For instance, in cases of physical goods redemption, we may require the redemption status to be either &lt;code&gt;redeemed&lt;&#x2F;code&gt;, &lt;code&gt;paid&lt;&#x2F;code&gt;, or &lt;code&gt;shipping&lt;&#x2F;code&gt;. It is RECOMMENDED to use a string enum that is comprehensible by both the operator and the marketplace or any other parties that want to exhibit the status of the redemption.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Description of the redemption, i.e. &lt;code&gt;description&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;description&lt;&#x2F;code&gt; SHOULD be used to provide more details about the redemption, such as information about the concert ticket, a detailed description of the action figures, and more.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;strong&gt;metadata extension&lt;&#x2F;strong&gt; is OPTIONAL for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6672&#x2F;&quot;&gt;ERC-6672&lt;&#x2F;a&gt; smart contracts (see &quot;caveats&quot;, below). This allows your smart contract to be interrogated for its name and for details about the assets which your NFTs represent.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-6672 Multi-Redeemable Token Standard, optional metadata extension&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-6672&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6672Metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is IERC721Metadata &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A distinct Uniform Resource Identifier (URI) for a given asset.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws if `_tokenId` is not a valid NFT. URIs are defined in RFC&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  3986. The URI may point to a JSON file that conforms to the &amp;quot;ERC-6672&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  Metadata JSON Schema&amp;quot;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This is the &quot;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6672&#x2F;&quot;&gt;ERC-6672&lt;&#x2F;a&gt; Metadata JSON Schema&quot; referenced above.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Asset Metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Identifies the asset to which this NFT represents&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Describes the asset to which this NFT represents&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;image&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A URI pointing to a resource with mime type image&#x2F;* representing the asset to which this NFT represents. Consider making any images at a width between 320 and 1080 pixels and aspect ratio between 1.91:1 and 4:5 inclusive.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;redemptions&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;operator-tokenId-redemptionId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;status&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The status of a redemption. Enum type can be used to represent the redemption status, such as redeemed, shipping, paid.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Describes the object that has been redeemed for an NFT, such as the name of an action figure series name or the color of the product.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;key-choices-for-redemption-flag-and-status&quot;&gt;Key Choices for Redemption Flag and Status&lt;&#x2F;h3&gt;
&lt;p&gt;The combination of &lt;code&gt;_operator&lt;&#x2F;code&gt;, &lt;code&gt;_tokenId&lt;&#x2F;code&gt;, and &lt;code&gt;_redemptionId&lt;&#x2F;code&gt; is chosen as the key because it provides a clear and unique identifier for each redemption transaction.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Operator wallet address, i.e. &lt;code&gt;_operator&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;It&#x27;s possible that there are more than one party who would like to use the same NFT for redemption. For example, MisterPunks NFTs are eligible to be redeemed for both Event-X and Event-Y tickets, and each event&#x27;s ticket redemption is handled by a different operator.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Token identifier, i.e. &lt;code&gt;_tokenId&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Each NFT holder will have different redemption records created by the same operator. Therefore, it&#x27;s important to use token identifier as one of the keys.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Redemption identifier, i.e. &lt;code&gt;_redemptionId&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Using &lt;code&gt;_redemptionId&lt;&#x2F;code&gt; as one of the keys enables NFT holders to redeem the same NFT to the same operator in multiple campaigns. For example, Operator-X has 2 campaigns, i.e. campaign A and campaign B, and both campaigns allow for MisterPunks NFTs to be redeemed for physical action figures. Holder of MisterPunk #7 is eligible for redemption in both campaigns and each redemption is recorded with the same &lt;code&gt;_operator&lt;&#x2F;code&gt; and &lt;code&gt;_tokenId&lt;&#x2F;code&gt;, but with different &lt;code&gt;_redemptionId&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The reference implementation of Multi-Redeemable NFT can be found &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6672&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;ERC6672.sol&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;An incorrect implementation of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6672&#x2F;&quot;&gt;ERC-6672&lt;&#x2F;a&gt; could potentially allow an unauthorized operator to access redemption flags owned by other operators, creating a security risk. As a result, an unauthorized operator could cancel the redemption process managed by other operators. Therefore, it is crucial for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6672&#x2F;&quot;&gt;ERC-6672&lt;&#x2F;a&gt; implementations to ensure that only the operator who created the redemption, identified using &lt;code&gt;msg.sender&lt;&#x2F;code&gt;, can update the redemption flag using the &lt;code&gt;redeem()&lt;&#x2F;code&gt; and &lt;code&gt;cancel()&lt;&#x2F;code&gt; functions. It is also recommended to isolate the &lt;code&gt;redeem()&lt;&#x2F;code&gt; and &lt;code&gt;cancel()&lt;&#x2F;code&gt; functions from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; approval models.&lt;&#x2F;p&gt;
&lt;p&gt;This &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6672&#x2F;&quot;&gt;ERC-6672&lt;&#x2F;a&gt; token is compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;, so wallets and smart contracts capable of storing and handling standard &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; tokens will not face the risk of asset loss caused by incompatible standard implementations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>P2P Escrowed Governance Incentives</title>
        <published>2023-02-15T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Josh Weintraub</name><uri>https://github.com/jhweintraub</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6506/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/escrowed-and-private-bribes-for-generalized-dao-voting/12694" />
        

        <id>https://wg-eips.ritovision.com/6506/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:6506"
            label="ERC-6506" />
        

        
        

        
        <summary type="html">Interface for building contracts that escrow funds based on an account taking action in a DAO</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6506/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The following EIP defines the interface for a contract that facilitates the exchange of a governance-incentive for users to vote in a designated direction on a DAO-proposal while escrowing funds until the vote can be verified.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;While a ton of effort has gone into building bribe systems for DAOs like Curve, Frax, Convex, etc., not a lot of focus has been put on how bribes on other, more general DAO votes, may affect outcomes. Bribes are a lucrative market on many popular DAO’s, and it stands to reason that people are willing to accept them for voting on other proposals, especially if they have no personal stake in the outcome. There are however, problems with current systems:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Current bribe schemes for votes based on pro-rata distribution are economically inefficient and result in worse outcomes for voters. For systems like Votium or Hidden-Hand, If Alice votes on a proposal with the expectation of receiving $10 in bribes, they can just be backrun by a larger voter, diluting their share of the pool. It may no longer be economical to make the decision they did. Using an OTC mechanisms is more efficient because the amount is “locked in” when the bribe is made and the recipient has much more concrete assurances on which to base their decision. These protocols are also centralized, relying on a central authority to accept and redistribute rewards fairly. Whenever possible, centralization should be avoided.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The lack of an existing standard means that parties are relying entirely on trust in one-another to obey. Bob has to trust Alice to pay out and Alice has to trust Bob to vote. Even if the two of them were to use an escrow contract, it may have flaws like relying on a trusted third-party, or simply that it is outside the technical reach of both parties.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;There are no mechanisms for creating transparency into the collusion of actors. Users colluding off-chain to sway the vote of a large token-holder creates opaque outcomes with no accountability since everything happens off-chain.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;For actors that wish to solicit incentives for their vote, this may require either active management, or the doxxing of their identity&#x2F;pseudonymous identifier. A user who wishes to negotiate would need to provide a way for incentivizers to contact them, engage in a negotiation process, write and deploy escrow contracts, vote, and then claim their reward. This is a lengthy and involved process that requires active management and communication. This creates a limit on who is able to solicit these incentives, and leads to the centralization of profit towards the few who can sustain this process at length.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Bribe Revenue as subsidies. As Vitalik wrote in a 2019 article, &lt;em&gt;On Collusion&lt;&#x2F;em&gt;, a potential solution would be a token that requires voters for a proposal to purchase the governance-token if the proposal-passes, subsidizing the cost of a bad decision for everyone else. If the revenue generated from these incentives is used (at least partly) to directly buy back those tokens by the treasury, then you get a similar outcome. The impact of a bad proposal being passed via-bribing is subsidized for everyone who didn&#x27;t vote for it by having some value returned to token-holders. This not only makes malicious bribes more costly, as it has to offset the value accrued via buyback, but also means higher profits for recipients.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;The key words &quot;BRIBE&quot; and &quot;INCENTIVE&quot; are to be interpreted as the transfer of a digital-asset(s) from user A to user B in exchange for an assurance that user B will vote in a specific-direction, on a specific proposal, for a specified-DAO. If user B does not honor the arrangement, the digital-asset(s) will be returned to user A.&lt;&#x2F;p&gt;
&lt;p&gt;The key words &quot;BRIBER&quot;, &quot;INCENTIVIZER&quot;, and &quot;SENDER&quot; shall refer to the user A offering monetary compensation to user B. &quot;RECIPIENT&quot;, &quot;VOTER&quot;, and &quot;INCENTIVIZEE&quot; herein refer to user B whom shall formally receive their compensation upon the termination of the agreement.&lt;&#x2F;p&gt;
&lt;p&gt;The key word &quot;VOTE&quot; shall be interpreted as the casting of a ballot in any kind of governance system which uses accounts as a form of permissions.&lt;&#x2F;p&gt;
&lt;p&gt;Contracts wishing to implement such a standard must implement the following interface&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IEscrowedGovIncentive&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; incentive&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; incentiveToken&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; incentivizer&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; proposalId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; direction&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;the keccak256 of the vote direction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint96&lt;&#x2F;span&gt;&lt;span&gt; deadline&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint96&lt;&#x2F;span&gt;&lt;span&gt; timestamp&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bool&lt;&#x2F;span&gt;&lt;span&gt; claimed&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; incentiveSent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; incentivizer&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; incentiveReclaimed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; incentivizer&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; modifiedClaimer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; claimer&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; direction&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; incentiveClaimed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; incentivizer&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; voter&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; incentiveId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; proofData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; disputeInitiated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; incentiveId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; plaintiff&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; defendant&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; disputeResolved&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; incentive&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; plaintiff&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; defendant&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; dismissed&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;Core mechanism&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; incentivize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; incentiveId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; incentiveInfo&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; claimIncentive&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; incentiveId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; reveal&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; reclaimIncentive&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; incentiveId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; reveal&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verifyVote&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; incentive&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; voteInfo&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; isVerifiable&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; proofData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; modifyClaimer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; claimer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; designation&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;Dispute Mechanism&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; beginDispute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; incentiveId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; disputeInfo&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; resolveDispute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; incentiveId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; disputeResolutionInfo&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; isDismissed&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;optional-implementation-details&quot;&gt;Optional Implementation Details&lt;&#x2F;h3&gt;
&lt;p&gt;Below are three potential implementation examples of the above system for different aspects.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;complete-transparency&quot;&gt;&lt;em&gt;Complete Transparency&lt;&#x2F;em&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;In this version all information about the vote direction, the amount, and the recipient are public at all times. Information is passed as calldata in plaintext and stored&#x2F;emitted as such.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;opacity-until-completion-ouc&quot;&gt;&lt;em&gt;Opacity until Completion (OUC)&lt;&#x2F;em&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;In this model, the recipient, the direction, and the amount are kept secret until the incentive is claimed. In this model, the data is committed to, and an encrypted version is passed as calldata. This data can be encrypted with the recipient&#x27;s public-key. It should be emitted as such which can then be decrypted off-chain by the recipient and used to make a determination on whether to oblige. In this model to ensure the privacy of transferring funds into escrow, the incentivizer could use methods such as deterministic-address-generation with the create2 opcode.&lt;&#x2F;p&gt;
&lt;p&gt;Upon the claiming of the bribe the recipient would simply open the commitment, which would then be checked on-chain and funds released.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;compatibility-with-off-chain-voting&quot;&gt;&lt;em&gt;Compatibility with Off-Chain Voting&lt;&#x2F;em&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Many DAO&#x27;s operate off-chain, typically through voting platforms like snapshot. This system does allow for such compatibility using known signature data. Consider the following example&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;User A commits an incentive to user B to vote on snapshot. User B votes.&lt;&#x2F;li&gt;
&lt;li&gt;Once the deadline has passed, a challenge window is initiated. The incentivizer has a predetermined window to demonstrate that the bribe was not honored. This can be done by simply passing to the contract a signature signed by User B voting in the opposite direction of the bribe. If the signature can be verified, then the arrangement was not honored and funds can be safely released back to user A.&lt;&#x2F;li&gt;
&lt;li&gt;If the challenge window concludes without A being able produce proof of noncompliance, then B is able to claim the reward. If B voted inline with the incentive, A will not be able to produce a valid signature of noncompliance. The challenge window with A demonstrating noncompliance is necesarry, because otherwise B could simply sign a message and not broadcast it, allowing them to claim the reward without voting.&lt;&#x2F;li&gt;
&lt;li&gt;In the event that B does NOT vote at all, then a special challenge period may be entered. Since B did not vote at all, A would not be able to produce the requisite proof, but B would still be able to claim the reward without complying. In this event, user A would have the option to enter a special dispute period. The details of this are determined by the contract implementation. This can include resolution by a trusted third-party, or other methods. An example includes using a merkle-root to show that B was not in the list of voters at the conclusion of the proposal. It should be considered making A present a&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;methods&quot;&gt;Methods&lt;&#x2F;h3&gt;
&lt;p&gt;While this EIP defines a struct &lt;em&gt;incentive&lt;&#x2F;em&gt;, &lt;code&gt;bytes memory&lt;&#x2F;code&gt; should be used whenever possible. Given as each DAO will have its own implementation details, interfaces, and signature data, this should then be decoded using &lt;code&gt;abi.decode()&lt;&#x2F;code&gt; and interpreted according to those known specifications.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;incentivize&quot;&gt;&lt;code&gt;incentivize&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The function where an incentivizer should commit to the details of their incentive. The commitment value can be calculated off-chain or calculated on-chain in a full transparency system. The function should take the input data from &lt;code&gt;incentiveInfo&lt;&#x2F;code&gt; and create store a new &lt;code&gt;incentive&lt;&#x2F;code&gt; object in the mapping incentives. If OUC is enabled, then only incentivizer and timestamp information need be public, everything else should be left as zero.&lt;&#x2F;p&gt;
&lt;p&gt;Function should account for fees taken from user at deposit. If fees are present, then &lt;code&gt;incentivize&lt;&#x2F;code&gt; should take them up front. This is to ensure that the amount quoted to a recipient is &lt;em&gt;at least&lt;&#x2F;em&gt; as much as they would receive.&lt;&#x2F;p&gt;
&lt;p&gt;MUST emit the &lt;code&gt;incentiveSent&lt;&#x2F;code&gt; event&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ncentivize&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; p&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ayable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ncentiveId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ytes32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ncentiveInfo&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ytes memory&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;claimincentive&quot;&gt;&lt;code&gt;claimIncentive&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Should be used by the intended recipient of a previously-committed incentive.&lt;&#x2F;p&gt;
&lt;p&gt;MUST revert if &lt;code&gt;msg.sender != original_recipient&lt;&#x2F;code&gt; and &lt;code&gt;!allowedClaimer[original_recipient][msg.sender]&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;MUST revert if the data provided in &lt;code&gt;reveal&lt;&#x2F;code&gt; does not match the data committed to by &lt;code&gt;incentiveId&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST revert if all funds committed to cannot be properly sent to &lt;code&gt;recipient&lt;&#x2F;code&gt; at conclusion of the function. If fees are present, then additional funds should be present at deposit to ensure that &lt;em&gt;at least&lt;&#x2F;em&gt; the amount committed to is sent to the user. This however, &lt;strong&gt;DOES NOT&lt;&#x2F;strong&gt; apply to any fees which may be taken by an approved claimer.&lt;&#x2F;p&gt;
&lt;p&gt;Ex: Alice commits to Bob an incentive 100 USDC. Bob has approved Eve to claim on his behalf in exchange for 5% of net value. Function should check that amount paid to Bob and Eve is &lt;code&gt;&amp;gt;=100 USDC&lt;&#x2F;code&gt; but &lt;strong&gt;NOT&lt;&#x2F;strong&gt; that Bob himself receives &lt;code&gt;&amp;gt;=100 USDC&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;MUST revert if the voting direction of the original recipient cannot be verified as being in line with the intended direction of &lt;code&gt;incentiveId&lt;&#x2F;code&gt;, and no dispute resolution process is defined.&lt;&#x2F;p&gt;
&lt;p&gt;MUST revert if the specified incentive has a pending dispute.&lt;&#x2F;p&gt;
&lt;p&gt;If verification is successful then funds should be sent to &lt;code&gt;recipient&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST emit the &lt;code&gt;incentiveClaimed&lt;&#x2F;code&gt; event if function does not revert.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;laimIncentive&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;onpayable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ncentiveId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ytes32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eveal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ytes memory&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ecipient&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress payable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;reclaimincentive&quot;&gt;&lt;code&gt;reclaimIncentive&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Function that should be invoked by the initial sender of &lt;code&gt;incentiveId&lt;&#x2F;code&gt; in the event that &lt;code&gt;recipient&lt;&#x2F;code&gt; did not vote in accordance with the incentive&#x27;s &lt;code&gt;direction&lt;&#x2F;code&gt;. Function should return the funds initially committed to by &lt;code&gt;incentiveId&lt;&#x2F;code&gt; to &lt;code&gt;incentivizer&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;MUST revert if all of the funds committed to cannot be returned to the incentivizer.&lt;&#x2F;p&gt;
&lt;p&gt;MUST revert if the function cannot successfully verify the validity of &lt;code&gt;msg.sender&lt;&#x2F;code&gt; claim of non-compliance.&lt;&#x2F;p&gt;
&lt;p&gt;MUST emit the event &lt;code&gt;incentiveReclaimed&lt;&#x2F;code&gt; if verification is successful. If proof can be retrieved on-chain, then the &lt;code&gt;proof&lt;&#x2F;code&gt; parameter may be left empty.&lt;&#x2F;p&gt;
&lt;p&gt;MUST revert if the specified incentive has a pending dispute.&lt;&#x2F;p&gt;
&lt;p&gt;If fees are taken, then all funds including any prepaid fees committed to should be returned to the &lt;code&gt;incentivizer&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eclaimIncentive&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;onpayable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ncentiveId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ytes32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eveal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ytes memory&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;verifyvote&quot;&gt;&lt;code&gt;verifyVote&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;function verifyVote(bytes32 incentive, bytes memory voteInfo) public view returns (bool isVerifiable);&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Function used to determine if the voter for &lt;code&gt;incentive&lt;&#x2F;code&gt; should receive the incentive originally committed to.&lt;&#x2F;p&gt;
&lt;p&gt;Functions may use whatever scheme they like to determine this information. Necessary data should be encoded and passed through &lt;code&gt;voteInfo&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST return &lt;code&gt;false&lt;&#x2F;code&gt; if &lt;code&gt;voteInfo&lt;&#x2F;code&gt; indicates that &lt;code&gt;recipient&lt;&#x2F;code&gt; did not vote in the direction committed to by &lt;code&gt;incentive&lt;&#x2F;code&gt;, and true otherwise.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;erifyVote&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ncentiveId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ytes32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;oteInfo&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ytes memory&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;sVerified&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ool&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; p&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;roofData&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ytes memory&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;modifyclaimer&quot;&gt;&lt;code&gt;modifyClaimer&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Function changing the designation of an address as being approved to claim a bribe on behalf of another user. Only an approved claimer should be able to claim the incentive on behalf of the user which approved them.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; m&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;odifyClaimer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;onpayable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;laimer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; d&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;esignation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ool&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;begindispute&quot;&gt;&lt;code&gt;beginDispute&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;A function used to initiate the resolution of an incentive through an optional dispute-mechanism. At the discretion of the developers, and based on the specifics of the vote-verification mechanism in which a voting direction cannot be conclusively decided, the developers may opt for an additional mechanism to resolve dispute between parties. This may include third-party intervention, additional cryptographic evidence, etc. needed to determine whether to pay out rewards to &lt;code&gt;recipient&lt;&#x2F;code&gt; or return them to the &lt;code&gt;incentivizer&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Potential Examples requiring additional dispute mechanisms:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Requiring a trusted third-party to resolve disputes.&lt;&#x2F;li&gt;
&lt;li&gt;The recipient did not vote in an off-chain proposal, and additional off-chain information is needed to confirm.&lt;&#x2F;li&gt;
&lt;li&gt;An additional unlocking mechanism is required to access previously deposited funds.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Dispute mechanisms may optionally choose to require a bond from the filer to prevent frivolous filings, to be returned to them on successful resolution of the dispute in their favor.&lt;&#x2F;p&gt;
&lt;p&gt;Must emit the event &lt;code&gt;disputeInitiated&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Once a dispute for a given incentive has been filed, neither the &lt;code&gt;incentivizer&lt;&#x2F;code&gt; nor &lt;code&gt;recipient&lt;&#x2F;code&gt; should be able to withdraw funds until completed.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eginDispute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; p&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ayable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ncentiveId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ytes32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; d&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;isputeInfo&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ytes memory&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;resolvedispute&quot;&gt;&lt;code&gt;resolveDispute&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;A function which is used to resolve pending disputes over &lt;code&gt;incentiveId&lt;&#x2F;code&gt;. The exact mechanism shall be specified by the developers.&lt;&#x2F;p&gt;
&lt;p&gt;MUST return false, and be &lt;em&gt;&quot;dismissed&quot;&lt;&#x2F;em&gt;, if the mechanisms resolves the dispute in favor of the defendant &lt;code&gt;(recipient)&lt;&#x2F;code&gt;, by showing they did honor the incentive of &lt;code&gt;incentiveId&lt;&#x2F;code&gt;. If the dispute is &lt;em&gt;&quot;confirmed&quot;&lt;&#x2F;em&gt;, then the function should return true.&lt;&#x2F;p&gt;
&lt;p&gt;MUST transfer funds committed to by &lt;code&gt;incentivizer&lt;&#x2F;code&gt; to &lt;code&gt;recipient&lt;&#x2F;code&gt; if dispute is &lt;code&gt;dismissed&lt;&#x2F;code&gt; and return &lt;code&gt;funds + fee + bond&lt;&#x2F;code&gt; to the &lt;code&gt;plaintiff&lt;&#x2F;code&gt;. If dismissed, the distribution of the bond shall be at the discretion of the developers. This may including burning, awarding to the defendant, or donating to a community treasury.&lt;&#x2F;p&gt;
&lt;p&gt;MUST emit the event &lt;code&gt;disputeResolved&lt;&#x2F;code&gt; on successful resolution.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;esolveDispute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;onPayable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ncentiveId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ytes32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; d&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;isputeResolutionInfo&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ytes memory&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ame isDismissed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ool&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;events&quot;&gt;Events&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;incentivesent&quot;&gt;&lt;code&gt;incentiveSent&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;incentivizer&lt;&#x2F;code&gt; has bribed &lt;code&gt;recipient&lt;&#x2F;code&gt; &lt;code&gt;amount&lt;&#x2F;code&gt; of &lt;code&gt;token&lt;&#x2F;code&gt; for some information.&lt;&#x2F;p&gt;
&lt;p&gt;If system is private then recipient, amount, and &lt;code&gt;token&lt;&#x2F;code&gt; may be left as zero.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ncentiveSent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;vent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ame incentivizer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;oken&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;mount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ecipient&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;incentiveclaimed&quot;&gt;&lt;code&gt;incentiveClaimed&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;recipient&lt;&#x2F;code&gt; claimed an incentive &lt;code&gt;amount&lt;&#x2F;code&gt; of &lt;code&gt;token&lt;&#x2F;code&gt; and any other data relevant.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ncentiveClaimed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;vent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ecipient&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;oken&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;mount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; d&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;modifiedclaimer&quot;&gt;&lt;code&gt;modifiedClaimer&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;A new &lt;code&gt;claimer&lt;&#x2F;code&gt; was either whitelisted by &lt;code&gt;recipient&lt;&#x2F;code&gt; or blacklisted.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; m&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;odifiedClaimer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;vent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ecipient&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;laimer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; d&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;irection&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ool&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;incentivereclaimed&quot;&gt;&lt;code&gt;incentiveReclaimed&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;An &lt;code&gt;incentivizer&lt;&#x2F;code&gt; is reclaiming &lt;code&gt;incentiveId&lt;&#x2F;code&gt;, and outing the noncompliance of &lt;code&gt;voter&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ncentiveReclaimed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;vent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ncentivizer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;oter&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ncentiveId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ytes32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; p&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;roofData&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;disputeinitiated&quot;&gt;&lt;code&gt;disputeInitiated&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;incentivizer&lt;&#x2F;code&gt; has initiated a dispute with &lt;code&gt;plaintiff&lt;&#x2F;code&gt; over &lt;code&gt;incentiveId&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; d&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;isputeInitiated&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;vent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ncentiveId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ytes32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; p&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;laintiff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; d&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;efendant&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;disputeresolved&quot;&gt;&lt;code&gt;disputeResolved&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The dispute over &lt;code&gt;incentiveId&lt;&#x2F;code&gt; has been resolved, either &lt;code&gt;dismissed&lt;&#x2F;code&gt; in favor of &lt;code&gt;defendant&lt;&#x2F;code&gt; or resolved in favor of the &lt;code&gt;plaintiff&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; d&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;isputeResolved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;vent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ncentiveId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ytes32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; p&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;laintiff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; d&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;efendant&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; d&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ismissed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ool&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This design was motivated by a few factors:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;The issue of offering incentives for votes is an inevitability. There is no mechanism that can prevent users from colluding off-chain to vote a certain direction, and with enough obfuscation, can be completely hidden from the community&#x27;s view. The solution is therefore to realign the incentives of these actors in a way that both creates transparency, while allowing for the decentralization of bribe-revenue. Flashbots is a relevant example. Since MEV could not be prevented, the solution was to make it more fairly distributed by incentivizing miners to use Flashbots-Geth with profits. Using an OTC market structure would have the same effect, allowing anyone to reap the benefits of a potential incentive while also creating a more efficient marketplace.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Injecting transparency about whom is bribing whom for what increases both fairness and profitability. This makes it possible for the community to organize around potential solutions. Ex: Alice pays Bob $10 for his 1k votes in the DAO. This is now known on-chain and next time someone who cares about the outcome can offer Bob $11 for the votes. This maximizes profit to the recipient.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;strong&gt;Implementations should operate similar to the following example:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Alice wants to give bob $10 to vote YES on DAO proposal #420. She wants an assurance he will do it and gets the money back if he doesn’t&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;It should work as an escrow service for both on-chain and snapshot based voting, releasing funds only after the vote has concluded, and it can be verified the recipient voted in line with the vote. It should be done without requiring a trusted third-party to escrow and release the funds themselves.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;This EIP makes no discernment about the nature in which this information is relayed to the recipient. Implementation details are at the discretion of the protocol. This includes the optional decisions to enable privacy for both the recipient and the amount. Information on how this can be implemented is below. Once the vote has occurred, then the contents of the bribe can be claimed, pending verification. This verification should satisfy both soundness and completeness, that only after the user can show they did vote in line with the incentive do they receive the funds, and that such proof cannot be forged or misleading in any way.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;strong&gt;Factors to consider&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;To remedy the problem of diluted rewards, the system uses a simple hash-based commitment scheme. When an incentive is sent, its data is committed to, and revealed when withdrawn.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Once a bribe is committed to, it cannot be withdrawn until after the voting period for the proposal has concluded. This is to ensure the legitimacy of the escrow, so that user A cannot withdraw the bribe after B has voted, but before they can claim the reward.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;potential-ethical-issues&quot;&gt;Potential Ethical Issues&lt;&#x2F;h3&gt;
&lt;p&gt;Potential ethical issues have been raised about the prospect of potentially encouraging users to accept monetary payment for their vote. This is the wrong frame of reference. The question is not whether it is ethical to encourage users to send&#x2F;solicit, but rather the consequences of doing nothing. Returning to the flashbots example, the question is not whether MEV is ethical, but repercussions of allowing it to flourish without pushback.&lt;&#x2F;p&gt;
&lt;p&gt;If nothing is done, the following outcomes are possible:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Flywheel Effect - Only dedicated and financially endowed holders will solicit incentives with impunity. This centralization of profit allows them to purchase more voting-rights, increasing power and so on until they have accumulated a critical mass, exerting potentially harmful influence over operations. This can range anywhere from minor operational decisions, to votes over treasury resolution.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Lack of transparency - Decisionmaking will occur behind closed doors as the true intentions of voters is unclear, and votes that should pass may fail, or vice-versa. The will of the community will not be honored.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is intended to work with existing governance systems. Any potential issue with existing governance may represent a potential attack on this as well. This includes voting-weight manipulation, vote forgery, verification discrepancies etc. All systems in which this EIP is integrated with should be properly audited for maximum security, as any issues may result in improper distribution of these governance incentives.&lt;&#x2F;p&gt;
&lt;p&gt;Potential implementations of this system may rely on complex cryptographic operations as well. This may include proper implementation of digital-signatures to prevent replay attacks, or correctness requirements of SNARK proofs. These features may be &lt;strong&gt;non-trivial&lt;&#x2F;strong&gt; and thus require special care to ensure they are implemented and configured securely, otherwise features like confidentiality may be violated.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Signature Validation for Predeploy Contracts</title>
        <published>2023-02-10T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Ivo Georgiev</name><uri>https://github.com/Ivshti</uri>
	</author>
	
	<author>
		<name>Agustin Aguilar</name><uri>https://github.com/Agusx1211</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6492/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6492-signature-validation-for-pre-deploy-contracts/12903" />
        

        <id>https://wg-eips.ritovision.com/6492/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:6492"
            label="ERC-6492" />
        

        
        

        
        <summary type="html">A way to verify a signature when the account is a smart contract that has not been deployed yet</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6492/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Contracts can sign verifiable messages via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;ERC-1271&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;However, if the contract is not deployed yet, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;ERC-1271&lt;&#x2F;a&gt; verification is impossible, as you can&#x27;t call the &lt;code&gt;isValidSignature&lt;&#x2F;code&gt; function on said contract.&lt;&#x2F;p&gt;
&lt;p&gt;We propose a standard way for any contract or off-chain actor to verify whether a signature on behalf of a given counterfactual contract (that is not deployed yet) is valid. This standard way extends &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;ERC-1271&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;With the rising popularity of account abstraction, we often find that the best user experience for contract wallets is to defer contract deployment until the first user transaction, therefore not burdening the user with an additional deploy step before they can use their account. However, at the same time, many dApps expect signatures, not only for interactions, but also just for logging in.&lt;&#x2F;p&gt;
&lt;p&gt;As such, contract wallets have been limited in their ability to sign messages before their de-facto deployment, which is often done on the first transaction.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore, not being able to sign messages from counterfactual contracts has always been a limitation of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;ERC-1271&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;The words &quot;validation&quot; and &quot;verification&quot; are used interchangeably.&lt;&#x2F;p&gt;
&lt;p&gt;Quoting &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;ERC-1271&lt;&#x2F;a&gt;,&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;isValidSignature&lt;&#x2F;code&gt; can call arbitrary methods to validate a given signature, which could be context dependent (e.g. time based or state based), EOA dependent (e.g. signers authorization level within smart wallet), signature scheme Dependent (e.g. ECDSA, multisig, BLS), etc.&lt;&#x2F;p&gt;
&lt;p&gt;This function should be implemented by contracts which desire to sign messages (e.g. smart contract wallets, DAOs, multisignature wallets, etc.) Applications wanting to support contract signatures should call this method if the signer is a contract.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;We use the same &lt;code&gt;isValidSignature&lt;&#x2F;code&gt; function, but we add a new wrapper signature format, that signing contracts MAY use before they&#x27;re deployed, in order to allow support for verification.&lt;&#x2F;p&gt;
&lt;p&gt;The signature verifier MUST perform a contract deployment before attempting to call &lt;code&gt;isValidSignature&lt;&#x2F;code&gt; if the wrapper signature format is detected.&lt;&#x2F;p&gt;
&lt;p&gt;The wrapper format is detected by checking if the signature ends in &lt;code&gt;magicBytes&lt;&#x2F;code&gt;, which MUST be defined as &lt;code&gt;0x6492649264926492649264926492649264926492649264926492649264926492&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;It is RECOMMENDED to use this ERC with CREATE2 contracts, as their deploy address is always predictable.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;signer-side&quot;&gt;Signer side&lt;&#x2F;h3&gt;
&lt;p&gt;The signing contract will normally be a contract wallet, but it could be any contract that implements &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;ERC-1271&lt;&#x2F;a&gt; and is deployed counterfactually.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If the contract is deployed, produce a normal &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;ERC-1271&lt;&#x2F;a&gt; signature&lt;&#x2F;li&gt;
&lt;li&gt;If the contract is not deployed yet, wrap the signature as follows: &lt;code&gt;concat(abi.encode((create2Factory, factoryCalldata, originalERC1271Signature), (address, bytes, bytes)), magicBytes)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;If the contract is deployed but not ready to verify using &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;ERC-1271&lt;&#x2F;a&gt;, wrap the signature as follows: &lt;code&gt;concat(abi.encode((prepareTo, prepareData, originalERC1271Signature), (address, bytes, bytes)), magicBytes)&lt;&#x2F;code&gt;; &lt;code&gt;prepareTo&lt;&#x2F;code&gt; and &lt;code&gt;prepareData&lt;&#x2F;code&gt; must contain the necessary transaction that will make the contract ready to verify using &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;ERC-1271&lt;&#x2F;a&gt; (e.g. a call to &lt;code&gt;migrate&lt;&#x2F;code&gt; or &lt;code&gt;update&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note that we&#x27;re passing &lt;code&gt;factoryCalldata&lt;&#x2F;code&gt; instead of &lt;code&gt;salt&lt;&#x2F;code&gt; and &lt;code&gt;bytecode&lt;&#x2F;code&gt;. We do this in order to make verification compliant with any factory interface. We do not need to calculate the address based on  &lt;code&gt;create2Factory&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;salt&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;bytecode&lt;&#x2F;code&gt;, because &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;ERC-1271&lt;&#x2F;a&gt; verification presumes we already know the account address we&#x27;re verifying the signature for.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;verifier-side&quot;&gt;Verifier side&lt;&#x2F;h3&gt;
&lt;p&gt;Full signature verification MUST be performed in the following order:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;check if the signature ends with magic bytes, in which case do an &lt;code&gt;eth_call&lt;&#x2F;code&gt; to a multicall contract that will call the factory first with the &lt;code&gt;factoryCalldata&lt;&#x2F;code&gt; and deploy the contract if it isn&#x27;t already deployed; Then, call &lt;code&gt;contract.isValidSignature&lt;&#x2F;code&gt; as usual with the unwrapped signature&lt;&#x2F;li&gt;
&lt;li&gt;check if there&#x27;s contract code at the address. If so perform &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;ERC-1271&lt;&#x2F;a&gt; verification as usual by invoking &lt;code&gt;isValidSignature&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;if the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;ERC-1271&lt;&#x2F;a&gt; verification fails, and the deploy call to the &lt;code&gt;factory&lt;&#x2F;code&gt; was skipped due to the wallet already having code, execute the &lt;code&gt;factoryCalldata&lt;&#x2F;code&gt; transaction and try &lt;code&gt;isValidSignature&lt;&#x2F;code&gt; again&lt;&#x2F;li&gt;
&lt;li&gt;if there is no contract code at the address, try &lt;code&gt;ecrecover&lt;&#x2F;code&gt; verification&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;We believe that wrapping the signature in a way that allows to pass the deploy data is the only clean way to implement this, as it&#x27;s completely contract agnostic, but also easy to verify.&lt;&#x2F;p&gt;
&lt;p&gt;The wrapper format ends in &lt;code&gt;magicBytes&lt;&#x2F;code&gt;, which ends with a &lt;code&gt;0x92&lt;&#x2F;code&gt;, which makes it is impossible for it to collide with a valid &lt;code&gt;ecrecover&lt;&#x2F;code&gt; signature if packed in the &lt;code&gt;r,s,v&lt;&#x2F;code&gt; format, as &lt;code&gt;0x92&lt;&#x2F;code&gt; is not a valid value for &lt;code&gt;v&lt;&#x2F;code&gt;. To avoid collisions with normal &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;ERC-1271&lt;&#x2F;a&gt;, &lt;code&gt;magicBytes&lt;&#x2F;code&gt; itself is also quite long (&lt;code&gt;bytes32&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;The order to ensure correct verification is based on the following rules:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;checking for &lt;code&gt;magicBytes&lt;&#x2F;code&gt; MUST happen before the usual &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;ERC-1271&lt;&#x2F;a&gt; check in order to allow counterfactual signatures to be valid even after contract deployment&lt;&#x2F;li&gt;
&lt;li&gt;checking for &lt;code&gt;magicBytes&lt;&#x2F;code&gt; MUST happen before &lt;code&gt;ecrecover&lt;&#x2F;code&gt; in order to avoid trying to verify a counterfactual contract signature via &lt;code&gt;ecrecover&lt;&#x2F;code&gt; if such is clearly identifiable&lt;&#x2F;li&gt;
&lt;li&gt;checking &lt;code&gt;ecrecover&lt;&#x2F;code&gt; MUST NOT happen before &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;ERC-1271&lt;&#x2F;a&gt; verification, because a contract may use a signature format that also happens to be a valid &lt;code&gt;ecrecover&lt;&#x2F;code&gt; signature for an EOA with a different address. One such example is a contract that&#x27;s a wallet controlled by said EOA.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;We can&#x27;t determine the reason why a signature was encoded with a &quot;deploy prefix&quot; when the corresponding wallet already has code. It could be due to the signature being created before the contract was deployed, or it could be because the contract was deployed but not ready to verify signatures yet. As such, we need to try both options.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC is backward compatible with previous work on signature validation, including &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;ERC-1271&lt;&#x2F;a&gt; and allows for easy verification of all signature types, including EOA signatures and typed data (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt;).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;using-erc-6492-for-regular-contract-signatures&quot;&gt;Using &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6492&#x2F;&quot;&gt;ERC-6492&lt;&#x2F;a&gt; for regular contract signatures&lt;&#x2F;h3&gt;
&lt;p&gt;The wrapper format described in this ERC can be used for all contract signatures, instead of plain &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;ERC-1271&lt;&#x2F;a&gt;. This provides several advantages:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;allows quick recognition of the signature type: thanks to the magic bytes, you can immediately know whether the signature is a contract signature without checking the blockchain&lt;&#x2F;li&gt;
&lt;li&gt;allows recovery of address: you can get the address only from the signature using &lt;code&gt;create2Factory&lt;&#x2F;code&gt; and &lt;code&gt;factoryCalldata&lt;&#x2F;code&gt;, just like &lt;code&gt;ecrecover&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Below you can find an implementation of a universal verification contract that can be used both on-chain and off-chain, intended to be deployed as a singleton. It can validate signatures signed with this ERC, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;ERC-1271&lt;&#x2F;a&gt; and traditional &lt;code&gt;ecrecover&lt;&#x2F;code&gt;. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; is also supported by extension, as we validate the final digest (&lt;code&gt;_hash&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; As per ERC-1271&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC1271Wallet&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isValidSignature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; magicValue&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC1271Revert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; error&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC6492DeployFailed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; error&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UniversalSigValidator&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; ERC6492_DETECTION_SUFFIX &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x6492649264926492649264926492649264926492649264926492649264926492&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; ERC1271_SUCCESS &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x1626ba7e&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isValidSigImpl&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _signer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; allowSideEffects&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tryPrepare&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint&lt;&#x2F;span&gt;&lt;span&gt; contractCodeLen &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_signer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; sigToValidate&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The order here is strictly defined in https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-6492&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - ERC-6492 suffix check and verification first, while being permissive in case the contract is already deployed; if the contract is deployed we will check the sig against the deployed version, this allows 6492 signatures to still be validated while taking into account potential key rotation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - ERC-1271 verification if there&amp;#39;s contract code&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - finally, ecrecover&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bool&lt;&#x2F;span&gt;&lt;span&gt; isCounterfactual &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_signature&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt;_signature&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; ERC6492_DETECTION_SUFFIX&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;isCounterfactual&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      address&lt;&#x2F;span&gt;&lt;span&gt; create2Factory&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; factoryCalldata&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      (&lt;&#x2F;span&gt;&lt;span&gt;create2Factory&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; factoryCalldata&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; sigToValidate&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;decode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt;_signature&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;contractCodeLen &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span&gt; tryPrepare&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt; success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; err&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; create2Factory&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;factoryCalldata&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC6492DeployFailed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;err&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      sigToValidate &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _signature&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Try ERC-1271 verification&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;isCounterfactual &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span&gt; contractCodeLen &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      try&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC1271Wallet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_signer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isValidSignature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; sigToValidate&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; magicValue&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span&gt; isValid &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; magicValue &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; ERC1271_SUCCESS&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; retry, but this time assume the prefix is a prepare call&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;isValid &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !&lt;&#x2F;span&gt;&lt;span&gt;tryPrepare &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; contractCodeLen &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;          return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isValidSigImpl&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_signer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; allowSideEffects&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;contractCodeLen &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; isCounterfactual &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !&lt;&#x2F;span&gt;&lt;span&gt;allowSideEffects&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;          &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if the call had side effects we need to return the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;          &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; result using a `revert` (to undo the state changes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;          assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;           mstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; isValid&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;           revert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;31&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; isValid&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; catch&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; err&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; retry, but this time assume the prefix is a prepare call&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;tryPrepare &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; contractCodeLen &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;          return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isValidSigImpl&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_signer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; allowSideEffects&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC1271Revert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;err&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ecrecover verification&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_signature&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 65&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;#39;SignatureValidator#recoverSigner: invalid signature length&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; r &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; s &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;64&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint8&lt;&#x2F;span&gt;&lt;span&gt; v &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint8&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;64&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;v &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 27&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; v &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 28&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      revert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;#39;SignatureValidator: invalid signature v value&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; ecrecover&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; s&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; _signer&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isValidSigWithSideEffects&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _signer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isValidSigImpl&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_signer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isValidSig&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _signer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    try&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isValidSigImpl&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_signer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; isValid&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span&gt; isValid&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    catch&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; error&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; in order to avoid side effects from the contract getting deployed, the entire call will revert with a single byte result&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      uint&lt;&#x2F;span&gt;&lt;span&gt; len &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; error&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;len &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; error&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x01&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; all other errors are simply forwarded, but in custom formats so that nothing else can revert with a single byte in the call&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      else&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; revert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;error&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; len&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; this is a helper so we can perform validation in a single eth_call without pre-deploying a singleton&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ValidateSigOffchain&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  constructor&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _signer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    UniversalSigValidator validator &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UniversalSigValidator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bool&lt;&#x2F;span&gt;&lt;span&gt; isValidSig &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; validator&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isValidSigWithSideEffects&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_signer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      mstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; isValidSig&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      return&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;31&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;on-chain-validation&quot;&gt;On-chain validation&lt;&#x2F;h3&gt;
&lt;p&gt;For on-chain validation, you could use two separate methods:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;UniversalSigValidator.isValidSig(_signer, _hash, _signature)&lt;&#x2F;code&gt;: returns a bool of whether the signature is valid or not; this is reentrancy-safe&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;UniversalSigValidator.isValidSigWithSideEffects(_signer, _hash, _signature)&lt;&#x2F;code&gt;: this is equivalent to the former - it is not reentrancy-safe but it is more gas-efficient in certain cases&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Both methods may revert if the underlying calls revert.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;off-chain-validation&quot;&gt;Off-chain validation&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;ValidateSigOffchain&lt;&#x2F;code&gt; helper allows you to perform the universal validation in one &lt;code&gt;eth_call&lt;&#x2F;code&gt;, without any pre-deployed contracts.&lt;&#x2F;p&gt;
&lt;p&gt;Here&#x27;s example of how to do this with the &lt;code&gt;ethers&lt;&#x2F;code&gt; library:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; isValidSignature&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ===&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; provider&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ethers&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;utils&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;concat&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    validateSigOffchainBytecode&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ethers&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;utils&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;AbiCoder&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;You may also use a library to perform the universal signature validation, such as Ambire&#x27;s &lt;code&gt;signature-validator&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The same considerations as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;ERC-1271&lt;&#x2F;a&gt; apply.&lt;&#x2F;p&gt;
&lt;p&gt;However, deploying a contract requires a &lt;code&gt;CALL&lt;&#x2F;code&gt; rather than a &lt;code&gt;STATICCALL&lt;&#x2F;code&gt;, which introduces reentrancy concerns. This is mitigated in the reference implementation by having the validation method always revert if there are side-effects, and capturing its actual result from the revert data. For use cases where reentrancy is not a concern, we have provided the &lt;code&gt;isValidSigWithSideEffects&lt;&#x2F;code&gt; method.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore, it is likely that this ERC will be more frequently used for off-chain validation, as in many cases, validating a signature on-chain presumes the wallet has been already deployed.&lt;&#x2F;p&gt;
&lt;p&gt;One out-of-scope security consideration worth mentioning is whether the contract is going to be set-up with the correct permissions at deploy time, in order to allow for meaningful signature verification. By design, this is up to the implementation, but it&#x27;s worth noting that thanks to how CREATE2 works, changing the bytecode or contructor callcode in the signature will not allow you to escalate permissions as it will change the deploy address and therefore make verification fail.&lt;&#x2F;p&gt;
&lt;p&gt;It must be noted that contract accounts can dynamically change their methods of authentication. This issue is mitigated by design in this EIP - even when validating counterfactual signatures, if the contract is already deployed, we will still call it, checking against the current live version of the contract.&lt;&#x2F;p&gt;
&lt;p&gt;As per usual with signatures, replay protection should be implemented in most use cases. This proposal adds an extra dimension to this, because it may be possible to validate a signature that has been rendered invalid (by changing the authorized keys) on a different network as long as 1) the signature was valid at the time of deployment 2) the wallet can be deployed with the same factory address&#x2F;bytecode on this different network.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>SSZ Optional</title>
        <published>2023-02-09T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Etan Kissling</name><uri>https://github.com/etan-status</uri>
	</author>
	
	<author>
		<name>Zahary Karadjov</name><uri>https://github.com/zah</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6475/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6475-ssz-optional/12891" />
        

        <id>https://wg-eips.ritovision.com/6475/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:6475"
            label="EIP-6475" />
        

        
        

        
        <summary type="html">New SSZ type to represent optional values</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6475/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a new &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;67c2f9ee9eb562f7cc02b2ff90d92c56137944e1&#x2F;ssz&#x2F;simple-serialize.md&quot;&gt;Simple Serialize (SSZ) type&lt;&#x2F;a&gt; to represent &lt;code&gt;Optional[T]&lt;&#x2F;code&gt; values.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Optional values are currently only representable in SSZ using workarounds. Adding proper support provides these benefits:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Better readability:&lt;&#x2F;strong&gt; SSZ structures with optional values can be represented with idiomatic types of the underlying programming language, e.g., &lt;code&gt;Optional[T]&lt;&#x2F;code&gt; in Python, making them easier to interact with.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Compact serialization:&lt;&#x2F;strong&gt; SSZ serialization can rely on the binary nature of optional values; they either exist or they don&#x27;t. This allows more compact serialization than using alternative approaches based on workarounds.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;type-definition&quot;&gt;Type definition&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;Optional[T]&lt;&#x2F;code&gt; is defined as a type that can represent:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A value of SSZ type &lt;code&gt;T&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Absence of a value, indicated by &lt;code&gt;None&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;default-value&quot;&gt;Default value&lt;&#x2F;h3&gt;
&lt;p&gt;The default value of &lt;code&gt;Optional[T]&lt;&#x2F;code&gt; is &lt;code&gt;None&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;serialization&quot;&gt;Serialization&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\x01&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; serialize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;deserialization&quot;&gt;Deserialization&lt;&#x2F;h3&gt;
&lt;p&gt;The deserialization of an &lt;code&gt;Optional[T]&lt;&#x2F;code&gt; depends on the input length:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If the input length is 0, the value is &lt;code&gt;None&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Otherwise, the first byte of the deserialization scope must be checked to be &lt;code&gt;0x01&lt;&#x2F;code&gt;, the remainder of the scope is deserialized same as &lt;code&gt;T&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;merkleization&quot;&gt;Merkleization&lt;&#x2F;h3&gt;
&lt;p&gt;An &lt;code&gt;Optional[T]&lt;&#x2F;code&gt; is merkleized as a &lt;code&gt;List[T, 1]&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If the value is &lt;code&gt;None&lt;&#x2F;code&gt;, the list length is &lt;code&gt;0&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Otherwise, the list length is &lt;code&gt;1&lt;&#x2F;code&gt;, and the first list element contains the underlying value.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-not-union-none-t&quot;&gt;Why not &lt;code&gt;Union[None, T]&lt;&#x2F;code&gt;?&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;Union[None, T]&lt;&#x2F;code&gt; leaves ambiguity about the intention whether the type may be extended in the future, i.e., &lt;code&gt;Union[None, T, U]&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore, SSZ Union types are currently not used in any final Ethereum specification and do not have a finalized design themselves. If the only use case is a workaround for lack of &lt;code&gt;Optional[T]&lt;&#x2F;code&gt;, the simpler &lt;code&gt;Optional[T]&lt;&#x2F;code&gt; type is sufficient, and support for general unions could be delayed until really needed. Note that the design of &lt;code&gt;Optional[T]&lt;&#x2F;code&gt; could be used as basis for a more general &lt;code&gt;Union&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-not-list-t-1&quot;&gt;Why not &lt;code&gt;List[T, 1]&lt;&#x2F;code&gt;?&lt;&#x2F;h3&gt;
&lt;p&gt;The serialization is less compact for variable-length &lt;code&gt;T&lt;&#x2F;code&gt;, due to the extra offset table at the beginning of the list to indicate the list length.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;Union[None, T]&lt;&#x2F;code&gt; and &lt;code&gt;List[T, 1]&lt;&#x2F;code&gt; workarounds are not used at this time to represent &lt;code&gt;Optional[T]&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6475&#x2F;.&#x2F;assets&#x2F;tests.py&quot;&gt;EIP assets&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Python:&lt;&#x2F;strong&gt; See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6475&#x2F;.&#x2F;assets&#x2F;optional.py&quot;&gt;EIP assets&lt;&#x2F;a&gt;, based on &lt;code&gt;protolambda&#x2F;remerkleable&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Nim:&lt;&#x2F;strong&gt; &lt;code&gt;status-im&#x2F;nim-ssz-serialization&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;None&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>SSZ withdrawals root</title>
        <published>2023-02-08T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Etan Kissling</name><uri>https://github.com/etan-status</uri>
	</author>
	
	<author>
		<name>Mikhail Kalinin</name><uri>https://github.com/mkalinin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6465/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6465-ssz-withdrawals-root/12883" />
        

        <id>https://wg-eips.ritovision.com/6465/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:6465"
            label="EIP-6465" />
        

        
        

        
        <summary type="html">Migration of withdrawals MPT commitment to SSZ</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6465/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP defines a migration process of the existing Merkle Patricia Trie (MPT) commitment for withdrawals to &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;ssz&#x2F;simple-serialize.md&quot;&gt;Simple Serialize (SSZ)&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;While the consensus &lt;code&gt;ExecutionPayloadHeader&lt;&#x2F;code&gt; and the execution block header map to each other conceptually, they are encoded differently. This EIP aims to align the encoding of the &lt;code&gt;withdrawals_root&lt;&#x2F;code&gt;, taking advantage of the more modern SSZ format. This brings several advantages:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Reducing complexity:&lt;&#x2F;strong&gt; The proposed design reduces the number of use cases that require support for Merkle Patricia Trie (MPT).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Reducing ambiguity:&lt;&#x2F;strong&gt; The name &lt;code&gt;withdrawals_root&lt;&#x2F;code&gt; is currently used to refer to different roots. While the execution block header refers to a Merkle Patricia Trie (MPT) root, the consensus &lt;code&gt;ExecutionPayloadHeader&lt;&#x2F;code&gt; instead refers to an SSZ root. With these changes, &lt;code&gt;withdrawals_root&lt;&#x2F;code&gt; consistently refers to the same SSZ root.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;existing-definitions&quot;&gt;Existing definitions&lt;&#x2F;h3&gt;
&lt;p&gt;Definitions from existing specifications that are used throughout this document are replicated here for reference.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;SSZ equivalent&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#custom-types&quot;&gt;&lt;code&gt;ValidatorIndex&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint64&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#custom-types&quot;&gt;&lt;code&gt;Gwei&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint64&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;bellatrix&#x2F;beacon-chain.md#custom-types&quot;&gt;&lt;code&gt;ExecutionAddress&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;Bytes20&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;capella&#x2F;beacon-chain.md#custom-types&quot;&gt;&lt;code&gt;WithdrawalIndex&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint64&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;withdrawals&quot;&gt;Withdrawals&lt;&#x2F;h3&gt;
&lt;p&gt;New withdrawals use a normalized SSZ representation. The existing consensus &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;capella&#x2F;beacon-chain.md#withdrawal&quot;&gt;&lt;code&gt;Withdrawal&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; SSZ container is migrated to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7495&#x2F;&quot;&gt;EIP-7495 &lt;code&gt;ProgressiveContainer&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Withdrawal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    index&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; WithdrawalIndex&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    validator_index&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ValidatorIndex&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    amount&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Gwei&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;execution-block-header-changes&quot;&gt;Execution block header changes&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;devp2p&#x2F;blob&#x2F;bc76b9809a30e6dc5c8dcda996273f0f9bcf7108&#x2F;caps&#x2F;eth.md#block-encoding-and-validity&quot;&gt;execution block header&#x27;s &lt;code&gt;withdrawals-root&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; is transitioned from MPT to SSZ.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;withdrawals&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Withdrawal&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    withdrawal_0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; withdrawal_1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; withdrawal_2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ...&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;block_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;withdrawals_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; withdrawals&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;hash_tree_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;consensus-executionpayload-changes&quot;&gt;Consensus &lt;code&gt;ExecutionPayload&lt;&#x2F;code&gt; changes&lt;&#x2F;h3&gt;
&lt;p&gt;When building a consensus &lt;code&gt;ExecutionPayload&lt;&#x2F;code&gt;, the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;deneb&#x2F;beacon-chain.md#executionpayload&quot;&gt;&lt;code&gt;withdrawals&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; list is based on the new progressive container type.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ExecutionPayload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    withdrawals&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Withdrawal&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The state transition function is updated to limit withdrawals to &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;capella&#x2F;beacon-chain.md#execution&quot;&gt;&lt;code&gt;MAX_WITHDRAWALS_PER_PAYLOAD&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This change was originally a candidate for inclusion in Shanghai, but was postponed to accelerate the rollout of withdrawals.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Applications that rely on the replaced MPT &lt;code&gt;withdrawals_root&lt;&#x2F;code&gt; in the block header require migration to the SSZ &lt;code&gt;withdrawals_root&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;RLP and SSZ withdrawals may clash when encoded. It is essential to use only a single format within one channel. The block header corresponding to the withdrawals can be consulted to identify the underlying fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;None&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>SSZ receipts</title>
        <published>2023-02-08T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Etan Kissling</name><uri>https://github.com/etan-status</uri>
	</author>
	
	<author>
		<name>Gajinder Singh</name><uri>https://github.com/g11tech</uri>
	</author>
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6466/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6466-ssz-receipts/12884" />
        

        <id>https://wg-eips.ritovision.com/6466/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:6466"
            label="EIP-6466" />
        

        
        

        
        <summary type="html">Migration of RLP receipts to SSZ</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6466/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP defines a migration process of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; Recursive-Length Prefix (RLP) receipts to &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b3e83f6691c61e5b35136000146015653b22ed38&#x2F;ssz&#x2F;simple-serialize.md&quot;&gt;Simple Serialize (SSZ)&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;RLP receipts have a number of shortcomings:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Limited proving support:&lt;&#x2F;strong&gt; Due to receipt data being linearly hashed as part of the &lt;code&gt;receipts_root&lt;&#x2F;code&gt; Merkle-Patricia Trie (MPT), it is not possible to efficiently proof individual parts of receipts, such as logs. Requiring the full receipt data to be present can be prohibitive for smart contract based applications such as L2 fraud proofs or client applications verifying log data.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Incomplete data:&lt;&#x2F;strong&gt; JSON-RPC provides &lt;code&gt;from&lt;&#x2F;code&gt;, &lt;code&gt;gasUsed&lt;&#x2F;code&gt;, and &lt;code&gt;contractAddress&lt;&#x2F;code&gt; fields for receipts, but the on-chain receipt does not contain the required information to verify them.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;This EIP defines a universal receipt format based on SSZ to address these concerns.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;existing-definitions&quot;&gt;Existing definitions&lt;&#x2F;h3&gt;
&lt;p&gt;Definitions from existing specifications that are used throughout this document are replicated here for reference.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;SSZ equivalent&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b3e83f6691c61e5b35136000146015653b22ed38&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#custom-types&quot;&gt;&lt;code&gt;Root&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;Bytes32&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b3e83f6691c61e5b35136000146015653b22ed38&#x2F;specs&#x2F;bellatrix&#x2F;beacon-chain.md#custom-types&quot;&gt;&lt;code&gt;ExecutionAddress&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;Bytes20&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6404&#x2F;#normalized-transactions&quot;&gt;&lt;code&gt;GasAmount&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint64&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;logs&quot;&gt;Logs&lt;&#x2F;h3&gt;
&lt;p&gt;Logs are represented as an SSZ &lt;code&gt;Container&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_TOPICS_PER_LOG&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;4&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;LOG0&lt;&#x2F;code&gt; through &lt;code&gt;LOG4&lt;&#x2F;code&gt; opcodes allow 0-4 topics per log&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Log&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    topics&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Bytes32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_TOPICS_PER_LOG&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveByteList&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;receipts&quot;&gt;Receipts&lt;&#x2F;h3&gt;
&lt;p&gt;New receipts use a normalized SSZ representation.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Receipt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;CompatibleUnion&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;01&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BasicReceipt&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;02&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; CreateReceipt&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;03&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; SetCodeReceipt&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    pass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;basic-receipts&quot;&gt;Basic receipts&lt;&#x2F;h4&gt;
&lt;p&gt;This receipt is emitted for these transactions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6404&#x2F;#normalized-transactions&quot;&gt;&lt;code&gt;RlpLegacyReplayableBasicTransaction&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6404&#x2F;#normalized-transactions&quot;&gt;&lt;code&gt;RlpLegacyBasicTransaction&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6404&#x2F;#normalized-transactions&quot;&gt;&lt;code&gt;RlpAccessListBasicTransaction&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6404&#x2F;#normalized-transactions&quot;&gt;&lt;code&gt;RlpBasicTransaction&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6404&#x2F;#normalized-transactions&quot;&gt;&lt;code&gt;RlpBlobTransaction&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BasicReceipt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity&quot;&gt;    ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    from_&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_used&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; GasAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    logs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Log&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    status&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; boolean&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;create-receipts&quot;&gt;Create receipts&lt;&#x2F;h4&gt;
&lt;p&gt;This receipt is emitted for these transactions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6404&#x2F;#normalized-transactions&quot;&gt;&lt;code&gt;RlpLegacyReplayableCreateTransaction&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6404&#x2F;#normalized-transactions&quot;&gt;&lt;code&gt;RlpLegacyCreateTransaction&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6404&#x2F;#normalized-transactions&quot;&gt;&lt;code&gt;RlpAccessListCreateTransaction&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6404&#x2F;#normalized-transactions&quot;&gt;&lt;code&gt;RlpCreateTransaction&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CreateReceipt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity&quot;&gt;    ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    from_&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_used&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; GasAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    contract_address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    logs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Log&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    status&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; boolean&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;eip-7702-set-code-receipts&quot;&gt;EIP-7702 set code receipts&lt;&#x2F;h4&gt;
&lt;p&gt;This receipt is emitted for these transactions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6404&#x2F;#normalized-transactions&quot;&gt;&lt;code&gt;RlpSetCodeTransaction&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SetCodeReceipt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity&quot;&gt;    ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    from_&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_used&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; GasAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    logs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Log&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    status&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; boolean&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    authorities&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;ExecutionAddress&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;receipt-construction&quot;&gt;&lt;code&gt;Receipt&lt;&#x2F;code&gt; construction&lt;&#x2F;h3&gt;
&lt;p&gt;Receipts are constructed as follows.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Field&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;from&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The transaction sender&#x27;s address&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;gas_used&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;How much gas this individual transaction used&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;contract_address&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;For transactions deploying a contract, the new contract address. Present only in &lt;code&gt;CreateReceipt&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;logs&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Logs emitted during transaction execution&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;status&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;658&#x2F;&quot;&gt;EIP-658&lt;&#x2F;a&gt; transaction status code&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;authorities&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;For transactions with an authorization list, the list of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; &lt;code&gt;authority&lt;&#x2F;code&gt; addresses. Non-successful authorizations are represented with an all-zero address&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The &lt;code&gt;logs_bloom&lt;&#x2F;code&gt;, intermediate state &lt;code&gt;root&lt;&#x2F;code&gt; (Homestead scheme), and &lt;code&gt;cumulative_gas_used&lt;&#x2F;code&gt; (pre &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8116&#x2F;&quot;&gt;EIP-8116&lt;&#x2F;a&gt;) fields are not present in SSZ receipts.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;execution-block-header-changes&quot;&gt;Execution block header changes&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;devp2p&#x2F;blob&#x2F;bc76b9809a30e6dc5c8dcda996273f0f9bcf7108&#x2F;caps&#x2F;eth.md#block-encoding-and-validity&quot;&gt;execution block header&#x27;s &lt;code&gt;receipts-root&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; is transitioned from MPT to SSZ.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;receipts&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Receipt&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    receipt_0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; receipt_1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; receipt_2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ...&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;block_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;receipts_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; receipts&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;hash_tree_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;json-rpc-api&quot;&gt;JSON-RPC API&lt;&#x2F;h3&gt;
&lt;p&gt;Transaction receipt objects in the context of the JSON-RPC API are extended to include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;authorities&lt;&#x2F;code&gt;: &lt;code&gt;Array of DATA|null&lt;&#x2F;code&gt; - Array of &lt;code&gt;DATA&lt;&#x2F;code&gt; entries each containing 20 Bytes, corresponding to the receipt&#x27;s &lt;code&gt;authorities&lt;&#x2F;code&gt; field&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;code&gt;logsBloom&lt;&#x2F;code&gt; field is no longer returned for new receipts. It continues to be returned for historical receipts conforming to earlier schemes.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;from&lt;&#x2F;code&gt;, &lt;code&gt;gasUsed&lt;&#x2F;code&gt;, and &lt;code&gt;contractAddress&lt;&#x2F;code&gt; are already provided via JSON-RPC and are left unchanged. For &lt;code&gt;BasicReceipt&lt;&#x2F;code&gt; and &lt;code&gt;SetCodeReceipt&lt;&#x2F;code&gt;, &lt;code&gt;contractAddress&lt;&#x2F;code&gt; will be &lt;code&gt;null&lt;&#x2F;code&gt; as these receipt types do not contain the &lt;code&gt;contract_address&lt;&#x2F;code&gt; field. &lt;code&gt;logIndex&lt;&#x2F;code&gt; indicates the log index position in the individual receipt (rather than the entire block), as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8116&#x2F;&quot;&gt;EIP-8116&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;consensus-executionpayload-changes&quot;&gt;Consensus &lt;code&gt;ExecutionPayload&lt;&#x2F;code&gt; changes&lt;&#x2F;h3&gt;
&lt;p&gt;When building a consensus &lt;code&gt;ExecutionPayload&lt;&#x2F;code&gt;, the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b3e83f6691c61e5b35136000146015653b22ed38&#x2F;specs&#x2F;deneb&#x2F;beacon-chain.md#executionpayload&quot;&gt;&lt;code&gt;receipts_root&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; is now based on the &lt;code&gt;Receipt&lt;&#x2F;code&gt; type, changing the type of &lt;code&gt;receipts_root&lt;&#x2F;code&gt; from an MPT &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b3e83f6691c61e5b35136000146015653b22ed38&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#custom-types&quot;&gt;&lt;code&gt;Hash32&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; to an SSZ &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b3e83f6691c61e5b35136000146015653b22ed38&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#custom-types&quot;&gt;&lt;code&gt;Root&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ExecutionPayload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    receipts_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ExecutionPayloadHeader&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    receipts_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;payload_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;receipts_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;receipts_root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;forward-compatibility&quot;&gt;Forward compatibility&lt;&#x2F;h3&gt;
&lt;p&gt;All receipts share the same Merkle tree shape with a stable &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;ssz&#x2F;merkle-proofs.md#generalized-merkle-tree-index&quot;&gt;generalized index (gindex)&lt;&#x2F;a&gt; assigned to each field. Future transaction features can introduce additional receipt fields or drop existing fields without breaking verifiers.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;verifier-improvements&quot;&gt;Verifier improvements&lt;&#x2F;h3&gt;
&lt;p&gt;Committing to &lt;code&gt;from&lt;&#x2F;code&gt;, &lt;code&gt;contract_address&lt;&#x2F;code&gt; and &lt;code&gt;authorities&lt;&#x2F;code&gt; in the receipt allows efficient verification without the expensive &lt;code&gt;ecrecover&lt;&#x2F;code&gt; mechanism. This allows future EIPs to change how these addresses are computed without breaking verifiers, e.g., when future signature schemes are introduced.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;execution-client-improvements&quot;&gt;Execution client improvements&lt;&#x2F;h3&gt;
&lt;p&gt;Execution Layer implementations no longer need access to the transaction and additional indices when serving receipts based on SSZ.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Applications that rely on the replaced MPT &lt;code&gt;receipts_root&lt;&#x2F;code&gt; in the block header require migration to the SSZ &lt;code&gt;receipts_root&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;RLP and SSZ receipts may clash when encoded. It is essential to use only a single format within one channel. When requesting receipts by hash over the network, the block header corresponding to the containing receipts root can be consulted to identify the underlying fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;None&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Multi-operator, per-token ERC-721 approvals.</title>
        <published>2023-02-02T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Cristian Espinoza</name><uri>https://github.com/crisgarner</uri>
	</author>
	
	<author>
		<name>Simon Fremaux</name><uri>https://github.com/dievardump</uri>
	</author>
	
	<author>
		<name>David Huber</name><uri>https://github.com/cxkoda</uri>
	</author>
	
	<author>
		<name>and Arran Schlosberg</name><uri>https://github.com/aschlosberg</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6464/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/fine-grained-erc721-approval-for-multiple-operators/12796" />
        

        <id>https://wg-eips.ritovision.com/6464/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:6464"
            label="ERC-6464" />
        

        
        

        
        <summary type="html">Extends ERC-721 to allow token owners to approve multiple operators to control their assets on a per-token basis.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6464/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; did not foresee the approval of multiple operators to manage a specific token on behalf of its owner. This lead to the establishment of &lt;code&gt;setApprovalForAll()&lt;&#x2F;code&gt; as the predominant way to authorise operators, which affords the approved address control over all assets and creates an unnecessarily broad security risk that has already been exploited in a multitude of phishing attacks. The presented EIP extends ERC-721 by introducing a fine-grained, on-chain approval mechanism that allows owners to authorise multiple, specific operators on a per-token basis; this removes unnecessary access permissions and shrinks the surface for exploits to a minimum. The provided reference implementation further enables cheap revocation of all approvals on a per-owner or per-token basis.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The NFT standard defined in ERC-721 allows token owners to &quot;approve&quot; arbitrary addresses to control their tokens—the approved addresses are known as &quot;operators&quot;. Two types of approval were defined:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;approve(address,uint256)&lt;&#x2F;code&gt; provides a mechanism for only a single operator to be approved for a given &lt;code&gt;tokenId&lt;&#x2F;code&gt;; and&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;setApprovalForAll(address,bool)&lt;&#x2F;code&gt; toggles whether an operator is approved for &lt;em&gt;every&lt;&#x2F;em&gt; token owned by &lt;code&gt;msg.sender&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;With the introduction of multiple NFT marketplaces, the ability to approve multiple operators for a particular token is necessary if sellers wish to allow each marketplace to transfer a token upon sale. There is, however, no mechanism for achieving this without using &lt;code&gt;setApprovalForAll()&lt;&#x2F;code&gt;. This is in conflict with the principle of least privilege and creates an attack vector that is exploited by phishing for malicious (i.e. zero-cost) sell-side signatures that are executed by legitimate marketplace contracts.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP therefore defines a fine-grained approach for approving multiple operators but scoped to specific token(s).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;goals&quot;&gt;Goals&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;Ease of adoption for marketplaces; requires minimal changes to existing workflows.&lt;&#x2F;li&gt;
&lt;li&gt;Ease of adoption for off-chain approval-indexing services.&lt;&#x2F;li&gt;
&lt;li&gt;Simple revocation of approvals; i.e. not requiring one per grant.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;non-goals&quot;&gt;Non-goals&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;Security measures for protecting NFTs other than through limiting the scope of operator approvals.&lt;&#x2F;li&gt;
&lt;li&gt;Compatibility with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; semi-fungible tokens. However we note that the mechanisms described herein are also applicable to ERC-1155 token &lt;em&gt;types&lt;&#x2F;em&gt; without requiring approval for all other types.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;To comply with this EIP, a contract MUST implement &lt;code&gt;IERC6464&lt;&#x2F;code&gt; (defined herein) and the &lt;code&gt;ERC165&lt;&#x2F;code&gt; and &lt;code&gt;ERC721&lt;&#x2F;code&gt; interfaces; see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; and ERC-721 respectively.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Extends ERC-721 to include per-token approval for multiple operators.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Off-chain indexers of approvals SHOULD assume that an operator is approved if either of `ERC721.Approval(…)` or&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * `ERC721.ApprovalForAll(…, true)` events are witnessed without the corresponding revocation(s), even if an&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * `ExplicitApprovalFor(…, false)` is emitted.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; TODO&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is TBD.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6464&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when approval is explicitly granted or revoked for a token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ExplicitApprovalFor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when all explicit approvals, as granted by either `setExplicitApprovalFor()` function, are&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * revoked for all tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST be emitted upon calls to `revokeAllExplicitApprovals()`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AllExplicitApprovalsRevoked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when all explicit approvals, as granted by either `setExplicitApprovalFor()` function, are&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * revoked for the specific token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST be `ownerOf(tokenId)` as per ERC721; in the case of revocation due to transfer, this MUST be&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * the `from` address expected to be emitted in the respective `ERC721.Transfer()` event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AllExplicitApprovalsRevoked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Approves the operator to manage the asset on behalf of its owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws if `msg.sender` is not the current NFT owner, or an authorised operator of the current owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Approvals set via this method MUST be revoked upon transfer of the token to a new owner; equivalent to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * calling `revokeAllExplicitApprovals(tokenId)`, including associated events.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST emit `ApprovalFor(operator, tokenId, approved)`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST NOT have an effect on any standard ERC721 approval setters &#x2F; getters.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setExplicitApproval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Approves the operator to manage the token(s) on behalf of their owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST be equivalent to calling `setExplicitApprovalFor(operator, tokenId, approved)` for each `tokenId` in&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * the array.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setExplicitApproval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Revokes all explicit approvals granted by `msg.sender`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST emit `AllExplicitApprovalsRevoked(msg.sender)`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revokeAllExplicitApprovals&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Revokes all excplicit approvals granted for the specified token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws if `msg.sender` is not the current NFT owner, or an authorised operator of the current owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST emit `AllExplicitApprovalsRevoked(msg.sender, tokenId)`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revokeAllExplicitApprovals&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Query whether an address is an approved operator for a token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isExplicitlyApprovedFor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6464AnyApproval&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns true if any of the following criteria are met:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * 1. `isExplicitlyApprovedFor(operator, tokenId) == true`; OR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * 2. `isApprovedForAll(ownerOf(tokenId), operator) == true`; OR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * 3. `getApproved(tokenId) == operator`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The criteria MUST be extended if other mechanism(s) for approving operators are introduced. The criteria&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST include all approval approaches.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isApprovedFor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;draft-notes-to-be-expanded-upon&quot;&gt;Draft notes to be expanded upon&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;Approvals granted via the newly introduced methods are called &lt;em&gt;explicit&lt;&#x2F;em&gt; as a means of easily distinguishing them from those granted via the standard &lt;code&gt;ERC721.approve()&lt;&#x2F;code&gt; and &lt;code&gt;ERC721.setApprovalForAll()&lt;&#x2F;code&gt; functions. However they follow the same intent: authorising operators to act on the owner&#x27;s behalf.&lt;&#x2F;li&gt;
&lt;li&gt;Abstracting &lt;code&gt;isApprovedFor()&lt;&#x2F;code&gt; into &lt;code&gt;IERC6464AnyApproval&lt;&#x2F;code&gt; interface, as against keeping it in &lt;code&gt;IERC6464&lt;&#x2F;code&gt; allows for modularity of plain &lt;code&gt;IERC6464&lt;&#x2F;code&gt; implementations while also standardising the interface for checking approvals when interfacing with specific implementations and any future approval EIPs.&lt;&#x2F;li&gt;
&lt;li&gt;Inclusion of an indexed owner address in &lt;code&gt;AllExplicitApprovalsRevoked(address,uint256)&lt;&#x2F;code&gt; assists off-chain indexing of existing approvals.&lt;&#x2F;li&gt;
&lt;li&gt;Re &lt;code&gt;IERC6464AnyApproval&lt;&#x2F;code&gt;: With an increasing number of approval mechanisms it becomes cumbersome for marketplaces to integrate with them since they have to query multiple interfaces to check if they are approved to manage tokens. This provides a streamlined interface, intended to simplify data ingestion for them.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;!--
  The rationale fleshes out the specification by describing what motivated the design and why particular design decisions were made. It should describe alternate designs that were considered and related work, e.g. how the feature is supported in other languages.

  The current placeholder is acceptable for a draft.

  TODO: Remove this comment before submitting
--&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This extension was written to allow for the smallest change possible to the original ERC-721 spec while still providing a mechanism to grant, revoke and track approvals of multiple operators on a per-token basis.&lt;&#x2F;p&gt;
&lt;p&gt;Extended contracts remain fully compatible with all existing platforms.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;&#x2F;strong&gt; the &lt;code&gt;Security Considerations&lt;&#x2F;code&gt; sub-section on &lt;code&gt;Other risks&lt;&#x2F;code&gt; regarding interplay of approval types.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TODO: add internal link to assets directory when the implementation is in place.&lt;&#x2F;p&gt;
&lt;p&gt;An efficient mechanism for broad revocation of approvals via incrementing nonces is included.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;threat-model&quot;&gt;Threat model&lt;&#x2F;h3&gt;
&lt;h3 id=&quot;mitigations&quot;&gt;Mitigations&lt;&#x2F;h3&gt;
&lt;h3 id=&quot;other-risks&quot;&gt;Other risks&lt;&#x2F;h3&gt;
&lt;p&gt;TODO: Interplay with &lt;code&gt;setApprovalForAll()&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;!--
  All EIPs must contain a section that discusses the security implications&#x2F;considerations relevant to the proposed change. Include information that might be important for security discussions, surfaces risks and can be used throughout the life cycle of the proposal. For example, include security-relevant design decisions, concerns, important discussions, implementation-specific guidance and pitfalls, an outline of threats and risks and how they are being addressed. EIP submissions missing the &quot;Security Considerations&quot; section will be rejected. An EIP cannot proceed to status &quot;Final&quot; without a Security Considerations discussion deemed sufficient by the reviewers.

  The current placeholder is acceptable for a draft.

  TODO: Remove this comment before submitting
--&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Minimal Transferable NFT detection interface</title>
        <published>2023-01-31T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Bruno Škvorc</name><uri>https://github.com/Swader</uri>
	</author>
	
	<author>
		<name>Francesco Sullo</name><uri>https://github.com/sullof</uri>
	</author>
	
	<author>
		<name>Steven Pineda</name><uri>https://github.com/steven2308</uri>
	</author>
	
	<author>
		<name>Stevan Bogosavljevic</name><uri>https://github.com/stevyhacker</uri>
	</author>
	
	<author>
		<name>Jan Turk</name><uri>https://github.com/ThunderDeliverer</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6454/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/minimalistic-transferable-interface/12517" />
        

        <id>https://wg-eips.ritovision.com/6454/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:6454"
            label="ERC-6454" />
        

        
        

        
        <summary type="html">A minimal extension to identify the transferability of Non-Fungible Tokens.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6454/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The Minimalistic Transferable interface for Non-Fungible Tokens standard extends &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; by introducing the ability to identify whether an NFT can be transferred or not.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal introduces the ability to prevent a token from being transferred from their owner, making them bound to the externally owned account, abstracted account, smart contract or token that owns it.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;With NFTs being a widespread form of tokens in the Ethereum ecosystem and being used for a variety of use cases, it is time to standardize additional utility for them. Having the ability to prevent the tokens from being transferred introduces new possibilities of NFT utility and evolution.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal is designed in a way to be as minimal as possible in order to be compatible with any usecases that wish to utilize this proposal.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP introduces new utilities for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; based tokens in the following areas:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6454&#x2F;#verifiable-attribution&quot;&gt;Verifiable attribution&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6454&#x2F;#immutable-properties&quot;&gt;Immutable properties&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;verifiable-attribution&quot;&gt;Verifiable attribution&lt;&#x2F;h3&gt;
&lt;p&gt;Personal achievements can be represented by non-fungible tokens. These tokens can be used to represent a wide range of accomplishments, including scientific advancements, philanthropic endeavors, athletic achievements, and more. However, if these achievement-indicating NFTs can be easily transferred, their authenticity and trustworthiness can be called into question. By binding the NFT to a specific account, it can be ensured that the account owning the NFT is the one that actually achieved the corresponding accomplishment. This creates a secure and verifiable record of personal achievements that can be easily accessed and recognized by others in the network. The ability to verify attribution helps to establish the credibility and value of the achievement-indicating NFT, making it a valuable asset that can be used as a recognition of the holder&#x27;s accomplishments.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;immutable-properties&quot;&gt;Immutable properties&lt;&#x2F;h3&gt;
&lt;p&gt;NFT properties are a critical aspect of non-fungible tokens, serving to differentiate them from one another and establish their scarcity. Centralized control of NFT properties by the issuer, however, can undermine the uniqueness of these properties.&lt;&#x2F;p&gt;
&lt;p&gt;By tying NFTs to specific properties, the original owner is ensured that the NFT will always retain these properties and its uniqueness.&lt;&#x2F;p&gt;
&lt;p&gt;In a blockchain game that employs non-transferable NFTs to represent skills or abilities, each skill would be a unique and permanent asset tied to a specific player or token. This would ensure that players retain ownership of the skills they have earned and prevent them from being traded or sold to other players. This can increase the perceived value of these skills, enhancing the player experience by allowing for greater customization and personalization of characters.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; EIP-6454 Minimalistic Non-Transferable interface for NFTs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-6454&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0x91a6262f.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.16&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6454&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is IERC165 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to check whether the given token is transferable or not.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If this function returns `false`, the transfer of the token MUST revert execution.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If the tokenId does not exist, this method MUST revert execution, unless the token is being checked for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  minting.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The `from` parameter MAY be used to also validate the approval of the token for transfer, but anyone&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  interacting with this function SHOULD NOT rely on it as it is not mandated by the proposal.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token being checked&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address from which the token is being transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address to which the token is being transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Boolean&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; value indicating whether the given token is transferable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isTransferable&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In order to determine whether a token is transferable or not in general, the function SHOULD return the appropriate boolean value when passing the &lt;code&gt;0x0000000000000000000000000000000000000000&lt;&#x2F;code&gt; address as the &lt;code&gt;to&lt;&#x2F;code&gt; and &lt;code&gt;from&lt;&#x2F;code&gt; parameter.&lt;&#x2F;p&gt;
&lt;p&gt;The general transferability of a token should not be affected by the ability to mint the token (value of &lt;code&gt;from&lt;&#x2F;code&gt; parameter is &lt;code&gt;0x0000000000000000000000000000000000000000&lt;&#x2F;code&gt;) and the ability to burn the token (value of &lt;code&gt;to&lt;&#x2F;code&gt; parameter is &lt;code&gt;0x0000000000000000000000000000000000000000&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;If the general transferability of token is &lt;code&gt;false&lt;&#x2F;code&gt;, any kind of transfer of the token, save minting and burning, MUST revert execution.&lt;&#x2F;p&gt;
&lt;p&gt;In order to determine whether a token is mintable, the exception SHOULD be made to allow the &lt;code&gt;tokenId&lt;&#x2F;code&gt; parameter for a token that does not exist. Additionally the &lt;code&gt;from&lt;&#x2F;code&gt; parameter SHOULD be &lt;code&gt;0x0000000000000000000000000000000000000000&lt;&#x2F;code&gt; and the &lt;code&gt;to&lt;&#x2F;code&gt; parameter SHOULD NOT be &lt;code&gt;0x0000000000000000000000000000000000000000&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;In order to determine whether a token is burnable, the &lt;code&gt;from&lt;&#x2F;code&gt; parameter SHOULD NOT be &lt;code&gt;0x0000000000000000000000000000000000000000&lt;&#x2F;code&gt; and the &lt;code&gt;to&lt;&#x2F;code&gt; parameter SHOULD be &lt;code&gt;0x0000000000000000000000000000000000000000&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Implementers MAY choose to validate the approval of the token for transfer by the &lt;code&gt;from&lt;&#x2F;code&gt; parameter, but anyone interacting with this function SHOULD NOT rely on it as it is not mandated by the proposal. This means that the &lt;code&gt;from&lt;&#x2F;code&gt; parameter in such implementations validates the initiator of the transaction rather than the owner from which the token is being transferred (which can either be the owner of the token or the operator allowed to transfer the token).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Designing the proposal, we considered the following questions:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Should we propose another (Non-)Transferable NFT proposal given the existence of existing ones, some even final, and how does this proposal compare to them?&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
This proposal aims to provide the minimum necessary specification for the implementation of non-transferable NFTs, we feel none of the existing proposals have presented the minimal required interface. Unlike other proposals that address the same issue, this proposal requires fewer methods in its specification, providing a more streamlined solution.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Why is there no event marking the token as Non-Transferable in this interface?&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
The token can become non-transferable either at its creation, after being marked as non-transferable, or after a certain condition is met. This means that some cases of tokens becoming non-transferable cannot emit an event, such as if the token becoming non-transferable is determined by a block number. Requiring an event to be emitted upon the token becoming non-transferable is not feasible in such cases.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Should the transferability state management function be included in this proposal?&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
A function that marks a token as non-transferable or releases the binding is referred to as the transferability management function. To maintain the objective of designing an agnostic minimal transferable proposal, we have decided not to specify the transferability management function. This allows for a variety of custom implementations that require the tokens to be non-transferable.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Why should this be an EIP if it only contains one method?&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
One could argue that since the core of this proposal is to only prevent ERC-721 tokens to be transferred, this could be done by overriding the transfer function. While this is true, the only way to assure that the token is non-transferable before the smart contract execution, is for it to have the transferable interface.&lt;br &#x2F;&gt;
This also allows for smart contract to validate whether the token is not transferable and not attempt transferring it as this would result in failed transactions and wasted gas.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Should we include the most straightforward method possible that only accepts a &lt;code&gt;tokenId&lt;&#x2F;code&gt; parameter?&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
The initial version of the proposal contained a method that only accepted a &lt;code&gt;tokenId&lt;&#x2F;code&gt; parameter. This method would return a boolean value indicating whether the token is transferable. However, the fact that the token can be non-transferable for different reasons was brought up throughout the discussion. This is why the method was changed to accept additional parameters, allowing for a more flexible implementation. Additionally, we kept the original method’s functionality by specifying the methodology on how to achieve the same result (by passing the &lt;code&gt;0x0000000000000000000000000000000000000000&lt;&#x2F;code&gt; address as the &lt;code&gt;to&lt;&#x2F;code&gt; and &lt;code&gt;from&lt;&#x2F;code&gt; parameters).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;What is the best user experience for frontend?&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
The best user experience for the front end is having a single method that checks whether the token is transferable. This method should handle both cases of transferability, general and conditional.&lt;br &#x2F;&gt;
The front end should also be able to handle the case where the token is not transferable and the transfer is attempted. This can be done by checking the return value of the transfer function, which will be false if the token is not transferable. If the token would just be set as non-transferable, without a standardized interface to check whether the token is transferable, the only way to validate transferability would be to attempt a gas calculation and check whether the transaction would revert. This is a bad user experience and should be avoided.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Should we mandate that the &lt;code&gt;isTransferable&lt;&#x2F;code&gt; validates approvals as well?&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
We considered specifying that the &lt;code&gt;from&lt;&#x2F;code&gt; parameter represents the initiator of the token transfer. This would mean that the &lt;code&gt;from&lt;&#x2F;code&gt; would validate whether the address is the owner of the token or approved to transfer it. While this might be beneficial, we ultimately decided to make it optional.&lt;br &#x2F;&gt;
As this proposal aims to be the minimal possible implementation and the approvals are already standardized, we feel that &lt;code&gt;isTransferable&lt;&#x2F;code&gt; can be used in conjunction with the approvals to validate whether the given address can initiate the transfer or not.&lt;br &#x2F;&gt;
Additionally, mandating the validation of approvals would incur higher gas consumption as additional checks would be required to validate the transferability.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The Minimalistic Non-Transferable token standard is fully compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and with the robust tooling available for implementations of ERC-721 as well as with the existing ERC-721 infrastructure.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Tests are included in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6454&#x2F;.&#x2F;assets&#x2F;test&#x2F;transferable.ts&quot;&gt;&lt;code&gt;transferable.ts&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;To run them in terminal, you can use the following commands:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cd ..&#x2F;assets&#x2F;eip-6454&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;npm install&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;npx hardhat test&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6454&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;mocks&#x2F;ERC721TransferableMock.sol&quot;&gt;&lt;code&gt;ERC721TransferableMock.sol&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The same security considerations as with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; apply: hidden logic may be present in any of the functions, including burn, add asset, accept asset, and more.&lt;&#x2F;p&gt;
&lt;p&gt;A smart contract can implement the proposal interface but returns fraudulent values, i.e., returning &lt;code&gt;false&lt;&#x2F;code&gt; for &lt;code&gt;isTransferable&lt;&#x2F;code&gt; when the token is transferable. Such a contract would trick other contracts into thinking that the token is non-transferable when it is transferable. If such a contract exists, we suggest not interacting with it. Much like fraudulent &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; smart contracts, it is not possible to prevent such contracts from existing. We suggest that you verify all of the external smart contracts you interact with and not interact with contracts you do not trust.&lt;&#x2F;p&gt;
&lt;p&gt;Since the transferability state can change over time, verifying that the state of the token is transferable before interacting with it is essential. Therefore, a dApp, marketplace, or wallet implementing this interface should verify the state of the token every time the token is displayed.&lt;&#x2F;p&gt;
&lt;p&gt;Caution is advised when dealing with non-audited contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>SSZ transactions</title>
        <published>2023-01-30T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Etan Kissling</name><uri>https://github.com/etan-status</uri>
	</author>
	
	<author>
		<name>Gajinder Singh</name><uri>https://github.com/g11tech</uri>
	</author>
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6404/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6404-ssz-transactions/12783" />
        

        <id>https://wg-eips.ritovision.com/6404/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:6404"
            label="EIP-6404" />
        

        
        

        
        <summary type="html">Migration of RLP transactions to SSZ</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6404/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP defines a migration process of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; Recursive-Length Prefix (RLP) transactions to &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;ssz&#x2F;simple-serialize.md&quot;&gt;Simple Serialize (SSZ)&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;RLP transactions have a number of shortcomings:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Linear hashing:&lt;&#x2F;strong&gt; The signing hash (&lt;code&gt;sig_hash&lt;&#x2F;code&gt;) and unique identifier (&lt;code&gt;tx_hash&lt;&#x2F;code&gt;) of an RLP transaction are computed by linear keccak256 hashes across its serialization. Even if only partial data is of interest, linear hashes require the full transaction data to be present, including potentially large calldata or access lists. This also applies when computing the &lt;code&gt;from&lt;&#x2F;code&gt; address of a transaction based on the &lt;code&gt;sig_hash&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Inefficient inclusion proofs:&lt;&#x2F;strong&gt; The Merkle-Patricia Trie (MPT) backing the execution block header&#x27;s &lt;code&gt;transactions_root&lt;&#x2F;code&gt; is constructed from the serialized transactions, internally prepending a prefix to the transaction data before it is keccak256 hashed into the MPT. Due to this prefix, there is no on-chain commitment to the &lt;code&gt;tx_hash&lt;&#x2F;code&gt; and inclusion proofs require the full transaction data to be present.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Incompatible representation:&lt;&#x2F;strong&gt; As part of the consensus &lt;code&gt;ExecutionPayload&lt;&#x2F;code&gt;, the RLP serialization of transactions is hashed using SSZ merkleization. These SSZ hashes are incompatible with both the &lt;code&gt;tx_hash&lt;&#x2F;code&gt; and the MPT &lt;code&gt;transactions_root&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Technical debt:&lt;&#x2F;strong&gt; All client applications and smart contracts handling RLP transactions have to correctly deal with caveats such as &lt;code&gt;LegacyTransaction&lt;&#x2F;code&gt; lacking a prefix byte, the inconsistent &lt;code&gt;chain_id&lt;&#x2F;code&gt; and &lt;code&gt;v&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;y_parity&lt;&#x2F;code&gt; semantics, and the introduction of &lt;code&gt;max_priority_fee_per_gas&lt;&#x2F;code&gt; between other fields instead of at the end. As existing transaction types tend to remain valid perpetually, this technical debt builds up over time.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Inappropriate opaqueness:&lt;&#x2F;strong&gt; The Consensus Layer treats RLP transaction data as opaque, but requires validation of consensus &lt;code&gt;blob_kzg_commitments&lt;&#x2F;code&gt; against transaction &lt;code&gt;blob_versioned_hashes&lt;&#x2F;code&gt;, resulting in a more complex than necessary engine API.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;This EIP addresses these by defining a lossless conversion mechanism to normalize transaction representation across both Consensus Layer and Execution Layer while retaining support for processing RLP transaction types.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;existing-definitions&quot;&gt;Existing definitions&lt;&#x2F;h3&gt;
&lt;p&gt;Definitions from existing specifications that are used throughout this document are replicated here for reference.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;deneb&#x2F;polynomial-commitments.md#constants&quot;&gt;&lt;code&gt;BYTES_PER_FIELD_ELEMENT&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint64(32)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;deneb&#x2F;polynomial-commitments.md#blob&quot;&gt;&lt;code&gt;FIELD_ELEMENTS_PER_BLOB&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint64(4096)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;SSZ equivalent&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#custom-types&quot;&gt;&lt;code&gt;Hash32&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;Bytes32&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;bellatrix&#x2F;beacon-chain.md#custom-types&quot;&gt;&lt;code&gt;ExecutionAddress&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;Bytes20&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;deneb&#x2F;beacon-chain.md#custom-types&quot;&gt;&lt;code&gt;VersionedHash&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;Bytes32&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;deneb&#x2F;polynomial-commitments.md#custom-types&quot;&gt;&lt;code&gt;KZGCommitment&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;Bytes48&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;deneb&#x2F;polynomial-commitments.md#custom-types&quot;&gt;&lt;code&gt;KZGProof&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;Bytes48&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;deneb&#x2F;polynomial-commitments.md#custom-types&quot;&gt;&lt;code&gt;Blob&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;ByteVector[BYTES_PER_FIELD_ELEMENT * FIELD_ELEMENTS_PER_BLOB]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;signatures&quot;&gt;Signatures&lt;&#x2F;h3&gt;
&lt;p&gt;Transaction signatures are represented by their native, opaque representation, prefixed by a value indicating their algorithm.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;SSZ equivalent&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ExecutionSignature&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;ProgressiveByteList&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ExecutionSignatureAlgorithm&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint8&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;secp256k1&quot;&gt;Secp256k1&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SECP256K1_ALGORITHM&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint8(0xFF)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Defined from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7932&#x2F;&quot;&gt;EIP-7932&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;verification&quot;&gt;Verification&lt;&#x2F;h4&gt;
&lt;p&gt;The following functions are imported from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7932&#x2F;&quot;&gt;EIP-7932&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;calculate_penalty&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;validate_signature&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;verify_signature&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;pubkey_to_address&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_signature_gas_cost&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;    signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionSignature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;    sig_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;    expected_algorithm&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Optional&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;ExecutionSignatureAlgorithm&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;None&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; expected_algorithm&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; expected_algorithm&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; calculate_penalty&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; sig_hash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validate_execution_signature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;    signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionSignature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;    expected_algorithm&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Optional&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;ExecutionSignatureAlgorithm&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;None&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; expected_algorithm&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; expected_algorithm&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    validate_signature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; recover_execution_signer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionSignature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; sig_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    public_key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; verify_signature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sig_hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; pubkey_to_address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;public_key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;gas-fees&quot;&gt;Gas fees&lt;&#x2F;h3&gt;
&lt;p&gt;The different kinds of gas fees are combined into a single structure.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;SSZ equivalent&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FeePerGas&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint256&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Fee per unit of gas&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BasicFeesPerGas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    regular&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; FeePerGas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BlobFeesPerGas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    regular&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; FeePerGas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    blob&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; FeePerGas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;normalized-transactions&quot;&gt;Normalized transactions&lt;&#x2F;h3&gt;
&lt;p&gt;RLP transactions are converted to a normalized SSZ representation. Their original RLP &lt;code&gt;TransactionType&lt;&#x2F;code&gt; is retained to enable recovery of their original RLP representation and associated &lt;code&gt;sig_hash&lt;&#x2F;code&gt; and historical &lt;code&gt;tx_hash&lt;&#x2F;code&gt; values.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;SSZ equivalent&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TransactionType&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint8&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; transaction type, range &lt;code&gt;[0x00, 0x7F]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ChainId&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint256&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt; chain ID&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;GasAmount&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint64&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Amount in units of gas&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;replayable-legacy-transactions&quot;&gt;Replayable legacy transactions&lt;&#x2F;h4&gt;
&lt;p&gt;The original RLP representation of these transactions is replayable across networks with different chain ID.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RlpLegacyReplayableBasicTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity&quot;&gt;    ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    type_&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; TransactionType&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0x00&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_fees_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BasicFeesPerGas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; GasAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    to&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    input_&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveByteList&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RlpLegacyReplayableCreateTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity&quot;&gt;    ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    type_&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; TransactionType&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0x00&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_fees_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BasicFeesPerGas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; GasAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    input_&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveByteList&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;eip-155-legacy-transactions&quot;&gt;EIP-155 legacy transactions&lt;&#x2F;h4&gt;
&lt;p&gt;These transactions are locked to a single &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt; chain ID.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RlpLegacyBasicTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity&quot;&gt;    ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    type_&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; TransactionType&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0x00&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    chain_id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ChainId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_fees_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BasicFeesPerGas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; GasAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    to&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    input_&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveByteList&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RlpLegacyCreateTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity&quot;&gt;    ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    type_&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; TransactionType&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0x00&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    chain_id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ChainId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_fees_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BasicFeesPerGas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; GasAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    input_&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveByteList&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;legacy-transactions&quot;&gt;Legacy transactions&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;RlpLegacyTransactionPayload&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    RlpLegacyReplayableBasicTransactionPayload&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    RlpLegacyReplayableCreateTransactionPayload&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    RlpLegacyBasicTransactionPayload&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    RlpLegacyCreateTransactionPayload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;eip-2930-access-list-transactions&quot;&gt;EIP-2930 access list transactions&lt;&#x2F;h4&gt;
&lt;p&gt;These transactions support specifying an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930&lt;&#x2F;a&gt; access list.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AccessTuple&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    storage_keys&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Hash32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RlpAccessListBasicTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity&quot;&gt;    ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    type_&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; TransactionType&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    chain_id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ChainId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_fees_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BasicFeesPerGas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; GasAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    to&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    input_&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveByteList&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    access_list&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;AccessTuple&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RlpAccessListCreateTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity&quot;&gt;    ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    type_&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; TransactionType&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    chain_id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ChainId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_fees_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BasicFeesPerGas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; GasAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    input_&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveByteList&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    access_list&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;AccessTuple&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;RlpAccessListTransactionPayload&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    RlpAccessListBasicTransactionPayload&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    RlpAccessListCreateTransactionPayload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;eip-1559-fee-market-transactions&quot;&gt;EIP-1559 fee market transactions&lt;&#x2F;h4&gt;
&lt;p&gt;These transactions support specifying &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; priority fees.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RlpBasicTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity&quot;&gt;    ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    type_&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; TransactionType&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0x02&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    chain_id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ChainId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_fees_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BasicFeesPerGas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; GasAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    to&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    input_&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveByteList&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    access_list&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;AccessTuple&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_priority_fees_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BasicFeesPerGas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RlpCreateTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity&quot;&gt;    ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    type_&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; TransactionType&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0x02&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    chain_id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ChainId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_fees_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BasicFeesPerGas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; GasAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    input_&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveByteList&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    access_list&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;AccessTuple&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_priority_fees_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BasicFeesPerGas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;RlpFeeMarketTransactionPayload&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    RlpBasicTransactionPayload&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    RlpCreateTransactionPayload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;eip-4844-blob-transactions&quot;&gt;EIP-4844 blob transactions&lt;&#x2F;h4&gt;
&lt;p&gt;These transactions support specifying &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt; blobs.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RlpBlobTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity&quot;&gt;    ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    type_&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; TransactionType&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0x03&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    chain_id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ChainId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_fees_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BlobFeesPerGas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; GasAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    to&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    input_&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveByteList&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    access_list&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;AccessTuple&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_priority_fees_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BasicFeesPerGas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    blob_versioned_hashes&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;VersionedHash&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;eip-7702-set-code-transactions&quot;&gt;EIP-7702 set code transactions&lt;&#x2F;h4&gt;
&lt;p&gt;These transactions support specifying an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; authorization list.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RlpReplayableBasicAuthorizationPayload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    magic&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; TransactionType&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0x05&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RlpBasicAuthorizationPayload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    magic&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; TransactionType&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0x05&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    chain_id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ChainId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RlpSetCodeAuthorizationPayload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;CompatibleUnion&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;01&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; RlpReplayableBasicAuthorizationPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;02&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; RlpBasicAuthorizationPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    pass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RlpSetCodeAuthorization&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; RlpSetCodeAuthorizationPayload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionSignature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RlpSetCodeTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity&quot;&gt;    ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    type_&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; TransactionType&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0x04&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    chain_id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ChainId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_fees_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BasicFeesPerGas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; GasAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    to&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    input_&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveByteList&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    access_list&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;AccessTuple&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_priority_fees_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BasicFeesPerGas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    authorization_list&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;RlpSetCodeAuthorization&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;transaction-helpers&quot;&gt;Transaction helpers&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;CompatibleUnion&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;01&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; RlpLegacyReplayableBasicTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;02&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; RlpLegacyReplayableCreateTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;03&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; RlpLegacyBasicTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;04&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; RlpLegacyCreateTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;05&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; RlpAccessListBasicTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;06&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; RlpAccessListCreateTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;07&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; RlpBasicTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;08&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; RlpCreateTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;09&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; RlpBlobTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0a&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; RlpSetCodeTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    pass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; TransactionPayload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionSignature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RlpTxType&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;IntEnum&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    LEGACY&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;00&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ACCESS_LIST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    FEE_MARKET&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;02&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    BLOB&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;03&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    SET_CODE&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;04&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    SET_CODE_MAGIC&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;05&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calculate_transaction_intrinsic_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Transaction&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    tx_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TX_BASE_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; FIXME&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: Should this be defined from another EIP?&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; hasattr&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx_data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;authorization_list&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; auth&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; tx_data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;authorization_list&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            gas_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; get_signature_gas_cost&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;auth&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expected_algorithm&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;expected_signature_algorithm&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; get_signature_gas_cost&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expected_algorithm&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;expected_signature_algorithm&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; gas_cost&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validate_transaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Transaction&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    tx_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    expected_signature_algorithm&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; hasattr&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx_data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;type_&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        expected_signature_algorithm&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SECP256K1_ALGORITHM&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        match&lt;&#x2F;span&gt;&lt;span&gt; tx_data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;type_&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            case&lt;&#x2F;span&gt;&lt;span&gt; RlpTxType&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;LEGACY&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; isinstance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx_data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; RlpLegacyTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            case&lt;&#x2F;span&gt;&lt;span&gt; RlpTxType&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;ACCESS_LIST&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; isinstance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx_data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; RlpAccessListTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            case&lt;&#x2F;span&gt;&lt;span&gt; RlpTxType&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;FEE_MARKET&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; isinstance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx_data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; RlpFeeMarketTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            case&lt;&#x2F;span&gt;&lt;span&gt; RlpTxType&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;BLOB&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; isinstance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx_data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; RlpBlobTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            case&lt;&#x2F;span&gt;&lt;span&gt; RlpTxType&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SET_CODE&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; isinstance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx_data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; RlpSetCodeTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            case&lt;&#x2F;span&gt;&lt;span&gt; _&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; hasattr&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx_data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;authorization_list&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; auth&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; tx_data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;authorization_list&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            auth_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; hasattr&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;auth_data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;magic&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                assert&lt;&#x2F;span&gt;&lt;span&gt; auth_data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;magic&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; RlpTxType&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SET_CODE_MAGIC&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; hasattr&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;auth_data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;chain_id&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                assert&lt;&#x2F;span&gt;&lt;span&gt; auth_data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;chain_id&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            validate_execution_signature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;auth&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; compute_auth_hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;auth&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expected_algorithm&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;expected_signature_algorithm&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    validate_execution_signature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; compute_sig_hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expected_algorithm&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;expected_signature_algorithm&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;execution-block-header-changes&quot;&gt;Execution block header changes&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;devp2p&#x2F;blob&#x2F;bc76b9809a30e6dc5c8dcda996273f0f9bcf7108&#x2F;caps&#x2F;eth.md#block-encoding-and-validity&quot;&gt;execution block header&#x27;s &lt;code&gt;txs-root&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; is transitioned from MPT to SSZ.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;transactions&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Transaction&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    tx_0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tx_1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tx_2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ...&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;block_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;transactions_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; transactions&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;hash_tree_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;engine-api&quot;&gt;Engine API&lt;&#x2F;h3&gt;
&lt;p&gt;In the engine API, the semantics of the &lt;code&gt;transactions&lt;&#x2F;code&gt; field in &lt;code&gt;ExecutionPayload&lt;&#x2F;code&gt; versions adopting this EIP are changed to emit transactions using SSZ serialization.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;transactions&lt;&#x2F;code&gt; - &lt;code&gt;Array&lt;&#x2F;code&gt; of &lt;code&gt;DATA&lt;&#x2F;code&gt; - Array of transaction objects, each object is a byte list (&lt;code&gt;DATA&lt;&#x2F;code&gt;) representing &lt;code&gt;ssz.serialize(tx)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;consensus-executionpayload-changes&quot;&gt;Consensus &lt;code&gt;ExecutionPayload&lt;&#x2F;code&gt; changes&lt;&#x2F;h3&gt;
&lt;p&gt;When building a consensus &lt;code&gt;ExecutionPayload&lt;&#x2F;code&gt;, the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;deneb&#x2F;beacon-chain.md#executionpayload&quot;&gt;&lt;code&gt;transactions&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; list is no longer opaque and uses the new &lt;code&gt;Transaction&lt;&#x2F;code&gt; type, aligning the &lt;code&gt;transactions_root&lt;&#x2F;code&gt; across execution blocks and execution payloads.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ExecutionPayload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    transactions&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Transaction&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;unique-transaction-identifier&quot;&gt;Unique transaction identifier&lt;&#x2F;h3&gt;
&lt;p&gt;For each transaction, an additional identifier &lt;code&gt;tx_root&lt;&#x2F;code&gt; SHALL be assigned:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; compute_tx_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Transaction&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;hash_tree_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note that this &lt;code&gt;tx_root&lt;&#x2F;code&gt; differs from the existing &lt;code&gt;tx_hash&lt;&#x2F;code&gt;. Existing APIs based on &lt;code&gt;tx_hash&lt;&#x2F;code&gt; remain available.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;forward-compatibility&quot;&gt;Forward compatibility&lt;&#x2F;h3&gt;
&lt;p&gt;The proposed transaction design is extensible with new fee types, new signature types, and entirely new transaction features (e.g., CREATE2), while retaining compatibility with the proposed transactions.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;verifier-improvements&quot;&gt;Verifier improvements&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;transactions_root&lt;&#x2F;code&gt; is effectively constructed from the list of &lt;code&gt;tx_root&lt;&#x2F;code&gt;, enabling transaction inclusion proofs. Further, partial data becomes provable, such as destination &#x2F; amount without requiring the full calldata. This can reduce gas cost or zk proving cost when verifying L2 chain data in an L1 smart contract.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;consensus-client-improvements&quot;&gt;Consensus client improvements&lt;&#x2F;h3&gt;
&lt;p&gt;Consensus Layer implementations may drop invalid blocks early if consensus &lt;code&gt;blob_kzg_commitments&lt;&#x2F;code&gt; do not validate against transaction &lt;code&gt;blob_versioned_hashes&lt;&#x2F;code&gt; and no longer need to query the Execution Layer for that validation. Future versions of the engine API could be simplified to drop the transfers of &lt;code&gt;blob_kzg_commitments&lt;&#x2F;code&gt; to the EL.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Applications that rely on the replaced MPT &lt;code&gt;transactions_root&lt;&#x2F;code&gt; in the block header require migration to the SSZ &lt;code&gt;transactions_root&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;While there is no on-chain commitment of the &lt;code&gt;tx_hash&lt;&#x2F;code&gt;, it is widely used in JSON-RPC and the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;devp2p&#x2F;blob&#x2F;bc76b9809a30e6dc5c8dcda996273f0f9bcf7108&#x2F;caps&#x2F;eth.md&quot;&gt;Ethereum Wire Protocol&lt;&#x2F;a&gt; to uniquely identify transactions. The conversion from RLP transactions to SSZ is lossless. The original RLP &lt;code&gt;sig_hash&lt;&#x2F;code&gt; and &lt;code&gt;tx_hash&lt;&#x2F;code&gt; can be recovered from the SSZ representation.&lt;&#x2F;p&gt;
&lt;p&gt;RLP and SSZ transactions may clash when encoded. It is essential to use only a single format within one channel.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;None&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Contract clock</title>
        <published>2023-01-25T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Hadrien Croubois</name><uri>https://github.com/Amxx</uri>
	</author>
	
	<author>
		<name>Francisco Giordano</name><uri>https://github.com/frangio</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6372/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6372-contract-clock/12689" />
        

        <id>https://wg-eips.ritovision.com/6372/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:6372"
            label="ERC-6372" />
        

        
        

        
        <summary type="html">An interface for exposing a contract&#x27;s clock value and details</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6372/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Many contracts rely on some clock for enforcing delays and storing historical data. While some contracts rely on block numbers, others use timestamps. There is currently no easy way to discover which time-tracking function a contract internally uses. This EIP proposes to standardize an interface for contracts to expose their internal clock and thus improve composability and interoperability.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Many contracts check or store time-related information. For example, timelock contracts enforce a delay before an operation can be executed. Similarly, DAOs enforce a voting period during which stakeholders can approve or reject a proposal. Last but not least, voting tokens often store the history of voting power using timed snapshots.&lt;&#x2F;p&gt;
&lt;p&gt;Some contracts do time tracking using timestamps while others use block numbers. In some cases, more exotic functions might be used to track time.&lt;&#x2F;p&gt;
&lt;p&gt;There is currently no interface for an external observer to detect which clock a contract uses. This seriously limits interoperability and forces devs to make risky assumptions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;Compliant contracts MUST implement the &lt;code&gt;clock&lt;&#x2F;code&gt; and &lt;code&gt;CLOCK_MODE&lt;&#x2F;code&gt; functions as specified below.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6372&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; clock&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint48&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CLOCK_MODE&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;methods&quot;&gt;Methods&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;clock&quot;&gt;clock&lt;&#x2F;h4&gt;
&lt;p&gt;This function returns the current timepoint according to the mode the contract is operating on. It MUST be a &lt;strong&gt;non-decreasing&lt;&#x2F;strong&gt; function of the chain, such as &lt;code&gt;block.timestamp&lt;&#x2F;code&gt; or &lt;code&gt;block.number&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;lock&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;imepoint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int48&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;clock-mode&quot;&gt;CLOCK_MODE&lt;&#x2F;h4&gt;
&lt;p&gt;This function returns a machine-readable string description of the clock the contract is operating on.&lt;&#x2F;p&gt;
&lt;p&gt;This string MUST be formatted like a URL query string (a.k.a. &lt;code&gt;application&#x2F;x-www-form-urlencoded&lt;&#x2F;code&gt;), decodable in standard JavaScript with &lt;code&gt;new URLSearchParams(CLOCK_MODE)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If operating using &lt;strong&gt;block number&lt;&#x2F;strong&gt;:
&lt;ul&gt;
&lt;li&gt;If the block number is that of the &lt;code&gt;NUMBER&lt;&#x2F;code&gt; opcode (&lt;code&gt;0x43&lt;&#x2F;code&gt;), then this function MUST return &lt;code&gt;mode=blocknumber&amp;amp;from=default&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If it is any other block number, then this function MUST return &lt;code&gt;mode=blocknumber&amp;amp;from=&amp;lt;CAIP-2-ID&amp;gt;&lt;&#x2F;code&gt;, where &lt;code&gt;&amp;lt;CAIP-2-ID&amp;gt;&lt;&#x2F;code&gt; is a CAIP-2 Blockchain ID such as &lt;code&gt;eip155:1&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;If operating using &lt;strong&gt;timestamp&lt;&#x2F;strong&gt;, then this function MUST return &lt;code&gt;mode=timestamp&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If operating using any other mode, then this function SHOULD return a unique identifier for the encoded &lt;code&gt;mode&lt;&#x2F;code&gt; field.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; C&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;LOCK_MODE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; d&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;escriptor&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;tring&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;expected-properties&quot;&gt;Expected properties&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;clock()&lt;&#x2F;code&gt; function MUST be non-decreasing.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;clock&lt;&#x2F;code&gt; returns &lt;code&gt;uint48&lt;&#x2F;code&gt; as it is largely sufficient for storing realistic values. In timestamp mode, &lt;code&gt;uint48&lt;&#x2F;code&gt; will be enough until the year 8921556. Even in block number mode, with 10,000 blocks per second, it would be enough until the year 2861. Using a type smaller than &lt;code&gt;uint256&lt;&#x2F;code&gt; allows storage packing of timepoints with other associated values, greatly reducing the cost of writing and reading from storage.&lt;&#x2F;p&gt;
&lt;p&gt;Depending on the evolution of the blockchain (particularly layer twos), using a smaller type, such as &lt;code&gt;uint32&lt;&#x2F;code&gt; might cause issues fairly quickly. On the other hand, anything bigger than &lt;code&gt;uint48&lt;&#x2F;code&gt; appears wasteful.&lt;&#x2F;p&gt;
&lt;p&gt;In addition to timestamps, it is sometimes necessary to define durations or delays, which are a difference between timestamps. In the general case, we would expect these values to be represented with the same type than timepoints (&lt;code&gt;uint48&lt;&#x2F;code&gt;). However, we believe that in most cases &lt;code&gt;uint32&lt;&#x2F;code&gt; is a good alternative, as it represents over 136 years if the clock operates using seconds. In most cases, we recommend using &lt;code&gt;uint48&lt;&#x2F;code&gt; for storing timepoints and using &lt;code&gt;uint32&lt;&#x2F;code&gt; for storing durations. That recommendation applies to &quot;reasonable&quot; durations (delay for a timelock, voting or vesting duration, ...) when operating with timestamps or block numbers that are more than 1 second apart.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;No known security issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Stealth Meta-Address Registry</title>
        <published>2023-01-24T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Matt Solomon</name><uri>https://github.com/mds1</uri>
	</author>
	
	<author>
		<name>Toni Wahrstätter</name><uri>https://github.com/nerolation</uri>
	</author>
	
	<author>
		<name>Ben DiFrancesco</name><uri>https://github.com/apbendi</uri>
	</author>
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	<author>
		<name>Gary Ghayrat</name><uri>https://github.com/garyghayrat</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6538/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/stealth-meta-address-registry/12888" />
        

        <id>https://wg-eips.ritovision.com/6538/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:6538"
            label="ERC-6538" />
        

        
        

        
        <summary type="html">A canonical contract for entities to register stealth meta-addresses directly or through a third party using signatures.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6538/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This specification defines a standardized way of storing and retrieving an entity&#x27;s stealth meta-address, by extending &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5564&#x2F;&quot;&gt;ERC-5564&lt;&#x2F;a&gt;. An entity may register their stealth meta-address directly. A third party can also register on behalf of an entity using a valid &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;EIP-1271&lt;&#x2F;a&gt; signature. Once registered, the stealth meta-address for the entity can be retrieved by any smart contract or user. One can use the stealth meta-address with &lt;code&gt;generateStealthAddress&lt;&#x2F;code&gt; specified in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5564&#x2F;&quot;&gt;ERC-5564&lt;&#x2F;a&gt; to send assets to the generated stealth address without revealing the entity&#x27;s address.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The standardization of stealth address generation holds the potential to greatly enhance the privacy capabilities of Ethereum by enabling the recipient of a transfer to remain anonymous when receiving an asset. By introducing a central smart contract for users to store their stealth meta-addresses, EOAs and contracts can programmatically engage in stealth interactions using a variety of stealth address schemes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;This contract defines an &lt;code&gt;ERC6538Registry&lt;&#x2F;code&gt; that stores the stealth meta-address for entities. These entities may be identified by an address, ENS name, or other identifier. This MUST be a singleton contract, with one instance per chain.&lt;&#x2F;p&gt;
&lt;p&gt;The contract is specified below. A one byte integer is used to identify the stealth address scheme. This integer is used to differentiate between different stealth address schemes. This ERC outlines schemeId &lt;code&gt;1&lt;&#x2F;code&gt; as the SECP256k1 curve cryptographic scheme with view tags, as specified in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5564&#x2F;&quot;&gt;ERC-5564&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0.8.23&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `ERC6538Registry` contract to map accounts to their stealth meta-address. See&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; [ERC-6538](https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-6538) to learn more.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC6538Registry&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when an invalid signature is provided to `registerKeysOnBehalf`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC6538Registry__InvalidSignature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Next nonce expected from `user` to use when signing for `registerKeysOnBehalf`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `registrant` may be a standard 160-bit address or any other identifier.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `schemeId` is an integer identifier for the stealth address scheme.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; registrant &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; schemeId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; stealthMetaAddressOf&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A nonce used to ensure a signature can only be used once.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `registrant` is the user address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `nonce` will be incremented after each valid `registerKeysOnBehalf` call.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; registrant &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; nonceOf&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The EIP-712 type hash used in `registerKeysOnBehalf`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; ERC6538REGISTRY_ENTRY_TYPE_HASH &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;Erc6538RegistryEntry(uint256 schemeId,bytes stealthMetaAddress,uint256 nonce)&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The chain ID where this contract is initially deployed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; immutable&lt;&#x2F;span&gt;&lt;span&gt; INITIAL_CHAIN_ID&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The domain separator used in this contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; immutable&lt;&#x2F;span&gt;&lt;span&gt; INITIAL_DOMAIN_SEPARATOR&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a registrant updates their stealth meta-address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; registrant&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The account that registered the stealth meta-address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; schemeId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Identifier corresponding to the applied stealth address scheme, e.g. 1 for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; secp256k1, as specified in ERC-5564.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; stealthMetaAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The stealth meta-address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; [ERC-5564](https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-5564) bases the format for stealth&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; meta-addresses on [ERC-3770](https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-3770) and specifies them as:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   st:&amp;lt;shortName&amp;gt;:0x&amp;lt;spendingPubKey&amp;gt;:&amp;lt;viewingPubKey&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The chain (`shortName`) is implicit based on the chain the `ERC6538Registry` is deployed on,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; therefore this `stealthMetaAddress` is just the compressed `spendingPubKey` and&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `viewingPubKey` concatenated.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; StealthMetaAddressSet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; registrant&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; schemeId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; stealthMetaAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a registrant increments their nonce.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; registrant&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The account that incremented the nonce.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; newNonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The new nonce value.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NonceIncremented&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; registrant&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newNonce&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    INITIAL_CHAIN_ID &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;chainid&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    INITIAL_DOMAIN_SEPARATOR &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _computeDomainSeparator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sets the caller&amp;#39;s stealth meta-address for the given scheme ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; schemeId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Identifier corresponding to the applied stealth address scheme, e.g. 1 for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; secp256k1, as specified in ERC-5564.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; stealthMetaAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The stealth meta-address to register.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; registerKeys&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; schemeId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; stealthMetaAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    stealthMetaAddressOf&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;schemeId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; stealthMetaAddress&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; StealthMetaAddressSet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; schemeId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; stealthMetaAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sets the `registrant`&amp;#39;s stealth meta-address for the given scheme ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; registrant&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the registrant.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; schemeId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Identifier corresponding to the applied stealth address scheme, e.g. 1 for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; secp256k1, as specified in ERC-5564.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A signature from the `registrant` authorizing the registration.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; stealthMetaAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The stealth meta-address to register.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Supports both EOA signatures and EIP-1271 signatures.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Reverts if the signature is invalid.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; registerKeysOnBehalf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; registrant&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; schemeId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; stealthMetaAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; dataHash&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; recoveredAddress&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    unchecked&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      dataHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;          &amp;quot;\x19\x01&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;          DOMAIN_SEPARATOR&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              ERC6538REGISTRY_ENTRY_TYPE_HASH&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              schemeId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;stealthMetaAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              nonceOf&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;registrant&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 65&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      bytes32&lt;&#x2F;span&gt;&lt;span&gt; r&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      bytes32&lt;&#x2F;span&gt;&lt;span&gt; s&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      uint8&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      assembly&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;memory-safe&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        r &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        s &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x40&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        v &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; byte&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x60&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      recoveredAddress &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; ecrecover&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;dataHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; s&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span&gt;recoveredAddress &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span&gt; recoveredAddress &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span&gt; registrant&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;          &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            IERC1271&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;registrant&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isValidSignature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;dataHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;              !=&lt;&#x2F;span&gt;&lt;span&gt; IERC1271&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;isValidSignature&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC6538Registry__InvalidSignature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    stealthMetaAddressOf&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;registrant&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;schemeId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; stealthMetaAddress&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; StealthMetaAddressSet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;registrant&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; schemeId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; stealthMetaAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Increments the nonce of the sender to invalidate existing signatures.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; incrementNonce&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    unchecked&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      nonceOf&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NonceIncremented&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; nonceOf&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the domain separator used in this contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The domain separator is re-computed if there&amp;#39;s a chain fork.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DOMAIN_SEPARATOR&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;chainid &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; INITIAL_CHAIN_ID &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span&gt; INITIAL_DOMAIN_SEPARATOR &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _computeDomainSeparator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Computes the domain separator for this contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _computeDomainSeparator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;      abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;          &amp;quot;EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;ERC6538Registry&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;1.0&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;chainid&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Interface of the ERC1271 standard signature validation method for contracts as defined&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; in https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-1271[ERC-1271].&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC1271&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Should return whether the signature provided is valid for the provided data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Hash of the data to be signed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Signature byte array associated with _data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isValidSignature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; magicValue&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The interface for this contract is defined below:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0.8.23&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Interface for calling the `ERC6538Registry` contract to map accounts to their stealth&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; meta-address. See [ERC-6538](https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-6538) to learn more.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6538Registry&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when an invalid signature is provided to `registerKeysOnBehalf`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC6538Registry__InvalidSignature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a registrant updates their stealth meta-address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; registrant&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The account that registered the stealth meta-address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; schemeId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Identifier corresponding to the applied stealth address scheme, e.g. 1 for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; secp256k1, as specified in ERC-5564.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; stealthMetaAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The stealth meta-address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; [ERC-5564](https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-5564) bases the format for stealth&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; meta-addresses on [ERC-3770](https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-3770) and specifies them as:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   st:&amp;lt;shortName&amp;gt;:0x&amp;lt;spendingPubKey&amp;gt;:&amp;lt;viewingPubKey&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The chain (`shortName`) is implicit based on the chain the `ERC6538Registry` is deployed on,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; therefore this `stealthMetaAddress` is just the `spendingPubKey` and `viewingPubKey`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; concatenated.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; StealthMetaAddressSet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; registrant&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; schemeId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; stealthMetaAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a registrant increments their nonce.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; registrant&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The account that incremented the nonce.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; newNonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The new nonce value.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NonceIncremented&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; registrant&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newNonce&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sets the caller&amp;#39;s stealth meta-address for the given scheme ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; schemeId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Identifier corresponding to the applied stealth address scheme, e.g. 1 for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; secp256k1, as specified in ERC-5564.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; stealthMetaAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The stealth meta-address to register.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; registerKeys&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; schemeId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; stealthMetaAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sets the `registrant`&amp;#39;s stealth meta-address for the given scheme ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; registrant&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the registrant.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; schemeId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Identifier corresponding to the applied stealth address scheme, e.g. 1 for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; secp256k1, as specified in ERC-5564.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A signature from the `registrant` authorizing the registration.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; stealthMetaAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The stealth meta-address to register.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Supports both EOA signatures and EIP-1271 signatures.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Reverts if the signature is invalid.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; registerKeysOnBehalf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; registrant&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; schemeId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; stealthMetaAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Increments the nonce of the sender to invalidate existing signatures.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; incrementNonce&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the domain separator used in this contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DOMAIN_SEPARATOR&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the stealth meta-address for the given `registrant` and `schemeId`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; stealthMetaAddressOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; registrant&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; schemeId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the EIP-712 type hash used in `registerKeysOnBehalf`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC6538REGISTRY_ENTRY_TYPE_HASH&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the nonce of the given `registrant`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; nonceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; registrant&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;deployment-method&quot;&gt;Deployment Method&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;ERC6538Registry&lt;&#x2F;code&gt; contract is deployed at &lt;code&gt;0x6538E6bf4B0eBd30A8Ea093027Ac2422ce5d6538&lt;&#x2F;code&gt; using &lt;code&gt;CREATE2&lt;&#x2F;code&gt; via the deterministic deployer at &lt;code&gt;0x4e59b44847b379578588920ca78fbf26c0b4956c&lt;&#x2F;code&gt; with a salt of &lt;code&gt;0x7cac4e512b1768c627c9e711c7a013f1ad0766ef5125c59fb7161dade58da078&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Having a central smart contract for registering stealth meta-addresses has several benefits:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;It guarantees interoperability with other smart contracts, as they can easily retrieve and utilize the registered stealth meta-addresses. This enables applications such as ENS or Gnosis Safe to use that information and integrate stealth addresses into their services.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;It ensures that users are not dependent on off-chain sources to retrieve a user&#x27;s stealth meta-address.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Registration of a stealth meta-address in this contract provides a standard way for users to communicate that they&#x27;re ready to participate in stealth interactions.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;By deploying the registry as a singleton contract, multiple projects can access the same set of stealth meta-addresses, contributing to improved standardization.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is fully backward compatible.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;You can find an implementation of the &lt;code&gt;ERC6538Registry&lt;&#x2F;code&gt; contract &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6538&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;ERC6538Registry.sol&quot;&gt;here&lt;&#x2F;a&gt; and the interface &lt;code&gt;IERC6538Registry.sol&lt;&#x2F;code&gt; &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6538&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;interfaces&#x2F;IERC6538Registry.sol&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;In the event of a compromised private key, the registrant should promptly un-register from the stealth key registry to prevent loss of future funds sent to the compromised account.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Public Non-Fungible Token Emote Repository</title>
        <published>2023-01-22T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Bruno Škvorc</name><uri>https://github.com/Swader</uri>
	</author>
	
	<author>
		<name>Steven Pineda</name><uri>https://github.com/steven2308</uri>
	</author>
	
	<author>
		<name>Stevan Bogosavljevic</name><uri>https://github.com/stevyhacker</uri>
	</author>
	
	<author>
		<name>Jan Turk</name><uri>https://github.com/ThunderDeliverer</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6381/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6381-emotable-extension-for-non-fungible-tokens/12710" />
        

        <id>https://wg-eips.ritovision.com/6381/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:6381"
            label="ERC-6381" />
        

        
        

        
        <summary type="html">React to any Non-Fungible Tokens using Unicode emojis.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6381/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The Public Non-Fungible Token Emote Repository standard provides an enhanced interactive utility for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; by allowing NFTs to be emoted at.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal introduces the ability to react to NFTs using Unicode standardized emoji in a public non-gated repository smart contract that is accessible at the same address in all of the networks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;With NFTs being a widespread form of tokens in the Ethereum ecosystem and being used for a variety of use cases, it is time to standardize additional utility for them. Having the ability for anyone to interact with an NFT introduces an interactive aspect to owning an NFT and unlocks feedback-based NFT mechanics.&lt;&#x2F;p&gt;
&lt;p&gt;This ERC introduces new utilities for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; based tokens in the following areas:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6381&#x2F;#interactivity&quot;&gt;Interactivity&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6381&#x2F;#feedback-based-evolution&quot;&gt;Feedback based evolution&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6381&#x2F;#valuation&quot;&gt;Valuation&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;interactivity&quot;&gt;Interactivity&lt;&#x2F;h3&gt;
&lt;p&gt;The ability to emote on an NFT introduces the aspect of interactivity to owning an NFT. This can either reflect the admiration for the emoter (person emoting to an NFT) or can be a result of a certain action performed by the token&#x27;s owner. Accumulating emotes on a token can increase its uniqueness and&#x2F;or value.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;feedback-based-evolution&quot;&gt;Feedback based evolution&lt;&#x2F;h3&gt;
&lt;p&gt;Standardized on-chain reactions to NFTs allow for feedback based evolution.&lt;&#x2F;p&gt;
&lt;p&gt;Current solutions are either proprietary or off-chain and therefore subject to manipulation and distrust. Having the ability to track the interaction on-chain allows for trust and objective evaluation of a given token. Designing the tokens to evolve when certain emote thresholds are met incentivizes interaction with the token collection.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;valuation&quot;&gt;Valuation&lt;&#x2F;h3&gt;
&lt;p&gt;Current NFT market heavily relies on previous values the token has been sold for, the lowest price of the listed token and the scarcity data provided by the marketplace. There is no real time indication of admiration or desirability of a specific token. Having the ability for users to emote to the tokens adds the possibility of potential buyers and sellers gauging the value of the token based on the impressions the token has collected.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-6381 Emotable Extension for Non-Fungible Tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-6381&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0xd9fac55a.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.16&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6381&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;is IERC165&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to notify listeners that the token with the specified ID has been emoted to or that the reaction has been revoked.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The event MUST only be emitted if the state of the emote is &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; emoter&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the account that emoted or revoked the reaction to the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the collection smart contract containing the token being emoted to or having the reaction revoked&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; emoji&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Unicode identifier of the emoji&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; on&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Boolean value signifying whether the token was emoted to (`true`) or if the reaction has been revoked (`false`)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Emoted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; emoter&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; emoji&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; on&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to get the number of emotes for a specific emoji on a token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the collection containing the token being checked for emoji count&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token to check for emoji count&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; emoji&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Unicode identifier of the emoji&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Number&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; of emotes with the emoji on the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; emoteCountOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; emoji&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to get the number of emotes for a specific emoji on a set of tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collections&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of addresses of the collections containing the tokens being checked for emoji count&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of IDs of the tokens to check for emoji count&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; emojis&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of unicode identifiers of the emojis&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; An&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of numbers of emotes with the emoji on the tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; bulkEmoteCountOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collections&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes4&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; emojis&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to get the information on whether the specified address has used a specific emoji on a specific&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; emoter&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the account we are checking for a reaction to a token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the collection smart contract containing the token being checked for emoji reaction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token being checked for emoji reaction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; emoji&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ASCII emoji code being checked for reaction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; A&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; boolean value indicating whether the `emoter` has used the `emoji` on the token (`true`) or not&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  (`false`)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; hasEmoterUsedEmote&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; emoter&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; emoji&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to get the information on whether the specified addresses have used specific emojis on specific&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; emoters&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of addresses of the accounts we are checking for reactions to tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collections&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of addresses of the collection smart contracts containing the tokens being checked&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  for emoji reactions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of IDs of the tokens being checked for emoji reactions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; emojis&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of the ASCII emoji codes being checked for reactions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; An&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of boolean values indicating whether the `emoter`s has used the `emoji`s on the tokens (`true`)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  or not (`false`)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; haveEmotersUsedEmotes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; emoters&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collections&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes4&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; emojis&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to get the message to be signed by the `emoter` in order for the reaction to be submitted by someone&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  else.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the collection smart contract containing the token being emoted at&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token being emoted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; emoji&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Unicode identifier of the emoji&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; state&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Boolean value signifying whether to emote (`true`) or undo (`false`) emote&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; deadline&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; UNIX timestamp of the deadline for the signature to be submitted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; message to be signed by the `emoter` in order for the reaction to be submitted by someone else&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; prepareMessageToPresignEmote&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; emoji&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; deadline&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to get multiple messages to be signed by the `emoter` in order for the reaction to be submitted by someone&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  else.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collections&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of addresses of the collection smart contracts containing the tokens being emoted at&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of IDs of the tokens being emoted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; emojis&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An arrau of unicode identifiers of the emojis&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; states&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of boolean values signifying whether to emote (`true`) or undo (`false`) emote&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; deadlines&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of UNIX timestamps of the deadlines for the signatures to be submitted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of messages to be signed by the `emoter` in order for the reaction to be submitted by someone else&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; bulkPrepareMessagesToPresignEmote&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collections&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes4&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; emojis&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; states&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; deadlines&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to emote or undo an emote on a token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Does nothing if attempting to set a pre-existent state.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST emit the `Emoted` event is the state of the emote is &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the collection containing the token being emoted at&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token being emoted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; emoji&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Unicode identifier of the emoji&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; state&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Boolean value signifying whether to emote (`true`) or undo (`false`) emote&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; emote&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; emoji&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; state&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to emote or undo an emote on multiple tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Does nothing if attempting to set a pre-existent state.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST emit the `Emoted` event is the state of the emote is &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST revert if the lengths of the `collections`, `tokenIds`, `emojis` and `states` arrays are not equal.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collections&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of addresses of the collections containing the tokens being emoted at&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of IDs of the tokens being emoted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; emojis&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of unicode identifiers of the emojis&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; states&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of boolean values signifying whether to emote (`true`) or undo (`false`) emote&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; bulkEmote&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collections&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes4&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; emojis&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; states&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to emote or undo an emote on someone else&amp;#39;s behalf.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Does nothing if attempting to set a pre-existent state.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST emit the `Emoted` event is the state of the emote is &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST revert if the lengths of the `collections`, `tokenIds`, `emojis` and `states` arrays are not equal.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST revert if the `deadline` has passed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST revert if the recovered address is the zero address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; emoter&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address that presigned the emote&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the collection smart contract containing the token being emoted at&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; IDs of the token being emoted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; emoji&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Unicode identifier of the emoji&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; state&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Boolean value signifying whether to emote (`true`) or undo (`false`) emote&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; deadline&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; UNIX timestamp of the deadline for the signature to be submitted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `v` value of an ECDSA signature of the message obtained via `prepareMessageToPresignEmote`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `r` value of an ECDSA signature of the message obtained via `prepareMessageToPresignEmote`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `s` value of an ECDSA signature of the message obtained via `prepareMessageToPresignEmote`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; presignedEmote&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; emoter&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; emoji&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; deadline&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; v&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; s&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to bulk emote or undo an emote on someone else&amp;#39;s behalf.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Does nothing if attempting to set a pre-existent state.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST emit the `Emoted` event is the state of the emote is &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST revert if the lengths of the `collections`, `tokenIds`, `emojis` and `states` arrays are not equal.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST revert if the `deadline` has passed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST revert if the recovered address is the zero address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; emoters&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of addresses of the accounts that presigned the emotes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; collections&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of addresses of the collections containing the tokens being emoted at&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of IDs of the tokens being emoted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; emojis&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of unicode identifiers of the emojis&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; states&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of boolean values signifying whether to emote (`true`) or undo (`false`) emote&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; deadlines&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; UNIX timestamp of the deadline for the signature to be submitted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of `v` values of an ECDSA signatures of the messages obtained via `prepareMessageToPresignEmote`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of `r` values of an ECDSA signatures of the messages obtained via `prepareMessageToPresignEmote`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of `s` values of an ECDSA signatures of the messages obtained via `prepareMessageToPresignEmote`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; bulkPresignedEmote&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; emoters&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collections&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes4&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; emojis&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; states&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; deadlines&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint8&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; v&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; s&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;message-format-for-presigned-emotes&quot;&gt;Message format for presigned emotes&lt;&#x2F;h3&gt;
&lt;p&gt;The message to be signed by the &lt;code&gt;emoter&lt;&#x2F;code&gt; in order for the reaction to be submitted by someone else is formatted as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            DOMAIN_SEPARATOR&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            collection&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            emoji&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            deadline&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The values passed when generating the message to be signed are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;DOMAIN_SEPARATOR&lt;&#x2F;code&gt; - The domain separator of the Emotable repository smart contract&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;collection&lt;&#x2F;code&gt; - Address of the collection containing the token being emoted at&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;tokenId&lt;&#x2F;code&gt; - ID of the token being emoted&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;emoji&lt;&#x2F;code&gt; - Unicode identifier of the emoji&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;state&lt;&#x2F;code&gt; - Boolean value signifying whether to emote (&lt;code&gt;true&lt;&#x2F;code&gt;) or undo (&lt;code&gt;false&lt;&#x2F;code&gt;) emote&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;deadline&lt;&#x2F;code&gt; - UNIX timestamp of the deadline for the signature to be submitted&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;code&gt;DOMAIN_SEPARATOR&lt;&#x2F;code&gt; is generated as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;ERC-6381: Public Non-Fungible Token Emote Repository&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;1&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;chainid&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Each chain, that the Emotable repository smart contract is deployed on, will have a different &lt;code&gt;DOMAIN_SEPARATOR&lt;&#x2F;code&gt; value due to chain IDs being different.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;pre-determined-address-of-the-emotable-repository&quot;&gt;Pre-determined address of the Emotable repository&lt;&#x2F;h3&gt;
&lt;p&gt;The address of the Emotable repository smart contract is designed to resemble the function it serves. It starts with &lt;code&gt;0x311073&lt;&#x2F;code&gt; which is the abstract representation of &lt;code&gt;EMOTE&lt;&#x2F;code&gt;. The address is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x31107354b61A0412E722455A771bC462901668eA&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Designing the proposal, we considered the following questions:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Does the proposal support custom emotes or only the Unicode specified ones?&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
The proposal only accepts the Unicode identifier which is a &lt;code&gt;bytes4&lt;&#x2F;code&gt; value. This means that while we encourage implementers to add the reactions using standardized emojis, the values not covered by the Unicode standard can be used for custom emotes. The only drawback being that the interface displaying the reactions will have to know what kind of image to render and such additions will probably be limited to the interface or marketplace in which they were made.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Should the proposal use emojis to relay the impressions of NFTs or some other method?&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
The impressions could have been done using user-supplied strings or numeric values, yet we decided to use emojis since they are a well established mean of relaying impressions and emotions.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Should the proposal establish an emotable extension or a common-good repository?&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
Initially we set out to create an emotable extension to be used with any ERC-721 compliant tokens. However, we realized that the proposal would be more useful if it was a common-good repository of emotable tokens. This way, the tokens that can be reacted to are not only the new ones but also the old ones that have been around since before the proposal.&lt;br &#x2F;&gt;
In line with this decision, we decided to calculate a deterministic address for the repository smart contract. This way, the repository can be used by any NFT collection without the need to search for the address on the given chain.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Should we include only single-action operations, only multi-action operations, or both?&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
We&#x27;ve considered including only single-action operations, where the user is only able to react with a single emoji to a single token, but we decided to include both single-action and multi-action operations. This way, the users can choose whether they want to emote or undo emote on a single token or on multiple tokens at once.&lt;br &#x2F;&gt;
This decision was made for the long-term viability of the proposal. Based on the gas cost of the network and the number of tokens in the collection, the user can choose the most cost-effective way of emoting.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Should we add the ability to emote on someone else&#x27;s behalf?&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
While we did not intend to add this as part of the proposal when drafting it, we realized that it would be a useful feature for it. This way, the users can emote on behalf of someone else, for example, if they are not able to do it themselves or if the emote is earned through an off-chain activity.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;How do we ensure that emoting on someone else&#x27;s behalf is legitimate?&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
We could add delegates to the proposal; when a user delegates their right to emote to someone else, the delegate can emote on their behalf. However, this would add a lot of complexity and additional logic to the proposal.&lt;br &#x2F;&gt;
Using ECDSA signatures, we can ensure that the user has given their consent to emote on their behalf. This way, the user can sign a message with the parameters of the emote and the signature can be submitted by someone else.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Should we add chain ID as a parameter when reacting to a token?&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
During the course of discussion of the proposal, a suggestion arose that we could add chain ID as a parameter when reacting to a token. This would allow the users to emote on the token of one chain on another chain.&lt;br &#x2F;&gt;
We decided against this as we feel that additional parameter would rarely be used and would add additional cost to the reaction transactions. If the collection smart contract wants to utilize on-chain emotes to tokens they contain, they require the reactions to be recorded on the same chain. Marketplaces and wallets integrating this proposal will rely on reactions to reside in the same chain as well, because if chain ID parameter was supported this would mean that they would need to query the repository smart contract on all of the chains the repository is deployed in order to get the reactions for a given token.&lt;br &#x2F;&gt;
Additionally, if the collection creator wants users to record their reactions on a different chain, they can still direct the users to do just that. The repository does not validate the existence of the token being reacted to, which in theory means that you can react to non-existent token or to a token that does not exist yet. The likelihood of a different collection existing at the same address on another chain is significantly low, so the users can react using the collection&#x27;s address on another chain and it is very unlikely that they will unintentionally react to another collection&#x27;s token.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The Emote repository standard is fully compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and with the robust tooling available for implementations of ERC-721 as well as with the existing ERC-721 infrastructure.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Tests are included in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6381&#x2F;.&#x2F;assets&#x2F;test&#x2F;emotableRepository.ts&quot;&gt;&lt;code&gt;emotableRepository.ts&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;To run them in terminal, you can use the following commands:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cd ..&#x2F;assets&#x2F;eip-6381&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;npm install&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;npx hardhat test&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6381&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;EmotableRepository.sol&quot;&gt;&lt;code&gt;EmotableRepository.sol&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The proposal does not envision handling any form of assets from the user, so the assets should not be at risk when interacting with an Emote repository.&lt;&#x2F;p&gt;
&lt;p&gt;The ability to use ECDSA signatures to emote on someone else&#x27;s behalf introduces the risk of a replay attack, which the format of the message to be signed guards against. The &lt;code&gt;DOMAIN_SEPARATOR&lt;&#x2F;code&gt; used in the message to be signed is unique to the repository smart contract of the chain it is deployed on. This means that the signature is invalid on any other chain and the Emote repositories deployed on them should revert the operation if a replay attack is attempted.&lt;&#x2F;p&gt;
&lt;p&gt;Another thing to consider is the ability of presigned message reuse. Since the message includes the signature validity deadline, the message can be reused any number of times before the deadline is reached. The proposal only allows for a single reaction with a given emoji to a specific token to be active, so the presigned message can not be abused to increase the reaction count on the token. However, if the service using the repository relies on the ability to revoke the reaction after certain actions, a valid presigned message can be used to re-react to the token. We suggest that the services using the repository in cnjunction with presigned messages use deadlines that invalidate presigned messages after a reasonalby short period of time.&lt;&#x2F;p&gt;
&lt;p&gt;Caution is advised when dealing with non-audited contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Single-contract Multi-delegatecall</title>
        <published>2023-01-18T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Gavin John</name><uri>https://github.com/Pandapip1</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6357/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6357-single-contract-multicall/12621" />
        

        <id>https://wg-eips.ritovision.com/6357/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="last-call"
                label="Last Call" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:6357"
            label="ERC-6357" />
        

        
        

        
        <summary type="html">Allows an EOA to call multiple functions of a smart contract in a single transaction</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6357/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP standardizes an interface containing a single function, &lt;code&gt;multicall&lt;&#x2F;code&gt;, allowing EOAs to call multiple functions of a smart contract in a single transaction, and revert all calls if any call fails.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, in order to transfer several &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; NFTs, one needs to submit a number of transactions equal to the number of NFTs being tranferred. This wastes users&#x27; funds by requiring them to pay 21000 gas fee for every NFT they transfer.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;Contracts implementing this EIP must implement the following interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IMulticall&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;           Takes an array of abi-encoded call data, delegatecalls itself with each calldata, and returns the abi-encoded result&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;              Reverts if any delegatecall reverts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    The abi-encoded data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @returns  results The abi-encoded return values&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; multicall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; results&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;           OPTIONAL. Takes an array of abi-encoded call data, delegatecalls itself with each calldata, and returns the abi-encoded result&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;              Reverts if any delegatecall reverts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    The abi-encoded data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    values&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  The effective msg.values. These must add up to at most msg.value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @returns  results The abi-encoded return values&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; multicallPayable&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; values&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; results&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;multicallPayable&lt;&#x2F;code&gt; is optional because it isn&#x27;t always feasible to implement, due to the &lt;code&gt;msg.value&lt;&#x2F;code&gt; splitting.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This is compatible with most existing multicall functions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;The following JavaScript code, using the Ethers library, should atomically transfer &lt;code&gt;amt&lt;&#x2F;code&gt; units of an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; token to both &lt;code&gt;addressA&lt;&#x2F;code&gt; and &lt;code&gt;addressB&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;multicall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;await&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; Promise&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;all&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    token&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodeFunctionData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;transfer&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; addressA&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amt&lt;&#x2F;span&gt;&lt;span&gt; ]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    token&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodeFunctionData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;transfer&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; addressB&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amt&lt;&#x2F;span&gt;&lt;span&gt; ]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Derived from OpenZeppelin&amp;#39;s implementation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;abstract&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Multicall&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IMulticall&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; multicall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; results&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        results &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;[](&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt; success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; returndata&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;delegatecall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            results&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; returndata&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; results&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;multicallPayable&lt;&#x2F;code&gt; should only be used if the contract is able to support it. A naive attempt at implementing it could allow an attacker to call a payable function multiple times with the same ether.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Cross-Chain Token States Synchronization</title>
        <published>2023-01-17T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Shawn Zheng</name><uri>https://github.com/xiyu1984</uri>
	</author>
	
	<author>
		<name>Jason Cheng</name><email>chengjingxx@gmail.com</email>
	</author>
	
	<author>
		<name>George Huang</name><uri>https://github.com/virgil2019</uri>
	</author>
	
	<author>
		<name>Kay Lin</name><uri>https://github.com/kay404</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6358/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/add-eip-6358-omniverse-distributed-ledger-technology/12625" />
        

        <id>https://wg-eips.ritovision.com/6358/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:6358"
            label="ERC-6358" />
        

        
        

        
        <summary type="html">A paradigm to synchronize token states over multiple existing public chains</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6358/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC standardizes an interface for contract-layer consensus-agnostic verifiable cross-chain bridging, through which we can define a new global token inherited from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;&#x2F;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; over multi-chains.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;figure-1-architecture&quot;&gt;Figure.1 Architecture&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6358&#x2F;.&#x2F;assets&#x2F;img&#x2F;o-dlt.png&quot; alt=&quot;img&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;With this ERC, we can create a global token protocol, that leverages smart contracts or similar mechanisms on existing blockchains to record the token states synchronously. The synchronization could be made by trustless off-chain synchronizers.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;The current paradigm of token bridges makes assets fragment.&lt;&#x2F;li&gt;
&lt;li&gt;If ETH was transferred to another chain through the current token bridge, if the chain broke down, ETH will be lost for users.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The core of this ERC is synchronization instead of transferring, even if all the other chains break down, as long as Ethereum is still running, user’s assets will not be lost.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The fragment problem will be solved.&lt;&#x2F;li&gt;
&lt;li&gt;The security of users&#x27; multi-chain assets can be greatly enhanced.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;omniverse-account&quot;&gt;Omniverse Account&lt;&#x2F;h3&gt;
&lt;p&gt;There SHOULD be a global user identifier of this ERC, which is RECOMMENDED to be referred to as Omniverse Account (&lt;code&gt;o-account&lt;&#x2F;code&gt; for short) in this article.&lt;br &#x2F;&gt;
The &lt;code&gt;o-account&lt;&#x2F;code&gt; is RECOMMENDED to be expressed as a public key created by the elliptic curve &lt;code&gt;secp256k1&lt;&#x2F;code&gt;. A &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6358&#x2F;#mapping-mechanism-for-different-environments&quot;&gt;mapping mechanism&lt;&#x2F;a&gt; is RECOMMENDED for different environments.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;data-structure&quot;&gt;Data Structure&lt;&#x2F;h3&gt;
&lt;p&gt;An Omniverse Transaction (&lt;code&gt;o-transaction&lt;&#x2F;code&gt; for short) MUST be described with the following data structure:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Omniverse transaction data structure&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * @member nonce: The number of the o-transactions. If the current nonce of an omniverse account is `k`, the valid nonce of this o-account in the next o-transaction is `k+1`. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * @member chainId: The chain where the o-transaction is initiated&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * @member initiateSC: The contract address from which the o-transaction is first initiated&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * @member from: The Omniverse account which signs the o-transaction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * @member payload: The encoded business logic data, which is maintained by the developer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * @member signature: The signature of the above informations. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC6358TransactionData&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint128&lt;&#x2F;span&gt;&lt;span&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint32&lt;&#x2F;span&gt;&lt;span&gt; chainId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span&gt; initiateSC&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span&gt; from&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span&gt; payload&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The data structure &lt;code&gt;ERC6358TransactionData&lt;&#x2F;code&gt; MUST be defined as above.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The member &lt;code&gt;nonce&lt;&#x2F;code&gt; MUST be defined as &lt;code&gt;uint128&lt;&#x2F;code&gt; due to better compatibility for more tech stacks of blockchains.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The member &lt;code&gt;chainId&lt;&#x2F;code&gt; MUST be defined as &lt;code&gt;uint32&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The member &lt;code&gt;initiateSC&lt;&#x2F;code&gt; MUST be defined as &lt;code&gt;bytes&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The member &lt;code&gt;from&lt;&#x2F;code&gt; MUST be defined as &lt;code&gt;bytes&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The member &lt;code&gt;payload&lt;&#x2F;code&gt; MUST be defined as &lt;code&gt;bytes&lt;&#x2F;code&gt;. It is encoded from a user-defined data related to the o-transaction. For example:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;For fungible tokens it is RECOMMENDED as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Fungible token data structure, from which the field `payload` in `ERC6358TransactionData` will be encoded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* @member op: The operation type&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;NOTE&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; op: 0-31 are reserved values, 32-255 are custom values&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*           op: 0 - omniverse account `from` transfers `amount` tokens to omniverse account `exData`, `from` have at least `amount` tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*           op: 1 - omniverse account `from` mints `amount` tokens to omniverse account `exData`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*           op: 2 - omniverse account `from` burns `amount` tokens from his own, `from` have at least `amount` tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* @member exData: The operation data. This sector could be empty and is determined by `op`. For example: &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            when `op` is 0 and 1, `exData` stores the omniverse account that receives.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            when `op` is 2, `exData` is empty.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* @member amount: The amount of tokens being operated&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Fungible&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint8&lt;&#x2F;span&gt;&lt;span&gt; op&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span&gt; exData&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;The related raw data for &lt;code&gt;signature&lt;&#x2F;code&gt; in &lt;code&gt;o-transaction&lt;&#x2F;code&gt; is RECOMMENDED to be the concatenation of the raw bytes of &lt;code&gt;op&lt;&#x2F;code&gt;, &lt;code&gt;exData&lt;&#x2F;code&gt;, and &lt;code&gt;amount&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;For non-fungible tokens it is RECOMMENDED as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Non-Fungible token data structure, from which the field `payload` in `ERC6358TransactionData` will be encoded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* @member op: The operation type&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;NOTE&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; op: 0-31 are reserved values, 32-255 are custom values&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*           op: 0 omniverse account `from` transfers token `tokenId` to omniverse account `exData`, `from` have the token with `tokenId`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*           op: 1 omniverse account `from` mints token `tokenId` to omniverse account `exData`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*           op: 2 omniverse account `from` burns token `tokenId`, `from` have the token with `tokenId`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* @member exData: The operation data. This sector could be empty and is determined by `op`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*           when `op` is 0 and 1, `exData` stores the omniverse account that receives.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            when `op` is 2, `exData` is empty.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* @member tokenId: The tokenId of the non-fungible token being operated&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NonFungible&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint8&lt;&#x2F;span&gt;&lt;span&gt; op&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span&gt; exData&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;The related raw data for &lt;code&gt;signature&lt;&#x2F;code&gt; in &lt;code&gt;o-transaction&lt;&#x2F;code&gt; is RECOMMENDED to be the concatenation of the raw bytes of &lt;code&gt;op&lt;&#x2F;code&gt;, &lt;code&gt;exData&lt;&#x2F;code&gt;, and &lt;code&gt;tokenId&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The member &lt;code&gt;signature&lt;&#x2F;code&gt; MUST be defined as &lt;code&gt;bytes&lt;&#x2F;code&gt;. It is RECOMMENDED to be created as follows.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;It is OPTIONAL that concating the sectors in &lt;code&gt;ERC6358TransactionData&lt;&#x2F;code&gt; as below (take Fungible token for example) and calculate the hash with &lt;code&gt;keccak256&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Decode `_data` from bytes to Fungible&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; A&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `Fungible` instance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; decodeData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Fungible&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span&gt; op&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; exData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;decode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Fungible&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;op&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; exData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the hash of a transaction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; value of the raw data of an `ERC6358TransactionData` instance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getTransactionHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;ERC6358TransactionData&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Fungible &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;memory&lt;&#x2F;span&gt;&lt;span&gt; fungible &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; decodeData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; payload &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;fungible&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;op&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; fungible&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;exData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; fungible&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; rawData &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;chainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;initiateSC&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; payload&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;rawData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;It is OPTIONAL that encapsulating the sectors in &lt;code&gt;ERC6358TransactionData&lt;&#x2F;code&gt; according to &lt;code&gt;EIP-712&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Sign the hash value.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;smart-contract-interface&quot;&gt;Smart Contract Interface&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Every &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6358&#x2F;&quot;&gt;ERC-6358&lt;&#x2F;a&gt; compliant contract MUST implement the &lt;code&gt;IERC6358&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Interface of the ERC-6358&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6358&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a o-transaction which has nonce `nonce` and was signed by user `pk` is sent by calling {sendOmniverseTransaction}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransactionSent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; pk&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sends an `o-transaction` &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: MUST implement the validation of the `_data.signature`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: A map maintaining the  `o-account` and the related transaction nonce is RECOMMENDED  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: MUST implement the validation of the `_data.nonce` according to the current account nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: MUST implement the validation of the `_data. payload`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: This interface is just for sending an `o-transaction`, and the execution MUST NOT be within this interface &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: The actual execution of an `o-transaction` is RECOMMENDED to be in another function and MAY be delayed for a time&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the `o-transaction` data with type {ERC6358TransactionData}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * See more information in the definition of {ERC6358TransactionData}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * Emit a {TransactionSent} event&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; sendOmniverseTransaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;ERC6358TransactionData&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the number of omniverse transactions sent by user `_pk`, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * which is also the valid `nonce` of a new omniverse transactions of user `_pk` &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _pk&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: Omniverse account to be queried&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; number of omniverse transactions sent by user `_pk`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getTransactionCount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _pk&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the transaction data `txData` and timestamp `timestamp` of the user `_use` at a specified nonce `_nonce`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _user&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Omniverse account to be queried&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The nonce to be queried&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Returns&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the transaction data `txData` and timestamp `timestamp` of the user `_use` at a specified nonce `_nonce`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getTransactionData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _nonce&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;ERC6358TransactionData&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the chain ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Returns&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the chain ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getChainId&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;sendOmniverseTransaction&lt;&#x2F;code&gt; function MAY be implemented as &lt;code&gt;public&lt;&#x2F;code&gt; or &lt;code&gt;external&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;getTransactionCount&lt;&#x2F;code&gt; function MAY be implemented as &lt;code&gt;public&lt;&#x2F;code&gt; or &lt;code&gt;external&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;getTransactionData&lt;&#x2F;code&gt; function MAY be implemented as &lt;code&gt;public&lt;&#x2F;code&gt; or &lt;code&gt;external&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;getChainId&lt;&#x2F;code&gt; function MAY be implemented as &lt;code&gt;pure&lt;&#x2F;code&gt; or &lt;code&gt;view&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;TransactionSent&lt;&#x2F;code&gt; event MUST be emitted when &lt;code&gt;sendOmniverseTransaction&lt;&#x2F;code&gt; function is called&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Optional Extension: Fungible Token&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; import &amp;quot;{IERC6358.sol}&amp;quot;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Interface of the ERC-6358 fungible token, which inherits {IERC6358}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6358Fungible&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6358&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the omniverse balance of a user `_pk`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _pk&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `o-account` to be queried&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Returns&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the omniverse balance of a user `_pk`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; omniverseBalanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _pk&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;omniverseBalanceOf&lt;&#x2F;code&gt; function MAY be implemented as &lt;code&gt;public&lt;&#x2F;code&gt; or &lt;code&gt;external&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Optional Extension: NonFungible Token&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;{IERC6358.sol}&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Interface of the ERC-6358 non fungible token, which inherits {IERC6358}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6358NonFungible&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6358&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the number of omniverse NFTs in account `_pk`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _pk&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `o-account` to be queried&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Returns&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the number of omniverse NFTs in account `_pk`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; omniverseBalanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _pk&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the owner of an omniverse NFT with `tokenId`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Omniverse NFT id to be queried&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Returns&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the owner of an omniverse NFT with `tokenId`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; omniverseOwnerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;omniverseBalanceOf&lt;&#x2F;code&gt; function MAY be implemented as &lt;code&gt;public&lt;&#x2F;code&gt; or &lt;code&gt;external&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;omniverseOwnerOf&lt;&#x2F;code&gt; function MAY be implemented as &lt;code&gt;public&lt;&#x2F;code&gt; or &lt;code&gt;external&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;architecture&quot;&gt;Architecture&lt;&#x2F;h3&gt;
&lt;p&gt;As shown in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6358&#x2F;#figure-1-architecture&quot;&gt;Figure.1&lt;&#x2F;a&gt;, smart contracts deployed on multi-chains execute &lt;code&gt;o-transactions&lt;&#x2F;code&gt; of ERC-6358 tokens synchronously through the trustless off-chain synchronizers.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The ERC-6358 smart contracts are referred to as &lt;strong&gt;Abstract Nodes&lt;&#x2F;strong&gt;. The states recorded by the Abstract Nodes that are deployed on different blockchains respectively could be considered as copies of the global state, and they are ultimately consistent.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Synchronizer&lt;&#x2F;strong&gt; is an off-chain execution program responsible for carrying published  &lt;code&gt;o-transactions&lt;&#x2F;code&gt; from the ERC-6358 smart contracts on one blockchain to the others. The synchronizers work trustless as they just deliver &lt;code&gt;o-transactions&lt;&#x2F;code&gt; with others&#x27; signatures, and details could be found in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6358&#x2F;#workflow&quot;&gt;workflow&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;principle&quot;&gt;Principle&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;o-account&lt;&#x2F;code&gt; has been mentioned &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6358&#x2F;#omniverse-account&quot;&gt;above&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The synchronization of the &lt;code&gt;o-transactions&lt;&#x2F;code&gt; guarantees the ultimate consistency of token states across all chains. The related data structure is &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6358&#x2F;#data-structure&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A &lt;code&gt;nonce&lt;&#x2F;code&gt; mechanism is brought in to make the states consistent globally.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;nonce&lt;&#x2F;code&gt; appears in two places, the one is &lt;code&gt;nonce in o-transaction&lt;&#x2F;code&gt; data structure, and the other is &lt;code&gt;account nonce&lt;&#x2F;code&gt; maintained by on-chain ERC-6358 smart contracts.&lt;&#x2F;li&gt;
&lt;li&gt;When synchronizing, the &lt;code&gt;nonce in o-transaction&lt;&#x2F;code&gt; data will be checked by comparing it to the &lt;code&gt;account nonce&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;workflow&quot;&gt;Workflow&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Suppose a common user &lt;code&gt;A&lt;&#x2F;code&gt; and her related operation &lt;code&gt;account nonce&lt;&#x2F;code&gt; is $k$.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;A&lt;&#x2F;code&gt; initiates an &lt;code&gt;o-transaction&lt;&#x2F;code&gt; on Ethereum by calling &lt;code&gt;IERC6358::sendOmniverseTransaction&lt;&#x2F;code&gt;. The current &lt;code&gt;account nonce&lt;&#x2F;code&gt; of &lt;code&gt;A&lt;&#x2F;code&gt; in the ERC-6358 smart contracts deployed on Ethereum is $k$ so the valid value of &lt;code&gt;nonce in o-transaction&lt;&#x2F;code&gt; needs to be $k+1$.&lt;&#x2F;li&gt;
&lt;li&gt;The ERC-6358 smart contracts on Ethereum verify the signature of the &lt;code&gt;o-transaction&lt;&#x2F;code&gt; data. If the verification succeeds, the &lt;code&gt;o-transaction&lt;&#x2F;code&gt; data will be published by the smart contracts on the Ethereum side. The verification includes:
&lt;ul&gt;
&lt;li&gt;whether the balance (FT) or the ownership (NFT) is valid&lt;&#x2F;li&gt;
&lt;li&gt;and whether the &lt;code&gt;nonce in o-transaction&lt;&#x2F;code&gt; is $k+1$&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;o-transaction&lt;&#x2F;code&gt; SHOULD NOT be executed on Ethereum immediately, but wait for a time.&lt;&#x2F;li&gt;
&lt;li&gt;Now, &lt;code&gt;A&lt;&#x2F;code&gt;&#x27;s latest submitted &lt;code&gt;nonce in o-transaction&lt;&#x2F;code&gt; on Ethereum is $k+1$, but still $k$ on other chains.&lt;&#x2F;li&gt;
&lt;li&gt;The off-chain synchronizers will find a newly published &lt;code&gt;o-transaction&lt;&#x2F;code&gt; on Ethereum but not on other chains.&lt;&#x2F;li&gt;
&lt;li&gt;Next synchronizers will rush to deliver this message because of a rewarding mechanism. (The strategy of the reward could be determined by the deployers of ERC-6358 tokens. For example, the reward could come from the service fee or a mining mechanism.)&lt;&#x2F;li&gt;
&lt;li&gt;Finally, the ERC-6358 smart contracts deployed on other chains will all receive the &lt;code&gt;o-transaction&lt;&#x2F;code&gt; data, verify the signature and execute it when the &lt;strong&gt;waiting time is up&lt;&#x2F;strong&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;After execution, the &lt;code&gt;account nonce&lt;&#x2F;code&gt; on all chains will add 1. Now all the &lt;code&gt;account nonce&lt;&#x2F;code&gt; of account &lt;code&gt;A&lt;&#x2F;code&gt; will be $k+1$, and the state of the balances of the related account will be the same too.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;omniverse-account-1&quot;&gt;Omniverse Account&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;An Omniverse Account example: &lt;code&gt;3092860212ceb90a13e4a288e444b685ae86c63232bcb50a064cb3d25aa2c88a24cd710ea2d553a20b4f2f18d2706b8cc5a9d4ae4a50d475980c2ba83414a796&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;The Omniverse Account is a public key of the elliptic curve &lt;code&gt;secp256k1&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;The related private key of the example is:  &lt;code&gt;cdfa0e50d672eb73bc5de00cc0799c70f15c5be6b6fca4a1c82c35c7471125b6&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;mapping-mechanism-for-different-environments&quot;&gt;Mapping Mechanism for Different Environments&lt;&#x2F;h4&gt;
&lt;p&gt;In the simplest implementation, we can just build two mappings to get it. One is like &lt;code&gt;pk based on sece256k1 =&amp;gt; account address in the special environment&lt;&#x2F;code&gt;, and the other is the reverse mapping.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;Account System&lt;&#x2F;code&gt; on &lt;code&gt;Flow&lt;&#x2F;code&gt; is a typical example.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Flow&lt;&#x2F;code&gt; has a built-in mechanism for &lt;code&gt;account address =&amp;gt; pk&lt;&#x2F;code&gt;. The public key can be bound to an account (a special built-in data structure) and the public key can be got from the &lt;code&gt;account address&lt;&#x2F;code&gt; directly.&lt;&#x2F;li&gt;
&lt;li&gt;A mapping from &lt;code&gt;pk&lt;&#x2F;code&gt; to the &lt;code&gt;account address&lt;&#x2F;code&gt; on Flow can be built by creating a mapping &lt;code&gt;{String: Address}&lt;&#x2F;code&gt;, in which &lt;code&gt;String&lt;&#x2F;code&gt; denotes the data type to express the public key and the &lt;code&gt;Address&lt;&#x2F;code&gt; is the data type of the &lt;code&gt;account address&lt;&#x2F;code&gt; on Flow.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;erc-6358-token&quot;&gt;ERC-6358 Token&lt;&#x2F;h3&gt;
&lt;p&gt;The ERC-6358 Token could be implemented with the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6358&#x2F;#smart-contract-interface&quot;&gt;interfaces mentioned above&lt;&#x2F;a&gt;. It can also be used with the combination of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;&#x2F;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The implementation examples of the interfaces can be found at:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6358&#x2F;.&#x2F;assets&#x2F;src&#x2F;contracts&#x2F;interfaces&#x2F;IERC6358.sol&quot;&gt;Interface &lt;code&gt;IERC6358&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;, the basic ERC-6358 interface mentioned &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6358&#x2F;#smart-contract-interface&quot;&gt;above&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6358&#x2F;.&#x2F;assets&#x2F;src&#x2F;contracts&#x2F;interfaces&#x2F;IERC6358Fungible.sol&quot;&gt;Interface &lt;code&gt;IERC6358Fungible&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;, the interface for ERC-6358 fungible token&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6358&#x2F;.&#x2F;assets&#x2F;src&#x2F;contracts&#x2F;interfaces&#x2F;IERC6358NonFungible.sol&quot;&gt;Interface &lt;code&gt;IERC6358NonFungible&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;, the interface for ERC-6358 non-fungible token&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The implementation example of some common tools to operate ERC-6358 can be found at:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6358&#x2F;.&#x2F;assets&#x2F;src&#x2F;contracts&#x2F;libraries&#x2F;OmniverseProtocolHelper.sol&quot;&gt;Common Tools&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The implementation examples of ERC-6358 Fungible Token and ERC-6358 Non-Fungible Token can be found at:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6358&#x2F;.&#x2F;assets&#x2F;src&#x2F;contracts&#x2F;ERC6358FungibleExample.sol&quot;&gt;ERC-6358 Fungible Token Example&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6358&#x2F;.&#x2F;assets&#x2F;src&#x2F;contracts&#x2F;ERC6358NonFungibleExample.sol&quot;&gt;ERC-6358 Non-Fungible Token Example&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;attack-vector-analysis&quot;&gt;Attack Vector Analysis&lt;&#x2F;h3&gt;
&lt;p&gt;According to the above, there are two roles:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;common users&lt;&#x2F;strong&gt; are who initiate an &lt;code&gt;o-transaction&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;synchronizers&lt;&#x2F;strong&gt; are who just carry the &lt;code&gt;o-transaction&lt;&#x2F;code&gt; data if they find differences between different chains.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The two roles might be where the attack happens:&lt;&#x2F;p&gt;
&lt;h4 id=&quot;will-the-synchronizers-cheat&quot;&gt;&lt;strong&gt;Will the &lt;em&gt;synchronizers&lt;&#x2F;em&gt; cheat?&lt;&#x2F;strong&gt;&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Simply speaking, it&#x27;s none of the &lt;strong&gt;synchronizer&lt;&#x2F;strong&gt;&#x27;s business as &lt;strong&gt;they cannot create other users&#x27; signatures&lt;&#x2F;strong&gt; unless some &lt;strong&gt;common users&lt;&#x2F;strong&gt; tell him, but at this point, we think it&#x27;s a problem with the role &lt;strong&gt;common user&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;strong&gt;synchronizer&lt;&#x2F;strong&gt; has no will and cannot do evil because the &lt;code&gt;o-transaction&lt;&#x2F;code&gt; data that they deliver is verified by the related &lt;strong&gt;signature&lt;&#x2F;strong&gt; of other &lt;strong&gt;common users&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;strong&gt;synchronizers&lt;&#x2F;strong&gt; would be rewarded as long as they submit valid &lt;code&gt;o-transaction&lt;&#x2F;code&gt; data, and &lt;em&gt;valid&lt;&#x2F;em&gt; only means that the signature and the amount are both valid. This will be detailed and explained later when analyzing the role of &lt;strong&gt;common user&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;strong&gt;synchronizers&lt;&#x2F;strong&gt; will do the delivery once they find differences between different chains:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If the current &lt;code&gt;account nonce&lt;&#x2F;code&gt; on one chain is smaller than a published &lt;code&gt;nonce in o-transaction&lt;&#x2F;code&gt; on another chain&lt;&#x2F;li&gt;
&lt;li&gt;If the transaction data related to a specific &lt;code&gt;nonce in o-transaction&lt;&#x2F;code&gt; on one chain is different from another published &lt;code&gt;o-transaction&lt;&#x2F;code&gt; data with the same &lt;code&gt;nonce in o-transaction&lt;&#x2F;code&gt; on another chain&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Conclusion: The &lt;em&gt;synchronizers&lt;&#x2F;em&gt; won&#x27;t cheat because there are no benefits and no way for them to do so.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;will-the-common-user-cheat&quot;&gt;&lt;strong&gt;Will the &lt;em&gt;common user&lt;&#x2F;em&gt; cheat?&lt;&#x2F;strong&gt;&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Simply speaking, &lt;strong&gt;maybe they will&lt;&#x2F;strong&gt;, but fortunately, &lt;strong&gt;they can&#x27;t succeed&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Suppose the current &lt;code&gt;account nonce&lt;&#x2F;code&gt; of a &lt;strong&gt;common user&lt;&#x2F;strong&gt; &lt;code&gt;A&lt;&#x2F;code&gt; is $k$ on all chains. &lt;code&gt;A&lt;&#x2F;code&gt; has 100 token &lt;code&gt;X&lt;&#x2F;code&gt;, which is an instance of the ERC-6358 token.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Common user &lt;code&gt;A&lt;&#x2F;code&gt; initiates an &lt;code&gt;o-transaction&lt;&#x2F;code&gt; on a Parachain of Polkadot first, in which &lt;code&gt;A&lt;&#x2F;code&gt; transfers &lt;code&gt;10&lt;&#x2F;code&gt; &lt;code&gt;X&lt;&#x2F;code&gt;s to an &lt;code&gt;o-account&lt;&#x2F;code&gt; of a &lt;strong&gt;common user&lt;&#x2F;strong&gt; &lt;code&gt;B&lt;&#x2F;code&gt;. The &lt;code&gt;nonce in o-transaction&lt;&#x2F;code&gt; needs to be $k+1$. After signature and data verification, the &lt;code&gt;o-transaction&lt;&#x2F;code&gt; data(&lt;code&gt;ot-P-ab&lt;&#x2F;code&gt; for short) will be published on Polkadot.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;At the same time, &lt;code&gt;A&lt;&#x2F;code&gt; initiates an &lt;code&gt;o-transaction&lt;&#x2F;code&gt; with the &lt;strong&gt;same nonce&lt;&#x2F;strong&gt; $k+1$ but &lt;strong&gt;different data&lt;&#x2F;strong&gt;(transfer &lt;code&gt;10&lt;&#x2F;code&gt; &lt;code&gt;X&lt;&#x2F;code&gt;s to another &lt;code&gt;o-account&lt;&#x2F;code&gt; &lt;code&gt;C&lt;&#x2F;code&gt; for example) on Ethereum. This &lt;code&gt;o-transaction&lt;&#x2F;code&gt; (named &lt;code&gt;ot-E-ac&lt;&#x2F;code&gt; for short) will pass the verification on Ethereum first, and be published.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;At this point, it seems &lt;code&gt;A&lt;&#x2F;code&gt; finished a &lt;em&gt;&lt;strong&gt;double spend attack&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt; and the states on Polkadot and Ethereum are different.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Response strategy&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;As we mentioned above, the synchronizers will deliver &lt;code&gt;ot-P-ab&lt;&#x2F;code&gt; to Ethereum and deliver &lt;code&gt;ot-E-ac&lt;&#x2F;code&gt; to Polkadot because they are different although with the same nonce. The synchronizer who submits the &lt;code&gt;o-transaction&lt;&#x2F;code&gt; first will be rewarded as the signature is valid.&lt;&#x2F;li&gt;
&lt;li&gt;Both the ERC-6358 smart contracts or similar mechanisms on Polkadot and Ethereum will find that &lt;code&gt;A&lt;&#x2F;code&gt; did cheating after they received both &lt;code&gt;ot-E-ac&lt;&#x2F;code&gt; and &lt;code&gt;ot-P-ab&lt;&#x2F;code&gt; respectively as the signature of &lt;code&gt;A&lt;&#x2F;code&gt; is non-deniable.&lt;&#x2F;li&gt;
&lt;li&gt;We have mentioned that the execution of an &lt;code&gt;o-transaction&lt;&#x2F;code&gt; will not be done immediately and instead there needs to be a fixed waiting time. So the &lt;code&gt;double spend attack&lt;&#x2F;code&gt; caused by &lt;code&gt;A&lt;&#x2F;code&gt; won&#x27;t succeed.&lt;&#x2F;li&gt;
&lt;li&gt;There will be many synchronizers waiting for delivering o-transactions to get rewards. So although it&#x27;s almost impossible that a &lt;strong&gt;common user&lt;&#x2F;strong&gt; can submit two &lt;code&gt;o-transactions&lt;&#x2F;code&gt; to two chains, but none of the synchronizers deliver the &lt;code&gt;o-transactions&lt;&#x2F;code&gt; successfully because of a network problem or something else, we still provide a solution:
&lt;ul&gt;
&lt;li&gt;The synchronizers will connect to several native nodes of every public chain to avoid the malicious native nodes.&lt;&#x2F;li&gt;
&lt;li&gt;If it indeed happened that all synchronizers&#x27; network break, the &lt;code&gt;o-transactions&lt;&#x2F;code&gt; will be synchronized when the network recovered. If the waiting time is up and the cheating &lt;code&gt;o-transaction&lt;&#x2F;code&gt; has been executed, we are still able to revert it from where the cheating happens according to the &lt;code&gt;nonce in o-transaction&lt;&#x2F;code&gt; and &lt;code&gt;account nonce&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;A&lt;&#x2F;code&gt; couldn&#x27;t escape punishment in the end (For example, lock his account or something else, and this is about the certain tokenomics determined by developers according to their own situation).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Conclusion: The &lt;em&gt;common user&lt;&#x2F;em&gt; maybe cheat but won&#x27;t succeed.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Elastic Signature</title>
        <published>2023-01-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>George</name><uri>https://github.com/JXRow</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6327/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6327-elastic-signature-es/12554" />
        

        <id>https://wg-eips.ritovision.com/6327/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:6327"
            label="ERC-6327" />
        

        
        

        
        <summary type="html">Use password to sign data as private key</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6327/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Elastic signature (ES) aims to sign data with a human friendly secret. The secret will be verified fully on-chain and is not stored anywhere. A user can change the secret as often as they need to. The secret does not have a fixed length. The secret will be like a password, which is a better understood concept than private key. This is specifically true for non-technical users. This EIP defines a smart contract interface to verify and authorize operations with ES.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;What would a changeable &quot;private key&quot; enable us? For years, we have been looking for ways to lower on-boarding barrier for users, especially those with less technical experiences. Private key custody solutions seem to provide an user friendly on-boarding experience, but it is vendor dependent and is not decentralized. ES makes a breakthrough with Zero-knowledge technology. Users generate proof of knowing the secret and a smart contract will verify the proof.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;use-case&quot;&gt;Use case&lt;&#x2F;h3&gt;
&lt;p&gt;ES is an alternative signing algorithm. It is not an either-or solution to the private key. It is designed to serve as an additional signing mechanism on top of the private key signature.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A DeFi app can utilize ES into their transfer fund process. Users will be required to provide their passwords to complete the transaction. This gives an extra protection even if the private key is compromised.&lt;&#x2F;li&gt;
&lt;li&gt;ES can also be used as a plugin to a smart contract wallet, like Account Abstraction &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt;. A decentralized password is picked instead of the private key. This could lead to a smooth onboarding experiences for new Ethereum Dapp users.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Let:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;pwdhash&lt;&#x2F;code&gt; represents the hash of the private secret (password).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;datahash&lt;&#x2F;code&gt; represents the hash of an intended transaction data.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;fullhash&lt;&#x2F;code&gt; represents the hash of &lt;code&gt;datahash&lt;&#x2F;code&gt; and all the well-known variables.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;expiration&lt;&#x2F;code&gt; is the timestamp after which the intended transaction expires.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;allhash&lt;&#x2F;code&gt; represents the hash of &lt;code&gt;fullhash&lt;&#x2F;code&gt; and &lt;code&gt;pwdhash&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;There are three parties involved, Verifier, Requester and Prover.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A verifier,
&lt;ul&gt;
&lt;li&gt;SHOULD compute &lt;code&gt;fullhash&lt;&#x2F;code&gt; from a &lt;code&gt;datahash&lt;&#x2F;code&gt;, which is provided by the requester.&lt;&#x2F;li&gt;
&lt;li&gt;SHOULD derive &lt;code&gt;pwdhash&lt;&#x2F;code&gt; for a given address. The address can be an EOA or a smart contract wallet.&lt;&#x2F;li&gt;
&lt;li&gt;SHOULD verify the proof with the derived &lt;code&gt;pwdhash&lt;&#x2F;code&gt;, the computed &lt;code&gt;fullhash&lt;&#x2F;code&gt; and a &lt;code&gt;allhash&lt;&#x2F;code&gt;, which is submitted by the requester.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;A requester
&lt;ul&gt;
&lt;li&gt;SHOULD generate &lt;code&gt;datahash&lt;&#x2F;code&gt; and decide an &lt;code&gt;expiration&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;SHALL request a verification from the verifier with,
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;proof&lt;&#x2F;code&gt; and &lt;code&gt;allhash&lt;&#x2F;code&gt; which are provided by the prover;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;datahash&lt;&#x2F;code&gt;;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;expiration&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;A prover
&lt;ul&gt;
&lt;li&gt;SHOULD generate the &lt;code&gt;proof&lt;&#x2F;code&gt; and &lt;code&gt;allhash&lt;&#x2F;code&gt; from,
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;datahash&lt;&#x2F;code&gt; and &lt;code&gt;expiration&lt;&#x2F;code&gt; which are agreed with the requester;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;nonce&lt;&#x2F;code&gt; and other well-known variables.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;There are also some requirements.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;well-known variable SHOULD be available to all parties.
&lt;ul&gt;
&lt;li&gt;SHOULD include a &lt;code&gt;nonce&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;SHOULD include a &lt;code&gt;chainid&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;MAY include any variable that is specific to the verifier.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;public statements SHOULD include,
&lt;ul&gt;
&lt;li&gt;one reflecting the &lt;code&gt;pwdhash&lt;&#x2F;code&gt;;&lt;&#x2F;li&gt;
&lt;li&gt;one reflecting the &lt;code&gt;fullhash&lt;&#x2F;code&gt;;&lt;&#x2F;li&gt;
&lt;li&gt;one reflecting the &lt;code&gt;allhash&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The computation of &lt;code&gt;fullhash&lt;&#x2F;code&gt; SHOULD be agreed by both the verifier and the prover.&lt;&#x2F;li&gt;
&lt;li&gt;The computation of &lt;code&gt;datahash&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;ielasticsignature-interface&quot;&gt;&lt;code&gt;IElasticSignature&lt;&#x2F;code&gt; Interface&lt;&#x2F;h3&gt;
&lt;p&gt;This is the verifier interface.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IElasticSignature&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Event emitted after user set&#x2F;reset their password&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; user&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - an user&amp;#39;s address, for whom the password hash is set. It could be a smart contract wallet address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  or an EOA wallet address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; pwdhash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - a password hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SetPassword&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; pwdhash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Event emitted after a successful verification performed for an user&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; user&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - an user&amp;#39;s address, for whom the submitted `proof` is verified. It could be a smart contract wallet&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  address or an EOA wallet address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - a new nonce, which is newly generated to replace the last used nonce. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Verified&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Get `pwdhash` for a user&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; user&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - a user&amp;#39;s address &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - the `pwdhash` for the given address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; pwdhashOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Update an user&amp;#39;s `pwdhash`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; proof1&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - proof generated by the old password&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; expiration1&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - old password signing expiry seconds&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; allhash1&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - allhash generated with the old password&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; proof2&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - proof generated by the new password&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; pwdhash2&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - hash of the new password&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; expiration2&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - new password signing expiry seconds&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; allhash2&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - allhash generated with the new password&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; resetPassword&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;8&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; proof1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expiration1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; allhash1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;8&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; proof2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; pwdhash2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expiration2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; allhash2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Verify a proof for a given user&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * It should be invoked by other contracts. The other contracts provide the `datahash`. The `proof` is generated by&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  the user. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; user&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; -  a user&amp;#39;s address, for whom the verification will be carried out.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; proof&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - a proof generated by the password&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; datahash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - the data what user signing, this is the hash of the data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; expiration&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - number of seconds from now, after which the proof is expired &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; allhash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - public statement, generated along with the `proof`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;8&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; proof&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; datahash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expiration&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; allhash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;verify&lt;&#x2F;code&gt; function SHOULD be called by another contract. The other contract SHOULD generate the &lt;code&gt;datahash&lt;&#x2F;code&gt; to call this. The function SHOULD verify if the &lt;code&gt;allhash&lt;&#x2F;code&gt; is computed correctly and honestly with the password.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The contract will store everyone&#x27;s &lt;code&gt;pwdhash&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6327&#x2F;.&#x2F;assets&#x2F;zkpass-1.png&quot; alt=&quot;verifier-contract&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The chart below shows ZK circuit logic.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6327&#x2F;.&#x2F;assets&#x2F;zkpass-2.png&quot; alt=&quot;circuit-logic&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;To verify the signature, it needs &lt;code&gt;proof&lt;&#x2F;code&gt;, &lt;code&gt;allhash&lt;&#x2F;code&gt;, &lt;code&gt;pwdhash&lt;&#x2F;code&gt; and &lt;code&gt;fullhash&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6327&#x2F;.&#x2F;assets&#x2F;zkpass-3.png&quot; alt=&quot;workflow&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The prover generates &lt;code&gt;proof&lt;&#x2F;code&gt; along with the public outputs. They will send all of them to a third-party requester contract. The requester will generate the &lt;code&gt;datahash&lt;&#x2F;code&gt;. It sends &lt;code&gt;datahash&lt;&#x2F;code&gt;, &lt;code&gt;proof&lt;&#x2F;code&gt;, &lt;code&gt;allhash&lt;&#x2F;code&gt;, &lt;code&gt;expiration&lt;&#x2F;code&gt; and prover&#x27;s address to the verifier contract. The contract verifies that the &lt;code&gt;datahash&lt;&#x2F;code&gt; is from the prover, which means the withdrawal operation is signed by the prover&#x27;s password.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is backward compatible with previous work on signature validation since this method is specific to password based signatures and not EOA signatures.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Example implementation of a signing contract:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;..&#x2F;interfaces&#x2F;IElasticSignature.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;verifier.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ZKPass&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IElasticSignature&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Verifier verifier &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Verifier&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; pwdhashOf&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; nonceOf&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; resetPassword&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;8&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; proof1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expiration1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; allhash1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;8&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; proof2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; pwdhash2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expiration2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; allhash2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span&gt; nonce &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; nonceOf&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;nonce &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;init password&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            pwdhashOf&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; pwdhash2&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            nonceOf&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            verify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; proof2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; expiration2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; allhash2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;reset password&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; check old pwdhash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            verify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; proof1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; expiration1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; allhash1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; check new pwdhash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            pwdhashOf&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; pwdhash2&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            verify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; proof2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; expiration2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; allhash2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SetPassword&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; pwdhash2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;8&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; proof&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; datahash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expiration&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; allhash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; expiration&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;ZKPass::verify: expired&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span&gt; pwdhash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; pwdhashOf&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;user&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            pwdhash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;ZKPass::verify: user not exist&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span&gt; nonce &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; nonceOf&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;user&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span&gt; fullhash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;expiration&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;chainid&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; datahash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 256b-&amp;gt;254b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            verifyProof&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;proof&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; pwdhash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; fullhash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; allhash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;ZKPass::verify: verify proof fail&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        nonceOf&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;user&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; nonce &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Verified&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F; util &#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verifyProof&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;8&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; proof&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; pwdhash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; fullhash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;254b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; allhash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            verifier&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;verifyProof&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                [&lt;&#x2F;span&gt;&lt;span&gt;proof&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; proof&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                [&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;proof&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; proof&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;proof&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; proof&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;5&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                [&lt;&#x2F;span&gt;&lt;span&gt;proof&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;6&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; proof&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                [&lt;&#x2F;span&gt;&lt;span&gt;pwdhash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; fullhash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; allhash&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;verifier.sol is auto generated by snarkjs, the source code circuit.circom is below&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; circom&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;include&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;..&#x2F;..&#x2F;node_modules&#x2F;circomlib&#x2F;circuits&#x2F;poseidon.circom&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;template&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Main&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    signal&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; input&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    signal&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; output&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; out&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    component&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; poseidon1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Poseidon&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    component&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; poseidon2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Poseidon&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    poseidon1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;pwd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    poseidon1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    out&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; poseidon1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;out&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;pwdhash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    poseidon2&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; poseidon1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;out&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    poseidon2&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;fullhash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    out&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;fullhash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    out&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; poseidon2&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;out&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;allhash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;component&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; main&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Main&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Since the pwdhash is public, it is possible to be crack the password. We estimate the Poseidon hash rate of RTX3090 would be 100Mhash&#x2F;s, this is the estimate of crack time:&lt;&#x2F;p&gt;
&lt;p&gt;8 chars (number) : 1 secs&lt;&#x2F;p&gt;
&lt;p&gt;8 chars (number + english) : 25 days&lt;&#x2F;p&gt;
&lt;p&gt;8 chars (number + english + symbol) : 594 days&lt;&#x2F;p&gt;
&lt;p&gt;12 chars (number) : 10000 secs&lt;&#x2F;p&gt;
&lt;p&gt;12 chars (number + english) : 1023042 years&lt;&#x2F;p&gt;
&lt;p&gt;12 chars (number + english + symbol) : 116586246 years&lt;&#x2F;p&gt;
&lt;p&gt;The crack difficulty of private key is 2^256, the crack difficulty of 40 chars (number + english + symbol) is 92^40, 92^40 &amp;gt; 2^256, so when password is 40 chars , it is more difficult to be crack than private key.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>ERC-2771 Namespaced Account Abstraction</title>
        <published>2023-01-11T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Gavin John</name><uri>https://github.com/Pandapip1</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6315/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/trustless-eip-2771/12497" />
        

        <id>https://wg-eips.ritovision.com/6315/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:6315"
            label="ERC-6315" />
        

        
        

        
        <summary type="html">Introducing per-forwarder namespaced addresses to facilitate meta-transactions under a namespacing framework</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6315/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2771&#x2F;&quot;&gt;ERC-2771&lt;&#x2F;a&gt; is a prevalent standard for handling meta-transactions via trusted forwarders. This EIP proposes an extension to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2771&#x2F;&quot;&gt;ERC-2771&lt;&#x2F;a&gt; to introduce a namespacing mechanism, facilitating trustless account abstraction through per-forwarder namespaced addresses.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;The key words &quot;Forwarder&quot; and &quot;Recipient&quot; in this document are to be interpreted as described in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2771&#x2F;&quot;&gt;ERC-2771&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;namespaced-forwarder-interface&quot;&gt;Namespaced Forwarder Interface&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; INamespacedForwarder&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isNamespacedTransaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;determining-the-sender-and-forwarder&quot;&gt;Determining the Sender and Forwarder&lt;&#x2F;h3&gt;
&lt;p&gt;Upon function invocation on a Recipient, the Recipient MUST execute a &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; to the &lt;code&gt;isNamespacedTransaction()&lt;&#x2F;code&gt; method of the caller. If this operation reverts or returns the boolean value &lt;code&gt;false&lt;&#x2F;code&gt;, the transaction MUST proceed normally, identifying the caller as the sender, and the Forwarder as the zero address. However, if the boolean value &lt;code&gt;true&lt;&#x2F;code&gt; is returned, the transaction is acknowledged as a namespaced transaction, with the sender identified using the procedure outlined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2771&#x2F;#extracting-the-transaction-signer-address&quot;&gt;ERC-2771&lt;&#x2F;a&gt;, and the Forwarder identified as the caller.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;recipient-extensions&quot;&gt;Recipient Extensions&lt;&#x2F;h3&gt;
&lt;p&gt;Whenever a Recipient contract has a function with one or more function parameters of type address, it MUST also provide a new function, mirroring the name of the original function but appending &lt;code&gt;Namespaced&lt;&#x2F;code&gt; at the end, which accepts two addresses instead. The initial address denotes the Forwarder, while the latter represents the address managed by that Forwarder. If a function accepts multiple address parameters (e.g., &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;&#x27;s &lt;code&gt;transferFrom&lt;&#x2F;code&gt;), a version of the function accepting two addresses per original address parameter MUST be provided. The original function MUST exhibit identical behavior to the new function when Forwarder addresses are the zero address.&lt;&#x2F;p&gt;
&lt;p&gt;For instance, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; would be extended with these functions:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferNamespaced&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; toForwarder&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; toAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approveNamespaced&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spenderForwarder&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spenderAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFromNamespaced&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; fromForwarder&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; fromAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; toForwarder&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; toAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;erc-165&quot;&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Recipient contracts MUST implement ERC-165. When an ERC-165 interface ID is registered, a second interface ID corresponding to the XOR of the Namespaced function selectors of the original interface must also be registered.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The approach of simply augmenting existing EIP functions with new &lt;code&gt;address&lt;&#x2F;code&gt; parameters, rather than crafting new interfaces for the most commonly used EIPs, is employed to ensure broader applicability of this namespacing proposal.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Contracts already deployed cannot not benefit from this namespacing proposal. This limitation also extends to ERC-2771.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;using-this-eip-in-standards&quot;&gt;Using this EIP in standards&lt;&#x2F;h3&gt;
&lt;p&gt;When using this EIP in another standard, both the original and the Namespaced interface IDs SHOULD be provided. Interfaces MUST NOT include namespaced versions of functions in their interfaces.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal alters trust dynamics: Forwarders no longer require Recipient trust, but instead require the trust of their users.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Human-readable offline signatures</title>
        <published>2023-01-08T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Tal Be&#x27;ery</name><email>tal@zengo.com</email>
	</author>
	
	<author>
		<name>RoiV</name><uri>https://github.com/DeVaz1</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6384/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6384-readable-eip-712-signatures/12752" />
        

        <id>https://wg-eips.ritovision.com/6384/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:6384"
            label="ERC-6384" />
        

        
        

        
        <summary type="html">A method for retrieving a human-readable description of EIP-712 typed and structured data.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6384/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces the &lt;code&gt;evalEIP712Buffer&lt;&#x2F;code&gt; function, which takes an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; buffer and returns a human-readable text description.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The use case of Web3 off-chain signatures intended to be used within on-chain transaction is gaining traction and being used in multiple leading protocols (e.g. OpenSea) and standards &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2612&#x2F;&quot;&gt;EIP-2612&lt;&#x2F;a&gt;, mainly as it offers a fee-less experience.
Attackers are known to actively and successfully abuse such off-chain signatures, leveraging the fact that users are blindly signing off-chain messages, since they are not humanly readable.
While &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; originally declared in its title that being ”humanly readable” is one of its goals, it did not live up to its promise eventually and EIP-712 messages are not understandable by an average user.&lt;&#x2F;p&gt;
&lt;p&gt;In one example, victims browse a malicious phishing website. It requests the victim to sign a message that will put their NFT token for sale on OpenSea platform, virtually for free.&lt;&#x2F;p&gt;
&lt;p&gt;The user interface for some popular wallet implementations is not conveying the actual meaning of signing such transactions.&lt;&#x2F;p&gt;
&lt;p&gt;In this proposal we offer a secure and scalable method to bring true human readability to EIP-712 messages by leveraging their bound smart contracts.
As a result, once implemented this EIP wallets can upgrade their user experience from current state:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6384&#x2F;.&#x2F;assets&#x2F;media&#x2F;MiceyMask-non-compliant.png&quot; alt=&quot;&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;to a much clearer user experience:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6384&#x2F;.&#x2F;assets&#x2F;media&#x2F;ZenGo-EIP-compliant-warning.png&quot; alt=&quot;&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The proposed solution solves the readability issues by allowing the wallet to query the &lt;code&gt;verifyingContract&lt;&#x2F;code&gt;. The incentives for keeping the EIP-712 message description as accurate as possible are aligned, as the responsibility for the description is now owned by the contract, that:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Knows the message meaning exactly (and probably can reuse the code that handles this message when received on chain)&lt;&#x2F;li&gt;
&lt;li&gt;Natively incentivized to provide the best explanation to prevent a possible fraud&lt;&#x2F;li&gt;
&lt;li&gt;Not involving a third party that needs to be trusted&lt;&#x2F;li&gt;
&lt;li&gt;Maintains the fee-less customer experience as the added function is in “view” mode and does not require an on-chain execution and fees.&lt;&#x2F;li&gt;
&lt;li&gt;Maintains Web3’s composability property&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;EIP-712 already formally binds an off-chain signature to a contract, with the &lt;code&gt;verifyingContract&lt;&#x2F;code&gt; parameter. We suggest adding a “view” function (&lt;code&gt;&quot;stateMutability&quot;:&quot;view&quot;&lt;&#x2F;code&gt;) to such contracts, that returns a human readable description of the meaning of this specific off-chain buffer.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the expected result of the offchain message.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;     function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; evalEIP712Buffer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; domainHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; primaryType&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; typedDataBuffer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;     external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;     view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;     returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   .&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Every compliant contract MUST implement this function.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Using this function, wallets can submit the proposed off-chain signature to the contract and present the results to the user, allowing them to enjoy an “on-chain simulation equivalent” experience to their off-chain message.&lt;&#x2F;p&gt;
&lt;p&gt;This function will have a well known name and signature, such that there is no need for updates in the EIP-712 structure.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;function-s-inputs&quot;&gt;Function&#x27;s inputs&lt;&#x2F;h3&gt;
&lt;p&gt;The inputs of the function:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;domainHash&lt;&#x2F;code&gt; is the EIP-712&#x27;s domainSeparator, a hashed &lt;code&gt;eip712Domain&lt;&#x2F;code&gt; struct.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;primaryType&lt;&#x2F;code&gt;is the EIP-712&#x27;s &lt;code&gt;primaryType&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;typedDataBuffer&lt;&#x2F;code&gt; is an ABI encoded message part of the EIP-712 full message.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;function-s-output-s&quot;&gt;Function&#x27;s output(s)&lt;&#x2F;h3&gt;
&lt;p&gt;The output of the function is an array of strings. The wallet SHOULD display them to its end-users. The wallet MAY choose to augment the returned strings with additional data. (e.g. resolve contract addresses to their name)&lt;&#x2F;p&gt;
&lt;p&gt;The strings SHOULD NOT be formatted (e.g. should not contain HTML code) and wallets SHOULD treat this string as an untrusted input and handle its rendering as such.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;support-for-eip-712-messages-that-are-not-meant-to-be-used-on-chain&quot;&gt;Support for EIP-712 messages that are not meant to be used on-chain&lt;&#x2F;h3&gt;
&lt;p&gt;If &lt;code&gt;verifyingContract&lt;&#x2F;code&gt; is not included in the EIP-712 domain separator, wallets MUST NOT retrieve a human-readable description using this EIP. In this case, wallets SHOULD fallback to their original EIP-712 display.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;We chose to implement the &lt;code&gt;typeDataBuffer&lt;&#x2F;code&gt; parameter as abi encoded as it is a generic way to pass the data to the contract. The alternative was to pass the &lt;code&gt;typedData&lt;&#x2F;code&gt; struct, which is not generic as it requires the contract to specify the message data.&lt;&#x2F;li&gt;
&lt;li&gt;We chose to return an array of strings and not a single string as there are potential cases where the message is composed of multiple parts. For example, in the case of a multiple assets transfers in the same &lt;code&gt;typedDataBuffer&lt;&#x2F;code&gt;, the contract is advised to describe each transfer in a separate string to allow the wallet to display each transfer separately.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;alternative-solutions&quot;&gt;Alternative solutions&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;third-party-services&quot;&gt;Third party services:&lt;&#x2F;h4&gt;
&lt;p&gt;Currently, the best choice for users is to rely on some 3rd party solutions that get the proposed message as input and explain its intended meaning to the user. This approach is:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Not scalable: 3rd party provider needs to learn all such proprietary messages&lt;&#x2F;li&gt;
&lt;li&gt;Not necessarily correct: the explanation is based on 3rd party interpretation of the original message author&lt;&#x2F;li&gt;
&lt;li&gt;Introduces an unnecessary dependency of a third party which may have some operational, security, and privacy implications.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;domain-name-binding&quot;&gt;Domain name binding&lt;&#x2F;h4&gt;
&lt;p&gt;Alternatively, wallets can bind domain name to a signature. i.e. only accept EIP-712 message if it comes from a web2 domain that its &lt;code&gt;name&lt;&#x2F;code&gt; as defined by EIP-712 is included in &lt;code&gt;eip712Domain&lt;&#x2F;code&gt;. However this approach has the following disadvantages:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;It breaks Web3’s composability, as now other dapps cannot interact with such messages&lt;&#x2F;li&gt;
&lt;li&gt;Does not protect against bad messages coming from the specified web2 domain, e.g. when web2 domain is hacked&lt;&#x2F;li&gt;
&lt;li&gt;Some current connector, such as WalletConnect do not allow wallets to verify the web2 domain authenticity&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;For non-supporting contracts the wallets will default to showing whatever they are showing today.
Non-supporting wallets will not call this function and will default to showing whatever they are showing today.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;A reference implementation can be found &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6384&#x2F;.&#x2F;assets&#x2F;implementation&#x2F;src&#x2F;MyToken&#x2F;MyToken.sol&quot;&gt;here&lt;&#x2F;a&gt;.
This toy example shows how an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;EIP-20&lt;&#x2F;a&gt; contract supporting this EIP implements an EIP-712 support for &quot;transferWithSig&quot; functionality (a non-standard variation on Permit, as the point of this EIP is to allow readability to non-standard EIP-712 buffers).
To illustrate the usability of this EIP to some real world use case, a helper function for the actual OpenSea&#x27;s SeaPort EIP-712 is implemented too in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6384&#x2F;.&#x2F;assets&#x2F;implementation&#x2F;src&#x2F;SeaPort&#x2F;SeaPort712ParserHelper.sol&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;the-threat-model&quot;&gt;The threat model:&lt;&#x2F;h3&gt;
&lt;p&gt;The attack is facilitated by a rogue web2 interface (“dapp”) that provides bad parameters for an EIP-712 formatted message that is intended to be consumed by a legitimate contract. Therefore, the message is controlled by attackers and cannot be trusted, however the contract is controlled by a legitimate party and can be trusted.&lt;&#x2F;p&gt;
&lt;p&gt;The attacker intends to use that signed EIP-712 message on-chain later on, with a transaction crafted by the attackers. If the subsequent on-chain transaction was to be sent by the victim, then a regular transaction simulation would have sufficed.&lt;&#x2F;p&gt;
&lt;p&gt;The case of a rogue contract is irrelevant, as such a rogue contract can already facilitate the attack regardless of the existence of the EIP-712 formatted message.&lt;&#x2F;p&gt;
&lt;p&gt;Having said that, a rogue contract may try to abuse this functionality in order to send some maliciously crafted string in order to exploit vulnerabilities in wallet rendering of the string. Therefore wallets should treat this string as an untrusted input and handle its renderring it as such.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;analysis-of-the-proposed-solution&quot;&gt;Analysis of the proposed solution&lt;&#x2F;h3&gt;
&lt;p&gt;The explanation is controlled by the relevant contract which is controlled by a legitimate party. The attacker must specify the relevant contract address, as otherwise it will not be accepted by it. Therefore, the attacker cannot create false explanations using this method.
Please note that if the explanation was part of the message to sign it would have been under the control of the attacker and hence irrelevant for security purposes.&lt;&#x2F;p&gt;
&lt;p&gt;Since the added functionality to the contract has the “view” modifier, it cannot change the on-chain state and harm the existing functionalities of the contract.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Semantic Soulbound Tokens</title>
        <published>2022-12-30T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Jessica Chang</name><uri>https://github.com/JessicaChg</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6239/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6239-semantic-soulbound-tokens/12334" />
        

        <id>https://wg-eips.ritovision.com/6239/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:6239"
            label="ERC-6239" />
        

        
        

        
        <summary type="html">Adding RDF triples to ERC-5192 token metadata to capture social meaning</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6239/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal extends &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5192&#x2F;&quot;&gt;ERC-5192&lt;&#x2F;a&gt; by introducing Resource Description Framework (RDF) triples to Soulbound Tokens&#x27; (‘SBTs‘) metadata.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;A Soulbound Token represents the commitments, credentials, and affiliations of accounts. RDF is a standard data model developed by the World Wide Web Consortium (‘W3C’) and is used to represent information in a structured format. Semantic SBTs are built on existing &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5192&#x2F;&quot;&gt;ERC-5192&lt;&#x2F;a&gt; standards to include RDF triples in metadata to capture and store the meaning of social metadata as a network of accounts and attributes.&lt;&#x2F;p&gt;
&lt;p&gt;Semantic SBT provides a foundation for publishing, linking, and integrating data from multiple sources, and enables the ability to query and retrieve information across these sources, using inference to uncover new insights from existing social relations. For example, form the on-chain united social graph, assign trusted contacts for social recovery, and supports fair governance.&lt;&#x2F;p&gt;
&lt;p&gt;While the existence of SBTs can create a decentralized social framework, there still needs to specify a common data model to manage the social metadata on-chain in a trustless manner, describing social metadata in an interconnected way, make it easy to be exchanged, integrated and discovered. And to further fuel the boom of the SBTs ecosystem, we need a bottom-up and decentralized way to maintain people’s social identity related information.&lt;&#x2F;p&gt;
&lt;p&gt;Semantic SBTs address this by storing social metadata, attestations, and access permissions on-chain to bootstrap the social identity layer and a linked data layer natively on Ethereum, and bring semantic meanings to the tons of bits of on-chain data.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;connectedness&quot;&gt;Connectedness&lt;&#x2F;h3&gt;
&lt;p&gt;Semantic SBTs store social data as RDF triples in the Subject-Predicate-Object format, making it easy to create relationships between accounts and attributes.  RDF is a standard for data interchange used to represent highly interconnected data. Representing data in RDF triples makes it simpler for automated systems to identify, clarify, and connect information.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;linked-data&quot;&gt;Linked Data&lt;&#x2F;h3&gt;
&lt;p&gt;Semantic SBTs allow the huge amount of social data on-chain to be available in a standard format (RDF) and be reachable and manageable. The interrelated datasets on-chain can create the linked data layer that allows social data to be mixed, exposed, and shared across different applications, providing a convenient, cheap, and reliable way to retrieve data, regardless of the number of users.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;social-identity&quot;&gt;Social Identity&lt;&#x2F;h3&gt;
&lt;p&gt;Semantic SBTs allow people to publish or attest their own identity-related data in a bottom-up and decentralized way, without reliance on any centralized intermediaries while setting every party free. The data is fragmentary in each Semantic SBT and socially interrelated. RDF triples enable various community detection algorithms to be built on top.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal outlines the semantic data modeling of SBTs that allows implementers to model the social relations among Semantic SBTs, especially in the social sector.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The token &lt;strong&gt;MUST&lt;&#x2F;strong&gt; implement the following interfaces:
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt;’s &lt;code&gt;ERC165&lt;&#x2F;code&gt; (&lt;code&gt;0x01ffc9a7&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;’s &lt;code&gt;ERC721&lt;&#x2F;code&gt; (&lt;code&gt;0x80ac58cd&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;’s &lt;code&gt;ERC721Metadata&lt;&#x2F;code&gt; (&lt;code&gt;0x5b5e139f&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5192&#x2F;&quot;&gt;ERC-5192&lt;&#x2F;a&gt;’s &lt;code&gt;ERC5192&lt;&#x2F;code&gt; (&lt;code&gt;0xb45a3c0e&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;rdf-statement&quot;&gt;RDF Statement&lt;&#x2F;h3&gt;
&lt;p&gt;RDF statements come in various formats, we have selected the six most commonly used formats: &lt;code&gt;nt(N-Triples)&lt;&#x2F;code&gt;,&lt;code&gt;ttl(Turtle)&lt;&#x2F;code&gt;,&lt;code&gt;rdf(RDF&#x2F;XML)&lt;&#x2F;code&gt;,&lt;code&gt;rj(RDF&#x2F;JSON)&lt;&#x2F;code&gt;,&lt;code&gt;nq(N-Quads)&lt;&#x2F;code&gt; and &lt;code&gt;trig(TriG)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The complete format of an RDF statement:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;rdfStatements = {[format]}&amp;lt;statements&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In the following section, fragments surrounded by &lt;code&gt;{}&lt;&#x2F;code&gt; characters are OPTIONAL.&lt;&#x2F;p&gt;
&lt;p&gt;In the following section, fragments surrounded by &lt;code&gt;&amp;lt;&amp;gt;&lt;&#x2F;code&gt; characters are REQUIRED.&lt;&#x2F;p&gt;
&lt;p&gt;format: nt&#x2F;ttl&#x2F;rdf&#x2F;rj&#x2F;nq&#x2F;trig&lt;&#x2F;p&gt;
&lt;p&gt;When no format is selected: statements = [ttl]statements&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;nt(n-triples)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;code&gt;nt&lt;&#x2F;code&gt; uses space to separate the subject, predicate, object of a triple, and a period . to indicate the end of a triple.&lt;&#x2F;p&gt;
&lt;p&gt;The basic structure is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;subject predicate object .&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In this format, the subject is in the format of IRIREF or BLANK_NODE_LABEL, the predicate is in the format of IRIREF, and the object is in the format of IRIREF, BLANK_NODE_LABEL, or STRING_LITERAL_QUOTE.&lt;&#x2F;p&gt;
&lt;p&gt;For example:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;http:&#x2F;&#x2F;example.org&#x2F;entity&#x2F;user1&amp;gt; &amp;lt;http:&#x2F;&#x2F;www.w3.org&#x2F;1999&#x2F;02&#x2F;22-rdf-syntax-ns#type&amp;gt; &amp;lt;http:&#x2F;&#x2F;example.org&#x2F;entity&#x2F;User&amp;gt; .&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;http:&#x2F;&#x2F;example.org&#x2F;entity&#x2F;user1&amp;gt; &amp;lt;http:&#x2F;&#x2F;example.org&#x2F;property&#x2F;name&amp;gt; &amp;quot;Alice&amp;quot; .&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ttl(Turtle)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Compared to &lt;code&gt;nt&lt;&#x2F;code&gt;, &lt;code&gt;ttl&lt;&#x2F;code&gt; uses prefixes to simplify the IRIREF format, and the same predicate under the same subject can be merged without repeating it. &quot;a&quot; can be used to represent &lt;code&gt;&amp;lt;http:&#x2F;&#x2F;www.w3.org&#x2F;1999&#x2F;02&#x2F;22-rdf-syntax-ns#type&amp;gt;&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;For example:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;@prefix : &amp;lt;http:&#x2F;&#x2F;example.org&#x2F;entity&#x2F;&amp;gt; .&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;@prefix p: &amp;lt;http:&#x2F;&#x2F;example.org&#x2F;property&#x2F;&amp;gt; .&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;:user1 a :User;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;       p:name ”Alice” .&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;rdf(RDF&#x2F;XML)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;code&gt;rdf&lt;&#x2F;code&gt; describes RDF in XML format, using rdf:RDF as the top-level element, and xmlns to describe prefixes. rdf:Description begins describing a node, rdf:about defines the node to be described, and rdf:resource fills in the property value in the format of IRI. If the property value is a string, the property value can be directly written as the text of the property node.&lt;&#x2F;p&gt;
&lt;p&gt;The basic structure is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;xml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;xml&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; version&lt;&#x2F;span&gt;&lt;span&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;?&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;rdf&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;RDF&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; xmlns&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;rdf&lt;&#x2F;span&gt;&lt;span&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;http:&#x2F;&#x2F;www.w3.org&#x2F;1999&#x2F; 02&#x2F;22-rdf-syntax-ns#&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;rdf&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;Description&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; rdf&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;about&lt;&#x2F;span&gt;&lt;span&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;subject&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;predicate&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; rdf&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;resource&lt;&#x2F;span&gt;&lt;span&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;&#x2F;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;predicate&lt;&#x2F;span&gt;&lt;span&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;object&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;predicate&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; &amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;rdf&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;Description&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;rdf&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;RDF&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;For example:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;xml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;xml&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; version&lt;&#x2F;span&gt;&lt;span&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;?&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;rdf&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;RDF&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; xmlns&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;rdf&lt;&#x2F;span&gt;&lt;span&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;http:&#x2F;&#x2F;www.w3.org&#x2F;1999&#x2F; 02&#x2F;22-rdf-syntax-ns#&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity&quot;&gt;           xmlns&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;p&lt;&#x2F;span&gt;&lt;span&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;http:&#x2F;&#x2F;example.org&#x2F;property&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;rdf&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;Description&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; rdf&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;about&lt;&#x2F;span&gt;&lt;span&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;http:&#x2F;&#x2F;example.org&#x2F;entity&#x2F;user1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;rdf&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; rdf&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;resource&lt;&#x2F;span&gt;&lt;span&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;http:&#x2F;&#x2F;example.org&#x2F;entity&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;&#x2F;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;p&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;name&lt;&#x2F;span&gt;&lt;span&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;Alice&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;p&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;name&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; &amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;rdf&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;Description&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;rdf&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;RDF&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;rj(RDF&#x2F;JSON)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;code&gt;rj&lt;&#x2F;code&gt; describes RDF in JSON format. A triple is described as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&amp;quot;subject&amp;quot;:{&amp;quot;predicate&amp;quot;:[object]}}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note that each root object is a unique primary key and duplicates are not allowed. There will be no duplicate subjects as keys, and there will be no duplicate predicates under a single subject.&lt;&#x2F;p&gt;
&lt;p&gt;For example:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;http:&#x2F;&#x2F;example.org&#x2F;entity&#x2F;user1&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;   &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;http:&#x2F;&#x2F;www.w3.org&#x2F;1999&#x2F;02&#x2F;22-rdf-syntax-ns#type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;     &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;http:&#x2F;&#x2F;example.org&#x2F;entity&#x2F;User&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;   &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;http:&#x2F;&#x2F;example.org&#x2F;property&#x2F;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;     &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Alice&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;nq(N-Quads)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;code&gt;nq&lt;&#x2F;code&gt; is based on &lt;code&gt;nt&lt;&#x2F;code&gt; but includes a graph label that describes the dataset to which an RDF triple belongs. The graph label can be in the format of IRIREF or BLANK_NODE_LABEL.&lt;&#x2F;p&gt;
&lt;p&gt;The basic structure is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;subject predicate object graphLabel.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;For example:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;http:&#x2F;&#x2F;example.org&#x2F;entity&#x2F;user1&amp;gt; &amp;lt;http:&#x2F;&#x2F;www.w3.org&#x2F;1999&#x2F;02&#x2F;22-rdf-syntax-ns#type&amp;gt; &amp;lt;http:&#x2F;&#x2F;example.org&#x2F;entity&#x2F;User&amp;gt; &amp;lt;http:&#x2F;&#x2F;example.org&#x2F;graphs&#x2F;example&amp;gt; .&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;http:&#x2F;&#x2F;example.org&#x2F;entity&#x2F;user1&amp;gt; &amp;lt;http:&#x2F;&#x2F;example.org&#x2F;property&#x2F;name&amp;gt; &amp;quot;Alice&amp;quot; &amp;lt;http:&#x2F;&#x2F;example.org&#x2F;graphs&#x2F;example&amp;gt; .&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;trig(TriG)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;code&gt;trig&lt;&#x2F;code&gt; is an extension of &lt;code&gt;ttl&lt;&#x2F;code&gt; that includes a graph label to describe the dataset to which an RDF triple belongs. The triple statements are enclosed in curly braces {}.&lt;&#x2F;p&gt;
&lt;p&gt;For example:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;@prefix : &amp;lt;http:&#x2F;&#x2F;example.org&#x2F;entity&#x2F;&amp;gt; .&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;@prefix p: &amp;lt;http:&#x2F;&#x2F;example.org&#x2F;property&#x2F;&amp;gt; .&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;http:&#x2F;&#x2F;example.org&#x2F;graphs&#x2F;example&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;       :user1 a :User;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              p:name ”Alice” .&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In the contract events: &lt;code&gt;CreateRDF&lt;&#x2F;code&gt;, &lt;code&gt;UpdateRDF&lt;&#x2F;code&gt;, &lt;code&gt;RemoveRDF&lt;&#x2F;code&gt;, and the &lt;code&gt;rdfOf method&lt;&#x2F;code&gt;, the  &lt;code&gt;rdfStatements&lt;&#x2F;code&gt; is used in &lt;code&gt;ttl&lt;&#x2F;code&gt; format by default. If other formats listed above are used, a format identifier needs to be added for identification.&lt;&#x2F;p&gt;
&lt;p&gt;The format identifier starts with &lt;code&gt;[&lt;&#x2F;code&gt; and ends with &lt;code&gt;]&lt;&#x2F;code&gt; with the format in the middle, i.e., &lt;code&gt;[format]&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;For example, the &lt;code&gt;rdfStatements&lt;&#x2F;code&gt; in &lt;code&gt;nt&lt;&#x2F;code&gt; format should include the prefix &lt;code&gt;[nt]&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[nt]subject predicate object .&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;contract-interface&quot;&gt;Contract Interface&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Semantic Soulbound Token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0xfbafb698&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ISemanticSBT&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when minting a Semantic Soulbound Token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier for the Semantic Soulbound Token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; rdfStatements&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The RDF statements for the Semantic Soulbound Token. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CreateRDF&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;  rdfStatements&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when updating the RDF data of Semantic Soulbound Token. RDF data is a collection of RDF statements that are used to represent information about resources.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier for the Semantic Soulbound Token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; rdfStatements&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The RDF statements for the semantic soulbound token. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UpdateRDF&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;  rdfStatements&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when burning or revoking Semantic Soulbound Token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier for the Semantic Soulbound Token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; rdfStatements&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The RDF statements for the Semantic Soulbound Token. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RemoveRDF&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;  rdfStatements&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the RDF statements of the Semantic Soulbound Token. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier for the Semantic Soulbound Token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; rdfStatements&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The RDF statements for the Semantic Soulbound Token. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; rdfOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; rdfStatements&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;ISemanticRDFSchema&lt;&#x2F;code&gt;, an extension of ERC-721 Metadata, is &lt;strong&gt;OPTIONAL&lt;&#x2F;strong&gt; for this standard, it is used to get the Schema URI for the RDF data.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ISemanticRDFSchema&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the URI of schema for this contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; URI of the contract which point to a configuration profile.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; schemaURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;method-specification&quot;&gt;Method Specification&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;rdfOf (uint256 tokenId)&lt;&#x2F;code&gt;: Query the RDF data for the Semantic Soulbound Token by &lt;code&gt;tokenId&lt;&#x2F;code&gt;. The returned RDF data format conforms to the W3C RDF standard. RDF data is a collection of RDF statements that are used to represent information about resources. An RDF statement, also known as a triple, is a unit of information in the RDF data model. It consists of three parts: a subject, a predicate, and an object.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;schemaURI()&lt;&#x2F;code&gt;: This &lt;strong&gt;OPTIONAL&lt;&#x2F;strong&gt; method is used to query the URIs of the schema for the RDF data. RDF Schema is an extension of the basic RDF vocabulary and provides a data-modelling vocabulary for RDF data. It is &lt;strong&gt;RECOMMENDED&lt;&#x2F;strong&gt; to store the RDF Schema in decentralized storage such as Arweave or IPFS. The URIs are then stored in the contract and can be queried by this method.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;event-specification&quot;&gt;Event Specification&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;CreateRDF&lt;&#x2F;code&gt;: When minting a Semantic Soulbound Token, this event &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be triggered to notify the listener to perform operations with the created RDF data. When calling the event, the input RDF data &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be RDF statements, which are units of information consisting of three parts: a subject, a predicate, and an object.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;UpdateRDF&lt;&#x2F;code&gt;: When updating RDF data for a Semantic Soulbound Token, this event &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be triggered to notify the listener to perform update operations accordingly with the updated RDF data. When calling the event, the input RDF data &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be RDF statements, which are units of information consisting of three parts: a subject, a predicate, and an object.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;RemoveRDF&lt;&#x2F;code&gt;: When burning or revoking a Semantic Soulbound Token, this event &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be triggered to notify the listener to perform operations with the removed RDF data for the Semantic SBT. When calling the event, the input RDF data &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be RDF statements, which are units of information consisting of three parts: a subject, a predicate, and an object.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;RDF is a flexible and extensible data model based on creating subject-predicate-object relationships, often used to model graph data due to its semantic web standards, Linked Data concept, flexibility, and query capabilities. RDF allows graph data to be easily integrated with other data sources on the web, making it possible to create more comprehensive and interoperable models. The advantage of using RDF for semantic description is that it can describe richer information, including terms, categories, properties, and relationships. RDF uses standard formats and languages to describe metadata, making the expression of semantic information more standardized and unified. This helps to establish more accurate and reliable semantic networks, promoting interoperability between different systems. Additionally, RDF supports semantic reasoning, which allows the system to automatically infer additional relationships and connections between nodes in the social graph based on the existing data.&lt;&#x2F;p&gt;
&lt;p&gt;There are multiple formats for RDF statements. We list six most widely adopted RDF statement formats in the EIP: &lt;code&gt;Turtle&lt;&#x2F;code&gt;, &lt;code&gt;N-Triples&lt;&#x2F;code&gt;, &lt;code&gt;RDF&#x2F;XML&lt;&#x2F;code&gt;, &lt;code&gt;RDF&#x2F;JSON&lt;&#x2F;code&gt;,&lt;code&gt;N-Quads&lt;&#x2F;code&gt;, and &lt;code&gt;TriG&lt;&#x2F;code&gt;. These formats have different advantages and applicability in expressing, storing, and parsing RDF statements. Among these, &lt;code&gt;Turtle&lt;&#x2F;code&gt; is a popular format in RDF statements, due to its good human-readability and concision. It is typically used as the default format in this EIP for RDF statements. Using the Turtle format can make RDF statements easier to understand and maintain, while reducing the need for storage, suitable for representing complex RDF graphs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal is fully backward compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5192&#x2F;&quot;&gt;ERC-5192&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;There are no security considerations related directly to the implementation of this standard.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Contracts Dependencies Registry</title>
        <published>2022-12-27T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Artem Chystiakov</name><uri>https://github.com/arvolear</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6224/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6224-contracts-dependencies-registry/12316" />
        

        <id>https://wg-eips.ritovision.com/6224/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="last-call"
                label="Last Call" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:6224"
            label="ERC-6224" />
        

        
        

        
        <summary type="html">A registry for managing smart contracts with their dependencies.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6224/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces an on-chain registry system that a decentralized protocol may use to manage its smart contracts.&lt;&#x2F;p&gt;
&lt;p&gt;The proposed system consists of two components: &lt;code&gt;ContractsRegistry&lt;&#x2F;code&gt; and &lt;code&gt;Dependant&lt;&#x2F;code&gt;. The &lt;code&gt;ContractsRegistry&lt;&#x2F;code&gt; contract stores references to every smart contract used within a protocol, optionally making them upgradeable by deploying self-managed proxies on top, and acts as a hub the &lt;code&gt;Dependant&lt;&#x2F;code&gt; contracts query to fetch their required dependencies from.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;In the ever-growing Ethereum ecosystem, projects tend to become more and more complex. Modern protocols require portability and agility to satisfy customer needs by continuously delivering new features and staying on pace with the industry. However, the requirement is hard to achieve due to the immutable nature of blockchains and smart contracts. Moreover, the increased complexity and continuous delivery bring bugs and entangle the dependencies between the contracts, making systems less supportable.&lt;&#x2F;p&gt;
&lt;p&gt;Applications that have a clear architectural facade; which are designed with forward compatibility in mind; which dependencies are transparent and clean are easier to develop and maintain. The given EIP tries to solve the aforementioned problems by presenting two smart contracts: the &lt;code&gt;ContractsRegistry&lt;&#x2F;code&gt; and the &lt;code&gt;Dependant&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The advantages of using the provided system might be:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Structured smart contracts management via specialized contracts.&lt;&#x2F;li&gt;
&lt;li&gt;Ad-hoc upgradeability provision of a protocol.&lt;&#x2F;li&gt;
&lt;li&gt;Runtime addition, removal, and substitution of smart contracts.&lt;&#x2F;li&gt;
&lt;li&gt;Dependency injection mechanism to keep smart contracts&#x27; dependencies under control.&lt;&#x2F;li&gt;
&lt;li&gt;Ability to specify custom access control rules to maintain the protocol.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;overview&quot;&gt;Overview&lt;&#x2F;h3&gt;
&lt;p&gt;The system consists of two smart contracts:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ContractsRegistry&lt;&#x2F;code&gt; that is a singleton registry to manage and upgrade a protocol&#x27;s smart contracts.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Dependant&lt;&#x2F;code&gt; that is a mix-in which enables a dependency injection mechanism.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The following diagram depicts the relationship between the registry and its dependants:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6224&#x2F;.&#x2F;assets&#x2F;diagram.svg&quot; alt=&quot;&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;contractsregistry&quot;&gt;ContractsRegistry&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;ContractsRegistry&lt;&#x2F;code&gt; is the main contract of the proposed system. It MUST store the references to every standalone contract used within a protocol. The &lt;code&gt;ContractRegistry&lt;&#x2F;code&gt; MAY be configured to deploy a proxy contract of choice on top of the registered contracts.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, the &lt;code&gt;ContractsRegistry&lt;&#x2F;code&gt; MUST reject the registration of zero addresses.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;ContractsRegistry&lt;&#x2F;code&gt; MUST implement the following interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IContractsRegistry&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The event that is emitted when the contract gets added to the registry&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; name&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the name of the contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contractAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the address of the added contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ContractAdded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contractAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The event that is emitted when the proxy contract gets added to the registry&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; name&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the name of the contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contractAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the address of the proxy contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; implementation&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the address of the implementation contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ProxyContractAdded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contractAddress&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; implementation&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The event that is emitted when the proxy contract gets upgraded through the registry&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; name&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the name of the contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; newImplementation&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the address of the new implementation contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ProxyContractUpgraded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newImplementation&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The event that is emitted when the contract gets removed from the registry&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; name&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the name of the removed contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ContractRemoved&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The function that returns an associated contract by the name. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST revert if the requested contract is `address(0)`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; name&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the name of the contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address of the contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The function that checks if a contract with a given name has been added&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; name&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the name of the contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; true&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if the contract is present in the registry&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; hasContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The function that injects dependencies into the given contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST call the `setDependencies()` with `address(this)` and `bytes(&amp;quot;&amp;quot;)` as arguments on the provided contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; name&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the name of the contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; injectDependencies&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The function that injects dependencies into the given contract with extra data.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST call the `setDependencies()` with `address(this)` and `data` as arguments on the provided contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; name&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the name of the contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the extra context data that will be passed to the dependant contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; injectDependenciesWithData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The function that upgrades added proxy contract with a new implementation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * It is the Owner&amp;#39;s responsibility to ensure the compatibility between implementations.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST emit `ProxyContractUpgraded` event&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; name&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the name of the proxy contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; newImplementation&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the new implementation the proxy will be upgraded to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; upgradeContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newImplementation&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The function that upgrades added proxy contract with a new implementation, providing data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * It is the Owner&amp;#39;s responsibility to ensure the compatibility between implementations.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST emit `ProxyContractUpgraded` event&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; name&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the name of the proxy contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; newImplementation&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the new implementation the proxy will be upgraded to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the data that the proxy will be called with after upgrade. This can be an ABI encoded function call&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; upgradeContractAndCall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newImplementation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The function that adds pure (non-proxy) contracts to the `ContractsRegistry`. The contracts MAY either be&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * the ones the system does not have direct upgradeability control over or those that are not upgradeable by design.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST emit `ContractAdded` event. Reverts if the provided address is `address(0)`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; name&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the name to associate the contract with&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contractAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the address of the contract to be added&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contractAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The function that adds the proxy contracts to the registry by deploying them above the provided implementation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * The function may be used to add a contract that the `ContractsRegistry` has to be able to upgrade.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST emit `ProxyContractAdded` event. Reverts if implementation address is `address(0)`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; name&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the name to associate the contract with&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contractAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the address of the implementation to point the proxy to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addProxyContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contractAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The function that adds the proxy contracts to the registry by deploying them above the provided implementation,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * providing data.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * The function may be used to add a contract that the `ContractsRegistry` has to be able to upgrade.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST emit `ProxyContractAdded` event. Reverts if implementation address is `address(0)`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; name&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the name to associate the contract with&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contractAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the address of the implementation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the data that the proxy will be called with. This can be an ABI encoded initialization call&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addProxyContractAndCall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contractAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The function that adds an already deployed proxy to the `ContractsRegistry`. It MAY be used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * when the system migrates to the new `ContractRegistry`. In that case, the new registry MUST have the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * credentials to upgrade the newly added proxies.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST emit `ProxyContractAdded` event. Reverts if implementation address is `address(0)`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; name&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the name to associate the contract with&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contractAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the address of the proxy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; justAddProxyContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contractAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The function to remove contracts from the ContractsRegistry.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * MUST emit `ContractRemoved` event. Reverts if the contract is already removed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; name&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the associated name with the contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; removeContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;dependant&quot;&gt;Dependant&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;ContractsRegistry&lt;&#x2F;code&gt; works together with the &lt;code&gt;Dependant&lt;&#x2F;code&gt; contract. Every standalone contract of a protocol MUST inherit &lt;code&gt;Dependant&lt;&#x2F;code&gt; in order to support the dependency injection mechanism.&lt;&#x2F;p&gt;
&lt;p&gt;The required dependencies MUST be set in the overridden &lt;code&gt;setDependencies&lt;&#x2F;code&gt; method, not in the &lt;code&gt;constructor&lt;&#x2F;code&gt; or &lt;code&gt;initializer&lt;&#x2F;code&gt; methods.&lt;&#x2F;p&gt;
&lt;p&gt;Only the injector MUST be able to call the &lt;code&gt;setDependencies&lt;&#x2F;code&gt; and &lt;code&gt;setInjector&lt;&#x2F;code&gt; methods. The initial injector will be a zero address, in that case, the call MUST NOT revert on access control checks.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;Dependant&lt;&#x2F;code&gt; contract MUST implement the following interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IDependant&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The function that is called from the `ContractsRegistry` to inject dependencies.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * The contract MUST perform a proper access check of `msg.sender`. The calls should only be possible from `ContractsRegistry`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contractsRegistry&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the registry to pull dependencies from&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the extra data that might provide additional application-specific context&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setDependencies&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contractsRegistry&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The function that sets the new dependency injector.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * The contract MUST perform a proper access check of `msg.sender`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; injector&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the new dependency injector&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setInjector&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; injector&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The function that gets the current dependency injector&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; current dependency injector&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getInjector&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;Dependant&lt;&#x2F;code&gt; contract MAY store the dependency injector (usually &lt;code&gt;ContractsRegistry&lt;&#x2F;code&gt;) address in the special slot &lt;code&gt;0x3d1f25f1ac447e55e7fec744471c4dab1c6a2b6ffb897825f9ea3d2e8c9be583&lt;&#x2F;code&gt; (obtained as &lt;code&gt;bytes32(uint256(keccak256(&quot;eip6224.dependant.slot&quot;)) - 1)&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;There are a few design decisions that have to be explicitly specified:&lt;&#x2F;p&gt;
&lt;h3 id=&quot;contractsregistry-rationale&quot;&gt;ContractsRegistry Rationale&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;contracts-identifier&quot;&gt;Contracts Identifier&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;string&lt;&#x2F;code&gt; contracts identifier is chosen over the &lt;code&gt;uint256&lt;&#x2F;code&gt; and &lt;code&gt;bytes32&lt;&#x2F;code&gt; to maintain code readability and reduce the human error chances when interacting with the &lt;code&gt;ContractsRegistry&lt;&#x2F;code&gt;. Being the topmost smart contract of a protocol, it MAY be typical for the users to interact with it via block explorers or DAOs. Clarity was prioritized over gas usage.&lt;&#x2F;p&gt;
&lt;p&gt;Due to the &lt;code&gt;string&lt;&#x2F;code&gt; identifier, the event parameters are not indexed. The &lt;code&gt;string indexed&lt;&#x2F;code&gt; parameter will become the &lt;code&gt;keccak256&lt;&#x2F;code&gt; hash of the contract name if it is larger than 32 bytes. This fact reduces readability, which was prioritized.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;reverts&quot;&gt;Reverts&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;getContract&lt;&#x2F;code&gt; view function reverts if the requested contract is &lt;code&gt;address(0)&lt;&#x2F;code&gt;. This is essential to minimize the risks of misinitialization of a protocol. Correct contracts SHOULD be added to the registry prior to any dependency injection actions.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;addContract&lt;&#x2F;code&gt;, &lt;code&gt;addProxyContract&lt;&#x2F;code&gt;, &lt;code&gt;addProxyContractAndCall&lt;&#x2F;code&gt;, and &lt;code&gt;justAddProxyContract&lt;&#x2F;code&gt; methods revert if the provided address is &lt;code&gt;address(0)&lt;&#x2F;code&gt; for the same risk minimization reason.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;dependant-rationale&quot;&gt;Dependant Rationale&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;dependencies&quot;&gt;Dependencies&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;data&lt;&#x2F;code&gt; parameter is provided to carry additional application-specific context. It MAY be used to extend the method&#x27;s behavior.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;injector&quot;&gt;Injector&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;setInjector&lt;&#x2F;code&gt; function is made &lt;code&gt;external&lt;&#x2F;code&gt; to support the dependency injection mechanism for factory-made contracts. However, the method SHOULD be used with extra care.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;blockquote&gt;
&lt;p&gt;Note that the reference implementation depends on OpenZeppelin contracts &lt;code&gt;4.9.2&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h3 id=&quot;contractsregistry-implementation&quot;&gt;ContractsRegistry Implementation&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Address&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;utils&#x2F;Address.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;TransparentUpgradeableProxy&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;proxy&#x2F;transparent&#x2F;TransparentUpgradeableProxy.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;OwnableUpgradeable&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts-upgradeable&#x2F;access&#x2F;OwnableUpgradeable.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Dependant&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;Dependant.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IContractsRegistry&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ContractAdded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contractAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ProxyContractAdded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contractAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; implementation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ProxyContractUpgraded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newImplementation&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ContractRemoved&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; hasContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; injectDependencies&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; injectDependenciesWithData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; upgradeContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newImplementation&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; upgradeContractAndCall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newImplementation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contractAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addProxyContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contractAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addProxyContractAndCall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contractAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; justAddProxyContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contractAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; removeContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ProxyUpgrader&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    using&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; immutable&lt;&#x2F;span&gt;&lt;span&gt; _OWNER&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    modifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _onlyOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        _&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _OWNER &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; upgrade&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; what_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;data_&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            TransparentUpgradeableProxy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;payable&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;what_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;upgradeToAndCall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;to_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; data_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            TransparentUpgradeableProxy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;payable&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;what_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;upgradeTo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;to_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getImplementation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; what_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; bytes4(keccak256(&amp;quot;implementation()&amp;quot;)) == 0x5c60da1b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt; success_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; returndata_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;what_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;staticcall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;5c60da1b&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;success_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ProxyUpgrader: not a proxy&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;decode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;returndata_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _onlyOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_OWNER &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ProxyUpgrader: not an owner&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ContractsRegistry&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IContractsRegistry&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;OwnableUpgradeable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ProxyUpgrader &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;private&lt;&#x2F;span&gt;&lt;span&gt; _proxyUpgrader&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _contracts&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _isProxy&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; __ContractsRegistry_init&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; initializer&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _proxyUpgrader &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ProxyUpgrader&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        __Ownable_init&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; contractAddress_ &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _contracts&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;name_&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            contractAddress_ &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;ContractsRegistry: this mapping doesn&amp;#39;t exist&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; contractAddress_&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; hasContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _contracts&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;name_&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getProxyUpgrader&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_proxyUpgrader&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; injectDependencies&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        injectDependenciesWithData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;name_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; injectDependenciesWithData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        public&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        virtual&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        onlyOwner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; contractAddress_ &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _contracts&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;name_&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            contractAddress_ &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;ContractsRegistry: this mapping doesn&amp;#39;t exist&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        Dependant dependant_ &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Dependant&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;contractAddress_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        dependant_&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;setDependencies&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; data_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; upgradeContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newImplementation_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        public&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        virtual&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        onlyOwner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        upgradeContractAndCall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;name_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; newImplementation_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; upgradeContractAndCall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newImplementation_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data_&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; contractToUpgrade_ &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _contracts&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;name_&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            contractToUpgrade_ &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;ContractsRegistry: this mapping doesn&amp;#39;t exist&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            _isProxy&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;contractToUpgrade_&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;ContractsRegistry: not a proxy contract&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _proxyUpgrader&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;upgrade&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;contractToUpgrade_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; newImplementation_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; data_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ProxyContractUpgraded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;name_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; newImplementation_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contractAddress_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        public&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        virtual&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        onlyOwner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            contractAddress_ &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;ContractsRegistry: zero address is forbidden&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _contracts&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;name_&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; contractAddress_&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ContractAdded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;name_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; contractAddress_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addProxyContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contractAddress_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        public&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        virtual&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        onlyOwner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        addProxyContractAndCall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;name_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; contractAddress_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addProxyContractAndCall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contractAddress_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data_&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            contractAddress_ &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;ContractsRegistry: zero address is forbidden&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; proxyAddr_ &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _deployProxy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            contractAddress_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_proxyUpgrader&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            data_&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _contracts&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;name_&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; proxyAddr_&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _isProxy&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;proxyAddr_&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ProxyContractAdded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;name_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; proxyAddr_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; contractAddress_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; justAddProxyContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contractAddress_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        public&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        virtual&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        onlyOwner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            contractAddress_ &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;ContractsRegistry: zero address is forbidden&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _contracts&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;name_&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; contractAddress_&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _isProxy&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;contractAddress_&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ProxyContractAdded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            name_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            contractAddress_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            _proxyUpgrader&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getImplementation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;contractAddress_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; removeContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; contractAddress_ &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _contracts&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;name_&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            contractAddress_ &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;ContractsRegistry: this mapping doesn&amp;#39;t exist&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        delete&lt;&#x2F;span&gt;&lt;span&gt; _isProxy&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;contractAddress_&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        delete&lt;&#x2F;span&gt;&lt;span&gt; _contracts&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;name_&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ContractRemoved&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;name_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _deployProxy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contractAddress_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; admin_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data_&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransparentUpgradeableProxy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;contractAddress_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; admin_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; data_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;dependant-implementation&quot;&gt;Dependant Implementation&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IDependant&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setDependencies&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contractsRegistry&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setInjector&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; injector&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getInjector&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;abstract&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Dependant&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IDependant&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; bytes32(uint256(keccak256(&amp;quot;eip6224.dependant.slot&amp;quot;)) - 1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; _INJECTOR_SLOT &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        0x3d1f25f1ac447e55e7fec744471c4dab1c6a2b6ffb897825f9ea3d2e8c9be583&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    modifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; dependant&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _checkInjector&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        _&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _setInjector&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setDependencies&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contractsRegistry_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setInjector&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; injector_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _checkInjector&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _setInjector&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;injector_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getInjector&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; injector_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; slot_ &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _INJECTOR_SLOT&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            injector_ &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;slot_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _setInjector&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; injector_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; slot_ &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _INJECTOR_SLOT&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;slot_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; injector_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _checkInjector&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; injector_ &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getInjector&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;injector_ &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span&gt; injector_ &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Dependant: not an injector&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;It is crucial for the owner of &lt;code&gt;ContractsRegistry&lt;&#x2F;code&gt; to keep their keys in a safe place. The loss&#x2F;leakage of credentials to the &lt;code&gt;ContractsRegistry&lt;&#x2F;code&gt; will lead to the application&#x27;s point of no return. The &lt;code&gt;ContractRegistry&lt;&#x2F;code&gt; is a cornerstone of a protocol, access must be granted to the trusted parties only.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;contractsregistry-security&quot;&gt;ContractsRegistry Security&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;ContractsRegistry&lt;&#x2F;code&gt; does not perform any upgradeability checks between the proxy upgrades. It is the user&#x27;s responsibility to make sure that the new implementation is compatible with the old one.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;dependant-security&quot;&gt;Dependant Security&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;Dependant&lt;&#x2F;code&gt; contract MUST set its dependency injector no later than the first call to the &lt;code&gt;setDependencies&lt;&#x2F;code&gt; function is made. That being said, it is possible to front-run the first dependency injection.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EOF - JUMPF and non-returning functions</title>
        <published>2022-12-21T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Andrei Maiboroda</name><uri>https://github.com/gumb0</uri>
	</author>
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	<author>
		<name>Paweł Bylica</name><uri>https://github.com/chfast</uri>
	</author>
	
	<author>
		<name>Matt Garnett</name><uri>https://github.com/lightclient</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6206/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-4750-eof-functions/8195" />
        

        <id>https://wg-eips.ritovision.com/6206/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:6206"
            label="EIP-6206" />
        

        
        

        
        <summary type="html">Introduces instruction for chaining function calls.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6206/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP allows for tail call optimizations in EOF functions (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4750&#x2F;&quot;&gt;EIP-4750&lt;&#x2F;a&gt;) by introducing a new instruction &lt;code&gt;JUMPF&lt;&#x2F;code&gt;, which jumps to a code section without adding a new return stack frame.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally the format of the type sections is extended to allow declaring sections as non-returning, with simplified stack validation for &lt;code&gt;JUMPF&lt;&#x2F;code&gt; to such section.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;It is common for functions to make a call at the end of the routine only to then return. &lt;code&gt;JUMPF&lt;&#x2F;code&gt; optimizes this behavior by changing code sections without needing to update the return stack.&lt;&#x2F;p&gt;
&lt;p&gt;Knowing at validation time that a function will never return control allows for &lt;code&gt;JUMPF&lt;&#x2F;code&gt; to such function to be treated similar to terminating instructions, where extra items may be left on the operand stack at execution termination. This provides opportunities for compilers to generate more optimal code, both in code size and in spent gas. It is particularly beneficial for small error handling helpers, that end execution with &lt;code&gt;REVERT&lt;&#x2F;code&gt;: they are commonly reused in multiple branches and extracting them into a helper function is efficient, when there is no need to pop extra stack items before &lt;code&gt;JUMPF&lt;&#x2F;code&gt; to such helper.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;type-section-changes&quot;&gt;Type section changes&lt;&#x2F;h3&gt;
&lt;p&gt;We define a non-returning section as one that cannot return control to its caller section.&lt;&#x2F;p&gt;
&lt;p&gt;Type section &lt;code&gt;outputs&lt;&#x2F;code&gt; field contains a special value &lt;code&gt;0x80&lt;&#x2F;code&gt; when corresponding code section is non-returning. See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6206&#x2F;#non-returning-status-validation&quot;&gt;Non-returning status validation&lt;&#x2F;a&gt; below for validation details.&lt;&#x2F;p&gt;
&lt;p&gt;The first code section MUST have 0 inputs and be non-returning.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;execution-semantics&quot;&gt;Execution Semantics&lt;&#x2F;h3&gt;
&lt;p&gt;A new instruction, &lt;code&gt;JUMPF (0xe5)&lt;&#x2F;code&gt;, is introduced.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;JUMPF&lt;&#x2F;code&gt; has one immediate argument, &lt;code&gt;target_section_index&lt;&#x2F;code&gt;, encoded as a 16-bit unsigned big-endian value.&lt;&#x2F;li&gt;
&lt;li&gt;If the operand stack size exceeds &lt;code&gt;1024 - type[target_section_index].max_stack_increase&lt;&#x2F;code&gt; (i.e. if the called function may exceed the global stack height limit), execution results in an exceptional halt. This guarantees that the target function does not exceed global stack height limit.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;JUMPF&lt;&#x2F;code&gt; sets &lt;code&gt;current_section_index&lt;&#x2F;code&gt; to &lt;code&gt;target_section_index&lt;&#x2F;code&gt; and &lt;code&gt;PC&lt;&#x2F;code&gt; to &lt;code&gt;0&lt;&#x2F;code&gt;, but does not change the return stack. Execution continues in the target section.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;JUMPF&lt;&#x2F;code&gt; costs 5 gas.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;JUMPF&lt;&#x2F;code&gt; neither pops nor pushes anything to the operand stack.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;If the code is legacy bytecode, &lt;code&gt;JUMPF&lt;&#x2F;code&gt; instruction results in an &lt;em&gt;exceptional halt&lt;&#x2F;em&gt;. (&lt;em&gt;Note: This means no change to behaviour.&lt;&#x2F;em&gt;)&lt;&#x2F;p&gt;
&lt;h3 id=&quot;code-validation&quot;&gt;Code Validation&lt;&#x2F;h3&gt;
&lt;p&gt;Let the definition of &lt;code&gt;type[i]&lt;&#x2F;code&gt; be inherited from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4750&#x2F;&quot;&gt;EIP-4750&lt;&#x2F;a&gt; and define &lt;code&gt;stack_height_min&lt;&#x2F;code&gt; and &lt;code&gt;stack_height_max&lt;&#x2F;code&gt; to be the stack height bounds at a certain instruction during the instruction flow traversal.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The immediate argument of &lt;code&gt;JUMPF&lt;&#x2F;code&gt; MUST be less than the total number of code sections.&lt;&#x2F;li&gt;
&lt;li&gt;For each &lt;code&gt;JUMPF&lt;&#x2F;code&gt; instruction:
&lt;ul&gt;
&lt;li&gt;either &lt;code&gt;type[current_section_index].outputs&lt;&#x2F;code&gt; MUST be greater or equal &lt;code&gt;type[target_section_index].outputs&lt;&#x2F;code&gt;,&lt;&#x2F;li&gt;
&lt;li&gt;or &lt;code&gt;type[target_section_index].outputs&lt;&#x2F;code&gt; MUST be &lt;code&gt;0x80&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The stack height validation at &lt;code&gt;JUMPF&lt;&#x2F;code&gt; depends on whether the target section is non-returning:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;JUMPF&lt;&#x2F;code&gt; into returning section (&lt;code&gt;type[target_section_index].outputs&lt;&#x2F;code&gt; does not equal &lt;code&gt;0x80&lt;&#x2F;code&gt;):  &lt;code&gt;stack_height_min&lt;&#x2F;code&gt; and &lt;code&gt;stack_height_max&lt;&#x2F;code&gt; MUST be equal to &lt;code&gt;type[current_section_index].outputs - type[target_section_index].outputs + type[target_section_index].inputs&lt;&#x2F;code&gt;. This means that target section can output less stack elements than the original code section called by the top element on the return stack, if the current code section leaves the delta &lt;code&gt;type[current_section_index].outputs - type[target_section_index].outputs&lt;&#x2F;code&gt; element(s) on the stack.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;JUMPF&lt;&#x2F;code&gt; into non-returning section (&lt;code&gt;type[target_section_index].outputs&lt;&#x2F;code&gt; equals &lt;code&gt;0x80&lt;&#x2F;code&gt;): &lt;code&gt;stack_height_min&lt;&#x2F;code&gt; MUST be greater than or equal to &lt;code&gt;type[target_section_index].inputs&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Stack overflow check at &lt;code&gt;JUMPF&lt;&#x2F;code&gt;: &lt;code&gt;stack_height_max&lt;&#x2F;code&gt; MUST be less than or equal to &lt;code&gt;1024 - types[target_section_index].max_stack_increase&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;JUMPF&lt;&#x2F;code&gt; is considered terminating instruction, i.e. does not have successor instructions in code validation and MAY be final instruction in the section.&lt;&#x2F;li&gt;
&lt;li&gt;The code validation defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4200&#x2F;&quot;&gt;EIP-4200&lt;&#x2F;a&gt; also fails if any &lt;code&gt;RJUMP*&lt;&#x2F;code&gt; offset points to one of the two bytes directly following a &lt;code&gt;JUMPF&lt;&#x2F;code&gt; instruction.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;code&gt;CALLF&lt;&#x2F;code&gt; instruction validation is extended to include the rule:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Code section is invalid in case an immediate argument &lt;code&gt;target_section_index&lt;&#x2F;code&gt; of any &lt;code&gt;CALLF&lt;&#x2F;code&gt; targets a non-returning section, i.e. &lt;code&gt;type[target_section_index].outputs&lt;&#x2F;code&gt; equals &lt;code&gt;0x80&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;non-returning-status-validation&quot;&gt;Non-returning status validation&lt;&#x2F;h4&gt;
&lt;p&gt;Section type MUST be non-returning if and only if the section contains no &lt;code&gt;RETF&lt;&#x2F;code&gt; instructions and no &lt;code&gt;JUMPF&lt;&#x2F;code&gt; instructions targeting returning sections (target section&#x27;s status is checked via its output value in type section.)
&lt;em&gt;Note: This implies that section containing only &lt;code&gt;JUMPF&lt;&#x2F;code&gt;s into non-returning sections is non-returning itself.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;allowing-jumpf-to-section-with-less-outputs&quot;&gt;Allowing &lt;code&gt;JUMPF&lt;&#x2F;code&gt; to section with less outputs&lt;&#x2F;h3&gt;
&lt;p&gt;An alternative rule for &lt;code&gt;JUMPF&lt;&#x2F;code&gt; stack validation could require the target section&#x27;s outputs to be exactly equal to the current section&#x27;s outputs. Under such rule, a particular target section (a shared &quot;helper&quot; piece of code) would only &quot;match&quot; sections (requiring some shared &quot;helper&quot; code to execute before returning) &lt;em&gt;with the same number of outputs&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Instead, we allow a given &lt;code&gt;JUMPF&lt;&#x2F;code&gt; target section to be called from sections with more outputs, as long as these sections provide these extra stack elements (the &quot;delta&quot;) themselves. This will reduce duplicated code as it will allow compilers more flexibility during code generation such that certain helpers can be used generically by functions, regardless of their output values.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change is backward compatible as EOF does not allow undefined instructions to be used or deployed, meaning no contracts will be affected.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This new instruction needs to be carefully considered during implementation of the EOF container validation algorithm.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Tokenized Vaults with Lock-in Period</title>
        <published>2022-12-21T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Anderson Chen</name><uri>https://github.com/Ankarrr</uri>
	</author>
	
	<author>
		<name>Martinet Lee</name><email>martinetlee@gmail.com</email>
	</author>
	
	<author>
		<name>Anton Cheng</name><email>antonassocareer@gmail.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6229/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-tokenized-vaults-with-lock-in-period/12298" />
        

        <id>https://wg-eips.ritovision.com/6229/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:6229"
            label="ERC-6229" />
        

        
        

        
        <summary type="html">ERC-4626 Tokenized Vaults with Lock-in Period.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6229/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard extends &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4626&#x2F;&quot;&gt;EIP-4626&lt;&#x2F;a&gt; to support lock-in periods.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4626&#x2F;&quot;&gt;EIP-4626&lt;&#x2F;a&gt; standard defines a tokenized vault allowing users (contracts or EOAs) to deposit and withdraw underlying tokens at any time. However, there exist cases where the vault needs to lock the underlying tokens (perhaps to execute certain strategies). During the lock-in period, neither withdrawals nor deposits should be allowed. This standard extends the EIP-4626 to support lock-in periods and handle scheduled deposits and withdrawals during them.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;All vaults that follow this EIP MUST implement &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4626&#x2F;&quot;&gt;EIP-4626&lt;&#x2F;a&gt; to provide basic vault functions and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;EIP-20&lt;&#x2F;a&gt; to represent shares.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;asset: The underlying &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;EIP-20&lt;&#x2F;a&gt; token that the vault accepts and manages.&lt;&#x2F;li&gt;
&lt;li&gt;share: The EIP-20 token that the vault issued.&lt;&#x2F;li&gt;
&lt;li&gt;locked: A status of the vault. When the vault is locked, user can’t withdraw or deposit assets from the vault.&lt;&#x2F;li&gt;
&lt;li&gt;unlocked: A status of the vault. When the vault is unlocked, user can withdraw or deposit assets from the vault.&lt;&#x2F;li&gt;
&lt;li&gt;round: The period that the vault is locked.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;view-methods&quot;&gt;View Methods&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;islocked&quot;&gt;isLocked&lt;&#x2F;h4&gt;
&lt;p&gt;The current state of the vault.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;true&lt;&#x2F;code&gt; represents a vault is in the locked state, and &lt;code&gt;false&lt;&#x2F;code&gt; represents a vault is in the unlocked state.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;sLocked&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ool&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;sLocked&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ool&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;vaultround&quot;&gt;vaultRound&lt;&#x2F;h4&gt;
&lt;p&gt;The current round of the vault.&lt;&#x2F;p&gt;
&lt;p&gt;MUST start with &lt;code&gt;0&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST add &lt;code&gt;1&lt;&#x2F;code&gt; each time a new round starts, that is, when the &lt;code&gt;isLocked&lt;&#x2F;code&gt; becomes true. MUST NOT be modified in any other circumstances.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;aultRound&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;aultRound&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;methods&quot;&gt;Methods&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;scheduledeposit&quot;&gt;scheduleDeposit&lt;&#x2F;h4&gt;
&lt;p&gt;Schedule the intent to deposit &lt;code&gt;assets&lt;&#x2F;code&gt; when the &lt;code&gt;isLocked&lt;&#x2F;code&gt; is true.&lt;&#x2F;p&gt;
&lt;p&gt;MUST only be callable when the &lt;code&gt;isLocked&lt;&#x2F;code&gt; is true.&lt;&#x2F;p&gt;
&lt;p&gt;MUST transfer the &lt;code&gt;assets&lt;&#x2F;code&gt; from the caller to the vault. MUST not issue new shares.&lt;&#x2F;p&gt;
&lt;p&gt;MUST revert if &lt;code&gt;assets&lt;&#x2F;code&gt; cannot be deposited.&lt;&#x2F;p&gt;
&lt;p&gt;MUST revert if the &lt;code&gt;isLocked&lt;&#x2F;code&gt; is false.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;cheduleDeposit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;onpayable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ssets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;scheduleredeem&quot;&gt;scheduleRedeem&lt;&#x2F;h4&gt;
&lt;p&gt;Schedule the intent to redeem &lt;code&gt;shares&lt;&#x2F;code&gt; from the vault when the &lt;code&gt;isLocked&lt;&#x2F;code&gt; is true.&lt;&#x2F;p&gt;
&lt;p&gt;MUST only be callable when the &lt;code&gt;isLocked&lt;&#x2F;code&gt; is true.&lt;&#x2F;p&gt;
&lt;p&gt;MUST transfer the &lt;code&gt;shares&lt;&#x2F;code&gt; from the caller to the vault. MUST not transfer assets to caller.&lt;&#x2F;p&gt;
&lt;p&gt;MUST revert if &lt;code&gt;shares&lt;&#x2F;code&gt; cannot be redeemed.&lt;&#x2F;p&gt;
&lt;p&gt;MUST revert if the &lt;code&gt;isLocked&lt;&#x2F;code&gt; is false.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;cheduleRedeem&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;onpayable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;hares&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;settledeposits&quot;&gt;settleDeposits&lt;&#x2F;h4&gt;
&lt;p&gt;Process all scheduled deposits for &lt;code&gt;depositor&lt;&#x2F;code&gt; and minting &lt;code&gt;newShares&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST only be callable when the &lt;code&gt;isLocked&lt;&#x2F;code&gt; is false.&lt;&#x2F;p&gt;
&lt;p&gt;MUST issue &lt;code&gt;newShares&lt;&#x2F;code&gt; according to the current share price for the scheduled &lt;code&gt;depositor&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST revert if there is no scheduled deposit for &lt;code&gt;depositor&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ettleDeposits&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;onpayable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; d&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;epositor&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ewShares&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;settleredemptions&quot;&gt;settleRedemptions&lt;&#x2F;h4&gt;
&lt;p&gt;Process all scheduled redemptions for &lt;code&gt;redeemer&lt;&#x2F;code&gt; by burning &lt;code&gt;burnShares&lt;&#x2F;code&gt; and transferring &lt;code&gt;redeemAssets&lt;&#x2F;code&gt; to the &lt;code&gt;redeemer&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST only be callable when the &lt;code&gt;isLocked&lt;&#x2F;code&gt; is false.&lt;&#x2F;p&gt;
&lt;p&gt;MUST burn the &lt;code&gt;burnShares&lt;&#x2F;code&gt; and transfer &lt;code&gt;redeemAssets&lt;&#x2F;code&gt; back to the &lt;code&gt;redeemer&lt;&#x2F;code&gt; according to the current share price.&lt;&#x2F;p&gt;
&lt;p&gt;MUST revert if no scheduled redemption for &lt;code&gt;redeemer&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ettleRedemptions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;onpayable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;edeemer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;urnShares&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;edeemAssets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;getscheduleddeposits&quot;&gt;getScheduledDeposits&lt;&#x2F;h4&gt;
&lt;p&gt;Get the &lt;code&gt;totalAssets&lt;&#x2F;code&gt; of scheduled deposits for &lt;code&gt;depositor&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST NOT revert.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; g&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;etScheduledDeposits&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; d&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;epositor&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;otalAssets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;getscheduledredemptions&quot;&gt;getScheduledRedemptions&lt;&#x2F;h4&gt;
&lt;p&gt;Get the &lt;code&gt;totalShares&lt;&#x2F;code&gt; of scheduled redemptions for &lt;code&gt;redeemer&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST NOT revert.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; g&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;etScheduledRedemptions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;edeemer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;otalShares&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;events&quot;&gt;Events&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;scheduledeposit-1&quot;&gt;ScheduleDeposit&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;sender&lt;&#x2F;code&gt; schedules a deposit with &lt;code&gt;assets&lt;&#x2F;code&gt; in this &lt;code&gt;round&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST be emitted via &lt;code&gt;scheduleDeposit&lt;&#x2F;code&gt; method.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; S&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;cheduleDeposit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;vent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ssets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ound&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;scheduleredeem-1&quot;&gt;ScheduleRedeem&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;sender&lt;&#x2F;code&gt; schedules a redemption with &lt;code&gt;shares&lt;&#x2F;code&gt; in this &lt;code&gt;round&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST be emitted via &lt;code&gt;scheduleRedeem&lt;&#x2F;code&gt; method.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; S&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;cheduleRedeem&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;vent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;hares&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ound&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;settledeposits-1&quot;&gt;SettleDeposits&lt;&#x2F;h4&gt;
&lt;p&gt;Settle scheduled deposits for &lt;code&gt;depositor&lt;&#x2F;code&gt; in this &lt;code&gt;round&lt;&#x2F;code&gt;. Issue &lt;code&gt;newShares&lt;&#x2F;code&gt; and transfer them to the &lt;code&gt;depositor&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST be emitted via &lt;code&gt;settleDeposits&lt;&#x2F;code&gt; method.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; S&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ettleDeposits&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;vent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; d&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;epositor&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ewShares&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ound&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;settleredemptions-1&quot;&gt;SettleRedemptions&lt;&#x2F;h4&gt;
&lt;p&gt;Settle scheduled redemptions for &lt;code&gt;redeemer&lt;&#x2F;code&gt; in this &lt;code&gt;round&lt;&#x2F;code&gt;. Burn &lt;code&gt;burnShares&lt;&#x2F;code&gt; and transfer &lt;code&gt;redeemAssets&lt;&#x2F;code&gt; back to the &lt;code&gt;redeemer&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST be emitted via &lt;code&gt;settleRedemptions&lt;&#x2F;code&gt; method.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; S&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ettleRedemptions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;vent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;edeemer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;urnShares&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;edeemAssets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ound&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The standard is designed to be a minimal interface. Details such as the start and end of a lock-in period, and how the underlying tokens are being used during the lock-in period are not specified.&lt;&#x2F;p&gt;
&lt;p&gt;There is no function for scheduling a withdrawal, since during the lock-in period, the share price is undetermined, so it is impossible to determine how many underlying tokens can be withdrawn.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;deposit&lt;&#x2F;code&gt;, &lt;code&gt;mint&lt;&#x2F;code&gt;, &lt;code&gt;withdraw&lt;&#x2F;code&gt;, &lt;code&gt;redeem&lt;&#x2F;code&gt; methods for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4626&#x2F;&quot;&gt;EIP-4626&lt;&#x2F;a&gt; should revert when the &lt;code&gt;isLocked&lt;&#x2F;code&gt; is true to prevent issuing or burning shares with an undefined share price.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Implementors need to be aware of unsettled scheduled deposits and redemptions. If a user has scheduled a deposit or redemption but does not settle when the &lt;code&gt;isLocked&lt;&#x2F;code&gt; is false, and then settles it after several rounds, the vault will process it with an incorrect share price. We didn’t specify the solution in the standard since there are many possible ways to solve this issue and we think implementors should decide the solution according to their use cases. For example:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Not allow the &lt;code&gt;isLocked&lt;&#x2F;code&gt; to become true if there is any unsettled scheduled deposit or redemption&lt;&#x2F;li&gt;
&lt;li&gt;Force settling the scheduled deposits or redemptions when the &lt;code&gt;isLocked&lt;&#x2F;code&gt; becomes true&lt;&#x2F;li&gt;
&lt;li&gt;Memorize the ending share price for each round and let the users settle according to the share prices&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Nonce Cap</title>
        <published>2022-12-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Gavin John</name><uri>https://github.com/Pandapip1</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6188/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6190-functional-selfdestruct/12232" />
        

        <id>https://wg-eips.ritovision.com/6188/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:6188"
            label="EIP-6188" />
        

        
        

        
        <summary type="html">Caps the nonce at 2^64-2</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6188/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP caps the nonce at &lt;code&gt;2^64-2&lt;&#x2F;code&gt;, reserving it for contracts with unusual behavior, as defined in other EIPs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is not terribly useful on its own, as it adds additional computation without any useful side effects. However, it can be used by other EIPs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;eoa-transactions&quot;&gt;EOA Transactions&lt;&#x2F;h3&gt;
&lt;p&gt;The nonce of a transaction originating from an EOA MUST be less than &lt;code&gt;2^64-2&lt;&#x2F;code&gt;. If the nonce is either &lt;code&gt;2^64-1&lt;&#x2F;code&gt; or &lt;code&gt;2^64-2&lt;&#x2F;code&gt;, the transaction MUST be invalid.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;create-and-create2&quot;&gt;&lt;code&gt;CREATE&lt;&#x2F;code&gt; and &lt;code&gt;CREATE2&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;If a nonce would be incremented to &lt;code&gt;2^64-1&lt;&#x2F;code&gt; by &lt;code&gt;CREATE&lt;&#x2F;code&gt; or &lt;code&gt;CREATE2&lt;&#x2F;code&gt;, it is instead set to &lt;code&gt;2^64-2&lt;&#x2F;code&gt;. &lt;code&gt;2^64-1&lt;&#x2F;code&gt; is reserved for alias or other special contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Capping a nonce allows for contracts with special properties to be created, with their functionality based on their contract code. As such, only one nonce needs to be reserved.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP requires a protocol upgrade, since it modifies consensus rules. The further restriction of nonce should not have an effect on accounts, as reaching a nonce of &lt;code&gt;2^64-2&lt;&#x2F;code&gt; is difficult.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;As it is not feasible for contract accounts to get to the nonce limit, any potential problems with opcodes that depend on the value of an account&#x27;s nonce can be safely ignored.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Alias Contracts</title>
        <published>2022-12-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Gavin John</name><uri>https://github.com/Pandapip1</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6189/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6190-functional-selfdestruct/12232" />
        

        <id>https://wg-eips.ritovision.com/6189/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:6189"
            label="EIP-6189" />
        

        
        

        
        <summary type="html">Allows the creation of contracts that forward calls to other contracts</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6189/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP allows contracts to be turned into &quot;alias contracts&quot; using a magic nonce. Alias contracts automatically forward calls to other contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is not terribly useful on its own, as it adds additional computation and gas costs without any useful side effects. However, in conjunction with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6190&#x2F;&quot;&gt;EIP-6190&lt;&#x2F;a&gt;, it can be used to make SELFDESTRUCT compatible with Verkle trees.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;p&gt;A contract is an alias contract if its nonce is &lt;code&gt;2^64-1&lt;&#x2F;code&gt;, and its contract code is equal to &lt;code&gt;0x1&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;prerequisites&quot;&gt;Prerequisites&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6188&#x2F;&quot;&gt;EIP-6188&lt;&#x2F;a&gt; MUST be used to protect the magic nonce value of &lt;code&gt;2^64-1&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;opcode-changes&quot;&gt;Opcode Changes&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;call-callcode-delegatecall-staticcall-pay-and-eoa-transactions&quot;&gt;&lt;code&gt;CALL&lt;&#x2F;code&gt;, &lt;code&gt;CALLCODE&lt;&#x2F;code&gt;, &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;, &lt;code&gt;STATICCALL&lt;&#x2F;code&gt;, &lt;code&gt;PAY&lt;&#x2F;code&gt;, and EOA Transactions&lt;&#x2F;h4&gt;
&lt;p&gt;The &quot;callee&quot; refers to the account that is being called or being paid.&lt;&#x2F;p&gt;
&lt;p&gt;If the nonce of the callee is &lt;code&gt;2^64-1&lt;&#x2F;code&gt;, the call MUST be forwarded to the address stored in the &lt;code&gt;0&lt;&#x2F;code&gt;th storage slot of the callee (as if the callee was the address stored in the &lt;code&gt;0&lt;&#x2F;code&gt;th storage slot of the callee). This MUST repeat until a non-alias contract is reached. The &lt;code&gt;CALLER&lt;&#x2F;code&gt; MUST remain unchanged.&lt;&#x2F;p&gt;
&lt;p&gt;If there is more than one alias contract in the chain, the original callee and all subsequent callees (except the last one) MUST have their &lt;code&gt;0&lt;&#x2F;code&gt;th storage slot set to the address of the final non-alias contract. Then, the call MUST be forwarded as usual. &lt;strong&gt;This MUST occur, even in a read-only context like &lt;code&gt;STATICCALL&lt;&#x2F;code&gt;.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;For example, if &lt;code&gt;A&lt;&#x2F;code&gt; is an alias contract that forwards calls to &lt;code&gt;B&lt;&#x2F;code&gt;, which is an alias contract that forwards calls to &lt;code&gt;C&lt;&#x2F;code&gt;, then &lt;code&gt;A&lt;&#x2F;code&gt;&#x27;s &lt;code&gt;0&lt;&#x2F;code&gt;th storage slot is set to &lt;code&gt;C&lt;&#x2F;code&gt;&#x27;s address. Then, the call is forwarded to &lt;code&gt;C&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Finally, the opcode MUST proceed as usual, using the final non-alias contract.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;CALL&lt;&#x2F;code&gt;, &lt;code&gt;CALLCODE&lt;&#x2F;code&gt;, &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;, and &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; opcodes and EOA Transactions MUST cost an &lt;code&gt;25&lt;&#x2F;code&gt; gas per account accessed in this manner (including the final one, and including if no aliased accounts were used), in addition to all the regular costs incurred by accessing accounts (see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;). For every account whose &lt;code&gt;0&lt;&#x2F;code&gt;th storage slot is updated, those opcodes MUST also cost an additional &lt;code&gt;5000&lt;&#x2F;code&gt; gas.&lt;&#x2F;p&gt;
&lt;p&gt;If an infinite loop occurs, the transaction MUST run out of gas and revert.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;extcodehash-extcodecopy-extcodesize-and-balance&quot;&gt;&lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt;, &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt;, &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt;, and &lt;code&gt;BALANCE&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &quot;accessed account&quot; refers to the account that is being accessed (i.e. the account whose code is being accessed, or the account whose balance is being accessed).&lt;&#x2F;p&gt;
&lt;p&gt;Similar to the &lt;code&gt;CALL&lt;&#x2F;code&gt; family of opcodes, if the nonce of the accessed account is &lt;code&gt;2^64-1&lt;&#x2F;code&gt;, the accessed account&#x27;s address MUST be replaced with the address stored in the &lt;code&gt;0&lt;&#x2F;code&gt;th storage slot of the accessed account. This MUST repeat until a non-alias contract is reached.&lt;&#x2F;p&gt;
&lt;p&gt;If there is more than one alias contract in the chain, the original accessed account and all subsequent accessed accounts (except the last one) MUST have their &lt;code&gt;0&lt;&#x2F;code&gt;th storage slot set to the address of the final non-alias contract. Then, the accessed account MUST be replaced as usual. &lt;strong&gt;This MUST occur, even in a read-only context like &lt;code&gt;STATICCALL&lt;&#x2F;code&gt;.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Finally, the opcode MUST proceed as usual, using the final non-alias contract.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt;, &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt;, &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt;, and &lt;code&gt;BALANCE&lt;&#x2F;code&gt; opcodes MUST cost an &lt;code&gt;25&lt;&#x2F;code&gt; gas per account accessed in this manner (including the final one, and including if no aliased accounts were used), in addition to all the regular costs incurred by accessing accounts (see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;). For every account whose &lt;code&gt;0&lt;&#x2F;code&gt;th storage slot is updated, those opcodes MUST also cost an additional &lt;code&gt;5000&lt;&#x2F;code&gt; gas.&lt;&#x2F;p&gt;
&lt;p&gt;If an infinite loop occurs, the transaction MUST run out of gas and revert.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;create-and-create2&quot;&gt;&lt;code&gt;CREATE&lt;&#x2F;code&gt; and &lt;code&gt;CREATE2&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;If &lt;code&gt;CREATE&lt;&#x2F;code&gt; or &lt;code&gt;CREATE2&lt;&#x2F;code&gt; would create (or fail to create, depending on which EIPs are used) an account at an address, and that account&#x27;s code is &lt;code&gt;0x1&lt;&#x2F;code&gt;, and its nonce is &lt;code&gt;2^64-1&lt;&#x2F;code&gt;, then instead of reverting, an attempt MUST be made to create a contract at the address stored in the &lt;code&gt;0&lt;&#x2F;code&gt;th storage slot of the existing account. This MUST repeat until a non-alias contract is reached.&lt;&#x2F;p&gt;
&lt;p&gt;If there is more than one alias contract in the chain, the original accessed account and all subsequent accessed accounts (except the last one) MUST have their &lt;code&gt;0&lt;&#x2F;code&gt;th storage slot set to the address of the final non-alias contract.&lt;&#x2F;p&gt;
&lt;p&gt;Finally, the opcode MUST proceed as usual, returning the address of the newly-created contract.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;CREATE&lt;&#x2F;code&gt; and &lt;code&gt;CREATE2&lt;&#x2F;code&gt; opcodes MUST cost an &lt;code&gt;25&lt;&#x2F;code&gt; gas per account accessed in this manner (including the final one, and including if no aliased accounts were used), in addition to all the regular costs incurred by accessing accounts (see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;). For every account whose &lt;code&gt;0&lt;&#x2F;code&gt;th storage slot is updated, those opcodes must also cost an additional &lt;code&gt;5000&lt;&#x2F;code&gt; gas.&lt;&#x2F;p&gt;
&lt;p&gt;If an infinite loop occurs, the transaction runs out of gas and reverts.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;address&quot;&gt;&lt;code&gt;ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;This opcode remains unchanged; &lt;code&gt;ADDRESS&lt;&#x2F;code&gt; points to the address that doesn&#x27;t have a nonce of &lt;code&gt;2^64-1&lt;&#x2F;code&gt;.33&lt;&#x2F;p&gt;
&lt;h3 id=&quot;transfers-to-the-zero-address&quot;&gt;Transfers to the zero address&lt;&#x2F;h3&gt;
&lt;p&gt;Transfers to the zero address continue to have the same effect as the &lt;code&gt;CREATE&lt;&#x2F;code&gt; opcode, and will cost extra gas as discussed in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6189&#x2F;#create-and-create2&quot;&gt;&lt;code&gt;CREATE&lt;&#x2F;code&gt; and &lt;code&gt;CREATE2&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; section.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;transaction-validity&quot;&gt;Transaction Validity&lt;&#x2F;h3&gt;
&lt;p&gt;The &quot;origin&quot; refers to the account that sent the transaction to be validated.&lt;&#x2F;p&gt;
&lt;p&gt;If the nonce of the origin is &lt;code&gt;2^64-1&lt;&#x2F;code&gt;, the origin MUST be updated to the address stored in the &lt;code&gt;0&lt;&#x2F;code&gt;th storage slot of the current origin (as if the origin was the address stored in the &lt;code&gt;0&lt;&#x2F;code&gt;th storage slot of the current origin). This MUST repeat until a non-alias contract is reached.&lt;&#x2F;p&gt;
&lt;p&gt;If there is more than one alias contract in the chain, the original origin and all subsequent origins (except the last one) MUST have their &lt;code&gt;0&lt;&#x2F;code&gt;th storage slot set to the address of the final non-alias contract. Then, the call MUST be forwarded as usual.&lt;&#x2F;p&gt;
&lt;p&gt;An additional &lt;code&gt;25&lt;&#x2F;code&gt; gas per account accessed in this manner (including the final one, and including if no aliased accounts were used), in addition to all the regular costs incurred by accessing accounts (see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;) is added to the validation costs. For every account whose &lt;code&gt;0&lt;&#x2F;code&gt;th storage slot is updated, it also costs an additional &lt;code&gt;5000&lt;&#x2F;code&gt; gas.&lt;&#x2F;p&gt;
&lt;p&gt;Finally, validation proceeds as normal.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;rpc-endpoint-changes&quot;&gt;RPC Endpoint Changes&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;eth-getstorageat&quot;&gt;&lt;code&gt;eth_getStorageAt&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;eth_getStorageAt&lt;&#x2F;code&gt; RPC endpoint must error if the target contract has a contract code of &lt;code&gt;0x1&lt;&#x2F;code&gt; and a nonce of &lt;code&gt;2^64-1&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The additional gas cost of &lt;code&gt;25&lt;&#x2F;code&gt; represents the cost of fetching the nonce and comparing it to the given value.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;eth_getStorageAt&lt;&#x2F;code&gt; was modified to throw an error because of alias contracts&#x27; special behavior.&lt;&#x2F;p&gt;
&lt;p&gt;The nonce of &lt;code&gt;2^64-1&lt;&#x2F;code&gt; was chosen since it is the nonce protected by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6188&#x2F;&quot;&gt;EIP-6188&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The contract code of &lt;code&gt;0x1&lt;&#x2F;code&gt; was chosen arbitrarily. A nonzero code was chosen just in case a non-alias contract with nonce &lt;code&gt;2^64-1&lt;&#x2F;code&gt; somehow had its code set to &lt;code&gt;0x0&lt;&#x2F;code&gt;, or an EOA had its nonce set to &lt;code&gt;2^64-1&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP requires a protocol upgrade, since it modifies consensus rules. No existing contracts should be affected, as they will not have a nonce of &lt;code&gt;2^64-1&lt;&#x2F;code&gt;, nor will they have the contract code &lt;code&gt;0x1&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The additional gas costs may cause potential DoS attacks if they access an arbitrary contract&#x27;s data or make frequent contract deactivations. Contract authors must be aware and design contracts accordingly. There may be an effect on existing deployed code performing autonomous destruction and revival.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Verkle-compatible SELFDESTRUCT</title>
        <published>2022-12-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Gavin John</name><uri>https://github.com/Pandapip1</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6190/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6190-functional-selfdestruct/12232" />
        

        <id>https://wg-eips.ritovision.com/6190/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:6190"
            label="EIP-6190" />
        

        
        

        
        <summary type="html">Changes SELFDESTRUCT to only cause a finite number of state changes</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6190/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Changes &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; to only cause a finite number of state changes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; instruction has a fixed price, but is unbounded in storage&#x2F;account changes (it needs to delete all keys). This has been an outstanding concern for some time.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore, with &lt;em&gt;Verkle trees&lt;&#x2F;em&gt; accounts will be organised differently. Account properties, including storage, would have individual keys. It would not be possible to traverse and find all used keys. This makes &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; very challenging to support in Verkle trees. This EIP is a step towards supporting &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; in Verkle trees.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;prerequisites&quot;&gt;Prerequisites&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6188&#x2F;&quot;&gt;EIP-6188&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6189&#x2F;&quot;&gt;EIP-6189&lt;&#x2F;a&gt; must be used for this EIP to function correctly.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;selfdestruct-behaviour&quot;&gt;&lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; Behaviour&lt;&#x2F;h3&gt;
&lt;p&gt;Instead of destroying the contract at the end of the transaction, instead, the following will occur at the end of the transaction in which it is invoked:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The contract&#x27;s code is set to &lt;code&gt;0x1&lt;&#x2F;code&gt;, and its nonce is set to &lt;code&gt;2^64-1&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The contract&#x27;s &lt;code&gt;0&lt;&#x2F;code&gt;th storage slot is set to the address that would be issued if the contract used the &lt;code&gt;CREATE&lt;&#x2F;code&gt; opcode (&lt;code&gt;keccak256(contractAddress, nonce)&lt;&#x2F;code&gt;). Note that the nonce is always &lt;code&gt;2^64-1&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If the contract was self-destructed after the call being forwarded by one or more alias contracts, the alias contract&#x27;s &lt;code&gt;0&lt;&#x2F;code&gt;th storage slot is set to the address calculated in step 2.&lt;&#x2F;li&gt;
&lt;li&gt;The contract&#x27;s balance is transferred, in its entirety, to the address on the top of the stack.&lt;&#x2F;li&gt;
&lt;li&gt;The top of the stack is popped.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;gas-cost-of-selfdestruct&quot;&gt;Gas Cost of &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The base gas cost of &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; is set to &lt;code&gt;5000&lt;&#x2F;code&gt;. The gas cost of &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; is increased by &lt;code&gt;5000&lt;&#x2F;code&gt; for each alias contract that forwarded to the contract being self-destructed. Finally, the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt; gas cost increase is applied.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is designed to be a step towards supporting &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; in Verkle trees while making the minimum amount of changes.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;5000&lt;&#x2F;code&gt; base gas cost and additional alias contracts represents the cost of setting the account nonce and first storage slot. The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt; gas cost increase is preserved for the reasons mentioned in said EIP&#x27;s Rationale.&lt;&#x2F;p&gt;
&lt;p&gt;The nonce of &lt;code&gt;2^64-1&lt;&#x2F;code&gt; was chosen since it is the nonce protected by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6188&#x2F;&quot;&gt;EIP-6188&lt;&#x2F;a&gt;. The account code of &lt;code&gt;0x1&lt;&#x2F;code&gt; was chosen since it was the code specified in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6189&#x2F;&quot;&gt;EIP-6189&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The address being the same as the one created by &lt;code&gt;CREATE&lt;&#x2F;code&gt; is designed to reduce possible attack vectors by not introducing a new mechanism by which accounts can be created at specific addresses.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP requires a protocol upgrade, since it modifies consensus rules.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Composable NFTs utilizing Equippable Parts</title>
        <published>2022-12-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Bruno Škvorc</name><uri>https://github.com/Swader</uri>
	</author>
	
	<author>
		<name>Cicada</name><uri>https://github.com/CicadaNCR</uri>
	</author>
	
	<author>
		<name>Steven Pineda</name><uri>https://github.com/steven2308</uri>
	</author>
	
	<author>
		<name>Stevan Bogosavljevic</name><uri>https://github.com/stevyhacker</uri>
	</author>
	
	<author>
		<name>Jan Turk</name><uri>https://github.com/ThunderDeliverer</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6220/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6220-composable-nfts-utilizing-equippable-parts/12289" />
        

        <id>https://wg-eips.ritovision.com/6220/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:6220"
            label="ERC-6220" />
        

        
        

        
        <summary type="html">An interface for Composable non-fungible tokens through fixed and slot parts equipping.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6220/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The Composable NFTs utilizing equippable parts standard extends &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; by allowing the NFTs to selectively add parts to themselves via equipping.&lt;&#x2F;p&gt;
&lt;p&gt;Tokens can be composed by cherry picking the list of parts from a Catalog for each NFT instance, and are able to equip other NFTs into slots, which are also defined within the Catalog. Catalogs contain parts from which NFTs can be composed.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal introduces two types of parts; slot type of parts and fixed type of parts. The slot type of parts allow for other NFT collections to be equipped into them, while fixed parts are full components with their own metadata.&lt;&#x2F;p&gt;
&lt;p&gt;Equipping a part into an NFT doesn&#x27;t generate a new token, but rather adds another component to be rendered when retrieving the token.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;With NFTs being a widespread form of tokens in the Ethereum ecosystem and being used for a variety of use cases, it is time to standardize additional utility for them. Having the ability for tokens to equip other tokens and be composed from a set of available parts allows for greater utility, usability and forward compatibility.&lt;&#x2F;p&gt;
&lt;p&gt;In the four years since &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; was published, the need for additional functionality has resulted in countless extensions. This EIP improves upon ERC-721 in the following areas:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6220&#x2F;#composing&quot;&gt;Composing&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6220&#x2F;#token-progression&quot;&gt;Token progression&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6220&#x2F;#merit-tracking&quot;&gt;Merit tracking&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6220&#x2F;#provable-digital-scarcity&quot;&gt;Provable Digital Scarcity&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;composing&quot;&gt;Composing&lt;&#x2F;h3&gt;
&lt;p&gt;NFTs can work together to create a greater construct. Prior to this proposal, multiple NFTs could be composed into a single construct either by checking all of the compatible NFTs associated with a given account and used indiscriminately (which could result in unexpected result if there was more than one NFT intended to be used in the same slot), or by keeping a custom ledger of parts to compose together (either in a smart contract or an off-chain database). This proposal establishes a standardized framework for composable NFTs, where a single NFT can select which parts should be a part of the whole, with the information being on chain. Composing NFTs in such a way allows for virtually unbounded customization of the base NFT. An example of this could be a movie NFT. Some parts, like credits, should be fixed. Other parts, like scenes, should be interchangeable, so that various releases (base version, extended cuts, anniversary editions,...) can be replaced.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;token-progression&quot;&gt;Token progression&lt;&#x2F;h3&gt;
&lt;p&gt;As the token progresses through various stages of its existence, it can attain or be awarded various parts. This can be explained in terms of gaming. A character could be represented by an NFT utilizing this proposal and would be able to equip gear acquired through the gameplay activities and as it progresses further in the game, better items would be available. In stead of having numerous NFTs representing the items collected through its progression, equippable parts can be unlocked and the NFT owner would be able to decide which items to equip and which to keep in the inventory (not equipped) without need of a centralized party.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;merit-tracking&quot;&gt;Merit tracking&lt;&#x2F;h3&gt;
&lt;p&gt;An equippable NFT can also be used to track merit. An example of this is academic merit. The equippable NFT in this case would represent a sort of digital portfolio of academic achievements, where the owner would be able to equip their diplomas, published articles and awards for all to see.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;provable-digital-scarcity&quot;&gt;Provable Digital Scarcity&lt;&#x2F;h3&gt;
&lt;p&gt;The majority of current NFT projects are only mock-scarce. Even with a limited supply of tokens, the utility of these (if any) is uncapped. As an example, you can log into 500 different instances of the same game using the same wallet and the same NFT. You can then equip the same hat onto 500 different in-game avatars at the same time, because its visual representation is just a client-side mechanic.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal adds the ability to enforce that, if a hat is equipped on one avatar (by being sent into it and then equipped), it cannot be equipped on another. This provides real digital scarcity.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;equippable-tokens&quot;&gt;Equippable tokens&lt;&#x2F;h3&gt;
&lt;p&gt;The interface of the core smart contract of the equippable tokens.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; EIP-6220 Composable NFTs utilizing Equippable Parts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-6220&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0x28bc9ae4.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.16&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERC5773.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6220&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5773&lt;&#x2F;span&gt;&lt;span&gt; &#x2F;*, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC165&lt;&#x2F;span&gt;&lt;span&gt; *&#x2F; &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to store the core structure of the `Equippable` component.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; assetId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ID of the asset equipping a child&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; childAssetId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ID of the asset used as equipment&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; childId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ID of token that is equipped&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; childEquippableAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the collection to which the child asset belongs to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Equipment&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint64&lt;&#x2F;span&gt;&lt;span&gt; assetId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint64&lt;&#x2F;span&gt;&lt;span&gt; childAssetId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; childId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; childEquippableAddress&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to provide a struct for inputing equip data.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Only used for input and not storage of data.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token we are managing&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; childIndex&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Index of a child in the list of token&amp;#39;s active children&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; assetId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the asset that we are equipping into&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; slotPartId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the slot part that we are using to equip&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; childAssetId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the asset that we are equipping&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IntakeEquip&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; childIndex&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint64&lt;&#x2F;span&gt;&lt;span&gt; assetId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint64&lt;&#x2F;span&gt;&lt;span&gt; slotPartId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint64&lt;&#x2F;span&gt;&lt;span&gt; childAssetId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to notify listeners that a child&amp;#39;s asset has been equipped into one of its parent assets.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token that had an asset equipped&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; assetId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the asset associated with the token we are equipping into&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; slotPartId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the slot we are using to equip&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; childId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the child token we are equipping into the slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; childAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the child token&amp;#39;s collection&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; childAssetId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the asset associated with the token we are equipping&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ChildAssetEquipped&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; assetId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; slotPartId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; childId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; childAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; childAssetId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to notify listeners that a child&amp;#39;s asset has been unequipped from one of its parent assets.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token that had an asset unequipped&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; assetId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the asset associated with the token we are unequipping out of&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; slotPartId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the slot we are unequipping from&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; childId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token being unequipped&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; childAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the collection that a token that is being unequipped belongs to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; childAssetId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the asset associated with the token we are unequipping&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ChildAssetUnequipped&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; assetId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; slotPartId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; childId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; childAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; childAssetId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to notify listeners that the assets belonging to a `equippableGroupId` have been marked as&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  equippable into a given slot and parent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; equippableGroupId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the equippable group being marked as equippable into the slot associated with&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  `slotPartId` of the `parentAddress` collection&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; slotPartId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the slot part of the catalog into which the parts belonging to the equippable group&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  associated with `equippableGroupId` can be equipped&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; parentAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the collection into which the parts belonging to `equippableGroupId` can be&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  equipped&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ValidParentEquippableGroupIdSet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; equippableGroupId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; slotPartId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; parentAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to equip a child into a token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The `IntakeEquip` struct contains the following data:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      tokenId,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      childIndex,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      assetId,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      slotPartId,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      childAssetId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An `IntakeEquip` struct specifying the equip data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; equip&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        IntakeEquip&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to unequip child from parent token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This can only be called by the owner of the token or by an account that has been granted permission to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  manage the given token by the current owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the parent from which the child is being unequipped&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; assetId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the parent&amp;#39;s asset that contains the `Slot` into which the child is equipped&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; slotPartId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the `Slot` from which to unequip the child&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; unequip&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; assetId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; slotPartId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to check whether the token has a given child equipped.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This is used to prevent from transferring a child that is equipped.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the parent token for which we are querying for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; childAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the child token&amp;#39;s smart contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; childId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the child token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The boolean value indicating whether the child token is equipped into the given token or not&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isChildEquipped&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; childAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; childId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to verify whether a token can be equipped into a given parent&amp;#39;s slot.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; parent&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the parent token&amp;#39;s smart contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token we want to equip&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; assetId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the asset associated with the token we want to equip&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; slotId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the slot that we want to equip the token into&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The boolean indicating whether the token with the given asset can be equipped into the desired&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; canTokenBeEquippedWithAssetIntoSlot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; assetId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; slotId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to get the Equipment object equipped into the specified slot of the desired token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The `Equipment` struct consists of the following data:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      assetId,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      childAssetId,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      childId,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      childEquippableAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token for which we are retrieving the equipped object&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; targetCatalogAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the `Catalog` associated with the `Slot` part of the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; slotPartId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the `Slot` part that we are checking for equipped objects&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The `Equipment` struct containing data about the equipped object&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getEquipment&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; targetCatalogAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; slotPartId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Equipment&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to get the asset and equippable data associated with given `assetId`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token for which to retrieve the asset&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; assetId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the asset of which we are retrieving&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; metadataURI&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The metadata URI of the asset&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; equippableGroupId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the equippable group this asset belongs to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; catalogAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the catalog the part belongs to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; partIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of IDs of parts included in the asset&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getAssetAndEquippableData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; assetId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; metadataURI&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; equippableGroupId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; catalogAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            uint64&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; partIds&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;catalog&quot;&gt;Catalog&lt;&#x2F;h3&gt;
&lt;p&gt;The interface of the Catalog containing the equippable parts. Catalogs are collections of equippable fixed and slot parts and are not restricted to a single collection, but can support any number of NFT collections.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ICatalog&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An interface Catalog for equippable module.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0xd912401f.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.16&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ICatalog&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is IERC165 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Event to announce addition of a new part.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; It is emitted when a new part is added.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; partId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the part that was added&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; itemType&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Enum value specifying whether the part is `None`, `Slot` and `Fixed`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; zIndex&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An uint specifying the z value of the part. It is used to specify the depth which the part should&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  be rendered at&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; equippableAddresses&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of addresses that can equip this part&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; metadataURI&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The metadata URI of the part&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AddedPart&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; partId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        ItemType&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; itemType&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; zIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; equippableAddresses&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; metadataURI&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Event to announce new equippables to the part.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; It is emitted when new addresses are marked as equippable for `partId`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; partId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the part that had new equippable addresses added&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; equippableAddresses&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of the new addresses that can equip this part&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AddedEquippables&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; partId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; equippableAddresses&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Event to announce the overriding of equippable addresses of the part.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; It is emitted when the existing list of addresses marked as equippable for `partId` is overwritten by a new&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  one.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; partId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the part whose list of equippable addresses was overwritten&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; equippableAddresses&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The new, full, list of addresses that can equip this part&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SetEquippables&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; partId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; equippableAddresses&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Event to announce that a given part can be equipped by any address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; It is emitted when a given part is marked as equippable by any.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; partId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the part marked as equippable by any address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SetEquippableToAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; partId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to define a type of the item. Possible values are `None`, `Slot` or `Fixed`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used for fixed and slot parts.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ItemType&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        None&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        Slot&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        Fixed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The integral structure of a standard RMRK catalog item defining it.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Requires a minimum of 3 storage slots per catalog item, equivalent to roughly 60,000 gas as of Berlin hard fork&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  (April 14, 2021), though 5-7 storage slots is more realistic, given the standard length of an IPFS URI. This&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  will result in between 25,000,000 and 35,000,000 gas per 250 assets--the maximum block size of Ethereum&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  mainnet is 30M at peak usage.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; itemType&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The item type of the part&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; z&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The z value of the part defining how it should be rendered when presenting the full NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; equippable&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The array of addresses allowed to be equipped in this part&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; metadataURI&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The metadata URI of the part&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Part&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ItemType itemType&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;1 byte&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint8&lt;&#x2F;span&gt;&lt;span&gt; z&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;1 byte&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; equippable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;n Collections that can be equipped into this slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt; metadataURI&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;n bytes 32+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The structure used to add a new `Part`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The part is added with specified ID, so you have to make sure that you are using an unused `partId`,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  otherwise the addition of the part vill be reverted.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The full `IntakeStruct` looks like this:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *          partID,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *          itemType,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *          z,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *          [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *               permittedCollectionAddress0,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *               permittedCollectionAddress1,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *               permittedCollectionAddress2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *           ],&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *           metadataURI&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *       ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *   ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; partId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID to be assigned to the `Part`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; part&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A `Part` to be added&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IntakeStruct&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint64&lt;&#x2F;span&gt;&lt;span&gt; partId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        Part part&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to return the metadata URI of the associated catalog.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Base metadata URI&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getMetadataURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to return the `itemType` of the associated catalog&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `itemType` of the associated catalog&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getType&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to check whether the given address is allowed to equip the desired `Part`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns true if a collection may equip asset with `partId`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; partId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ID of the part that we are checking&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; targetAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address that we are checking for whether the part can be equipped into it or not&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The status indicating whether the `targetAddress` can be equipped into `Part` with `partId` or not&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checkIsEquippable&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; partId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; targetAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to check if the part is equippable by all addresses.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns true if part is equippable to all.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; partId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the part that we are checking&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The status indicating whether the part with `partId` can be equipped by any address or not&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checkIsEquippableToAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; partId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to retrieve a `Part` with id `partId`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; partId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the part that we are retrieving&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The `Part` struct associated with given `partId`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getPart&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; partId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Part&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to retrieve multiple parts at the same time.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; partIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of part IDs that we want to retrieve&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of `Part` structs associated with given `partIds`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getParts&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; partIds&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Part&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Designing the proposal, we considered the following questions:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Why are we using a Catalog in stead of supporting direct NFT equipping?&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
If NFTs could be directly equipped into other NFTs without any oversight, the resulting composite would be unpredictable. Catalog allows for parts to be pre-verified in order to result in a composite that composes as expected. Another benefit of Catalog is the ability of defining reusable fixed parts.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Why do we propose two types of parts?&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
Some parts, that are the same for all of the tokens, don&#x27;t make sense to be represented by individual NFTs, so they can be represented by fixed parts. This reduces the clutter of the owner&#x27;s wallet as well as introduces an efficient way of disseminating repetitive assets tied to NFTs.&lt;br &#x2F;&gt;
The slot parts allow for equipping NFTs into them. This provides the ability to equip unrelated NFT collections into the base NFT after the unrelated collection has been verified to compose properly.&lt;br &#x2F;&gt;
Having two parts allows for support of numerous use cases and, since the proposal doesn&#x27;t enforce the use of both it can be applied in any configuration needed.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Why is a method to get all of the equipped parts not included?&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
Getting all parts might not be an operation necessary for all implementers. Additionally, it can be added either as an extension, doable with hooks, or can be emulated using an indexer.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Should Catalog be limited to support one NFT collection at a time or be able to support any nunmber of collections?&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
As the Catalog is designed in a way that is agnostic to the use case using it. It makes sense to support as wide reusability as possible. Having one Catalog supporting multiple collections allows for optimized operation and reduced gas prices when deploying it and setting fixed as well as slot parts.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;fixed-parts&quot;&gt;Fixed parts&lt;&#x2F;h3&gt;
&lt;p&gt;Fixed parts are defined and contained in the Catalog. They have their own metadata and are not meant to change through the lifecycle of the NFT.&lt;&#x2F;p&gt;
&lt;p&gt;A fixed part cannot be replaced.&lt;&#x2F;p&gt;
&lt;p&gt;The benefit of fixed parts is that they represent equippable parts that can be equipped by any number of tokens in any number of collections and only need to be defined once.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;slot-parts&quot;&gt;Slot parts&lt;&#x2F;h3&gt;
&lt;p&gt;Slot parts are defined and contained in the Catalog. They don&#x27;t have their own metadata, but rather support equipping of selected NFT collections into them. The tokens equipped into the slots however, contain their own metadata. This allows for an equippable modifialbe content of the base NFT controlled by its owner. As they can be equipped into any number of tokens of any number of collections, they allow for reliable composing of the final tokens by vetting which NFTs can be equipped by a given slot once and then reused any number of times.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The Equippable token standard has been made compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; in order to take advantage of the robust tooling available for implementations of ERC-721 and to ensure compatibility with existing ERC-721 infrastructure.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Tests are included in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6220&#x2F;.&#x2F;assets&#x2F;test&#x2F;equippableFixedParts.ts&quot;&gt;&lt;code&gt;equippableFixedParts.ts&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6220&#x2F;.&#x2F;assets&#x2F;test&#x2F;equippableSlotParts.ts&quot;&gt;&lt;code&gt;equippableSlotParts.ts&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;To run them in terminal, you can use the following commands:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cd ..&#x2F;assets&#x2F;eip-6220&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;npm install&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;npx hardhat test&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6220&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;EquippableToken.sol&quot;&gt;&lt;code&gt;EquippableToken.sol&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The same security considerations as with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; apply: hidden logic may be present in any of the functions, including burn, add resource, accept resource, and more.&lt;&#x2F;p&gt;
&lt;p&gt;Caution is advised when dealing with non-audited contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Cross-Chain Messaging Interface</title>
        <published>2022-12-19T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Sujith Somraaj</name><uri>https://github.com/sujithsomraaj</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6170/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/cross-chain-messaging-standard/12197" />
        

        <id>https://wg-eips.ritovision.com/6170/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:6170"
            label="ERC-6170" />
        

        
        

        
        <summary type="html">A common smart contract interface for interacting with messaging protocols.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6170/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a common interface for cross-chain arbitrary message bridges (AMBs) to send and receive a cross-chain message (state).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, cross-chain arbitrary message bridges lack standardization, resulting in complex competing implementations: Layerzero, Hyperlane, Axelar, Wormhole, Matic State Tunnel and others. Either chain native (or) seperate message bridge, the problem prevails. Adding a common standardized interface to the arbitrary message bridges provides these benefits:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Ease Of Development:&lt;&#x2F;strong&gt; A common standard interface would help developers build scalable cross-chain applications with ease.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Improved Scalability:&lt;&#x2F;strong&gt; Cross-chain applications can efficiently use multiple message bridges.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Improved Security:&lt;&#x2F;strong&gt; Confronting security to specific parameters. At present, every message bridge has its diverse security variable. E.g., In Layerzero, the nonce is used to prevent a replay attack, whereas Hyperlane uses the Merkle root hash.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Improved Robustness:&lt;&#x2F;strong&gt; Message bridges involving off-chain components are not censorship-resistant and are prone to downtimes. Hence, apps built on top of them have no choice but to migrate their entire state (which is highly impossible for large complex applications).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords &quot;MUST,&quot; &quot;MUST NOT,&quot; &quot;REQUIRED,&quot; &quot;SHALL,&quot; &quot;SHALL NOT,&quot; &quot;SHOULD,&quot; &quot;SHOULD NOT,&quot; &quot;RECOMMENDED,&quot; &quot;MAY,&quot; and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;Every compliant cross-chain arbitrary message bridge must implement the following interface.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: Apache-3.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; &amp;gt;=0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Cross-Chain Messaging interface&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Allows seamless interchain messaging.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @author&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sujith Somraaj&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: Bytes are used throughout the implementation to support non-evm chains.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IEIP6170&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when a cross-chain message is sent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: MessageSent MUST trigger when a message is sent, including zero bytes transfers.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MessageSent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; toChainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; message&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; extraData&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when a cross-chain message is received.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MessageReceived MUST trigger on any successful call to receiveMessage(bytes chainId, bytes sender, bytes message) function.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MessageReceived&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; fromChainId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; message&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sends a message to a receiving address on a different blockchain.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; chainId_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the unique identifier of receiving blockchain.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; receiver_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the address of the receiver.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; message_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the arbitrary message to be delivered.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is a bridge-specific encoded data for off-chain relayer infrastructure.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; status of the process on the sending chain.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: this function is designed to support both evm and non-evm chains&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: proposing chain-ids be the bytes encoding their native token name string. For eg., abi.encode(&amp;quot;ETH&amp;quot;), abi.encode(&amp;quot;SOL&amp;quot;) imagining they cannot override.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; sendMessage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; chainId_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; receiver_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; message_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data_&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Receives a message from a sender on a different blockchain.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; chainId_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the unique identifier of the sending blockchain.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sender_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the address of the sender.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; message_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the arbitrary message sent by the sender.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is an additional parameter to be used for security purposes. E.g, can send nonce in layerzero.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; status of message processing&#x2F;storage.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: sender validation (or) message validation should happen before processing the message.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; receiveMessage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; chainId_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sender_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; message_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data_&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The cross-chain arbitrary messaging interface will optimize the interoperability layer between blockchains with a feature-complete yet minimal interface. The light-weighted approach also provides arbitrary message bridges, and the freedom of innovating at the relayer level, to show their technical might.&lt;&#x2F;p&gt;
&lt;p&gt;The EIP will make blockchains more usable and scalable. It opens up the possibilities for building cross-chain applications by leveraging any two blockchains, not just those limited to Ethereum and compatible L2s. To put this into perspective, an easy-to-communicate mechanism will allow developers to build cross-chain applications across Ethereum and Solana, leveraging their unique advantages.&lt;&#x2F;p&gt;
&lt;p&gt;The interface also aims to reduce the risks of a single point of failure (SPOF) for applications&#x2F;protocols, as they can continue operating by updating their AMB address.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Fully permissionless messaging could be a security threat to the protocol. It is recommended that all the integrators review the implementation of messaging tunnels before integrating.&lt;&#x2F;p&gt;
&lt;p&gt;Without sender authentication, anyone could write arbitrary messages into the receiving smart contract.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP focuses only on how the messages should be sent and received with a specific standard. But integrators can implement any authentication (or) message tunnel-specific operations inside the receive function leveraging &lt;code&gt;data_&lt;&#x2F;code&gt; parameter.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Hierarchical NFTs</title>
        <published>2022-12-15T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Keegan Lee</name><uri>https://github.com/keeganlee</uri>
	</author>
	
	<author>
		<name>msfew</name><email>msfew@hyperoracle.io</email>
	</author>
	
	<author>
		<name>Kartin</name><email>kartin@hyperoracle.io</email>
	</author>
	
	<author>
		<name>qizhou</name><uri>https://github.com/qizhou</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6150/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6150-hierarchical-nfts-an-extension-to-erc-721/12173" />
        

        <id>https://wg-eips.ritovision.com/6150/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:6150"
            label="ERC-6150" />
        

        
        

        
        <summary type="html">Hierarchical NFTs, an extension to EIP-721.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6150/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is an extension to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt;. It proposes a multi-layer filesystem-like hierarchical NFTs. This standard provides interfaces to get parent NFT or children NFTs and whether NFT is a leaf node or root node, maintaining the hierarchical relationship among them.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP standardizes the interface of filesystem-like hierarchical NFTs and provides a reference implementation.&lt;&#x2F;p&gt;
&lt;p&gt;Hierarchy structure is commonly implemented for file systems by operating systems such as Linux Filesystem Hierarchy (FHS).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6150&#x2F;.&#x2F;assets&#x2F;linux-hierarchy.png&quot; alt=&quot;Linux Hierarchical File Structure&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Websites often use a directory and category hierarchy structure, such as eBay (Home -&amp;gt; Electronics -&amp;gt; Video Games -&amp;gt; Xbox -&amp;gt; Products), and Twitter (Home -&amp;gt; Lists -&amp;gt; List -&amp;gt; Tweets), and Reddit (Home -&amp;gt; r&#x2F;ethereum -&amp;gt; Posts -&amp;gt; Hot).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6150&#x2F;.&#x2F;assets&#x2F;website-hierarchy.png&quot; alt=&quot;Website Hierarchical Structure&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;A single smart contract can be the &lt;code&gt;root&lt;&#x2F;code&gt;, managing every directory&#x2F;category as individual NFT and hierarchy relations of NFTs. Each NFT&#x27;s &lt;code&gt;tokenURI&lt;&#x2F;code&gt; may be another contract address, a website link, or any form of metadata.&lt;&#x2F;p&gt;
&lt;p&gt;The advantages and the advancement of the Ethereum ecosystem of using this standard include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Complete on-chain storage of hierarchy, which can also be governed on-chain by additional DAO contract&lt;&#x2F;li&gt;
&lt;li&gt;Only need a single contract to manage and operate the hierarchical relations&lt;&#x2F;li&gt;
&lt;li&gt;Transferrable directory&#x2F;category ownership as NFT, which is great for use cases such as on-chain forums&lt;&#x2F;li&gt;
&lt;li&gt;Easy and permissionless data access to the hierarchical structure by front-end&lt;&#x2F;li&gt;
&lt;li&gt;Ideal structure for traditional applications such as e-commerce, or forums&lt;&#x2F;li&gt;
&lt;li&gt;Easy-to-understand interfaces for developers, which are similar to Linux filesystem commands in concept&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The use cases can include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;On-chain forum, like Reddit&lt;&#x2F;li&gt;
&lt;li&gt;On-chain social media, like Twitter&lt;&#x2F;li&gt;
&lt;li&gt;On-chain corporation, for managing organizational structures&lt;&#x2F;li&gt;
&lt;li&gt;On-chain e-commerce platforms, like eBay or individual stores&lt;&#x2F;li&gt;
&lt;li&gt;Any application with tree-like structures&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In the future, with the development of the data availability solutions of Ethereum and an external permissionless data retention network, the content (posts, listed items, or tweets) of these platforms can also be entirely stored on-chain, thus realizing fully decentralized applications.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;Every compliant contract must implement this proposal, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;EIP-165&lt;&#x2F;a&gt; interfaces.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0x897e2c73.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6150&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is IERC721, IERC165 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when `tokenId` token under `parentId` is minted.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; minter&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of minter&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address received token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; parentId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The id of parent token, if it&amp;#39;s zero, it means minted `tokenId` is a root token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The id of minted token, required to be greater than zero&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Minted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; minter&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; parentId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the parent token of `tokenId` token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The child token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; parentId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The Parent token found&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; parentOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; parentId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the children tokens of `tokenId` token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The parent token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; childrenIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The array of children tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; childrenOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; childrenIds&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check the `tokenId` token if it is a root token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token want to be checked&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Return&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `true` if it is a root token; if not, return `false`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isRoot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check the `tokenId` token if it is a leaf token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token want to be checked&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Return&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `true` if it is a leaf token; if not, return `false`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isLeaf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Optional Extension: Enumerable&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0xba541a2e.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6150Enumerable&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6150&lt;&#x2F;span&gt;&lt;span&gt; &#x2F;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC721Enumerable&lt;&#x2F;span&gt;&lt;span&gt; *&#x2F; &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get total amount of children tokens under `parentId` token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If `parentId` is zero, it means get total amount of root tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; total amount of children tokens under `parentId` token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; childrenCountOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; parentId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the token at the specified index of all children tokens under `parentId` token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If `parentId` is zero, it means get root token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; token ID at `index` of all chlidren tokens under `parentId` token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; childOfParentByIndex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; parentId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; index&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the index position of specified token in the children enumeration under specified parent token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws if the `tokenId` is not found in the children enumeration.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * If `parentId` is zero, means get root token index.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; parentId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The parent token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The specified token to be found&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; index position of `tokenId` found in the children enumeration&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; indexInChildrenEnumeration&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; parentId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Optional Extension: Burnable&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0x4ac0aa46.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6150Burnable&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6150&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Burn the `tokenId` token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws if `tokenId` is not a leaf token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Throws if `tokenId` is not a valid NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Throws if `owner` is not the owner of `tokenId` token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Throws unless `msg.sender` is the current owner, an authorized operator, or the approved address for this token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token to be burnt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeBurn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Batch burn tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws if one of `tokenIds` is not a leaf token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Throws if one of `tokenIds` is not a valid NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Throws if `owner` is not the owner of all `tokenIds` tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Throws unless `msg.sender` is the current owner, an authorized operator, or the approved address for all `tokenIds`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The tokens to be burnt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeBatchBurn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Optional Extension: ParentTransferable&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0xfa574808.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6150ParentTransferable&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6150&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when the parent of `tokenId` token &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; oldParentId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Previous parent token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; newParentId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; New parent token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ParentTransferred&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; oldParentId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newParentId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfer parentship of `tokenId` token to a new parent token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; newParentId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; New parent token id&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token to be &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferParent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newParentId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Batch transfer parentship of `tokenIds` to a new parent token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; newParentId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; New parent token id&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Array of token ids to be &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; batchTransferParent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newParentId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Optional Extension: Access Control&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0x1d04f0b3.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6150AccessControl&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6150&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check the account whether a admin of `tokenId` token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Each token can be set more than one admin. Admin have permission to do something to the token, like mint child token,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * or burn token, or transfer parentship.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The specified token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The account to be checked&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; If&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the account has admin permission, return true; otherwise, return false.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isAdminOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check whether the specified parent token and account can mint children tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If the `parentId` is zero, check whether account can mint root nodes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; parentId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The specified parent token to be checked&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The specified account to be checked&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; If&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the token and account has mint permission, return true; otherwise, return false.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; canMintChildren&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; parentId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check whether the specified token can be burnt by specified account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The specified token to be checked&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The specified account to be checked&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; If&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the tokenId can be burnt by account, return true; otherwise, return false.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; canBurnTokenByAccount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;As mentioned in the abstract, this EIP&#x27;s goal is to have a simple interface for supporting Hierarchical NFTs. Here are a few design decisions and why they were made:&lt;&#x2F;p&gt;
&lt;h3 id=&quot;relationship-between-nfts&quot;&gt;Relationship between NFTs&lt;&#x2F;h3&gt;
&lt;p&gt;All NFTs will make up a hierarchical relationship tree. Each NFT is a node of the tree, maybe as a root node or a leaf node, as a parent node or a child node.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal standardizes the event &lt;code&gt;Minted&lt;&#x2F;code&gt; to indicate the parent and child relationship when minting a new node. When a root node is minted, parentId should be zero. That means a token id of zero could not be a real node. So a real node token id must be greater than zero.&lt;&#x2F;p&gt;
&lt;p&gt;In a hierarchical tree, it&#x27;s common to query upper and lower nodes. So this proposal standardizes function &lt;code&gt;parentOf&lt;&#x2F;code&gt; to get the parent node of the specified node and standardizes function &lt;code&gt;childrenOf&lt;&#x2F;code&gt; to get all children nodes.&lt;&#x2F;p&gt;
&lt;p&gt;Functions &lt;code&gt;isRoot&lt;&#x2F;code&gt; and &lt;code&gt;isLeaf&lt;&#x2F;code&gt; can check if one node is a root node or a leaf node, which would be very useful for many cases.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;enumerable-extension&quot;&gt;Enumerable Extension&lt;&#x2F;h3&gt;
&lt;p&gt;This proposal standardizes three functions as an extension to support enumerable queries involving children nodes. Each function all have param &lt;code&gt;parentId&lt;&#x2F;code&gt;, for compatibility, when the &lt;code&gt;parentId&lt;&#x2F;code&gt; specified zero means query root nodes.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parenttransferable-extension&quot;&gt;ParentTransferable Extension&lt;&#x2F;h3&gt;
&lt;p&gt;In some cases, such as filesystem, a directory or a file could be moved from one directory to another. So this proposal adds ParentTransferable Extension to support this situation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;access-control&quot;&gt;Access Control&lt;&#x2F;h3&gt;
&lt;p&gt;In a hierarchical structure, usually, there is more than one account has permission to operate a node, like mint children nodes, transfer node, burn node. This proposal adds a few functions as standard to check access control permissions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal is fully backward compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Implementation: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6150&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;ERC6150.sol&quot;&gt;EIP-6150&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;No security considerations were found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Forkid checks based on timestamps</title>
        <published>2022-12-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Marius van der Wijden</name><uri>https://github.com/MariusVanDerWijden</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6122/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6122-forkid-checks-based-on-timestamps/12130" />
        

        <id>https://wg-eips.ritovision.com/6122/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="networking"
                label="Networking" />
            
        

        
        <category
            term="tag:eip:6122"
            label="EIP-6122" />
        

        
        

        
        <summary type="html">Modifies the forkid checks to work with timestamps and block numbers</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6122/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2124&#x2F;&quot;&gt;EIP-2124&lt;&#x2F;a&gt; proposed a way of identifying nodes on the p2p network based on their chain configuration via the forkid parameter.
It allows nodes to cut incompatible nodes off quickly which makes the P2P network more reliable.
After the merge, forks are scheduled by block time instead of block number. This EIP updates the forkid calculation with block time.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;While in proof-of-work forks were scheduled by block number, the proof-of-stake consensus layer schedules forks by slot number. The slot number is a time based measurement. In order to schedule forks at the same time on the consensus and execution layer, the execution layer is forced to also schedule forks by timestamp after the merge.&lt;&#x2F;p&gt;
&lt;p&gt;The forkid calculation allows peers to quickly determine the configuration of peers and disconnect peers that are misconfigured or configured for other networks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Each node maintains the following values:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;FORK_HASH&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: IEEE CRC32 checksum (&lt;code&gt;[4]byte&lt;&#x2F;code&gt;) of the genesis hash and fork blocks numbers or timestamps that already passed.
&lt;ul&gt;
&lt;li&gt;The fork block numbers or timestamps are fed into the CRC32 checksum in ascending order.&lt;&#x2F;li&gt;
&lt;li&gt;If multiple forks are applied at the same block or time, the block number or timestamp is checksummed only once.&lt;&#x2F;li&gt;
&lt;li&gt;Block numbers are regarded as &lt;code&gt;uint64&lt;&#x2F;code&gt; integers, encoded in big endian format when checksumming.&lt;&#x2F;li&gt;
&lt;li&gt;Block timestamps are regarded as &lt;code&gt;uint64&lt;&#x2F;code&gt; integers, encoded in big endian format when checksumming.&lt;&#x2F;li&gt;
&lt;li&gt;If a chain is configured to start with a non-Frontier ruleset already in its genesis, that is NOT considered a fork.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;FORK_NEXT&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: Block number or timestamp (&lt;code&gt;uint64&lt;&#x2F;code&gt;) of the next upcoming fork, or &lt;code&gt;0&lt;&#x2F;code&gt; if no next fork is known.
&lt;ul&gt;
&lt;li&gt;Note that it is not important to distinguish between a timestamp or a block for &lt;code&gt;FORK_NEXT&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;A &lt;code&gt;FORK_HASH&lt;&#x2F;code&gt; for a timestamp based fork at &lt;code&gt;1668000000&lt;&#x2F;code&gt; on top of homestead would be:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;forkhash₁ = &lt;code&gt;0xcb37b2ee&lt;&#x2F;code&gt; (homestead+fictional fork) = &lt;code&gt;CRC32(&amp;lt;genesis-hash&amp;gt; || uint64(1150000) || uint64(1668000000))&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;additional-rules&quot;&gt;Additional rules&lt;&#x2F;h3&gt;
&lt;p&gt;The following additional rules are applied:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Forks by timestamp MUST be scheduled at or after the forks by block (on mainnet as well as on private networks).&lt;&#x2F;li&gt;
&lt;li&gt;An implementation of forkid verification of remote peer needs to filter the incoming forkids first by block then by timestamp.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Shanghai will be scheduled by timestamp thus the forkid calculations need to be updated to work with timestamps and blocks.
Since all block number based forks are before time based forks, nodes need to check the block based forks before the time based forks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change modifies the forkid calculation slightly.
As a consequence nodes applying this change will drop peers who are not applying this change as soon as timestamp-scheduled fork occurs.
This is not only expected, but actually the purpose of the forkid in the first place.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Here&#x27;s a suite of tests with mainnet config and withdrawals enabled at time &lt;code&gt;1668000000&lt;&#x2F;code&gt; and merge netsplit block at block &lt;code&gt;18000000&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;go&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; testcase&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; struct&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	head&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	want&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tests&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; :=&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	config&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;  *&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;params&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ChainConfig&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	genesis&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; common&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	cases&lt;&#x2F;span&gt;&lt;span&gt;   [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;testcase&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Withdrawal test cases&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;	&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;withdrawalConfig&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	params&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;MainnetGenesisHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;testcase&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checksumToBytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;fc64ec04&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1150000&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;           &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Unsynced&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1149999&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checksumToBytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;fc64ec04&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1150000&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;     &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Last Frontier block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1150000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checksumToBytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;97c2c34c&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1920000&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;     &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; First Homestead block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1919999&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checksumToBytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;97c2c34c&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1920000&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;     &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Last Homestead block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1920000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checksumToBytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;91d1f948&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2463000&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;     &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; First DAO block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2462999&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checksumToBytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;91d1f948&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2463000&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;     &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Last DAO block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2463000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checksumToBytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7a64da13&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2675000&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;     &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; First Tangerine block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2674999&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checksumToBytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7a64da13&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2675000&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;     &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Last Tangerine block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2675000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checksumToBytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3edd5b10&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 4370000&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;     &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; First Spurious block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4369999&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checksumToBytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3edd5b10&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 4370000&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;     &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Last Spurious block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4370000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checksumToBytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;a00bc324&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 7280000&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;     &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; First Byzantium block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7279999&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checksumToBytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;a00bc324&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 7280000&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;     &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Last Byzantium block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7280000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checksumToBytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;668db0af&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 9069000&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;     &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; First and last Constantinople, first Petersburg block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;9068999&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checksumToBytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;668db0af&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 9069000&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;     &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Last Petersburg block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;9069000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checksumToBytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;879d6e30&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 9200000&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;     &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; First Istanbul and first Muir Glacier block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;9199999&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checksumToBytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;879d6e30&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 9200000&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;     &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Last Istanbul and first Muir Glacier block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;9200000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checksumToBytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;e029e991&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 12244000&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; First Muir Glacier block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;12243999&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checksumToBytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;e029e991&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 12244000&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Last Muir Glacier block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;12244000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checksumToBytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0eb440f6&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 12965000&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; First Berlin block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;12964999&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checksumToBytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0eb440f6&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 12965000&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Last Berlin block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;12965000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checksumToBytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;b715077d&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 13773000&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; First London block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;13772999&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checksumToBytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;b715077d&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 13773000&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Last London block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;13773000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checksumToBytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;20c327fc&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 15050000&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; First Arrow Glacier block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;15049999&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checksumToBytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;20c327fc&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 15050000&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Last Arrow Glacier block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;15050000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checksumToBytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;f0afd0e3&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 18000000&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; First Gray Glacier block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;18000000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checksumToBytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4fb8a872&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1668000000&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; First Merge Start block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;20000000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checksumToBytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4fb8a872&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1668000000&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Last Merge Start block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;20000000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1668000000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checksumToBytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;c1fdf181&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; First Shanghai block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;20100000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2669000000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checksumToBytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;c1fdf181&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Future Shanghai block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Here&#x27;s a suite of tests of the different states a Mainnet node might be in and the different remote fork identifiers it might be required to validate and decide to accept or reject:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;go&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tests&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; :=&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	head&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	id&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;   ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	err&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  error&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; Local is mainnet Withdrawals, remote announces the same. No future fork is announced.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;20000000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1668000001&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checksumToBytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;c1fdf181&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; nil&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Local is mainnet Withdrawals, remote announces the same also announces a next fork&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; at block&#x2F;time 0xffffffff, but that is uncertain.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;20000000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1668000001&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checksumToBytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;c1fdf181&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; math&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;MaxUint64&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; nil&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Local is mainnet currently in Byzantium only (so it&amp;#39;s aware of Petersburg &amp;amp; Withdrawals), remote announces&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; also Byzantium, but it&amp;#39;s not yet aware of Petersburg (e.g. non updated node before the fork).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; In this case we don&amp;#39;t know if Petersburg passed yet or not.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7279999&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1667999999&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checksumToBytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;a00bc324&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; nil&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Local is mainnet currently in Byzantium only (so it&amp;#39;s aware of Petersburg &amp;amp; Withdrawals), remote announces&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; also Byzantium, and it&amp;#39;s also aware of Petersburg (e.g. updated node before the fork). We&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; don&amp;#39;t know if Petersburg passed yet (will pass) or not.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7279999&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1667999999&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checksumToBytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;a00bc324&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 7280000&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; nil&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Local is mainnet currently in Byzantium only (so it&amp;#39;s aware of Petersburg &amp;amp; Withdrawals), remote announces&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; also Byzantium, and it&amp;#39;s also aware of some random fork (e.g. misconfigured Petersburg). As&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; neither forks passed at neither nodes, they may mismatch, but we still connect for now.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7279999&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1667999999&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checksumToBytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;a00bc324&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; math&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;MaxUint64&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; nil&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Local is mainnet exactly on Withdrawals, remote announces Byzantium + knowledge about Petersburg. Remote&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is simply out of sync, accept.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;20000000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1668000000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checksumToBytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;a00bc324&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 7280000&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; nil&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Local is mainnet Withdrawals, remote announces Byzantium + knowledge about Petersburg. Remote&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is simply out of sync, accept.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;20000000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1668000001&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checksumToBytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;a00bc324&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 7280000&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; nil&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Local is mainnet Withdrawals, remote announces Spurious + knowledge about Byzantium. Remote&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is definitely out of sync. It may or may not need the Petersburg update, we don&amp;#39;t know yet.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;20000000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1668000001&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checksumToBytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3edd5b10&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 4370000&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; nil&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Local is mainnet Byzantium &amp;amp; pre-withdrawals, remote announces Petersburg. Local is out of sync, accept.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7279999&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1667999999&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checksumToBytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;668db0af&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; nil&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Local is mainnet Spurious, remote announces Byzantium, but is not aware of Petersburg. Local&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; out of sync. Local also knows about a future fork, but that is uncertain yet.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4369999&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1667999999&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checksumToBytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;a00bc324&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; nil&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Local is mainnet Withdrawals. remote announces Byzantium but is not aware of further forks.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Remote needs software update.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;20000000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1668000001&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checksumToBytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;a00bc324&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ErrRemoteStale&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Local is mainnet Withdrawals, and isn&amp;#39;t aware of more forks. Remote announces Petersburg +&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0xffffffff. Local needs software update, reject.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;20000000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1668000001&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checksumToBytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;5cddc0e1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ErrLocalIncompatibleOrStale&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Local is mainnet Withdrawals, and is aware of Petersburg. Remote announces Petersburg +&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0xffffffff. Local needs software update, reject.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;20000000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1668000001&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checksumToBytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;5cddc0e1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ErrLocalIncompatibleOrStale&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Local is mainnet Withdrawals, remote is Rinkeby Petersburg.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;20000000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1668000001&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checksumToBytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;afec6b27&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ErrLocalIncompatibleOrStale&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Local is mainnet Withdrawals, far in the future. Remote announces Gopherium (non existing fork)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; at some future block 88888888, for itself, but past block for local. Local is incompatible.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This case detects non-upgraded nodes with majority hash power (typical Ropsten mess).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;88888888&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1668000001&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checksumToBytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;f0afd0e3&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 88888888&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ErrRemoteStale&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Local is mainnet Withdrawals. Remote is in Byzantium, but announces Gopherium (non existing&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; fork) at block 7279999, before Petersburg. Local is incompatible.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;20000000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1668000001&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checksumToBytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;a00bc324&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 7279999&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ErrRemoteStale&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;No known security risks&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Smart Derivative Contract</title>
        <published>2022-12-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Christian Fries</name><uri>https://github.com/cfries</uri>
	</author>
	
	<author>
		<name>Peter Kohl-Landgraf</name><uri>https://github.com/pekola</uri>
	</author>
	
	<author>
		<name>Alexandros Korpis</name><uri>https://github.com/kourouta</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6123/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6123-smart-derivative-contract-frictionless-processing-of-financial-derivatives/12134" />
        

        <id>https://wg-eips.ritovision.com/6123/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:6123"
            label="ERC-6123" />
        

        
        

        
        <summary type="html">A deterministic protocol for frictionless trade processing of financial contracts</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6123/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The Smart Derivative Contract (SDC) allows fully automizing and securing a financial product&#x27;s - e.g. a financial derivative or bond - complete trade life cycle.&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-1-1&quot;&gt;&lt;a href=&quot;#fn-1&quot;&gt;1&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;
The SDC leverages the advantages of smart contracts to remove many of the frictions associated with the classical derivative life cycle. Most notably, the protocol allows the removal of counterpart risk essentially.
The SDC can be implemented using a pre-agreed valuation oracle and valuation model, removing ambiguity in the settlement amounts. The SDC provides methods and callbacks to enable fully automated and fully transactional settlements (delivery-versus-payment, payment-vs-payment).
Token-based settlement can be realized by any contract implementation implementing an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; token.
Proof of concepts in terms of two legally binding digital Interest Rate Swaps were conducted in 2021 and 2022.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;rethinking-financial-derivatives&quot;&gt;Rethinking Financial Derivatives&lt;&#x2F;h3&gt;
&lt;p&gt;By their very nature, so-called &quot;over-the-counter (OTC)&quot; financial contracts are bilateral contractual agreements on exchanging long-dated cash flow schedules.
Since these contracts change their intrinsic market value due to changing market environments, they are subject to counterparty credit risk when one counterparty is subject to default.
The initial white paper describes the concept of a Smart Derivative Contract (SDC) with the central aim to detach bilateral financial transactions from counterparty credit risk and to remove complexities
in bilateral post-trade processing by a complete redesign.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;concept-of-a-smart-derivative-contract&quot;&gt;Concept of a Smart Derivative Contract&lt;&#x2F;h3&gt;
&lt;p&gt;A Smart Derivative Contract is a deterministic settlement protocol with the same economic behaviour as a Financial Contract - e.g. an OTC-Derivative or a Bond.
Every process state is specified; therefore, the trade and post-trade process is known in advance and is deterministic over the trade&#x27;s life cycle. An &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; token can be used for frictionless decentralized settlement, see reference implementation. We do provide a separate interface and implementation for a specific &quot;Settlement Token&quot; derived from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;.
These features enable two or multiple trade parties to process their financial contracts fully decentralized without relying on a third central intermediary agent.
The process logic of SDC can be implemented as a finite state machine on solidity.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;applications&quot;&gt;Applications&lt;&#x2F;h3&gt;
&lt;p&gt;The interface&#x27;s life cycle functionality applies to several use cases.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;settle-to-market-otc-derivative&quot;&gt;Settle-to-Market OTC Derivative&lt;&#x2F;h4&gt;
&lt;p&gt;In the case of a settle-to-market OTC derivative, an SDC settles the outstanding net present value of the underlying financial contract on a frequent (e.g. daily) basis. With each settlement cycle, the net present value of the underlying contract is exchanged, and the value of the contract is reset to zero. Pre-agreed margin buffers are locked at the beginning of each settlement cycle so that settlement will be guaranteed up to a certain amount.
If a counterparty fails to obey contract rules, e.g. not providing sufficient pre-funding, SDC will terminate automatically with the guaranteed transfer of a termination fee by the causing party.
We provide a reference implementation for this case.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;callateralized-otc-derivative&quot;&gt;Callateralized OTC Derivative&lt;&#x2F;h4&gt;
&lt;p&gt;An implementation variante of the protocol can be used to realize a collateralized OTC derivative.[^2]
Here the contract manages separate collateral and cash tokens.
The constructions allows to eliminate the risk of under-collateralization.
Thus, a separate initial margin is not required.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;defaultable-otc-derivative&quot;&gt;Defaultable OTC Derivative&lt;&#x2F;h4&gt;
&lt;p&gt;A defaultable OTC Derivative has no Collateral Process in place. In that case, a smart derivative will settle the according cash flows as determined in the derivative contract specification. A defaultable OTC derivative might end in
a state &#x27;Failure to Pay&#x27; if a settlement cannot be conducted.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;smart-bond-contract&quot;&gt;Smart Bond Contract&lt;&#x2F;h4&gt;
&lt;p&gt;The life cycle of a bond can also make use of the function catalogue below. The interface enables the issuer to allocate and redeem the bond as well as settle coupon payments. On the other hand, it allows bondholders to interact with each other, conducting secondary market trades. It all boils down to a settlement phase, which needs to be pre-agreed by both parties or triggered by the issuer
which can be processed in a completely frictionless way.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The methods and event are separated into different interfaces:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ISDCTrade&lt;&#x2F;code&gt; - events and functions related to trade inception, confirmation and termination.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ISDCSettlement&lt;&#x2F;code&gt; - events and functions related to the settlement life-cycle of a trade.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;IAsyncTransferCallback&lt;&#x2F;code&gt; - events and the callback function &lt;code&gt;afterTransfer&lt;&#x2F;code&gt; for settlements that utilize and external payment system.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;IAsyncTransfer&lt;&#x2F;code&gt; - events and functions related to async transfer (e.g., for external payment systems).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;code&gt;ISDC&lt;&#x2F;code&gt; interface is the aggregation of &lt;code&gt;ISDCTrade&lt;&#x2F;code&gt;, &lt;code&gt;ISDCSettlement&lt;&#x2F;code&gt; and &lt;code&gt;IAsyncTransferCallback&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;methods-of-isdctrade&quot;&gt;Methods of &lt;code&gt;ISDCTrade&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The following methods specify a Smart Derivative Contract&#x27;s trade initiation, trade termination and settlement life cycle. For further information, please also look at the interface documentation &lt;code&gt;ISDC.sol&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;trade-initiation-phase-incepttrade&quot;&gt;Trade Initiation Phase: &lt;code&gt;inceptTrade&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;A party can initiate a trade by providing the party address to trade with, trade data, trade position, payment amount for the trade and initial settlement data. Only registered counterparties are allowed to use that function.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; inceptTrade&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; withParty&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tradeData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; position&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; paymentAmount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; initialSettlementData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The position and the paymentAmount are viewed from the incepter.
The function will return a generated unique &lt;code&gt;tradeId&lt;&#x2F;code&gt;. The trade id will also be emitted by an event.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;trade-initiation-phase-confirmtrade&quot;&gt;Trade Initiation Phase: &lt;code&gt;confirmTrade&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;A counterparty can confirm a trade by providing its trade specification data, which then gets matched against the data stored from &lt;code&gt;inceptTrade&lt;&#x2F;code&gt; call.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; confirmTrade&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; withParty&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tradeData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; position&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; paymentAmount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; initialSettlementData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Here, the position and the paymentAmount is viewed from the confimer (opposite sign compared to the call to &lt;code&gt;inceptTrade&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;h4 id=&quot;trade-initiation-phase-canceltrade&quot;&gt;Trade Initiation Phase: &lt;code&gt;cancelTrade&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The counterparty that called &lt;code&gt;inceptTrade&lt;&#x2F;code&gt; has the option to cancel the trade, e.g., in the case where the trade is not confirmed in a timely manner.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; cancelTrade&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; withParty&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tradeData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; position&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; paymentAmount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; initialSettlementData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;trade-termination-requesttermination&quot;&gt;Trade Termination: &lt;code&gt;requestTermination&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Allows an eligible party to request a mutual termination of the trade with the corresponding &lt;code&gt;tradeId&lt;&#x2F;code&gt; with a termination amount she is willing to pay and provide further termination terms (e.g. an XML)&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; requestTradeTermination&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tradeId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; terminationPayment&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; terminationTerms&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;trade-termination-confirmtradetermination&quot;&gt;Trade Termination: &lt;code&gt;confirmTradeTermination&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Allows an eligible party to confirm a previously requested (mutual) trade termination, including termination payment value and termination terms&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; confirmTradeTermination&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tradeId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; terminationPayment&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; terminationTerms&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;trade-termination-canceltradetermination&quot;&gt;Trade Termination: &lt;code&gt;cancelTradeTermination&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The party that initiated &lt;code&gt;requestTradeTermination&lt;&#x2F;code&gt; has the option to withdraw the request, e.g., in the case where the termination is not confirmed in a timely manner.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; cancelTradeTermination&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tradeId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; terminationPayment&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; terminationTerms&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;methods-of-isdcsettlement&quot;&gt;Methods of &lt;code&gt;ISDCSettlement&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;settlement-phase-initiatesettlement&quot;&gt;Settlement Phase: &lt;code&gt;initiateSettlement&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Allows eligible participants (such as counterparties or a delegated agent) to trigger a settlement phase.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; initiateSettlement&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;settlement-phase-performsettlement&quot;&gt;Settlement Phase: &lt;code&gt;performSettlement&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Valuation may be provided on-chain or off-chain via an external oracle service that calculates the settlement or coupon amounts and uses external market data.
This method serves as a callback called from an external oracle providing settlement amount and used settlement data, which also get stored.
The settlement amount will be checked according to contract terms, resulting in either a regular settlement or a termination of the trade.&lt;&#x2F;p&gt;
&lt;p&gt;The method may perform a synchonous transfer of the settlement or make use of an &lt;code&gt;IAsyncTransfer&lt;&#x2F;code&gt;, which will finalize the
transfer though the callback &lt;code&gt;afterTransfer&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The transactionData is emitted as part of the corresponding event: &lt;code&gt;SettlementTransferred&lt;&#x2F;code&gt; or &lt;code&gt;SettlementFailed&lt;&#x2F;code&gt;
This might result in a termination or start of the next settlement phase, depending on the provided success flag.&lt;&#x2F;p&gt;
&lt;p&gt;The parameter &lt;code&gt;settlementData&lt;&#x2F;code&gt; will be ussed as &lt;code&gt;lastSettlementData&lt;&#x2F;code&gt; as part of the &lt;code&gt;SettlementRequested&lt;&#x2F;code&gt; event (see there)
and may contain updates to the determination of the next settlement, e.g., data to determine the reference value for margining or
the specification of updated margin buffer values.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; performSettlement&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; settlementAmount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; settlementData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;settlement-phase-aftersettlement&quot;&gt;Settlement Phase: &lt;code&gt;afterSettlement&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The method is called to verify and prepare the next settlement and move to that phase.
The method may trigger optional checks (e.g. pre-funding check).&lt;&#x2F;p&gt;
&lt;p&gt;Depending on the implementation, this method may be called automatically at the end of performSettlement
or called externally (e.g. from a time-oracle to allow for a time-period to prepare the next settlement).&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;An implementation that uses adjusting of pre-funding can check the pre-funding within this method.&lt;&#x2F;li&gt;
&lt;li&gt;An implementation that checked a static pre-funding upon confirmation of the trade might not require this step.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In any case, the method may trigger termination if the settlement failed.&lt;&#x2F;p&gt;
&lt;p&gt;Emits a &lt;code&gt;SettlementTransferred&lt;&#x2F;code&gt; or a &lt;code&gt;SettlementFailed&lt;&#x2F;code&gt; event. May emit a &lt;code&gt;TradeTerminated&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; afterSettlement&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;methods-of-iasynctransfercallback&quot;&gt;Methods of &lt;code&gt;IAsyncTransferCallback&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;settlement-phase-aftertransfer&quot;&gt;Settlement Phase: &lt;code&gt;afterTransfer&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;This method is called back from a settlement token or from an eligible address if the transfer of the settlement
amount was successful. - completes the settlement transfer.
The transactionData is emitted as part of the corresponding event: &lt;code&gt;SettlementTransferred&lt;&#x2F;code&gt; or &lt;code&gt;SettlementFailed&lt;&#x2F;code&gt;
This might result in a termination or start of the next settlement phase, depending on the provided success flag.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; afterTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; transactionID&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; transactionData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;trade-events&quot;&gt;Trade Events&lt;&#x2F;h3&gt;
&lt;p&gt;The following events are emitted during an SDC Trade life-cycle.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;tradeincepted&quot;&gt;TradeIncepted&lt;&#x2F;h4&gt;
&lt;p&gt;Emitted on trade inception - method &#x27;inceptTrade&#x27;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TradeIncepted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; initiator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tradeId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tradeData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;tradeconfirmed&quot;&gt;TradeConfirmed&lt;&#x2F;h4&gt;
&lt;p&gt;Emitted on trade confirmation - method &#x27;confirmTrade&#x27;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TradeConfirmed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; confirmer&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tradeId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;tradecanceled&quot;&gt;TradeCanceled&lt;&#x2F;h4&gt;
&lt;p&gt;Emitted on trade cancellation - method &#x27;cancelTrade&#x27;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TradeCanceled&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; initiator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tradeId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;tradeactivated&quot;&gt;TradeActivated&lt;&#x2F;h4&gt;
&lt;p&gt;Emitted when a Trade is activated&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TradeActivated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tradeId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;tradeterminationrequest&quot;&gt;TradeTerminationRequest&lt;&#x2F;h4&gt;
&lt;p&gt;Emitted when termination request is initiated by a counterparty&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TradeTerminationRequest&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; initiator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tradeId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; terminationPayment&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; terminationTerms&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;tradeterminationconfirmed&quot;&gt;TradeTerminationConfirmed&lt;&#x2F;h4&gt;
&lt;p&gt;Emitted when termination request is confirmed by a counterparty&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TradeTerminationConfirmed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; confirmer&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tradeId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; terminationPayment&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; terminationTerms&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;tradeterminationcanceled&quot;&gt;TradeTerminationCanceled&lt;&#x2F;h4&gt;
&lt;p&gt;Emitted when termination request is canceled by the requesting counterparty&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TradeTerminationCanceled&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; initiator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tradeId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; terminationTerms&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;tradeterminated&quot;&gt;TradeTerminated&lt;&#x2F;h4&gt;
&lt;p&gt;Emitted when trade is terminated&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TradeTerminated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; cause&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;settlement-events&quot;&gt;Settlement Events&lt;&#x2F;h3&gt;
&lt;p&gt;The following events are emitted during the settlement phases.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;settlementrequested&quot;&gt;SettlementRequested&lt;&#x2F;h4&gt;
&lt;p&gt;Emitted when a settlement is requested (via &lt;code&gt;initiateSettlement&lt;&#x2F;code&gt;). May trigger the settlement phase.&lt;&#x2F;p&gt;
&lt;p&gt;The argument &lt;code&gt;lastSettlementData&lt;&#x2F;code&gt; is the one that was passed upon a previous settlement
in &lt;code&gt;performSettlement&lt;&#x2F;code&gt; (under the name &lt;code&gt;settlementData&lt;&#x2F;code&gt;). It may be used to pass updated settlement
specific information calculated during the previous settlement, e.g., when margin buffer amounts are a function
of market parameters. In case of an external oracle it can pass the &lt;code&gt;settlementData&lt;&#x2F;code&gt; via &lt;code&gt;performSettlement&lt;&#x2F;code&gt;
and pick it up in the &lt;code&gt;SettlementRequested&lt;&#x2F;code&gt; event (allows for stateless external oracles).&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SettlementRequested&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; initiator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tradeData&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; lastSettlementData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;settlementdetermined&quot;&gt;SettlementDetermined&lt;&#x2F;h4&gt;
&lt;p&gt;Emitted when the settlement phase is started (via &lt;code&gt;performSettlement&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SettlementDetermined&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; initiator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; settlementAmount&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; settlementData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;settlementtransferred&quot;&gt;SettlementTransferred&lt;&#x2F;h4&gt;
&lt;p&gt;Emitted when the settlement succeeded.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SettlementTransferred&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; transactionData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;settlementfailed&quot;&gt;SettlementFailed&lt;&#x2F;h4&gt;
&lt;p&gt;Emitted when the settlement failed.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SettlementFailed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; transactionData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The interface design and reference implementation are based on the following considerations:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;An SDC protocol enables interacting parties to initiate and process a financial transaction in a bilateral and deterministic manner. Settlement and Counterparty Risk is managed by the contract.&lt;&#x2F;li&gt;
&lt;li&gt;The provided interface specification is supposed to completely reflect the entire trade life cycle.&lt;&#x2F;li&gt;
&lt;li&gt;The interface specification is generic enough to handle the case that parties process one or even multiple financial transactions (on a netted base)&lt;&#x2F;li&gt;
&lt;li&gt;Usually, the valuation of financial trades (e.g. OTC Derivatives) will require advanced valuation methodology to determine the market value. This is why the concept might rely on an external market data source and hosted valuation algorithms&lt;&#x2F;li&gt;
&lt;li&gt;A pull-based valuation-based oracle pattern can be implemented by using the provided callback pattern (methods: &lt;code&gt;initiateSettlement&lt;&#x2F;code&gt;, &lt;code&gt;performSettlement&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;The reference implementation &lt;code&gt;SDCSingleTrade.sol&lt;&#x2F;code&gt; considers a single trade and is based on a state-machine pattern where the states also serve as guards (via modifiers) to check which method is allowed to be called at a particular given process and trade state&lt;&#x2F;li&gt;
&lt;li&gt;The interface allows the extension to multiple trades with common (netted) settlement.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;state-diagram-of-trade-and-process-states&quot;&gt;State diagram of trade and process states&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6123&#x2F;.&#x2F;assets&#x2F;doc&#x2F;sdc_trade_states.svg&quot; alt=&quot;image info&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The diagram shows the trade states of a single trade SDC as in &lt;code&gt;SDCSingleTrade.sol&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;sequence-diagram-of-reference-implementation-sdcpledgedbalance-sol&quot;&gt;Sequence diagram of reference implementation &#x27;SDCPledgedBalance.sol&#x27;&lt;&#x2F;h3&gt;
&lt;p&gt;The following sequence diagram shows the function calls that create the trade and stellement state transitions
and the emitted events.  Shown is the implementation variante that&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;utilizes an asynchronous settlement through a settlement token (see the interface &lt;code&gt;IAsyncTransfer&lt;&#x2F;code&gt;, &lt;code&gt;IAsyncTransferCallback&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;receives the trigger &lt;code&gt;afterSettlement&lt;&#x2F;code&gt; to perfrom checks of settlement pre-conditions (see the corresponding method description &lt;code&gt;afterSettlement&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6123&#x2F;.&#x2F;assets&#x2F;doc&#x2F;sequence.svg&quot; alt=&quot;image info&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;sequence-diagram-of-an-implementation-variant-with-a-separate-collateral-account&quot;&gt;Sequence diagram of an implementation variant with a separate collateral account&lt;&#x2F;h3&gt;
&lt;p&gt;The following sequence diagram shows the implementation variant with a separate collateral account.
This diagram show the settlement phase.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6123&#x2F;.&#x2F;assets&#x2F;doc&#x2F;sequence-sdc-collateral-settlement.svg&quot; alt=&quot;image info&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Life-cycle unit tests based on the sample implementation and usage of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; token is provided. See file &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6123&#x2F;.&#x2F;assets&#x2F;test&#x2F;SDCTests.js&quot;&gt;test&#x2F;SDCTests.js&lt;&#x2F;a&gt;
).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;An abstract contract class &lt;code&gt;SDCSingleTrade.sol&lt;&#x2F;code&gt; for single trade SDCs as well as a full reference implementation SDCPledgedBalance.sol for an OTC-Derivative is provided and is based on the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; token standard.
See folder &lt;code&gt;&#x2F;assets&#x2F;contracts&lt;&#x2F;code&gt;, more explanation on the implementation is provided inline.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;trade-data-specification-suggestion&quot;&gt;Trade Data Specification (suggestion)&lt;&#x2F;h3&gt;
&lt;p&gt;Please take a look at the provided xml file as a suggestion on how trade parameters could be stored.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;No known security issues up to now.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;section class=&quot;footnotes&quot;&gt;
&lt;ol class=&quot;footnotes-list&quot;&gt;
&lt;li id=&quot;fn-1&quot;&gt;
&lt;p&gt;Fries, C. P., &amp;amp; Kohl-Landgraf, P. (2018). Smart Derivative Contracts (Detaching Transactions from Counterparty Credit Risk: Specification, Parametrisation, Valuation). &lt;span style=&quot;font-style: italic;&quot;&gt;SSRN Electronic Journal&lt;&#x2F;span&gt;. https:&#x2F;&#x2F;doi.org&#x2F;&lt;a href=&quot;https:&#x2F;&#x2F;doi.org&#x2F;10.2139&#x2F;ssrn.3163074&quot;&gt;10.2139&#x2F;ssrn.3163074&lt;&#x2F;a&gt; (Original work published 2018)[^2]: Fries, C. P., Kohl-Landgraf, P., Prandtl, R., &amp;amp; Schütte, W. (2025). A Smart Derivative Contract with Collateral. &lt;span style=&quot;font-style: italic;&quot;&gt;SSRN Electronic Journal&lt;&#x2F;span&gt;. https:&#x2F;&#x2F;doi.org&#x2F;&lt;a href=&quot;https:&#x2F;&#x2F;doi.org&#x2F;10.2139&#x2F;ssrn.5454714&quot;&gt;10.2139&#x2F;ssrn.5454714&lt;&#x2F;a&gt; (Original work published 2025) &lt;a href=&quot;#fr-1-1&quot;&gt;↩&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;section&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Universal Token Router</title>
        <published>2022-12-12T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Derion</name><uri>https://github.com/derion-io</uri>
	</author>
	
	<author>
		<name>Zergity</name><uri>https://github.com/Zergity</uri>
	</author>
	
	<author>
		<name>Ngo Quang Anh</name><uri>https://github.com/anhnq82</uri>
	</author>
	
	<author>
		<name>BerlinP</name><uri>https://github.com/BerlinP</uri>
	</author>
	
	<author>
		<name>Khanh Pham</name><uri>https://github.com/blackskin18</uri>
	</author>
	
	<author>
		<name>Hal Blackburn</name><uri>https://github.com/h4l</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6120/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6120-universal-token-router/12142" />
        

        <id>https://wg-eips.ritovision.com/6120/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:6120"
            label="ERC-6120" />
        

        
        

        
        <summary type="html">A singleton router contract allows tokens to be spent in the transfer-and-call pattern instead of approve-then-call.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6120/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The default transaction behavior of ETH is &lt;em&gt;transfer-and-call&lt;&#x2F;em&gt;, but the widely used &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; standard isn&#x27;t compatible with this pattern. This incompatibility forces applications to use an inefficient and risky two-step &lt;em&gt;approve-then-call&lt;&#x2F;em&gt; process. This approach is costly, creates a poor user experience, and introduces significant security vulnerabilities, as users must approve unaudited and often upgradable contracts. This has led to numerous allowance-related bugs and exploits.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;strong&gt;Universal Token Router&lt;&#x2F;strong&gt; (&lt;strong&gt;UTR&lt;&#x2F;strong&gt;) addresses this issue by separating the token allowance from the application logic. This allows any token to be spent in a single contract call, similar to how ETH is handled, without needing to approve individual application contracts. When tokens are approved to the &lt;strong&gt;UTR&lt;&#x2F;strong&gt;, they can only be spent in transactions signed directly by the token owner. The &lt;strong&gt;UTR&lt;&#x2F;strong&gt;&#x27;s transaction data clearly shows key details like token types, amounts, and the recipient.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;strong&gt;UTR&lt;&#x2F;strong&gt; promotes the &lt;strong&gt;security-by-result&lt;&#x2F;strong&gt; model over the &lt;strong&gt;security-by-process&lt;&#x2F;strong&gt; model. By allowing applications to verify the output of a transaction (e.g., checking token balance changes), users&#x27; funds can be secure even when interacting with potentially flawed or malicious contracts.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;strong&gt;UTR&lt;&#x2F;strong&gt; contract is deployed at &lt;code&gt;0x69c4620b62D99f524c5B4dE45442FE2D7dD59576&lt;&#x2F;code&gt; on all EVM-compatible networks using the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1014&#x2F;&quot;&gt;EIP-1014&lt;&#x2F;a&gt; SingletonFactory. This allows new token contracts to pre-configure it as a trusted spender, eliminating the need for approval transactions entirely for their interactive usage.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;When users approve their tokens to a contract, they expect that:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;it only spends the tokens with their permission (from &lt;code&gt;msg.sender&lt;&#x2F;code&gt; or &lt;code&gt;ecrecover&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;it does not use &lt;code&gt;delegatecall&lt;&#x2F;code&gt; (e.g. upgradable proxies)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;strong&gt;UTR&lt;&#x2F;strong&gt; ensures these same security conditions, allowing all interactive applications to share a single, secure token allowance. This saves most approval transactions for existing tokens and &lt;strong&gt;all&lt;&#x2F;strong&gt; approval transactions for new ones.&lt;&#x2F;p&gt;
&lt;p&gt;Before the &lt;strong&gt;UTR&lt;&#x2F;strong&gt;, users had to blindly trust the front-end code of applications to construct transactions honestly. This made them highly vulnerable to phishing. The &lt;strong&gt;UTR&lt;&#x2F;strong&gt;&#x27;s function arguments act as a manifest that wallets can display to users, allowing them to review the expected token behavior before signing, making phishing attacks much easier to detect.&lt;&#x2F;p&gt;
&lt;p&gt;Most existing application contracts are already compatible with the &lt;strong&gt;UTR&lt;&#x2F;strong&gt; and can integrate it to gain several benefits:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Securely share a user&#x27;s token allowance across all applications.&lt;&#x2F;li&gt;
&lt;li&gt;Update their own peripheral contracts as often as needed without requiring new user approvals.&lt;&#x2F;li&gt;
&lt;li&gt;Save development and security audit costs on their own router contracts.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “NOT RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;The main interface of the UTR contract:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IUniversalTokenRouter&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; exec&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        Output&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; outputs&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        Action&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; actions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;output-verification&quot;&gt;Output Verification&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;Output&lt;&#x2F;code&gt; defines the expected token balance change for verification.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Output&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint&lt;&#x2F;span&gt;&lt;span&gt; eip&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;           &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; token standard: 0 for ETH or EIP number&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; token&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; token contract address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint&lt;&#x2F;span&gt;&lt;span&gt; id&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; token id for ERC-721 and ERC-1155&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint&lt;&#x2F;span&gt;&lt;span&gt; amountOutMin&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Token balances of the &lt;code&gt;recipient&lt;&#x2F;code&gt; address are recorded at the beginning and the end of the &lt;code&gt;exec&lt;&#x2F;code&gt; function for each item in &lt;code&gt;outputs&lt;&#x2F;code&gt;. Transaction will revert with &lt;code&gt;INSUFFICIENT_OUTPUT_AMOUNT&lt;&#x2F;code&gt; if any of the balance changes are less than its &lt;code&gt;amountOutMin&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;A special id &lt;code&gt;ERC_721_BALANCE&lt;&#x2F;code&gt; is reserved for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;, which can be used in output actions to verify the total amount of all ids owned by the &lt;code&gt;recipient&lt;&#x2F;code&gt; address.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ERC_721_BALANCE &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;#39;UniversalTokenRouter.ERC_721_BALANCE&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;action&quot;&gt;Action&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;Action&lt;&#x2F;code&gt; defines the token inputs and the contract call.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Action&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; inputs&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; code&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;       &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; contract code address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; contract input data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The action code contract MUST implement the &lt;code&gt;NotToken&lt;&#x2F;code&gt; contract or the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; interface with the ID &lt;code&gt;0x61206120&lt;&#x2F;code&gt; in order to be called by the UTR. This interface check prevents the direct invocation of token &lt;em&gt;allowance-spending&lt;&#x2F;em&gt; functions (e.g., &lt;code&gt;transferFrom&lt;&#x2F;code&gt;) by the UTR. Therefore, new token contracts MUST NOT implement this interface ID.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * This contract will conflict with the ERC20, ERC721, and ERC1155 standards,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * preventing token contracts from accidentally implementing it.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;abstract&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NotToken&lt;&#x2F;span&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; allowance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;THIS IS NOT A TOKEN&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isApprovedForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;THIS IS NOT A TOKEN&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Application&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NotToken&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; this contract can be used with the UTR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;input&quot;&gt;Input&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;Input&lt;&#x2F;code&gt; defines the input token to transfer or prepare before the action contract is executed.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Input&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint&lt;&#x2F;span&gt;&lt;span&gt; mode&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint&lt;&#x2F;span&gt;&lt;span&gt; eip&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;           &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; token standard: 0 for ETH or EIP number&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; token&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; token contract address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint&lt;&#x2F;span&gt;&lt;span&gt; id&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; token id for ERC-721 and ERC-1155&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint&lt;&#x2F;span&gt;&lt;span&gt; amountIn&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;mode&lt;&#x2F;code&gt; takes one of the following values:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;PAYMENT = 0&lt;&#x2F;code&gt;: pend a payment for the token to be transferred from &lt;code&gt;msg.sender&lt;&#x2F;code&gt; to the &lt;code&gt;recipient&lt;&#x2F;code&gt; by calling &lt;code&gt;UTR.pay&lt;&#x2F;code&gt; from anywhere in the same transaction.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TRANSFER = 1&lt;&#x2F;code&gt;: transfer the token directly from &lt;code&gt;msg.sender&lt;&#x2F;code&gt; to the &lt;code&gt;recipient&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CALL_VALUE = 2&lt;&#x2F;code&gt;: record the &lt;code&gt;ETH&lt;&#x2F;code&gt; amount to pass to the action as the call &lt;code&gt;value&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Each input in the &lt;code&gt;inputs&lt;&#x2F;code&gt; argument is processed sequentially. For simplicity, duplicated &lt;code&gt;PAYMENT&lt;&#x2F;code&gt; and &lt;code&gt;CALL_VALUE&lt;&#x2F;code&gt; inputs are valid, but only the last &lt;code&gt;amountIn&lt;&#x2F;code&gt; value is used.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;payment-input&quot;&gt;Payment Input&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;PAYMENT&lt;&#x2F;code&gt; is the recommended mode for application contracts that use the &lt;em&gt;transfer-in-callback&lt;&#x2F;em&gt; pattern. E.g., flashloan contracts, Uniswap&#x2F;v3-core, Derion, etc.&lt;&#x2F;p&gt;
&lt;p&gt;For each &lt;code&gt;Input&lt;&#x2F;code&gt; with &lt;code&gt;PAYMENT&lt;&#x2F;code&gt; mode, at most &lt;code&gt;amountIn&lt;&#x2F;code&gt; of the token can be transferred from &lt;code&gt;msg.sender&lt;&#x2F;code&gt; to the &lt;code&gt;recipient&lt;&#x2F;code&gt; by calling &lt;code&gt;UTR.pay&lt;&#x2F;code&gt; from anywhere in the same transaction.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;UTR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; | PAYMENT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; | (payments pended for UTR.pay)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; |                                  Application Contracts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;action.code.call ---------------------&amp;gt; |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                        |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;UTR.pay &amp;lt;----------------------- (call) |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                        |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; | &amp;lt;-------------------------- (return) |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; | (clear all pending payments)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;END&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Token&#x27;s allowance and &lt;code&gt;PAYMENT&lt;&#x2F;code&gt; are essentially different as:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;allowance: allow a specific &lt;code&gt;spender&lt;&#x2F;code&gt; to transfer the token to anyone at any time.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;PAYMENT&lt;&#x2F;code&gt;: allow anyone to transfer the token to a specific &lt;code&gt;recipient&lt;&#x2F;code&gt; only in that transaction.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;spend-payment&quot;&gt;Spend Payment&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IUniversalTokenRouter&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; pay&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; payment&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;To call &lt;code&gt;pay&lt;&#x2F;code&gt;, the &lt;code&gt;payment&lt;&#x2F;code&gt; param must be encoded as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;payment &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    recipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    eip&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    id          &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;payment&lt;&#x2F;code&gt; bytes can also be used by adapter UTR contracts to pass contexts and payloads for performing custom payment logic.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;discard-payment&quot;&gt;Discard Payment&lt;&#x2F;h5&gt;
&lt;p&gt;Sometimes, it&#x27;s useful to discard the payment instead of performing the transfer, for example, when the application contract wants to burn its own token from &lt;code&gt;payment.payer&lt;&#x2F;code&gt;. The following function can be used to verify the payment to the caller&#x27;s address and discard a portion of it.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IUniversalTokenRouter&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; discard&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; payment&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Please refer to the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6120&#x2F;#discard-payment-1&quot;&gt;Discard Payment&lt;&#x2F;a&gt; section in the &lt;strong&gt;Security Considerations&lt;&#x2F;strong&gt; for an important security note.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;sender-authentication&quot;&gt;Sender Authentication&lt;&#x2F;h5&gt;
&lt;p&gt;Discarding payment also makes sender authentication possible with a router, which is never achievable with regular routers. By inputting a pseudo payment (not a token payment), the UTR allows the target contract to verify the sender&#x27;s address for authentication, along with normal token transfers and payments.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AuthChecker&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NotToken&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; must be trusted with a proper implementation of discard function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; immutable&lt;&#x2F;span&gt;&lt;span&gt; UTR&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; actionMustSentBySender&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; payment &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        IUniversalTokenRouter&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;UTR&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;discard&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;payment&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; utr&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;exec&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    inputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        mode&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; PAYMENT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        eip&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        token&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; AddressZero&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        amountIn&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        recipient&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; paymentTest&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    code&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; authChecker&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; authChecker&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;populateTransaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;actionMustSentBySender&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Please refer to the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6120&#x2F;#discard-payment-1&quot;&gt;Discard Payment&lt;&#x2F;a&gt; section in the &lt;strong&gt;Security Considerations&lt;&#x2F;strong&gt; for an important security note.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;payment-lifetime&quot;&gt;Payment Lifetime&lt;&#x2F;h5&gt;
&lt;p&gt;Payments are recorded in the UTR storage and intended to be spent by &lt;code&gt;input.action&lt;&#x2F;code&gt; external calls only within that transaction. All payment storages will be cleared before the &lt;code&gt;UTR.exec&lt;&#x2F;code&gt; ends.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;native-token-tranfer&quot;&gt;Native Token Tranfer&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;UTR&lt;&#x2F;code&gt; SHOULD have a &lt;code&gt;receive()&lt;&#x2F;code&gt; function for user execution logic that requires transferring ETH in. The &lt;code&gt;msg.value&lt;&#x2F;code&gt; transferred into the router can be spent in multiple inputs across different actions. While the caller takes full responsibility for the movement of &lt;code&gt;ETH&lt;&#x2F;code&gt; in and out of the router, the &lt;code&gt;exec&lt;&#x2F;code&gt; function SHOULD refund any remaining &lt;code&gt;ETH&lt;&#x2F;code&gt; before the function ends.&lt;&#x2F;p&gt;
&lt;p&gt;Please refer to the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6120&#x2F;#reentrancy&quot;&gt;Reentrancy&lt;&#x2F;a&gt; section in the &lt;strong&gt;Security Considerations&lt;&#x2F;strong&gt; for information on reentrancy risks and mitigation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;usage-examples&quot;&gt;Usage Examples&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;uniswap-v2-router&quot;&gt;Uniswap V2 Router&lt;&#x2F;h4&gt;
&lt;p&gt;Legacy function:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;UniswapV2Router01&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;swapExactTokensForTokens&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint&lt;&#x2F;span&gt;&lt;span&gt; amountIn&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint&lt;&#x2F;span&gt;&lt;span&gt; amountOutMin&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span&gt; path&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint&lt;&#x2F;span&gt;&lt;span&gt; deadline&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;UniswapV2Helper01.swapExactTokensForTokens&lt;&#x2F;code&gt; is a modified version of it without the token transfer part.&lt;&#x2F;p&gt;
&lt;p&gt;This transaction is signed by users to execute the swap instead of the legacy function:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;UniversalTokenRouter&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;exec&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    recipient&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    eip&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 20&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    token&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; path&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;path&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    amountOutMin&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    inputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        mode&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; TRANSFER&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        recipient&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; UniswapV2Library&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;pairFor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;factory&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; path&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; path&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        eip&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 20&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        token&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; path&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        amountIn&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amountIn&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    code&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; UniswapV2Helper01&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; encodeFunctionData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;swapExactTokensForTokens&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        amountIn&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        amountOutMin&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        path&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        deadline&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;uniswap-v3-router&quot;&gt;Uniswap V3 Router&lt;&#x2F;h4&gt;
&lt;p&gt;Legacy router contract:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SwapRouter&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; this function is called by pool to pay the input tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; pay&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; payer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        .&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; pull payment&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        TransferHelper&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;safeTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; payer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The helper contract to use with the &lt;code&gt;UTR&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SwapHelper&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; this function is called by pool to pay the input tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; pay&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; payer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        .&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; pull payment&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; payment &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;payer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 20&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        UTR&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;pay&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;payment&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This transaction is signed by users to execute the &lt;code&gt;exactInput&lt;&#x2F;code&gt; functionality using &lt;code&gt;PAYMENT&lt;&#x2F;code&gt; mode:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;UniversalTokenRouter&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;exec&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    eip&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 20&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    token&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenOut&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    amountOutMin&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    recipient&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    inputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        mode&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; PAYMENT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        eip&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 20&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        token&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenIn&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        amountIn&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amountIn&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        recipient&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; pool&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    code&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; SwapHelper&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; encodeFunctionData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;exactInput&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;...&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;allowance-adapter&quot;&gt;Allowance Adapter&lt;&#x2F;h4&gt;
&lt;p&gt;A simple non-reentrancy ERC-20 adapter for aplication and router contracts that use direct allowance.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AllowanceAdapter&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ReentrancyGuard&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Input&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; token&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span&gt; amountIn&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approveAndCall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        Input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; inputs&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; leftOverRecipient&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; nonReentrant&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; inputs&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            Input &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;memory&lt;&#x2F;span&gt;&lt;span&gt; input &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; inputs&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            IERC20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;input&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; input&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amountIn&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt; success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;call&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                revert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;result&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; inputs&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            Input &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;memory&lt;&#x2F;span&gt;&lt;span&gt; input &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; inputs&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; clear all allowance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            IERC20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;input&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            uint&lt;&#x2F;span&gt;&lt;span&gt; leftOver &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;input&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;leftOver &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                TransferHelper&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;safeTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;input&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; leftOverRecipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; leftOver&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This transaction is constructed to utilize the &lt;code&gt;UTR&lt;&#x2F;code&gt; to interact with Uniswap V2 Router without approving any token to it:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; routerData&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uniswapRouter&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;populateTransaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;swapExactTokensForTokens&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    amountIn&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    amountOutMin&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    path&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    deadline&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; adapterData&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; adapter&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;populateTransaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;approveAndCall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    [&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        token&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; path&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        amountIn&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    uniswapRouter&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    routerData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    leftOverRecipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; utr&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;exec&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    inputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        mode&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; TRANSFER&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        recipient&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; adapter&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        eip&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 20&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        token&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; path&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        amountIn&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    code&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; adapter&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; adapterData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;Permit&lt;&#x2F;code&gt; type signature is not supported since the purpose of the Universal Token Router is to eliminate all interactive &lt;code&gt;approve&lt;&#x2F;code&gt; signatures for new tokens, and &lt;em&gt;most&lt;&#x2F;em&gt; for old tokens.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;tokens&quot;&gt;Tokens&lt;&#x2F;h3&gt;
&lt;p&gt;Old token contracts (ERC-20, ERC-721 and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt;) require approval for the Universal Token Router once for each account.&lt;&#x2F;p&gt;
&lt;p&gt;New token contracts can pre-configure the Universal Token Router as a trusted spender, and no approval transaction is required for interactive usage.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC20&#x2F;ERC20.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Implementation of the {ERC20} token standard that support a trusted ERC6120 contract as an unlimited spender.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC20WithUTR&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC20&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; immutable&lt;&#x2F;span&gt;&lt;span&gt; UTR&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sets the values for {name}, {symbol} and ERC6120&amp;#39;s {utr} address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * All three of these values are immutable: they can only be set once during&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * construction.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; utr&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; can be zero to disable trusted ERC6120 support.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; symbol&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; utr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;name, symbol) &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        UTR &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; utr&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See {IERC20-allowance}.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; allowance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;spender &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; UTR &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; spender &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;allowance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Does not check or update the allowance if `spender` is the UTR.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _spendAllowance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;spender &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; UTR &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; spender &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_spendAllowance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;applications&quot;&gt;Applications&lt;&#x2F;h3&gt;
&lt;p&gt;The only application contracts &lt;strong&gt;INCOMPATIBLE&lt;&#x2F;strong&gt; with the UTR are contracts that use &lt;code&gt;msg.sender&lt;&#x2F;code&gt; as the beneficiary address in their internal storage without any function for ownership transfer.&lt;&#x2F;p&gt;
&lt;p&gt;All application contracts that accept &lt;code&gt;recipient&lt;&#x2F;code&gt; (or &lt;code&gt;to&lt;&#x2F;code&gt;) argument as the beneficiary address are compatible with the UTR out of the box.&lt;&#x2F;p&gt;
&lt;p&gt;Application contracts that transfer tokens (ERC-20, ERC-721, and ERC-1155) to &lt;code&gt;msg.sender&lt;&#x2F;code&gt; need additional adapters to add a &lt;code&gt;recipient&lt;&#x2F;code&gt; to their functions.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; sample adapter contract for WETH&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; WethAdapter&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; deposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        IWETH&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;WETH&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;deposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        TransferHelper&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;safeTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;WETH&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Additional helper and adapter contracts might be needed, but they&#x27;re mostly peripheral and non-intrusive. They don&#x27;t hold any tokens or allowances, so they can be frequently updated and have little to no security impact on the core application contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;A reference implementation by Derion Labs and audited by Hacken.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The implementation of the EIP-6120.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @author&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Derion Labs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UniversalTokenRouter&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC165&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IUniversalTokenRouter&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; PAYMENT       &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; TRANSFER      &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; CALL_VALUE    &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; EIP_ETH       &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; ERC_721_BALANCE &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;#39;UniversalTokenRouter.ERC_721_BALANCE&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The main entry point of the router&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; outputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; token behavior for output verification&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; actions&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; router actions and inputs for execution&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; exec&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        Output&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; outputs&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        Action&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; actions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    unchecked&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; track the expected balances before any action is executed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; outputs&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            Output &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;memory&lt;&#x2F;span&gt;&lt;span&gt; output &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; outputs&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            uint256&lt;&#x2F;span&gt;&lt;span&gt; balance &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;output&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            uint256&lt;&#x2F;span&gt;&lt;span&gt; expected &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amountOutMin &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt; balance&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;expected &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; balance&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;#39;UTR: OUTPUT_BALANCE_OVERFLOW&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amountOutMin &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; expected&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; actions&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            Action &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;memory&lt;&#x2F;span&gt;&lt;span&gt; action &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; actions&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            uint256&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; j &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; j &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; action&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;inputs&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;j&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                Input &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;memory&lt;&#x2F;span&gt;&lt;span&gt; input &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; action&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;inputs&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;j&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                uint256&lt;&#x2F;span&gt;&lt;span&gt; mode &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; input&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;mode&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;mode &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; CALL_VALUE&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;                    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; eip and id are ignored&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    value &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; input&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amountIn&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;mode &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; PAYMENT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        bytes32&lt;&#x2F;span&gt;&lt;span&gt; key &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;                            msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; input&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;recipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; input&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;eip&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; input&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; input&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;id&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        )&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        uint&lt;&#x2F;span&gt;&lt;span&gt; amountIn &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; input&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amountIn&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;                            tstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amountIn&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;mode &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; TRANSFER&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;                        _transferToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; input&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;recipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; input&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;eip&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; input&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; input&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; input&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amountIn&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                        revert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;#39;UTR: INVALID_MODE&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;action&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;code &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span&gt; action&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span&gt; value &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    TokenChecker&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isNotToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;action&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    ERC165Checker&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;action&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x61206120&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;                    &amp;quot;UTR: NOT_CALLABLE&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt; success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; action&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;call&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;action&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                    assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                        revert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;result&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;mload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; clear all transient storages&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; j &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; j &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; action&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;inputs&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;j&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                Input &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;memory&lt;&#x2F;span&gt;&lt;span&gt; input &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; action&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;inputs&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;j&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;input&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;mode &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; PAYMENT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;                    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; transient storages&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    bytes32&lt;&#x2F;span&gt;&lt;span&gt; key &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;                        msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; input&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;recipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; input&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;eip&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; input&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; input&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;id&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    )&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                    assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;                        tstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; refund any left-over ETH&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; leftOver &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balance&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;leftOver &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            TransferHelper&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;safeTransferETH&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; leftOver&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; verify balance changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; outputs&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            Output &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;memory&lt;&#x2F;span&gt;&lt;span&gt; output &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; outputs&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            uint256&lt;&#x2F;span&gt;&lt;span&gt; balance &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;output&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; NOTE&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: output.amountOutMin is reused as `expected`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;balance &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amountOutMin&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;#39;UTR: INSUFFICIENT_OUTPUT_AMOUNT&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Spend the pending payment. Intended to be called from the input.action.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; payment&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; encoded payment data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; token amount to pay with payment&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; pay&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; payment&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        discard&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;payment&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            address&lt;&#x2F;span&gt;&lt;span&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            address&lt;&#x2F;span&gt;&lt;span&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            uint256&lt;&#x2F;span&gt;&lt;span&gt; eip&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            address&lt;&#x2F;span&gt;&lt;span&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            uint256&lt;&#x2F;span&gt;&lt;span&gt; id&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;decode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;payment&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _transferToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; eip&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Discard a part of a pending payment. Can be called from the input.action&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; to verify the payment without transferring any token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; payment&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; encoded payment data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; token amount to pay with payment&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; discard&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; payment&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; key &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;payment&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; remain&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            remain &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;remain &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;#39;UTR: INSUFFICIENT_PAYMENT&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            tstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; sub&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;remain&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; IERC165-supportsInterface&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;IUniversalTokenRouter&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _transferToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; eip&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;eip &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            TransferHelper&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;safeTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;eip &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1155&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            IERC1155&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;safeTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;eip &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 721&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            IERC721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;safeTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            revert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;UTR: INVALID_EIP&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        Output&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; output&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; balance&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; eip &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;eip&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;eip &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;recipient&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;eip &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1155&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC1155&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;recipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;eip &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 721&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;id &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; ERC_721_BALANCE&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;recipient&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            try&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; currentOwner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                return&lt;&#x2F;span&gt;&lt;span&gt; currentOwner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;recipient &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; :&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; catch&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;eip &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; EIP_ETH&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;recipient&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balance&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        revert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;UTR: INVALID_EIP&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;erc-165-tokens&quot;&gt;ERC-165 Tokens&lt;&#x2F;h3&gt;
&lt;p&gt;Token contracts must &lt;strong&gt;NEVER&lt;&#x2F;strong&gt; support the ERC-165 interface with the ID &lt;code&gt;0x61206120&lt;&#x2F;code&gt;, as it is reserved for non-token contracts to be called with the UTR. Any token with the interface ID &lt;code&gt;0x61206120&lt;&#x2F;code&gt; approved to the UTR can be spent by anyone, without any restrictions.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;reentrancy&quot;&gt;Reentrancy&lt;&#x2F;h3&gt;
&lt;p&gt;Tokens transferred to the UTR contract will be permanently lost, as there is no way to transfer them out. Applications that require an intermediate address to hold tokens should use their own Helper contract with a reentrancy guard for secure execution.&lt;&#x2F;p&gt;
&lt;p&gt;ETH must be transferred to the UTR contracts before the value is spent in an action call (using &lt;code&gt;CALL_VALUE&lt;&#x2F;code&gt;). This ETH value can be siphoned out of the UTR using a re-entrant call inside an action code or rogue token functions. This exploit will not be possible if users don&#x27;t transfer more ETH than they will spend in that transaction.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; transfer 100 in, but spend only 60,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; so at most 40 wei can be exploited in this transaction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;UniversalTokenRouter&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;exec&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    .&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        mode&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; CALL_VALUE&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        eip&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 20&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        token&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        id&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        amountIn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 60&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; spend 60&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        recipient&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; AddressZero&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    .&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 100&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; transfer 100 in&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;discard-payment-1&quot;&gt;Discard Payment&lt;&#x2F;h3&gt;
&lt;p&gt;The result of the &lt;code&gt;pay&lt;&#x2F;code&gt; function can be checked by querying the balance after the call, allowing the UTR contract to be called in a trustless manner. However, due to the inability to verify the execution of the &lt;code&gt;discard&lt;&#x2F;code&gt; function, it should only be used with a trusted UTR contract.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Supply validator deposits on chain</title>
        <published>2022-12-09T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Mikhail Kalinin</name><uri>https://github.com/mkalinin</uri>
	</author>
	
	<author>
		<name>Danny Ryan</name><uri>https://github.com/djrtwo</uri>
	</author>
	
	<author>
		<name>Peter Davies</name><uri>https://github.com/petertdavies</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6110/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6110-supply-validator-deposits-on-chain/12072" />
        

        <id>https://wg-eips.ritovision.com/6110/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:6110"
            label="EIP-6110" />
        

        
        

        
        <summary type="html">Provides validator deposits as a list of deposit operations added to the Execution Layer block</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6110/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Appends validator deposits to the Execution Layer block structure. This shifts responsibility of deposit inclusion and validation to the Execution Layer and removes the need for deposit (or &lt;code&gt;eth1data&lt;&#x2F;code&gt;) voting from the Consensus Layer.&lt;&#x2F;p&gt;
&lt;p&gt;Validator deposits list supplied in a block is obtained by parsing deposit contract log events emitted by each deposit transaction included in a given block.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Validator deposits are a core component of the proof-of-stake consensus mechanism. This EIP allows for an in-protocol mechanism of deposit processing on the Consensus Layer and eliminates the proposer voting mechanism utilized currently. This proposed mechanism relaxes safety assumptions and reduces complexity of client software design, contributing to the security of the deposits flow. It also improves validator UX.&lt;&#x2F;p&gt;
&lt;p&gt;Advantages of in-protocol deposit processing consist of, but are not limited to, the following:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Significant increase of deposits security by supplanting proposer voting. With the proposed in-protocol mechanism, an honest online node can&#x27;t be convinced to process fake deposits even when more than 2&#x2F;3 portion of stake is adversarial.&lt;&#x2F;li&gt;
&lt;li&gt;Decrease of delay between submitting deposit transaction on Execution Layer and its processing on Consensus Layer. That is, ~13 minutes with in-protocol deposit processing compared to ~12 hours with the existing mechanism.&lt;&#x2F;li&gt;
&lt;li&gt;Eliminate beacon block proposal dependency on JSON-RPC API data polling that suffers from failures caused by inconsistencies between JSON-RPC API implementations and dependency of API calls processing on the inner state (e.g. syncing) of client software.&lt;&#x2F;li&gt;
&lt;li&gt;Eliminate requirement to maintain and distribute deposit contract snapshots (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4881&#x2F;&quot;&gt;EIP-4881&lt;&#x2F;a&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;Reduction of design and engineering complexity of Consensus Layer client software on a component that has proven to be brittle.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;execution-layer&quot;&gt;Execution Layer&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Comment&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;DEPOSIT_REQUEST_TYPE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;b&#x27;0&#x27;&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7685&#x2F;&quot;&gt;EIP-7685&lt;&#x2F;a&gt; request type byte for deposit operation&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;configuration&quot;&gt;Configuration&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Comment&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;DEPOSIT_CONTRACT_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x00000000219ab540356cbb839cbe05303d7705fa&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Mainnet&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;DEPOSIT_EVENT_SIGNATURE_HASH&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x649bbc62d0e31342afea4e5cd82d4049e7e1ee912fc0889aa790803be39038c5&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;&lt;code&gt;DEPOSIT_CONTRACT_ADDRESS&lt;&#x2F;code&gt;, &lt;code&gt;DEPOSIT_EVENT_SIGNATURE_HASH&lt;&#x2F;code&gt; parameters &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be included into client software binary distribution.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;FORK_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; -- the first block in a blockchain after this EIP has been activated.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;deposit-request&quot;&gt;Deposit request&lt;&#x2F;h4&gt;
&lt;p&gt;The structure denoting the new deposit request consists of the following fields:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;pubkey: Bytes48&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;withdrawal_credentials: Bytes32&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;amount: uint64&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;signature: Bytes96&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;index: uint64&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Deposits are a type of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7685&#x2F;&quot;&gt;EIP-7685&lt;&#x2F;a&gt; request, with the following encoding:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;request_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; DEPOSIT_REQUEST_TYPE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;request_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_deposit_request_data&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;receipts&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;block-validity&quot;&gt;Block validity&lt;&#x2F;h4&gt;
&lt;p&gt;Beginning with the &lt;code&gt;FORK_BLOCK&lt;&#x2F;code&gt;, each deposit accumulated in the block &lt;strong&gt;MUST&lt;&#x2F;strong&gt; appear in the EIP-7685 requests list
in the order they appear in the logs. To illustrate:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; parse_deposit_data&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;deposit_event_data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;  Parses deposit data from DepositContract.DepositEvent data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  pass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; is_valid_deposit_event_data&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;deposit_event_data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Verifies the layout of the DepositEvent. Returns `False` if the layout is unsupported,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    `True` if the layout is of the expected format.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;deposit_event_data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 576&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    pubkey_offset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;deposit_event_data&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; byteorder&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;big&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;False&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    withdrawal_credentials_offset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;deposit_event_data&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;64&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; byteorder&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;big&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;False&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    amount_offset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;deposit_event_data&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;64&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;96&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; byteorder&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;big&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;False&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signature_offset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;deposit_event_data&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;96&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;128&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; byteorder&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;big&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;False&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    index_offset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;deposit_event_data&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;128&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;160&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; byteorder&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;big&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;False&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        pubkey_offset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 160&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        or&lt;&#x2F;span&gt;&lt;span&gt; withdrawal_credentials_offset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        or&lt;&#x2F;span&gt;&lt;span&gt; amount_offset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 320&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        or&lt;&#x2F;span&gt;&lt;span&gt; signature_offset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 384&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        or&lt;&#x2F;span&gt;&lt;span&gt; index_offset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 512&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; These sizes are the sizes of the relevant data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    pubkey_size&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;deposit_event_data&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;pubkey_offset&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;pubkey_offset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; byteorder&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;big&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;False&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    withdrawal_credentials_size&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;deposit_event_data&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;withdrawal_credentials_offset&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;withdrawal_credentials_offset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; byteorder&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;big&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;False&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    amount_size&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;deposit_event_data&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;amount_offset&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;amount_offset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; byteorder&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;big&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;False&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signature_size&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;deposit_event_data&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;signature_offset&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;signature_offset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; byteorder&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;big&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;False&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    index_size&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;deposit_event_data&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;index_offset&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;index_offset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; byteorder&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;big&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;False&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        pubkey_size&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 48&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        and&lt;&#x2F;span&gt;&lt;span&gt; withdrawal_credentials_size&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        and&lt;&#x2F;span&gt;&lt;span&gt; amount_size&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        and&lt;&#x2F;span&gt;&lt;span&gt; signature_size&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 96&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        and&lt;&#x2F;span&gt;&lt;span&gt; index_size&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; event_data_to_deposit_request&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;deposit_event_data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    deposit_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; parse_deposit_data&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;deposit_event_data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Bytes48&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;deposit_data&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    withdrawal_credentials&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;deposit_data&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; deposit_data&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;   #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 8 bytes uint64 LE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Bytes96&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;deposit_data&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; deposit_data&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 8 bytes uint64 LE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; withdrawal_credentials&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; index&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_deposit_request_data&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;receipts&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieve all deposits made in the block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    deposit_requests&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; receipt&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; receipts&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; log&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; receipt&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;logs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; log&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; DEPOSIT_CONTRACT_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;log&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;topics&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span&gt; log&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;topics&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; DEPOSIT_EVENT_SIGNATURE_HASH&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                    assert&lt;&#x2F;span&gt;&lt;span&gt; is_valid_deposit_event_data&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;log&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;invalid deposit log: unsupported data layout&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    deposit_request&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; event_data_to_deposit_request&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;log&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    deposit_requests&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;deposit_request&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Concatenate list of deposit request data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;join&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;deposit_requests&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;consensus-layer&quot;&gt;Consensus layer&lt;&#x2F;h3&gt;
&lt;p&gt;Consensus layer changes can be summarized into the following list:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;ExecutionRequests&lt;&#x2F;code&gt; is extended with a new &lt;code&gt;deposit_requests&lt;&#x2F;code&gt; field to accommodate deposit requests list.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;BeaconState&lt;&#x2F;code&gt; is appended with &lt;code&gt;deposit_requests_start_index&lt;&#x2F;code&gt; used to switch from the former deposit mechanism to the new one.&lt;&#x2F;li&gt;
&lt;li&gt;As a part of transition logic a new beacon block validity condition is added to constrain the usage of &lt;code&gt;Eth1Data&lt;&#x2F;code&gt; poll.&lt;&#x2F;li&gt;
&lt;li&gt;A new &lt;code&gt;process_deposit_request&lt;&#x2F;code&gt; function is added to the block processing routine to handle &lt;code&gt;deposit_requests&lt;&#x2F;code&gt; processing.&lt;&#x2F;li&gt;
&lt;li&gt;Validator guide provides a logic switching off &lt;code&gt;Eth1Data&lt;&#x2F;code&gt; poll once transition is completed.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Detailed consensus layer specification can be found in following documents:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;eba62dbf00132dfdc97fbfab663a99cb23b9e8f1&#x2F;specs&#x2F;electra&#x2F;beacon-chain.md&quot;&gt;&lt;code&gt;electra&#x2F;beacon-chain.md&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; -- state transition.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;eba62dbf00132dfdc97fbfab663a99cb23b9e8f1&#x2F;specs&#x2F;electra&#x2F;validator.md&quot;&gt;&lt;code&gt;electra&#x2F;validator.md&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; -- validator guide.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;eba62dbf00132dfdc97fbfab663a99cb23b9e8f1&#x2F;specs&#x2F;electra&#x2F;fork.md&quot;&gt;&lt;code&gt;electra&#x2F;fork.md&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; -- EIP activation.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;validator-index-invariant&quot;&gt;Validator index invariant&lt;&#x2F;h4&gt;
&lt;p&gt;Due to the large follow distance of &lt;code&gt;Eth1Data&lt;&#x2F;code&gt; poll an index of a new validator assigned during deposit processing remains the same across different branches of a block tree, i.e. with existing mechanism &lt;code&gt;(pubkey, index)&lt;&#x2F;code&gt; cache utilized by consensus layer clients is re-org resilient. The new deposit machinery breaks this invariant and consensus layer clients will have to deal with a fact that a validator index becomes fork dependent, i.e. a validator with the same &lt;code&gt;pubkey&lt;&#x2F;code&gt; can have different indexes in different block tree branches.&lt;&#x2F;p&gt;
&lt;p&gt;Detailed &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6110&#x2F;assets&#x2F;pubkey_to_index_cache_analysis&#x2F;&quot;&gt;analysis&lt;&#x2F;a&gt; shows that &lt;code&gt;process_deposit&lt;&#x2F;code&gt; function is &lt;em&gt;the only&lt;&#x2F;em&gt; place requiring a fork dependent &lt;code&gt;(pubkey, index)&lt;&#x2F;code&gt; cache.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;eth1data-poll-deprecation&quot;&gt;&lt;code&gt;Eth1Data&lt;&#x2F;code&gt; poll deprecation&lt;&#x2F;h4&gt;
&lt;p&gt;Consensus layer clients will be able to remove &lt;code&gt;Eth1Data&lt;&#x2F;code&gt; poll mechanism in an uncoordinated fashion once transition period is finished. The transition period is considered as finished when a network reaches the point where &lt;code&gt;state.eth1_deposit_index == state.deposit_requests_start_index&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;index-field&quot;&gt;&lt;code&gt;index&lt;&#x2F;code&gt; field&lt;&#x2F;h3&gt;
&lt;p&gt;Deposit &lt;code&gt;index&lt;&#x2F;code&gt; is used to deterministically initialize &lt;code&gt;deposit_requests_start_index&lt;&#x2F;code&gt; in the &lt;code&gt;BeaconState&lt;&#x2F;code&gt;, this prevents same deposit from being applied twice during &lt;code&gt;Eth1Data&lt;&#x2F;code&gt; poll deprecation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;not-limiting-the-size-of-deposit-operations-list&quot;&gt;Not limiting the size of deposit operations list&lt;&#x2F;h3&gt;
&lt;p&gt;The list is unbounded because of negligible data complexity and absence of potential DoS vectors. See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6110&#x2F;#security-considerations&quot;&gt;Security Considerations&lt;&#x2F;a&gt; for more details.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;filtering-events-by-deposit-contract-address-and-deposit-event-signature-hash&quot;&gt;Filtering events by &lt;code&gt;DEPOSIT_CONTRACT_ADDRESS&lt;&#x2F;code&gt; and &lt;code&gt;DEPOSIT_EVENT_SIGNATURE_HASH&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Depending on the design, Deposit smart contract can emit different type of events when deposit is being processed. For instance, Deposit smart contract on Sepolia emits &lt;code&gt;Transfer&lt;&#x2F;code&gt; in addition to &lt;code&gt;DepositEvent&lt;&#x2F;code&gt;. Thus it is important to filter out irrelevant events.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces backwards incompatible changes to the block structure and block validation rule set. But neither of these changes break anything related to user activity and experience.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;data-complexity&quot;&gt;Data complexity&lt;&#x2F;h3&gt;
&lt;p&gt;At the time of the latest update of this document, the total number of submitted deposits is 1,899,120 which is 348MB of deposit data. Assuming frequency of deposit transactions remains the same, historic chain data complexity induced by this EIP can be estimated as 84MB per year which is negligible in comparison to other historical data.&lt;&#x2F;p&gt;
&lt;p&gt;After the beacon chain launch in December 2020, the biggest observed spike in a number of submitted deposits was on June 1, 2023. More than 12,000 deposit transactions were submitted during 24 hours which on average is less than 2 deposit, or 384 bytes of data, per block.&lt;&#x2F;p&gt;
&lt;p&gt;Considering the above, we conclude that data complexity introduced by this proposal is negligible.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;dos-vectors&quot;&gt;DoS vectors&lt;&#x2F;h3&gt;
&lt;p&gt;The code in the deposit contract costs 15,650 gas to run in the cheapest case (when all storage slots are hot and only a single leaf has to be modified). Some deposits in a batch deposit are more expensive, but those costs, when amortized over a large number of deposits, are small at around ~1,000 gas per deposit. Under current gas pricing rules an extra 6,900 gas is charged to make a &lt;code&gt;CALL&lt;&#x2F;code&gt; that transfers ETH, this is a case of inefficient gas pricing and may be reduced in the future. For future robustness the beacon chain needs to be able to withstand 1,916 deposits in a 30M gas block (15,650 gas per deposit). The limit under current rules is less than 1,271 deposits in a 30M gas block.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;execution-layer-1&quot;&gt;Execution layer&lt;&#x2F;h4&gt;
&lt;p&gt;With 1 ETH as a minimum deposit amount, the lowest cost of a byte of deposit data is 1 ETH&#x2F;192 ~ 5,208,333 Gwei. This is several orders of magnitude higher than the cost of a byte of transaction&#x27;s calldata, thus adding deposit operations to a block does not increase DoS attack surface of the execution layer.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;consensus-layer-1&quot;&gt;Consensus layer&lt;&#x2F;h4&gt;
&lt;p&gt;The most consuming computation of deposit processing is signature verification. Its complexity is bounded by a maximum number of deposits per block which is around 1,271 with 30M gas block at the moment. So, it is ~1,271 signature verifications which is roughly ~1.2 seconds of processing (without optimisations like batched signatures verification). An attacker would need to spend 1,000 ETH to slow down block processing by a second which isn&#x27;t sustainable and viable attack long term.&lt;&#x2F;p&gt;
&lt;p&gt;An optimistically syncing node may be susceptible to a more severe attack scenario. Such a node can&#x27;t validate a list of deposits provided in a payload which makes it possible for attacker to include as many deposits as the limitation allows to. Currently, it is 8,192 deposits (1.5MB of data) with rough processing time of 8s. Considering an attacker would need to sign off on this block with its crypto economically viable signature (which requires building an alternative chain and feeding it to a syncing node), this attack vector is not considered as viable as it can&#x27;t result in a significant slow down of a sync process.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;optimistic-sync&quot;&gt;Optimistic sync&lt;&#x2F;h3&gt;
&lt;p&gt;An optimistically syncing node has to rely on the honest majority assumption. That is, if adversary is powerful enough to finalize a deposit sequence, a syncing node will have to apply these deposits disregarding the validity of deposit requests with respect to the execution of a given block. Thus, an adversary that can finalize an invalid chain can also convince an honest node to accept fake deposits. The same is applicable to the validity of execution layer world state today and a new deposit processing design is within boundaries of the existing security model in that regard.&lt;&#x2F;p&gt;
&lt;p&gt;Online nodes can&#x27;t be tricked into this situation because their execution layer validates supplied deposits with respect to the block execution.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;weak-subjectivity-period&quot;&gt;Weak subjectivity period&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP removes a hard limit on a number of deposits per epoch and makes a block gas limit the only limitation on this number. That is, the limit on deposits per epoch shifts from &lt;code&gt;MAX_DEPOSITS * SLOTS_PER_EPOCH = 512&lt;&#x2F;code&gt; to &lt;code&gt;max_deposits_per_30m_gas_block * SLOTS_PER_EPOCH ~ 32,768&lt;&#x2F;code&gt; at 30M gas block (we consider &lt;code&gt;max_deposits_per_30m_gas_block = 1,024&lt;&#x2F;code&gt; for simplicity).&lt;&#x2F;p&gt;
&lt;p&gt;This change affects a number of top ups per epoch which is one of the inputs to the weak subjectivity period computation. One can top up own validators to instantly increase a portion of stake it owns with respect to those validators that are leaking. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6110&#x2F;assets&#x2F;ws_period_analysis&#x2F;&quot;&gt;The analysis&lt;&#x2F;a&gt; does not demonstrate significant reduction of a weak subjectivity period sizes. Moreover, such an attack is not considered as viable because it requires a decent portion of stake to be burned as one of preliminaries.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Guard of NFT&#x2F;SBT, an Extension of ERC-721</title>
        <published>2022-12-07T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>5660-eth</name><uri>https://github.com/5660-eth</uri>
	</author>
	
	<author>
		<name>Wizard Wang</name>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6147/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/guard-of-nft-sbt-an-extension-of-eip-721/12052" />
        

        <id>https://wg-eips.ritovision.com/6147/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:6147"
            label="ERC-6147" />
        

        
        

        
        <summary type="html">A new management role with an expiration date of NFT&#x2F;SBT is defined, achieving the separation of transfer right and holding right.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6147/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is an extension of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;. It separates the holding right and transfer right of non-fungible tokens (NFTs) and Soulbound Tokens (SBTs) and defines a new role, &lt;code&gt;guard&lt;&#x2F;code&gt; with &lt;code&gt;expires&lt;&#x2F;code&gt;. The flexibility of the &lt;code&gt;guard&lt;&#x2F;code&gt; setting enables the design of NFT anti-theft, NFT lending, NFT leasing, SBT, etc.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;NFTs are assets that possess both use and financial value.&lt;&#x2F;p&gt;
&lt;p&gt;Many cases of NFT theft currently exist, and current NFT anti-theft schemes, such as transferring NFTs to cold wallets, make NFTs inconvenient to be used.&lt;&#x2F;p&gt;
&lt;p&gt;In current NFT lending, the NFT owner needs to transfer the NFT to the NFT lending contract, and the NFT owner no longer has the right to use the NFT while he has obtained the loan. In the real world, for example, if a person takes out a mortgage on his own house, he still has the right to use that house.&lt;&#x2F;p&gt;
&lt;p&gt;For SBT, the current mainstream view is that an SBT is not transferable, which makes an SBT bound to an Ether address. However, when the private key of the user address is leaked or lost, retrieving SBT will become a complicated task and there is no corresponding standard. The SBTs essentially realizes the separation of NFT holding right and transfer right. When the wallet where SBT is located is stolen or unavailable, SBT should be able to be recoverable.&lt;&#x2F;p&gt;
&lt;p&gt;In addition, SBTs still need to be managed in use. For example, if a university issues diploma-based SBTs to its graduates, and if the university later finds that a graduate has committed academic misconduct or jeopardized the reputation of the university, it should have the ability to retrieve the diploma-based SBTs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot; and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;ERC-721 compliant contracts MAY implement this EIP.&lt;&#x2F;p&gt;
&lt;p&gt;A guard Must be valid only before expires.&lt;&#x2F;p&gt;
&lt;p&gt;When a token has no guard or the guard is expired, &lt;code&gt;guardInfo&lt;&#x2F;code&gt; MUST return &lt;code&gt;(address(0), 0)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;When a token has no guard or the guard is expired, owner, authorised operators and approved address of the token MUST have permission to set guard and expires.&lt;&#x2F;p&gt;
&lt;p&gt;When a token has a valid guard, owner, authorised operators and approved address of the token MUST NOT be able to change guard and expires, and they MUST NOT be able to transfer the token.&lt;&#x2F;p&gt;
&lt;p&gt;When a token has a valid guard, &lt;code&gt;guardInfo&lt;&#x2F;code&gt; MUST return the address and expires of the guard.&lt;&#x2F;p&gt;
&lt;p&gt;When a token has a valid guard, the guard MUST be able to remove guard and expires, change guard and expires, and transfer the token.&lt;&#x2F;p&gt;
&lt;p&gt;When a token has a valid guard, if the token burns, the guard MUST be deleted.&lt;&#x2F;p&gt;
&lt;p&gt;If issuing or minting SBTs, the guard MAY be uniformly set to the designated address to facilitate management.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;contract-interface&quot;&gt;Contract Interface&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6147&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Logged when the guard of an NFT is &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; or expires is &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when the `guard` is &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; or the `expires` is &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         The zero address for `newGuard` indicates that there currently is no guard address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UpdateGuardLog&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newGuard&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; oldGuard&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expires&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Owner, authorised operators and approved address of the NFT can set guard and expires of the NFT and&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         valid guard can modifiy guard and expires of the NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         If the NFT has a valid guard role, the owner, authorised operators and approved address of the NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         cannot modify guard and expires&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The `newGuard` can not be zero address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      The `expires` need to be valid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      Throws if `tokenId` is not valid NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT to get the guard address for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; newGuard&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The new guard address of the NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; expires&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; UNIX timestamp, the guard could manage the token before expires&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; changeGuard&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newGuard&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expires&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Remove the guard and expires of the NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         Only guard can remove its own guard role and expires&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The guard address is set to 0 address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      The expires is set to 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      Throws if `tokenId` is not valid NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT to remove the guard and expires for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; removeGuard&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfer the NFT and remove its guard and expires&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT is transferred to `to` and the guard address is set to 0 address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      Throws if `tokenId` is not valid NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the previous owner of the NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of NFT recipient &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT to get transferred for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferAndRemove&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the guard address and expires of the NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The zero address indicates that there is no guard&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT to get the guard address and expires for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; guard address and expires for the NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; guardInfo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;   &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;changeGuard(uint256 tokenId, address newGuard, uint64 expires)&lt;&#x2F;code&gt; function MAY be implemented as &lt;code&gt;public&lt;&#x2F;code&gt; or &lt;code&gt;external&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;removeGuard(uint256 tokenId)&lt;&#x2F;code&gt; function MAY be implemented as &lt;code&gt;public&lt;&#x2F;code&gt; or &lt;code&gt;external&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;transferAndRemove(address from,address to,uint256 tokenId)&lt;&#x2F;code&gt; function MAY be implemented as &lt;code&gt;public&lt;&#x2F;code&gt; or &lt;code&gt;external&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;guardInfo(uint256 tokenId)&lt;&#x2F;code&gt; function MAY be implemented as &lt;code&gt;pure&lt;&#x2F;code&gt; or &lt;code&gt;view&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;UpdateGuardLog&lt;&#x2F;code&gt; event MUST be emitted when a guard is changed.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; method MUST return &lt;code&gt;true&lt;&#x2F;code&gt; when called with &lt;code&gt;0xb61d1057&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;universality&quot;&gt;Universality&lt;&#x2F;h3&gt;
&lt;p&gt;There are many application scenarios for NFT&#x2F;SBT, and there is no need to propose a dedicated EIP for each one, which would make the overall number of EIPS inevitably increase and add to the burden of developers. The standard is based on the analysis of the right attached to assets in the real world, and abstracts the right attached to NFT&#x2F;SBT into holding right and transfer right making the standard more universal.&lt;&#x2F;p&gt;
&lt;p&gt;For example, the standard has more than the following use cases:&lt;&#x2F;p&gt;
&lt;p&gt;SBTs. The SBTs issuer can assign a uniform role of &lt;code&gt;guard&lt;&#x2F;code&gt; to the SBTs before they are minted, so that the SBTs cannot be transferred by the corresponding holders and can be managed by the SBTs issuer through the &lt;code&gt;guard&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;NFT anti-theft. If an NFT holder sets a &lt;code&gt;guard&lt;&#x2F;code&gt; address of an NFT as his or her own cold wallet address, the NFT can still be used by the NFT holder, but the risk of theft is greatly reduced.&lt;&#x2F;p&gt;
&lt;p&gt;NFT lending. The borrower sets the &lt;code&gt;guard&lt;&#x2F;code&gt; of his or her own NFT as the lender&#x27;s address, the borrower still has the right to use the NFT while obtaining the loan, but at the same time cannot transfer or sell the NFT. If the borrower defaults on the loan, the lender can transfer and sell the NFT.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, by setting an &lt;code&gt;expires&lt;&#x2F;code&gt; for the &lt;code&gt;guard&lt;&#x2F;code&gt;, the scalability of the protocol is further enhanced, as demonstrated in the following examples:&lt;&#x2F;p&gt;
&lt;p&gt;More flexible NFT issuance. During NFT minting, discounts can be offered for NFTs that are locked for a certain period of time, without affecting the NFTs&#x27; usability.&lt;&#x2F;p&gt;
&lt;p&gt;More secure NFT management. Even if the &lt;code&gt;guard&lt;&#x2F;code&gt; address becomes inaccessible due to lost private keys, the &lt;code&gt;owner&lt;&#x2F;code&gt; can still retrieve the NFT after the &lt;code&gt;guard&lt;&#x2F;code&gt; has expired.&lt;&#x2F;p&gt;
&lt;p&gt;Valid SBTs. Some SBTs have a period of use. More effective management can be achieved through &lt;code&gt;guard&lt;&#x2F;code&gt; and &lt;code&gt;expires&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;extensibility&quot;&gt;Extensibility&lt;&#x2F;h3&gt;
&lt;p&gt;This standard only defines a &lt;code&gt;guard&lt;&#x2F;code&gt; and its &lt;code&gt;expires&lt;&#x2F;code&gt;. For complex functions needed by NFTs and SBTs, such as social recovery and multi-signature, the &lt;code&gt;guard&lt;&#x2F;code&gt; can be set as a third-party protocol address. Through the third-party protocol, more flexible and diverse functions can be achieved based on specific application scenarios.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;naming&quot;&gt;Naming&lt;&#x2F;h3&gt;
&lt;p&gt;The alternative names are &lt;code&gt;guardian&lt;&#x2F;code&gt; and &lt;code&gt;guard&lt;&#x2F;code&gt;, both of which basically match the permissions corresponding to the role: protection of NFT or necessary management according to its application scenarios. The &lt;code&gt;guard&lt;&#x2F;code&gt; has fewer characters than the &lt;code&gt;guardian&lt;&#x2F;code&gt; and is more concise.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This standard can be fully ERC-721 compatible by adding an extension function set.&lt;&#x2F;p&gt;
&lt;p&gt;If an NFT issued based on the above standard does not set a &lt;code&gt;guard&lt;&#x2F;code&gt;, then it is no different in the existing functions from the current NFT issued based on the ERC-721 standard.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.8&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC721&#x2F;ERC721.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERC6147.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;abstract&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC6147&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC6147&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A structure representing a token of guard address and expires&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; guard&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address of guard role&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; expirs&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; UNIX timestamp, the guard could manage the token before expires&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; GuardInfo&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; guard&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint64&lt;&#x2F;span&gt;&lt;span&gt; expires&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; GuardInfo&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; _guardInfo&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Owner, authorised operators and approved address of the NFT can set guard and expires of the NFT and&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         valid guard can modifiy guard and expires of the NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         If the NFT has a valid guard role, the owner, authorised operators and approved address of the NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         cannot modify guard and expires&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The `newGuard` can not be zero address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      The `expires` need to be valid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      Throws if `tokenId` is not valid NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT to get the guard address for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; newGuard&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The new guard address of the NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; expires&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; UNIX timestamp, the guard could manage the token before expires&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; changeGuard&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newGuard&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expires&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;expires &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC6147: invalid expires&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _updateGuard&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; newGuard&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; expires&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Remove the guard and expires of the NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         Only guard can remove its own guard role and expires&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The guard address is set to 0 address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      The expires is set to 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      Throws if `tokenId` is not valid NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT to remove the guard and expires for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; removeGuard&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _updateGuard&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfer the NFT and remove its guard and expires&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT is transferred to `to` and the guard address is set to 0 address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      Throws if `tokenId` is not valid NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the previous owner of the NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of NFT recipient &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT to get transferred for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferAndRemove&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        safeTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        removeGuard&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the guard address and expires of the NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The zero address indicates that there is no guard&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT to get the guard address and expires for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; guard address and expires for the NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; guardInfo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_guardInfo&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;expires &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;_guardInfo&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;guard&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _guardInfo&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;expires&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        else&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Update the guard of the NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Delete function: set guard to 0 address and set expires to 0; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      and update function: set guard to new address and set expires&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      Throws if `tokenId` is not valid NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT to update the guard address for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; newGuard&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The newGuard address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; expires&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; UNIX timestamp, the guard could manage the token before expires&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; allowNull&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Allow 0 address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _updateGuard&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newGuard&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expires&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; allowNull&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; guard&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; guardInfo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;allowNull&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;newGuard &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC6147: new guard can not be null&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;guard &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;guard &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _msgSender&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC6147: only guard can change it self&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_isApprovedOrOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_msgSender&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC6147: caller is not owner nor approved&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;guard &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span&gt; newGuard &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            _guardInfo&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; GuardInfo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;newGuard&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;expires&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UpdateGuardLog&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; newGuard&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; guard&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; expires&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check the guard address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The zero address indicates there is no guard&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT to check the guard address for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; guard address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _checkGuard&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; guard&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; )&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; guardInfo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; sender &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _msgSender&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;guard &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;guard &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC6147: sender is not guard of the token&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; guard&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Before transferring the NFT, need to check the gurard address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; guard&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; new_from &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; from&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;from &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            guard &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _checkGuard&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            new_from &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;guard &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;                _isApprovedOrOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_msgSender&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;                &amp;quot;ERC721: transfer caller is not owner nor approved&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;new_from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Before safe transferring the NFT, need to check the gurard address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; guard&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; new_from &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; from&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;from &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            guard &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _checkGuard&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            new_from &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;guard &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;                _isApprovedOrOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_msgSender&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;                &amp;quot;ERC721: transfer caller is not owner nor approved&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _safeTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; When burning, delete `token_guard_map[tokenId]`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This is an internal function that does not check if the sender is authorized to operate on the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _burn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; guard&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; )&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;guardInfo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_burn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        delete&lt;&#x2F;span&gt;&lt;span&gt; _guardInfo&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UpdateGuardLog&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; guard&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See {IERC165-supportsInterface}.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;IERC6147&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Make sure to set an appropriate &lt;code&gt;expires&lt;&#x2F;code&gt; for the &lt;code&gt;guard&lt;&#x2F;code&gt;, based on the specific application scenario.&lt;&#x2F;p&gt;
&lt;p&gt;When an NFT has a valid guard, even if an address is authorized as an operator through &lt;code&gt;approve&lt;&#x2F;code&gt; or &lt;code&gt;setApprovalForAll&lt;&#x2F;code&gt;, the operator still has no right to transfer the NFT.&lt;&#x2F;p&gt;
&lt;p&gt;When an NFT has a valid guard, the &lt;code&gt;owner&lt;&#x2F;code&gt; cannot sell the NFT. Some trading platforms list NFTs through &lt;code&gt;setApprovalForAll&lt;&#x2F;code&gt; and owners&#x27; signature. It is recommended to prevent listing these NFTs by checking &lt;code&gt;guardInfo&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Custom errors for commonly-used tokens</title>
        <published>2022-12-06T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Ernesto García</name><uri>https://github.com/ernestognw</uri>
	</author>
	
	<author>
		<name>Francisco Giordano</name><uri>https://github.com/frangio</uri>
	</author>
	
	<author>
		<name>Hadrien Croubois</name><uri>https://github.com/Amxx</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6093/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6093-custom-errors-for-erc-tokens/12043" />
        

        <id>https://wg-eips.ritovision.com/6093/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:6093"
            label="ERC-6093" />
        

        
        

        
        <summary type="html">Lists custom errors for common token implementations</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6093/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP defines a standard set of custom errors for commonly-used tokens, which are defined as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;, and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; tokens.&lt;&#x2F;p&gt;
&lt;p&gt;Ethereum applications and wallets have historically relied on revert reason strings to display the cause of transaction errors to users. Recent Solidity versions offer rich revert reasons with error-specific decoding (sometimes called &quot;custom errors&quot;). This EIP defines a standard set of errors designed to give at least the same relevant information as revert reason strings, but in a structured and expected way that clients can implement decoding for.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Since the introduction of Solidity custom errors in v0.8.4, these have provided a way to show failures in a more expressive and gas efficient manner with dynamic arguments, while reducing deployment costs.&lt;&#x2F;p&gt;
&lt;p&gt;However, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; were already finalized when custom errors were released, so no errors are included in their specification.&lt;&#x2F;p&gt;
&lt;p&gt;Standardized errors allow users to expect more consistent error messages across applications or testing environments, while exposing pertinent arguments and overall reducing the need of writing expensive revert strings in the deployment bytecode.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;The following errors were designed according to the criteria described in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6093&#x2F;#rationale&quot;&gt;Rationale&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP defines standard errors that may be used by implementations in certain scenarios but it does not specify whether implementations should revert in those scenarios, which remains up to the implementers unless a revert is mandated by the corresponding EIPs.&lt;&#x2F;p&gt;
&lt;p&gt;The names of the error arguments are defined in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6093&#x2F;#parameter-glossary&quot;&gt;Parameter Glossary&lt;&#x2F;a&gt; and MUST be used according to those definitions.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;erc-20&quot;&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;erc20insufficientbalance-address-sender-uint256-balance-uint256-needed&quot;&gt;&lt;code&gt;ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed)&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Indicates an error related to the current &lt;code&gt;balance&lt;&#x2F;code&gt; of a &lt;code&gt;sender&lt;&#x2F;code&gt;.
Used in transfers.&lt;&#x2F;p&gt;
&lt;p&gt;Usage guidelines:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;balance&lt;&#x2F;code&gt; MUST be less than &lt;code&gt;needed&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;erc20invalidsender-address-sender&quot;&gt;&lt;code&gt;ERC20InvalidSender(address sender)&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Indicates a failure with the token &lt;code&gt;sender&lt;&#x2F;code&gt;.
Used in transfers.&lt;&#x2F;p&gt;
&lt;p&gt;Usage guidelines:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;RECOMMENDED for disallowed transfers from the zero address.&lt;&#x2F;li&gt;
&lt;li&gt;MUST NOT be used for approval operations.&lt;&#x2F;li&gt;
&lt;li&gt;MUST NOT be used for balance or allowance requirements.
&lt;ul&gt;
&lt;li&gt;Use &lt;code&gt;ERC20InsufficientBalance&lt;&#x2F;code&gt; or &lt;code&gt;ERC20InsufficientAllowance&lt;&#x2F;code&gt; instead.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;erc20invalidreceiver-address-receiver&quot;&gt;&lt;code&gt;ERC20InvalidReceiver(address receiver)&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Indicates a failure with the token &lt;code&gt;receiver&lt;&#x2F;code&gt;.
Used in transfers.&lt;&#x2F;p&gt;
&lt;p&gt;Usage guidelines:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;RECOMMENDED for disallowed transfers to the zero address.&lt;&#x2F;li&gt;
&lt;li&gt;RECOMMENDED for disallowed transfers to non-compatible addresses (eg. contract addresses).&lt;&#x2F;li&gt;
&lt;li&gt;MUST NOT be used for approval operations.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;erc20insufficientallowance-address-spender-uint256-allowance-uint256-needed&quot;&gt;&lt;code&gt;ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed)&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Indicates a failure with the &lt;code&gt;spender&lt;&#x2F;code&gt;&#x27;s &lt;code&gt;allowance&lt;&#x2F;code&gt;.
Used in transfers.&lt;&#x2F;p&gt;
&lt;p&gt;Usage guidelines:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;allowance&lt;&#x2F;code&gt; MUST be less than &lt;code&gt;needed&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;erc20invalidapprover-address-approver&quot;&gt;&lt;code&gt;ERC20InvalidApprover(address approver)&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Indicates a failure with the &lt;code&gt;approver&lt;&#x2F;code&gt; of a token to be approved.
Used in approvals.&lt;&#x2F;p&gt;
&lt;p&gt;Usage guidelines:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;RECOMMENDED for disallowed approvals from the zero address.&lt;&#x2F;li&gt;
&lt;li&gt;MUST NOT be used for transfer operations.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;erc20invalidspender-address-spender&quot;&gt;&lt;code&gt;ERC20InvalidSpender(address spender)&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Indicates a failure with the &lt;code&gt;spender&lt;&#x2F;code&gt; to be approved.
Used in approvals.&lt;&#x2F;p&gt;
&lt;p&gt;Usage guidelines:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;RECOMMENDED for disallowed approvals to the zero address.&lt;&#x2F;li&gt;
&lt;li&gt;RECOMMENDED for disallowed approvals to the owner itself.&lt;&#x2F;li&gt;
&lt;li&gt;MUST NOT be used for transfer operations.
&lt;ul&gt;
&lt;li&gt;Use &lt;code&gt;ERC20InsufficientAllowance&lt;&#x2F;code&gt; instead.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;erc-721&quot;&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;erc721invalidowner-address-owner&quot;&gt;&lt;code&gt;ERC721InvalidOwner(address owner)&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Indicates that an address can&#x27;t be an owner.
Used in balance queries.&lt;&#x2F;p&gt;
&lt;p&gt;Usage guidelines:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;RECOMMENDED for addresses whose ownership is disallowed (eg. ERC-721 explicitly disallows &lt;code&gt;address(0)&lt;&#x2F;code&gt; to be an owner).&lt;&#x2F;li&gt;
&lt;li&gt;MUST NOT be used for transfers.
&lt;ul&gt;
&lt;li&gt;Use &lt;code&gt;ERC721IncorrectOwner&lt;&#x2F;code&gt; instead.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;erc721nonexistenttoken-uint256-tokenid&quot;&gt;&lt;code&gt;ERC721NonexistentToken(uint256 tokenId)&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Indicates a &lt;code&gt;tokenId&lt;&#x2F;code&gt; whose &lt;code&gt;owner&lt;&#x2F;code&gt; is the zero address.&lt;&#x2F;p&gt;
&lt;p&gt;Usage guidelines:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;tokenId&lt;&#x2F;code&gt; MUST BE a non-minted or burned token.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;erc721incorrectowner-address-sender-uint256-tokenid-address-owner&quot;&gt;&lt;code&gt;ERC721IncorrectOwner(address sender, uint256 tokenId, address owner)&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Indicates an error related to the ownership over a particular token.
Used in transfers.&lt;&#x2F;p&gt;
&lt;p&gt;Usage guidelines:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;sender&lt;&#x2F;code&gt; MUST NOT be &lt;code&gt;owner&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;MUST NOT be used for approval operations.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;erc721invalidsender-address-sender&quot;&gt;&lt;code&gt;ERC721InvalidSender(address sender)&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Indicates a failure with the token &lt;code&gt;sender&lt;&#x2F;code&gt;.
Used in transfers.&lt;&#x2F;p&gt;
&lt;p&gt;Usage guidelines:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;RECOMMENDED for disallowed transfers from the zero address.&lt;&#x2F;li&gt;
&lt;li&gt;MUST NOT be used for approval operations.&lt;&#x2F;li&gt;
&lt;li&gt;MUST NOT be used for ownership or approval requirements.
&lt;ul&gt;
&lt;li&gt;Use &lt;code&gt;ERC721IncorrectOwner&lt;&#x2F;code&gt; or &lt;code&gt;ERC721InsufficientApproval&lt;&#x2F;code&gt; instead.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;erc721invalidreceiver-address-receiver&quot;&gt;&lt;code&gt;ERC721InvalidReceiver(address receiver)&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Indicates a failure with the token &lt;code&gt;receiver&lt;&#x2F;code&gt;.
Used in transfers.&lt;&#x2F;p&gt;
&lt;p&gt;Usage guidelines:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;RECOMMENDED for disallowed transfers to the zero address.&lt;&#x2F;li&gt;
&lt;li&gt;RECOMMENDED for disallowed transfers to non-&lt;code&gt;ERC721TokenReceiver&lt;&#x2F;code&gt; contracts or those that reject a transfer. (eg. returning an invalid response in &lt;code&gt;onERC721Received&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;MUST NOT be used for approval operations.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;erc721insufficientapproval-address-operator-uint256-tokenid&quot;&gt;&lt;code&gt;ERC721InsufficientApproval(address operator, uint256 tokenId)&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Indicates a failure with the &lt;code&gt;operator&lt;&#x2F;code&gt;&#x27;s approval.
Used in transfers.&lt;&#x2F;p&gt;
&lt;p&gt;Usage guidelines:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;isApprovedForAll(owner, operator)&lt;&#x2F;code&gt; MUST be false for the &lt;code&gt;tokenId&lt;&#x2F;code&gt;&#x27;s owner and &lt;code&gt;operator&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;getApproved(tokenId)&lt;&#x2F;code&gt; MUST not be &lt;code&gt;operator&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;erc721invalidapprover-address-approver&quot;&gt;&lt;code&gt;ERC721InvalidApprover(address approver)&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Indicates a failure with the &lt;code&gt;owner&lt;&#x2F;code&gt; of a token to be approved.
Used in approvals.&lt;&#x2F;p&gt;
&lt;p&gt;Usage guidelines:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;RECOMMENDED for disallowed approvals from the zero address.&lt;&#x2F;li&gt;
&lt;li&gt;MUST NOT be used for transfer operations.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;erc721invalidoperator-address-operator&quot;&gt;&lt;code&gt;ERC721InvalidOperator(address operator)&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Indicates a failure with the &lt;code&gt;operator&lt;&#x2F;code&gt; to be approved.
Used in approvals.&lt;&#x2F;p&gt;
&lt;p&gt;Usage guidelines:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;RECOMMENDED for disallowed approvals to the zero address.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;operator&lt;&#x2F;code&gt; MUST NOT be the owner of the approved token.&lt;&#x2F;li&gt;
&lt;li&gt;MUST NOT be used for transfer operations.
&lt;ul&gt;
&lt;li&gt;Use &lt;code&gt;ERC721InsufficientApproval&lt;&#x2F;code&gt; instead.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;erc-1155&quot;&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;erc1155insufficientbalance-address-sender-uint256-balance-uint256-needed-uint256-tokenid&quot;&gt;&lt;code&gt;ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId)&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Indicates an error related to the current &lt;code&gt;balance&lt;&#x2F;code&gt; of a &lt;code&gt;sender&lt;&#x2F;code&gt;.
Used in transfers.&lt;&#x2F;p&gt;
&lt;p&gt;Usage guidelines:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;balance&lt;&#x2F;code&gt; MUST be less than &lt;code&gt;needed&lt;&#x2F;code&gt; for a &lt;code&gt;tokenId&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;erc1155invalidsender-address-sender&quot;&gt;&lt;code&gt;ERC1155InvalidSender(address sender)&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Indicates a failure with the token &lt;code&gt;sender&lt;&#x2F;code&gt;.
Used in transfers.&lt;&#x2F;p&gt;
&lt;p&gt;Usage guidelines:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;RECOMMENDED for disallowed transfers from the zero address.&lt;&#x2F;li&gt;
&lt;li&gt;MUST NOT be used for approval operations.&lt;&#x2F;li&gt;
&lt;li&gt;MUST NOT be used for balance or allowance requirements.
&lt;ul&gt;
&lt;li&gt;Use &lt;code&gt;ERC1155InsufficientBalance&lt;&#x2F;code&gt; or &lt;code&gt;ERC1155MissingApprovalForAll&lt;&#x2F;code&gt; instead.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;erc1155invalidreceiver-address-receiver&quot;&gt;&lt;code&gt;ERC1155InvalidReceiver(address receiver)&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Indicates a failure with the token &lt;code&gt;receiver&lt;&#x2F;code&gt;.
Used in transfers.&lt;&#x2F;p&gt;
&lt;p&gt;Usage guidelines:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;RECOMMENDED for disallowed transfers to the zero address.&lt;&#x2F;li&gt;
&lt;li&gt;RECOMMENDED for disallowed transfers to non-&lt;code&gt;ERC1155TokenReceiver&lt;&#x2F;code&gt; contracts or those that reject a transfer. (eg. returning an invalid response in &lt;code&gt;onERC1155Received&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;MUST NOT be used for approval operations.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;erc1155missingapprovalforall-address-operator-address-owner&quot;&gt;&lt;code&gt;ERC1155MissingApprovalForAll(address operator, address owner)&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Indicates a failure with the &lt;code&gt;operator&lt;&#x2F;code&gt;&#x27;s approval in a transfer.
Used in transfers.&lt;&#x2F;p&gt;
&lt;p&gt;Usage guidelines:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;isApprovedForAll(owner, operator)&lt;&#x2F;code&gt; MUST be false for the &lt;code&gt;tokenId&lt;&#x2F;code&gt;&#x27;s owner and &lt;code&gt;operator&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;erc1155invalidapprover-address-approver&quot;&gt;&lt;code&gt;ERC1155InvalidApprover(address approver)&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Indicates a failure with the &lt;code&gt;approver&lt;&#x2F;code&gt; of a token to be approved.
Used in approvals.&lt;&#x2F;p&gt;
&lt;p&gt;Usage guidelines:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;RECOMMENDED for disallowed approvals from the zero address.&lt;&#x2F;li&gt;
&lt;li&gt;MUST NOT be used for transfer operations.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;erc1155invalidoperator-address-operator&quot;&gt;&lt;code&gt;ERC1155InvalidOperator(address operator)&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Indicates a failure with the &lt;code&gt;operator&lt;&#x2F;code&gt; to be approved.
Used in approvals.&lt;&#x2F;p&gt;
&lt;p&gt;Usage guidelines:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;RECOMMENDED for disallowed approvals to the zero address.&lt;&#x2F;li&gt;
&lt;li&gt;MUST be used for disallowed approvals to the owner itself.&lt;&#x2F;li&gt;
&lt;li&gt;MUST NOT be used for transfer operations.
&lt;ul&gt;
&lt;li&gt;Use &lt;code&gt;ERC1155InsufficientApproval&lt;&#x2F;code&gt; instead.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;erc1155invalidarraylength-uint256-idslength-uint256-valueslength&quot;&gt;&lt;code&gt;ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength)&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Indicates an array length mismatch between &lt;code&gt;ids&lt;&#x2F;code&gt; and &lt;code&gt;values&lt;&#x2F;code&gt; in a &lt;code&gt;safeBatchTransferFrom&lt;&#x2F;code&gt; operation.
Used in batch transfers.&lt;&#x2F;p&gt;
&lt;p&gt;Usage guidelines:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;idsLength&lt;&#x2F;code&gt; MUST NOT be &lt;code&gt;valuesLength&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;parameter-glossary&quot;&gt;Parameter Glossary&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;sender&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Address whose tokens are being transferred.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;balance&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Current balance for the interacting account.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;needed&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Minimum amount required to perform an action.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;receiver&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Address to which tokens are being transferred.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;spender&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Address that may be allowed to operate on tokens without being their owner.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;allowance&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Amount of tokens a &lt;code&gt;spender&lt;&#x2F;code&gt; is allowed to operate with.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;approver&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Address initiating an approval operation.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;tokenId&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Identifier number of a token.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;owner&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Address of the current owner of a token.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;operator&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Same as &lt;code&gt;spender&lt;&#x2F;code&gt;.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;*Length&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Array length for the prefixed parameter.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;error-additions&quot;&gt;Error additions&lt;&#x2F;h3&gt;
&lt;p&gt;Any addition to this EIP or implementation-specific errors (such as extensions) SHOULD follow the guidelines presented in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6093&#x2F;#rationale&quot;&gt;rationale&lt;&#x2F;a&gt; section to keep consistency.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The chosen objectives for a standard for token errors are to provide context about the error, and to make moderate use of meaningful arguments (to maintain the code size benefits with respect to strings).&lt;&#x2F;p&gt;
&lt;p&gt;Considering this, the error names are designed following a basic grammatical structure based on the standard actions that can be performed on each token and the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6093&#x2F;#actions-and-subjects&quot;&gt;subjects&lt;&#x2F;a&gt; involved.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;actions-and-subjects&quot;&gt;Actions and subjects&lt;&#x2F;h3&gt;
&lt;p&gt;An error is defined based on the following &lt;strong&gt;actions&lt;&#x2F;strong&gt; that can be performed on a token and its involved &lt;em&gt;subjects&lt;&#x2F;em&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Transfer&lt;&#x2F;strong&gt;: An operation in which a &lt;em&gt;sender&lt;&#x2F;em&gt; moves to a &lt;em&gt;receiver&lt;&#x2F;em&gt; any number of tokens (fungible &lt;em&gt;balance&lt;&#x2F;em&gt; and&#x2F;or non-fungible &lt;em&gt;token ids&lt;&#x2F;em&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Approval&lt;&#x2F;strong&gt;: An operation in which an &lt;em&gt;approver&lt;&#x2F;em&gt; grants any form of &lt;em&gt;approval&lt;&#x2F;em&gt; to an &lt;em&gt;operator&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;These attempt to exhaustively represent what can go wrong in a token operation. Therefore, the errors can be constructed by specifying which &lt;em&gt;subject&lt;&#x2F;em&gt; failed during an &lt;strong&gt;action&lt;&#x2F;strong&gt; execution, and prefixing with an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6093&#x2F;#error-prefixes&quot;&gt;error prefix&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Note that the action is never seen as the subject of an error.&lt;&#x2F;p&gt;
&lt;p&gt;If a subject is called different on a particular token standard, the error should be consistent with the standard&#x27;s naming convention.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;error-prefixes&quot;&gt;Error prefixes&lt;&#x2F;h3&gt;
&lt;p&gt;An error prefix is added to a subject to derive a concrete error condition.
Developers can think about an error prefix as the &lt;em&gt;why&lt;&#x2F;em&gt; an error happened.&lt;&#x2F;p&gt;
&lt;p&gt;A prefix can be &lt;code&gt;Invalid&lt;&#x2F;code&gt; for general incorrectness, or more specific like &lt;code&gt;Insufficient&lt;&#x2F;code&gt; for amounts.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;domain&quot;&gt;Domain&lt;&#x2F;h3&gt;
&lt;p&gt;Each error&#x27;s arguments may vary depending on the token domain. If there are errors with the same name and different arguments, the Solidity compiler currently fails with a &lt;code&gt;DeclarationError&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;An example of this is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;InsufficientApproval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt; allowance&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt; needed&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;InsufficientApproval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;For that reason, a domain prefix is proposed to avoid declaration clashing, which is the name of the ERC and its corresponding number appended at the beginning.&lt;&#x2F;p&gt;
&lt;p&gt;Example:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC20InsufficientApproval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt; allowance&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt; needed&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC721InsufficientApproval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;arguments&quot;&gt;Arguments&lt;&#x2F;h3&gt;
&lt;p&gt;The selection of arguments depends on the subject involved, and it should follow the order presented below:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;em&gt;Who&lt;&#x2F;em&gt; is involved with the error (eg. &lt;code&gt;address sender&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;What&lt;&#x2F;em&gt; failed (eg. &lt;code&gt;uint256 allowance&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;Why&lt;&#x2F;em&gt; it failed, expressed in additional arguments (eg. &lt;code&gt;uint256 needed&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;A particular argument may fall into overlapping categories (eg. &lt;em&gt;Who&lt;&#x2F;em&gt; may also be &lt;em&gt;What&lt;&#x2F;em&gt;), so not all of these will be present but the order shouldn&#x27;t be broken.&lt;&#x2F;p&gt;
&lt;p&gt;Some tokens may need a &lt;code&gt;tokenId&lt;&#x2F;code&gt;. This is suggested to include at the end as additional information instead of as a subject.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;error-grammar-rules&quot;&gt;Error grammar rules&lt;&#x2F;h3&gt;
&lt;p&gt;Given the above, we can summarize the construction of error names with a grammar that errors will follow:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;Domain&amp;gt;&amp;lt;ErrorPrefix&amp;gt;&amp;lt;Subject&amp;gt;(&amp;lt;Arguments&amp;gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Domain&lt;&#x2F;em&gt;: &lt;code&gt;ERC20&lt;&#x2F;code&gt;, &lt;code&gt;ERC721&lt;&#x2F;code&gt; or &lt;code&gt;ERC1155&lt;&#x2F;code&gt;. Although other token standards may be suggested if not considered in this EIP.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;ErrorPrefix&lt;&#x2F;em&gt;: &lt;code&gt;Invalid&lt;&#x2F;code&gt;, &lt;code&gt;Insufficient&lt;&#x2F;code&gt;, or another if it&#x27;s more appropriate.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;Subject&lt;&#x2F;em&gt;: &lt;code&gt;Sender&lt;&#x2F;code&gt;, &lt;code&gt;Receiver&lt;&#x2F;code&gt;, &lt;code&gt;Balance&lt;&#x2F;code&gt;, &lt;code&gt;Approver&lt;&#x2F;code&gt;, &lt;code&gt;Operator&lt;&#x2F;code&gt;, &lt;code&gt;Approval&lt;&#x2F;code&gt; or another if it&#x27;s more appropriate, and must make adjustments based on the domain&#x27;s naming convention.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;Arguments&lt;&#x2F;em&gt;: Follow the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6093&#x2F;#arguments&quot;&gt;&lt;em&gt;who&lt;&#x2F;em&gt;, &lt;em&gt;what&lt;&#x2F;em&gt; and &lt;em&gt;why&lt;&#x2F;em&gt; order&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Tokens already deployed rely mostly on revert strings and make use of &lt;code&gt;require&lt;&#x2F;code&gt; instead of custom errors. Even most of the newly deployed tokens since Solidity&#x27;s v0.8.4 release inherit from implementations using revert strings.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP can not be enforced on non-upgradeable already deployed tokens, however, these tokens generally use similar conventions with small variations such as:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;including&#x2F;removing the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6093&#x2F;#domain&quot;&gt;domain&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;using different &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6093&#x2F;#error-prefixes&quot;&gt;error prefixes&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;including similar &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6093&#x2F;#actions-and-subjects&quot;&gt;subjects&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;changing the grammar order.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Upgradeable contracts MAY be upgraded to implement this EIP.&lt;&#x2F;p&gt;
&lt;p&gt;Implementers and DApp developers that implement special support for tokens that are compliant with this EIP, SHOULD tolerate different errors emitted by non-compliant contracts, as well as classic revert strings.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;solidity&quot;&gt;Solidity&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.4&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Standard ERC20 Errors&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-6093&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC20Errors&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC20InsufficientBalance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt; balance&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt; needed&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC20InvalidSender&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC20InvalidReceiver&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; receiver&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC20InsufficientAllowance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt; allowance&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt; needed&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC20InvalidApprover&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; approver&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC20InvalidSpender&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Standard ERC721 Errors&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-721&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-6093&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721Errors&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721InvalidOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721NonexistentToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721IncorrectOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721InvalidSender&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721InvalidReceiver&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; receiver&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721InsufficientApproval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721InvalidApprover&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; approver&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721InvalidOperator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Standard ERC1155 Errors&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-1155&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-6093&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC1155Errors&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC1155InsufficientBalance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt; balance&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt; needed&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC1155InvalidSender&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC1155InvalidReceiver&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; receiver&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC1155MissingApprovalForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC1155InvalidApprover&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; approver&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC1155InvalidOperator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC1155InvalidArrayLength&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; idsLength&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt; valuesLength&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;There are no known signature hash collisions for the specified errors.&lt;&#x2F;p&gt;
&lt;p&gt;Tokens upgraded to implement this EIP may break assumptions in other systems relying on revert strings.&lt;&#x2F;p&gt;
&lt;p&gt;Offchain applications should be cautious when dealing with untrusted contracts that may revert using these custom errors. For instance, if a user interface prompts actions based on error decoding, malicious contracts could exploit this to encourage untrusted and potentially harmful operations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>No Intermediary NFT Trading Protocol</title>
        <published>2022-12-02T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>5660-eth</name><uri>https://github.com/5660-eth</uri>
	</author>
	
	<author>
		<name>Silvere Heraudeau</name><uri>https://github.com/lambdalf-dev</uri>
	</author>
	
	<author>
		<name>Martin McConnell</name><uri>https://github.com/offgridgecko</uri>
	</author>
	
	<author>
		<name>Abu</name><email>team10kuni@gmail.com</email>
	</author>
	
	<author>
		<name>Wizard Wang</name>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6105/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip6105-no-intermediary-nft-trading-protocol/12171" />
        

        <id>https://wg-eips.ritovision.com/6105/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:6105"
            label="ERC-6105" />
        

        
        

        
        <summary type="html">Adds a marketplace functionality with more diverse royalty schemes to ERC-721</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6105/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC adds a marketplace functionality to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; to enable non-fungible token trading without relying on an intermediary trading platform. At the same time, creators may implement more diverse royalty schemes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Most current NFT trading relies on an NFT trading platform acting as an intermediary, which has the following problems:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Security concerns arise from authorization via the &lt;code&gt;setApprovalForAll&lt;&#x2F;code&gt; function. The permissions granted to NFT trading platforms expose unnecessary risks. Should a problem occur with the trading platform contract, it would result in significant losses to the industry as a whole. Additionally, if a user has authorized the trading platform to handle their NFTs, it allows a phishing scam to trick the user into signing a message that allows the scammer to place an order at a low price on the NFT trading platform and designate themselves as the recipient. This can be difficult for ordinary users to guard against.&lt;&#x2F;li&gt;
&lt;li&gt;High trading costs are a significant issue. On one hand, as the number of trading platforms increases, the liquidity of NFTs becomes dispersed. If a user needs to make a deal quickly, they must authorize and place orders on multiple platforms, which increases the risk exposure and requires additional gas expenditures for each authorization. For example, taking BAYC as an example, with a total supply of 10,000 and over 6,000 current holders, the average number of BAYC held by each holder is less than 2. While &lt;code&gt;setApprovalForAll&lt;&#x2F;code&gt; saves on gas expenditure for pending orders on a single platform, authorizing multiple platforms results in an overall increase in gas expenditures for users. On the other hand, trading service fees charged by trading platforms must also be considered as a cost of trading, which are often much higher than the required gas expenditures for authorization.&lt;&#x2F;li&gt;
&lt;li&gt;Aggregators provide a solution by aggregating liquidity, but the decision-making process is centralized. Furthermore, as order information on trading platforms is off-chain, the aggregator&#x27;s efficiency in obtaining data is affected by the frequency of the trading platform&#x27;s API and, at times, trading platforms may suspend the distribution of APIs and limit their frequency.&lt;&#x2F;li&gt;
&lt;li&gt;The project parties&#x27; royalty income is dependent on centralized decision-making by NFT trading platforms. Some trading platforms implement optional royalty without the consent of project parties, which is a violation of their interests.&lt;&#x2F;li&gt;
&lt;li&gt;NFT trading platforms are not resistant to censorship. Some platforms have delisted a number of NFTs and the formulation and implementation of delisting rules are centralized and not transparent enough. In the past, some NFT trading platforms have failed and wrongly delisted certain NFTs, leading to market panic.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL
NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;,
and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119
and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;Compliant contracts MUST implement the following interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6105&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a token is listed for sale or delisted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The zero `salePrice` indicates that the token is not for sale&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      The zero `expires` indicates that the token is not for sale&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - identifier of the token being listed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - address of who is selling the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; salePrice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - the price the token is being sold for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; expires&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - UNIX timestamp, the buyer could buy the token before expires&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; supportedToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - contract addresses of supported token or zero address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                         The zero address indicates that the supported token is ETH&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                         Buyer needs to purchase item with supported token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; benchmarkPrice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - Additional price parameter, may be used when calculating royalties&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UpdateListing&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; salePrice&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expires&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; supportedToken&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; benchmarkPrice&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a token is being purchased&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - identifier of the token being purchased&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - address of who is selling the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - address of who is buying the token &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; salePrice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - the price the token is being sold for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; supportedToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - contract addresses of supported token or zero address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                         The zero address indicates that the supported token is ETH&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                         Buyer needs to purchase item with supported token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; royalties&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - The amount of royalties paid on this purchase&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Purchased&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; salePrice&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; supportedToken&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; royalties&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Create or update a listing for `tokenId`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `salePrice` MUST NOT be set to zero&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - identifier of the token being listed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; salePrice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - the price the token is being sold for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; expires&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - UNIX timestamp, the buyer could buy the token before expires&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; supportedToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - contract addresses of supported token or zero address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                         The zero address indicates that the supported token is ETH&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                         Buyer needs to purchase item with supported token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - `tokenId` must exist&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - Caller must be owner, authorised operators or approved address of the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - `salePrice` must not be zero&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - `expires` must be valid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - Must emit an {UpdateListing} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; listItem&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; salePrice&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expires&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; supportedToken&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Create or update a listing for `tokenId` with `benchmarkPrice`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `salePrice` MUST NOT be set to zero&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - identifier of the token being listed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; salePrice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - the price the token is being sold for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; expires&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - UNIX timestamp, the buyer could buy the token before expires&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; supportedToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - contract addresses of supported token or zero address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                         The zero address indicates that the supported token is ETH&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                         Buyer needs to purchase item with supported token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; benchmarkPrice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - Additional price parameter, may be used when calculating royalties&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - `tokenId` must exist&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - Caller must be owner, authorised operators or approved address of the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - `salePrice` must not be zero&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - `expires` must be valid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - Must emit an {UpdateListing} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; listItem&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; salePrice&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expires&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; supportedToken&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; benchmarkPrice&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Remove the listing for `tokenId`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - identifier of the token being delisted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - `tokenId` must exist and be listed for sale&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - Caller must be owner, authorised operators or approved address of the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - Must emit an {UpdateListing} event&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; delistItem&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Buy a token and transfer it to the caller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `salePrice` and `supportedToken` must match the expected purchase price and token to prevent front-running attacks&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - identifier of the token being purchased&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; salePrice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - the price the token is being sold for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; supportedToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - contract addresses of supported token or zero address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - `tokenId` must exist and be listed for sale&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - `salePrice` must matches the expected purchase price to prevent front-running attacks&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - `supportedToken` must matches the expected purchase token to prevent front-running attacks&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - Caller must be able to pay the listed price for `tokenId`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - Must emit a {Purchased} event&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; buyItem&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; salePrice&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; supportedToken&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Return the listing for `tokenId`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The zero sale price indicates that the token is not for sale&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      The zero expires indicates that the token is not for sale&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      The zero supported token address indicates that the supported token is ETH&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; identifier of the token being queried&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; specified listing (sale price, expires, supported token, benchmark price)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getListing&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;optional-collection-offer-extension&quot;&gt;Optional collection offer extension&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The collection offer extension is OPTIONAL for ERC-6105 smart contracts. This allows smart contract to support collection offer functionality.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6105CollectionOffer&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when the collection receives an offer or an offer is canceled&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The zero `salePrice` indicates that the collection offer of the token is canceled&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      The zero `expires` indicates that the collection offer of the token is canceled&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - address of who make collection offer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - the amount the offerer wants to buy at `salePrice` per token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; salePrice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - the price of each token is being offered for the collection&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; expires&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - UNIX timestamp, the offer could be accepted before expires&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; supportedToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - contract addresses of supported ERC20 token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                          Buyer wants to purchase items with supported token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UpdateCollectionOffer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; salePrice&lt;&#x2F;span&gt;&lt;span&gt; ,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expires&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; supportedToken&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Create or update an offer for the collection&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `salePrice` MUST NOT be set to zero&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - the amount the offerer wants to buy at `salePrice` per token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; salePrice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - the price of each token is being offered for the collection&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; expires&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - UNIX timestamp, the offer could be accepted before expires&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; supportedToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - contract addresses of supported token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                         Buyer wants to purchase items with supported token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - The caller must have enough supported tokens, and has approved the contract a sufficient amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - `salePrice` must not be zero&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - `amount` must not be zero&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - `expires` must be valid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - Must emit an {UpdateCollectionOffer} event&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; makeCollectionOffer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; salePrice&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expires&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; supportedToken&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Accepts collection offer and transfers the token to the buyer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `salePrice` and `supportedToken` must match the expected purchase price and token to prevent front-running attacks&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      When the trading is completed, the `amount` of NFTs the buyer wants to purchase needs to be reduced by 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - identifier of the token being offered&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; salePrice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - the price the token is being offered for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; supportedToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - contract addresses of supported token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; buyer&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - address of who wants to buy the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - `tokenId` must exist and be offered for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - Caller must be owner, authorised operators or approved address of the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - Must emit a {Purchased} event&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; acceptCollectionOffer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; salePrice&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; supportedToken&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; buyer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Accepts collection offer and transfers the token to the buyer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `salePrice` and `supportedToken` must match the expected purchase price and token to prevent front-running attacks&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      When the trading is completed, the `amount` of NFTs the buyer wants to purchase needs to be reduced by 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - identifier of the token being offered&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; salePrice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - the price the token is being offered for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; supportedToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - contract addresses of supported token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; buyer&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - address of who wants to buy the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; benchmarkPrice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - additional price parameter, may be used when calculating royalties&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - `tokenId` must exist and be offered for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - Caller must be owner, authorised operators or approved address of the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - Must emit a {Purchased} event&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; acceptCollectionOffer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; salePrice&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; supportedToken&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; buyer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; benchmarkPrice&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Removes the offer for the collection&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - Caller must be the offerer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - Must emit an {UpdateCollectionOffer} event&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; cancelCollectionOffer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the offer for `tokenId` maked by `buyer`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The zero amount indicates there is no offer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      The zero sale price indicates there is no offer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      The zero expires indicates that there is no offer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; buyer&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address of who wants to buy the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; specified offer (amount, sale price, expires, supported token)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getCollectionOffer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; buyer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;optional-item-offer-extension&quot;&gt;Optional item offer extension&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The item offer extension is OPTIONAL for ERC-6105 smart contracts. This allows smart contract to support item offer functionality.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6105ItemOffer&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a token receives an offer or an offer is canceled&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The zero `salePrice` indicates that the offer of the token is canceled&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      The zero `expires` indicates that the offer of the token is canceled&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - identifier of the token being offered&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - address of who wants to buy the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; salePrice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - the price the token is being offered for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; expires&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - UNIX timestamp, the offer could be accepted before expires&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; supportedToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - contract addresses of supported token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                          Buyer wants to purchase item with supported token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UpdateItemOffer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; salePrice&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expires&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; supportedToken&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Create or update an offer for `tokenId`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `salePrice` MUST NOT be set to zero&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - identifier of the token being offered&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; salePrice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - the price the token is being offered for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; expires&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - UNIX timestamp, the offer could be accepted before expires&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; supportedToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - contract addresses of supported token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                         Buyer wants to purchase item with supported token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - `tokenId` must exist&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - The caller must have enough supported tokens, and has approved the contract a sufficient amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - `salePrice` must not be zero&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - `expires` must be valid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - Must emit an {UpdateItemOffer} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; makeItemOffer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; salePrice&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expires&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; supportedToken&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Remove the offer for `tokenId`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - identifier of the token being canceled offer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - `tokenId` must exist and be offered for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - Caller must be the offerer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - Must emit an {UpdateItemOffer} event&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; cancelItemOffer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Accept offer and transfer the token to the buyer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `salePrice` and `supportedToken` must match the expected purchase price and token to prevent front-running attacks&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      When the trading is completed, the offer infomation needs to be removed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - identifier of the token being offered&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; salePrice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - the price the token is being offered for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; supportedToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - contract addresses of supported token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; buyer&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - address of who wants to buy the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - `tokenId` must exist and be offered for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - Caller must be owner, authorised operators or approved address of the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - Must emit a {Purchased} event&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; acceptItemOffer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; salePrice&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; supportedToken&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; buyer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Accepts offer and transfers the token to the buyer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `salePrice` and `supportedToken` must match the expected purchase price and token to prevent front-running attacks&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      When the trading is completed, the offer infomation needs to be removed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - identifier of the token being offered&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; salePrice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - the price the token is being offered for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; supportedToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - contract addresses of supported token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; buyer&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - address of who wants to buy the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; benchmarkPrice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - additional price parameter, may be used when calculating royalties&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - `tokenId` must exist and be offered for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - Caller must be owner, authorised operators or approved address of the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - Must emit a {Purchased} event&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; acceptItemOffer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; salePrice&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; supportedToken&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; buyer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; benchmarkPrice&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Return the offer for `tokenId` maked by `buyer`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The zero sale price indicates there is no offer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      The zero expires indicates that there is no offer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; identifier of the token being queried&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; buyer&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address of who wants to buy the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; specified offer (sale price, expires, supported token)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getItemOffer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; buyer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;considerations-for-some-local-variables&quot;&gt;Considerations for some local variables&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;salePrice&lt;&#x2F;code&gt; in the &lt;code&gt;listItem&lt;&#x2F;code&gt; function cannot be set to zero. Firstly, it is a rare occurrence for a caller to set the price to 0, and when it happens, it is often due to an operational error which can result in loss of assets. Secondly, a caller needs to spend gas to call this function, so if he can set the token price to 0, his income would be actually negative at this time, which does not conform to the concept of &#x27;economic man&#x27; in economics. Additionally, a token price of 0 indicates that the item is not for sale, making the reference implementation more concise.&lt;&#x2F;p&gt;
&lt;p&gt;Setting &lt;code&gt;expires&lt;&#x2F;code&gt; in the &lt;code&gt;listItem&lt;&#x2F;code&gt; function allows callers to better manage their listings. If a listing expires automatically, the token owner will no longer need to manually &lt;code&gt;delistItem&lt;&#x2F;code&gt;, thus saving gas.&lt;&#x2F;p&gt;
&lt;p&gt;Setting &lt;code&gt;supportedToken&lt;&#x2F;code&gt; in the &lt;code&gt;listItem&lt;&#x2F;code&gt; function allows the caller or contract owner to choose which tokens they want to accept, rather than being limited to a single token.&lt;&#x2F;p&gt;
&lt;p&gt;The rationales of variable setting in the &lt;code&gt;acceptCollectionOffer&lt;&#x2F;code&gt; and &lt;code&gt;acceptItemOffer&lt;&#x2F;code&gt; functions are the same as described above.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;more-diverse-royalty-schemes&quot;&gt;More diverse royalty schemes&lt;&#x2F;h3&gt;
&lt;p&gt;By introducing the parameter &lt;code&gt;benchmarkPrice&lt;&#x2F;code&gt; in the &lt;code&gt;listItem&lt;&#x2F;code&gt;, &lt;code&gt;acceptCollectionOffer&lt;&#x2F;code&gt; and &lt;code&gt;acceptItemOffer&lt;&#x2F;code&gt; functions, the &lt;code&gt;_salePrice&lt;&#x2F;code&gt; in the &lt;code&gt;royaltyInfo(uint256 _tokenId, uint256 _salePrice)&lt;&#x2F;code&gt; function in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2981&#x2F;&quot;&gt;ERC-2981&lt;&#x2F;a&gt; interface can be changed to &lt;code&gt;taxablePrice&lt;&#x2F;code&gt;, making the ERC-2981 royalty scheme more diverse. Here are several examples of royalty schemes:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;(address royaltyRecipient, uint256 royalties) = royaltyInfo(tokenId, taxablePrice)&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Value-added Royalty (VAR, royalties are only charged on the part of the seller&#x27;s profit）: &lt;code&gt;taxablePrice=max(salePrice- historicalPrice, 0)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Sale Royalty (SR): &lt;code&gt;taxablePrice=salePrice&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Capped Royalty(CR): &lt;code&gt;taxablePrice=min(salePrice, constant)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Quantitative Royalty(QR, each token trading pays a fixed royalties): &lt;code&gt;taxablePrice= constant&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;optional-blocklist&quot;&gt;Optional Blocklist&lt;&#x2F;h3&gt;
&lt;p&gt;Some viewpoints suggest that tokens should be prevented from trading on intermediary markets that do not comply with royalty schemes, but this standard only provides a functionality for non-intermediary NFT trading and does not offer a standardized interface to prevent tokens from trading on these markets. If deemed necessary to better protect the interests of the project team and community, they may consider adding a blocklist to their implementation contracts to prevent NFTs from being traded on platforms that do not comply with the project’s royalty scheme.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2981&#x2F;&quot;&gt;ERC-2981&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.8&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC721&#x2F;ERC721.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;common&#x2F;ERC2981.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC20&#x2F;IERC20.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;security&#x2F;ReentrancyGuard.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERC6105.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; No Intermediary NFT Trading Protocol with Value-added Royalty&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The royalty scheme used by this reference implementation is Value-Added Royalty&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC6105&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC2981&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC6105&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ReentrancyGuard&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A structure representing a listed token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      The zero `salePrice` indicates that the token is not for sale&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      The zero `expires` indicates that the token is not for sale&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; salePrice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - the price the token is being sold for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; expires&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - UNIX timestamp, the buyer could buy the token before expires&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; supportedToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - contract addresses of supported ERC20 token or zero address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                         The zero address indicates that the supported token is ETH&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                         Buyer needs to purchase item with supported token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; historicalPrice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - The price at which the seller last bought this token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Listing&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; salePrice&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint64&lt;&#x2F;span&gt;&lt;span&gt; expires&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; supportedToken&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; historicalPrice&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Mapping from token Id to listing index&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Listing&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _listings&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; symbol_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    ERC721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;name_, symbol_)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Create or update a listing for `tokenId`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `salePrice` MUST NOT be set to zero&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - identifier of the token being listed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; salePrice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - the price the token is being sold for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; expires&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - UNIX timestamp, the buyer could buy the token before expires&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; supportedToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - contract addresses of supported ERC20 token or zero address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                         The zero address indicates that the supported token is ETH&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                         Buyer needs to purchase item with supported token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; listItem&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; salePrice&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expires&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; supportedToken&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        listItem&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; salePrice&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; expires&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; supportedToken&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Create or update a listing for `tokenId` with `historicalPrice`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `price` MUST NOT be set to zero&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - identifier of the token being listed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; salePrice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - the price the token is being sold for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; expires&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - UNIX timestamp, the buyer could buy the token before expires&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; supportedToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - contract addresses of supported ERC20 token or zero address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                         The zero address indicates that the supported token is ETH&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                         Buyer needs to purchase item with supported token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; historicalPrice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - The price at which the seller last bought this token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; listItem&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; salePrice&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expires&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; supportedToken&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; historicalPrice&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; tokenOwner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;salePrice &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC6105: token sale price MUST NOT be set to zero&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;expires &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC6105: invalid expires&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_isApprovedOrOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_msgSender&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC6105: caller is not owner nor approved&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    _listings&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Listing&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;salePrice&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; expires&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; supportedToken&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; historicalPrice&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UpdateListing&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenOwner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; salePrice&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; expires&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; supportedToken&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; historicalPrice&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Remove the listing for `tokenId`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - identifier of the token being listed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; delistItem&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_isApprovedOrOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_msgSender&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC6105: caller is not owner nor approved&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_isForSale&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC6105: invalid listing&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    _removeListing&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Buy a token and transfers it to the caller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `salePrice` and `supportedToken` must match the expected purchase price and token to prevent front-running attacks&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - identifier of the token being purchased&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; salePrice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - the price the token is being sold for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; supportedToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - contract addresses of supported token or zero address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; buyItem&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; salePrice&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; supportedToken&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; nonReentrant&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; tokenOwner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; buyer &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; historicalPrice &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _listings&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;historicalPrice&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;salePrice &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; _listings&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;salePrice&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC6105: inconsistent prices&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;supportedToken &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt;  _listings&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;supportedToken&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;ERC6105: inconsistent tokens&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_isForSale&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC6105: invalid listing&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Handle royalties&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; royaltyRecipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt; royalties&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _calculateRoyalties&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; salePrice&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; historicalPrice&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; payment &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; salePrice &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt; royalties&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;supportedToken &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;value &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; salePrice&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC6105: incorrect value&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _processSupportedTokenPayment&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;royalties&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; buyer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; royaltyRecipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _processSupportedTokenPayment&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;payment&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; buyer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenOwner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; num &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;supportedToken&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;allowance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;buyer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;num &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; salePrice&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC6105: insufficient allowance&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _processSupportedTokenPayment&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;royalties&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; buyer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; royaltyRecipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; supportedToken&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _processSupportedTokenPayment&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;payment&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; buyer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenOwner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; supportedToken&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    _transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenOwner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; buyer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Purchased&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenOwner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; buyer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; salePrice&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; supportedToken&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; royalties&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Return the listing for `tokenId`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The zero sale price indicates that the token is not for sale&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      The zero expires indicates that the token is not for sale&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      The zero supported token address indicates that the supported token is ETH&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; identifier of the token being queried&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; specified listing (sale price, expires, supported token, benchmark price)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getListing&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_listings&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;salePrice &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; _listings&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;expires &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;  block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; salePrice &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _listings&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;salePrice&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint64&lt;&#x2F;span&gt;&lt;span&gt; expires &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _listings&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;expires&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; supportedToken &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;  _listings&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;supportedToken&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; historicalPrice &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _listings&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;historicalPrice&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;salePrice&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; expires&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; supportedToken&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; historicalPrice&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Remove the listing for `tokenId`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - identifier of the token being delisted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _removeListing&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; tokenOwner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    delete&lt;&#x2F;span&gt;&lt;span&gt; _listings&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UpdateListing&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenOwner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check if the token is for sale&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _isForSale&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_listings&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;salePrice &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; _listings&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;expires &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Handle Value Added Royalty&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _calculateRoyalties&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; price&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; historicalPrice&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; taxablePrice&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;price &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; historicalPrice&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      taxablePrice &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; price &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt; historicalPrice&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      taxablePrice &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt; ;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; royaltyRecipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt; royalties&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; royaltyInfo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; taxablePrice&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;royaltyRecipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; royalties&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Process a `supportedToken` of `amount` payment to `recipient`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - the amount to send&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - the payment payer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; recipient&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - the payment recipient&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; supportedToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - contract addresses of supported ERC20 token or zero address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                         The zero address indicates that the supported token is ETH&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _processSupportedTokenPayment&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; supportedToken&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;supportedToken &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt; success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;recipient&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;call&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Ether Transfer Fail&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;supportedToken&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Supported Token Transfer Fail&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See {IERC165-supportsInterface}.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC721&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC2981&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;     return&lt;&#x2F;span&gt;&lt;span&gt; interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;IERC6105&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Before transferring the NFT, need to delete listing&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _beforeTokenTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; batchSize&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;      super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_beforeTokenTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; batchSize&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_isForSale&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;          _removeListing&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;buyItem&lt;&#x2F;code&gt; function, as well as the &lt;code&gt;acceptCollectionOffer&lt;&#x2F;code&gt; and &lt;code&gt;acceptItemOffer&lt;&#x2F;code&gt; functions, has a potential front-running risk.  Must check that &lt;code&gt;salePrice&lt;&#x2F;code&gt; and &lt;code&gt;supportedToken&lt;&#x2F;code&gt; match the expected price and token to prevent front-running attacks&lt;&#x2F;p&gt;
&lt;p&gt;There is a potential re-entrancy risk with the &lt;code&gt;acceptCollectionOffer&lt;&#x2F;code&gt; and &lt;code&gt;acceptItemOffer&lt;&#x2F;code&gt; functions. Make sure to obey the checks, effects, interactions pattern or use a reentrancy guard.&lt;&#x2F;p&gt;
&lt;p&gt;If a buyer uses &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens to purchase an NFT, the buyer needs to first call the &lt;code&gt;approve(address spender, uint256 amount)&lt;&#x2F;code&gt; function of the ERC-20 token to grant the NFT contract access to a certain &lt;code&gt;amount&lt;&#x2F;code&gt; of tokens. Please make sure to authorize an appropriate &lt;code&gt;amount&lt;&#x2F;code&gt;. Furthermore, caution is advised when dealing with non-audited contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Real Estate Token</title>
        <published>2022-11-29T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Alex</name><uri>https://github.com/Alex-Klasma</uri>
	</author>
	
	<author>
		<name>Ben Fusek</name><uri>https://github.com/bfusek</uri>
	</author>
	
	<author>
		<name>Daniel Fallon-Cyr</name><uri>https://github.com/dfalloncyr</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6065/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/updated-eip-6065-real-estate-token/11936" />
        

        <id>https://wg-eips.ritovision.com/6065/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:6065"
            label="ERC-6065" />
        

        
        

        
        <summary type="html">An interface for real estate NFTs that extends ERC-721</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6065/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal introduces an open structure for physical real estate and property to exist on the blockchain. This standard builds off of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;, adding important functionality necessary for representing real world assets such as real estate. The three objectives this standard aims to meet are: universal transferability of the NFT, private property rights attached to the NFT, and atomic transfer of property rights with the transfer of the NFT. The token contains a hash of the operating agreement detailing the NFT holder’s legal right to the property, unique identifiers for the property, a debt value and foreclosure status, and a manager address.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Real estate is the largest asset class in the world. By tokenizing real estate, barriers to entry are lowered, transaction costs are minimized, information asymmetry is reduced, ownership structures become more malleable, and a new building block for innovation is formed. However, in order to tokenize this asset class, a common standard is needed that accounts for its real world particularities while remaining flexible enough to adapt to various jurisdictions and regulatory environments.&lt;&#x2F;p&gt;
&lt;p&gt;Ethereum tokens involving real world assets (RWAs) are notoriously tricky. This is because Ethereum tokens exist on-chain, while real estate exists off-chain. As such, the two are subject to entirely different consensus environments. For Ethereum tokens, consensus is reached through a formalized process of distributed validators. When a purely-digital NFT is transferred, the new owner has a cryptographic guarantee of ownership. For real estate, consensus is supported by legal contracts, property law, and enforced by the court system. With existing asset-backed ERC-721 tokens, a transfer of the token to another individual does not necessarily have any impact on the legal ownership of the physical asset.&lt;&#x2F;p&gt;
&lt;p&gt;This standard attempts to solve the real world reconciliation issue, enabling real estate NFTs to function seamlessly on-chain, just like their purely-digital counterparts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “NOT RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;In order to meet the above objectives and create an open standard for on-chain property ownership we have created a token structure that builds on the widely-used ERC-721 standard.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;token-components&quot;&gt;Token Components:&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;Inherits ERC-721 - Allows for backwards compatibility with the most widely accepted NFT token standard.&lt;&#x2F;li&gt;
&lt;li&gt;operatingAgreementHashOf - immutable hash of the legal agreement detailing the right to ownership and conditions of use with regard to the property&lt;&#x2F;li&gt;
&lt;li&gt;Property Unique Identifiers - legal description (from physical deed), street address, GIS coordinates, parcel&#x2F;tax ID, legal owning entity (on deed)&lt;&#x2F;li&gt;
&lt;li&gt;debtOf - readable debt value, currency, and foreclosure status of the NFT&lt;&#x2F;li&gt;
&lt;li&gt;managerOf - readable Ethereum address with managing control of property&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;interfaces&quot;&gt;Interfaces&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP inherits the ERC-721 NFT token standard for all transfer and approval logic. All transfer and approval functions are inherited from this token standard without changes. Additionally, this EIP also inherits the ERC-721 Metadata standards for name, symbol, and metadata URI lookup. This allows an NFT under this EIP to become interoperable with preexisting NFT exchanges and services, however, some care must be taken. Please refer to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6065&#x2F;#backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6065&#x2F;#security-considerations&quot;&gt;Security Considerations&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;solidity-interface&quot;&gt;Solidity Interface&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pragma solidity ^0.8.13;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;import &amp;quot;forge-std&#x2F;interfaces&#x2F;IERC721.sol&amp;quot;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;interface IERC6065 is IERC721 {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&#x2F;&#x2F; This event MUST emit if the asset is ever foreclosed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	event Foreclosed(uint256 id);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&#x2F;* &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	Next getter functions return immutable data for NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	function legalDescriptionOf(uint256 _id) external view returns (string memory);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	function addressOf(uint256 _id) external view returns (string memory);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	function geoJsonOf(uint256 _id) external view returns (string memory);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	function parcelIdOf(uint256 _id) external view returns (string memory);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	function legalOwnerOf(uint256 _id) external view returns (string memory);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	function operatingAgreementHashOf(uint256 _id) external view returns (bytes32);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&#x2F;*&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	Next getter function returns the debt denomination token of the NFT, the amount of debt (negative debt == credit), and if the underlying &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	asset backing the NFT has been foreclosed on. This should be utilized specifically for off-chain debt and required payments on the RWA asset.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	It&amp;#39;s recommended that administrators only use a single token type to denominate the debt. It&amp;#39;s unrealistic to require integrating smart&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	contracts to implement possibly unbounded tokens denominating the off-chain debt of an asset.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	If the foreclosed status == true, then the RWA can be seen as severed from the NFT. The NFT is now &amp;quot;unbacked&amp;quot; by the RWA.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	function debtOf(uint256 _id) external view returns (address debtToken, int256 debtAmt, bool foreclosed);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&#x2F;&#x2F; Get the managerOf an NFT. The manager can have additional rights to the NFT or RWA on or off-chain.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	function managerOf(uint256 _id) external view returns (address);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;introduction&quot;&gt;Introduction&lt;&#x2F;h3&gt;
&lt;p&gt;Real world assets operate in messy, non-deterministic environments. Because of this, validating the true state of an asset can be murky, expensive, or time-consuming. For example, in the U.S., change of property ownership is usually recorded at the County Recorder’s office, sometimes using pen and paper. It would be infeasible to continuously update this manual record every time an NFT transaction occurs on the blockchain. Additionally, since real world property rights are enforced by the court of law, it is essential that property ownership be documented in such a way that courts are able to interpret and enforce ownership if necessary.&lt;&#x2F;p&gt;
&lt;p&gt;For these reasons, it is necessary to have a trusted party tasked with the responsibility of ensuring the state of the on-chain property NFT accurately mirrors its physical counterpart. By having an Administrator for the property who issues a legally-binding digital representation of the physical property, we are able to solve for both the atomic transfer of the property rights with the transfer of the NFT, as well as institute a seamless process for making the necessary payments and filings associated with property ownership. This is made possible by eliminating the change in legal ownership each time the NFT changes hands. An example Administrator legal structure implemented for property tokenization in the U.S. is provided in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6065&#x2F;#reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;a&gt;. While a token that implements this standard must have a legal entity to conduct the off-chain dealings for the property, this implementation is not mandatory.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;guiding-objectives&quot;&gt;Guiding Objectives&lt;&#x2F;h3&gt;
&lt;p&gt;We have designed this EIP to achieve three primary objectives necessary for creating an NFT representation of physical real estate:&lt;&#x2F;p&gt;
&lt;h4 id=&quot;1-real-estate-nfts-are-universally-transferable&quot;&gt;1. Real Estate NFTs are universally transferable&lt;&#x2F;h4&gt;
&lt;p&gt;A key aspect to private property is the right to transfer ownership to any legal person or entity that has the capacity to own that property. Therefore, an NFT representation of physical property should maintain that universal freedom of transfer.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;2-all-rights-associated-with-property-ownership-are-able-to-be-maintained-and-guaranteed-by-the-nft&quot;&gt;2. All rights associated with property ownership are able to be maintained and guaranteed by the NFT&lt;&#x2F;h4&gt;
&lt;p&gt;The rights associated with private property ownership are the right to hold, occupy, rent, alter, resell, or transfer the property. It is essential that these same rights are able to be maintained and enforced with an NFT representation of real estate.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;3-property-rights-are-transferred-atomically-with-the-transfer-of-the-nft&quot;&gt;3. Property rights are transferred atomically with the transfer of the NFT&lt;&#x2F;h4&gt;
&lt;p&gt;Token ownership on any blockchain is atomic with the transfer of the digital token. To ensure the digital representation of a physical property is able to fully integrate the benefits of blockchain technology, it is essential the rights associated with the property are passed atomically with the transfer of the digital token.&lt;&#x2F;p&gt;
&lt;p&gt;The following section specifies the technological components required to meet these three objectives.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;operatingagreementhashof&quot;&gt;operatingAgreementHashOf&lt;&#x2F;h3&gt;
&lt;p&gt;An immutable hash of the legal document issued by the legal entity that owns the property. The agreement is unique and contains the rights, terms, and conditions for the specific property represented by the NFT. The hash of the agreement attached to the NFT must be immutable to ensure the legitimacy and enforceability of these rights in the future for integrators or transferees. Upon transfer of the NFT, these legal rights are immediately enforceable by the new owner. For changes to the legal structure or rights and conditions with regard to the property the original token must be burned and a new token with the new hash must be minted.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;property-unique-identifiers&quot;&gt;Property Unique Identifiers&lt;&#x2F;h3&gt;
&lt;p&gt;The following unique identifiers of the property are contained within the NFT and are immutable:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;legalDescriptionOf&lt;&#x2F;code&gt;: written description of the property taken from the physical property deed
&lt;code&gt;addressOf&lt;&#x2F;code&gt;: street address of the property
&lt;code&gt;geoJsonOf&lt;&#x2F;code&gt;: the GeoJSON format of the property’s geospatial coordinates
&lt;code&gt;parcelIdOf&lt;&#x2F;code&gt;: ID number used to identify the property by the local authority
&lt;code&gt;legalOwnerOf&lt;&#x2F;code&gt;: the legal entity that is named on the verifiable physical deed&lt;&#x2F;p&gt;
&lt;p&gt;These unique identifiers ensure the physical property in question is clear and identifiable. These strings must be immutable to make certain that the identity of the property can not be changed in the future. This is necessary to provide confidence in the NFT holder in the event a dispute about the property arises.&lt;&#x2F;p&gt;
&lt;p&gt;These identifiers, especially &lt;code&gt;legalOwnerOf&lt;&#x2F;code&gt;, allow for individuals to verify off-chain ownership and legitimacy of the legal agreement. These verification checks could be integrated with something like Chainlink functions in the future to be simplified and automatic.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;debtof&quot;&gt;debtOf&lt;&#x2F;h3&gt;
&lt;p&gt;A readable value of debt and denoted currency that is accrued to the property. A positive balance signifies a debt against the property, while a negative balance signifies a credit which can be claimed by the NFT owner. This is a way for the property administrator to charge the NFT holder for any necessary payments towards the property, like property tax, or other critical repairs or maintenance in the &quot;real world&quot;. A credit might be given to the NFT holder via this same function, perhaps the administrator and the NFT holder had worked out a property management or tenancy revenue-sharing agreement.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;debtOf&lt;&#x2F;code&gt; function also returns the boolean foreclosure status of the asset represented by the NFT. A true result indicates the associated property is no longer backing the NFT, a false result indicates the associated property is still backing the NFT. An administrator can foreclose an asset for any reason as specified in the &lt;code&gt;Operating Agreement&lt;&#x2F;code&gt;, an example would be excessive unpaid debts. Smart contracts can check the foreclosure state by calling this function. If the asset is foreclosed, it should be understood that the RWA backing the NFT has been removed, and smart contracts should take this into account when doing any valuations or other calculations.&lt;&#x2F;p&gt;
&lt;p&gt;There are no standard requirements for how these values are updated as those details will be decided by the implementor. This EIP does however standardize how these values are indicated and read for simplicity of integration.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;managerof&quot;&gt;managerOf&lt;&#x2F;h3&gt;
&lt;p&gt;A readable Ethereum address that can be granted a right to action on the property without being the underlying owner of the NFT.&lt;&#x2F;p&gt;
&lt;p&gt;This function allows the token to be owned by one Ethereum address while granting particular rights to another. This enables protocols and smart contracts to own the underlying asset, such as a lending protocol, but still allow another Ethereum address, such as a depositor, to action on the NFT via other integrations, for example the Administrator management portal. The standard does not require a specific implementation of the manager role, only the value is required. In many instances the managerOf value will be the same as the owning address of the NFT.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is backwards compatible with ERC-721. However, it is important to note that there are potential implementation considerations to take into account before any smart contract integration. See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6065&#x2F;#security-considerations&quot;&gt;Security Considerations&lt;&#x2F;a&gt; for more details.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Klasma Labs offers a work in progress &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6065&#x2F;.&#x2F;assets&#x2F;Implementation.sol&quot;&gt;reference implementation&lt;&#x2F;a&gt;. The technical implementation includes the following additional components for reference, this implementation is not required.&lt;&#x2F;p&gt;
&lt;p&gt;Summary of this implementation:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;NFT burn and mint function&lt;&#x2F;li&gt;
&lt;li&gt;Immutable NFT data (unique identifiers and operating agreement hash)&lt;&#x2F;li&gt;
&lt;li&gt;Simple debt tracking by Administrator&lt;&#x2F;li&gt;
&lt;li&gt;Blocklist function to freeze asset held by fraudulent addresses (NOTE: to be implemented in the future)&lt;&#x2F;li&gt;
&lt;li&gt;Simple foreclosure logic initiated by Administrator&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;managerOf&lt;&#x2F;code&gt; function implementation to chain this call to other supported smart contracts&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;legal-structure-implementation&quot;&gt;Legal Structure Implementation&lt;&#x2F;h3&gt;
&lt;p&gt;This section explains the legal structure and implementation a company may employ as an Administrator of this token. The structure detailed below is specific to property tokenization in the U.S. in the 2023 regulatory environment.&lt;&#x2F;p&gt;
&lt;p&gt;This section details an implementation of the legal standard that could be used by a company specifically for property tokenization in the U.S. in the 2022 regulatory environment.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6065&#x2F;.&#x2F;assets&#x2F;corporate-structure.png&quot; alt=&quot;Corporate Structure Image&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The legal structure for this token is as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;A parent company and property Administrator, owns a bankruptcy remote LLC for each individual property they act as Administrator for.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The bankruptcy remote LLC is the owner and manager of a DAO LLC. The DAO LLC is on the title and deed and issues the corresponding NFT and operating agreement for the property.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;This structure enables the following three outcomes:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Homeowners are shielded from any financial stress or bankruptcy their physical asset Administrator encounters. In the event of an Administrator bankruptcy or dissolution the owner of the NFT is entitled to transfer of the DAO LLC, or the sale and distribution of proceeds from the property.&lt;&#x2F;li&gt;
&lt;li&gt;Transfer of the rights to the property are atomic with the transfer of the NFT. The NFT represents a right to claim the asset and have the title transferred to the NFT owner, as well as the right to use the asset. This ensures the rights to the physical property are passed digitally with the transfer of the NFT, without having to update the legal owner of the property after each transfer.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Security note: In the event of a private key hack the company will likely not be able to reissue a Home NFT. Home NFT owners who are not confident in their ability to safely store their home NFT will have varying levels of security options (multi-sigs, custodians, etc.). For public, large protocol hacks, the company may freeze the assets using the Blocklist function and reissue the home NFTs to the original owners. Blocklist functionality is to-be-implemented in the reference implementation above.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The following are checks and recommendations for protocols integrating NFTs under this standard. These are of particular relevance to applications which lend against any asset utilizing this standard.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Protocol integrators are recommended to check that the unique identifiers for the property and the hash of the operating agreement are immutable for the specific NFTs they wish to integrate. For correct implementation of this standard these values must be immutable to ensure legitimacy for future transferees.&lt;&#x2F;li&gt;
&lt;li&gt;Protocol integrators are recommended to check the debtOf value for an accurate representation of the value of this token.&lt;&#x2F;li&gt;
&lt;li&gt;Protocol integrators are recommended to check the foreclose status to ensure this token is still backed by the asset it was originally tied to.&lt;&#x2F;li&gt;
&lt;li&gt;For extra risk mitigation protocol integrators can implement a time-delay before performing irreversible actions. This is to protect against potential asset freezes if a hacked NFT is deposited into the protocol. Asset freezes are non-mandatory and subject to the implementation of the asset Administrator.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Signature Validation Method for NFTs</title>
        <published>2022-11-29T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Jack Boyuan Xu</name><uri>https://github.com/boyuanx</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6066/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6066-signature-validation-method-for-nfts/11943" />
        

        <id>https://wg-eips.ritovision.com/6066/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:6066"
            label="ERC-6066" />
        

        
        

        
        <summary type="html">A way to verify signatures when the signing entity is an ERC-721 or ERC-1155 NFT</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6066/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;While &lt;strong&gt;E&lt;&#x2F;strong&gt;xternally &lt;strong&gt;O&lt;&#x2F;strong&gt;wned &lt;strong&gt;A&lt;&#x2F;strong&gt;ccounts can validate signed messages with &lt;code&gt;ecrecover()&lt;&#x2F;code&gt; and smart contracts can validate signatures using specifications outlined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;ERC-1271&lt;&#x2F;a&gt;, currently there is no standard method to create or validate signatures made by NFTs. We propose a standard way for anyone to validate whether a signature made by an NFT is valid. This is possible via a modified signature validation function originally found in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;ERC-1271&lt;&#x2F;a&gt;: &lt;code&gt;isValidSignature(tokenId, hash, data)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;With billions of ETH in trading volume, the &lt;strong&gt;N&lt;&#x2F;strong&gt;on-&lt;strong&gt;F&lt;&#x2F;strong&gt;ungible &lt;strong&gt;T&lt;&#x2F;strong&gt;oken standard has exploded into tremendous popularity in recent years. Despite the far-reaching implications of having unique tokenized items on-chain, NFTs have mainly been used to represent artwork in the form of avatars or profile pictures. While this is certainly not a trivial use case for the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; &amp;amp; &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; token standards, we reckon more can be done to aid the community in discovering alternative uses for NFTs.&lt;&#x2F;p&gt;
&lt;p&gt;One of the alternative use cases for NFTs is using them to represent offices in an organization. In this case, tying signatures to transferrable NFTs instead of EOAs or smart contracts becomes crucial. Suppose there exists a DAO that utilizes NFTs as badges that represent certain administrative offices (i.e., CEO, COO, CFO, etc.) with a quarterly democratic election that potentially replaces those who currently occupy said offices. If the sitting COO has previously signed agreements or authorized certain actions, their past signatures would stay with the EOA who used to be the COO instead of the COO&#x27;s office itself once they are replaced with another EOA as the new COO-elect. Although a multisig wallet for the entire DAO is one way to mitigate this problem, often it is helpful to generate signatures on a more intricate level so detailed separation of responsibilities are established and maintained. It is also feasible to appoint a smart contract instead of an EOA as the COO, but the complexities this solution brings are unnecessary. If a DAO uses ENS to establish their organizational hierarchy, this proposal would allow wrapped ENS subdomains (which are NFTs) to generate signatures.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “NOT RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pragma solidity ^0.8.0;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;interface IERC6066 {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev MUST return if the signature provided is valid for the provided tokenId and hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param tokenId   Token ID of the signing NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param hash      Hash of the data to be signed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param data      OPTIONAL arbitrary data that may aid verification&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * MUST return the bytes4 magic value 0x12edb34f when function passes.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * MUST NOT modify state (using STATICCALL for solc &amp;lt; 0.5, view modifier for solc &amp;gt; 0.5)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * MUST allow external calls&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function isValidSignature(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 tokenId,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bytes32 hash,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bytes calldata data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ) external view returns (bytes4 magicValue);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;isValidSignature&lt;&#x2F;code&gt; can call arbitrary methods to validate a given signature.&lt;&#x2F;p&gt;
&lt;p&gt;This function MAY be implemented by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; compliant contracts that desire to enable its token holders to sign messages using their NFTs. Compliant callers wanting to support contract signatures MUST call this method if the signer is the holder of an NFT (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt;).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;We have purposefully decided to not include a signature generation standard in this proposal as it would restrict flexibility of such mechanism, just as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;ERC-1271&lt;&#x2F;a&gt; does not enforce a signing standard for smart contracts. We also decided to reference Gnosis Safe&#x27;s contract signing approach as it is both simplistic and proven to be adequate. The &lt;code&gt;bytes calldata data&lt;&#x2F;code&gt; parameter is considered optional if extra data is needed for signature verification, also conforming this EIP to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5750&#x2F;&quot;&gt;ERC-5750&lt;&#x2F;a&gt; for future-proofing purposes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is incompatible with previous work on signature validation as it does not validate any cryptographically generated signatures. Instead, signature is merely a boolean flag indicating consent. This is consistent with Gnosis Safe&#x27;s contract signature implementation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Example implementation of an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; compliant contract that conforms to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6066&#x2F;&quot;&gt;ERC-6066&lt;&#x2F;a&gt; with a custom signing function:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pragma solidity ^0.8.0;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;import &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC721&#x2F;ERC721.sol&amp;quot;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;import &amp;quot;.&#x2F;interfaces&#x2F;IERC6066.sol&amp;quot;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;contract ERC6066Reference is ERC721, IERC6066 {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; type(IERC6066).interfaceId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytes4 public constant MAGICVALUE = 0x12edb34f;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytes4 public constant BADVALUE = 0xffffffff;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    mapping(uint256 =&amp;gt; mapping(bytes32 =&amp;gt; bool)) internal _signatures;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    error ENotTokenOwner();&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev Checks if the sender owns NFT with ID tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param tokenId   Token ID of the signing NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    modifier onlyTokenOwner(uint256 tokenId) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        if (ownerOf(tokenId) != _msgSender()) revert ENotTokenOwner();&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    constructor(string memory name_, string memory symbol_)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ERC721(name_, symbol_)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev SHOULD sign the provided hash with NFT of tokenId given sender owns said NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param tokenId   Token ID of the signing NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param hash      Hash of the data to be signed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function sign(uint256 tokenId, bytes32 hash)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        onlyTokenOwner(tokenId)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _signatures[tokenId][hash] = true;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev MUST return if the signature provided is valid for the provided tokenId, hash, and optionally data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function isValidSignature(uint256 tokenId, bytes32 hash, bytes calldata data)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        override&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        returns (bytes4 magicValue)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &#x2F;&#x2F; The data parameter is unused in this example&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return _signatures[tokenId][hash] ? MAGICVALUE : BADVALUE;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev ERC-165 support&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function supportsInterface(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bytes4 interfaceId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ) public view virtual override returns (bool) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            interfaceId == type(IERC6066).interfaceId ||&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            super.supportsInterface(interfaceId);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The revokable nature of contract-based signatures carries over to this EIP. Developers and users alike should take it into consideration.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>ERC-721 Balance indexing via Transfer event</title>
        <published>2022-11-26T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Zainan Victor Zhou</name><uri>https://github.com/xinbenlv</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6047/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-xxx-require-erc721-to-always-emit-transfer/11894" />
        

        <id>https://wg-eips.ritovision.com/6047/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:6047"
            label="ERC-6047" />
        

        
        

        
        <summary type="html">Mandates emitting the Transfer event for ERC-721 NFTs during contract creation</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6047/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP extends &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; to allow the tracking and indexing of NFTs by mandating that a pre-existing event be emitted during contract creation.&lt;&#x2F;p&gt;
&lt;p&gt;ERC-721 requires a &lt;code&gt;Transfer&lt;&#x2F;code&gt; event to be emitted whenever a transfer or mint (i.e. transfer from &lt;code&gt;0x0&lt;&#x2F;code&gt;) or burn (i.g. transfer to &lt;code&gt;0x0&lt;&#x2F;code&gt;) occurs, &lt;strong&gt;except during contract creation&lt;&#x2F;strong&gt;. This EIP mandates that compliant contracts emit a &lt;code&gt;Transfer&lt;&#x2F;code&gt; event &lt;strong&gt;regardless of whether it occurs during or after contract creation.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; requires a &lt;code&gt;Transfer&lt;&#x2F;code&gt; event to be emitted whenever a transfer or mint (i.e. transfer from &lt;code&gt;0x0&lt;&#x2F;code&gt;) or burn (i.e. transfer to &lt;code&gt;0x0&lt;&#x2F;code&gt;) occurs, EXCEPT for during contract creation. Due to this exception, contracts can mint NFTs during contract creation without the event being emitted. Unlike ERC-721, the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; standard mandates events to be emitted regardless of whether such minting occurs during or outside of contract creation. This allows an indexing service or any off-chain service to reliably capture and account for token creation.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP removes this exception granted by ERC-721 and mandates emitting the &lt;code&gt;Transfer&lt;&#x2F;code&gt; for ERC-721 during contract creation. In this manner, indexers and off-chain applications can track token minting, burning, and transferring while relying only on ERC-721&#x27;s &lt;code&gt;Transfer&lt;&#x2F;code&gt; event log.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Compliant contracts MUST implement &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Compliant contracts MUST emit a &lt;code&gt;Transfer&lt;&#x2F;code&gt; event whenever a token is transferred, minted (i.e. transferred from &lt;code&gt;0x0&lt;&#x2F;code&gt;), or burned (i.g. transferred to &lt;code&gt;0x0&lt;&#x2F;code&gt;), &lt;strong&gt;including during contract creation.&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Using the existing &lt;code&gt;Transfer&lt;&#x2F;code&gt; event instead of creating a new event (e.g. &lt;code&gt;Creation&lt;&#x2F;code&gt;) allows this EIP to be backward compatible with existing indexers.E&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;All contracts compliant with this EIP are compliant with ERC-721. However, not all contracts compliant with ERC-721 are compliant with this EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;No new security concerns.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Replace SELFDESTRUCT with DEACTIVATE</title>
        <published>2022-11-25T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6046/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/almost-self-destructing-selfdestruct-deactivate/11886" />
        

        <id>https://wg-eips.ritovision.com/6046/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:6046"
            label="EIP-6046" />
        

        
        

        
        <summary type="html">Change SELFDESTRUCT to not delete storage keys and use a special value in the account nonce to signal deactivation</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6046/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Change &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; to not delete all storage keys, and to use a special value in the account nonce to signal &lt;em&gt;deactivated&lt;&#x2F;em&gt; accounts. Because the semantics of revival change (storage keys may exists), we also rename the instruction to &lt;code&gt;DEACTIVATE&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; instruction currently has a fixed price, but is unbounded in terms of how many storage&#x2F;account changes it performs (it needs to delete all keys). This has been an outstanding concern for some time.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore, with &lt;em&gt;Verkle trees&lt;&#x2F;em&gt;, accounts will be organised differently: account properties, including storage, will have individual keys. It will not be possible to traverse and find all used keys. This makes &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; very challenging to support in Verkle trees.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Change the rules introduced by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2681&#x2F;&quot;&gt;EIP-2681&lt;&#x2F;a&gt; such that regular nonce increase is bound by &lt;code&gt;2^64-2&lt;&#x2F;code&gt; instead of &lt;code&gt;2^64-1&lt;&#x2F;code&gt;. This applies from genesis.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The behaviour of &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; is changed such that:&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;ul&gt;
&lt;li&gt;Does not delete any storage keys and also leave the account in place.&lt;&#x2F;li&gt;
&lt;li&gt;Transfer the account balance to the target &lt;strong&gt;and&lt;&#x2F;strong&gt; set account balance to &lt;code&gt;0.&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Set the account nonce to &lt;code&gt;2^64-1&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Note that no refund is given since &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3529&#x2F;&quot;&gt;EIP-3529&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Note that the rules of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt; regarding &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; remain unchanged.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;ol start=&quot;2&quot;&gt;
&lt;li&gt;Modify account execution (triggered both via external transactions or CALL* instructions), such that execution succeeds and returns an empty buffer if the nonce equals &lt;code&gt;2^64-1&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;ul&gt;
&lt;li&gt;Note that the account can still receive non-executable value transfers (such as coinbase transactions or other &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;s).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;ol start=&quot;3&quot;&gt;
&lt;li&gt;Modify &lt;code&gt;CREATE2&lt;&#x2F;code&gt; such that it allows account creation if the nonce equals &lt;code&gt;2^64-1&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;ul&gt;
&lt;li&gt;Note that the account (especially code and storage) might not be empty prior to &lt;code&gt;CREATE2&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Note that a successful &lt;code&gt;CREATE2&lt;&#x2F;code&gt; will change the account code, nonce and potentially balance.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;ol start=&quot;4&quot;&gt;
&lt;li&gt;Rename the &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; instruction to &lt;code&gt;DEACTIVATE&lt;&#x2F;code&gt;, because the semantics of &quot;account revival&quot; are changed: the old storage items will remain, and newly deployed code must be aware of this.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;There have been various proposals of removing &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; and many would just outright remove the deletion capability. This breaks certain usage patterns, which the &lt;em&gt;deactivation&lt;&#x2F;em&gt; option leaves intact, albeit with minor changes. This only affects &lt;em&gt;newly&lt;&#x2F;em&gt; deployed code, and not existing one.&lt;&#x2F;p&gt;
&lt;p&gt;All the proposals would leave data in the state, but this proposal provides the flexibility to reuse or remove storage slots one-by-one should the revived contract choose to do so.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP requires a protocol upgrade, since it modifies consensus rules. The further restriction of nonce should not have an effect on accounts, as &lt;code&gt;2^64-2&lt;&#x2F;code&gt; is an unfeasibly high limit.&lt;&#x2F;p&gt;
&lt;p&gt;Contracts using the revival pattern will still work, but the code deployed during revival may need to be made aware that storage keys can already exist in the account.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The new behaviour of preserving storage has a potential effect on security. Contract authors must be aware and design contracts accordingly. There may be an effect on existing deployed code performing autonomous destruction and revival.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Private Key Encapsulation</title>
        <published>2022-11-21T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Base Labs</name><uri>https://github.com/Base-Labs</uri>
	</author>
	
	<author>
		<name>Weiji Guo</name><uri>https://github.com/weiji-cryptonatty</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6051/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/private-key-encapsulation-to-move-around-securely-without-entering-seed/11604" />
        

        <id>https://wg-eips.ritovision.com/6051/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="interface"
                label="Interface" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:6051"
            label="EIP-6051" />
        

        
        

        
        <summary type="html">defines a specification for encapsulating private keys.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6051/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes a mechanism to encapsulate a private key so that it could be securely relocated to another application without providing the seed. This EIP combines &lt;code&gt;ECIES&lt;&#x2F;code&gt; (Elliptic Curve Integrated Encryption Scheme) and optional signature verification under various choices to ensure that the private key is encapsulated for a known or trusted party.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;There are various cases in which we might want to export one of many private keys from a much more secure but less convenient wallet, which is controlled with a seed or passphrase.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;We might dedicate one of many private keys for messaging purposes, and that private key is probably managed in a not-so-secure manner;&lt;&#x2F;li&gt;
&lt;li&gt;We might want to export one of many private keys from a hardware wallet, and split it with MPC technology so that a 3rd party service could help us identify potential frauds or known bad addresses, enforce 2FA, etc., meanwhile we can initiate transactions from a mobile device with much better UX and without carrying a hardware wallet.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;In both cases, it is safer not to provide the seed which controls the whole wallet and might contains many addresses in multiple chains.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP aims to enable such use cases.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;sender-and-recipient&quot;&gt;Sender and Recipient&lt;&#x2F;h3&gt;
&lt;p&gt;We hereby define:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;Sender&lt;&#x2F;em&gt; as the party who holds in custody the private key to be encapsulated; &lt;em&gt;Sender Application&lt;&#x2F;em&gt; as the client-side application that said &lt;em&gt;Sender&lt;&#x2F;em&gt; uses to send the encapsulated private key.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;Recipient&lt;&#x2F;em&gt; as the party who accepts the encapsulated private key, unwraps, and then uses it; &lt;em&gt;Recipient Application&lt;&#x2F;em&gt; as the client-side application that &lt;em&gt;Recipient&lt;&#x2F;em&gt; uses to receive the encapsulated private key.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;core-algorithms&quot;&gt;Core Algorithms&lt;&#x2F;h3&gt;
&lt;p&gt;The basic idea is to encapsulate the private key with ECIES. To ensure that the ephemeral public key to encapsulate the private key is indeed generated from a trusted party and has not been tampered with, we also provided an option to sign that ephemeral public key in this standard.&lt;&#x2F;p&gt;
&lt;p&gt;There should be a mandatory  &lt;code&gt;version&lt;&#x2F;code&gt;  parameter. This allows various kinds of Key Encapsulation Mechanisms to be adopted depending on security considerations or preferences. The list shall be short to minimize compatibility issues among different vendors.&lt;&#x2F;p&gt;
&lt;p&gt;In addition to a &lt;code&gt;version&lt;&#x2F;code&gt; parameter, the following keys and functions are involved:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The Sender&#x27;s private key  &lt;code&gt;sk&lt;&#x2F;code&gt;, which is to be encapsulated to the Recipient, and the corresponding address &lt;code&gt;account&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The ephemeral Recipient key pair  &lt;code&gt;(r, R)&lt;&#x2F;code&gt;  such that &lt;code&gt;R = [r]G&lt;&#x2F;code&gt;. &lt;code&gt;G&lt;&#x2F;code&gt; denotes the base point of the elliptic curve, and &lt;code&gt;[r]G&lt;&#x2F;code&gt; denotes scalar multiplication. Optionally, &lt;code&gt;R&lt;&#x2F;code&gt; could be signed, and &lt;code&gt;signerPubKey&lt;&#x2F;code&gt; and &lt;code&gt;signature&lt;&#x2F;code&gt; are then provided for Sender to verify if &lt;code&gt;R&lt;&#x2F;code&gt;  could be trusted or not.&lt;&#x2F;li&gt;
&lt;li&gt;The ephemeral Sender key pair  &lt;code&gt;(s, S)&lt;&#x2F;code&gt;  such that &lt;code&gt;S = [s]G&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The share secret  &lt;code&gt;ss := [s]R = [r]S&lt;&#x2F;code&gt; according to ECDH. Note that for secp256k1 this EIP follows RFC5903 and uses compact representation, which means to use &lt;em&gt;only&lt;&#x2F;em&gt; the &lt;code&gt;x&lt;&#x2F;code&gt; coordinate as the shared secret. For Curve25519 this EIP follows RFC7748.&lt;&#x2F;li&gt;
&lt;li&gt;The out-of-band data &lt;code&gt;oob&lt;&#x2F;code&gt;, optional. This could be digits or an alpha-numeric string entered by the user.&lt;&#x2F;li&gt;
&lt;li&gt;Let  &lt;code&gt;derivedKey  :=  HKDF(hash=SHA256, ikm=ss, info=oob,  salt,  length)&lt;&#x2F;code&gt;. HKDF is defined in RFC5869. The  &lt;code&gt;length&lt;&#x2F;code&gt;  should be determined by  &lt;code&gt;skey&lt;&#x2F;code&gt;  and  &lt;code&gt;IV&lt;&#x2F;code&gt;  requirements such that the symmetric key  &lt;code&gt;skey  = derivedKey[0:keySize]&lt;&#x2F;code&gt;, and  &lt;code&gt;IV  = derivedKey[keySize:length]&lt;&#x2F;code&gt;.  &lt;code&gt;keySize&lt;&#x2F;code&gt;  denotes the key size of the underlying symmetric algorithm, for example, 16 (bytes) for AES-128, and 32 (bytes) for Chacha20. See &lt;strong&gt;Security Considerations&lt;&#x2F;strong&gt; for the use of  &lt;code&gt;salt&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Let &lt;code&gt;cipher  := authenticated_encryption(symAlg,  skey,  IV, data=sk)&lt;&#x2F;code&gt;. The symmetric cipher algorithm &lt;code&gt;symAlg&lt;&#x2F;code&gt; and authentication scheme are decided by the version parameter. No additional authentication data &lt;code&gt;aad&lt;&#x2F;code&gt; is used.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;A much-simplified example flow without signature and verification is:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;em&gt;Recipient Application&lt;&#x2F;em&gt; generates  &lt;code&gt;(r, R)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;User inputs  &lt;code&gt;R&lt;&#x2F;code&gt;  to &lt;em&gt;Sender Application&lt;&#x2F;em&gt;, along with a six-digit code “123456” as  &lt;code&gt;oob&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;Sender Application&lt;&#x2F;em&gt; generates  &lt;code&gt;(s, S)&lt;&#x2F;code&gt;, and computes  &lt;code&gt;cipher&lt;&#x2F;code&gt;, then returns &lt;code&gt;S || cipher&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;Recipient Application&lt;&#x2F;em&gt; scans to read  &lt;code&gt;S&lt;&#x2F;code&gt;  and  &lt;code&gt;cipher&lt;&#x2F;code&gt;. The user enters “123456” as  &lt;code&gt;oob&lt;&#x2F;code&gt;  to &lt;em&gt;Recipient Application&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;Recipient Application&lt;&#x2F;em&gt; decrypts  &lt;code&gt;cipher&lt;&#x2F;code&gt;  to get  &lt;code&gt;sk&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;Recipient Application&lt;&#x2F;em&gt; derives the address corresponding to  &lt;code&gt;sk&lt;&#x2F;code&gt;  so that the user can confirm the correctness.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;With signature and verification, the signature to &lt;code&gt;R&lt;&#x2F;code&gt; by &lt;code&gt;singerPubKey&lt;&#x2F;code&gt; is appended to &lt;code&gt;R&lt;&#x2F;code&gt;. &lt;code&gt;signerPubKey&lt;&#x2F;code&gt; itself could have been already signed by &lt;code&gt;trustedPubKey&lt;&#x2F;code&gt;, and that signature is appended to &lt;code&gt;signerPubKey&lt;&#x2F;code&gt;. Note that the signature is applied to the byte array data instead of its string representation, which might lead to confusion and interoperability issues (such as hex or base64, lower case v.s. upper case, etc.). See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6051&#x2F;#requests&quot;&gt;Requests&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6051&#x2F;#test-cases&quot;&gt;Test Cases&lt;&#x2F;a&gt; for further clarification and examples.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;requests&quot;&gt;Requests&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;encoding-of-data-and-messages&quot;&gt;Encoding of data and messages&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Raw bytes are encoded in hex and prefixed with &#x27;0x&#x27;.&lt;&#x2F;li&gt;
&lt;li&gt;Unless specified otherwise, all parameters and return values are hex-encoded bytes.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;cipher&lt;&#x2F;code&gt;  is encoded into a single byte buffer as: &lt;code&gt;[IV  || encrypted_sk || tag]&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;R&lt;&#x2F;code&gt;, &lt;code&gt;S&lt;&#x2F;code&gt;, &lt;code&gt;signerPubKey&lt;&#x2F;code&gt;, and &lt;code&gt;trustedPubKey&lt;&#x2F;code&gt; are compressed if applicable.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;R&lt;&#x2F;code&gt; or &lt;code&gt;signerPubKey&lt;&#x2F;code&gt; could be followed by a signature to it: &lt;code&gt;[pub || sig]&lt;&#x2F;code&gt;. Note that for the secp256k1 curve, the signature is just 64 bytes without the &lt;code&gt;v&lt;&#x2F;code&gt; indicator as found in a typical Ethereum signature.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;r1-request-for-recipient-to-generate-ephemeral-key-pair&quot;&gt;R1. Request for Recipient to generate ephemeral key pair&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;request&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	method&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_generateEphemeralKeyPair&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	params&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;version&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; signerPubKey&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; expected return value: R&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;signerPubKey&lt;&#x2F;code&gt;  is optional. If provided, it is assumed that the implementation has the corresponding private key and the implementation MUST sign the ephemeral public key (in the form of what is to be returned). The signature algorithm is determined by the curve part of the  &lt;code&gt;version&lt;&#x2F;code&gt;  parameter, that is, ECDSA for secp256k1, and Ed25519 for Curve25519. And in this situation, it should be the case that &lt;em&gt;Sender&lt;&#x2F;em&gt; trusts  &lt;code&gt;signerPubKey&lt;&#x2F;code&gt;, no matter how this trust is maintained. If not, the next request WILL be rejected by &lt;em&gt;Sender Application&lt;&#x2F;em&gt;. Also, see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6051&#x2F;#security-considerations&quot;&gt;Security Considerations&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The implementation then MUST generate random private key &lt;code&gt;r&lt;&#x2F;code&gt; with a cryptographic secure random number generator (CSRNG), and derive ephemeral public key &lt;code&gt;R = [r]G&lt;&#x2F;code&gt;. The implementation SHOULD keep the generated key pair &lt;code&gt;(r, R)&lt;&#x2F;code&gt; in a secure manner in accordance with the circumstances, and SHOULD keep it only for a limited duration, but the specific duration is left to individual implementations. The implementation SHOULD be able to retrieve &lt;code&gt;r&lt;&#x2F;code&gt; when given back the corresponding public key &lt;code&gt;R&lt;&#x2F;code&gt; if within the said duration.&lt;&#x2F;p&gt;
&lt;p&gt;The return value is &lt;code&gt;R&lt;&#x2F;code&gt;, compressed if applicable. If  &lt;code&gt;signerPubKey&lt;&#x2F;code&gt;  is provided, then the &lt;code&gt;signature&lt;&#x2F;code&gt; is appended to &lt;code&gt;R&lt;&#x2F;code&gt;, also hex-encoded.&lt;&#x2F;p&gt;
&lt;p&gt;Alternatively, &lt;code&gt;signature&lt;&#x2F;code&gt; could be calculated separately, and then appended to the returned data.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;r2-request-for-sender-to-encapsulate-the-private-key&quot;&gt;R2. Request for Sender to encapsulate the private key&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;request&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	method&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_encapsulatePrivateKey&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	params&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		version&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		recipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; public key, may be followed by its signature, see signerPubKey&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		signerPubKey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		oob&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		salt&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; expected return value: S || cipher&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;recipient&lt;&#x2F;code&gt;  is the return value from the call to generate ephemeral key pair, with the optional &lt;code&gt;signature&lt;&#x2F;code&gt; appended either as returned or separately.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;oob&lt;&#x2F;code&gt;  and  &lt;code&gt;salt&lt;&#x2F;code&gt;  are just byte arrays.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;account&lt;&#x2F;code&gt;  is used to identify which private key to be encapsulated. With Ethereum, it is an address. Also, see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6051&#x2F;#encoding-of-data-and-messages&quot;&gt;Encoding of data and messages&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;If  &lt;code&gt;signerPubKey&lt;&#x2F;code&gt;  is provided or  &lt;code&gt;recipient&lt;&#x2F;code&gt;  contains &lt;code&gt;signature&lt;&#x2F;code&gt; data, the implementation MUST perform signature verification. Missing data or incorrect format MUST either fail the call or result in an empty return and optional error logs.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;signerPubKey&lt;&#x2F;code&gt; could have been further signed by another key pair &lt;code&gt;(trusted, trustedPubKey)&lt;&#x2F;code&gt;, which is trusted by &lt;em&gt;Sender Application&lt;&#x2F;em&gt;. In that case, &lt;code&gt;signerPubKey&lt;&#x2F;code&gt; is appended with the corresponding signature data, which SHOULD be verified against &lt;code&gt;trustedPubKey&lt;&#x2F;code&gt;. See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6051&#x2F;#test-cases&quot;&gt;Test Cases&lt;&#x2F;a&gt; for further clarification.&lt;&#x2F;p&gt;
&lt;p&gt;The implementation shall then proceed to retrieve the private key &lt;code&gt;sk&lt;&#x2F;code&gt; corresponding to  &lt;code&gt;account&lt;&#x2F;code&gt;, and follow the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6051&#x2F;#core-algorithms&quot;&gt;Core Algorithms&lt;&#x2F;a&gt; to encrypt it.&lt;&#x2F;p&gt;
&lt;p&gt;The return data is a byte array that contains first &lt;em&gt;Sender&lt;&#x2F;em&gt;&#x27;s ephemeral public key &lt;code&gt;S&lt;&#x2F;code&gt; (compressed if applicable), then &lt;code&gt;cipher&lt;&#x2F;code&gt; including any authentication tag, that is, &lt;code&gt;S || cipher&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;r3-request-for-recipient-to-unwrap-and-intake-the-private-key&quot;&gt;R3. Request for Recipient to unwrap and intake the private key&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;request&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	method&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_intakePrivateKey&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	params&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		version&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		recipientPublicKey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  no signature this time&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		oob&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		salt&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; expected return value: account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This time  &lt;code&gt;recipientPublicKey&lt;&#x2F;code&gt;  is only the ephemeral public key &lt;code&gt;R&lt;&#x2F;code&gt; generated earlier in the Recipient side, just for the implementation to retrieve the corresponding private key &lt;code&gt;r&lt;&#x2F;code&gt;.  &lt;code&gt;data&lt;&#x2F;code&gt;  is the return value from the call to encapsulate private key, which is &lt;code&gt;S || cipher&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;When the encapsulated private key &lt;code&gt;sk&lt;&#x2F;code&gt; is decrypted successfully, the implementation can process it further according to the designated purposes. Some general security guidelines SHALL be followed, for example, do  &lt;em&gt;not&lt;&#x2F;em&gt;  log the value, do securely wipe it after use, etc.&lt;&#x2F;p&gt;
&lt;p&gt;The return value is the corresponding Ethereum address for &lt;code&gt;sk&lt;&#x2F;code&gt;, or empty if any error.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;options-and-parameters&quot;&gt;Options and Parameters&lt;&#x2F;h3&gt;
&lt;p&gt;Available elliptic curves are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;secp256k1 (mandatory)&lt;&#x2F;li&gt;
&lt;li&gt;Curve25519&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Available authenticated encryption schemes are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;AES-128-GCM (mandatory)&lt;&#x2F;li&gt;
&lt;li&gt;AES-256-GCM&lt;&#x2F;li&gt;
&lt;li&gt;Chacha20-Poly1305&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The version string is simply the concatenation of the elliptic curve and AE scheme, for example, secp256k1-AES-128-GCM. The above lists allow a combination of six different concrete schemes. Implementations are encouraged to implement curve-related logic separately from authenticated encryption schemes to avoid duplication and to promote interoperability.&lt;&#x2F;p&gt;
&lt;p&gt;Signature algorithms for each curve are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;secp256k1 --&amp;gt; ECDSA&lt;&#x2F;li&gt;
&lt;li&gt;Curve25519 --&amp;gt; Ed25519&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;A critical difference between this &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6051&#x2F;&quot;&gt;EIP-6051&lt;&#x2F;a&gt; with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5630&#x2F;&quot;&gt;EIP-5630&lt;&#x2F;a&gt; is that, as the purpose of key encapsulation is to transport a private key securely, the public key from the key recipient should be ephemeral, and mostly used only one-time. While in EIP-5630 settings, the public key of the message recipient shall be stable for a while so that message senders can encrypt messages without key discovery every time.&lt;&#x2F;p&gt;
&lt;p&gt;There is security implication to this difference, including perfect forward secrecy. We aim to achieve perfect forward secrecy by generating ephemeral key pairs on both sides every time:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;first &lt;em&gt;Recipient&lt;&#x2F;em&gt; shall generate an ephemeral key pair, retain the private key securely, and export the public key;&lt;&#x2F;li&gt;
&lt;li&gt;then &lt;em&gt;Sender&lt;&#x2F;em&gt; can securely wrap the private key in ECIES, with another ephemeral key pair, then destroy the ephemeral key securely;&lt;&#x2F;li&gt;
&lt;li&gt;finally &lt;em&gt;Recipient&lt;&#x2F;em&gt; can unwrap the private key, then destroy its ephemeral key pair securely. After these steps, the cipher text in transport intercepted by a malicious 3rd party is no longer decryptable.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues for this new proposal.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;interoperability&quot;&gt;Interoperability&lt;&#x2F;h3&gt;
&lt;p&gt;To minimize potential compatibility issues among applications (including hardware wallets), this EIP requires that version secp256k1-AES-128-GCM MUST be supported.&lt;&#x2F;p&gt;
&lt;p&gt;The version could be decided by the user or negotiated by both sides. When there is no user input or negotiation, secp256k1-AES-128-GCM is assumed.&lt;&#x2F;p&gt;
&lt;p&gt;It is expected that implementations cover curve supports separately from encryption support, that is, all the versions that could be derived from the supported curve and supported encryption scheme should work.&lt;&#x2F;p&gt;
&lt;p&gt;Signatures to &lt;code&gt;R&lt;&#x2F;code&gt; and &lt;code&gt;signerPubKey&lt;&#x2F;code&gt; are applied to byte array values instead of the encoded string.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;ux-recommendations&quot;&gt;UX Recommendations&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;salt&lt;&#x2F;code&gt; and&#x2F;or &lt;code&gt;oob&lt;&#x2F;code&gt; data: both are inputs to the HKDF function (&lt;code&gt;oob&lt;&#x2F;code&gt; as “info” parameter). For better user experiences we suggest to require from users only one of them but this is up to the implementation.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Recipient Application&lt;&#x2F;em&gt; is assumed to be powerful enough. &lt;em&gt;Sender Application&lt;&#x2F;em&gt; could have very limited computing power and user interaction capabilities.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;For review purposes, the program to generate the test vectors is open-sourced and provided in the corresponding discussion thread.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;data-fixation&quot;&gt;Data Fixation&lt;&#x2F;h3&gt;
&lt;p&gt;Throughout the test cases, we fix values for the below data:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;sk&lt;&#x2F;code&gt;, the private key to be encapsulated, fixed to: &lt;code&gt;0xf8f8a2f43c8376ccb0871305060d7b27b0554d2cc72bccf41b2705608452f315&lt;&#x2F;code&gt;. The corresponding address is &lt;code&gt;0x001d3f1ef827552ae1114027bd3ecf1f086ba0f9&lt;&#x2F;code&gt;, called &lt;code&gt;account&lt;&#x2F;code&gt;. Note that these values come from the book &lt;em&gt;Mastering Ethereum&lt;&#x2F;em&gt; by Andreas M. Antonopoulos and Gavin Wood.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;r&lt;&#x2F;code&gt;, the Recipient private key, fixed to &lt;code&gt;0x6f2dd2a7804705d2d536bee92221051865a639efa23f5ca7c810e77048253a79&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;s&lt;&#x2F;code&gt;, the Sender private key, fixed to &lt;code&gt;0x28fa2db9f916e44fcc88370bedaf5eb3ec45632f040f4c1450c0f101e1e8bac8&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;signer&lt;&#x2F;code&gt;, the private key to sign the ephemeral public key, fixed to &lt;code&gt;0xac304db075d1685284ba5e10c343f2324ee32df3394fc093c98932517d36e344&lt;&#x2F;code&gt;. When used for Ed25519 signing, however, this value acts as &lt;code&gt;seed&lt;&#x2F;code&gt;, while the actual private key is calculated as &lt;code&gt;SHA512(seed)[:32]&lt;&#x2F;code&gt;. Or put another way, the public key is the scalar multiplication of hashed private key to the base point. Same for &lt;code&gt;trusted&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;trusted&lt;&#x2F;code&gt;, the private key to sign &lt;code&gt;signerPubKey&lt;&#x2F;code&gt;, fixed to &lt;code&gt;0xda6649d68fc03b807e444e0034b3b59ec60716212007d72c9ddbfd33e25d38d1&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;oob&lt;&#x2F;code&gt;, fixed to &lt;code&gt;0x313233343536&lt;&#x2F;code&gt; (string value: &lt;code&gt;123456&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;salt&lt;&#x2F;code&gt;, fixed to &lt;code&gt;0x6569703a2070726976617465206b657920656e63617073756c6174696f6e&lt;&#x2F;code&gt; (string value: &lt;code&gt;eip: private key encapsulation&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;case-1&quot;&gt;Case 1&lt;&#x2F;h3&gt;
&lt;p&gt;Use &lt;code&gt;version&lt;&#x2F;code&gt; as &lt;code&gt;secp256k1-AES-128-GCM&lt;&#x2F;code&gt;. &lt;strong&gt;R1&lt;&#x2F;strong&gt; is provided as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;request&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	method&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_generateEphemeralKeyPair&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	params&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		version&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;secp256k1-AES-128-GCM&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		signerPubKey&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x035a5ca16997f9b9ead9572c9bde36c5dab584b17bc965cdd7c2945c776e981b0b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Suppose the implementation generates an ephemeral key pair &lt;code&gt;(r, R)&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;r: &amp;#39;0x6f2dd2a7804705d2d536bee92221051865a639efa23f5ca7c810e77048253a79&amp;#39;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;R: &amp;#39;0x039ef98feddb39664450c3876878093c70652caba7e3fd04333c0558ffdf798d09&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The return value could be:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;#39;0x039ef98feddb39664450c3876878093c70652caba7e3fd04333c0558ffdf798d09536da06b8d9207040ada179dc2c38f701a1a21c9ab5a7d52f5da50ea438e8ccf47dac77547fbdde194f71db52860b9e10ca2b089646f133d172124504ac1996a&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note that &lt;code&gt;R&lt;&#x2F;code&gt; is compressed and &lt;code&gt;R&lt;&#x2F;code&gt; leads the return value: &lt;code&gt;R || sig&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Therefore &lt;strong&gt;R2&lt;&#x2F;strong&gt; could be provided as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;request&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	method&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_encapsulatePrivateKey&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	params&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		version&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;secp256k1-AES-128-GCM&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		recipient&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x039ef98feddb39664450c3876878093c70652caba7e3fd04333c0558ffdf798d09536da06b8d9207040ada179dc2c38f701a1a21c9ab5a7d52f5da50ea438e8ccf47dac77547fbdde194f71db52860b9e10ca2b089646f133d172124504ac1996a&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		signerPubKey&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x035a5ca16997f9b9ead9572c9bde36c5dab584b17bc965cdd7c2945c776e981b0b5bd427c527b7f1012b8edfd179b9002a7f2d7fc326bb6ae9aaf38b44eb93c397631fd8bb05fd78fa16ecca1eb19652b200f9048611265bc81f485cf60f29d6de&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		oob&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x313233343536&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		salt&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x6569703a2070726976617465206b657920656e63617073756c6174696f6e&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		account&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x001d3f1ef827552ae1114027bd3ecf1f086ba0f9&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;em&gt;Sender Application&lt;&#x2F;em&gt; first verifies first layer signature as ECDSA over secp256k1:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; actual message to be signed should be the decoded byte array&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;msg: &amp;#39;0x039ef98feddb39664450c3876878093c70652caba7e3fd04333c0558ffdf798d09&amp;#39;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sig: &amp;#39;0x536da06b8d9207040ada179dc2c38f701a1a21c9ab5a7d52f5da50ea438e8ccf47dac77547fbdde194f71db52860b9e10ca2b089646f133d172124504ac1996aaf4a811661741a43587dd458858b75c582ca7db82fa77b&amp;#39;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;signerPubKey&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pub: &amp;#39;0x035a5ca16997f9b9ead9572c9bde36c5dab584b17bc965cdd7c2945c776e981b0b&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Then it proceeds to verify the second layer signature, also as ECDSA over secp256k1:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; actual message to be signed should be the decoded byte array&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;msg: &amp;#39;0x035a5ca16997f9b9ead9572c9bde36c5dab584b17bc965cdd7c2945c776e981b0b&amp;#39;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sig: &amp;#39;0x5bd427c527b7f1012b8edfd179b9002a7f2d7fc326bb6ae9aaf38b44eb93c397631fd8bb05fd78fa16ecca1eb19652b200f9048611265bc81f485cf60f29d6de&amp;#39;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;trustedPubKey&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pub: &amp;#39;0x027fb72176f1f9852ce7dd9dc3aa4711675d3d8dc5102b86d758d853002137e839&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Since &lt;em&gt;Sender Application&lt;&#x2F;em&gt; trusts &lt;code&gt;trustedPubKey&lt;&#x2F;code&gt;, the signature verification succeeds.&lt;&#x2F;p&gt;
&lt;p&gt;Suppose the implementation generates an ephemeral key pair &lt;code&gt;(s, S)&lt;&#x2F;code&gt; as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;s: &amp;#39;0x28fa2db9f916e44fcc88370bedaf5eb3ec45632f040f4c1450c0f101e1e8bac8&amp;#39;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;S: &amp;#39;0x02ced2278d9ebb193f166d4ee5bbbc5ab8ca4b9ddf23c4172ad11185c079944c02&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The shared secret, symmetric key, and IV should be:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ss: &amp;#39;0x8e83bc5a9c77b11afc12c9a8262b16e899678d1720459e3b73ca2abcfed1fca3&amp;#39;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;skey: &amp;#39;0x6ccc02a61aa16d6c66a1277e5e2434b8&amp;#39;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;IV: &amp;#39;0x9c7a0f870d17ced2d2c3d1cf&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Then the return value should be:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;#39;0x02ced2278d9ebb193f166d4ee5bbbc5ab8ca4b9ddf23c4172ad11185c079944c02abff407e8901bb37d13d724a2e3a8a1a5af300adc286aa2ec65ef2a38c10c5cec68a949d0a20dbad2a8e5dfd7a14bbcb&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;With compressed public key &lt;code&gt;S&lt;&#x2F;code&gt; leading &lt;code&gt;cipher&lt;&#x2F;code&gt;, which in turn is (added prefix &#x27;0x&#x27;):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;#39;0xabff407e8901bb37d13d724a2e3a8a1a5af300adc286aa2ec65ef2a38c10c5cec68a949d0a20dbad2a8e5dfd7a14bbcb&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Then &lt;strong&gt;R3&lt;&#x2F;strong&gt; is provided as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;request&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	method&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_intakePrivateKey&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	params&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		version&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;secp256k1-AES-128-GCM&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		recipientPublicKey&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x039ef98feddb39664450c3876878093c70652caba7e3fd04333c0558ffdf798d09&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		oob&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x313233343536&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		salt&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x6569703a2070726976617465206b657920656e63617073756c6174696f6e&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		data&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x02ced2278d9ebb193f166d4ee5bbbc5ab8ca4b9ddf23c4172ad11185c079944c02abff407e8901bb37d13d724a2e3a8a1a5af300adc286aa2ec65ef2a38c10c5cec68a949d0a20dbad2a8e5dfd7a14bbcb&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The return value should be &lt;code&gt;0x001d3f1ef827552ae1114027bd3ecf1f086ba0f9&lt;&#x2F;code&gt;. This matches the &lt;code&gt;account&lt;&#x2F;code&gt; parameter in &lt;strong&gt;R2&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;case-2&quot;&gt;Case 2&lt;&#x2F;h3&gt;
&lt;p&gt;Use &lt;code&gt;version&lt;&#x2F;code&gt; as &lt;code&gt;secp256k1-AES-256-GCM&lt;&#x2F;code&gt;. The calculated symmetric key &lt;code&gt;skey&lt;&#x2F;code&gt;, &lt;code&gt;IV&lt;&#x2F;code&gt;, and &lt;code&gt;cipher&lt;&#x2F;code&gt; will be different. &lt;strong&gt;R1&lt;&#x2F;strong&gt; is provided as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;request&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	method&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_generateEphemeralKeyPair&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	params&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		version&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;secp256k1-AES-256-GCM&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		signerPubKey&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x035a5ca16997f9b9ead9572c9bde36c5dab584b17bc965cdd7c2945c776e981b0b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note that only the &lt;code&gt;version&lt;&#x2F;code&gt; is different (AES key size). We keep using the same &lt;code&gt;(r, R)&lt;&#x2F;code&gt; (this is just a test vector).&lt;&#x2F;p&gt;
&lt;p&gt;Therefore &lt;strong&gt;R2&lt;&#x2F;strong&gt; is provided as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;request&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	method&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_encapsulatePrivateKey&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	params&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		version&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;secp256k1-AES-256-GCM&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		recipient&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x039ef98feddb39664450c3876878093c70652caba7e3fd04333c0558ffdf798d09536da06b8d9207040ada179dc2c38f701a1a21c9ab5a7d52f5da50ea438e8ccf47dac77547fbdde194f71db52860b9e10ca2b089646f133d172124504ac1996a&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		signerPubKey&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x035a5ca16997f9b9ead9572c9bde36c5dab584b17bc965cdd7c2945c776e981b0b5bd427c527b7f1012b8edfd179b9002a7f2d7fc326bb6ae9aaf38b44eb93c397631fd8bb05fd78fa16ecca1eb19652b200f9048611265bc81f485cf60f29d6de&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		oob&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x313233343536&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		salt&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x6569703a2070726976617465206b657920656e63617073756c6174696f6e&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		account&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x001d3f1ef827552ae1114027bd3ecf1f086ba0f9&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Suppose the implementation generates the same &lt;code&gt;(s, S)&lt;&#x2F;code&gt; as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6051&#x2F;#case-1&quot;&gt;Case 1&lt;&#x2F;a&gt;. The shared secret, symmetric key, and IV should be:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ss: &amp;#39;0x8e83bc5a9c77b11afc12c9a8262b16e899678d1720459e3b73ca2abcfed1fca3&amp;#39;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;skey: &amp;#39;0x6ccc02a61aa16d6c66a1277e5e2434b89c7a0f870d17ced2d2c3d1cfd0e6f199&amp;#39;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;IV: &amp;#39;0x3369b9570b9d207a0a8ebe27&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;With shared secret &lt;code&gt;ss&lt;&#x2F;code&gt; remaining the same as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6051&#x2F;#case-1&quot;&gt;Case 1&lt;&#x2F;a&gt;, symmetric key &lt;code&gt;skey&lt;&#x2F;code&gt; contains both the &lt;code&gt;skey&lt;&#x2F;code&gt; and &lt;code&gt;IV&lt;&#x2F;code&gt; from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6051&#x2F;#case-1&quot;&gt;Case 1&lt;&#x2F;a&gt;. IV is changed.&lt;&#x2F;p&gt;
&lt;p&gt;Then the return value should be the following, with the &lt;code&gt;S&lt;&#x2F;code&gt; part the same as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6051&#x2F;#case-1&quot;&gt;Case 1&lt;&#x2F;a&gt; and the &lt;code&gt;cipher&lt;&#x2F;code&gt; part different:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;#39;0x02ced2278d9ebb193f166d4ee5bbbc5ab8ca4b9ddf23c4172ad11185c079944c0293910a91270b5deb0a645cc33604ed91668daf72328739d52a5af5a4760c4f3a9592b8f6d9b3ebe25127e7bf1c43b839&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Then &lt;strong&gt;R3&lt;&#x2F;strong&gt; is provided as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;request&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	method&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_intakePrivateKey&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	params&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		version&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;secp256k1-AES-256-GCM&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		recipientPublicKey&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x039ef98feddb39664450c3876878093c70652caba7e3fd04333c0558ffdf798d09&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		oob&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x313233343536&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		salt&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x6569703a2070726976617465206b657920656e63617073756c6174696f6e&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		data&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x02ced2278d9ebb193f166d4ee5bbbc5ab8ca4b9ddf23c4172ad11185c079944c0293910a91270b5deb0a645cc33604ed91668daf72328739d52a5af5a4760c4f3a9592b8f6d9b3ebe25127e7bf1c43b839&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The return value should be &lt;code&gt;0x001d3f1ef827552ae1114027bd3ecf1f086ba0f9&lt;&#x2F;code&gt;. This matches the &lt;code&gt;account&lt;&#x2F;code&gt; parameter in &lt;strong&gt;R2&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;case-3&quot;&gt;Case 3&lt;&#x2F;h3&gt;
&lt;p&gt;Use &lt;code&gt;version&lt;&#x2F;code&gt; as: &lt;code&gt;Curve-25519-Chacha20-Poly1305&lt;&#x2F;code&gt;. &lt;strong&gt;R1&lt;&#x2F;strong&gt; is provided as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;request&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	method&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_generateEphemeralKeyPair&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	params&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		version&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Curve25519-Chacha20-Poly1305&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		signerPubKey&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xe509fb840f6d5a69333ef68d69b86de55b9b905e45b16e3591912c097ba69938&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note that with Curve25519 the size is 32 (bytes) for both the public key and private key. And there is no compression for the public key. &lt;code&gt;signerPubKey&lt;&#x2F;code&gt; is calculated as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;signer is &amp;#39;0xac304db075d1685284ba5e10c343f2324ee32df3394fc093c98932517d36e344&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;s := SHA512(signer)[:32]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;signerPubKey := Curve25519.ScalarBaseMult(s).ToHex()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The same technique applies to &lt;code&gt;trustedPubKey&lt;&#x2F;code&gt;. With &lt;code&gt;r&lt;&#x2F;code&gt; the same as in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6051&#x2F;#case-1&quot;&gt;Case 1&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6051&#x2F;#case-2&quot;&gt;Case 2&lt;&#x2F;a&gt; and the curve being changed, the return value is &lt;code&gt;R = [r]G || sig&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;R = &amp;#39;0xc0ea3514b0ab83b2fe4f4ef96159cda8fa836ce549ef09569b901eef0723bf79cac06de279ec7f65f6b75f6bee740496df0650a6de61da5e691d7c5da1c7cb1ece61c669dd588a1029c38f11ad1714c1c9742232f9562ca6bbc7bad57882da04&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;R2&lt;&#x2F;strong&gt; is provided as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;request&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	method&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_encapsulatePrivateKey&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	params&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		version&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Curve25519-Chacha20-Poly1305&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		recipient&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xc0ea3514b0ab83b2fe4f4ef96159cda8fa836ce549ef09569b901eef0723bf79879d900f04a955078ff6ae86f1d1b69b3e1265370e64bf064adaecb895c51effa3bdae7964bf8f9a6bfaef3b66306c1bc36afa5607a51b9768aa42ac2c961f02&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		signerPubKey&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xe509fb840f6d5a69333ef68d69b86de55b9b905e45b16e3591912c097ba69938d43e06a0f32c9e5ddb39fce34fac2b6f5314a1b1583134f27426d50af7094b0c101e848737e7f717da8c8497be06bab2a9536856c56eee194e89e94fd1bba509&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		oob&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x313233343536&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		salt&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x6569703a2070726976617465206b657920656e63617073756c6174696f6e&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		account&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x001d3f1ef827552ae1114027bd3ecf1f086ba0f9&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Both &lt;code&gt;recipient&lt;&#x2F;code&gt; and &lt;code&gt;signerPubKey&lt;&#x2F;code&gt; have been signed in Ed25519. Verifying signature to &lt;code&gt;R&lt;&#x2F;code&gt; is carried out as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; actual message to be signed should be the decoded byte array&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;msg: &amp;#39;0xc0ea3514b0ab83b2fe4f4ef96159cda8fa836ce549ef09569b901eef0723bf79&amp;#39;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sig: &amp;#39;0x879d900f04a955078ff6ae86f1d1b69b3e1265370e64bf064adaecb895c51effa3bdae7964bf8f9a6bfaef3b66306c1bc36afa5607a51b9768aa42ac2c961f02&amp;#39;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;signerPubKey&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pub: &amp;#39;0xe509fb840f6d5a69333ef68d69b86de55b9b905e45b16e3591912c097ba69938&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;After successfully verifying the signature (and the one by &lt;code&gt;trustedPubKey&lt;&#x2F;code&gt;), the implementation then generates ephemeral key pair &lt;code&gt;(s, S)&lt;&#x2F;code&gt; in Curve25519:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; s same as Case 1 and Case 2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;s = &amp;#39;0x28fa2db9f916e44fcc88370bedaf5eb3ec45632f040f4c1450c0f101e1e8bac8&amp;#39;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;S = &amp;#39;0xd2fd6fcaac231d08363e736e61edb7e7696b13a727e3d2a239415cb8dc6ee278&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The shared secret, symmetric key, and IV should be:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ss: &amp;#39;0xe0b36f56cdb63c27e933a5a67a5e97db4b566c9276a36aeee5dc6e87da118867&amp;#39;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;skey: &amp;#39;0x7c6fa749e6df13c8578dc44cb24cdf46a44cb163e1e570c2e590c720aed5783f&amp;#39;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;IV: &amp;#39;0x3c98ef6fc34b0d6e7e16bd78&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Then the return value should be &lt;code&gt;S || cipher&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;#39;0xd2fd6fcaac231d08363e736e61edb7e7696b13a727e3d2a239415cb8dc6ee2786a7e2e40efb86dc68f44f3e032bbedb1259fa820e548ac5adbf191784c568d4f642ca5b60c0b2142189dff6ee464b95c&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Then &lt;strong&gt;R3&lt;&#x2F;strong&gt; is provided as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;request&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	method&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_intakePrivateKey&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	params&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		version&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Curve25519-Chacha20-Poly1305&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		recipientPublicKey&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xc0ea3514b0ab83b2fe4f4ef96159cda8fa836ce549ef09569b901eef0723bf79&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		oob&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x313233343536&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		salt&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x6569703a2070726976617465206b657920656e63617073756c6174696f6e&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		data&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xd2fd6fcaac231d08363e736e61edb7e7696b13a727e3d2a239415cb8dc6ee2786a7e2e40efb86dc68f44f3e032bbedb1259fa820e548ac5adbf191784c568d4f642ca5b60c0b2142189dff6ee464b95c&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The return value should be &lt;code&gt;0x001d3f1ef827552ae1114027bd3ecf1f086ba0f9&lt;&#x2F;code&gt;. This matches the &lt;code&gt;account&lt;&#x2F;code&gt; parameter in &lt;strong&gt;R2&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;perfect-forward-secrecy&quot;&gt;Perfect Forward Secrecy&lt;&#x2F;h3&gt;
&lt;p&gt;PFS is achieved by using ephemeral key pairs on both sides.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;optional-signature-and-trusted-public-keys&quot;&gt;Optional Signature and Trusted Public Keys&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;R&lt;&#x2F;code&gt; could be signed so that &lt;em&gt;Sender Application&lt;&#x2F;em&gt; can verify if &lt;code&gt;R&lt;&#x2F;code&gt; could be trusted or not. This involves both signature verification and if the signer could be trusted or not. While signature verification is quite straightforward in itself, the latter should be managed with care. To facilitate this trust management issue, &lt;code&gt;signerPubKey&lt;&#x2F;code&gt; could be further signed, creating a dual-layer trust structure:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;R &amp;lt;-- signerPubKey &amp;lt;-- trustedPubKey&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This allows various strategies to manage trust. For example:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A hardware wallet vendor which takes it very seriously about the brand reputation and the fund safety for its customers, could choose to trust only its own public keys, all instances of &lt;code&gt;trustedPubKey&lt;&#x2F;code&gt;. These public keys only sign &lt;code&gt;signerPubKey&lt;&#x2F;code&gt; from selected partners.&lt;&#x2F;li&gt;
&lt;li&gt;A MPC service could publish its &lt;code&gt;signerPubKey&lt;&#x2F;code&gt; online so that &lt;em&gt;Sender Application&lt;&#x2F;em&gt; won&#x27;t verify the signature against a wrong or fake public key.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note that it is advised that a separate key pair should be used for signing on each curve.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;security-level&quot;&gt;Security Level&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;We are not considering post-quantum security. If the quantum computer becomes a materialized threat, the underlying cipher of Ethereum and other L1 chains would have been replaced, and this EIP will be outdated then (as the EC part of ECIES is also broken).&lt;&#x2F;li&gt;
&lt;li&gt;The security level shall match that of the elliptic curve used by the underlying chains. It does not make much sense to use AES-256 to safeguard a secp256k1 private key but implementations could choose freely.&lt;&#x2F;li&gt;
&lt;li&gt;That being said, a key might be used in multiple chains. So the security level shall cover the most demanding requirement and potential future developments.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;AES-128, AES-256, and ChaCha20 are provided.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;randomness&quot;&gt;Randomness&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;r&lt;&#x2F;code&gt; and &lt;code&gt;s&lt;&#x2F;code&gt; must be generated with a cryptographic secure random number generator (CSRNG).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;salt&lt;&#x2F;code&gt;  could be random bytes generated the same way as  &lt;code&gt;r&lt;&#x2F;code&gt;  or  &lt;code&gt;s&lt;&#x2F;code&gt;.  &lt;code&gt;salt&lt;&#x2F;code&gt;  could be in any length but the general suggestion is 12 or 16, which could be displayed as a QR code by the screen of some hardware wallet (so that another application could scan to read). If  &lt;code&gt;salt&lt;&#x2F;code&gt;  is not provided, this EIP uses the default value as &lt;code&gt;EIP-6051&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;out-of-band-data&quot;&gt;Out of Band Data&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;oob&lt;&#x2F;code&gt;  data is optional. When non-empty, its content is digits or an alpha-numeric string from the user. &lt;em&gt;Sender Application&lt;&#x2F;em&gt; may mandate  &lt;code&gt;oob&lt;&#x2F;code&gt;  from the user.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Role-based Access Control</title>
        <published>2022-11-15T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Zainan Victor Zhou</name><uri>https://github.com/xinbenlv</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5982/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5982-role-based-access-control/11759" />
        

        <id>https://wg-eips.ritovision.com/5982/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:5982"
            label="ERC-5982" />
        

        
        

        
        <summary type="html">An interface for role-based access control for smart contracts.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5982/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP defines an interface for role-based access control for smart contracts. Roles are defined as &lt;code&gt;byte32&lt;&#x2F;code&gt;. The interface specifies how to read, grant, create and destroy roles. It specifies the sense of role power in the format of its ability to call a given method
identified by &lt;code&gt;bytes4&lt;&#x2F;code&gt; method selector. It also specifies how metadata of roles are represented.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;There are many ways to establish access control for privileged actions. One common pattern is &quot;role-based&quot; access control, where one or more users are assigned to one or more &quot;roles,&quot; which grant access to privileged actions. This pattern is more secure and flexible than ownership-based access control since it allows for many people to be granted permissions according to the principle of least privilege.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;Interfaces of reference is described as followed:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC_ACL_CORE&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; hasRole&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; role&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; grantRole&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; role&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revokeRole&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; role&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC_ACL_GENERAL&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RoleGranted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantor&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; role&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantee&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RoleRevoked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; revoker&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; role&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; revokee&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RoleCreated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; roleGrantor&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; role&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; adminOfRole&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; desc&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uri&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RoleDestroyed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; roleDestroyer&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; role&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RolePowerSet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; rolePowerSetter&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; role&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; methods&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; grantRole&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; role&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revokeRole&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; role&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; createRole&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; role&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; adminOfRole&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; desc&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uri&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; destroyRole&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; role&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setRolePower&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; role&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; methods&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; hasRole&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; role&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; canGrantRole&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantor&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; grantee&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; canRevokeRole&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; revoker&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; revokee&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; canExecute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; executor&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; methods&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; payload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC_ACL_METADATA&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; roleName&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; roleDescription&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; roleURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ol&gt;
&lt;li&gt;Compliant contracts MUST implement &lt;code&gt;IERC_ACL_CORE&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;It is RECOMMENDED for compliant contracts to implement the optional extension &lt;code&gt;IERC_ACL_GENERAL&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Compliant contracts MAY implement the optional extension &lt;code&gt;IERC_ACL_METADATA&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;A role in a compliant smart contract is represented in the format of &lt;code&gt;bytes32&lt;&#x2F;code&gt;. It&#x27;s RECOMMENDED the value of such role is computed as a
&lt;code&gt;keccak256&lt;&#x2F;code&gt; hash of a string of the role name, in this format: &lt;code&gt;bytes32 role = keccak256(&quot;&amp;lt;role_name&amp;gt;&quot;)&lt;&#x2F;code&gt;. such as &lt;code&gt;bytes32 role = keccak256(&quot;MINTER&quot;)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Compliant contracts SHOULD implement &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; identifier.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;The names and parameters of methods in &lt;code&gt;IERC_ACL_CORE&lt;&#x2F;code&gt; are chosen to allow backward compatibility with OpenZeppelin&#x27;s implementation.&lt;&#x2F;li&gt;
&lt;li&gt;The methods in &lt;code&gt;IERC_ACL_GENERAL&lt;&#x2F;code&gt; conform to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5750&#x2F;&quot;&gt;ERC-5750&lt;&#x2F;a&gt; to allow extension.&lt;&#x2F;li&gt;
&lt;li&gt;The method of &lt;code&gt;renounceRole&lt;&#x2F;code&gt; was not adopted, consolidating with &lt;code&gt;revokeRole&lt;&#x2F;code&gt; to simplify interface.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Add Poseidon hash function precompile</title>
        <published>2022-11-15T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Abdelhamid Bakhta</name><uri>https://github.com/abdelhamidbakhta</uri>
	</author>
	
	<author>
		<name>Eli Ben Sasson</name><uri>https://github.com/Elistark</uri>
	</author>
	
	<author>
		<name>Avihu Levy</name><uri>https://github.com/avihu28</uri>
	</author>
	
	<author>
		<name>David Levit Gurevich</name><uri>https://github.com/DavidLevitGurevich</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5988/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5988-add-poseidon-hash-function-precompile/11772" />
        

        <id>https://wg-eips.ritovision.com/5988/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:5988"
            label="EIP-5988" />
        

        
        

        
        <summary type="html">Add a precompiled contract which implements the hash function used in the Poseidon cryptographic hashing algorithm</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5988/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a new precompiled contract which implements the hash function used in the Poseidon cryptographic hashing algorithm, for the purpose of allowing interoperability between the EVM and ZK &#x2F; Validity rollups, as well as introducing more flexible cryptographic hash primitives to the EVM.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5988&#x2F;.&#x2F;assets&#x2F;papers&#x2F;poseidon_paper.pdf&quot;&gt;Poseidon&lt;&#x2F;a&gt; is an arithmetic hash function that is designed to be efficient for Zero-Knowledge Proof Systems.
Ethereum adopts a rollup centric roadmap and hence must adopt facilities for L2s to be able to communicate with the EVM in an optimal manner.&lt;&#x2F;p&gt;
&lt;p&gt;ZK-Rollups have particular needs for cryptographic hash functions that can allow for efficient verification of proofs.&lt;&#x2F;p&gt;
&lt;p&gt;The Poseidon hash function is a set of permutations over a prime field, which makes it particularly well-suited for the purpose of building efficient ZK &#x2F; Validity rollups on Ethereum.&lt;&#x2F;p&gt;
&lt;p&gt;Poseidon is one of the most efficient hashing algorithms that can be used in this context.
Moreover it is compatible with all major proof systems (SNARKs, STARKs, Bulletproofs, etc...).
This makes it a good candidate for a precompile that can be used by many different ZK-Rollups.&lt;&#x2F;p&gt;
&lt;p&gt;An important point to note is that ZK rollups using Poseidon have chosen different sets of parameters, which makes it harder to build a single precompile for all of them.&lt;&#x2F;p&gt;
&lt;p&gt;However, we can still build a generic precompile that supports arbitrary parameters, and allow the ZK rollups to choose the parameters they want to use.&lt;&#x2F;p&gt;
&lt;p&gt;This is the approach that we have taken in this EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FORK_BLKNUM&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;TBD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;GAS_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;TBD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;POSEIDON_PRECOMPILE_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xA&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Here are the Poseidon parameters that the precompile will support:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter name&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;th&gt;Encoding size (in bytes)&lt;&#x2F;th&gt;&lt;th&gt;Comments&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;p&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Prime field modulus&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;security_level&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Security level measured in bits. Denoted &lt;code&gt;M&lt;&#x2F;code&gt; in the Poseidon paper&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;alpha&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Power of S-box&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;input_rate&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Size of input&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;t&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Size of the state&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;full_round&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Number of full rounds. Denoted as &lt;code&gt;R_F&lt;&#x2F;code&gt; in the Poseidon paper.&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;partial_round&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Number of partial rounds. Denoted as &lt;code&gt;R_P&lt;&#x2F;code&gt; in the Poseidon paper.&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;input&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Input to the hash function&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;input_rate&lt;&#x2F;code&gt; * 32&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The encoding of the precompile input is the following:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[32 bytes for p][2 bytes for security_level][1 byte for alpha][2 bytes for input_rate][1 byte for t][1 byte for full_round][1 byte for partial_round][input_rate * 32 bytes for input]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The precompile should compute the hash function as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5988&#x2F;.&#x2F;assets&#x2F;papers&#x2F;poseidon_paper.pdf&quot;&gt;specified in the Poseidon paper&lt;&#x2F;a&gt; and return hash output.&lt;&#x2F;p&gt;
&lt;!--### Example Usage in Solidity

The precompile can be wrapped easily in Solidity to provide a more development-friendly interface to `poseidon_hash` function.

```solidity
&#x2F;&#x2F; TODO: Add solidity example
```--&gt;
&lt;!--### Gas Costs

```
TODO: Fill gas costs section
```--&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;TODO: Add rationale&lt;&#x2F;p&gt;
&lt;p&gt;TODO: Add rationale for gas cost e.g. benchmark and computation cost estimation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;There is very little risk of breaking backwards-compatibility with this EIP, the sole issue being if someone were to build a contract relying on the address at &lt;code&gt;0xPOSEIDON_PRECOMPILE_ADDRESS&lt;&#x2F;code&gt; being empty. The likelihood of this is low, and should specific instances arise, the address could be chosen to be any arbitrary value with negligible risk of collision.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;The Poseidon reference implementation contains test vectors that can be used to test the precompile.
Those tests are available &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5988&#x2F;.&#x2F;assets&#x2F;test&#x2F;poseidon&#x2F;test_vectors.txt&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;!--## Reference Implementation

TODO: Add initial Geth implementation--&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Quoting Vitalik Buterin from &lt;code&gt;Arithmetic hash based alternatives to KZG for proto-danksharding&lt;&#x2F;code&gt; thread on EthResearch:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;The Poseidon hash function was officially introduced in 2019. Since then it has seen considerable attempts at cryptanalysis and optimization. However, it is still very young compared to popular “traditional” hash functions (eg. SHA256 and Keccak), and its general approach of accepting a high level of algebraic structure to minimize constraint count is relatively untested.
There are layer-2 systems live on the Ethereum network and other systems that already rely on these hashes for their security, and so far they have seen no bugs for this reason. Use of Poseidon in production is still somewhat “brave” compared to decades-old tried-and-tested hash functions, but this risk should be weighed against the risks of proposed alternatives (eg. pairings with trusted setups) and the risks associated with centralization that might come as a result of dependence on powerful provers that can prove SHA256.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;It is true that arithmetic hash functions are relatively untested compared to traditional hash functions.
However, Poseidon has been thoroughly tested and is considered secure by multiple independent research groups and layers 2 systems are already using it in production (StarkWare, Polygon, Loopring) and also by other projects (e.g. Filecoin).&lt;&#x2F;p&gt;
&lt;p&gt;Moreover, the impact of a potential vulnerability in the Poseidon hash function would be limited to the rollups that use it.&lt;&#x2F;p&gt;
&lt;p&gt;We can see the same rationale for the KZG ceremony in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt;, arguing that the risk of a vulnerability in the KZG ceremony is limited to the rollups that use it.&lt;&#x2F;p&gt;
&lt;p&gt;List of projects (non exhaustive) using Poseidon:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;StarkWare plans to use Poseidon as the main hash function for StarkNet, and to add a Poseidon built-in in Cairo.&lt;&#x2F;li&gt;
&lt;li&gt;Filecoin employs POSEIDON for Merkle tree proofs with different arities and for two-value commitments.&lt;&#x2F;li&gt;
&lt;li&gt;Dusk Network uses POSEIDON to build a Zcash-like protocol for securities trading.11 It also uses POSEIDON
for encryption as described above.&lt;&#x2F;li&gt;
&lt;li&gt;Sovrin uses POSEIDON for Merkle-tree based revocation.&lt;&#x2F;li&gt;
&lt;li&gt;Loopring uses POSEIDON for private trading on Ethereum.&lt;&#x2F;li&gt;
&lt;li&gt;Polygon uses Poseidon for Hermez ZK-EVM.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In terms of security, the choice of parameters is important.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;security-of-the-poseidon-parameters&quot;&gt;Security of the Poseidon parameters&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;choice-of-the-mds-matrix&quot;&gt;Choice of the MDS matrix&lt;&#x2F;h4&gt;
&lt;p&gt;The MDS matrix is a square matrix of size &lt;code&gt;t&lt;&#x2F;code&gt; * &lt;code&gt;t&lt;&#x2F;code&gt; that is used to mix the state.&lt;&#x2F;p&gt;
&lt;p&gt;This matrix is used during the &lt;code&gt;MixLayer&lt;&#x2F;code&gt; phase of the Poseidon hash function.&lt;&#x2F;p&gt;
&lt;p&gt;The matrix must be chosen s.t. no subspace trail with inactive&#x2F;active S-boxes can be set up for more than &lt;code&gt;t -1&lt;&#x2F;code&gt; rounds.&lt;&#x2F;p&gt;
&lt;p&gt;There are some efficient algorithms to detect weak MDS matrices.&lt;&#x2F;p&gt;
&lt;p&gt;Those algorithms are described in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5988&#x2F;.&#x2F;assets&#x2F;papers&#x2F;proving_resistance_linear_layer.pdf&quot;&gt;Proving Resistance Against Infinitely Long Subspace Trails: How to Choose the Linear Layer&lt;&#x2F;a&gt; paper.&lt;&#x2F;p&gt;
&lt;p&gt;The process of the generation of the matrix should look like this, as recommended in the Poseidon paper:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Generate a random matrix.&lt;&#x2F;li&gt;
&lt;li&gt;Check if the matrix is secure using Algorithm 1, Algorithm 2, and Algorithm 3 provided &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5988&#x2F;.&#x2F;assets&#x2F;papers&#x2F;proving_resistance_linear_layer.pdf&quot;&gt;Proving Resistance Against Infinitely Long Subspace Trails: How to Choose the Linear Layer&lt;&#x2F;a&gt; paper.&lt;&#x2F;li&gt;
&lt;li&gt;If the matrix is not secure, go back to step 1.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;papers-and-research-related-to-poseidon-security&quot;&gt;Papers and research related to Poseidon security&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5988&#x2F;.&#x2F;assets&#x2F;papers&#x2F;poseidon_paper.pdf&quot;&gt;Poseidon: A New Hash Function for Zero-Knowledge Proof Systems&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5988&#x2F;.&#x2F;assets&#x2F;papers&#x2F;security_poseidon_non_binary_differential_attacks.pdf&quot;&gt;Security of the Poseidon Hash Function Against Non-Binary Differential and Linear Attacks&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5988&#x2F;.&#x2F;assets&#x2F;papers&#x2F;report_security_stark_friendly_hash.pdf&quot;&gt;Report on the Security of STARK-friendly Hash Functions&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5988&#x2F;.&#x2F;assets&#x2F;papers&#x2F;practical_algebraic_attacks.pdf&quot;&gt;Practical Algebraic Attacks against some Arithmetization-oriented Hash Functions&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Parent-Governed Nestable Non-Fungible Tokens</title>
        <published>2022-11-15T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Bruno Škvorc</name><uri>https://github.com/Swader</uri>
	</author>
	
	<author>
		<name>Cicada</name><uri>https://github.com/CicadaNCR</uri>
	</author>
	
	<author>
		<name>Steven Pineda</name><uri>https://github.com/steven2308</uri>
	</author>
	
	<author>
		<name>Stevan Bogosavljevic</name><uri>https://github.com/stevyhacker</uri>
	</author>
	
	<author>
		<name>Jan Turk</name><uri>https://github.com/ThunderDeliverer</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6059/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6059-parent-governed-nestable-non-fungible-tokens/11914" />
        

        <id>https://wg-eips.ritovision.com/6059/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:6059"
            label="ERC-6059" />
        

        
        

        
        <summary type="html">An interface for Nestable Non-Fungible Tokens with emphasis on parent token&#x27;s control over the relationship.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6059/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The Parent-Governed Nestable NFT standard extends &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; by allowing for a new inter-NFT relationship and interaction.&lt;&#x2F;p&gt;
&lt;p&gt;At its core, the idea behind the proposal is simple: the owner of an NFT does not have to be an Externally Owned Account (EOA) or a smart contract, it can also be an NFT.&lt;&#x2F;p&gt;
&lt;p&gt;The process of nesting an NFT into another is functionally identical to sending it to another user. The process of sending a token out of another one involves issuing a transaction from the account owning the parent token.&lt;&#x2F;p&gt;
&lt;p&gt;An NFT can be owned by a single other NFT, but can in turn have a number of NFTs that it owns. This proposal establishes the framework for the parent-child relationships of NFTs. A parent token is the one that owns another token. A child token is a token that is owned by another token. A token can be both a parent and child at the same time. Child tokens of a given token can be fully managed by the parent token&#x27;s owner, but can be proposed by anyone.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6059&#x2F;.&#x2F;assets&#x2F;img&#x2F;eip-6059-nestable-tokens.png&quot; alt=&quot;Nestable tokens&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The graph illustrates how a child token can also be a parent token, but both are still administered by the root parent token&#x27;s owner.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;With NFTs being a widespread form of tokens in the Ethereum ecosystem and being used for a variety of use cases, it is time to standardize additional utility for them. Having the ability for tokens to own other tokens allows for greater utility, usability and forward compatibility.&lt;&#x2F;p&gt;
&lt;p&gt;In the four years since &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; was published, the need for additional functionality has resulted in countless extensions. This ERC improves upon ERC-721 in the following areas:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6059&#x2F;#bundling&quot;&gt;Bundling&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6059&#x2F;#collecting&quot;&gt;Collecting&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6059&#x2F;#membership&quot;&gt;Membership&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6059&#x2F;#delegation&quot;&gt;Delegation&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;bundling&quot;&gt;Bundling&lt;&#x2F;h3&gt;
&lt;p&gt;One of the most frequent uses of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; is to disseminate the multimedia content that is tied to the tokens. In the event that someone wants to offer a bundle of NFTs from various collections, there is currently no easy way of bundling all of these together and handle their sale as a single transaction. This proposal introduces a standardized way of doing so. Nesting all of the tokens into a simple bundle and selling that bundle would transfer the control of all of the tokens to the buyer in a single transaction.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;collecting&quot;&gt;Collecting&lt;&#x2F;h3&gt;
&lt;p&gt;A lot of NFT consumers collect them based on countless criteria. Some aim for utility of the tokens, some for the uniqueness, some for the visual appeal, etc. There is no standardized way to group the NFTs tied to a specific account. By nesting NFTs based on their owner&#x27;s preference, this proposal introduces the ability to do it. The root parent token could represent a certain group of tokens and all of the children nested into it would belong to it.&lt;&#x2F;p&gt;
&lt;p&gt;The rise of soulbound, non-transferable, tokens, introduces another need for this proposal. Having a token with multiple soulbound traits (child tokens), allows for numerous use cases. One concrete example of this can be drawn from supply chains use case. A shipping container, represented by an NFT with its own traits, could have multiple child tokens denoting each leg of its journey.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;membership&quot;&gt;Membership&lt;&#x2F;h3&gt;
&lt;p&gt;A common utility attached to NFTs is a membership to a Decentralised Autonomous Organization (DAO) or to some other closed-access group. Some of these organizations and groups occasionally mint NFTs to the current holders of the membership NFTs. With the ability to nest mint a token into a token, such minting could be simplified, by simply minting the bonus NFT directly into the membership one.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;delegation&quot;&gt;Delegation&lt;&#x2F;h3&gt;
&lt;p&gt;One of the core features of DAOs is voting and there are various approaches to it. One such mechanic is using fungible voting tokens where members can delegate their votes by sending these tokens to another member. Using this proposal, delegated voting could be handled by nesting your voting NFT into the one you are delegating your votes to and transferring it when the member no longer wishes to delegate their votes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; EIP-6059 Parent-Governed Nestable Non-Fungible Tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-6059&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0x42b0e56f.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.16&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6059&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is ERC165 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The core struct of ownership.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The `DirectOwner` struct is used to store information of the next immediate owner, be it the parent token,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * an `ERC721Receiver` contract or an externally owned account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If the token is not owned by an NFT, the `tokenId` MUST equal `0`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the parent token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ownerAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the owner of the token. If the owner is another token, then the address MUST be&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  the one of the parent token&amp;#39;s collection smart contract. If the owner is externally owned account, the address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  MUST be the address of this account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DirectOwner&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; ownerAddress&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to notify listeners that the token is being transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when `tokenId` token is transferred from `from` to `to`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the previous immediate owner, which is a smart contract if the token was nested.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the new immediate owner, which is a smart contract if the token is being nested.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; fromTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the previous parent token. If the token was not nested before, the value MUST be `0`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; toTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the new parent token. If the token is not being nested, the value MUST be `0`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token being transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NestTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; fromTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; toTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to notify listeners that a new token has been added to a given token&amp;#39;s pending children array.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a child NFT is added to a token&amp;#39;s pending array.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token that received a new pending child token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; childIndex&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Index of the proposed child token in the parent token&amp;#39;s pending children array&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; childAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the proposed child token&amp;#39;s collection smart contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; childId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the child token in the child token&amp;#39;s collection smart contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ChildProposed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; childIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; childAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; childId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to notify listeners that a new child token was accepted by the parent token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a parent token accepts a token from its pending array, migrating it to the active array.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token that accepted a new child token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; childIndex&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Index of the newly accepted child token in the parent token&amp;#39;s active children array&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; childAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the child token&amp;#39;s collection smart contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; childId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the child token in the child token&amp;#39;s collection smart contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ChildAccepted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; childIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; childAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; childId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to notify listeners that all pending child tokens of a given token have been rejected.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a token removes all a child tokens from its pending array.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token that rejected all of the pending children&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AllChildrenRejected&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to notify listeners a child token has been transferred from parent token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a token transfers a child from itself, transferring ownership.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token that transferred a child token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; childIndex&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Index of a child in the array from which it is being transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; childAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the child token&amp;#39;s collection smart contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; childId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the child token in the child token&amp;#39;s collection smart contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; fromPending&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A boolean value signifying whether the token was in the pending child tokens array (`true`) or&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  in the active child tokens array (`false`)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ChildTransferred&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; childIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; childAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; childId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; fromPending&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The core child token struct, holding the information about the child tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the child token in the child token&amp;#39;s collection smart contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contractAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the child token&amp;#39;s smart contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Child&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; contractAddress&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to retrieve the *root* owner of a given token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The *root* owner of the token is the top-level owner in the hierarchy which is not an NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If the token is owned by another NFT, it MUST recursively look up the parent&amp;#39;s root owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token for which the *root* owner has been retrieved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The *root* owner of the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to retrieve the immediate owner of the given token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If the immediate owner is another token, the address returned, MUST be the one of the parent token&amp;#39;s&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  collection smart contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token for which the direct owner is being retrieved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the given token&amp;#39;s owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ID of the parent token. MUST be `0` if the owner is not an NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The boolean value signifying whether the owner is an NFT or not&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; directOwnerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            uint256&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bool&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to burn a given token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; When a token is burned, all of its child tokens are recursively burned as well.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; When specifying the maximum recursive burns, the execution MUST be reverted if there are more children to be&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  burned.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Setting the `maxRecursiveBurn` value to 0 SHOULD only attempt to burn the specified token and MUST revert if&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  there are any child tokens present.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token to burn&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; maxRecursiveBurns&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Maximum number of tokens to recursively burn&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Number of recursively burned children&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; burn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; maxRecursiveBurns&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to add a child token to a given parent token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This adds the child token into the given parent token&amp;#39;s pending child tokens array.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The destination token MUST NOT be a child token of the token being transferred or one of its downstream&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  child tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This method MUST NOT be called directly. It MUST only be called from an instance of `IERC6059` as part of a &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        `nestTransfer` or `transferChild` to an NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  - `directOwnerOf` on the child contract MUST resolve to the called contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  - the pending array of the parent contract MUST not be full.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; parentId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the parent token to receive the new child token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; childId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the new proposed child token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addChild&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; parentId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; childId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to accept a pending child token for a given parent token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This moves the child token from parent token&amp;#39;s pending child tokens array into the active child tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  array.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; parentId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the parent token for which the child token is being accepted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; childIndex&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Index of the child token to accept in the pending children array of a given token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; childAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the collection smart contract of the child token expected to be at the specified&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  index&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; childId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the child token expected to be located at the specified index&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; acceptChild&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; parentId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; childIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; childAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; childId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to reject all pending children of a given parent token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Removes the children from the pending array mapping.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The children&amp;#39;s ownership structures are not updated.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - `parentId` MUST exist&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; parentId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the parent token for which to reject all of the pending tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; maxRejections&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Maximum number of expected children to reject, used to prevent from&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  rejecting children which arrive just before this operation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; rejectAllChildren&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; parentId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; maxRejections&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to transfer a child token from a given parent token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST remove the child from the parent&amp;#39;s active or pending children.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; When transferring a child token, the owner of the token MUST be set to `to`, or not updated in the event of `to`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  being the `0x0` address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the parent token from which the child token is being transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address to which to transfer the token to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; destinationId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token to receive this child token (MUST be 0 if the destination is not a token)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; childIndex&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Index of a token we are transferring, in the array it belongs to (can be either active array or&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  pending array)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; childAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the child token&amp;#39;s collection smart contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; childId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the child token in its own collection smart contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; isPending&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A boolean value indicating whether the child token being transferred is in the pending array of the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  parent token (`true`) or in the active array (`false`)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Additional data with no specified format, sent in call to `to`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferChild&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; destinationId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; childIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; childAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; childId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; isPending&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to retrieve the active child tokens of a given parent token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns array of Child structs existing for parent token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The Child struct consists of the following values:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      tokenId,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      contractAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; parentId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the parent token for which to retrieve the active child tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;[] An array of Child structs containing the parent token&amp;#39;s active child tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; childrenOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; parentId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Child&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to retrieve the pending child tokens of a given parent token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns array of pending Child structs existing for given parent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The Child struct consists of the following values:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      tokenId,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      contractAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; parentId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the parent token for which to retrieve the pending child tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;[] An array of Child structs containing the parent token&amp;#39;s pending child tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; pendingChildrenOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; parentId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Child&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to retrieve a specific active child token for a given parent token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns a single Child struct locating at `index` of parent token&amp;#39;s active child tokens array.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The Child struct consists of the following values:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      tokenId,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      contractAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; parentId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the parent token for which the child is being retrieved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; index&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Index of the child token in the parent token&amp;#39;s active child tokens array&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A Child struct containing data about the specified child&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; childOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; parentId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Child&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to retrieve a specific pending child token from a given parent token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns a single Child struct locating at `index` of parent token&amp;#39;s active child tokens array.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The Child struct consists of the following values:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      tokenId,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      contractAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; parentId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the parent token for which the pending child token is being retrieved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; index&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Index of the child token in the parent token&amp;#39;s pending child tokens array&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A Child struct containing data about the specified child&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; pendingChildOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; parentId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Child&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to transfer the token into another token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The destination token MUST NOT be a child token of the token being transferred or one of its downstream&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  child tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the direct owner of the token to be transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the receiving token&amp;#39;s collection smart contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token being transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; destinationId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token to receive the token being transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; nestTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; destinationId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;ID MUST never be a &lt;code&gt;0&lt;&#x2F;code&gt; value, as this proposal uses &lt;code&gt;0&lt;&#x2F;code&gt; values do signify that the token&#x2F;destination is not an NFT.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Designing the proposal, we considered the following questions:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;How to name the proposal?&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
In an effort to provide as much information about the proposal we identified the most important aspect of the proposal; the parent centered control over nesting. The child token&#x27;s role is only to be able to be &lt;code&gt;Nestable&lt;&#x2F;code&gt; and support a token owning it. This is how we landed on the &lt;code&gt;Parent-Centered&lt;&#x2F;code&gt; part of the title.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Why is automatically accepting a child using &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; permit-style signatures not a part of this proposal?&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
For consistency. This proposal extends ERC-721 which already uses 1 transaction for approving operations with tokens. It would be inconsistent to have this and also support signing messages for operations with assets.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Why use indexes?&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
To reduce the gas consumption. If the token ID was used to find which token to accept or reject, iteration over arrays would be required and the cost of the operation would depend on the size of the active or pending children arrays. With the index, the cost is fixed. Lists of active and pending children per token need to be maintained, since methods to get them are part of the proposed interface.&lt;br &#x2F;&gt;
To avoid race conditions in which the index of a token changes, the expected token ID as well as the expected token&#x27;s collection smart contract is included in operations requiring token index, to verify that the token being accessed using the index is the expected one.&lt;br &#x2F;&gt;
Implementation that would internally keep track of indices using mapping was attempted. The minimum cost of accepting a child token was increased by over 20% and the cost of minting has increased by over 15%. We concluded that it is not necessary for this proposal and can be implemented as an extension for use cases willing to accept the increased transaction cost this incurs. In the sample implementation provided, there are several hooks which make this possible.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Why is the pending children array limited instead of supporting pagination?&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
The pending child tokens array is not meant to be a buffer to collect the tokens that the root owner of the parent token wants to keep, but not enough to promote them to active children. It is meant to be an easily traversable list of child token candidates and should be regularly maintained; by either accepting or rejecting proposed child tokens. There is also no need for the pending child tokens array to be unbounded, because active child tokens array is.&lt;br &#x2F;&gt;
Another benefit of having bounded child tokens array is to guard against spam and griefing. As minting malicious or spam tokens could be relatively easy and low-cost, the bounded pending array assures that all of the tokens in it are easy to identify and that legitimate tokens are not lost in a flood of spam tokens, if one occurs.&lt;br &#x2F;&gt;
A consideration tied to this issue was also how to make sure, that a legitimate token is not accidentally rejected when clearing the pending child tokens array. We added the maximum pending children to reject argument to the clear pending child tokens array call. This assures that only the intended number of pending child tokens is rejected and if a new token is added to the pending child tokens array during the course of preparing such call and executing it, the clearing of this array SHOULD result in a reverted transaction.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Should we allow tokens to be nested into one of its children?&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
The proposal enforces that a parent token can&#x27;t be nested into one of its child token, or downstream child tokens for that matter. A parent token and its children are all managed by the parent token&#x27;s root owner. This means that if a token would be nested into one of its children, this would create the ownership loop and none of the tokens within the loop could be managed anymore.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Why is there not a &quot;safe&quot; nest transfer method?&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
&lt;code&gt;nestTransfer&lt;&#x2F;code&gt; is always &quot;safe&quot; since it MUST check for &lt;code&gt;IERC6059&lt;&#x2F;code&gt; compatibility on the destination.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;How does this proposal differ from the other proposals trying to address a similar problem?&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
This interface allows for tokens to both be sent to and receive other tokens. The propose-accept and parent governed patterns allow for a more secure use. The backward compatibility is only added for ERC-721, allowing for a simpler interface. The proposal also allows for different collections to inter-operate, meaning that nesting is not locked to a single smart contract, but can be executed between completely separate NFT collections.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;propose-commit-pattern-for-child-token-management&quot;&gt;Propose-Commit pattern for child token management&lt;&#x2F;h3&gt;
&lt;p&gt;Adding child tokens to a parent token MUST be done in the form of propose-commit pattern to allow for limited mutability by a 3rd party. When adding a child token to a parent token, it is first placed in a &lt;em&gt;&quot;Pending&quot;&lt;&#x2F;em&gt; array, and MUST be migrated to the &lt;em&gt;&quot;Active&quot;&lt;&#x2F;em&gt; array by the parent token&#x27;s root owner. The &lt;em&gt;&quot;Pending&quot;&lt;&#x2F;em&gt; child tokens array SHOULD be limited to 128 slots to prevent spam and griefing.&lt;&#x2F;p&gt;
&lt;p&gt;The limitation that only the root owner can accept the child tokens also introduces a trust inherent to the proposal. This ensures that the root owner of the token has full control over the token. No one can force the user to accept a child if they don&#x27;t want to.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parent-governed-pattern&quot;&gt;Parent Governed pattern&lt;&#x2F;h3&gt;
&lt;p&gt;The parent NFT of a nested token and the parent&#x27;s root owner are in all aspects the true owners of it. Once you send a token to another one you give up ownership.&lt;&#x2F;p&gt;
&lt;p&gt;We continue to use ERC-721&#x27;s &lt;code&gt;ownerOf&lt;&#x2F;code&gt; functionality which will now recursively look up through parents until it finds an address which is not an NFT, this is referred to as the &lt;em&gt;root owner&lt;&#x2F;em&gt;. Additionally we provide the &lt;code&gt;directOwnerOf&lt;&#x2F;code&gt; which returns the most immediate owner of a token using 3 values: the owner address, the tokenId which MUST be 0 if the direct owner is not an NFT, and a flag indicating whether or not the parent is an NFT.&lt;&#x2F;p&gt;
&lt;p&gt;The root owner or an approved party MUST be able do the following operations on children: &lt;code&gt;acceptChild&lt;&#x2F;code&gt;, &lt;code&gt;rejectAllChildren&lt;&#x2F;code&gt; and &lt;code&gt;transferChild&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The root owner or an approved party MUST also be allowed to do these operations only when token is not owned by an NFT: &lt;code&gt;transferFrom&lt;&#x2F;code&gt;, &lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt;, &lt;code&gt;nestTransferFrom&lt;&#x2F;code&gt;, &lt;code&gt;burn&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;If the token is owned by an NFT, only the parent NFT itself MUST be allowed to execute the operations listed above. Transfers MUST be done from the parent token, using &lt;code&gt;transferChild&lt;&#x2F;code&gt;, this method in turn SHOULD call &lt;code&gt;nestTransferFrom&lt;&#x2F;code&gt; or &lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt; in the child token&#x27;s smart contract, according to whether the destination is an NFT or not. For burning, tokens must first be transferred to an EOA and then burned.&lt;&#x2F;p&gt;
&lt;p&gt;We add this restriction to prevent inconsistencies on parent contracts, since only the &lt;code&gt;transferChild&lt;&#x2F;code&gt; method takes care of removing the child from the parent when it is being transferred out of it.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;child-token-management&quot;&gt;Child token management&lt;&#x2F;h3&gt;
&lt;p&gt;This proposal introduces a number of child token management functions. In addition to the permissioned migration from &lt;em&gt;&quot;Pending&quot;&lt;&#x2F;em&gt; to &lt;em&gt;&quot;Active&quot;&lt;&#x2F;em&gt; child tokens array, the main token management function from this proposal is the &lt;code&gt;tranferChild&lt;&#x2F;code&gt; function. The following state transitions of a child token are available with it:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Reject child token&lt;&#x2F;li&gt;
&lt;li&gt;Abandon child token&lt;&#x2F;li&gt;
&lt;li&gt;Unnest child token&lt;&#x2F;li&gt;
&lt;li&gt;Transfer the child token to an EOA or an &lt;code&gt;ERC721Receiver&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Transfer the child token into a new parent token&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;To better understand how these state transitions are achieved, we have to look at the available parameters passed to &lt;code&gt;transferChild&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferChild&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; destinationId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; childIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; childAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; childId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; isPending&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Based on the desired state transitions, the values of these parameters have to be set accordingly (any parameters not set in the following examples depend on the child token being managed):&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Reject child token&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6059&#x2F;.&#x2F;assets&#x2F;img&#x2F;eip-6059-reject-child.png&quot; alt=&quot;Reject child token&quot; &#x2F;&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Abandon child token&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6059&#x2F;.&#x2F;assets&#x2F;img&#x2F;eip-6059-abandon-child.png&quot; alt=&quot;Abandon child token&quot; &#x2F;&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Unnest child token&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6059&#x2F;.&#x2F;assets&#x2F;img&#x2F;eip-6059-unnest-child.png&quot; alt=&quot;Unnest child token&quot; &#x2F;&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Transfer the child token to an EOA or an &lt;code&gt;ERC721Receiver&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6059&#x2F;.&#x2F;assets&#x2F;img&#x2F;eip-6059-transfer-child-to-eoa.png&quot; alt=&quot;Transfer child token to EOA&quot; &#x2F;&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Transfer the child token into a new parent token&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6059&#x2F;.&#x2F;assets&#x2F;img&#x2F;eip-6059-transfer-child-to-token.png&quot; alt=&quot;Transfer child token to parent token&quot; &#x2F;&gt;&lt;br &#x2F;&gt;
This state change places the token in the pending array of the new parent token. The child token still needs to be accepted by the new parent token&#x27;s root owner in order to be placed into the active array of that token.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The Nestable token standard has been made compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; in order to take advantage of the robust tooling available for implementations of ERC-721 and to ensure compatibility with existing ERC-721 infrastructure.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Tests are included in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6059&#x2F;.&#x2F;assets&#x2F;test&#x2F;nestable.ts&quot;&gt;&lt;code&gt;nestable.ts&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;To run them in terminal, you can use the following commands:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cd ..&#x2F;assets&#x2F;eip-6059&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;npm install&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;npx hardhat test&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6059&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;NestableToken.sol&quot;&gt;&lt;code&gt;NestableToken.sol&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The same security considerations as with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; apply: hidden logic may be present in any of the functions, including burn, add child, accept child, and more.&lt;&#x2F;p&gt;
&lt;p&gt;Since the current owner of the token is allowed to manage the token, there is a possibility that after the parent token is listed for sale, the seller might remove a child token just before before the sale and thus the buyer would not receive the expected child token. This is a risk that is inherent to the design of this standard. Marketplaces should take this into account and provide a way to verify the expected child tokens are present when the parent token is being sold or to guard against such a malicious behaviour in another way.&lt;&#x2F;p&gt;
&lt;p&gt;Caution is advised when dealing with non-audited contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Smart Contract Event Hooks</title>
        <published>2022-11-09T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Simon Brown</name><uri>https://github.com/orbmis</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5902/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/idea-smart-contract-event-hooks-standard/11503" />
        

        <id>https://wg-eips.ritovision.com/5902/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:5902"
            label="ERC-5902" />
        

        
        

        
        <summary type="html">Format that allows contracts to semi-autonoumously respond to events emitted by other contracts</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5902/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes a standard for creating &quot;hooks&quot; that allow a smart contract function to be called automatically in response to a trigger fired by another contract, by using a public relayer network as a messaging bus.&lt;&#x2F;p&gt;
&lt;p&gt;While there are many similar solutions in existence already, this proposal describes a simple yet powerful primitive that can be employed by many applications in an open, permissionless and decentralized manner.&lt;&#x2F;p&gt;
&lt;p&gt;It relies on two interfaces, one for a publisher contract and one for a subscriber contract.  The publisher contract emits events that are picked up by &quot;relayers&quot;, who are independent entities that subscribe to &quot;hook&quot; events on publisher contracts, and call a function on the respective subscriber contracts, whenever a hook event is fired by the publisher contracts.  Whenever a relayer calls the respective subscriber&#x27;s contract with the details of the hook event emitted by the publisher contract, they are paid a fee by the subscriber.  Both the publisher and subscriber contracts are registered in a central registry smart contract that relayers can use to discover hooks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;There exists a number of use cases that require some off-chain party to monitor the chain and respond to on-chain events by broadcasting a transaction.  Such cases usually require some off-chain process to run alongside an Ethereum node in order to subscribe to events emitted by smart contract, and then execute some logic in response and subsequently broadcast a transaction to the network.  This requires an Ethereum node and an open websocket connection to some long-running process that may only be used infrequently, resulting in a sub-optimal use of resources.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal would allow for a smart contract to contain the logic it needs to respond to events without having to store that logic in some off-chain process.  The smart contract can subscribe to events fired by other smart contracts and would only execute the required logic when it is needed. This method would suit any contract logic that does not require off-chain computation, but usually requires an off-chain process to monitor the chain state. With this approach, subscribers do not need their own dedicated off-chain processes for monitoring and responding to contract events.  Instead, a single incentivized relayer can subscribe to many different events on behalf of multiple different subscriber contracts.&lt;&#x2F;p&gt;
&lt;p&gt;Examples of use cases that would benefit from this scheme include:&lt;&#x2F;p&gt;
&lt;h3 id=&quot;collateralised-lending-protocols&quot;&gt;Collateralised Lending Protocols&lt;&#x2F;h3&gt;
&lt;p&gt;Collateralised lending protocols or stablecoins can emit events whenever they receive price oracle updates, which would allow borrowers to automatically &quot;top-up&quot; their open positions to avoid liquidation.&lt;&#x2F;p&gt;
&lt;p&gt;For example, Maker uses the &quot;medianizer&quot; smart contract which maintains a whitelist of price feed contracts which are allowed to post price updates. Every time a new price update is received, the median of all feed prices is re-computed and the medianized value is updated.  In this case, the medianizer smart contract could fire a hook event that would allow subscriber contracts to decide to re-collateralize their CDPs.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;automated-market-makers&quot;&gt;Automated Market Makers&lt;&#x2F;h3&gt;
&lt;p&gt;AMM liquidity pools could fire a hook event whenever liquidity is added or removed.  This could allow a subscriber smart contracts to add or remove liquidity once the total pool liquidity reaches a certain point.&lt;&#x2F;p&gt;
&lt;p&gt;AMMs can fire a hook whenever there is a trade within a trading pair, emitting the time-weighted-price-oracle update via an hook event.  Subscribers can use this to create an automated Limit-Order-Book type contract to buy&#x2F;sell tokens once an asset&#x27;s spot price breaches a pre-specified threshold.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;dao-voting&quot;&gt;DAO Voting&lt;&#x2F;h3&gt;
&lt;p&gt;Hook events can be emitted by a DAO governance contract to signal that a proposal has been published, voted on, carried or vetoed, and would allow any subscriber contract to automatically respond accordingly. For example, to execute some smart contract function whenever a specific proposal has passed, such as an approval for payment of funds.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;scheduled-function-calls&quot;&gt;Scheduled Function Calls&lt;&#x2F;h3&gt;
&lt;p&gt;A scheduler service can be created whereby a subscriber can register for a scheduled funtion call, this could be done using unix cron format and the service can fire events from a smart contract on separate threads.  Subscriber contracts can subscriber to the respective threads in order to subscribe to certain schedules (e.g. daily, weekly, hourly etc.), and could even register customer cron schedules.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;recurring-payments&quot;&gt;Recurring Payments&lt;&#x2F;h3&gt;
&lt;p&gt;A service provider can fire Hook events that will allow subscriber contracts to automatically pay their service fees on a regular schedule.  Once the subscriber contracts receive a hook event, they can call a function on the service provider&#x27;s contract to transfer funds due.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;coordination-via-delegation&quot;&gt;Coordination via Delegation&lt;&#x2F;h3&gt;
&lt;p&gt;Hook event payloads can contain any arbitrary data, this means you can use things like the Delegatable framework to sign off-chain delegations which can faciliate a chain of authorized entities to publish valid Hook events.  You can also use things like BLS threshold signatures, to facilitate multiple off-chain publishers to authorize the firing of a Hook.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;registering-a-publisher&quot;&gt;Registering a Publisher&lt;&#x2F;h3&gt;
&lt;p&gt;Both the publisher and subscriber contracts &lt;strong&gt;MUST&lt;&#x2F;strong&gt; register in a specific register contract, similarly to how smart contracts register an interface in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1820&#x2F;&quot;&gt;ERC-1820&lt;&#x2F;a&gt; contract.  The registry contract &lt;strong&gt;MUST&lt;&#x2F;strong&gt; must use a deterministic deployment mechanism, i.e. using a factory contract and a specific salt.&lt;&#x2F;p&gt;
&lt;p&gt;To register a publisher contract&#x27;s hook, the &lt;code&gt;registerHook&lt;&#x2F;code&gt; function &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be called on the registry contract.  The parameters that need to be supplied are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;(address) The publisher contract address&lt;&#x2F;li&gt;
&lt;li&gt;(uint256) The thread id that the hooks events will reference (a single contract can fire hook events with any number of threads, subscribers can choose which threads to subscribe to)&lt;&#x2F;li&gt;
&lt;li&gt;(bytes) The public key associated with the hook events (optional)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;When the &lt;code&gt;registerHook&lt;&#x2F;code&gt; function is called on the registry contract, the registry contract &lt;strong&gt;MUST&lt;&#x2F;strong&gt; make a downstream call to the publisher contract address, by calling the publisher contract&#x27;s &lt;code&gt;verifyEventHookRegistration&lt;&#x2F;code&gt; function, with the same arguments as passed to the &lt;code&gt;registerHook&lt;&#x2F;code&gt; function on the registry contract.  The &lt;code&gt;verifyEventHookRegistration&lt;&#x2F;code&gt; function in the publisher contract &lt;strong&gt;MUST&lt;&#x2F;strong&gt; return true in order to indicate that the contract will allow itself to be added to the registry as a publisher.  The registry contract &lt;strong&gt;MUST&lt;&#x2F;strong&gt; emit a &lt;code&gt;HookRegistered&lt;&#x2F;code&gt; event to indicate that a new publisher contract has been added.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;updating-a-hook&quot;&gt;Updating a Hook&lt;&#x2F;h3&gt;
&lt;p&gt;Publishers may want to update the details associated with a Hook event, or indeed remove support for a Hook event completely.  The registry contract &lt;strong&gt;MUST&lt;&#x2F;strong&gt; implement the &lt;code&gt;updatePublisher&lt;&#x2F;code&gt; function to allow for an existing publisher contract to be updated in the registry.  The registry contract &lt;strong&gt;MUST&lt;&#x2F;strong&gt; emit a &lt;code&gt;PublisherUpdated&lt;&#x2F;code&gt; event to indicate that the publisher contract was updated.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;removing-a-hook&quot;&gt;Removing a Hook&lt;&#x2F;h3&gt;
&lt;p&gt;To remove a previously registered Hook, the function &lt;code&gt;removeHook&lt;&#x2F;code&gt; function must be called on the Registry contract, with the same parameters as the &lt;code&gt;updateHook&lt;&#x2F;code&gt; function. The registry contract &lt;strong&gt;MUST&lt;&#x2F;strong&gt; emit a &lt;code&gt;HookRemoved&lt;&#x2F;code&gt; event with the same parameters as passed to the &#x27;removeHook&#x27; function and the &lt;code&gt;msg.sender&lt;&#x2F;code&gt; value.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;registering-a-subscriber&quot;&gt;Registering a Subscriber&lt;&#x2F;h3&gt;
&lt;p&gt;To register a subscriber to a hook, the &lt;code&gt;registerSubscriber&lt;&#x2F;code&gt; function &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be called on the registry contract with the following parameters:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;(address) The publisher contract address&lt;&#x2F;li&gt;
&lt;li&gt;(bytes32) The subscriber contract address&lt;&#x2F;li&gt;
&lt;li&gt;(uint256) The thread id to subscribe to&lt;&#x2F;li&gt;
&lt;li&gt;(uint256) The fee that the subscriber is willing to pay to get updates&lt;&#x2F;li&gt;
&lt;li&gt;(uint256) The maximum gas that the subscriber will allow for updates, to prevent griefing attacks, or 0 to indicate no maximum&lt;&#x2F;li&gt;
&lt;li&gt;(uint256) The maximum gas price that the subscriber is willing to repay the relayer on top of the fee, or 0 to indicate no rebates&lt;&#x2F;li&gt;
&lt;li&gt;(uint256) The chain id that the subscriber wants updates from&lt;&#x2F;li&gt;
&lt;li&gt;(address) The address of the token that the fee will be paid in or 0x0 for the chain&#x27;s native asset (e.g. ETH, MATIC etc.)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The subscriber contract &lt;strong&gt;MAY&lt;&#x2F;strong&gt; implement gas refunds on top of the fixed fee per update. Where a subscriber chooses to do this, then they &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; specify the &lt;code&gt;maximum gas&lt;&#x2F;code&gt; and &lt;code&gt;maximum gas price&lt;&#x2F;code&gt; parameters in order to protect themselves from griefing attacks. This is so that a malicious or careless relay doesn&#x27;t set an exorbitantly high gas price and ends up draining the subscriber contracts. Subscriber contracts can otherwise choose to set a fee that is estimated to be sufficiently high to cover gas fees.&lt;&#x2F;p&gt;
&lt;p&gt;Note that while the chain id and the token address were not included in the original version of the spec, the simple addition of these two parameters allows for leveraging the relayers for cross chain messages, should the subscriber wish to do this, and also allows for paying relayer fees in various tokens.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;updating-a-subscription&quot;&gt;Updating a Subscription&lt;&#x2F;h3&gt;
&lt;p&gt;To update a subscription, the &lt;code&gt;updateSubscriber&lt;&#x2F;code&gt; function &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be called with the same set of parameters as the &lt;code&gt;registerSubscriber&lt;&#x2F;code&gt; function.  This might be done in order to cancel a subscription, or to change the subscription fee. Note that the &lt;code&gt;updateSubscriber&lt;&#x2F;code&gt; function &lt;strong&gt;MUST&lt;&#x2F;strong&gt; maintain the same &lt;code&gt;msg.sender&lt;&#x2F;code&gt; that the &lt;code&gt;registerSubscriber&lt;&#x2F;code&gt; function was called with.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;removing-a-subscription&quot;&gt;Removing a Subscription&lt;&#x2F;h3&gt;
&lt;p&gt;To remove a previously registered subscription, the function &lt;code&gt;removeSubscriber&lt;&#x2F;code&gt; &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be called on the Registry contract, with the same parameters as the &lt;code&gt;updateSubscriber&lt;&#x2F;code&gt; function, but without the &lt;code&gt;fee&lt;&#x2F;code&gt; parameter (i.e. publisher and subscriber contract addresses and thread id). The fee will be subsequently set to 0 to indicate that the subscriber no longer wants updates for this subscription.  The registry contract &lt;strong&gt;MUST&lt;&#x2F;strong&gt; emit a &lt;code&gt;SubscriptionRemoved&lt;&#x2F;code&gt; event with publisher contract address, subscriber contract address and the thread id as topics.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;publishing-an-event&quot;&gt;Publishing an Event&lt;&#x2F;h3&gt;
&lt;p&gt;A publisher contract &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; emit a hook event from at least one function. The emitted event &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be called &lt;code&gt;Hook&lt;&#x2F;code&gt; and &lt;strong&gt;MUST&lt;&#x2F;strong&gt; contain the following parameters:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;uint256 (indexed) - threadId&lt;&#x2F;li&gt;
&lt;li&gt;uint256 (indexed) - nonce&lt;&#x2F;li&gt;
&lt;li&gt;bytes32 digest&lt;&#x2F;li&gt;
&lt;li&gt;bytes payload&lt;&#x2F;li&gt;
&lt;li&gt;bytes32 checksum&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;code&gt;nonce&lt;&#x2F;code&gt; value &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be incremented every time a Hook event is fired by a publisher contract.  Every Hook event &lt;strong&gt;MUST&lt;&#x2F;strong&gt; have a unique &lt;code&gt;nonce&lt;&#x2F;code&gt; value.  The &lt;code&gt;nonce&lt;&#x2F;code&gt; property is initiated to 1, but the first Hook event ever fired &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be set to 2.  This is to prevent ambiguity between an uninitiated nonce variable and a nonce variable that is explicitly initiated to zero.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;digest&lt;&#x2F;code&gt; parameter of the event &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be the keccak256 hash of the payload, and the &lt;code&gt;checksum&lt;&#x2F;code&gt; &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be the keccak256 hash of the concatenation of the digest with the current blockheight, e.g.:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;bytes32 checksum = keccak256(abi.encodePacked(digest, block.number));&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;Hook&lt;&#x2F;code&gt; event can be triggered by a function call from any EOA or external contract. This allows the payload to be created dynamically within the publisher contract.  The subscriber contract &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; call the &lt;code&gt;verifyEventHook&lt;&#x2F;code&gt; function on the publisher contract to verify that the received Hook payload is valid.&lt;&#x2F;p&gt;
&lt;p&gt;The payload &lt;strong&gt;MAY&lt;&#x2F;strong&gt; be passed to the function firing the Hook event instead of being generated within the publisher contract itself, but if a signature is provided it &lt;strong&gt;MUST&lt;&#x2F;strong&gt; sign a hash of the payload, and it is strongly recommended to use the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; standard, and to follow the data structure outlined at the end of this proposal.  This signature &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; be verified by the subscribers to ensure they are getting authentic events. The signature &lt;strong&gt;MUST&lt;&#x2F;strong&gt; correspond to the public key that was registered with the event.  With this approach, the signature &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; be placed at the start of the payload (e.g. bytes 0 to 65 for an ECDSA signature with r, s, v properties).  This method of verification can be used for cross-chain Hook events, where subscribers will not be able to call the &lt;code&gt;verifyHookEvent&lt;&#x2F;code&gt; of the publisher contract on another chain.&lt;&#x2F;p&gt;
&lt;p&gt;The payload &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be passed to subscribers as a byte array in calldata.  The subscriber smart contract &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; convert the byte array into the required data type.  For example, if the payload is a snark proof, the publisher would need to serialize the variables into a byte array, and the subscriber smart contract would need to deserialize it on the other end, e.g.:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;struct SnarkProof {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    uint256[2] a;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    uint256[2][2] b;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    uint256[2] c;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    uint256[1] input;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SnarkProof memory zkproof = abi.decode(payload, SnarkProof);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;relayers&quot;&gt;Relayers&lt;&#x2F;h3&gt;
&lt;p&gt;Relayers are independent parties that listen to &lt;code&gt;Hook&lt;&#x2F;code&gt; events on publisher smart contracts.  Relayers retrieve a list of subscribers for different hooks from the registry, and listen for hook events being fired on the publisher contracts.  Once a hook event has been fired by a publisher smart contract, relayers can decide to relay the hook event&#x27;s payload to the subscriber contracts by broadcasting a transaction that executes the subscriber contract&#x27;s &lt;code&gt;verifyHook&lt;&#x2F;code&gt; function.  Relayers are incentivised to do this because it is expected that the subscriber contract will remunerate them with ETH, or some other asset.&lt;&#x2F;p&gt;
&lt;p&gt;Relayers &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; simulate the transaction locally before broadcasting it to make sure that the subscriber contract has sufficient balance for payment of the fee.  This requires subscriber contracts to maintain a balance of ETH (or some asset) in order to provision payment of relayer fees.  A subscriber contract &lt;strong&gt;MAY&lt;&#x2F;strong&gt; decide to revert a transaction based on some logic, which subsequently allows the subscriber contract to conditionally respond to events, depending on the data in the payload. In this case the relayer will simulate the transaction locally and determine not to relay the Hook event to the subscriber contract.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;verifying-a-hook-event&quot;&gt;Verifying a Hook Event&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;verifyHook&lt;&#x2F;code&gt; function of the subscriber contracts &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; include logic to ensure that they are retrieving authentic events. In the case where the Hook event contains a signature, then subscriber contracts &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; create a hash of the required parameters, and &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; verify that the signature in the hook event is valid against the derived hash and the publisher&#x27;s public key (see the reference implemenetation for an example).  The hook function &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; also verify the nonce of the hook event and record it internally, in order to prevent replay attacks.&lt;&#x2F;p&gt;
&lt;p&gt;For Hook events without signatures, the subscriber contract &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; call the &lt;code&gt;verifyHookEvent&lt;&#x2F;code&gt; on the publisher contract in order to verify that the hook event is valid.  The publisher smart contract &lt;strong&gt;MUST&lt;&#x2F;strong&gt; implement the &lt;code&gt;verifyHookEvent&lt;&#x2F;code&gt;, which accepts the hash of the payload, the thread id, the nonce, and the block height associated with the Hook event, and returns a boolean value to indicate the Hook event&#x27;s authenticity.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;interfaces&quot;&gt;Interfaces&lt;&#x2F;h3&gt;
&lt;p&gt;IRegistry.sol&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @title IRegistry&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @dev Implements the registry contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IRegistry&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @dev Registers a new hook event by a publisher&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @param publisherContract The address of the publisher contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @param threadId The id of the thread these hook events will be fired on&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @param signingKey The public key that corresponds to the signature of externally generated payloads (optional)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @return Returns true if the hook is successfully registered&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; registerHook&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; publisherContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; threadId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signingKey&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @dev Verifies a hook with the publisher smart contract before adding it to the registry&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @param publisherAddress The address of the publisher contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @param threadId The id of the thread these hook events will be fired on&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @param signingKey The public key used to verify the hook signatures&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @return Returns true if the hook is successfully verified&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verifyHook&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; publisherAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; threadId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signingKey&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @dev Update a previously registered hook event&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @dev Can be used to transfer hook authorization to a new address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @dev To remove a hook, transfer it to the burn address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @param publisherContract The address of the publisher contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @param threadId The id of the thread these hook events will be fired on&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @param signingKey The public key used to verify the hook signatures&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @return Returns true if the hook is successfully updated&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; updateHook&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; publisherContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; threadId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signingKey&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @dev Remove a previously registered hook event&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @param publisherContract The address of the publisher contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @param threadId The id of the thread these hook events will be fired on&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @param signingKey The public key used to verify the hook signatures&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @return Returns true if the hook is successfully updated&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; removeHook&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; publisherContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; threadId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signingKey&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @dev Registers a subscriber to a hook event&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @param publisherContract The address of the publisher contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @param subscriberContract The address of the contract subscribing to the event hooks&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @param threadId The id of the thread these hook events will be fired on&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @param fee The fee that the subscriber contract will pay the relayer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @param maxGas The maximum gas that the subscriber allow to spend, to prevent griefing attacks&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @param maxGasPrice The maximum gas price that the subscriber is willing to rebate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @param chainId The chain id that the subscriber wants updates on&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @param feeToken The address of the token that the fee will be paid in or 0x0 for the chain&amp;#39;s native asset (e.g. ETH)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @return Returns true if the subscriber is successfully registered&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; registerSubscriber&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; publisherContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; subscriberContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; threadId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; fee&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; maxGas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; maxGasPrice&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; chainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; feeToken&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @dev Registers a subscriber to a hook event&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @param publisherContract The address of the publisher contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @param subscriberContract The address of the contract subscribing to the event hooks&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @param threadId The id of the thread these hook events will be fired on&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @param fee The fee that the subscriber contract will pay the relayer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @return Returns true if the subscriber is successfully updated&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; updateSubscriber&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; publisherContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; subscriberContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; threadId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; fee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @dev Removes a subscription to a hook event&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @param publisherContract The address of the publisher contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @param subscriberContract The address of the contract subscribing to the event hooks&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @param threadId The id of the thread these hook events will be fired on&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @return Returns true if the subscriber is subscription removed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; removeSubscription&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; publisherContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; subscriberContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; threadId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;IPublisher.sol&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @title IPublisher&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @dev Implements a publisher contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IPublisher&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @dev Example of a function that fires a hook event when it is called&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @param payload The actual payload of the hook event&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @param digest Hash of the hook event payload that was signed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @param threadId The thread number to fire the hook event on&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fireHook&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; payload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; digest&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; threadId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @dev Adds &#x2F; updates a new hook event internally&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @param threadId The thread id of the hook&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @param signingKey The public key associated with the private key that signs the hook events&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addHook&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; threadId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signingKey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @dev Called by the registry contract when registering a hook, used to verify the hook is valid before adding&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @param threadId The thread id of the hook&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @param signingKey The public key associated with the private key that signs the hook events&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @return Returns true if the hook is valid and is ok to add to the registry&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verifyEventHookRegistration&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; threadId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signingKey&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @dev Returns true if the specified hook is valid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @param payloadhash The hash of the hook&amp;#39;s data payload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @param threadId The thread id of the hook&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @param nonce The nonce of the current thread&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @param blockheight The blockheight that the hook was fired at&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @return Returns true if the specified hook is valid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verifyEventHook&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; payloadhash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; threadId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; blockheight&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;ISubscriber.sol&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @title ISubscriber&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @dev Implements a subscriber contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ISubscriber&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @dev Example of a function that is called when a hook is fired by a publisher&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @param publisher The address of the publisher contract in order to verify hook event with&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @param payload Hash of the hook event payload that was signed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @param threadId The id of the thread this hook was fired on&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @param nonce Unique nonce of this hook&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; @param blockheight The block height at which the hook event was fired&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verifyHook&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; publisher&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; payload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; threadId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; blockheight&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The rationale for this design is that it allows smart contract developers to write contract logic that listens and responds to events fired in other smart contracts, without requiring them to run some dedicated off-chain process to achieve this.  This best suits any simple smart contract logic that runs relatively infrequently in response to events in other contracts.&lt;&#x2F;p&gt;
&lt;p&gt;This improves on the existing solutions to achieve a pub&#x2F;sub design pattern. To elaborate: a number of service providers currently offer &quot;webhooks&quot; as a way to subscribe to events emitted by smart contracts, by having some API endpoint called when the events are emitted, or alternatively offer some serverless feature that can be triggered by some smart contract event.  This approach works very well, but it does require that some API endpoint or serverless function be always available, which may require some dedicated server &#x2F; process, which in turn will need to have some private key, and some amount of ETH in order to re-broadcast transactions, no to mention the requirement to maintain an account with some third party provider.&lt;&#x2F;p&gt;
&lt;p&gt;This approach offers a more suitable alternative for when an &quot;always-on&quot; server instance is not desirable, e.g. in the case that it will be called infrequently.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal incorporates a decentralized market-driven relay network, and this decision is based on the fact that this is a highly scalable approach.  Conversely, it is possible to implement this functionality without resorting to a market-driven approach, by simply defining a standard for contracts to allow other contracts to subscribe directly.  That approach is conceptually simpler, but has its drawbacks, in so far as it requires a publisher contract to record subscribers in its own state, creating an overhead for data management, upgradeability etc.  That approach would also require the publisher to call the &lt;code&gt;verifyHook&lt;&#x2F;code&gt; function on each subscriber contract, which will incur potentially significant gas costs for the publisher contract.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;griefing-attacks&quot;&gt;Griefing Attacks&lt;&#x2F;h3&gt;
&lt;p&gt;It is imperative that subscriber contracts trust the publisher contracts not to fire events that hold no intrinsic interest or value for them, as it is possible that malicious publisher contracts can publish a large number of events that will in turn drain the ETH from the subscriber contracts.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;front-running-attacks&quot;&gt;Front-running Attacks&lt;&#x2F;h3&gt;
&lt;p&gt;It is advised not to rely on signatures alone to validate Hook events. It is important for publishers and subscribers of hooks to be aware that it is possible for a relayer to relay hook events before they are published, by examining the publisher&#x27;s transaction in the mempool before it actually executes in the publisher&#x27;s smart contract.  The normal flow is for a &quot;trigger&quot; transaction to call a function in the publisher smart contract, which in turn fires an event which is then picked up by relayers.  Competitive relayers will observe that it is possible to pluck the signature and payload from the trigger transaction in the public mempool and simply relay it to subscriber contracts before the trigger transaction has been actually included in a block.  In fact, it is possible that the subscriber contracts process the event before the trigger transaction is processed, based purely on gas fee dynamics.  This can mitigated against by subscriber contracts calling the &lt;code&gt;verifyEventHook&lt;&#x2F;code&gt; function on the publisher contract when they receive a Hook event.&lt;&#x2F;p&gt;
&lt;p&gt;Another risk from front-running affects relayers, whereby the relayer&#x27;s transactions to the subscriber contracts can be front-run by generalized MEV searchers in the mempool.  It is likely that this sort of MEV capture will occur in the public mempool, and therefore it is advised that relayers use private channels to block builders to mitigate against this issue.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;relayer-competition&quot;&gt;Relayer Competition&lt;&#x2F;h3&gt;
&lt;p&gt;By broadcasting transactions to a segregated mempool, relayers protect themselves from front-running by generalized MEV bots, but their transactions can still fail due to competition from other relayers.  If two or more relayers decide to start relaying hook events from the same publisher to the same subscribers, then the relay transactions with the highest gas price will be executed before the others.  This will result in the other relayer&#x27;s transactions potentially failing on-chain, by being included later in the same block.  For now, there are certain transaction optimization services that will prevent transactions from failing on-chain, which will offer a solution to this problem, though this is out-of-scope for this document.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;optimal-fees&quot;&gt;Optimal Fees&lt;&#x2F;h3&gt;
&lt;p&gt;The fees that are paid to relayers are at the discretion of the subscribers, but it can be non-trivial to set fees to their optimal level, especially when considering volatile gas fees and competition between relayers.  This will result in subscribers setting fees to a perceived &quot;safe&quot; level, which they are confident will incentivize relayers to relay Hook events.  This will inevitably lead to poor price discovery and subscribers over-paying for updates.&lt;&#x2F;p&gt;
&lt;p&gt;The best way to solve this problem is through an auction mechanism that would allow relayers to bid against each other for the right to relay a transaction, which would guarantee that subscribers are paying the optimal price for their updates.  Describing an auction mechanism that would satisfy this requirements is out of scope for this proposal, but there exists proposals for general purpose auction mechanisms that can faciliate this without introducing undue latency.  One exampe of such as proposal is SUAVE from Flashbots, and there will likely be several others in time.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;without-an-auction&quot;&gt;Without an Auction&lt;&#x2F;h3&gt;
&lt;p&gt;In order to cultivate and maintain a reliable relayer market without the use of an auction mechanism, subscriber contracts would need to implement logic to either rebate any gas fees up to a specified limit, (while still allowing for execution of hook updates under normal conditions).&lt;&#x2F;p&gt;
&lt;p&gt;Another approach would be to implement a logical condition that checks the gas price of the transaction that is calling the &lt;code&gt;verifyHook&lt;&#x2F;code&gt; function, to ensure that the gas price does not effectively reduce the fee to zero.  This would require that the subscriber smart contract has some knowledge of the approximate gas used by it&#x27;s &lt;code&gt;verifyHook&lt;&#x2F;code&gt; function, and to check that the condition &lt;code&gt;minFee &amp;gt;= fee - (gasPrice * gasUsed)&lt;&#x2F;code&gt; is true.  This will mitigate against competitive bidding that would drive the &lt;em&gt;effective&lt;&#x2F;em&gt; relayer fee to zero, by ensuring that there is some minimum fee below which the effective fee is not allowed to drop.  This would mean that the highest gas price that can be paid before the transaction reverts is &lt;code&gt;fee - minFee + ε&lt;&#x2F;code&gt; where &lt;code&gt;ε ~= 1 gwei&lt;&#x2F;code&gt;.  This will require careful estimation of the gas cost of the &lt;code&gt;verifyHook&lt;&#x2F;code&gt; function and an awareness that the gas used may change over time as the contract&#x27;s state changes. The key insight with this approach is that competition between relayers will result in the fee that the subscribers pay always being the maximum, which is why the use of an auction mechanism is preferable.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;relayer-transaction-batching&quot;&gt;Relayer Transaction Batching&lt;&#x2F;h3&gt;
&lt;p&gt;Another important consideration is with batching of Hook events. Relayers are logically incentivized to batch Hook updates to save on gas, seeing as gas savings amount to 21,000 * n where n is the number of hooks being processed in a block by a single relayer.  If a relayer decides to batch multiple Hook event updates to various subscriber contracts into a single transaction, via a multi-call proxy contract, then they increase the risk of the entire batch failing on-chain if even one of the transactions in the batch fails on-chain.  For example, if relayer A batches x number of Hook updates, and relayer B batches y number of Hook updates, it is possible that relayer A&#x27;s batch is included in the same block in front of relayer B&#x27;s batch, and if both batches contain at least one duplicate, (i.e. the same Hook event to the same subscriber), then this will cause relayer B&#x27;s batch transaction to revert on-chain.  This is an important consideration for relayers, and suggests that relayers should have access to some sort of bundle simulation service to identify conflicting transactions before they occur.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;replay-attacks&quot;&gt;Replay Attacks&lt;&#x2F;h3&gt;
&lt;p&gt;When using signature verification, it is advised to use the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; standard in order to prevent cross network replay attacks, where the same contract deployed on more than one network can have its hook events pushed to subscribers on other networks, e.g. a publisher contract on Polygon can fire a hook event that could be relayed to a subscriber contract on Gnosis Chain.  Whereas the keys used to sign the hook events should ideally be unique, in reality this may not always be the case.&lt;&#x2F;p&gt;
&lt;p&gt;For this reason, it is recommended to use &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; Typed Data Signatures.  In this case the process that initiates the hook should create the signature according to the following data structure:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; domain&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;verifyingContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;salt&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; hook&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;payload&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;blockheight&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;threadId&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; domainData&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Name of Publisher Dapp&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  version&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  chainId&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; parseInt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;web3&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;version&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;network&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  verifyingContract&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x123456789abcedf....publisher contract address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  salt&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x123456789abcedf....random hash unique to publisher contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; message&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  payload&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes array serialized payload&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  nonce&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  blockheight&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 999999&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  threadId&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; eip712TypedData&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  types&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    EIP712Domain&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; domain&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Hook&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; hook&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  domain&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; domainData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  primaryType&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Hook&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  message&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; message&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note: please refer to the unit tests in the reference implmenetation for an example of how a hook event should be constructed properly by the publisher.&lt;&#x2F;p&gt;
&lt;p&gt;Replay attacks can also occur on the same network that the event hook was fired, by simply re-broadcasting an event hook that was already broadcast previously.  For this reason, subscriber contracts should check that a nonce is included in the event hook being received, and record the nonce in the contract&#x27;s state.  If the hook nonce is not valid, or has already been recorded, the transaction should revert.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;cross-chain-messaging&quot;&gt;Cross-chain Messaging&lt;&#x2F;h3&gt;
&lt;p&gt;There is also the possibility to leverage the &lt;code&gt;chainId&lt;&#x2F;code&gt; for more than preventing replay attacks, but also for accepting messages from other chains.  In this use-case the subscriber contracts should register on the same chain that the subscriber contract is deployed on, and should set the &lt;code&gt;chainId&lt;&#x2F;code&gt; to the chain it wants to receive hook events from.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via CC0.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Complex Numbers stored in `bytes32` types</title>
        <published>2022-10-29T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Paul Edge</name><uri>https://github.com/genkifs</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5850/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5850-store-real-and-imaginary-parts-of-complex-numbers-in-the-least-significant-and-most-significant-16-bytes-respectively-of-a-bytes32-type/11532" />
        

        <id>https://wg-eips.ritovision.com/5850/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:5850"
            label="ERC-5850" />
        

        
        

        
        <summary type="html">Store real and imaginary parts of complex numbers in the least significant and most significant 16 bytes respectively of a `bytes32` type.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5850/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes a natural way for complex numbers to be stored in and retrieved from the &lt;code&gt;bytes32&lt;&#x2F;code&gt; data-type.  It splits the storage space exactly in half and, most importantly, assigns the real number part to the least significant 16 bytes and the imaginary number part to the most significant 16 bytes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Complex numbers are an essential tool for many mathematical and scientific calculations.  For example, Fourier Transforms, Characteristic functions, AC Circuits and Navier-Stokes equations all require the concept.&lt;&#x2F;p&gt;
&lt;p&gt;Complex numbers can be represented in many different forms (polynomial, cartesian, polar, exponential).  The EIP creates a standard that can accommodate cartesian, polar and exponential formats with example code given for the Cartesian representation, where a complex number is just the pair of real numbers which gives the real and imaginary co-ordinates of the complex number. Equal storage capacity is assigned to both components and the order they appear is explicitly defined.&lt;&#x2F;p&gt;
&lt;p&gt;Packing complex numbers into a single &lt;code&gt;bytes32&lt;&#x2F;code&gt; data object halves storage costs and creates a more natural code object that can be passed around the solidity ecosystem.  Existing code may not need to be rewritten for complex numbers.  For example, mappings by &lt;code&gt;bytes32&lt;&#x2F;code&gt; are common and indexing in the 2D complex plane may improve code legibility.&lt;&#x2F;p&gt;
&lt;p&gt;Decimal numbers, either fix or floating, are not yet fully supported by Solidity so enforcing similar standards for complex versions is premature.  It can be suggested that fixed point methods such as prb-math be used with 18 decimal places, or floating point methods like abdk.  However, it should be noted that this EIP supports any decimal number representation so long as it fits inside the 16 bytes space.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;A complex number would be defined as &lt;code&gt;bytes32&lt;&#x2F;code&gt; and a cartesian representation would be initialized with the &lt;code&gt;cnNew&lt;&#x2F;code&gt; function and converted back with &lt;code&gt;RealIm&lt;&#x2F;code&gt;, both given below.&lt;&#x2F;p&gt;
&lt;p&gt;To create the complex number one would use&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; cnNew&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int128&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _Real&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int128&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _Imag&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; Imag32 &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes16&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint128&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_Imag&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; Real32 &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes16&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint128&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_Real&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;Real32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 128&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span&gt; Imag32&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;and to convert back&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RealIm&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _cn&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int128&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; Real&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int128&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; Imag&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes16&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; tmp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes16&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        mstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tmp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _cn&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        mstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tmp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 16&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _cn&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Imag&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int128&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint128&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tmp&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Real&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int128&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint128&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tmp&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;An EIP is required as this proposal defines a complex numbers storage&#x2F;type standard for multiple apps to use.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP proposes to package both the real and imaginary within one existing data type, &lt;code&gt;bytes32&lt;&#x2F;code&gt;.  This allows compact storage without the need for structures and facilitates easy library implementations.  The &lt;code&gt;bytes32&lt;&#x2F;code&gt; would remain available for existing, non-complex number uses.
Only the split and position of the real &amp;amp; imaginary parts is defined in this EIP.  Manipulation of complex numbers (addition, multiplication etc.), number of decimal places and other such topics are left for other EIP discussions.  This keeps this EIP more focused and therefore more likely to succeed.&lt;&#x2F;p&gt;
&lt;p&gt;Defining real numbers in the 16 least-significant bytes allows direct conversion from &lt;code&gt;uint128&lt;&#x2F;code&gt; to &lt;code&gt;bytes32&lt;&#x2F;code&gt; for positive integers less than 2**127.&lt;br &#x2F;&gt;
Direct conversion back from &lt;code&gt;bytes32&lt;&#x2F;code&gt; -&amp;gt; &lt;code&gt;uint&lt;&#x2F;code&gt; -&amp;gt; &lt;code&gt;int&lt;&#x2F;code&gt; are not recommended as the complex number may contain imaginary parts and&#x2F;or the real part may be negative. It is better to always use &lt;code&gt;RealIm&lt;&#x2F;code&gt; for separating the complex part.&lt;&#x2F;p&gt;
&lt;p&gt;Libraries for complex number manipulation can be implemented with the &lt;code&gt;Using Complex for bytes32&lt;&#x2F;code&gt; syntax where &lt;code&gt;Complex&lt;&#x2F;code&gt; would be the name of the library.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;There is no impact on other uses of the &lt;code&gt;bytes32&lt;&#x2F;code&gt; datatype.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;If complex numbers are manipulated in &lt;code&gt;bytes32&lt;&#x2F;code&gt; form then overflow checks must be performed manually during the manipulation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Auto-renewable allowance extension</title>
        <published>2022-10-22T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>zlace</name><uri>https://github.com/zlace0x</uri>
	</author>
	
	<author>
		<name>zhongfu</name><uri>https://github.com/zhongfu</uri>
	</author>
	
	<author>
		<name>edison0xyz</name><uri>https://github.com/edison0xyz</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5827/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5827-auto-renewable-allowance-extension/10392" />
        

        <id>https://wg-eips.ritovision.com/5827/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:5827"
            label="ERC-5827" />
        

        
        

        
        <summary type="html">Extension to enable automatic renewals on allowance approvals</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5827/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This extension adds a renewable allowance mechanism to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; allowances, in which a &lt;code&gt;recoveryRate&lt;&#x2F;code&gt; defines the amount of token per second that the allowance regains towards the initial maximum approval &lt;code&gt;amount&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, ERC-20 tokens support allowances, with which token owners can allow a spender to spend a certain amount of tokens on their behalf. However, this is not ideal in circumstances involving recurring payments (e.g. subscriptions, salaries, recurring direct-cost-averaging purchases).&lt;&#x2F;p&gt;
&lt;p&gt;Many existing DApps circumvent this limitation by requesting that users grant a large or unlimited allowance. This presents a security risk as malicious DApps can drain users&#x27; accounts up to the allowance granted, and users may not be aware of the implications of granting allowances.&lt;&#x2F;p&gt;
&lt;p&gt;An auto-renewable allowance enables many traditional financial concepts like credit and debit limits. An account owner can specify a spending limit, and limit the amount charged to the account based on an allowance that recovers over time.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5827&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is ERC20, ERC165 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0x93cd7af6.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * 0x93cd7af6 ===&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *   bytes4(keccak256(&amp;#39;approveRenewable(address,uint256,uint256)&amp;#39;)) ^&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *   bytes4(keccak256(&amp;#39;renewableAllowance(address,address)&amp;#39;)) ^&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *   bytes4(keccak256(&amp;#39;approve(address,uint256)&amp;#39;) ^&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *   bytes4(keccak256(&amp;#39;transferFrom(address,address,uint256)&amp;#39;) ^&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *   bytes4(keccak256(&amp;#39;allowance(address,address)&amp;#39;) ^&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  Thrown when the available allowance is less than the transfer amount.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;   available&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;       allowance available; 0 if unset&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InsufficientRenewableAllowance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; available&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  Emitted when any allowance is set.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     MUST be emitted even if a non-renewable allowance is set; if so, the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     `_recoveryRate` MUST be 0.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;   _owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;          owner of token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;   _spender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;        allowed spender of token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;   _value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;          initial and maximum allowance granted to spender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;   _recoveryRate&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   recovery amount per second&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RenewableApproval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _recoveryRate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  Grants an allowance of `_value` to `_spender` initially, which recovers over time &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  at a rate of `_recoveryRate` up to a limit of `_value`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     SHOULD cause `allowance(address _owner, address _spender)` to return `_value`, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     SHOULD throw when `_recoveryRate` is larger than `_value`, and MUST emit a &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     `RenewableApproval` event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;   _spender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;        allowed spender of token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;   _value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;          initial and maximum allowance granted to spender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;   _recoveryRate&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   recovery amount per second&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approveRenewable&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _recoveryRate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  Returns approved max amount and recovery rate of allowance granted to `_spender` &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  by `_owner`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     `amount` MUST also be the initial approval amount when a non-renewable allowance &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     has been granted, e.g. with `approve(address _spender, uint256 _value)`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    _owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         owner of token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;   _spender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;        allowed spender of token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; initial and maximum allowance granted to spender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  recoveryRate&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; recovery amount per second&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; renewableAllowance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recoveryRate&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Overridden ERC-20 functions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  Grants a (non-increasing) allowance of _value to _spender and clears any existing &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  renewable allowance.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     MUST clear set `_recoveryRate` to 0 on the corresponding renewable allowance, if &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     any.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;   _spender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;        allowed spender of token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;   _value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;          allowance granted to spender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   Moves `amount` tokens from `from` to `to` using the caller&amp;#39;s allowance.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      When deducting `amount` from the caller&amp;#39;s allowance, the allowance amount used &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      SHOULD include the amount recovered since the last transfer, but MUST NOT exceed &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      the maximum allowed amount returned by `renewableAllowance(address _owner, address &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      _spender)`. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      SHOULD also throw `InsufficientRenewableAllowance` when the allowance is &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      insufficient.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;            token owner address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;              token recipient&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;          amount of token to transfer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  Returns amount currently spendable by `_spender`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     The amount returned MUST be as of `block.timestamp`, if a renewable allowance &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     for the `_owner` and `_spender` is present.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;   _owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         owner of token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;   _spender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;       allowed spender of token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  remaining&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; allowance at the current point in time&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; allowance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; remaining&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Base method &lt;code&gt;approve(address _spender, uint256 _value)&lt;&#x2F;code&gt; MUST set &lt;code&gt;recoveryRate&lt;&#x2F;code&gt; to 0.&lt;&#x2F;p&gt;
&lt;p&gt;Both &lt;code&gt;allowance()&lt;&#x2F;code&gt; and &lt;code&gt;transferFrom()&lt;&#x2F;code&gt; MUST be updated to include allowance recovery logic.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;approveRenewable(address _spender, uint256 _value, uint256 _recoveryRate)&lt;&#x2F;code&gt; MUST set both the initial allowance amount and the maximum allowance limit (to which the allowance can recover) to &lt;code&gt;_value&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;supportsInterface(0x93cd7af6)&lt;&#x2F;code&gt; MUST return &lt;code&gt;true&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;additional-interfaces&quot;&gt;Additional interfaces&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;Token Proxy&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Existing ERC-20 tokens can delegate allowance enforcement to a proxy contract that implements this specification. An additional query function exists to get the underlying ERC-20 token.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5827Proxy&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is IERC5827 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0xc55dae63.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * 0xc55dae63 ===&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *   bytes4(keccak256(&amp;#39;baseToken()&amp;#39;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   Get the underlying base token being proxied.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;   baseToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address of the base token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; baseToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;transfer()&lt;&#x2F;code&gt; function on the proxy MUST NOT emit the &lt;code&gt;Transfer&lt;&#x2F;code&gt; event (as the underlying token already does so).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Automatic Expiration&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5827Expirable&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is IERC5827 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0x46c5b619.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * 0x46c5b619 ===&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *   bytes4(keccak256(&amp;#39;approveRenewable(address,uint256,uint256,uint64)&amp;#39;)) ^&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *   bytes4(keccak256(&amp;#39;renewableAllowance(address,address)&amp;#39;)) ^&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  Grants an allowance of `_value` to `_spender` initially, which recovers over time &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  at a rate of `_recoveryRate` up to a limit of `_value` and expires at &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  `_expiration`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     SHOULD throw when `_recoveryRate` is larger than `_value`, and MUST emit &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     `RenewableApproval` event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;   _spender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;        allowed spender of token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;   _value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;          initial allowance granted to spender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;   _recoveryRate&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   recovery amount per second&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;   _expiration&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     Unix time (in seconds) at which the allowance expires&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approveRenewable&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _recoveryRate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _expiration&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  Returns approved max amount, recovery rate, and expiration timestamp.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; initial and maximum allowance granted to spender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  recoveryRate&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; recovery amount per second&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  expiration&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Unix time (in seconds) at which the allowance expires&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; renewableAllowance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recoveryRate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expiration&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Renewable allowances can be implemented with discrete resets per time cycle. However, a continuous &lt;code&gt;recoveryRate&lt;&#x2F;code&gt; allows for more flexible use cases not bound by reset cycles and can be implemented with simpler logic.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Existing ERC-20 token contracts can delegate allowance enforcement to a proxy contract that implements this specification.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;An minimal implementation is included &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5827&#x2F;.&#x2F;assets&#x2F;ERC5827.sol&quot;&gt;here&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;An audited, open source implemention of this standard as a &lt;code&gt;IERC5827Proxy&lt;&#x2F;code&gt; can be found at &lt;code&gt;https:&#x2F;&#x2F;github.com&#x2F;suberra&#x2F;funnel-contracts&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a stricter set of constraints compared to ERC-20 with unlimited allowances. However, when &lt;code&gt;_recoveryRate&lt;&#x2F;code&gt; is set to a large value, large amounts can still be transferred over multiple transactions.&lt;&#x2F;p&gt;
&lt;p&gt;Applications that are not &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5827&#x2F;&quot;&gt;ERC-5827&lt;&#x2F;a&gt;-aware may erroneously infer that the value returned by &lt;code&gt;allowance(address _owner, address _spender)&lt;&#x2F;code&gt; or included in &lt;code&gt;Approval&lt;&#x2F;code&gt; events is the maximum amount of tokens that &lt;code&gt;_spender&lt;&#x2F;code&gt; can spend from &lt;code&gt;_owner&lt;&#x2F;code&gt;. This may not be the case, such as when a renewable allowance is granted to &lt;code&gt;_spender&lt;&#x2F;code&gt; by &lt;code&gt;_owner&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Delegate transaction</title>
        <published>2022-10-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Hadrien Croubois</name><uri>https://github.com/Amxx</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5806/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5806-delegate-transaction/11409" />
        

        <id>https://wg-eips.ritovision.com/5806/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:5806"
            label="EIP-5806" />
        

        
        

        
        <summary type="html">Adds a new transaction type that allows EOAs to execute arbitrary code through delegation</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5806/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP adds a new transaction type that allows EOAs to execute arbitrary code using a delegate-call-like mechanism.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;EOA are the most widely used type of account, yet their ability to perform operations is limited to deploying contracts and sending &quot;call&quot; transactions. It is currently not possible for an EOA to execute arbitrary code, which greatly limits the interactions users can have with the blockchain. Account abstraction has been extensively discussed but the path toward mainstream adoption is still unclear. Some approaches, such as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt; hope to improve the usability of smart wallets, without addressing the issue of smart wallet support by applications.&lt;&#x2F;p&gt;
&lt;p&gt;While smart contract wallets have a lot to offer in terms of UX, it is unlikely that all users will migrate any time soon because of the associated cost and the fact that some EOAs have custody of non-transferable assets.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP proposes an approach to allow the execution of arbitrary code by EOAs, with minimal change over the EVM, and using the same security model users are used to. By allowing EOAs to perform delegate calls to a contract (similarly to how contracts can delegate calls to other contracts using &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7&#x2F;&quot;&gt;EIP-7&lt;&#x2F;a&gt;), EOAs will be able to have more control over what operations they want to execute. This proposal&#x27;s goal is NOT to provide an account abstraction primitive.&lt;&#x2F;p&gt;
&lt;p&gt;By performing a delegate call to a multicall contract (such as the one deployed to &lt;code&gt;0xcA11bde05977b3631167028862bE2a173976CA11&lt;&#x2F;code&gt;), EOAs would be able to batch multiple transactions into a single one (being the &lt;code&gt;msg.sender&lt;&#x2F;code&gt; of all the sub calls). This would provide a better UX for users that want to interact with protocols (no need for multiple transactions, with variable gas prices and 21k gas overhead) and increase the security of such interactions (by avoiding unsafe token approvals being exploited between an &lt;code&gt;approval&lt;&#x2F;code&gt; and the following &lt;code&gt;transferFrom&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;Other unforeseen logic could be implemented in smart contracts and used by EOA. This includes emitting events.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP doesn&#x27;t aim to replace other account abstraction proposals. It hopes to be an easy-to-implement alternative that would significantly improve the user experience of EOA owners in the near future.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;FORK_BLKNUM&lt;&#x2F;code&gt; = &lt;code&gt;TBD&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TX_TYPE&lt;&#x2F;code&gt; = TBD, &amp;gt; 0x03 (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;As of &lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt;, a new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; transaction is introduced with &lt;code&gt;TransactionType&lt;&#x2F;code&gt; = &lt;code&gt;TX_TYPE(TBD)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The intrinsic cost of the new transaction is inherited from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930&lt;&#x2F;a&gt;, specifically &lt;code&gt;21000 + 16 * non-zero calldata bytes + 4 * zero calldata bytes + 1900 * access list storage key count + 2400 * access list address count&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; &lt;code&gt;TransactionPayload&lt;&#x2F;code&gt; for this transaction is&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;rlp([chain_id, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit, destination, data, access_list, signature_y_parity, signature_r, signature_s])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The definitions of all fields follow the same semantics as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt;. Note the absence of &lt;code&gt;amount&lt;&#x2F;code&gt; field in this transaction!&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;to&lt;&#x2F;code&gt; field deviates slightly from the semantics with the exception that it MUST NOT be nil and therefore must always represent a 20-byte address. This means that delegate transactions cannot have the form of a create transaction.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;signature_y_parity, signature_r, signature_s&lt;&#x2F;code&gt; elements of this transaction represent a secp256k1 signature over &lt;code&gt;keccak256(TX_TYPE || rlp([chain_id, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit, destination, data, access_list]))&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; &lt;code&gt;ReceiptPayload&lt;&#x2F;code&gt; for this transaction is &lt;code&gt;rlp([status, cumulative_transaction_gas_used, logs_bloom, logs])&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The execution of this new transaction type is equivalent to the delegate call mechanism introduced in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7&#x2F;&quot;&gt;EIP-7&lt;&#x2F;a&gt;, but performed by an EOA (the transaction sender). This implies that the code present at &lt;code&gt;destination&lt;&#x2F;code&gt;, if any, should be executed in the context of the sender. As a consequence, such a transaction emit an event from the EOA or use &lt;code&gt;Create2&lt;&#x2F;code&gt; with the address of the EOA as the creator. This transaction includes some restrictions though.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;opcode-restriction&quot;&gt;Opcode restriction&lt;&#x2F;h3&gt;
&lt;p&gt;For security reasons, some opcodes should not be executed in the context of an EOA:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;SSTORE&lt;&#x2F;code&gt; (0x55): Setting storage under an EOA breaks many assumptions. In particular storage set through a delegate transaction could cause issues if the accounts later &quot;migrates&quot; using &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7377&#x2F;&quot;&gt;EIP-7377&lt;&#x2F;a&gt; or similar. Additionally, storage may be a source of conflicts if a single EOA uses delegate transactions to target codes that interpret the storage layout under this account differently. For all these reasons, EOA should be forbidden from performing &lt;code&gt;SSTORE&lt;&#x2F;code&gt; in the context of a delegate transaction. If a delegate transaction performs a CALL, the target of the call is free to manipulate storage normally.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;CREATE&lt;&#x2F;code&gt; (0xF0), &lt;code&gt;CREATE2&lt;&#x2F;code&gt; (0xF5) and &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; (0xFF): There may be an expectation that transactions from a given sender should have consecutive nonces. This assumption would be broken if an EOA was able to execute one or multiple operations that alter the sender account&#x27;s nonce. Consequently, EOA performing a delegate transaction should not be able to use the &lt;code&gt;CREATE&lt;&#x2F;code&gt;, &lt;code&gt;CREATE2&lt;&#x2F;code&gt; or &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; opcodes. If a delegate transaction performs a CALL, the target of the call is free to create contracts normally.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Any attempts to make execute one of these restricted operations will instead throw an exception.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;EOAs are the most widely used type of wallet.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP would drastically expand the ability of EOAs to interact with smart contracts by using the pre-existing and well-understood delegation mechanism introduced in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7&#x2F;&quot;&gt;EIP-7&lt;&#x2F;a&gt; and without adding new complexity to the EVM.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No known backward compatibility issues thanks to the transaction envelope (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;Due to the inclusion logic and the gas cost being similar to type 2 transactions, it should be possible to include this new transaction type in the same mempool.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The nonce mechanism, already used in other transaction types, prevents replay attacks. Similar to existing transaction types, a delegate transaction can be cancelled by replacing it with a dummy transaction that pays more fees.&lt;&#x2F;p&gt;
&lt;p&gt;Since the object signed by the wallet is a transaction and not a signature that could potentially be processed in many ways (as is the case for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3074&#x2F;&quot;&gt;EIP-3074&lt;&#x2F;a&gt;), the risks associated with the miss-use of the signature are reduced. A wallet could simulate the execution of this delegate transaction and provide good guarantees that the operation that the user signs won&#x27;t be manipulated.&lt;&#x2F;p&gt;
&lt;p&gt;Contracts being called through this mechanism can execute any operation on behalf of the signer. As with other transaction types, signers should be extremely careful when signing a delegate transaction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>eth&#x2F;68 - Add tx type to tx announcement</title>
        <published>2022-10-18T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Marius van der Wijden</name><uri>https://github.com/MariusVanDerWijden</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5793/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5793-eth-68-add-transaction-type-to-tx-announcement/11364" />
        

        <id>https://wg-eips.ritovision.com/5793/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="networking"
                label="Networking" />
            
        

        
        <category
            term="tag:eip:5793"
            label="EIP-5793" />
        

        
        

        
        <summary type="html">Adds the transaction type and transaction size to tx announcement messages in the wire protocol</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5793/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The Ethereum Wire Protocol defines request and response messages for exchanging data between clients. The &lt;code&gt;NewPooledTransactionHashes&lt;&#x2F;code&gt; message announces transactions available in the node. This EIP extends this announcement message such that beside the transaction hashes, the node sends the transaction types and their sizes (as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt;) as well.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;NewPooledTransactionHashes&lt;&#x2F;code&gt; message announces transaction hashes, allowing the peer to selectively fetch transactions it does not yet have.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt; introduces a new transaction type for blob transactions. Since these blob transactions are large, naively broadcasting them to &lt;code&gt;sqrt(peers)&lt;&#x2F;code&gt; could significantly increase bandwidth requirements. Adding the transaction type and the size to the announcement message will allow nodes to select which transactions they want to fetch and also allow them to load balance or throttle peers based on past behavior.&lt;&#x2F;p&gt;
&lt;p&gt;The added metadata fields will also enable future - upgradeless - protocol tweaks to prevent certain transaction type (e.g. blob transactions) or certain transaction sizes (e.g. 128KB+) from being blindly broadcast to many peers. Enforcing announcements only and retrieval on demand would ensure a much more predictable networking behavior, limiting the amplification effect of transaction propagation DoS attack.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Modify the &lt;code&gt;NewPooledTransactionHashes (0x08)&lt;&#x2F;code&gt; message:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;(eth&#x2F;67)&lt;&#x2F;strong&gt;: &lt;code&gt;[hash_0: B_32, hash_1: B_32, ...]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;(eth&#x2F;68)&lt;&#x2F;strong&gt;: &lt;code&gt;[types: B, [size_0: P, size_1: P, ...], [hash_0: B_32, hash_1: B_32, ...]]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The new &lt;code&gt;types&lt;&#x2F;code&gt; element refers to the transaction types of the announced hashes. Note the
transaction types are packed as a &#x27;byte array&#x27; instead of a list.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;size_0&lt;&#x2F;code&gt;, &lt;code&gt;size_1&lt;&#x2F;code&gt; etc. elements refer to the transaction sizes of the announced hashes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This change will make the &lt;code&gt;eth&lt;&#x2F;code&gt; protocol future-proof for new transaction types that might not be relevant for all nodes. It gives the receiving node better control over the data it fetches from the peer as well as allow throttling the download of specific types.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;types&lt;&#x2F;code&gt; message element is a byte array because early implementations of this EIP
erroneously implemented it that way. It was later decided to keep this behavior in order
to minimize work.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP changes the &lt;code&gt;eth&lt;&#x2F;code&gt; protocol and requires rolling out a new version, &lt;code&gt;eth&#x2F;68&lt;&#x2F;code&gt;. Supporting multiple versions of a wire protocol is possible. Rolling out a new version does not break older clients immediately, since they can keep using protocol version &lt;code&gt;eth&#x2F;67&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP does not change consensus rules of the EVM and does not require a hard fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;None&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>On-Chain Verifiable Credentials</title>
        <published>2022-10-18T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Yu Liu</name><uri>https://github.com/yuliu-debond</uri>
	</author>
	
	<author>
		<name>Junyi Zhong</name><uri>https://github.com/Jooeys</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5851/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5815-kyc-certification-issuer-and-verifier-standard/11513" />
        

        <id>https://wg-eips.ritovision.com/5851/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:5851"
            label="ERC-5851" />
        

        
        

        
        <summary type="html">Interface for contracts that manage verifiable claims and identifiers as Soulbound tokens.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5851/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal introduces a method of certifying that a particular address meets a claim, and a method of verifying those certifications using on-chain metadata. Claims are assertions or statements made about a subject having certain properties that may be met conditions (for example: &lt;code&gt;age &amp;gt;= 18&lt;&#x2F;code&gt;), and are certified by issuers using a Soundbound Token (SBT).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;On-chain issuance of verifiable attestations are essential for use-case like:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Avoiding Sybil attacks with one person one vote&lt;&#x2F;li&gt;
&lt;li&gt;Participation in certain events with credentials&lt;&#x2F;li&gt;
&lt;li&gt;Compliance to government financial regulations etc.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;We are proposing a standard claims structure for Decentralized Identity (DID) issuers and verifier entities to create smart contracts in order to provide on-chain commitment of the off-chain verification process, and once the given address is associated with the given attestation of the identity verification off-chain, the issuers can then onboard other verifiers (i.e. governance, financial institution, non-profit organization, web3 related cooperation) to define the condition of the ownership of the user in order to reduce the technical barriers and overhead of current implementations.&lt;&#x2F;p&gt;
&lt;p&gt;The motivation behind this proposal is to create a standard for verifier and issuer smart contracts to communicate with each other in a more efficient way. This will reduce the cost of KYC processes, and provide the possibility for on-chain KYC checks.  By creating a standard for communication between verifiers and issuers, it will create an ecosystem in which users can be sure their data is secure and private. This will ultimately lead to more efficient KYC processes and help create a more trustful environment for users. It will also help to ensure that all verifier and issuer smart contracts are up-to-date with the most recent KYC regulations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Zero-Knowledge Proof (ZKP): a cryptographic device that can convince a verifier that an assertion is correct without revealing all of the inputs to the assertion.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Soulbound Token (SBT): A non-fungible and non-transferrable token that is used for defining the identity of the users.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;SBT Certificate: An SBT that represents the ownership of ID signatures corresponding to the claims defined in &lt;code&gt;function standardClaim()&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Verifiable Credential (VC): A collection of claims made by an issuer. These are temper evident credentials that allow the holders to prove that they posses certain characteristics (for example, passport verification, constraints like value of tokens in your wallet, etc) as demanded by the verifier entity.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Claim: An assertion that the DID Holder must fulfill to be verified.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Holder: The entity that stores the claim, such as a digital identity provider or a DID registry. The holder is responsible for validating the claim and providing verifiable evidence of the claim.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Claimer: The party making a claim, such as in an identity verification process.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Issuer: The entity that creates a verifiable credential from claims about one or more subjects to a holder. Example issuers include governments, corporations, non-profit organizations, trade associations, and individuals.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Verifier: An entity that validates data provided by an issuer of verifiable credentials, determining its accuracy, origin, currency and trustworthiness.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;metadata-standard&quot;&gt;Metadata Standard&lt;&#x2F;h3&gt;
&lt;p&gt;Claims MUST be exposed in the following structures:&lt;&#x2F;p&gt;
&lt;h4 id=&quot;1-metadata-information&quot;&gt;1. Metadata information&lt;&#x2F;h4&gt;
&lt;p&gt;Each claim requirement MUST be exposed using the following structure:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Metadata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; defines the name of the claim field&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _type&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the type of the data (bool,string,address,bytes,..)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; description&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; additional information about claim details.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Metadata&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt; title&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt; _type&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt; description&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;2-values-information&quot;&gt;2. Values Information&lt;&#x2F;h4&gt;
&lt;p&gt;This following structure will be used to define the actual claim information, based on the description of the &lt;code&gt;Metadata&lt;&#x2F;code&gt; structure, the structure is the same as &lt;code&gt;Values&lt;&#x2F;code&gt; structure of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3475&#x2F;&quot;&gt;EIP-3475&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Values&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;       string&lt;&#x2F;span&gt;&lt;span&gt; stringValue&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;       uint&lt;&#x2F;span&gt;&lt;span&gt; uintValue&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;       address&lt;&#x2F;span&gt;&lt;span&gt; addressValue&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;       bool&lt;&#x2F;span&gt;&lt;span&gt; boolValue&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;3-claim-structure&quot;&gt;3. Claim structure&lt;&#x2F;h4&gt;
&lt;p&gt;Claims (eg. &lt;code&gt;age &amp;gt;= 18&lt;&#x2F;code&gt;, jurisdiction in allowlist, etc.) are represented by one or many instances of the &lt;code&gt;Claim&lt;&#x2F;code&gt; structure below:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Claims&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * Claims structure consist of the conditions and value that holder claims to associate and verifier has to validate them.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the below given parameters are for reference purposes only, developers can optimize the fields that are needed to be represented on-chain by using schemes like TLV, encoding into base64 etc.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; structure that defines the parameters for specific claims of the SBT certificate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; this structure is used for the verification process, it contains the metadata, logic and expectation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; logic can represent either the enum format for defining the different operations, or they can be logic operators (stored in form of ASCII figure based on unicode standard). like  e.g: &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;(&amp;quot;⊄&amp;quot; = U+2284, &amp;quot;⊂&amp;quot; = U+2282,  &amp;quot;&amp;lt;&amp;quot; = U+003C , &amp;quot;&amp;lt;=&amp;quot; = U + 2265,&amp;quot;==&amp;quot; = U + 003D, &amp;quot;!=&amp;quot;U + 2260, &amp;quot;&amp;gt;=&amp;quot; = U + 2265,&amp;quot;&amp;gt;&amp;quot; =  U + 2262).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Claim&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        Metadata metadata&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt; logic&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        Values expectation&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;description of some logic functions that can be used are as follows:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Symbol&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;⊄&lt;&#x2F;td&gt;&lt;td&gt;does not belong to the set of values (or range) defined by the corresponding &lt;code&gt;Values&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;⊂&lt;&#x2F;td&gt;&lt;td&gt;condition that the parameter belongs to one of values defined by the &lt;code&gt;Values&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&amp;lt;&lt;&#x2F;td&gt;&lt;td&gt;condition that the parameter is greater than  value defined by the &lt;code&gt;Values&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;==&lt;&#x2F;td&gt;&lt;td&gt;condition that the parameter is strictly equal to the value defined by the &lt;code&gt;Values&lt;&#x2F;code&gt; structure&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;claim-example&quot;&gt;Claim Example&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;   &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;age&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;   &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unit&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;   &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;age of the person based on the birth date on the legal document&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;   &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;logic&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;   &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;18&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Defines the condition encoded for the index 1 (i.e the holder must be equal or more than 18 years old).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;interface-specification&quot;&gt;Interface specification&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;verifier&quot;&gt;Verifier&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; getter function to validate if the address `claimer` is the holder of the claim defined by the tokenId `SBTID`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; it MUST be defining the conditional operator (logic explained below) to allow the application to convert it into code logic &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; logic given here MUST be the conditiaonl operator, MUST be one of (&amp;quot;⊄&amp;quot;, &amp;quot;⊂&amp;quot;, &amp;quot;&amp;lt;&amp;quot;, &amp;quot;&amp;lt;=&amp;quot;, &amp;quot;==&amp;quot;, &amp;quot;!=&amp;quot;, &amp;quot;&amp;gt;=&amp;quot;, &amp;quot;&amp;gt;&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; claimer&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the EOA address that wants to validate the SBT issued to it by the issuer. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; SBTID&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the Id of the SBT that user is the claimer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; true&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if the assertion is valid, else false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    example ifVerified(0xfoo, 1) =&amp;gt; true will mean that 0xfoo is the holder of the SBT identity token defined by tokenId of the given collection. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ifVerified&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; claimer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; SBTID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;issuer&quot;&gt;Issuer&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; getter function to fetch the on-chain identification logic for the given identity holder.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; it MUST not be defined for address(0). &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; SBTID&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the Id of the SBT that the user is the claimer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; struct array of all the descriptions of condition metadata that is defined by the administrator for the given KYC provider.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    ex: standardClaim(1) --&amp;gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    { &amp;quot;title&amp;quot;:&amp;quot;age&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &amp;quot;type&amp;quot;: &amp;quot;uint&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &amp;quot;description&amp;quot;: &amp;quot;age of the person based on the birth date on the legal document&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;       &amp;quot;logic&amp;quot;: &amp;quot;&amp;gt;=&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &amp;quot;value&amp;quot;:&amp;quot;18&amp;quot;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    Defines the condition encoded for the identity index 1, defining the identity condition that holder must be equal or more than 18 years old.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; standardClaim&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; SBTID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Claim&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; function for setting the claim requirement logic (defined by Claims metadata) details for the given identity token defined by SBTID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; it should only be called by the admin address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; SBTID&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the Id of the SBT-based identity certificate for which the admin wants to define the Claims.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `claims` is the struct array of all the descriptions of condition metadata that is defined by the administrator. check metadata section for more information.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    example: changeStandardClaim(1, { &amp;quot;title&amp;quot;:&amp;quot;age&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &amp;quot;type&amp;quot;: &amp;quot;uint&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &amp;quot;description&amp;quot;: &amp;quot;age of the person based on the birth date on the legal document&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &amp;quot;logic&amp;quot;: &amp;quot;&amp;gt;=&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &amp;quot;value&amp;quot;:&amp;quot;18&amp;quot;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    }); &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    will correspond to the functionality that admin needs to adjust the standard claim for the identification SBT with tokenId = 1, based on the conditions described in the Claims array struct details.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; changeStandardClaim&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; SBTID&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; Claim&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _claims&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; function which uses the ZKProof protocol to validate the identity based on the given &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; it should only be called by the admin address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; SBTID&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the Id of the SBT-based identity certificate for which admin wants to define the Claims.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; claimer&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the address that needs to be proven as the owner of the SBT defined by the tokenID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    example: certify(0xA....., 10) means that admin assigns the DID badge with id 10 to the address defined by the `0xA....` wallet.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; certify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; claimer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; SBTID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; function which uses the ZKProof protocol to validate the identity based on the given &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; it should only be called by the admin address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; SBTID&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the Id of the SBT-based identity certificate for which the admin wants to define the Claims.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; claimer&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the address that needs to be proven as the owner of the SBT defined by the tokenID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; eg: revoke(0xfoo,1): means that KYC admin revokes the SBT certificate number 1 for the address &amp;#39;0xfoo&amp;#39;. &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revoke&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; certifying&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; SBTID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;events&quot;&gt;Events&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * standardChanged&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; standardChanged MUST be triggered when claims are &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; by the admin. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; standardChanged MUST also be triggered for the creation of a new SBTID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    e.g : emit StandardChanged(1, Claims(Metadata(&amp;#39;age&amp;#39;, &amp;#39;uint&amp;#39;, &amp;#39;age of the person based on the birth date on the legal document&amp;#39; ), &amp;quot;&amp;gt;=&amp;quot;, &amp;quot;18&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    is emitted when the Claim condition is &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; which allows the certificate holder to call the functions with the modifier, claims that the holder must be equal or more than 18 years old.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; StandardChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; SBTID&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;Claim&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _claims&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * certified&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; certified MUST be triggered when the SBT certificate is given to the certifying address. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * eg: Certified(0xfoo,2); means that wallet holder address `0xfoo` is certified to hold a certificate issued with id 2, and thus can satisfy all the conditions defined by the required interface.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Certified&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; claimer&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; SBTID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * revoked&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; revoked MUST be triggered when the SBT certificate is revoked. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * eg: Revoked( 0xfoo,1); means that entity user 0xfoo has been revoked to all the function access defined by the SBT ID 1.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Revoked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; claimer&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; SBTID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;This EIP is backward compliant for the contracts that keep intact the metadata structure of previous issued SBT&#x27;s with their ID and claim requirement details.
&lt;ul&gt;
&lt;li&gt;For e.g if the DeFI provider (using the modifiers to validate the ownership of required SBT by owner) wants the admin to change the logic of verification or remove certain claim structure, the previous holders of the certificates will be affected by these changes.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases for the minimal reference implementation can be found &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5851&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;test.sol&quot;&gt;here&lt;&#x2F;a&gt; for using transaction verification regarding whether the users hold the tokens or not. Use Remix IDE to compile and test the contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5851&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;interfaces&#x2F;IERC5851.sol&quot;&gt;interface&lt;&#x2F;a&gt; is divided into two separate implementations:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5851&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;ERC5851Verifier.sol&quot;&gt;EIP-5851 Verifier&lt;&#x2F;a&gt; is a simple modifier that needs to be imported by functions that are to be only called by holders of the SBT certificates. Then the modifier will call the issuer contract to verifiy if the claimer has the SBT certifcate in question.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5851&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;ERC5851Issuer.sol&quot;&gt;EIP-5851 Issuer&lt;&#x2F;a&gt; is an example of an identity certificate that can be assigned by a KYC controller contract. This is a full implementation of the standard interface.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;Implementation of functional interfaces for creating KYC on SBT (i.e &lt;code&gt;changeStandardClaim()&lt;&#x2F;code&gt;, &lt;code&gt;certify()&lt;&#x2F;code&gt; and &lt;code&gt;revoke()&lt;&#x2F;code&gt;) are dependent on the admin role. Thus the developer must insure security of admin role and rotation of this role to the entity entrusted by the KYC attestation service provider and DeFI protocols that are using this attestation service.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Physical Backed Tokens</title>
        <published>2022-10-17T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>2pmflow</name><uri>https://github.com/2pmflow</uri>
	</author>
	
	<author>
		<name>locationtba</name><uri>https://github.com/locationtba</uri>
	</author>
	
	<author>
		<name>Cameron Robertson</name><uri>https://github.com/ccamrobertson</uri>
	</author>
	
	<author>
		<name>cygaar</name><uri>https://github.com/cygaar</uri>
	</author>
	
	<author>
		<name>Brian Weick</name><uri>https://github.com/bweick</uri>
	</author>
	
	<author>
		<name>vectorized</name><uri>https://github.com/vectorized</uri>
	</author>
	
	<author>
		<name>djdabs</name><uri>https://github.com/djdabs</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5791/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/physical-backed-tokens/11350" />
        

        <id>https://wg-eips.ritovision.com/5791/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:5791"
            label="ERC-5791" />
        

        
        

        
        <summary type="html">Minimal interface for linking ownership of ERC-721 NFTs to a physical chip</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5791/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is an extension of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;. It proposes a minimal interface for a &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; NFT to be &quot;physically backed&quot; and owned by whoever owns the NFT&#x27;s physical counterpart.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;NFT collectors enjoy collecting digital assets and sharing them with others online. However, there is currently no such standard for showcasing physical assets as NFTs with verified authenticity and ownership. Existing solutions are fragmented and tend to be susceptible to at least one of the following:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The ownership of the physical item and the ownership of the NFT are decoupled.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Verifying the authenticity of the physical item requires action from a trusted 3rd party (e.g. StockX).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;requirements&quot;&gt;Requirements&lt;&#x2F;h3&gt;
&lt;p&gt;This approach requires that the physical item must have a chip attached to it that should be secure and signal authenticity:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The chip can securely generate and store an asymmetric key pair;&lt;&#x2F;li&gt;
&lt;li&gt;The chip can sign messages using the private key of the previously-generated asymmetric key pair;&lt;&#x2F;li&gt;
&lt;li&gt;The chip exposes the public key; and&lt;&#x2F;li&gt;
&lt;li&gt;The private key cannot be extracted or duplicated by design&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The approach also requires that the contract uses an account-bound implementation of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; (where all &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; functions that transfer must throw, e.g. the &quot;read only NFT registry&quot; implementation referenced in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;). This ensures that ownership of the physical item is required to initiate transfers and manage ownership of the NFT, through a new function introduced in this interface described below.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;approach&quot;&gt;Approach&lt;&#x2F;h3&gt;
&lt;p&gt;Each NFT is conceptually linked to a physical chip.&lt;&#x2F;p&gt;
&lt;p&gt;When the chipId is paired to a tokenId, an event will be emitted. This lets downstream indexers know which chip addresses are mapped to which tokens for the NFT collection. The NFT cannot be minted without its token id being linked to a specific chip.&lt;&#x2F;p&gt;
&lt;p&gt;The interface includes a function called &lt;code&gt;transferToken&lt;&#x2F;code&gt; that transfers the NFT to the function caller if a valid signature signed by the chip is passed in. A valid signature must follow the schemes set forth in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;191&#x2F;&quot;&gt;ERC-191&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2&#x2F;&quot;&gt;EIP-2&lt;&#x2F;a&gt; (s-value restrictions), where the data to sign consists of the target recipient address (the function caller), the chip address, a block timestamp, and any extra params used for additional custom logic in the implementation.&lt;&#x2F;p&gt;
&lt;p&gt;The interface also includes other functions that let anyone validate whether the chip in the physical item is backing an existing NFT in the collection.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;interface&quot;&gt;Interface&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5791&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the ERC-721 `tokenId` for a given chip address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      Reverts if `chipId` has not been paired to a `tokenId`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      For minimalism, this will NOT revert if the `tokenId` does not exist.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      If there is a need to check for token existence, external contracts can&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      call `ERC721.ownerOf(uint256 tokenId)` and check if it passes or reverts.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; chipId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address for the chip embedded in the physical item&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;               (computed from the chip&amp;#39;s public key).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenIdFor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; chipId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns true if `signature` is signed by the chip assigned to `tokenId`, else false.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      Reverts if `tokenId` has not been paired to a chip.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      For minimalism, this will NOT revert if the `tokenId` does not exist.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      If there is a need to check for token existence, external contracts can&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      call `ERC721.ownerOf(uint256 tokenId)` and check if it passes or reverts.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-721 `tokenId`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      Arbitrary bytes string that is signed by the chip to produce `signature`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; EIP-191 signature by the chip to check.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isChipSignatureForToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfers the token into the address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      Returns the `tokenId` transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                  The recipient. Dynamic to allow easier transfers to vaults.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; chipId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;              Chip ID (address) of chip being transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; chipSignature&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;       EIP-191 signature by the chip to authorize the transfer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; signatureTimestamp&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  Timestamp used in `chipSignature`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; useSafeTransferFrom&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Whether ERC-721&amp;#39;s `safeTransferFrom` should be used,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                            instead of `transferFrom`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; extras&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;              Additional data that can be used for additional logic&#x2F;context&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                            when the PBT is transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; chipId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; chipSignature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signatureTimestamp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; useSafeTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; extras&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when `chipId` is paired to `tokenId`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `tokenId` may not necessarily exist during assignment.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Indexers can combine this event with the {ERC721.Transfer} event to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; infer which tokens exists and are paired with a chip ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ChipSet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; chipId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;To aid recognition that an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; token implements physical binding via this EIP: upon calling &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt;’s &lt;code&gt;function supportsInterface(bytes4 interfaceID) external view returns (bool)&lt;&#x2F;code&gt; with &lt;code&gt;interfaceID=0x4901df9f&lt;&#x2F;code&gt;, a contract implementing this EIP must return true.&lt;&#x2F;p&gt;
&lt;p&gt;The mint interface is up to the implementation. The minted NFT&#x27;s owner should be the owner of the physical chip (this authentication could be implemented using the signature scheme defined for &lt;code&gt;transferToken&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This solution&#x27;s intent is to be the simplest possible path towards linking physical items to digital NFTs without a centralized authority.&lt;&#x2F;p&gt;
&lt;p&gt;The interface includes a &lt;code&gt;transferToken&lt;&#x2F;code&gt; function that&#x27;s opinionated with respect to the signature scheme, in order to enable a downstream aggregator-like product that supports transfers of any NFTs that implement this EIP in the future.&lt;&#x2F;p&gt;
&lt;p&gt;The chip address is included in &lt;code&gt;transferToken&lt;&#x2F;code&gt; to allow signature verification by a smart contract. This ensures that chips in physically backed tokens are not strictly tied to implementing secp256k1 signatures, but instead may use a variety of signature schemes such as P256 or BabyJubJub.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;out-of-scope&quot;&gt;Out of Scope&lt;&#x2F;h3&gt;
&lt;p&gt;The following are some peripheral problems that are intentionally not within the scope of this EIP:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;trusting that a specific NFT collection&#x27;s chip addresses actually map to physical chips embedded in items, instead of arbitrary EOAs that purport to be chips&lt;&#x2F;li&gt;
&lt;li&gt;ensuring that the chip does not deteriorate or get damaged&lt;&#x2F;li&gt;
&lt;li&gt;ensuring that the chip stays attached to the physical item&lt;&#x2F;li&gt;
&lt;li&gt;etc.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Work is being done on these challenges in parallel.&lt;&#x2F;p&gt;
&lt;p&gt;Mapping token ids to chip addresses is also out of scope. This can be done in multiple ways, e.g. by having the contract owner preset this mapping pre-mint, or by having a &lt;code&gt;(tokenId, chipId)&lt;&#x2F;code&gt; tuple passed into a mint function that&#x27;s pre-signed by an address trusted by the contract, or by doing a lookup in a trusted registry, or by assigning token ids at mint time first come first served, etc.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, it&#x27;s possible for the owner of the physical item to transfer the NFT to a wallet owned by somebody else (by sending a chip signature to that other person for use). We still consider the NFT physical backed, as ownership management is tied to the physical item. This can be interpreted as the item&#x27;s owner temporarily lending the item to somebody else, since (1) the item&#x27;s owner must be involved for this to happen as the one signing with the chip, and (2) the item&#x27;s owner can reclaim ownership of the NFT at any time.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal is backward compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; on an API level. As mentioned above, for the token to be physical-backed, the contract must use a account-bound implementation of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; (all &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; functions that transfer must throw) so that transfers go through the new function introduced here, which requires a chip signature.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The following is a snippet on how to validate a chip signature in a transfer event.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;#39;@openzeppelin&#x2F;contracts&#x2F;utils&#x2F;cryptography&#x2F;ECDSA.sol&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfers the `tokenId` assigned to `chipId` to `to`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; chipId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; chipSignature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signatureTimestamp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; useSafeTransfer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; extras&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    tokenId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenIdFor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;chipId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    _validateSigAndUpdateNonce&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; chipId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; chipSignature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signatureTimestamp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; extras&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;useSafeTransfer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _safeTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Validates the `chipSignature` and update the nonce for the future signature of `chipId`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _validateSigAndUpdateNonce&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; chipId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; chipSignature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signatureTimestamp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; extras&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; hash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _getSignatureHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signatureTimestamp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; chipId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; extras&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;SignatureCheckerLib&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isValidSignatureNow&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;chipId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; chipSignature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InvalidSignature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    chipNonce&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;chipId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;hash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ^&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;blockhash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the digest to be signed by the `chipId`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _getSignatureHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signatureTimestamp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; chipId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; extras&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    internal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    virtual&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;signatureTimestamp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SignatureTimestampInFuture&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;signatureTimestamp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt; maxDurationWindow &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SignatureTimestampTooOld&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; hash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;chainid&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; chipNonce&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;chipId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signatureTimestamp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;extras&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; ECDSA&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;toEthSignedMessageHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;hash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;191&#x2F;&quot;&gt;ERC-191&lt;&#x2F;a&gt; signature passed to &lt;code&gt;transferToken&lt;&#x2F;code&gt; requires the function caller&#x27;s address in its signed data so that the signature cannot be used in a replay attack. It also requires a recent block timestamp so that a malicious chip owner cannot pre-generate signatures to use after a short time window (e.g. after the owner of the physical item changes). It&#x27;s recommended to use a non-deterministic &lt;code&gt;chipNonce&lt;&#x2F;code&gt; when generating signatures.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, the level of trust that one has for whether the token is physically-backed is dependent on the security of the physical chip, which is out of scope for this EIP as mentioned above.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Wallet Call API</title>
        <published>2022-10-17T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Moody Salem</name><uri>https://github.com/moodysalem</uri>
	</author>
	
	<author>
		<name>Lukas Rosario</name><uri>https://github.com/lukasrosario</uri>
	</author>
	
	<author>
		<name>Wilson Cusack</name><uri>https://github.com/wilsoncusack</uri>
	</author>
	
	<author>
		<name>Dror Tirosh</name><uri>https://github.com/drortirosh</uri>
	</author>
	
	<author>
		<name>Jake Moxey</name><uri>https://github.com/jxom</uri>
	</author>
	
	<author>
		<name>Derek Rein</name><uri>https://github.com/arein</uri>
	</author>
	
	<author>
		<name>Alex Forshtat</name><uri>https://github.com/forshtat</uri>
	</author>
	
	<author>
		<name>Sam Wilson</name><uri>https://github.com/SamWilsn</uri><email>sam@binarycake.ca</email>
	</author>
	
	<author>
		<name>Borislav Itskov</name><uri>https://github.com/Oxbobby</uri>
	</author>
	
	<author>
		<name>Joao Tavares</name><uri>https://github.com/cryptotavares</uri>
	</author>
	
	<author>
		<name>Adam Fuller</name><uri>https://github.com/azf20</uri>
	</author>
	
	<author>
		<name>Philip Liao</name><uri>https://github.com/phil-ociraptor</uri>
	</author>
	
	<author>
		<name>bumblefudge</name><uri>https://github.com/bumblefudge</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5792/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5792-wallet-abstract-transaction-send-api/11374" />
        

        <id>https://wg-eips.ritovision.com/5792/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="interface"
                label="Interface" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:5792"
            label="EIP-5792" />
        

        
        

        
        <summary type="html">Adds JSON-RPC methods for sending multiple calls from the user&#x27;s wallet, and checking their status</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5792/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Defines new JSON-RPC methods which enable apps to ask a wallet to process a batch of onchain write calls and to check on the status of those calls.
Applications can specify that these onchain calls be executed taking advantage of specific capabilities previously expressed by the wallet; an additional, novel wallet RPC is defined to enable apps to query the wallet for those capabilities.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The current methods used to send transactions from the user wallet and check their status are &lt;code&gt;eth_sendTransaction&lt;&#x2F;code&gt; and &lt;code&gt;eth_getTransactionReceipt&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The current methods used to send transactions from the user wallet and check their status do not meet modern developer demands and cannot accommodate new transaction formats. Even the name–- &lt;code&gt;eth_sendTransaction&lt;&#x2F;code&gt;-– is an artifact of a time when nodes served as wallets.&lt;&#x2F;p&gt;
&lt;p&gt;Today, developers want to send multiple calls batched together in a single RPC call, which many smart accounts can, in turn, execute atomically in a single transaction. Developers also want to make use of features afforded by new transaction formats, like paymasters in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt; transactions. &lt;code&gt;eth_sendTransaction&lt;&#x2F;code&gt; offers no way to do these things.&lt;&#x2F;p&gt;
&lt;p&gt;In updating to a new set of &lt;code&gt;wallet_&lt;&#x2F;code&gt; RPCs, our main goals are to enforce a clean separation of wallet and app concerns, enable developers to make use of things like paymasters and batch transactions, and to create a clear way for more safely discoverable features to be added over time with minimal coordination.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Four new JSON-RPC methods are added: three are for handling batches of onchain calls, and one is for querying support for wallet capabilities, such as to make better use of the three batching methods.
Apps may begin using these first three methods immediately, falling back to &lt;code&gt;eth_sendTransaction&lt;&#x2F;code&gt; and &lt;code&gt;eth_getTransactionReceipt&lt;&#x2F;code&gt; when they are not available.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;wallet-sendcalls&quot;&gt;&lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Requests that a wallet submits a batch of calls. &lt;code&gt;from&lt;&#x2F;code&gt; and &lt;code&gt;chainId&lt;&#x2F;code&gt; are identified by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt; integers expressed in hexadecimal notation,
with &lt;code&gt;0x&lt;&#x2F;code&gt; prefix and no leading zeroes for the &lt;code&gt;chainId&lt;&#x2F;code&gt; value.
The items in the &lt;code&gt;calls&lt;&#x2F;code&gt; field are simple &lt;code&gt;{to, data, value}&lt;&#x2F;code&gt; tuples.&lt;&#x2F;p&gt;
&lt;p&gt;The capabilities field is how an app can communicate with a wallet about capabilities a wallet supports. For example, this is where an app can specify a paymaster service URL from which an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt; wallet can request a &lt;code&gt;paymasterAndData&lt;&#x2F;code&gt; input for a user operation.&lt;&#x2F;p&gt;
&lt;p&gt;Each capability defined in the &quot;capabilities&quot; member can define global or call specific fields.
These fields are set inside this capability&#x27;s entry in the &lt;code&gt;capabilities&lt;&#x2F;code&gt; object.
Each entity in the &lt;code&gt;calls&lt;&#x2F;code&gt; field may contain an optional &lt;code&gt;capabilities&lt;&#x2F;code&gt; object.
This object allows the applications to attach a capability-specific metadata to individual calls.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;atomicRequired&lt;&#x2F;code&gt; field specifies if a wallet is required to handle the batch of calls atomically or not. The wallet capacity to execute batch calls atomically is exposed through the built in &lt;code&gt;atomic&lt;&#x2F;code&gt; capability and can be sourced via &lt;code&gt;wallet_getCapabilities&lt;&#x2F;code&gt;..&lt;&#x2F;p&gt;
&lt;p&gt;Unless these requirements are explicitly overridden by a certain &lt;code&gt;capability&lt;&#x2F;code&gt;, the wallet must adhere to the following rules.
Note that such a &lt;code&gt;capability&lt;&#x2F;code&gt; is not in the scope of this EIP and should be defined in its own ERC.&lt;&#x2F;p&gt;
&lt;p&gt;The wallet:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;MUST send the calls in the order specified in the request&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;MUST send the calls on the same chain identified by the request&#x27;s &lt;code&gt;chainId&lt;&#x2F;code&gt; property&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;MUST send the calls from the address specified in the request&#x27;s &lt;code&gt;from&lt;&#x2F;code&gt; property, if provided&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If &lt;code&gt;from&lt;&#x2F;code&gt; is not provided the wallet SHOULD present the user with an opportunity to view and select the &lt;code&gt;from&lt;&#x2F;code&gt; address during confirmation&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;MUST NOT await for any calls to be finalized to complete the batch&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;MUST NOT send any calls from the request if the user rejects the request&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;When &lt;code&gt;atomicRequired&lt;&#x2F;code&gt; is set to &lt;code&gt;true&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;MUST execute all calls atomically, meaning that either all calls execute successfully or no material effects appear on chain.&lt;&#x2F;li&gt;
&lt;li&gt;MUST execute all calls contiguously, meaning no other transactions&#x2F;calls may be interleaved with the calls from this batch.&lt;&#x2F;li&gt;
&lt;li&gt;If a wallet is able to upgrade its atomicity guarantees from &lt;code&gt;ready&lt;&#x2F;code&gt; to &lt;code&gt;supported&lt;&#x2F;code&gt; but has not yet done so, it MUST upgrade before proceeding to submit the calls with the above guarantees.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;When &lt;code&gt;atomicRequired&lt;&#x2F;code&gt; is set to &lt;code&gt;false&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;MAY execute all calls sequentially without any atomicity&#x2F;contiguity guarantees.&lt;&#x2F;li&gt;
&lt;li&gt;If a wallet is capable of providing atomicity guarantees, it MAY execute the batch atomically.&lt;&#x2F;li&gt;
&lt;li&gt;If a wallet is able to upgrade its atomicity guarantees to &lt;code&gt;supported&lt;&#x2F;code&gt; (see &lt;code&gt;atomic&lt;&#x2F;code&gt; capability definition below), it MAY do so and then execute the batch atomically.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;MAY reject the request if the from address does not match the enabled account&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;MAY reject the request if one or more calls in the batch is expected to fail, when simulated sequentially&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;MUST reject the request if it contains a &lt;code&gt;capability&lt;&#x2F;code&gt; (either top-level or call-level) that is not supported by the wallet and the &lt;code&gt;capability&lt;&#x2F;code&gt; is not explicitly marked as optional.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Applications may mark a capability as optional by setting &lt;code&gt;optional&lt;&#x2F;code&gt; to &lt;code&gt;true&lt;&#x2F;code&gt;. See the RPC Specification section below for details.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;If provided, the wallet MUST respect the &lt;code&gt;id&lt;&#x2F;code&gt; field and return it in the response.&lt;&#x2F;p&gt;
&lt;p&gt;Identifiers, whether provided by the app or generated by the wallet, MUST be a unique string up to 4096 bytes (8194 characters including leading &lt;code&gt;0x&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;App-provided &lt;code&gt;id&lt;&#x2F;code&gt;s MUST be unique per sender per app, where each &quot;app&quot; SHOULD be identified by their domain.&lt;&#x2F;p&gt;
&lt;p&gt;Wallets MUST reject requests with duplicate &lt;code&gt;id&lt;&#x2F;code&gt;s.&lt;&#x2F;p&gt;
&lt;p&gt;Within 24 hours from the corresponding &lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt;, wallets SHOULD return a call-batch status when &lt;code&gt;wallet_getCallsStatus&lt;&#x2F;code&gt; is called with the same &lt;code&gt;id&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;capabilities&lt;&#x2F;code&gt; response object allows the wallets to attach a capability-specific metadata to the response.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;wallet-sendcalls-rpc-specification&quot;&gt;&lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt; RPC Specification&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Capability&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; unknown&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  optional&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; boolean&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SendCallsParams&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  version&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  id&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  from&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Hex chain id&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  atomicRequired&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; boolean&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  calls&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    to&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Hex value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    capabilities&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Record&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Capability&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  capabilities&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Record&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Capability&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SendCallsResult&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  id&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  capabilities&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Record&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; any&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;wallet-sendcalls-example-parameters&quot;&gt;&lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt; Example Parameters&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;from&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xd46e8dd67c5d32be8058bb8eb970870f07244567&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;atomicRequired&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;calls&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xd46e8dd67c5d32be8058bb8eb970870f07244567&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x9184e72a&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xd46e8dd67c5d32be8058bb8eb970870f07244567&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x182183&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xfbadbaf01&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;capabilities&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;paymasterService&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;url&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;optional&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note that since the &lt;code&gt;paymasterService&lt;&#x2F;code&gt; &lt;code&gt;capability&lt;&#x2F;code&gt; is marked as optional, wallets that do not support it will still process and handle the request as if the capability had not been present. If this &lt;code&gt;optional&lt;&#x2F;code&gt; field were set to &lt;code&gt;false&lt;&#x2F;code&gt; or absent from the request, wallets that do not support the &lt;code&gt;capability&lt;&#x2F;code&gt; MUST reject the request.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;wallet-sendcalls-example-return-value&quot;&gt;&lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt; Example Return Value&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x00000000000000000000000000000000000000000000000000000000000000000e670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;wallet-getcallsstatus&quot;&gt;&lt;code&gt;wallet_getCallsStatus&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Returns the status of a call batch that was sent via &lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt;.
The identifier of the batch is the value returned from the &lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt; RPC.
Note that the &lt;code&gt;receipts&lt;&#x2F;code&gt; objects of this method&#x27;s response is a strict subset of the object returned by &lt;code&gt;eth_getTransactionReceipt&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;capabilities&lt;&#x2F;code&gt; object allows the wallets to attach a capability-specific metadata to the response.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;atomic&lt;&#x2F;code&gt; field specifies how the wallet handled the batch of calls, which influences the structure of the &lt;code&gt;receipts&lt;&#x2F;code&gt; field.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The receipts in the &lt;code&gt;receipts&lt;&#x2F;code&gt; field MUST be in the order that they are included onchain.&lt;&#x2F;li&gt;
&lt;li&gt;If a wallet executes multiple calls &lt;strong&gt;atomically&lt;&#x2F;strong&gt;, &lt;code&gt;wallet_getCallsStatus&lt;&#x2F;code&gt; MAY return an object with a &lt;code&gt;receipts&lt;&#x2F;code&gt; field that contains a single transaction receipt or an array of receipts, corresponding to how the batch of transactions were included onchain. It also MUST be explicit and return an &lt;code&gt;atomic&lt;&#x2F;code&gt; field set to &lt;code&gt;true&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If a wallet executes multiple calls &lt;strong&gt;non-atomically&lt;&#x2F;strong&gt;, &lt;code&gt;wallet_getCallsStatus&lt;&#x2F;code&gt; MUST return an object with a &lt;code&gt;receipts&lt;&#x2F;code&gt; field that contains &lt;strong&gt;an array of receipts&lt;&#x2F;strong&gt; for all transactions containing batch calls that were included onchain. This includes the batch calls that were included on-chain but eventually reverted. It also MUST be explicit and return a &lt;code&gt;atomic&lt;&#x2F;code&gt; field set to &lt;code&gt;false&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;logs&lt;&#x2F;code&gt; in the receipt objects MUST only include logs relevant to the calls submitted using &lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt;. For example, in the case of a transaction submitted onchain by an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt; bundler, the logs must only include those relevant to the user operation constructed using the calls submitted via &lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt;. I.e. the logs should not include those from other unrelated user operations submitted in the same bundle.
&lt;ul&gt;
&lt;li&gt;Similarly, if a user upgrades their wallet to support atomicity before submitting a batch of calls from an app, the logs MUST NOT include those emitted as part of the upgrade process.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;wallet-getcallsstatus-rpc-specification&quot;&gt;&lt;code&gt;wallet_getCallsStatus&lt;&#x2F;code&gt; RPC Specification&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; GetCallsParams&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; GetCallsResult&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  version&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  id&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  status&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; number&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See &amp;quot;Status Codes&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  atomic&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; boolean&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  receipts&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    logs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;      address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;      data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;      topics&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    status&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Hex 1 or 0 for success or failure, respectively&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    blockHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    blockNumber&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    gasUsed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    transactionHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  capabilities&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Record&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; any&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;status-codes-for-status-field&quot;&gt;Status Codes for &lt;code&gt;status&lt;&#x2F;code&gt; field&lt;&#x2F;h5&gt;
&lt;p&gt;The purpose of the &lt;code&gt;status&lt;&#x2F;code&gt; field is to provide a short summary of the current status of the batch.
It provides some off-chain context to the array of inner transaction &lt;code&gt;receipts&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Status codes follow these categories:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;1xx: Pending states&lt;&#x2F;li&gt;
&lt;li&gt;2xx: Confirmed states&lt;&#x2F;li&gt;
&lt;li&gt;4xx: Offchain failures&lt;&#x2F;li&gt;
&lt;li&gt;5xx: Chain rules failures&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Code&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;td&gt;Batch has been received by the wallet but has not completed execution onchain (pending)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;200&lt;&#x2F;td&gt;&lt;td&gt;Batch has been included onchain without reverts, receipts array contains info of all calls (confirmed)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;400&lt;&#x2F;td&gt;&lt;td&gt;Batch has not been included onchain and wallet will not retry (offchain failure)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;500&lt;&#x2F;td&gt;&lt;td&gt;Batch reverted &lt;strong&gt;completely&lt;&#x2F;strong&gt; and only changes related to gas charge may have been included onchain (chain rules failure)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;600&lt;&#x2F;td&gt;&lt;td&gt;Batch reverted &lt;strong&gt;partially&lt;&#x2F;strong&gt; and some changes related to batch calls may have been included onchain (partial chain rules failure)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;More specific status codes within these categories should be proposed and agreed upon in separate ERCs.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;wallet-getcallsstatus-example-parameters&quot;&gt;&lt;code&gt;wallet_getCallsStatus&lt;&#x2F;code&gt; Example Parameters&lt;&#x2F;h5&gt;
&lt;p&gt;The &lt;code&gt;id&lt;&#x2F;code&gt; batch identifier is a unique 64 bytes represented as a hex encoded string returned from &lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x00000000000000000000000000000000000000000000000000000000000000000e670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;wallet-getcallsstatus-example-return-value&quot;&gt;&lt;code&gt;wallet_getCallsStatus&lt;&#x2F;code&gt; Example Return Value&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x00000000000000000000000000000000000000000000000000000000000000000e670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;status&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 200&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;atomic&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;receipts&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;logs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xa922b54716264130634d6ff183747a8ead91a40b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;topics&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x5a2a90727cc9d000dd060b1132a5c977c9702bb3a52afe360c9c22f0e9451a68&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xabcd&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;status&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;blockHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xf19bbafd9fd0124ec110b848e8de4ab4f62bf60c189524e54213285e7f540d4a&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;blockNumber&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xabcd&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gasUsed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xdef&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;transactionHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x9b7bb827c2e5e3c1a0a44dc53e573aa0b3af3bd1f9f5ed03071b100bb039eaff&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;wallet-showcallsstatus&quot;&gt;&lt;code&gt;wallet_showCallsStatus&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Requests that a wallet shows information about a given call bundle that was sent with &lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt;. Note that this method does not return anything for a known &lt;code&gt;id&lt;&#x2F;code&gt; batch identifier. If the identifier is not known, or in case of any other failure to execute &lt;code&gt;wallet_showCallsStatus&lt;&#x2F;code&gt; returns an RPC call error.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;wallet-showcallsstatus-rpc-specification&quot;&gt;&lt;code&gt;wallet_showCallsStatus&lt;&#x2F;code&gt; RPC Specification&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ShowCallsParams&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Call bundle identifier returned by wallet_sendCalls&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;wallet-showcallsstatus-example-parameters&quot;&gt;&lt;code&gt;wallet_showCallsStatus&lt;&#x2F;code&gt; Example Parameters&lt;&#x2F;h5&gt;
&lt;p&gt;This method accepts a call bundle identifier returned by a &lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt; call.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;wallet-getcapabilities&quot;&gt;&lt;code&gt;wallet_getCapabilities&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;This RPC allows an application to request capabilities from a wallet (e.g. batch transactions, paymaster communication), without distinct discovery and permission requests. For more on the difference between requesting capabilities and discovering features, see the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5792&#x2F;#privacy-considerations&quot;&gt;&quot;Privacy Considerations&quot; section&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This method SHOULD return an &lt;code&gt;4100 Unauthorized&lt;&#x2F;code&gt; error if the user has not already authorized a connection between the application and the requested address.&lt;&#x2F;p&gt;
&lt;p&gt;We expect the community to align on the definition of additional capabilities in separate ERCs over time.&lt;&#x2F;p&gt;
&lt;p&gt;Note that in addition to, or instead of, querying the wallet directly for capabilities, the same capability objects MAY be exposed out-of-band, such as in a &lt;code&gt;sessionProperties&lt;&#x2F;code&gt; and&#x2F;or &lt;code&gt;scopedProperties&lt;&#x2F;code&gt; collections persisted in a &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ChainAgnostic&#x2F;CAIPs&#x2F;blob&#x2F;c599f7601d0ce83e6dd9f350c6c21d158d56fd6d&#x2F;CAIPs&#x2F;caip-25.md&quot;&gt;CAIP-25&lt;&#x2F;a&gt;-conformant wallet provider interface (see the ethereum usage profile for CAIP-25 for an example request and response), or in some other a well-known location (such as a URL derived from an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6963&#x2F;&quot;&gt;EIP-6963&lt;&#x2F;a&gt; &lt;code&gt;rdns&lt;&#x2F;code&gt; identifier).
Provider abstractions MAY also cache capabilities from previous requests or otherwise inject them from out-of-band to facilitate better user experience.
If any of these supplemental expressions of capabilities are contradicted by capabilities expressed in live wallet RPC responses, these latter values SHOULD be taken as the canonical and current expression of capabilities.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;wallet-getcapabilities-rpc-specification&quot;&gt;&lt;code&gt;wallet_getCapabilities&lt;&#x2F;code&gt; RPC Specification&lt;&#x2F;h4&gt;
&lt;p&gt;Capabilities are returned in key&#x2F;value pairs, with the key naming a capability and a value conforming to a shape defined for that name, in an object keyed to the relevant &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt; &lt;code&gt;chainId&lt;&#x2F;code&gt; expressed in hexadecimal notation.
Capabilities are nested in per-chain objects because wallets may support different capabilities across multiple chains authorized in a given session.
Capabilities that the wallet supports on all the chains SHOULD be included only once, using a special &lt;code&gt;chainID&lt;&#x2F;code&gt; value &lt;code&gt;&quot;0x0&quot;&lt;&#x2F;code&gt;, and SHOULD NOT be repeated in nested per-chain objects.
If a wallet does not support a chain that is requested in the &lt;code&gt;wallet_getCapabilities&lt;&#x2F;code&gt; method, the wallet MUST NOT respond with an error, and MUST instead not include a key for the unsupported chain(s) in the response.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; GetCapabilitiesParams&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Wallet address, array of queried chain ids (optional)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; GetCapabilitiesResult&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Record&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Record&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; any&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;; &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Hex chain id&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;wallet-getcapabilities-example-parameters&quot;&gt;&lt;code&gt;wallet_getCapabilities&lt;&#x2F;code&gt; Example Parameters&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xd46e8dd67c5d32be8058bb8eb970870f07244567&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x2105&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x14A34&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;wallet-getcapabilities-example-return-value&quot;&gt;&lt;code&gt;wallet_getCapabilities&lt;&#x2F;code&gt; Example Return Value&lt;&#x2F;h5&gt;
&lt;p&gt;The capabilities below are for illustrative purposes.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;flow-control&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;supported&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;0x2105&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;paymasterService&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;supported&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;sessionKeys&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;supported&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;0x14A34&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;auxiliaryFunds&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;supported&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;atomic-capability&quot;&gt;&lt;code&gt;atomic&lt;&#x2F;code&gt; Capability&lt;&#x2F;h3&gt;
&lt;p&gt;Like the illustrative examples given above and other capabilities to be defined in future EIPs, the &lt;code&gt;atomic&lt;&#x2F;code&gt; capability specifies how the wallet will execute the batches of transactions requested through &lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt; method.&lt;&#x2F;p&gt;
&lt;p&gt;The valid JSON-RPC values for this &lt;code&gt;atomic&lt;&#x2F;code&gt; capability&#x27;s only property, &lt;code&gt;status&lt;&#x2F;code&gt;, are &lt;code&gt;supported&lt;&#x2F;code&gt;, &lt;code&gt;ready&lt;&#x2F;code&gt;, and &lt;code&gt;unsupported&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;supported&lt;&#x2F;code&gt; means that the wallet will execute the calls atomically and contiguously.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ready&lt;&#x2F;code&gt; means that the wallet is able to upgrade to &lt;code&gt;supported&lt;&#x2F;code&gt; pending user approval.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;unsupported&lt;&#x2F;code&gt; means that the wallet does not provide any atomicity or contiguity guarantees, nor will it suggest an upgrade to the user.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This capability is expressed separately on each chain and should be interpreted as a guarantee only for batches of transactions on that chain.&lt;&#x2F;p&gt;
&lt;p&gt;If the &lt;code&gt;atomic&lt;&#x2F;code&gt; capability is not present for a given chain, and unless it is explicitly overridden by another &lt;code&gt;capability&lt;&#x2F;code&gt; (not in scope of this EIP), it means that the wallet does not support batching for that given chain.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;atomic-capability-specification&quot;&gt;&lt;code&gt;atomic&lt;&#x2F;code&gt; Capability Specification&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AtomicCapability&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  status&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;supported&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ready&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unsupported&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;wallet-getcapabilities-example-return-value-including-atomic&quot;&gt;&lt;code&gt;wallet_getCapabilities&lt;&#x2F;code&gt; Example Return Value including &lt;code&gt;atomic&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;0x2105&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;atomic&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;status&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;supported&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;0x14A34&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;atomic&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;status&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unsupported&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;error-codes&quot;&gt;Error Codes&lt;&#x2F;h3&gt;
&lt;p&gt;The following error codes are defined for the methods specified in this EIP. These errors follow the JSON-RPC 2.0 specification for error objects, which require a &lt;code&gt;code&lt;&#x2F;code&gt; and &lt;code&gt;message&lt;&#x2F;code&gt; field.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Code&lt;&#x2F;th&gt;&lt;th&gt;Message&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;th&gt;Related RPCs&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;-32602&lt;&#x2F;td&gt;&lt;td&gt;Invalid params&lt;&#x2F;td&gt;&lt;td&gt;The wallet cannot parse this request (e.g., missing 0x prefix, leading zeros in chain id, request fails schema validation)&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt;, &lt;code&gt;wallet_getCallsStatus&lt;&#x2F;code&gt;, &lt;code&gt;wallet_showCallsStatus&lt;&#x2F;code&gt;, &lt;code&gt;wallet_getCapabilities&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;4001&lt;&#x2F;td&gt;&lt;td&gt;User Rejected Request&lt;&#x2F;td&gt;&lt;td&gt;The user rejected submitting the batch of calls (from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1193&#x2F;&quot;&gt;EIP-1193&lt;&#x2F;a&gt;)&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;4100&lt;&#x2F;td&gt;&lt;td&gt;Unauthorized&lt;&#x2F;td&gt;&lt;td&gt;The specified address is not connected or not in the wallet (from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1193&#x2F;&quot;&gt;EIP-1193&lt;&#x2F;a&gt;)&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt;, &lt;code&gt;wallet_getCapabilities&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;5700&lt;&#x2F;td&gt;&lt;td&gt;Unsupported non-optional capability&lt;&#x2F;td&gt;&lt;td&gt;This wallet does not support a capability that was not marked as optional&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;5710&lt;&#x2F;td&gt;&lt;td&gt;Unsupported chain id&lt;&#x2F;td&gt;&lt;td&gt;This wallet does not support the specified chain id&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;5720&lt;&#x2F;td&gt;&lt;td&gt;Duplicate ID&lt;&#x2F;td&gt;&lt;td&gt;There is already a bundle submitted with this id&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;5730&lt;&#x2F;td&gt;&lt;td&gt;Unknown bundle id&lt;&#x2F;td&gt;&lt;td&gt;This bundle id is unknown &#x2F; has not been submitted&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;wallet_getCallsStatus&lt;&#x2F;code&gt;, &lt;code&gt;wallet_showCallsStatus&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;5740&lt;&#x2F;td&gt;&lt;td&gt;Bundle too large&lt;&#x2F;td&gt;&lt;td&gt;The call bundle is too large for the wallet to process&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;5750&lt;&#x2F;td&gt;&lt;td&gt;Atomic-ready wallet rejected upgrade&lt;&#x2F;td&gt;&lt;td&gt;The wallet can support atomicity after an upgrade, but the user rejected the upgrade&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;5760&lt;&#x2F;td&gt;&lt;td&gt;Atomicity not supported&lt;&#x2F;td&gt;&lt;td&gt;The wallet does not support atomic execution but the request requires it&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;on-naming&quot;&gt;On Naming&lt;&#x2F;h3&gt;
&lt;p&gt;We considered modifying &lt;code&gt;eth_sendTransaction&lt;&#x2F;code&gt; to add support for these new capabilities, but the method is ultimately an artifact of when nodes were used to sign transactions. We decided it is better to move forward with &lt;code&gt;wallet_&lt;&#x2F;code&gt;-namespaced methods that better describe what they are used for.&lt;&#x2F;p&gt;
&lt;p&gt;We also debated whether the methods should be called &lt;code&gt;wallet_sendTransaction&lt;&#x2F;code&gt;, &lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt;, or something else. We ultimately landed on &lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt; because in the case of EOA wallets the &lt;code&gt;wallet_send*&lt;&#x2F;code&gt; method might send more than one transaction. Similarly, we decided against &lt;code&gt;wallet_sendTransactions&lt;&#x2F;code&gt; because in the case of other wallet implementations (e.g. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt;) multiple calls could result in a single transaction.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;call-execution-atomicity&quot;&gt;Call Execution Atomicity&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt; method accepts an array of &lt;code&gt;calls&lt;&#x2F;code&gt;. However, this proposal does not require that these calls be executed as part of a single transaction. It enables EOA wallets to express their ability to execute calls as part of a single transaction or as part of multiple transactions. It also enables Apps to express their minimum atomicity requirements for how calls must be executed.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;atomic&lt;&#x2F;code&gt; special capability was made an integral part of this specification in order promote expressiveness and facilitate adoption (from both wallets and apps). And due to its importance to reduce ambiguity between the App and the Wallet, the capability is expressed as a top-level field in the &lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt; request (through the &lt;code&gt;atomicRequired&lt;&#x2F;code&gt; parameter) and the &lt;code&gt;wallet_getCallsStatus&lt;&#x2F;code&gt; response (through the &lt;code&gt;atomic&lt;&#x2F;code&gt; field).&lt;&#x2F;p&gt;
&lt;p&gt;We initially proposed that multiple calls must be executed atomically, but after some debate we ultimately decided this was too opinionated. Instead, we are including a specification for an &lt;code&gt;atomic&lt;&#x2F;code&gt; capability. This allows for EOA wallets to accept multiple calls and still gives developers the option to only submit batched calls if they are executed atomically.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;call-gas-limit&quot;&gt;Call Gas Limit&lt;&#x2F;h3&gt;
&lt;p&gt;Our initial proposal included an optional &lt;code&gt;gas&lt;&#x2F;code&gt; field for each call in the &lt;code&gt;calls&lt;&#x2F;code&gt; field accepted by the &lt;code&gt;walletSendCalls&lt;&#x2F;code&gt; method. However, we realized this could be misleading because in the case of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt; wallets you cannot specify a gas limit per call, only a single gas limit for all calls in the user operation. We then proposed a single &lt;code&gt;gas&lt;&#x2F;code&gt; value that would apply to all of the calls. This works for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt; wallets, but not for EOA wallets. When we decided that EOA wallets should be able to handle multiple calls, the common &lt;code&gt;gas&lt;&#x2F;code&gt; field became untenable across use cases and we removed it altogether.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Wallets that do not support the methods defined here SHOULD return error responses when these new JSON-RPC methods are called. Apps MAY attempt to send the same batch of calls serially via &lt;code&gt;eth_sendTransaction&lt;&#x2F;code&gt; when a call to these methods fails for lack of wallet support, or they MAY indicate to the user that their wallet is not supported and the request was not processed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Regardless of the &lt;code&gt;atomic&lt;&#x2F;code&gt; value specified, App developers MUST NOT assume that all calls will be sent in a single transaction. An example could be an L2 resistant to reorgs that implements a sendBundle or similar functionality.&lt;&#x2F;p&gt;
&lt;p&gt;Wallets MUST ensure that batch identifiers returned by &lt;code&gt;wallet_sendCalls&lt;&#x2F;code&gt; are unpredictable to prevent malicious apps from inferring information about other users&#x27; transactions.&lt;&#x2F;p&gt;
&lt;p&gt;Wallets MUST NOT leak sensitive information in &lt;code&gt;wallet_getCallsStatus&lt;&#x2F;code&gt; &lt;code&gt;capabilities&lt;&#x2F;code&gt; responses.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;privacy-considerations&quot;&gt;Privacy Considerations&lt;&#x2F;h3&gt;
&lt;p&gt;Progressive authorization and progressive consent paradigms are important to modern user experience, as well as to preserving the anonymity of user agents. To protect these patterns from the cross-incentives of feature-discovery that enables better user experiences, capability semantics are used and the difference between lack of feature support and lack of feature permission explicitly occluded in the design of the &lt;code&gt;wallet_&lt;&#x2F;code&gt; RPC for querying capabilities.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore, wallets are recommended to avoid exposing capabilities to untrusted callers or to more callers than necessary, as this may allow their &quot;user-agent&quot; (i.e. client software) to be &quot;fingerprinted&quot; or probabilistically identified, which combined with other deanonymization vectors inherent to the web platform could contribute to the deanonymization of the individual user or to the deanonymization of all users of a given client in aggregate. Similarly, applications over-querying capabilities or incentivizing capability oversharing (including third-party capability oversharing) is an anti-pattern to be avoided in the implementation of capability exchanges serving to discover features.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Context-Dependent Multi-Asset Tokens</title>
        <published>2022-10-10T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Bruno Škvorc</name><uri>https://github.com/Swader</uri>
	</author>
	
	<author>
		<name>Cicada</name><uri>https://github.com/CicadaNCR</uri>
	</author>
	
	<author>
		<name>Steven Pineda</name><uri>https://github.com/steven2308</uri>
	</author>
	
	<author>
		<name>Stevan Bogosavljevic</name><uri>https://github.com/stevyhacker</uri>
	</author>
	
	<author>
		<name>Jan Turk</name><uri>https://github.com/ThunderDeliverer</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5773/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/multiresource-tokens/11326" />
        

        <id>https://wg-eips.ritovision.com/5773/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:5773"
            label="ERC-5773" />
        

        
        

        
        <summary type="html">An interface for Multi-Asset tokens with context dependent asset type output controlled by owner&#x27;s preference.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5773/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The Multi-Asset NFT standard allows for the construction of a new primitive: context-dependent output of information per single NFT.&lt;&#x2F;p&gt;
&lt;p&gt;The context-dependent output of information means that the asset in an appropriate format is displayed based on how the token is being accessed. I.e. if the token is being opened in an e-book reader, the PDF asset is displayed, if the token is opened in the marketplace, the PNG or the SVG asset is displayed, if the token is accessed from within a game, the 3D model asset is accessed and if the token is accessed by the (Internet of Things) IoT hub, the asset providing the necessary addressing and specification information is accessed.&lt;&#x2F;p&gt;
&lt;p&gt;An NFT can have multiple assets (outputs), which can be any kind of file to be served to the consumer, and orders them by priority. They do not have to match in mimetype or tokenURI, nor do they depend on one another. Assets are not standalone entities, but should be thought of as “namespaced tokenURIs” that can be ordered at will by the NFT owner, but only modified, updated, added, or removed if agreed on by both the owner of the token and the issuer of the token.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;With NFTs being a widespread form of tokens in the Ethereum ecosystem and being used for a variety of use cases, it is time to standardize additional utility for them. Having multiple assets associated with a single NFT allows for greater utility, usability and forward compatibility.&lt;&#x2F;p&gt;
&lt;p&gt;In the four years since &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; was published, the need for additional functionality has resulted in countless extensions. This EIP improves upon ERC-721 in the following areas:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5773&#x2F;#cross-metaverse-compatibility&quot;&gt;Cross-metaverse compatibility&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5773&#x2F;#multi-media-output&quot;&gt;Multi-media output&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5773&#x2F;#media-redundancy&quot;&gt;Media redundancy&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5773&#x2F;#nft-evolution&quot;&gt;NFT evolution&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;cross-metaverse-compatibility&quot;&gt;Cross-metaverse compatibility&lt;&#x2F;h3&gt;
&lt;p&gt;At the time of writing this proposal, the metaverse is still a fledgling, not full defined, term. No matter how the definition of metaverse evolves, the proposal can support any number of different implementations.&lt;&#x2F;p&gt;
&lt;p&gt;Cross-metaverse compatibility could also be referred to as cross-engine compatibility. An example of this is where a cosmetic item for game A is not available in game B because the frameworks are incompatible.&lt;&#x2F;p&gt;
&lt;p&gt;Such NFT can be given further utility by means of new additional assets: more games, more cosmetic items, appended to the same NFT. Thus, a game cosmetic item as an NFT becomes an ever-evolving NFT of infinite utility.&lt;&#x2F;p&gt;
&lt;p&gt;The following is a more concrete example. One asset is a cosmetic item for game A, a file containing the cosmetic assets. Another is a cosmetic asset file for game B. A third is a generic asset intended to be shown in catalogs, marketplaces, portfolio trackers, or other generalized NFT viewers, containing a representation, stylized thumbnail, and animated demo&#x2F;trailer of the cosmetic item.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP adds a layer of abstraction, allowing game developers to directly pull asset data from a user&#x27;s NFTs instead of hard-coding it.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;multi-media-output&quot;&gt;Multi-media output&lt;&#x2F;h3&gt;
&lt;p&gt;An NFT of an eBook can be represented as a PDF, MP3, or some other format, depending on what software loads it. If loaded into an eBook reader, a PDF should be displayed, and if loaded into an audiobook application, the MP3 representation should be used. Other metadata could be present in the NFT (perhaps the book&#x27;s cover image) for identification on various marketplaces, Search Engine Result Pages (SERPs), or portfolio trackers.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;media-redundancy&quot;&gt;Media redundancy&lt;&#x2F;h3&gt;
&lt;p&gt;Many NFTs are minted hastily without best practices in mind - specifically, many NFTs are minted with metadata centralized on a server somewhere or, in some cases, a hardcoded IPFS gateway which can also go down, instead of just an IPFS hash.&lt;&#x2F;p&gt;
&lt;p&gt;By adding the same metadata file as different assets, e.g., one asset of a metadata and its linked image on Arweave, one asset of this same combination on Sia, another of the same combination on IPFS, etc., the resilience of the metadata and its referenced information increases exponentially as the chances of all the protocols going down at once become less likely.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;nft-evolution&quot;&gt;NFT evolution&lt;&#x2F;h3&gt;
&lt;p&gt;Many NFTs, particularly game related ones, require evolution. This is especially the case in modern metaverses where no metaverse is actually a metaverse - it is just a multiplayer game hosted on someone&#x27;s server which replaces username&#x2F;password logins with reading an account&#x27;s NFT balance.&lt;&#x2F;p&gt;
&lt;p&gt;When the server goes down or the game shuts down, the player ends up with nothing (loss of experience) or something unrelated (assets or accessories unrelated to the game experience, spamming the wallet, incompatible with other “verses” - see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5773&#x2F;#cross-metaverse-compatibility&quot;&gt;cross-metaverse&lt;&#x2F;a&gt; compatibility above).&lt;&#x2F;p&gt;
&lt;p&gt;With Multi-Asset NFTs, a minter or another pre-approved entity is allowed to suggest a new asset to the NFT owner who can then accept it or reject it. The asset can even target an existing asset which is to be replaced.&lt;&#x2F;p&gt;
&lt;p&gt;Replacing an asset could, to some extent, be similar to replacing an ERC-721 token&#x27;s URI. When an asset is replaced a clear line of traceability remains; the old asset is still reachable and verifiable. Replacing an asset&#x27;s metadata URI obscures this lineage. It also gives more trust to the token owner if the issuer cannot replace the asset of the NFT at will. The propose-accept asset replacement mechanic of this proposal provides this assurance.&lt;&#x2F;p&gt;
&lt;p&gt;This allows level-up mechanics where, once enough experience has been collected, a user can accept the level-up. The level-up consists of a new asset being added to the NFT, and once accepted, this new asset replaces the old one.&lt;&#x2F;p&gt;
&lt;p&gt;As a concrete example, think of Pokemon™️ evolving - once enough experience has been attained, a trainer can choose to evolve their monster. With Multi-Asset NFTs, it is not necessary to have centralized control over metadata to replace it, nor is it necessary to airdrop another NFT into the user&#x27;s wallet - instead, a new Raichu asset is minted onto Pikachu, and if accepted, the Pikachu asset is gone, replaced by Raichu, which now has its own attributes, values, etc.&lt;&#x2F;p&gt;
&lt;p&gt;Alternative example of this, could be version control of an IoT device&#x27;s firmware. An asset could represent its current firmware and once an update becomes available, the current asset could be replaced with the one containing the updated firmware.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-5773 Context-Dependent Multi-Asset Tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-5773&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0x06b4329a.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.16&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5773&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is ERC165 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to notify listeners that an asset object is initialised at `assetId`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; assetId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the asset that was initialised&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AssetSet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; assetId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to notify listeners that an asset object at `assetId` is added to token&amp;#39;s pending asset&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  array.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of IDs of the tokens that received a new pending asset&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; assetId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the asset that has been added to the token&amp;#39;s pending assets array&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; replacesId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the asset that would be replaced&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AssetAddedToTokens&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; assetId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; replacesId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to notify listeners that an asset object at `assetId` is accepted by the token and migrated&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  from token&amp;#39;s pending assets array to active assets array of the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token that had a new asset accepted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; assetId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the asset that was accepted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; replacesId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the asset that was replaced&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AssetAccepted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; assetId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; replacesId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to notify listeners that an asset object at `assetId` is rejected from token and is dropped&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  from the pending assets array of the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token that had an asset rejected&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; assetId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the asset that was rejected&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AssetRejected&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; assetId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to notify listeners that token&amp;#39;s priority array is reordered.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token that had the asset priority array updated&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AssetPrioritySet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to notify listeners that owner has granted an approval to the user to manage the assets of a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  given token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Approvals must be cleared on transfer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the account that has granted the approval for all token&amp;#39;s assets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; approved&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the account that has been granted approval to manage the token&amp;#39;s assets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token on which the approval was granted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ApprovalForAssets&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approved&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to notify listeners that owner has granted approval to the user to manage assets of all of their&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the account that has granted the approval for all assets on all of their tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the account that has been granted the approval to manage the token&amp;#39;s assets on all of the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; approved&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Boolean value signifying whether the permission has been granted (`true`) or revoked (`false`)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ApprovalForAllForAssets&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Accepts an asset at from the pending array of given token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Migrates the asset from the token&amp;#39;s pending asset array to the token&amp;#39;s active asset array.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Active assets cannot be removed by anyone, but can be replaced by a new asset.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  - The caller must own the token or be approved to manage the token&amp;#39;s assets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  - `tokenId` must exist.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  - `index` must be in range of the length of the pending asset array.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emits an {AssetAccepted} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token for which to accept the pending asset&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; index&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Index of the asset in the pending array to accept&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; assetId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Id of the asset expected to be in the index&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; acceptAsset&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; index&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; assetId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Rejects an asset from the pending array of given token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Removes the asset from the token&amp;#39;s pending asset array.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  - The caller must own the token or be approved to manage the token&amp;#39;s assets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  - `tokenId` must exist.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  - `index` must be in range of the length of the pending asset array.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emits a {AssetRejected} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token that the asset is being rejected from&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; index&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Index of the asset in the pending array to be rejected&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; assetId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Id of the asset expected to be in the index&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; rejectAsset&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; index&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; assetId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Rejects all assets from the pending array of a given token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Effectively deletes the pending array.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  - The caller must own the token or be approved to manage the token&amp;#39;s assets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  - `tokenId` must exist.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emits a {AssetRejected} event with assetId = 0.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token of which to clear the pending array&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; maxRejections&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; to prevent from rejecting assets which arrive just before this operation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; rejectAllAssets&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; maxRejections&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sets a new priority array for a given token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The priority array is a non-sequential list of `uint16`s, where the lowest value is considered highest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  priority.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Value `0` of a priority is a special case equivalent to uninitialised.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  - The caller must own the token or be approved to manage the token&amp;#39;s assets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  - `tokenId` must exist.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  - The length of `priorities` must be equal the length of the active assets array.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emits a {AssetPrioritySet} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token to set the priorities for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; priorities&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An array of priorities of active assets. The succession of items in the priorities array&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  matches that of the succession of items in the active array&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setPriority&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; priorities&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to retrieve IDs of the active assets of given token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Asset data is stored by reference, in order to access the data corresponding to the ID, call&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  `getAssetMetadata(tokenId, assetId)`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; You can safely get 10k&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token to retrieve the IDs of the active assets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;[] An array of active asset IDs of the given token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getActiveAssets&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to retrieve IDs of the pending assets of given token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Asset data is stored by reference, in order to access the data corresponding to the ID, call&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  `getAssetMetadata(tokenId, assetId)`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token to retrieve the IDs of the pending assets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;[] An array of pending asset IDs of the given token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getPendingAssets&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to retrieve the priorities of the active assets of a given token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Asset priorities are a non-sequential array of uint16 values with an array size equal to active asset&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  priorites.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token for which to retrieve the priorities of the active assets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint16&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;[] An array of priorities of the active assets of the given token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getActiveAssetPriorities&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to retrieve the asset that will be replaced if a given asset from the token&amp;#39;s pending array&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  is accepted.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Asset data is stored by reference, in order to access the data corresponding to the ID, call&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  `getAssetMetadata(tokenId, assetId)`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token to check&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; newAssetId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the pending asset which will be accepted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the asset which will be replaced&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getAssetReplacements&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newAssetId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to fetch the asset metadata of the specified token&amp;#39;s active asset with the given index.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Can be overridden to implement enumerate, fallback or other custom logic.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token from which to retrieve the asset metadata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; assetId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Asset Id, must be in the active assets array&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The metadata of the asset belonging to the specified index in the token&amp;#39;s active assets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  array&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getAssetMetadata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; assetId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to grant permission to the user to manage token&amp;#39;s assets.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This differs from transfer approvals, as approvals are not cleared when the approved party accepts or&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  rejects an asset, or sets asset priorities. This approval is cleared on token transfer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Only a single account can be approved at a time, so approving the `0x0` address clears previous approvals.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  - The caller must own the token or be an approved operator.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  - `tokenId` must exist.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emits an {ApprovalForAssets} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the account to grant the approval to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token for which the approval to manage the assets is granted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approveForAssets&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to retrieve the address of the account approved to manage assets of a given token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  - `tokenId` must exist.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the token for which to retrieve the approved address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the account that is approved to manage the specified token&amp;#39;s assets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getApprovedForAssets&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to add or remove an operator of assets for the caller.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Operators can call {acceptAsset}, {rejectAsset}, {rejectAllAssets} or {setPriority} for any token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  owned by the caller.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  - The `operator` cannot be the caller.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emits an {ApprovalForAllForAssets} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the account to which the operator role is granted or revoked from&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; approved&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The boolean value indicating whether the operator role is being granted (`true`) or revoked&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  (`false`)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setApprovalForAllForAssets&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approved&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Used to check whether the address has been granted the operator role by a given address or not.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See {setApprovalForAllForAssets}.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the account that we are checking for whether it has granted the operator role&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the account that we are checking whether it has the operator role or not&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The boolean value indicating whether the account we are checking has been granted the operator role&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isApprovedForAllForAssets&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;getAssetMetadata&lt;&#x2F;code&gt; function returns the asset&#x27;s metadata URI. The metadata, to which the metadata URI of the asset points, MAY contain a JSON response with the following fields:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Asset Name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The description of the token or asset&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;mediaUri&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ipfs:&#x2F;&#x2F;mediaOfTheAssetOrToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;thumbnailUri&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ipfs:&#x2F;&#x2F;thumbnailOfTheAssetOrToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;externalUri&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;uriToTheProjectWebsite&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;license&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;License name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;licenseUri&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;uriToTheLicense&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;tags&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;tags&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;used&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;help&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;marketplaces&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;categorize&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;the&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;asset&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;or&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;token&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;preferThumb&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A boolean flag indicating to UIs to prefer thumbnailUri instead of mediaUri wherever applicable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;attributes&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;label&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;rarity&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;epic&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; For backward compatibility&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;rarity&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;label&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;color&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;red&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; For backward compatibility&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;color&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;label&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;height&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;float&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 192.4&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; For backward compatibility&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;height&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;display_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;While this is the suggested JSON schema for the asset metadata, it is not enforced and MAY be structured completely differently based on implementer&#x27;s preference.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Designing the proposal, we considered the following questions:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Should we use Asset or Resource when referring to the structure that comprises the token?&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
The original idea was to call the proposal Multi-Resource, but while this denoted the broadness of the structures that could be held by a single token, the term &lt;em&gt;asset&lt;&#x2F;em&gt; represents it better.&lt;br &#x2F;&gt;
An asset is defined as something that is owned by a person, company, or organization, such as money, property, or land. This is the best representation of what an asset of this proposal can be. An asset in this proposal can be a multimedia file, technical information, a land deed, or anything that the implementer has decided to be an asset of the token they are implementing.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Why are &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; permit-style signatures to manage approvals not used?&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
For consistency. This proposal extends ERC-721 which already uses 1 transaction for approving operations with tokens. It would be inconsistent to have this and also support signing messages for operations with assets.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Why use indexes?&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
To reduce the gas consumption. If the asset ID was used to find which asset to accept or reject, iteration over arrays would be required and the cost of the operation would depend on the size of the active or pending assets arrays. With the index, the cost is fixed. A list of active and pending assets arrays per token need to be maintained, since methods to get them are part of the proposed interface.&lt;br &#x2F;&gt;
To avoid race conditions in which the index of an asset changes, the expected asset ID is included in operations requiring asset index, to verify that the asset being accessed using the index is the expected asset.&lt;br &#x2F;&gt;
Implementation that would internally keep track of indices using mapping was attempted. The average cost of adding an asset to a token increased by over 25%, costs of accepting and rejecting assets also increased 4.6% and 7.1% respectively. We concluded that it is not necessary for this proposal and can be implemented as an extension for use cases willing to accept this cost. In the sample implementation provided, there are several hooks which make this possible.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Why is a method to get all the assets not included?&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
Getting all assets might not be an operation necessary for all implementers. Additionally, it can be added either as an extension, doable with hooks, or can be emulated using an indexer.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Why is pagination not included?&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
Asset IDs use &lt;code&gt;uint64&lt;&#x2F;code&gt;, testing has confirmed that the limit of IDs you can read before reaching the gas limit is around 30.000. This is not expected to be a common use case so it is not a part of the interface. However, an implementer can create an extension for this use case if needed.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;How does this proposal differ from the other proposals trying to address a similar problem?&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
After reviewing them, we concluded that each contains at least one of these limitations:
&lt;ul&gt;
&lt;li&gt;Using a single URI which is replaced as new assets are needed, this introduces a trust issue for the token owner.&lt;&#x2F;li&gt;
&lt;li&gt;Focusing only on a type of asset, while this proposal is asset type agnostic.&lt;&#x2F;li&gt;
&lt;li&gt;Having a different token for each new use case, this means that the token is not forward-compatible.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;multi-asset-storage-schema&quot;&gt;Multi-Asset Storage Schema&lt;&#x2F;h3&gt;
&lt;p&gt;Assets are stored within a token as an array of &lt;code&gt;uint64&lt;&#x2F;code&gt; identifiers.&lt;&#x2F;p&gt;
&lt;p&gt;In order to reduce redundant on-chain string storage, multi asset tokens store assets by reference via inner storage. An asset entry on the storage is stored via a &lt;code&gt;uint64&lt;&#x2F;code&gt; mapping to asset data.&lt;&#x2F;p&gt;
&lt;p&gt;An asset array is an array of these &lt;code&gt;uint64&lt;&#x2F;code&gt; asset ID references.&lt;&#x2F;p&gt;
&lt;p&gt;Such a structure allows that, a generic asset can be added to the storage one time, and a reference to it can be added to the token contract as many times as we desire. Implementers can then use string concatenation to procedurally generate a link to a content-addressed archive based on the base &lt;em&gt;SRC&lt;&#x2F;em&gt; in the asset and the &lt;em&gt;token ID&lt;&#x2F;em&gt;. Storing the asset in a new token will only take 16 bytes of storage in the asset array per token for recurrent as well as &lt;code&gt;tokenId&lt;&#x2F;code&gt; dependent assets.&lt;&#x2F;p&gt;
&lt;p&gt;Structuring token&#x27;s assets in such a way allows for URIs to be derived programmatically through concatenation, especially when they differ only by &lt;code&gt;tokenId&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;propose-commit-pattern-for-asset-addition&quot;&gt;Propose-Commit pattern for asset addition&lt;&#x2F;h3&gt;
&lt;p&gt;Adding assets to an existing token MUST be done in the form of a propose-commit pattern to allow for limited mutability by a 3rd party. When adding an asset to a token, it is first placed in the &lt;em&gt;&quot;Pending&quot;&lt;&#x2F;em&gt; array, and MUST be migrated to the &lt;em&gt;&quot;Active&quot;&lt;&#x2F;em&gt; array by the token&#x27;s owner. The &lt;em&gt;&quot;Pending&quot;&lt;&#x2F;em&gt; assets array SHOULD be limited to 128 slots to prevent spam and griefing.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;asset-management&quot;&gt;Asset management&lt;&#x2F;h3&gt;
&lt;p&gt;Several functions for asset management are included. In addition to permissioned migration from &quot;Pending&quot; to &quot;Active&quot;, the owner of a token MAY also drop assets from both the active and the pending array -- an emergency function to clear all entries from the pending array MUST also be included.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The MultiAsset token standard has been made compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; in order to take advantage of the robust tooling available for implementations of ERC-721 and to ensure compatibility with existing ERC-721 infrastructure.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Tests are included in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5773&#x2F;.&#x2F;assets&#x2F;test&#x2F;multiasset.ts&quot;&gt;&lt;code&gt;multiasset.ts&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;To run them in terminal, you can use the following commands:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cd ..&#x2F;assets&#x2F;eip-5773&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;npm install&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;npx hardhat test&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5773&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;MultiAssetToken.sol&quot;&gt;&lt;code&gt;MultiAssetToken.sol&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The same security considerations as with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; apply: hidden logic may be present in any of the functions, including burn, add asset, accept asset, and more.&lt;&#x2F;p&gt;
&lt;p&gt;Caution is advised when dealing with non-audited contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Lockable Extension for EIP-721</title>
        <published>2022-10-05T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Filipp Makarov</name><uri>https://github.com/filmakarov</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5753/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/lockable-nfts-extension/8800" />
        

        <id>https://wg-eips.ritovision.com/5753/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:5753"
            label="ERC-5753" />
        

        
        

        
        <summary type="html">Interface for disabling token transfers (locking) and re-enabling them (unlocking).</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5753/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is an extension of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt;. It introduces lockable NFTs. The locked asset can be used in any way except by selling and&#x2F;or transferring it. The owner or operator can lock the token. When a token is locked, the unlocker address (an EOA or a contract) is set. Only the unlocker is able to &lt;code&gt;unlock&lt;&#x2F;code&gt; the token.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;With NFTs, digital objects become digital goods, which are verifiably ownable, easily tradable, and immutably stored on the blockchain. That&#x27;s why it&#x27;s very important to continuously improve UX for non-fungible tokens, not just inherit it from one of the fungible tokens.&lt;&#x2F;p&gt;
&lt;p&gt;In DeFi there is an UX pattern when you lock your tokens on a service smart contract. For example, if you want to borrow some $DAI, you have to provide some $ETH as collateral for a loan. During the loan period this $ETH is being locked into the lending service contract. Such a pattern works for $ETH and other fungible tokens.&lt;&#x2F;p&gt;
&lt;p&gt;However, it should be different for NFTs because NFTs have plenty of use cases that require the NFT to stay in the holder&#x27;s wallet even when it is used as collateral for a loan. You may want to keep using your NFT as a verified PFP on Twitter, or use it to authorize a Discord server through collab.land. You may want to use your NFT in a P2E game. And you should be able to do all of this even during the lending period, just like you are able to live in your house even if it is mortgaged.&lt;&#x2F;p&gt;
&lt;p&gt;The following use cases are enabled for lockable NFTs:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;NFT-collateralised loans&lt;&#x2F;strong&gt; Use your NFT as collateral for a loan without locking it on the lending protocol contract. Lock it on your wallet instead and continue enjoying all the utility of your NFT.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;No collateral rentals of NFTs&lt;&#x2F;strong&gt; Borrow NFT for a fee, without a need for huge collateral. You can use NFT, but not transfer it, so the lender is safe. The borrowing service contract automatically transfers NFT back to the lender as soon as the borrowing period expires.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Primary sales&lt;&#x2F;strong&gt; Mint NFT for only the part of the price and pay the rest when you are satisfied with how the collection evolves.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Secondary sales&lt;&#x2F;strong&gt; Buy and sell your NFT by installments. Buyer gets locked NFT and immediately starts using it. At the same time he&#x2F;she is not able to sell the NFT until all the installments are paid. If full payment is not received, NFT goes back to the seller together with a fee.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;S is for Safety&lt;&#x2F;strong&gt; Use your exclusive blue chip NFTs safely and conveniently. The most convenient way to use NFT is together with MetaMask. However, MetaMask is vulnerable to various bugs and attacks. With &lt;code&gt;Lockable&lt;&#x2F;code&gt; extension you can lock your NFT and declare your safe cold wallet as an unlocker. Thus, you can still keep your NFT on MetaMask and use it conveniently. Even if a hacker gets access to your MetaMask, they won’t be able to transfer your NFT without access to the cold wallet. That’s what makes &lt;code&gt;Lockable&lt;&#x2F;code&gt; NFTs safe.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Metaverse ready&lt;&#x2F;strong&gt; Locking NFT tickets can be useful during huge Metaverse events. That will prevent users, who already logged in with an NFT, from selling it or transferring it to another user. Thus we avoid double usage of one ticket.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Non-custodial staking&lt;&#x2F;strong&gt; There are different approaches to non-custodial staking proposed by communities like CyberKongz, Moonbirds and other. Approach suggested in this impementation supposes that the token can only be staked in one place, not several palces at a time (it is like you can not deposit money in two bank accounts simultaneously). Also it doesn&#x27;t require any additional code and is available with just locking feature.
Another approach to the same concept is using locking to provide proof of HODL. You can lock your NFTs from selling as a manifestation of loyalty to the community and start earning rewards for that. It is better version of the rewards mechanism, that was originally introduced by The Hashmasks and their $NCT token.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Safe and convenient co-ownership and co-usage&lt;&#x2F;strong&gt; Extension of safe co-ownership and co-usage. For example, you want to purchase an expensive NFT asset together with friends, but it is not handy to use it with multisig, so you can safely rotate and use it between wallets. The NFT will be stored on one of the co-owners&#x27; wallet and he will be able to use it in any way (except transfers) without requiring multi-approval. Transfers will require multi-approval.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;EIP-721 compliant contracts MAY implement this EIP to provide standard methods of locking and unlocking the token at its current owner address.
If the token is locked, the &lt;code&gt;getLocked&lt;&#x2F;code&gt; function MUST return an address that is able to unlock the token.
For tokens that are not locked, the &lt;code&gt;getLocked&lt;&#x2F;code&gt; function MUST return &lt;code&gt;address(0)&lt;&#x2F;code&gt;.
The user MAY permanently lock the token by calling &lt;code&gt;lock(address(1), tokenId)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;When the token is locked, all the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; transfer functions MUST revert, except if the transaction has been initiated by an unlocker.
When the token is locked, the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; &lt;code&gt;approve&lt;&#x2F;code&gt; method MUST revert for this token.
When the token is locked, the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; &lt;code&gt;getApproved&lt;&#x2F;code&gt; method SHOULD return &lt;code&gt;unlocker&lt;&#x2F;code&gt; address for this token so the unlocker is able to transfer this token.
When the token is locked, the &lt;code&gt;lock&lt;&#x2F;code&gt; method MUST revert for this token, even when it is called with the same &lt;code&gt;unlocker&lt;&#x2F;code&gt; as argument.
When the locked token is transferred by an unlocker, the token MUST be unlocked after the transfer.&lt;&#x2F;p&gt;
&lt;p&gt;Marketplaces should call &lt;code&gt;getLocked&lt;&#x2F;code&gt; method of an EIP-721 Lockable token contract to learn whether a token with a specified tokenId is locked or not. Locked tokens SHOULD NOT be available for listings. Locked tokens can not be sold. Thus, marketplaces SHOULD hide the listing for the tokens that has been locked, because such orders can not be fulfilled.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;contract-interface&quot;&gt;Contract Interface&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; &amp;gt;=0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Interface for the Lockable extension&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ILockable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when `id` token is locked, and `unlocker` is stated as unlocking wallet.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Lock&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; unlocker&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when `id` token is unlocked.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Unlock&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Locks the `id` token and gives the `unlocker` address permission to unlock.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; lock&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; unlocker&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Unlocks the `id` token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; unlock&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the wallet, that is stated as unlocking wallet for the `tokenId` token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * If address(0) returned, that means token is not locked. Any other result means token is locked.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getLocked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; method MUST return &lt;code&gt;true&lt;&#x2F;code&gt; when called with &lt;code&gt;0x72b68110&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This approach proposes a solution that is designed to be as minimal as possible. It only allows to lock the item (stating who will be able to unlock it) and unlock it when needed if a user has permission to do it.&lt;&#x2F;p&gt;
&lt;p&gt;At the same time, it is a generalized implementation. It allows for a lot of extensibility and any of the potential use cases (or all of them), mentioned in the Motivation section.&lt;&#x2F;p&gt;
&lt;p&gt;When there is a need to grant temporary and&#x2F;or redeemable rights for the token (rentals, purchase with instalments) this EIP involves the real transfer of the token to the temporary user&#x27;s wallet, not just assigning a role.
This choice was made to increase compatibility with all the existing NFT eco-system tools and dApps, such as Collab.land. Otherwise, it would require from all of such dApps implementing additional interfaces and logic.&lt;&#x2F;p&gt;
&lt;p&gt;Naming and reference implementation for the functions and storage entities mimics that of Approval flow for [EIP-721] in order to be intuitive.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is compatible with current &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; standards.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; &amp;gt;=0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;#39;..&#x2F;ILockable.sol&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;#39;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC721&#x2F;ERC721.sol&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Lockable Extension for ERC721&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;abstract&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721Lockable&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ILockable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;                            LOCKABLE EXTENSION STORAGE                        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; unlockers&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;                              LOCKABLE LOGIC&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Public function to lock the token. Verifies if the msg.sender is the owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      or approved party.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; lock&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; unlocker&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; tokenOwner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; tokenOwner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isApprovedForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenOwner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;NOT_AUTHORIZED&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;unlockers&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;id&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ALREADY_LOCKED&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        unlockers&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;id&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; unlocker&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;unlocker&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Public function to unlock the token. Only the unlocker (stated at the time of locking) can unlock&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; unlock&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; unlockers&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;id&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;NOT_UNLOCKER&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        unlockers&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;id&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the unlocker for the tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      address(0) means token is not locked&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      reverts if token does not exist&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getLocked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_exists&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Lockable: locking query for nonexistent token&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; unlockers&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Locks the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _lock&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; unlocker&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        unlockers&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;id&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; unlocker&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Unlocks the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _unlock&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        unlockers&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;id&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;                              OVERRIDES&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getLocked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Can not approve locked token&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _beforeTokenTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if it is a Transfer or Burn&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;from &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; token should not be locked or msg.sender should be unlocker to do that&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getLocked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getLocked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;LOCKED&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _afterTokenTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if it is a Transfer or Burn, we always deal with one token, that is startTokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;from &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; clear locks&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            delete&lt;&#x2F;span&gt;&lt;span&gt; unlockers&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Optional override, if to clear approvals while the tken is locked&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getApproved&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getLocked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getApproved&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;                              ERC165 LOGIC&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        public&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        virtual&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        override&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;IERC721Lockable&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;There are no security considerations related directly to the implementation of this standard for the contract that manages &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; tokens.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;considerations-for-the-contracts-that-work-with-lockable-tokens&quot;&gt;Considerations for the contracts that work with lockable tokens&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Make sure that every contract that is stated as &lt;code&gt;unlocker&lt;&#x2F;code&gt; can actually unlock the token in all cases.&lt;&#x2F;li&gt;
&lt;li&gt;There are use cases, that involve transferring the token to a temporary owner and then lock it. For example, NFT rentals. Smart contracts that manage such services should always use &lt;code&gt;transferFrom&lt;&#x2F;code&gt; instead of &lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt; to avoid re-entrancies.&lt;&#x2F;li&gt;
&lt;li&gt;There are no MEV considerations regarding lockable tokens as only authorized parties are allowed to lock and unlock.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>The &#x27;window.evmproviders&#x27; object</title>
        <published>2022-10-04T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Kosala Hemachandra</name><uri>https://github.com/kvhnuke</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5749/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5749-deprecate-window-ethereum/11195" />
        

        <id>https://wg-eips.ritovision.com/5749/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="interface"
                label="Interface" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:5749"
            label="EIP-5749" />
        

        
        

        
        <summary type="html">Add &#x27;window.evmproviders&#x27; and suggest the eventual removal of &#x27;window.ethereum&#x27;</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5749/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;A Javascript Ethereum Provider interface injection that will allow for the interoperability of multiple browser wallets at the same time. Replacing &lt;code&gt;window.ethereum&lt;&#x2F;code&gt; with &lt;code&gt;window.evmproviders&lt;&#x2F;code&gt; is a simple solution that will provide multiple benefits including: improving user experience, encouraging innovation in the space, removing race conditions and a &#x27;winner-takes-most&#x27; environment as well as lowering barriers for user adoption.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;At present, &lt;code&gt;window.ethereum&lt;&#x2F;code&gt; is the prevailing method by which Ethereum-compatible applications interact with injected wallets. This originated with Mist Wallet in 2015 to interact with other applications. With the proliferation of both applications and wallets, &lt;code&gt;window.ethereum&lt;&#x2F;code&gt; has unintended negative consequences:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;window.ethereum&lt;&#x2F;code&gt; only permits one wallet to be injected at a time, resulting in a race condition between two or more wallets. This creates an inconsistent connection behavior that makes having and using more than one browser wallet unpredictable and impractical. The current solution is for wallets to inject their own namespaces, but this is not feasible as every application would need to be made aware of any wallet that might be used.&lt;&#x2F;li&gt;
&lt;li&gt;The aforementioned race condition means users are disincentivized to experiment with new wallets. This creates a &#x27;winner-takes-most&#x27; wallet market across EVM chains which forces application developers to optimize for a particular wallet experience.&lt;&#x2F;li&gt;
&lt;li&gt;The &#x27;winner-takes-most&#x27; wallet environment that results from the &lt;code&gt;window.ethereum&lt;&#x2F;code&gt; standard hinders innovation because it creates a barrier to adoption. New entrants into the space have difficulty gaining traction against legacy players because users can have no more than one injected wallet. With new entrants crowded out, legacy wallet providers are put under little pressure to innovate.&lt;&#x2F;li&gt;
&lt;li&gt;Wallets continue to be the most fundamental tool for interacting with blockchains. A homogeneous wallet experience in Ethereum and EVM chains risks stunting UX improvement across the ecosystem and will allow other ecosystems that are more encouraging of competition and innovation to move ahead.&lt;&#x2F;li&gt;
&lt;li&gt;Some wallets that currently use &lt;code&gt;window.ethereum&lt;&#x2F;code&gt; as of August, 2022. Currently a user will have inconsistent behavior if they use multiple of these wallets in a single browser.
&lt;ul&gt;
&lt;li&gt;Metamask&lt;&#x2F;li&gt;
&lt;li&gt;Coinbase wallet&lt;&#x2F;li&gt;
&lt;li&gt;Enkrypt&lt;&#x2F;li&gt;
&lt;li&gt;Trust wallet&lt;&#x2F;li&gt;
&lt;li&gt;Rainbow&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Replacing &lt;code&gt;window.ethereum&lt;&#x2F;code&gt; with &lt;code&gt;window.evmproviders&lt;&#x2F;code&gt; will allow solutions such as web3modal and web3onboard to display all injected wallets the user has installed. This will simplify the UX and remove race conditions between wallet providers in case multiple wallets are installed. Over time, as &lt;code&gt;window.evmproviders&lt;&#x2F;code&gt; supplants the current standard and removes barriers to choice, we can hope to see a wallet landscape more reflective of user preference.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;window-evmproviders&quot;&gt;&lt;code&gt;window.evmproviders={}&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * Represents the assets needed to display a wallet&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ProviderInfo&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;   &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * A UUIDv4 unique to the wallet provider.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * This must remain the same across versions but must be different across channels. For example, MetaMask, Trust wallet and Enkrypt should each have different UUIDs, but MetaMask 10.22.2 and MetaMask 9.8.1 should have the same UUID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;readonly&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    uuid&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * The name of the wallet provider (e.g. `MetaMask` or `Enkrypt`)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;readonly&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    name&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * A base64 encoded SVG image.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Base64 is defined in RFC 4648.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;readonly&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    icon&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;data:image&#x2F;svg+xml;base64,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * A description of the wallet provider.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;readonly&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    description&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * Represents the new Provider with info type that extends the EIP1193 provider&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ProviderWithInfo&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; extends&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; EIP1193Provider&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  	info&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ProviderInfo&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Type &lt;code&gt;EIP1193Provider&lt;&#x2F;code&gt; is documented at &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1193&#x2F;&quot;&gt;EIP-1193&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * The type of `window.evmproviders`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EVMProviders&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * The key is RECOMMENDED to be the name of the extension in snake_case. It MUST contain only lowercase letters, numbers, and underscores.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ProviderWithInfo&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Standardizing a &lt;code&gt;ProviderInfo&lt;&#x2F;code&gt; type allows determining the necessary information to populate a wallet selection popup. This is particularly useful for web3 onboarding libraries such as Web3Modal, Web3React, and Web3Onboard.&lt;&#x2F;p&gt;
&lt;p&gt;The name &lt;code&gt;evmproviders&lt;&#x2F;code&gt; was chosen to include other EVM-compliant chains.&lt;&#x2F;p&gt;
&lt;p&gt;The SVG image format was chosen for its flexibility, lightweight nature, and dynamic resizing capabilities.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP doesn&#x27;t require supplanting &lt;code&gt;window.ethereum&lt;&#x2F;code&gt;, so it doesn&#x27;t directly break existing applications. However, the recommended behavior of eventually supplanting &lt;code&gt;window.ethereum&lt;&#x2F;code&gt; would break existing applications that rely on it.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;injection&quot;&gt;Injection&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; provider&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ProviderWithInfo&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;your&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; wallet&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;window&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;evmproviders&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; window&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;evmproviders&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;window&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;evmproviders&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;name&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; provider&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;retrieving-all-evm-providers&quot;&gt;Retrieving all EVM providers&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; allproviders&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Object&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;values&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;window&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;evmproviders&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The security considerations of EIP-1193 apply to this EIP.&lt;&#x2F;p&gt;
&lt;p&gt;The use of SVG images introduces a cross-site scripting risk as they can include JavaScript code. Applications and libraries must render SVG images using the &lt;code&gt;&amp;lt;img&amp;gt;&lt;&#x2F;code&gt; tag to ensure no JS executions can happen.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>General Extensibility for Method Behaviors</title>
        <published>2022-10-04T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Zainan Victor Zhou</name><uri>https://github.com/xinbenlv</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5750/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-5750-method-with-extra-data/11176" />
        

        <id>https://wg-eips.ritovision.com/5750/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:5750"
            label="ERC-5750" />
        

        
        

        
        <summary type="html">Designating last param of dynamically sized bytes to be used for behavior extensions of methods.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5750/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP standardizes the passing of unstructured call data to functions to enable future extensibility.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The purpose of having extra data in a method is to allow further extensions to existing method interfaces.&lt;&#x2F;p&gt;
&lt;p&gt;It is it useful to make methods extendable. Any methods complying with this EIP, such as overloaded &lt;code&gt;transfer&lt;&#x2F;code&gt; and &lt;code&gt;vote&lt;&#x2F;code&gt; could use string reasons as the extra data. Existing EIPs that have exported methods compliant with this EIP can be extended for behaviors such as using the extra data to prove endorsement, as a salt, as a nonce, or as a commitment for a reveal&#x2F;commit scheme. Finally, data can be passed forward to callbacks.&lt;&#x2F;p&gt;
&lt;p&gt;There are two ways to achieve extensibility for existing functions. Each comes with their set of challenges:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Add a new method&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;ul&gt;
&lt;li&gt;What will the method name be?&lt;&#x2F;li&gt;
&lt;li&gt;What will the parameters be?&lt;&#x2F;li&gt;
&lt;li&gt;How many use-cases does a given method signature support?&lt;&#x2F;li&gt;
&lt;li&gt;Does this support off-chain signatures?&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;ol start=&quot;2&quot;&gt;
&lt;li&gt;Use one or more existing parameters, or add one or more new ones&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;ul&gt;
&lt;li&gt;Should existing parameters be repurposed, or should more be added?&lt;&#x2F;li&gt;
&lt;li&gt;How many parameters should be used?&lt;&#x2F;li&gt;
&lt;li&gt;What are their sizes and types?&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Standardizing how methods can be extended helps to answer these questions.&lt;&#x2F;p&gt;
&lt;p&gt;Finally, this EIP aims to achieve maximum backward and future compatibility. Many EIPs already partially support this EIP, such as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;EIP-1155&lt;&#x2F;a&gt;. This EIP supports many use cases, from commit-reveal schemes (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5732&#x2F;&quot;&gt;EIP-5732&lt;&#x2F;a&gt;), to adding digital signatures alongside with a method call. Other implementers and EIPs should be able to depend on the compatibility granted by this EIP so that all compliant method interfaces are eligible for future new behaviors.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;When used in this EIP, the term &lt;code&gt;bytes&lt;&#x2F;code&gt; MUST be interpreted as the dynamically-sized byte array in Solidity data types.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Unlike many other ERCs which is compliant at the &lt;code&gt;contract&lt;&#x2F;code&gt; level, this ERC&#x27;s specification specify compliance at &lt;code&gt;method&lt;&#x2F;code&gt; level.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Any method with a bytes as this method&#x27;s last parameter is an &lt;em&gt;eligible&lt;&#x2F;em&gt; method. It looks like this &lt;code&gt;function methodName(type1 value1, type2 value2, ... bytes data)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;A &lt;em&gt;compliant&lt;&#x2F;em&gt; method MUST be an &lt;em&gt;eligible&lt;&#x2F;em&gt; method and MUST also designate that last &lt;code&gt;bytes&lt;&#x2F;code&gt; field in its method parameter for behaviors extensions.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;If an &lt;em&gt;eligible&lt;&#x2F;em&gt; method has an overloaded sibling method that
has the exact same method name and exact same preceding parameters
except for not having the last &lt;code&gt;bytes&lt;&#x2F;code&gt; parameter, the behavior
of the compliant method MUST be identical to
its overloaded sibling method when last &lt;code&gt;bytes&lt;&#x2F;code&gt; is an empty array.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;examples-of-compliant-and-non-compliant-methods&quot;&gt;Examples of compliant and non-compliant methods&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;Here is a compliant method &lt;code&gt;methodName1&lt;&#x2F;code&gt; in a &lt;code&gt;Foo&lt;&#x2F;code&gt; contract&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Foo&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @dev This method allows extension behavior via `_data` field;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; methodName1&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _param1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _param2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; firstNonRelatedMethod&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; someValue&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; secondNonRelatedMethod&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; someValue&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ol start=&quot;2&quot;&gt;
&lt;li&gt;Here is a compliant method &lt;code&gt;methodName2&lt;&#x2F;code&gt; in a &lt;code&gt;Bar&lt;&#x2F;code&gt; contract which is an overloaded method for another &lt;code&gt;methodName2&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Foo&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @dev This is a sibling method to `methodName2(uint256 _param1, address _param2, bytes calldata _data);`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; methodName2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _param1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _param2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @dev This method allows extension behavior via `_data` field;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      When passed in an empty array for `_data` field, this method&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      MUST behave IDENTICAL to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      its overloaded sibling `methodName2(uint256 _param1, address _param2);`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; methodName2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _param1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _param2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; firstNonRelatedMethod&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; someValue&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; secondNonRelatedMethod&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; someValue&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ol start=&quot;3&quot;&gt;
&lt;li&gt;Here is a non-compliant method &lt;code&gt;methodName1&lt;&#x2F;code&gt; because it do not allow extending behavior&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Foo&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @dev This method DO NOT allow extension behavior via `_data` field;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; methodName1&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _param1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _param2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; firstNonRelatedMethod&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; someValue&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; secondNonRelatedMethod&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; someValue&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ol start=&quot;4&quot;&gt;
&lt;li&gt;Here is a non-compliant method
&lt;code&gt;methodName2(uint256 _param1, address _param2, bytes calldata _data);&lt;&#x2F;code&gt;
because it behaves differently
to its overloaded sibling method
&lt;code&gt;methodName2(uint256 _param1, address _param2);&lt;&#x2F;code&gt; when &lt;code&gt;_data&lt;&#x2F;code&gt; is empty array.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Foo&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @dev This is a sibling method to `methodName2(uint256 _param1, address _param2, bytes calldata _data);`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; methodName2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _param1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _param2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @dev This method allows extension behavior via `_data` field;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      When passed in an empty array for `_data` field, this method&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      behave DIFFERENTLY to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      its overloaded sibling `methodName2(uint256 _param1, address _param2);`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; methodName2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _param1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _param2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; firstNonRelatedMethod&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; someValue&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; secondNonRelatedMethod&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; someValue&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;Using the dynamically-sized &lt;code&gt;bytes&lt;&#x2F;code&gt; type allows for maximum flexibility by enabling payloads of arbitrary types.&lt;&#x2F;li&gt;
&lt;li&gt;Having the bytes specified as the last parameter makes this EIP compatible with the calldata layout of solidity.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Many existing EIPs already have compliant methods as part of their specification. All contracts compliant with those EIPs are either fully or partially compliant with this EIP.&lt;&#x2F;p&gt;
&lt;p&gt;Here is an incomplete list:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;In &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt;, the following method is already compliant:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;function safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes data) external payable;&lt;&#x2F;code&gt; is already compliant&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;In &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;EIP-1155&lt;&#x2F;a&gt;, the following methods are already compliant
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;function safeTransferFrom(address _from, address _to, uint256 _id, uint256 _value, bytes calldata _data) external;&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;function safeBatchTransferFrom(address _from, address _to, uint256[] calldata _ids, uint256[] calldata _values, bytes calldata _data) external;&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;In &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;777&#x2F;&quot;&gt;EIP-777&lt;&#x2F;a&gt;, the following methods are already compliant
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;function burn(uint256 amount, bytes calldata data) external;&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;function send(address to, uint256 amount, bytes calldata data) external;&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;However, not all functions that have a &lt;code&gt;bytes&lt;&#x2F;code&gt; as the last parameter are compliant. The following functions are not compliant without an overload since their last parameter is involved in functionality:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;In &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2535&#x2F;&quot;&gt;EIP-2535&lt;&#x2F;a&gt;, the following methods is not compliant:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;function diamondCut(FacetCut[] calldata _diamondCut, address _init, bytes calldata _calldata) external;&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Either&lt;&#x2F;strong&gt; of the following can be done to create a compliance.
&lt;ol&gt;
&lt;li&gt;An overload MUST be created: &lt;code&gt;function diamondCut(FacetCut[] calldata _diamondCut, address _init, bytes calldata _calldata, bytes calldata _data) external;&lt;&#x2F;code&gt; which adds a new &lt;code&gt;_data&lt;&#x2F;code&gt; after all parameters of original method.&lt;&#x2F;li&gt;
&lt;li&gt;The use of &lt;code&gt;bytes memory _calldata&lt;&#x2F;code&gt; MUST be relaxed to allow for extending behaviors.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;In &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;EIP-1271&lt;&#x2F;a&gt;, the following method is not compliant:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;function isValidSignature(bytes32 _hash, bytes memory _signature) public view returns (bytes4 magicValue);&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Either&lt;&#x2F;strong&gt; of the following can be done to create a compliance:
&lt;ol&gt;
&lt;li&gt;An new overload MUST be created: &lt;code&gt;function isValidSignature(bytes32 _hash, bytes memory _signature, bytes calldata _data) public view returns (bytes4 magicValue);&lt;&#x2F;code&gt; which adds a new &lt;code&gt;_data&lt;&#x2F;code&gt; after all parameters of original method.&lt;&#x2F;li&gt;
&lt;li&gt;The use of &lt;code&gt;bytes memory _signature&lt;&#x2F;code&gt; MUST be relaxed to allow for extending behaviors.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;If using the extra data for extended behavior, such as supplying signature for onchain verification, or supplying commitments in a commit-reveal scheme, best practices should be followed for those particular extended behaviors.&lt;&#x2F;li&gt;
&lt;li&gt;Compliant contracts must also take into consideration that the data parameter will be publicly revealed when submitted into the mempool or included in a block, so one must consider the risk of replay and transaction ordering attacks. &lt;strong&gt;Unencrypted personally identifiable information must never be included in the data parameter.&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Commit Interface</title>
        <published>2022-09-29T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Zainan Victor Zhou</name><uri>https://github.com/xinbenlv</uri>
	</author>
	
	<author>
		<name>Matt Stam</name><uri>https://github.com/mattstam</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5732/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-5732-simple-commit-interface-to-support-commit-reveal-schemes/11115" />
        

        <id>https://wg-eips.ritovision.com/5732/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:5732"
            label="ERC-5732" />
        

        
        

        
        <summary type="html">A simple but general commit interface to support commit-reveal scheme.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5732/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;A simple commit interface to support commit-reveal scheme which provides &lt;strong&gt;only&lt;&#x2F;strong&gt; a commit
method but no reveal method, allowing implementations to integrate this interface
with arbitrary reveal methods such as &lt;code&gt;vote&lt;&#x2F;code&gt; or &lt;code&gt;transfer&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;support commit-reveal privacy for applications such as voting.&lt;&#x2F;li&gt;
&lt;li&gt;make it harder for attackers for front-running, back-running or sandwich attacks.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;Interfaces referenced in this specification are as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; &amp;gt;=0.7.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0.9&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The EIP-165 identifier of this interface is 0xf14fcbc8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC_COMMIT_CORE&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; commit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _commitment&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; &amp;gt;=0.7.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0.9&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The EIP-165 identifier of this interface is 0x67b2ec2c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC_COMMIT_GENERAL&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Commit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _timePoint&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _commitment&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _extraData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; commitFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _commitment&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _extraData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; timePoint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;A compliant contract MUST implement the &lt;code&gt;IERC_COMMIT_CORE&lt;&#x2F;code&gt; interface.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;A compliant contract SHOULD implement the &lt;code&gt;IERC_COMMIT_GENERAL&lt;&#x2F;code&gt; interface.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;A compliant contract that implements the &lt;code&gt;IERC_COMMIT_GENERAL&lt;&#x2F;code&gt; interface MUST accept &lt;code&gt;commit(_commitment)&lt;&#x2F;code&gt; as equivalent to &lt;code&gt;commitFrom(msg.sender, _commitment, [&#x2F;*empty array*&#x2F;])&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;timePoint&lt;&#x2F;code&gt; return value of &lt;code&gt;commitFrom&lt;&#x2F;code&gt; is RECOMMENDED to use &lt;code&gt;block.timestamp&lt;&#x2F;code&gt; or &lt;code&gt;block.number&lt;&#x2F;code&gt; or a number that indicates the ordering of different commitments. When &lt;code&gt;commitFrom&lt;&#x2F;code&gt; is being called.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;A compliant contract that implements &lt;code&gt;IERC_COMMIT_GENERAL&lt;&#x2F;code&gt; MUST emit event &lt;code&gt;Commit&lt;&#x2F;code&gt; when a commitment is accepted and recorded. In the parameter of both &lt;code&gt;Commit&lt;&#x2F;code&gt; and the &lt;code&gt;commitFrom&lt;&#x2F;code&gt; method, the &lt;code&gt;_timePoint&lt;&#x2F;code&gt; is a time-point-representing value that represents ordering of commitments in which a latter commitment will always have a &lt;em&gt;greater or equal value&lt;&#x2F;em&gt; than a former commitment, such as &lt;code&gt;block.timestamp&lt;&#x2F;code&gt; or &lt;code&gt;block.number&lt;&#x2F;code&gt; or other time scale chosen by implementing contracts.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;extraData&lt;&#x2F;code&gt; is reserved for future behavior extension. If the &lt;code&gt;_from&lt;&#x2F;code&gt; is different from the TX signer, it is RECOMMENDED that compliant contract SHOULD validate signature for &lt;code&gt;_from&lt;&#x2F;code&gt;. For EOAs this will be validating its ECDSA signatures on chain. For smart contract accounts, it is RECOMMENDED to use &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;EIP-1271&lt;&#x2F;a&gt; to validate the signatures.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;One or more methods of a compliant contract MAY be used for reveal.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;But there MUST be a way to supply an extra field of &lt;code&gt;secret_salt&lt;&#x2F;code&gt;, so that committer can later open the &lt;code&gt;secret_salt&lt;&#x2F;code&gt; in the reveal TX that exposes the &lt;code&gt;secret_salt&lt;&#x2F;code&gt;. The size and location of &lt;code&gt;secret_salt&lt;&#x2F;code&gt; is intentionally unspecified in this EIP to maximize flexibility for integration.&lt;&#x2F;p&gt;
&lt;ol start=&quot;8&quot;&gt;
&lt;li&gt;It is RECOMMENDED for compliant contracts to implement &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;EIP-165&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;One design options is that we can attach a Commit Interface to any individual ERCs such as voting standards or token standards. We choose to have a simple and generalize commit interface so all ERCs can be extended to support commit-reveal without changing their basic method signatures.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The key derived design decision we made is we will have  a standardized &lt;code&gt;commit&lt;&#x2F;code&gt; method without a standardized &lt;code&gt;reveal&lt;&#x2F;code&gt; method, making room for customized reveal method or using &lt;code&gt;commit&lt;&#x2F;code&gt; with existing standard.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;We chose to have a simple one parameter method of &lt;code&gt;commit&lt;&#x2F;code&gt; in our Core interface to make it fully backward compatible with a few prior-adoptions e.g. ENS&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;We also add a &lt;code&gt;commitFrom&lt;&#x2F;code&gt; to easy commitment being generated off-chain and submitted by some account on behalf by another account.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is backward compatible with all existing ERCs method signature that has extraData. New EIPs can be designed with an extra field of &quot;salt&quot; to make it easier to support this EIP, but not required.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;IERC_COMMIT_CORE&lt;&#x2F;code&gt; is backward compatible with ENS implementations and other existing prior-art.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;commit-with-ens-register-as-reveal&quot;&gt;Commit with ENS Register as Reveal&lt;&#x2F;h3&gt;
&lt;p&gt;In ENS registering process, currently inside of &lt;code&gt;ETHRegistrarController&lt;&#x2F;code&gt; contract a commit function is being used to allow registerer fairly register a desire domain to avoid being front-run.&lt;&#x2F;p&gt;
&lt;p&gt;Here is how ENS uses commitment in its registration logic:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; commit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; commitment&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;commitments&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;commitment&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; maxCommitmentAge &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; now&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    commitments&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;commitment&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; now&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;With this EIP it can be updated to&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; commit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; commitment&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;commitments&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;commitment&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; maxCommitmentAge &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; now&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    commitments&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;commitment&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; now&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Commit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;Do not use the reference implementation in production. It is just for demonstration purposes.&lt;&#x2F;li&gt;
&lt;li&gt;The reveal transactions and parameters, especially &lt;code&gt;secret_salt&lt;&#x2F;code&gt;, MUST be kept secret before they are revealed.&lt;&#x2F;li&gt;
&lt;li&gt;The length of &lt;code&gt;secret_salt&lt;&#x2F;code&gt; must be cryptographically long enough and the random values used to generate &lt;code&gt;secret_salt&lt;&#x2F;code&gt; must be cryptographically safe.&lt;&#x2F;li&gt;
&lt;li&gt;Users must NEVER reuse a used &lt;code&gt;secret_salt&lt;&#x2F;code&gt;. It&#x27;s recommended for client applications to warn users who attempt to do so.&lt;&#x2F;li&gt;
&lt;li&gt;Contract implementations should consider deleting the commitment of a given sender immediately to reduce the chances of a replay attack or re-entry attack.&lt;&#x2F;li&gt;
&lt;li&gt;Contract implementations may consider including the ordering of commitment received to add restrictions on the order of reveal transactions.&lt;&#x2F;li&gt;
&lt;li&gt;There is potential for replay attacks across different chainIds or chains resulting from forks. In these cases, the chainId must be included in the generation of commitment. For applications with a higher risk of replay attacks, implementors should consider battle-tested and cryptographically-secure solutions such as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; to compose commitments before creating their own new solution.&lt;&#x2F;li&gt;
&lt;li&gt;Proper time gaps are suggested if the purpose is to avoid frontrunning attacks.&lt;&#x2F;li&gt;
&lt;li&gt;For compliant contract that requires the &lt;code&gt;_timePoint&lt;&#x2F;code&gt; from the next transaction to be &lt;em&gt;strictly greater&lt;&#x2F;em&gt; than that of any previous transaction, &lt;code&gt;block.timestamp&lt;&#x2F;code&gt; and &lt;code&gt;block.number&lt;&#x2F;code&gt; are not reliable as two transactions could co-exist in the same block resulting in the same &lt;code&gt;_timePoint&lt;&#x2F;code&gt; value. In such case, extra measures to enforce this strict monotonicity are required, such as the use of a separate sate variable in the contract to keep track of number of commits it receives, or to reject any second&#x2F;other TX that shares the same &lt;code&gt;block.timestamp&lt;&#x2F;code&gt; or &lt;code&gt;block.number&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Latent Fungible Token</title>
        <published>2022-09-29T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Cozy Finance</name><uri>https://github.com/cozyfinance</uri>
	</author>
	
	<author>
		<name>Tony Sheng</name><uri>https://github.com/tonysheng</uri>
	</author>
	
	<author>
		<name>Matt Solomon</name><uri>https://github.com/mds1</uri>
	</author>
	
	<author>
		<name>David Laprade</name><uri>https://github.com/davidlaprade</uri>
	</author>
	
	<author>
		<name>Payom Dousti</name><uri>https://github.com/payomdousti</uri>
	</author>
	
	<author>
		<name>Chad Fleming</name><uri>https://github.com/chad-js</uri>
	</author>
	
	<author>
		<name>Franz Chen</name><uri>https://github.com/Dendrimer</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5744/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5744-latent-fungible-token/11111" />
        

        <id>https://wg-eips.ritovision.com/5744/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:5744"
            label="ERC-5744" />
        

        
        

        
        <summary type="html">An interface for tokens that become fungible after a period of time.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5744/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The following standard is an extension of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;EIP-20&lt;&#x2F;a&gt; that enables tokens to become fungible after some initial non-fungible period.
Once minted, tokens are non-fungible until they reach maturity.
At maturity, they become fungible and can be transferred, traded, and used in any way that a standard EIP-20 token can be used.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Example use cases include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Receipt tokens that do not become active until a certain date or condition is met. For example, this can be used to enforce minimum deposit durations in lending protocols.&lt;&#x2F;li&gt;
&lt;li&gt;Vesting tokens that cannot be transferred or used until the vesting period has elapsed.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;All latent fungible tokens MUST implement EIP-20 to represent the token.
The &lt;code&gt;balanceOf&lt;&#x2F;code&gt; and &lt;code&gt;totalSupply&lt;&#x2F;code&gt; return quantities for all tokens, not just the matured, fungible tokens.
A new method called &lt;code&gt;balanceOfMatured&lt;&#x2F;code&gt; MUST be added to the ABI.
This method returns the balance of matured tokens for a given address:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOfMatured&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;An additional method called &lt;code&gt;getMints&lt;&#x2F;code&gt; MUST be added, which returns an array of all mint metadata for a given address:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MintMetadata&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Amount of tokens minted.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Timestamp of the mint, in seconds.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span&gt; time&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Delay in seconds until these tokens mature and become fungible. When the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; delay is not known (e.g. if it&amp;#39;s dependent on other factors aside from&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; simply elapsed time), this value must be `type(uint256).max`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span&gt; delay&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getMints&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;MintMetadata&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note that the implementation does not require that each of the above metadata parameters are stored as a &lt;code&gt;uint256&lt;&#x2F;code&gt;, just that they are returned as &lt;code&gt;uint256&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;An additional method called &lt;code&gt;mints&lt;&#x2F;code&gt; MAY be added.
This method returns the metadata for a mint based on its ID:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mints&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;MintMetadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The ID is not prescriptive—it may be an index in an array, or may be generated by other means.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;transfer&lt;&#x2F;code&gt; and &lt;code&gt;transferFrom&lt;&#x2F;code&gt; methods MAY be modified to revert when transferring tokens that have not matured.
Similarly, any methods that burn tokens MAY be modified to revert when burning tokens that have not matured.&lt;&#x2F;p&gt;
&lt;p&gt;All latent fungible tokens MUST implement EIP-20’s optional metadata extensions.
The &lt;code&gt;name&lt;&#x2F;code&gt; and &lt;code&gt;symbol&lt;&#x2F;code&gt; functions MUST reflect the underlying token’s &lt;code&gt;name&lt;&#x2F;code&gt; and &lt;code&gt;symbol&lt;&#x2F;code&gt; in some way.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;mints&lt;&#x2F;code&gt; method is optional because the ID is optional. In some use cases such as vesting where a user may have a maximum of one mint, an ID is not required.&lt;&#x2F;p&gt;
&lt;p&gt;Similarly, vesting use cases may want to enforce non-transferrable tokens until maturity, whereas lending receipt tokens with a minimum deposit duration may want to support transfers at all times.&lt;&#x2F;p&gt;
&lt;p&gt;It is possible that the number of mints held by a user is so large that it is impractical to return all of them in a single &lt;code&gt;eth_call&lt;&#x2F;code&gt;.
This is unlikely so it was not included in the spec.
If this is likely for a given use case, the implementer may choose to implement an alternative method that returns a subset of the mints, such as &lt;code&gt;getMints(address user, uint256 startId, uint256 endId)&lt;&#x2F;code&gt;.
However, if IDs are not sequential, a different signature may be required, and therefore this was not included in the specification.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal is fully backward compatible with the EIP-20 standard and has no known compatibility issues with other standards.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Iterating over large arrays of mints is not recommended, as this is very expensive and may cause the protocol, or just a user&#x27;s interactions with it, to be stuck if this exceeds the block gas limit and reverts. There are some ways to mitigate this, with specifics dependent on the implementation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Semi-Fungible Soulbound Token</title>
        <published>2022-09-28T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Austin Zhu</name><uri>https://github.com/AustinZhu</uri>
	</author>
	
	<author>
		<name>Terry Chen</name><email>terry.chen@phaneroz.io</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5727/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5727-semi-fungible-soulbound-token/11086" />
        

        <id>https://wg-eips.ritovision.com/5727/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:5727"
            label="ERC-5727" />
        

        
        

        
        <summary type="html">An interface for soulbound tokens, also known as badges or account-bound tokens, that can be both fungible and non-fungible.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5727/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;An interface for soulbound tokens (SBT), which are non-transferable tokens representing a person&#x27;s identity, credentials, affiliations, and reputation.&lt;&#x2F;p&gt;
&lt;p&gt;Our interface can handle a combination of fungible and non-fungible tokens in an organized way. It provides a set of core methods that can be used to manage the lifecycle of soulbound tokens, as well as a rich set of extensions that enables DAO governance, delegation, token expiration, and account recovery.&lt;&#x2F;p&gt;
&lt;p&gt;This interface aims to provide a flexible and extensible framework for the development of soulbound token systems.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The current Web3 ecosystem is heavily focused on financialized, transferable tokens. However, there&#x27;s a growing need for non-transferable tokens to represent unique personal attributes and rights. Existing attempts within the Ethereum community to create such tokens lack the necessary flexibility and extensibility. Our interface addresses this gap, offering a versatile and comprehensive solution for SBTs.&lt;&#x2F;p&gt;
&lt;p&gt;Our interface can be used to represent non-transferable ownerships, and provides features for common use cases including but not limited to:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Lifecycle Management: Robust tools for minting, revocation, and managing the subscription and expiration of SBTs.&lt;&#x2F;li&gt;
&lt;li&gt;DAO Governance and Delegation: Empower community-driven decisions and operational delegation for SBT management.&lt;&#x2F;li&gt;
&lt;li&gt;Account Recovery: Advanced mechanisms for account recovery and key rotation, ensuring security and continuity.&lt;&#x2F;li&gt;
&lt;li&gt;Versatility in Tokens: Support for both fungible and non-fungible SBTs, catering to a wide range of use cases like membership cards and loyalty programs.&lt;&#x2F;li&gt;
&lt;li&gt;Token Grouping: Innovative slot-based system for organizing SBTs, ideal for complex reward structures including vouchers, points, and badges.&lt;&#x2F;li&gt;
&lt;li&gt;Claimable SBTs: Streamlined distribution of SBTs for airdrops, giveaways, and referral programs.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This interface not only enriches the Web3 landscape but also paves the way for a more decentralized and personalized digital society.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;A token is identified by its &lt;code&gt;tokenId&lt;&#x2F;code&gt;, which is a 256-bit unsigned integer. A token can also have a value denoting its denomination.&lt;&#x2F;p&gt;
&lt;p&gt;A slot is identified by its &lt;code&gt;slotId&lt;&#x2F;code&gt;, which is a 256-bit unsigned integer. Slots are used to group fungible and non-fungible tokens together, thus make tokens semi-fungible. A token can only belong to one slot at a time.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;core&quot;&gt;Core&lt;&#x2F;h3&gt;
&lt;p&gt;The core methods are used to manage the lifecycle of SBTs. They MUST be supported by all semi-fungible SBT implementations.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC5727 Soulbound Token Interface&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The core interface of the ERC5727 standard.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5727&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC3525&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC5192&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC5484&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC4906&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST emit when a token is revoked.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token id&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Revoked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST emit when a token is verified.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; by&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address that initiated the verification&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token id&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; result&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The result of the verification&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Verified&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; by&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the verifier of a token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST revert if the `tokenId` does not exist&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the token for which to query the verifier&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address of the verifier of `tokenId`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verifierOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the issuer of a token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST revert if the `tokenId` does not exist&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the token for which to query the issuer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address of the issuer of `tokenId`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; issuerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Issue a token in a specified slot to an address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST revert if the `to` address is the zero address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      MUST revert if the `verifier` address is the zero address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to issue the token to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token id&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The slot to issue the token in&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; burnAuth&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The burn authorization of the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; verifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the verifier&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Additional data used to issue the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; issue&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; slot&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        BurnAuth&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; burnAuth&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; verifier&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Issue credit to a token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST revert if the `tokenId` does not exist.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token id&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of the credit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The additional data used to issue the credit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; issue&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Revoke a token from an address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST revert if the `tokenId` does not exist.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token id&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The additional data used to revoke the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revoke&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Revoke credit from a token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST revert if the `tokenId` does not exist.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token id&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of the credit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The additional data used to revoke the credit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revoke&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify if a token is valid.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST revert if the `tokenId` does not exist.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token id&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The additional data used to verify the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; A&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; boolean indicating whether the token is successfully verified&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;extensions&quot;&gt;Extensions&lt;&#x2F;h3&gt;
&lt;p&gt;All extensions below are OPTIONAL for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5727&#x2F;&quot;&gt;ERC-5727&lt;&#x2F;a&gt; implementations. An implementation MAY choose to implement some, none, or all of them.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;enumerable&quot;&gt;Enumerable&lt;&#x2F;h4&gt;
&lt;p&gt;This extension provides methods to enumerate the tokens of a owner. It is recommended to be implemented together with the core interface.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC5727 Soulbound Token Enumerable Interface&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This extension allows querying the tokens of a owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5727Enumerable&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC3525SlotEnumerable&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC5727&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the number of slots of a owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The owner whose number of slots is queried for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; number of slots of the `owner`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; slotCountOfOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the slot with `index` of the `owner`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST revert if the `index` exceed the number of slots of the `owner`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The owner whose slot is queried for.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; index&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The index of the slot queried for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; slot is queried for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; slotOfOwnerByIndex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; index&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the balance of a owner in a slot.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST revert if the slot does not exist.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The owner whose balance is queried for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The slot whose balance is queried for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; balance of the `owner` in the `slot`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ownerBalanceInSlot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;metadata&quot;&gt;Metadata&lt;&#x2F;h4&gt;
&lt;p&gt;This extension provides methods to fetch the metadata of a token, a slot and the contract itself. It is recommended to be implemented if you need to specify the appearance and properties of tokens, slots and the contract (i.e. the SBT collection).&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC5727 Soulbound Token Metadata Interface&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This extension allows querying the metadata of soulbound tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5727Metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC3525Metadata&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC5727&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;governance&quot;&gt;Governance&lt;&#x2F;h4&gt;
&lt;p&gt;This extension provides methods to manage the mint and revocation permissions through voting. It is useful if you want to rely on a group of voters to decide the issuance a particular SBT.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC5727 Soulbound Token Governance Interface&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This extension allows issuing of tokens by community voting.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5727Governance&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5727&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ApprovalStatus&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        Pending&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        Approved&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        Rejected&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        Removed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a token issuance approval is &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; approvalId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The id of the approval&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; creator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The creator of the approval, zero address if the approval is removed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; status&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The status of the approval&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ApprovalUpdate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approvalId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; creator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        ApprovalStatus&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; status&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a voter approves an approval.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voter&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The voter who approves the approval&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; approvalId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The id of the approval&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; voter&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approvalId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approve&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Create an approval of issuing a token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST revert if the caller is not a voter.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      MUST revert if the `to` address is the zero address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The owner which the token to mint to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The id of the token to mint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of the token to mint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The slot of the token to mint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; burnAuth&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The burn authorization of the token to mint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The additional data used to mint the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; requestApproval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; slot&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        BurnAuth&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; burnAuth&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; verifier&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Remove `approvalId` approval request.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST revert if the caller is not the creator of the approval request.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      MUST revert if the approval request is already approved or rejected or non-existent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; approvalId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The approval to remove&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; removeApprovalRequest&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approvalId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Approve `approvalId` approval request.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST revert if the caller is not a voter.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *     MUST revert if the approval request is already approved or rejected or non-existent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; approvalId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The approval to approve&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; approve&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; True if the approval is approved, false if the approval is rejected&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The additional data used to approve the approval (e.g. the signature, voting power)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; voteApproval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approvalId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approve&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the URI of the approval.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST revert if the `approvalId` does not exist.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; approvalId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The approval whose URI is queried for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; URI of the approval&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approvalURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approvalId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;delegate&quot;&gt;Delegate&lt;&#x2F;h4&gt;
&lt;p&gt;This extension provides methods to delegate (undelegate) mint right in a slot to (from) an operator. It is useful if you want to allow an operator to mint tokens in a specific slot on your behalf.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC5727 Soulbound Token Delegate Interface&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This extension allows delegation of issuing and revocation of tokens to an operator.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5727Delegate&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5727&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a token issuance is delegated to an operator.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The owner to which the issuing right is delegated&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The slot to issue the token in&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Delegate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; slot&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a token issuance is revoked from an operator.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The owner to which the issuing right is delegated&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The slot to issue the token in&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UnDelegate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; slot&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Delegate rights to `operator` for a slot.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST revert if the caller does not have the right to delegate.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      MUST revert if the `operator` address is the zero address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      MUST revert if the `slot` is not a valid slot.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The owner to which the issuing right is delegated&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The slot to issue the token in&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; delegate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; slot&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Revoke rights from `operator` for a slot.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST revert if the caller does not have the right to delegate.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      MUST revert if the `operator` address is the zero address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      MUST revert if the `slot` is not a valid slot.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The owner to which the issuing right is delegated&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The slot to issue the token in&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; undelegate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; slot&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check if an operator has the permission to issue or revoke tokens in a slot.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The operator to check&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The slot to check&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isOperatorFor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;recovery&quot;&gt;Recovery&lt;&#x2F;h4&gt;
&lt;p&gt;This extension provides methods to recover tokens from a stale owner. It is recommended to use this extension so that users are able to retrieve their tokens from a compromised or old wallet in certain situations. The signing scheme SHALL be compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; for readability and usability.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC5727 Soulbound Token Recovery Interface&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This extension allows recovering soulbound tokens from an address provided its signature.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5727Recovery&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5727&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when the tokens of `owner` are recovered.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The owner whose tokens are recovered&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The new owner of the tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Recovered&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Recover the tokens of `owner` with `signature`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST revert if the signature is invalid.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The owner whose tokens are recovered&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The signature signed by the `owner`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; recover&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;expirable&quot;&gt;Expirable&lt;&#x2F;h4&gt;
&lt;p&gt;This extension provides methods to manage the expiration of tokens. It is useful if you want to expire&#x2F;invalidate tokens after a certain period of time.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC5727 Soulbound Token Expirable Interface&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This extension allows soulbound tokens to be expirable and renewable.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5727Expirable&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5727&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC5643&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Set the expiry date of a token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST revert if the `tokenId` token does not exist.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      MUST revert if the `date` is in the past.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token whose expiry date is set&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; expiration&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The expire date to set&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; isRenewable&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Whether the token is renewable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setExpiration&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expiration&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; isRenewable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;token-storage-model&quot;&gt;Token storage model&lt;&#x2F;h3&gt;
&lt;p&gt;We adopt semi-fungible token storage models designed to support both fungible and non-fungible tokens, inspired by the semi-fungible token standard. We found that such a model is better suited to the representation of SBT than the model used in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Firstly, each slot can be used to represent different categories of SBTs. For instance, a DAO can have membership SBTs, role badges, reputations, etc. in one SBT collection.&lt;&#x2F;p&gt;
&lt;p&gt;Secondly, unlike &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt;, in which each unit of fungible tokens is exactly the same, our interface can help differentiate between similar tokens. This is justified by that credential scores obtained from different entities differ not only in value but also in their effects, validity periods, origins, etc. However, they still share the same slot as they all contribute to a person&#x27;s credibility, membership, etc.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;recovery-mechanism&quot;&gt;Recovery mechanism&lt;&#x2F;h3&gt;
&lt;p&gt;To prevent the loss of SBTs, we propose a recovery mechanism that allows users to recover their tokens by providing a signature signed by their owner address. This mechanism is inspired by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;ERC-1271&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Since SBTs are bound to an address and are meant to represent the identity of the address, which cannot be split into fractions. Therefore, each recovery should be considered as a transfer of all the tokens of the owner. This is why we use the &lt;code&gt;recover&lt;&#x2F;code&gt; function instead of &lt;code&gt;transferFrom&lt;&#x2F;code&gt; or &lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes a new token interface which is compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3525&#x2F;&quot;&gt;ERC-3525&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4906&#x2F;&quot;&gt;ERC-4906&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5192&#x2F;&quot;&gt;ERC-5192&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5484&#x2F;&quot;&gt;ERC-5484&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP is also compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Our sample implementation includes test cases written using Hardhat.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;You can find our reference implementation &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5727&#x2F;.&#x2F;assets&#x2F;ERC5727.sol&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP does not involve the general transfer of tokens, and thus there will be no security issues related to token transfer generally.&lt;&#x2F;p&gt;
&lt;p&gt;However, users should be aware of the security risks of using the recovery mechanism. If a user loses his&#x2F;her private key, all his&#x2F;her soulbound tokens will be exposed to potential theft. The attacker can create a signature and restore all SBTs of the victim. Therefore, users should always keep their private keys safe. We recommend developers implement a recovery mechanism that requires multiple signatures to restore SBTs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Signature replacement interface</title>
        <published>2022-09-26T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Agustin Aguilar</name><uri>https://github.com/Agusx1211</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5719/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-signature-replacing-for-smart-contract-wallets/11059" />
        

        <id>https://wg-eips.ritovision.com/5719/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:5719"
            label="ERC-5719" />
        

        
        

        
        <summary type="html">Non-interactive replacing of smart contract wallet signatures that became stale due to configuration changes.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5719/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Smart contract wallet signed messages can become stale, meaning a signature that once was valid could become invalid at any point.&lt;&#x2F;p&gt;
&lt;p&gt;Signatures MAY become stale for reasons like:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The internal set of signers changed&lt;&#x2F;li&gt;
&lt;li&gt;The wallet makes signatures expirable&lt;&#x2F;li&gt;
&lt;li&gt;The contract was updated to a new implementation&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The following standard allows smart contract wallets to expose a URI that clients can use to replace a stale signature with a valid one.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;In contrast to EOA signatures, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;EIP-1271&lt;&#x2F;a&gt; signatures are not necessarily idempotent; they can become invalid at any point in time. This poses a challenge to protocols that rely on signatures remaining valid for extended periods of time.&lt;&#x2F;p&gt;
&lt;p&gt;A signature MAY need to be mutated due to one of the following scenarios:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The wallet removes a signer that contributed to signing the initial message.&lt;&#x2F;li&gt;
&lt;li&gt;The wallet uses a Merkle tree to store signers, adding a new signer.&lt;&#x2F;li&gt;
&lt;li&gt;The wallet uses a Merkle tree to store signatures, adding new signatures.&lt;&#x2F;li&gt;
&lt;li&gt;The wallet is updated to a new implementation, and the signature schema changes.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Non-interactive signature replacement SHOULD be possible, since the wallet that originally signed the message MAY NOT be available when the signature needs to be validated. An example use-case is the settlement of a trade in an exchange that uses an off-chain order book.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The wallet contract MUST implement the following function:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getAlternativeSignature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _digest&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The returned string MUST be a URI pointing to a JSON object with the following schema:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Signature alternative&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;blockHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A block.hash on which the signature should be valid.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The alternative signature for the given digest.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;client-process-for-replacing-a-signature&quot;&gt;Client process for replacing a signature&lt;&#x2F;h3&gt;
&lt;p&gt;A client is an entity that holds a signature and intends to validate it, either for off-chain or on-chain use. To use the smart contract wallet signature, the client MUST perform the following actions:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Try validating the signature using &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;EIP-1271&lt;&#x2F;a&gt;; if the signature is valid, then the signature can be used as-is.&lt;&#x2F;li&gt;
&lt;li&gt;If the signature is not valid, call &lt;code&gt;getAlternativeSignature(_digest)&lt;&#x2F;code&gt;, passing the &lt;code&gt;digest&lt;&#x2F;code&gt; corresponding to the old signature.&lt;&#x2F;li&gt;
&lt;li&gt;If the call fails, no URI is returned, or the content of the URI is not valid, then the signature MUST be considered invalid.&lt;&#x2F;li&gt;
&lt;li&gt;Try validating the new signature using &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;EIP-1271&lt;&#x2F;a&gt;; if the signature is valid, it can be used as a drop-in replacement of the original signature.&lt;&#x2F;li&gt;
&lt;li&gt;If the validation fails, repeat the process from step (2) (notice: if the URI returns the same signature, the signature MUST be considered invalid).&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Clients MUST implement a retry limit when fetching alternative signatures. This limit is up to the client to define.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;A URI is chosen because it can accommodate centralized and decentralized solutions. For example, a server can implement live re-encoding for Merkle proofs, or an IPFS link could point to a directory with all the pre-computed signature mutations.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;getAlternativeSignature&lt;&#x2F;code&gt; method points to an off-chain source because it&#x27;s expected that the smart contract wallet doesn&#x27;t contain on-chain records for all signed digests, if that were the case then such contract wouldn&#x27;t need to use this EIP since it could directly validate the &lt;code&gt;digest&lt;&#x2F;code&gt; on&lt;code&gt;isValidSignature&lt;&#x2F;code&gt; ignoring the stale signature.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Existing wallets that do not implement the &lt;code&gt;getAlternativeSignature&lt;&#x2F;code&gt; method can still sign messages without any changes; if any signatures become invalidated, clients will drop them on step (3).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Some applications use signatures as secrets; these applications would risk leaking such secrets if the EIP exposes the signatures.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Bindable Token Interface</title>
        <published>2022-09-22T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Leeren</name><uri>https://github.com/leeren</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5700/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5700-bindable-token-standard/11077" />
        

        <id>https://wg-eips.ritovision.com/5700/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:5700"
            label="ERC-5700" />
        

        
        

        
        <summary type="html">Interface for binding fungible and non-fungible tokens to assets.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5700/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard defines an interface for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; tokens, known as &quot;bindables&quot;, to &quot;bind&quot; to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; NFTs.&lt;&#x2F;p&gt;
&lt;p&gt;When bindable tokens &quot;bind&quot; to an NFT, even though their ownership is transferred to the NFT, the NFT owner may &quot;unbind&quot; the tokens and claim their ownership. This enables bindable tokens to transfer with their bound NFTs without extra cost, offering a more effective way to create and transfer N:1 token-to-NFT bundles. Until an NFT owner decides to unbind them, bound tokens stay locked and resume their base token functionalities after unbinding.&lt;&#x2F;p&gt;
&lt;p&gt;This standard supports various use-cases such as:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;NFT-bundled physical assets like microchipped streetwear, digitized car collections, and digitally twinned real estate.&lt;&#x2F;li&gt;
&lt;li&gt;NFT-bundled digital assets such as accessorizable virtual wardrobes, composable music tracks, and customizable metaverse land.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;A standard interface for NFT binding offers a seamless and efficient way to bundle and transfer tokens with NFTs, ensuring compatibility with wallets, marketplaces, and other NFT applications. It eliminates the need for rigid, implementation-specific strategies for token ownership.&lt;&#x2F;p&gt;
&lt;p&gt;In contrast with other standards that deal with token ownership at the account level, this standard aims to address token ownership at the NFT level. Its objective is to build a universal interface for token bundling, compatible with existing &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; standards.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;erc-721-bindable&quot;&gt;ERC-721 Bindable&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;Smart contracts implementing the ERC-721 bindable standard MUST implement the &lt;code&gt;IERC721Bindable&lt;&#x2F;code&gt; interface.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Implementers of the &lt;code&gt;IER721Bindable&lt;&#x2F;code&gt; interface MUST return &lt;code&gt;true&lt;&#x2F;code&gt; if &lt;code&gt;0x82a34a7d&lt;&#x2F;code&gt; is passed as the identifier to the &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; function.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-721 Bindable Token Standard&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See https:&#x2F;&#x2F;eips.ethereum.org&#x2F;ERCS&#x2F;eip-5700&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;  Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0x82a34a7d.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC721Bindable&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is IERC721 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This event emits when an unbound token is bound to an NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address approved to perform the binding.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the unbound token owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bindAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The contract address of the NFT being bound to.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bindId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier of the NFT being bound to.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier of binding token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Bind&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bindAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bindId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This event emits when an NFT-bound token is unbound.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address approved to perform the unbinding.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The owner of the NFT the token is bound to.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the new unbound token owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bindAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The contract address of the NFT being unbound from.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bindId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier of the NFT being unbound from.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier of the unbinding token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Unbind&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bindAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bindId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Binds token `tokenId` to NFT `bindId` at address `bindAddress`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The function MUST throw unless `msg.sender` is the current owner, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  an authorized operator, or the approved address for the token. It also&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  MUST throw if the token is already bound or if `from` is not the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  owner. Finally, it MUST throw if the NFT contract does not support the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  ERC-721 interface or if the NFT being bound to does not exist. Before &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  binding, token ownership MUST be transferred to the contract address of&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  the NFT. On bind completion, the function MUST emit `Transfer` &amp;amp; `Bind` &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  events to reflect the implicit token transfer and subsequent bind.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the unbound token owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bindAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The contract address of the NFT being bound to.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bindId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier of the NFT being bound to.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier of the binding token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; bind&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bindAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bindId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Unbinds token `tokenId` from NFT `bindId` at address `bindAddress`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The function MUST throw unless `msg.sender` is the current owner, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  an authorized operator, or the approved address for the NFT the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  is bound to. It also MUST throw if the token is unbound, if `from` is&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  not the owner of the bound NFT, or if `to` is the zero address. After&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  unbinding, token ownership MUST be transferred to `to`, during which&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  the function MUST check if `to` is a valid contract (code size &amp;gt; 0),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  and if so, call `onERC721Received`, throwing if the wrong identifier is&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  returned. On unbind completion, the function MUST emit `Unbind` &amp;amp;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  `Transfer` events to reflect the unbind and subsequent transfer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the owner of the NFT the token is bound to.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the unbound token new owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bindAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The contract address of the NFT being unbound from.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bindId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier of the NFT being unbound from.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier of the unbinding token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; unbind&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bindAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bindId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Gets the NFT address and identifier token `tokenId` is bound to.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; When the token is unbound, this function MUST return the zero&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  address for the address portion to indicate no binding exists.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier of the token being queried.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; token-bound NFT contract address and numerical identifier.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; binderOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Gets total tokens bound to NFT `bindId` at address `bindAddress`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bindAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The contract address of the NFT being queried.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bindId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier of the NFT being queried.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; total number of tokens bound to the queried NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; boundBalanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bindAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bindId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;erc-1155-bindable&quot;&gt;ERC-1155 Bindable&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;Smart contracts implementing the ERC-1155 Bindable standard MUST implement the &lt;code&gt;IERC1155Bindable&lt;&#x2F;code&gt; interface.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Implementers of the &lt;code&gt;IER1155Bindable&lt;&#x2F;code&gt; interface MUST return &lt;code&gt;true&lt;&#x2F;code&gt; if &lt;code&gt;0xd0d55c6&lt;&#x2F;code&gt; is passed as the identifier to the &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; function.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-1155 Bindable Token Standard&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See https:&#x2F;&#x2F;eips.ethereum.org&#x2F;ERCS&#x2F;eip-5700&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;  Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0xd0d555c6.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC1155Bindable&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is IERC1155 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This event emits when token(s) are bound to an NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address approved to perform the binding.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The owner address of the unbound tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bindAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The contract address of the NFT being bound to.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bindId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier of the NFT being bound to.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier of the binding token type.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The number of tokens binding to the NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Bind&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bindAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bindId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This event emits when token(s) of different types are bound to an NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address approved to perform the batch binding.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The owner address of the unbound tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bindAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The contract address of the NFTs being bound to.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bindId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier of the NFT being bound to.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifiers of the binding token types.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amounts&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The number of tokens per type binding to the NFTs.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BindBatch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bindAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bindId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amounts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This event emits when token(s) are unbound from an NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address approved to perform the unbinding.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The owner address of the NFT the tokens are bound to.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the unbound tokens&amp;#39; new owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bindAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The contract address of the NFT being unbound from.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bindId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier of the NFT being unbound from.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier of the unbinding token type.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The number of tokens unbinding from the NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Unbind&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bindAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bindId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This event emits when token(s) of different types are unbound from an NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address approved to perform the batch binding.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The owner address of the unbound tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the unbound tokens&amp;#39; new owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bindAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The contract address of the NFTs being unbound from.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bindId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier of the NFT being unbound from.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifiers of the unbinding token types.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amounts&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The number of tokens per type unbinding from the NFTs.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UnbindBatch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bindAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bindId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amounts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Binds `amount` tokens of `tokenId` to NFT `bindId` at address `bindAddress`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The function MUST throw unless `msg.sender` is an approved operator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  for `from`. It also MUST throw if the `from` owns fewer than `amount`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  tokens. Finally, it MUST throw if the NFT contract does not support the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  ERC-721 interface or if the NFT being bound to does not exist. Before &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  binding, tokens MUST be transferred to the contract address of the NFT. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  On bind completion, the function MUST emit `Transfer` &amp;amp; `Bind` events &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  to reflect the implicit token transfers and subsequent bind.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The owner address of the unbound tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bindAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The contract address of the NFT being bound to.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bindId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier of the NFT being bound to.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier of the binding token type.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The number of tokens binding to the NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; bind&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bindAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bindId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Binds `amounts` tokens of `tokenIds` to NFT `bindId` at address `bindAddress`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The function MUST throw unless `msg.sender` is an approved operator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  for `from`. It also MUST throw if the length of `amounts` is not the &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  same as `tokenIds`, or if any balances of `tokenIds` for `from` is less&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  than that of `amounts`. Finally, it MUST throw if the NFT contract does &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  not support the ERC-721 interface or if the bound NFT does not exist. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  Before binding, tokens MUST be transferred to the contract address of &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  the NFT. On bind completion, the function MUST emit `TransferBatch` and&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  `BindBatch` events to reflect the batch token transfers and bind.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The owner address of the unbound tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bindAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The contract address of the NFTs being bound to.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bindId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier of the NFT being bound to.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifiers of the binding token types.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amounts&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The number of tokens per type binding to the NFTs.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; batchBind&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bindAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bindId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amounts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Unbinds `amount` tokens of `tokenId` from NFT `bindId` at address `bindAddress`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The function MUST throw unless `msg.sender` is an approved operator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  for `from`. It also MUST throw if `from` is not the owner of the bound&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  NFT, if the NFT&amp;#39;s token balance is fewer than `amount`, or if `to` is &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  the zero address. After unbinding, tokens MUST be transferred to `to`,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  during which the function MUST check if `to` is a valid contract (code &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  size &amp;gt; 0), and if so, call `onERC1155Received`, throwing if the wrong \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  identifier is returned. On unbind completion, the function MUST emit &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  `Unbind` &amp;amp; `Transfer` events to reflect the unbind and transfers.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The owner address of the NFT the tokens are bound to.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the unbound tokens&amp;#39; new owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bindAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The contract address of the NFT being unbound from.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bindId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier of the NFT being unbound from.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier of the unbinding token type.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The number of tokens unbinding from the NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; unbind&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bindAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bindId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Unbinds `amount` tokens of `tokenId` from NFT `bindId` at address `bindAddress`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The function MUST throw unless `msg.sender` is an approved operator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  for `from`. It also MUST throw if the length of `amounts` is not the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  same as `tokenIds`, if any balances of `tokenIds` for the NFT is less &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  than that of `amounts`, or if `to` is the zero addresss. After &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  unbinding, tokens MUST be transferred to `to`, during which the &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  function MUST check if `to` is a valid contract (code size &amp;gt; 0), and if &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  so, call `onERC1155BatchReceived`, throwing if the wrong identifier is &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  returned. On unbind completion, the function MUST emit `UnbindBatch` &amp;amp; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  `TransferBatch` events to reflect the batch unbind and transfers.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The owner address of the unbound tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the unbound tokens&amp;#39; new owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bindAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The contract address of the NFTs being unbound from.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bindId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier of the NFT being unbound from.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifiers of the unbinding token types.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amounts&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The number of tokens per type unbinding from the NFTs.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; batchUnbind&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bindAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bindId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amounts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Gets the number of tokens of type `tokenId` bound to NFT `bindId` at address `bindAddress`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bindAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The contract address of the bound NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bindId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier of the bound NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier of the token type bound to the NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; number of tokens of type `tokenId` bound to the NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; boundBalanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bindAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bindId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Gets the number of tokens of types `bindIds` bound to NFTs `bindIds` at address `bindAddress`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bindAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The contract address of the bound NFTs.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bindIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifiers of the bound NFTs.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifiers of the token types bound to the NFTs.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; balances&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The bound balances for each token type &#x2F; NFT pair.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; boundBalanceOfBatch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bindAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bindIds&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; balances&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;A standard for token binding unlocks a new layer of composability for allowing wallets, applications, and protocols to interact with, trade, and display bundled NFTs. One example use-case of this is at Dopamine, where streetwear garments may be bundled with digital assets such as music, avatars, or digital-twins of the garments, by representing these assets as bindable tokens and binding them to microchips represented as NFTs.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;binding-mechanism&quot;&gt;Binding Mechanism&lt;&#x2F;h3&gt;
&lt;p&gt;During binding, a bindable token&#x27;s technical ownership is conferred to its bound NFT, while allowing the NFT owner to unbind at any time. A caveat of this lightweight design is that applications that have yet to adopt this standard will not show the bundled tokens as owned by the NFT owner.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The bindable token interface is designed to be compatible with existing ERC-721 and ERC-1155 standards.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5700&#x2F;.&#x2F;assets&#x2F;erc721&#x2F;ERC721Bindable.sol&quot;&gt;ERC-721 Bindable&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5700&#x2F;.&#x2F;assets&#x2F;erc1155&#x2F;ERC1155Bindable.sol&quot;&gt;ERC-1155 Bindable&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;During binding, because ownership is conferred to the bound NFT contract, implementations should take caution in ensuring unbinding may only be performed by the designated NFT owner.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Token Minting and Burning</title>
        <published>2022-09-17T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Zainan Victor Zhou</name><uri>https://github.com/xinbenlv</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5679/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-5679-mint-and-burn-tokens/10913" />
        

        <id>https://wg-eips.ritovision.com/5679/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:5679"
            label="ERC-5679" />
        

        
        

        
        <summary type="html">An extension for minting and burning EIP-20, EIP-721, and EIP-1155 tokens</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5679/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a consistent way to extend token standards for minting and burning.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Minting and Burning are typical actions for creating and destroying tokens.
By establishing a consistent way to mint and burn a token, we complete the basic lifecycle.&lt;&#x2F;p&gt;
&lt;p&gt;Some implementations of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;EIP-1155&lt;&#x2F;a&gt;
have been able to use &lt;code&gt;transfer&lt;&#x2F;code&gt; methods or the-like
to mint and burn tokens. However, minting and burning change token supply. The access controls
of minting and burning also usually follow different rules than transfer.
Therefore, creating separate methods for burning and minting simplifies implementations
and reduces security error.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Any contract complying with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;EIP-20&lt;&#x2F;a&gt; when extended with this EIP,
&lt;strong&gt;MUST&lt;&#x2F;strong&gt; implement the following interface:&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The EIP-165 identifier of this interface is 0xd0017968&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5679Ext20&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; burn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ol start=&quot;2&quot;&gt;
&lt;li&gt;Any contract complying with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; when extended with this EIP,
&lt;strong&gt;MUST&lt;&#x2F;strong&gt; implement the following interface:&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The EIP-165 identifier of this interface is 0xcce39764&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5679Ext721&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeMint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; burn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ol start=&quot;3&quot;&gt;
&lt;li&gt;Any contract complying with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;EIP-1155&lt;&#x2F;a&gt; when extended with this EIP,
&lt;strong&gt;MUST&lt;&#x2F;strong&gt; implement the following interface:&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The EIP-165 identifier of this interface is 0xf4cedd5a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5679Ext1155&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeMint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeMintBatch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ids&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amounts&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; burn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; burnBatch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ids&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amounts&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ol start=&quot;4&quot;&gt;
&lt;li&gt;
&lt;p&gt;When the token is being minted, the transfer events &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be emitted as if
the token in the &lt;code&gt;_amount&lt;&#x2F;code&gt; for EIP-20 and EIP-1155 and token id being &lt;code&gt;_id&lt;&#x2F;code&gt; for EIP-721 and EIP-1155
were transferred from address &lt;code&gt;0x0&lt;&#x2F;code&gt; to the recipient address identified by &lt;code&gt;_to&lt;&#x2F;code&gt;.
The total supply &lt;strong&gt;MUST&lt;&#x2F;strong&gt; increase accordingly.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;When the token is being burned, the transfer events &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be emitted as if
the token in the &lt;code&gt;_amount&lt;&#x2F;code&gt; for EIP-20 and EIP-1155 and token id being &lt;code&gt;_id&lt;&#x2F;code&gt; for EIP-721 and EIP-1155
were transferred from the recipient address identified by &lt;code&gt;_to&lt;&#x2F;code&gt; to the address of &lt;code&gt;0x0&lt;&#x2F;code&gt;.
The total supply &lt;strong&gt;MUST&lt;&#x2F;strong&gt; decrease accordingly.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;safeMint&lt;&#x2F;code&gt; MUST implement the same receiver restrictions as &lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt; as defined in
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;EIP-1155&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;It&#x27;s RECOMMENDED for the client to implement &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;EIP-165&lt;&#x2F;a&gt; identifiers as specified above.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;It&#x27;s possible that the interface be consolidated to the same as EIP-1155 which is always bearing &lt;code&gt;_amount&lt;&#x2F;code&gt; field,
regardless of whether it&#x27;s a EIP-20, EIP-721 or EIP-1155. But we choose that each ERC token should have their own
standard way of representing the amount of token to follow the same way of &lt;code&gt;_id&lt;&#x2F;code&gt; and &lt;code&gt;_amount&lt;&#x2F;code&gt; in their original
token standard.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;We have chosen to identify the interface with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;EIP-165&lt;&#x2F;a&gt; identifiers each individually,
instead of having a single identifier because the signatures of interface are different.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;We have chosen NOT to create new events but to require the usage of existing transfer event as required by EIP-20
EIP-721 and EIP-1155 for maximum compatibility.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;We have chosen to add &lt;code&gt;safeMintBatch&lt;&#x2F;code&gt; and &lt;code&gt;burnBatch&lt;&#x2F;code&gt; methods for EIP-1155 but not for EIP-721 to follow the
convention of EIP-721 and EIP-1155 respectively.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;We have not add extension for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;777&#x2F;&quot;&gt;EIP-777&lt;&#x2F;a&gt; because it already handles Minting and Burning.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is designed to be compatible for EIP-20, EIP-721 and EIP-1155 respectively.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP depends on the security soundness of the underlying book keeping behavior of the token implementation.
In particular, a token contract should carefully design the access control for which role is granted permission
to mint a new token. Failing to safe guard such behavior can cause fraudulent issuance and an elevation of total supply.&lt;&#x2F;p&gt;
&lt;p&gt;The burning should also carefully design the access control. Typically only the following two roles are entitled to burn a token:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Role 1. The current token holder&lt;&#x2F;li&gt;
&lt;li&gt;Role 2. An role with special privilege.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Either Role 1 OR Role 2 or a consensus between the two are entitled to conduct the burning action.
However as author of this EIP we do recognize there are potentially other use case where a third type of role shall be entitled
to burning. We keep this EIP less opinionated in such restriction but implementors should be cautious about designing
the restriction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Token State Fingerprint</title>
        <published>2022-09-11T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Naim Ashhab</name><uri>https://github.com/ashhanai</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5646/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5646-discussion-token-state-fingerprint/10808" />
        

        <id>https://wg-eips.ritovision.com/5646/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:5646"
            label="ERC-5646" />
        

        
        

        
        <summary type="html">Unambiguous token state identifier</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5646/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This specification defines the minimum interface required to unambiguously identify the state of a mutable token without knowledge of implementation details.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, protocols need to know about tokens&#x27; state properties to create the unambiguous identifier. Unfortunately, this leads to an obvious bottleneck in which protocols need to support every new token specifically.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5646&#x2F;.&#x2F;assets&#x2F;support-per-abi.png&quot; alt=&quot;&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, and &quot;MAY&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC5646&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC165&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Function to return current token state fingerprint.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Id of a token state in &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;question&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Current&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; token state fingerprint.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getStateFingerprint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;getStateFingerprint&lt;&#x2F;code&gt; MUST return a different value when the token state changes.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;getStateFingerprint&lt;&#x2F;code&gt; MUST NOT return a different value when the token state remains the same.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;getStateFingerprint&lt;&#x2F;code&gt; MUST include all state properties that might change during the token lifecycle (are not immutable).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;getStateFingerprint&lt;&#x2F;code&gt; MAY include computed values, such as values based on a current timestamp (e.g., expiration, maturity).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;getStateFingerprint&lt;&#x2F;code&gt; MAY include token metadata URI.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;supportsInterface(0xf5112315)&lt;&#x2F;code&gt; MUST return &lt;code&gt;true&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Protocols can use state fingerprints as a part of a token identifier and support mutable tokens without knowing any state implementation details.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5646&#x2F;.&#x2F;assets&#x2F;support-per-eip.png&quot; alt=&quot;&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;State fingerprints don&#x27;t have to factor in state properties that are immutable, because they can be safely identified by a token id.&lt;&#x2F;p&gt;
&lt;p&gt;This standard is not for use cases where token state property knowledge is required, as these cases cannot escape the bottleneck problem described earlier.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is not introducing any backward incompatibilities.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Example of a mutable token implementing state fingerprint.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; LPToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC5646&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Stored token states (token id =&amp;gt; state).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; State&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; states&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; State&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; asset1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; asset2&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; amount1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; amount2&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; fee&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Immutable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Immutable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; expiration&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Parameter dependent on a block.timestamp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; State fingerprint getter.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Id of a token state in &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;question&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Current&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; token state fingerprint.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getStateFingerprint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        State &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;storage&lt;&#x2F;span&gt;&lt;span&gt; state &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; states&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;asset1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;asset2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amount1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amount2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;                &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; state.fee don&amp;#39;t need to be part of the fingerprint computation as it is immutable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;                &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; state.operator don&amp;#39;t need to be part of the fingerprint computation as it is immutable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;                block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;expiration&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ERC5646&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;interfaceId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Token state fingerprints from two different contracts may collide. Because of that, they should be compared only in the context of one token contract.&lt;&#x2F;p&gt;
&lt;p&gt;If the &lt;code&gt;getStateFingerprint&lt;&#x2F;code&gt; implementation does not include all parameters that could change the token state, a token owner would be able to change the token state without changing the token fingerprint. It could break the trustless assumptions of several protocols, which create, e.g., buy offers for tokens. The token owner would be able to change the state of the token before accepting an offer.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Subscription NFTs</title>
        <published>2022-09-10T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>cygaar</name><uri>https://github.com/cygaar</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5643/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5643-subscription-nfts/10802" />
        

        <id>https://wg-eips.ritovision.com/5643/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:5643"
            label="ERC-5643" />
        

        
        

        
        <summary type="html">Add subscription-based functionality to EIP-721 tokens</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5643/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is an extension of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt;. It proposes an additional interface for NFTs to be used as recurring, expirable subscriptions. The interface includes functions to renew and cancel the subscription.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;NFTs are commonly used as accounts on decentralized apps or membership passes to communities, events, and more. However, it is currently rare to see NFTs like these that have a finite expiration date. The &quot;permanence&quot; of the blockchain often leads to memberships that have no expiration dates and thus no required recurring payments. However, for many real-world applications, a paid subscription is needed to keep an account or membership valid.&lt;&#x2F;p&gt;
&lt;p&gt;The most prevalent on-chain application that makes use of the renewable subscription model is the Ethereum Name Service (ENS), which utilizes a similar interface to the one proposed below. Each domain can be renewed for a certain period of time, and expires if payments are no longer made. A common interface will make it easier for future projects to develop subscription-based NFTs. In the current Web2 world, it&#x27;s hard for a user to see or manage all of their subscriptions in one place. With a common standard for subscriptions, it will be easy for a single application to determine the number of subscriptions a user has, see when they expire, and renew&#x2F;cancel them as requested.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, as the prevalence of secondary royalties from NFT trading disappears, creators will need new models for generating recurring income. For NFTs that act as membership or access passes, pivoting to a subscription-based model is one way to provide income and also force issuers to keep providing value.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5643&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a subscription expiration changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; When a subscription is canceled, the expiration value should also be 0.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SubscriptionUpdate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expiration&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Renews the subscription to an NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws if `tokenId` is not a valid NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT to renew the subscription for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; duration&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The number of seconds to extend a subscription for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; renewSubscription&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; duration&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Cancels the subscription of an NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws if `tokenId` is not a valid NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT to cancel the subscription for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; cancelSubscription&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Gets the expiration date of a subscription&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws if `tokenId` is not a valid NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT to get the expiration date of&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; expiration date of the subscription&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; expiresAt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Determines whether a subscription can be renewed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws if `tokenId` is not a valid NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT to get the expiration date of&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; renewability of a the subscription&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isRenewable&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;expiresAt(uint256 tokenId)&lt;&#x2F;code&gt; function MAY be implemented as &lt;code&gt;pure&lt;&#x2F;code&gt; or &lt;code&gt;view&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;isRenewable(uint256 tokenId)&lt;&#x2F;code&gt; function MAY be implemented as &lt;code&gt;pure&lt;&#x2F;code&gt; or &lt;code&gt;view&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;renewSubscription(uint256 tokenId, uint64 duration)&lt;&#x2F;code&gt; function MAY be implemented as &lt;code&gt;external&lt;&#x2F;code&gt; or &lt;code&gt;public&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;cancelSubscription(uint256 tokenId)&lt;&#x2F;code&gt; function MAY be implemented as &lt;code&gt;external&lt;&#x2F;code&gt; or &lt;code&gt;public&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;SubscriptionUpdate&lt;&#x2F;code&gt; event MUST be emitted whenever the expiration date of a subscription is changed.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; method MUST return &lt;code&gt;true&lt;&#x2F;code&gt; when called with &lt;code&gt;0x8c65f84d&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This standard aims to make on-chain subscriptions as simple as possible by adding the minimal required functions and events for implementing on-chain subscriptions. It is important to note that in this interface, the NFT itself represents ownership of a subscription, there is no facilitation of any other fungible or non-fungible tokens.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;subscription-management&quot;&gt;Subscription Management&lt;&#x2F;h3&gt;
&lt;p&gt;Subscriptions represent agreements to make advanced payments in order to receive or participate in something. In order to facilitate these agreements, a user must be able to renew or cancel their subscriptions hence the &lt;code&gt;renewSubscription&lt;&#x2F;code&gt; and &lt;code&gt;cancelSubscription&lt;&#x2F;code&gt; functions. It also important to know when a subscription expires - users will need this information to know when to renew, and applications need this information to determine the validity of a subscription NFT. The &lt;code&gt;expiresAt&lt;&#x2F;code&gt; function provides this functionality. Finally, it is possible that a subscription may not be renewed once expired. The &lt;code&gt;isRenewable&lt;&#x2F;code&gt; function gives users and applications that information.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;easy-integration&quot;&gt;Easy Integration&lt;&#x2F;h3&gt;
&lt;p&gt;Because this standard is fully EIP-721 compliant, existing protocols will be able to facilitate the transfer of subscription NFTs out of the box. With only a few functions to add, protocols will be able to fully manage a subscription&#x27;s expiration, determine whether a subscription is expired, and see whether it can be renewed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This standard can be fully EIP-721 compatible by adding an extension function set.&lt;&#x2F;p&gt;
&lt;p&gt;The new functions introduced in this standard add minimal overhead to the existing EIP-721 interface, which should make adoption straightforward and quick for developers.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;The following tests require Foundry.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.13&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;forge-std&#x2F;Test.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;..&#x2F;src&#x2F;ERC5643.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC5643Mock&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC5643&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; symbol_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC5643&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;name_, symbol_) &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC5643Test&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Test&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SubscriptionUpdate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expiration&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; user1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ERC5643Mock erc5643&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setUp&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        tokenId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        user1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        erc5643 &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC5643Mock&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;erc5369&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC5643&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        erc5643&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;user1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; testRenewalValid&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        vm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;warp&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        vm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;prank&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;user1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        vm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;expectEmit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SubscriptionUpdate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        erc5643&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;renewSubscription&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; testRenewalNotOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        vm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;expectRevert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;Caller is not owner nor approved&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        erc5643&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;renewSubscription&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; testCancelValid&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        vm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;prank&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;user1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        vm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;expectEmit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SubscriptionUpdate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        erc5643&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;cancelSubscription&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; testCancelNotOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        vm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;expectRevert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;Caller is not owner nor approved&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        erc5643&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;cancelSubscription&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; testExpiresAt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        vm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;warp&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        assertEq&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;erc5643&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;expiresAt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        vm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;startPrank&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;user1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        erc5643&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;renewSubscription&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        assertEq&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;erc5643&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;expiresAt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        erc5643&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;cancelSubscription&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        assertEq&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;erc5643&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;expiresAt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Implementation: &lt;code&gt;ERC5643.sol&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.13&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC721&#x2F;ERC721.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERC5643.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC5643&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC5643&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _expirations&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; symbol_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;name_, symbol_) &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; renewSubscription&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; duration&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_isApprovedOrOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Caller is not owner nor approved&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint64&lt;&#x2F;span&gt;&lt;span&gt; currentExpiration &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _expirations&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint64&lt;&#x2F;span&gt;&lt;span&gt; newExpiration&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;currentExpiration &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            newExpiration &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; duration&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_isRenewable&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SubscriptionNotRenewable&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            newExpiration &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; currentExpiration &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt; duration&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _expirations&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; newExpiration&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SubscriptionUpdate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; newExpiration&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; cancelSubscription&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_isApprovedOrOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Caller is not owner nor approved&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        delete&lt;&#x2F;span&gt;&lt;span&gt; _expirations&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SubscriptionUpdate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; expiresAt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _expirations&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isRenewable&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;IERC5643&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP standard does not affect ownership of an NFT and thus can be considered secure.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Composable Soulbound NFT, EIP-1155 Extension</title>
        <published>2022-09-09T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>HonorLabs</name><uri>https://github.com/honorworldio</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5633/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/composable-soulbound-nft-eip-1155-extension/10773" />
        

        <id>https://wg-eips.ritovision.com/5633/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:5633"
            label="ERC-5633" />
        

        
        

        
        <summary type="html">Add composable soulbound property to EIP-1155 tokens</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5633/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is an extension of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;EIP-1155&lt;&#x2F;a&gt;. It proposes a smart contract interface that can represent any number of soulbound and non-soulbound NFT types. Soulbound is the property of a token that prevents it from being transferred between accounts. This standard allows for each token ID to have its own soulbound property.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The soulbound NFTs similar to World of Warcraft’s soulbound items are attracting more and more attention in the Ethereum community. In a real world game like World of Warcraft, there are thousands of items, and each item has its own soulbound property. For example, the amulate Necklace of Calisea is of soulbound property, but another low level amulate is not. This proposal provides a standard way to represent soulbound NFTs that can coexist with non-soulbound ones. It is easy to design a composable NFTs for an entire collection in a single contract.&lt;&#x2F;p&gt;
&lt;p&gt;This standard outline a interface to EIP-1155 that allows wallet implementers and developers to check for soulbound property of token ID using &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;EIP-165&lt;&#x2F;a&gt;. the soulbound property can be checked in advance, and the transfer function can be called only when the token is not soulbound.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;A token type with a &lt;code&gt;uint256 id&lt;&#x2F;code&gt;  is soulbound if function &lt;code&gt;isSoulbound(uint256 id)&lt;&#x2F;code&gt; returning true. In this case, all EIP-1155 functions of the contract that transfer the token from one account to another MUST throw, except for mint and burn.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5633&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a token type `id` is set or cancel to soulbound, according to `bounded`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Soulbound&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bounded&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns true if a token type `id` is soulbound.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isSoulbound&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Smart contracts implementing this standard MUST implement the EIP-165 supportsInterface function and MUST return the constant value true if 0x911ec470 is passed through the interfaceID argument.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;If all tokens in a contract are soulbound by default, &lt;code&gt;isSoulbound(uint256 id)&lt;&#x2F;code&gt; should return true by default during implementation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is fully EIP-1155 compatible.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases are included in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5633&#x2F;.&#x2F;assets&#x2F;test&#x2F;test.js&quot;&gt;test.js&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Run in terminal:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;cd&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; ..&#x2F;assets&#x2F;eip-5633&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;npm&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; install&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;npx&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; hardhat&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; test&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Test contract are included in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5633&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;ERC5633Demo.sol&quot;&gt;&lt;code&gt;ERC5633Demo.sol&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5633&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;ERC5633.sol&quot;&gt;&lt;code&gt;ERC5633.sol&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;There are no security considerations related directly to the implementation of this standard.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Delegation Registry</title>
        <published>2022-09-09T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>foobar</name><uri>https://github.com/0xfoobar</uri>
	</author>
	
	<author>
		<name>Wilkins Chung</name><uri>https://github.com/wwhchung</uri><email>wilkins@manifold.xyz</email>
	</author>
	
	<author>
		<name>ryley-o</name><uri>https://github.com/ryley-o</uri>
	</author>
	
	<author>
		<name>Jake Rockland</name><uri>https://github.com/jakerockland</uri>
	</author>
	
	<author>
		<name>andy8052</name><uri>https://github.com/andy8052</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5639/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5639-delegation-registry/10949" />
        

        <id>https://wg-eips.ritovision.com/5639/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:5639"
            label="ERC-5639" />
        

        
        

        
        <summary type="html">Delegation of permissions for safer and more convenient signing operations.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5639/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP describes the details of the Delegation Registry, a proposed protocol and ABI definition that provides the ability to link one or more delegate wallets to a vault wallet in a manner which allows the linked delegate wallets to prove control and asset ownership of the vault wallet.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Proving ownership of an asset to a third party application in the Ethereum ecosystem is common. Users frequently sign payloads of data to authenticate themselves before gaining access to perform some operation. However, this method--akin to giving the third party root access to one&#x27;s main wallet--is both insecure and inconvenient.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Examples:&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;In order for you to edit your profile on OpenSea, you must sign a message with your wallet.&lt;&#x2F;li&gt;
&lt;li&gt;In order to access NFT gated content, you must sign a message with the wallet containing the NFT in order to prove ownership.&lt;&#x2F;li&gt;
&lt;li&gt;In order to gain access to an event, you must sign a message with the wallet containing a required NFT in order to prove ownership.&lt;&#x2F;li&gt;
&lt;li&gt;In order to claim an airdrop, you must interact with the smart contract with the qualifying wallet.&lt;&#x2F;li&gt;
&lt;li&gt;In order to prove ownership of an NFT, you must sign a payload with the wallet that owns that NFT.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;In all the above examples, one interacts with the dApp or smart contract using the wallet itself, which may be&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;inconvenient (if it is controlled via a hardware wallet or a multi-sig)&lt;&#x2F;li&gt;
&lt;li&gt;insecure (since the above operations are read-only, but you are signing&#x2F;interacting via a wallet that has write access)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Instead, one should be able to approve multiple wallets to authenticate on behalf of a given wallet.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;problems-with-existing-methods-and-solutions&quot;&gt;Problems with existing methods and solutions&lt;&#x2F;h3&gt;
&lt;p&gt;Unfortunately, we&#x27;ve seen many cases where users have accidentally signed a malicious payload. The result is almost always a significant loss of assets associated with the delegate address.&lt;&#x2F;p&gt;
&lt;p&gt;In addition to this, many users keep significant portions of their assets in &#x27;cold storage&#x27;. With the increased security from &#x27;cold storage&#x27; solutions, we usually see decreased accessibility because users naturally increase the barriers required to access these wallets.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;proposal-use-of-a-delegation-registry&quot;&gt;Proposal: Use of a Delegation Registry&lt;&#x2F;h3&gt;
&lt;p&gt;This proposal aims to provide a mechanism which allows a vault wallet to grant wallet, contract or token level permissions to a delegate wallet. This would achieve a safer and more convenient way to sign and authenticate, and provide &#x27;read only&#x27; access to a vault wallet via one or more secondary wallets.&lt;&#x2F;p&gt;
&lt;p&gt;From there, the benefits are twofold. This EIP gives users increased security via outsourcing potentially malicious signing operations to wallets that are more accessible (hot wallets), while being able to maintain the intended security assumptions of wallets that are not frequently used for signing operations.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;improving-dapp-interaction-security&quot;&gt;Improving dApp Interaction Security&lt;&#x2F;h4&gt;
&lt;p&gt;Many dApps requires one to prove control of a wallet to gain access. At the moment, this means that you must interact with the dApp using the wallet itself. This is a security issue, as malicious dApps or phishing sites can lead to the assets of the wallet being compromised by having them sign malicious payloads.&lt;&#x2F;p&gt;
&lt;p&gt;However, this risk would be mitigated if one were to use a secondary wallet for these interactions. Malicious interactions would be isolated to the assets held in the secondary wallet, which can be set up to contain little to nothing of value.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;improving-multiple-device-access-security&quot;&gt;Improving Multiple Device Access Security&lt;&#x2F;h4&gt;
&lt;p&gt;In order for a non-hardware wallet to be used on multiple devices, you must import the seed phrase to each device. Each time a seed phrase is entered on a new device, the risk of the wallet being compromised increases as you are increasing the surface area of devices that have knowledge of the seed phrase.&lt;&#x2F;p&gt;
&lt;p&gt;Instead, each device can have its own unique wallet that is an authorized secondary wallet of the main wallet. If a device specific wallet was ever compromised or lost, you could simply remove the authorization to authenticate.&lt;&#x2F;p&gt;
&lt;p&gt;Further, wallet authentication can be chained so that a secondary wallet could itself authorize one or many tertiary wallets, which then have signing rights for both the secondary address as well as the root main address. This, can allow teams to each have their own signer while the main wallet can easily invalidate an entire tree, just by revoking rights from the root stem.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;improving-convenience&quot;&gt;Improving Convenience&lt;&#x2F;h4&gt;
&lt;p&gt;Many invididuals use hardware wallets for maximum security. However, this is often inconvenient, since many do not want to carry their hardware wallet with them at all times.&lt;&#x2F;p&gt;
&lt;p&gt;Instead, if you approve a non-hardware wallet for authentication activities (such as a mobile device), you would be able to use most dApps without the need to have your hardware wallet on hand.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;Let:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;vault&lt;&#x2F;code&gt; represent the vault address we are trying to authenticate or prove asset ownership for.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;delegate&lt;&#x2F;code&gt; represent the address we want to use for signing in lieu of &lt;code&gt;vault&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;A Delegation Registry must implement IDelegationRegistry&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An immutable registry contract to be deployed as a standalone primitive&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; New project launches can read previous cold wallet -&amp;gt; hot wallet delegations&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * from here and integrate those permissions into their flow&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IDelegationRegistry&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Delegation type&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DelegationType&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        NONE&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        ALL&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        CONTRACT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        TOKEN&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Info about a single delegation, used for onchain enumeration&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DelegationInfo&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        DelegationType type_&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; vault&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; delegate&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; contract_&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Info about a single contract-level delegation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ContractDelegation&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; contract_&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; delegate&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Info about a single token-level delegation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TokenDelegation&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; contract_&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; delegate&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a user delegates their entire wallet&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DelegateForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; vault&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; delegate&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a user delegates a specific contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DelegateForContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; vault&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; delegate&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contract_&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a user delegates a specific token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DelegateForToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; vault&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; delegate&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contract_&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a user revokes all delegations&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RevokeAllDelegates&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; vault&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a user revoes all delegations for a given delegate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RevokeDelegate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; vault&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; delegate&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * -----------  WRITE -----------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Allow the delegate to act on your behalf for all contracts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; delegate&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The hotwallet to act on your behalf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Whether to enable or disable delegation for this address, true for setting and false for revoking&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; delegateForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; delegate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Allow the delegate to act on your behalf for a specific contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; delegate&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The hotwallet to act on your behalf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contract_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address for the contract you&amp;#39;re delegating&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Whether to enable or disable delegation for this address, true for setting and false for revoking&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; delegateForContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; delegate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contract_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Allow the delegate to act on your behalf for a specific token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; delegate&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The hotwallet to act on your behalf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contract_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address for the contract you&amp;#39;re delegating&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token id for the token you&amp;#39;re delegating&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Whether to enable or disable delegation for this address, true for setting and false for revoking&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; delegateForToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; delegate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contract_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Revoke all delegates&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revokeAllDelegates&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Revoke a specific delegate for all their permissions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; delegate&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The hotwallet to revoke&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revokeDelegate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; delegate&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Remove yourself as a delegate for a specific vault&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; vault&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The vault which delegated to the msg.sender, and should be removed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revokeSelf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; vault&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * -----------  READ -----------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns all active delegations a given delegate is able to claim on behalf of&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; delegate&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The delegate that you would like to retrieve delegations for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; info&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Array of DelegationInfo structs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getDelegationsByDelegate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; delegate&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;DelegationInfo&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns an array of wallet-level delegates for a given vault&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; vault&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The cold wallet who issued the delegation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; addresses&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Array of wallet-level delegates for a given vault&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getDelegatesForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; vault&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns an array of contract-level delegates for a given vault and contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; vault&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The cold wallet who issued the delegation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contract_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address for the contract you&amp;#39;re delegating&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; addresses&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Array of contract-level delegates for a given vault and contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getDelegatesForContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; vault&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contract_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns an array of contract-level delegates for a given vault&amp;#39;s token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; vault&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The cold wallet who issued the delegation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contract_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address for the contract holding the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token id for the token you&amp;#39;re delegating&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; addresses&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Array of contract-level delegates for a given vault&amp;#39;s token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getDelegatesForToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; vault&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contract_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns all contract-level delegations for a given vault&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; vault&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The cold wallet who issued the delegations&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; delegations&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Array of ContractDelegation structs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getContractLevelDelegations&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; vault&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;ContractDelegation&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; delegations&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns all token-level delegations for a given vault&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; vault&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The cold wallet who issued the delegations&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; delegations&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Array of TokenDelegation structs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getTokenLevelDelegations&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; vault&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;TokenDelegation&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; delegations&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns true if the address is delegated to act on the entire vault&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; delegate&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The hotwallet to act on your behalf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; vault&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The cold wallet who issued the delegation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checkDelegateForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; delegate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; vault&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns true if the address is delegated to act on your behalf for a token contract or an entire vault&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; delegate&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The hotwallet to act on your behalf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contract_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address for the contract you&amp;#39;re delegating&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; vault&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The cold wallet who issued the delegation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checkDelegateForContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; delegate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; vault&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contract_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns true if the address is delegated to act on your behalf for a specific token, the token&amp;#39;s contract or an entire vault&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; delegate&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The hotwallet to act on your behalf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contract_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address for the contract you&amp;#39;re delegating&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token id for the token you&amp;#39;re delegating&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; vault&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The cold wallet who issued the delegation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checkDelegateForToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; delegate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; vault&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contract_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;checking-delegation&quot;&gt;Checking Delegation&lt;&#x2F;h3&gt;
&lt;p&gt;A dApp or smart contract would check whether or not a delegate is authenticated for a vault by checking the return value of checkDelegateForAll.&lt;&#x2F;p&gt;
&lt;p&gt;A dApp or smart contract would check whether or not a delegate can authenticated for a contract associated with a by checking the return value of checkDelegateForContract.&lt;&#x2F;p&gt;
&lt;p&gt;A dApp or smart contract would check whether or not a delegate can authenticated for a specific token owned by a vault by checking the return value of checkDelegateForToken.&lt;&#x2F;p&gt;
&lt;p&gt;A delegate can act on a token if they have a token level delegation, contract level delegation (for that token&#x27;s contract) or vault level delegation.&lt;&#x2F;p&gt;
&lt;p&gt;A delegate can act on a contract if they have contract level delegation or vault level delegation.&lt;&#x2F;p&gt;
&lt;p&gt;For the purposes of saving gas, it is expected if delegation checks are performed at a smart contract level, the dApp would provide a hint to the smart contract which level of delegation the delegate has so that the smart contract can verify with the Delegation Registry using the most gas efficient check method.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;allowing-for-vault-contract-or-token-level-delegation&quot;&gt;Allowing for vault, contract or token level delegation&lt;&#x2F;h3&gt;
&lt;p&gt;In order to support a wide range of delegation use cases, the proposed specification allows a vault to delegate all assets it controls, assets of a specific contract, or a specific token. This ensures that a vault has fine grained control over the security of their assets, and allows for emergent behavior around granting third party wallets limited access only to assets relevant to them.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;on-chain-enumeration&quot;&gt;On-chain enumeration&lt;&#x2F;h3&gt;
&lt;p&gt;In order to support ease of integration and adoption, this specification has chosen to include on-chain enumeration of delegations and incur the additional gas cost associated with supporting enumeration. On-chain enumeration allows for dApp frontends to identify the delegations that any connected wallet has access to, and can provide UI selectors.&lt;&#x2F;p&gt;
&lt;p&gt;Without on-chain enumeration, a dApp would require the user to manually input the vault, or would need a way to index all delegate events.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The core purpose of this EIP is to enhance security and promote a safer way to authenticate wallet control and asset ownership when the main wallet is not needed and assets held by the main wallet do not need to be moved. Consider it a way to do &#x27;read only&#x27; authentication.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>NFT Metadata JSON Schema dStorage Extension</title>
        <published>2022-09-08T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Gavin Fu</name><uri>https://github.com/gavfu</uri>
	</author>
	
	<author>
		<name>Leo Wang</name><uri>https://github.com/wanglie1986</uri>
	</author>
	
	<author>
		<name>Bova Chen</name><uri>https://github.com/appoipp</uri>
	</author>
	
	<author>
		<name>Guang Han</name><uri>https://github.com/pangwa</uri>
	</author>
	
	<author>
		<name>Brian Wu</name><uri>https://github.com/wuhaixian1984</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5625/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5625-nft-metadata-json-schema-dstorage-extension/10754" />
        

        <id>https://wg-eips.ritovision.com/5625/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:5625"
            label="ERC-5625" />
        

        
        

        
        <summary type="html">Add a dStorage property to non-fungible tokens (NFTs) metadata JSON schema to provide decentralized storage information of NFT assets</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5625/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP extends the NFT metadata JSON schema defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;EIP-1155&lt;&#x2F;a&gt;, adding a &lt;code&gt;dStorage&lt;&#x2F;code&gt; key that provides information about how the NFT data is stored.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;As highly valuable crypto properties, NFT assets intrinsically demand guaranteed storage to assure their &lt;strong&gt;immutability&lt;&#x2F;strong&gt;, &lt;strong&gt;reliability&lt;&#x2F;strong&gt;, and &lt;strong&gt;durability&lt;&#x2F;strong&gt;. NFT ownership is tracked by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;EIP-1155&lt;&#x2F;a&gt; smart contracts, hence persisted in blockchain, which is not a problem. But how about the mime-type assets that NFT tokens represent? Ideally, they should also be stored in some reliable and verifiable decentralized storage system that is designed to store larger amounts of data than the blockchain itself. As an effort to promote &lt;strong&gt;decentralized storage&lt;&#x2F;strong&gt; adoption in NFT world, we propose to add additional &lt;strong&gt;dStorage&lt;&#x2F;strong&gt; information into NFT metadata JSON schema.&lt;&#x2F;p&gt;
&lt;p&gt;As a refresher, let&#x27;s review existing NFT metadata JSON schema standards. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; defines a standard contract method &lt;code&gt;tokenURI&lt;&#x2F;code&gt; to return a given NFT&#x27;s metadata JSON file, conforming to the &lt;em&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; Metadata JSON Schema&lt;&#x2F;em&gt;, which defines three properties: &lt;code&gt;name&lt;&#x2F;code&gt;, &lt;code&gt;description&lt;&#x2F;code&gt; and &lt;code&gt;image&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Similarly, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;EIP-1155&lt;&#x2F;a&gt; also defines a standard contract method &lt;code&gt;uri&lt;&#x2F;code&gt; to return NFT metadata JSON files conforming to the &lt;em&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;EIP-1155&lt;&#x2F;a&gt; Metadata JSON Schema&lt;&#x2F;em&gt;, which defines properties like &lt;code&gt;name&lt;&#x2F;code&gt;, &lt;code&gt;decimals&lt;&#x2F;code&gt;, &lt;code&gt;description&lt;&#x2F;code&gt;, &lt;code&gt;image&lt;&#x2F;code&gt;, &lt;code&gt;properties&lt;&#x2F;code&gt;, &lt;code&gt;localization&lt;&#x2F;code&gt;, etc.&lt;&#x2F;p&gt;
&lt;p&gt;Besides, as the world&#x27;s largest NFT marketplace nowadays, OpenSea defines their own &lt;em&gt;Metadata Standards&lt;&#x2F;em&gt;, including a few more properties like &lt;code&gt;image_data&lt;&#x2F;code&gt;, &lt;code&gt;external_url&lt;&#x2F;code&gt;, &lt;code&gt;attributes&lt;&#x2F;code&gt;, &lt;code&gt;background_color&lt;&#x2F;code&gt;, &lt;code&gt;animation_url&lt;&#x2F;code&gt;, &lt;code&gt;youtube_url&lt;&#x2F;code&gt;, etc. This standard is de facto respected and followed by other NFT marketplaces like LooksRare.&lt;&#x2F;p&gt;
&lt;p&gt;None of these standards conveys storage information about the mime-type asset that the NFT token represents. This proposal is an effort to fill the missing part.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;In addition to the existing properties, the Metadata JSON file returned by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;EIP-1155&lt;&#x2F;a&gt; smart contracts (via &lt;code&gt;tokenURI&lt;&#x2F;code&gt; and &lt;code&gt;uri&lt;&#x2F;code&gt; methods, respectively), should OPTIONALLY contains one more &lt;code&gt;dStorage&lt;&#x2F;code&gt; property.&lt;&#x2F;p&gt;
&lt;p&gt;For &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; smart contracts, the Metadata JSON file schema is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Asset Metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Identifies the asset to which this NFT represents&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Describes the asset to which this NFT represents&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;image&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A URI pointing to a resource with mime type image&#x2F;* representing the asset to which this NFT represents. Consider making any images at a width between 320 and 1080 pixels and aspect ratio between 1.91:1 and 4:5 inclusive.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;dStorage&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;required&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;platform&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;persistence_mechanism&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;challenge_mechanism&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;consensus&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;dstorage_note&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;platform&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;dStorage platform name like Swarm, Arweave, Filecoin, Crust, etc&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A brief description of the dStorage platform&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;persistence_mechanism&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Persistence mechanism or incentive structure of the dStorage platform, like &amp;#39;blockchain-based&amp;#39;, &amp;#39;contract-based&amp;#39;, etc&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;challenge_mechanism&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Challenge mechanism of the dStorage platform, like Arweave&amp;#39;s proof-of-access, etc&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;consensus&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Consensus mechanism of the dStorage platform, like PoW, PoS, etc&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;dstorage_note&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A note to prove the storage of the NFT asset on the dStorage platform, like a Filecoin deal id, a Crust place_storage_order transaction hash, etc&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;For &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;EIP-1155&lt;&#x2F;a&gt; smart contracts, the Metadata JSON file schema is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Token Metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Identifies the asset to which this token represents&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;decimals&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;integer&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The number of decimal places that the token amount should display - e.g. 18, means to divide the token amount by 1000000000000000000 to get its user representation.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Describes the asset to which this token represents&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;image&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A URI pointing to a resource with mime type image&#x2F;* representing the asset to which this token represents. Consider making any images at a width between 320 and 1080 pixels and aspect ratio between 1.91:1 and 4:5 inclusive.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Arbitrary properties. Values may be strings, numbers, object or arrays.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;localization&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;required&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uri&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;default&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;locales&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uri&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The URI pattern to fetch localized data from. This URI should contain the substring `{locale}` which will be replaced with the appropriate locale value before sending the request.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;default&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The locale of the default data within the base JSON&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;locales&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;array&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The list of locales for which data is available. These locales should conform to those defined in the Unicode Common Locale Data Repository (http:&#x2F;&#x2F;cldr.unicode.org&#x2F;).&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;dStorage&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;required&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;platform&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;persistence_mechanism&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;challenge_mechanism&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;consensus&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;dstorage_note&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;platform&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;dStorage platform name like Swarm, Arweave, Filecoin, Crust, etc&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A brief description of the dStorage platform&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;persistence_mechanism&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Persistence mechanism or incentive structure of the dStorage platform, like &amp;#39;blockchain-based&amp;#39;, &amp;#39;contract-based&amp;#39;, etc&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;challenge_mechanism&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Challenge mechanism of the dStorage platform, like Arweave&amp;#39;s proof-of-access, etc&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;consensus&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Consensus mechanism of the dStorage platform, like PoW, PoS, etc&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;dstorage_note&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A note to prove the storage of the NFT asset on the dStorage platform, like a Filecoin deal id, a Crust place_storage_order transaction hash, etc&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;choice-between-interface-and-json-schema-extension&quot;&gt;Choice between Interface and JSON Schema Extension&lt;&#x2F;h3&gt;
&lt;p&gt;An extension of the EIP-721 or EIP-1155 contract interfaces would unnecessarily require additional code to implement, and would not be available for use by NFT projects that already have their NFT smart contracts finalized and deployed. An optional JSON schema extension is noninvasive, and more easily adopted.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h1&gt;
&lt;p&gt;This EIP is backward compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt;  and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;EIP-1155&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP does not introduce any new security risks or vulnerabilities, as the &lt;code&gt;dStorage&lt;&#x2F;code&gt; property is only an informational field of the Metadata JSON file returned by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;EIP-1155&lt;&#x2F;a&gt; smart contracts. It does not affect the execution or validity of NFT transactions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Transferable Vesting NFT</title>
        <published>2022-09-08T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Apeguru</name><uri>https://github.com/Apegurus</uri>
	</author>
	
	<author>
		<name>Marco De Vries</name><email>marco@paladinsec.co</email>
	</author>
	
	<author>
		<name>Mario</name><email>mario@paladinsec.co</email>
	</author>
	
	<author>
		<name>DeFiFoFum</name><uri>https://github.com/DeFiFoFum</uri>
	</author>
	
	<author>
		<name>Elliott Green</name><uri>https://github.com/elliott-green</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5725/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5725-transferable-vesting-nft/11099" />
        

        <id>https://wg-eips.ritovision.com/5725/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:5725"
            label="ERC-5725" />
        

        
        

        
        <summary type="html">An interface for transferable vesting NFTs which release underlying tokens over time.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5725/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;A &lt;strong&gt;Non-Fungible Token&lt;&#x2F;strong&gt; (NFT) standard used to vest tokens (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; or otherwise) over a vesting release curve.&lt;&#x2F;p&gt;
&lt;p&gt;The following standard allows for the implementation of a standard API for NFT based contracts that hold and represent the vested and locked properties of any underlying token (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; or otherwise) that is emitted to the NFT holder. This standard is an extension of the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; token that provides basic functionality for creating vesting NFTs, claiming the tokens and reading vesting curve properties.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Vesting contracts, including timelock contracts, lack a standard and unified interface, which results in diverse implementations of such contracts. Standardizing such contracts into a single interface would allow for the creation of an ecosystem of on- and off-chain tooling around these contracts. In addition, liquid vesting in the form of non-fungible assets can prove to be a huge improvement over traditional &lt;strong&gt;Simple Agreement for Future Tokens&lt;&#x2F;strong&gt; (SAFTs) or &lt;strong&gt;Externally Owned Account&lt;&#x2F;strong&gt; (EOA)-based vesting as it enables transferability and the ability to attach metadata similar to the existing functionality offered by with traditional NFTs.&lt;&#x2F;p&gt;
&lt;p&gt;Such a standard will not only provide a much-needed &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; token lock standard, but will also enable the creation of secondary marketplaces tailored for semi-liquid SAFTs.&lt;&#x2F;p&gt;
&lt;p&gt;This standard also allows for a variety of different vesting curves to be implement easily.&lt;&#x2F;p&gt;
&lt;p&gt;These curves could represent:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;linear vesting&lt;&#x2F;li&gt;
&lt;li&gt;cliff vesting&lt;&#x2F;li&gt;
&lt;li&gt;exponential vesting&lt;&#x2F;li&gt;
&lt;li&gt;custom deterministic vesting&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;use-cases&quot;&gt;Use Cases&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;A framework to release tokens over a set period of time that can be used to build many kinds of NFT financial products such as bonds, treasury bills, and many others.&lt;&#x2F;li&gt;
&lt;li&gt;Replicating SAFT contracts in a standardized form of semi-liquid vesting NFT assets.
&lt;ul&gt;
&lt;li&gt;SAFTs are generally off-chain, while today&#x27;s on-chain versions are mainly address-based, which makes distributing vesting shares to many representatives difficult. Standardization simplifies this convoluted process.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Providing a path for the standardization of vesting and token timelock contracts.
&lt;ul&gt;
&lt;li&gt;There are many such contracts in the wild and most of them differ in both interface and implementation.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;NFT marketplaces dedicated to vesting NFTs.
&lt;ul&gt;
&lt;li&gt;Whole new sets of interfaces and analytics could be created from a common standard for token vesting NFTs.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Integrating vesting NFTs into services like Safe Wallet.
&lt;ul&gt;
&lt;li&gt;A standard would mean services like Safe Wallet could more easily and uniformly support interactions with these types of contracts inside of a multisig contract.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Enable standardized fundraising implementations and general fundraising that sell vesting tokens (eg. SAFTs) in a more transparent manner.&lt;&#x2F;li&gt;
&lt;li&gt;Allows tools, front-end apps, aggregators, etc. to show a more holistic view of the vesting tokens and the properties available to users.
&lt;ul&gt;
&lt;li&gt;Currently, every project needs to write their own visualization of the vesting schedule of their vesting assets. If this is standardized, third-party tools could be developed to aggregate all vesting NFTs from all projects for the user, display their schedules and allow the user to take aggregated vesting actions.&lt;&#x2F;li&gt;
&lt;li&gt;Such tooling can easily discover compliance through the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; &lt;code&gt;supportsInterface(InterfaceID)&lt;&#x2F;code&gt; check.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Makes it easier for a single wrapping implementation to be used across all vesting standards that defines multiple recipients, periodic renting of vesting tokens etc.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC721&#x2F;IERC721.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Non-Fungible Vesting Token Standard.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A non-fungible token standard used to vest ERC-20 tokens over a vesting release curve &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *  scheduled using timestamps.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Because this standard relies on timestamps for the vesting schedule, it&amp;#39;s important to keep track of the &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *  tokens claimed per Vesting NFT so that a user cannot withdraw more tokens than allotted for a specific Vesting NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@custom:interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;-id 0xbd3a202b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5725&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC721&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  This event is emitted when the payout is claimed through the claim function.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the NFT tokenId of the assets being claimed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; recipient&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address which is receiving the payout.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; claimAmount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of tokens being claimed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PayoutClaimed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; claimAmount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  This event is emitted when an `owner` sets an address to manage token claims for all tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address setting a manager to manage all tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address being permitted to manage all tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; approved&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A boolean indicating whether the spender is approved to claim for all tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ClaimApprovalForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approved&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  This event is emitted when an `owner` sets an address to manage token claims for a `tokenId`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The `owner` of `tokenId`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address being permitted to manage a tokenId.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The unique identifier of the token being managed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; approved&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A boolean indicating whether the spender is approved to claim for `tokenId`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ClaimApproval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approved&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Claim the pending payout for the NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST grant the claimablePayout value at the time of claim being called to `msg.sender`. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  MUST revert if not called by the token owner or approved users. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  MUST emit PayoutClaimed. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  SHOULD revert if there is nothing to claim.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT token id.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; claim&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Number of tokens for the NFT which have been claimed at the current timestamp.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT token id.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; payout&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The total amount of payout tokens claimed for this NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; claimedPayout&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; payout&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Number of tokens for the NFT which can be claimed at the current timestamp.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; It is RECOMMENDED that this is calculated as the `vestedPayout()` subtracted from `payoutClaimed()`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT token id.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; payout&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of unlocked payout tokens for the NFT which have not yet been claimed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; claimablePayout&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; payout&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Total amount of tokens which have been vested at the current timestamp. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  This number also includes vested tokens which have been claimed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; It is RECOMMENDED that this function calls `vestedPayoutAtTime` &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  with `block.timestamp` as the `timestamp` parameter.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT token id.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; payout&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Total amount of tokens which have been vested at the current timestamp.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; vestedPayout&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; payout&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Total amount of vested tokens at the provided timestamp. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  This number also includes vested tokens which have been claimed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `timestamp` MAY be both in the future and in the past. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  Zero MUST be returned if the timestamp is before the token was minted.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT token id.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; timestamp&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The timestamp to check on, can be both in the past and the future.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; payout&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Total amount of tokens which have been vested at the provided timestamp.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; vestedPayoutAtTime&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; timestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; payout&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Number of tokens for an NFT which are currently vesting.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The sum of vestedPayout and vestingPayout SHOULD always be the total payout.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT token id.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; payout&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The number of tokens for the NFT which are vesting until a future date.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; vestingPayout&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; payout&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The start and end timestamps for the vesting of the provided NFT. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  MUST return the timestamp where no further increase in vestedPayout occurs for `vestingEnd`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT token id.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; vestingStart&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The beginning of the vesting as a unix timestamp.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; vestingEnd&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ending of the vesting as a unix timestamp.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; vestingPeriod&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; vestingStart&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; vestingEnd&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Token which is used to pay out the vesting claims.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT token id.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; token&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token which is used to pay out the vesting claims.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; payoutToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sets a global `operator` with permission to manage all tokens owned by the current `msg.sender`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to let manage all tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; approved&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A boolean indicating whether the spender is approved to claim for all tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setClaimApprovalForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approved&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sets a tokenId `operator` with permission to manage a single `tokenId` owned by the `msg.sender`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to let manage a single `tokenId`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the `tokenId` to be managed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; approved&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A boolean indicating whether the spender is approved to claim for all tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setClaimApproval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approved&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns true if `owner` has set `operator` to manage all `tokenId`s.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The owner allowing `operator` to manage all `tokenId`s.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address who is given permission to spend tokens on behalf of the `owner`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isClaimApprovedForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; isClaimApproved&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the operating address for a `tokenId`. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  If `tokenId` is not managed, then returns the zero address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT `tokenId` to query for a `tokenId` manager.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getClaimApproved&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;terms&quot;&gt;Terms&lt;&#x2F;h3&gt;
&lt;p&gt;These are base terms used around the specification which function names and definitions are based on.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;vesting&lt;&#x2F;em&gt;: Tokens which a vesting NFT is vesting until a future date.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;vested&lt;&#x2F;em&gt;: Total amount of tokens a vesting NFT has vested.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;claimable&lt;&#x2F;em&gt;: Amount of vested tokens which can be unlocked.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;claimed&lt;&#x2F;em&gt;: Total amount of tokens unlocked from a vesting NFT.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;timestamp&lt;&#x2F;em&gt;: The unix &lt;code&gt;timestamp&lt;&#x2F;code&gt; (seconds) representation of dates used for vesting.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;vesting-functions&quot;&gt;Vesting Functions&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;vestingPayout&lt;&#x2F;code&gt; + &lt;code&gt;vestedPayout&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;vestingPayout(uint256 tokenId)&lt;&#x2F;code&gt; and &lt;code&gt;vestedPayout(uint256 tokenId)&lt;&#x2F;code&gt; add up to the total number of tokens which can be claimed by the end of the vesting schedule. This is also equal to &lt;code&gt;vestedPayoutAtTime(uint256 tokenId, uint256 timestamp)&lt;&#x2F;code&gt; with &lt;code&gt;type(uint256).max&lt;&#x2F;code&gt; as the &lt;code&gt;timestamp&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The rationale for this is to guarantee that the tokens &lt;code&gt;vested&lt;&#x2F;code&gt; and tokens &lt;code&gt;vesting&lt;&#x2F;code&gt; are always in sync. The intent is that the vesting curves created are deterministic across the &lt;code&gt;vestingPeriod&lt;&#x2F;code&gt;. This creates useful opportunities for integration with these NFTs. For example: A vesting schedule can be iterated through and a vesting curve could be visualized, either on-chain or off-chain.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;vestedPayout&lt;&#x2F;code&gt; vs &lt;code&gt;claimedPayout&lt;&#x2F;code&gt; &amp;amp; &lt;code&gt;claimablePayout&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;vestedPayout &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt; claimedPayout &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt; claimablePayout &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; lockedPayout&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;vestedPayout(uint256 tokenId)&lt;&#x2F;code&gt; provides the total amount of payout tokens which have &lt;strong&gt;vested&lt;&#x2F;strong&gt; &lt;em&gt;including &lt;code&gt;claimedPayout(uint256 tokenId)&lt;&#x2F;code&gt;&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;claimedPayout(uint256 tokenId)&lt;&#x2F;code&gt; provides the total amount of payout tokens which have been unlocked at the current &lt;code&gt;timestamp&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;claimablePayout(uint256 tokenId)&lt;&#x2F;code&gt; provides the amount of payout tokens which can be unlocked at the current &lt;code&gt;timestamp&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The rationale for providing three functions is to support a number of features:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The return of &lt;code&gt;vestedPayout(uint256 tokenId)&lt;&#x2F;code&gt; will always match the return of &lt;code&gt;vestedPayoutAtTime(uint256 tokenId, uint256 timestamp)&lt;&#x2F;code&gt; with &lt;code&gt;block.timestamp&lt;&#x2F;code&gt; as the &lt;code&gt;timestamp&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;claimablePayout(uint256 tokenId)&lt;&#x2F;code&gt; can be used to easily see the current payout unlock amount and allow for unlock cliffs by returning zero until a &lt;code&gt;timestamp&lt;&#x2F;code&gt; has been passed.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;claimedPayout(uint256 tokenId)&lt;&#x2F;code&gt; is helpful to see tokens unlocked from an NFT and it is also necessary for the calculation of vested-but-locked payout tokens: &lt;code&gt;vestedPayout - claimedPayout - claimablePayout = lockedPayout&lt;&#x2F;code&gt;. This would depend on how the vesting curves are configured by the an implementation of this standard.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;code&gt;vestedPayoutAtTime(uint256 tokenId, uint256 timestamp)&lt;&#x2F;code&gt; provides functionality to iterate through the &lt;code&gt;vestingPeriod(uint256 tokenId)&lt;&#x2F;code&gt; and provide a visual of the release curve. The intent is that release curves are created which makes &lt;code&gt;vestedPayoutAtTime(uint256 tokenId, uint256 timestamp)&lt;&#x2F;code&gt; deterministic.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;timestamps&quot;&gt;Timestamps&lt;&#x2F;h3&gt;
&lt;p&gt;Generally in Solidity development it is advised against using &lt;code&gt;block.timestamp&lt;&#x2F;code&gt; as a state dependent variable as the timestamp of a block can be manipulated by a miner. The choice to use a &lt;code&gt;timestamp&lt;&#x2F;code&gt; over a &lt;code&gt;block&lt;&#x2F;code&gt; is to allow the interface to work across multiple &lt;strong&gt;Ethereum Virtual Machine&lt;&#x2F;strong&gt; (EVM) compatible networks which generally have different block times. Block proposal with a significantly fabricated timestamp will generally be dropped by all node implementations which makes the window for abuse negligible.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;timestamp&lt;&#x2F;code&gt; makes cross chain integration easy, but internally, the reference implementation keeps track of the token payout per Vesting NFT to ensure that excess tokens allotted by the vesting terms cannot be claimed.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;limitation-of-scope&quot;&gt;Limitation of Scope&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Historical claims&lt;&#x2F;strong&gt;: While historical vesting schedules can be determined on-chain with &lt;code&gt;vestedPayoutAtTime(uint256 tokenId, uint256 timestamp)&lt;&#x2F;code&gt;, historical claims would need to be calculated through historical transaction data. Most likely querying for &lt;code&gt;PayoutClaimed&lt;&#x2F;code&gt; events to build a historical graph.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;extension-possibilities&quot;&gt;Extension Possibilities&lt;&#x2F;h3&gt;
&lt;p&gt;These feature are not supported by the standard as is, but the standard could be extended to support these more advanced features.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Custom Vesting Curves&lt;&#x2F;strong&gt;: This standard intends on returning deterministic &lt;code&gt;vesting&lt;&#x2F;code&gt; values given NFT &lt;code&gt;tokenId&lt;&#x2F;code&gt; and a &lt;strong&gt;timestamp&lt;&#x2F;strong&gt; as inputs. This is intentional as it provides for flexibility in how the vesting curves work under the hood which doesn&#x27;t constrain projects who intend on building a complex smart contract vesting architecture.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;NFT Rentals&lt;&#x2F;strong&gt;: Further complex DeFi tools can be created if vesting NFTs could be rented.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This is done intentionally to keep the base standard simple. These features can and likely will be added through extensions of this standard.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;The Vesting NFT standard is meant to be fully backwards compatible with any current &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; integrations and marketplaces.&lt;&#x2F;li&gt;
&lt;li&gt;The Vesting NFT standard also supports &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; interface detection for detecting &lt;code&gt;EIP-721&lt;&#x2F;code&gt; compatibility, as well as Vesting NFT compatibility.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;The reference vesting NFT repository includes tests written in Hardhat.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;A reference implementation of this EIP can be found in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5725&#x2F;assets&#x2F;README&#x2F;&quot;&gt;ERC-5725 assets&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;timestamps&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Vesting schedules are based on timestamps. As such, it&#x27;s important to keep track of the number of tokens which have been claimed and to not give out more tokens than allotted for a specific Vesting NFT.
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;vestedPayoutAtTime(tokenId, type(uint256).max)&lt;&#x2F;code&gt;, for example, must return the total payout for a given &lt;code&gt;tokenId&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;approvals&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;When an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; approval is made on a Vesting NFT, the operator would have the rights to transfer the Vesting NFT to themselves and then claim the vested tokens.&lt;&#x2F;li&gt;
&lt;li&gt;When a ERC-5725 approval is made on a Vesting NFT, the operator would have the rights to claim the vested tokens, but not transfer the NFT away from the owner.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>New approach for encryption &#x2F; decryption</title>
        <published>2022-09-07T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Firn Protocol</name><uri>https://github.com/firnprotocol</uri>
	</author>
	
	<author>
		<name>Fried L. Trout</name>
	</author>
	
	<author>
		<name>Weiji Guo</name><uri>https://github.com/weijiguo</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5630/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5630-encryption-and-decryption/10761" />
        

        <id>https://wg-eips.ritovision.com/5630/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:5630"
            label="ERC-5630" />
        

        
        

        
        <summary type="html">defines a specification for encryption and decryption using Ethereum wallets.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5630/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes a new way to encrypt and decrypt using Ethereum keys. This EIP uses &lt;em&gt;only&lt;&#x2F;em&gt; the &lt;code&gt;secp256k1&lt;&#x2F;code&gt; curve, and proposes two new RPC methods: &lt;code&gt;eth_getEncryptionPublicKey&lt;&#x2F;code&gt; and &lt;code&gt;eth_performECDH&lt;&#x2F;code&gt;. These two methods, in conjunction, allow users to receive encryptions and perform decryptions (respectively). We require that the wallet &lt;em&gt;only&lt;&#x2F;em&gt; perform the core ECDH operation, leaving the ECIES operations up to implementers (we do suggest a standardized version of ECIES, however). In contrast, a previous EIPs used the same secret key, in both signing and encryption, on two &lt;em&gt;different&lt;&#x2F;em&gt; curves (namely, &lt;code&gt;secp256k1&lt;&#x2F;code&gt; and &lt;code&gt;ec25519&lt;&#x2F;code&gt;), and hardcoded a particular version of ECIES.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;We discuss a few motivating examples. One key motivation is direct-to-address encryption on Ethereum. Using our EIP, one can directly send encrypted messages to some desired recipient on-chain, without having a prior direct channel to that recipient. (Note that in this EIP, we standardize &lt;em&gt;only&lt;&#x2F;em&gt; the encryption procedure—that is, the generation of the ciphertext—and &lt;em&gt;not&lt;&#x2F;em&gt; how exactly the on-chain message should be sent. In practice, ideally, smart-contract infrastructure will be set up for this purpose; barring this, encryptors could make use of the raw &lt;code&gt;data&lt;&#x2F;code&gt; field available in each standard transfer.)&lt;&#x2F;p&gt;
&lt;p&gt;We discuss a second sort of example. In a certain common design pattern, a dApp generates a fresh secret on behalf of a user. It is of interest if, instead of forcing this user to independently store, safeguard, and back up this latter secret, the dApp may instead encrypt this secret to a public key which the user controls—and whose secret key, crucially, resides within the user&#x27;s HD wallet hierarchy—and then post the resulting ciphertext to secure storage (e.g., on-chain).  This design pattern allows the dApp&#x2F;user to bootstrap the security of the &lt;em&gt;fresh&lt;&#x2F;em&gt; secret onto the security of the user&#x27;s existing HD wallet seed phrase, which the user has already gone through the trouble of safeguarding and storing. This represents a far lower UX burden than forcing the user to store and manage fresh keys directly (which can, and often does, lead to loss of funds). We note that this design pattern described above is used today by, various dApps (e.g., Tornado Cash).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;We describe our approach here; we compare our approach to prior EIPs in the &lt;strong&gt;Rationale&lt;&#x2F;strong&gt; section below. Throughout, we make reference to SEC 1: Elliptic Curve Cryptography, by Daniel R. L. Brown.&lt;&#x2F;p&gt;
&lt;p&gt;We use the &lt;code&gt;secp256k1&lt;&#x2F;code&gt; curve for both signing and encryption.
For encryption, we use ECIES. We specify that the wallet &lt;em&gt;only&lt;&#x2F;em&gt; perform the sensitive ECDH operation. This lets implementers select their own ECIES variants at will.&lt;&#x2F;p&gt;
&lt;p&gt;We propose that all binary data be serialized to and from &lt;code&gt;0x&lt;&#x2F;code&gt;-prefixed hex strings. We moreover use &lt;code&gt;0x&lt;&#x2F;code&gt;-prefixed hex strings to specify private keys and public keys, and represent public keys in compressed form. We represent Ethereum accounts in the usual way (&lt;code&gt;0x&lt;&#x2F;code&gt;-prefixed, 20-byte hex strings). Specifically, to serialize and deserialize elliptic curve points, implementers MUST use the following standard:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;to serialize a point: use [SEC 1, §2.3.3], with point compression.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;to deserialize a point: use [SEC 1, §2.3.3], while &lt;em&gt;requiring&lt;&#x2F;em&gt; point compression; that is:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;the input byte string MUST have length ⌈log₂q &#x2F; 8⌉ + 1 = &lt;code&gt;33&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;the first byte MUST be &lt;code&gt;0x02&lt;&#x2F;code&gt; or &lt;code&gt;0x03&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;the integer represented by the remaining 32 bytes (as in [SEC 1, §2.3.8]) MUST reside in {0, ..., &lt;em&gt;p&lt;&#x2F;em&gt; - 1}, and moreover MUST yield a quadratic residue modulo &lt;em&gt;p&lt;&#x2F;em&gt; under the Weierstrass expression X^3 + 7 (modulo &lt;em&gt;p&lt;&#x2F;em&gt;).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;For application-level implementers actually implementing ECIES, we propose the following variant. Unless they have a reason to do otherwise, implementers SHOULD use the following standardized choices:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;the KDF &lt;code&gt;ANSI-X9.63-KDF&lt;&#x2F;code&gt;, where the hash function &lt;code&gt;SHA-512&lt;&#x2F;code&gt; is used,&lt;&#x2F;li&gt;
&lt;li&gt;the HMAC &lt;code&gt;HMAC–SHA-256–256 with 32 octet or 256 bit keys&lt;&#x2F;code&gt;,&lt;&#x2F;li&gt;
&lt;li&gt;the symmetric encryption scheme &lt;code&gt;AES–256 in CBC mode&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;We propose that the binary, &lt;em&gt;concatenated&lt;&#x2F;em&gt; serialization mode for ECIES ciphertexts be used, both for encryption and decryption, where moreover elliptic curve points are &lt;em&gt;compressed&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Thus, on the request:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;request&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  method&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_getEncryptionPublicKey&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  params&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;account&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where &lt;code&gt;account&lt;&#x2F;code&gt; is a standard 20-byte, &lt;code&gt;0x&lt;&#x2F;code&gt;-prefixed, hex-encoded Ethereum account, the client should operate as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;find the secret signing key &lt;code&gt;sk&lt;&#x2F;code&gt; corresponding to the Ethereum account &lt;code&gt;account&lt;&#x2F;code&gt;, or else return an error if none exists.&lt;&#x2F;li&gt;
&lt;li&gt;compute the &lt;code&gt;secp256k1&lt;&#x2F;code&gt; public key corresponding to &lt;code&gt;sk&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;return this public key in compressed, &lt;code&gt;0x&lt;&#x2F;code&gt;-prefixed, hex-encoded form, following [SEC 1, §2.3.3].&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;On the request&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;request&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  method&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_performECDH&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  params&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ephemeralKey&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where &lt;code&gt;account&lt;&#x2F;code&gt; is as above, and &lt;code&gt;ephemeralKey&lt;&#x2F;code&gt; is an elliptic curve point encoded as above:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;find the secret key &lt;code&gt;sk&lt;&#x2F;code&gt; corresponding to the Ethereum account &lt;code&gt;account&lt;&#x2F;code&gt;, or else return an error if none exists.&lt;&#x2F;li&gt;
&lt;li&gt;deserialize &lt;code&gt;ephemeralKey&lt;&#x2F;code&gt; to an elliptic curve point using [SEC 1, §2.3.3] (where compression is required), throwing an error if deserialization fails.&lt;&#x2F;li&gt;
&lt;li&gt;compute the elliptic curve Diffie–Hellman secret, following [SEC 1, §3.3.1].&lt;&#x2F;li&gt;
&lt;li&gt;return the resulting field element as an 0x-prefixed, hex-encoded, 32-byte string, using [SEC 1, §2.3.5].&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Test vectors are given below.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;encrypting-to-a-smart-contract&quot;&gt;Encrypting to a smart contract&lt;&#x2F;h3&gt;
&lt;p&gt;In light of account abstraction, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;EIP-4337&lt;&#x2F;a&gt;, and the advent of smart-contract wallets, we moreover specify a way to encrypt to a contract.
More precisely, we specify a way for a contract to &lt;em&gt;advertise&lt;&#x2F;em&gt; how it would like encryptions to it to be constructed. This should be viewed as an analogue of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;EIP-1271&lt;&#x2F;a&gt;, but for encryption, as opposed to signing.&lt;&#x2F;p&gt;
&lt;p&gt;Our specification is as follows.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC5630&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Should return an encryption of the provided plaintext, using the provided randomness.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; plaintext&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      Plaintext to be encrypted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; randomness&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     Entropy to be used during encryption&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; encryptTo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; plaintext&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; randomness&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    public&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ciphertext&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Each contract MAY implement &lt;code&gt;encryptTo&lt;&#x2F;code&gt; as it desires. Unless it has a good reason to do otherwise, it SHOULD use the ECIES variant we propose above.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;There is &lt;em&gt;no security proof&lt;&#x2F;em&gt; for a scheme which simultaneously invokes signing on the &lt;code&gt;secp256k1&lt;&#x2F;code&gt; curve and encryption on the &lt;code&gt;ec25519&lt;&#x2F;code&gt; curve, and where &lt;em&gt;the same secret key is moreover used in both cases&lt;&#x2F;em&gt;. Though no attacks are known, it is not desirable to use a scheme which lacks a proof in this way.
We, instead, propose the reuse of the same key in signing and encryption, but where &lt;em&gt;the same curve is used in both&lt;&#x2F;em&gt;. This very setting has been studied in prior work; see, e.g., Degabriele, Lehmann, Paterson, Smart and Strefler, &lt;em&gt;On the Joint Security of Encryption and Signature in EMV&lt;&#x2F;em&gt;, 2011. That work found this joint scheme to be secure in the generic group model.
We note that this very joint scheme (i.e., using ECDSA and ECIES on the same curve) is used live in production in EMV payments.&lt;&#x2F;p&gt;
&lt;p&gt;We now discuss a few further aspects of our approach.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;On-chain public key discovery.&lt;&#x2F;strong&gt; Our proposal has an important feature whereby an encryption &lt;em&gt;to&lt;&#x2F;em&gt; some account can be constructed whenever that account has signed at least one transaction.
Indeed, it is possible to recover an account&#x27;s &lt;code&gt;secp256k1&lt;&#x2F;code&gt; public key directly from any signature on behalf of that account.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;ECDH vs. ECIES.&lt;&#x2F;strong&gt; We specify that the wallet &lt;em&gt;only&lt;&#x2F;em&gt; perform the sensitive ECDH operation, and let application-level implementers perform the remaining steps of ECIES. This has two distinct advantages:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Flexibility.&lt;&#x2F;strong&gt; It allows implementers to select arbitrary variants of ECIES, without having to update what the wallet does.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Bandwidth.&lt;&#x2F;strong&gt; Our approach requires that only small messages (on the order of 32 bytes) be exchanged between the client and the wallet. This could be material in settings in which the plaintexts and ciphertexts at play are large, and when the client and the wallet are separated by an internet connection.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Twist attacks.&lt;&#x2F;strong&gt; A certain GitHub post by Christian Lundkvist warns against &quot;twist attacks&quot; on the &lt;code&gt;secp256k1&lt;&#x2F;code&gt; curve. These attacks are not applicable to this EIP, for multiple &lt;em&gt;distinct&lt;&#x2F;em&gt; reasons, which we itemize:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Only applies to classical ECDH, not ECIES.&lt;&#x2F;strong&gt; This attack only applies to classical ECDH (i.e., in which both parties use persistent, authenticated public keys), and not to ECIES (in which one party, the encryptor, uses an ephemeral key). Indeed, it only applies to a scenario in which an attacker can induce a victim to exponentiate an attacker-supplied point by a sensitive scalar, and then moreover send the result back to the attacker. But this pattern only happens in classical Diffie–Hellman, and never in ECIES. Indeed, in ECIES, we recall that the only sensitive Diffie–Hellman operation happens during decryption, but in this case, the victim (who would be the decryptor) never sends the resulting DH point back to the attacker (rather, the victim merely uses it locally to attempt an AES decryption). During &lt;em&gt;encryption&lt;&#x2F;em&gt;, the exponentiation is done by the encryptor, who has no secret at all (sure enough, the exponentiation is by an ephemeral scalar), so here there would be nothing for the attacker to learn.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Only applies to uncompressed points.&lt;&#x2F;strong&gt; Indeed, we use compressed points in this EIP. When compressed points are used, each 33-byte string &lt;em&gt;necessarily&lt;&#x2F;em&gt; either resolves to a point on the correct curve, or else has no reasonable interpretation. There is no such thing as &quot;a point not on the curve&quot; (which, in particular, can pass undetectedly as such).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Only applies when you fail to check a point is on the curve.&lt;&#x2F;strong&gt; But this is inapplicable for us anyway, since we use compressed points (see above). We also require that all validations be performed.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Our &lt;code&gt;eth_performECDH&lt;&#x2F;code&gt; method is new, and so doesn&#x27;t raise any backwards compatibility issues.&lt;&#x2F;p&gt;
&lt;p&gt;A previous proposal proposed an &lt;code&gt;eth_getEncryptionPublicKey&lt;&#x2F;code&gt; method (together with an &lt;code&gt;eth_decrypt&lt;&#x2F;code&gt; method unrelated to this EIP). Our proposal overwrites the previous behavior of &lt;code&gt;eth_getEncryptionPublicKey&lt;&#x2F;code&gt;.
It is unlikely that this will be an issue, since encryption keys need be newly retrieved &lt;em&gt;only&lt;&#x2F;em&gt; upon the time of encryption; on the other hand, &lt;em&gt;new&lt;&#x2F;em&gt; ciphertexts will be generated using our new approach.
(In particular, our modification will not affect the ability of ciphertexts generated using the old EIP to be &lt;code&gt;eth_decrypt&lt;&#x2F;code&gt;ed.)&lt;&#x2F;p&gt;
&lt;p&gt;In any case, the previous EIP was never standardized, and is &lt;em&gt;not&lt;&#x2F;em&gt; (to our knowledge) implemented in a non-deprecated manner in &lt;em&gt;any&lt;&#x2F;em&gt; production code today.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h3&gt;
&lt;p&gt;The secret &lt;em&gt;signing key&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    0x439047a312c8502d7dd276540e89fe6639d39da1d8466f79be390579d7eaa3b2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;with Ethereum address &lt;code&gt;0x72682F2A3c160947696ac3c9CC48d290aa89549c&lt;&#x2F;code&gt;, has &lt;code&gt;secp256k1&lt;&#x2F;code&gt; public key&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    0x03ff5763a2d3113229f2eda8305fae5cc1729e89037532a42df357437532770010&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Thus, the request:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;request&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  method&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_getEncryptionPublicKey&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  params&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x72682F2A3c160947696ac3c9CC48d290aa89549c&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;should return:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x03ff5763a2d3113229f2eda8305fae5cc1729e89037532a42df357437532770010&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;If an encryptor were to encrypt a message—say, &lt;code&gt;I use Firn Protocol to gain privacy on Ethereum.&lt;&#x2F;code&gt;—under the above public key, using the above ECIES variant, he could obtain, for example:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x036f06f9355b0e3f7d2971da61834513d5870413d28a16d7d68ce05dc78744daf850e6c2af8fb38e3e31d679deac82bd12148332fa0e34aecb31981bd4fe8f7ac1b74866ce65cbe848ee7a9d39093e0de0bd8523a615af8d6a83bbd8541bf174f47b1ea2bd57396b4a950a0a2eb77af09e36bd5832b8841848a8b302bd816c41ce&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Upon obtaining this ciphertext, the decryptor would extract the relevant ephemeral public key, namely:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x036f06f9355b0e3f7d2971da61834513d5870413d28a16d7d68ce05dc78744daf8&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;And submit the request:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;request&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  method&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_performECDH&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  params&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x72682F2A3c160947696ac3c9CC48d290aa89549c&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x036f06f9355b0e3f7d2971da61834513d5870413d28a16d7d68ce05dc78744daf8&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;which in turn would return the Diffie–Hellman secret:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x4ad782e7409702101abe6d0279f242a2c545c46dd50a6704a4b9e3ae2730522e&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Upon proceeding with the above ECIES variant, the decryptor would then obtain the string &lt;code&gt;I use Firn Protocol to gain privacy on Ethereum.&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Our proposal uses heavily standardized algorithms and follows all best practices.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Multiverse NFTs</title>
        <published>2022-09-06T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Gaurang Torvekar</name><uri>https://github.com/gaurangtorvekar</uri>
	</author>
	
	<author>
		<name>Khemraj Adhawade</name><uri>https://github.com/akhemraj</uri>
	</author>
	
	<author>
		<name>Nikhil Asrani</name><uri>https://github.com/nikhilasrani</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5606/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5606-multiverse-nfts-for-digital-asset-interoperability/10698" />
        

        <id>https://wg-eips.ritovision.com/5606/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:5606"
            label="ERC-5606" />
        

        
        

        
        <summary type="html">A universal representation of multiple related NFTs as a single digital asset across various platforms</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5606/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This specification defines a minimal interface to create a multiverse NFT standard for digital assets such as wearables and in-game items that, in turn, index the delegate NFTs on each platform where this asset exists. These platforms could be metaverses, play-to-earn games or NFT marketplaces. This proposal depends on and extends &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt;. The standard also allows for the ‘bundling’ and ‘unbundling’ of these delegate NFTs within the multiverse NFT so holders can trade them individually or as a bundle.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Several metaverses and blockchain games (&quot;platforms&quot;) exist that use NFT standards such as ERC-721 and ERC-1155 for creating in-universe assets like avatar wearables, in-game items including weapons, shields, potions and much more. The biggest shortcoming while using these standards is that there is no interoperability between these platforms. As a publisher, you must publish the same digital asset (for example, a shirt) on various platforms as separate ERC-721 or ERC-1155 tokens. Moreover, there is no relationship between these, although they represent the same digital asset in reality. Hence, it is very difficult to prove the scarcity of these items on-chain.&lt;&#x2F;p&gt;
&lt;p&gt;Since their inception, NFTs were meant to be interoperable and prove the scarcity of digital assets. Although NFTs can arguably prove the scarcity of items, the interoperability aspect hasn’t been addressed yet. Creating a multiverse NFT standard that allows for indexing and ownership of a digital asset across various platforms would be the first step towards interoperability and true ownership across platforms.&lt;&#x2F;p&gt;
&lt;p&gt;In the web3 ecosystem, NFTs have evolved to represent multiple types of unique and non-fungible assets. One type of asset includes a set of NFTs related to one another. For instance, if a brand releases a new sneaker across various metaverses, it would be minted as a separate NFT on each platform. However, it is, in reality, the same sneaker.
There is a need to represent the relationship and transferability of these types of NFTs as metaverses and blockchain games gain more mainstream adoption. The ecosystem needs a better framework to address this issue rather than relying on the application level. This framework should define the relationship between these assets and the nature of their association. There is more value in the combined recognition, use and transferability of these individual NFTs as a bundle rather than their selves.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;A multiverse NFT contract represents a digital asset across multiple platforms. This contract can own one or more delegate NFT tokens of the digital asset on the various platforms through bundling or unbundling.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;* @dev Interface of the Multiverse NFT standard as defined in the EIP.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;interface IMultiverseNFT {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    * @dev struct to store delegate token details&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   struct DelegateData {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;       address contractAddress;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;       uint256 tokenId;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;       uint256 quantity;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    * @dev Emitted when one or more new delegate NFTs are added to a Multiverse NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   event Bundled(uint256 multiverseTokenID, DelegateData[] delegateData, address ownerAddress);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    * @dev Emitted when one or more delegate NFTs are removed from a Multiverse NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   event Unbundled(uint256 multiverseTokenID, DelegateData[] delegateData);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    * @dev Accepts the tokenId of the Multiverse NFT and returns an array of delegate token data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   function delegateTokens(uint256 multiverseTokenID) external view returns (DelegateData[] memory);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    * @dev Removes one or more delegate NFTs from a Multiverse NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    * This function accepts the delegate NFT details and transfers those NFTs out of the Multiverse NFT contract to the owner&amp;#39;s wallet&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   function unbundle(DelegateData[] memory delegateData, uint256 multiverseTokenID) external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    * @dev Adds one or more delegate NFTs to a Multiverse NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    * This function accepts the delegate NFT details and transfers those NFTs to the Multiverse NFT contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    * Need to ensure that approval is given to this Multiverse NFT contract for the delegate NFTs so that they can be transferred programmatically&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   function bundle(DelegateData[] memory delegateData, uint256 multiverseTokenID) external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    * @dev Initialises a new bundle, mints a Multiverse NFT and assigns it to msg.sender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    * Returns the token ID of a new Multiverse NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    * Note - When a new Multiverse NFT is initialised, it is empty; it does not contain any delegate NFTs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   function initBundle(DelegateData[] memory delegateData) external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Any dapp implementing this standard would initialise a bundle by calling the function &lt;code&gt;initBundle&lt;&#x2F;code&gt;. This mints a new multiverse NFT and assigns it to msg.sender. While creating a bundle, the delegate token contract addresses and the token IDs are set during the initialisation and cannot be changed after that. This avoids unintended edge cases where non-related NFTs could be bundled together by mistake.&lt;&#x2F;p&gt;
&lt;p&gt;Once a bundle is initialised, the delegate NFT tokens can then be transferred to this Multiverse NFT contract by calling the function &lt;code&gt;bundle&lt;&#x2F;code&gt; and passing the token ID of the multiverse NFT. It is essential for a dapp to get the delegate NFTs ‘approved’ from the owner to this Multiverse NFT contract before calling the bundle function. After that, the Multiverse NFT owns one or more versions of this digital asset across the various platforms.&lt;&#x2F;p&gt;
&lt;p&gt;If the owner of the multiverse NFT wants to sell or use the individual delegate NFTs across any of the platforms, they can do so by calling the function &lt;code&gt;unbundle&lt;&#x2F;code&gt;. This function transfers the particular delegate NFT token(s) to msg.sender (only if &lt;code&gt;msg.sender&lt;&#x2F;code&gt; is the owner of the multiverse NFT).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;delegateData&lt;&#x2F;code&gt; struct contains information about the delegate NFT tokens on each platform. It contains variables such as &lt;code&gt;contractAddress&lt;&#x2F;code&gt;, &lt;code&gt;tokenId&lt;&#x2F;code&gt;, &lt;code&gt;quantity&lt;&#x2F;code&gt; to differentiate the NFTs. These NFTs could be following either the ERC-721 standard or the ERC-1155 standard.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;bundle&lt;&#x2F;code&gt; and &lt;code&gt;unbundle&lt;&#x2F;code&gt; functions accept an array of DelegateData struct because of the need to cater to partial bundling and unbundling. For instance, a user could initialise a bundle with three delegate NFTs, but they should be able to bundle and unbundle less than three at any time. They can never bundle or unbundle more than three. They also need the individual token IDs of the delegate NFTs to bundle and unbundle selectively.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is fully compatible with ERC-721 and ERC-1155. Third-party applications that don’t support this EIP will still be able to use the original NFT standards without any problems.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5606&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;MultiverseNFT.sol&quot;&gt;MultiverseNFT.sol&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The bundle function involves calling an external contract(s). So reentrancy prevention measures should be applied while implementing this function.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Restrict Ethereum Provider API Injection</title>
        <published>2022-09-05T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Yan Zhu</name><uri>https://github.com/diracdeltas</uri>
	</author>
	
	<author>
		<name>Brian R. Bondy</name><uri>https://github.com/bbondy</uri>
	</author>
	
	<author>
		<name>Andrea  Brancaleoni</name><uri>https://github.com/thypon</uri>
	</author>
	
	<author>
		<name>Kyle Den Hartog</name><uri>https://github.com/kdenhartog</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5593/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/rfc-limiting-provider-object-injection-to-secure-contexts/10670" />
        

        <id>https://wg-eips.ritovision.com/5593/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="interface"
                label="Interface" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:5593"
            label="EIP-5593" />
        

        
        

        
        <summary type="html">Wallet guidance for restricting Ethereum Provider API access to secure contexts for improved privacy and security for wallet users.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5593/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Historically the web platform has had a notion of “powerful” APIs like those defined in W3C&#x27;s Geolocation specification and W3C&#x27;s Mediastreams specification, which are subject to additional security restrictions such as those defined by W3C&#x27;s secure contexts specification. Since the Ethereum Provider APIs allow dApp websites to request access to sensitive user data and to request use of user funds, new Ethereum Provider APIs generally should align to the security considerations defined by W3C&#x27;s Secure Context specification in order to better protect the users data and users funds managed via the web.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;author-s-note&quot;&gt;Author&#x27;s Note&lt;&#x2F;h3&gt;
&lt;p&gt;Unfortunately, because of a difference in interpretations by EIP editors of RFC 2119 terminology around linking in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1&#x2F;&quot;&gt;EIP-1&lt;&#x2F;a&gt;, the authors cannot directly link to other W3C specifications which this EIP builds upon. The author&#x27;s attempted to provide as much context as possible within the text while complying with the editor bot in order to get this merged. If this policy is updated or further clarified before this EIP reaches final call in the future this EIP will be updated with links.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Wallets are oftentimes maintaining security and safety of users&#x27; funds that can be equivalent to large portions of money. For this reason, it&#x27;s a good idea to restrict access to the Ethereum Provider APIs to align it with other powerful APIs on the web platform. This will assist in reducing the surface area that attacks can be conducted to access users funds or data. Additionally, by adding in restrictions we&#x27;re reducing the surface area that malicious web pages could fingerprint the user via the Ethereum Provider APIs providing some additional privacy benefits. An example of a specific attack that&#x27;s avoided by this is one where a malicious advertisement is loaded on a legitimate dApp that attempts to interact with a users wallet to maliciously request the user to access funds. With this EIP implemented the advertisement frame would be considered a third-party iframe and therefore would not have the Ethereum Provider API injected into it&#x27;s sub frame because it&#x27;s not a secure context.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;restrictions-for-providers&quot;&gt;Restrictions for providers&lt;&#x2F;h3&gt;
&lt;p&gt;The provider objects, e.g. &lt;code&gt;window.ethereum&lt;&#x2F;code&gt;, are expected to only inject the Ethereum Provider APIs in secure context when conforming with this specification. The following restrictions are REQUIRED for conformant wallets:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Provider objects MAY be accessible in private (incognito) windows.&lt;&#x2F;li&gt;
&lt;li&gt;The origin MUST be a &quot;potentially trustworthy origin&quot; (defined in W3C&#x27;s Secure Contexts specification in section 3.1) to have access to &lt;code&gt;window.ethereum&lt;&#x2F;code&gt;. This can be checked using &lt;code&gt;window.isSecureContext&lt;&#x2F;code&gt;, including inside iframes.
&lt;ul&gt;
&lt;li&gt;Secure contexts include sites that are served from HTTPS but also HTTP &lt;code&gt;localhost&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The User Agent implementation MAY also support configured [potentially trustworthy origins] that would normally not be considered trustworthy if the user configures their User Agent to do so. See section 7.2 titled &quot;Development Environments&quot; of W3C&#x27;s Secure Contexts specification for additional details. For example, in Chromium based User Agents this is done via the &lt;code&gt;chrome:&#x2F;&#x2F;flags&#x2F;#unsafely-treat-insecure-origin-as-secure&lt;&#x2F;code&gt; flag.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;By default the Ethereum Provider APIs MUST NOT be exposed to third-party iframes.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;window.ethereum&lt;&#x2F;code&gt; MUST be &lt;code&gt;undefined&lt;&#x2F;code&gt; in an iframe where &lt;code&gt;window.isSecureContext&lt;&#x2F;code&gt; returns &lt;code&gt;false&lt;&#x2F;code&gt; in that iframe.&lt;&#x2F;li&gt;
&lt;li&gt;If the iframe is a third party to the top-level secure origin, it SHOULD be blocked. Some implementations MAY provide a mechanism (e.g., via the &lt;code&gt;allow&lt;&#x2F;code&gt; attribute and Permissions API) for pages to request access, subject to user approval.&lt;&#x2F;li&gt;
&lt;li&gt;If the iframe is first-party to the top-level origin AND the &lt;code&gt;sandbox&lt;&#x2F;code&gt; attribute is set on the iframe, the provider object MUST be blocked. If the &lt;code&gt;sandbox&lt;&#x2F;code&gt; attribute is set to &lt;code&gt;sandbox=&quot;allow-same-origin&quot;&lt;&#x2F;code&gt; it MUST be injected for a first party frame.
&lt;ul&gt;
&lt;li&gt;Note &lt;code&gt;&quot;allow-same-origin&quot;&lt;&#x2F;code&gt; does nothing if the iframe is third-party. Third-party iframes SHOULD be blocked by default, but implementations MAY allow access through user-approved mechanisms such as the Permissions API.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;By limiting the capabilities of where the Ethereum Provider APIs are being injected we can reduce the surface area of where attacks can be executed. Given the sensitivity of data that&#x27;s passed to the Ethereum Provider APIs some basic levels of authentication and confidentiality should be met in order to ensure that request data is not being intercepted or tampered with. While there have been attempts to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2255&#x2F;&quot;&gt;limit request access via the wallet&lt;&#x2F;a&gt; interface itself, there have not been limitations that have been set to where these Ethereum Provider APIs are expected to be or not be injected. Since the secure contexts web platform API is a well developed boundary that&#x27;s been recommended by W3C and the fact that the Ethereum Provider APIs are extending the traditional web platform APIs, no other alternative solutions have been considered in order to extend current established prior art.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Wallet extensions SHOULD consider adding a &quot;developer mode&quot; toggle via a UX so that dApp developers have the capability to disable the insecure context (http) check for the &lt;code&gt;http:&#x2F;&#x2F;localhost:&amp;lt;any-port&amp;gt;&lt;&#x2F;code&gt; origin only in the event that localhost does not return &lt;code&gt;true&lt;&#x2F;code&gt; for secure context. See section 5.2 of W3C&#x27;s Secure Context specification for more details. This will allow dApp developers to be able to continue to host dApps on the localhost origin if a User Agent has chosen to not already consider localhost a secure context. All major User Agent implementations tested do consider localhost a secure context already. This toggle MUST be set to disabled by default.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;required-test-cases&quot;&gt;Required Test Cases&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Top level &lt;code&gt;http:&#x2F;&#x2F;a.com&lt;&#x2F;code&gt; -&amp;gt; blocked (insecure&#x2F;top level)&lt;&#x2F;li&gt;
&lt;li&gt;Top level &lt;code&gt;https:&#x2F;&#x2F;a.com&lt;&#x2F;code&gt; -&amp;gt; allowed&lt;&#x2F;li&gt;
&lt;li&gt;Top level &lt;code&gt;https:&#x2F;&#x2F;a.com&lt;&#x2F;code&gt; with &lt;code&gt;&amp;lt;iframe src=&quot;http:&#x2F;&#x2F;a.com&#x2F;&quot;&amp;gt;&lt;&#x2F;code&gt; -&amp;gt; blocked (insecure first party iframe)&lt;&#x2F;li&gt;
&lt;li&gt;Top level &lt;code&gt;http:&#x2F;&#x2F;a.com&lt;&#x2F;code&gt; with &lt;code&gt;&amp;lt;iframe src=&quot;https:&#x2F;&#x2F;a.com&#x2F;&quot;&amp;gt;&lt;&#x2F;code&gt; -&amp;gt; blocked (insecure top level window)&lt;&#x2F;li&gt;
&lt;li&gt;Top level &lt;code&gt;https:&#x2F;&#x2F;a.com&lt;&#x2F;code&gt; with &lt;code&gt;&amp;lt;iframe src=&quot;https:&#x2F;&#x2F;a.com&quot;&amp;gt;&lt;&#x2F;code&gt; -&amp;gt; allowed&lt;&#x2F;li&gt;
&lt;li&gt;Top level &lt;code&gt;https:&#x2F;&#x2F;a.com&lt;&#x2F;code&gt; with &lt;code&gt;&amp;lt;iframe src=&quot;https:&#x2F;&#x2F;b.com&quot;&amp;gt;&lt;&#x2F;code&gt; -&amp;gt; blocked (third-party iframe without sufficient privileges)&lt;&#x2F;li&gt;
&lt;li&gt;Top level &lt;code&gt;https:&#x2F;&#x2F;b.com&lt;&#x2F;code&gt; with &lt;code&gt;&amp;lt;iframe src=&quot;http:&#x2F;&#x2F;a.com&#x2F;&quot;&amp;gt;&lt;&#x2F;code&gt; with &lt;code&gt;&amp;lt;iframe src=&quot;https:&#x2F;&#x2F;b.com&quot;&amp;gt;&lt;&#x2F;code&gt; -&amp;gt; blocked (insecure iframe)&lt;&#x2F;li&gt;
&lt;li&gt;Top level &lt;code&gt;https:&#x2F;&#x2F;b.com&lt;&#x2F;code&gt; with &lt;code&gt;&amp;lt;iframe src=&quot;https:&#x2F;&#x2F;a.com&quot;&amp;gt;&lt;&#x2F;code&gt; with &lt;code&gt;&amp;lt;iframe src=&quot;https:&#x2F;&#x2F;b.com&quot;&amp;gt;&lt;&#x2F;code&gt; -&amp;gt; blocked (third-party iframe without sufficient privileges)&lt;&#x2F;li&gt;
&lt;li&gt;Top level &lt;code&gt;https:&#x2F;&#x2F;a.com&lt;&#x2F;code&gt; with &lt;code&gt;&amp;lt;iframe src=&quot;https:&#x2F;&#x2F;sub.a.com&quot;&amp;gt;&lt;&#x2F;code&gt; -&amp;gt; blocked (third-party iframe without sufficient privileges)&lt;&#x2F;li&gt;
&lt;li&gt;Top level &lt;code&gt;https:&#x2F;&#x2F;a.com&lt;&#x2F;code&gt; with &lt;code&gt;&amp;lt;iframe src=&quot;https:&#x2F;&#x2F;a.com&quot; sandbox&amp;gt;&lt;&#x2F;code&gt; -&amp;gt; blocked (sandbox attribute without &quot;allow-same-origin&quot;)&lt;&#x2F;li&gt;
&lt;li&gt;Top level &lt;code&gt;https:&#x2F;&#x2F;a.com&lt;&#x2F;code&gt; with &lt;code&gt;&amp;lt;iframe src=&quot;https:&#x2F;&#x2F;a.com&quot; sandbox=&quot;allow-same-origin allow-scripts&quot;&amp;gt;&lt;&#x2F;code&gt; -&amp;gt; allowed (Note this case is discouraged by User Agent implementer&#x27;s such as Mozilla&#x27;s MDN documents because it’d allow the iframe to remove its own &lt;code&gt;sandbox&lt;&#x2F;code&gt; attribute. See the &lt;code&gt;sandbox&lt;&#x2F;code&gt; attribute section of the iframes document in MDN for more details.)&lt;&#x2F;li&gt;
&lt;li&gt;Top level &lt;code&gt;data:&#x2F;&#x2F;foo with &amp;lt;iframe src=&quot;data:&#x2F;&#x2F;bar&quot;&amp;gt;&lt;&#x2F;code&gt; -&amp;gt; blocked (insecure top level scheme)&lt;&#x2F;li&gt;
&lt;li&gt;Top level &lt;code&gt;file:&#x2F;&#x2F;foo with &amp;lt;iframe src=&quot;file:&#x2F;&#x2F;bar&quot;&amp;gt;&lt;&#x2F;code&gt; -&amp;gt; blocked (third-party iframe)&lt;&#x2F;li&gt;
&lt;li&gt;Top level &lt;code&gt;https:&#x2F;&#x2F;a.com&lt;&#x2F;code&gt; with &lt;code&gt;&amp;lt;iframe src=&quot;https:&#x2F;&#x2F;b.com&quot; sandbox=&quot;allow-same-origin allow-scripts&quot;&amp;gt;&lt;&#x2F;code&gt; -&amp;gt; blocked (third-party iframe without sufficient privileges)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;user-enables-developer-mode&quot;&gt;User Enables Developer Mode&lt;&#x2F;h3&gt;
&lt;p&gt;Oftentimes developers require the ability to develop dApps locally in order to test their website and develop while hosting their dApp on &lt;code&gt;http:&#x2F;&#x2F;localhost&lt;&#x2F;code&gt;. In this case localhost would be blocked and compatibility issues would arise when developing a dApp locally. In order to increase compatibility for dApp developers a toggle to disable the check for the localhost can be considered. If this were to be extended beyond the localhost origin it could be used as a means to convince users to enable developer mode in order to subvert the guards put in place by this EIP. Therefore, implementations should be cautious when extending this developer toggle beyond the scope of the localhost origin.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;privacy-considerations&quot;&gt;Privacy Considerations&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;web3-provider-fingerprinting&quot;&gt;Web3 Provider Fingerprinting&lt;&#x2F;h4&gt;
&lt;p&gt;Due to the nature of how the provider object is injected by default into most webpages, there&#x27;s a risk that a malicious web page could utilize the provider object to fingerprint the user more precisely as a Web3 user. Implementers of this EIP are expected to consider the risks of injecting the Ethereum provider APIs into pages by default in order to consider what privacy characteristics they wish to enable for their users.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>NFT Lien</title>
        <published>2022-09-05T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Zainan Victor Zhou</name><uri>https://github.com/xinbenlv</uri>
	</author>
	
	<author>
		<name>Allen Zhou</name><email>allen@ubiloan.io</email>
	</author>
	
	<author>
		<name>Alex Qin</name><email>alex@ubiloan.io</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5604/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/creating-a-new-erc-proposal-for-nft-lien/10683" />
        

        <id>https://wg-eips.ritovision.com/5604/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:5604"
            label="ERC-5604" />
        

        
        

        
        <summary type="html">Extend ERC-721 to support putting liens on NFT</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5604/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC introduces NFT liens, a form of security interest over an item of property to secure the recovery of liability or performance of some other obligation. It introduces an interface to place and removes a lien, plus an event.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Liens are widely used for finance use cases, such as car and property liens. An example use case for an NFT lien is for a deed.
This ERC provides an interface to implement an interface that performs the lien holding relationships.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Any compliant contract MUST implement &lt;code&gt;ERC-721&lt;&#x2F;code&gt;, and &lt;code&gt;ERC-165&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Any compliant contract MUST implement the following interface:&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC_LIEN&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC165&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; === Events ===&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST be emitted when new lien is successfully placed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the token a lien is placed on.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; holder&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the holder of the lien.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; extraParams&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; of the original request to add the lien.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OnLienPlaced&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; holder&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; extraParams&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST be emitted when an existing lien is successfully removed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the token a lien was removed from.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; holder&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the holder of the lien.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; extraParams&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; of the original request to remove the lien.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OnLienRemoved&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; holder&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; extraParams&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; === CRUD ===&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The method to place a lien on a token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         it MUST throw an error if the same holder already has a lien on the same token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the token a lien is placed on.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; holder&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the holder of the lien&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; extraParams&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; extra data for future extension.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addLienHolder&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; holder&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; extraParams&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The method to remove a lien on a token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         it MUST throw an error if the holder already has a lien.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the token a lien is being removed from.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; holder&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the holder of the lien&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; extraParams&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; extra data for future extension.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; removeLienHolder&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; holder&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; extraParams&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The method to query if an active lien exists on a token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         it MUST throw an error if the tokenId doesn&amp;#39;t exist or is not owned.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the token a lien is being queried for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; holder&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the holder about whom the method is querying about lien holding.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; extraParams&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; extra data for future extension.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; hasLien&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; holder&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; extraParams&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;We only support &lt;code&gt;ERC-721&lt;&#x2F;code&gt; NFTs for simplicity and gas efficiency. We have not considered other ERCs, which can be left for future extensions. For example, &lt;code&gt;ERC-20&lt;&#x2F;code&gt; and &lt;code&gt;ERC-1155&lt;&#x2F;code&gt; were not considered.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;We choose separate &quot;addLienHolder&quot; and &quot;removeLienHolder&quot; instead of use a single &lt;code&gt;changeLienholder&lt;&#x2F;code&gt; with amount because we believe
the add or remove action are significantly different and usually require different Access Control,
for example, the token holder shall be able to add someone else as a lien holder but the lien holder of that token.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;We have not specified the &quot;amount of debt&quot; in this interface. We believe this is complex enough and worthy of an individual ERC by itself.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;We have not specified how endorsement can be applied to allow holder to signal their approval for transfer or swapping. We believe this is complex enough and worthy of an individual ERC by itself.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The ERC is designed as an extension of &lt;code&gt;ERC-721&lt;&#x2F;code&gt; and therefore compliant contracts need to fully comply with &lt;code&gt;ERC-721&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Proxy Ownership Register</title>
        <published>2022-09-03T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Omnus Sunmo</name><uri>https://github.com/omnus</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4886/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-4886-a-proxy-ownership-and-asset-delivery-register/8559" />
        

        <id>https://wg-eips.ritovision.com/4886/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:4886"
            label="ERC-4886" />
        

        
        

        
        <summary type="html">A proxy ownership register allowing trustless proof of ownership between Ethereum addresses, with delegated asset delivery</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4886/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;A proxy protocol that allows users to nominate a proxy address to act on behalf of another wallet address, together with a delivery address for new assets. Smart contracts and applications making use of the protocol can take a proxy address and lookup holding information for the nominator address. This has a number of practical applications, including allowing users to store valuable assets safely in a cold wallet and interact with smart contracts using a proxy address of low value. The assets in the nominator are protected as all contract interactions take place with the proxy address. This eliminates a number of exploits seen recently where users&#x27; assets are drained through a malicious contract interaction. In addition, the register holds a delivery address, allowing new assets to be delivered directly to a cold wallet address.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;To make full use of Ethereum users often need to prove their ownership of existing assets. For example:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Discord communities require users to sign a message with their wallet to prove they hold the tokens or NFTs of that community.&lt;&#x2F;li&gt;
&lt;li&gt;Whitelist events (for example recent airdrops, or NFT mints), require the user to interact using a given address to prove eligibility.&lt;&#x2F;li&gt;
&lt;li&gt;Voting in DAOs and other protocols require the user to sign using the address that holds the relevant assets.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;There are more examples, with the unifying theme being that the user must make use of the address with the assets to derive the platform benefit. This means the addresses holding these assets cannot be truly &#x27;cold&#x27;, and is a gift to malicious developers seeking to steal valuable assets. For example, a new project can offer free NFTs to holders of an existing NFT asset. The existing holders have to prove ownership by minting from the wallet with the asset that determined eligibility. This presents numerous possible attack vectors for a malicious developer who knows that all users interacting with the contract have an asset of that type.&lt;&#x2F;p&gt;
&lt;p&gt;Possibly even more damaging is the effect on user confidence across the whole ecosystem. Users become reluctant to interact with apps and smart contracts for fear of putting their assets at risk. They may also decide not to store assets in cold wallet addresses as they need to prove they own them on a regular basis. A pertinent example is the user trying to decide whether to &#x27;vault&#x27; their NFT and lose access to a discord channel, or keep their NFT in another wallet, or even to connect their &#x27;vault&#x27; to discord.&lt;&#x2F;p&gt;
&lt;p&gt;Ethereum is amazing at providing trustless proofs. The &lt;em&gt;only&lt;&#x2F;em&gt; time a user should need to interact using the wallet that holds an asset is if they intend to sell or transfer that asset. If a user merely wishes to prove ownership (to access a resource, get an airdrop, mint an NFT, or vote in a DAO), they should do this through a trustless proof stored on-chain.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore, users should be able to decide where new assets are delivered, rather than them being delivered to the wallet providing the interaction. This allows hot wallets to acquire assets sent directly to a cold wallet &#x27;vault&#x27;, possibly even the one they are representing in terms of asset ownership.&lt;&#x2F;p&gt;
&lt;p&gt;The aim of this EIP is to provide a convenient method to avoid this security concern and empower more people to feel confident leveraging the full scope of Ethereum functionality. Our vision is an Ethereum where users setup a new hardware wallet for assets they wish to hold long-term, then make one single contract interaction with that wallet: to nominate a hot wallet proxy. That user can always prove they own assets on that address, and they can specify it as a delivery address for new asset delivery.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Delivery address: The address that assets will be delivered to for the current Proxy Record, i.e. a new NFT minted by the Proxy address, representing the Nominator address, should be delivered to the Delivery address.&lt;&#x2F;li&gt;
&lt;li&gt;Nomination: Where a Nominator has nominated a Proxy address. Will only be active when the Proxy has accepted the nomination.&lt;&#x2F;li&gt;
&lt;li&gt;Nominator address: The address that proposes a proxy relationship. This address nominates another address to act as its proxy, representing it and its holdings in all interactions.&lt;&#x2F;li&gt;
&lt;li&gt;Proxy address: The address that will represent a Nominator on-chain.&lt;&#x2F;li&gt;
&lt;li&gt;Proxy Record: An active proxy relationship encompassing a Nominator, Proxy and Delivery.&lt;&#x2F;li&gt;
&lt;li&gt;Register: The main EPS contract, which holds details of both Nominations and Proxy Records.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;eps-specification&quot;&gt;EPS Specification&lt;&#x2F;h3&gt;
&lt;p&gt;There are two main parts to the register - a nomination and a proxy record:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Contract &#x2F; Dapp                        Register&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Nominator: 0x1234..             Nominator: 0x1234..&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Proxy: 0x5678..     ---------&amp;gt;  Proxy: 0x4567..&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                Delivery: 0x9876..&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The first step to creating a proxy record is for an address to nominate another address as its proxy. This creates a nomination that maps the nominator (the address making the nomination) to the proposed proxy address.&lt;&#x2F;p&gt;
&lt;p&gt;This is not a proxy record on the register at this stage, as the proxy address needs to first accept the nomination. Until the nomination is accepted it can be considered to be pending. Once the proxy address has accepted the nomination a proxy record is added to the register.&lt;&#x2F;p&gt;
&lt;p&gt;When accepting a nomination the proxy address sets the delivery address for that proxy record. The proxy address remains in control of updating that delivery address as required. Both the nominator and proxy can delete the proxy record and nomination at any time. The proxy will continue forever if not deleted - it is eternal.&lt;&#x2F;p&gt;
&lt;p&gt;The register is a single smart contract that stores all nomination and register records. The information held for each is as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Nomination:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The address of the Nominator&lt;&#x2F;li&gt;
&lt;li&gt;The address of the Proposed Proxy&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Proxy Record:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The address of the Nominator&lt;&#x2F;li&gt;
&lt;li&gt;The address of the Proxy&lt;&#x2F;li&gt;
&lt;li&gt;The delivery address for proxied deliveries&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Any address can act as a Nominator or a Proxy. A Nomination must have been made first in order for an address to accept acting as a Proxy.&lt;&#x2F;p&gt;
&lt;p&gt;A Nomination cannot be made to an address that is already active as either a Proxy or a Nominator, i.e. that address is already in an active proxy relationship.&lt;&#x2F;p&gt;
&lt;p&gt;The information for both Nominations and Proxy records is held as a mapping. For the Nomination this is address =&amp;gt; address for the Nominator to the Proxy address. For the Proxy Record the mapping is from address =&amp;gt; struct for the Proxy Address to a struct containing the Nominator and Delivery address.&lt;&#x2F;p&gt;
&lt;p&gt;Mapping between an address and its Nominator and Delivery address is a simple process as shown below:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Contract &#x2F; Dapp                        Register&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  |                                       |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  |------------- 0x4567..---------------&amp;gt; |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  |                                       |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  | &amp;lt;-------nominator: 0x1234..---------- |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  |         delivery: 0x9876..            |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  |                                       |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The protocol is fully backwards compatible. If it is passed an address that does not have an active mapping it will pass back the received address as both the Nominator and Delivery address, thereby preserving functionality as the address is acting on its own behalf.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Contract &#x2F; Dapp                        Register&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  |                                       |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  |------------- 0x0222..---------------&amp;gt; |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  |                                       |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  | &amp;lt;-------nominator: 0x0222..---------- |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  |         delivery: 0x0222..            |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  |                                       |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;If the EPS register is passed the address of a Nominator it will revert. This is of vital importance. The purpose of the proxy is that the Proxy address is operating on behalf of the Nominator. The Proxy address therefore can derive the same benefits as the Nominator (for example discord roles based on the Nominator&#x27;s holdings, or mint NFTs that require another NFT to be held). It is therefore imperative that the Nominator in an active proxy cannot also interact and derive these benefits, otherwise two addresses represent the same holding. A Nominator can of course delete the Proxy Record at any time and interact on it&#x27;s own behalf, with the Proxy address instantly losing any benefits associated with the proxy relationship.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;solidity-interface-definition&quot;&gt;Solidity Interface Definition&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;Nomination Exists&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function nominationExists(address _nominator) external view returns (bool);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Returns true if a Nomination exists for the address specified.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Nomination Exists for Caller&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function nominationExistsForCaller() external view returns (bool);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Returns true if a Nomination exists for the msg.sender.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Proxy Record Exists&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function proxyRecordExists(address _proxy) external view returns (bool);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Returns true if a Proxy Record exists for the passed Proxy address.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Proxy Record Exists for Caller&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function proxyRecordExistsForCaller() external view returns (bool);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Returns true if a Proxy Record exists for the msg.sender.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Nominator Record Exists&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function nominatorRecordExists(address _nominator) external view returns (bool);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Returns true if a Proxy Record exists for the passed Nominator address.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Nominator Record Exists for Caller&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function nominatorRecordExistsForCaller() external view returns (bool);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Returns true if a Proxy Record exists for the msg.sender.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Get Proxy Record&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function getProxyRecord(address _proxy) external view returns (address nominator, address proxy, address delivery);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Returns Nominator, Proxy and Delivery address for a passed Proxy address.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Get Proxy Record for Caller&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function getProxyRecordForCaller() external view returns (address nominator, address proxy, address delivery);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Returns Nominator, Proxy and Delivery address for msg.sender as Proxy address.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Get Nominator Record&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function getNominatorRecord(address _nominator) external view returns (address nominator, address proxy, address delivery);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Returns Nominator, Proxy and Delivery address for a passed Nominator address.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Get Nominator Record for Caller&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function getNominatorRecordForCaller() external view returns (address nominator, address proxy, address delivery);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Returns Nominator, Proxy and Delivery address for msg.sender address as Nominator.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Address Is Active&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function addressIsActive(address _receivedAddress) external view returns (bool);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Returns true if the passed address is Nominator or Proxy address on an active Proxy Record.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Address Is Active for Caller&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function addressIsActiveForCaller() external view returns (bool);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Returns true if msg.sender is Nominator or Proxy address on an active Proxy Record.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Get Nomination&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;function getNomination(address _nominator) external view returns (address proxy);&lt;&#x2F;p&gt;
&lt;p&gt;Returns the proxy address for a Nomination when passed a Nominator.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Get Nomination for Caller&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;function getNominationForCaller() external view returns (address proxy);&lt;&#x2F;p&gt;
&lt;p&gt;Returns the proxy address for a Nomination if msg.sender is a Nominator&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Get Addresses&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function getAddresses(address _receivedAddress) external view returns (address nominator, address delivery, bool isProxied);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Returns the Nominator, Proxy, Delivery and a boolean isProxied for the passed address. If you pass an address that is not a Proxy address it will return address(0) for the Nominator, Proxy and Delivery address and isProxied of false. If you pass an address that is a Proxy address it will return the relvant addresses and isProxied of true.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Get Addresses for Caller&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function getAddressesForCaller() external view returns (address nominator, address delivery, bool isProxied);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Returns the Nominator, Proxy, Delivery and a boolean isProxied for msg.sender. If msg.sender is not a Proxy address it will return address(0) for the Nominator, Proxy and Delivery address and isProxied of false. If msg.sender is a Proxy address it will return the relvant addresses and isProxied of true.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Get Role&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function getRole(address _roleAddress) external view returns (string memory currentRole);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Returns a string value with a role for the passed address. Possible roles are:&lt;&#x2F;p&gt;
&lt;p&gt;None The address does not appear on the Register as either a Record or a Nomination.&lt;&#x2F;p&gt;
&lt;p&gt;Nominator - Pending The address is the Nominator on a Nomination which has yet to be accepted by the nominated Proxy address.&lt;&#x2F;p&gt;
&lt;p&gt;Nominator - Active The address is a Nominator on an active Proxy Record (i.e. the Nomination has been accepted).&lt;&#x2F;p&gt;
&lt;p&gt;Proxy - Active The address is a Proxy on an active Proxy Record.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Get Role for Caller&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function getRoleForCaller() external view returns (string memory currentRole);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Returns a string value with a role for msg.sender. Possible roles are:&lt;&#x2F;p&gt;
&lt;p&gt;None The msg.sender does not appear on the Register as either a Record or a Nomination.&lt;&#x2F;p&gt;
&lt;p&gt;Nominator - Pending The msg.sender is the Nominator on a Nomination which has yet to be accepted by the nominated Proxy address.&lt;&#x2F;p&gt;
&lt;p&gt;Nominator - Active The msg.sender is a Nominator on an active Proxy Record (i.e. the Nomination has been accepted).&lt;&#x2F;p&gt;
&lt;p&gt;Proxy - Active The msg.sender is a Proxy on an active Proxy Record.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Make Nomination&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function makeNomination(address _proxy, uint256 _provider) external payable;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Can be passed a Proxy address to create a Nomination for the msg.sender.&lt;&#x2F;p&gt;
&lt;p&gt;Provider is a required argument. If you do not have a Provider ID you can pass 0 as the default EPS provider. For details on the EPS Provider Program please see .&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Accept Nomination&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function acceptNomination(address _nominator, address _delivery, uint256 _provider) external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Can be passed a Nominator and Delivery address to accept a Nomination for a msg.sender. Note that to accept a Nomination the Nomination needs to exists with the msg.sender as the Proxy. The Nominator passed to the function and that on the Nomination must match.&lt;&#x2F;p&gt;
&lt;p&gt;Provider is a required argument. If you do not have a Provider ID you can pass 0 as the default EPS provider. For details on the EPS Provider Program please see .&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Update Delivery Record&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function updateDeliveryAddress(address _delivery, uint256 _provider) external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Can be passed a new Delivery address where the msg.sender is the Proxy on a Proxy Record.&lt;&#x2F;p&gt;
&lt;p&gt;Provider is a required argument. If you do not have a Provider ID you can pass 0 as the default EPS provider. For details on the EPS Provider Program please see .&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Delete Record by Nominator&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function deleteRecordByNominator(uint256 _provider) external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Can be called to delete a Record and Nomination when the msg.sender is a Nominator.&lt;&#x2F;p&gt;
&lt;p&gt;Note that when both a Record and Nomination exist both are deleted. If no Record exists (i.e. the Nomination hasn&#x27;t been accepted by the Proxy address) the Nomination is deleted.&lt;&#x2F;p&gt;
&lt;p&gt;Provider is a required argument. If you do not have a Provider ID you can pass 0 as the default EPS provider. For details on the EPS Provider Program please see .&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Delete Record by Proxy&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function deleteRecordByProxy(uint256 _provider) external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Can be called to delete a Record and Nomination when the msg.sender is a Proxy.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The rationale for this EIP was to provide a way for all existing and future Ethereum assets to be have a &#x27;beneficial owner&#x27; (the proxy) that is different to the address custodying the asset. The use of a register to achieve this ensures that changes to existing tokens are not required. The register stores a trustless proof, signed by both the nominator and proxy, that can be relied upon as a true representation of asset ownership.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The EIP is fully backwards compatible.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;The full SDLC for this proposal has been completed and it is operation at 0xfa3D2d059E9c0d348dB185B32581ded8E8243924 on mainnet, ropsten and rinkeby. The contract source code is validated and available on etherscan. The full unit test suite is available in &lt;code&gt;.&#x2F;assets&#x2F;&lt;&#x2F;code&gt;, as is the source code and example implementations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Please see &lt;code&gt;.&#x2F;assets&#x2F;contracts&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The core intention of the EIP is to improve user security by better safeguarding assets and allowing greater use of cold wallet storage.&lt;&#x2F;p&gt;
&lt;p&gt;Potential negative security implications have been considered and none are envisaged. The proxy record can only become operational when a nomination has been confirmed by a proxy address, both addresses therefore having provided signed proof.&lt;&#x2F;p&gt;
&lt;p&gt;From a usability perspective the key risk is in users specifying the incorrect asset delivery address, though it is noted that this burden of accuracy is no different to that currently on the network.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Vanilla Options for ERC-20 Tokens</title>
        <published>2022-09-02T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Ewan Humbert</name><uri>https://github.com/Xeway</uri><email>xeway@protonmail.com</email>
	</author>
	
	<author>
		<name>Lassi Maksimainen</name><uri>https://github.com/mlalma</uri><email>lassi.maksimainen@gmail.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7390/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7390-vanilla-option-standard/15206" />
        

        <id>https://wg-eips.ritovision.com/7390/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7390"
            label="ERC-7390" />
        

        
        

        
        <summary type="html">An interface for creating, managing, and executing simple time-limited call&#x2F;put (vanilla) options.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7390/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard defines a comprehensive set of functions and events facilitating seamless interactions (creation, management, exercising, etc.) for vanilla options.&lt;&#x2F;p&gt;
&lt;p&gt;Vanilla options grant the right, without obligation, to buy or sell an asset at a set price within a specified timeframe.&lt;&#x2F;p&gt;
&lt;p&gt;This standard doesn&#x27;t represent a simple option that would be useless after the expiration date. Instead, it can store as many issuance as needed. Each issuance is identified by an id, and can be bought, exercised, cancelled, etc., independently of the other issuances.&lt;br &#x2F;&gt;
Every issuance is collateralized, meaning that the writer has to provide the collateral to the contract before the buyer can buy the option. The writer can retrieve the collateral if the buyer hasn&#x27;t exercised in the exercise window.&lt;br &#x2F;&gt;
A buyer can decide to buy only a fraction of the issuance (meaning multiple buyers is possible), and will receive accordingly tokens (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt;) that represent the fraction of the issuance. From now, we will call these tokens &lt;em&gt;redeem tokens&lt;&#x2F;em&gt;. These tokens can be exchanged between users, and are used for exercising the option. With this mechanism, a buyer can decide to exercise only a fraction of what he bought.&lt;br &#x2F;&gt;
Also, the writer can decide to cancel the issuance if no option has been bought yet. He also has the right to update the premium price at any time. This doesn&#x27;t affect the already bought options.&lt;br &#x2F;&gt;
The underlying token, strike token and premium token are &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens.&lt;&#x2F;p&gt;
&lt;p&gt;In the following, the plural term option&lt;strong&gt;s&lt;&#x2F;strong&gt; will sometimes be used. This can refer to the amount of redeem tokens a buyer purchased and can exercise.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Options are widely used financial instruments, and have a true usefulness for investors and traders. It offers versatile risk management tools and speculative opportunities.&lt;br &#x2F;&gt;
In the decentralized finance, many options-selling platform emerged, but each of these protocols implements their own definition of an option. This leads to incompatibilities, which is a pity because options should be interoperable like fungible&#x2F;non-fungible tokens are.&lt;br &#x2F;&gt;
By introducing a standard interface for vanilla options contracts, we aim to foster a more inclusive and interoperable derivatives ecosystem. This standard will enhance the user experience and facilitate the development of decentralized options platforms, enabling users to seamlessly trade options across different applications. Moreover, this standard is designed to represent vanilla options, which are the most common type of options. This standard can be used as a base for more complex options, such as exotic options.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Implementations of this proposal MUST also implement ERC-1155 to give the possibility to buy only a fraction of the issuance.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;interface&quot;&gt;Interface&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC7390&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Side&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        Call&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        Put&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; VanillaOptionData&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        Side side&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; underlyingToken&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; strikeToken&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; strike&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; premiumToken&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; premium&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; exerciseWindowStart&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; exerciseWindowEnd&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; allowed&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OptionIssuance&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        VanillaOptionData data&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; writer&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; exercisedAmount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; soldAmount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Forbidden&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransferFailed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TimeForbidden&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AmountForbidden&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InsufficientBalance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Created&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Bought&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; buyer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Exercised&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Expired&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Canceled&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PremiumUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AllowedUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; allowed&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; create&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;VanillaOptionData&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; optionData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; buy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; exercise&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; retrieveExpiredTokens&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; receiver&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; cancel&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; receiver&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; updatePremium&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; updateAllowed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; allowed&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; issuance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;OptionIssuance&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;state-variable-descriptions&quot;&gt;State Variable Descriptions&lt;&#x2F;h3&gt;
&lt;p&gt;At creation time, user must provide filled instance of &lt;code&gt;VanillaOptionData&lt;&#x2F;code&gt; structure that contains all the key information for initializing the option issuance.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;side&quot;&gt;&lt;code&gt;side&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;Type: &lt;code&gt;enum&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Side of the option. Can take the value &lt;code&gt;Call&lt;&#x2F;code&gt; or &lt;code&gt;Put&lt;&#x2F;code&gt;. &lt;code&gt;Call&lt;&#x2F;code&gt; option gives the option buyer right to exercise any acquired option tokens to buy the &lt;code&gt;underlying&lt;&#x2F;code&gt; token at given &lt;code&gt;strike&lt;&#x2F;code&gt; price using &lt;code&gt;strikeToken&lt;&#x2F;code&gt; from option writer. Similarly, &lt;code&gt;Put&lt;&#x2F;code&gt; option gives the option buyer right to sell the &lt;code&gt;underlying&lt;&#x2F;code&gt; token to the option writer at &lt;code&gt;strike&lt;&#x2F;code&gt; price.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;underlyingtoken&quot;&gt;&lt;code&gt;underlyingToken&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;Type: &lt;code&gt;address&lt;&#x2F;code&gt; (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; contract)&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Underlying token.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;amount&quot;&gt;&lt;code&gt;amount&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;Type: &lt;code&gt;uint256&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Maximum amount of the underlying tokens that can be exercised.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Be aware of token decimals!&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h4 id=&quot;striketoken&quot;&gt;&lt;code&gt;strikeToken&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;Type: &lt;code&gt;address&lt;&#x2F;code&gt; (ERC-20 contract)&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Token used as a reference to determine the strike price.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;strike&quot;&gt;&lt;code&gt;strike&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;Type: &lt;code&gt;uint256&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Strike price. The option buyer MAY be able to exercise only fraction of the issuance and the paid strike price must be adjusted by the contract to reflect it.&lt;&#x2F;p&gt;
&lt;p&gt;Note that &lt;code&gt;strike&lt;&#x2F;code&gt; is meant to represent the price in &lt;code&gt;strikeToken&lt;&#x2F;code&gt; for a single &lt;code&gt;underlyingToken&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Be aware of token decimals!&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h4 id=&quot;premiumtoken&quot;&gt;&lt;code&gt;premiumToken&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;Type: &lt;code&gt;address&lt;&#x2F;code&gt; (ERC-20 contract)&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Premium token.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;premium&quot;&gt;&lt;code&gt;premium&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;Type: &lt;code&gt;uint256&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Premium price is the price that option buyer has to pay to option writer to compensate for the risk that the writer takes for issuing the option. Option premium changes depending on various factors, most important ones being the volatility of the underlying token, strike price and the time left for exercising the option.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Note that the premium price is set for exercising the total &lt;code&gt;amount&lt;&#x2F;code&gt; of the issuance. The buyer MAY be able to buy only fraction of the option tokens and the paid premium price must be adjusted by the contract to reflect it.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Be aware of token decimals!&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h4 id=&quot;exercisewindowstart&quot;&gt;&lt;code&gt;exerciseWindowStart&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;Type: &lt;code&gt;uint256&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
&lt;strong&gt;Format: &lt;em&gt;timestamp as seconds since unix epoch&lt;&#x2F;em&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Option exercising window start time. When current time is greater or equal to &lt;code&gt;exerciseWindowStart&lt;&#x2F;code&gt; and below or equal to &lt;code&gt;exerciseWindowEnd&lt;&#x2F;code&gt;, owner of option(s) can exercise them.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;exercisewindowend&quot;&gt;&lt;code&gt;exerciseWindowEnd&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;Type: &lt;code&gt;uint256&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
&lt;strong&gt;Format: &lt;em&gt;timestamp as seconds since unix epoch&lt;&#x2F;em&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Option exercising window end time. When current time is greater or equal to &lt;code&gt;exerciseWindowStart&lt;&#x2F;code&gt; and below or equal to &lt;code&gt;exerciseWindowEnd&lt;&#x2F;code&gt;, owner of option(s) can exercise them. When current time is greater than &lt;code&gt;exerciseWindowEnd&lt;&#x2F;code&gt;, buyers can&#x27;t exercise and writer can retrieve remaining underlying (call) or strike (put) tokens.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;allowed&quot;&gt;&lt;code&gt;allowed&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;Type: &lt;code&gt;address[]&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Addresses that are allowed to buy the issuance. If the array is empty, all addresses are allowed to buy the issuance.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;VanillaOptionData&lt;&#x2F;code&gt; is stored in the &lt;code&gt;OptionIssuance&lt;&#x2F;code&gt; struct, which is used to store the option issuance data. It contains other information.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;writer&quot;&gt;&lt;code&gt;writer&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;Type: &lt;code&gt;address&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Address of the writer meaning the address that created the option.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;exercisedamount&quot;&gt;&lt;code&gt;exercisedAmount&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;Type: &lt;code&gt;uint256&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Amount of underlying tokens that have been exercised.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;soldamount&quot;&gt;&lt;code&gt;soldAmount&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;Type: &lt;code&gt;uint256&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Amount of underlying tokens that have been bought for this issuance.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;transferredexercisecost&quot;&gt;&lt;code&gt;transferredExerciseCost&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;Type: &lt;code&gt;uint256&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Amount of &lt;code&gt;strikeToken&lt;&#x2F;code&gt; tokens that have been transferred to the writer (call) or buyers (put) of the option issuance.&lt;br &#x2F;&gt;
This is an utility variable used to not always have to calculate the total exercise cost transferred. It&#x27;s updated at the same time &lt;code&gt;exercisedAmount&lt;&#x2F;code&gt; is updated. The calculation is &lt;code&gt;(amount * selectedIssuance.data.strike) &#x2F; (10**underlyingToken.decimals())&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;exercisecost&quot;&gt;&lt;code&gt;exerciseCost&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;Type: &lt;code&gt;uint256&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Exercise cost. It represents the collateral the writer has to deposit to the contract (put), or the amount of &lt;code&gt;strikeToken&lt;&#x2F;code&gt; tokens a writer can receive if all buyers decide to exercise (call).&lt;br &#x2F;&gt;
This is an utility variable used to not always have to calculate the exercise cost. We compute it at the creation of the option. The calculation is &lt;code&gt;(strike * amount) &#x2F; (10 ** underlyingToken.decimals())&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;function-descriptions&quot;&gt;Function Descriptions&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;constructor&quot;&gt;&lt;code&gt;constructor&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;No constructor is needed for this standard, but the contract MUST implement the ERC-1155 interface. So, the contract MUST call the ERC-1155 constructor.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;create&quot;&gt;&lt;code&gt;create&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; create&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;VanillaOptionData&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; optionData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Option writer creates new option tokens and defines the option parameters using &lt;code&gt;create()&lt;&#x2F;code&gt;. As an argument, option writer needs to fill &lt;code&gt;VanillaOptionData&lt;&#x2F;code&gt; data structure instance and pass it to the method. As a part of creating the option tokens, the function transfers the collateral from option writer to the contract.&lt;&#x2F;p&gt;
&lt;p&gt;It is highly preferred that as a part of calling &lt;code&gt;create()&lt;&#x2F;code&gt; the option issuance becomes fully collateralized to prevent increased counterparty risk. For creating a call (put) option issuance, writer needs to allow the amount of &lt;code&gt;amount&lt;&#x2F;code&gt; (&lt;code&gt;strike&lt;&#x2F;code&gt;) tokens of &lt;code&gt;underlyingToken&lt;&#x2F;code&gt; (&lt;code&gt;strikeToken&lt;&#x2F;code&gt;) to be transferred to the option contract before calling &lt;code&gt;create()&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Note that this standard does not define functionality for option writer to &quot;re-up&quot; the collateral in case the option contract allows under-collateralization. The contract needs to then adjust its API and implementation accordingly.&lt;&#x2F;p&gt;
&lt;p&gt;MUST revert if &lt;code&gt;underlyingToken&lt;&#x2F;code&gt; or &lt;code&gt;strikeToken&lt;&#x2F;code&gt; is the zero address.&lt;br &#x2F;&gt;
MUST revert if &lt;code&gt;premium&lt;&#x2F;code&gt; is not 0 and &lt;code&gt;premiumToken&lt;&#x2F;code&gt; is the zero address.&lt;br &#x2F;&gt;
MUST revert if &lt;code&gt;amount&lt;&#x2F;code&gt; or &lt;code&gt;strike&lt;&#x2F;code&gt; is 0.&lt;br &#x2F;&gt;
MUST revert if &lt;code&gt;exerciseWindowStart&lt;&#x2F;code&gt; is less than the current time or if &lt;code&gt;exerciseWindowEnd&lt;&#x2F;code&gt; is less than &lt;code&gt;exerciseWindowStart&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Returns an id value that refers to the created option issuance in option contract if option issuance was successful.&lt;&#x2F;em&gt;
&lt;em&gt;Emits &lt;code&gt;Created&lt;&#x2F;code&gt; event if option issuance was successful.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;buy&quot;&gt;&lt;code&gt;buy&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; buy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Allows the buyer to buy &lt;code&gt;amount&lt;&#x2F;code&gt; of option tokens from option issuance with the defined &lt;code&gt;id&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The buyer has to allow the token contract to transfer the (fraction of total) &lt;code&gt;premium&lt;&#x2F;code&gt; in the specified &lt;code&gt;premiumToken&lt;&#x2F;code&gt; to option writer. During the call of the function, the premium is be directly transferred to the writer.&lt;&#x2F;p&gt;
&lt;p&gt;If &lt;code&gt;allowed&lt;&#x2F;code&gt; array is not empty, the buyer&#x27;s address MUST be included in this list.&lt;br &#x2F;&gt;
MUST revert if &lt;code&gt;amount&lt;&#x2F;code&gt; is 0 or greater than the remaining options available for purchase.&lt;br &#x2F;&gt;
MUST revert if the current time is greater than &lt;code&gt;exerciseWindowEnd&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Mints &lt;code&gt;amount&lt;&#x2F;code&gt; redeem tokens to the buyer&#x27;s address if buying was successful.&lt;&#x2F;em&gt;
&lt;em&gt;Emits &lt;code&gt;Bought&lt;&#x2F;code&gt; event if buying was successful.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;exercise&quot;&gt;&lt;code&gt;exercise&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; exercise&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Allows the buyer to exercise &lt;code&gt;amount&lt;&#x2F;code&gt; of option tokens from option issuance with the defined &lt;code&gt;id&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If the option is a call, buyer pays writer at the specified strike price and gets the specified underlying tokens.&lt;&#x2F;li&gt;
&lt;li&gt;If the option is a put, buyer transfers to writer the underlying tokens and gets paid at the specified strike price.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The buyer has to allow the spend of either &lt;code&gt;strikeToken&lt;&#x2F;code&gt; or &lt;code&gt;underlyingToken&lt;&#x2F;code&gt; before calling &lt;code&gt;exercise()&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Exercise MUST only take place when &lt;code&gt;exerciseWindowStart&lt;&#x2F;code&gt; &amp;lt;= current time &amp;lt;= &lt;code&gt;exerciseWindowEnd&lt;&#x2F;code&gt;.&lt;br &#x2F;&gt;
MUST revert if &lt;code&gt;amount&lt;&#x2F;code&gt; is 0 or buyer hasn&#x27;t the necessary redeem tokens to exercise the option.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Burns &lt;code&gt;amount&lt;&#x2F;code&gt; redeem tokens from the buyer&#x27;s address if the exercising was successful.&lt;&#x2F;em&gt;
&lt;em&gt;Emits &lt;code&gt;Exercised&lt;&#x2F;code&gt; event if the option exercising was successful.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;retrieveexpiredtokens&quot;&gt;&lt;code&gt;retrieveExpiredTokens&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; retrieveExpiredTokens&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; receiver&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Allows writer to retrieve the collateral tokens that were not exercised. These tokens are transferred to &lt;code&gt;receiver&lt;&#x2F;code&gt;.&lt;br &#x2F;&gt;
If the option is a call, &lt;code&gt;receiver&lt;&#x2F;code&gt; retrieves the underlying tokens. If the option is a put, &lt;code&gt;receiver&lt;&#x2F;code&gt; retrieves the strike tokens.&lt;&#x2F;p&gt;
&lt;p&gt;MUST revert if the address calling the function is not the writer of the option issuance.&lt;br &#x2F;&gt;
MUST revert if &lt;code&gt;exerciseWindowEnd&lt;&#x2F;code&gt; is greater or equals than the current time.&lt;br &#x2F;&gt;
If equals to the zero address, MUST set &lt;code&gt;receiver&lt;&#x2F;code&gt; to caller&#x27;s address.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Transfers the un-exercised collateral to the writer&#x27;s address.&lt;&#x2F;em&gt;
&lt;em&gt;MAY delete the option issuance from the contract if the retrieval was successful.&lt;&#x2F;em&gt;
&lt;em&gt;Emits &lt;code&gt;Expired&lt;&#x2F;code&gt; event if the retrieval was successful.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;cancel&quot;&gt;&lt;code&gt;cancel&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; cancel&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; receiver&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Allows writer to cancel the option and retrieve tokens used as collateral. These tokens are transferred to &lt;code&gt;receiver&lt;&#x2F;code&gt;.&lt;br &#x2F;&gt;
If the option is a call, &lt;code&gt;receiver&lt;&#x2F;code&gt; retrieves the underlying tokens. If the option is a put, &lt;code&gt;receiver&lt;&#x2F;code&gt; retrieves the strike tokens.&lt;&#x2F;p&gt;
&lt;p&gt;MUST revert if the address calling the function is not the writer of the option issuance.&lt;br &#x2F;&gt;
MUST revert if at least one option&#x27;s fraction has been bought.&lt;br &#x2F;&gt;
If equals to the zero address, MUST set &lt;code&gt;receiver&lt;&#x2F;code&gt; to caller&#x27;s address.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Transfers the un-exercised collateral to the writer&#x27;s address.&lt;&#x2F;em&gt;
&lt;em&gt;MAY delete the option issuance from the contract if the cancelation was successful.&lt;&#x2F;em&gt;
&lt;em&gt;Emits &lt;code&gt;Canceled&lt;&#x2F;code&gt; event if the cancelation was successful.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;updatepremium&quot;&gt;&lt;code&gt;updatePremium&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; updatePremium&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Allows the writer to update the premium that buyers will need to provide for buying the options.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Note that the &lt;code&gt;amount&lt;&#x2F;code&gt; will be for the whole underlying amount, not only for the options that might still be available for purchase.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;MUST revert if the address calling the function is not the writer of the option issuance.&lt;br &#x2F;&gt;
MUST revert if the current time is greater than &lt;code&gt;exerciseWindowEnd&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Emits &lt;code&gt;PremiumUpdated&lt;&#x2F;code&gt; event when the function call was handled successfully.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;updateallowed&quot;&gt;&lt;code&gt;updateAllowed&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; updateAllowed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; allowed&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Allows the writer to update the list of allowed addresses that can buy the option issuance.&lt;br &#x2F;&gt;
If a buyer already bought an option and his address is not in the new list, he will still be able to exercise his purchased options.&lt;&#x2F;p&gt;
&lt;p&gt;MUST revert if the address calling the function is not the writer of the option issuance.&lt;br &#x2F;&gt;
MUST revert if the current time is greater than &lt;code&gt;exerciseWindowEnd&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Emits &lt;code&gt;AllowedUpdated&lt;&#x2F;code&gt; event when the function call was handled successfully.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;issuance&quot;&gt;&lt;code&gt;issuance&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; issuance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;OptionIssuance&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Returns all the key information for the option issuance with the given &lt;code&gt;id&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;events&quot;&gt;Events&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;created&quot;&gt;&lt;code&gt;Created&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Created&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Emitted when the writer has provided option issuance data successfully (and locked down the collateral to the contract). The given &lt;code&gt;id&lt;&#x2F;code&gt; identifies the particular option issuance.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;bought&quot;&gt;&lt;code&gt;Bought&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Bought&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; buyer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Emitted when options have been bought. Provides information about the option issuance &lt;code&gt;id&lt;&#x2F;code&gt;, the address of &lt;code&gt;buyer&lt;&#x2F;code&gt; and the &lt;code&gt;amount&lt;&#x2F;code&gt; of options bought.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;exercised&quot;&gt;&lt;code&gt;Exercised&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Exercised&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Emitted when the option has been exercised from the option issuance with given &lt;code&gt;id&lt;&#x2F;code&gt; and the given &lt;code&gt;amount&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;expired&quot;&gt;&lt;code&gt;Expired&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Expired&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Emitted when the writer of the option issuance with &lt;code&gt;id&lt;&#x2F;code&gt; has retrieved the un-exercised collateral.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;canceled&quot;&gt;&lt;code&gt;Canceled&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Canceled&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Emitted when the option issuance with given &lt;code&gt;id&lt;&#x2F;code&gt; has been cancelled by the writer.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;premiumupdated&quot;&gt;&lt;code&gt;PremiumUpdated&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PremiumUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Emitted when writer updates the premium to &lt;code&gt;amount&lt;&#x2F;code&gt; for option issuance with given &lt;code&gt;id&lt;&#x2F;code&gt;. Note that the updated premium is for the total issuance.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;allowedupdated&quot;&gt;&lt;code&gt;AllowedUpdated&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AllowedUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; allowed&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Emitted when writer updates the list of allowed addresses for option issuance with given &lt;code&gt;id&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;errors&quot;&gt;Errors&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;forbidden&quot;&gt;&lt;code&gt;Forbidden&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Reverts when the caller is not allowed to perform some actions (general purpose).&lt;&#x2F;p&gt;
&lt;h4 id=&quot;transferfailed&quot;&gt;&lt;code&gt;TransferFailed&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Reverts when the transfer of tokens failed.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;timeforbidden&quot;&gt;&lt;code&gt;TimeForbidden&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Reverts when the current time of the execution is invalid.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;amountforbidden&quot;&gt;&lt;code&gt;AmountForbidden&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Reverts when the amount is invalid.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;insufficientbalance&quot;&gt;&lt;code&gt;InsufficientBalance&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Reverts when the caller has insufficient balance to perform the action.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;concrete-examples&quot;&gt;Concrete Examples&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;call-option&quot;&gt;Call Option&lt;&#x2F;h4&gt;
&lt;p&gt;Let&#x27;s say Bob sells a &lt;strong&gt;call&lt;&#x2F;strong&gt; option.&lt;br &#x2F;&gt;
He gives the right to anyone to buy &lt;strong&gt;8 TokenA&lt;&#x2F;strong&gt; at &lt;strong&gt;25 TokenB&lt;&#x2F;strong&gt; each between &lt;strong&gt;14th of July 2023&lt;&#x2F;strong&gt; and &lt;strong&gt;16th of July 2023 (at midnight)&lt;&#x2F;strong&gt;.&lt;br &#x2F;&gt;
For such a contract, he wants to receive a premium of &lt;strong&gt;10 TokenC&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Before creating the option, Bob has to transfer the collateral to the contract. This collateral corresponds to the tokens he will have to give if the option if fully exercised (&lt;code&gt;amount&lt;&#x2F;code&gt;). For this option, he has to give as collateral 8 TokenA. He does that by calling the function &lt;code&gt;approve(address spender, uint256 amount)&lt;&#x2F;code&gt; on the TokenA&#x27;s contract and as parameters the contract&#x27;s address (&lt;code&gt;spender&lt;&#x2F;code&gt;) and for &lt;code&gt;amount&lt;&#x2F;code&gt;: &lt;strong&gt;8 * 10^(TokenA&#x27;s decimals)&lt;&#x2F;strong&gt;. Then Bob can execute &lt;code&gt;create()&lt;&#x2F;code&gt; on the contract for issuing the option, giving the following parameters:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;side&lt;&#x2F;code&gt;: &lt;strong&gt;Call&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;underlyingToken&lt;&#x2F;code&gt;: &lt;strong&gt;TokenA&#x27;s address&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;amount&lt;&#x2F;code&gt;: &lt;strong&gt;8 * 10^(TokenA&#x27;s decimals)&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;strikeToken&lt;&#x2F;code&gt;: &lt;strong&gt;TokenB&#x27;s address&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;strike&lt;&#x2F;code&gt;: &lt;strong&gt;25 * 10^(TokenB&#x27;s decimals)&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;premiumToken&lt;&#x2F;code&gt;: &lt;strong&gt;TokenC&#x27;s address&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;premium&lt;&#x2F;code&gt;: &lt;strong&gt;10 * 10^(TokenC&#x27;s decimals)&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;exerciseWindowStart&lt;&#x2F;code&gt;: &lt;strong&gt;1689292800&lt;&#x2F;strong&gt; &lt;em&gt;(2023-07-14 timestamp)&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;exerciseWindowEnd&lt;&#x2F;code&gt;: &lt;strong&gt;1689465600&lt;&#x2F;strong&gt; &lt;em&gt;(2023-07-16 timestamp)&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;allowed&lt;&#x2F;code&gt;: &lt;code&gt;[]&lt;&#x2F;code&gt; (open to anyone)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The issuance has ID 88.&lt;&#x2F;p&gt;
&lt;p&gt;Alice wants to be able to buy only &lt;strong&gt;4&lt;&#x2F;strong&gt; TokenA. She will first have to pay the premium (that is proportional to its share) by allowing the spending of his 10 TokenC by calling &lt;code&gt;approve(address spender, uint256 amount)&lt;&#x2F;code&gt; on the TokenC&#x27;s contract and give as parameters the contract&#x27;s address (&lt;code&gt;spender&lt;&#x2F;code&gt;) and for &lt;code&gt;amount&lt;&#x2F;code&gt;: &lt;strong&gt;4*10^(TokenA&#x27;s decimals) * 10*10^(TokenC&#x27;s decimals) &#x2F; 8*10^(TokenA&#x27;s decimals)&lt;&#x2F;strong&gt; (amountToBuy * &lt;code&gt;premium&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;amount&lt;&#x2F;code&gt;). She can then execute &lt;code&gt;buy(88, 4 * 10^(TokenA&#x27;s decimals))&lt;&#x2F;code&gt; on the contract, and will receive 4*10^(TokenA&#x27;s decimals) redeem tokens.&lt;&#x2F;p&gt;
&lt;p&gt;John, for his part, wants to buy &lt;strong&gt;2&lt;&#x2F;strong&gt; TokenA. He does the same thing and receives &lt;strong&gt;2*10^(TokensA&#x27;s decimals)&lt;&#x2F;strong&gt; redeem tokens.&lt;&#x2F;p&gt;
&lt;p&gt;We&#x27;re on the 15th of July and Alice wants to exercise his option because 1 TokenA is traded at 50 TokenB! She needs to allow the contract to transfer &lt;strong&gt;4*10^(TokenA&#x27;s decimals) * 25*10^(TokenB&#x27;s decimals) &#x2F; 10^(TokenA&#x27;s decimals)&lt;&#x2F;strong&gt; (amountToExercise * &lt;code&gt;strike&lt;&#x2F;code&gt; &#x2F; 10^(&lt;code&gt;TokenA&lt;&#x2F;code&gt;&#x27;s decimals)) TokenBs from her account to be able to exercise. When she calls &lt;code&gt;exercise(88, 4 * 10^(TokenA&#x27;s decimals))&lt;&#x2F;code&gt; on the contract, it will transfer 4 TokenA to Alice, and 4*25 TokenB to Bob.&lt;&#x2F;p&gt;
&lt;p&gt;John decided to give his right to exercise to his friend Jimmy. He did that simply by transferring his &lt;strong&gt;2*10^(TokensA&#x27;s decimals)&lt;&#x2F;strong&gt; redeem tokens to Jimmy&#x27;s address.&lt;br &#x2F;&gt;
Jimmy decides to only buy &lt;strong&gt;1&lt;&#x2F;strong&gt; TokenA with the option. So he will give to Bob (through the contract) &lt;strong&gt;1*10^(TokenA&#x27;s decimals) * 25*10^(TokenB&#x27;s decimals) &#x2F; 10^(TokenA&#x27;s decimals)&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;put-option&quot;&gt;Put Option&lt;&#x2F;h4&gt;
&lt;p&gt;Let&#x27;s say Bob sells a &lt;strong&gt;put&lt;&#x2F;strong&gt; option.&lt;br &#x2F;&gt;
He gives the right to anyone to sell to him &lt;strong&gt;8 TokenA&lt;&#x2F;strong&gt; at &lt;strong&gt;25 TokenB&lt;&#x2F;strong&gt; each between &lt;strong&gt;14th of July 2023&lt;&#x2F;strong&gt; and &lt;strong&gt;16th of July 2023 (at midnight)&lt;&#x2F;strong&gt;.&lt;br &#x2F;&gt;
For such a contract, he wants to receive a premium of &lt;strong&gt;10 TokenC&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Before creating the option, Bob has to transfer the collateral to the contract. This collateral corresponds to the tokens he will have to give if the option if fully exercised (&lt;code&gt;exerciseCost&lt;&#x2F;code&gt;). For this option, he has to give as collateral 200 TokenB (8 * 25). He does that by calling the function &lt;code&gt;approve(address spender, uint256 amount)&lt;&#x2F;code&gt; on the TokenB&#x27;s contract and as parameters the contract&#x27;s address (&lt;code&gt;spender&lt;&#x2F;code&gt;) and for &lt;code&gt;amount&lt;&#x2F;code&gt;: &lt;strong&gt;25*10^(Token B&#x27;s decimals) * 8*10^(TokenB&#x27;s decimals) &#x2F; 10^(TokenA&#x27;s decimals)&lt;&#x2F;strong&gt; (&lt;code&gt;strike&lt;&#x2F;code&gt; * &lt;code&gt;amount&lt;&#x2F;code&gt; &#x2F; 10^(&lt;code&gt;underlyingToken&lt;&#x2F;code&gt;&#x27;s decimals)). Then Bob can execute &lt;code&gt;create()&lt;&#x2F;code&gt; on the contract for issuing the option, giving the following parameters:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;side&lt;&#x2F;code&gt;: &lt;strong&gt;Put&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;underlyingToken&lt;&#x2F;code&gt;: &lt;strong&gt;TokenA&#x27;s address&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;amount&lt;&#x2F;code&gt;: &lt;strong&gt;8 * 10^(TokenA&#x27;s decimals)&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;strikeToken&lt;&#x2F;code&gt;: &lt;strong&gt;TokenB&#x27;s address&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;strike&lt;&#x2F;code&gt;: &lt;strong&gt;25 * 10^(TokenB&#x27;s decimals)&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;premiumToken&lt;&#x2F;code&gt;: &lt;strong&gt;TokenC&#x27;s address&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;premium&lt;&#x2F;code&gt;: &lt;strong&gt;10 * 10^(TokenC&#x27;s decimals)&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;exerciseWindowStart&lt;&#x2F;code&gt;: &lt;strong&gt;1689292800&lt;&#x2F;strong&gt; &lt;em&gt;(2023-07-14 timestamp)&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;exerciseWindowEnd&lt;&#x2F;code&gt;: &lt;strong&gt;1689465600&lt;&#x2F;strong&gt; &lt;em&gt;(2023-07-16 timestamp)&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;allowed&lt;&#x2F;code&gt;: &lt;code&gt;[]&lt;&#x2F;code&gt; (open to anyone)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The issuance has ID 88.&lt;&#x2F;p&gt;
&lt;p&gt;Alice wants to be able to sell only &lt;strong&gt;4&lt;&#x2F;strong&gt; TokenA. She will first have to pay the premium (that is proportional to its share) by allowing the spending of his 10 TokenC by calling &lt;code&gt;approve(address spender, uint256 amount)&lt;&#x2F;code&gt; on the TokenC&#x27;s contract and give as parameters the contract&#x27;s address (&lt;code&gt;spender&lt;&#x2F;code&gt;) and for &lt;code&gt;amount&lt;&#x2F;code&gt;: &lt;strong&gt;4*10^(TokenA&#x27;s decimals) * 10*10^(TokenC&#x27;s decimals) &#x2F; 8*10^(TokenA&#x27;s decimals)&lt;&#x2F;strong&gt; (amountToSell * &lt;code&gt;premium&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;amount&lt;&#x2F;code&gt;). She can then execute &lt;code&gt;buy(88, 4 * 10^(TokenA&#x27;s decimals))&lt;&#x2F;code&gt; on the contract, and will receive 4*10^(TokenA&#x27;s decimals) redeem tokens.&lt;&#x2F;p&gt;
&lt;p&gt;John, for his part, wants to sell &lt;strong&gt;2&lt;&#x2F;strong&gt; TokenA. He does the same thing and receives &lt;strong&gt;2*10^(TokensA&#x27;s decimals)&lt;&#x2F;strong&gt; redeem tokens.&lt;&#x2F;p&gt;
&lt;p&gt;We&#x27;re on the 15th of July and Alice wants to exercise his option because 1 TokenA is traded at only 10 TokenB! She needs to allow the contract to transfer &lt;strong&gt;4 * 10^(TokenA&#x27;s decimals)&lt;&#x2F;strong&gt; TokenAs from her account to be able to exercise. When she calls &lt;code&gt;exercise(88, 4 * 10^(TokenA&#x27;s decimals))&lt;&#x2F;code&gt; on the contract, it will transfer 4*25 TokenB to Alice and 4 TokenA to Bob.&lt;&#x2F;p&gt;
&lt;p&gt;John decided to give his right to exercise to his friend Jimmy. He did that simply by transferring his &lt;strong&gt;2*10^(TokensA&#x27;s decimals)&lt;&#x2F;strong&gt; redeem tokens to Jimmy&#x27;s address.&lt;br &#x2F;&gt;
Jimmy decides to only sell &lt;strong&gt;1&lt;&#x2F;strong&gt; TokenA with the option. So he will give to Bob (through the contract) &lt;strong&gt;1*10^(TokenA&#x27;s decimals)&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;retrieve-collateral&quot;&gt;Retrieve collateral&lt;&#x2F;h4&gt;
&lt;p&gt;Let&#x27;s say Alice never exercised his option because it wasn&#x27;t profitable enough for her. To retrieve his collateral, Bob would have to wait for the current time to be greater than &lt;code&gt;exerciseWindowEnd&lt;&#x2F;code&gt;. In the examples, this characteristic is set to 2 days, so he would be able to get back his collateral from the 16th of July by simply calling &lt;code&gt;retrieveExpiredTokens()&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This contract&#x27;s concept is oracle-free, because we assume that a rational buyer will exercise his option only if it&#x27;s profitable for him.&lt;&#x2F;p&gt;
&lt;p&gt;The premium is to be determined by the option writer. writer is free to choose how to calculate the premium, e.g. by using &lt;em&gt;Black-Scholes model&lt;&#x2F;em&gt; or something else. writer can update the premium price at will in order to adjust it according to changes on the underlying&#x27;s price, volatility, time to option expiry and other such factors. Computing the premium off-chain is better for gas costs purposes.&lt;&#x2F;p&gt;
&lt;p&gt;This ERC is intended to represent vanilla options. However, exotic options can be built on top of this ERC.&lt;br &#x2F;&gt;
Instead of representing a single option that would be useless after the expiration date, this contract can store as many issuances as needed. Each issuance is identified by an id, and can be bought, exercised, cancelled, etc., independently of the other issuances. This is a better approach for gas costs purposes.&lt;&#x2F;p&gt;
&lt;p&gt;It&#x27;s designed so that the option can be either European or American, by introduction of the &lt;code&gt;exerciseWindowStart&lt;&#x2F;code&gt; and &lt;code&gt;exerciseWindowEnd&lt;&#x2F;code&gt; data points. A buyer can only exercise between &lt;code&gt;exerciseWindowStart&lt;&#x2F;code&gt; and &lt;code&gt;exerciseWindowEnd&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If the option writer considers the option to be European, he can set the &lt;code&gt;exerciseWindowStart&lt;&#x2F;code&gt; in line with the expiration date, and &lt;code&gt;exerciseWindowEnd&lt;&#x2F;code&gt; to the expiration date + a determined time range so that buyers have a period of time to exercise.&lt;&#x2F;li&gt;
&lt;li&gt;If the option writer considers the option to be American, he can set the &lt;code&gt;exerciseWindowStart&lt;&#x2F;code&gt; to the current time, and the buyer will be able to exercise the option immediately.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The contract inherently supports multiple buyers for a single option issuance. This is achieved by using ERC-1155 tokens for representing the options. When a buyer buys a fraction of the option issuance, he receives ERC-1155 tokens that represent the fraction of the option issuance. These tokens can be exchanged between users, and are used for exercising the option. With this mechanism, a buyer can decide to exercise only a fraction of what he bought.&lt;&#x2F;p&gt;
&lt;p&gt;The contract implements &lt;code&gt;allowed&lt;&#x2F;code&gt; array, which can be used to restrict the addresses that can buy the option issuance. This can be useful if two users agreed for an option off-chain and they want to create it on-chain. This prevents the risk that between the creation of the contract and the purchase by the second user, an on-chain user has already bought the contract.&lt;&#x2F;p&gt;
&lt;p&gt;This ERC is designed to handle ERC-20 tokens. However, this standard can be used as a good base for handling other types of tokens, such as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; tokens. Some attributes and functions signatures (to provide an id instead of an amount for instance) would have to be changed, but the general idea would remain the same.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Contract contains &lt;code&gt;exerciseWindowStart&lt;&#x2F;code&gt; and &lt;code&gt;exerciseWindowEnd&lt;&#x2F;code&gt; data points. These define the determined time range for the buyer to exercise options. When the current time is greater than &lt;code&gt;exerciseWindowEnd&lt;&#x2F;code&gt;, the buyer won&#x27;t be able to exercise and the writer will be able to retrieve any remaining collateral.&lt;&#x2F;p&gt;
&lt;p&gt;For preventing clear arbitrage cases when option writer considers the issuance to be of European options, we would strongly advice the option writer to call &lt;code&gt;updatePremium&lt;&#x2F;code&gt; to considerably increase the premium price when exercise window opens. This will make sure that the bots won&#x27;t be able to buy any remaining options and immediately exercise them for quick profit. Of course, this standard can be customized and maybe users will find more convenient to update the premium automatically using available tools, instead of doing it manually (especially if the premium is based on specific dynamic metrics like the &lt;em&gt;Black-Scholes model&lt;&#x2F;em&gt;). If the option issuance is considered to be American, such adjustment is of course not needed.&lt;&#x2F;p&gt;
&lt;p&gt;This standard implements the &lt;code&gt;updatePremium&lt;&#x2F;code&gt; function, which allows the writer to update the premium price at any time. This function can lead to security issues for the buyer: a buyer could buy an option, and the writer could front-run buyer&#x27;s transaction by updating the premium price to a very high value. To prevent this, we advise the buyer to only allow for the agreed amount of premium to be spent by the contract, not more.&lt;&#x2F;p&gt;
&lt;p&gt;The contract supports multiple buyers for a single option issuance, meaning fractions of the option issuance can be bought. The ecosystem doesn&#x27;t really support non-integers, so fractions can sometimes lead to rounding errors. This can lead to unexpected results, especially in the &lt;code&gt;buy&lt;&#x2F;code&gt; function: if the premium is set, the buyer has to pay for only a fraction proportional to the amount of options he wants to buy. If that fraction is not an integer, this will truncate and therefore round to floor. This means that writer will receive less than the expected premium. We consider this risk pretty negligible given that most tokens have a high number of decimals, but it&#x27;s important to be aware of it. Some buyer could exploit this by buying repeatedly small fraction, and therefore paying less than the expected premium. However, this probably wouldn&#x27;t be profitable given the gas costs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Digital Receipt Non-Fungible Tokens</title>
        <published>2022-09-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Sean Darcy</name><uri>https://github.com/darcys22</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5570/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/idea-standard-digital-receipts-using-erc-721/9908" />
        

        <id>https://wg-eips.ritovision.com/5570/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:5570"
            label="ERC-5570" />
        

        
        

        
        <summary type="html">Non-Fungible Tokens as digital receipts for physical purchases, where the metadata represents a JSON receipt</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5570/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC proposes a standard schema for digital receipts of transactions. Digital Receipt Non-Fungible Tokens are issued by a vendor when a customer makes a purchase from their store and contains transaction details necessary for record keeping. Digital Receipt Non-Fungible Tokens extend &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; which allows for the management and ownership of unique tokens.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Purchases from online retailers include a receipt that is emailed and&#x2F;or physically provided to the customer. These receipts are critical for many reasons but are provided in an analogue form which is difficult to parse by financial systems. Digital receipts have never gained traction dispite the fact that point of sales systems are already digital and the customers often want this information in their own digital systems. So we are left with a redundant Digital -&amp;gt; Analogue -&amp;gt; Digital process which requires unnecessary data entry or the use of clunky receipt-scanning applications.&lt;&#x2F;p&gt;
&lt;p&gt;Digital receipts are relatively simple and can be specified with a schema that can be parsed into JSON or other structured formats. In addition we can prove the receipts validity by digitally signing the receipt using the vendors private keys.&lt;&#x2F;p&gt;
&lt;p&gt;As Ethereum scales tooling will need to be developed to provide end users with features (such as receipts) already available to fiat transactions. NFTs provide a unique opportunity to link an on chain purchase with its transaction details directly through the transaction state update. If we conceptually think of a transaction as funds provided to one participant and goods provided to another, then our real life state includes two sides of a transaction, 1) Funds changing ownership and 2) goods changing ownership. NFT receipts are first class citizens of a transaction reflecting the goods changing ownership as part of the transaction state. They will bring our on chain transaction state in line with the changes happening in the real world.&lt;&#x2F;p&gt;
&lt;p&gt;The convenience of a direct link to the transaction receipt via the transaction state is significant, other methods of distributing receipts either off chain or through smart contracts separate to the initial transaction lose this link and force the end user to manually locate the transaction details when needed.
The benefit can be demonstrated by comparing a wallet that allows a user to click through a transaction to its receipt (available immediately after purchase without any further action) verses a user needing to search through a datastore to locate a receipt for a transaction that they can see in their wallet history.&lt;&#x2F;p&gt;
&lt;p&gt;Digital receipt as NFTs can also conceptually include other important information such as item serial numbers and delivery tracking etc.&lt;&#x2F;p&gt;
&lt;p&gt;One of the major roadblocks to fully automating our finance world has been the difficulty in tracking transaction details. Human beings physically tracking paper receipts is archaic and NFTs on the blockchain provide a pathway for these systems to be significantly improved.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Transaction Flow:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A customer purchases an item from an online retailer, checking out leads the customer to an option to mint a NFT.&lt;&#x2F;li&gt;
&lt;li&gt;The smart contract provides the user with a Digital Receipt Non-Fungible Token.&lt;&#x2F;li&gt;
&lt;li&gt;When fulfilling the order, the retailer will upload the digital receipt specified in in the JSON schema below as the metadata to the previously minted NFT.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;digital-receipt-json-schema&quot;&gt;Digital Receipt JSON Schema&lt;&#x2F;h3&gt;
&lt;p&gt;The JSON schema is composed of 2 parts. The root schema contains high level details of the receipt (for example Date and Vendor) and another schema for the optionally recurring line items contained in the receipt.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;root-schema&quot;&gt;Root Schema&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;receipt.json#&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Receipt Schema for Digital Receipt Non-Fungible Tokens&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;required&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;image&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;receipt&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Identifies the token as a digital receipt&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Description&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Brief description of a digital receipt&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;receipt&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Receipt&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Details of the receipt&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;required&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;date&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;vendor&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;items&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ID&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Unique ID for the receipt generated by the vendor&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;date&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Date&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Date Receipt Issued&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;date&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;vendor&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Vendor&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Details of the entity issuing the receipt&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;required&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;website&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Name of the vendor. E.g. Acme Corp&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;logo&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Logo&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;URL of the issuer&amp;#39;s logo&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uri&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;List of strings comprising the address of the issuer&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;array&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;items&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;minItems&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;maxItems&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;website&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Website&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;URL of the issuer&amp;#39;s website&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uri&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;contact&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Contact Details&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Details of the person to contact&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;required&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Name of the contact person&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;position&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Position&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Position &#x2F; Role of the contact person&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;tel&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Telephone Number&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Telephone number of the contact person&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;email&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Email&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Email of the contact person&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;email&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;List of strings comprising the address of the contact person&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;array&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;items&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;minItems&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;maxItems&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;items&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Items&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Items included into the receipt&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;array&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;minItems&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uniqueItems&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;items&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;$ref&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;item.json#&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;comments&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Comments&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Any messages&#x2F;comments the issuer wishes to convey to the customer&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;image&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Image&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Viewable&#x2F;Printable Image of the Digital Receipt&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Digital signature by the vendor of receipts data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;extra&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Extra&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Extra information about the business&#x2F;receipt as needed&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;line-items-schema&quot;&gt;Line Items Schema&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;item.json#&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;required&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;date&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;tax&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;quantity&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ID&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Unique identifier of the goods or service&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Title&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Title of the goods or service&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Description&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Description of the goods or service&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;link&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Link&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;URL link to the web page for the product or sevice&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uri&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;URL link or hash to an external contract for this product or service&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;serial_number&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Serial Number&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Serial number of the item&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;date&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Supply Date&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The date the goods or service were provided&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;date&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Unit Price&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Unit Price per item (excluding tax)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;tax&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Tax&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Amount of tax charged for unit&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;array&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;items&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;required&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;rate&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Name of Tax&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;GST&#x2F;PST etc&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;rate&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Tax Rate&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Tax rate as a percentage&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Tax Amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Total amount of tax charged&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;quantity&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Quantity&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Number of units&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;integer&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The schema introduced complies with ERC-721&#x27;s metadata extension, conveniently allowing previous tools for viewing NFTs to show our receipts. The new property &quot;receipt&quot; contains our newly provided receipt structure and the signature property optionally allows the vendor to digitally sign the receipt structure.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is an extension of ERC-721. It is compatible with both optional extensions, Metadata and Enumerable, mentioned in ERC-721.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The data stored in the digital receipt includes various types of personally identifying information (PII), such as the vendor&#x27;s name, contact details, and the items purchased. PII is sensitive information that can be used to identify, locate, or contact an individual. Protecting the privacy of the customer is of utmost importance, as unauthorized access to PII can lead to identity theft, fraud, or other malicious activities.&lt;&#x2F;p&gt;
&lt;p&gt;To ensure the privacy of the customer, it is crucial to encrypt the PII contained within the digital receipt. By encrypting the PII, only authorized parties with the appropriate decryption keys can access and read the information stored in the digital receipt. This ensures that the customer&#x27;s privacy is maintained, and their data is protected from potential misuse.&lt;&#x2F;p&gt;
&lt;p&gt;While encrypting PII is essential, it is important to note that defining a specific encryption standard is beyond the scope of this ERC.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Well-Known Format for Required Actions</title>
        <published>2022-08-31T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Gavin John</name><uri>https://github.com/Pandapip1</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5568/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5568-revert-signals/10622" />
        

        <id>https://wg-eips.ritovision.com/5568/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        

        
        <category
            term="tag:eip:5568"
            label="ERC-5568" />
        

        
        

        
        <summary type="html">Signal to wallets that an action is needed through a well-known function and revert reason</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5568/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC introduces a minimalistic machine-readable (binary) format to signal to wallets that an action needs to be taken by the user using a well-known function and revert reason. It provides just enough data to be extendable by future ERCs and to take in arbitrary parameters (up to 64 kB of data). Example use cases could include approving a token for an exchange, sending an HTTP request, or requesting the user to rotate their keys after a certain period of time to enforce good hygiene.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Oftentimes, a smart contract needs to signal to a wallet that an action needs to be taken, such as to sign a transaction or send an HTTP request to a URL. Traditionally, this has been done by hard-coding the logic into the frontend, but this ERC allows the smart contract itself to request the action.&lt;&#x2F;p&gt;
&lt;p&gt;This means that, for example, an exchange or a market can directly tell the wallet to approve the smart contract to spend the token, vastly simplifying front-end code.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;action-detection&quot;&gt;Action Detection&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5568&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; walletSignal24&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; selector&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; function_data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint24&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; instruction_id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; instruction_data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;instruction_id&lt;&#x2F;code&gt; of an instruction defined by an ERC MUST be its ERC number unless there are exceptional circumstances (be reasonable). An ERC MUST define exactly zero or one &lt;code&gt;instruction_id&lt;&#x2F;code&gt;. The structure of the instruction data for any &lt;code&gt;instruction_id&lt;&#x2F;code&gt; MUST be defined by the ERC that defines the &lt;code&gt;instruction_id&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;To indicate that an action needs to be taken, return the &lt;code&gt;instruction_id&lt;&#x2F;code&gt; and &lt;code&gt;instruction_data&lt;&#x2F;code&gt;. To indicate no actions need to be taken, set &lt;code&gt;instruction_id&lt;&#x2F;code&gt; to be &lt;code&gt;0&lt;&#x2F;code&gt; and &lt;code&gt;instruction_data&lt;&#x2F;code&gt; to any value.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;custom-revert-reason&quot;&gt;Custom Revert Reason&lt;&#x2F;h3&gt;
&lt;p&gt;To signal an action was not taken, a compliant smart contract MUST revert with the following error:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; WalletSignal24&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint24&lt;&#x2F;span&gt;&lt;span&gt; instruction_id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt; instruction_data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;instruction_id&lt;&#x2F;code&gt; of an instruction defined by an ERC MUST be its ERC number unless there are exceptional circumstances (be reasonable). An ERC MUST define exactly zero or one &lt;code&gt;instruction_id&lt;&#x2F;code&gt;. The structure of the instruction data for any &lt;code&gt;instruction_id&lt;&#x2F;code&gt; MUST be defined by the ERC that defines the &lt;code&gt;instruction_id&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;responding-to-a-revert&quot;&gt;Responding to a Revert&lt;&#x2F;h3&gt;
&lt;p&gt;Before submitting a transaction to the mempool, the &lt;code&gt;walletSignal24&lt;&#x2F;code&gt; function MUST be simulated locally. It MUST be treated as if it were a non-&lt;code&gt;view&lt;&#x2F;code&gt; function capable of making state changes (e.g. &lt;code&gt;CALLS&lt;&#x2F;code&gt; to non-&lt;code&gt;view&lt;&#x2F;code&gt; functions are allowed). If the resulting &lt;code&gt;instruction_id&lt;&#x2F;code&gt; is nonzero, an action needs to be taken.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;instruction_id&lt;&#x2F;code&gt;, and &lt;code&gt;instruction_data&lt;&#x2F;code&gt; MUST be taken from the &lt;code&gt;walletSignal24&lt;&#x2F;code&gt; simulation. The instruction SHOULD be evaluated as per the relevant ERC. If the instruction is not supported by the wallet, it MUST display an error to the user indicating that is the case. The wallet MUST then re-evaluate the transaction, except if an instruction explicitly states that the transaction MUST NOT be re-evaluated.&lt;&#x2F;p&gt;
&lt;p&gt;If an instruction is invalid, or the &lt;code&gt;instruction_id&lt;&#x2F;code&gt;, and &lt;code&gt;instruction_data&lt;&#x2F;code&gt; cannot be parsed, then an error MUST be displayed to the user indicating that is the case. The transaction MUST NOT be re-evaluated.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC was explicitly optimized for deployment gas cost and simplicity. It is expected that libraries will eventually be developed that makes this more developer-friendly.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; is not used, since the interface is simple enough that it can be detected simply by calling the function.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;human-readable-revert-messages&quot;&gt;Human-Readable Revert Messages&lt;&#x2F;h3&gt;
&lt;p&gt;See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5568&#x2F;#revert-reason-collisions&quot;&gt;Revert Reason Collisions&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;erc-3668&quot;&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3668&#x2F;&quot;&gt;ERC-3668&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;ERC-3668 can be used alongside this ERC, but it uses a different mechanism than this ERC.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;revert-reason-collisions&quot;&gt;Revert Reason Collisions&lt;&#x2F;h3&gt;
&lt;p&gt;It is unlikely that the signature of the custom error matches any custom errors in the wild. In the case that it does, no harm is caused unless the data happen to be a valid instruction, which is even more unlikely.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Redeemable NFTs</title>
        <published>2022-08-30T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Olivier Fernandez</name><uri>https://github.com/fernandezOli</uri>
	</author>
	
	<author>
		<name>Frédéric Le Coidic</name><uri>https://github.com/FredLC29</uri>
	</author>
	
	<author>
		<name>Julien Béranger</name><uri>https://github.com/julienbrg</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5560/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-redeemable-nft-extension/10589" />
        

        <id>https://wg-eips.ritovision.com/5560/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:5560"
            label="ERC-5560" />
        

        
        

        
        <summary type="html">Makes an NFT redeemable for a physical object</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5560/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The EIP is a Redeemable NFT extension which adds a &lt;code&gt;redeem&lt;&#x2F;code&gt; function to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt;. It can be implemented when an NFT issuer wants his&#x2F;her NFT to be redeemed for a physical object.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;An increasing amount of NFT issuers such as artists, fine art galeries, auction houses, brands and others want to offer a physical object to the holder of a given NFT. This standard allows EIP-721 NFTs to signal reedemability.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;em&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;EIP-721&lt;&#x2F;code&gt; compliant contracts MAY implement this EIP to provide a standard method of receiving information on redeemability.&lt;&#x2F;p&gt;
&lt;p&gt;The NFT issuer &lt;strong&gt;MUST&lt;&#x2F;strong&gt; decide who is allowed to redeem the NFT, and restrict access to the &lt;code&gt;redeem()&lt;&#x2F;code&gt; function accordingly.&lt;&#x2F;p&gt;
&lt;p&gt;Anyone &lt;strong&gt;MAY&lt;&#x2F;strong&gt; access the &lt;code&gt;isRedeemable()&lt;&#x2F;code&gt; function to check the redeemability status: it returns &lt;code&gt;true&lt;&#x2F;code&gt; when the NFT redeemable, and &lt;code&gt;false&lt;&#x2F;code&gt; when already redeemed.&lt;&#x2F;p&gt;
&lt;p&gt;Third-party services that support this standard &lt;strong&gt;MAY&lt;&#x2F;strong&gt; use the &lt;code&gt;Redeem&lt;&#x2F;code&gt; event to listen to changes on the redeemable status of the NFT.&lt;&#x2F;p&gt;
&lt;p&gt;Implementers of this standard &lt;strong&gt;MUST&lt;&#x2F;strong&gt; have all of the following functions:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;#39;@openzeppelin&#x2F;contracts&#x2F;utils&#x2F;introspection&#x2F;ERC165.sol&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Implementation of Redeemable for ERC-721s&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IRedeemable&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC165&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;*&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * ERC165 bytes to add to interface array - set in parent contract implementing this standard&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * bytes4 private constant _INTERFACE_ID_ERC721REDEEM = 0x2f8ca953;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This event emits when a token is redeemed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Redeem&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	 &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the redeem status of a token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Identifier of the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isRedeemable&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Redeeem a token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Identifier of the token to redeeem&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; redeem&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;Redeem&lt;&#x2F;code&gt; event is emitted when the &lt;code&gt;redeem()&lt;&#x2F;code&gt; function is called.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; method &lt;strong&gt;MUST&lt;&#x2F;strong&gt; return &lt;code&gt;true&lt;&#x2F;code&gt; when called with &lt;code&gt;0x2f8ca953&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;When the NFT contract is deployed, the &lt;code&gt;isRedeemable()&lt;&#x2F;code&gt; function returns &lt;code&gt;true&lt;&#x2F;code&gt; by default.&lt;&#x2F;p&gt;
&lt;p&gt;By default, the &lt;code&gt;redeem()&lt;&#x2F;code&gt; function visibility is public, so anyone can trigger it. It is &lt;strong&gt;RECOMMENDED&lt;&#x2F;strong&gt; to add a &lt;code&gt;require&lt;&#x2F;code&gt; to restrict the access:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC721Redeemable: You are not the owner of this token&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;After the &lt;code&gt;redeem()&lt;&#x2F;code&gt; function is triggered, &lt;code&gt;isRedeemable()&lt;&#x2F;code&gt; function returns &lt;code&gt;false&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;redeem-event&quot;&gt;&lt;code&gt;Redeem&lt;&#x2F;code&gt; event&lt;&#x2F;h3&gt;
&lt;p&gt;When the &lt;code&gt;redeem()&lt;&#x2F;code&gt; function is triggered, the following event &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be emitted:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Redeem&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is compatible with EIP-721.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Here&#x27;s an example of an EIP-721 that includes the Redeemable extension:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721Redeemable&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Redeemable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; symbol&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;name, symbol) &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isRedeemable&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_exists&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC721Redeemable: Redeem query for nonexistent token&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isRedeemable&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; redeem&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_exists&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC721Redeemable: Redeem query for nonexistent token&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC721Redeemable: You are not the owner of this token&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;		super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;redeem&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC721&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Redeemable&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Revocation List Registry</title>
        <published>2022-08-26T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Philipp Bolte</name><uri>https://github.com/strumswell</uri>
	</author>
	
	<author>
		<name>Lauritz Leifermann</name><uri>https://github.com/lleifermann</uri>
	</author>
	
	<author>
		<name>Dennis von der Bey</name><uri>https://github.com/DennisVonDerBey</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5539/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5539-revocation-list-registry/10573" />
        

        <id>https://wg-eips.ritovision.com/5539/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:5539"
            label="ERC-5539" />
        

        
        

        
        <summary type="html">Registry of revocation lists for revoking arbitrary data.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5539/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes a set of methods and standards for a role-based registry of indicators aimed for usage in revocations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Revocation is a universally needed construct both in the traditional centralized and decentralized credential attestation. This EIP aims to provide an interface to standardize a decentralized approach to managing and resolving revocation states in a contract registry.&lt;&#x2F;p&gt;
&lt;p&gt;The largest problem with traditional revocation lists is the centralized aspect of them. Most of the world&#x27;s CRLs rely on HTTP servers as well as caching and are therefore vulnerable to known attack vectors in the traditional web space. This aspect severely weakens the underlying strong asymmetric key architecture in current PKI systems.&lt;&#x2F;p&gt;
&lt;p&gt;In addition, issuers in existing CRL approaches are required to host an own instance of their public revocation list, as shared or centralized instances run the risk of misusage by the controlling entity.
This incentivizes issuers to shift this responsibility to a third party, imposing the risk of even more centralization of the ecosystem (see Cloudflare, AWS).
Ideally, issuers should be able to focus on their area of expertise, including ownership of their revocable material, instead of worrying about infrastructure.&lt;&#x2F;p&gt;
&lt;p&gt;We see value in a future of the Internet where anyone can be an issuer of verifiable information. This proposal lays the groundwork for anyone to also own the lifecycle of this information to build trust in ecosystems.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP specifies a contract called &lt;code&gt;EthereumRevocationRegistry&lt;&#x2F;code&gt; that is deployed once and may then be commonly used by everyone. By default, an Ethereum address &lt;strong&gt;MAY&lt;&#x2F;strong&gt; own and manage a multitude of revocation lists in a namespace that &lt;strong&gt;MUST&lt;&#x2F;strong&gt; contain the revocation states for a set of revocation keys.&lt;&#x2F;p&gt;
&lt;p&gt;An owner of a namespace &lt;strong&gt;MAY&lt;&#x2F;strong&gt; allow delegates to manage one or more of its revocation lists. Delegates &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be removable by the respective list&#x27;s owner. In certain situations, an owner &lt;strong&gt;MAY&lt;&#x2F;strong&gt; also want to transfer a revocation list in a namespace and its management rights to a new owner.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;namespace&lt;&#x2F;code&gt;: A namespace is a representation of an Ethereum address inside the registry that corresponds to its owners address. All revocation lists within a namespace are initially owned by the namespace&#x27;s owner address.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;revocation list&lt;&#x2F;code&gt;: A namespace can contain a number of revocation lists. Each revocation list is identified by a unique key of the type bytes32 that can be used to address it in combination with the namespace address.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;revocation key&lt;&#x2F;code&gt;: A revocation list can contain a number of revocation keys of the type bytes32. In combination with the namespace address and the revocation list key, it resolves to a boolean value that indicates whether the revocation key is revoked or not.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;owner&lt;&#x2F;code&gt;: An Ethereum address that has modifying rights to revocation lists within its own and possibly foreign namespaces. An owner can give up modifying rights of revocation lists within its namespace by transferring ownership to another address.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;delegate&lt;&#x2F;code&gt;: An Ethereum address that received temporary access to a revocation list in a namespace. It has to be granted by the current owner of the revocation list in question.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;revocation-management&quot;&gt;Revocation Management&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;isrevoked&quot;&gt;isRevoked&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;MUST&lt;&#x2F;strong&gt; implement a function that returns the revocation status of a particular revocation key in a namespace&#x27;s revocation list. It &lt;strong&gt;MAY&lt;&#x2F;strong&gt; also respect the revocation lists revocation status.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isRevoked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; list&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;changestatus&quot;&gt;changeStatus&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;MUST&lt;&#x2F;strong&gt; implement a function to change the revocation status of a particular revocation key in a namespace&#x27;s revocation list&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; changeStatus&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; revoked&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; revocationList&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; revocationKey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;changestatussigned-see-meta-transactions&quot;&gt;changeStatusSigned (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5539&#x2F;#MetaTransactions&quot;&gt;see Meta Transactions&lt;&#x2F;a&gt;)&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;OPTIONAL&lt;&#x2F;strong&gt; implements a function to change the revocation status of a particular revocation key in a namespace&#x27;s revocation list with a raw signature.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; changeStatusSigned&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; revoked&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; revocationList&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; revocationKey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;changestatusdelegated&quot;&gt;changeStatusDelegated&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;OPTIONAL&lt;&#x2F;strong&gt; implements a function to change the revocation status of a particular revocation key in a namespace&#x27;s revocation list by a revocation list&#x27;s delegate.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; changeStatusDelegated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; revoked&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; revocationList&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; revocationKey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;changestatusdelegatedsigned-see-meta-transactions&quot;&gt;changeStatusDelegatedSigned (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5539&#x2F;#MetaTransactions&quot;&gt;see Meta Transactions&lt;&#x2F;a&gt;)&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;OPTIONAL&lt;&#x2F;strong&gt; implements a function to change the revocation status of a particular revocation key in a namespace&#x27;s revocation list with a raw signature.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; changeStatusDelegatedSigned&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; revoked&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; revocationList&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; revocationKey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;changestatusesinlist&quot;&gt;changeStatusesInList&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;OPTIONAL&lt;&#x2F;strong&gt; implements a function to change multiple revocation statuses in a namespace&#x27;s revocation list at once.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; changeStatusesInList&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; revoked&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; revocationList&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; revocationKeys&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;changestatusesinlistsigned-see-meta-transactions&quot;&gt;changeStatusesInListSigned (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5539&#x2F;#MetaTransactions&quot;&gt;see Meta Transactions&lt;&#x2F;a&gt;)&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;OPTIONAL&lt;&#x2F;strong&gt; implements a function to change multiple revocation statuses in a namespace&#x27;s revocation list at once with a raw signature.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; changeStatusesInListSigned&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; revoked&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; revocationList&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; revocationKeys&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;changestatusesinlistdelegated&quot;&gt;changeStatusesInListDelegated&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;OPTIONAL&lt;&#x2F;strong&gt; implements a function to change multiple revocation statuses in a namespace&#x27;s revocation list at once by a revocation list&#x27;s delegate.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; changeStatusesInListDelegated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; revoked&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; revocationList&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; revocationKeys&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;changestatusesinlistdelegatedsigned-see-meta-transactions&quot;&gt;changeStatusesInListDelegatedSigned (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5539&#x2F;#MetaTransactions&quot;&gt;see Meta Transactions&lt;&#x2F;a&gt;)&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;OPTIONAL&lt;&#x2F;strong&gt; implements a function to change multiple revocation statuses in a namespace&#x27;s revocation list at once with a raw signature generated by a revocation list&#x27;s delegate.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; changeStatusesInListDelegatedSigned&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; revoked&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; revocationList&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; revocationKeys&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;revocation-list-management&quot;&gt;Revocation List Management&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;&quot;&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;OPTIONAL&lt;&#x2F;strong&gt; implements a function that returns the revocation status of a particular revocation list in a namespace.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; listIsRevoked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; revocationList&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;changeliststatus&quot;&gt;changeListStatus&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;OPTIONAL&lt;&#x2F;strong&gt; implements a function to change the revocation of a revocation list itself. If a revocation list is revoked, all its keys are considered revoked as well.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; changeListStatus&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; revoked&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; revocationList&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;changeliststatussigned-see-meta-transactions&quot;&gt;changeListStatusSigned (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5539&#x2F;#MetaTransactions&quot;&gt;see Meta Transactions&lt;&#x2F;a&gt;)&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;OPTIONAL&lt;&#x2F;strong&gt; implements a function to change the revocation of a revocation list itself with a raw signature. If a revocation list is revoked, all its keys are considered revoked as well.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; changeListStatusSigned&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; revoked&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; revocationList&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;owner-management&quot;&gt;Owner management&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;changelistowner&quot;&gt;changeListOwner&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;OPTIONAL&lt;&#x2F;strong&gt; implement a function to change the revocation status of a revocation list. If a revocation list is revoked, all keys in it are considered revoked.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; changeListOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newOwner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; revocationList&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;changelistownersigned-see-meta-transactions&quot;&gt;changeListOwnerSigned (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5539&#x2F;#MetaTransactions&quot;&gt;see Meta Transactions&lt;&#x2F;a&gt;)&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;OPTIONAL&lt;&#x2F;strong&gt; implement a function to change the revocation status of a revocation list with a raw signature. If a revocation list is revoked, all keys in it are considered revoked.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; changeListOwnerSigned&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newOwner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; revocationList&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;delegation-management&quot;&gt;Delegation management&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;addlistdelegate&quot;&gt;addListDelegate&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;OPTIONAL&lt;&#x2F;strong&gt; implements a function to add a delegate to an owner&#x27;s revocation list in a namespace.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addListDelegate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; delegate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; revocationList&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;addlistdelegatesigned-see-meta-transactions&quot;&gt;addListDelegateSigned (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5539&#x2F;#MetaTransactions&quot;&gt;see Meta Transactions&lt;&#x2F;a&gt;)&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;OPTIONAL&lt;&#x2F;strong&gt; implements a function to add a delegate to an owner&#x27;s revocation list in a namespace with a raw signature.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addListDelegateSigned&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; delegate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; revocationList&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;removelistdelegate&quot;&gt;removeListDelegate&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;OPTIONAL&lt;&#x2F;strong&gt; implements a function to remove a delegate from an owner&#x27;s revocation list in a namespace.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; removeListDelegate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; delegate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; revocationList&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;removelistdelegatesigned-see-meta-transactions&quot;&gt;removeListDelegateSigned (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5539&#x2F;#MetaTransactions&quot;&gt;see Meta Transactions&lt;&#x2F;a&gt;)&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;OPTIONAL&lt;&#x2F;strong&gt; implements a function to remove a delegate from an owner&#x27;s revocation list in a namespace with a raw signature.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; removeListDelegateSigned&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; delegate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; revocationList&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;events&quot;&gt;Events&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;revocationstatuschanged&quot;&gt;RevocationStatusChanged&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;MUST&lt;&#x2F;strong&gt; be emitted when &lt;code&gt;changeStatus&lt;&#x2F;code&gt;, &lt;code&gt;changeStatusSigned&lt;&#x2F;code&gt;, &lt;code&gt;changeStatusDelegated&lt;&#x2F;code&gt;, &lt;code&gt;changeStatusDelegatedSigned&lt;&#x2F;code&gt;, &lt;code&gt;changeStatusesInList&lt;&#x2F;code&gt;, &lt;code&gt;changeStatusesInListSigned&lt;&#x2F;code&gt;, &lt;code&gt;changeStatusesInListDelegated&lt;&#x2F;code&gt;, or &lt;code&gt;changeStatusesInListDelegatedSigned&lt;&#x2F;code&gt; was successfully executed.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RevocationStatusChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; revocationList&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; revocationKey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; revoked&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;revocationlistownerchanged&quot;&gt;RevocationListOwnerChanged&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;MUST&lt;&#x2F;strong&gt; be emitted when &lt;code&gt;changeListOwner&lt;&#x2F;code&gt; or &lt;code&gt;changeListOwnerSigned&lt;&#x2F;code&gt; was successfully executed.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RevocationListOwnerChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; revocationList&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newOwner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;revocationlistdelegateadded&quot;&gt;RevocationListDelegateAdded&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;MUST&lt;&#x2F;strong&gt; be emitted when &lt;code&gt;addListDelegate&lt;&#x2F;code&gt; or &lt;code&gt;addListDelegateSigned&lt;&#x2F;code&gt; was successfully executed.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RevocationListDelegateAdded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; revocationList&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; delegate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;revocationlistdelegateremoved&quot;&gt;RevocationListDelegateRemoved&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;MUST&lt;&#x2F;strong&gt; be emitted when &lt;code&gt;removeListDelegate&lt;&#x2F;code&gt; or &lt;code&gt;removeListDelegateSigned&lt;&#x2F;code&gt; was successfully executed.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RevocationListDelegateRemoved&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; revocationList&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; delegate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;revocationliststatuschanged&quot;&gt;RevocationListStatusChanged&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;MUST&lt;&#x2F;strong&gt; be emitted when &lt;code&gt;changeListStatus&lt;&#x2F;code&gt; or &lt;code&gt;changeListStatusSigned&lt;&#x2F;code&gt; was successfully executed.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RevocationListStatusChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; namespace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; revocationlist&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; revoked&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;meta-transactions&quot;&gt;Meta Transactions &lt;span id=&quot;MetaTransactions&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;This section uses the following terms:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;transaction signer&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: An Ethereum address that signs arbitrary data for the contract to execute &lt;strong&gt;BUT&lt;&#x2F;strong&gt; does not commit the transaction.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;transaction sender&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: An Ethereum address that takes signed data from a &lt;strong&gt;transaction signer&lt;&#x2F;strong&gt; and commits it wrapped with its own signature to the smart contract.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;An address (&lt;strong&gt;transaction signer&lt;&#x2F;strong&gt;) &lt;strong&gt;MAY&lt;&#x2F;strong&gt; be able to deliver a signed payload off-band to another address (&lt;strong&gt;transaction sender&lt;&#x2F;strong&gt;) that initiates the Ethereum interaction with the smart contract. The signed payload &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be limited to be used only once (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5539&#x2F;#SignedHash&quot;&gt;Signed Hash&lt;&#x2F;a&gt; + &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5539&#x2F;#Nonce&quot;&gt;nonces&lt;&#x2F;a&gt;).&lt;&#x2F;p&gt;
&lt;h4 id=&quot;signed-hash&quot;&gt;Signed Hash &lt;span id=&quot;SignedHash&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The signature of the &lt;strong&gt;transaction signer&lt;&#x2F;strong&gt; &lt;strong&gt;MUST&lt;&#x2F;strong&gt; conform &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt;. This helps users understand what the payload they&#x27;re signing consists of &amp;amp; it improves the protection against replay attacks.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;nonce&quot;&gt;Nonce &lt;span id=&quot;Nonce&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;This EIP &lt;strong&gt;RECOMMENDS&lt;&#x2F;strong&gt; the use of a &lt;strong&gt;dedicated nonce mapping&lt;&#x2F;strong&gt; for meta transactions. If the signature of the &lt;strong&gt;transaction sender&lt;&#x2F;strong&gt; and its meta contents are verified, the contract increases a nonce for this &lt;strong&gt;transaction signer&lt;&#x2F;strong&gt;. This effectively removes the possibility for any other sender to execute the same transaction again with another wallet.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-the-concept-of-namespaces&quot;&gt;Why the concept of namespaces?&lt;&#x2F;h3&gt;
&lt;p&gt;This provides every Ethereum address a reserved space, without the need to actively claim it in the contract. Initially addresses only have owner access in their own namespace.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-does-a-namespace-always-represent-the-initial-owner-address&quot;&gt;Why does a namespace always represent the initial owner address?&lt;&#x2F;h3&gt;
&lt;p&gt;The change of an owner of a list shouldn&#x27;t break the link to a revocation key in it, as already existing off-chain data may depend on it.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues were found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;meta-transactions-1&quot;&gt;Meta Transactions&lt;&#x2F;h3&gt;
&lt;p&gt;The signature of signed transactions could potentially be replayed on different chains or deployed versions of the registry implementing this ERC. This security consideration is addressed by the usage of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;rights-management&quot;&gt;Rights Management&lt;&#x2F;h3&gt;
&lt;p&gt;The different roles and their inherent permissions are meant to prevent changes from unauthorized entities. The revocation list owner should always be in complete control over its revocation list and who has writing access to it.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Refundable Tokens</title>
        <published>2022-08-19T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>elie222</name><uri>https://github.com/elie222</uri>
	</author>
	
	<author>
		<name>Gavin John</name><uri>https://github.com/Pandapip1</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5507/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5507-refundable-nfts/10451" />
        

        <id>https://wg-eips.ritovision.com/5507/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:5507"
            label="ERC-5507" />
        

        
        

        
        <summary type="html">Adds refund functionality to ERC-20, ERC-721, and ERC-1155 tokens</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5507/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC adds refund functionality for initial token offerings to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;, and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt;. Funds are held in escrow until a predetermined time before they are claimable. Until that predetermined time passes, users can receive a refund for tokens they have purchased.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The NFT and token spaces lack accountability. For the health of the ecosystem as a whole, better mechanisms to prevent rugpulls from happening are needed. Offering refunds provides greater protection for buyers and increases legitimacy for creators.&lt;&#x2F;p&gt;
&lt;p&gt;A standard interface for this particular use case allows for certain benefits:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Greater Compliance with EU &quot;Distance Selling Regulations,&quot; which require a 14-day refund period for goods (such as tokens) purchased online&lt;&#x2F;li&gt;
&lt;li&gt;Interoperability with various NFT-related applications, such as portfolio browsers, and marketplaces
&lt;ul&gt;
&lt;li&gt;NFT marketplaces could place a badge indicating that the NFT is still refundable on listings, and offer to refund NFTs instead of listing them on the marketplace&lt;&#x2F;li&gt;
&lt;li&gt;DExes could offer to refund tokens if doing so would give a higher yield&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Better wallet confirmation dialogs
&lt;ul&gt;
&lt;li&gt;Wallets can better inform the user of the action that is being taken (tokens being refunded), similar to how transfers often have their own unique dialog&lt;&#x2F;li&gt;
&lt;li&gt;DAOs can better display the functionality of smart proposals that include refunding tokens&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;All implementations MUST use and follow the directions of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;erc-20-refund-extension&quot;&gt;ERC-20 Refund Extension&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.17&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC20.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC165.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Refundable ERC-20 tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    The ERC-165 identifier of this interface is `0xf0ca2917`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC20Refund&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC20&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC165&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;           Emitted when a token is refunded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;              Emitted by `refund`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     The account whose assets are refunded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  _amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   The amount of token (in terms of the indivisible unit) that was refunded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Refund&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;           Emitted when a token is refunded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;              Emitted by `refundFrom`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  _sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   The account that sent the refund&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     The account whose assets are refunded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  _amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   The amount of token (in terms of the indivisible unit) that was refunded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RefundFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         As long as the refund is active, refunds the user&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;            Make sure to check that the user has the token, and be aware of potential re-entrancy vectors&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  The `amount` to refund&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; refund&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         As long as the refund is active and the sender has sufficient approval, refund the tokens and send the ether to the sender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;            Make sure to check that the user has the token, and be aware of potential re-entrancy vectors&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                 The ether goes to msg.sender.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    The user from which to refund the assets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  The `amount` to refund&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; refundFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         Gets the refund price&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _wei&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    The amount of ether (in wei) that would be refunded for a single token unit (10**decimals indivisible units)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; refundOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _wei&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         Gets the first block for which the refund is not active&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; block&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   The first block where the token cannot be refunded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; refundDeadlineOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;erc-721-refund-extension&quot;&gt;ERC-721 Refund Extension&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.17&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC721.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC165.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Refundable ERC-721 tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    The ERC-165 identifier of this interface is `0xe97f3c83`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721Refund&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721&lt;&#x2F;span&gt;&lt;span&gt; &#x2F;* , &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC165&lt;&#x2F;span&gt;&lt;span&gt; *&#x2F; &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;           Emitted when a token is refunded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;              Emitted by `refund`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     The account whose assets are refunded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  The `tokenId` that was refunded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Refund&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;           Emitted when a token is refunded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;              Emitted by `refundFrom`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  _sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   The account that sent the refund&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     The account whose assets are refunded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  The `tokenId` that was refunded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RefundFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         As long as the refund is active for the given `tokenId`, refunds the user&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;            Make sure to check that the user has the token, and be aware of potential re-entrancy vectors&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The `tokenId` to refund&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; refund&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         As long as the refund is active and the sender has sufficient approval, refund the token and send the ether to the sender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;            Make sure to check that the user has the token, and be aware of potential re-entrancy vectors&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                 The ether goes to msg.sender.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    The user from which to refund the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The `tokenId` to refund&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; refundFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         Gets the refund price of the specific `tokenId`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The `tokenId` to query&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _wei&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    The amount of ether (in wei) that would be refunded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; refundOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _wei&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         Gets the first block for which the refund is not active for a given `tokenId`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The `tokenId` to query&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; block&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   The first block where token cannot be refunded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; refundDeadlineOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;optional-erc-721-batch-refund-extension&quot;&gt;Optional ERC-721 Batch Refund Extension&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC721Refund.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Batch Refundable ERC-721 tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    The ERC-165 identifier of this interface is ``&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721BatchRefund&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721Refund&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;           Emitted when one or more tokens are batch refunded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;              Emitted by `refundBatch`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     The account whose assets are refunded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  The `tokenIds` that were refunded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RefundBatch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokenIds&lt;&#x2F;span&gt;&lt;span&gt; &#x2F;&#x2F; &lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;This&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; may&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; or&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; may&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; be&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;           Emitted when one or more tokens are batch refunded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;              Emitted by `refundFromBatch`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  _sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   The account that sent the refund&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     The account whose assets are refunded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  The `tokenId` that was refunded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RefundFromBatch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;           As long as the refund is active for the given `tokenIds`, refunds the user&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;              Make sure to check that the user has the tokens, and be aware of potential re-entrancy vectors&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                   These must either succeed or fail together; there are no partial refunds.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  tokenIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  The `tokenId`s to refund&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; refundBatch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;           As long as the refund is active for the given `tokenIds` and the sender has sufficient approval, refund the tokens and send the ether to the sender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;              Make sure to check that the user has the tokens, and be aware of potential re-entrancy vectors&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                   The ether goes to msg.sender.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                   These must either succeed or fail together; there are no partial refunds.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      The user from which to refund the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  tokenIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  The `tokenId`s to refund&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; refundFromBatch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;erc-1155-refund-extension&quot;&gt;ERC-1155 Refund Extension&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.17&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC1155.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC165.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Refundable ERC-1155 tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    The ERC-165 identifier of this interface is `0x94029f5c`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC1155Refund&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC1155&lt;&#x2F;span&gt;&lt;span&gt; &#x2F;* , &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC165&lt;&#x2F;span&gt;&lt;span&gt; *&#x2F; &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;           Emitted when a token is refunded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;              Emitted by `refund`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     The account that requested a refund&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  The `tokenId` that was refunded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  _amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   The amount of `tokenId` that was refunded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Refund&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;           Emitted when a token is refunded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;              Emitted by `refundFrom`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  _sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   The account that sent the refund&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     The account whose assets are refunded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  The `tokenId` that was refunded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  _amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   The amount of `tokenId` that was refunded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RefundFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         As long as the refund is active for the given `tokenId`, refunds the user&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;            Make sure to check that the user has enough tokens, and be aware of potential re-entrancy vectors&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The `tokenId` to refund&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  The amount of `tokenId` to refund&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; refund&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         As long as the refund is active and the sender has sufficient approval, refund the tokens and send the ether to the sender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;            Make sure to check that the user has enough tokens, and be aware of potential re-entrancy vectors&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                 The ether goes to msg.sender.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    The user from which to refund the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The `tokenId` to refund&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  The amount of `tokenId` to refund&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; refundFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         Gets the refund price of the specific `tokenId`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The `tokenId` to query&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _wei&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    The amount of ether (in wei) that would be refunded for a single token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; refundOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _wei&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         Gets the first block for which the refund is not active for a given `tokenId`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The `tokenId` to query&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; block&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   The first block where the token cannot be refunded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; refundDeadlineOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;optional-erc-1155-batch-refund-extension&quot;&gt;Optional ERC-1155 Batch Refund Extension&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC1155Refund.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Batch Refundable ERC-1155 tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    The ERC-165 identifier of this interface is ``&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC1155BatchRefund&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC1155Refund&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;           Emitted when one or more tokens are batch refunded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;              Emitted by `refundBatch`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     The account that requested a refund&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  _tokenIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The `tokenIds` that were refunded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  _amounts&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  The amount of each `tokenId` that was refunded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RefundBatch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokenIds&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span&gt;&#x2F;&#x2F; &lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;This&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; may&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; or&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; may&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; be&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _amounts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;           Emitted when one or more tokens are batch refunded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;              Emitted by `refundFromBatch`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  _sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   The account that sent the refund&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     The account whose assets are refunded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  _tokenIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The `tokenIds` that was refunded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  _amounts&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  The amount of each `tokenId` that was refunded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RefundFromBatch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span&gt;&#x2F;&#x2F; &lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;This&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; may&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; or&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; may&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; be&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _amounts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;           As long as the refund is active for the given `tokenIds`, refunds the user&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;              Make sure to check that the user has enough tokens, and be aware of potential re-entrancy vectors&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                   These must either succeed or fail together; there are no partial refunds.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  tokenIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  The `tokenId`s to refund&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  amounts&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   The amount of each `tokenId` to refund&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; refundBatch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amounts&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;           As long as the refund is active for the given `tokenIds` and the sender has sufficient approval, refund the tokens and send the ether to the sender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;              Make sure to check that the user has the tokens, and be aware of potential re-entrancy vectors&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                   The ether goes to msg.sender.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                   These must either succeed or fail together; there are no partial refunds.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      The user from which to refund the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  tokenIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  The `tokenId`s to refund&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  amounts&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   The amount of each `tokenId` to refund&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; refundFromBatch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amounts&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;refundDeadlineOf&lt;&#x2F;code&gt; uses blocks instead of timestamps, as timestamps are less reliable than block numbers.&lt;&#x2F;p&gt;
&lt;p&gt;The function names of &lt;code&gt;refund&lt;&#x2F;code&gt;, &lt;code&gt;refundOf&lt;&#x2F;code&gt;, and &lt;code&gt;refundDeadlineOf&lt;&#x2F;code&gt; were chosen to fit the naming style of ERC-20, ERC-721, and ERC-1155.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; is required as introspection by DApps would be made significantly harder if it were not.&lt;&#x2F;p&gt;
&lt;p&gt;Custom ERC-20 tokens are not supported, as it needlessly increases complexity, and the &lt;code&gt;refundFrom&lt;&#x2F;code&gt; function allows for this functionality when combined with a DEx.&lt;&#x2F;p&gt;
&lt;p&gt;Batch refunds are optional, as account abstraction would make atomic operations like these significantly easier. However, they might still reduce gas costs if properly implemented.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues were found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;There is a potential re-entrancy risk with the &lt;code&gt;refund&lt;&#x2F;code&gt; function. Make sure to perform the ether transfer &lt;strong&gt;after&lt;&#x2F;strong&gt; the tokens are destroyed (i.e. obey the checks, effects, interactions pattern).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Soulbound Multi-owner Tokens</title>
        <published>2022-08-19T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Lucas Martín Grasso Ramos</name><uri>https://github.com/LucasGrasso</uri>
	</author>
	
	<author>
		<name>Matias Arazi</name><uri>https://github.com/MatiArazi</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5516/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/EIP-5516-soulbound-multi-token-standard/10485" />
        

        <id>https://wg-eips.ritovision.com/5516/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:5516"
            label="ERC-5516" />
        

        
        

        
        <summary type="html">An interface for non-transferable, Multi-owner NFTs binding to Ethereum accounts</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5516/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes a standard interface for non-transferable, multi-owner Soulbound tokens.
Previous account-bound token standards face the issue of users losing their account keys or having them rotated, thereby losing their tokens in the process. This EIP provides a solution to this issue that allows for the recycling of SBTs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP was inspired by the main characteristics of the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; token standard and by articles in which benefits and potential use cases of Soulbound&#x2F;Accountbound Tokens (SBTs) were presented.
This design also allows for batch token transfers, saving on transaction costs. Trading of multiple tokens can be built on top of this standard and it removes the need to approve individual token contracts separately. It is also easy to describe and mix multiple fungible or non-fungible token types in a single contract.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;characteristics&quot;&gt;Characteristics&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;The NFT will be non-transferable after the initial transfer&lt;&#x2F;li&gt;
&lt;li&gt;Multi-Token&lt;&#x2F;li&gt;
&lt;li&gt;Multi-Owner&lt;&#x2F;li&gt;
&lt;li&gt;Semi-Fungible&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;applications&quot;&gt;Applications&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Academic Degrees&lt;&#x2F;li&gt;
&lt;li&gt;Code audits&lt;&#x2F;li&gt;
&lt;li&gt;POAPs (Proof of Attendance Protocol NFTs)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Smart contracts implementing this EIP MUST implement all of the functions in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5516&#x2F;&quot;&gt;ERC-5516&lt;&#x2F;a&gt; interface.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Smart contracts implementing this EIP MUST implement the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;EIP-165&lt;&#x2F;a&gt; &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; function and MUST return the constant value &lt;code&gt;true&lt;&#x2F;code&gt; if &lt;code&gt;0x45b253ba&lt;&#x2F;code&gt; is passed through the &lt;code&gt;interfaceID&lt;&#x2F;code&gt; argument.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.4&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Soulbound, Multi-Token standard.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Interface of the EIP-5516&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: The ERC-165 identifier for this interface is 0x45b253ba.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5516&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when `issuer` creates a new soulbound token and distributes it to `recipients[]`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The unique identifier of the newly created token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; issuer&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the entity that issued the credential.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; recipients&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Array of addresses that received the soulbound token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; metadataURI&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; URI pointing to the token metadata (e.g., IPFS hash).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Issued&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; issuer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recipients&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; metadataURI&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when `who` voluntarily renounces their soulbound token under `tokenId`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The unique identifier of the renounced token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; who&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address that renounced ownership of the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Renounced&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; who&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Issues a new soulbound token to multiple recipients.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Creates a unique token identifier and distributes it to all addresses in `recipients[]`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * The token is non-transferable after issuance.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - `recipients[]` MUST NOT be empty.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - All addresses in `recipients[]` MUST be non-zero.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - All addresses in `recipients[]` MUST NOT already own a token under the generated `tokenId`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - Caller MUST be an authorized issuer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Emits an {Issued} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; recipients&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Array of addresses that will receive the soulbound token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; metadataURI&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; URI pointing to the token metadata (IPFS, Arweave, HTTP, etc.).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The unique identifier of the newly created token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; issue&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recipients&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; metadataURI&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Allows the token holder to voluntarily renounce their soulbound token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Once renounced, the holder no longer owns the token and cannot reclaim it.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * This action is irreversible.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - Caller MUST own the token under `tokenId`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - `tokenId` MUST exist.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Emits a {Renounced} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The unique identifier of the token to renounce.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; renounce&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Checks if a given address owns a specific soulbound token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; who&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to check ownership for.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The unique identifier of the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; True&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if `who` owns the token under `tokenId`, false otherwise.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; has&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; who&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the URI for a given token ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * The URI typically points to a JSON file containing token metadata.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * This may be an IPFS hash, Arweave transaction ID, or HTTP URL.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - `tokenId` MUST exist.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The unique identifier of the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; complete URI string for the token metadata.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; uri&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;erc-5516-as-certificates&quot;&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5516&#x2F;&quot;&gt;ERC-5516&lt;&#x2F;a&gt; as certificates&lt;&#x2F;h3&gt;
&lt;p&gt;The original idea for this proposal aroused from a neccesity of emitting on-chain certificates to multiple people. We thought that having to emit one token per account has redundant, and we originally developed a &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; partial-compatible implementation.&lt;&#x2F;p&gt;
&lt;p&gt;After revisiting our proposal, we thought that it would be cleaner to have a more minimal interface that just serves this purpose only, so we decided to drop the partial backwards compatibility with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;sbt-as-a-spinoff-of-eip-1155&quot;&gt;SBT as a &lt;em&gt;spinoff&lt;&#x2F;em&gt; of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;EIP-1155&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;We saw the vision of the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;#metadata&quot;&gt;ERC-1155&lt;&#x2F;a&gt; and tried to apply it to Soulbound&#x2F;Accountbound tokens: We think that having the ability to prove that you own a token, not a particular identifier is valuable, and that it has real world use cases.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;metadata&quot;&gt;Metadata.&lt;&#x2F;h3&gt;
&lt;p&gt;We implement a standard method of obtaining metadata (&lt;code&gt;uri&lt;&#x2F;code&gt;) similar to the one defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;#metadata&quot;&gt;ERC-1155&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;p&gt;The URI value allows for ID substitution by clients. If the string &lt;code&gt;{id}&lt;&#x2F;code&gt; exists in any URI, clients MUST replace this with the actual token ID in hexadecimal form. This allows for a large number of tokens to use the same on-chain string by defining a URI once, for that large number of tokens.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The string format of the substituted hexadecimal ID MUST be lowercase alphanumeric: &lt;code&gt;[0-9a-f]&lt;&#x2F;code&gt; with no 0x prefix.&lt;&#x2F;li&gt;
&lt;li&gt;The string format of the substituted hexadecimal ID MUST be leading zero padded to 64 hex characters length if necessary.
Example of such a URI: &lt;code&gt;https:&#x2F;&#x2F;token-cdn-domain&#x2F;{id}.json&lt;&#x2F;code&gt; would be replaced with &lt;code&gt;https:&#x2F;&#x2F;token-cdn-domain&#x2F;000000000000000000000000000000000000000000000000000000000004cce0.json&lt;&#x2F;code&gt; if the client is referring to token ID 314592&#x2F;0x4CCE0.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;guaranteed-log-trace&quot;&gt;Guaranteed log trace&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5516&#x2F;&quot;&gt;ERC-5516&lt;&#x2F;a&gt; standard guarantees that event logs emitted by the smart contract will provide enough data to create an accurate record of all current token balances. A database or explorer may listen to events and be able to provide indexed and categorized searches of every &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5516&#x2F;&quot;&gt;ERC-5516&lt;&#x2F;a&gt; token in the contract.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;exception-handling&quot;&gt;Exception handling&lt;&#x2F;h3&gt;
&lt;p&gt;Given the non-transferability property of SBTs, if a user&#x27;s keys to an account get compromised or rotated, such user may lose the ability to associate themselves with the token.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Given the multi-owner characteristic of this EIP, SBTs will be able to bind to multiple accounts, providing a potential solution to the issue.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Multi-owner SBTs can also be issued to a contract account that implements a multi-signature functionality (As recommended in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4973&#x2F;#exception-handling&quot;&gt;EIP-4973&lt;&#x2F;a&gt;).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;multi-token&quot;&gt;Multi-token&lt;&#x2F;h3&gt;
&lt;p&gt;The multi-token functionality permits the implementation of multiple token types in the same contract. Furthermore, all emitted tokens are stored in the same contract, preventing redundant bytecode from being deployed to the blockchain. It also facilitates transfer to token issuers, since all issued tokens are stored and can be accessed under the same contract address.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This is a new token type and is not meant to be backward compatible with any existing tokens other than existing viable souls (any asset that can be identified by &lt;code&gt;[address,id]&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;You can find an implementation of this standard &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5516&#x2F;.&#x2F;assets&#x2F;ERC5516.sol&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Rental &amp; Delegation NFT - EIP-721 Extension</title>
        <published>2022-08-18T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Jan Smrža</name><uri>https://github.com/smrza</uri>
	</author>
	
	<author>
		<name>David Rábel</name><uri>https://github.com/rabeles11</uri>
	</author>
	
	<author>
		<name>Tomáš Janča</name><email>tomas.janca@jtbstorage.eu</email>
	</author>
	
	<author>
		<name>Jan Bureš</name><uri>https://github.com/JohnyX89</uri>
	</author>
	
	<author>
		<name>DOBBYLABS</name><uri>https://github.com/DOBBYLABS</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5501/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-tbd-rental-delegation-nft-erc-721-extension/10441" />
        

        <id>https://wg-eips.ritovision.com/5501/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:5501"
            label="ERC-5501" />
        

        
        

        
        <summary type="html">Adds a conditional time-limited user role to EIP-721. This role can be delegated or borrowed.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5501/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The following standard proposes an additional &lt;code&gt;user&lt;&#x2F;code&gt; role for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt;. This role grants the permission to use the NFT with no ability to transfer or set users. It has an expiry and a flag if the token is borrowed or not. &lt;code&gt;Owner&lt;&#x2F;code&gt; can delegate the NFT for usage to hot wallets or lend the NFT. If the token is borrowed, not even the owner can change the user until the status expires or both parties agree to terminate. This way, it is possible to keep both roles active at the same time.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Collectibles, gaming assets, metaverse, event tickets, music, video, domains, real item representation are several among many NFT use cases. With &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; only the owner can reap the benefits. However, with most of the utilities it would be beneficial to distinguish between the token owner and its user. For instance music or movies could be rented. Metaverse lands could be delegated for usage.&lt;&#x2F;p&gt;
&lt;p&gt;The two reasons why to set the user are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;delegation&lt;&#x2F;strong&gt; - Assign user to your hot wallet to interact with applications securely. In this case, the owner can change the user at any time.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;renting&lt;&#x2F;strong&gt; - This use case comes with additional requirements. It is needed to terminate the loan once the established lending period is over. This is provided by &lt;code&gt;expires&lt;&#x2F;code&gt; of the user. It is also necessary to protect the borrower against resetting their status by the owner. Thus, &lt;code&gt;isBorrowed&lt;&#x2F;code&gt; check must be implemented to disable the option to set the user before the contract expires.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The most common use cases for having an additional user role are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;delegation&lt;&#x2F;strong&gt; - For security reasons.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;gaming&lt;&#x2F;strong&gt; - Would you like to try a game (or particular gaming assets) but are you unsure whether or not you will like it? Rent assets first.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;guilds&lt;&#x2F;strong&gt; - Keep the owner of the NFTs as the multisig wallet and set the user to a hot wallet with shared private keys among your guild members.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;events&lt;&#x2F;strong&gt; - Distinguish between &lt;code&gt;ownerOf&lt;&#x2F;code&gt; and &lt;code&gt;userOf&lt;&#x2F;code&gt;. Each role has a different access.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;social&lt;&#x2F;strong&gt; - Differentiate between roles for different rooms. For example owner has read + write access while userOf has read access only.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This proposal is a follow up on &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4400&#x2F;&quot;&gt;EIP-4400&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4907&#x2F;&quot;&gt;EIP-4907&lt;&#x2F;a&gt; and introduces additional upgrades for lending and borrowing which include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;NFT stays in owner&#x27;s wallet during rental period&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Listing and sale of NFT without termination of the rent&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Claiming owner benefits during rental period&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Building the standard with additional isBorrowed check now allows to create rental marketplaces which can set the user of NFT without the necessary staking mechanism. With current standards if a token is not staked during the rental period, the owner can simply terminate the loan by setting the user repeatedly. This is taken care of by disabling the function if the token is borrowed which in turn is providing the owner additional benefits. They can keep the token tied to their wallet, meaning they can still receive airdrops, claim free mints based on token ownership or otherwise use the NFT provided by third-party services for owners. They can also keep the NFT listed for sale. Receiving airdrops or free mints was previously possible but the owner was completely reliant on the implementation of rental marketplaces and their discretion.&lt;&#x2F;p&gt;
&lt;p&gt;Decentralized applications can now differentiate between ownerOf and userOf while both statuses can coexist.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Every compliant contract MUST implement the &lt;code&gt;IERC5501&lt;&#x2F;code&gt; interface. This extension is OPTIONAL for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; contracts.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; IERC5501: Rental &amp;amp; Delegation NFT - EIP-721 Extension&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the EIP-165 identifier for this interface is 0xf808ec37.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5501&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is IERC721 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when the user of an NFT is modified.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UpdateUser&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _user&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _expires&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _isBorrowed&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Set the user info of an NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; User address cannot be zero address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Only approved operator or NFT owner can set the user.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * If NFT is borrowed, the user info cannot be &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; until user status expires.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; uint256 ID of the token to set user info for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _user&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address of the new user&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _expires&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Unix timestamp when user info expires&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _isBorrowed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; flag whether or not the NFT is borrowed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setUser&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _expires&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _isBorrowed&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the user address of an NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Reverts if user is not set.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; uint256 ID of the token to get the user address for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; user address for this NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; userOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the user expires of an NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; uint256 ID of the token to get the user expires for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; user expires for this NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; userExpires&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the user isBorrowed of an NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; uint256 ID of the token to get the user isBorrowed for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; user isBorrowed for this NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; userIsBorrowed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Every contract implementing the &lt;code&gt;IERC5501&lt;&#x2F;code&gt; interface is free to define the permissions of a &lt;code&gt;user&lt;&#x2F;code&gt;. However, user MUST NOT be considered an &lt;code&gt;owner&lt;&#x2F;code&gt;. They MUST NOT be able to execute transfers and approvals. Furthermore, &lt;code&gt;setUser&lt;&#x2F;code&gt; MUST be blocked from executing if &lt;code&gt;userIsBorrowed&lt;&#x2F;code&gt; returns &lt;code&gt;true&lt;&#x2F;code&gt; and &lt;code&gt;userExpires&lt;&#x2F;code&gt; is larger than or equal to &lt;code&gt;block.timestamp&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;UpdateUser&lt;&#x2F;code&gt; event MUST be emitted when a &lt;code&gt;user&lt;&#x2F;code&gt; is changed.&lt;br &#x2F;&gt;
The &lt;code&gt;setUser(uint256 _tokenId, address _user, uint64 _expires, bool _isBorrowed)&lt;&#x2F;code&gt; function SHOULD &lt;code&gt;revert&lt;&#x2F;code&gt; unless the &lt;code&gt;msg.sender&lt;&#x2F;code&gt; is the &lt;code&gt;owner&lt;&#x2F;code&gt; or an approved operator. It MUST revert if a token is borrowed and status has not expired yet. It MAY be &lt;code&gt;public&lt;&#x2F;code&gt; or &lt;code&gt;external&lt;&#x2F;code&gt;.&lt;br &#x2F;&gt;
The &lt;code&gt;userOf(uint256 _tokenId)&lt;&#x2F;code&gt; function SHOULD revert if &lt;code&gt;user&lt;&#x2F;code&gt; is not set or expired.&lt;br &#x2F;&gt;
The &lt;code&gt;userExpires(uint256 _tokenId)&lt;&#x2F;code&gt; function returns a timestamp when user status expires.&lt;br &#x2F;&gt;
The &lt;code&gt;userIsBorrowed(uint256 _tokenId)&lt;&#x2F;code&gt; function returns whether NFT is borrowed or not.&lt;br &#x2F;&gt;
The &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; function MUST return &lt;code&gt;true&lt;&#x2F;code&gt; when called with &lt;code&gt;0xf808ec37&lt;&#x2F;code&gt;.&lt;br &#x2F;&gt;
On every &lt;code&gt;transfer&lt;&#x2F;code&gt;, the &lt;code&gt;user&lt;&#x2F;code&gt; MUST be reset if the token is not borrowed. If the token is borrowed the &lt;code&gt;user&lt;&#x2F;code&gt; MUST stay the same.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;The Balance extension is OPTIONAL. This gives the option to query the number of tokens a &lt;code&gt;user&lt;&#x2F;code&gt; has.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; IERC5501Balance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * Extension for ERC5501 which adds userBalanceOf to query how many tokens address is userOf.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the EIP-165 identifier for this interface is 0x0cb22289.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5501Balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is IERC5501 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Count of all NFTs assigned to a user.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Reverts if user is zero address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _user&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; an address for which to query the balance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the number of NFTs the user has&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; userBalanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _user&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;userBalanceOf(address _user)&lt;&#x2F;code&gt; function SHOULD &lt;code&gt;revert&lt;&#x2F;code&gt; for zero address.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;The Enumerable extension is OPTIONAL. This allows to iterate over user balance.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; IERC5501Enumerable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * This extension for ERC5501 adds the option to iterate over user tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the EIP-165 identifier for this interface is 0x1d350ef8.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5501Enumerable&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is IERC5501Balance, IERC5501 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Enumerate NFTs assigned to a user.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Reverts if user is zero address or _index &amp;gt;= userBalanceOf(_owner).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _user&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; an address to iterate over its tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the token ID for given index assigned to _user&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenOfUserByIndex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;tokenOfUserByIndex(address _user, uint256 _index)&lt;&#x2F;code&gt; function SHOULD &lt;code&gt;revert&lt;&#x2F;code&gt; for zero address and &lt;code&gt;throw&lt;&#x2F;code&gt; if the index is larger than or equal to &lt;code&gt;user&lt;&#x2F;code&gt; balance.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;The Terminable extension is OPTIONAL. This allows terminating the rent early if both parties agree.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; IERC5501Terminable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * This extension for ERC5501 adds the option to terminate borrowing if both parties agree.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the EIP-165 identifier for this interface is 0x6a26417e.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5501Terminable&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is IERC5501 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when one party from borrowing contract approves termination of agreement.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _isLender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; true for lender, false for borrower&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AgreeToTerminateBorrow&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _party&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _isLender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when agreements to terminate borrow are reset.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ResetTerminationAgreements&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when borrow of token ID is terminated.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TerminateBorrow&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _lender&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _borrower&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _caller&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Agree to terminate a borrowing.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Lender must be ownerOf token ID. Borrower must be userOf token ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * If lender and borrower are the same, set termination agreement for both at once.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; uint256 ID of the token to set termination info for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setBorrowTermination&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get if it is possible to terminate a borrow agreement.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; uint256 ID of the token to get termination info for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;, bool first indicates lender agrees, second indicates borrower agrees&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getBorrowTermination&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Terminate a borrow if both parties agreed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Both parties must have agreed, otherwise revert.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; uint256 ID of the token to terminate borrow of&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; terminateBorrow&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;AgreeToTerminateBorrow&lt;&#x2F;code&gt; event MUST be emitted when either the lender or borrower agrees to terminate the rent.&lt;br &#x2F;&gt;
The &lt;code&gt;ResetTerminationAgreements&lt;&#x2F;code&gt; event MUST be emitted when a token is borrowed and transferred or &lt;code&gt;setUser&lt;&#x2F;code&gt; and &lt;code&gt;terminateBorrow&lt;&#x2F;code&gt; functions are called.&lt;br &#x2F;&gt;
The &lt;code&gt;TerminateBorrow&lt;&#x2F;code&gt; event MUST be emitted when the rent is terminated.&lt;br &#x2F;&gt;
The &lt;code&gt;setBorrowTermination(uint256 _tokenId)&lt;&#x2F;code&gt;. It MUST set an agreement from either party whichever calls the function. If the lender and borrower are the same address, it MUST assign an agreement for both parties at once.&lt;br &#x2F;&gt;
The &lt;code&gt;getBorrowTermination(uint256 _tokenId)&lt;&#x2F;code&gt; returns if agreements from both parties are &lt;code&gt;true&lt;&#x2F;code&gt; or &lt;code&gt;false&lt;&#x2F;code&gt;.&lt;br &#x2F;&gt;
The &lt;code&gt;terminateBorrow(uint256 _tokenId)&lt;&#x2F;code&gt; function MAY be called by anyone. It MUST &lt;code&gt;revert&lt;&#x2F;code&gt; if both agreements to terminate are not &lt;code&gt;true&lt;&#x2F;code&gt;. This function SHOULD change the &lt;code&gt;isBorrowed&lt;&#x2F;code&gt; flag from &lt;code&gt;true&lt;&#x2F;code&gt; to &lt;code&gt;false&lt;&#x2F;code&gt;.&lt;br &#x2F;&gt;
On every &lt;code&gt;transfer&lt;&#x2F;code&gt;, the termination agreements from either party MUST be reset if the token is borrowed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The main factors influencing this standard are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4400&#x2F;&quot;&gt;EIP-4400&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4907&#x2F;&quot;&gt;EIP-4907&lt;&#x2F;a&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Allow lending and borrowing without the necessary stake or overcollateralization while owner retains ownership&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Leave the delegation option available&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Keep the number of functions in the interfaces to a minimum while achieving desired functionality&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Modularize additional extensions to let developers choose what they need for their project&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;name&quot;&gt;Name&lt;&#x2F;h3&gt;
&lt;p&gt;The name for the additional role has been chosen to fit the purpose and to keep compatibility with EIP-4907.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;ownership-retention&quot;&gt;Ownership retention&lt;&#x2F;h3&gt;
&lt;p&gt;Many collections offer their owners airdrops or free minting of various tokens. This is essentially broken if the owner is lending a token by staking it into a contract (unless the contract is implementing a way to claim at least airdropped tokens). Applications can also provide different access and benefits to owner and user roles in their ecosystem.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;balance-and-enumerable-extensions&quot;&gt;Balance and Enumerable extensions&lt;&#x2F;h3&gt;
&lt;p&gt;These have been chosen as OPTIONAL extensions due to the complexity of implementation based on the fact that balance is less once user status expires and there is no immediate on-chain transaction to evaluate that. In both &lt;code&gt;userBalanceOf&lt;&#x2F;code&gt; and &lt;code&gt;tokenOfUserByIndex&lt;&#x2F;code&gt; functions there must be a way to determine whether or not user status has expired.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;terminable-extension&quot;&gt;Terminable extension&lt;&#x2F;h3&gt;
&lt;p&gt;If the owner mistakenly sets a user with borrow status and expires to a large value they would essentially be blocked from setting the user ever again. The problem is addressed by this extension if both parties agree to terminate the user status.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;security&quot;&gt;Security&lt;&#x2F;h3&gt;
&lt;p&gt;Once applications adopt the user role, it is possible to delegate ownership to hot wallet and interact with them with no fear of connecting to malicious websites.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is compatible with current &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; by adding an extension function set. The new functions introduced are similar to existing functions in EIP-721 which guarantees easy adoption by developers and applications. This standard also shares similarities to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4907&#x2F;&quot;&gt;EIP-4907&lt;&#x2F;a&gt; considering user role and its expiry which means applications will be able to determine the user if either of the standards is used.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases can be found in the reference implementation:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5501&#x2F;.&#x2F;assets&#x2F;test&#x2F;ERC5501Test.ts&quot;&gt;Main contract&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5501&#x2F;.&#x2F;assets&#x2F;test&#x2F;ERC5501BalanceTest.ts&quot;&gt;Balance extension&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5501&#x2F;.&#x2F;assets&#x2F;test&#x2F;ERC5501EnumerableTest.ts&quot;&gt;Enumerable extension&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5501&#x2F;.&#x2F;assets&#x2F;test&#x2F;ERC5501TerminableTest.ts&quot;&gt;Terminable extension&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5501&#x2F;.&#x2F;assets&#x2F;test&#x2F;ERC5501CombinedTest.ts&quot;&gt;Scenario combined of all extensions&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The reference implementation is available here:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5501&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;ERC5501.sol&quot;&gt;Main contract&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5501&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;ERC5501Balance.sol&quot;&gt;Balance extension&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5501&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;ERC5501Enumerable.sol&quot;&gt;Enumerable extension&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5501&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;ERC5501Terminable.sol&quot;&gt;Terminable extension&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5501&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;ERC5501Combined.sol&quot;&gt;Solution combined of all extensions&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Developers implementing this standard and applications must consider all the permissions they give to users and owners. Since owner and user are both active roles at the same time, double-spending problem must be avoided. Balance extension must be implemented in such a way which will not cause any gas problems. Marketplaces should let users know if a token listed for sale is borrowed or not.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EIP-1155 asset backed NFT extension</title>
        <published>2022-08-18T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>liszechung</name><uri>https://github.com/liszechung</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5505/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-draft-erc1155-asset-backed-nft-extension/10437" />
        

        <id>https://wg-eips.ritovision.com/5505/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:5505"
            label="ERC-5505" />
        

        
        

        
        <summary type="html">Extends EIP-1155 to support crucial operations for asset-backed NFTs</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5505/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;To propose an extension of smart contract interfaces for asset-backed, fractionalized projects using the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;EIP-1155&lt;&#x2F;a&gt; standard such that total acquisition will become possible. This proposal focuses on physical asset, where total acquisition should be able to happen.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Fractionalized, asset backed NFTs face difficulty when someone wants to acquire the whole asset. For example, if someone wants to bring home a fractionalized asset, he needs to buy all NFT pieces so he will become the 100% owner. However he could not do so as it is publicly visible that someone is trying to perform a total acquisition in an open environment like Ethereum. Sellers will take advantage to set unreasonable high prices which hinders the acquisition. Or in other cases, NFTs are owned by wallets with lost keys, such that the ownership will never be a complete one. We need a way to enable potential total acquisition.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;EIP-1155&lt;&#x2F;a&gt; compliant contracts MAY implement this EIP for adding functionalities to support total acquisition.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;set the percentage required for any acquirer to trigger a forced sale&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;set also the payment token to settle for the acquisition&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setForcedSaleRequirement&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	uint128&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; requiredBP&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; erc20Token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;set&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; unit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; price&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; acquire&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; remaining&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NFTs&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;100&lt;&#x2F;span&gt;&lt;span&gt;% - &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;requiredBP&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;suggest&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; use&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Time&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Weighted&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Average&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Price&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; certain&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; period&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; before&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; reaching&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; requiredBP&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ForcedSaleSet&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setForcedSaleTWAP&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;	uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;acquirer&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; deposit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; remainingQTY&lt;&#x2F;span&gt;&lt;span&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;TWAP&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ForcedSaleFinished&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;after&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; point&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; acquirer&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; of&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; whole&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; asset&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; execForcedSale&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;	uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;burn&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ALL&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NFTs&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; and&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; collect&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; funds&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ForcedSaleClaimed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; claimForcedSale&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;public&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ForcedSaleSet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;	bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isSet&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ForceSaleClaimed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;	uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; qtyBurned&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;	uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; amountClaimed&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;	address&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; claimer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Native ETH is supported by via Wrapped Ether &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;EIP-20&lt;&#x2F;a&gt;.
After forcedSale is set, the remaining NFTs metadata should be updated to reflect the NFTs are at most valued at the previously set TWAP price.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The major security risks considered include&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The execution of the forcedSale is only executed by the contract owner, after a governance proposal. If there is any governance attack, the forcedSale TWAP price might be manipulated on a specific timing. The governance structure for using this extension should consider adding a &lt;strong&gt;council&lt;&#x2F;strong&gt; to safeguard the fairness of the forcedSale.&lt;&#x2F;li&gt;
&lt;li&gt;Payment tokens are deposited into the contract account when forcedSale is executed. These tokens will then await the minority holders to withdraw on burning the NFT. There might be a potential security risk.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>CREATE2COPY Opcode</title>
        <published>2022-08-17T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Qi Zhou</name><uri>https://github.com/qizhou</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5478/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5478-reducing-the-gas-cost-of-contract-creation-with-existing-code/10419" />
        

        <id>https://wg-eips.ritovision.com/5478/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:5478"
            label="EIP-5478" />
        

        
        

        
        <summary type="html">Reducing the gas cost of contract creation with existing code</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5478/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Adding a new opcode, &lt;code&gt;CREATE2COPY&lt;&#x2F;code&gt;, that is identical to &lt;code&gt;CREATE2&lt;&#x2F;code&gt; but with potentially much lower gas cost by accepting an additional argument &lt;code&gt;existing_contract_address&lt;&#x2F;code&gt; that already stored the code of the new contract.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP aims to reduce the smart contract creation cost of account abstraction (AA) contracts that have identical code.&lt;&#x2F;p&gt;
&lt;p&gt;The major cost of creating an AA contract is the contract creation cost, especially data gas. For example, creating an AA contract with 10,000 bytes will consume 2,000,000 data gas. Considering the code for each user&#x27;s AA contract is the same, &lt;code&gt;CREATE2COPY&lt;&#x2F;code&gt; can reduce the data gas cost to 2600 (cold account) or even 100 (warm account) if the contract code already exists in the local storage.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FORK_BLKNUM&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;TBD&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CREATE_DATA_GAS_PER_BYTE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;200&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;COLD_ACCOUNT_ACCESS_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;2600&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;WARM_ACCOUNT_ACCESS_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= FORK_BLKNUM&lt;&#x2F;code&gt;, a new opcode is added (&lt;code&gt;CREATE2COPY&lt;&#x2F;code&gt;) at &lt;code&gt;0xf6&lt;&#x2F;code&gt;, which takes 5 stack arguments: &lt;code&gt;endowment&lt;&#x2F;code&gt;, &lt;code&gt;memory_start&lt;&#x2F;code&gt;, &lt;code&gt;memory_length&lt;&#x2F;code&gt;, &lt;code&gt;salt&lt;&#x2F;code&gt;, &lt;code&gt;existing_contract_address&lt;&#x2F;code&gt;. &lt;code&gt;CREATE2COPY&lt;&#x2F;code&gt; behaves identically to &lt;code&gt;CREATE2&lt;&#x2F;code&gt; (&lt;code&gt;0xf5&lt;&#x2F;code&gt; as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1014&#x2F;&quot;&gt;EIP-1014&lt;&#x2F;a&gt;), except that the code hash of the creating contract MUST be the same as that of &lt;code&gt;existing_contract_address&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;CREATE2COPY&lt;&#x2F;code&gt; has the same &lt;code&gt;gas&lt;&#x2F;code&gt; schema as &lt;code&gt;CREATE2&lt;&#x2F;code&gt;, but replacing the data gas from &lt;code&gt;CREATE_DATA_GAS_PER_BYTE * CONTRACT_BYTES&lt;&#x2F;code&gt; to the gas cost of &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; opcode, which is &lt;code&gt;COLD_ACCOUNT_ACCESS_COST&lt;&#x2F;code&gt; if the &lt;code&gt;existing_contract_address&lt;&#x2F;code&gt; is first-time accessed in the transaction or &lt;code&gt;WARM_ACCOUNT_ACCESS_COST&lt;&#x2F;code&gt; if &lt;code&gt;existing_contract_address&lt;&#x2F;code&gt; is already in the access list according to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;If the code of the contract returned from the init code differs from that of &lt;code&gt;existing_contract_address&lt;&#x2F;code&gt;, the creation fails with the error &quot;mismatched contract creation code with existing code&quot;, and will burn all gas for the contract creation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Consensual Soulbound Tokens</title>
        <published>2022-08-17T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Buzz Cai</name><uri>https://github.com/buzzcai</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5484/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5484-consensual-soulbound-tokens/10424" />
        

        <id>https://wg-eips.ritovision.com/5484/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:5484"
            label="ERC-5484" />
        

        
        

        
        <summary type="html">Interface for special NFTs with immutable ownership and pre-determined immutable burn authorization</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5484/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP defines an interface extending &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; to create soulbound tokens. Before issuance, both parties (the issuer and the receiver), have to agree on who has the authorization to burn this token. Burn authorization is immutable after declaration. After its issuance, a soulbound token can&#x27;t be transferred, but can be burned based on a predetermined immutable burn authorization.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The idea of soulbound tokens has gathered significant attention since its publishing. Without a standard interface, however, soulbound tokens are incompatible. It is hard to develop universal services targeting at soulbound tokens without minimal consensus on the implementation of the tokens.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP envisions soulbound tokens as specialized NFTs that will play the roles of credentials, credit records, loan histories, memberships, and many more. In order to provide the flexibility in these scenarios, soulbound tokens must have an application-specific burn authorization and a way to distinguish themselves from regular EIP-721 tokens.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The token MUST implement the following interfaces:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;EIP-165&lt;&#x2F;a&gt;’s &lt;code&gt;ERC165&lt;&#x2F;code&gt; (&lt;code&gt;0x01ffc9a7&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt;’s &lt;code&gt;ERC721&lt;&#x2F;code&gt; (&lt;code&gt;0x80ac58cd&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;burnAuth&lt;&#x2F;code&gt; SHALL be presented to receiver before issuance.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;burnAuth&lt;&#x2F;code&gt; SHALL be Immutable after issuance.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;burnAuth&lt;&#x2F;code&gt; SHALL be the sole factor that determines which party has the rights to burn token.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The issuer SHALL present token metadata to the receiver and acquire receiver&#x27;s signature before issuance.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The issuer SHALL NOT change metadata after issuance.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&#x2F;&#x2F;&#x2F; Note: the EIP-165 identifier for this interface is 0x0489b56f&lt;&#x2F;p&gt;
&lt;h3 id=&quot;contract-interface&quot;&gt;Contract Interface&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5484&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A guideline to standardlize burn-authorization&amp;#39;s number coding&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BurnAuth&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        IssuerOnly&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        OwnerOnly&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        Both&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        Neither&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a soulbound token is issued.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emit is an add-on to nft&amp;#39;s transfer emit in order to distinguish sbt &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; from vanilla nft while providing backward compatibility.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The issuer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The receiver&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The id of the issued token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Issued&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        BurnAuth&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; burnAuth&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; provides burn authorization of the token id.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; unassigned tokenIds are invalid, and queries do throw&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier for a token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; burnAuth&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;BurnAuth&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;soulbound-token-sbts-as-an-extension-to-eip-721&quot;&gt;Soulbound Token (SBTs) as an extension to EIP-721&lt;&#x2F;h3&gt;
&lt;p&gt;We believe that soulbound token serves as a specialized subset of the existing EIP-721 tokens. The advantage of such design is seamless compatibility of soulbound token with existing NFT services. Service providers can treat SBTs like NFTs and do not need to make drastic changes to their existing codebase.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;non-transferable&quot;&gt;Non-Transferable&lt;&#x2F;h3&gt;
&lt;p&gt;One problem with current soulbound token implementations that extend from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; is that all transfer implementations throw errors. A much cleaner approach would be for transfer functions to still throw, but also enable third parties to check beforehand if the contract implements the soulbound interface to avoid calling transfer.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;burn-authorization&quot;&gt;Burn Authorization&lt;&#x2F;h3&gt;
&lt;p&gt;We want maximum freedom when it comes to interface usage. A flexible and predetermined rule to burn is crucial. Here are some sample scenarios for different burn authorizations:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;IssuerOnly&lt;&#x2F;code&gt;: Loan record&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ReceiverOnly&lt;&#x2F;code&gt;: Paid membership&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Both&lt;&#x2F;code&gt;: Credentials&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Neither&lt;&#x2F;code&gt;: Credit history&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Burn authorization is tied to specific tokens and immutable after issuance. It is therefore important to inform the receiver and gain receiver&#x27;s consent before the token is issued.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;issued-event&quot;&gt;Issued Event&lt;&#x2F;h3&gt;
&lt;p&gt;On issuing, an &lt;code&gt;Issued&lt;&#x2F;code&gt; event will be emitted alongside &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt;&#x27;s &lt;code&gt;Transfer&lt;&#x2F;code&gt; event. This design keeps backward compatibility while giving clear signals to thrid-parties that this is a soulBound token issuance event.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;key-rotations&quot;&gt;Key Rotations&lt;&#x2F;h3&gt;
&lt;p&gt;A concern Ethereum users have is that soulbound tokens having immutable ownership discourage key rotations. This is a valid concern. Having a burnable soulbound token, however, makes key rotations achievable. The owner of the soulbound token, when in need of key rotations, can inform the issuer of the token. Then the party with burn authorization can burn the token while the issuer can issue a replica to the new address.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal is fully backward compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;There are no security considerations related directly to the implementation of this standard.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Jurisdiction, Accreditation, and Enforcement</title>
        <published>2022-08-17T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Zainan Victor Zhou</name><uri>https://github.com/xinbenlv</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5485/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-5485-interface-for-legitimacy-jurisdiction-and-sovereignty/10425" />
        

        <id>https://wg-eips.ritovision.com/5485/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:5485"
            label="ERC-5485" />
        

        
        

        
        <summary type="html">An interface for identifying the sovereignty status, observed jurisdiction, accreditation, and enforcement mechanisms.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5485/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Defines a standard interface for smart contracts to declare their sovereignty status, observed jurisdiction, accreditation within that jurisdiction, and the mechanisms by which they may receive and record enforcement actions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Smart contracts are, in essence, digital agreements whose execution is enforced by network consensus. As their use increasingly expands into domains that mirror real-world legal or institutional relationships, one critical component present in traditional systems is missing on-chain: a structured way to express sovereignty, jurisdiction, accreditation, and enforcement.&lt;&#x2F;p&gt;
&lt;p&gt;Historically, much of the smart-contract ecosystem has emphasized decentralization and self-sovereignty, implicitly assuming that contracts do not rely on any external legal or institutional framework. However, many practical use cases—especially those that interface with real-world regulations, property rights, or compliance regimes—require an explicit identification of the jurisdiction(s) a contract observes, the authority that has accredited it as a valid actor within that jurisdiction, and the mechanisms by which binding decisions may be communicated to it.&lt;&#x2F;p&gt;
&lt;p&gt;This ERC proposes a standardized interface for representing four foundational concepts:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Sovereignty&lt;&#x2F;strong&gt; — whether a contract is self-sovereign or claims allegiance to a higher-order system;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Jurisdiction&lt;&#x2F;strong&gt; — which external authority it chooses to observe;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Accreditation&lt;&#x2F;strong&gt; — whether that authority formally recognizes the contract as a valid participant within its system; and&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Enforcement&lt;&#x2F;strong&gt; — how decisions, rulings, or binding actions issued by that authority can be delivered to and acknowledged by the contract.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In many real-world and institutional settings, an entity becomes an actionable participant only after receiving formal accreditation by the relevant authority—whether this is a state chartering a corporation, a school recognizing a student club, a platform onboarding a developer, or a DAO admitting a module into its governance structure. Conversely, some entities explicitly declare their absence of external jurisdictional alignment, operating instead as sovereign actors such as declaration of independence as newly established countries gain their sovereignty, or joining a jurisdictional system as a newly established entity. Representing both modes—subordination and self-sovereignty—is essential for accurately modeling institutional relationships on-chain.&lt;&#x2F;p&gt;
&lt;p&gt;By standardizing how smart contracts declare sovereignty, jurisdiction, accreditation, and enforcement pathways, this ERC enables interoperability between legal systems, regulatory frameworks, institutional hierarchies, and on-chain governance models—bridging a structural gap between real-world systems and their digital counterparts.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;use-cases-primary&quot;&gt;Use Cases (Primary)&lt;&#x2F;h3&gt;
&lt;p&gt;The primary use cases address the questions related to the status of a contract themselves.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Stablecoins (e.g., USDC):&lt;&#x2F;strong&gt; Require jurisdiction because reserve custody, redemptions, freezes, and regulatory compliance depend on a specific legal authority.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Tokenized Stocks &#x2F; RWAs:&lt;&#x2F;strong&gt; Require jurisdiction because securities laws, transfer restrictions, investor rights, and enforcement vary entirely by legal venue.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Regulated Lending Protocols:&lt;&#x2F;strong&gt; Require jurisdiction to define collateral rights, default resolution, licensing requirements, and enforceability of loan agreements.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Private Company Equity for Qualified Investors:&lt;&#x2F;strong&gt; Require jurisdiction to enforce accreditation rules, transfer limits, corporate law, and cap-table validity.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;use-cases-secondary&quot;&gt;Use Cases (Secondary)&lt;&#x2F;h3&gt;
&lt;p&gt;The secondary use cases address the questions related to the interactions between contracts.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Jurisdiction Compatibility Checks:&lt;&#x2F;strong&gt; Ensuring that interacting contracts operate under compatible or acceptable jurisdictions.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Regulatory Boundary Enforcement:&lt;&#x2F;strong&gt; Gateways, bridges, or marketplaces can restrict integration to contracts meeting specific jurisdictional or accreditation requirements.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Good-Standing Verification:&lt;&#x2F;strong&gt; Validating whether a contract is accredited and in compliance under its declared jurisdiction.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Jurisdiction-Based Access Control:&lt;&#x2F;strong&gt; Allowing or restricting participation based on jurisdiction or accreditation metadata.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Cross-Contract Legal Cohesion:&lt;&#x2F;strong&gt; Ensuring coherent jurisdictional alignment across multi-contract systems, federated DAOs, or hierarchical governance structures.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Automated Dispute-Path Selection:&lt;&#x2F;strong&gt; Determining which arbitration venue, legal process, or enforcement route applies when disputes ar&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;A contract compliant with this ERC MUST implement the interface defined below.&lt;br &#x2F;&gt;
The interface provides standardized primitives for declaring a contract’s accreditation source, its observed jurisdiction, and a mechanism for receiving structured enforcement proposals. When the jurisdiction is absent, a contract is self-sovereign.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;1-data-structures&quot;&gt;1. Data Structures&lt;&#x2F;h3&gt;
&lt;p&gt;For backward compatibility with existing contracts that implement
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5247&#x2F;&quot;&gt;ERC-5247&lt;&#x2F;a&gt;, the interface extends
the &lt;code&gt;IERC5247Executable&lt;&#x2F;code&gt; and &lt;code&gt;IERC5247Executables&lt;&#x2F;code&gt; data structures.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;ierc5247executable&quot;&gt;&lt;code&gt;IERC5247Executable&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Represents a single action that MAY be proposed as part of an enforcement submission.&lt;br &#x2F;&gt;
This structure follows a generic “executable call” pattern: a target address, an optional ETH value, a gas limit, and calldata for invocation.&lt;br &#x2F;&gt;
No guarantees are made regarding execution; implementations MAY ignore or reinterpret these fields.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A single executable action that MAY be proposed as part of an enforcement.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5247Executable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The target address to be called if this executable is processed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; target&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of ETH (in wei) to send along with the call to `target`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The gas limit for the call. Implementations MAY ignore this field.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; gasLimit&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The calldata to send to `target`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;ierc5247executables&quot;&gt;&lt;code&gt;IERC5247Executables&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;A batch of &lt;code&gt;IERC5247Executable&lt;&#x2F;code&gt; items representing an ordered enforcement proposal.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A batch of executable actions forming an enforcement proposal.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5247Executables&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Ordered list of executable actions included in this proposal.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    IERC5247Executable&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; executables&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;2-interface&quot;&gt;2. Interface&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;sourceofaccreditation&quot;&gt;&lt;code&gt;sourceOfAccreditation()&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Returns the address that accredited this contract as a valid participant within some jurisdiction or governance system.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;MUST return the accrediting authority’s address if one exists.&lt;&#x2F;li&gt;
&lt;li&gt;MUST return &lt;code&gt;address(0)&lt;&#x2F;code&gt; if the contract does not recognize any external accreditation source (e.g., self-sovereign behavior).&lt;&#x2F;li&gt;
&lt;li&gt;SHOULD remain stable over the contract’s lifetime or change only through a defined governance or upgrade mechanism.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;jurisdiction&quot;&gt;&lt;code&gt;jurisdiction()&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Returns the primary jurisdiction or system whose rules this contract claims to observe.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;MAY return the same address as &lt;code&gt;sourceOfAccreditation()&lt;&#x2F;code&gt; when a single contract performs both roles.&lt;&#x2F;li&gt;
&lt;li&gt;MUST return &lt;code&gt;address(0)&lt;&#x2F;code&gt; if the contract claims no external jurisdiction.&lt;&#x2F;li&gt;
&lt;li&gt;Represents the higher-order system the contract aligns with, independently of accreditation.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;imposeenforcement-ierc5247executables-proposal&quot;&gt;&lt;code&gt;imposeEnforcement(IERC5247Executables _proposal)&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;A standardized entry point for submitting an enforcement proposal to the contract.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Implementations MUST define and document the access control for this function (e.g., restricted to &lt;code&gt;jurisdiction()&lt;&#x2F;code&gt;, &lt;code&gt;sourceOfAccreditation()&lt;&#x2F;code&gt;, or a curated authority list).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Implementations MAY:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;immediately execute some or all proposed actions,&lt;&#x2F;li&gt;
&lt;li&gt;record the proposal for later deliberation,&lt;&#x2F;li&gt;
&lt;li&gt;partially honor or completely ignore the proposal based on policy.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Implementations SHOULD emit events or persist state enabling verifiable on-chain acknowledgment that an enforcement attempt occurred.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The function is payable to allow ETH to accompany proposals when executables specify non-zero &lt;code&gt;value&lt;&#x2F;code&gt; or when processing fees apply.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;full-interface&quot;&gt;Full Interface&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5485&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the address that accredited this contract, if any.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST return address(0) if the contract does not recognize &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      an external accreditation source. SHOULD remain stable or change &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      only via defined governance.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; sourceOfAccreditation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the jurisdiction or higher-order system this contract &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      observes.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MAY be the same as `sourceOfAccreditation()`. MUST return address(0) &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      when the contract claims no external jurisdiction (self-sovereign &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      behavior). SHOULD remain stable or change only via defined governance.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; jurisdiction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Submits an enforcement proposal to this contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Implementations MUST define access control. Implementations MAY execute,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      schedule, partially honor, reject, or only record `_proposal`. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Implementations SHOULD emit events or store state acknowledging receipt of &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      enforcement proposals. Payable to allow ETH forwarding for executables that &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      specify non-zero value.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; imposeEnforcement&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;IERC5247Executables&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _proposal&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;separation-of-jurisdiction-and-accreditation&quot;&gt;Separation of Jurisdiction and Accreditation&lt;&#x2F;h3&gt;
&lt;p&gt;This ERC separates &lt;strong&gt;jurisdiction&lt;&#x2F;strong&gt; from &lt;strong&gt;accreditation&lt;&#x2F;strong&gt; because
they represent fundamentally different relationships:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Jurisdiction is voluntary.&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
A contract may unilaterally declare that it observes the rules or
norms of a particular system.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Accreditation requires external approval.&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
Only the authority itself can grant formal recognition that a contract
is an accepted participant within its system.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Jurisdiction expresses alignment; accreditation expresses acceptance.&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
Declaring jurisdiction does not imply the authority recognizes the contract.
Accreditation establishes the reciprocal relationship.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Accreditation enables enforcement.&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
Authorities typically issue enforcement only to contracts they have
accredited. Jurisdiction alone does not create this binding pathway.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Keeping these concepts distinct reflects how real-world institutions work:
observing a system’s rules is self-declared, but gaining formal standing
within that system requires an explicit action by the authority. This
distinction ensures more accurate modeling of institutional relationships
on-chain.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;The absence of accreditation and jurisdiction is backward compatible with
existing contracts, as it is a superset of the existing behavior. More
explicitly, a contract that does not implement this interface observes no
jurisdiction, by default showing no accreditation and is considered
self-sovereign.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Using &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5247&#x2F;&quot;&gt;ERC-5247&lt;&#x2F;a&gt; as a base interface for enforcement proposals is backward
compatible with existing contracts that implement &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5247&#x2F;&quot;&gt;ERC-5247&lt;&#x2F;a&gt;, such as Multi-Sig
wallets such as treasury of a DAO.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Similar to a real world scenario, when observing a jurisdiction
practically gives the contract the ability to enforce rules on the
contract&#x27;s behavior. Simlar to &quot;Ownable&quot; (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;173&#x2F;&quot;&gt;ERC-173&lt;&#x2F;a&gt;) or &quot;AccessControl&quot;,
implementations MUST be aware of the security implications of this: the
security of a contract is compromised if the jurisdiction is compromised.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Representing IP and its Royalty Structure</title>
        <published>2022-08-17T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Roy Osherove</name><uri>https://github.com/royosherove</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5553/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5553-representing-intellectual-property-on-chain-with-royalty-rights/10551" />
        

        <id>https://wg-eips.ritovision.com/5553/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:5553"
            label="ERC-5553" />
        

        
        

        
        <summary type="html">A way of representing intellectual property and its respective royalty structure on chain</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5553/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal introduces a generic way to represent intellectual property on chain, along with a refined royalty representation mechanism and associated metadata link. This standard is not associated with a specific type of IP and could represent many types of IP, such as musical IP, videos, books, images, and more.
The standard is kept very generic to allow the industry to evolve new ecosystems that can all rely on the same basic standard at their core.&lt;&#x2F;p&gt;
&lt;p&gt;This standard allows market participants to:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Observe the canonical on-chain representation of an intellectual property&lt;&#x2F;li&gt;
&lt;li&gt;Discover its attached metadata&lt;&#x2F;li&gt;
&lt;li&gt;Discover its related royalty structure&lt;&#x2F;li&gt;
&lt;li&gt;This will enable building registration, licensing, and payout mechanisms for intellectual property assets in the future.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;There is no accepted standard mechanism to license intellectual property or to represent it, except using traditional NFTs. However, regular NFTs only represent a collectible item use case and cannot easily represent more complicated use cases of licensing IP for different types of uses.
We can enable such licensing mechanisms if we can:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Declare that IP exists, SEPARATELY from its purchase ability&lt;&#x2F;li&gt;
&lt;li&gt;Declare possibly multiple interested parties to be paid for such IP&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;For 1, no standard exists today.&lt;&#x2F;p&gt;
&lt;p&gt;For 2, traditional split standards exist based on NFT purchases or through mechanisms like 0xsplits. While these solve the main problem, they do not contain the ability to name multiple types of collaboration participants.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;contracts that want to represent IP on chain MUST implement &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; AND this Proposal&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;This standard extends &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; with the following &lt;code&gt;IIPRepresentation&lt;&#x2F;code&gt; (IPR for short) interface.
Implementers of this standard &lt;strong&gt;MUST&lt;&#x2F;strong&gt; have all of the following functions:&lt;&#x2F;p&gt;
&lt;h3 id=&quot;royaltyportiontokens-function&quot;&gt;royaltyPortionTokens() function&lt;&#x2F;h3&gt;
&lt;p&gt;This function MUST return an array of addresses related to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;EIP-20&lt;&#x2F;a&gt; tokens that MUST represent royalty portions to different types of interested parties. These royalty portion tokens represent a more granular and streamlined way to declare royalty splits for multiple collaboration participants for the creation of the IP.&lt;&#x2F;p&gt;
&lt;p&gt;For example, for a musical IP, we might have two tokens representing the composition&#x2F;writing&#x2F;publishing royalty portion side and the recording&#x2F;master side. These royalty portion tokens are distributed to the collaboration participants and can later be queried by the various holders to distribute royalties. I.e., if one holds 10% of a royalty portion token, that holder will get 10% of the financial distribution related to that type of royalty.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;metadatauri-function&quot;&gt;metadataURI() function&lt;&#x2F;h3&gt;
&lt;p&gt;This function MUST return the URI to a metadata file containing any required metadata for the IP or an empty string. Each IP type MAY implement its metadata standard, defined separately. The file MUST be hosted in IPFS, Arweave, or other decentralized content-addressable systems in which the file&#x27;s contents are not changeable without changing the URI.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;changemetadatauri-function&quot;&gt;changeMetadataURI() function&lt;&#x2F;h3&gt;
&lt;p&gt;This function allows changing the metadata URI to point to a new version of the metadata file. Calling this function MUST trigger the event &lt;code&gt;MetadataChanged&lt;&#x2F;code&gt; in case of success.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;ledger-function&quot;&gt;ledger() function&lt;&#x2F;h3&gt;
&lt;p&gt;This function MUST return the registry or registrar contract address or an EOA account that initialized the IP and associated royalty tokens. An IP representation MAY be registered in multiple places by different actors for different purposes. This function enables market participants to discover which registry mechanism is the parent of the IP and might have special access rights to manage the IP.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.9&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;#39;@openzeppelin&#x2F;contracts&#x2F;interfaces&#x2F;IERC165.sol&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Interface for Intellectual Property Representation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IIPRepresentation&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC165&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Called with the new URI to an updated metadata file&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _newUri&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - the URI pointing to a metadata file (file standard is up to the implementer)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _newFileHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - The hash of the new metadata file for future reference and verification&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; changeMetadataURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _newUri&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _newFileHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; ;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; array&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; of addresses of ERC20 tokens representing royalty portion in the IP&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; i.e implementing ERC5501 (IRoyaltyInterestToken interface)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; royaltyPortionTokens&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; ;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address of the contract or EOA that initialized the IP registration&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; i.e., a registry or registrar, to be implemented in the future&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ledger&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; ;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; URI of the current metadata file for the II P&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; metadataURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; ;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; event to be triggered whenever metadata URI is &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; byAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the addresses that triggered this operation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; oldURI&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the URI to the old metadata file before the change&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; oldFileHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the hash of the old metadata file before the change&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; newURI&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the URI to the new metadata file &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; newFileHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the hash of the new metadata file &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MetadaDataChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; byAddress&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; oldURI&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; oldFileHash&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newURI&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newFileHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;returning-an-array-of-eip-20-tokens-presents-a-more-robust-royalty-portions-structure&quot;&gt;Returning an array of EIP-20 tokens presents a more robust royalty portions structure&#x2F;&lt;&#x2F;h3&gt;
&lt;p&gt;Current royalty implementations deal only with a single type of royalty payment: NFT sales. They also only allow a single type of royalty - i.e., Music NFTs cannot pay different people in different scenarios.
In other words, currently, a royalty split works the same way no matter what type of purchase or license deal has happened for all parties involved.&lt;&#x2F;p&gt;
&lt;p&gt;With this proposal, multiple &lt;strong&gt;types&lt;&#x2F;strong&gt; of royalty scenarios are allowed. A classic case is the music industry, in which we have writing&#x2F;composition royalties and recording&#x2F;master royalties. Different licensing types will pay different percentages to different parties based on context.&lt;&#x2F;p&gt;
&lt;p&gt;In the case of a song cover, a license payment formula can be created so that that
a) Original IP&#x27;s writers get paid for using the lyrics or composition of the song
b) recording artists of the original song do not get paid since their recording is not used
c) recording artists of the new IP will get paid
d) there are no writing royalties for the creators of the cover.&lt;&#x2F;p&gt;
&lt;p&gt;Moreover, this EIP has a single structure that connects to all types of royalty types and allows finding them more easily.
Lastly, moving EIP-20 tokens around is much easier than managing an 0xsplits contract.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;separating-the-ip-contract-from-the-collectible-and-licensing-nfts-enables-scaling-licensing-types&quot;&gt;Separating the IP contract from the collectible and licensing NFTs enables scaling licensing types&lt;&#x2F;h3&gt;
&lt;p&gt;By separating the canonical version of the IP from its various licensed uses (NFT purchase, streaming, usage of art and more.), this EIP introduces a path for an ecosystem of various license types and payment distributions to evolve.
In other words, when people use this scheme, they will not start by creating a music NFT or art NFT; they start by creating the IP Representation and then create types of licenses or collectibles for it, each as its own sellable NFT.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;a-single-pointer-to-the-ip-s-metadata&quot;&gt;A single pointer to the IP&#x27;s metadata&lt;&#x2F;h3&gt;
&lt;p&gt;The IPR points to metadata housed in IPFS or Arweave and allows changing it and keeping track of the changes in a simple and standard way. Today the only metadata standard is NFT metadata extension, but it is impossible to know to which standard the document adheres. With different IP types, different metadata standards for different IP types can be formulated and have a simple, easy place to discover attached metadata.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;h4 id=&quot;implementing-a-musical-ip-representation-mipr-for-short-based-on-iiprepresentation&quot;&gt;Implementing a Musical IP Representation (MIPR for short) based on IIPRepresentation&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.9&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;#39;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC721&#x2F;ERC721.sol&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;interfaces&#x2F;IIPRepresentation.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;interfaces&#x2F;Structs.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MusicalIP&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IIPRepresentation&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; songLedger&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; compToken&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; recToken&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; metadataURI&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; fileHash&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; activated &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC165&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;IIPRepresentation&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getInterfaceId&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;IIPRepresentation&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;interfaceId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _songLedger&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        SongMintingParams&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _params&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _compAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _recAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    ERC721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_params.shortName, _params.symbol)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        songLedger &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _songLedger&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        compToken &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _compAddress&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        recToken &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _recAddress&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        metadataURI &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _params&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;metadataUri&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        fileHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _params&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;fileHash&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        tokenId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _safeMint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_songLedger&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Minted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_params&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;shortName&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;_songLedger&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;_compAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;_recAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_msgSender&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;_params&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;metadataUri&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; changeMetadataURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _newURI&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _newFileHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; oldURI &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; metadataURI&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; oldHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; fileHash&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        metadataURI &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _newURI&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        fileHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _newFileHash&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MetadataChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;oldURI&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; oldHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;_newURI&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;_newFileHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; royaltyPortionTokens&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; items &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[](&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; compToken&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; recToken&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; items&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ledger&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;         return&lt;&#x2F;span&gt;&lt;span&gt; songLedger&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MetadataChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;  oldUri&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; oldFileHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;  newUri&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newFileHash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Minted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;  abbvName&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ledger&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; compToken&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recToken&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; creator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; metadataUri&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;deploying-a-new-musical-ip-using-a-simple-song-registry-contract&quot;&gt;Deploying a new Musical IP using a simple song registry contract&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.9&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;utils&#x2F;Counters.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;MusicalIP.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;CompositionRoyaltyToken.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;RecordingRoyaltyToken.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SimpleSongLedger&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC721Receiver&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    using&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Counters&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Counters&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;Counter&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Counters&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;Counter &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;private&lt;&#x2F;span&gt;&lt;span&gt; mipIds&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onERC721Received&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; IERC721Receiver&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;onERC721Received&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mintSong&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;SongMintingParams&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _params&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        CompositionRoyaltyToken comp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CompositionRoyaltyToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;SONGCOMP&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;COMP&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        RecordingRoyaltyToken rec &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RecordingRoyaltyToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;SONGREC&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;REC&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        mipIds&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;increment&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        MusicalIP mip &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MusicalIP&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                        mipIds&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;current&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                                        address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                        _params&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                                        address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;comp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                                        address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;rec&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;There might be potential security challenges of attackers persuading holders of royalty portion tokens to send them those tokens and gaining royalty portion in various IPRs. However, these are not specific to royalties and are a common issue with EIP-20 tokens.&lt;&#x2F;p&gt;
&lt;p&gt;In the case of the IP registration ownership, it will be recommended that registry contracts own the IP registration, which will be non-transferrable (account bound to the registry that created it).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>NFT Hyperlink Extension</title>
        <published>2022-08-16T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>IronMan_CH</name><uri>https://github.com/coderfengyun</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5489/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5489-nft-hyperlink-extension/10431" />
        

        <id>https://wg-eips.ritovision.com/5489/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:5489"
            label="ERC-5489" />
        

        
        

        
        <summary type="html">NFT Hyperlink Extension embeds hyperlinks onto NFTs, allowing users to click any hNFT and be transported to any url set by the owner.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5489/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes a new extension for NFTs (non-fungible token, aka &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt;): nft-hyperlink-extention (hNFT), embedding NFTs with hyperlinks, referred to as “hNFTs”. As owners of hNFTs, users may authorize a URL slot to a specific address which can be either an externally-owned account (EOA) or a contract address and hNFT owners are entitled to revoke that authorization at any time. The address which has slot authorization can manage the URL of that slot.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;As NFTs attract more attention, they have the potential to become the primary medium of Web3. Currently, end users can’t attach rich texts, videos, or images to NFTs, and there’s no way to render these rich-content attachments. Many industries eagerly look forward to this kind of rich-content attachment ability. Attaching, editing, and displaying highly customized information can usefully be standardized.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP uses hyperlinks as the aforementioned form of “highly customized attachment on NFT”, and also specifies how to attach, edit, and display these attachments on NFTs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;interface&quot;&gt;Interface&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;ierc5489&quot;&gt;&lt;code&gt;IERC5489&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5489&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; this event emits when the slot on `tokenId` is authorzized to `slotManagerAddr`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SlotAuthorizationCreated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; slotManagerAddr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; this event emits when the authorization on slot `slotManagerAddr` of token `tokenId` is revoked.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * So, the corresponding DApp can handle this to stop on-going incentives or rights&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SlotAuthorizationRevoked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; slotManagerAddr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; this event emits when the uri on slot `slotManagerAddr` of token `tokenId` has been updated to `uri`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SlotUriUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; slotManagerAddr&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uri&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Authorize a hyperlink slot on `tokenId` to address `slotManagerAddr`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Indeed slot is an entry in a map whose key is address `slotManagerAddr`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Only the address `slotManagerAddr` can manage the specific slot.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * This method will emit SlotAuthorizationCreated event&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; authorizeSlotTo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; slotManagerAddr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Revoke the authorization of the slot indicated by `slotManagerAddr` on token `tokenId`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * This method will emit SlotAuthorizationRevoked event&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revokeAuthorization&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; slotManagerAddr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Revoke all authorizations of slot on token `tokenId`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * This method will emit SlotAuthorizationRevoked event for each slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revokeAllAuthorizations&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Set uri for a slot on a token, which is indicated by `tokenId` and `slotManagerAddr`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Only the address with authorization through {authorizeSlotTo} can manipulate this slot.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * This method will emit SlotUriUpdated event&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setSlotUri&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newUri&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws if `tokenId` is not a valid NFT. URIs are defined in RFC 3986.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * The URI MUST point to a JSON file that conforms to the &amp;quot;EIP5489 Metadata JSON schema&amp;quot;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * returns the latest uri of an slot on a token, which is indicated by `tokenId`, `slotManagerAddr`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getSlotUri&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; slotManagerAddr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;authorizeSlotTo(uint256 tokenId, address slotManagerAddr)&lt;&#x2F;code&gt; function MAY be implemented as public or external.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;revokeAuthorization(uint256 tokenId, address slotManagerAddr)&lt;&#x2F;code&gt; function MAY be implemented as public or external.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;revokeAllAuthorizations(uint256 tokenId)&lt;&#x2F;code&gt; function MAY be implemented as public or external.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;setSlotUri(uint256 tokenId, string calldata newUri)&lt;&#x2F;code&gt; function MAY be implemented as public or external.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;getSlotUri(uint256 tokenId, address slotManagerAddr)&lt;&#x2F;code&gt; function MAY be implemented as pure or view.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;SlotAuthorizationCreated&lt;&#x2F;code&gt; event MUST be emitted when a slot is authorized to an address.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;SlotAuthorizationRevoked&lt;&#x2F;code&gt; event MUST be emitted when a slot authorization is revoked.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;SlotUriUpdated&lt;&#x2F;code&gt; event MUSt be emitted when a slot&#x27;s URI is changed.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;supportInterface&lt;&#x2F;code&gt; method MUST return true when called with &lt;code&gt;0x8f65987b&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;authentication&quot;&gt;Authentication&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;authorizeSlotTo&lt;&#x2F;code&gt;, &lt;code&gt;revokeAuthorization&lt;&#x2F;code&gt;, and &lt;code&gt;revokeAllAuthorizations&lt;&#x2F;code&gt; functions are authenticated if and only if the message sender is the owner of the token.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;metadata-json-schema&quot;&gt;Metadata JSON schema&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;AD Metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;icon&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A URI pointing to a resource with mime type image&#x2F;* representing the slot&amp;#39;s occupier. Consider making any images at a width between 48 and 1080 pixels and aspect ration between 1.91:1 and 4:5 inclusive. Suggest to show this as an thumbnail of the target resource&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A paragraph which briefly introduce what is the target resource&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;target&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A URI pointing to target resource, sugguest to follow 30X status code to support more redirections, the mime type and content rely on user&amp;#39;s setting&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;extends-nft-with-hyperlinks&quot;&gt;Extends NFT with hyperlinks&lt;&#x2F;h3&gt;
&lt;p&gt;URIs are used to represent the value of slots to ensure enough flexibility to deal with different use cases.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;authorize-slot-to-address&quot;&gt;Authorize slot to address&lt;&#x2F;h3&gt;
&lt;p&gt;We use addresses to represent the key of slots to ensure enough flexibility to deal with all use cases.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;As mentioned in the specifications section, this standard can be fully EIP-721 compatible by adding an extension function set.&lt;&#x2F;p&gt;
&lt;p&gt;In addition, new functions introduced in this standard have many similarities with the existing functions in EIP-721. This allows developers to easily adopt the standard quickly.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;You can find an implementation of this standard in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5489&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;ERC5489.sol&quot;&gt;&lt;code&gt;ERC5489.sol&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;No security considerations were found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Refundable Fungible Token</title>
        <published>2022-08-16T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>StartfundInc</name><uri>https://github.com/StartfundInc</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5528/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5528-refundable-token-standard/10494" />
        

        <id>https://wg-eips.ritovision.com/5528/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:5528"
            label="ERC-5528" />
        

        
        

        
        <summary type="html">Allows refunds for EIP-20 tokens by escrow smart contract</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5528/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is an extension of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;EIP-20&lt;&#x2F;a&gt;. This specification defines a type of escrow service with the following flow:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The seller issues tokens.&lt;&#x2F;li&gt;
&lt;li&gt;The seller creates an escrow smart contract with detailed escrow information like contract addresses, lock period, exchange rate, additional escrow success conditions, etc.&lt;&#x2F;li&gt;
&lt;li&gt;The seller funds seller tokens to the &lt;em&gt;Escrow Contract&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Buyers fund buyer tokens which are pre-defined in the &lt;em&gt;Escrow Contract&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;When the escrow status meets success, the seller can withdraw buyer tokens, and buyers can withdraw seller tokens based on exchange rates.&lt;&#x2F;li&gt;
&lt;li&gt;Buyers can withdraw (or refund) their funded token if the escrow process is failed or is in the middle of the escrow process.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Because of the pseudonymous nature of cryptocurrencies, there is no automatic recourse to recover funds that have already been paid.&lt;&#x2F;p&gt;
&lt;p&gt;In traditional finance, trusted escrow services solve this problem. In the world of decentralized cryptocurrency, however, it is possible to implement an escrow service without a third-party arbitrator. This standard defines an interface for smart contracts to act as an escrow service with a function where tokens are sent back to the original wallet if the escrow is not completed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;There are two types of contract for the escrow process:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Payable Contract&lt;&#x2F;em&gt;: The sellers and buyers use this token to fund the &lt;em&gt;Escrow Contract&lt;&#x2F;em&gt;. This contract MUST override &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;EIP-20&lt;&#x2F;a&gt; interfaces.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;Escrow Contract&lt;&#x2F;em&gt;: Defines the escrow policies and holds &lt;em&gt;Payable Contract&lt;&#x2F;em&gt;&#x27;s token for a certain period. This contract does not requires override &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;EIP-20&lt;&#x2F;a&gt; interfaces.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;methods&quot;&gt;Methods&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;constructor&quot;&gt;&lt;code&gt;constructor&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;em&gt;Escrow Contract&lt;&#x2F;em&gt; demonstrates details of escrow policies as none-mutable matter in constructor implementation.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;em&gt;Escrow Contract&lt;&#x2F;em&gt; MUST define the following policies:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Seller token contract address&lt;&#x2F;li&gt;
&lt;li&gt;Buyer token contract address&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;em&gt;Escrow Contract&lt;&#x2F;em&gt; MAY define the following policies:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Escrow period&lt;&#x2F;li&gt;
&lt;li&gt;Maximum (or minimum) number of investors&lt;&#x2F;li&gt;
&lt;li&gt;Maximum (or minimum) number of tokens to fund&lt;&#x2F;li&gt;
&lt;li&gt;Exchange rates of seller&#x2F;buyer token&lt;&#x2F;li&gt;
&lt;li&gt;KYC verification of users&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;escrowfund&quot;&gt;&lt;code&gt;escrowFund&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Funds &lt;code&gt;_value&lt;&#x2F;code&gt; amount of tokens to address &lt;code&gt;_to&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;In the case of &lt;em&gt;Escrow Contract&lt;&#x2F;em&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;_to&lt;&#x2F;code&gt; MUST be the user address.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;msg.sender&lt;&#x2F;code&gt; MUST be the &lt;em&gt;Payable Contract&lt;&#x2F;em&gt; address.&lt;&#x2F;li&gt;
&lt;li&gt;MUST check policy validations.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In the case of &lt;em&gt;Payable Contract&lt;&#x2F;em&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The address &lt;code&gt;_to&lt;&#x2F;code&gt; MUST be the &lt;em&gt;Escrow Contract&lt;&#x2F;em&gt; address.&lt;&#x2F;li&gt;
&lt;li&gt;MUST call the same function of the &lt;em&gt;Escrow Contract&lt;&#x2F;em&gt; interface. The parameter &lt;code&gt;_to&lt;&#x2F;code&gt; MUST be &lt;code&gt;msg.sender&lt;&#x2F;code&gt; to recognize the user address in the &lt;em&gt;Escrow Contract&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; escrowFund&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;escrowrefund&quot;&gt;&lt;code&gt;escrowRefund&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Refunds &lt;code&gt;_value&lt;&#x2F;code&gt; amount of tokens from address &lt;code&gt;_from&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;In the case of &lt;em&gt;Escrow Contract&lt;&#x2F;em&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;_from&lt;&#x2F;code&gt; MUST be the user address.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;msg.sender&lt;&#x2F;code&gt; MUST be the &lt;em&gt;Payable Contract&lt;&#x2F;em&gt; address.&lt;&#x2F;li&gt;
&lt;li&gt;MUST check policy validations.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In the case of &lt;em&gt;Payable Contract&lt;&#x2F;em&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The address &lt;code&gt;_from&lt;&#x2F;code&gt; MUST be the &lt;em&gt;Escrow Contract&lt;&#x2F;em&gt; address.&lt;&#x2F;li&gt;
&lt;li&gt;MUST call the same function of the &lt;em&gt;Escrow Contract&lt;&#x2F;em&gt; interface. The parameter &lt;code&gt;_from&lt;&#x2F;code&gt; MUST be &lt;code&gt;msg.sender&lt;&#x2F;code&gt; to recognize the user address in the &lt;em&gt;Escrow Contract&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; escrowRefund&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;escrowwithdraw&quot;&gt;&lt;code&gt;escrowWithdraw&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Withdraws funds from the escrow account.&lt;&#x2F;p&gt;
&lt;p&gt;In the case of &lt;em&gt;Escrow Contract&lt;&#x2F;em&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;MUST check the escrow process is completed.&lt;&#x2F;li&gt;
&lt;li&gt;MUST send the remaining balance of seller and buyer tokens to &lt;code&gt;msg.sender&lt;&#x2F;code&gt;&#x27;s seller and buyer contract wallets.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In the case of &lt;em&gt;Payable Contract&lt;&#x2F;em&gt;, it is optional.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; escrowWithdraw&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;example-of-interface&quot;&gt;Example of interface&lt;&#x2F;h3&gt;
&lt;p&gt;This example demonstrates simple exchange of one seller and one buyer in one-to-one exchange rates.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.4.20&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5528&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; escrowFund&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; escrowRefund&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; escrowWithdraw&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PayableContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5528&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC20&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;      General ERC20 implementations&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; fromBalance &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;fromBalance &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC20: transfer amount exceeds balance&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; fromBalance &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; owner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; escrowFund&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span&gt; res &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5528&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;escrowFund&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;res&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Fund Failed&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; escrowRefund&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span&gt; res &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5528&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_from&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;escrowRefund&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;res&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Refund Failed&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EscrowContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5528&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; State&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt; Inited&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt; Running&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt; Success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt; Closed&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BalanceData&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; _addrSeller&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; _addrBuyer&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    BalanceData _fundSeller&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    BalanceData _fundBuyer&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    EscrowStatus _status&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sellerContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; buyerContract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _addrSeller &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; sellerContract&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _addrBuyer &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; buyerContract&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _status &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; State&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;Inited&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; escrowFund&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; _addrSeller&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_status&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; State&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;Running&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;must be running state&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            _fundSeller&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;addr &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            _fundSeller&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            _status &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; State&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;Success&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; _addrBuyer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_status&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; State&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;Inited&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;must be init state&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            _fundBuyer&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;addr &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            _fundBuyer&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            _status &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; State&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;Running&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Invalid to address&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; escrowRefund&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_status&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; State&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;Running&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;refund is only available on running state&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; _addrBuyer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;invalid caller for refund&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_fundBuyer&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;addr &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;only buyer can refund&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_fundBuyer&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;buyer fund is not enough to refund&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _fundBuyer&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _fundBuyer&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; escrowWithdraw&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_status&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; State&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;Success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;withdraw is only available on success state&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; common &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MIN&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_fundBuyer&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _fundSeller&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;common &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            _fundBuyer&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _fundBuyer&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt; common&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            _fundSeller&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _fundSeller&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt; common&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Exchange&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            IERC5528&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_addrSeller&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_fundBuyer&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; common&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            IERC5528&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_addrBuyer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_fundSeller&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; common&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; send back the remaining balances&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_fundBuyer&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;                IERC5528&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_addrBuyer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_fundBuyer&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _fundBuyer&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_fundSeller&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;                IERC5528&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_addrSeller&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_fundSeller&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _fundSeller&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _status &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; State&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;Closed&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The interfaces cover the escrow operation&#x27;s refundable issue.&lt;&#x2F;p&gt;
&lt;p&gt;The suggested 3 functions (&lt;code&gt;escrowFund&lt;&#x2F;code&gt;, &lt;code&gt;escrowRefund&lt;&#x2F;code&gt; and &lt;code&gt;escrowWithdraw&lt;&#x2F;code&gt;) are based on &lt;code&gt;transfer&lt;&#x2F;code&gt; function in EIP-20.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;escrowFund&lt;&#x2F;code&gt; send tokens to the &lt;em&gt;Escrow Contract&lt;&#x2F;em&gt;. The &lt;em&gt;Escrow Contract&lt;&#x2F;em&gt; can hold the contract in the escrow process or reject tokens if the policy does not meet.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;escrowRefund&lt;&#x2F;code&gt; can be invoked in the middle of the escrow process or when the escrow process fails.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;escrowWithdraw&lt;&#x2F;code&gt; allows users (sellers and buyers) to transfer tokens from the escrow account. When the escrow process completes, the seller can get the buyer&#x27;s token, and the buyers can get the seller&#x27;s token.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;em&gt;Payable Contract&lt;&#x2F;em&gt; which implements this EIP is fully backward compatible with the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;EIP-20&lt;&#x2F;a&gt; specification.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5528&#x2F;.&#x2F;assets&#x2F;truffule-test.js&quot;&gt;Unit test example by truffle&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This test case demonstrates the following conditions for exchanging seller&#x2F;buyer tokens.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The exchange rate is one-to-one.&lt;&#x2F;li&gt;
&lt;li&gt;If the number of buyers reaches 2, the escrow process will be terminated(success).&lt;&#x2F;li&gt;
&lt;li&gt;Otherwise (not meeting success condition yet), buyers can refund (or withdraw) their funded tokens.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Since the &lt;em&gt;Escrow Contract&lt;&#x2F;em&gt; controls seller and buyer rights, flaws within the &lt;em&gt;Escrow Contract&lt;&#x2F;em&gt; will directly lead to unexpected behavior and potential loss of funds.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>ERC-721 NFT Authorization</title>
        <published>2022-08-15T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Veega Labs</name><uri>https://github.com/VeegaLabsOfficial</uri>
	</author>
	
	<author>
		<name>Sean NG</name><uri>https://github.com/ngveega</uri>
	</author>
	
	<author>
		<name>Tiger</name><uri>https://github.com/tiger0x</uri>
	</author>
	
	<author>
		<name>Fred</name><uri>https://github.com/apan826</uri>
	</author>
	
	<author>
		<name>Fov Cao</name><uri>https://github.com/fovcao</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5585/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/nft-authorization-erc721-extension/10661" />
        

        <id>https://wg-eips.ritovision.com/5585/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:5585"
            label="ERC-5585" />
        

        
        

        
        <summary type="html">Allows NFT owners to authorize other users to use their NFTs.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5585/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP separates the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; NFT&#x27;s commercial usage rights from its ownership to allow for the independent management of those rights.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Most NFTs have a simplified ownership verification mechanism, with a sole owner of an NFT. Under this model, other rights, such as display, or creating derivative works or distribution, are not possible to grant, limiting the value and commercialization of NFTs. Therefore, the separation of an NFT&#x27;s ownership and user rights can enhance its commercial value.&lt;&#x2F;p&gt;
&lt;p&gt;Commercial right is a broad concept based on the copyright, including the rights of copy, display, distribution, renting, commercial use, modify, reproduce and sublicense etc.  With the development of the Metaverse, NFTs are becoming more diverse, with new use cases such as digital collections, virtual real estate, music, art, social media, and digital asset of all kinds. The copyright and authorization based on NFTs are becoming a potential business form.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY” and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;contract-interface&quot;&gt;Contract Interface&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5585&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UserRecord&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; user&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; rights&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; expires&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get all available rights of this NFT project&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; All&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the rights that can be authorized to the user&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getRights&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; NFT holder authorizes all the rights of the NFT to a user for a specified period of time&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The zero address indicates there is no user&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT which is authorized&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; user&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The user to whom the NFT is authorized&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; duration&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The period of time the authorization lasts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; authorizeUser&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; duration&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; NFT holder authorizes specific rights to a user for a specified period of time&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The zero address indicates there is no user. It will throw exception when the rights are not defined by this NFT project&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT which is authorized&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; user&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The user to whom the NFT is authorized&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; rights&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Rights authorized to the user, such as renting, distribution or display etc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; duration&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The period of time the authorization lasts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; authorizeUser&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; rights&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; duration&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The user of the NFT transfers his rights to the new user&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The zero address indicates there is no user&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The rights of this NFT is transferred to the new user&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; newUser&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The new user&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferUserRights&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newUser&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; NFT holder extends the duration of authorization&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The zero address indicates there is no user. It will throw exception when the rights are not defined by this NFT project&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT which has been authorized&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; user&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The user to whom the NFT has been authorized&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; duration&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The new duration of the authorization&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; extendDuration&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; duration&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; NFT holder updates the rights of authorization&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The zero address indicates there is no user&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT which has been authorized&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; user&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The user to whom the NFT has been authorized&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; rights&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; New rights authorized to the user&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; updateUserRights&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; rights&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the authorization expired time of the specified NFT and user&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The zero address indicates there is no user&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT to get the user expires for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; user&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The user who has been authorized&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; authorization expired time&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getExpires&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the rights of the specified NFT and user&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The zero address indicates there is no user&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT to get the rights&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; user&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The user who has been authorized&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; rights has been authorized&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getUserRights&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The contract owner can update the number of users that can be authorized per NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; userLimit&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The number of users set by operators only&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; updateUserLimit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; userLimit&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; resetAllowed flag can be updated by contract owner to control whether the authorization can be revoked or not &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; resetAllowed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; It is the boolean flag&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; updateResetAllowed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; resetAllowed&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check if the token is available for authorization&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws if tokenId is not a valid NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT to be checked the availability&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; true&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; or false whether the NFT is available for authorization or not&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checkAuthorizationAvailability&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Clear authorization of a specified user&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The zero address indicates there is no user. The function  works when resetAllowed is true and it will throw exception when false  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT on which the authorization based&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; user&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The user whose authorization will be cleared&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; resetUser&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when the user of a NFT is &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; or the authorization expires time is updated&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; param tokenId The NFT on which the authorization based&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; param indexed user The user to whom the NFT authorized&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; rights&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Rights authorized to the user&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; expires&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The expires time of the authorization&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; authorizeUser&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; rights&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expires&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when the number of users that can be authorized per NFT is updated&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; userLimit&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The number of users set by operators only&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; updateUserLimit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; userLimit&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;getRights()&lt;&#x2F;code&gt; function MAY be implemented as pure and view.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;authorizeUser(uint256 tokenId, address user, uint duration)&lt;&#x2F;code&gt; function MAY be implemented as &lt;code&gt;public&lt;&#x2F;code&gt; or &lt;code&gt;external&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;authorizeUser(uint256 tokenId, address user, string[] rights; uint duration)&lt;&#x2F;code&gt; function MAY be implemented as &lt;code&gt;public&lt;&#x2F;code&gt; or &lt;code&gt;external&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;transferUserRights(uint256 tokenId, address newUser)&lt;&#x2F;code&gt; function MAY be implemented as &lt;code&gt;public&lt;&#x2F;code&gt; or &lt;code&gt;external&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;extendDuration(uint256 tokenId, address user, uint duration)&lt;&#x2F;code&gt; function MAY be implemented as &lt;code&gt;public&lt;&#x2F;code&gt; or &lt;code&gt;external&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;updateUserRights(uint256 tokenId, address user, string[] rights)&lt;&#x2F;code&gt; function MAY be implemented as &lt;code&gt;public&lt;&#x2F;code&gt; or &lt;code&gt;external&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;getExpires(uint256 tokenId, address user)&lt;&#x2F;code&gt; function MAY be implemented as &lt;code&gt;pure&lt;&#x2F;code&gt; or &lt;code&gt;view&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;getUserRights(uint256 tokenId, address user)&lt;&#x2F;code&gt; function MAY be implemented as pure and view.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;updateUserLimit(unit256 userLimit)&lt;&#x2F;code&gt; function MAY be implemented as &lt;code&gt;public&lt;&#x2F;code&gt; or &lt;code&gt;external&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;updateResetAllowed(bool resetAllowed)&lt;&#x2F;code&gt; function MAY be implemented as &lt;code&gt;public&lt;&#x2F;code&gt; or &lt;code&gt;external&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;checkAuthorizationAvailability(uint256 tokenId)&lt;&#x2F;code&gt; function MAY be implemented as &lt;code&gt;pure&lt;&#x2F;code&gt; or &lt;code&gt;view&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;resetUser(uint256 tokenId, address user)&lt;&#x2F;code&gt; function MAY be implemented as &lt;code&gt;public&lt;&#x2F;code&gt; or &lt;code&gt;external&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;authorizeUser&lt;&#x2F;code&gt; event MUST be emitted when the user of a NFT is changed or the authorization expires time is updated.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;updateUserLimit&lt;&#x2F;code&gt; event MUST be emitted when the number of users that can be authorized per NFT is updated.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;First of all, NFT contract owner can set the maximum number of authorized users to each NFT and whether the NFT owner can cancel the authorization at any time to protect the interests of the parties involved.&lt;&#x2F;p&gt;
&lt;p&gt;Secondly, there is a &lt;code&gt;resetAllowed&lt;&#x2F;code&gt; flag to control the rights between the NFT owner and the users for the contract owner. If the flag is set to true, then the NFT owner can disable usage rights of all authorized users at any time.&lt;&#x2F;p&gt;
&lt;p&gt;Thirdly, the rights within the user record struct is used to store what rights has been authorized to a user by the NFT owner, in other words, the NFT owner can authorize a user with specific rights and update it when necessary.&lt;&#x2F;p&gt;
&lt;p&gt;Finally, this design can be seamlessly integrated with third parties. It is an extension of ERC-721, therefore it can be easily integrated into a new NFT project. Other projects can directly interact with these interfaces and functions to implement their own types of transactions. For example, an announcement platform could use this EIP to allow all NFT owners to make authorization or deauthorization at any time.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; since it is an extension of it.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;When the &lt;code&gt;resetAllowed&lt;&#x2F;code&gt; flag is false, which means the authorization can not be revoked by NFT owner during the period of authorization, users of the EIP need to make sure the authorization fee can be fairly assigned if the NFT was sold to a new holder.&lt;&#x2F;p&gt;
&lt;p&gt;Here is a solution for taking reference: the authorization fee paid by the users can be held in an escrow contract for a period of time depending on the duration of the authorization. For example, if the authorization duration is 12 months and the fee in total is 10 ETH, then if the NFT is transferred after 3 months, then only 2.5 ETH would be sent and the remaining 7.5 ETH would be refunded.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Stealth Addresses</title>
        <published>2022-08-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Toni Wahrstätter</name><uri>https://github.com/nerolation</uri>
	</author>
	
	<author>
		<name>Matt Solomon</name><uri>https://github.com/mds1</uri>
	</author>
	
	<author>
		<name>Ben DiFrancesco</name><uri>https://github.com/apbendi</uri>
	</author>
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5564/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5566-stealth-addresses-for-smart-contract-wallets/10614" />
        

        <id>https://wg-eips.ritovision.com/5564/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:5564"
            label="ERC-5564" />
        

        
        

        
        <summary type="html">Private, non-interactive transactions</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5564/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This specification establishes a standardized method for interacting with stealth addresses, which allow senders of transactions or transfers to non-interactively generate private accounts exclusively accessible by their recipients. Moreover, this specification enables developers to create stealth address protocols based on the foundational implementation outlined in this ERC, utilizing a singleton contract deployed at &lt;code&gt;0x55649E01B5Df198D18D95b5cc5051630cfD45564&lt;&#x2F;code&gt; to emit the necessary information for recipients. In addition to the base implementation, this ERC also outlines the first implementation of a cryptographic scheme, specifically the SECP256k1 curve.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The standardization of non-interactive stealth address generation presents the potential to significantly improve the privacy capabilities of the Ethereum network and other EVM-compatible chains by allowing recipients to remain private when receiving assets. This is accomplished through the sender generating a stealth address based on a shared secret known exclusively to the sender and recipient. The recipients alone can access the funds stored at their stealth addresses, as they are the sole possessors of the necessary private key. As a result, observers are unable to associate the recipient&#x27;s stealth address with their identity, thereby preserving the recipient&#x27;s privacy and leaving the sender as the only party privy to this information. By offering a foundational implementation in the form of a single contract that is compatible with multiple cryptographic schemes, recipients are granted a centralized location to monitor, ensuring they do not overlook any incoming transactions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;Definitions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A &quot;stealth meta-address&quot; is a set of one or two public keys that can be used to compute a stealth address for a given recipient.&lt;&#x2F;li&gt;
&lt;li&gt;A &quot;spending key&quot; is a private key that can be used to spend funds sent to a stealth address. A &quot;spending public key&quot; is the corresponding public key.&lt;&#x2F;li&gt;
&lt;li&gt;A &quot;viewing key&quot; is a private key that can be used to determine if funds sent to a stealth address belong to the recipient who controls the corresponding spending key. A &quot;viewing public key&quot; is the corresponding public key.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Different stealth address schemes will have different expected stealth meta-address lengths. A scheme that uses public keys of length &lt;code&gt;n&lt;&#x2F;code&gt; bytes MUST define stealth meta-addresses as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A stealth meta-address of length &lt;code&gt;n&lt;&#x2F;code&gt; uses the same stealth meta-address for the spending public key and viewing public key.&lt;&#x2F;li&gt;
&lt;li&gt;A stealth meta-address of length &lt;code&gt;2n&lt;&#x2F;code&gt; uses the first &lt;code&gt;n&lt;&#x2F;code&gt; bytes as the spending public key and the last &lt;code&gt;n&lt;&#x2F;code&gt; bytes as the viewing public key.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Given a recipient&#x27;s stealth meta-address, a sender MUST be able generate a stealth address for the recipient by calling a method with the following signature:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Generates a stealth address from a stealth meta address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; stealthMetaAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The recipient&amp;#39;s stealth meta-address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; stealthAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The recipient&amp;#39;s stealth address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ephemeralPubKey&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ephemeral public key used to generate the stealth address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; viewTag&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The view tag derived from the shared secret.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; generateStealthAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; stealthMetaAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; stealthAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ephemeralPubKey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes1&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; viewTag&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;A recipient MUST be able to check if a stealth address belongs to them by calling a method with the following signature:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns true if funds sent to a stealth address belong to the recipient who controls&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the corresponding spending key.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; stealthAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The recipient&amp;#39;s stealth address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ephemeralPubKey&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ephemeral public key used to generate the stealth address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; viewingKey&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The recipient&amp;#39;s viewing private key.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; spendingPubKey&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The recipient&amp;#39;s spending public key.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; True&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if funds sent to the stealth address belong to the recipient.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checkStealthAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; stealthAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ephemeralPubKey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; viewingKey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spendingPubKey&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;A recipient MUST be able to compute the private key for a stealth address by calling a method with the following signature:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Computes the stealth private key for a stealth address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; stealthAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The expected stealth address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ephemeralPubKey&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ephemeral public key used to generate the stealth address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; viewingKey&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The recipient&amp;#39;s viewing private key.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; spendingKey&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The recipient&amp;#39;s spending private key.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; stealthKey&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The stealth private key corresponding to the stealth address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The stealth address input is not strictly necessary, but it is included so the method&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; can validate that the stealth private key was generated correctly.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; computeStealthKey&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; stealthAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ephemeralPubKey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; viewingKey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spendingKey&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The implementation of these methods is scheme-specific. The specification of a new stealth address scheme MUST specify the implementation for each of these methods. Additionally, although these function interfaces are specified in Solidity, they do not necessarily ever need to be implemented in Solidity, but any library or SDK conforming to this specification MUST implement these methods with compatible function interfaces.&lt;&#x2F;p&gt;
&lt;p&gt;A 256 bit integer (&lt;code&gt;schemeId&lt;&#x2F;code&gt;) is used to identify stealth address schemes. A mapping from the schemeId to its specification MUST be declared in the ERC that proposes to standardize a new stealth address scheme. It is RECOMMENDED that &lt;code&gt;schemeId&lt;&#x2F;code&gt;s are chosen to be monotonically incrementing integers for simplicity, but arbitrary or meaningful &lt;code&gt;schemeId&lt;&#x2F;code&gt;s may be chosen. This ERC introduces a &lt;code&gt;schemeId&lt;&#x2F;code&gt; of &lt;code&gt;1&lt;&#x2F;code&gt; with the following extensions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;1&lt;&#x2F;code&gt; is the integer identifier for the scheme,&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;viewTags&lt;&#x2F;code&gt; MUST be included in the announcement event and is used to reduce the parsing time for the recipients.&lt;&#x2F;li&gt;
&lt;li&gt;SECP256k1 is the algorithm for encoding a stealth meta-address (i.e. the spending public key and viewing public key) into a &lt;code&gt;bytes&lt;&#x2F;code&gt; array, and decoding it from &lt;code&gt;bytes&lt;&#x2F;code&gt; to the native key types of that scheme.&lt;&#x2F;li&gt;
&lt;li&gt;SECP256k1 with view tags will be used in &lt;code&gt;generateStealthAddress&lt;&#x2F;code&gt;, &lt;code&gt;checkStealthAddress&lt;&#x2F;code&gt;, and &lt;code&gt;computeStealthKey&lt;&#x2F;code&gt; methods.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This specification additionally defines a singleton &lt;code&gt;ERC5564Announcer&lt;&#x2F;code&gt; contract that emits events to announce when something is sent to a stealth address. This MUST be a singleton contract, with one instance per chain. The contract is specified as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Interface for announcing when something is sent to a stealth address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5564Announcer&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when sending something to a stealth address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See the `announce` method for documentation on the parameters.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Announcement&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; schemeId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; stealthAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; caller&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ephemeralPubKey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; metadata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Called by integrators to emit an `Announcement` event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; schemeId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The integer specifying the applied stealth address scheme.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; stealthAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The computed stealth address for the recipient.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ephemeralPubKey&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Ephemeral public key used by the sender.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An arbitrary field MUST include the view tag in the first byte.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Besides the view tag, the metadata can be used by the senders however they like,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; but the below guidelines are recommended:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The first byte of the metadata MUST be the view tag.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - When sending&#x2F;interacting with the native token of the blockchain (cf. ETH), the metadata SHOULD be structured as follows:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     - Byte 1 MUST be the view tag, as specified above.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     - Bytes 2-5 are `0xeeeeeeee`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     - Bytes 6-25 are the address 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     - Bytes 26-57 are the amount of ETH being sent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - When interacting with ERC-20&#x2F;ERC-721&#x2F;etc. tokens, the metadata SHOULD be structured as follows:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   - Byte 1 MUST be the view tag, as specified above.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   - Bytes 2-5 are a function identifier. When a function selector (e.g.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     the first (left, high-order in big-endian) four bytes of the Keccak-256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     hash of the signature of the function, like Solidity and Vyper use) is&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     available, it MUST be used.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   - Bytes 6-25 are the token contract address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   - Bytes 26-57 are the amount of tokens being sent&#x2F;interacted with for fungible tokens, or&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     the token ID for non-fungible tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; announce&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; schemeId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; stealthAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ephemeralPubKey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; metadata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Announcement&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;schemeId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; stealthAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; ephemeralPubKey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; metadata&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;stealth-meta-address-format&quot;&gt;Stealth meta-address format&lt;&#x2F;h3&gt;
&lt;p&gt;The new address format for the stealth meta-address extends the chain specific address format by adding a &lt;code&gt;st:&lt;&#x2F;code&gt; (&lt;em&gt;stealth&lt;&#x2F;em&gt;) prefix.
Thus, a stealth meta-address on Ethereum has the following format:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;st:eth:0x&amp;lt;spendingPubKey&amp;gt;&amp;lt;viewingPubKey&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Stealth meta-addresses may be managed by the user and&#x2F;or registered within a publicly available &lt;code&gt;Registry&lt;&#x2F;code&gt; contract, as delineated in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6538&#x2F;&quot;&gt;ERC-6538&lt;&#x2F;a&gt;. This provides users with a centralized location for identifying stealth meta-addresses associated with other individuals while simultaneously enabling recipients to express their openness to engage via stealth addresses.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Notably, the address format is used only to differentiate stealth addresses from standard addresses, as the prefix is removed before performing any computations on the stealth meta-address.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;hr &#x2F;&gt;
&lt;h3 id=&quot;initial-implementation-of-secp256k1-with-view-tags&quot;&gt;Initial Implementation of SECP256k1 with View Tags&lt;&#x2F;h3&gt;
&lt;p&gt;This ERC provides a foundation that is not tied to any specific cryptographic system through the &lt;code&gt;IERC5564Announcer&lt;&#x2F;code&gt; contract. In addition, it introduces the first implementation of a stealth address scheme that utilizes the SECP256k1 elliptic curve and view tags. The SECP256k1 elliptic curve is defined with the equation $y^2 = x^3 + 7 \pmod{p}$, where $p = 2^{256} - 2^{32} - 977$.&lt;&#x2F;p&gt;
&lt;p&gt;The following reference is divided into three sections:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Stealth address generation&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Parsing announcements&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Stealth private key derivation&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Definitions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;$G$ represents the generator point of the curve.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;generation-generate-stealth-address-from-stealth-meta-address&quot;&gt;Generation - Generate stealth address from stealth meta-address:&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Recipient has access to the private keys $p_{spend}$, $p_{view}$ from which public keys $P_{spend}$ and $P_{view}$ are derived.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Recipient has published a stealth meta-address that consists of the public keys $P_{spend}$ and $P_{view}$.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Sender passes the stealth meta-address to the &lt;code&gt;generateStealthAddress&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;generateStealthAddress&lt;&#x2F;code&gt; function performs the following computations:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Generate a random 32-byte entropy ephemeral private key $p_{ephemeral}$.&lt;&#x2F;li&gt;
&lt;li&gt;Derive the ephemeral public key $P_{ephemeral}$ from $p_{ephemeral}$.&lt;&#x2F;li&gt;
&lt;li&gt;Parse the spending and viewing public keys, $P_{spend}$ and $P_{view}$, from the stealth meta-address.&lt;&#x2F;li&gt;
&lt;li&gt;A shared secret $s$ is computed as $s = p_{ephemeral} \cdot P_{view}$.&lt;&#x2F;li&gt;
&lt;li&gt;The secret is hashed $s_{h} = \textrm{h}(s)$.&lt;&#x2F;li&gt;
&lt;li&gt;The view tag $v$ is extracted by taking the most significant byte $s_{h}[0]$,&lt;&#x2F;li&gt;
&lt;li&gt;Multiply the hashed shared secret with the generator point $S_h = s_h \cdot G$.&lt;&#x2F;li&gt;
&lt;li&gt;The recipient&#x27;s stealth public key is computed as $P_{stealth} = P_{spend} + S_h$.&lt;&#x2F;li&gt;
&lt;li&gt;The recipient&#x27;s stealth address $a_{stealth}$ is computed as $\textrm{pubkeyToAddress}(P_{stealth})$.&lt;&#x2F;li&gt;
&lt;li&gt;The function returns the stealth address $a_{stealth}$, the ephemeral public key $P_{ephemeral}$ and the view tag $v$.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;parsing-locate-one-s-own-stealth-address-es&quot;&gt;Parsing - Locate one&#x27;s own stealth address(es):&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;User has access to the viewing private key $p_{view}$ and the spending public key $P_{spend}$.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;User has access to a set of &lt;code&gt;Announcement&lt;&#x2F;code&gt; events and applies the &lt;code&gt;checkStealthAddress&lt;&#x2F;code&gt; function to each of them.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;checkStealthAddress&lt;&#x2F;code&gt; function performs the following computations:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Shared secret $s$ is computed by multiplying the viewing private key with the ephemeral public key of the announcement $s = p_{view}$ * $P_{ephemeral}$.&lt;&#x2F;li&gt;
&lt;li&gt;The secret is hashed $s_{h} = h(s)$.&lt;&#x2F;li&gt;
&lt;li&gt;The view tag $v$ is extracted by taking the most significant byte $s_{h}[0]$ and can be compared to the given view tag. If the view tags do not match, this &lt;code&gt;Announcement&lt;&#x2F;code&gt; is not for the user and the remaining steps can be skipped. If the view tags match, continue on.&lt;&#x2F;li&gt;
&lt;li&gt;Multiply the hashed shared secret with the generator point $S_h = s_h \cdot G$.&lt;&#x2F;li&gt;
&lt;li&gt;The stealth public key is computed as $P_{stealth} = P_{spend} + S_h$.&lt;&#x2F;li&gt;
&lt;li&gt;The derived stealth address $a_{stealth}$ is computed as $\textrm{pubkeyToAddress}(P_{stealth})$.&lt;&#x2F;li&gt;
&lt;li&gt;Return &lt;code&gt;true&lt;&#x2F;code&gt; if the stealth address of the announcement matches the derived stealth address, else return &lt;code&gt;false&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;private-key-derivation-generate-the-stealth-address-private-key-from-the-hashed-shared-secret-and-the-spending-private-key&quot;&gt;Private key derivation - Generate the stealth address private key from the hashed shared secret and the spending private key.&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;User has access to the viewing private key $p_{view}$ and spending private key $p_{spend}$.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;User has access to a set of &lt;code&gt;Announcement&lt;&#x2F;code&gt; events for which the &lt;code&gt;checkStealthAddress&lt;&#x2F;code&gt; function returns &lt;code&gt;true&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;computeStealthKey&lt;&#x2F;code&gt; function performs the following computations:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Shared secret $s$ is computed by multiplying the viewing private key with the ephemeral public key of the announcement $s = p_{view}$ * $P_{ephemeral}$.&lt;&#x2F;li&gt;
&lt;li&gt;The secret is hashed $s_{h} = h(s)$.&lt;&#x2F;li&gt;
&lt;li&gt;The stealth private key is computed as $p_{stealth} = p_{spend} + s_h$.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;parsing-considerations&quot;&gt;Parsing considerations&lt;&#x2F;h3&gt;
&lt;p&gt;Usually, the recipient of a stealth address transaction has to perform the following operations to check whether he was the recipient of a certain transaction:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;2x ecMUL,&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;2x HASH,&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;1x ecADD,&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The view tags approach is introduced to reduce the parsing time by around 6x. Users only need to perform 1x ecMUL and 1x HASH (skipping 1x ecMUL, 1x ecADD and 1x HASH) for every parsed announcement. The 1-byte view tag length is based on the maximum required space to reliably filter non-matching announcements. With a 1-byte &lt;code&gt;viewTag&lt;&#x2F;code&gt;, the probability for users to skip the remaining computations after hashing the shared secret $h(s)$ is $255&#x2F;256$. This means that users can almost certainly skip the above three operations for any announcements that do not involve them. Since the view tag reveals one byte of the shared secret, the security margin is reduced from 128 bits to 124 bits. Notably, this only affects the privacy and not the secure generation of a stealth address.&lt;&#x2F;p&gt;
&lt;hr &#x2F;&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC emerged from the need for privacy-preserving ways to transfer ownership without disclosing any information about the recipients&#x27; identities. Token ownership can expose sensitive personal information. While individuals may wish to donate to a specific organization or country, they might prefer not to disclose a link between themselves and the recipient simultaneously. Standardizing stealth address generation represents a significant step towards unlinkable interactions, since such privacy-enhancing solutions require standards to achieve widespread adoption. Consequently, it is crucial to focus on developing generalizable approaches for implementing related solutions.&lt;&#x2F;p&gt;
&lt;p&gt;The stealth address specification standardizes a protocol for generating and locating stealth addresses, facilitating the transfer of assets without requiring prior interaction with the recipient. This enables recipients to verify the receipt of a transfer without the need to interact with the blockchain and query account balances. Importantly, stealth addresses enable token transfer recipients to verify receipt while maintaining their privacy, as only the recipient can recognize themselves as the recipient of the transfer.&lt;&#x2F;p&gt;
&lt;p&gt;The authors recognize the trade-off between on- and off-chain efficiency. Although incorporating a Monero-like view tags mechanism enables recipients to parse announcements more efficiently, it adds complexity to the announcement event.&lt;&#x2F;p&gt;
&lt;p&gt;The recipient&#x27;s address and the &lt;code&gt;viewTag&lt;&#x2F;code&gt; must be included in the announcement event, allowing users to quickly verify ownership without querying the chain for positive account balances.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC is fully backward compatible.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;deployment-method&quot;&gt;Deployment Method&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;ERC5564Announcer&lt;&#x2F;code&gt; contract is deployed at &lt;code&gt;0x55649E01B5Df198D18D95b5cc5051630cfD45564&lt;&#x2F;code&gt; using &lt;code&gt;CREATE2&lt;&#x2F;code&gt; via the deterministic deployer at &lt;code&gt;0x4e59b44847b379578588920ca78fbf26c0b4956c&lt;&#x2F;code&gt; with a salt of &lt;code&gt;0xd0103a290d760f027c9ca72675f5121d725397fb2f618f05b6c44958b25b4447&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;You can find the implementation of the &lt;code&gt;ERC5564Announcer&lt;&#x2F;code&gt; contract &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5564&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;ERC5564Announcer.sol&quot;&gt;here&lt;&#x2F;a&gt; and the interface &lt;code&gt;IERC5564Announcer.sol&lt;&#x2F;code&gt; &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5564&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;interfaces&#x2F;IERC5564Announcer.sol&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;dos-countermeasures&quot;&gt;DoS Countermeasures&lt;&#x2F;h3&gt;
&lt;p&gt;There are potential denial of service (DoS) attack vectors that are not mitigated by network transaction fees. Stealth transfer senders cause an externality for recipients, as parsing announcement events consumes computational resources that are not compensated with gas. Therefore, spamming announcement events &lt;em&gt;can&lt;&#x2F;em&gt; be a detriment to the user experience, as it &lt;em&gt;can&lt;&#x2F;em&gt; lead to longer parsing times.
We consider the incentives to carry out such an attack to be low because &lt;strong&gt;no monetary benefit can be obtained&lt;&#x2F;strong&gt;
However, to tackle potential spam, parsing providers may adopt their own anti-DoS attack methods. These may include ignoring the spamming users when serving announcements to users or, less harsh, de-prioritizing them when ordering the announcements. The indexed &lt;code&gt;caller&lt;&#x2F;code&gt; keyword may help parsing providers to effectively filter known spammers.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore, parsing providers have a few options to counter spam, such as introducing staking mechanisms or requiring senders to pay a &lt;code&gt;toll&lt;&#x2F;code&gt; before including their &lt;code&gt;Announcement&lt;&#x2F;code&gt;. Moreover, a Staking mechanism may allow users to stake an unslashable amount of ETH (similarly to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt;), to help mitigate potential spam through &lt;em&gt;sybil attacks&lt;&#x2F;em&gt; and enable parsing providers filtering spam more effectively.
Introducing a &lt;code&gt;toll&lt;&#x2F;code&gt;, paid by sending users, would simply put a cost on each stealth address transaction, making spamming economically unattractive.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;recipients-transaction-costs&quot;&gt;Recipients&#x27; transaction costs&lt;&#x2F;h3&gt;
&lt;p&gt;The funding of the stealth address wallet represents a known issue that might breach privacy. The wallet that funds the stealth address MUST NOT have any physical connection to the stealth address owner in order to fully leverage the privacy improvements.&lt;&#x2F;p&gt;
&lt;p&gt;Thus, the sender may attach a small amount of ETH to each stealth address transaction, thereby sponsoring subsequent transactions of the recipient.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EOF - Stack Validation</title>
        <published>2022-08-12T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Andrei Maiboroda</name><uri>https://github.com/gumb0</uri>
	</author>
	
	<author>
		<name>Paweł Bylica</name><uri>https://github.com/chfast</uri>
	</author>
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	<author>
		<name>Danno Ferrin</name><uri>https://github.com/shemnon</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5450/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5450-eof-stack-validation/10410" />
        

        <id>https://wg-eips.ritovision.com/5450/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:5450"
            label="EIP-5450" />
        

        
        

        
        <summary type="html">Deploy-time validation of stack usage for EOF functions.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5450/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce extended validation of EOF code sections to guarantee that neither stack underflow nor overflow can happen during execution of validated contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The current EVM performs a number of validity checks for each executed instruction, such as checking
for instruction being defined, stack overflow and underflow, and enough amount of gas remaining.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP minimizes the number of such checks required at run-time
by verifying that no exceptional conditions can happen
and preventing the execution and deployment of any invalid code.&lt;&#x2F;p&gt;
&lt;p&gt;The operand stack validation provides several benefits:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;removes the run-time stack underflow check for all instructions,&lt;&#x2F;li&gt;
&lt;li&gt;removes the run-time stack overflow check for all instructions except &lt;code&gt;CALLF&lt;&#x2F;code&gt; and &lt;code&gt;JUMPF&lt;&#x2F;code&gt; (&lt;code&gt;JUMPF&lt;&#x2F;code&gt; introduced in a separate EIP) ,&lt;&#x2F;li&gt;
&lt;li&gt;ensures that execution terminates with one of the terminating instructions,&lt;&#x2F;li&gt;
&lt;li&gt;prevents deployment of code with unreachable instructions, thereby discouraging the use of code sections for data storage.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;It also has some disadvantages:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;adds constraints to the code structure (similar to JVM, CPython bytecode, WebAssembly, SPIR-V and others); however, these constraints can be lifted in a backward-compatible manner if they are shown to be user-unfriendly,&lt;&#x2F;li&gt;
&lt;li&gt;it is natural to implement stack validation as a second validation pass; however, it is not strictly required and validation&#x27;s computational and space complexity remains linear in any implementation variant.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The guarantees created by these validation rules also improve the feasibility of Ahead-Of-Time and Just-In-Time compilation of EVM code. Single pass transpilation passes can be safely executed with the code validation and advanced stack&#x2F;register handling can be applied with the stack height validations. While not as impactful to a Mainnet validator node that is bound mostly by storage state sizes, these can significantly speed up witness validation and other non-Mainnet use cases.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;code-validation&quot;&gt;Code validation&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;em&gt;Remark:&lt;&#x2F;em&gt; We rely on the notions of &lt;em&gt;operand stack&lt;&#x2F;em&gt; and &lt;em&gt;type section&lt;&#x2F;em&gt; as defined by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4750&#x2F;&quot;&gt;EIP-4750&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Each code section is validated independently.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;instructions-validation&quot;&gt;Instructions validation&lt;&#x2F;h4&gt;
&lt;p&gt;In the first validation phase defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3670&#x2F;&quot;&gt;EIP-3670&lt;&#x2F;a&gt; (and extended by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4200&#x2F;&quot;&gt;EIP-4200&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4750&#x2F;&quot;&gt;EIP-4750&lt;&#x2F;a&gt;) instructions are inspected independently to check if their opcodes and immediate values are valid.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;operand-stack-validation&quot;&gt;Operand stack validation&lt;&#x2F;h4&gt;
&lt;p&gt;In the second validation phase control-flow analysis is performed on the code.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Operand stack height&lt;&#x2F;em&gt; here refers to the number of stack values accessible by this function, i.e. it does not take into account values of caller functions&#x27; frames (but does include this function&#x27;s inputs). Note that validation procedure does not require actual operand stack implementation, but only to keep track of its height.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Terminating instructions&lt;&#x2F;em&gt; refers to the instructions either:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;ending function execution: &lt;code&gt;RETF&lt;&#x2F;code&gt;, &lt;code&gt;JUMPF&lt;&#x2F;code&gt;, or&lt;&#x2F;li&gt;
&lt;li&gt;ending call frame execution: &lt;code&gt;STOP&lt;&#x2F;code&gt;, &lt;code&gt;RETURN&lt;&#x2F;code&gt;, &lt;code&gt;RETURNCODE&lt;&#x2F;code&gt;, &lt;code&gt;REVERT&lt;&#x2F;code&gt;, &lt;code&gt;INVALID&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;note: &lt;code&gt;JUMPF&lt;&#x2F;code&gt; and &lt;code&gt;RETURNCODE&lt;&#x2F;code&gt; are introduced in separate EIPs.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Forward jump&lt;&#x2F;em&gt; refers to any of &lt;code&gt;RJUMP&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt; instruction with relative offset greater than or equal to 0. &lt;em&gt;Backwards jump&lt;&#x2F;em&gt; refers to any of &lt;code&gt;RJUMP&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt; instruction with relative offset less than 0, including jumps to the same jump instruction.&lt;&#x2F;p&gt;
&lt;p&gt;Instructions in the code are scanned in a single linear pass over the code. For each instruction the operand stack height bounds are recorded as &lt;code&gt;stack_height_min&lt;&#x2F;code&gt; and &lt;code&gt;stack_height_max&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The first instruction&#x27;s recorded stack height bounds are initialized to be equal to the number of inputs to the function type matching the code (&lt;code&gt;stack_height_min = stack_height_max = type[code_section_index].inputs&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;For each instruction:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Check&lt;&#x2F;strong&gt; if this instruction has recorded stack height bounds. If it does not, it means it was neither referenced by previous forward jump, nor is part of sequential instruction flow, and this code fails validation.
&lt;ul&gt;
&lt;li&gt;It is a prerequisite to validation algorithm, and code generators are required to order code basic blocks in a way that no block is referenced only by backwards jump. Any program can satisfy this requirement by ordering code basic blocks by the reverse postorder.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Determine the effect the instruction has on the operand stack:
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Check&lt;&#x2F;strong&gt; if the recorded stack height bounds satisfy the instruction requirements. Specifically:
&lt;ul&gt;
&lt;li&gt;for &lt;code&gt;CALLF&lt;&#x2F;code&gt; instruction the recorded stack height lower bound must be at least the number of inputs of the called function according to its type defined in the type section,&lt;&#x2F;li&gt;
&lt;li&gt;for &lt;code&gt;RETF&lt;&#x2F;code&gt; instruction both the recorded lower and upper bound must be equal and must be exactly the number of outputs of the function matching the code,&lt;&#x2F;li&gt;
&lt;li&gt;for &lt;code&gt;JUMPF&lt;&#x2F;code&gt; into returning function both the recorded lower and upper bound must equal exactly &lt;code&gt;type[current_section_index].outputs + type[target_section_index].inputs - type[target_section_index].outputs&lt;&#x2F;code&gt;,&lt;&#x2F;li&gt;
&lt;li&gt;for &lt;code&gt;JUMPF&lt;&#x2F;code&gt; into non-returning function the recorded stack height lower bound must be at least the number of inputs of the target function according to its type defined in the type section,&lt;&#x2F;li&gt;
&lt;li&gt;for any other instruction the recorded stack height lower bound must be at least the number of inputs required by instruction,&lt;&#x2F;li&gt;
&lt;li&gt;there is no additional check for terminating instructions other than &lt;code&gt;RETF&lt;&#x2F;code&gt; and &lt;code&gt;JUMPF&lt;&#x2F;code&gt;, this implies that extra items left on stack at instruction ending EVM execution are allowed.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;For &lt;code&gt;CALLF&lt;&#x2F;code&gt; and &lt;code&gt;JUMPF&lt;&#x2F;code&gt; &lt;strong&gt;check&lt;&#x2F;strong&gt; for possible stack overflow: if recorded stack height upper bound is greater than &lt;code&gt;1024 - types[target_section_index].max_stack_increase&lt;&#x2F;code&gt;, validation fails.&lt;&#x2F;li&gt;
&lt;li&gt;Compute new stack height bounds after the instruction execution. Upper and lower bound are updated by the same value:
&lt;ul&gt;
&lt;li&gt;after &lt;code&gt;CALLF&lt;&#x2F;code&gt; stack height bounds are adjusted by adding &lt;code&gt;types[target_section_index].outputs - types[target_section_index].inputs&lt;&#x2F;code&gt;,&lt;&#x2F;li&gt;
&lt;li&gt;after any other non-terminating instruction stack height bounds are adjusted by subtracting the number of instruction inputs and adding the number of instruction outputs,&lt;&#x2F;li&gt;
&lt;li&gt;terminating instructions do not need to update stack height bounds.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Determine the list of successor instructions that can follow the current instructions:
&lt;ol&gt;
&lt;li&gt;The next instruction if the current instruction is not a terminating instruction nor unconditional jump (&lt;code&gt;RJUMP&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;All the current instruction targets if the current instruction is a conditional (&lt;code&gt;RJUMPI&lt;&#x2F;code&gt; or &lt;code&gt;RJUMPV&lt;&#x2F;code&gt;) or unconditional jump (&lt;code&gt;RJUMP&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;For each successor instruction:
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Check&lt;&#x2F;strong&gt; if the instruction is present in the code (i.e. execution must not &quot;fall off&quot; the code).&lt;&#x2F;li&gt;
&lt;li&gt;If the successor is reached via forwards jump or sequential flow from previous instruction:
&lt;ol&gt;
&lt;li&gt;If the instruction does not have stack height bounds recorded (being visited for the first time), record the instruction stack height bound as the value computed in 2.3.&lt;&#x2F;li&gt;
&lt;li&gt;Otherwise, instruction has been already visited (by previously seen forward jump). Update this instruction&#x27;s recorded stack height bounds so that they contain the bounds computed in 2.3, i.e. &lt;code&gt;target_stack_min = min(target_stack_min, current_stack_min)&lt;&#x2F;code&gt; and &lt;code&gt;target_stack_max = max(target_stack_max, current_stack_max)&lt;&#x2F;code&gt;, where &lt;code&gt;(target_stack_min, target_stack_max)&lt;&#x2F;code&gt; are successor bounds and &lt;code&gt;(current_stack_min, current_stack_max)&lt;&#x2F;code&gt; are bounds computed in 2.3.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;If the successor is reached via backwards jump, &lt;strong&gt;check&lt;&#x2F;strong&gt; if the recorded stack height bounds equal the value computed in 2.3. Validation fails if they are not equal, i.e. we see backwards jump to a different stack height.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;After all instructions are visited, determine the function maximum operand stack height increase:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Compute the maximum stack height &lt;code&gt;max_stack_height&lt;&#x2F;code&gt; as the maximum of all recorded stack height upper bounds.&lt;&#x2F;li&gt;
&lt;li&gt;Compute the maximum stack height increase &lt;code&gt;max_stack_increase&lt;&#x2F;code&gt; as &lt;code&gt;max_stack_height - type[current_section_index].inputs&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Check&lt;&#x2F;strong&gt; if the maximum stack height increase &lt;code&gt;max_stack_increase&lt;&#x2F;code&gt; matches the value corresponding code section&#x27;s within the type section: &lt;code&gt;types[current_section_index].max_stack_increase&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;em&gt;Note: Although we check only that &lt;code&gt;max_stack_increase&lt;&#x2F;code&gt; matches the type section definition, which guarantees that it does not exceed 1023 by EOF header definition, it is also guaranteed that &lt;code&gt;max_stack_height&lt;&#x2F;code&gt; does not exceed 1024, because otherwise validation of &lt;code&gt;CALLF&lt;&#x2F;code&gt; and &lt;code&gt;JUMPF&lt;&#x2F;code&gt; into this section would fail at operand stack overflow check. Every section is required to have &lt;code&gt;CALLF&lt;&#x2F;code&gt; or &lt;code&gt;JUMPF&lt;&#x2F;code&gt; targeting it, except 0th section (non-reachable sections are not allowed). 0th section is required to have 0 inputs, which implies &lt;code&gt;max_stack_increase&lt;&#x2F;code&gt; equals &lt;code&gt;max_stack_height&lt;&#x2F;code&gt;.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The computational and space complexity of this pass is &lt;em&gt;O(len(code))&lt;&#x2F;em&gt;. Each instruction is visited at most once.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;execution&quot;&gt;Execution&lt;&#x2F;h3&gt;
&lt;p&gt;Given the deploy-time validation guarantees, an EVM implementation is not required anymore to have run-time stack underflow nor overflow checks for each executed instruction. The exception is the &lt;code&gt;CALLF&lt;&#x2F;code&gt; and &lt;code&gt;JUMPF&lt;&#x2F;code&gt; performing operand stack overflow check for the entire called function.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;properties-of-validated-code&quot;&gt;Properties of validated code&lt;&#x2F;h3&gt;
&lt;p&gt;Any code section validated according to operand stack validation has the following properties:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;There are no unreachable instructions&lt;&#x2F;li&gt;
&lt;li&gt;There are no instructions reachable only via backwards jump&lt;&#x2F;li&gt;
&lt;li&gt;Operand stack underflow cannot happen.&lt;&#x2F;li&gt;
&lt;li&gt;Operand stack overflow can only happen at &lt;code&gt;CALLF&lt;&#x2F;code&gt; or &lt;code&gt;JUMPF&lt;&#x2F;code&gt; instruction.&lt;&#x2F;li&gt;
&lt;li&gt;Multiple forward jump instructions executing at different stack heights may target the same instruction; the stack of target basic block is validated for all possible heights.&lt;&#x2F;li&gt;
&lt;li&gt;Any backwards jump instruction can only target an instruction that is executed with equal stack height; this prevents deployment of the loops with unbounded stack pushing or popping.&lt;&#x2F;li&gt;
&lt;li&gt;Final instruction in the code section is either terminating instruction or &lt;code&gt;RJUMP&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;stack-overflow-check-only-in-callf-jumpf&quot;&gt;Stack overflow check only in CALLF&#x2F;JUMPF&lt;&#x2F;h3&gt;
&lt;p&gt;In this EIP, we provide a more efficient variant of the EVM where stack overflow check is performed only in &lt;code&gt;CALLF&lt;&#x2F;code&gt; and &lt;code&gt;JUMPF&lt;&#x2F;code&gt; instructions using the called function&#x27;s &lt;code&gt;max_stack_height&lt;&#x2F;code&gt; information. This decreases flexibility of an EVM program because &lt;code&gt;max_stack_height&lt;&#x2F;code&gt; corresponds to the worst-case control-flow path in the function.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;unreachable-code&quot;&gt;Unreachable code&lt;&#x2F;h3&gt;
&lt;p&gt;The operand stack validation algorithm rejects any code having any unreachable instructions. This check can be performed very cheaply. It prevents deploying degenerated code. Moreover, it enables combining instruction validation and operand stack validation into single pass.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;clean-stack-upon-termination&quot;&gt;Clean stack upon termination&lt;&#x2F;h3&gt;
&lt;p&gt;It is currently required that the operand stack is empty (in the current function context) after the &lt;code&gt;RETF&lt;&#x2F;code&gt; instruction.
Otherwise, the &lt;code&gt;RETF&lt;&#x2F;code&gt; semantic would be more complicated. For &lt;code&gt;n&lt;&#x2F;code&gt; function outputs and &lt;code&gt;s&lt;&#x2F;code&gt; the stack height at &lt;code&gt;RETF&lt;&#x2F;code&gt; the EVM would have to erase &lt;code&gt;s-n&lt;&#x2F;code&gt; non-top stack items and move the &lt;code&gt;n&lt;&#x2F;code&gt; stack items to the place of erased ones. Cost of such operation may be relatively cheap but is not constant.
However, lifting the requirement and modifying the &lt;code&gt;RETF&lt;&#x2F;code&gt; semantic as described above is backward
compatible and can be easily introduced in the future.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;more-restrictive-stack-validation&quot;&gt;More restrictive stack validation&lt;&#x2F;h3&gt;
&lt;p&gt;Originally another variant of stack validation was proposed, where instead of linear scan of the code section, all code paths were examined by following the target(s) of every jump instruction in a breadth-first-search manner, tracking stack height for each visited instruction and checking that for every possible code path to a particular instruction its stack height remains constant.&lt;&#x2F;p&gt;
&lt;p&gt;The advantage of this variant would be somewhat simpler algorithm (we would not need to track stack height bounds, but only a single stack height value for each instruction) and no extra requirement for ordering of code basic blocks (see below).&lt;&#x2F;p&gt;
&lt;p&gt;However, compiler teams opposed to such restrictive stack height requirements. One prominent pattern used by compilers which wouldn&#x27;t be possible is jumping to terminating helpers (code blocks ending with &lt;code&gt;RETURN&lt;&#x2F;code&gt; or &lt;code&gt;REVERT&lt;&#x2F;code&gt;) from different stack heights. This is common for example for a series of &lt;code&gt;assert&lt;&#x2F;code&gt; statements, each one compiled to a &lt;code&gt;RJUMPI&lt;&#x2F;code&gt; into a shared terminating helper. Enforcing constant stack requirement would mean that before jumping to such helper, extra items on the stack have to be popped, and this noticeably increases code size and consumed gas, and would defeat the purpose of extracting these common terminating sequences into a helper.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;ordering-of-basic-blocks&quot;&gt;Ordering of basic blocks&lt;&#x2F;h3&gt;
&lt;p&gt;The prerequisite to stack validation algorithm is ordering of code basic blocks in a way that no block is referenced only by backwards jump.&lt;&#x2F;p&gt;
&lt;p&gt;This is required to make it possible to examine each instruction in one linear pass over the code section. Forward pass over the code section allows for the algorithm to &quot;expand&quot; each forward jump target&#x27;s stack height bounds and still keep the complexity linear. Trying to do jump target stack bounds expansion while scanning the code in the breadth-first-search manner would require to re-examine entire code path after its stack height bounds are expanded, which would result in quadratic complexity.&lt;&#x2F;p&gt;
&lt;p&gt;This requirement is not unique to EOF but also present is some low-level IRs like SPIR-V and LLVM MIR.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change requires a &quot;network upgrade,&quot; since it modifies consensus rules.&lt;&#x2F;p&gt;
&lt;p&gt;It poses no risk to backwards compatibility, as it is introduced only for EOF1 contracts, for which deploying undefined instructions is not allowed, therefore there are no existing contracts using these instructions. The new instructions are not introduced for legacy bytecode (code which is not EOF formatted).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;As mentioned above, the proposed validation algorithm has linear computational and space complexity and its cost is covered by the transaction data costs &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2028&#x2F;&quot;&gt;EIP-2028&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Endorsement - Permit for Any Functions</title>
        <published>2022-08-12T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Zainan Victor Zhou</name><uri>https://github.com/xinbenlv</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5453/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-5453-endorsement-standard/10355" />
        

        <id>https://wg-eips.ritovision.com/5453/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="last-call"
                label="Last Call" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:5453"
            label="ERC-5453" />
        

        
        

        
        <summary type="html">A general protocol for approving function calls in the same transaction rely on ERC-5750.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5453/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP establish a general protocol for permitting approving function calls in the same transaction rely on &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5750&#x2F;&quot;&gt;ERC-5750&lt;&#x2F;a&gt;.
Unlike a few prior art (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2612&#x2F;&quot;&gt;ERC-2612&lt;&#x2F;a&gt; for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;, &lt;code&gt;ERC-4494&lt;&#x2F;code&gt; for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; that
usually only permit for a single behavior (&lt;code&gt;transfer&lt;&#x2F;code&gt; for ERC-20 and &lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt; for ERC-721) and a single approver in two transactions (first a &lt;code&gt;permit(...)&lt;&#x2F;code&gt; TX, then a &lt;code&gt;transfer&lt;&#x2F;code&gt;-like TX), this EIP provides a way to permit arbitrary behaviors and aggregating multiple approvals from arbitrary number of approvers in the same transaction, allowing for Multi-Sig or Threshold Signing behavior.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;Support permit(approval) alongside a function call.&lt;&#x2F;li&gt;
&lt;li&gt;Support a second approval from another user.&lt;&#x2F;li&gt;
&lt;li&gt;Support pay-for-by another user&lt;&#x2F;li&gt;
&lt;li&gt;Support multi-sig&lt;&#x2F;li&gt;
&lt;li&gt;Support persons acting in concert by endorsements&lt;&#x2F;li&gt;
&lt;li&gt;Support accumulated voting&lt;&#x2F;li&gt;
&lt;li&gt;Support off-line signatures&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;interfaces&quot;&gt;Interfaces&lt;&#x2F;h3&gt;
&lt;p&gt;The interfaces and structure referenced here are as followed&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.9&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ValidityBound&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; functionParamStructHash&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; validSince&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; validBy&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SingleEndorsementData&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; endorserAddress&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span&gt; sig&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; dynamic = 65&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; GeneralExtensionDataStruct&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; erc5453MagicWord&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; erc5453Type&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; validSince&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; validBy&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span&gt; endorsementPayload&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5453EndorsementCore&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; eip5453Nonce&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; endorser&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isEligibleEndorser&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; endorser&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5453EndorsementDigest&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; computeValidityDigest&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _functionParamStructHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _validSince&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _validBy&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; computeFunctionParamHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _functionName&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _functionParamPacked&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5453EndorsementDataTypeA&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; computeExtensionDataTypeA&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; validSince&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; validBy&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; endorserAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sig&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5453EndorsementDataTypeB&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; computeExtensionDataTypeB&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; validSince&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; validBy&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; endorserAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sigs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5453&#x2F;.&#x2F;assets&#x2F;IERC5453.sol&quot;&gt;&lt;code&gt;IERC5453.sol&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;behavior-specification&quot;&gt;Behavior specification&lt;&#x2F;h3&gt;
&lt;p&gt;As specified in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5750&#x2F;&quot;&gt;ERC-5750 General Extensibility for Method Behaviors&lt;&#x2F;a&gt;, any compliant method that has an &lt;code&gt;bytes extraData&lt;&#x2F;code&gt; as its
last method designated for extending behaviors can conform to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5453&#x2F;&quot;&gt;ERC-5453&lt;&#x2F;a&gt; as the way to indicate a permit from certain user.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Any compliant method of this EIP MUST be a &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5750&#x2F;&quot;&gt;ERC-5750&lt;&#x2F;a&gt; compliant method.&lt;&#x2F;li&gt;
&lt;li&gt;Caller MUST pass in the last parameter &lt;code&gt;bytes extraData&lt;&#x2F;code&gt; conforming a solidity memory encoded layout bytes of &lt;code&gt;GeneralExtensionDataStruct&lt;&#x2F;code&gt; specified in &lt;em&gt;Section Interfaces&lt;&#x2F;em&gt;. The following descriptions are based on when decoding &lt;code&gt;bytes extraData&lt;&#x2F;code&gt; into a &lt;code&gt;GeneralExtensionDataStruct&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;In the &lt;code&gt;GeneralExtensionDataStruct&lt;&#x2F;code&gt;-decoded &lt;code&gt;extraData&lt;&#x2F;code&gt;, caller MUST set the value of &lt;code&gt;GeneralExtensionDataStruct.erc5453MagicWord&lt;&#x2F;code&gt; to be the &lt;code&gt;keccak256(&quot;ERC5453-ENDORSEMENT&quot;)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Caller MUST set the value of &lt;code&gt;GeneralExtensionDataStruct.erc5453Type&lt;&#x2F;code&gt; to be one of the supported values.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; ERC5453_TYPE_A &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; ERC5453_TYPE_B &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ol start=&quot;5&quot;&gt;
&lt;li&gt;
&lt;p&gt;When the value of &lt;code&gt;GeneralExtensionDataStruct.erc5453Type&lt;&#x2F;code&gt; is set to be &lt;code&gt;ERC5453_TYPE_A&lt;&#x2F;code&gt;, &lt;code&gt;GeneralExtensionDataStruct.endorsementPayload&lt;&#x2F;code&gt; MUST be abi encoded bytes of a &lt;code&gt;SingleEndorsementData&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;When the value of &lt;code&gt;GeneralExtensionDataStruct.erc5453Type&lt;&#x2F;code&gt; is set to be &lt;code&gt;ERC5453_TYPE_B&lt;&#x2F;code&gt;, &lt;code&gt;GeneralExtensionDataStruct.endorsementPayload&lt;&#x2F;code&gt; MUST be abi encoded bytes of &lt;code&gt;SingleEndorsementData[]&lt;&#x2F;code&gt; (a dynamic array).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Each &lt;code&gt;SingleEndorsementData&lt;&#x2F;code&gt; MUST have a &lt;code&gt;address endorserAddress;&lt;&#x2F;code&gt; and a 65-bytes &lt;code&gt;bytes sig&lt;&#x2F;code&gt; signature.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Each &lt;code&gt;bytes sig&lt;&#x2F;code&gt; MUST be an ECDSA (secp256k1) signature using private key of signer whose corresponding address is &lt;code&gt;endorserAddress&lt;&#x2F;code&gt; signing &lt;code&gt;validityDigest&lt;&#x2F;code&gt; which is the a hashTypeDataV4 of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; of hashStruct of &lt;code&gt;ValidityBound&lt;&#x2F;code&gt; data structure as followed:&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt; validityDigest &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    eip712HashTypedDataV4&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;                    &amp;quot;ValidityBound(bytes32 functionParamStructHash,uint256 validSince,uint256 validBy,uint256 nonce)&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                )&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                functionParamStructHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                _validSince&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                _validBy&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                _nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ol start=&quot;9&quot;&gt;
&lt;li&gt;The &lt;code&gt;functionParamStructHash&lt;&#x2F;code&gt; MUST be computed as followed&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; functionParamStructHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_functionStructure&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                _functionParamPacked&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; functionParamStructHash&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;whereas&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;_functionStructure&lt;&#x2F;code&gt; MUST be computed as &lt;code&gt;function methodName(type1 param1, type2 param2, ...)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;_functionParamPacked&lt;&#x2F;code&gt; MUST be computed as &lt;code&gt;enc(param1) || enco(param2) ...&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;ol start=&quot;10&quot;&gt;
&lt;li&gt;
&lt;p&gt;Upon validating that &lt;code&gt;endorserAddress == ecrecover(validityDigest, signature)&lt;&#x2F;code&gt; or &lt;code&gt;EIP1271(endorserAddress).isValidSignature(validityDigest, signature) == ERC1271.MAGICVALUE&lt;&#x2F;code&gt;, the single endorsement MUST be deemed valid.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Compliant method MAY choose to impose a threshold for a number of endorsements needs to be valid in the same &lt;code&gt;ERC5453_TYPE_B&lt;&#x2F;code&gt; kind of &lt;code&gt;endorsementPayload&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;validSince&lt;&#x2F;code&gt; and &lt;code&gt;validBy&lt;&#x2F;code&gt; are both inclusive. Implementer MAY choose to use blocknumber or timestamp. Implementor SHOULD find away to indicate whether &lt;code&gt;validSince&lt;&#x2F;code&gt; and &lt;code&gt;validBy&lt;&#x2F;code&gt; is blocknumber or timestamp.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;We chose to have both &lt;code&gt;ERC5453_TYPE_A&lt;&#x2F;code&gt;(single-endorsement) and &lt;code&gt;ERC5453_TYPE_B&lt;&#x2F;code&gt;(multiple-endorsements, same nonce for entire contract) so we
could balance a wider range of use cases. E.g. the same use cases of ERC-2612 and &lt;code&gt;ERC-4494&lt;&#x2F;code&gt; can be supported by &lt;code&gt;ERC5453_TYPE_A&lt;&#x2F;code&gt;. And threshold approvals can be done via &lt;code&gt;ERC5453_TYPE_B&lt;&#x2F;code&gt;. More complicated approval types can also be extended by defining new &lt;code&gt;ERC5453_TYPE_?&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;We chose to include both &lt;code&gt;validSince&lt;&#x2F;code&gt; and &lt;code&gt;validBy&lt;&#x2F;code&gt; to allow maximum flexibility in expiration. This can be also be supported by EVM natively at if adopted &lt;code&gt;ERC-5081&lt;&#x2F;code&gt; but &lt;code&gt;ERC-5081&lt;&#x2F;code&gt; will not be adopted anytime soon, we choose to add these two numbers in our protocol to allow
smart contract level support.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The design assumes a &lt;code&gt;bytes calldata extraData&lt;&#x2F;code&gt; to maximize the flexibility of future extensions. This assumption is compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; and many other ERC-track EIPs. Those that aren&#x27;t, such as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;, can also be updated to support it, such as using a wrapper contract or proxy upgrade.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;In addition to the specified algorithm for validating endorser signatures, we also present the following reference implementations.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.9&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;utils&#x2F;cryptography&#x2F;SignatureChecker.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;utils&#x2F;cryptography&#x2F;EIP712.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERC5453.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;abstract&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AERC5453Endorsible&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EIP712&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    IERC5453EndorsementCore&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC5453EndorsementDigest&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC5453EndorsementDataTypeA&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC5453EndorsementDataTypeB&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _validate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; msgDigest&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        SingleEndorsementData&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; endersement&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            endersement&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sig&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 65&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;AERC5453Endorsible: wrong signature length&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            SignatureChecker&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isValidSignatureNow&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                endersement&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;endorserAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                msgDigest&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                endersement&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sig&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;AERC5453Endorsible: invalid signature&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    modifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyEndorsed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _functionParamStructHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _extensionData&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_isEndorsed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_functionParamStructHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _extensionData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        _&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; computeExtensionDataTypeB&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; validSince&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; validBy&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; endorserAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sigs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;endorserAddress&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; sigs&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        SingleEndorsementData&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            memory&lt;&#x2F;span&gt;&lt;span&gt; endorsements &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span&gt; SingleEndorsementData&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                endorserAddress&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; endorserAddress&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            endorsements&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SingleEndorsementData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                endorserAddress&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                sigs&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;                GeneralExtensionDataStruct&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    MAGIC_WORLD&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    ERC5453_TYPE_B&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    validSince&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    validBy&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;                    abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;endorsements&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5453&#x2F;.&#x2F;assets&#x2F;AERC5453.sol&quot;&gt;&lt;code&gt;AERC5453.sol&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;reference-implementation-of-endorsableerc721&quot;&gt;Reference Implementation of &lt;code&gt;EndorsableERC721&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Here is a reference implementation of &lt;code&gt;EndorsableERC721&lt;&#x2F;code&gt; that achieves similar behavior of &lt;code&gt;ERC-4494&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.9&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EndorsableERC721&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;AERC5453Endorsible&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _extraData&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        onlyEndorsed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            _computeFunctionParamHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;                abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            _extraData&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5453&#x2F;.&#x2F;assets&#x2F;EndorsableERC721.sol&quot;&gt;&lt;code&gt;EndorsableERC721.sol&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;reference-implementation-of-thresholdmultisigforwarder&quot;&gt;Reference Implementation of &lt;code&gt;ThresholdMultiSigForwarder&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Here is a reference implementation of ThresholdMultiSigForwarder that achieves similar behavior of multi-sig threshold approval
remote contract call like a Gnosis-Safe wallet.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.9&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ThresholdMultiSigForwarder&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AERC5453Endorsible&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; forward&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _dest&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _gasLimit&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _calldata&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _extraData&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        onlyEndorsed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            _computeFunctionParamHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; forward&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _dest&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _gasLimit&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _calldata&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;                abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_dest&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _gasLimit&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_calldata&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            _extraData&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; errorMessage &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Fail to call remote contract&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt; success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; returndata&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; _dest&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;call&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            _calldata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        Address&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;verifyCallResult&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; returndata&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; errorMessage&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5453&#x2F;.&#x2F;assets&#x2F;ThresholdMultiSigForwarder.sol&quot;&gt;&lt;code&gt;ThresholdMultiSigForwarder.sol&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;replay-attacks&quot;&gt;Replay Attacks&lt;&#x2F;h3&gt;
&lt;p&gt;A replay attack is a type of attack on cryptography authentication. In a narrow sense, it usually refers to a type of attack that circumvents the cryptographically signature verification by reusing an existing signature for a message being signed again. Any implementations relying on this EIP must realize that all smart endorsements described here are cryptographic signatures that are &lt;em&gt;public&lt;&#x2F;em&gt; and can be obtained by anyone. They must foresee the possibility of a replay of the transactions not only at the exact deployment of the same smart contract, but also other deployments of similar smart contracts, or of a version of the same contract on another &lt;code&gt;chainId&lt;&#x2F;code&gt;, or any other similar attack surfaces. The &lt;code&gt;nonce&lt;&#x2F;code&gt;, &lt;code&gt;validSince&lt;&#x2F;code&gt;, and &lt;code&gt;validBy&lt;&#x2F;code&gt; fields are meant to restrict the surface of attack but might not fully eliminate the risk of all such attacks, e.g. see the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5453&#x2F;#phishing&quot;&gt;Phishing&lt;&#x2F;a&gt; section.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;phishing&quot;&gt;Phishing&lt;&#x2F;h3&gt;
&lt;p&gt;It&#x27;s worth pointing out a special form of replay attack by phishing. An adversary can design another smart contract in a way that the user be tricked into signing a smart endorsement for a seemingly legitimate purpose, but the data-to-designed matches the target application&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Referable NFT</title>
        <published>2022-08-10T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Saber Yu</name><uri>https://github.com/OniReimu</uri>
	</author>
	
	<author>
		<name>Qin Wang</name><email>qin.wang@data61.csiro.au</email>
	</author>
	
	<author>
		<name>Shange Fu</name><email>shange.fu@monash.edu</email>
	</author>
	
	<author>
		<name>Yilin Sai</name><email>yilin.sai@data61.csiro.au</email>
	</author>
	
	<author>
		<name>Shiping Chen</name><email>shiping.chen@data61.csiro.au</email>
	</author>
	
	<author>
		<name>Sherry Xu</name><email>xiwei.xu@data61.csiro.au</email>
	</author>
	
	<author>
		<name>Jiangshan Yu</name><email>jiangshan.yu@monash.edu</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5521/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-x-erc-721-referable-nft/10310" />
        

        <id>https://wg-eips.ritovision.com/5521/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:5521"
            label="ERC-5521" />
        

        
        

        
        <summary type="html">An ERC-721 extension to construct reference relationships among NFTs</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5521/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is an extension of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;. It proposes two referable indicators, referring and referred, and a time-based indicator &lt;code&gt;createdTimestamp&lt;&#x2F;code&gt;. The relationship between each NFT forms a directed acyclic graph (DAG). The standard allows users to query, track and analyze their relationships.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5521&#x2F;.&#x2F;assets&#x2F;system-arch.png&quot; alt=&quot;System Architecture&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Many scenarios require the inheritance, reference, and extension of NFTs. For instance, an artist may develop his NFT work based on a previous NFT, or a DJ may remix his record by referring to two pop songs, etc. A gap in existing NFT standards is the absence of established relationships between an NFT and its original creator. This void isolates NFTs, rendering the sale of each one a one-off transaction, thereby obstructing creators from accruing the full value of their intellectual property over time.&lt;&#x2F;p&gt;
&lt;p&gt;In this sense, proposing a referable solution for existing NFTs that enables efficient queries on cross-references is necessary. By introducing a reference relationship between NFTs, a sustainable economic model can be established to incentivize continued engagement in creating, using, and promoting NFTs.&lt;&#x2F;p&gt;
&lt;p&gt;This standard accordingly introduces a new concept, referable NFT (rNFT), which can transform static NFTs into a dynamically extensible network. We embed reference information, including &lt;code&gt;referring&lt;&#x2F;code&gt; and &lt;code&gt;referred&lt;&#x2F;code&gt; relationships, aiding in the formation of a Direct Acyclic Graph (DAG)-based NFT network. This structure provides a transparent graphical historical record and allows users to query, trace, and analyze relationships. It can enable NFT creators to build upon existing works without the need to start anew.&lt;&#x2F;p&gt;
&lt;p&gt;An intuitive example: users can create new NFTs (C, D, E) by referencing existing ones (A, B), while the &lt;code&gt;referred&lt;&#x2F;code&gt; function informs the original NFTs (A, B) about their citations (e.g., A ← D; C ← E; B ← E, and A ← E). Here, the &lt;code&gt;createdTimestamp&lt;&#x2F;code&gt; (block-level) serves as an indicator for the creation time of NFTs (A, B, C, D, E).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;key-takeaways&quot;&gt;Key Takeaways&lt;&#x2F;h3&gt;
&lt;p&gt;This standard provides several advantages:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Clear ownership inheritance&lt;&#x2F;em&gt;: This standard extends the static NFT into a virtually extensible NFT network. Artists do not have to create work isolated from others. The ownership inheritance avoids reinventing the same wheel.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Incentive Compatibility&lt;&#x2F;em&gt;: This standard clarifies the referable relationship across different NFTs, helping to integrate multiple up-layer incentive models for both original NFT owners and new creators.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Easy Integration&lt;&#x2F;em&gt;: This standard makes it easier for the existing token standards or third-party protocols. For instance, the rNFT can be applied to rentable scenarios (cf. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5006&#x2F;&quot;&gt;ERC-5006&lt;&#x2F;a&gt; to build a hierarchical rental market, where multiple users can rent the same NFT during the same time or one user can rent multiple NFTs during the same duration).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Scalable Interoperability&lt;&#x2F;em&gt;: This standard enables cross-contract references, giving a scalable adoption for the broader public with stronger interoperability.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;UpdateNode&lt;&#x2F;code&gt;: event emitted when &lt;code&gt;setNode&lt;&#x2F;code&gt; is invoked;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;safeMint&lt;&#x2F;code&gt;: mint a new rNFT;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;setNode&lt;&#x2F;code&gt;: set the referring list of an rNFT and update the referred list of each one in the referring list;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;setNodeReferring&lt;&#x2F;code&gt;: set the referring list of an rNFT;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;setNodeReferred&lt;&#x2F;code&gt;: set the referred list of the given rNFTs sourced from different contracts;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;setNodeReferredExternal&lt;&#x2F;code&gt;: set the referred list of the given rNFTs sourced from external contracts;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;referringOf&lt;&#x2F;code&gt;: get the referring list of an rNFT;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;referredOf&lt;&#x2F;code&gt;: get the referred list of an rNFT;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;createdTimestampOf&lt;&#x2F;code&gt;: get the timestamp of an rNFT when it is being created.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Implementers of this standard &lt;strong&gt;MUST&lt;&#x2F;strong&gt; have all of the following functions:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.4&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;utils&#x2F;introspection&#x2F;IERC165.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC_5521&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC165&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Logged when a node in the rNFT gets referred and &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when the `node` (i.e., an rNFT) is &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UpdateNode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                     address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                     address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _address_referringList&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                     uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokenIds_referringList&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                     address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _address_referredList&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                     uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokenIds_referredList&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; set the referred list of an rNFT associated with different contract addresses and update the referring list of each one in the referred list. Checking the duplication of `addresses` and `tokenIds` is **RECOMMENDED**.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `tokenId` of rNFT being set. `addresses` of the contracts in which rNFTs with `tokenIds` being referred accordingly. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @requirement &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - the size of `addresses` **MUST** be the same as that of `tokenIds`;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - once the size of `tokenIds` is non-zero, the inner size **MUST** also be non-zero;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - the `tokenId` **MUST** be unique within the same contract;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - the `tokenId` **MUST NOT** be the same as `tokenIds[i][j]` if `addresses[i]` is essentially `address(this)`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setNode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; addresses&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; get the referring list of an rNFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `tokenId` of the rNFT being focused, `_address` of contract address associated with the focused rNFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; referring mapping of the rNFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; referringOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; get the referred list of an rNFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `tokenId` of the rNFT being focused, `_address` of contract address associated with the focused rNFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; referred mapping of the rNFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; referredOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; get the timestamp of an rNFT when is being created.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `tokenId` of the rNFT being focused, `_address` of contract address associated with the focused rNFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; timestamp of the rNFT when is being created with uint256 format.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; createdTimestampOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; check supported interfaces, adhereing to ERC165.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TargetContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC165&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; set the referred list of an rNFT associated with external contract addresses. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `_tokenIds` of rNFTs associated with the contract address `_address` being referred by the rNFT with `tokenId`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @requirement&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - `_address` **MUST NOT** be the same as `address(this)` where `this` is executed by an external contract where `TargetContract` interface is implemented.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setNodeReferredExternal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenIds&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; referringOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; referredOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; createdTimestampOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;is-this-event-informative-enough&quot;&gt;Is this event informative enough?&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;UpdateNode&lt;&#x2F;code&gt;: This event disseminates crucial information, including the rNFT ID, its owner, and lists of contract addresses&#x2F;IDs with rNFTs referring to or referred by the subject rNFT. This data set enables stakeholders to efficiently manage and navigate the complex web of relationships inherent in the rNFT ecosystem.&lt;&#x2F;p&gt;
&lt;p&gt;Implementers are free to choose to use a struct (a recommended struct is given in the Reference Implementation), or several separate mappings, or whatever other storage mechanism. Whichever mechanism chosen has no observable effect on the behaviour of the contract, as long as its output can fulfill the &lt;code&gt;UpdateNode&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-createdtimestampof&quot;&gt;Why &lt;code&gt;createdTimestampOf&lt;&#x2F;code&gt;?&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;createdTimestamp&lt;&#x2F;code&gt;: A key principle of this standard is that an rNFT should reference content already accepted by the community (a time-based sequence known by participants). Global timestamps for rNFTs are thus essential, serving to prevent conflicting states (akin to concurrency issues in transaction processing and block organization). We define a block-level timestamp where &lt;code&gt;createdTimestamp = block.timestamp&lt;&#x2F;code&gt; Note that, given that the granularity of references is tied to the block timestamp, it is impractical to discern the order of two rNFTs within the same block.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;how-is-cross-contract-reference-performed&quot;&gt;How is cross-contract reference performed?&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;setNodeReferredExternal&lt;&#x2F;code&gt;: This function operates conditionally, dependent on successful interface verification in external contracts. Such selective invocation ensures backward compatibility and integration with existing contracts, provided they adhere to specified interfaces.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This standard can be fully &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; compatible by adding an extension function set.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases are included in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5521&#x2F;.&#x2F;assets&#x2F;ERC_5521.test.js&quot;&gt;ERC_5521.test.js&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The recommended implementation is demonstrated as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Relationship&lt;&#x2F;code&gt;: a structure that contains &lt;code&gt;referring&lt;&#x2F;code&gt;, &lt;code&gt;referred&lt;&#x2F;code&gt;, &lt;code&gt;referringKeys&lt;&#x2F;code&gt;, &lt;code&gt;referredKeys&lt;&#x2F;code&gt;, &lt;code&gt;createdTimestamp&lt;&#x2F;code&gt;, and other customized and optional attributes (i.e., not necessarily included in the standard) such as &lt;code&gt;privityOfAgreement&lt;&#x2F;code&gt; recording the ownerships of referred NFTs at the time the Referable NFTs (rNFTs) were being created or &lt;code&gt;profitSharing&lt;&#x2F;code&gt; recording the profit sharing of &lt;code&gt;referring&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;referring&lt;&#x2F;code&gt;: an out-degree indicator, used to show the users this NFT refers to;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;referred&lt;&#x2F;code&gt;: an in-degree indicator, used to show the users who have refereed this NFT;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;referringKeys&lt;&#x2F;code&gt;: a helper for mapping conversion of out-degree indicators, used for events;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;referredKeys&lt;&#x2F;code&gt;: a helper for mapping conversion of in-degree indicators, used for events;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;createdTimestamp&lt;&#x2F;code&gt;: a time-based indicator, used to compare the timestamp of mint, which should not be editable anyhow by callers.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;referringOf&lt;&#x2F;code&gt; and &lt;code&gt;referredOf&lt;&#x2F;code&gt;: First, the current &lt;code&gt;referringOf&lt;&#x2F;code&gt; and &lt;code&gt;referredOf&lt;&#x2F;code&gt; allow cross-contract looking up, while this cannot be done by directly accessing &lt;code&gt;_relationship&lt;&#x2F;code&gt;. Secondly, only if privacy is not a concern, making &lt;code&gt;_relationship&lt;&#x2F;code&gt; public simplifies the contract by relying on Solidity’s automatically generated getters. However, if you need to control the visibility of the data, keeping the state variable private and providing specific getter functions would be the best approach.  For example, if &lt;code&gt;_relationship&lt;&#x2F;code&gt; includes details about specific users’ interactions or transactions or some private extensible parameters (in the updated version, we specifically highlight the &lt;code&gt;Relationship&lt;&#x2F;code&gt; can be extended to meet different requirements), always making this data public could reveal users’ behavior patterns or preferences, leading to potential privacy breaches.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;convertMap&lt;&#x2F;code&gt;: This function is essential for retrieving the full mapping contents within a struct. Even if &lt;code&gt;_relationship&lt;&#x2F;code&gt; is public, The getters only allow retrieval of individual values for specific keys. Since we need comprehensive access to all stored addresses, &lt;code&gt;convertMap&lt;&#x2F;code&gt; is necessary to fulfill our event emission requirements.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.4&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC721&#x2F;ERC721.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERC_5521.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC_5521&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC_5521&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;TargetContract&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Relationship&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        mapping&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; referring&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        mapping&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; referred&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; referringKeys&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; referredKeys&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; createdTimestamp&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; unix timestamp when the rNFT is being created&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; extensible parameters&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Relationship&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; _relationship&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; contractOwner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; symbol_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;name_, symbol_) &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        contractOwner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeMint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; addresses&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenIds&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; require(msg.sender == contractOwner, &amp;quot;ERC_rNFT: Only contract owner can mint&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _safeMint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        setNode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; addresses&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _tokenIds&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; set the referred list of an rNFT associated with different contract addresses and update the referring list of each one in the referred list&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of rNFTs, recommended to check duplication at the caller&amp;#39;s end&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setNode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; addresses&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            addresses&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;Addresses and TokenID arrays must have the same length&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;tokenIds&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; revert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;ERC_5521: the referring list cannot be empty&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        setNodeReferring&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addresses&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        setNodeReferred&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addresses&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; set the referring list of an rNFT associated with different contract addresses &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of rNFTs associated with addresses, recommended to check duplication at the caller&amp;#39;s end&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setNodeReferring&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; addresses&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenIds&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_isApprovedOrOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC_5521: transfer caller is not owner nor approved&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        Relationship &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;storage&lt;&#x2F;span&gt;&lt;span&gt; relationship &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _relationship&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; addresses&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;relationship&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;referring&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;addresses&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt; relationship&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;referringKeys&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;push&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addresses&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Add the address if it&amp;#39;s a new entry&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            relationship&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;referring&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;addresses&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; _tokenIds&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        relationship&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;createdTimestamp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        emitEvents&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; set the referred list of an rNFT associated with different contract addresses &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of rNFTs associated with addresses, recommended to check duplication at the caller&amp;#39;s end&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setNodeReferred&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; addresses&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenIds&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; addresses&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;addresses&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt; j &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; j &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; _tokenIds&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; j&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    Relationship &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;storage&lt;&#x2F;span&gt;&lt;span&gt; relationship &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _relationship&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_tokenIds&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;j&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;relationship&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;referred&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;addresses&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt; relationship&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;referredKeys&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;push&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addresses&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Add the address if it&amp;#39;s a new entry&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span&gt; _tokenIds&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;j&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC_5521: self-reference not allowed&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;relationship&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;createdTimestamp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; revert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;ERC_5521: the referred rNFT needs to be a predecessor&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Make sure the reference complies with the timing sequence&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    relationship&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;referred&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;push&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;                    emitEvents&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_tokenIds&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;j&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_tokenIds&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;j&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                TargetContract targetContractInstance &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TargetContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addresses&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                bool&lt;&#x2F;span&gt;&lt;span&gt; isSupports &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; targetContractInstance&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;TargetContract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;isSupports&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;                    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The target contract supports the interface, safe to call functions of the interface.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    targetContractInstance&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;setNodeReferredExternal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _tokenIds&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; set the referred list of an rNFT associated with different contract addresses &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenIds&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of rNFTs associated with addresses, recommended to check duplication at the caller&amp;#39;s end&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setNodeReferredExternal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenIds&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; _tokenIds&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            Relationship &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;storage&lt;&#x2F;span&gt;&lt;span&gt; relationship &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _relationship&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_tokenIds&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;relationship&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;referred&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_address&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt; relationship&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;referredKeys&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;push&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Add the address if it&amp;#39;s a new entry&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_address &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC_5521: this must be an external contract address&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;relationship&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;createdTimestamp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; revert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;ERC_5521: the referred rNFT needs to be a predecessor&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Make sure the reference complies with the timing sequence&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            relationship&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;referred&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_address&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;push&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            emitEvents&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_tokenIds&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_tokenIds&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the referring list of an rNFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The considered rNFT, _address The corresponding contract address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; referring mapping of an rNFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; referringOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC_5521&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TargetContract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; _referringKeys&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; _referringValues&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;_address &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_exists&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC_5521: token ID not existed&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            (&lt;&#x2F;span&gt;&lt;span&gt;_referringKeys&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _referringValues&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; convertMap&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            TargetContract targetContractInstance &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TargetContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;targetContractInstance&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;TargetContract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC_5521: target contract not supported&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            (&lt;&#x2F;span&gt;&lt;span&gt;_referringKeys&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _referringValues&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; targetContractInstance&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;referringOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;     &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;      &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;_referringKeys&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _referringValues&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the referred list of an rNFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The considered rNFT, _address The corresponding contract address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; referred mapping of an rNFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; referredOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC_5521&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TargetContract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; _referredKeys&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; _referredValues&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;_address &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_exists&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC_5521: token ID not existed&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            (&lt;&#x2F;span&gt;&lt;span&gt;_referredKeys&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _referredValues&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; convertMap&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            TargetContract targetContractInstance &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TargetContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;targetContractInstance&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;TargetContract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC_5521: target contract not supported&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            (&lt;&#x2F;span&gt;&lt;span&gt;_referredKeys&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _referredValues&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; targetContractInstance&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;referredOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;           &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;_referredKeys&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _referredValues&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the timestamp of an rNFT when is being created.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `tokenId` of the rNFT being focused, `_address` of contract address associated with the focused rNFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; timestamp of the rNFT when is being created with uint256 format.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; createdTimestampOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; createdTimestamp&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;_address &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_exists&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC_5521: token ID not existed&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            Relationship &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;storage&lt;&#x2F;span&gt;&lt;span&gt; relationship &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _relationship&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            createdTimestamp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; relationship&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;createdTimestamp&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            TargetContract targetContractInstance &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TargetContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;targetContractInstance&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;TargetContract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC_5521: target contract not supported&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            createdTimestamp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; targetContractInstance&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;createdTimestampOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;            &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; createdTimestamp&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See {IERC165-supportsInterface}.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC721&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC_5521&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TargetContract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;IERC_5521&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;interfaceId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            ||&lt;&#x2F;span&gt;&lt;span&gt; interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;TargetContract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;interfaceId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            ||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @notice Emit an event of UpdateNode&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; emitEvents&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; _referringKeys&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; _referringValues&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; convertMap&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; _referredKeys&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; _referredValues&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; convertMap&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UpdateNode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _referringKeys&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _referringValues&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _referredKeys&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _referredValues&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @notice Convert a specific `local` token mapping to a key array and a value array&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; convertMap&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; isReferring&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        Relationship &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;storage&lt;&#x2F;span&gt;&lt;span&gt; relationship &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _relationship&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; returnKeys&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; returnValues&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;isReferring&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            returnKeys &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; relationship&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;referringKeys&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            returnValues &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;returnKeys&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; returnKeys&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                returnValues&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; relationship&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;referring&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;returnKeys&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span&gt;            &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            returnKeys &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; relationship&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;referredKeys&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            returnValues &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;returnKeys&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; returnKeys&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                returnValues&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; relationship&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;referred&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;returnKeys&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;returnKeys&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; returnValues&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;timestamp&quot;&gt;Timestamp&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;createdTimestamp&lt;&#x2F;code&gt; only covers the block-level timestamp (based on block headers), which does not support fine-grained comparisons such as transaction-level.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;ownership-and-reference&quot;&gt;Ownership and Reference&lt;&#x2F;h3&gt;
&lt;p&gt;The change of ownership has nothing to do with the reference relationship. Normally, the distribution of profits complies with the agreement when the NFT was being created regardless of the change of ownership unless specified in the agreement.&lt;&#x2F;p&gt;
&lt;p&gt;Referring a token will not refer to its descendants by default. In the case that only a specific child token gets referred, it means the privity of the contract will involve nobody other than the owner of this specific child token. Alternatively, a chain-of-reference all the way from the root token to a specific very bottom child token (from root to leaf) can be constructed and recorded in the &lt;code&gt;referring&lt;&#x2F;code&gt; to explicitly define the distribution of profits.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;open-minting-and-relationship-risks&quot;&gt;Open Minting and Relationship Risks&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;safeMint&lt;&#x2F;code&gt; function has been deliberately designed to allow unrestricted minting and relationship setting, akin to the open referencing system seen in platforms such as Google Scholar. This decision facilitates strong flexibility, enabling any user to create and define relationships between NFTs without centralized control. While this design aligns with the intended openness of the system, it inherently carries certain risks. Unauthorized or incorrect references can be created, mirroring the challenges faced in traditional scholarly referencing, where erroneous citations may occur. Additionally, the open nature may expose the system to potential abuse by malicious actors, who might manipulate relationships or inflate the token supply. It is important to recognize that these risks are not considered design flaws but intentional trade-offs, which balance the system&#x27;s flexibility against potential reliability concerns.&lt;&#x2F;p&gt;
&lt;p&gt;Stakeholders should be aware that the on-chain data integrity guarantees extend only to what has been recorded on the blockchain and do not preclude the possibility of off-chain errors or manipulations. Thus, users and integrators should exercise caution and judgment in interpreting and using the relationships and other data provided by this system.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>NFT Licensing Agreements</title>
        <published>2022-08-10T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Timi</name><uri>https://github.com/0xTimi</uri>
	</author>
	
	<author>
		<name>0xTriple7</name><uri>https://github.com/ysqi</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5635/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5635-discussion-nft-licensing-agreement-standard/10779" />
        

        <id>https://wg-eips.ritovision.com/5635/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:5635"
            label="ERC-5635" />
        

        
        

        
        <summary type="html">An oracle for retrieving NFT licensing agreements</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5635/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP standardizes an NFT licensing oracle to store (register) and retrieve (discover) granted licensing agreements for non-fungible token (NFT) derivative works, which are also NFTs but are created using properties of some other underlying NFTs.&lt;&#x2F;p&gt;
&lt;p&gt;In this standard, an NFT derivative work is referred to as a &lt;strong&gt;dNFT&lt;&#x2F;strong&gt;, while the original underlying NFT is referred to as an &lt;strong&gt;oNFT&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The NFT owner, known as the &lt;code&gt;licensor&lt;&#x2F;code&gt;, may authorize another creator, known as the &lt;code&gt;licensee&lt;&#x2F;code&gt;, to create a derivative works (dNFTs), in exchange for an agreed payment, known as a &lt;code&gt;Royalty&lt;&#x2F;code&gt;. A licensing agreement outlines terms and conditions related to the deal between the licensor and licensee.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;In general, there are three important roles in this standard:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;oNFT: An original underlying NFT. The holder of an oNFT is a licensor. An oNFT can be any NFT.&lt;&#x2F;li&gt;
&lt;li&gt;dNFT: A derivative work based on one or more oNFTs. The holder of a dNFT is a licensee.&lt;&#x2F;li&gt;
&lt;li&gt;Registry: A trusted smart contract able to verify whether a credential is signed or released by the holder of oNFT.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Every &lt;strong&gt;dNFT&lt;&#x2F;strong&gt; contract must implement the &lt;code&gt;IERC5635NFT&lt;&#x2F;code&gt; and &lt;code&gt;IERC165&lt;&#x2F;code&gt; inferfaces.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.6.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERC165.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Interface of NFT derivatives (dNFT) for the NFT Licensing Standard&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ERC-165 identifier for this interface is 0xd584841c.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5635DNFT&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC165&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC165 bytes to add to interface array - set in parent contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; implementing this standard&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; bytes4(keccak256(&amp;quot;IERC5635DNFT{}&amp;quot;)) == 0xd584841c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; bytes4 private constant _INTERFACE_ID_IERC5635DNFT = 0xd584841c;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; _registerInterface(_INTERFACE_ID_IERC5635XDNFT);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the number of credentials.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - ID of the dNFT asset queried&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _number&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - the number of credentials &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; numberOfCredentials&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _number&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Called with the sale price to determine how much royalty is owed and to whom.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - ID of the dNFT asset queried&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _credentialId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - ID of the licensing agreement credential, the max id is numberOfCredentials(_tokenId)-1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _oNFT&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - the oNFT address where the licensing from&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenID&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - the oNFT ID where the licensing from&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _registry&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - the address of registry which can verify this credential&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; authorizedBy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _credentialId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _oNFT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _registry&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC165&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Query if a contract implements an interface&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; interfaceID&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The interface identifier, as specified in ERC-165&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Interface identification is specified in ERC-165. This function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  uses less than 30,000 gas.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `true` if the contract implements `interfaceID` and&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  `interfaceID` is not 0xffffffff, `false` otherwise&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Every &lt;strong&gt;Registry&lt;&#x2F;strong&gt; contract must implement the &lt;code&gt;IERC5635Registry&lt;&#x2F;code&gt; and &lt;code&gt;IERC165&lt;&#x2F;code&gt; inferfaces.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.6.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERC165.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Interface of NFT derivatives (dNFT) for the NFT Licensing Standard&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;  Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0xb5065e9f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5635Registry&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC165&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC165 bytes to add to interface array - set in parent contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; implementing this standard&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; bytes4(keccak256(&amp;quot;IERC5635Registry{}&amp;quot;)) == 0xb5065e9f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; bytes4 private constant _INTERFACE_ID_IERC5635Registry = 0xb5065e9f;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; _registerInterface(_INTERFACE_ID_IERC5635Registry);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; TODO&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: Is the syntax correct?&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; LicensingAgreementType&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;      NonExclusive&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;      Exclusive&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;      Sole&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _dNFT&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _dNFT_Id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _oNFT&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _oNFT_Id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _licensed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenID&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - the oNFT ID where the licensing from&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _registry&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - the address of registry which can verify this credential&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isLicensed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _dNFT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _dNFT_Id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _oNFT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _oNFT_Id&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _licensed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _licenseIdentifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - the identifier, e.g. `MIT` or `Apache`, similar to `SPDX-License-Identifier: MIT` in SPDX.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; licensingInfo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _dNFT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _dNFT_Id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _oNFT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _oNFT_Id&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _licensed&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _licensor&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _timeOfSignature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _expiryTime&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        LicensingAgreementType&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _type&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _licenseName&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _licenseUri&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; royaltyRate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _dNFT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _dNFT_Id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _oNFT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _oNFT_Id&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; beneficiary&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; rate&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The decimals is 9, means to divide the rate by 1,000,000,000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;strong&gt;Registry&lt;&#x2F;strong&gt; contract MAY implement the &lt;code&gt;IERC5635Licensing&lt;&#x2F;code&gt; and &lt;code&gt;IERC165&lt;&#x2F;code&gt; inferfaces.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.6.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERC165.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5635Licensing&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC165&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC5635Registry&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Licence&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _oNFT&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _oNFT_Id&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _dNFT&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _dNFT_Id&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _expiryTime&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;LicensingAgreementType&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _type&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _licenseName&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _licenseUri&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Approval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _oNFT&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ApprovalForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _oNFT&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; licence&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _oNFT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _oNFT_Id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _dNFT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _dNFT_Id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _expiryTime&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; LicensingAgreementType&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _type&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _licenseName&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _licenseUri&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;TODO&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: mortgages or not?&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _oNFT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;TODO&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: why payable?&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setApprovalForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _oNFT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getApproved&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _oNFT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isApprovedForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _oNFT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Licensing credentials from a dNFT&#x27;s contract can be retrieved with &lt;code&gt;authorizedBy&lt;&#x2F;code&gt;, which specifies the details of a licensing agreement, which may include the oNFT. Those credentials may be verified with a &lt;code&gt;registry&lt;&#x2F;code&gt; service.&lt;&#x2F;p&gt;
&lt;p&gt;Anyone can retrieve licensing royalty information with &lt;code&gt;licensingRoyalty&lt;&#x2F;code&gt; via the registry. While it is not possible to enforce the rules set out in this EIP on-chain, just like &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2981&#x2F;&quot;&gt;EIP-2981&lt;&#x2F;a&gt;, we encourages NFT marketplaces to follow this EIP.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;two-stages-licensing-and-discovery&quot;&gt;Two stages: Licensing and Discovery&lt;&#x2F;h3&gt;
&lt;p&gt;Taking the moment when the dNFT is minted as the cut-off point, the stage before is called the &lt;strong&gt;Licensing&lt;&#x2F;strong&gt; stage, and the subsequent stage is called the &lt;strong&gt;Discovery&lt;&#x2F;strong&gt; stage. The interface &lt;code&gt;IERC5635Licensing&lt;&#x2F;code&gt; is for the &lt;strong&gt;Licensing&lt;&#x2F;strong&gt; stage, and the interfaces &lt;code&gt;IERC5635DNFT&lt;&#x2F;code&gt; and &lt;code&gt;IERC5635Registry&lt;&#x2F;code&gt; are for the &lt;strong&gt;Discovery&lt;&#x2F;strong&gt; stage.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;design-decision-beneficiary-of-licensing-agreement&quot;&gt;Design decision: beneficiary of licensing agreement&lt;&#x2F;h3&gt;
&lt;p&gt;As soon as someone sells their NFT, the full licensed rights are passed along to the new owner without any encumbrances, so that the beneficiary should be the new owner.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;difference-between-cantbeevil-licenses-and-licensing-agreements&quot;&gt;Difference between CantBeEvil Licenses and Licensing Agreements.&lt;&#x2F;h3&gt;
&lt;p&gt;CantBeEvil licenses are creator-holder licenses which indicate what rights the NFTs&#x27; holder are granted from the creator. Meanwhile, licensing agreements is a contract between a licensor and licensee. So, CantBeEvil licenses cannot be used as a licensing agreement.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;design-decision-relationship-between-different-approval-levels&quot;&gt;Design decision: Relationship between different approval levels&lt;&#x2F;h3&gt;
&lt;p&gt;The approved address can &lt;code&gt;license()&lt;&#x2F;code&gt; the licensing agreement to &lt;strong&gt;dNFT&lt;&#x2F;strong&gt; on behalf of the holder of an &lt;strong&gt;oNFT&lt;&#x2F;strong&gt;. We define two levels of approval like that:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;approve&lt;&#x2F;code&gt; will lead to approval for one NFT related to an id.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;setApprovalForAll&lt;&#x2F;code&gt; will lead to approval of all NFTs owned by &lt;code&gt;msg.sender&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;EIP-1155&lt;&#x2F;a&gt;, and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2981&#x2F;&quot;&gt;EIP-2981&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;examples&quot;&gt;Examples&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;deploying-an-eip-721-nft-and-signaling-support-for-dnft&quot;&gt;Deploying an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; NFT and signaling support for dNFT&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;constructor&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; symbol&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; baseURI&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _name &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _symbol &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; symbol&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _setBaseURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;baseURI&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; register the supported interfaces to conform to ERC721 via ERC165&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _registerInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_INTERFACE_ID_ERC721&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _registerInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_INTERFACE_ID_ERC721_METADATA&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _registerInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_INTERFACE_ID_ERC721_ENUMERABLE&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; dNFT interface&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _registerInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_INTERFACE_ID_IERC5635DNFT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;checking-if-the-nft-being-sold-on-your-marketplace-is-a-dnft&quot;&gt;Checking if the NFT being sold on your marketplace is a dNFT&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; _INTERFACE_ID_IERC5635DNFT &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xd584841c&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checkDNFT&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _contract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC165&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_contract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_INTERFACE_ID_IERC5635DNFT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; success&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;checking-if-an-address-is-a-registry&quot;&gt;Checking if an address is a Registry&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; _INTERFACE_ID_IERC5635Registry &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xb5065e9f&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checkLARegistry&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _contract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC165&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_contract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_INTERFACE_ID_IERC5635Registry&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; success&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Security Contact Interface</title>
        <published>2022-08-09T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Zainan Zhou</name><uri>https://github.com/xinbenlv</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5437/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-interface-for-security-contract/10303" />
        

        <id>https://wg-eips.ritovision.com/5437/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:5437"
            label="ERC-5437" />
        

        
        

        
        <summary type="html">An interface for security notice using asymmetric encryption</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5437/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;An interface for security notice using asymmetric encryption. The interface exposes a asymmetric encryption key and a destination of delivery.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently there is no consistent way to specify an official channel for security researchers to report security issues to smart contract maintainers.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IEIP5437&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; REQUIRED&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getSecurityContact&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; publicKey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; extraData&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; OPTIONAL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; TODO&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; consider remove if not needed before finalized&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setSecurityContact&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; publicKey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; extraData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SecurityContactChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; publicKeyForEncryption&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; extraData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; OPTIONAL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; securityNotify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; OPTIONAL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OnSecurityNotification&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sourceData&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; OPTIONAL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; TODO&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; consider to make it a separate EIP&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; bountyPolicy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; extraData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ol&gt;
&lt;li&gt;Compliant interfaces MUST implement the &lt;code&gt;getSecurityContact&lt;&#x2F;code&gt; method.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;code&gt;type&lt;&#x2F;code&gt; is a one byte data with valid range of &lt;code&gt;[0x10, 0x7f]&lt;&#x2F;code&gt;. The ranges of &lt;code&gt;[0x00, 0x0f]&lt;&#x2F;code&gt; and &lt;code&gt;[0x80, 0xff]&lt;&#x2F;code&gt; are reserved for future extension.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;type&lt;&#x2F;code&gt; indicates the format of the &lt;code&gt;publicKey&lt;&#x2F;code&gt; and &lt;code&gt;extraData&lt;&#x2F;code&gt; in the following way&lt;&#x2F;p&gt;
&lt;hr &#x2F;&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Encryption scheme&lt;&#x2F;th&gt;&lt;th&gt;extraData&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;0x10&lt;&#x2F;td&gt;&lt;td&gt;GnuPG - RSA&#x2F;3072&lt;&#x2F;td&gt;&lt;td&gt;Email address(es) encoded in format of RFC 2822&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;hr &#x2F;&gt;
&lt;p&gt;A new version of this table can be proposed by future EIPs by specifying a new &lt;code&gt;type&lt;&#x2F;code&gt; number.&lt;&#x2F;p&gt;
&lt;ol start=&quot;2&quot;&gt;
&lt;li&gt;The &lt;code&gt;publicKey&lt;&#x2F;code&gt; returned from &lt;code&gt;getSecurityContact&lt;&#x2F;code&gt; MUST follow the encryption scheme specified
in the table above.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The following is an example of a &lt;code&gt;publicKey&lt;&#x2F;code&gt; using &lt;code&gt;RSA&#x2F;3072&lt;&#x2F;code&gt; generated via GnuPG in an RFC 20 ASCII-encoding of the public key string:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-----BEGIN PGP PUBLIC KEY BLOCK-----&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mQGNBGLzM2YBDADnCxAW&#x2F;A0idvKNeQ6s&#x2F;iYUeIIE+2mWmHcBGqLi0zrfz7pKWI+D&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;m6Hek51sg2c7ZlswPEp8KqANrj&#x2F;CV1stXHF+KAZtYeFiAqpIZl1wtB6QgKYWGsJf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sXjBU3duLzLut2yvTfbEZsWAvrEaDjlXywdpboorHvfTE2vOvI6iGcjdh7PW7W7g&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;IGzlL6ukLGG7y9FUO2dSMjCR&#x2F;tWMLCupnDDLN2cUHnfEnHZ34FMd61NxcHLC7cIk&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;P8xkFt8GCxURniTjqI5HAB8bGfR34kflVpr2+iKD5e+vQxcWK7vB443nruVf8osn&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;udDF8Z6mgl7bKBbGyYH58QsVlmZ8g3E4YaMKjpwOzEK3V2R8Yh4ETdr670ZCRrIz&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;QWVkibGgmQ3J&#x2F;9RYps5Hfqpj4wV60Bsh1xUIJEIAs3ubMt7Z5JYFeze7VlXGlwot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;P+SnAfKzlZT4CDEl2LEEDrbpnpOEdp0x9hYsEaXTxBGSpTDaxP2MyhW3u6pYeehG&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;oD0UVTLjWgU+6akAEQEAAbQjc29tZXJlYWxuYW1lIDxncGcubG9jYWwuZ2VuQHp6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;bi5pbT6JAdQEEwEIAD4WIQTDk&#x2F;9jzRZ+lU2cY8rSVJNbud1lrQUCYvMzZgIbAwUJ&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;EswDAAULCQgHAgYVCgkICwIEFgIDAQIeAQIXgAAKCRDSVJNbud1lraulDACqFbQg&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;e9hfoK17UcPVz&#x2F;u4ZnwmFd9zFAWSYkGqrK9XMvz0R8pr7Y3Dp5hfvaptqID&#x2F;lHhA&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;2oPEZ1ViIYDBcqG9WoWjCOYNoIosEAczrvf8YtUC2MHI+5DdYHtST74jDLuWMw3U&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;AbBXHds3KcRY5&#x2F;j01kqqi4uwsMBCYyH3Jl3IwjKgy0KDBbuQakvaHPmNnt81ayvZ&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ucdsNB9n&#x2F;JMDxUWNCcySR+cllW4mk68pdiuK5qw0JMaoUjHFoWsgMTbFSlAV&#x2F;lre&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;qu8MnrLSs5iPvvaJ3uDOuYROB2FsbvWxayfAAVS1iZf2vQFBJPnDwDdYoPNYMjLp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;s2SfU02MVRGp3wanbtvM52uP42SLLNjBqUvJV03&#x2F;QwfxCRejgAJOBn+iaOxP9NOe&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;qfQdKzYPbA9FohdkL9991n21XBZcZzAgF9RyU9IZAPAnwZyex1zfzJsUp&#x2F;HrjhP8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Ljs8MIcjIlmpLk66TmJte4dN5eML1bpohmfMX8k0ILESLSUhxEg1JBNYIDK5AY0E&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;YvMzZgEMALnIkONpqCkV+yaP8Tb8TBjmM+3TioJQROViINUQZh6lZM3&#x2F;M+DPxAWZ&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;r0MIh1a3+o+ThlZ70tlS67w3Sjd62sWAFzALzW4F+gTqjBTh6LURDqDV8OXUrggA&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SKK222aDP+Fr21h&#x2F;TtPLeyDvcgm8Xvi4Cy7Jmf5CfT5jDio7a+FyFBNlTFSVqzLM&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;TgFOkUFBg8kJKvDjWIrS2fcTkELwZ8+IlQ52YbrXwbDar843x1fRmsY+x9nnuGuP&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;RYn1U4Jbptu2pEkG5q94jzUzTkGZHCzBJY7a8mtvS0mLqIE0Se1p+HFLY76Rma&#x2F;F&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;HB6J4JNOTzBZ0&#x2F;1FVvUOcMkjuZ2dX81qoCZ8NP6eafzKvNYZrGa5NJnjWO1ag5jQ&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;D8qHuOwxs8Fy9evmkwAVl51evLFNT532I4LK0zHSbF8MccZjpEFMSKwalKJn02Ml&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;yTd+ljYLf8SKMOLVps8kc4VyMR1lz0PwSpKDFOmkC1LRURpM7UTtCK+&#x2F;RFg1OLyQ&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SKBmdI37KQARAQABiQG8BBgBCAAmFiEEw5P&#x2F;Y80WfpVNnGPK0lSTW7ndZa0FAmLz&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;M2YCGwwFCRLMAwAACgkQ0lSTW7ndZa2oFgv8DAxHtRZchTvjxtdLhQEUSHt80JCQ&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;zgHd7OUI9EU3K+oDj9AKtKZF1fqMlQoOskgBsLy&#x2F;xpWwyhatv2ONLtHSjYDkZ7qs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jsXshqpuvJ3X00Yn9PXG1Z1jKl7rzy2&#x2F;0DnQ8aFP+gktfu2Oat4uIu4YSqRsVW&#x2F;Z&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sbdTsW3T4E6Uf0qUKDf49mK3Y2nhTwY0YZqJnuQkSuUvpuM5a&#x2F;4zSoaIRz+vSNjX&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;MoXUIK&#x2F;f8UnWABPm90OCptTMTzXCC1UXEHTNm6iBJThFiq3GeLZH+GnIola5KLO1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+YbsFEchLfLZ27pWGfIbyppvsuQmrHef+J3g6sXybOWDHVYr3Za1fzxQVIbwoIEe&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ndKG0bu7ZAi2b&#x2F;c8uH&#x2F;wHT5IvtfzHLeSTjDqG8UyLTnaDxHQZIE9JIzWSQ1DSoNC&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;YrU7CQtL+&#x2F;HRpiGFHfClaXln8VWkjnUvp+Fg1ZPtE1t&#x2F;SKddZ7m29Hd9nzUc0OQW&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;MOA+HDqgA3a9kWbQKSloORq4unft1eu&#x2F;FCra&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;=O6Bf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-----END PGP PUBLIC KEY BLOCK-----&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ol start=&quot;3&quot;&gt;
&lt;li&gt;
&lt;p&gt;IF &lt;code&gt;setSecurityContact&lt;&#x2F;code&gt; is implemented and a call to it has succeeded in setting a new security contact, an event &lt;code&gt;SecurityContactChanged&lt;&#x2F;code&gt; MUST be emitted with the identical passed-in-parameters of &lt;code&gt;setSecurityContact&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;It&#x27;s also RECOMMENDED that an on-chain security notify method &lt;code&gt;securityNotify&lt;&#x2F;code&gt;
to implemented to receive security notice onchain. If it&#x27;s implemented and a call
has succeeded, it MUST emit an &lt;code&gt;OnSecurityNotification&lt;&#x2F;code&gt; with identical pass-in-parameter data.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Compliant interfaces MUST implement &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;EIP-165&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;!-- TODO: add EIP-165 interfaces. --&gt;
&lt;!-- TODO also consider requiring&#x2F;recommending implementing EIP-5629 ERC-interface detection. --&gt;
&lt;ol start=&quot;6&quot;&gt;
&lt;li&gt;It&#x27;s recommended to set a bounty policy via &lt;code&gt;bountyPolicy&lt;&#x2F;code&gt; method. The &lt;code&gt;id = 0&lt;&#x2F;code&gt; is preserved for a full overview, while other digits are used for different individual bounty policies. The returned
string will be URI to content of bounty policies.
No particular format of bounty policy is specified.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;For simplicity, this EIP specifies a simple GPG scheme with a given encryption scheme and uses email addresses as a contact method. It&#x27;s possible that future EIPs will specify new encryption schemes or delivery methods.&lt;&#x2F;li&gt;
&lt;li&gt;This EIP adds an optional method, &lt;code&gt;setSecurityContact&lt;&#x2F;code&gt;, to set the security contact, because it might change due to circumstances such as the expiration of the cryptographic keys.&lt;&#x2F;li&gt;
&lt;li&gt;This EIP explicitly marks &lt;code&gt;securityNotify&lt;&#x2F;code&gt; as &lt;code&gt;payable&lt;&#x2F;code&gt;, in order to allow implementers to set a staking amount to report a security vulnerability.&lt;&#x2F;li&gt;
&lt;li&gt;This EIP allows for future expansion by adding the &lt;code&gt;bountyPolicy&lt;&#x2F;code&gt; the &lt;code&gt;extraData&lt;&#x2F;code&gt; fields. Additional values of these fields may be added in future EIPs.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, existing solutions such as OpenZeppelin use plaintext in source code&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @custom:security&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;-contact some-user@some-domain.com&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;It&#x27;s recommend that new versions of smart contracts adopt this EIP in addition to the legacy &lt;code&gt;@custom:security-contact&lt;&#x2F;code&gt; approach.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Implementors should properly follow security practices required by the encryption scheme to ensure the security of the chosen communication channel. Some best practices are as follows:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Keep security contact information up-to-date;&lt;&#x2F;li&gt;
&lt;li&gt;Rotate encryption keys in the period recommended by best practice;&lt;&#x2F;li&gt;
&lt;li&gt;Regularly monitor the channel to receive notices in a timely manner.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>NFT Author Information and Consent</title>
        <published>2022-07-30T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Samuele Marro</name><uri>https://github.com/samuelemarro</uri>
	</author>
	
	<author>
		<name>Luca Donno</name><uri>https://github.com/lucadonnoh</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5375/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5375-nft-authorship/10182" />
        

        <id>https://wg-eips.ritovision.com/5375/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:5375"
            label="ERC-5375" />
        

        
        

        
        <summary type="html">An extension of EIP-721 for NFT authorship and author consent.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5375/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP standardizes a JSON format for storing off-chain information about NFT authors. Specifically, it adds a new field which provides a list of author names, addresses, and proofs of &lt;em&gt;authorship consent&lt;&#x2F;em&gt;: proofs that the authors have agreed to be named as authors. Note that a proof of authorship &lt;em&gt;consent&lt;&#x2F;em&gt; is not a proof of authorship: an address can consent without having authored the NFT.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;There is currently no standard to identify authors of an NFT, and existing techniques have issues:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Using the mint &lt;code&gt;tx.origin&lt;&#x2F;code&gt; or &lt;code&gt;msg.sender&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;Assumes that the minter and the author are the same&lt;&#x2F;li&gt;
&lt;li&gt;Does not support multiple authors&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Using the first Transfer event for a given ID
&lt;ul&gt;
&lt;li&gt;Contract&#x2F;minter can claim that someone else is the author without their consent&lt;&#x2F;li&gt;
&lt;li&gt;Does not support multiple authors&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Using a custom method&#x2F;custom JSON field
&lt;ul&gt;
&lt;li&gt;Requires per-contract support by NFT platforms&lt;&#x2F;li&gt;
&lt;li&gt;Contract&#x2F;minter can claim that someone else is the author without their consent&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The first practice is the most common. However, there are several situations where the minter and the author might not be the same, such as:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;NFTs minted by a contract&lt;&#x2F;li&gt;
&lt;li&gt;Lazy minting&lt;&#x2F;li&gt;
&lt;li&gt;NFTs minted by an intermediary (which can be particularly useful when the author is not tech-savvy and&#x2F;or the minting process is convoluted)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This document thus defines a standard which allows the minter to provide authorship information, while also preventing authorship claims without the author&#x27;s consent.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;All addresses used in this standard MUST follow the casing rules described in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;55&#x2F;&quot;&gt;EIP-55&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Authors&lt;&#x2F;strong&gt;: creators of an NFT&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Minter&lt;&#x2F;strong&gt;: entity responsible for the actual minting transaction; the minter and the authors MAY be the same&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Verifier&lt;&#x2F;strong&gt;: entity that wants to verify the authorship of an NFT (e.g. a user or an NFT marketplace)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Author Consent Proof (ACP)&lt;&#x2F;strong&gt;: a signed message that proves that the signer agrees to be considered the author of the NFT&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;authorship-support&quot;&gt;Authorship Support&lt;&#x2F;h3&gt;
&lt;p&gt;The standard introduces a new JSON field, named &lt;code&gt;authorInfo&lt;&#x2F;code&gt;. It provides a REQUIRED interface for authorship claiming, as well as an OPTIONAL interface for author consent proofs.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;authorInfo&lt;&#x2F;code&gt; is a top-level field of the NFT metadata. Specifically:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If a contract supports the metadata extension for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt;, the JSON document pointed by &lt;code&gt;tokenURI(uint256 _tokenId)&lt;&#x2F;code&gt; MUST include the top-level field &lt;code&gt;authorInfo&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;If a contract supports the metadata extension for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;EIP-1155&lt;&#x2F;a&gt;, the JSON document pointed by &lt;code&gt;uri(uint256 _id)&lt;&#x2F;code&gt; MUST include a top-level field &lt;code&gt;authorInfo&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The JSON schema of &lt;code&gt;authorInfo&lt;&#x2F;code&gt; (named &lt;code&gt;ERC5375AuthorInfoSchema&lt;&#x2F;code&gt;) is defined as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;consentInfo&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Helper fields for consent verification&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;integer&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;EIP-155 chain id&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;NFT id&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;contractAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x-prefixed address of the smart contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;authors&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;array&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;items&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ERC5375AuthorSchema&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;required&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;authors&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note that &lt;code&gt;authors&lt;&#x2F;code&gt; MAY be an empty array.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;ERC5375AuthorSchema&lt;&#x2F;code&gt; is defined as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x-prefixed address of the author&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;consent&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ERC5375AuthorConsentSchema&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Author consent information&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;required&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Moreover, if the &lt;code&gt;consent&lt;&#x2F;code&gt; field is present, the &lt;code&gt;consentInfo&lt;&#x2F;code&gt; field of &lt;code&gt;authorInfo&lt;&#x2F;code&gt; MUST be present.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;ERC5375AuthorConsentSchema&lt;&#x2F;code&gt; is defined as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;consentData&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;NFT authorship consent schema version&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;issuer&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x-prefixed address of the author&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;metadataFields&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;required&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;issuer&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;metadataFields&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;publicKey&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;EVM public key of the author&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;EIP-712 signature of the consent message&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;required&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;consentData&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;publicKey&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where &lt;code&gt;metadataFields&lt;&#x2F;code&gt; is an object containing the JSON top-level fields (excluding &lt;code&gt;authorInfo&lt;&#x2F;code&gt;) that the author will certify. Note that the keys of &lt;code&gt;metadataFields&lt;&#x2F;code&gt; MAY be a (potentially empty) subset of the set of fields.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;consentData&lt;&#x2F;code&gt; MAY support additional fields as defined by other EIPs. &lt;code&gt;consentData&lt;&#x2F;code&gt; MUST contain all the information (which is not already present in other fields) required to verify the validity of an authorship consent proof.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;author-consent&quot;&gt;Author Consent&lt;&#x2F;h3&gt;
&lt;p&gt;Consent is obtained by signing an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; compatible message. Specifically, the structure is defined as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Author&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; subject&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span&gt; metadata&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where &lt;code&gt;subject&lt;&#x2F;code&gt; is the address of the NFT contract, &lt;code&gt;tokenId&lt;&#x2F;code&gt; is the id of the NFT and &lt;code&gt;metadata&lt;&#x2F;code&gt; is the JSON encoding of the fields listed in &lt;code&gt;metadataFields&lt;&#x2F;code&gt;. &lt;code&gt;metadata&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;MUST contain exactly the same fields as the ones listed in &lt;code&gt;metadataFields&lt;&#x2F;code&gt;, in the same order&lt;&#x2F;li&gt;
&lt;li&gt;MUST escape all non-ASCII characters. If the escaped character contains hexadecimal letters, they MUST be uppercase&lt;&#x2F;li&gt;
&lt;li&gt;MUST not contain any whitespace that is not part of a field name or value&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;For example, if the top-level JSON fields are:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The Holy Hand Grenade of Antioch&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Throw in the general direction of your favorite rabbit, et voilà&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;damage&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 500&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;authors&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;    .&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;and the content of &lt;code&gt;metadataFields&lt;&#x2F;code&gt; is &lt;code&gt;[&quot;name&quot;, &quot;description&quot;]&lt;&#x2F;code&gt;, the content of &lt;code&gt;metadata&lt;&#x2F;code&gt; is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The Holy Hand Grenade of Antioch&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Throw in the general direction of your favorite rabbit, et voil&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\u00E0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Similarly to &lt;code&gt;consentData&lt;&#x2F;code&gt;, this structure MAY support additional fields as defined by other EIPs.&lt;&#x2F;p&gt;
&lt;p&gt;The domain separator structure is&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EIP712Domain&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span&gt; version&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; chainId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where &lt;code&gt;name&lt;&#x2F;code&gt; and &lt;code&gt;version&lt;&#x2F;code&gt; are the same fields described in &lt;code&gt;consentData&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;This structure MAY support additional fields as defined by other EIPs.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;author-consent-verification&quot;&gt;Author Consent Verification&lt;&#x2F;h3&gt;
&lt;p&gt;Verification is performed using EIP-712 on an author-by-author basis. Specifically, given a JSON document D1, a consent proof is valid if all of the following statements are true:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;D1 has a top-level &lt;code&gt;authorInfo&lt;&#x2F;code&gt; field that matches &lt;code&gt;ERC5375AuthorInfoSchema&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;consent&lt;&#x2F;code&gt; exists and matches &lt;code&gt;ERC5375AuthorConsentSchema&lt;&#x2F;code&gt;;&lt;&#x2F;li&gt;
&lt;li&gt;If calling &lt;code&gt;tokenURI&lt;&#x2F;code&gt; (for EIP-721) or &lt;code&gt;uri&lt;&#x2F;code&gt; (for EIP-1155) returns the URI of a JSON document D2, all the top-level fields listed in &lt;code&gt;metadataFields&lt;&#x2F;code&gt; MUST exist and have the same value;&lt;&#x2F;li&gt;
&lt;li&gt;The EIP-712 signature in &lt;code&gt;signature&lt;&#x2F;code&gt; (computed using the fields specified in the JSON document) is valid;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Verifiers MUST NOT assume that an NFT with a valid consent proof from address X means that X is the actual author. On the other hand, verifiers MAY assume that if an NFT does not provide a valid consent proof for address X, then X is not the actual author.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-provide-only-an-author-consent-proof&quot;&gt;Why provide only an author consent proof?&lt;&#x2F;h3&gt;
&lt;p&gt;Adding support for full authorship proofs (i.e. Alice is the author and no one else is the author) requires a protocol to prove that someone is the only author of an NFT.
In other words, we need to answer the question: &quot;Given an NFT Y and a user X claiming to be the author, is X the original author of Y?&quot;.&lt;&#x2F;p&gt;
&lt;p&gt;For the sake of the argument, assume that there exists a protocol that, given an NFT Y, can determine the original author of Y. Even if such method existed, an attacker could slightly modify Y, thus obtaining a new NFT Y&#x27;, and rightfully claim to be the author of Y&#x27;, despite the fact that it is not an original work. Real-world examples include changing some pixels of an image or replacing some words of a text with synonyms.
Preventing this behavior would require a general formal definition of when two NFTs are semantically equivalent. Even if defining such a concept were possible, it would still be beyond the scope of this EIP.&lt;&#x2F;p&gt;
&lt;p&gt;Note that this issue is also present when using the minter&#x27;s address as a proxy for the author.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-off-chain&quot;&gt;Why off-chain?&lt;&#x2F;h3&gt;
&lt;p&gt;There are three reasons:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Adding off-chain support does not require modifications to existing smart contracts;&lt;&#x2F;li&gt;
&lt;li&gt;Off-chain storage is usually much cheaper than on-chain storage, thus reducing the implementation barrier;&lt;&#x2F;li&gt;
&lt;li&gt;While there may be some use cases for full on-chain authorship proofs (e.g. a marketplace providing special features for authors), there are limited applications for on-chain author consent, due to the fact that it is mostly used by users to determine the subjective value of an NFT.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;why-repeat-id-chainid-and-contractaddress&quot;&gt;Why repeat id, chainId and contractAddress?&lt;&#x2F;h3&gt;
&lt;p&gt;In many cases, this data can be derived from contextual information. However, requiring their inclusion in the JSON document ensures that author consent can be verified using only the JSON document.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-not-implement-a-revocation-system&quot;&gt;Why not implement a revocation system?&lt;&#x2F;h3&gt;
&lt;p&gt;Authorship is usually final: either someone created an NFT or they didn&#x27;t. Moreover, a revocation system would impose additional implementation requirements on smart contracts and increase the complexity of verification. Smart contracts MAY implement a revocation system, such as the one defined in other EIPs.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;why-escape-non-ascii-characters-in-the-signature-message&quot;&gt;Why escape non-ASCII characters in the signature message?&lt;&#x2F;h4&gt;
&lt;p&gt;EIP-712 is designed with the possibility of on-chain verification in mind; while on-chain verification is not a priority for this EIP, non-ASCII characters are escaped due to the high complexity of dealing with non-ASCII strings in smart contracts.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;usability-improvements-for-authors&quot;&gt;Usability Improvements for Authors&lt;&#x2F;h3&gt;
&lt;p&gt;Since the author only needs to sign an EIP-712 message, this protocol allows minters to handle the technical aspects of minting while still preserving the secrecy of the author&#x27;s wallet. Specifically, the author only needs to:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Obtain an EVM wallet;&lt;&#x2F;li&gt;
&lt;li&gt;Learn how to read and sign a EIP-712 message (which can often be simplified by using a Dapp)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;without needing to:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Obtain the chain&#x27;s native token (e.g. through trading or bridging);&lt;&#x2F;li&gt;
&lt;li&gt;Sign a transaction;&lt;&#x2F;li&gt;
&lt;li&gt;Understand the pricing mechanism of transactions;&lt;&#x2F;li&gt;
&lt;li&gt;Verify if a transaction has been included in a block&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This reduces the technical barrier for authors, thus increasing the usability of NFTs, without requiring authors to hand over their keys to a tech-savvy intermediary.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;limitations-of-address-based-consent&quot;&gt;Limitations of Address-Based Consent&lt;&#x2F;h3&gt;
&lt;p&gt;The standard defines a protocol to verify that a certain &lt;em&gt;address&lt;&#x2F;em&gt; provided consent. However, it does not guarantee that the address corresponds to the expected author (such as the one provided in the &lt;code&gt;name&lt;&#x2F;code&gt; field). Proving a link between an address and the entity behind it is beyond the scope of this document.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues were found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;attacks&quot;&gt;Attacks&lt;&#x2F;h3&gt;
&lt;p&gt;A potential attack that exploits this EIP involves tricking authors into signing authorship consent messages against their wishes. For this reason, authors MUST verify that all signature fields match the required ones.&lt;&#x2F;p&gt;
&lt;p&gt;A more subtle approach involves not adding important fields to &lt;code&gt;metadataFields&lt;&#x2F;code&gt;. By doing so, the author signature might be valid even if the minter changes critical information.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;deprecated-features&quot;&gt;Deprecated Features&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;ERC5375AuthorInfoSchema&lt;&#x2F;code&gt; also originally included a field to specify a human-readable name for the author (without any kind of verification). This was scrapped due to the high risk of author spoofing, i.e.:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Alice mints an NFT using Bob&#x27;s name and Alice&#x27;s address&lt;&#x2F;li&gt;
&lt;li&gt;Charlie does not check the address and instead relies on the provided name&lt;&#x2F;li&gt;
&lt;li&gt;Charlie buys Alice&#x27;s NFT while believing that it was created by Bob&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;For this reason, smart contract developers SHOULD NOT add support for unverifiable information to the JSON document. We believe that the most secure way to provide complex authorship information (e.g. the name of the author) is to prove that the information is associated with the &lt;em&gt;author&#x27;s address&lt;&#x2F;em&gt;, instead of with the NFT itself.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;replay-attack-resistance&quot;&gt;Replay Attack Resistance&lt;&#x2F;h3&gt;
&lt;p&gt;The chain id, the contract address and the token id uniquely identify an NFT; for this reason, there is no need to implement additional replay attack countermeasures (e.g. a nonce system).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Multi-privilege Management NFT Extension</title>
        <published>2022-07-30T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Jeremy Z</name><uri>https://github.com/wnft</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5496/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5496-multi-privilege-management-extension-for-erc-721/10427" />
        

        <id>https://wg-eips.ritovision.com/5496/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="last-call"
                label="Last Call" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:5496"
            label="ERC-5496" />
        

        
        

        
        <summary type="html">Create shareable multi-privilege NFTs for EIP-721</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5496/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP defines an interface extending &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; to provide shareable multi-privileges for NFTs. Privileges may be on-chain (voting rights, permission to claim an airdrop) or off-chain (a coupon for an online store, a discount at a local restaurant, access to VIP lounges in airports). Each NFT may contain many privileges, and the holder of a privilege can verifiably transfer that privilege to others. Privileges may be non-shareable or shareable. Shareable privileges can be cloned, with the provider able to adjust the details according to the spreading path. Expiration periods can also be set for each privilege.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This standard aims to efficiently manage privileges attached to NFTs in real-time. Many NFTs have functions other than just being used as profile pictures or art collections, they may have real utilities in different scenarios. For example, a fashion store may give a discount for its own NFT holders; a DAO member NFT holder can vote for the proposal of how to use their treasury; a dApp may create an airdrop event to attract a certain group of people like some blue chip NFT holders to claim; the grocery store can issue its membership card on chain (as an NFT) and give certain privileges when the members shop at grocery stores, etc. There are cases when people who own NFTs do not necessarily want to use their privileges. By providing additional data recording different privileges a NFT collection has and interfaces to manage them, users can transfer or sell privileges without losing their ownership of the NFT.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; only records the ownership and its transfer, the privileges of an NFT are not recorded on-chain. This extension would allow merchants&#x2F;projects to give out a certain privilege to a specified group of people, and owners of the privileges can manage each one of the privileges independently. This facilitates a great possibility for NFTs to have real usefulness.&lt;&#x2F;p&gt;
&lt;p&gt;For example, an airline company issues a series of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt;&#x2F;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;EIP-1155&lt;&#x2F;a&gt; tokens to Crypto Punk holders to give them privileges, in order to attract them to join their club. However, since these tokens are not bound to the original NFT, if the original NFT is transferred, these privileges remain in the hands of the original holders, and the new holders cannot enjoy the privileges automatically.
So, we propose a set of interfaces that can bind the privileges to the underlying NFT, while allowing users to manage the privileges independently.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;Every contract complying with this standard MUST implement the &lt;code&gt;IERC5496&lt;&#x2F;code&gt; interface. The &lt;strong&gt;shareable multi-privilege extension&lt;&#x2F;strong&gt; is OPTIONAL for EIP-721 contracts.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; multi-privilege extension for EIP-721&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;  Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the EIP-165 identifier for this interface is 0x076e1bbb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5496&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when `owner` changes the `privilege holder` of a NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PrivilegeAssigned&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; privilegeId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expires&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when `contract owner` changes the `total privilege` of the collection&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PrivilegeTotalChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newTotal&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; oldTotal&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; set the privilege holder of a NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; expires should be less than 30 days&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws if `msg.sender` is not approved or owner of the tokenId.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT to set privilege for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; privilegeId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The privilege to set&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; user&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The privilege holder to set&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; expires&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; For how long the privilege holder can have&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setPrivilege&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; privilegeId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expires&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Return the expiry timestamp of a privilege&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier of the queried NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; privilegeId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier of the queried privilege&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Whether&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; a user has a certain privilege&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; privilegeExpires&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; privilegeId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check if a user has a certain privilege&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier of the queried NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; privilegeId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier of the queried privilege&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; user&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the queried user&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Whether&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; a user has a certain privilege&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; hasPrivilege&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; privilegeId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Every contract implementing this standard SHOULD set a maximum privilege number before setting any privilege, the &lt;code&gt;privilegeId&lt;&#x2F;code&gt; MUST NOT be greater than the maximum privilege number.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;PrivilegeAssigned&lt;&#x2F;code&gt; event MUST be emitted when &lt;code&gt;setPrivilege&lt;&#x2F;code&gt; is called.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;PrivilegeTotalChanged&lt;&#x2F;code&gt; event MUST be emitted when the &lt;code&gt;total privilege&lt;&#x2F;code&gt; of the collection is changed.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; method MUST return &lt;code&gt;true&lt;&#x2F;code&gt; when called with &lt;code&gt;0x076e1bbb&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Cloneable extension - Optional for EIP-721&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC721Cloneable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when set the `privilege ` of a NFT cloneable.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PrivilegeCloned&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; privId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; set a certain privilege cloneable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier of the queried NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; privilegeId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier of the queried privilege&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; referrer&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the referrer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Whether&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the operation is successful or not&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; clonePrivilege&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; privId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; referrer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;PrivilegeCloned&lt;&#x2F;code&gt; event MUST be emitted when &lt;code&gt;clonePrivilege&lt;&#x2F;code&gt; is called.&lt;&#x2F;p&gt;
&lt;p&gt;For Compliant contract, it is RECOMMENDED to use &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;EIP-1271&lt;&#x2F;a&gt; to validate the signatures.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;shareable-privileges&quot;&gt;Shareable Privileges&lt;&#x2F;h3&gt;
&lt;p&gt;The number of privilege holders is limited by the number of NFTs if privileges are non-shareable. A shareable privilege means the original privilege holder can copy the privilege and give it to others, not transferring his&#x2F;her own privilege to them. This mechanism greatly enhances the spread of privileges as well as the adoption of NFTs.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;expire-date-type&quot;&gt;Expire Date Type&lt;&#x2F;h3&gt;
&lt;p&gt;The expiry timestamp of a privilege is a timestamp and stored in &lt;code&gt;uint256&lt;&#x2F;code&gt; typed variables.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;beneficiary-of-referrer&quot;&gt;Beneficiary of Referrer&lt;&#x2F;h3&gt;
&lt;p&gt;For example, a local pizza shop offers a 30% off Coupon and the owner of the shop encourages their consumers to share the coupon with friends, then the friends can get the coupon. Let&#x27;s say Tom gets 30% off Coupon from the shop and he shares the coupon with Alice. Alice gets the coupon too and Alice&#x27;s referrer is Tom. For some certain cases, Tom may get more rewards from the shop. This will help the merchants in spreading the promotion among consumers.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;proposal-nft-transfer&quot;&gt;Proposal: NFT Transfer&lt;&#x2F;h3&gt;
&lt;p&gt;If the owner of the NFT transfers ownership to another user, there is no impact on &quot;privileges&quot;. But errors may occur if the owner tries to withdraw the original &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; token from the wrapped NFT through &lt;code&gt;unwrap()&lt;&#x2F;code&gt; if any available privileges are still ongoing. We protect the rights of holders of the privileges to check the last expiration date of the privilege.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; unwrap&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getBlockTimestamp&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; privilegeBook&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;lastExpiresAt&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;privilege not yet expired&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;not owner&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    _burn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    IERC721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;nft&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Unwrap&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;nft&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is compatible with any kind of NFTs that follow the EIP-721 standard. It only adds more functions and data structures without interfering with the original &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; standard.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases are implemented with the reference implementation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;test-code&quot;&gt;Test Code&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5496&#x2F;.&#x2F;assets&#x2F;test&#x2F;test.js&quot;&gt;test.js&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Run in terminal:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;truffle&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; test&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; .&#x2F;test&#x2F;test.js&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5496&#x2F;.&#x2F;assets&#x2F;test&#x2F;testCloneable.js&quot;&gt;testCloneable.js&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Run in terminal:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;truffle&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; test&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; .&#x2F;test&#x2F;testCloneable.js&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC721&#x2F;ERC721.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;utils&#x2F;introspection&#x2F;IERC165.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERC5496.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC5496&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC5496&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PrivilegeRecord&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; user&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; expiresAt&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PrivilegeStorage&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span&gt; lastExpiresAt&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; privId =&amp;gt; PrivilegeRecord&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; PrivilegeRecord&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; privilegeEntry&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; privilegeTotal&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; tokenId =&amp;gt; PrivilegeStorage&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; PrivilegeStorage&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; privilegeBook&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; privilegeDelegator&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; symbol_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    ERC721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;name_,symbol_)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setPrivilege&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; privId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expires&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;hasPrivilege&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; privId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _isApprovedOrOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _isDelegatorOrHolder&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; privId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC721: transfer caller is not owner nor approved&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;expires &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 30&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; days&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;expire time invalid&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;privId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; privilegeTotal&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;invalid privilege id&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        privilegeBook&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;privilegeEntry&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;privId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;user &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; user&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_isApprovedOrOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            privilegeBook&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;privilegeEntry&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;privId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;expiresAt &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; expires&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;privilegeBook&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;lastExpiresAt &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; expires&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                privilegeBook&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;lastExpiresAt &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; expires&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PrivilegeAssigned&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; privId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;privilegeBook&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;privilegeEntry&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;privId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;expiresAt&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; hasPrivilege&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; privId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;privilegeBook&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;privilegeEntry&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;privId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;expiresAt &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; privilegeBook&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;privilegeEntry&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;privId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;user &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; user&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; user&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; privilegeExpires&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; privId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; privilegeBook&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;privilegeEntry&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;privId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;expiresAt&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _setPrivilegeTotal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; total&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PrivilegeTotalChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;total&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; privilegeTotal&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        privilegeTotal &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; total&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getPrivilegeInfo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; privId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expiresAt&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;privilegeBook&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;privilegeEntry&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;privId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; privilegeBook&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;privilegeEntry&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;privId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;expiresAt&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setDelegator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; delegator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; enabled&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        privilegeDelegator&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;delegator&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; enabled&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _isDelegatorOrHolder&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; delegator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; privId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; holder &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; privilegeBook&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;privilegeEntry&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;privId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;user&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;         return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;delegator &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; holder &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isApprovedForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;holder&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; delegator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span&gt; privilegeDelegator&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;holder&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;delegator&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;IERC5496&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Implementations must thoroughly consider who has the permission to set or clone privileges.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Silent Signing Extension for JSON-RPC</title>
        <published>2022-07-26T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Stanley Wu</name><uri>https://github.com/fruit37</uri>
	</author>
	
	<author>
		<name>Mücahit Büyükyılmaz</name><uri>https://github.com/anndro</uri>
	</author>
	
	<author>
		<name>Muhammed Emin Aydın</name><uri>https://github.com/muhammedea</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5345/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/walletconnect-silent-signing-extension/10137" />
        

        <id>https://wg-eips.ritovision.com/5345/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="interface"
                label="Interface" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:5345"
            label="EIP-5345" />
        

        
        

        
        <summary type="html">Temporary transaction signing without user interaction</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5345/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Mobile applications supporting lots of transactions might become a source of bad user experience due to uncontrolled switching between the wallet&#x27;s and application&#x27;s UI. By this proposal, we would like to introduce the means to sign and send wallet transactions without the need for user participation. This feature can be implemented by providing user consent for a specific time duration. We call the feature Silent Signing.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Some blockchain applications interact with a blockchain much more frequently than others. It is especially true for gaming applications having their own sidechains. Interrupting the gaming process and switching to the wallet to perform a transaction drastically affect the user experience.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;To remedy the situation, we&#x27;d like to introduce new RPC methods for the ethereum JSON-RPC. Those methods help enable wallets to implement the Silent Signing feature.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;silent-signing-user-flow&quot;&gt;Silent Signing User Flow&lt;&#x2F;h3&gt;
&lt;p&gt;The Silent Signing process has the following structure:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;First, the application requests the wallet to use Silent Signing via the RPC&#x27;s &lt;code&gt;wallet_requestSilentSign&lt;&#x2F;code&gt; method.&lt;&#x2F;li&gt;
&lt;li&gt;Second, the wallet prompts the user to confirm enabling the Silent Singing functionality for a specific time duration.&lt;&#x2F;li&gt;
&lt;li&gt;If the user does not confirm Silent Signing or the RPC method is not allowed, the application will continue using the regular methods.&lt;&#x2F;li&gt;
&lt;li&gt;If the user confirms Silent Signing, then each subsequent transaction will be sent using the &lt;code&gt;wallet_silentSendTransaction&lt;&#x2F;code&gt; method for the time duration specified.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h3&gt;
&lt;p&gt;The implementation introduces new RPC methods and flow for application and wallet side.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;new-rpc-methods&quot;&gt;New RPC Methods&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;wallet-requestsilentsign&quot;&gt;&lt;code&gt;wallet_requestSilentSign&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;This RPC method opens the wallet and prompts the user to enable automatic signing for a specific time duration. This function grants the application to call the following methods until the timestamp expires. Standard methods like &lt;code&gt;eth_signTrancaction&lt;&#x2F;code&gt; remain untouched.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Parameters&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  Object:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; request&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; object&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    until: NUMBER - unix timesptamp, the &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;end&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; time&lt;&#x2F;span&gt;&lt;span&gt; the permission will be valid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    chainId:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; NUMBER&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; chain&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; id&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; that&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; located&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; in&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    contractAddress:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; ADDRESS&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; of&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; be&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; allowed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    allowedFunctions:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; STRING&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; ARRAY&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; allowed&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; function&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; signatures&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;          Ex:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;equip(address,uint256)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unequip(address,uint256)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    description:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; STRING&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; extra&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; description&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; that&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; can&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; be&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; shown&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; user&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; by&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; wallet&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Returns&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  DATA,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 20&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; Bytes:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; permissionSecret&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; secret&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; for&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; silent-signing&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; requests&lt;&#x2F;span&gt;&lt;span&gt; (randomly&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; generated&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;wallet-silentsigntransaction&quot;&gt;&lt;code&gt;wallet_silentSignTransaction&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;This RPC method creates a transaction and sends its data to the wallet for signing. The wallet signs the data in the background, interfering with no processes the user is involved in. Afterward, the application sends the signed transaction to the blockchain using Nethereum&#x27;s or other libraries&#x27; &lt;code&gt;sendRawTransaction&lt;&#x2F;code&gt; method.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Parameters&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  DATA,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 20&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; Bytes:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; permissionSecret&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; secret&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; obtained&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;wallet_requestSilentSign&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; method&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  Object&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; transaction&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; object&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    from:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; DATA,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 20&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; Bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; transaction&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; sent&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; from.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    to:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; DATA,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 20&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; Bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; (optional&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; when&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; creating&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;) The address the transaction is directed to.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    gas:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; QUANTITY&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; (optional,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; default:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 90000&lt;&#x2F;span&gt;&lt;span&gt;) Integer of the gas provided &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt; the transaction execution. It will return unused gas.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    gasPrice:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; QUANTITY&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; (optional,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; default:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; To-Be-Determined&lt;&#x2F;span&gt;&lt;span&gt;) Integer of the gasPrice used &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt; each paid gas, in Wei.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    value:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; QUANTITY&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; (optional&lt;&#x2F;span&gt;&lt;span&gt;) Integer of the value sent with this transaction, in Wei.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    data:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; DATA&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; compiled&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; code&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; of&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; OR&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; of&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; invoked&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; method&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; and&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; encoded&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; parameters.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    nonce:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; QUANTITY&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; (optional&lt;&#x2F;span&gt;&lt;span&gt;) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Returns&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  DATA,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; signed&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; transaction&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; object.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;wallet-silentsendtransaction&quot;&gt;&lt;code&gt;wallet_silentSendTransaction&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;This RPC method creates a transaction and sends it to the blockchain without interfering with the process the user is involved in.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Parameters&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  DATA,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 20&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; Bytes:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; permissionSecret&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; secret&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; obtained&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;wallet_requestSilentSign&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; method&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  Object&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; transaction&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; object&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    from:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; DATA,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 20&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; Bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; transaction&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; sent&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; from.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    to:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; DATA,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 20&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; Bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; (optional&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; when&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; creating&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;) The address the transaction is directed to.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    gas:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; QUANTITY&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; (optional,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; default:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 90000&lt;&#x2F;span&gt;&lt;span&gt;) Integer of the gas provided &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt; the transaction execution. It will return unused gas.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    gasPrice:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; QUANTITY&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; (optional,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; default:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; To-Be-Determined&lt;&#x2F;span&gt;&lt;span&gt;) Integer of the gasPrice used &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt; each paid gas.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    value:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; QUANTITY&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; (optional&lt;&#x2F;span&gt;&lt;span&gt;) Integer of the value sent with this transaction.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    data:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; DATA&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; compiled&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; code&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; of&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; OR&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; of&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; invoked&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; method&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; and&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; encoded&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; parameters.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    nonce:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; QUANTITY&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; (optional&lt;&#x2F;span&gt;&lt;span&gt;) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Returns&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  DATA,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; Bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; transaction&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; hash,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; or&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; zero&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; if&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; transaction&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; yet&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; available.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;application-and-wallet-communication&quot;&gt;Application and Wallet Communication&lt;&#x2F;h3&gt;
&lt;p&gt;Sending RPC requests between application and wallet can be as usual. For example browser extension wallets can use these new methods easily. Even hardware wallets can implement this too. But for mobile wallets extra communication techniques should be considered. Because mobile wallets can be inactive when it is not in use.&lt;&#x2F;p&gt;
&lt;p&gt;Mobile wallets mostly use Walletconnect protocol. The application closed or active in the background can&#x27;t connect to the Bridge server via WebSocket. Therefore, we have to trigger the wallet to connect to the Bridge and to start waiting for requests. For this purpose, push notifications are to be used. That means that only the wallets supporting push notifications can implement the feature.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5345&#x2F;.&#x2F;assets&#x2F;walletconnect-flow.png&quot; alt=&quot;&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Whenever the wallet receives a push notification, it connects to the Bridge server and gets access to the pending requests. If there are &lt;code&gt;wallet_silenSignTransaction&lt;&#x2F;code&gt; or &lt;code&gt;wallet_silentSendTransaction&lt;&#x2F;code&gt; silent signing requests pending and the interaction with the requesting client has been confirmed for this particular time duration, then the wallet executes the request without interfering with the ongoing user activity.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Games and Metaverse applications imply lots of cases when the user interacts with the wallet, switching to it and approving transactions. This switching aspect might interfere with gaming per se and create a bad user experience. That is why such applications can benefit if the wallets can support the Silent Signing functionality allowing transactions to be signed with no user interaction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;These new RPC methods don&#x27;t interfere with the current ones, and for mobile wallets the push notifications API is currently a part of the &lt;code&gt;WalletConnect&lt;&#x2F;code&gt; specification. Implementing the proposal&#x27;s functionality changes nothing for other applications and wallets.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The proposed feature aims to improve the user experience and can only be enabled with user consent. Users might freely choose to use the application as usual.&lt;&#x2F;p&gt;
&lt;p&gt;Silent Signing permission has restrictions that makes it more secure.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Permission granted only for a specified time duration&lt;&#x2F;li&gt;
&lt;li&gt;Permission granted only for specific contract in a specific chain and restricted to specified functions.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EIP-721 User And Expires And Level Extension</title>
        <published>2022-07-25T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Yan</name><uri>https://github.com/yan253319066</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5334/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-721-user-and-expires-and-level-extension/10097" />
        

        <id>https://wg-eips.ritovision.com/5334/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:5334"
            label="ERC-5334" />
        

        
        

        
        <summary type="html">Add a time-limited role with restricted permissions to EIP-721 tokens.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5334/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;An &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; extension that adds an additional role (&lt;code&gt;user&lt;&#x2F;code&gt;) which can be granted to addresses, and a time where the role is automatically revoked (&lt;code&gt;expires&lt;&#x2F;code&gt;) and (&lt;code&gt;level&lt;&#x2F;code&gt;) . The &lt;code&gt;user&lt;&#x2F;code&gt; role represents permission to &quot;use&quot; the NFT, but not the ability to transfer it or set users.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Some NFTs have certain utilities. For example, virtual land can be &quot;used&quot; to build scenes, and NFTs representing game assets can be &quot;used&quot; in-game. In some cases, the owner and user may not always be the same. There may be an owner of the NFT that rents it out to a “user”. The actions that a “user” should be able to take with an NFT would be different from the “owner” (for instance, “users” usually shouldn’t be able to sell ownership of the NFT).  In these situations, it makes sense to have separate roles that identify whether an address represents an “owner” or a “user” and manage permissions to perform actions accordingly.&lt;&#x2F;p&gt;
&lt;p&gt;Some projects already use this design scheme under different names such as “operator” or “controller” but as it becomes more and more prevalent, we need a unified standard to facilitate collaboration amongst all applications.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore, applications of this model (such as renting) often demand that user addresses have only temporary access to using the NFT. Normally, this means the owner needs to submit two on-chain transactions, one to list a new address as the new user role at the start of the duration and one to reclaim the user role at the end. This is inefficient in both labor and gas and so an “expires” and “level” function is introduced that would facilitate the automatic end of a usage term without the need of a second transaction.&lt;&#x2F;p&gt;
&lt;p&gt;Here are some of the problems that are solved by this standard:&lt;&#x2F;p&gt;
&lt;h3 id=&quot;clear-rights-assignment&quot;&gt;Clear Rights Assignment&lt;&#x2F;h3&gt;
&lt;p&gt;With Dual “owner” and “user” roles, it becomes significantly easier to manage what lenders and borrowers can and cannot do with the NFT (in other words, their rights). Additionally, owners can control who the user is and it’s easy for other projects to assign their own rights to either the owners or the users.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;simple-on-chain-time-management&quot;&gt;Simple On-chain Time Management&lt;&#x2F;h3&gt;
&lt;p&gt;Once a rental period is over, the user role needs to be reset and the “user” has to lose access to the right to use the NFT. This is usually accomplished with a second on-chain transaction but that is gas inefficient and can lead to complications because it’s imprecise. With the &lt;code&gt;expires&lt;&#x2F;code&gt; function, there is no need for another transaction because the “user” is invalidated automatically after the duration is over.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;easy-third-party-integration&quot;&gt;Easy Third-Party Integration&lt;&#x2F;h3&gt;
&lt;p&gt;In the spirit of permission less interoperability, this standard makes it easier for third-party protocols to manage NFT usage rights without permission from the NFT issuer or the NFT application. Once a project has adopted the additional &lt;code&gt;user&lt;&#x2F;code&gt; role and &lt;code&gt;expires&lt;&#x2F;code&gt; and &lt;code&gt;level&lt;&#x2F;code&gt;, any other project can directly interact with these features and implement their own type of transaction. For example, a PFP NFT using this standard can be integrated into both a rental platform where users can rent the NFT for 30 days AND, at the same time, a mortgage platform where users can use the NFT while eventually buying ownership of the NFT with installment payments. This would all be done without needing the permission of the original PFP project.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot; and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;contract-interface&quot;&gt;Contract Interface&lt;&#x2F;h3&gt;
&lt;p&gt;Solidity Interface with NatSpec &amp;amp; OpenZeppelin v4 Interfaces (also available at &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5334&#x2F;.&#x2F;assets&#x2F;IERC5334.sol&quot;&gt;&lt;code&gt;IERC5334.sol&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5334&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Logged when the user of a NFT, expires, or level is &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when the `user` of an NFT or the `expires` of the `user` is &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; or the user `level` is &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The zero address for user indicates that there is no user address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UpdateUser&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expires&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; level&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; set the user and expires and level of a NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The zero address indicates there is no user&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws if `tokenId` is not valid NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; user&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  The new user of the NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; expires&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  UNIX timestamp, The new user could use the NFT before expires&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; level&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; user level&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setUser&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expires&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; level&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the user address of an NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The zero address indicates that there is no user or the user is expired&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT to get the user address for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; user address for this NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; userOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the user expires of an NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The zero value indicates that there is no user&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT to get the user expires for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; user expires for this NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; userExpires&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the user level of an NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The zero value indicates that there is no user&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT to get the user level for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; user level for this NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; userLevel&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;userOf(uint256 tokenId)&lt;&#x2F;code&gt; function MAY be implemented as &lt;code&gt;pure&lt;&#x2F;code&gt; or &lt;code&gt;view&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;userExpires(uint256 tokenId)&lt;&#x2F;code&gt; function MAY be implemented as &lt;code&gt;pure&lt;&#x2F;code&gt; or &lt;code&gt;view&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;userLevel(uint256 tokenId)&lt;&#x2F;code&gt; function MAY be implemented as &lt;code&gt;pure&lt;&#x2F;code&gt; or &lt;code&gt;view&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;setUser(uint256 tokenId, address user, uint64 expires)&lt;&#x2F;code&gt; function MAY be implemented as &lt;code&gt;public&lt;&#x2F;code&gt; or &lt;code&gt;external&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;UpdateUser&lt;&#x2F;code&gt; event MUST be emitted when a user address is changed or the user expires is changed or the user level is changed.&lt;&#x2F;p&gt;
&lt;!-- The `supportsInterface` method MUST return `true` when called with `0xTODO`. --&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;As mentioned in the specifications section, this standard can be fully EIP-721 compatible by adding an extension function set.&lt;&#x2F;p&gt;
&lt;p&gt;In addition, new functions introduced in this standard have many similarities with the existing functions in EIP-721. This allows developers to easily adopt the standard quickly.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;A reference implementation of this standard can be found in the assets folder.&lt;&#x2F;p&gt;
&lt;!-- [.&#x2F;assets&#x2F;ERC5334.sol](.&#x2F;assets&#x2F;ERC5334.sol). --&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP standard can completely protect the rights of the owner, the owner can change the NFT user and expires and level at any time.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EIP-1155 Non-Fungible Token extension</title>
        <published>2022-07-23T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Ronan Sandford</name><uri>https://github.com/wighawag</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5409/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5409-non-fungible-token-extension-for-eip-1155/10240" />
        

        <id>https://wg-eips.ritovision.com/5409/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:5409"
            label="ERC-5409" />
        

        
        

        
        <summary type="html">Allow EIP-1155 to represent Non-Fungible Tokens (tokens who have a unique owner)</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5409/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is an extension of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;EIP-1155&lt;&#x2F;a&gt;. It proposes an additional function, &lt;code&gt;ownerOf&lt;&#x2F;code&gt;, which allows EIP-1155 tokens to support Non-Fungibility (unique owners). By implementing this extra function, EIP-1155 tokens can benefit from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt;&#x27;s core functionality without implementing the (less efficient) EIP-721 specification in the same contract.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, EIP-1155 does not allow an external caller to detect whether a token is truly unique (can have only one owner) or fungible. This is because EIP-1155 do not expose a mechanism to detect whether a token will have its supply remain to be &quot;1&quot;. Furthermore, it does not let an external caller retrieve the owner directly on-chain.&lt;&#x2F;p&gt;
&lt;p&gt;The EIP-1155 specification does mention the use of split id to represent non-fungible tokens, but this requires a pre-established convention that is not part of the standard, and is not as simple as EIP-721&#x27;s &lt;code&gt;ownerOf&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The ability to get the owner of a token enables novel use-cases, including the ability for the owner to associate data with it.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot; and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;contract-interface&quot;&gt;Contract Interface&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC1155OwnerOf&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Find the owner of an NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The zero address indicates that there is no owner: either the token does not exist or it is not an NFT (supply potentially bigger than 1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier for an NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address of the owner of the NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;ownerOf(uint256 tokenId)&lt;&#x2F;code&gt; function MAY be implemented as &lt;code&gt;pure&lt;&#x2F;code&gt; or &lt;code&gt;view&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; method MUST return &lt;code&gt;true&lt;&#x2F;code&gt; when called with &lt;code&gt;0x6352211e&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;ownerOf&lt;&#x2F;code&gt; does not throw when a token does not exist (or does not have an owner). This simplifies the handling of such a case. Since it would be a security risk to assume all EIP-721 implementation would throw, it should not break compatibility with contract handling EIP-721 when dealing with this EIP-1155 extension.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is fully backward compatible with EIP-1155.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Light Contract Ownership</title>
        <published>2022-07-22T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>William Entriken</name><uri>https://github.com/fulldecent</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5313/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5313-light-contract-ownership/10052" />
        

        <id>https://wg-eips.ritovision.com/5313/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:5313"
            label="ERC-5313" />
        

        
        

        
        <summary type="html">An interface for identifying ownership of contracts</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5313/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This specification defines the minimum interface required to identify an account that controls a contract.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This is a slimmed-down alternative to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;173&#x2F;&quot;&gt;EIP-173&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key word “MUST” in this document is to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;Every contract compliant with this EIP MUST implement the &lt;code&gt;EIP5313&lt;&#x2F;code&gt; interface.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.15&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; EIP-5313 Light Contract Ownership Standard&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EIP5313&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the address of the owner    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address of the owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Key factors influencing the standard:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Minimize the number of functions in the interface&lt;&#x2F;li&gt;
&lt;li&gt;Backwards compatibility with existing contracts&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This standard can be (and has been) extended by other standards to add additional ownership functionality. The smaller scope of this specification allows more and more straightforward ownership implementations, see limitations explained in EIP-173 under &quot;other schemes that were considered&quot;.&lt;&#x2F;p&gt;
&lt;p&gt;Implementing &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;EIP-165&lt;&#x2F;a&gt; could be a valuable addition to this interface specification. However, this EIP is being written to codify existing protocols that connect contracts (often NFTs), with third-party websites (often a well-known NFT marketplace).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Every contract that implements EIP-173 already implements this specification.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Because this specification does not extend EIP-165, calling this EIP&#x27;s &lt;code&gt;owner&lt;&#x2F;code&gt; function cannot result in complete certainty that the result is indeed the owner. For example, another function with the same function signature may return some value that is then interpreted to be the true owner. If this EIP is used solely to identify if an account is the owner of a contract, then the impact of this risk is minimized. But if the interrogator is, for example, sending a valuable NFT to the identified owner of any contract on the network, then the risk is heightened.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Token Transfer by Social Recovery</title>
        <published>2022-07-19T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Erhard Dinhobl</name><uri>https://github.com/mrqc</uri>
	</author>
	
	<author>
		<name>Kevin Riedl</name><uri>https://github.com/wsdt</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5883/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5806-delegate-transaction/11409" />
        

        <id>https://wg-eips.ritovision.com/5883/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:5883"
            label="ERC-5883" />
        

        
        

        
        <summary type="html">On-Chain Social Recovery taking users&#x27; reputation into account &amp; using a nearest-neighbour approach.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5883/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP standardizes a mechanism of a social recovery where a token may be transferred from an inaccessible account to a new account, given enough approvals from other identities. This approval is not purely technical, but rather needs human intervention. These humans are - based on the Soul Bound Token proposal - called Souls. When enough Souls give their approval (which is a Yes&#x2F;No decision) and a threshold is reached, a token is transferred from an old to a new identity.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;It is a known problem that the private key of an account can be lost. If that key is lost it&#x27;s not possible to recover the tokens owned by that account. The holder loses those tokens forever. In addition to directly harming the token holder, the entire  ecosystem of the token itself is affected: the more tokens that are lost the less tokens are available for the natural growth and planned evolution of that ecosystem.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.7&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ISocialRecovery&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Related but independent identity approves the transfer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approveTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; User wants to move their onchain identity to another wallet which needs to be approved by n-nearest neighbour identities&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; requestTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addNeighbour&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; neighbour_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; removeNeighbour&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; neighbour_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;The math behind it&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;p&gt;A compliant contract SHOULD calculate the score of a node n with the following formula:&lt;&#x2F;p&gt;
&lt;p&gt;$$ score(n) = tanh({ { {\displaystyle\sum_{i = 1}^{|N|} } {log{(n_i^{r} {1 \over t - n_i^{t} + 1})}} \over{|N| + 1}} + n^{r}}) $$&lt;&#x2F;p&gt;
&lt;p&gt;where:&lt;&#x2F;p&gt;
&lt;p&gt;$t$ is the current time (can be any time-identifying value such as &lt;code&gt;block.timestamp&lt;&#x2F;code&gt;, &lt;code&gt;block.number&lt;&#x2F;code&gt;, etc.)&lt;&#x2F;p&gt;
&lt;p&gt;$n^{r}$ is the reward count of the node n&lt;&#x2F;p&gt;
&lt;p&gt;$N$ is the list of neighbours of n&lt;&#x2F;p&gt;
&lt;p&gt;$n_i^{r}$ is the reward count of neighbour node i from n&lt;&#x2F;p&gt;
&lt;p&gt;$n_i^{t}$ is the last timestamp (where a reward was booked on that account) of neighbour node i from n&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Flows&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5883&#x2F;.&#x2F;assets&#x2F;sequence-diagram.svg&quot; alt=&quot;Approval of asset movement&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The formula proposed was deemed very resilient and provides a coherent incentivation structure to actually see value in the on-chain score. The formula adds weights based on scores based on time which further contributes to the fairness of the metric.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;We currently do not see any mechanism of preventing a user of getting a lot of rewards. Sure, a high reward is bound to a lot of investment but the person who wants to get that reward amount and has a enough money will reach it. The only thing which could be improved is that we somehow find a mechanism really identify users bound to an address. We thought about having a kind of a hashing mechanism which hashes a real world object which could be fuzzy (for sure!) and generates a hash out of it which is the same based on the fuzzy set.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;We implemented a threshold which must be reached to make a social token transfer possible. Currently there is no experience which defines a &quot;good&quot; or &quot;bad&quot; threshold hence we tried to find a first value. This can or must be adjusted based on future experience.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Another problem we see is that the network of the neighbours is not active anymore to reach the necessary minimum threshold. Which means that due to not being able to reach the minimum amount of approvals a user gets stuck with the e.g. social token transfer he&#x2F;she wants to perform. Hence the contract lives from its usage and if it tends to be not used anymore it will get useless.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Semaphore for Reentrancy Protection</title>
        <published>2022-07-17T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Sergio D. Lerner</name><uri>https://github.com/SergioDemianLerner</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5283/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5283-a-semaphore-for-parallelizable-reentrancy-protection/10236" />
        

        <id>https://wg-eips.ritovision.com/5283/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:5283"
            label="EIP-5283" />
        

        
        

        
        <summary type="html">A Precompile-based parallelizable reentrancy protection using the call stack</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5283/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes adding a precompiled contract that provides a semaphore function for creating a new type of reentrancy protection guard (RPG). This function aims to replace the typical RPG based on modifying a contract storage cell. The benefit is that the precompile-based RPG does not write to storage, and therefore it enables contracts to be forward-compatible with all designs that provide fine-grained (i.e. cell level) parallelization for the multi-threaded execution of EVM transactions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The typical smart contract RPG uses a contract storage cell. The algorithm is simple: the code checks that a storage cell is 0 (or any other predefined constant) on entry, aborting if not, and then sets it to 1. After executing the required code, it resets the cell back to 0 before exiting. This is the algorithm implemented in OpenZeppelin&#x27;s ReentrancyGuard. The algorithm results in a read-write pattern on the RPG&#x27;s storage cell. This pattern prevents the parallelization of the execution of the smart contract for all known designs that try to provide fine-grained parallelization (detecting conflicts at the storage cell level).&lt;&#x2F;p&gt;
&lt;p&gt;Several EVM-based blockchains have successfully tested designs for the parallelization of the EVM. The best results have been obtained with fine-grained parallelization where conflicts are detected by tracking writes and reads of individual storage cells. The designs based on tracking the use of accounts or contracts provide only minor benefits because most transactions use the same &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;EIP-20&lt;&#x2F;a&gt; contracts.&lt;&#x2F;p&gt;
&lt;p&gt;To summarize, the only available RPG construction today is based on using a contract storage cell. This construction is clean but it is not forward-compatible with transaction execution parallelization.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Starting from an activation block (TBD) a new precompiled contract &lt;code&gt;Semaphore&lt;&#x2F;code&gt; is created at address &lt;code&gt;0x0A&lt;&#x2F;code&gt;. When &lt;code&gt;Semaphore&lt;&#x2F;code&gt; is called, if the caller address is present more than once in the call stack, the contract behaves as if the first instruction had been a &lt;code&gt;REVERT&lt;&#x2F;code&gt;, therefore the CALL returns 0. Otherwise, it executes no code and returns 1. The gas cost of the contract execution is set to 100, which is consumed independently of the call result.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The address &lt;code&gt;0x0A&lt;&#x2F;code&gt; is the next one available within the range defined by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1352&#x2F;&quot;&gt;EIP-1352&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;sample-usage&quot;&gt;Sample usage&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;abstract&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ReentrancyGuard2&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; SemaphoreAddress &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x0A&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Prevents a contract from calling itself, directly or indirectly.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Calling a `nonReentrant` function from another `nonReentrant`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * function is supported.      &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    modifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; nonReentrant&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _nonReentrantBefore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        _&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _nonReentrantBefore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    	assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; iszero&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;staticcall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;SemaphoreAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;  0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                revert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;parallelizable-storage-based-rpgs&quot;&gt;Parallelizable storage-based RPGs&lt;&#x2F;h3&gt;
&lt;p&gt;The only way to parallelize preexistent contracts that are using the storage RPG construction is that the VM automatically detects that a storage variable is used for the RPG, and proves that it works as required. This requires static code analysis. This is difficult to implement in consensus for two reasons. First, the CPU cost of detection and&#x2F;or proving may be high. Second, some contract functions may not be protected by the RPG, meaning that some execution paths do not alter the RPG, which may complicate proving. Therefore this proposal aims to protect future contracts and let them be parallelizable, rather than to parallelize already deployed ones.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;alternatives&quot;&gt;Alternatives&lt;&#x2F;h3&gt;
&lt;p&gt;There are alternative designs to implement RPGs on the EVM:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Transient storage opcodes (&lt;code&gt;TLOAD&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;TSTORE&lt;&#x2F;code&gt;) provide contract state that is kept between calls in the same transaction but it is not committed to the world state afterward. These opcodes also enable fine-grained parallelization.&lt;&#x2F;li&gt;
&lt;li&gt;An opcode &lt;code&gt;SSTORE_COUNT&lt;&#x2F;code&gt; that retrieves the number of &lt;code&gt;SSTORE&lt;&#x2F;code&gt; instructions executed. It enables also fine-grained execution parallelization, but &lt;code&gt;SSTORE_COUNT&lt;&#x2F;code&gt; is much more complex to use correctly as it returns the number &lt;code&gt;SSTORE&lt;&#x2F;code&gt; opcodes executed, not the number of reentrant calls. Reentrancy must be deducted from this value.&lt;&#x2F;li&gt;
&lt;li&gt;A new &lt;code&gt;LOCKCALL&lt;&#x2F;code&gt; opcode that works similar to &lt;code&gt;STATICALL&lt;&#x2F;code&gt; but only blocks storage writes in the caller contract. This results in cheaper RPG, but it doesn&#x27;t allow some contract functions to be free of the RPG.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;All these alternative proposals have the downside that they create new opcodes, and this is discouraged if the same functionality can be implemented with the same gas cost using precompiles. A new opcode requires modifying compilers, debuggers and static analysis tools.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-cost&quot;&gt;Gas cost&lt;&#x2F;h3&gt;
&lt;p&gt;A gas cost of 100 represents a worst-case resource consumption, which occurs when the stack is almost full (approximately 400 addresses) and it is fully scanned. As the stack is always present in RAM, the scanning is fast.&lt;&#x2F;p&gt;
&lt;p&gt;Note: Once code is implemented in geth, it can be benchmarked and the cost can be re-evaluated, as it may result to be lower in practice. As a precompile call currently costs 700 gas, the cost of stack scanning has a low impact on the total cost of the precompile call (800 gas in total).&lt;&#x2F;p&gt;
&lt;p&gt;The storage-based RPG currently costs 200 gas (because of the savings introduced in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1283&#x2F;&quot;&gt;EIP-1283&lt;&#x2F;a&gt;. Using the &lt;code&gt;Semaphore&lt;&#x2F;code&gt; precompile as a reentrancy check would currently cost 800 gas (a single call from one of the function modifiers). While this cost is higher than the traditional RPG cost and therefore discourages its use, it is still much lower than the pre-EIP-1283 cost. If a reduction in precompile call cost is implemented, then the cost of using the &lt;code&gt;Semaphore&lt;&#x2F;code&gt; precompile will be reduced to approximately 140 gas, below the current 200 gas consumed by a storage-based RPG. To encourage to use of the precompile-based RPG, it is suggested that this EIP is implemented together with a reduction in precompile calls cost.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change requires a hard fork and therefore all full nodes must be updated.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Test&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ReentrancyGuard2&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; second&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; nonReentrant&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; first&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; nonReentrant&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;second&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;A call to &lt;code&gt;second()&lt;&#x2F;code&gt; directly from a transaction does not revert, but a call to &lt;code&gt;first()&lt;&#x2F;code&gt; does revert.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Ethereum Notary Interface</title>
        <published>2022-07-16T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Gavin John</name><uri>https://github.com/Pandapip1</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5289/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/pr-5289-discussion-notary-interface/9980" />
        

        <id>https://wg-eips.ritovision.com/5289/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:5289"
            label="ERC-5289" />
        

        
        

        
        <summary type="html">Allows Smart Contracts to be Legally Binding Off-Chain</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5289/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, the real-world applications of smart contracts are limited by the fact that they aren&#x27;t legally binding. This EIP proposes a standard that allows smart contracts to be legally binding by providing IPFS links to legal documents and ensuring that the users of the smart contract have privity with the relevant legal documents.&lt;&#x2F;p&gt;
&lt;p&gt;Please note that the authors are not lawyers, and that this EIP is not legal advice.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;NFTs have oftentimes been branded as a way to hold and prove copyright of a specific work. However, this, in practice, has almost never been the case. Most of the time, NFTs have no legally-binding meaning, and in the rare cases that do, the NFT simply provides a limited license for the initial holder to use the work (but cannot provide any license for any future holders).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;legal-contract-library-interface&quot;&gt;Legal Contract Library Interface&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERC165.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5289Library&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC165&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when signDocument is called&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DocumentSigned&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signer&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint16&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; documentId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An immutable link to the legal document (RECOMMENDED to be hosted on IPFS). This MUST use a common file format, such as PDF, HTML, TeX, or Markdown.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; legalDocument&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint16&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; documentId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns whether or not the given user signed the document.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; documentSigned&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint16&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; documentId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signed&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns when the given user signed the document.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If the user has not signed the document, the timestamp may be anything.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; documentSignedAt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint16&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; documentId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; timestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sign a document&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This MUST be validated by the smart contract. This MUST emit DocumentSigned or throw.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; signDocument&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint16&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; documentId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;requesting-a-signature&quot;&gt;Requesting a Signature&lt;&#x2F;h3&gt;
&lt;p&gt;To request that certain documents be signed, revert with an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5568&#x2F;&quot;&gt;ERC-5568&lt;&#x2F;a&gt; signal. The format of the &lt;code&gt;instruction_data&lt;&#x2F;code&gt; is an ABI-encoded &lt;code&gt;(address, uint16)&lt;&#x2F;code&gt; pair, where the address is the address of the library, and the &lt;code&gt;uint16&lt;&#x2F;code&gt; is the &lt;code&gt;documentId&lt;&#x2F;code&gt; of the document:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;throw&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; WalletSignal24&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 5289&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xcbd99eb81b2d8ca256bb6a5b0ef7db86489778a7&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 12345&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;signing-a-document&quot;&gt;Signing a Document&lt;&#x2F;h3&gt;
&lt;p&gt;When a signature is requested, wallets MUST call &lt;code&gt;legalDocument&lt;&#x2F;code&gt;, display the resulting document to the user, and prompt them to either sign the document or cancel:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5289&#x2F;.&#x2F;assets&#x2F;example-popup.png&quot; alt=&quot;image&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;If the user agrees, the wallet MUST call &lt;code&gt;signDocument&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;uint64&lt;&#x2F;code&gt; was chosen for the timestamp return type as 64-bit time registers are standard.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;uint16&lt;&#x2F;code&gt; was chosen for the document ID as 65536 documents are likely sufficient for any use case, and the contract can always be re-deployed.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;signDocument&lt;&#x2F;code&gt; doesn&#x27;t take an ECDSA signature for future compatibility with account abstraction. In addition, future extensions can supply this functionality.&lt;&#x2F;li&gt;
&lt;li&gt;IPFS is mandatory because the authenticity of the signed document can be proven.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backwards compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;legal-contract-library&quot;&gt;Legal Contract Library&lt;&#x2F;h3&gt;
&lt;p&gt;See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5289&#x2F;.&#x2F;assets&#x2F;interfaces&#x2F;IERC5289Library.sol&quot;&gt;&lt;code&gt;IERC5289Library&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5289&#x2F;.&#x2F;assets&#x2F;ERC5289Library.sol&quot;&gt;&lt;code&gt;ERC5289Library&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Users can claim that their private key was stolen and used to fraudulently &quot;sign&quot; contracts. As such, &lt;strong&gt;documents must only be permissive in nature, not restrictive.&lt;&#x2F;strong&gt; For example, a document granting a license to use the image attached to an NFT would be acceptable, as there is no reason for the signer to plausibly deny signing the document.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>ERC Detection and Discovery</title>
        <published>2022-07-15T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Zainan Victor Zhou</name><uri>https://github.com/xinbenlv</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5269/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc5269-human-readable-interface-detection/9957" />
        

        <id>https://wg-eips.ritovision.com/5269/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:5269"
            label="ERC-5269" />
        

        
        

        
        <summary type="html">An interface to identify if major behavior or optional behavior specified in an ERC is supported for a given caller.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5269/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;An interface for better identification and detection of ERC by numbers.
It designates a field in which it&#x27;s called &lt;code&gt;majorERCIdentifier&lt;&#x2F;code&gt; which is normally known or referred to as &quot;ERC number&quot;. For example, &lt;code&gt;ERC-721&lt;&#x2F;code&gt; aka &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; has a &lt;code&gt;majorERCIdentifier = 721&lt;&#x2F;code&gt;. This ERC has a &lt;code&gt;majorERCIdentifier = 5269&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Calling it a &lt;code&gt;majorERCIdentifier&lt;&#x2F;code&gt; instead of &lt;code&gt;ERCNumber&lt;&#x2F;code&gt; makes it future-proof: anticipating there is a possibility where future ERC is not numbered or if we want to incorporate other types of standards.&lt;&#x2F;p&gt;
&lt;p&gt;It also proposes a new concept of &lt;code&gt;minorERCIdentifier&lt;&#x2F;code&gt; which is left for authors of
individual ERC to define. For example, ERC-721&#x27;s author may define &lt;code&gt;ERC721Metadata&lt;&#x2F;code&gt;
interface as &lt;code&gt;minorERCIdentifier= keccak256(&quot;ERC721Metadata&quot;)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;It also proposes an event to allow smart contracts to optionally declare the ERCs they support.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC is created as a competing standard for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Here are the major differences between this ERC and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; uses the hash of a method&#x27;s signature which declares the existence of one method or multiple methods,
therefore it requires at least one method to &lt;em&gt;exist&lt;&#x2F;em&gt; in the first place. In some cases, some ERCs interface does not have a method, such as some ERCs related to data format and signature schemes or the &quot;Soul-Bound-ness&quot; aka SBT which could just revert a transfer call without needing any specific method.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; doesn&#x27;t provide query ability based on the caller.
The compliant contract of this ERC will respond to whether it supports certain ERC &lt;em&gt;based on&lt;&#x2F;em&gt; a given caller.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Here is the motivation for this ERC given ERC-165 already exists:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Using ERC numbers improves human readability as well as make it easier to work with named contract such as ENS.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Instead of using an ERC-165 identifier, we have seen an increasing interest to use ERC numbers as the way to identify or specify an ERC. For example&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5267&#x2F;&quot;&gt;ERC-5267&lt;&#x2F;a&gt; specifies &lt;code&gt;extensions&lt;&#x2F;code&gt; to be a list of ERC numbers.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;600&#x2F;&quot;&gt;ERC-600&lt;&#x2F;a&gt;, and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;601&#x2F;&quot;&gt;ERC-601&lt;&#x2F;a&gt; specify an &lt;code&gt;ERC&lt;&#x2F;code&gt; number in the &lt;code&gt;m &#x2F; purpose&#x27; &#x2F; subpurpose&#x27; &#x2F; ERC&#x27; &#x2F; wallet&#x27;&lt;&#x2F;code&gt; path.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5568&#x2F;&quot;&gt;ERC-5568&lt;&#x2F;a&gt; specifies &lt;code&gt;The instruction_id of an instruction defined by an ERC MUST be its ERC number unless there are exceptional circumstances (be reasonable)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6120&#x2F;&quot;&gt;ERC-6120&lt;&#x2F;a&gt; specifies &lt;code&gt;struct Token { uint eip; ..., }&lt;&#x2F;code&gt; where &lt;code&gt;uint eip&lt;&#x2F;code&gt; is an ERC number to identify ERCs.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ERC-867&lt;&#x2F;code&gt;(Stagnant) proposes to create &lt;code&gt;erpId: A string identifier for this ERP (likely the associated ERC number, e.g. “ERC-1234”).&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;ol start=&quot;3&quot;&gt;
&lt;li&gt;
&lt;p&gt;Having an ERC&#x2F;ERC number detection interface reduces the need for a lookup table in smart contract to
convert a function method or whole interface in any ERC in the bytes4 ERC-165 identifier into its respective ERC number and massively simplifies the way to specify ERC for behavior expansion.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;We also recognize a smart contract might have different behavior given different caller accounts. One of the most notable use cases is that when using Transparent Upgradable Pattern, a proxy contract gives an Admin account and Non-Admin account different treatment when they call.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;In the following description, we use ERC and ERC inter-exchangeably. This was because while most of the time the description applies to an ERC category of the Standards Track of ERC, the ERC number space is a subspace of ERC number space and we might sometimes encounter ERCs that aren&#x27;t recognized as ERCs but has behavior that&#x27;s worthy of a query.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Any compliant smart contract MUST implement the following interface&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; DRAFTv1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.9&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5269&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OnSupportERC&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; caller&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span&gt;&#x2F;&#x2F; &lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;when&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; emitted&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; with&lt;&#x2F;span&gt;&lt;span&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;` means all callers&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span&gt; majorERCIdentifier&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span&gt; minorERCIdentifier&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0 means the entire ERC&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      bytes32&lt;&#x2F;span&gt;&lt;span&gt; ercStatus&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      bytes&lt;&#x2F;span&gt;&lt;span&gt; extraData&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The core method of ERC Interface Detection&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; caller&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;, a `address` value of the address of a caller being queried whether the given ERC is supported.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; majorERCIdentifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;, a `uint256` value and SHOULD BE the ERC number being queried. Unless superseded by future ERC, such ERC number SHOULD BE less or equal to (0, 2^32-1]. For a function call to `supportERC`, any value outside of this range is deemed unspecified and open to implementation&amp;#39;s choice or for future ERCs to specify.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; minorERCIdentifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;, a `bytes32` value reserved for authors of individual ERC to specify. For example the author of [ERC-721](&#x2F;ERCS&#x2F;eip-721) MAY specify `keccak256(&amp;quot;ERC721Metadata&amp;quot;)` or `keccak256(&amp;quot;ERC721Metadata.tokenURI&amp;quot;)` as `minorERCIdentifier` to be quired for support. Author could also use this minorERCIdentifier to specify different versions, such as ERC-712 has its V1-V4 with different behavior.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; extraData&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;, a `bytes` for [ERC-5750](&#x2F;ERCS&#x2F;eip-5750) for future extensions.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ercStatus&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;, a `bytes32` indicating the status of ERC the contract supports.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                    - For FINAL ERCs, it MUST return `keccak256(&amp;quot;FINAL&amp;quot;)`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                    - For non-FINAL ERCs, it SHOULD return `keccak256(&amp;quot;DRAFT&amp;quot;)`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                      During ERC procedure, ERC authors are allowed to specify their own&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                      ercStatus other than `FINAL` or `DRAFT` at their discretion such as `keccak256(&amp;quot;DRAFTv1&amp;quot;)`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                      or `keccak256(&amp;quot;DRAFT-option1&amp;quot;)`and such value of ercStatus MUST be documented in the ERC body&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportERC&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; caller&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; majorERCIdentifier&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; minorERCIdentifier&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; extraData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ercStatus&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In the following description, &lt;code&gt;ERC_5269_STATUS&lt;&#x2F;code&gt; is set to be &lt;code&gt;keccak256(&quot;DRAFTv1&quot;)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;In addition to the behavior specified in the comments of &lt;code&gt;IERC5269&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Any &lt;code&gt;minorERCIdentifier=0&lt;&#x2F;code&gt; is reserved to be referring to the main behavior of the ERC being queried.&lt;&#x2F;li&gt;
&lt;li&gt;The Author of compliant ERC is RECOMMENDED to declare a list of &lt;code&gt;minorERCIdentifier&lt;&#x2F;code&gt; for their optional interfaces, behaviors and value range for future extension.&lt;&#x2F;li&gt;
&lt;li&gt;When this ERC is FINAL, any compliant contract MUST return an &lt;code&gt;ERC_5269_STATUS&lt;&#x2F;code&gt; for the call of &lt;code&gt;supportERC((any caller), 5269, 0, [])&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;em&gt;Note&lt;&#x2F;em&gt;: at the current snapshot, the &lt;code&gt;supportERC((any caller), 5269, 0, [])&lt;&#x2F;code&gt; MUST return &lt;code&gt;ERC_5269_STATUS&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;ol start=&quot;4&quot;&gt;
&lt;li&gt;Any complying contract SHOULD emit an &lt;code&gt;OnSupportERC(address(0), 5269, 0, ERC_5269_STATUS, [])&lt;&#x2F;code&gt; event upon construction or upgrade.&lt;&#x2F;li&gt;
&lt;li&gt;Any complying contract MAY declare for easy discovery any ERC main behavior or sub-behaviors by emitting an event of &lt;code&gt;OnSupportERC&lt;&#x2F;code&gt; with relevant values and when the compliant contract changes whether the support an ERC or certain behavior for a certain caller or all callers.&lt;&#x2F;li&gt;
&lt;li&gt;For any &lt;code&gt;ERC-XXX&lt;&#x2F;code&gt; that is NOT in &lt;code&gt;Final&lt;&#x2F;code&gt; status, when querying the &lt;code&gt;supportERC((any caller), xxx, (any minor identifier), [])&lt;&#x2F;code&gt;, it MUST NOT return &lt;code&gt;keccak256(&quot;FINAL&quot;)&lt;&#x2F;code&gt;. It is RECOMMENDED to return &lt;code&gt;0&lt;&#x2F;code&gt; in this case but other values of &lt;code&gt;ercStatus&lt;&#x2F;code&gt; is allowed. Caller MUST treat any returned value other than &lt;code&gt;keccak256(&quot;FINAL&quot;)&lt;&#x2F;code&gt; as non-final, and MUST treat 0 as strictly &quot;not supported&quot;.&lt;&#x2F;li&gt;
&lt;li&gt;The function &lt;code&gt;supportERC&lt;&#x2F;code&gt; MUST be mutability &lt;code&gt;view&lt;&#x2F;code&gt;, i.e. it MUST NOT mutate any global state of EVM.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;When data type &lt;code&gt;uint256 majorERCIdentifier&lt;&#x2F;code&gt;, there are other alternative options such as:&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;ul&gt;
&lt;li&gt;(1) using a hashed version of the ERC number,&lt;&#x2F;li&gt;
&lt;li&gt;(2) use a raw number, or&lt;&#x2F;li&gt;
&lt;li&gt;(3) use an ERC-165 identifier.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The pros for (1) are that it automatically supports any evolvement of future ERC numbering&#x2F;naming conventions.
But the cons are it&#x27;s not backward readable: seeing a &lt;code&gt;hash(ERC-number)&lt;&#x2F;code&gt; one usually can&#x27;t easily guess what their ERC number is.&lt;&#x2F;p&gt;
&lt;p&gt;We choose the (2) in the rationale laid out in motivation.&lt;&#x2F;p&gt;
&lt;ol start=&quot;2&quot;&gt;
&lt;li&gt;
&lt;p&gt;We have a &lt;code&gt;bytes32 minorERCIdentifier&lt;&#x2F;code&gt; in our design decision. Alternatively, it could be (1) a number, forcing all ERC authors to define its numbering for sub-behaviors so we go with a &lt;code&gt;bytes32&lt;&#x2F;code&gt; and ask the ERC authors to use a hash for a string name for their sub-behaviors which they are already doing by coming up with interface name or method name in their specification.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Alternatively, it&#x27;s possible we add extra data as a return value or an array of all ERC being supported but we are unsure how much value this complexity brings and whether the extra overhead is justified.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Compared to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt;, we also add an additional input of &lt;code&gt;address caller&lt;&#x2F;code&gt;, given the increasing popularity of proxy patterns such as those enabled by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1967&#x2F;&quot;&gt;ERC-1967&lt;&#x2F;a&gt;. One may ask: why not simply use &lt;code&gt;msg.sender&lt;&#x2F;code&gt;? This is because we want to allow query them without transaction or a proxy contract to query whether interface ERC-&lt;code&gt;number&lt;&#x2F;code&gt; will be available to that particular sender.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;We reserve the input &lt;code&gt;majorERCIdentifier&lt;&#x2F;code&gt; greater than or equals &lt;code&gt;2^32&lt;&#x2F;code&gt; in case we need to support other collections of standards which is not an ERC&#x2F;ERC.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;describe&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ERC5269&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;  async&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; deployFixture&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  describe&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Deployment&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    it&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Should emit proper OnSupportERC events&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; async&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      let&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; txDeployErc721&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; loadFixture&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;deployFixture&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; events&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; txDeployErc721&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;events&lt;&#x2F;span&gt;&lt;span&gt;?.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;filter&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; event&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ===&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;OnSupportERC&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;events&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;have&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;lengthOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ev5269&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; events&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;filter&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;event&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; event&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;args&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;majorERCIdentifier&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;eq&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;5269&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;ev5269&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;have&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;lengthOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;ev5269&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;args&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;caller&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;BigNumber&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;ev5269&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;args&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;minorERCIdentifier&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;BigNumber&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;ev5269&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;args&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;ercStatus&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;ethers&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;utils&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;DRAFTv1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ev721&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; events&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;filter&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;event&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; event&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;args&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;majorERCIdentifier&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;eq&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;721&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;ev721&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;have&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;lengthOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;ev721&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;args&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;caller&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;BigNumber&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;ev721&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;args&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;minorERCIdentifier&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;BigNumber&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;ev721&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;args&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;ercStatus&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;ethers&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;utils&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;FINAL&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;ev721&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;args&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;caller&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;BigNumber&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;ev721&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;args&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;minorERCIdentifier&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;ethers&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;utils&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ERC721Metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;ev721&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;args&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;ercStatus&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;ethers&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;utils&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;FINAL&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    it&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Should return proper ercStatus value when called supportERC() for declared supported ERC&#x2F;features&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; async&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      let&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; erc721ForTesting&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; loadFixture&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;deployFixture&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; erc721ForTesting&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportERC&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 5269&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ethers&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;utils&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;hexZeroPad&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x00&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;ethers&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;utils&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;DRAFTv1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; erc721ForTesting&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportERC&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 721&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ethers&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;utils&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;hexZeroPad&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x00&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;ethers&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;utils&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;FINAL&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; erc721ForTesting&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportERC&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 721&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ethers&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;utils&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ERC721Metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;ethers&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;utils&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;FINAL&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; erc721ForTesting&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportERC&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 721&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ethers&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;utils&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;WRONG FEATURE&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;BigNumber&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; erc721ForTesting&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportERC&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 9999&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ethers&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;utils&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;hexZeroPad&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x00&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;BigNumber&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    it&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Should return zero as ercStatus value when called supportERC() for non declared ERC&#x2F;features&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; async&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      let&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; erc721ForTesting&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; loadFixture&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;deployFixture&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; erc721ForTesting&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportERC&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 721&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ethers&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;utils&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;WRONG FEATURE&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;BigNumber&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; erc721ForTesting&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportERC&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 9999&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ethers&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;utils&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;hexZeroPad&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x00&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;BigNumber&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5269&#x2F;.&#x2F;assets&#x2F;test&#x2F;TestERC5269.ts&quot;&gt;&lt;code&gt;TestERC5269.ts&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Here is a reference implementation for this ERC:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC5269&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5269&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; ERC_STATUS &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;DRAFTv1&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OnSupportERC&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 5269&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; ERC_STATUS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _supportERC&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;caller&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; majorERCIdentifier&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; minorERCIdentifier&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;extraData&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ercStatus&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;majorERCIdentifier &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 5269&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;minorERCIdentifier &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                return&lt;&#x2F;span&gt;&lt;span&gt; ERC_STATUS&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportERC&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; caller&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; majorERCIdentifier&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; minorERCIdentifier&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; extraData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ercStatus&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _supportERC&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;caller&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; majorERCIdentifier&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; minorERCIdentifier&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; extraData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5269&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;ERC5269.sol&quot;&gt;&lt;code&gt;ERC5269.sol&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Here is an example where a contract of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; also implement this ERC to make it easier
to detect and discover:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC721&#x2F;ERC721.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;..&#x2F;ERC5269.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721ForTesting&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC5269&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; ERC_FINAL &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;FINAL&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;&amp;quot;ERC721ForTesting&amp;quot;, &amp;quot;E721FT&amp;quot;) &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC5269&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;) &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OnSupportERC&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 721&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; ERC_FINAL&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OnSupportERC&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 721&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;ERC721Metadata&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; ERC_FINAL&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OnSupportERC&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 721&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;ERC721Enumerable&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; ERC_FINAL&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportERC&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; caller&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; majorERCIdentifier&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; minorERCIdentifier&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; extraData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  override&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ercStatus&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;majorERCIdentifier &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 721&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;minorERCIdentifier &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;FINAL&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;minorERCIdentifier &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;ERC721Metadata&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;FINAL&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;minorERCIdentifier &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;ERC721Enumerable&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;FINAL&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_supportERC&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;caller&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; majorERCIdentifier&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; minorERCIdentifier&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; extraData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5269&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;testing&#x2F;ERC721ForTesting.sol&quot;&gt;&lt;code&gt;ERC721ForTesting.sol&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Similar to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; callers of the interface MUST assume the smart contract
declaring they support such ERC interfaces doesn&#x27;t necessarily correctly support them.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Retrieval of EIP-712 domain</title>
        <published>2022-07-14T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Francisco Giordano</name><uri>https://github.com/frangio</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5267/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5267-retrieval-of-eip-712-domain/9951" />
        

        <id>https://wg-eips.ritovision.com/5267/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:5267"
            label="ERC-5267" />
        

        
        

        
        <summary type="html">A way to describe and retrieve an EIP-712 domain to securely integrate EIP-712 signatures.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5267/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP complements &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; by standardizing how contracts should publish the fields and values that describe their domain. This enables applications to retrieve this description and generate appropriate domain separators in a general way, and thus integrate EIP-712 signatures securely and scalably.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;EIP-712 is a signature scheme for complex structured messages. In order to avoid replay attacks and mitigate phishing, the scheme includes a &quot;domain separator&quot; that makes the resulting signature unique to a specific domain (e.g., a specific contract) and allows user-agents to inform end users the details of what is being signed and how it may be used. A domain is defined by a data structure with fields from a predefined set, all of which are optional, or from extensions. Notably, EIP-712 does not specify any way for contracts to publish which of these fields they use or with what values. This has likely limited adoption of EIP-712, as it is not possible to develop general integrations, and instead applications find that they need to build custom support for each EIP-712 domain. A prime example of this is &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2612&#x2F;&quot;&gt;EIP-2612&lt;&#x2F;a&gt; (permit), which has not been widely adopted by applications even though it is understood to be a valuable improvement to the user experience. The present EIP defines an interface that can be used by applications to retrieve a definition of the domain that a contract uses to verify EIP-712 signatures.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;Compliant contracts MUST define &lt;code&gt;eip712Domain&lt;&#x2F;code&gt; exactly as declared below. All specified values MUST be returned even if they are not used, to ensure proper decoding on the client side.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; eip712Domain&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes1&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; fields&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; version&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; chainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; verifyingContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; salt&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; extensions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The return values of this function MUST describe the domain separator that is used for verification of EIP-712 signatures in the contract. They describe both the form of the &lt;code&gt;EIP712Domain&lt;&#x2F;code&gt; struct (i.e., which of the optional fields and extensions are present) and the value of each field, as follows.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;fields&lt;&#x2F;code&gt;: A bit map where bit &lt;code&gt;i&lt;&#x2F;code&gt; is set to 1 if and only if domain field &lt;code&gt;i&lt;&#x2F;code&gt; is present (&lt;code&gt;0 ≤ i ≤ 4&lt;&#x2F;code&gt;). Bits are read from least significant to most significant, and fields are indexed in the order that is specified by EIP-712, identical to the order in which they are listed in the function type.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;name&lt;&#x2F;code&gt;, &lt;code&gt;version&lt;&#x2F;code&gt;, &lt;code&gt;chainId&lt;&#x2F;code&gt;, &lt;code&gt;verifyingContract&lt;&#x2F;code&gt;, &lt;code&gt;salt&lt;&#x2F;code&gt;: The value of the corresponding field in &lt;code&gt;EIP712Domain&lt;&#x2F;code&gt;, if present according to &lt;code&gt;fields&lt;&#x2F;code&gt;. If the field is not present, the value is unspecified. The semantics of each field is defined in EIP-712.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;extensions&lt;&#x2F;code&gt;: A list of EIP numbers, each of which MUST refer to an EIP that extends EIP-712 with new domain fields, along with a method to obtain the value for those fields, and potentially conditions for inclusion. The value of &lt;code&gt;fields&lt;&#x2F;code&gt; does not affect their inclusion.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The return values of this function (equivalently, its EIP-712 domain) MAY change throughout the lifetime of a contract, but changes SHOULD NOT be frequent. The &lt;code&gt;chainId&lt;&#x2F;code&gt; field, if used, SHOULD change to mirror the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt; id of the underlying chain. Contracts MAY emit the event &lt;code&gt;EIP712DomainChanged&lt;&#x2F;code&gt; defined below to signal that the domain could have changed.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EIP712DomainChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;A notable application of EIP-712 signatures is found in EIP-2612 (permit), which specifies a &lt;code&gt;DOMAIN_SEPARATOR&lt;&#x2F;code&gt; function that returns a &lt;code&gt;bytes32&lt;&#x2F;code&gt; value (the actual domain separator, i.e., the result of &lt;code&gt;hashStruct(eip712Domain)&lt;&#x2F;code&gt;). This value does not suffice for the purposes of integrating with EIP-712, as the RPC methods defined there receive an object describing the domain and not just the separator in hash form. Note that this is not a flaw of the RPC methods, it is indeed part of the security proposition that the domain should be validated and informed to the user as part of the signing process. On its own, a hash does not allow this to be implemented, given it is opaque. The present EIP fills this gap in both EIP-712 and EIP-2612.&lt;&#x2F;p&gt;
&lt;p&gt;Extensions are described by their EIP numbers because EIP-712 states: &quot;Future extensions to this standard can add new fields [...] new fields should be proposed through the EIP process.&quot;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This is an optional extension to EIP-712 that does not introduce backwards compatibility issues.&lt;&#x2F;p&gt;
&lt;p&gt;Upgradeable contracts that make use of EIP-712 signatures MAY be upgraded to implement this EIP.&lt;&#x2F;p&gt;
&lt;p&gt;User-agents or applications that use this EIP SHOULD additionally support those contracts that due to their immutability cannot be upgraded to implement it. The simplest way to achieve this is to hardcode common domains based on contract address and chain id. However, it is also possible to implement a more general solution by guessing possible domains based on a few common patterns using the available information, and selecting the one whose hash matches a &lt;code&gt;DOMAIN_SEPARATOR&lt;&#x2F;code&gt; or &lt;code&gt;domainSeparator&lt;&#x2F;code&gt; function in the contract.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;solidity-example&quot;&gt;Solidity Example&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EIP712VerifyingContract&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; eip712Domain&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      bytes1&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; fields&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; version&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; chainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; verifyingContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; salt&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; extensions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;0d&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 01101&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;          &amp;quot;Example&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;          &amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;          block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;chainid&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;          new&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[](&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This contract&#x27;s domain only uses the fields &lt;code&gt;name&lt;&#x2F;code&gt;, &lt;code&gt;chainId&lt;&#x2F;code&gt;, and &lt;code&gt;verifyingContract&lt;&#x2F;code&gt;, therefore the &lt;code&gt;fields&lt;&#x2F;code&gt; value is &lt;code&gt;01101&lt;&#x2F;code&gt;, or &lt;code&gt;0d&lt;&#x2F;code&gt; in hexadecimal.&lt;&#x2F;p&gt;
&lt;p&gt;Assuming this contract is on Ethereum mainnet and its address is 0x0000000000000000000000000000000000000001, the domain it describes is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;  n&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;m&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Example&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;  c&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;h&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;I&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;d&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;  v&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;y&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;g&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;javascript&quot;&gt;JavaScript&lt;&#x2F;h3&gt;
&lt;p&gt;A domain object can be constructed based on the return values of an &lt;code&gt;eip712Domain()&lt;&#x2F;code&gt; invocation.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieves the EIP-712 domain of a contract using EIP-5267 without extensions. &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;async&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getDomain&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; fields&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; version&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; chainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; verifyingContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; salt&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; extensions&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;eip712Domain&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;extensions&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    throw&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Error&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Extensions not implemented&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; buildBasicDomain&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;fields&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; version&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; chainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; verifyingContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; salt&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; fieldNames&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;verifyingContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;salt&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Builds a domain object without extensions based on the return values of `eip712Domain()`. &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; buildBasicDomain&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;fields&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; version&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; chainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; verifyingContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; salt&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; domain&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; version&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; chainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; verifyingContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; salt&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; field&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; of&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; fieldNames&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;entries&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      delete&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; domain&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;field&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; domain&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;extensions&quot;&gt;Extensions&lt;&#x2F;h4&gt;
&lt;p&gt;Suppose EIP-XYZ defines a new field &lt;code&gt;subdomain&lt;&#x2F;code&gt; of type &lt;code&gt;bytes32&lt;&#x2F;code&gt; and a function &lt;code&gt;getSubdomain()&lt;&#x2F;code&gt; to retrieve its value.&lt;&#x2F;p&gt;
&lt;p&gt;The function &lt;code&gt;getDomain&lt;&#x2F;code&gt; from above would be extended as follows.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieves the EIP-712 domain of a contract using EIP-5267 with support for EIP-XYZ. &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;async&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getDomain&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; fields&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; version&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; chainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; verifyingContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; salt&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; extensions&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;eip712Domain&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; domain&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; buildBasicDomain&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;fields&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; version&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; chainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; verifyingContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; salt&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; of&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; extensions&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ===&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; XYZ&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      domain&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;subdomain&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getSubdomain&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      throw&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Error&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;EIP-&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; extension not implemented&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; domain&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Additionally, the type of the &lt;code&gt;EIP712Domain&lt;&#x2F;code&gt; struct needs to be extended with the &lt;code&gt;subdomain&lt;&#x2F;code&gt; field. This is left out of scope of this reference implementation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;While this EIP allows a contract to specify a &lt;code&gt;verifyingContract&lt;&#x2F;code&gt; other than itself, as well as a &lt;code&gt;chainId&lt;&#x2F;code&gt; other than that of the current chain, user-agents and applications should in general validate that these do match the contract and chain before requesting any user signatures for the domain. This may not always be a valid assumption.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Smart Contract Executable Proposal Interface</title>
        <published>2022-07-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Zainan Victor Zhou</name><uri>https://github.com/xinbenlv</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5247/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-5247-executable-proposal-standard/9938" />
        

        <id>https://wg-eips.ritovision.com/5247/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        

        
        <category
            term="tag:eip:5247"
            label="ERC-5247" />
        

        
        

        
        <summary type="html">An interface to create and execute proposals.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5247/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP presents an interface for &quot;smart contract executable proposals&quot;: proposals that are submitted to, recorded on, and possibly executed on-chain. Such proposals include a series of information about
function calls including the target contract address, ether value to be transmitted, gas limits and calldatas.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;It is oftentimes necessary to separate the code that is to be executed from the actual execution of the code.&lt;&#x2F;p&gt;
&lt;p&gt;A typical use case for this EIP is in a Decentralized Autonomous Organization (DAO). A proposer will create a smart proposal and advocate for it. Members will then choose whether or not to endorse the proposal and vote accordingly (see &lt;code&gt;ERC-1202&lt;&#x2F;code&gt;). Finallym when consensus has been formed, the proposal is executed.&lt;&#x2F;p&gt;
&lt;p&gt;A second typical use-case is that one could have someone who they trust, such as a delegator, trustee, or an attorney-in-fact, or any bilateral collaboration format, where a smart proposal will be first composed, discussed, approved in some way, and then put into execution.&lt;&#x2F;p&gt;
&lt;p&gt;A third use-case is that a person could make an &quot;offer&quot; to a second person, potentially with conditions. The smart proposal can be presented as an offer and the second person can execute it if they choose to accept this proposal.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: MIT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.17&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5247&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ProposalCreated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; proposer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; proposalId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; targets&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; values&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; gasLimits&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; calldatas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; extraParams&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ProposalExecuted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; executor&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; proposalId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; extraParams&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; createProposal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; proposalId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; targets&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; values&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; gasLimits&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; calldatas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; extraParams&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; registeredProposalId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; executeProposal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; proposalId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; extraParams&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Originally, this interface was part of part of &lt;code&gt;ERC-1202&lt;&#x2F;code&gt;. However, the proposal itself can potentially have many use cases outside of voting. It is possible that voting may not need to be upon a proposal in any particular format. Hence, we decide to &lt;em&gt;decouple the voting interface and proposal interface&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Arrays were used for &lt;code&gt;target&lt;&#x2F;code&gt;s, &lt;code&gt;value&lt;&#x2F;code&gt;s, &lt;code&gt;calldata&lt;&#x2F;code&gt;s instead of single variables, allowing a proposal to carry arbitrarily long multiple functional calls.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;registeredProposalId&lt;&#x2F;code&gt; is returned in &lt;code&gt;createProposal&lt;&#x2F;code&gt; so the standard can support implementation to decide their own format of proposal id.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;A simple test case can be found as&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        it&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Should work for a simple case&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; async&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            const&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; erc721&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; loadFixture&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;deployFixture&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; callData1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; erc721&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodeFunctionData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;mint&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; callData2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; erc721&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodeFunctionData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;mint&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;connect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                .&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;createProposal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;                    0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;erc721&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; erc721&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    [&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    [&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;callData1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; callData2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; erc721&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;connect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;executeProposal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; erc721&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5247&#x2F;.&#x2F;assets&#x2F;testProposalRegistry.ts&quot;&gt;testProposalRegistry.ts&lt;&#x2F;a&gt; for the whole testset.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;A simple reference implementation can be found.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; createProposal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; proposalId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; targets&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; values&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; gasLimits&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; calldatas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; extraParams&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; registeredProposalId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;targets&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; values&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;GeneralForwarder: targets and values length mismatch&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;targets&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; gasLimits&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;GeneralForwarder: targets and gasLimits length mismatch&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;targets&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; calldatas&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;GeneralForwarder: targets and calldatas length mismatch&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        registeredProposalId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; proposalCount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        proposalCount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        proposals&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;registeredProposalId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Proposal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            by&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            proposalId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; proposalId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            targets&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; targets&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            values&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; values&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            calldatas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; calldatas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            gasLimits&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; gasLimits&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ProposalCreated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; proposalId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; targets&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; values&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; gasLimits&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; calldatas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; extraParams&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; registeredProposalId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; executeProposal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; proposalId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; extraParams&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        Proposal &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;storage&lt;&#x2F;span&gt;&lt;span&gt; proposal &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; proposals&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;proposalId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; targets &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; proposal&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;targets&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; errorMessage &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Governor: call reverted without message&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; targets&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt; success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; returndata&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; proposal&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;targets&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;call&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; proposal&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;values&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;proposal&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;calldatas&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            Address&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;verifyCallResult&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; returndata&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; errorMessage&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ProposalExecuted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; proposalId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; extraParams&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5247&#x2F;.&#x2F;assets&#x2F;ProposalRegistry.sol&quot;&gt;ProposalRegistry.sol&lt;&#x2F;a&gt; for more information.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>ENS Trust to hold NFTs under ENS name</title>
        <published>2022-07-12T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Zainan Victor Zhou</name><uri>https://github.com/xinbenlv</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5298/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-eip-5198-ens-as-token-holder/10374" />
        

        <id>https://wg-eips.ritovision.com/5298/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:5298"
            label="ERC-5298" />
        

        
        

        
        <summary type="html">An interface for a smart contract acting as a &quot;trust&quot; that holds tokens by ENS name.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5298/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP standardizes an interface for smart contracts to hold of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;EIP-1155&lt;&#x2F;a&gt; tokens on behalf of ENS domains.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, if someone wants to receive a token, they have to set up a wallet address. This EIP decouples NFT ownership from wallet addresses.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;Compliant contracts MUST implement &lt;code&gt;ERC721TokenReceiver&lt;&#x2F;code&gt;, as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Compliant contracts implement the following interface:&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC_ENS_TRUST&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721Receiver&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC1155Receiver&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; claimTo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ensNode&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ol start=&quot;3&quot;&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;claimTo&lt;&#x2F;code&gt; MUST check if &lt;code&gt;msg.sender&lt;&#x2F;code&gt; is the owner of the ENS node identified by &lt;code&gt;bytes32 ensNode&lt;&#x2F;code&gt; (and&#x2F;or approved by the domain in implementation-specific ways). The compliant contract then MUST make a call to the &lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt; function of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;EIP-1155&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Any &lt;code&gt;ensNode&lt;&#x2F;code&gt; is allowed.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;ENS was chosen because it is a well-established scoped ownership namespace.
This is nonetheless compatible with other scoped ownership namespaces.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;We didn&#x27;t expose getters or setters for ensRoot because it is outside of the scope of this EIP.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues were found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; loadFixture&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;@nomicfoundation&#x2F;hardhat-network-helpers&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; expect&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;chai&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ethers&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;hardhat&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;describe&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;FirstENSBankAndTrust&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    describe&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Receive and Claim Token&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        it&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Should ACCEPT&#x2F;REJECT claimTo based on if ENS owner is msg.sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; async&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Steps of testing:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; mint to charlie&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; charlie send to ENSTrust and recorded under bob.xinbenlvethsf.eth&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; bob try to claimTo alice, first time it should be rejected&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; bob then set the ENS record&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; bob claim to alice, second time it should be accepted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; mint to charlie&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; erc721ForTesting&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;charlie&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; fakeTokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; charlie send to ENSTrust and recorded under bob.xinbenlvethsf.eth&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; erc721ForTesting&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;connect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;charlie&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;safeTransferFrom(address,address,uint256,bytes)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;                charlie&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; firstENSBankAndTrust&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;                fakeTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;                fakeReceiverENSNamehash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; bob try to claimTo alice, first time it should be rejected&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            await&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;firstENSBankAndTrust&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;connect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;bob&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;claimTo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;                alice&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;                fakeReceiverENSNamehash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;                firstENSBankAndTrust&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;                fakeTokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                )&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                .&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;be&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;rejectedWith&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ENSTokenHolder: node not owned by sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; bob then set the ENS record&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ensForTesting&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;setOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;                fakeReceiverENSNamehash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bob&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; bob claim to alice, second time it should be accepted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            await&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;firstENSBankAndTrust&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;connect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;bob&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;claimTo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;                alice&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;                fakeReceiverENSNamehash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;                erc721ForTesting&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;                fakeTokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.9&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FirstENSBankAndTrust&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC721Receiver&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Ownable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getENS&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;ENS&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ENS&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ensAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setENS&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newENSAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ensAddress &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; newENSAddress&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @dev This function is called by the owner of the token to approve the transfer of the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @param data MUST BE the ENS node of the intended token receiver this ENSHoldingServiceForNFT is holding on behalf of.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onERC721Received&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ENSTokenHolder: last data field must be ENS node.&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; --- START WARNING ---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; DO NOT USE THIS IN PROD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; this is just a demo purpose of using extraData for node information&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; In prod, you should use a struct to store the data. struct should clearly identify the data is for ENS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; rather than anything else.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; ensNode &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; --- END OF WARNING ---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        addToHolding&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ensNode&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; conduct the book keeping&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; ERC721_RECEIVER_MAGICWORD&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; claimTo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ensNode&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getENS&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ensNode&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ENSTokenHolder: node not owned by sender&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        removeFromHolding&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ensNode&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        IERC721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenContract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;safeTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>ERC-1155 Allowance Extension</title>
        <published>2022-07-11T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Iván Mañús</name><uri>https://github.com/ivanmmurciaua</uri>
	</author>
	
	<author>
		<name>Juan Carlos Cantó</name><uri>https://github.com/EscuelaCryptoES</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5216/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-erc1155-approval-by-amount/9898" />
        

        <id>https://wg-eips.ritovision.com/5216/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="last-call"
                label="Last Call" />
            
        

        
        <category
            term="tag:eip:5216"
            label="ERC-5216" />
        

        
        

        
        <summary type="html">Extension for ERC-1155 secure approvals</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5216/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC defines standard functions for granular approval of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; tokens by both &lt;code&gt;id&lt;&#x2F;code&gt; and &lt;code&gt;amount&lt;&#x2F;code&gt;. This ERC extends &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt;&#x27;s popularity means that multi-token management transactions occur on a daily basis. Although it can be used as a more comprehensive alternative to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;, ERC-1155 is most commonly used as intended: creating multiple &lt;code&gt;id&lt;&#x2F;code&gt;s, each with multiple tokens. While many projects interface with these semi-fungible tokens, by far the most common interactions are with NFT marketplaces.&lt;&#x2F;p&gt;
&lt;p&gt;Due to the nature of the blockchain, programming errors or malicious operators can cause permanent loss of funds. It is therefore essential that transactions are as trustless as possible. ERC-1155 uses the &lt;code&gt;setApprovalForAll&lt;&#x2F;code&gt; function, which approves ALL tokens with a specific &lt;code&gt;id&lt;&#x2F;code&gt;. This system has obvious minimum required trust flaws. This ERC combines ideas from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; in order to create a trust mechanism where an owner can allow a third party, such as a marketplace, to approve a limited (instead of unlimited) number of tokens of one &lt;code&gt;id&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;Contracts using this ERC MUST implement the &lt;code&gt;IERC5216&lt;&#x2F;code&gt; interface.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;interface-implementation&quot;&gt;Interface implementation&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-1155 Allowance Extension&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0x1be07d74&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5216&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC1155&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * `id` and with an amount: `amount`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Approval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Grants permission to `operator` to transfer the caller&amp;#39;s tokens, according to `id`, and an amount: `amount`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Emits an {Approval} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - `operator` cannot be the caller.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the amount allocated to `operator` approved to transfer `account`&amp;#39;s tokens, according to `id`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; allowance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;approve(address operator, uint256 id, uint256 amount)&lt;&#x2F;code&gt; function MUST be either &lt;code&gt;public&lt;&#x2F;code&gt; or &lt;code&gt;external&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;allowance(address account, address operator, uint256 id)&lt;&#x2F;code&gt; function MUST be either &lt;code&gt;public&lt;&#x2F;code&gt; or &lt;code&gt;external&lt;&#x2F;code&gt; and MUST be &lt;code&gt;view&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;safeTrasferFrom&lt;&#x2F;code&gt; function (as defined by ERC-1155) MUST:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Not revert if the user has approved &lt;code&gt;msg.sender&lt;&#x2F;code&gt; with a sufficient &lt;code&gt;amount&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Subtract the transferred amount of tokens from the approved amount if &lt;code&gt;msg.sender&lt;&#x2F;code&gt; is not approved with &lt;code&gt;setApprovalForAll&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In addition, the &lt;code&gt;safeBatchTransferFrom&lt;&#x2F;code&gt; MUST:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Add an extra condition that checks if the &lt;code&gt;allowance&lt;&#x2F;code&gt; of all &lt;code&gt;ids&lt;&#x2F;code&gt; have the approved &lt;code&gt;amounts&lt;&#x2F;code&gt; (See &lt;code&gt;_checkApprovalForBatch&lt;&#x2F;code&gt; function reference implementation)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;code&gt;Approval&lt;&#x2F;code&gt; event MUST be emitted when a certain number of tokens are approved.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; method MUST return &lt;code&gt;true&lt;&#x2F;code&gt; when called with &lt;code&gt;0x1be07d74&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The name &quot;ERC-1155 Allowance Extension&quot; was chosen because it is a succinct description of this ERC. Users can approve their tokens by &lt;code&gt;id&lt;&#x2F;code&gt; and &lt;code&gt;amount&lt;&#x2F;code&gt; to &lt;code&gt;operator&lt;&#x2F;code&gt;s.&lt;&#x2F;p&gt;
&lt;p&gt;By having a way to approve and revoke in a manner similar to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;, the trust level can be more directly managed by users:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Using the &lt;code&gt;approve&lt;&#x2F;code&gt; function, users can approve an operator to spend an &lt;code&gt;amount&lt;&#x2F;code&gt; of tokens for each &lt;code&gt;id&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Using the &lt;code&gt;allowance&lt;&#x2F;code&gt; function, users can see the approval that an operator has for each &lt;code&gt;id&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; name patterns were used due to similarities with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; approvals.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The reference implementation can be found &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5216&#x2F;.&#x2F;assets&#x2F;ERC5216.sol&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Users of this ERC must thoroughly consider the amount of tokens they give permission to &lt;code&gt;operators&lt;&#x2F;code&gt;, and should revoke unused authorizations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>NFT Rights Management</title>
        <published>2022-07-11T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>James Grimmelmann</name><uri>https://github.com/grimmelm</uri>
	</author>
	
	<author>
		<name>Yan Ji</name><uri>https://github.com/iseriohn</uri>
	</author>
	
	<author>
		<name>Tyler Kell</name><uri>https://github.com/relyt29</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5218/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5218-nft-rights-management/9911" />
        

        <id>https://wg-eips.ritovision.com/5218/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:5218"
            label="ERC-5218" />
        

        
        

        
        <summary type="html">An interface for creating copyright licenses that transfer with an NFT.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5218/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The following standard defines an API for managing NFT licenses. This standard provides basic functionality to create, transfer, and revoke licenses, and to determine the current licensing state of an NFT. The standard does not define the legal details of the license. Instead, it provides a structured framework for recording licensing details.&lt;&#x2F;p&gt;
&lt;p&gt;We consider use cases of NFT creators who wish to give the NFT holder a copyright license to use a work associated with the NFT. The holder of an active license can issue sublicenses to others to carry out the rights granted under the license. The license can be transferred with the NFT, so do all the sublicenses. The license can optionally be revoked under conditions specified by the creator.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; standard defines an API to track and transfer ownership of an NFT. When an NFT is to represent some off-chain asset, however, we would need some legally effective mechanism to &lt;em&gt;tether&lt;&#x2F;em&gt; the on-chain asset (NFT) to the off-chain property. One important case of off-chain property is creative work such as an image or music file. Recently, most NFT projects involving creative works have used licenses to clarify what legal rights are granted to the NFT owner. But these licenses are almost always off-chain and the NFTs themselves do not indicate what licenses apply to them, leading to uncertainty about rights to use the work associated with the NFT. It is not a trivial task to avoid all the copyright vulnerabilities in NFTs, nor have existing EIPs addressed rights management of NFTs beyond the simple cases of direct ownership (see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;) or rental (see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4907&#x2F;&quot;&gt;ERC-4907&lt;&#x2F;a&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;This EIP attempts to provide a standard to facilitate rights management of NFTs in the world of Web3. In particular, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5218&#x2F;&quot;&gt;ERC-5218&lt;&#x2F;a&gt; smart contracts allow all licenses to an NFT, including the &lt;em&gt;root license&lt;&#x2F;em&gt; issued to the NFT owner and &lt;em&gt;sublicenses&lt;&#x2F;em&gt; granted by a license holder, to be recorded and easily tracked with on-chain data. These licenses can consist of human-readable legal code, machine-readable summaries such as those written in CC REL, or both. An ERC-5218 smart contract points to a license by recording a URI, providing a reliable reference for users to learn what legal rights they are granted and for NFT creators and auditors to detect unauthorized infringing uses.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Every ERC-5218 compliant contract &lt;em&gt;must&lt;&#x2F;em&gt; implement the &lt;code&gt;IERC5218&lt;&#x2F;code&gt; interface&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-5218: NFT Rights Management&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5218&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC721&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when a new license is created by any mechanism.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CreateLicense&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _licenseId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _parentLicenseId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _licenseHolder&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _uri&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _revoker&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when a license is revoked. &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; that under some&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  license terms, the sublicenses may be `implicitly` revoked following the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  revocation of some ancestral license. In that case, your smart contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  may only emit this event once for the ancestral license, and the revocation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  of all its sublicenses can be implied without consuming additional gas.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RevokeLicense&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _licenseId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when the a license is transferred to a new holder. The&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  root license of an NFT should be transferred with the NFT in an ERC721&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  `transfer` function call. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransferLicense&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _licenseId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _licenseHolder&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check if a license is active.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A non-existing or revoked license is inactive and this function must&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  return `false` upon it. Under some license terms, a license may become&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  inactive because some ancestral license has been revoked. In that case,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  this function should return `false`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _licenseId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier for the queried license&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Whether&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the queried license is active&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isLicenseActive&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _licenseId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieve the token identifier a license was issued upon.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws unless the license is active.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _licenseId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier for the queried license&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; token identifier the queried license was issued upon&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getLicenseTokenId&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _licenseId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieve the parent license identifier of a license.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws unless the license is active. If a license doesn&amp;#39;t have a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  parent license, return a special identifier not referring to any license&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  (such as 0).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _licenseId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier for the queried license&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; parent license identifier of the queried license&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getParentLicenseId&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _licenseId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieve the holder of a license.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws unless the license is active.   &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _licenseId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier for the queried license&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; holder address of the queried license&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getLicenseHolder&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _licenseId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieve the URI of a license.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws unless the license is active.   &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _licenseId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier for the queried license&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; URI of the queried license&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getLicenseURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _licenseId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieve the revoker address of a license.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws unless the license is active.   &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _licenseId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier for the queried license&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; revoker address of the queried license&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getLicenseRevoker&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _licenseId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieve the root license identifier of an NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws unless the queried NFT exists. If the NFT doesn&amp;#39;t have a root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  license tethered to it, return a special identifier not referring to any&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  license (such as 0).   &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier for the queried NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; root license identifier of the queried NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getLicenseIdByTokenId&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Create a new license.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws unless the NFT `_tokenId` exists. Throws unless the parent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  license `_parentLicenseId` is active, or `_parentLicenseId` is a special&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  identifier not referring to any license (such as 0) and the NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  `_tokenId` doesn&amp;#39;t have a root license tethered to it. Throws unless the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  message sender is eligible to create the license, i.e., either the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  license to be created is a root license and `msg.sender` is the NFT owner,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  or the license to be created is a sublicense and `msg.sender` is the holder&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  of the parent license. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier for the NFT the license is issued upon&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _parentLicenseId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier for the parent license&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _licenseHolder&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the license holder&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _uri&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The URI of the license terms&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _revoker&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The revoker address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; identifier of the created license&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; createLicense&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _parentLicenseId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _licenseHolder&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _uri&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _revoker&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Revoke a license.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws unless the license is active and the message sender is the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  eligible revoker. This function should be used for revoking both root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  licenses and sublicenses. &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; that if a root license is revoked, the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  NFT should be transferred back to its creator.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _licenseId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier for the queried license&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revokeLicense&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _licenseId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfer a sublicense.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws unless the sublicense is active and `msg.sender` is the license&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  holder. &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; that the root license of an NFT should be tethered to and&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  transferred with the NFT. Whenever an NFT is transferred by calling the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  ERC721 `transfer` function, the holder of the root license should be&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;  changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; to the new NFT owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _licenseId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier for the queried license&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _licenseHolder&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The new license holder&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferSublicense&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _licenseId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _licenseHolder&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Licenses to an NFT in general have a tree structure as below:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5218&#x2F;.&#x2F;assets&#x2F;license-tree.png&quot; alt=&quot;The license tree&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;There is one root license to the NFT itself, granting the NFT owner some rights to the linked work. The NFT owner (i.e., the root license holder) may create sublicenses, holders of which may also create sublicenses recursively.&lt;&#x2F;p&gt;
&lt;p&gt;The full log of license creation, transfer, and revocation &lt;em&gt;must&lt;&#x2F;em&gt; be traceable via event logs. Therefore, all license creations and transfers &lt;em&gt;must&lt;&#x2F;em&gt; emit a corresponding log event. Revocation may differ a bit. An implementation of this EIP may emit a &lt;code&gt;Revoke&lt;&#x2F;code&gt; event only when a license is revoked in a function call, or for every revoked license, both are sufficient to trace the status of all licenses. The former costs less gas if revoking a license automatically revokes all sublicenses under it, while the latter is efficient in terms of interrogation of a license status. Implementers should make the tradeoffs depending on their license terms.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;revoker&lt;&#x2F;code&gt; of a license may be the licensor, the license holder, or a smart contract address which calls the &lt;code&gt;revokeLicense&lt;&#x2F;code&gt; function when some conditions are met. Implementers should be careful with the authorization, and may make the &lt;code&gt;revoker&lt;&#x2F;code&gt; smart contract forward compatible with transfers by not hardcoding the addresses of &lt;code&gt;licensor&lt;&#x2F;code&gt; or &lt;code&gt;licenseHolder&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The license &lt;code&gt;URI&lt;&#x2F;code&gt; may point to a JSON file that conforms to the &quot;ERC-5218 Metadata JSON Schema&quot; as below, which adopts the &quot;three-layer&quot; design of the Creative Commons Licenses:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;License Metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;legal-code&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The legal code of the license.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;human-readable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The human readable license deed.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;machine-readable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The machine readable code of the license that can be recognized by software, such as CC REL.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note that this EIP doesn&#x27;t include a function to update license URI so the license terms should be persistent by default. It is recommended to store the license metadata on a decentralized storage service such as IPFS or adopt the IPFS-style URI which encodes the hash of the metadata for integrity verification. On the other hand, license updatability, if necessary in certain scenarios, can be realized by revoking the original license and creating a new license, or adding a updating function, the eligibile caller of which must be carefully specified in the license and securely implemented in the smart contract.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; method MUST return &lt;code&gt;true&lt;&#x2F;code&gt; when called with &lt;code&gt;0xac7b5ca9&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP aims to allow tracing all licenses to an NFT to facilitate right management. The ERC-721 standard only logs the property but not the legal rights tethered to NFTs. Even when logging the license via the optional ERC-721 Metadata extension, sublicenses are not traceable, which doesn&#x27;t comply with the transparency goals of Web3. Some implementations attempt to get around this limitation by minting NFTs to represent a particular license, such as the BAYC #6068 Royalty-Free Usage License. This is not an ideal solution because the linking between different licenses to an NFT is ambiguous. An auditor has to investigate all NFTs in the blockchain and inspect the metadata which hasn&#x27;t been standardized in terms of sublicense relationship. To avoid these problems, this EIP logs all licenses to an NFT in a tree data structure, which is compatible with ERC-721 and allows efficient traceability.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP attempts to tether NFTs with copyright licenses to the creative work by default and is not subject to the high legal threshold for copyright ownership transfers which require an explicit signature from the copyright owner. To transfer and track copyright ownership, one may possibly integrate ERC-5218 and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5289&#x2F;&quot;&gt;ERC-5289&lt;&#x2F;a&gt; after careful scrutinizing and implement a smart contract that atomically (1) signs the legal contract via ERC-5289, and (2) transfers the NFT together with the copyright ownership via ERC-5218. Either both take place or both revert.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is compatible with the current ERC-721 standards: a contract can inherit from both ERC-721 and ERC-5218 at the same time.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases are available &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5218&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;test&#x2F;Contract.t.sol&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;A reference implementation maintains the following data structures:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; License&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bool&lt;&#x2F;span&gt;&lt;span&gt; active&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; whether the license is active&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the identifier of the NFT the license is tethered to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; parentLicenseId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the identifier of the parent license&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; licenseHolder&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the license holder&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span&gt; uri&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the license URI&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; revoker&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the license revoker&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; License&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _licenses&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; maps from a license identifier to a license object&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _licenseIds&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; maps from an NFT to its root license identifier&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Each NFT has a license tree and starting from each license, one can trace back to the root license via &lt;code&gt;parentLicenseId&lt;&#x2F;code&gt; along the path.&lt;&#x2F;p&gt;
&lt;p&gt;In the reference implementation, once a license is revoked, all sublicenses under it are revoked. This is realized in a &lt;em&gt;lazy&lt;&#x2F;em&gt; manner for lower gas cost, i.e., assign &lt;code&gt;active=false&lt;&#x2F;code&gt; only for licenses that are explicitly revoked in a &lt;code&gt;revokeLicense&lt;&#x2F;code&gt; function call. Therefore, &lt;code&gt;isLicenseActive&lt;&#x2F;code&gt; returns &lt;code&gt;true&lt;&#x2F;code&gt; only if all its ancestral licenses haven&#x27;t been revoked.&lt;&#x2F;p&gt;
&lt;p&gt;For non-root licenses, the creation, transfer and revocation are straightforward:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Only the holder of an active license can create sublicenses.&lt;&#x2F;li&gt;
&lt;li&gt;Only the holder of an active license can transfer it to a different license holder.&lt;&#x2F;li&gt;
&lt;li&gt;Only the revoker of an active license can revoke it.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The root license must be compatible with &lt;code&gt;ERC-721&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;When an NFT is minted, a license is granted to the NFT owner.&lt;&#x2F;li&gt;
&lt;li&gt;When an NFT is transferred, the license holder is changed to the new owner of the NFT.&lt;&#x2F;li&gt;
&lt;li&gt;When a root license is revoked, the NFT is returned to the NFT creator, and the NFT creator may later transfer it to a new owner with a new license.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The complete implementation can be found &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5218&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;src&#x2F;RightsManagement.sol&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;In addition, the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5218&#x2F;.&#x2F;assets&#x2F;ic3license&#x2F;ic3license.pdf&quot;&gt;Token-Bound NFT License&lt;&#x2F;a&gt; is specifically designed to work with this interface and provides a reference to the language of NFT licenses.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Implementors of the &lt;code&gt;IERC5218&lt;&#x2F;code&gt; standard must consider thoroughly the permissions they give to &lt;code&gt;licenseHolder&lt;&#x2F;code&gt; and &lt;code&gt;revoker&lt;&#x2F;code&gt;. If the license is ever to be transferred to a different license holder, the &lt;code&gt;revoker&lt;&#x2F;code&gt; smart contract should not hardcode the &lt;code&gt;licenseHolder&lt;&#x2F;code&gt; address to avoid undesirable scenarios.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Contract Resource Requests</title>
        <published>2022-07-10T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Gavin John</name><uri>https://github.com/Pandapip1</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5219/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/pr-5219-discussion-contract-rest/9907" />
        

        <id>https://wg-eips.ritovision.com/5219/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:5219"
            label="ERC-5219" />
        

        
        

        
        <summary type="html">Allows the requesting of resources from contracts</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5219/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP standardizes an interface to make resource requests to smart contracts and to receive HTTP-like responses.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Ethereum is the most-established blockchain for building decentralized applications (referred to as &lt;code&gt;DApp&lt;&#x2F;code&gt;s). Due to this, the Ethereum DApp ecosystem is very diverse. However, one issue that plagues DApps is the fact that they are not fully decentralized. Specifically, to interface a &quot;decentralized&quot; application, one first needs to access a &lt;em&gt;centralized&lt;&#x2F;em&gt; website containing the DApp&#x27;s front-end code, presenting a few issues. The following are some risks associated with using centralized websites to interface with decentralized applications:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Trust Minimization: An unnecessarily large number of entities need to be trusted&lt;&#x2F;li&gt;
&lt;li&gt;Censorship: A centralized website is not resistant to being censored&lt;&#x2F;li&gt;
&lt;li&gt;Permanence: The interface may not have a mechanism that permits it to be permanently stored&lt;&#x2F;li&gt;
&lt;li&gt;Interoperability: Smart Contracts cannot directly interact with DApp interfaces&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;name-resolution&quot;&gt;Name Resolution&lt;&#x2F;h3&gt;
&lt;p&gt;EIPs that propose a name resolution mechanism MAY reference this EIP and MAY recommend that clients support their mechanism. Clients MAY also support regular DNS, as defined in RFC 1034 and RFC 1035.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;separation-of-concerns&quot;&gt;Separation of Concerns&lt;&#x2F;h3&gt;
&lt;p&gt;It is RECOMMENDED to separate the application logic from the front-end logic (the contract implementing the interface defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5219&#x2F;#contract-interface&quot;&gt;Contract Interface&lt;&#x2F;a&gt;).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;contract-interface&quot;&gt;Contract Interface&lt;&#x2F;h3&gt;
&lt;p&gt;DApp contracts MUST implement the interface defined in the following file: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5219&#x2F;.&#x2F;assets&#x2F;IDecentralizedApp.sol&quot;&gt;Contract Interface&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;note-to-implementers&quot;&gt;Note to Implementers&lt;&#x2F;h3&gt;
&lt;p&gt;To save gas costs, it is recommended to use the &lt;code&gt;message&#x2F;external-body&lt;&#x2F;code&gt; MIME-type, which allows you to point to data that the smart contract might not have access to. For example, the following response would tell a client to fetch the data off of IPFS:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tatusCode&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 200&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;b&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ody&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; T&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;HIS IS NOT REALLY THE BODY!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;h&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;eaders&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; k&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ey&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; C&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ontent-type&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;    v&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;alue&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; m&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;essage&#x2F;external-body; access-type=URL; URL=&amp;quot;ipfs:&#x2F;&#x2F;11148a173fd3e32c0fa78b90fe42d305f202244e2739&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;request&lt;&#x2F;code&gt; method was chosen to be readonly because all data should be sent to the contract from the parsed DApp. Here are some reasons why:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Submitting a transaction to send a request would be costly and would require waiting for the transaction to be mined, resulting in bad user experience.&lt;&#x2F;li&gt;
&lt;li&gt;Complicated front-end logic should not be stored in the smart contract, as it would be costly to deploy and would be better run on the end-user&#x27;s machine.&lt;&#x2F;li&gt;
&lt;li&gt;Separation of Concerns: the front-end contract shouldn&#x27;t have to worry about interacting with the back-end smart contract.&lt;&#x2F;li&gt;
&lt;li&gt;Other EIPs can be used to request state changing operations in conjunction with a &lt;code&gt;307 Temporary Redirect&lt;&#x2F;code&gt; status code.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Instead of mimicking a full HTTP request, a highly slimmed version was chosen for the following reasons:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The only particularly relevant HTTP method is &lt;code&gt;GET&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Query parameters can be encoded in the resource.&lt;&#x2F;li&gt;
&lt;li&gt;Request headers are, for the most part, unnecessary for &lt;code&gt;GET&lt;&#x2F;code&gt; requests.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is backwards compatible with all standards listed in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5219&#x2F;#name-resolution&quot;&gt;Name Resolution&lt;&#x2F;a&gt; section.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The normal security considerations of accessing normal URLs apply here, such as potential privacy leakage by following &lt;code&gt;3XX&lt;&#x2F;code&gt; redirects.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>NFT Legal Use, Repurposing, and Remixing</title>
        <published>2022-07-07T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Isaac Patka</name><uri>https://github.com/ipatka</uri>
	</author>
	
	<author>
		<name>COALA Licensing Taskforce</name><email>info@coala.org</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5554/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5999-legal-use-sharing-repurposing-and-remixing-standard-compatible-with-creative-commons/10553" />
        

        <id>https://wg-eips.ritovision.com/5554/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:5554"
            label="ERC-5554" />
        

        
        

        
        <summary type="html">An interface for describing and enforcing the legal use and remix of an NFT. On-chain registry of rights, attribution and derivative links.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5554/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP extends any other token standard to provide:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Explicit rights for the token holder related to commercial exploitation, derivative works, and reproduction;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5218&#x2F;&quot;&gt;EIP-5218&lt;&#x2F;a&gt; interface for creating, viewing, and checking the status of licenses&lt;&#x2F;li&gt;
&lt;li&gt;Standard format for extended license information in the token metadata;&lt;&#x2F;li&gt;
&lt;li&gt;Standard events to track off chain creation of derivative works, commercial exploitation, and reproduction;&lt;&#x2F;li&gt;
&lt;li&gt;On chain tracking of derivative works and reproductions&lt;&#x2F;li&gt;
&lt;li&gt;Additional required fields in the smart contract to reference the copyright owner&lt;&#x2F;li&gt;
&lt;li&gt;Function calls for commercial exploitation, derivative works and reproduction.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;NFTs still face legal uncertainty, and many now realize that the rights associated with an NFT are just as important as the NFT itself. Our goal is to help the ecosystem reach clear consensus and broad understanding of what purchasers of NFTs are acquiring in terms of copyright or other rights.&lt;&#x2F;p&gt;
&lt;p&gt;Today, purchasing the NFT of a digital work is not the same as purchasing the copyright in that work. In most cases, the NFT does not even incorporate the digital work; it only references it via a hash. Hence, the NFT holder owns a unique digital copy of the work, but does not necessarily enjoy the right to reproduce, redistribute, or otherwise exploit that work—unless explicitly provided for by the copyright owner. It typically only includes the right to privately enjoy the work and display it publicly on social media or in virtual galleries.&lt;&#x2F;p&gt;
&lt;p&gt;We aim to create a new set of licenses with modular terms and conditions—à la Creative Commons—in order to enable artists to increase the value of their NFT by associating additional rights to them (e.g. the right to create derivative works, or to allow for the commercial usage of the underlying works). Our solution will allow for any licensed rights to be granted, only and exclusively, to the current holders of an NFT, and to be transferred automatically to the new token holders every time the NFT is being transferred.&lt;&#x2F;p&gt;
&lt;p&gt;An on chain registry of copyrighted material will help in discovery of the rights associated with the NFTs that have been created with this protocol.&lt;&#x2F;p&gt;
&lt;p&gt;Our current work is drafting the legalese and technical specifications.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;Every contract compliant with this EIP must implement the &lt;code&gt;IERC5554&lt;&#x2F;code&gt; interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5554&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5218&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CommercialExploitation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _licenseId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _externalUri&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ReproductionCreated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _licenseId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _reproductionId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _reproduction&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _reproductionTokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DerivativeCreated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _licenseId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _derivativeId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _derivative&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _derivativeTokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieve the copyright owner address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws unless the token exists&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier for the queried token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; of the copyright owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getCopyrightOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        virtual&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Requests to log an execution of a license&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws unless the token issuance conditions are met&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier for the queried token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; tracking reproduction ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; logReproduction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; reproduction&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; reproductionTokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        virtual&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Requests to log an executions of a license&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws unless the token issuance conditions are met&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier for the queried token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; tracking derivative ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; logDerivative&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; derivative&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; derivativeTokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        virtual&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Requests to log an execution of a license&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws unless the commercial exploitation conditions are met&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier for the queried token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; logCommercialExploitation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uri&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieve the token associated with a reproduction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws unless the reproduction exists&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _reproductionId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier for the reproduction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier for the token used to generate the reproduction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getReproductionTokenId&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _reproductionId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieve the token associated with a reproduction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws unless the reproduction exists&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _reproductionId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier for the reproduction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier for the license used to generate the reproduction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getReproductionLicenseId&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _reproductionId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieve the token associated with a reproduction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws unless the reproduction exists&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _reproductionId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier for the derivative work&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the reproduction collection&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getReproductionCollection&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _reproductionId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieve the token associated with a derivative&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws unless the derivative exists&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _derivativeId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier for the derivative work&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier for the token used to generate the derivative work&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getDerivativeTokenId&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _derivativeId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieve the token associated with a derivative&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws unless the derivative exists&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _derivativeId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier for the derivative work&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier for the license used to generate the derivative work&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getDerivativeLicenseId&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _derivativeId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieve the token associated with a derivative&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws unless the derivative exists&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _derivativeId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier for the derivative work&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the derivative collection&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getDerivativeCollection&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _derivativeId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;token-based-attribution-remix&quot;&gt;Token based Attribution&#x2F; Remix&lt;&#x2F;h3&gt;
&lt;p&gt;On chain derivative works and reproductions&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Reproductions and derivative works are tracked in the contract.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;event-based-attribution&quot;&gt;Event based attribution&lt;&#x2F;h3&gt;
&lt;p&gt;For commercial exploitation or other off-chain uses of a creative work, this EIP defines events to be emitted to track the use of the work.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CommercialExploitation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenID&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uri&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; logCommercialExploitation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uri&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; bool;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;example&quot;&gt;Example:&lt;&#x2F;h4&gt;
&lt;p&gt;When a token holder uses an NFT for off-chain merchandise, log a reference to the off-chain work in the event uri&lt;&#x2F;p&gt;
&lt;h3 id=&quot;required-fields&quot;&gt;Required fields&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; copyrightOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; address;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Copyright owner per tokenID. Could just be the tokenID owner in a simple use case, or something else if desired by the creator.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;We expand here upon the Motivation section to justify every decision made with regard to the specs of the standard:&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;getLicenseId()&lt;&#x2F;code&gt; function takes a tokenID as a parameter, making it possible for different tokenID to be associated with different licensing terms.&lt;&#x2F;p&gt;
&lt;p&gt;LicenseURI links to a content-addressed file that stipulates the terms and conditions of the license in actual legal language, so that the license can be read and understood by those who want to understand which rights are associated with the work of authorship, and which additional rights are granted through the acquisition of the NFT.&lt;&#x2F;p&gt;
&lt;p&gt;When the license allows for the reproduction and&#x2F;or for the creation of a derivative work only to the token holders, there needs to be a way to verify that the new NFT or the derivative NFT was created legitimately. The standard ensures this by enabling the current token holder to call a function, e.g. logDerivative which checks that the caller has a valid license to execute&lt;&#x2F;p&gt;
&lt;p&gt;For commercial exploitation or other off-chain uses of a creative work, the standard implements the &lt;code&gt;logCommercialExploitation()&lt;&#x2F;code&gt; that makes it possible to keep track of which commercial exploitations have been made, and when. This makes it possible to verify that all commercial exploitation were legitimately done.&lt;&#x2F;p&gt;
&lt;p&gt;The standard introduces a new field, &lt;code&gt;copyrightOwner&lt;&#x2F;code&gt;, which indicates the address of the current holder of the copyright in the work. If multiple copyright owners exist, a multisig address (or DAO) can be used.&lt;&#x2F;p&gt;
&lt;p&gt;The artist address is not registered as an on-chain variable, but rather as part of the metadata, because it is an immutable field.&lt;&#x2F;p&gt;
&lt;p&gt;If any, the parents of the work (i.e. the works that it is derived upon) must be part of the metadata information, so that people can verify that the NFT has obtained a DerivativeWork for each one of its parents.&lt;&#x2F;p&gt;
&lt;p&gt;This licensing framework is intended to create a system to facilitate the licensing of rights that “follow the token” through a public licensing framework. This is not meant to be used for cases in which an exclusive right is licensed through a personal license to a specific actor (e.g. the copyright owner providing a third-party with the right to commercially exploit the work, regardless of whether they hold the token). This also is not designed to account for the sub-licensing case (e.g. licensing the right to one party to license third parties to engage in commercial exploitation), since this should rather be done via a personal copyright licensing scheme.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;examples&quot;&gt;Examples&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;bored-koalas-merchandising&quot;&gt;Bored Koalas merchandising&lt;&#x2F;h4&gt;
&lt;p&gt;Vigdís creates a PFP collection of Bored Koalas, which is subject to standard copyright restrictions: no one has the right to reproduce, distribute, communicate, commercialize or remix these works. However, she wants to give specific permissions to those who hold a NFT from the collection. She mints the collection with this EIP, introducing a conditional license that allows for the current token holder to display the Bored Koala associated with each NFT and commercialize it for the purpose of merchandising only.&lt;&#x2F;p&gt;
&lt;p&gt;Neža has purchased one of these Bored Koalas. She wants to produce merchandising to be distributed at his blockchain conference. She goes to a print shop and asks them to make t-shirts with the Bored Koala image of the NFT she has purchased. The print shop can verify that she has the right to commercially exploit the work by verifying that they are the holder of the Bored Koala NFT, and verifying the terms of the license associated with it. (NB: this does not require a sub-license to be granted to the print shop, because the commercial exploitation implies the right to commission third parties to engage in such commercial exploitation). Neža brings the t-shirts to her conference and puts them for sale. When doing so, she calls the &lt;code&gt;logCommercialExploitation()&lt;&#x2F;code&gt; function from the NFT smart contract in order to track that the commercial exploitation was done at a time while she was the token holder.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;musical-remix&quot;&gt;Musical Remix&lt;&#x2F;h4&gt;
&lt;p&gt;Matti is an up and coming songwriter in the emerging web3 music ecosystem. For the upcoming crypto conference, he creates a hit song called “Degens in the Night”. Instead of listing the song on a web2 platform, Matti mints the song as an NFT using this EIP, with a dual licensing scheme: a general public licenses that allows for the free reproduction and redistribution of the work, given proper attribution (e.g. Creative Commons BY-NC-ND) and a conditional license which allows for the token holder to remix the song, in exchange of a particular lump sum (e.g. 1ETH) and under the condition that the derivative work is released under the same licensing terms as the original work Lyyli wants to create a cover of that song, which she calls “Degens in the Parisian Night”. She purchases the NFT and mints a new derivative NFT under a new smart contract using this EIP standard. She then calls the &lt;code&gt;requestDerivativeToken()&lt;&#x2F;code&gt; function and send 1ETH to the original NFT smart contract, in order to request that a DerivativeToken be assigned to the new smart contract she has created. The smart contract automatically approves the request to assign a Derivative Token to the new smart contract of Lyyli. This can be used as a proof that the derivative work is indeed a legitimate work, which has been approved by the copyright owner of the original work. During the conference hundreds of other web3 music creators host a side event with Degens in the Night remixes playing until 4am.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;royalties-remix&quot;&gt;Royalties Remix&lt;&#x2F;h4&gt;
&lt;p&gt;Alice created a 3D model of a motorcycle, which she wants everyone to remix, under the condition that she gets royalty from the commercial exploitation of all derivative works. She release her work as an NFT with this EIP, with a dual licensing scheme: a general public licenses that allows for the free reproduction and redistribution of the work, given proper attribution (e.g. Creative Commons BY-NC-ND) and a conditional license which allows for the token holder to remix the song, under the condition that the derivative work is released under the same licensing terms as the original work, and that there is a split of the royalties between himself and the remixer.&lt;&#x2F;p&gt;
&lt;p&gt;Jane wants to create a derivative work of the motorcycle. She purchases the NFT and mints a new derivative NFT under a new smart contract that uses this EIP, which includes a royalty split for Alice. She then calls the &lt;code&gt;requestDerivativeToken()&lt;&#x2F;code&gt; function from the original NFT smart contract in order to request that a DerivativeToken be assigned to the new smart contract she has created. Alice decided that the smart contract shall not automate the approval or rejection of the request, but rather wait for her to validate or invalidate the request, after she has verified that the design and provisions of the new smart contract, namely that it does indeed replicate the same terms and conditions as the original work and that it incorporates the proper amount of royalties. She approves the request to assign a Derivative Token to the new smart contract of Jane. When people purchase Jane’s NFT, the royalties are split to ensure the proper redistribution of the generated profit to Alice.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The interface defined in this standard is backward compatible with most NFT standards used in the Ethereum ecosystem as of this writing.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Voting with delegation</title>
        <published>2022-07-04T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Hadrien Croubois</name><uri>https://github.com/Amxx</uri>
	</author>
	
	<author>
		<name>Francisco Giordano</name><uri>https://github.com/frangio</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5805/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5805-voting-with-delegation/11407" />
        

        <id>https://wg-eips.ritovision.com/5805/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:5805"
            label="ERC-5805" />
        

        
        

        
        <summary type="html">An interface for voting weight tracking, with delegation support</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5805/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Many DAOs (decentralized autonomous organizations) rely on tokens to represent one&#x27;s voting power. In order to perform this task effectively, the token contracts need to include specific mechanisms such as checkpoints and delegation. The existing implementations are not standardized. This ERC proposes to standardize the way votes are delegated from one account to another, and the way current and past votes are tracked and queried. The corresponding behavior is compatible with many token types, including but not limited to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;. This ERC also considers the diversity of time tracking functions, allowing the voting tokens (and any contract associated with it) to track the votes based on &lt;code&gt;block.number&lt;&#x2F;code&gt;, &lt;code&gt;block.timestamp&lt;&#x2F;code&gt;, or any other non-decreasing function.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Beyond simple monetary transactions, decentralized autonomous organizations are arguably one of the most important use cases of blockchain and smart contract technologies. Today, many communities are organized around a governance contract that allows users to vote. Among these communities, some represent voting power using transferable tokens (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;, other). In this context, the more tokens one owns, the more voting power one has. Governor contracts, such as Compound&#x27;s &lt;code&gt;GovernorBravo&lt;&#x2F;code&gt;, read from these &quot;voting token&quot; contracts to get the voting power of the users.&lt;&#x2F;p&gt;
&lt;p&gt;Unfortunately, simply using the &lt;code&gt;balanceOf(address)&lt;&#x2F;code&gt; function present in most token standards is not good enough:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The values are not checkpointed, so a user can vote, transfer its tokens to a new account, and vote again with the same tokens.&lt;&#x2F;li&gt;
&lt;li&gt;A user cannot delegate their voting power to someone else without transferring full ownership of the tokens.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;These constraints have led to the emergence of voting tokens with delegation that contain the following logic:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Users can delegate the voting power of their tokens to themselves or a third party. This creates a distinction between balance and voting weight.&lt;&#x2F;li&gt;
&lt;li&gt;The voting weights of accounts are checkpointed, allowing lookups for past values at different points in time.&lt;&#x2F;li&gt;
&lt;li&gt;The balances are not checkpointed.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This ERC is proposing to standardize the interface and behavior of these voting tokens.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, the existing (non-standardized) implementations are limited to &lt;code&gt;block.number&lt;&#x2F;code&gt; based checkpoints. This choice causes many issues in a multichain environment, where some chains (particularly L2s) have an inconsistent or unpredictable time between blocks. This ERC also addresses this issue by allowing the voting token to use any time tracking function it wants, and exposing it so that other contracts (such as a Governor) can stay consistent with the token checkpoints.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;Following pre-existing (but not-standardized) implementation, the EIP proposes the following mechanism.&lt;&#x2F;p&gt;
&lt;p&gt;Each user account (address) can delegate to an account of its choice. This can be itself, someone else, or no one (represented by &lt;code&gt;address(0)&lt;&#x2F;code&gt;). Assets held by the user cannot express their voting power unless they are delegated.&lt;&#x2F;p&gt;
&lt;p&gt;When a &quot;delegator&quot; delegates its tokens voting power to a &quot;delegatee&quot;, its balance is added to the voting power of the delegatee. If the delegator changes its delegation, the voting power is subtracted from the old delegatee&#x27;s voting power and added to the new delegate&#x27;s voting power. The voting power of each account is tracked through time so that it is possible to query its value in the past. With tokens being delegated to at most one delegate at a given point in time, double voting is prevented.&lt;&#x2F;p&gt;
&lt;p&gt;Whenever tokens are transferred from one account to another, the associated voting power should be deducted from the sender&#x27;s delegate and added to the receiver&#x27;s delegate.&lt;&#x2F;p&gt;
&lt;p&gt;Tokens that are delegated to &lt;code&gt;address(0)&lt;&#x2F;code&gt; should not be tracked. This allows users to optimize the gas cost of their token transfers by skipping the checkpoint update for their delegate.&lt;&#x2F;p&gt;
&lt;p&gt;To accommodate different types of chains, we want the voting checkpoint system to support different forms of time tracking. On the Ethereum mainnet, using block numbers provides backward compatibility with applications that historically use it. On the other hand, using timestamps provides better semantics for end users, and accommodates use cases where the duration is expressed in seconds. Other monotonic functions could also be deemed relevant by developers based on the characteristics of future applications and blockchains.&lt;&#x2F;p&gt;
&lt;p&gt;Both timestamps, block numbers, and other possible modes use the same external interfaces. This allows transparent binding of third-party contracts, such as governor systems, to the vote tracking built into the voting contracts. For this to be effective, the voting contracts must, in addition to all the vote-tracking functions, expose the current value used for time-tracking.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;methods&quot;&gt;Methods&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;erc-6372-clock-and-clock-mode&quot;&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6372&#x2F;&quot;&gt;ERC-6372&lt;&#x2F;a&gt;: clock and CLOCK_MODE&lt;&#x2F;h4&gt;
&lt;p&gt;Compliant contracts SHOULD implement ERC-6372 (Contract clock) to announce the clock that is used for vote tracking.&lt;&#x2F;p&gt;
&lt;p&gt;If the contract does not implement ERC-6372, it MUST operate according to a block number clock, exactly as if ERC-6372&#x27;s &lt;code&gt;CLOCK_MODE&lt;&#x2F;code&gt; returned &lt;code&gt;mode=blocknumber&amp;amp;from=default&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;In the following specification, &quot;the current clock&quot; refers to either the result of ERC-6372&#x27;s &lt;code&gt;clock()&lt;&#x2F;code&gt;, or the default of &lt;code&gt;block.number&lt;&#x2F;code&gt; in its absence.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;getvotes&quot;&gt;getVotes&lt;&#x2F;h4&gt;
&lt;p&gt;This function returns the current voting weight of an account. This corresponds to all the voting power delegated to it at the moment this function is called.&lt;&#x2F;p&gt;
&lt;p&gt;As tokens delegated to &lt;code&gt;address(0)&lt;&#x2F;code&gt; should not be counted&#x2F;snapshotted, &lt;code&gt;getVotes(0)&lt;&#x2F;code&gt; SHOULD always return &lt;code&gt;0&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This function MUST be implemented&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; g&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;etVotes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ccount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;otingWeight&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;getpastvotes&quot;&gt;getPastVotes&lt;&#x2F;h4&gt;
&lt;p&gt;This function returns the historical voting weight of an account. This corresponds to all the voting power delegated to it at a specific timepoint. The timepoint parameter MUST match the operating mode of the contract. This function SHOULD only serve past checkpoints, which SHOULD be immutable.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Calling this function with a timepoint that is greater or equal to the current clock SHOULD revert.&lt;&#x2F;li&gt;
&lt;li&gt;Calling this function with a timepoint strictly smaller than the current clock SHOULD NOT revert.&lt;&#x2F;li&gt;
&lt;li&gt;For any integer that is strictly smaller than the current clock, the value returned by &lt;code&gt;getPastVotes&lt;&#x2F;code&gt; SHOULD be constant. This means that for any call to this function that returns a value, re-executing the same call (at any time in the future) SHOULD return the same value.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;As tokens delegated to &lt;code&gt;address(0)&lt;&#x2F;code&gt; should not be counted&#x2F;snapshotted, &lt;code&gt;getPastVotes(0,x)&lt;&#x2F;code&gt; SHOULD always return &lt;code&gt;0&lt;&#x2F;code&gt; (for all values of &lt;code&gt;x&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;This function MUST be implemented&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; g&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;etPastVotes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ccount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;imepoint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;otingWeight&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;delegates&quot;&gt;delegates&lt;&#x2F;h4&gt;
&lt;p&gt;This function returns the address to which the voting power of an account is currently delegated.&lt;&#x2F;p&gt;
&lt;p&gt;Note that if the delegate is &lt;code&gt;address(0)&lt;&#x2F;code&gt; then the voting power SHOULD NOT be checkpointed, and it should not be possible to vote with it.&lt;&#x2F;p&gt;
&lt;p&gt;This function MUST be implemented&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; d&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;elegates&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ccount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; d&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;elegatee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;delegate&quot;&gt;delegate&lt;&#x2F;h4&gt;
&lt;p&gt;This function changes the caller&#x27;s delegate, updating the vote delegation in the meantime.&lt;&#x2F;p&gt;
&lt;p&gt;This function MUST be implemented&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; d&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;elegate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;onpayable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; d&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;elegatee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;delegatebysig&quot;&gt;delegateBySig&lt;&#x2F;h4&gt;
&lt;p&gt;This function changes an account&#x27;s delegate using a signature, updating the vote delegation in the meantime.&lt;&#x2F;p&gt;
&lt;p&gt;This function MUST be implemented&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; d&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;elegateBySig&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;onpayable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; d&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;elegatee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;once&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;xpiry&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ytes32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ytes32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This signature should follow the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; format:&lt;&#x2F;p&gt;
&lt;p&gt;A call to &lt;code&gt;delegateBySig(delegatee, nonce, expiry, v, r, s)&lt;&#x2F;code&gt; changes the signer&#x27;s delegate to &lt;code&gt;delegatee&lt;&#x2F;code&gt;, increment the signer&#x27;s nonce by 1, and emits a corresponding &lt;code&gt;DelegateChanged&lt;&#x2F;code&gt; event, and possibly &lt;code&gt;DelegateVotesChanged&lt;&#x2F;code&gt; events for the old and the new delegate accounts, if and only if the following conditions are met:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The current timestamp is less than or equal to &lt;code&gt;expiry&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;nonces(signer)&lt;&#x2F;code&gt; (before the state update) is equal to &lt;code&gt;nonce&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;If any of these conditions are not met, the &lt;code&gt;delegateBySig&lt;&#x2F;code&gt; call must revert. This translates to the following solidity code:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;expiry &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt; signer &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; ecrecover&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;1901&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    DOMAIN_SEPARATOR&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;Delegation(address delegatee,uint256 nonce,uint256 expiry)&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      delegatee&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      expiry&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  v&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; s&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signer &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;nounces&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; increment nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; set delegation of `signer` to `delegatee`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where &lt;code&gt;DOMAIN_SEPARATOR&lt;&#x2F;code&gt; is defined according to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt;. The &lt;code&gt;DOMAIN_SEPARATOR&lt;&#x2F;code&gt; should be unique to the contract and chain to prevent replay attacks from other domains,
and satisfy the requirements of EIP-712, but is otherwise unconstrained.&lt;&#x2F;p&gt;
&lt;p&gt;A common choice for &lt;code&gt;DOMAIN_SEPARATOR&lt;&#x2F;code&gt; is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;DOMAIN_SEPARATOR &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;    abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;#39;EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;name&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;version&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        chainid&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In other words, the message is the EIP-712 typed structure:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;types&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;EIP712Domain&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;verifyingContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Delegation&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;delegatee&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;expiry&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;primaryType&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Permit&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;domain&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contractName&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; version&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; chainid&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;verifyingContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contractAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;message&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;delegatee&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; delegatee&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;expiry&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; expiry&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note that nowhere in this definition do we refer to &lt;code&gt;msg.sender&lt;&#x2F;code&gt;. The caller of the &lt;code&gt;delegateBySig&lt;&#x2F;code&gt; function can be any address.&lt;&#x2F;p&gt;
&lt;p&gt;When this function is successfully executed, the delegator&#x27;s nonce MUST be incremented to prevent replay attacks.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;nonces&quot;&gt;nonces&lt;&#x2F;h4&gt;
&lt;p&gt;This function returns the current nonce for a given account.&lt;&#x2F;p&gt;
&lt;p&gt;Signed delegations (see &lt;code&gt;delegateBySig&lt;&#x2F;code&gt;) are only accepted if the nonce used in the EIP-712 signature matches the return of this function. This value of &lt;code&gt;nonce(delegator)&lt;&#x2F;code&gt; should be incremented whenever a call to &lt;code&gt;delegateBySig&lt;&#x2F;code&gt; is performed on behalf of &lt;code&gt;delegator&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This function MUST be implemented&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;onces&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ccount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; d&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;elegator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;once&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;events&quot;&gt;Events&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;delegatechanged&quot;&gt;DelegateChanged&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;delegator&lt;&#x2F;code&gt; changes the delegation of its assets from &lt;code&gt;fromDelegate&lt;&#x2F;code&gt; to &lt;code&gt;toDelegate&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST be emitted when the delegate for an account is modified by &lt;code&gt;delegate(address)&lt;&#x2F;code&gt; or &lt;code&gt;delegateBySig(address,uint256,uint256,uint8,bytes32,bytes32)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; D&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;elegateChanged&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;vent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; d&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;elegator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;romDelegate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;oDelegate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;delegatevoteschanged&quot;&gt;DelegateVotesChanged&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;delegate&lt;&#x2F;code&gt; available voting power changes from &lt;code&gt;previousBalance&lt;&#x2F;code&gt; to &lt;code&gt;newBalance&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This MUST be emitted when:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;an account (that holds more than 0 assets) updates its delegation from or to &lt;code&gt;delegate&lt;&#x2F;code&gt;,&lt;&#x2F;li&gt;
&lt;li&gt;an asset transfer from or to an account that is delegated to &lt;code&gt;delegate&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; D&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;elegateVotesChanged&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;vent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; d&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;elegate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; p&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;reviousBalance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ewBalance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;solidity-interface&quot;&gt;Solidity interface&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5805&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6372&lt;&#x2F;span&gt;&lt;span&gt; &#x2F;* (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;optional&lt;&#x2F;span&gt;&lt;span&gt;) *&#x2F; &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DelegateChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; delegator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; fromDelegate&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; toDelegate&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DelegateVotesChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; delegate&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; previousBalance&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newBalance&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getVotes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getPastVotes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; timepoint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; delegates&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; nonces&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; delegate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; delegatee&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; delegateBySig&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; delegatee&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expiry&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; v&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; s&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;expected-properties&quot;&gt;Expected properties&lt;&#x2F;h3&gt;
&lt;p&gt;Let &lt;code&gt;clock&lt;&#x2F;code&gt; be the current clock.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;For all timepoints &lt;code&gt;t &amp;lt; clock&lt;&#x2F;code&gt;, &lt;code&gt;getVotes(address(0))&lt;&#x2F;code&gt; and &lt;code&gt;getPastVotes(address(0), t)&lt;&#x2F;code&gt; SHOULD return 0.&lt;&#x2F;li&gt;
&lt;li&gt;For all accounts &lt;code&gt;a != 0&lt;&#x2F;code&gt;, &lt;code&gt;getVotes(a)&lt;&#x2F;code&gt; SHOULD be the sum of the &quot;balances&quot; of all the accounts that delegate to &lt;code&gt;a&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;For all accounts &lt;code&gt;a != 0&lt;&#x2F;code&gt; and all timestamp &lt;code&gt;t &amp;lt; clock&lt;&#x2F;code&gt;, &lt;code&gt;getPastVotes(a, t)&lt;&#x2F;code&gt; SHOULD be the sum of the &quot;balances&quot; of all the accounts that delegated to &lt;code&gt;a&lt;&#x2F;code&gt; when &lt;code&gt;clock&lt;&#x2F;code&gt; overtook &lt;code&gt;t&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;For all accounts &lt;code&gt;a&lt;&#x2F;code&gt;, &lt;code&gt;getPastVotes(a, t)&lt;&#x2F;code&gt; MUST be constant after &lt;code&gt;t &amp;lt; clock&lt;&#x2F;code&gt; is reached.&lt;&#x2F;li&gt;
&lt;li&gt;For all accounts &lt;code&gt;a&lt;&#x2F;code&gt;, the action of changing the delegate from &lt;code&gt;b&lt;&#x2F;code&gt; to &lt;code&gt;c&lt;&#x2F;code&gt; MUST not increase the current voting power of &lt;code&gt;b&lt;&#x2F;code&gt; (&lt;code&gt;getVotes(b)&lt;&#x2F;code&gt;) and MUST not decrease the current voting power of &lt;code&gt;c&lt;&#x2F;code&gt; (&lt;code&gt;getVotes(c)&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Delegation allows token holders to trust a delegate with their vote while keeping full custody of their token. This means that only a small-ish number of delegates need to pay gas for voting. This leads to better representation of small token holders by allowing their votes to be cast without requiring them to pay expensive gas fees. Users can take over their voting power at any point, and delegate it to someone else, or to themselves.&lt;&#x2F;p&gt;
&lt;p&gt;The use of checkpoints prevents double voting. Votes, for example in the context of a governance proposal, should rely on a snapshot defined by a timepoint. Only tokens delegated at that timepoint can be used for voting. This means any token transfer performed after the snapshot will not affect the voting power of the sender&#x2F;receiver&#x27;s delegate. This also means that in order to vote, someone must acquire tokens and delegate them before the snapshot is taken. Governors can, and do, include a delay between the proposal is submitted and the snapshot is taken so that users can take the necessary actions (change their delegation, buy more tokens, ...).&lt;&#x2F;p&gt;
&lt;p&gt;While timestamps produced by ERC-6372&#x27;s &lt;code&gt;clock&lt;&#x2F;code&gt; are represented as &lt;code&gt;uint48&lt;&#x2F;code&gt;, &lt;code&gt;getPastVotes&lt;&#x2F;code&gt;&#x27;s timepoint argument is &lt;code&gt;uint256&lt;&#x2F;code&gt; for backward compatibility. Any timepoint &lt;code&gt;&amp;gt;=2**48&lt;&#x2F;code&gt; passed to &lt;code&gt;getPastVotes&lt;&#x2F;code&gt; SHOULD cause the function to revert, as it would be a lookup in the future.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;delegateBySig&lt;&#x2F;code&gt; is necessary to offer a gasless workflow to token holders that do not want to pay gas for voting.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;nonces&lt;&#x2F;code&gt; mapping is given for replay protection.&lt;&#x2F;p&gt;
&lt;p&gt;EIP-712 typed messages are included because of their widespread adoption in many wallet providers.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Compound and OpenZeppelin already provide implementations of voting tokens. The delegation-related methods are shared between the two implementations and this ERC. For the vote lookup, this ERC uses OpenZeppelin&#x27;s implementation (with return type uint256) as Compound&#x27;s implementation causes significant restrictions of the acceptable values (return type is uint96).&lt;&#x2F;p&gt;
&lt;p&gt;Both implementations use &lt;code&gt;block.number&lt;&#x2F;code&gt; for their checkpoints and do not implement ERC-6372, which is compatible with this ERC.&lt;&#x2F;p&gt;
&lt;p&gt;Existing governors, that are currently compatible with OpenZeppelin&#x27;s implementation will be compatible with the &quot;block number mode&quot; of this ERC.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Before doing a lookup, one should check the return value of &lt;code&gt;clock()&lt;&#x2F;code&gt; and make sure that the parameters of the lookup are consistent. Performing a lookup using a timestamp argument on a contract that uses block numbers will very likely cause a revert. On the other end, performing a lookup using a block number argument on a contract that uses timestamps will likely return 0.&lt;&#x2F;p&gt;
&lt;p&gt;Though the signer of a &lt;code&gt;Delegation&lt;&#x2F;code&gt; may have a certain party in mind to submit their transaction, another party can always front-run this transaction and call &lt;code&gt;delegateBySig&lt;&#x2F;code&gt; before the intended party. The result is the same for the &lt;code&gt;Delegation&lt;&#x2F;code&gt; signer, however.&lt;&#x2F;p&gt;
&lt;p&gt;Since the ecrecover precompile fails silently and just returns the zero address as &lt;code&gt;signer&lt;&#x2F;code&gt; when given malformed messages, it is important to ensure &lt;code&gt;signer != address(0)&lt;&#x2F;code&gt; to avoid &lt;code&gt;delegateBySig&lt;&#x2F;code&gt; from delegating &quot;zombie funds&quot; belonging to the zero address.&lt;&#x2F;p&gt;
&lt;p&gt;Signed &lt;code&gt;Delegation&lt;&#x2F;code&gt; messages are censorable. The relaying party can always choose to not submit the &lt;code&gt;Delegation&lt;&#x2F;code&gt; after having received it, withholding the option to submit it. The &lt;code&gt;expiry&lt;&#x2F;code&gt; parameter is one mitigation to this. If the signing party holds ETH they can also just submit the &lt;code&gt;Delegation&lt;&#x2F;code&gt; themselves, which can render previously signed &lt;code&gt;Delegation&lt;&#x2F;code&gt;s invalid.&lt;&#x2F;p&gt;
&lt;p&gt;If the &lt;code&gt;DOMAIN_SEPARATOR&lt;&#x2F;code&gt; contains the &lt;code&gt;chainId&lt;&#x2F;code&gt; and is defined at contract deployment instead of reconstructed for every signature, there is a risk of possible replay attacks between chains in the event of a future chain split.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Minimal Soulbound NFTs</title>
        <published>2022-07-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Tim Daubenschütz</name><uri>https://github.com/TimDaub</uri>
	</author>
	
	<author>
		<name>Anders</name><uri>https://github.com/0xanders</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5192/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5192-minimal-soulbound-nfts/9814" />
        

        <id>https://wg-eips.ritovision.com/5192/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:5192"
            label="ERC-5192" />
        

        
        

        
        <summary type="html">Minimal interface for soulbinding EIP-721 NFTs</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5192/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is an extension of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt;. It proposes a minimal interface to make tokens soulbound using the feature detection functionality of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;EIP-165&lt;&#x2F;a&gt;. A soulbound token is a non-fungible token bound to a single account.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The Ethereum community has expressed a need for non-transferrable, non-fungible, and socially-priced tokens similar to World of Warcraft’s soulbound items. But the lack of a token standard leads many developers to simply throw errors upon a user&#x27;s invocation of transfer functionalities. Over the long term, this will lead to fragmentation and less composability.&lt;&#x2F;p&gt;
&lt;p&gt;In this document, we outline a minimal addition to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; that allows wallet implementers to check for a token contract&#x27;s permanent (non-)transferability using &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;EIP-165&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot; and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;contract-interface&quot;&gt;Contract Interface&lt;&#x2F;h3&gt;
&lt;p&gt;A token with a &lt;code&gt;uint256 tokenId&lt;&#x2F;code&gt; may be bound to a receiving account with &lt;code&gt;function locked(...)&lt;&#x2F;code&gt; returning &lt;code&gt;true&lt;&#x2F;code&gt;. In this case, all &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; functions of the contract that transfer the token from one account to another must throw.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5192&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when the locking status is &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; to locked.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If a token is minted and the status is locked, this event should be emitted.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier for a token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Locked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when the locking status is &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; to unlocked.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If a token is minted and the status is unlocked, this event should be emitted.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier for a token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Unlocked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the locking status of an Soulbound Token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SBTs assigned to zero address are considered invalid, and queries&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; about them do throw.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier for an SBT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; locked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;To aid recognition that an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; token implements &quot;soulbinding&quot; via this EIP upon calling &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt;&#x27;s &lt;code&gt;function supportsInterface(bytes4 interfaceID) external view returns (bool)&lt;&#x2F;code&gt; with &lt;code&gt;interfaceID=0xb45a3c0e&lt;&#x2F;code&gt;, a contract implementing this EIP must return &lt;code&gt;true&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The above model is the simplest possible path towards a canonical interface for Soulbound tokens. It reflects upon the numerous Soulbound token implementations that simply revert upon transfers.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal is fully backward compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;There are no security considerations related directly to the implementation of this standard.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Account Abstraction via Endorsed Operations</title>
        <published>2022-06-29T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Agustín Aguilar</name><uri>https://github.com/agusx1211</uri>
	</author>
	
	<author>
		<name>Philippe Castonguay</name><uri>https://github.com/phabc</uri>
	</author>
	
	<author>
		<name>Michael Standen</name><uri>https://github.com/ScreamingHawk</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5189/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-account-abstraction-via-endorsed-operations/9799" />
        

        <id>https://wg-eips.ritovision.com/5189/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:5189"
            label="ERC-5189" />
        

        
        

        
        <summary type="html">An account abstraction proposal that avoids protocol changes while maintaining compatibility with existing smart contract wallets.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5189/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC proposes a form of account abstraction (AA) that ensures compatibility with existing smart contract wallets and provides flexibility for alternative designs while avoiding introducing changes to the consensus layer. Instead of defining a strict structure for AA transactions, this proposal introduces the figure of &lt;code&gt;endorser&lt;&#x2F;code&gt; contracts. These smart contract instances are tasked with determining the quality of the submitted AA transactions, thus safely helping bundlers determine if a transaction should be kept in the mempool or not. Developers that intend to make their smart contract wallet compatible with this ERC must create and deploy an instance of an &lt;code&gt;endorser&lt;&#x2F;code&gt; or use an existing one compatible with their wallet.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This account abstraction proposal aims to implement a generalized system for executing AA transactions while maintaining the following goals:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Achieve the primary goal of account abstraction:&lt;&#x2F;strong&gt; allow users to use smart contract wallets containing arbitrary verification and execution logic instead of EOAs as their primary account.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Decentralization:&lt;&#x2F;strong&gt;
&lt;ul&gt;
&lt;li&gt;Allow any bundler to participate in the process of including AA transactions.&lt;&#x2F;li&gt;
&lt;li&gt;Work with all activity happening over a public mempool without having to concentrate transactions on centralized relayers.&lt;&#x2F;li&gt;
&lt;li&gt;Define structures that help maintain a healthy mempool without risking its participants from getting flooded with invalid or malicious payloads.&lt;&#x2F;li&gt;
&lt;li&gt;Avoid trust assumptions between bundlers, developers, and wallets.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Support existing smart contract wallet implementations:&lt;&#x2F;strong&gt; Work with all the smart contract wallets already deployed and active while avoiding forcing each wallet instance to be manually upgraded.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Provide an unrestrictive framework:&lt;&#x2F;strong&gt; Smart contract wallets are very different in design, limitations, and capabilities from one another; the proposal is designed to accommodate almost all possible variations.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;No overhead:&lt;&#x2F;strong&gt; Smart contract wallets already have a cost overhead compared to EOA alternatives, the proposal does not worsen the current situation.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Support other use cases:&lt;&#x2F;strong&gt;
&lt;ul&gt;
&lt;li&gt;Privacy-preserving applications.&lt;&#x2F;li&gt;
&lt;li&gt;Atomic multi-operations (similar to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3074&#x2F;&quot;&gt;EIP-3074&lt;&#x2F;a&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;Payment of transaction fees using tokens. (E.g. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;777&#x2F;&quot;&gt;ERC-777&lt;&#x2F;a&gt;, etc.)&lt;&#x2F;li&gt;
&lt;li&gt;Scheduled execution of smart contracts without any user input.&lt;&#x2F;li&gt;
&lt;li&gt;Applications that require a generalistic relayer.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;To avoid Ethereum consensus changes, we do not attempt to create new transaction types for account-abstracted transactions. Instead, AA transactions are packed up in a struct called &lt;code&gt;Operation&lt;&#x2F;code&gt;, operations are structs composed by the following fields:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Field&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;entrypoint&lt;&#x2F;td&gt;&lt;td&gt;address&lt;&#x2F;td&gt;&lt;td&gt;Contract address that must be called with &lt;code&gt;callData&lt;&#x2F;code&gt; to execute the &lt;code&gt;operation&lt;&#x2F;code&gt;.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;callData&lt;&#x2F;td&gt;&lt;td&gt;bytes&lt;&#x2F;td&gt;&lt;td&gt;Data that must be passed to the &lt;code&gt;entrypoint&lt;&#x2F;code&gt; call to execute the &lt;code&gt;operation&lt;&#x2F;code&gt;.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;fixedGas&lt;&#x2F;td&gt;&lt;td&gt;uint64&lt;&#x2F;td&gt;&lt;td&gt;Amount of gas that the operation will pay for, regardless execution costs, and independent from &lt;code&gt;gasLimit&lt;&#x2F;code&gt;.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;gasLimit&lt;&#x2F;td&gt;&lt;td&gt;uint64&lt;&#x2F;td&gt;&lt;td&gt;Minimum gasLimit that must be passed when executing the &lt;code&gt;operation&lt;&#x2F;code&gt;.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;feeToken&lt;&#x2F;td&gt;&lt;td&gt;address&lt;&#x2F;td&gt;&lt;td&gt;Contract address of the token used to repay the bundler. &lt;em&gt;(&lt;code&gt;address(0)&lt;&#x2F;code&gt; for the native token)&lt;&#x2F;em&gt;.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;endorser&lt;&#x2F;td&gt;&lt;td&gt;address&lt;&#x2F;td&gt;&lt;td&gt;Address of the endorser contract that should be used to validate the &lt;code&gt;operation&lt;&#x2F;code&gt;.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;endorserCallData&lt;&#x2F;td&gt;&lt;td&gt;bytes&lt;&#x2F;td&gt;&lt;td&gt;Additional data that must be passed to the &lt;code&gt;endorser&lt;&#x2F;code&gt; when calling &lt;code&gt;isOperationReady()&lt;&#x2F;code&gt;.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;endorserGasLimit&lt;&#x2F;td&gt;&lt;td&gt;uint64&lt;&#x2F;td&gt;&lt;td&gt;Amount of gas that should be passed to the endorser when validating the &lt;code&gt;operation&lt;&#x2F;code&gt;.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;maxFeePerGas&lt;&#x2F;td&gt;&lt;td&gt;uint256&lt;&#x2F;td&gt;&lt;td&gt;Max amount of basefee that the &lt;code&gt;operation&lt;&#x2F;code&gt; execution is expected to pay. &lt;em&gt;(Similar to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; &lt;code&gt;max_fee_per_gas&lt;&#x2F;code&gt;)&lt;&#x2F;em&gt;.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;priorityFeePerGas&lt;&#x2F;td&gt;&lt;td&gt;uint256&lt;&#x2F;td&gt;&lt;td&gt;Fixed amount of fees that the &lt;code&gt;operation&lt;&#x2F;code&gt; execution is expected to pay to the bundler. &lt;em&gt;(Similar to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; &lt;code&gt;max_priority_fee_per_gas&lt;&#x2F;code&gt;)&lt;&#x2F;em&gt;.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;feeScalingFactor&lt;&#x2F;td&gt;&lt;td&gt;uint256&lt;&#x2F;td&gt;&lt;td&gt;Scaling factor to convert the computed fee into the &lt;code&gt;feeToken&lt;&#x2F;code&gt; unit.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;feeNormalizationFactor&lt;&#x2F;td&gt;&lt;td&gt;uint256&lt;&#x2F;td&gt;&lt;td&gt;Normalization factor to convert the computed fee into the &lt;code&gt;feeToken&lt;&#x2F;code&gt; unit.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;hasUntrustedContext&lt;&#x2F;td&gt;&lt;td&gt;bool&lt;&#x2F;td&gt;&lt;td&gt;If &lt;code&gt;true&lt;&#x2F;code&gt;, the operation &lt;em&gt;may&lt;&#x2F;em&gt; have untrusted code paths. These should be treated differently by the bundler (see untrusted environment).&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;chainId&lt;&#x2F;td&gt;&lt;td&gt;uint256&lt;&#x2F;td&gt;&lt;td&gt;Chain ID of the network where the &lt;code&gt;operation&lt;&#x2F;code&gt; is intended to be executed.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;These &lt;code&gt;Operation&lt;&#x2F;code&gt; objects can be sent to a dedicated operations mempool. A specialized class of actors called bundlers (either block producers running special-purpose code, or just users that can relay transactions to block producers) listen for operations on the mempool and execute these transactions.&lt;&#x2F;p&gt;
&lt;p&gt;Transactions are executed by calling the &lt;code&gt;entrypoint&lt;&#x2F;code&gt; with the provided &lt;code&gt;callData&lt;&#x2F;code&gt;. The &lt;code&gt;entrypoint&lt;&#x2F;code&gt; can be any contract, but most commonly it will be the wallet contract itself. Alternatively it can be an intermediary utility that deploys the wallet and then performs the transaction.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;endorser-functionality&quot;&gt;Endorser functionality&lt;&#x2F;h3&gt;
&lt;p&gt;Mempool participants need to be able to able to filter &quot;good operations&quot; (operations that pay the bundler the defined fee) from &quot;bad operations&quot; (operations that either miss payment or revert altogether).&lt;&#x2F;p&gt;
&lt;p&gt;This categorization is facilitated by the &lt;code&gt;endorser&lt;&#x2F;code&gt;; the endorser must be a deployed smart contract that implements the following interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Endorser&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Operation&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; entrypoint&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span&gt; callData&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; fixedGas&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; gasLimit&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; endorser&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span&gt; endorserCallData&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; endorserGasLimit&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; maxFeePerGas&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; priorityFeePerGas&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; feeToken&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; feeScalingFactor&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; feeNormalizationFactor&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bool&lt;&#x2F;span&gt;&lt;span&gt; hasUntrustedContext&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; GlobalDependency&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bool&lt;&#x2F;span&gt;&lt;span&gt; baseFee&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bool&lt;&#x2F;span&gt;&lt;span&gt; blobBaseFee&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bool&lt;&#x2F;span&gt;&lt;span&gt; chainId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bool&lt;&#x2F;span&gt;&lt;span&gt; coinBase&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bool&lt;&#x2F;span&gt;&lt;span&gt; difficulty&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bool&lt;&#x2F;span&gt;&lt;span&gt; gasLimit&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bool&lt;&#x2F;span&gt;&lt;span&gt; number&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bool&lt;&#x2F;span&gt;&lt;span&gt; timestamp&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bool&lt;&#x2F;span&gt;&lt;span&gt; txOrigin&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bool&lt;&#x2F;span&gt;&lt;span&gt; txGasPrice&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; maxBlockNumber&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; maxBlockTimestamp&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Constraint&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; slot&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; minValue&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; maxValue&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Dependency&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bool&lt;&#x2F;span&gt;&lt;span&gt; balance&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bool&lt;&#x2F;span&gt;&lt;span&gt; code&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bool&lt;&#x2F;span&gt;&lt;span&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bool&lt;&#x2F;span&gt;&lt;span&gt; allSlots&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; slots&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Constraint&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; constraints&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Replacement&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; oldAddr&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; newAddr&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    SlotReplacement&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; slots&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SlotReplacement&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; slot&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; simulationSettings&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    Operation&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _operation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    Replacement&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; replacements&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isOperationReady&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    Operation&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _operation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; readiness&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    GlobalDependency&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; globalDependency&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    Dependency&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; dependencies&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Endorsers SHOULD be registered in the &lt;code&gt;EndorserRegistry&lt;&#x2F;code&gt; with an amount of burned ETH.
The amount of ETH to be burned is not specified in this proposal as mempool operators are free to set their own minimum thresholds.
Mempool operators MAY accept operations from endorsers without any burned ETH, but they would increase their risk exposing themselves to denial of service attacks.
Mempool operators MAY publish the minimum amount of burned ETH required for each endorser.&lt;&#x2F;p&gt;
&lt;p&gt;To check for operation status, the caller must first call &lt;code&gt;simulationSettings&lt;&#x2F;code&gt; to retrieve a list of on chain alterations.
Then call when the &lt;code&gt;isOperationReady&lt;&#x2F;code&gt; method is called, the endorser must return this information:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;readiness:&lt;&#x2F;strong&gt; when returning &lt;code&gt;true&lt;&#x2F;code&gt;, it means the transaction MUST be executed correctly and the bundler MUST be paid the offered gas fees (even if the underlying intent of the operation fails).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;globalDependency:&lt;&#x2F;strong&gt; a list of possible dependencies that don&#x27;t belong to a given address, defines if the execution of the transaction MAY be invalidated by a change on one of these global variables. &lt;code&gt;maxBlockNumber&lt;&#x2F;code&gt; and &lt;code&gt;maxBlockTimestamp&lt;&#x2F;code&gt; are used as global constraints.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;dependencies:&lt;&#x2F;strong&gt; a comprehensive list of addresses and storage slots that must be monitored; any state change in these dependencies MUST trigger a re-evaluation of the operation&#x27;s readiness.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The information provided by the endorser helps the mempool operator maintain a pool of &quot;good&quot; AA transactions that behave correctly; but it only provides a soft guarantee that the transaction will be executed correctly. Bundlers must always simulate the result of the execution before including a transaction in a block.&lt;&#x2F;p&gt;
&lt;p&gt;If the result of a simulation fails and the endorser still returns &lt;code&gt;readiness == true&lt;&#x2F;code&gt; with the same dependencies, then the endorser can not be trusted and it MUST be banned by the mempool operator.&lt;&#x2F;p&gt;
&lt;p&gt;The dependency list serves as a shortcut for the bundler to know which operations are fully independent from each other. This shortcut is useful for (a) clearing the mempool from operations that are no longer valid, and (b) for bundlers to know which operations can be included in the same block.&lt;&#x2F;p&gt;
&lt;p&gt;For efficiency, additional information MAY be provided to the endorser with &lt;code&gt;endorserCallData&lt;&#x2F;code&gt;.
If used, the endorser MUST validate that the provided &lt;code&gt;endorserCallData&lt;&#x2F;code&gt; is valid and relevant to the other values provided.&lt;&#x2F;p&gt;
&lt;p&gt;While the endorser is deployed on chain, calls to the endorser MUST NOT be submitted on chain. The bundler MUST read the results of &lt;code&gt;simulationSettings&lt;&#x2F;code&gt;, perform chain alterations and simulate the execution off chain.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;global-dependencies&quot;&gt;Global Dependencies&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Field&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;baseFee&lt;&#x2F;td&gt;&lt;td&gt;bool&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;true&lt;&#x2F;code&gt; if the &lt;code&gt;block.basefee&lt;&#x2F;code&gt; should be considered a dependency.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;blobBaseFee&lt;&#x2F;td&gt;&lt;td&gt;bool&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;true&lt;&#x2F;code&gt; if the &lt;code&gt;block.blockbasefee&lt;&#x2F;code&gt; should be considered a dependency.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;chainId&lt;&#x2F;td&gt;&lt;td&gt;bool&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;true&lt;&#x2F;code&gt; if the &lt;code&gt;block.chainid&lt;&#x2F;code&gt; should be considered a dependency.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;coinbase&lt;&#x2F;td&gt;&lt;td&gt;bool&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;true&lt;&#x2F;code&gt; if the &lt;code&gt;block.coinbase&lt;&#x2F;code&gt; should be considered a dependency.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;difficulty&lt;&#x2F;td&gt;&lt;td&gt;bool&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;true&lt;&#x2F;code&gt; if the &lt;code&gt;block.difficulty&lt;&#x2F;code&gt; should be considered a dependency.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;gasLimit&lt;&#x2F;td&gt;&lt;td&gt;bool&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;true&lt;&#x2F;code&gt; if the &lt;code&gt;block.gaslimit&lt;&#x2F;code&gt; should be considered a dependency.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;number&lt;&#x2F;td&gt;&lt;td&gt;bool&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;true&lt;&#x2F;code&gt; if the &lt;code&gt;block.number&lt;&#x2F;code&gt; should be considered a dependency.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;timestamp&lt;&#x2F;td&gt;&lt;td&gt;bool&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;true&lt;&#x2F;code&gt; if the &lt;code&gt;block.timestamp&lt;&#x2F;code&gt; should be considered a dependency.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;txOrigin&lt;&#x2F;td&gt;&lt;td&gt;bool&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;true&lt;&#x2F;code&gt; if the &lt;code&gt;tx.origin&lt;&#x2F;code&gt; should be considered a dependency.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;txGasPrice&lt;&#x2F;td&gt;&lt;td&gt;bool&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;true&lt;&#x2F;code&gt; if the &lt;code&gt;tx.gasprice&lt;&#x2F;code&gt; should be considered a dependency.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;maxBlockNumber&lt;&#x2F;td&gt;&lt;td&gt;uint256&lt;&#x2F;td&gt;&lt;td&gt;The maximum value of &lt;code&gt;block.number&lt;&#x2F;code&gt; that &lt;code&gt;readiness&lt;&#x2F;code&gt; applies to.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;maxBlockTimestamp&lt;&#x2F;td&gt;&lt;td&gt;uint256&lt;&#x2F;td&gt;&lt;td&gt;The maximum value of &lt;code&gt;block.timestamp&lt;&#x2F;code&gt; that &lt;code&gt;readiness&lt;&#x2F;code&gt; applies to.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The &lt;code&gt;endorser&lt;&#x2F;code&gt; MUST use the &lt;code&gt;maxBlockNumber&lt;&#x2F;code&gt; and &lt;code&gt;maxBlockTimestamp&lt;&#x2F;code&gt; fields to limit the validity of the &lt;code&gt;readiness&lt;&#x2F;code&gt; result. This is useful for operations that are only valid for a certain period of time.&lt;&#x2F;p&gt;
&lt;p&gt;Note that all values are &lt;strong&gt;inclusive&lt;&#x2F;strong&gt;. If the &lt;code&gt;endorser&lt;&#x2F;code&gt; determines the validity of the &lt;code&gt;operation&lt;&#x2F;code&gt; is indefinite, the &lt;code&gt;maxBlockNumber&lt;&#x2F;code&gt; and &lt;code&gt;maxBlockTimestamp&lt;&#x2F;code&gt; fields MUST be set to &lt;code&gt;type(uint256).max&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;dependencies&quot;&gt;Dependencies&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Field&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;addr&lt;&#x2F;td&gt;&lt;td&gt;address&lt;&#x2F;td&gt;&lt;td&gt;Contract address of the dependencies entry. &lt;em&gt;(Only one entry per address is allowed)&lt;&#x2F;em&gt;.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;balance&lt;&#x2F;td&gt;&lt;td&gt;bool&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;true&lt;&#x2F;code&gt; if the balance of &lt;code&gt;addr&lt;&#x2F;code&gt; should be considered a dependency of the &lt;code&gt;operation&lt;&#x2F;code&gt;.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;code&lt;&#x2F;td&gt;&lt;td&gt;bool&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;true&lt;&#x2F;code&gt; if the code of &lt;code&gt;addr&lt;&#x2F;code&gt; should be considered a dependency of the &lt;code&gt;operation&lt;&#x2F;code&gt;.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;nonce&lt;&#x2F;td&gt;&lt;td&gt;bool&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;true&lt;&#x2F;code&gt; if the nonce of &lt;code&gt;addr&lt;&#x2F;code&gt; should be considered a dependency of the &lt;code&gt;operation&lt;&#x2F;code&gt;.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;allSlots&lt;&#x2F;td&gt;&lt;td&gt;bool&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;true&lt;&#x2F;code&gt; if all storage slots of &lt;code&gt;addr&lt;&#x2F;code&gt; should be considered a dependency of the &lt;code&gt;operation&lt;&#x2F;code&gt;.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;slots&lt;&#x2F;td&gt;&lt;td&gt;bytes32[]&lt;&#x2F;td&gt;&lt;td&gt;List of all storage slots of &lt;code&gt;addr&lt;&#x2F;code&gt; that should be considered dependencies of &lt;code&gt;operation&lt;&#x2F;code&gt;.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;constraints&lt;&#x2F;td&gt;&lt;td&gt;Constraint[]&lt;&#x2F;td&gt;&lt;td&gt;List of storage slots of &lt;code&gt;addr&lt;&#x2F;code&gt; that have a range of specific values as dependencies.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The &lt;code&gt;endorser&lt;&#x2F;code&gt; does not need to include all accessed storage slots on the dependencies list, it only needs to include storage slots that after a change may also result in a change of readiness.&lt;&#x2F;p&gt;
&lt;p&gt;Note that &lt;code&gt;allSlots&lt;&#x2F;code&gt;, &lt;code&gt;constraints&lt;&#x2F;code&gt; and &lt;code&gt;slots&lt;&#x2F;code&gt; are mutually exclusive. If &lt;code&gt;allSlots&lt;&#x2F;code&gt; is set to &lt;code&gt;true&lt;&#x2F;code&gt;, then &lt;code&gt;constraints&lt;&#x2F;code&gt; and &lt;code&gt;slots&lt;&#x2F;code&gt; MUST be empty arrays.
If a slot is listed in &lt;code&gt;constraints&lt;&#x2F;code&gt;, it MUST NOT be listed in &lt;code&gt;slots&lt;&#x2F;code&gt;.
The &lt;code&gt;endorser&lt;&#x2F;code&gt; should prefer to use &lt;code&gt;constraints&lt;&#x2F;code&gt; over &lt;code&gt;slots&lt;&#x2F;code&gt;, and &lt;code&gt;slots&lt;&#x2F;code&gt; over &lt;code&gt;allSlots&lt;&#x2F;code&gt; whenever possible to limit reevaluation requirements of the bundler.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;E.g. A wallet may pay fees using funds stored as WETH. During &lt;code&gt;isOperationReady()&lt;&#x2F;code&gt;, the endorser contract may call the &lt;code&gt;balanceOf&lt;&#x2F;code&gt; method of the &lt;code&gt;WETH&lt;&#x2F;code&gt; contract to determine if the wallet has enough &lt;code&gt;WETH&lt;&#x2F;code&gt; balance. Even though the ETH balance of the WETH contract and the code of the WETH contract are being accessed, the endorser only cares about the user&#x27;s WETH balance for this operation and hence does not include these as dependencies.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h4 id=&quot;constraints&quot;&gt;Constraints&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Field&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;slot&lt;&#x2F;td&gt;&lt;td&gt;bytes32&lt;&#x2F;td&gt;&lt;td&gt;Storage slot of &lt;code&gt;addr&lt;&#x2F;code&gt; that has a range of specific values as dependencies.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;minValue&lt;&#x2F;td&gt;&lt;td&gt;bytes32&lt;&#x2F;td&gt;&lt;td&gt;Minimum value (inclusive) of &lt;code&gt;slot&lt;&#x2F;code&gt; that &lt;code&gt;readiness&lt;&#x2F;code&gt; applies to.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;maxValue&lt;&#x2F;td&gt;&lt;td&gt;bytes32&lt;&#x2F;td&gt;&lt;td&gt;Maximum value (inclusive) of &lt;code&gt;slot&lt;&#x2F;code&gt; that &lt;code&gt;readiness&lt;&#x2F;code&gt; applies to.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The &lt;code&gt;endorser&lt;&#x2F;code&gt; can use the &lt;code&gt;minValue&lt;&#x2F;code&gt; and &lt;code&gt;maxValue&lt;&#x2F;code&gt; fields to limit the validity of the &lt;code&gt;readiness&lt;&#x2F;code&gt; result. This allows the endorser to fully validate an operation, even when this operation depends on storage values that are not directly accessible by the endorser.&lt;&#x2F;p&gt;
&lt;p&gt;Note that all values are &lt;strong&gt;inclusive&lt;&#x2F;strong&gt;. When an exact value is required, &lt;code&gt;minValue&lt;&#x2F;code&gt; and &lt;code&gt;maxValue&lt;&#x2F;code&gt; should be set to the same value.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;simulation-settings&quot;&gt;Simulation settings&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;simulationSettings&lt;&#x2F;code&gt; method returns a list of replacements that the bundler should apply to the operation before simulating the &lt;code&gt;isOperationReady&lt;&#x2F;code&gt;. Note that these replacements are only used for &lt;code&gt;isOperationReady&lt;&#x2F;code&gt; simulation and are not applied when simulating the operation itself.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Field&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;oldAddr&lt;&#x2F;td&gt;&lt;td&gt;address&lt;&#x2F;td&gt;&lt;td&gt;The on chain address where contract code is currently located.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;newAddr&lt;&#x2F;td&gt;&lt;td&gt;address&lt;&#x2F;td&gt;&lt;td&gt;The address the contract code should be located when performing simulation.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;slots.slot&lt;&#x2F;td&gt;&lt;td&gt;bytes32&lt;&#x2F;td&gt;&lt;td&gt;The slot location to be changed.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;slots.value&lt;&#x2F;td&gt;&lt;td&gt;bytes32&lt;&#x2F;td&gt;&lt;td&gt;The value of the slot to be set before performing simulation.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The &lt;code&gt;endorser&lt;&#x2F;code&gt; MAY use the &lt;code&gt;simulationSettings&lt;&#x2F;code&gt; method to provide a list of replacements that the bundler should apply to the network before simulating &lt;code&gt;isOperationReady&lt;&#x2F;code&gt;. This is useful for operations that must be called from specific contract addresses or that depend on specific storage values (e.g. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt;&#x27;s EntryPoint).&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;endorser&lt;&#x2F;code&gt; MAY provide it&#x27;s own address for replacement. In this event, the bundler should update the &lt;code&gt;endorser&lt;&#x2F;code&gt; address used when calling &lt;code&gt;isOperationReady&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;misbehavior-detection&quot;&gt;Misbehavior detection&lt;&#x2F;h3&gt;
&lt;p&gt;It is possible for &lt;code&gt;endorser&lt;&#x2F;code&gt; contracts to behave maliciously or erratically in the following ways:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;(1) It considers an operation &quot;ready&quot;, but when the operation is executed it transfers less than the agreed-upon fees to the bundler.&lt;&#x2F;li&gt;
&lt;li&gt;(2) It considers an operation &quot;ready&quot;, but when the operation is executed the top-level call fails.&lt;&#x2F;li&gt;
&lt;li&gt;(3) It changes the readiness from &lt;code&gt;true&lt;&#x2F;code&gt; to &lt;code&gt;false&lt;&#x2F;code&gt; while none of the dependencies register any change.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The bundler MUST discard and re-evaluate the readiness status after a change on any of the dependencies of the &lt;code&gt;operation&lt;&#x2F;code&gt;, meaning that only operations considered &lt;code&gt;ready&lt;&#x2F;code&gt; are candidates for constructing the next block.&lt;&#x2F;p&gt;
&lt;p&gt;If, when simulating the final inclusion of the operation, the bundler discovers that it does not result in correct payment (either because the transaction fails, or transferred amount is below the defined fee), then it MUST ban the &lt;code&gt;endorser&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;When an &lt;code&gt;endorser&lt;&#x2F;code&gt; is banned, the mempool operator MUST drop all &lt;code&gt;operations&lt;&#x2F;code&gt; related to the endorser.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;untrusted-environment&quot;&gt;Untrusted environment&lt;&#x2F;h3&gt;
&lt;p&gt;In some scenarios, the &lt;code&gt;endorser&lt;&#x2F;code&gt; may not be able to fully validate the &lt;code&gt;operation&lt;&#x2F;code&gt; but may be able to infer that a given code path &lt;em&gt;should&lt;&#x2F;em&gt; be safe. In these cases, the endorser can mark a section of the operation as &lt;code&gt;untrusted&lt;&#x2F;code&gt;. Any storage slots (balance, code, nonce, or specific slots) accessed in this untrusted context should be automatically considered as dependencies.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Endorser&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UntrustedStarted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UntrustedEnded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The endorser can use the &lt;code&gt;UntrustedStarted&lt;&#x2F;code&gt; and &lt;code&gt;UntrustedEnded&lt;&#x2F;code&gt; events to signal the start and end of an untrusted context. The bundler should listen to these events and extend the dependencies list accordingly.&lt;&#x2F;p&gt;
&lt;p&gt;Only the top-level &lt;code&gt;endorser&lt;&#x2F;code&gt; can signal an untrusted context; any other events with the same signature but emitted by a different contract should be ignored.&lt;&#x2F;p&gt;
&lt;p&gt;Untrusted contexts can be opened and closed multiple times and can be nested. If multiple events are emitted, the bundler MUST count the number of &lt;code&gt;UntrustedStarted&lt;&#x2F;code&gt; and &lt;code&gt;UntrustedEnded&lt;&#x2F;code&gt; events and only consider the untrusted context as ended when the number of &lt;code&gt;UntrustedEnded&lt;&#x2F;code&gt; events is equal to the number of &lt;code&gt;UntrustedStarted&lt;&#x2F;code&gt; events.&lt;&#x2F;p&gt;
&lt;p&gt;If &lt;code&gt;hasUntrustedContext&lt;&#x2F;code&gt; is set to &lt;code&gt;false&lt;&#x2F;code&gt;, the bundler should ignore any &lt;code&gt;UntrustedStarted&lt;&#x2F;code&gt; and &lt;code&gt;UntrustedEnded&lt;&#x2F;code&gt; events.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;automatic-dependency-graph-construction&quot;&gt;Automatic dependency graph construction&lt;&#x2F;h4&gt;
&lt;p&gt;All code executed within the untrusted context must be monitored. If the code executes any of the following opcodes, the dependency graph must be extended accordingly.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Opcode&lt;&#x2F;th&gt;&lt;th&gt;Dependency&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;BALANCE&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;dependencies[addr].balance = true&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;ORIGIN&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;global.txOrigin = true&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;CODESIZE&lt;&#x2F;td&gt;&lt;td&gt;None&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;CODECOPY&lt;&#x2F;td&gt;&lt;td&gt;None&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;GASPRICE&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;global.txGasPrice = true&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;EXTCODESIZE&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;dependencies[addr].code = true&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;EXTCODECOPY&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;dependencies[addr].code = true&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;EXTCODEHASH&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;dependencies[addr].code = true&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;COINBASE&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;global.coinbase = true&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;TIMESTAMP&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;global.timestamp = true&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;NUMBER&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;global.number = true&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;DIFFICULTY&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;global.difficulty = true&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;PREVRANDAO&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;global.difficulty = true&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;CHAINID&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;global.chainId = true&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;SELFBALANCE&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;dependencies[self].balance = true&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;BASEFEE&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;global.baseFee = true&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;SLOAD&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;dependencies[addr].slots[slot] = true&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;CREATE&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;dependencies[addr].nonce = true&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;CREATE2&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;dependencies[contract].code = true&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Notice that untrusted contexts generate a lot of dependencies and may generate many false positives. This may lead to numerous re-evaluations and thus to the operation being dropped from the mempool. A bundler MAY choose to drop operations if the number of dependencies exceeds a certain threshold.&lt;&#x2F;p&gt;
&lt;p&gt;Block-level dependencies are specially sensitive as they will be shared with a large number of operations.&lt;&#x2F;p&gt;
&lt;p&gt;It is recommended to use untrusted contexts only when necessary, like when an &lt;code&gt;endorser&lt;&#x2F;code&gt; needs to validate a nested signature to a wallet that is not under its control.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;fee-payment&quot;&gt;Fee payment&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;endorser&lt;&#x2F;code&gt; MUST guarantee that the operation will repay at least the spent gas to &lt;code&gt;tx.origin&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The payment is always made in the &lt;code&gt;feeToken&lt;&#x2F;code&gt;, which can be any token standard (E.g. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;). If &lt;code&gt;feeToken&lt;&#x2F;code&gt; is &lt;code&gt;address(0)&lt;&#x2F;code&gt;, then payment is made in the native currency. When &lt;code&gt;feeToken&lt;&#x2F;code&gt; is &lt;code&gt;address(0)&lt;&#x2F;code&gt;, &lt;code&gt;feeScalingFactor&lt;&#x2F;code&gt; and &lt;code&gt;feeNormalizationFactor&lt;&#x2F;code&gt; MUST be equal to &lt;code&gt;1&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;All units are expressed in the native token unit. The result of the fee calculation is then converted to the &lt;code&gt;feeToken&lt;&#x2F;code&gt; unit using the &lt;code&gt;feeScalingFactor&lt;&#x2F;code&gt; and &lt;code&gt;feeNormalizationFactor&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The gas units consider a fixed amount of gas (&lt;code&gt;fixedGas&lt;&#x2F;code&gt;) and a variable amount of gas (&lt;code&gt;gasLimit&lt;&#x2F;code&gt;). Allowing fixed costs caters for gas overheads which may be outside the scope of the on chain execution, such as calldata fees. This also allows repayment to be reduced when execution is cheaper than expected (such as when an inner call fails without reverting the top-level transaction), while still repaying the bundler.&lt;&#x2F;p&gt;
&lt;p&gt;The expected gas repayment is calculated as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gasUnits = op.fixedGas + Min(gasUsed, op.gasLimit)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;feePerGas = Min(op.maxFeePerGas, block.baseFee + op.priorityFeePerGas)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;expectedRepayment = (gasUnits * feePerGas * op.feeScalingFactor) &#x2F; op.feeNormalizationFactor&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;While the &lt;code&gt;endorser&lt;&#x2F;code&gt; MUST guarantee the repayment of &lt;code&gt;expectedRepayment&lt;&#x2F;code&gt;, the actual repayment amount MAY exceed this fee. E.g. For ease of development, a bundler MAY choose to only endorse operations that repay the maximum values provided by the operation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;operation-identification&quot;&gt;Operation identification&lt;&#x2F;h3&gt;
&lt;p&gt;Operations can be identified by their operation hash, which is calculated as a CIDv1 multihash of a &lt;code&gt;raw&lt;&#x2F;code&gt; file, containing the canonical JSON representation of the operation. This hash is never used on-chain, but it serves as a unique pointer to the operation that can be shared across systems.&lt;&#x2F;p&gt;
&lt;p&gt;The operation MAY be pinned on the IPFS network; this would allow other participants to retrieve the content of the operation after the operation has been removed from the mempool. This pinning is not mandatory, and it may be performed by the mempool operator or by the wallet itself if visibility of the operation is desired.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;bundler-behavior-upon-receiving-an-operation&quot;&gt;Bundler behavior upon receiving an operation&lt;&#x2F;h3&gt;
&lt;p&gt;Bundlers can add their own rules for how to ensure the successful relaying of AA transactions and for getting paid for relaying these transactions. However, we propose here a baseline specification that should be sufficient.&lt;&#x2F;p&gt;
&lt;p&gt;When a bundler receives an &lt;code&gt;operation&lt;&#x2F;code&gt;, it SHOULD perform these sanity checks:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;endorserGasLimit&lt;&#x2F;code&gt; is sufficiently low (&amp;lt;= &lt;code&gt;MAX_ENDORSER_GAS&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;The endorser (i) is registered and has enough burn (&amp;gt;= &lt;code&gt;MIN_ENDORSER_BURN&lt;&#x2F;code&gt;), and (ii) it has not been internally flagged as banned.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;fixedGas&lt;&#x2F;code&gt; is large enough to cover the cost associated with submitting the transaction (i.e. calldata gas costs).&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;gasLimit&lt;&#x2F;code&gt; is at least the cost of a &lt;code&gt;CALL&lt;&#x2F;code&gt; with a non-zero value.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;feeToken&lt;&#x2F;code&gt; is &lt;code&gt;address(0)&lt;&#x2F;code&gt; or a known token address that the bundler is willing to accept.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;feeScalingFactor&lt;&#x2F;code&gt; and &lt;code&gt;feeNormalizationFactor&lt;&#x2F;code&gt; are &lt;code&gt;1&lt;&#x2F;code&gt; for a &lt;code&gt;feeToken&lt;&#x2F;code&gt; value of &lt;code&gt;address(0)&lt;&#x2F;code&gt; or values the bundler is willing to accept.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;maxFeePerGas&lt;&#x2F;code&gt; and &lt;code&gt;priorityPerGas&lt;&#x2F;code&gt; are above a configurable minimum value the bundler is willing to accept.&lt;&#x2F;li&gt;
&lt;li&gt;If another operation exists in the mempool with the exact same dependency set AND the same endorser address, the &lt;code&gt;maxFeePerGas&lt;&#x2F;code&gt; and &lt;code&gt;priorityFeePerGas&lt;&#x2F;code&gt; of the newly received operation MUST be 12% higher than the one on the mempool to replace it. (Similar with how EOA with same nonce work)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The bundler should then perform evaluation of the operation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;evaluation&quot;&gt;Evaluation&lt;&#x2F;h3&gt;
&lt;p&gt;To evaluate the &lt;code&gt;operation&lt;&#x2F;code&gt;, the bundler MUST call &lt;code&gt;simulationSettings()&lt;&#x2F;code&gt; on the &lt;code&gt;endorser&lt;&#x2F;code&gt; to obtain simulation setting values. The bundler MUST apply the settings and &lt;strong&gt;simulate&lt;&#x2F;strong&gt; a call to &lt;code&gt;isOperationReady()&lt;&#x2F;code&gt; on the &lt;code&gt;endorser&lt;&#x2F;code&gt;. If the endorser considers the operation ready, and the constraints are within bounds, then the client MUST add the operation to the mempool. Otherwise, the operation MUST be dropped.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;endorser&lt;&#x2F;code&gt; result SHOULD be invalidated and its readiness SHOULD be re-evaluated if any of the values of the provided dependencies change. If the operation readiness changes to &lt;code&gt;false&lt;&#x2F;code&gt;, the operation MUST be discarded.&lt;&#x2F;p&gt;
&lt;p&gt;Before including the operation in a block, a last simulation MUST be performed, this time by constructing the block and probing the result. All transactions in the block listed &lt;strong&gt;before&lt;&#x2F;strong&gt; the operation must be simulated and then the &lt;code&gt;endorser&lt;&#x2F;code&gt; must be queried for readiness in-case some dependencies changed. Then constraints MUST be re-evaluated for correctness. Finally, the &lt;strong&gt;operation&lt;&#x2F;strong&gt; MUST be simulated.&lt;&#x2F;p&gt;
&lt;p&gt;If the &lt;strong&gt;operation&lt;&#x2F;strong&gt; fails during the final simulation, the &lt;code&gt;endorser&lt;&#x2F;code&gt; MUST be banned because (i) it returned a bad readiness state or (ii) it changed the operation readiness independently from the dependencies.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;optional-rules&quot;&gt;Optional rules&lt;&#x2F;h3&gt;
&lt;p&gt;Mempool clients MAY implement additional rules to further protect against maliciously constructed transactions.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Limit the size of accepted dependencies to &lt;code&gt;MAX_OPERATION_DEPENDENCIES&lt;&#x2F;code&gt;, dropping operations that cross the boundary.&lt;&#x2F;li&gt;
&lt;li&gt;Limit the number of times an operation may trigger a re-evaluation to &lt;code&gt;MAX_OPERATION_REEVALS&lt;&#x2F;code&gt;, dropping operations that cross the boundary.&lt;&#x2F;li&gt;
&lt;li&gt;Limit the number of operations in the mempool that depend on the same dependency slots.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;If these rules are widely adopted, wallet developers should keep usage of dependencies to the lowest possible levels and avoid shared dependency slots that are frequently updated.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;after-operation-inclusion&quot;&gt;After operation inclusion&lt;&#x2F;h3&gt;
&lt;p&gt;There is no limit in-place that defines that an operation can only be executed once.&lt;&#x2F;p&gt;
&lt;p&gt;The bundler SHOULD NOT drop an &lt;code&gt;operation&lt;&#x2F;code&gt; after successfully including such operation in a block, the bundler MAY perform evaluation.&lt;&#x2F;p&gt;
&lt;p&gt;If the &lt;code&gt;endorser&lt;&#x2F;code&gt; still returns &lt;code&gt;readiness == true&lt;&#x2F;code&gt; (after inclusion) then the operation SHOULD be treated as any other healthy operation, and thus it MAY be kept in the mempool.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;endorser-registry&quot;&gt;Endorser registry&lt;&#x2F;h3&gt;
&lt;p&gt;The endorser registry serves as a place to register the burn of each endorser, anyone can increase the burn of any endorser by calling the &lt;code&gt;addBurn()&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;p&gt;All burn is effectively locked forever; slashing can&#x27;t be reliably proved on-chain without protocol alterations, so it remains a virtual event on which mempool operators will ignore the deposited ETH.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h4&gt;
&lt;p&gt;(EXAMPLE)&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: UNLICENSED&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.15&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EndorserRegistry&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Burned&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _endorser&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _new&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _total&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; burn&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addBurn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _endorser&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; total &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; burn&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_endorser&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    burn&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_endorser&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; total&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Burned&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_endorser&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; total&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; total&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;griefing-protection&quot;&gt;Griefing protection&lt;&#x2F;h3&gt;
&lt;p&gt;The main challenge with a purely smart contract wallet-based account abstraction system is DoS safety: how can a bundler that includes an operation make sure it will be paid without executing the entire operation?&lt;&#x2F;p&gt;
&lt;p&gt;Bundlers could execute the entire operation to determine if it is healthy or not, but this operation may be expensive and complex for the following reasons:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The bundler does not have a way to simulate the transaction with a reduced amount of gas; it has to use the whole &lt;code&gt;gasLimit&lt;&#x2F;code&gt;, exposing itself to a higher level of griefing.&lt;&#x2F;li&gt;
&lt;li&gt;The bundler does not have a way to know if a change to the state will affect the operation or not, and thus it has to re-evaluate the operation after every single change.&lt;&#x2F;li&gt;
&lt;li&gt;The bundler does not have a way to know if a change to the state will invalidate a large portion of the mempool.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In this proposal, we add the &lt;code&gt;endorser&lt;&#x2F;code&gt; as a tool for the bundlers to validate arbitrary operations in a controlled manner, without the bundler having to know any of the inner workings of such operation.&lt;&#x2F;p&gt;
&lt;p&gt;In effect, we move the responsibility from the wallet to the wallet developer; the developer must code, deploy and burn ETH for the &lt;code&gt;endorser&lt;&#x2F;code&gt;; this is a nearly ideal scenario because developers know how their wallet operations work, and thus they can build tools to evaluate these operations efficiently.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, the specification is kept as simple as possible as enforcing a highly structured behavior and schema for smart contract wallet transactions may stagnate the adoption of more innovative types of wallets and the adoption of a shared standard among them.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;burned-eth&quot;&gt;Burned ETH&lt;&#x2F;h3&gt;
&lt;p&gt;Anyone can deploy a endorser contract and wallet clients are the one providing which endorser contract should be used for the given transaction. Instead of having each bundler rely on an off-chain registry that they need to maintain, the endorser registry can be called to see if the requested endorser contract is present and how much ETH was burned for it. Bundlers can then decide a minimum treshshold for how much ETH burnt is required for an endorser contract to be accepted. Bundlers are also free to support endorsers contract that are not part of the registry or are part of it but have no ETH burned associated.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;minimum-overhead&quot;&gt;Minimum overhead&lt;&#x2F;h3&gt;
&lt;p&gt;Since the validation of an AA transactions is done off-chain by the bundler rather than at execution time, there is no additional gas fee overhead for executing transactions. The bundler bears the risk rather than all users having to pay for that security.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;differences-with-alternative-proposals&quot;&gt;Differences with alternative proposals&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;This proposal does not require monitoring for forbidden opcodes or storage access boundaries. Wallets have complete freedom to use any EVM capabilities during validation and execution.&lt;&#x2F;li&gt;
&lt;li&gt;This proposal does not specify any replay protection logic since all existing smart contract wallets already have their own, and designs can vary among them. Nonces can be communicated to the bundler using a &lt;code&gt;dependency&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;This proposal does not specify a pre-deployment logic because it can be handled directly by the entrypoint.&lt;&#x2F;li&gt;
&lt;li&gt;This proposal does not require wallets to accept &lt;code&gt;execution&lt;&#x2F;code&gt; transactions from a trusted entrypoint contract, reducing overhead and allowing existing wallets to be compatible with the proposal.&lt;&#x2F;li&gt;
&lt;li&gt;This proposal does not distinguish between &lt;code&gt;execution&lt;&#x2F;code&gt; and &lt;code&gt;signature&lt;&#x2F;code&gt; payloads, this distinction remains implementation-specific.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC does not change he consensus layer, nor does impose changes on existing smart contract wallets, so there are no backwards compatibility issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC does not make changes to on-chain interactions. Endorsers are explicitly for off-chain validations.&lt;&#x2F;p&gt;
&lt;p&gt;Bundlers are responsible for managing their own security and for ensuring that they are paid for the transactions they include in blocks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Account-bound Finance</title>
        <published>2022-06-29T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Hyungsuk Kang</name><uri>https://github.com/hskang9</uri>
	</author>
	
	<author>
		<name>Viktor Pernjek</name><uri>https://github.com/smuxx</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5252/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/pr-5252-discussion-account-bound-finance/10027" />
        

        <id>https://wg-eips.ritovision.com/5252/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:5252"
            label="ERC-5252" />
        

        
        

        
        <summary type="html">An ERC-5114 extension that aids in preventing arbitrary loss of funds</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5252/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes a form of smart contract design pattern and a new type of account abstraction on how one&#x27;s finance should be managed, ensuring transparency of managing investments and protection with self-sovereignty even from its financial operators. This EIP enables greater self-sovereignty of one&#x27;s assets using a personal finance contract for each individual. The separation between an investor&#x27;s funds and the operation fee is clearly specified in the personal smart contract, so investors can ensure safety from arbitrary loss of funds by the operating team&#x27;s control.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP extends &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5114&#x2F;&quot;&gt;ERC-5114&lt;&#x2F;a&gt; to further enable transferring fund to other accounts for mobility between managing multiple wallets.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Decentralized finance (DeFi) faces a trust issue. Smart contracts are often proxies, with the actual logic of the contract hidden away in a separate logic contract. Many projects include a multi-signature &quot;wallet&quot; with unnecessarily-powerful permissions. And it is not possible to independently verify that stablecoins have enough real-world assets to continue maintaining their peg, creating a large loss of funds (such as happened in the official bankruptcy announcement of Celsius and UST de-pegging and anchor protocol failure). One should not trust exchanges or other third parties with one&#x27;s own investments with the operators&#x27; clout in Web3.0.&lt;&#x2F;p&gt;
&lt;p&gt;Smart contracts are best implemented as a promise between two parties written in code, but current DeFi contracts are often formed using less than 7 smart contracts to manage their whole investors&#x27; funds, and often have a trusted key that has full control. This is evidently an issue, as investors have to trust contract operators with their funds, meaning that users do not actually own their funds.&lt;&#x2F;p&gt;
&lt;p&gt;The pattern with personal finance contract also offers more transparency than storing mixed fund financial data in the operating team&#x27;s contract. With a personal finance contract, an account&#x27;s activity is easier to track than one global smart contract&#x27;s activity. The pattern introduces a Non-Fungiible Account-Bound Token (ABT) to store credentials from the personal finance contract.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;offchain-identity-vs-soul-bound-token-on-credentials&quot;&gt;Offchain-identity vs Soul-bound token on credentials&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP provides a better alternative to off-chain identity solutions which take over the whole system because their backends eventually rely on the trust of the operator, not cryptographic proof (e.g. Proof-of-work, Proof-of-stake, etc). Off-chain identity as credentials are in direct opposition to the whole premise of crypto. Soulbound tokens are a better, verifiable credential, and data stored off-chain is only to store token metadata.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;The specification consists of two patterns for &lt;strong&gt;Interaction&lt;&#x2F;strong&gt; and &lt;strong&gt;Governance&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;interaction&quot;&gt;Interaction&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;interfaces&quot;&gt;Interfaces&lt;&#x2F;h4&gt;
&lt;p&gt;The interaction pattern consists of 4 components for interaction; manager, factory, finance, account-bound token, and extension.&lt;&#x2F;p&gt;
&lt;p&gt;Interaction contract pattern is defined with these contracts:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A soul-bound or account bound token contract to give access to interact with a financial contract with credentials&lt;&#x2F;li&gt;
&lt;li&gt;A manager contract that interacts first contact with an investor&lt;&#x2F;li&gt;
&lt;li&gt;A factory contract that creates a financial contract for each user&lt;&#x2F;li&gt;
&lt;li&gt;A finance contract that can interact with the investor&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;requirements&quot;&gt;Requirements&lt;&#x2F;h4&gt;
&lt;p&gt;A soul-bound or account bound token contract is defined with these properties:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;It SHALL be non-fungible and MUST satisfy &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Credentials SHOULD be represented with its metadata with &lt;code&gt;tokenURI()&lt;&#x2F;code&gt; function.&lt;&#x2F;li&gt;
&lt;li&gt;It MUST only reference factory to verify its minting.&lt;&#x2F;li&gt;
&lt;li&gt;If it is transferrable, it is account-bound. If not, it is soul-bound.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;A manager contract is defined with these properties:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;It MUST be the only kind of contract which calls factory to create.&lt;&#x2F;li&gt;
&lt;li&gt;It SHOULD store all related configurations for financial parameters.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;A factory contract is defined with these properties:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;It SHALL clone the finance contract with uniform implementation.&lt;&#x2F;li&gt;
&lt;li&gt;It MUST be the only contract that can mint account-bound token.&lt;&#x2F;li&gt;
&lt;li&gt;It MUST keep an recent id of account bound token.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;A finance contract is defined with these properties:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;A finance contract MUST only be initialized once from factory contract in constructor.&lt;&#x2F;li&gt;
&lt;li&gt;Funds in the contract SHALL NOT be transferred to other contracts nor accounts unless sender who owns soul-bound or account bound token signs to do so.&lt;&#x2F;li&gt;
&lt;li&gt;Every state-changing function of the smart contract MUST only accept sender who owns soul-bound or account bound-token except global function(e.g. liquidation).&lt;&#x2F;li&gt;
&lt;li&gt;Global function SHOULD be commented as &lt;code&gt;&#x2F;* global *&#x2F;&lt;&#x2F;code&gt; to clarify the function is can be accessed with anyone.&lt;&#x2F;li&gt;
&lt;li&gt;Each finance contract SHOULD be able to represent transaction that has happened only with those who had account-bound token.&lt;&#x2F;li&gt;
&lt;li&gt;If soul-bound token is used for access, the finance contract MUST be able to represent transaction that has happened only between whom had the private key and the finance contract.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h4 id=&quot;contracts&quot;&gt;Contracts&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5252&#x2F;.&#x2F;assets&#x2F;media&#x2F;media.svg&quot; alt=&quot;Diagram&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;center&gt;
Contract Diagram of [ERC-5252](..&#x2F;05252.md)
&lt;&#x2F;center&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;Manager&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: &lt;strong&gt;&lt;code&gt;Manager&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; contract acts as an entry point to interact with the investor. The contract also stores parameters for &lt;strong&gt;&lt;code&gt;Finance&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; contract.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;Factory&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: &lt;strong&gt;&lt;code&gt;Factory&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; contract manages contract bytecode to create for managing investor&#x27;s fund and clones &lt;strong&gt;&lt;code&gt;Finance&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; contract on &lt;strong&gt;&lt;code&gt;Manager&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; contract&#x27;s approval. It also mints account-bound tokens to interact with the &lt;code&gt;Finance&lt;&#x2F;code&gt; contract.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;Finance&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: &lt;strong&gt;&lt;code&gt;Finance&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; contract specifies all rules on managing an investor&#x27;s fund. The contract is only accessible with an account that has an Account-bound token. When an investor deposits a fund to &lt;strong&gt;&lt;code&gt;Manager&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; contract, the contract sends the fund to &lt;strong&gt;&lt;code&gt;Finance&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; contract account after separating fees for operation.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;Account-bound token&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: &lt;strong&gt;&lt;code&gt;Account-bound token&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; contract in this EIP can bring the &lt;strong&gt;&lt;code&gt;Finance&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; contract&#x27;s data and add metadata. For example, if there is a money market lending
&lt;strong&gt;&lt;code&gt;Finance&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; contract, its &lt;strong&gt;&lt;code&gt;Account-bound token&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; can show how much balance is in agreement using SVG.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;Extension&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: &lt;strong&gt;&lt;code&gt;Extension&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; contract is another contract that can utilize locked funds in &lt;strong&gt;&lt;code&gt;Finance&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; contract. The contract can access with &lt;strong&gt;&lt;code&gt;Finance&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; contract on operator&#x27;s approval managed in &lt;strong&gt;&lt;code&gt;Manager&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; contract. Example use case of &lt;code&gt;Extension&lt;&#x2F;code&gt; can be a membership.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;Metadata&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: &lt;strong&gt;&lt;code&gt;Metadata&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; contract is the contract where it stores metadata related to account credentials. Credential related data are stored with specific key. Images are usually displayed as SVG, but offchain image is possible.&lt;&#x2F;p&gt;
&lt;hr &#x2F;&gt;
&lt;h3 id=&quot;governance&quot;&gt;Governance&lt;&#x2F;h3&gt;
&lt;p&gt;The governance pattern consists of 2 components; influencer and governor.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;interfaces-1&quot;&gt;Interfaces&lt;&#x2F;h4&gt;
&lt;h4 id=&quot;requirements-1&quot;&gt;Requirements&lt;&#x2F;h4&gt;
&lt;p&gt;An influencer contract is defined with these properties:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The contract SHALL manage multiplier for votes.&lt;&#x2F;li&gt;
&lt;li&gt;The contract SHALL set a decimal to calculated normalized scores.&lt;&#x2F;li&gt;
&lt;li&gt;The contract SHALL set a function where governance can decide factor parameters.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;A governor contract is defined with these properties:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The contract MUST satisfy Governor contract from OpenZeppelin.&lt;&#x2F;li&gt;
&lt;li&gt;The contract SHALL refer influencer contract for multiplier&lt;&#x2F;li&gt;
&lt;li&gt;The contract MUST limit transfer of account bound token once claimed for double vote prevention.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h4 id=&quot;from-token-governance-to-contribution-based-governance&quot;&gt;From Token Governance To Contribution Based Governance&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;&#x2F;th&gt;&lt;th&gt;Token Governance&lt;&#x2F;th&gt;&lt;th&gt;Credential-based Governance&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Enforcement&lt;&#x2F;td&gt;&lt;td&gt;More tokens, more power&lt;&#x2F;td&gt;&lt;td&gt;More contribution, More power&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Incentives&lt;&#x2F;td&gt;&lt;td&gt;More tokens, more incentives&lt;&#x2F;td&gt;&lt;td&gt;More contribution, more incentives&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Penalty&lt;&#x2F;td&gt;&lt;td&gt;No penalty&lt;&#x2F;td&gt;&lt;td&gt;Loss of power&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Assignment&lt;&#x2F;td&gt;&lt;td&gt;One who holds the token&lt;&#x2F;td&gt;&lt;td&gt;One who has the most influence&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;center&gt;
Token Governance vs Credential Based Governance
&lt;&#x2F;center&gt;
&lt;p&gt;Token governance is not sustainable in that it gives &lt;strong&gt;more&lt;&#x2F;strong&gt; power to &quot;those who most want to rule&quot;. Any individual who gets more than 51% of the token supply can forcefully take control.&lt;&#x2F;p&gt;
&lt;p&gt;New governance that considers contributions to the protocol is needed because:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Rulers can be penalized on breaking the protocol&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Rulers can be more effectively incentivized on maintaining the protocol&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The power should be given to &quot;those who are most responsible&quot;. Instead of locked or owned tokens, voting power is determined with contributions marked in Account Bound Tokens (ABT). This EIP defines this form of voting power as &lt;strong&gt;&lt;code&gt;Influence&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;calculating-influence&quot;&gt;Calculating Influence&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;Influence&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; is a multiplier on staked tokens that brings more voting power of a DAO to its contributors. To get &lt;strong&gt;&lt;code&gt;Influence&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;, a score is calculated on weighted contribution matrix. Then, the score is normalized to give a member&#x27;s position in whole distribution. Finally, the multiplier is determined on the position in every community members.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;calculating-score&quot;&gt;Calculating score&lt;&#x2F;h4&gt;
&lt;p&gt;The weights represent relative importance on each factor. The total importance is the total sum of the factors. More factors that can be normalized at the time of submitting proposal can be added by community.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;α&lt;&#x2F;td&gt;&lt;td&gt;Contribution value per each &lt;strong&gt;&lt;code&gt;Finance&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; contract from current proposal&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;β&lt;&#x2F;td&gt;&lt;td&gt;Time they maintained &lt;strong&gt;&lt;code&gt;Finance&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; per each contract from current timestamp of a proposal&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(score per each ABT) = α * (contribution value) + β * (time that abt was maintained from now)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;normalization&quot;&gt;Normalization&lt;&#x2F;h4&gt;
&lt;p&gt;Normalization is applied for data integrity on user&#x27;s contribution in a DAO.
Normalized score can be calculated from the state of submitting a proposal&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(Normalized score per each ABT) = α * (contribution value)&#x2F;(total contribution value at submitting tx) + β * (time that abt was maintained)&#x2F;(time passed from genesis to proposal creation)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;and have a value between 0 and 1 (since α + β = 1).&lt;&#x2F;p&gt;
&lt;h4 id=&quot;multiplier&quot;&gt;Multiplier&lt;&#x2F;h4&gt;
&lt;p&gt;The multiplier is determined linearly from base factor (b) and multiplier(m).&lt;&#x2F;p&gt;
&lt;p&gt;The equation for influence is :&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(influence) = m * (sum(normalized_score))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;example&quot;&gt;Example&lt;&#x2F;h4&gt;
&lt;p&gt;For example, if a user has 3 &lt;strong&gt;&lt;code&gt;Account-bound tokens&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; with normalized score of each 1.0, 0.5, 0.3 and the locked token is 100, and multiplier is 0.5 and base factor is 1.5. Then the total influence is&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0.5 * {(1.0 + 0.5 + 0.3) &#x2F; 3} + 1.5 = 1.8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; The total voting power would be&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;```&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(voting power) = 1.8 * sqrt(100)  = 18&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;stakers-vs-enforcers&quot;&gt;Stakers vs Enforcers&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;&#x2F;th&gt;&lt;th&gt;Stakers&lt;&#x2F;th&gt;&lt;th&gt;Enforcers&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Role&lt;&#x2F;td&gt;&lt;td&gt;stake governance token for voting&lt;&#x2F;td&gt;&lt;td&gt;Contributed on the system, can make proposal to change rule, more voting power like 1.5&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Populations&lt;&#x2F;td&gt;&lt;td&gt;many&lt;&#x2F;td&gt;&lt;td&gt;small&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Contribution&lt;&#x2F;td&gt;&lt;td&gt;Less effect&lt;&#x2F;td&gt;&lt;td&gt;More effect&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Influence&lt;&#x2F;td&gt;&lt;td&gt;sqrt(locked token)&lt;&#x2F;td&gt;&lt;td&gt;Influence * sqrt(locked token)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;center&gt;
Stakers vs Enforcers
&lt;&#x2F;center&gt;
&lt;p&gt;&lt;strong&gt;Stakers&lt;&#x2F;strong&gt;: Stakers are people who vote to enforcers&#x27; proposals and get dividend for staked tokens&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Enforcers&lt;&#x2F;strong&gt;: Enforcers are people who takes risk on managing protocol and contributes to the protocol by making a proposal and change to it.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;contracts-1&quot;&gt;Contracts&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;Influencer&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: An &lt;strong&gt;&lt;code&gt;Influencer&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; contract stores influence configurations and measures the contribution of a user from his activities done in a registered Account Bound Token contract. The contract puts a lock on that Account Bound Token until the proposal is finalized.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;Governor&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: &lt;strong&gt;&lt;code&gt;Governor&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; contract is compatible with the current governor contract in OpenZeppelin. For its special use case, it configures factors where the influencer manages and has access to changing parameters of &lt;strong&gt;&lt;code&gt;Manager&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; configs. Only the &lt;code&gt;Enforcer&lt;&#x2F;code&gt; can propose new parameters.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;gas-saving-for-end-user&quot;&gt;Gas saving for end user&lt;&#x2F;h3&gt;
&lt;p&gt;The gas cost of using multiple contracts (as opposed to a single one) actually saves gas long-run if the clone factory pattern is applied. One contract storing users&#x27; states globally means each user is actually paying for the storage cost of other users after interacting with the contract. This, for example, means that MakerDAO&#x27;s contract operating cost is sometimes over 0.1 ETH, limitimg users&#x27; minimum deposit for CDP in order to save gas costs. To solve inefficient n-times charging gas cost interaction for future users, one contract per user is used.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;separation-between-investor-s-and-operation-fund&quot;&gt;Separation between investor&#x27;s and operation fund&lt;&#x2F;h4&gt;
&lt;p&gt;The separation between an investor&#x27;s funds and operation fee is clearly specified in the smart contract, so investors can ensure safety from arbitrary loss of funds by the operating team&#x27;s control.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP has no known backward compatibility issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5252&#x2F;assets&#x2F;README&#x2F;&quot;&gt;Reference implementation&lt;&#x2F;a&gt; is a simple deposit account contract as &lt;code&gt;Finance&lt;&#x2F;code&gt; contract and its contribution value α is measured with deposit amount with ETH.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;Factory&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; contracts must ensure that each &lt;strong&gt;&lt;code&gt;Finance&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; contract is registered in the factory and check that &lt;strong&gt;&lt;code&gt;Finance&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; contracts are sending transactions related to their bounded owner.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Reentrancy attack guard should be applied or change state before delegatecall in each user function in &lt;strong&gt;&lt;code&gt;Manager&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; contract or &lt;strong&gt;&lt;code&gt;Finance&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; contract. Otherwise, &lt;strong&gt;&lt;code&gt;Finance&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; can be generated as double and ruin whole indices.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Once a user locks influence on a proposal&#x27;s vote, an &lt;strong&gt;&lt;code&gt;Account Bound Token&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; cannot be transferred to another wallet. Otherwise, double influence can happen.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>NFT Updatable Metadata Extension</title>
        <published>2022-06-27T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Christophe Le Bars</name><uri>https://github.com/clbrge</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5185/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-721-erc-1155-updatable-metadata-extension/9077" />
        

        <id>https://wg-eips.ritovision.com/5185/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:5185"
            label="ERC-5185" />
        

        
        

        
        <summary type="html">An interface extension for ERC-721&#x2F;ERC-1155 controlled metadata updates</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5185/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This specification defines a standard way to allow controlled NFTs&#x27; metadata updates along predefined formulas. Updates of the original metadata are restricted and defined by a set of recipes and the sequence and results of these recipes are deterministic and fully verifiable with on-chain metadata updates event. The proposal depends on and extends the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;EIP-1155&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Storing voluminous NFT metadata on-chain is often neither practical nor cost-efficient.&lt;&#x2F;p&gt;
&lt;p&gt;Storing NFT metadata off-chain on distributed file systems like IPFS can answer some needs of verifiable correlation and permanence between an NFT tokenId and its metadata but updates come at the cost of being all or nothing (aka changing the &lt;code&gt;tokenURI&lt;&#x2F;code&gt;). Bespoke solutions can be easily developed for a specific NFT smart contract but a common specification is necessary for NFT marketplaces and third parties tools to understand and verify these metadata updates.&lt;&#x2F;p&gt;
&lt;p&gt;This ERC allows the original JSON metadata to be modified step by step along a set of predefined JSON transformation formulas. Depending on NFT use-cases, the transformation formulas can be more or less restrictive.&lt;&#x2F;p&gt;
&lt;p&gt;As examples, an NFT representing a house could only allow append-only updates to the list of successive owners, and a game using NFT characters could let some attributes change from time to time (e.g. health, experience, level, etc) while some other would be guaranteed to never change (e.g. physicals traits etc).&lt;&#x2F;p&gt;
&lt;p&gt;This standard extension is compatible with NFTs bridged between Ethereum and L2 networks and allows efficient caching solutions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot; and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;strong&gt;metadata updates extension&lt;&#x2F;strong&gt; is OPTIONAL for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;EIP-1155&lt;&#x2F;a&gt; contracts.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-721&#x2F;ERC-1155 Updatable Metadata Extension&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5185UpdatableMetadata&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A distinct Uniform Resource Identifier (URI) for a set of updates&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This event emits an URI (defined in RFC 3986) of a set of metadata updates.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The URI should point to a JSON file that conforms to the &amp;quot;NFT Metadata Updates JSON Schema&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Third-party platforms such as NFT marketplace can deterministically calculate the latest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; metadata for all tokens using these events by applying them in sequence for each token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MetadataUpdates&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; URI&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The original metadata SHOULD conform to the &quot;ERC-5185 Updatable Metadata JSON Schema&quot; which is a compatible extension of the &quot;ERC-721 Metadata JSON Schema&quot; defined in ERC-721.&lt;&#x2F;p&gt;
&lt;p&gt;&quot;ERC-5185 Updatable Metadata JSON Schema&quot; :&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Asset Updatable Metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Identifies the asset to which this NFT represents&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Describes the asset to which this NFT represents&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;image&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A URI pointing to a resource with mime type image&#x2F;* representing the asset to which this NFT represents. Consider making any images at a width between 320 and 1080 pixels and aspect ratio between 1.91:1 and 4:5 inclusive.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;updatable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;required&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;engine&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;recipes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;engine&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Non ambiguous transformation method&#x2F;language (with version) to process updates along recipes defined below&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;schema&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;if present, a JSON Schema that all sequential post transformation updated metadata need to conform. If a transformed JSON does not conform, the update should be considered voided.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;recipes&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A catalog of all possibles recipes identified by their keys&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;patternProperties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;.*&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The key of this object is used to select which recipe to apply for each update&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;required&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eval&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;eval&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The evaluation formula to transform the last JSON metadata using the engine above (can take arguments)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&quot;NFT Metadata Updates JSON Schema&quot; :&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Metadata Updates JSON Schema&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;updates&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;array&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A list of updates to apply sequentially to calculate updated metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;items&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;$ref&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;#&#x2F;$defs&#x2F;update&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;$defs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;update&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;required&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;recipeKey&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The tokenId for which the update recipe should apply&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                         }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;recipeKey&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;recipeKey to use to get the JSON transformation expression in current metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;args&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;arguments to pass to the JSON transformation&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                 }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;engines&quot;&gt;Engines&lt;&#x2F;h3&gt;
&lt;p&gt;Only one engine is currently defined in this extension proposal.&lt;&#x2F;p&gt;
&lt;p&gt;If the engine in the original metadata is &quot;jsonata@1.8.*&quot;, updated metadata is calculated starting from original metadata and applying each update sequentially (all updates which are present in all the URIs emitted by the event &lt;code&gt;MetadataUpdates&lt;&#x2F;code&gt; for which tokenId matches).&lt;&#x2F;p&gt;
&lt;p&gt;For each step, the next metadata is obtained by the javascript calculation (or compatible jsonata implementation in other language) :&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; nextMetadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; jsonata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;evalString&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;evaluate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;previousMetadata&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; args&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;With &lt;code&gt;evalString&lt;&#x2F;code&gt; is found with &lt;code&gt;recipeKey&lt;&#x2F;code&gt; in the original metadata recipes list.&lt;&#x2F;p&gt;
&lt;p&gt;If the key is not present in the original metadata list, &lt;code&gt;previousMetadata&lt;&#x2F;code&gt; is kept as the valid updated metadata.&lt;&#x2F;p&gt;
&lt;p&gt;If the evaluation throws any errors, &lt;code&gt;previousMetadata&lt;&#x2F;code&gt; is kept as the valid updated metadata.&lt;&#x2F;p&gt;
&lt;p&gt;If a validation Schema JSON has been defined and the result JSON &lt;code&gt;nextMetadata&lt;&#x2F;code&gt; does not conform, that update is not valid and &lt;code&gt;previousMetadata&lt;&#x2F;code&gt; is kept as the valid updated metadata.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;There have been numerous interesting uses of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;EIP-1155&lt;&#x2F;a&gt; smart contracts that associate for each token essential and significant metadata. While some projects (e.g. EtherOrcs) have experimented successfully to manage these metadata on-chain, that experimental solution will always be limited by the cost and speed of generating and storing JSON on-chain. Symmetrically, while storing the JSON metadata at URI endpoint controlled by traditional servers permit limitless updates the metadata for each NFT, it is somehow defeating in many uses cases, the whole purpose of using a trustless blockchain to manage NFT: indeed users may want or demand more permanence and immutability from the metadata associated with their NFT.&lt;&#x2F;p&gt;
&lt;p&gt;Most use cases have chosen intermediate solutions like IPFS or arweave to provide some permanence or partial&#x2F;full immutability of metadata. This is a good solution when an NFT represents a static asset whose characteristics are by nature permanent and immutable (like in the art world) but less so with other use cases like gaming or NFT representing a deed or title. Distinguishable assets in a game often should be allowed to evolve and change over time in a controlled way and titles need to record real life changes.&lt;&#x2F;p&gt;
&lt;p&gt;The advantages of this standard is precisely to allow these types of controlled transformations over time of each NFT metadata by applying sequential transformations starting with the original metadata and using formulas themselves defined in the original metadata.&lt;&#x2F;p&gt;
&lt;p&gt;The original metadata for a given NFT is always defined as the JSON pointed by the result of &lt;code&gt;tokenURI&lt;&#x2F;code&gt; for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; and function &lt;code&gt;uri&lt;&#x2F;code&gt; for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;EIP-1155&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The on-chain log trace of updates guarantee that anyone can recalculate and verify independently the current updated metadata starting from the original metadata. The fact that the calculation is deterministic allows easy caching of intermediate transformations and the efficient processing of new updates using these caches.&lt;&#x2F;p&gt;
&lt;p&gt;The number of updates defined by each event is to be determined by the smart contract logic and use case, but it can easily scale to thousands or millions of updates per event. The function(s) that should emit &lt;code&gt;MetadataUpdates&lt;&#x2F;code&gt; and the frequency of these on-chain updates is left at the discretion of this standard implementation.&lt;&#x2F;p&gt;
&lt;p&gt;The proposal is extremely gas efficient, since gas costs are only proportional to the frequency of committing changes. Many changes for many tokens can be batched in one transaction for the cost of only one &lt;code&gt;emit&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;transformation-engines&quot;&gt;Transformation engines&lt;&#x2F;h3&gt;
&lt;p&gt;We have been experimenting with this generic Metadata update proposal using the JSONata transformation language.&lt;&#x2F;p&gt;
&lt;p&gt;Here is a very simple example of a NFT metadata for an imaginary &#x27;little monster&#x27; game :&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Monster 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Little monsters you can play with.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;attributes&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Level&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;trait_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Stamina&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 100&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;updatable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;engine&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;jsonata@1.8.*&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;recipes&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;levelUp&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;eval&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;$ ~&amp;gt; | attributes[trait_type=&amp;#39;Level&amp;#39;] | {&amp;#39;value&amp;#39;: value + 1} |&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;updateDescription&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;eval&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;$ ~&amp;gt; | $ | {&amp;#39;description&amp;#39;: $newDescription} |&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This updatable metadata can only be updated to increment by one the trait attribute &quot;Level&quot;.&lt;&#x2F;p&gt;
&lt;p&gt;An example JSON updates metadata would be :&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;updates&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;action&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;levelUp&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;action&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;levelUp&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;action&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;updateDescription&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;args&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;newDescription&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Now I&amp;#39;m a big monster&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;action&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;levelUp&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;3&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;action&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;levelUp&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;A malicious recipe in the original metadata might be constructed as a DDoS vector for third parties marketplaces and tools that calculate NFT updated JSON metadata. They are encouraged to properly encapsulate software in charge of these calculations and put limits for the engine updates processing.&lt;&#x2F;p&gt;
&lt;p&gt;Smart contracts should be careful and conscious of using this extension and still allow the metadata URI to be updated in some contexts (by not having the same URI returned by &lt;code&gt;tokenURI&lt;&#x2F;code&gt; or &lt;code&gt;uri&lt;&#x2F;code&gt; for a given tokenId over time). They need to take into account if previous changes could have been already broadcasted for that NFT by the contract, if these changes are compatible with the new &quot;original metadata&quot; and what semantic they decide to associate by combining these two kinds of &quot;updates&quot;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The proposal is fully compatible with both &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;EIP-1155&lt;&#x2F;a&gt;. Third-party applications that don&#x27;t support this EIP will still be able to use the original metadata for each NFT.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Blueprint contract format</title>
        <published>2022-06-23T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Charles Cooper</name><uri>https://github.com/charles-cooper</uri>
	</author>
	
	<author>
		<name>Edward Amor</name><uri>https://github.com/skellet0r</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5202/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-5202-standard-factory-contract-format/9851" />
        

        <id>https://wg-eips.ritovision.com/5202/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:5202"
            label="ERC-5202" />
        

        
        

        
        <summary type="html">Define a bytecode container format for indexing and utilizing blueprint contracts</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5202/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Define a standard for &quot;blueprint&quot; contracts, or contracts which represent initcode that is stored on-chain.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;To decrease deployer contract size, a useful pattern is to store initcode on chain as a &quot;blueprint&quot; contract, and then use &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt; to copy the initcode into memory, followed by a call to &lt;code&gt;CREATE&lt;&#x2F;code&gt; or &lt;code&gt;CREATE2&lt;&#x2F;code&gt;. However, this comes with the following problems:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;It is hard for external tools and indexers to detect if a contract is a &quot;regular&quot; runtime contract or a &quot;blueprint&quot; contract. Heuristically searching for patterns in bytecode to determine if it is initcode poses maintenance and correctness problems.&lt;&#x2F;li&gt;
&lt;li&gt;Storing initcode byte-for-byte on-chain is a correctness and security problem. Since the EVM does not have a native way to distinguish between executable code and other types of code, unless the initcode explicitly implements ACL rules, &lt;em&gt;anybody&lt;&#x2F;em&gt; can call such a &quot;blueprint&quot; contract and execute the initcode directly as ordinary runtime code. This is particularly problematic if the initcode stored by the blueprint contract has side effects such as writing to storage or calling external contracts. If the initcode stored by the blueprint contract executes a &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; opcode, the blueprint contract could even be removed, preventing the correct operation of downstream deployer contracts that rely on the blueprint existing. For this reason, it would be good to prefix blueprint contracts with a special preamble to prevent execution.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;A blueprint contract MUST use the preamble &lt;code&gt;0xFE71&amp;lt;version bits&amp;gt;&amp;lt;length encoding bits&amp;gt;&lt;&#x2F;code&gt;. 6 bits are allocated to the version, and 2 bits to the length encoding. The first version begins at 0 (&lt;code&gt;0b000000&lt;&#x2F;code&gt;), and versions increment by 1. The value &lt;code&gt;0b11&lt;&#x2F;code&gt; for &lt;code&gt;&amp;lt;length encoding bits&amp;gt;&lt;&#x2F;code&gt; is reserved. In the case that the length bits are &lt;code&gt;0b11&lt;&#x2F;code&gt;, the third byte is considered a continuation byte (that is, the version requires multiple bytes to encode). The exact encoding of a multi-byte version is left to a future ERC.&lt;&#x2F;p&gt;
&lt;p&gt;A blueprint contract MUST contain at least one byte of initcode.&lt;&#x2F;p&gt;
&lt;p&gt;A blueprint contract MAY insert any bytes (data or code) between the version byte(s) and the initcode. If such variable length data is used, the preamble must be &lt;code&gt;0xFE71&amp;lt;version bits&amp;gt;&amp;lt;length encoding bits&amp;gt;&amp;lt;length bytes&amp;gt;&amp;lt;data&amp;gt;&lt;&#x2F;code&gt;. The &lt;code&gt;&amp;lt;length encoding bits&amp;gt;&lt;&#x2F;code&gt; represent a number between 0 and 2 (inclusive) describing how many bytes &lt;code&gt;&amp;lt;length bytes&amp;gt;&lt;&#x2F;code&gt; takes, and &lt;code&gt;&amp;lt;length bytes&amp;gt;&lt;&#x2F;code&gt; is the big-endian encoding of the number of bytes that &lt;code&gt;&amp;lt;data&amp;gt;&lt;&#x2F;code&gt; takes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;To save gas and storage space, the preamble should be as minimal as possible.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;It is considered &quot;bad&quot; behavior to try to CALL a blueprint contract directly, therefore the preamble starts with &lt;code&gt;INVALID (0xfe)&lt;&#x2F;code&gt; to end execution with an exceptional halting condition (rather than a &quot;gentler&quot; opcode like &lt;code&gt;STOP (0x00)&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;To help distinguish a blueprint contract from other contracts that may start with &lt;code&gt;0xFE&lt;&#x2F;code&gt;, a &quot;magic&quot; byte is used. The value &lt;code&gt;0x71&lt;&#x2F;code&gt; was arbitrarily chosen by taking the last byte of the keccak256 hash of the bytestring &quot;blueprint&quot; (i.e.: &lt;code&gt;keccak256(b&quot;blueprint&quot;)[-1]&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;An empty initcode is disallowed by the spec to prevent what might be a common mistake.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Users may want to include arbitrary data or code in their preamble. To allow indexers to ignore these bytes, a variable length encoding is proposed. To allow the length to be only zero or one bytes (in the presumably common case that &lt;code&gt;len(data bytes)&lt;&#x2F;code&gt; is smaller than 256), two bits of the third byte are reserved to specify how many bytes the encoded length takes.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;In case we need an upgrade path, version bits are included. While we do not expect to exhaust the version bits, in case we do, a continuation sequence is reserved. Since only two bytes are required for &lt;code&gt;&amp;lt;length bytes&amp;gt;&lt;&#x2F;code&gt; (as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;170&#x2F;&quot;&gt;EIP-170&lt;&#x2F;a&gt; restricts contract length to 24KB), a &lt;code&gt;&amp;lt;length encoding bits&amp;gt;&lt;&#x2F;code&gt; value of 3 would never be required to describe &lt;code&gt;&amp;lt;length bytes&amp;gt;&lt;&#x2F;code&gt;. For that reason, the special &lt;code&gt;&amp;lt;length encoding bits&amp;gt;&lt;&#x2F;code&gt; value of &lt;code&gt;0b11&lt;&#x2F;code&gt; is reserved as a continuation sequence marker.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The length of the initcode itself is not included by default in the preamble because it takes space, and it can be trivially determined using &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The Ethereum Object Format (EOF) could provide another way of specifying blueprint contracts, by adding another section kind (3 - initcode). However, it is not yet in the EVM, and we would like to be able to standardize blueprint contracts today, without relying on EVM changes. If, at some future point, section kind 3 becomes part of the EOF spec, and the EOF becomes part of the EVM, this ERC will be considered to be obsolesced since the EOF validation spec provides much stronger guarantees than this ERC.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No known issues&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;An example (and trivial!) blueprint contract with no data section, whose initcode is just the &lt;code&gt;STOP&lt;&#x2F;code&gt; instruction:&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xFE710000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;An example blueprint contract whose initcode is the trivial &lt;code&gt;STOP&lt;&#x2F;code&gt; instruction and whose data section contains the byte &lt;code&gt;0xFF&lt;&#x2F;code&gt; repeated seven times:&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xFE710107FFFFFFFFFFFFFF00&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Here, 0xFE71 is the magic header, &lt;code&gt;0x01&lt;&#x2F;code&gt; means version 0 + 1 length bit, &lt;code&gt;0x07&lt;&#x2F;code&gt; encodes the length in bytes of the data section. These are followed by the data section, and then the initcode. For illustration, the above code with delimiters would be &lt;code&gt;0xFE71|01|07|FFFFFFFFFFFFFF|00&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;An example blueprint whose initcode is the trivial &lt;code&gt;STOP&lt;&#x2F;code&gt; instruction and whose data section contains the byte &lt;code&gt;0xFF&lt;&#x2F;code&gt; repeated 256 times:&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xFE71020100FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Delimited, that would be &lt;code&gt;0xFE71|02|0100|FF...FF|00&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt; typing&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; import&lt;&#x2F;span&gt;&lt;span&gt; Optional&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Tuple&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; parse_blueprint_preamble&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;bytecode&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Tuple&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Optional&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Given bytecode as a sequence of bytes, parse the blueprint preamble and&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    deconstruct the bytecode into:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        the ERC version, preamble data and initcode.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Raises an exception if the bytecode is not a valid blueprint contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    according to this ERC.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    arguments:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        bytecode: a `bytes` object representing the bytecode&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    returns:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        (version,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;         None if &amp;lt;length encoding bits&amp;gt; is 0, otherwise the bytes of the data section,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;         the bytes of the initcode,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; bytecode&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\xFE&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\x71&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        raise&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; Exception&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Not a blueprint!&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    erc_version&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;bytecode&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0b&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;11111100&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    n_length_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; bytecode&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0b&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;11&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; n_length_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0b&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;11&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        raise&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; Exception&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Reserved bits are set&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    data_length&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;bytecode&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; n_length_bytes&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; byteorder&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;big&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; n_length_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        preamble_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        data_start&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; n_length_bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        preamble_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; bytecode&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;data_start&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;data_start&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; data_length&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    initcode&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; bytecode&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; n_length_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; data_length&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;initcode&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        raise&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; Exception&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Empty initcode!&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; erc_version&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; preamble_data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; initcode&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The following reference function takes the desired initcode for a blueprint as a parameter, and returns EVM code which will deploy a corresponding blueprint contract (with no data section):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; blueprint_deployer_bytecode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;initcode&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    blueprint_preamble&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\xFE&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\x71&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\x00&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC5202 preamble&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    blueprint_bytecode&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; blueprint_preamble&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; initcode&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the length of the deployed code in bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    len_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;blueprint_bytecode&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;to_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;big&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; copy &amp;lt;blueprint_bytecode&amp;gt; to memory and `RETURN` it per EVM creation semantics&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; PUSH2 &amp;lt;len&amp;gt; RETURNDATASIZE DUP2 PUSH1 10 RETURNDATASIZE CODECOPY RETURN&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    deploy_bytecode&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\x61&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; len_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\x3d&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\x81&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\x60&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\x0a&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\x3d&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\x39&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\xf3&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; deploy_bytecode&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; blueprint_bytecode&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;There could be contracts on-chain already which happen to start with the same prefix as proposed in this ERC. However, this is not considered a serious risk, because the way it is envisioned that indexers will use this is to verify source code by compiling it and prepending the preamble.&lt;&#x2F;p&gt;
&lt;p&gt;As of 2022-07-08, no contracts deployed on the Ethereum mainnet have a bytecode starting with &lt;code&gt;0xFE71&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Cross Chain Write Deferral Protocol</title>
        <published>2022-06-23T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Paul Gauvreau</name><uri>https://github.com/0xpaulio</uri>
	</author>
	
	<author>
		<name>Nick Johnson</name><uri>https://github.com/arachnid</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5559/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-cross-chain-write-deferral-protocol/10576" />
        

        <id>https://wg-eips.ritovision.com/5559/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:5559"
            label="ERC-5559" />
        

        
        

        
        <summary type="html">The cross chain write deferral protocol provides a mechanism to defer the storage &amp; resolution of mutations to off-chain handlers</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5559/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The following standard provides a mechanism in which smart contracts can request various tasks to be resolved by an external handler. This provides a mechanism in which protocols can reduce the gas fees associated with storing data on mainnet by deferring the handling of it to another system&#x2F;network. These external handlers act as an extension to the core L1 contract.&lt;&#x2F;p&gt;
&lt;p&gt;This standard outlines a set of handler types that can be used for managing the execution and storage of mutations (tasks), as well as their corresponding tradeoffs. Each handler type has associated operational costs, finality guarantees, and levels of decentralization. By further specifying the type of handler that the mutation is deferred to, the protocol can better define how to permission and secure their system.&lt;&#x2F;p&gt;
&lt;p&gt;This standard can be implemented in conjunction with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3668&#x2F;&quot;&gt;EIP-3668&lt;&#x2F;a&gt; to provide a mechanism in which protocols can reside on and be interfaced through an L1 contract on mainnet, while being able to resolve and mutate data stored in external systems.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3668&#x2F;&quot;&gt;EIP-3668&lt;&#x2F;a&gt; provides a mechanism by which off-chain lookups can be defined inside smart contracts in a transparent manner. In addition, it provides a scheme in which the resolved data can be verified on-chain. However, there lacks a standard by which mutations can be requested through the native contract, to be performed on the off-chain data. Furthermore, with the increase in L2 solutions, smart contract engineers have additional tools that can be used to reduce the storage and transaction costs of performing mutations on the Ethereum mainnet.&lt;&#x2F;p&gt;
&lt;p&gt;A specification that allows smart contracts to defer the storage and resolution of data to external handlers facilitates writing clients agnostic to the storage solution being used, enabling new applications that can operate without knowledge of the underlying handlers associated with the contracts they interact with.&lt;&#x2F;p&gt;
&lt;p&gt;Examples of this include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Allowing the management of ENS domains externally resolved on an L2 solution or off-chain database as if they were native L1 tokens.&lt;&#x2F;li&gt;
&lt;li&gt;Allowing the management of digital identities stored on external handlers as if they were in the stored in the native L1 smart contract.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;overview&quot;&gt;Overview&lt;&#x2F;h3&gt;
&lt;p&gt;There are two main handler classifications: L2 Contract and Off-Chain Database. These are determined based off of where the handler is deployed. The handler classifications are used to better define the different security guarantees and requirements associated with its deployment.&lt;&#x2F;p&gt;
&lt;p&gt;From a high level:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Handlers hosted on an L2 solution are EVM compatible and can use attributes native to the Ethereum ecosystem (such as address) to permission access.&lt;&#x2F;li&gt;
&lt;li&gt;Handlers hosted on an Off-Chain Database require additional parameters and signatures to correctly enforce the authenticity and check the validity of a request.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;A deferred mutation can be handled in as little as two steps. However, in some cases the mutation might be deferred multiple times.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Querying or sending a transaction to the contract&lt;&#x2F;li&gt;
&lt;li&gt;Querying or sending a transaction to the handler using the parameters provided in step 1&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;In step 1, a standard blockchain call operation is made to the contract. The contract either performs the operation as intended or reverts with an error that specifies the type of handler that the mutation is being deferred to and the corresponding parameters required to perform the subsequent mutation. There are two types of errors that the contract can revert with, but more may be defined in other EIPs:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;StorageHandledByL2(chainId, contractAddress)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;StorageHandledByOffChainDatabase(sender, url, data)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In step 2, the client builds and performs a new request based off of the type of error received in (1). These handshakes are outlined in the sections below:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5559&#x2F;#data-stored-in-an-l2&quot;&gt;StorageHandledByL2&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5559&#x2F;#data-stored-in-an-off-chain-database&quot;&gt;StorageHandledByOffChainDatabase&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In some cases, the mutation may be deferred multiple times&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5559&#x2F;#data-stored-in-an-l2-an-off-chain-database&quot;&gt;Storage Deferred Twice L1 &amp;gt; L2 &amp;gt; Off-Chain&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;data-stored-in-an-l1&quot;&gt;Data Stored in an L1&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;┌──────┐                ┌───────────┐ &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│Client│                │L1 Contract│ &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;└──┬───┘                └─────┬─────┘ &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │                          │       &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │ somefunc(...)            │       &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   ├─────────────────────────►│       &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │                          │       &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │ response                 │       &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │◄─────────────────────────┤       &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │                          │       &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In the case in which no reversion occurs, data is stored in the L1 contract when the transaction is executed.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;data-stored-in-an-l2&quot;&gt;Data Stored in an L2&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;┌──────┐                                           ┌───────────┐  ┌─────────────┐&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│Client│                                           │L1 Contract│  │ L2 Contract │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;└──┬───┘                                           └─────┬─────┘  └──────┬──────┘&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │                                                     │               │       &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │ somefunc(...)                                       │               │       &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   ├────────────────────────────────────────────────────►│               │       &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │                                                     │               │       &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │ revert StorageHandledByL2(chainId, contractAddress) │               │       &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │◄────────────────────────────────────────────────────┤               │       &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │                                                     │               │       &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │ Execute Tx [chainId] [contractAddress] [callData]   │               │       &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   ├─────────────────────────────────────────────────────┼──────────────►│       &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │                                                     │               │       &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │ response                                            │               │       &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │◄────────────────────────────────────────────────────┼───────────────┤       &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │                                                     │               │       &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The call or transaction to the L1 contract reverts with the &lt;code&gt;StorageHandledByL2(chainId, contractAddress)&lt;&#x2F;code&gt; error.&lt;&#x2F;p&gt;
&lt;p&gt;In this case, the client builds a new transaction for &lt;code&gt;contractAddress&lt;&#x2F;code&gt; with the original &lt;code&gt;callData&lt;&#x2F;code&gt; and sends it to a RPC of their choice for the corresponding &lt;code&gt;chainId&lt;&#x2F;code&gt;. The &lt;code&gt;chainId&lt;&#x2F;code&gt; parameter corresponds to an L2 Solution that is EVM compatible.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;example&quot;&gt;Example&lt;&#x2F;h4&gt;
&lt;p&gt;Suppose a contract has the following method:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setAddr&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; a&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Data for this mutations is stored and tracked on an EVM compatible L2. The contract author wants to reduce the gas fees associated with the contract, while maintaining the interoperability and decentralization of the protocol. Therefore, the mutation is deferred to a off-chain handler by reverting with the &lt;code&gt;StorageHandledByL2(chainId, contractAddress)&lt;&#x2F;code&gt; error.&lt;&#x2F;p&gt;
&lt;p&gt;One example of a valid implementation of &lt;code&gt;setAddr&lt;&#x2F;code&gt; would be:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setAddr&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; a&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;   revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; StorageHandledByL2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;      10&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      _l2HandlerContractAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;For example, if a contract returns the following data in an &lt;code&gt;StorageHandledByL2&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;chainId = 10&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;contractAddress = 0x0000111122223333444455556666777788889999aaaabbbbccccddddeeeeffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The user, receiving this error, creates a new transaction for the corresponding &lt;code&gt;chainId&lt;&#x2F;code&gt;, and builds a transaction with the original &lt;code&gt;callData&lt;&#x2F;code&gt; to send to &lt;code&gt;contractAddress&lt;&#x2F;code&gt;. The user will have to choose an RPC of their choice to send the transaction to for the corresponding &lt;code&gt;chainId&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;data-stored-in-an-off-chain-database&quot;&gt;Data Stored in an Off-Chain Database&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;┌──────┐                                           ┌───────────┐  ┌────────────────────┐&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│Client│                                           │L1 Contract│  │ Off-Chain Database │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;└──┬───┘                                           └─────┬─────┘  └──────────┬─────────┘&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │                                                     │                   │ &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │ somefunc(...)                                       │                   │ &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   ├────────────────────────────────────────────────────►│                   │ &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │                                                     │                   │ &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │ revert StorageHandledByOffChainDatabase(sender,     |                   │ &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │                               urls, requestParams)  │                   │ &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │◄────────────────────────────────────────────────────┤                   │ &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │                                                     │                   │ &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │ HTTP Request [requestParams, signature]             │                   │ &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   ├─────────────────────────────────────────────────────┼──────────────────►│ &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │                                                     │                   │ &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │ response                                            │                   │ &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │◄────────────────────────────────────────────────────┼───────────────────┤ &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │                                                     │                   │ &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The call or transaction to the L1 contract reverts with the &lt;code&gt;StorageHandledByOffChainDatabase(sender, url, data)&lt;&#x2F;code&gt; error.&lt;&#x2F;p&gt;
&lt;p&gt;In this case, the client performs a HTTP POST request to the gateway service. The gateway service is defined by &lt;code&gt;url&lt;&#x2F;code&gt;. The body attached to the request is a JSON object that includes &lt;code&gt;sender&lt;&#x2F;code&gt;, &lt;code&gt;data&lt;&#x2F;code&gt;, and a signed copy of &lt;code&gt;data&lt;&#x2F;code&gt; denoted &lt;code&gt;signature&lt;&#x2F;code&gt;. The signature is generated according to a &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt;, in which a typed data signature is generated using domain definition, &lt;code&gt;sender&lt;&#x2F;code&gt;, and the message context, &lt;code&gt;data&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;sender&lt;&#x2F;code&gt; ia an ABI-encoded struct defined as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Struct used to define the domain of the typed data signature, defined in EIP-712.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; name&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The user friendly name of the contract that the signature corresponds to.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; version&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The version of domain object being used.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ID of the chain that the signature corresponds to (ie Ethereum mainnet: 1, Goerli testnet: 5, ...). &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; verifyingContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the contract that the signature pertains to.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; domainData&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span&gt; version&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint64&lt;&#x2F;span&gt;&lt;span&gt; chainId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; verifyingContract&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;data&lt;&#x2F;code&gt; ia an abi encoded struct defined as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Struct used to define the message context used to construct a typed data signature, defined in EIP-712, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* to authorize and define the deferred mutation being performed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; functionSelector&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The function selector of the corresponding mutation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the user performing the mutation (msg.sender).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; parameter&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;[] A list of &amp;lt;key, value&amp;gt; pairs defining the inputs used to perform the deferred mutation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; messageData&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes4&lt;&#x2F;span&gt;&lt;span&gt; functionSelector&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    parameter&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; parameters&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; expirationTimestamp&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Struct used to define a parameter for Off-Chain Database Handler deferral.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; name&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The variable name of the parameter.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The string encoded value representation of the parameter.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; parameter&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;signature&lt;&#x2F;code&gt; is generated by using the &lt;code&gt;sender&lt;&#x2F;code&gt; &amp;amp; &lt;code&gt;data&lt;&#x2F;code&gt; parameters to construct an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; typed data signature.&lt;&#x2F;p&gt;
&lt;p&gt;The body used in the HTTP POST request is defined as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;abi encoded domainData (sender)&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;abi encoded messageData (data)&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;EIP-712 typed data signature of corresponding message data &amp;amp; domain definition&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;example-1&quot;&gt;Example&lt;&#x2F;h4&gt;
&lt;p&gt;Suppose a contract has the following method:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setAddr&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; a&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Data for this mutations is stored and tracked in some kind of off-chain database. The contract author wants the user to be able to authorize and make modifications to their &lt;code&gt;Addr&lt;&#x2F;code&gt; without having to pay a gas fee. Therefore, the mutation is deferred to a off-chain handler by reverting with the &lt;code&gt;StorageHandledByOffChainDatabase(sender, url, data)&lt;&#x2F;code&gt; error.&lt;&#x2F;p&gt;
&lt;p&gt;One example of a valid implementation of &lt;code&gt;setAddr&lt;&#x2F;code&gt; would be:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setAddr&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; a&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    IWriteDeferral&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parameter&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; params &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span&gt; IWriteDeferral&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parameter&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    params&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;name &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;node&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    params&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;value &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; BytesToString&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;bytes32ToString&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    params&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;name &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;coin_type&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    params&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;value &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; Strings&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;toString&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;coinType&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    params&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;name &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;address&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    params&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;value &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; BytesToString&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;bytesToString&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;a&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; StorageHandledByOffChainDatabase&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        IWriteDeferral&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;domainData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                name&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; WRITE_DEFERRAL_DOMAIN_NAME&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                version&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; WRITE_DEFERRAL_DOMAIN_VERSION&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                verifyingContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _offChainDatabaseUrl&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        IWriteDeferral&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;messageData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                functionSelector&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sig&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                parameters&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; params&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                expirationTimestamp&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt; _offChainDatabaseTimeoutDuration&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;For example, if a contract reverts with the following:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;StorageHandledByOffChainDatabase(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;CoinbaseResolver&amp;quot;, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;1&amp;quot;, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        1, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        0x32f94e75cde5fa48b6469323742e6004d701409b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ), &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;https:&#x2F;&#x2F;example.com&#x2F;r&#x2F;{sender}&amp;quot;, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        0xd5fa2b00, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        0x727f366727d3c9cc87f05d549ee2068f254b267c, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            (&amp;quot;node&amp;quot;, &amp;quot;0x418ae76a9d04818c7a8001095ad01a78b9cd173ee66fe33af2d289b5dc5f4cba&amp;quot;), &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            (&amp;quot;coin_type&amp;quot;, &amp;quot;60&amp;quot;), &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            (&amp;quot;address&amp;quot;, &amp;quot;0x727f366727d3c9cc87f05d549ee2068f254b267c&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ], &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        181&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The user, receiving this error, constructs the typed data signature, signs it, and performs that request via a HTTP POST to &lt;code&gt;url&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Example HTTP POST request body including &lt;code&gt;requestParams&lt;&#x2F;code&gt; and &lt;code&gt;signature&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;abi encoded domainData (sender)&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;abi encoded messageData (data)&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;EIP-712 typed data signature of corresponding message data &amp;amp; domain definition&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note that the message could be altered could be altered in any way, shape, or form prior to signature and request. It is the backend&#x27;s responsibility to correctly permission and process these mutations. From a security standpoint, this is no different then a user being able to call a smart contract with any params they want, as it is the smart contract&#x27;s responsibility to permission and handle those requests.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;data-stored-in-an-l2-an-off-chain-database&quot;&gt;Data Stored in an L2 &amp;amp; an Off-Chain Database&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;┌──────┐                                           ┌───────────┐  ┌─────────────┐  ┌────────────────────┐&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│Client│                                           │L1 Contract│  │ L2 Contract │  │ Off-Chain Database │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;└──┬───┘                                           └─────┬─────┘  └──────┬──────┘  └──────────┬─────────┘&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │                                                     │               │                    │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │ somefunc(...)                                       │               │                    │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   ├────────────────────────────────────────────────────►│               │                    │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │                                                     │               │                    │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │ revert StorageHandledByL2(chainId, contractAddress) │               │                    │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │◄────────────────────────────────────────────────────┤               │                    │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │                                                     │               │                    │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │ Execute Tx [chainId] [contractAddress] [callData]   │               │                    │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   ├─────────────────────────────────────────────────────┼──────────────►│                    │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │                                                     │               │                    │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │ revert StorageHandledByOffChainDatabase(sender, url, data)          │                    │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │◄────────────────────────────────────────────────────┼───────────────┤                    │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │                                                     │               │                    │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │ HTTP Request {requestParams, signature}             │               │                    │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   ├─────────────────────────────────────────────────────┼───────────────┼───────────────────►│&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │                                                     │               │                    │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │ response                                            │               │                    │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │◄────────────────────────────────────────────────────┼───────────────┼────────────────────┤&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │                                                     │               │                    │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The call or transaction to the L1 contract reverts with the &lt;code&gt;StorageHandledByL2(chainId, contractAddress)&lt;&#x2F;code&gt; error.&lt;&#x2F;p&gt;
&lt;p&gt;In this case, the client builds a new transaction for &lt;code&gt;contractAddress&lt;&#x2F;code&gt; with the original &lt;code&gt;callData&lt;&#x2F;code&gt; and sends it to a RPC of their choice for the corresponding &lt;code&gt;chainId&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;That call or transaction to the L2 contract then reverts with the &lt;code&gt;StorageHandledByOffChainDatabase(sender, url, data)&lt;&#x2F;code&gt; error.&lt;&#x2F;p&gt;
&lt;p&gt;In this case, the client then performs a HTTP POST request against the gateway service. The gateway service is defined by &lt;code&gt;url&lt;&#x2F;code&gt;. The body attached to the request is a JSON object that includes &lt;code&gt;sender&lt;&#x2F;code&gt;, &lt;code&gt;data&lt;&#x2F;code&gt;, and &lt;code&gt;signature&lt;&#x2F;code&gt; -- a typed data signature corresponding to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;events&quot;&gt;Events&lt;&#x2F;h3&gt;
&lt;p&gt;When making changes to core variables of the handler, the corresponding event MUST be emitted. This increases the transparency associated with different managerial actions. Core variables include &lt;code&gt;chainId&lt;&#x2F;code&gt; and &lt;code&gt;contractAddress&lt;&#x2F;code&gt; for L2 solutions and &lt;code&gt;url&lt;&#x2F;code&gt; for Off-Chain Database solutions. The events are outlined below in the WriteDeferral Interface.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;write-deferral-interface&quot;&gt;Write Deferral Interface&lt;&#x2F;h3&gt;
&lt;p&gt;Below is a basic interface that defines and describes all of the reversion types and their corresponding parameters.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.13&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IWriteDeferral&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;                                 EVENTS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Event raised when the default chainId is &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; for the corresponding L2 handler.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; L2HandlerDefaultChainIdChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; previousChainId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newChainId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Event raised when the contractAddress is &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; for the L2 handler corresponding to chainId.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; L2HandlerContractAddressChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; chainId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; previousContractAddress&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newContractAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Event raised when the url is &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; for the corresponding Off-Chain Database handler.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OffChainDatabaseHandlerURLChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; previousUrl&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newUrl&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;                                 STRUCTS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Struct used to define the domain of the typed data signature, defined in EIP-712.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; name&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The user friendly name of the contract that the signature corresponds to.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; version&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The version of domain object being used.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ID of the chain that the signature corresponds to (ie Ethereum mainnet: 1, Goerli testnet: 5, ...). &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; verifyingContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the contract that the signature pertains to.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; domainData&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt; version&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint64&lt;&#x2F;span&gt;&lt;span&gt; chainId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; verifyingContract&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Struct used to define the message context used to construct a typed data signature, defined in EIP-712, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * to authorize and define the deferred mutation being performed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; functionSelector&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The function selector of the corresponding mutation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the user performing the mutation (msg.sender).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; parameter&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;[] A list of &amp;lt;key, value&amp;gt; pairs defining the inputs used to perform the deferred mutation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; messageData&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes4&lt;&#x2F;span&gt;&lt;span&gt; functionSelector&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        parameter&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; parameters&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; expirationTimestamp&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Struct used to define a parameter for off-chain Database Handler deferral.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; name&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The variable name of the parameter.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The string encoded value representation of the parameter.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; parameter&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;                                 ERRORS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Error to raise when mutations are being deferred to an L2.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Chain ID to perform the deferred mutation to.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contractAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Contract Address at which the deferred mutation should transact with.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; StorageHandledByL2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; chainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; contractAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Error to raise when mutations are being deferred to an Off-Chain Database.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the EIP-712 domain definition of the corresponding contract performing the off-chain database, write &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * deferral reversion.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; url&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; URL to request to perform the off-chain mutation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the EIP-712 message signing data context used to authorize and instruct the mutation deferred to the &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * off-chain database handler. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * In order to authorize the deferred mutation to be performed, the user must use the domain definition (sender) and message data &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * (data) to construct a type data signature request defined in EIP-712. This signature, message data (data), and domainData (sender) &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * are then included in the HTTP POST request, denoted sender, data, and signature.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Example HTTP POST request:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      &amp;quot;sender&amp;quot;: &amp;lt;abi encoded domainData (sender)&amp;gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      &amp;quot;data&amp;quot;: &amp;lt;abi encoded message data (data)&amp;gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      &amp;quot;signature&amp;quot;: &amp;lt;EIP-712 typed data signature of corresponding message data &amp;amp; domain definition&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; StorageHandledByOffChainDatabase&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        domainData sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt; url&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        messageData data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;     &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;use-of-transactions-with-storage-deferral-reversions&quot;&gt;Use of transactions with storage-deferral reversions&lt;&#x2F;h3&gt;
&lt;p&gt;In some cases the contract might conditionally defer and handle mutations, in which case a transaction may be required. It is simple to use this method for sending transactions that may result in deferral reversions, as a client should receive the corresponding reversion while &lt;code&gt;preflighting&lt;&#x2F;code&gt; the transaction.&lt;&#x2F;p&gt;
&lt;p&gt;This functionality is ideal for applications that want to allow their users to define the security guarantees and costs associated with their actions. For example, in the case of a decentralized identity profile, a user might not care if their data is decentralized and chooses to defer the handling of their records to the off-chain handler to reduce gas fees and on-chain transactions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;use-of-revert-to-convey-call-information&quot;&gt;Use of &lt;code&gt;revert&lt;&#x2F;code&gt; to convey call information&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3668&#x2F;&quot;&gt;EIP-3668&lt;&#x2F;a&gt; adopted the idea of using a &lt;code&gt;revert&lt;&#x2F;code&gt; to convey call information. It was proposed as a simple mechanism in which any pre-existing interface or function signature could be satisfied while maintain a mechanism to instruct and trigger an off-chain lookup.&lt;&#x2F;p&gt;
&lt;p&gt;This is very similar for the write deferral protocol, defined in this EIP; without any modifications to the ABI or underlying EVM, &lt;code&gt;revert&lt;&#x2F;code&gt; provides a clean mechanism in which we can &quot;return&quot; a typed instruction - and the corresponding elements to complete that action - without modifying the signature of the corresponding function. This makes it easy to comply with pre-existing interfaces and infrastructure.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;use-of-multiple-reversion-handler-types-to-better-define-security-guarantees&quot;&gt;Use of multiple reversion &amp;amp; handler types to better define security guarantees&lt;&#x2F;h3&gt;
&lt;p&gt;By further defining the class of the handler, it gives the developer increased granularity to define the characteristics and different guarantees associated storing the data off-chain. In addition, different handlers require different parameters and verification mechanisms. This is very important for the transparency of the protocol, as they store data outside of the native ethereum ecosystem. Common implementations of this protocol could include storing non-operational data in L2 solutions and off-chain databases to reduce gas fees, while maintaining open interoperability.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Existing contracts that do not wish to use this specification are unaffected. Clients can add support for Cross Chain Write Deferrals to all contract calls without introducing any new overhead or incompatibilities.&lt;&#x2F;p&gt;
&lt;p&gt;Contracts that require Cross Chain Write Deferrals will not function in conjunction with clients that do not implement this specification. Attempts to call these contracts from non-compliant clients will result in the contract throwing an exception that is propagated to the user.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Deferred mutations should never resolve to mainnet ethereum. Such attempts to defer the mutation back to ETH could include hijacking attempts in which the contract developer is trying to get the user to sign and send a malicious transaction. Furthermore, when a transaction is deferred to an L2 system, it must use the original &lt;code&gt;calldata&lt;&#x2F;code&gt;, this prevents against potentially malicious contextual changes in the transaction.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;fingerprinting-attacks&quot;&gt;Fingerprinting attacks&lt;&#x2F;h3&gt;
&lt;p&gt;As all deferred mutations will include the &lt;code&gt;msg.sender&lt;&#x2F;code&gt; parameter in &lt;code&gt;data&lt;&#x2F;code&gt;, it is possible that &lt;code&gt;StorageHandledByOffChainDatabase&lt;&#x2F;code&gt; reversions could fingerprint wallet addresses and the corresponding IP address used to make the HTTP request. The impact of this is application-specific and something the user should understand is a risk associated with off-chain handlers. To minimize the security impact of this, we make the following recommendations:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Smart contract developers should provide users with the option to resolve data directly on the network. Allowing them to enable on-chain storage provides the user with a simple cost-benefit analysis of where they would like their data to resolve and different guarantees &#x2F; risks associated with the resolution location.&lt;&#x2F;li&gt;
&lt;li&gt;Client libraries should provide clients with a hook to override Cross Chain Write Deferral &lt;code&gt;StorageHandledByOffChainDatabase&lt;&#x2F;code&gt; calls - either by rewriting them to use a proxy service, or by denying them entirely. This mechanism or another should be written so as to easily facilitate adding domains to allowlists or blocklists.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;We encourage applications to be as transparent as possible with their setup and different precautions put in place.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Cross-Chain Execution</title>
        <published>2022-06-14T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Brendan Asselstine</name><uri>https://github.com/asselstine</uri>
	</author>
	
	<author>
		<name>Pierrick Turelier</name><uri>https://github.com/PierrickGT</uri>
	</author>
	
	<author>
		<name>Chris Whinfrey</name><uri>https://github.com/cwhinfrey</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5164/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5164-cross-chain-execution/9658" />
        

        <id>https://wg-eips.ritovision.com/5164/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="last-call"
                label="Last Call" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:5164"
            label="ERC-5164" />
        

        
        

        
        <summary type="html">Defines an interface that supports execution across EVM networks.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5164/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This specification defines a cross-chain execution interface for EVM-based blockchains. Implementations of this specification will allow contracts on one chain to call contracts on another by sending a cross-chain message.&lt;&#x2F;p&gt;
&lt;p&gt;The specification defines two components: the &quot;Message Dispatcher&quot; and the &quot;Message Executor&quot;. The Message Dispatcher lives on the calling side, and the executor lives on the receiving side. When a message is sent, a Message Dispatcher will move the message through a transport layer to a Message Executor, where they are executed. Implementations of this specification must implement both components.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Many Ethereum protocols need to coordinate state changes across multiple EVM-based blockchains. These chains often have native or third-party bridges that allow Ethereum contracts to execute code. However, bridges have different APIs so bridge integrations are custom. Each one affords different properties; with varying degrees of security, speed, and control. Defining a simple, common specification will increase code re-use and allow us to use common bridge implementations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;This specification allows contracts on one chain to send messages to contracts on another chain. There are two key interfaces that needs to be implemented:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;MessageDispatcher&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;MessageExecutor&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;code&gt;MessageDispatcher&lt;&#x2F;code&gt; lives on the origin chain and dispatches messages to the &lt;code&gt;MessageExecutor&lt;&#x2F;code&gt; for execution. The &lt;code&gt;MessageExecutor&lt;&#x2F;code&gt; lives on the destination chain and executes dispatched messages.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;messagedispatcher&quot;&gt;MessageDispatcher&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;MessageDispatcher&lt;&#x2F;code&gt; lives on the chain from which messages are sent. The Dispatcher&#x27;s job is to broadcast messages through a transport layer to one or more &lt;code&gt;MessageExecutor&lt;&#x2F;code&gt; contracts.&lt;&#x2F;p&gt;
&lt;p&gt;A unique &lt;code&gt;messageId&lt;&#x2F;code&gt; MUST be generated for each message or message batch. The message identifier MUST be unique across chains and dispatchers.  This can be achieved by hashing a tuple of &lt;code&gt;chainId, dispatcherAddress, messageNonce&lt;&#x2F;code&gt; where messageNonce is a monotonically increasing integer per message.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;messagedispatcher-methods&quot;&gt;MessageDispatcher Methods&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;dispatchMessage&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Will dispatch a message to be executed by the &lt;code&gt;MessageExecutor&lt;&#x2F;code&gt; on the destination chain specified by &lt;code&gt;toChainId&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;MessageDispatcher&lt;&#x2F;code&gt;s MUST emit the &lt;code&gt;MessageDispatched&lt;&#x2F;code&gt; event when a message is dispatched.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;MessageDispatcher&lt;&#x2F;code&gt;s MUST revert if &lt;code&gt;toChainId&lt;&#x2F;code&gt; is not supported.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;MessageDispatcher&lt;&#x2F;code&gt;s MUST forward the message to a &lt;code&gt;MessageExecutor&lt;&#x2F;code&gt; on the &lt;code&gt;toChainId&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;MessageDispatcher&lt;&#x2F;code&gt;s MUST use a unique &lt;code&gt;messageId&lt;&#x2F;code&gt; for each message.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;MessageDispatcher&lt;&#x2F;code&gt;s MUST return the &lt;code&gt;messageId&lt;&#x2F;code&gt; to allow the message sender to track the message.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;MessageDispatcher&lt;&#x2F;code&gt;s MAY require payment.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MessageDispatcher&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; dispatchMessage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; toChainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; messageId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; d&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ispatchMessage&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; p&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ayable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;oChainId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;o&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; d&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; m&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;essageId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ytes32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;messagedispatcher-events&quot;&gt;MessageDispatcher Events&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;MessageDispatched&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;MessageDispatched&lt;&#x2F;code&gt; event MUST be emitted by the &lt;code&gt;MessageDispatcher&lt;&#x2F;code&gt; when an individual message is dispatched.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MessageDispatcher&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MessageDispatched&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; messageId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; toChainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; M&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;essageDispatched&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;vent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; m&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;essageId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ytes32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;rom&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;oChainId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;o&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; d&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;messageexecutor&quot;&gt;MessageExecutor&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;MessageExecutor&lt;&#x2F;code&gt; executes dispatched messages and message batches. Developers must implement a &lt;code&gt;MessageExecutor&lt;&#x2F;code&gt; in order to execute messages on the receiving chain.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;MessageExecutor&lt;&#x2F;code&gt; will execute a messageId only once, but may execute messageIds in any order. This specification makes no ordering guarantees, because messages and message batches may travel non-sequentially through the transport layer.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;execution&quot;&gt;Execution&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;MessageExecutor&lt;&#x2F;code&gt;s SHOULD verify all message data with the bridge transport layer.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;MessageExecutor&lt;&#x2F;code&gt;s MUST NOT successfully execute a message more than once.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;MessageExecutor&lt;&#x2F;code&gt;s MUST revert the transaction when a message fails to be executed allowing the message to be retried at a later time.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Calldata&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;MessageExecutor&lt;&#x2F;code&gt;s MUST append the ABI-packed (&lt;code&gt;messageId&lt;&#x2F;code&gt;, &lt;code&gt;fromChainId&lt;&#x2F;code&gt;, &lt;code&gt;from&lt;&#x2F;code&gt;) to the calldata for each message being executed. This allows the receiver of the message to verify the cross-chain sender and the chain that the message is coming from.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; messageId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; fromChainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; from&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;alldata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; d&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; m&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;essageId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ytes32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;romChainId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;rom&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;messageexecutor-events&quot;&gt;MessageExecutor Events&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;MessageIdExecuted&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;MessageIdExecuted&lt;&#x2F;code&gt; MUST be emitted once a message or message batch has been executed.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MessageExecutor&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MessageIdExecuted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; fromChainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; messageId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; M&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;essageIdExecuted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;vent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;romChainId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; m&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;essageId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ytes32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;messageexecutor-errors&quot;&gt;MessageExecutor Errors&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;MessageAlreadyExecuted&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;MessageExecutor&lt;&#x2F;code&gt;s MUST revert if a messageId has already been executed and SHOULD emit a &lt;code&gt;MessageIdAlreadyExecuted&lt;&#x2F;code&gt; custom error.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MessageExecutor&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MessageIdAlreadyExecuted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; messageId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;MessageFailure&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;MessageExecutor&lt;&#x2F;code&gt;s MUST revert if an individual message fails and SHOULD emit a &lt;code&gt;MessageFailure&lt;&#x2F;code&gt; custom error.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MessageExecutor&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MessageFailure&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; messageId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span&gt; errorData&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;MessageDispatcher&lt;&#x2F;code&gt; can be coupled to one or more &lt;code&gt;MessageExecutor&lt;&#x2F;code&gt;. It is up to bridges to decide how to couple the two. Users can easily bridge a message by calling &lt;code&gt;dispatchMessage&lt;&#x2F;code&gt; without being aware of the &lt;code&gt;MessageExecutor&lt;&#x2F;code&gt; address. Messages can also be traced by a client using the data logged by the &lt;code&gt;MessageIdExecuted&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;p&gt;Some bridges may require payment in the native currency, so the &lt;code&gt;dispatchMessage&lt;&#x2F;code&gt; function is payable.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This specification is compatible with existing governance systems as it offers simple cross-chain execution.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Bridge trust profiles are variable, so users must understand that bridge security depends on the implementation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Slippage Protection for Tokenized Vault</title>
        <published>2022-06-09T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Hadrien Croubois</name><uri>https://github.com/amxx</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5143/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5143-slippage-protection-for-tokenized-vaults/9554" />
        

        <id>https://wg-eips.ritovision.com/5143/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:5143"
            label="ERC-5143" />
        

        
        

        
        <summary type="html">An extension of EIP-4626 supporting improved EOA interactions.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5143/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The following standard extends the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4626&#x2F;&quot;&gt;EIP-4626&lt;&#x2F;a&gt; Tokenized Vault standard with functions dedicated to the safe interaction between EOAs and the vault when price is subject to slippage.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4626&#x2F;&quot;&gt;EIP-4626&lt;&#x2F;a&gt; security considerations section states that:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&quot;If implementors intend to support EOA account access directly, they should consider adding an additional function call for deposit&#x2F;mint&#x2F;withdraw&#x2F;redeem with the means to accommodate slippage loss or unexpected deposit&#x2F;withdrawal limits, since they have no other means to revert the transaction if the exact output amount is not achieved.&quot;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;Yet, EIP-4626 does not standardize the corresponding function signatures and behaviors. For improved interroperability, and better support by wallets, it is essential that this optional functions are also standardized.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC is an extension of EIP-4626. Any contract implementing it MUST also implement EIP-4626.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;methods&quot;&gt;Methods&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;deposit&quot;&gt;deposit&lt;&#x2F;h4&gt;
&lt;p&gt;Overloaded version of ERC-4626&#x27;s &lt;code&gt;deposit&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Mints &lt;code&gt;shares&lt;&#x2F;code&gt; Vault shares to &lt;code&gt;receiver&lt;&#x2F;code&gt; by depositing exactly &lt;code&gt;assets&lt;&#x2F;code&gt; of underlying tokens.&lt;&#x2F;p&gt;
&lt;p&gt;MUST emit the &lt;code&gt;Deposit&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;p&gt;MUST support &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;EIP-20&lt;&#x2F;a&gt; &lt;code&gt;approve&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;transferFrom&lt;&#x2F;code&gt; on &lt;code&gt;asset&lt;&#x2F;code&gt; as a deposit flow.
MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the &lt;code&gt;deposit&lt;&#x2F;code&gt; execution, and are accounted for during &lt;code&gt;deposit&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST revert if all of &lt;code&gt;assets&lt;&#x2F;code&gt; cannot be deposited (due to deposit limit being reached, slippage, the user not approving enough underlying tokens to the Vault contract, etc).
MUST revert if depositing &lt;code&gt;assets&lt;&#x2F;code&gt; underlying asset mints less then &lt;code&gt;minShares&lt;&#x2F;code&gt; shares.&lt;&#x2F;p&gt;
&lt;p&gt;Note that most implementations will require pre-approval of the Vault with the Vault&#x27;s underlying &lt;code&gt;asset&lt;&#x2F;code&gt; token.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; d&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eposit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;onpayable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ssets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eceiver&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; m&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;inShares&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;hares&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;mint&quot;&gt;mint&lt;&#x2F;h4&gt;
&lt;p&gt;Overloaded version of ERC-4626&#x27;s &lt;code&gt;mint&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Mints exactly &lt;code&gt;shares&lt;&#x2F;code&gt; Vault shares to &lt;code&gt;receiver&lt;&#x2F;code&gt; by depositing &lt;code&gt;assets&lt;&#x2F;code&gt; of underlying tokens.&lt;&#x2F;p&gt;
&lt;p&gt;MUST emit the &lt;code&gt;Deposit&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;p&gt;MUST support ERC-20 &lt;code&gt;approve&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;transferFrom&lt;&#x2F;code&gt; on &lt;code&gt;asset&lt;&#x2F;code&gt; as a mint flow.
MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the &lt;code&gt;mint&lt;&#x2F;code&gt; execution, and are accounted for during &lt;code&gt;mint&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST revert if all of &lt;code&gt;shares&lt;&#x2F;code&gt; cannot be minted (due to deposit limit being reached, slippage, the user not approving enough underlying tokens to the Vault contract, etc).
MUST revert if minting &lt;code&gt;shares&lt;&#x2F;code&gt; shares cost more then &lt;code&gt;maxAssets&lt;&#x2F;code&gt; underlying tokens.&lt;&#x2F;p&gt;
&lt;p&gt;Note that most implementations will require pre-approval of the Vault with the Vault&#x27;s underlying &lt;code&gt;asset&lt;&#x2F;code&gt; token.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; m&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;onpayable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;hares&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eceiver&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; m&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;axAssets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ssets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;withdraw&quot;&gt;withdraw&lt;&#x2F;h4&gt;
&lt;p&gt;Overloaded version of ERC-4626&#x27;s &lt;code&gt;withdraw&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Burns &lt;code&gt;shares&lt;&#x2F;code&gt; from &lt;code&gt;owner&lt;&#x2F;code&gt; and sends exactly &lt;code&gt;assets&lt;&#x2F;code&gt; of underlying tokens to &lt;code&gt;receiver&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST emit the &lt;code&gt;Withdraw&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;p&gt;MUST support a withdraw flow where the shares are burned from &lt;code&gt;owner&lt;&#x2F;code&gt; directly where &lt;code&gt;owner&lt;&#x2F;code&gt; is &lt;code&gt;msg.sender&lt;&#x2F;code&gt; or &lt;code&gt;msg.sender&lt;&#x2F;code&gt; has ERC-20 approval over the shares of &lt;code&gt;owner&lt;&#x2F;code&gt;.
MAY support an additional flow in which the shares are transferred to the Vault contract before the &lt;code&gt;withdraw&lt;&#x2F;code&gt; execution, and are accounted for during &lt;code&gt;withdraw&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST revert if all of &lt;code&gt;assets&lt;&#x2F;code&gt; cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner not having enough shares, etc).
MUST revert if withdrawing &lt;code&gt;assets&lt;&#x2F;code&gt; underlying tokens requires burning more then &lt;code&gt;maxShares&lt;&#x2F;code&gt; shares.&lt;&#x2F;p&gt;
&lt;p&gt;Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed. Those methods should be performed separately.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; w&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ithdraw&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;onpayable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ssets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eceiver&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; o&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;wner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; m&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;axShares&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;hares&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;redeem&quot;&gt;redeem&lt;&#x2F;h4&gt;
&lt;p&gt;Overloaded version of ERC-4626&#x27;s &lt;code&gt;redeem&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Burns exactly &lt;code&gt;shares&lt;&#x2F;code&gt; from &lt;code&gt;owner&lt;&#x2F;code&gt; and sends &lt;code&gt;assets&lt;&#x2F;code&gt; of underlying tokens to &lt;code&gt;receiver&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST emit the &lt;code&gt;Withdraw&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;p&gt;MUST support a redeem flow where the shares are burned from &lt;code&gt;owner&lt;&#x2F;code&gt; directly where &lt;code&gt;owner&lt;&#x2F;code&gt; is &lt;code&gt;msg.sender&lt;&#x2F;code&gt; or &lt;code&gt;msg.sender&lt;&#x2F;code&gt; has ERC-20 approval over the shares of &lt;code&gt;owner&lt;&#x2F;code&gt;.
MAY support an additional flow in which the shares are transferred to the Vault contract before the &lt;code&gt;redeem&lt;&#x2F;code&gt; execution, and are accounted for during &lt;code&gt;redeem&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST revert if all of &lt;code&gt;shares&lt;&#x2F;code&gt; cannot be redeemed (due to withdrawal limit being reached, slippage, the owner not having enough shares, etc).
MUST revert if redeeming &lt;code&gt;shares&lt;&#x2F;code&gt; shares sends less than &lt;code&gt;minAssets&lt;&#x2F;code&gt; underlying tokens to &lt;code&gt;receiver&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed. Those methods should be performed separately.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;edeem&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;onpayable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;hares&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eceiver&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; o&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;wner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; m&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;inAssets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ssets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC&#x27;s functions do not replace ERC-4626 equivalent mechanisms. They are additional (overloaded) methods designed to protect EOAs interacting with the vault.&lt;&#x2F;p&gt;
&lt;p&gt;When smart contracts interact with an ERC-4626 vault, they can preview any operation using the dedicated functions before executing the operation. This can be done
atomically, with no risk of price change. This is not true of EOA, which will preview their operations on a UI, sign a transaction, and have it mined later.
Between the preview and the transaction being executed, the blockchain state might change, resulting in unexpected outcomes. In particular, frontrunning
make EOA&#x27;s interractons with an ERC-4626 vault possibly risky.&lt;&#x2F;p&gt;
&lt;p&gt;Other projects in the DeFi spaces, such as decentralized exchanges, already include similar mechanisms so a user can request its transaction reverts if the
resulting exchange rate is not considered good enough.&lt;&#x2F;p&gt;
&lt;p&gt;Implementing This ERC on top of an ERC-4626 contract can be done very easily. It just requires calling the corresponding ERC-4626 function and adding a revert
check on the returned value.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;alternative-approaches&quot;&gt;Alternative approaches&lt;&#x2F;h3&gt;
&lt;p&gt;This ERC aims at solving the security concerns (describes in the motivation section) at the vault level. For completeness, we have to mention that these issues can also be addressed using a generic ERC-4626 router, similar to how Uniswap V2 &amp;amp; V3 use a router to provide good user workflows on top of the Uniswap pairs. The router approach is possibly more versatile and leaves more room for evolutions (the router can be replaced at any point) but it also leads to more expensive operations because the router needs to take temporary custody of the tokens going into the vault.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Given an existing ERC-4626 implementation&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC5143&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC4626&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; deposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; assets&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; receiver&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; minShares&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; shares &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; deposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;assets&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; receiver&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;shares &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; minShares&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC5143: deposit slippage protection&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; shares&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; shares&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; receiver&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; maxAssets&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; assets &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;shares&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; receiver&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;assets &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; maxAssets&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC5143: mint slippage protection&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; assets&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; withdraw&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; assets&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; receiver&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; maxShares&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; shares &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; withdraw&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;assets&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; receiver&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;shares &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; maxShares&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC5143: withdraw slippage protection&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; shares&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; redeem&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; shares&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; receiver&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; minAssets&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; assets &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; redeem&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;shares&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; receiver&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;assets &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; minAssets&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC5143: redeem slippage protection&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; assets&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC addresses one of the security consideration raised by ERC-4626. Other considerations still apply.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Remote Procedure Call Provider Lists</title>
        <published>2022-06-06T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Sam Wilson</name><uri>https://github.com/SamWilsn</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5139/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5139-remote-procedure-call-provider-lists/9517" />
        

        <id>https://wg-eips.ritovision.com/5139/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:5139"
            label="ERC-5139" />
        

        
        

        
        <summary type="html">Format for lists of RPC providers for Ethereum-like chains.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5139/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal specifies a JSON schema for describing lists of remote procedure call (RPC) providers for Ethereum-like chains, including their supported &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt; &lt;code&gt;CHAIN_ID&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The recent explosion of alternate chains, scaling solutions, and other mostly Ethereum-compatible ledgers has brought with it many risks for users. It has become commonplace to blindly add new RPC providers using &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3085&#x2F;&quot;&gt;EIP-3085&lt;&#x2F;a&gt; without evaluating their trustworthiness. At best, these RPC providers may be accurate, but track requests; and at worst, they may provide misleading information and frontrun transactions.&lt;&#x2F;p&gt;
&lt;p&gt;If users instead are provided with a comprehensive provider list built directly by their wallet, with the option of switching to whatever list they so choose, the risk of these malicious providers is mitigated significantly, without sacrificing functionality for advanced users.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot; and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;list-validation-schema&quot;&gt;List Validation &amp;amp; Schema&lt;&#x2F;h3&gt;
&lt;p&gt;List consumers (like wallets) MUST validate lists against the provided schema. List consumers MUST NOT connect to RPC providers present only in an invalid list.&lt;&#x2F;p&gt;
&lt;p&gt;Lists MUST conform to the following JSON Schema:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;$schema&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;json-schema.org&#x2F;draft&#x2F;2020-12&#x2F;schema&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Ethereum RPC Provider List&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Schema for lists of RPC providers compatible with Ethereum wallets.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;$defs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;VersionBase&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Version of a list, used to communicate changes.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;required&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;major&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;minor&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;patch&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;major&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;integer&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Major version of a list. Incremented when providers are removed from the list or when their chain ids change.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;minimum&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;minor&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;integer&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Minor version of a list. Incremented when providers are added to the list.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;minimum&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;patch&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;integer&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Patch version of a list. Incremented for any change not covered by major or minor versions, like bug fixes.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;minimum&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;preRelease&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Pre-release version of a list. Indicates that the version is unstable and might not satisfy the intended compatibility requirements as denoted by its major, minor, and patch versions.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;pattern&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;^[1-9A-Za-z][0-9A-Za-z]*(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\\&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;.[1-9A-Za-z][0-9A-Za-z]*)*$&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;Version&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;additionalProperties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;allOf&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;$ref&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;#&#x2F;$defs&#x2F;VersionBase&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;major&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;minor&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;patch&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;preRelease&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;build&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Build metadata associated with a list.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;pattern&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;^[0-9A-Za-z-]+(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\\&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;.[0-9A-Za-z-])*$&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;VersionRange&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;additionalProperties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;major&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;minor&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;patch&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;preRelease&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;mode&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;allOf&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;$ref&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;#&#x2F;$defs&#x2F;VersionBase&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;oneOf&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;mode&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;^&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;preRelease&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;required&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;preRelease&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;mode&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;mode&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;Logo&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A URI to a logo; suggest SVG or PNG of size 64x64&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uri&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;ProviderChain&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A single chain supported by a provider&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;additionalProperties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;required&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;endpoints&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;integer&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Chain ID of an Ethereum-compatible network&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;minimum&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;endpoints&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;array&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;minItems&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uniqueItems&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;items&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uri&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;Provider&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Description of an RPC provider.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;additionalProperties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;required&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;chains&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Name of the provider.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;minLength&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;maxLength&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 40&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;pattern&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;^[ &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\\&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;w.&amp;#39;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\\&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;-%&#x2F;À-ÖØ-öø-ÿ:&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\\&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\\&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\\&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\\&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;)]+$&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;logo&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;$ref&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;#&#x2F;$defs&#x2F;Logo&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;priority&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;integer&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Priority of this provider (where zero is the highest priority.)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;minimum&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chains&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;array&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;items&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;$ref&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;#&#x2F;$defs&#x2F;ProviderChain&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;Path&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A JSON Pointer path.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;Patch&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;items&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;oneOf&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;additionalProperties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;required&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;op&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;path&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;path&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;$ref&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;#&#x2F;$defs&#x2F;Path&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;op&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The operation to perform.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;add&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;replace&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;test&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The value to add, replace or test.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;additionalProperties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;required&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;op&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;path&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;path&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;$ref&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;#&#x2F;$defs&#x2F;Path&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;op&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The operation to perform.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;remove&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;additionalProperties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;required&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;from&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;op&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;path&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;path&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;$ref&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;#&#x2F;$defs&#x2F;Path&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;op&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The operation to perform.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;move&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;copy&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;from&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;$ref&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;#&#x2F;$defs&#x2F;Path&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A JSON Pointer path pointing to the location to move&#x2F;copy from.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;array&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;additionalProperties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;required&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;timestamp&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Name of the provider list&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;minLength&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;maxLength&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 40&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;pattern&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;^[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\\&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;w ]+$&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;logo&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;$ref&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;#&#x2F;$defs&#x2F;Logo&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;$ref&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;#&#x2F;$defs&#x2F;Version&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;timestamp&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;date-time&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The timestamp of this list version; i.e. when this immutable version of the list was created&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;extends&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;changes&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;providers&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;oneOf&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;required&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;extends&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;changes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;providers&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;extends&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;additionalProperties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;required&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uri&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uri&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Location of the list to extend, as a URI.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;ens&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Location of the list to extend using EIP-1577.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;$ref&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;#&#x2F;$defs&#x2F;VersionRange&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;oneOf&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uri&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;ens&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;ens&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uri&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;changes&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;$ref&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;#&#x2F;$defs&#x2F;Patch&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;required&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;providers&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;changes&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;extends&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;providers&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;additionalProperties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;$ref&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;#&#x2F;$defs&#x2F;Provider&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;For illustrative purposes, the following is an example list following the schema:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Example Provider List&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;major&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;minor&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;patch&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;build&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;XPSr.p.I.g.l&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;timestamp&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2004-08-08T00:00:00.0Z&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;logo&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;mylist.invalid&#x2F;logo.png&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;providers&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;some-key&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Frustrata&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chains&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;endpoints&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;mainnet1.frustrata.invalid&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;mainnet2.frustrana.invalid&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;endpoints&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;ropsten.frustrana.invalid&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;other-key&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Sourceri&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;priority&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chains&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;endpoints&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;mainnet.sourceri.invalid&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 42&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;endpoints&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;kovan.sourceri.invalid&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;versioning&quot;&gt;Versioning&lt;&#x2F;h3&gt;
&lt;p&gt;List versioning MUST follow the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5139&#x2F;assets&#x2F;semver&#x2F;&quot;&gt;Semantic Versioning 2.0.0&lt;&#x2F;a&gt; (SemVer) specification.&lt;&#x2F;p&gt;
&lt;p&gt;The major version MUST be incremented for the following modifications:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Removing a provider.&lt;&#x2F;li&gt;
&lt;li&gt;Changing a provider&#x27;s key in the &lt;code&gt;providers&lt;&#x2F;code&gt; object.&lt;&#x2F;li&gt;
&lt;li&gt;Removing the last &lt;code&gt;ProviderChain&lt;&#x2F;code&gt; for a chain id.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The major version MAY be incremented for other modifications, as permitted by SemVer.&lt;&#x2F;p&gt;
&lt;p&gt;If the major version is not incremented, the minor version MUST be incremented if any of the following modifications are made:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Adding a provider.&lt;&#x2F;li&gt;
&lt;li&gt;Adding the first &lt;code&gt;ProviderChain&lt;&#x2F;code&gt; of a chain id.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The minor version MAY be incremented for other modifications, as permitted by SemVer.&lt;&#x2F;p&gt;
&lt;p&gt;If the major and minor versions are unchanged, the patch version MUST be incremented for any change.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;publishing&quot;&gt;Publishing&lt;&#x2F;h3&gt;
&lt;p&gt;Provider lists SHOULD be published to an Ethereum Name Service (ENS) name using &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1577&#x2F;&quot;&gt;EIP-1577&lt;&#x2F;a&gt;&#x27;s &lt;code&gt;contenthash&lt;&#x2F;code&gt; mechanism on mainnet.&lt;&#x2F;p&gt;
&lt;p&gt;Provider lists MAY instead be published using HTTPS. Provider lists published in this way MUST allow reasonable access from other origins (generally by setting the header &lt;code&gt;Access-Control-Allow-Origin: *&lt;&#x2F;code&gt;.)&lt;&#x2F;p&gt;
&lt;h3 id=&quot;priority&quot;&gt;Priority&lt;&#x2F;h3&gt;
&lt;p&gt;Provider entries MAY contain a &lt;code&gt;priority&lt;&#x2F;code&gt; field. A &lt;code&gt;priority&lt;&#x2F;code&gt; value of zero SHALL indicate the highest priority, with increasing &lt;code&gt;priority&lt;&#x2F;code&gt; values indicating decreasing priority. Multiple providers MAY be assigned the same priority. All providers without a &lt;code&gt;priority&lt;&#x2F;code&gt; field SHALL have equal priority. Providers without a &lt;code&gt;priority&lt;&#x2F;code&gt; field SHALL always have a lower priority than any provider with a &lt;code&gt;priority&lt;&#x2F;code&gt; field.&lt;&#x2F;p&gt;
&lt;p&gt;List consumers MAY use &lt;code&gt;priority&lt;&#x2F;code&gt; fields to choose when to connect to a provider, but MAY ignore it entirely. List consumers SHOULD explain to users how their implementation interprets &lt;code&gt;priority&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;list-subtypes&quot;&gt;List Subtypes&lt;&#x2F;h3&gt;
&lt;p&gt;Provider lists are subdivided into two categories: root lists, and extension lists. A root list contains a list of providers, while an extension list contains a set of modifications to apply to another list.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;root-lists&quot;&gt;Root Lists&lt;&#x2F;h4&gt;
&lt;p&gt;A root list has a top-level &lt;code&gt;providers&lt;&#x2F;code&gt; key.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;extension-lists&quot;&gt;Extension Lists&lt;&#x2F;h4&gt;
&lt;p&gt;An extension list has top-level &lt;code&gt;extends&lt;&#x2F;code&gt; and &lt;code&gt;changes&lt;&#x2F;code&gt; keys.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;specifying-a-parent-extends&quot;&gt;Specifying a Parent (&lt;code&gt;extends&lt;&#x2F;code&gt;)&lt;&#x2F;h5&gt;
&lt;p&gt;The &lt;code&gt;uri&lt;&#x2F;code&gt; and &lt;code&gt;ens&lt;&#x2F;code&gt; fields SHALL point to a source for the parent list.&lt;&#x2F;p&gt;
&lt;p&gt;If present, the &lt;code&gt;uri&lt;&#x2F;code&gt; field MUST use a scheme specified in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5139&#x2F;#publishing&quot;&gt;Publishing&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;If present, the &lt;code&gt;ens&lt;&#x2F;code&gt; field MUST specify an ENS name to be resolved using EIP-1577.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;version&lt;&#x2F;code&gt; field SHALL specify a range of compatible versions. List consumers MUST reject extension lists specifying an incompatible parent version.&lt;&#x2F;p&gt;
&lt;p&gt;In the event of an incompatible version, list consumers MAY continue to use a previously saved parent list, but list consumers choosing to do so MUST display a prominent warning that the provider list is out of date.&lt;&#x2F;p&gt;
&lt;h6 id=&quot;default-mode&quot;&gt;Default Mode&lt;&#x2F;h6&gt;
&lt;p&gt;If the &lt;code&gt;mode&lt;&#x2F;code&gt; field is omitted, a parent version SHALL be compatible if and only if the parent&#x27;s version number matches the left-most non-zero portion in the major, minor, patch grouping.&lt;&#x2F;p&gt;
&lt;p&gt;For example:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;major&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;minor&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;patch&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;3&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Is equivalent to:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;gt;=1.2.3, &amp;lt;2.0.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;And:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;major&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;minor&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;patch&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;3&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Is equivalent to:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;gt;=0.2.3, &amp;lt;0.3.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h6 id=&quot;caret-mode&quot;&gt;Caret Mode (&lt;code&gt;^&lt;&#x2F;code&gt;)&lt;&#x2F;h6&gt;
&lt;p&gt;The &lt;code&gt;^&lt;&#x2F;code&gt; mode SHALL behave exactly as the default mode above.&lt;&#x2F;p&gt;
&lt;h6 id=&quot;exact-mode&quot;&gt;Exact Mode (&lt;code&gt;=&lt;&#x2F;code&gt;)&lt;&#x2F;h6&gt;
&lt;p&gt;In &lt;code&gt;=&lt;&#x2F;code&gt; mode, a parent version SHALL be compatible if and only if the parent&#x27;s version number exactly matches the specified version.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;specifying-changes-changes&quot;&gt;Specifying Changes (&lt;code&gt;changes&lt;&#x2F;code&gt;)&lt;&#x2F;h5&gt;
&lt;p&gt;The &lt;code&gt;changes&lt;&#x2F;code&gt; field SHALL be a JavaScript Object Notation (JSON) Patch document as specified in RFC 6902.&lt;&#x2F;p&gt;
&lt;p&gt;JSON pointers within the &lt;code&gt;changes&lt;&#x2F;code&gt; field MUST be resolved relative to the &lt;code&gt;providers&lt;&#x2F;code&gt; field of the parent list. For example, see the following lists for a correctly formatted extension.&lt;&#x2F;p&gt;
&lt;h6 id=&quot;root-list&quot;&gt;Root List&lt;&#x2F;h6&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;TODO&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h6 id=&quot;extension-list&quot;&gt;Extension List&lt;&#x2F;h6&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;TODO&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;applying-extension-lists&quot;&gt;Applying Extension Lists&lt;&#x2F;h5&gt;
&lt;p&gt;List consumers MUST follow this algorithm to apply extension lists:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Is the current list an extension list?
&lt;ul&gt;
&lt;li&gt;Yes:
&lt;ol&gt;
&lt;li&gt;Ensure that this &lt;code&gt;from&lt;&#x2F;code&gt; has not been seen before.&lt;&#x2F;li&gt;
&lt;li&gt;Retrieve the parent list.&lt;&#x2F;li&gt;
&lt;li&gt;Verify that the parent list is valid according to the JSON schema.&lt;&#x2F;li&gt;
&lt;li&gt;Ensure that the parent list is version compatible.&lt;&#x2F;li&gt;
&lt;li&gt;Set the current list to the parent list and go to step 1.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;No:
&lt;ol&gt;
&lt;li&gt;Go to step 2.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Copy the current list into a variable &lt;code&gt;$output&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Does the current list have a child:
&lt;ul&gt;
&lt;li&gt;Yes:
&lt;ol&gt;
&lt;li&gt;Apply the child&#x27;s &lt;code&gt;changes&lt;&#x2F;code&gt; to &lt;code&gt;providers&lt;&#x2F;code&gt; in &lt;code&gt;$output&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Verify that &lt;code&gt;$output&lt;&#x2F;code&gt; is valid according to the JSON schema.&lt;&#x2F;li&gt;
&lt;li&gt;Set the current list to the child.&lt;&#x2F;li&gt;
&lt;li&gt;Go to step 3.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;No:
&lt;ol&gt;
&lt;li&gt;Replace the current list&#x27;s &lt;code&gt;providers&lt;&#x2F;code&gt; with &lt;code&gt;providers&lt;&#x2F;code&gt; from &lt;code&gt;$output&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The current list is now the resolved list; return it.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;List consumers SHOULD limit the number of extension lists to a reasonable number.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This specification has two layers (provider, then chain id) instead of a flatter structure so that wallets can choose to query multiple independent providers for the same query and compare the results.&lt;&#x2F;p&gt;
&lt;p&gt;Each provider may specify multiple endpoints to implement load balancing or redundancy.&lt;&#x2F;p&gt;
&lt;p&gt;List version identifiers conform to SemVer to roughly communicate the kinds of changes that each new version brings. If a new version adds functionality (eg. a new chain id), then users can expect the minor version to be incremented. Similarly, if the major version is not incremented, list subscribers can assume dapps that work in the current version will continue to work in the next one.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Ultimately it is up to the end user to decide on what list to subscribe to. Most users will not change from the default list maintained by their wallet. Since wallets already have access to private keys, giving them additional control over RPC providers seems like a small increase in risk.&lt;&#x2F;p&gt;
&lt;p&gt;While list maintainers may be incentivized (possibly financially) to include or exclude particular providers, actually doing so may jeopardize the legitimacy of their lists. This standard facilitates swapping lists, so if such manipulation is revealed, users are free to swap to a new list with little effort.&lt;&#x2F;p&gt;
&lt;p&gt;If the list chosen by the user is published using EIP-1577, the list consumer has to have access to ENS in some way. This creates a paradox: how do you query Ethereum without an RPC provider? This paradox creates an attack vector: whatever method the list consumer uses to fetch the list can track the user, and even more seriously, &lt;strong&gt;can lie about the contents of the list&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>SAFE Authentication For ENS</title>
        <published>2022-06-03T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Wilkins Chung</name><uri>https://github.com/wwhchung</uri><email>wilkins@manifold.xyz</email>
	</author>
	
	<author>
		<name>Jalil Wahdatehagh</name><uri>https://github.com/jwahdatehagh</uri>
	</author>
	
	<author>
		<name>Cry</name><uri>https://github.com/crydoteth</uri>
	</author>
	
	<author>
		<name>Sillytuna</name><uri>https://github.com/sillytuna</uri>
	</author>
	
	<author>
		<name>Cyberpnk</name><uri>https://github.com/CyberpnkWin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5131/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5131-ens-subdomain-authentication/9458" />
        

        <id>https://wg-eips.ritovision.com/5131/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:5131"
            label="ERC-5131" />
        

        
        

        
        <summary type="html">Using ENS Text Records to facilitate safer and more convenient signing operations.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5131/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP links one or more signing wallets via Ethereum Name Service Specification (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;137&#x2F;&quot;&gt;EIP-137&lt;&#x2F;a&gt;) to prove control and asset ownership of a main wallet.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Proving ownership of an asset to a third party application in the Ethereum ecosystem is common. Users frequently sign payloads of data to authenticate themselves before gaining access to perform some operation. However, this method--akin to giving the third party root access to one&#x27;s main wallet--is both insecure and inconvenient.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Examples:&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;In order for you to edit your profile on OpenSea, you must sign a message with your wallet.&lt;&#x2F;li&gt;
&lt;li&gt;In order to access NFT gated content, you must sign a message with the wallet containing the NFT in order to prove ownership.&lt;&#x2F;li&gt;
&lt;li&gt;In order to gain access to an event, you must sign a message with the wallet containing a required NFT in order to prove ownership.&lt;&#x2F;li&gt;
&lt;li&gt;In order to claim an airdrop, you must interact with the smart contract with the qualifying wallet.&lt;&#x2F;li&gt;
&lt;li&gt;In order to prove ownership of an NFT, you must sign a payload with the wallet that owns that NFT.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;In all the above examples, one interacts with the dApp or smart contract using the wallet itself, which may be&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;inconvenient (if it is controlled via a hardware wallet or a multi-sig)&lt;&#x2F;li&gt;
&lt;li&gt;insecure (since the above operations are read-only, but you are signing&#x2F;interacting via a wallet that has write access)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Instead, one should be able to approve multiple wallets to authenticate on behalf of a given wallet.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;problems-with-existing-methods-and-solutions&quot;&gt;Problems with existing methods and solutions&lt;&#x2F;h3&gt;
&lt;p&gt;Unfortunately, we&#x27;ve seen many cases where users have accidentally signed a malicious payload. The result is almost always a significant loss of assets associated with the signing address.&lt;&#x2F;p&gt;
&lt;p&gt;In addition to this, many users keep significant portions of their assets in &#x27;cold storage&#x27;. With the increased security from &#x27;cold storage&#x27; solutions, we usually see decreased accessibility because users naturally increase the barriers required to access these wallets.&lt;&#x2F;p&gt;
&lt;p&gt;Some solutions propose dedicated registry smart contracts to create this link, or new protocols to be supported. This is problematic from an adoption standpoint, and there have not been any standards created for them.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;proposal-use-the-ethereum-name-service-eip-137&quot;&gt;Proposal: Use the Ethereum Name Service (EIP-137)&lt;&#x2F;h3&gt;
&lt;p&gt;Rather than &#x27;re-invent the wheel&#x27;, this proposal aims to use the widely adopted Ethereum Name Service in conjunction with the ENS Text Records feature (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;634&#x2F;&quot;&gt;EIP-634&lt;&#x2F;a&gt;) in order to achieve a safer and more convenient way to sign and authenticate, and provide &#x27;read only&#x27; access to a main wallet via one or more secondary wallets.&lt;&#x2F;p&gt;
&lt;p&gt;From there, the benefits are twofold. This EIP gives users increased security via outsourcing potentially malicious signing operations to wallets that are more accessible (hot wallets), while being able to maintain the intended security assumptions of wallets that are not frequently used for signing operations.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;improving-dapp-interaction-security&quot;&gt;Improving dApp Interaction Security&lt;&#x2F;h4&gt;
&lt;p&gt;Many dApps requires one to prove control of a wallet to gain access. At the moment, this means that you must interact with the dApp using the wallet itself. This is a security issue, as malicious dApps or phishing sites can lead to the assets of the wallet being compromised by having them sign malicious payloads.&lt;&#x2F;p&gt;
&lt;p&gt;However, this risk would be mitigated if one were to use a secondary wallet for these interactions. Malicious interactions would be isolated to the assets held in the secondary wallet, which can be set up to contain little to nothing of value.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;improving-multiple-device-access-security&quot;&gt;Improving Multiple Device Access Security&lt;&#x2F;h4&gt;
&lt;p&gt;In order for a non-hardware wallet to be used on multiple devices, you must import the seed phrase to each device. Each time a seed phrase is entered on a new device, the risk of the wallet being compromised increases as you are increasing the surface area of devices that have knowledge of the seed phrase.&lt;&#x2F;p&gt;
&lt;p&gt;Instead, each device can have its own unique wallet that is an authorized secondary wallet of the main wallet. If a device specific wallet was ever compromised or lost, you could simply remove the authorization to authenticate.&lt;&#x2F;p&gt;
&lt;p&gt;Further, wallet authentication can be chained so that a secondary wallet could itself authorize one or many tertiary wallets, which then have signing rights for both the secondary address as well as the root main address. This, can allow teams to each have their own signer while the main wallet can easily invalidate an entire tree, just by revoking rights from the root stem.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;improving-convenience&quot;&gt;Improving Convenience&lt;&#x2F;h4&gt;
&lt;p&gt;Many invididuals use hardware wallets for maximum security. However, this is often inconvenient, since many do not want to carry their hardware wallet with them at all times.&lt;&#x2F;p&gt;
&lt;p&gt;Instead, if you approve a non-hardware wallet for authentication activities (such as a mobile device), you would be able to use most dApps without the need to have your hardware wallet on hand.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;Let:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;mainAddress&lt;&#x2F;code&gt; represent the wallet address we are trying to authenticate or prove asset ownership for.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;mainENS&lt;&#x2F;code&gt; represent the reverse lookup ENS string for &lt;code&gt;mainAddress&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;authAddress&lt;&#x2F;code&gt; represent the address we want to use for signing in lieu of &lt;code&gt;mainAddress&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;authENS&lt;&#x2F;code&gt; represent the reverse lookup ENS string for &lt;code&gt;authAddress&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;authKey&lt;&#x2F;code&gt; represents a string in the format &lt;code&gt;[0-9A-Za-z]+&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Control of &lt;code&gt;mainAddress&lt;&#x2F;code&gt; and ownership of &lt;code&gt;mainAddress&lt;&#x2F;code&gt; assets by &lt;code&gt;authAddress&lt;&#x2F;code&gt; is proven if all the following conditions are met:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;mainAddress&lt;&#x2F;code&gt; has an ENS resolver record and a reverse record set to &lt;code&gt;mainENS&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;authAddress&lt;&#x2F;code&gt; has an ENS resolver record and a reverse record set to &lt;code&gt;authENS&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;authENS&lt;&#x2F;code&gt; has an ENS TEXT record &lt;code&gt;eip5131:vault&lt;&#x2F;code&gt; in the format &lt;code&gt;&amp;lt;authKey&amp;gt;:&amp;lt;mainAddress&amp;gt;&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;mainENS&lt;&#x2F;code&gt; has an ENS TEXT record &lt;code&gt;eip5131:&amp;lt;authKey&amp;gt;&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;setting-up-one-or-many-authaddress-records-on-a-single-ens-domain&quot;&gt;Setting up one or many &lt;code&gt;authAddress&lt;&#x2F;code&gt; records on a single ENS domain&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;mainAddress&lt;&#x2F;code&gt; MUST have an ENS resolver record and reverse record configured.
In order to automatically discover the linked account, the &lt;code&gt;authAddress&lt;&#x2F;code&gt; SHOULD have an ENS resolver record and reverse record configured.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Choose an unused &lt;code&gt;&amp;lt;authKey&amp;gt;&lt;&#x2F;code&gt;. This can be any string in the format &lt;code&gt;[0-0A-Za-z]+&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Set a TEXT record &lt;code&gt;eip5131:&amp;lt;authKey&amp;gt;&lt;&#x2F;code&gt; on &lt;code&gt;mainENS&lt;&#x2F;code&gt;, with the value set to the desired &lt;code&gt;authAddress&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Set a TEXT record &lt;code&gt;eip5131:vault&lt;&#x2F;code&gt; on &lt;code&gt;authENS&lt;&#x2F;code&gt;, with the value set to the &lt;code&gt;&amp;lt;authKey&amp;gt;:mainAddress&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Currently this EIP does not enforce an upper-bound on the number of &lt;code&gt;authAddress&lt;&#x2F;code&gt; entries you can include. Users can repeat this process with as many address as they like.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;authenticating-mainaddress-via-authaddress&quot;&gt;Authenticating &lt;code&gt;mainAddress&lt;&#x2F;code&gt; via &lt;code&gt;authAddress&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Control of &lt;code&gt;mainAddress&lt;&#x2F;code&gt; and ownership of &lt;code&gt;mainAddress&lt;&#x2F;code&gt; assets is proven if any associated &lt;code&gt;authAddress&lt;&#x2F;code&gt; is the &lt;code&gt;msg.sender&lt;&#x2F;code&gt; or has signed the message.&lt;&#x2F;p&gt;
&lt;p&gt;Practically, this would work by performing the following operations:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Get the resolver for &lt;code&gt;authENS&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Get the &lt;code&gt;eip5131:vault&lt;&#x2F;code&gt; TEXT record of &lt;code&gt;authENS&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Parse &lt;code&gt;&amp;lt;authKey&amp;gt;:&amp;lt;mainAddress&amp;gt;&lt;&#x2F;code&gt; to determine the &lt;code&gt;authKey&lt;&#x2F;code&gt; and &lt;code&gt;mainAddress&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;MUST get the reverse ENS record for &lt;code&gt;mainAddress&lt;&#x2F;code&gt; and verify that it matches &lt;code&gt;&amp;lt;mainENS&amp;gt;&lt;&#x2F;code&gt;.
&lt;ul&gt;
&lt;li&gt;Otherwise one could set up other ENS nodes (with auths) that point to &lt;code&gt;mainAddress&lt;&#x2F;code&gt; and authenticate via those.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Get the &lt;code&gt;eip5131:&amp;lt;authKey&amp;gt;&lt;&#x2F;code&gt; TEXT record of &lt;code&gt;mainENS&lt;&#x2F;code&gt; and ensure it matches &lt;code&gt;authAddress&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Note that this specification allows for both contract level and client&#x2F;server side validation of signatures.  It is not limited to smart contracts, which is why there is no proposed external interface definition.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;revocation-of-authaddress&quot;&gt;Revocation of &lt;code&gt;authAddress&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;To revoke permission of &lt;code&gt;authAddress&lt;&#x2F;code&gt;, delete the &lt;code&gt;eip5131:&amp;lt;authKey&amp;gt;&lt;&#x2F;code&gt; TEXT record of &lt;code&gt;mainENS&lt;&#x2F;code&gt; or update it to point to a new &lt;code&gt;authAddress&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;usage-of-eip-137&quot;&gt;Usage of EIP-137&lt;&#x2F;h3&gt;
&lt;p&gt;The proposed specification makes use of EIP-137 rather than introduce another registry paradigm. The reason for this is due to the existing wide adoption of EIP-137 and ENS.&lt;&#x2F;p&gt;
&lt;p&gt;However, the drawback to EIP-137 is that any linked &lt;code&gt;authAddress&lt;&#x2F;code&gt; must contain some ETH in order to set the &lt;code&gt;authENS&lt;&#x2F;code&gt; reverse record as well as the &lt;code&gt;eip5131:vault&lt;&#x2F;code&gt; TEXT record. This can be solved by a separate reverse lookup registry that enables &lt;code&gt;mainAddress&lt;&#x2F;code&gt; to set the reverse record and TEXT record with a message signed by &lt;code&gt;authAddress&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;With the advent of L2s and ENS Layer 2 functionalities, off chain verification of linked addresses is possible even with domains managed across different chains.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;one-to-many-authentication-relationship&quot;&gt;One-to-Many Authentication Relationship&lt;&#x2F;h3&gt;
&lt;p&gt;This proposed specification allows for a one (&lt;code&gt;mainAddress&lt;&#x2F;code&gt;) to many (&lt;code&gt;authAddress&lt;&#x2F;code&gt;) authentication relationship.  i.e. one &lt;code&gt;mainAddress&lt;&#x2F;code&gt; can authorize many &lt;code&gt;authAddress&lt;&#x2F;code&gt; to authenticate, but an &lt;code&gt;authAddress&lt;&#x2F;code&gt; can only authenticate itself or a single &lt;code&gt;mainAddress&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The reason for this design choice is to allow for simplicity of authentication via client and smart contract code. You can determine which &lt;code&gt;mainAddress&lt;&#x2F;code&gt; the &lt;code&gt;authAddress&lt;&#x2F;code&gt; is signing for without any additional user input.&lt;&#x2F;p&gt;
&lt;p&gt;Further, you can design UX without any user interaction necessary to &#x27;pick&#x27; the interacting address by display assets owned by &lt;code&gt;authAddress&lt;&#x2F;code&gt; and &lt;code&gt;mainAddress&lt;&#x2F;code&gt; and use the appropriate address dependent on the asset the user is attempting to authenticate with.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;client-server-side&quot;&gt;Client&#x2F;Server Side&lt;&#x2F;h3&gt;
&lt;p&gt;In typescript, the validation function, using ethers.js would be as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;export interface LinkedAddress {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ens: string,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  address: string,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;export async function getLinkedAddress(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  provider: ethers.providers.EnsProvider, address: string&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;): Promise&amp;lt;LinkedAddress | null&amp;gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  const addressENS = await provider.lookupAddress(address);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  if (!addressENS) return null;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  const vaultInfo = await (await provider.getResolver(addressENS))?.getText(&amp;#39;eip5131:vault&amp;#39;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  if (!vaultInfo) return null;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  const vaultInfoArray = vaultInfo.split(&amp;#39;:&amp;#39;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  if (vaultInfoArray.length !== 2) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    throw new Error(&amp;#39;EIP5131: Authkey and vault address not configured correctly.&amp;#39;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  const [ authKey, vaultAddress ] = vaultInfoArray;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  const vaultENS = await provider.lookupAddress(vaultAddress);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  if (!vaultENS) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    throw new Error(`EIP5131: No ENS domain with reverse record set for vault.`);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  };&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  const expectedSigningAddress = await (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    await provider.getResolver(vaultENS)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )?.getText(`eip5131:${authKey}`);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  if (expectedSigningAddress?.toLowerCase() !== address.toLowerCase()) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    throw new Error(`EIP5131: Authentication mismatch.`);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  };&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  return {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ens: vaultENS,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address: vaultAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  };&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;contract-side&quot;&gt;Contract side&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;with-a-backend&quot;&gt;With a backend&lt;&#x2F;h4&gt;
&lt;p&gt;If your application operates a secure backend server, you could run the client&#x2F;server code above, then use the result in conjunction with specs like &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;EIP-1271&lt;&#x2F;a&gt; : &lt;code&gt;Standard Signature Validation Method for Contracts&lt;&#x2F;code&gt; for a cheap and secure way to validate that the message signer is indeed authenticated for the main address.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;without-a-backend-javascript-only&quot;&gt;Without a backend (JavaScript only)&lt;&#x2F;h4&gt;
&lt;p&gt;Provided is a reference implementation for an internal function to verify that the message sender has an authentication link to the main address.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; SPDX-License-Identifier: MIT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pragma solidity ^0.8.0;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @author: manifold.xyz&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * ENS Registry Interface&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;interface ENS {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function resolver(bytes32 node) external view returns (address);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * ENS Resolver Interface&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;interface Resolver {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function addr(bytes32 node) external view returns (address);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function name(bytes32 node) external view returns (string memory);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function text(bytes32 node, string calldata key) external view returns (string memory);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * Validate a signing address is associtaed with a linked address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;library LinkedAddress {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * Validate that the message sender is an authentication address for mainAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param ensRegistry    Address of ENS registry&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param mainAddress     The main address we want to authenticate for.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param mainENSNodeHash The main ENS Node Hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param authKey         The TEXT record of the authKey we are using for validation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param authENSNodeHash The auth ENS Node Hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function validateSender(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address ensRegistry,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address mainAddress,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bytes32 mainENSNodeHash,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        string calldata authKey,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bytes32 authENSNodeHash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ) internal view returns (bool) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return validate(ensRegistry, mainAddress, mainENSNodeHash, authKey, msg.sender, authENSNodeHash);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * Validate that the authAddress is an authentication address for mainAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param ensRegistry     Address of ENS registry&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param mainAddress     The main address we want to authenticate for.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param mainENSNodeHash The main ENS Node Hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param authAddress     The address of the authentication wallet&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param authENSNodeHash The auth ENS Node Hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function validate(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address ensRegistry,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address mainAddress,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bytes32 mainENSNodeHash,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        string calldata authKey,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address authAddress,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bytes32 authENSNodeHash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ) internal view returns (bool) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _verifyMainENS(ensRegistry, mainAddress, mainENSNodeHash, authKey, authAddress);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _verifyAuthENS(ensRegistry, mainAddress, authKey, authAddress, authENSNodeHash);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return true;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; *********************&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;   Helper Functions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; *********************&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function _verifyMainENS(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address ensRegistry,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address mainAddress,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bytes32 mainENSNodeHash,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        string calldata authKey,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address authAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ) private view {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &#x2F;&#x2F; Check if the ENS nodes resolve correctly to the provided addresses&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address mainResolver = ENS(ensRegistry).resolver(mainENSNodeHash);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        require(mainResolver != address(0), &amp;quot;Main ENS not registered&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        require(mainAddress == Resolver(mainResolver).addr(mainENSNodeHash), &amp;quot;Main address is wrong&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &#x2F;&#x2F; Verify the authKey TEXT record is set to authAddress by mainENS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        string memory authText = Resolver(mainResolver).text(mainENSNodeHash, string(abi.encodePacked(&amp;quot;eip5131:&amp;quot;, authKey)));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        require(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            keccak256(bytes(authText)) == keccak256(bytes(_addressToString(authAddress))),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &amp;quot;Invalid auth address&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        );&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function _verifyAuthENS(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address ensRegistry,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address mainAddress,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        string memory authKey,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address authAddress,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bytes32 authENSNodeHash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ) private view {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &#x2F;&#x2F; Check if the ENS nodes resolve correctly to the provided addresses&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address authResolver = ENS(ensRegistry).resolver(authENSNodeHash);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        require(authResolver != address(0), &amp;quot;Auth ENS not registered&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        require(authAddress == Resolver(authResolver).addr(authENSNodeHash), &amp;quot;Auth address is wrong&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &#x2F;&#x2F; Verify the TEXT record is appropriately set by authENS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        string memory vaultText = Resolver(authResolver).text(authENSNodeHash, &amp;quot;eip5131:vault&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        require(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            keccak256(abi.encodePacked(authKey, &amp;quot;:&amp;quot;, _addressToString(mainAddress))) ==&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                keccak256(bytes(vaultText)),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &amp;quot;Invalid auth text record&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        );&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytes16 private constant _HEX_SYMBOLS = &amp;quot;0123456789abcdef&amp;quot;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function sha3HexAddress(address addr) private pure returns (bytes32 ret) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 value = uint256(uint160(addr));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bytes memory buffer = new bytes(40);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        for (uint256 i = 39; i &amp;gt; 1; --i) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            buffer[i] = _HEX_SYMBOLS[value &amp;amp; 0xf];&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            value &amp;gt;&amp;gt;= 4;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return keccak256(buffer);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function _addressToString(address addr) private pure returns (string memory ptr) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &#x2F;&#x2F; solhint-disable-next-line no-inline-assembly&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        assembly {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            ptr := mload(0x40)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &#x2F;&#x2F; Adjust mem ptr and keep 32 byte aligned&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &#x2F;&#x2F; 32 bytes to store string length; address is 42 bytes long&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            mstore(0x40, add(ptr, 96))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &#x2F;&#x2F; Store (string length, &amp;#39;0&amp;#39;, &amp;#39;x&amp;#39;) (42, 48, 120)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &#x2F;&#x2F; Single write by offsetting across 32 byte boundary&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            ptr := add(ptr, 2)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            mstore(ptr, 0x2a3078)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &#x2F;&#x2F; Write string backwards&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            for {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F;&#x2F; end is at &amp;#39;x&amp;#39;, ptr is at lsb char&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                let end := add(ptr, 31)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                ptr := add(ptr, 71)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            } gt(ptr, end) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                ptr := sub(ptr, 1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                addr := shr(4, addr)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            } {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                let v := and(addr, 0xf)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F;&#x2F; if &amp;gt; 9, use ascii &amp;#39;a-f&amp;#39; (no conditional required)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                v := add(v, mul(gt(v, 9), 39))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F;&#x2F; Add ascii for &amp;#39;0&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                v := add(v, 48)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                mstore8(ptr, v)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &#x2F;&#x2F; return ptr to point to length (32 + 2 for &amp;#39;0x&amp;#39; - 1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            ptr := sub(ptr, 33)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return string(ptr);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The core purpose of this EIP is to enhance security and promote a safer way to authenticate wallet control and asset ownership when the main wallet is not needed and assets held by the main wallet do not need to be moved. Consider it a way to do &#x27;read only&#x27; authentication.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Delaying Difficulty Bomb to mid-September 2022</title>
        <published>2022-06-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Tomasz Kajetan Stanczak</name><uri>https://github.com/tkstanczak</uri>
	</author>
	
	<author>
		<name>Eric Marti Haynes</name><uri>https://github.com/ericmartihaynes</uri>
	</author>
	
	<author>
		<name>Josh Klopfenstein</name><uri>https://github.com/joshklop</uri>
	</author>
	
	<author>
		<name>Abhimanyu Nag</name><uri>https://github.com/AbhiMan1601</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5133/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5133-delaying-difficulty-bomb-to-mid-september-2022/9622" />
        

        <id>https://wg-eips.ritovision.com/5133/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:5133"
            label="EIP-5133" />
        

        
        

        
        <summary type="html">Delays the difficulty bomb by a further 700000 blocks, to the middle of September 2022.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5133/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Starting with &lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt; the client will calculate the difficulty based on a fake block number suggesting to the client that the difficulty bomb is adjusting 11,400,000 blocks later than the actual block number.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;To avoid network degradation due to a premature activation of the difficulty bomb.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h4 id=&quot;relax-difficulty-with-fake-block-number&quot;&gt;Relax Difficulty with Fake Block Number&lt;&#x2F;h4&gt;
&lt;p&gt;For the purposes of &lt;code&gt;calc_difficulty&lt;&#x2F;code&gt;, simply replace the use of &lt;code&gt;block.number&lt;&#x2F;code&gt;, as used in the exponential ice age component, with the formula:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;fake_block_number&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 11_400_000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; FORK_BLOCK_NUMBER&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The following script predicts the bomb will go off at block 15530314, which is expected to be mined around mid-September.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; math&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; predict_bomb_block&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;current_difficulty&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; diff_adjust_coeff&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; block_adjustment&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;#39;&amp;#39;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Predicts the block number at which the difficulty bomb will become noticeable.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    current_difficulty: the current difficulty&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    diff_adjust_coeff: intuitively, the percent increase in work that miners have to exert to find a PoW&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    block_adjustment: the number of blocks to delay the bomb by&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;#39;&amp;#39;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; round&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block_adjustment&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 100000&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; math&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;log2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;diff_adjust_coeff&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; current_difficulty&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2048&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; current_difficulty = 13891609586928851 (Jun 01, 2022)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; diff_adjust_coeff = 0.1 (historically, the bomb is noticeable when the coefficient is &amp;gt;= 0.1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; block_adjustment = 11400000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;print&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;predict_bomb_block&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;13891609586928851&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0.1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 11400000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Precise increases in block times are very difficult to predict (especially after the bomb is noticeable).
However, based on past manifestations of the bomb, we can anticipate 0.1s delays by mid-September and 0.6-1.2s delays by early October.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No known backward compatibility issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Misjudging the effects of the difficulty can mean longer blocktimes than anticipated until a hardfork is released. Wild shifts in difficulty can affect this number severely. Also, gradual changes in blocktimes due to longer-term adjustments in difficulty can affect the timing of difficulty bomb epochs. This affects the usability of the network but unlikely to have security ramifications.&lt;&#x2F;p&gt;
&lt;p&gt;In this specific instance, it is possible that the network hashrate drops considerably before The Merge, which could accelerate the timeline by which the bomb is felt in block times. The offset value chosen aims to take this into account.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Soulbound Badge</title>
        <published>2022-05-30T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Micah Zoltu</name><uri>https://github.com/MicahZoltu</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5114/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5114-soulbound-token/9417" />
        

        <id>https://wg-eips.ritovision.com/5114/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="last-call"
                label="Last Call" />
            
        

        
        <category
            term="tag:eip:5114"
            label="ERC-5114" />
        

        
        

        
        <summary type="html">A token that is attached to a &quot;soul&quot; at mint time and cannot be transferred after that.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5114/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;A soulbound badge is a token that, when minted, is bound to another Non-Fungible Token (NFT), and cannot be transferred&#x2F;moved after that.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5114&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; fired anytime a new instance of this badge is minted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; this event **MUST NOT** be fired twice for the same `badgeId`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; badgeId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nftAddress&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nftTokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; returns the NFT that this badge is bound to.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; this function **MUST** throw if the badge hasn&amp;#39;t been minted yet&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; this function **MUST** always return the same result every time it is called after it has been minted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; this function **MUST** return the same value as found in the original `Mint` event for the badge&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; badgeId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nftAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nftTokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; returns a URI with details about this badge collection&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the metadata returned by this is merged with the metadata return by `badgeUri(uint256)`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the collectionUri **MUST** be immutable (e.g., ipfs:&#x2F;&#x2F; and not http:&#x2F;&#x2F;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the collectionUri **MUST** be content addressable (e.g., ipfs:&#x2F;&#x2F; and not http:&#x2F;&#x2F;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; data from `badgeUri` takes precedence over data returned by this method&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; any external links referenced by the content at `collectionUri` also **MUST** follow all of the above rules&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; collectionUri&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collectionUri&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; returns a censorship resistant URI with details about this badge instance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the collectionUri **MUST** be immutable (e.g., ipfs:&#x2F;&#x2F; and not http:&#x2F;&#x2F;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the collectionUri **MUST** be content addressable (e.g., ipfs:&#x2F;&#x2F; and not http:&#x2F;&#x2F;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; data from this takes precedence over data returned by `collectionUri`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; any external links referenced by the content at `badgeUri` also **MUST** follow all of the above rules&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; badgeUri&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; badgeId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; badgeUri&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; returns a string that indicates the format of the `badgeUri` and `collectionUri` results (e.g., &amp;#39;EIP-ABCD&amp;#39; or &amp;#39;soulbound-schema-version-4&amp;#39;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; metadataFormat&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; format&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Implementers of this standard &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; also depend on a standard for interface detection so callers can easily find out if a given contract implements this interface.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;immutability&quot;&gt;Immutability&lt;&#x2F;h3&gt;
&lt;p&gt;By requiring that badges can never move, we both guarantee non-separability and non-mergeability among collections of soulbound badges that are bound to a single NFT while simultaneously allowing users to aggressively cache results.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;content-addressable-uris-required&quot;&gt;Content Addressable URIs Required&lt;&#x2F;h3&gt;
&lt;p&gt;Soulbound badges are meant to be permanent badges&#x2F;indicators attached to a persona.
This means that not only can the user not transfer ownership, but the minter also cannot withdraw&#x2F;transfer&#x2F;change ownership as well.
This includes mutating or removing any remote content as a means of censoring or manipulating specific users.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;no-specification-for-badgeuri-data-format&quot;&gt;No Specification for &lt;code&gt;badgeUri&lt;&#x2F;code&gt; Data Format&lt;&#x2F;h3&gt;
&lt;p&gt;The format of the data pointed to by &lt;code&gt;collectionUri()&lt;&#x2F;code&gt; and &lt;code&gt;badgeUri(uint256)&lt;&#x2F;code&gt;, and how to merge them, is intentionally left out of this standard in favor of separate standards that can be iterated on in the future.
The immutability constraints are the only thing defined by this to ensure that the spirit of this badge is maintained, regardless of the specifics of the data format.
The &lt;code&gt;metadataFormat&lt;&#x2F;code&gt; function can be used to inform a caller what type&#x2F;format&#x2F;version of data they should expect at the URIs, so the caller can parse the data directly without first having to deduce its format via inspection.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This is a new token type and is not meant to be backward compatible with any existing tokens other than existing viable souls (any asset that can be identified by &lt;code&gt;[address,id]&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Users of badges that claim to implement this EIP must be diligent in verifying they actually do.
A badge author can create a badge that, upon initial probing of the API surface, may appear to follow the rules when in reality it doesn&#x27;t.
For example, the contract could allow transfers via some mechanism and simply not utilize them initially.&lt;&#x2F;p&gt;
&lt;p&gt;It should also be made clear that soulbound badges are not bound to a human, they are bound to a persona.
A persona is any actor (which could be a group of humans) that collects multiple soulbound badges over time to build up a collection of badges.
This persona may transfer to another human, or to another group of humans, and anyone interacting with a persona should not assume that there is a single permanent human behind that persona.&lt;&#x2F;p&gt;
&lt;p&gt;It is possible for a soulbound badge to be bound to another soulbound badge.
In theory, if all badges in the chain are created at the same time they could form a loop.
Software that tries to walk such a chain should take care to have an exit strategy if a loop is detected.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>SY Token</title>
        <published>2022-05-30T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Vu Nguyen</name><uri>https://github.com/mrenoon</uri>
	</author>
	
	<author>
		<name>Long Vuong</name><uri>https://github.com/UncleGrandpa925</uri>
	</author>
	
	<author>
		<name>Anton Buenavista</name><uri>https://github.com/ayobuenavista</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5115/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5115-super-composable-yield-token-standard/9423" />
        

        <id>https://wg-eips.ritovision.com/5115/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:5115"
            label="ERC-5115" />
        

        
        

        
        <summary type="html">Interface for wrapped yield-bearing tokens.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5115/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard proposes an API for wrapped yield-bearing tokens within smart contracts. It is an extension on the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; token that provides basic functionality for transferring, depositing, withdrawing tokens, as well as reading balances.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Yield generating mechanisms are built in all shapes and sizes, necessitating a manual integration every time a protocol builds on top of another protocol’s yield generating mechanism.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4626&#x2F;&quot;&gt;ERC-4626&lt;&#x2F;a&gt; tackled a significant part of this fragmentation by standardizing the interfaces for vaults, a major category among various yield generating mechanisms.&lt;&#x2F;p&gt;
&lt;p&gt;In this ERC, we’re extending the coverage to include assets beyond ERC-4626’s reach, namely:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;yield-bearing assets that have different input tokens used for minting vs accounting for the pool value.
&lt;ul&gt;
&lt;li&gt;This category includes AMM liquidity tokens (which are yield-bearing assets that yield swap fees) since the value of the pool is measured in “liquidity units” (for example, $\sqrt k$ in UniswapV2, as defined in UniswapV2 whitepaper) which can’t be deposited in (as they are not tokens).&lt;&#x2F;li&gt;
&lt;li&gt;This extends the flexibility in minting the yield-bearing assets. For example, there could be an ETH vault that wants to allow users to deposit cETH directly instead of ETH, for gas efficiency or UX reasons.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Assets with reward tokens by default (e.g. COMP rewards for supplying in Compound). The reward tokens are expected to be sold to compound into the same asset.&lt;&#x2F;li&gt;
&lt;li&gt;This ERC can be extended further to include the handling of rewards, such as the claiming of accrued multiple rewards tokens.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;While ERC-4626 is a well-designed and suitable standard for most vaults, there will inevitably be some yield generating mechanisms that do not fit into their category (LP tokens for instance). A more flexible standard is required to standardize the interaction with all types of yield generating mechanisms.&lt;&#x2F;p&gt;
&lt;p&gt;Therefore, we are proposing Standardized Yield (SY), a flexible standard for wrapped yield-bearing tokens that could cover most mechanisms in DeFi. We foresee that:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;ERC-4626 will still be a popular vault standard, that most vaults should adopt.&lt;&#x2F;li&gt;
&lt;li&gt;SY tokens can wrap over most yield generating mechanisms in DeFi, including ERC-4626 vaults for projects built on top of yield-bearing tokens.&lt;&#x2F;li&gt;
&lt;li&gt;Whoever needs the functionalities of SY could integrate with the existing SY tokens or write a new SY (to wrap over the target yield-bearing token).&lt;&#x2F;li&gt;
&lt;li&gt;Reward handling can be extended from the SY token.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;use-cases&quot;&gt;Use Cases&lt;&#x2F;h3&gt;
&lt;p&gt;This ERC is designed for flexibility, aiming to accommodate as many yield generating mechanisms as possible. Particularly, this standard aims to be generalized enough that it supports the following use cases and more:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Money market supply positions
&lt;ul&gt;
&lt;li&gt;Lending DAI in Compound, getting DAI interests and COMP rewards&lt;&#x2F;li&gt;
&lt;li&gt;Lending ETH in BenQi, getting ETH interests and QI + AVAX rewards&lt;&#x2F;li&gt;
&lt;li&gt;Lending USDC in Aave, getting USDC interests and stkAAVE rewards&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;AMM liquidity provision
&lt;ul&gt;
&lt;li&gt;Provide ETH + USDC to ETHUSDC pool in SushiSwap, getting swap fees in more ETH+USDC&lt;&#x2F;li&gt;
&lt;li&gt;Provide ETH + USDC to ETHUSDC pool in SushiSwap and stake it in Sushi Onsen, getting swap fees and SUSHI rewards&lt;&#x2F;li&gt;
&lt;li&gt;Provide USDC+DAI+USDT to 3crv pool and stake it in Convex, getting 3crv swap fees and CRV + CVX rewards&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Vault positions
&lt;ul&gt;
&lt;li&gt;Provide ETH into Yearn ERC-4626 vault, where the vault accrues yield from Yearn’s ETH strategy&lt;&#x2F;li&gt;
&lt;li&gt;Provide DAI into Harvest and staking it, getting DAI interests and FARM rewards&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Liquid staking positions
&lt;ul&gt;
&lt;li&gt;Holding stETH (in Lido), getting yields in more stETH&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Liquidity mining programs
&lt;ul&gt;
&lt;li&gt;Provide USDC in Stargate, getting STG rewards&lt;&#x2F;li&gt;
&lt;li&gt;Provide LOOKS in LooksRare, getting LOOKS yield and WETH rewards&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Rebasing tokens
&lt;ul&gt;
&lt;li&gt;Stake OHM into sOHM&#x2F;gOHM, getting OHM rebase yield&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The ERC hopes to minimize, if not possibly eliminate, the use of customized adapters in order to interact with many different forms of yield-bearing token mechanisms.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;generic-yield-generating-pool&quot;&gt;Generic Yield Generating Pool&lt;&#x2F;h3&gt;
&lt;p&gt;We will first introduce Generic Yield Generating Pool (GYGP), a model to describe most yield generating mechanisms in DeFi. In every yield generating mechanism, there is a pool of funds, whose value is measured in &lt;strong&gt;assets&lt;&#x2F;strong&gt;. There are a number of users who contribute liquidity to the pool, in exchange for &lt;strong&gt;shares&lt;&#x2F;strong&gt; of the pool, which represents units of ownership of the pool. Over time, the value (measured in &lt;strong&gt;assets&lt;&#x2F;strong&gt;) of the pool grows, such that each &lt;strong&gt;share&lt;&#x2F;strong&gt; is worth more &lt;strong&gt;assets&lt;&#x2F;strong&gt; over time. The pool could earn a number of &lt;strong&gt;reward tokens&lt;&#x2F;strong&gt; over time, which are distributed to the users according to some logic (for example, proportionally the number of &lt;strong&gt;shares&lt;&#x2F;strong&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;Here are the more concrete definitions of the terms:&lt;&#x2F;p&gt;
&lt;h4 id=&quot;gygp-definitions&quot;&gt;GYGP Definitions:&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;asset&lt;&#x2F;strong&gt;: Is a unit to measure the value of the pool. At time &lt;em&gt;t&lt;&#x2F;em&gt;, the pool has a total value of &lt;em&gt;TotalAsset(t)&lt;&#x2F;em&gt; &lt;strong&gt;assets&lt;&#x2F;strong&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;shares&lt;&#x2F;strong&gt;: Is a unit that represents ownership of the pool. At time &lt;em&gt;t&lt;&#x2F;em&gt;, there are &lt;em&gt;TotalShares(t)&lt;&#x2F;em&gt; &lt;strong&gt;shares&lt;&#x2F;strong&gt; in total.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;reward tokens&lt;&#x2F;strong&gt;: Over time, the pool earns $n_{rewards}$ types of reward tokens $(n_{rewards} \ge 0)$. At time &lt;em&gt;t&lt;&#x2F;em&gt;, $TotalRewards_i(t)$ is the amount of &lt;strong&gt;reward token &lt;em&gt;i&lt;&#x2F;em&gt;&lt;&#x2F;strong&gt; that has accumulated for the pool up until time &lt;em&gt;t&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;exchange rate&lt;&#x2F;strong&gt;: At time &lt;em&gt;t&lt;&#x2F;em&gt;, the &lt;strong&gt;exchange rate&lt;&#x2F;strong&gt; &lt;em&gt;ExchangeRate(t)&lt;&#x2F;em&gt; is simply how many &lt;strong&gt;assets&lt;&#x2F;strong&gt; each &lt;strong&gt;shares&lt;&#x2F;strong&gt; is worth $ExchangeRate(t) = \frac{TotalAsset(t)}{TotalShares(t)}$&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;users&lt;&#x2F;strong&gt;: At time &lt;em&gt;t&lt;&#x2F;em&gt;, each user &lt;em&gt;u&lt;&#x2F;em&gt; has $shares_u(t)$ &lt;strong&gt;shares&lt;&#x2F;strong&gt; in the pool, which is worth $asset_u(t) = shares_u(t) \cdot ExchangeRate(t)$  &lt;strong&gt;assets&lt;&#x2F;strong&gt;. Until time &lt;em&gt;t&lt;&#x2F;em&gt;, user &lt;em&gt;u&lt;&#x2F;em&gt; is entitled to receive a total of $rewards_{u_i}(t)$ &lt;strong&gt;reward token &lt;em&gt;i&lt;&#x2F;em&gt;&lt;&#x2F;strong&gt;. The sum of all users’ shares, assets and rewards should be the same as the total shares, assets and rewards of the whole pool.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;state-changes&quot;&gt;State changes:&lt;&#x2F;h4&gt;
&lt;ol&gt;
&lt;li&gt;A user deposits $d_a$ &lt;strong&gt;assets&lt;&#x2F;strong&gt; into the pool at time $t$ ($d_a$ could be negative, which means a withdraw from the pool). $d_s = d_a &#x2F; ExchangeRate(t)$ new &lt;strong&gt;shares&lt;&#x2F;strong&gt; will be created and given
to user (or removed and burned from the user when $d_a$ is negative).&lt;&#x2F;li&gt;
&lt;li&gt;The pool earns $d_a$ (or loses $−d_a$ if $d_a$ is negative) &lt;strong&gt;assets&lt;&#x2F;strong&gt; at time $t$. The &lt;strong&gt;exchange rate&lt;&#x2F;strong&gt; simply increases (or decreases if $d_a$ is negative) due to the additional assets.&lt;&#x2F;li&gt;
&lt;li&gt;The pool earns $d_r$ &lt;strong&gt;reward token&lt;&#x2F;strong&gt; $i$. Every user will receive a certain amount of &lt;strong&gt;reward token&lt;&#x2F;strong&gt; $i$.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h4 id=&quot;examples-of-gygps-in-defi&quot;&gt;Examples of GYGPs in DeFi:&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Yield generating mechanism&lt;&#x2F;th&gt;&lt;th&gt;Asset&lt;&#x2F;th&gt;&lt;th&gt;Shares&lt;&#x2F;th&gt;&lt;th&gt;Reward tokens&lt;&#x2F;th&gt;&lt;th&gt;Exchange rate&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Supply USDC in Compound&lt;&#x2F;td&gt;&lt;td&gt;USDC&lt;&#x2F;td&gt;&lt;td&gt;cUSDC&lt;&#x2F;td&gt;&lt;td&gt;COMP&lt;&#x2F;td&gt;&lt;td&gt;USDC value per cUSDC, increases with USDC supply interests&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;ETH liquid staking in Lido&lt;&#x2F;td&gt;&lt;td&gt;stETH&lt;&#x2F;td&gt;&lt;td&gt;wstETH&lt;&#x2F;td&gt;&lt;td&gt;None&lt;&#x2F;td&gt;&lt;td&gt;stETH value per wstETH, increases with ETH staking rewards&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Stake LOOKS in LooksRare Compounder&lt;&#x2F;td&gt;&lt;td&gt;LOOKS&lt;&#x2F;td&gt;&lt;td&gt;shares (in contract)&lt;&#x2F;td&gt;&lt;td&gt;WETH&lt;&#x2F;td&gt;&lt;td&gt;LOOKS value per shares, increases with LOOKS rewards&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Stake APE in $APE Compounder&lt;&#x2F;td&gt;&lt;td&gt;sAPE&lt;&#x2F;td&gt;&lt;td&gt;shares (in contract)&lt;&#x2F;td&gt;&lt;td&gt;APE&lt;&#x2F;td&gt;&lt;td&gt;sAPE value per shares, increases with APE rewards&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Provide ETH+USDC liquidity on Sushiswap&lt;&#x2F;td&gt;&lt;td&gt;ETHUSDC liquidity (a pool of x ETH + y USDC has sqrt(xy) ETHUSDC liquidity)&lt;&#x2F;td&gt;&lt;td&gt;ETHUSDC Sushiswap LP (SLP) token&lt;&#x2F;td&gt;&lt;td&gt;None&lt;&#x2F;td&gt;&lt;td&gt;ETHUSDC liquidity value per ETHUSDC SLP, increases due to swap fees&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Provide ETH+USDC liquidity on Sushiswap and stake into Onsen&lt;&#x2F;td&gt;&lt;td&gt;ETHUSDC liquidity (a pool of x ETH + y USDC has sqrt(xy) ETHUSDC liquidity)&lt;&#x2F;td&gt;&lt;td&gt;ETHUSDC Sushiswap LP (SLP) token&lt;&#x2F;td&gt;&lt;td&gt;SUSHI&lt;&#x2F;td&gt;&lt;td&gt;ETHUSDC liquidity value per ETHUSDC SLP, increases due to swap fees&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Provide BAL+WETH liquidity in Balancer (80% BAL, 20% WETH)&lt;&#x2F;td&gt;&lt;td&gt;BALWETH liquidity (a pool of x BAL + y WETH has x^0.8*y^0.2 BALWETH liquidity)&lt;&#x2F;td&gt;&lt;td&gt;BALWETH Balancer LP token&lt;&#x2F;td&gt;&lt;td&gt;None&lt;&#x2F;td&gt;&lt;td&gt;BALWETH liquidity per BALWETH Balancer LP token, increases due to swap fees&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Provide USDC+USDT+DAI liquidity in Curve&lt;&#x2F;td&gt;&lt;td&gt;3crv pool’s liquidity (amount of D per 3crv token)&lt;&#x2F;td&gt;&lt;td&gt;3crv token&lt;&#x2F;td&gt;&lt;td&gt;CRV&lt;&#x2F;td&gt;&lt;td&gt;3crv pool’s liquidity per 3crv token, increases due to swap fees&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Provide FRAX+USDC liquidity in Curve then stake LP in Convex&lt;&#x2F;td&gt;&lt;td&gt;BALWETH liquidity (a pool of x BAL + y WETH has x^0.8*y^0.2 BALWETH liquidity)&lt;&#x2F;td&gt;&lt;td&gt;BALWETH Balancer LP token&lt;&#x2F;td&gt;&lt;td&gt;None&lt;&#x2F;td&gt;&lt;td&gt;BALWETH liquidity per BALWETH Balancer LP token, increases due to swap fees&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;standardized-yield-token-standard&quot;&gt;Standardized Yield Token Standard&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;overview&quot;&gt;Overview:&lt;&#x2F;h4&gt;
&lt;p&gt;Standardized Yield (SY) is a token standard for any yield generating mechanism that conforms to the GYGP model. Each SY token represents &lt;strong&gt;shares&lt;&#x2F;strong&gt; in a GYGP and allows for interacting with the GYGP via a standard interface.&lt;&#x2F;p&gt;
&lt;p&gt;All SY tokens:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;MUST&lt;&#x2F;strong&gt; implement &lt;strong&gt;&lt;code&gt;ERC-20&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; to represent shares in the underlying GYGP.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;MUST&lt;&#x2F;strong&gt; implement ERC-20’s optional metadata extensions &lt;code&gt;name&lt;&#x2F;code&gt;, &lt;code&gt;symbol&lt;&#x2F;code&gt;, and &lt;code&gt;decimals&lt;&#x2F;code&gt;, which &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; reflect the underlying GYGP’s accounting asset’s &lt;code&gt;name&lt;&#x2F;code&gt;, &lt;code&gt;symbol&lt;&#x2F;code&gt;, and &lt;code&gt;decimals&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;MAY&lt;&#x2F;strong&gt; implement &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2612&#x2F;&quot;&gt;ERC-2612&lt;&#x2F;a&gt; to improve the UX of approving SY tokens on various integrations.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;MAY&lt;&#x2F;strong&gt; revert on calls to &lt;code&gt;transfer&lt;&#x2F;code&gt; and &lt;code&gt;transferFrom&lt;&#x2F;code&gt; if a SY token is to be non-transferable.&lt;&#x2F;li&gt;
&lt;li&gt;The ERC-20 operations &lt;code&gt;balanceOf&lt;&#x2F;code&gt;, &lt;code&gt;transfer&lt;&#x2F;code&gt;, &lt;code&gt;totalSupply&lt;&#x2F;code&gt;, etc. &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; operate on the GYGP “shares”, which represent a claim to ownership on a fraction of the GYGP’s underlying holdings.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;sy-definitions&quot;&gt;SY Definitions:&lt;&#x2F;h4&gt;
&lt;p&gt;On top of the definitions above for GYGPs, we need to define 2 more concepts:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;input tokens&lt;&#x2F;strong&gt;: Are tokens that can be converted into assets to enter the pool. Each SY can accept several possible input tokens $tokens_{in_{i}}$&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;output tokens&lt;&#x2F;strong&gt;: Are tokens that can be redeemed from assets when exiting the pool. Each SY can have several possible output tokens $tokens_{out_{i}}$&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;interface&quot;&gt;Interface&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IStandardizedYield&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Deposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; caller&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; receiver&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIn&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amountDeposited&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amountSyOut&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Redeem&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; caller&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; receiver&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenOut&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amountSyToRedeem&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amountTokenOut&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; deposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; receiver&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIn&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amountTokenToDeposit&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; minSharesOut&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; depositFromInternalBalance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amountSharesOut&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; redeem&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; receiver&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amountSharesToRedeem&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenOut&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; minTokenOut&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; burnFromInternalBalance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amountTokenOut&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; exchangeRate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; res&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getTokensIn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; res&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getTokensOut&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; res&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; yieldToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; previewDeposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIn&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amountTokenToDeposit&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amountSharesOut&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; previewRedeem&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenOut&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amountSharesToRedeem&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amountTokenOut&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; symbol&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; decimals&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;methods&quot;&gt;Methods&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; deposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; receiver&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIn&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amountTokenToDeposit&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; minSharesOut&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; depositFromInternalBalance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amountSharesOut&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This function will deposit &lt;em&gt;amountTokenToDeposit&lt;&#x2F;em&gt; of input token $i$ (&lt;em&gt;tokenIn&lt;&#x2F;em&gt;) to mint new SY shares.&lt;&#x2F;p&gt;
&lt;p&gt;If &lt;em&gt;depositFromInternalBalance&lt;&#x2F;em&gt; is set to &lt;em&gt;false&lt;&#x2F;em&gt;, msg.sender will need to initially deposit &lt;em&gt;amountTokenToDeposit&lt;&#x2F;em&gt; of input token $i$ (&lt;em&gt;tokenIn&lt;&#x2F;em&gt;) into the SY contract, then this function will convert the &lt;em&gt;amountTokenToDeposit&lt;&#x2F;em&gt; of input token $i$ into $d_a$ worth of &lt;strong&gt;asset&lt;&#x2F;strong&gt; and deposit this amount into the pool for the &lt;em&gt;receiver&lt;&#x2F;em&gt;, who will receive &lt;em&gt;amountSharesOut&lt;&#x2F;em&gt; of SY tokens (&lt;strong&gt;shares&lt;&#x2F;strong&gt;). If &lt;em&gt;depositFromInternalBalance&lt;&#x2F;em&gt; is set to &lt;em&gt;true&lt;&#x2F;em&gt;, then &lt;em&gt;amountTokenToDeposit&lt;&#x2F;em&gt; of input token $i$ (&lt;em&gt;tokenIn&lt;&#x2F;em&gt;) will be taken from receiver directly (as msg.sender), and will be converted and shares returned to the receiver similarly to the first case.&lt;&#x2F;p&gt;
&lt;p&gt;This function should revert if $amountSharesOut \lt minSharesOut$.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;MUST&lt;&#x2F;strong&gt; emit the &lt;code&gt;Deposit&lt;&#x2F;code&gt; event.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;MUST&lt;&#x2F;strong&gt; support ERC-20’s &lt;code&gt;approve&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;transferFrom&lt;&#x2F;code&gt; flow where &lt;code&gt;tokenIn&lt;&#x2F;code&gt; are taken from receiver directly (as msg.sender) or if the msg.sender has ERC-20 approved allowance over the input token of the receiver.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;MUST&lt;&#x2F;strong&gt; revert if $amountSharesOut \lt minSharesOut$ (due to deposit limit being reached, slippage, or the user not approving enough &lt;code&gt;tokenIn&lt;&#x2F;code&gt; **to the SY contract, etc).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;MAY&lt;&#x2F;strong&gt; be payable if the &lt;code&gt;tokenIn&lt;&#x2F;code&gt; depositing asset is the chain&#x27;s native currency (e.g. ETH).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; redeem&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; receiver&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amountSharesToRedeem&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenOut&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; minTokenOut&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; burnFromInternalBalance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amountTokenOut&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This function will redeem the $d_s$ shares, which is equivalent to $d_a = d_s \times ExchangeRate(t)$ assets, from the pool. The $d_a$ assets is converted into exactly &lt;em&gt;amountTokenOut&lt;&#x2F;em&gt; of output token $i$ (&lt;em&gt;tokenOut&lt;&#x2F;em&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;If &lt;em&gt;burnFromInternalBalance&lt;&#x2F;em&gt; is set to &lt;em&gt;false&lt;&#x2F;em&gt;, the user will need to initially deposit &lt;em&gt;amountSharesToRedeem&lt;&#x2F;em&gt; into the SY contract, then this function will burn the floating amount $d_s$ of SY tokens (&lt;strong&gt;shares&lt;&#x2F;strong&gt;) in the SY contract to redeem to output token $i$ (&lt;em&gt;tokenOut&lt;&#x2F;em&gt;). This pattern is similar to UniswapV2 which allows for more gas efficient ways to interact with the contract. If &lt;em&gt;burnFromInternalBalance&lt;&#x2F;em&gt; is set to &lt;em&gt;true&lt;&#x2F;em&gt;, then this function will burn &lt;em&gt;amountSharesToRedeem&lt;&#x2F;em&gt; $d_s$ of SY tokens directly from the user to redeem to output token $i$ (&lt;em&gt;tokenOut&lt;&#x2F;em&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;This function should revert if $amountTokenOut \lt minTokenOut$.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;MUST&lt;&#x2F;strong&gt; emit the &lt;code&gt;Redeem&lt;&#x2F;code&gt; event.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;MUST&lt;&#x2F;strong&gt; support ERC-20’s &lt;code&gt;approve&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;transferFrom&lt;&#x2F;code&gt; flow where the shares are burned from receiver directly (as msg.sender) or if the msg.sender has ERC-20 approved allowance over the shares of the receiver.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;MUST&lt;&#x2F;strong&gt; revert if $amountTokenOut \lt minTokenOut$ (due to redeem limit being reached, slippage, or the user not approving enough &lt;code&gt;amountSharesToRedeem&lt;&#x2F;code&gt; to the SY contract, etc).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; exchangeRate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; res&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This method updates and returns the latest &lt;strong&gt;exchange rate&lt;&#x2F;strong&gt;, which is the &lt;strong&gt;exchange rate&lt;&#x2F;strong&gt; from SY token amount into asset amount, scaled by a fixed scaling factor of 1e18.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;MUST&lt;&#x2F;strong&gt; return $ExchangeRate(t_{now})$ such that $ExchangeRate(t_{now}) \times syBalance &#x2F; 1e18 = assetBalance$.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; include fees that are charged against the underlying yield token in the SY contract.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getTokensIn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; res&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This read-only method returns the list of all input tokens that can be used to deposit into the SY contract.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;MUST&lt;&#x2F;strong&gt; return ERC-20 token addresses.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;MUST&lt;&#x2F;strong&gt; return at least one address.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; revert.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getTokensOut&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; res&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This read-only method returns the list of all output tokens that can be converted into when exiting the SY contract.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;MUST&lt;&#x2F;strong&gt; return ERC-20 token addresses.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;MUST&lt;&#x2F;strong&gt; return at least one address.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; revert.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; yieldToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This read-only method returns the underlying yield-bearing token (representing a GYGP) address.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;MUST&lt;&#x2F;strong&gt; return a token address that conforms to the ERC-20 interface, or zero address&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; revert.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;MUST&lt;&#x2F;strong&gt; reflect the exact underlying yield-bearing token address if the SY token is a wrapped token.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;MAY&lt;&#x2F;strong&gt; return 0x or zero address if the SY token is natively implemented, and not from wrapping.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; previewDeposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIn&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amountTokenToDeposit&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amountSharesOut&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This read-only method returns the amount of shares that a user would have received if they deposit &lt;em&gt;amountTokenToDeposit&lt;&#x2F;em&gt; of &lt;em&gt;tokenIn&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;MUST&lt;&#x2F;strong&gt; return less than or equal of &lt;em&gt;amountSharesOut&lt;&#x2F;em&gt; to the actual return value of the &lt;code&gt;deposit&lt;&#x2F;code&gt; method, and &lt;strong&gt;SHOULD NOT&lt;&#x2F;strong&gt; return greater than the actual return value of the &lt;code&gt;deposit&lt;&#x2F;code&gt; method.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;SHOULD ONLY&lt;&#x2F;strong&gt; revert if minting SY token with the entered parameters is forbidden (e.g. exceeding supply cap).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; previewRedeem&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenOut&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amountSharesToRedeem&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amountTokenOut&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This read-only method returns the amount of &lt;em&gt;tokenOut&lt;&#x2F;em&gt; that a user would have received if they redeem &lt;em&gt;amountSharesToRedeem&lt;&#x2F;em&gt; of &lt;em&gt;tokenOut&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;MUST&lt;&#x2F;strong&gt; return less than or equal of &lt;em&gt;amountTokenOut&lt;&#x2F;em&gt; to the actual return value of the &lt;code&gt;redeem&lt;&#x2F;code&gt; method, and &lt;strong&gt;SHOULD NOT&lt;&#x2F;strong&gt; return greater than the actual return value of the &lt;code&gt;redeem&lt;&#x2F;code&gt; method.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;SHOULD ONLY&lt;&#x2F;strong&gt; revert if burning SY token with the entered parameters is forbidden.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;events&quot;&gt;Events&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Deposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; caller&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; receiver&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIn&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amountDeposited&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amountSyOut&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;caller&lt;&#x2F;code&gt; has converted exact &lt;em&gt;tokenIn&lt;&#x2F;em&gt; tokens into SY (shares) and transferred those SY to &lt;code&gt;receiver&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;MUST&lt;&#x2F;strong&gt; be emitted when input tokens are deposited into the SY contract via &lt;code&gt;deposit&lt;&#x2F;code&gt; method.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Redeem&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; caller&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; receiver&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenOut&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amountSyToRedeem&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amountTokenOut&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;caller&lt;&#x2F;code&gt; has converted exact SY (shares) into input tokens and transferred those input tokens to &lt;code&gt;receiver&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;MUST&lt;&#x2F;strong&gt; be emitted when input tokens are redeemed from the SY contract via &lt;code&gt;redeem&lt;&#x2F;code&gt; method.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;&quot;SY&quot; Word Choice:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&quot;SY&quot; (pronunciation: &lt;em&gt;&#x2F;sʌɪ&#x2F;&lt;&#x2F;em&gt;), an abbreviation of Standardized Yield, was found to be appropriate to describe a broad universe of standardized composable yield-bearing digital assets.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; is enforced because implementation details such as transfer, token approvals, and balance calculation directly carry over to the SY tokens. This standardization makes the SY tokens immediately compatible with all ERC-20 use cases.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; can optionally be implemented should you want integrations to detect the IStandardizedYield interface implementation.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2612&#x2F;&quot;&gt;ERC-2612&lt;&#x2F;a&gt; can optionally be implemented in order to improve the UX of approving SY tokens on various integrations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC is fully backwards compatible as its implementation extends the functionality of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;, however the optional metadata extensions, namely &lt;code&gt;name&lt;&#x2F;code&gt;, &lt;code&gt;decimals&lt;&#x2F;code&gt;, and &lt;code&gt;symbol&lt;&#x2F;code&gt; semantics MUST be implemented for all SY token implementations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Malicious implementations which conform to the interface can put users at risk. It is recommended that all integrators (such as wallets, aggregators, or other smart contract protocols) review the implementation to avoid possible exploits and users losing funds.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;yieldToken&lt;&#x2F;code&gt; must strongly reflect the address of the underlying wrapped yield-bearing token. For a native implementation wherein the SY token does not wrap a yield-bearing token, but natively represents a GYGP share, then the address returned MAY be a zero address. Otherwise, for wrapped tokens, you may introduce confusion on what the SY token represents, or may be deemed malicious.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>URL Format for Ethereum Network Switching</title>
        <published>2022-05-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Luc van Kampen</name><uri>https://github.com/lucemans</uri>
	</author>
	
	<author>
		<name>Jakob Helgesson</name><uri>https://github.com/svemat01</uri>
	</author>
	
	<author>
		<name>Joshua Hendrix</name><uri>https://github.com/thejoshuahendrix</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5094/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/5094-uri-format-for-ethereum-network-switching/9277" />
        

        <id>https://wg-eips.ritovision.com/5094/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:5094"
            label="ERC-5094" />
        

        
        

        
        <summary type="html">A way of representing various network configurations as URLs.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5094/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard includes all needed information for adding a network to a wallet via URL, by including parameters such as &lt;code&gt;chainId&lt;&#x2F;code&gt;, &lt;code&gt;rpc_url&lt;&#x2F;code&gt;, &lt;code&gt;chain_name&lt;&#x2F;code&gt; and others, such that the network configuration is provided through the URL itself.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;As observed with the use of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;681&#x2F;&quot;&gt;EIP-681&lt;&#x2F;a&gt; and its implementation in current mobile wallets, transactions can be made, approved, viewed, and used. However, if the wallet is instructed to perform a transaction on a chain they have not yet been configured before, the operation tends to fail.&lt;&#x2F;p&gt;
&lt;p&gt;This is understandable, as the &lt;code&gt;chain_id&lt;&#x2F;code&gt; provided makes up only one part of what is required to connect to a network. This EIP aims to introduce a new type of URL for usage with deep-linking, QR, and more, to allow users to seamlessly add new networks to their (for ex. mobile) wallet to then be able to more easily partake in &lt;code&gt;pay-&lt;&#x2F;code&gt;, &lt;code&gt;tx-&lt;&#x2F;code&gt;, or other Ethereum URL interactions.&lt;&#x2F;p&gt;
&lt;p&gt;As an extension to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;831&#x2F;&quot;&gt;EIP-831&lt;&#x2F;a&gt; and neighboring &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;681&#x2F;&quot;&gt;EIP-681&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2400&#x2F;&quot;&gt;EIP-2400&lt;&#x2F;a&gt;, this document aims to standardize the addition of new networks and switching thereof through the means of URLs. User convenience in this case is primary.&lt;&#x2F;p&gt;
&lt;p&gt;Introduction of this EIP is meant to bridge to a safer RPC listing system to be introduced in the near future.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;syntax&quot;&gt;Syntax&lt;&#x2F;h3&gt;
&lt;p&gt;Network Switching URLs contain &quot;ethereum&quot; in their schema (protocol) part and are constructed as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;ABNF&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;network_add             =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; erc831&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;part&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;add&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; chain&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ]&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; parameters&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;erc831_part             =&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ethereum:network-&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;chain_id                =&lt;&#x2F;span&gt;&lt;span&gt; 1*&lt;&#x2F;span&gt;&lt;span&gt;DIGIT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;parameters              =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; parameter&lt;&#x2F;span&gt;&lt;span&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; parameter&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;parameter               =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;key                     =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; required&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;keys&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; optional&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;keys&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;required_keys           =&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;rpc_url&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;chain_name&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;optional_keys           =&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;symbol&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;decimals&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;explorer_url&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;icon_url&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;value                   =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; STRING&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; number&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;number                  =&lt;&#x2F;span&gt;&lt;span&gt; 1*&lt;&#x2F;span&gt;&lt;span&gt;DIGIT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;STRING&lt;&#x2F;code&gt; is a URL-encoded Unicode string of arbitrary length, where delimiters and the
percentage symbol (&lt;code&gt;%&lt;&#x2F;code&gt;) are mandatorily hex-encoded with a &lt;code&gt;%&lt;&#x2F;code&gt; prefix.&lt;&#x2F;p&gt;
&lt;p&gt;If the &lt;em&gt;key&lt;&#x2F;em&gt; in the parameter is &lt;code&gt;decimals&lt;&#x2F;code&gt; the &lt;em&gt;value&lt;&#x2F;em&gt; MUST be a &lt;code&gt;number&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;semantics&quot;&gt;Semantics&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;chain_id&lt;&#x2F;code&gt; is mandatory and denotes the decimal chain ID, such that we have the identifier of the network we would like to add.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;rpc_url&lt;&#x2F;code&gt; is represented as an array of RPC URLs. A minimum of 1 &lt;code&gt;rpc_url&lt;&#x2F;code&gt; MUST be present, in the format of &lt;code&gt;rpc_url=https%3A%2F%2Fpolygon-rpc.com&lt;&#x2F;code&gt;, or when multiple present &lt;code&gt;rpc_url=https%3A%2F%2Fpolygon-rpc.com&amp;amp;rpc_url=https%3A%2F%2Frpc-mainnet.matic.network&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;chain_name&lt;&#x2F;code&gt; is required to specify the name of the network to be added.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;name&lt;&#x2F;code&gt; and &lt;code&gt;symbol&lt;&#x2F;code&gt; if provided, SHOULD be a human-readable string representing the native token.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;decimals&lt;&#x2F;code&gt; if provided, MUST be a non-negative integer representing the decimal precision of the native token.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;explorer_url&lt;&#x2F;code&gt; if provided, MUST specify one or more URLs pointing to block explorer web sites for the chain.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;icon_url&lt;&#x2F;code&gt; if provided, MUST specify one or more URLs pointing to reasonably sized images that can be used to visually identify the chain.&lt;&#x2F;p&gt;
&lt;p&gt;An example of adding a network with RPC endpoints &lt;code&gt;https:&#x2F;&#x2F;rpc-polygon.com&lt;&#x2F;code&gt; and &lt;code&gt;https:&#x2F;&#x2F;rpc-mainnet.matic.network&lt;&#x2F;code&gt;, the name &lt;code&gt;Polygon Mainnet&lt;&#x2F;code&gt;, token &lt;code&gt;Matic&lt;&#x2F;code&gt;, symbol &lt;code&gt;MATIC&lt;&#x2F;code&gt;, decimals &lt;code&gt;18&lt;&#x2F;code&gt;, explorer at &lt;code&gt;https:&#x2F;&#x2F;polygonscan.com&#x2F;&lt;&#x2F;code&gt;, and Chain ID &lt;code&gt;137&lt;&#x2F;code&gt; would look as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ethereum:network-add@137&#x2F;?chain_name=Polygon%20Mainnet&amp;amp;rpc_url=https%3A%2F%2Frpc-polygon.com&amp;amp;rpc_url=https%3A%2F%2Frpc-mainnet.matic.network&amp;amp;name=Matic&amp;amp;symbol=MATIC&amp;amp;decimals=18&amp;amp;explorer_url=https%3A%2F%2Fpolygonscan.com&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;In furtherance of the Ethereum URL saga, network configuration is a needed addition to the possibility of Ethereum URLs. This would improve functionality for URLs, and offer non-mainnet users a way to connect without needing to configure their wallet by hand.&lt;&#x2F;p&gt;
&lt;p&gt;The URL follows &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;831&#x2F;&quot;&gt;EIP-831&lt;&#x2F;a&gt; with the &lt;code&gt;PREFIX&lt;&#x2F;code&gt; being &lt;code&gt;network&lt;&#x2F;code&gt; and the &lt;code&gt;PAYLOAD&lt;&#x2F;code&gt; being a composite of &lt;code&gt;add&lt;&#x2F;code&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;681&#x2F;&quot;&gt;EIP-681&lt;&#x2F;a&gt;-like &lt;code&gt;chain_id&lt;&#x2F;code&gt; and parameters.&lt;&#x2F;p&gt;
&lt;p&gt;The choice for &lt;code&gt;PREFIX&lt;&#x2F;code&gt; being &lt;code&gt;network&lt;&#x2F;code&gt; is to allow further expansion and allow variants following the pattern &lt;code&gt;network-x&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;An example URL for adding the Optimism Network&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ethereum:network-add@10&#x2F;?chain_name=Optimistic%20Ethereum&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;amp;rpc_url=https%3A%2F%2Fmainnet.optimism.io&amp;amp;name=Ethereum&amp;amp;symbol=ETH&amp;amp;decimals=18&amp;amp;explorer_url=https%3A%2F%2Foptimistic.etherscan.io&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The specification allows for a multitude of &lt;code&gt;rpc_url&lt;&#x2F;code&gt; and &lt;code&gt;explorer_url&lt;&#x2F;code&gt; to be specified. This is done such to overlap with parsing of the &lt;code&gt;TYPE&lt;&#x2F;code&gt; mentioned in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;681&#x2F;&quot;&gt;EIP-681&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;URLs can be malformed to deceive users. Users SHOULD confirm source of URL before using any links. As well as checking source and transaction details before confirming any transactions. Applications SHOULD display network config, prior to network addition, such that users can confirm the validity of the network configuration being added.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Charity token</title>
        <published>2022-05-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Aubay</name><email>blockchain-team@aubay.com</email>
	</author>
	
	<author>
		<name>BOCA Jeabby</name><uri>https://github.com/bjeabby1507</uri>
	</author>
	
	<author>
		<name>EL MERSHATI Laith</name><uri>https://github.com/lth-elm</uri>
	</author>
	
	<author>
		<name>KEMP Elia</name><uri>https://github.com/eliakemp</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6353/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc20-charity-token/12617" />
        

        <id>https://wg-eips.ritovision.com/6353/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:6353"
            label="ERC-6353" />
        

        
        

        
        <summary type="html">Extension of EIP-20 token that can be partially donated to a charity project</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6353/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;An extension to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;EIP-20&lt;&#x2F;a&gt; that can automatically send an additional percentage of each transfer to a third party, and that provides an interface for retrieving this information. This can allow token owners to make donations to a charity with every transfer. This can also be used to allow automated savings programs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;There are charity organizations with addresses on-chain, and there are token holders who want to make automated donations. Having a standardized way of collecting and managing these donations helps users and user interface developers. Users can make an impact with their token and can contribute to achieving sustainable blockchain development. Projects can easily retrieve charity donations addresses and rate for a given &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;EIP-20&lt;&#x2F;a&gt; token, token holders can compare minimum rate donation offers allowed by token contract owners. This standard provides functionality that allows token holders to donate easily.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;Owner of the contract &lt;strong&gt;MAY&lt;&#x2F;strong&gt;, after review, register charity address in &lt;code&gt;whitelistedRate&lt;&#x2F;code&gt; and set globally a default rate of donation. To register the address, the rate &lt;strong&gt;MUST&lt;&#x2F;strong&gt; not be null.&lt;&#x2F;p&gt;
&lt;p&gt;Token holders &lt;strong&gt;MAY&lt;&#x2F;strong&gt; choose and specify a default charity address from &lt;code&gt;_defaultAddress&lt;&#x2F;code&gt;, this address &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; be different from the null address for the donation to be activated.&lt;&#x2F;p&gt;
&lt;p&gt;The donation is a percentage-based rate model, but the calculation can be done differently. Applications and individuals can implement this standard by retrieving information with &lt;code&gt;charityInfo()&lt;&#x2F;code&gt; , which specifies an assigned rate for a given address.&lt;&#x2F;p&gt;
&lt;p&gt;This standard provides functionality that allows token holders to donate easily. The donation when activated is done directly in the overridden &lt;code&gt;transfer&lt;&#x2F;code&gt;, &lt;code&gt;transferFrom&lt;&#x2F;code&gt;, and &lt;code&gt;approve&lt;&#x2F;code&gt; functions.&lt;&#x2F;p&gt;
&lt;p&gt;When &lt;code&gt;transfer&lt;&#x2F;code&gt;, &lt;code&gt;transferFrom&lt;&#x2F;code&gt; are called the sender&#x27;s balance is reduced by the initial amount and a donation amount is deduced. The initial transferred amount is transferred to the recipient&#x27;s balance and an additional donation amount is transferred to a third party (charity). The two transfer are done at the same time and emit two &lt;code&gt;Transfer&lt;&#x2F;code&gt; events.
Also, if the account has an insufficient balance to cover the transfer and the donation the whole transfer would revert.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.4&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Required interface of an ERC20 Charity compliant contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC20charity&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC165&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The EIP-165 identifier for this interface is 0x557512b6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when `toAdd` charity address is added to `whitelistedRate`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AddedToWhitelist&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; toAdd&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when `toRemove` charity address is deleted from `whitelistedRate`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RemovedFromWhitelist&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; toRemove&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when `_defaultAddress` charity address is modified and set to `whitelistedAddr`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DonnationAddressChanged&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; whitelistedAddr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when `_defaultAddress` charity address is modified and set to `whitelistedAddr` &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * and _donation is set to `rate`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DonnationAddressAndRateChanged&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; whitelistedAddr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; rate&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when `whitelistedRate` for `whitelistedAddr` is modified and set to `rate`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ModifiedCharityRate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; whitelistedAddr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; rate&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Called with the charity address to determine if the contract whitelisted the address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *and if it is the rate assigned.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - the Charity address queried for donnation information.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; whitelisted&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - true if the contract whitelisted the address to receive donnation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; defaultRate&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - the rate defined by the contract owner by default , the minimum rate allowed different from 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; charityInfo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; addr&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; whitelisted&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; defaultRate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Add address to whitelist and set rate to the default rate.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - `toAdd` cannot be the zero address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; toAdd&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to whitelist.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addToWhitelist&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; toAdd&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Remove the address from the whitelist and set rate to the default rate.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - `toRemove` cannot be the zero address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; toRemove&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to remove from whitelist.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; deleteFromWhitelist&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; toRemove&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get all registered charity addresses.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getAllWhitelistedAddresses&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; ;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Display for a user the rate of the default charity address that will receive donation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getRate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Set personlised rate for charity address in {whitelistedRate}.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - `whitelistedAddr` cannot be the zero address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - `rate` cannot be inferior to the default rate.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; whitelistedAddr&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to set as default.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; rate&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The personalised rate for donation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setSpecificRate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; whitelistedAddr&lt;&#x2F;span&gt;&lt;span&gt; ,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; rate&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Set for a user a default charity address that will receive donation. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * The default rate specified in {whitelistedRate} will be applied.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - `whitelistedAddr` cannot be the zero address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; whitelistedAddr&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to set as default.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setSpecificDefaultAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; whitelistedAddr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Set for a user a default charity address that will receive donation. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * The rate is specified by the user.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - `whitelistedAddr` cannot be the zero address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - `rate` cannot be less than to the default rate &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * or to the rate specified by the owner of this contract in {whitelistedRate}.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; whitelistedAddr&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to set as default.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; rate&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The personalised rate for donation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setSpecificDefaultAddressAndRate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; whitelistedAddr&lt;&#x2F;span&gt;&lt;span&gt; ,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; rate&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Display for a user the default charity address that will receive donation. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * The default rate specified in {whitelistedRate} will be applied.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; specificDefaultAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; defaultAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Delete The Default Address and so deactivate donnations .&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; deleteDefaultAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;functions&quot;&gt;Functions&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;addtowhitelist&quot;&gt;&lt;strong&gt;addToWhitelist&lt;&#x2F;strong&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Add address to whitelist and set the rate to the default rate.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;toAdd&lt;&#x2F;td&gt;&lt;td&gt;The address to the whitelist.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;deletefromwhitelist&quot;&gt;&lt;strong&gt;deleteFromWhitelist&lt;&#x2F;strong&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Remove the address from the whitelist and set rate to the default rate.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;toRemove&lt;&#x2F;td&gt;&lt;td&gt;The address to remove from whitelist.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;getallwhitelistedaddresses&quot;&gt;&lt;strong&gt;getAllWhitelistedAddresses&lt;&#x2F;strong&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Get all registered charity addresses.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;getrate&quot;&gt;&lt;strong&gt;getRate&lt;&#x2F;strong&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Display for a user the rate of the default charity address that will receive donation.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;setspecificrate&quot;&gt;&lt;strong&gt;setSpecificRate&lt;&#x2F;strong&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Set personalized rate for charity address in {whitelistedRate}.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;whitelistedAddr&lt;&#x2F;td&gt;&lt;td&gt;The address to set as default.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;rate&lt;&#x2F;td&gt;&lt;td&gt;The personalised rate for donation.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;setspecificdefaultaddress&quot;&gt;&lt;strong&gt;setSpecificDefaultAddress&lt;&#x2F;strong&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Set for a user a default charity address that will receive donations. The default rate specified in {whitelistedRate} will be applied.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;whitelistedAddr&lt;&#x2F;td&gt;&lt;td&gt;The address to set as default.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;setspecificdefaultaddressandrate&quot;&gt;&lt;strong&gt;setSpecificDefaultAddressAndRate&lt;&#x2F;strong&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Set for a user a default charity address that will receive donations. The rate is specified by the user.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;whitelistedAddr&lt;&#x2F;td&gt;&lt;td&gt;The address to set as default.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;rate&lt;&#x2F;td&gt;&lt;td&gt;The personalized rate for donation.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;specificdefaultaddress&quot;&gt;&lt;strong&gt;specificDefaultAddress&lt;&#x2F;strong&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Display for a user the default charity address that will receive donations. The default rate specified in {whitelistedRate} will be applied.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;deletedefaultaddress&quot;&gt;&lt;strong&gt;deleteDefaultAddress&lt;&#x2F;strong&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Delete The Default Address and so deactivate donations.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;charityinfo&quot;&gt;&lt;strong&gt;charityInfo&lt;&#x2F;strong&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Called with the charity address to determine if the contract whitelisted the address and if it is, the rate assigned.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;addr&lt;&#x2F;td&gt;&lt;td&gt;The Charity address queried for donnation information.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP chooses to whitelist charity addresses by using an array and keeping track of the &quot;active&quot; status with a mapping &lt;code&gt;whitelistedRate&lt;&#x2F;code&gt; to allow multiple choice of recipient and for transparence. The donation address can also be a single address chosen by the owner of the contract and modified by period.&lt;&#x2F;p&gt;
&lt;p&gt;If the sender balance is insuficent i.e total amount of token (initial transfer + donation) is insuficent the transfer would revert. Donation are done in the &lt;code&gt;transfer&lt;&#x2F;code&gt; function to simplify the usage and to not add an additional function, but the implementation could be donne differently, and for example allow a transfer to go through without the donation amount when donation is activated. The token implementer can also choose to store the donation in the contract or in another one and add a withdrawal or claimable function, so the charity can claim the allocated amount of token themselves, the additional transfer will be triggered by the charity and not the token holder.&lt;&#x2F;p&gt;
&lt;p&gt;Also, donations amount are calculated here as a percentage of the amount of token transferred to allow different case scenario, but the token implementer can decide to opt for another approach instead like rounding up the transaction value.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This implementation is an extension of the functionality of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;EIP-20&lt;&#x2F;a&gt;, it introduces new functionality retaining the core interfaces and functionality of the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;EIP-20&lt;&#x2F;a&gt; standard. There is a small backwards compatibility issue, indeed if an account has insufficient balance, it&#x27;s possible for the transfer to fail.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Tests can be found in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6353&#x2F;.&#x2F;assets&#x2F;test&#x2F;charity.js&quot;&gt;&lt;code&gt;charity.js&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The reference implementation of the standard can be found under &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6353&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;ERC20Charity.sol&quot;&gt;&lt;code&gt;contracts&#x2F;&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; folder.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;There are no additional security considerations compared to EIP-20.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>NFT Future Rewards (nFR)</title>
        <published>2022-05-08T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Yale ReiSoleil</name><uri>https://github.com/longnshort</uri>
	</author>
	
	<author>
		<name>dRadiant</name><uri>https://github.com/dRadiant</uri>
	</author>
	
	<author>
		<name>D Wang</name>
	</author>
	
	<author>
		<name>PhD</name><email>david@iob.fi</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5173/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/non-fungible-future-rewards-token-standard/9203" />
        

        <id>https://wg-eips.ritovision.com/5173/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:5173"
            label="ERC-5173" />
        

        
        

        
        <summary type="html">A multigenerational reward mechanism that rewards‌ all ‌owners of non-fungible tokens (NFT).</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5173/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal introduces the Non-Fungible Future Rewards (nFR) framework, extending &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; tokens (NFTs) features to let token holders benefit from value appreciation after transferring ownership. By integrating cooperative game theory, it aligns stakeholder incentives, addressing inefficiencies in asset transactions. The framework fosters collaboration, transparency, and equitable profit sharing. It improves equity and efficiency, recognizes all ownership stages, and establishes a cooperative asset transaction model.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Traditional financial markets are often characterized by inefficiencies, opaque practices, and systemic imbalances, resulting in significant disadvantages for the majority of participants. Although blockchain technology offers transaction transparency, current implementations do not adequately facilitate equitable value sharing or participant alignment. This proposal addresses these gaps by introducing structured collaboration and a fair compensation system, ensuring equitable rewards for contributions to asset value.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;framework-components&quot;&gt;Framework Components&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;the-flow-mechanism&quot;&gt;The Flow mechanism&lt;&#x2F;h4&gt;
&lt;p&gt;Each &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5173&#x2F;&quot;&gt;ERC-5173&lt;&#x2F;a&gt; token maintains an immutable record of ownership and price transitions, creating a dedicated network of historical token owners. This unique community collaborates to generate additional value and maintains vested interest in the project or token even after selling, ensuring contributors benefit from the asset&#x27;s appreciation. This mechanism promotes collaborative value creation, equitable profit sharing, and a connected financial ecosystem, distinct from traditional financial market systems.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;cooperative-value-future-rewards-distribution&quot;&gt;Cooperative Value (Future Rewards) Distribution&lt;&#x2F;h4&gt;
&lt;p&gt;The nFR framework transforms the zero-sum financial equation:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;P(A) + P(B) + F ≤ 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;P(A): Profit of trader A&lt;&#x2F;li&gt;
&lt;li&gt;P(B): Profit of trader B&lt;&#x2F;li&gt;
&lt;li&gt;F: Transaction fees, friction costs, and operational expenses&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;into a collaborative model:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;P(A) + P(B) + F + FR &amp;gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;FR: Shared value creation through cooperative mechanisms&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This model incentivizes fairness and rewards contributions throughout the asset lifecycle.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;The following is an extension of the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; standard.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;-compliant contracts MAY implement this EIP for rewards to provide a standard method of rewarding future buyers and previous owners with realized profits in the future.&lt;&#x2F;p&gt;
&lt;p&gt;Implementers of this standard MUST have all of the following functions:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;utils&#x2F;introspection&#x2F;IERC165.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;*&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * @dev Interface for the Future Rewards Token Standard.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * A standardized way to receive future rewards for non-fungible tokens (NFTs.)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5173&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC165&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FRClaimed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FRDistributed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; soldPrice&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; allocatedFR&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Listed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; salePrice&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Unlisted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Bought&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; salePrice&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; list&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; salePrice&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; unlist&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; buy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; releaseFR&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; retrieveFRInfo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; retrieveAllottedFR&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; retrieveListInfo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;An nFR contract MUST implement and update for each Token ID. The data in the &lt;code&gt;FRInfo&lt;&#x2F;code&gt; struct MAY either be stored wholly in a single mapping, or MAY be broken down into several mappings. The struct MUST either be exposed in a public mapping or mappings, or MUST have public functions that access the private data. This is for client-side data fetching and verification.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FRInfo&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint8&lt;&#x2F;span&gt;&lt;span&gt; numGenerations&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  Number of generations corresponding to that Token ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; percentOfProfit&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Percent of profit allocated for FR, scaled by 1e18&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; successiveRatio&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The common ratio of successive in the geometric sequence, used for distribution calculation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; lastSoldPrice&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Last sale price in ETH mantissa&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; ownerAmount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Amount of owners the Token ID has seen&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; addressesInFR&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The addresses currently in the FR cycle&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ListInfo&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; salePrice&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ETH mantissa of the listed selling price&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; lister&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Owner&#x2F;Lister of the Token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span&gt; isListed&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Boolean indicating whether the Token is listed or not&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Additionally, an nFR smart contract MUST store the corresponding &lt;code&gt;ListInfo&lt;&#x2F;code&gt; for each Token ID in a mapping. A method to retrieve a Token ID’s corresponding &lt;code&gt;ListInfo&lt;&#x2F;code&gt; MUST also be accessible publicly.&lt;&#x2F;p&gt;
&lt;p&gt;An nFR smart contract MUST also store and update the amount of Ether allocated to a specific address using the &lt;code&gt;_allotedFR&lt;&#x2F;code&gt; mapping. The &lt;code&gt;_allottedFR&lt;&#x2F;code&gt; mapping MUST either be public or have a function to fetch the FR payment allotted to a specific address.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;percent-fixed-point&quot;&gt;Percent Fixed Point&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;allocatedFR&lt;&#x2F;code&gt; MUST be calculated using a percentage fixed point with a scaling factor of 1e18 (X&#x2F;1e18) - such as &quot;5e16&quot; - for 5%. This is REQUIRED to maintain uniformity across the standard. The max and min values would be - 1e18 - 1.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;default-fr-info&quot;&gt;Default FR Info&lt;&#x2F;h3&gt;
&lt;p&gt;A default &lt;code&gt;FRInfo&lt;&#x2F;code&gt; MUST be stored in order to be backward compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; mint functions. It MAY also have a function to update the &lt;code&gt;FRInfo&lt;&#x2F;code&gt;, assuming it has not been hard-coded.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;erc-721-overrides&quot;&gt;ERC-721 Overrides&lt;&#x2F;h3&gt;
&lt;p&gt;An nFR-compliant smart contract MUST override the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; &lt;code&gt;_mint&lt;&#x2F;code&gt;, &lt;code&gt;_transfer&lt;&#x2F;code&gt;, and &lt;code&gt;_burn&lt;&#x2F;code&gt; functions. When overriding the &lt;code&gt;_mint&lt;&#x2F;code&gt; function, a default FR model is REQUIRED to be established if the mint is to succeed when calling the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; &lt;code&gt;_mint&lt;&#x2F;code&gt; function and not the nFR &lt;code&gt;_mint&lt;&#x2F;code&gt; function. It is also to update the owner amount and directly add the recipient address to the FR cycle. When overriding the &lt;code&gt;_transfer&lt;&#x2F;code&gt; function, the smart contract SHALL consider the NFT as sold for 0 ETH, and update the state accordingly after a successful transfer. This is to prevent FR circumvention. Additionally, the &lt;code&gt;_transfer&lt;&#x2F;code&gt; function SHALL prevent the caller from transferring the token to themselves or an address that is already in the FR sliding window, this can be done through a require statement that ensures that the sender or an address in the FR sliding window is not the recipient, otherwise, it’d be possible to fill up the FR sequence with one’s own address or duplicate addresses. Finally, when overriding the &lt;code&gt;_burn&lt;&#x2F;code&gt; function, the smart contract SHALL delete the &lt;code&gt;FRInfo&lt;&#x2F;code&gt; and &lt;code&gt;ListInfo&lt;&#x2F;code&gt; corresponding to that Token ID after a successful burn.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; &lt;code&gt;_checkOnERC721Received&lt;&#x2F;code&gt; function MAY be explicitly called after mints and transfers if the smart contract aims to have safe transfers and mints.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;safe-transfers&quot;&gt;Safe Transfers&lt;&#x2F;h3&gt;
&lt;p&gt;If the wallet&#x2F;broker&#x2F;auction application will accept safe transfers, then it MUST implement the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; wallet interface.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;listing-unlisting-and-buying&quot;&gt;Listing, Unlisting, and Buying&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;list&lt;&#x2F;code&gt;, &lt;code&gt;unlist&lt;&#x2F;code&gt;, and &lt;code&gt;buy&lt;&#x2F;code&gt; functions MUST be implemented, as they provide the capability to sell a token.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; list&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; salePrice&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; unlist&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; buy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;list&lt;&#x2F;code&gt; function accepts a &lt;code&gt;tokenId&lt;&#x2F;code&gt; and a &lt;code&gt;salePrice&lt;&#x2F;code&gt; and updates the corresponding &lt;code&gt;ListInfo&lt;&#x2F;code&gt; for that given &lt;code&gt;tokenId&lt;&#x2F;code&gt; after ensuring that the &lt;code&gt;msg.sender&lt;&#x2F;code&gt; is either approved or the owner of the token. The &lt;code&gt;list&lt;&#x2F;code&gt; function SHOULD emit the &lt;code&gt;Listed&lt;&#x2F;code&gt; event. The function signifies that the token is listed and at what price it is listed for.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;unlist&lt;&#x2F;code&gt; function accepts a &lt;code&gt;tokenId&lt;&#x2F;code&gt; and it deletes the corresponding &lt;code&gt;ListInfo&lt;&#x2F;code&gt; after the owner verifications have been met. The &lt;code&gt;unlist&lt;&#x2F;code&gt; function SHOULD emit the &lt;code&gt;Unlisted&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;buy&lt;&#x2F;code&gt; function accepts a &lt;code&gt;tokenId&lt;&#x2F;code&gt; and MUST be payable. It MUST verify that the &lt;code&gt;msg.value&lt;&#x2F;code&gt; matches the token’s &lt;code&gt;salePrice&lt;&#x2F;code&gt; and that the token is listed, before proceeding and calling the FR &lt;code&gt;_transferFrom&lt;&#x2F;code&gt; function. The function MUST also verify that the buyer is not already in the FR sliding window. This is to ensure the values are valid and will also allow for the necessary FR to be held in the contract. The &lt;code&gt;buy&lt;&#x2F;code&gt; function SHOULD emit the &lt;code&gt;Bought&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;future-rewards-transferfrom-function&quot;&gt;Future Rewards &lt;code&gt;_transferFrom&lt;&#x2F;code&gt; Function&lt;&#x2F;h3&gt;
&lt;p&gt;The FR &lt;code&gt;_transferFrom&lt;&#x2F;code&gt; function MUST be called by all nFR-supporting smart contracts, though the accommodations for non-nFR-supporting contracts MAY also be implemented to ensure backwards compatibility.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; soldPrice&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;       &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Based on the stored &lt;code&gt;lastSoldPrice&lt;&#x2F;code&gt;, the smart contract will determine whether the sale was profitable after calling the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; transfer function and transferring the NFT. If it was not profitable, the smart contract SHALL update the last sold price for the corresponding Token ID, increment the owner amount, shift the generations, and transfer all of the &lt;code&gt;msg.value&lt;&#x2F;code&gt; to the &lt;code&gt;lister&lt;&#x2F;code&gt; depending on the implementation. Otherwise, if the transaction was profitable, the smart contract SHALL call the &lt;code&gt;_distributeFR&lt;&#x2F;code&gt; function, then update the &lt;code&gt;lastSoldPrice&lt;&#x2F;code&gt;, increment the owner amount, and finally shift generations. The &lt;code&gt;_distributeFR&lt;&#x2F;code&gt; function or the FR &lt;code&gt;_transferFrom&lt;&#x2F;code&gt; MUST return the difference between the allocated FR that is to be distributed amongst the &lt;code&gt;_addressesInFR&lt;&#x2F;code&gt; and the &lt;code&gt;msg.value&lt;&#x2F;code&gt; to the &lt;code&gt;lister&lt;&#x2F;code&gt;. Once the operations have completed, the function MUST clear the corresponding &lt;code&gt;ListInfo&lt;&#x2F;code&gt;. Similarly to the &lt;code&gt;_transfer&lt;&#x2F;code&gt; override, the FR &lt;code&gt;_transferFrom&lt;&#x2F;code&gt; SHALL ensure that the recipient is not the sender of the token or an address in the FR sliding window.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;future-rewards-calculation&quot;&gt;Future Rewards Calculation&lt;&#x2F;h3&gt;
&lt;p&gt;Marketplaces that support this standard MAY implement various methods of calculating or transferring Future Rewards to the previous owners.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _calculateFR&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; totalProfit&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; buyerReward&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; successiveRatio&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ownerAmount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; windowSize&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;...        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In this example (&lt;em&gt;Figure 1&lt;&#x2F;em&gt;), a seller is REQUIRED to share a portion of their net profit with 10 previous holders of the token. Future Rewards will also be paid to the same seller as the value of the token increases from up to 10 subsequent owners.&lt;&#x2F;p&gt;
&lt;p&gt;When an owner loses money during their holding period, they MUST NOT be obligated to share Future Rewards distributions, since there is no profit to share. However, he SHALL still receive a share of Future Rewards distributions from future generations of owners, if they are profitable.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5173&#x2F;.&#x2F;assets&#x2F;Total_FR_Payout_Distribution-geo.png&quot; alt=&quot;Figure 1: Geometric sequence distribution&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Figure 1: Geometric sequence distribution&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The buyers&#x2F;owners receive a portion ( r ) of the realized profit  (P ) from an NFT transaction. The remaining proceeds go to the seller.&lt;&#x2F;p&gt;
&lt;p&gt;As a result of defining a sliding window mechanism ( n ), we can determine which previous owners will receive distributions. The owners are arranged in a queue, starting with the earliest owner and ending with the owner immediately before the current owner (the Last Generation). The First Generation is the last of the next n generations. There is a fixed-size profit distribution window from the First Generation to the Last Generation.&lt;&#x2F;p&gt;
&lt;p&gt;The profit distribution SHALL be only available to previous owners who fall within the window.&lt;&#x2F;p&gt;
&lt;p&gt;In this example, there SHALL be a portion of the proceeds awarded to the Last Generation owner (the owner immediately prior to the current seller) based on the geometric sequence in which profits are distributed. The larger portion of the proceeds SHALL go to the Mid-Gen owners, the earlier the greater, until the last eligible owner is determined by the sliding window, the First Generation. Owners who purchase earlier SHALL receive a greater reward, with first-generation owners receiving the greatest reward.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;future-rewards-distribution&quot;&gt;Future Rewards Distribution&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5173&#x2F;.&#x2F;assets&#x2F;nFR_Standard_Outline.jpeg&quot; alt=&quot;Figure 2: NFT Owners&amp;#39; Future Rewards (nFR)&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Figure 2: NFT Owners&#x27; Future Rewards (nFR)&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Figure 2&lt;&#x2F;em&gt; illustrates an example of a five-generation Future Rewards Distribution program based on an owner&#x27;s realized profit.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _distributeFR&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; soldPrice&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;       &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FRDistributed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; soldPrice&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; allocatedFR&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;_distributeFR&lt;&#x2F;code&gt; function MUST be called in the FR &lt;code&gt;_transferFrom&lt;&#x2F;code&gt; function if there is a profitable sale. The function SHALL determine the addresses eligible for FR, which would essentially be, excluding the last address in &lt;code&gt;addressesInFR&lt;&#x2F;code&gt; in order to prevent any address from paying itself. If the function determines there are no addresses eligible, i.e., it is the first sale, then it SHALL either &lt;code&gt;return 0&lt;&#x2F;code&gt; if &lt;code&gt;_transferFrom&lt;&#x2F;code&gt; is handling FR payment or send &lt;code&gt;msg.value&lt;&#x2F;code&gt; to the &lt;code&gt;lister&lt;&#x2F;code&gt;. The function SHALL calculate the difference between the current sale price and the &lt;code&gt;lastSoldPrice&lt;&#x2F;code&gt;, then it SHALL call the &lt;code&gt;_calculateFR&lt;&#x2F;code&gt; function to receive the proper distribution of FR. Then it SHALL distribute the FR accordingly, making order adjustments as necessary. Then, the contract SHALL calculate the total amount of FR that was distributed (&lt;code&gt;allocatedFR&lt;&#x2F;code&gt;), in order to return the difference of the &lt;code&gt;soldPrice&lt;&#x2F;code&gt; and &lt;code&gt;allocatedFR&lt;&#x2F;code&gt; to the &lt;code&gt;lister&lt;&#x2F;code&gt;. Finally, it SHALL emit the &lt;code&gt;FRDistributed&lt;&#x2F;code&gt; event. Additionally, the function MAY return the allocated FR, which would be received by the FR &lt;code&gt;_transferFrom&lt;&#x2F;code&gt; function, if the &lt;code&gt;_transferFrom&lt;&#x2F;code&gt; function is sending the &lt;code&gt;allocatedFR&lt;&#x2F;code&gt; to the &lt;code&gt;lister&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;future-rewards-claiming&quot;&gt;Future Rewards Claiming&lt;&#x2F;h3&gt;
&lt;p&gt;The future Rewards payments SHOULD utilize a pull-payment model, similar to that demonstrated by OpenZeppelin with their PaymentSplitter contract. The event  FRClaimed would be triggered after a successful claim has been made.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; releaseFR&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;owner-generation-shifting&quot;&gt;Owner Generation Shifting&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;_shiftGenerations&lt;&#x2F;code&gt; function MUST be called regardless of whether the sale was profitable or not. As a result, it will be called in the &lt;code&gt;_transfer&lt;&#x2F;code&gt; &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; override function and the FR &lt;code&gt;transferFrom&lt;&#x2F;code&gt; function. The function SHALL remove the oldest account from the corresponding &lt;code&gt;_addressesInFR&lt;&#x2F;code&gt; array. This calculation will take into account the current length of the array versus the total number of generations for a given token ID.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;fixed-percentage-to-10-18&quot;&gt;Fixed Percentage to 10^18&lt;&#x2F;h3&gt;
&lt;p&gt;Considering Fixed-Point Arithmetic is to be enforced, it is logical to have 1e18 represent 100% and 1e16 represent 1% for Fixed-Point operations. This method of handling percents is also commonly seen in many Solidity libraries for Fixed-Point operations.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;emitting-event-for-payment&quot;&gt;Emitting Event for Payment&lt;&#x2F;h3&gt;
&lt;p&gt;Since each NFT contract is independent, and while a marketplace contract can emit events when an item is sold, choosing to emit an event for payment is important. As the royalty and FR recipient may not be aware of&#x2F;watching for a secondary sale of their NFT, they would never know that they received a payment except that their ETH wallet has been increased randomly.&lt;&#x2F;p&gt;
&lt;p&gt;The recipient of the secondary sale will therefore be able to verify that the payment has been received by calling the parent contract of the NFT being sold, as implemented in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2981&#x2F;&quot;&gt;ERC-2981&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;number-of-generations-of-all-owners-n-vs-number-of-generations-of-only-profitable-owners&quot;&gt;Number of Generations of All Owners ( n ) vs Number of Generations of Only Profitable Owners&lt;&#x2F;h3&gt;
&lt;p&gt;It is the number of generations of all owners, not just those who are profitable, that determines the number of owners from which the subsequent owners&#x27; profits will be shared, see &lt;em&gt;Figure 3&lt;&#x2F;em&gt;. As part of the effort to discourage &quot;ownership hoarding,&quot; Future Rewards distributions will not be made to the current owner&#x2F;purchaser if all the owners lose money holding the NFT. Further information can be found under Security Considerations.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5173&#x2F;.&#x2F;assets&#x2F;Losing_owners.jpeg&quot; alt=&quot;Figure 3: Losing owners&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Figure 3: Losing owners&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;single-vs-multigenerations&quot;&gt;Single vs Multigenerations&lt;&#x2F;h3&gt;
&lt;p&gt;In a single generation reward, the new buyer&#x2F;owner receives a share of the next single generation&#x27;s realized profit only. In a multigenerational reward system, buyers will have future rewards years after their purchase. The NFT should have a long-term growth potential and a substantial dividend payout would be possible in this case.&lt;&#x2F;p&gt;
&lt;p&gt;We propose that the marketplace operator can choose between a single generational distribution system and a multigenerational distribution system.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;direct-fr-payout-by-the-seller-vs-smart-contract-managed-payout&quot;&gt;Direct FR Payout by the Seller vs Smart Contract-managed Payout&lt;&#x2F;h3&gt;
&lt;p&gt;FR payouts directly derived from the sale proceeds are immediate and final. As part of the fraud detection detailed later in the Security Considerations section, we selected a method in which the smart contract calculates all the FR amounts for each generation of previous owners, and handles payout according to other criteria set by the marketplace, such as reduced or delayed payments for wallet addresses with low scores, or a series of consecutive orders detected using a time-heuristic analysis.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;equal-vs-linear-reward-distributions&quot;&gt;Equal vs Linear Reward Distributions&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;equal-fr-payout&quot;&gt;Equal FR Payout&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5173&#x2F;.&#x2F;assets&#x2F;Total_FR_Payout_Distribution-flat.png?raw=true&quot; alt=&quot;Figure 4: Equal, linear reward distribution&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Figure 4: Equal, linear reward distribution&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;FR distributions from the realization of profits by later owners are distributed equally to all eligible owners (&lt;em&gt;Figure 4&lt;&#x2F;em&gt;). The exponential reward curve, however, may be more desirable, as it gives a slightly larger share to the newest buyer. Additionally, this distribution gives the earliest generations the largest portions as their FR distributions near the end, so they receive higher rewards for their early involvement, but the distribution is not nearly as extreme as one based on arithmetic sequences (&lt;em&gt;Figure 5&lt;&#x2F;em&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;This system does not discriminate against any buyer because each buyer will go through the same distribution curve.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;straight-line-arithmetic-sequence-fr-payout&quot;&gt;Straight line arithmetic sequence FR payout&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5173&#x2F;.&#x2F;assets&#x2F;Arithmetic_Sequence_FR_Payout_Distribution.png?raw=true&quot; alt=&quot;Figure 5: Arithmetic sequence distribution&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Figure 5: Arithmetic sequence distribution&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The profit is distributed according to the arithmetic sequence, which is 1, 2, 3, ... and so on. The first owner will receive 1 portion, the second owner will receive 2 portions, the third owner will receive 3 portions, etc.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal is fully compatible with current &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; standards and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2981&#x2F;&quot;&gt;ERC-2981&lt;&#x2F;a&gt;. It can also be easily adapted to work with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5173&#x2F;.&#x2F;assets&#x2F;Implementation&#x2F;nFRImplementation.sol&quot;&gt;This contract&lt;&#x2F;a&gt; contains the reference implementation for this proposal.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5173&#x2F;.&#x2F;assets&#x2F;animate-1920x1080-1750-frames.gif?raw=true&quot;&gt;Here is a visualization of the test case&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;As a result of implementing ERC-5173, a new project has been launched called untrading.org.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;This implementation uses OpenZeppelin contracts and the PRB Math library created by Paul R Berg for fixed-point arithmetic. It demonstrates the interface for the nFR standard, an nFR standard-compliant extension, and an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; implementation using the extension.&lt;&#x2F;p&gt;
&lt;p&gt;The code for the reference implementation is &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5173&#x2F;.&#x2F;assets&#x2F;Implementation&#x2F;nFRImplementation.sol&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;distribution-of-nft-royalties-to-artists-and-creators&quot;&gt;Distribution of NFT Royalties to Artists and Creators&lt;&#x2F;h3&gt;
&lt;p&gt;We agree that artists’ royalties should be uniform and on-chain. We support &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2981&#x2F;&quot;&gt;ERC-2981&lt;&#x2F;a&gt; NFT royalty Standard proposal.&lt;&#x2F;p&gt;
&lt;p&gt;All platforms can support royalty rewards for the same NFT based on on-chain parameters and functions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;No profit, no profit sharing, no cost;&lt;&#x2F;li&gt;
&lt;li&gt;The question of &quot;who owned it&quot; is often crucial to the provenance and value of a collectible;&lt;&#x2F;li&gt;
&lt;li&gt;The previous owner should be re-compensated for their ownership;&lt;&#x2F;li&gt;
&lt;li&gt;And the buyer&#x2F;owner incentive in FR eliminates any motive to circumvent the royalty payout schemes;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;distribution-of-nft-owners-future-rewards-frs&quot;&gt;Distribution of NFT Owners’ Future Rewards (FRs)&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;future-rewards-calculation-1&quot;&gt;Future Rewards calculation&lt;&#x2F;h4&gt;
&lt;p&gt;Any realized profits (P) when an NFT is sold are distributed among the buyers&#x2F;owners. The previous owners will take a fixed portion of the profit (P), and this portion is called Future Rewards (FRs). The seller takes the rest of the profits.&lt;&#x2F;p&gt;
&lt;p&gt;We define a sliding window mechanism to decide which previous owners will be involved in the profit distribution. Let&#x27;s imagine the owners as a queue starting from the first hand owner to the current owner. The profit distribution window starts from the previous owner immediately to the current owner and extends towards the first owner, and the size of the windows is fixed. Only previous owners located inside the window will join the profit distribution.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5173&#x2F;.&#x2F;assets&#x2F;nFR_distribution_formula.jpg?raw=true&quot; alt=&quot;Future Rewards calculation formula&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;In this equation:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;P is the total profit, the difference between the selling price minus the buying price;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;R&lt;&#x2F;em&gt; is buyer reward ratio of the total P;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;g&lt;&#x2F;em&gt; is the common ratio of successive in the geometric sequence;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;n&lt;&#x2F;em&gt; is the actual number of owners eligible and participating in the future rewards sharing. To calculate &lt;em&gt;n&lt;&#x2F;em&gt;, we have &lt;em&gt;n&lt;&#x2F;em&gt; = min(&lt;em&gt;m&lt;&#x2F;em&gt;, &lt;em&gt;w&lt;&#x2F;em&gt;), where &lt;em&gt;m&lt;&#x2F;em&gt; is the current number of owners for a token, and &lt;em&gt;w&lt;&#x2F;em&gt; is the window size of the profit distribution sliding window algorithm&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;converting-into-code&quot;&gt;Converting into Code&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Assumes usage of a Fixed Point Arithmetic library (prb-math) for both int256 and uint256, and OpenZeppelin Math utils for Math.min. &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _calculateFR&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; p&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; g&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; m&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; w&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; n &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; Math&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;m&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; w&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; FR &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[](&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; n &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            uint256&lt;&#x2F;span&gt;&lt;span&gt; pi &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;successiveRatio &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1e18&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                int256&lt;&#x2F;span&gt;&lt;span&gt; v1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1e18&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;g&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;powu&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                int256&lt;&#x2F;span&gt;&lt;span&gt; v2 &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;g&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;powu&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                int256&lt;&#x2F;span&gt;&lt;span&gt; v3 &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;p&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;mul&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;r&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                int256&lt;&#x2F;span&gt;&lt;span&gt; v4 &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; v3&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;mul&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1e18&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;g&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                pi &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;v4 &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; v2 &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; v1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                pi &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; p&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;mul&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;r&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;div&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            FR&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; pi&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; FR&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The complete implementation code can be found &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5173&#x2F;.&#x2F;assets&#x2F;Implementation&#x2F;nFRImplementation.sol&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;payment-attacks&quot;&gt;Payment Attacks&lt;&#x2F;h3&gt;
&lt;p&gt;As this ERC introduces royalty and realized profit rewards collection, distribution, and payouts to the ERC-721 standard, the attack vectors increase. As discussed by Andreas Freund regarding mitigations to phishing attacks, we recommend reentrancy protection for all payment functions to reduce the most significant attack vectors for payments and payouts.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;royalty-circumventing&quot;&gt;Royalty Circumventing&lt;&#x2F;h3&gt;
&lt;p&gt;Many methods are being used to avoid paying royalties to creators under the current &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; standard. Through an under-the-table transaction, the new buyer&#x27;s cost basis will be reduced to zero, increasing their FR liability to the full selling price. Everyone, either the buyer or seller, would pay a portion of the previous owner&#x27;s net realized profits ( P x r ). Acting in his or her own interests, the buyer rejects any loyalty circumventing proposal.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;fr-hoarding-through-wash-sales&quot;&gt;FR Hoarding through Wash Sales&lt;&#x2F;h3&gt;
&lt;p&gt;Quantexa blog and beincrypto articles have reported widespread wash trading on all unregulated cryptocurrency trading platforms and NFT marketplaces. The use of wash trading by dishonest actors can lead to an unfair advantage, as well as inflated prices and money laundering. When a single entity becomes multiple generations of owners to accumulate more rewards in the future, the validity of the system is undermined.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;wash-trading-by-users&quot;&gt;Wash trading by users&lt;&#x2F;h4&gt;
&lt;p&gt;Using a different wallet address, an attacker can &quot;sell&quot; the NFT to themselves at a loss. It is possible to repeat this process n times in order to maximize their share of the subsequent FR distributions (&lt;em&gt;Figure 6&lt;&#x2F;em&gt;). A wallet ranking score can partially alleviate this problem. It is evident that a brand new wallet is a red flag, and the marketplace may withhold FR distribution from it if it has a short transaction history (i.e. fewer than a certain number of transactions).&lt;&#x2F;p&gt;
&lt;p&gt;We do not want a large portion of future rewards to go to a small number of wash traders. Making such practices less profitable is one way to discourage wash trading and award hoarding. It can be partially mitigated, for example, by implementing a wallet-score and holding period-based incentive system. The rewards for both parties are reduced if a new wallet is used or if a holding period is less than a certain period.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5173&#x2F;.&#x2F;assets&#x2F;Same_owner_using_different_wallets.jpeg&quot; alt=&quot;Figure 6: Same owner using different wallets&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Figure 6: Same owner using different wallets&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;wash-trading-by-the-marketplace-operator&quot;&gt;Wash trading by the marketplace operator&lt;&#x2F;h4&gt;
&lt;p&gt;However, the biggest offender appears to be the marketplace, which engages heavily in wash trading, or simply does not care about it, according to Decrypt. The authors have personally experienced this phenomenon. A senior executive of a top-5 cryptocurrency exchange boasted during a mid-night drinking session in 2018, that they had &quot;brushed&quot; (wash-traded) certain newly listed tokens, which they called &quot;marketmaking.&quot; The exchange is still ranked among the top five crypto exchanges today.&lt;&#x2F;p&gt;
&lt;p&gt;Many of these companies engage in wash trading on their own or collude with certain users, and royalties and FR payments are reimbursed under the table. It is crucial that all exchanges have robust features to prevent self-trading. Users should be able to observe watchers transparently. Marketplaces should provide their customers with free access to an on-chain transaction monitoring service like Chainalysis Reactor.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;long-cyclical-fr-entitled-owner-generations&quot;&gt;Long&#x2F;Cyclical FR-Entitled Owner Generations&lt;&#x2F;h3&gt;
&lt;p&gt;In most cases, malicious actors will create excessively long or cyclical Future Rewards Owner Generations that will result in applications that attempt to distribute FR or shift generations running out of gas and not functioning. Therefore, clients are responsible for verifying that the contract with which they interact has an appropriate number of generations, so that looping over will not deplete the gas.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Expirable Transaction</title>
        <published>2022-05-06T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Zainan Victor Zhou</name><uri>https://github.com/xinbenlv</uri>
	</author>
	
	<author>
		<name>Nick Johnson</name><uri>https://github.com/Arachnid</uri>
	</author>
	
	<author>
		<name>Konrad Feldmeier</name><email>konrad@brainbot.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5081/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5081-expirable-transaction/9208" />
        

        <id>https://wg-eips.ritovision.com/5081/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:5081"
            label="EIP-5081" />
        

        
        

        
        <summary type="html">This EIP adds a new transaction type of that includes expiration with a blocknum</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5081/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP adds a new transaction type of that includes expiration with a blocknum.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;When a user sends a transaction &lt;code&gt;tx0&lt;&#x2F;code&gt; with a low gas price, sometimes it might not be high enough to be executed.
A common resolution is for the user to submit the transaction again with the same nonce and higher gas price.&lt;&#x2F;p&gt;
&lt;p&gt;That previous &lt;code&gt;tx0&lt;&#x2F;code&gt; can theoretically be included in any time in the future unless a &lt;code&gt;tx&lt;&#x2F;code&gt; with the exact same nonce is already executed.&lt;&#x2F;p&gt;
&lt;p&gt;When network is congested, gas price are high, for critical transactions user might try gas price that is much higher than an average day.
This cause the &lt;code&gt;tx0&lt;&#x2F;code&gt; choice might be very easy to executed in the average day.&lt;&#x2F;p&gt;
&lt;p&gt;If user already uses a &lt;code&gt;tx1&lt;&#x2F;code&gt; with different nonce or from another account to execute the intended transaction,
there is currently no clean way to cancel it,
except for signing a new &lt;code&gt;tx0&#x27;&lt;&#x2F;code&gt; that shares the same nonce but with higher gas fee hoping that it will execute to &lt;em&gt;preempt&lt;&#x2F;em&gt;- than &lt;code&gt;tx0&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Given &lt;code&gt;tx0&lt;&#x2F;code&gt; was already high gas price, the current way of &lt;em&gt;preempting&lt;&#x2F;em&gt; &lt;code&gt;tx0&lt;&#x2F;code&gt; could be both unreliable and very costly.&lt;&#x2F;p&gt;
&lt;p&gt;TODO(@xinbenlv): to include in the motivation:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Expiring transactions are transactions that have low time preference, but can easily become invalid in the future. For example, you may want to do a swap on an AMM but you don&#x27;t want to pay a very high fee for it so you set the max fee to a low number. However, your transaction will almost certainly fail if it takes longer than a couple minutes to be mined. In this scenario, you would rather fail cheaply if your transaction doesn&#x27;t get included quickly.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Similarly, there are situations where there is a limited window of availability of some asset and if your transaction doesn&#x27;t mine within that period you know with certainty that it will fail. In these cases, it would be nice to be able to express that to the system and not waste unnecessary resources just to have the transaction fail.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;FORK_BLKNUM&lt;&#x2F;code&gt; = &lt;code&gt;TBD&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CHAIN_ID&lt;&#x2F;code&gt; = &lt;code&gt;TBD&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TX_TYPE&lt;&#x2F;code&gt; = TBD, &amp;gt; 0x02 (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;As of &lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt;, a new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; transaction is introduced with &lt;code&gt;TransactionType&lt;&#x2F;code&gt; = &lt;code&gt;TX_TYPE(TBD)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The intrinsic cost of the new transaction is inherited from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930&lt;&#x2F;a&gt;, specifically &lt;code&gt;21000 + 16 * non-zero calldata bytes + 4 * zero calldata bytes + 1900 * access list storage key count + 2400 * access list address count&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; &lt;code&gt;TransactionPayload&lt;&#x2F;code&gt; for this transaction is&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;rlp([chain_id, expire_by, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit, destination, amount, data, access_list, signature_y_parity, signature_r, signature_s])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The definition of &lt;code&gt;expire_by&lt;&#x2F;code&gt; is a block number the latest possible block to
execute this transaction. Any block with a block number &lt;code&gt;block_num &amp;gt; expire_by&lt;&#x2F;code&gt; MUST NOT execute this transaction.&lt;&#x2F;p&gt;
&lt;p&gt;The definitions of all other fields share the same meaning with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;signature_y_parity, signature_r, signature_s&lt;&#x2F;code&gt; elements of this transaction represent a secp256k1 signature over &lt;code&gt;keccak256(0x02 || rlp([chain_id, expire_by, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit, destination, amount, data, access_list]))&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; &lt;code&gt;ReceiptPayload&lt;&#x2F;code&gt; for this transaction is &lt;code&gt;rlp([status, cumulative_transaction_gas_used, logs_bloom, logs])&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;TODO&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;TODO&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;If &lt;code&gt;current_block_num&lt;&#x2F;code&gt; is available, client MUST drop and stop propagating&#x2F;broadcasting any transactions that has a
&lt;code&gt;transaction_type == TX_TYPE&lt;&#x2F;code&gt; AND &lt;code&gt;current_block_num &amp;gt; expire_by&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;It is suggested but not required that a &lt;code&gt;currentBlockNum&lt;&#x2F;code&gt; SHOULD be made available to client. Any client doing PoW calculation on blocks expire tx or propagating such are essentially penalized for wasting of work, mitigating possible denial of service attack.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;It is suggested but not required that client SHOULD introduce a
&lt;code&gt;gossip_ttl&lt;&#x2F;code&gt; in unit of block_num as a safe net so that it only propagate
a tx if &lt;code&gt;current_block_num + gossip_ttl &amp;lt;= expire_by&lt;&#x2F;code&gt;. Backward compatibility:
for nodes that doesn&#x27;t have &lt;code&gt;current_block_num&lt;&#x2F;code&gt; or &lt;code&gt;gossip_ttl&lt;&#x2F;code&gt; available,
they should be presumed to be &lt;code&gt;0&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;It is suggested by not required that any propagating client SHOULD properly deduct the &lt;code&gt;gossip_ttl&lt;&#x2F;code&gt;
based on the network environment it sees fit.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Client Script URI for Token Contracts</title>
        <published>2022-05-03T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>James</name><uri>https://github.com/JamesSmartCell</uri>
	</author>
	
	<author>
		<name>Weiwu</name><uri>https://github.com/weiwu-zhang</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5169/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5169-client-script-uri-for-token-contracts/9674" />
        

        <id>https://wg-eips.ritovision.com/5169/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:5169"
            label="ERC-5169" />
        

        
        

        
        <summary type="html">Add a scriptURI to point to an executable script associated with the functionality of the token.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5169/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP provides a contract interface adding a &lt;code&gt;scriptURI()&lt;&#x2F;code&gt; function for locating executable scripts associated with the token.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Often, smart contract authors want to provide some user functionality to their tokens through client scripts. The idea is made popular with function-rich NFTs. It&#x27;s important that a token&#x27;s contract is linked to its client script, since the client script may carry out trusted tasks such as creating transactions for the user.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP allows users to be sure they are using the correct script through the contract by providing a URI to an official script, made available with a call to the token contract itself (&lt;code&gt;scriptURI&lt;&#x2F;code&gt;). This URI can be any RFC 3986-compliant URI, such as a link to an IPFS multihash, GitHub gist, or a cloud storage provider. Each contract implementing this EIP  implements a &lt;code&gt;scriptURI&lt;&#x2F;code&gt; function which returns the download URI to a client script. The script provides a client-side executable to the hosting token. Examples of such a script could be:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A &#x27;miniDapp&#x27;, which is a cut-down DApp tailored for a single token.&lt;&#x2F;li&gt;
&lt;li&gt;A &#x27;TokenScript&#x27; which provides TIPS from a browser wallet.&lt;&#x2F;li&gt;
&lt;li&gt;A &#x27;TokenScript&#x27; that allows users to interact with contract functions not normally provided by a wallet, eg &#x27;mint&#x27; function.&lt;&#x2F;li&gt;
&lt;li&gt;An extension that is downloadable to the hardware wallet with an extension framework, such as Ledger.&lt;&#x2F;li&gt;
&lt;li&gt;JavaScript instructions to operate a smartlock, after owner receives authorization token in their wallet.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;overview&quot;&gt;Overview&lt;&#x2F;h3&gt;
&lt;p&gt;With the discussion above in mind, we outline the solution proposed by this EIP. For this purpose, we consider the following variables:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;SCPrivKey&lt;&#x2F;code&gt;: The private signing key to administrate a smart contract implementing this EIP. Note that this doesn&#x27;t have to be a new key especially added for this EIP. Most smart contracts made today already have an administration key to manage the tokens issued. It can be used to update the &lt;code&gt;scriptURI&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;newScriptURI&lt;&#x2F;code&gt;: an array of URIs for different ways to find the client script.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;We can describe the life cycle of the &lt;code&gt;scriptURI&lt;&#x2F;code&gt; functionality:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Issuance&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;ol&gt;
&lt;li&gt;The token issuer issues the tokens and a smart contract implementing this EIP, with the admin key for the smart contract being &lt;code&gt;SCPrivKey&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The token issuer calls &lt;code&gt;setScriptURI&lt;&#x2F;code&gt; with the &lt;code&gt;scriptURI&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;ul&gt;
&lt;li&gt;Update &lt;code&gt;scriptURI&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;ol&gt;
&lt;li&gt;The token issuer stores the desired &lt;code&gt;script&lt;&#x2F;code&gt; at all the new URI locations and constructs a new &lt;code&gt;scriptURI&lt;&#x2F;code&gt; structure based on this.&lt;&#x2F;li&gt;
&lt;li&gt;The token issuer calls &lt;code&gt;setScriptURI&lt;&#x2F;code&gt; with the new &lt;code&gt;scriptURI&lt;&#x2F;code&gt; structure.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY” and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;We define a scriptURI element using the &lt;code&gt;string[]&lt;&#x2F;code&gt;.
Based on this, we define the smart contract interface below:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5169&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This event emits when the scriptURI is updated, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; so wallets implementing this interface can update a cached script&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ScriptUpdate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newScriptURI&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the scriptURI for the contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; scriptURI&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; scriptURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Update the scriptURI &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; emits event ScriptUpdate(scriptURI memory newScriptURI);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setScriptURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newScriptURI&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The interface MUST be implemented under the following constraints:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The smart contract implementing &lt;code&gt;IERC5169&lt;&#x2F;code&gt; MUST store variables &lt;code&gt;address owner&lt;&#x2F;code&gt; in its state.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The smart contract implementing &lt;code&gt;IERC5169&lt;&#x2F;code&gt; MUST set &lt;code&gt;owner=msg.sender&lt;&#x2F;code&gt; in its constructor.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;ScriptUpdate(...)&lt;&#x2F;code&gt; event MUST be emitted when the &lt;code&gt;setScriptURI&lt;&#x2F;code&gt; function updates the &lt;code&gt;scriptURI&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;setScriptURI(...)&lt;&#x2F;code&gt; function MUST validate that &lt;code&gt;owner == msg.sender&lt;&#x2F;code&gt; &lt;em&gt;before&lt;&#x2F;em&gt; executing its logic and updating any state.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;setScriptURI(...)&lt;&#x2F;code&gt; function MUST update its internal state such that &lt;code&gt;currentScriptURI = newScriptURI&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;scriptURI()&lt;&#x2F;code&gt; function MUST return the &lt;code&gt;currentScriptURI&lt;&#x2F;code&gt; state.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;scriptURI()&lt;&#x2F;code&gt; function MAY be implemented as pure or view.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Any user of the script learned from &lt;code&gt;scriptURI&lt;&#x2F;code&gt; MUST validate the script is either at an immutable location, its URI contains its hash digest, or it implements the separate &lt;code&gt;Authenticity for Client Script&lt;&#x2F;code&gt; EIP, which asserts authenticity using signatures instead of a digest.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This method avoids the need for building secure and certified centralized hosting and allows scripts to be hosted anywhere: IPFS, GitHub or cloud storage.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is backwards-compatible with most existing token standards, including the following commonly-used ones:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;777&#x2F;&quot;&gt;ERC-777&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;test-contract&quot;&gt;Test Contract&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;access&#x2F;Ownable.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERC5169.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC5169&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5169&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Ownable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _scriptURI&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; scriptURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _scriptURI&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setScriptURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newScriptURI&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _scriptURI &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; newScriptURI&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ScriptUpdate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;newScriptURI&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;test-cases-1&quot;&gt;Test Cases&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; expect&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;chai&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; BigNumber&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; Wallet&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ethers&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; ethers&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; network&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; getChainId&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;hardhat&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;describe&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ERC5169&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  before&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt;async&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;    this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;ERC5169&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ethers&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getContractFactory&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ERC5169&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  beforeEach&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt;async&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; targetNFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;    this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;erc5169&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;ERC5169&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;deploy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  it&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Should set script URI&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; async&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; scriptURI&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uri1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uri2&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uri3&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    await&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;erc5169&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;setScriptURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;scriptURI&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      .&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;emit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;erc5169&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ScriptUpdate&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      .&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;withArgs&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;scriptURI&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; currentScriptURI&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;erc5169&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;scriptURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;currentScriptURI&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;toString&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;be&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;scriptURI&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;toString&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;An intuitive implementation is the STL office door token. This NFT is minted and transferred to STL employees. The TokenScript attached to the token contract via the &lt;code&gt;scriptURI()&lt;&#x2F;code&gt; function contains instructions on how to operate the door interface. This takes the form of:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Query for challenge string (random message from IoT interface eg &#x27;Apples-5E3FA1&#x27;).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Receive and display challenge string on Token View, and request &#x27;Sign Personal&#x27;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;On obtaining the signature of the challenge string, send back to IoT device.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;IoT device will unlock door if ec-recovered address holds the NFT.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;With &lt;code&gt;scriptURI()&lt;&#x2F;code&gt; the experience is greatly enhanced as the flow for the user is:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Receive NFT.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Use authenticated NFT functionality in the wallet immediately.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The project with contract, TokenScript and IoT firmware is in use by Smart Token Labs office door and numerous other installations. An example implementation contract: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5169&#x2F;.&#x2F;assets&#x2F;contract&#x2F;ExampleContract.sol&quot;&gt;ERC-5169 Contract Example&lt;&#x2F;a&gt; and TokenScript:  &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5169&#x2F;.&#x2F;assets&#x2F;tokenscript&#x2F;ExampleScript.xml&quot;&gt;ERC-5169 TokenScript Example&lt;&#x2F;a&gt;. Links to the firmware and full sample can be found in the associated discussion linked in the header.
The associated TokenScript can be read from the contract using &lt;code&gt;scriptURI()&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;script-location&quot;&gt;Script location&lt;&#x2F;h3&gt;
&lt;p&gt;While the most straightforward solution to facilitate specific script usage associated with NFTs, is clearly to store such a script on the smart contract. However, this has several disadvantages:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;The smart contract signing key is needed to make updates, causing the key to become more exposed, as it is used more often.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Updates require smart contract interaction. If frequent updates are needed, smart contract calls can become an expensive hurdle.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Storage fee. If the script is large, updates to the script will be costly. A client script is typically much larger than a smart contract.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;For these reasons, storing volatile data, such as token enhancing functionality, on an external resource makes sense. Such an external resource can be either be  hosted centrally, such as through a cloud provider, or privately hosted through a private server, or decentralized hosted, such as the interplanetary filesystem.&lt;&#x2F;p&gt;
&lt;p&gt;While centralized storage for a decentralized functionality goes against the ethos of web3, fully decentralized solutions may come with speed, price or space penalties. This EIP handles this by allowing the function &lt;code&gt;ScriptURI&lt;&#x2F;code&gt; to return multiple URIs, which could be a mix of centralized, individually hosted and decentralized locations.&lt;&#x2F;p&gt;
&lt;p&gt;While this EIP does not dictate the format of the stored script, the script itself could contain pointers to multiple other scripts and data sources, allowing for advanced ways to expand token scripts, such as lazy loading.
The handling of integrity of such secondary data sources is left dependent on the format of the script.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;When a server is involved&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;When the client script does not purely rely on connection to a blockchain node, but also calls server APIs,  the trustworthiness of the server API is called into question. This EIP does not provide any mechanism to assert the authenticity of the API access point. Instead, as long as the client script is trusted, it&#x27;s assumed that it can call any server API in order to carry out token functions. This means the client script can mistrust a server API access point.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;When the scriptURI doesn&#x27;t contain integrity (hash) information&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;We separately authored &lt;code&gt;Authenticity for Client Script&lt;&#x2F;code&gt; EIP to guide on how to use digital signatures efficiently and concisely to ensure authenticity and integrity of scripts not stored at a URI which is a digest of the script itself.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Principal Token</title>
        <published>2022-05-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Julian Traversa</name><uri>https://github.com/JTraversa</uri>
	</author>
	
	<author>
		<name>Robert Robbins</name><uri>https://github.com/robrobbins</uri>
	</author>
	
	<author>
		<name>Alberto Cuesta Cañada</name><uri>https://github.com/alcueca</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5095/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5095-principal-token-standard/9259" />
        

        <id>https://wg-eips.ritovision.com/5095/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:5095"
            label="ERC-5095" />
        

        
        

        
        <summary type="html">Principal tokens (zero-coupon tokens) are redeemable for a single underlying EIP-20 token at a future timestamp.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5095/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Principal tokens represent ownership of an underlying &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;EIP-20&lt;&#x2F;a&gt; token at a future timestamp.&lt;&#x2F;p&gt;
&lt;p&gt;This specification is an extension on the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;EIP-20&lt;&#x2F;a&gt; token that provides basic functionality for depositing
and withdrawing tokens and reading balances and the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2612&#x2F;&quot;&gt;EIP-2612&lt;&#x2F;a&gt; specification that provides
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; signature based approvals.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Principal tokens lack standardization which has led to a difficult to navigate development space and diverse implementation
schemes.&lt;&#x2F;p&gt;
&lt;p&gt;The primary examples include yield tokenization platforms which strip future yield leaving a principal
token behind, as well as fixed-rate money-markets which utilize principal tokens as a medium
to lend&#x2F;borrow.&lt;&#x2F;p&gt;
&lt;p&gt;This inconsistency in implementation makes integration difficult at the application layer as well as
wallet layer which are key catalysts for the space&#x27;s growth.
Developers are currently expected to implement individual adapters for each principal token, as well as adapters for
their pool contracts, and many times adapters for their custodial contracts as well, wasting significant developer resources.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;All Principal Tokens (PTs) MUST implement &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;EIP-20&lt;&#x2F;a&gt; to represent ownership of future underlying redemption.
If a PT is to be non-transferrable, it MAY revert on calls to &lt;code&gt;transfer&lt;&#x2F;code&gt; or &lt;code&gt;transferFrom&lt;&#x2F;code&gt;.
The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;EIP-20&lt;&#x2F;a&gt; operations &lt;code&gt;balanceOf&lt;&#x2F;code&gt;, &lt;code&gt;transfer&lt;&#x2F;code&gt;, &lt;code&gt;totalSupply&lt;&#x2F;code&gt;, etc. operate on the Principal Token balance.&lt;&#x2F;p&gt;
&lt;p&gt;All Principal Tokens MUST implement &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;EIP-20&lt;&#x2F;a&gt;&#x27;s optional metadata extensions.
The &lt;code&gt;name&lt;&#x2F;code&gt; and &lt;code&gt;symbol&lt;&#x2F;code&gt; functions SHOULD reflect the underlying token&#x27;s &lt;code&gt;name&lt;&#x2F;code&gt; and &lt;code&gt;symbol&lt;&#x2F;code&gt; in some way, as well as the origination protocol, and in the case of yield tokenization protocols, the origination money-market.&lt;&#x2F;p&gt;
&lt;p&gt;All Principal Tokens MAY implement &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2612&#x2F;&quot;&gt;EIP-2612&lt;&#x2F;a&gt; to improve the UX of approving PTs on various integrations.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions:&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;underlying: The token that Principal Tokens are redeemable for at maturity.
Has units defined by the corresponding &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;EIP-20&lt;&#x2F;a&gt; contract.&lt;&#x2F;li&gt;
&lt;li&gt;maturity: The timestamp (unix) at which a Principal Token matures. Principal Tokens become redeemable for underlying at or after this timestamp.&lt;&#x2F;li&gt;
&lt;li&gt;fee: An amount of underlying or Principal Token charged to the user by the Principal Token. Fees can exist on redemption or post-maturity yield.&lt;&#x2F;li&gt;
&lt;li&gt;slippage: Any difference between advertised redemption value and economic realities of PT redemption, which is not accounted by fees.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;methods&quot;&gt;Methods&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;underlying&quot;&gt;&lt;code&gt;underlying&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The address of the underlying token used by the Principal Token for accounting, and redeeming.&lt;&#x2F;p&gt;
&lt;p&gt;MUST be an EIP-20 token contract.&lt;&#x2F;p&gt;
&lt;p&gt;MUST &lt;em&gt;NOT&lt;&#x2F;em&gt; revert.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;nderlying&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;nderlyingAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;maturity&quot;&gt;&lt;code&gt;maturity&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The unix timestamp (uint256) at or after which Principal Tokens can be redeemed for their underlying deposit.&lt;&#x2F;p&gt;
&lt;p&gt;MUST &lt;em&gt;NOT&lt;&#x2F;em&gt; revert.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; m&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;aturity&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;imestamp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;converttounderlying&quot;&gt;&lt;code&gt;convertToUnderlying&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The amount of underlying that would be exchanged for the amount of PTs provided, in an ideal scenario where all the conditions are met.&lt;&#x2F;p&gt;
&lt;p&gt;Before maturity, the amount of underlying returned is as if the PTs would be at maturity.&lt;&#x2F;p&gt;
&lt;p&gt;MUST NOT be inclusive of any fees that are charged against redemptions.&lt;&#x2F;p&gt;
&lt;p&gt;MUST NOT show any variations depending on the caller.&lt;&#x2F;p&gt;
&lt;p&gt;MUST NOT reflect slippage or other on-chain conditions, when performing the actual redemption.&lt;&#x2F;p&gt;
&lt;p&gt;MUST NOT revert unless due to integer overflow caused by an unreasonably large input.&lt;&#x2F;p&gt;
&lt;p&gt;MUST round down towards 0.&lt;&#x2F;p&gt;
&lt;p&gt;This calculation MAY NOT reflect the &quot;per-user&quot; price-per-principal-token, and instead should reflect the &quot;average-user&#x27;s&quot; price-per-principal-token, meaning what the average user should expect to see when exchanging to and from.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;onvertToUnderlying&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; p&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;rincipalAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;nderlyingAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;converttoprincipal&quot;&gt;&lt;code&gt;convertToPrincipal&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The amount of principal tokens that the principal token contract would request for redemption in order to provide the amount of underlying specified, in an ideal scenario where all the conditions are met.&lt;&#x2F;p&gt;
&lt;p&gt;MUST NOT be inclusive of any fees.&lt;&#x2F;p&gt;
&lt;p&gt;MUST NOT show any variations depending on the caller.&lt;&#x2F;p&gt;
&lt;p&gt;MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.&lt;&#x2F;p&gt;
&lt;p&gt;MUST NOT revert unless due to integer overflow caused by an unreasonably large input.&lt;&#x2F;p&gt;
&lt;p&gt;MUST round down towards 0.&lt;&#x2F;p&gt;
&lt;p&gt;This calculation MAY NOT reflect the &quot;per-user&quot; price-per-principal-token, and instead should reflect the &quot;average-user&#x27;s&quot; price-per-principal-token, meaning what the average user should expect to see when redeeming.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;onvertToPrincipal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;nderlyingAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; p&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;rincipalAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;maxredeem&quot;&gt;&lt;code&gt;maxRedeem&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Maximum amount of principal tokens that can be redeemed from the &lt;code&gt;holder&lt;&#x2F;code&gt; balance, through a &lt;code&gt;redeem&lt;&#x2F;code&gt; call.&lt;&#x2F;p&gt;
&lt;p&gt;MUST return the maximum amount of principal tokens that could be transferred from &lt;code&gt;holder&lt;&#x2F;code&gt; through &lt;code&gt;redeem&lt;&#x2F;code&gt; and not cause a revert, which MUST NOT be higher than the actual maximum that would be accepted (it should underestimate if necessary).&lt;&#x2F;p&gt;
&lt;p&gt;MUST factor in both global and user-specific limits, like if redemption is entirely disabled (even temporarily) it MUST return 0.&lt;&#x2F;p&gt;
&lt;p&gt;MUST NOT revert.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; m&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;axRedeem&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; h&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;older&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; m&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;axPrincipalAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;previewredeem&quot;&gt;&lt;code&gt;previewRedeem&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block, given current on-chain conditions.&lt;&#x2F;p&gt;
&lt;p&gt;MUST return as close to and no more than the exact amount of underliyng that would be obtained in a &lt;code&gt;redeem&lt;&#x2F;code&gt; call in the same transaction. I.e. &lt;code&gt;redeem&lt;&#x2F;code&gt; should return the same or more &lt;code&gt;underlyingAmount&lt;&#x2F;code&gt; as &lt;code&gt;previewRedeem&lt;&#x2F;code&gt; if called in the same transaction.&lt;&#x2F;p&gt;
&lt;p&gt;MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the redemption would be accepted, regardless if the user has enough principal tokens, etc.&lt;&#x2F;p&gt;
&lt;p&gt;MUST be inclusive of redemption fees. Integrators should be aware of the existence of redemption fees.&lt;&#x2F;p&gt;
&lt;p&gt;MUST NOT revert due to principal token contract specific user&#x2F;global limits. MAY revert due to other conditions that would also cause &lt;code&gt;redeem&lt;&#x2F;code&gt; to revert.&lt;&#x2F;p&gt;
&lt;p&gt;Note that any unfavorable discrepancy between &lt;code&gt;convertToUnderlying&lt;&#x2F;code&gt; and &lt;code&gt;previewRedeem&lt;&#x2F;code&gt; SHOULD be considered slippage in price-per-principal-token or some other type of condition.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; p&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;reviewRedeem&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; p&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;rincipalAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;nderlyingAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;redeem&quot;&gt;&lt;code&gt;redeem&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;At or after maturity, burns exactly &lt;code&gt;principalAmount&lt;&#x2F;code&gt; of Principal Tokens from &lt;code&gt;from&lt;&#x2F;code&gt; and sends &lt;code&gt;underlyingAmount&lt;&#x2F;code&gt; of underlying tokens to &lt;code&gt;to&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Interfaces and other contracts MUST NOT expect fund custody to be present. While custodial redemption of Principal Tokens through the Principal Token contract is extremely useful for integrators, some protocols may find giving the Principal Token itself custody breaks their backwards compatibility.&lt;&#x2F;p&gt;
&lt;p&gt;MUST emit the &lt;code&gt;Redeem&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;p&gt;MUST support a redeem flow where the Principal Tokens are burned from &lt;code&gt;holder&lt;&#x2F;code&gt; directly where &lt;code&gt;holder&lt;&#x2F;code&gt; is &lt;code&gt;msg.sender&lt;&#x2F;code&gt; or &lt;code&gt;msg.sender&lt;&#x2F;code&gt; has EIP-20 approval over the principal tokens of &lt;code&gt;holder&lt;&#x2F;code&gt;.
MAY support an additional flow in which the principal tokens are transferred to the Principal Token contract before the &lt;code&gt;redeem&lt;&#x2F;code&gt; execution, and are accounted for during &lt;code&gt;redeem&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST revert if all of &lt;code&gt;principalAmount&lt;&#x2F;code&gt; cannot be redeemed (due to withdrawal limit being reached, slippage, the holder not having enough Principal Tokens, etc).&lt;&#x2F;p&gt;
&lt;p&gt;Note that some implementations will require pre-requesting to the Principal Token before a withdrawal may be performed. Those methods should be performed separately.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;edeem&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;onpayable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; p&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;rincipalAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;o&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;rom&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;nderlyingAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;maxwithdraw&quot;&gt;&lt;code&gt;maxWithdraw&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Maximum amount of the underlying asset that can be redeemed from the &lt;code&gt;holder&lt;&#x2F;code&gt; principal token balance, through a &lt;code&gt;withdraw&lt;&#x2F;code&gt; call.&lt;&#x2F;p&gt;
&lt;p&gt;MUST return the maximum amount of underlying tokens that could be redeemed from &lt;code&gt;holder&lt;&#x2F;code&gt; through &lt;code&gt;withdraw&lt;&#x2F;code&gt; and not cause a revert, which MUST NOT be higher than the actual maximum that would be accepted (it should underestimate if necessary).&lt;&#x2F;p&gt;
&lt;p&gt;MUST factor in both global and user-specific limits, like if withdrawals are entirely disabled (even temporarily) it MUST return 0.&lt;&#x2F;p&gt;
&lt;p&gt;MUST NOT revert.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; m&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;axWithdraw&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; h&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;older&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; m&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;axUnderlyingAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;previewwithdraw&quot;&gt;&lt;code&gt;previewWithdraw&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block, given current on-chain conditions.&lt;&#x2F;p&gt;
&lt;p&gt;MUST return as close to and no fewer than the exact amount of principal tokens that would be burned in a &lt;code&gt;withdraw&lt;&#x2F;code&gt; call in the same transaction. I.e. &lt;code&gt;withdraw&lt;&#x2F;code&gt; should return the same or fewer &lt;code&gt;principalAmount&lt;&#x2F;code&gt; as &lt;code&gt;previewWithdraw&lt;&#x2F;code&gt; if called in the same transaction.&lt;&#x2F;p&gt;
&lt;p&gt;MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though the withdrawal would be accepted, regardless if the user has enough principal tokens, etc.&lt;&#x2F;p&gt;
&lt;p&gt;MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.&lt;&#x2F;p&gt;
&lt;p&gt;MUST NOT revert due to principal token contract specific user&#x2F;global limits. MAY revert due to other conditions that would also cause &lt;code&gt;withdraw&lt;&#x2F;code&gt; to revert.&lt;&#x2F;p&gt;
&lt;p&gt;Note that any unfavorable discrepancy between &lt;code&gt;convertToPrincipal&lt;&#x2F;code&gt; and &lt;code&gt;previewWithdraw&lt;&#x2F;code&gt; SHOULD be considered slippage in price-per-principal-token or some other type of condition.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; p&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;reviewWithdraw&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;nderlyingAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; p&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;rincipalAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;withdraw&quot;&gt;&lt;code&gt;withdraw&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Burns &lt;code&gt;principalAmount&lt;&#x2F;code&gt; from &lt;code&gt;holder&lt;&#x2F;code&gt; and sends exactly &lt;code&gt;underlyingAmount&lt;&#x2F;code&gt; of underlying tokens to &lt;code&gt;receiver&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST emit the &lt;code&gt;Redeem&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;p&gt;MUST support a withdraw flow where the principal tokens are burned from &lt;code&gt;holder&lt;&#x2F;code&gt; directly where &lt;code&gt;holder&lt;&#x2F;code&gt; is &lt;code&gt;msg.sender&lt;&#x2F;code&gt; or &lt;code&gt;msg.sender&lt;&#x2F;code&gt; has &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;EIP-20&lt;&#x2F;a&gt; approval over the principal tokens of &lt;code&gt;holder&lt;&#x2F;code&gt;.
MAY support an additional flow in which the principal tokens are transferred to the principal token contract before the &lt;code&gt;withdraw&lt;&#x2F;code&gt; execution, and are accounted for during &lt;code&gt;withdraw&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST revert if all of &lt;code&gt;underlyingAmount&lt;&#x2F;code&gt; cannot be withdrawn (due to withdrawal limit being reached, slippage, the holder not having enough principal tokens, etc).&lt;&#x2F;p&gt;
&lt;p&gt;Note that some implementations will require pre-requesting to the principal token contract before a withdrawal may be performed. Those methods should be performed separately.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; w&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ithdraw&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;onpayable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;nderlyingAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eceiver&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; h&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;older&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; p&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;rincipalAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;events&quot;&gt;Events&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;redeem-1&quot;&gt;Redeem&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;from&lt;&#x2F;code&gt; has exchanged &lt;code&gt;principalAmount&lt;&#x2F;code&gt; of Principal Tokens for &lt;code&gt;underlyingAmount&lt;&#x2F;code&gt; of underlying, and transferred that underlying to &lt;code&gt;to&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST be emitted when Principal Tokens are burnt and underlying is withdrawn from the contract in the &lt;code&gt;EIP5095.redeem&lt;&#x2F;code&gt; method.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; R&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;edeem&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;vent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;rom&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;o&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;mount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The Principal Token interface is designed to be optimized for integrators with a core minimal interface alongside optional interfaces to enable backwards compatibility. Details such as accounting and management of underlying are intentionally not specified, as Principal Tokens are expected to be treated as black boxes on-chain and inspected off-chain before use.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;EIP-20&lt;&#x2F;a&gt; is enforced as implementation details such as token approval and balance calculation directly carry over. This standardization makes Principal Tokens immediately compatible with all &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;EIP-20&lt;&#x2F;a&gt; use cases in addition to EIP-5095.&lt;&#x2F;p&gt;
&lt;p&gt;All principal tokens are redeemable upon maturity, with the only variance being whether further yield is generated post-maturity. Given the ubiquity of redemption, the presence of &lt;code&gt;redeem&lt;&#x2F;code&gt; allows integrators to purchase Principal Tokens on an open market, and them later redeem them for a fixed-yield solely knowing the address of the Principal Token itself.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP draws heavily on the design of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4626&#x2F;&quot;&gt;EIP-4626&lt;&#x2F;a&gt; because technically Principal Tokens could be described as a subset of Yield Bearing Vaults, extended with a &lt;code&gt;maturity&lt;&#x2F;code&gt; variable and restrictions on the implementation. However, extending &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4626&#x2F;&quot;&gt;EIP-4626&lt;&#x2F;a&gt; would force PT implementations to include methods (namely, &lt;code&gt;mint&lt;&#x2F;code&gt; and &lt;code&gt;deposit&lt;&#x2F;code&gt;) that are not necessary to the business case that PTs solve. It can also be argued that partial redemptions (implemented via &lt;code&gt;withdraw&lt;&#x2F;code&gt;) are rare for PTs.&lt;&#x2F;p&gt;
&lt;p&gt;PTs mature at a precise second, but given the reactive nature of smart contracts, there can&#x27;t be an event marking maturity, because there is no guarantee of any activity at or after maturity. Emitting an event to notify of maturity in the first transaction after maturity would be imprecise and expensive. Instead, integrators are recommended to either use the first &lt;code&gt;Redeem&lt;&#x2F;code&gt; event, or to track themselves when each PT is expected to have matured.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is fully backward compatible with the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;EIP-20&lt;&#x2F;a&gt; specification and has no known compatibility issues with other standards.
For production implementations of Principal Tokens which do not use EIP-5095, wrapper adapters can be developed and used, or wrapped tokens can be implemented.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; SPDX-License-Identifier: MIT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pragma solidity 0.8.14;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;import {ERC20} from &amp;quot;yield-utils-v2&#x2F;contracts&#x2F;token&#x2F;ERC20.sol&amp;quot;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;import {MinimalTransferHelper} from &amp;quot;yield-utils-v2&#x2F;contracts&#x2F;token&#x2F;MinimalTransferHelper.sol&amp;quot;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;contract ERC5095 is ERC20 {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    using MinimalTransferHelper for ERC20;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;* EVENTS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *****************************************************************************************************************&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    event Redeem(address indexed from, address indexed to, uint256 underlyingAmount);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;* MODIFIERS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *****************************************************************************************************************&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @notice A modifier that ensures the current block timestamp is at or after maturity.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    modifier afterMaturity() virtual {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        require(block.timestamp &amp;gt;= maturity, &amp;quot;BEFORE_MATURITY&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;* IMMUTABLES&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *****************************************************************************************************************&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ERC20 public immutable underlying;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    uint256 public immutable maturity;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;* CONSTRUCTOR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *****************************************************************************************************************&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    constructor(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        string memory name_,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        string memory symbol_,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint8 decimals_,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ERC20 underlying_,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 maturity_&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ) ERC20(name_, symbol_, decimals_) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        underlying = underlying_;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        maturity = maturity_;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;* CORE FUNCTIONS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *****************************************************************************************************************&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @notice Burns an exact amount of principal tokens in exchange for an amount of underlying.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @dev This reverts if before maturity.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @param principalAmount The exact amount of principal tokens to be burned.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @param from The owner of the principal tokens to be redeemed.  If not msg.sender then must have prior approval.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @param to The address to send the underlying tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @return underlyingAmount The total amount of underlying tokens sent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function redeem(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 principalAmount,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address from,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ) public virtual afterMaturity returns (uint256 underlyingAmount) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _decreaseAllowance(from, principalAmount);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &#x2F;&#x2F; Check for rounding error since we round down in previewRedeem.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        require((underlyingAmount = _previewRedeem(principalAmount)) != 0, &amp;quot;ZERO_ASSETS&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _burn(from, principalAmount);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        emit Redeem(from, to, principalAmount);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _transferOut(to, underlyingAmount);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @notice Burns a calculated amount of principal tokens in exchange for an exact amount of underlying.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @dev This reverts if before maturity.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @param underlyingAmount The exact amount of underlying tokens to be received.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @param from The owner of the principal tokens to be redeemed.  If not msg.sender then must have prior approval.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @param to The address to send the underlying tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @return principalAmount The total amount of underlying tokens redeemed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function withdraw(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 underlyingAmount,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address from,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ) public virtual afterMaturity returns (uint256 principalAmount) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        principalAmount = _previewWithdraw(underlyingAmount); &#x2F;&#x2F; No need to check for rounding error, previewWithdraw rounds up.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _decreaseAllowance(from, principalAmount);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _burn(from, principalAmount);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        emit Redeem(from, to, principalAmount);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _transferOut(to, underlyingAmount);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @notice An internal, overridable transfer function.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @dev Reverts on failed transfer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @param to The recipient of the transfer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @param amount The amount of the transfer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function _transferOut(address to, uint256 amount) internal virtual {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        underlying.safeTransfer(to, amount);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;* ACCOUNTING FUNCTIONS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *****************************************************************************************************************&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @notice Calculates the amount of underlying tokens that would be exchanged for a given amount of principal tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @dev Before maturity, it converts to underlying as if at maturity.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @param principalAmount The amount principal on which to calculate conversion.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @return underlyingAmount The total amount of underlying that would be received for the given principal amount..&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function convertToUnderlying(uint256 principalAmount) external view returns (uint256 underlyingAmount) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return _convertToUnderlying(principalAmount);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function _convertToUnderlying(uint256 principalAmount) internal view virtual returns (uint256 underlyingAmount) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return principalAmount;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @notice Converts a given amount of underlying tokens to principal exclusive of fees.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @dev Before maturity, it converts to principal as if at maturity.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @param underlyingAmount The total amount of underlying on which to calculate the conversion.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @return principalAmount The amount principal tokens required to provide the given amount of underlying.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function convertToPrincipal(uint256 underlyingAmount) external view returns (uint256 principalAmount) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return _convertToPrincipal(underlyingAmount);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function _convertToPrincipal(uint256 underlyingAmount) internal view virtual returns (uint256 principalAmount) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return underlyingAmount;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @notice Allows user to simulate redemption of a given amount of principal tokens, inclusive of fees and other&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; current block conditions.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @dev This reverts if before maturity.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @param principalAmount The amount of principal that would be redeemed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @return underlyingAmount The amount of underlying that would be received.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function previewRedeem(uint256 principalAmount) external view afterMaturity returns (uint256 underlyingAmount) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return _previewRedeem(principalAmount);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function _previewRedeem(uint256 principalAmount) internal view virtual returns (uint256 underlyingAmount) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return _convertToUnderlying(principalAmount); &#x2F;&#x2F; should include fees&#x2F;slippage&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @notice Calculates the maximum amount of principal tokens that an owner could redeem.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @dev This returns 0 if before maturity.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @param owner The address for which the redemption is being calculated.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @return maxPrincipalAmount The maximum amount of principal tokens that can be redeemed by the given owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function maxRedeem(address owner) public view returns (uint256 maxPrincipalAmount) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return block.timestamp &amp;gt;= maturity ? _balanceOf[owner] : 0;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @notice Allows user to simulate withdraw of a given amount of underlying tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @dev This reverts if before maturity.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @param underlyingAmount The amount of underlying tokens that would be withdrawn.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @return principalAmount The amount of principal tokens that would be redeemed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function previewWithdraw(uint256 underlyingAmount) external view afterMaturity returns (uint256 principalAmount) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return _previewWithdraw(underlyingAmount);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function _previewWithdraw(uint256 underlyingAmount) internal view virtual returns (uint256 principalAmount) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return _convertToPrincipal(underlyingAmount); &#x2F;&#x2F; should include fees&#x2F;slippage&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @notice Calculates the maximum amount of underlying tokens that can be withdrawn by a given owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @dev This returns 0 if before maturity.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @param owner The address for which the withdraw is being calculated.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @return maxUnderlyingAmount The maximum amount of underlying tokens that can be withdrawn by a given owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function maxWithdraw(address owner) public view returns (uint256 maxUnderlyingAmount) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return _previewWithdraw(maxRedeem(owner));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Fully permissionless use cases could fall prey to malicious implementations which only conform to the interface in this EIP but not the specification, failing to implement proper custodial functionality but offering the ability to purchase Principal Tokens through secondary markets.&lt;&#x2F;p&gt;
&lt;p&gt;It is recommended that all integrators review each implementation for potential ways of losing user deposits before integrating.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;convertToUnderlying&lt;&#x2F;code&gt; method is an estimate useful for display purposes,
and do &lt;em&gt;not&lt;&#x2F;em&gt; have to confer the &lt;em&gt;exact&lt;&#x2F;em&gt; amount of underlying assets their context suggests.&lt;&#x2F;p&gt;
&lt;p&gt;As is common across many standards, it is strongly recommended to mirror the underlying token&#x27;s &lt;code&gt;decimals&lt;&#x2F;code&gt; if at all possible, to eliminate possible sources of confusion and simplify integration across front-ends and for other off-chain users.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Lockable Non-Fungible Tokens</title>
        <published>2022-04-30T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Tyler</name><uri>https://github.com/radiocaca</uri>
	</author>
	
	<author>
		<name>Alex</name><uri>https://github.com/gojazdev</uri>
	</author>
	
	<author>
		<name>John</name><uri>https://github.com/sfumato00</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5058/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5058-erc-721-lockable-standard/9201" />
        

        <id>https://wg-eips.ritovision.com/5058/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:5058"
            label="ERC-5058" />
        

        
        

        
        <summary type="html">Lockable EIP-721 tokens</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5058/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;We propose to extend the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; standard with a secure locking mechanism. The NFT owners approve the operator to lock the NFT through &lt;code&gt;setLockApprovalForAll()&lt;&#x2F;code&gt; or &lt;code&gt;lockApprove()&lt;&#x2F;code&gt;. The approved operator locks the NFT through &lt;code&gt;lock()&lt;&#x2F;code&gt;. The locked NFTs cannot be transferred until the end of the locking period. An immediate use case is to allow NFTs to participate in smart contracts without leaving the wallets of their owners.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;NFTs, enabled by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt;, have exploded in demand. The total market value and the ecosystem continue to grow with more and more blue chip NFTs, which are approximately equivalent to popular intellectual properties in a conventional sense. Despite the vast success, something is left to be desired. Liquidity has always been one of the biggest challenges for NFTs. Several attempts have been made to tackle the liquidity challenge: NFTFi and BendDAO, to name a few. Utilizing the currently prevalent EIP-721 standard, these projects require participating NFTs to be transferred to the projects&#x27; contracts, which poses inconveniences and risks to the owners:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Smart contract risks: NFTs can be lost or stolen due to bugs or vulnerabilities in the contracts.&lt;&#x2F;li&gt;
&lt;li&gt;Loss of utility: NFTs have utility values, such as profile pictures and bragging rights, which are lost when the NFTs are no longer seen under the owners&#x27; custody.&lt;&#x2F;li&gt;
&lt;li&gt;Missing Airdrops: The owners can no longer directly receive airdrops entitled to the NFTs. Considering the values and price fluctuation of some of the airdrops, either missing or not getting the airdrop on time can financially impact the owners.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;All of the above are bad UX, and we believe the EIP-721 standard can be improved by adopting a native locking mechanism:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Instead of being transferred to a smart contract, an NFT remains in self-custody but locked.&lt;&#x2F;li&gt;
&lt;li&gt;While an NFT is locked, its transfer is prohibited. Other properties remain unaffected.&lt;&#x2F;li&gt;
&lt;li&gt;The owners can receive or claim airdrops themselves.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The value of an NFT can be reflected in two aspects: collection value and utility value. Collection value needs to ensure that the holder&#x27;s wallet retains ownership of the NFT forever. Utility value requires ensuring that the holder can verify their NFT ownership in other projects. Both of these aspects require that the NFT remain in its owner&#x27;s wallet.&lt;&#x2F;p&gt;
&lt;p&gt;The proposed standard allows the underlying NFT assets to be managed securely and conveniently by extending the EIP-721 standard to natively support common NFTFi use cases including locking, staking, lending, and crowdfunding. We believe the proposed standard will encourage NFT owners to participate more actively in NFTFi projects and, hence, improve the livelihood of the whole NFT ecosystem.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;Lockable EIP-721 &lt;strong&gt;MUST&lt;&#x2F;strong&gt; implement the &lt;code&gt;IERC5058&lt;&#x2F;code&gt; interfaces:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.8&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; EIP-721 Non-Fungible Token Standard, optional lockable extension&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * ERC721 Token that can be locked for a certain period and cannot be transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * This is designed for a non-escrow staking contract that comes later to lock a user&amp;#39;s NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * while still letting them keep it in their wallet.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * This extension can ensure the security of user tokens during the staking period.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * If the nft lending protocol is compatible with this extension, the trouble caused by the NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * airdrop can be avoided, because the airdrop is still in the user&amp;#39;s wallet&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5058&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when `tokenId` token is locked by `operator` from `from`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Locked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expired&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when `tokenId` token is unlocked by `operator` from `from`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Unlocked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when `owner` enables `approved` to lock the `tokenId` token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; LockApproval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approved&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when `owner` enables or disables (`approved`) `operator` to lock all of its tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; LockApprovalForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approved&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the locker who is locking the `tokenId` token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - `tokenId` must exist.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; lockerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; locker&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Lock `tokenId` token until the block number is greater than `expired` to be unlocked.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - `tokenId` token must be owned by `owner`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - `expired` must be greater than block.number&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - If the caller is not `owner`, it must be approved to lock this token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * by either {lockApprove} or {setLockApprovalForAll}.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Emits a {Locked} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; lock&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expired&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Unlock `tokenId` token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - `tokenId` token must be owned by `owner`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - the caller must be the operator who locks the token by {lock}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Emits a {Unlocked} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; unlock&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Gives permission to `to` to lock `tokenId` token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - The caller must own the token or be an approved lock operator.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - `tokenId` must exist.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Emits an {LockApproval} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; lockApprove&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Approve or remove `operator` as an lock operator for the caller.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Operators can call {lock} for any token owned by the caller.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - The `operator` cannot be the caller.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Emits an {LockApprovalForAll} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setLockApprovalForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approved&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the account lock approved for `tokenId` token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - `tokenId` must exist.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getLockApproved&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns if the `operator` is allowed to lock all of the assets of `owner`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * See {setLockApprovalForAll}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isLockApprovedForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns if the `tokenId` token is locked.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isLocked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the `tokenId` token lock expired time.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; lockExpiredTime&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;nft-lock-approvals&quot;&gt;NFT lock approvals&lt;&#x2F;h3&gt;
&lt;p&gt;An NFT owner can give another trusted operator the right to lock his NFT through the approve functions. The &lt;code&gt;lockApprove()&lt;&#x2F;code&gt; function only approves for the specified NFT, whereas &lt;code&gt;setLockApprovalForAll()&lt;&#x2F;code&gt; approves for all NFTs of the collection under the wallet. When a user participates in an NFTFi project, the project contract calls &lt;code&gt;lock()&lt;&#x2F;code&gt; to lock the user&#x27;s NFT. Locked NFTs cannot be transferred, but the NFTFi project contract can use the unlock function &lt;code&gt;unlock()&lt;&#x2F;code&gt; to unlock the NFT.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;nft-lock-unlock&quot;&gt;NFT lock&#x2F;unlock&lt;&#x2F;h3&gt;
&lt;p&gt;Authorized project contracts have permission to lock NFT with the &lt;code&gt;lock&lt;&#x2F;code&gt; method. Locked NFTs cannot be transferred until the lock time expires. The project contract also has permission to unlock NFT in advance through the &lt;code&gt;unlock&lt;&#x2F;code&gt; function. Note that only the address of the locked NFT has permission to unlock that NFT.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;nft-lock-period&quot;&gt;NFT lock period&lt;&#x2F;h3&gt;
&lt;p&gt;When locking an NFT, one must specify the lock expiration block number, which must be greater than the current block number. When the current block number exceeds the expiration block number, the NFT is automatically released and can be transferred.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;bound-nft&quot;&gt;Bound NFT&lt;&#x2F;h3&gt;
&lt;p&gt;Bound NFT is an extension of this EIP, which implements the ability to mint a boundNFT during the NFT locking period. The boundNFT is identical to the locked NFT metadata and can be transferred. However, a boundNFT only exists during the NFT locking period and will be destroyed after the NFT is unlocked.
BoundNFT can be used to lend, as a staking credential for the contract. The credential can be locked in the contract, but also to the user. In NFT leasing, boundNFT can be rented to users because boundNFT is essentially equivalent to NFT. This consensus, if accepted by all projects, boundNFT will bring more creativity to NFT.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;bound-nft-factory&quot;&gt;Bound NFT Factory&lt;&#x2F;h3&gt;
&lt;p&gt;Bound NFT Factory is a common boundNFT factory, similar to Uniswap&#x27;s &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;EIP-20&lt;&#x2F;a&gt; pairs factory. It uses the create2 method to create a boundNFT contract address for any NFT deterministic. BoundNFT contract that has been created can only be controlled by the original NFT contract.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is compatible with EIP-721.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases written using hardhat can be found &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5058&#x2F;.&#x2F;assets&#x2F;test&#x2F;test.ts&quot;&gt;here&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;You can find an implementation of this standard in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5058&#x2F;.&#x2F;assets&#x2F;ERC5058.sol&quot;&gt;assets&lt;&#x2F;a&gt; folder.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;After being locked, the NFT can not be transferred, so before authorizing locking rights to other project contracts, you must confirm that the project contract can unlock NFT. Otherwise there is a risk of NFT being permanently locked. It is recommended to give a reasonable locking period in use for projects. NFT can be automatically unlocked, which can reduce the risk to a certain extent.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Instruction for transferring ether</title>
        <published>2022-04-30T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Mudit Gupta</name><uri>https://github.com/maxsam4</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5065/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5065-instruction-for-transferring-ether/9107" />
        

        <id>https://wg-eips.ritovision.com/5065/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:5065"
            label="EIP-5065" />
        

        
        

        
        <summary type="html">Instruction for just transferring ether without transferring the flow of execution</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5065/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Add a new instruction that transfers ether to a destination address without handing over the flow of execution to it. It should work similarly to how &lt;code&gt;SELFDESTRUCT (0xFF)&lt;&#x2F;code&gt; transfers ether to the destination without making a call to it.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;From an architectural point of view, execution flow should never be handed over to an untrusted contract. Ethereum currently does not have any ideal way to transfer ether without transferring the flow of execution. People have come up with reentrancy guards and similar solutions to prevent some types of attacks but it&#x27;s not an ideal solution. The only way to transfer ether from smart contracts without triggering a call is to create a dummy contract, send the precise amount of ether to it and then call &lt;code&gt;SELFDESTRUCT (0xFF)&lt;&#x2F;code&gt; from it.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce a new instruction, &lt;code&gt;AIRDROP&lt;&#x2F;code&gt; (&lt;code&gt;0xFG&lt;&#x2F;code&gt;) that transfers ether to the destination without making a call to it.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;stack-input&quot;&gt;Stack input&lt;&#x2F;h3&gt;
&lt;p&gt;address: the account to send ether to.
value: value in wei to send to the account.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas&quot;&gt;Gas&lt;&#x2F;h3&gt;
&lt;p&gt;The total gas cost should be the sum of a static cost + address_access_cost + value_to_empty_account_cost.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Static cost: 6700&lt;&#x2F;li&gt;
&lt;li&gt;Dynamic cost:
&lt;ol&gt;
&lt;li&gt;address_access_cost: If the target is not in &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt;, charge &lt;code&gt;COLD_ACCOUNT_ACCESS_COST&lt;&#x2F;code&gt; gas, and add the address to &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt;. Otherwise, charge &lt;code&gt;WARM_STORAGE_READ_COST&lt;&#x2F;code&gt; gas. Currently, &lt;code&gt;COLD_ACCOUNT_ACCESS_COST&lt;&#x2F;code&gt; is 2600 while &lt;code&gt;WARM_STORAGE_READ_COST&lt;&#x2F;code&gt; is 100.&lt;&#x2F;li&gt;
&lt;li&gt;value_to_empty_account_cost: If value is not 0 and the address given points to an empty account, then value_to_empty_account_cost is the account creation gas cost which currently is 25000. An account is empty if its balance is 0, its nonce is 0 and it has no code.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This behavior is already possible by deploying a new contract that does &lt;code&gt;SELFDESTRUCT (0xFF)&lt;&#x2F;code&gt; but it is prohibitively expensive. In most scenarios, the contract author only wants to transfer ether rather than transferring control of the execution. ERC20 can be used as a case study for this where most users transfer funds without a post-transfer hook.&lt;&#x2F;p&gt;
&lt;p&gt;This instruction allows contracts to safely pass ether to an untrusted address without worrying about reentrancy or other malicious things an untrusted contract can do on.&lt;&#x2F;p&gt;
&lt;p&gt;The static gas cost is derived by subtracting the gas stipend (2300) from the positive_value_cost of &lt;code&gt;CALL (0xF1)&lt;&#x2F;code&gt; opcode which is currently set to 9000.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No known issues as this is a new instruction that does not affect any old instructions and does not break any valid assumptions since it make not anything impossible possible.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TODO&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;No known security risks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;creativecommons.org&#x2F;publicdomain&#x2F;zero&#x2F;1.0&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Remove the limit on contract code size</title>
        <published>2022-04-21T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Qi Zhou</name><uri>https://github.com/qizhou</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5027/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5027-unlimit-contract-code-size/9010" />
        

        <id>https://wg-eips.ritovision.com/5027/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:5027"
            label="EIP-5027" />
        

        
        

        
        <summary type="html">Change the limit on contract size from 24576 to infinity</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5027/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Remove the limit on the contract code size, i.e., only limit the contract code size by block gas limit, with minimal changes to existing code and proper gas metering adjustment to avoid possible attacks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The motivation is to remove the limit on the code size so that users can deploy a large-code contract without worrying about splitting the contract into several sub-contracts.&lt;&#x2F;p&gt;
&lt;p&gt;With the dramatic growth of dApplications, the functionalities of smart contracts are becoming more and more complicated, and thus, the sizes of newly developed contracts are steadily increasing.  As a result, we are facing more and more issues with the 24576-bytes contract size limit.  Although several techniques such as splitting a large contract into several sub-contracts can alleviate the issue, these techniques inevitably increase the burden of developing&#x2F;deploying&#x2F;maintaining smart contracts.&lt;&#x2F;p&gt;
&lt;p&gt;The proposal implements a solution to remove the existing 24576-bytes limit of the code size.  Further, the proposal aims to minimize the changes in the client implementation (e.g., Geth) with&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;proper gas metering to avoid abusing the node resources for contract-related opcodes, i.e, &lt;code&gt;CODESIZE (0x38)&#x2F;CODECOPY (0x39)&#x2F;EXTCODESIZE (0x3B)&#x2F;EXTCODECOPY (0x3C)&#x2F;EXTCODEHASH (0x3F)&#x2F;DELEGATECALL (0xF4)&#x2F;CALL (0xF1)&#x2F;CALLCODE (0xF2)&#x2F;STATICCALL (0xFA)&#x2F;CREATE (0xF0)&#x2F;CREATE2 (0xF5)&lt;&#x2F;code&gt;; and&lt;&#x2F;li&gt;
&lt;li&gt;no change to the existing structure of the Ethereum state.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FORK_BLKNUM&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;TBD&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CODE_SIZE_UNIT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;24576&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;COLD_ACCOUNT_CODE_ACCESS_COST_PER_UNIT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;2600&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CREATE_DATA_GAS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;200&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= FORK_BLKNUM&lt;&#x2F;code&gt;, the contract creation initialization can return data with any length, but the contract-related opcodes will take extra gas as defined below:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;For &lt;code&gt;CODESIZE&#x2F;CODECOPY&#x2F;EXTCODESIZE&#x2F;EXTCODEHASH&lt;&#x2F;code&gt;, the gas is unchanged.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;For CREATE&#x2F;CREATE2, if the newly created contract size &amp;gt; &lt;code&gt;CODE_SIZE_UNIT&lt;&#x2F;code&gt;, the opcodes will take extra write gas as&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;code&gt;(CODE_SIZE - CODE_SIZE_UNIT) * CREATE_DATA_GAS&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;For &lt;code&gt;EXTCODECOPY&#x2F;CALL&#x2F;CALLCODE&#x2F;DELEGATECALL&#x2F;STATICCALL&lt;&#x2F;code&gt;, if the contract code size &amp;gt; &lt;code&gt;CODE_SIZE_UNIT&lt;&#x2F;code&gt;, then the opcodes will take extra gas as&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(CODE_SIZE - 1) &#x2F;&#x2F; CODE_SIZE_UNIT * COLD_ACCOUNT_CODE_ACCESS_COST_PER_UNIT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;if the contract is not in &lt;code&gt;accessed_code_in_addresses&lt;&#x2F;code&gt; or &lt;code&gt;0&lt;&#x2F;code&gt; if the contract is in &lt;code&gt;accessed_code_in_addresses&lt;&#x2F;code&gt;, where &lt;code&gt;&#x2F;&#x2F;&lt;&#x2F;code&gt; is the integer divide operator, and &lt;code&gt;accessed_code_in_addresses: Set[Address]&lt;&#x2F;code&gt; is a transaction-context-wide set similar to &lt;code&gt;access_addresses&lt;&#x2F;code&gt; and &lt;code&gt;accessed_storage_keys&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;When a transaction execution begins, &lt;code&gt;accessed_code_in_addresses&lt;&#x2F;code&gt; will include &lt;code&gt;tx.sender&lt;&#x2F;code&gt;, &lt;code&gt;tx.to&lt;&#x2F;code&gt;, and all precompiles.&lt;&#x2F;p&gt;
&lt;p&gt;When &lt;code&gt;CREATE&#x2F;CREATE2&#x2F;EXTCODECOPY&#x2F;CALL&#x2F;CALLCODE&#x2F;DELEGATECALL&#x2F;STATICCALL&lt;&#x2F;code&gt; is called, immediately add the address to &lt;code&gt;accessed_code_in_addresses&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;gas-metering&quot;&gt;Gas Metering&lt;&#x2F;h3&gt;
&lt;p&gt;The goal is to measure the CPU&#x2F;IO cost of the contract read&#x2F;write operations reusing existing gas metering so that the resources will not be abused.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;For code-size-related opcodes (&lt;code&gt;CODESIZE&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt;), we would expect the client to implement a mapping from the hash of code to the size, so reading the code size of a large contract should still be O(1).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;For &lt;code&gt;CODECOPY&lt;&#x2F;code&gt;, the data is already loaded in memory (as part of &lt;code&gt;CALL&#x2F;CALLCODE&#x2F;DELEGATECALL&#x2F;STATICCALL&lt;&#x2F;code&gt;), so we do not charge extra gas.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;For &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt;, the value is already in the account, so we do not charge extra gas.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;For &lt;code&gt;EXTCODECOPY&#x2F;CALL&#x2F;CALLCODE&#x2F;DELEGATECALL&#x2F;STATICCALL&lt;&#x2F;code&gt;, since it will read extra data from the database, we will additionally charge &lt;code&gt;COLD_ACCOUNT_CODE_ACCESS_COST_PER_UNIT&lt;&#x2F;code&gt; per extra &lt;code&gt;CODE_SIZE_UNIT&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;For &lt;code&gt;CREATE&#x2F;CREATE2&lt;&#x2F;code&gt;, since it will create extra data to the database, we will additionally charge &lt;code&gt;CREATE_DATA_GAS&lt;&#x2F;code&gt; per extra bytes.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;All existing contracts will not be impacted by the proposal.&lt;&#x2F;p&gt;
&lt;p&gt;Only contracts deployed before &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;170&#x2F;&quot;&gt;EIP-170&lt;&#x2F;a&gt; could possibly be longer than the current max code size, and the reference implementation was able to successfully import all blocks before that fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The reference implementation on Geth is available at &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5027&#x2F;.&#x2F;assets&#x2F;0001-unlimit-code-size.patch&quot;&gt;0001-unlimit-code-size.patch&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Increase price of SSTORE from zero to non-zero to 40k gas</title>
        <published>2022-04-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Green</name><uri>https://github.com/greenlucid</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5022/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-proposal-increase-cost-of-sstore-from-20k-to-x-when-creating-new-storage/7614" />
        

        <id>https://wg-eips.ritovision.com/5022/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:5022"
            label="EIP-5022" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5022/">&lt;h3 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h3&gt;
&lt;p&gt;Increase the price of the SSTORE opcode from &lt;code&gt;20_000&lt;&#x2F;code&gt; gas to &lt;code&gt;40_000&lt;&#x2F;code&gt; gas when the original slot is zero and the resultant slot is non-zero.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h3&gt;
&lt;p&gt;The cost of creating a piece of new state increases as state is larger. However, the price for creating every new storage slot has not increased.
All resources are merged into the same pricing mechanism. If the price for creating new storage slots is fixed, then it needs to be manually changed.&lt;&#x2F;p&gt;
&lt;p&gt;One of the main reasons for not increasing gas limit is the increase of state. In that regard, because the cost of creating storage is higher than its price, all the users of all the other opcodes are subsidizing the creation of state. If state creation was more precisely priced, raising gas limit would be more feasible, and would benefit the users.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-not-also-raise-the-cost-of-non-zero-to-non-zero&quot;&gt;Why not also raise the cost of non-zero to non-zero?&lt;&#x2F;h3&gt;
&lt;p&gt;Rewriting storage does not affect state growth, which is the main issue this EIP is addressing. Rewriting storage may also be underpriced.
Increasing the price of state growth will, at least, incentivize developers to reuse storage instead.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-not-also-increase-the-gas-refund-from-setting-non-zero-to-zero&quot;&gt;Why not also increase the gas refund from setting non-zero to zero?&lt;&#x2F;h3&gt;
&lt;p&gt;More discussion is needed on this.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-not-a-better-state-solution&quot;&gt;Why not a better state solution?&lt;&#x2F;h3&gt;
&lt;p&gt;Whereas solutions like state rent, or state expiry have been researched for a long time, they will not be ready on the short to medium term. So, it is desirable to patch pricing for the short term. Opcode repricing has been done before, so it should not impose a large development time investment for clients.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-was-that-specific-amount-chosen&quot;&gt;Why was that specific amount chosen?&lt;&#x2F;h3&gt;
&lt;p&gt;The current pricing was made off a naive approach of benchmarking opcodes in a laptop. Not only it did not consider the long term problem of having the same price for a resource that costs more over time, the benchmark itself was wrong. This price is closer to what the naive original benchmark should have been. It could go higher, but that may be too disruptive.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;is-this-too-disruptive&quot;&gt;Is this too disruptive?&lt;&#x2F;h3&gt;
&lt;p&gt;This change will severely impact the gas cost of many applications. The network does not have to subsidize state growth at the expense of more expensive regular transactions, so even if it is too disruptive, it will increase the health of the network.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FORK_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;TBD&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;NEW_STORAGE_PRICE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;40_000&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;For blocks where &lt;code&gt;block.number &amp;gt;= FORK_BLOCK&lt;&#x2F;code&gt;, a new gas schedule applies. Make &lt;code&gt;SSTORE_SET_GAS&lt;&#x2F;code&gt;, the price when a slot is set from zero to non-zero, equal &lt;code&gt;NEW_STORAGE_PRICE&lt;&#x2F;code&gt;. All other costs remain the same.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;backwards-compatibility&quot;&gt;Backwards compatibility&lt;&#x2F;h3&gt;
&lt;p&gt;Contracts that depend on hardcoded gas costs will break if they create state.&lt;&#x2F;p&gt;
&lt;p&gt;It is a gas schedule change, so transactions from an epoch before FORK_BLOCK should be treated with previous gas costs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;go-ethereum&#x2F;pull&#x2F;24725&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security considerations&lt;&#x2F;h2&gt;
&lt;p&gt;TODO&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Filesystem-like Interface for Contracts</title>
        <published>2022-04-18T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Qi Zhou</name><uri>https://github.com/qizhou</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5018/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5018-directory-standard/8958" />
        

        <id>https://wg-eips.ritovision.com/5018/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:5018"
            label="ERC-5018" />
        

        
        

        
        <summary type="html">An interface to provide access to binary objects similar to filesystems.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5018/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The following standardizes an API for directories and files within smart contracts, similar to traditional filesystems.
This standard provides basic functionality to read&#x2F;write binary objects of any size, as well as allow reading&#x2F;writing chunks of the object if the object is too large to fit in a single transaction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;A standard interface allows any binary objects on EVM-based blockchain to be re-used by other dApps.&lt;&#x2F;p&gt;
&lt;p&gt;With &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4804&#x2F;&quot;&gt;EIP-4804&lt;&#x2F;a&gt;, we are able to locate a Web3 resource on blockchain using HTTP-style URIs. One application of Web3 resources are web contents that are referenced within a directory using relative paths such as HTML&#x2F;SVG. This standard proposes a contract-based directory to simplify the mapping between local web contents and on-chain web contents. Further, with relative paths referenced in the web contents and EIP-4804, the users will have a consistent view of the web contents locally and on-chain.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;directory&quot;&gt;Directory&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;methods&quot;&gt;Methods&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;write&quot;&gt;write&lt;&#x2F;h5&gt;
&lt;p&gt;Writes binary &lt;code&gt;data&lt;&#x2F;code&gt; to the file &lt;code&gt;name&lt;&#x2F;code&gt; in the directory by an account with write permission.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function write(bytes memory name, bytes memory data) external payable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;read&quot;&gt;read&lt;&#x2F;h5&gt;
&lt;p&gt;Returns the binary &lt;code&gt;data&lt;&#x2F;code&gt; from the file &lt;code&gt;name&lt;&#x2F;code&gt; in the directory and existence of the file.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function read(bytes memory name) external view returns (bytes memory data, bool exist)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;fallback-read&quot;&gt;fallback read&lt;&#x2F;h5&gt;
&lt;p&gt;Returns the binary &lt;code&gt;data&lt;&#x2F;code&gt; from the file &lt;code&gt;prefixedName&lt;&#x2F;code&gt; (prefixed with &lt;code&gt;&#x2F;&lt;&#x2F;code&gt;) in the directory.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;fallback(bytes calldata prefixedName) external returns (bytes memory data) &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;size&quot;&gt;size&lt;&#x2F;h5&gt;
&lt;p&gt;Returns the size of the &lt;code&gt;data&lt;&#x2F;code&gt; from the file &lt;code&gt;name&lt;&#x2F;code&gt; in the directory and the number of chunks of the data.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function size(bytes memory name) external view returns (uint256 size, uint256 chunks)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;remove&quot;&gt;remove&lt;&#x2F;h5&gt;
&lt;p&gt;Removes the file &lt;code&gt;name&lt;&#x2F;code&gt; in the directory and returns the number of chunks removed (0 means the file does not exist) by an account with write permission.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function remove(bytes memory name) external returns (uint256 numOfChunksRemoved)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;countchunks&quot;&gt;countChunks&lt;&#x2F;h5&gt;
&lt;p&gt;Returns the number of chunks of the file &lt;code&gt;name&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function countChunks(bytes memory name) external view returns (uint256 numOfChunks);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;writechunk&quot;&gt;writeChunk&lt;&#x2F;h5&gt;
&lt;p&gt;Writes a chunk of data to the file by an account with write permission. The write will fail if &lt;code&gt;chunkId &amp;gt; numOfChunks&lt;&#x2F;code&gt;, i.e., the write must append the file or replace the existing chunk.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; function writeChunk(bytes memory name, uint256 chunkId, bytes memory chunkData) external payable;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;readchunk&quot;&gt;readChunk&lt;&#x2F;h5&gt;
&lt;p&gt;Returns the chunk data of the file &lt;code&gt;name&lt;&#x2F;code&gt; and the existence of the chunk.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function readChunk(bytes memory name, uint256 chunkId) external view returns (bytes memory chunkData, bool exist);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;chunksize&quot;&gt;chunkSize&lt;&#x2F;h5&gt;
&lt;p&gt;Returns the size of a chunk of the file &lt;code&gt;name&lt;&#x2F;code&gt; and the existence of the chunk.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function chunkSize(bytes memory name, uint256 chunkId) external view returns (uint256 chunkSize, bool exist);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;removechunk&quot;&gt;removeChunk&lt;&#x2F;h5&gt;
&lt;p&gt;Removes a chunk of the file &lt;code&gt;name&lt;&#x2F;code&gt; and returns &lt;code&gt;false&lt;&#x2F;code&gt; if such chunk does not exist. The method should be called by an account with write permission.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function removeChunk(bytes memory name, uint256 chunkId) external returns (bool exist);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;truncate&quot;&gt;truncate&lt;&#x2F;h5&gt;
&lt;p&gt;Removes the chunks of the file &lt;code&gt;name&lt;&#x2F;code&gt; in the directory from the given &lt;code&gt;chunkId&lt;&#x2F;code&gt; and returns the number of chunks removed by an account with write permission. When &lt;code&gt;chunkId = 0&lt;&#x2F;code&gt;, the method is essentially the same as &lt;code&gt;remove()&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function truncate(bytes memory name, uint256 chunkId) external returns (uint256 numOfChunksRemoved);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;getchunkhash&quot;&gt;getChunkHash&lt;&#x2F;h5&gt;
&lt;p&gt;Returns the hash value of the chunk data.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function getChunkHash(bytes memory name, uint256 chunkId) external view returns (bytes32);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;One issue of uploading the web contents to the blockchain is that the web contents may be too large to fit into a single transaction. As a result, the standard provides chunk-based operations so that uploading a content can be split into several transactions. Meanwhile, the read operation can be done in a single transaction, i.e., with a single Web3 URL defined in EIP-4804.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;interactions-between-unchunked-chunked-functions&quot;&gt;Interactions Between Unchunked&#x2F;Chunked Functions&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;read&lt;&#x2F;code&gt; method should return the concatenated chunked data written by &lt;code&gt;writeChunk&lt;&#x2F;code&gt; method. The following gives some examples of the interactions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;read(&quot;hello.txt&quot;)&lt;&#x2F;code&gt; =&amp;gt; &quot;&quot; (file is empty)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;writeChunk(&quot;hello.txt&quot;, 0, &quot;abc&quot;)&lt;&#x2F;code&gt; will succeed&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;read(&quot;hello.txt&quot;)&lt;&#x2F;code&gt; =&amp;gt; &quot;abc&quot;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;writeChunk(&quot;hello.txt&quot;, 1, &quot;efg&quot;)&lt;&#x2F;code&gt; will succeed&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;read(&quot;hello.txt&quot;)&lt;&#x2F;code&gt; =&amp;gt; &quot;abcefg&quot;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;writeChunk(&quot;hello.txt&quot;, 0, &quot;aaa&quot;)&lt;&#x2F;code&gt; will succeed (replace chunk 0&#x27;s data)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;read(&quot;hello.txt&quot;)&lt;&#x2F;code&gt; =&amp;gt; &quot;aaaefg&quot;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;writeChunk(&quot;hello.txt&quot;, 3, &quot;hij&quot;)&lt;&#x2F;code&gt; will fail because the operation is not replacement or append.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;With &lt;code&gt;writeChunk&lt;&#x2F;code&gt; method, we allow writing a file with external data that exceeds the current calldata limit (e.g., 1.8MB now), and it is able to read the whole file in a single &lt;code&gt;read&lt;&#x2F;code&gt; method (which is friendly for large web objects such as HTML&#x2F;SVG&#x2F;PNG&#x2F;JPG, etc).&lt;&#x2F;p&gt;
&lt;p&gt;For &lt;code&gt;write&lt;&#x2F;code&gt; method, calling a &lt;code&gt;write&lt;&#x2F;code&gt; method will replace all data chunks of the file with &lt;code&gt;write&lt;&#x2F;code&gt; method data, and one implementation can be:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;writeChunk(filename, chunkId=0, data_from_write)&lt;&#x2F;code&gt; to chunk 0 with the same &lt;code&gt;write&lt;&#x2F;code&gt; method data; and&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;truncate(filename, chunkId=1)&lt;&#x2F;code&gt;, which will remove the rest chunks.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backwards compatibility issues were identified.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;No security considerations were found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Extend EIP-1155 with rentable usage rights</title>
        <published>2022-04-17T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>DerivStudio</name><uri>https://github.com/DerivStudio</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5187/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-draft-extending-erc1155-with-rentable-usage-rights/9553/4" />
        

        <id>https://wg-eips.ritovision.com/5187/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:5187"
            label="ERC-5187" />
        

        
        

        
        <summary type="html">Separate ownership and usage rights of EIP-1155 to allow users to use NFTs for an allotted time and return them to owners after expiration.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5187/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is an extension of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;EIP-1155&lt;&#x2F;a&gt;. It proposes to introduce separable, rentable, and transferable usage rights (in the form of NFT-IDs), enabling the property owner (the only NFT holder) to rent out the NFT to multiple users (ID holders) at the same time for different terms, and be withdrawn by smart contract upon expiration.&lt;&#x2F;p&gt;
&lt;p&gt;The property owner always retains ownership and is able to transfer the NFT to others during the lease.&lt;&#x2F;p&gt;
&lt;p&gt;The proposal also supports the sublease and renewal of the rental so that users can freely transfer the usage rights among each other and extend the lease term. Early return of NFTs can also be achieved by subletting the usage rights back to the property owners.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The well-accepted &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; and EIP-1155 standards focused on the ownership of unique assets, quite sensible in the time of NFTs being used primarily as arts and collectibles, or, you can say, as private property rights.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;first-step-expirable-nfts&quot;&gt;First Step: &quot;Expirable&quot; NFTs&lt;&#x2F;h3&gt;
&lt;p&gt;The advent of private ownership in the real world has promoted the vigorous development of the modern economy, and we believe that the usage right will be the first detachable right widely applied in the blockchain ecosystem. As NFTs are increasingly applied in rights, finance, games, and the Metaverse, the value of NFT is no longer simply the proof of ownership, but with limitless practice use scenarios. For example, artists may wish to rent out their artworks to media or audiences within specific periods, and game guilds may wish to rent out game items to new players to reduce their entry costs.&lt;&#x2F;p&gt;
&lt;p&gt;The lease&#x2F;rental of NFTs in the crypto space is not a new topic, but the implementation of leasing has long relied on over-collateralization, centralized custody, or pure trust, which significantly limits the boom of the leasing market. Therefore, a new type of &quot;expirable&quot; NFTs that can be automatically withdrawn upon expiration through smart contract is proposed, at the technical level, to eliminate those bottlenecks. Based on that, a new leasing model that is decentralized, collateral-free, and operated purely &quot;on-chain&quot; may disrupt the way people trade and use NFTs. Thus, this EIP proposal is here to create &quot;expirable&quot; NFTs compatible with EIP-1155.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;then-make-everything-transferable&quot;&gt;Then, Make Everything Transferable&lt;&#x2F;h3&gt;
&lt;p&gt;The way we achieve leasing is to separate ownership and usage rights, and beyond that, we focus more on making them freely priced and traded after separation, which is impossible to happen in the traditional financial field. Imagine the below scenarios: i) as a landlord, you can sell your house in rental to others without affecting the tenancy, and your tenants will then pay rent to the new landlord; ii) as a tenant, you can sublet the house to others without the consent of the landlord, and even the one sublets can continue subletting the house until the lease term is close the last tenant can apply for a renewal of the lease. All of this can happen in the blockchain world, and that&#x27;s the beauty of blockchain. Without permission, without trust, code is the law.&lt;&#x2F;p&gt;
&lt;p&gt;Making ownership and usage rights transferable may further revolutionize the game rules in NFT&#x27;s field, both in capital allocation and NFT development. Buying NFT ownership is more like investing in stocks, and the price is determined by market expectations of the project; renting the usage right is less speculative, so the price is easier to determine based on supply and demand. The ownership market and the usage-right market will function to meet the needs of target participants and achieve a balance that is conducive to the long-term and stable development of NFT projects.
Based on the above, we propose this EIP standard to complement the current EIP scopes and introduce those functions as new standards.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;  Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0x6938e358.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IRental&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is IERC165,IERC1155 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when user rent NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - `id` The id of the current token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - `user` The address to rent the NFT usage rights&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - `amount` The amount of usage rights&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - `expire` The specified period of time to rent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Rented&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expire&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * MUST trigger on any successful call to `renew(address user,uint256 id)`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *  - `id` The id of the current token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *  - `user` The user of the NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *  - `expire` The new specified period of time to rent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Renew&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expire&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *  MUST trigger on any successful call to `renew(address user,uint256 id,uint256 expire)`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *  - `id` The id of the current token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *  - `from` The current user of the NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *  - `to` The new user&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Sublet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when the NFT owner takes back the usage rights from the tenant (the `user`)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - id The id of the current token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - user The address to rent the NFT&amp;#39;s usage rights&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - amount Amount of usage rights&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TakeBack&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Function to rent out usage rights&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - from The address to approve&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - to The address to rent the NFT usage rights&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - id The id of the current token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - amount The amount of usage rights&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - expire The specified period of time to rent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeRent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expire&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Function to take back usage rights after the end of the tenancy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - user The address to rent the NFT&amp;#39;s usage rights&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - tokenId The id of the current token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; takeBack&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Return the NFT to the address of the NFT property right owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; propertyRightOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Return the total supply amount of the current token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Return expire The specified period of time to rent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; expireAt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *   extended rental period&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *  - `id` The id of the current token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *  - `user` The user of the NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *  - `expire` The new specified period of time to rent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; renew&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expire&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *  transfer of usage right&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *  - `id` The id of the current token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *  - `user` The user of the NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *  - `expire` The new specified period of time to rent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; sublet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Implementing the proposal to create rentable NFTs has two main benefits.&lt;&#x2F;p&gt;
&lt;p&gt;One is that NFTs with multiple usage rights allow NFT property owners to perform the safeRent function and rent out usage rights to multiple users at the same time. For each usage right leased and expires, the property owner can perform the takeBack function to retrieve the usage right.&lt;&#x2F;p&gt;
&lt;p&gt;Another benefit is that the transfer of usage rights can be quite flexible. The user can transfer the usage rights to other users by calling the Sublet function during the lease period, and can also extend the lease period of the usage rights by asking the property owner to perform the Renewal function. It is worth mentioning that if the user sublet the NFT to the property owner, it will realize the early return of NFT before the end of the lease period.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;As mentioned at the beginning, this is an extension of EIP-1155. Therefore, it is fully backward compatible with EIP-1155.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Disclaimer of copyright and related rights through &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Zodiac Modular Accounts</title>
        <published>2022-04-14T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Auryn Macmillan</name><uri>https://github.com/auryn-macmillan</uri>
	</author>
	
	<author>
		<name>Kei Kreutler</name><uri>https://github.com/keikreutler</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5005/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-zodiac-a-composable-design-philosophy-for-daos/8963" />
        

        <id>https://wg-eips.ritovision.com/5005/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:5005"
            label="ERC-5005" />
        

        
        

        
        <summary type="html">Composable interoperable programmable accounts</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5005/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP standardizes interfaces for composable and interoperable tooling for programmable Ethereum accounts. These interfaces separate contract accounts (&quot;avatars&quot;) from their authentication and execution logic (&quot;guards&quot; and &quot;modules&quot;). Avatars implement the &lt;code&gt;IAvatar&lt;&#x2F;code&gt; interface, and guards implement the &lt;code&gt;IGuard&lt;&#x2F;code&gt; interface. Modules may take any form.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, most programmable accounts (like DAO tools and frameworks) are built as monolithic systems where the authorization and execution logic are coupled, either within the same contract or in a tightly integrated system of contracts. This needlessly inhibits the flexibility of these tools and encourages platform lock-in via high switching costs.&lt;&#x2F;p&gt;
&lt;p&gt;By using the this EIP standard to separate concerns (decoupling authentication and execution logic), users are able to:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Enable flexible, module-based control of programmable accounts&lt;&#x2F;li&gt;
&lt;li&gt;Easily switch between tools and frameworks without unnecessary overhead.&lt;&#x2F;li&gt;
&lt;li&gt;Enable multiple control mechanism in parallel.&lt;&#x2F;li&gt;
&lt;li&gt;Enable cross-chain &#x2F; cross-layer governance.&lt;&#x2F;li&gt;
&lt;li&gt;Progressively decentralize their governance as their project and community matures.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP consists of four key concepts:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Avatars&lt;&#x2F;strong&gt; are programmable Ethereum accounts. Avatars are the address that holds balances, owns systems, executes transaction, is referenced externally, and ultimately represents your DAO. Avatars MUST implement the &lt;code&gt;IAvatar&lt;&#x2F;code&gt; interface.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Modules&lt;&#x2F;strong&gt; are contracts enabled by an avatar that implement some execution logic.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Modifiers&lt;&#x2F;strong&gt; are contracts that sit between modules and avatars to modify the module&#x27;s behavior. For example, they might enforce a delay on all functions a module attempts to execute or limit the scope of transactions that can be initiated by the module. Modifiers MUST implement the &lt;code&gt;IAvatar&lt;&#x2F;code&gt; interface.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Guards&lt;&#x2F;strong&gt; are contracts that MAY be enabled on modules or modifiers and implement pre- or post-checks on each transaction executed by those modules or modifiers. This allows avatars to do things like limit the scope of addresses and functions that a module or modifier can call or ensure a certain state is never changed by a module or modifier. Guards MUST expose the &lt;code&gt;IGuard&lt;&#x2F;code&gt; interface. Modules, modifiers, and avatars that wish to be guardable MUST inherit &lt;code&gt;Guardable&lt;&#x2F;code&gt;, MUST call &lt;code&gt;checkTransaction()&lt;&#x2F;code&gt; before triggering execution on their target, and MUST call &lt;code&gt;checkAfterExecution()&lt;&#x2F;code&gt; after execution is complete.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Avatar - A contract that manages modules that can execute transactions via this contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; &amp;gt;=0.7.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0.9&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;Enum.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IAvatar&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EnabledModule&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; module&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DisabledModule&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; module&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ExecutionFromModuleSuccess&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; module&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ExecutionFromModuleFailure&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; module&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Enables a module on the avatar.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Can only be called by the avatar.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Modules should be stored as a linked list.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Must emit EnabledModule(address module) if successful.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; module&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Module to be enabled.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; enableModule&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; module&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Disables a module on the avatar.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Can only be called by the avatar.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Must emit DisabledModule(address module) if successful.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; prevModule&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address that pointed to the module to be removed in the linked list&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; module&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Module to be removed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; disableModule&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; prevModule&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; module&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Allows a Module to execute a transaction.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Can only be called by an enabled module.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Must emit ExecutionFromModuleSuccess(address module) if successful.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Must emit ExecutionFromModuleFailure(address module) if unsuccessful.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Destination address of module transaction.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Ether value of module transaction.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Data payload of module transaction.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; operation&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Operation type of module transaction: 0 == call, 1 == delegate call.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; execTransactionFromModule&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        Enum&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;Operation&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Allows a Module to execute a transaction and return data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Can only be called by an enabled module.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Must emit ExecutionFromModuleSuccess(address module) if successful.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Must emit ExecutionFromModuleFailure(address module) if unsuccessful.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Destination address of module transaction.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Ether value of module transaction.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Data payload of module transaction.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; operation&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Operation type of module transaction: 0 == call, 1 == delegate call.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; execTransactionFromModuleReturnData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        Enum&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;Operation&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; returnData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns if an module is enabled&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; True&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if the module is enabled&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isModuleEnabled&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; module&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns array of modules.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; start&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Start of the page.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; pageSize&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Maximum number of modules that should be returned.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; array&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Array of modules.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; next&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Start of the next page.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getModulesPaginated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; start&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; pageSize&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; array&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; next&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; &amp;gt;=0.7.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0.9&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;Enum.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IGuard&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checkTransaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        Enum&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;Operation&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; safeTxGas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; baseGas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; gasPrice&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; gasToken&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; refundReceiver&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signatures&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; msgSender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checkAfterExecution&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; txHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; &amp;gt;=0.7.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0.9&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;Enum.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;BaseGuard.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Guardable - A contract that manages fallback calls made to this contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Guardable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; guard&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ChangedGuard&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; guard&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `guard_` does not implement IERC165.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NotIERC165Compliant&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; guard_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Set a guard that checks transactions before execution.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _guard&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the guard to be used or the 0 address to disable the guard.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setGuard&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _guard&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;_guard &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;BaseGuard&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_guard&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;IGuard&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NotIERC165Compliant&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_guard&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        guard &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _guard&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ChangedGuard&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;guard&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getGuard&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _guard&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; guard&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; &amp;gt;=0.7.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0.9&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;Enum.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERC165.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IGuard.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;abstract&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BaseGuard&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC165&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        pure&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        override&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;IGuard&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0xe6d7a83a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;IERC165&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;interfaceId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0x01ffc9a7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Module transactions only use the first four parameters: to, value, data, and operation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Module.sol hardcodes the remaining parameters as 0 since they are not used for module transactions.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checkTransaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        Enum&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;Operation&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; safeTxGas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; baseGas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; gasPrice&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; gasToken&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; refundReceiver&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signatures&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; msgSender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checkAfterExecution&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; txHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; &amp;gt;=0.7.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0.9&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Enum - Collection of enums&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Enum&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Operation&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;Call&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt; DelegateCall&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The interface defined in this standard is designed to be mostly compatible with most popular programmable accounts in use right now, to minimize the need for changes to existing tooling.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues are introduced by this standard.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;There are some considerations that module developers and users should take into account:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Modules have absolute control:&lt;&#x2F;strong&gt; Modules have absolute control over any avatar on which they are enabled, so any module implementation should be treated as security critical and users should be vary cautious about enabling new modules. ONLY ENABLE MODULES THAT YOU TRUST WITH THE FULL VALUE OF THE AVATAR.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Race conditions:&lt;&#x2F;strong&gt; A given avatar may have any number of modules enabled, each with unilateral control over the safe. In such cases, there may be race conditions between different modules and&#x2F;or other control mechanisms.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Don&#x27;t brick your avatar:&lt;&#x2F;strong&gt; There are no safeguards to stop you adding or removing modules. If you remove all of the modules that let you control an avatar, the avatar will cease to function and all funds will be stuck.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Time NFT, ERC-721 Time Extension</title>
        <published>2022-04-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Anders</name><uri>https://github.com/0xanders</uri>
	</author>
	
	<author>
		<name>Lance</name><uri>https://github.com/LanceSnow</uri>
	</author>
	
	<author>
		<name>Shrug</name><email>shrug@emojidao.org</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5007/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5007-eip-721-time-extension/8924" />
        

        <id>https://wg-eips.ritovision.com/5007/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:5007"
            label="ERC-5007" />
        

        
        

        
        <summary type="html">Add start time and end time to ERC-721 tokens.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5007/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is an extension of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;. It proposes some additional functions (&lt;code&gt;startTime&lt;&#x2F;code&gt;, &lt;code&gt;endTime&lt;&#x2F;code&gt;) to help with on-chain time management.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Some NFTs have a defined usage period and cannot be used outside of that period. With traditional NFTs that do not include time information, if you want to mark a token as invalid or enable it at a specific time, you need to actively submit a transaction—a process both cumbersome and expensive.&lt;&#x2F;p&gt;
&lt;p&gt;Some existing NFTs contain time functions, but their interfaces are not consistent, so it is difficult to develop third-party platforms for them.&lt;&#x2F;p&gt;
&lt;p&gt;By introducing these functions (&lt;code&gt;startTime&lt;&#x2F;code&gt;, &lt;code&gt;endTime&lt;&#x2F;code&gt;), it is possible to enable and disable NFTs automatically on chain.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot; and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the ERC-165 identifier for this interface is 0xf140be0d.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5007&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is IERC721 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the start time of the NFT as a UNIX timestamp.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - `tokenId` must exist.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; startTime&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the end time of the NFT as a UNIX timestamp.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - `tokenId` must exist.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; endTime&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;strong&gt;composable extension&lt;&#x2F;strong&gt; is OPTIONAL for this standard. This allows your NFT to be minted from an existing NFT or to merge two NFTs into one NFT.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the ERC-165 identifier for this interface is 0x75cf3842.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5007Composable&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is IERC5007 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the asset id of the time NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Only NFTs with same asset id can be merged.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - `tokenId` must exist.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; assetId&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Split an old token to two new tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * The assetId of the new token is the same as the assetId of the old token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - `oldTokenId` must exist.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - `newToken1Id` must not exist.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - `newToken1Owner` cannot be the zero address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - `newToken2Id` must not exist.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - `newToken2Owner` cannot be the zero address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - `splitTime`  require(oldToken.startTime &amp;lt;= splitTime &amp;amp;&amp;amp; splitTime &amp;lt; oldToken.EndTime)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; split&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; oldTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newToken1Id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newToken1Owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newToken2Id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newToken2Owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; splitTime&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Merge the first token and second token into the new token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - `firstTokenId` must exist.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - `secondTokenId` must exist.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - require((firstToken.endTime + 1) == secondToken.startTime)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - require((firstToken.assetId()) == secondToken.assetId())&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - `newTokenOwner` cannot be the zero address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - `newTokenId` must not exist.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; merge&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; firstTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; secondTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newTokenOwner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newTokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;time-data-type&quot;&gt;Time Data Type&lt;&#x2F;h3&gt;
&lt;p&gt;The max value of &lt;code&gt;uint64&lt;&#x2F;code&gt; is 18,446,744,073,709,551,615. As a timestamp, 18,446,744,073,709,551,615 is about year 584,942,419,325. &lt;code&gt;uint256&lt;&#x2F;code&gt; is too big for C, C++, Java, Go, etc, and &lt;code&gt;uint64&lt;&#x2F;code&gt; is natively supported by mainstream programming languages.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is fully ERC-721 compatible.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases are included in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5007&#x2F;.&#x2F;assets&#x2F;test&#x2F;test.js&quot;&gt;test.js&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Run in terminal:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;cd&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; ..&#x2F;assets&#x2F;eip-5007&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;npm&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; install&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; truffle&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;g&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;npm&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; install&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;truffle&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; test&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5007&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;ERC5007.sol&quot;&gt;&lt;code&gt;ERC5007.sol&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;No security issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Rental NFT, NFT User Extension</title>
        <published>2022-04-12T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Lance</name><uri>https://github.com/LanceSnow</uri>
	</author>
	
	<author>
		<name>Anders</name><uri>https://github.com/0xanders</uri>
	</author>
	
	<author>
		<name>Shrug</name><email>shrug@emojidao.org</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5006/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip5006-erc-1155-usage-rights-extension/8941" />
        

        <id>https://wg-eips.ritovision.com/5006/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:5006"
            label="ERC-5006" />
        

        
        

        
        <summary type="html">Add a user role with restricted permissions to ERC-1155 tokens</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5006/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is an extension of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt;. It proposes an additional role (&lt;code&gt;user&lt;&#x2F;code&gt;) which can be granted to addresses that represent a &lt;code&gt;user&lt;&#x2F;code&gt; of the assets rather than an &lt;code&gt;owner&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Like &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; tokens may have utility of some kind. The people who “use” the token may be different than the people who own it (such as in a rental). Thus, it would be useful to have separate roles for the “owner” and the “user” so that the “user” would not be able to take actions that the owner could (for example, transferring ownership).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot; and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5006&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UserRecord&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint64&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; user&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint64&lt;&#x2F;span&gt;&lt;span&gt; expiry&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when permission for `user` to use `amount` of `tokenId` token owned by `owner`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * until `expiry` are given.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CreateUserRecord&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recordId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;  amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;  expiry&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when record of `recordId` are deleted. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DeleteUserRecord&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recordId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the usable amount of `tokenId` tokens  by `account`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; usableBalanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the amount of frozen tokens of token type `id` by `account`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; frozenBalanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the `UserRecord` of `recordId`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; userRecordOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recordId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;UserRecord&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Gives permission to `user` to use `amount` of `tokenId` token owned by `owner` until `expiry`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Emits a {CreateUserRecord} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - If the caller is not `owner`, it must be have been approved to spend ``owner``&amp;#39;s tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * via {setApprovalForAll}.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - `owner` must have a balance of tokens of type `id` of at least `amount`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - `user` cannot be the zero address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - `amount` must be greater than 0.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - `expiry` must after the block timestamp.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; createUserRecord&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expiry&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Atomically delete `record` of `recordId` by the caller.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Emits a {DeleteUserRecord} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - the caller must have allowance.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; deleteUserRecord&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recordId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; method MUST return &lt;code&gt;true&lt;&#x2F;code&gt; when called with &lt;code&gt;0xc26d96cc&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This model is intended to facilitate easy implementation. The following are some problems that are solved by this standard:&lt;&#x2F;p&gt;
&lt;h3 id=&quot;clear-rights-assignment&quot;&gt;Clear Rights Assignment&lt;&#x2F;h3&gt;
&lt;p&gt;With Dual “owner” and “user” roles, it becomes significantly easier to manage what lenders and borrowers can and cannot do with the NFT (in other words, their rights).  For example, for the right to transfer ownership, the project simply needs to check whether the address taking the action represents the owner or the user and prevent the transaction if it is the user.  Additionally, owners can control who the user is and it is easy for other projects to assign their own rights to either the owners or the users.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;easy-third-party-integration&quot;&gt;Easy Third-Party Integration&lt;&#x2F;h3&gt;
&lt;p&gt;In the spirit of permissionless interoperability, this standard makes it easier for third-party protocols to manage NFT usage rights without permission from the NFT issuer or the NFT application. Once a project has adopted the additional &lt;code&gt;user&lt;&#x2F;code&gt; role, any other project can directly interact with these features and implement their own type of transaction. For example, a PFP NFT using this standard can be integrated into both a rental platform where users can rent the NFT for 30 days AND, at the same time, a mortgage platform where users can use the NFT while eventually buying ownership of the NFT with installment payments. This would all be done without needing the permission of the original PFP project.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;As mentioned in the specifications section, this standard can be fully ERC compatible by adding an extension function set, and there are no conflicts between &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5006&#x2F;&quot;&gt;ERC-5006&lt;&#x2F;a&gt; and ERC-1155.&lt;&#x2F;p&gt;
&lt;p&gt;In addition, new functions introduced in this standard have many similarities with the existing functions in ERC-1155. This allows developers to easily adopt the standard quickly.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases are included in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5006&#x2F;.&#x2F;assets&#x2F;test&#x2F;test.ts&quot;&gt;test.js&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Run in terminal:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;cd ..&#x2F;assets&#x2F;eip-5006&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;npm install&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;npx hardhat test&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5006&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;ERC5006.sol&quot;&gt;&lt;code&gt;ERC5006.sol&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP standard can completely protect the rights of the owner, the owner can change the NFT user, the user can not transfer the NFT.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>ERC-721 Nonce Extension</title>
        <published>2022-04-10T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Anders</name><uri>https://github.com/0xanders</uri>
	</author>
	
	<author>
		<name>Lance</name><uri>https://github.com/LanceSnow</uri>
	</author>
	
	<author>
		<name>Shrug</name><email>shrug@emojidao.org</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5008/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip5008-eip-721-nonce-and-metadata-update-extension/8925" />
        

        <id>https://wg-eips.ritovision.com/5008/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="last-call"
                label="Last Call" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:5008"
            label="ERC-5008" />
        

        
        

        
        <summary type="html">Add a `nonce` function to ERC-721.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5008/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is an extension of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;. It proposes adding a &lt;code&gt;nonce&lt;&#x2F;code&gt; function to ERC-721 tokens.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Some orders of NFT marketplaces have been attacked and the NFTs sold at a lower price than the current market floor price. This can happen when users transfer an NFT to another wallet and, later, back to the original wallet. This reactivates the order, which may list the token at a much lower price than the owner would have intended.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP proposes adding a &lt;code&gt;nonce&lt;&#x2F;code&gt; property to ERC-721 tokens, and the &lt;code&gt;nonce&lt;&#x2F;code&gt; will be changed when a token is transferred. If a &lt;code&gt;nonce&lt;&#x2F;code&gt; is added to an order, the order can be checked to avoid attacks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot; and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the ERC-165 identifier for this interface is 0xce03fdab.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5008&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is IERC165 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when the `nonce` of an NFT is &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NonceChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the nonce of an NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws if `tokenId` is not a valid NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The id of the NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; nonce of the NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;nonce(uint256 tokenId)&lt;&#x2F;code&gt; function MUST be implemented as &lt;code&gt;view&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; method MUST return &lt;code&gt;true&lt;&#x2F;code&gt; when called with &lt;code&gt;0xce03fdab&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;At first &lt;code&gt;transferCount&lt;&#x2F;code&gt; was considered as function name, but there may some case to change the &lt;code&gt;nonce&lt;&#x2F;code&gt; besides transfer, such as important properties changed, then we changed &lt;code&gt;transferCount&lt;&#x2F;code&gt; to &lt;code&gt;nonce&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is compatible with ERC-721.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases are included in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5008&#x2F;.&#x2F;assets&#x2F;test&#x2F;test.ts&quot;&gt;test.js&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Run:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;cd&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; ..&#x2F;assets&#x2F;eip-5008&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;npm&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; install&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;npm&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; run&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; test&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5008&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;ERC5008.sol&quot;&gt;&lt;code&gt;ERC5008.sol&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;No security issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Name-Owned Account</title>
        <published>2022-04-04T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Shu Dong</name><uri>https://github.com/dongshu2013</uri>
	</author>
	
	<author>
		<name>Qi Zhou</name><uri>https://github.com/qizhou</uri>
	</author>
	
	<author>
		<name>Zihao Chen</name><uri>https://github.com/zihaoccc</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4972/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-4972-name-owned-account/8822" />
        

        <id>https://wg-eips.ritovision.com/4972/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:4972"
            label="ERC-4972" />
        

        
        

        
        <summary type="html">Name-Owned Account for Social Identity</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4972/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The ERC suggests expanding the capabilities of the name service, such as ENS, by enabling each human-readable identity to be linked to a single smart contract account that can be controlled by the owner of the name identity.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Name itself cannot hold any context. We want to build an extension of name service to give name rich context by offering each name owner an extra ready to use smart contract account, which may help the general smart contract account adoption. With NOA, it is possible to hold assets and information for its name node, opening up new use cases such as name node transfers, which involve transferring ownership of the name node as well as the NOA, including any assets and information it holds.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;name-owned-account&quot;&gt;Name-Owned Account&lt;&#x2F;h3&gt;
&lt;p&gt;An NOA has&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;a human readable name defined by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;137&#x2F;&quot;&gt;ERC-137&lt;&#x2F;a&gt;; and&lt;&#x2F;li&gt;
&lt;li&gt;an owned account(NOA), which is an smart contract account whose address is derived from the name; and&lt;&#x2F;li&gt;
&lt;li&gt;owner(s) of the name that can deploy and manipulate the owned account.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The following diagram illustrates the relationship between NOA, name node, and name owner, with the ownership being guaranteed by the name service.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ┌───────────────┐        ┌───────────┐         ┌───────────────┐&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  │ Owned Account ◄──own───┤ Name Node ◄───own───┤   Name Owner  │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  └───────────────┘        └───────────┘         └───────────────┘&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;interface&quot;&gt;Interface&lt;&#x2F;h3&gt;
&lt;p&gt;The core interface required for a name service to have is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;interface INameServiceRegistry {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @notice get account address owned by the name node&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @params node represents a name node&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @return the address of an account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function ownedAccount(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bytes32 node&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ) external view returns(address);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The core interface required for the name owned account is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;interface INameOwnedAccount {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @notice get the name node is mapped to this account address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @return return a name node&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function name() external view returns(bytes32);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @notice get the name service contract address where&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; the name is registered&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @return return the name service the name registered at&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function nameService() external view returns(address);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;To achieve a one-to-one mapping from the name to the NOA, where each NOA&#x27;s address is derived from the name node, we must include the name node information in each NOA to reflect its name node ownership. The &quot;name()&quot; function can be used to retrieve this property of each NOA and enable reverse tracking to its name node. The &quot;nameService()&quot; function can get the name service contract address where the name is registered, to perform behaviors such as validation checks. Through these two methods, the NOA has the ability to track back to its actual owner who owns the name node.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The name registry interface is compatible with ERC-137.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;name-owned-account-creation&quot;&gt;Name Owned Account Creation&lt;&#x2F;h3&gt;
&lt;p&gt;The NOA creation is done by a “factory” contract. The factory could be the name service itself and is expected to use CREATE2 (not CREATE) to create the NOA. NOAs should have identical initcode and factory contract in order to achieve deterministic preservation of address. The name node can be used as the salt to guarantee the bijection from name to its owned account.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;No security considerations were found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Ratings</title>
        <published>2022-04-02T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Daniel Tedesco</name><uri>https://github.com/dtedesco1</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4974/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/8805" />
        

        <id>https://wg-eips.ritovision.com/4974/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:4974"
            label="ERC-4974" />
        

        
        

        
        <summary type="html">An interface for assigning and managing numerical ratings</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4974/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard defines a standardized interface for assigning and managing numerical ratings on the Ethereum blockchain. This allows ratings to be codified within smart contracts and recognized by other applications, enabling a wide range of new use cases for tokens.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Traditionally, blockchain applications have focused on buying and selling digital assets. However, the asset-centric model has often been detrimental to community-based blockchain projects, as seen in the pay-to-play dynamics of many EVM-based games and DAOs in 2021.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal addresses this issue by allowing ratings to be assigned to contracts and wallets, providing a new composable primitive for blockchain applications. This allows for a diverse array of new use cases, such as:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Voting weight in a DAO: Ratings assigned using this standard can be used to determine the voting weight of members in a decentralized autonomous organization (DAO). For example, a DAO may assign higher ratings to members who have demonstrated a strong track record of contributing to the community, and use these ratings to determine the relative influence of each member in decision-making processes.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Experience points in a decentralized game ecosystem: Ratings can be used to track the progress of players in a decentralized game ecosystem, and to reward them for achieving specific milestones or objectives. For example, a game may use ratings to assign experience points to players, which can be used to unlock new content or abilities within the game.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Loyalty points for customers of a business: Ratings can be used to track the loyalty of customers to a particular business or service, and to reward them for their continued support. For example, a business may use ratings to assign loyalty points to customers, which can be redeemed for special offers or discounts.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Asset ratings for a decentralized insurance company: Ratings can be used to evaluate the risk profile of assets in a decentralized insurance company, and to determine the premiums and coverage offered to policyholders. For example, a decentralized insurance company may use ratings to assess the risk of different types of assets, and to provide lower premiums and higher coverage to assets with lower risk ratings.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This standard is influenced by the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;EIP-20&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; token standards and takes cues from each in its structure, style, and semantics.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;Every compliant contract MUST implement the following interfaces:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; SPDX-License-Identifier: CC0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pragma solidity ^0.8.0;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @title EIP-4974 Ratings&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @dev See https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;EIP-4974&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F;  Note: the EIP-165 identifier for this interface is #######.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F;  Must initialize contracts with an `operator` address that is not `address(0)`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;interface IERC4974 &#x2F;* is ERC165 *&#x2F; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @dev Emits when operator changes.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F;  MUST emit when `operator` changes by any mechanism.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F;  MUST ONLY emit by `setOperator`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    event NewOperator(address indexed _operator);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @dev Emits when operator issues a rating. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F;  MUST emit when rating is assigned by any mechanism.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F;  MUST ONLY emit by `rate`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    event Rating(address _rated, int8 _rating);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @dev Emits when operator removes a rating. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F;  MUST emit when rating is removed by any mechanism.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F;  MUST ONLY emit by `remove`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    event Removal(address _removed);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @notice Appoint operator authority.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @dev MUST throw unless `msg.sender` is `operator`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F;  MUST throw if `operator` address is either already current `operator`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F;  or is the zero address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F;  MUST emit an `Appointment` event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @param _operator New operator of the smart contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function setOperator(address _operator) external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @notice Rate an address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F;  MUST emit a Rating event with each successful call.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @param _rated Address to be rated.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @param _rating Total EXP tokens to reallocate.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function rate(address _rated, int8 _rating) external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @notice Remove a rating from an address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F;  MUST emit a Remove event with each successful call.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @param _removed Address to be removed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function removeRating(address _removed) external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @notice Return a rated address&amp;#39; rating.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @dev MUST register each time `Rating` emits.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F;  SHOULD throw for queries about the zero address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @param _rated An address for whom to query rating.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @return int8 The rating assigned.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function ratingOf(address _rated) external view returns (int8);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;interface IERC165 {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @notice Query if a contract implements an interface.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @dev Interface identification is specified in EIP-165. This function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F;  uses less than 30,000 gas.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @param interfaceID The interface identifier, as specified in EIP-165.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @return bool `true` if the contract implements `interfaceID` and&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F;  `interfaceID` is not 0xffffffff, `false` otherwise.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function supportsInterface(bytes4 interfaceID) external view returns (bool);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;rating-assignment&quot;&gt;Rating Assignment&lt;&#x2F;h3&gt;
&lt;p&gt;Ratings SHALL be at the sole discretion of the contract operator. This party may be a sports team coach or a multisig DAO wallet. We decide not to specify how governance occurs, but only &lt;em&gt;that&lt;&#x2F;em&gt; governance occurs. This allows for a wider range of potential use cases than optimizing for particular decision-making forms.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal standardizes a control mechanism to allocate community reputation without encouraging financialization of that recognition. While it does not ensure meritocracy, it opens the door.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;choice-of-int8&quot;&gt;Choice of int8&lt;&#x2F;h3&gt;
&lt;p&gt;It&#x27;s signed: Reviewers should be able to give neutral and negative ratings for the wallets and contracts they interact with. This is especially important for decentralized applications that may be subject to malicious actors.&lt;&#x2F;p&gt;
&lt;p&gt;It&#x27;s 8bit: The objective here is to keep ratings within some fathomably comparable range. Longer term, this could encourage easy aggregation of ratings, versus using larger numbers where users might employ a great variety of scales.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;rating-changes&quot;&gt;Rating Changes&lt;&#x2F;h3&gt;
&lt;p&gt;Ratings SHOULD allow rating updates by contract operators. If Bob has contributed greatly to the community, but then is caught stealing from Alice, the community may decide this should lower Bob&#x27;s standing and influence in the community. Again, while this does not ensure an ethical standard within the community, it opens the door.&lt;&#x2F;p&gt;
&lt;p&gt;Relatedly, ratings SHOULD allow removal of ratings to rescind a rating if the rater does not have confidence in their ability to rate effectively.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;interface-detection&quot;&gt;Interface Detection&lt;&#x2F;h3&gt;
&lt;p&gt;We chose Standard Interface Detection (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;EIP-165&lt;&#x2F;a&gt;) to expose the interfaces that a compliant smart contract supports.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;metadata-choices&quot;&gt;Metadata Choices&lt;&#x2F;h3&gt;
&lt;p&gt;We have required &lt;code&gt;name&lt;&#x2F;code&gt; and &lt;code&gt;description&lt;&#x2F;code&gt; functions in the metadata extension. &lt;code&gt;name&lt;&#x2F;code&gt; common among major standards for blockchain-based primitives. We included a &lt;code&gt;description&lt;&#x2F;code&gt; function that may be helpful for games or other applications with multiple ratings systems.&lt;&#x2F;p&gt;
&lt;p&gt;We remind implementation authors that the empty string is a valid response to &lt;code&gt;name&lt;&#x2F;code&gt; and &lt;code&gt;description&lt;&#x2F;code&gt; if you protest to the usage of this mechanism. We also remind everyone that any smart contract can use the same name and description as your contract. How a client may determine which ratings smart contracts are well-known (canonical) is outside the scope of this standard.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;drawbacks&quot;&gt;Drawbacks&lt;&#x2F;h3&gt;
&lt;p&gt;One potential drawback of using this standard is that ratings are subjective and may not always accurately reflect the true value or quality of a contract or wallet. However, the standard provides mechanisms for updating and removing ratings, allowing for flexibility and evolution over time.&lt;&#x2F;p&gt;
&lt;p&gt;Users identified in the motivation section have a strong need to identify how a contract or community evaluates another. While some users may be proud of ratings they receive, others may rightly or wrongly receive negative ratings from certain contracts. Negative ratings may allow for nefarious activities such as bullying and discrimination. We implore all implementers to be mindful of the consequences of any ratings systems they create with this standard.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;We have adopted the &lt;code&gt;name&lt;&#x2F;code&gt; semantics from the EIP-20 and EIP-721 specifications.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;A reference implementation of this standard can be found in the assets folder.&lt;&#x2F;p&gt;
&lt;!-- [.&#x2F;assets&#x2F;ERC4974.sol](.&#x2F;assets&#x2F;ERC4974.sol). --&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;One potential security concern with this standard is the risk of malicious actors assigning false or misleading ratings to contracts or wallets. This could be used to manipulate voting weights in a DAO, or to deceive users into making poor decisions based on inaccurate ratings.&lt;&#x2F;p&gt;
&lt;p&gt;To address this concern, the standard includes mechanisms for updating and removing ratings, allowing for corrections to be made in cases of false or misleading ratings. Additionally, the use of a single operator address to assign and update ratings provides a single point of control, which can be used to enforce rules and regulations around the assignment of ratings.&lt;&#x2F;p&gt;
&lt;p&gt;Another potential security concern is the potential for an attacker to gain control of the operator address and use it to manipulate ratings for their own benefit. To mitigate this risk, it is recommended that the operator address be carefully managed and protected, and that multiple parties be involved in its control and oversight.&lt;&#x2F;p&gt;
&lt;p&gt;Overall, the security of compliant contracts will depend on the careful management and protection of the operator address, as well as the development of clear rules and regulations around the assignment of ratings.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Account-bound Tokens</title>
        <published>2022-04-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Tim Daubenschütz</name><uri>https://github.com/TimDaub</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4973/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-4973-non-transferrable-non-fungible-tokens-soulbound-tokens-or-badges/8825" />
        

        <id>https://wg-eips.ritovision.com/4973/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:4973"
            label="ERC-4973" />
        

        
        

        
        <summary type="html">An interface for non-transferrable NFTs binding to an Ethereum account like a legendary World of Warcraft item binds to a character.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4973/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Proposes a standard API for account-bound Tokens (ABT) within smart contracts. An ABT is a non-fungible token bound to a single account. ABTs don&#x27;t implement a canonical interface for transfers. This EIP defines basic functionality to mint, assign, revoke and track ABTs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;In the popular MMORPG World of Warcraft, its game designers intentionally took some items out of the world&#x27;s auction house market system to prevent them from having a publicly-discovered price and limit their accessibility.&lt;&#x2F;p&gt;
&lt;p&gt;Vanilla WoW&#x27;s &quot;Thunderfury, Blessed Blade of the Windseeker&quot; was one such legendary item, and it required a forty-person raid, among other sub-tasks, to slay the firelord &quot;Ragnaros&quot; to gain the &quot;Essence of the Firelord,&quot; a material needed to craft the sword once.&lt;&#x2F;p&gt;
&lt;p&gt;Upon voluntary pickup, the sword permanently &lt;strong&gt;binds&lt;&#x2F;strong&gt; to a character&#x27;s &quot;soul,&quot; making it impossible to trade, sell or even swap it between a player&#x27;s characters.&lt;&#x2F;p&gt;
&lt;p&gt;In other words, &quot;Thunderfury&quot;&#x27;s price was the aggregate of all social costs related to completing the difficult quest line with friends and guild members. Other players spotting Thunderfuries could be sure their owner had slain &quot;Ragnaros,&quot; the blistering firelord.&lt;&#x2F;p&gt;
&lt;p&gt;World of Warcraft players could &lt;strong&gt;trash&lt;&#x2F;strong&gt; legendary and soulbound items like the Thunderfury to permanently remove them from their account. It was their choice to visibly &lt;strong&gt;equip&lt;&#x2F;strong&gt; or &lt;strong&gt;unequip&lt;&#x2F;strong&gt; an item and hence show their achievements to everyone.&lt;&#x2F;p&gt;
&lt;p&gt;The Ethereum community has expressed a need for non-transferrable, non-fungible, and socially-priced tokens similar to WoW&#x27;s soulbound items. Popular contracts implicitly implement account-bound interaction rights today. A principled standardization helps interoperability and improves on-chain data indexing.&lt;&#x2F;p&gt;
&lt;p&gt;The purpose of this document is to make ABTs a reality on Ethereum by creating consensus around a &lt;strong&gt;maximally backward-compatible&lt;&#x2F;strong&gt; but otherwise &lt;strong&gt;minimal&lt;&#x2F;strong&gt; interface definition.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;solidity-interface&quot;&gt;Solidity Interface&lt;&#x2F;h3&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;ABTs &lt;em&gt;must&lt;&#x2F;em&gt; implement the interfaces:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt;&#x27;s &lt;code&gt;ERC165&lt;&#x2F;code&gt; (&lt;code&gt;0x01ffc9a7&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;&#x27;s &lt;code&gt;ERC721Metadata&lt;&#x2F;code&gt; (&lt;code&gt;0x5b5e139f&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;ABTs &lt;em&gt;must not&lt;&#x2F;em&gt; implement the interfaces:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;&#x27;s &lt;code&gt;ERC721&lt;&#x2F;code&gt; (&lt;code&gt;0x80ac58cd&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;An ABT receiver must be able to always call &lt;code&gt;function unequip(address _tokenId)&lt;&#x2F;code&gt; to take their ABT off-chain.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.6&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Account-bound tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-4973&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0xeb72bb7c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC4973&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when ownership of any ABT changes by any mechanism.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  This event emits when ABTs are given or equipped and unequipped&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  (`to` == 0).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Count all ABTs assigned to an owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ABTs assigned to the zero address are considered invalid, and this&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  function throws for queries about the zero address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An address for whom to query the balance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; number of ABTs owned by `address owner`, possibly zero&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Find the address bound to an ERC4973 account-bound token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ABTs assigned to zero address are considered invalid, and queries&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  about them do throw.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier for an ABT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address of the owner bound to the ABT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Removes the `uint256 tokenId` from an account. At any time, an&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  ABT receiver must be able to disassociate themselves from an ABT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  publicly through calling this function. After successfully executing this&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  function, given the parameters for calling `function give` or&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  `function take` a token must be re-equipable.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Must emit a `event Transfer` with the `address to` field pointing to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  the zero address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier for an ABT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; unequip&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Creates and transfers the ownership of an ABT from the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  transaction&amp;#39;s `msg.sender` to `address to`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws unless `bytes signature` represents a signature of the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   EIP-712 structured data hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  `Agreement(address active,address passive,bytes metadata)` expressing&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  `address to`&amp;#39;s explicit agreement to be publicly associated with&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  `msg.sender` and `bytes metadata`. A unique `uint256 tokenId` must be&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  generated by type-casting the `bytes32` EIP-712 structured data hash to a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  `uint256`. If `bytes signature` is empty or `address to` is a contract,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  an EIP-1271-compatible call to `function isValidSignatureNow(...)` must&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  be made to `address to`. A successful execution must result in the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  `event Transfer(msg.sender, to, tokenId)`. Once an ABT exists as an&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  `uint256 tokenId` in the contract, `function give(...)` must throw.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The receiver of the ABT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The metadata that will be associated to the ABT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A signature of the EIP-712 structured data hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  `Agreement(address active,address passive,bytes metadata)` signed by&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  `address to`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; A&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; unique `uint256 tokenId` generated by type-casting the `bytes32`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  EIP-712 structured data hash to a `uint256`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; give&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; metadata&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Creates and transfers the ownership of an ABT from an&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `address from` to the transaction&amp;#39;s `msg.sender`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws unless `bytes signature` represents a signature of the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  EIP-712 structured data hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  `Agreement(address active,address passive,bytes metadata)` expressing&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  `address from`&amp;#39;s explicit agreement to be publicly associated with&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  `msg.sender` and `bytes metadata`. A unique `uint256 tokenId` must be&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  generated by type-casting the `bytes32` EIP-712 structured data hash to a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  `uint256`. If `bytes signature` is empty or `address from` is a contract,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  an EIP-1271-compatible call to `function isValidSignatureNow(...)` must&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  be made to `address from`. A successful execution must result in the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  emission of an `event Transfer(from, msg.sender, tokenId)`. Once an ABT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  exists as an `uint256 tokenId` in the contract, `function take(...)` must&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  throw.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The origin of the ABT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The metadata that will be associated to the ABT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A signature of the EIP-712 structured data hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  `Agreement(address active,address passive,bytes metadata)` signed by&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  `address from`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; A&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; unique `uint256 tokenId` generated by type-casting the `bytes32`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  EIP-712 structured data hash to a `uint256`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; take&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; metadata&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Decodes the opaque metadata bytestring of an ABT into the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  URI that will be associated with it once it is created on chain.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The metadata that will be associated to an ABT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; A&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; URI that represents the metadata.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; decodeURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; metadata&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; for a definition of its metadata JSON Schema.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;eip-712-typed-structured-data-hashing-and-bytearray-signature-creation&quot;&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; Typed Structured Data Hashing and Bytearray Signature Creation&lt;&#x2F;h3&gt;
&lt;p&gt;To invoke &lt;code&gt;function give(...)&lt;&#x2F;code&gt; and &lt;code&gt;function take(...)&lt;&#x2F;code&gt; a bytearray signature must be created using &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt;. A tested reference implementation in Node.js is attached at &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4973&#x2F;.&#x2F;assets&#x2F;sdk&#x2F;src&#x2F;index.mjs&quot;&gt;index.mjs&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4973&#x2F;.&#x2F;assets&#x2F;sdk&#x2F;test&#x2F;index_test.mjs&quot;&gt;index_test.mjs&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4973&#x2F;.&#x2F;assets&#x2F;package.json&quot;&gt;package.json&lt;&#x2F;a&gt;. In Solidity, this bytearray signature can be created as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt; r &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x68a020a209d3d56c46f38cc50a33f704f4a9a10a59377f8dd762ac66910e9b90&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt; s &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x7e865ad05c4035ab5792787d4a0297a43617ae897930a6fe4d822b8faea52064&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span&gt; v   &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 27&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; signature &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; s&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;interface&quot;&gt;Interface&lt;&#x2F;h3&gt;
&lt;p&gt;ABTs shall be maximally backward-compatible but still only expose a minimal and simple to implement interface definition.&lt;&#x2F;p&gt;
&lt;p&gt;As &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; tokens have seen widespread adoption with wallet providers and marketplaces, using its &lt;code&gt;ERC721Metadata&lt;&#x2F;code&gt; interface with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; for feature-detection potentially allows implementers to support ABTs out of the box.&lt;&#x2F;p&gt;
&lt;p&gt;If an implementer of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; properly built &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt;&#x27;s &lt;code&gt;function supportsInterface(bytes4 interfaceID)&lt;&#x2F;code&gt; function, already by recognizing that &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;&#x27;s track and transfer interface component with the identifier &lt;code&gt;0x80ac58cd&lt;&#x2F;code&gt; is not implemented, transferring of a token should not be suggested as a user interface option.&lt;&#x2F;p&gt;
&lt;p&gt;Still, since ABTs support &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;&#x27;s &lt;code&gt;ERC721Metadata&lt;&#x2F;code&gt; extension, wallets and marketplaces should display an account-bound token with no changes needed.&lt;&#x2F;p&gt;
&lt;p&gt;Although other implementations of account-bound tokens are possible, e.g., by having all transfer functions revert, ABTs are superior as it supports feature detection through &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;We expose &lt;code&gt;function unequip(address _tokenId)&lt;&#x2F;code&gt; and require it to be callable at any time by an ABT&#x27;s owner as it ensures an owner&#x27;s right to publicly disassociate themselves from what has been issued towards their account.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;exception-handling&quot;&gt;Exception handling&lt;&#x2F;h3&gt;
&lt;p&gt;Given the non-transferable between accounts property of ABTs, if a user&#x27;s keys to an account or a contract get compromised or rotated, a user may lose the ability to associate themselves with the token. In some cases, this can be the desired effect. Therefore, ABT implementers should build re-issuance and revocation processes to enable recourse. We recommend implementing strictly decentralized, permissionless, and censorship-resistant re-issuance processes.&lt;&#x2F;p&gt;
&lt;p&gt;But this document is deliberately abstaining from offering a standardized form of exception handling in cases where user keys are compromised or rotated.&lt;&#x2F;p&gt;
&lt;p&gt;In cases where implementers want to make account-bound tokens shareable among different accounts, e.g., to avoid losing access when keys get compromised, we suggest issuing the account-bound token towards a contract&#x27;s account that implements a multi-signature functionality.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;provenance-indexing&quot;&gt;Provenance Indexing&lt;&#x2F;h3&gt;
&lt;p&gt;ABTs can be indexed by tracking the emission of &lt;code&gt;event Transfer(address indexed from, address indexed to, uint256 indexed tokenId)&lt;&#x2F;code&gt;. As with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;, transfers between two accounts are represented by &lt;code&gt;address from&lt;&#x2F;code&gt; and &lt;code&gt;address to&lt;&#x2F;code&gt; being non-zero addresses. Unequipping a token is represented through emitting a transfer with &lt;code&gt;address to&lt;&#x2F;code&gt; being set to the zero address. Mint operations where &lt;code&gt;address from&lt;&#x2F;code&gt; is set to zero don&#x27;t exist. To avoid being spoofed by maliciously-implemented &lt;code&gt;event Transfer&lt;&#x2F;code&gt; emitting contracts, an indexer should ensure that the transaction&#x27;s sender is equal to &lt;code&gt;event Transfer&lt;&#x2F;code&gt;&#x27;s &lt;code&gt;from&lt;&#x2F;code&gt; value.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;We have adopted the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; and &lt;code&gt;ERC721Metadata&lt;&#x2F;code&gt; functions purposefully to create a high degree of backward compatibility with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;. We have deliberately used &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; terminology such as &lt;code&gt;function ownerOf(...)&lt;&#x2F;code&gt;, &lt;code&gt;function balanceOf(...)&lt;&#x2F;code&gt; to minimize the effort of familiarization for ABT implementers already familiar with, e.g., &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;. For indexers, we&#x27;ve re-used the widely-implemented &lt;code&gt;event Transfer&lt;&#x2F;code&gt; event signature.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;You can find an implementation of this standard in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4973&#x2F;.&#x2F;assets&#x2F;ERC4973-flat.sol&quot;&gt;ERC-4973-flat.sol&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;There are no security considerations related directly to the implementation of this standard.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Vendor Metadata Extension for NFTs</title>
        <published>2022-03-29T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Ignacio Mazzara</name><uri>https://github.com/nachomazzara</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4955/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-4955-non-fungible-token-metadata-namespaces-extension/8746" />
        

        <id>https://wg-eips.ritovision.com/4955/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:4955"
            label="ERC-4955" />
        

        
        

        
        <summary type="html">Add a new field to NFT metadata to store vendor specific data</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4955/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP standardizes a schema for NFTs metadata to add new field namespaces to the JSON schema for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;EIP-1155&lt;&#x2F;a&gt; NFTs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;A standardized NFT metadata schema allows wallets, marketplaces, metaverses, and similar applications to interoperate with any NFT. Applications such as NFT marketplaces and metaverses could usefully leverage NFTs by rendering them using custom 3D representations or any other new attributes.&lt;&#x2F;p&gt;
&lt;p&gt;Some projects like Decentraland, TheSandbox, Cryptoavatars, etc. need their own 3D model in order to represent an NFT. These models are not cross-compatible because of distinct aesthetics and data formats.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;schema&quot;&gt;Schema&lt;&#x2F;h3&gt;
&lt;p&gt;(subject to &quot;caveats&quot; below)&lt;&#x2F;p&gt;
&lt;p&gt;A new property called &lt;code&gt;namespaces&lt;&#x2F;code&gt; is introduced. This property expects one object per project as shown in the example below.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;jsonc&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Asset Metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Identifies the asset that this NFT represents&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Describes the asset that this NFT represents&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;image&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A URI pointing to a resource with mime type image&#x2F;* representing the asset that this NFT represents. Consider making any images at a width between 320 and 1080 pixels and aspect ratio between 1.91:1 and 4:5 inclusive.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;namespaces&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Application-specific NFT properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;example&quot;&gt;Example&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;jsonc&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;My NFT&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;NFT description&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;image&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ipfs:&#x2F;&#x2F;QmZfmRZHuawJDtDVMaEaPWfgWFV9iXoS9SzLvwX76wm6pa&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;namespaces&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;myAwesomeCompany&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;prop1&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;value1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;prop2&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;value2&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;myAwesomeCompany2&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;prop3&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;value3&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;prop4&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;value4&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Or by simply using a `URI` to reduce the size of the JSON response.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;My NFT&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;NFT description&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;image&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ipfs:&#x2F;&#x2F;QmZfmRZHuawJDtDVMaEaPWfgWFV9iXoS9SzLvwX76wm6pa&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;namespaces&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;myAwesomeCompany&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;URI&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;myAwesomeCompany2&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;URI&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;There are many projects which need custom properties in order to display a current NFT. Each project may have its own way to render the NFTs and therefore they need different values. An example of this is the metaverses like Decentraland or TheSandbox where they need different 3d models to render the NFT based on the visual&#x2F;engine of each. NFTs projects like Cryptopunks, Bored Apes, etc. can create the 3d models needed for each project and therefore be supported out of the box.&lt;&#x2F;p&gt;
&lt;p&gt;The main differences between the projects that are rendering 3d NFTs (models) are:&lt;&#x2F;p&gt;
&lt;h3 id=&quot;armatures&quot;&gt;Armatures&lt;&#x2F;h3&gt;
&lt;p&gt;Every metaverse uses its own armature. There is a standard for humanoids but it is not being used for every metaverse and not all the metaverses use humanoids. For example, Decentraland has a different aesthetic than Cryptovoxels and TheSandbox. It means that every metaverse will need a different model and they may have the same extension (GLB, GLTF)&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4955&#x2F;.&#x2F;assets&#x2F;different-renders.jpeg&quot; alt=&quot;&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;metadata-representations-files&quot;&gt;Metadata (Representations Files)&lt;&#x2F;h3&gt;
&lt;p&gt;For example, every metaverse uses its own metadata representation files to make it work inside the engine depending on its game needs.&lt;&#x2F;p&gt;
&lt;p&gt;This is the JSON config of a wearable item in Decentraland:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;jsonc&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;replaces&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;hides&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;tags&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;category&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;upper_body&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;representations&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bodyShapes&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;urn:decentraland:off-chain:base-avatars:BaseMale&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;mainFile&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;male&#x2F;Look6_Tshirt_A.glb&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;contents&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;key&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;male&#x2F;Look6_Tshirt_A.glb&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;url&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;peer-ec2.decentraland.org&#x2F;content&#x2F;contents&#x2F;QmX3yMhmx4AvGmyF3CM5ycSQB4F99zXh9rL5GvdxTTcoCR&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;overrideHides&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;overrideReplaces&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bodyShapes&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;urn:decentraland:off-chain:base-avatars:BaseFemale&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;mainFile&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;female&#x2F;Look6_Tshirt_B (1).glb&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;contents&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;key&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;female&#x2F;Look6_Tshirt_B (1).glb&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;url&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;peer-ec2.decentraland.org&#x2F;content&#x2F;contents&#x2F;QmcgddP4L8CEKfpJ4cSZhswKownnYnpwEP4eYgTxmFdav8&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;overrideHides&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;overrideReplaces&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;image&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;peer-ec2.decentraland.org&#x2F;content&#x2F;contents&#x2F;QmPnzQZWAMP4Grnq6phVteLzHeNxdmbRhKuFKqhHyVMqrK&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;thumbnail&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;peer-ec2.decentraland.org&#x2F;content&#x2F;contents&#x2F;QmcnBFjhyFShGo9gWk2ETbMRDudiX7yjn282djYCAjoMuL&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;metrics&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;triangles&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3400&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;materials&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;textures&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;meshes&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bodies&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;entities&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;replaces&lt;&#x2F;code&gt;, &lt;code&gt;overrides&lt;&#x2F;code&gt;, &lt;code&gt;hides&lt;&#x2F;code&gt;, and different body shapes representation for the same asset are needed for Decentraland in order to render the 3D asset correctly.&lt;&#x2F;p&gt;
&lt;p&gt;Using &lt;code&gt;namespaces&lt;&#x2F;code&gt; instead of objects like the ones below make it easy for the specific vendor&#x2F;third-parties to access and index the required models. Moreover, &lt;code&gt;styles&lt;&#x2F;code&gt; do not exist because there are no standards around for how an asset will be rendered. As I mentioned above, each metaverse for example uses its own armature and aesthetic. There is no Decentraland-style or TheSandbox-style that other metaverses use. Each of them is unique and specific for the sake of the platform&#x27;s reason of being. Projects like Cryptoavatars are trying to push different standards but without luck for the same reasons related to the uniquity of the armature&#x2F;animations&#x2F;metadata.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;jsonc&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;model&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;model&#x2F;gltf+json&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;style&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Decentraland&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uri&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Or&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;model&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;model&#x2F;gltf+json&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;style&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;humanoide&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uri&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;With &lt;code&gt;namespaces&lt;&#x2F;code&gt;, each vendor will know how to render an asset by doing:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;fetch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;metadata&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;namespaces&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;PROJECT_NAME&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;uri&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;then&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;res&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; render&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;res&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The idea behind extending the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; metadata schema is for backward compatibility. Most projects on Ethereum use non-upgradeable contracts. If this EIP required new implementations of those contracts, they would have to be re-deployed. This is time-consuming and wastes money. Leveraging EIP-721&#x27;s existing metadata  field minimizes the number of changes necessary. Finally, the JSON metadata is already used to store representations using the &lt;code&gt;image&lt;&#x2F;code&gt; field. It seems reasonable to have all the representations of an asset in the same place.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Existing projects that can&#x27;t modify the metadata response (schema), may be able to create a new smart contract that based on the &lt;code&gt;tokenId&lt;&#x2F;code&gt; returns the updated metadata schema. Of course, the projects may need to accept these linked smart contracts as valid in order to fetch the metadata by the &lt;code&gt;tokenURI&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The same security considerations as with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; apply related to using http gateways or IPFS for the tokenURI method.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Entangled Tokens</title>
        <published>2022-03-28T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Víctor Muñoz</name><uri>https://github.com/victormunoz</uri>
	</author>
	
	<author>
		<name>Josep Lluis de la Rosa</name><uri>https://github.com/peplluis7</uri>
	</author>
	
	<author>
		<name>Easy Innova</name><uri>https://github.com/easyinnova</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4950/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/entangled-tokens/8702" />
        

        <id>https://wg-eips.ritovision.com/4950/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:4950"
            label="ERC-4950" />
        

        
        

        
        <summary type="html">ERC-721 extension with two tokens minted that are tied together</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4950/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP defines an interface for delegating control of a smart contract wallet to pairs of users using entangled &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; non-fungible tokens.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The motivation is to provide an easy way to share a wallet through NFTs, so that the act of buying an NFT (in a marketplace) gives the buyer the privilege to have access to a given wallet. This wallet could have budget in many tokens, or even be the owner of other NFTs.&lt;&#x2F;p&gt;
&lt;p&gt;A use case is to keep contact between an artist and an buyer of its NFTs. If an artist T has created a digital piece of art P with an NFT, then T creates 2 entangled tokens A and B so that he keeps A and transfer B to P. By construction of entangled tokens, only one transfer is possible for them, thus the artist proofs he’s been the creator of P by sending a transaction to A that is visible from B. Otherwise, the owner of P might check the authenticity of the artist by sending a transaction to B so that the artist might proof by showing the outcome out of A.&lt;&#x2F;p&gt;
&lt;p&gt;A version of this use case is when one user U mints his piece of art directly in the form of an entangled token A; then the user U sells&#x2F;transfers it while keeping the entangled token B in the U&#x27;s wallet. The piece of art and the artists will be entangled whoever is the A&#x27;s owner.&lt;&#x2F;p&gt;
&lt;p&gt;These applications of entangled tokens are envisaged to be useful for:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;NFT authorship &#x2F; art creation&lt;&#x2F;li&gt;
&lt;li&gt;Distribution of royalties by the creator.&lt;&#x2F;li&gt;
&lt;li&gt;Authenticity of a work of art: creation limited to the author (e.g. only 1000 copies if there are 1000 1000 entangled tokens in that NFT).&lt;&#x2F;li&gt;
&lt;li&gt;Usowners (users that consume an NFT also become -partial- owners of the NFT)&lt;&#x2F;li&gt;
&lt;li&gt;Reformulation of property rights: the one who owns the property receives it without having to follow in the footsteps of the owners.&lt;&#x2F;li&gt;
&lt;li&gt;Identity: Only those credentials that have an entangled token with you are related to you.&lt;&#x2F;li&gt;
&lt;li&gt;Vreservers (value-reservers).&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;An entangled token contract implements &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; with the additional restriction that it only ever mints exactly two tokens at contract deployment: one with a &lt;code&gt;tokenId&lt;&#x2F;code&gt; of &lt;code&gt;0&lt;&#x2F;code&gt;, the other with a &lt;code&gt;tokenId&lt;&#x2F;code&gt; of &lt;code&gt;1&lt;&#x2F;code&gt;. The entangled token contract also implements a smart contract wallet that can be operated by the owners of those two tokens.&lt;&#x2F;p&gt;
&lt;p&gt;Also, a &lt;code&gt;tokenTransfer&lt;&#x2F;code&gt; function is to be be added in order to allow the token owners to transact with the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens owned by the contract&#x2F;NFT itself. The function signature is as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;IERC20&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwners&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;We decide to extend &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; could be also possible) because the main purpose of this is to be compatible with current marketplaces platforms. This entangled NFTs will be listed in a marketplace, and the user who buys it will have then the possibility to transact with the wallet properties (fungible and non fungible tokens).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backwards compatibility issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Mint two tokens, and only two, at the contract constructor, and set the &lt;code&gt;minted&lt;&#x2F;code&gt; property to true:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _minted&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; symbol&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; base_uri&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;name, symbol) &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        baseUri &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; base_uri&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _minted &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;_minted&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC4950: already minted&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;    super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Add additional functions to allow both NFT user owners to operate with other ERC-20 tokens owned by the contract:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    modifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwners&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Caller does not own any of the tokens&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        _&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;IERC20&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwners&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        token&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;recipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;There are no security considerations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Insert Code into EOAs with AUTHUSURP</title>
        <published>2022-03-26T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Dan Finlay</name><uri>https://github.com/danfinlay</uri>
	</author>
	
	<author>
		<name>Sam Wilson</name><uri>https://github.com/SamWilsn</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5003/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5003-auth-usurp-publishing-code-at-an-eoa-address/8979" />
        

        <id>https://wg-eips.ritovision.com/5003/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:5003"
            label="EIP-5003" />
        

        
        

        
        <summary type="html">Allow migrating away from ECDSA by deploying code in place of an externally owned account.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5003/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a new opcode, &lt;code&gt;AUTHUSURP&lt;&#x2F;code&gt;, which deploys code at an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3074&#x2F;&quot;&gt;EIP-3074&lt;&#x2F;a&gt; authorized address. For externally owned accounts (EOAs), together with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3607&#x2F;&quot;&gt;EIP-3607&lt;&#x2F;a&gt;, this effectively revokes the original signing key&#x27;s authority.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;EOAs currently hold a significant amount of user-controlled value on Ethereum blockchains, but are limited by the protocol in a variety of critical ways. These accounts do not support rotating keys for security, batching to save gas, or sponsored transactions to reduce the need to hold ether yourself. There are countless other benefits that come from having a contract account or account abstraction, like choosing one&#x27;s own authentication algorithm, setting spending limits, enabling social recovery, allowing key rotation, arbitrarily and transitively delegating capabilities, and just about anything else we can imagine.&lt;&#x2F;p&gt;
&lt;p&gt;New users have access to these benefits using smart contract wallets, and new contracts can adopt recent standards to enable app-layer account abstraction (like &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;EIP-4337&lt;&#x2F;a&gt;), but these would neglect the vast majority of existing Ethereum users&#x27; accounts. These users exist today, and they also need a path to achieving their security goals.&lt;&#x2F;p&gt;
&lt;p&gt;Those added benefits would mostly come along with EIP-3074 itself, but with one significant shortcoming: the original signing key has ultimate authority for the account. While an EOA could delegate its authority to some &lt;em&gt;additional&lt;&#x2F;em&gt; contract, the key itself would linger, continuing to provide an attack vector, and a constantly horrifying question lingering: have I been leaked? In other words, EIP-3074 can only grant authority to additional actors, but never revoke it.&lt;&#x2F;p&gt;
&lt;p&gt;Today&#x27;s EOAs have no option to rotate their keys. A leaked private key (either through phishing, or accidental access) cannot be revoked. A prudent user concerned about their key security might migrate to a new secret recovery phrase but at best this requires a transaction per asset (making it extremely expensive), and at worst, some powers (like hard-coded owners in a smart contract) might not be transferable at all.&lt;&#x2F;p&gt;
&lt;p&gt;We know that EOAs cannot provide ideal user experience or safety, and there is a desire in the community to change the norm to contract-based accounts, but if that transition is designed without regard for the vast majority of users today—for whom Ethereum has always meant EOAs—we will be continually struggling against the need to support both of these userbases. This EIP provides a path not to enshrine EOAs, but to provide a migration path off of them, once and for all.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal combines well with, but is distinct from, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3074&#x2F;&quot;&gt;EIP-3074&lt;&#x2F;a&gt;, which provides opcodes that could enable any externally owned account (EOA) to delegate its signing authority to an arbitrary smart contract. It allows an EOA to authorize a contract account to act on its behalf &lt;em&gt;without forgoing its own powers&lt;&#x2F;em&gt;, while this EIP provides a final migration path off the EOA&#x27;s original signing key.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;conventions&quot;&gt;Conventions&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;top - N&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; - the &lt;code&gt;N&lt;&#x2F;code&gt;th most recently pushed value on the EVM stack, where &lt;code&gt;top - 0&lt;&#x2F;code&gt; is the most recent.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;invalid execution&lt;&#x2F;strong&gt; - execution that is invalid and must exit the current execution frame immediately, consuming all remaining gas (in the same way as a stack underflow or invalid jump).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;empty account&lt;&#x2F;strong&gt; - account where its balance is 0, its nonce is 0, and it has no code.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;authusurp-0xf8&quot;&gt;&lt;code&gt;AUTHUSURP&lt;&#x2F;code&gt; (&lt;code&gt;0xf8&lt;&#x2F;code&gt;)&lt;&#x2F;h3&gt;
&lt;p&gt;A new opcode &lt;code&gt;AUTHUSURP&lt;&#x2F;code&gt; shall be created at &lt;code&gt;0xf8&lt;&#x2F;code&gt;. It shall take two stack elements and return one stack element.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;input&quot;&gt;Input&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Stack&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;top - 0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;offset&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;top - 1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;length&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;output&quot;&gt;Output&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Stack&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;top - 0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;address&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;behavior&quot;&gt;Behavior&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;AUTHUSURP&lt;&#x2F;code&gt; behaves identically to &lt;code&gt;CREATE&lt;&#x2F;code&gt; (&lt;code&gt;0xf0&lt;&#x2F;code&gt;), except as described below:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If &lt;code&gt;authorized&lt;&#x2F;code&gt; (as defined in EIP-3074) is unset, execution is invalid.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;authorized&lt;&#x2F;code&gt; points to an empty account, then &lt;code&gt;static_gas&lt;&#x2F;code&gt; remains 32,000. Otherwise, &lt;code&gt;static_gas&lt;&#x2F;code&gt; shall be 7,000.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;AUTHUSURP&lt;&#x2F;code&gt; does not check the nonce of the &lt;code&gt;authorized&lt;&#x2F;code&gt; account.&lt;&#x2F;li&gt;
&lt;li&gt;The initcode runs at the address &lt;code&gt;authorized&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If the initcode returns no bytes, its execution frame must be reverted, and &lt;code&gt;AUTHUSURP&lt;&#x2F;code&gt; returns zero.&lt;&#x2F;li&gt;
&lt;li&gt;After executing the initcode, but before the returned code is deployed, if the account&#x27;s code is non-empty, the initcode&#x27;s execution frame must be reverted, and &lt;code&gt;AUTHUSURP&lt;&#x2F;code&gt; returns zero.&lt;&#x2F;li&gt;
&lt;li&gt;The code is deployed into the account with the address &lt;code&gt;authorized&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;AUTHUSURP&lt;&#x2F;code&gt; does not check the nonce of the &lt;code&gt;authorized&lt;&#x2F;code&gt; account because it must work with accounts that have previously sent transactions.&lt;&#x2F;p&gt;
&lt;p&gt;When using &lt;code&gt;AUTHUSURP&lt;&#x2F;code&gt;, if the initcode were to deploy a zero-length contract, there would be no way to prevent using &lt;code&gt;AUTHUSURP&lt;&#x2F;code&gt; again later.&lt;&#x2F;p&gt;
&lt;p&gt;The account&#x27;s code must be checked immediately before deploying to catch the situation where the initcode attempts to &lt;code&gt;AUTHUSURP&lt;&#x2F;code&gt; at the same address. This is unnecessary with other deployment instructions because they increment and check the account&#x27;s nonce.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;AUTHUSURP&lt;&#x2F;code&gt; with EIP-3607 revokes the authority of the original ECDSA signature to send transactions from the account. This is completely new behavior, although it is somewhat similar to the &lt;code&gt;CREATE2&lt;&#x2F;code&gt; opcode.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Contracts using ECDSA signatures outside of transactions will not be aware that the usurped account is no longer controlled by a private key. This means that, for example, the private key will &lt;em&gt;always&lt;&#x2F;em&gt; have access to the &lt;code&gt;permit&lt;&#x2F;code&gt; function on token contracts. This can—and should—be mitigated by modifying the &lt;code&gt;ecrecover&lt;&#x2F;code&gt; pre-compiled contract.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Contract with Exactly One Non-fungible Token</title>
        <published>2022-03-25T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Víctor Muñoz</name><uri>https://github.com/victormunoz</uri>
	</author>
	
	<author>
		<name>Josep Lluis de la Rosa</name><uri>https://github.com/peplluis7</uri>
	</author>
	
	<author>
		<name>Andres El-Fakdi</name><uri>https://github.com/Bluezfish</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4944/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc721-minting-only-one-token/8602/2" />
        

        <id>https://wg-eips.ritovision.com/4944/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:4944"
            label="ERC-4944" />
        

        
        

        
        <summary type="html">An ERC-721 compatible single-token NFT</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4944/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The following describes standard functions for an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; compatible contract with a total supply of one.
This allows an NFT to be associated uniquely with a single contract address.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;If the ERC-721 was modified to mint only 1 token (per contract), then the contract address could be identified uniquely with that minted token (instead of the tuple contract address + token id, as ERC-721 requires).
This change would enable automatically all the capabilities of composable tokens &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;998&#x2F;&quot;&gt;ERC-998&lt;&#x2F;a&gt; (own other ERC-721 or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;) natively without adding any extra code, just forbidding to mint more than one token per deployed contract.
Then the NFT minted with this contract could operate with his &quot;budget&quot; (the ERC-20 he owned) and also trade with the other NFTs he could own. Just like an autonomous agent, that could decide what to do with his properties (sell his NFTs, buy other NFTs, etc).&lt;&#x2F;p&gt;
&lt;p&gt;The first use case that is devised is for value preservation. Digital assets, as NFTs, have value that has to be preserved in order to not be lost. If the asset has its own budget (in other ERC-20 coins), could use it to autopreserve itself.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The constructor should mint the unique token of the contract, and then the mint function should add a restriction to avoid further minting.&lt;&#x2F;p&gt;
&lt;p&gt;Also, a &lt;code&gt;tokenTransfer&lt;&#x2F;code&gt; function should be added in order to allow the contract owner to transact with the ERC-20 tokens owned by the contract&#x2F;NFT itself. So that if the contract receives a transfer of ERC-20 tokens, the owner of the NFT could spend it from the contract wallet.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The main motivation is to keep the contract compatible with current ERC-721 platforms.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;There are no backwards compatibility issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Add the variable &lt;code&gt;_minted&lt;&#x2F;code&gt; in the contract:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _minted&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In the constructor, automint the first token and set the variable to true:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; symbol&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; base_uri&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;name, symbol) &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        baseUri &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; base_uri&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _minted &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Add additional functions to interact with the NFT properties (for instance, ERC-20):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    modifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Caller is not the owner of the NFT&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        _&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferTokens&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;IERC20&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        token&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;recipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceTokens&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;IERC20&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; token&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;No security issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>&quot;eth&#x2F;67 - Removal of GetNodeData&quot;</title>
        <published>2022-03-23T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Marius van der Wijden</name><uri>https://github.com/MariusVanDerWijden</uri>
	</author>
	
	<author>
		<name>Felix Lange</name><email>fjl@ethereum.org</email>
	</author>
	
	<author>
		<name>Gary Rong</name><email>garyrong@ethereum.org</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4938/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-4938-removal-of-getnodedata/8893" />
        

        <id>https://wg-eips.ritovision.com/4938/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="networking"
                label="Networking" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:4938"
            label="EIP-4938" />
        

        
        

        
        <summary type="html">&quot;Remove GetNodeData and NodeData messages from the wire protocol&quot;</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4938/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;devp2p&#x2F;blob&#x2F;40ab248bf7e017e83cc9812a4e048446709623e8&#x2F;caps&#x2F;eth.md&quot;&gt;Ethereum Wire Protocol&lt;&#x2F;a&gt; defines request and response messages for exchanging data between clients. The &lt;code&gt;GetNodeData&lt;&#x2F;code&gt; request retrieves a set of trie nodes or contract code from the state trie by hash. We propose to remove the &lt;code&gt;GetNodeData&lt;&#x2F;code&gt; and &lt;code&gt;NodeData&lt;&#x2F;code&gt; messages from the wire protocol.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;GetNodeData&lt;&#x2F;code&gt; and &lt;code&gt;NodeData&lt;&#x2F;code&gt; were introduced in protocol version &lt;code&gt;eth&#x2F;63&lt;&#x2F;code&gt; to allow for a sync mode called &quot;fast sync&quot;, which downloads the Ethereum state without executing all blocks. The sync algorithm works by requesting all state trie nodes and contract codes by their hash.&lt;&#x2F;p&gt;
&lt;p&gt;Serving &lt;code&gt;GetNodeData&lt;&#x2F;code&gt; requests requires clients to store state as a mapping of hashes to trie nodes. Avoiding the need to store such a mapping in the database is the main motivation for removing this request type.&lt;&#x2F;p&gt;
&lt;p&gt;At this time, some client implementations cannot serve &lt;code&gt;GetNodeData&lt;&#x2F;code&gt; requests because they do not store the state in a compatible way. The Ethereum Wire Protocol should accurately reflect the capabilities of clients, and should not contain messages which are impossible to implement in some clients.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Remove the following message types from the &lt;code&gt;eth&lt;&#x2F;code&gt; protocol:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;GetNodeData (0x0d)&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;(eth&#x2F;66)&lt;&#x2F;strong&gt;: &lt;code&gt;[request_id: P, [hash_0: B_32, hash_1: B_32, ...]]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;NodeData (0x0e)&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;(eth&#x2F;66)&lt;&#x2F;strong&gt;: &lt;code&gt;[request_id: P, [value_0: B, value_1: B, ...]]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;A replacement for &lt;code&gt;GetNodeData&lt;&#x2F;code&gt; is available in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;devp2p&#x2F;blob&#x2F;40ab248bf7e017e83cc9812a4e048446709623e8&#x2F;caps&#x2F;snap.md&quot;&gt;snap protocol&lt;&#x2F;a&gt;. Specifically, clients can use the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;devp2p&#x2F;blob&#x2F;40ab248bf7e017e83cc9812a4e048446709623e8&#x2F;caps&#x2F;snap.md#getbytecodes-0x04&quot;&gt;GetByteCodes&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;devp2p&#x2F;blob&#x2F;40ab248bf7e017e83cc9812a4e048446709623e8&#x2F;caps&#x2F;snap.md#gettrienodes-0x06&quot;&gt;GetTrieNodes&lt;&#x2F;a&gt; messages instead of &lt;code&gt;GetNodeData&lt;&#x2F;code&gt;. The snap protocol can be used to implement the &quot;fast sync&quot; algorithm, though it is recommended to use it for &quot;snap sync&quot;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP changes the &lt;code&gt;eth&lt;&#x2F;code&gt; protocol and requires rolling out a new version, &lt;code&gt;eth&#x2F;67&lt;&#x2F;code&gt;. Supporting multiple versions of a wire protocol is possible. Rolling out a new version does not break older clients immediately, since they can keep using protocol version &lt;code&gt;eth&#x2F;66&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP does not change consensus rules of the EVM and does not require a hard fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;None&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>L2 Aliasing of EVM-based Addresses</title>
        <published>2022-03-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Kelvin Fichter</name><uri>https://github.com/smartcontracts</uri>
	</author>
	
	<author>
		<name>Andreas Freund</name><uri>https://github.com/Therecanbeonlyone1969</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6735/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/l2-aliasing-of-evm-based-addresses-from-the-eea-oasis-community-projects-l2-standards-working-group/13093" />
        

        <id>https://wg-eips.ritovision.com/6735/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        

        
        <category
            term="tag:eip:6735"
            label="ERC-6735" />
        

        
        

        
        <summary type="html">Identify and translate EVM-based addresses from different Layer 1, Layer 2, or Sidechains</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6735/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The document describes the minimal set of business and technical prerequisites, functional and non-functional requirements for Aliasing of EVM based Addresses that when implemented ensures that two or more Layer 1, Layer 2, or Sidechains can identify and translate EVM based addresses from different Layer 1, Layer 2, or Sidechains.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The members of the L2 WG of the EEA Communities Project managed by OASIS have recognized that the ability to deterministically derive addresses of a digital asset or an externally owned account (EOA) in EVM based execution frameworks for L1s, L2s, Sidechains based on an origin chain of an asset or EOA, known as address aliasing, simplifies interoperability between EVM based L1s, L2s, and Sidechains because:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;It allows messages from chain A (source chain) to unambiguously address asset A (smart contract) or EOA on chain Y (target chain), if asset A or EOA exists on Chain X and on Chain Y.&lt;&#x2F;li&gt;
&lt;li&gt;It allows a user to deterministically verify the source chain of a message, and, if required, directly verify the origin chain of asset A or EOA and its state on its origin chain utilizing a canonical token list of the (message) source chain.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The ability to unambiguously, and deterministically, relate an address for a digital asset (smart contract) or an externally owned account (EOA) between EVM based L1s, L2s, and Sidechains where this digital asset or EOA exists, also known as address aliasing, is critical prerequisite for interoperability between EVM based L1s, L2s, and Sidechains. However, there is currently no way to do so in a standardized way -- imagine every internet service provider were to define its own IP addresses.&lt;&#x2F;p&gt;
&lt;p&gt;Hence, the L2 WG of the EEA Communities Project managed by OASIS, an open-source initiative, intends for this document to establish an unambiguous and deterministic standard for EVM based address aliasing based on the concept of root → leaf where an address alias is derived based on the address on the origin chain and an offset which is an immutable characteristic of the origin chain.&lt;&#x2F;p&gt;
&lt;p&gt;See Figure 1 for the conceptual root → leaf design with offset.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6735&#x2F;.&#x2F;assets&#x2F;address-aliasing-root-leaf-design.png&quot; alt=&quot;Fig1&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Figure 1: Root → Leaf address aliasing concept using an chain immanent characteristics from L1 to L2 and L3 and back.&lt;&#x2F;p&gt;
&lt;p&gt;Alternative Figure 1 Description: The figure describes conceptually how (interoperability) messages from source to target chain utilize address aliasing. At the bottom an EVM based L1 is uni-directionally connected to three EVM based L2s -- A, B, and C -- each with an alias of L1 address + L1 Offset. In addition, A is uni-directionally connected to B with an alias of L1 address + L1 offset + A offset. B is uni-directionally connected to an EVM-based Layer 3 or L3 with an alias of L1 address + L1 offset + B offset signaling that the address is anchored on L1 via the L2 B. And finally D is uni-directionally connected to C via the alias L1 address + L1 offset + B offset plus D offset indicating the asset chain of custody from L1 to B to D to C.&lt;&#x2F;p&gt;
&lt;p&gt;To further clarify the connections between the different possible paths an asset can take from an L1 to different L2&#x2F;L3s and the &lt;code&gt;relativeAddress&lt;&#x2F;code&gt; of that asset, we visually highlight in red the path from the EVM based L1 to the B L2, to the D L3, and finally to the C L2.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6735&#x2F;.&#x2F;assets&#x2F;visual-Highlight-Path-Red-evm-based-aliasing..png&quot; alt=&quot;Fig2&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Figure 2: Visually highlighted path in red from the EVM based L1 to the B L2, to the D L3, and finally to the C L2.&lt;&#x2F;p&gt;
&lt;p&gt;Alternative Figure 1 Description: The figure is the same as Figure 1. However, the uni-directional connections between the EVM based L1 to the L2 B, to the L3 D, and finally to the L2 C are highlighted in red.&lt;&#x2F;p&gt;
&lt;p&gt;Note, that address aliasing between non-EVM and EVM-based L1s, L2s, and Sidechains, and between non-EVM-based L1s, L2s, and Sidechains is out of scope of this document.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;typographical-convention-requirement-ids&quot;&gt;Typographical Convention: Requirement Ids&lt;&#x2F;h3&gt;
&lt;p&gt;A requirement is uniquely identified by a unique ID composed of its requirement level followed by a requirement number, as per convention &lt;strong&gt;[RequirementLevelRequirementNumber]&lt;&#x2F;strong&gt;.
There are four requirement levels that are coded in requirement ids as per below convention:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;[R]&lt;&#x2F;strong&gt; - The requirement level for requirements which IDs start with the letter &lt;em&gt;R&lt;&#x2F;em&gt; is to be interpreted as &lt;strong&gt;MUST&lt;&#x2F;strong&gt; as described in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc2119&quot;&gt;RFC2119&lt;&#x2F;a&gt;.&lt;br &#x2F;&gt;
&lt;strong&gt;[D]&lt;&#x2F;strong&gt; - The requirement level for requirements which IDs start with the letter &lt;em&gt;D&lt;&#x2F;em&gt; is to be interpreted as &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; as described in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc2119&quot;&gt;RFC2119&lt;&#x2F;a&gt;.&lt;br &#x2F;&gt;
&lt;strong&gt;[O]&lt;&#x2F;strong&gt; - The requirement level for requirements which IDs start with the letter &lt;em&gt;O&lt;&#x2F;em&gt; is to be interpreted as &lt;strong&gt;MAY&lt;&#x2F;strong&gt; as described in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc2119&quot;&gt;RFC2119&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Note that requirements are uniquely numbered in ascending order within each requirement level.&lt;&#x2F;p&gt;
&lt;p&gt;Example : It should be read that [R1] is an absolute requirement of the specification whereas [D1] is a recommendation and [O1] is truly optional.&lt;&#x2F;p&gt;
&lt;p&gt;The requirements below are only valid for EVM based L1s, L2, or Sidechains. Address aliasing for non-EVM systems is out of scope of this document.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r1&quot;&gt; &lt;strong&gt;[R1]&lt;&#x2F;strong&gt; &lt;&#x2F;a&gt;
An address alias -- &lt;code&gt;addressAlias&lt;&#x2F;code&gt; -- to be used between Chain A and Chain B MUST be constructed as follows:
&lt;code&gt;addressAlias (Chain A) = offsetAlias (for Chain A) relativeAddress (on Chain A) offsetAlias (for Chain A)&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6735&#x2F;#r1&quot;&gt;[R1]&lt;&#x2F;a&gt; testability: &lt;code&gt;addressAlias&lt;&#x2F;code&gt; can be parsed and split using existing open source packages and the result compared to known &lt;code&gt;addressAlias&lt;&#x2F;code&gt; and &lt;code&gt;relativeAddress&lt;&#x2F;code&gt; used in the construction.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r2&quot;&gt; &lt;strong&gt;[R2]&lt;&#x2F;strong&gt; &lt;&#x2F;a&gt;
The &lt;code&gt;offsetAlias&lt;&#x2F;code&gt; of a chain MUST be &lt;code&gt;0xchainId00000000000000000000000000000000chainId&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6735&#x2F;#r2&quot;&gt;[R2]&lt;&#x2F;a&gt; testability: &lt;code&gt;offsetAlias&lt;&#x2F;code&gt; can be parsed and split using existing open source packages and the result compared to known &lt;code&gt;chainId&lt;&#x2F;code&gt; used in the construction.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r3&quot;&gt; &lt;strong&gt;[R3]&lt;&#x2F;strong&gt; &lt;&#x2F;a&gt;
The &lt;code&gt;chainId&lt;&#x2F;code&gt; used in the &lt;code&gt;offsetAlias&lt;&#x2F;code&gt; MUST NOT be zero (0)&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6735&#x2F;#r3&quot;&gt;[R3]&lt;&#x2F;a&gt; testability: A &lt;code&gt;chainId&lt;&#x2F;code&gt; is a numerical value and can be compared to &lt;code&gt;0&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r4&quot;&gt; &lt;strong&gt;[R4]&lt;&#x2F;strong&gt; &lt;&#x2F;a&gt;
The &lt;code&gt;chainId&lt;&#x2F;code&gt; used in the &lt;code&gt;offsetAlias&lt;&#x2F;code&gt; MUST be 8 bytes.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6735&#x2F;#r4&quot;&gt;[R4]&lt;&#x2F;a&gt; testability: The length of the &lt;code&gt;chainId&lt;&#x2F;code&gt; string can be converted to bytes and then compared to &lt;code&gt;8&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r5&quot;&gt; &lt;strong&gt;[R5]&lt;&#x2F;strong&gt; &lt;&#x2F;a&gt;
In case the &lt;code&gt;chainId&lt;&#x2F;code&gt; has less than 16 digits the &lt;code&gt;chainId&lt;&#x2F;code&gt; MUST be padded with zeros to 16 digits.&lt;&#x2F;p&gt;
&lt;p&gt;For example the &lt;code&gt;chainId&lt;&#x2F;code&gt; of Polygon PoS is &lt;code&gt;137&lt;&#x2F;code&gt;, with the current list of EVM based &lt;code&gt;chainId&lt;&#x2F;code&gt;s to be found at chainlist.org, and its &lt;code&gt;offsetAlias&lt;&#x2F;code&gt; is &lt;code&gt;0x0000000000000137000000000000000000000000000000000000000000000137&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6735&#x2F;#r5&quot;&gt;[R5]&lt;&#x2F;a&gt; testability: &lt;code&gt;chainId&lt;&#x2F;code&gt; can be parsed and split using existing open source packages and the result compared to known &lt;code&gt;chainId&lt;&#x2F;code&gt; used in the construction. Subsequently the number of zeros used in the padding can be computed and compared to the expected number of zeros for the padding.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r6&quot;&gt; &lt;strong&gt;[R6]&lt;&#x2F;strong&gt; &lt;&#x2F;a&gt;
The &lt;code&gt;offsetAlias&lt;&#x2F;code&gt;for Ethereum Mainnet as the primary anchor of EVM based chains MUST be &lt;code&gt;0x1111000000000000000000000000000000001111&lt;&#x2F;code&gt; due to current adoption of this offset by existing L2 solutions.&lt;&#x2F;p&gt;
&lt;p&gt;An example of address alias for the USDC asset would be &lt;code&gt;addressAlias = 0x1111A0b86991c6218b36c1d19D4a2e9Eb0cE3606eB481111&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6735&#x2F;#r6&quot;&gt;[R6]&lt;&#x2F;a&gt; testability: This requirement is a special case of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6735&#x2F;#r1&quot;&gt;[R1]&lt;&#x2F;a&gt;. Hence, it is testable.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r7&quot;&gt; &lt;strong&gt;[R7]&lt;&#x2F;strong&gt; &lt;&#x2F;a&gt;
The &lt;code&gt;relativeAddress&lt;&#x2F;code&gt; of an Externally Owned Account (EOA) or Smart Contract on a chain MUST either be the smart contract or EOA address of the origin chain or a &lt;code&gt;relativeAddress&lt;&#x2F;code&gt; of an EOA or Smart Contract from another chain.&lt;&#x2F;p&gt;
&lt;p&gt;An example of the former instance would be the relative address of wrapped USDC, &lt;code&gt;relativeAddress = 0x1111A0b86991c6218b36c1d19D4a2e9Eb0cE3606eB481111&lt;&#x2F;code&gt;, and an example of the latter would be the relative address of wrapped USDC on Polygon, &lt;code&gt;relativeAddress = 0x00000000000001371111A0b86991c6218b36c1d19D4a2e9Eb0cE3606eB4811110000000000000137&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Finally, an example of an address alias for a message to another L1, L2, or Sidechain for wrapped USDC from Ethereum on Arbitrum would be:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;addressAlias = 0x00000000000421611111A0b86991c6218b36c1d19D4a2e9Eb0cE3606eB4811110000000000042161&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6735&#x2F;#r7&quot;&gt;[R7]&lt;&#x2F;a&gt; testability: Since this document is dealing with EVM-based systems with multiple live implementations, there are multiple known methods of how to verify if an address belongs to an EOA or a smart contract.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r8&quot;&gt; &lt;strong&gt;[R8]&lt;&#x2F;strong&gt; &lt;&#x2F;a&gt;
The order of the &lt;code&gt;offsetAlias&lt;&#x2F;code&gt;es in an &lt;code&gt;addressAlias&lt;&#x2F;code&gt; MUST be ordered from the &lt;code&gt;offSetAlias&lt;&#x2F;code&gt; of the root chain bracketing the &lt;code&gt;relativeAddress&lt;&#x2F;code&gt; on the root chain through the ordered sequence of &lt;code&gt;offsetAlias&lt;&#x2F;code&gt;es of the chains on which the digital asset exists.&lt;&#x2F;p&gt;
&lt;p&gt;For example, a valid &lt;code&gt;addressAlias&lt;&#x2F;code&gt; of an asset on chain A bridged to chain B and subsequently to chain C and that is to be bridged to yet another chain from chain C would be:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;addressAlias = chainId(C) chainId(B) chainId(A) relativeAddress chainId(A) chainId(B) chainId(C)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;However, the reverse order is invalid:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;addressAlias = chainId(A) chainId(B) chainId(C) relativeAddress chainId(C) chainId(B) chainId(A)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6735&#x2F;#r8&quot;&gt;[R8]&lt;&#x2F;a&gt; testability: Since &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6735&#x2F;#r1&quot;&gt;[R1]&lt;&#x2F;a&gt; is testable and since &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6735&#x2F;#r8&quot;&gt;[R8]&lt;&#x2F;a&gt; is an order rule for the construction in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6735&#x2F;#r1&quot;&gt;[R1]&lt;&#x2F;a&gt;, which can be tested by applying logic operations on the output of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6735&#x2F;#r1&quot;&gt;[R1]&lt;&#x2F;a&gt; tests, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6735&#x2F;#r8&quot;&gt;[R8]&lt;&#x2F;a&gt; is testable.&lt;&#x2F;p&gt;
&lt;p&gt;Note, that a proof that a given order is provably correct is beyond the scope of this document.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;conformance&quot;&gt;Conformance&lt;&#x2F;h3&gt;
&lt;p&gt;This section describes the conformance clauses and tests required to achieve an implementation that is provably conformant with the requirements in this document.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;conformance-targets&quot;&gt;Conformance Targets&lt;&#x2F;h4&gt;
&lt;p&gt;This document does not yet define a standardized set of test-fixtures with test inputs for all MUST, SHOULD, and MAY requirements with conditional MUST or SHOULD requirements.&lt;&#x2F;p&gt;
&lt;p&gt;A standardized set of test-fixtures with test inputs for all MUST, SHOULD, and MAY requirements with conditional MUST or SHOULD requirements is intended to be published with the next version of the standard.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;conformance-levels&quot;&gt;Conformance Levels&lt;&#x2F;h4&gt;
&lt;p&gt;This section specifies the conformance levels of this standard. The conformance levels offer implementers several levels of conformance. These can be used to establish competitive differentiation.&lt;&#x2F;p&gt;
&lt;p&gt;This document defines the conformance levels of EVM based Address Aliasing as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Level 1:&lt;&#x2F;strong&gt; All MUST requirements are fulfilled by a specific implementation as proven by a test report that proves in an easily understandable manner the implementation&#x27;s conformance with each requirement based on implementation-specific test-fixtures with implementation-specific test-fixture inputs.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Level 2:&lt;&#x2F;strong&gt; All MUST and SHOULD requirements are fulfilled by a specific implementation as proven by a test report that proves in an easily understandable manner the implementation&#x27;s conformance with each requirement based on implementation-specific test-fixtures with implementation-specific test-fixture inputs.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Level 3:&lt;&#x2F;strong&gt; All MUST, SHOULD, and MAY requirements with conditional MUST or SHOULD requirements are fulfilled by a specific implementation as proven by a test report that proves in an easily understandable manner the implementation&#x27;s conformance with each requirement based on implementation-specific test-fixtures with implementation-specific test-fixture inputs.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;a name=&quot;d1&quot;&gt; &lt;strong&gt;[D1]&lt;&#x2F;strong&gt; &lt;&#x2F;a&gt;
A claim that a canonical token list implementation conforms to this specification SHOULD describe a testing procedure carried out for each requirement to which conformance is claimed, that justifies the claim with respect to that requirement.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6735&#x2F;#d1&quot;&gt;[D1]&lt;&#x2F;a&gt; testability: Since each of the non-conformance-target requirements in this documents is testable, so must be the totality of the requirements in this document. Therefore, conformance tests for all requirements can exist, and can be described as required in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6735&#x2F;#d1&quot;&gt;[D1]&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r9&quot;&gt; &lt;strong&gt;[R9]&lt;&#x2F;strong&gt; &lt;&#x2F;a&gt;
A claim that a canonical token list implementation conforms to this specification at &lt;strong&gt;Level 2&lt;&#x2F;strong&gt; or higher MUST describe the testing procedure carried out for each requirement at &lt;strong&gt;Level 2&lt;&#x2F;strong&gt; or higher, that justifies the claim to that requirement.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6735&#x2F;#r9&quot;&gt;[R9]&lt;&#x2F;a&gt; testability: Since each of the non-conformance-target requirements in this documents is testable, so must be the totality of the requirements in this document. Therefore, conformance tests for all requirements can exist, be described, be built and implemented and results can be recorded as required in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6735&#x2F;#r9&quot;&gt;[R9]&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The standard follows an already existing approach for address aliasing from Ethereum (L1) to EVM-based L2s such as Arbitrum and Optimism and between L2s, and extends and generalizes it to allow aliasing across any type of EVM-based network irrespective of the network type -- L1, L2 or higher layer networks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;data-privacy&quot;&gt;Data Privacy&lt;&#x2F;h3&gt;
&lt;p&gt;The standard does not set any requirements for compliance to jurisdiction legislation&#x2F;regulations. It is the responsibility of the implementer to comply with applicable data privacy laws.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;production-readiness&quot;&gt;Production Readiness&lt;&#x2F;h3&gt;
&lt;p&gt;The standard does not set any requirements for the use of specific applications&#x2F;tools&#x2F;libraries etc. The implementer should perform due diligence when selecting specific applications&#x2F;tools&#x2F;libraries.&lt;&#x2F;p&gt;
&lt;p&gt;There are security considerations as to the Ethereum-type addresses used in the construction of the &lt;code&gt;relativeAddress&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;If the Ethereum-type address used in the &lt;code&gt;relativeAddress&lt;&#x2F;code&gt; is supposed to be an EOA, the target system&#x2F;recipient should validate that the &lt;code&gt;codehash&lt;&#x2F;code&gt; of the source account is &lt;code&gt;NULL&lt;&#x2F;code&gt; such that no malicious code can be executed surreptitiously in an asset transfer.&lt;&#x2F;p&gt;
&lt;p&gt;If the Ethereum-type address used in the &lt;code&gt;relativeAddress&lt;&#x2F;code&gt; is supposed to be a smart contract account representing an asset, the target system&#x2F;recipient should validate that the &lt;code&gt;codehash&lt;&#x2F;code&gt; of the source account matches the &lt;code&gt;codehash&lt;&#x2F;code&gt; of the published smart contract solidity code to ensure that the source smart contract behaves as expected.&lt;&#x2F;p&gt;
&lt;p&gt;Lastly, it is recommended that as part of the &lt;code&gt;relativeAddress&lt;&#x2F;code&gt; validation the target system performs an address checksum validation as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;55&#x2F;&quot;&gt;ERC-55&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;internationalization-and-localization&quot;&gt;Internationalization and Localization&lt;&#x2F;h3&gt;
&lt;p&gt;Given the non-language specific features of EVM-based address aliasing, there are no internationalization&#x2F;localization considerations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Royalty Bearing NFTs</title>
        <published>2022-03-14T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Andreas Freund</name><uri>https://github.com/Therecanbeonlyone1969</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4910/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/royalty-bearing-nfts/8453" />
        

        <id>https://wg-eips.ritovision.com/4910/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:4910"
            label="ERC-4910" />
        

        
        

        
        <summary type="html">Extension of ERC-721 to correctly define, process, and pay (hierarchical) onchain NFT royalties.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4910/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The proposal directly connects NFTs and royalties in a smart contract architecture extending the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; standard, with the aim of precluding central authorities from manipulating or circumventing payments to those who are legally entitled to them.&lt;&#x2F;p&gt;
&lt;p&gt;The proposal builds upon the OpenZeppelin Smart Contract Toolbox architecture, and extends it to include royalty account management (CRUD), royalty balance and payments management, simple trading capabilities -- Listing&#x2F;De-Listing&#x2F;Buying -- and capabilities to trace trading on exchanges. The royalty management capabilities allow for hierarchical royalty structures, referred to herein as royalty trees, to be established by logically connecting a &quot;parent&quot; NFT to its &quot;children&quot;, and recursively enabling NFT &quot;children&quot; to have more children.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The management of royalties is an age-old problem characterized by complex contracts, opaque management, plenty of cheating and fraud.&lt;&#x2F;p&gt;
&lt;p&gt;The above is especially true for a hierarchy of royalties, where one or more assets is derived from an original asset such as a print from an original painting, or a song is used in the creation of another song, or distribution rights and compensation are managed through a series of affiliates.&lt;&#x2F;p&gt;
&lt;p&gt;In the example below, the artist who created the original is eligible to receive proceeds from every sale, and resale, of a print.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4910&#x2F;.&#x2F;assets&#x2F;eip-4910-print-families.png&quot; alt=&quot;Fig1&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The basic concept for hierarchical royalties utilizing the above &quot;ancestry concept&quot; is demonstrated in the figure below.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4910&#x2F;.&#x2F;assets&#x2F;eip-4910-royalties.png&quot; alt=&quot;Fig2&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;In order to solve for the complicated inheritance problem, this proposal breaks down the recursive problem of the hierarchy tree of depth N into N separate problems, one for each layer. This allows us to traverse the tree from its lowest level upwards to its root most efficiently.&lt;&#x2F;p&gt;
&lt;p&gt;This affords creators, and the distributors of art derived from the original, the opportunity to achieve passive income from the creative process, enhancing the value of an NFT, since it now not only has intrinsic value but also comes with an attached cash flow.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;outline&quot;&gt;Outline&lt;&#x2F;h3&gt;
&lt;p&gt;This proposal introduces several new concepts as extensions to the ERC-721 standard that warrant explanation:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Royalty Account (RA)&lt;&#x2F;strong&gt;
&lt;ul&gt;
&lt;li&gt;A Royalty Account is attached to each NFT through its &lt;code&gt;tokenId&lt;&#x2F;code&gt; and consists of several sub-accounts which can be accounts of individuals or other RAs. A Royalty Account is identified by an account identifier.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Account Type&lt;&#x2F;strong&gt;
&lt;ul&gt;
&lt;li&gt;This specifies if an RA Sub Account belongs to an individual (user) or is another RA. If there is another RA as an RA Sub Account, the allocated balance needs to be reallocated to the Sub Accounts making up the referenced RA.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Royalty Split&lt;&#x2F;strong&gt;
&lt;ul&gt;
&lt;li&gt;The percentage each Sub Account receives based on a sale of an NFT that is associated with an RA&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Royalty Balance&lt;&#x2F;strong&gt;
&lt;ul&gt;
&lt;li&gt;The royalty balance associated with an RA&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Sub Account Royalty Balance&lt;&#x2F;strong&gt;
&lt;ul&gt;
&lt;li&gt;The royalty balance associated to each RA Sub Account. Note that only individual accounts can carry a balance that can be paid out. That means that if an RA Sub Account is an RA, its final Sub Account balance must be zero, since all RA balances must be allocated to individual accounts.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Token Type&lt;&#x2F;strong&gt;
&lt;ul&gt;
&lt;li&gt;Token Type is given as either ETH or the symbol of the supported utility tokens such as &lt;code&gt;DAI&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Asset ID&lt;&#x2F;strong&gt;
&lt;ul&gt;
&lt;li&gt;This is the &lt;code&gt;tokenId&lt;&#x2F;code&gt; the RA belongs to.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Parent&lt;&#x2F;strong&gt;
&lt;ul&gt;
&lt;li&gt;This indicates which &lt;code&gt;tokenId&lt;&#x2F;code&gt; is the immediate parent of the &lt;code&gt;tokenId&lt;&#x2F;code&gt; to which an RA belongs.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Below a non-normative overview is given of the data structures and functionality that are covered by the requirements in this document.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;data-structures&quot;&gt;Data Structures&lt;&#x2F;h4&gt;
&lt;p&gt;In order to create an interconnected data structure linking NFTs to RAs certain global data structures are required:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A Royalty Account and associated Royalty Sub Accounts to establish the concept of a Royalty Account with sub accounts.&lt;&#x2F;li&gt;
&lt;li&gt;Connecting a &lt;code&gt;tokenId&lt;&#x2F;code&gt; to a Royalty Account identifier.&lt;&#x2F;li&gt;
&lt;li&gt;A structure mapping parent-to-child NFT relationships.&lt;&#x2F;li&gt;
&lt;li&gt;A listing of token types and last validated balance (for trading and royalty payment purposes)&lt;&#x2F;li&gt;
&lt;li&gt;A listing of registered payments to be made in the &lt;code&gt;executePayment&lt;&#x2F;code&gt; function and validated in &lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt;. This is sufficient, because a payment once received and distributed in the &lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt; function will be removed from the listing.&lt;&#x2F;li&gt;
&lt;li&gt;A listing of NFTs to be sold&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;royalty-account-functions&quot;&gt;Royalty Account Functions&lt;&#x2F;h4&gt;
&lt;p&gt;Definitions and interfaces for the Royalty Account RUD (Read-Update-Delete) functions. Because the RA is created in the minting function, there is no need to have a function to create a royalty account separately.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;minting-of-a-royalty-bearing-nft&quot;&gt;Minting of a Royalty Bearing NFT&lt;&#x2F;h4&gt;
&lt;p&gt;When an NFT is minted, an RA must be created and associated with the NFT and the NFT owner, and, if there is an ancestor, with the ancestor&#x27;s RA. To this end the specification utilizes the &lt;code&gt;_safemint&lt;&#x2F;code&gt; function in a newly defined &lt;code&gt;mint&lt;&#x2F;code&gt; function and applies various business rules on the input variables.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;listing-nfts-for-sale-and-removing-a-listing&quot;&gt;Listing NFTs for Sale and removing a Listing&lt;&#x2F;h4&gt;
&lt;p&gt;Authorized user addresses can list NFTs for sale for non-exchange mediated NFT purchases.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;payment-function-from-buyer-to-seller&quot;&gt;Payment Function from Buyer to Seller&lt;&#x2F;h4&gt;
&lt;p&gt;To avoid royalty circumvention, a buyer will always pay the NFT contract directly and not the seller. The seller is paid through the royalty distribution and can later request a payout.&lt;&#x2F;p&gt;
&lt;p&gt;The payment process depends on whether the payment is received in ETH or an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; token:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;ERC-20 Token
&lt;ol&gt;
&lt;li&gt;The Buyer must &lt;code&gt;approve&lt;&#x2F;code&gt; the NFT contract for the purchase price, &lt;code&gt;payment&lt;&#x2F;code&gt; for the selected payment token (ERC-20 contract address).&lt;&#x2F;li&gt;
&lt;li&gt;For an ERC-20 payment token, the Buyer must then call the &lt;code&gt;executePayment&lt;&#x2F;code&gt; in the NFT contract -- the ERC-20 is not directly involved.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;For a non-ERC-20 payment, the Buyer must send a protocol token (ETH) to the NFT contract, and is required to send &lt;code&gt;msg.data&lt;&#x2F;code&gt; encoded as an array of purchased NFTs &lt;code&gt;uint256[] tokenId&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;modified-nft-transfer-function-including-required-trade-data-to-allocate-royalties&quot;&gt;Modified NFT Transfer Function including required Trade data to allocate Royalties&lt;&#x2F;h4&gt;
&lt;p&gt;The input parameters must satisfy several requirements for the NFT to be transferred AFTER the royalties have been properly distributed. Furthermore, the ability to transfer more than one token at a time is also considered.&lt;&#x2F;p&gt;
&lt;p&gt;The proposal defines:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Input parameter validation&lt;&#x2F;li&gt;
&lt;li&gt;Payment Parameter Validation&lt;&#x2F;li&gt;
&lt;li&gt;Distributing Royalties&lt;&#x2F;li&gt;
&lt;li&gt;Update Royalty Account ownership with payout&lt;&#x2F;li&gt;
&lt;li&gt;Transferring Ownership of the NFT&lt;&#x2F;li&gt;
&lt;li&gt;Removing the Payment entry in &lt;code&gt;registeredPayment&lt;&#x2F;code&gt; after successful transfer&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Lastly, the approach to distributing royalties is to break down the hierarchical structure of interconnected Royalty Accounts into layers and then process one layer at time, where each relationship between a token and its ancestor is utilized to traverse the Royalty Account chain until the root ancestor and associated RA is reached.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;paying-out-royalties-to-the-nft-owner-from-address-in-safetransferfrom-function&quot;&gt;Paying out Royalties to the NFT Owner -- &lt;code&gt;from&lt;&#x2F;code&gt; address in &lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt; Function&lt;&#x2F;h4&gt;
&lt;p&gt;This is the final part of the proposal.&lt;&#x2F;p&gt;
&lt;p&gt;There are two versions of the payout function -- a &lt;code&gt;public&lt;&#x2F;code&gt; function and an &lt;code&gt;internal&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;p&gt;The public function has the following interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function royaltyPayOut (uint256 tokenId, address RAsubaccount, address payable payoutAccount, uint256 amount) public virtual nonReentrant returns (bool)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where we only need the &lt;code&gt;tokenId&lt;&#x2F;code&gt;, the RA Sub Account address, &lt;code&gt;_RAsubaccount&lt;&#x2F;code&gt; which is the &lt;code&gt;owner&lt;&#x2F;code&gt;, and the amount to be paid out, &lt;code&gt;_amount&lt;&#x2F;code&gt;. Note that the function has &lt;code&gt;nonReentrant&lt;&#x2F;code&gt; modifier protection, because funds are being payed out.&lt;&#x2F;p&gt;
&lt;p&gt;To finally send a Payout payment, the following steps need to be taken:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;find the RA Sub Account based on &lt;code&gt;RAaccount&lt;&#x2F;code&gt; and the &lt;code&gt;subaccountPos&lt;&#x2F;code&gt; and extract the balance&lt;&#x2F;li&gt;
&lt;li&gt;extract &lt;code&gt;tokenType&lt;&#x2F;code&gt; from the Sub Account&lt;&#x2F;li&gt;
&lt;li&gt;based on the token type, send the payout payment (not exceeding the available balance)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;data-structures-1&quot;&gt;Data Structures&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;royalty-account-and-royalty-sub-accounts&quot;&gt;Royalty Account and Royalty Sub Accounts&lt;&#x2F;h4&gt;
&lt;p&gt;In order to create an interconnected data structure linking NFTs to RAs that is search optimized requires to make the following additions to the global data structures of an ERC-721.&lt;&#x2F;p&gt;
&lt;p&gt;Note, a Royalty Account is defined as a collection of Royalty Sub Accounts linked to a meta account. This meta account is comprised of general account identifiers particular to the NFT it is linked to such as asset identifier, parent identifier etc.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r1&quot;&gt;&lt;strong&gt;[R1]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; &lt;em&gt;One or more Royalty Sub-Account MUST be linked to a Royalty Account.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r2&quot;&gt;&lt;strong&gt;[R2]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; &lt;em&gt;The account identifier of a Royalty Account, &lt;code&gt;raAccountId&lt;&#x2F;code&gt;, MUST be unique.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r3&quot;&gt;&lt;strong&gt;[R3]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; &lt;em&gt;The &lt;code&gt;tokenId&lt;&#x2F;code&gt; of a NFT MUST be linked to a &lt;code&gt;raAccountID&lt;&#x2F;code&gt; in order to connect an &lt;code&gt;raAccountId&lt;&#x2F;code&gt; to a &lt;code&gt;tokenId&lt;&#x2F;code&gt;.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;print-child-nfts&quot;&gt;Print (Child) NFTs&lt;&#x2F;h4&gt;
&lt;p&gt;The set of requirement to manage Parent-Child NFT Relationships and constraints at each level of the NFT (family) tree e.g. number of children permitted, NFT parents have to be linked to their immediate NFT children are as follows.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r4&quot;&gt;&lt;strong&gt;[R4]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; &lt;em&gt;There MUST be a link for direct parent-child relationships&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;nft-payment-tokens&quot;&gt;NFT Payment Tokens&lt;&#x2F;h4&gt;
&lt;p&gt;In order to capture royalties, an NFT contract must be involved in NFT trading. Therefore, the NFT contract needs to be aware of NFT payments, which in turn requires the NFT contract to be aware which tokens can be used for trading.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r5&quot;&gt;&lt;strong&gt;[R5]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; &lt;em&gt;There MUST be a listing of supported token types&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Since the NFT contract is managing royalty distributions and payouts as well as sales, it needs to track the last available balances of the allowed token types owned by the contract.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r6&quot;&gt;&lt;strong&gt;[R6]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; &lt;em&gt;There MUST be a link of the last validated balance of an allowed token type in the contract to the respective allowed token contract.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;nft-listings-and-payments&quot;&gt;NFT Listings and Payments&lt;&#x2F;h4&gt;
&lt;p&gt;Since the contract is directly involved in the sales process, a capability to list one or more NFTs for sale is required.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r7&quot;&gt;&lt;strong&gt;[R7]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; &lt;em&gt;There MUST be a list of NFTs for sale.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r8&quot;&gt;&lt;strong&gt;[R8]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; &lt;em&gt;A sales listing MUST have a unique identifier.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Besides listings, the contract is required to manage sales as well. This requires the capability to register a payment, either for immediate execution or for later payment such as in an auction situation.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r9&quot;&gt;&lt;strong&gt;[R9]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; &lt;em&gt;There MUST be a listing for registered payments&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r10&quot;&gt;&lt;strong&gt;[R10]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; &lt;em&gt;A registered payment MUST have a unique identifier.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;contract-constructor-and-global-variables-and-their-update-functions&quot;&gt;Contract Constructor and Global Variables and their update functions&lt;&#x2F;h4&gt;
&lt;p&gt;This standard extends the current ERC-721 constructor, and adds several global variables to recognize the special role of the creator of an NFT, and the fact that the contract is now directly involved in managing sales and royalties.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r11&quot;&gt;&lt;strong&gt;[R11]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; &lt;em&gt;The minimal contract constructor MUST contain the following input elements.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @dev Definition of the contract constructor&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @param name as in ERC-721&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @param symbol as in ERC-721&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @param baseTokenURI as in ERC-721&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @param allowedTokenTypes is the array of allowed tokens for payment&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;constructor(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        string memory name,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        string memory symbol,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        string memory baseTokenURI,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address[] memory allowedTokenTypes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ) ERC721(name, symbol) {...}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;royalty-account-management&quot;&gt;Royalty Account Management&lt;&#x2F;h3&gt;
&lt;p&gt;Below are the definitions and interfaces for the Royalty Account RUD (Read-Update-Delete) functions. Since a Royalty Account is created in the NFT minting function, there is no need to have a separate function to create a royalty account.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;get-a-royalty-account&quot;&gt;Get a Royalty Account&lt;&#x2F;h4&gt;
&lt;p&gt;There is only one get function required because a Royalty Account and its sub accounts can be retrieved through the &lt;code&gt;tokenId&lt;&#x2F;code&gt; in the &lt;code&gt;ancestry&lt;&#x2F;code&gt; field of the Royalty Account.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r12&quot;&gt;&lt;strong&gt;[R12]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; &lt;em&gt;The &lt;code&gt;getRoyaltyAccount&lt;&#x2F;code&gt; function interface MUST adhere to the definition below:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @dev Function to fetch a Royalty Account for a given tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @param tokenId is the identifier of the NFT to which a Royalty Account is attached&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @param RoyaltyAccount is a data structure containing the royalty account information&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @param RASubAccount[] is an array of data structures containing the information of the royalty sub accounts associated with the royalty account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function getRoyaltyAccount (uint256 tokenId) public view virtual returns (address,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            RoyaltyAccount memory,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            RASubAccount[] memory);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;a name=&quot;r13&quot;&gt;&lt;strong&gt;[R13]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; &lt;em&gt;The following business rules MUST be enforced in the &lt;code&gt;getRoyaltyAccount&lt;&#x2F;code&gt; function:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;tokenId&lt;&#x2F;code&gt; exists and is not burned&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;update-a-royalty-account&quot;&gt;Update a Royalty Account&lt;&#x2F;h4&gt;
&lt;p&gt;In order to update a Royalty Account, the caller must have both the &#x27;tokenId&#x27; and the &lt;code&gt;RoyaltyAccount&lt;&#x2F;code&gt; itself which can be obtained from the Royalty Account getter function.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r14&quot;&gt;&lt;strong&gt;[R14]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; &lt;em&gt;The &lt;code&gt;updateRoyaltyAccount&lt;&#x2F;code&gt; function interface MUST adhere to the definition below:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @dev Function to update a Royalty Account and its Sub Accounts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @param tokenId is the identifier of the NFT to which the Royalty Account to be updated is attached&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @param RoyaltyAccount is the Royalty Account and associated Royalty Sub Accounts with updated values  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function updateRoyaltyAccount (uint256 _tokenId, `RoyaltyAccount memory _raAccount) public virtual returns (bool)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The update functionality of a Royalty Account, while straightforward, is also highly nuanced. To avoid complicated change control rules such as multi-signature rules, Royalty Account changes are kept simple.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r15&quot;&gt;&lt;strong&gt;[R15]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; &lt;em&gt;The business rules for the update function are as follows:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;An NFTs asset identifier MUST NOT be changed.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;An NFTs ancestor MUST NOT be updated.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;An NFTs token type accepted for payment MUST NOT be updated.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;The royalty balance in a Royalty Sub Account MUST NOT be changed.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;The royalty split inherited by the children from the NFT parent MUST NOT be changed.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;New royalty split values MUST be larger than, or less than, or equal to any established boundary value for royalty splits, if it exists.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;The number of existing Royalty Sub Account plus the number of new Royalty Sub Accounts to be added MUST be smaller or equal to an established boundary value, if it exists.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;The sum of all royalty splits across all existing and new Royalty Sub Accounts MUST equal to 1 or its equivalent numerical value at all times.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;&#x27;msg.sender` MUST be equal to an account identifier in the Royalty Sub Account of the Royalty Account to be modified and that royalty sub account must be identified as not belonging to the parent NFT&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;9.1 &lt;em&gt;the Sub Account belonging to the account identifier MUST NOT be removed&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;9.2 &lt;em&gt;A royalty split MUST only be decreased, and either the existing sub account&#x27;s  royalty split MUST be increased accordingly such that the sum of all royalty splits remains equal to 1 or its numerical equivalent, or one or more new Royalty Sub Accounts MUST be added according to rule 10.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;9.3 &lt;em&gt;a royalty balance MUST NOT be changed&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;9.4 &lt;em&gt;an account identifier MUST NOT be NULL&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;If &lt;code&gt;msg.sender&lt;&#x2F;code&gt; is equal to the account identifier of one of the Sub Account owners which is not the parent NFT, an additional Royalty Sub Accounts MAY be added&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;10.1 &lt;em&gt;if the royalty split of the Royalty Sub Account belonging to &lt;code&gt;msg.sender&lt;&#x2F;code&gt; is reduced&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;then the royalty balance in each new Royalty Sub Account MUST be zero&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;and the sum of the new royalty splits data MUST be equal to the royalty split of the Royalty Sub Account of &lt;code&gt;msg.sender&lt;&#x2F;code&gt; before it was modified&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;10.2 &lt;em&gt;new account identifier MUST not be NULL&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;If the Royalty Account update is correct, the function returns &lt;code&gt;true&lt;&#x2F;code&gt;, otherwise &lt;code&gt;false&lt;&#x2F;code&gt;.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h4 id=&quot;deleting-a-royalty-account&quot;&gt;Deleting a Royalty Account&lt;&#x2F;h4&gt;
&lt;p&gt;While sometimes deleting a Royalty Account is necessary, even convenient, it is a very costly function in terms of gas, and should not be used unless one is absolutely sure that the conditions enumerated below are met.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r16&quot;&gt;&lt;strong&gt;[R16]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; &lt;em&gt;The &lt;code&gt;deleteRoyaltyAccount&lt;&#x2F;code&gt; function interface MUST adhere to the definition below:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @dev Function to delete a Royalty Account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @param tokenId is the identifier of the NFT to which the Royalty Account to be updated is attached&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function deleteRoyaltyAccount (uint256 _tokenId) public virtual returns (bool)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;a name=&quot;r17&quot;&gt;&lt;strong&gt;[R17]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; &lt;em&gt;The business rules for this function are as follows:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;_tokenId&lt;&#x2F;code&gt; MUST be burned, i.e., have owner &lt;code&gt;address(0)&lt;&#x2F;code&gt;.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;all &lt;code&gt;tokenId&lt;&#x2F;code&gt; numbers genealogically related to &lt;code&gt;_tokenId&lt;&#x2F;code&gt; either as ancestors or offspring MUST also be burnt.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;all balances in the Royalty Sub Accounts MUST be zero.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;nft-minting&quot;&gt;NFT Minting&lt;&#x2F;h3&gt;
&lt;p&gt;In extension to the ERC-721 minting capability, a Royalty Account with Royalty Sub Accounts are required to be added during the minting, besides establishing the NFT token specific data structures supporting constraints such as the maximum number of children an NFT can have.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r18&quot;&gt;&lt;strong&gt;[R18]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; &lt;em&gt;When a new NFT is minted a Royalty Account with one or more Royalty Sub Accounts MUST be created and associated with the NFT and the NFT owner, and, if there is an ancestor, with the ancestor&#x27;s Royalty Account.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;To this end the specification utilizes the ERC-721 &lt;code&gt;_safemint&lt;&#x2F;code&gt; function in a newly defined &lt;code&gt;mint&lt;&#x2F;code&gt; function, and applies various business rules on the function&#x27;s input variables.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;d1&quot;&gt;&lt;strong&gt;[D1]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; &lt;em&gt;Note, that the &lt;code&gt;mint&lt;&#x2F;code&gt; function SHOULD have the ability to mint more than one NFT at a time.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r19&quot;&gt;&lt;strong&gt;[R19]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; &lt;em&gt;Also, note that the &lt;code&gt;owner&lt;&#x2F;code&gt; of a new NFT MUST be the NFT contract itself.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r20&quot;&gt;&lt;strong&gt;[R20]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; &lt;em&gt;The non-contract owner of the NFT MUST be set as &lt;code&gt;isApproved&lt;&#x2F;code&gt; which allows the non-contract owner to operate just like the &lt;code&gt;owner&lt;&#x2F;code&gt;.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;This strange choice in the two requirements above is necessary, because the NFT contract functions as an escrow for payments and royalties, and, hence, needs to be able to track payments received from buyers and royalties due to recipients, and to associate them with a valid &lt;code&gt;tokenId&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r21&quot;&gt;&lt;strong&gt;[R21]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; &lt;em&gt;For compactness of the input, and since the token meta data might vary from token to token the MUST be a minimal data structure containing:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @param parent is the parent tokenId of the (child) token, and if set to 0 then there is no parent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @param canBeParent indicates if a tokenId can have children or not.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @param maxChildren defines how many children an NFT can have.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @param royaltySplitForItsChildren is the royalty percentage split that a child has to pay to its parent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @param uri is the unique token URI of the NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;a name=&quot;r22&quot;&gt;&lt;strong&gt;[R22]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; &lt;em&gt;The &lt;code&gt;mint&lt;&#x2F;code&gt; function interface MUST adhere to the definition below:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @dev Function creates one or more new NFTs with its relevant meta data necessary for royalties, and a Royalty Account with its associated met data for `to` address. The tokenId(s) will be automatically assigned (and available on the emitted {IERC-721-Transfer} event).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @param to is the address to which the NFT(s) are minted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @param nfttoken is an array of struct type NFTToken for the meta data of the minted NFT(s)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @param tokenType is the type of allowed payment token for the NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function mint(address to, NFTToken[] memory nfttoken, address tokenType) public virtual&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;a name=&quot;r23&quot;&gt;&lt;strong&gt;[R23]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; &lt;em&gt;The following business rules for the &lt;code&gt;mint&lt;&#x2F;code&gt; function&#x27;s input data MUST be fulfilled:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;The number of tokens to be minted MUST NOT be zero.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;msg.sender&lt;&#x2F;code&gt; MUST have either the &lt;code&gt;MINTER_ROLE&lt;&#x2F;code&gt; or the &lt;code&gt;CREATOR_Role&lt;&#x2F;code&gt; identifying the creator of the first NFT.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;to&lt;&#x2F;code&gt; address MUST NOT be the zero address.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;to&lt;&#x2F;code&gt; address MUST NOT be a contract, unless it has been whitelisted -- see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4910&#x2F;#security-considerations&quot;&gt;Security Considerations&lt;&#x2F;a&gt; for more details.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;tokenType&lt;&#x2F;code&gt; MUST be a token type supported by the contract.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;royaltySplitForItsChildren&lt;&#x2F;code&gt; MUST be less or equal to 100% or numerical equivalent thereof less any constraints such as platform fees&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;If the new NFT(s) cannot have children, &lt;code&gt;royaltySplitForItsChildren&lt;&#x2F;code&gt; MUST be zero.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;If the new NFT(s) has a parent, the parent NFT &lt;code&gt;tokenId&lt;&#x2F;code&gt; MUST exist.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;The ancestry level of the parent MUST be less than the maximum number of allowed NFT generations, if specified.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;The number of allowed children for an NFT to be minted MUST be less than the maximum number of allowed children, if specified.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;listing-and-de-listing-of-nfts-for-direct-sales&quot;&gt;Listing and De-Listing of NFTs for Direct Sales&lt;&#x2F;h3&gt;
&lt;p&gt;In the sales process, we need to minimally distinguish two types of transactions&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Exchange-mediated sales&lt;&#x2F;li&gt;
&lt;li&gt;Direct sales&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The first type of transaction does not require that the smart contract is aware of a sales listing since the exchange contract will trigger payment and transfer transactions directly with the NFT contract as the owner. However, for the latter transaction type it is essential, since direct sales are required to be mediated at every step by the smart contract.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r24&quot;&gt;&lt;strong&gt;[R24]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; &lt;em&gt;For direct sales, NFT listing, und de-listing, transactions MUST be executed through the NFT smart contract.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Exchange-mediated sales will be discussed when this document discusses payments.&lt;&#x2F;p&gt;
&lt;p&gt;In direct sales, authorized user addresses can list NFTs for sale, see the business rules below.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r25&quot;&gt;&lt;strong&gt;[R25]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; &lt;em&gt;The &lt;code&gt;listNFT&lt;&#x2F;code&gt; function interface MUST adhere to the definition below:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @dev Function to list one or more NFTs for direct sales&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @param tokenIds is the array of tokenIds to be included in the listing&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @param price is the price set by the owner for the listed NFT(s)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @param tokenType is the payment token type allowed for the listing&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function listNFT (uint256[] calldata tokenIds, uint256 price, address tokenType) public virtual returns (bool)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The Boolean return value is &lt;code&gt;true&lt;&#x2F;code&gt; for a successful function execution, and &lt;code&gt;false&lt;&#x2F;code&gt; for an unsuccessful function execution.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r26&quot;&gt;&lt;strong&gt;[R26]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; &lt;em&gt;The business rules of the &lt;code&gt;listNFT&lt;&#x2F;code&gt; function are as follows:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;there MUST NOT already be a listing for one or more NFTs in the &lt;code&gt;listedNFT&lt;&#x2F;code&gt; mapping of the proposed listing.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;seller&lt;&#x2F;code&gt; MUST be equal to &lt;code&gt;getApproved(tokenId[i])&lt;&#x2F;code&gt; for all NFTs in the proposed listing.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;tokenType&lt;&#x2F;code&gt; MUST be supported by the smart contract.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;price&lt;&#x2F;code&gt; MUST be larger than &lt;code&gt;0&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;a name=&quot;r27&quot;&gt;&lt;strong&gt;[R27]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; &lt;em&gt;If the conditions in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4910&#x2F;#r26&quot;&gt;&lt;strong&gt;[R26]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; are met, then the NFT sales list MUST be updated.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Authorized user addresses can also remove a direct sale listing of NFTs.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r28&quot;&gt;&lt;strong&gt;[R28]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; &lt;em&gt;The &lt;code&gt;removeNFTListing&lt;&#x2F;code&gt; function interface MUST adhere to the definition below:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @dev Function to de-list one or more NFTs for direct sales&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @param listingId is the identifier of the NFT listing&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function removeNFTListing (uint256 listingId) public virtual returns (bool)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The Boolean return value is &lt;code&gt;true&lt;&#x2F;code&gt; for a successful function execution, and &lt;code&gt;false&lt;&#x2F;code&gt; for an unsuccessful function execution.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r29&quot;&gt;&lt;strong&gt;[R29]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; &lt;em&gt;The business rules of the &lt;code&gt;removeNFTListing&lt;&#x2F;code&gt; function below MUST be adhered to:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;the registered payment entry MUST be NULL&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;msg.sender = getApproved(tokenId)&lt;&#x2F;code&gt; for the NFT listing&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;a name=&quot;r30&quot;&gt;&lt;strong&gt;[R30]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; &lt;em&gt;If the conditions in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4910&#x2F;#r29&quot;&gt;&lt;strong&gt;[R29]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; are met, then the NFT sales listing MUST be removed.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;payments-for-nft-sales&quot;&gt;Payments for NFT Sales&lt;&#x2F;h3&gt;
&lt;p&gt;As noted before, a buyer will always pay the NFT contract directly and not the seller. The seller is paid through the royalty distribution and can later request a payout to their wallet.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r31&quot;&gt;&lt;strong&gt;[R31]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; &lt;em&gt;The payment process requires either one or two steps:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;em&gt;For an ERC-20 token&lt;&#x2F;em&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;The buyer MUST &lt;code&gt;approve&lt;&#x2F;code&gt; the NFT contract for the purchase price, &lt;code&gt;payment&lt;&#x2F;code&gt;, for the selected payment token type.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;The buyer MUST call the &lt;code&gt;executePayment&lt;&#x2F;code&gt; function.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;For a protocol token&lt;&#x2F;em&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;The buyer MUST call a payment fallback function with &lt;code&gt;msg.data&lt;&#x2F;code&gt; not NULL.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;a name=&quot;r32&quot;&gt;&lt;strong&gt;[R32]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; &lt;em&gt;For an ERC-20 token type, the required &lt;code&gt;executePayment&lt;&#x2F;code&gt; function interface MUST adhere to the definition below&lt;&#x2F;em&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @dev Function to make a NFT direct sales or exchange-mediate sales payment&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @param receiver is the address of the receiver of the payment&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @param seller is the address of the NFT seller &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @param tokenIds are the tokenIds of the NFT to be bought&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @param payment is the amount of that payment to be made&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @param tokenType is the type of payment token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @param trxnType is the type of payment transaction -- minimally direct sales or exchange-mediated&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function executePayment (address receiver, address seller, uint 256[] tokenIds, uint256 payment, string tokenType, int256 trxnType) public virtual nonReentrant returns (bool)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The Boolean return value is &lt;code&gt;true&lt;&#x2F;code&gt; for a successful function execution, and &lt;code&gt;false&lt;&#x2F;code&gt; for an unsuccessful function execution.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r33&quot;&gt;&lt;strong&gt;[R33]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; &lt;em&gt;Independent of &lt;code&gt;trxnType&lt;&#x2F;code&gt;, the business rules for the input data are as follows:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;All purchased NFTs in the &lt;code&gt;tokenIds&lt;&#x2F;code&gt; array MUST exist and MUST NOT be burned.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;tokenType&lt;&#x2F;code&gt; MUST be a supported token.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;trxnType&lt;&#x2F;code&gt; MUST be set to either &lt;code&gt;0&lt;&#x2F;code&gt; (direct sale) or &lt;code&gt;1&lt;&#x2F;code&gt; (exchange-mediate sale), or another supported type.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;receiver&lt;&#x2F;code&gt; MAY be NULL but MUST NOT be the Zero Address.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;seller&lt;&#x2F;code&gt; MUST be the address in the corresponding listing.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;msg.sender&lt;&#x2F;code&gt; MUST not be a contract, unless it is whitelisted in the NFT contract.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In the following, this document will only discuss the differences between the two minimally required transaction types.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r34&quot;&gt;&lt;strong&gt;[R34]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; &lt;em&gt;For &lt;code&gt;trxnType = 0&lt;&#x2F;code&gt;, the payment data MUST to be validated against the listing, based on the following rules:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;NFT(s) MUST be listed&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;payment&lt;&#x2F;code&gt; MUST be larger or equal to the listing price.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;The listed NFT(s) MUST match the NFT(s) in the payment data.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;The listed NFT(s) MUST be controlled by &lt;code&gt;seller&lt;&#x2F;code&gt;.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;a name=&quot;r35&quot;&gt;&lt;strong&gt;[R35]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; &lt;em&gt;If all checks in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4910&#x2F;#r33&quot;&gt;&lt;strong&gt;[R33]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt;, and in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4910&#x2F;#r34&quot;&gt;&lt;strong&gt;[R34]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; for &lt;code&gt;trxnType = 0&lt;&#x2F;code&gt;, are passed, the &lt;code&gt;executePayment&lt;&#x2F;code&gt; function MUST call the &lt;code&gt;transfer&lt;&#x2F;code&gt; function in the ERC-20 contract identified by &lt;code&gt;tokenType&lt;&#x2F;code&gt; with &lt;code&gt;recipient = address(this)&lt;&#x2F;code&gt; and &lt;code&gt;amount = payment&lt;&#x2F;code&gt;.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Note the NFT contract pays itself from the available allowance set in the &lt;code&gt;approve&lt;&#x2F;code&gt; transaction from the buyer.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r36&quot;&gt;&lt;strong&gt;[R36]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; &lt;em&gt;For &lt;code&gt;trxnType = 1&lt;&#x2F;code&gt;, and for a successful payment, the &lt;code&gt;registeredPayment&lt;&#x2F;code&gt; mapping MUST updated with the payment, such that it can be validated when the NFT is transferred in a separate &lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt; call, and &lt;code&gt;true&lt;&#x2F;code&gt; MUST be returned as the return value of the function, if successful, &lt;code&gt;false&lt;&#x2F;code&gt; otherwise.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r37&quot;&gt;&lt;strong&gt;[R37]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; &lt;em&gt;For &lt;code&gt;trxnType = 0&lt;&#x2F;code&gt;, an &lt;code&gt;internal&lt;&#x2F;code&gt; version of the &lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt; function with message data MUST be called to transfer the NFTs to the buyer, and upon success, the buyer MUST be given the &lt;code&gt;MINTER_ROLE&lt;&#x2F;code&gt;, unless the buyer already has that role.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Note, the &lt;code&gt;_safeTransferFrom&lt;&#x2F;code&gt; function has the same structure as &lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt; but skips the input data validation.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r38&quot;&gt;&lt;strong&gt;[R38]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; &lt;em&gt;For &lt;code&gt;trxnType = 0&lt;&#x2F;code&gt;, and if the NFT transfer is successful, the listing of the NFT MUST be removed.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r39&quot;&gt;&lt;strong&gt;[R39]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; &lt;em&gt;For a protocol token as a payment token, and independent of &lt;code&gt;trxnType&lt;&#x2F;code&gt;, the buyer MUST send protocol tokens to the NFT contract as the escrow, and &lt;code&gt;msg.data&lt;&#x2F;code&gt; MUST encode the array of paid for NFTs &lt;code&gt;uint256[] tokenIds&lt;&#x2F;code&gt;.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r40&quot;&gt;&lt;strong&gt;[R40]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; &lt;em&gt;For the NFT contract to receive a protocol token, a payable fallback function (&lt;code&gt;fallback() external payable&lt;&#x2F;code&gt;) MUST be implemented.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Note that since the information for which NFTs the payment was for must be passed, a simple &lt;code&gt;receive()&lt;&#x2F;code&gt; fallback function cannot be allowed since it does not allow for &lt;code&gt;msg.data&lt;&#x2F;code&gt; to be sent with the transaction.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r41&quot;&gt;&lt;strong&gt;[R41]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; &lt;em&gt;&lt;code&gt;msg.data&lt;&#x2F;code&gt; for the fallback function MUST minimally contain the following data:
&lt;code&gt;address memory seller, uint256[] memory _tokenId, address memory receiver, int256 memory trxnType&lt;&#x2F;code&gt;&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r42&quot;&gt;&lt;strong&gt;[R42]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; &lt;em&gt;If &lt;code&gt;trxnType&lt;&#x2F;code&gt; is not equal to either &#x27;0&#x27; or &#x27;1&#x27;, or another supported type, then the fallback function MUST &lt;code&gt;revert&lt;&#x2F;code&gt;.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r43&quot;&gt;&lt;strong&gt;[R43]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; &lt;em&gt;For &lt;code&gt;trxnType&lt;&#x2F;code&gt; equal to either &#x27;0&#x27; or &#x27;1&#x27;, the requirements &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4910&#x2F;#r33&quot;&gt;&lt;strong&gt;[R33]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; through &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4910&#x2F;#r38&quot;&gt;&lt;strong&gt;[R38]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; MUST be satisfied for the fallback function to successfully execute, otherwise the fallback function MUST &lt;code&gt;revert&lt;&#x2F;code&gt;.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r44&quot;&gt;&lt;strong&gt;[R44]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; &lt;em&gt;In case of a transaction failure (for direct sales, &lt;code&gt;trxnType = 0&lt;&#x2F;code&gt;), or the buyer of the NFT listing changing their mind (for exchange-mediated sales, &lt;code&gt;trxnType = 1&lt;&#x2F;code&gt;), the submitted payment MUST be able to revert using the &lt;code&gt;reversePayment&lt;&#x2F;code&gt; function where the function interface is defined below:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @dev Definition of the function enabling the reversal of a payment before the sale is complete&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @param paymentId is the unique identifier for which a payment was made&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @param tokenType is the type of payment token used in the payment&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function reversePayment(uint256 paymentId, string memory tokenType) public virtual returns (bool)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The Boolean return value is &lt;code&gt;true&lt;&#x2F;code&gt; for a successful function execution, and &lt;code&gt;false&lt;&#x2F;code&gt; for an unsuccessful function execution.&lt;&#x2F;p&gt;
&lt;p&gt;Note, &lt;code&gt;reentrancy&lt;&#x2F;code&gt; protection through e.g. &lt;code&gt;nonReentrant&lt;&#x2F;code&gt; from the Open Zeppelin library is strongly advised since funds are being paid out.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r45&quot;&gt;&lt;strong&gt;[R45]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; &lt;em&gt;The business rules for the &lt;code&gt;reversePayment&lt;&#x2F;code&gt; function are as follows:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;There MUST be registered payment for a given &lt;code&gt;paymentId&lt;&#x2F;code&gt; and &lt;code&gt;tokenType&lt;&#x2F;code&gt;.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;msg.sender&lt;&#x2F;code&gt; MUST be the buyer address in the registered payment.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;The payment amount must be larger than &lt;code&gt;0&lt;&#x2F;code&gt;.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;The registered payment MUST be removed when the payment has been successfully reverted, otherwise the function must fail.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;modified-nft-transfer-function&quot;&gt;Modified NFT Transfer function&lt;&#x2F;h3&gt;
&lt;p&gt;This document adheres to the ERC-721 interface format for the &lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt; function as given below:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) external virtual override&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note, that the input parameters must satisfy several requirements for the NFT(s) to be transferred AFTER royalties have been properly distributed. Note also, that the ability to transfer more than one token at a time is required. However, the standard interface only allows one token to be transferred at a time. In order to remain compliant with the ERC-721 standard, this document uses &lt;code&gt;tokenId&lt;&#x2F;code&gt; only for the first NFT to be transferred. All other transfer relevant data is encoded in &lt;code&gt;_data&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The high-level requirements are as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The payment parameters of the trade encoded in &lt;code&gt;_data&lt;&#x2F;code&gt; must be validated.&lt;&#x2F;li&gt;
&lt;li&gt;The seller and the sold NFT token(s) must exist, and the seller must be the owner of the token.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;msg.sender&lt;&#x2F;code&gt; must be the seller address or an approved address.&lt;&#x2F;li&gt;
&lt;li&gt;the payment of the trade received by the NFT smart contract is correctly disbursed to all Royalty Sub Account owners.&lt;&#x2F;li&gt;
&lt;li&gt;the NFT token is transferred after all Royalty Sub Accounts and their holders associated with the NFT token(s) have been properly credited.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Also, note that in order to avoid royalty circumvention attacks, there is only one NFT transfer function.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r46&quot;&gt;&lt;strong&gt;[R46]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; &lt;em&gt;Therefore, &lt;code&gt;transferFrom&lt;&#x2F;code&gt; and &lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt; without &lt;code&gt;data&lt;&#x2F;code&gt; MUST be disabled.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;This can be achieved through for example a &lt;code&gt;revert&lt;&#x2F;code&gt; statement in an &lt;code&gt;override&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r47&quot;&gt;&lt;strong&gt;[R47]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; &lt;em&gt;The requirements on input parameters of the function are as follows&lt;&#x2F;em&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;from&lt;&#x2F;code&gt; MUST not be &lt;code&gt;address(0)&lt;&#x2F;code&gt;.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;from&lt;&#x2F;code&gt; MUST be the owner or &lt;code&gt;approved&lt;&#x2F;code&gt; for &lt;code&gt;tokenId&lt;&#x2F;code&gt; and the other tokens included in &lt;code&gt;_data&lt;&#x2F;code&gt;.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;from&lt;&#x2F;code&gt; MUST not be a smart contract unless whitelisted.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;a Royalty Account MUST be associated to &lt;code&gt;tokenId&lt;&#x2F;code&gt; and the other tokens included in &lt;code&gt;_data&lt;&#x2F;code&gt;.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;_data&lt;&#x2F;code&gt; MUST NOT be NULL.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;msg.sender&lt;&#x2F;code&gt; MUST be equal to &lt;code&gt;from&lt;&#x2F;code&gt; or an &lt;code&gt;approved&lt;&#x2F;code&gt; address, or a whitelisted contract.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note, that in the context of this document only the scenario where the calling contract is still being created, i.e., the constructor being executed is a possible attack vector, and should to be carefully treated in the transfer scenario.&lt;&#x2F;p&gt;
&lt;p&gt;Turning to the &lt;code&gt;_data&lt;&#x2F;code&gt; object.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r48&quot;&gt;&lt;strong&gt;[R48]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; &lt;em&gt;The &lt;code&gt;_data&lt;&#x2F;code&gt; object MUST minimally contain the following payment parameters:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Seller Address as &lt;code&gt;address&lt;&#x2F;code&gt;.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;Buyer Address as &lt;code&gt;address&lt;&#x2F;code&gt;.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;Receiver Address as `address.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;Token identifiers as &lt;code&gt;uint256[]&lt;&#x2F;code&gt;.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;Token type used for payment.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;Payment amount paid to NFT contract as &lt;code&gt;uint256&lt;&#x2F;code&gt;.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;a registered payment identifier.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;blockchain ID, &lt;code&gt;block.chainid&lt;&#x2F;code&gt;, of the underlying blockchain.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;a name=&quot;r49&quot;&gt;&lt;strong&gt;[R49]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; &lt;em&gt;The following business rules MUST be met for the payment data in &#x27;_data&#x27;:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;seller == from&lt;&#x2F;code&gt;.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;tokenId[0] == tokenId&lt;&#x2F;code&gt;.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;Each token in &lt;code&gt;_tokenId&lt;&#x2F;code&gt; has an associated Royalty Account.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;chainid == block.chainid&lt;&#x2F;code&gt;.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;buyer&lt;&#x2F;code&gt; is equal to the buyer address in the registered payment for the given ``paymentId.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;receiver == to&lt;&#x2F;code&gt;.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;the receiver of the token is not the seller.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;the receiver of the token is not a contract or is a whitelisted contract&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;For all NFTs in the payment, &lt;code&gt;tokenId[i] = registeredPayment[paymentId].boughtTokens[i]&lt;&#x2F;code&gt;.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;tokenType&lt;&#x2F;code&gt; is supported in the contract.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;allowedToken[tokenType]&lt;&#x2F;code&gt; is not NULL.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;tokenType = registeredPayment[paymentId].tokenType&lt;&#x2F;code&gt;.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;payment &amp;gt; lastBalanceAllowedToken[allowedToken[listingId]]&lt;&#x2F;code&gt;.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;payment = registeredPayment[paymentId].payment&lt;&#x2F;code&gt;.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;distributing-royalties-in-the-transfer-function&quot;&gt;Distributing Royalties in the Transfer Function&lt;&#x2F;h3&gt;
&lt;p&gt;The approach to distributing royalties is to break down the hierarchical structure of interconnected Royalty Accounts into layers, and then process one layer at time, where each relationship between a NFT and its ancestor is utilized to traverse the Royalty Account chain until the root ancestor and its associated Royalty Account.&lt;&#x2F;p&gt;
&lt;p&gt;Note, that the distribution function assumes that the payment made is for ALL tokens in the requested transfer. That means, that &lt;code&gt;payment&lt;&#x2F;code&gt; for the distribution function is equally divided between all NFTs included in the payment.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r5&quot;&gt;&lt;strong&gt;[R50]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; *The &lt;code&gt;distributePayment&lt;&#x2F;code&gt; function interface MUST adhere to the definition below:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @dev Function to distribute a payment as royalties to a chain of Royalty Accounts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @param tokenId is a tokenId included in the sale and used to look up the associated Royalty Account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @param payment is the payment (portion) to be distributed as royalties&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function distributePayment (uint256 tokenId, uint265 payment) internal virtual returns (bool)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The Boolean return value is &lt;code&gt;true&lt;&#x2F;code&gt; for a successful function execution, and &lt;code&gt;false&lt;&#x2F;code&gt; for an unsuccessful function execution.&lt;&#x2F;p&gt;
&lt;p&gt;As mentioned before, the internal &lt;code&gt;distributePayment&lt;&#x2F;code&gt; function is called within the modified &lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;p&gt;Note, that it is necessary to multiply two &lt;code&gt;uint256&lt;&#x2F;code&gt; numbers with each other -- the payment amount with the royalty split percentage expressed as a whole number e.g. &lt;code&gt;10000 = 100%&lt;&#x2F;code&gt;. And then divide the result by the whole number representing &lt;code&gt;100%&lt;&#x2F;code&gt; in order to arrive at the correct application of the royalty split percentage to the payment amount. This requires careful treatment of numbers in the implementation to prevent issues such as buffer over or under runs.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r51&quot;&gt;&lt;strong&gt;[R51]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; &lt;em&gt;The processing logic of &lt;code&gt;distributePayment&lt;&#x2F;code&gt; function MUST be as follows:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Load the Royalty Account (&lt;code&gt;RA&lt;&#x2F;code&gt;) and associated Royalty Sub Accounts using the passed &lt;code&gt;tokenId&lt;&#x2F;code&gt;.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;For each Royalty Sub Account in &lt;code&gt;RA&lt;&#x2F;code&gt; apply the following rules:&lt;&#x2F;em&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;If a Royalty Sub Account in &lt;code&gt;RA&lt;&#x2F;code&gt; has &lt;code&gt;isIndividual&lt;&#x2F;code&gt; set to &lt;code&gt;true&lt;&#x2F;code&gt; then&lt;&#x2F;em&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;apply the royalty percentage of that Royalty Sub Account to &lt;code&gt;payment&lt;&#x2F;code&gt; and add the calculated amount, e.g. &lt;code&gt;royaltyAmountTemp&lt;&#x2F;code&gt;, to the &lt;code&gt;royaltybalance&lt;&#x2F;code&gt; of that Royalty Sub Account.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;emit an event as a notification of payment to the &lt;code&gt;accountId&lt;&#x2F;code&gt; of the Royalty Sub Account containing: assetId, accountId, tokenType, royaltybalance.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;in the RA add &lt;code&gt;royaltyamountTemp&lt;&#x2F;code&gt; amount to &lt;code&gt;balance&lt;&#x2F;code&gt;&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;If a Royalty Sub Account in &lt;code&gt;RA&lt;&#x2F;code&gt; has &lt;code&gt;isIndividual&lt;&#x2F;code&gt; set to &lt;code&gt;false&lt;&#x2F;code&gt; then&lt;&#x2F;em&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;apply the royalty percentage of that Royalty Sub Account to &lt;code&gt;payment&lt;&#x2F;code&gt; and store temporarily in a new variable e.g. &lt;code&gt;RApaymenttemp&lt;&#x2F;code&gt;, but do not update the &lt;code&gt;royaltybalance&lt;&#x2F;code&gt; of the Royalty Sub Account which remains &lt;code&gt;0&lt;&#x2F;code&gt;.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;then use &lt;code&gt;ancestor&lt;&#x2F;code&gt; to obtain the &lt;code&gt;RA&lt;&#x2F;code&gt; connected to &lt;code&gt;ancestor&lt;&#x2F;code&gt; e.g. via a look up through a Royalty Account mapping.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;load the new RA&lt;&#x2F;em&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;if &lt;code&gt;isIndividual&lt;&#x2F;code&gt; of the Royalty Sub Account is set to &lt;code&gt;true&lt;&#x2F;code&gt;, pass through the Royalty Sub Accounts of the next &lt;code&gt;RA&lt;&#x2F;code&gt;, and apply the rule for &lt;code&gt;isIndividual = true&lt;&#x2F;code&gt;.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;if &lt;code&gt;isIndividual&lt;&#x2F;code&gt; of the Royalty Sub Account is set to &lt;code&gt;false&lt;&#x2F;code&gt;, pass through the Royalty Sub Accounts of the next &lt;code&gt;RA&lt;&#x2F;code&gt;, and apply the rule for &lt;code&gt;isIndividual = false&lt;&#x2F;code&gt;.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;Repeat the procedures for &lt;code&gt;isIndividual&lt;&#x2F;code&gt; equal to &lt;code&gt;true&lt;&#x2F;code&gt; and &lt;code&gt;false&lt;&#x2F;code&gt; until a &lt;code&gt;RA&lt;&#x2F;code&gt; is reached that does not have an &lt;code&gt;ancestor&lt;&#x2F;code&gt;, and where all Royalty Sub Accounts have&lt;code&gt;isIndividual&lt;&#x2F;code&gt; set to &lt;code&gt;true&lt;&#x2F;code&gt;, and apply the rule for a Royalty Sub Account that has &lt;code&gt;isIndividual&lt;&#x2F;code&gt; set to &lt;code&gt;true&lt;&#x2F;code&gt; to all Royalty Sub Accounts in that &lt;code&gt;RA&lt;&#x2F;code&gt;.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;update-royalty-sub-account-ownership-with-payout-to-approved-address-from&quot;&gt;Update Royalty Sub Account Ownership with Payout to approved Address (&lt;code&gt;from&lt;&#x2F;code&gt;)&lt;&#x2F;h3&gt;
&lt;p&gt;In order to simplify the ownership transfer, first the approved address -- the non-contract NFT owner --, &lt;code&gt;from&lt;&#x2F;code&gt;, is paid out its share of the royalties. And then the Royalty Sub Account is updated with the new owner, &lt;code&gt;to&lt;&#x2F;code&gt;. This step repeats for each token to be transferred.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r52&quot;&gt;&lt;strong&gt;[R52]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; &lt;em&gt;The business rules are as follows:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;the internal version of the&lt;code&gt;royaltyPayOut&lt;&#x2F;code&gt; function MUST pay out the entire royalty balance of the Royalty Sub Account owned by the &lt;code&gt;from&lt;&#x2F;code&gt; address to the &lt;code&gt;from&lt;&#x2F;code&gt; address.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;the Royalty Sub Account MUST only be updated with the new owner only once the payout function has successfully completed and the &lt;code&gt;royaltybalance = 0&lt;&#x2F;code&gt;.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The last step in the process chain is transferring the NFTs in the purchase to the &lt;code&gt;to&lt;&#x2F;code&gt; address.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r53&quot;&gt;&lt;strong&gt;[R53]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; &lt;em&gt;For every NFT (in the batch) the &#x27;to&#x27; address MUST be `approved&#x27; (ERC-721 function) to complete the ownership transfer:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;_approve(to, tokenId[i]);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The technical NFT owner remains the NFT contract.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;removing-the-payment-entry-after-successful-transfer&quot;&gt;Removing the Payment Entry after successful Transfer&lt;&#x2F;h3&gt;
&lt;p&gt;Only after the real ownership of the NFT, the approved address, has been updated, the payment registry entry can be removed to allow the transferred NFTs to be sold again.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r54&quot;&gt;&lt;strong&gt;[R54]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; &lt;em&gt;After the &lt;code&gt;approve&lt;&#x2F;code&gt; relationship has been successfully updated to the &lt;code&gt;to&lt;&#x2F;code&gt; address, the registered payment MUST be removed.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;paying-out-royalties-to-the-from-address-in-safetransferfrom-function&quot;&gt;Paying out Royalties to the &lt;code&gt;from&lt;&#x2F;code&gt; Address in &lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt; Function&lt;&#x2F;h3&gt;
&lt;p&gt;There are two versions of the payout function -- a &lt;code&gt;public&lt;&#x2F;code&gt; and an &lt;code&gt;internal&lt;&#x2F;code&gt; function -- depending on whether there is a payout during a purchase, or a payout is requested by a Royalty Sub Account owner.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r55&quot;&gt;&lt;strong&gt;[R55]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; &lt;em&gt;The public &lt;code&gt;royaltyPayOut&lt;&#x2F;code&gt; function interface MUST adhere to the definition below:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @dev Function to payout a royalty payment&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @param tokenId is the identifier of the NFT token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @param RAsubaccount is the address of the Royalty Sub Account from which the payout should happen&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @param receiver is the address to receive the payout&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @param amount is the amount to be paid out&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function royaltyPayOut (uint256 tokenId, address RAsubaccount, address payable payoutAccount, uint256 amount) public virtual nonReentrant returns (bool)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The Boolean return value is &lt;code&gt;true&lt;&#x2F;code&gt; for a successful function execution, and &lt;code&gt;false&lt;&#x2F;code&gt; for an unsuccessful function execution.&lt;&#x2F;p&gt;
&lt;p&gt;Note, that the function has &lt;code&gt;reentrancy&lt;&#x2F;code&gt; protection through &lt;code&gt;nonReentrant&lt;&#x2F;code&gt; from the Open Zeppelin library since funds are being paid out.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;r56&quot;&gt;&lt;strong&gt;[R56]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; &lt;em&gt;The input parameters of the &lt;code&gt;royaltyPayOut&lt;&#x2F;code&gt; function MUST satisfy the following requirements:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;msg.sender == RAsubaccount&lt;&#x2F;code&gt;.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;tokenId&lt;&#x2F;code&gt; must exist and must not be burned.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;tokenId&lt;&#x2F;code&gt; must be associated with a Royalty Account.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;RAsubaccount&lt;&#x2F;code&gt; must be a valid &lt;code&gt;accountId&lt;&#x2F;code&gt; in a Royalty Sub Account of the Royalty Account of the `tokenId&#x27;.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;isIndividual == true&lt;&#x2F;code&gt; for the Royalty Sub Account, &lt;code&gt;RAsubaccount&lt;&#x2F;code&gt;.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;*&lt;code&gt;amount &amp;lt;= royaltybalance&lt;&#x2F;code&gt; of the Royalty Sub Account, &lt;code&gt;RAsubaccount.*&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;a name=&quot;r57&quot;&gt;&lt;strong&gt;[R57]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; &lt;em&gt;The internal &lt;code&gt;_royaltyPayOut&lt;&#x2F;code&gt; function interface MUST adhere to the definition below&lt;&#x2F;em&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function _royaltyPayOut (uint256 tokenId, address RAsubaccount, address payable payoutAccount, uint256 amount) public virtual returns (bool)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;a name=&quot;r58&quot;&gt;&lt;strong&gt;[R58]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; *The internal &lt;code&gt;_royaltyPayOut&lt;&#x2F;code&gt; function MUST perform the following actions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;send the payment to the &lt;code&gt;payoutaccount&lt;&#x2F;code&gt;.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;update the &lt;code&gt;royaltybalance&lt;&#x2F;code&gt; of the &lt;code&gt;RAsubaccount&lt;&#x2F;code&gt; of the Royalty Account upon successful transfer.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;a name=&quot;r59&quot;&gt;&lt;strong&gt;[R59]&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; &lt;em&gt;The following steps MUST be taken to send out a royalty payment to its recipient:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;find the Royalty Sub Account.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;extract &lt;code&gt;tokenType&lt;&#x2F;code&gt; from the Royalty Sub Account.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;based on the token type send to the &lt;code&gt;payoutAccount&lt;&#x2F;code&gt; either&lt;&#x2F;em&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;&#x27;ETH&#x27; &#x2F; relevant protocol token or&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;another token based on token type&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;and only if the payout transaction is successful, deduct &lt;code&gt;amount&lt;&#x2F;code&gt; from &lt;code&gt;royaltybalance&lt;&#x2F;code&gt; of the Royalty Sub Account,&lt;code&gt;RAsubaccount&lt;&#x2F;code&gt;, and then return &lt;code&gt;true&lt;&#x2F;code&gt; as the function return parameter, otherwise return &lt;code&gt;false&lt;&#x2F;code&gt;.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Royalties for NFTs is at its core a distribution licensing problem. A buyer obtains the right to an asset&#x2F;content which might or might not be reproducible, alterable etc. by the buyer or agents of the buyer. Therefore, a comprehensive specification must address a hierarchy of royalties, where one or more assets are derived from an original asset as described in the Motivation section in detail. Consequently, a design must solve for a multi-level inheritance, and thus, recursion problem.&lt;&#x2F;p&gt;
&lt;p&gt;In order to solve for the complicated inheritance problem, this proposal design breaks down the recursive problem of the hierarchy first into a tree of depth N. And the further breaks down the tree structure into N separate problems, one for each layer. This design allows one to traverse the tree from its lowest level upwards to its root most efficiently. This is achieved with the design for the &lt;code&gt;distributePayment&lt;&#x2F;code&gt; function and the NFT data structures allowing for the tree structure e.g. &lt;code&gt;ancestry&lt;&#x2F;code&gt;,&lt;code&gt;royaltyAccount&lt;&#x2F;code&gt;, &lt;code&gt;RAsubaccount&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;In order to avoid massive gas costs during the payout of royalties, possibly exceeding block gas limits for large royalty trees, the design needed to create a royalty accounting system to maintain royalty balances for recipients as done with the &lt;code&gt;royaltyAccount&lt;&#x2F;code&gt;, &#x27;RAsubaccount&#x27; data structures and the associated CRUD operations, as well as require that royalty payouts are done by individual and by request, only, as is achieved with the &lt;code&gt;royaltyPayout&lt;&#x2F;code&gt; function design.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore, the design had to ensure that in order to account for and payout royalties the smart contract must be in the &quot;know&quot; of all buying and selling of an NFT including the exchange of monies. This buying and selling can be either direct through the NFT contract or can be exchange-mediated as is most often the case today -- which is a centralizing factor! The chosen design for purchasing is accounting for those two modes.&lt;&#x2F;p&gt;
&lt;p&gt;Keeping the NFT contract in the &quot;know&quot; at the beginning of the purchase process requires that authorized user addresses can list NFTs for sale for direct sales , whereas for exchange-mediated purchases, a payment must be registered with the NFT contract before the purchase can be completed.&lt;&#x2F;p&gt;
&lt;p&gt;The design needed to avoid royalty circumvention during the purchase process, therefore, the NFT must be kept in the &quot;know&quot;, a buyer will always have to pay the NFT contract directly and not the seller for both purchasing modes. The seller is subsequently paid through the royalty distribution function in the NFT contract. As a consequence, and a key design choice, and to stay compliant with ERC-721, the NFT contract must be the owner of the NFT, and the actual owner is an &lt;code&gt;approved&lt;&#x2F;code&gt; address.&lt;&#x2F;p&gt;
&lt;p&gt;The specification design also needed to account for that the payment process depends on whether the payment is received in ETH or an ERC-20 token:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;ERC-20 Token
&lt;ol&gt;
&lt;li&gt;The Buyer must &lt;code&gt;approve&lt;&#x2F;code&gt; the NFT contract for the purchase price, &lt;code&gt;payment&lt;&#x2F;code&gt; for the selected payment token (ERC-20 contract address).&lt;&#x2F;li&gt;
&lt;li&gt;For an ERC-20 payment token, the Buyer must then call the &lt;code&gt;executePayment&lt;&#x2F;code&gt; in the NFT contract -- the ERC-20 is not directly involved.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;For a non-ERC-20 payment, the Buyer must send a protocol token (ETH) to the NFT contract, and is required to send encoded listing and payment information.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In addition, the &lt;code&gt;executePayment&lt;&#x2F;code&gt; function had to be designed to handle both direct sales (through the NFT contract) and exchange-mediated sales which required the introduction of an indicator whether the purchase is direct or exchange-mediated.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;executePayment&lt;&#x2F;code&gt; function also has to  handle the NFT transfer and purchase clean up -- removal  of a listing, or removal of a registered payment, distribution of royalties, payment to the seller, and finally transfer to the seller.&lt;&#x2F;p&gt;
&lt;p&gt;To stay compliant with the ERC-721 design but avoid royalty circumvention, all transfer functions must be disabled save the one that allows for additional information to be submitted with the function in order to manage the complicated purchase cleanup process -- &lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt;. To ensure safety, the design enforces that input parameters must satisfy several requirements for the NFT to be transferred AFTER the royalties have been properly distributed, not before. The design accounts for the fact that we need to treat transfer somewhat differently for direct sales versus exchange mediated sales.&lt;&#x2F;p&gt;
&lt;p&gt;Finally the specification needed to take into account that NFTs must be able to be &lt;code&gt;minted&lt;&#x2F;code&gt; and &lt;code&gt;burned&lt;&#x2F;code&gt; to maintain compliance with the ERC-721 specification while also having to set up all the data structures for the tree.&lt;&#x2F;p&gt;
&lt;p&gt;The design enforces that when an NFT is minted, a royalty account for that NFT must be created and associated with the NFT and the NFT owner, and, if there is an ancestor of the NFT with the ancestor&#x27;s royalty account to enforces the tree structure. To this end the specification utilizes the ERC-721 &lt;code&gt;_safemint&lt;&#x2F;code&gt; function in a newly defined &lt;code&gt;mint&lt;&#x2F;code&gt; function and applies various business rules on the input variables required to ensure proper set-up.&lt;&#x2F;p&gt;
&lt;p&gt;An NFT with a royalty account can be burned. However, several things have to be true to avoid locking funds not only for the royalty account of the NFT but also its descendants, if they exist. That means that all royalties for the NFT and its descendants, if they exists, must be paid out. Furthermore, if descendants exist, they must have been burned before an ancestor can be burned. If those rules are not enforced the cleanly, the hierarchical royalty structure in part of the tree can break down and lead to lost funds, not paid out royalties etc.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is backwards compatible to the ERC-721 standard introducing new interfaces and functionality but retaining the core interfaces and functionality of the ERC-721 standard.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;A full test suite is part of the reference implementation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The Treetrunk reference implementation of the standard can be found in the public treetrunkio Github repo under treetrunk-nft-reference-implementation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Given that this EIP introduces royalty collection, distribution, and payouts to the ERC-721 standard, the number of attack vectors increases. The most important attack vector categories and their mitigation are discussed below:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Payments and Payouts&lt;&#x2F;strong&gt;:
&lt;ul&gt;
&lt;li&gt;Reentrancy attacks are mitigated through a reentrancy protection on all payment functions. See for example the Open Zeppelin reference implementation .&lt;&#x2F;li&gt;
&lt;li&gt;Payouts from unauthorized accounts. Mitigation: Royalty Sub Accounts require at least that &lt;code&gt;msg.sender&lt;&#x2F;code&gt; is the Royalty Sub Account owner.&lt;&#x2F;li&gt;
&lt;li&gt;Payments could get stuck in the NFT contract if the &lt;code&gt;executePayment&lt;&#x2F;code&gt; function fails. Mitigation: For exchange-mediated sales, a buyer can always reverse a payment with &lt;code&gt;reversePayment&lt;&#x2F;code&gt; if the &lt;code&gt;executePayment&lt;&#x2F;code&gt; function fails. For direct sales, &lt;code&gt;reversePayment&lt;&#x2F;code&gt; will be directly triggered in the &lt;code&gt;executePayment&lt;&#x2F;code&gt; function.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Circumventing Royalties&lt;&#x2F;strong&gt;:
&lt;ul&gt;
&lt;li&gt;Offchain Key exchanges
&lt;ul&gt;
&lt;li&gt;Exchanging a private key for money off chain can not be prevented in any scenario.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Smart Contract Wallets as NFT owners
&lt;ul&gt;
&lt;li&gt;A Smart Contract Wallet controlled by multiple addresses could own an NFT and the owners could transfer the asset within the wallet with an off chain money exchange. Mitigation: Prohibit that Smart Contracts can own an NFT unless explicitly allowed to accommodate special scenarios such as collections.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Denial of Royalty Disbursement
&lt;ul&gt;
&lt;li&gt;An attacker who has purchased one or more NFTs in a given generation of an NFT family can cause out of gas errors or run time errors for the contract, if they add many spurious royalty sub-accounts with very low royalty split percentages, and then mint more prints of those purchased NFTs, and then repeat that step until the set &lt;code&gt;maxGeneration&lt;&#x2F;code&gt; limit is reached. An NFT trade at the bottom of the hierarchy will then require a lot of code cycles because of the recursive nature of the royalty distribution function. Mitigation: Limit the number of royalty sub-accounts per NFT and impose a royalty split percentage limit.&lt;&#x2F;li&gt;
&lt;li&gt;Following the same approach as above but now targeting the &lt;code&gt;addListNFT&lt;&#x2F;code&gt; function, an attacker can force an out of gas error or run time errors in the &lt;code&gt;executePayment&lt;&#x2F;code&gt; function by listing many NFTs at a low price, and then performing a purchase from another account. Mitigation: Limit the number of NFTs that can be included in one listing.&lt;&#x2F;li&gt;
&lt;li&gt;The creator of the NFT family could set the number of generations too high such that the royalty distribution function could incur and out of gas or run time error because of the recursive nature of the function. Mitigation: Limiting the &lt;code&gt;maxNumberGeneration&lt;&#x2F;code&gt; by the creator.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;General Considerations: The creator of an NFT family must carefully consider the business model for the NFT family and then set the parameters such as maximum number of generations, royalty sub-accounts, number of prints per print, number of NFTs in a listing, and the maximum and minimum royalty split percentage allowed.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Phishing Attacks&lt;&#x2F;strong&gt;
&lt;ul&gt;
&lt;li&gt;NFT phishing attacks often target the &lt;code&gt;approve&lt;&#x2F;code&gt; and &lt;code&gt;setApprovalForAll&lt;&#x2F;code&gt; functions by tricking owners of NFTs to sign transactions adding the attacker account as approved for one or all NFTs of the victim. Mitigation: This contract is not vulnerable to these type of phishing attacks because all NFT transfers are sales, and the NFT contract itself is the owner of all NFTs. This means that transfers after a purchase are achieved by setting the new owner in the &lt;code&gt;_approve&lt;&#x2F;code&gt; function. Calling the public &lt;code&gt;approve&lt;&#x2F;code&gt; function will cause the function call to error out because &lt;code&gt;msg.sender&lt;&#x2F;code&gt; of the malicious transaction cannot be the NFT owner.&lt;&#x2F;li&gt;
&lt;li&gt;NFT phishing attack targeting the &lt;code&gt;addListNFT&lt;&#x2F;code&gt; function to trick victim to list one or more NFTs at a very low price and the attacker immediately registering a payment, and executing that payment right away. Mitigation: Implement a waiting period for a purchase can be affected giving the victim time to call the &lt;code&gt;removeListNFT&lt;&#x2F;code&gt; function. In addition, an implementer could require Two-Factor-Authentication either built into the contract or by utilizing an authenticator app such as Google Authenticator built into a wallet software.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Besides the usage of professional security analysis tools, it is also recommended that each implementation performs a security audit of its implementation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>MULDIV instruction</title>
        <published>2022-03-14T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Harikrishnan Mulackal</name><uri>https://github.com/hrkrshnn</uri>
	</author>
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	<author>
		<name>Paweł Bylica</name><uri>https://github.com/chfast</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5000/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/muldiv-instruction/9930" />
        

        <id>https://wg-eips.ritovision.com/5000/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:5000"
            label="EIP-5000" />
        

        
        

        
        <summary type="html">Introduce a new instruction to perform x * y &#x2F; z in 512-bit precision</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5000/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce a new instruction, &lt;code&gt;MULDIV(x, y, z)&lt;&#x2F;code&gt;, to perform &lt;code&gt;((x * y) &#x2F; z) % 2**256&lt;&#x2F;code&gt; in 512-bit precision. &lt;code&gt;z = 0&lt;&#x2F;code&gt; is a special case for &lt;code&gt;(x * y) &#x2F; 2**256&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Fixed point operations in high level languages are very commonly used on Ethereum, especially in the domain of financial applications.&lt;&#x2F;p&gt;
&lt;p&gt;While fixed point addition and subtraction can be done with merely &lt;code&gt;add&lt;&#x2F;code&gt; and &lt;code&gt;sub&lt;&#x2F;code&gt; respectively, being able to efficiently do fixedpoint multiplication and division is a very sought after feature. A commonly used workaround relies on a &lt;code&gt;mulmod&lt;&#x2F;code&gt;-based, rather complex implementation (taking around 50 instructions, excluding stack manipulation). This instruction reduces that to a single opcode.&lt;&#x2F;p&gt;
&lt;p&gt;A secondary use case is likely in cryptographic applications, where the &lt;code&gt;muldiv&lt;&#x2F;code&gt; instruction allows full precision 256x256-&amp;gt;512 multiplication. &lt;code&gt;mul(x y)&lt;&#x2F;code&gt; (or &lt;code&gt;muldiv(x, y, 1)&lt;&#x2F;code&gt;) computes the lower order 256 bits and &lt;code&gt;muldiv(x, y, 0)&lt;&#x2F;code&gt; computes the higher order 256 bits.&lt;&#x2F;p&gt;
&lt;p&gt;Finally we aimed to provide an instruction which can be efficiently used both in &lt;em&gt;checked&lt;&#x2F;em&gt; and &lt;em&gt;unchecked arithmetic&lt;&#x2F;em&gt; use cases. By &lt;em&gt;checked&lt;&#x2F;em&gt; we mean to abort on conditions including division-by-zero and wrapping behaviour.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;A new instruction is introduced: &lt;code&gt;MULDIV&lt;&#x2F;code&gt; (&lt;code&gt;0x1e&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Pops 3 values from the stack, first &lt;code&gt;x&lt;&#x2F;code&gt;, then &lt;code&gt;y&lt;&#x2F;code&gt; and &lt;code&gt;z&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;z == 0&lt;&#x2F;code&gt;, &lt;code&gt;r = (uint512(x) * y) &#x2F; 2**256&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Otherwise &lt;code&gt;r = (uint512(x) * y &#x2F; z) % 2**256&lt;&#x2F;code&gt;, where the intermediate calculation is performed with 512-bit precision.&lt;&#x2F;li&gt;
&lt;li&gt;Pushes &lt;code&gt;r&lt;&#x2F;code&gt; on the stack.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; operations `*` and `&#x2F;&#x2F;` are done in 512 bit precision&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; muldiv&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;x&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; y&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; z&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; z&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; y&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; y&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; z&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The cost of the instruction is 8 gas (aka &lt;code&gt;mid&lt;&#x2F;code&gt;), the same as for &lt;code&gt;addmod&lt;&#x2F;code&gt; and &lt;code&gt;mulmod&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;the-special-0-case&quot;&gt;The special 0 case&lt;&#x2F;h3&gt;
&lt;p&gt;All the arithmetic instructions in EVM handle division or modulo 0 specially: the instructions return 0. We have decided to break consistency in order to provide a flexible opcode, which can be used to detect wrapping behaviour.&lt;&#x2F;p&gt;
&lt;p&gt;Alternate options include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Returning a flag for wrapping&lt;&#x2F;li&gt;
&lt;li&gt;Returning two stack items, higher and lower order bits&lt;&#x2F;li&gt;
&lt;li&gt;Compute the higher order 256 bits in EVM:&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns `hi` such that `x × y = hi × 2**256 + mul(x, y)`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; hob&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; x&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; y&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; hi&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint&lt;&#x2F;span&gt;&lt;span&gt; uint_max &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        let&lt;&#x2F;span&gt;&lt;span&gt; lo &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mul&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;x&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; y&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        let&lt;&#x2F;span&gt;&lt;span&gt; mm &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; mulmod&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;x&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; y&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; uint_max&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        hi &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; sub&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;sub&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;mm&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; lo&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; lt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;mm&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; lo&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;While this feature is clever and useful, callers must be aware that unlike other EVM instructions, passing 0 will have a vastly different behaviour.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;argument-ordering&quot;&gt;Argument ordering&lt;&#x2F;h3&gt;
&lt;p&gt;The order of arguments matches &lt;code&gt;addmod&lt;&#x2F;code&gt; and &lt;code&gt;mulmod&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This is a new instruction not present prior.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;MULDIV&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;MULDIV&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x0000000000000000000000000000000000000000000000000de0b6b3a7640000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x000000000000000000000000000000000000000000000000016345785d8a0000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x00000000000000000000000000000000000000000000d3c21bcecceda1000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;MULDIV&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x00000000000000000000000000000000000000000000152d02c7e14af6800000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;TBA&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>PAY opcode</title>
        <published>2022-03-14T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Gavin John</name><uri>https://github.com/Pandapip1</uri>
	</author>
	
	<author>
		<name>Zainan Victor Zhou</name><uri>https://github.com/xinbenlv</uri>
	</author>
	
	<author>
		<name>Sam Wilson</name><uri>https://github.com/SamWilsn</uri>
	</author>
	
	<author>
		<name>Jochem Brouwer</name><uri>https://github.com/jochem-brouwer</uri>
	</author>
	
	<author>
		<name>Charles Cooper</name><uri>https://github.com/charles-cooper</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5920/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5920-pay-opcode/11717" />
        

        <id>https://wg-eips.ritovision.com/5920/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:5920"
            label="EIP-5920" />
        

        
        

        
        <summary type="html">Introduces a new opcode, PAY, to send ether to an address without calling any of its functions</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5920/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a new opcode, &lt;code&gt;PAY&lt;&#x2F;code&gt;, taking two stack parameters, &lt;code&gt;addr&lt;&#x2F;code&gt; and &lt;code&gt;val&lt;&#x2F;code&gt;, that transfers &lt;code&gt;val&lt;&#x2F;code&gt; wei to the address &lt;code&gt;addr&lt;&#x2F;code&gt; without calling any of its functions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, to send ether to an address requires you to call into that address, which transfers execution context to that address, which creates several issues:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;First of all, it opens a reentrancy attack vector, as the recipient can call back into the sender. More generally, the recipient can unilaterally execute arbitrary state changes, limited only by the gas forwarded, which is not desirable from the point of view of the sender.
&lt;ul&gt;
&lt;li&gt;In practice, when calling into another account and sending ether, 2300 gas (the &quot;gas stipend&quot;) is always available &quot;for free&quot; in the newly created call frame. Although it is currently not possible to make storage state changes with the 2300 gas stipend (see the last minute rejection of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1283&#x2F;&quot;&gt;EIP-1283&lt;&#x2F;a&gt; from Constantinople to be replaced with the &quot;gas stipend safe&quot; &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2200&#x2F;&quot;&gt;EIP-2200&lt;&#x2F;a&gt; version in Istanbul), it is possible to do this with transient storage (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1153&#x2F;&quot;&gt;EIP-1153&lt;&#x2F;a&gt;). This is a security risk where potentially the transient storage gets changed unintentionally. The goal is to send ether, and not have to consider these potential unintuitive security problems.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Secondly, it opens a DoS vector. Contracts wanting to send ether must be cognizant of the possibility that the recipient will run out of gas or revert.&lt;&#x2F;li&gt;
&lt;li&gt;Future potential call-like opcodes may not provide a way to restrict the amount of gas being forwarded to the recipient, so the meager mitigation against unintended side effects in use today (gas limit) is not guaranteed to be available.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;CALL&lt;&#x2F;code&gt; and &lt;code&gt;EXTCALL&lt;&#x2F;code&gt; opcodes will execute code on the recipient, which is unintended when wanting to send ether and which could lead to unintentional operations. The code execution also has to be paid for in gas, even when the intention is to only send ether, which is thus an unnecessary waste of gas.&lt;&#x2F;li&gt;
&lt;li&gt;Finally, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; allows to delegate externally owned accounts (EOAs) to other accounts, which breaks the invariant that EOAs cannot contain code. Therefore, calling such EOA with the intention to send ether will thus also execute code and cost unnecessary gas.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Having a dedicated opcode for ether transfers solves all of these issues, and would be a useful addition to the EVM.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Definition&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;WARM_STORAGE_READ_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;COLD_ACCOUNT_ACCESS_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;GAS_NEW_ACCOUNT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;execution-specs&#x2F;blob&#x2F;4d953035fb0cceda7cf21d71b2ab7a9a6f4632f0&#x2F;src&#x2F;ethereum&#x2F;frontier&#x2F;vm&#x2F;gas.py#L52&quot;&gt;EELS&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;GAS_CALL_VALUE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;execution-specs&#x2F;blob&#x2F;4d953035fb0cceda7cf21d71b2ab7a9a6f4632f0&#x2F;src&#x2F;ethereum&#x2F;frontier&#x2F;vm&#x2F;gas.py#L53&quot;&gt;EELS&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;behavior&quot;&gt;Behavior&lt;&#x2F;h3&gt;
&lt;p&gt;A new opcode is introduced: &lt;code&gt;PAY&lt;&#x2F;code&gt; (&lt;code&gt;0xfc&lt;&#x2F;code&gt;), which:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Halt with exceptional failure if the current frame is static, as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;214&#x2F;&quot;&gt;EIP-214&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Pops two values from the stack: &lt;code&gt;addr&lt;&#x2F;code&gt; then &lt;code&gt;val&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Exceptionally halts if &lt;code&gt;addr&lt;&#x2F;code&gt; has any of the high 12 bytes set to a non-zero value (i.e. it does not contain a 20-byte address).&lt;&#x2F;li&gt;
&lt;li&gt;Charges the gas cost detailed below.&lt;&#x2F;li&gt;
&lt;li&gt;Marks &lt;code&gt;addr&lt;&#x2F;code&gt; as warm (adding &lt;code&gt;addr&lt;&#x2F;code&gt; to &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;Transfers &lt;code&gt;val&lt;&#x2F;code&gt; wei from the current address to the address &lt;code&gt;addr&lt;&#x2F;code&gt;, only if the current address has a balance greater than or equal to &lt;code&gt;val&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Push &lt;code&gt;1&lt;&#x2F;code&gt; on the stack if the &lt;code&gt;PAY&lt;&#x2F;code&gt; operation was successful, or &lt;code&gt;0&lt;&#x2F;code&gt; if it failed.
&lt;ul&gt;
&lt;li&gt;Currently only insufficient balance would produce a &lt;code&gt;0&lt;&#x2F;code&gt; return value.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;gas-cost&quot;&gt;Gas Cost&lt;&#x2F;h3&gt;
&lt;p&gt;The gas cost for &lt;code&gt;PAY&lt;&#x2F;code&gt; is the sum of the following:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Is &lt;code&gt;addr&lt;&#x2F;code&gt; in &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt;?
&lt;ul&gt;
&lt;li&gt;If yes, &lt;code&gt;WARM_STORAGE_READ_COST&lt;&#x2F;code&gt;;&lt;&#x2F;li&gt;
&lt;li&gt;Otherwise, &lt;code&gt;COLD_ACCOUNT_ACCESS_COST&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Does &lt;code&gt;addr&lt;&#x2F;code&gt; exist or is &lt;code&gt;val&lt;&#x2F;code&gt; zero?
&lt;ul&gt;
&lt;li&gt;If yes to either, zero;&lt;&#x2F;li&gt;
&lt;li&gt;Otherwise, &lt;code&gt;GAS_NEW_ACCOUNT&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Is &lt;code&gt;val&lt;&#x2F;code&gt; zero?
&lt;ul&gt;
&lt;li&gt;If yes, zero;&lt;&#x2F;li&gt;
&lt;li&gt;Otherwise, &lt;code&gt;GAS_CALL_VALUE&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;code&gt;PAY&lt;&#x2F;code&gt; cannot be implemented on networks with empty accounts (see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7523&#x2F;&quot;&gt;EIP-7523&lt;&#x2F;a&gt;).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;argument-order&quot;&gt;Argument order&lt;&#x2F;h3&gt;
&lt;p&gt;The order of arguments mimics that of &lt;code&gt;CALL&lt;&#x2F;code&gt;, which pops &lt;code&gt;addr&lt;&#x2F;code&gt; before &lt;code&gt;val&lt;&#x2F;code&gt;. Beyond consistency, though, this ordering aids validators pattern-matching MEV opportunities, so &lt;code&gt;PAY&lt;&#x2F;code&gt; always appears immediately after &lt;code&gt;COINBASE&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;halting-for-invalid-address&quot;&gt;Halting for invalid address&lt;&#x2F;h3&gt;
&lt;p&gt;The halting behavior is designed to allow for Address Space Extension.
If the high bytes were truncated, as in &lt;code&gt;CALL&lt;&#x2F;code&gt;, contracts could depend on the truncating behavior.
If the address space were extended beyond 20 bytes, &lt;code&gt;PAY&lt;&#x2F;code&gt; would either not be able to target those accounts, or code expecting truncation could send ether to the wrong address.&lt;&#x2F;p&gt;
&lt;p&gt;Because this behavior may be changed, contracts should not rely on this halting behavior and use methods designated to intentionally halt (such as the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;141&#x2F;&quot;&gt;&lt;code&gt;INVALID&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; opcode).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change requires a hard fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Existing contracts should not rely on their balance being under their control, since it is already possible to send ether to an address without calling it, by using the &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; opcode (somewhat restricted in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6780&#x2F;&quot;&gt;EIP-6780&lt;&#x2F;a&gt;).
It is also possible to involuntarily fund an account with priority fees sent to a &lt;code&gt;block.coinbase&lt;&#x2F;code&gt;.
However, this opcode does make this process cheaper and easier. It thus does not break an invariant.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EIP-721 Metadata Update Extension</title>
        <published>2022-03-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Anders</name><uri>https://github.com/0xanders</uri>
	</author>
	
	<author>
		<name>Lance</name><uri>https://github.com/LanceSnow</uri>
	</author>
	
	<author>
		<name>Shrug</name><email>shrug@emojidao.org</email>
	</author>
	
	<author>
		<name>Nathan</name><email>nathan.gang@gemini.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4906/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip4906-erc-721-erc-1155-metadata-update-extension/8588" />
        

        <id>https://wg-eips.ritovision.com/4906/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:4906"
            label="ERC-4906" />
        

        
        

        
        <summary type="html">Add a MetadataUpdate event to EIP-721.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4906/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is an extension of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt;. It adds a &lt;code&gt;MetadataUpdate&lt;&#x2F;code&gt; event to EIP-721 tokens.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Many &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; contracts emit an event when one of its tokens&#x27; metadata are changed. While tracking changes based on these different events is possible, it is an extra effort for third-party platforms, such as an NFT marketplace, to build individualized solutions for each NFT collection.&lt;&#x2F;p&gt;
&lt;p&gt;Having a standard &lt;code&gt;MetadataUpdate&lt;&#x2F;code&gt; event will make it easy for third-party platforms to timely update the metadata of many NFTs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;strong&gt;metadata update extension&lt;&#x2F;strong&gt; is OPTIONAL for EIP-721 contracts.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; EIP-721 Metadata Update Extension&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC4906&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC165&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC721&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This event emits when the metadata of a token is &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; So that the third-party platforms such as NFT market could&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; timely update the images and related attributes of the NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MetadataUpdate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This event emits when the metadata of a range of tokens is &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; So that the third-party platforms such as NFT market could&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; timely update the images and related attributes of the NFTs.    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BatchMetadataUpdate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _fromTokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _toTokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;MetadataUpdate&lt;&#x2F;code&gt; or &lt;code&gt;BatchMetadataUpdate&lt;&#x2F;code&gt; event MUST be emitted when the JSON metadata of a token, or a consecutive range of tokens, is changed.&lt;&#x2F;p&gt;
&lt;p&gt;Not emitting &lt;code&gt;MetadataUpdate&lt;&#x2F;code&gt; event is RECOMMENDED when a token is minted.&lt;&#x2F;p&gt;
&lt;p&gt;Not emitting &lt;code&gt;MetadataUpdate&lt;&#x2F;code&gt; event is RECOMMENDED  when a token is burned.&lt;&#x2F;p&gt;
&lt;p&gt;Not emitting &lt;code&gt;MetadataUpdate&lt;&#x2F;code&gt; event is RECOMMENDED  when the tokenURI changes but the JSON metadata does not.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; method MUST return &lt;code&gt;true&lt;&#x2F;code&gt; when called with &lt;code&gt;0x49064906&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Different NFTs have different metadata, and metadata generally has multiple fields. &lt;code&gt;bytes data&lt;&#x2F;code&gt; could be used to represents the modified value of metadata.  It is difficult for third-party platforms to identify various types of &lt;code&gt;bytes data&lt;&#x2F;code&gt;, so as to avoid unnecessary complexity, arbitrary metadata is not included in the &lt;code&gt;MetadataUpdate&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;p&gt;After capturing the &lt;code&gt;MetadataUpdate&lt;&#x2F;code&gt; event, a third party can update the metadata with information returned from the &lt;code&gt;tokenURI(uint256 _tokenId)&lt;&#x2F;code&gt; of EIP-721. When a range of token ids is specified, the third party can query each token URI individually.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backwards compatibility issues were found&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC721&#x2F;ERC721.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERC4906.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC4906&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC4906&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; symbol_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;name_, symbol_) &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See {IERC165-supportsInterface}.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC165&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes4&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x49064906&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;If there is an off-chain modification of metadata, a method that triggers &lt;code&gt;MetadataUpdate&lt;&#x2F;code&gt; can be added, but ensure that the function&#x27;s permission controls are correct.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Rental NFT, an Extension of EIP-721</title>
        <published>2022-03-11T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Anders</name><uri>https://github.com/0xanders</uri>
	</author>
	
	<author>
		<name>Lance</name><uri>https://github.com/LanceSnow</uri>
	</author>
	
	<author>
		<name>Shrug</name><email>shrug@emojidao.org</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4907/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/idea-erc-721-user-and-expires-extension/8572" />
        

        <id>https://wg-eips.ritovision.com/4907/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:4907"
            label="ERC-4907" />
        

        
        

        
        <summary type="html">Add a time-limited role with restricted permissions to EIP-721 tokens.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4907/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is an extension of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt;. It proposes an additional role (&lt;code&gt;user&lt;&#x2F;code&gt;) which can be granted to addresses, and a time where the role is automatically revoked (&lt;code&gt;expires&lt;&#x2F;code&gt;). The &lt;code&gt;user&lt;&#x2F;code&gt; role represents permission to &quot;use&quot; the NFT, but not the ability to transfer it or set users.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Some NFTs have certain utilities. For example, virtual land can be &quot;used&quot; to build scenes, and NFTs representing game assets can be &quot;used&quot; in-game. In some cases, the owner and user may not always be the same. There may be an owner of the NFT that rents it out to a “user”. The actions that a “user” should be able to take with an NFT would be different from the “owner” (for instance, “users” usually shouldn’t be able to sell ownership of the NFT).  In these situations, it makes sense to have separate roles that identify whether an address represents an “owner” or a “user” and manage permissions to perform actions accordingly.&lt;&#x2F;p&gt;
&lt;p&gt;Some projects already use this design scheme under different names such as “operator” or “controller” but as it becomes more and more prevalent, we need a unified standard to facilitate collaboration amongst all applications.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore, applications of this model (such as renting) often demand that user addresses have only temporary access to using the NFT. Normally, this means the owner needs to submit two on-chain transactions, one to list a new address as the new user role at the start of the duration and one to reclaim the user role at the end. This is inefficient in both labor and gas and so an “expires” function is introduced that would facilitate the automatic end of a usage term without the need of a second transaction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot; and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;contract-interface&quot;&gt;Contract Interface&lt;&#x2F;h3&gt;
&lt;p&gt;Solidity Interface with NatSpec &amp;amp; OpenZeppelin v4 Interfaces (also available at &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4907&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;IERC4907.sol&quot;&gt;&lt;code&gt;IERC4907.sol&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC4907&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Logged when the user of an NFT is &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; or expires is &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when the `user` of an NFT or the `expires` of the `user` is &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The zero address for user indicates that there is no user address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UpdateUser&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expires&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; set the user and expires of an NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The zero address indicates there is no user&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws if `tokenId` is not valid NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; user&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  The new user of the NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; expires&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  UNIX timestamp, The new user could use the NFT before expires&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setUser&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expires&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the user address of an NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The zero address indicates that there is no user or the user is expired&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT to get the user address for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; user address for this NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; userOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the user expires of an NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The zero value indicates that there is no user&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT to get the user expires for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; user expires for this NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; userExpires&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;userOf(uint256 tokenId)&lt;&#x2F;code&gt; function MAY be implemented as &lt;code&gt;pure&lt;&#x2F;code&gt; or &lt;code&gt;view&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;userExpires(uint256 tokenId)&lt;&#x2F;code&gt; function MAY be implemented as &lt;code&gt;pure&lt;&#x2F;code&gt; or &lt;code&gt;view&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;setUser(uint256 tokenId, address user, uint64 expires)&lt;&#x2F;code&gt; function MAY be implemented as &lt;code&gt;public&lt;&#x2F;code&gt; or &lt;code&gt;external&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;UpdateUser&lt;&#x2F;code&gt; event MUST be emitted when a user address is changed or the user expires is changed.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; method MUST return &lt;code&gt;true&lt;&#x2F;code&gt; when called with &lt;code&gt;0xad092b5c&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This model is intended to facilitate easy implementation. Here are some of the problems that are solved by this standard:&lt;&#x2F;p&gt;
&lt;h3 id=&quot;clear-rights-assignment&quot;&gt;Clear Rights Assignment&lt;&#x2F;h3&gt;
&lt;p&gt;With Dual “owner” and “user” roles, it becomes significantly easier to manage what lenders and borrowers can and cannot do with the NFT (in other words, their rights). Additionally, owners can control who the user is and it’s easy for other projects to assign their own rights to either the owners or the users.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;simple-on-chain-time-management&quot;&gt;Simple On-chain Time Management&lt;&#x2F;h3&gt;
&lt;p&gt;Once a rental period is over, the user role needs to be reset and the “user” has to lose access to the right to use the NFT. This is usually accomplished with a second on-chain transaction but that is gas inefficient and can lead to complications because it’s imprecise. With the &lt;code&gt;expires&lt;&#x2F;code&gt; function, there is no need for another transaction because the “user” is invalidated automatically after the duration is over.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;easy-third-party-integration&quot;&gt;Easy Third-Party Integration&lt;&#x2F;h3&gt;
&lt;p&gt;In the spirit of permission less interoperability, this standard makes it easier for third-party protocols to manage NFT usage rights without permission from the NFT issuer or the NFT application. Once a project has adopted the additional &lt;code&gt;user&lt;&#x2F;code&gt; role and &lt;code&gt;expires&lt;&#x2F;code&gt;, any other project can directly interact with these features and implement their own type of transaction. For example, a PFP NFT using this standard can be integrated into both a rental platform where users can rent the NFT for 30 days AND, at the same time, a mortgage platform where users can use the NFT while eventually buying ownership of the NFT with installment payments. This would all be done without needing the permission of the original PFP project.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;As mentioned in the specifications section, this standard can be fully EIP-721 compatible by adding an extension function set.&lt;&#x2F;p&gt;
&lt;p&gt;In addition, new functions introduced in this standard have many similarities with the existing functions in EIP-721. This allows developers to easily adopt the standard quickly.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;test-contract&quot;&gt;Test Contract&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;ERC4907Demo&lt;&#x2F;code&gt; Implementation: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4907&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;ERC4907Demo.sol&quot;&gt;&lt;code&gt;ERC4907Demo.sol&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;ERC4907.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC4907Demo&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC4907&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; symbol&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;     ERC4907&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;name,symbol)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     {&lt;&#x2F;span&gt;&lt;span&gt;         &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;test-code&quot;&gt;Test Code&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4907&#x2F;.&#x2F;assets&#x2F;test&#x2F;test.js&quot;&gt;test.js&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; assert&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;chai&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; ERC4907Demo&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; artifacts&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ERC4907Demo&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;test&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; async&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; accounts&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    it&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;should set user to Bob&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; async&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get initial balances of first and second account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; Alice&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; accounts&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; Bob&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; accounts&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; instance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ERC4907Demo&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;deployed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;T&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;T&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; demo&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; instance&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; demo&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Alice&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; expires&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Math&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;floor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Date&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getTime&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1000&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; demo&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;setUser&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Bob&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BigInt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;expires&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; user_1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; demo&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;userOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;            user_1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;            Bob&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;User of NFT 1 should be Bob&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner_1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; demo&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;            owner_1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;            Alice&lt;&#x2F;span&gt;&lt;span&gt; ,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Owner of NFT 1 should be Alice&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;run in Terminal：&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;truffle test .&#x2F;test&#x2F;test.js&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Implementation: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4907&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;ERC4907.sol&quot;&gt;&lt;code&gt;ERC4907.sol&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC721&#x2F;ERC721.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERC4907.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC4907&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC4907&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UserInfo&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; user&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address of user role&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint64&lt;&#x2F;span&gt;&lt;span&gt; expires&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; unix timestamp, user expires&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;  =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; UserInfo&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; _users&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; symbol_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;     ERC721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;name_, symbol_)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; set the user and expires of an NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The zero address indicates there is no user&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws if `tokenId` is not valid NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; user&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  The new user of the NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; expires&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  UNIX timestamp, The new user could use the NFT before expires&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setUser&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expires&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_isApprovedOrOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC4907: transfer caller is not owner nor approved&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        UserInfo &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;storage&lt;&#x2F;span&gt;&lt;span&gt; info &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;  _users&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        info&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;user &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; user&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        info&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;expires &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; expires&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UpdateUser&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; expires&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the user address of an NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The zero address indicates that there is no user or the user is expired&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT to get the user address for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; user address for this NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; userOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_users&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;expires&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;  block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt;  _users&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;user&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        else&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the user expires of an NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The zero value indicates that there is no user&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT to get the user expires for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; user expires for this NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; userExpires&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _users&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;expires&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See {IERC165-supportsInterface}.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;IERC4907&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _beforeTokenTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_beforeTokenTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;from &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span&gt; to &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; _users&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;user &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            delete&lt;&#x2F;span&gt;&lt;span&gt; _users&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UpdateUser&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP standard can completely protect the rights of the owner, the owner can change the NFT user and expires at any time.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>ERC-721 Entitlement Extension</title>
        <published>2022-03-11T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Gavin John</name><uri>https://github.com/Pandapip1</uri>
	</author>
	
	<author>
		<name>Tim Daubenschütz</name><uri>https://github.com/TimDaub</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5380/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/pr-5380-eip-4907-alternative-design/10190" />
        

        <id>https://wg-eips.ritovision.com/5380/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:5380"
            label="ERC-5380" />
        

        
        

        
        <summary type="html">Allows token owners to grant the ability for others to use specific properties of those tokens</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5380/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes a new interface that allows &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; token owners to grant limited usage of those tokens to other addresses.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;There are many scenarios in which it makes sense for the owner of a token to grant certain properties to another address. One use case is renting tokens. If the token in question represents a trading card in an on-chain TCG (trading card game), one might want to be able to use that card in the game without having to actually buy it. Therefore, the owner might grant the renter the &quot;property&quot; of it being able to be played in the TCG. However, this property should only be able to be assigned to one person at a time, otherwise a contract could simply &quot;rent&quot; the card to everybody. If the token represents usage rights instead, the property of being allowed to use the associated media does not need such a restriction, and there is no reason that the property should be as scarce as the token.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot; and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;base&quot;&gt;Base&lt;&#x2F;h3&gt;
&lt;p&gt;Compliant entitlement contracts MUST implement the following Solidity interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC5380Entitlement&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC165&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when the amount of entitlement a user has changes. If user is the zero address, then the user is the owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EntitlementChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;             Set the user associated with the given ERC-721 token as long as the owner is msg.sender.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                SHOULD NOT revert if the owner is not msg.sender.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  user&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;        The user to grant the entitlement to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    The property to grant&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     The tokenId to grant the properties of&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; entitle&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;             Get the maximum number of users that can receive this entitlement&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    The contract to query&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     The tokenId to query&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; maxEntitlements&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;             Get the user associated with the given contract and tokenId.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                Defaults to maxEntitlements(contract, tokenId) assigned to contract.ownerOf(tokenId)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  user&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;        The user to query&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    The contract to query&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     The tokenId to query&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; entitlementOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amt&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;supportsInterface&lt;&#x2F;code&gt; MUST return true when called with &lt;code&gt;ERC5380Entitlement&lt;&#x2F;code&gt;&#x27;s interface ID.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;enumerable-extension&quot;&gt;Enumerable Extension&lt;&#x2F;h3&gt;
&lt;p&gt;This OPTIONAL Solidity interface is RECOMMENDED.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC5380EntitlementEnumerable&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC5380Entitlement&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Also implicitly supports ERC-165&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         Enumerate tokens with nonzero entitlement assigned to a user&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;            Throws if the index is out of bounds or if user == address(0)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  user&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    The user to query&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  index&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   A counter&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; entitlementOfUserByIndex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;supportsInterface&lt;&#x2F;code&gt; MUST return true when called with &lt;code&gt;ERC5380EntitlementEnumerable&lt;&#x2F;code&gt;&#x27;s interface ID.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;metadata-extension&quot;&gt;Metadata Extension&lt;&#x2F;h3&gt;
&lt;p&gt;This OPTIONAL Solidity interface is RECOMMENDED.&lt;&#x2F;p&gt;
&lt;p&gt;This extension uses &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1046&#x2F;&quot;&gt;ERC-1046&lt;&#x2F;a&gt; for &lt;code&gt;tokenURI&lt;&#x2F;code&gt; compatibility.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC5380EntitlementMetadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC5380Entitlement&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Also implicitly supports ERC-165&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;             ERC-1046 token URI&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                See ERC-1046 and the metadata schema below&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;supportsInterface&lt;&#x2F;code&gt; MUST return true when called with &lt;code&gt;ERC5380EntitlementMetadata&lt;&#x2F;code&gt;&#x27;s interface ID.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;interoperability-metadata-extension&quot;&gt;Interoperability Metadata Extension&lt;&#x2F;h4&gt;
&lt;p&gt;ERC-1046&#x27;s &lt;code&gt;InteroperabilityMetadata&lt;&#x2F;code&gt; is extended with the following TypeScript interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * ERC-5380&amp;#39;s extension to ERC-1046&amp;#39;s Interoperability metadata.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC5380InteroperabilityMetadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InteroperabilityMetadata&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * This MUST be true if this is ERC-5380 Token Metadata, otherwise, this MUST be omitted.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Setting this to true indicates to wallets that the address should be treated as an ERC-5380 entitlement.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    erc5380&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; boolean&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; undefined&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;tokenuri-metadata-schema&quot;&gt;&lt;code&gt;tokenURI&lt;&#x2F;code&gt; Metadata Schema&lt;&#x2F;h4&gt;
&lt;p&gt;The resolved &lt;code&gt;tokenURI&lt;&#x2F;code&gt; data MUST conform to the following TypeScript interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * ERC-5380 Asset Metadata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * Can be extended&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC5380TokenMetadata&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Interoperabiliy, to differentiate between different types of tokens and their corresponding URIs.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    interop&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC5380InteroperabilityMetadata&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * The name of the ERC-5380 token. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    name&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * The symbol of the ERC-5380 token. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    symbol&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Provides a short one-paragraph description of the ERC-5380 token, without any markup or newlines.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    description&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * One or more URIs each pointing to a resource with mime type `image&#x2F;*` that represents this token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * If an image is a bitmap, it SHOULD have a width between 320 and 1080 pixels&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Images SHOULD have an aspect ratio between 1.91:1 and 4:5 inclusive.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    images&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * One or more URIs each pointing to a resource with mime type `image&#x2F;*` that represent an icon for this token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * If an image is a bitmap, it SHOULD have a width between 320 and 1080 pixels, and MUST have a height equal to its width&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Images MUST have an aspect ratio of 1:1, and use a transparent background&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    icons&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; are unsupported as partial ownership is much more complex to track than boolean ownership.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues were found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The security considerations of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1046&#x2F;&quot;&gt;ERC-1046&lt;&#x2F;a&gt; apply.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Beacon chain push withdrawals as operations</title>
        <published>2022-03-10T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Stokes</name><uri>https://github.com/ralexstokes</uri>
	</author>
	
	<author>
		<name>Danny Ryan</name><uri>https://github.com/djrtwo</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4895/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-4895-beacon-chain-withdrawals-as-system-level-operations/8568" />
        

        <id>https://wg-eips.ritovision.com/4895/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:4895"
            label="EIP-4895" />
        

        
        

        
        <summary type="html">Support validator withdrawals from the beacon chain to the EVM via a new &quot;system-level&quot; operation type.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4895/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce a system-level &quot;operation&quot; to support validator withdrawals that are &quot;pushed&quot; from the beacon chain to the EVM.&lt;&#x2F;p&gt;
&lt;p&gt;These operations create unconditional balance increases to the specified recipients.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP provides a way for validator withdrawals made on the beacon chain to enter into the EVM.
The architecture is &quot;push&quot;-based, rather than &quot;pull&quot;-based, where withdrawals are required to be processed in the execution layer as soon as they are dequeued from the consensus layer.&lt;&#x2F;p&gt;
&lt;p&gt;Withdrawals are represented as a new type of object in the execution payload -- an &quot;operation&quot; -- that separates the withdrawals feature from user-level transactions.
This approach is more involved than the prior approach introducing a new transaction type but it cleanly separates this &quot;system-level&quot; operation from regular transactions.
The separation simplifies testing (so facilitates security) by reducing interaction effects generated by mixing this system-level concern with user data.&lt;&#x2F;p&gt;
&lt;p&gt;Moreover, this approach is more complex than &quot;pull&quot;-based alternatives with respect to the core protocol but does provide tighter integration of a critical feature into the protocol itself.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;constants&lt;&#x2F;th&gt;&lt;th&gt;value&lt;&#x2F;th&gt;&lt;th&gt;units&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FORK_TIMESTAMP&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;1681338455&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Beginning with the execution timestamp &lt;code&gt;FORK_TIMESTAMP&lt;&#x2F;code&gt;, execution clients &lt;strong&gt;MUST&lt;&#x2F;strong&gt; introduce the following extensions to payload validation and processing:&lt;&#x2F;p&gt;
&lt;h3 id=&quot;system-level-operation-withdrawal&quot;&gt;System-level operation: withdrawal&lt;&#x2F;h3&gt;
&lt;p&gt;Define a new payload-level object called a &lt;code&gt;withdrawal&lt;&#x2F;code&gt; that describes withdrawals that have been validated at the consensus layer.
&lt;code&gt;Withdrawal&lt;&#x2F;code&gt;s are syntactically similar to a user-level transaction but live in a different domain than user-level transactions.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;Withdrawal&lt;&#x2F;code&gt;s provide key information from the consensus layer:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;a monotonically increasing &lt;code&gt;index&lt;&#x2F;code&gt;, starting from 0, as a &lt;code&gt;uint64&lt;&#x2F;code&gt; value that increments by 1 per withdrawal to uniquely identify each withdrawal&lt;&#x2F;li&gt;
&lt;li&gt;the &lt;code&gt;validator_index&lt;&#x2F;code&gt; of the validator, as a &lt;code&gt;uint64&lt;&#x2F;code&gt; value, on the consensus layer the withdrawal corresponds to&lt;&#x2F;li&gt;
&lt;li&gt;a recipient for the withdrawn ether &lt;code&gt;address&lt;&#x2F;code&gt; as a 20-byte value&lt;&#x2F;li&gt;
&lt;li&gt;a nonzero &lt;code&gt;amount&lt;&#x2F;code&gt; of ether given in Gwei (1e9 wei) as a &lt;code&gt;uint64&lt;&#x2F;code&gt; value.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;em&gt;NOTE&lt;&#x2F;em&gt;: the &lt;code&gt;index&lt;&#x2F;code&gt; for each withdrawal is a global counter spanning the entire sequence of withdrawals.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;Withdrawal&lt;&#x2F;code&gt; objects are serialized as a RLP list according to the schema: &lt;code&gt;[index, validator_index, address, amount]&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;new-field-in-the-execution-payload-withdrawals&quot;&gt;New field in the execution payload: withdrawals&lt;&#x2F;h3&gt;
&lt;p&gt;The execution payload gains a new field for the &lt;code&gt;withdrawals&lt;&#x2F;code&gt; which is an RLP list of &lt;code&gt;Withdrawal&lt;&#x2F;code&gt; data.&lt;&#x2F;p&gt;
&lt;p&gt;For example:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;withdrawal_0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;index_0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; validator_index_0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; address_0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount_0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;withdrawal_1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;index_1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; validator_index_1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; address_1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount_1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;withdrawals&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;withdrawal_0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; withdrawal_1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This new field is encoded after the existing fields in the execution payload structure and is considered part of the execution payload&#x27;s body.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;execution_payload_rlp&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; RLP&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; transactions&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; withdrawals&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;execution_payload_body_rlp&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; RLP&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;transactions&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; withdrawals&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;NOTE: the empty list in this schema is due to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3675&#x2F;&quot;&gt;EIP-3675&lt;&#x2F;a&gt; that sets the &lt;code&gt;ommers&lt;&#x2F;code&gt; value to a fixed constant.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;new-field-in-the-execution-payload-header-withdrawals-root&quot;&gt;New field in the execution payload header: withdrawals root&lt;&#x2F;h3&gt;
&lt;p&gt;The execution payload header gains a new field committing to the &lt;code&gt;withdrawals&lt;&#x2F;code&gt; in the execution payload.&lt;&#x2F;p&gt;
&lt;p&gt;This commitment is constructed identically to the transactions root in the existing execution payload header by inserting
each withdrawal into a Merkle-Patricia trie keyed by index in the list of &lt;code&gt;withdrawals&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; compute_trie_root_from_indexed_data&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    trie&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Trie&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; obj&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; obj&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; enumerate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; trie&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;execution_payload_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;withdrawals_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; compute_trie_root_from_indexed_data&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;execution_payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;withdrawals&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The execution payload header is extended with a new field containing the 32 byte root of the trie committing to the list of withdrawals provided in a given execution payload.&lt;&#x2F;p&gt;
&lt;p&gt;To illustrate:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;execution_payload_header_rlp&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; RLP&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  parent_hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ommers hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  coinbase&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  state_root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  txs_root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  receipts_root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  logs_bloom&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;  0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; difficulty&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  number&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  gas_limit&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  gas_used&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  timestamp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  extradata&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  prev_randao&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0000000000000000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  base_fee_per_gas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  withdrawals_root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;NOTE: field names and constant value in this example reflect &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3675&#x2F;&quot;&gt;EIP-3675&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4399&#x2F;&quot;&gt;EIP-4399&lt;&#x2F;a&gt;. Refer to those EIPs for further information.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;execution-payload-validity&quot;&gt;Execution payload validity&lt;&#x2F;h3&gt;
&lt;p&gt;Assuming the execution payload is well-formatted, the execution client has an additional payload validation to ensure that the &lt;code&gt;withdrawals_root&lt;&#x2F;code&gt; matches the expected value given the list in the payload.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span&gt; execution_payload_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;withdrawals_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; compute_trie_root_from_indexed_data&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;execution_payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;withdrawals&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;state-transition&quot;&gt;State transition&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;withdrawals&lt;&#x2F;code&gt; in an execution payload are processed &lt;strong&gt;after&lt;&#x2F;strong&gt; any user-level transactions are applied.&lt;&#x2F;p&gt;
&lt;p&gt;For each &lt;code&gt;withdrawal&lt;&#x2F;code&gt; in the list of &lt;code&gt;execution_payload.withdrawals&lt;&#x2F;code&gt;, the implementation increases the balance of the &lt;code&gt;address&lt;&#x2F;code&gt; specified by the &lt;code&gt;amount&lt;&#x2F;code&gt; given.&lt;&#x2F;p&gt;
&lt;p&gt;Recall that the &lt;code&gt;amount&lt;&#x2F;code&gt; is given in units of Gwei so a conversion to units of wei must be performed when working with account balances in the execution state.&lt;&#x2F;p&gt;
&lt;p&gt;This balance change is unconditional and &lt;strong&gt;MUST&lt;&#x2F;strong&gt; not fail.&lt;&#x2F;p&gt;
&lt;p&gt;This operation has no associated gas costs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-not-a-new-transaction-type&quot;&gt;Why not a new transaction type?&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP suggests a new type of object -- the &quot;withdrawal operation&quot; -- as it has special semantics different from other existing types of EVM transactions.&lt;&#x2F;p&gt;
&lt;p&gt;Operations are initiated by the overall system, rather than originating from end users like typical transactions.&lt;&#x2F;p&gt;
&lt;p&gt;An entirely new type of object firewalls off generic EVM execution from this type of processing to simplify testing and security review of withdrawals.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-no-gas-costs-for-the-withdrawal-type&quot;&gt;Why no (gas) costs for the withdrawal type?&lt;&#x2F;h3&gt;
&lt;p&gt;The maximum number of withdrawals that can reach the execution layer at a given time is bounded (enforced by the consensus layer) and this limit has been chosen so that
any execution layer operational costs are negligible in the context of the broader payload execution.&lt;&#x2F;p&gt;
&lt;p&gt;This bound applies to both computational cost (only a few balance updates in the state) and storage&#x2F;networking cost as the additional payload footprint is kept small (current parameterizations put the additional overhead at ~1% of current average payload size).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-only-balance-updates-no-general-evm-execution&quot;&gt;Why only balance updates? No general EVM execution?&lt;&#x2F;h3&gt;
&lt;p&gt;More general processing introduces the risk of failures, which complicates accounting on the beacon chain.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP suggests a route for withdrawals that provides most of the benefits for a minimum of the (complexity) cost.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Consensus-layer validation of withdrawal transactions is critical to ensure that the proper amount of ETH is withdrawn back into the execution layer.
This consensus-layer to execution-layer ETH transfer does not have a current analog in the EVM and thus deserves very high security scrutiny.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Composable SVG NFT</title>
        <published>2022-03-08T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Andrew B Coathup</name><uri>https://github.com/abcoathup</uri>
	</author>
	
	<author>
		<name>Alex</name><uri>https://github.com/AlexPartyPanda</uri>
	</author>
	
	<author>
		<name>Damian Martinelli</name><uri>https://github.com/damianmarti</uri>
	</author>
	
	<author>
		<name>blockdev</name><uri>https://github.com/0xbok</uri>
	</author>
	
	<author>
		<name>Austin Griffith</name><uri>https://github.com/austintgriffith</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4883/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-4883-composable-svg-nft/8765" />
        

        <id>https://wg-eips.ritovision.com/4883/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:4883"
            label="ERC-4883" />
        

        
        

        
        <summary type="html">Compose an SVG NFT by concatenating the SVG with the rendered SVG of another NFT.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4883/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Compose an SVG (Scalable Vector Graphics) NFT by concatenating the SVG with the SVG of another NFT rendered as a string for a specific token ID.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Onchain SVG NFTs allow for NFTs to be entirely onchain by returning artwork as SVG in a data URI of the &lt;code&gt;tokenUri&lt;&#x2F;code&gt; function. Composability allows onchain SVG NFTs to be crafted. e.g. adding glasses &amp;amp; hat NFTs to a profile pic NFT or a fish NFT to a fish tank NFT.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; EIP-4883 Non-Fungible Token Standard&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC4883&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; renderTokenById&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;renderTokenById&lt;&#x2F;code&gt; must return the SVG body for the specified token &lt;code&gt;id&lt;&#x2F;code&gt; and must either be an empty string or valid SVG element(s).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;SVG elements can be string concatenated to compose an SVG.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;ordering-of-concatenation&quot;&gt;Ordering of concatenation&lt;&#x2F;h3&gt;
&lt;p&gt;SVG uses a &quot;painters model&quot; of rendering.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Scalable Vector Graphics (SVG) 1.1 (Second Edition)&lt;&#x2F;strong&gt;, section: &lt;strong&gt;3.3 Rendering Order&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Elements in an SVG document fragment have an implicit drawing order, with the first elements in the SVG document fragment getting &quot;painted&quot; first. Subsequent elements are painted on top of previously painted elements.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;The ordering of the SVG concatenation determines the drawing order rather than any concept of a z-index.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP only specifies the rendering of the rendered SVG NFT and does not require any specific ordering when composing.  This allows the SVG NFT to use a rendered SVG NFT as a foreground or a background as required.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;alternatives-to-concatenation&quot;&gt;Alternatives to concatenation&lt;&#x2F;h3&gt;
&lt;p&gt;SVG specifies a &lt;code&gt;link&lt;&#x2F;code&gt; tag.  Linking could allow for complex SVGs to be composed but would require creating a URI format and then getting ecosystem adoption.  As string concatenation of SVG&#x27;s is already supported, the simpler approach of concatenation is used.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;sizing&quot;&gt;Sizing&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP doesn&#x27;t specify any requirements on the size of the rendered SVG.  Any scaling based on sizing can be performed by the SVG NFT as required.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;render-function-name&quot;&gt;Render function name&lt;&#x2F;h3&gt;
&lt;p&gt;The render function is named &lt;code&gt;renderTokenById&lt;&#x2F;code&gt; as this function name was first used by Loogies and allows existing deployed NFTs to be compatible with this EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP has no backwards compatibility concerns&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;SVG uses a &quot;painters model&quot; of rendering. A rendered SVG body could be added and completely obscure the existing SVG NFT artwork.&lt;&#x2F;li&gt;
&lt;li&gt;SVG is XML and can contain malicious content, and while it won&#x27;t impact the contract, it could impact the use of the SVG.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Subscription NFTs and Multi Tokens</title>
        <published>2022-03-08T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Jules Lai</name><uri>https://github.com/julesl23</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4885/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-subscription-token-standard/8531" />
        

        <id>https://wg-eips.ritovision.com/4885/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:4885"
            label="ERC-4885" />
        

        
        

        
        <summary type="html">An interface for subscription tokens that gives holders subscriptions to NFTs and multi tokens</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4885/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The following standard allows for the implementation of a standard API for subscribing to non-fungible and multi tokens. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;EIP-20&lt;&#x2F;a&gt; tokens are deposited in exchange for subscription tokens that give the right to use said non-fungible and multi tokens for a specified time limited or unlimited period.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This standard offers a flexible, general purpose way to subscribe to the use of assets or services offered by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;EIP-1155&lt;&#x2F;a&gt; contracts. From here on in, for the sake of simplicity, these contracts will be known as NFTs; the provider is the issuer of said NFTs and the subscriber(s) uses them.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal was originally conceived from the want to give creators of music and film, back control. The distribution and delivery of digital content is currently the purview of centralised tech corporations who offer homogeneous subscription models to their customers. This proposal specifies a standard for dapp developers to give creators the ability to set their own custom subscription models and hence, open up new revenue streams that can lead to decentralised distribution and delivery models.&lt;&#x2F;p&gt;
&lt;p&gt;Use cases include any sort of periodic (e.g. daily, weekly, monthly, quarterly, yearly&#x2F;annual, or seasonal) use of or access to assets or services such as:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Subscriptions for streaming music, video, e-learning or book&#x2F;news services&lt;&#x2F;li&gt;
&lt;li&gt;Sharing of digital assets among subscribers&lt;&#x2F;li&gt;
&lt;li&gt;Club memberships such as health clubs&lt;&#x2F;li&gt;
&lt;li&gt;Season tickets for sports and e-sports&lt;&#x2F;li&gt;
&lt;li&gt;Agreement between parties to exchange fixed rate subscription stream with variable income in DeFi&lt;&#x2F;li&gt;
&lt;li&gt;Renting in-game assets&lt;&#x2F;li&gt;
&lt;li&gt;Etc.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The subscription token borrows a few functions from the EIP-20 specification. An implementer is free to implement the rest of the standard; allowing for example subscription tokens to be transferred in secondary markets, sent as gifts or for refunds etc.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The subscriber deposits EIP-20 to receive an NFT and subscription. Subscription tokens balance automatically decreases linearly over the lifetime of usage of the NFT, and use of the NFT is disabled once the subscription token balance falls to zero. The subscriber can top up the balance to extend the lifetime of the subscription by depositing EIP-20 tokens in exchange for more subscription tokens.&lt;&#x2F;p&gt;
&lt;p&gt;Smart contracts implementing this EIP standard MUST implement the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;EIP-165&lt;&#x2F;a&gt; supportsInterface function and MUST return the constant value true if 0xC1A48422 is passed through the interfaceID argument. Note that revert in this document MAY mean a require, throw (not recommended as depreciated) or revert solidity statement with or without error messages.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ISubscriptionToken&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when the subscription token constructor or initialize method is&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        executed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; name&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The name of the subscription token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; symbol&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The symbol of the subscription token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; provider&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The provider of the subscription whom receives the deposits&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; subscriptionToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The subscription token contract address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; baseToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ERC-20 compatible token to use for the deposits.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; nft&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the `nft` contract that the provider mints&#x2F;transfers from.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        All tokenIds referred to in this interface MUST be token instances of this `nft` contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InitializeSubscriptionToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; symbol&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; provider&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; subscriptionToken&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; baseToken&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nft&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uri&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits for every new subscriber to `nft` contract of token `tokenId`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        `subscriber` MUST have received `nft` of token `tokenId` in their account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; subscriber&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The subscriber account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST be token id of `nft` sent to `subscriber`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uri&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST be uri of the `nft` that was sent to `subscriber` or empty string&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SubscribeToNFT&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; subscriber&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uri&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emits when `subscriber` deposits ERC-20 of token type `baseToken` via the `deposit method.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        This tops up `subscriber` balance of subscription tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; depositAmount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of ERC-20 of type `baseToken` deposited&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; subscriptionTokenAmount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of subscription tokens sent in exchange to `subscriber`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; subscriptionPeriod&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Amount of additional time in seconds subscription is extended&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Deposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; subscriber&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; depositAmount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; subscriptionTokenAmount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; subscriptionPeriod&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; name of the subscription token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; symbol of the subscription token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; symbol&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Subscribes `subscriber` to `nft` of &amp;#39;tokenId&amp;#39;. `subscriber` MUST receive `nft`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        of token `tokenId` in their account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST revert if `subscriber` is already subscribed to `nft` of &amp;#39;tokenId&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        MUST revert if &amp;#39;nft&amp;#39; has not approved the `subscriptionToken` contract address as operator.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; subscriber&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The subscriber account. MUST revert if zero address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST be token id of `nft` contract sent to `subscriber`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        `tokenId` emitted from event `SubscribeToNFT` MUST be the same as tokenId except when&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        tokenId is zero; allows OPTIONAL tokenid that is then set internally and minted by&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        `nft` contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uri&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The OPTIONAL uri of the `nft`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        `uri` emitted from event `SubscribeToNFT` MUST be the same as uri except when uri is empty.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; subscribeToNFT&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; subscriber&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uri&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Top up balance of subscription tokens held by `subscriber`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST revert if `subscriber` is not subscribed to `nft` of &amp;#39;tokenId&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        MUST revert if &amp;#39;nft&amp;#39; has not approved the `subscriptionToken` contract address as operator.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; subscriber&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The subscriber account. MUST revert if zero address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token id of `nft` contract to subscribe to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; depositAmount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of ERC-20 token of contract address `baseToken` to deposit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        in exchange for subscription tokens of contract address `subscriptionToken`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; deposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; subscriber&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; depositAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; balance of subscription tokens held by `subscriber`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        RECOMMENDED that the balance decreases linearly to zero for time limited subscriptions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        RECOMMENDED that the balance remains the same for life long subscriptions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        MUST return zero balance if the `subscriber` does not hold `nft` of &amp;#39;tokenId&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        MUST revert if subscription has not yet started via the `deposit` function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        When the balance is zero, the use of `nft` of `tokenId` MUST NOT be allowed for `subscriber`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; subscriber&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;subscription-token-balances&quot;&gt;Subscription token balances&lt;&#x2F;h3&gt;
&lt;p&gt;An example implementation mints an amount of subscription token that totals to one subscription token per day of the subscription period length paid for by the subscriber; for example a week would be for seven subscription tokens. The subscription token balance then decreases automatically at a rate of one token per day continuously and linearly over time until zero. The &lt;code&gt;balanceOf&lt;&#x2F;code&gt; function can be implemented lazily by calculating the amount of subscription tokens left only when it is called as a view function, thus has no gas cost.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;subscription-token-price&quot;&gt;Subscription token price&lt;&#x2F;h3&gt;
&lt;p&gt;Subscription token price paid per token per second can be calculated from the &lt;code&gt;Deposit&lt;&#x2F;code&gt; event parameters as
&lt;code&gt;depositAmount&lt;&#x2F;code&gt; &#x2F; (&lt;code&gt;subscriptionTokenAmount&lt;&#x2F;code&gt; * &lt;code&gt;subscriptionPeriod&lt;&#x2F;code&gt;)&lt;&#x2F;p&gt;
&lt;h3 id=&quot;nft-metadata&quot;&gt;NFT metadata&lt;&#x2F;h3&gt;
&lt;p&gt;The NFT&#x27;s metadata can store information of the asset&#x2F;service offered to the subscriber by the provider for the duration of the subscription. This MAY be the terms and conditions of the agreed subscription service offered by the provider to the subscriber. It MAY also be the metadata of the NFT asset if this is offered directly. This standard is kept purposely general to cater for many different use cases of NFTs.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;subscription-expiry&quot;&gt;Subscription expiry&lt;&#x2F;h3&gt;
&lt;p&gt;When the subscription token balance falls to zero for a subscriber (signifying that the subscription has expired) then it is up to the implementer on how to handle this for their particular use case. For example, a provider may stop streaming media service to a subscriber. For an NFT that represents an image stored off-chain, perhaps the NFT&#x27;s &lt;code&gt;uri&lt;&#x2F;code&gt; function no longer returns back a link to its metadata.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;caveats&quot;&gt;Caveats&lt;&#x2F;h3&gt;
&lt;p&gt;With some traditional subscription models based on fiat currencies, the subscribers&#x27; saved payment credentials are used to automatically purchase to extend the subscription period, at or just before expiry. This feature is not possible in this proposal specification as recurring payments will have to have allowance approved for signed by a subscriber for each payment when using purely cryptocurrencies.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal does not deal with pausing subscriptions directly, implementers can write their own or inherit off 3rd party smart contract abstractions such as OpenZeppelin&#x27;s Pausable. In that case, &lt;code&gt;balanceOf&lt;&#x2F;code&gt; method would need extra logic and storage to account for the length of time the subscription tokens were paused.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;tokenisation-of-subscriptions&quot;&gt;Tokenisation of subscriptions&lt;&#x2F;h3&gt;
&lt;p&gt;The subscription itself has value when it is exchanged for a deposit. This proposal enables subscriptions to be &#x27;tokenised&#x27; thus secondary markets can exist where the subscription tokens can be bought and sold. For example, a fan might want to sell their season ticket, that gives access to live sporting events, on to another fan. This would not be as easily possible if there was only a date expiry extension feature added to NFTs.
An implementer can simply implement the rest of the EIP-20 functions for subscription tokens to be traded. It is left to the implementer to decide if the subscription service offered is non-fungible or fungible. If non-fungible then buying the subscription tokens would simply give the same period left to expiration. If fungible and the purchaser already had an existing subscription for the same service then their total subscription period can be extended by the amount of subscription tokens bought.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;cater-for-current-and-future-uses-of-nfts&quot;&gt;Cater for current and future uses of NFTs&lt;&#x2F;h3&gt;
&lt;p&gt;This proposal purposely keeps &lt;code&gt;tokenId&lt;&#x2F;code&gt; and &lt;code&gt;uri&lt;&#x2F;code&gt; optional in the &lt;code&gt;subcribeToNFT&lt;&#x2F;code&gt; method to keep the specification general purpose. Some use cases such as pre-computed image NFT collections don&#x27;t require a different &#x27;uri&#x27;, just a different &lt;code&gt;tokenId&lt;&#x2F;code&gt; for each NFT. However, in other use cases such as those that require legal contracts between both parties, individual &lt;code&gt;uri&lt;&#x2F;code&gt; links are probably required as the NFT&#x27;s metadata may require information from both parties to be stored on immutable storage.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;giving-back-users-control&quot;&gt;Giving back users control&lt;&#x2F;h3&gt;
&lt;p&gt;Traditional subscription models, particularly with streaming services, control of the subscription model is totally with that of the central service provider. This proposal gives decentralised services a standard way to give control back to their users. Hence each user is able to develop their own subscription eco system and administer it towards one that suits theirs and their subscribers&#x27; needs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;A subscription token contract can be fully compatible with EIP-20 specification to allow, for example, transfers from one subscriber to another subscriber or user. EIP-20 methods &lt;code&gt;name&lt;&#x2F;code&gt;, &lt;code&gt;symbol&lt;&#x2F;code&gt; and &lt;code&gt;balanceOf&lt;&#x2F;code&gt; are already part of the specification of this proposal, and it is left to the implementer to choose whether to implement the rest of EIP-20&#x27;s interface by considering their own use case.&lt;&#x2F;p&gt;
&lt;p&gt;Use of subscription tokens is in effect an indirect way to control the lifetime of an NFT. As such it is assumed that this arrangement would work best when the NFTs and subscription token contracts subscribing to the NFTs, are deployed by the same platform or decentralised app. It MUST NOT have an impact or dependencies to existing NFTs that have not approved the subscription token as an operator. Indeed in this case, any other parties wouldn&#x27;t be aware of and any NFT lifetime dependencies will be ignored, hence should not work anyway. To this end, this proposal specifies that the &#x27;nft&#x27; MUST have approved the &lt;code&gt;subscriptionToken&lt;&#x2F;code&gt; contract address as operator.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;It is normal for service providers to receive subscriber payments upfront before the subscriber gets to use the service. Indeed this proposal via the &lt;code&gt;deposit&lt;&#x2F;code&gt; method follows this remit. It would therefore be possible that a service provider sets up, receives the deposits and then does not provide or provides the service poorly to its subscribers. This happens in the traditional world too and this proposal does not cover how to resolve this.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;subscribeToNFT&lt;&#x2F;code&gt; method takes a parameter &lt;code&gt;uri&lt;&#x2F;code&gt; link to the &lt;code&gt;nft&lt;&#x2F;code&gt; metadata. It is possible if stored on centralised storage that the owners can change the metadata, or perhaps the metadata is hacked which is an issue with vanilla NFT contracts too. But because the &lt;code&gt;uri&lt;&#x2F;code&gt; is provided at the time of subscription rather then deployment, it is RECOMMENDED that where the use case requires, implementers ensure that the &lt;code&gt;uri&lt;&#x2F;code&gt; link is to immutable storage.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Beacon chain push withdrawals</title>
        <published>2022-02-28T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Stokes</name><uri>https://github.com/ralexstokes</uri>
	</author>
	
	<author>
		<name>Danny Ryan</name><uri>https://github.com/djrtwo</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4863/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-4863-beacon-chain-push-withdrawals/8465" />
        

        <id>https://wg-eips.ritovision.com/4863/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:4863"
            label="EIP-4863" />
        

        
        

        
        <summary type="html">Support validator withdrawals from the beacon chain to the EVM via a new &quot;push-style&quot; transaction type.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4863/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce a new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718 transaction type&lt;&#x2F;a&gt; to support validator withdrawals that are &quot;pushed&quot; from the beacon chain to the EVM.&lt;&#x2F;p&gt;
&lt;p&gt;Add block validations to ensure the withdrawal transactions are sound with respect to withdrawal processing on the beacon chain.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP provides a way for validator withdrawals made on the beacon chain to enter into the EVM.
The architecture is &quot;push&quot;-based, rather than &quot;pull&quot;-based, where withdrawals are required to be processed in the execution block as soon as they are dequeued from the beacon chain.&lt;&#x2F;p&gt;
&lt;p&gt;This approach is more involved than &quot;pull&quot;-based alternatives (e.g. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4788&#x2F;&quot;&gt;EIP-4788&lt;&#x2F;a&gt; + user-space withdrawal contract) with respect to the core protocol (by providing a new transaction type with special semantics) but does provide tighter integration of a critical feature into the protocol itself.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;constants&lt;&#x2F;th&gt;&lt;th&gt;value&lt;&#x2F;th&gt;&lt;th&gt;units&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FORK_TIMESTAMP&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;TBD&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;WITHDRAWAL_TX_TYPE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x3&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;byte&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Beginning with the execution timestamp &lt;code&gt;FORK_TIMESTAMP&lt;&#x2F;code&gt;, execution clients &lt;strong&gt;MUST&lt;&#x2F;strong&gt; introduce the following extensions to transaction processing and block validation:&lt;&#x2F;p&gt;
&lt;h3 id=&quot;new-transaction-type&quot;&gt;New transaction type&lt;&#x2F;h3&gt;
&lt;p&gt;Define a new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; transaction type with &lt;code&gt;TransactionType&lt;&#x2F;code&gt; &lt;code&gt;WITHDRAWAL_TX_TYPE&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;TransactionPayload&lt;&#x2F;code&gt; is an RLP-encoded list &lt;code&gt;RLP([index, address, amount])&lt;&#x2F;code&gt; where the &lt;code&gt;index&lt;&#x2F;code&gt; is a 64-bit value uniquely labeling a specific withdrawal, the &lt;code&gt;address&lt;&#x2F;code&gt; refers to an execution layer account and the &lt;code&gt;amount&lt;&#x2F;code&gt; refers to an ether value given in units of wei.&lt;&#x2F;p&gt;
&lt;p&gt;These values are provided by the consensus layer.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;block-validity&quot;&gt;Block validity&lt;&#x2F;h3&gt;
&lt;p&gt;If a block contains &lt;em&gt;any&lt;&#x2F;em&gt; transactions with &lt;code&gt;WITHDRAWAL_TX_TYPE&lt;&#x2F;code&gt; type, they &lt;strong&gt;MUST&lt;&#x2F;strong&gt; come after &lt;strong&gt;ALL&lt;&#x2F;strong&gt; other transactions in the block.&lt;&#x2F;p&gt;
&lt;p&gt;If the execution client receives a block where this is not the case, it &lt;strong&gt;MUST&lt;&#x2F;strong&gt; consider the block invalid.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;transaction-processing&quot;&gt;Transaction processing&lt;&#x2F;h3&gt;
&lt;p&gt;When processing a transaction with &lt;code&gt;WITHDRAWAL_TX_TYPE&lt;&#x2F;code&gt; type, the implementation should increase the balance of the &lt;code&gt;address&lt;&#x2F;code&gt; specified by
the &lt;code&gt;WithdrawalTransaction&lt;&#x2F;code&gt; by the &lt;code&gt;amount&lt;&#x2F;code&gt; of wei specified.&lt;&#x2F;p&gt;
&lt;p&gt;This balance change is unconditional and &lt;strong&gt;MUST&lt;&#x2F;strong&gt; not fail.&lt;&#x2F;p&gt;
&lt;p&gt;This transaction type has no associated gas costs.&lt;&#x2F;p&gt;
&lt;p&gt;TODO: add logs?&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;push-vs-pull-approach&quot;&gt;Push vs pull approach&lt;&#x2F;h3&gt;
&lt;p&gt;This push approach gives validators a small subsidy with respect to processing, in lieu of needing to buy gas via normal EVM processing that would be required for a pull-based approach.&lt;&#x2F;p&gt;
&lt;p&gt;This style also happens automatically when the requisite conditions are met on the beacon chain which is nicer UX for validators.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-a-new-transaction-type&quot;&gt;Why a new transaction type?&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP suggests a new transaction type as it has special semantics different from other existing types of EVM transactions.&lt;&#x2F;p&gt;
&lt;p&gt;An entirely new transaction type firewalls off generic EVM execution from this type of processing to simplify testing and security review of withdrawals.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-no-gas-costs-for-new-transaction-type&quot;&gt;Why no (gas) costs for new transaction type?&lt;&#x2F;h3&gt;
&lt;p&gt;The maximum number of this transaction type that can reach the execution layer at a given time is bounded (enforced by the consensus layer) and this limit is kept small so that
any execution layer operational costs are negligible in the context of the broader block execution.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-only-balance-updates-no-general-evm-execution&quot;&gt;Why only balance updates? No general EVM execution?&lt;&#x2F;h3&gt;
&lt;p&gt;More general processing introduces the risk of failures, which complicates accounting on the beacon chain.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP suggests a route for withdrawals that provides most of the benefits for a minimum of the (complexity) cost.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-new-block-validations&quot;&gt;Why new block validations?&lt;&#x2F;h3&gt;
&lt;p&gt;The beacon chain must be able to efficiently validate that the withdrawal transactions in a given execution block are
the ones expected based on its own internal scheduling logic to maintain the soundness of the withdrawal mechanism.&lt;&#x2F;p&gt;
&lt;p&gt;By requiring all withdrawal transactions to be at the back of every block where they are applicable, the algorithm to
check consistency becomes a straightforward linear walk from the start of the set until a known, bounded (small) number.&lt;&#x2F;p&gt;
&lt;p&gt;Having a simple ordering scheme like this facilitates optimizations clients may do with respect to withdrawal processing, which
would be hampered if withdrawal transactions could be placed in the block freely.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Consensus-layer validation of withdrawal transactions is critical to ensure that the proper amount of ETH is withdrawn back into the execution layer.
This consensus-layer to execution-layer ETH transfer does not have a current analog in the EVM and thus deserves very high security scrutiny.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Shard Blob Transactions</title>
        <published>2022-02-25T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	<author>
		<name>Dankrad Feist</name><uri>https://github.com/dankrad</uri>
	</author>
	
	<author>
		<name>Diederik Loerakker</name><uri>https://github.com/protolambda</uri>
	</author>
	
	<author>
		<name>George Kadianakis</name><uri>https://github.com/asn-d6</uri>
	</author>
	
	<author>
		<name>Matt Garnett</name><uri>https://github.com/lightclient</uri>
	</author>
	
	<author>
		<name>Mofi Taiwo</name><uri>https://github.com/Inphi</uri>
	</author>
	
	<author>
		<name>Ansgar Dietrichs</name><uri>https://github.com/adietrichs</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4844/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-4844-shard-blob-transactions/8430" />
        

        <id>https://wg-eips.ritovision.com/4844/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:4844"
            label="EIP-4844" />
        

        
        

        
        <summary type="html">Shard Blob Transactions scale data-availability of Ethereum in a simple, forwards-compatible manner.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4844/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce a new transaction format for &quot;blob-carrying transactions&quot; which contain a large amount of data that cannot be
accessed by EVM execution, but whose commitment can be accessed.
The format is intended to be fully compatible with the format that will be used in full sharding.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Rollups are in the short and medium term, and possibly in the long term, the only trustless scaling solution for Ethereum.
Transaction fees on L1 have been very high for months and there is greater urgency in doing anything required to help facilitate an ecosystem-wide move to rollups.
Rollups are significantly reducing fees for many Ethereum users: Optimism and Arbitrum frequently provide fees that are ~3-8x lower than the Ethereum base layer itself,
and ZK rollups, which have better data compression and can avoid including signatures, have fees ~40-100x lower than the base layer.&lt;&#x2F;p&gt;
&lt;p&gt;However, even these fees are too expensive for many users. The long-term solution to the long-term inadequacy of rollups
by themselves has always been data sharding, which would add ~16 MB per block of dedicated data space to the chain that rollups could use.
However, data sharding will still take a considerable amount of time to finish implementing and deploying.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP provides a stop-gap solution until that point by implementing the &lt;em&gt;transaction format&lt;&#x2F;em&gt; that would be used in sharding,
but not actually sharding those transactions. Instead, the data from this transaction format is simply part of the beacon chain and is fully downloaded
by all consensus nodes (but can be deleted after only a relatively short delay).
Compared to full data sharding, this EIP has a reduced cap on the number of these transactions that can be included, corresponding to a target of ~0.375 MB per block and a limit of ~0.75 MB.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;BLOB_TX_TYPE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;Bytes1(0x03)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;BYTES_PER_FIELD_ELEMENT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;32&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FIELD_ELEMENTS_PER_BLOB&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;4096&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;BLS_MODULUS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;52435875175126190479447740508185965837690552500527637822603658699938581184513&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;VERSIONED_HASH_VERSION_KZG&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;Bytes1(0x01)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;POINT_EVALUATION_PRECOMPILE_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;Bytes20(0x0A)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;POINT_EVALUATION_PRECOMPILE_GAS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;50000&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_BLOB_GAS_PER_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;786432&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TARGET_BLOB_GAS_PER_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;393216&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MIN_BASE_FEE_PER_BLOB_GAS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;BLOB_BASE_FEE_UPDATE_FRACTION&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;3338477&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;GAS_PER_BLOB&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2**17&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;HASH_OPCODE_BYTE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;Bytes1(0x49)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;HASH_OPCODE_GAS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;3&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;4de1d156c78b555421b72d6067c73b614ab55584&#x2F;configs&#x2F;mainnet.yaml#L148&quot;&gt;&lt;code&gt;MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;4096&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;type-aliases&quot;&gt;Type aliases&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Base type&lt;&#x2F;th&gt;&lt;th&gt;Additional checks&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;Blob&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;ByteVector[BYTES_PER_FIELD_ELEMENT * FIELD_ELEMENTS_PER_BLOB]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;VersionedHash&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;Bytes32&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;KZGCommitment&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;Bytes48&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Perform IETF BLS signature &quot;KeyValidate&quot; check but do allow the identity point&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;KZGProof&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;Bytes48&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Same as for &lt;code&gt;KZGCommitment&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;cryptographic-helpers&quot;&gt;Cryptographic Helpers&lt;&#x2F;h3&gt;
&lt;p&gt;Throughout this proposal we use cryptographic methods and classes defined in the corresponding &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;86fb82b221474cc89387fa6436806507b3849d88&#x2F;specs&#x2F;deneb&quot;&gt;consensus 4844 specs&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Specifically, we use the following methods from &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;86fb82b221474cc89387fa6436806507b3849d88&#x2F;specs&#x2F;deneb&#x2F;polynomial-commitments.md&quot;&gt;&lt;code&gt;polynomial-commitments.md&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;86fb82b221474cc89387fa6436806507b3849d88&#x2F;specs&#x2F;deneb&#x2F;polynomial-commitments.md#verify_kzg_proof&quot;&gt;&lt;code&gt;verify_kzg_proof()&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;86fb82b221474cc89387fa6436806507b3849d88&#x2F;specs&#x2F;deneb&#x2F;polynomial-commitments.md#verify_blob_kzg_proof_batch&quot;&gt;&lt;code&gt;verify_blob_kzg_proof_batch()&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;helpers&quot;&gt;Helpers&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; kzg_to_versioned_hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;commitment&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; KZGCommitment&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; VersionedHash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; VERSIONED_HASH_VERSION_KZG&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; sha256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;commitment&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Approximates &lt;code&gt;factor * e ** (numerator &#x2F; denominator)&lt;&#x2F;code&gt; using Taylor expansion:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fake_exponential&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;factor&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; numerator&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; denominator&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    output&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    numerator_accum&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; factor&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; denominator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    while&lt;&#x2F;span&gt;&lt;span&gt; numerator_accum&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        output&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; numerator_accum&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        numerator_accum&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;numerator_accum&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; numerator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;denominator&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; output&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; denominator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;blob-transaction&quot;&gt;Blob transaction&lt;&#x2F;h3&gt;
&lt;p&gt;We introduce a new type of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; transaction, &quot;blob transaction&quot;, where the &lt;code&gt;TransactionType&lt;&#x2F;code&gt; is &lt;code&gt;BLOB_TX_TYPE&lt;&#x2F;code&gt; and the &lt;code&gt;TransactionPayload&lt;&#x2F;code&gt; is the RLP serialization of the following &lt;code&gt;TransactionPayloadBody&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[chain_id, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit, to, value, data, access_list, max_fee_per_blob_gas, blob_versioned_hashes, y_parity, r, s]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The fields &lt;code&gt;chain_id&lt;&#x2F;code&gt;, &lt;code&gt;nonce&lt;&#x2F;code&gt;, &lt;code&gt;max_priority_fee_per_gas&lt;&#x2F;code&gt;, &lt;code&gt;max_fee_per_gas&lt;&#x2F;code&gt;, &lt;code&gt;gas_limit&lt;&#x2F;code&gt;, &lt;code&gt;value&lt;&#x2F;code&gt;, &lt;code&gt;data&lt;&#x2F;code&gt;, and &lt;code&gt;access_list&lt;&#x2F;code&gt; follow the same semantics as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The field &lt;code&gt;to&lt;&#x2F;code&gt; deviates slightly from the semantics with the exception that it MUST NOT be &lt;code&gt;nil&lt;&#x2F;code&gt; and therefore must always represent a 20-byte address. This means that blob transactions cannot have the form of a create transaction.&lt;&#x2F;p&gt;
&lt;p&gt;The field &lt;code&gt;max_fee_per_blob_gas&lt;&#x2F;code&gt; is a &lt;code&gt;uint256&lt;&#x2F;code&gt; and the field &lt;code&gt;blob_versioned_hashes&lt;&#x2F;code&gt; represents a list of hash outputs from &lt;code&gt;kzg_to_versioned_hash&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; &lt;code&gt;ReceiptPayload&lt;&#x2F;code&gt; for this transaction is &lt;code&gt;rlp([status, cumulative_transaction_gas_used, logs_bloom, logs])&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;signature&quot;&gt;Signature&lt;&#x2F;h4&gt;
&lt;p&gt;The signature values &lt;code&gt;y_parity&lt;&#x2F;code&gt;, &lt;code&gt;r&lt;&#x2F;code&gt;, and &lt;code&gt;s&lt;&#x2F;code&gt; are calculated by constructing a secp256k1 signature over the following digest:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;keccak256(BLOB_TX_TYPE || rlp([chain_id, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit, to, value, data, access_list, max_fee_per_blob_gas, blob_versioned_hashes]))&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;header-extension&quot;&gt;Header extension&lt;&#x2F;h3&gt;
&lt;p&gt;The current header encoding is extended with two new 64-bit unsigned integer fields:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;blob_gas_used&lt;&#x2F;code&gt; is the total amount of blob gas consumed by the transactions within the block.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;excess_blob_gas&lt;&#x2F;code&gt; is a running total of blob gas consumed in excess of the target, prior to the block. Blocks with above-target blob gas consumption increase this value, blocks with below-target blob gas consumption decrease it (bounded at 0).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The resulting RLP encoding of the header is therefore:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;rlp([&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    parent_hash,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347, # ommers hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    coinbase,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state_root,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    txs_root,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    receipts_root,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    logs_bloom,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    0, # difficulty&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    number,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_limit,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_used,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    timestamp,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    extradata,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    prev_randao,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    0x0000000000000000, # nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    base_fee_per_gas,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    withdrawals_root,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    blob_gas_used,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    excess_blob_gas,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The value of &lt;code&gt;excess_blob_gas&lt;&#x2F;code&gt; can be calculated using the parent header.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calc_excess_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Header&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;excess_blob_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;blob_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TARGET_BLOB_GAS_PER_BLOCK&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;excess_blob_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;blob_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TARGET_BLOB_GAS_PER_BLOCK&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;For the first post-fork block, both &lt;code&gt;parent.blob_gas_used&lt;&#x2F;code&gt; and &lt;code&gt;parent.excess_blob_gas&lt;&#x2F;code&gt; are evaluated as &lt;code&gt;0&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-accounting&quot;&gt;Gas accounting&lt;&#x2F;h3&gt;
&lt;p&gt;We introduce blob gas as a new type of gas. It is independent of normal gas and follows its own targeting rule, similar to EIP-1559.
We use the &lt;code&gt;excess_blob_gas&lt;&#x2F;code&gt; header field to store persistent data needed to compute the blob gas base fee. For now, only blobs are priced in blob gas.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calc_blob_fee&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;header&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Header&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Transaction&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; get_total_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; get_base_fee_per_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_total_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Transaction&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GAS_PER_BLOB&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;blob_versioned_hashes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_base_fee_per_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;header&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Header&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; fake_exponential&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        MIN_BASE_FEE_PER_BLOB_GAS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;excess_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        BLOB_BASE_FEE_UPDATE_FRACTION&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The block validity conditions are modified to include blob gas checks (see the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;#execution-layer-validation&quot;&gt;Execution layer validation&lt;&#x2F;a&gt; section below).&lt;&#x2F;p&gt;
&lt;p&gt;The actual &lt;code&gt;blob_fee&lt;&#x2F;code&gt; as calculated via &lt;code&gt;calc_blob_fee&lt;&#x2F;code&gt; is deducted from the sender balance before transaction execution and burned, and is not refunded in case of transaction failure.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;opcode-to-get-versioned-hashes&quot;&gt;Opcode to get versioned hashes&lt;&#x2F;h3&gt;
&lt;p&gt;We add an instruction &lt;code&gt;BLOBHASH&lt;&#x2F;code&gt; (with opcode &lt;code&gt;HASH_OPCODE_BYTE&lt;&#x2F;code&gt;) which reads &lt;code&gt;index&lt;&#x2F;code&gt; from the top of the stack
as big-endian &lt;code&gt;uint256&lt;&#x2F;code&gt;, and replaces it on the stack with &lt;code&gt;tx.blob_versioned_hashes[index]&lt;&#x2F;code&gt;
if &lt;code&gt;index &amp;lt; len(tx.blob_versioned_hashes)&lt;&#x2F;code&gt;, and otherwise with a zeroed &lt;code&gt;bytes32&lt;&#x2F;code&gt; value.
The opcode has a gas cost of &lt;code&gt;HASH_OPCODE_GAS&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;point-evaluation-precompile&quot;&gt;Point evaluation precompile&lt;&#x2F;h3&gt;
&lt;p&gt;Add a precompile at &lt;code&gt;POINT_EVALUATION_PRECOMPILE_ADDRESS&lt;&#x2F;code&gt; that verifies a KZG proof which claims that a blob
(represented by a commitment) evaluates to a given value at a given point.&lt;&#x2F;p&gt;
&lt;p&gt;The precompile costs &lt;code&gt;POINT_EVALUATION_PRECOMPILE_GAS&lt;&#x2F;code&gt; and executes the following logic:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; point_evaluation_precompile&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;input&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Verify p(z) = y given commitment that corresponds to the polynomial p(x) and a KZG proof.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Also verify that the provided commitment matches the provided versioned_hash.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The data is encoded as follows: versioned_hash | z | y | commitment | proof | with z and y being padded 32 byte big endian values&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;input&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 192&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    versioned_hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    z&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;64&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    y&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;64&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;96&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    commitment&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;96&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;144&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    proof&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;144&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;192&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify commitment matches versioned_hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; kzg_to_versioned_hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;commitment&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; versioned_hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify KZG proof with z and y in big endian format&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; verify_kzg_proof&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;commitment&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; z&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; y&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; proof&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Return FIELD_ELEMENTS_PER_BLOB and BLS_MODULUS as padded 32 byte big endian values&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;U256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;FIELD_ELEMENTS_PER_BLOB&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;to_be_bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; U256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;BLS_MODULUS&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;to_be_bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The precompile MUST reject non-canonical field elements (i.e. provided field elements MUST be strictly less than &lt;code&gt;BLS_MODULUS&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;consensus-layer-validation&quot;&gt;Consensus layer validation&lt;&#x2F;h3&gt;
&lt;p&gt;On the consensus layer the blobs are referenced, but not fully encoded, in the beacon block body.
Instead of embedding the full contents in the body, the blobs are propagated separately, as &quot;sidecars&quot;.&lt;&#x2F;p&gt;
&lt;p&gt;This &quot;sidecar&quot; design provides forward compatibility for further data increases by black-boxing &lt;code&gt;is_data_available()&lt;&#x2F;code&gt;:
with full sharding &lt;code&gt;is_data_available()&lt;&#x2F;code&gt; can be replaced by data-availability-sampling (DAS) thus avoiding all blobs being downloaded by all beacon nodes on the network.&lt;&#x2F;p&gt;
&lt;p&gt;Note that the consensus layer is tasked with persisting the blobs for data availability, the execution layer is not.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;ethereum&#x2F;consensus-specs&lt;&#x2F;code&gt; repository defines the following consensus layer changes involved in this EIP:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Beacon chain: process updated beacon blocks and ensure blobs are available.&lt;&#x2F;li&gt;
&lt;li&gt;P2P network: gossip and sync updated beacon block types and new blob sidecars.&lt;&#x2F;li&gt;
&lt;li&gt;Honest validator: produce beacon blocks with blobs; sign and publish the associated blob sidecars.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;execution-layer-validation&quot;&gt;Execution layer validation&lt;&#x2F;h3&gt;
&lt;p&gt;On the execution layer, the block validity conditions are extended as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validate_block&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; check that the excess blob gas was updated correctly&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;excess_blob_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; calc_excess_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    blob_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;transactions&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; modify the check for sufficient balance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        max_total_fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_fee_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; get_tx_type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BLOB_TX_TYPE&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            max_total_fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; get_total_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_fee_per_blob_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span&gt; signer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span&gt; max_total_fee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; add validity logic specific to blob txs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; get_tx_type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BLOB_TX_TYPE&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; there must be at least one blob&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;blob_versioned_hashes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; all versioned blob hashes must start with VERSIONED_HASH_VERSION_KZG&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            for&lt;&#x2F;span&gt;&lt;span&gt; h&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;blob_versioned_hashes&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                assert&lt;&#x2F;span&gt;&lt;span&gt; h&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; VERSIONED_HASH_VERSION_KZG&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ensure that the user was willing to at least pay the current blob base fee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            assert&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_fee_per_blob_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span&gt; get_base_fee_per_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; keep track of total blob gas spent in the block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            blob_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; get_total_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ensure the total blob gas spent is at most equal to the limit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; blob_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_BLOB_GAS_PER_BLOCK&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ensure blob_gas_used matches header&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;blob_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; blob_gas_used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;networking&quot;&gt;Networking&lt;&#x2F;h3&gt;
&lt;p&gt;Blob transactions have two network representations. During transaction gossip responses (&lt;code&gt;PooledTransactions&lt;&#x2F;code&gt;), the EIP-2718 &lt;code&gt;TransactionPayload&lt;&#x2F;code&gt; of the blob transaction is wrapped to become:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;rlp([tx_payload_body, blobs, commitments, proofs])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Each of these elements are defined as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;tx_payload_body&lt;&#x2F;code&gt; - is the &lt;code&gt;TransactionPayloadBody&lt;&#x2F;code&gt; of standard EIP-2718 &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;#blob-transaction&quot;&gt;blob transaction&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;blobs&lt;&#x2F;code&gt; - list of &lt;code&gt;Blob&lt;&#x2F;code&gt; items&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;commitments&lt;&#x2F;code&gt; - list of &lt;code&gt;KZGCommitment&lt;&#x2F;code&gt; of the corresponding &lt;code&gt;blobs&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;proofs&lt;&#x2F;code&gt; - list of &lt;code&gt;KZGProof&lt;&#x2F;code&gt; of the corresponding &lt;code&gt;blobs&lt;&#x2F;code&gt; and &lt;code&gt;commitments&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The node MUST validate &lt;code&gt;tx_payload_body&lt;&#x2F;code&gt; and verify the wrapped data against it. To do so, ensure that:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;There are an equal number of &lt;code&gt;tx_payload_body.blob_versioned_hashes&lt;&#x2F;code&gt;, &lt;code&gt;blobs&lt;&#x2F;code&gt;, &lt;code&gt;commitments&lt;&#x2F;code&gt;, and &lt;code&gt;proofs&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The KZG &lt;code&gt;commitments&lt;&#x2F;code&gt; hash to the versioned hashes, i.e. &lt;code&gt;kzg_to_versioned_hash(commitments[i]) == tx_payload_body.blob_versioned_hashes[i]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;The KZG &lt;code&gt;commitments&lt;&#x2F;code&gt; match the corresponding &lt;code&gt;blobs&lt;&#x2F;code&gt; and &lt;code&gt;proofs&lt;&#x2F;code&gt;. (Note: this can be optimized using &lt;code&gt;verify_blob_kzg_proof_batch&lt;&#x2F;code&gt;, with a proof for a
random evaluation at a point derived from the commitment and blob data for each blob)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;For body retrieval responses (&lt;code&gt;BlockBodies&lt;&#x2F;code&gt;), the standard EIP-2718 blob transaction &lt;code&gt;TransactionPayload&lt;&#x2F;code&gt; is used.&lt;&#x2F;p&gt;
&lt;p&gt;Nodes MUST NOT automatically broadcast blob transactions to their peers.
Instead, those transactions are only announced using &lt;code&gt;NewPooledTransactionHashes&lt;&#x2F;code&gt; messages, and can then be manually requested via &lt;code&gt;GetPooledTransactions&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;on-the-path-to-sharding&quot;&gt;On the path to sharding&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP introduces blob transactions in the same format in which they are expected to exist in the final sharding specification.
This provides a temporary but significant scaling relief for rollups by allowing them to initially scale to 0.375 MB per slot,
with a separate fee market allowing fees to be very low while usage of this system is limited.&lt;&#x2F;p&gt;
&lt;p&gt;The core goal of rollup scaling stopgaps is to provide temporary scaling relief,
without imposing extra development burdens on rollups to take advantage of this relief.
Today, rollups use calldata. In the future, rollups will have no choice but to use sharded data (also called &quot;blobs&quot;)
because sharded data will be much cheaper.
Hence, rollups cannot avoid making a large upgrade to how they process data at least once along the way.
But what we &lt;em&gt;can&lt;&#x2F;em&gt; do is ensure that rollups need to &lt;em&gt;only&lt;&#x2F;em&gt; upgrade once.
This immediately implies that there are exactly two possibilities for a stopgap: (i) reducing the gas costs of existing calldata,
and (ii) bringing forward the format that will be used for sharded data, but not yet actually sharding it.
Previous EIPs were all a solution of category (i); this EIP is a solution of category (ii).&lt;&#x2F;p&gt;
&lt;p&gt;The main tradeoff in designing this EIP is that of implementing more now versus having to implement more later:
do we implement 25% of the work on the way to full sharding, or 50%, or 75%?&lt;&#x2F;p&gt;
&lt;p&gt;The work that is already done in this EIP includes:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A new transaction type, of the exact same format that will need to exist in &quot;full sharding&quot;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;All&lt;&#x2F;em&gt; of the execution-layer logic required for full sharding&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;All&lt;&#x2F;em&gt; of the execution &#x2F; consensus cross-verification logic required for full sharding&lt;&#x2F;li&gt;
&lt;li&gt;Layer separation between &lt;code&gt;BeaconBlock&lt;&#x2F;code&gt; verification and data availability sampling blobs&lt;&#x2F;li&gt;
&lt;li&gt;Most of the &lt;code&gt;BeaconBlock&lt;&#x2F;code&gt; logic required for full sharding&lt;&#x2F;li&gt;
&lt;li&gt;A self-adjusting independent base fee for blobs&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The work that remains to be done to get to full sharding includes:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A low-degree extension of the &lt;code&gt;commitments&lt;&#x2F;code&gt; in the consensus layer to allow 2D sampling&lt;&#x2F;li&gt;
&lt;li&gt;An actual implementation of data availability sampling&lt;&#x2F;li&gt;
&lt;li&gt;PBS (proposer&#x2F;builder separation), to avoid requiring individual validators to process 32 MB of data in one slot&lt;&#x2F;li&gt;
&lt;li&gt;Proof of custody or similar in-protocol requirement for each validator to verify a particular part of the sharded data in each block&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This EIP also sets the stage for longer-term protocol cleanups. For example, its (cleaner) gas base fee update rule could be applied to the primary basefee calculation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;how-rollups-would-function&quot;&gt;How rollups would function&lt;&#x2F;h3&gt;
&lt;p&gt;Instead of putting rollup block data in transaction calldata, rollups would expect rollup block submitters
to put the data into blobs. This guarantees availability (which is what rollups need) but would be much cheaper than calldata.
Rollups need data to be available once, long enough to ensure honest actors can construct the rollup state, but not forever.&lt;&#x2F;p&gt;
&lt;p&gt;Optimistic rollups only need to actually provide the underlying data when fraud proofs are being submitted.
The fraud proof can verify the transition in smaller steps, loading at most a few values of the blob at a time through calldata.
For each value it would provide a KZG proof and use the point evaluation precompile to verify the value against the versioned hash that was submitted before,
and then perform the fraud proof verification on that data as is done today.&lt;&#x2F;p&gt;
&lt;p&gt;ZK rollups would provide two commitments to their transaction or state delta data:
the blob commitment (which the protocol ensures points to available data) and the ZK rollup&#x27;s own commitment using whatever proof system the rollup uses internally.
They would use a proof of equivalence protocol, using the point evaluation precompile,
to prove that the two commitments refer to the same data.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;versioned-hashes-precompile-return-data&quot;&gt;Versioned hashes &amp;amp; precompile return data&lt;&#x2F;h3&gt;
&lt;p&gt;We use versioned hashes (rather than commitments) as references to blobs in the execution layer to ensure forward compatibility with future changes.
For example, if we need to switch to Merkle trees + STARKs for quantum-safety reasons, then we would add a new version,
allowing the point evaluation precompile to work with the new format.
Rollups would not have to make any EVM-level changes to how they work;
sequencers would simply have to switch over to using a new transaction type at the appropriate time.&lt;&#x2F;p&gt;
&lt;p&gt;However, the point evaluation happens inside a finite field, and it is only well defined if the field modulus is known. Smart contracts could contain a table mapping the commitment version to a modulus, but this would not allow smart contract to take into account future upgrades to a modulus that is not known yet. By allowing access to the modulus inside the EVM, the smart contract can be built so that it can use future commitments and proofs, without ever needing an upgrade.&lt;&#x2F;p&gt;
&lt;p&gt;In the interest of not adding another precompile, we return the modulus and the polynomial degree directly from the point evaluation precompile. It can then be used by the caller. It is also &quot;free&quot; in that the caller can just ignore this part of the return value without incurring an extra cost -- systems that remain upgradable for the foreseeable future will likely use this route for now.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;base-fee-per-blob-gas-update-rule&quot;&gt;Base fee per blob gas update rule&lt;&#x2F;h3&gt;
&lt;p&gt;The base fee per blob gas update rule is intended to approximate the formula &lt;code&gt;base_fee_per_blob_gas = MIN_BASE_FEE_PER_BLOB_GAS * e**(excess_blob_gas &#x2F; BLOB_BASE_FEE_UPDATE_FRACTION)&lt;&#x2F;code&gt;,
where &lt;code&gt;excess_blob_gas&lt;&#x2F;code&gt; is the total &quot;extra&quot; amount of blob gas that the chain has consumed relative to the &quot;targeted&quot; number (&lt;code&gt;TARGET_BLOB_GAS_PER_BLOCK&lt;&#x2F;code&gt; per block).
Like EIP-1559, it&#x27;s a self-correcting formula: as the excess goes higher, the &lt;code&gt;base_fee_per_blob_gas&lt;&#x2F;code&gt; increases exponentially, reducing usage and eventually forcing the excess back down.&lt;&#x2F;p&gt;
&lt;p&gt;The block-by-block behavior is roughly as follows.
If block &lt;code&gt;N&lt;&#x2F;code&gt; consumes &lt;code&gt;X&lt;&#x2F;code&gt; blob gas, then in block &lt;code&gt;N+1&lt;&#x2F;code&gt; &lt;code&gt;excess_blob_gas&lt;&#x2F;code&gt; increases by &lt;code&gt;X - TARGET_BLOB_GAS_PER_BLOCK&lt;&#x2F;code&gt;,
and so the &lt;code&gt;base_fee_per_blob_gas&lt;&#x2F;code&gt; of block &lt;code&gt;N+1&lt;&#x2F;code&gt; increases by a factor of &lt;code&gt;e**((X - TARGET_BLOB_GAS_PER_BLOCK) &#x2F; BLOB_BASE_FEE_UPDATE_FRACTION)&lt;&#x2F;code&gt;.
Hence, it has a similar effect to the existing EIP-1559, but is more &quot;stable&quot; in the sense that it responds in the same way to the same total usage regardless of how it&#x27;s distributed.&lt;&#x2F;p&gt;
&lt;p&gt;The parameter &lt;code&gt;BLOB_BASE_FEE_UPDATE_FRACTION&lt;&#x2F;code&gt; controls the maximum rate of change of the base fee per blob gas. It is chosen to target a maximum change rate of &lt;code&gt;e**(TARGET_BLOB_GAS_PER_BLOCK &#x2F; BLOB_BASE_FEE_UPDATE_FRACTION) ≈ 1.125&lt;&#x2F;code&gt; per block.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;throughput&quot;&gt;Throughput&lt;&#x2F;h3&gt;
&lt;p&gt;The values for &lt;code&gt;TARGET_BLOB_GAS_PER_BLOCK&lt;&#x2F;code&gt; and &lt;code&gt;MAX_BLOB_GAS_PER_BLOCK&lt;&#x2F;code&gt; are chosen to correspond to a target of 3 blobs (0.375 MB) and maximum of 6 blobs (0.75 MB) per block. These small initial limits are intended to minimize the strain on the network created by this EIP and are expected to be increased in future upgrades as the network demonstrates reliability under larger blocks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;blob-non-accessibility&quot;&gt;Blob non-accessibility&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP introduces a transaction type that has a distinct mempool version and execution-payload version,
with only one-way convertibility between the two. The blobs are in the network representation and not in the consensus representation;
instead, they are coupled with the beacon block. This means that there is now a part of a transaction that will not be accessible from the web3 API.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;mempool-issues&quot;&gt;Mempool issues&lt;&#x2F;h3&gt;
&lt;p&gt;Blob transactions have a large data size at the mempool layer, which poses a mempool DoS risk,
though not an unprecedented one as this also applies to transactions with large amounts of calldata.&lt;&#x2F;p&gt;
&lt;p&gt;By only broadcasting announcements for blob transactions, receiving nodes will have control over which and how many transactions to receive,
allowing them to throttle throughput to an acceptable level.
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5793&#x2F;&quot;&gt;EIP-5793&lt;&#x2F;a&gt; will give further fine-grained control to nodes by extending the &lt;code&gt;NewPooledTransactionHashes&lt;&#x2F;code&gt; announcement messages to include the transaction type and size.&lt;&#x2F;p&gt;
&lt;p&gt;In addition, we recommend including a 1.1x base fee per blob gas bump requirement to the mempool transaction replacement rules.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Execution layer test cases for this EIP can be found in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;execution-spec-tests&#x2F;tree&#x2F;1983444bbe1a471886ef7c0e82253ffe2a4053e1&#x2F;tests&#x2F;cancun&#x2F;eip4844_blobs&quot;&gt;&lt;code&gt;eip4844_blobs&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; of the &lt;code&gt;ethereum&#x2F;execution-spec-tests&lt;&#x2F;code&gt; repository. Consensus layer test cases can be found &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;tree&#x2F;2297c09b7e457a13f7b2261a28cb45777be82f83&#x2F;tests&#x2F;core&#x2F;pyspec&#x2F;eth2spec&#x2F;test&#x2F;deneb&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP increases the bandwidth requirements per beacon block by a maximum of ~0.75 MB.
This is 40% larger than the theoretical maximum size of a block today (30M gas &#x2F; 16 gas per calldata byte = 1.875M bytes), and so it will not greatly increase worst-case bandwidth.
Post-merge, block times are static rather than an unpredictable Poisson distribution, giving a guaranteed period of time for large blocks to propagate.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;em&gt;sustained&lt;&#x2F;em&gt; load of this EIP is much lower than alternatives that reduce calldata costs, even if the calldata is limited,
because there is no expectation that the blobs need to be stored for as long as an execution payload.
This makes it possible to implement a policy that these blobs must be kept for at least a certain period. The specific value chosen is &lt;code&gt;MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS&lt;&#x2F;code&gt; epochs, which is around 18 days,
a much shorter delay compared to proposed (but yet to be implemented) one-year rotation times for execution payload history.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Hierarchical Domains</title>
        <published>2022-02-22T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Gavin John</name><uri>https://github.com/Pandapip1</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4834/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-4834-hierarchical-domains-standard/8388" />
        

        <id>https://wg-eips.ritovision.com/4834/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:4834"
            label="ERC-4834" />
        

        
        

        
        <summary type="html">Extremely generic name resolution</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4834/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This is a standard for generic name resolution with arbitrarily complex access control and resolution. It permits a contract that implements this EIP (referred to as a &quot;domain&quot; hereafter) to be addressable with a more human-friendly name, with a similar purpose to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;137&#x2F;&quot;&gt;ERC-137&lt;&#x2F;a&gt; (also known as &quot;ENS&quot;).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The advantage of this EIP over existing standards is that it provides a minimal interface that supports name resolution, adds standardized access control, and has a simple architecture. ENS, although useful, has a comparatively complex architecture and does not have standard access control.&lt;&#x2F;p&gt;
&lt;p&gt;In addition, all domains (including subdomains, TLDs, and even the root itself) are actually implemented as domains, meaning that name resolution is a simple iterative algorithm, not unlike DNS itself.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;contract-interface&quot;&gt;Contract Interface&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IDomain&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     Query if a domain has a subdomain with a given name&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      name&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The subdomain to query, in right to left order&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     `true` if the domain has a subdomain with the given name, `false` otherwise&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; hasDomain&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     Fetch the subdomain with a given name&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;        This should revert if `hasDomain(name)` is `false`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      name&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The subdomain to fetch, in right to left order&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;     The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; subdomain with the given name&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getDomain&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;name-resolution&quot;&gt;Name Resolution&lt;&#x2F;h3&gt;
&lt;p&gt;To resolve a name (like &lt;code&gt;&quot;a.b.c&quot;&lt;&#x2F;code&gt;), split it by the delimiter (resulting in something like &lt;code&gt;[&quot;a&quot;, &quot;b&quot;, &quot;c&quot;]&lt;&#x2F;code&gt;). Set &lt;code&gt;domain&lt;&#x2F;code&gt; initially to the root domain, and &lt;code&gt;path&lt;&#x2F;code&gt; to be an empty list.&lt;&#x2F;p&gt;
&lt;p&gt;Pop off the last element of the array (&lt;code&gt;&quot;c&quot;&lt;&#x2F;code&gt;) and add it to the path, then call &lt;code&gt;domain.hasDomain(path)&lt;&#x2F;code&gt;. If it&#x27;s &lt;code&gt;false&lt;&#x2F;code&gt;, then the domain resolution fails. Otherwise, set the domain to &lt;code&gt;domain.getDomain(path)&lt;&#x2F;code&gt;. Repeat until the list of split segments is empty.&lt;&#x2F;p&gt;
&lt;p&gt;There is no limit to the amount of nesting that is possible. For example, &lt;code&gt;0.1.2.3.4.5.6.7.8.9.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z&lt;&#x2F;code&gt; would be valid if the root contains &lt;code&gt;z&lt;&#x2F;code&gt;, and &lt;code&gt;z&lt;&#x2F;code&gt; contains &lt;code&gt;y&lt;&#x2F;code&gt;, and so on.&lt;&#x2F;p&gt;
&lt;p&gt;Here is a solidity function that resolves a name:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; resolve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; splitName&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; IDomain&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; root&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    IDomain current &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; root&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; path &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; splitName&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Append to back of list&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        path&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;push&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;splitName&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Require that the current domain has a domain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;current&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;hasDomain&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;path&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Name resolution failed&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Resolve subdomain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        current &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; current&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getDomain&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;path&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; current&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;optional-extension-registerable&quot;&gt;Optional Extension: Registerable&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IDomainRegisterable&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IDomain&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; Events&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     Must be emitted when a new subdomain is created (e.g. through `createDomain`)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; msg.sender for createDomain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      name&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; name for createDomain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      subdomain&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; subdomain in createDomain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SubdomainCreate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; subdomain&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     Must be emitted when the resolved address for a domain is &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; (e.g. with `setDomain`)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; msg.sender for setDomain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      name&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; name for setDomain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      subdomain&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; subdomain in setDomain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      oldSubdomain&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the old subdomain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SubdomainUpdate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; subdomain&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; oldSubdomain&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     Must be emitted when a domain is unmapped (e.g. with `deleteDomain`)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; msg.sender for deleteDomain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      name&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; name for deleteDomain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      subdomain&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the old subdomain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SubdomainDelete&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; subdomain&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; CRUD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     Create a subdomain with a given name&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;        This should revert if `canCreateDomain(msg.sender, name, pointer)` is `false` or if the domain exists&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      name&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The subdomain name to be created&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      subdomain&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The subdomain to create&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; createDomain&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; subdomain&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     Update a subdomain with a given name&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;        This should revert if `canSetDomain(msg.sender, name, pointer)` is `false` of if the domain doesn&amp;#39;t exist&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      name&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The subdomain name to be updated&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      subdomain&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The subdomain to set&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setDomain&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; subdomain&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     Delete the subdomain with a given name&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;        This should revert if the domain doesn&amp;#39;t exist or if `canDeleteDomain(msg.sender, name)` is `false`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      name&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The subdomain to delete&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; deleteDomain&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; Parent Domain Access Control&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     Get if an account can create a subdomain with a given name&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;        This must return `false` if `hasDomain(name)` is `true`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      updater&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The account that may or may not be able to create&#x2F;update a subdomain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      name&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The subdomain name that would be created&#x2F;updated&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      subdomain&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The subdomain that would be set&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;     Whether&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; an account can update or create the subdomain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; canCreateDomain&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; updater&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; subdomain&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     Get if an account can update or create a subdomain with a given name&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;        This must return `false` if `hasDomain(name)` is `false`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;             If `getDomain(name)` is also a domain implementing the subdomain access control extension, this should return `false` if `getDomain(name).canMoveSubdomain(msg.sender, this, subdomain)` is `false`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      updater&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The account that may or may not be able to create&#x2F;update a subdomain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      name&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The subdomain name that would be created&#x2F;updated&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      subdomain&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The subdomain that would be set&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;     Whether&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; an account can update or create the subdomain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; canSetDomain&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; updater&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; subdomain&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     Get if an account can delete the subdomain with a given name&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;        This must return `false` if `hasDomain(name)` is `false`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;             If `getDomain(name)` is a domain implementing the subdomain access control extension, this should return `false` if `getDomain(name).canDeleteSubdomain(msg.sender, this, subdomain)` is `false`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      updater&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The account that may or may not be able to delete a subdomain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      name&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The subdomain to delete&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;     Whether&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; an account can delete the subdomain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; canDeleteDomain&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; updater&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;optional-extension-enumerable&quot;&gt;Optional Extension: Enumerable&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IDomainEnumerable&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IDomain&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     Query all subdomains. Must revert if the number of domains is unknown or infinite.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;     The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; subdomain with the given index.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; subdomainByIndex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     Get the total number of subdomains. Must revert if the number of domains is unknown or infinite.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;     The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; total number of subdomains.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalSubdomains&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;optional-extension-access-control&quot;&gt;Optional Extension: Access Control&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IDomainAccessControl&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IDomain&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     Get if an account can move the subdomain away from the current domain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;        May be called by `canSetDomain` of the parent domain - implement access control here!!!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      updater&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The account that may be moving the subdomain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      name&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The subdomain name&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      parent&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The parent domain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      newSubdomain&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The domain that will be set next&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;     Whether&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; an account can update the subdomain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; canMoveSubdomain&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; updater&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; IDomain&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newSubdomain&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     Get if an account can unset this domain as a subdomain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;        May be called by `canDeleteDomain` of the parent domain - implement access control here!!!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      updater&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The account that may or may not be able to delete a subdomain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      name&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The subdomain to delete&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      parent&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The parent domain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;     Whether&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; an account can delete the subdomain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; canDeleteSubdomain&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; updater&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; IDomain&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP&#x27;s goal, as mentioned in the abstract, is to have a simple interface for resolving names. Here are a few design decisions and why they were made:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Name resolution algorithm
&lt;ul&gt;
&lt;li&gt;Unlike ENS&#x27;s resolution algorithm, this EIP&#x27;s name resolution is fully under the control of the contracts along the resolution path.&lt;&#x2F;li&gt;
&lt;li&gt;This behavior is more intuitive to users.&lt;&#x2F;li&gt;
&lt;li&gt;This behavior allows for greater flexibility - e.g. a contract that changes what it resolves to based on the time of day.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Parent domain access control
&lt;ul&gt;
&lt;li&gt;A simple &quot;ownable&quot; interface was not used because this specification was designed to be as generic as possible. If an ownable implementation is desired, it can be implemented.&lt;&#x2F;li&gt;
&lt;li&gt;This also gives parent domains the ability to call subdomains&#x27; access control methods so that subdomains, too, can choose whatever access control mechanism they desire&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Subdomain access control
&lt;ul&gt;
&lt;li&gt;These methods are included so that subdomains aren&#x27;t always limited to their parent domain&#x27;s access control&lt;&#x2F;li&gt;
&lt;li&gt;The root domain can be controlled by a DAO with a non-transferable token with equal shares, a TLD can be controlled by a DAO with a token representing stake, a domain of that TLD can be controlled by a single owner, a subdomain of that domain can be controlled by a single owner linked to an NFT, and so on.&lt;&#x2F;li&gt;
&lt;li&gt;Subdomain access control functions are suggestions: an ownable domain might implement an owner override, so that perhaps subdomains might be recovered if the keys are lost.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is general enough to support ENS, but ENS is not general enough to support this EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;malicious-canmovesubdomain-black-hole&quot;&gt;Malicious canMoveSubdomain (Black Hole)&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;description-malicious-canmovesubdomain&quot;&gt;Description: Malicious &lt;code&gt;canMoveSubdomain&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Moving a subdomain using &lt;code&gt;setDomain&lt;&#x2F;code&gt; is a potentially dangerous operation.&lt;&#x2F;p&gt;
&lt;p&gt;Depending on the parent domain&#x27;s implementation, if a malicious new subdomain unexpectedly returns &lt;code&gt;false&lt;&#x2F;code&gt; on &lt;code&gt;canMoveSubdomain&lt;&#x2F;code&gt;, that subdomain can effectively lock the ownership of the domain.&lt;&#x2F;p&gt;
&lt;p&gt;Alternatively, it might return &lt;code&gt;true&lt;&#x2F;code&gt; when it isn&#x27;t expected (i.e. a backdoor), allowing the contract owner to take over the domain.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;mitigation-malicious-canmovesubdomain&quot;&gt;Mitigation: Malicious &lt;code&gt;canMoveSubdomain&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Clients should help by warning if &lt;code&gt;canMoveSubdomain&lt;&#x2F;code&gt; or &lt;code&gt;canDeleteSubdomain&lt;&#x2F;code&gt; for the new subdomain changes to &lt;code&gt;false&lt;&#x2F;code&gt;. It is important to note, however, that since these are functions, it is possible for the value to change depending on whether or not it has already been linked. It is also still possible for it to unexpectedly return true. It is therefore recommended to &lt;strong&gt;always&lt;&#x2F;strong&gt; audit the new subdomain&#x27;s source code before calling &lt;code&gt;setDomain&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parent-domain-resolution&quot;&gt;Parent Domain Resolution&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;description-parent-domain-resolution&quot;&gt;Description: Parent Domain Resolution&lt;&#x2F;h4&gt;
&lt;p&gt;Parent domains have full control of name resolution for their subdomains. If a particular domain is linked to &lt;code&gt;a.b.c&lt;&#x2F;code&gt;, then &lt;code&gt;b.c&lt;&#x2F;code&gt; can, depending on its code, set &lt;code&gt;a.b.c&lt;&#x2F;code&gt; to any domain, and &lt;code&gt;c&lt;&#x2F;code&gt; can set &lt;code&gt;b.c&lt;&#x2F;code&gt; itself to any domain.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;mitigation-parent-domain-resolution&quot;&gt;Mitigation: Parent Domain Resolution&lt;&#x2F;h4&gt;
&lt;p&gt;Before acquiring a domain that has been pre-linked, it is recommended to always have the contract &lt;strong&gt;and&lt;&#x2F;strong&gt; all the parents up to the root audited.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Common Interfaces for DAOs</title>
        <published>2022-02-17T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Joshua Tan</name><uri>https://github.com/thelastjosh</uri>
	</author>
	
	<author>
		<name>Isaac Patka</name><uri>https://github.com/ipatka</uri>
	</author>
	
	<author>
		<name>Ido Gershtein</name><email>ido@daostack.io</email>
	</author>
	
	<author>
		<name>Eyal Eithcowich</name><email>eyal@deepdao.io</email>
	</author>
	
	<author>
		<name>Michael Zargham</name><uri>https://github.com/mzargham</uri>
	</author>
	
	<author>
		<name>Sam Furter</name><uri>https://github.com/nivida</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4824/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-4824-decentralized-autonomous-organizations/8362" />
        

        <id>https://wg-eips.ritovision.com/4824/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        

        
        <category
            term="tag:eip:4824"
            label="ERC-4824" />
        

        
        

        
        <summary type="html">An API for decentralized autonomous organizations (DAOs).</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4824/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;An API standard for decentralized autonomous organizations (DAOs), focused on relating on-chain and off-chain representations of membership and proposals.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;DAOs, since being invoked in the Ethereum whitepaper, have been vaguely defined. This has led to a wide range of patterns but little standardization or interoperability between the frameworks and tools that have emerged. Standardization and interoperability are necessary to support a variety of use-cases. In particular, a standard daoURI, similar to tokenURI in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;, will enhance DAO discoverability, legibility, proposal simulation, and interoperability between tools. More consistent data across the ecosystem is also a prerequisite for future DAO standards.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;Every contract implementing this EIP MUST implement the &lt;code&gt;IERC4824&lt;&#x2F;code&gt; interface below:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-4824 DAOs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See &amp;lt;https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-4824&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC4824&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DAOURIUpdate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; daoAddress&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; daoURI&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A distinct Uniform Resource Identifier (URI) pointing to a JSON object following the &amp;quot;ERC-4824 DAO JSON-LD Schema&amp;quot;. This JSON file splits into four subsidiary URIs: membersURI, proposalsURI, activityLogURI, and governanceURI. The membersURI SHOULD point to a JSON file that conforms to the &amp;quot;ERC-4824 Members JSON-LD Schema&amp;quot;. The proposalsURI SHOULD point to a JSON file that conforms to the &amp;quot;ERC-4824 Proposals JSON-LD Schema&amp;quot;. The activityLogURI SHOULD point to a JSON file that conforms to the &amp;quot;ERC-4824 Activity Log JSON-LD Schema&amp;quot;. The governanceURI SHOULD point to a flatfile, normatively a .md file. Each of the JSON files named above MAY be statically-hosted or dynamically-generated. The content of subsidiary JSON files MAY be directly embedded as a JSON object directly within the top-level DAO JSON, in which case the relevant field MUST be renamed to remove the &amp;quot;URI&amp;quot; suffix. For example, &amp;quot;membersURI&amp;quot; would be renamed to &amp;quot;members&amp;quot;, &amp;quot;proposalsURI&amp;quot; would be renamed to &amp;quot;proposals&amp;quot;, and so on.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; daoURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _daoURI&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The DAO JSON-LD Schema mentioned above:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;@context&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;http:&#x2F;&#x2F;www.daostar.org&#x2F;schemas&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;DAO&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;name of the DAO&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;description&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;membersURI&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;URI&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;proposalsURI&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;URI&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;activityLogURI&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;URI&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;governanceURI&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;URI&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;contractsURI&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;URI&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;A DAO MAY inherit the &lt;code&gt;IERC4824&lt;&#x2F;code&gt; interface above or it MAY create an external registration contract that is compliant with this EIP. Whether the DAO inherits the above interface or it uses an external registration contract, the DAO SHOULD define a method for and implement some access control logic to enable efficient updating for daoURI. If a DAO creates an external registration contract, the registration contract MUST store the DAO’s primary address, typically the address of the primary governance contract. See the reference implementation of external registration contract in the attached assets folder to this EIP.&lt;&#x2F;p&gt;
&lt;p&gt;When reporting information in the DAO JSON-LD Schema, if a given field has no value (for example, &lt;code&gt;description&lt;&#x2F;code&gt;), it SHOULD be removed rather than left with an empty or &lt;code&gt;null&lt;&#x2F;code&gt; value.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;indexing&quot;&gt;Indexing&lt;&#x2F;h3&gt;
&lt;p&gt;If a DAO inherits the &lt;code&gt;IERC4824&lt;&#x2F;code&gt; interface from a 4824-compliant DAO factory, then the DAO factory SHOULD incorporate a call to an indexer contract as part of the DAO&#x27;s initialization to enable efficient network indexing. If the DAO is &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt;-compliant, the factory can do this without additional permissions. If the DAO is &lt;em&gt;not&lt;&#x2F;em&gt; compliant with ERC-165, the factory SHOULD first obtain access control rights to the indexer contract and then call &lt;code&gt;logRegistration&lt;&#x2F;code&gt; directly with the address of the new DAO and the daoURI of the new DAO. Note that any user, including the DAO itself, MAY call &lt;code&gt;logRegistration&lt;&#x2F;code&gt; and submit a registration for a DAO which inherits the &lt;code&gt;IERC4824&lt;&#x2F;code&gt; interface and which is also ERC-165-compliant.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC4824InterfaceNotSupported&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC4824Index&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AccessControl&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    using&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC165Checker&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; REGISTRATION_ROLE &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;REGISTRATION_ROLE&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DAOURIRegistered&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; daoAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _grantRole&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;DEFAULT_ADMIN_ROLE&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _grantRole&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;REGISTRATION_ROLE&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; logRegistrationPermissioned&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; daoAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyRole&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;REGISTRATION_ROLE&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DAOURIRegistered&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;daoAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; logRegistration&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; daoAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;daoAddress&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;IERC4824&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC4824InterfaceNotSupported&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DAOURIRegistered&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;daoAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;If a DAO uses an external registration contract, the DAO SHOULD use a common registration factory contract linked to a common indexer to enable efficient network indexing. See the reference implementation of the factory contract in the attached assets folder to this EIP.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;indexing-priority&quot;&gt;Indexing priority&lt;&#x2F;h4&gt;
&lt;p&gt;daoURIs may be published directly in the DAO&#x27;s contract or through a call to a common registration factory contract. In cases where both occur, the daoURI (and all sub-URIs) published through a call to a registration factory contract SHOULD take precedence. If there are multiple registrations, the most recent registration SHOULD take precedence.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;members&quot;&gt;Members&lt;&#x2F;h3&gt;
&lt;p&gt;Members JSON-LD Schema. Every contract implementing this EIP SHOULD implement a membersURI pointing to a JSON object satisfying this schema. Below, DID refers to &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.w3.org&#x2F;TR&#x2F;2022&#x2F;REC-did-core-20220719&#x2F;&quot;&gt;Decentralized Identifiers&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;@context&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;www.daostar.org&#x2F;schemas&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;DAO&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;members&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;CAIP-10 address, DID address, or other URI identifier&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;CAIP-10 address, DID address, or other URI identifier&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;For example, for an address on Ethereum Mainnet, the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ChainAgnostic&#x2F;CAIPs&#x2F;blob&#x2F;ad0cfebc45a4b8368628340bf22aefb2a5edcab7&#x2F;CAIPs&#x2F;caip-10.md&quot;&gt;CAIP-10&lt;&#x2F;a&gt; address would be of the form &lt;code&gt;eip155:1:0x1234abcd&lt;&#x2F;code&gt;, while the DID address would be of the form &lt;code&gt;did:ethr:0x1234abcd&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;proposals&quot;&gt;Proposals&lt;&#x2F;h3&gt;
&lt;p&gt;Proposals JSON-LD Schema. Every contract implementing this EIP SHOULD implement a proposalsURI pointing to a JSON object satisfying this schema.&lt;&#x2F;p&gt;
&lt;p&gt;In particular, any on-chain proposal MUST be associated to an id of the form CAIP10_ADDRESS + “?proposalId=” + PROPOSAL_COUNTER, where CAIP10_ADDRESS is an address following the CAIP-10 standard and PROPOSAL_COUNTER is an arbitrary identifier such as a uint256 counter or a hash that is locally unique per CAIP-10 address. Off-chain proposals MAY use a similar id format where CAIP10_ADDRESS is replaced with an appropriate URI or URL.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;@context&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;www.daostar.org&#x2F;schemas&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;proposals&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;proposal&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;proposal ID&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;name or title of proposal&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;contentURI&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;URI to content&#x2F;text of the proposal&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;discussionURI&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;URI to discussion or thread for the proposal&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;status&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;status of proposal&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;calls&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;CallDataEVM&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;operation&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;call or delegate call&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;from&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;EthereumAddress&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;EthereumAddress&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;value&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;call data&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;When deferenced, contentURI should return the content (i.e. the text) of the proposal. Similarly, discussionURI should return a discussion link, whether a forum post, Discord channel, or Twitter thread.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;activity-log&quot;&gt;Activity Log&lt;&#x2F;h3&gt;
&lt;p&gt;Activity Log JSON-LD Schema. Every contract implementing this EIP SHOULD implement a activityLogURI pointing to a JSON object satisfying this schema.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;@context&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;www.daostar.org&#x2F;schemas&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;activities&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;activity ID&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;activity&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;proposal&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;proposal&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;proposal ID&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;member&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;CAIP-10 address, DID address, or other URI identifier&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;contracts&quot;&gt;Contracts&lt;&#x2F;h3&gt;
&lt;p&gt;Contracts JSON-LD Schema. Every contract implementing this EIP SHOULD implement a contractsURI pointing to a JSON object satisfying this schema.&lt;&#x2F;p&gt;
&lt;p&gt;contractsURI is especially important for DAOs with distinct or decentralized governance occurring across multiple different contracts, possibly across several chains. Multiple addresses may report the same daoURI.&lt;&#x2F;p&gt;
&lt;p&gt;To prevent spam or spoofing, all DAOs adopting this specification SHOULD publish through contractsURI the address of every contract associated to the DAO, including but not limited to those that inherit the &lt;code&gt;IERC4824&lt;&#x2F;code&gt; interface or those that interact with a registration factory contract. Note that this includes the contract address(es) of any actual registration contracts deployed through a registration factory.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;@context&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;www.daostar.org&#x2F;schemas&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;contracts&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;CAIP-10 address, DID address, or other URI identifier&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;name, e.g. Treasury&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;description, e.g. Primary operating treasury for the DAO&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;CAIP-10 address, DID address, or other URI identifier&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;name, e.g. Governance Token&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;description, e.g. ERC20 governance token contract&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;CAIP-10 address, DID address, or other URI identifier&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;name, e.g. Registration Contract&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;description, e.g. ERC-4824 registration contract&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;uri-fields&quot;&gt;URI fields&lt;&#x2F;h3&gt;
&lt;p&gt;The content of subsidiary JSON files MAY be directly embedded as a JSON object directly within the top-level DAO JSON, in which case the relevant field MUST be renamed to remove the &quot;URI&quot; suffix. For example, &lt;code&gt;membersURI&lt;&#x2F;code&gt; would be renamed to &lt;code&gt;members&lt;&#x2F;code&gt;, &lt;code&gt;proposalsURI&lt;&#x2F;code&gt; would be renamed to &lt;code&gt;proposals&lt;&#x2F;code&gt;, and so on. In all cases, the embedded JSON object MUST conform to the relevant schema. A given field and a URI-suffixed field (e.g. &lt;code&gt;membersURI&lt;&#x2F;code&gt; and &lt;code&gt;members&lt;&#x2F;code&gt;) SHOULD NOT appear in the same JSON-LD; if they do, the field without the URI suffix MUST take precedence.&lt;&#x2F;p&gt;
&lt;p&gt;Fields which are not appended with URI MAY be appended with a URI, for example &lt;code&gt;name&lt;&#x2F;code&gt; and &lt;code&gt;description&lt;&#x2F;code&gt; may be renamed to &lt;code&gt;nameURI&lt;&#x2F;code&gt; and &lt;code&gt;descriptionURI&lt;&#x2F;code&gt;, in which case the dereferenced URI MUST return a JSON-LD object containing the &lt;code&gt;&quot;@context&quot;: &quot;https:&#x2F;&#x2F;www.daostar.org&#x2F;schemas&quot;&lt;&#x2F;code&gt; field and the original key-value pair.&lt;&#x2F;p&gt;
&lt;p&gt;For example, descriptionURI should return:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;@context&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;www.daostar.org&#x2F;schemas&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;description&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;entities-which-are-not-daos&quot;&gt;Entities which are not DAOs&lt;&#x2F;h3&gt;
&lt;p&gt;Entities which are not DAOs or which do not wish to identify as DAOs MAY still publish daoURIs. If so, they SHOULD use a different value for the &lt;code&gt;type&lt;&#x2F;code&gt; field than &quot;DAO&quot;, for example &quot;Organization&quot;, &quot;Foundation&quot;, &quot;Person&quot;, or, most broadly, &quot;Entity&quot;.&lt;&#x2F;p&gt;
&lt;p&gt;Entities which are not DAOs or which do not wish to identify as DAOs MAY also publish metadata information through an off-chain orgURI or entityURI, which are aliases of daoURI. If these entities are reporting their URI through an on-chain smart contract or registration, however, they MUST retain &lt;code&gt;IERC4824&lt;&#x2F;code&gt;&#x27;s daoURI in order to enable network indexing.&lt;&#x2F;p&gt;
&lt;p&gt;The Entity JSON-LD Schema:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;@context&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;www.daostar.org&#x2F;schemas&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;type of entity&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;name of the entity&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;description&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;membersURI&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;URI&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;proposalsURI&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;URI&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;activityLogURI&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;URI&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;governanceURI&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;URI&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;contractsURI&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;URI&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;In this standard, we assume that all DAOs possess at least two primitives: &lt;em&gt;membership&lt;&#x2F;em&gt; and &lt;em&gt;behavior&lt;&#x2F;em&gt;. &lt;em&gt;Membership&lt;&#x2F;em&gt; is defined by a set of addresses. &lt;em&gt;Behavior&lt;&#x2F;em&gt; is defined by a set of possible contract actions, including calls to external contracts and calls to internal functions. &lt;em&gt;Proposals&lt;&#x2F;em&gt; relate membership and behavior; they are objects that members can interact with and which, if and when executed, become behaviors of the DAO.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;apis-uris-and-off-chain-data&quot;&gt;APIs, URIs, and off-chain data&lt;&#x2F;h3&gt;
&lt;p&gt;DAOs themselves have a number of existing and emerging use-cases. But almost all DAOs need to publish data off-chain for a number of reasons: communicating to and recruiting members, coordinating activities, powering user interfaces and governance applications such as Snapshot or Tally, or enabling search and discovery via platforms like DeepDAO, Messari, and Etherscan. Having a standardized schema for this data organized across multiple URIs, i.e. an API specification, would strengthen existing use-cases for DAOs, help scale tooling and frameworks across the ecosystem, and build support for additional forms of interoperability.&lt;&#x2F;p&gt;
&lt;p&gt;While we considered standardizing on-chain aspects of DAOs in this standard, particularly on-chain proposal objects and proposal IDs, we felt that this level of standardization was premature given (1) the relative immaturity of use-cases, such as multi-DAO proposals or master-minion contracts, that would benefit from such standardization, (2) the close linkage between proposal systems and governance, which we did not want to standardize (see “governanceURI”, below), and (3) the prevalence of off-chain and L2 voting and proposal systems in DAOs (see “proposalsURI”, below). Further, a standard URI interface is relatively easy to adopt and has been actively demanded by frameworks (see “Community Consensus”, below).&lt;&#x2F;p&gt;
&lt;p&gt;We added the ability to append or remove the URI suffix to make dereferenced daoURIs easier to parse, especially in certain applications that did not want to maintain several services or flatfiles. Where there is a conflict, we decided that fields without the URI suffix should take precedence since they are more directly connected to the initial publication of daoURI.&lt;&#x2F;p&gt;
&lt;p&gt;In terms of indexing: we believe that the most trustworthy way of publishing a daoURI is through an on-chain registration contract, as it is the clearest reflection of the active will of a DAO. It is also the primary way a DAO may “overwrite” any other daoURI that has previously been published, through any means. If a DAO inherits daoURI directly through its contract, then this information is also trustworthy, though slightly less so as it often reflects the decisions of a DAO framework rather than the DAO directly.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;membersuri&quot;&gt;membersURI&lt;&#x2F;h3&gt;
&lt;p&gt;Approaches to membership vary widely in DAOs. Some DAOs and DAO frameworks (e.g. Gnosis Safe, Tribute), maintain an explicit, on-chain set of members, sometimes called owners or stewards. But many DAOs are structured so that membership status is based on the ownership of a token or tokens (e.g. Moloch, Compound, DAOstack, 1Hive Gardens). In these DAOs, computing the list of current members typically requires some form of off-chain indexing of events.&lt;&#x2F;p&gt;
&lt;p&gt;In choosing to ask only for an (off-chain) JSON schema of members, we are trading off some on-chain functionality for more flexibility and efficiency. We expect different DAOs to use membersURI in different ways: to serve a static copy of on-chain membership data, to contextualize the on-chain data (e.g. many Gnosis Safe stewards would not say that they are the only members of the DAO), to serve consistent membership for a DAO composed of multiple contracts, or to point at an external service that computes the list, among many other possibilities. We also expect many DAO frameworks to offer a standard endpoint that computes this JSON file, and we provide a few examples of such endpoints in the implementation section.&lt;&#x2F;p&gt;
&lt;p&gt;We encourage extensions of the Membership JSON-LD Schema, e.g. for DAOs that wish to create a state variable that captures active&#x2F;inactive status or different membership levels.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;proposalsuri&quot;&gt;proposalsURI&lt;&#x2F;h3&gt;
&lt;p&gt;Proposals have become a standard way for the members of a DAO to trigger on-chain actions, e.g. sending out tokens as part of a grant or executing arbitrary code in an external contract. In practice, however, many DAOs are governed by off-chain decision-making systems on platforms such as Discourse, Discord, or Snapshot, where off-chain proposals may function as signaling mechanisms for an administrator or as a prerequisite for a later on-chain vote. (To be clear, on-chain votes may also serve as non-binding signaling mechanisms or as “binding” signals leading to some sort of off-chain execution.) The schema we propose is intended to support both on-chain and off-chain proposals, though DAOs themselves may choose to report only on-chain, only off-chain, or some custom mix of proposal types.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Proposal ID&lt;&#x2F;strong&gt;. In the specification, we state that every unique on-chain proposal must be associated to a proposal ID of the form CAIP10_ADDRESS + “?proposalId=” + PROPOSAL_COUNTER, where PROPOSAL_COUNTER is an arbitrary string which is unique per CAIP10_ADDRESS. Note that PROPOSAL_COUNTER may not be the same as the on-chain representation of the proposal; however, each PROPOSAL_COUNTER should be unique per CAIP10_ADDRESS, such that the proposal ID is a globally unique identifier. We endorse the CAIP-10 standard to support multi-chain &#x2F; layer 2 proposals and the “?proposalId=” query syntax to suggest off-chain usage.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;ContentURI&lt;&#x2F;strong&gt;. In many cases, a proposal will have some (off-chain) content such as a forum post or a description on a voting platform which predates or accompanies the actual proposal.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Status&lt;&#x2F;strong&gt;. Almost all proposals have a status or state, but the actual status is tied to the governance system, and there is no clear consensus between existing DAOs about what those statuses should be (see table below). Therefore, we have defined a “status” property with a generic, free text description field.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Project&lt;&#x2F;th&gt;&lt;th&gt;Proposal Statuses&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Aragon&lt;&#x2F;td&gt;&lt;td&gt;Not specified&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Colony&lt;&#x2F;td&gt;&lt;td&gt;[‘Null’, ‘Staking’, ‘Submit’, ‘Reveal’, ‘Closed’, ‘Finalizable’, ‘Finalized’, ‘Failed’]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Compound&lt;&#x2F;td&gt;&lt;td&gt;[‘Pending’, ‘Active’, ‘Canceled’, ‘Defeated’, ‘Succeeded’, ‘Queued’, ‘Expired’, ‘Executed’]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;DAOstack&#x2F; Alchemy&lt;&#x2F;td&gt;&lt;td&gt;[‘None’, ‘ExpiredInQueue’, ‘Executed’, ‘Queued’, ‘PreBoosted’, ‘Boosted’, ‘QuietEndingPeriod’]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Moloch v2&lt;&#x2F;td&gt;&lt;td&gt;[sponsored, processed, didPass, cancelled, whitelist, guildkick]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Tribute&lt;&#x2F;td&gt;&lt;td&gt;[‘EXISTS’, ‘SPONSORED’, ‘PROCESSED’]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;&lt;strong&gt;ExecutionData&lt;&#x2F;strong&gt;. For on-chain proposals with non-empty execution, we include an array field to expose the call data. The main use-case for this data is execution simulation of proposals.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;activityloguri&quot;&gt;activityLogURI&lt;&#x2F;h3&gt;
&lt;p&gt;The activity log JSON is intended to capture the interplay between a member of a DAO and a given proposal. Examples of activities include the creation&#x2F;submission of a proposal, voting on a proposal, disputing a proposal, and so on.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Alternatives we considered: history, interactions&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;governanceuri&quot;&gt;governanceURI&lt;&#x2F;h3&gt;
&lt;p&gt;Membership, to be meaningful, usually implies rights and affordances of some sort, e.g. the right to vote on proposals, the right to ragequit, the right to veto proposals, and so on. But many rights and affordances of membership are realized off-chain (e.g. right to vote on a Snapshot, gated access to a Discord). Instead of trying to standardize these wide-ranging practices or forcing DAOs to locate descriptions of those rights on-chain, we believe that a flatfile represents the easiest and most widely-acceptable mechanism for communicating what membership means and how proposals work. These flatfiles can then be consumed by services such as Etherscan, supporting DAO discoverability and legibility.&lt;&#x2F;p&gt;
&lt;p&gt;We chose the word “governance” as an appropriate word that reflects (1) the widespread use of the word in the DAO ecosystem and (2) the common practice of emitting a governance.md file in open-source software projects.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Alternative names considered: description, readme, constitution&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;contractsuri&quot;&gt;contractsURI&lt;&#x2F;h3&gt;
&lt;p&gt;Over the course of community conversations, multiple parties raised the need to report on, audit, and index the different contracts belonging to a given DAO. Some of these contracts are deployed as part of the modular design of a single DAO framework, e.g. the core, voting, and timelock contracts within Open Zeppelin &#x2F; Compound Governor. In other cases, a DAO might deploy multiple multsigs as treasuries and&#x2F;or multiple subDAOs that are effectively controlled by the DAO. contractsURI offers a generic way of declaring these many instruments so that they can be efficiently aggregated by an indexer.&lt;&#x2F;p&gt;
&lt;p&gt;contractsURI is also important for spam prevention or spoofing. Some DAOs may spread governance power and control across multiple different governance contracts, possibly across several chains. To capture this reality, multiple addresses may wish to report the same daoURI, or different daoURIs with the same name&lt;!-- or the same ID--&gt;. However, unauthorized addresses may try to report the same daoURI or name&lt;!--, or ID --&gt;. Additional contract information can prevent attacks of this sort by allowing indexers to weed out spam information.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Alternative names considered: contractsRegistry, contractsList&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-json-ld&quot;&gt;Why JSON-LD&lt;&#x2F;h3&gt;
&lt;p&gt;We chose to use JSON-LD rather than the more widespread and simpler JSON standard because (1) we want to support use-cases where a DAO wants to include members using some other form of identification than their Ethereum address and (2) we want this standard to be compatible with future multi-chain standards. Either use-case would require us to implement a context and type for addresses, which is already implemented in JSON-LD.&lt;&#x2F;p&gt;
&lt;p&gt;Further, given the emergence of patterns such as subDAOs and DAOs of DAOs in large organizations such as Synthetix, as well as L2 and multi-chain use-cases, we expect some organizations will point multiple DAOs to the same URI, which would then serve as a gateway to data from multiple contracts and services. The choice of JSON-LD allows for easier extension and management of that data.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;community-consensus&quot;&gt;&lt;strong&gt;Community Consensus&lt;&#x2F;strong&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The initial draft standard was developed as part of the DAOstar roundtable series, which included representatives from all major EVM-based DAO frameworks (Aragon, Compound, DAOstack, Gnosis, Moloch, OpenZeppelin, and Tribute), a wide selection of DAO tooling developers, as well as several major DAOs. Thank you to all the participants of the roundtable. We would especially like to thank Fabien of Snapshot, Jake Hartnell, Auryn Macmillan, Selim Imoberdorf, Lucia Korpas, and Mehdi Salehi for their contributions.&lt;&#x2F;p&gt;
&lt;p&gt;In-person events for community comment were held at Schelling Point 2022, ETHDenver 2022, ETHDenver 2023, DAO Harvard 2023, DAO Stanford 2023 (also known as the Science of Blockchains Conference DAO Workshop). The team also hosted over 50 biweekly community calls as part of the DAOstar project.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Existing contracts that do not wish to use this specification are unaffected. DAOs that wish to adopt the standard without updating or migrating contracts can do so via an external registration contract.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This standard defines the interfaces for the DAO URIs but does not specify the rules under which the URIs are set, or how the data is prepared. Developers implementing this standard should consider how to update this data in a way aligned with the DAO’s governance model, and keep the data fresh in a way that minimizes reliance on centralized service providers.&lt;&#x2F;p&gt;
&lt;p&gt;Indexers that rely on the data returned by the URI should take caution if DAOs return executable code from the URIs. This executable code might be intended to get the freshest information on membership, proposals, and activity log, but it could also be used to run unrelated tasks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Web3 URL to EVM Call Message Translation</title>
        <published>2022-02-14T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Qi Zhou</name><uri>https://github.com/qizhou</uri>
	</author>
	
	<author>
		<name>Chao Pi</name><uri>https://github.com/pichaoqkc</uri>
	</author>
	
	<author>
		<name>Sam Wilson</name><uri>https://github.com/SamWilsn</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4804/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-4804-web3-url-to-evm-call-message-translation/8300" />
        

        <id>https://wg-eips.ritovision.com/4804/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:4804"
            label="ERC-4804" />
        

        
        

        
        <summary type="html">A translation of an HTTP-style Web3 URL to an EVM call message</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4804/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard translates an RFC 2396 URI like &lt;code&gt;web3:&#x2F;&#x2F;uniswap.eth&#x2F;&lt;&#x2F;code&gt; to an EVM message such as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;EVMMessage {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   To: 0xaabbccddee.... &#x2F;&#x2F; where uniswap.eth&amp;#39;s address registered at ENS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   Calldata: 0x&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, reading data from Web3 generally relies on a translation done by a Web2 proxy to Web3 blockchain. The translation is mostly done by the proxies such as dApp websites&#x2F;node service provider&#x2F;etherscan, which are out of the control of users. The standard here aims to provide a simple way for Web2 users to directly access the content of Web3, especially on-chain Web contents such as SVG&#x2F;HTML.  Moreover, this standard enables interoperability with other standards already compatible with URIs, like SVG&#x2F;HTML.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;This specification only defines read-only (i.e. Solidity&#x27;s &lt;code&gt;view&lt;&#x2F;code&gt; functions) semantics. State modifying functions may be defined as a future extension.&lt;&#x2F;p&gt;
&lt;p&gt;A Web3 URL is in the following form&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;web3URL = web3Schema [userinfo &amp;quot;@&amp;quot;] contractName [&amp;quot;:&amp;quot; chainid] path [&amp;quot;?&amp;quot; query]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;web3Schema = [ &amp;quot;ethereum-web3:&#x2F;&#x2F;&amp;quot; | &amp;quot;eth-web3:&#x2F;&#x2F;&amp;quot; | &amp;quot;web3:&#x2F;&#x2F;&amp;quot; ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;contractName = address | [name &amp;quot;.&amp;quot; [ subDomain0 &amp;quot;.&amp;quot; ... ]] nsProviderSuffix&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;path = [&amp;quot;&#x2F;&amp;quot; method [&amp;quot;&#x2F;&amp;quot; argument_0 [&amp;quot;&#x2F;&amp;quot; argument_1 ... ]]]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;argument = [type &amp;quot;!&amp;quot;] value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;query = &amp;quot;attribute_1=value_1 [ &amp;quot;&amp;amp;&amp;quot; attribute_2=value_2 ... ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;attribute = &amp;quot;returns&amp;quot; | &amp;quot;returnTypes&amp;quot; | other_attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;web3Schema&lt;&#x2F;strong&gt; indicates the schema of the URL, which is &lt;code&gt;web3:&#x2F;&#x2F;&lt;&#x2F;code&gt; or &lt;code&gt;w3:&#x2F;&#x2F;&lt;&#x2F;code&gt; for short.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;userinfo&lt;&#x2F;strong&gt; indicates which user is calling the EVM, i.e., &quot;From&quot; field in EVM call message. If not specified, the protocol will use 0x0 as the sender address.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;contractName&lt;&#x2F;strong&gt; indicates the contract to be called, i.e., &quot;To&quot; field in the EVM call message. If the &lt;strong&gt;contractName&lt;&#x2F;strong&gt; is an &lt;strong&gt;address&lt;&#x2F;strong&gt;, i.e., 0x + 20-byte-data hex, then &quot;To&quot; will be the address. Otherwise, the name is from a name service. In the second case, &lt;strong&gt;nsProviderSuffix&lt;&#x2F;strong&gt; will be the suffix from name service providers such as &quot;eth&quot;, etc. The way to translate the name from a name service to an address will be discussed in later EIPs.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;chainid&lt;&#x2F;strong&gt; indicates which chain to resolve &lt;strong&gt;contractName&lt;&#x2F;strong&gt; and call the message. If not specified, the protocol will use the same chain as the name service provider, e.g., 1 for eth. If no name service provider is available, the default chainid is 1.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;query&lt;&#x2F;strong&gt; is an optional component containing a sequence of attribute-value pairs separated by &quot;&amp;amp;&quot;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;resolve-mode&quot;&gt;Resolve Mode&lt;&#x2F;h3&gt;
&lt;p&gt;Once the &quot;To&quot; address and chainid are determined, the protocol will check the resolver mode of contract by calling &quot;resolveMode&quot; method. The protocol currently supports two resolve modes:&lt;&#x2F;p&gt;
&lt;h4 id=&quot;manual-mode&quot;&gt;Manual Mode&lt;&#x2F;h4&gt;
&lt;p&gt;The manual mode will not do any interpretation of &lt;strong&gt;path&lt;&#x2F;strong&gt; and &lt;strong&gt;query&lt;&#x2F;strong&gt;, and put &lt;strong&gt;path&lt;&#x2F;strong&gt; [ &quot;?&quot; &lt;strong&gt;query&lt;&#x2F;strong&gt; ] as the calldata of the message directly.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;auto-mode&quot;&gt;Auto Mode&lt;&#x2F;h4&gt;
&lt;p&gt;The auto mode is the default mode to resolve (also applies when the &quot;resolveMode&quot; method is unavailable in the target contract). In the auto mode, if &lt;strong&gt;path&lt;&#x2F;strong&gt; is empty, then the protocol will call the target contract with empty calldata. Otherwise, the calldata of the EVM message will use standard Solidity contract ABI, where&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;method&lt;&#x2F;strong&gt; is a string of function method be called&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;argument_i&lt;&#x2F;strong&gt; is the ith argument of the method. If &lt;strong&gt;type&lt;&#x2F;strong&gt; is specified, the value will be translated to the corresponding type. The protocol currently supports the basic types such as uint256, bytes32, address, bytes, and string. If &lt;strong&gt;type&lt;&#x2F;strong&gt; is not specified, then the type will be automatically detected using the following rule in a sequential way:&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;type&lt;&#x2F;strong&gt;=&quot;uint256&quot;, if &lt;strong&gt;value&lt;&#x2F;strong&gt; is numeric; or&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;type&lt;&#x2F;strong&gt;=&quot;bytes32&quot;, if &lt;strong&gt;value&lt;&#x2F;strong&gt; is in the form of 0x+32-byte-data hex; or&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;type&lt;&#x2F;strong&gt;=&quot;address&quot;, if &lt;strong&gt;value&lt;&#x2F;strong&gt; is in the form of 0x+20-byte-data hex; or&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;type&lt;&#x2F;strong&gt;=&quot;bytes&quot;, if &lt;strong&gt;value&lt;&#x2F;strong&gt; is in the form of 0x followed by any number of bytes besides 20 or 32; or&lt;&#x2F;li&gt;
&lt;li&gt;else &lt;strong&gt;type&lt;&#x2F;strong&gt;=&quot;address&quot; and parse the argument as a domain name in the form of &lt;code&gt;[name &quot;.&quot; [ subDomain0 &quot;.&quot; ... ]] nsProviderSuffix&lt;&#x2F;code&gt;. In this case, the actual value of the argument will be obtained from &lt;strong&gt;nsProviderSuffix&lt;&#x2F;strong&gt;, e.g., eth.  If &lt;strong&gt;nsProviderSuffix&lt;&#x2F;strong&gt; is not supported, an unsupported NS provider error will be returned.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Note that if &lt;strong&gt;method&lt;&#x2F;strong&gt; does not exist, i.e., &lt;strong&gt;path&lt;&#x2F;strong&gt; is empty or &quot;&#x2F;&quot;, then the contract will be called with empty calldata.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;returns&lt;&#x2F;strong&gt; attribute in &lt;strong&gt;query&lt;&#x2F;strong&gt; tells the format of the returned data. If not specified, the returned message data will be parsed in &quot;(bytes32)&quot; and MIME will be set based on the suffix of the last argument. If &lt;strong&gt;returns&lt;&#x2F;strong&gt; is &quot;()&quot;, the returned data will be parsed in raw bytes in JSON.  Otherwise, the returned message will be parsed in the specified &lt;strong&gt;returns&lt;&#x2F;strong&gt; attribute in JSON.  If multiple &lt;strong&gt;returns&lt;&#x2F;strong&gt; attributes are present, the value of the last &lt;strong&gt;returns&lt;&#x2F;strong&gt; attribute will be applied. Note that &lt;strong&gt;returnTypes&lt;&#x2F;strong&gt; is the alias of &lt;strong&gt;returns&lt;&#x2F;strong&gt;, but it is not recommended to use and is mainly for backward-compatible purpose.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;examples&quot;&gt;Examples&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;example-1&quot;&gt;Example 1&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;web3:&#x2F;&#x2F;w3url.eth&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The protocol will find the address of &lt;strong&gt;w3url.eth&lt;&#x2F;strong&gt; from ENS in chainid 1 (Mainnet), and then the protocol will call the address with &quot;From&quot; = &quot;0x...&quot; and &quot;Calldata&quot; = &quot;0x2F&quot;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;example-2&quot;&gt;Example 2&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;web3:&#x2F;&#x2F;cyberbrokers-meta.eth&#x2F;renderBroker&#x2F;9999&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The protocol will find the address of &lt;strong&gt;cyberbrokers-meta.eth&lt;&#x2F;strong&gt; from ENS on chainid 1 (Mainnet), and then call the address with &quot;To&quot; = &quot;0x...&quot; and &quot;Calldata&quot; = &quot;0x&quot; + &lt;code&gt;keccak(&quot;view(uint256)&quot;)[0:4] + abi.encode(uint256(9999))&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;example-3&quot;&gt;Example 3&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;web3:&#x2F;&#x2F;vitalikblog.eth:5&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The protocol will find the address of &lt;strong&gt;vitalikblog.eth&lt;&#x2F;strong&gt; from ENS on chainid 5 (Goerli), and then call the address with &quot;From&quot; = &quot;0x...&quot; and &quot;Calldata&quot; = &quot;0x2F&quot; with chainid = 5.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;example-4&quot;&gt;Example 4&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;web3:&#x2F;&#x2F;0xe4ba0e245436b737468c206ab5c8f4950597ab7f:42170&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The protocol will call the address with &quot;To&quot; = &quot;0x9e081Df45E0D167636DB9C61C7ce719A58d82E3b&quot; and &quot;Calldata&quot; = &quot;0x&quot; with chainid = 42170 (Arbitrum Nova).&lt;&#x2F;p&gt;
&lt;h4 id=&quot;example-5&quot;&gt;Example 5&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;web3:&#x2F;&#x2F;0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48&#x2F;balanceOf&#x2F;vitalik.eth?returns=(uint256)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The protocol will find the addresses of &lt;strong&gt;vitalik.eth&lt;&#x2F;strong&gt; from ENS on chainid 1 (Mainnet) and then call the method &quot;balanceOf(address)&quot; of the contract with the &lt;strong&gt;charles.eth&lt;&#x2F;strong&gt;&#x27;s address. The returned data will be parsed as uint256 like &lt;code&gt;[ &quot;10000000000000&quot; ]&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;example-6&quot;&gt;Example 6&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;web3:&#x2F;&#x2F;0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48&#x2F;balanceOf&#x2F;vitalik.eth?returns=()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The protocol will find the address of &lt;strong&gt;vitalik.eth&lt;&#x2F;strong&gt; from ENS on chainid 1 (Mainnet) and then call the method &quot;balanceOf(address)&quot; of the address. The returned data will be parsed as raw bytes like &lt;code&gt;[&quot;0x000000000000000000000000000000000000000000000000000009184e72a000&quot;]&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The purpose of the proposal is to add a decentralized presentation layer for Ethereum.  With the layer, we are able to render any web content (including HTML&#x2F;CSS&#x2F;JPG&#x2F;PNG&#x2F;SVG, etc) on-chain using human-readable URLs, and thus EVM can be served as decentralized Backend.  The design of the standard is based on the following principles:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Human-readable&lt;&#x2F;strong&gt;.  The Web3 URL should be easily recognized by human similar to Web2 URL (&lt;code&gt;http:&#x2F;&#x2F;&lt;&#x2F;code&gt;).  As a result, we support names from name services to replace address for better readability.  In addition, instead of using calldata in hex, we use human-readable method + arguments and translate them to calldata for better readability.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Maximum-Compatible with HTTP-URL standard&lt;&#x2F;strong&gt;.  The Web3 URL should be compatible with HTTP-URL standard including relative pathing, query, fragment, etc so that the support of existing HTTP-URL (e.g., by browser) can be easily extended to Web3 URL with minimal modification.  This also means that existing Web2 users can easily migrate to Web3 with minimal extra knowledge of this standard.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Simple&lt;&#x2F;strong&gt;.  Instead of providing explicit types in arguments, we use a &quot;maximum likelihood&quot; principle of auto-detecting the types of the arguments such as address, bytes32, and uint256.  This could greatly minimize the length of URL, while avoiding confusion.  In addition, explicit types are also supported to clear the confusion if necessary.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Flexible&lt;&#x2F;strong&gt;.  The contract is able to override the encoding rule so that the contract has fine-control of understanding the actual Web resources that the users want to locate.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;No security considerations were found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Non-Fungible Token Ownership Designation Standard</title>
        <published>2022-02-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>David Buckman</name><uri>https://github.com/davidbuckman</uri>
	</author>
	
	<author>
		<name>Isaac Buckman</name><uri>https://github.com/isaacbuckman</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4799/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-4799-non-fungible-token-wrapping-standard/8396" />
        

        <id>https://wg-eips.ritovision.com/4799/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:4799"
            label="ERC-4799" />
        

        
        

        
        <summary type="html">A standardized interface for designating ownership of an NFT</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4799/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The following defines a standard interface for designating ownership of an NFT to someone while the NFT is held in escrow by a smart contract. The standard allows for the construction of a directed acyclic graph of NFTs, where the designated owner of every NFT in a given chain is the terminal address of that chain. This enables the introduction of additional functionality to pre-existing NFTs, without having to give up the authenticity of the original. In effect, this means that all NFTs are composable and can be rented, used as collateral, fractionalized, and more.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Many NFTs aim to provide their holders with some utility - utility that can come in many forms. This can be the right to inhabit an apartment, access to tickets to an event, an airdrop of tokens, or one of the infinitely many other potential applications. However, in their current form, NFTs are limited by the fact that the only verifiable wallet associated with an NFT is the owner, so clients that want to distribute utility are forced to do so to an NFT&#x27;s listed owner. This means that any complex ownership agreements must be encoded into the original NFT contract - there is no mechanism by which an owner can link the authenticity of their original NFT to any external contract.&lt;&#x2F;p&gt;
&lt;p&gt;The goal of this standard is to allow users and developers the ability to define arbitrarily complex ownership agreements on NFTs that have already been minted. This way, new contracts with innovative ownership structures can be deployed, but they can still leverage the authenticity afforded by established NFT contracts - in the past a wrapping contract meant brand new NFTs with no established authenticity.&lt;&#x2F;p&gt;
&lt;p&gt;Prior to this standard, wrapping an NFT inside another contract was the only way to add functionality after the NFT contract had been deployed, but this meant losing access to the utility of holding the original NFT. Any application querying for the owner of that NFT would determine the wrapping smart contract to be the owner. Using this standard, applications will have a standardized method of interacting with wrapping contracts so that they can continue to direct their utility to users even when the NFT has been wrapped.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;utils&#x2F;introspection&#x2F;IERC165.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC4799NFT&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC165&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when ownership of any NFT changes by any mechanism.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  This event emits when NFTs are created (`from` == 0) and destroyed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  (`to` == 0). Exception: during contract creation, any number of NFTs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  may be created and assigned without emitting Transfer. At the time of&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  any transfer, the approved address for that NFT (if any) is reset to none.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Find the owner of an NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; NFTs assigned to zero address are considered invalid, and queries&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  about them throw&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier for an NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address of the owner of the NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-4799 Non-Fungible Token Ownership Designation Standard&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-4799&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is [&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;TODO&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;].&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;utils&#x2F;introspection&#x2F;IERC165.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERC4799NFT.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC4799&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC165&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when a source token designates its ownership to the owner of the target token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OwnershipDesignation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        IERC4799NFT&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sourceContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sourceTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        IERC4799NFT&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; targetContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; targetTokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Find the designated NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sourceContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The contract address of the source NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sourceTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The tokenId of the source NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; (targetContract, targetTokenId) contract address and tokenId of the parent NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; designatedTokenOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;IERC4799NFT&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sourceContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sourceTokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;IERC4799NFT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The authenticity of designated ownership of an NFT is conferred by the designating ERC-4799 contract’s ownership of the original NFT according to the source contract. This MUST be verified by clients by querying the source contract.&lt;&#x2F;p&gt;
&lt;p&gt;Clients respecting this specification SHALL NOT distribute any utility to the address of the ERC-4799 contract. Instead, they MUST distribute it to the owner of the designated token that the ERC-4799 contract points them to.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;To maximize the future compatibility of the wrapping contract, we first defined a canonical NFT interface. We created &lt;code&gt;IERC4799NFT&lt;&#x2F;code&gt;, an interface implicitly implemented by virtually all popular NFT contracts, including all deployed contracts that are &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; compliant. This interface represents the essence of an NFT: a mapping from a token identifier to the address of a singular owner, represented by the function &lt;code&gt;ownerOf&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The core of our proposal is the &lt;code&gt;IERC4799&lt;&#x2F;code&gt; interface, an interface for a standard NFT ownership designation contract (ODC). ERC4799 requires the implementation of a &lt;code&gt;designatedTokenOf&lt;&#x2F;code&gt; function, which maps a source NFT to exactly one target NFT. Through this function, the ODC expresses its belief of designated ownership. This designated ownership is only authentic if the ODC is listed as the owner of the original NFT, thus maintaining the invariant that every NFT has exactly one designated owner.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;IERC4799NFT&lt;&#x2F;code&gt; interface is backwards compatible with &lt;code&gt;IERC721&lt;&#x2F;code&gt;, as &lt;code&gt;IERC721&lt;&#x2F;code&gt; implicitly extends &lt;code&gt;IERC4799NFT&lt;&#x2F;code&gt;. This means that the ERC-4799 standard, which wraps NFTs that implement &lt;code&gt;ERC4799NFT&lt;&#x2F;code&gt;, is fully backwards compatible with ERC-721.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; &amp;gt;=0.8.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0.9&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERC4799.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERC4799NFT.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;ERC721.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC721&#x2F;IERC721Receiver.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721Composable&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC4799&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC721Receiver&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;IERC4799NFT &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; IERC4799NFT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _targetContracts&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;IERC4799NFT &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _targetTokenIds&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; designatedTokenOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;IERC4799NFT&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sourceContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sourceTokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        override&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;IERC4799NFT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            IERC4799NFT&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_targetContracts&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;sourceContract&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;sourceTokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            _targetTokenIds&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;sourceContract&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;sourceTokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; designateToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        IERC4799NFT&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sourceContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sourceTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        IERC4799NFT&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; targetContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; targetTokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            ERC721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sourceContract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sourceTokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            ERC721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sourceContract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getApproved&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sourceTokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;ERC721Composable: Only owner or approved address can set a designate ownership&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _targetContracts&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;sourceContract&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;sourceTokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; targetContract&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _targetTokenIds&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;sourceContract&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;sourceTokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; targetTokenId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OwnershipDesignation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            sourceContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            sourceTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            targetContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            targetTokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onERC721Received&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sourceTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        ERC721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; sourceTokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; IERC721Receiver&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;onERC721Received&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        public&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        virtual&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        override&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            (&lt;&#x2F;span&gt;&lt;span&gt;interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;IERC4799&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            interfaceId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;IERC721Receiver&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; &amp;gt;=0.8.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0.9&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERC4799.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERC4799NFT.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;utils&#x2F;introspection&#x2F;ERC165Checker.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DesignatedOwner&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; designatedOwnerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        IERC4799NFT&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; maxDepth&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        owner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; tokenContract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;ERC165Checker&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;IERC4799&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;maxDepth &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;designatedOwnerOf: depth limit exceeded&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            (&lt;&#x2F;span&gt;&lt;span&gt;tokenContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC4799&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;designatedTokenOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                tokenContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; designatedOwnerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; maxDepth &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;long-cyclical-chains-of-ownership&quot;&gt;Long&#x2F;Cyclical Chains of Ownership&lt;&#x2F;h3&gt;
&lt;p&gt;The primary security concern is that of malicious actors creating excessively long or cyclical chains of ownership, leading applications that attempt to query for the designated owner of a given token to run out of gas and be unable to function. To address this, clients are expected to always query considering a &lt;code&gt;maxDepth&lt;&#x2F;code&gt; parameter, cutting off computation after a certain number of chain traversals.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Beacon block root in the EVM</title>
        <published>2022-02-10T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Stokes</name><uri>https://github.com/ralexstokes</uri>
	</author>
	
	<author>
		<name>Ansgar Dietrichs</name><uri>https://github.com/adietrichs</uri>
	</author>
	
	<author>
		<name>Danny Ryan</name><uri>https://github.com/djrtwo</uri>
	</author>
	
	<author>
		<name>Martin Holst Swende</name><uri>https://github.com/holiman</uri>
	</author>
	
	<author>
		<name>lightclient</name><uri>https://github.com/lightclient</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4788/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-4788-beacon-root-in-evm/8281" />
        

        <id>https://wg-eips.ritovision.com/4788/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:4788"
            label="EIP-4788" />
        

        
        

        
        <summary type="html">Expose beacon chain roots in the EVM</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4788/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Commit to the hash tree root of each beacon chain block in the corresponding execution payload header.&lt;&#x2F;p&gt;
&lt;p&gt;Store each of these roots in a smart contract.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Roots of the beacon chain blocks are cryptographic accumulators that allow proofs of arbitrary consensus state.
Exposing these roots inside the EVM allows for trust-minimized access to the consensus layer.
This functionality supports a wide variety of use cases that improve trust assumptions of staking pools,
restaking constructions, smart contract bridges, MEV mitigations and more.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;constants&lt;&#x2F;th&gt;&lt;th&gt;value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FORK_TIMESTAMP&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;1710338135&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;HISTORY_BUFFER_LENGTH&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;8191&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SYSTEM_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xfffffffffffffffffffffffffffffffffffffffe&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;BEACON_ROOTS_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x000F3df6D732807Ef1319fB7B8bB8522d0Beac02&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;background&quot;&gt;Background&lt;&#x2F;h3&gt;
&lt;p&gt;The high-level idea is that each execution block contains the parent beacon block&#x27;s root. Even in the event of missed slots since the previous block root does not change,
we only need a constant amount of space to represent this &quot;oracle&quot; in each execution block. To improve the usability of this oracle, a small history of block roots
are stored in the contract.&lt;&#x2F;p&gt;
&lt;p&gt;To bound the amount of storage this construction consumes, a ring buffer is used that mirrors a block root accumulator on the consensus layer.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;block-structure-and-validity&quot;&gt;Block structure and validity&lt;&#x2F;h3&gt;
&lt;p&gt;Beginning at the execution timestamp &lt;code&gt;FORK_TIMESTAMP&lt;&#x2F;code&gt;, execution clients &lt;strong&gt;MUST&lt;&#x2F;strong&gt; extend the header schema with an additional field: the &lt;code&gt;parent_beacon_block_root&lt;&#x2F;code&gt;.
This root consumes 32 bytes and is exactly the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;fa09d896484bbe240334fa21ffaa454bafe5842e&#x2F;ssz&#x2F;simple-serialize.md#merkleization&quot;&gt;hash tree root&lt;&#x2F;a&gt; of the parent beacon block for the given execution block.&lt;&#x2F;p&gt;
&lt;p&gt;The resulting RLP encoding of the header is therefore:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;rlp&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    parent_hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ommers hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    coinbase&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state_root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    txs_root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    receipts_root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    logs_bloom&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; difficulty&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    number&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_limit&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_used&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    timestamp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    extradata&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    prev_randao&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0000000000000000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    base_fee_per_gas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    withdrawals_root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    blob_gas_used&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    excess_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    parent_beacon_block_root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Validity of the parent beacon block root is guaranteed from the consensus layer, much like how withdrawals are handled.&lt;&#x2F;p&gt;
&lt;p&gt;When verifying a block, execution clients &lt;strong&gt;MUST&lt;&#x2F;strong&gt; ensure the root value in the block header matches the one provided by the consensus client.&lt;&#x2F;p&gt;
&lt;p&gt;For a genesis block with no existing parent beacon block root the 32 zero bytes are used as a root placeholder.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;beacon-roots-contract&quot;&gt;Beacon roots contract&lt;&#x2F;h4&gt;
&lt;p&gt;The beacon roots contract has two operations: &lt;code&gt;get&lt;&#x2F;code&gt; and &lt;code&gt;set&lt;&#x2F;code&gt;. The input itself is not used to determine which function to execute, for that the result of &lt;code&gt;caller&lt;&#x2F;code&gt; is used. If &lt;code&gt;caller&lt;&#x2F;code&gt; is equal to &lt;code&gt;SYSTEM_ADDRESS&lt;&#x2F;code&gt; then the operation to perform is &lt;code&gt;set&lt;&#x2F;code&gt;. Otherwise, &lt;code&gt;get&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;get&quot;&gt;&lt;code&gt;get&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;ul&gt;
&lt;li&gt;Callers provide the &lt;code&gt;timestamp&lt;&#x2F;code&gt; they are querying encoded as 32 bytes in big-endian format.&lt;&#x2F;li&gt;
&lt;li&gt;If the input is not exactly 32 bytes, the contract must revert.&lt;&#x2F;li&gt;
&lt;li&gt;If the input is equal to 0, the contract must revert.&lt;&#x2F;li&gt;
&lt;li&gt;Given &lt;code&gt;timestamp&lt;&#x2F;code&gt;, the contract computes the storage index in which the timestamp is stored by computing the modulo &lt;code&gt;timestamp % HISTORY_BUFFER_LENGTH&lt;&#x2F;code&gt; and reads the value.&lt;&#x2F;li&gt;
&lt;li&gt;If the &lt;code&gt;timestamp&lt;&#x2F;code&gt; does not match, the contract must revert.&lt;&#x2F;li&gt;
&lt;li&gt;Finally, the beacon root associated with the timestamp is returned to the user. It is stored at &lt;code&gt;timestamp % HISTORY_BUFFER_LENGTH + HISTORY_BUFFER_LENGTH&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;set&quot;&gt;&lt;code&gt;set&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;ul&gt;
&lt;li&gt;Caller provides the parent beacon block root as calldata to the contract.&lt;&#x2F;li&gt;
&lt;li&gt;Set the storage value at &lt;code&gt;header.timestamp % HISTORY_BUFFER_LENGTH&lt;&#x2F;code&gt; to be &lt;code&gt;header.timestamp&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Set the storage value at &lt;code&gt;header.timestamp % HISTORY_BUFFER_LENGTH + HISTORY_BUFFER_LENGTH&lt;&#x2F;code&gt; to be &lt;code&gt;calldata[0:32]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;pseudocode&quot;&gt;Pseudocode&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt; evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;caller&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SYSTEM_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    set&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    get&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;calldata&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;revert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; to_uint256_be&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;calldata&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;revert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    timestamp_idx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; to_uint256_be&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;calldata&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; HISTORY_BUFFER_LENGTH&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    timestamp&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; storage&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;timestamp_idx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; timestamp&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;calldata&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;revert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    root_idx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; timestamp_idx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; HISTORY_BUFFER_LENGTH&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; storage&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;root_idx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;root&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; set&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    timestamp_idx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; to_uint256_be&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; HISTORY_BUFFER_LENGTH&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    root_idx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; timestamp_idx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; HISTORY_BUFFER_LENGTH&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    storage&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;set&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;timestamp_idx&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    storage&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;set&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;root_idx&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;calldata&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;bytecode&quot;&gt;Bytecode&lt;&#x2F;h5&gt;
&lt;p&gt;The exact contract bytecode is shared below.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;asm&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;caller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push20 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xfffffffffffffffffffffffffffffffffffffffe&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;eq&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x4d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;calldatasize&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;eq&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x24&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;revert&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;iszero&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x49&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push3 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x001fff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mod&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;eq&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x3c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;revert&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push3 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x001fff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;revert&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push3 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x001fff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mod&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push3 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x001fff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;stop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;deployment&quot;&gt;Deployment&lt;&#x2F;h4&gt;
&lt;p&gt;The beacon roots contract is deployed like any other smart contract. A special synthetic address is generated
by working backwards from the desired deployment transaction:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; null&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x3d090&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gasPrice&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xe8d4a51000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;maxPriorityFeePerGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; null&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;maxFeePerGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; null&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;input&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x60618060095f395ff33373fffffffffffffffffffffffffffffffffffffffe14604d57602036146024575f5ffd5b5f35801560495762001fff810690815414603c575f5ffd5b62001fff01545f5260205ff35b5f5ffd5b62001fff42064281555f359062001fff015500&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;v&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x539&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1b9b6eb1f0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xdf52c2d3bbe38820fff7b5eaab3db1b91f8e1412b56497d88388fb5d4ea1fde0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note, the input in the transaction has a simple constructor prefixing the desired runtime code.&lt;&#x2F;p&gt;
&lt;p&gt;The sender of the transaction can be calculated as &lt;code&gt;0x0B799C86a49DEeb90402691F1041aa3AF2d3C875&lt;&#x2F;code&gt;. The address of the first contract deployed from the account is &lt;code&gt;rlp([sender, 0])&lt;&#x2F;code&gt; which equals &lt;code&gt;0x000F3df6D732807Ef1319fB7B8bB8522d0Beac02&lt;&#x2F;code&gt;. This is how &lt;code&gt;BEACON_ROOTS_ADDRESS&lt;&#x2F;code&gt; is determined. Although this style of contract creation is not tied to any specific initcode like create2 is, the synthetic address is cryptographically bound to the input data of the transaction (e.g. the initcode).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;block-processing&quot;&gt;Block processing&lt;&#x2F;h3&gt;
&lt;p&gt;At the start of processing any execution block where &lt;code&gt;block.timestamp &amp;gt;= FORK_TIMESTAMP&lt;&#x2F;code&gt; (i.e. before processing any transactions), call &lt;code&gt;BEACON_ROOTS_ADDRESS&lt;&#x2F;code&gt; as &lt;code&gt;SYSTEM_ADDRESS&lt;&#x2F;code&gt; with the 32-byte input of &lt;code&gt;header.parent_beacon_block_root&lt;&#x2F;code&gt;, a gas limit of &lt;code&gt;30_000_000&lt;&#x2F;code&gt;, and &lt;code&gt;0&lt;&#x2F;code&gt; value. This will trigger the &lt;code&gt;set()&lt;&#x2F;code&gt; routine of the beacon roots contract. This is a system operation and therefore:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;the call must execute to completion&lt;&#x2F;li&gt;
&lt;li&gt;the call does not count against the block&#x27;s gas limit&lt;&#x2F;li&gt;
&lt;li&gt;the call does not follow the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; burn semantics - no value should be transferred as part of the call&lt;&#x2F;li&gt;
&lt;li&gt;if no code exists at &lt;code&gt;BEACON_ROOTS_ADDRESS&lt;&#x2F;code&gt;, the call must fail silently&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Clients may decide to omit an explicit EVM call and directly set the storage values. Note: While this is a valid optimization for Ethereum mainnet, it could be problematic on non-mainnet situations in case a different contract is used.&lt;&#x2F;p&gt;
&lt;p&gt;If this EIP is active in a genesis block, the genesis header&#x27;s &lt;code&gt;parent_beacon_block_root&lt;&#x2F;code&gt; must be &lt;code&gt;0x0&lt;&#x2F;code&gt; and no system transaction may occur.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-not-repurpose-blockhash&quot;&gt;Why not repurpose &lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt;?&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt; opcode could be repurposed to provide the beacon root instead of some execution block hash.
To minimize code change, avoid breaking changes to smart contracts, and simplify deployment to mainnet, this EIP suggests leaving &lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt; alone and adding new
functionality with the desired semantics.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;beacon-block-root-instead-of-state-root&quot;&gt;Beacon block root instead of state root&lt;&#x2F;h3&gt;
&lt;p&gt;Block roots are preferred over state roots so there is a constant amount of work to do with each new execution block. Otherwise, skipped slots would require
a linear amount of work with each new payload. While skipped slots are quite rare on mainnet, it is best to not add additional load under what would already
be nonfavorable conditions.&lt;&#x2F;p&gt;
&lt;p&gt;Use of block root over state root does mean proofs will require a few additional nodes but this cost is negligible (and could be amortized across all consumers,
e.g. with a singleton state root contract that caches the proof per slot).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-two-ring-buffers&quot;&gt;Why two ring buffers?&lt;&#x2F;h3&gt;
&lt;p&gt;The first ring buffer only tracks &lt;code&gt;HISTORY_BUFFER_LENGTH&lt;&#x2F;code&gt; worth of roots and so for all possible timestamp values would consume a constant amount of storage.
However, this design opens the contract to an attack where a skipped slot that has the same value modulo the ring buffer length would return an old root value,
rather than the most recent one.&lt;&#x2F;p&gt;
&lt;p&gt;To nullify this attack while retaining a fixed memory footprint, this EIP keeps track of the pair of data &lt;code&gt;(parent_beacon_block_root, timestamp)&lt;&#x2F;code&gt; for each index into the
ring buffer and verifies the timestamp matches the one originally used to write the root data when being read. Given the fixed size of storage slots (only 32 bytes), the requirement
to store a pair of values necessitates two ring buffers, rather than just one.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;size-of-ring-buffers&quot;&gt;Size of ring buffers&lt;&#x2F;h3&gt;
&lt;p&gt;The ring buffer data structures are sized to hold 8191 roots from the consensus layer. Using a prime number as the ring buffer size ensures that no value is overwritten until the entire ring buffer has been saturated and thereafter, each value will be updated once per iteration. This also means that even if the slot times were to change, we would continue to use at most 8191 storage slots.&lt;&#x2F;p&gt;
&lt;p&gt;Given the current mainnet values, 8191 roots provides about a day of coverage. This gives users plenty of time to make a transaction with a verification against a specific root and get the transaction included on-chain.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;N&#x2F;A&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;N&#x2F;A&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;N&#x2F;A&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Deactivate SELFDESTRUCT</title>
        <published>2022-02-03T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Guillaume Ballet</name><uri>https://github.com/gballet</uri>
	</author>
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	<author>
		<name>Dankrad Feist</name><uri>https://github.com/dankrad</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4758/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-4758-deactivate-selfdestruct/8710" />
        

        <id>https://wg-eips.ritovision.com/4758/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:4758"
            label="EIP-4758" />
        

        
        

        
        <summary type="html">Deactivate SELFDESTRUCT by changing it to SENDALL, which does recover all funds to the caller but does not delete any code or storage.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4758/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP renames the &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; opcode to &lt;code&gt;SENDALL&lt;&#x2F;code&gt;, and replaces its functionality. The new functionality will be only to send all Ether in the account to the caller.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; opcode requires large changes to the state of an account, in particular removing all code and storage. This will not be possible in the future with Verkle trees: Each account will be stored in many different account keys, which will not be obviously connected to the root account.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP implements this change. Applications that only use &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; to retrieve funds will still work.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; opcode is renamed to &lt;code&gt;SENDALL&lt;&#x2F;code&gt;, and now only immediately moves all ETH in the account to the target; it no longer destroys code or storage or alters the nonce&lt;&#x2F;li&gt;
&lt;li&gt;All refunds related to &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; are removed&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Getting rid of the &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; opcode has been considered in the past, and there are currently no strong reasons to use it. Disabling it will be a requirement for statelessness.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP requires a hard fork, since it modifies consensus rules.&lt;&#x2F;p&gt;
&lt;p&gt;Few applications are affected by this change. The only use that breaks is where a contract is re-created at the same address using &lt;code&gt;CREATE2&lt;&#x2F;code&gt; (after a &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The following applications of &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; will be broken and applications that use it in this way are not safe anymore:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Any use where &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; is used to burn non-ETH token balances, such as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;EIP-20&lt;&#x2F;a&gt;), inside a contract. We do not know of any such use (since it can easily be done by sending to a burn address this seems an unlikely way to use &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;Where &lt;code&gt;CREATE2&lt;&#x2F;code&gt; is used to redeploy a contract in the same place. There are two ways in which this can fail:
&lt;ul&gt;
&lt;li&gt;The destruction prevents the contract from being used outside of a certain context. For example, the contract allows anyone to withdraw funds, but &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; is used at the end of an operation to prevent others from doing this. This type of operation can easily be modified to not depend on &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; operation is used in order to make a contract upgradable. This is not supported anymore and delegates should be used.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>SELFDESTRUCT bomb</title>
        <published>2022-02-03T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Guillaume Ballet</name><uri>https://github.com/gballet</uri>
	</author>
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	<author>
		<name>Dankrad Feist</name><uri>https://github.com/dankrad</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4760/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-4760-selfdestruct-bomb/8713" />
        

        <id>https://wg-eips.ritovision.com/4760/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:4760"
            label="EIP-4760" />
        

        
        

        
        <summary type="html">Deactivate SELFDESTRUCT by changing it to SENDALL and stage this via a stage of exponential gas cost increases.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4760/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP renames the &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; opcode to &lt;code&gt;SENDALL&lt;&#x2F;code&gt;, and replaces its functionality. The new functionality will be only to send all Ether in the account to the caller.&lt;&#x2F;p&gt;
&lt;p&gt;In order to give apps more warning even if their developers are completely unaware of the EIP process, this version will exponentially increase the gas costs of the opcode, so any developer has time to see this change and react by implementing a version of their contract that does not rely on &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; .&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; opcode requires large changes to the state of an account, in particular removing all code and storage. This will not be possible in the future with Verkle trees: Each account will be stored in many different account keys, which will not be obviously connected to the root account.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP implements this change. Applications that only use &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; to retrieve funds will still work.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Comment&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;OLD_SELFDESTRUCT_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;5000&lt;&#x2F;td&gt;&lt;td&gt;Current gas cost of &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; opcode&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;HARD_FORK_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;TBD&lt;&#x2F;td&gt;&lt;td&gt;(Shanghai HF block height)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;DOUBLING_SLOTS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2**16&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;(Time for gas price to double, ca. 9 days)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;DOUBLINGS_BEFORE_SENDALL&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;13&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; will be converted to &lt;code&gt;SENDALL&lt;&#x2F;code&gt; at &lt;code&gt;HARD_FORK_BLOCK + DOUBLING_SLOTS * DOUBLINGS_BEFORE_SENDALL&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;ul&gt;
&lt;li&gt;If &lt;code&gt;HARD_FORK_BLOCK &amp;lt;= slot &amp;lt; HARD_FORK_BLOCK + DOUBLING_SLOTS * DOUBLINGS_BEFORE_SENDALL&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; functionality remains unchanged&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; gas cost is now &lt;code&gt;OLD_SELFDESTRUCT_COST * 2 ** ((slot - HARD_FORK_BLOCK) &#x2F;&#x2F; DOUBLING_SLOTS)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;For &lt;code&gt;slot &amp;gt;= HARD_FORK_BLOCK + DOUBLING_SLOTS * DOUBLINGS_BEFORE_SENDALL&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;The cost reverts back to &lt;code&gt;OLD_SELFDESTRUCT_COST&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; opcode is renamed to &lt;code&gt;SENDALL&lt;&#x2F;code&gt;, and now only immediately moves all ETH in the account to the target; it no longer destroys code or storage or alters the nonce&lt;&#x2F;li&gt;
&lt;li&gt;All refunds related to &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; are removed&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The idea behind this EIP is to disable &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; in a way that gives ample warning to Dapp developers. Many developers do not watch the EIP process closely and can therefore be caught by surprise when an opcode is deactivated and does not fulfill its original purpose anymore. However, at least if the smart contract has regular use, then users will notice the price of the operation going up tremendously. The period over which this is happening (&lt;code&gt;HARD_FORK_BLOCK + DOUBLING_SLOTS * DOUBLINGS_BEFORE_SENDALL&lt;&#x2F;code&gt;) is chosen to be long enough (ca. 4 months) such that it gives developers time to react to this change and prepare their application.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backward-compatibility&quot;&gt;Backward Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP requires a hard fork, since it modifies consensus rules.&lt;&#x2F;p&gt;
&lt;p&gt;Few applications are affected by this change. The only use that breaks is where a contract is re-created at the same address using &lt;code&gt;CREATE2&lt;&#x2F;code&gt; (after a &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;). The only application that is significantly affected (and where code can be analyzed) is able to switch to a different model, and should have ample time to do so.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The following applications of &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; will be broken and applications that use it in this way are not safe anymore:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Any use where &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; is used to burn non-ETH token balances, such as ERC20, inside a contract. We do not know of any such use (since it can easily be done by sending to a burn address this seems an unlikely way to use &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;)&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Where &lt;code&gt;CREATE2&lt;&#x2F;code&gt; is used to redeploy a contract in the same place. There are two ways in which this can fail:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The destruction prevents the contract from being used outside of a certain context. For example, the contract allows anyone to withdraw funds, but &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; is used at the end of an operation to prevent others from doing this. This type of operation can easily be modified to not depend on &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; operation is used in order to make a contract upgradable. This is not supported anymore and delegates should be used.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Statelessness gas cost changes</title>
        <published>2022-02-03T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Guillaume Ballet</name><uri>https://github.com/gballet</uri>
	</author>
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	<author>
		<name>Dankrad Feist</name><uri>https://github.com/dankrad</uri>
	</author>
	
	<author>
		<name>Ignacio Hagopian</name><uri>https://github.com/jsign</uri>
	</author>
	
	<author>
		<name>Tanishq Jasoria</name><uri>https://github.com/tanishqjasoria</uri>
	</author>
	
	<author>
		<name>Gajinder Singh</name><uri>https://github.com/g11tech</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4762/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-4762-statelessness-gas-cost-changes/8714" />
        

        <id>https://wg-eips.ritovision.com/4762/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:4762"
            label="EIP-4762" />
        

        
        

        
        <summary type="html">Changes the gas schedule to reflect the costs of creating a witness by requiring clients update their database layout to match.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4762/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces changes in the gas schedule to reflect the costs of creating a witness. It requires clients to update their database layout to match this, so as to avoid potential DoS attacks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The introduction of Verkle trees into Ethereum requires fundamental changes and as a preparation, this EIP is targeting the fork coming right before the verkle tree fork, in order to incentivize Dapp developers to adopt the new storage model, and ample time to adjust to it. It also incentivizes client developers to migrate their database format ahead of the verkle fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;helper-functions&quot;&gt;Helper functions&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_storage_slot_tree_keys&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;storage_key&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; storage_key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;CODE_OFFSET&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; HEADER_STORAGE_OFFSET&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        pos&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; HEADER_STORAGE_OFFSET&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; storage_key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        pos&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAIN_STORAGE_OFFSET&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; storage_key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        pos&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 256&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        pos&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;access-events&quot;&gt;Access events&lt;&#x2F;h3&gt;
&lt;p&gt;Whenever the state is read, one or more of the access events of the form &lt;code&gt;(address, sub_key, leaf_key)&lt;&#x2F;code&gt; take place, determining what data is being accessed. We define access events as follows:&lt;&#x2F;p&gt;
&lt;h4 id=&quot;access-events-for-account-headers&quot;&gt;Access events for account headers&lt;&#x2F;h4&gt;
&lt;p&gt;When:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;a non-precompile which is also not a system contract is the target of a &lt;code&gt;*CALL&lt;&#x2F;code&gt;, &lt;code&gt;CALLCODE&lt;&#x2F;code&gt;, &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;, &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt;, or &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt; opcode,&lt;&#x2F;li&gt;
&lt;li&gt;a non-precompile which is also not a system contract is the target address of a contract creation whose initcode starts execution,&lt;&#x2F;li&gt;
&lt;li&gt;any address is the target of the &lt;code&gt;BALANCE&lt;&#x2F;code&gt; opcode&lt;&#x2F;li&gt;
&lt;li&gt;a &lt;em&gt;deployed&lt;&#x2F;em&gt; contract calls &lt;code&gt;CODECOPY&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;process this access event:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(address, 0, BASIC_DATA_LEAF_KEY)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note: a non-value-bearing &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;, &lt;code&gt;*CALL&lt;&#x2F;code&gt; or &lt;code&gt;CALLCODE&lt;&#x2F;code&gt;, targeting a precompile or a system contract, will not cause the &lt;code&gt;BASIC_DATA_LEAF_KEY&lt;&#x2F;code&gt; to be added to the witness.&lt;&#x2F;p&gt;
&lt;p&gt;If a &lt;code&gt;*CALL&lt;&#x2F;code&gt;, &lt;code&gt;CALLCODE&lt;&#x2F;code&gt; or &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; is value-bearing (ie. it transfers nonzero wei), whether or not the &lt;code&gt;callee&lt;&#x2F;code&gt; is a precompile or a system contract, process this additional access event:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(caller, 0, BASIC_DATA_LEAF_KEY)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note: when checking for the existence of the &lt;code&gt;callee&lt;&#x2F;code&gt;, the existence check is done by validating that there is an extension-and-suffix tree at the corresponding stem, and does not rely on &lt;code&gt;CODEHASH_LEAF_KEY&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;When calling &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt;, process the access event:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(address, 0, CODEHASH_LEAF_KEY)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note that precompiles and system contracts are excluded, as their hashes are known to the client.&lt;&#x2F;p&gt;
&lt;p&gt;When a contract is created, process these access events:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(contract_address, 0, BASIC_DATA_LEAF_KEY)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(contract_address, 0, CODEHASH_LEAF_KEY)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;access-events-for-storage&quot;&gt;Access events for storage&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;SLOAD&lt;&#x2F;code&gt; and &lt;code&gt;SSTORE&lt;&#x2F;code&gt; opcodes with a given address and key process an access event of the form&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(address, tree_key, sub_key)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Where &lt;code&gt;tree_key&lt;&#x2F;code&gt; and &lt;code&gt;sub_key&lt;&#x2F;code&gt; are computed as &lt;code&gt;tree_key, sub_key = get_storage_slot_tree_keys(key)&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;access-events-for-code&quot;&gt;Access events for code&lt;&#x2F;h4&gt;
&lt;p&gt;In the conditions below, “chunk chunk_id is accessed” is understood to mean an access event of the form&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(address, (chunk_id + 128) &#x2F;&#x2F; 256, (chunk_id + 128) % 256)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;At each step of EVM execution, if and only if &lt;code&gt;PC &amp;lt; len(code)&lt;&#x2F;code&gt;, chunk &lt;code&gt;PC &#x2F;&#x2F; CHUNK_SIZE&lt;&#x2F;code&gt; (where &lt;code&gt;PC&lt;&#x2F;code&gt; is the current program counter) of the callee is accessed. In particular, note the following corner cases:
&lt;ul&gt;
&lt;li&gt;The destination of a &lt;code&gt;JUMP&lt;&#x2F;code&gt; (or positively evaluated &lt;code&gt;JUMPI&lt;&#x2F;code&gt;) is considered to be accessed, even if the destination is not a jumpdest or is inside pushdata&lt;&#x2F;li&gt;
&lt;li&gt;The destination of a &lt;code&gt;JUMPI&lt;&#x2F;code&gt; is not considered to be accessed if the jump conditional is &lt;code&gt;false&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The destination of a jump is not considered to be accessed if the execution gets to the jump opcode but does not have enough gas to pay for the gas cost of executing the &lt;code&gt;JUMP&lt;&#x2F;code&gt; opcode (including chunk access cost if the &lt;code&gt;JUMP&lt;&#x2F;code&gt; is the first opcode in a not-yet-accessed chunk)&lt;&#x2F;li&gt;
&lt;li&gt;The destination of a jump is not considered to be accessed if it is beyond the code (&lt;code&gt;destination &amp;gt;= len(code)&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;If code stops execution by walking past the end of the code, &lt;code&gt;PC = len(code)&lt;&#x2F;code&gt; is not considered to be accessed&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;If the current step of EVM execution is a &lt;code&gt;PUSH{n}&lt;&#x2F;code&gt;, all chunks &lt;code&gt;(PC &#x2F;&#x2F; CHUNK_SIZE) &amp;lt;= chunk_index &amp;lt;= ((PC + n) &#x2F;&#x2F; CHUNK_SIZE)&lt;&#x2F;code&gt; of the callee are accessed.&lt;&#x2F;li&gt;
&lt;li&gt;If a nonzero-read-size &lt;code&gt;CODECOPY&lt;&#x2F;code&gt; or &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt; read bytes &lt;code&gt;x...y&lt;&#x2F;code&gt; inclusive, all chunks &lt;code&gt;(x &#x2F;&#x2F; CHUNK_SIZE) &amp;lt;= chunk_index &amp;lt;= (min(y, code_size - 1) &#x2F;&#x2F; CHUNK_SIZE)&lt;&#x2F;code&gt; of the accessed contract are accessed.
&lt;ul&gt;
&lt;li&gt;Example 1: for a &lt;code&gt;CODECOPY&lt;&#x2F;code&gt; with start position 100, read size 50, &lt;code&gt;code_size = 200&lt;&#x2F;code&gt;, &lt;code&gt;x = 100&lt;&#x2F;code&gt; and &lt;code&gt;y = 149&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Example 2: for a &lt;code&gt;CODECOPY&lt;&#x2F;code&gt; with start position 600, read size 0, no chunks are accessed&lt;&#x2F;li&gt;
&lt;li&gt;Example 3: for a &lt;code&gt;CODECOPY&lt;&#x2F;code&gt; with start position 1500, read size 2000, &lt;code&gt;code_size = 3100&lt;&#x2F;code&gt;, &lt;code&gt;x = 1500&lt;&#x2F;code&gt; and &lt;code&gt;y = 3099&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CODESIZE&lt;&#x2F;code&gt;, &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; and &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; do NOT access any chunks.
When a contract is created, access chunks &lt;code&gt;0 ... (len(code)+30)&#x2F;&#x2F;31&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;write-events&quot;&gt;Write Events&lt;&#x2F;h3&gt;
&lt;p&gt;We define &lt;strong&gt;write events&lt;&#x2F;strong&gt; as follows. Note that when a write takes place, an access event also takes place (so the definition below should be a subset of the definition of access events). A write event is of the form &lt;code&gt;(address, sub_key, leaf_key)&lt;&#x2F;code&gt;, determining what data is being written to.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;write-events-for-account-headers&quot;&gt;Write events for account headers&lt;&#x2F;h4&gt;
&lt;p&gt;When a nonzero-balance-sending &lt;code&gt;CALL&lt;&#x2F;code&gt;, &lt;code&gt;CALLCODE&lt;&#x2F;code&gt; or &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; with a given sender and recipient takes place, process these write events:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(caller, 0, BASIC_DATA_LEAF_KEY)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(callee, 0, BASIC_DATA_LEAF_KEY)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;if no account exists at &lt;code&gt;callee_address&lt;&#x2F;code&gt;, also process:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(callee, 0, CODEHASH_LEAF_KEY)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;When a contract creation is initialized, process these write events:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(contract_address, 0, BASIC_DATA_LEAF_KEY)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(contract_address, 0, CODEHASH_LEAF_KEY)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;write-events-for-storage&quot;&gt;Write events for storage&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;SSTORE&lt;&#x2F;code&gt; opcodes with a given &lt;code&gt;address&lt;&#x2F;code&gt; and &lt;code&gt;key&lt;&#x2F;code&gt; process a write event of the form&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(address, tree_key, sub_key)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Where &lt;code&gt;tree_key&lt;&#x2F;code&gt; and &lt;code&gt;sub_key&lt;&#x2F;code&gt; are computed as &lt;code&gt;tree_key, sub_key = get_storage_slot_tree_keys(key)&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;write-events-for-code&quot;&gt;Write events for code&lt;&#x2F;h4&gt;
&lt;p&gt;When a contract is created, process the write events:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;CODE_OFFSET&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; VERKLE_NODE_WIDTH&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;CODE_OFFSET&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; VERKLE_NODE_WIDTH&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;For &lt;code&gt;i&lt;&#x2F;code&gt; in &lt;code&gt;0 ... (len(code)+30)&#x2F;&#x2F;31&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Note: since no access list existed for code up until this EIP, note that no warm costs are charged for code accesses.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;transaction&quot;&gt;Transaction&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;access-events-1&quot;&gt;Access events&lt;&#x2F;h4&gt;
&lt;p&gt;For a transaction, make these access events:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(tx.origin, 0, BASIC_DATA_LEAF_KEY)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(tx.origin, 0, CODEHASH_LEAF_KEY)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(tx.target, 0, BASIC_DATA_LEAF_KEY)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(tx.target, 0, CODEHASH_LEAF_KEY)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;write-events-1&quot;&gt;Write events&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(tx.origin, 0, BASIC_DATA_LEAF_KEY)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;If &lt;code&gt;value&lt;&#x2F;code&gt; is non-zero:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(tx.target, 0, BASIC_DATA_LEAF_KEY)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;witness-gas-costs&quot;&gt;Witness gas costs&lt;&#x2F;h3&gt;
&lt;p&gt;Remove the following gas costs:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Increased gas cost of &lt;code&gt;CALL&lt;&#x2F;code&gt; if it is nonzero-value-sending&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2200&#x2F;&quot;&gt;EIP-2200&lt;&#x2F;a&gt; &lt;code&gt;SSTORE&lt;&#x2F;code&gt; gas costs except for the &lt;code&gt;SLOAD_GAS&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;200 per byte contract code cost&lt;&#x2F;li&gt;
&lt;li&gt;All &lt;code&gt;CALLCODE&lt;&#x2F;code&gt; costs related to nonzero-value-sending&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Reduce gas cost:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;CREATE&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;CREATE2&lt;&#x2F;code&gt; to 1000&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;WITNESS_BRANCH_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;1900&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;WITNESS_CHUNK_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;200&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SUBTREE_EDIT_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3000&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CHUNK_EDIT_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;500&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CHUNK_FILL_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;6200&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;When executing a transaction, maintain four sets:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;accessed_subtrees: Set[Tuple[address, int]]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;accessed_leaves: Set[Tuple[address, int, int]]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;edited_subtrees: Set[Tuple[address, int]]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;edited_leaves: Set[Tuple[address, int, int]]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;When an &lt;strong&gt;access&lt;&#x2F;strong&gt; event of &lt;code&gt;(address, sub_key, leaf_key)&lt;&#x2F;code&gt; occurs, perform the following checks:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Perform the following steps unless event is a &lt;em&gt;Transaction access event&lt;&#x2F;em&gt;;&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;(address, sub_key)&lt;&#x2F;code&gt; is not in &lt;code&gt;accessed_subtrees&lt;&#x2F;code&gt;, charge &lt;code&gt;WITNESS_BRANCH_COST&lt;&#x2F;code&gt; gas and add that tuple to &lt;code&gt;accessed_subtrees&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;leaf_key&lt;&#x2F;code&gt; is not &lt;code&gt;None&lt;&#x2F;code&gt; and &lt;code&gt;(address, sub_key, leaf_key)&lt;&#x2F;code&gt; is not in &lt;code&gt;accessed_leaves&lt;&#x2F;code&gt;, charge &lt;code&gt;WITNESS_CHUNK_COST&lt;&#x2F;code&gt; gas and add it to &lt;code&gt;accessed_leaves&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;When a &lt;strong&gt;write&lt;&#x2F;strong&gt; event of &lt;code&gt;(address, sub_key, leaf_key)&lt;&#x2F;code&gt; occurs, perform the following checks:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If event is &lt;em&gt;Transaction write event&lt;&#x2F;em&gt;, skip the following steps.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;(address, sub_key)&lt;&#x2F;code&gt; is not in &lt;code&gt;edited_subtrees&lt;&#x2F;code&gt;, charge &lt;code&gt;SUBTREE_EDIT_COST&lt;&#x2F;code&gt; gas and add that tuple to &lt;code&gt;edited_subtrees&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;leaf_key&lt;&#x2F;code&gt; is not &lt;code&gt;None&lt;&#x2F;code&gt; and &lt;code&gt;(address, sub_key, leaf_key)&lt;&#x2F;code&gt; is not in &lt;code&gt;edited_leaves&lt;&#x2F;code&gt;, charge &lt;code&gt;CHUNK_EDIT_COST&lt;&#x2F;code&gt; gas and add it to &lt;code&gt;edited_leaves&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;Additionally, if there was no value stored at &lt;code&gt;(address, sub_key, leaf_key)&lt;&#x2F;code&gt; (ie. the state held &lt;code&gt;None&lt;&#x2F;code&gt; at that position), charge &lt;code&gt;CHUNK_FILL_COST&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note that tree keys can no longer be emptied: only the values &lt;code&gt;0...2**256-1&lt;&#x2F;code&gt; can be written to a tree key, and 0 is distinct from &lt;code&gt;None&lt;&#x2F;code&gt;. Once a tree key is changed from &lt;code&gt;None&lt;&#x2F;code&gt; to not-&lt;code&gt;None&lt;&#x2F;code&gt;, it can never go back to &lt;code&gt;None&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Note that values should only be added to the witness if there is sufficient gas to cover their associated event costs. If there is not enough gas to cover the event costs, all the remaining gas should be consumed.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;CREATE*&lt;&#x2F;code&gt; and &lt;code&gt;*CALL&lt;&#x2F;code&gt; reserve 1&#x2F;64th of the gas before the nested execution. In order to match the behavior of this charge with the pre-fork behavior of access lists:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;this minimum 1&#x2F;64th gas reservation is checked &lt;strong&gt;AFTER&lt;&#x2F;strong&gt; charging the witness costs when performing a &lt;code&gt;CALL&lt;&#x2F;code&gt;, &lt;code&gt;CALLCODE&lt;&#x2F;code&gt;, &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; or &lt;code&gt;STATICCALL&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;this 1&#x2F;64th of the gas is subtracted &lt;strong&gt;BEFORE&lt;&#x2F;strong&gt; charging the witness costs when performing a &lt;code&gt;CREATE&lt;&#x2F;code&gt; or &lt;code&gt;CREATE2&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;block-level-operations&quot;&gt;Block-level operations&lt;&#x2F;h3&gt;
&lt;p&gt;None of:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Precompile accounts, system contract accounts and slots of a system contract that are accessed during a system call,&lt;&#x2F;li&gt;
&lt;li&gt;The coinbase account&lt;&#x2F;li&gt;
&lt;li&gt;Withdrawal accounts&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;are warm at the start of a transaction.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;system-contracts&quot;&gt;System contracts&lt;&#x2F;h3&gt;
&lt;p&gt;When (and only when) calling a system contract either&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;via a system call&lt;&#x2F;em&gt; or&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;to resolve a precompile&#x2F;opcode&lt;&#x2F;em&gt;,&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;the system contract&#x27;s &lt;em&gt;code chunks&lt;&#x2F;em&gt; and &lt;em&gt;account headers&lt;&#x2F;em&gt; accesses should not appear in the witness as these should be known&#x2F;cached in the clients. However any other accesses and all writes should appear in the witness.&lt;&#x2F;p&gt;
&lt;p&gt;Also corresponding witness costs need to be charged for &lt;em&gt;precompile&#x2F;opcode resolution&lt;&#x2F;em&gt; but are not charged in the &lt;em&gt;system call&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;account-abstraction&quot;&gt;Account abstraction&lt;&#x2F;h3&gt;
&lt;p&gt;TODO : still waiting on a final decision between 7702 and 3074&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;gas-reform&quot;&gt;Gas reform&lt;&#x2F;h3&gt;
&lt;p&gt;Gas costs for reading storage and code are reformed to more closely reflect the gas costs under the new Verkle tree design. &lt;code&gt;WITNESS_CHUNK_COST&lt;&#x2F;code&gt; is set to charge 6.25 gas per byte for chunks, and &lt;code&gt;WITNESS_BRANCH_COST&lt;&#x2F;code&gt; is set to charge ~13,2 gas per byte for branches on average (assuming 144 byte branch length) and ~2.5 gas per byte in the worst case if an attacker fills the tree with keys deliberately computed to maximize proof length.&lt;&#x2F;p&gt;
&lt;p&gt;The main differences from gas costs in Berlin are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;200 gas charged per 31 byte chunk of code. This has been estimated to increase average gas usage by ~6-12% (suggesting 10-20% gas usage increases at a 350 gas per chunk level).&lt;&#x2F;li&gt;
&lt;li&gt;Cost for accessing adjacent storage slots (&lt;code&gt;key1 &#x2F;&#x2F; 256 == key2 &#x2F;&#x2F; 256&lt;&#x2F;code&gt;) decreases from 2100 to 200 for all slots after the first in the group,&lt;&#x2F;li&gt;
&lt;li&gt;Cost for accessing storage slots 0…63 decreases from 2100 to 200, including the first storage slot. This is likely to significantly improve performance of many existing contracts, which use those storage slots for single persistent variables.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Gains from the latter two properties have not yet been analyzed, but are likely to significantly offset the losses from the first property. It’s likely that once compilers adapt to these rules, efficiency will increase further.&lt;&#x2F;p&gt;
&lt;p&gt;The precise specification of when access events take place, which makes up most of the complexity of the gas repricing, is necessary to clearly specify when data needs to be saved to the period 1 tree.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP requires a hard fork, since it modifies consensus rules.&lt;&#x2F;p&gt;
&lt;p&gt;The main backwards-compatibility-breaking change is the gas costs for code chunk access making some applications less economically viable. It can be mitigated by increasing the gas limit at the same time as implementing this EIP, reducing the risk that applications will no longer work at all due to transaction gas usage rising above the block gas limit.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP will mean that certain operations, mostly reading and writing several elements in the same suffix tree, become cheaper. If clients retain the same database structure as they have now, this would result in a DOS vector.&lt;&#x2F;p&gt;
&lt;p&gt;So some adaptation of the database is required in order to make this work:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;In all possible futures, it is important to logically separate the commitment scheme from data storage. In particular, no traversal of the commitment scheme tree should be necessary to find any given state element&lt;&#x2F;li&gt;
&lt;li&gt;In order to make accesses to the same stem cheap as required for this EIP, the best way is probably to store each stem in the same location in the database. Basically the 256 leaves of 32 bytes each would be stored in an 8kB BLOB. The overhead of reading&#x2F;writing this BLOB is small because most of the cost of disk access is seeking and not the amount transferred.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Simplify EIP-161</title>
        <published>2022-02-02T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Peter Davies</name><uri>https://github.com/petertdavies</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4747/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-4747-simplify-eip-161/8246" />
        

        <id>https://wg-eips.ritovision.com/4747/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:4747"
            label="EIP-4747" />
        

        
        

        
        <summary type="html">Simplify EIP-161 and retroactively deprecate unused aspects of it</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4747/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Simplify the definition of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;161&#x2F;&quot;&gt;EIP-161&lt;&#x2F;a&gt;, removing the requirement for implementors to support edge cases that are impossible on Ethereum Mainnet.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;EIP-161 is overly complex and has a number of edge cases that are poorly documented and tested. This EIP takes advantage of the complete removal of all remaining empty accounts in block 14049881 (tx &lt;code&gt;0xf955834bfa097458a9cf6b719705a443d32e7f43f20b9b0294098c205b4bcc3d&lt;&#x2F;code&gt;) to clarify it, and allows implementors to not implement various edge cases that never occurred and are not possible in the future.&lt;&#x2F;p&gt;
&lt;p&gt;In particular, this EIP permits implementors who do not wish to support historical blocks to not implement state clearing at all.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;Retroactively replace EIP-161, starting from its introduction in block 2675000, with the following rules:&lt;&#x2F;p&gt;
&lt;p&gt;a. When creating an account, set it&#x27;s nonce to &lt;code&gt;1&lt;&#x2F;code&gt; prior to executing initcode.&lt;&#x2F;p&gt;
&lt;p&gt;b. When performing EVM execution treat all empty accounts as if they do not exist. Any operation that would create an empty account instead leaves it non-existent.&lt;&#x2F;p&gt;
&lt;p&gt;c. If one of the following events happens to an empty account &lt;code&gt;X&lt;&#x2F;code&gt;, it is deleted:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;X&lt;&#x2F;code&gt; receives a zero value &lt;code&gt;CALL&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;X&lt;&#x2F;code&gt; is the recipient of a zero value transaction.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;X&lt;&#x2F;code&gt; is the beneficiary of a &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; with zero value.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;If the transaction, &lt;code&gt;CALL&lt;&#x2F;code&gt; or &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; is reverted, then the state clearing is also reverted. As a special case on Ethereum Mainnet, in block 2675119 (tx &lt;code&gt;0xcf416c536ec1a19ed1fb89e4ec7ffb3cf73aa413b3aa9b77d60e4fd81a4296ba&lt;&#x2F;code&gt;), an empty call is made to an empty account at &lt;code&gt;RIPEMD160&lt;&#x2F;code&gt; (precompile &lt;code&gt;0x3&lt;&#x2F;code&gt;), the call fails out of gas, but the empty account is removed anyway.&lt;&#x2F;p&gt;
&lt;p&gt;The deletion MAY happen immediately or be processed at the end of the transaction. A client may assume that &lt;code&gt;STATICCALL&lt;&#x2F;code&gt;s to empty accounts never occur and that &lt;code&gt;CALL&lt;&#x2F;code&gt;s to empty accounts in &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; contexts never occur.&lt;&#x2F;p&gt;
&lt;p&gt;On Ethereum Mainnet, the only state clearing events after the start of Byzantium are the two listed below. Clients MAY implement post Byzantium state clearing by hardcoding those events.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;In block 4457731 (tx &lt;code&gt;0x63791f962e13e6b01ec13d38a8ab66c87c2f5a1768276f866300d900cca808fe&lt;&#x2F;code&gt;), &lt;code&gt;0xd29DFe5aE95B5C067a91F472Dac0d9be6700A4A9&lt;&#x2F;code&gt; receives a zero value &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; and is cleared.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;In block 14049881 (tx &lt;code&gt;0xf955834bfa097458a9cf6b719705a443d32e7f43f20b9b0294098c205b4bcc3d&lt;&#x2F;code&gt;), the following accounts receive zero value calls and are cleared.&lt;&#x2F;p&gt;
  &lt;details&gt;
  &lt;summary&gt;Accounts cleared&lt;&#x2F;summary&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x01a3dd7d158e3b4c9d8d2af0ddcf3df0f5e14463&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0366c731dd7c095dc08896806765a649c6c0885a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x056c68da52395f1d42c5ba15c4fb956146a4f2c1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x070ba92497cd4b88a8a9a60795ca7d7f7de0faa3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x07a1648ce2bed6721a5d25de3c228a296d03fd52&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x07b14ba68f474529cc0bd6a9bffee2bc4090d185&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x07ea32232e37d44134a3071319d228bdab249a60&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x096b7382500fa11c22c54c0422c5e38899a2e933&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x09f3200441bd60522bcf28f3666f8e8dbd19fb62&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0ad0f3c60696adece09367a9a11c968fb88560bb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0af6181e1db22071f38fc162e1610e29d288de04&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0cdc7fef8f8d0ee77360060930aada1263b26ff7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0dac3d571eb5b884a2550db2791d5ac1efca306b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0ec857faba49392080b68dd5074d85f34724d04a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0f5054f9c674b37d15915ca8925f231edb3afa8c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0f78d535e1faad9a982dca2a76d16da4649f7021&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x104c5b235166f26df54f52666d5e77d9e03e353e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x106b47175965b6d607008544267c91490672a54f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x1223d5c03b4d52ebed43f781251098c9138c3dd7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x1251d13cde439378349f039379e83c2641b6269f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x12c814cebee6bb08a5d1b9d009332bf8b536d645&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x150c63df3da35e590a6d2f7accf2e6f241ea5f1a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x15ddf20e4eb8b53b823bc45c9bad2670aad907dd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x1712b1c428f89bc695b1871abfff6b5097350150&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x178df2e27b781f024e90ab0abe9cff7e2f66a5fc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x1c2bd83dc29095173c4bcc14927811f5141c1373&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x1d12f2fad3603ea871fcb13ac3e30674f9ad903f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x1f7391b6881b6f025aef25cff737ff3fcb9d7660&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x219a3d724f596a4b75656e9b1569289c71782804&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x21a7fd9228c46ec72f926978f791fc8bfcd277fa&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x23acb760cebd01fe7c92361274a4077d37b59f4c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x23b249eeeeedd86bc40349f8bb8e2df34bd28f78&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x28d006b1a2309e957005ee575f422af8034f93df&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x28ef72d5614b2833d645aecf8ef7add075eb21e2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x292966802ffedb6f34f2c8c59df35c9d8f612c24&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x2c2661ddd320017138075aba06999440a902695f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x2c632be2dc2f47affd07bfce91bd4a27c02f4563&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x2f86de22ced85a7dd0d680fc4266929a72775e27&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x2fa04f15123025ab487dce71668f5265649d0598&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x30f78fd12c17855453e0db166fecf684bb239b8c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x31534e95353323209cd18ad35c22c2528db6d164&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x336e0e1a14e0136c02bf8dcf0a9a3fe408548262&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x340399588bba5b843883d1ad7afd771a3651447a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x341d2b82d0924ef42d75ce053654295d34839459&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x34c2b8975b47e13818f496cf80b40566798cf968&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x370e67f45db9c18d6551000e6c0918bc8d346ebf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x37149dae898296173d309f1de6981922ec1dc495&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x377cb0d3427af7f06df47d2ab420458834bed1fc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x3d473af3e6ce45183c781b414e8a9edcb8b26f72&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x42794c1d807079e16735e47e193825cec80ee28c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x45603aa97b67965b42b38ddc8884373edbcf2d56&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x465cb9df2f6d3c8a1c1ce3f2338823f0638fefa5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x49fbe69c2897bce0340b5983a0f719213a8c6e6f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x4a84cbd3ef642e301aa59bedf4fa4d28e24e6204&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x4d4d551bd6244b854e732572902f19f4ccaa6996&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x4f62af4ec150ea121859b3368e6a61fb7bcf9002&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x4fd1c530f73ddfff5c609a4a8b25af6ca489d1fd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x50010a4f0e429b398c66876dea7694d5f8b1a639&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x522c9f65bc77ad9eed6bcdc3ec220236451c9583&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x52b30ca3c2f8656e2c022e896bef7fad9a0449ca&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x537a7030ecd9d159e8231ce31b0c2e83b4f9ed75&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x5483a4c5583d5ba3db23676a3db346f47ba357e1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x55ec1a78a1187428dc0c67cbb77ae9fbdd61cc2a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x56cc1c0aadc2b8beb71f1ac61f03645483abe165&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x58bea8cea61fad5c453731aaeed377f3d77a04cc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x58f632327fbc4f449bda3bd51e13f590e67a8627&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x59d122afcbd68c731de85c2597004c6ddafbc7ed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x5da0228024cc084b9475470a7b7ae1d478d51bb7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x5e51d6621883afcbd4e999b93180a96909bdc766&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x5e9a0a1bdfdd868706f4554aae21bb2c46da32c2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x5f3f0d3215db85faa693d99acfb03cca66556671&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x5f6aa25f22edb2347b464312e2508cbc4c6e0162&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x6006f79e4104850ab7c9b0f75918c1e2cf6311df&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x60f5da58bccb716f58b5759a06fc2167fe237c26&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x62d3a444d0af59f9de79f8abeb5c942fcfbfbef5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x630ea66c8c5dc205d45a978573fa86df5af1fe7a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x6464f0f96a29934087a955c67a6b53d5ed852e49&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x6653cedb0b7f51c4b0c44079eb45c514df24ecfd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x66d69ac12b573299f36b108792be75a1e2ccdfdc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x690ed837d25b46dbf46727fcda7392d997c2bc97&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x696eecbc97189c5b2a8245a8e32517db9960c171&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x69aaff0b7babe85e0a95adfc540e689399db7f24&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x6b71d2ceab5678b607aa1e69b6781f5c7abc9aaf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x6e03d9cce9d60f3e9f2597e13cd4c54c55330cfd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x6e278cfecfe96fa5e6d5411ba6eeb765dff4f118&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x6e557f01c9dcb573b03909c9a5b3528aec263472&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x6ec268f8bef9c685d7e04d5cdb61fbb544869a9f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x6f2ba051b3ce06a90705c22e0241c2b7e32c1af0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x7063732ced55cfa08aea520f3fe200c39b3df0f5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x7073a17a0172dfb1e46a62f054d11a775aeac32e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x71d3718cfa0f9ee8173688fe52bb499e1f36534b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x74e20aec156674945894d404f8dea602570e62f5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x783e45c2989e675ffc9d067914d7de3ff68aee58&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x7a5f843f884bb15d070806e1ff59b6c6f74bbe2d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x7c6b1706c86ea76a0e232324f249e1508ca2dfda&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x7d23a23584c83c1f6636124255cfd8e9cfc0e529&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x7e8b5df0dec9168741c93d52d7045aca7ea632d3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x7ec5da0f1036750688084252b802befe41551205&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x82c9fcef4dd2d374b000063d4899a38a7219cdc7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x82fa2ab30a566ceeac987eb5510485be9382f130&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x83d927aca3266f94e8163eaa32700c70e9b76e6e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x8476f7e193c930f21e88dae84888e0d8bfaf3ed8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x85ec166cb81f5010b4a8d365821473dac0c0aa88&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x8883c55943d5caf06b6484de9c1d73da8307cd82&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x8c07456cffd4254c89aaaa9d4e95c8b3e36c2a3b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x8fef965e5db6f7f1a165008499e8b7901cd766b2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x9018e2967c15e1faed9b5d6439522f075535a683&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x903f1d8a086c6af1afe24648b6409aade83c4340&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x9127c398827d8db6b6d5f17b71f5db69d06e8b74&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x917b5be6e3acd96d40a33c13e6748e4a88576c6d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x91edfd05112f0bc9d6cd43b65361713a50e9eb7f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x93026a2c4a0bc69de31515070bf086e0c1f789e5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x94863bbbc12ec5be148f60a7020fd49236fc1937&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x94befc001e203f141462f16bde60873bcefae401&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x94c408cf5934f241d4fdd55ff3825131635c6af2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x94cfdec548de92301735dc0b82d8e1f79404ff94&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x96527f3311f44340887c926acc16f0997eb3b955&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x974117faf194885c01513e8d87b38a2291083ed5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x993424827a5fb2fa97818814ea4027e28150f187&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x9a6f30a5cb46840076edd780da2dbb4bc7c39f24&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x9a74a096b0bb82adfd28494107f2c07f4545723e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x9af82ec46185641c0ea44679aac8a7e7570be202&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x9e2287a60ed85f6bd80c62c1b7b4130ea1b521dd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x9fee5b81ee0cbf34c18c52061f1b257d4ccb2702&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xa017226377e775af8e56450301cc035ae72267f8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xa1b423e024daf925f25296ea2efcf009cc328873&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xa23c0cbfe59e8650277ffa635c59f287cece9087&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xa340b7625eec76b372f2c317fe08a7733f05d09c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xa4cb6be13c2eace6c0f1157553e3c446f7b38b10&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xa54326267784fae3ffd6800af38099753bb7f470&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xa580086125d040fddd3af9d563285bd0ec4d13e3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xa88fc7a34ca36b952aa45d94c1e13155042b5e7d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xac8f4ce2e4eff39c738bf1941350b3b57e8eec4f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xacb17dca110db022b1aceb5399acba1e9bf577e3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xae0b03c8d8bf9cf71eda758e9e8b59c70a3b4580&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xae365ff4b0c64413baf6f7dfdb5cd3fb65ad1376&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xaf7e60d02b425b54730b7281a97d1640233704b0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xaf9846f8098656e7c2f0e53e9ff7d38ec7b7f679&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xb2784c0a95e9b6b865aca13556fb32e2f37cb775&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xb385fa211cd08326ff84b0d4f37cc8c3735aa3aa&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xb3fb883cbbccb0551daf1507f87426fd38da087e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xb6515cfb82fa877fbadae5a87006a8d3deeeb7c9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xb78c4f0b8c9ec0b3058724eca65292d0d65586b9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xba25f341e16ee81ab80ea246d45bdead7cc339e5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xbab14024437285c2e3b3c521abff96b0ef2e919f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xbaf0996297cc70fca1bee30162eabcd892f0574a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xbb01ea95321a94242c89479995b7e3f264cb46a0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xc1b37a3b7f76947e24cc2470e0e948aab0181346&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xc24431c1a1147456414355b1f1769de450e524da&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xc467b893e29277f9b62b4ed6c9ba054bd8225bff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xc4bc101a168ea2228973a65564a7d40a68528dd2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xc784626571c2c25cd2cfe24192a149cad86d40d8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xc7acf90a9f442855b8f291288bb5fb612536ed9b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xc9956593dbfb46cfd24686a365b34051a55abce6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xca2eb2af7dd7a90777c8c6456efcc00fe56dbd6f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xcb4bb078edaae9393c8da27b809aa9c0f4c920b7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xcc8f68e8e2d8196e2ecd0caf2f35b1611739a21f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xcd67903318a805d63fe79bf9b8401c1b79c6babf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xcd7a2fe9cb80c95b03950daf5b6d476bec9ac24d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xd09476f5ee7979becca8ffe6dc22a72565fc3cea&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xd1c4bd2b583f445354d1b644ea4b8353f2d23048&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xd32bb8bceafc89ff59ba43ce8b6cd65bb06dd7b0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xd49e9fa792db9d9398c57eabf94ba1b2c709ace7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xd6b862cf0d009bde0f020ab9d8f96e475069c5c6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xd747c05d9c8057db608ef7aedabf07e4db0bbe97&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xdb9b40d1b691ced3680e539261b6bc195388b3c0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xdbcc502093cadd0feb709708c633e2427aeb9c2d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xdc53001181ddc6a279deea6419443ea0ac0aec9c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xde3b38cb1050e7b5db39b4cbb2b2b63a1e32cbf6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xdf1b687a99216ad4ebf9176983bf165be7b25bbe&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xe000662c02a02d8b40aabfcd661594312992311d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xe30c59e4dc19d7c9ed6eb10d734d4d7ef28403ac&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xe415114089b4b4933e542a5c79af4b6e6cd7abc9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xe47f0a0e93241d390fe9b99de852682522e847bc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xe54abbd51e324bf8cf349b6b31c01b043d1ee0e4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xe57838f777b11fdc428d9e7e67f1187d6251ba1f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xe5e4b26325d0fbf551367f2cf3b5d01caed6abcf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xe6655208bd812d833238b560e847014b0aab3b51&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xe6e16a1023af4a8fe54669f3fce7c406801bb333&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xe727bba699fbe82a731dad9476b5234d0038cfa1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xec361d34a55e24e2f77de7121ae2b7bf11ed0d65&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xed3bf94976eb11d55b955d1369a478620872b57c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xee93ad447fe6a0e2bbac4952e651b21c0175acad&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xefc5d9cabc0bda8124e1b821e8c86c7e7bf1e4bc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xf272f72a00f166f491d994642c8243099b72d2cd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xf45f642034bbce869e31b05d1da919125c7331ee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xf4883b21724405b19e240f3309a64d16dd89adc7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xf5cb2a87ff1095f6d93e7b4bfc1bc47542380550&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xf6ddd386c4f7f0b460032c8055d7f9c3503d7140&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xf72093096c81b3e9e991f5b737baec9570a56927&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xf7412232a7a731bca2e5554c8ee051274373c17c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xfc2321dc32c2e6e96a0e41c911fb73a7b278d5c8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xfc4dc782bf7e81a2ed5cc0519f80de36e7931bd9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xfcde1c261eb257e14491b4e7cb1949a7623c00c5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xfd17a22fd80075f2716e93268aa01bcdd7d70b22&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;  &lt;&#x2F;details&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;EIP-161 provides that empty accounts (accounts that have zero nonce, zero balance and no code, but that might have storage) can no longer be created and provides mechanism to remove old empty accounts. The last empty accounts were removed in block 14049881 (tx &lt;code&gt;0xf955834bfa097458a9cf6b719705a443d32e7f43f20b9b0294098c205b4bcc3d&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;The complete removal of all empty accounts ensures that certain edgecases of EIP-161 can never occur on Ethereum Mainnet. Continuing to define and test those cases as part of the Ethereum Specification burdens future client implementors with unnecessary technical debt. This EIP declares those cases undefined and leaves clients free to assume they will not occur.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is identical to EIP-161 except for the following differences, none of which affect Ethereum Mainnet. The differences are:&lt;&#x2F;p&gt;
&lt;h3 id=&quot;potentially-state-changing-operations&quot;&gt;&quot;Potentially state-changing operations&quot;&lt;&#x2F;h3&gt;
&lt;p&gt;EIP-161 specifies 11 &quot;potentially state-changing operations&quot; that trigger state clearing. All but the 3 listed in this EIP are irrelevant, for the following reasons:&lt;&#x2F;p&gt;
&lt;h4 id=&quot;impossible&quot;&gt;Impossible&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Receiving zero value mining reward&#x2F;fees (this would become possible after the merge).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;cannot-happen-to-an-empty-account&quot;&gt;Cannot happen to an empty account&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Being the source of a &lt;code&gt;CREATE&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Being the source of a &lt;code&gt;CALL&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Being refunded by a &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;causes-the-account-to-become-non-empty&quot;&gt;Causes the account to become non-empty&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Being the sender of a message call transaction.&lt;&#x2F;li&gt;
&lt;li&gt;Being the sender of a contract creation transaction.&lt;&#x2F;li&gt;
&lt;li&gt;Being created by a &lt;code&gt;CREATE&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Being created by a contract creation transaction.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;interaction-with-staticcall&quot;&gt;Interaction with &lt;code&gt;STATICCALL&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The interaction between &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; and account clearing has never been specified in an EIP. The Ethereum currently testsuite requires that &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; triggers state clearing.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP formally undefines all interactions between &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; and state clearing as it has never happened on Ethereum Mainnet and cannot happen in future.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;at-the-end-of-the-transaction&quot;&gt;&quot;At the end of the transaction&quot;&lt;&#x2F;h3&gt;
&lt;p&gt;This only makes a difference if an account is deleted and later recreated in the same transaction. This never happens on Ethereum Mainnet.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h3&gt;
&lt;p&gt;All test cases involving empty accounts in the Ethereum execution layer test suite shall be removed unless they relate to the Spurious Dragon Hardfork. If a Spurious Dragon test relates involved deprecated edgecase the test must be removed or reworked.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;other-networks&quot;&gt;Other networks&lt;&#x2F;h3&gt;
&lt;p&gt;Ropsten had empty accounts seeded at genesis. They appear to have been cleared early in Ropsten&#x27;s history before the Byzantium hardfork. Ropsten has never been checked for edgecases occurring. All other Ethereum testnets have had EIP-161 from genesis.&lt;&#x2F;p&gt;
&lt;p&gt;As a security precaution all empty accounts on Ethereum Classic have been cleared, but no checks for edgecases occurring have been done. Due to EIP-161&#x27;s age the vast majority of EVM compatible networks have supported it from genesis.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is only equivalent to EIP-161 on Ethereum Mainnet if the following facts are true:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;No empty accounts are ever touched and then reinstated in the same transaction.&lt;&#x2F;li&gt;
&lt;li&gt;The transactions in the Appendix are the only state clearing transactions on Ethereum Mainnet after block 4370000 (start of Byzantium).&lt;&#x2F;li&gt;
&lt;li&gt;All empty accounts have been removed on Ethereum Mainnet.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Limit transaction gas to a maximum of 2^63-1</title>
        <published>2022-02-02T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4803/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-4803-limit-transaction-gas-to-a-maximum-of-2-63-1/8296" />
        

        <id>https://wg-eips.ritovision.com/4803/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:4803"
            label="EIP-4803" />
        

        
        

        
        <summary type="html">Valid transactions must have a reasonable gas limit</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4803/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Limit transaction gas to be between &lt;code&gt;0&lt;&#x2F;code&gt; and &lt;code&gt;2^63-1&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The gas limit field in the transaction is specified to be an arbitrary long unsigned integer, but various clients put limits on this value. This EIP brings a reasonable limit into consensus.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce one new restriction retroactively from genesis: any transaction is invalid and not includeable in a block, where the gas limit exceeds &lt;code&gt;2^63-1&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;2-63-1-vs-2-64-1&quot;&gt;&lt;code&gt;2^63-1&lt;&#x2F;code&gt; vs &lt;code&gt;2^64-1&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;2^63-1&lt;&#x2F;code&gt; is chosen because it allows representing the gas value as a signed integer, and so the out of gas check can be done as a simple &quot;less than zero&quot; check after subtraction.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;consider-2-31-1&quot;&gt;Consider &lt;code&gt;2^31-1&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;An alternative is considering a lower limit, because this can be handled easily in Javascript, since it handles numbers as floating point (the actual upper bound is &lt;code&gt;2^53-1&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;current-limit&quot;&gt;Current limit&lt;&#x2F;h3&gt;
&lt;p&gt;Due to the nature of RLP encoding, there is no fixed upper bound for the value, but most implementations limit it to 256-bits. Furthermore, most client implementations (such as geth) internally handle gas as a 64-bit value.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;While this is a breaking change, no actual effect should be visible.&lt;&#x2F;p&gt;
&lt;p&gt;Before &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; it was possible to include transactions with &lt;code&gt;gasPrice = 0&lt;&#x2F;code&gt; and thus the &lt;code&gt;gasLimit * gasPrice &amp;lt;= accountBalance&lt;&#x2F;code&gt; calculation could have allowed for arbitrarily large values of &lt;code&gt;gasLimit&lt;&#x2F;code&gt;. However, the rule that the transaction list cannot exceed the block gas limit, and the strict rules about how the block gas limit can change, prevented arbitrarily large values of &lt;code&gt;gasLimit&lt;&#x2F;code&gt; to be in the historical state.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;None.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Consensus Layer Withdrawal Protection</title>
        <published>2022-01-30T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Benjamin Chodroff</name><uri>https://github.com/benjaminchodroff</uri>
	</author>
	
	<author>
		<name>Jim McDonald</name><uri>https://github.com/mcdee</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4736/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/consensus-layer-withdrawal-protection/8161" />
        

        <id>https://wg-eips.ritovision.com/4736/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="interface"
                label="Interface" />
            
        

        
        <category
            term="tag:eip:4736"
            label="EIP-4736" />
        

        
        

        
        <summary type="html">Additional security for BLSToExecutionChange operation when a consensus layer mnemonic may be compromised, without changing consensus</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4736/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;If a consensus layer mnemonic phrase is compromised, it is impossible for the consensus layer network to differentiate the legitimate holder of the key from an illegitimate holder. However, there are signals that can be considered in a wider sense without changing core Ethereum consensus. This proposal outlines ways in which on chain evidence such as the execution layer deposit address and list of signed messages could create a social consensus that would significantly favor but not guarantee legitimate mnemonic holders would win a race condition against an attacker.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The consensus layer &lt;code&gt;BLSToExecutionChange&lt;&#x2F;code&gt; message is secure for a single user who has certainty their keys and mnemonic have not been compromised. However, as validator withdrawals on the consensus layer are not possible until the Capella hard fork, no user can have absolute certainty that their keys are not compromised until the &lt;code&gt;BLSToExecutionChange&lt;&#x2F;code&gt; is on chain, and by then too late to change. All legitimate mnemonic phrase holders were originally in control of the execution layer deposit address. Beacon node clients and node operators may optionally load a list of verifiable &lt;code&gt;BLSToExecutionChange&lt;&#x2F;code&gt; messages to broadcasts that may create a social consensus for legitimate holders to successfully win a race condition against an attacker. If attackers compromise a significant number of consensus layer nodes, it would pose risks to the entire Ethereum community.&lt;&#x2F;p&gt;
&lt;p&gt;Setting a withdrawal address to an execution layer address was not supported by the eth2.0-deposit-cli until v1.1.1 on March 23, 2021, leaving early adopters wishing they could force set their execution layer address to a deposit address earlier. Forcing this change is not something that can be enforced in-protocol, partly due to lack of information on the beacon chain about the execution layer deposit address and partly due to the fact that this was never listed as a requirement. It is also possible that the execution layer deposit address is no longer under the control of the legitimate holder of the withdrawal private key.&lt;&#x2F;p&gt;
&lt;p&gt;However, it is possible for individual nodes to locally restrict the changes they wish to include in blocks they propose, and which they propagate around the network, in a way that does not change consensus. It is also possible for client nodes to help broadcast signed &lt;code&gt;BLSToExecutionChange&lt;&#x2F;code&gt; requests to ensure as many nodes witness this message as soon as possible in a fair manner. Further, such &lt;code&gt;BLSToExecutionChange&lt;&#x2F;code&gt; signed messages can be preloaded into clients in advance to further help nodes filter attacking requests.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal provides purely optional additional protection. It aims to request nodes set a priority on withdrawal credential claims that favour a verifiable execution layer deposit address in the event of two conflicting &lt;code&gt;BLSToExecutionChange&lt;&#x2F;code&gt; messages. It also establishes a list of &lt;code&gt;BLSToExecutionChange&lt;&#x2F;code&gt; signed messages to help broadcast &quot;as soon as possible&quot; when the network supports it, and encourage client teams to help use these lists to honour filter and prioritize accepting requests by REST and transmitting them via P2P. This will not change consensus, but may help prevent propagating an attack where a withdrawal key has been knowingly or unknowingly compromised.&lt;&#x2F;p&gt;
&lt;p&gt;It is critical to understand that this proposal is not a consensus change. Nothing in this proposal restricts the validity of withdrawal credential operations within the protocol. It is a voluntary change by client teams to build this functionality in to their beacon nodes, and a voluntary change by node operators to accept any or all of the restrictions and broadcasting capabilities suggested by end users.&lt;&#x2F;p&gt;
&lt;p&gt;Because of the above, even if fully implemented, it will be down to chance as to which validators propose blocks, and which voluntary restrictions those validators’ beacon nodes are running. Node operators can do what they will to help the community prevent attacks on any compromised consensus layer keys, but there are no guarantees of success this will prevent a successful attack.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The Consensus Layer &lt;code&gt;BLSToExecutionChange&lt;&#x2F;code&gt; operation has the following fields:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Validator index&lt;&#x2F;li&gt;
&lt;li&gt;Current withdrawal BLS public key&lt;&#x2F;li&gt;
&lt;li&gt;Proposed execution layer withdrawal address&lt;&#x2F;li&gt;
&lt;li&gt;Signature by withdrawal private key over the prior fields&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This proposal describes OPTIONAL and RECOMMENDED mechanisms which a client beacon node MAY implement, and end users are RECOMMENDED to use in their beacon node operation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;blstoexecutionchange-broadcast-file&quot;&gt;&lt;code&gt;BLSToExecutionChange&lt;&#x2F;code&gt; Broadcast File&lt;&#x2F;h3&gt;
&lt;p&gt;Beacon node clients MAY support an OPTIONAL file of lines specifying &quot;validator index&quot; , &quot;current withdrawal BLS public key&quot; , &quot;proposed execution layer withdrawal address&quot;, and &quot;signature&quot; which, if implemented and if provided, SHALL instruct nodes to automatically submit a one-time &lt;code&gt;BLSToExecutionChange&lt;&#x2F;code&gt; broadcast message for each valid signature at the Capella hard fork. This file SHALL give all node operators an OPTIONAL opportunity to ensure any valid &lt;code&gt;BLSToExecutionChange&lt;&#x2F;code&gt; messages are broadcast, heard, and shared by nodes at the Capella hard fork. This OPTIONAL file SHALL also instruct nodes to perpetually prefer accepting and repeating signatures matching the signature in the file, and SHALL reject accepting or rebroadcasting messages which do not match a signature for a given withdrawal credential.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;blstoexecutionchange-handling&quot;&gt;&lt;code&gt;BLSToExecutionChange&lt;&#x2F;code&gt; Handling&lt;&#x2F;h3&gt;
&lt;p&gt;Beacon node clients are RECOMMENDED to allow accepting &quot;&lt;code&gt;BLSToExecutionChange&lt;&#x2F;code&gt; Broadcast&quot; file of verifiable signatures, and then MAY fallback to accept a &quot;first request&quot; via P2P. All of this proposal is OPTIONAL for beacon nodes to implement or use, but all client teams are RECOMMENDED to allow a &quot;&lt;code&gt;BLSToExecutionChange&lt;&#x2F;code&gt; Broadcast File&quot; to be loaded locally before the Capella hard fork. This OPTIONAL protection will allow a user to attempt to set a withdrawal address message as soon as the network supports it without any change to consensus.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal is intended to protect legitimate validator mnemonic holders where it was knowingly or unknowingly compromised. As there is no safe way to transfer ownership of a validator without exiting, it can safely be assumed that all validator holders intend to set to a withdrawal address they specify. Using the deposit address in the execution layer to determine the legitimate holder is not possible to consider in consensus as it may be far back in history and place an overwhelming burden to maintain such a list. As such, this proposal outlines optional mechanism which protect legitimate original mnemonic holders and does so in a way that does not place any mandatory burden on client node software or operators.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;As there is no existing &lt;code&gt;BLSToExecutionChange&lt;&#x2F;code&gt; operation prior to Capella, there is no documented backwards compatibility. As all of the proposal is OPTIONAL in both implementation and operation, it is expected that client beacon nodes that do not implement this functionality would still remain fully backwards compatible with any or all clients that do implement part or all of the functionality described in this proposal. Additionally, while users are RECOMMENDED to enable these OPTIONAL features, if they decide to either disable or ignore some or all of the features, or even purposefully load content contrary to the intended purpose, the beacon node client will continue to execute fully compatible with the rest of the network as none of the proposal will change core Ethereum consensus.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;blstoexecutionchange-broadcast-file-1&quot;&gt;&lt;code&gt;BLSToExecutionChange&lt;&#x2F;code&gt; Broadcast File&lt;&#x2F;h3&gt;
&lt;p&gt;A &quot;change-operations.json&quot; file intended to be preloaded with all consensus layer withdrawal credential signatures and verifiable execution layer deposit addresses. This file may be generated by a script and able to be independently verified by community members using the consensus layer node, and intended to be included by all clients, enabled by default. Client nodes are encouraged to enable packaging this independently verifiable list with the client software, and enable it by default to help further protect the community from unsuspected attacks.&lt;&#x2F;p&gt;
&lt;p&gt;The change-operations.json format is the &quot;&lt;code&gt;BLSToExecutionChange&lt;&#x2F;code&gt; File - Claim&quot; combined into a single JSON array.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;blstoexecutionchange-broadcast-file-claim&quot;&gt;&lt;code&gt;BLSToExecutionChange&lt;&#x2F;code&gt; Broadcast File - Claim&lt;&#x2F;h3&gt;
&lt;p&gt;A community collected and independently verifiable list of &quot;&lt;code&gt;BLSToExecutionChange&lt;&#x2F;code&gt; Broadcasts&quot; containing verifiable claims will be collected. Node operators may verify these claims independently and are suggested to load claims in compatible beacon node clients.&lt;&#x2F;p&gt;
&lt;p&gt;To make a verifiable claim, users MAY upload a claim to any public repository in a text file &quot;[chain]&#x2F;validatorIndex.json&quot; such as &quot;mainnet&#x2F;123456.json&quot;.&lt;&#x2F;p&gt;
&lt;p&gt;123456.json:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[{&amp;quot;message&amp;quot;:{&amp;quot;validator_index&amp;quot;:&amp;quot;123456&amp;quot;,&amp;quot;from_bls_pubkey&amp;quot;:&amp;quot;0x977cc21a067003e848eb3924bcf41bd0e820fbbce026a0ff8e9c3b6b92f1fea968ca2e73b55b3908507b4df89eae6bfb&amp;quot;,&amp;quot;to_execution_address&amp;quot;:&amp;quot;0x08f2e9Ce74d5e787428d261E01b437dC579a5164&amp;quot;},&amp;quot;signature&amp;quot;:&amp;quot;0x872935e0724b31b2f0209ac408b673e6fe2f35b640971eb2e3b429a8d46be007c005431ef46e9eb11a3937f920cafe610c797820ca088543c6baa0b33797f0a38f6db3ac68ffc4fd03290e35ffa085f0bfd56b571d7b2f13c03f7b6ce141c283&amp;quot;}]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;claim-acceptance&quot;&gt;Claim Acceptance&lt;&#x2F;h4&gt;
&lt;p&gt;In order for a submission to be merged into public repository, the submission must have:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Valid filename in the format validatorIndex.json&lt;&#x2F;li&gt;
&lt;li&gt;Valid validator index which is active on the consensus layer&lt;&#x2F;li&gt;
&lt;li&gt;Verifiable signature&lt;&#x2F;li&gt;
&lt;li&gt;A single change operation for a single validator, with all required fields in the file with no other content present&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;All merge requests that fail will be provided a reason from above which must be addressed prior to merge. Any future verifiable amendments to accepted claims must be proposed by the same submitter, or it will be treated as a contention.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;blstoexecutionchange-broadcast&quot;&gt;&lt;code&gt;BLSToExecutionChange&lt;&#x2F;code&gt; Broadcast&lt;&#x2F;h4&gt;
&lt;p&gt;Anyone in the community will be able to independently verify the files from the claims provided using the Capella spec and command line clients such as &quot;ethdo&quot; which support the specification.&lt;&#x2F;p&gt;
&lt;p&gt;A claim will be considered contested if a claim arrives where the verifiable consensus layer signatures differ between two or more submissions, where neither party has proven ownership of the execution layer deposit address. If a contested but verified &quot;&lt;code&gt;BLSToExecutionChange&lt;&#x2F;code&gt; Broadcast&quot; request arrives to a repository, all parties can be notified, and may try to convince the wider community by providing any publicly verifiable on chain evidence or off chain evidence supporting their claim to then include their claim in nodes. Node operators may decide which verifiable claims they wish to include based on social consensus.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;1-attacker-lacks-el-deposit-key-uncontested-claim&quot;&gt;1: Attacker lacks EL deposit key, uncontested claim&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;User A: Controls the CL keys and the EL key used for the deposit&lt;&#x2F;li&gt;
&lt;li&gt;User B: Controls the CL keys, but does not control the EL key for the deposit&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;User A signs and submits a claim to the CLWP repository, clients load User A message into the &quot;&lt;code&gt;BLSToExecutionChange&lt;&#x2F;code&gt; Broadcast&quot; file. At the time of the first epoch support &lt;code&gt;BLSToExecutionChange&lt;&#x2F;code&gt;, many (not all) nodes begin to broadcast the message. User B also tries to submit a different but valid &lt;code&gt;BLSToExecutionChange&lt;&#x2F;code&gt; to an address that does not match the signature in the claim. This message is successfully received via REST API, but some (not all) nodes begin to silently drop this message as the signature does not match the signature in the &quot;&lt;code&gt;BLSToExecutionChange&lt;&#x2F;code&gt; Broadcast&quot; file. As such, these nodes do not replicate this message via P2P.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;2-attacker-has-both-el-deposit-key-and-cl-keys-uncontested-claim&quot;&gt;2: Attacker has both EL deposit key and CL keys, uncontested claim&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;User A: Controls the CL key&#x2F;mnemonic and the EL key used for the deposit, and submits a claim to move to a new address&lt;&#x2F;li&gt;
&lt;li&gt;User B: Controls the CL and EL key&#x2F;mnemonic used for the EL deposit, but fails to submit a claim&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;It is possible&#x2F;likely that User A would notice that all their funds in the EL deposit address had been stolen. This may signal that their CL key is compromised as well, so they decide to pick a new address for the withdrawal. The story will play out the same as Scenario 1 as the claim is uncontested.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;3-same-as-2-but-the-attacker-submits-a-contested-claim&quot;&gt;3: Same as #2, but the attacker submits a contested claim&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;User A: Controls the CL keys&#x2F;mnemonic and the EL key used for the deposit, and submits a claim to move to a new address&lt;&#x2F;li&gt;
&lt;li&gt;User B: Controls the CL keys&#x2F;mnemonic and the EL key used for the deposit, and submits a claim to move to a new address&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This is a contested claim and as such there is no way to prove who is in control using on chain data. Instead, either user may try to persuade the community they are the rightful owner (identity verification, social media, etc.) in an attempt to get node operators to load their contested claim into their &quot;&lt;code&gt;BLSToExecutionChange&lt;&#x2F;code&gt; Broadcast&quot; file. However, there is no way to fully prove it.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;4-a-user-has-lost-either-their-cl-key-and-or-mnemonic-no-withdrawal-key&quot;&gt;4: A user has lost either their CL key and&#x2F;or mnemonic (no withdrawal key)&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;User A: Lacks the CL keys and mnemonic&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;There is no way to recover this scenario with this proposal as we cannot prove a user has lost their keys, and the mnemonic is required to generate the withdrawal key.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;5-end-game-attacker&quot;&gt;5: End game - attacker&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;User A: Controls EL and CL key&#x2F;mnemonic, successfully achieves a set address withdrawal&lt;&#x2F;li&gt;
&lt;li&gt;User B: Controls CL key, decides to attack&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Upon noticing User A has submitted a successful set address withdrawal, User B may run a validator and attempt to get User A slashed. Users who suspect their validator key or seed phrase is compromised should take action to exit their validator as early as possible.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;6-compromised-key-but-not-vulnerable-to-withdrawal&quot;&gt;6: Compromised key, but not vulnerable to withdrawal&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;User A: Controls EL and CL key&#x2F;mnemonic, but has a vulnerability which leaks their CL key but NOT their CL mnemonic&lt;&#x2F;li&gt;
&lt;li&gt;User B: Controls the CL key, but lacks the CL mnemonic&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;User A may generate the withdrawal key (requires the mnemonic). User B can attack User A by getting them slashed, but will be unable to generate the withdrawal key.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;7-attacker-loads-a-malicious-blstoexecutionchange-broadcast-file-into-one-or-multiple-nodes-user-a-submits-claim&quot;&gt;7: Attacker loads a malicious &lt;code&gt;BLSToExecutionChange&lt;&#x2F;code&gt; Broadcast file into one or multiple nodes, User A submits claim&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;User A: Submits a valid uncontested claim which is broadcast out as soon as possible by many nodes&lt;&#x2F;li&gt;
&lt;li&gt;User B: Submits no claim, but broadcasts a valid malicious claim out through their &lt;code&gt;BLSToExecutionChange&lt;&#x2F;code&gt; Broadcast list, and blocks User A&#x27;s claim from their node.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;User B&#x27;s claim will make it into many nodes, but when it hits nodes that have adopted User A&#x27;s signature they will be dropped and not rebroadcast. Statistically, User B will have a harder time achieving consensus among the entire community, but it will be down to chance.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;8-same-as-7-but-user-a-submits-no-claim&quot;&gt;8: Same as #7, but User A submits no claim&lt;&#x2F;h3&gt;
&lt;p&gt;The attacker will statistically likely win as they will be first to have their message broadcast to many nodes and, unless User A submits a request exactly at the time of support, it is unlikely to be heard by enough nodes to gain consensus. All users are encouraged to submit claims for this reason because nobody can be certain their mnemonic has not been compromised until it is too late.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;second-order-effects&quot;&gt;Second Order Effects&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;A user who participates in the &quot;&lt;code&gt;BLSToExecutionChange&lt;&#x2F;code&gt; Broadcast&quot; may cause the attacker to give up early and instead start to slash. For some users, the thought of getting slashed is preferable to giving an adversary any funds. As the proposal is voluntary, users may choose not to participate if they fear this scenario.&lt;&#x2F;li&gt;
&lt;li&gt;The attacker may set up their own &lt;code&gt;BLSToExecutionChange&lt;&#x2F;code&gt; Broadcast to reject signatures not matching their attack. This is possible with or without this proposal.&lt;&#x2F;li&gt;
&lt;li&gt;The attacker may be the one collecting &quot;&lt;code&gt;BLSToExecutionChange&lt;&#x2F;code&gt; Broadcast&quot; claims for this proposal and may purposefully reject legitimate requests. Anyone is free to set up their own community claim collection and gather their own community support using the same mechanisms described in this proposal to form an alternative social consensus.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Shareable Non-Fungible Token</title>
        <published>2022-01-28T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Jarno Marttila</name><uri>https://github.com/yaruno</uri>
	</author>
	
	<author>
		<name>Martin Moravek</name><uri>https://github.com/mmartinmo</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5023/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/new-nft-concept-shareable-nfts/8681" />
        

        <id>https://wg-eips.ritovision.com/5023/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:5023"
            label="ERC-5023" />
        

        
        

        
        <summary type="html">An interface for creating value-holding tokens shareable by multiple owners</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5023/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP standardizes an interface for non-fungible value-holding shareable tokens. Shareability is accomplished by minting copies of existing tokens for new recipients. Sharing and associated events allow the construction of a graph describing who has shared what to which party.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;NFT standards such as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;EIP-1155&lt;&#x2F;a&gt; have been developed to standardize scarce digital resources. However, many non-fungible digital resources need not be scarce.&lt;&#x2F;p&gt;
&lt;p&gt;We have attempted to capture positive externalities in ecosystems with new types of incentive mechanisms that exhibit anti-rival logic, serve as an unit of accounting and function as medium of sharing. We envision that shareable tokens can work both as incentives but also as representations of items that are typically digital in their nature and gain more value as they are shared.&lt;&#x2F;p&gt;
&lt;p&gt;These requirements have set us to define shareable NFTs and more specifically a variation of shareable NFTs called non-transferable shareable NFTs. These shareable NFTs can be “shared” in the same way digital goods can be shared, at an almost zero technical transaction cost. We have utilized them to capture anti-rival value in terms of accounting positive externalities in an economic system.&lt;&#x2F;p&gt;
&lt;p&gt;Typical NFT standards such as EIP-721 and EIP-1155 do not define a sharing modality. Instead ERC standards define interfaces for typical rival use cases such as token minting and token transactions that the NFT contract implementations should fulfil. The ‘standard contract implementations&#x27; may extend the functionalities of these standards beyond the definition of interfaces. The shareable tokens that we have designed and developed in our experiments are designed to be token standard compatible at the interface level. However the implementation of token contracts may contain extended functionalities to match the requirements of the experiments such as the requirement of &#x27;shareability&#x27;. In reflection to standard token definitions, shareability of a token could be thought of as re-mintability of an existing token to another party while retaining the original version of it.&lt;&#x2F;p&gt;
&lt;p&gt;Sharing is an interesting concept as it can be thought and perceived in different ways. For example, when we talk about sharing we can think about it is as digital copying, giving a copy of a digital resource while retaining a version by ourselves. Sharing can also be fractional or sharing could be about giving rights to use a certain resource. The concept of shareability and the context of shareability can take different forms and one might use different types of implementatins for instances of shareable tokens. Hence we haven&#x27;t restricted that the interface should require any specific token type.&lt;&#x2F;p&gt;
&lt;p&gt;Shareable tokens can be made non-transferable at the contract implementation level. Doing so, makes them shareable non-transferable tokens. In the reference implementation we have distilled a general case from our use cases that defines a shareable non-transferable NFTs using the shareable NFT interface.&lt;&#x2F;p&gt;
&lt;p&gt;We believe that the wider audience should benefit from an abstraction level higher definition for shareability, such as this interface implementation, that defines minimum amount of functions that would be implemented to satisfy the concept of shareability.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;  Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0xded6338b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5023&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC165&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when a token is shared, reminted and given to another wallet that isn&amp;#39;t function caller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Share&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; derivedFromtokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Shares, remints an existing token, gives a newly minted token a fresh token id, keeps original token at function callers possession and transfers newly minted token to receiver which should be another address than function caller. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; share&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIdToBeShared&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newTokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The Share event is expected to be emitted when function method share is successfully called and a new token on basis of a given token id is minted and transferred to a recipient.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Current NFT standards define transferable non-fungible tokens, but not shareable non-fungible tokens. To be able to create shareable NFTs we see that existing NFT contracts could be extended with an interface which defines the basic principles of sharing, namely the Event of sharing and the function method of sharing. Definition of how transferability of tokens should be handled is left to the contract implementor. In case transferring is left enable shareable tokens behave similarly to the existing tokens, except when they are shared, a version of token is retained. In case transfering is disabled, shareable tokens become shareable non-transferable tokens, where they can be minted and given or shared to other people, but they cannot be transferred away.&lt;&#x2F;p&gt;
&lt;p&gt;Imagine that Bob works together with Alice on a project. Bob earns an unique NFT indicating that he has made effort to the project, but Bob feels that his accomplishments are not only out of his own accord. Bob wants to share his token with Alice to indicate that also Alice deserves recognition of having put effort on their project. Bob initiates token sharing by calling &lt;code&gt;Share&lt;&#x2F;code&gt; method on the contract which has his token and indicates which one of his tokens he wishes to share and to whom by passing address and token id parameters. A new token is minted for Alice and a &lt;code&gt;Share&lt;&#x2F;code&gt; event is initiated to communicate that it was Bob whom shared his token to Alice by logging addresses who shared a token id to whose address and which token id was this new token derived from.&lt;&#x2F;p&gt;
&lt;p&gt;Over time, a tree-like structures can be formed from the Share event information. If Bob shared to Alice, and Alice shared further to Charlie and Alice also shared to David a rudimentary tree structure forms out from sharing activity. This share event data can be later on utilized to gain more information of share activities that the tokens represent.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;B -&amp;gt; A -&amp;gt; C &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;       &amp;gt;  D&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;These tree structures can be further aggregated and collapsed to network representations e.g. social graphs on basis of whom has shared to whom over a span of time. E.g. if Bob shared a token to Alice, and Alice has shared a different token to Charlie and Bob has shared a token to Charlie, connections form between all these parties through sharing activities.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; B----A----C         &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  \_______&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal is backwards compatible with EIP-721 and EIP-1155.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Following reference implementation demonstrates a general use case of one of our pilots. In this case a shareable non-transferable token represents a contribution done to a community that the contract owner has decided to merit with a token. Contract owner can mint a merit token and give it to a person. This token can be further shared by the receiver to other parties for example to share the received merit to others that have participated or influenced his contribution.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERC5023.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC721&#x2F;IERC721.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC721&#x2F;IERC721Receiver.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;utils&#x2F;Address.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;utils&#x2F;Context.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;utils&#x2F;Strings.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;utils&#x2F;introspection&#x2F;ERC165.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC721&#x2F;extensions&#x2F;IERC721Metadata.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC721&#x2F;extensions&#x2F;ERC721URIStorage.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;access&#x2F;Ownable.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ShareableERC721&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721URIStorage&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Ownable&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC5023&lt;&#x2F;span&gt;&lt;span&gt; &#x2F;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;EIP165&lt;&#x2F;span&gt;&lt;span&gt; *&#x2F; &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  string&lt;&#x2F;span&gt;&lt;span&gt; baseURI&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; _currentIndex&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _symbol&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_name, _symbol) &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setTokenURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenURI&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _setTokenURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenURI&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setBaseURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; baseURI_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        baseURI &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; baseURI_&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _baseURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; baseURI&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; share&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIdToBeShared&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newTokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;to &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC721: mint to the zero address&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_exists&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenIdToBeShared&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ShareableERC721: token to be shared must exist&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenIdToBeShared&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Method caller must be the owner of token&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; _tokenURI &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenIdToBeShared&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      _mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _currentIndex&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      _setTokenURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_currentIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _tokenURI&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Share&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _currentIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenIdToBeShared&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      return&lt;&#x2F;span&gt;&lt;span&gt; _currentIndex&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        revert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;#39;In this reference implementation tokens are not transferrable&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        revert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;#39;In this reference implementation tokens are not transferrable&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Reference implementation should not be used as is in production.
There are no other security considerations related directly to implementation of this standard.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Permission Token</title>
        <published>2022-01-19T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Chiro</name><uri>https://github.com/chiro-hiro</uri>
	</author>
	
	<author>
		<name>Victor Dusart</name><uri>https://github.com/vdusart</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6366/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6366-a-standard-for-permission-token/9105" />
        

        <id>https://wg-eips.ritovision.com/6366/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        

        
        <category
            term="tag:eip:6366"
            label="ERC-6366" />
        

        
        

        
        <summary type="html">A token that holds the permission of an address in an ecosystem</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6366/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP offers an alternative to Access Control Lists (ACLs) for granting authorization and enhancing security. A &lt;code&gt;uint256&lt;&#x2F;code&gt; is used to store permission of given address in a ecosystem. Each permission is represented by a single bit in a &lt;code&gt;uint256&lt;&#x2F;code&gt; as described in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6617&#x2F;&quot;&gt;ERC-6617&lt;&#x2F;a&gt;. Bitwise operators and bitmasks are used to determine the access right which is much more efficient and flexible than &lt;code&gt;string&lt;&#x2F;code&gt; or &lt;code&gt;keccak256&lt;&#x2F;code&gt; comparison.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Special roles like &lt;code&gt;Owner&lt;&#x2F;code&gt;, &lt;code&gt;Operator&lt;&#x2F;code&gt;, &lt;code&gt;Manager&lt;&#x2F;code&gt;, &lt;code&gt;Validator&lt;&#x2F;code&gt; are common for many smart contracts because permissioned addresses are used to administer and manage them. It is difficult to audit and maintain these system since these permissions are not managed in a single smart contract.&lt;&#x2F;p&gt;
&lt;p&gt;Since permissions and roles are reflected by the permission token balance of the relevant account in the given ecosystem, cross-interactivity between many ecosystems will be made simpler.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Note&lt;&#x2F;em&gt; The following specifications use syntax from Solidity &lt;code&gt;0.8.7&lt;&#x2F;code&gt; (or above)&lt;&#x2F;p&gt;
&lt;h3 id=&quot;core-interface&quot;&gt;Core Interface&lt;&#x2F;h3&gt;
&lt;p&gt;Compliant contracts MUST implement &lt;code&gt;IEIP6366Core&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;It is RECOMMENDED to define each permission as a power of &lt;code&gt;2&lt;&#x2F;code&gt; so that we can check for the relationship between sets of permissions using &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6617&#x2F;&quot;&gt;ERC-6617&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IEIP6366Core&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * MUST trigger when `_permission` are transferred, including `zero` permission transfers.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;           Permission owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;             Permission receiver&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _permission&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     Transferred subset permission of permission owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _permission&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * MUST trigger on any successful call to `approve(address _delegatee, uint256 _permission)`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;          Permission owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _delegatee&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      Delegatee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _permission&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     Approved subset permission of permission owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Approval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _delegatee&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _permission&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * Transfers a subset `_permission` of permission to address `_to`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * The function SHOULD revert if the message caller’s account permission does not have the subset&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * of the transferring permissions. The function SHOULD revert if any of transferring permissions are&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * existing on target `_to` address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;             Permission receiver&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _permission&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     Subset permission of permission owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _permission&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * Allows `_delegatee` to act for the permission owner&amp;#39;s behalf, up to the `_permission`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * If this function is called again it overwrites the current granted with `_permission`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * `approve()` method SHOULD `revert` if granting `_permission` permission is not&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * a subset of all available permissions of permission owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _delegatee&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      Delegatee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _permission&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     Subset permission of permission owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _delegatee&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _permission&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * Returns the permissions of the given `_owner` address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; permissionOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; permission&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * Returns `true` if `_required` is a subset of `_permission` otherwise return `false`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _permission&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     Checking permission set&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _required&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;       Required set of permission&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; permissionRequire&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _permission&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _required&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; isPermissioned&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * Returns `true` if `_required` permission is a subset of `_actor`&amp;#39;s permissions or a subset of his delegated&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * permission granted by the `_owner`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;          Permission owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _actor&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;          Actor who acts on behalf of the owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _required&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;       Required set of permission&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; hasPermission&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _actor&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _required&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; isPermissioned&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * Returns the subset permission of the `_owner` address were granted to `_delegatee` address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;          Permission owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _delegatee&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      Delegatee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; delegated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _delegatee&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; permission&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;metadata-interface&quot;&gt;Metadata Interface&lt;&#x2F;h3&gt;
&lt;p&gt;It is RECOMMENDED for compliant contracts to implement the optional extension &lt;code&gt;IEIP6617Meta&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;SHOULD define a description for the base permissions and main combinaison.&lt;&#x2F;p&gt;
&lt;p&gt;SHOULD NOT define a description for every subcombinaison of permissions possible.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;error-interface&quot;&gt;Error Interface&lt;&#x2F;h3&gt;
&lt;p&gt;Compatible tokens MAY implement &lt;code&gt;IEIP6366Error&lt;&#x2F;code&gt; as defined below:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IEIP6366Error&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * The owner or actor does not have the required permission&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AccessDenied&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt; _actor&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt; _permission&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * Conflict between permission set&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DuplicatedPermission&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; _permission&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * Data out of range&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OutOfRange&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;First implementation could be found here:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6366&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;EIP6366Core.sol&quot;&gt;ERC-6366 Core implementation&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Need more discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Non-Tradable Tokens Standard</title>
        <published>2022-01-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Omar Aflak</name><uri>https://github.com/omaraflak</uri>
	</author>
	
	<author>
		<name>Pol-Malo Le Bris</name>
	</author>
	
	<author>
		<name>Marvin Martin</name><uri>https://github.com/MarvinMartin24</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4671/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-4671-non-tradable-token/7976" />
        

        <id>https://wg-eips.ritovision.com/4671/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:4671"
            label="ERC-4671" />
        

        
        

        
        <summary type="html">A standard interface for non-tradable tokens, aka badges or souldbound NFTs.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4671/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;A non-tradable token, or NTT, represents inherently personal possessions (material or immaterial), such as university diplomas, online training certificates, government issued documents (national id, driving license, visa, wedding, etc.), labels, and so on.&lt;&#x2F;p&gt;
&lt;p&gt;As the name implies, non-tradable tokens are made to not be traded or transferred, they are &quot;soulbound&quot;. They don&#x27;t have monetary value, they are personally delivered to &lt;strong&gt;you&lt;&#x2F;strong&gt;, and they only serve as a &lt;strong&gt;proof of possession&#x2F;achievement&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;In other words, the possession of a token carries a strong meaning in itself depending on &lt;strong&gt;why&lt;&#x2F;strong&gt; it was delivered.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;We have seen in the past smart contracts being used to deliver university diplomas or driving licenses, for food labeling or attendance to events, and much more. All of these implementations are different, but they have a common ground: the tokens are &lt;strong&gt;non-tradable&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The blockchain has been used for too long as a means of speculation, and non-tradable tokens want to be part of the general effort aiming to provide usefulness through the blockchain.&lt;&#x2F;p&gt;
&lt;p&gt;By providing a common interface for non-tradable tokens, we allow more applications to be developed and we position blockchain technology as a standard gateway for verification of personal possessions and achievements.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;non-tradable-token&quot;&gt;Non-Tradable Token&lt;&#x2F;h3&gt;
&lt;p&gt;A NTT contract is seen as representing &lt;strong&gt;one type of certificate&lt;&#x2F;strong&gt; delivered by &lt;strong&gt;one authority&lt;&#x2F;strong&gt;. For instance, one NTT contract for the French National Id, another for Ethereum EIP creators, and so on...&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;An address might possess multiple tokens. Each token has a unique identifier: &lt;code&gt;tokenId&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;An authority who delivers a certificate should be in position to revoke it. Think of driving licenses or weddings. However, it cannot delete your token, i.e. the record will show that you once owned a token from that contract.&lt;&#x2F;li&gt;
&lt;li&gt;The most typical usage for third-parties will be to verify if a user has a valid token in a given contract.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: MIT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERC165.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC4671&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC165&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Event emitted when a token `tokenId` is minted for `owner`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Minted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Event emitted when token `tokenId` of `owner` is revoked&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Revoked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Count all tokens assigned to an owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address for whom to query the balance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Number&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; of tokens owned by `owner`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get owner of a token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Identifier of the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; of the owner of `tokenId`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check if a token hasn&amp;#39;t been revoked&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Identifier of the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; True&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if the token is valid, false otherwise&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isValid&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check if an address owns a valid token in the contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address for whom to check the ownership&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; True&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if `owner` has a valid token, false otherwise&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; hasValid&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;extensions&quot;&gt;Extensions&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;metadata&quot;&gt;Metadata&lt;&#x2F;h5&gt;
&lt;p&gt;An interface allowing to add metadata linked to each token.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: MIT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERC4671.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC4671Metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC4671&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Descriptive&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; name of the tokens in this contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; An&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; abbreviated name of the tokens in this contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; symbol&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; URI to query to get the token&amp;#39;s metadata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Identifier of the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; URI&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; for the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;enumerable&quot;&gt;Enumerable&lt;&#x2F;h5&gt;
&lt;p&gt;An interface allowing to enumerate the tokens of an owner.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: MIT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERC4671.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC4671Enumerable&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC4671&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; emittedCount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Number of tokens emitted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; emittedCount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; holdersCount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Number of token holders  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; holdersCount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the tokenId of a token using its position in the owner&amp;#39;s list&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address for whom to get the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; index&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Index of the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; of the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenOfOwnerByIndex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get a tokenId by it&amp;#39;s index, where 0 &amp;lt;= index &amp;lt; total()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; index&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Index of the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; of the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenByIndex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;delegation&quot;&gt;Delegation&lt;&#x2F;h5&gt;
&lt;p&gt;An interface allowing delegation rights of token minting.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: MIT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERC4671.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC4671Delegate&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC4671&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Grant one-time minting right to `operator` for `owner`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An allowed operator can call the function to transfer rights.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address allowed to mint a token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address for whom `operator` is allowed to mint a token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; delegate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Grant one-time minting right to a list of `operators` for a corresponding list of `owners`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An allowed operator can call the function to transfer rights.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; operators&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Addresses allowed to mint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owners&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Addresses for whom `operators` are allowed to mint a token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; delegateBatch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operators&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owners&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Mint a token. Caller must have the right to mint for the owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address for whom the token is minted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Mint tokens to multiple addresses. Caller must have the right to mint for all owners.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owners&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Addresses for whom the tokens are minted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mintBatch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owners&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the issuer of a token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Identifier of the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; who minted `tokenId`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; issuerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;consensus&quot;&gt;Consensus&lt;&#x2F;h5&gt;
&lt;p&gt;An interface allowing minting&#x2F;revocation of tokens based on a consensus of a predefined set of addresses.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: MIT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERC4671.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC4671Consensus&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC4671&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get voters addresses for this consensus contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Addresses&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; of the voters&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; voters&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Cast a vote to mint a token for a specific address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address for whom to mint the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approveMint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Cast a vote to revoke a specific token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Identifier of the token to revoke&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approveRevoke&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;pull&quot;&gt;Pull&lt;&#x2F;h5&gt;
&lt;p&gt;An interface allowing a token owner to pull his token to a another of his wallets (here &lt;code&gt;recipient&lt;&#x2F;code&gt;). The caller must provide a signature of the tuple &lt;code&gt;(tokenId, owner, recipient)&lt;&#x2F;code&gt; using the &lt;code&gt;owner&lt;&#x2F;code&gt; wallet.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: MIT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERC4671.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC4671Pull&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC4671&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Pull a token from the owner wallet to the caller&amp;#39;s wallet&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Identifier of the token to transfer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address that owns tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Signed data (tokenId, owner, recipient) by the owner of the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; pull&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;ntt-store&quot;&gt;NTT Store&lt;&#x2F;h3&gt;
&lt;p&gt;Non-tradable tokens are meant to be fetched by third-parties, which is why there needs to be a convenient way for users to expose some or all of their tokens. We achieve this result using a store which must implement the following interface.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: MIT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERC165.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC4671Store&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC165&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Event emitted when a IERC4671Enumerable contract is added to the owner&amp;#39;s records&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Added&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Event emitted when a IERC4671Enumerable contract is removed from the owner&amp;#39;s records&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Removed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Add a IERC4671Enumerable contract address to the caller&amp;#39;s record&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; token&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the IERC4671Enumerable contract to add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Remove a IERC4671Enumerable contract from the caller&amp;#39;s record&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; token&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the IERC4671Enumerable contract to remove&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; remove&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get all the IERC4671Enumerable contracts for a given owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address for which to retrieve the IERC4671Enumerable contracts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;on-chain-vs-off-chain&quot;&gt;On-chain vs Off-chain&lt;&#x2F;h3&gt;
&lt;p&gt;A decision was made to keep the data off-chain (via &lt;code&gt;tokenURI()&lt;&#x2F;code&gt;) for two main reasons:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Non-tradable tokens represent personal possessions. Therefore, there might be cases where the data should be encrypted. The standard should not outline decisions about encryption because there are just so many ways this could be done, and every possibility is specific to the use-case.&lt;&#x2F;li&gt;
&lt;li&gt;Non-tradable tokens must stay generic. There could have been a possibility to make a &lt;code&gt;MetadataStore&lt;&#x2F;code&gt; holding the data of tokens in an elegant way, unfortunately we would have needed a support for generics in solidity (or struct inheritance), which is not available today.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;You can find an implementation of this standard &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4671&#x2F;assets&#x2F;index&#x2F;&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Using this implementation, this is how you would create a token:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: MIT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;ERC4671.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EIPCreatorBadge&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC4671&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC4671&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;&amp;quot;EIP Creator Badge&amp;quot;, &amp;quot;EIP&amp;quot;) &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; giveThatManABadge&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_isCreator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;You must be the contract creator&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _baseURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;https:&#x2F;&#x2F;eips.ethereum.org&#x2F;ntt&#x2F;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This could be a contract managed by the Ethereum foundation and which allows them to deliver tokens to EIP creators.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;One security aspect is related to the &lt;code&gt;tokenURI&lt;&#x2F;code&gt; method which returns the metadata linked to a token. Since the standard represents inherently personal possessions, users might want to encrypt the data in some cases e.g. national id cards. Moreover, it is the responsibility of the contract creator to make sure the URI returned by this method is available at all times.&lt;&#x2F;p&gt;
&lt;p&gt;The standard does not define any way to transfer a token from one wallet to another. Therefore, users must be very cautious with the wallet they use to receive these tokens. If a wallet is lost, the only way to get the tokens back is for the issuing authorities to deliver the tokens again, akin real life.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Multi-Fractional Non-Fungible Tokens</title>
        <published>2022-01-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>David Kim</name><uri>https://github.com/powerstream3604</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4675/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-4675-multi-fractional-non-fungible-token-standard/8008" />
        

        <id>https://wg-eips.ritovision.com/4675/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:4675"
            label="ERC-4675" />
        

        
        

        
        <summary type="html">Fractionalize multiple NFTs using a single contract</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4675/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard outlines a smart contract interface eligible to represent any number of fractionalized non-fungible tokens. Existing projects utilizing standards like &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1633&#x2F;&quot;&gt;EIP-1633&lt;&#x2F;a&gt; conventionally deploy separate &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;EIP-20&lt;&#x2F;a&gt; compatible token contracts to fractionalize the non-fungible token into EIP-20 tokens. In contrast, this ERC allows each token ID to represent a token type representing(fractionalizing) the non-fungible token.&lt;&#x2F;p&gt;
&lt;p&gt;This standard is approximate in terms of using &lt;code&gt;_id&lt;&#x2F;code&gt; for distinguishing token types. However, this ERC has a clear difference with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;EIP-1155&lt;&#x2F;a&gt; as each &lt;code&gt;_id&lt;&#x2F;code&gt; represents a distinct NFT.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The conventional fractionalization process of fractionalizing a NFT to FT requires deployment of a FT token contract representing the ownership of NFT. This leads to inefficient bytecode usage on Ethereum Blockchain and limits functionalities since each token contract is separated into its own permissioned address.
With the rise of multiple NFT projects needing to fractionalize NFT to FT, new type of token standard is needed to back up them.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Multi-Fractional Non-Fungible Token Standard&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; : The ERC-165 identifier for this interface is 0x83f5d35f.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IMFNFT&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when ownership of any token changes by any mechanism.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        The `_from` argument MUST be the address of an account&#x2F;contract sending the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        The `_to` argument MUST be the address of an account&#x2F;contract receiving the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        The `_id` argument MUST be the token type being transferred. (represents NFT)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        The `_value` argument MUST be the number of tokens the holder balance is decrease by and match the recipient balance is increased by.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when the approved address for token is &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; or reaffirmed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        The `_owner` argument MUST be the address of account&#x2F;contract approving to withdraw.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        The `_spender` argument MUST be the address of account&#x2F;contract approved to withdraw from the `_owner` balance.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        The `_id` argument MUST be the token type being transferred. (represents NFT)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        The `_value` argument MUST be the number of tokens the `_approved` is able to withdraw from `_owner` balance.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Approval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when new token type is added which represents the share of the Non-Fungible Token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        The `_parentToken` argument MUST be the address of the Non-Fungible Token contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        The `_parentTokenId` argument MUST be the token ID of the Non-Fungible Token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        The `_id` argument MUST be the token type being added. (represents NFT)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        The `_totalSupply` argument MUST be the number of total token supply of the token type.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TokenAddition&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _parentToken&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _parentTokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _totalSupply&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfers `_value` amount of an `_id` from the msg.sender address to the `_to` address specified&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; msg.sender must have sufficient balance to handle the tokens being transferred out of the account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        MUST revert if `_to` is the zero address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        MUST revert if balance of msg.sender for token `_id` is lower than the `_value` being transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        MUST revert on any other error.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        MUST emit the `Transfer` event to reflect the balance change.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      Source address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      ID of the token type&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   Transfer amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;         True&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if transfer was successful, false if not&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Approves `_value` amount of an `_id` from the msg.sender to the `_spender` address specified.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; msg.sender must have sufficient balance to handle the tokens when the `_spender` wants to transfer the token on behalf.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        MUST revert if `_spender` is the zero address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        MUST revert on any other error.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        MUST emit the `Approval` event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Spender address(account&#x2F;contract which can withdraw token on behalf of msg.sender)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      ID of the token type&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   Approval amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;         True&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if approval was successful, false if not&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfers `_value` amount of an `_id` from the `_from` address to the `_to` address specified.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Caller must be approved to manage the tokens being transferred out of the `_from` account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        MUST revert if `_to` is the zero address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        MUST revert if balance of holder for token `_id` is lower than the `_value` sent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        MUST revert on any other error.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        MUST emit `Transfer` event to reflect the balance change.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    Source address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      Target Address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      ID of the token type&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   Transfer amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;         True&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if transfer was successful, false if not&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sets the NFT as a new type token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The contract itself should verify if the ownership of NFT is belongs to this contract itself with the `_parentNFTContractAddress` &amp;amp; `_parentNFTTokenId` before adding the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        MUST revert if the same NFT is already registered.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        MUST revert if `_parentNFTContractAddress` is address zero.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        MUST revert if `_parentNFTContractAddress` is not ERC-721 compatible.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        MUST revert if this contract itself is not the owner of the NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        MUST revert on any other error.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        MUST emit `TokenAddition` event to reflect the token type addition.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _parentNFTContractAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    NFT contract address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _parentNFTTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;            NFT tokenID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _totalSupply&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                 Total token supply&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setParentNFT&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _parentNFTContractAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _parentNFTTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _totalSupply&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the token ID&amp;#39;s total token supply.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      ID of the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;         The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; total token supply of the specified token type&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the balance of an account&amp;#39;s tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  The address of the token holder&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     ID of the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; _owner&amp;#39;s balance of the token type requested&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the amount which `_spender` is still allowed to withdraw from `_owner`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   The address of the token holder&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address approved to withdraw token on behalf of `_owner`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      ID of the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;         The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; amount which `_spender` is still allowed to withdraw from `_owner`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; allowance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the bool value which represents whether the NFT is already registered and fractionalized by this contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _parentNFTContractAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    NFT contract address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _parentNFTTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;            NFT tokenID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;                             The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; bool value representing the whether the NFT is already registered.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isRegistered&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _parentNFTContractAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _parentNFTTokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC165&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Query if a contract implements an interface&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; interfaceID&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The interface identifier, as specified in ERC-165&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Interface identification is specified in ERC-165. This function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        uses less than 30,000 gas.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `true` if the contract implements `interfaceID` and&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        `interfaceID` is not 0xffffffff, `false` otherwise&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;To receive Non-Fungible Token on &lt;code&gt;safe Transfer&lt;&#x2F;code&gt; the contract should include &lt;code&gt;onERC721Received()&lt;&#x2F;code&gt;.
Including &lt;code&gt;onERC721Received()&lt;&#x2F;code&gt; is needed to be compatible with Safe Transfer Rules.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Handle the receipt of an NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address which called `safeTransferFrom` function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address which previously owned the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT identifier which is being transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Additional data with no specified format&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `bytes4(keccak256(&amp;quot;onERC721Received(address,address,uint256,bytes)&amp;quot;))`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onERC721Received&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;Metadata&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;symbol()&lt;&#x2F;code&gt; &amp;amp; &lt;code&gt;name()&lt;&#x2F;code&gt; functions were not included since the majority of users can just fetch it from the originating NFT contract. Also, copying the name &amp;amp; symbol every time when token gets added might place a lot of redundant bytecode on the Ethereum blockchain.
However, according to the need and design of the project it could also be added to each token type by fetching the metadata from the NFT contract.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Design&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Most of the decisions made around the design of this ERC were done to keep it as flexible for diverse token design &amp;amp; architecture.
These minimum requirement for this standard allows for each project to determine their own system for minting, governing, burning their MFNFT tokens depending on their programmable architecture.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;To make this standard compatible with existing standards, this standard &lt;code&gt;event&lt;&#x2F;code&gt; &amp;amp; &lt;code&gt;function&lt;&#x2F;code&gt; names are identical with ERC-20 token standard with some more &lt;code&gt;events&lt;&#x2F;code&gt; &amp;amp; &lt;code&gt;functions&lt;&#x2F;code&gt; to add token type dynamically.&lt;&#x2F;p&gt;
&lt;p&gt;Also, the sequence of parameter in use of &lt;code&gt;_id&lt;&#x2F;code&gt; for distinguishing token types in &lt;code&gt;functions&lt;&#x2F;code&gt; and &lt;code&gt;events&lt;&#x2F;code&gt; are very much similar to ERC-1155 Multi-Token Standard.&lt;&#x2F;p&gt;
&lt;p&gt;Since this standard is intended to interact with the EIP-721 Non-Fungible Token Standard, it is kept purposefully agnostic to extensions beyond the standard in order to allow specific projects to design their own token usage and scenario.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Reference Implementation of MFNFT Token includes test cases written using hardhat. (Test coverage : 100%)&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4675&#x2F;assets&#x2F;README&#x2F;&quot;&gt;MFNFT - Implementation&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;To fractionalize an already minted NFT, it is evident that ownership of NFT should be given to token contracts before fractionalization.
In the case of fractionalizing NFT, the token contract should thoroughly verify the ownership of NFT before fractionalizing it to prevent tokens from being a separate tokens with the NFT.&lt;&#x2F;p&gt;
&lt;p&gt;If an arbitrary account has the right to call &lt;code&gt;setParentNFT()&lt;&#x2F;code&gt; there might be a front-running issue. The caller of &lt;code&gt;setParentNFT()&lt;&#x2F;code&gt; might be different from the real NFT sender.
To prevent this issue, implementors should just allow &lt;strong&gt;admin&lt;&#x2F;strong&gt; to call, or fractionalize and receive NFT in an atomic transaction similar to flash loan(swap).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EOF - Functions</title>
        <published>2022-01-10T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Andrei Maiboroda</name><uri>https://github.com/gumb0</uri>
	</author>
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	<author>
		<name>Paweł Bylica</name><uri>https://github.com/chfast</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4750/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-4750-eof-functions/8195" />
        

        <id>https://wg-eips.ritovision.com/4750/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:4750"
            label="EIP-4750" />
        

        
        

        
        <summary type="html">Individual sections for functions with `CALLF` and `RETF` instructions</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4750/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce the ability to have several code sections in EOF-formatted (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3540&#x2F;&quot;&gt;EIP-3540&lt;&#x2F;a&gt;) bytecode, each one representing a separate subroutine&#x2F;function. Two new opcodes,&lt;code&gt;CALLF&lt;&#x2F;code&gt; and &lt;code&gt;RETF&lt;&#x2F;code&gt;, are introduced to call and return from such a function. Dynamic jump instructions are disallowed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, in the EVM everything is a dynamic jump. Languages like Solidity generate most jumps in a static manner (i.e. the destination is pushed to the stack right before, &lt;code&gt;PUSHn .. JUMP&lt;&#x2F;code&gt;). Unfortunately however this cannot be used by most EVM interpreters, because of added requirement of validation&#x2F;analysis. This also restricts them from making optimisations and potentially reducing the cost of jumps.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4200&#x2F;&quot;&gt;EIP-4200&lt;&#x2F;a&gt; introduces static jump instructions, which remove the need for &lt;em&gt;most&lt;&#x2F;em&gt; dynamic jump use cases, but not everything can be solved with them.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP aims to remove the need and disallow dynamic jumps as it offers the most important feature those are used for: calling into and returning from functions.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore, it aims to improve analysis opportunities by encoding the number of inputs and outputs for each given function, and isolating the stack of each function (i.e. a function cannot read the stack of the caller&#x2F;callee).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;type-section&quot;&gt;Type Section&lt;&#x2F;h3&gt;
&lt;p&gt;The type section of EOF containers must adhere to following requirements:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The section is a list of metadata where the metadata index in the type section corresponds to a code section index. Therefore, the type section size MUST be &lt;code&gt;n * 4&lt;&#x2F;code&gt; bytes, where &lt;code&gt;n&lt;&#x2F;code&gt; is the number of code sections.&lt;&#x2F;li&gt;
&lt;li&gt;Each metadata item has 3 attributes: a uint8 &lt;code&gt;inputs&lt;&#x2F;code&gt;, a uint8 &lt;code&gt;outputs&lt;&#x2F;code&gt;, and a uint16 &lt;code&gt;max_stack_increase&lt;&#x2F;code&gt;. &lt;em&gt;Note:&lt;&#x2F;em&gt; This implies that there is a limit of 255 stack for the input and in the output. This is further restricted to 127 stack items, because the upper bit of both the input and output bytes are reserved for future use (&lt;code&gt;outputs == 0x80&lt;&#x2F;code&gt; is already used in EOF1 to denote non-returning functions, as introduced in a separate EIP). &lt;code&gt;max_stack_increase&lt;&#x2F;code&gt; is further defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5450&#x2F;&quot;&gt;EIP-5450&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The 0th code section MUST have 0 inputs and be non-returning.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Refer to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3540&#x2F;&quot;&gt;EIP-3540&lt;&#x2F;a&gt; to see the full structure of a well-formed EOF bytecode.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;new-execution-state-in-evm&quot;&gt;New execution state in EVM&lt;&#x2F;h3&gt;
&lt;p&gt;A return stack is introduced, separate from the operand stack. It is a stack of items representing execution state to return to after function execution is finished. Each item is comprised of code section index and offset in the code section (PC value).&lt;&#x2F;p&gt;
&lt;p&gt;Note: Implementations are free to choose particular encoding for a stack item. In the specification below we assume that representation is two unsigned integers: &lt;code&gt;code_section_index&lt;&#x2F;code&gt;, &lt;code&gt;offset&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The return stack is limited to a maximum of &lt;code&gt;1024&lt;&#x2F;code&gt; items.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, EVM keeps track of the index of currently executing section - &lt;code&gt;current_section_index&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;new-instructions&quot;&gt;New instructions&lt;&#x2F;h3&gt;
&lt;p&gt;We introduce two new instructions:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;CALLF&lt;&#x2F;code&gt; (&lt;code&gt;0xe3&lt;&#x2F;code&gt;) - call a function&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RETF&lt;&#x2F;code&gt; (&lt;code&gt;0xe4&lt;&#x2F;code&gt;) - return from a function&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;If the code is legacy bytecode, any of these instructions results in an &lt;em&gt;exceptional halt&lt;&#x2F;em&gt;. (&lt;em&gt;Note: This means no change to behaviour.&lt;&#x2F;em&gt;)&lt;&#x2F;p&gt;
&lt;p&gt;First we define several helper values:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;type[i].inputs = type_section_contents[i * 4]&lt;&#x2F;code&gt; - number of inputs of ith code section&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;type[i].outputs = type_section_contents[i * 4 + 1]&lt;&#x2F;code&gt; - number of outputs of ith code section&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;type[i].max_stack_increase = type_section_contents[i * 4 + 2:i * 4 + 4]&lt;&#x2F;code&gt; - maximum operand stack height increase of ith code section&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;If the code is valid EOF1, the following execution rules apply:&lt;&#x2F;p&gt;
&lt;h4 id=&quot;callf&quot;&gt;&lt;code&gt;CALLF&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Has one immediate argument,&lt;code&gt;target_section_index&lt;&#x2F;code&gt;, encoded as a 16-bit unsigned big-endian value.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;Note:&lt;&#x2F;em&gt; EOF validation &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5450&#x2F;&quot;&gt;EIP-5450&lt;&#x2F;a&gt; guarantees that operand stack has enough items to use as callee&#x27;s inputs.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;If operand stack size exceeds &lt;code&gt;1024 - type[target_section_index].max_stack_increase&lt;&#x2F;code&gt; (i.e. if the called function may exceed the global stack height limit), execution results in exceptional halt. This also guarantees that the stack height after the call is within the limits.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;If return stack already has &lt;code&gt;1024&lt;&#x2F;code&gt; items, execution results in exceptional halt.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Charges &lt;code&gt;5&lt;&#x2F;code&gt; gas.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Pops nothing and pushes nothing to operand stack.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Pushes to return stack an item:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(code_section_index = current_section_index, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;offset = PC_post_instruction)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Under &lt;code&gt;PC_post_instruction&lt;&#x2F;code&gt; we mean the PC position after the entire immediate argument of &lt;code&gt;CALLF&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Note:&lt;&#x2F;em&gt; EOF validation &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5450&#x2F;&quot;&gt;EIP-5450&lt;&#x2F;a&gt; guarantees there is always an instruction following &lt;code&gt;CALLF&lt;&#x2F;code&gt; (since terminating instruction or unconditional jump is required to be final one in the section), therefore &lt;code&gt;PC_post_instruction&lt;&#x2F;code&gt; always points to an instruction inside section bounds.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Sets &lt;code&gt;current_section_index&lt;&#x2F;code&gt; to &lt;code&gt;target_section_index&lt;&#x2F;code&gt; and &lt;code&gt;PC&lt;&#x2F;code&gt; to &lt;code&gt;0&lt;&#x2F;code&gt;, and execution continues in the called section.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h4 id=&quot;retf&quot;&gt;&lt;code&gt;RETF&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;ol&gt;
&lt;li&gt;Does not have immediate arguments.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;Note:&lt;&#x2F;em&gt; EOF validation &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5450&#x2F;&quot;&gt;EIP-5450&lt;&#x2F;a&gt; guarantees that operand stack has exact number of items to use as outputs.&lt;&#x2F;li&gt;
&lt;li&gt;Charges &lt;code&gt;3&lt;&#x2F;code&gt; gas.&lt;&#x2F;li&gt;
&lt;li&gt;Pops nothing and pushes nothing to operand stack.&lt;&#x2F;li&gt;
&lt;li&gt;Pops an item from return stack and sets &lt;code&gt;current_section_index&lt;&#x2F;code&gt; and &lt;code&gt;PC&lt;&#x2F;code&gt; to values from this item.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;em&gt;Note:&lt;&#x2F;em&gt; EOF validation requirement for 0th code section to be non-returning (non-returning sections introduced in a separate EIP) guarantees that return stack cannot be empty before &lt;code&gt;RETF&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;code-validation&quot;&gt;Code Validation&lt;&#x2F;h3&gt;
&lt;p&gt;In addition to container format validation rules above, we extend code section validation rules (as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3670&#x2F;&quot;&gt;EIP-3670&lt;&#x2F;a&gt;).&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Code validation rules of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3670&#x2F;&quot;&gt;EIP-3670&lt;&#x2F;a&gt; are applied to every code section.&lt;&#x2F;li&gt;
&lt;li&gt;Code section is invalid in case an immediate argument of any &lt;code&gt;CALLF&lt;&#x2F;code&gt; is greater than or equal to the total number of code sections.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RJUMP&lt;&#x2F;code&gt;, &lt;code&gt;RJUMPI&lt;&#x2F;code&gt; and &lt;code&gt;RJUMPV&lt;&#x2F;code&gt; immediate argument value (jump destination relative offset) validation:
&lt;ol&gt;
&lt;li&gt;Code section is invalid in case offset points to a position outside of section bounds.&lt;&#x2F;li&gt;
&lt;li&gt;Code section is invalid in case offset points to one of two bytes directly following &lt;code&gt;CALLF&lt;&#x2F;code&gt; instruction.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;No unreachable code sections are allowed, i.e. every code section can be reached from the 0th code section with a series of &lt;code&gt;CALLF&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;JUMPF&lt;&#x2F;code&gt; (&lt;code&gt;JUMPF&lt;&#x2F;code&gt; introduced in a separate EIP) instructions (0th code section is always reachable).&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;disallowed-instructions&quot;&gt;Disallowed instructions&lt;&#x2F;h3&gt;
&lt;p&gt;Dynamic jump instructions &lt;code&gt;JUMP&lt;&#x2F;code&gt; (&lt;code&gt;0x56&lt;&#x2F;code&gt;) and &lt;code&gt;JUMPI&lt;&#x2F;code&gt; (&lt;code&gt;0x57&lt;&#x2F;code&gt;) are invalid and their opcodes are undefined.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; (&lt;code&gt;0x5b&lt;&#x2F;code&gt;) instruction is renamed to &lt;code&gt;NOP&lt;&#x2F;code&gt; (&quot;no operation&quot;) without the change in behaviour: it pops nothing and pushes nothing to operand stack and has no other effects except for &lt;code&gt;PC&lt;&#x2F;code&gt; increment and charging 1 gas.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;PC&lt;&#x2F;code&gt; (0x58) instruction becomes invalid and its opcode is undefined.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Note:&lt;&#x2F;em&gt; This change implies that JUMPDEST analysis is no longer required for EOF code.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;execution&quot;&gt;Execution&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;Execution starts at the first byte of the 0th code section, and &lt;code&gt;PC&lt;&#x2F;code&gt; is set to &lt;code&gt;0&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Return stack is initialized empty.&lt;&#x2F;li&gt;
&lt;li&gt;Stack underflow check is not performed anymore. &lt;em&gt;Note:&lt;&#x2F;em&gt; EOF validation &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5450&#x2F;&quot;&gt;EIP-5450&lt;&#x2F;a&gt; guarantees that it cannot happen at run-time.&lt;&#x2F;li&gt;
&lt;li&gt;Stack overflow check is not performed anymore, except during &lt;code&gt;CALLF&lt;&#x2F;code&gt; as specified above.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;retf-in-the-top-frame-ends-execution-vs-exceptionally-halts-vs-is-not-allowed-during-validation&quot;&gt;&lt;code&gt;RETF&lt;&#x2F;code&gt; in the top frame ends execution vs exceptionally halts vs is not allowed during validation&lt;&#x2F;h3&gt;
&lt;p&gt;Alternative logic for &lt;code&gt;RETF&lt;&#x2F;code&gt; in the top frame could be to allow it during code validation and make it either:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;end execution if the return stack is emptied by the &lt;code&gt;RETF&lt;&#x2F;code&gt; or&lt;&#x2F;li&gt;
&lt;li&gt;exceptionally halt if the return stack is empty before the &lt;code&gt;RETF&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This has been superseded with the validation rule of top frame (0th code section) being non-returning (non-returning sections introduced in a separate EIP), because validating non-returning status of functions is valuable by itself for other reasons. Therefore all considerations of runtime behavior of &lt;code&gt;RETF&lt;&#x2F;code&gt; in the top frame were obsoleted.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;minimal-function-type&quot;&gt;&quot;Minimal&quot; function type&lt;&#x2F;h3&gt;
&lt;p&gt;Let&#x27;s consider a trivial function with single instruction &lt;code&gt;RETF&lt;&#x2F;code&gt;.
Such function have the &quot;minimal&quot; type of &lt;code&gt;inputs = 0, outputs = 0&lt;&#x2F;code&gt;.
However, any other type like &lt;code&gt;inputs = k, outputs = k&lt;&#x2F;code&gt; is also valid for such function.
It has been considered to enforce usage of the &quot;minimal&quot; type for all functions.
This requires additional validation rule that checks if any instruction in the function accesses the bottom stack operand.
This rule can be obeyed by compilers, but causes quite significant annoyance.
On the other hand, it provides close to zero benefits for the EVM implementations.
In the end, it has been decided that this is not enforced.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;code-section-limit-and-instruction-size&quot;&gt;Code section limit and instruction size&lt;&#x2F;h3&gt;
&lt;p&gt;The number of code sections is limited to 1024. This requires 2-byte immediate for &lt;code&gt;CALLF&lt;&#x2F;code&gt; and leaves room for increasing the limit in the future. The 256 limit (1-byte immediate) was discussed and concerns were raised that it might not be sufficient.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;nop-instruction&quot;&gt;&lt;code&gt;NOP&lt;&#x2F;code&gt; instruction&lt;&#x2F;h3&gt;
&lt;p&gt;Instead of deprecating &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; we repurpose it as &lt;code&gt;NOP&lt;&#x2F;code&gt; instruction, because &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; effectively was a &quot;no-operation&quot; instruction and was already used as such in various contexts. It can be useful for some off-chain tooling, e.g. benchmarking EVM implementations (performance of &lt;code&gt;NOP&lt;&#x2F;code&gt; instruction is performance of EVM interpreter loop), as a padding to force code alignment, as a placeholder in dynamic code composition.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;deprecating-jumpdest-analysis&quot;&gt;Deprecating &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; analysis&lt;&#x2F;h3&gt;
&lt;p&gt;The purpose of &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; analysis was to find in code the valid &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; bytes that do not happen to be inside &lt;code&gt;PUSH&lt;&#x2F;code&gt; immediate data. Only dynamic jump instructions (&lt;code&gt;JUMP&lt;&#x2F;code&gt;, &lt;code&gt;JUMPI&lt;&#x2F;code&gt;) required destination to be &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; instruction. Relative static jumps (&lt;code&gt;RJUMP&lt;&#x2F;code&gt;, &lt;code&gt;RJUMPI&lt;&#x2F;code&gt; and &lt;code&gt;RJUMPV&lt;&#x2F;code&gt;) do not have this requirement and are validated once at deploy-time during EOF instructions validation. Therefore, without dynamic jump instructions, &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; analysis is not required.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change poses no risk to backwards compatibility, as it is introduced only for EOF1 contracts, for which deploying undefined instructions is not allowed, therefore there are no existing contracts using these instructions. The new instructions are not introduced for legacy bytecode (code which is not EOF formatted).&lt;&#x2F;p&gt;
&lt;p&gt;The new execution state and multi-section control flow pose no risk to backwards compatibility, because it is a generalization of executing a single code section. Executing existing contracts (both legacy and EOF1) has no user-observable changes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The gas cost of introduced instructions reflects the need to manipulate return stack entries and jumping to proper code section offset in memory when interpreting the bytecode.&lt;&#x2F;p&gt;
&lt;p&gt;These new instructions need to be carefully considered during implementation of the EOF container validation algorithm.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Untransferability Indicator for EIP-1155</title>
        <published>2022-01-06T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Yuki Aoki</name><uri>https://github.com/yuki-js</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6268/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/sbt-implemented-in-erc1155/12182" />
        

        <id>https://wg-eips.ritovision.com/6268/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:6268"
            label="ERC-6268" />
        

        
        

        
        <summary type="html">An extension of EIP-1155 for indicating the transferability of the token.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6268/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP standardizes an interface indicating &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;EIP-1155&lt;&#x2F;a&gt;-compatible token non-transferability using &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;EIP-165&lt;&#x2F;a&gt; feature detection.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Soulbound Tokens (SBT) are non-transferable tokens. While &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5192&#x2F;&quot;&gt;EIP-5192&lt;&#x2F;a&gt; standardizes non-fungible SBTs, a standard for Soulbound semi-fungible or fungible tokens does not yet exist. The introduction of a standard non-transferability indicator that is agnostic to fungibility promotes the usage of Souldbound semi-fungible or fungible tokens.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;Smart contracts implementing this standard MUST comform to the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;EIP-1155&lt;&#x2F;a&gt; specification.&lt;&#x2F;p&gt;
&lt;p&gt;Smart contracts implementing this standard MUST implement all of the functions in the &lt;code&gt;IERC6268&lt;&#x2F;code&gt; interface.&lt;&#x2F;p&gt;
&lt;p&gt;Smart contracts implementing this standard MUST implement the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;EIP-165&lt;&#x2F;a&gt; supportsInterface function and MUST return the constant value true if &lt;code&gt;0xd87116f3&lt;&#x2F;code&gt; is passed through the interfaceID argument.&lt;&#x2F;p&gt;
&lt;p&gt;For the token identifier &lt;code&gt;_id&lt;&#x2F;code&gt; that is marked as &lt;code&gt;locked&lt;&#x2F;code&gt;, &lt;code&gt;locked(_id)&lt;&#x2F;code&gt; MUST return the constant value true and any functions that try transferring the token, including &lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt; and &lt;code&gt;safeBatchTransferFrom&lt;&#x2F;code&gt; function MUST throw.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC6268&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Either `LockedSingle` or `LockedBatch` MUST emit when the locking status is &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; to locked.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If a token is minted and the status is locked, this event should be emitted.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier for a token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; LockedSingle&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Either `LockedSingle` or `LockedBatch` MUST emit when the locking status is &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; to locked.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If a token is minted and the status is locked, this event should be emitted.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _ids&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The list of identifiers for tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; LockedBatch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _ids&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Either `UnlockedSingle` or `UnlockedBatch` MUST emit when the locking status is &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; to unlocked.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If a token is minted and the status is unlocked, this event should be emitted.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier for a token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UnlockedSingle&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Either `UnlockedSingle` or `UnlockedBatch` MUST emit when the locking status is &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; to unlocked.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If a token is minted and the status is unlocked, this event should be emitted.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _ids&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The list of identifiers for tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UnlockedBatch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _ids&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the locking status of the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SBTs assigned to zero address are considered invalid, and queries&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; about them do throw.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier for a token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; locked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the locking statuses of the multiple tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SBTs assigned to zero address are considered invalid, and queries&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; about them do throw.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _ids&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The list of identifiers for tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; lockedBatch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _ids&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal is fully backward compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;EIP-1155&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Tokenized Vaults</title>
        <published>2021-12-22T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Joey Santoro</name><uri>https://github.com/joeysantoro</uri>
	</author>
	
	<author>
		<name>t11s</name><uri>https://github.com/transmissions11</uri>
	</author>
	
	<author>
		<name>Jet Jadeja</name><uri>https://github.com/JetJadeja</uri>
	</author>
	
	<author>
		<name>Alberto Cuesta Cañada</name><uri>https://github.com/alcueca</uri>
	</author>
	
	<author>
		<name>Señor Doggo</name><uri>https://github.com/fubuloubu</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4626/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-4626-yield-bearing-vault-standard/7900" />
        

        <id>https://wg-eips.ritovision.com/4626/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:4626"
            label="ERC-4626" />
        

        
        

        
        <summary type="html">Tokenized Vaults with a single underlying EIP-20 token.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4626/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The following standard allows for the implementation of a standard API for tokenized Vaults
representing shares of a single underlying &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;EIP-20&lt;&#x2F;a&gt; token.
This standard is an extension on the EIP-20 token that provides basic functionality for depositing
and withdrawing tokens and reading balances.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Tokenized Vaults have a lack of standardization leading to diverse implementation details.
Some various examples include lending markets, aggregators, and intrinsically interest bearing tokens.
This makes integration difficult at the aggregator or plugin layer for protocols which need to conform to many standards, and forces each protocol to implement their own adapters which are error prone and waste development resources.&lt;&#x2F;p&gt;
&lt;p&gt;A standard for tokenized Vaults will lower the integration effort for yield-bearing vaults, while creating more consistent and robust implementation patterns.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;All &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4626&#x2F;&quot;&gt;EIP-4626&lt;&#x2F;a&gt; tokenized Vaults MUST implement EIP-20 to represent shares.
If a Vault is to be non-transferrable, it MAY revert on calls to &lt;code&gt;transfer&lt;&#x2F;code&gt; or &lt;code&gt;transferFrom&lt;&#x2F;code&gt;.
The EIP-20 operations &lt;code&gt;balanceOf&lt;&#x2F;code&gt;, &lt;code&gt;transfer&lt;&#x2F;code&gt;, &lt;code&gt;totalSupply&lt;&#x2F;code&gt;, etc. operate on the Vault &quot;shares&quot;
which represent a claim to ownership on a fraction of the Vault&#x27;s underlying holdings.&lt;&#x2F;p&gt;
&lt;p&gt;All EIP-4626 tokenized Vaults MUST implement EIP-20&#x27;s optional metadata extensions.
The &lt;code&gt;name&lt;&#x2F;code&gt; and &lt;code&gt;symbol&lt;&#x2F;code&gt; functions SHOULD reflect the underlying token&#x27;s &lt;code&gt;name&lt;&#x2F;code&gt; and &lt;code&gt;symbol&lt;&#x2F;code&gt; in some way.&lt;&#x2F;p&gt;
&lt;p&gt;EIP-4626 tokenized Vaults MAY implement &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2612&#x2F;&quot;&gt;EIP-2612&lt;&#x2F;a&gt; to improve the UX of approving shares on various integrations.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions:&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;asset: The underlying token managed by the Vault.
Has units defined by the corresponding EIP-20 contract.&lt;&#x2F;li&gt;
&lt;li&gt;share: The token of the Vault. Has a ratio of underlying assets
exchanged on mint&#x2F;deposit&#x2F;withdraw&#x2F;redeem (as defined by the Vault).&lt;&#x2F;li&gt;
&lt;li&gt;fee: An amount of assets or shares charged to the user by the Vault. Fees can exists for
deposits, yield, AUM, withdrawals, or anything else prescribed by the Vault.&lt;&#x2F;li&gt;
&lt;li&gt;slippage: Any difference between advertised share price and economic realities of
deposit to or withdrawal from the Vault, which is not accounted by fees.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;methods&quot;&gt;Methods&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;asset&quot;&gt;asset&lt;&#x2F;h4&gt;
&lt;p&gt;The address of the underlying token used for the Vault for accounting, depositing, and withdrawing.&lt;&#x2F;p&gt;
&lt;p&gt;MUST be an EIP-20 token contract.&lt;&#x2F;p&gt;
&lt;p&gt;MUST &lt;em&gt;NOT&lt;&#x2F;em&gt; revert.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;sset&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ssetTokenAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;totalassets&quot;&gt;totalAssets&lt;&#x2F;h4&gt;
&lt;p&gt;Total amount of the underlying asset that is &quot;managed&quot; by Vault.&lt;&#x2F;p&gt;
&lt;p&gt;SHOULD include any compounding that occurs from yield.&lt;&#x2F;p&gt;
&lt;p&gt;MUST be inclusive of any fees that are charged against assets in the Vault.&lt;&#x2F;p&gt;
&lt;p&gt;MUST &lt;em&gt;NOT&lt;&#x2F;em&gt; revert.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;otalAssets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;otalManagedAssets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;converttoshares&quot;&gt;convertToShares&lt;&#x2F;h4&gt;
&lt;p&gt;The amount of shares that the Vault would exchange for the amount of assets provided, in an ideal scenario where all the conditions are met.&lt;&#x2F;p&gt;
&lt;p&gt;MUST NOT be inclusive of any fees that are charged against assets in the Vault.&lt;&#x2F;p&gt;
&lt;p&gt;MUST NOT show any variations depending on the caller.&lt;&#x2F;p&gt;
&lt;p&gt;MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.&lt;&#x2F;p&gt;
&lt;p&gt;MUST NOT revert unless due to integer overflow caused by an unreasonably large input.&lt;&#x2F;p&gt;
&lt;p&gt;MUST round down towards 0.&lt;&#x2F;p&gt;
&lt;p&gt;This calculation MAY NOT reflect the &quot;per-user&quot; price-per-share, and instead should reflect the &quot;average-user&#x27;s&quot; price-per-share, meaning what the average user should expect to see when exchanging to and from.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;onvertToShares&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ssets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;hares&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;converttoassets&quot;&gt;convertToAssets&lt;&#x2F;h4&gt;
&lt;p&gt;The amount of assets that the Vault would exchange for the amount of shares provided, in an ideal scenario where all the conditions are met.&lt;&#x2F;p&gt;
&lt;p&gt;MUST NOT be inclusive of any fees that are charged against assets in the Vault.&lt;&#x2F;p&gt;
&lt;p&gt;MUST NOT show any variations depending on the caller.&lt;&#x2F;p&gt;
&lt;p&gt;MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.&lt;&#x2F;p&gt;
&lt;p&gt;MUST NOT revert unless due to integer overflow caused by an unreasonably large input.&lt;&#x2F;p&gt;
&lt;p&gt;MUST round down towards 0.&lt;&#x2F;p&gt;
&lt;p&gt;This calculation MAY NOT reflect the &quot;per-user&quot; price-per-share, and instead should reflect the &quot;average-user&#x27;s&quot; price-per-share, meaning what the average user should expect to see when exchanging to and from.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;onvertToAssets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;hares&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ssets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;maxdeposit&quot;&gt;maxDeposit&lt;&#x2F;h4&gt;
&lt;p&gt;Maximum amount of the underlying asset that can be deposited into the Vault for the &lt;code&gt;receiver&lt;&#x2F;code&gt;, through a &lt;code&gt;deposit&lt;&#x2F;code&gt; call.&lt;&#x2F;p&gt;
&lt;p&gt;MUST return the maximum amount of assets &lt;code&gt;deposit&lt;&#x2F;code&gt; would allow to be deposited for &lt;code&gt;receiver&lt;&#x2F;code&gt; and not cause a revert, which MUST NOT be higher than the actual maximum that would be accepted (it should underestimate if necessary). This assumes that the user has infinite assets, i.e. MUST NOT rely on &lt;code&gt;balanceOf&lt;&#x2F;code&gt; of &lt;code&gt;asset&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST factor in both global and user-specific limits, like if deposits are entirely disabled (even temporarily) it MUST return 0.&lt;&#x2F;p&gt;
&lt;p&gt;MUST return &lt;code&gt;2 ** 256 - 1&lt;&#x2F;code&gt; if there is no limit on the maximum amount of assets that may be deposited.&lt;&#x2F;p&gt;
&lt;p&gt;MUST NOT revert.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; m&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;axDeposit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eceiver&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; m&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;axAssets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;previewdeposit&quot;&gt;previewDeposit&lt;&#x2F;h4&gt;
&lt;p&gt;Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given current on-chain conditions.&lt;&#x2F;p&gt;
&lt;p&gt;MUST return as close to and no more than the exact amount of Vault shares that would be minted in a &lt;code&gt;deposit&lt;&#x2F;code&gt; call in the same transaction. I.e. &lt;code&gt;deposit&lt;&#x2F;code&gt; should return the same or more &lt;code&gt;shares&lt;&#x2F;code&gt; as &lt;code&gt;previewDeposit&lt;&#x2F;code&gt; if called in the same transaction.&lt;&#x2F;p&gt;
&lt;p&gt;MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the deposit would be accepted, regardless if the user has enough tokens approved, etc.&lt;&#x2F;p&gt;
&lt;p&gt;MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.&lt;&#x2F;p&gt;
&lt;p&gt;MUST NOT revert due to vault specific user&#x2F;global limits. MAY revert due to other conditions that would also cause &lt;code&gt;deposit&lt;&#x2F;code&gt; to revert.&lt;&#x2F;p&gt;
&lt;p&gt;Note that any unfavorable discrepancy between &lt;code&gt;convertToShares&lt;&#x2F;code&gt; and &lt;code&gt;previewDeposit&lt;&#x2F;code&gt; SHOULD be considered slippage in share price or some other type of condition, meaning the depositor will lose assets by depositing.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; p&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;reviewDeposit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ssets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;hares&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;deposit&quot;&gt;deposit&lt;&#x2F;h4&gt;
&lt;p&gt;Mints &lt;code&gt;shares&lt;&#x2F;code&gt; Vault shares to &lt;code&gt;receiver&lt;&#x2F;code&gt; by depositing exactly &lt;code&gt;assets&lt;&#x2F;code&gt; of underlying tokens.&lt;&#x2F;p&gt;
&lt;p&gt;MUST emit the &lt;code&gt;Deposit&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;p&gt;MUST support EIP-20 &lt;code&gt;approve&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;transferFrom&lt;&#x2F;code&gt; on &lt;code&gt;asset&lt;&#x2F;code&gt; as a deposit flow.
MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the &lt;code&gt;deposit&lt;&#x2F;code&gt; execution, and are accounted for during &lt;code&gt;deposit&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST revert if all of &lt;code&gt;assets&lt;&#x2F;code&gt; cannot be deposited (due to deposit limit being reached, slippage, the user not approving enough underlying tokens to the Vault contract, etc).&lt;&#x2F;p&gt;
&lt;p&gt;Note that most implementations will require pre-approval of the Vault with the Vault&#x27;s underlying &lt;code&gt;asset&lt;&#x2F;code&gt; token.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; d&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eposit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;onpayable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ssets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eceiver&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;hares&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;maxmint&quot;&gt;maxMint&lt;&#x2F;h4&gt;
&lt;p&gt;Maximum amount of shares that can be minted from the Vault for the &lt;code&gt;receiver&lt;&#x2F;code&gt;, through a &lt;code&gt;mint&lt;&#x2F;code&gt; call.&lt;&#x2F;p&gt;
&lt;p&gt;MUST return the maximum amount of shares &lt;code&gt;mint&lt;&#x2F;code&gt; would allow to be deposited to &lt;code&gt;receiver&lt;&#x2F;code&gt; and not cause a revert, which MUST NOT be higher than the actual maximum that would be accepted (it should underestimate if necessary). This assumes that the user has infinite assets, i.e. MUST NOT rely on &lt;code&gt;balanceOf&lt;&#x2F;code&gt; of &lt;code&gt;asset&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST factor in both global and user-specific limits, like if mints are entirely disabled (even temporarily) it MUST return 0.&lt;&#x2F;p&gt;
&lt;p&gt;MUST return &lt;code&gt;2 ** 256 - 1&lt;&#x2F;code&gt; if there is no limit on the maximum amount of shares that may be minted.&lt;&#x2F;p&gt;
&lt;p&gt;MUST NOT revert.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; m&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;axMint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eceiver&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; m&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;axShares&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;previewmint&quot;&gt;previewMint&lt;&#x2F;h4&gt;
&lt;p&gt;Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given current on-chain conditions.&lt;&#x2F;p&gt;
&lt;p&gt;MUST return as close to and no fewer than the exact amount of assets that would be deposited in a &lt;code&gt;mint&lt;&#x2F;code&gt; call in the same transaction. I.e. &lt;code&gt;mint&lt;&#x2F;code&gt; should return the same or fewer &lt;code&gt;assets&lt;&#x2F;code&gt; as &lt;code&gt;previewMint&lt;&#x2F;code&gt; if called in the same transaction.&lt;&#x2F;p&gt;
&lt;p&gt;MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint would be accepted, regardless if the user has enough tokens approved, etc.&lt;&#x2F;p&gt;
&lt;p&gt;MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.&lt;&#x2F;p&gt;
&lt;p&gt;MUST NOT revert due to vault specific user&#x2F;global limits. MAY revert due to other conditions that would also cause &lt;code&gt;mint&lt;&#x2F;code&gt; to revert.&lt;&#x2F;p&gt;
&lt;p&gt;Note that any unfavorable discrepancy between &lt;code&gt;convertToAssets&lt;&#x2F;code&gt; and &lt;code&gt;previewMint&lt;&#x2F;code&gt; SHOULD be considered slippage in share price or some other type of condition, meaning the depositor will lose assets by minting.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; p&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;reviewMint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;hares&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ssets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;mint&quot;&gt;mint&lt;&#x2F;h4&gt;
&lt;p&gt;Mints exactly &lt;code&gt;shares&lt;&#x2F;code&gt; Vault shares to &lt;code&gt;receiver&lt;&#x2F;code&gt; by depositing &lt;code&gt;assets&lt;&#x2F;code&gt; of underlying tokens.&lt;&#x2F;p&gt;
&lt;p&gt;MUST emit the &lt;code&gt;Deposit&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;p&gt;MUST support EIP-20 &lt;code&gt;approve&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;transferFrom&lt;&#x2F;code&gt; on &lt;code&gt;asset&lt;&#x2F;code&gt; as a mint flow.
MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the &lt;code&gt;mint&lt;&#x2F;code&gt; execution, and are accounted for during &lt;code&gt;mint&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST revert if all of &lt;code&gt;shares&lt;&#x2F;code&gt; cannot be minted (due to deposit limit being reached, slippage, the user not approving enough underlying tokens to the Vault contract, etc).&lt;&#x2F;p&gt;
&lt;p&gt;Note that most implementations will require pre-approval of the Vault with the Vault&#x27;s underlying &lt;code&gt;asset&lt;&#x2F;code&gt; token.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; m&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;onpayable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;hares&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eceiver&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ssets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;maxwithdraw&quot;&gt;maxWithdraw&lt;&#x2F;h4&gt;
&lt;p&gt;Maximum amount of the underlying asset that can be withdrawn from the &lt;code&gt;owner&lt;&#x2F;code&gt; balance in the Vault, through a &lt;code&gt;withdraw&lt;&#x2F;code&gt; call.&lt;&#x2F;p&gt;
&lt;p&gt;MUST return the maximum amount of assets that could be transferred from &lt;code&gt;owner&lt;&#x2F;code&gt; through &lt;code&gt;withdraw&lt;&#x2F;code&gt; and not cause a revert, which MUST NOT be higher than the actual maximum that would be accepted (it should underestimate if necessary).&lt;&#x2F;p&gt;
&lt;p&gt;MUST factor in both global and user-specific limits, like if withdrawals are entirely disabled (even temporarily) it MUST return 0.&lt;&#x2F;p&gt;
&lt;p&gt;MUST NOT revert.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; m&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;axWithdraw&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; o&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;wner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; m&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;axAssets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;previewwithdraw&quot;&gt;previewWithdraw&lt;&#x2F;h4&gt;
&lt;p&gt;Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block, given current on-chain conditions.&lt;&#x2F;p&gt;
&lt;p&gt;MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a &lt;code&gt;withdraw&lt;&#x2F;code&gt; call in the same transaction. I.e. &lt;code&gt;withdraw&lt;&#x2F;code&gt; should return the same or fewer &lt;code&gt;shares&lt;&#x2F;code&gt; as &lt;code&gt;previewWithdraw&lt;&#x2F;code&gt; if called in the same transaction.&lt;&#x2F;p&gt;
&lt;p&gt;MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though the withdrawal would be accepted, regardless if the user has enough shares, etc.&lt;&#x2F;p&gt;
&lt;p&gt;MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.&lt;&#x2F;p&gt;
&lt;p&gt;MUST NOT revert due to vault specific user&#x2F;global limits. MAY revert due to other conditions that would also cause &lt;code&gt;withdraw&lt;&#x2F;code&gt; to revert.&lt;&#x2F;p&gt;
&lt;p&gt;Note that any unfavorable discrepancy between &lt;code&gt;convertToShares&lt;&#x2F;code&gt; and &lt;code&gt;previewWithdraw&lt;&#x2F;code&gt; SHOULD be considered slippage in share price or some other type of condition, meaning the depositor will lose assets by depositing.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; p&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;reviewWithdraw&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ssets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;hares&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;withdraw&quot;&gt;withdraw&lt;&#x2F;h4&gt;
&lt;p&gt;Burns &lt;code&gt;shares&lt;&#x2F;code&gt; from &lt;code&gt;owner&lt;&#x2F;code&gt; and sends exactly &lt;code&gt;assets&lt;&#x2F;code&gt; of underlying tokens to &lt;code&gt;receiver&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST emit the &lt;code&gt;Withdraw&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;p&gt;MUST support a withdraw flow where the shares are burned from &lt;code&gt;owner&lt;&#x2F;code&gt; directly where &lt;code&gt;owner&lt;&#x2F;code&gt; is &lt;code&gt;msg.sender&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST support a withdraw flow where the shares are burned from &lt;code&gt;owner&lt;&#x2F;code&gt; directly where &lt;code&gt;msg.sender&lt;&#x2F;code&gt; has EIP-20 approval over the shares of &lt;code&gt;owner&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MAY support an additional flow in which the shares are transferred to the Vault contract before the &lt;code&gt;withdraw&lt;&#x2F;code&gt; execution, and are accounted for during &lt;code&gt;withdraw&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;SHOULD check &lt;code&gt;msg.sender&lt;&#x2F;code&gt; can spend owner funds, assets needs to be converted to shares and shares should be checked for allowance.&lt;&#x2F;p&gt;
&lt;p&gt;MUST revert if all of &lt;code&gt;assets&lt;&#x2F;code&gt; cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner not having enough shares, etc).&lt;&#x2F;p&gt;
&lt;p&gt;Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed. Those methods should be performed separately.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; w&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ithdraw&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;onpayable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ssets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eceiver&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; o&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;wner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;hares&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;maxredeem&quot;&gt;maxRedeem&lt;&#x2F;h4&gt;
&lt;p&gt;Maximum amount of Vault shares that can be redeemed from the &lt;code&gt;owner&lt;&#x2F;code&gt; balance in the Vault, through a &lt;code&gt;redeem&lt;&#x2F;code&gt; call.&lt;&#x2F;p&gt;
&lt;p&gt;MUST return the maximum amount of shares that could be transferred from &lt;code&gt;owner&lt;&#x2F;code&gt; through &lt;code&gt;redeem&lt;&#x2F;code&gt; and not cause a revert, which MUST NOT be higher than the actual maximum that would be accepted (it should underestimate if necessary).&lt;&#x2F;p&gt;
&lt;p&gt;MUST factor in both global and user-specific limits, like if redemption is entirely disabled (even temporarily) it MUST return 0.&lt;&#x2F;p&gt;
&lt;p&gt;MUST NOT revert.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; m&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;axRedeem&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; o&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;wner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; m&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;axShares&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;previewredeem&quot;&gt;previewRedeem&lt;&#x2F;h4&gt;
&lt;p&gt;Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block, given current on-chain conditions.&lt;&#x2F;p&gt;
&lt;p&gt;MUST return as close to and no more than the exact amount of assets that would be withdrawn in a &lt;code&gt;redeem&lt;&#x2F;code&gt; call in the same transaction. I.e. &lt;code&gt;redeem&lt;&#x2F;code&gt; should return the same or more &lt;code&gt;assets&lt;&#x2F;code&gt; as &lt;code&gt;previewRedeem&lt;&#x2F;code&gt; if called in the same transaction.&lt;&#x2F;p&gt;
&lt;p&gt;MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the redemption would be accepted, regardless if the user has enough shares, etc.&lt;&#x2F;p&gt;
&lt;p&gt;MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.&lt;&#x2F;p&gt;
&lt;p&gt;MUST NOT revert due to vault specific user&#x2F;global limits. MAY revert due to other conditions that would also cause &lt;code&gt;redeem&lt;&#x2F;code&gt; to revert.&lt;&#x2F;p&gt;
&lt;p&gt;Note that any unfavorable discrepancy between &lt;code&gt;convertToAssets&lt;&#x2F;code&gt; and &lt;code&gt;previewRedeem&lt;&#x2F;code&gt; SHOULD be considered slippage in share price or some other type of condition, meaning the depositor will lose assets by redeeming.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; p&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;reviewRedeem&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;iew&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;hares&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ssets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;redeem&quot;&gt;redeem&lt;&#x2F;h4&gt;
&lt;p&gt;Burns exactly &lt;code&gt;shares&lt;&#x2F;code&gt; from &lt;code&gt;owner&lt;&#x2F;code&gt; and sends &lt;code&gt;assets&lt;&#x2F;code&gt; of underlying tokens to &lt;code&gt;receiver&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST emit the &lt;code&gt;Withdraw&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;p&gt;MUST support a redeem flow where the shares are burned from &lt;code&gt;owner&lt;&#x2F;code&gt; directly where &lt;code&gt;owner&lt;&#x2F;code&gt; is &lt;code&gt;msg.sender&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST support a redeem flow where the shares are burned from &lt;code&gt;owner&lt;&#x2F;code&gt; directly where &lt;code&gt;msg.sender&lt;&#x2F;code&gt; has EIP-20 approval over the shares of &lt;code&gt;owner&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MAY support an additional flow in which the shares are transferred to the Vault contract before the &lt;code&gt;redeem&lt;&#x2F;code&gt; execution, and are accounted for during &lt;code&gt;redeem&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;SHOULD check &lt;code&gt;msg.sender&lt;&#x2F;code&gt; can spend owner funds using allowance.&lt;&#x2F;p&gt;
&lt;p&gt;MUST revert if all of &lt;code&gt;shares&lt;&#x2F;code&gt; cannot be redeemed (due to withdrawal limit being reached, slippage, the owner not having enough shares, etc).&lt;&#x2F;p&gt;
&lt;p&gt;Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed. Those methods should be performed separately.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;edeem&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;tateMutability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;onpayable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;hares&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eceiver&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; o&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;wner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  o&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;utputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ssets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;events&quot;&gt;Events&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;deposit-1&quot;&gt;Deposit&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;sender&lt;&#x2F;code&gt; has exchanged &lt;code&gt;assets&lt;&#x2F;code&gt; for &lt;code&gt;shares&lt;&#x2F;code&gt;, and transferred those &lt;code&gt;shares&lt;&#x2F;code&gt; to &lt;code&gt;owner&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST be emitted when tokens are deposited into the Vault via the &lt;code&gt;mint&lt;&#x2F;code&gt; and &lt;code&gt;deposit&lt;&#x2F;code&gt; methods.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; D&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eposit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;vent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; o&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;wner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ssets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;hares&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;withdraw-1&quot;&gt;Withdraw&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;sender&lt;&#x2F;code&gt; has exchanged &lt;code&gt;shares&lt;&#x2F;code&gt;, owned by &lt;code&gt;owner&lt;&#x2F;code&gt;, for &lt;code&gt;assets&lt;&#x2F;code&gt;, and transferred those &lt;code&gt;assets&lt;&#x2F;code&gt; to &lt;code&gt;receiver&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST be emitted when shares are withdrawn from the Vault in &lt;code&gt;EIP-4626.redeem&lt;&#x2F;code&gt; or &lt;code&gt;EIP-4626.withdraw&lt;&#x2F;code&gt; methods.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; W&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ithdraw&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;vent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;  i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;nputs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eceiver&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; o&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;wner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ssets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ame&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;hares&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      i&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ndexed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;      t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;ype&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;int256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The Vault interface is designed to be optimized for integrators with a feature complete yet minimal interface.
Details such as accounting and allocation of deposited tokens are intentionally not specified,
as Vaults are expected to be treated as black boxes on-chain and inspected off-chain before use.&lt;&#x2F;p&gt;
&lt;p&gt;EIP-20 is enforced because implementation details like token approval
and balance calculation directly carry over to the shares accounting.
This standardization makes the Vaults immediately compatible with all EIP-20 use cases in addition to EIP-4626.&lt;&#x2F;p&gt;
&lt;p&gt;The mint method was included for symmetry and feature completeness.
Most current use cases of share-based Vaults do not ascribe special meaning to the shares such that
a user would optimize for a specific number of shares (&lt;code&gt;mint&lt;&#x2F;code&gt;) rather than specific amount of underlying (&lt;code&gt;deposit&lt;&#x2F;code&gt;).
However, it is easy to imagine future Vault strategies which would have unique and independently useful share representations.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;convertTo&lt;&#x2F;code&gt; functions serve as rough estimates that do not account for operation specific details like withdrawal fees, etc.
They were included for frontends and applications that need an average value of shares or assets, not an exact value possibly including slippage or other fees.
For applications that need an exact value that attempts to account for fees and slippage we have included a corresponding &lt;code&gt;preview&lt;&#x2F;code&gt; function to match each mutable function. These functions must not account for deposit or withdrawal limits, to ensure they are easily composable, the &lt;code&gt;max&lt;&#x2F;code&gt; functions are provided for that purpose.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;EIP-4626 is fully backward compatible with the EIP-20 standard and has no known compatibility issues with other standards.
For production implementations of Vaults which do not use EIP-4626, wrapper adapters can be developed and used.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;See &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;transmissions11&#x2F;solmate&#x2F;blob&#x2F;main&#x2F;src&#x2F;tokens&#x2F;ERC4626.sol&quot;&gt;Solmate EIP-4626&lt;&#x2F;a&gt;:
a minimal and opinionated implementation of the standard with hooks for developers to easily insert custom logic into deposits and withdrawals.&lt;&#x2F;p&gt;
&lt;p&gt;See &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;fubuloubu&#x2F;ERC4626&quot;&gt;Vyper EIP-4626&lt;&#x2F;a&gt;:
a demo implementation of the standard in Vyper, with hooks for share price manipulation and other testing needs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Fully permissionless use cases could fall prey to malicious implementations which only conform to the interface but not the specification.
It is recommended that all integrators review the implementation for potential ways of losing user deposits before integrating.&lt;&#x2F;p&gt;
&lt;p&gt;If implementors intend to support EOA account access directly, they should consider adding an additional function call for &lt;code&gt;deposit&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;mint&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;withdraw&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;redeem&lt;&#x2F;code&gt; with the means to accommodate slippage loss or unexpected deposit&#x2F;withdrawal limits, since they have no other means to revert the transaction if the exact output amount is not achieved.&lt;&#x2F;p&gt;
&lt;p&gt;The methods &lt;code&gt;totalAssets&lt;&#x2F;code&gt;, &lt;code&gt;convertToShares&lt;&#x2F;code&gt; and &lt;code&gt;convertToAssets&lt;&#x2F;code&gt; are estimates useful for display purposes,
and do &lt;em&gt;not&lt;&#x2F;em&gt; have to confer the &lt;em&gt;exact&lt;&#x2F;em&gt; amount of underlying assets their context suggests.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;preview&lt;&#x2F;code&gt; methods return values that are as close as possible to exact as possible. For that reason, they are manipulable by altering the on-chain conditions and are not always safe to be used as price oracles. This specification includes &lt;code&gt;convert&lt;&#x2F;code&gt; methods that are allowed to be inexact and therefore can be implemented as robust price oracles. For example, it would be correct to implement the &lt;code&gt;convert&lt;&#x2F;code&gt; methods as using a time-weighted average price in converting between assets and shares.&lt;&#x2F;p&gt;
&lt;p&gt;Integrators of EIP-4626 Vaults should be aware of the difference between these view methods when integrating with this standard. Additionally, note that the amount of underlying assets a user may receive from redeeming their Vault shares (&lt;code&gt;previewRedeem&lt;&#x2F;code&gt;) can be significantly different than the amount that would be taken from them when minting the same quantity of shares (&lt;code&gt;previewMint&lt;&#x2F;code&gt;). The differences may be small (like if due to rounding error), or very significant (like if a Vault implements withdrawal or deposit fees, etc). Therefore integrators should always take care to use the preview function most relevant to their use case, and never assume they are interchangeable.&lt;&#x2F;p&gt;
&lt;p&gt;Finally, EIP-4626 Vault implementers should be aware of the need for specific, opposing rounding directions across the different mutable and view methods, as it is considered most secure to favor the Vault itself during calculations over its users:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;If (1) it&#x27;s calculating how many shares to issue to a user for a certain amount of the underlying tokens they provide or (2) it&#x27;s determining the amount of the underlying tokens to transfer to them for returning a certain amount of shares, it should round &lt;em&gt;down&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;If (1) it&#x27;s calculating the amount of shares a user has to supply to receive a given amount of the underlying tokens or (2) it&#x27;s calculating the amount of underlying tokens a user has to provide to receive a certain amount of shares, it should round &lt;em&gt;up&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The only functions where the preferred rounding direction would be ambiguous are the &lt;code&gt;convertTo&lt;&#x2F;code&gt; functions. To ensure consistency across all EIP-4626 Vault implementations it is specified that these functions MUST both always round &lt;em&gt;down&lt;&#x2F;em&gt;. Integrators may wish to mimic rounding up versions of these functions themselves, like by adding 1 wei to the result.&lt;&#x2F;p&gt;
&lt;p&gt;Although the &lt;code&gt;convertTo&lt;&#x2F;code&gt; functions should eliminate the need for any use of an EIP-4626 Vault&#x27;s &lt;code&gt;decimals&lt;&#x2F;code&gt; variable, it is still strongly recommended to mirror
the underlying token&#x27;s &lt;code&gt;decimals&lt;&#x2F;code&gt; if at all possible, to eliminate possible sources of confusion and simplify integration across front-ends and for other off-chain users.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Procedures for the EVM</title>
        <published>2021-12-16T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Greg Colvin</name><uri>https://github.com/gcolvin</uri>
	</author>
	
	<author>
		<name>Greg Colvin</name><email>greg@colvin.org</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4573/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-4573-named-procedures-for-evm-code-sections/7776" />
        

        <id>https://wg-eips.ritovision.com/4573/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:4573"
            label="EIP-4573" />
        

        
        

        
        <summary type="html">Introduces support for EVM Procedures.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4573/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Five EVM instructions are introduced to define, call, and return from named EVM &lt;em&gt;procedures&lt;&#x2F;em&gt; and access their &lt;em&gt;call frames&lt;&#x2F;em&gt; in memory - &lt;code&gt;ENTERPROC&lt;&#x2F;code&gt;, &lt;code&gt;LEAVEPROC&lt;&#x2F;code&gt;, &lt;code&gt;CALLPROC&lt;&#x2F;code&gt;, &lt;code&gt;RETURNPROC&lt;&#x2F;code&gt;, and &lt;code&gt;FRAMEADDRESS&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, Ethereum bytecode has no syntactic structure, and &lt;em&gt;subroutines&lt;&#x2F;em&gt; have no defined interfaces.&lt;&#x2F;p&gt;
&lt;p&gt;We propose to add &lt;em&gt;procedures&lt;&#x2F;em&gt; -- delimited blocks of code that can be entered only by calling into them via defined interfaces.&lt;&#x2F;p&gt;
&lt;p&gt;Also, the EVM currently has no automatic management of memory for &lt;em&gt;procedures&lt;&#x2F;em&gt;.  So we also propose to automatically reserve call frames on an in-memory stack.&lt;&#x2F;p&gt;
&lt;p&gt;Constraints on the use of &lt;em&gt;procedures&lt;&#x2F;em&gt; must be validated at contract initialization time to maintain the safety properties of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3779&#x2F;&quot;&gt;EIP-3779&lt;&#x2F;a&gt;: Valid programs will not halt with an exception unless they run out of gas or recursively overflow stack.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;prior-art&quot;&gt;Prior Art&lt;&#x2F;h3&gt;
&lt;p&gt;The terminology is not well-defined, but we will follow Intel in calling the low-level concept &lt;em&gt;subroutines&lt;&#x2F;em&gt; and the higher level concept &lt;em&gt;procedures&lt;&#x2F;em&gt;.  The distinction is that &lt;em&gt;subroutines&lt;&#x2F;em&gt; are little more than a jump that knows where it came from, whereas procedures have a defined interface and manage memory as a stack. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2315&#x2F;&quot;&gt;EIP-2315&lt;&#x2F;a&gt; introduces &lt;em&gt;subroutines&lt;&#x2F;em&gt;, and this EIP introduces &lt;em&gt;procedures&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;instructions&quot;&gt;Instructions&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;enterproc-0x-dest-section-uint8-dest-offset-uint8-n-inputs-uint16-n-outputs-uint16-n-locals-uint16&quot;&gt;ENTERPROC (0x??) dest_section: uint8, dest_offset: uint8, n_inputs: uint16, n_outputs: uint16, n_locals: uint16&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;frame_stack.push(FP)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;FP -= n_locals * 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PC +- &amp;lt;length of immediates&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Marks the entry point to a procedure&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;at offset &lt;code&gt;dest_offset&lt;&#x2F;code&gt; from the beginning of the &lt;code&gt;dest_section&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;taking &lt;code&gt;n_inputs&lt;&#x2F;code&gt; arguments from the data stack,&lt;&#x2F;li&gt;
&lt;li&gt;returning &lt;code&gt;n_outputs&lt;&#x2F;code&gt; values on the &lt;code&gt;data stack&lt;&#x2F;code&gt;, and&lt;&#x2F;li&gt;
&lt;li&gt;reserving &lt;code&gt;n_locals&lt;&#x2F;code&gt; words of data in memory on the &lt;code&gt;frame stack&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Procedures can only be entered via a &lt;code&gt;CALLPROC&lt;&#x2F;code&gt; to their entry point.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;leaveproc-0x&quot;&gt;LEAVEPROC (0x??)&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   FP = frame_stack.pop()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   asm RETURNSUB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;blockquote&gt;
&lt;p&gt;Pop the &lt;code&gt;frame stack&lt;&#x2F;code&gt; and return to the calling procedure using &lt;code&gt;RETURNSUB&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;Marks the end of a procedure.  Each &lt;code&gt;ENTERPROC&lt;&#x2F;code&gt; requires a closing &lt;code&gt;LEAVEPROC&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Note: Attempts to jump into a procedure (including its  &lt;code&gt;LEAVEPROC&lt;&#x2F;code&gt;) from outside of the procedure or to jump or step to &lt;code&gt;ENTERPROC&lt;&#x2F;code&gt; at all must be prevented at validation time.  &lt;code&gt;CALLPROC&lt;&#x2F;code&gt; is the only valid way to enter a procedure.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;callproc-0x-dest-section-uint16-dest-proc-uint16&quot;&gt;CALLPROC (0x??) dest_section: uint16, dest_proc: uint16&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  FP -= n_locals&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  asm JUMPSUB &amp;lt;offset of section&amp;gt; + &amp;lt;offset of procedure&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;blockquote&gt;
&lt;p&gt;Allocate a &lt;em&gt;stack frame&lt;&#x2F;em&gt; and transfer control and &lt;code&gt;JUMPSUB&lt;&#x2F;code&gt; to the Nth (N=&lt;em&gt;dest_proc&lt;&#x2F;em&gt;) &lt;em&gt;procedure&lt;&#x2F;em&gt; in the Mth(M=&lt;em&gt;dest_section&lt;&#x2F;em&gt;) &lt;em&gt;section&lt;&#x2F;em&gt; of the code.  &lt;em&gt;Section 0&lt;&#x2F;em&gt; is the current code section, any other code sections are indexed starting at &lt;em&gt;1&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;&lt;em&gt;Note: That the procedure is defined and the required &lt;code&gt;n_inputs&lt;&#x2F;code&gt; words are available on the &lt;code&gt;data stack&lt;&#x2F;code&gt; must be shown at validation time.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;returnproc-0x&quot;&gt;RETURNPROC (0x??)&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   FP += n_locals&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   asm RETURNSUB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;blockquote&gt;
&lt;p&gt;Pop the &lt;code&gt;frame stack&lt;&#x2F;code&gt; and return control to the calling procedure using &lt;code&gt;RETURNSUB&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;&lt;em&gt;Note: That the promised &lt;code&gt;n_outputs&lt;&#x2F;code&gt; words are available on the &lt;code&gt;data stack&lt;&#x2F;code&gt; must be shown at validation time.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;frameaddress-0x-offset-int16&quot;&gt;FRAMEADDRESS (0x??) offset: int16&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;asm PUSH2 FP + offset&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;blockquote&gt;
&lt;p&gt;Push the address &lt;code&gt;FP + offset&lt;&#x2F;code&gt; onto the data stack.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;Call frame data is addressed at an immediate &lt;code&gt;offset&lt;&#x2F;code&gt; relative to &lt;code&gt;FP&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Typical usage includes storing data on a call frame&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0xdada&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;FRAMEADDRESS 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;MSTORE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;and loading data from a call frame&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;FRAMEADDRESS 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;MLOAD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;memory-costs&quot;&gt;Memory Costs&lt;&#x2F;h3&gt;
&lt;p&gt;Presently,&lt;code&gt;MSTORE&lt;&#x2F;code&gt; is defined as&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   memory[stack[0]...stack[0]+31] = stack[1]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   memory_size = max(memory_size,floor((stack[0]+32)÷32)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;where &lt;code&gt;memory_size&lt;&#x2F;code&gt; is the number of active words of memory above &lt;em&gt;0&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;We propose to treat memory addresses as signed, so the formula needs to be&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   memory[stack[0]...stack[0]+31] = stack[1]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   if (stack[0])+32)÷32) &amp;lt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      negative_memory_size = max(negative_memory_size,floor((stack[0]+32)÷32))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   else&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      positive_memory_size = max(positive_memory_size,floor((stack[0]+32)÷32))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   memory_size = positive_memory_size + negative_memory_size&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;where &lt;code&gt;negative_memory_size&lt;&#x2F;code&gt; is the number of active words of memory below &lt;em&gt;0&lt;&#x2F;em&gt; and&lt;&#x2F;li&gt;
&lt;li&gt;where &lt;code&gt;positive_memory_size&lt;&#x2F;code&gt; is the number of active words of memory at or above &lt;em&gt;0&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;call-frame-stack&quot;&gt;Call Frame Stack&lt;&#x2F;h3&gt;
&lt;p&gt;These instructions make use of a &lt;code&gt;frame stack&lt;&#x2F;code&gt; to allocate and free frames of local data for &lt;em&gt;procedures&lt;&#x2F;em&gt; in memory.  Frame memory begins at address 0 in memory and grows downwards, towards more negative addresses.  A frame is allocated for each procedure when it is called, and freed when it returns.&lt;&#x2F;p&gt;
&lt;p&gt;Memory can be addressed relative to the frame pointer &lt;code&gt;FP&lt;&#x2F;code&gt; or by absolute address.  &lt;code&gt;FP&lt;&#x2F;code&gt; starts at 0, and moves downward towards more negative addresses to point to the frame for each &lt;code&gt;CALLPROC&lt;&#x2F;code&gt; and moving upward towards less negative addresses to point to the previous frame for the corresponding &lt;code&gt;RETURNPROC&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Equivalently, in the EVM&#x27;s twos-complement arithmetic, &lt;code&gt;FP&lt;&#x2F;code&gt; moves from the highest address down, as is common in many calling conventions.&lt;&#x2F;p&gt;
&lt;p&gt;For example, after an initial &lt;code&gt;CALLPROC&lt;&#x2F;code&gt; to a procedure needing two words of data the &lt;code&gt;frame stack&lt;&#x2F;code&gt; might look like this&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     0-&amp;gt; ........&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         ........&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    FP-&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Then, after a further &lt;code&gt;CALLPROC&lt;&#x2F;code&gt; to a procedure needing three words of data the &lt;code&gt;frame stack&lt;&#x2F;code&gt; would like this&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     0-&amp;gt; ........&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         ........&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   -64-&amp;gt; ........&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         ........&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         ........&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    FP-&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;After a &lt;code&gt;RETURNPROC&lt;&#x2F;code&gt; from that procedure the &lt;code&gt;frame stack&lt;&#x2F;code&gt; would look like this&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     0-&amp;gt; ........&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         ........&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    FP-&amp;gt; ........&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         ........&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         ........&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;and after a final &lt;code&gt;RETURNPROC&lt;&#x2F;code&gt;, like this&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    FP-&amp;gt; ........&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         ........&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         ........&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         ........&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         ........&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;There is actually not much new here.  It amounts to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;615&#x2F;&quot;&gt;EIP-615&lt;&#x2F;a&gt;, refined and refactored into bite-sized pieces, along lines common to other machines.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal uses the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2315&#x2F;&quot;&gt;EIP-2315&lt;&#x2F;a&gt; return stack to manage calls and returns, and steals ideas from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;615&#x2F;&quot;&gt;EIP-615&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3336&#x2F;&quot;&gt;EIP-3336&lt;&#x2F;a&gt;, and  &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4200&#x2F;&quot;&gt;EIP-4200&lt;&#x2F;a&gt;. &lt;code&gt;ENTERPROC&lt;&#x2F;code&gt; corresponds to &lt;code&gt;BEGINSUB&lt;&#x2F;code&gt; from EIP-615.  Like EIP-615 it uses a frame stack to track call-frame addresses with &lt;code&gt;FP&lt;&#x2F;code&gt; as &lt;em&gt;procedures&lt;&#x2F;em&gt; are entered and left, but like EIP-3336 and EIP-3337 it moves call frames from the data stack to memory.&lt;&#x2F;p&gt;
&lt;p&gt;Aliasing call frames with ordinary memory supports  addressing call-frame data with ordinary stores and loads.  This is generally useful, especially for languages like C that provide pointers to variables on the stack.&lt;&#x2F;p&gt;
&lt;p&gt;The design model here is the &lt;em&gt;subroutines&lt;&#x2F;em&gt; and &lt;em&gt;procedures&lt;&#x2F;em&gt; of the Intel x86 architecture.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;JUMPSUB&lt;&#x2F;code&gt; and &lt;code&gt;RETURNSUB&lt;&#x2F;code&gt; (from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2315&#x2F;&quot;&gt;EIP-2315&lt;&#x2F;a&gt; -- like &lt;code&gt;CALL&lt;&#x2F;code&gt; and &lt;code&gt;RET&lt;&#x2F;code&gt; -- jump to and return from &lt;em&gt;subroutines&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ENTERPROC&lt;&#x2F;code&gt;  -- like &lt;code&gt;ENTER&lt;&#x2F;code&gt; -- sets up the stack frame for a &lt;em&gt;procedure&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CALLPROC&lt;&#x2F;code&gt; amounts to a &lt;code&gt;JUMPSUB&lt;&#x2F;code&gt; to an &lt;code&gt;ENTERPROC&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RETURNPROC&lt;&#x2F;code&gt; amounts to an early &lt;code&gt;LEAVEPROC&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;LEAVEPROC&lt;&#x2F;code&gt; -- like &lt;code&gt;LEAVE&lt;&#x2F;code&gt; -- takes down the stack frame for a &lt;em&gt;procedure&lt;&#x2F;em&gt;.  It then executes a &lt;code&gt;RETURNSUB&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal adds new EVM opcodes.  It doesn&#x27;t remove or change the semantics of any existing opcodes, so there should be no backwards compatibility issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security&quot;&gt;Security&lt;&#x2F;h2&gt;
&lt;p&gt;Safe use of these constructs must be checked completely at validation time -- per EIP-3779 -- so there should be no security issues at runtime.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;ENTERPROC&lt;&#x2F;code&gt; and &lt;code&gt;LEAVEPROC&lt;&#x2F;code&gt; must follow the same safety rules as for &lt;code&gt;JUMPSUB&lt;&#x2F;code&gt; and &lt;code&gt;RETURNSUB&lt;&#x2F;code&gt; in EIP-2315. In addition, the following constraints must be validated:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Every&lt;code&gt;ENTERPROC&lt;&#x2F;code&gt; must be followed by a &lt;code&gt;LEAVEPROC&lt;&#x2F;code&gt; to delimit the bodies of &lt;em&gt;procedures&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;There can be no nested &lt;em&gt;procedures&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;There can be no jump into the body of a procedure (including its &lt;code&gt;LEAVEPROC&lt;&#x2F;code&gt;) from outside of that body.&lt;&#x2F;li&gt;
&lt;li&gt;There can be no jump or step to &lt;code&gt;BEGINPROC&lt;&#x2F;code&gt; at all -- only &lt;code&gt;CALLPROC&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The specified &lt;code&gt;n_inputs&lt;&#x2F;code&gt; and &lt;code&gt;n_outputs&lt;&#x2F;code&gt; must be on the stack.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>721&#x2F;20-compatible transfer</title>
        <published>2021-12-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Ross Campbell</name><uri>https://github.com/z0r0z</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4521/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-4521-721-20-compatible-transfer/7903" />
        

        <id>https://wg-eips.ritovision.com/4521/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:4521"
            label="ERC-4521" />
        

        
        

        
        <summary type="html">Recommends a simple extension to make NFTs compatible with apps and contracts that handle fungibles.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4521/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;ERC-721, the popular standard for non-fungible tokens (NFTs), includes send functions, such as &lt;code&gt;transferFrom()&lt;&#x2F;code&gt; and &lt;code&gt;safeTransferFrom()&lt;&#x2F;code&gt;, but does not include a backwards-compatible &lt;code&gt;transfer()&lt;&#x2F;code&gt; found in fungible ERC-20 tokens. This standard provides references to add such a &lt;code&gt;transfer()&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This standard proposes a simple extension to allow NFTs to work with contracts designed to manage ERC-20s and many consumer wallets which expect to be able to execute a token &lt;code&gt;transfer()&lt;&#x2F;code&gt;. For example, if an NFT is inadvertently sent to a contract that typically handles ERC-20, that NFT will be locked. It should also simplify the task for contract programmers if they can rely on &lt;code&gt;transfer()&lt;&#x2F;code&gt; to both handle ERC-20 and NFTs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;The interface for ERC-4521 &lt;code&gt;transfer()&lt;&#x2F;code&gt; MUST conform to ERC-20 and resulting transfers MUST fire the &lt;code&gt;Transfer&lt;&#x2F;code&gt; event as described in ERC-721.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Replicating ERC-20 &lt;code&gt;transfer()&lt;&#x2F;code&gt; with just a minor change to accurately reflect that a unique &lt;code&gt;tokenId&lt;&#x2F;code&gt; rather than fungible sum is being sent is desirable for code simplicity and to make integration easier.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP does not introduce any known backward compatibility issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;A reference implementation of an ERC-4521 &lt;code&gt;transfer()&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; ownerOf&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;NOT_OWNER&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        unchecked&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            balanceOf&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            balanceOf&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        delete&lt;&#x2F;span&gt;&lt;span&gt; getApproved&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ownerOf&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        success &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Implementers must be sure to include the relevant return &lt;code&gt;bool&lt;&#x2F;code&gt; value for an ERC-4521 in order to conform with existing contracts that use ERC-20 interfaces, otherwise, NFTs may be locked unless a &lt;code&gt;safeTransfer&lt;&#x2F;code&gt; is used in such contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Wrapped Deposits</title>
        <published>2021-12-11T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Justice Hudson</name><uri>https://github.com/jchancehud</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4546/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/wrapped-deposit-contract-eip/7740" />
        

        <id>https://wg-eips.ritovision.com/4546/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:4546"
            label="ERC-4546" />
        

        
        

        
        <summary type="html">A singleton contract for managing asset deposits.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4546/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The wrapped deposit contract handles deposits of assets (Ether, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;) on behalf of a user. A user must only approve a spend limit once and then an asset may be deposited to any number of different applications that support deposits from the contract.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The current user flow for depositing assets in dapps is unnecessarily expensive and insecure. To deposit an ERC-20 asset a user must either:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;send an approve transaction for the exact amount being sent, before making a deposit, and then repeat this process for every subsequent deposit.&lt;&#x2F;li&gt;
&lt;li&gt;send an approve transaction for an infinite spend amount before making deposits.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The first option is inconvenient, and expensive. The second option is insecure. Further, explaining approvals to new or non-technical users is confusing. This has to be done in &lt;em&gt;every&lt;&#x2F;em&gt; dapp that supports ERC20 deposits.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The wrapped deposit contract SHOULD be deployed at an identifiable address (e.g. &lt;code&gt;0x1111119a9e30bceadf9f939390293ffacef93fe9&lt;&#x2F;code&gt;). The contract MUST be non-upgradable with no ability for state variables to be changed.&lt;&#x2F;p&gt;
&lt;p&gt;The wrapped deposit contract MUST have the following public functions:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;depositERC20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;depositERC721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;safeDepositERC721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;safeDepositERC1155&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;batchDepositERC1155&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; values&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;depositEther&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Each of these functions MUST revert if &lt;code&gt;to&lt;&#x2F;code&gt; is an address with a zero code size. Each function MUST attempt to call a method on the &lt;code&gt;to&lt;&#x2F;code&gt; address confirming that it is willing and able to accept the deposit. If this function call does not return a true value execution MUST revert. If the asset transfer is not successful execution MUST revert.&lt;&#x2F;p&gt;
&lt;p&gt;The following interfaces SHOULD exist for contracts wishing to accept deposits:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC20Receiver&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; acceptERC20Deposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; depositor&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721Receiver&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; acceptERC721Deposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; depositor&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC1155Receiver&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; acceptERC1155Deposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; depositor&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; acceptERC1155BatchDeposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; depositor&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; values&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EtherReceiver&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; acceptEtherDeposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; depositor&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;A receiving contract MAY implement any of these functions as desired. If a given function is not implemented deposits MUST not be sent for that asset type.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Having a single contract that processes all token transfers allows users to submit a single approval per token to deposit to any number of contracts. The user does not have to trust receiving contracts with token spend approvals and receiving contracts have their complexity reduced by not having to implement token transfers themselves.&lt;&#x2F;p&gt;
&lt;p&gt;User experience is improved because a simple global dapp can be implemented with the messaging: &quot;enable token for use in other apps&quot;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is not backward compatible. Any contract planning to use this deposit system must implement specific functions to accept deposits. Existing contracts that are upgradeable can add support for this EIP retroactively by implementing one or more accept deposit functions.&lt;&#x2F;p&gt;
&lt;p&gt;Upgraded contracts can allow deposits using both the old system (approving the contract itself) and the proposed deposit system to preserve existing approvals. New users should be prompted to use the proposed deposit system.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ^&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC20Receiver&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; acceptERC20Deposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; depositor&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721Receiver&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; acceptERC721Deposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; depositor&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC1155Receiver&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; acceptERC1155Deposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; depositor&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; acceptERC1155BatchDeposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; depositor&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; values&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EtherReceiver&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; acceptEtherDeposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; depositor&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC20&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC721&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC1155&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeBatchTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _ids&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _values&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; WrappedDeposit&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; depositERC20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    _assertContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC20Receiver&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;acceptERC20Deposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodeWithSelector&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      IERC20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;transferFrom&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;selector&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; returndata&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; backward compat for tokens incorrectly implementing the transfer function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;returndata&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;decode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;returndata&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ERC20 operation did not succeed&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; depositERC721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    _assertContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC721Receiver&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;acceptERC721Deposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    IERC721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeDepositERC721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    _assertContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC721Receiver&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;acceptERC721Deposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    IERC721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;safeTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeDepositERC1155&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    _assertContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC1155Receiver&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;acceptERC1155Deposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    IERC1155&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;safeTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; batchDepositERC1155&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; values&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    _assertContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC1155Receiver&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;acceptERC1155BatchDeposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; values&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    IERC1155&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;safeBatchTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenIds&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; values&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; depositEther&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    _assertContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;EtherReceiver&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;acceptEtherDeposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; )&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;call&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;value&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;nonpayable&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _assertContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; c&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; view&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; size&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      size&lt;&#x2F;span&gt;&lt;span&gt; :&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; extcodesize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;size&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;noncontract&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The wrapped deposit implementation should be as small as possible to reduce the risk of bugs. The contract should be small enough that an engineer can read and understand it in a few minutes.&lt;&#x2F;p&gt;
&lt;p&gt;Receiving contracts MUST verify that &lt;code&gt;msg.sender&lt;&#x2F;code&gt; is equal to the wrapped deposit contract. Failing to do so allows anyone to simulate deposits.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>QR Code transmission protocol for wallets</title>
        <published>2021-12-07T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Aaron Chen</name><uri>https://github.com/aaronisme</uri>
	</author>
	
	<author>
		<name>Sora Lee</name><uri>https://github.com/soralit</uri>
	</author>
	
	<author>
		<name>ligi</name><uri>https://github.com/ligi</uri>
	</author>
	
	<author>
		<name>Dan Miller</name><uri>https://github.com/danjm</uri>
	</author>
	
	<author>
		<name>AndreasGassmann</name><uri>https://github.com/andreasgassmann</uri>
	</author>
	
	<author>
		<name>xardass</name><uri>https://github.com/xardass</uri>
	</author>
	
	<author>
		<name>Lixin Liu</name><uri>https://github.com/BitcoinLixin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4527/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/add-qr-code-scanning-between-software-wallet-cold-signer-hardware-wallet/6568" />
        

        <id>https://wg-eips.ritovision.com/4527/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:4527"
            label="ERC-4527" />
        

        
        

        
        <summary type="html">QR Code data transmission protocol between wallets and offline signers.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4527/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The purpose of this EIP is to provide a process and data transmission protocol via QR Code between offline signers and watch-only wallets.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;There is an increasing number of users whom like to use complete offline signers to manage their private keys, signers like hardware wallets and mobile phones in offline mode. In order to sign transactions or data, these offline signers have to rely on a watch-only wallet since it would prepare the data to be signed. Currently, there are 4 possible data transmission methods between offline signers and watch-only wallets: QR Code, USB, Bluetooth, and file transfer. The QR Code data transmission method have the following advantages when compared to the other three methods mentioned above:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Transparency and Security: Compared to USB or Bluetooth, users can easily decode the data via QR Code (with the help of some tools). It can also help users clearly identify what they are going to sign, which improves transparency and thus better security.&lt;&#x2F;li&gt;
&lt;li&gt;Improved Compatibility: Compared to USB and Bluetooth, QR Code data transmissions has a wider range of compatibility. Normally, it wouldn’t be broken by software changes like browser upgrades, system upgrade, and etc.&lt;&#x2F;li&gt;
&lt;li&gt;Improved User experience: QR Code data transmissions can provide a better user experience compared to USB, Bluetooth, and file transfer especially when the user is using a mobile device.&lt;&#x2F;li&gt;
&lt;li&gt;A smaller attack surface: USB and Bluetooth have a bigger attack surface than QR-Codes.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Due to these advantages, QR Code data transmissions is a better choice. Unfortunately, there is no modern standard for how offline signers should work with watch-only wallets nor how data should be encoded.
This EIP presents a standard process and data transmission protocol for offline signers to work with watch-only wallets.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;Offline signer&lt;&#x2F;strong&gt;: An offline signer is a device or application which holds the user’s private keys and does not have network access.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Watch-only wallet&lt;&#x2F;strong&gt;: A watch-only wallet is a wallet that has network access and can interact with the Ethereum blockchain.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;process&quot;&gt;Process&lt;&#x2F;h3&gt;
&lt;p&gt;In order to work with offline signers, the watch-only wallet should follow the following process.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The offline signer provides the public key information to the watch-only wallet to generate addresses, sync balances and etc via QR Codes.&lt;&#x2F;li&gt;
&lt;li&gt;The watch-only wallet generates the unsigned data and sends it to an offline signer for signing via QR Code, data that can include transactions, typed data, and etc.&lt;&#x2F;li&gt;
&lt;li&gt;The offline signer signs the data and provides a signature back to the watch-only wallet via QR Code.&lt;&#x2F;li&gt;
&lt;li&gt;The watch-only wallet receives the signature, constructs the signed data (transaction) and performs the following activities like broadcasting the transaction etc.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;data-transmission-protocol&quot;&gt;Data Transmission Protocol&lt;&#x2F;h3&gt;
&lt;p&gt;Since a single QR Code can only contain a limited amount of data, animated QR Codes should be utilized for data transmission. The &lt;code&gt;BlockchainCommons&lt;&#x2F;code&gt; have published a series of data transmission protocol called Uniform Resources (UR). It provides a basic method to encode data into animated QR Codes. This EIP will use UR and extend its current definition.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;Concise Binary Object Representation(CBOR)&lt;&#x2F;code&gt; will be used for binary data encoding. &lt;code&gt;Concise Data Definition Language(CDDL)&lt;&#x2F;code&gt; will be used for expressing the CBOR.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;setting-up-the-watch-only-wallet-with-the-offline-signer&quot;&gt;Setting up the watch-only wallet with the offline signer&lt;&#x2F;h3&gt;
&lt;p&gt;In order to allow a watch-only wallet to collect information from the Ethereum blockchain, the offline signer would need to provide the public keys to the watch-only wallet in which the wallet will use them to query the necessary information from the Ethereum blockchain.&lt;&#x2F;p&gt;
&lt;p&gt;In such a case, offline signers should provide the extended public keys and derivation path. The UR Type called &lt;code&gt;crypto-hdkey&lt;&#x2F;code&gt; will be used to encode this data and the derivation path will be encoded as &lt;code&gt;crypto-keypath&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;cddl-for-key-path&quot;&gt;CDDL for Key Path&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;crypto-keypath&lt;&#x2F;code&gt; will be used to specify the key path.The following specification is written in Concise Data Definition Language(CDDL) for &lt;code&gt;crypto-key-path&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;; Metadata for the derivation path of a key.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;; `source-fingerprint`, if present, is the fingerprint of the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;; ancestor key from which the associated key was derived.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;; If `components` is empty, then `source-fingerprint` MUST be a fingerprint of&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;; a master key.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;; `depth`, if present, represents the number of derivation steps in&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;; the path of the associated key, even if not present in the `components` element&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;; of this structure.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    crypto-keypath = {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        components: [path-component], ; If empty, source-fingerprint MUST be present&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ? source-fingerprint: uint32 .ne 0 ; fingerprint of ancestor key, or master key if components is empty&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ? depth: uint8 ; 0 if this is a public key derived directly from a master key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    path-component = (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        child-index &#x2F; child-index-range &#x2F; child-index-wildcard-range,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        is-hardened&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    uint32 = uint .size 4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    uint31 = uint32 .lt 2147483648 ;0x80000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    child-index = uint31&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    child-index-range = [child-index, child-index] ; [low, high] where low &amp;lt; high&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    child-index-wildcard = []&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    is-hardened = bool&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    components = 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    source-fingerprint = 2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    depth = 3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;cddl-for-extended-public-keys&quot;&gt;CDDL for Extended Public Keys&lt;&#x2F;h4&gt;
&lt;p&gt;Since the purpose is to transfer public key data, the definition of &lt;code&gt;crypto-hdkey&lt;&#x2F;code&gt; will be kept only for public key usage purposes.&lt;&#x2F;p&gt;
&lt;p&gt;The following specification is written in Concise Data Definition Language &lt;code&gt;CDDL&lt;&#x2F;code&gt; and includes the crypto-keypath spec above.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;; An hd-key must be a derived key.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;hd-key = {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    derived-key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;; A derived key must be public, has an optional chain code, and&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;; may carry additional metadata about its use and derivation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;; To maintain isomorphism with [BIP32] and allow keys to be derived from&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;; this key `chain-code`, `origin`, and `parent-fingerprint` must be present.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;; If `origin` contains only a single derivation step and also contains `source-fingerprint`,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;; then `parent-fingerprint` MUST be identical to `source-fingerprint` or may be omitted.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;derived-key = (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    key-data: key-data-bytes,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ? chain-code: chain-code-bytes       ; omit if no further keys may be derived from this key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ? origin: #6.304(crypto-keypath),    ; How the key was derived&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ? name: text,                        ; A short name for this key.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ? source: text,                      ; The device info or any other description for this key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;key-data = 3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;chain-code = 4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;origin = 6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;name = 9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;source = 10&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;uint8 = uint .size 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;key-data-bytes = bytes .size 33&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;chain-code-bytes = bytes .size 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;If the chain-code is provided, then it can be used to derive child keys but if it isn’t provided, it is simply a solo key and the origin can be provided to indicate the derivation key path.&lt;&#x2F;p&gt;
&lt;p&gt;If the signer would like to provide multiple public keys instead of the extended public key for any reason, the signer can use &lt;code&gt;crypto-account&lt;&#x2F;code&gt; for that.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;sending-the-unsigned-data-from-the-watch-only-wallet-to-the-offline-signer&quot;&gt;Sending the unsigned data from the watch-only wallet to the offline signer&lt;&#x2F;h3&gt;
&lt;p&gt;To send the unsigned data from a watch-only wallet to an offline signer, the new UR type &lt;code&gt;eth-sign-request&lt;&#x2F;code&gt; will be introduced to encode the signing request.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;cddl-for-eth-sign-request&quot;&gt;CDDL for Eth Sign Request.&lt;&#x2F;h4&gt;
&lt;p&gt;The following specification is written in Concise Data Definition Language &lt;code&gt;CDDL&lt;&#x2F;code&gt;.
UUIDs in this specification notated UUID are CBOR binary strings tagged with #6.37, per the IANA &lt;code&gt;CBOR Tags Registry&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;; Metadata for the signing request for Ethereum.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sign-data-type = {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    type: int .default 1 transaction data; the unsigned data type&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;eth-transaction-data = 1; legacy transaction rlp encoding of unsigned transaction data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;eth-typed-data = 2; EIP-712 typed signing data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;eth-raw-bytes=3;   for signing message usage, like EIP-191 personal_sign data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;eth-typed-transaction=4; EIP-2718 typed transaction of unsigned transaction data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;; Metadata for the signing request for Ethereum.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;; request-id: the identifier for this signing request.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;; sign-data: the unsigned data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;; data-type: see sign-data-type definition&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;; chain-id: chain id definition see https:&#x2F;&#x2F;github.com&#x2F;ethereum-lists&#x2F;chains for detail&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;; derivation-path: the key path of the private key to sign the data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;; address: Ethereum address of the signing type for verification purposes which is optional&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;eth-sign-request = (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sign-data: sign-data-bytes, ; sign-data is the data to be signed by offline signer, currently it can be unsigned transaction or typed data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    data-type: #3.401(sign-data-type),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    chain-id: int .default 1,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    derivation-path: #5.304(crypto-keypath), ;the key path for signing this request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ?request-id: uuid, ; the uuid for this signing request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ?address: eth-address-bytes,            ;verification purpose for the address of the signing key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ?origin: text  ;the origin of this sign request, like wallet name&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;request-id = 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sign-data = 2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;data-type = 3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;chain-id = 4 ;it will be the chain id of ethereum related blockchain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;derivation-path = 5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;address = 6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;origin = 7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;eth-address-bytes = bytes .size 20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sign-data-bytes = bytes ; for unsigned transactions it will be the rlp encoding for unsigned transaction data and ERC 712 typed data it will be the bytes of json string.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;the-signature-provided-by-offline-signers-to-watch-only-wallets&quot;&gt;The signature provided by offline signers to watch-only wallets&lt;&#x2F;h3&gt;
&lt;p&gt;After the data is signed, the offline signer should send the signature back to the watch-only wallet. The new UR type called &lt;code&gt;eth-signature&lt;&#x2F;code&gt; is introduced here to encode this data.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;cddl-for-eth-signature&quot;&gt;CDDL for Eth Signature.&lt;&#x2F;h4&gt;
&lt;p&gt;The following specification is written in Concise Data Definition Language &lt;code&gt;CDDL&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;eth-signature  = (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    request-id: uuid,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signature: eth-signature-bytes,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ? origin: text, ; The device info for providing this signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;request-id = 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;signature = 2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;origin = 3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;eth-signature-bytes = bytes .size 65; the signature of the signing request (r,s,v)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP uses some existing UR types like &lt;code&gt;crypto-keypath&lt;&#x2F;code&gt; and &lt;code&gt;crypto-hdkey&lt;&#x2F;code&gt; and also introduces some new UR types like &lt;code&gt;eth-sign-request&lt;&#x2F;code&gt; and &lt;code&gt;eth-signature&lt;&#x2F;code&gt;. Here are the reasons we choose UR for the QR Code data transmission protocol:&lt;&#x2F;p&gt;
&lt;h3 id=&quot;ur-provides-a-solid-foundation-for-qr-code-data-transmission&quot;&gt;UR provides a solid foundation for QR Code data transmission&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Uses the alphanumeric QR code mode for efficiency.&lt;&#x2F;li&gt;
&lt;li&gt;Includes a CRC32 checksum of the entire message in each part to tie the different parts of the QR code together and ensure the transmitted message has been reconstructed.&lt;&#x2F;li&gt;
&lt;li&gt;uses &lt;code&gt;Fountain Code&lt;&#x2F;code&gt; for the arbitrary amount of data which can be both a minimal, finite sequence of parts and an indefinite sequence of parts. The Fountain Code can ultimately help the receiver to make the data extraction easier.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;ur-provides-existing-helpful-types-and-scalability-for-new-usages&quot;&gt;UR provides existing helpful types and scalability for new usages&lt;&#x2F;h3&gt;
&lt;p&gt;Currently, UR has provided some existing types like &lt;code&gt;crypto-keypath&lt;&#x2F;code&gt; and &lt;code&gt;crypto-hdkey&lt;&#x2F;code&gt; so it is quite easy to add a new type and definitions for new usages.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;ur-has-an-active-air-gapped-wallet-community&quot;&gt;UR has an active air-gapped wallet community.&lt;&#x2F;h3&gt;
&lt;p&gt;Currently, the UR has an active &lt;code&gt;airgapped wallet community&lt;&#x2F;code&gt; which continues to improve the UR forward.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, there is no existing protocol to define data transmissions via QR Codes so there are no backward compatibility issues that needs to be addressed now.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;The test cases can be found on the &lt;code&gt;ur-registry-eth&lt;&#x2F;code&gt; package released by the Keystone team.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The reference implementation can be found on the &lt;code&gt;ur-registry-eth&lt;&#x2F;code&gt; package released by the Keystone team.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The offline signer should decode all the data from &lt;code&gt;eth-sign-request&lt;&#x2F;code&gt; and show them to the user for confirmation prior to signing. It is recommended to provide an address field in the &lt;code&gt;eth-sign-request&lt;&#x2F;code&gt;. If provided, the offline signer should verify the address being the same one as the address associated with the signing key.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Safer ERC-20</title>
        <published>2021-12-05T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>William Schwab</name><uri>https://github.com/wschwab</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4524/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/why-isnt-there-an-erc-for-safetransfer-for-erc20/7604" />
        

        <id>https://wg-eips.ritovision.com/4524/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:4524"
            label="ERC-4524" />
        

        
        

        
        <summary type="html">Extending ERC-20 with ERC165 and adding safeTransfer (like ERC-721 and ERC-1155)</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4524/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard extends &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;EIP-165&lt;&#x2F;a&gt;, and adds familiar functions from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; ensuring receiving contracts have implemented proper functionality.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;EIP-165&lt;&#x2F;a&gt; adds (among other things) the ability to tell if a target recipient explicitly signals compatibility with an ERC. This is already used in the EIPs for NFTs, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt;. In addition, EIP-165 is a valuable building block for extensions on popular standards to signal implementation, a trend we&#x27;ve seen in a number of NFT extensions. This EIP aims to bring these innovations back to ERC-20.&lt;&#x2F;p&gt;
&lt;p&gt;The importance of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;EIP-165&lt;&#x2F;a&gt; is perhaps felt most for app developers looking to integrate with a generic standard such as ERC-20 or ERC-721, while integrating newer innovations built atop these standards. An easy example would be token permits, which allow for a one-transaction approval and transfer. This has already been implemented in many popular ERC-20 tokens using the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2612&#x2F;&quot;&gt;ERC-2612&lt;&#x2F;a&gt; standard or similar. A platform integrating ERC-20 tokens has no easy way of telling if a particular token has implemented token permits or not. (As of this writing, ERC-2612 does not require EIP-165.) With EIP-165, the app (or contracts) could query &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; to see if the &lt;code&gt;interfaceId&lt;&#x2F;code&gt; of a particular EIP is registered (in this case, EIP-2612), allowing for easier and more modular functions interacting with ERC-20 contracts. It is already common in NFT extensions to include an EIP-165 interface with a standard, we would argue this is at least in part due to the underlying &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; standards integrating EIP-165. Our hope is that this extension to ERC-20 would also help future extensions by making them easier to integrate.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;In order to be compliant with this EIP, and ERC-20-compliant contract MUST also implement the following functions:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0.8.10&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;#39;.&#x2F;IERC20.sol&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;#39;.&#x2F;IERC165.sol&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the EIP-165 interfaceId for this interface is 0x534f5876&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SaferERC&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;20&lt;&#x2F;span&gt;&lt;span&gt; is IERC20&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; IERC165 &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;safeTransfer&lt;&#x2F;code&gt; and &lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt; MUST transfer as expected to EOA addresses, and to contracts implementing &lt;code&gt;ERC20Receiver&lt;&#x2F;code&gt; and returning the function selector (&lt;code&gt;0x4fc35859&lt;&#x2F;code&gt;) when called, and MUST revert when transferring to a contract which either does not have &lt;code&gt;ERC20Receiver&lt;&#x2F;code&gt; implemented, or does not return the function selector when called.&lt;&#x2F;p&gt;
&lt;p&gt;In addition, a contract accepting safe transfers MUST implement the following if it wishes to accept safe transfers, and MUST return the function selector (&lt;code&gt;0x4fc35859&lt;&#x2F;code&gt;):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0.8.10&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;#39;.&#x2F;IERC165.sol&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC20Receiver&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC165&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onERC20Received&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is meant to be minimal and straightforward. Adding EIP-165 to ERC-20 is useful for a number of applications, and outside of a minimal amount of code increasing contract size, carries no downside. The &lt;code&gt;safeTransfer&lt;&#x2F;code&gt; and &lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt; functions are well recognized from ERC-721 and ERC-1155, and therefore keeping identical naming conventions is reasonable, and the benefits of being able to check for implementation before transferring are as useful for ERC-20 tokens as they are for ERC-721 and ERC-1155.&lt;&#x2F;p&gt;
&lt;p&gt;Another easy backport from EIP721 and EIP1155 might be the inclusion of a metadata URI for tokens, allowing them to easily reference logo and other details. This has not been included, both in order to keep this EIP as minimal as possible, and because it is already sufficiently covered by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1046&#x2F;&quot;&gt;EIP-1046&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;There are no issues with backwards compatibility in this EIP, as the full suite of ERC-20 functions is unchanged.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases have been provided in the implementation repo &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;wschwab&#x2F;SaferERC-20&#x2F;blob&#x2F;main&#x2F;src&#x2F;SaferERC-20.t.sol&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;A sample repo demonstrating an implementation of this EIP has been created &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;wschwab&#x2F;SaferERC-20&quot;&gt;here&lt;&#x2F;a&gt;. It is (as of this writing) in a Dapptools environment, for details on installing and running Dapptools see the Dapptools repo.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;onERC20Received&lt;&#x2F;code&gt;  is a callback function. Callback functions have been exploited in the past as a reentrancy vector, and care should be taken to make sure implementations are not vulnerable.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Non-Fungible Tokens Tied to Physical Assets</title>
        <published>2021-12-03T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Javier Arcenegui</name><uri>https://github.com/Hardblock-IMSE-CNM</uri>
	</author>
	
	<author>
		<name>Rosario Arjona</name><uri>https://github.com/RosarioArjona</uri>
	</author>
	
	<author>
		<name>Roberto Román</name><email>roman@imse-cnm.csic.es</email>
	</author>
	
	<author>
		<name>Iluminada Baturone</name><uri>https://github.com/lumi2018</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4519/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/new-proposal-of-smart-non-fungible-token/7677" />
        

        <id>https://wg-eips.ritovision.com/4519/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:4519"
            label="ERC-4519" />
        

        
        

        
        <summary type="html">Interface for non-fungible tokens representing physical assets that can generate or recover their own accounts and obey users.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4519/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP standardizes an interface for non-fungible tokens representing physical assets, such as Internet of Things (IoT) devices. These NFTs are tied to physical assets and can verify the authenticity of the tie. They can include an Ethereum address of the physical asset, permitting physical assets to sign messages and transactions. Physical assets can operate with an operating mode defined by its corresponding NFT.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This standard was developed because &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; only tracks ownership (not usage rights) and does not track the Ethereum addresses of the asset. The popularity of smart assets, such as IoT devices, is increasing. To permit secure and traceable management, these NFTs can be used to establish secure communication channels between the physical asset, its owner, and its user.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The attributes &lt;code&gt;addressAsset&lt;&#x2F;code&gt; and &lt;code&gt;addressUser&lt;&#x2F;code&gt; are, respectively, the Ethereum addresses of the physical asset and the user. They are optional attributes but at least one of them should be used in an NFT. In the case of using only the attribute &lt;code&gt;addressUser&lt;&#x2F;code&gt;, two states define if the token is assigned or not to a user. &lt;code&gt;Figure 1&lt;&#x2F;code&gt; shows these states in a flow chart. When a token is created, transferred or unassigned, the token state is set to &lt;code&gt;notAssigned&lt;&#x2F;code&gt;. If the token is assigned to a valid user, the state is set to &lt;code&gt;userAssigned&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4519&#x2F;.&#x2F;assets&#x2F;images&#x2F;Figure1.jpg&quot; alt=&quot;Figure 1 : Flow chart of the token states with addressUser defined (and addressAsset undefined)&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;In the case of defining the attribute &lt;code&gt;addressAsset&lt;&#x2F;code&gt; but not the attribute &lt;code&gt;addressUser&lt;&#x2F;code&gt;, two states define if the token is waiting for authentication with the owner or if the authentication has finished successfully. &lt;code&gt;Figure 2&lt;&#x2F;code&gt; shows these states in a flow chart. When a token is created or transferred to a new owner, then the token changes its state to &lt;code&gt;waitingForOwner&lt;&#x2F;code&gt;. In this state, the token is waiting for the mutual authentication between the asset and the owner. Once authentication is finished successfully, the token changes its state to &lt;code&gt;engagedWithOwner&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4519&#x2F;.&#x2F;assets&#x2F;images&#x2F;Figure2.jpg&quot; alt=&quot;Figure 2 : Flow chart of the token states with addressAsset defined (and addressUser undefined)&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Finally, if both the attributes &lt;code&gt;addressAsset&lt;&#x2F;code&gt; and &lt;code&gt;addressUser&lt;&#x2F;code&gt; are defined, the states of the NFT define if the asset has been engaged or not with the owner or the user (&lt;code&gt;waitingForOwner&lt;&#x2F;code&gt;, &lt;code&gt;engagedWithOwner&lt;&#x2F;code&gt;, &lt;code&gt;waitingForUser&lt;&#x2F;code&gt; and &lt;code&gt;engagedWithUser&lt;&#x2F;code&gt;). The flow chart in &lt;code&gt;Figure 3&lt;&#x2F;code&gt; shows all the possible state changes. The states related to the owner are the same as in &lt;code&gt;Figure 2&lt;&#x2F;code&gt;. The difference is that, at the state &lt;code&gt;engagedWithOwner&lt;&#x2F;code&gt;, the token can be assigned to a user. If a user is assigned (the token being at states &lt;code&gt;engagedWithOwner&lt;&#x2F;code&gt;, &lt;code&gt;waitingForUser&lt;&#x2F;code&gt; or &lt;code&gt;engagedWithUser&lt;&#x2F;code&gt;), then the token changes its state to &lt;code&gt;waitingForUser&lt;&#x2F;code&gt;. Once the asset and the user authenticate each other, the state of the token is set to &lt;code&gt;engagedWithUser&lt;&#x2F;code&gt;, and the user is able to use the asset.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4519&#x2F;.&#x2F;assets&#x2F;images&#x2F;Figure3.jpg&quot; alt=&quot;Figure 3 : Flow chart of the token states with addressUser and addressUser defined&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;In order to complete the ownership transfer of a token, the new owner must carry out a mutual authentication process with the asset, which is off-chain with the asset and on-chain with the token, by using their Ethereum addresses. Similarly, a new user must carry out a mutual authentication process with the asset to complete a use transfer. NFTs define how the authentication processes start and finish. These authentication processes allow deriving fresh session cryptographic keys for secure communication between assets and owners, and between assets and users. Therefore, the trustworthiness of the assets can be traced even if new owners and users manage them.&lt;&#x2F;p&gt;
&lt;p&gt;When the NFT is created or when the ownership is transferred, the token state is &lt;code&gt;waitingForOwner&lt;&#x2F;code&gt;. The asset sets its operating mode to &lt;code&gt;waitingForOwner&lt;&#x2F;code&gt;. The owner generates a pair of keys using the elliptic curve secp256k1 and the primitive element P used on this curve: a secret key SK&lt;sub&gt;O_A&lt;&#x2F;sub&gt; and a Public Key PK&lt;sub&gt;O_A&lt;&#x2F;sub&gt;, so that PK&lt;sub&gt;O_A&lt;&#x2F;sub&gt; = SK&lt;sub&gt;O_A&lt;&#x2F;sub&gt; * P. To generate the shared key between the owner and the asset, K&lt;sub&gt;O&lt;&#x2F;sub&gt;, the public key of the asset, PK&lt;sub&gt;A&lt;&#x2F;sub&gt;, is employed as follows:&lt;&#x2F;p&gt;
&lt;p&gt;K&lt;sub&gt;O&lt;&#x2F;sub&gt; = PK&lt;sub&gt;A&lt;&#x2F;sub&gt; * SK&lt;sub&gt;O_A&lt;&#x2F;sub&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Using the function &lt;code&gt;startOwnerEngagement&lt;&#x2F;code&gt;, PK&lt;sub&gt;O_A&lt;&#x2F;sub&gt; is saved as the attribute &lt;code&gt;dataEngagement&lt;&#x2F;code&gt; and the hash of K&lt;sub&gt;O&lt;&#x2F;sub&gt; as the attribute &lt;code&gt;hashK_OA&lt;&#x2F;code&gt;. The owner sends request engagement to the asset, and the asset calculates:&lt;&#x2F;p&gt;
&lt;p&gt;K&lt;sub&gt;A&lt;&#x2F;sub&gt; = SK&lt;sub&gt;A&lt;&#x2F;sub&gt; * PK&lt;sub&gt;O_A&lt;&#x2F;sub&gt;&lt;&#x2F;p&gt;
&lt;p&gt;If everything is correctly done, K&lt;sub&gt;O&lt;&#x2F;sub&gt; and K&lt;sub&gt;A&lt;&#x2F;sub&gt; are the same since:&lt;&#x2F;p&gt;
&lt;p&gt;K&lt;sub&gt;O&lt;&#x2F;sub&gt; = PK&lt;sub&gt;A&lt;&#x2F;sub&gt; * SK&lt;sub&gt;O_A&lt;&#x2F;sub&gt; = (SK&lt;sub&gt;A&lt;&#x2F;sub&gt; * P) * SK&lt;sub&gt;O_A&lt;&#x2F;sub&gt; = SK&lt;sub&gt;A&lt;&#x2F;sub&gt; * (SK&lt;sub&gt;O_A&lt;&#x2F;sub&gt; * P) = SK&lt;sub&gt;A&lt;&#x2F;sub&gt; * PK&lt;sub&gt;O_A&lt;&#x2F;sub&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Using the function &lt;code&gt;ownerEngagement&lt;&#x2F;code&gt;, the asset sends the hash of K&lt;sub&gt;A&lt;&#x2F;sub&gt;, and if it is the same as the data in &lt;code&gt;hashK_OA&lt;&#x2F;code&gt;, then the state of the token changes to &lt;code&gt;engagedWithOwner&lt;&#x2F;code&gt; and the event &lt;code&gt;OwnerEngaged&lt;&#x2F;code&gt; are sent. Once the asset receives the event, it changes its operation mode to &lt;code&gt;engagedWithOwner&lt;&#x2F;code&gt;. This process is shown in &lt;code&gt;Figure 4&lt;&#x2F;code&gt;. From this moment, the asset can be managed by the owner and they can communicate in a secure way using the shared key.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4519&#x2F;.&#x2F;assets&#x2F;images&#x2F;Figure4.jpg&quot; alt=&quot;Figure 4: Steps in a successful owner and asset mutual authentication process&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;If the asset consults Ethereum and the state of its NFT is &lt;code&gt;waitingForUser&lt;&#x2F;code&gt;, the asset (assuming it is an electronic physical asset) sets its operating mode to &lt;code&gt;waitingForUser&lt;&#x2F;code&gt;. Then, a mutual authentication process is carried out with the user, as already done with the owner. The user sends the transaction associated with the function &lt;code&gt;startUserEngagement&lt;&#x2F;code&gt;. As in &lt;code&gt;startOwnerEngagement&lt;&#x2F;code&gt;, this function saves the public key generated by the user, PK&lt;sub&gt;U_A&lt;&#x2F;sub&gt;, as the attribute &lt;code&gt;dataEngagement&lt;&#x2F;code&gt; and the hash of K&lt;sub&gt;U&lt;&#x2F;sub&gt; = PK&lt;sub&gt;A&lt;&#x2F;sub&gt; * SK&lt;sub&gt;U_A&lt;&#x2F;sub&gt; as the attribute &lt;code&gt;hashK_UA&lt;&#x2F;code&gt; in the NFT.&lt;&#x2F;p&gt;
&lt;p&gt;The user sends request engagement and the asset calculates:&lt;&#x2F;p&gt;
&lt;p&gt;K&lt;sub&gt;A&lt;&#x2F;sub&gt; = SK&lt;sub&gt;A&lt;&#x2F;sub&gt; * PK&lt;sub&gt;U_A&lt;&#x2F;sub&gt;&lt;&#x2F;p&gt;
&lt;p&gt;If everything is correctly done, K&lt;sub&gt;U&lt;&#x2F;sub&gt; and K&lt;sub&gt;A&lt;&#x2F;sub&gt; are the same since:&lt;&#x2F;p&gt;
&lt;p&gt;K&lt;sub&gt;U&lt;&#x2F;sub&gt; = PK&lt;sub&gt;A&lt;&#x2F;sub&gt; * SK&lt;sub&gt;U_A&lt;&#x2F;sub&gt; = (SK&lt;sub&gt;A&lt;&#x2F;sub&gt; * P) * SK&lt;sub&gt;U_A&lt;&#x2F;sub&gt; = SK&lt;sub&gt;A&lt;&#x2F;sub&gt; * (SK&lt;sub&gt;U_A&lt;&#x2F;sub&gt; * P) = SK&lt;sub&gt;A&lt;&#x2F;sub&gt; * PK&lt;sub&gt;U_A&lt;&#x2F;sub&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Using the function &lt;code&gt;userEngagement&lt;&#x2F;code&gt;, the asset sends the hash of K&lt;sub&gt;A&lt;&#x2F;sub&gt; obtained and if it is the same as the data in &lt;code&gt;hashK_UA&lt;&#x2F;code&gt;, then the state of the token changes to &lt;code&gt;engagedWithUser&lt;&#x2F;code&gt; and the event &lt;code&gt;UserEngaged&lt;&#x2F;code&gt; is sent. Once the asset receives the event, it changes its operation mode to &lt;code&gt;engagedWithUser&lt;&#x2F;code&gt;. This process is shown in &lt;code&gt;Figure 5&lt;&#x2F;code&gt;. From this moment, the asset can be managed by the user and they can communicate in a secure way using the shared key.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4519&#x2F;.&#x2F;assets&#x2F;images&#x2F;Figure5.jpg&quot; alt=&quot;Figure 5: Steps in a successful user and asset mutual authentication process&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Since the establishment of a shared secret key is very important for a secure communication, NFTs include the attributes
&lt;code&gt;hashK_OA&lt;&#x2F;code&gt;, &lt;code&gt;hashK_UA&lt;&#x2F;code&gt; and &lt;code&gt;dataEngagement&lt;&#x2F;code&gt;. The first two attributes define, respectively, the hash of the secret key shared between the asset and its owner and between the asset and its user. Assets, owners and users should check they are using the correct shared secret keys. The attribute &lt;code&gt;dataEngagement&lt;&#x2F;code&gt; defines the public data needed for the agreement.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; EIP-4519 NFT: Extension of EIP-721 Non-Fungible Token Standard. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;  Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the EIP-165 identifier for this interface is 0x8a68abe3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EIP&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4519&lt;&#x2F;span&gt;&lt;span&gt; NFT is EIP721&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;,EIP165&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when the NFT is assigned as utility of a new user.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  This event emits when the user of the token changes.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  (`_addressUser` == 0) when no user is assigned.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UserAssigned&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _addressUser&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when user and asset finish mutual authentication process successfully.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  This event emits when both the user and the asset prove they share a secure communication channel.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UserEngaged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when owner and asset finish mutual authentication process successfully.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  This event emits when both the owner and the asset prove they share a secure communication channel.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OwnerEngaged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when it is checked that the timeout has expired.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  This event emits when the timestamp of the EIP-4519 NFT is not updated in timeout.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TimeoutAlarm&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function defines how the NFT is assigned as utility of a new user (if &amp;quot;addressUser&amp;quot; is defined).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Only the owner of the EIP-4519 NFT can assign a user. If &amp;quot;addressAsset&amp;quot; is defined, then the state of the token must be&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &amp;quot;engagedWithOwner&amp;quot;,&amp;quot;waitingForUser&amp;quot; or &amp;quot;engagedWithUser&amp;quot; and this function changes the state of the token defined by &amp;quot;_tokenId&amp;quot; to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &amp;quot;waitingForUser&amp;quot;. If &amp;quot;addressAsset&amp;quot; is not defined, the state is set to &amp;quot;userAssigned&amp;quot;. In both cases, this function sets the parameter &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &amp;quot;addressUser&amp;quot; to &amp;quot;_addressUser&amp;quot;. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the tokenId of the EIP-4519 NFT tied to the asset.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _addressUser&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the address of the new user.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setUser&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _addressUser&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function defines the initialization of the mutual authentication process between the owner and the asset.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Only the owner of the token can start this authentication process if &amp;quot;addressAsset&amp;quot; is defined and the state of the token is &amp;quot;waitingForOwner&amp;quot;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The function does not change the state of the token and saves &amp;quot;_dataEngagement&amp;quot; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; and &amp;quot;_hashK_OA&amp;quot; in the parameters of the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the tokenId of the EIP-4519 NFT tied to the asset.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _dataEngagement&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the public data proposed by the owner for the agreement of the shared key.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _hashK_OA&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the hash of the secret proposed by the owner to share with the asset.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; startOwnerEngagement&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _dataEngagement&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _hashK_OA&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function completes the mutual authentication process between the owner and the asset.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Only the asset tied to the token can finish this authentication process provided that the state of the token is&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &amp;quot;waitingForOwner&amp;quot; and dataEngagement is different from 0. This function compares hashK_OA saved in&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the token with hashK_A. If they are equal then the state of the token changes to &amp;quot;engagedWithOwner&amp;quot;, dataEngagement is set to 0,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; and the event &amp;quot;OwnerEngaged&amp;quot; is emitted.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _hashK_A&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the hash of the secret generated by the asset to share with the owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ownerEngagement&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _hashK_A&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function defines the initialization of the mutual authentication process between the user and the asset.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Only the user of the token can start this authentication process if &amp;quot;addressAsset&amp;quot; and &amp;quot;addressUser&amp;quot; are defined and&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the state of the token is &amp;quot;waitingForUser&amp;quot;. The function does not change the state of the token and saves &amp;quot;_dataEngagement&amp;quot; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; and &amp;quot;_hashK_UA&amp;quot; in the parameters of the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the tokenId of the EIP-4519 NFT tied to the asset.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _dataEngagement&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the public data proposed by the user for the agreement of the shared key.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _hashK_UA&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the hash of the secret proposed by the user to share with the asset.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; startUserEngagement&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _dataEngagement&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _hashK_UA&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function completes the mutual authentication process between the user and the asset.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Only the asset tied to the token can finish this authentication process provided that the state of the token is&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &amp;quot;waitingForUser&amp;quot; and dataEngagement is different from 0. This function compares hashK_UA saved in&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the token with hashK_A. If they are equal then the state of the token changes to &amp;quot;engagedWithUser&amp;quot;, dataEngagement is set to 0,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; and the event &amp;quot;UserEngaged&amp;quot; is emitted.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _hashK_A&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the hash of the secret generated by the asset to share with the user.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; userEngagement&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _hashK_A&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function checks if the timeout has expired.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Everybody can call this function to check if the timeout has expired. The event &amp;quot;TimeoutAlarm&amp;quot; is emitted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if the timeout has expired.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the tokenId of the EIP-4519 NFT tied to the asset.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; true&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if timeout has expired and false in other case.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checkTimeout&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function sets the value of timeout.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Only the owner of the token can set this value provided that the state of the token is &amp;quot;engagedWithOwner&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &amp;quot;waitingForUser&amp;quot; or &amp;quot;engagedWithUser&amp;quot;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the tokenId of the EIP-4519 NFT tied to the asset.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _timeout&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the value to assign to timeout.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setTimeout&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _timeout&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function updates the timestamp, thus avoiding the timeout alarm.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Only the asset tied to the token can update its own timestamp.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; updateTimestamp&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function lets obtain the tokenId from an address. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Everybody can call this function. The code executed only reads from Ethereum.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _addressAsset&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the address to obtain the tokenId from it.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; of the token tied to the asset that generates _addressAsset.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenFromBCA&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _addressAsset&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function lets know the owner of the token from the address of the asset tied to the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Everybody can call this function. The code executed only reads from Ethereum.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _addressAsset&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the address to obtain the owner from it.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; of the token bound to the asset that generates _addressAsset.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ownerOfFromBCA&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _addressAsset&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function lets know the user of the token from its tokenId.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Everybody can call this function. The code executed only reads from Ethereum.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the tokenId of the EIP-4519 NFT tied to the asset.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; user&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; of the token from its _tokenId.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; userOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function lets know the user of the token from the address of the asset tied to the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Everybody can call this function. The code executed only reads from Ethereum.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _addressAsset&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the address to obtain the user from it.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; user&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; of the token tied to the asset that generates _addressAsset.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; userOfFromBCA&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _addressAsset&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function lets know how many tokens are assigned to a user.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Everybody can call this function. The code executed only reads from Ethereum.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _addressUser&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the address of the user.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; number&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; of tokens assigned to a user.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; userBalanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _addressUser&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function lets know how many tokens of a particular owner are assigned to a user.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Everybody can call this function. The code executed only reads from Ethereum.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _addressUser&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the address of the user.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _addressOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the address of the owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; number&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; of tokens assigned to a user from an owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; userBalanceOfAnOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _addressUser&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _addressOwner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;authentication&quot;&gt;Authentication&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP uses smart contracts to verify the mutual authentication process since smart contracts are trustless.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;tie-time&quot;&gt;Tie Time&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP proposes including the attribute timestamp (to register in Ethereum the last time that the physical asset checked the tie with its token) and the attribute timeout (to register the maximum delay time established for the physical asset to prove again the tie). These attributes avoid that a malicious owner or user could use the asset endlessly.&lt;&#x2F;p&gt;
&lt;p&gt;When the asset calls &lt;code&gt;updateTimestamp&lt;&#x2F;code&gt;, the smart contract must call &lt;code&gt;block.timestamp&lt;&#x2F;code&gt;, which provides current block timestamp as seconds since Unix epoch. For this reason, &lt;code&gt;timeout&lt;&#x2F;code&gt;  must be provided in seconds.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;eip-721-based&quot;&gt;EIP-721-based&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; is the most commonly-used standard for generic NFTs. This EIP extends EIP-721 for backwards compatibility.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is an extension of EIP-721. It is fully compatible with both of the commonly used optional extensions (&lt;code&gt;IERC721Metadata&lt;&#x2F;code&gt; and &lt;code&gt;IERC721Enumerable&lt;&#x2F;code&gt;) mentioned in the EIP-721 standard.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;The test cases presented in the paper shown below are available &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4519&#x2F;assets&#x2F;PoC_SmartNFT&#x2F;README&#x2F;&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;A first version was presented in a paper of the Special Issue &lt;strong&gt;Security, Trust and Privacy in New Computing Environments&lt;&#x2F;strong&gt; of &lt;strong&gt;Sensors&lt;&#x2F;strong&gt; journal of &lt;strong&gt;MDPI&lt;&#x2F;strong&gt; editorial. The paper, entitled &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4519&#x2F;.&#x2F;assets&#x2F;sensors-21-03119.pdf&quot;&gt;Secure Combination of IoT and Blockchain by Physically Binding IoT Devices to Smart Non-Fungible Tokens Using PUFs&lt;&#x2F;a&gt;, was written by the same authors of this EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;In this EIP, a generic system has been proposed for the creation of non-fungible tokens tied to physical assets. A generic point of view based on the improvements of the current EIP-721 NFT is provided, such as the implementation of the user management mechanism, which does not affect the token&#x27;s ownership. The physical asset should have the ability to generate an Ethereum address from itself in a totally random way so that only the asset is able to know the secret from which the Ethereum address is generated. In this way, identity theft is avoided and the asset can be proven to be completely genuine. In order to ensure this, it is recommended that only the manufacturer of the asset has the ability to create its associated token. In the case of an IoT device, the device firmware will be unable to share and modify the secret. Instead of storing the secrets, it is recommended that assets reconstruct their secrets from non-sensitive information such as the helper data associated with Physical Unclonable Functions (PUFs). Although a secure key exchange protocol based on elliptic curves has been proposed, the token is open to coexist with other types of key exchange.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Multi-byte opcodes prefixed by EB and EC.</title>
        <published>2021-12-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Brayton Goodall</name><uri>https://github.com/Spore-Druid-Bray</uri>
	</author>
	
	<author>
		<name>Mihir Faujdar</name><uri>https://github.com/uink45</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4520/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/multi-byte-opcodes/7681" />
        

        <id>https://wg-eips.ritovision.com/4520/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:4520"
            label="EIP-4520" />
        

        
        

        
        <summary type="html">Reserve `0xEB` and `0xEC` for usage as extended opcode space.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4520/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Reserve &lt;code&gt;0xEB&lt;&#x2F;code&gt; and &lt;code&gt;0xEC&lt;&#x2F;code&gt; for usage as extended opcode space.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;It would be convenient to introduce new opcodes that are likely to be infrequently used, whilst also being able to have greater than 256 opcodes in total. As a single byte opcode is half the size of a double byte opcode, the greatest efficiency in code sizes will be one where frequently used opcodes are single bytes. Two prefix bytes are used to accommodate up to 510 double byte opcodes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;For example, a new arithmetic opcode may be allocated to &lt;code&gt;0xEC 01&lt;&#x2F;code&gt;(&lt;code&gt;ADD&lt;&#x2F;code&gt;), and a novel opcode may be introduced at &lt;code&gt;0xEB F4&lt;&#x2F;code&gt;(&lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;Triple byte opcodes may be doubly-prefixed by &lt;code&gt;0xEB EB&lt;&#x2F;code&gt;, &lt;code&gt;0xEC EC&lt;&#x2F;code&gt;, &lt;code&gt;0xEB EC&lt;&#x2F;code&gt; and &lt;code&gt;0xEC EB&lt;&#x2F;code&gt;. It is possible to allocate experimental opcodes to this triple-byte space initially, and if they prove safe and useful, they could later be allocated a location in double-byte or single-byte space.&lt;&#x2F;p&gt;
&lt;p&gt;Only &lt;code&gt;0xEB EB&lt;&#x2F;code&gt;, &lt;code&gt;0xEC EC&lt;&#x2F;code&gt;, &lt;code&gt;0xEC EC&lt;&#x2F;code&gt;, and &lt;code&gt;0xEB EC&lt;&#x2F;code&gt; may be interpreted as further extensions of the opcode space. &lt;code&gt;0xEB&lt;&#x2F;code&gt; and &lt;code&gt;0xEC&lt;&#x2F;code&gt; do not themselves affect the stack or memory, however opcodes specified by further bytes may. If a multi-byte opcode is yet to be defined, it is to be treated as &lt;code&gt;INVALID&lt;&#x2F;code&gt; rather than as a &lt;code&gt;NOP&lt;&#x2F;code&gt;, as per usual for undefined opcodes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;It was considered that two prefix bytes rather than one would be adequate for reservation as extension addresses. Both &lt;code&gt;0xEB&lt;&#x2F;code&gt; and &lt;code&gt;0xEC&lt;&#x2F;code&gt; were chosen to be part of the E-series of opcodes. For example, the &lt;code&gt;0xEF&lt;&#x2F;code&gt; byte is reserved for contracts conforming to the Ethereum Object Format. By having unassigned opcodes for extending the opcode space, there will be a lower risk of breaking the functionalities of deployed contracts compared to choosing assigned opcodes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Previous usage of &lt;code&gt;0xEB&lt;&#x2F;code&gt; and &lt;code&gt;0xEC&lt;&#x2F;code&gt; may result in unexpected behaviour and broken code.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;There are no known security considerations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Permit for ERC-721 NFTs</title>
        <published>2021-11-25T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Simon Fremaux</name><uri>https://github.com/dievardump</uri>
	</author>
	
	<author>
		<name>William Schwab</name><uri>https://github.com/wschwab</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4494/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-extending-erc2612-style-permits-to-erc721-nfts/7519/2" />
        

        <id>https://wg-eips.ritovision.com/4494/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:4494"
            label="ERC-4494" />
        

        
        

        
        <summary type="html">ERC-712-singed approvals for ERC-721 NFTs</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4494/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The &quot;Permit&quot; approval flow outlined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2612&#x2F;&quot;&gt;ERC-2612&lt;&#x2F;a&gt; has proven a very valuable advancement in UX by creating gasless approvals for ERC20 tokens. This EIP extends the pattern to ERC-721 NFTs. This EIP borrows heavily from ERC-2612.&lt;&#x2F;p&gt;
&lt;p&gt;This requires a separate EIP due to the difference in structure between ERC-20 and ERC-721 tokens. While ERC-20 permits use value (the amount of the ERC-20 token being approved) and a nonce based on the owner&#x27;s address, ERC-721 permits focus on the &lt;code&gt;tokenId&lt;&#x2F;code&gt; of the NFT and increment nonce based on the transfers of the NFT.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The permit structure outlined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2612&#x2F;&quot;&gt;ERC-2612&lt;&#x2F;a&gt; allows for a signed message (structured as outlined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;ERC-712&lt;&#x2F;a&gt;) to be used in order to create an approval. Whereas the normal approval-based pull flow generally involves two transactions, one to approve a contract and a second for the contract to pull the asset, which is poor UX and often confuses new users, a permit-style flow only requires signing a message and a transaction. Additional information can be found in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2612&#x2F;&quot;&gt;ERC-2612&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2612&#x2F;&quot;&gt;ERC-2612&lt;&#x2F;a&gt; only outlines a permit architecture for ERC-20 tokens. This ERC proposes an architecture for ERC-721 NFTs, which also contain an approve architecture that would benefit from a signed message-based approval flow.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;Three new functions MUST be added to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0.8.10&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERC165.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Interface for token permits for ERC-721&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC4494&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC165&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC165 bytes to add to interface array - set in parent contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; _INTERFACE_ID_ERC4494 = 0x5604e225&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Function to approve by way of owner signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the address to approve&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the index of the NFT to approve the spender on&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; deadline&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; a timestamp expiry for the permit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sig&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; a traditional or EIP-2098 signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; permit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; deadline&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sig&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the nonce of an NFT - useful for creating permits&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the index of the NFT to get the nonce of&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; uint256 representation of the nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; nonces&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the domain separator used in the encoding of the signature for permits, as defined by EIP-712&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; bytes32 domain separator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DOMAIN_SEPARATOR&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The semantics of which are as follows:&lt;&#x2F;p&gt;
&lt;p&gt;For all addresses &lt;code&gt;spender&lt;&#x2F;code&gt;, &lt;code&gt;uint256&lt;&#x2F;code&gt;s &lt;code&gt;tokenId&lt;&#x2F;code&gt;, &lt;code&gt;deadline&lt;&#x2F;code&gt;, and &lt;code&gt;nonce&lt;&#x2F;code&gt;, and &lt;code&gt;bytes&lt;&#x2F;code&gt; &lt;code&gt;sig&lt;&#x2F;code&gt;, a call to &lt;code&gt;permit(spender, tokenId, deadline, sig)&lt;&#x2F;code&gt; MUST set &lt;code&gt;spender&lt;&#x2F;code&gt; as approved on &lt;code&gt;tokenId&lt;&#x2F;code&gt; as long as the owner of &lt;code&gt;tokenId&lt;&#x2F;code&gt; remains in possession of it, and MUST emit a corresponding &lt;code&gt;Approval&lt;&#x2F;code&gt; event, if and only if the following conditions are met:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;the current blocktime is less than or equal to &lt;code&gt;deadline&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;the owner of the &lt;code&gt;tokenId&lt;&#x2F;code&gt; is not the zero address&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;nonces[tokenId]&lt;&#x2F;code&gt; is equal to &lt;code&gt;nonce&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;sig&lt;&#x2F;code&gt; is a valid &lt;code&gt;secp256k1&lt;&#x2F;code&gt; or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2098&#x2F;&quot;&gt;EIP-2098&lt;&#x2F;a&gt; signature from owner of the &lt;code&gt;tokenId&lt;&#x2F;code&gt;:&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;keccak256(abi.encodePacked(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   hex&amp;quot;1901&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   DOMAIN_SEPARATOR,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   keccak256(abi.encode(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            keccak256(&amp;quot;Permit(address spender,uint256 tokenId,uint256 nonce,uint256 deadline)&amp;quot;),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            spender,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            tokenId,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            nonce,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            deadline))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where &lt;code&gt;DOMAIN_SEPARATOR&lt;&#x2F;code&gt; MUST be defined according to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt;. The &lt;code&gt;DOMAIN_SEPARATOR&lt;&#x2F;code&gt; should be unique to the contract and chain to prevent replay attacks from other domains, and satisfy the requirements of EIP-712, but is otherwise unconstrained. A common choice for &lt;code&gt;DOMAIN_SEPARATOR&lt;&#x2F;code&gt; is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;DOMAIN_SEPARATOR = keccak256(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    abi.encode(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        keccak256(&amp;#39;EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)&amp;#39;),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        keccak256(bytes(name)),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        keccak256(bytes(version)),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        chainid,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address(this)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In other words, the message is the following ERC-712 typed structure:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;types&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;EIP712Domain&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;verifyingContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;Permit&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;spender&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;deadline&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;primaryType&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Permit&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;domain&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;721&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;m&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;h&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;d&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;verifyingContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;k&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;d&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;d&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;s&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;message&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;spender&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;p&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;d&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;deadline&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; d&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;d&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In addition:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;the &lt;code&gt;nonce&lt;&#x2F;code&gt; of a particular &lt;code&gt;tokenId&lt;&#x2F;code&gt; (&lt;code&gt;nonces[tokenId]&lt;&#x2F;code&gt;) MUST be incremented upon any transfer of the &lt;code&gt;tokenId&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;the &lt;code&gt;permit&lt;&#x2F;code&gt; function MUST check that the signer is not the zero address&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note that nowhere in this definition do we refer to &lt;code&gt;msg.sender&lt;&#x2F;code&gt;. The caller of the &lt;code&gt;permit&lt;&#x2F;code&gt; function can be any address.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP requires &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;EIP-165&lt;&#x2F;a&gt;. EIP165 is already required in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;, but is further necessary here in order to register the interface of this EIP. Doing so will allow easy verification if an NFT contract has implemented this EIP or not, enabling them to interact accordingly. The interface of this EIP (as defined in EIP-165) is &lt;code&gt;0x5604e225&lt;&#x2F;code&gt;. Contracts implementing this EIP MUST have the &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; function return &lt;code&gt;true&lt;&#x2F;code&gt; when called with &lt;code&gt;0x5604e225&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;permit&lt;&#x2F;code&gt; function is sufficient for enabling a &lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt; transaction to be made without the need for an additional transaction.&lt;&#x2F;p&gt;
&lt;p&gt;The format avoids any calls to unknown code.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;nonces&lt;&#x2F;code&gt; mapping is given for replay protection.&lt;&#x2F;p&gt;
&lt;p&gt;A common use case of permit has a relayer submit a Permit on behalf of the owner. In this scenario, the relaying party is essentially given a free option to submit or withhold the Permit. If this is a cause of concern, the owner can limit the time a Permit is valid for by setting deadline to a value in the near future. The deadline argument can be set to uint(-1) to create Permits that effectively never expire.&lt;&#x2F;p&gt;
&lt;p&gt;ERC-712 typed messages are included because of its use in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2612&#x2F;&quot;&gt;ERC-2612&lt;&#x2F;a&gt;, which in turn cites widespread adoption in many wallet providers.&lt;&#x2F;p&gt;
&lt;p&gt;While ERC-2612 focuses on the value being approved, this EIP focuses on the &lt;code&gt;tokenId&lt;&#x2F;code&gt; of the NFT being approved via &lt;code&gt;permit&lt;&#x2F;code&gt;. This enables a flexibility that cannot be achieved with ERC-20 (or even &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt;) tokens, enabling a single owner to give multiple permits on the same NFT. This is possible since each ERC-721 token is discrete (oftentimes referred to as non-fungible), which allows assertion that this token is still in the possession of the &lt;code&gt;owner&lt;&#x2F;code&gt; simply and conclusively.&lt;&#x2F;p&gt;
&lt;p&gt;Whereas ERC-2612 splits signatures into their &lt;code&gt;v,r,s&lt;&#x2F;code&gt; components, this EIP opts to instead take a &lt;code&gt;bytes&lt;&#x2F;code&gt; array of variable length in order to support &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2098&#x2F;&quot;&gt;EIP-2098&lt;&#x2F;a&gt; signatures (64 bytes), which cannot be easily separated or reconstructed from &lt;code&gt;r,s,v&lt;&#x2F;code&gt; components (65 bytes).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;There are already some ERC-721 contracts implementing a &lt;code&gt;permit&lt;&#x2F;code&gt;-style architecture, most notably Uniswap v3.&lt;&#x2F;p&gt;
&lt;p&gt;Their implementation differs from the specification here in that:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;the &lt;code&gt;permit&lt;&#x2F;code&gt; architecture is based on &lt;code&gt;owner&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;the &lt;code&gt;nonce&lt;&#x2F;code&gt; is incremented at the time the &lt;code&gt;permit&lt;&#x2F;code&gt; is created&lt;&#x2F;li&gt;
&lt;li&gt;the &lt;code&gt;permit&lt;&#x2F;code&gt; function must be called by the NFT owner, who is set as the &lt;code&gt;owner&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;the signature is split into &lt;code&gt;r,s,v&lt;&#x2F;code&gt; instead of &lt;code&gt;bytes&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Rationale for differing on design decisions is detailed above.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Basic test cases for the reference implementation can be found &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;dievardump&#x2F;erc721-with-permits&#x2F;tree&#x2F;main&#x2F;test&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;In general, test suites should assert at least the following about any implementation of this EIP:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;the nonce is incremented after each transfer&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;permit&lt;&#x2F;code&gt; approves the &lt;code&gt;spender&lt;&#x2F;code&gt; on the correct &lt;code&gt;tokenId&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;the permit cannot be used after the NFT is transferred&lt;&#x2F;li&gt;
&lt;li&gt;an expired permit cannot be used&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;A reference implementation has been set up &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;dievardump&#x2F;erc721-with-permits&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Extra care should be taken when creating transfer functions in which &lt;code&gt;permit&lt;&#x2F;code&gt; and a transfer function can be used in one function to make sure that invalid permits cannot be used in any way. This is especially relevant for automated NFT platforms, in which a careless implementation can result in the compromise of a number of user assets.&lt;&#x2F;p&gt;
&lt;p&gt;The remaining considerations have been copied from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2612&#x2F;&quot;&gt;ERC-2612&lt;&#x2F;a&gt; with minor adaptation, and are equally relevant here:&lt;&#x2F;p&gt;
&lt;p&gt;Though the signer of a &lt;code&gt;Permit&lt;&#x2F;code&gt; may have a certain party in mind to submit their transaction, another party can always front run this transaction and call &lt;code&gt;permit&lt;&#x2F;code&gt; before the intended party. The end result is the same for the &lt;code&gt;Permit&lt;&#x2F;code&gt; signer, however.&lt;&#x2F;p&gt;
&lt;p&gt;Since the ecrecover precompile fails silently and just returns the zero address as &lt;code&gt;signer&lt;&#x2F;code&gt; when given malformed messages, it is important to ensure &lt;code&gt;ownerOf(tokenId) != address(0)&lt;&#x2F;code&gt; to avoid &lt;code&gt;permit&lt;&#x2F;code&gt; from creating an approval to any &lt;code&gt;tokenId&lt;&#x2F;code&gt; which does not have an approval set.&lt;&#x2F;p&gt;
&lt;p&gt;Signed &lt;code&gt;Permit&lt;&#x2F;code&gt; messages are censorable. The relaying party can always choose to not submit the &lt;code&gt;Permit&lt;&#x2F;code&gt; after having received it, withholding the option to submit it. The &lt;code&gt;deadline&lt;&#x2F;code&gt; parameter is one mitigation to this. If the signing party holds ETH they can also just submit the &lt;code&gt;Permit&lt;&#x2F;code&gt; themselves, which can render previously signed &lt;code&gt;Permit&lt;&#x2F;code&gt;s invalid.&lt;&#x2F;p&gt;
&lt;p&gt;The standard &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;swcregistry.io&#x2F;docs&#x2F;SWC-114&quot;&gt;ERC-20 race condition for approvals&lt;&#x2F;a&gt; applies to &lt;code&gt;permit&lt;&#x2F;code&gt; as well.&lt;&#x2F;p&gt;
&lt;p&gt;If the &lt;code&gt;DOMAIN_SEPARATOR&lt;&#x2F;code&gt; contains the &lt;code&gt;chainId&lt;&#x2F;code&gt; and is defined at contract deployment instead of reconstructed for every signature, there is a risk of possible replay attacks between chains in the event of a future chain split.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Transaction calldata gas cost reduction with total calldata limit</title>
        <published>2021-11-23T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	<author>
		<name>Ansgar Dietrichs</name><uri>https://github.com/adietrichs</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4488/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-4488-transaction-calldata-gas-cost-reduction-with-total-calldata-limit/7555" />
        

        <id>https://wg-eips.ritovision.com/4488/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:4488"
            label="EIP-4488" />
        

        
        

        
        <summary type="html">Greatly decreases the gas cost of transaction calldata and simultaneously caps total transaction calldata in a block</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4488/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Decrease transaction calldata gas cost, and add a limit of how much total transaction calldata can be in a block.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Rollups are in the short and medium term, and possibly the long term, the only trustless scaling solution for Ethereum. Transaction fees on L1 have been very high for months and there is greater urgency in doing anything required to help facilitate an ecosystem-wide move to rollups. Rollups are significantly reducing fees for many Ethereum users: Optimism and Arbitrum frequently provide fees that are ~3-8x lower than the Ethereum base layer itself, and ZK rollups, which have better data compression and can avoid including signatures, have fees ~40-100x lower than the base layer.&lt;&#x2F;p&gt;
&lt;p&gt;However, even these fees are too expensive for many users. The long-term solution to the long-term inadequacy of rollups by themselves has always been &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs#sharding&quot;&gt;data sharding&lt;&#x2F;a&gt;, which would add ~1-2 MB&#x2F;sec of dedicated data space for rollups to the chain. However, data sharding will still take a considerable amount of time to finish implementing and deploying. Hence, a short-term solution to further cut costs for rollups, and to incentivize an ecosystem-wide transition to a rollup-centric Ethereum, is desired.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP presents a quick-to-implement short-term solution that also mitigates security risks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;NEW_CALLDATA_GAS_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;3&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;BASE_MAX_CALLDATA_PER_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;1,048,576&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CALLDATA_PER_TX_STIPEND&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;300&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Reduce the gas cost of transaction calldata to &lt;code&gt;NEW_CALLDATA_GAS_COST&lt;&#x2F;code&gt; per byte, regardless of whether the byte is zero or nonzero.&lt;&#x2F;p&gt;
&lt;p&gt;Add a rule that a block is only valid if &lt;code&gt;sum(len(tx.calldata) for tx in block.txs) &amp;lt;= BASE_MAX_CALLDATA_PER_BLOCK + len(block.txs) * CALLDATA_PER_TX_STIPEND&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;A natural alternative proposal is to decrease &lt;code&gt;NEW_CALLDATA_GAS_COST&lt;&#x2F;code&gt; without adding a limit. However, this presents a security concern: today, the average block size &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;etherscan.io&#x2F;chart&#x2F;blocksize&quot;&gt;is 60-90 kB&lt;&#x2F;a&gt;, but the &lt;em&gt;maximum&lt;&#x2F;em&gt; block size is &lt;code&gt;30M &#x2F; 16 = 1,875,000&lt;&#x2F;code&gt; bytes (plus about a kilobyte of block and tx overhead). Simply decreasing the calldata gas cost from 16 to 3 would increase the maximum block size to 10M bytes. This would push the Ethereum p2p networking layer to unprecedented levels of strain and risk breaking the network; some previous live tests of ~500 kB blocks a few years ago had already taken down a few bootstrap nodes.&lt;&#x2F;p&gt;
&lt;p&gt;The decrease-cost-and-cap proposal achieves most of the benefits of the decrease, as rollups are unlikely to &lt;em&gt;dominate&lt;&#x2F;em&gt; Ethereum block space in the short term future and so 1.5 MB will be sufficient, while preventing most of the security risk.&lt;&#x2F;p&gt;
&lt;p&gt;Historically, the Ethereum protocol community has been suspicious of multi-dimensional resource limit rules (in this case, gas and calldata) because such rules greatly increase the complexity of the block packing problem that proposers (today miners, post-merge validators) need to solve. Today, proposers can generate blocks with near-optimal fee revenue by simply choosing transactions in highest-to-lowest order of priority fee. In a multi-dimensional world, proposers would have to deal with multi-dimensional constraints. Multi-dimensional knapsack problems are much more complicated than the single-dimensional equivalent, and well-optimized proprietary implementations built by pools may well outperform default open source implementations.&lt;&#x2F;p&gt;
&lt;p&gt;Today, there are two key reasons why this is less of a problem than before:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; means that, at least most of the time, the problem that block proposers are solving is &lt;em&gt;not&lt;&#x2F;em&gt; a knapsack problem. Rather, block proposers are simply including all the transactions they can find with sufficient base fee and priority fee. Hence, naive algorithms will also frequently generate close-to-optimal results.&lt;&#x2F;li&gt;
&lt;li&gt;The existence of sophisticated proprietary strategies for miner extractable value (MEV) extraction means that decentralized optimal block production is already in the medium and long term a lost cause. Research is instead going into solutions that separate away the specialization-friendly task of block body generation from the role of a validator (&quot;proposer&#x2F;builder separation&quot;). Instead of being a fundamental change, two-dimensional knapsack problems today would be merely &quot;yet another&quot; MEV opportunity.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Hence, it&#x27;s worth rethinking the historical opposition to multi-dimensional resource limits and considering them as a pragmatic way to simultaneously achieve moderate scalability gains while retaining security.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, the stipend mechanism makes the two-dimensional optimization problem even less of an issue in practice. 90% of all transactions (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4488&#x2F;.&#x2F;assets&#x2F;gas_and_calldata_sample.csv&quot;&gt;sample&lt;&#x2F;a&gt; taken from blocks &lt;code&gt;13500000, 13501000 ... 13529000&lt;&#x2F;code&gt;) have &amp;lt;300 bytes of calldata. Hence, if a naive transaction selection algorithm overfills the calldata of a block that the proposer is creating, the proposer will still be able to keep adding transactions from 90% of their mempool.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This is a backwards incompatible gas repricing that requires a scheduled network upgrade.&lt;&#x2F;p&gt;
&lt;p&gt;Users will be able to continue operating with no changes.&lt;&#x2F;p&gt;
&lt;p&gt;Miners will be able to continue operating with no changes except for a rule to stop adding new transactions into a block when the total calldata size reaches the maximum. However, there are pragmatic heuristics that they could add to achieve closer-to-optimal returns in such cases: for example, if a block fills up to the size limit, they could repeatedly remove the last data-heavy transaction and replace it with as many data-light transactions as possible, until doing so is no longer profitable.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;em&gt;burst&lt;&#x2F;em&gt; data capacity of the chain does not increase as a result of this proposal (in fact, it slightly decreases). However, the &lt;em&gt;average&lt;&#x2F;em&gt; data capacity will increase. This means that the storage requirements of history-storing will go up. A worst-case scenario would be a theoretical long-run maximum of ~1,262,861 bytes per 12 sec slot, or ~3.0 TB per year.&lt;&#x2F;p&gt;
&lt;p&gt;We recommend &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4444&#x2F;&quot;&gt;EIP-4444&lt;&#x2F;a&gt; or some similar history expiry proposal be implemented either at the same time or soon after this EIP to mitigate this risk.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Described Transactions</title>
        <published>2021-11-07T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Richard Moore</name><uri>https://github.com/ricmoo</uri>
	</author>
	
	<author>
		<name>Nick Johnson</name><uri>https://github.com/arachnid</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4430/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/discussion-eip-4430-described-transactions/8762" />
        

        <id>https://wg-eips.ritovision.com/4430/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:4430"
            label="ERC-4430" />
        

        
        

        
        <summary type="html">A technique for contracts to provide a human-readable description of a transaction&#x27;s side-effects.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4430/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Use a contract method to provide &lt;em&gt;virtual functions&lt;&#x2F;em&gt; which can generate
a human-readable description at the same time as the machine-readable
bytecode, allowing the user to agree to the human-readable component
in a UI while the machine can execute the bytecode once accepted.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;When using an Ethereum Wallet (e.g. MetaMask, Clef, Hardware Wallets)
users must accept a transaction before it can be submitted (or the user
may decline).&lt;&#x2F;p&gt;
&lt;p&gt;Due to the complexity of Ethereum transactions, wallets are very limited
in their ability to provide insight into the effects of a transaction
that the user is approving; outside special-cased support for common
transactions such as ERC20 transfers, this often amounts to asking the
user to sign an opaque blob of binary data.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP presents a method for dapp developers to enable a more comfortable
user experience by providing wallets with a means to generate a better
description about what the contract claims will happen.&lt;&#x2F;p&gt;
&lt;p&gt;It does not address malicious contracts which wish to lie, it only addresses
honest contracts that want to make their user&#x27;s life better. We believe
that this is a reasonable security model, as transaction descriptions can be
audited at the same time as contract code, allowing auditors and code
reviewers to check that transaction descriptions are accurate as part of
their review.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;strong&gt;description&lt;&#x2F;strong&gt; (a string) and the matching &lt;strong&gt;execcode&lt;&#x2F;strong&gt; (bytecode)
are generated simultaneously by evaluating the method on a contract:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; eipXXXDescribe&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; inputs&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; reserved&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; description&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; execcode&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The human-readable &lt;strong&gt;description&lt;&#x2F;strong&gt; can be shown in any client which supports
user interaction for approval, while the &lt;strong&gt;execcode&lt;&#x2F;strong&gt; is the data that
should be included in a transaction to the contract to perform that operation.&lt;&#x2F;p&gt;
&lt;p&gt;The method must be executable in a static context, (i.e. any side effects,
such as logX, sstore, etc.), including through indirect calls may be ignored.&lt;&#x2F;p&gt;
&lt;p&gt;During evaluation, the &lt;code&gt;ADDRESS&lt;&#x2F;code&gt; (i.e. &lt;code&gt;to&lt;&#x2F;code&gt;), &lt;code&gt;CALLER&lt;&#x2F;code&gt; (i.e. &lt;code&gt;from&lt;&#x2F;code&gt;), &lt;code&gt;VALUE&lt;&#x2F;code&gt;,
and &lt;code&gt;GASPRICE&lt;&#x2F;code&gt; must be the same as the values for the transaction being
described, so that the code generating the description can rely on them.&lt;&#x2F;p&gt;
&lt;p&gt;When executing the bytecode, best efforts should be made to ensure &lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt;,
&lt;code&gt;NUMBER&lt;&#x2F;code&gt;, &lt;code&gt;TIMESTAMP&lt;&#x2F;code&gt; and &lt;code&gt;DIFFICULTY&lt;&#x2F;code&gt; match the &lt;code&gt;&quot;latest&quot;&lt;&#x2F;code&gt; block. The
&lt;code&gt;COINBASE&lt;&#x2F;code&gt; should be the zero address.&lt;&#x2F;p&gt;
&lt;p&gt;The method may revert, in which case the signing must be aborted.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;meta-description&quot;&gt;Meta Description&lt;&#x2F;h3&gt;
&lt;p&gt;There have been many attempts to solve this problem, many of which attempt
to examine the encoded transaction data or message data directly.&lt;&#x2F;p&gt;
&lt;p&gt;In many cases, the information that would be necessary for a meaningful
description is not present in the final encoded transaction data or message
data.&lt;&#x2F;p&gt;
&lt;p&gt;Instead this EIP uses an indirect description of the data.&lt;&#x2F;p&gt;
&lt;p&gt;For example, the &lt;code&gt;commit(bytes32)&lt;&#x2F;code&gt; method of ENS places a commitment
&lt;strong&gt;hash&lt;&#x2F;strong&gt; on-chain. The hash contains the &lt;strong&gt;blinded&lt;&#x2F;strong&gt; name and address;
since the name is blinded, the encoded data (i.e. the hash) no longer
contains the original values and is insufficient to access the necessary
values to be included in a description.&lt;&#x2F;p&gt;
&lt;p&gt;By instead describing the commitment indirectly (with the original information
intact: NAME, ADDRESS and SECRET) a meaningful description can be computed
(e.g. &quot;commit to NAME for ADDRESS (with SECRET)&quot;) and the matching data can
be computed (i.e. &lt;code&gt;commit(hash(name, owner, secret))&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;This technique of blinded data will become much more popular with L2
solutions, which use blinding not necessarily for privacy, but for
compression.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;entangling-the-contract-address&quot;&gt;Entangling the Contract Address&lt;&#x2F;h3&gt;
&lt;p&gt;To prevent signed data being used across contracts, the contract address
is entanlged into both the transaction implicitly via the &lt;code&gt;to&lt;&#x2F;code&gt; field.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;alternatives&quot;&gt;Alternatives&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;NatSpec and company are a class of more complex languages that attempt to describe the encoded data directly. Because of the language complexity they often end up being quite large requiring entire runtime environments with ample processing power and memory, as well as additional sandboxing to reduce security concerns. One goal of this is to reduce the complexity to something that could execute on hardware wallets and other simple wallets. These also describe the data directly, which in many cases (such as blinded data), cannot adequately describe the data at all&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Custom Languages; due to the complexity of Ethereum transactions, any language used would require a lot of expressiveness and re-inventing the wheel. The EVM already exists (it may not be ideal), but it is there and can handle everything necessary.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Format Strings (e.g. Trustless Signing UI Protocol; format strings can only operate on the class of regular languages, which in many cases is insufficient to describe an Ethereum transaction. This was an issue quite often during early attempts at solving this problem.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The signTypedData &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; has many parallels to what this EIP aims to solve&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This does not affect backwards compatibility.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;I will add deployed examples by address and chain ID.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;escaping-text&quot;&gt;Escaping Text&lt;&#x2F;h3&gt;
&lt;p&gt;Wallets must be careful when displaying text provided by contracts and proper
efforts must be taken to sanitize it, for example, be sure to consider:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;HTML could be embedded to attempt to trick web-based wallets into executing code using the script tag (possibly uploading any private keys to a server)&lt;&#x2F;li&gt;
&lt;li&gt;In general, extreme care must be used when rendering HTML; consider the ENS names &lt;code&gt;&amp;lt;span style=&quot;display:none&quot;&amp;gt;not-&amp;lt;&#x2F;span&amp;gt;ricmoo.eth&lt;&#x2F;code&gt; or &lt;code&gt;&amp;amp;thinsp;ricmoo.eth&lt;&#x2F;code&gt;, which if rendered without care would appear as &lt;code&gt;ricmoo.eth&lt;&#x2F;code&gt;, which it is not&lt;&#x2F;li&gt;
&lt;li&gt;Other marks which require escaping could be included, such as quotes (&lt;code&gt;&quot;&lt;&#x2F;code&gt;), formatting (&lt;code&gt;\n&lt;&#x2F;code&gt; (new line), &lt;code&gt;\f&lt;&#x2F;code&gt; (form feed), &lt;code&gt;\t&lt;&#x2F;code&gt; (tab), any of many non-standard whitespaces), back-slassh (&lt;code&gt;\&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;UTF-8 has had bugs in the past which could allow arbitrary code execution and crashing renderers; consider using the UTF-8 replacement character (or &lt;em&gt;something&lt;&#x2F;em&gt;) for code-points outside common planes or common sub-sets within planes&lt;&#x2F;li&gt;
&lt;li&gt;Homoglyphs attacks&lt;&#x2F;li&gt;
&lt;li&gt;Right-to-left mark may affect rendering&lt;&#x2F;li&gt;
&lt;li&gt;Many other things, deplnding on your environment&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Bound Historical Data in Execution Clients</title>
        <published>2021-11-02T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>George Kadianakis</name><uri>https://github.com/asn-d6</uri>
	</author>
	
	<author>
		<name>lightclient</name><uri>https://github.com/lightclient</uri>
	</author>
	
	<author>
		<name>Alex Stokes</name><uri>https://github.com/ralexstokes</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4444/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-4444-bound-historical-data-in-execution-clients/7450" />
        

        <id>https://wg-eips.ritovision.com/4444/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="networking"
                label="Networking" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:4444"
            label="EIP-4444" />
        

        
        

        
        <summary type="html">Prune historical data in clients older than one year</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4444/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Clients must stop serving historical headers, bodies, and receipts older than one year on the p2p layer. Clients may locally prune this historical data.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Historical blocks and receipts currently occupy more than 400GB of disk space (and growing!). Therefore, to validate the chain, users must typically have a 1TB disk.&lt;&#x2F;p&gt;
&lt;p&gt;Historical data is not necessary for validating new blocks, so once a client has synced the tip of the chain, historical data is only retrieved when requested explicitly over the JSON-RPC or when a peer attempts to sync the chain. By pruning the history, this proposal reduces the disk requirements for users. Pruning history also allows clients to remove code that processes historical blocks. This means that execution clients don&#x27;t need to maintain code paths that deal with each upgrade&#x27;s compounding changes.&lt;&#x2F;p&gt;
&lt;p&gt;Finally, this change will result in less bandwidth usage on the network as clients adopt more lightweight sync strategies based on the PoS weak subjectivity assumption.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;HISTORY_PRUNE_EPOCHS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;82125&lt;&#x2F;td&gt;&lt;td&gt;A year in beacon chain epochs&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Clients SHOULD NOT serve headers, block bodies, and receipts that are older than &lt;code&gt;HISTORY_PRUNE_EPOCHS&lt;&#x2F;code&gt; epochs on the p2p network.&lt;&#x2F;p&gt;
&lt;p&gt;Clients MAY locally prune headers, block bodies, and receipts that are older than &lt;code&gt;HISTORY_PRUNE_EPOCHS&lt;&#x2F;code&gt; epochs.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;bootstrapping-and-syncing&quot;&gt;Bootstrapping and syncing&lt;&#x2F;h4&gt;
&lt;p&gt;This EIP impacts the way clients bootstrap and sync. Clients will not be able to full sync using devp2p since historical data will no longer be served.&lt;&#x2F;p&gt;
&lt;p&gt;Clients MUST use a valid Weak Subjectivity Checkpoint to bootstrap from a more recent view of the chain. For the purpose of syncing, clients treat weak subjectivity checkpoints as the genesis block. We call this method &quot;checkpoint sync&quot;.&lt;&#x2F;p&gt;
&lt;p&gt;For the purposes of this proposal, we assume clients always start with a configured and valid weak subjectivity checkpoint. The way this is achieved is out-of-scope for this proposal.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal forces clients to stop serving old historical data over p2p. We make this explicit to force clients to seek historical data from other sources, instead of relying on the optional behavior of some clients which would result in quality degradation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-a-year&quot;&gt;Why a year?&lt;&#x2F;h3&gt;
&lt;p&gt;This proposal sets &lt;code&gt;HISTORY_PRUNE_EPOCHS&lt;&#x2F;code&gt; to 82125 epochs (one earth year). This constant is large enough to provide sufficient room for the Weak Subjectivity Period to grow, and it&#x27;s also small enough so as to not occupy too much disk space.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;preserving-historical-data&quot;&gt;Preserving historical data&lt;&#x2F;h3&gt;
&lt;p&gt;This proposal impacts nodes that make use of historical data (e.g. web3 applications that display history of blocks, transactions or accounts). Preserving the history of Ethereum is fundamental and we believe there are various out-of-band ways to achieve this.&lt;&#x2F;p&gt;
&lt;p&gt;Historical data can be packaged and shared via torrent magnet links or over networks like IPFS. Furthermore, systems like the Portal Network or The Graph can be used to acquire historical data.&lt;&#x2F;p&gt;
&lt;p&gt;Clients should allow importing and exporting of historical data. Clients can provide scripts that fetch&#x2F;verify data and automatically import them.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;full-syncing-from-genesis&quot;&gt;Full syncing from genesis&lt;&#x2F;h3&gt;
&lt;p&gt;Full syncing will no longer be possible over the p2p network. However, we do want to allow interested parties to do so on their own.&lt;&#x2F;p&gt;
&lt;p&gt;We suggest that a specialized &quot;full sync&quot; client is built. The client is a shim that pieces together different releases of execution engines and can import historical blocks to validate the entire Ethereum chain from genesis and generate all other historical data.&lt;&#x2F;p&gt;
&lt;p&gt;It&#x27;s important to also note that although archive nodes with &quot;state sync&quot; functionality are in development, full sync is currently the only reliable way to bootstrap them. Clients that wish to continue providing archive support would need the ability to import historical blocks retrieved out-of-band and retain support for each historical upgrade of the network.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;user-experience&quot;&gt;User experience&lt;&#x2F;h3&gt;
&lt;p&gt;This proposal impacts the UX for setting up applications that use historical data. Hence we suggest that clients introduce this change in two phases:&lt;&#x2F;p&gt;
&lt;p&gt;In the first phase, clients don&#x27;t prune historical data by default. They introduce a command line option similar to geth&#x27;s &lt;code&gt;--txlookuplimit&lt;&#x2F;code&gt; that users can use if they want to prune historical data.&lt;&#x2F;p&gt;
&lt;p&gt;In the second phase, history is pruned by default and the command line option is removed. Clients assume that users will find and import data in an out-of-band way.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;json-rpc-changes&quot;&gt;JSON-RPC changes&lt;&#x2F;h3&gt;
&lt;p&gt;After this proposal is implemented, certain JSON-RPC endpoints (e.g. like &lt;code&gt;getBlockByHash&lt;&#x2F;code&gt;) won&#x27;t be able to tell whether a given hash is invalid or just outdated. Other endpoints like &lt;code&gt;getLogs&lt;&#x2F;code&gt; will simply no longer have the data the user is requesting. The way this regression should be handled by applications or clients is out-of-scope for this proposal.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;relying-on-weak-subjectivity&quot;&gt;Relying on weak subjectivity&lt;&#x2F;h3&gt;
&lt;p&gt;With the move to PoS, it&#x27;s essential for security to use valid weak subjectivity checkpoints because of long-range attacks.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal relies on the weak subjectivity assumption and assumes that clients will not bootstrap with an invalid or old WS checkpoint.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal also assumes that the weak subjectivity period will never be longer than &lt;code&gt;HISTORY_PRUNE_EPOCHS&lt;&#x2F;code&gt;. If that were to happen, clients with an old weak subjectivity checkpoint would never be able to &quot;checkpoint sync&quot; since the p2p network would not be able to provide the required data.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;centralization-censorship-risk&quot;&gt;Centralization&#x2F;censorship risk&lt;&#x2F;h3&gt;
&lt;p&gt;There are censorship&#x2F;availability risks if there is a lack of incentives to keep historical data.&lt;&#x2F;p&gt;
&lt;p&gt;It&#x27;s important that Ethereum historical data are preserved and seeded by independent organizations, and their availability should be checked frequently. We consider these mechanisms as out-of-scope for this proposal.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore, there is a risk that more dapps will rely on centralized services for acquiring historical data because it will be harder to setup a full node.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;confusion-with-other-proposals&quot;&gt;Confusion with other proposals&lt;&#x2F;h3&gt;
&lt;p&gt;Because there are a number of alternative proposals for reducing the execution client&#x27;s footprint on disk, we&#x27;ve decided to enforce a specific pronunciation of the EIP. When pronouncing the EIP number, it &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be pronounced EIP &quot;four fours&quot;. All other pronunciation are incorrect.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Generic Token Upgrade Standard</title>
        <published>2021-11-02T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>John Peterson</name><uri>https://github.com/John-peterson-coinbase</uri>
	</author>
	
	<author>
		<name>Roberto Bayardo</name><uri>https://github.com/roberto-bayardo</uri>
	</author>
	
	<author>
		<name>David Núñez</name><uri>https://github.com/cygnusv</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4931/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-4931-generic-token-upgrade-standard/8687" />
        

        <id>https://wg-eips.ritovision.com/4931/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:4931"
            label="ERC-4931" />
        

        
        

        
        <summary type="html">Create a standard interface for upgrading ERC20 token contracts.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4931/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The following standard allows for the implementation of a standard API for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; token upgrades. This standard specifies an interface that supports the conversion of tokens from one contract (called the &quot;source token&quot;) to those from another (called the &quot;destination token&quot;), as well as several helper methods to provide basic information about the token upgrade (i.e. the address of the source and destination token contracts, the ratio that source will be upgraded to destination, etc.).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Token contract upgrades typically require each asset holder to exchange their old tokens for new ones using a bespoke interface provided by the developers. This standard interface will allow asset holders as well as centralized and decentralized exchanges to conduct token upgrades more efficiently since token contract upgrade scripts will be essentially reusable. Standardization will reduce the security overhead involved in verifying the functionality of the upgrade contracts. It will also provide asset issuers clear guidance on how to effectively implement a token upgrade.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;Please Note: Methods marked with (Optional Ext.) are a part of the optional extension for downgrade functionality and may remain unimplemented if downgrade functionality is not required.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;token-upgrade-interface-contract&quot;&gt;Token Upgrade Interface Contract&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IEIP4931&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;methods&quot;&gt;Methods&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;upgradesource&quot;&gt;upgradeSource&lt;&#x2F;h5&gt;
&lt;p&gt;Returns the address of the original (source) token that will be upgraded.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A getter to determine the contract that is being upgraded from (&amp;quot;source contract&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address of the source token contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; upgradeSource&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;upgradedestination&quot;&gt;upgradeDestination&lt;&#x2F;h5&gt;
&lt;p&gt;Returns the address of the token contract that is being upgraded to.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A getter to determine the contract that is being upgraded to (&amp;quot;destination contract&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address of the destination token contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; upgradeDestination&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;isupgradeactive&quot;&gt;isUpgradeActive&lt;&#x2F;h5&gt;
&lt;p&gt;Returns the current status of the upgrade functionality. Status MUST return &lt;code&gt;true&lt;&#x2F;code&gt; when the upgrade contract is functional and serving upgrades. It MUST return &lt;code&gt;false&lt;&#x2F;code&gt; when the upgrade contract is not currently serving upgrades.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The method will return true when the contract is serving upgrades and otherwise false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; status of the upgrade as a boolean&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isUpgradeActive&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;isdowngradeactive&quot;&gt;isDowngradeActive&lt;&#x2F;h5&gt;
&lt;p&gt;Returns the current status of the downgrade functionality. Status MUST return &lt;code&gt;true&lt;&#x2F;code&gt; when the upgrade contract is functional and serving downgrades. It MUST return &lt;code&gt;false&lt;&#x2F;code&gt; when the upgrade contract is not currently serving downgrades. When the downgrade Optional Ext. is not implemented, this method will always return &lt;code&gt;false&lt;&#x2F;code&gt; to signify downgrades are not available.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The method will return true when the contract is serving downgrades and otherwise false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; status of the downgrade as a boolean&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isDowngradeActive&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;ratio&quot;&gt;ratio&lt;&#x2F;h5&gt;
&lt;p&gt;Returns the ratio of destination token to source token, expressed as a 2-tuple, that the upgrade will use. E.g. &lt;code&gt;(3, 1)&lt;&#x2F;code&gt; means the upgrade will provide 3 destination tokens for every 1 source token being upgraded.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A getter for the ratio of destination tokens to source tokens received when conducting an upgrade&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Two&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; uint256, the first represents the numerator while the second represents&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the denominator of the ratio of destination tokens to source tokens allotted during the upgrade&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ratio&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;totalupgraded&quot;&gt;totalUpgraded&lt;&#x2F;h5&gt;
&lt;p&gt;Returns the total number of tokens that have been upgraded from source to destination. If the downgrade Optional Ext. is implemented, calls to &lt;code&gt;downgrade&lt;&#x2F;code&gt; will reduce the &lt;code&gt;totalUpgraded&lt;&#x2F;code&gt; return value making it possible for the value to decrease between calls. The return value will be strictly increasing if downgrades are not implemented.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A getter for the total amount of source tokens that have been upgraded to destination tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The value may not be strictly increasing if the downgrade Optional Ext. is implemented.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; number of source tokens that have been upgraded to destination tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalUpgraded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;computeupgrade&quot;&gt;computeUpgrade&lt;&#x2F;h5&gt;
&lt;p&gt;Computes the &lt;code&gt;destinationAmount&lt;&#x2F;code&gt; of destination tokens that correspond to a given &lt;code&gt;sourceAmount&lt;&#x2F;code&gt; of source tokens, according to the predefined conversion ratio, as well as the &lt;code&gt;sourceRemainder&lt;&#x2F;code&gt; amount of source tokens that can&#x27;t be upgraded. For example, let&#x27;s consider a (3, 2) ratio, which means that 3 destination tokens are provided for every 2 source tokens; then, for a source amount of 5 tokens, &lt;code&gt;computeUpgrade(5)&lt;&#x2F;code&gt; must return &lt;code&gt;(6, 1)&lt;&#x2F;code&gt;, meaning that 6 destination tokens are expected (in this case, from 4 source tokens) and 1 source token is left as remainder.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A method to mock the upgrade call determining the amount of destination tokens received from an upgrade&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; as well as the amount of source tokens that are left over as remainder&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sourceAmount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of source tokens that will be upgraded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; destinationAmount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A uint256 representing the amount of destination tokens received if upgrade is called&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sourceRemainder&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A uint256 representing the amount of source tokens left over as remainder if upgrade is called&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; computeUpgrade&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sourceAmount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; destinationAmount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sourceRemainder&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;computedowngrade-optional-ext&quot;&gt;computeDowngrade (Optional Ext.)&lt;&#x2F;h5&gt;
&lt;p&gt;Computes the &lt;code&gt;sourceAmount&lt;&#x2F;code&gt; of source tokens that correspond to a given &lt;code&gt;destinationAmount&lt;&#x2F;code&gt; of destination tokens, according to the predefined conversion ratio, as well as the &lt;code&gt;destinationRemainder&lt;&#x2F;code&gt; amount of destination tokens that can&#x27;t be downgraded. For example, let&#x27;s consider a (3, 2) ratio, which means that 3 destination tokens are provided for every 2 source tokens; for a destination amount of 13 tokens, &lt;code&gt;computeDowngrade(13)&lt;&#x2F;code&gt; must return &lt;code&gt;(4, 1)&lt;&#x2F;code&gt;, meaning that 4 source tokens are expected (in this case, from 12 destination tokens) and 1 destination token is left as remainder.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A method to mock the downgrade call determining the amount of source tokens received from a downgrade&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; as well as the amount of destination tokens that are left over as remainder&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; destinationAmount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of destination tokens that will be downgraded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sourceAmount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A uint256 representing the amount of source tokens received if downgrade is called&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; destinationRemainder&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A uint256 representing the amount of destination tokens left over as remainder if upgrade is called&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; computeDowngrade&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; destinationAmount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sourceAmount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; destinationRemainder&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;upgrade&quot;&gt;upgrade&lt;&#x2F;h5&gt;
&lt;p&gt;Upgrades the &lt;code&gt;amount&lt;&#x2F;code&gt; of source token to the destination token in the specified ratio. The destination tokens will be sent to the &lt;code&gt;_to&lt;&#x2F;code&gt; address. The function MUST lock the source tokens in the upgrade contract or burn them. If the downgrade Optional Ext. is implemented, the source tokens MUST be locked instead of burning. The function MUST &lt;code&gt;throw&lt;&#x2F;code&gt; if the caller&#x27;s address does not have enough source token to upgrade or if &lt;code&gt;isUpgradeActive&lt;&#x2F;code&gt; is returning &lt;code&gt;false&lt;&#x2F;code&gt;. The function MUST also fire the &lt;code&gt;Upgrade&lt;&#x2F;code&gt; event. &lt;code&gt;approve&lt;&#x2F;code&gt; MUST be called first on the source contract.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A method to conduct an upgrade from source token to destination token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The call will fail if upgrade status is not true, if approve has not been called&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; on the source contract, or if sourceAmount is larger than the amount of source tokens at the msg.sender address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If the ratio would cause an amount of tokens to be destroyed by rounding&#x2F;truncation, the upgrade call will&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; only upgrade the nearest whole amount of source tokens returning the excess to the msg.sender address. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emits the Upgrade event&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address the destination tokens will be sent to upon completion of the upgrade&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sourceAmount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of source tokens that will be upgraded &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; upgrade&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sourceAmount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;downgrade-optional-ext&quot;&gt;downgrade (Optional Ext.)&lt;&#x2F;h5&gt;
&lt;p&gt;Downgrades the &lt;code&gt;amount&lt;&#x2F;code&gt; of destination token to the source token in the specified ratio. The source tokens will be sent to the &lt;code&gt;_to&lt;&#x2F;code&gt; address. The function MUST unwrap the destination tokens back to the source tokens. The function MUST &lt;code&gt;throw&lt;&#x2F;code&gt; if the caller&#x27;s address does not have enough destination token to downgrade or if &lt;code&gt;isDowngradeActive&lt;&#x2F;code&gt; is returning &lt;code&gt;false&lt;&#x2F;code&gt;. The function MUST also fire the &lt;code&gt;Downgrade&lt;&#x2F;code&gt; event. &lt;code&gt;approve&lt;&#x2F;code&gt; MUST be called first on the destination contract.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A method to conduct a downgrade from destination token to source token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The call will fail if downgrade status is not true, if approve has not been called&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; on the destination contract, or if destinationAmount is larger than the amount of destination tokens at the msg.sender address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If the ratio would cause an amount of tokens to be destroyed by rounding&#x2F;truncation, the downgrade call will only downgrade&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the nearest whole amount of destination tokens returning the excess to the msg.sender address. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  Emits the Downgrade event&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address the source tokens will be sent to upon completion of the downgrade&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; destinationAmount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of destination tokens that will be downgraded &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; downgrade&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; destinationAmount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;events&quot;&gt;Events&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;upgrade-1&quot;&gt;Upgrade&lt;&#x2F;h5&gt;
&lt;p&gt;MUST trigger when tokens are upgraded.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address that called upgrade&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address that destination tokens were sent to upon completion of the upgrade&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sourceAmount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Amount of source tokens that were upgraded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; destinationAmount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Amount of destination tokens sent to the _to address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Upgrade&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sourceAmount&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; destinationAmount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;downgrade-optional-ext-1&quot;&gt;Downgrade (Optional Ext.)&lt;&#x2F;h5&gt;
&lt;p&gt;MUST trigger when tokens are downgraded.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address that called downgrade&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address that source tokens were sent to upon completion of the downgrade&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sourceAmount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Amount of source tokens sent to the _to address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; destinationAmount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Amount of destination tokens that were downgraded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Downgrade&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sourceAmount&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; destinationAmount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;There have been several notable ERC20 upgrades (Ex. Golem: GNT -&amp;gt; GLM) where the upgrade functionality is written directly into the token contracts. We view this as a suboptimal approach to upgrades since it tightly couples the upgrade with the existing tokens. This EIP promotes the use of a third contract to facilitate the token upgrade to decouple the functionality of the upgrade from the functionality of the token contracts. Standardizing the upgrade functionality will allow asset holders and exchanges to write simplified reusable scripts to conduct upgrades which will reduce the overhead of conducting upgrades in the future. The interface aims to be intentionally broad leaving much of the specifics of the upgrade to the implementer, so that the token contract implementations do not interfere with the upgrade process. Finally, we hope to create a greater sense of security and validity for token upgrades by enforcing strict means of disposing of the source tokens during the upgrade. This is achieved by the specification of the  &lt;code&gt;upgrade&lt;&#x2F;code&gt; method. The agreed upon norm is that burnable tokens shall be burned. Otherwise, tokens shall be effectively burned by being sent to the &lt;code&gt;0x00&lt;&#x2F;code&gt; address. When downgrade Optional Ext. is implemented, the default is instead to lock source tokens in the upgrade contract to avoid a series of consecutive calls to &lt;code&gt;upgrade&lt;&#x2F;code&gt; and &lt;code&gt;downgrade&lt;&#x2F;code&gt; from artificially inflating the supply of either token (source or destination).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;There are no breaking backwards compatibility issues. There are previously implemented token upgrades that likely do not adhere to this standard. In these cases, it may be relevant for the asset issuers to communicate that their upgrade is not EIP-4931 compliant.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;SPDX-License-Identifier: Apache-2.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0.8.9&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC20&#x2F;IERC20.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC20&#x2F;utils&#x2F;SafeERC20.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IEIP4931.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SourceUpgrade&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  IEIP4931&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;	using&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SafeERC20&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;  for&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC20&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; RATIO_SCALE &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;18&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	IERC20 &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;private&lt;&#x2F;span&gt;&lt;span&gt; source&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	IERC20 &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;private&lt;&#x2F;span&gt;&lt;span&gt; destination&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; upgradeStatus&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; downgradeStatus&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; numeratorRatio&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; denominatorRatio&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; sourceUpgradedTotal&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; upgradedBalance&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _source&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _destination&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _upgradeStatus&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _downgradeStatus&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _numeratorRatio&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _denominatorRatio&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_source &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span&gt; _destination&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;SourceUpgrade: source and destination addresses are the same&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_source &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;SourceUpgrade: source address cannot be zero address&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_destination &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;SourceUpgrade: destination address cannot be zero address&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_numeratorRatio &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;SourceUpgrade: numerator of ratio cannot be zero&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_denominatorRatio &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;SourceUpgrade: denominator of ratio cannot be zero&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		source &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_source&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		destination &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_destination&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		upgradeStatus &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _upgradeStatus&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		downgradeStatus &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _downgradeStatus&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		numeratorRatio &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _numeratorRatio&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		denominatorRatio &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _denominatorRatio&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A getter to determine the contract that is being upgraded from (&amp;quot;source contract&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address of the source token contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; upgradeSource&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;source&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A getter to determine the contract that is being upgraded to (&amp;quot;destination contract&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address of the destination token contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; upgradeDestination&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;destination&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The method will return true when the contract is serving upgrades and otherwise false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; status of the upgrade as a boolean&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isUpgradeActive&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		return&lt;&#x2F;span&gt;&lt;span&gt; upgradeStatus&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The method will return true when the contract is serving downgrades and otherwise false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; status of the downgrade as a boolean&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isDowngradeActive&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		return&lt;&#x2F;span&gt;&lt;span&gt; downgradeStatus&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A getter for the ratio of destination tokens to source tokens received when conducting an upgrade&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Two&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; uint256, the first represents the numerator while the second represents&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the denominator of the ratio of destination tokens to source tokens allotted during the upgrade&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ratio&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;numeratorRatio&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; denominatorRatio&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A getter for the total amount of source tokens that have been upgraded to destination tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The value may not be strictly increasing if the downgrade Optional Ext. is implemented.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; number of source tokens that have been upgraded to destination tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalUpgraded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		return&lt;&#x2F;span&gt;&lt;span&gt; sourceUpgradedTotal&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A method to mock the upgrade call determining the amount of destination tokens received from an upgrade&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; as well as the amount of source tokens that are left over as remainder&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sourceAmount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of source tokens that will be upgraded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; destinationAmount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A uint256 representing the amount of destination tokens received if upgrade is called&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sourceRemainder&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A uint256 representing the amount of source tokens left over as remainder if upgrade is called&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; computeUpgrade&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sourceAmount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;		public&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;		view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; destinationAmount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sourceRemainder&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		sourceRemainder &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; sourceAmount % &lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;numeratorRatio &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; denominatorRatio&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		uint256&lt;&#x2F;span&gt;&lt;span&gt; upgradeableAmount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; sourceAmount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;sourceRemainder &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; RATIO_SCALE&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		destinationAmount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; upgradeableAmount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;numeratorRatio &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; denominatorRatio&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A method to mock the downgrade call determining the amount of source tokens received from a downgrade&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; as well as the amount of destination tokens that are left over as remainder&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; destinationAmount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of destination tokens that will be downgraded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sourceAmount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A uint256 representing the amount of source tokens received if downgrade is called&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; destinationRemainder&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A uint256 representing the amount of destination tokens left over as remainder if upgrade is called&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; computeDowngrade&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; destinationAmount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;		public&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;		view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sourceAmount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; destinationRemainder&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		destinationRemainder &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; destinationAmount % &lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;denominatorRatio &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; numeratorRatio&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		uint256&lt;&#x2F;span&gt;&lt;span&gt; upgradeableAmount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; destinationAmount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;destinationRemainder &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; RATIO_SCALE&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		sourceAmount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; upgradeableAmount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;denominatorRatio &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; numeratorRatio&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A method to conduct an upgrade from source token to destination token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The call will fail if upgrade status is not true, if approve has not been called&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; on the source contract, or if sourceAmount is larger than the amount of source tokens at the msg.sender address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If the ratio would cause an amount of tokens to be destroyed by rounding&#x2F;truncation, the upgrade call will&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; only upgrade the nearest whole amount of source tokens returning the excess to the msg.sender address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emits the Upgrade event&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address the destination tokens will be sent to upon completion of the upgrade&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sourceAmount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of source tokens that will be upgraded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; upgrade&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sourceAmount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;upgradeStatus &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;SourceUpgrade: upgrade status is not active&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; destinationAmount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt; sourceRemainder&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; computeUpgrade&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sourceAmount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		sourceAmount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; sourceRemainder&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sourceAmount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;SourceUpgrade: disallow conversions of zero value&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		upgradedBalance&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; sourceAmount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		source&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;safeTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;			msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;			address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			sourceAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		destination&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;safeTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; destinationAmount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		sourceUpgradedTotal &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; sourceAmount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Upgrade&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; sourceAmount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; destinationAmount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A method to conduct a downgrade from destination token to source token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The call will fail if downgrade status is not true, if approve has not been called&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; on the destination contract, or if destinationAmount is larger than the amount of destination tokens at the msg.sender address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If the ratio would cause an amount of tokens to be destroyed by rounding&#x2F;truncation, the downgrade call will only downgrade&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the nearest whole amount of destination tokens returning the excess to the msg.sender address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  Emits the Downgrade event&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address the source tokens will be sent to upon completion of the downgrade&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; destinationAmount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of destination tokens that will be downgraded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; downgrade&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; destinationAmount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;upgradeStatus &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;SourceUpgrade: upgrade status is not active&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; sourceAmount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt; destinationRemainder&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; computeDowngrade&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;destinationAmount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		destinationAmount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; destinationRemainder&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;destinationAmount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;SourceUpgrade: disallow conversions of zero value&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;upgradedBalance&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; sourceAmount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;			&amp;quot;SourceUpgrade: can not downgrade more than previously upgraded&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		upgradedBalance&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; sourceAmount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		destination&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;safeTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;			msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;			address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			destinationAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		source&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;safeTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; sourceAmount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		sourceUpgradedTotal &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; sourceAmount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Downgrade&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; sourceAmount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; destinationAmount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The main security consideration is ensuring the implementation of the interface handles the source tokens during the upgrade in such a way that they are no longer accessible. Without careful handling, the validity of the upgrade may come into question since source tokens could potentially be upgraded multiple times. This is why EIP-4931 will strictly enforce the use of &lt;code&gt;burn&lt;&#x2F;code&gt; for source tokens that are burnable. For non-burnable tokens, the accepted method is to send the source tokens to the &lt;code&gt;0x00&lt;&#x2F;code&gt; address. When the downgrade Optional Ext. is implemented, the constraint will be relaxed, so that the source tokens can be held by the upgrade contract.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;creativecommons.org&#x2F;publicdomain&#x2F;zero&#x2F;1.0&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Supplant DIFFICULTY opcode with PREVRANDAO</title>
        <published>2021-10-30T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Mikhail Kalinin</name><uri>https://github.com/mkalinin</uri>
	</author>
	
	<author>
		<name>Danny Ryan</name><uri>https://github.com/djrtwo</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4399/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-4399-supplant-difficulty-opcode-with-random/7368" />
        

        <id>https://wg-eips.ritovision.com/4399/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:4399"
            label="EIP-4399" />
        

        
        

        
        <summary type="html">Expose beacon chain randomness in the EVM by supplanting DIFFICULTY opcode semantics</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4399/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP supplants the semantics of the return value of existing &lt;code&gt;DIFFICULTY (0x44)&lt;&#x2F;code&gt; opcode and renames the opcode to &lt;code&gt;PREVRANDAO (0x44)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The return value of the &lt;code&gt;DIFFICULTY (0x44)&lt;&#x2F;code&gt; instruction after this change is the output of the randomness beacon provided by the beacon chain.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Applications may benefit from using the randomness accumulated by the beacon chain. Thus, randomness outputs produced by the beacon chain should be accessible in the EVM.&lt;&#x2F;p&gt;
&lt;p&gt;At the point of &lt;code&gt;TRANSITION_BLOCK&lt;&#x2F;code&gt; of the Proof-of-Stake (PoS) upgrade described in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3675&#x2F;&quot;&gt;EIP-3675&lt;&#x2F;a&gt;, the &lt;code&gt;difficulty&lt;&#x2F;code&gt; block field &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be &lt;code&gt;0&lt;&#x2F;code&gt; thereafter because there is no longer any Proof-of-Work (PoW) seal on the block. This means that the &lt;code&gt;DIFFICULTY (0x44)&lt;&#x2F;code&gt; instruction no longer has it&#x27;s previous semantic meaning, nor a clear &quot;correct&quot; value to return.&lt;&#x2F;p&gt;
&lt;p&gt;Given prior analysis on the usage of &lt;code&gt;DIFFICULTY&lt;&#x2F;code&gt;, the value returned by the instruction mixed with other values is a common pattern used by smart contracts to obtain randomness. The instruction with the same number as the &lt;code&gt;DIFFICULTY&lt;&#x2F;code&gt; opcode returning outputs of the beacon chain RANDAO implementation makes the upgrade to PoS backwards compatible for existing smart contracts obtaining randomness from the &lt;code&gt;DIFFICULTY&lt;&#x2F;code&gt; instruction.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, changes proposed by this EIP allow for smart contracts to determine whether the upgrade to the PoS has already happened. This can be done by analyzing the return value of the &lt;code&gt;DIFFICULTY&lt;&#x2F;code&gt; instruction. A value greater than &lt;code&gt;2**64&lt;&#x2F;code&gt; indicates that the transaction is being executed in the PoS block. Decompilers and other similar tooling may also use this trick to discern the new semantics of the instruction if data of the block including the transaction in question is available.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;TRANSITION_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; The definition of this block can be found in the Definitions section of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3675&#x2F;#definitions&quot;&gt;EIP-3675&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;block-structure&quot;&gt;Block structure&lt;&#x2F;h3&gt;
&lt;p&gt;Beginning with &lt;code&gt;TRANSITION_BLOCK&lt;&#x2F;code&gt;, client software &lt;strong&gt;MUST&lt;&#x2F;strong&gt; set the value of the &lt;code&gt;mixHash&lt;&#x2F;code&gt;, i.e. the field with the number &lt;code&gt;13&lt;&#x2F;code&gt; (0-indexed) in a block header, to the latest RANDAO mix of the post beacon state of the previous block.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;evm&quot;&gt;EVM&lt;&#x2F;h3&gt;
&lt;p&gt;Beginning with &lt;code&gt;TRANSITION_BLOCK&lt;&#x2F;code&gt;, the &lt;code&gt;DIFFICULTY (0x44)&lt;&#x2F;code&gt; instruction &lt;strong&gt;MUST&lt;&#x2F;strong&gt; return the value of the &lt;code&gt;mixHash&lt;&#x2F;code&gt; field.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Note&lt;&#x2F;em&gt;: The gas cost of the &lt;code&gt;DIFFICULTY (0x44)&lt;&#x2F;code&gt; opcode remains unchanged.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;renaming&quot;&gt;Renaming&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;mixHash&lt;&#x2F;code&gt; field &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; further be renamed to &lt;code&gt;prevRandao&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;DIFFICULTY (0x44)&lt;&#x2F;code&gt; opcode &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; further be renamed to &lt;code&gt;PREVRANDAO (0x44)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;including-randao-output-in-the-block-header&quot;&gt;Including RANDAO output in the block header&lt;&#x2F;h3&gt;
&lt;p&gt;Including a RANDAO output in the block header provides a straightforward method of accessing it from inside of the EVM as block header data is already available in the EVM context.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, this ensures that the execution layer can be fully executed with the block alone rather than requiring extra inputs from the PoS consensus layer.&lt;&#x2F;p&gt;
&lt;p&gt;Mixing the randomness into a block header may contribute to uniqueness of the block hash in the case when values of other fields of the block header match the corresponding values of the header of another block.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;using-mixhash-field-instead-of-difficulty&quot;&gt;Using &lt;code&gt;mixHash&lt;&#x2F;code&gt; field instead of &lt;code&gt;difficulty&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;mixHash&lt;&#x2F;code&gt; header field is used instead of &lt;code&gt;difficulty&lt;&#x2F;code&gt; to avoid a class of hidden forkchoice bugs after the PoS upgrade.&lt;&#x2F;p&gt;
&lt;p&gt;Client software implementing pre-EIP-3675 logic heavily depends on the &lt;code&gt;difficulty&lt;&#x2F;code&gt; value as total difficulty computation is the basis of the PoW fork choice rule. Setting the &lt;code&gt;difficulty&lt;&#x2F;code&gt; field to &lt;code&gt;0&lt;&#x2F;code&gt; at the PoS upgrade aims to reduce the surface of bugs related to the total difficulty value growing after the upgrade.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, any latent total difficulty computation after the PoS upgrade would become overflow prone if the randomness output supplanted the value of the &lt;code&gt;difficulty&lt;&#x2F;code&gt; field.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;reusing-existing-field-instead-of-appending-a-new-one&quot;&gt;Reusing existing field instead of appending a new one&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;mixHash&lt;&#x2F;code&gt; field is deprecated at the PoS upgrade and set to zero bytes array thereafter. Reusing an existing field as a place for the randomness output saves 32 bytes per block and effectively removes the deprecation of one of the fields induced by the upgrade.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;reusing-the-difficulty-opcode-instead-of-introducing-a-new-one&quot;&gt;Reusing the &lt;code&gt;DIFFICULTY&lt;&#x2F;code&gt; opcode instead of introducing a new one&lt;&#x2F;h3&gt;
&lt;p&gt;See the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4399&#x2F;#motivation&quot;&gt;Motivation&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;renaming-the-field-and-the-opcode&quot;&gt;Renaming the field and the opcode&lt;&#x2F;h3&gt;
&lt;p&gt;The renaming should be done to make the field and the opcode names semantically sound.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;using-transition-block-rather-than-a-block-or-slot-number&quot;&gt;Using &lt;code&gt;TRANSITION_BLOCK&lt;&#x2F;code&gt; rather than a block or slot number&lt;&#x2F;h3&gt;
&lt;p&gt;By utilizing &lt;code&gt;TRANSITION_BLOCK&lt;&#x2F;code&gt; to trigger the change in logic defined in this EIP rather than a block or slot number, this EIP is tightly coupled to the PoS upgrade defined by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3675&#x2F;&quot;&gt;EIP-3675&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;By tightly coupling to the PoS upgrade, we ensure that there is no discontinuity for the usecase of this opcode for randomness -- the primary &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4399&#x2F;#motivation&quot;&gt;motivation&lt;&#x2F;a&gt; for re-using &lt;code&gt;DIFFICULTY&lt;&#x2F;code&gt; rather than creating a new opcode.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;using-2-64-threshold-to-determine-pos-blocks&quot;&gt;Using &lt;code&gt;2**64&lt;&#x2F;code&gt; threshold to determine PoS blocks&lt;&#x2F;h3&gt;
&lt;p&gt;The probability of RANDAO value to fall into the range between &lt;code&gt;0&lt;&#x2F;code&gt; and &lt;code&gt;2**64&lt;&#x2F;code&gt; and, thus, to be mixed with PoW difficulty values, is drastically low. Though, proposed threshold might seem to have insufficient distance from difficulty values on Ethereum Mainnet (they are currently around &lt;code&gt;2**54&lt;&#x2F;code&gt;), it requires a thousand times increase of the hashrate to make this threshold insecure. Such an increase is considered impossible to occur before the upcoming consensus upgrade.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces backward incompatible changes to the execution and validation of EVM state transitions. As written, this EIP utilizes &lt;code&gt;TRANSITION_BLOCK&lt;&#x2F;code&gt; and is thus tightly coupled with the PoS upgrade introduced in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3675&#x2F;&quot;&gt;EIP-3675&lt;&#x2F;a&gt;. If this EIP is to be adopted, it &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be scheduled at the same time as EIP-3675.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, the changes proposed might be backward incompatible for the following categories of applications:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Applications that use the value returned by the &lt;code&gt;DIFFICULTY&lt;&#x2F;code&gt; opcode as the PoW &lt;code&gt;difficulty&lt;&#x2F;code&gt; parameter&lt;&#x2F;li&gt;
&lt;li&gt;Applications with logic that depends on the &lt;code&gt;DIFFICULTY&lt;&#x2F;code&gt; opcode returning a relatively small number with respect to the full 256-bit size of the field.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The first category is already affected by switching the consensus mechanism to PoS and no additional breaking changes are introduced by this specification.&lt;&#x2F;p&gt;
&lt;p&gt;The second category is comprised of applications that use the return value of the &lt;code&gt;DIFFICULTY&lt;&#x2F;code&gt; opcode in operations that might cause either overflow or underflow errors. While it is theoretically possible to author an application where a change in the range of possible values this opcode may return could lead to a security vulnerability, the chances of that are negligible.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;In one of ancestors of &lt;code&gt;TRANSITION_BLOCK&lt;&#x2F;code&gt; deploy a contract that stores return value of  &lt;code&gt;DIFFICULTY (0x44)&lt;&#x2F;code&gt; to the state&lt;&#x2F;li&gt;
&lt;li&gt;Check that value returned by &lt;code&gt;DIFFICULTY (0x44)&lt;&#x2F;code&gt; in transaction executed within the parent of &lt;code&gt;TRANSITION_BLOCK&lt;&#x2F;code&gt; equals &lt;code&gt;difficulty&lt;&#x2F;code&gt; field value&lt;&#x2F;li&gt;
&lt;li&gt;Check that value returned by &lt;code&gt;PREVRANDAO (0x44)&lt;&#x2F;code&gt; in transaction executed within &lt;code&gt;TRANSITION_BLOCK&lt;&#x2F;code&gt; equals &lt;code&gt;prevRandao&lt;&#x2F;code&gt; field value&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;PREVRANDAO (0x44)&lt;&#x2F;code&gt; opcode in PoS Ethereum (based on the beacon chain RANDAO implementation) is a source of randomness with different properties to the randomness supplied by &lt;code&gt;BLOCKHASH (0x40)&lt;&#x2F;code&gt; or &lt;code&gt;DIFFICULTY (0x44)&lt;&#x2F;code&gt; opcodes in the PoW network.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;biasability&quot;&gt;Biasability&lt;&#x2F;h3&gt;
&lt;p&gt;The beacon chain RANDAO implementation gives every block proposer 1 bit of influence power per slot. Proposer may deliberately refuse to propose a block on the opportunity cost of proposer and transaction fees to prevent beacon chain randomness (a RANDAO mix) from being updated in a particular slot.&lt;&#x2F;p&gt;
&lt;p&gt;An effect of proposer&#x27;s influence power is limited in time and lasts until the first honest RANDAO reveal is made afterwards. This limitation does also exist in the case when proposers of &lt;code&gt;n&lt;&#x2F;code&gt; consecutive slots are colluding to get &lt;code&gt;n&lt;&#x2F;code&gt; bits of influence power. Simply speaking, one honest block proposal is enough to unbias the RANDAO even if it was biased during several slots in a row.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, semantics of the &lt;code&gt;PREVRANDAO (0x44)&lt;&#x2F;code&gt; instruction gives proposers another way to gain 1 bit of influence power on applications. Biased proposer may censor a rolling the dice transaction to force it to be included into the next block, thus, force it to use a RANDAO mix that the proposer knows in advance. The opportunity cost in this case would be negligible.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;predictability&quot;&gt;Predictability&lt;&#x2F;h3&gt;
&lt;p&gt;Obviously, historical randomness provided by any decentralized oracle is 100% predictable. On the contrary, the randomness that is revealed in the future is predictable up to a limited extent.&lt;&#x2F;p&gt;
&lt;p&gt;A list of inputs influencing future randomness on the beacon chain consists of but is not limited to the following items:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Accumulated randomness.&lt;&#x2F;strong&gt; A RANDAO mix produced by the beacon chain in the last slot of epoch &lt;code&gt;N&lt;&#x2F;code&gt; is the main input to the function defining block proposers in each slot of epoch &lt;code&gt;N + MIN_SEED_LOOKAHEAD + 1&lt;&#x2F;code&gt;, i.e. it is the main factor defining future RANDAO revealers.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Number of active validators.&lt;&#x2F;strong&gt; A number of active validators throughout an epoch is another input to the block proposer function.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Effective balance.&lt;&#x2F;strong&gt; All else being equal, the lower the effective balance of a validator the lower the chance this validator has to be designated as a proposer in a slot.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Accidentally missed proposals.&lt;&#x2F;strong&gt; Network conditions and other factors that are resulting in accidentally missed proposals is a source of highly qualitative entropy that impacts RANDAO mixes. Usual rate of missed proposals on the Mainnet is about &lt;code&gt;1%&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;These inputs may be predictable and malleable on a short range of slots but the longer the attempted lookahead the more entropy is accumulated by the beacon chain.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;tips-for-application-developers&quot;&gt;Tips for application developers&lt;&#x2F;h3&gt;
&lt;p&gt;The following tips attempt to reduce predictability and biasability of randomness outputs returned by &lt;code&gt;PREVRANDAO (0x44)&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Make your applications rely on the future randomness with a reasonably high lookahead. For example, an application stops accepting bids at the end of epoch &lt;code&gt;K&lt;&#x2F;code&gt; and uses a RANDAO mix produced in slot &lt;code&gt;K + N + ε&lt;&#x2F;code&gt; to roll the dice, where &lt;code&gt;N&lt;&#x2F;code&gt; is a lookahead in epochs and &lt;code&gt;ε&lt;&#x2F;code&gt; is a few slots into epoch &lt;code&gt;N + 1&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;At least four epochs of lookahead results in the following outcome:&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;ul&gt;
&lt;li&gt;A proposer set of epoch &lt;code&gt;N + 1&lt;&#x2F;code&gt; isn&#x27;t known at the end of epoch &lt;code&gt;K&lt;&#x2F;code&gt; breaking a direct link between bidders and dice rollers&lt;&#x2F;li&gt;
&lt;li&gt;A number of active validators is updated at the end of each epoch affecting a set of proposers of next epochs, thus, impacting a RANDAO mix used by the application to roll the dice&lt;&#x2F;li&gt;
&lt;li&gt;Due to Mainnet statistics, there is about a &lt;code&gt;100%&lt;&#x2F;code&gt; chance for the network to accidentally miss a proposal during this period of time which reduces predictability of a RANDAO mix used to roll the dice.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;ol start=&quot;3&quot;&gt;
&lt;li&gt;Setting &lt;code&gt;ε&lt;&#x2F;code&gt; to a small number, e.g. 2 or 4 slots, gives a third party a little time to gain influence power on the future randomness that is being used to roll the dice. This amount of time is defined by &lt;code&gt;MIN_SEED_LOOKAHEAD&lt;&#x2F;code&gt; parameter and is about 6 minutes on the Mainnet.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;A reasonably high distance between bidding and rolling the dice attempts to leave low chance for bidders controlling a subset of validators to directly exploit their influence power. Ultimately, this chance depends on the type of the game and on a number of controlled validators. For instance, a chance of a single validator to affect a one-time game is negligible, and becomes bigger for multiple validators in a repeated game scenario.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EIP-721 Consumable Extension</title>
        <published>2021-10-30T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Daniel Ivanov</name><uri>https://github.com/Daniel-K-Ivanov</uri>
	</author>
	
	<author>
		<name>George Spasov</name><uri>https://github.com/Perseverance</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4400/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/EIP-4400-EIP721consumer-extension/7371" />
        

        <id>https://wg-eips.ritovision.com/4400/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:4400"
            label="ERC-4400" />
        

        
        

        
        <summary type="html">Interface extension for EIP-721 consumer role</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4400/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This specification defines standard functions outlining a &lt;code&gt;consumer&lt;&#x2F;code&gt; role for instance(s) of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt;. An implementation allows reading the current &lt;code&gt;consumer&lt;&#x2F;code&gt; for a given NFT (&lt;code&gt;tokenId&lt;&#x2F;code&gt;) along with a standardized event for when an &lt;code&gt;consumer&lt;&#x2F;code&gt; has changed. The proposal depends on and extends the existing &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Many &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; contracts introduce their own custom role that grants permissions for utilising&#x2F;consuming a given NFT instance. The need for that role stems from the fact that other than owning the NFT instance, there are other actions that can be performed on an NFT. For example, various metaverses use &lt;code&gt;operator&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;contributor&lt;&#x2F;code&gt; roles for Land (EIP-721), so that owners of the land can authorise other addresses to deploy scenes to them (f.e. commissioning a service company to develop a scene).&lt;&#x2F;p&gt;
&lt;p&gt;It is common for NFTs to have utility other than ownership. That being said, it requires a separate standardized consumer role, allowing compatibility with user interfaces and contracts, managing those contracts.&lt;&#x2F;p&gt;
&lt;p&gt;Having a &lt;code&gt;consumer&lt;&#x2F;code&gt; role will enable protocols to integrate and build on top of dApps that issue EIP-721 tokens. One example is the creation of generic&#x2F;universal NFT renting marketplaces.&lt;&#x2F;p&gt;
&lt;p&gt;Example of kinds of contracts and applications that can benefit from this standard are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;metaverses that have land and other types of digital assets in those metaverses (scene deployment on land, renting land &#x2F; characters &#x2F; clothes &#x2F; passes to events etc.)&lt;&#x2F;li&gt;
&lt;li&gt;NFT-based yield-farming. Adopting the standard enables the &quot;staker&quot; (owner of the NFT) to have access to the utility benefits even after transferring his NFT to the staking contract&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;Every contract compliant to the &lt;code&gt;EIP721Consumable&lt;&#x2F;code&gt; extension MUST implement the &lt;code&gt;IEIP721Consumable&lt;&#x2F;code&gt; interface. The &lt;strong&gt;consumer extension&lt;&#x2F;strong&gt; is OPTIONAL for EIP-721 contracts.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; EIP-721 Consumer Role extension&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;  Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the EIP-165 identifier for this interface is 0x953c8dfa&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IEIP721Consumable&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is EIP721 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when `owner` changes the `consumer` of an NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The zero address for consumer indicates that there is no consumer address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; When a Transfer event emits, this also indicates that the consumer address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; for that NFT (if any) is set to none&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ConsumerChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; consumer&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the consumer address of an NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The zero address indicates that there is no consumer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws if `_tokenId` is not a valid NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT to get the consumer address for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; consumer address for this NFT, or the zero address if there is none&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; consumerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Change or reaffirm the consumer address for an NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The zero address indicates there is no consumer address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws unless `msg.sender` is the current NFT owner, an authorised&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; operator of the current owner or approved address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws if `_tokenId` is not valid NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _consumer&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The new consumer of the NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; changeConsumer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _consumer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Every contract implementing the &lt;code&gt;EIP721Consumable&lt;&#x2F;code&gt; extension is free to define the permissions of a &lt;code&gt;consumer&lt;&#x2F;code&gt; (e.g. what are consumers allowed to do within their system) with only one exception - consumers MUST NOT be considered owners, authorised operators or approved addresses as per the EIP-721 specification. Thus, they MUST NOT be able to execute transfers &amp;amp; approvals.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;consumerOf(uint256 _tokenId)&lt;&#x2F;code&gt; function MAY be implemented as &lt;code&gt;pure&lt;&#x2F;code&gt; or &lt;code&gt;view&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;changeConsumer(address _consumer, uint256 _tokenId)&lt;&#x2F;code&gt; function MAY be implemented as &lt;code&gt;public&lt;&#x2F;code&gt; or &lt;code&gt;external&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;ConsumerChanged&lt;&#x2F;code&gt; event MUST be emitted when a consumer is changed.&lt;&#x2F;p&gt;
&lt;p&gt;On every &lt;code&gt;transfer&lt;&#x2F;code&gt;, the consumer MUST be changed to a default address. It is RECOMMENDED for implementors to use &lt;code&gt;address(0)&lt;&#x2F;code&gt; as that default address.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; method MUST return &lt;code&gt;true&lt;&#x2F;code&gt; when called with &lt;code&gt;0x953c8dfa&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Key factors influencing the standard:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Keeping the number of functions in the interfaces to a minimum to prevent contract bloat&lt;&#x2F;li&gt;
&lt;li&gt;Simplicity&lt;&#x2F;li&gt;
&lt;li&gt;Gas Efficiency&lt;&#x2F;li&gt;
&lt;li&gt;Not reusing or overloading other already existing roles (e.g. owners, operators, approved addresses)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;name&quot;&gt;Name&lt;&#x2F;h3&gt;
&lt;p&gt;The chosen name resonates with the purpose of its existence. Consumers can be considered entities that utilise the token instances, without necessarily having ownership rights to it.&lt;&#x2F;p&gt;
&lt;p&gt;The other name for the role that was considered was &lt;code&gt;operator&lt;&#x2F;code&gt;, however it is already defined and used within the &lt;code&gt;EIP-721&lt;&#x2F;code&gt; standard.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;restriction-on-the-permissions&quot;&gt;Restriction on the Permissions&lt;&#x2F;h3&gt;
&lt;p&gt;There are numerous use-cases where a distinct role for NFTs is required that MUST NOT have owner permissions. A contract that implements the consumer role and grants ownership permissions to the consumer renders this standard pointless.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is compatible with current EIP-721 standards. There are no other standards that define a similar role for NFTs and the name (&lt;code&gt;consumer&lt;&#x2F;code&gt;) is not used by other EIP-721 related standards.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases are available in the reference implementation &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4400&#x2F;.&#x2F;assets&#x2F;test&#x2F;erc721-consumable.ts&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The reference implementation can be found &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4400&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;ERC721Consumable.sol&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Implementors of the &lt;code&gt;EIP721Consumable&lt;&#x2F;code&gt; standard must consider thoroughly the permissions they give to &lt;code&gt;consumers&lt;&#x2F;code&gt;. Even if they implement the standard correctly and do not allow transfer&#x2F;burning of NFTs, they might still provide permissions to the &lt;code&gt;consumers&lt;&#x2F;code&gt; that they might not want to provide otherwise and should be restricted to &lt;code&gt;owners&lt;&#x2F;code&gt; only.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Time-Aware Base Fee Calculation</title>
        <published>2021-10-28T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Ansgar Dietrichs</name><uri>https://github.com/adietrichs</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4396/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-4396-time-aware-base-fee-calculation/7363" />
        

        <id>https://wg-eips.ritovision.com/4396/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:4396"
            label="EIP-4396" />
        

        
        

        
        <summary type="html">Accounts for block time in the base fee calculation to target a stable throughput by time instead of by block.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4396/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes accounting for time between blocks in the base fee calculation to target a stable throughput by time, instead of by block. Aiming to minimize changes to the calculation, it only introduces a variable block gas target proportional to the block time. The EIP can, in principle, be applied to either a Proof-of-Work or a Proof-of-Stake chain, however the security implications for the Proof-of-Work case remain unexplored.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The current base fee calculation chooses the gas usage of a block as the signal to determine whether demand for block space is too low (indicating that the base fee should be lowered) or too high (indicating that the base fee should be increased). While simple, this choice of signal has drawbacks: it does not take the block time into account. Assuming a relatively constant demand, a proposer constructing a block after 20 seconds will have transactions available with twice the gas of a proposer constructing a block after 10 seconds. Using the same gas target for both is accordingly sub-optimal. In practice, there are several undesirable consequences of this flawed signal:&lt;&#x2F;p&gt;
&lt;h3 id=&quot;base-fee-volatility-under-proof-of-work&quot;&gt;Base Fee Volatility Under Proof-of-Work&lt;&#x2F;h3&gt;
&lt;p&gt;Under Proof-of-Work (PoW), block times are stochastic, and for that reason there exists large block time variability. This variability contributes to the base fee volatility, where the base fee can be expected to oscillate around the equilibrium value even under perfectly stable demand.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;missed-slots&quot;&gt;Missed Slots&lt;&#x2F;h3&gt;
&lt;p&gt;Under Proof-of-Stake (PoS), block times are ideally uniform (always 12s), but missed slots lead to individual blocks with increased block time (24s, 36s, ...). Such missed slots will result in the next block being overfull, and with the current update rule, signal a fake demand spike and thus cause a small unwarranted base fee spike.&lt;&#x2F;p&gt;
&lt;p&gt;More importantly, these missed slots directly reduce the overall throughput of the execution chain by the gas target of one block. While the next block can be expected to include the &quot;delayed&quot; transactions of the missed slot, the resulting base fee spike then results in some number of under-full blocks. In the end the block space of the missed slot is lost for the chain.&lt;&#x2F;p&gt;
&lt;p&gt;This is particularly problematic because a Denial-of-Service (DoS) attack on block proposers can cause them to miss slots, and compromises the overall chain performance.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;throughput-degradation-during-consensus-issues&quot;&gt;Throughput Degradation During Consensus Issues&lt;&#x2F;h3&gt;
&lt;p&gt;A more severe version of individual missed slots can be caused by consensus issues that prevent a significant portion of block proposers from continuing to create blocks. This can be due to block proposers forking off (and creating blocks on their own fork), being unable to keep up with the current chain head for another reason, or simply being unable to create valid blocks.&lt;&#x2F;p&gt;
&lt;p&gt;In all these situations, average block times go up significantly, causing chain throughput to fall by the same fraction. While this effect is already present under PoW, the self-healing mechanism of difficulty adjustments is relatively quick to kick in and restore normal block times. On the other hand, under PoS the automatic self-healing mechanism can be extremely slow: potentially several months to return to normal with up to a third of slots missed, or several weeks if more than a third of slots are missed.&lt;&#x2F;p&gt;
&lt;p&gt;For all these reasons, it would be desirable to target a stable throughput per time instead of per block, by taking block time into account during the base fee calculation.&lt;&#x2F;p&gt;
&lt;p&gt;To maximize the chance of this EIP being included in the merge fork, the adjustments are kept to a minimum, with more involved changes discussed in the rationale section.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Using the pseudocode language of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt;, the updated base fee calculation becomes:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;BASE_FEE_MAX_CHANGE_DENOMINATOR&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;BLOCK_TIME_TARGET&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 12&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;MAX_GAS_TARGET_PERCENT&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 95&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; World&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;ABC&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validate_block&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        parent_gas_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        parent_block_time&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        parent_base_gas_target&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; parent_gas_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ELASTICITY_MULTIPLIER&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        parent_adjusted_gas_target&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;parent_base_gas_target&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; parent_block_time&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BLOCK_TIME_TARGET&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; parent_gas_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_GAS_TARGET_PERCENT&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 100&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        parent_base_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;base_fee_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        parent_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; parent_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; parent_adjusted_gas_target&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            expected_base_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; parent_base_fee_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        elif&lt;&#x2F;span&gt;&lt;span&gt; parent_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; parent_adjusted_gas_target&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            gas_used_delta&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; parent_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; parent_adjusted_gas_target&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            base_fee_per_gas_delta&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;parent_base_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; gas_used_delta&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; parent_base_gas_target&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BASE_FEE_MAX_CHANGE_DENOMINATOR&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            expected_base_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; parent_base_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; base_fee_per_gas_delta&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            gas_used_delta&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; parent_adjusted_gas_target&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; parent_gas_used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            base_fee_per_gas_delta&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; parent_base_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; gas_used_delta&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; parent_base_gas_target&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BASE_FEE_MAX_CHANGE_DENOMINATOR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            expected_base_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; parent_base_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; base_fee_per_gas_delta&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;mechanism&quot;&gt;Mechanism&lt;&#x2F;h3&gt;
&lt;p&gt;The proposed new base fee calculation only adjusts the block gas target by scaling it with the block time, capped at a maximum percent of the overall block gas limit:&lt;&#x2F;p&gt;
&lt;h4 id=&quot;current-base-fee-calculation&quot;&gt;Current Base Fee Calculation&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4396&#x2F;.&#x2F;assets&#x2F;old_formula.png&quot; alt=&quot;&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;proposed-base-fee-calculation&quot;&gt;Proposed Base Fee Calculation&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4396&#x2F;.&#x2F;assets&#x2F;new_formula.png&quot; alt=&quot;&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;This new calculation thus targets a stable throughput per time instead of per block.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;limitations&quot;&gt;Limitations&lt;&#x2F;h3&gt;
&lt;p&gt;Under PoS, block time increases always come in multiples of full blocks (e.g. a single missed slot = 24s instead of 12s block time). Accounting for this already requires doubling the block gas target, even for a single missed slot. However, with the block elasticity currently set to 2, this target would be equal to the block gas limit. Having the new target equal to the block gas limit is less than ideal, and thus is reduced slightly, according to the &lt;code&gt;MAX_GAS_TARGET_PERCENT&lt;&#x2F;code&gt; parameter. The reason for the existence of this parameter is twofold:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Ensure that the signal remains meaningful: A target equal to or greater than the gas limit could never be reached, so the base fee would always be reduced after a missed slot.&lt;&#x2F;li&gt;
&lt;li&gt;Ensure that the base fee can still react to genuine demand increases: During times of many offline block proposers (and thus many missed slots), genuine demand increases still need a way to eventually result in a base fee increase, to avoid a fallback to a first-price priority fee auction.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;However, this means that even a single missed slot cannot be fully compensated. Even worse, any second or further sequential missed slot cannot be compensated for at all, as the gas target is already at its max. This effect becomes more pronounced as the share of offline validators increases:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4396&#x2F;.&#x2F;assets&#x2F;degradation.png&quot; alt=&quot;&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;As can be observed, while this EIP does indeed increase the robustness of the network throughput in cases of offline validators, it does so imperfectly. Furthermore, there is a tradeoff effected by the &lt;code&gt;MAX_GAS_TARGET_PERCENT&lt;&#x2F;code&gt; parameter, with a higher value resulting in a higher network robustness, but a more impaired base fee adjustment mechanism during times of frequent missed slots.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;possible-extensions&quot;&gt;Possible Extensions&lt;&#x2F;h3&gt;
&lt;p&gt;These limitations directly result from the design goal of a minimal change, to maximize chances of being included in the merge. There are natural ways of extending the EIP design to more effectively handle offline validators, at the expense of somewhat more extensive changes:&lt;&#x2F;p&gt;
&lt;h4 id=&quot;persistent-multi-slot-buffer&quot;&gt;Persistent Multi-Slot Buffer&lt;&#x2F;h4&gt;
&lt;p&gt;To be able to compensate multiple consecutive missed slots, a gas buffer could be introduced, that would allow the gas beyond the block elasticity to be carried forward to future blocks. To avoid long-run buffer accumulation that would delay a return to normal operations once block proposers are back online, a cap on the buffer would be added. Even for a relatively small buffer cap, the throughput robustness is significantly improved:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4396&#x2F;.&#x2F;assets&#x2F;degradation_buffers.png&quot; alt=&quot;&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;With an elasticity still at 2, there is no way of avoiding the eventual breakdown for more than 50% offline block proposers.&lt;&#x2F;p&gt;
&lt;p&gt;The main implementation complexity for this approach comes from the introduction of the buffer as a new persistent field. To retain the ability for calculating base fees only based on headers, it would have to be added to the block header.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;increased-block-elasticity&quot;&gt;Increased Block Elasticity&lt;&#x2F;h4&gt;
&lt;p&gt;In addition to the introduction of a buffer, increasing the block elasticity is another tool for increasing throughput robustness. The following diagram shows the effect of different elasticity levels, both in the presence and absence of a persistent buffer:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4396&#x2F;.&#x2F;assets&#x2F;degradation_elasticity.png&quot; alt=&quot;&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Again, a clear positive effect can be observed.&lt;&#x2F;p&gt;
&lt;p&gt;The main additional complexity here would come from the increased peak load (networking, compute &amp;amp; disk access) of multiple sequential overfull blocks. Note though that PoS with its minimum block time of 12s significantly reduces worst case peak stress as compared to PoW.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The EIP has minimal impact on backwards compatibility, only requiring updates to existing base fee calculation tooling.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;tbd&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;tbd&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;timestamp-manipulation&quot;&gt;Timestamp Manipulation&lt;&#x2F;h3&gt;
&lt;p&gt;Under PoW, miners are in control over the timestamp field of their blocks. While there are some enforced limits to valid timestamps, implications regarding potential timestamp manipulation are nontrivial and remain unexplored for this EIP.&lt;&#x2F;p&gt;
&lt;p&gt;Under PoS, each slot has a &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;v1.1.3&#x2F;specs&#x2F;merge&#x2F;beacon-chain.md#process_execution_payload&quot;&gt;fixed assigned timestamp&lt;&#x2F;a&gt;, rendering any timestamp manipulation by block proposers impossible.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;suppressing-base-fee-increases&quot;&gt;Suppressing Base Fee Increases&lt;&#x2F;h3&gt;
&lt;p&gt;As discussed in the rationale, a high value for &lt;code&gt;MAX_GAS_TARGET_PERCENT&lt;&#x2F;code&gt; during times of many offline block proposers results in a small remaining signal space for genuine demand increases that should result in base fee increases. This in turn decreases the cost for block proposers for suppresing these base fee increases, instead forcing the fallback to a first-price priority fee auction.&lt;&#x2F;p&gt;
&lt;p&gt;While the arguments of incentive incompatibility for base fee suppression of the base EIP-1559 case still apply here, with a decreasing cost of this individually irrational behavior the risk for overriding psychological factors becomes more significant.&lt;&#x2F;p&gt;
&lt;p&gt;Even in such a case the system degradation would however be graceful, as it would only temporarily suspend the base fee burn. As soon as the missing block proposers would come back online, the system would return to its ordinary EIP-1559 equilibrium.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Micropayments for NFTs and Multi Tokens</title>
        <published>2021-10-24T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Jules Lai</name><uri>https://github.com/julesl23</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4393/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-proposal-micropayments-standard-for-nfts-and-multi-tokens/7366" />
        

        <id>https://wg-eips.ritovision.com/4393/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:4393"
            label="ERC-4393" />
        

        
        

        
        <summary type="html">An interface for tip tokens that allows tipping to holders of NFTs and multi tokens</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4393/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard outlines a smart contract interface for tipping to non-fungible and multi tokens. Holders of the tokens are able to withdraw the tips as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;EIP-20&lt;&#x2F;a&gt; rewards.&lt;&#x2F;p&gt;
&lt;p&gt;For the purpose of this EIP, a micropayment is termed as a financial transaction that involves usually a small sum of money called &quot;tips&quot; that are sent to specific &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; NFTs and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;EIP-1155&lt;&#x2F;a&gt; multi tokens, as rewards to their holders. A holder (also referred to as controller) is used as a more generic term for owner, as NFTs may represent non-digital assets such as services.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;A cheap way to send tips to any type of NFT or multi token. This can be achieved by gas optimising the tip token contract and sending the tips in batches using the &lt;code&gt;tipBatch&lt;&#x2F;code&gt; function from the interface.&lt;&#x2F;p&gt;
&lt;p&gt;To make it easy to implement into dapps a tipping service to reward the NFT and multi token holders. Allows for fairer distribution of revenue back to NFT holders from the user community.&lt;&#x2F;p&gt;
&lt;p&gt;To make the interface as minimal as possible in order to allow adoption into many different use cases.&lt;&#x2F;p&gt;
&lt;p&gt;Some use cases include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;In game purchases and other virtual goods&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Tipping messages, posts, music and video content&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Donations&#x2F;crowdfunding&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Distribution of royalties&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Pay per click advertising&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Incentivising use of services&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Reward cards and coupons&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;These can all leverage the security, immediacy and transparency of blockchain.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;This standard proposal outlines a generalised way to allow tipping via implementation of an &lt;code&gt;ITipToken&lt;&#x2F;code&gt; interface. The interface is intentionally kept to a minimum in order to allow for maximum use cases.&lt;&#x2F;p&gt;
&lt;p&gt;Smart contracts implementing this EIP standard MUST implement all of the functions in this EIP interface. MUST also emit the events specified in the interface so that a complete state of the tip token contract can be derived from the events emitted alone.&lt;&#x2F;p&gt;
&lt;p&gt;Smart contracts implementing this EIP standard MUST implement the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;EIP-165&lt;&#x2F;a&gt; supportsInterface function and MUST return the constant value true if 0xE47A7022 is passed through the interfaceID argument. Note that revert in this document MAY mean a require, throw (not recommended as depreciated) or revert solidity statement with or without error messages.&lt;&#x2F;p&gt;
&lt;p&gt;Note that, nft (or NFT in caps) in the code and as mentioned in this document, MAY also refer to an EIP-1155 fungible token.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ITipToken&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when the tip token implementation approves the address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        of an NFT for tipping.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        The holders of the &amp;#39;nft&amp;#39; are approved to receive rewards.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        When an NFT Transfer event emits, this also indicates that the approved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        addresses for that NFT (if any) is reset to none.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0x985A3267.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ApprovalForNFT&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; holders&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nft&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when a user has deposited an ERC-20 compatible token to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        the tip token&amp;#39;s contract address or to an external address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        This also indicates that the deposit has been exchanged for an&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        amount of tip tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Deposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; rewardToken&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tipTokenAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when a holder withdraws an amount of ERC-20 compatible&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        reward. This reward comes from the tip token&amp;#39;s contract address or from&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        an external address, depending on the tip token implementation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; WithdrawReward&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; holder&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; rewardToken&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when the tip token constructor or initialize method is&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        executed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        Importantly the ERC-20 compatible token &amp;#39;rewardToken_&amp;#39; to use as reward&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        to NFT holders is set at this time and remains the same throughout the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        lifetime of the tip token contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        The &amp;#39;rewardToken_&amp;#39; and &amp;#39;tipToken_&amp;#39; MAY be the same.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InitializeTipToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tipToken_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; rewardToken_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner_&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits every time a user tips an NFT holder.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        Also includes the reward token address and the reward token amount that&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        will be held pending until the holder withdraws the reward tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Tip&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; holder&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nft&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; rewardToken&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; rewardTokenAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Enable or disable approval for tipping for a single NFT held&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        by a holder or a multi token shared by holders&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST revert if calling nft&amp;#39;s supportsInterface does not return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        true for either IERC721 or IERC1155.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        MUST revert if any of the &amp;#39;holders&amp;#39; is the zero address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        MUST revert if &amp;#39;nft&amp;#39; has not approved the tip token contract address as operator.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        MUST emit the &amp;#39;ApprovalForNFT&amp;#39; event to reflect approval or not approval.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; holders&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The holders of the NFT (NFT controllers)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; nft&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT contract address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT token id&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; approved&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; True if the &amp;#39;holder&amp;#39; is approved, false to revoke approval&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setApprovalForNFT&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; holders&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nft&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Checks if &amp;#39;holder&amp;#39; and &amp;#39;nft&amp;#39; with token &amp;#39;id&amp;#39; have been approved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        by setApprovalForNFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This does not check that the holder of the NFT has &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;. That is&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        left to the implementer to detect events for change of ownership and to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        take appropriate action&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; holder&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The holder of the NFT (NFT controller)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; nft&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT contract address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT token id&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; True&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if &amp;#39;holder&amp;#39; and &amp;#39;nft&amp;#39; with token &amp;#39;id&amp;#39; have previously been&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        approved by the tip token contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isApprovalForNFT&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; holder&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nft&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sends tip from msg.sender to holder of a single NFT or&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        to shared holders of a multi token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If &amp;#39;nft&amp;#39; has not been approved for tipping, MUST revert&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        MUST revert if &amp;#39;nft&amp;#39; is zero address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        MUST burn the tip &amp;#39;amount&amp;#39; to the &amp;#39;holder&amp;#39; and send the reward to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        an account pending for the holder(s).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        If &amp;#39;nft&amp;#39; is a multi token that has multiple holders then each holder&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        MUST receive tip amount in proportion of their balance of multi tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        MUST emit the &amp;#39;Tip&amp;#39; event to reflect the amounts that msg.sender tipped&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        to holder(s) of &amp;#39;nft&amp;#39;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; nft&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT contract address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT token id&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Amount of tip tokens to send to the holder of the NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tip&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nft&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sends a batch of tips to holders of &amp;#39;nfts&amp;#39; for gas efficiency&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If NFT has not been approved for tipping, revert&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        MUST revert if the input arguments lengths are not all the same&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        MUST revert if any of the user addresses are zero&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        MUST revert the whole batch if there are any errors&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        MUST emit the &amp;#39;Tip&amp;#39; events so that the state of the amounts sent to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        each holder and for which nft and from whom, can be reconstructed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; users&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; User accounts to tip from&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; nfts&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT contract addresses whose holders to tip to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ids&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT token ids that uniquely identifies the &amp;#39;nfts&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amounts&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Amount of tip tokens to send to the holders of the NFTs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tipBatch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; users&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nfts&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ids&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amounts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Deposit an ERC-20 compatible token in exchange for tip tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The price of tip tokens can be different for each deposit as&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        the amount of reward token sent ultimately is a ratio of the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        amount of tip tokens to tip over the user&amp;#39;s tip tokens balance available&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        multiplied by the user&amp;#39;s deposit balance.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        The deposited tokens can be held in the tip tokens contract account or&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        in an external escrow. This will depend on the tip token implementation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        Each tip token contract MUST handle only one type of ERC-20 compatible&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        reward for deposits.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        This token address SHOULD be passed in to the tip token constructor or&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        initialize method. SHOULD revert if ERC-20 reward for deposits is&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        zero address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        MUST emit the &amp;#39;Deposit&amp;#39; event that shows the user, deposited token details&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        and amount of tip tokens minted in exchange&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; user&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The user account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Amount of ERC-20 token to deposit in exchange for tip tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        This deposit is to be used later as the reward token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; deposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An NFT holder can withdraw their tips as an ERC-20 compatible&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        reward at a time of their choosing&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST revert if not enough balance pending available to withdraw.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        MUST send &amp;#39;amount&amp;#39; to msg.sender account (the holder)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        MUST reduce the balance of reward tokens pending by the &amp;#39;amount&amp;#39; withdrawn.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        MUST emit the &amp;#39;WithdrawReward&amp;#39; event to show the holder who withdrew, the reward&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        token address and &amp;#39;amount&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Amount of ERC-20 token to withdraw as a reward&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; withdrawReward&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST have identical behaviour to ERC-20 balanceOf and is the amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        of tip tokens held by &amp;#39;user&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; user&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The user account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; balance of tip tokens held by user&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The balance of deposit available to become rewards when&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        user sends the tips&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; user&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The user account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; remaining balance of the ERC-20 compatible token deposited&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceDepositOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of reward token owed to &amp;#39;holder&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The pending tokens can come from the tip token contract account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        or from an external escrow, depending on tip token implementation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; holder&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The holder of NFT(s) (NFT controller)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; amount of reward tokens owed to the holder from tipping&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; rewardPendingOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; holder&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;tipping-and-rewards-to-holders&quot;&gt;Tipping and rewards to holders&lt;&#x2F;h3&gt;
&lt;p&gt;A user first deposits a compatible EIP-20 to the tip token contract that is then held (less any agreed fee) in escrow, in exchange for tip tokens. These tip tokens can then be sent by the user to NFTs and multi tokens (that have been approved by the tip token contract for tipping) to be redeemed for the original EIP-20 deposits on withdrawal by the holders as rewards.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;tip-token-transfer-and-value-calculations&quot;&gt;Tip Token transfer and value calculations&lt;&#x2F;h3&gt;
&lt;p&gt;Tip token values are exchanged with EIP-20 deposits and vice-versa. It is left to the tip token implementer to decide on the price of a tip token and hence how much tip to mint in exchange for the EIP-20 deposited. One possibility is to have fixed conversion rates per geographical region so that users from poorer countries are able to send the same number of tips as those from richer nations for the same level of appreciation for content&#x2F;assets etc. Hence, not skewed by average wealth when it comes to analytics to discover what NFTs are actually popular, allowing creators to have a level playing field.&lt;&#x2F;p&gt;
&lt;p&gt;Whenever a user sends a tip, an equivalent value of deposited EIP-20 MUST be transferred to a pending account for the NFT or multi token holder, and the tip tokens sent MUST be burnt. This equivalent value is calculated using a simple formula:&lt;&#x2F;p&gt;
&lt;p&gt;_total user balance of EIP-20 deposit _ tip amount &#x2F; total user balance of tip tokens*&lt;&#x2F;p&gt;
&lt;p&gt;Thus adding *free* tips to a user&#x27;s balance of tips for example, simply dilutes the overall value of each tip for that user, as collectively they still refer to the same amount of EIP-20 deposited.&lt;&#x2F;p&gt;
&lt;p&gt;Note if the tip token contract inherits from an EIP-20, tips can be transferred from one user to another directly. The deposit amount would be already in the tip token contract (or an external escrow account) so only tip token contract&#x27;s internal mapping of user account to deposit balances needs to be updated. It is RECOMMENDED that the tip amount be burnt from user A and then minted back to user B in the amount that keeps user B&#x27;s average EIP-20 deposited value per tip the same, so that the value of the tip does not fluctuate in the process of tipping.&lt;&#x2F;p&gt;
&lt;p&gt;If not inheriting from EIP-20, then minting the tip tokens MUST emit &lt;code&gt;event Transfer(address indexed from, address indexed to, uint256 value)&lt;&#x2F;code&gt; where sender is the zero address for a mint and to is the zero address for a burn. The Transfer event MUST be the same signature as the Transfer function in the &lt;code&gt;IERC20&lt;&#x2F;code&gt; interface.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;royalty-distribution&quot;&gt;Royalty distribution&lt;&#x2F;h3&gt;
&lt;p&gt;EIP-1155 allows for shared holders of a token id. Imagine a scenario where an article represented by an NFT was written by multiple contributors. Here, each contributor is a holder and the fractional sharing percentage between them can be represented by the balance that each holds in the EIP-1155 token id. So for two holders A and B of EIP-1155 token 1, if holder A&#x27;s balance is 25 and holder B&#x27;s is 75 then any tip sent to token 1 would distribute 25% of the reward pending to holder A and the remaining 75% pending to holder B.&lt;&#x2F;p&gt;
&lt;p&gt;Here is an example implementation of ITipToken contract data structures:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Mapping from NFT&#x2F;multi token to token id to holder(s)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _tokenIdToHolders&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Mapping from user to user&amp;#39;s deposit balance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _depositBalances&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Mapping from holder to holder&amp;#39;s reward pending amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _rewardsPending&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This copes with EIP-721 contracts that must have unique token ids and single holders (to be compliant with the standard), and EIP-1155 contracts that can have multiple token ids and multiple holders per instance. The &lt;code&gt;tip&lt;&#x2F;code&gt; function implementation would then access &lt;code&gt;_tokenIdToHolders&lt;&#x2F;code&gt; via indices NFT&#x2F;multi token address and token id to distribute to holder&#x27;s or holders&#x27; &lt;code&gt;_rewardsPending&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;For scenarios where royalties are to be distributed to holders directly, then implementation of the &lt;code&gt;tip&lt;&#x2F;code&gt; method of &lt;code&gt;ITipToken&lt;&#x2F;code&gt; contract MAY send the royalty amount straight from the user&#x27;s account to the holder of a single NFT or to the shared holders of a multi token, less an optional agreed fee. In this case, the tip token type is the reward token.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;caveats&quot;&gt;Caveats&lt;&#x2F;h3&gt;
&lt;p&gt;To keep the &lt;code&gt;ITipToken&lt;&#x2F;code&gt; interface simple and general purpose, each tip token contract MUST use one EIP-20 compatible deposit type at a time. If tipping is required to support many EIP-20 deposits then each tip token contract MUST be deployed separately per EIP-20 compatible type required. Thus, if tipping is required from both ETH and BTC wrapper EIP-20 deposits then the tip token contract is deployed twice. The tip token contract&#x27;s constructor is REQUIRED to pass in the address of the EIP-20 token supported for the deposits for the particular tip token contract. Or in the case for upgradeable tip token contracts, an initialize method is REQUIRED to pass in the EIP-20 token address.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP does not provide details for where the EIP-20 reward deposits are held. It MUST be available at the time a holder withdraws the rewards that they are owed. A RECOMMENDED implementation would be to keep the deposits locked in the tip token contract address. By keeping a mapping structure that records the balances pending to holders then the
deposits can remain where they are when a user tips, and only transferred out to a holder&#x27;s address when a holder withdraws it as their reward.&lt;&#x2F;p&gt;
&lt;p&gt;This standard does not specify the type of EIP-20 compatible deposits allowed. Indeed, could be tip tokens themselves. But it is RECOMMENDED that balances of the deposits be checked after transfer to find out the exact amount deposited to keep internal accounting consistent. In case, for example, the EIP-20 contract takes fees and hence reduces the actual amount deposited.&lt;&#x2F;p&gt;
&lt;p&gt;This standard does not specify any functionality for refunds for deposits nor for tip tokens sent, it is left to the implementor to add this to their smart contract(s). The reasoning for this is to keep the interface light and not to enforce upon implementors the need for refunds but to leave that as a choice.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;minimising-gas-costs&quot;&gt;Minimising Gas Costs&lt;&#x2F;h3&gt;
&lt;p&gt;By caching tips off-chain and then batching them up to call the &lt;code&gt;tipBatch&lt;&#x2F;code&gt; method of the ITipToken interface then essentially the cost of initialising transactions is paid once rather than once per tip. Plus, further gas savings can be made off-chain if multiple tips sent by the same user to the same NFT token are accumulated together and sent as one entry in the batch.&lt;&#x2F;p&gt;
&lt;p&gt;Further savings can be made by grouping users together sending to the same NFT, so that checking the validity of the NFT and whether it is an EIP-721 or EIP-1155, is performed once for each group.&lt;&#x2F;p&gt;
&lt;p&gt;Clever ways to minimise on-chain state updating of the deposit balances for each user and the reward balances of each holder, can help further to minimise the gas costs when sending in a batch if the batch is ordered beforehand. For example, can avoid the checks if the next NFT in the batch is the same. This left to the tip token contract implementer. Whatever optimisation is applied, it MUST still allow information of which account tipped which account and for what NFT to be reconstructed from the Tip and the TipBatch events emitted.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;simplicity&quot;&gt;Simplicity&lt;&#x2F;h3&gt;
&lt;p&gt;ITipToken interface uses a minimal number of functions, in order to keep its use as general purpose as possible, whilst there being enough to guide implementation that fulfils its purpose for micropayments to NFT holders.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;use-of-nfts&quot;&gt;Use of NFTs&lt;&#x2F;h3&gt;
&lt;p&gt;Each NFT is a unique non-fungible token digital asset stored on the blockchain that are uniquely identified by its address and token id. It&#x27;s truth burnt using cryptographic hashing on a secure blockchain means that it serves as an anchor for linking with a unique digital asset, service or other contractual agreement. Such use cases may include (but only really limited by imagination and acceptance):&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Digital art, collectibles, music, video, licenses and certificates, event tickets, ENS names, gaming items, objects in metaverses, proof of authenticity of physical items, service agreements etc.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This mechanism allows consumers of the NFT a secure way to easily tip and reward the NFT holder.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;new-business-models&quot;&gt;New Business Models&lt;&#x2F;h3&gt;
&lt;p&gt;To take the music use case for example. Traditionally since the industry transitioned from audio distributed on physical medium such as CDs, to an online digital distribution model via streaming, the music industry has been controlled by oligopolies that served to help in the transition. They operate a fixed subscription model and from that they set the amount of royalty distribution to content creators; such as the singers, musicians etc. Using tip tokens represent an additional way for fans of music to reward the content creators. Each song or track is represented by an NFT and fans are able to tip the song (hence the NFT) that they like, and in turn the content creators of the NFT are able to receive the EIP-20 rewards that the tips were bought for. A fan led music industry with decentralisation and tokenisation is expected to bring new revenue, and bring fans and content creators closer together.&lt;&#x2F;p&gt;
&lt;p&gt;Across the board in other industries a similar ethos can be applied where third party controllers move to a more facilitating role rather than a monetary controlling role that exists today.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;guaranteed-audit-trail&quot;&gt;Guaranteed audit trail&lt;&#x2F;h3&gt;
&lt;p&gt;As the Ethereum ecosystem continues to grow, many dapps are relying on traditional databases and explorer API services to retrieve and categorize data. This EIP standard guarantees that event logs emitted by the smart contract MUST provide enough data to create an accurate record of all current tip token and EIP-20 reward balances. A database or explorer can provide indexed and categorized searches of every tip token and reward sent to NFT holders from the events emitted by any tip token contract that implements this standard. Thus, the state of the tip token contract can be reconstructed from the events emitted alone.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;A tip token contract can be fully compatible with EIP-20 specification and inherit some functions such as transfer if the tokens are allowed to be sent directly to other users. Note that balanceOf has been adopted and MUST be the number of tips held by a user&#x27;s address. If inheriting from, for example, OpenZeppelin&#x27;s implementation of EIP-20 token then their contract is responsible for maintaining the balance of tip token. Therefore, tip token balanceOf function SHOULD simply directly call the parent (super) contract&#x27;s balanceOf function.&lt;&#x2F;p&gt;
&lt;p&gt;What hasn&#x27;t been carried over to tip token standard, is the ability for a spender of other users&#x27; tips. For the moment, this standard does not foresee a need for this.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP does not stress a need for tip token secondary markets or other use cases where identifying the tip token type with names rather than addresses might be useful, so these functions were left out of the ITipToken interface and is the remit for implementers.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Though it is RECOMMENDED that users&#x27; deposits are kept locked in the tip token contract or external escrow account, and SHOULD NOT be used for anything but the rewards for holders, this cannot be enforced. This standard stipulates that the rewards MUST be available for when holders withdraw their rewards from the pool of deposits.&lt;&#x2F;p&gt;
&lt;p&gt;Before any users can tip an NFT, the holder of the NFT has to give their approval for tipping from the tip token contract. This standard stipulates that holders of the NFTs receive the rewards. It SHOULD be clear in the tip token contract code that it does so, without obfuscation to where the rewards go. Any fee charges SHOULD be made obvious to users before acceptance of their deposit. There is a risk that rogue implementers may attempt to *hijack* potential tip income streams for their own purposes. But additionally the number and frequency of transactions of the tipping process should make this type of fraud quicker to be found out.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Sign-In with Ethereum</title>
        <published>2021-10-11T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Wayne Chang</name><uri>https://github.com/wyc</uri>
	</author>
	
	<author>
		<name>Gregory Rocco</name><uri>https://github.com/obstropolos</uri>
	</author>
	
	<author>
		<name>Brantly Millegan</name><uri>https://github.com/brantlymillegan</uri>
	</author>
	
	<author>
		<name>Nick Johnson</name><uri>https://github.com/Arachnid</uri>
	</author>
	
	<author>
		<name>Oliver Terbu</name><uri>https://github.com/awoie</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4361/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-4361-sign-in-with-ethereum/7263" />
        

        <id>https://wg-eips.ritovision.com/4361/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:4361"
            label="ERC-4361" />
        

        
        

        
        <summary type="html">Off-chain authentication for Ethereum accounts to establish sessions.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4361/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Sign-In with Ethereum describes how Ethereum accounts authenticate with off-chain services by signing a standard message format parameterized by scope, session details, and security mechanisms (e.g., a nonce). The goals of this specification are to provide a self-custodied alternative to centralized identity providers, improve interoperability across off-chain services for Ethereum-based authentication, and provide wallet vendors a consistent machine-readable message format to achieve improved user experiences and consent management.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;When signing in to popular non-blockchain services today, users will typically use identity providers (IdPs) that are centralized entities with ultimate control over users&#x27; identifiers, for example, large internet companies and email providers. Incentives are often misaligned between these parties. Sign-In with Ethereum offers a new self-custodial option for users who wish to assume more control and responsibility over their own digital identity.&lt;&#x2F;p&gt;
&lt;p&gt;Already, many services support workflows to authenticate Ethereum accounts using message signing, such as to establish a cookie-based web session which can manage privileged metadata about the authenticating address. This is an opportunity to standardize the sign-in workflow and improve interoperability across existing services, while also providing wallet vendors a reliable method to identify signing requests as Sign-In with Ethereum requests for improved UX.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;overview&quot;&gt;Overview&lt;&#x2F;h3&gt;
&lt;p&gt;Sign-In with Ethereum (SIWE) works as follows:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The relying party generates a SIWE Message and prefixes the SIWE Message with &lt;code&gt;\x19Ethereum Signed Message:\n&amp;lt;length of message&amp;gt;&lt;&#x2F;code&gt; as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;191&#x2F;&quot;&gt;ERC-191&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The wallet presents the user with a structured plaintext message or equivalent interface for signing the SIWE Message with the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;191&#x2F;&quot;&gt;ERC-191&lt;&#x2F;a&gt; signed data format.&lt;&#x2F;li&gt;
&lt;li&gt;The signature is then presented to the relying party, which checks the signature&#x27;s validity and SIWE Message content.&lt;&#x2F;li&gt;
&lt;li&gt;The relying party might further fetch data associated with the Ethereum address, such as from the Ethereum blockchain (e.g., ENS, account balances, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;&#x2F;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;&#x2F;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; asset ownership), or other data sources that might or might not be permissioned.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;message-format&quot;&gt;Message Format&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;abnf-message-format&quot;&gt;ABNF Message Format&lt;&#x2F;h4&gt;
&lt;p&gt;A SIWE Message MUST conform with the following Augmented Backus–Naur Form (ABNF, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc5234&quot;&gt;RFC 5234&lt;&#x2F;a&gt;) expression (note that &lt;code&gt;%s&lt;&#x2F;code&gt; denotes case sensitivity for a string term, as per &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc7405&quot;&gt;RFC 7405&lt;&#x2F;a&gt;).&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;ABNF&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sign-in-with-ethereum =&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; scheme&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;:&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; domain&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; %s&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; wants you to sign in with your Ethereum account:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; LF&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; LF&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    LF&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; statement&lt;&#x2F;span&gt;&lt;span&gt; LF&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    LF&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    %s&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;URI: &lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uri&lt;&#x2F;span&gt;&lt;span&gt; LF&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    %s&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Version: &lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; version&lt;&#x2F;span&gt;&lt;span&gt; LF&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    %s&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Chain ID: &lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; chain-id&lt;&#x2F;span&gt;&lt;span&gt; LF&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    %s&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Nonce: &lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt; LF&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    %s&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Issued At: &lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; issued-at&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    [&lt;&#x2F;span&gt;&lt;span&gt; LF&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; %s&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Expiration Time: &lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; expiration-time&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    [&lt;&#x2F;span&gt;&lt;span&gt; LF&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; %s&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Not Before: &lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; not-before&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    [&lt;&#x2F;span&gt;&lt;span&gt; LF&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; %s&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Request ID: &lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; request-id&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    [&lt;&#x2F;span&gt;&lt;span&gt; LF&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; %s&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Resources:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    resources&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;scheme =&lt;&#x2F;span&gt;&lt;span&gt; ALPHA&lt;&#x2F;span&gt;&lt;span&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt; ALPHA&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span&gt; DIGIT&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    ;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See RFC 3986 for the fully contextualized&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    ;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; definition of &amp;quot;scheme&amp;quot;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;domain =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; authority&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    ;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; From RFC 3986:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    ;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     authority     = [ userinfo &amp;quot;@&amp;quot; ] host [ &amp;quot;:&amp;quot; port ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    ;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See RFC 3986 for the fully contextualized&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    ;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; definition of &amp;quot;authority&amp;quot;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;address =&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; 40*40&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;HEXDIG&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    ;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Must also conform to capitalization&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    ;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; checksum encoding specified in EIP-55&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    ;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; where applicable (EOAs).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;statement =&lt;&#x2F;span&gt;&lt;span&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; reserved&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; unreserved&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    ;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See RFC 3986 for the definition&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    ;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; of &amp;quot;reserved&amp;quot; and &amp;quot;unreserved&amp;quot;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    ;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The purpose is to exclude LF (line break).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;uri =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; URI&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    ;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See RFC 3986 for the definition of &amp;quot;URI&amp;quot;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;version =&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;chain-id =&lt;&#x2F;span&gt;&lt;span&gt; 1*&lt;&#x2F;span&gt;&lt;span&gt;DIGIT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    ;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See EIP-155 for valid CHAIN_IDs.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;nonce =&lt;&#x2F;span&gt;&lt;span&gt; 8*&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt; ALPHA&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span&gt; DIGIT&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    ;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See RFC 5234 for the definition&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    ;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; of &amp;quot;ALPHA&amp;quot; and &amp;quot;DIGIT&amp;quot;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;issued-at =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; date-time&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;expiration-time =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; date-time&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;not-before =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; date-time&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    ;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See RFC 3339 (ISO 8601) for the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    ;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; definition of &amp;quot;date-time&amp;quot;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;request-id =&lt;&#x2F;span&gt;&lt;span&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;pchar&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    ;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See RFC 3986 for the definition of &amp;quot;pchar&amp;quot;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;resources =&lt;&#x2F;span&gt;&lt;span&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;(&lt;&#x2F;span&gt;&lt;span&gt; LF&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; resource&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;resource =&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;- &lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; URI&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;message-fields&quot;&gt;Message Fields&lt;&#x2F;h4&gt;
&lt;p&gt;This specification defines the following SIWE Message fields that can be parsed from a SIWE Message by following the rules in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4361&#x2F;#abnf-message-format&quot;&gt;ABNF Message Format&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;scheme&lt;&#x2F;code&gt; OPTIONAL. The URI scheme of the origin of the request. Its value MUST be an RFC 3986 URI scheme.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;domain&lt;&#x2F;code&gt; REQUIRED. The domain that is requesting the signing. Its value MUST be an RFC 3986 authority. The authority includes an OPTIONAL port. If the port is not specified, the default port for the provided &lt;code&gt;scheme&lt;&#x2F;code&gt; is assumed (e.g., 443 for HTTPS). If &lt;code&gt;scheme&lt;&#x2F;code&gt; is not specified, HTTPS is assumed by default.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;address&lt;&#x2F;code&gt; REQUIRED. The Ethereum address performing the signing. Its value SHOULD be conformant to mixed-case checksum address encoding specified in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;55&#x2F;&quot;&gt;ERC-55&lt;&#x2F;a&gt; where applicable.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;statement&lt;&#x2F;code&gt; OPTIONAL. A human-readable ASCII assertion that the user will sign which MUST NOT include &lt;code&gt;&#x27;\n&#x27;&lt;&#x2F;code&gt; (the byte &lt;code&gt;0x0a&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;uri&lt;&#x2F;code&gt; REQUIRED. An RFC 3986 URI referring to the resource that is the subject of the signing (as in the &lt;em&gt;subject of a claim&lt;&#x2F;em&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;version&lt;&#x2F;code&gt; REQUIRED. The current version of the SIWE Message, which MUST be &lt;code&gt;1&lt;&#x2F;code&gt; for this specification.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;chain-id&lt;&#x2F;code&gt; REQUIRED. The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt; Chain ID to which the session is bound, and the network where Contract Accounts MUST be resolved.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;nonce&lt;&#x2F;code&gt; REQUIRED. A random string typically chosen by the relying party and used to prevent replay attacks, at least 8 alphanumeric characters.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;issued-at&lt;&#x2F;code&gt; REQUIRED. The time when the message was generated, typically the current time. Its value MUST be an &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc3339&quot;&gt;RFC 3339&lt;&#x2F;a&gt; datetime string.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;expiration-time&lt;&#x2F;code&gt; OPTIONAL. The time when the signed authentication message is no longer valid. Its value MUST be an &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc3339&quot;&gt;RFC 3339&lt;&#x2F;a&gt; datetime string.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;not-before&lt;&#x2F;code&gt; OPTIONAL. The time when the signed authentication message will become valid. Its value MUST be an &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc3339&quot;&gt;RFC 3339&lt;&#x2F;a&gt; datetime string.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;request-id&lt;&#x2F;code&gt; OPTIONAL. A system-specific identifier that MAY be used to uniquely refer to the sign-in request.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;resources&lt;&#x2F;code&gt; OPTIONAL. A list of information or references to information the user wishes to have resolved as part of authentication by the relying party. Every resource MUST be an RFC 3986 URI separated by &lt;code&gt;&quot;\n- &quot;&lt;&#x2F;code&gt; where &lt;code&gt;\n&lt;&#x2F;code&gt; is the byte &lt;code&gt;0x0a&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;informal-message-template&quot;&gt;Informal Message Template&lt;&#x2F;h4&gt;
&lt;p&gt;A Bash-like informal template of the full SIWE Message is presented below for readability and ease of understanding, and it does not reflect the allowed optionality of the fields. Field descriptions are provided in the following section. A full ABNF description is provided in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4361&#x2F;#abnf-message-format&quot;&gt;ABNF Message Format&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;${scheme}:&#x2F;&#x2F; ${domain} wants you to sign in with your Ethereum account:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;${address}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;${statement}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;URI: ${uri}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Version: ${version}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Chain ID: ${chain-id}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Nonce: ${nonce}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Issued At: ${issued-at}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Expiration Time: ${expiration-time}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Not Before: ${not-before}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Request ID: ${request-id}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Resources:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;- ${resources[0]}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;- ${resources[1]}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;- ${resources[n]}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;examples&quot;&gt;Examples&lt;&#x2F;h4&gt;
&lt;p&gt;The following is an example SIWE Message with an implicit scheme:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;example.com wants you to sign in with your Ethereum account:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;I accept the ExampleOrg Terms of Service: https:&#x2F;&#x2F;example.com&#x2F;tos&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;URI: https:&#x2F;&#x2F;example.com&#x2F;login&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Version: 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Chain ID: 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Nonce: 32891756&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Issued At: 2021-09-30T16:25:24Z&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Resources:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;- ipfs:&#x2F;&#x2F;bafybeiemxf5abjwjbikoz4mc3a3dla6ual3jsgpdr4cjr3oz3evfyavhwq&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;- https:&#x2F;&#x2F;example.com&#x2F;my-web2-claim.json&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The following is an example SIWE Message with an implicit scheme and explicit port:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;example.com:3388 wants you to sign in with your Ethereum account:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;I accept the ExampleOrg Terms of Service: https:&#x2F;&#x2F;example.com&#x2F;tos&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;URI: https:&#x2F;&#x2F;example.com&#x2F;login&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Version: 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Chain ID: 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Nonce: 32891756&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Issued At: 2021-09-30T16:25:24Z&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Resources:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;- ipfs:&#x2F;&#x2F;bafybeiemxf5abjwjbikoz4mc3a3dla6ual3jsgpdr4cjr3oz3evfyavhwq&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;- https:&#x2F;&#x2F;example.com&#x2F;my-web2-claim.json&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The following is an example SIWE Message with an explicit scheme:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;https:&#x2F;&#x2F;example.com wants you to sign in with your Ethereum account:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;I accept the ExampleOrg Terms of Service: https:&#x2F;&#x2F;example.com&#x2F;tos&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;URI: https:&#x2F;&#x2F;example.com&#x2F;login&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Version: 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Chain ID: 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Nonce: 32891756&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Issued At: 2021-09-30T16:25:24Z&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Resources:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;- ipfs:&#x2F;&#x2F;bafybeiemxf5abjwjbikoz4mc3a3dla6ual3jsgpdr4cjr3oz3evfyavhwq&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;- https:&#x2F;&#x2F;example.com&#x2F;my-web2-claim.json&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;signing-and-verifying-messages-with-ethereum-accounts&quot;&gt;Signing and Verifying Messages with Ethereum Accounts&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;For Externally Owned Accounts (EOAs), the verification method specified in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;191&#x2F;&quot;&gt;ERC-191&lt;&#x2F;a&gt; MUST be used.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;For Contract Accounts,&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The verification method specified in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;ERC-1271&lt;&#x2F;a&gt; SHOULD be used, and if it is not, the implementer MUST clearly define the verification method to attain security and interoperability for both wallets and relying parties.&lt;&#x2F;li&gt;
&lt;li&gt;When performing &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;ERC-1271&lt;&#x2F;a&gt; signature verification, the contract performing the verification MUST be resolved from the specified &lt;code&gt;chain-id&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Implementers SHOULD take into consideration that &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;ERC-1271&lt;&#x2F;a&gt; implementations are not required to be pure functions, and can return different results for the same inputs depending on blockchain state. This can affect the security model and session validation rules. For example, a service with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;ERC-1271&lt;&#x2F;a&gt; signing enabled could rely on webhooks to receive notifications when state affecting the results is changed. When it receives a notification, it invalidates any matching sessions.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;resolving-ethereum-name-service-ens-data&quot;&gt;Resolving Ethereum Name Service (ENS) Data&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;The relying party or wallet MAY additionally perform resolution of ENS data, as this can improve the user experience by displaying human-friendly information that is related to the &lt;code&gt;address&lt;&#x2F;code&gt;. Resolvable ENS data include:
&lt;ul&gt;
&lt;li&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;181&#x2F;&quot;&gt;primary ENS name&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The ENS avatar.&lt;&#x2F;li&gt;
&lt;li&gt;Any other resolvable resources specified in the ENS documentation.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;If resolution of ENS data is performed, implementers SHOULD take precautions to preserve user privacy and consent, as their &lt;code&gt;address&lt;&#x2F;code&gt; could be forwarded to third party services as part of the resolution process.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;relying-party-implementer-steps&quot;&gt;Relying Party Implementer Steps&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;specifying-the-request-origin&quot;&gt;Specifying the Request Origin&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;domain&lt;&#x2F;code&gt; and, if present, the &lt;code&gt;scheme&lt;&#x2F;code&gt;, in the SIWE Message MUST correspond to the origin from where the signing request was made. For instance, if the signing request is made within a cross-origin iframe embedded in a parent browser window, the &lt;code&gt;domain&lt;&#x2F;code&gt; (and, if present, the &lt;code&gt;scheme&lt;&#x2F;code&gt;) have to match the origin of the iframe, rather than the origin of the parent. This is crucial to prevent the iframe from falsely asserting the origin of one of its ancestor windows for security reasons. This behavior is enforced by conforming wallets.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;verifying-a-signed-message&quot;&gt;Verifying a signed Message&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;The SIWE Message MUST be checked for conformance to the ABNF Message Format in the previous sections, checked against expected values after parsing (e.g., &lt;code&gt;expiration-time&lt;&#x2F;code&gt;, &lt;code&gt;nonce&lt;&#x2F;code&gt;, &lt;code&gt;request-uri&lt;&#x2F;code&gt; etc.), and its signature MUST be checked as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4361&#x2F;#signing-and-verifying-messages-with-ethereum-accounts&quot;&gt;Signing and Verifying Messages with Ethereum Accounts&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;creating-sessions&quot;&gt;Creating Sessions&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Sessions MUST be bound to the &lt;code&gt;address&lt;&#x2F;code&gt; and not to further resolved resources that can change.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;interpreting-and-resolving-resources&quot;&gt;Interpreting and resolving Resources&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Implementers SHOULD ensure that URIs in the listed &lt;code&gt;resources&lt;&#x2F;code&gt; are human-friendly when expressed in plaintext form.&lt;&#x2F;li&gt;
&lt;li&gt;The interpretation of the listed &lt;code&gt;resources&lt;&#x2F;code&gt; in the SIWE Message is out of scope of this specification.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;wallet-implementer-steps&quot;&gt;Wallet Implementer Steps&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;verifying-the-message-format&quot;&gt;Verifying the Message Format&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;The full SIWE message MUST be checked for conformance to the ABNF defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4361&#x2F;#abnf-message-format&quot;&gt;ABNF Message Format&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Wallet implementers SHOULD warn users if the substring &lt;code&gt;&quot;wants you to sign in with your Ethereum account&quot;&lt;&#x2F;code&gt; appears anywhere in an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;191&#x2F;&quot;&gt;ERC-191&lt;&#x2F;a&gt; message signing
request unless the message fully conforms to the format defined &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4361&#x2F;#abnf-message-format&quot;&gt;ABNF Message Format&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;verifying-the-request-origin&quot;&gt;Verifying the Request Origin&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Wallet implementers MUST prevent phishing attacks by verifying the origin of the request against the &lt;code&gt;scheme&lt;&#x2F;code&gt; and &lt;code&gt;domain&lt;&#x2F;code&gt; fields in the SIWE Message. For example, when processing the SIWE message beginning with &lt;code&gt;&quot;example.com wants you to sign in...&quot;&lt;&#x2F;code&gt;, the wallet checks that the request actually originated from &lt;code&gt;https:&#x2F;&#x2F;example.com&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The origin SHOULD be read from a trusted data source such as the browser window or over WalletConnect (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1328&#x2F;&quot;&gt;ERC-1328&lt;&#x2F;a&gt;) sessions for comparison against the signing message contents.&lt;&#x2F;li&gt;
&lt;li&gt;Wallet implementers MAY warn instead of rejecting the verification if the origin is pointing to localhost.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The following is a RECOMMENDED algorithm for Wallets to conform with the requirements on request origin verification defined by this specification.&lt;&#x2F;p&gt;
&lt;p&gt;The algorithm takes the following input variables:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;fields from the SIWE message.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;origin&lt;&#x2F;code&gt; of the signing request - in the case of a browser wallet implementation - the origin of the page which requested the signin via the provider.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;allowedSchemes&lt;&#x2F;code&gt; - a list of schemes allowed by the Wallet.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;defaultScheme&lt;&#x2F;code&gt; - a scheme to assume when none was provided. Wallet implementers in the browser SHOULD use &lt;code&gt;https&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;developer mode indication - a setting deciding if certain risks should be a warning instead of rejection. Can be manually configured or derived from &lt;code&gt;origin&lt;&#x2F;code&gt; being localhost.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The algorithm is described as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If &lt;code&gt;scheme&lt;&#x2F;code&gt; was not provided, then assign &lt;code&gt;defaultScheme&lt;&#x2F;code&gt; as &lt;code&gt;scheme&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;scheme&lt;&#x2F;code&gt; is not contained in &lt;code&gt;allowedSchemes&lt;&#x2F;code&gt;, then the &lt;code&gt;scheme&lt;&#x2F;code&gt; is not expected and the Wallet MUST reject the request. Wallet implementers in the browser SHOULD limit the list of &lt;code&gt;allowedSchemes&lt;&#x2F;code&gt; to just &lt;code&gt;&#x27;https&#x27;&lt;&#x2F;code&gt; unless a developer mode is activated.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;scheme&lt;&#x2F;code&gt; does not match the scheme of &lt;code&gt;origin&lt;&#x2F;code&gt;, the Wallet SHOULD reject the request. Wallet implementers MAY show a warning instead of rejecting the request if a developer mode is activated. In that case the Wallet continues processing the request.&lt;&#x2F;li&gt;
&lt;li&gt;If the &lt;code&gt;host&lt;&#x2F;code&gt; part of the &lt;code&gt;domain&lt;&#x2F;code&gt; and &lt;code&gt;origin&lt;&#x2F;code&gt; do not match, the Wallet MUST reject the request unless the Wallet is in developer mode. In developer mode the Wallet MAY show a warning instead and continues processing the request.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;domain&lt;&#x2F;code&gt; and &lt;code&gt;origin&lt;&#x2F;code&gt; have mismatching subdomains, the Wallet SHOULD reject the request unless the Wallet is in developer mode. In developer mode the Wallet MAY show a warning instead and continues processing the request.&lt;&#x2F;li&gt;
&lt;li&gt;Let &lt;code&gt;port&lt;&#x2F;code&gt; be the port component of &lt;code&gt;domain&lt;&#x2F;code&gt;, and if no port is contained in &lt;code&gt;domain&lt;&#x2F;code&gt;, assign &lt;code&gt;port&lt;&#x2F;code&gt; the default port specified for the &lt;code&gt;scheme&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;port&lt;&#x2F;code&gt; is not empty, then the Wallet SHOULD show a warning if the &lt;code&gt;port&lt;&#x2F;code&gt; does not match the port of &lt;code&gt;origin&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;port&lt;&#x2F;code&gt; is empty, then the Wallet MAY show a warning if &lt;code&gt;origin&lt;&#x2F;code&gt; contains a specific port. (Note &#x27;https&#x27; has a default port of 443 so this only applies if &lt;code&gt;allowedSchemes&lt;&#x2F;code&gt; contain unusual schemes)&lt;&#x2F;li&gt;
&lt;li&gt;Return request origin verification completed.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;creating-sign-in-with-ethereum-interfaces&quot;&gt;Creating Sign-In with Ethereum Interfaces&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Wallet implementers MUST display to the user the following fields from the SIWE Message request by default and prior to signing, if they are present: &lt;code&gt;scheme&lt;&#x2F;code&gt;, &lt;code&gt;domain&lt;&#x2F;code&gt;, &lt;code&gt;address&lt;&#x2F;code&gt;, &lt;code&gt;statement&lt;&#x2F;code&gt;, and &lt;code&gt;resources&lt;&#x2F;code&gt;. Other present fields MUST also be made available to the user prior to signing either by default or through an extended interface.&lt;&#x2F;li&gt;
&lt;li&gt;Wallet implementers displaying a plaintext SIWE Message to the user SHOULD require the user to scroll to the bottom of the text area prior to signing.&lt;&#x2F;li&gt;
&lt;li&gt;Wallet implementers MAY construct a custom SIWE user interface by parsing the ABNF terms into data elements for use in the interface. The display rules above still apply to custom interfaces.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;supporting-internationalization-i18n&quot;&gt;Supporting internationalization (i18n)&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;After successfully parsing the message into ABNF terms, translation MAY happen at the UX level per human language.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;requirements&quot;&gt;Requirements&lt;&#x2F;h3&gt;
&lt;p&gt;Write a specification for how Sign-In with Ethereum should work. The specification should be simple and generally follow existing practices. Avoid feature bloat, particularly the inclusion of lesser-used projects who see getting into the specification as a means of gaining adoption. The core specification should be decentralized, open, non-proprietary, and have long-term viability. It should have no dependence on a centralized server except for the servers already being run by the application that the user is signing in to. The basic specification should include: Ethereum accounts used for authentication, ENS names for usernames (via reverse resolution), and data from the ENS name’s text records for additional profile information (e.g. avatar, social media handles, etc).&lt;&#x2F;p&gt;
&lt;p&gt;Additional functional requirements:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The user must be presented a human-understandable interface prior to signing, mostly free of machine-targeted artifacts such as JSON blobs, hex codes (aside from the Ethereum address), and baseXX-encoded strings.&lt;&#x2F;li&gt;
&lt;li&gt;The application server must be able to implement fully usable support for its end without forcing a change in the wallets.&lt;&#x2F;li&gt;
&lt;li&gt;There must be a simple and straightforward upgrade path for both applications and wallets already using Ethereum account-based signing for authentication.&lt;&#x2F;li&gt;
&lt;li&gt;There must be facilities and guidelines for adequate mitigation of Man-in-the-Middle (MITM) attacks, replay attacks, and malicious signing requests.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;design-goals&quot;&gt;Design Goals&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;Human-Friendly&lt;&#x2F;li&gt;
&lt;li&gt;Simple to Implement&lt;&#x2F;li&gt;
&lt;li&gt;Secure&lt;&#x2F;li&gt;
&lt;li&gt;Machine Readable&lt;&#x2F;li&gt;
&lt;li&gt;Extensible&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;technical-decisions&quot;&gt;Technical Decisions&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Why &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;191&#x2F;&quot;&gt;ERC-191&lt;&#x2F;a&gt; (Signed Data Standard) over &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; (Ethereum typed structured data hashing and signing)&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;191&#x2F;&quot;&gt;ERC-191&lt;&#x2F;a&gt; is already broadly supported across wallets UX, while &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; support for friendly user display is pending. &lt;strong&gt;(1, 2, 3, 4)&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;191&#x2F;&quot;&gt;ERC-191&lt;&#x2F;a&gt; is simple to implement using a pre-set prefix prior to signing, while &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; is more complex to implement requiring the further implementations of a bespoke Solidity-inspired type system, RLP-based encoding format, and custom keccak-based hashing scheme. &lt;strong&gt;(2)&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;191&#x2F;&quot;&gt;ERC-191&lt;&#x2F;a&gt; produces more human-readable messages, while &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; creates signing outputs for machine consumption, with most wallets not displaying the payload to be signed in a manner friendly to humans. &lt;strong&gt;(1)&lt;&#x2F;strong&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4361&#x2F;.&#x2F;assets&#x2F;signing.png&quot; alt=&quot;&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; has the advantage of on-chain representation and on-chain verifiability, such as for their use in metatransactions, but this feature is not relevant for the specification&#x27;s scope. &lt;strong&gt;(2)&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Why not use JWTs? Wallets don&#x27;t support JWTs. The keccak hash function is not assigned by IANA for use as a JOSE algorithm. &lt;strong&gt;(2, 3)&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Why not use YAML or YAML with exceptions? YAML is loose compared to ABNF, which can readily express character set limiting, required ordering, and strict whitespacing. &lt;strong&gt;(2, 3)&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;out-of-scope&quot;&gt;Out of Scope&lt;&#x2F;h3&gt;
&lt;p&gt;The following concerns are out of scope for this version of the specification to define:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Additional authentication not based on Ethereum addresses.&lt;&#x2F;li&gt;
&lt;li&gt;Authorization to server resources.&lt;&#x2F;li&gt;
&lt;li&gt;Interpretation of the URIs in the &lt;code&gt;resources&lt;&#x2F;code&gt; field as claims or other resources.&lt;&#x2F;li&gt;
&lt;li&gt;The specific mechanisms to ensure domain-binding.&lt;&#x2F;li&gt;
&lt;li&gt;The specific mechanisms to generate nonces and evaluation of their appropriateness.&lt;&#x2F;li&gt;
&lt;li&gt;Protocols for use without TLS connections.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;considerations-for-forwards-compatibility&quot;&gt;Considerations for Forwards Compatibility&lt;&#x2F;h3&gt;
&lt;p&gt;The following items are considered for future support either through an iteration of this specification or new work items using this specification as a dependency.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Possible support for Decentralized Identifiers and Verifiable Credentials.&lt;&#x2F;li&gt;
&lt;li&gt;Possible cross-chain support.&lt;&#x2F;li&gt;
&lt;li&gt;Possible SIOPv2 support.&lt;&#x2F;li&gt;
&lt;li&gt;Possible future support for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Version interpretation rules, e.g., sign with minor revision greater than understood, but not greater major version.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Most wallet implementations already support &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;191&#x2F;&quot;&gt;ERC-191&lt;&#x2F;a&gt;, so this is used as a base pattern with additional features.&lt;&#x2F;li&gt;
&lt;li&gt;Requirements were gathered from existing implementations of similar sign-in workflows, including statements to allow the user to accept a Terms of Service, nonces for replay protection, and inclusion of the Ethereum address itself in the message.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;A reference implementation is available &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4361&#x2F;.&#x2F;assets&#x2F;example.js&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;identifier-reuse&quot;&gt;Identifier Reuse&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Towards perfect privacy, it would be ideal to use a new uncorrelated identifier (e.g., Ethereum address) per digital interaction, selectively disclosing the information required and no more.&lt;&#x2F;li&gt;
&lt;li&gt;This concern is less relevant to certain user demographics who are likely to be early adopters of this specification, such as those who manage an Ethereum address and&#x2F;or ENS names intentionally associated with their public presence. These users often prefer identifier reuse to maintain a single correlated identity across many services.&lt;&#x2F;li&gt;
&lt;li&gt;This consideration will become increasingly important with mainstream adoption. There are several ways to move towards this model, such as using HD wallets, signed delegations, and zero-knowledge proofs. However, these approaches are out of scope for this specification and better suited for follow-on specifications.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;key-management&quot;&gt;Key Management&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Sign-In with Ethereum gives users control through their keys. This is additional responsibility that mainstream users may not be accustomed to accepting, and key management is a hard problem especially for individuals. For example, there is no &quot;forgot password&quot; button as centralized identity providers commonly implement.&lt;&#x2F;li&gt;
&lt;li&gt;Early adopters of this specification are likely to be already adept at key management, so this consideration becomes more relevant with mainstream adoption.&lt;&#x2F;li&gt;
&lt;li&gt;Certain wallets can use smart contracts and multisigs to provide an enhanced user experience with respect to key usage and key recovery, and these can be supported via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;ERC-1271&lt;&#x2F;a&gt; signing.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;wallet-and-relying-party-combined-security&quot;&gt;Wallet and Relying Party combined Security&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Both the wallet and relying party have to implement this specification for improved security to the end user. Specifically, the wallet has to confirm that the SIWE Message is for the correct request origin or provide the user means to do so manually (such as instructions to visually confirming the correct domain in a TLS-protected website prior to connecting via QR code or deeplink), otherwise the user is subject to phishing attacks.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;minimizing-wallet-and-server-interaction&quot;&gt;Minimizing Wallet and Server Interaction&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;In some implementations of wallet sign-in workflows, the server first sends parameters of the SIWE Message to the wallet. Others generate the SIWE message for signing entirely in the client side (e.g., dapps). The latter approach without initial server interaction SHOULD be preferred when there is a user privacy advantage by minimizing wallet-server interaction. Often, the backend server first produces a &lt;code&gt;nonce&lt;&#x2F;code&gt; to prevent replay attacks, which it verifies after signing. Privacy-preserving alternatives are suggested in the next section on preventing replay attacks.&lt;&#x2F;li&gt;
&lt;li&gt;Before the wallet presents the SIWE message signing request to the user, it MAY consult the server for the proper contents of the message to be signed, such as an acceptable &lt;code&gt;nonce&lt;&#x2F;code&gt; or requested set of &lt;code&gt;resources&lt;&#x2F;code&gt;. When communicating to the server, the wallet SHOULD take precautions to protect user privacy by mitigating user information revealed as much as possible.&lt;&#x2F;li&gt;
&lt;li&gt;Prior to signing, the wallet MAY consult the user for preferences, such as the selection of one &lt;code&gt;address&lt;&#x2F;code&gt; out of many, or a preferred ENS name out of many.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;preventing-replay-attacks&quot;&gt;Preventing Replay Attacks&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;A &lt;code&gt;nonce&lt;&#x2F;code&gt; SHOULD be selected per session initiation with enough entropy to prevent replay attacks, a man-in-the-middle attack in which an attacker is able to capture the user&#x27;s signature and resend it to establish a new session for themselves.&lt;&#x2F;li&gt;
&lt;li&gt;Implementers MAY consider using privacy-preserving yet widely-available &lt;code&gt;nonce&lt;&#x2F;code&gt; values, such as one derived from a recent Ethereum block hash or a recent Unix timestamp.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;preventing-phishing-attacks&quot;&gt;Preventing Phishing Attacks&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;To prevent phishing attacks Wallets have to implement request origin verification as described in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4361&#x2F;#verifying-the-request-origin&quot;&gt;Verifying the Request Origin&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;channel-security&quot;&gt;Channel Security&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;For web-based applications, all communications SHOULD use HTTPS to prevent man-in-the-middle attacks on the message signing.&lt;&#x2F;li&gt;
&lt;li&gt;When using protocols other than HTTPS, all communications SHOULD be protected with proper techniques to maintain confidentiality, data integrity, and sender&#x2F;receiver authenticity.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;session-invalidation&quot;&gt;Session Invalidation&lt;&#x2F;h3&gt;
&lt;p&gt;There are several cases where an implementer SHOULD check for state changes as they relate to sessions.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;ERC-1271&lt;&#x2F;a&gt; implementation or dependent data changes the signature computation, the server SHOULD invalidate sessions appropriately.&lt;&#x2F;li&gt;
&lt;li&gt;If any resources specified in &lt;code&gt;resources&lt;&#x2F;code&gt; change, the server SHOULD invalidate sessions appropriately. However, the interpretation of &lt;code&gt;resources&lt;&#x2F;code&gt; is out of scope of this specification.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;maximum-lengths-for-abnf-terms&quot;&gt;Maximum Lengths for ABNF Terms&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;While this specification does not contain normative requirements around maximum string lengths, implementers SHOULD choose maximum lengths for terms that strike a balance across the prevention of denial of service attacks, support for arbitrary use cases, and user readability.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Interface for Staked Tokens in NFTs</title>
        <published>2021-10-08T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Rex Creed</name><uri>https://github.com/aug2uag</uri>
	</author>
	
	<author>
		<name>Dane Scarborough</name><email>dane@nftapps.us</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4353/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-4353-viewing-staked-tokens-in-nft/7234" />
        

        <id>https://wg-eips.ritovision.com/4353/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:4353"
            label="ERC-4353" />
        

        
        

        
        <summary type="html">This interface enables access to publicly viewable staking data of an NFT.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4353/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; tokens can be deposited or staked in NFTs for a variety of reasons including escrow, rewards, benefits, and others. There is currently no means of retrieving the number of tokens staked and&#x2F;or bound to an NFT. This proposal outlines a standard that may be implemented by all wallets and marketplaces easily to correctly retrieve the staked token amount of an NFT.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Without staked token data, the actual amount of staked tokens cannot be conveyed from token owners to other users, and cannot be displayed in wallets, marketplaces, or block explorers. The ability to identify and verify an exogenous value derived from the staking process may be critical to the aims of an NFT holder.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Interface of the ERC4353 standard, as defined in the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-4353.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * Implementers can declare support of contract interfaces, which can then be&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * queried by others.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: The ERC-165 identifier for this interface is 0x3a3d855f.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC721Staked&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns uint256 amount of on-chain tokens staked to the NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Wallets and marketplaces would need to call this for displaying&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      the amount of tokens staked and&#x2F;or bound to the NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; stakedAmount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;suggested-flow&quot;&gt;Suggested flow:&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;constructor-deployment&quot;&gt;Constructor&#x2F;deployment&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Creator - the owner of an NFT with its own rules for depositing tokens at and&#x2F;or after the minting of a token.&lt;&#x2F;li&gt;
&lt;li&gt;Token Amount - the current amount of on-chain &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;EIP-20&lt;&#x2F;a&gt; or derived tokens bound to an NFT from one or more deposits.&lt;&#x2F;li&gt;
&lt;li&gt;Withdraw Mechanism - rules based approach for withdrawing staked tokens and making sure to update the balance of the staked tokens.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;staking-at-mint-and-locking-tokens-in-nft&quot;&gt;Staking at mint and locking tokens in NFT&lt;&#x2F;h3&gt;
&lt;p&gt;The suggested and intended implementation of this standard is to stake tokens at the time of minting an NFT, and not implementing any outbound transfer of tokens outside of &lt;code&gt;burn&lt;&#x2F;code&gt;. Therefore, only to stake at minting and withdraw only at burning.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;nft-displayed-in-wallet-or-marketplace&quot;&gt;NFT displayed in wallet or marketplace&lt;&#x2F;h4&gt;
&lt;p&gt;A wallet or marketplace checks if an NFT has publicly staked tokens available for display - if so, call &lt;code&gt;stakedAmount(tokenId)&lt;&#x2F;code&gt; to get the current amount of tokens staked and&#x2F;or bound to the NFT.&lt;&#x2F;p&gt;
&lt;p&gt;The logical code looks something like this and inspired by William Entriken:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; contracts&#x2F;Token.sol&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: MIT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC721&#x2F;extensions&#x2F;ERC721URIStorage.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;access&#x2F;Ownable.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Very simple ERC721 example with stake interface example.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; this implementation enforces recommended procedure:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *  1) stake at mint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *  2) withdraw at burn&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721Staked&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721URIStorage&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Ownable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; track original minter of tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; payees&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; map tokens to stored staked token value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; tokenValue&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; metadata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;Staked NFT&amp;quot;, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;SNFT&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; mints a new NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address that will own the minted NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; id the NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _uri&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; metadata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _uri&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        payable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        onlyOwner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _setTokenURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _uri&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        payees&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        tokenValue&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; staked interface&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; id of the NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; staked value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; stakedAmount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _value &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; tokenValue&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; removes NFT &amp;amp; transfers crypto to minter&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the NFT we want to remove&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; burn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        onlyOwner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_burn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        payees&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenValue&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        tokenValue&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is completely agnostic to how tokens are deposited or handled by the NFT. It is, therefore, the choice and responsibility of the author to encode and communicate the encoding of their tokenomics to purchasees of their token and&#x2F;or to make their contracts viewable by purchasees.&lt;&#x2F;p&gt;
&lt;p&gt;Although the intention of this standard is for tokens staked at mint and withdrawable only upon burn, the interface may be modified for dynamic withdrawing and depositing of tokens especially under DeFi application settings. In its current form, the contract logic may be the determining factor whether a deviation from the standard exists.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backward-compatibility&quot;&gt;Backward Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; expect&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;chai&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; ethers&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; waffle&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;hardhat&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; provider&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; waffle&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;provider&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;describe&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;StakedNFT&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1234567890&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1.5&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Token&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Interface&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; addr1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; addr2&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    beforeEach&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt;async&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        Token&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ethers&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getContractFactory&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ERC721Staked&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; addr1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ...&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;addr2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ethers&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getSigners&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        Interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Token&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;deploy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    describe&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Staked NFT&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        it&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Should set the right owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; async&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; mint&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Interface&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;                addr1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;http:&#x2F;&#x2F;foobar&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Interface&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;addr1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        it&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Should not have staked balance without value&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; async&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; mint&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Interface&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;                addr1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;http:&#x2F;&#x2F;foobar&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Interface&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;stakedAmount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;                ethers&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;utils&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;parseEther&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        it&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Should set and return the staked amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; async&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; mint&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Interface&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;                addr1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;http:&#x2F;&#x2F;foobar&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                {&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ethers&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;utils&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;parseEther&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Interface&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;stakedAmount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;                ethers&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;utils&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;parseEther&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        it&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Should decrease owner eth balance on mint (deposit)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; async&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; balance1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; provider&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getBalance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; mint&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Interface&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;                addr1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;http:&#x2F;&#x2F;foobar&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                {&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ethers&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;utils&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;parseEther&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; balance2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; provider&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getBalance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; diff&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; parseFloat&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;ethers&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;utils&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;formatEther&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;                balance1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;sub&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;balance2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;toFixed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;diff&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ===&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        it&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Should add to payee&amp;#39;s eth balance on burn (withdraw)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; async&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; balance1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; provider&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getBalance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;addr1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; mint&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Interface&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;                addr1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;http:&#x2F;&#x2F;foobar&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                {&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ethers&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;utils&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;parseEther&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Interface&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;burn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; balance2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; provider&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getBalance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;addr1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; diff&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; parseFloat&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;ethers&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;utils&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;formatEther&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;                balance2&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;sub&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;balance1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;toFixed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;diff&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ===&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        it&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Should update balance after transfer&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; async&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; mint&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Interface&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;                addr1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;http:&#x2F;&#x2F;foobar&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                {&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ethers&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;utils&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;parseEther&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Interface&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;burn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Interface&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;stakedAmount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;                ethers&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;utils&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;parseEther&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The purpose of this standard is to simply and publicly identify whether an NFT claims to have staked tokens.&lt;&#x2F;p&gt;
&lt;p&gt;Staked claims will be unreliable without a locking mechanism enforced, for example, if staked tokens can only be transferred at burn. Otherwise, tokens may be deposited and&#x2F;or withdrawn at any time via arbitrary methods. Also, contracts that may allow arbitrary transfers without updating the correct balance will result in potential issues. A strict rules-based approach should be taken with these edge cases in mind.&lt;&#x2F;p&gt;
&lt;p&gt;A dedicated service may exist to verify the claims of a token by analyzing transactions on the explorer. In this manner, verification may be automated to ensure a token&#x27;s claims are valid. The logical extension of this method may be to extend the interface and support flagging erroneous claims, all the while maintaining a simple goal of validating and verifying a staked amount exists to benefit the operator experience.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Difficulty Bomb Delay to June 2022</title>
        <published>2021-10-05T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Tim Beiko</name><uri>https://github.com/timbeiko</uri>
	</author>
	
	<author>
		<name>James Hancock</name><uri>https://github.com/MadeOfTin</uri>
	</author>
	
	<author>
		<name>Thomas Jay Rush</name><uri>https://github.com/tjayrush</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4345/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-4345-difficulty-bomb-delay-to-may-2022/7209" />
        

        <id>https://wg-eips.ritovision.com/4345/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:4345"
            label="EIP-4345" />
        

        
        

        
        <summary type="html">Delays the difficulty bomb to be noticeable in June 2022.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4345/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Starting with &lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt; the client will calculate the difficulty based on a fake block number suggesting to the client that the difficulty bomb is adjusting 10,700,000 blocks later than the actual block number.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Targeting for The Merge to occur before June 2022. If it is not ready by then, the bomb can be delayed further.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h4 id=&quot;relax-difficulty-with-fake-block-number&quot;&gt;Relax Difficulty with Fake Block Number&lt;&#x2F;h4&gt;
&lt;p&gt;For the purposes of &lt;code&gt;calc_difficulty&lt;&#x2F;code&gt;, simply replace the use of &lt;code&gt;block.number&lt;&#x2F;code&gt;, as used in the exponential ice age component, with the formula:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    fake_block_number&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10_700_000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; FORK_BLOCK_NUMBER&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The following script predicts a ~0.1 second delay to block time by June 2022 and a ~0.5 second delay by July 2022. This gives reason to address because the effect will be seen, but not so much urgency we don&#x27;t have space to work around if needed.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; predict_diff_bomb_effect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;current_blknum&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; current_difficulty&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; block_adjustment&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; months&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;#39;&amp;#39;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Predicts the effect on block time (as a ratio) in a specified amount of months in the future.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Vars used for predictions:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    current_blknum = 13423376 # Oct 15, 2021&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    current_difficulty = 9545154427582720&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    block adjustment = 10700000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    months = 7.5 # June 2022&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    months = 8.5 # July 2022&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;#39;&amp;#39;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    blocks_per_month&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;86400&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 30&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 13.3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    future_blknum&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; current_blknum&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; blocks_per_month&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; months&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    diff_adjustment&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; **&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;future_blknum&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; block_adjustment&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 100000&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    diff_adjust_coeff&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; diff_adjustment&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span&gt; current_difficulty&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2048&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; diff_adjust_coeff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;diff_adjust_coeff&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; predict_diff_bomb_effect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;13423376&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;9545154427582720&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10700000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7.5&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;diff_adjust_coeff&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; predict_diff_bomb_effect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;13423376&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;9545154427582720&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10700000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;8.5&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No known backward compatibility issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Misjudging the effects of the difficulty can mean longer blocktimes than anticipated until a hardfork is released. Wild shifts in difficulty can affect this number severely. Also, gradual changes in blocktimes due to longer-term adjustments in difficulty can affect the timing of difficulty bomb epochs. This affects the usability of the network but unlikely to have security ramifications.&lt;&#x2F;p&gt;
&lt;p&gt;In this specific instance, it is possible that the network hashrate drops considerably before The Merge, which could accelerate the timeline by which the bomb is felt in block times. The offset value chosen aimed to take this into account.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Ordered NFT Batch Standard</title>
        <published>2021-10-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Simon Tian</name><uri>https://github.com/simontianx</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4341/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/3782" />
        

        <id>https://wg-eips.ritovision.com/4341/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:4341"
            label="ERC-4341" />
        

        
        

        
        <summary type="html">The ordering information of multiple NFTs is retained and managed</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4341/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard introduces a smart contract interface that can represent a batch
of non-fungible tokens of which the ordering information shall be retained and
managed. Such information is particularly useful if &lt;code&gt;tokenId&lt;&#x2F;code&gt;s are encoded with
the sets of &lt;code&gt;unicodes&lt;&#x2F;code&gt; for logographic characters and emojis. As a result, NFTs
can be utilized as carriers of meanings.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Non-fungible tokens are widely accepted as carriers of crypto-assets, hence in both
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt;, the ordering information of
multiple NFTs is discarded. However, as proposed in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3754&#x2F;&quot;&gt;EIP-3754&lt;&#x2F;a&gt;,
non-fungible tokens are thought of as basic units on a blockchain and can carry
abstract meanings with unicoded &lt;code&gt;tokenId&lt;&#x2F;code&gt;s. Transferring such tokens is transmitting
an ordered sequence of unicodes, thus effectively transmitting phrases or meanings
on a blockchain.&lt;&#x2F;p&gt;
&lt;p&gt;A &lt;strong&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Logogram&quot;&gt;logograph&lt;&#x2F;a&gt;&lt;&#x2F;strong&gt; is a written character
that represents a word or morpheme, examples include &lt;em&gt;hanzi&lt;&#x2F;em&gt; in Mandarin, &lt;em&gt;kanji&lt;&#x2F;em&gt;
in Japanese, &lt;em&gt;hanja&lt;&#x2F;em&gt; in Korean, and etc. A &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Unicode&quot;&gt;unicode&lt;&#x2F;a&gt;
is an information technology standard for the consistent encoding, representation, and
handling of texts.&lt;&#x2F;p&gt;
&lt;p&gt;It is natural to combine the two to create unicoded NFTs to represent logographic
characters. Since a rich amount of meanings can be transmitted in just a few
characters in such languages, it is technically practical and valuable to create
a standard for it. Emojis are similar with logographs and can be included as well.
For non-logographic languages such as English, although the same standard can be
applied, it is tedious to represent each letter with an NFT, hence the gain is
hardly justifiable.&lt;&#x2F;p&gt;
&lt;p&gt;A motivating example is instead of sending the two Chinese characters of the
Great Wall &lt;code&gt;长城&lt;&#x2F;code&gt;, two NFTs with IDs &lt;code&gt;#38271&lt;&#x2F;code&gt; and &lt;code&gt;#22478&lt;&#x2F;code&gt; respectively can be
transferred in a batch. The two IDs are corresponding to the decimal unicode of
the two characters. The receiving end decodes the IDs and retrieves the original
characters. A key point is the ordering information matters in this scenario
since the tuples &lt;code&gt;(38271, 22478)&lt;&#x2F;code&gt; and &lt;code&gt;(22478, 38271)&lt;&#x2F;code&gt; can be decoded as
&lt;code&gt;长城&lt;&#x2F;code&gt; and &lt;code&gt;城长&lt;&#x2F;code&gt;, respectively, and both are legitimate words in the Chinese
language. This illustrates the key difference between this standard and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Besides, in the eastern Asian culture, characters are sometimes considered or
practically used as gifts in holidays such as Spring Feastival, etc.
&lt;code&gt;(24685, 21916, 21457, 36001)&lt;&#x2F;code&gt; &lt;code&gt;恭喜发财&lt;&#x2F;code&gt; can be used literally as a gift to
express the best wishes for financial prosperity. It is therefore cuturally
natural to transfer tokens to express meanings with this standard.&lt;&#x2F;p&gt;
&lt;p&gt;Also in logographic language systems, ancient teachings are usually written in
concise ways such that a handful of characters can unfold a rich amount of
meanings. Modern people now get a reliable technical means to pass down their
words, poems and proverbs to the future generations by sending tokens.&lt;&#x2F;p&gt;
&lt;p&gt;Other practical and interesting applications include Chinese chess, wedding
vows, family generation quotes and sayings, funeral commendation words, prayers,
anecdotes and etc.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pragma solidity ^0.8.0;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    @title EIP-4341 Multi Ordered NFT Standard&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    @dev See https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-4341&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;interface ERC4341 &#x2F;* is ERC165 *&#x2F; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    event Transfer(address indexed from, address indexed to, uint256 id, uint256 amount);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    event TransferBatch(address indexed from, address indexed to, uint256[] ids, uint256[] amounts);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function safeBatchTransferFrom(address from, address to, uint256[] calldata ids, uint256[] calldata amounts, bytes calldata data) external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function safePhraseTransferFrom(address from, address to, uint256[] calldata phrase, bytes calldata data) external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function balanceOf(address owner, uint256 id) external view returns (uint256);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function balanceOfPhrase(address owner) external view returns (uint256);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function balanceOfBatch(address[] calldata owners, uint256[] calldata ids) external view returns (uint256[] memory);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function retrievePhrase(address owner, uint256 phraseId) external view returns (uint256[] memory);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function setApprovalForAll(address operator, bool approved) external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function isApprovedForAll(address owner, address operator) external view returns (bool);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;In &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;, NFTs are used to represent
crypto-assets, and in this standard together with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3754&#x2F;&quot;&gt;EIP-3754&lt;&#x2F;a&gt;, NFTs
are equipped with utilities. In this standard, the ordering information of a batch
of NFTs is retained and managed through a construct &lt;code&gt;phrase&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;phrase&quot;&gt;Phrase&lt;&#x2F;h3&gt;
&lt;p&gt;A &lt;code&gt;phrase&lt;&#x2F;code&gt; is usually made of a handful of basic characters or an orderred sequence
of unicodes and is able to keep the ordering information in a batch of tokens.
Technically, it is stored in an array of unsigned integers, and is not supposed
to be disseminated. A phrase does not increase or decrease the amount of any NFT
in anyway. A phrase cannot be transferred, however, it can be retrieved and
decoded to restore the original sequence of unicodes. The phrase information
is kept in storage and hence additional storage than &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; is required.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3754&#x2F;&quot;&gt;EIP-3754&lt;&#x2F;a&gt; is the pre-requisite to this standard.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;https:&#x2F;&#x2F;github.com&#x2F;simontianx&#x2F;ERC4341&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Account Abstraction Using Alt Mempool</title>
        <published>2021-09-29T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	<author>
		<name>Yoav Weiss</name><uri>https://github.com/yoavw</uri>
	</author>
	
	<author>
		<name>Dror Tirosh</name><uri>https://github.com/drortirosh</uri>
	</author>
	
	<author>
		<name>Shahaf Nacson</name><uri>https://github.com/shahafn</uri>
	</author>
	
	<author>
		<name>Alex Forshtat</name><uri>https://github.com/forshtat</uri>
	</author>
	
	<author>
		<name>Kristof Gazso</name><uri>https://github.com/kristofgazso</uri>
	</author>
	
	<author>
		<name>Tjaden Hess</name><uri>https://github.com/tjade273</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4337/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-4337-account-abstraction-via-entry-point-contract-specification/7160" />
        

        <id>https://wg-eips.ritovision.com/4337/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:4337"
            label="ERC-4337" />
        

        
        

        
        <summary type="html">Account abstraction without consensus-layer protocol changes, instead relying on higher-layer infrastructure.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4337/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;An account abstraction proposal which completely avoids the need for consensus-layer protocol changes. Instead of adding new protocol features and changing the bottom-layer transaction type, this proposal instead introduces a higher-layer pseudo-transaction object called a &lt;code&gt;UserOperation&lt;&#x2F;code&gt;. Users send &lt;code&gt;UserOperation&lt;&#x2F;code&gt; objects into a separate mempool. A special class of actor called bundlers package up a set of these objects into a transaction making a &lt;code&gt;handleOps&lt;&#x2F;code&gt; call to a special contract, and that transaction then gets included in a block.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Historically, introducing Account Abstraction has been a long-standing goal of the Ethereum protocol.
A number of proposals have been thoroughly discussed, but so far none of them have been implemented in the protocol.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal takes a different approach, avoiding any adjustments to the consensus layer. It seeks to achieve the following goals:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Achieve the key goal of Account Abstraction&lt;&#x2F;strong&gt;: allow users to use Smart Contract Accounts containing arbitrary verification logic instead of EOAs as their primary account. Completely remove any need at all for users to also have EOAs,
as required by both status quo Smart Contract Accounts and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Decentralization&lt;&#x2F;strong&gt;
&lt;ul&gt;
&lt;li&gt;Allow any bundler (think: block builder) to participate in the process of including account-abstracted &lt;code&gt;UserOperations&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Work with all activity happening over a public mempool; users do not need to know the direct communication addresses (eg. IP, onion) of any specific actors&lt;&#x2F;li&gt;
&lt;li&gt;Avoid trust assumptions on bundlers&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Do not require any Ethereum consensus changes&lt;&#x2F;strong&gt;: Ethereum consensus layer development is focusing on scalability-oriented features, and there may not be any opportunity for further protocol changes for a long time. Hence, to increase the chance of faster adoption, this proposal avoids Ethereum consensus changes.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Support other use cases&lt;&#x2F;strong&gt;
&lt;ul&gt;
&lt;li&gt;Privacy-preserving applications&lt;&#x2F;li&gt;
&lt;li&gt;Atomic multi-operations (similar goal to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;Pay tx fees with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens, allow developers to pay fees for their users, and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt;-like &lt;strong&gt;sponsored transaction&lt;&#x2F;strong&gt; use cases more generally&lt;&#x2F;li&gt;
&lt;li&gt;abstracting the validation allows the contract to use different signature schemes, multisig configuration, custom recovery, and more.&lt;&#x2F;li&gt;
&lt;li&gt;abstracting gas payments allows easy onboarding by 3rd party payments, paying with tokens, cross-chain gas payments&lt;&#x2F;li&gt;
&lt;li&gt;abstracting execution allows bundled transactions&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;UserOperation&lt;&#x2F;strong&gt; - a structure that describes a transaction to be sent on behalf of a user. To avoid confusion, it is not named &quot;transaction&quot;.
&lt;ul&gt;
&lt;li&gt;Like a transaction, it contains &lt;code&gt;to&lt;&#x2F;code&gt;, &lt;code&gt;calldata&lt;&#x2F;code&gt;, &lt;code&gt;maxFeePerGas&lt;&#x2F;code&gt;, &lt;code&gt;maxPriorityFeePerGas&lt;&#x2F;code&gt;, &lt;code&gt;nonce&lt;&#x2F;code&gt;, &lt;code&gt;signature&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Unlike a transaction, it contains several other fields, described below.&lt;&#x2F;li&gt;
&lt;li&gt;Notably, the &lt;code&gt;signature&lt;&#x2F;code&gt; field usage is not defined by the protocol, but by the Smart Contract Account implementation.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Sender&lt;&#x2F;strong&gt; - the Smart Contract Account sending a &lt;code&gt;UserOperation&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;EntryPoint&lt;&#x2F;strong&gt; - a singleton contract to execute bundles of &lt;code&gt;UserOperations&lt;&#x2F;code&gt;. Bundlers should whitelist the supported &lt;code&gt;EntryPoint&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Bundler&lt;&#x2F;strong&gt; - a node (block builder) that can handle &lt;code&gt;UserOperations&lt;&#x2F;code&gt;,
create a valid &lt;code&gt;entryPoint.handleOps()&lt;&#x2F;code&gt; transaction,
and add it to the block while it is still valid.
This can be achieved by a number of ways:
&lt;ul&gt;
&lt;li&gt;Bundler can act as a block builder itself.&lt;&#x2F;li&gt;
&lt;li&gt;If the bundler is not a block builder, it should work with the block builder through an infrastructure such as &lt;code&gt;mev-boost&lt;&#x2F;code&gt;, or any other kind of proposer-builder separation.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Paymaster&lt;&#x2F;strong&gt; - a helper contract that agrees to pay for the transaction, instead of the sender itself.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Factory&lt;&#x2F;strong&gt; - a helper contract that performs a deployment for a new &lt;code&gt;sender&lt;&#x2F;code&gt; contract if necessary.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Aggregator&lt;&#x2F;strong&gt; - also known as &quot;authorizer contract&quot; - a contract that enables multiple &lt;code&gt;UserOperations&lt;&#x2F;code&gt; to share a single validation. The full design of such contracts is outside the scope of this proposal.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Canonical &lt;code&gt;UserOperation&lt;&#x2F;code&gt; mempool&lt;&#x2F;strong&gt; - a decentralized permissionless P2P network where bundlers exchange &lt;code&gt;UserOperations&lt;&#x2F;code&gt; that are valid and conform with the same shared set of rules applied to the validation code. The full specification of such rules is outside the scope of this proposal.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Alternative &lt;code&gt;UserOperation&lt;&#x2F;code&gt; mempool&lt;&#x2F;strong&gt; - any other P2P mempool where the validity of &lt;code&gt;UserOperations&lt;&#x2F;code&gt; is determined by rules that are different from the shared set of rules, applied to the validation code, in any way.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Deposit&lt;&#x2F;strong&gt; - an amount of Ether (or any L2 native currency) that a &lt;code&gt;Sender&lt;&#x2F;code&gt; or &lt;code&gt;Paymaster&lt;&#x2F;code&gt; contract has transferred to the &lt;code&gt;EntryPoint&lt;&#x2F;code&gt; contract intended to pay gas costs of the future &lt;code&gt;UserOperations&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;the-useroperation-structure&quot;&gt;The &lt;code&gt;UserOperation&lt;&#x2F;code&gt; structure&lt;&#x2F;h3&gt;
&lt;p&gt;To avoid Ethereum consensus changes, we do not attempt to create new transaction types for account-abstracted transactions. Instead, users package up the action they want their Smart Contract Account to take in a struct named &lt;code&gt;UserOperation&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Field&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;sender&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;address&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The Account making the &lt;code&gt;UserOperation&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;nonce&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint256&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Anti-replay parameter (see &quot;Semi-abstracted Nonce Support&quot; )&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;factory&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;address&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Account Factory for new Accounts OR &lt;code&gt;0x7702&lt;&#x2F;code&gt; flag for EIP-7702 Accounts, otherwise &lt;code&gt;address(0)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;factoryData&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;bytes&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;data for the Account Factory if &lt;code&gt;factory&lt;&#x2F;code&gt; is provided OR EIP-7702 initialization data, or empty array&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;callData&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;bytes&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The data to pass to the &lt;code&gt;sender&lt;&#x2F;code&gt; during the main execution call&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;callGasLimit&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint256&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The amount of gas to allocate the main execution call&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;verificationGasLimit&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint256&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The amount of gas to allocate for the verification step&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;preVerificationGas&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint256&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Extra gas to pay the bundler&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;maxFeePerGas&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint256&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Maximum fee per gas (similar to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; &lt;code&gt;max_fee_per_gas&lt;&#x2F;code&gt;)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;maxPriorityFeePerGas&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint256&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Maximum priority fee per gas (similar to EIP-1559 &lt;code&gt;max_priority_fee_per_gas&lt;&#x2F;code&gt;)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;paymaster&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;address&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Address of paymaster contract, (or empty, if the &lt;code&gt;sender&lt;&#x2F;code&gt; pays for gas by itself)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;paymasterVerificationGasLimit&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint256&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The amount of gas to allocate for the paymaster validation code (only if paymaster exists)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;paymasterPostOpGasLimit&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint256&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The amount of gas to allocate for the paymaster post-operation code (only if paymaster exists)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;paymasterData&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;bytes&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Data for paymaster (only if paymaster exists)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;signature&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;bytes&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Data passed into the &lt;code&gt;sender&lt;&#x2F;code&gt; to verify authorization&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Users send &lt;code&gt;UserOperation&lt;&#x2F;code&gt; objects to a dedicated &lt;code&gt;UserOperation&lt;&#x2F;code&gt; mempool.&lt;&#x2F;p&gt;
&lt;p&gt;To prevent replay attacks, either cross-chain or with multiple &lt;code&gt;EntryPoint&lt;&#x2F;code&gt; contract versions,
the &lt;code&gt;signature&lt;&#x2F;code&gt; MUST depend on &lt;code&gt;chainid&lt;&#x2F;code&gt; and the &lt;code&gt;EntryPoint&lt;&#x2F;code&gt; address.&lt;&#x2F;p&gt;
&lt;p&gt;Note that one &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; &quot;authorization tuple&quot; value can be provided alongside the &lt;code&gt;UserOperation&lt;&#x2F;code&gt; struct,
but &quot;authorization tuples&quot; are not included in the &lt;code&gt;UserOperation&lt;&#x2F;code&gt; itself.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;entrypoint-interface&quot;&gt;&lt;code&gt;EntryPoint&lt;&#x2F;code&gt; interface&lt;&#x2F;h3&gt;
&lt;p&gt;When passed on-chain, to the &lt;code&gt;EntryPoint&lt;&#x2F;code&gt; contract, the &lt;code&gt;Account&lt;&#x2F;code&gt; and the &lt;code&gt;Paymaster&lt;&#x2F;code&gt;, a &quot;packed&quot; version of the above structure called &lt;code&gt;PackedUserOperation&lt;&#x2F;code&gt; is used:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Field&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;sender&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;address&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;nonce&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint256&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;initCode&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;bytes&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;concatenation of factory address and factoryData (or empty), or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;#support-for-eip-7702-authorizations&quot;&gt;EIP-7702 data&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;callData&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;bytes&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;accountGasLimits&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;bytes32&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;concatenation of verificationGasLimit (16 bytes) and callGasLimit (16 bytes)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;preVerificationGas&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint256&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;gasFees&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;bytes32&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;concatenation of maxPriorityFeePerGas (16 bytes) and maxFeePerGas (16 bytes)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;paymasterAndData&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;bytes&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;concatenation of paymaster fields (or empty)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;signature&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;bytes&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The core interface of the &lt;code&gt;EntryPoint&lt;&#x2F;code&gt; contract is as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; handleOps&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;PackedUserOperation&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ops&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; beneficiary&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;beneficiary&lt;&#x2F;code&gt; is the address that will be paid with all the gas fees collected during the execution of the bundle.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;smart-contract-account-interface&quot;&gt;Smart Contract Account Interface&lt;&#x2F;h3&gt;
&lt;p&gt;The core interface required for the Smart Contract Account to have is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IAccount&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validateUserOp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;PackedUserOperation&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; userOp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; userOpHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; missingAccountFunds&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; validationData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;userOpHash&lt;&#x2F;code&gt; is a hash over the &lt;code&gt;userOp&lt;&#x2F;code&gt; (except &lt;code&gt;signature&lt;&#x2F;code&gt;), &lt;code&gt;entryPoint&lt;&#x2F;code&gt; and &lt;code&gt;chainId&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The Smart Contract Account:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;MUST validate the caller is a trusted &lt;code&gt;EntryPoint&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;MUST validate that the signature is a valid signature of the &lt;code&gt;userOpHash&lt;&#x2F;code&gt;, and
SHOULD return &lt;code&gt;SIG_VALIDATION_FAILED&lt;&#x2F;code&gt; (&lt;code&gt;1&lt;&#x2F;code&gt;) without reverting on signature mismatch. Any other error MUST revert.&lt;&#x2F;li&gt;
&lt;li&gt;SHOULD not return early when returning &lt;code&gt;SIG_VALIDATION_FAILED&lt;&#x2F;code&gt; (&lt;code&gt;1&lt;&#x2F;code&gt;). Instead, it SHOULD complete the normal flow to enable performing a gas estimation for the validation function.&lt;&#x2F;li&gt;
&lt;li&gt;MUST pay the &lt;code&gt;EntryPoint&lt;&#x2F;code&gt; (caller) at least the &lt;code&gt;missingAccountFunds&lt;&#x2F;code&gt; (which might be zero, in case the current &lt;code&gt;sender&lt;&#x2F;code&gt;&#x27;s deposit is sufficient)&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;sender&lt;&#x2F;code&gt; MAY pay more than this minimum to cover future transactions. It can also call &lt;code&gt;withdrawTo&lt;&#x2F;code&gt; to retrieve it later at any time.&lt;&#x2F;li&gt;
&lt;li&gt;The return value MUST be packed of &lt;code&gt;aggregator&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;authorizer&lt;&#x2F;code&gt;, &lt;code&gt;validUntil&lt;&#x2F;code&gt; and &lt;code&gt;validAfter&lt;&#x2F;code&gt; timestamps.
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;aggregator&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;authorizer&lt;&#x2F;code&gt; - 0 for valid signature, 1 to mark signature failure. Otherwise, an address of an &lt;code&gt;aggregator&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;authorizer&lt;&#x2F;code&gt; contract.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;validUntil&lt;&#x2F;code&gt; is 6-byte timestamp value, or zero for &quot;infinite&quot;. The &lt;code&gt;UserOperation&lt;&#x2F;code&gt; is valid only up to this time.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;validAfter&lt;&#x2F;code&gt; is 6-byte timestamp. The &lt;code&gt;UserOperation&lt;&#x2F;code&gt; is valid only after this time.&lt;&#x2F;li&gt;
&lt;li&gt;In order to specify a validity range using block numbers, both the &lt;code&gt;validUntil&lt;&#x2F;code&gt; and &lt;code&gt;validAfter&lt;&#x2F;code&gt; need to set their highest bit to 1.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Note:&lt;&#x2F;strong&gt; The validity range can be expressed by two block timestamps or two block numbers, but one timestamp and one block number cannot be mixed in the same UserOperation&#x27;s validity range.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The Smart Contract Account MAY implement the interface &lt;code&gt;IAccountExecute&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IAccountExecute&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; executeUserOp&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;PackedUserOperation&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; userOp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; userOpHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This method will be called by the &lt;code&gt;EntryPoint&lt;&#x2F;code&gt; with the current UserOperation, instead of executing the &lt;code&gt;callData&lt;&#x2F;code&gt; itself directly on the &lt;code&gt;sender&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;semi-abstracted-nonce-support&quot;&gt;Semi-abstracted Nonce Support&lt;&#x2F;h3&gt;
&lt;p&gt;In Ethereum protocol, the sequential transaction &lt;code&gt;nonce&lt;&#x2F;code&gt; value is used as a replay protection method as well as to
determine the valid order of transaction being included in blocks.&lt;&#x2F;p&gt;
&lt;p&gt;It also contributes to the transaction hash uniqueness, as a transaction by the same sender with the same
nonce may not be included in the chain twice.&lt;&#x2F;p&gt;
&lt;p&gt;However, requiring a single sequential &lt;code&gt;nonce&lt;&#x2F;code&gt; value is limiting to the senders&#x27; ability to define their custom logic
with regard to transaction ordering and replay protection.&lt;&#x2F;p&gt;
&lt;p&gt;Instead of sequential &lt;code&gt;nonce&lt;&#x2F;code&gt; we implement a nonce mechanism that uses a single &lt;code&gt;uint256&lt;&#x2F;code&gt; nonce value in the &lt;code&gt;UserOperation&lt;&#x2F;code&gt;,
but treats it as two values:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;192-bit &quot;key&quot;&lt;&#x2F;li&gt;
&lt;li&gt;64-bit &quot;sequence&quot;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;These values are represented on-chain in the &lt;code&gt;EntryPoint&lt;&#x2F;code&gt; contract.
We define the following method in the &lt;code&gt;EntryPoint&lt;&#x2F;code&gt; interface to expose these values:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getNonce&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint192&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;For each &lt;code&gt;key&lt;&#x2F;code&gt; the &lt;code&gt;sequence&lt;&#x2F;code&gt; is validated by the &lt;code&gt;EntryPoint&lt;&#x2F;code&gt; for each UserOperation.
If the nonce validation fails the &lt;code&gt;UserOperation&lt;&#x2F;code&gt; is considered invalid and the bundle is reverted.
The &lt;code&gt;sequence&lt;&#x2F;code&gt; value is incremented sequentially and monotonically for the &lt;code&gt;sender&lt;&#x2F;code&gt; for each UserOperation.
A new &lt;code&gt;key&lt;&#x2F;code&gt; can be introduced with an arbitrary value at any point, with its &lt;code&gt;sequence&lt;&#x2F;code&gt; starting at &lt;code&gt;0&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This approach maintains the guarantee of &lt;code&gt;UserOperation&lt;&#x2F;code&gt; hash uniqueness on-chain on the protocol level while allowing
Accounts to implement any custom logic they may need operating on a 192-bit &quot;key&quot; field, while fitting the 32 byte word.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;reading-and-validating-the-nonce&quot;&gt;Reading and validating the nonce&lt;&#x2F;h4&gt;
&lt;p&gt;When preparing the &lt;code&gt;UserOperation&lt;&#x2F;code&gt; bundlers may make a view call to this method to determine a valid value for the &lt;code&gt;nonce&lt;&#x2F;code&gt; field.&lt;&#x2F;p&gt;
&lt;p&gt;Bundler&#x27;s validation of a &lt;code&gt;UserOperation&lt;&#x2F;code&gt; SHOULD start with &lt;code&gt;getNonce&lt;&#x2F;code&gt; to ensure the transaction has a valid &lt;code&gt;nonce&lt;&#x2F;code&gt; field.&lt;&#x2F;p&gt;
&lt;p&gt;If the bundler is willing to accept multiple &lt;code&gt;UserOperations&lt;&#x2F;code&gt; by the same sender into their mempool,
this bundler is supposed to track the &lt;code&gt;key&lt;&#x2F;code&gt; and &lt;code&gt;sequence&lt;&#x2F;code&gt; pair of the &lt;code&gt;UserOperations&lt;&#x2F;code&gt; already added in the mempool.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;usage-examples&quot;&gt;Usage examples&lt;&#x2F;h4&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Classic sequential nonce.&lt;&#x2F;p&gt;
&lt;p&gt;In order to require the Account to have classic, sequential nonce, the validation function MUST perform:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;userOp&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Ordered administrative events&lt;&#x2F;p&gt;
&lt;p&gt;In some cases, an account may need to have an &quot;administrative&quot; channel of operations running in parallel to normal
operations.&lt;&#x2F;p&gt;
&lt;p&gt;In this case, the account may use a specific &lt;code&gt;key&lt;&#x2F;code&gt; when calling methods on the account itself:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span&gt; sig &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes4&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;userOp&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;callData&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; :&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt; key &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; userOp&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;nonce &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 64&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;sig &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; ADMIN_METHODSIG&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;key &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; ADMIN_KEY&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;wrong nonce-key for admin operation&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;key &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;wrong nonce-key for normal operation&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;required-entrypoint-contract-functionality&quot;&gt;Required &lt;code&gt;EntryPoint&lt;&#x2F;code&gt; contract functionality&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;EntryPoint&lt;&#x2F;code&gt; method is &lt;code&gt;handleOps&lt;&#x2F;code&gt;, which handles an array of &lt;code&gt;UserOperations&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;EntryPoint&lt;&#x2F;code&gt;&#x27;s &lt;code&gt;handleOps&lt;&#x2F;code&gt; function must perform the following steps (we first describe the simpler non-paymaster case). It must make two loops, the &lt;strong&gt;verification loop&lt;&#x2F;strong&gt; and the &lt;strong&gt;execution loop&lt;&#x2F;strong&gt;.
In the verification loop, the &lt;code&gt;handleOps&lt;&#x2F;code&gt; call must perform the following steps for each &lt;code&gt;UserOperation&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Create the &lt;code&gt;sender&lt;&#x2F;code&gt; Smart Contract Account if it does not yet exist&lt;&#x2F;strong&gt;, using the &lt;code&gt;initcode&lt;&#x2F;code&gt; provided in the &lt;code&gt;UserOperation&lt;&#x2F;code&gt;.
&lt;ul&gt;
&lt;li&gt;If the &lt;code&gt;factory&lt;&#x2F;code&gt; address is &quot;0x7702&quot;, then the sender MUST be an EOA with an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; authorization designation. The &lt;code&gt;EntryPoint&lt;&#x2F;code&gt; validates the authorized address matches the one specified in the &lt;code&gt;UserOperation&lt;&#x2F;code&gt; signature (see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;#support-for-eip-7702-authorizations&quot;&gt;Support for [EIP-7702] authorizations&lt;&#x2F;a&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;If the &lt;code&gt;sender&lt;&#x2F;code&gt; does not exist, &lt;em&gt;and&lt;&#x2F;em&gt; the &lt;code&gt;initcode&lt;&#x2F;code&gt; is empty, or does not deploy a contract at the &quot;sender&quot; address, the call must fail.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;WARNING&lt;&#x2F;strong&gt;: If the &lt;code&gt;sender&lt;&#x2F;code&gt; does exist, &lt;em&gt;and&lt;&#x2F;em&gt; the &lt;code&gt;initcode&lt;&#x2F;code&gt; is &lt;em&gt;not&lt;&#x2F;em&gt; empty, then the &lt;code&gt;initcode&lt;&#x2F;code&gt; is ignored.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;calculate the maximum possible fee the &lt;code&gt;sender&lt;&#x2F;code&gt; needs to pay based on validation and call gas limits, and current gas values.&lt;&#x2F;li&gt;
&lt;li&gt;calculate the fee the &lt;code&gt;sender&lt;&#x2F;code&gt; must add to its &quot;deposit&quot; in the &lt;code&gt;EntryPoint&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Call &lt;code&gt;validateUserOp&lt;&#x2F;code&gt; on the &lt;code&gt;sender&lt;&#x2F;code&gt; contract&lt;&#x2F;strong&gt;, passing in the &lt;code&gt;UserOperation&lt;&#x2F;code&gt;, its hash and the required fee.
The Smart Contract Account MUST verify the &lt;code&gt;UserOperation&lt;&#x2F;code&gt;&#x27;s &lt;code&gt;signature&lt;&#x2F;code&gt; parameter, and pay the fee if the &lt;code&gt;sender&lt;&#x2F;code&gt; considers the &lt;code&gt;UserOperation&lt;&#x2F;code&gt; valid. If any &lt;code&gt;validateUserOp&lt;&#x2F;code&gt; call fails, &lt;code&gt;handleOps&lt;&#x2F;code&gt; must skip execution of at least that &lt;code&gt;UserOperation&lt;&#x2F;code&gt;, and may revert entirely.&lt;&#x2F;li&gt;
&lt;li&gt;Validate the account&#x27;s deposit in the &lt;code&gt;EntryPoint&lt;&#x2F;code&gt; is high enough to cover the max possible cost (cover the already-done verification and max execution gas)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In the execution loop, the &lt;code&gt;handleOps&lt;&#x2F;code&gt; call must perform the following steps for each &lt;code&gt;UserOperation&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Call the account with the &lt;code&gt;UserOperation&lt;&#x2F;code&gt;&#x27;s calldata&lt;&#x2F;strong&gt;. It&#x27;s up to the account to choose how to parse the calldata; an expected workflow is for the account to have an &lt;code&gt;execute&lt;&#x2F;code&gt; function that parses the remaining calldata as a series of one or more calls that the account should make.&lt;&#x2F;li&gt;
&lt;li&gt;If the calldata starts with the methodsig &lt;code&gt;IAccountExecute.executeUserOp&lt;&#x2F;code&gt;, then the &lt;code&gt;EntryPoint&lt;&#x2F;code&gt; must build a calldata by encoding &lt;code&gt;executeUserOp(userOp,userOpHash)&lt;&#x2F;code&gt; and call the account using that calldata.&lt;&#x2F;li&gt;
&lt;li&gt;After the call, refund the account&#x27;s deposit with the excess gas cost that was pre-charged.&lt;br &#x2F;&gt;
A penalty of &lt;code&gt;10%&lt;&#x2F;code&gt; (&lt;code&gt;UNUSED_GAS_PENALTY_PERCENT&lt;&#x2F;code&gt;) is applied on the amounts of &lt;code&gt;callGasLimit&lt;&#x2F;code&gt; and &lt;code&gt;paymasterPostOpGasLimit&lt;&#x2F;code&gt; gas that remains &lt;strong&gt;unused&lt;&#x2F;strong&gt;.&lt;br &#x2F;&gt;
This penalty is only applied if the amount of the remaining unused gas is greater than or equal &lt;code&gt;40000&lt;&#x2F;code&gt; (&lt;code&gt;PENALTY_GAS_THRESHOLD&lt;&#x2F;code&gt;).&lt;br &#x2F;&gt;
This penalty is necessary to prevent the &lt;code&gt;UserOperations&lt;&#x2F;code&gt; from reserving large parts of the gas space in the bundle but leaving it unused and preventing the bundler from including other &lt;code&gt;UserOperations&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;After the execution of all calls, pay the collected fees from all &lt;code&gt;UserOperations&lt;&#x2F;code&gt; to the &lt;code&gt;beneficiary&lt;&#x2F;code&gt; address provided by the bundler.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;.&#x2F;assets&#x2F;bundle-seq.svg&quot; alt=&quot;&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Before accepting a &lt;code&gt;UserOperation&lt;&#x2F;code&gt;, bundlers SHOULD use an RPC method to locally call the &lt;code&gt;handleOps&lt;&#x2F;code&gt; function on the &lt;code&gt;EntryPoint&lt;&#x2F;code&gt;,
to verify that the signature is correct and the &lt;code&gt;UserOperation&lt;&#x2F;code&gt; actually pays fees; see the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;#useroperation-simulation&quot;&gt;Simulation section below&lt;&#x2F;a&gt; for details.
A node&#x2F;bundler MUST reject a &lt;code&gt;UserOperation&lt;&#x2F;code&gt; that fails the validation, meaning not adding it to the local mempool
and not propagating it to other peers.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;json-rpc-api-for-erc-4337&quot;&gt;JSON-RPC API for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;In order to support sending &lt;code&gt;UserOperation&lt;&#x2F;code&gt; objects to bundlers, which in turn propagate them through the P2P mempool,
we introduce a set of JSON-RPC APIs including &lt;code&gt;eth_sendUserOperation&lt;&#x2F;code&gt; and &lt;code&gt;eth_getUserOperationReceipt&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The full definition of the new JSON-RPC API is outside the scope of this proposal.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;support-for-eip-712-signatures&quot;&gt;Support for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; signatures&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;userOpHash&lt;&#x2F;code&gt; is calculated as an [EIP-712] typed message hash with the following parameters:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; TYPE_HASH &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        &amp;quot;EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; PACKED_USEROP_TYPEHASH &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        &amp;quot;PackedUserOperation(address sender,uint256 nonce,bytes initCode,bytes callData,bytes32 accountGasLimits,uint256 preVerificationGas,bytes32 gasFees,bytes paymasterAndData)&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;support-for-eip-7702-authorizations&quot;&gt;Support for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; authorizations&lt;&#x2F;h3&gt;
&lt;p&gt;On networks with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; enabled, the &lt;code&gt;eth_sendUserOperation&lt;&#x2F;code&gt; method accepts an extra &lt;code&gt;eip7702Auth&lt;&#x2F;code&gt; parameter.
If this parameter is set, it MUST be a valid &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; authorization tuple, and signed by the &lt;code&gt;sender&lt;&#x2F;code&gt; address.
The bundler MUST add all required &lt;code&gt;eip7702Auth&lt;&#x2F;code&gt; of all &lt;code&gt;UserOperations&lt;&#x2F;code&gt; in a bundle to the &lt;code&gt;authorizationList&lt;&#x2F;code&gt; and execute
the bundle using a transaction type &lt;code&gt;SET_CODE_TX_TYPE&lt;&#x2F;code&gt;.
Additionally, the &lt;code&gt;UserOperation&lt;&#x2F;code&gt; hash calculation is updated to include the desired &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; delegation address.&lt;&#x2F;p&gt;
&lt;p&gt;If the &lt;code&gt;initCode&lt;&#x2F;code&gt; field starts with &lt;code&gt;0x7702&lt;&#x2F;code&gt; right-padded with 18 zeros, and this account was deployed using an EIP-7702 transaction, then the hash is calculated as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;For the purpose of hash calculation, the first 20 bytes of the &lt;code&gt;initCode&lt;&#x2F;code&gt; field of the &lt;code&gt;UserOperation&lt;&#x2F;code&gt; are set to account&#x27;s EIP-7702 delegate address (fetched with EXTCODECOPY)&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;initCode&lt;&#x2F;code&gt; is not used to call a factory contract.&lt;&#x2F;li&gt;
&lt;li&gt;If the &lt;code&gt;initCode&lt;&#x2F;code&gt; is longer than 20 bytes, then the rest of the initCode is used to call an initialization function in the account itself.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note that a &lt;code&gt;UserOperation&lt;&#x2F;code&gt; may still be executed without such &lt;code&gt;initCode&lt;&#x2F;code&gt;.
In this case the &lt;code&gt;EntryPoint&lt;&#x2F;code&gt; doesn&#x27;t hash the current &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702 delegate&lt;&#x2F;a&gt;, and can be potentially executed against a modified account.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, EIP-7702 defines the gas cost of executing an authorization equal to &lt;code&gt;PER_EMPTY_ACCOUNT_COST = 25000&lt;&#x2F;code&gt;.
This gas consumption is not observable on-chain by the &lt;code&gt;EntryPoint&lt;&#x2F;code&gt; contract and MUST be included in the &lt;code&gt;preVerificationGas&lt;&#x2F;code&gt; value.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;extension-paymasters&quot;&gt;Extension: paymasters&lt;&#x2F;h3&gt;
&lt;p&gt;We extend the &lt;code&gt;EntryPoint&lt;&#x2F;code&gt; logic to support &lt;strong&gt;paymasters&lt;&#x2F;strong&gt; that can sponsor transactions for other users. This feature can be used to allow application developers to subsidize fees for their users, allow users to pay fees with [ERC-20] tokens and many other use cases. When the &lt;code&gt;paymasterAndData&lt;&#x2F;code&gt; field in the &lt;code&gt;UserOperation&lt;&#x2F;code&gt; is not empty, the &lt;code&gt;EntryPoint&lt;&#x2F;code&gt; implements a different flow for that UserOperation:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;.&#x2F;assets&#x2F;bundle-seq-pm.svg&quot; alt=&quot;&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;During the verification loop, in addition to calling &lt;code&gt;validateUserOp&lt;&#x2F;code&gt;, the &lt;code&gt;handleOps&lt;&#x2F;code&gt; execution also must check that the paymaster has enough ETH deposited with the &lt;code&gt;EntryPoint&lt;&#x2F;code&gt; to pay for the &lt;code&gt;UserOperation&lt;&#x2F;code&gt;, and then call &lt;code&gt;validatePaymasterUserOp&lt;&#x2F;code&gt; on the paymaster to verify that the paymaster is willing to pay for the &lt;code&gt;UserOperation&lt;&#x2F;code&gt;. Note that in this case, the &lt;code&gt;validateUserOp&lt;&#x2F;code&gt; is called with a &lt;code&gt;missingAccountFunds&lt;&#x2F;code&gt; of 0 to reflect that the account&#x27;s deposit is not used for payment for this &lt;code&gt;UserOperation&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;If the paymaster&#x27;s &lt;code&gt;validatePaymasterUserOp&lt;&#x2F;code&gt; returns a non-empty &lt;code&gt;context&lt;&#x2F;code&gt; byte array, then &lt;code&gt;handleOps&lt;&#x2F;code&gt; must call &lt;code&gt;postOp&lt;&#x2F;code&gt; on the paymaster after making the main execution call.
Otherwise, no call is done to the &lt;code&gt;postOp&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;p&gt;Maliciously crafted paymasters could pose a risk of a DoS attack against the system and bundlers should take steps to mitigate it.
As a mitigation, bundlers should use a reputation system for contracts they serve, and the paymaster must either limit its storage usage, or deposit a stake in a reputation system.
Full specification of a reputation system is outside the scope of this proposal.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;the-paymasteranddata-field-encoding-and-paymastersignature&quot;&gt;The &lt;code&gt;paymasterAndData&lt;&#x2F;code&gt; field encoding and &lt;code&gt;paymasterSignature&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;paymasterAndData&lt;&#x2F;code&gt; field is a byte array that contains a non-standard encoding of the following fields:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;paymasterAddress&lt;&#x2F;code&gt; - 20 bytes — the address of the paymaster contract&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;paymasterVerificationGasLimit&lt;&#x2F;code&gt; - 16 bytes - the gas limit for the verification function&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;postOpGasLimit&lt;&#x2F;code&gt; - 16 bytes - the gas limit for the postOp function&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;paymasterData&lt;&#x2F;code&gt; - the data that the paymaster contract will receive in the &lt;code&gt;validatePaymasterUserOp&lt;&#x2F;code&gt; call&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The following data can optionally be appended to the &lt;code&gt;paymasterAndData&lt;&#x2F;code&gt; field:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;paymasterSignature&lt;&#x2F;code&gt; - the &quot;signature&quot; value byte array to be checked by the paymaster contract; this value can be provided &lt;strong&gt;without affecting the UserOperation hash&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;paymasterSignatureLength&lt;&#x2F;code&gt; - 2 bytes - the exact length of the &lt;code&gt;paymasterSignature&lt;&#x2F;code&gt; parameter byte array&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;PAYMASTER_SIG_MAGIC&lt;&#x2F;code&gt; (&lt;code&gt;0x22e325a297439656&lt;&#x2F;code&gt;) - the magic value that is appended to indicate the use of the &lt;code&gt;paymasterSignature&lt;&#x2F;code&gt; feature by the UserOperation&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note that as both the &lt;code&gt;signature&lt;&#x2F;code&gt; and the &lt;code&gt;paymasterSignature&lt;&#x2F;code&gt; fields do not affect the UserOperation hash, the signing by the Sender and the Paymaster can be performed in parallel.&lt;&#x2F;p&gt;
&lt;p&gt;The paymaster interface is as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validatePaymasterUserOp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;PackedUserOperation&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; userOp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; userOpHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; maxCost&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; context&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; validationData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; postOp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;PostOpMode&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mode&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; context&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; actualGasCost&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; actualUserOpFeePerGas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PostOpMode&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;    opSucceeded&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; UserOperation succeeded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;    opReverted&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; UserOperation reverted. paymaster still has to pay for gas.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;EntryPoint&lt;&#x2F;code&gt; must implement the following API to let entities like paymasters have a stake, and thus have more flexibility in their storage access.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; add a stake to the calling entity&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addStake&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _unstakeDelaySec&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; unlock the stake (must wait unstakeDelay before can withdraw)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; unlockStake&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; withdraw the unlocked stake&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; withdrawStake&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; withdrawAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The paymaster must also have a deposit, which the &lt;code&gt;EntryPoint&lt;&#x2F;code&gt; will charge &lt;code&gt;UserOperation&lt;&#x2F;code&gt; costs from.
The deposit (for paying gas fees) is separate from the stake (which is locked).&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;EntryPoint&lt;&#x2F;code&gt; must implement the following interface to allow Paymasters (and optionally Accounts) to manage their deposit:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; return the deposit of an account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; add to the deposit of the given account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; depositTo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; add to the deposit of the calling account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;receive&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; withdraw from the deposit of the current account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; withdrawTo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; withdrawAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; withdrawAmount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; get the currently executing UserOperation hash, or 0 if not called during the execution&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getCurrentUserOpHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;bundler-behavior-upon-receiving-a-useroperation&quot;&gt;Bundler behavior upon receiving a UserOperation&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;.&#x2F;assets&#x2F;bundle-build-full-seq.svg&quot; alt=&quot;&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Similar to an Ethereum transaction, the offchain flow of a &lt;code&gt;UserOperation&lt;&#x2F;code&gt; can be described as follows:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Client sends a &lt;code&gt;UserOperation&lt;&#x2F;code&gt; to the bundler through an RPC call &lt;code&gt;eth_sendUserOperation&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Before including the &lt;code&gt;UserOperation&lt;&#x2F;code&gt; in the mempool, the bundler runs the &lt;em&gt;first validation&lt;&#x2F;em&gt; of the newly received UserOperation. If the &lt;code&gt;UserOperation&lt;&#x2F;code&gt; fails validation, the bundler drops it and returns an error in response to &lt;code&gt;eth_sendUserOperation&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Later, once building a bundle, the bundler takes &lt;code&gt;UserOperations&lt;&#x2F;code&gt; from the mempool and runs the &lt;em&gt;second validation&lt;&#x2F;em&gt; of a single &lt;code&gt;UserOperation&lt;&#x2F;code&gt; on each of them. If it succeeds, it is scheduled for inclusion in the next bundle, and dropped otherwise.&lt;&#x2F;li&gt;
&lt;li&gt;Before submitting the new bundle onchain, the bundler performs the &lt;em&gt;third validation&lt;&#x2F;em&gt; of the entire &lt;code&gt;UserOperations&lt;&#x2F;code&gt; bundle. If any of the &lt;code&gt;UserOperations&lt;&#x2F;code&gt; fail validation, the bundler drops them. The bundler should keep track of the peers&#x27; reputation. The full design of such a reputation system is outside the scope of this proposal.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;When a bundler receives a &lt;code&gt;UserOperation&lt;&#x2F;code&gt;, it must first run some basic sanity checks, namely that:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Either the &lt;code&gt;sender&lt;&#x2F;code&gt; is an existing contract, or the &lt;code&gt;initCode&lt;&#x2F;code&gt; is not empty (but not both)&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;initCode&lt;&#x2F;code&gt; is not empty, parse its first 20 bytes as a factory address or an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; flag.&lt;br &#x2F;&gt;
Record whether the factory is staked, in case the later simulation indicates that it needs to be. If the factory accesses the global state, it must be staked.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;verificationGasLimit&lt;&#x2F;code&gt; and &lt;code&gt;paymasterVerificationGasLimits&lt;&#x2F;code&gt; are lower than &lt;code&gt;MAX_VERIFICATION_GAS&lt;&#x2F;code&gt; (&lt;code&gt;500000&lt;&#x2F;code&gt;) and the &lt;code&gt;preVerificationGas&lt;&#x2F;code&gt; is high enough to pay for the calldata gas cost of serializing the &lt;code&gt;UserOperation&lt;&#x2F;code&gt; plus &lt;code&gt;PRE_VERIFICATION_OVERHEAD_GAS&lt;&#x2F;code&gt; (&lt;code&gt;50000&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;paymasterAndData&lt;&#x2F;code&gt; is either empty, or starts with the &lt;strong&gt;paymaster&lt;&#x2F;strong&gt; address, which is a contract that (i) currently has nonempty code on chain, (ii) has a sufficient deposit to pay for the UserOperation, and (iii) is not currently banned. During simulation, the paymaster&#x27;s stake is also checked, depending on its storage usage.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;callGasLimit&lt;&#x2F;code&gt; is at least the cost of a &lt;code&gt;CALL&lt;&#x2F;code&gt; with non-zero value.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;maxFeePerGas&lt;&#x2F;code&gt; and &lt;code&gt;maxPriorityFeePerGas&lt;&#x2F;code&gt; are above a configurable minimum value that the bundler is willing to accept. At the minimum, they are sufficiently high to be included with the upcoming &lt;code&gt;block.basefee&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;sender&lt;&#x2F;code&gt; doesn&#x27;t have another &lt;code&gt;UserOperation&lt;&#x2F;code&gt; already present in the mempool (or it replaces an existing entry with the same sender and nonce, with a higher &lt;code&gt;maxPriorityFeePerGas&lt;&#x2F;code&gt; and an equally increased &lt;code&gt;maxFeePerGas&lt;&#x2F;code&gt;).
Only one &lt;code&gt;UserOperation&lt;&#x2F;code&gt; per sender may be included in a single bundle.
A sender is exempt from this rule and may have multiple &lt;code&gt;UserOperations&lt;&#x2F;code&gt; in the mempool and in a bundle if it is staked.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;useroperation-simulation&quot;&gt;UserOperation Simulation&lt;&#x2F;h3&gt;
&lt;p&gt;We define &lt;code&gt;UserOperation&lt;&#x2F;code&gt; simulation, as the offchain view call (or trace call) to the &lt;code&gt;EntryPoint&lt;&#x2F;code&gt; contract with the &lt;code&gt;UserOperation&lt;&#x2F;code&gt;, and the enforcement of the shared set of rules applied to the validation code, as part of the &lt;code&gt;UserOperation&lt;&#x2F;code&gt; validation.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;simulation-rationale&quot;&gt;Simulation Rationale&lt;&#x2F;h4&gt;
&lt;p&gt;To validate a normal Ethereum transaction &lt;code&gt;tx&lt;&#x2F;code&gt;, the bundler performs static checks, like:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;ecrecover(tx.v, tx.r, tx.s)&lt;&#x2F;code&gt; has to return a valid EOA&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;tx.nonce&lt;&#x2F;code&gt; has to be the current nonce of the recovered EOA&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;balance&lt;&#x2F;code&gt; of the recovered EOA has to be sufficient to pay for the transaction&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;tx.gasLimit&lt;&#x2F;code&gt; has to be sufficient to cover the intrinsic gas cost of a transaction&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;chainId&lt;&#x2F;code&gt; has to match the current chain&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;All of these checks do not rely on EVM state, and cannot be affected by other Accounts&#x27; transactions.&lt;&#x2F;p&gt;
&lt;p&gt;In contrast, &lt;code&gt;UserOperation&lt;&#x2F;code&gt; validation rely on EVM state (calls to &lt;code&gt;validateUserOp&lt;&#x2F;code&gt;, &lt;code&gt;validatePaymasterUserOp&lt;&#x2F;code&gt;), can be changed by other &lt;code&gt;UserOperations&lt;&#x2F;code&gt; (or normal Ethereum transactions). Therefore, we introduce simulation as a new mechanism to check its validity.
Intuitively, the aim of the simulation is to ensure the onchain validation code of a &lt;code&gt;UserOperation&lt;&#x2F;code&gt; is sandboxed, isolated from other &lt;code&gt;UserOperations&lt;&#x2F;code&gt; in the same bundle.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;simulation-specification&quot;&gt;Simulation Specification:&lt;&#x2F;h4&gt;
&lt;p&gt;To simulate a &lt;code&gt;UserOperation&lt;&#x2F;code&gt; validation, the bundler makes a view call to the &lt;code&gt;handleOps()&lt;&#x2F;code&gt; method with the &lt;code&gt;UserOperation&lt;&#x2F;code&gt; to check.&lt;&#x2F;p&gt;
&lt;p&gt;Simulation should run only on the validation section of the &lt;code&gt;sender&lt;&#x2F;code&gt; and &lt;code&gt;paymaster&lt;&#x2F;code&gt;, and is not required for the &lt;code&gt;UserOperation&lt;&#x2F;code&gt;&#x27;s execution.
A bundler MAY add second &quot;always failed&quot; &lt;code&gt;UserOperation&lt;&#x2F;code&gt; to the bundle, so that the simulation will
end as soon as the first UserOperation&#x27;s validation complete.&lt;&#x2F;p&gt;
&lt;p&gt;The bundler MUST drop the &lt;code&gt;UserOperation&lt;&#x2F;code&gt; if the simulation reverts&lt;&#x2F;p&gt;
&lt;p&gt;The simulated call performs the full validation, by calling:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;If &lt;code&gt;initCode&lt;&#x2F;code&gt; is present, create the &lt;code&gt;sender&lt;&#x2F;code&gt; Account.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;account.validateUserOp&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;if specified a paymaster: &lt;code&gt;paymaster.validatePaymasterUserOp&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Either &lt;code&gt;sender&lt;&#x2F;code&gt; or &lt;code&gt;paymaster&lt;&#x2F;code&gt; may return a time-range (&lt;code&gt;validAfter&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;validUntil&lt;&#x2F;code&gt;).
The &lt;code&gt;UserOperation&lt;&#x2F;code&gt; MUST be valid at the current time to be considered valid, defined as &lt;code&gt;validAfter&amp;lt;=block.timestamp&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;A bundler MUST drop a &lt;code&gt;UserOperation&lt;&#x2F;code&gt; if it expires too soon and is likely to become invalid before the next block.
To decode the returned time-ranges, the bundler MUST run the validation using tracing, to decode the return value from the &lt;code&gt;validateUserOp&lt;&#x2F;code&gt; and &lt;code&gt;validatePaymasterUserOp&lt;&#x2F;code&gt; methods.&lt;&#x2F;p&gt;
&lt;p&gt;To prevent DoS attacks on bundlers, they must make sure the validation methods above pass the validation rules, which constrain their usage of opcodes and storage.
The full design of such a shared set of rules, applied to the validation code, is outside the scope of this proposal.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;estimating-preverificationgas&quot;&gt;Estimating &lt;code&gt;preVerificationGas&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;This document does not specify a canonical way to estimate this value,
as it depends on non-permanent network properties such as operation and data gas pricing and the expected bundle size.&lt;&#x2F;p&gt;
&lt;p&gt;However, the requirement is for the estimated value to be sufficient to cover the following costs:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Base bundle transaction cost. On Ethereum, &lt;code&gt;21000&lt;&#x2F;code&gt; gas divided by the number of &lt;code&gt;UserOperations&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The calldata gas cost related to the &lt;code&gt;UserOperation&lt;&#x2F;code&gt; as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2028&#x2F;&quot;&gt;EIP-2028&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Static &lt;code&gt;EntryPoint&lt;&#x2F;code&gt; contract code execution.&lt;&#x2F;li&gt;
&lt;li&gt;Static memory cost when loading the fixed size fields of the &lt;code&gt;UserOperation&lt;&#x2F;code&gt; into EVM memory&lt;&#x2F;li&gt;
&lt;li&gt;Memory cost (including expansion cost) due to context returned by paymaster &lt;code&gt;validatePaymasterUserOp&lt;&#x2F;code&gt; function, if relevant.
&lt;ul&gt;
&lt;li&gt;External call to the &lt;code&gt;innerHandleOp()&lt;&#x2F;code&gt; function which is a major part of the &lt;code&gt;EntryPoint&lt;&#x2F;code&gt; implementation.
Note that this value is not static and depends on the &lt;code&gt;UserOperation&lt;&#x2F;code&gt;&#x27;s position in the bundle.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;[EIP-7702] authorization cost, if any.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7623&#x2F;&quot;&gt;EIP-7623&lt;&#x2F;a&gt; calldata floor price increase is estimated as follows:
&lt;ul&gt;
&lt;li&gt;Apply the new formula for &lt;code&gt;tx.gasUsed&lt;&#x2F;code&gt;, replacing the &lt;code&gt;execution_gas_used&lt;&#x2F;code&gt; value with an estimate for value made for this UserOperation.&lt;&#x2F;li&gt;
&lt;li&gt;The estimate is calculated as a sum of all verification gas used during simulation (account creation, validation and paymaster validation) and 10% of the sum of execution and &lt;code&gt;postOp&lt;&#x2F;code&gt; gas limit.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The bundler MUST require a slack in &lt;code&gt;PreVerificationGas&lt;&#x2F;code&gt; value, to accommodate memory expansion costs in the future bundle, and the expected position of the &lt;code&gt;UserOperation&lt;&#x2F;code&gt; in it.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;alternative-mempools&quot;&gt;Alternative Mempools&lt;&#x2F;h3&gt;
&lt;p&gt;The simulation rules above are strict and prevent the ability of paymasters to grief the system.
However, there might be use cases where specific paymasters can be validated
(through manual auditing) and verified that they cannot cause any problem, while still require relaxing of the opcode rules.
A bundler cannot simply &quot;whitelist&quot; a request from a specific paymaster: if that paymaster is not accepted by all
bundlers, then its support will be sporadic at best.
Instead, we introduce the term &quot;alternate mempool&quot;: a modified validation rules, and procedure of propagating them to other bundlers.&lt;&#x2F;p&gt;
&lt;p&gt;The procedure of using alternate mempools is outside the scope of this proposal.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;bundling&quot;&gt;Bundling&lt;&#x2F;h3&gt;
&lt;p&gt;Bundling is the process where a node&#x2F;bundler collects multiple &lt;code&gt;UserOperations&lt;&#x2F;code&gt; and creates a single transaction to submit on-chain.&lt;&#x2F;p&gt;
&lt;p&gt;During bundling, the bundler MUST:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Exclude &lt;code&gt;UserOperations&lt;&#x2F;code&gt; that access any sender address of another &lt;code&gt;UserOperation&lt;&#x2F;code&gt; in the same bundle.&lt;&#x2F;li&gt;
&lt;li&gt;Exclude &lt;code&gt;UserOperations&lt;&#x2F;code&gt; that access any address created by another &lt;code&gt;UserOperation&lt;&#x2F;code&gt; validation in the same bundle (via a factory).&lt;&#x2F;li&gt;
&lt;li&gt;For each paymaster used in the bundle, keep track of the balance while adding &lt;code&gt;UserOperations&lt;&#x2F;code&gt;. Ensure that it has sufficient deposit to pay for all the &lt;code&gt;UserOperations&lt;&#x2F;code&gt; that use it.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;After creating the bundle, before including the transaction in a block, the bundler SHOULD:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Run &lt;code&gt;debug_traceCall&lt;&#x2F;code&gt; with maximum possible gas, to enforce the validation rules on opcode and storage access,
as well as to verify the entire &lt;code&gt;handleOps&lt;&#x2F;code&gt; bundle transaction,
and use the consumed gas for the actual transaction execution.&lt;&#x2F;li&gt;
&lt;li&gt;If the call reverted, the bundler MUST use the trace result to find the entity that reverted the call.&lt;br &#x2F;&gt;
This is the last entity that is CALL&#x27;ed by the &lt;code&gt;EntryPoint&lt;&#x2F;code&gt; prior to the revert.&lt;br &#x2F;&gt;
(the bundler cannot assume the revert is &lt;code&gt;FailedOp&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;If any verification context rule was violated the bundlers MUST treat it the same as
if this &lt;code&gt;UserOperation&lt;&#x2F;code&gt; reverted.&lt;&#x2F;li&gt;
&lt;li&gt;Remove the offending &lt;code&gt;UserOperation&lt;&#x2F;code&gt; from the current bundle and from mempool.&lt;&#x2F;li&gt;
&lt;li&gt;If the error is caused by a &lt;code&gt;factory&lt;&#x2F;code&gt; or a &lt;code&gt;paymaster&lt;&#x2F;code&gt;, and the &lt;code&gt;sender&lt;&#x2F;code&gt;
of the &lt;code&gt;UserOperation&lt;&#x2F;code&gt; &lt;strong&gt;is not&lt;&#x2F;strong&gt; a staked entity, then issue a &quot;ban&quot; for the guilty factory or paymaster.&lt;&#x2F;li&gt;
&lt;li&gt;If the error is caused by a &lt;code&gt;factory&lt;&#x2F;code&gt; or a &lt;code&gt;paymaster&lt;&#x2F;code&gt;, and the &lt;code&gt;sender&lt;&#x2F;code&gt;
of the &lt;code&gt;UserOperation&lt;&#x2F;code&gt; &lt;strong&gt;is&lt;&#x2F;strong&gt; a staked entity, do not ban the &lt;code&gt;factory&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;paymaster&lt;&#x2F;code&gt; from the mempool.
Instead, issue a &quot;ban&quot; for the staked &lt;code&gt;sender&lt;&#x2F;code&gt; entity.&lt;&#x2F;li&gt;
&lt;li&gt;Repeat until &lt;code&gt;debug_traceCall&lt;&#x2F;code&gt; succeeds.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;As staked entries may use some kind of transient storage to communicate data between &lt;code&gt;UserOperations&lt;&#x2F;code&gt; in the same bundle,
it is critical that the exact same opcode and precompile banning rules as well as storage access rules are enforced
for the &lt;code&gt;handleOps&lt;&#x2F;code&gt; validation in its entirety as for individual &lt;code&gt;UserOperations&lt;&#x2F;code&gt;.
Otherwise, attackers may be able to use the banned opcodes to detect running on-chain and trigger a &lt;code&gt;FailedOp&lt;&#x2F;code&gt; revert.&lt;&#x2F;p&gt;
&lt;p&gt;When a bundler includes a bundle in a block it must ensure that earlier transactions in the block don&#x27;t make any &lt;code&gt;UserOperation&lt;&#x2F;code&gt; fail.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;error-codes&quot;&gt;Error codes.&lt;&#x2F;h3&gt;
&lt;p&gt;While performing validation, the &lt;code&gt;EntryPoint&lt;&#x2F;code&gt; must revert on failures. During simulation, the calling bundler MUST be able to determine which entity (&lt;code&gt;sender&lt;&#x2F;code&gt;,&lt;code&gt;factory&lt;&#x2F;code&gt; or &lt;code&gt;paymaster&lt;&#x2F;code&gt;) caused the failure.
The attribution of a revert to an entity is done using call-tracing: the last entity called by the &lt;code&gt;EntryPoint&lt;&#x2F;code&gt; prior to the revert is the entity that caused the revert.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;For diagnostic purposes, the &lt;code&gt;EntryPoint&lt;&#x2F;code&gt; must only revert with explicit &lt;code&gt;SignatureValidationFailed()&lt;&#x2F;code&gt;, &lt;code&gt;FailedOp()&lt;&#x2F;code&gt; or &lt;code&gt;FailedOpWithRevert()&lt;&#x2F;code&gt; errors.&lt;&#x2F;li&gt;
&lt;li&gt;The message of the error starts with event code, AA##&lt;&#x2F;li&gt;
&lt;li&gt;Event code starting with &quot;AA1&quot; signifies an error during &lt;code&gt;sender&lt;&#x2F;code&gt; creation&lt;&#x2F;li&gt;
&lt;li&gt;Event code starting with &quot;AA2&quot; signifies an error during &lt;code&gt;sender&lt;&#x2F;code&gt; validation (&lt;code&gt;validateUserOp&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;Event code starting with &quot;AA3&quot; signifies an error during &lt;code&gt;paymaster&lt;&#x2F;code&gt; validation (&lt;code&gt;validatePaymasterUserOp&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The main challenge with a purely &quot;Smart Contract Accounts&quot; based Account Abstraction system is DoS safety: how can a block builder including an operation make sure that it will actually pay fees, without having to first execute the entire operation?
Requiring the block builder to execute the entire operation opens a DoS attack vector, as an attacker could easily send many operations that pretend to pay a fee but then revert at the last moment after a long execution.
Similarly, to prevent attackers from cheaply clogging the mempool, nodes in the P2P network need to check if an operation will pay a fee before they are willing to forward it.&lt;&#x2F;p&gt;
&lt;p&gt;The first step is a clean separation between validation (acceptance of UserOperation, and acceptance to pay) and execution.
In this proposal, we expect Accounts to have a &lt;code&gt;validateUserOp&lt;&#x2F;code&gt; method that takes as input a &lt;code&gt;UserOperation&lt;&#x2F;code&gt;, verifies the signature and pays the fee.
Only if this method returns successfully, the execution will happen.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;EntryPoint&lt;&#x2F;code&gt;-based approach allows for a clean separation between verification and execution, and keeps Smart Contract Accounts&#x27; logic simple. It enforces the simple rule that only after validation is successful and the &lt;code&gt;UserOperation&lt;&#x2F;code&gt; can pay, the execution is done and only done once, and also guarantees the fee payment.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;validation-rules-rationale&quot;&gt;Validation Rules Rationale&lt;&#x2F;h3&gt;
&lt;p&gt;The next step is protecting the bundlers from denial-of-service attacks by a mass number of &lt;code&gt;UserOperations&lt;&#x2F;code&gt; that appear to be valid (and pay) but that eventually revert, and thus block the bundler from processing valid &lt;code&gt;UserOperations&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;There are two types of &lt;code&gt;UserOperations&lt;&#x2F;code&gt; that can fail validation:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;UserOperations&lt;&#x2F;code&gt; that succeed in initial validation (and accepted into the mempool), but rely on the environment state to fail later when attempting to include them in a block.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;UserOperations&lt;&#x2F;code&gt; that are valid when checked independently but fail when bundled together to be put on-chain.
To prevent such rogue &lt;code&gt;UserOperations&lt;&#x2F;code&gt;, the bundler is required to follow a set of shared set of rules applied to the validation code, to prevent such denial-of-service attacks.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;reputation-rationale&quot;&gt;Reputation Rationale&lt;&#x2F;h3&gt;
&lt;p&gt;UserOperation&#x27;s storage access rules prevent them from interfering with each other.
But &quot;global&quot; entities - paymasters and factories are accessed by multiple &lt;code&gt;UserOperations&lt;&#x2F;code&gt;, and thus might invalidate multiple previously valid &lt;code&gt;UserOperations&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;To prevent abuse, we throttle down (or completely ban for a period of time) an entity that causes invalidation of a large number of &lt;code&gt;UserOperations&lt;&#x2F;code&gt; in the mempool.
To prevent such entities from &quot;Sybil-attack&quot;, we require them to stake with the system, and thus make such DoS attack very expensive.
Note that this stake is never slashed. There is no slashing mechanism involved and the only use for the stake in sybil attack prevention.
The stake can be withdrawn at any time after the specified unstake delay.&lt;&#x2F;p&gt;
&lt;p&gt;Unstaked entities are allowed, under the rules below.&lt;&#x2F;p&gt;
&lt;p&gt;When staked, an entity is less restricted in its use of contract storage.&lt;&#x2F;p&gt;
&lt;p&gt;The stake value is not enforced on-chain, but specifically by each bundler while simulating a transaction.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;paymasters&quot;&gt;Paymasters&lt;&#x2F;h3&gt;
&lt;p&gt;Paymaster contracts allow the abstraction of gas: having a contract, that is not the sender of the transaction, to pay for the transaction fees.&lt;&#x2F;p&gt;
&lt;p&gt;Paymaster architecture allows them to follow the model of &quot;pre-charge, and later refund&quot;.
E.g. a token-paymaster may pre-charge the user with the max possible price of the transaction, and refund the user with the excess afterwards.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;first-time-smart-contract-account-creation&quot;&gt;First-time Smart Contract Account creation&lt;&#x2F;h3&gt;
&lt;p&gt;NOTE: for contracts using EIP-7702 this flow is described in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;#support-for-eip-7702-authorizations&quot;&gt;Support for [EIP-7702] authorizations&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;It is an important design goal of this proposal to replicate the key property of EOAs that users do not need to perform some custom action or rely on an existing user to create their Smart Contract Account;
they can simply generate an address locally and immediately start accepting funds.&lt;&#x2F;p&gt;
&lt;p&gt;The Smart Contract Account creation itself is done by a &quot;factory&quot; contract, with some Account-specific data.
The Factory is expected to use &lt;code&gt;CREATE2 0xF5&lt;&#x2F;code&gt; (not &lt;code&gt;CREATE 0xF0&lt;&#x2F;code&gt;) to create the Account, so that the order of creation of the Accounts doesn&#x27;t interfere with the generated addresses.
The &lt;code&gt;initCode&lt;&#x2F;code&gt; field (if non-zero length) is parsed as a 20-byte &lt;code&gt;factory&lt;&#x2F;code&gt; address, followed by &lt;code&gt;calldata&lt;&#x2F;code&gt; to pass to this address.
This method call is expected to create the Account and return its address.
If the factory does use &lt;code&gt;CREATE2 0xF5&lt;&#x2F;code&gt; or some other deterministic method to create the Account, it&#x27;s expected to return the Account address even if it had already been created.
This comes to make it easier for bundlers to query the address without knowing if the Account has already been deployed, by simulating a call to &lt;code&gt;entryPoint.getSenderAddress()&lt;&#x2F;code&gt;, which calls the &lt;code&gt;factory&lt;&#x2F;code&gt; under the hood.
When &lt;code&gt;initCode&lt;&#x2F;code&gt; is specified, if either the &lt;code&gt;sender&lt;&#x2F;code&gt; address points to an existing contract or the &lt;code&gt;sender&lt;&#x2F;code&gt; address still does not exist after calling the &lt;code&gt;initCode&lt;&#x2F;code&gt;,
then the operation is aborted.
The &lt;code&gt;initCode&lt;&#x2F;code&gt; MUST NOT be called directly from the &lt;code&gt;EntryPoint&lt;&#x2F;code&gt;, but from another address.
The contract created by this factory method MUST accept a call to &lt;code&gt;validateUserOp&lt;&#x2F;code&gt; to validate the &lt;code&gt;UserOperation&lt;&#x2F;code&gt;&#x27;s signature.
For security reasons, it is important that the generated contract address will depend on the initial signature.
This way, even if someone can deploy an Account at that address, he can&#x27;t set different credentials to control it.
The Factory has to be staked if it accesses global storage.
NOTE: In order for the Wallet Application to determine the &quot;counterfactual&quot; address of the Account prior to its creation,
it SHOULD make a static call to the &lt;code&gt;entryPoint.getSenderAddress()&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC does not change the consensus layer, so there are no backwards compatibility issues for Ethereum as a whole. Unfortunately it is not easily compatible with pre-&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt; Smart Contract Accounts, because those Accounts do not have a &lt;code&gt;validateUserOp&lt;&#x2F;code&gt; function. If the Smart Contract Account has a function for authorizing a trusted &lt;code&gt;UserOperation&lt;&#x2F;code&gt; submitter, then this could be fixed by creating an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt; compatible Account that re-implements the verification logic as a wrapper and setting it to be the original Account&#x27;s trusted &lt;code&gt;UserOperation&lt;&#x2F;code&gt; submitter.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;EntryPoint&lt;&#x2F;code&gt; contract will need to be audited and formally verified, because it will serve as a central trust point for &lt;em&gt;all&lt;&#x2F;em&gt; [ERC-4337]. In total, this architecture reduces auditing and formal verification load for the ecosystem, because the amount of work that individual &lt;em&gt;accounts&lt;&#x2F;em&gt; have to do becomes much smaller (they need only verify the &lt;code&gt;validateUserOp&lt;&#x2F;code&gt; function and its &quot;check signature and pay fees&quot; logic) and check that other functions are &lt;code&gt;msg.sender == ENTRY_POINT&lt;&#x2F;code&gt; gated (perhaps also allowing &lt;code&gt;msg.sender == self&lt;&#x2F;code&gt;), but it is nevertheless the case that this is done precisely by concentrating security risk in the &lt;code&gt;EntryPoint&lt;&#x2F;code&gt; contract that needs to be verified to be very robust.&lt;&#x2F;p&gt;
&lt;p&gt;Verification would need to cover two primary claims (not including claims needed to protect paymasters, and claims needed to establish p2p-level DoS resistance):&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Safety against arbitrary hijacking&lt;&#x2F;strong&gt;: The &lt;code&gt;EntryPoint&lt;&#x2F;code&gt; only calls to the &lt;code&gt;sender&lt;&#x2F;code&gt; with &lt;code&gt;userOp.calldata&lt;&#x2F;code&gt; and only if &lt;code&gt;validateUserOp&lt;&#x2F;code&gt; to that specific &lt;code&gt;sender&lt;&#x2F;code&gt; has passed.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Safety against fee draining&lt;&#x2F;strong&gt;: If the &lt;code&gt;EntryPoint&lt;&#x2F;code&gt; calls &lt;code&gt;validateUserOp&lt;&#x2F;code&gt; and passes, it also must make the generic call with calldata equal to &lt;code&gt;userOp.calldata&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;factory-contracts&quot;&gt;Factory contracts&lt;&#x2F;h3&gt;
&lt;p&gt;All &lt;code&gt;factory&lt;&#x2F;code&gt; contracts MUST check that all calls to the &lt;code&gt;createAccount()&lt;&#x2F;code&gt; function originate from the &lt;code&gt;entryPoint.senderCreator()&lt;&#x2F;code&gt; address.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;paymasters-contracts&quot;&gt;Paymasters contracts&lt;&#x2F;h3&gt;
&lt;p&gt;All &lt;code&gt;paymaster&lt;&#x2F;code&gt; contracts MUST check that all calls to the &lt;code&gt;validatePaymasterUserOp()&lt;&#x2F;code&gt; and &lt;code&gt;postOp()&lt;&#x2F;code&gt; functions originate from the &lt;code&gt;EntryPoint&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;aggregator-contracts&quot;&gt;Aggregator contracts&lt;&#x2F;h3&gt;
&lt;p&gt;All &lt;code&gt;aggregator&lt;&#x2F;code&gt; contracts MUST check that all calls to the &lt;code&gt;validateSignatures()&lt;&#x2F;code&gt; function originates from the &lt;code&gt;EntryPoint&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;eip-7702-delegated-smart-contract-accounts&quot;&gt;EIP-7702 delegated Smart Contract Accounts&lt;&#x2F;h3&gt;
&lt;p&gt;All EIP-7702 delegated Smart Contract Account implementations MUST check that all calls to the initialization function originate from the &lt;code&gt;entryPoint.senderCreator()&lt;&#x2F;code&gt; address.&lt;&#x2F;p&gt;
&lt;p&gt;There is no way for the &lt;code&gt;EntryPoint&lt;&#x2F;code&gt; contract to know whether an EIP-7702 account has been initialized or not, and therefore the EIP-7702 account initialization code, can be called multiple times through &lt;code&gt;EntryPoint&lt;&#x2F;code&gt;.
The Account code SHOULD only allow calling it once and the Wallet Application SHOULD NOT pass the &lt;code&gt;initCode&lt;&#x2F;code&gt; repeatedly.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;smart-contract-accounts&quot;&gt;Smart Contract Accounts&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;storage-layout-collisions&quot;&gt;Storage layout collisions&lt;&#x2F;h4&gt;
&lt;p&gt;It is expected that most of ERC-4337 Smart Contract Account will be upgradeable,
either via on-chain delegate proxy contracts or via EIP-7702.&lt;&#x2F;p&gt;
&lt;p&gt;When changing the underlying implementation, all Accounts MUST ensure that there are no conflicts in the storage layout
of the two contracts.&lt;&#x2F;p&gt;
&lt;p&gt;One common approach to this problem is often referred to as &quot;diamond storage&quot; and is fully described in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7201&#x2F;&quot;&gt;ERC-7201&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;transient-storage&quot;&gt;Transient Storage&lt;&#x2F;h3&gt;
&lt;p&gt;Contracts using the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1153&#x2F;&quot;&gt;EIP-1153&lt;&#x2F;a&gt; transient storage MUST take into account that ERC-4337 allows multiple
&lt;code&gt;UserOperations&lt;&#x2F;code&gt; from different unrelated &lt;code&gt;sender&lt;&#x2F;code&gt; addresses to be included in the same underlying transaction.
The transient storage MUST be cleaned up manually if contains any sensitive information or is used for access control.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Held token interface</title>
        <published>2021-09-21T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Devin Conley</name><uri>https://github.com/devinaconley</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4987/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-4987-held-token-standard-nfts-defi/7117" />
        

        <id>https://wg-eips.ritovision.com/4987/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:4987"
            label="ERC-4987" />
        

        
        

        
        <summary type="html">Interface to query ownership and balance of held tokens</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4987/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The proposed standard defines a lightweight interface to expose functional ownership and balances of held tokens. A held token is a token owned by a contract. This standard may be implemented by smart contracts which hold &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;EIP-20&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt;, or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;EIP-1155&lt;&#x2F;a&gt; tokens and is intended to be consumed by both on-chain and off-chain systems that rely on ownership and balance verification.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;As different areas of crypto (DeFi, NFTs, etc.) converge and composability improves, there will more commonly be a distinction between the actual owner (likely a contract) and the functional owner (likely a user) of a token. Currently, this results in a conflict between mechanisms that require token deposits and systems that rely on those tokens for ownership or balance verification.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal aims to address that conflict by providing a standard interface for token holders to expose ownership and balance information. This will allow users to participate in these DeFi mechanisms without giving up existing token utility. Overall, this would greatly increase interoperability across systems, benefiting both users and protocol developers.&lt;&#x2F;p&gt;
&lt;p&gt;Example implementers of this ERC standard include&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;staking or farming contracts&lt;&#x2F;li&gt;
&lt;li&gt;lending pools&lt;&#x2F;li&gt;
&lt;li&gt;time lock or vesting vaults&lt;&#x2F;li&gt;
&lt;li&gt;fractionalized NFT contracts&lt;&#x2F;li&gt;
&lt;li&gt;smart contract wallets&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Example consumers of this ERC standard include&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;governance systems&lt;&#x2F;li&gt;
&lt;li&gt;gaming&lt;&#x2F;li&gt;
&lt;li&gt;PFP verification&lt;&#x2F;li&gt;
&lt;li&gt;art galleries or showcases&lt;&#x2F;li&gt;
&lt;li&gt;token based membership programs&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Smart contracts implementing the &lt;code&gt;ERC20&lt;&#x2F;code&gt; held token standard MUST implement all of the functions in the &lt;code&gt;IERC20Holder&lt;&#x2F;code&gt; interface.&lt;&#x2F;p&gt;
&lt;p&gt;Smart contracts implementing the &lt;code&gt;ERC20&lt;&#x2F;code&gt; held token standard MUST also implement &lt;code&gt;ERC165&lt;&#x2F;code&gt; and return true when the interface ID &lt;code&gt;0x74c89d54&lt;&#x2F;code&gt; is passed.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the ERC20 holder standard provides a common interface to query&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * token balance information&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC20Holder&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC165&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; emitted when the token is transferred to the contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; functional token owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; held token address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenAmount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; held token amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Hold&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; emitted when the token is released back to the user&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; functional token owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; held token address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenAmount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; held token amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Release&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; get the held balance of the token owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; should throw for invalid queries and return zero for no balance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; held token address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; functional token owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; held&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; token balance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; heldBalanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Smart contracts implementing the &lt;code&gt;ERC721&lt;&#x2F;code&gt; held token standard MUST implement all of the functions in the &lt;code&gt;IERC721Holder&lt;&#x2F;code&gt; interface.&lt;&#x2F;p&gt;
&lt;p&gt;Smart contracts implementing the &lt;code&gt;ERC721&lt;&#x2F;code&gt; held token standard MUST also implement &lt;code&gt;ERC165&lt;&#x2F;code&gt; and return true when the interface ID &lt;code&gt;0x16b900ff&lt;&#x2F;code&gt; is passed.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the ERC721 holder standard provides a common interface to query&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * token ownership and balance information&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC721Holder&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC165&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; emitted when the token is transferred to the contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; functional token owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; held token address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; held token ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Hold&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; emitted when the token is released back to the user&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; functional token owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; held token address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; held token ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Release&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; get the functional owner of a held token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; should throw for invalid queries and return zero for a token ID that is not held&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; held token address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; held token ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; functional&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; token owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; heldOwnerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; get the held balance of the token owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; should throw for invalid queries and return zero for no balance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; held token address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; functional token owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; held&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; token balance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; heldBalanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Smart contracts implementing the &lt;code&gt;ERC1155&lt;&#x2F;code&gt; held token standard MUST implement all of the functions in the &lt;code&gt;IERC1155Holder&lt;&#x2F;code&gt; interface.&lt;&#x2F;p&gt;
&lt;p&gt;Smart contracts implementing the &lt;code&gt;ERC1155&lt;&#x2F;code&gt; held token standard MUST also implement &lt;code&gt;ERC165&lt;&#x2F;code&gt; and return true when the interface ID &lt;code&gt;0xced24c37&lt;&#x2F;code&gt; is passed.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the ERC1155 holder standard provides a common interface to query&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * token balance information&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC1155Holder&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC165&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; emitted when the token is transferred to the contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; functional token owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; held token address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; held token ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenAmount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; held token amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Hold&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; emitted when the token is released back to the user&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; functional token owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; held token address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; held token ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenAmount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; held token amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Release&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; get the held balance of the token owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; should throw for invalid queries and return zero for no balance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; held token address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; functional token owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; held token ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; held&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; token balance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; heldBalanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This interface is designed to be extremely lightweight and compatible with any existing token contract. Any token holder contract likely already stores all relevant information, so this standard is purely adding a common interface to expose that data.&lt;&#x2F;p&gt;
&lt;p&gt;The token address parameter is included to support contracts that can hold multiple token contracts simultaneously. While some contracts may only hold a single token address, this is more general to either scenario.&lt;&#x2F;p&gt;
&lt;p&gt;Separate interfaces are proposed for each token type (EIP-20, EIP-721, EIP-1155) because any contract logic to support holding these different tokens is likely independent. In the scenario where a single contract does hold multiple token types, it can simply implement each appropriate held token interface.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Importantly, the proposed specification is fully compatible with all existing EIP-20, EIP-721, and EIP-1155 token contracts.&lt;&#x2F;p&gt;
&lt;p&gt;Token holder contracts will need to be updated to implement this lightweight interface.&lt;&#x2F;p&gt;
&lt;p&gt;Consumer of this standard will need to be updated to respect this interface in any relevant ownership logic.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;A full example implementation including &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4987&#x2F;.&#x2F;assets&#x2F;IERC721Holder.sol&quot;&gt;interfaces&lt;&#x2F;a&gt;, a vault &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4987&#x2F;.&#x2F;assets&#x2F;Vault.sol&quot;&gt;token holder&lt;&#x2F;a&gt;, and a &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4987&#x2F;.&#x2F;assets&#x2F;Consumer.sol&quot;&gt;consumer&lt;&#x2F;a&gt;, can be found at &lt;code&gt;assets&#x2F;eip-4987&#x2F;&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Notably, consumers of the &lt;code&gt;IERC721Holder&lt;&#x2F;code&gt; interface can do a chained lookup for the owner of any specific token ID using the following logic.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; get the functional owner of a token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; token id of interest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; get raw owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; owner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; token&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if owner is not contract, return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      return&lt;&#x2F;span&gt;&lt;span&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; check for token holder interface support&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    try&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC165&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x16b900ff&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ret&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;ret&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; catch&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      return&lt;&#x2F;span&gt;&lt;span&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; check for held owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    try&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC721Holder&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;heldOwnerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;user &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span&gt; user&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; catch&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Consumers of this standard should be cautious when using ownership information from unknown contracts. A bad actor could implement the interface, but report invalid or malicious information with the goal of manipulating a governance system, game, membership program, etc.&lt;&#x2F;p&gt;
&lt;p&gt;Consumers should also verify the overall token balance and ownership of the holder contract as a sanity check.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Gas refunds on reverts</title>
        <published>2021-09-16T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Anton Bukov</name><uri>https://github.com/k06a</uri>
	</author>
	
	<author>
		<name>Mikhail Melnik</name><uri>https://github.com/ZumZoom</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3978/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3978-gas-refunds-on-reverts/7071/" />
        

        <id>https://wg-eips.ritovision.com/3978/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:3978"
            label="EIP-3978" />
        

        
        

        
        <summary type="html">Reprice reverted SSTORE&#x2F;CREATE&#x2F;SELFDESTRUCT&#x2F;LOGX operations gas via gas refund mechanism</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3978/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;For reverted state modification operations, keep access cost, but refund modification cost.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Reverting a transaction, or any of its sub-calls, drops any state modifications that happened inside.
But now, users are being charged for the dropped modifications as if they persisted.&lt;&#x2F;p&gt;
&lt;p&gt;Since &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3298&#x2F;&quot;&gt;EIP-3298&lt;&#x2F;a&gt;, the gas refund mechanism works for storage restores only inside the same transaction. But on revert, the gas refund is not increased; it is completely erased.
It can even be cheaper to transfer tokens back at the end of a transaction instead of reverting, to keep the existing gas refund.
This should be changed.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Reverted SSTORE deserves to be repriced to SLOAD gas (100 gas)&lt;&#x2F;li&gt;
&lt;li&gt;Reverted LOG0, LOG1, LOG2, LOG3 and LOG4 deserve to be repriced to 100 gas&lt;&#x2F;li&gt;
&lt;li&gt;Reverted CALL with value (&lt;code&gt;positive_value_cost&lt;&#x2F;code&gt; = 9,000 gas) deserves to be repriced to 100 gas&lt;&#x2F;li&gt;
&lt;li&gt;Reverted CALL with value and account creation (&lt;code&gt;value_to_empty_account_cost&lt;&#x2F;code&gt; = 25,000 gas) deserves to be repriced to 100 gas&lt;&#x2F;li&gt;
&lt;li&gt;Reverted CREATE and CREATE2 (32,000 gas) deserve to be repriced to 100 gas&lt;&#x2F;li&gt;
&lt;li&gt;Reverted SELFDESTRUCT (5,000 or 25,000 gas) deserves to be repriced to 100 gas&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Moreover, it seems fair to charge CREATE and CREATE2 operations 32,000 fix price conditionally only if returned bytecode is not empty.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;For each callframe, track &lt;code&gt;revert_gas_refund&lt;&#x2F;code&gt;, initially 0.&lt;&#x2F;p&gt;
&lt;p&gt;The set of operations that modify &lt;code&gt;revert_gas_refund&lt;&#x2F;code&gt; are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;SSTORE&lt;&#x2F;li&gt;
&lt;li&gt;LOG0, LOG1, LOG2, LOG3, LOG4&lt;&#x2F;li&gt;
&lt;li&gt;CALL&lt;&#x2F;li&gt;
&lt;li&gt;CREATE, CREATE2&lt;&#x2F;li&gt;
&lt;li&gt;SELFDESTRUCT&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;They increase &lt;code&gt;revert_gas_refund&lt;&#x2F;code&gt; as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;call&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;revert_gas_refund&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; operation&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; WARM_STORAGE_READ_COST&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;And in case of revert let&#x27;s use this value instead of just erasing &lt;code&gt;gas_refund&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;call&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;reverted&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; existing behavior&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;gas_refund&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; call&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;gas_refund&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; New behavior added to existing according to the EIP-3978&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;gas_refund&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; call&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;revert_gas_refund&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Gas should reflect the cost of use.
The revert cost reflects the cost of access during execution, but not the cost of modification.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No known backward incompatibilities.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Strict enforcement of chainId</title>
        <published>2021-09-02T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Gregory Markou</name><uri>https://github.com/GregTheGreek</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3788/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/discussion-to-eip-3788-strict-enforcement-of-chainid/7001" />
        

        <id>https://wg-eips.ritovision.com/3788/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:3788"
            label="EIP-3788" />
        

        
        

        
        <summary type="html">Reject transactions that do not explicitly have the same chainId as the node&#x27;s configuration.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3788/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Reject transactions that do not explicitly have the same chainId as the node&#x27;s configuration.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Per &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt; a transaction with a &lt;code&gt;chainId = 0&lt;&#x2F;code&gt; is considered to be a valid
transaction. This was a feature to offer developers the ability to submit replayable transactions
across different chains. With the rise of evm compatible chains, many of which use forks, or packages
from popular Ethereum clients, we are putting user funds at risk. This is because most wallet
interfaces do not expose the chainId to the user, meaning they typically do not have insight
into what chainId they are signing. Should a malicious actor (or accidental) choose to, they
can easily have users submit transactions with a &lt;code&gt;chainId = 0&lt;&#x2F;code&gt; on a non-mainnet network, allowing
the malicious actor to replay the transaction on ethereum mainnet (or other networks for that matter)
as a grief or sophisticated attack.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;As of the fork block &lt;code&gt;N&lt;&#x2F;code&gt;, consider transactions with a &lt;code&gt;chaindId = 0&lt;&#x2F;code&gt; to be invalid. Such that
transactions are verified based on the nodes configuration. Eg:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;if (node.cfg.chainId != tx.chainId) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; Reject transaction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The configuration set by the node is the main source of truth, and thus should be explicitly used
when deciding how to filter out a transaction. This check should exist in two places, as a filter
on the JSON-RPC (eg: &lt;code&gt;eth_sendTransaction&lt;&#x2F;code&gt;), and strictly enforced on the EVM during transaction
validation.&lt;&#x2F;p&gt;
&lt;p&gt;This ensures that users will not have transactions pending that will be guaranteed to fail, and
prevents the transaction from being included in a block.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This breaks all applications or tooling that submit transactions with a &lt;code&gt;chainId == 0&lt;&#x2F;code&gt; after block number &lt;code&gt;N&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;It should be noted this will not prevent a malicious actor from deploying a network with &lt;code&gt;chainId = 1&lt;&#x2F;code&gt;, or copying any other networks chainId.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Safer Control Flow for the EVM</title>
        <published>2021-08-30T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Greg Colvin</name><uri>https://github.com/gcolvin</uri>
	</author>
	
	<author>
		<name>Greg Colvin</name><email>greg@colvin.org</email>
	</author>
	
	<author>
		<name>Brooklyn Zelenka</name><uri>https://github.com/expede</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3779/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3779-safe-control-flow-for-the-evm/6975" />
        

        <id>https://wg-eips.ritovision.com/3779/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:3779"
            label="EIP-3779" />
        

        
        

        
        <summary type="html">Ensure an essential level of safety for EVM code.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3779/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;We define a safe EVM contract as one that cannot encounter an exceptional halting state.  In general, we cannot prove safety for Turing-complete programs. But we can prove a useful subset.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP specifies validity rules to ensure that:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Valid contracts will not halt with an exception unless they either&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;throw &lt;code&gt;out of gas&lt;&#x2F;code&gt; or&lt;&#x2F;li&gt;
&lt;li&gt;recursively overflow stack.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;This EIP does not introduce any new opcodes.  Rather, it restricts the use of existing and proposed control-flow instructions.  The restrictions must be validated at contract initialization time – not at runtime – by the provided algorithm or its equivalent. This algorithm must take time and space near-linear in the size of the contract, so as not to be a denial of service vulnerability.&lt;&#x2F;p&gt;
&lt;p&gt;This specification is entirely semantic.  It imposes no further syntax on bytecode, as none is required to ensure the specified level of safety.  Ethereum Virtual Machine bytecode is just that -- a sequence of bytes that when executed causes a sequence of changes to the machine state.  The safety we seek here is simply to not, as it were, jam up the gears.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;safety&quot;&gt;Safety&lt;&#x2F;h3&gt;
&lt;p&gt;For our purposes we define a safe EVM contract as one that cannot encounter an exceptional halting state.  From the standpoint of security it would be best if unsafe contracts were never placed on the blockchain.  Unsafe code can attempt to overflow stack, underflow stack, execute invalid instructions, and jump to invalid locations.&lt;&#x2F;p&gt;
&lt;p&gt;Unsafe contracts are exploits waiting to happen.&lt;&#x2F;p&gt;
&lt;p&gt;Validating contract safety requires traversing the contract code.  So in order to prevent denial of service attacks all jumps, including the existing &lt;code&gt;JUMP&lt;&#x2F;code&gt; and &lt;code&gt;JUMPI&lt;&#x2F;code&gt;, and also the other proposed jumps -- &lt;code&gt;RJUMP&lt;&#x2F;code&gt;, &lt;code&gt;RJUMPI&lt;&#x2F;code&gt;, &lt;code&gt;RJUMPSUB&lt;&#x2F;code&gt; and &lt;code&gt;RETURNSUB&lt;&#x2F;code&gt; -- must be validated at initialization time, and in time and space linear in the size of the code.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;static-jumps-and-subroutines&quot;&gt;Static Jumps and Subroutines&lt;&#x2F;h4&gt;
&lt;p&gt;The relative jumps of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4200&#x2F;&quot;&gt;EIP-4200&lt;&#x2F;a&gt; and the simple subroutines of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2315&#x2F;&quot;&gt;EIP-2315&lt;&#x2F;a&gt; provide a complete set of static control flow instructions:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;RJUMP&lt;&#x2F;code&gt; &lt;em&gt;offset&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Jumps to &lt;em&gt;IP+offset&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt; &lt;em&gt;offset&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Jumps if the top of stack is non-zero.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;RJUMPSUB&lt;&#x2F;code&gt; offset&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Pushes &lt;em&gt;IP+1&lt;&#x2F;em&gt; on the return stack and jumps to &lt;em&gt;IP+offset&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;RETURNSUB&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Jumps to the address popped off the return stack.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note that each jump creates at most two paths of control through the code, such that the complexity of traversing the entire control-flow graph is linear in the size of the code.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;dynamic-jumps&quot;&gt;&lt;em&gt;Dynamic Jumps&lt;&#x2F;em&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Dynamic jumps, where the destination of a &lt;code&gt;JUMP&lt;&#x2F;code&gt; or &lt;code&gt;JUMPI&lt;&#x2F;code&gt; is not known until runtime, are an obstacle to proving validity in linear time -- any jump can be to any destination in the code, potentially requiring time quadratic in the size of code. For this reason we have two real choices.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Deprecate dynamic jumps. This is easily done:&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;blockquote&gt;
&lt;p&gt;Define &lt;code&gt;JUMP&lt;&#x2F;code&gt; and &lt;code&gt;JUMPI&lt;&#x2F;code&gt; as &lt;code&gt;INVALID&lt;&#x2F;code&gt; for the purposes of EOF Code Validation&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;ol start=&quot;2&quot;&gt;
&lt;li&gt;Constrain dynamic jumps. This requires static analysis.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Consider the simplest and most common case.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;JUMP&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This is effectively a static jump.&lt;&#x2F;p&gt;
&lt;p&gt;Another important use of &lt;code&gt;JUMP&lt;&#x2F;code&gt; is to implement the return jump from a subroutine. So consider this example of calling and returning from a minimal subroutine:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;TEST_SQUARE:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    push RTN_SQUARE &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    0x02&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    push SQUARE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    jump&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;RTN_SQUARE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    jump&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SQUARE:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    dup1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    mul&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    jump&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The return address -&lt;code&gt;RTN_SQUARE&lt;&#x2F;code&gt; - and the destination address - &lt;code&gt;SQUARE&lt;&#x2F;code&gt; - are pushed on the stack as constants and remain unchanged as they move on the stack, such that only those constants are passed to each &lt;code&gt;JUMP&lt;&#x2F;code&gt;. They are effectively static.  We can track the motion of constants on the &lt;code&gt;data stack&lt;&#x2F;code&gt; at validation time, so &lt;em&gt;we do not need unconstrained dynamic jumps to implement subroutines.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;The above is the simplest analysis that suffices.  A more powerful analysis that takes in more use cases is possible -- slower, but still linear-time.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;validation&quot;&gt;Validation&lt;&#x2F;h4&gt;
&lt;p&gt;We can validate the safety of contracts with a static analysis that takes time and space linear in the size of the &lt;em&gt;code&lt;&#x2F;em&gt;, as shown below.  And since we can, we should.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;performance&quot;&gt;Performance&lt;&#x2F;h3&gt;
&lt;p&gt;Validating safe control flow at initialization time has potential performance advantages.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Static jumps do not need to be checked at runtime.&lt;&#x2F;li&gt;
&lt;li&gt;Stack underflow does not need to be checked for at runtime.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;validity&quot;&gt;Validity&lt;&#x2F;h3&gt;
&lt;blockquote&gt;
&lt;p&gt;In theory, theory and practice are the same. In practice, they&#x27;re not. -- Albert Einstein&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;We define a &lt;em&gt;safe&lt;&#x2F;em&gt; EVM contract as one that cannot encounter an exceptional halting state.  We validate &lt;em&gt;safety&lt;&#x2F;em&gt; at initialization time to the extent practical.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;exceptional-halting-states&quot;&gt;&lt;em&gt;Exceptional Halting States&lt;&#x2F;em&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;em&gt;execution&lt;&#x2F;em&gt; of each instruction is defined in the Yellow Paper as a change to the EVM state that preserves the invariants of EVM state.  At runtime, if the execution of an instruction would violate an invariant the EVM is in an exceptional halting state.  The Yellow Paper defined five such states.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Insufficient gas&lt;&#x2F;li&gt;
&lt;li&gt;More than 1024 stack items&lt;&#x2F;li&gt;
&lt;li&gt;Insufficient stack items&lt;&#x2F;li&gt;
&lt;li&gt;Invalid jump destination&lt;&#x2F;li&gt;
&lt;li&gt;Invalid instruction&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;em&gt;A program is safe iff no execution can lead to an exceptional halting state.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;We would like to consider EVM programs valid iff they are safe.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;In practice&lt;&#x2F;em&gt;, we must be able to validate &lt;em&gt;code&lt;&#x2F;em&gt; in linear time to avoid denial of service attacks. And we must support dynamically-priced instructions, loops, and recursion, which can use arbitrary amounts of gas and stack.&lt;&#x2F;p&gt;
&lt;p&gt;Thus our validation cannot consider concrete computations -- it only performs a limited symbolic execution of the &lt;em&gt;code&lt;&#x2F;em&gt;.  This means we will reject programs if we detect any invalid execution paths, even if those paths are not reachable at runtime.  And we will count as valid programs that may not always produce correct results.&lt;&#x2F;p&gt;
&lt;p&gt;We can detect only &lt;em&gt;non-recursive&lt;&#x2F;em&gt; stack overflows at &lt;em&gt;validation time&lt;&#x2F;em&gt;, so we must check for the first two states at &lt;em&gt;runtime&lt;&#x2F;em&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;out of gas&lt;&#x2F;code&gt; and&lt;&#x2F;li&gt;
&lt;li&gt;stack overflow.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The remaining three states we can check at &lt;em&gt;validation time&lt;&#x2F;em&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;stack underflow,&lt;&#x2F;li&gt;
&lt;li&gt;invalid jump, and&lt;&#x2F;li&gt;
&lt;li&gt;invalid instruction.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;That is to say:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Valid contracts will not halt with an exception unless they either&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;throw &lt;code&gt;out of gas&lt;&#x2F;code&gt; or&lt;&#x2F;li&gt;
&lt;li&gt;recursively overflow stack.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;blockquote&gt;
&lt;h4 id=&quot;constraints-on-valid-code&quot;&gt;&lt;em&gt;Constraints on Valid Code&lt;&#x2F;em&gt;&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Every instruction is valid.&lt;&#x2F;li&gt;
&lt;li&gt;Every jump is valid:
&lt;ul&gt;
&lt;li&gt;Every&lt;code&gt;JUMP&lt;&#x2F;code&gt; and &lt;code&gt;JUMPI&lt;&#x2F;code&gt; is &lt;em&gt;static&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;No &lt;code&gt;JUMP&lt;&#x2F;code&gt;, &lt;code&gt;JUMPI&lt;&#x2F;code&gt;, &lt;code&gt;RJUMP&lt;&#x2F;code&gt;, &lt;code&gt;RJUMPI&lt;&#x2F;code&gt;, or &lt;code&gt;RJUMPSUB&lt;&#x2F;code&gt; addresses immediate data.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The stacks are always valid:
&lt;ul&gt;
&lt;li&gt;The &lt;em&gt;number&lt;&#x2F;em&gt; of items on the &lt;code&gt;data stack&lt;&#x2F;code&gt; is always positive, and at most 1024.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;em&gt;number&lt;&#x2F;em&gt; of items on the &lt;code&gt;return stack&lt;&#x2F;code&gt; is always positive, and at most 1024.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The data stack is consistently aligned:
&lt;ul&gt;
&lt;li&gt;The &lt;em&gt;number&lt;&#x2F;em&gt; of items on the &lt;code&gt;data stack&lt;&#x2F;code&gt; between the current &lt;code&gt;stack pointer&lt;&#x2F;code&gt; and the &lt;code&gt;stack pointer&lt;&#x2F;code&gt; on entry to the most recent basic block is the same for each &lt;em&gt;execution&lt;&#x2F;em&gt; of a &lt;em&gt;byte_code&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;We define a &lt;code&gt;JUMP&lt;&#x2F;code&gt; or &lt;code&gt;JUMPI&lt;&#x2F;code&gt; instruction to be &lt;em&gt;static&lt;&#x2F;em&gt; if its &lt;code&gt;jumpsrc&lt;&#x2F;code&gt; argument was first placed on the stack via a &lt;code&gt;PUSH…&lt;&#x2F;code&gt; and that value has not changed since, though it may have been copied via a &lt;code&gt;DUP…&lt;&#x2F;code&gt; or &lt;code&gt;SWAP…&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;RJUMP&lt;&#x2F;code&gt;, &lt;code&gt;RJUMPI&lt;&#x2F;code&gt; and &lt;code&gt;RJUMPSUB&lt;&#x2F;code&gt;instructions take their destination as an immediate argument, so they are &lt;em&gt;static&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Taken together, these rules allow for code to be validated by traversing the control-flow graph, in time and space linear in the size of the code, following each edge only once.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Note: The definition of &#x27;static&#x27; for &lt;code&gt;JUMP&lt;&#x2F;code&gt; and &lt;code&gt;JUMPI&lt;&#x2F;code&gt; is the bare minimum needed to implement subroutines.  Deeper analyses could be proposed that would validate a larger and probably more useful set of jumps, at the cost of more expensive (but still linear) validation.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Demanding &lt;em&gt;static&lt;&#x2F;em&gt; destinations for all jumps means that all jump destinations can be validated at initialization time, not runtime.&lt;&#x2F;p&gt;
&lt;p&gt;Bounding the stack pointers catches all &lt;code&gt;data stack&lt;&#x2F;code&gt; and non-recursive&lt;code&gt;return stack&lt;&#x2F;code&gt; overflows.&lt;&#x2F;p&gt;
&lt;p&gt;Requiring a consistently aligned&lt;code&gt;data stack&lt;&#x2F;code&gt; prevents stack underflow. It can also catch such errors as misaligned stacks due to irreducible control flows and calls to subroutines with the wrong number of arguments.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;These changes affect the semantics of EVM code – the use of &lt;code&gt;JUMP&lt;&#x2F;code&gt;, &lt;code&gt;JUMPI&lt;&#x2F;code&gt;, and the stack are restricted, such that some &lt;em&gt;code&lt;&#x2F;em&gt; that would otherwise run correctly will nonetheless be invalid EVM &lt;em&gt;code&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The following is a pseudo-Go implementation of an algorithm for predicating code validity.  An equivalent algorithm must be run at initialization time.&lt;&#x2F;p&gt;
&lt;p&gt;This algorithm performs a symbolic execution of the program that recursively traverses the &lt;em&gt;code&lt;&#x2F;em&gt;, emulating its control flow and stack use and checking for violations of the rules above.&lt;&#x2F;p&gt;
&lt;p&gt;It runs in time equal to &lt;code&gt;O(vertices + edges)&lt;&#x2F;code&gt; in the program&#x27;s control-flow graph, where edges represent control flow and the vertices represent &lt;em&gt;basic blocks&lt;&#x2F;em&gt; -- thus the algorithm takes time proportional to the size of the &lt;em&gt;code&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Note: All valid code has a control-flow graph that can be traversed in time and space linear in the length of the code.  That means that some other static analyses and code transformations that might otherwise require quadratic time can also be written to run in near-linear time, including one-pass and streaming compilers.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;validation-function&quot;&gt;Validation Function&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Note:&lt;&#x2F;strong&gt; This function is a work in progress, and the version below is known to be incorrect.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;For simplicity&#x27;s sake we assume that &lt;em&gt;jumpdest analysis&lt;&#x2F;em&gt; has been done and that we have some helper functions.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;isValidInstruction(pc)&lt;&#x2F;code&gt; returns true if &lt;code&gt;pc&lt;&#x2F;code&gt; points at a valid instruction&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;isValidJumpdest(dest)&lt;&#x2F;code&gt; returns true if &lt;code&gt;dest&lt;&#x2F;code&gt; is a valid jumpdest&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;immediateData(pc)&lt;&#x2F;code&gt; returns the immediate data for the instruction at &lt;code&gt;pc&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;advancePC(pc)&lt;&#x2F;code&gt; returns next &lt;code&gt;pc&lt;&#x2F;code&gt;,  skipping any immediate data.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;removed_items(pc)&lt;&#x2F;code&gt; returns the number of items removed from the &lt;code&gt;dataStack&lt;&#x2F;code&gt; by the instruction at &lt;code&gt;pc&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;added_items(pc)&lt;&#x2F;code&gt; returns the number of items added to the &lt;code&gt;dataStack&lt;&#x2F;code&gt; by the instruction at &lt;code&gt;pc&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;var bytecode      [codeLen]byte&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;var subMin        [codeLen]int&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;var subMax        [codeLen]int&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;var subDelta      [codeLen]int&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;var visited       [codeLen]bool&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;var dataStack     [1024]int&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; validate a path through the control flow of the bytecode at pc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; and return the maximum number of stack items used down that path&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; or else the PC and an error&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; by starting at pc:=0 the entire program is recursively evaluated&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;func validate(pc := 0, sp := 0, rp := 0) int, error {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   minStack := 0 &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   maxStack := 0 &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   deltaStack := 0 &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   for pc &amp;lt; codeLen {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      if !isValidInstruction(pc) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         return 0,0,0,invalid_instruction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &#x2F;&#x2F; if we have jumped here before return to break cycle&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      if visited[pc] {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          &#x2F;&#x2F; stack is not aligned if deltas not the same&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          if ??? {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            return 0,0,0,invalid_stack&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          return minStack, maxStack, sp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      visited[pc] = true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      switch bytecode[pc] {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &#x2F;&#x2F; successful termination&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      case STOP:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         return minStack, maxStack, sp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      case RETURN:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         return minStack, maxStack, sp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      case SELFDESTRUCT:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         return minStack, maxStack, sp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      case REVERT:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         return minStack, maxStack, sp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      case INVALID:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         return 0,0,0,invalid_instruction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      case RJUMP:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         &#x2F;&#x2F; check for valid jump destination&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         if !isValidJumpdest(jumpdest) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            return 0,0,0,invalid_destination&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         &#x2F;&#x2F; reset pc to destination of jump&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         pc += immediateData(pc)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      case RJUMPI:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         &#x2F;&#x2F; recurse to validate true side of conditional&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         jumpdest = pc + immediateData(pc)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         if !isValidJumpdest(pc + jumpdest) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            return 0,0,0,invalid_destination&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         minRight, maxLeft, deltaRight, err =&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            validate(jumpdest, sp, rp)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     err {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            return 0,0,0,err&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         &#x2F;&#x2F; recurse to validate false side of conditional&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         pc = advancePC(pc)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         minRight, maxRight, deltaRight, err =&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            validate(pc, sp, rp)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         if err {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            return 0,0,0,err&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         &#x2F;&#x2F; both paths valid, so return max&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         minStack = min(minStack, min(minLeft, minRight))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         maxStack += max(maxLeft, maxRight)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         deltaStack += max(deltaLeft, deltaRight)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         return minStack, maxStack, deltaStack&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      case RJUMPSUB:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         &#x2F;&#x2F; check for valid jump destination&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         jumpdest = immediateData(pc)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         if !isValidJumpdest(pc + jumpdest) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            return 0,0,0,invalid_destination&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         pc += jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         &#x2F;&#x2F; recurse to validate subroutine call&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         minSub, maxSub, deltaSub, err = validate(jumpdest, sp, rp)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         if err {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            return 0,0,0,err&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         subMin[pc] = minSub&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         subMax[pc] = maxSub&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         subDelta[pc] = deltaSub&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         minStack = min(minStack, sp)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         maxStack = max(maxStack, sp)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         pc = advancePC(pc)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      case RETURNSUB:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         maxStack = max(maxStack, sp)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         return minStack, maxStack, sp, nil&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &#x2F;&#x2F; The following are to be included only if we take&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &#x2F;&#x2F;    Option 2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &#x2F;&#x2F; and do not deprecate JUMP and JUMPI&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      case JUMP:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         &#x2F;&#x2F; pop jump destination&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         jumpdest = dataStack[--sp]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         if !valid_jumpdest(jumpdest) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            return 0,0,0,invalid_destination&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         pc = jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      case JUMPI:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         &#x2F;&#x2F; pop jump destination and conditional&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         jumpdest = dataStack[--sp]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         jumpif = dataStack[--sp]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         if sp &amp;lt; 0 {}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            return 0,0,0,stack_underflow&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         if !valid_jumpdest(jumpdest) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            return 0,0,0,invalid_destination&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         &#x2F;&#x2F; recurse to validate true side of conditional&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         if !isValidJumpdest(jumpdest) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            return 0,0,0,invalid_destination&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         maxLeft, err = validate(jumpdest, sp, rp)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         if err {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            return 0,0,0,err&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         &#x2F;&#x2F; recurse to validate false side of conditional&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         pc = advance_pc(pc)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         maxRight, err = validate(pc, sp, rp)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         if err {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            return 0,0,0,err&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         &#x2F;&#x2F; both sides valid, return max&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         maxStack += max(maxLeft, maxRight)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         return minStack, maxStack, sp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      case PUSH1 &amp;lt;= bytecode[pc] &amp;amp;&amp;amp; bytecode[pc] &amp;lt;= PUSH32 {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         sp++&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         if (sp &amp;gt; 1023) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            return 0,0,0,stack_overflow&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         maxStack = max(maxStack, sp)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         dataStack[sp] = immediateData(pc)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         pc = advancePC(pc)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      case DUP1 &amp;lt;= bytecode[pc] &amp;amp;&amp;amp; bytecode[pc] &amp;lt;= DUP32 {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         dup = sp - (bytecode[pc] - DUP1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         if dup &amp;lt; 0 {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            return 0,0,0,stack_underflow&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         sp++&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         if (sp &amp;gt; 1023) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            return 0,0,0,stack_overflow&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         maxStack = max(maxStack, sp)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         dataStack[sp] = dataStack[dup]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         pc = advancePC(pc)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      case SWAP1 &amp;lt;= bytecode[pc] &amp;amp;&amp;amp; bytecode[pc] &amp;lt;= SWAP32 {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         swap = sp - (bytecode[pc] - SWAP1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         if swap &amp;lt; 0 {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            return 0,0,0,stack_underflow&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         temp := dataStack[swap]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         dataStack[swap] = dataStack[0]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         dataStack[0] = temp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         pc = advancePC(pc)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      default:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         &#x2F;&#x2F; apply other instructions to stack pointer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         sp -= removed_items(pc)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         if (sp &amp;lt; 0) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            return 0,0,0,stack_underflow&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         minStack = min(minStack, sp)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         sp += added_items(pc)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         if (sp &amp;gt; 1023) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            return 0,0,0,stack_overflow&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         maxStack = max(maxStack, sp)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         pc = advancePC(pc)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   &#x2F;&#x2F; successful termination&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   return minStack, maxStack, sp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is intended to ensure an essential level of safety for EVM code deployed on the blockchain.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Compressed Integers</title>
        <published>2021-08-27T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Soham Zemse</name><uri>https://github.com/zemse</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3772/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/3772" />
        

        <id>https://wg-eips.ritovision.com/3772/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:3772"
            label="ERC-3772" />
        

        
        

        
        <summary type="html">Using lossy compression on uint256 to improve gas costs, ideally by a factor up to 4x.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3772/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This document specifies compression of &lt;code&gt;uint256&lt;&#x2F;code&gt; to smaller data structures like &lt;code&gt;uint64&lt;&#x2F;code&gt;, &lt;code&gt;uint96&lt;&#x2F;code&gt;, &lt;code&gt;uint128&lt;&#x2F;code&gt;, for optimizing costs for storage. The smaller data structure (represented as &lt;code&gt;cintx&lt;&#x2F;code&gt;) is divided into two parts, in the first one we store &lt;code&gt;significant&lt;&#x2F;code&gt; bits and in the other number of left &lt;code&gt;shift&lt;&#x2F;code&gt;s needed on the significant bits to decompress. This document also includes two specifications for decompression due to the nature of compression being lossy, i.e. it causes underflow.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Storage is costly, each storage slot costs almost $0.8 to initialize and $0.2 to update (20 gwei, 2000 ETHUSD).&lt;&#x2F;li&gt;
&lt;li&gt;Usually, we store money amounts in &lt;code&gt;uint256&lt;&#x2F;code&gt; which takes up one entire slot.&lt;&#x2F;li&gt;
&lt;li&gt;If it&#x27;s DAI value, the range we work with most is 0.001 DAI to 1T DAI (or 10&lt;sup&gt;12&lt;&#x2F;sup&gt;). If it&#x27;s ETH value, the range we work with most is 0.000001 ETH to 1B ETH. Similarly, any token of any scale has a reasonable range of 10&lt;sup&gt;15&lt;&#x2F;sup&gt; amounts that we care&#x2F;work with.&lt;&#x2F;li&gt;
&lt;li&gt;However, uint256 type allows us to represent $10&lt;sup&gt;-18&lt;&#x2F;sup&gt; to $10&lt;sup&gt;58&lt;&#x2F;sup&gt;, and most of it is a waste. In technical terms, we have the probability distribution for values larger than $10&lt;sup&gt;15&lt;&#x2F;sup&gt; and smaller than $10&lt;sup&gt;-3&lt;&#x2F;sup&gt; as negligible (i.e. P[val &amp;gt; 10&lt;sup&gt;15&lt;&#x2F;sup&gt;] ≈ 0 and P[val &amp;lt; 10&lt;sup&gt;-3&lt;&#x2F;sup&gt;] ≈ 0).&lt;&#x2F;li&gt;
&lt;li&gt;Number of bits required to represent 10&lt;sup&gt;15&lt;&#x2F;sup&gt; values = log&lt;sub&gt;2&lt;&#x2F;sub&gt;(10&lt;sup&gt;15&lt;&#x2F;sup&gt;) = 50 bits. So just 50 bits (instead of 256) are reasonably enough to represent a practical range of money, causing a very negligible difference.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;In this specification, the structure for representing a compressed value is represented using &lt;code&gt;cintx&lt;&#x2F;code&gt;, where x is the number of bits taken by the entire compressed value. On the implementation level, an &lt;code&gt;uintx&lt;&#x2F;code&gt; can be used for storing a &lt;code&gt;cintx&lt;&#x2F;code&gt; value.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;compression&quot;&gt;Compression&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;uint256-into-cint64-up-to-cint120&quot;&gt;uint256 into cint64 (up to cint120)&lt;&#x2F;h4&gt;
&lt;p&gt;The rightmost, or least significant, 8 bits in &lt;code&gt;cintx&lt;&#x2F;code&gt; are reserved for storing the shift and the rest available bits are used to store the significant bits starting from the first &lt;code&gt;1&lt;&#x2F;code&gt; bit in &lt;code&gt;uintx&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; cint64&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint56&lt;&#x2F;span&gt;&lt;span&gt; significant&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint8&lt;&#x2F;span&gt;&lt;span&gt; shift&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; cint120&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint112&lt;&#x2F;span&gt;&lt;span&gt; significant&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint8&lt;&#x2F;span&gt;&lt;span&gt; shift&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;uint256-into-cint128-up-to-cint248&quot;&gt;uint256 into cint128 (up to cint248)&lt;&#x2F;h4&gt;
&lt;p&gt;The rightmost, or least significant, 7 bits in &lt;code&gt;cintx&lt;&#x2F;code&gt; are reserved for storing the shift and the rest available bits are used to store the significant bits starting from the first one bit in &lt;code&gt;uintx&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;In the following code example, &lt;code&gt;uint7&lt;&#x2F;code&gt; is used just for representation purposes only, but it should be noted that uints in Solidity are in multiples of 8.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; cint128&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint121&lt;&#x2F;span&gt;&lt;span&gt; significant&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint7&lt;&#x2F;span&gt;&lt;span&gt; shift&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; cint248&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint241&lt;&#x2F;span&gt;&lt;span&gt; significant&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint7&lt;&#x2F;span&gt;&lt;span&gt; shift&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Examples:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Example:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;uint256 value: 2**100, binary repr: 1000000...(hundred zeros)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cint64 { significant: 10000000...(55 zeros), shift: 00101101 (45 in decimal)}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Example:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;uint256 value: 2**100-1, binary repr: 111111...(hundred ones)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cint64 { significant: 11111111...(56 ones), shift: 00101100 (44 in decimal) }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;decompression&quot;&gt;Decompression&lt;&#x2F;h3&gt;
&lt;p&gt;Two decompression methods are defined: a normal &lt;code&gt;decompress&lt;&#x2F;code&gt; and a &lt;code&gt;decompressRoundingUp&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;library&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CInt64&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; packs the uint256 amount into a cint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; compress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;cint64&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; unpacks cint64, by shifting the significant bits left by shift&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; decompress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;cint64&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; unpacks cint64, by shifting the significant bits left by shift&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; and having 1s in the shift bits&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; decompressRoundingUp&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;cint64&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;normal-decompression&quot;&gt;Normal Decompression&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;significant&lt;&#x2F;code&gt; bits in the &lt;code&gt;cintx&lt;&#x2F;code&gt; are moved to a &lt;code&gt;uint256&lt;&#x2F;code&gt; space and shifted left by &lt;code&gt;shift&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;NOTE: In the following example, cint16 is used for visual demonstration purposes. But it should be noted that it is definitely not safe for storing money amounts because its significant bits capacity is 8, while at least 50 bits are required for storing money amounts.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Example:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cint16{significant:11010111, shift:00000011}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;decompressed uint256: 11010111000 &#x2F;&#x2F; shifted left by 3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Example:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cint64 { significant: 11111111...(56 ones), shift: 00101100 (44 in decimal) }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;decompressed uint256: 1111...(56 ones)0000...(44 zeros)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;decompression-along-with-rounding-up&quot;&gt;Decompression along with rounding up&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;significant&lt;&#x2F;code&gt; bits in the &lt;code&gt;cintx&lt;&#x2F;code&gt; are moved to a &lt;code&gt;uint256&lt;&#x2F;code&gt; space and shifted left by &lt;code&gt;shift&lt;&#x2F;code&gt; and the least significant &lt;code&gt;shift&lt;&#x2F;code&gt; bits are &lt;code&gt;1&lt;&#x2F;code&gt;s.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Example:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cint16{significant:11011110, shift:00000011}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;decompressed rounded up value: 11011110111 &#x2F;&#x2F; shifted left by 3 and 1s instead of 0s&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Example:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cint64 { significant: 11111111...(56 ones), shift: 00101100 (44 in decimal) }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;decompressed uint256: 1111...(100 ones)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This specification is to be used by a new smart contract for managing its internal state so that any state mutating calls to it can be cheaper. These compressed values on a smart contract&#x27;s state are something that should not be exposed to the external world (other smart contracts or clients). A smart contract should expose a decompressed value if needed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;significant&lt;&#x2F;code&gt; bits are stored in the most significant part of &lt;code&gt;cintx&lt;&#x2F;code&gt; while &lt;code&gt;shift&lt;&#x2F;code&gt; bits in the least significant part, to help prevent obvious dev mistakes. For e.g. a number smaller than 2&lt;sup&gt;56&lt;&#x2F;sup&gt;-1 its compressed &lt;code&gt;cint64&lt;&#x2F;code&gt; value would be itself if the arrangement were to be opposite than specified. If a developer forgets to uncompress a value before using it, this case would still pass if the compressed value is the same as decompressed value.&lt;&#x2F;li&gt;
&lt;li&gt;It should be noted that using &lt;code&gt;cint64&lt;&#x2F;code&gt; doesn&#x27;t render gas savings automatically. The solidity compiler needs to pack more data into the same storage slot.&lt;&#x2F;li&gt;
&lt;li&gt;Also the packing and unpacking adds some small cost too.&lt;&#x2F;li&gt;
&lt;li&gt;Though this design can also be seen as a binary floating point representation, however using floating point numbers on EVM is not in the scope of this ERC. The primary goal of floating point numbers is to be able to represent a wider range in an available number of bits, while the goal of compression in this ERC is to keep as much precision as possible. Hence, it specifies for the use of minimum exponent&#x2F;shift bits (i.e 8 up to &lt;code&gt;uint120&lt;&#x2F;code&gt; and 7 up to &lt;code&gt;uint248&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; uses 3 slots&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UserData1&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint64&lt;&#x2F;span&gt;&lt;span&gt; amountCompressed&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; hash&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; beneficiary&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; uses 2 slots&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UserData2&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint64&lt;&#x2F;span&gt;&lt;span&gt; amountCompressed&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; beneficiary&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; hash&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;There are no known backward-incompatible issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;On the implementation level &lt;code&gt;uint64&lt;&#x2F;code&gt; may be used directly, or with custom types introduced in 0.8.9.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; compress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; full&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; cint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint8&lt;&#x2F;span&gt;&lt;span&gt; bits &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mostSignificantBitPosition&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;full&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;bits &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 55&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        cint &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;full&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bits &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 55&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        cint &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;full &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; bits&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; bits&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; decompress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; cint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; full&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint8&lt;&#x2F;span&gt;&lt;span&gt; bits &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint8&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;cint % &lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 9&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    full &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;cint &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; bits&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; decompressRoundingUp&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; cint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; full&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint8&lt;&#x2F;span&gt;&lt;span&gt; bits &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint8&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;cint % &lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 9&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    full &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;cint &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; bits &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; bits&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The above gist has &lt;code&gt;library CInt64&lt;&#x2F;code&gt; that contains demonstrative logic for compression, decompression, and arithmetic for &lt;code&gt;cint64&lt;&#x2F;code&gt;. The gist also has an example contract that uses the library for demonstration purposes.&lt;&#x2F;p&gt;
&lt;p&gt;The CInt64 format is intended only for storage, while dev should convert it to uint256 form using suitable logic (decompress or decompressRoundingUp) to perform any arithmetic on it.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The following security considerations are discussed:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Effects due to lossy compression
&lt;ul&gt;
&lt;li&gt;Error estimation for &lt;code&gt;cint64&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Handling the error&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Losing precision due to incorrect use of &lt;code&gt;cintx&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Compressing something other than money &lt;code&gt;uint256&lt;&#x2F;code&gt;s.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;1-effects-due-to-lossy-compression&quot;&gt;1. Effects due to lossy compression&lt;&#x2F;h3&gt;
&lt;p&gt;When a value is compressed, it causes underflow, i.e. some less significant bits are sacrificed. This results in a &lt;code&gt;cintx&lt;&#x2F;code&gt; value whose decompressed value is less than or equal to the actual &lt;code&gt;uint256&lt;&#x2F;code&gt; value.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt; a &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;100&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 100 # of 1s in binary format&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt; c &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; a&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;compress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;decompress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;a &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; c&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;a &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;100&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 56&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; c&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Visual example:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; before: 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; after:  1111111111111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;error-estimation-for-cint64&quot;&gt;Error estimation for cint64&lt;&#x2F;h4&gt;
&lt;p&gt;Let&#x27;s consider we have a &lt;code&gt;value&lt;&#x2F;code&gt; of the order 2&lt;sup&gt;m&lt;&#x2F;sup&gt; (less than 2&lt;sup&gt;m&lt;&#x2F;sup&gt; and greater than or equal to 2&lt;sup&gt;m-1&lt;&#x2F;sup&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;For all values such that 2&lt;sup&gt;m&lt;&#x2F;sup&gt; - 1 - (2&lt;sup&gt;m-56&lt;&#x2F;sup&gt; - 1) &amp;lt;= &lt;code&gt;value&lt;&#x2F;code&gt; &amp;lt;= 2&lt;sup&gt;m&lt;&#x2F;sup&gt; - 1, the compressed value &lt;code&gt;cvalue&lt;&#x2F;code&gt; is 2&lt;sup&gt;m&lt;&#x2F;sup&gt; - 1 - (2&lt;sup&gt;m-56&lt;&#x2F;sup&gt; - 1).&lt;&#x2F;p&gt;
&lt;p&gt;The maximum error is 2&lt;sup&gt;m-56&lt;&#x2F;sup&gt; - 1, approximating it to decimal: 10&lt;sup&gt;n-17&lt;&#x2F;sup&gt; (log&lt;sub&gt;2&lt;&#x2F;sub&gt;(56) is 17). Here &lt;code&gt;n&lt;&#x2F;code&gt; is number of decimal digits + 1.&lt;&#x2F;p&gt;
&lt;p&gt;For e.g. compressing a value of the order $1,000,000,000,000 (or 1T or 10&lt;sup&gt;12&lt;&#x2F;sup&gt;) to &lt;code&gt;cint64&lt;&#x2F;code&gt;, the maximum error turns out to be 10&lt;sup&gt;12+1-17&lt;&#x2F;sup&gt; = $10&lt;sup&gt;-4&lt;&#x2F;sup&gt; = $0.0001. This means the precision after 4 decimal places is lost, or we can say that the uncompressed value is at maximum $0.0001 smaller. Similarly, if someone is storing $1,000,000 into &lt;code&gt;cint64&lt;&#x2F;code&gt;, the uncompressed value would be at maximum $0.0000000001 smaller. In comparison, the storage costs are almost $0.8 to initialize and $0.2 to update (20 gwei, 2000 ETHUSD).&lt;&#x2F;p&gt;
&lt;h4 id=&quot;handling-the-error&quot;&gt;Handling the error&lt;&#x2F;h4&gt;
&lt;p&gt;Note that compression makes the value slightly smaller (underflow). But we also have another operation that also does that. In integer math, the division is a lossy operation (causing underflow). For instance,&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;10000001&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 5000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The result of the division operation is not always exact, but it&#x27;s smaller than the actual value, in some cases as in the above example. Though, most engineers try to reduce this effect by doing all the divisions at the end.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;1001 &#x2F; 2 * 301 == 150500 &#x2F;&#x2F; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;1001 * 301 &#x2F; 2 == 150650 &#x2F;&#x2F; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The division operation has been in use in the wild, and plenty of lossy integer divisions have taken place, causing DeFi users to get very very slightly less withdrawal amounts, which they don&#x27;t even notice. If been careful, then the risk is very negligible. Compression is similar, in the sense that it is also a division by 2&lt;sup&gt;shift&lt;&#x2F;sup&gt;. If been careful with this too, the effects are minimized.&lt;&#x2F;p&gt;
&lt;p&gt;In general, one should follow the rule:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;When a smart contract has to transfer a compressed amount to a user, they should use a rounded down value (by using &lt;code&gt;amount.decompress()&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;When a smart contract has to transferFrom a compressed amount from a user to itself, i.e charging for some bill, they should use a rounded up value (by using &lt;code&gt;amount.decompressUp()&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The above ensures that smart contract does not loose money due to the compression, it is the user who receives less funds or pays more funds. The extent of rounding is something that is negligible enough for the user. Also just to mention, this rounding up and down pattern is observed in many projects including UniswapV3.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;2-losing-precision-due-to-incorrect-use-of-cintx&quot;&gt;2. Losing precision due to incorrect use of &lt;code&gt;cintx&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;This is an example where dev errors while using compression can be a problem.&lt;&#x2F;p&gt;
&lt;p&gt;Usual user amounts mostly have an max entropy of 50, i.e. 10&lt;sup&gt;15&lt;&#x2F;sup&gt; (or 2&lt;sup&gt;50&lt;&#x2F;sup&gt;) values in use, that is the reason why we find uint56 enough for storing significant bits. However, let&#x27;s see an example:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span&gt; sharesC &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; reading compressed value from storage;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span&gt; price &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; CALL;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span&gt; amountC &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; sharesC&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;cmuldiv&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;price&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; PRICE_UNIT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;user&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;amountC&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;uncompress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The above code results in a serious precision loss. &lt;code&gt;sharesC&lt;&#x2F;code&gt; has an entropy of 50, as well as &lt;code&gt;priceC&lt;&#x2F;code&gt; also has an entropy of 50. When we multiply them, we get a value that contains entropies of both, and hence, an entropy of 100. After multiplication is done, &lt;code&gt;cmul&lt;&#x2F;code&gt; compresses the value, which drops the entropy of &lt;code&gt;amountC&lt;&#x2F;code&gt; to 56 (as we have uint56 there to store significant bits).&lt;&#x2F;p&gt;
&lt;p&gt;To prevent entropy&#x2F;precision from dropping, we get out from compression.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span&gt; sharesC &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; shares&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;compress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span&gt; priceC &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; price&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;compress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; amount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; sharesC&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;uncompress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; price &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; PRICE_UNIT&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;user&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Compression is only useful when writing to storage while doing arithmetic with them should be done very carefully.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;3-compressing-something-other-than-money-uint256s&quot;&gt;3. Compressing something other than money &lt;code&gt;uint256&lt;&#x2F;code&gt;s.&lt;&#x2F;h3&gt;
&lt;p&gt;Compressed Integers is intended to only compress money amount. Technically there are about 10&lt;sup&gt;77&lt;&#x2F;sup&gt; values that a &lt;code&gt;uint256&lt;&#x2F;code&gt; can store but most of those values have a flat distribution i.e. the probability is 0 or extremely negligible. (What is a probability that a user would be depositing 1000T DAI or 1T ETH to a contract? In normal circumstances it doesn&#x27;t happen, unless someone has full access to the mint function). Only the amounts that people work with have a non-zero distribution ($0.001 DAI to $1T or 10&lt;sup&gt;15&lt;&#x2F;sup&gt; to 10&lt;sup&gt;30&lt;&#x2F;sup&gt; in uint256). 50 bits are enough to represent this information, just to round it we use 56 bits for precision.&lt;&#x2F;p&gt;
&lt;p&gt;Using the same method for compressing something else which have a completely different probability distribution will likely result in a problem. It&#x27;s best to just not compress if you&#x27;re not sure about the distribution of values your &lt;code&gt;uint256&lt;&#x2F;code&gt; is going to take. And also, for things you think you are sure about using compression for, it&#x27;s better to give more thought if compression can result in edge cases (e.g. in previous multiplication example).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;4-compressing-stable-vs-volatile-money-amounts&quot;&gt;4. Compressing Stable vs Volatile money amounts&lt;&#x2F;h3&gt;
&lt;p&gt;Since we have a dynamic &lt;code&gt;uint8 shift&lt;&#x2F;code&gt; value that can move around. So even if you wanted to represent 1 Million SHIBA INU tokens or 0.0002 WBTC (both $10 as of this writing), cint64 will pick its top 56 significant bits which will take care of the value representation.&lt;&#x2F;p&gt;
&lt;p&gt;It can be a problem for volatile tokens if the coin is extremely volatile wrt user&#x27;s native currency. Imagine a very unlikely case where a coin goes 2&lt;sup&gt;56&lt;&#x2F;sup&gt;x up (price went up by 10&lt;sup&gt;16&lt;&#x2F;sup&gt; lol). In such cases &lt;code&gt;uint56&lt;&#x2F;code&gt; might not be enough as even its least significant bit is very valuable. If such insanely volatile tokens are to be stored, you should store more significant bits, i.e. using &lt;code&gt;cint96&lt;&#x2F;code&gt; or &lt;code&gt;cint128&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;cint64&lt;&#x2F;code&gt; has 56 bits for storing significant, when only 50 were required. Hence there are 6 extra bits, which means that it is fine if the $ value of the cryptocurrency stored in cint64 increases by 2&lt;sup&gt;6&lt;&#x2F;sup&gt; or 64x. If the value goes down it&#x27;s not a problem.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Chain-specific addresses</title>
        <published>2021-08-26T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Lukas Schor</name><uri>https://github.com/lukasschor</uri>
	</author>
	
	<author>
		<name>Richard Meissner</name><uri>https://github.com/rmeissner</uri>
	</author>
	
	<author>
		<name>Pedro Gomes</name><uri>https://github.com/pedrouid</uri>
	</author>
	
	<author>
		<name>ligi</name><email>ligi@ligi.de</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3770/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/chain-specific-addresses/6449" />
        

        <id>https://wg-eips.ritovision.com/3770/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:3770"
            label="ERC-3770" />
        

        
        

        
        <summary type="html">Prepending chain-specific addresses with a human-readable chain identifier</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3770/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3770&#x2F;&quot;&gt;ERC-3770&lt;&#x2F;a&gt; introduces a new address standard to be adapted by wallets and dApps to display chain-specific addresses by using a human-readable prefix.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The need for this proposal emerges from the increasing adoption of non-Ethereum Mainnet chains that use the Ethereum Virtual Machine (EVM). In this context, addresses become ambiguous, as the same address may refer to an EOA on chain X or a smart contract on chain Y. This will eventually lead to Ethereum users losing funds due to human error. For example, users sending funds to a smart contract wallet address which was not deployed on a particular chain.&lt;&#x2F;p&gt;
&lt;p&gt;Therefore we should prefix addresses with a unique identifier that signals to Dapps and wallets on what chain the target account is. In theory, this prefix could be a &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt; chainID. However, these chain IDs are not meant to be displayed to users in dApps or wallets, and they were optimized for developer interoperability, rather than human readability.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal extends addresses with a human-readable blockchain short name.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;syntax&quot;&gt;Syntax&lt;&#x2F;h3&gt;
&lt;p&gt;A chain-specific address is prefixed with a chain shortName, separated with a colon sign (:).&lt;&#x2F;p&gt;
&lt;p&gt;Chain-specific address = &quot;&lt;code&gt;shortName&lt;&#x2F;code&gt;&quot; &quot;&lt;code&gt;:&lt;&#x2F;code&gt;&quot; &quot;&lt;code&gt;address&lt;&#x2F;code&gt;&quot;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;shortName&lt;&#x2F;code&gt; = STRING&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;address&lt;&#x2F;code&gt; = STRING&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;semantics&quot;&gt;Semantics&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;shortName&lt;&#x2F;code&gt; is mandatory and MUST be a valid chain short name from https:&#x2F;&#x2F;github.com&#x2F;ethereum-lists&#x2F;chains&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;address&lt;&#x2F;code&gt; is mandatory and MUST be a &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;55&#x2F;&quot;&gt;ERC-55&lt;&#x2F;a&gt; compatible hexadecimal address&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;examples&quot;&gt;Examples&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3770&#x2F;.&#x2F;assets&#x2F;examples.png&quot; alt=&quot;Chain-specific addresses&quot; title=&quot;Examples of chain-specific addresses&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;To solve the initial problem of user-facing addresses being ambiguous in a multichain context, we need to map EIP-155 chain IDs with a user-facing format of displaying chain identifiers.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Ethereum addresses without the chain specifier will continue to require additional context to understand which chain the address refers to.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Similar looking chain short names can be used to confuse users.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>A Vanilla Non-Fungible Token Standard</title>
        <published>2021-08-21T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Simon Tian</name><uri>https://github.com/simontianx</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3754/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/3753" />
        

        <id>https://wg-eips.ritovision.com/3754/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:3754"
            label="ERC-3754" />
        

        
        

        
        <summary type="html">NFTs for representing abstract ownership</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3754/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;In this standard, a non-fungible token stands as atomic existence and encourages
layers of abstraction built on top of it. Ideal for representing concepts like
rights, a form of abstract ownership. Such right can take the form of NFT options,
oracle membership, virtual coupons, etc., and can then be made liquid because of
this tokenization.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Non-fungible tokens are popularized by the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; NFT standard
for representing &quot;ownership over digital or physical assets&quot;. Over the course of
development, reputable NFT projects are about crypto-assets, digital collectibles,
etc. The proposed standard aims to single out a special type of NFTs that are
ideal for representing abstract ownership such as rights. Examples include the
right of making a function call to a smart contract, an NFT option that gives
the owner the right, but not obligation, to purchase an ERC-721 NFT, and the prepaid
membership (time-dependent right) of accessing to data feeds provided by oracles
without having to pay the required token fees. An on-chain subscription business
model can then be made available by this standard. The conceptual clarity of an
NFT is hence improved by this standard.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;interface IERC3754 {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function balanceOf(address owner) external view returns (uint256);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function ownerOf(uint256 tokenId) external view returns (address);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function approve(address to, uint256 tokenId) external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function getApproved(uint256 tokenId) external view returns (address);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function setApprovalForAll(address operator, bool approved) external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function isApprovedForAll(address owner, address operator) external view returns (bool);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function transferFrom(address from, address to, uint256 tokenId) external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function safeTransferFrom(address from, address to, uint256 tokenId) external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The NFTs defined in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; standard are already largely
accepted and known as representing ownership of digital assets, and the NFTs by
this standard aim to be accepted and known as representing abstract ownership.
This is achieved by allowing and encouraging layers of abstract utilities built
on top of them. Ownership of such NFTs is equivalent with having the rights to
perform functions assigned to such tokens. Transfer of such rights is also made
easier because of this tokenization. To further distinguish this standard
from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;, data fields and functions related to &lt;code&gt;URI&lt;&#x2F;code&gt; are
excluded.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;There is no further backwards compatibility required.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;https:&#x2F;&#x2F;github.com&#x2F;simontianx&#x2F;ERC3754&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The security is enhanced from ERC721, given tokens are minted without having to
provide &lt;code&gt;URI&lt;&#x2F;code&gt;s. Errors in dealing with &lt;code&gt;URI&lt;&#x2F;code&gt;s can be avoided.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Gas Limit Cap</title>
        <published>2021-08-21T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>lightclient</name><uri>https://github.com/lightclient</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3756/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3756-gas-limit-cap/6921" />
        

        <id>https://wg-eips.ritovision.com/3756/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:3756"
            label="EIP-3756" />
        

        
        

        
        <summary type="html">Set an in-protocol cap for the gas limit</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3756/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Set an in-protocol cap for the gas limit of 30,000,000.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;A high gas limit increases pressure on the network. In the benign case, it
increases the size of the state and history faster than we can sustain. In the
malicious case, it amplifies the devastation of certain denial-of-service
attacks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;As of the fork block &lt;code&gt;N&lt;&#x2F;code&gt;, consider blocks with a &lt;code&gt;gas_limit&lt;&#x2F;code&gt; greater than
&lt;code&gt;30,000,000&lt;&#x2F;code&gt; invalid.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-cap-the-gas-limit&quot;&gt;Why Cap the Gas Limit&lt;&#x2F;h3&gt;
&lt;p&gt;The gas limit is currently under the control of block proposers. They have the
ability to increase the gas limit to whatever value they desire. This allows
them to bypass the EIP and All Core Devs processes in protocol decisions that
may negatively affect the security and&#x2F;or decentralization of the network.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;no-fixed-gas-limit&quot;&gt;No Fixed Gas Limit&lt;&#x2F;h3&gt;
&lt;p&gt;A valuable property of proposers choosing the gas limit is they can scale it
down quickly if the network becomes unstable or is undergoing certain types of
attacks. For this reason, we maintain their ability to lower the gas limit
&lt;em&gt;below&lt;&#x2F;em&gt; 30,000,000.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backwards compatibility issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;No security considerations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Remove Support for Type 1 Transactions</title>
        <published>2021-08-07T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Gregory Markou</name><uri>https://github.com/GregTheGreek</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3709/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3709-deprecate-type-1-transactions/6810" />
        

        <id>https://wg-eips.ritovision.com/3709/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="interface"
                label="Interface" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:3709"
            label="EIP-3709" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3709/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Deprecates usage of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; &lt;code&gt;TransactionType&lt;&#x2F;code&gt; 1 in wallets and providers, upgrading all type 1 transactions to a type 2 transaction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Since both &lt;code&gt;TransactionType&lt;&#x2F;code&gt; 1 and 2 contain &lt;code&gt;access_list&lt;&#x2F;code&gt;, we propose the removal of offering &lt;code&gt;TransactionType&lt;&#x2F;code&gt; 1 from wallets and providers, instead the transaction will be converted to &lt;code&gt;TransactionType&lt;&#x2F;code&gt; 2 to make use of the new gas properties introduced by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930&lt;&#x2F;a&gt; was introduced as the first &lt;code&gt;TransactionType&lt;&#x2F;code&gt;, type 1, with the intention of adding &lt;code&gt;access_list&lt;&#x2F;code&gt; to the &lt;code&gt;TransactionPayload&lt;&#x2F;code&gt;. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; introduced the second &lt;code&gt;TransactionType&lt;&#x2F;code&gt; 2, which is represented as &lt;code&gt;rlp([chain_id, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit, destination, amount, data, access_list, signature_y_parity, signature_r, signature_s])&lt;&#x2F;code&gt;. The intention behind EIP-1559 was to enhance the user experience surrounding gas fees, and as we move forward we expect that the majority of the network will begin to using &lt;code&gt;TransactionType&lt;&#x2F;code&gt; 2 instead of the legacy style transactions. &lt;code&gt;TransactionType&lt;&#x2F;code&gt; 1 is a legacy transaction with the addition of &lt;code&gt;access_list&lt;&#x2F;code&gt; meaning that users will not benefit from enhancements made by EIP-1559. &lt;code&gt;TransactionType&lt;&#x2F;code&gt; 2 contains &lt;code&gt;access_list&lt;&#x2F;code&gt;, thus there is no reason to further support &lt;code&gt;TransactionType&lt;&#x2F;code&gt; 1 if the end goal is to push users towards using &lt;code&gt;TransactionType&lt;&#x2F;code&gt; 2 anyway.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;For wallets and providers, if a user submits a transaction for signing with where &lt;code&gt;TransactionType == 0x1&lt;&#x2F;code&gt;, the developer should upgrade the transaction to meet the criteria of transaction of type 2.&lt;&#x2F;p&gt;
&lt;p&gt;The following fields need to be changed, or amended:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;access_list&lt;&#x2F;code&gt;: Nothing changes and it should remain in the transaction.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;type&lt;&#x2F;code&gt;: Should change from &lt;code&gt;0x1&lt;&#x2F;code&gt; to &lt;code&gt;0x2&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;gas_price&lt;&#x2F;code&gt;: Should be removed in favour of &lt;code&gt;max_fee_per_gas&lt;&#x2F;code&gt; &amp;amp; &lt;code&gt;max_priority_fee_per_gas&lt;&#x2F;code&gt; (see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; for proper usage).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Improve the user experience for submitting transactions, and move away from legacy style transactions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;There are no known security considerations at this time.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Poster</title>
        <published>2021-07-31T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Auryn Macmillan</name><uri>https://github.com/auryn-macmillan</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3722/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-poster-a-ridiculously-simple-general-purpose-social-media-smart-contract/6751" />
        

        <id>https://wg-eips.ritovision.com/3722/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:3722"
            label="ERC-3722" />
        

        
        

        
        <summary type="html">A ridiculously simple general purpose social media smart contract.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3722/">&lt;h1 id=&quot;poster&quot;&gt;Poster&lt;&#x2F;h1&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;A ridiculously simple general purpose social media smart contract.
It takes two strings (&lt;code&gt;content&lt;&#x2F;code&gt; and &lt;code&gt;tag&lt;&#x2F;code&gt;) as parameters and emits those strings, along with msg.sender, as an event. That&#x27;s it.
The EIP also includes a proposed standard json format for a Twitter-like application, where each &lt;code&gt;post()&lt;&#x2F;code&gt; call can include multiple posts and&#x2F;or operations. The assumption being that application state will be constructed off-chain via some indexer.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Poster is intended to be used as a base layer for decentralized social media. It can be deployed to the same address (via the singleton factory) on just about any EVM compatible network. Any Ethereum account can make posts to the deployment of Poster on its local network.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;contract&quot;&gt;Contract&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Poster&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NewPost&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; content&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tag&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; post&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; content&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tag&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NewPost&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; content&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tag&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;abi&quot;&gt;ABI&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;anonymous&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;internalType&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;user&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;internalType&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;content&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;internalType&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;tag&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;NewPost&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;internalType&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;content&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;internalType&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;tag&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;post&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;outputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;stateMutability&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;nonpayable&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;standard-json-format-for-twitter-like-posts&quot;&gt;Standard json format for Twitter-like posts&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;content&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;microblog&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;text&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;this is the first post in a thread&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;microblog&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;text&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;this is the second post in a thread&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;replyTo&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;this[0]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;microblog&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;text&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;this is a reply to some other post&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;replyTo&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;some_post_id&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;microblog&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;text&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;this is a post with an image&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;image&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ipfs:&#x2F;&#x2F;ipfs_hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;microblog&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;text&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;this post replaces a previously posted post&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;edit&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;some_post_id&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;delete&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;target&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;some_post_id&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;like&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;target&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;some_post_id&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;repost&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;target&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;some_post_id&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;follow&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;target&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;some_account&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;unfollow&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;target&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;some_account&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;block&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;target&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;some_account&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;report&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;target&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;some_account or some_post_id&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;permissions&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;account&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;account_to_set_permissions&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;permissions&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;post&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;delete&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;like&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;follow&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;block&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;report&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;permissions&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;microblog&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;text&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;This is a post from an account with permissions to post on behalf of another account.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;from&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;from_address&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;There was some discussion around whether or not an post ID should also be emitted, whether the content should be a string or bytes, and whether or not anything at all should actually be emitted.&lt;&#x2F;p&gt;
&lt;p&gt;We decided not to emit an ID, since it meant adding state or complexity to the contract and there is a fairly common pattern of assigning IDs on the indexer layer based on transactionHash + logIndex.&lt;&#x2F;p&gt;
&lt;p&gt;We decided to emit a string, rather than bytes, simply because that would make content human readable on many existing interfaces, like Etherscan for example. This did, unfortunately, eliminate some of the benefit that we might have gotten from a more compact encoding scheme like CBOR, rather than JSON. But this also would not have satisfied the human readable criteria.&lt;&#x2F;p&gt;
&lt;p&gt;While there would have been some gas savings if we decided against emitting anything at all, it would have redically increased the node requirements to index posts. As such, we decided it was worth the extra gas to actually emit the content.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Poster has been deployed at &lt;code&gt;0x000000000000cd17345801aa8147b8D3950260FF&lt;&#x2F;code&gt; on multiple networks using the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-2470&quot;&gt;Singleton Factory&lt;&#x2F;a&gt;. If it is not yet deployed on your chosen network, you can use the Singleton Factory to deploy an instance of Poster at the same address on just about any EVM compatible network using these parameters:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;initCode:&lt;&#x2F;strong&gt; &lt;code&gt;0x608060405234801561001057600080fd5b506101f6806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c80630ae1b13d14610030575b600080fd5b61004361003e3660046100fa565b610045565b005b8181604051610055929190610163565b60405180910390203373ffffffffffffffffffffffffffffffffffffffff167f6c7f3182d7e4cb876251f9ae1489975fdbbf15d9f35d393f2ac9b1ff57cec69f86866040516100a5929190610173565b60405180910390a350505050565b60008083601f8401126100c4578182fd5b50813567ffffffffffffffff8111156100db578182fd5b6020830191508360208285010111156100f357600080fd5b9250929050565b6000806000806040858703121561010f578384fd5b843567ffffffffffffffff80821115610126578586fd5b610132888389016100b3565b9096509450602087013591508082111561014a578384fd5b50610157878288016100b3565b95989497509550505050565b6000828483379101908152919050565b60006020825282602083015282846040840137818301604090810191909152601f9092017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016010191905056fea2646970667358221220ee0377bd266748c5dbaf0a3f15ebd97be153932f2d14d460d9dd4271fee541b564736f6c63430008000033&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;salt:&lt;&#x2F;strong&gt; &lt;code&gt;0x9245db59943806d06245bc7847b3efb2c899d11b621a0f01bb02fd730e33aed2&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;When verifying on the source code on a block explorer, make sure to set the optimizer to &lt;code&gt;yes&lt;&#x2F;code&gt; and the runs to &lt;code&gt;10000000&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The source code is available in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ETHPoster&#x2F;contract&#x2F;blob&#x2F;master&#x2F;contracts&#x2F;Poster.sol&quot;&gt;Poster contract repo&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Given the ridiculously simple implementation of Poster, there does not appear to be any real security concerns at the contract level.&lt;&#x2F;p&gt;
&lt;p&gt;At the application level, clients should confirm that posts including a &lt;code&gt;&quot;from&quot;&lt;&#x2F;code&gt; field that differs from &lt;code&gt;msg.sender&lt;&#x2F;code&gt; have been authorized by the &lt;code&gt;&quot;from&quot;&lt;&#x2F;code&gt; address via a &lt;code&gt;&quot;permissions&quot;&lt;&#x2F;code&gt; post, otherwise they should be considerred invalid or a post from &lt;code&gt;msg.sender&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Clients should also be sure to sanitize post data.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Upgrade consensus to Proof-of-Stake</title>
        <published>2021-07-22T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Mikhail Kalinin</name><uri>https://github.com/mkalinin</uri>
	</author>
	
	<author>
		<name>Danny Ryan</name><uri>https://github.com/djrtwo</uri>
	</author>
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3675/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3675-upgrade-consensus-to-proof-of-stake/6706" />
        

        <id>https://wg-eips.ritovision.com/3675/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:3675"
            label="EIP-3675" />
        

        
        

        
        <summary type="html">Specification of the consensus mechanism upgrade on Ethereum Mainnet that introduces Proof-of-Stake</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3675/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP deprecates Proof-of-Work (PoW) and supersedes it with the new Proof-of-Stake consensus mechanism (PoS) driven by the beacon chain. Information on the bootstrapping of the new consensus mechanism is documented in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2982&#x2F;&quot;&gt;EIP-2982&lt;&#x2F;a&gt;. Full specification of the beacon chain can be found in the &lt;code&gt;ethereum&#x2F;consensus-specs&lt;&#x2F;code&gt; repository.&lt;&#x2F;p&gt;
&lt;p&gt;This document specifies the set of changes to the block structure, block processing, fork choice rule and network interface introduced by the consensus upgrade.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The beacon chain network has been up and running since December 2020. Neither safety nor liveness failures were detected during this period of time. This long period of running without failure demonstrates the sustainability of the beacon chain system and its readiness to become a security provider for the Ethereum Mainnet.&lt;&#x2F;p&gt;
&lt;p&gt;To understand the motivation of introducing the Proof-of-Stake consensus see the Motivation section of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2982&#x2F;#motivation&quot;&gt;EIP-2982&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;PoW block&lt;&#x2F;strong&gt;: Block that is built and verified by the existing proof-of-work mechanism. In other words, a block of the Ethereum network before the consensus upgrade.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;PoS block&lt;&#x2F;strong&gt;: Block that is built and verified by the new proof-of-stake mechanism.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Terminal PoW block&lt;&#x2F;strong&gt;: A PoW block that satisfies the following conditions --
&lt;code&gt;pow_block.total_difficulty &amp;gt;= TERMINAL_TOTAL_DIFFICULTY&lt;&#x2F;code&gt; &lt;em&gt;and&lt;&#x2F;em&gt; &lt;code&gt;pow_block.parent_block.total_difficulty &amp;lt; TERMINAL_TOTAL_DIFFICULTY&lt;&#x2F;code&gt;.
There can be more than one terminal PoW block in the network, e.g. multiple children of the same pre-terminal block.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;TERMINAL_TOTAL_DIFFICULTY&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; The amount of total difficulty reached by the network that triggers the consensus upgrade. Ethereum Mainnet configuration &lt;strong&gt;MUST&lt;&#x2F;strong&gt; have this parameter set to the value &lt;code&gt;58750000000000000000000&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;TRANSITION_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; The earliest PoS block of the canonical chain, i.e. the PoS block with the lowest block height.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;POS_FORKCHOICE_UPDATED&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; An event occurring when the state of the proof-of-stake fork choice is updated.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;FORK_NEXT_VALUE&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; A block number set to the &lt;code&gt;FORK_NEXT&lt;&#x2F;code&gt; parameter for the upcoming consensus upgrade.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;TERMINAL_BLOCK_HASH&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; Designates the hash of the terminal PoW block if set, i.e. if not stubbed with &lt;code&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;TERMINAL_BLOCK_NUMBER&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; Designates the number of the terminal PoW block if &lt;code&gt;TERMINAL_BLOCK_HASH&lt;&#x2F;code&gt; is set.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;pos-events&quot;&gt;PoS events&lt;&#x2F;h4&gt;
&lt;p&gt;Events having the &lt;code&gt;POS_&lt;&#x2F;code&gt; prefix in the name (PoS events) are emitted by the new proof-of-stake consensus mechanism. They signify the corresponding assertion that has been made regarding a block specified by the event. The underlying logic of PoS events can be found in the beacon chain specification. On the occurrence of each PoS event the corresponding action that is specified by this EIP &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be taken.&lt;&#x2F;p&gt;
&lt;p&gt;The details provided below must be taken into account when reading those parts of the specification that refer to the PoS events:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Reference to a block that is contained by PoS events is provided in a form of a block hash unless another is explicitly specified.&lt;&#x2F;li&gt;
&lt;li&gt;A &lt;code&gt;POS_FORKCHOICE_UPDATED&lt;&#x2F;code&gt; event contains references to the head of the canonical chain and to the most recent finalized block. Before the first finalized block occurs in the system the finalized block hash provided by this event is stubbed with &lt;code&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;FIRST_FINALIZED_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; The first finalized block that is designated by &lt;code&gt;POS_FORKCHOICE_UPDATED&lt;&#x2F;code&gt; event and has the hash that differs from the stub.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;client-software-configuration&quot;&gt;Client software configuration&lt;&#x2F;h3&gt;
&lt;p&gt;The following set of parameters is a part of client software configuration and &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be included into its binary distribution:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;TERMINAL_TOTAL_DIFFICULTY&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;FORK_NEXT_VALUE&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TERMINAL_BLOCK_HASH&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TERMINAL_BLOCK_NUMBER&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;Note&lt;&#x2F;em&gt;: If &lt;code&gt;TERMINAL_BLOCK_HASH&lt;&#x2F;code&gt; is stubbed with &lt;code&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;code&gt; then &lt;code&gt;TERMINAL_BLOCK_HASH&lt;&#x2F;code&gt; and &lt;code&gt;TERMINAL_BLOCK_NUMBER&lt;&#x2F;code&gt; parameters &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; take an effect.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;pow-block-processing&quot;&gt;PoW block processing&lt;&#x2F;h3&gt;
&lt;p&gt;PoW blocks that are descendants of any terminal PoW block &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; be imported. This implies that a terminal PoW block will be the last PoW block in the canonical chain.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;&lt;code&gt;MAX_EXTRA_DATA_BYTES&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;32&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;block-structure&quot;&gt;Block structure&lt;&#x2F;h3&gt;
&lt;p&gt;Beginning with &lt;code&gt;TRANSITION_BLOCK&lt;&#x2F;code&gt;, a number of previously dynamic block fields are deprecated by enforcing these values to instead be constants. Each block field listed in the table below &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be replaced with the corresponding constant value.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Field&lt;&#x2F;th&gt;&lt;th&gt;Constant value&lt;&#x2F;th&gt;&lt;th&gt;Comment&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;&lt;code&gt;ommersHash&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;= Keccak256(RLP([]))&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;&lt;code&gt;difficulty&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;&lt;code&gt;mixHash&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;&lt;code&gt;nonce&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x0000000000000000&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;&lt;code&gt;ommers&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;[]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;RLP([]) = 0xc0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Beginning with &lt;code&gt;TRANSITION_BLOCK&lt;&#x2F;code&gt;, the validation of the block&#x27;s &lt;strong&gt;&lt;code&gt;extraData&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; field changes: The length of the block&#x27;s &lt;strong&gt;&lt;code&gt;extraData&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be less than or equal to &lt;strong&gt;&lt;code&gt;MAX_EXTRA_DATA_BYTES&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; bytes.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Note&lt;&#x2F;em&gt;: Logic and validity conditions of block fields that are &lt;em&gt;not&lt;&#x2F;em&gt; specified here &lt;strong&gt;MUST&lt;&#x2F;strong&gt; remain unchanged. Additionally, the overall block format &lt;strong&gt;MUST&lt;&#x2F;strong&gt; remain unchanged.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Note&lt;&#x2F;em&gt;: Subsequent EIPs may override the constant values specified above to provide additional functionality. For an example, see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4399&#x2F;&quot;&gt;EIP-4399&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;block-validity&quot;&gt;Block validity&lt;&#x2F;h3&gt;
&lt;p&gt;Beginning with &lt;code&gt;TRANSITION_BLOCK&lt;&#x2F;code&gt;, the block validity conditions &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be altered by the following:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Remove verification of the block&#x27;s &lt;strong&gt;&lt;code&gt;difficulty&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; value with respect to the difficulty formula.&lt;&#x2F;li&gt;
&lt;li&gt;Remove verification of the block&#x27;s &lt;strong&gt;&lt;code&gt;nonce&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; and &lt;strong&gt;&lt;code&gt;mixHash&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; values with respect to the Ethash function.&lt;&#x2F;li&gt;
&lt;li&gt;Remove all validation rules that are evaluated over the list of ommers and each member of this list.&lt;&#x2F;li&gt;
&lt;li&gt;Add verification of the fields noted in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3675&#x2F;#block-structure&quot;&gt;block structure&lt;&#x2F;a&gt; section.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;Note&lt;&#x2F;em&gt;: If one of the new rules fails then the block &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be invalidated.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Note&lt;&#x2F;em&gt;: Validity rules that are not specified in the list above &lt;strong&gt;MUST&lt;&#x2F;strong&gt; remain unchanged.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;transition-block-validity&quot;&gt;Transition block validity&lt;&#x2F;h4&gt;
&lt;p&gt;In addition to satisfying the above conditions, &lt;code&gt;TRANSITION_BLOCK&lt;&#x2F;code&gt; &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be a child of a terminal PoW block. That is, a parent of &lt;code&gt;TRANSITION_BLOCK&lt;&#x2F;code&gt; &lt;strong&gt;MUST&lt;&#x2F;strong&gt; satisfy terminal PoW block conditions.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;block-and-ommer-rewards&quot;&gt;Block and ommer rewards&lt;&#x2F;h3&gt;
&lt;p&gt;Beginning with &lt;code&gt;TRANSITION_BLOCK&lt;&#x2F;code&gt;, block and ommer rewards are deprecated. Specifically, the following actions &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be taken:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Remove increasing the balance of the block&#x27;s &lt;strong&gt;&lt;code&gt;beneficiary&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; account by the block reward.&lt;&#x2F;li&gt;
&lt;li&gt;Remove increasing the balance of the block&#x27;s &lt;strong&gt;&lt;code&gt;beneficiary&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; account by the ommer inclusion reward per each ommer.&lt;&#x2F;li&gt;
&lt;li&gt;Remove increasing the balance of the ommer&#x27;s &lt;strong&gt;&lt;code&gt;beneficiary&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; account by the ommer block reward per each ommer.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;Note&lt;&#x2F;em&gt;: Transaction fee mechanics affecting the block&#x27;s &lt;code&gt;beneficiary&lt;&#x2F;code&gt; account &lt;strong&gt;MUST&lt;&#x2F;strong&gt; remain unchanged.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;fork-choice-rule&quot;&gt;Fork choice rule&lt;&#x2F;h3&gt;
&lt;p&gt;If set, &lt;code&gt;TERMINAL_BLOCK_HASH&lt;&#x2F;code&gt; parameter affects the PoW heaviest chain rule in the following way:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Canonical blockchain &lt;strong&gt;MUST&lt;&#x2F;strong&gt; contain a block with the hash defined by &lt;code&gt;TERMINAL_BLOCK_HASH&lt;&#x2F;code&gt; parameter at the height defined by &lt;code&gt;TERMINAL_BLOCK_NUMBER&lt;&#x2F;code&gt; parameter.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;Note&lt;&#x2F;em&gt;: This rule is akin to block hash whitelisting functionality already present in client software implementations.&lt;&#x2F;p&gt;
&lt;p&gt;As of the first &lt;code&gt;POS_FORKCHOICE_UPDATED&lt;&#x2F;code&gt; event, the fork choice rule &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be altered in the following way:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Remove the existing PoW heaviest chain rule.&lt;&#x2F;li&gt;
&lt;li&gt;Adhere to the new PoS LMD-GHOST rule.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The new PoS LMD-GHOST fork choice rule is specified as follows. On each occurrence of a &lt;code&gt;POS_FORKCHOICE_UPDATED&lt;&#x2F;code&gt; event including the first one, the following actions &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be taken:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Consider the chain starting at genesis and ending with the head block nominated by the event as the canonical blockchain.&lt;&#x2F;li&gt;
&lt;li&gt;Set the head of the canonical blockchain to the corresponding block nominated by the event.&lt;&#x2F;li&gt;
&lt;li&gt;Beginning with the &lt;code&gt;FIRST_FINALIZED_BLOCK&lt;&#x2F;code&gt;, set the most recent finalized block to the corresponding block nominated by the event.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Changes to the block tree store that are related to the above actions &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be applied atomically.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Note&lt;&#x2F;em&gt;: This rule &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be strictly enforced. &quot;Optimistic&quot; updates to the head &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; be made. That is -- if a new block is processed on top of the current head block, this new block becomes the new head if and only if an accompanying &lt;code&gt;POS_FORKCHOICE_UPDATED&lt;&#x2F;code&gt; event occurs.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;network&quot;&gt;Network&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;fork-identifier&quot;&gt;Fork identifier&lt;&#x2F;h4&gt;
&lt;p&gt;For the purposes of the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2124&#x2F;&quot;&gt;EIP-2124&lt;&#x2F;a&gt; fork identifier, nodes implementing this EIP &lt;strong&gt;MUST&lt;&#x2F;strong&gt; set the &lt;code&gt;FORK_NEXT&lt;&#x2F;code&gt; parameter to the &lt;code&gt;FORK_NEXT_VALUE&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;devp2p&quot;&gt;devp2p&lt;&#x2F;h4&gt;
&lt;p&gt;The networking stack &lt;strong&gt;SHOULD NOT&lt;&#x2F;strong&gt; send the following messages if they advertise the descendant of any terminal PoW block:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;NewBlockHashes (0x01)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;NewBlock (0x07)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Beginning with receiving the &lt;code&gt;FIRST_FINALIZED_BLOCK&lt;&#x2F;code&gt;, the networking stack &lt;strong&gt;MUST&lt;&#x2F;strong&gt; discard the following ingress messages:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;NewBlockHashes (0x01)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;NewBlock (0x07)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Beginning with receiving the finalized block next to the &lt;code&gt;FIRST_FINALIZED_BLOCK&lt;&#x2F;code&gt;, the networking stack &lt;strong&gt;MUST&lt;&#x2F;strong&gt; remove the handlers corresponding to the following messages:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;NewBlockHashes (0x01)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;NewBlock (0x07)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Peers that keep sending these messages after the handlers have been removed &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; be disconnected.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Note:&lt;&#x2F;em&gt; The logic of message handlers that are not affected by this section &lt;strong&gt;MUST&lt;&#x2F;strong&gt; remain unchanged.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The changes specified in this EIP target a minimal requisite set of consensus and client software modifications to safely replace the existing proof-of-work consensus algorithm with the new proof-of-stake consensus represented by the already in-production beacon chain.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP was designed to minimize the complexity of hot-swapping the live consensus of the Ethereum network. Both the safety of the operation and time to production were taken into consideration. Additionally, a minimal changeset helps ensure that &lt;em&gt;most&lt;&#x2F;em&gt; smart contracts and services will continue to function as intended during and after the transition with little to no required intervention.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;total-difficulty-triggering-the-upgrade&quot;&gt;Total difficulty triggering the upgrade&lt;&#x2F;h3&gt;
&lt;p&gt;See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3675&#x2F;#terminal-total-difficulty-vs-block-number&quot;&gt;Security considerations&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parameterizing-terminal-block-hash&quot;&gt;Parameterizing terminal block hash&lt;&#x2F;h3&gt;
&lt;p&gt;See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3675&#x2F;#terminal-pow-block-overriding&quot;&gt;Security considerations&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;halting-the-import-of-pow-blocks&quot;&gt;Halting the import of PoW blocks&lt;&#x2F;h3&gt;
&lt;p&gt;See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3675&#x2F;#halt-the-importing-of-pow-blocks&quot;&gt;Security considerations&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;replacing-block-fields-with-constants&quot;&gt;Replacing block fields with constants&lt;&#x2F;h3&gt;
&lt;p&gt;Deprecated block fields are replaced with constant values to ensure the block format remains backwards compatible. Preserving the block format aids existing smart contracts and services in providing uninterrupted service during and after this transition.&lt;&#x2F;p&gt;
&lt;p&gt;Particularly, this is important for those smart contracts that verify Merkle proofs of transaction&#x2F;receipt inclusion and state by validating the hash of externally provided block header against the corresponding value returned by the &lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt; operation.&lt;&#x2F;p&gt;
&lt;p&gt;This change introduces an additional validity rule that enforces the replacement of deprecated block fields.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;replacing-difficulty-with-0&quot;&gt;Replacing &lt;code&gt;difficulty&lt;&#x2F;code&gt; with &lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;After deprecating the proof-of-work the notion of difficulty no longer exists and replacing the block header &lt;strong&gt;&lt;code&gt;difficulty&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; field with &lt;code&gt;0&lt;&#x2F;code&gt; constant is semantically sound.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;changing-block-validity-rules&quot;&gt;Changing block validity rules&lt;&#x2F;h3&gt;
&lt;p&gt;The rule set enforcing the PoW seal validity is replaced with the corresponding PoS rules along with the consensus upgrade as the rationale behind this change.&lt;&#x2F;p&gt;
&lt;p&gt;An additional rule validating a set of deprecated block fields is required by the block format changes introduced by this specification.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;removing-block-rewards&quot;&gt;Removing block rewards&lt;&#x2F;h3&gt;
&lt;p&gt;Existing rewards for producing and sealing blocks are deprecated along with the PoW mechanism. The new PoS consensus becomes both responsible for sealing blocks and for issuing block rewards once this specification enters into effect.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;supplanting-fork-choice-rule&quot;&gt;Supplanting fork choice rule&lt;&#x2F;h3&gt;
&lt;p&gt;The fork choice rule of the PoW mechanism becomes completely irrelevant after the upgrade and is replaced with the corresponding rule of the new PoS consensus mechanism.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;remove-of-pos-consensus-validated&quot;&gt;Remove of &lt;code&gt;POS_CONSENSUS_VALIDATED&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;In prior draft versions of this EIP, an additional POS event -- &lt;code&gt;POS_CONSENSUS_VALIDATED&lt;&#x2F;code&gt; -- was required as a validation condition for blocks. This event gave the signal to either fully incorporate or prune the block from the block tree.&lt;&#x2F;p&gt;
&lt;p&gt;This event was removed for two reasons:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;This event was an unnecessary optimization to allow for pruning of &quot;bad&quot; blocks from the block tree. This optimization was unnecessary because the PoS consensus would never send &lt;code&gt;POS_FORKCHOICE_UPDATED&lt;&#x2F;code&gt; for any such bad blocks or their descendants, and eventually any such blocks would be able to be pruned after a PoS finality event of an alternative branch in the block tree.&lt;&#x2F;li&gt;
&lt;li&gt;This event was dangerous in some scenarios because a block could be referenced by two &lt;em&gt;different&lt;&#x2F;em&gt; and conflicting PoS branches. Thus for the same block in some scenarios, both a &lt;code&gt;POS_CONSENSUS_VALIDATED == TRUE&lt;&#x2F;code&gt; and &lt;code&gt;POS_CONSENSUS_VALIDATED == FALSE&lt;&#x2F;code&gt; event could sent, entirely negating the ability to safely perform the optimization in (1).&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;eip-2124-fork-identifier&quot;&gt;EIP-2124 fork identifier&lt;&#x2F;h3&gt;
&lt;p&gt;The value of &lt;code&gt;FORK_NEXT&lt;&#x2F;code&gt; in EIP-2124 refers to the block number of the next fork a given node knows about and &lt;code&gt;0&lt;&#x2F;code&gt; otherwise.&lt;&#x2F;p&gt;
&lt;p&gt;The number of &lt;code&gt;TRANSITION_BLOCK&lt;&#x2F;code&gt; cannot be known ahead of time given the dynamic nature of the transition trigger condition. As the block will not be known a priori, nodes can&#x27;t use its number for &lt;code&gt;FORK_NEXT&lt;&#x2F;code&gt; and in light of this fact an explicitly set &lt;code&gt;FORK_NEXT_VALUE&lt;&#x2F;code&gt; is used instead.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;removing-block-gossip&quot;&gt;Removing block gossip&lt;&#x2F;h3&gt;
&lt;p&gt;After the upgrade of the consensus mechanism only the beacon chain network will have enough information to validate a block. Thus, block gossip provided by the &lt;code&gt;eth&lt;&#x2F;code&gt; network protocol will become unsafe and is deprecated in favour of the block gossip existing in the beacon chain network.&lt;&#x2F;p&gt;
&lt;p&gt;It is recommended for the client software to not propagate descendants of any terminal PoW block to reduce the load on processing the P2P component and stop operating in the environment with unknown security properties.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;restricting-the-length-of-extradata&quot;&gt;Restricting the length of &lt;code&gt;extraData&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;extraData&lt;&#x2F;code&gt; field is defined as a maximum of &lt;code&gt;32&lt;&#x2F;code&gt; bytes in the yellow paper. Thus mainnet and most PoW testnets cap the value at &lt;code&gt;32&lt;&#x2F;code&gt; bytes.  &lt;code&gt;extraData&lt;&#x2F;code&gt; fields of greater length are used by clique testnets and other networks to carry special signature&#x2F;consensus schemes. This EIP restricts the length of &lt;code&gt;extraData&lt;&#x2F;code&gt; to &lt;code&gt;32&lt;&#x2F;code&gt; bytes because any network that is transitioning from another consensus mechanism to a beacon chain PoS consensus mechanism no longer needs extended or unbounded &lt;code&gt;extraData&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces backward incompatibilities in block validity, block rewards and fork choice rule.&lt;&#x2F;p&gt;
&lt;p&gt;The design of the consensus upgrade specified by this document does not introduce backward incompatibilities for existing applications and services built on top of Ethereum except for those that are described in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3675&#x2F;#evm&quot;&gt;EVM&lt;&#x2F;a&gt; section below or heavily depends on the PoW consensus in any other way.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;evm&quot;&gt;EVM&lt;&#x2F;h3&gt;
&lt;p&gt;Although this EIP does not introduce any explicit changes to the EVM there are a couple of places where it may affect the logic of existing smart contracts.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;difficulty&quot;&gt;DIFFICULTY&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;DIFFICULTY&lt;&#x2F;code&gt; operation will always return &lt;code&gt;0&lt;&#x2F;code&gt; after this EIP takes effect and deprecates the &lt;strong&gt;&lt;code&gt;difficulty&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; field by replacing it with &lt;code&gt;0&lt;&#x2F;code&gt; constant.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Note:&lt;&#x2F;em&gt; Altering the &lt;code&gt;DIFFICULTY&lt;&#x2F;code&gt; semantics to return randomness accumulated by the beacon chain is under consideration but will be introduced in a separate EIP.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;blockhash&quot;&gt;BLOCKHASH&lt;&#x2F;h4&gt;
&lt;p&gt;Pseudo-random numbers obtained as the output of &lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt; operation become more insecure after this EIP takes effect and the PoW mechanism (which decreases the malleability of block hashes) gets supplanted by PoS.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Block validity
&lt;ul&gt;
&lt;li&gt;Beginning with &lt;code&gt;TRANSITION_BLOCK&lt;&#x2F;code&gt;, block is invalidated if any of the following is true:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ommersHash != Keccak256(RLP([]))&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;difficulty != 0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;nonce != 0x0000000000000000&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;len(extraData) &amp;gt; MAX_EXTRA_DATA_BYTES&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Beginning with &lt;code&gt;TRANSITION_BLOCK&lt;&#x2F;code&gt;, block rewards aren&#x27;t added to &lt;code&gt;beneficiary&lt;&#x2F;code&gt; account&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Client software adheres to PoS LMD-GHOST rule
&lt;ul&gt;
&lt;li&gt;Head and finalized blocks are set according to the recent &lt;code&gt;POS_FORKCHOICE_UPDATED&lt;&#x2F;code&gt; event&lt;&#x2F;li&gt;
&lt;li&gt;No fork choice state is updated unless &lt;code&gt;POS_FORKCHOICE_UPDATED&lt;&#x2F;code&gt; event is received&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Transition process
&lt;ul&gt;
&lt;li&gt;Client software doesn&#x27;t process any PoW block beyond a terminal PoW block&lt;&#x2F;li&gt;
&lt;li&gt;Beginning with &lt;code&gt;TRANSITION_BLOCK&lt;&#x2F;code&gt;, client software applies new block validity rules&lt;&#x2F;li&gt;
&lt;li&gt;Beginning with the first &lt;code&gt;POS_FORKCHOICE_UPDATED&lt;&#x2F;code&gt;, client software switches its fork choice rule to PoS LMD-GHOST&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TRANSITION_BLOCK&lt;&#x2F;code&gt; must be a child of a terminal PoW block&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;NewBlockHashes (0x01)&lt;&#x2F;code&gt; and &lt;code&gt;NewBlock (0x07)&lt;&#x2F;code&gt; network messages are discarded after receiving the &lt;code&gt;FIRST_FINALIZED_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;beacon-chain&quot;&gt;Beacon chain&lt;&#x2F;h3&gt;
&lt;p&gt;See Security Considerations section of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2982&#x2F;#security-considerations&quot;&gt;EIP-2982&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;transition-process&quot;&gt;Transition process&lt;&#x2F;h3&gt;
&lt;p&gt;The transition process used to take this specification into effect is a more sophisticated version of a hardfork -- the regular procedure of applying backwards incompatible changes in the Ethereum network. This process has multiple successive steps instead of the normal block-height point condition of simpler hardforks.&lt;&#x2F;p&gt;
&lt;p&gt;The complexity of this upgrade process stems from this fork targeting the underlying consensus mechanism rather than the execution layer within the consensus mechanism. Although the design seeks simplicity where possible, safety and liveness considerations during this transition have been prioritized.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;terminal-total-difficulty-vs-block-number&quot;&gt;Terminal total difficulty vs block number&lt;&#x2F;h4&gt;
&lt;p&gt;Using a pre-defined block number for the hardfork is unsafe in this context due to the PoS fork choice taking priority during the transition.&lt;&#x2F;p&gt;
&lt;p&gt;An attacker may use a minority of hash power to build a malicious chain fork that would satisfy the block height requirement. Then the first PoS block may be maliciously proposed on top of the PoW block from this adversarial fork, becoming the head and subverting the security of the transition.&lt;&#x2F;p&gt;
&lt;p&gt;To protect the network from this attack scenario, difficulty accumulated by the chain (total difficulty) is used to trigger the upgrade.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;ability-to-jump-between-terminal-pow-blocks&quot;&gt;Ability to jump between terminal PoW blocks&lt;&#x2F;h4&gt;
&lt;p&gt;There could be the case when a terminal PoW block is not observed by the majority of network participants due to (temporal) network partitioning. In such a case, this minority would switch their fork choice to the new rule provided by the PoS rooted on the minority terminal PoW block that they observed.&lt;&#x2F;p&gt;
&lt;p&gt;The transition process allows the network to re-org between forks with different terminal PoW blocks as long as (a) these blocks satisfy the terminal PoW block conditions and (b) the &lt;code&gt;FIRST_FINALIZED_BLOCK&lt;&#x2F;code&gt; has not yet been received. This provides resilience against adverse network conditions during the transition process and prevents irreparable forks&#x2F;partitions.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;halt-the-importing-of-pow-blocks&quot;&gt;Halt the importing of PoW blocks&lt;&#x2F;h4&gt;
&lt;p&gt;Suppose the part of the client software that is connected to the beacon chain network goes offline before the Ethereum network reaches the &lt;code&gt;TERMINAL_TOTAL_DIFFICULTY&lt;&#x2F;code&gt; and stays offline while the network meets this threshold. Such an event makes the client software unable to switch to PoS and allows it to keep following the PoW chain if this chain is being built beyond the terminal PoW block. Depending on how long the beacon chain part was offline, it could result in different adverse effects such as:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The client has no post-state for the terminal PoW block (the state has been pruned) which prevents it from doing the re-org to the PoS chain and leaving syncing from scratch as the only option to recover.&lt;&#x2F;li&gt;
&lt;li&gt;An application, a user or a service uses the data from the wrong fork (PoW chain that is kept being built) which can cause security issues on their side.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Not importing PoW blocks that are beyond the terminal PoW block prevents these adverse effects on safety&#x2F;re-orgs in the event of software or configuration failures &lt;em&gt;in favor&lt;&#x2F;em&gt; of a liveness failure.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;terminal-pow-block-overriding&quot;&gt;Terminal PoW block overriding&lt;&#x2F;h4&gt;
&lt;p&gt;There is a mechanism allowing for accelerating the consensus upgrade in emergency cases.
This EIP considers the following emergency case scenarios for the acceleration to come into effect:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A drop of the network hashing rate which delays the upgrade significantly.&lt;&#x2F;li&gt;
&lt;li&gt;Attacks on the PoW network before the upgrade.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The first case can be safely accelerated by updating the following parameters:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;TERMINAL_TOTAL_DIFFICULTY&lt;&#x2F;code&gt; -- reset to a value that is closer in time than the original one.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;FORK_NEXT_VALUE&lt;&#x2F;code&gt; -- adjust accordingly.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The second, more dire attack scenario requires a more invasive override:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;TERMINAL_BLOCK_HASH&lt;&#x2F;code&gt; -- set to the hash of a certain block to become the terminal PoW block.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TERMINAL_BLOCK_NUMBER&lt;&#x2F;code&gt; -- set to the number of a block designated by &lt;code&gt;TERMINAL_BLOCK_HASH&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TERMINAL_TOTAL_DIFFICULTY&lt;&#x2F;code&gt; -- set to the total difficulty value of a block designated by &lt;code&gt;TERMINAL_BLOCK_HASH&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;FORK_NEXT_VALUE&lt;&#x2F;code&gt; -- adjust accordingly.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;Note&lt;&#x2F;em&gt;: Acceleration in the second case is considered for the most extreme of scenarios because it will result in a non-trivial liveness failure on Ethereum Mainnet.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;ancient-blocks-are-no-longer-a-requisite-for-a-network-security&quot;&gt;Ancient blocks are no longer a requisite for a network security&lt;&#x2F;h3&gt;
&lt;p&gt;Keeping historical blocks starting from genesis is essential in the PoW network. A header of every block that belongs to a particular chain is required to justify the validity of this chain with respect to the PoW seal.&lt;&#x2F;p&gt;
&lt;p&gt;Validating the entire history of the chain is not required by the new PoS mechanism. Instead, the sync process in the PoS network relies on weak subjectivity checkpoints, which are historical snapshots shared by peers on the network. This means historical blocks beyond weak subjectivity checkpoint are no longer a requisite for determining the canonical blockchain.&lt;&#x2F;p&gt;
&lt;p&gt;Specification of weak subjectivity checkpoints can be found in the &lt;code&gt;ethereum&#x2F;consensus-specs&lt;&#x2F;code&gt; repository.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Sign-In with Ethereum Capabilities, ReCaps</title>
        <published>2021-07-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Oliver Terbu</name><uri>https://github.com/awoie</uri>
	</author>
	
	<author>
		<name>Jacob Ward</name><uri>https://github.com/cobward</uri>
	</author>
	
	<author>
		<name>Charles Lehner</name><uri>https://github.com/clehner</uri>
	</author>
	
	<author>
		<name>Sam Gbafa</name><uri>https://github.com/skgbafa</uri>
	</author>
	
	<author>
		<name>Wayne Chang</name><uri>https://github.com/wyc</uri>
	</author>
	
	<author>
		<name>Charles Cunningham</name><uri>https://github.com/chunningham</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5573/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5573-siwe-recap/10627" />
        

        <id>https://wg-eips.ritovision.com/5573/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:5573"
            label="ERC-5573" />
        

        
        

        
        <summary type="html">Mechanism on top of Sign-In with Ethereum for informed consent to delegate capabilities with an extensible scope mechanism</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5573/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4361&#x2F;&quot;&gt;ERC-4361&lt;&#x2F;a&gt;, or Sign-In with Ethereum (SIWE), describes how Ethereum accounts authenticate with off-chain services. This proposal, known as ReCaps, describes a mechanism on top of SIWE to give informed consent to authorize a Relying Party to exercise certain scoped capabilities. How a Relying Party authenticates against the target resource is out of scope for this specification and depends on the implementation of the target resource.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;SIWE ReCaps unlock integration of protocols and&#x2F;or APIs for developers by reducing user friction, onchain state and increasing security by introducing informed consent and deterministic capability objects on top of Sign-In With Ethereum (ERC-4361).&lt;&#x2F;p&gt;
&lt;p&gt;While SIWE focuses on authenticating the Ethereum account against the service (relying party or SIWE client) initiating the SIWE flow, there is no canonical way for the authenticated Ethereum account to authorize a relying party to interact with a third-party service (resource service) on behalf of the Ethereum account. A relying party may want to interact with another service on behalf of the Ethereum account, for example a service that provides data storage for the Ethereum account. This specification introduces a mechanism that allows the service (or more generally a Relying Party) to combine authentication and authorization of such while preserving security and optimizing UX.&lt;&#x2F;p&gt;
&lt;p&gt;Note, this approach is a similar mechanism to combining OpenID Connect (SIWE auth) and OAuth2 (SIWE ReCap) where SIWE ReCap implements capabilities-based authorization on top of the authentication provided by SIWE.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;This specification has three different audiences:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Web3 application developers that want to integrate ReCaps to authenticate with any protocols and APIs that support object capabilities.&lt;&#x2F;li&gt;
&lt;li&gt;Protocol or API developers that want to learn how to define their own ReCaps.&lt;&#x2F;li&gt;
&lt;li&gt;Wallet implementers that want to improve the UI for ReCaps.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;terms-and-definitions&quot;&gt;Terms and Definitions&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;ReCap - A SIWE Message complying with this specification, i.e. containing at least one ReCap URI in the &lt;code&gt;Resources&lt;&#x2F;code&gt; section and the corresponding human-readable ReCap Statement appended to the SIWE &lt;code&gt;statement&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;ReCap URI - A type of URI that resolves to a ReCap Details Object.&lt;&#x2F;li&gt;
&lt;li&gt;ReCap Details Object - A JSON object describing the actions and optionally the resources associated with a ReCap Capability.&lt;&#x2F;li&gt;
&lt;li&gt;Resource Service (RS) - The entity that is providing third-party services for the Ethereum account.&lt;&#x2F;li&gt;
&lt;li&gt;SIWE Client (SC) - The entity initiating the authorization (SIWE authentication and ReCap flow).&lt;&#x2F;li&gt;
&lt;li&gt;Relying Party (RP) - same as SC in the context of authorization.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;overview&quot;&gt;Overview&lt;&#x2F;h3&gt;
&lt;p&gt;This specification defines the following:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;ReCap SIWE Extension&lt;&#x2F;li&gt;
&lt;li&gt;ReCap Capability
&lt;ul&gt;
&lt;li&gt;ReCap URI Scheme&lt;&#x2F;li&gt;
&lt;li&gt;ReCap Details Object Schema&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;ReCap Translation Algorithm&lt;&#x2F;li&gt;
&lt;li&gt;ReCap Verification&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;recap-siwe-extension&quot;&gt;ReCap SIWE Extension&lt;&#x2F;h3&gt;
&lt;p&gt;A ReCap is an ERC-4361 message following a specific format that allows an Ethereum account to delegate a set of ReCap Capabilities to a Relying Party through informed consent. ReCap Capabilities MUST be represented by the final entry in the &lt;code&gt;Resources&lt;&#x2F;code&gt; array of the SIWE message that MUST deterministically translate the ReCap Capability in human-readable form to the &lt;code&gt;statement&lt;&#x2F;code&gt; field in the SIWE message using the ReCap Translation Algorithm.&lt;&#x2F;p&gt;
&lt;p&gt;The following SIWE message fields are used to further define (or limit) the scope of all ReCap Capabilities:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;URI&lt;&#x2F;code&gt; field MUST specify the intended Relying Party, e.g., &lt;code&gt;https:&#x2F;&#x2F;example.com&lt;&#x2F;code&gt;, &lt;code&gt;did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK&lt;&#x2F;code&gt;. It is expected that the RS authenticates the Relying Party before invoking an action for the ReCap Capability.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;Issued At&lt;&#x2F;code&gt; field MUST be used to specify the issuance date of the ReCap Capabilities.&lt;&#x2F;li&gt;
&lt;li&gt;If present, the &lt;code&gt;Expiration Time&lt;&#x2F;code&gt; field MUST be used as the expiration time of the ReCap Capabilities, i.e. the time at which the RS will no longer accept an invocation of the capabilities expressed in this form.&lt;&#x2F;li&gt;
&lt;li&gt;If present, the &lt;code&gt;Not Before&lt;&#x2F;code&gt; field MUST be used as the time that has to expire before the RS starts accepting invocations of the capabilities expressed in the message.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The following is a non-normative example of a SIWE message with the SIWE ReCap Extension:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;example.com wants you to sign in with your Ethereum account:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;I further authorize the stated URI to perform the following actions on my behalf: (1) &amp;#39;example&amp;#39;: &amp;#39;append&amp;#39;, &amp;#39;read&amp;#39; for &amp;#39;https:&#x2F;&#x2F;example.com&amp;#39;. (2) &amp;#39;other&amp;#39;: &amp;#39;action&amp;#39; for &amp;#39;https:&#x2F;&#x2F;example.com&amp;#39;. (3) &amp;#39;example&amp;#39;: &amp;#39;append&amp;#39;, &amp;#39;delete&amp;#39; for &amp;#39;my:resource:uri.1&amp;#39;. (4) &amp;#39;example&amp;#39;: &amp;#39;append&amp;#39; for &amp;#39;my:resource:uri.2&amp;#39;. (5) &amp;#39;example&amp;#39;: &amp;#39;append&amp;#39; for &amp;#39;my:resource:uri.3&amp;#39;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;URI: did:key:example&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Version: 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Chain ID: 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Nonce: mynonce1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Issued At: 2022-06-21T12:00:00.000Z&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Resources:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;- urn:recap:eyJhdHQiOnsiaHR0cHM6Ly9leGFtcGxlLmNvbSI6eyJleGFtcGxlL2FwcGVuZCI6W10sImV4YW1wbGUvcmVhZCI6W10sIm90aGVyL2FjdGlvbiI6W119LCJteTpyZXNvdXJjZTp1cmkuMSI6eyJleGFtcGxlL2FwcGVuZCI6W10sImV4YW1wbGUvZGVsZXRlIjpbXX0sIm15OnJlc291cmNlOnVyaS4yIjp7ImV4YW1wbGUvYXBwZW5kIjpbXX0sIm15OnJlc291cmNlOnVyaS4zIjp7ImV4YW1wbGUvYXBwZW5kIjpbXX19LCJwcmYiOltdfQ&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;recap-capability&quot;&gt;ReCap Capability&lt;&#x2F;h4&gt;
&lt;p&gt;A ReCap Capability is identified by their ReCap URI that resolves to a ReCap Details Object which defines the associated actions and optional target resources. The scope of each ReCap Capability is attenuated by common fields in the SIWE message as described in the previous chapter, e.g., &lt;code&gt;URI&lt;&#x2F;code&gt;, &lt;code&gt;Issued At&lt;&#x2F;code&gt;, &lt;code&gt;Expiration Time&lt;&#x2F;code&gt;, &lt;code&gt;Not Before&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;recap-uri-scheme&quot;&gt;ReCap URI Scheme&lt;&#x2F;h5&gt;
&lt;p&gt;A ReCap URI starts with &lt;code&gt;urn:recap:&lt;&#x2F;code&gt; followed by the unpadded base64url-encoded payload of the ReCap Details Object. Note, the term base64url is defined in RFC4648 - Base 64 Encoding with URL and Filename Safe Alphabet. If present, a Recap URI MUST occupy the final entry of the SIWE resource list.&lt;&#x2F;p&gt;
&lt;p&gt;The following is a non-normative example of a ReCap Capability:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;urn:recap:eyJhdHQiOnsiaHR0cHM6Ly9leGFtcGxlLmNvbS9waWN0dXJlcy8iOnsiY3J1ZC9kZWxldGUiOlt7fV0sImNydWQvdXBkYXRlIjpbe31dLCJvdGhlci9hY3Rpb24iOlt7fV19LCJtYWlsdG86dXNlcm5hbWVAZXhhbXBsZS5jb20iOnsibXNnL3JlY2VpdmUiOlt7Im1heF9jb3VudCI6NSwidGVtcGxhdGVzIjpbIm5ld3NsZXR0ZXIiLCJtYXJrZXRpbmciXX1dLCJtc2cvc2VuZCI6W3sidG8iOiJzb21lb25lQGVtYWlsLmNvbSJ9LHsidG8iOiJqb2VAZW1haWwuY29tIn1dfX0sInByZiI6WyJ6ZGo3V2o2Rk5TNHJVVWJzaUp2amp4Y3NOcVpkRENTaVlSOHNLUVhmb1BmcFNadUF3Il19&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;ability-strings&quot;&gt;Ability Strings&lt;&#x2F;h5&gt;
&lt;p&gt;Ability Strings identify an action or Ability within a Namespace. They are serialized as &lt;code&gt;&amp;lt;namespace&amp;gt;&#x2F;&amp;lt;ability&amp;gt;&lt;&#x2F;code&gt;. Namespaces and Abilities MUST contain only alphanumeric characters as well as the characters &lt;code&gt;.&lt;&#x2F;code&gt;, &lt;code&gt;*&lt;&#x2F;code&gt;, &lt;code&gt;_&lt;&#x2F;code&gt;, &lt;code&gt;+&lt;&#x2F;code&gt;, &lt;code&gt;-&lt;&#x2F;code&gt;, conforming to the regex &lt;code&gt;^[a-zA-Z0-9.*_+-]$&lt;&#x2F;code&gt;. The ability string as a whole MUST conform to &lt;code&gt;^[a-zA-Z0-9.*_+-]+\&#x2F;[a-zA-z0-9.*_+-]+$&lt;&#x2F;code&gt;. For example, &lt;code&gt;crud&#x2F;update&lt;&#x2F;code&gt; has an ability-namespace of &lt;code&gt;crud&lt;&#x2F;code&gt; and an ability-name of &lt;code&gt;update&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;recap-details-object-schema&quot;&gt;ReCap Details Object Schema&lt;&#x2F;h5&gt;
&lt;p&gt;The ReCap Details Object denotes which actions on which resources the Relying Party is authorized to invoke on behalf of the Ethereum account for the validity period defined in the SIWE message. It can also contain additional information that the RS may require to verify a capability invocation. A ReCap Details Object MUST follow the following JSON Schema:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;jsonc&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;$schema&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;http:&#x2F;&#x2F;json-schema.org&#x2F;draft-04&#x2F;schema#&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;att&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;propertyNames&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uri&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;patternProperties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;^.+:.*$&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;patternProperties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;^[a-zA-Z0-9.*_+-]+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;[a-zA-z0-9.*_+-]+$&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;array&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;items&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;additionalProperties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;minProperties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;additionalProperties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;minProperties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;prf&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;array&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;items&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;CID&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;minItems&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;A ReCap Details Object defines the following properties:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;att&lt;&#x2F;code&gt;: (CONDITIONAL) If present, &lt;code&gt;att&lt;&#x2F;code&gt; MUST be a JSON object where each key is a URI and each value is an object containing Ability Strings as keys and a corresponding value which is an array of qualifications to the action (i.e. a restriction or requirement). The keys of the object MUST be ordered lexicographically.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;prf&lt;&#x2F;code&gt;: (CONDITIONAL) If present, &lt;code&gt;prf&lt;&#x2F;code&gt; MUST be a JSON array of string values with at least one entry where each value is a valid Base58-encoded CID which identifies a parent capability, authorizing the Ethereum account for one or more of the entries in &lt;code&gt;att&lt;&#x2F;code&gt; if the SIWE &lt;code&gt;address&lt;&#x2F;code&gt; does not identify the controller of the &lt;code&gt;att&lt;&#x2F;code&gt; entries.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Objects in the &lt;code&gt;att&lt;&#x2F;code&gt; field (including nested objects) MUST NOT contain duplicate keys and MUST have their keys ordered lexicographically with two steps:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Sort by byte value.&lt;&#x2F;li&gt;
&lt;li&gt;If a string starts with another, the shorter string comes first (e.g. &lt;code&gt;msg&#x2F;send&lt;&#x2F;code&gt; comes before &lt;code&gt;msg&#x2F;send-to&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;This is the same as the &lt;code&gt;Array.sort()&lt;&#x2F;code&gt; method in JavaScript. In the example below, &lt;code&gt;crud&#x2F;delete&lt;&#x2F;code&gt; must appear before &lt;code&gt;crud&#x2F;update&lt;&#x2F;code&gt; and &lt;code&gt;other&#x2F;action&lt;&#x2F;code&gt;, similarly &lt;code&gt;msg&#x2F;receive&lt;&#x2F;code&gt; must appear before &lt;code&gt;msg&#x2F;send&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The following is a non-normative example of a ReCap Capability Object with &lt;code&gt;att&lt;&#x2F;code&gt; and &lt;code&gt;prf&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;jsonc&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;   &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;att&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;https:&#x2F;&#x2F;example.com&#x2F;pictures&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;         &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;crud&#x2F;delete&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;         &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;crud&#x2F;update&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;         &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;other&#x2F;action&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;mailto:username@example.com&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;msg&#x2F;receive&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;max_count&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 5&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;templates&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;newsletter&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;marketing&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;msg&#x2F;send&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;someone@email.com&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;joe@email.com&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;   &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;prf&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bafybeigk7ly3pog6uupxku3b6bubirr434ib6tfaymvox6gotaaaaaaaaa&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In the example above, the Relying Party is authorized to perform the actions &lt;code&gt;crud&#x2F;update&lt;&#x2F;code&gt;, &lt;code&gt;crud&#x2F;delete&lt;&#x2F;code&gt; and &lt;code&gt;other&#x2F;action&lt;&#x2F;code&gt; on resource &lt;code&gt;https:&#x2F;&#x2F;example.com&#x2F;pictures&#x2F;&lt;&#x2F;code&gt; without limitations for any. Additionally the Relying Party is authorized to perform actions &lt;code&gt;msg&#x2F;send&lt;&#x2F;code&gt; and &lt;code&gt;msg&#x2F;recieve&lt;&#x2F;code&gt; on resource &lt;code&gt;mailto:username@example.com&lt;&#x2F;code&gt;, where &lt;code&gt;msg&#x2F;send&lt;&#x2F;code&gt; is limited to sending to &lt;code&gt;someone@email.com&lt;&#x2F;code&gt; or &lt;code&gt;joe@email.com&lt;&#x2F;code&gt; and &lt;code&gt;msg&#x2F;recieve&lt;&#x2F;code&gt; is limited to a maximum of 5 and templates &lt;code&gt;newsletter&lt;&#x2F;code&gt; or &lt;code&gt;marketing&lt;&#x2F;code&gt;. Note, the Relying Party can invoke each action individually and independently from each other in the RS. Additionally the ReCap Capability Object contains some additional information that the RS will need during verification. The responsibility for defining the structure and semantics of this data lies with the RS. These action and restriction semantics are examples not intended to be universally understood. The Nota Bene objects appearing in the array associated with ability strings represent restrictions on use of an ability. An empty object implies that the action can be performed with no restrictions, but an empty array with no objects implies that there is no way to use this ability in a valid way.&lt;&#x2F;p&gt;
&lt;p&gt;It is expected that RS implementers define which resources they want to expose through ReCap Details Objects and which actions they want to allow users to invoke on them.&lt;&#x2F;p&gt;
&lt;p&gt;This example is expected to transform into the following &lt;code&gt;recap-transformed-statement&lt;&#x2F;code&gt; (for &lt;code&gt;URI&lt;&#x2F;code&gt; of &lt;code&gt;https:&#x2F;&#x2F;example.com&lt;&#x2F;code&gt;):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;I further authorize the stated URI to perform the following actions on my behalf: (1) &amp;#39;crud&amp;#39;: &amp;#39;delete&amp;#39;, &amp;#39;update&amp;#39; for &amp;#39;https:&#x2F;&#x2F;example.com&#x2F;pictures&#x2F;&amp;#39;. (2) &amp;#39;other&amp;#39;: &amp;#39;action&amp;#39; for &amp;#39;https:&#x2F;&#x2F;example.com&#x2F;pictures&#x2F;&amp;#39;. (3) &amp;#39;msg&amp;#39;: &amp;#39;receive&amp;#39;, &amp;#39;send&amp;#39; for &amp;#39;mailto:username@example.com&amp;#39;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This example is also expected to transform into the following &lt;code&gt;recap-uri&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;urn:recap:eyJhdHQiOnsiaHR0cHM6Ly9leGFtcGxlLmNvbS9waWN0dXJlcy8iOnsiY3J1ZC9kZWxldGUiOlt7fV0sImNydWQvdXBkYXRlIjpbe31dLCJvdGhlci9hY3Rpb24iOlt7fV19LCJtYWlsdG86dXNlcm5hbWVAZXhhbXBsZS5jb20iOnsibXNnL3JlY2VpdmUiOlt7Im1heF9jb3VudCI6NSwidGVtcGxhdGVzIjpbIm5ld3NsZXR0ZXIiLCJtYXJrZXRpbmciXX1dLCJtc2cvc2VuZCI6W3sidG8iOiJzb21lb25lQGVtYWlsLmNvbSJ9LHsidG8iOiJqb2VAZW1haWwuY29tIn1dfX0sInByZiI6WyJ6ZGo3V2o2Rk5TNHJVVWJzaUp2amp4Y3NOcVpkRENTaVlSOHNLUVhmb1BmcFNadUF3Il19&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;merging-capability-objects&quot;&gt;Merging Capability Objects&lt;&#x2F;h5&gt;
&lt;p&gt;Any two Recap objects can be merged together by recursive concatenation of their field elements as long as the ordering rules of the field contents is followed. For example, two recap objects:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;jsonc&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;att&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;https:&#x2F;&#x2F;example1.com&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;crud&#x2F;read&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;prf&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bafyexample1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;att&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;https:&#x2F;&#x2F;example1.com&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;crud&#x2F;update&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;max_times&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;https:&#x2F;&#x2F;example2.com&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;crud&#x2F;delete&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;prf&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bafyexample2&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;combine into:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;jsonc&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;att&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;https:&#x2F;&#x2F;example1.com&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;crud&#x2F;read&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;crud&#x2F;update&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;max_times&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;https:&#x2F;&#x2F;example2.com&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;crud&#x2F;delete&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;prf&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bafyexample1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bafyexample2&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;recap-translation-algorithm&quot;&gt;ReCap Translation Algorithm&lt;&#x2F;h4&gt;
&lt;p&gt;After applying the ReCap Translation Algorithm on a given SIWE message that MAY include a pre-defined &lt;code&gt;statement&lt;&#x2F;code&gt;, the &lt;code&gt;recap-transformed-statement&lt;&#x2F;code&gt; in a ReCap SIWE message MUST conform to the following ABNF:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;recap-transformed-statement = statement recap-preamble 1*(&amp;quot; &amp;quot; recap-statement-entry &amp;quot;.&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   ; see ERC-4361 for definition of input-statement&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;recap-preamble = &amp;quot;I further authorize the stated URI to perform the following actions on my behalf:&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;recap-statement-entry = &amp;quot;(&amp;quot; number &amp;quot;) &amp;quot; action-namespace &amp;quot;: &amp;quot; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                          action-name *(&amp;quot;,&amp;quot; action-name) &amp;quot;for&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                          recap-resource&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   ; see RFC8259 for definition of number&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ability-namespace = string&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   ; see RFC8259 for definition of string&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ability-name = string&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   ; see RFC8259 for definition of string&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;recap-resource = string&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   ; see RFC8259 for definition of string&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The following algorithm or an algorithm that produces the same output MUST be performed to generate the SIWE ReCap Transformed Statement.&lt;&#x2F;p&gt;
&lt;p&gt;Inputs:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Let &lt;code&gt;recap-uri&lt;&#x2F;code&gt; be a ReCap URI, which represents the ReCap Capabilities that are to be encoded in the SIWE message, and which contains a ReCap Details Object which conforms to the ReCap Details Object Schema.&lt;&#x2F;li&gt;
&lt;li&gt;[Optional] Let &lt;code&gt;statement&lt;&#x2F;code&gt; be the statement field of the input SIWE message conforming to ERC-4361.
Algorithm:&lt;&#x2F;li&gt;
&lt;li&gt;Let &lt;code&gt;recap-transformed-statement&lt;&#x2F;code&gt; be an empty string value.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;statement&lt;&#x2F;code&gt; is present, do the following:
&lt;ul&gt;
&lt;li&gt;Append the value of the &lt;code&gt;statement&lt;&#x2F;code&gt; field of &lt;code&gt;siwe&lt;&#x2F;code&gt; to &lt;code&gt;recap-transformed-statement&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Append a single space character &lt;code&gt;&quot; &quot;&lt;&#x2F;code&gt; to &lt;code&gt;recap-transformed-statement&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Append the following string to &lt;code&gt;recap-transformed-statement&lt;&#x2F;code&gt;: &lt;code&gt;&quot;I further authorize the stated URI to perform the following actions on my behalf:&quot;&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Let &lt;code&gt;numbering&lt;&#x2F;code&gt; be an integer starting with 1.&lt;&#x2F;li&gt;
&lt;li&gt;Let &lt;code&gt;attenuations&lt;&#x2F;code&gt; be the &lt;code&gt;att&lt;&#x2F;code&gt; field of the ReCap Details Object&lt;&#x2F;li&gt;
&lt;li&gt;For each key and value pair in &lt;code&gt;attenuations&lt;&#x2F;code&gt; (starting with the first entry), perform the following:
&lt;ul&gt;
&lt;li&gt;Let &lt;code&gt;resource&lt;&#x2F;code&gt; be the key and &lt;code&gt;abilities&lt;&#x2F;code&gt; be the value&lt;&#x2F;li&gt;
&lt;li&gt;Group the keys of the &lt;code&gt;abilities&lt;&#x2F;code&gt; object by their &lt;code&gt;ability-namespace&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;For each &lt;code&gt;ability-namespace&lt;&#x2F;code&gt;, perform the following:
&lt;ul&gt;
&lt;li&gt;Append the string concatenation of &lt;code&gt;&quot; (&quot;&lt;&#x2F;code&gt;, &lt;code&gt;numbering&lt;&#x2F;code&gt;, &lt;code&gt;&quot;)&quot;&lt;&#x2F;code&gt; to &lt;code&gt;recap-transformed-statement&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Append the string concatenation of &lt;code&gt;&#x27;&lt;&#x2F;code&gt;, &lt;code&gt;ability-namespace&lt;&#x2F;code&gt;, &lt;code&gt;&#x27;:&lt;&#x2F;code&gt; to &lt;code&gt;recap-transformed-statement&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;For each &lt;code&gt;ability-name&lt;&#x2F;code&gt; in the &lt;code&gt;ability-namespace&lt;&#x2F;code&gt; group, perform the following:
&lt;ul&gt;
&lt;li&gt;Append the string concatenation of &lt;code&gt;&#x27;&lt;&#x2F;code&gt;, &lt;code&gt;ability-name&lt;&#x2F;code&gt;, &lt;code&gt;&#x27;&lt;&#x2F;code&gt; to &lt;code&gt;recap-transformed-statement&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;If not the final &lt;code&gt;ability-name&lt;&#x2F;code&gt;, append &lt;code&gt;,&lt;&#x2F;code&gt; to &lt;code&gt;recap-transformed-statement&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Append &lt;code&gt;for &#x27;&lt;&#x2F;code&gt;, &lt;code&gt;resource&lt;&#x2F;code&gt;, &lt;code&gt;&#x27;.&lt;&#x2F;code&gt; to &lt;code&gt;recap-transformed-statement&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Increase &lt;code&gt;numbering&lt;&#x2F;code&gt; by 1&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Return &lt;code&gt;recap-transformed-statement&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;recap-verification-algorithm&quot;&gt;ReCap Verification Algorithm&lt;&#x2F;h4&gt;
&lt;p&gt;The following algorithm or an algorithm that produces the same output MUST be performed to verify a SIWE ReCap.&lt;&#x2F;p&gt;
&lt;p&gt;Inputs:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Let &lt;code&gt;recap-siwe&lt;&#x2F;code&gt; be the input SIWE message conforming to ERC-4361 and this EIP.&lt;&#x2F;li&gt;
&lt;li&gt;Let &lt;code&gt;siwe-signature&lt;&#x2F;code&gt; be the output of signing &lt;code&gt;recap-siwe&lt;&#x2F;code&gt;, as defined in ERC-4361.
Algorithm:&lt;&#x2F;li&gt;
&lt;li&gt;Perform ERC-4361 signature verification with &lt;code&gt;recap-siwe&lt;&#x2F;code&gt; and &lt;code&gt;siwe-signature&lt;&#x2F;code&gt; as inputs.&lt;&#x2F;li&gt;
&lt;li&gt;Let &lt;code&gt;uri&lt;&#x2F;code&gt; be the uri field of &lt;code&gt;recap-siwe&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Let &lt;code&gt;recap-uri&lt;&#x2F;code&gt; be a recap URI taken from the last entry of the resources field of &lt;code&gt;recap-siwe&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Let &lt;code&gt;recap-transformed-statement&lt;&#x2F;code&gt; be the result of performing the above &lt;code&gt;ReCap Translation Algorithm&lt;&#x2F;code&gt; with &lt;code&gt;uri&lt;&#x2F;code&gt; and &lt;code&gt;recap-uri&lt;&#x2F;code&gt; as input.&lt;&#x2F;li&gt;
&lt;li&gt;Assert that the statement field of &lt;code&gt;recap-siwe&lt;&#x2F;code&gt; ends with &lt;code&gt;recap-transformed-statement&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;implementer-s-guide&quot;&gt;Implementer&#x27;s Guide&lt;&#x2F;h3&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h4 id=&quot;web3-application-implementers&quot;&gt;Web3 Application Implementers&lt;&#x2F;h4&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h4 id=&quot;wallet-implementers&quot;&gt;Wallet Implementers&lt;&#x2F;h4&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h4 id=&quot;protocol-or-api-implementers&quot;&gt;Protocol or API Implementers&lt;&#x2F;h4&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Resource service implementer&#x27;s should not consider ReCaps as bearer tokens but instead require to authenticate the Relying Party in addition. The process of authenticating the Relying Party against the resource service is out of scope of this specification and can be done in various different ways.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Limit and meter initcode</title>
        <published>2021-07-16T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Martin Holst Swende</name><uri>https://github.com/holiman</uri>
	</author>
	
	<author>
		<name>Paweł Bylica</name><uri>https://github.com/chfast</uri>
	</author>
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	<author>
		<name>Andrei Maiboroda</name><uri>https://github.com/gumb0</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3860/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3860-limit-and-meter-initcode/7018" />
        

        <id>https://wg-eips.ritovision.com/3860/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:3860"
            label="EIP-3860" />
        

        
        

        
        <summary type="html">Limit the maximum size of initcode to 49152 and apply extra gas cost of 2 for every 32-byte chunk of initcode</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3860/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;We extend &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;170&#x2F;&quot;&gt;EIP-170&lt;&#x2F;a&gt; by introducing a maximum size limit for &lt;code&gt;initcode&lt;&#x2F;code&gt; (&lt;code&gt;MAX_INITCODE_SIZE = 2 * MAX_CODE_SIZE = 49152&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore, we introduce a charge of &lt;code&gt;2&lt;&#x2F;code&gt; gas for every 32-byte chunk of &lt;code&gt;initcode&lt;&#x2F;code&gt; to represent the cost of jumpdest-analysis.&lt;&#x2F;p&gt;
&lt;p&gt;Lastly, the size limit results in the nice-to-have property that EVM code size, code offset (&lt;code&gt;PC&lt;&#x2F;code&gt;), and jump offset fits a 16-bit value.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;During contract creation the client has to perform jumpdest-analysis on the &lt;code&gt;initcode&lt;&#x2F;code&gt; prior to execution. The work performed scales linearly with the size of the &lt;code&gt;initcode&lt;&#x2F;code&gt;. This work currently is not metered, nor is there a protocol enforced upper bound for the size.&lt;&#x2F;p&gt;
&lt;p&gt;There are three costs charged today:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Cost for calldata aka &lt;code&gt;initcode&lt;&#x2F;code&gt;: 4 gas for a byte with the value of zero, and 16 gas otherwise.&lt;&#x2F;li&gt;
&lt;li&gt;Cost for the resulting deployed code: 200 gas per byte.&lt;&#x2F;li&gt;
&lt;li&gt;Cost of address calculation (hashing of code) in case of &lt;code&gt;CREATE2&lt;&#x2F;code&gt; only: 6 gas per word.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Only the first cost applies to &lt;code&gt;initcode&lt;&#x2F;code&gt;, but only in the case of contract creation transactions. For the case of &lt;code&gt;CREATE&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;CREATE2&lt;&#x2F;code&gt; there is no such cost, and it is possible to programmatically generate variations of &lt;code&gt;initcode&lt;&#x2F;code&gt; in a relatively cheap manner. In the past it was possible to craft malicious &lt;code&gt;initcode&lt;&#x2F;code&gt; due to a vulnerability fixed in 2017 by geth 1.6.5.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore, the lack of a limit has caused lengthy discussions for some EVM proposals, influencing the design, or even causing a delay or cancellation of a feature.&lt;&#x2F;p&gt;
&lt;p&gt;We are motivated by three reasons:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Ensuring &lt;code&gt;initcode&lt;&#x2F;code&gt; is fairly charged (most importantly cost is proportional to &lt;code&gt;initcode&lt;&#x2F;code&gt;&#x27;s length) to minimize the risks for the future.&lt;&#x2F;li&gt;
&lt;li&gt;To have a cost system which is extendable in the future.&lt;&#x2F;li&gt;
&lt;li&gt;To simplify EVM engines by the explicit limits (code size, code offsets (&lt;code&gt;PC&lt;&#x2F;code&gt;), and jump offsets fit 16-bits).&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;INITCODE_WORD_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_INITCODE_SIZE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2 * MAX_CODE_SIZE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Where &lt;code&gt;MAX_CODE_SIZE&lt;&#x2F;code&gt; is defined by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;170&#x2F;&quot;&gt;EIP-170&lt;&#x2F;a&gt; as &lt;code&gt;24576&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;We define &lt;code&gt;initcode_cost(initcode)&lt;&#x2F;code&gt; to equal &lt;code&gt;INITCODE_WORD_COST * ceil(len(initcode) &#x2F; 32)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;rules&quot;&gt;Rules&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;If length of transaction data (&lt;code&gt;initcode&lt;&#x2F;code&gt;) in a create transaction exceeds &lt;code&gt;MAX_INITCODE_SIZE&lt;&#x2F;code&gt;, transaction is invalid. (&lt;em&gt;Note that this is similar to transactions considered invalid for not meeting the intrinsic gas cost requirement.&lt;&#x2F;em&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;For a create transaction, extend the transaction data cost formula to include &lt;code&gt;initcode_cost(initcode)&lt;&#x2F;code&gt;. (&lt;em&gt;Note that this is included in transaction intrinsic cost, i.e. transaction with not enough gas to cover initcode cost is invalid.&lt;&#x2F;em&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;If length of &lt;code&gt;initcode&lt;&#x2F;code&gt; to &lt;code&gt;CREATE&lt;&#x2F;code&gt; or &lt;code&gt;CREATE2&lt;&#x2F;code&gt; instructions exceeds &lt;code&gt;MAX_INITCODE_SIZE&lt;&#x2F;code&gt;, instruction execution exceptionally aborts (as if it runs out of gas).&lt;&#x2F;li&gt;
&lt;li&gt;For the &lt;code&gt;CREATE&lt;&#x2F;code&gt; and &lt;code&gt;CREATE2&lt;&#x2F;code&gt; instructions charge an extra gas cost equaling to &lt;code&gt;initcode_cost(initcode)&lt;&#x2F;code&gt;. This cost is deducted before the calculation of the resulting contract address and the execution of &lt;code&gt;initcode&lt;&#x2F;code&gt;. (&lt;em&gt;Note that this means before or at the same time as the hashing cost is applied in &lt;code&gt;CREATE2&lt;&#x2F;code&gt;.&lt;&#x2F;em&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;gas-cost-constant&quot;&gt;Gas cost constant&lt;&#x2F;h3&gt;
&lt;p&gt;The value of &lt;code&gt;INITCODE_WORD_COST&lt;&#x2F;code&gt; is selected based on performance benchmarks of differing worst-cases per implementation. The baseline for the benchmarks is the performance of &lt;code&gt;KECCAK256&lt;&#x2F;code&gt; hashing in geth 1.10.9, which matches the 70 Mgas&#x2F;s gas limit target on a 4.0 GHz x86_64 CPU.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;EVM&lt;&#x2F;th&gt;&lt;th&gt;version&lt;&#x2F;th&gt;&lt;th&gt;MB&#x2F;s&lt;&#x2F;th&gt;&lt;th&gt;B&#x2F;CPUcycle&lt;&#x2F;th&gt;&lt;th&gt;CPUcycle&#x2F;B&lt;&#x2F;th&gt;&lt;th&gt;cost of 1 B&lt;&#x2F;th&gt;&lt;th&gt;cost of 32 B&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;geth&#x2F;KECCAK256&lt;&#x2F;td&gt;&lt;td&gt;1.10.9&lt;&#x2F;td&gt;&lt;td&gt;357&lt;&#x2F;td&gt;&lt;td&gt;1.8&lt;&#x2F;td&gt;&lt;td&gt;0.6&lt;&#x2F;td&gt;&lt;td&gt;0.2&lt;&#x2F;td&gt;&lt;td&gt;6.0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;geth&lt;&#x2F;td&gt;&lt;td&gt;1.10.9&lt;&#x2F;td&gt;&lt;td&gt;1091&lt;&#x2F;td&gt;&lt;td&gt;5.5&lt;&#x2F;td&gt;&lt;td&gt;0.2&lt;&#x2F;td&gt;&lt;td&gt;0.1&lt;&#x2F;td&gt;&lt;td&gt;2.0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;evmone&#x2F;Baseline&lt;&#x2F;td&gt;&lt;td&gt;0.8.2&lt;&#x2F;td&gt;&lt;td&gt;727&lt;&#x2F;td&gt;&lt;td&gt;3.7&lt;&#x2F;td&gt;&lt;td&gt;0.3&lt;&#x2F;td&gt;&lt;td&gt;0.1&lt;&#x2F;td&gt;&lt;td&gt;2.9&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;evmone&#x2F;Advanced&lt;&#x2F;td&gt;&lt;td&gt;0.8.2&lt;&#x2F;td&gt;&lt;td&gt;155&lt;&#x2F;td&gt;&lt;td&gt;0.8&lt;&#x2F;td&gt;&lt;td&gt;1.3&lt;&#x2F;td&gt;&lt;td&gt;0.4&lt;&#x2F;td&gt;&lt;td&gt;13.8&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;gas-cost-per-word-32-byte-chunk&quot;&gt;Gas cost per word (32-byte chunk)&lt;&#x2F;h3&gt;
&lt;p&gt;We have chosen the cost of 2 gas per word based on Geth&#x27;s implementation and comparing with &lt;code&gt;KECCAK256&lt;&#x2F;code&gt; performance. This means the per byte cost is &lt;code&gt;0.0625&lt;&#x2F;code&gt;. While fractional gas costs are not permitted in the EVM, we can approximate it by charging per-word.&lt;&#x2F;p&gt;
&lt;p&gt;Moreover, calculating gas per word is compatible with the calculation of &lt;code&gt;CREATE2&lt;&#x2F;code&gt;&#x27;s &lt;em&gt;hashcost&lt;&#x2F;em&gt; of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1014&#x2F;&quot;&gt;EIP-1014&lt;&#x2F;a&gt;. Therefore, the same implementation may be used for &lt;code&gt;CREATE&lt;&#x2F;code&gt; and &lt;code&gt;CREATE2&lt;&#x2F;code&gt; with different cost constants: before activation &lt;code&gt;0&lt;&#x2F;code&gt; for &lt;code&gt;CREATE&lt;&#x2F;code&gt; and &lt;code&gt;6&lt;&#x2F;code&gt; for &lt;code&gt;CREATE2&lt;&#x2F;code&gt;, after activation &lt;code&gt;2&lt;&#x2F;code&gt; for &lt;code&gt;CREATE&lt;&#x2F;code&gt; and &lt;code&gt;6 + 2&lt;&#x2F;code&gt; for &lt;code&gt;CREATE2&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;reason-for-size-limit-of-initcode&quot;&gt;Reason for size limit of initcode&lt;&#x2F;h3&gt;
&lt;p&gt;Estimating and creating worst case scenarios is easier with an upper bound in place, given one parameter for the search is greatly reduced. This allows for selecting a much more optimistic gas per byte.&lt;&#x2F;p&gt;
&lt;p&gt;Should there be no upper bound, the cost would need to be higher accounting for unknown unknowns. Given most &lt;em&gt;initcode&lt;&#x2F;em&gt; (&lt;em&gt;TODO: state maximum initcode size resulting in deployment seen on mainnet here&lt;&#x2F;em&gt;) does not exceed the proposed limit, penalising contracts by overly conservative costs seems unnecessary.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;effect-of-size-limit-of-initcode&quot;&gt;Effect of size limit of initcode&lt;&#x2F;h3&gt;
&lt;p&gt;In most, if not all cases when a new contract is being created, the resulting runtime code is copied from the initcode itself. For the basic case the &lt;code&gt;2 * MAX_CODE_SIZE&lt;&#x2F;code&gt; limit allows &lt;code&gt;MAX_CODE_SIZE&lt;&#x2F;code&gt; for runtime code and another &lt;code&gt;MAX_CODE_SIZE&lt;&#x2F;code&gt; for contract constructor code. However, the limit may have practical implications for cases where multiple contracts are deployed in a single create transaction.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;initcode-cost-for-create-transaction&quot;&gt;Initcode cost for create transaction&lt;&#x2F;h3&gt;
&lt;p&gt;The initcode cost for create transaction data (0.0625 gas per byte) is negligible compared to the transaction data cost (4 or 16 gas per byte). Despite that, we decided to include it in the specification for consistency, and more importantly for forward compatibility.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;how-to-report-initcode-limit-violation&quot;&gt;How to report initcode limit violation?&lt;&#x2F;h3&gt;
&lt;p&gt;We specified that initcode size limit violation for &lt;code&gt;CREATE&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;CREATE2&lt;&#x2F;code&gt; results in exceptional abort of the execution. This places it in the group of early out-of-gas checks, including: stack underflow, memory expansion, static call violation, initcode hashing cost, and initcode cost introduced by this EIP. They precede the later &quot;light&quot; checks: call depth and balance. The choice gives consistency to the order of checks and lowers implementation complexity (out-of-gas checks can be performed in any order).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP requires a &quot;network upgrade&quot;, since it modifies consensus rules.&lt;&#x2F;p&gt;
&lt;p&gt;Already deployed contracts should not be affected, but certain transactions (with &lt;code&gt;initcode&lt;&#x2F;code&gt; beyond the proposed limit) would still be includable in a block, but result in an exceptional abort.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Tests should include the following cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Creation transaction with gas limit enough to cover initcode cost&lt;&#x2F;li&gt;
&lt;li&gt;Creation transaction with gas limit enough to cover intrinsic cost except initcode cost&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CREATE&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;CREATE2&lt;&#x2F;code&gt;&#x2F;creation transaction with &lt;code&gt;len(initcode)&lt;&#x2F;code&gt; at &lt;code&gt;MAX_INITCODE_SIZE&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CREATE&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;CREATE2&lt;&#x2F;code&gt;&#x2F;creation transaction with &lt;code&gt;len(initcode)&lt;&#x2F;code&gt; at &lt;code&gt;MAX_INITCODE_SIZE+1&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;For client implementations, this EIP makes attacks based on jumpdest-analysis less problematic, so should increase the robustness of clients.&lt;&#x2F;p&gt;
&lt;p&gt;For layer 2, this EIP introduces failure-modes where there previously were none. There &lt;em&gt;could&lt;&#x2F;em&gt; exist factory-contracts which deploy multi-level contract hierarchies, such that the code for multiple contracts are included in the initcode of the first contract. The author(s) of this EIP are not aware of any such contracts.&lt;&#x2F;p&gt;
&lt;p&gt;Currently, on London, with &lt;code&gt;30M&lt;&#x2F;code&gt; gas limit, it would be possible to trigger jumpdest-analysis of a total &lt;code&gt;~1.3GB&lt;&#x2F;code&gt; of initcode. With this EIP, the cost for such an attack would increase by roughly &lt;code&gt;80M&lt;&#x2F;code&gt; gas.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EOF - Static relative jumps</title>
        <published>2021-07-16T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	<author>
		<name>Andrei Maiboroda</name><uri>https://github.com/gumb0</uri>
	</author>
	
	<author>
		<name>Paweł Bylica</name><uri>https://github.com/chfast</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4200/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-4200-static-relative-jumps/7108" />
        

        <id>https://wg-eips.ritovision.com/4200/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:4200"
            label="EIP-4200" />
        

        
        

        
        <summary type="html">RJUMP, RJUMPI and RJUMPV instructions with a signed immediate encoding the jump destination</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4200/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Three new EVM jump instructions are introduced (&lt;code&gt;RJUMP&lt;&#x2F;code&gt;, &lt;code&gt;RJUMPI&lt;&#x2F;code&gt; and &lt;code&gt;RJUMPV&lt;&#x2F;code&gt;) which encode destinations as signed immediate values. These can be useful in the majority of (but not all) use cases and offer a cost reduction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;A recurring discussion topic is that EVM only has a mechanism for dynamic jumps. They provide a very flexible architecture with only 2 (!) instructions. This flexibility comes at a cost however: it makes analysis of code more complicated and it also (partially) resulted in the need to have the &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; marker.&lt;&#x2F;p&gt;
&lt;p&gt;In a great many cases control flow is actually static and there is no need for any dynamic behaviour, though not every use case can be solved by static jumps.&lt;&#x2F;p&gt;
&lt;p&gt;There are various ways to reduce the need for dynamic jumps, some examples:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;With native support for functions &#x2F; subroutines&lt;&#x2F;li&gt;
&lt;li&gt;A &quot;return to caller&quot; instruction&lt;&#x2F;li&gt;
&lt;li&gt;A &quot;switch-case&quot; table with dynamic indexing&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;This change does not attempt to solve these, but instead introduces a minimal feature set to allow compilers to decide which is the most adequate option for a given use case. It is expected that compilers will use &lt;code&gt;RJUMP&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt; almost exclusively, with the exception of returning to the caller continuing to use &lt;code&gt;JUMP&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This functionality does not preclude the EVM from introducing other forms of control flow later on. &lt;code&gt;RJUMP&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt; can efficiently co-exists with a higher-level declaration of functions, where static relative jumps should be used for intra-function control flow.&lt;&#x2F;p&gt;
&lt;p&gt;The main benefit of these instruction is reduced gas cost (both at deploy and execution time) and better analysis properties.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;We introduce three new instructions on the same block number &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3540&#x2F;&quot;&gt;EIP-3540&lt;&#x2F;a&gt; is activated on:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;RJUMP&lt;&#x2F;code&gt; (0xe0) - relative jump&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt; (0xe1) - conditional relative jump&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt; (0xe2) - relative jump via jump table&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;If the code is legacy bytecode, all of these instructions result in an &lt;em&gt;exceptional halt&lt;&#x2F;em&gt;. (&lt;em&gt;Note: This means no change to behaviour.&lt;&#x2F;em&gt;)&lt;&#x2F;p&gt;
&lt;p&gt;If the code is valid EOF1:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;RJUMP relative_offset&lt;&#x2F;code&gt; sets the &lt;code&gt;PC&lt;&#x2F;code&gt; to &lt;code&gt;PC_post_instruction + relative_offset&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RJUMPI relative_offset&lt;&#x2F;code&gt; pops a value (&lt;code&gt;condition&lt;&#x2F;code&gt;) from the stack, and sets the &lt;code&gt;PC&lt;&#x2F;code&gt; to &lt;code&gt;PC_post_instruction + ((condition == 0) ? 0 : relative_offset)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RJUMPV max_index relative_offset+&lt;&#x2F;code&gt; pops a value (&lt;code&gt;case&lt;&#x2F;code&gt;) from the stack, and sets the &lt;code&gt;PC&lt;&#x2F;code&gt; to &lt;code&gt;PC_post_instruction + ((case &amp;gt; max_index) ? 0 : relative_offset[case])&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The immediate argument &lt;code&gt;relative_offset&lt;&#x2F;code&gt; is encoded as a 16-bit &lt;strong&gt;signed&lt;&#x2F;strong&gt; (two&#x27;s-complement) big-endian value. Under &lt;code&gt;PC_post_instruction&lt;&#x2F;code&gt; we mean the &lt;code&gt;PC&lt;&#x2F;code&gt; position after the entire immediate value.&lt;&#x2F;p&gt;
&lt;p&gt;The immediate encoding of &lt;code&gt;RJUMPV&lt;&#x2F;code&gt; is more special: the unsigned 8-bit &lt;code&gt;max_index&lt;&#x2F;code&gt; value determines the maximum index in the jump table. The number of &lt;code&gt;relative_offset&lt;&#x2F;code&gt; values following is &lt;code&gt;max_index+1&lt;&#x2F;code&gt;. This allows table sizes up to 256. The encoding of &lt;code&gt;RJUMPV&lt;&#x2F;code&gt; must have at least one &lt;code&gt;relative_offset&lt;&#x2F;code&gt; and thus it will take at minimum 4 bytes. Furthermore, the &lt;code&gt;case &amp;gt; max_index&lt;&#x2F;code&gt; condition falling through means that in many use cases, one would place the &lt;em&gt;default&lt;&#x2F;em&gt; path following the &lt;code&gt;RJUMPV&lt;&#x2F;code&gt; instruction. An interesting feature is that &lt;code&gt;RJUMPV 0 relative_offset&lt;&#x2F;code&gt; is an inverted-&lt;code&gt;RJUMPI&lt;&#x2F;code&gt;, which can be used in many cases instead of &lt;code&gt;ISZERO RJUMPI relative_offset&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;We also extend the validation algorithm of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3670&#x2F;&quot;&gt;EIP-3670&lt;&#x2F;a&gt; to verify that each &lt;code&gt;RJUMP&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt; has a &lt;code&gt;relative_offset&lt;&#x2F;code&gt; pointing to an instruction. This means it cannot point to an immediate data of &lt;code&gt;PUSHn&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMP&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt;. It cannot point outside of code bounds. It is allowed to point to a &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt;, but is not required to.&lt;&#x2F;p&gt;
&lt;p&gt;Because the destinations are validated upfront, the cost of these instructions are less than their dynamic counterparts: &lt;code&gt;RJUMP&lt;&#x2F;code&gt; should cost 2, and &lt;code&gt;RJUMPI&lt;&#x2F;code&gt; and &lt;code&gt;RJUMPV&lt;&#x2F;code&gt; should cost 4.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;relative-addressing&quot;&gt;Relative addressing&lt;&#x2F;h3&gt;
&lt;p&gt;We chose relative addressing in order to support code which is relocatable. This also means a code snippet can be injected. A technique seen used prior to this EIP to achieve the same goal was to inject code like &lt;code&gt;PUSHn PC ADD JUMPI&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;We do not see any significant downside to relative addressing and it allows us to also deprecate the &lt;code&gt;PC&lt;&#x2F;code&gt; instruction.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;immediate-size&quot;&gt;Immediate size&lt;&#x2F;h3&gt;
&lt;p&gt;The signed 16-bit immediate means that the largest jump distance possible is 32767. In the case the bytecode at &lt;code&gt;PC=0&lt;&#x2F;code&gt; starts with an &lt;code&gt;RJUMP&lt;&#x2F;code&gt;, it will be possible to jump as far as &lt;code&gt;PC=32770&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Given &lt;code&gt;MAX_CODE_SIZE = 24576&lt;&#x2F;code&gt; (in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;170&#x2F;&quot;&gt;EIP-170&lt;&#x2F;a&gt;) and &lt;code&gt;MAX_INITCODE_SIZE = 49152&lt;&#x2F;code&gt; (in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3860&#x2F;&quot;&gt;EIP-3860&lt;&#x2F;a&gt;), we think the 16-bit immediate is large enough.&lt;&#x2F;p&gt;
&lt;p&gt;A version with an 8-bit immediate would only allow moving &lt;code&gt;PC&lt;&#x2F;code&gt; backward by 125 or forward by 127 bytes. While that seems to be a good enough distance for many for-loops, it is likely not good enough for cross-function jumps, and since the 16-bit immediate is the same size as what a dynamic jump would take in such cases (3 bytes: &lt;code&gt;JUMP PUSH1 n&lt;&#x2F;code&gt;), we think having less instructions is better.&lt;&#x2F;p&gt;
&lt;p&gt;Should there be a need to have immediate encodings of other size (such as 8-bits, 24-bits or 32-bits), it would be possible to introduce new opcodes, similarly to how multiple &lt;code&gt;PUSH&lt;&#x2F;code&gt; instructions exist.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;pushn-jump-sequences&quot;&gt;&lt;code&gt;PUSHn JUMP&lt;&#x2F;code&gt; sequences&lt;&#x2F;h3&gt;
&lt;p&gt;If we chose absolute addressing, then &lt;code&gt;RJUMP&lt;&#x2F;code&gt; could be viewed similar to the sequence &lt;code&gt;PUSHn JUMP&lt;&#x2F;code&gt; (and &lt;code&gt;RJUMPI&lt;&#x2F;code&gt; similar to &lt;code&gt;PUSHn JUMPI&lt;&#x2F;code&gt;). In that case one could argue that instead of introducing a new instruction, such sequences should get a discount, because EVMs could optimise them.&lt;&#x2F;p&gt;
&lt;p&gt;We think this is a bad direction to go:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;It further complicates the already complex rules of gas calculation.&lt;&#x2F;li&gt;
&lt;li&gt;And it either requires a consensus defined internal representation for EVM code, or forces EVM implementations to do optimisations on their own.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Both of these are risky. Furthermore we think that EVM implementations should be free to chose what optimisations they apply, and the savings do not need to be passed down at all cost.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally it requires a potentially significant change to the current implementations which depend on a streaming one-by-one execution without a lookahead.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;relation-to-dynamic-jumps&quot;&gt;Relation to dynamic jumps&lt;&#x2F;h3&gt;
&lt;p&gt;The goal was not to completely replace the current control flow system of the EVM, but to augment it. There are many cases where dynamic jumps are useful, such as returning to the caller.&lt;&#x2F;p&gt;
&lt;p&gt;It is possible to introduce a new mechanism for having a pre-defined table of valid jump destinations, and dynamically supplying the index within this table to accomplish some form of dynamic jumps. This is very useful for efficiently encoding a form of &quot;switch-cases&quot; statements. It could also be used for &quot;return to caller&quot; cases, however it is likely inefficient or awkward.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;lack-of-jumpdest&quot;&gt;Lack of &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; serves two purposes:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;To efficiently partition code -- this can be useful for pre-calculating total gas usage for a given &lt;em&gt;block&lt;&#x2F;em&gt; (i.e. instructions between &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt;s), and for JIT&#x2F;AOT translation.&lt;&#x2F;li&gt;
&lt;li&gt;To explicitly show valid locations (otherwise any non-data location would be valid).&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;This functionality is not needed for static jumps, as the analysers can easily tell destinations from the static jump immediates during jumpdest-analysis.&lt;&#x2F;p&gt;
&lt;p&gt;There are two benefits here:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Not wasting a byte for a &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; also means a saving of 200 gas during deployment, for each jump destination.&lt;&#x2F;li&gt;
&lt;li&gt;Saving an extra 1 gas per jump during execution, given &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; itself cost 1 gas and is &quot;executed&quot; during jumping.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;rjumpv-fallback-case&quot;&gt;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt; fallback case&lt;&#x2F;h3&gt;
&lt;p&gt;If no match is found (i.e. the &lt;em&gt;default&lt;&#x2F;em&gt; case) in the &lt;code&gt;RJUMPV&lt;&#x2F;code&gt; instruction execution will continue without branching. This allows for gaps in the arguments to be filled with &lt;code&gt;0&lt;&#x2F;code&gt;s, and a choice of implementation by the programmer. Alternate options would include exceptional aborts in case of no match.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change poses no risk to backwards compatibility, as it is introduced at the same time EIP-3540 is. The new instructions are not introduced for legacy bytecode (code which is not EOF formatted).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;validation&quot;&gt;Validation&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;valid-cases&quot;&gt;Valid cases&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;RJUMP&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt; with &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; as target
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;relative_offset&lt;&#x2F;code&gt; is positive&#x2F;negative&#x2F;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RJUMP&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt; with instruction other than &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; as target
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;relative_offset&lt;&#x2F;code&gt; is positive&#x2F;negative&#x2F;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt; with various valid table sizes from 1 to 256&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RJUMP&lt;&#x2F;code&gt; as a final instruction in code section&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;invalid-cases&quot;&gt;Invalid cases&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;RJUMP&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt; with truncated immediate&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt; as a final instruction in code section&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RJUMP&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt; target outside of code section bounds&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RJUMP&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt; target push data&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RJUMP&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt; target another &lt;code&gt;RJUMP&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt; immediate argument&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;execution&quot;&gt;Execution&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;RJUMP&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt; in legacy code aborts execution&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RJUMP&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;relative_offset&lt;&#x2F;code&gt; is positive&#x2F;negative&#x2F;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;relative_offset&lt;&#x2F;code&gt; is positive&#x2F;negative&#x2F;&lt;code&gt;0&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;condition&lt;&#x2F;code&gt; equals &lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;condition&lt;&#x2F;code&gt; does not equal &lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RJUMPV 0 relative_offset&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;case&lt;&#x2F;code&gt; equals &lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;case&lt;&#x2F;code&gt; does not equal &lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt; with table containing positive, negative, &lt;code&gt;0&lt;&#x2F;code&gt; offsets
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;case&lt;&#x2F;code&gt; equals &lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;case&lt;&#x2F;code&gt; does not equal &lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;case&lt;&#x2F;code&gt; outside of table bounds (&lt;code&gt;case &amp;gt; max_index&lt;&#x2F;code&gt;, fallback case)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;case&lt;&#x2F;code&gt; &amp;gt; 255&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Adding new instructions with immediate arguments should be carefully considered when implementing the EOF container validation algorithm.&lt;&#x2F;p&gt;
&lt;p&gt;Static relative jump execution does not require runtime check of the jump destination. It greatly reduces execution cost. Therefore the gas cost of the new instructions can also be significantly reduced.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;RJUMPV&lt;&#x2F;code&gt; instruction relative offset table can have up to 256 one-byte entries, so reading an offset cannot be a potential attack surface.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Warm COINBASE</title>
        <published>2021-07-12T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>William Morriss</name><uri>https://github.com/wjmelements</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3651/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3651-warm-coinbase/6640" />
        

        <id>https://wg-eips.ritovision.com/3651/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:3651"
            label="EIP-3651" />
        

        
        

        
        <summary type="html">Starts the `COINBASE` address warm</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3651/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;COINBASE&lt;&#x2F;code&gt; address shall be warm at the start of transaction execution, in accordance with the actual cost of reading that account.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Direct &lt;code&gt;COINBASE&lt;&#x2F;code&gt; payments are becoming increasingly popular because they allow conditional payments, which provide benefits such as implicit cancellation of transactions that would revert.
But accessing &lt;code&gt;COINBASE&lt;&#x2F;code&gt; is overpriced; the address is initially cold under the access list framework introduced in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;.
This gas cost mismatch can incentivize alternative payments besides ETH, such as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;, but ETH should be the primary means of paying for transactions on Ethereum.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;At the start of transaction execution, &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt; shall be initialized to also include the address returned by &lt;code&gt;COINBASE&lt;&#x2F;code&gt; (&lt;code&gt;0x41&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The addresses currently initialized warm are the addresses that should already be loaded at the start of transaction validation.
The &lt;code&gt;ORIGIN&lt;&#x2F;code&gt; address is always loaded to check its balance against the gas limit and the gas price.
The &lt;code&gt;tx.to&lt;&#x2F;code&gt; address is always loaded to begin execution.
The &lt;code&gt;COINBASE&lt;&#x2F;code&gt; address should also be always be loaded because it receives the block reward and the transaction fees.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;There are no known backward compatibility issues presented by this change.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;There are no known security considerations introduced by this change.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>T-REX - Token for Regulated EXchanges</title>
        <published>2021-07-09T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Joachim Lebrun</name><uri>https://github.com/Joachim-Lebrun</uri>
	</author>
	
	<author>
		<name>Tony Malghem</name><uri>https://github.com/TonyMalghem</uri>
	</author>
	
	<author>
		<name>Kevin Thizy</name><uri>https://github.com/Nakasar</uri>
	</author>
	
	<author>
		<name>Luc Falempin</name><uri>https://github.com/lfalempin</uri>
	</author>
	
	<author>
		<name>Adam Boudjemaa</name><uri>https://github.com/Aboudjem</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3643/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3643-proposition-of-the-t-rex-token-standard-for-securities/6844" />
        

        <id>https://wg-eips.ritovision.com/3643/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:3643"
            label="ERC-3643" />
        

        
        

        
        <summary type="html">An institutional grade security token contract that provides interfaces for the management and compliant transfer of security tokens.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3643/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The T-REX token is an institutional grade security token standard. This standard provides a library of interfaces for the management and compliant transfer of security tokens, using an automated onchain validator system leveraging onchain identities for eligibility checks.&lt;&#x2F;p&gt;
&lt;p&gt;The standard defines several interfaces that are described hereunder:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Token&lt;&#x2F;li&gt;
&lt;li&gt;Identity Registry&lt;&#x2F;li&gt;
&lt;li&gt;Identity Registry Storage&lt;&#x2F;li&gt;
&lt;li&gt;Compliance&lt;&#x2F;li&gt;
&lt;li&gt;Trusted Issuers Registry&lt;&#x2F;li&gt;
&lt;li&gt;Claim Topics Registry&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The advent of blockchain technology has brought about a new era of efficiency, accessibility, and liquidity in the world of asset transfer. This is particularly evident in the realm of cryptocurrencies, where users can transfer token ownership peer-to-peer without intermediaries. However, when it comes to tokenized securities or security tokens, the situation is more complex due to the need for compliance with securities laws. These tokens cannot be permissionless like utility tokens; they must be permissioned to track ownership and ensure that only eligible investors can hold tokens.&lt;&#x2F;p&gt;
&lt;p&gt;The existing Ethereum protocol, while powerful and versatile, does not fully address the unique challenges posed by security tokens. There is a need for a standard that supports compliant issuance and management of permissioned tokens, suitable for representing a wide range of asset classes, including small businesses and real estate.&lt;&#x2F;p&gt;
&lt;p&gt;The proposed &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3643&#x2F;&quot;&gt;ERC-3643&lt;&#x2F;a&gt; standard is motivated by this need. It aims to provide a comprehensive framework for managing the lifecycle of security tokens, from issuance to transfers between eligible investors, while enforcing compliance rules at every stage. The standard also supports additional features such as token pausing and freezing, which can be used to manage the token in response to regulatory requirements or changes in the status of the token or its holders.&lt;&#x2F;p&gt;
&lt;p&gt;Moreover, the standard is designed to work in conjunction with an on-chain Identity system, allowing for the validation of the identities and credentials of investors through signed attestations issued by trusted claim issuers. This ensures compliance with legal and regulatory requirements for the trading of security tokens.&lt;&#x2F;p&gt;
&lt;p&gt;In summary, the motivation behind the proposed standard is to bring the benefits of blockchain technology to the world of securities, while ensuring compliance with existing securities laws. It aims to provide a robust, flexible, and efficient framework for the issuance and management of security tokens, thereby accelerating the evolution of capital markets.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The proposed standard has the following requirements:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;MUST&lt;&#x2F;strong&gt; be &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; compatible.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;MUST&lt;&#x2F;strong&gt; be used in combination with an onchain Identity system&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;MUST&lt;&#x2F;strong&gt; be able to apply any rule of compliance that is required by the regulator or by the token issuer (about the factors of eligibility of an identity or about the rules of the token itself)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;MUST&lt;&#x2F;strong&gt; have a standard interface to pre-check if a transfer is going to pass or fail before sending it to the blockchain&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;MUST&lt;&#x2F;strong&gt; have a recovery system in case an investor loses access to his private key&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;MUST&lt;&#x2F;strong&gt; be able to freeze tokens on the wallet of investors if needed, partially or totally&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;MUST&lt;&#x2F;strong&gt; have the possibility to pause the token&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;MUST&lt;&#x2F;strong&gt; be able to mint and burn tokens&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;MUST&lt;&#x2F;strong&gt; define an Agent role and an Owner (token issuer) role&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;MUST&lt;&#x2F;strong&gt; be able to force transfers from an Agent wallet&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;MUST&lt;&#x2F;strong&gt; be able to issue transactions in batch (to save gas and to have all the transactions performed in the same block)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;While this standard is backwards compatible with ERC-20 and all ERC-20 functions can be called on an ERC-3643 token, the implementation of these functions differs due to the permissioned nature of ERC-3643. Each token transfer under this standard involves a compliance check to validate the transfer and the eligibility of the stakeholder’s identities.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;agent-role-interface&quot;&gt;Agent Role Interface&lt;&#x2F;h3&gt;
&lt;p&gt;The standard defines an Agent role, which is crucial for managing access to various functions of the smart contracts. The interface for the Agent role is as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IAgentRole&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; events&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AgentAdded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _agent&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AgentRemoved&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _agent&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; functions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; setters&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addAgent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _agent&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; removeAgent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _agent&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; getters&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isAgent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _agent&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;IAgentRole&lt;&#x2F;code&gt; interface allows for the addition and removal of agents, as well as checking if an address is an agent. In this standard, it is the owner role, as defined by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;173&#x2F;&quot;&gt;ERC-173&lt;&#x2F;a&gt;, that has the responsibility of appointing and removing agents. Any contract that fulfills the role of a Token contract or an Identity Registry within the context of this standard must be compatible with the &lt;code&gt;IAgentRole&lt;&#x2F;code&gt; interface.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;main-functions&quot;&gt;Main functions&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;transfer&quot;&gt;Transfer&lt;&#x2F;h4&gt;
&lt;p&gt;To be able to perform a transfer on T-REX you need to fulfill several conditions :&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The sender &lt;strong&gt;MUST&lt;&#x2F;strong&gt; hold enough free balance (total balance - frozen tokens, if any)&lt;&#x2F;li&gt;
&lt;li&gt;The receiver &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be whitelisted on the Identity Registry and verified (hold the necessary claims on his onchain Identity)&lt;&#x2F;li&gt;
&lt;li&gt;The sender&#x27;s wallet &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; be frozen&lt;&#x2F;li&gt;
&lt;li&gt;The receiver&#x27;s wallet &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; be frozen&lt;&#x2F;li&gt;
&lt;li&gt;The token &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; be paused&lt;&#x2F;li&gt;
&lt;li&gt;The transfer &lt;strong&gt;MUST&lt;&#x2F;strong&gt; respect all the rules of compliance defined in the Compliance smart contract (canTransfer needs to return TRUE)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Here is an example of &lt;code&gt;transfer&lt;&#x2F;code&gt; function implementation :&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; whenNotPaused&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;_frozen&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_to&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !&lt;&#x2F;span&gt;&lt;span&gt;_frozen&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC-3643: Frozen wallet&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_amount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;_frozenTokens&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC-3643: Insufficient Balance&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt; _tokenIdentityRegistry&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isVerified&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC-3643: Invalid identity&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt; _tokenCompliance&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;canTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC-3643: Compliance failure&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _tokenCompliance&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transferred&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;transferFrom&lt;&#x2F;code&gt; function works the same way while the &lt;code&gt;mint&lt;&#x2F;code&gt; function and the &lt;code&gt;forcedTransfer&lt;&#x2F;code&gt; function only require the receiver to be whitelisted and verified on the Identity Registry (they bypass the compliance rules). The &lt;code&gt;burn&lt;&#x2F;code&gt; function bypasses all checks on eligibility.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;isverified&quot;&gt;isVerified&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;isVerified&lt;&#x2F;code&gt; function is called from within the transfer functions &lt;code&gt;transfer&lt;&#x2F;code&gt;, &lt;code&gt;transferFrom&lt;&#x2F;code&gt;, &lt;code&gt;mint&lt;&#x2F;code&gt; and
&lt;code&gt;forcedTransfer&lt;&#x2F;code&gt; to instruct the &lt;code&gt;Identity Registry&lt;&#x2F;code&gt; to check if the receiver is a valid investor, i.e. if his
wallet address is in the &lt;code&gt;Identity Registry&lt;&#x2F;code&gt; of the token, and if the &lt;code&gt;Identity&lt;&#x2F;code&gt;contract linked to his wallet
contains the claims (see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3643&#x2F;.&#x2F;assets&#x2F;ONCHAINID&#x2F;IERC735.sol&quot;&gt;Claim Holder&lt;&#x2F;a&gt;) required in the &lt;code&gt;Claim Topics Registry&lt;&#x2F;code&gt; and
if these claims are signed by an authorized Claim Issuer as required in the &lt;code&gt;Trusted Issuers Registry&lt;&#x2F;code&gt;.
If all the requirements are fulfilled, the &lt;code&gt;isVerified&lt;&#x2F;code&gt; function returns &lt;code&gt;TRUE&lt;&#x2F;code&gt;, otherwise it returns &lt;code&gt;FALSE&lt;&#x2F;code&gt;. An
implementation of this function can be found on the T-REX repository of Tokeny.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;cantransfer&quot;&gt;canTransfer&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;canTransfer&lt;&#x2F;code&gt; function is also called from within transfer functions. This function checks if the transfer is compliant with global compliance rules applied to the token, in opposition with &lt;code&gt;isVerified&lt;&#x2F;code&gt; that only checks the eligibility of an investor to hold and receive tokens, the &lt;code&gt;canTransfer&lt;&#x2F;code&gt; function is looking at global compliance rules, e.g. check if the transfer is compliant in the case there is a fixed maximum number of token holders to respect (can be a limited number of holders per country as well), check if the transfer respects rules setting a maximum amount of tokens per investor, ...
If all the requirements are fulfilled, the &lt;code&gt;canTransfer&lt;&#x2F;code&gt; function will return &lt;code&gt;TRUE&lt;&#x2F;code&gt; otherwise it will return
&lt;code&gt;FALSE&lt;&#x2F;code&gt; and the transfer will not be allowed to happen. An implementation of this function can be found on the T-REX
repository of Tokeny.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;other-functions&quot;&gt;Other functions&lt;&#x2F;h4&gt;
&lt;p&gt;Description of other functions of the ERC-3643 can be found in the &lt;code&gt;interfaces&lt;&#x2F;code&gt; folder. An implementation of the
ERC-3643 suite of smart contracts can be found on the T-REX repository of Tokeny.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;token-interface&quot;&gt;Token interface&lt;&#x2F;h3&gt;
&lt;p&gt;ERC-3643 permissioned tokens build upon the standard ERC-20 structure, but with additional functions to ensure compliance in the transactions of the security tokens. The functions &lt;code&gt;transfer&lt;&#x2F;code&gt; and &lt;code&gt;transferFrom&lt;&#x2F;code&gt; are implemented in a conditional way, allowing them to proceed with a transfer only if the transaction is valid. The permissioned tokens are allowed to be transferred only to validated counterparties, in order to avoid tokens being held in wallets&#x2F;Identity contracts of ineligible&#x2F;unauthorized investors. The ERC-3643 standard also supports the recovery of security tokens in case an investor loses access to their wallet private key. A history of recovered tokens is maintained on the blockchain for transparency reasons.&lt;&#x2F;p&gt;
&lt;p&gt;ERC-3643 tokens implement a range of additional functions to enable the owner or their appointed agents to manage supply, transfer rules, lockups, and any other requirements in the management of a security. The standard relies on ERC-173 to define contract ownership, with the owner having the responsibility of appointing agents. Any contract that fulfills the role of a Token contract within the context of this standard must be compatible with the &lt;code&gt;IAgentRole&lt;&#x2F;code&gt; interface.&lt;&#x2F;p&gt;
&lt;p&gt;A detailed description of the functions can be found in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3643&#x2F;.&#x2F;assets&#x2F;interfaces&#x2F;IERC3643.sol&quot;&gt;interfaces folder&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC3643&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC20&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; events&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UpdatedTokenInformation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _newName&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _newSymbol&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _newDecimals&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _newVersion&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _newOnchainID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IdentityRegistryAdded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _identityRegistry&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ComplianceAdded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _compliance&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RecoverySuccess&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _lostWallet&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _newWallet&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _investorOnchainID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AddressFrozen&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _userAddress&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _isFrozen&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TokensFrozen&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _userAddress&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TokensUnfrozen&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _userAddress&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Paused&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _userAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Unpaused&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _userAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; functions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; getters&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onchainID&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; version&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; identityRegistry&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;IIdentityRegistry&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; compliance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;ICompliance&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; paused&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isFrozen&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _userAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getFrozenTokens&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _userAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; setters&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setName&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _name&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setSymbol&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _symbol&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setOnchainID&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _onchainID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; pause&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; unpause&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setAddressFrozen&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _userAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _freeze&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; freezePartialTokens&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _userAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; unfreezePartialTokens&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _userAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setIdentityRegistry&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _identityRegistry&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setCompliance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _compliance&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; transfer actions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; forcedTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; burn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _userAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; recoveryAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _lostWallet&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _newWallet&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _investorOnchainID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; batch functions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; batchTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _toList&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amounts&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; batchForcedTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _fromList&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _toList&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amounts&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; batchMint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _toList&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amounts&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; batchBurn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _userAddresses&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amounts&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; batchSetAddressFrozen&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _userAddresses&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _freeze&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; batchFreezePartialTokens&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _userAddresses&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amounts&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; batchUnfreezePartialTokens&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _userAddresses&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amounts&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;identity-registry-interface&quot;&gt;Identity Registry Interface&lt;&#x2F;h3&gt;
&lt;p&gt;The Identity Registry is linked to storage that contains a dynamic whitelist of identities. It establishes the link between a wallet address, an Identity smart contract, and a country code corresponding to the investor&#x27;s country of residence. This country code is set in accordance with the ISO-3166 standard. The Identity Registry also includes a function called &lt;code&gt;isVerified()&lt;&#x2F;code&gt;, which returns a status based on the validity of claims (as per the security token requirements) in the user’s Identity contract.&lt;&#x2F;p&gt;
&lt;p&gt;The standard relies on ERC-173 to define contract ownership, with the owner having the responsibility of appointing agents. Any contract that fulfills the role of an Identity Registry within the context of this standard must be compatible with the &lt;code&gt;IAgentRole&lt;&#x2F;code&gt; interface. The Identity Registry is managed by the agent wallet(s), meaning only the agent(s) can add or remove identities in the registry. Note that the agent role on the Identity Registry is set by the owner, therefore the owner could set themselves as the agent if they want to maintain full control. There is a specific identity registry for each security token.&lt;&#x2F;p&gt;
&lt;p&gt;A detailed description of the functions can be found in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3643&#x2F;.&#x2F;assets&#x2F;interfaces&#x2F;IIdentityRegistry.sol&quot;&gt;interfaces folder&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Note that &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3643&#x2F;.&#x2F;assets&#x2F;ONCHAINID&#x2F;IClaimIssuer.sol&quot;&gt;&lt;code&gt;IClaimIssuer&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3643&#x2F;.&#x2F;assets&#x2F;ONCHAINID&#x2F;IIdentity.sol&quot;&gt;&lt;code&gt;IIdentity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; are needed in this interface as they are required for the Identity eligibility checks.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IIdentityRegistry&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; events&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ClaimTopicsRegistrySet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; claimTopicsRegistry&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IdentityStorageSet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; identityStorage&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TrustedIssuersRegistrySet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trustedIssuersRegistry&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IdentityRegistered&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; investorAddress&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;IIdentity&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; identity&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IdentityRemoved&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; investorAddress&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;IIdentity&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; identity&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IdentityUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;IIdentity&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; oldIdentity&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;IIdentity&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newIdentity&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CountryUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; investorAddress&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint16&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; country&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; functions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; identity registry getters&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; identityStorage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;IIdentityRegistryStorage&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; issuersRegistry&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;ITrustedIssuersRegistry&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; topicsRegistry&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;IClaimTopicsRegistry&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;identity registry setters&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setIdentityRegistryStorage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _identityRegistryStorage&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setClaimTopicsRegistry&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _claimTopicsRegistry&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setTrustedIssuersRegistry&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _trustedIssuersRegistry&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; registry actions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; registerIdentity&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _userAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; IIdentity&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _identity&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint16&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _country&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; deleteIdentity&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _userAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; updateCountry&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _userAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint16&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _country&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; updateIdentity&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _userAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; IIdentity&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _identity&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; batchRegisterIdentity&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _userAddresses&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; IIdentity&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _identities&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint16&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _countries&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; registry consultation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; contains&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _userAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isVerified&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _userAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; identity&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _userAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;IIdentity&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; investorCountry&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _userAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint16&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;identity-registry-storage-interface&quot;&gt;Identity Registry Storage Interface&lt;&#x2F;h3&gt;
&lt;p&gt;The Identity Registry Storage stores the identity addresses of all the authorized investors in the security token(s) linked to the storage contract. These are all identities of investors who have been authorized to hold the token(s) after having gone through the appropriate KYC and eligibility checks. The Identity Registry Storage can be bound to one or several Identity Registry contract(s). The goal of the Identity Registry storage is to separate the Identity Registry functions and specifications from its storage. This way, it is possible to keep one single Identity Registry contract per token, with its own Trusted Issuers Registry and Claim Topics Registry, but with a shared whitelist of investors used by the &lt;code&gt;isVerifed()&lt;&#x2F;code&gt; function implemented in the Identity Registries to check the eligibility of the receiver in a transfer transaction.&lt;&#x2F;p&gt;
&lt;p&gt;The standard relies on ERC-173 to define contract ownership, with the owner having the responsibility of appointing agents(in this case through the &lt;code&gt;bindIdentityRegistry&lt;&#x2F;code&gt; function). Any contract that fulfills the role of an Identity Registry Storage within the context of this standard must be compatible with the &lt;code&gt;IAgentRole&lt;&#x2F;code&gt; interface. The Identity Registry Storage is managed by the agent addresses (i.e. the bound Identity Registries), meaning only the agent(s) can add or remove identities in the registry. Note that the agent role on the Identity Registry Storage is set by the owner, therefore the owner could set themselves as the agent if they want to modify the storage manually. Otherwise it is the bound Identity Registries that are using the agent role to write in the Identity Registry Storage.&lt;&#x2F;p&gt;
&lt;p&gt;A detailed description of the functions can be found in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3643&#x2F;.&#x2F;assets&#x2F;interfaces&#x2F;IIdentityRegistryStorage.sol&quot;&gt;interfaces folder&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IIdentityRegistryStorage&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;events&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IdentityStored&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; investorAddress&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;IIdentity&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; identity&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IdentityUnstored&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; investorAddress&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;IIdentity&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; identity&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IdentityModified&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;IIdentity&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; oldIdentity&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;IIdentity&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newIdentity&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CountryModified&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; investorAddress&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint16&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; country&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IdentityRegistryBound&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; identityRegistry&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IdentityRegistryUnbound&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; identityRegistry&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;functions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; storage related functions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; storedIdentity&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _userAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;IIdentity&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; storedInvestorCountry&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _userAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint16&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addIdentityToStorage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _userAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; IIdentity&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _identity&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint16&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _country&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; removeIdentityFromStorage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _userAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; modifyStoredInvestorCountry&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _userAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint16&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _country&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; modifyStoredIdentity&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _userAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; IIdentity&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _identity&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; role setter&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; bindIdentityRegistry&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _identityRegistry&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; unbindIdentityRegistry&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _identityRegistry&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; getter for bound IdentityRegistry role&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; linkedIdentityRegistries&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;compliance-interface&quot;&gt;Compliance Interface&lt;&#x2F;h3&gt;
&lt;p&gt;The Compliance contract is used to set the rules of the offering itself and ensures these rules are respected during the whole lifecycle of the token. For example, the Compliance contract will define the maximum amount of investors per country, the maximum amount of tokens per investor, and the accepted countries for the circulation of the token (using the country code corresponding to each investor in the Identity Registry). The Compliance smart contract can be either “tailor-made”, following the legal requirements of the token issuer, or can be deployed under a generic modular form, which can then add and remove external compliance &lt;code&gt;Modules&lt;&#x2F;code&gt; to fit the legal requirements of the token in the same way as a custom &quot;tailor-made&quot; contract would.&lt;&#x2F;p&gt;
&lt;p&gt;This contract is triggered at every transaction by the Token and returns &lt;code&gt;TRUE&lt;&#x2F;code&gt; if the transaction is compliant with the rules of the offering and &lt;code&gt;FALSE&lt;&#x2F;code&gt; otherwise.&lt;&#x2F;p&gt;
&lt;p&gt;The standard relies on ERC-173 to define contract ownership, with the owner having the responsibility of setting the Compliance parameters and binding the Compliance to a Token contract.&lt;&#x2F;p&gt;
&lt;p&gt;A detailed description of the functions can be found in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3643&#x2F;.&#x2F;assets&#x2F;interfaces&#x2F;ICompliance.sol&quot;&gt;interfaces folder&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ICompliance&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; events&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TokenBound&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TokenUnbound&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; functions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; initialization of the compliance contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; bindToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; unbindToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; check the parameters of the compliance contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isTokenBound&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getTokenBound&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; compliance check and state update&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; canTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferred&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; created&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; destroyed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;trusted-issuer-s-registry-interface&quot;&gt;Trusted Issuer&#x27;s Registry Interface&lt;&#x2F;h3&gt;
&lt;p&gt;The Trusted Issuer&#x27;s Registry stores the contract addresses (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3643&#x2F;.&#x2F;assets&#x2F;ONCHAINID&#x2F;IClaimIssuer.sol&quot;&gt;IClaimIssuer&lt;&#x2F;a&gt;) of all the trusted claim issuers for a specific security token. The Identity contract (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3643&#x2F;.&#x2F;assets&#x2F;ONCHAINID&#x2F;IIdentity.sol&quot;&gt;IIdentity&lt;&#x2F;a&gt;) of token owners (the investors) must have claims signed by the claim issuers stored in this smart contract in order to be able to hold the token.&lt;&#x2F;p&gt;
&lt;p&gt;The standard relies on ERC-173 to define contract ownership, with the owner having the responsibility of managing this registry as per their requirements. This includes the ability to add, remove, and update the list of Trusted Issuers.&lt;&#x2F;p&gt;
&lt;p&gt;A detailed description of the functions can be found in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3643&#x2F;.&#x2F;assets&#x2F;interfaces&#x2F;ITrustedIssuersRegistry.sol&quot;&gt;interfaces folder&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ITrustedIssuersRegistry&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; events&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TrustedIssuerAdded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;IClaimIssuer&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trustedIssuer&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; claimTopics&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TrustedIssuerRemoved&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;IClaimIssuer&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trustedIssuer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ClaimTopicsUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;IClaimIssuer&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trustedIssuer&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; claimTopics&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; functions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; setters&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addTrustedIssuer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;IClaimIssuer&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _trustedIssuer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _claimTopics&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; removeTrustedIssuer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;IClaimIssuer&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _trustedIssuer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; updateIssuerClaimTopics&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;IClaimIssuer&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _trustedIssuer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _claimTopics&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; getters&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getTrustedIssuers&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;IClaimIssuer&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isTrustedIssuer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _issuer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getTrustedIssuerClaimTopics&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;IClaimIssuer&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _trustedIssuer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getTrustedIssuersForClaimTopic&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; claimTopic&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;IClaimIssuer&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; hasClaimTopic&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _issuer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _claimTopic&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;claim-topics-registry-interface&quot;&gt;Claim Topics Registry Interface&lt;&#x2F;h3&gt;
&lt;p&gt;The Claim Topics Registry stores all the trusted claim topics for the security token. The Identity contract (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3643&#x2F;.&#x2F;assets&#x2F;ONCHAINID&#x2F;IIdentity.sol&quot;&gt;IIdentity&lt;&#x2F;a&gt;) of token owners must contain claims of the claim topics stored in this smart contract.&lt;&#x2F;p&gt;
&lt;p&gt;The standard relies on ERC-173 to define contract ownership, with the owner having the responsibility of managing this registry as per their requirements. This includes the ability to add and remove required Claim Topics.&lt;&#x2F;p&gt;
&lt;p&gt;A detailed description of the functions can be found in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3643&#x2F;.&#x2F;assets&#x2F;interfaces&#x2F;IClaimTopicsRegistry.sol&quot;&gt;interfaces folder&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IClaimTopicsRegistry&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; events&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ClaimTopicAdded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; claimTopic&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ClaimTopicRemoved&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; claimTopic&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; functions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; setters&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addClaimTopic&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _claimTopic&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; removeClaimTopic&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _claimTopic&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; getter&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getClaimTopics&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;transfer-restrictions&quot;&gt;Transfer Restrictions&lt;&#x2F;h3&gt;
&lt;p&gt;Transfers of securities can fail for a variety of reasons. This is in direct contrast to utility tokens, which generally only require the sender to have a sufficient balance. These conditions can be related to the status of an investor’s wallet, the identity of the sender and receiver of the securities (i.e., whether they have been through a KYC process, whether they are accredited or an affiliate of the issuer) or for reasons unrelated to the specific transfer but instead set at the token level (i.e., the token contract enforces a maximum number of investors or a cap on the percentage held by any single investor). For ERC-20 tokens, the &lt;code&gt;balanceOf&lt;&#x2F;code&gt; and &lt;code&gt;allowance&lt;&#x2F;code&gt; functions provide a way to check that a transfer is likely to succeed before executing the transfer, which can be executed both on-chain and off-chain. For tokens representing securities, the T-REX standard introduces a function &lt;code&gt;canTransfer&lt;&#x2F;code&gt; which provides a more general-purpose way to achieve this. I.e., when the reasons for failure are related to the compliance rules of the token and a function &lt;code&gt;isVerified&lt;&#x2F;code&gt; which allows checking the eligibility status of the identity of the investor. Transfers can also fail if the address of the sender and&#x2F;or receiver is frozen, or if the free balance of the sender (total balance - frozen tokens) is lower than the amount to transfer. Ultimately, the transfer could be blocked if the token is &lt;code&gt;paused&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;identity-management&quot;&gt;Identity Management&lt;&#x2F;h3&gt;
&lt;p&gt;Security and compliance of transfers are enforced through the management of on-chain identities. These include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Identity contract: A unique identifier for each investor, which is used to manage their identity and claims.&lt;&#x2F;li&gt;
&lt;li&gt;Claim: Signed attestations issued by a trusted claim issuer that confirm certain attributes or qualifications of the token holders, such as their identity, location, investor status, or KYC&#x2F;AML clearance.&lt;&#x2F;li&gt;
&lt;li&gt;Identity Storage&#x2F;Registry: A storage system for all Identity contracts and their associated wallets, which is used to
verify the eligibility of investors during transfers.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;token-lifecycle-management&quot;&gt;Token Lifecycle Management&lt;&#x2F;h3&gt;
&lt;p&gt;The T-REX standard provides a comprehensive framework for managing the lifecycle of security tokens. This includes the issuance of tokens, transfers between eligible investors, and the enforcement of compliance rules at every stage of the token&#x27;s lifecycle. The standard also supports additional features such as token pausing and freezing, which can be used to manage the token in response to regulatory requirements or changes in the status of the token or its holders.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;additional-compliance-rules&quot;&gt;Additional Compliance Rules&lt;&#x2F;h3&gt;
&lt;p&gt;The T-REX standard supports the implementation of additional compliance rules through modular compliance. These modules can be used to enforce a wide range of rules and restrictions, such as caps on the number of investors or the percentage of tokens held by a single investor, restrictions on transfers between certain types of investors, and more. This flexibility allows issuers to tailor the compliance rules of their tokens to their specific needs and regulatory environment.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;inclusion-of-agent-related-functions&quot;&gt;Inclusion of Agent-Related Functions&lt;&#x2F;h3&gt;
&lt;p&gt;The inclusion of Agent-scoped functions within the standard interfaces is deliberate. The intent is to accommodate secure and adaptable token management practices that surpass the capabilities of EOA management. We envision scenarios where the agent role is fulfilled by automated systems or smart contracts, capable of programmatically executing operational functions like minting, burning, and freezing in response to specified criteria or regulatory triggers. For example, a smart contract might automatically burn tokens to align with redemption requests in an open-ended fund, or freeze tokens associated with wallets engaged in fraudulent activities.&lt;&#x2F;p&gt;
&lt;p&gt;Consequently, these functions are standardized to provide a uniform interface for various automated systems interacting with different ERC-3643 tokens, allowing for standardized tooling and interfaces that work across the entire ecosystem. This approach ensures that ERC-3643 remains flexible, future-proof, and capable of supporting a wide array of operational models.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;T-REX tokens should be backwards compatible with ERC-20 and ERC-173
and should be able to interact with a &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3643&#x2F;.&#x2F;assets&#x2F;ONCHAINID&#x2F;IERC735.sol&quot;&gt;Claim Holder contract&lt;&#x2F;a&gt; to validate
the claims linked to an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3643&#x2F;.&#x2F;assets&#x2F;ONCHAINID&#x2F;IIdentity.sol&quot;&gt;Identity contract&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This specification has been audited by Kapersky and Hacken, and no notable security considerations were found.
While the audits were primarily focused on the specific implementation by Tokeny, they also challenged and validated the core principles of the T-REX standard. The auditing teams approval of these principles provides assurance that the standard itself is robust and does not present any significant security concerns.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EOF - Code Validation</title>
        <published>2021-06-23T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	<author>
		<name>Andrei Maiboroda</name><uri>https://github.com/gumb0</uri>
	</author>
	
	<author>
		<name>Paweł Bylica</name><uri>https://github.com/chfast</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3670/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3670-eof-code-validation/6693" />
        

        <id>https://wg-eips.ritovision.com/3670/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:3670"
            label="EIP-3670" />
        

        
        

        
        <summary type="html">Validate EOF bytecode for correctness at the time of deployment.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3670/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce code validation at contract creation time for EOF formatted (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3540&#x2F;&quot;&gt;EIP-3540&lt;&#x2F;a&gt;)
contracts. Reject contracts which contain truncated &lt;code&gt;PUSH&lt;&#x2F;code&gt;-data or undefined instructions.
Legacy bytecode (code which is not EOF formatted) is unaffected by this change.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently existing contracts require no validation of correctness and EVM implementations can decide
how they handle truncated bytecode or undefined instructions. This change aims to bring code
validity into consensus, so that it becomes easier to reason about bytecode.
Moreover, EVM implementations may require fewer paths to decide which instruction is valid in
the current execution context.&lt;&#x2F;p&gt;
&lt;p&gt;If there&#x27;s a desire to introduce new instructions without bumping the EOF version, having undefined instructions already deployed could potentially break such contracts, as some instructions might change their behavior. Rejecting to deploy undefined instructions allows
introducing new instructions with or without bumping the EOF version.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;eof1-forward-compatibility&quot;&gt;EOF1 forward compatibility&lt;&#x2F;h3&gt;
&lt;p&gt;The EOF1 format provides following forward compatibility properties:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;New instructions can be defined for previously unassigned opcodes. These instructions may have immediate values.&lt;&#x2F;li&gt;
&lt;li&gt;Mandatory EOF sections may be made optional.&lt;&#x2F;li&gt;
&lt;li&gt;New optional EOF sections may be introduced. They can be placed in any order in relation to previously defined sections.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;This feature is introduced on the same block EIP-3540 is enabled, therefore every EOF1-compatible bytecode MUST be validated according to these rules.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Previously deprecated instructions &lt;code&gt;CALLCODE&lt;&#x2F;code&gt; (0xf2) and &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; (0xff), as well as instructions deprecated in EIP-3540, are invalid and their opcodes are undefined. (&lt;strong&gt;NOTE&lt;&#x2F;strong&gt; there are more instructions deprecated and rejected in EOF, as specced out by separate EIPs)&lt;&#x2F;li&gt;
&lt;li&gt;At contract creation time &lt;em&gt;code validation&lt;&#x2F;em&gt; is performed on each code section of the EOF container. The code is invalid if any of the checks below fails. For each instruction:
&lt;ol&gt;
&lt;li&gt;Check if the opcode is defined. The &lt;code&gt;INVALID&lt;&#x2F;code&gt; (0xfe) is considered defined.&lt;&#x2F;li&gt;
&lt;li&gt;Check if all instructions&#x27; immediate bytes are present in the code (code does not end in the middle of instruction).&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;immediate-data&quot;&gt;Immediate data&lt;&#x2F;h3&gt;
&lt;p&gt;Allowing implicit zero immediate data for &lt;code&gt;PUSH&lt;&#x2F;code&gt; instructions introduces inefficiencies to EVM implementations without any practical use-case (the value of a &lt;code&gt;PUSH&lt;&#x2F;code&gt; instruction at the code end cannot be observed by EVM). This EIP requires all immediate bytes to be explicitly present in the code.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;rejection-of-deprecated-instructions&quot;&gt;Rejection of deprecated instructions&lt;&#x2F;h3&gt;
&lt;p&gt;The deprecated instructions &lt;code&gt;CALLCODE&lt;&#x2F;code&gt; (0xf2) and &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; (0xff) are removed from the &lt;code&gt;valid_opcodes&lt;&#x2F;code&gt; list to prevent their use in the future.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;blockhash-instruction&quot;&gt;BLOCKHASH instruction&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt; instruction is well replaced by the system contract introduced in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2935&#x2F;&quot;&gt;EIP-2935&lt;&#x2F;a&gt;.
However, despite a replacement being introduced this opcode has not been deprecated.
This opcode will remain valid in EOF not to differentiate from legacy bytecode.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change poses no risk to backwards compatibility, as it is introduced at the same time EIP-3540 is. The validation does not cover legacy bytecode (code which is not EOF formatted).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;contract-creation&quot;&gt;Contract creation&lt;&#x2F;h3&gt;
&lt;p&gt;Each case should be tested by submitting an EOF container to EOF contract creation (as specced out in a separate EIP). Each case should be tested with code placed in code sections at different indices.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;valid-codes&quot;&gt;Valid codes&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;EOF code containing &lt;code&gt;INVALID&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;EOF code with data section containing bytes that are undefined instructions&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;invalid-codes&quot;&gt;Invalid codes&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;EOF code containing an undefined instruction&lt;&#x2F;li&gt;
&lt;li&gt;EOF code ending with incomplete &lt;code&gt;PUSH&lt;&#x2F;code&gt; instruction&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ranges below are as specified by Execution Specs for Shanghai.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Note: range(s, e) excludes e, hence the +1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;shanghai_opcodes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    *&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;00&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0b&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    *&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1d&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;20&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    *&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;30&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    *&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;40&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;48&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    *&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;50&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;5b&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;5f&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    *&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;60&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;6f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    *&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;70&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    *&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;80&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;8f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    *&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;90&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;9f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    *&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;a0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;a4&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Note: 0xfe is considered assigned.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;f0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;f1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;f2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;f3&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;f4&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;f5&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;fa&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;fd&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;fe&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;ff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Drop the opcodes deprecated and rejected in here and in EIP-3540&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;rejected_in_eof&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;38&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;39&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3b&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3c&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3f&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;5a&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;f1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;f2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;f4&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;fa&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;ff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;valid_opcodes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;op&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; op&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; shanghai_opcodes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; rejected_in_eof&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;immediate_sizes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;immediate_sizes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;60&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; PUSH1..PUSH32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Raises ValidationException on invalid code&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validate_instructions&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;code&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Note that EOF1 already asserts this with the code section requirements&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    pos&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    while&lt;&#x2F;span&gt;&lt;span&gt; pos&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Ensure the opcode is valid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        opcode&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; code&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;pos&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; opcode&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; valid_opcodes&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            raise&lt;&#x2F;span&gt;&lt;span&gt; ValidationException&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;undefined opcode&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Skip immediate data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        pos&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; immediate_sizes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;opcode&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Ensure last instruction&amp;#39;s immediate doesn&amp;#39;t go over code end&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; pos&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        raise&lt;&#x2F;span&gt;&lt;span&gt; ValidationException&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;truncated immediate&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3540&#x2F;#security-considerations&quot;&gt;Security Considerations of EIP-3540&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EOF - JUMPDEST Table</title>
        <published>2021-06-23T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	<author>
		<name>Paweł Bylica</name><uri>https://github.com/chfast</uri>
	</author>
	
	<author>
		<name>Andrei Maiboroda</name><uri>https://github.com/gumb0</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3690/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3690-eof-jumpdest-table/6806" />
        

        <id>https://wg-eips.ritovision.com/3690/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:3690"
            label="EIP-3690" />
        

        
        

        
        <summary type="html">A special EOF section for storing the list of JUMPDESTs, which simplifies execution time analysis.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3690/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce a section in the EOF format (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3540&#x2F;&quot;&gt;EIP-3540&lt;&#x2F;a&gt;) for storing the list of &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt;s, validate the correctness of this list at the time of contract creation, and remove the need for &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt;-analysis at execution time. In EOF contracts, the &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; instruction is not needed anymore and becomes invalid. Legacy contracts are entirely unaffected by this change.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently existing contracts require no validation of correctness, but every time they are executed, a list must be built containing all the valid jump-destinations. This is an overhead which can be avoided, albeit the effect of the overhead depends on the client implementation.&lt;&#x2F;p&gt;
&lt;p&gt;With the structure provided by EIP-3540 it is easy to store and transmit a table of valid jump-destinations instead of using designated &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; (0x5b) opcodes in the code.&lt;&#x2F;p&gt;
&lt;p&gt;The goal of this change is that we trade less complexity (and processing time) at execution time for more complexity at contract creation time. Through benchmarks we have identified that the mandatory execution preparation time is the same as before for extreme cases (i.e. deliberate edge cases), while it is ~10x faster for the average case.&lt;&#x2F;p&gt;
&lt;p&gt;Finally, this change puts an implicit bound on &quot;initcode analysis&quot; which is now limited to jumpdests section loading of max size of 0xffff. The legacy code remains vulnerable.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;This feature is introduced on the very same block &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3540&#x2F;&quot;&gt;EIP-3540&lt;&#x2F;a&gt; is enabled, therefore every EOF1-compatible bytecode MUST have a JUMPDEST-table if it uses jumps.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Remark:&lt;&#x2F;em&gt; We rely on the notation of &lt;em&gt;initcode&lt;&#x2F;em&gt;, &lt;em&gt;code&lt;&#x2F;em&gt; and &lt;em&gt;creation&lt;&#x2F;em&gt; as defined by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3540&#x2F;&quot;&gt;EIP-3540&lt;&#x2F;a&gt;, and extend validation rules of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3670&#x2F;&quot;&gt;EIP-3670&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;eof-container-changes&quot;&gt;EOF container changes&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;A new EOF section called &lt;code&gt;jumpdests&lt;&#x2F;code&gt; (&lt;code&gt;section_kind = 3&lt;&#x2F;code&gt;) is introduced. It contains a sequence of &lt;em&gt;n&lt;&#x2F;em&gt; unsigned integers &lt;em&gt;jumploc&lt;sub&gt;i&lt;&#x2F;sub&gt;&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;em&gt;jumploc&lt;sub&gt;i&lt;&#x2F;sub&gt;&lt;&#x2F;em&gt; values are encoded with &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;LEB128#Unsigned_LEB128&quot;&gt;unsigned LEB128&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;description&lt;&#x2F;th&gt;&lt;th&gt;encoding&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;jumploc&lt;sub&gt;0&lt;&#x2F;sub&gt;&lt;&#x2F;td&gt;&lt;td&gt;unsigned LEB128&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;jumploc&lt;sub&gt;1&lt;&#x2F;sub&gt;&lt;&#x2F;td&gt;&lt;td&gt;unsigned LEB128&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;...&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;jumploc&lt;sub&gt;n&lt;&#x2F;sub&gt;&lt;&#x2F;td&gt;&lt;td&gt;unsigned LEB128&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The jump destinations represent the set of valid code positions as arguments to jump instructions. They are delta-encoded therefore partial sum must be performed to retrieve the absolute offsets.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; jumpdest&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; jumpdests_table&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; list&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; sum&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;jumpdests_table&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;validation-rules&quot;&gt;Validation rules&lt;&#x2F;h3&gt;
&lt;blockquote&gt;
&lt;p&gt;This section extends contract creation validation rules (as defined in EIP-3540).&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;ol start=&quot;4&quot;&gt;
&lt;li&gt;The &lt;code&gt;jumpdests&lt;&#x2F;code&gt; section MUST be present if and only if the &lt;code&gt;code&lt;&#x2F;code&gt; section contains &lt;code&gt;JUMP&lt;&#x2F;code&gt; or &lt;code&gt;JUMPI&lt;&#x2F;code&gt; opcodes.&lt;&#x2F;li&gt;
&lt;li&gt;If the &lt;code&gt;jumpdests&lt;&#x2F;code&gt; section is present it MUST directly precede the &lt;code&gt;code&lt;&#x2F;code&gt; section. In this case a valid EOF bytecode will have the form of &lt;code&gt;format, magic, version, [jumpdests_section_header], code_section_header, [data_section_header], 0, [jumpdests_section_contents], code_section_contents, [data_section_contents]&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The LEB128 encoding of a &lt;code&gt;jumploc&lt;&#x2F;code&gt; must be valid: the encoding must be complete and not read out of &lt;code&gt;jumpdests&lt;&#x2F;code&gt; section. As an additional constraint, the shortest possible encoding must be used.&lt;&#x2F;li&gt;
&lt;li&gt;With an exception of the first entry, the value of &lt;code&gt;jumploc&lt;&#x2F;code&gt; MUST NOT be 0.&lt;&#x2F;li&gt;
&lt;li&gt;Every &lt;code&gt;jumploc&lt;&#x2F;code&gt; MUST point to a valid opcode. They MUST NOT point into PUSH-data or outside of the code section.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; (0x5b) instruction becomes undefined (Note: According to rules of EIP-3670, deploying the code will fail if it contains &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;execution&quot;&gt;Execution&lt;&#x2F;h3&gt;
&lt;ol start=&quot;10&quot;&gt;
&lt;li&gt;When executing &lt;code&gt;JUMP&lt;&#x2F;code&gt; or &lt;code&gt;JUMPI&lt;&#x2F;code&gt; instructions, the jump destination MUST be in the &lt;code&gt;jumpdests&lt;&#x2F;code&gt; table. Otherwise, the execution aborts with &lt;em&gt;bad jump destination&lt;&#x2F;em&gt;. In case of &lt;code&gt;JUMPI&lt;&#x2F;code&gt;, the check is done only when the jump is to be taken (no change to the previous behaviour).&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;jumpdests-section-is-bounded&quot;&gt;Jumpdests section is bounded&lt;&#x2F;h3&gt;
&lt;p&gt;The length of the &lt;code&gt;jumpdests&lt;&#x2F;code&gt; section is bounded by the EOF maximum section size value 0xffff. Moreover, for deployed code this is additionally limited by the max bytecode size 0x6000. Then any valid &lt;code&gt;jumpdests&lt;&#x2F;code&gt; section may not be larger than 0x3000.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;delta-encoding&quot;&gt;Delta encoding&lt;&#x2F;h3&gt;
&lt;p&gt;Delta-encoding is very efficient for this job. From a quick analysis of a small set of contracts &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; opcodes are relatively close to each other. In the delta-encoding the values almost never exceed 128. Combined with any form of variable-length quantity (VLQ) where values &amp;lt; 128 occupy one byte, encoding of single jumpdest takes ~1 byte. We also remove &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; opcodes from the code section therefore the total bytecode length remains the same if extreme examples are ignored.&lt;&#x2F;p&gt;
&lt;p&gt;By extreme examples we mean contracts having a distance between two subsequent JUMPDESTs larger than 128. Then the LEB128 encoding of such distance requires more than one byte and the total bytecode size will increase by the additional number of bytes used.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;leb128-for-offsets&quot;&gt;LEB128 for offsets&lt;&#x2F;h3&gt;
&lt;p&gt;The LEB128 encoding is the most popular VLQ used in DWARF and WebAssembly.&lt;&#x2F;p&gt;
&lt;p&gt;LEB128 allows encoding a fixed value with arbitrary number of bytes by having zero payloads for most significant bits of the value. To ensure there exists only single encoding of a given value, we additionally require the shortest possible LEB128 encoding to be used. This constraint is also required by WebAssembly.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;size-prefix-for-offsets&quot;&gt;Size-prefix for offsets&lt;&#x2F;h3&gt;
&lt;p&gt;This is another option for encoding inspired by UTF-8. The benefit is that the number of following bytes is encoded in the first byte (the top two bits), so the expected length is known upfront.&lt;&#x2F;p&gt;
&lt;p&gt;A simple decoder is the following:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; decode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;input&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    size_prefix&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; size_prefix&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    elif&lt;&#x2F;span&gt;&lt;span&gt; size_prefix&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3f&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    elif&lt;&#x2F;span&gt;&lt;span&gt; size_prefix&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3f&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 16&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Do not support case 3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;False&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;empty-table&quot;&gt;Empty table&lt;&#x2F;h3&gt;
&lt;p&gt;In case code does not use jumps, an empty JUMPDEST table is represented by omitting &lt;code&gt;jumpdests&lt;&#x2F;code&gt; section as opposed to a section that is always present, but allowed to be empty. This is consistent with the requirement of EIP-3540 for section size to be non-zero. Additionally, omitting the section saves 3 bytes of code storage.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-jumpdests-before-code&quot;&gt;Why jumpdests before code?&lt;&#x2F;h3&gt;
&lt;p&gt;The contents of &lt;code&gt;jumpdests&lt;&#x2F;code&gt; section are always needed to start EVM execution. For chunked and&#x2F;or merkleized bytecode it is more efficient to have &lt;code&gt;jumpdests&lt;&#x2F;code&gt; just after the EOF header so they can share the same first chunk(s).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;code-chunking-merkleization&quot;&gt;Code chunking &#x2F; merkleization&lt;&#x2F;h3&gt;
&lt;p&gt;In code chunking the contract code is split into (fixed size) chunks. Due to the requirement of jumpdest-analysis, it must be known where the first instruction starts in a given chunk, in case the split happened within a PUSH-data. This is commonly accomplished with reserving the first byte of the chunk as the &quot;first instruction offset&quot; (FIO) field.&lt;&#x2F;p&gt;
&lt;p&gt;With this EIP, code chunking does not need to have such a field. However, the jumpdest table must be provided instead (for all the chunks up until the last jump location used during execution).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;benchmarks-performance-analysis&quot;&gt;Benchmarks &#x2F; performance analysis&lt;&#x2F;h3&gt;
&lt;p&gt;We compared the performance of &lt;code&gt;jumpdests&lt;&#x2F;code&gt; section loading to JUMPDEST analysis in evmone&#x2F;Baseline interpreter. In both cases a bitset of valid jumpdest positions is built.&lt;&#x2F;p&gt;
&lt;p&gt;We used the worst case for &lt;code&gt;jumpdests&lt;&#x2F;code&gt; section as the benchmark baseline. This is the case where every position in the code section is valid jumpdest. I.e. the bytecode has as many jumpdests as possible making the jumpdests section as large as possible. The encoded representation is &lt;code&gt;0x00, 0x01, 0x01, 0x01, ...&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This also happen to be the worst case for the JUMPDEST analysis.&lt;&#x2F;p&gt;
&lt;p&gt;Further, we picked 5 popular contracts from the Ethereum mainnet.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;case&lt;&#x2F;th&gt;&lt;th&gt;size&lt;&#x2F;th&gt;&lt;th&gt;num JUMPDESTs&lt;&#x2F;th&gt;&lt;th&gt;JUMPDEST analysis (cycles&#x2F;byte)&lt;&#x2F;th&gt;&lt;th&gt;jumpdests load (cycles&#x2F;byte)&lt;&#x2F;th&gt;&lt;th&gt;performance change&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;worst&lt;&#x2F;td&gt;&lt;td&gt;65535&lt;&#x2F;td&gt;&lt;td&gt;65535&lt;&#x2F;td&gt;&lt;td&gt;9.11&lt;&#x2F;td&gt;&lt;td&gt;9.36&lt;&#x2F;td&gt;&lt;td&gt;2.75%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;RoninBridge&lt;&#x2F;td&gt;&lt;td&gt;1760&lt;&#x2F;td&gt;&lt;td&gt;71&lt;&#x2F;td&gt;&lt;td&gt;3.57&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;-89.41%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;UniswapV2ERC20&lt;&#x2F;td&gt;&lt;td&gt;2319&lt;&#x2F;td&gt;&lt;td&gt;61&lt;&#x2F;td&gt;&lt;td&gt;2.10&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;-88.28%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;DepositContract&lt;&#x2F;td&gt;&lt;td&gt;6358&lt;&#x2F;td&gt;&lt;td&gt;123&lt;&#x2F;td&gt;&lt;td&gt;1.86&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;-90.24%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;TetherToken&lt;&#x2F;td&gt;&lt;td&gt;11075&lt;&#x2F;td&gt;&lt;td&gt;236&lt;&#x2F;td&gt;&lt;td&gt;1.91&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;-89.58%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;UniswapV2Router02&lt;&#x2F;td&gt;&lt;td&gt;21943&lt;&#x2F;td&gt;&lt;td&gt;468&lt;&#x2F;td&gt;&lt;td&gt;2.26&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;-91.17%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;For the worst case the performance difference between JUMPDEST analysis and jumpdests section loading is very small. The performance very slow compared to memory copy (0.15 cycles&#x2F;byte).&lt;&#x2F;p&gt;
&lt;p&gt;However, the maximum length for the worst cases is different. For JUMPDEST analysis this is 24576 (0x6000) for deployed contracts and only limited by EVM memory cost in case of &lt;em&gt;initcode&lt;&#x2F;em&gt; (can be over 1MB). For jumpdests sections, the limit is 12288 for deployed contracts (the deployed bytecode length limit must be split equally between jumpdests and code sections). For &lt;em&gt;initcode&lt;&#x2F;em&gt; case, the limit is 65535 because this is the maximum section size allowed by EOF.&lt;&#x2F;p&gt;
&lt;p&gt;For &quot;popular&quot; contracts the gained efficiency is ~10x because the jumpdests section is relatively small compared to the code section and therefore there is much less bytes to loop over than in JUMPDEST analysis.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;We extend the &lt;code&gt;validate_code()&lt;&#x2F;code&gt; function of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3670&#x2F;&quot;&gt;EIP-3670&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The same table as in EIP-3670&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;valid_opcodes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Remove JUMPDEST from the list of valid opcodes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;valid_opcodes&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;remove&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;5b&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This helper decodes a single unsigned LEB128 encoded value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This will abort on truncated (short) input&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; leb128u_decode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;input&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ret&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  shift&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  consumed_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  while&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; True&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;      #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check for truncated input&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      assert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;consumed_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;input&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;      #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Only allow up to 4-byte long leb128 encodings&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      assert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;consumed_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      input_byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;consumed_bytes&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      consumed_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ret&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |=&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;input_byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7f&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; shift&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;input_byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;80&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;          #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Do not allow additional leading zero bits.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;          assert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;input_byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span&gt; consumed_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;          break&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      shift&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;ret&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; consumed_bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This helper parses the jumpdest table into a list of relative offsets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This will abort on truncated (short) input&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; parse_table&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;input&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; list&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  jumpdests&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  pos&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  while&lt;&#x2F;span&gt;&lt;span&gt; pos&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;input&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; consumed_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; leb128u_decode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;pos&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      jumpdests&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      pos&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; consumed_bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  return&lt;&#x2F;span&gt;&lt;span&gt; jumpdests&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This helper translates the delta offsets into absolute ones&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This will abort on invalid 0-value entries&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; process_jumpdests&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;delta&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; list&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; list&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    jumpdests&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    partial_sum&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    first&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; True&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; d&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; delta&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; first&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            first&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            assert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;d&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        partial_sum&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        jumpdests&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;partial_sum&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; jumpdests&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Fails with assertion on invalid code&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Expects list of absolute jumpdest offsets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validate_code&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;code&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; jumpdests&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; list&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    pos&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    while&lt;&#x2F;span&gt;&lt;span&gt; pos&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Ensure the opcode is valid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        opcode&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; code&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;pos&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        pos&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;opcode&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; valid_opcodes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Remove touched offset&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        try&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            jumpdests&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;remove&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;pos&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        except&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; ValueError&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            pass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Skip pushdata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; opcode&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;60&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span&gt; opcode&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7f&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            pos&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; opcode&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;60&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Ensure last PUSH doesn&amp;#39;t go over code end&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;pos&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The table is invalid if there are untouched locations&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;jumpdests&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h4 id=&quot;valid-bytecodes&quot;&gt;Valid bytecodes&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;No jumpdests&lt;&#x2F;li&gt;
&lt;li&gt;Every byte is a jumpdest&lt;&#x2F;li&gt;
&lt;li&gt;Distant jumpdests (0x7f and 0x3f01 bytes apart)&lt;&#x2F;li&gt;
&lt;li&gt;Max number of jumpdests
&lt;ul&gt;
&lt;li&gt;1-byte offset encoding: initcode of max size (64K) with jumpdest at each byte - table contains 65536 1-byte offsets, first one is 0x00, all others equal 0x01&lt;&#x2F;li&gt;
&lt;li&gt;2-byte offset encoding: inicode of max size with jumpdests 0x80 (128) bytes apart - table contains 512 offsets, first one is 0x7f (127), all others equal 0x8001&lt;&#x2F;li&gt;
&lt;li&gt;3-byte offset encoding: inicode of max size with jumpdests 0x4000 (16384) bytes apart - table contains 4 offsets: 0xFF7F (16383), 0x808001, 0x808001, 0x808001&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;invalid-bytecodes&quot;&gt;Invalid bytecodes&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Empty jumpdest section&lt;&#x2F;li&gt;
&lt;li&gt;Multiple jumpdest sections&lt;&#x2F;li&gt;
&lt;li&gt;jumpdest section after the code section&lt;&#x2F;li&gt;
&lt;li&gt;jumpdest section after the data section&lt;&#x2F;li&gt;
&lt;li&gt;Final jumploc in the table is truncated (not a valid LEB128)&lt;&#x2F;li&gt;
&lt;li&gt;LEB128 encoding with extra 0s (non-minimal encoding)&lt;&#x2F;li&gt;
&lt;li&gt;Jumpdest location pointing to PUSH data&lt;&#x2F;li&gt;
&lt;li&gt;Jumpdest location out of code section bounds
&lt;ul&gt;
&lt;li&gt;pointing into data section&lt;&#x2F;li&gt;
&lt;li&gt;pointing into jumpdest section&lt;&#x2F;li&gt;
&lt;li&gt;pointing outside container bounds&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Duplicate jumpdest locations (0 deltas in table other than 1st offset)&lt;&#x2F;li&gt;
&lt;li&gt;Code containing &lt;code&gt;JUMP&lt;&#x2F;code&gt; but no jumpdest table&lt;&#x2F;li&gt;
&lt;li&gt;Code containing &lt;code&gt;JUMPI&lt;&#x2F;code&gt; but no jumpdest table&lt;&#x2F;li&gt;
&lt;li&gt;Code containing jumpdest table but not &lt;code&gt;JUMP&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;JUMPI&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Code containing &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change poses no risk to backwards compatibility, as it is introduced at the same time EIP-3540 is. The requirement of a JUMPDEST table does not cover legacy bytecode.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The authors are not aware of any security or DoS risks posed by this change.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Reject transactions from senders with deployed code</title>
        <published>2021-06-10T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Dankrad Feist</name><uri>https://github.com/dankrad</uri>
	</author>
	
	<author>
		<name>Dmitry Khovratovich</name><uri>https://github.com/khovratovich</uri>
	</author>
	
	<author>
		<name>Marius van der Wijden</name><uri>https://github.com/MariusVanDerWijden</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3607/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/3608" />
        

        <id>https://wg-eips.ritovision.com/3607/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:3607"
            label="EIP-3607" />
        

        
        

        
        <summary type="html">Do not allow transactions for which `tx.sender` has any code deployed.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3607/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Ethereum addresses are currently only 160 bits long. This means it is possible to create a collision between a contract account and an Externally Owned Account (EOA) using an estimated &lt;code&gt;2**80&lt;&#x2F;code&gt; computing operations, which is feasible now given a large budget (ca. 10 billion USD). The fix in this EIP prevents the worst possible attack, where a safe looking contract (e.g. a token wrapper or an AMM-type contract) is deployed to attract user funds, which can then be spent using the EOA key for the same address. The fix is to never allow to use an address that already has code deployed as an EOA address.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;generating-address-collisions&quot;&gt;Generating address collisions&lt;&#x2F;h3&gt;
&lt;p&gt;By creating keys for &lt;code&gt;2**80&lt;&#x2F;code&gt; EOAs and simulating the deployment of &lt;code&gt;2**80&lt;&#x2F;code&gt; contracts from these EOAs (one each), one expects to find about one collision where an EOA has the same address as one contract.&lt;&#x2F;p&gt;
&lt;p&gt;This very simple form of the attack requires the storage of &lt;code&gt;2**80&lt;&#x2F;code&gt; addresses, which is a practical barrier: It would require &lt;code&gt;2.4*10**25&lt;&#x2F;code&gt; bytes of memory (24 Yottabyte). However, there are cycle finding algorithms that can perform the collision search without requiring large amounts of storage. An estimate for the complexity has been made &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;hackmd.io&#x2F;Vzhp5YJyTT-LhWm_s0JQpA&quot;&gt;here&lt;&#x2F;a&gt;. We estimate that a collision between a contract and an EOA could be found in about one year with an investment of ca. US$10 billion in hardware and electricity.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;background&quot;&gt;Background&lt;&#x2F;h3&gt;
&lt;p&gt;There is currently a discussion to move to 256-bit addresses on Ethereum, which would increase collision resistance to a complexity of &lt;code&gt;2**128&lt;&#x2F;code&gt; which is currently thought infeasible for the foreseeable future. However, with 160 bit addresses, the collision problem can be effectively solved now, as demonstrated above.&lt;&#x2F;p&gt;
&lt;p&gt;Most attacks that can occur via address collisions are quite impractical: They involve users sending funds to an address before a contract is deployed. This is a very rare application in practice and users can easily circumvent the attack by never sending funds to a contract until it has been safely deployed with enough confirmations.&lt;&#x2F;p&gt;
&lt;p&gt;However, the yellow paper does not explicitly specify how a client should handle the case where a transaction is sent from an account that already has contract code deployed; presumably because this was considered infeasible at the time. The assumption is that most client would allow this transaction in their current state.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP is to specify this behaviour to always forbid such transactions. This fixes most realistic or serious attacks due to address collisions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Any transaction where &lt;code&gt;tx.sender&lt;&#x2F;code&gt; has a &lt;code&gt;CODEHASH != EMPTYCODEHASH&lt;&#x2F;code&gt; MUST be rejected as invalid, where &lt;code&gt;EMPTYCODEHASH = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470&lt;&#x2F;code&gt;.
The invalid transaction MUST be rejected by the client and not be included in a block.
A block containing such a transaction MUST be considered invalid.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;We note that it was always expected that a contract account&#x27;s behaviour is constrained by the code in that contract -- which means that the account&#x27;s funds should not suddenly be spendable by some private key. It was just implicitly assumed in the past that a 160 bit address length is enough to provide collision resistance, and thus that this case could never occur. In that sense, this EIP should be seen as a clarification of protocol behaviour in a previously undefined case rather than an explicit upgrade of consensus rules.&lt;&#x2F;p&gt;
&lt;p&gt;This does not exclude all possible attack vectors, only the most serious one. Further possible attack vectors via address collisions between contracts and EOAs are:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;An attacker can convince a user to send funds to an account before it is deployed. Some applications require this behaviour (e.g. state channels).&lt;&#x2F;li&gt;
&lt;li&gt;A chain reorg can happen after a contract is deployed. If the reorg removes the contract deployment transaction the funds can still be accessed using the private key.&lt;&#x2F;li&gt;
&lt;li&gt;A contract can self destruct, with the stated intention that ERC20s (or other tokens) in the contract would be burned. However, they can now be accessed by a key for that address.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;All these scenarios are much harder to exploit for an attacker, and likely have much lower yield making the attacks unlikely to be economically viable.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;It is unlikely that an attack like this has already occurred on the Ethereum mainnet, or we would very likely have heard of it. It is inconceivable that someone would use this as a &quot;feature&quot; to make a contract an EOA at the same time, when they could simply do this by adding some methods to the contract instead of spending billions on building hardware to find hash collisions.&lt;&#x2F;p&gt;
&lt;p&gt;Private networks may have deployed contracts which also work as EOAs at genesis and should check that this upgrade does not impact their workflows.&lt;&#x2F;p&gt;
&lt;p&gt;Clients might choose to disable this rule for RPC calls like &lt;code&gt;eth_call&lt;&#x2F;code&gt; and &lt;code&gt;eth_estimateGas&lt;&#x2F;code&gt; as some Multi-Sig contracts use these calls to create transactions as if they originated from the multisig contract itself.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Given a genesis allocation of&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Address: 0x71562b71999873DB5b286dF957af199Ec94617F7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Balance: 1000000000000000000 &#x2F;&#x2F; 1 ether&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Nonce:   0,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Code:    0xB0B0FACE&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Every transaction sent by the private key corresponding to &lt;code&gt;0x715656...&lt;&#x2F;code&gt; (
&lt;code&gt;b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291&lt;&#x2F;code&gt;) should be rejected.
These transaction must be rejected and not included in a block.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The following check must be added to the state transition checks after checking that the nonce of the sender is correct.
The sender is the address recovered from the signature of the transaction.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; Make sure the sender is an EOA&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Set ch to the CodeHash of the sender account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;if ch is not equal to EmptyCodeHash then&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	return ErrSenderNoEOA&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;end if&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;A diff to implement EIP-3607 in go-ethereum can be found &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3607&#x2F;.&#x2F;assets&#x2F;geth.diff&quot;&gt;here&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is a strict security upgrade: It simply makes some transactions that were formerly valid now invalid. There is no legitimate use for such transactions, so there should be no security downsides.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP can be implemented as a soft fork because the new validity rules are a strict superset of the previous validity rules.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Assemble assets into NFTs</title>
        <published>2021-05-24T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Zhenyu Sun</name><uri>https://github.com/Ungigdu</uri>
	</author>
	
	<author>
		<name>Xinqi Yang</name><uri>https://github.com/xinqiyang</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3589/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/3590" />
        

        <id>https://wg-eips.ritovision.com/3589/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:3589"
            label="ERC-3589" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3589/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;This standard defines a ERC-721 token called assembly token which can represent a combination of assets.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The ERC-1155 multi-token contract defines a way to batch transfer tokens, but those tokens must be minted by the ERC-1155 contract itself. This EIP is an ERC-721 extension with ability to assemble assets such as ether, ERC-20 tokens, ERC-721 tokens and ERC-1155 tokens into one ERC-721 token whose token id is also the asset&#x27;s signature. As assets get assembled into one, batch transfer or swap can be implemented very easily.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;As NFT arts and collectors rapidly increases, some collectors are not satisfied with traditional trading methods. When two collectors want to swap some of their collections, currently they can list their NFTs on the market and notify the other party to buy, but this is inefficient and gas-intensive. Instead, some collectors turn to social media or chat group looking for a trustworthy third party to swap NFTs for them. The third party takes NFTs from both collector A and B, and transfer A&#x27;s collections to B and B&#x27;s to A. This is very risky.&lt;&#x2F;p&gt;
&lt;p&gt;The safest way to do batch swap, is to transform batch swap into atomic swap, i.e. one to one swap. But first we should &quot;assemble&quot; those ether, ERC-20 tokens, ERC-721 tokens and ERC-1155 tokens together, and this is the main purpose of this EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;ERC-721 compliant contracts MAY implement this ERC to provide a standard method to assemble assets.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;mint&lt;&#x2F;code&gt; and &lt;code&gt;safeMint&lt;&#x2F;code&gt; assemble assets into one ERC-721 token. &lt;code&gt;mint&lt;&#x2F;code&gt; SHOULD be implemented for normal ERC-20 tokens whose &lt;code&gt;_transfer&lt;&#x2F;code&gt; is lossless. &lt;code&gt;safeMint&lt;&#x2F;code&gt; MUST takes care for lossy token such as PIG token whose &lt;code&gt;_transfer&lt;&#x2F;code&gt; function is taxed.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;_salt&lt;&#x2F;code&gt; of &lt;code&gt;hash&lt;&#x2F;code&gt; function MAY be implemented other way, even provided as user input. But the token id MUST be generated by &lt;code&gt;hash&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;p&gt;Implementations of the standard MAY supports different set of assets.&lt;&#x2F;p&gt;
&lt;p&gt;Implementers of this standard MUST have all of the following functions:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pragma solidity ^0.8.0;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;interface AssemblyNFTInterface {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  event AssemblyAsset(address indexed firstHolder,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    uint256 indexed tokenId,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    uint256 salt,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    address[] addresses,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    uint256[] numbers);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  * @dev hash function assigns the combination of assets with salt to bytes32 signature that is also the token id.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  * @param `_salt` prevents hash collision, can be chosen by user input or increasing nonce from contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  * @param `_addresses` concat assets addresses, e.g. [ERC-20_address1, ERC-20_address2, ERC-721_address_1, ERC-1155_address_1, ERC-1155_address_2]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  * @param `_numbers` describes how many eth, ERC-20 token addresses length, ERC-721 token addresses length, ERC-1155 token addresses length,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  * ERC-20 token amounts, ERC-721 token ids, ERC-1155 token ids and amounts.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  function hash(uint256 _salt, address[] memory _addresses, uint256[] memory _numbers) external pure returns (uint256 tokenId);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &#x2F;&#x2F;&#x2F; @dev to assemble lossless assets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &#x2F;&#x2F;&#x2F; @param `_to` the receiver of the assembly token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  function mint(address _to, address[] memory _addresses, uint256[] memory _numbers) payable external returns(uint256 tokenId);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &#x2F;&#x2F;&#x2F; @dev mint with additional logic that calculates the actual received value for tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  function safeMint(address _to, address[] memory _addresses, uint256[] memory _numbers) payable external returns(uint256 tokenId);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &#x2F;&#x2F;&#x2F; @dev burn this token and releases assembled assets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &#x2F;&#x2F;&#x2F; @param `_to` to which address the assets is released&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  function burn(address _to, uint256 _tokenId, uint256 _salt, address[] calldata _addresses, uint256[] calldata _numbers) external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;There are many reasons why people want to pack their NFTs together. For example, a collector want to pack a set of football players into a football team; a collector has hundreds of of NFTs with no categories to manage them; a collector wants to buy a full collection of NFTs or none of them. They all need a way a assemble those NFTs together.&lt;&#x2F;p&gt;
&lt;p&gt;The reason for choosing ERC-721 standard as a wrapper is ERC-721 token is already widely used and well supported by NFT wallets. And assembly token itself can also be assembled again. Assembly token is easier for smart contract to use than a batch of assets, in scenarios like batch trade, batch swap or collections exchange.&lt;&#x2F;p&gt;
&lt;p&gt;This standard has AssemblyAsset event which records the exact kinds and amounts of assets the assembly token represents. The wallet can easily display those NFTs to user just by the token id.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal combines already available 721 extensions and is backwards compatible with the ERC-721 standard.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pragma solidity ^0.8.0;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;import &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC20&#x2F;IERC20.sol&amp;quot;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;import &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC20&#x2F;utils&#x2F;SafeERC20.sol&amp;quot;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;import &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC721&#x2F;ERC721.sol&amp;quot;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;import &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC721&#x2F;utils&#x2F;ERC721Holder.sol&amp;quot;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;import &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC1155&#x2F;ERC1155.sol&amp;quot;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;import &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC1155&#x2F;utils&#x2F;ERC1155Holder.sol&amp;quot;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;import &amp;quot;.&#x2F;AssemblyNFTInterface.sol&amp;quot;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;abstract contract AssemblyNFT is ERC721, ERC721Holder, ERC1155Holder, AssemblyNFTInterface{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  using SafeERC20 for IERC20;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721, ERC1155Receiver) returns (bool) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return ERC721.supportsInterface(interfaceId) || ERC1155Receiver.supportsInterface(interfaceId);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  uint256 nonce;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  * layout of _addresses:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  *     erc20 addresses | erc721 addresses | erc1155 addresses&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  * layout of _numbers:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  *     eth | erc20.length | erc721.length | erc1155.length | erc20 amounts | erc721 ids | erc1155 ids | erc1155 amounts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  function hash(uint256 _salt, address[] memory _addresses, uint256[] memory _numbers) public pure override returns (uint256 tokenId){&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      bytes32 signature = keccak256(abi.encodePacked(_salt));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      for(uint256 i=0; i&amp;lt; _addresses.length; i++){&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        signature = keccak256(abi.encodePacked(signature, _addresses[i]));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      for(uint256 j=0; j&amp;lt;_numbers.length; j++){&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        signature = keccak256(abi.encodePacked(signature, _numbers[j]));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      assembly {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        tokenId := signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  function mint(address _to, address[] memory _addresses, uint256[] memory _numbers) payable external override returns(uint256 tokenId){&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      require(_to != address(0), &amp;quot;can&amp;#39;t mint to address(0)&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      require(msg.value == _numbers[0], &amp;quot;value not match&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      require(_addresses.length == _numbers[1] + _numbers[2] + _numbers[3], &amp;quot;2 array length not match&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      require(_addresses.length == _numbers.length -4 - _numbers[3], &amp;quot;numbers length not match&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      uint256 pointerA; &#x2F;&#x2F;points to first erc20 address, if there is any&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      uint256 pointerB =4; &#x2F;&#x2F;points to first erc20 amount, if there is any&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      for(uint256 i = 0; i&amp;lt; _numbers[1]; i++){&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        require(_numbers[pointerB] &amp;gt; 0, &amp;quot;transfer erc20 0 amount&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        IERC20(_addresses[pointerA++]).safeTransferFrom(_msgSender(), address(this), _numbers[pointerB++]);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      for(uint256 j = 0; j&amp;lt; _numbers[2]; j++){&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        IERC721(_addresses[pointerA++]).safeTransferFrom(_msgSender(), address(this), _numbers[pointerB++]);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      for(uint256 k =0; k&amp;lt; _numbers[3]; k++){&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        IERC1155(_addresses[pointerA++]).safeTransferFrom(_msgSender(), address(this), _numbers[pointerB], _numbers[_numbers[3] + pointerB++], &amp;quot;&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      tokenId = hash(nonce, _addresses, _numbers);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      super._mint(_to, tokenId);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      emit AssemblyAsset(_to, tokenId, nonce, _addresses, _numbers);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      nonce ++;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  function safeMint(address _to, address[] memory _addresses, uint256[] memory _numbers) payable external override returns(uint256 tokenId){&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      require(_to != address(0), &amp;quot;can&amp;#39;t mint to address(0)&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      require(msg.value == _numbers[0], &amp;quot;value not match&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      require(_addresses.length == _numbers[1] + _numbers[2] + _numbers[3], &amp;quot;2 array length not match&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      require(_addresses.length == _numbers.length -4 - _numbers[3], &amp;quot;numbers length not match&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      uint256 pointerA; &#x2F;&#x2F;points to first erc20 address, if there is any&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      uint256 pointerB =4; &#x2F;&#x2F;points to first erc20 amount, if there is any&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      for(uint256 i = 0; i&amp;lt; _numbers[1]; i++){&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        require(_numbers[pointerB] &amp;gt; 0, &amp;quot;transfer erc20 0 amount&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        IERC20 token = IERC20(_addresses[pointerA++]);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 orgBalance = token.balanceOf(address(this));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        token.safeTransferFrom(_msgSender(), address(this), _numbers[pointerB]);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _numbers[pointerB++] = token.balanceOf(address(this)) - orgBalance;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      for(uint256 j = 0; j&amp;lt; _numbers[2]; j++){&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        IERC721(_addresses[pointerA++]).safeTransferFrom(_msgSender(), address(this), _numbers[pointerB++]);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      for(uint256 k =0; k&amp;lt; _numbers[3]; k++){&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        IERC1155(_addresses[pointerA++]).safeTransferFrom(_msgSender(), address(this), _numbers[pointerB], _numbers[_numbers[3] + pointerB++], &amp;quot;&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      tokenId = hash(nonce, _addresses, _numbers);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      super._mint(_to, tokenId);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      emit AssemblyAsset(_to, tokenId, nonce, _addresses, _numbers);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      nonce ++;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  function burn(address _to, uint256 _tokenId, uint256 _salt, address[] calldata _addresses, uint256[] calldata _numbers) override external {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      require(_msgSender() == ownerOf(_tokenId), &amp;quot;not owned&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      require(_tokenId == hash(_salt, _addresses, _numbers));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      super._burn(_tokenId);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      payable(_to).transfer(_numbers[0]);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      uint256 pointerA; &#x2F;&#x2F;points to first erc20 address, if there is any&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      uint256 pointerB =4; &#x2F;&#x2F;points to first erc20 amount, if there is any&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      for(uint256 i = 0; i&amp;lt; _numbers[1]; i++){&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        require(_numbers[pointerB] &amp;gt; 0, &amp;quot;transfer erc20 0 amount&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        IERC20(_addresses[pointerA++]).safeTransfer(_to, _numbers[pointerB++]);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      for(uint256 j = 0; j&amp;lt; _numbers[2]; j++){&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        IERC721(_addresses[pointerA++]).safeTransferFrom(address(this), _to, _numbers[pointerB++]);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      for(uint256 k =0; k&amp;lt; _numbers[3]; k++){&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        IERC1155(_addresses[pointerA++]).safeTransferFrom(address(this), _to, _numbers[pointerB], _numbers[_numbers[3] + pointerB++], &amp;quot;&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Before using &lt;code&gt;mint&lt;&#x2F;code&gt; or &lt;code&gt;safeMint&lt;&#x2F;code&gt; functions, user should be aware that some implementations of tokens are pausable. If one of the assets get paused after assembled into one NFT, the &lt;code&gt;burn&lt;&#x2F;code&gt; function may not be executed successfully. Platforms using this standard should make support lists or block lists to avoid this situation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Block Access List</title>
        <published>2021-05-22T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Gajinder Singh</name><uri>https://github.com/g11in</uri>
	</author>
	
	<author>
		<name>Piper Merriam</name><uri>https://github.com/pipermerriam</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3584/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethresear.ch/t/block-access-list-v0-1/9505" />
        

        <id>https://wg-eips.ritovision.com/3584/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:3584"
            label="EIP-3584" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3584/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;A proposal to build a block&#x27;s &lt;code&gt;access_list&lt;&#x2F;code&gt; and include its fingerprint &lt;code&gt;AccessListRoot&lt;&#x2F;code&gt; in the block header.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;&#x2F;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930&lt;&#x2F;a&gt; centers around normalizing the (low) gas costs of data&#x2F;storage accesses made by a transaction as well as providing for (and encouraging) a new transaction type format:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x01 || rlp([chainId, nonce, gasPrice, gasLimit, to, value, data, access_list, yParity, senderR, senderS])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;that makes upfront &lt;code&gt;access_list&lt;&#x2F;code&gt; declarations, where &lt;code&gt;access_list&lt;&#x2F;code&gt; is some &lt;code&gt;[[{20 bytes}, [{32 bytes}...]]...]&lt;&#x2F;code&gt; map of &lt;code&gt;AccessedAddress=&amp;gt; AccessedStorageKeys&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The first &lt;em&gt;accesses&lt;&#x2F;em&gt; of these upfront &lt;em&gt;declarations&lt;&#x2F;em&gt; are charged at discounted price (roughly ~&lt;code&gt;10%&lt;&#x2F;code&gt;) and first accesses outside this list are charged higher price. Reason is upfront access declaration provides for a way to &lt;em&gt;preload&#x2F;optimize&#x2F;batch&lt;&#x2F;em&gt; loading these locations while executing the transaction.
This inadvertently leads to generation of transaction &lt;code&gt;access_list&lt;&#x2F;code&gt; that has all (first) accesses (declared or not) made by a transaction.
This proposal is to collate these &lt;em&gt;transaction&lt;&#x2F;em&gt; &lt;code&gt;access_list&lt;&#x2F;code&gt;s for all the transactions in a &lt;strong&gt;block&lt;&#x2F;strong&gt; &lt;code&gt;access_list&lt;&#x2F;code&gt; document and include its &lt;em&gt;fingerprint&lt;&#x2F;em&gt; in the block header.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Motivation for collating the &lt;em&gt;transaction&lt;&#x2F;em&gt; &lt;code&gt;access_list&lt;&#x2F;code&gt;s for all the transactions in a &lt;strong&gt;block&lt;&#x2F;strong&gt;’s &lt;code&gt;access_list&lt;&#x2F;code&gt; is to have an &lt;em&gt;access index&lt;&#x2F;em&gt; of the block with following benefits:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Block execution&#x2F;validation optimizations&#x2F;parallelization&#x2F;cache warm-up by enabling construction of &lt;em&gt;a partial order&lt;&#x2F;em&gt; for access and hence execution (hint: &lt;em&gt;chains&lt;&#x2F;em&gt; in this &lt;em&gt;poset&lt;&#x2F;em&gt; can be parallelized).&lt;&#x2F;li&gt;
&lt;li&gt;Enabling partial inspection and fetching&#x2F;serving of a block data&#x2F;state by &lt;em&gt;light sync&lt;&#x2F;em&gt; or &lt;em&gt;fast sync&lt;&#x2F;em&gt; protocols concerned with a subset of addresses.&lt;&#x2F;li&gt;
&lt;li&gt;Possible future extension of this list to serve as index for bundling, serving and fetching witness data for &lt;em&gt;stateless&lt;&#x2F;em&gt; protocols.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;A block &lt;code&gt;access_list&lt;&#x2F;code&gt; represents:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Set [ &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    AccessedAddress, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    List [AccessedStorageKeys] , &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Set  [ AccessedInBlockTransactionNumber, List [ AccessedStorageKeys ]]  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;A &lt;strong&gt;canonical&lt;&#x2F;strong&gt; construction of such an &lt;code&gt;access_list&lt;&#x2F;code&gt; is specified as below.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;canonical-block-access-list&quot;&gt;Canonical Block Access List&lt;&#x2F;h3&gt;
&lt;p&gt;An &lt;code&gt;access_list&lt;&#x2F;code&gt; is defined to be comprised of many &lt;code&gt;access_list_entry&lt;&#x2F;code&gt; elements:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;access_list   :=  [access_list_entry, ...]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;An &lt;code&gt;access_list_entry&lt;&#x2F;code&gt; is a 3-tuple of:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;address&lt;&#x2F;li&gt;
&lt;li&gt;sorted list of storage keys of the address accessed across the entire block&lt;&#x2F;li&gt;
&lt;li&gt;sorted list of 2-tuples of:
&lt;ul&gt;
&lt;li&gt;transaction index in which the address or any of its storage keys were accessed&lt;&#x2F;li&gt;
&lt;li&gt;sorted list of storage keys which were accessed&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;access_list                 := [access_list_entry, ...]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;access_list_entry           := [address, storage_keys, accesses_by_txn_index]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;address                     := bytes20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;accesses_by_txn_index       := [txn_index_and_keys, ...]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;txn_index_and_keys          := [txn_index, storage_keys]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;txn_index                   := uint64  # or uint256 or whatever&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;storage_keys                := [storage_key, ...]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;storage_key                 := bytes32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Additional sorting rules for the above are that:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;access_list&lt;&#x2F;code&gt; is sorted by the &lt;code&gt;address&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;storage_keys&lt;&#x2F;code&gt; is sorted&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;accesses_by_txn_index&lt;&#x2F;code&gt; is sorted by &lt;code&gt;txn_index&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Additional validation rules for the above are that:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Each unique &lt;code&gt;address&lt;&#x2F;code&gt; may only appear at most once in &lt;code&gt;access_list&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Each &lt;code&gt;storage_key&lt;&#x2F;code&gt; may only appear at most once in &lt;code&gt;storage_keys&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Each &lt;code&gt;txn_index&lt;&#x2F;code&gt; may only appear at most once in &lt;code&gt;txn_index_and_keys&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;All sorting is in increasing order.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;accesslistroot&quot;&gt;AccessListRoot&lt;&#x2F;h3&gt;
&lt;p&gt;An &lt;code&gt;AccessListRoot&lt;&#x2F;code&gt; is a URN &lt;em&gt;like&lt;&#x2F;em&gt; encoding &lt;code&gt;Hash&#x2F;Commitment&lt;&#x2F;code&gt; of the canonical &lt;code&gt;access_list&lt;&#x2F;code&gt; as well as the construction type ( &lt;code&gt;sha256&lt;&#x2F;code&gt; ) and serialization type ( &lt;code&gt;json&lt;&#x2F;code&gt; ), i.e.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;AccessListRoot := &amp;quot;urn:sha256:json:0x${ SHA256( access_list.toJSONString(&amp;#39;utf8&amp;#39;) ).toHexString() }&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where &lt;code&gt;0x${ SHA256 (...)...}&lt;&#x2F;code&gt; is the &lt;code&gt;SHA256&lt;&#x2F;code&gt; hashed &lt;code&gt;32&lt;&#x2F;code&gt; bytes hex string as indicated by leading &lt;code&gt;0x&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;additional-block-validation&quot;&gt;Additional Block Validation&lt;&#x2F;h3&gt;
&lt;p&gt;Validating a new block requires an additional validation check that the block’s &lt;code&gt;AccessListRoot&lt;&#x2F;code&gt; matches the one generated by executing the block using the construction as defined by the &lt;code&gt;AccessListRoot&lt;&#x2F;code&gt; URN.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;sorting-of-canonical-access-list&quot;&gt;Sorting of canonical &lt;code&gt;access_list&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;It is specified to be sorted in lexicographic ordering or integer sorting wherever applicable and specified. Sorting with respect to access time was considered but didn&#x27;t seem to provide any additional benefit at the cost of adding implementation complexity and bookkeeping.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;accesslistroot-1&quot;&gt;&lt;code&gt;AccessListRoot&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;AccessListRoot&lt;&#x2F;code&gt; is generated to prevent any &lt;em&gt;griefing&lt;&#x2F;em&gt; attacks and hence will need to be included (and validated) in the &lt;em&gt;block header&lt;&#x2F;em&gt;.
Even though &lt;code&gt;AccessListRoot&lt;&#x2F;code&gt; is currently specified to be a simple &lt;code&gt;sha256&lt;&#x2F;code&gt; hash of the canonical &lt;code&gt;access_list&lt;&#x2F;code&gt;, it would be beneficial to consider other constructions&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;a tree structure (&lt;code&gt;merkle&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;verkle&lt;&#x2F;code&gt;). It will be a bit more expensive but will enable partial downloading, inspection and validation of the &lt;code&gt;access_list&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;a normal &lt;code&gt;kate&lt;&#x2F;code&gt; commitment can also be generated to enable this partial capability and is recommended as validating partial fetch of access list chunks would be very simple.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Also serialization of the &lt;code&gt;access_list&lt;&#x2F;code&gt; is currently specified as a normal &lt;code&gt;JSON String&lt;&#x2F;code&gt; dump and these parameters could vary from construction to construction, but for the sake of simplicity, it can always be &lt;code&gt;sha256&lt;&#x2F;code&gt; hashed to get a consistent &lt;code&gt;32&lt;&#x2F;code&gt; bytes hex string root.&lt;&#x2F;p&gt;
&lt;p&gt;So this AccessListRoot could evolve to &lt;code&gt;urn:merkle:ssz:...&lt;&#x2F;code&gt; or to &lt;code&gt;urn:kate:...&lt;&#x2F;code&gt; or to any other scheme as per requirement. And the idea of having the &lt;code&gt;AccessListRoot&lt;&#x2F;code&gt; as URN &lt;em&gt;like&lt;&#x2F;em&gt; structure is to enable upgradation to these paths without affecting block structure.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;future-extensions-of-access-list&quot;&gt;Future extensions of &lt;code&gt;access_list&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;We can extend the notion of a block’s &lt;code&gt;access_list&lt;&#x2F;code&gt; to include witnesses:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;access_list := Set[ &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Address,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    List [ AddressWitnesses ],&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Set  [ AccessedStorageKey, List [ StorageKeyWitnesses] ],        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Set  [ AccessedInBlockTransactionNumber, List [ AccessedStorageKeys ] ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;and then get to define the a canonical specification for building the fingerprint.
This will allow an incremental path to partial or full statelessness, where it would be easy to bundle&#x2F;request &lt;strong&gt;witnesses&lt;&#x2F;strong&gt; using this &lt;code&gt;access_list&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The extra block validation will only be mandatory post the block number this EIP comes into effect, but the clients can still provide a way to generate (and possibly store) this access list  on request (via the &lt;code&gt;JSON&#x2F;RPC&lt;&#x2F;code&gt; api). However this is optional and client dependent.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;There are no known security issues as a result of this change.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Trust Minimized Upgradeability Proxy</title>
        <published>2021-05-09T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Sam Porter</name><uri>https://github.com/SamPorter1984</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3561/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/trust-minimized-proxy/5742" />
        

        <id>https://wg-eips.ritovision.com/3561/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:3561"
            label="ERC-3561" />
        

        
        

        
        <summary type="html">proxy with a delay before specified upgrade goes live</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3561/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Removing trust from upgradeability proxy is necessary for anonymous developers. In order to accomplish this, instant and potentially malicious upgrades must be prevented. This EIP introduces additional storage slots for upgradeability proxy which are assumed to decrease trust in interaction with upgradeable smart contracts. Defined by the admin implementation logic can be made an active implementation logic only after Zero Trust Period allows.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Anonymous developers who utilize upgradeability proxies typically struggle to earn the trust of the community.&lt;&#x2F;p&gt;
&lt;p&gt;Fairer, better future for humanity absolutely requires some developers to stay anonymous while still attract vital attention to solutions they propose and at the same time leverage the benefits of possible upgradeability.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The specification is an addition to the standard &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1967&#x2F;&quot;&gt;EIP-1967&lt;&#x2F;a&gt; transparent proxy design.
The specification focuses on the slots it adds. All admin interactions with trust minimized proxy must emit an event to make admin actions trackable, and all admin actions must be guarded with &lt;code&gt;onlyAdmin()&lt;&#x2F;code&gt; modifier.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;next-logic-contract-address&quot;&gt;Next Logic Contract Address&lt;&#x2F;h3&gt;
&lt;p&gt;Storage slot &lt;code&gt;0x19e3fabe07b65998b604369d85524946766191ac9434b39e27c424c976493685&lt;&#x2F;code&gt; (obtained as &lt;code&gt;bytes32(uint256(keccak256(&#x27;eip3561.proxy.next.logic&#x27;)) - 1)&lt;&#x2F;code&gt;).
Desirable implementation logic address must be first defined as next logic, before it can function as actual logic implementation stored in EIP-1967 &lt;code&gt;IMPLEMENTATION_SLOT&lt;&#x2F;code&gt;.
Admin interactions with next logic contract address correspond with these methods and events:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sets next logic contract address. Emits NextLogicDefined&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If current implementation is address(0), then upgrades to IMPLEMENTATION_SLOT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; immedeatelly, therefore takes data as an argument&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; proposeTo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; implementation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IfAdmin&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;As&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; soon&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UPGRADE_BLOCK_SLOT&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; allows&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; sets&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; stored&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; as&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; next&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; implementation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;as&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; current&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IMPLEMENTATION_SLOT&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; and&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; initializes&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; it&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; upgrade&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IfAdmin&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;cancelling&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; possible&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; as&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; long&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; as&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; upgrade&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; given&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; next&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; logic&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; was&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; called&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;emits&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NextLogicCanceled&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; cancelUpgrade&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyAdmin&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NextLogicDefined&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nextLogic&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; earliestArrivalBlock&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; important to have&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NextLogicCanceled&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; oldLogic&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;upgrade-block&quot;&gt;Upgrade Block&lt;&#x2F;h3&gt;
&lt;p&gt;Storage slot &lt;code&gt;0xe3228ec3416340815a9ca41bfee1103c47feb764b4f0f4412f5d92df539fe0ee&lt;&#x2F;code&gt; (obtained as &lt;code&gt;bytes32(uint256(keccak256(&#x27;eip3561.proxy.next.logic.block&#x27;)) - 1)&lt;&#x2F;code&gt;).
On&#x2F;after this block next logic contract address can be set to EIP-1967 &lt;code&gt;IMPLEMENTATION_SLOT&lt;&#x2F;code&gt; or, in other words, &lt;code&gt;upgrade()&lt;&#x2F;code&gt; can be called. Updated automatically according to Zero Trust Period, shown as &lt;code&gt;earliestArrivalBlock&lt;&#x2F;code&gt; in the event &lt;code&gt;NextLogicDefined&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;propose-block&quot;&gt;Propose Block&lt;&#x2F;h3&gt;
&lt;p&gt;Storage slot &lt;code&gt;0x4b50776e56454fad8a52805daac1d9fd77ef59e4f1a053c342aaae5568af1388&lt;&#x2F;code&gt; (obtained as &lt;code&gt;bytes32(uint256(keccak256(&#x27;eip3561.proxy.propose.block&#x27;)) - 1)&lt;&#x2F;code&gt;).
Defines after&#x2F;on which block &lt;em&gt;proposing&lt;&#x2F;em&gt; next logic is possible. Required for convenience, for example can be manually set to a year from given time. Can be set to maximum number to completely seal the code.
Admin interactions with this slot correspond with this method and event:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; prolongLock&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; b&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyAdmin&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ProposingUpgradesRestrictedUntil&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nextProposedLogicEarliestArrival&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;zero-trust-period&quot;&gt;Zero Trust Period&lt;&#x2F;h3&gt;
&lt;p&gt;Storage slot &lt;code&gt;0x7913203adedf5aca5386654362047f05edbd30729ae4b0351441c46289146720&lt;&#x2F;code&gt; (obtained as &lt;code&gt;bytes32(uint256(keccak256(&#x27;eip3561.proxy.zero.trust.period&#x27;)) - 1)&lt;&#x2F;code&gt;).
Zero Trust Period in amount of blocks, can only be set higher than previous value. While it is at default value(0), the proxy operates exactly as standard EIP-1967 transparent proxy. After zero trust period is set, all above specification is enforced.
Admin interactions with this slot should correspond with this method and event:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setZeroTrustPeriod&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; blocks&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyAdmin&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ZeroTrustPeriodSet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; blocks&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;implementation-example&quot;&gt;Implementation Example&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; &amp;gt;=0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;important&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; EIP-3561 trust minimized proxy implementation https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;blob&#x2F;master&#x2F;EIPS&#x2F;.&#x2F;03561.md&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Based on EIP-1967 upgradeability proxy: https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;blob&#x2F;master&#x2F;EIPS&#x2F;.&#x2F;01967.md&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TrustMinimizedProxy&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Upgraded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; toLogic&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AdminChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; previousAdmin&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newAdmin&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NextLogicDefined&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nextLogic&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; earliestArrivalBlock&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ProposingUpgradesRestrictedUntil&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nextProposedLogicEarliestArrival&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NextLogicCanceled&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ZeroTrustPeriodSet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; blocks&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; ADMIN_SLOT &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; LOGIC_SLOT &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; NEXT_LOGIC_SLOT &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x19e3fabe07b65998b604369d85524946766191ac9434b39e27c424c976493685&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; NEXT_LOGIC_BLOCK_SLOT &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xe3228ec3416340815a9ca41bfee1103c47feb764b4f0f4412f5d92df539fe0ee&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; PROPOSE_BLOCK_SLOT &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x4b50776e56454fad8a52805daac1d9fd77ef59e4f1a053c342aaae5568af1388&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; ZERO_TRUST_PERIOD_SLOT &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x7913203adedf5aca5386654362047f05edbd30729ae4b0351441c46289146720&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; payable &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            ADMIN_SLOT &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;#39;eip1967.proxy.admin&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                LOGIC_SLOT &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;#39;eip1967.proxy.implementation&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                NEXT_LOGIC_SLOT &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;#39;eip3561.proxy.next.logic&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                NEXT_LOGIC_BLOCK_SLOT &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;#39;eip3561.proxy.next.logic.block&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                PROPOSE_BLOCK_SLOT &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;#39;eip3561.proxy.propose.block&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                ZERO_TRUST_PERIOD_SLOT &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;#39;eip3561.proxy.zero.trust.period&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _setAdmin&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    modifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IfAdmin&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _admin&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;            _&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            _fallback&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _logic&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; logic&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            logic &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;LOGIC_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _nextLogic&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nextLogic&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            nextLogic &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;NEXT_LOGIC_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _proposeBlock&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; b&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            b &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;PROPOSE_BLOCK_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _nextLogicBlock&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; b&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            b &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;NEXT_LOGIC_BLOCK_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _zeroTrustPeriod&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ztp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            ztp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ZERO_TRUST_PERIOD_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _admin&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; adm&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            adm &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ADMIN_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _setAdmin&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newAdm&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ADMIN_SLOT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; newAdm&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; changeAdmin&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newAdm&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IfAdmin&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AdminChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_admin&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; newAdm&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _setAdmin&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;newAdm&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; upgrade&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IfAdmin&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _nextLogicBlock&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;#39;too soon&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; logic&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            logic &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;NEXT_LOGIC_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;LOGIC_SLOT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; logic&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt; success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; )&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; logic&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;delegatecall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;#39;failed to call&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Upgraded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;logic&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    fallback&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _fallback&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    receive&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _fallback&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _fallback&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _admin&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _delegate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_logic&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; cancelUpgrade&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IfAdmin&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; logic&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            logic &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;LOGIC_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;NEXT_LOGIC_SLOT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; logic&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NextLogicCanceled&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; prolongLock&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; b&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IfAdmin&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;b &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _proposeBlock&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;#39;can be only set higher&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;PROPOSE_BLOCK_SLOT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; b&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ProposingUpgradesRestrictedUntil&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;b&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; b &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _zeroTrustPeriod&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setZeroTrustPeriod&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; blocks&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IfAdmin&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; before this set at least once acts like a normal eip 1967 transparent proxy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span&gt; ztp&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            ztp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ZERO_TRUST_PERIOD_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;blocks &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; ztp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;#39;can be only set higher&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ZERO_TRUST_PERIOD_SLOT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; blocks&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _updateNextBlockSlot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ZeroTrustPeriodSet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;blocks&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _updateNextBlockSlot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span&gt; nlb &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _zeroTrustPeriod&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;NEXT_LOGIC_BLOCK_SLOT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; nlb&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _setNextLogic&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nl&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _proposeBlock&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;#39;too soon&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _updateNextBlockSlot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;NEXT_LOGIC_SLOT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; nl&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NextLogicDefined&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;nl&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _zeroTrustPeriod&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; proposeTo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newLogic&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IfAdmin&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_zeroTrustPeriod&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _logic&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            _updateNextBlockSlot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;                sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;LOGIC_SLOT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; newLogic&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt; success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; )&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; newLogic&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;delegatecall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;#39;failed to call&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Upgraded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;newLogic&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            _setNextLogic&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;newLogic&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _delegate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; logic_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            calldatacopy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calldatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            let&lt;&#x2F;span&gt;&lt;span&gt; result &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; delegatecall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; logic_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calldatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            returndatacopy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returndatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            switch result&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            case &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                revert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returndatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            default &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                return&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returndatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;An argument &quot;just don&#x27;t make such contracts upgadeable at all&quot; fails when it comes to complex systems which do or do not heavily rely on human factor, which might manifest itself in unprecedented ways. It might be impossible to model some systems right on first try. Using decentralized governance for upgrade management coupled with EIP-1967 proxy might become a serious bottleneck for certain protocols before they mature and data is at hand.&lt;&#x2F;p&gt;
&lt;p&gt;A proxy without a time delay before an actual upgrade is obviously abusable. A time delay is probably unavoidable, even if it means that inexperienced developers might not have confidence using it. Albeit this is a downside of this EIP, it&#x27;s a critically important option to have in smart contract development today.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Users must ensure that a trust-minimized proxy they interact with does not allow overflows, ideally represents the exact copy of the code in implementation example above, and also they must ensure that Zero Trust Period length is reasonable(at the very least two weeks if upgrades are usually being revealed beforehand, and in most cases at least a month).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Sealed NFT Metadata Standard</title>
        <published>2021-05-07T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Sean Papanikolas</name><uri>https://github.com/pizzarob</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3569/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3569-sealed-nft-metadata-standard/7130" />
        

        <id>https://wg-eips.ritovision.com/3569/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:3569"
            label="ERC-3569" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3569/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;The Sealed NFT Metadata Extension provides a mechanism to immortalize NFT metadata in a cost-effective manner.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard accomplishes three things; it provides a way for potential collectors to verify that the NFT metadata will not change, allows creators to immortalize metadata for multiple tokens at one time, and allows metadata for many NFTs to be read and cached from one file. A creator can call the &lt;code&gt;seal&lt;&#x2F;code&gt; function for a range of one or many sequential NFTs. Included as an argument is a URI which points to a decentralized storage service like IPFS and will be stored in the smart contract. The URI will return a JSON object in which the keys are token IDs and the values are either a string which is a URI pointing to a metadata file stored on a decentralized file system, or raw metadata JSON for each token ID. The token ID(s) will then be marked as sealed in the smart contract and cannot be sealed again. The &lt;code&gt;seal&lt;&#x2F;code&gt; function can be called after NFT creation, or during the NFT creation process.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;In the original ERC-721 standard, the metadata extension specifies a &lt;code&gt;tokenURI&lt;&#x2F;code&gt; function which returns a URI for a single token ID. This may be hosted on IPFS or might be hosted on a centralized server. There&#x27;s no guarantee that the NFT metadata will not change. This is the same for the ERC-1155 metadata extension. In addition to that - if you want to update the metadata for many NFTs you would need to do so in O(n) time, which as we know is not financially feasible at scale. By allowing for a decentralized URI to point to a JSON object of many NFT IDs we can solve this issue by providing metadata for many tokens at one time rather than one at a time. We can also provide methods which give transparency into whether the NFT has be explicitly &quot;sealed&quot; and that the metadata is hosted on a decentralized storage space.&lt;&#x2F;p&gt;
&lt;p&gt;There is not a way for the smart contract layer to communicate with a storage layer and as such we need a solution which provides a way for potential NFT collectors on Ethereum to verify that their NFT will not be &quot;rug pulled&quot;. This standard provides a solution for that. By allowing creators to seal their NFTs during or after creation, they are provided with full flexibility when it comes to creating their NFTs. Decentralized storage means permanence - in the fast-moving world of digital marketing campaigns, or art projects mistakes can happen. As such, it is important for creators to have flexibility when creating their projects. Therefore, this standard allows creators to opt in at a time of their choosing. Mistakes do happen and metadata should be flexible enough so that creators can fix mistakes or create dynamic NFTs (see Beeple&#x27;s CROSSROAD NFT). If there comes a time when the NFT metadata should be immortalized, then the creator can call the &lt;code&gt;seal&lt;&#x2F;code&gt; method. Owners, potential owners, or platforms can verify that the NFT was sealed and can check the returned URI. If the &lt;code&gt;sealedURI&lt;&#x2F;code&gt; return value is not hosted on a decentralized storage platform, or the &lt;code&gt;isSealed&lt;&#x2F;code&gt; method does not return &lt;code&gt;true&lt;&#x2F;code&gt; for the given NFT ID then it can be said that one cannot trust that these NFTs will not change at a future date and can then decide if they want to proceed with collecting the given NFT.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;interface SealedMetadata {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    @notice This function is used to set a sealed URI for the given range of tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    @dev&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      - If the sealed URI is being set for one token then the fromTokenId and toTokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      values MUST be the same.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      - If any token within the range of tokens specified has already&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      been sealed then this function MUST throw.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      - This function MAY be called at the time of NFT creation, or after the NFTs have been created.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      - It is RECOMMENDED that this function only be executable by either the creator of the smart contract,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        or the creator of the NFTs, but this is OPTIONAL and should be implemented based on use case.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      - This function MUST emit the Sealed event&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      - The URI argument SHOULD point to a JSON file hosted within a decentralized file system like IPFS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    @param fromTokenId The first token in a consecutive range of tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    @param toTokenId The ending token in a consecutive range of tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    @param uri A URI which points to a JSON file hosted on a decentralized file system.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  function seal(uint256 fromTokenId, uint256 toTokenId, string memory uri) external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    @notice This function returns the URI which the sealed metadata can be found for the given token ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    @dev&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      - This function MUST throw if the token ID does not exist, or is not sealed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    @param tokenId Token ID to retrieve the sealed URI for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    @return The sealed URI in which the metadata for the given token ID can be found&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  function sealedURI(uint256 tokenId) external view returns (string);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    @notice This function returns a boolean stating if the token ID is sealed or not&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    @dev This function should throw if the token ID does not exist&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    @param tokenId The token ID that will be checked if sealed or not&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    @return Boolean stating if token ID is sealed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  function isSealed(uint256 tokenId) external view returns (bool)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &#x2F;&#x2F;&#x2F; @dev This emits when a range of tokens is sealed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  event Sealed(uint256 indexed fromTokenId, uint256 indexed toTokenId, string memory uri);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;sealed-metadata-json-format&quot;&gt;Sealed Metadata JSON Format&lt;&#x2F;h3&gt;
&lt;p&gt;The sealed metadata JSON file MAY contain metadata for many different tokens. The top level keys of the JSON object MUST be token IDs.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;type ERC721Metadata = {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  name?: string;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  image?: string;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  description?: string;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;type SealedMetaDataJson = {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  [tokenId: string]: string | ERC721Metadata;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;const sealedMetadata: SealedMetaDataJson = {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;#39;1&amp;#39;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        name: &amp;#39;Metadata for token with ID 1&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;#39;2&amp;#39;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        name: &amp;#39;Metadata for token with ID 2&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; Example pointing to another file&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;#39;3&amp;#39;: &amp;#39;ipfs:&#x2F;&#x2F;SOME_HASH_ON_IPFS&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;};&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;Rationale for rule not explicitly requiring that sealed URI be hosted on decentralized filestorage&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;In order for this standard to remain future proof there is no validation within the smart contract that would verify the sealed URI is hosted on IPFS or another decentralized file storage system. The standard allows potential collectors and platforms to validate the URI on the client.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Rationale to include many NFT metadata objects, or URIs in one JSON file&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;By including metadata for many NFTs in one JSON file we can eliminate the need for many transactions to set the metadata for multiple NFTs. Given that this file should not change NFT platforms, or explorers can cache the metadata within the file.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Rationale for emitting &lt;code&gt;Sealed&lt;&#x2F;code&gt; event&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Platforms and explorers can use the &lt;code&gt;Sealed&lt;&#x2F;code&gt; event to automatically cache metadata, or update information regarding specified NFTs.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Rationale for allowing URIs as values in the JSON file&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;If a token&#x27;s metadata is very large, or there are many tokens you can save file space by referencing another URI rather than storing the metadata JSON within the top level metadata file.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;There is no backwards compatibility with existing standards. This is an extension which could be added to existing NFT standards.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;There are no security considerations related directly to the implementation of this standard.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Difficulty Bomb Delay to December 2021</title>
        <published>2021-05-06T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>James Hancock</name><uri>https://github.com/madeoftin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3554/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3554-ice-age-delay-targeting-december-2021/6188" />
        

        <id>https://wg-eips.ritovision.com/3554/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:3554"
            label="EIP-3554" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3554/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Delays the difficulty bomb to show effect the first week of December 2021.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Starting with &lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt; the client will calculate the difficulty based on a fake block number suggesting to the client that the difficulty bomb is adjusting 9,700,000 blocks later than the actual block number.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Targeting for the Shanghai upgrade and&#x2F;or the Merge to occur before December 2021. Either the bomb can be readjusted at that time, or removed all together.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h4 id=&quot;relax-difficulty-with-fake-block-number&quot;&gt;Relax Difficulty with Fake Block Number&lt;&#x2F;h4&gt;
&lt;p&gt;For the purposes of &lt;code&gt;calc_difficulty&lt;&#x2F;code&gt;, simply replace the use of &lt;code&gt;block.number&lt;&#x2F;code&gt;, as used in the exponential ice age component, with the formula:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    fake_block_number&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 9_700_000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; FORK_BLOCK_NUMBER&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The following script predicts a .1 second delay to blocktime the first week of december and a 1 second delay by the end of the month. This gives reason to address because the effect will be seen, but not so much urgency we don&#x27;t have space to work around if needed.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; predict_diff_bomb_effect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;current_blknum&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; current_difficulty&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; block_adjustment&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; months&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;#39;&amp;#39;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Predicts the effect on block time (as a ratio) in a specified amount of months in the future.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Vars used in last prediction:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    current_blknum = 12382958&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    current_difficulty = 7393633000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    block adjustment = 9700000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    months = 6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;#39;&amp;#39;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    blocks_per_month&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;86400&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 30&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 13.3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    future_blknum&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; current_blknum&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; blocks_per_month&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; months&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    diff_adjustment&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; **&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;future_blknum&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; block_adjustment&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 100000&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    diff_adjust_coeff&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; diff_adjustment&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span&gt; current_difficulty&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2048&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; diff_adjust_coeff&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;diff_adjust_coeff&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; predict_diff_bomb_effect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;12382958&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7393633000000000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;9700000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;6&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No known backward compatibility issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Misjudging the effects of the difficulty can mean longer blocktimes than anticipated until a hardfork is released. Wild shifts in difficulty can affect this number severely. Also, gradual changes in blocktimes due to longer-term adjustments in difficulty can affect the timing of difficulty bomb epochs. This affects the usability of the network but unlikely to have security ramifications.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Reduction in refunds</title>
        <published>2021-04-22T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	<author>
		<name>Martin Swende</name><uri>https://github.com/holiman</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3529/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3529-reduction-in-refunds-alternative-to-eip-3298-and-3403-that-better-preserves-existing-clearing-incentives/6097" />
        

        <id>https://wg-eips.ritovision.com/3529/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:3529"
            label="EIP-3529" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3529/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Remove gas refunds for &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;, and reduce gas refunds for &lt;code&gt;SSTORE&lt;&#x2F;code&gt; to a lower level where the refunds are still substantial, but they are no longer high enough for current &quot;exploits&quot; of the refund mechanism to be viable.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Gas refunds for &lt;code&gt;SSTORE&lt;&#x2F;code&gt; and &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; were originally introduced to motivate application developers to write applications that practice &quot;good state hygiene&quot;, clearing storage slots and contracts that are no longer needed. However, the benefits of this technique have proven to be far lower than anticipated, and gas refunds have had multiple unexpected harmful consequences:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Refunds give rise to GasToken. GasToken has benefits in moving gas space from low-fee periods to high-fee periods, but it also has downsides to the network, particularly in exacerbating state size (as state slots are effectively used as a &quot;battery&quot; to save up gas) and inefficiently clogging blockchain gas usage&lt;&#x2F;li&gt;
&lt;li&gt;Refunds increase block size variance. The theoretical maximum amount of actual gas consumed in a block is nearly twice the on-paper gas limit (as refunds add gas space for subsequent transactions in a block, though refunds are capped at 50% of a transaction&#x27;s gas used). This is not fatal, but is still undesirable, especially given that refunds can be used to maintain 2x usage spikes for far longer than EIP-1559 can.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FORK_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;TBD&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_REFUND_QUOTIENT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;For blocks where &lt;code&gt;block.number &amp;gt;= FORK_BLOCK&lt;&#x2F;code&gt;, the following changes apply.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Remove the &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; refund.&lt;&#x2F;li&gt;
&lt;li&gt;Replace &lt;code&gt;SSTORE_CLEARS_SCHEDULE&lt;&#x2F;code&gt; (as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2200&#x2F;&quot;&gt;EIP-2200&lt;&#x2F;a&gt;) with &lt;code&gt;SSTORE_RESET_GAS + ACCESS_LIST_STORAGE_KEY_COST&lt;&#x2F;code&gt; (4,800 gas as of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt; + &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930&lt;&#x2F;a&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;Reduce the max gas refunded after a transaction to &lt;code&gt;gas_used &#x2F;&#x2F; MAX_REFUND_QUOTIENT&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Remark: Previously &lt;em&gt;max gas refunded&lt;&#x2F;em&gt; was defined as &lt;code&gt;gas_used &#x2F;&#x2F; 2&lt;&#x2F;code&gt;. Here we
name the constant &lt;code&gt;2&lt;&#x2F;code&gt; as &lt;code&gt;MAX_REFUND_QUOTIENT&lt;&#x2F;code&gt; and change its value to &lt;code&gt;5&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;In &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2200&#x2F;#specification&quot;&gt;EIP-2200&lt;&#x2F;a&gt;, three cases for refunds were introduced:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;If the original value is nonzero, and the new value is zero, add &lt;code&gt;SSTORE_CLEARS_SCHEDULE&lt;&#x2F;code&gt; (currently 15,000) gas to the refund counter&lt;&#x2F;li&gt;
&lt;li&gt;If the original value is zero, the current value is nonzero, and the new value is zero, add &lt;code&gt;SSTORE_SET_GAS - SLOAD_GAS&lt;&#x2F;code&gt; (currently 19,900) gas to the refund counter&lt;&#x2F;li&gt;
&lt;li&gt;If the original value is nonzero, the current value is a different nonzero value, and the new value equals the original value, add &lt;code&gt;SSTORE_RESET_GAS - SLOAD_GAS&lt;&#x2F;code&gt; (currently 4,900) gas to the refund counter&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Of these three, only (1) enables gastokens and allows a block to expend more gas on execution than the block gas limit. (2) does not have this property, because for the 19,900 refund to be obtained, &lt;em&gt;the same storage slot&lt;&#x2F;em&gt; must have been changed from zero to nonzero previously, costing 20,000 gas. The inability to obtain gas from clearing one storage slot and use it to edit another storage slot means that it cannot be used for gas tokens. Additionally, obtaining the refund requires &lt;em&gt;reverting&lt;&#x2F;em&gt; the effect of the storage write and expansion, so the refunded gas does not contribute to a client&#x27;s load in processing a block. (3) behaves similarly: the 4,900 refund can only be obtained when 5,000 gas had previously been spent on the same storage slot.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP deals with case (1). We can establish under what conditions a gastoken is nonviable (ie. you cannot get more gas out of a storage slot than you put in) by using a similar &quot;pairing&quot; argument, mapping each refund to a previous expenditure in the same transaction on the same storage slot. lf a storage slot is changed to zero when its original value is nonzero, there are two possibilities:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;This could be the first time that the storage slot is set to zero. In this case, we can pair this event with the &lt;code&gt;SSTORE_RESET_GAS + ACCESS_LIST_STORAGE_KEY_COST&lt;&#x2F;code&gt; minimum cost of reading and editing the storage slot for the first time.&lt;&#x2F;li&gt;
&lt;li&gt;This could be the second or later time that the storage slot is set to zero. In this case, we can pair this event with the most recent previous time that the value was set &lt;em&gt;away&lt;&#x2F;em&gt; from zero, in which &lt;code&gt;SSTORE_CLEARS_SCHEDULE&lt;&#x2F;code&gt; gas is &lt;em&gt;removed&lt;&#x2F;em&gt; from the refund.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;For the second and later event, it does not matter what value &lt;code&gt;SSTORE_CLEARS_SCHEDULE&lt;&#x2F;code&gt; has, because every refund of that size is paired with a refund &lt;em&gt;removal&lt;&#x2F;em&gt; of the same size. This leaves the first event. For the total gas expended on the slot to be guaranteed to be positive, we need &lt;code&gt;SSTORE_CLEARS_SCHEDULE &amp;lt;= SSTORE_RESET_GAS + ACCESS_LIST_STORAGE_KEY_COST&lt;&#x2F;code&gt;. And so this EIP simply decreases &lt;code&gt;SSTORE_CLEARS_SCHEDULE&lt;&#x2F;code&gt; to the sum of those two costs.&lt;&#x2F;p&gt;
&lt;p&gt;One alternative intuition for this EIP is that there will not be a net refund for clearing data that has not yet been read (which is often &quot;useless&quot; data), but there will continue to be a net refund for clearing data that has been read (which is likely to be &quot;useful&quot; data).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Refunds are currently only applied &lt;em&gt;after&lt;&#x2F;em&gt; transaction execution, so they cannot affect how much gas is available to any particular call frame during execution. Hence, removing them will not break the ability of any code to execute, though it will render some applications economically nonviable.&lt;&#x2F;p&gt;
&lt;p&gt;Gas tokens will become valueless. DeFi arbitrage bots, which today frequently use either established gas token schemes or a custom alternative to reduce on-chain costs, would benefit from rewriting their code to remove calls to these no-longer-functional gas storage mechanisms.&lt;&#x2F;p&gt;
&lt;p&gt;However, fully preserving refunds in the &lt;code&gt;new = original = 0 != current&lt;&#x2F;code&gt; case, and keeping &lt;em&gt;some&lt;&#x2F;em&gt; refund in the other &lt;code&gt;nonzero -&amp;gt; zero&lt;&#x2F;code&gt; cases, ensures that a few key use cases that receive (and deserve) favorable gas cost treatment continue to do so. For example, &lt;code&gt;zero -&amp;gt; nonzero -&amp;gt; zero&lt;&#x2F;code&gt; storage set patterns continue to cost only ~100 gas. Two important examples of such patterns include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Anti-reentrancy locks (typically flipped from 0 to 1 right before a child call begins, and then flipped back to 0 when the child call ends)&lt;&#x2F;li&gt;
&lt;li&gt;ERC20 approve-and-send (the &quot;approved value&quot; goes from zero to nonzero when the token transfer is approved, and then back to zero when the token transfer processes)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;effect-on-storage-clearing-incentives&quot;&gt;Effect on storage clearing incentives&lt;&#x2F;h3&gt;
&lt;p&gt;A criticism of earlier refund removal EIPs (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3298&#x2F;&quot;&gt;EIP-3298&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3403&#x2F;&quot;&gt;EIP-3403&lt;&#x2F;a&gt;) is that these EIPs fully remove the incentive to set a value to zero, encouraging users to not fully clear a storage slot if they expect even the smallest probability that they will want to use that storage slot again.&lt;&#x2F;p&gt;
&lt;p&gt;For example, if you have 1 unit of an ERC20 token and you are giving away or selling your entire balance, you could instead only give away 0.999999 units and leave the remainder behind. If you ever decide to re-acquire more of that token with the same account in the future, you would only have to pay 5000 gas (2100 for the read + 2900 for nonzero-to-nonzero set) for the &lt;code&gt;SSTORE&lt;&#x2F;code&gt; instead of 22100 (20000 for the zero-to-nonzero set). Today, this is counterbalanced by the 15000 refund for clearing, so you only have an incentive to do this if you are more than &lt;code&gt;15000 &#x2F; 17100 = 87.7%&lt;&#x2F;code&gt; sure that you will use the slot again; with EIP-3298 or EIP-3403 the counterbalancing incentive would not exist, so setting to nonzero is better if your chance of using the slot again is &lt;em&gt;any&lt;&#x2F;em&gt; value greater than 0%.&lt;&#x2F;p&gt;
&lt;p&gt;A refund of 4800 gas remains, so there is only be an incentive to keep a storage slot nonzero if you expect a probability of more than &lt;code&gt;4800 &#x2F; 17100 = 28.1%&lt;&#x2F;code&gt; that you will use that slot again. This is not perfect, but it is likely higher than the average person&#x27;s expectations of later re-acquiring a token with the same address if they clear their entire balance of it.&lt;&#x2F;p&gt;
&lt;p&gt;The capping of refunds to 1&#x2F;5 of gas expended means that this refund can only be used to increase the amount of storage write operations needed to process a block by at most 25%, limiting the ability to use this mechanic for storage-write-focused denial-of-service attacks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;eip-2929-gas-costs&quot;&gt;EIP-2929 Gas Costs&lt;&#x2F;h3&gt;
&lt;p&gt;Note, there is a difference between &#x27;hot&#x27; and &#x27;cold&#x27; slots. This table shows the values as of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt; assuming that all touched storage slots were already &#x27;hot&#x27; (the difference being a one-time cost of &lt;code&gt;2100&lt;&#x2F;code&gt; gas).&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Code&lt;&#x2F;th&gt;&lt;th&gt;Used Gas&lt;&#x2F;th&gt;&lt;th&gt;Refund&lt;&#x2F;th&gt;&lt;th&gt;Original&lt;&#x2F;th&gt;&lt;th&gt;1st&lt;&#x2F;th&gt;&lt;th&gt;2nd&lt;&#x2F;th&gt;&lt;th&gt;3rd&lt;&#x2F;th&gt;&lt;th&gt;Effective gas (after refund)&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;td&gt;19900&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556002600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;15000&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;-11988&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;2800&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556002600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60026000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;15000&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;-11988&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60026000556003600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60026000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;2800&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60026000556002600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;15000&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;-11988&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556002600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x600160005560006000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;40118&lt;&#x2F;td&gt;&lt;td&gt;19900&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;20218&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x600060005560016000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;5918&lt;&#x2F;td&gt;&lt;td&gt;17800&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;-11882&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;with-reduced-refunds&quot;&gt;With reduced refunds&lt;&#x2F;h3&gt;
&lt;p&gt;If refunds were to be partially removed, by changing &lt;code&gt;SSTORE_CLEARS_SCHEDULE&lt;&#x2F;code&gt; from 15000 to 4800 (and removing selfdestruct refund) this would be the comparative table.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Code&lt;&#x2F;th&gt;&lt;th&gt;Used Gas&lt;&#x2F;th&gt;&lt;th&gt;Refund&lt;&#x2F;th&gt;&lt;th&gt;Original&lt;&#x2F;th&gt;&lt;th&gt;1st&lt;&#x2F;th&gt;&lt;th&gt;2nd&lt;&#x2F;th&gt;&lt;th&gt;3rd&lt;&#x2F;th&gt;&lt;th&gt;Effective gas (after refund)&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;td&gt;19900&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556002600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;4800&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;-1788&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;2800&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556002600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60026000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;4800&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;-1788&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60026000556003600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60026000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;2800&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60026000556002600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;4800&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;-1788&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556002600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x600160005560006000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;40118&lt;&#x2F;td&gt;&lt;td&gt;19900&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;20218&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x600060005560016000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;5918&lt;&#x2F;td&gt;&lt;td&gt;7600&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;-1682&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Refunds are not visible to transaction execution, so this should not have any impact on transaction execution logic.&lt;&#x2F;p&gt;
&lt;p&gt;The maximum amount of gas that can be spent on execution in a block is limited to the gas limit, if we do not count zero-to-nonzero &lt;code&gt;SSTORE&lt;&#x2F;code&gt;s that were later reset back to zero. It is okay to not count those, because if such an &lt;code&gt;SSTORE&lt;&#x2F;code&gt; is reset, storage is not expanded and the client does not need to actually adjust the Merke tree; the gas consumption is refunded, but the effort normally required by the client to process those opcodes is also cancelled. &lt;strong&gt;Clients should make sure to not do a storage write if &lt;code&gt;new_value = original_value&lt;&#x2F;code&gt;; this was a prudent optimization since the beginning of Ethereum but it becomes more important now.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>ERC-721 Editions Standard</title>
        <published>2021-04-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Nathan Ginnever</name><uri>https://github.com/nginnever</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3440/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3340-nft-editions-standard-extension/6044" />
        

        <id>https://wg-eips.ritovision.com/3440/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:3440"
            label="ERC-3440" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3440/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;This standard addresses an extension to the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721 specification&lt;&#x2F;a&gt; by allowing signatures on NFTs representing works of art. This provides improved provenance by creating functionality for an artist to designate an original and signed limited-edition prints of their work.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;ERC-3440 is an ERC-721 extension specifically designed to make NFTs more robust for works of art. This extends the original ERC-721 spec by providing the ability to designate the original and limited-edition prints with a specialized enumeration extension similar to the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;OpenZeppelin&#x2F;openzeppelin-contracts&#x2F;blob&#x2F;master&#x2F;contracts&#x2F;token&#x2F;ERC721&#x2F;extensions&#x2F;ERC721Enumerable.sol&quot;&gt;original 721 extension&lt;&#x2F;a&gt; built-in. The key improvement of this extension is allowing artists to designate the limited nature of their prints and provide a signed piece of data that represents their unique signature to a given token Id, much like an artist would sign a print of their work.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently the link between a NFT and the digital work of art is only enforced in the token metadata stored in the shared &lt;code&gt;tokenURI&lt;&#x2F;code&gt; state of a NFT. While the blockchain provides an immutable record of history back to the origin of an NFT, often the origin is not a key that an artist maintains as closely as they would a hand written signature.&lt;&#x2F;p&gt;
&lt;p&gt;An edition is a printed replica of an original piece of art. ERC-721 is not specifically designed to be used for works of art, such as digital art and music. ERC-721 (NFT) was originally created to handle deeds and other contracts. Eventually ERC-721 evolved into gaming tokens, where metadata hosted by servers may be sufficient. This proposal takes the position that we can create a more tangible link between the NFT, digital art, owner, and artist. By making a concise standard for art, it will be easier for an artist to maintain a connection with the Ethereum blockchain as well as their fans that purchase their tokens.&lt;&#x2F;p&gt;
&lt;p&gt;The use cases for NFTs have evolved into works of digital art, and there is a need to designate an original NFT and printed editions with signatures in a trustless manner. ERC-721 contracts may or may not be deployed by artists, and currently, the only way to understand that something is uniquely touched by an artist is to display it on 3rd party applications that assume a connection via metadata that exists on servers, external to the blockchain. This proposal helps remove that distance with readily available functionality for artists to sign their work and provides a standard for 3rd party applications to display the uniqueness of a NFT for those that purchase them. The designation of limited-editions combined with immutable signatures, creates a trustlessly enforced link. This signature is accompanied by view functions that allow applications to easily display these signatures and limited-edition prints as evidence of uniqueness by showing that artists specifically used their key to designate the total supply and sign each NFT.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;ERC-721 compliant contracts MAY implement this ERC for editions to provide a standard method for designating the original and limited-edition prints with signatures from the artist.&lt;&#x2F;p&gt;
&lt;p&gt;Implementations of ERC-3440 MUST designate which token Id is the original NFT (defaulted to Id 0), and which token Id is a unique replica. The original print SHOULD be token Id number 0 but MAY be assigned to a different Id. The original print MUST only be designated once. The implementation MUST designate a maximum number of minted editions, after which new Ids MUST NOT be printed &#x2F; minted.&lt;&#x2F;p&gt;
&lt;p&gt;Artists MAY use the signing feature to sign the original or limited edition prints but this is OPTIONAL. A standard message to sign is RECOMMENDED to be simply a hash of the integer of the token Id.&lt;&#x2F;p&gt;
&lt;p&gt;Signature messages MUST use the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-712&quot;&gt;EIP-712&lt;&#x2F;a&gt; standard.&lt;&#x2F;p&gt;
&lt;p&gt;A contract that is compliant with ERC-3440 shall implement the following abstract contract (referred to as ERC3440.sol):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: MIT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC721&#x2F;extensions&#x2F;ERC721URIStorage.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;utils&#x2F;cryptography&#x2F;ECDSA.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC721 token with editions extension.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;abstract&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC3440&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721URIStorage&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; eip-712&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EIP712Domain&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt;  name&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt;  version&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; chainId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; verifyingContract&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Contents of message to be signed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Signature&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; verificationAddress&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ensure the artists signs only address(this) for each piece&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt; artist&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; wallet&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt; contents&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; type hashes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; EIP712DOMAIN_TYPEHASH &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        &amp;quot;EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; SIGNATURE_TYPEHASH &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        &amp;quot;Signature(address verifyAddress,string artist,address wallet, string contents)&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; DOMAIN_SEPARATOR&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Optional mapping for signatures&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _signatures&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A view to display the artist&amp;#39;s address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; artist&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A view to display the total number of prints created&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; editionSupply &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A view to display which ID is the original copy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; originalId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A signed token event&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Signed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sets `artist` as the original artist.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `address _artist` the wallet of the signing artist (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;TODO&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; consider multiple&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * signers and contract signers (non-EOA)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _designateArtist&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _artist&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;artist &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC721Extensions: the artist has already been set&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If there is no special designation for the artist, set it.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        artist &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _artist&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sets `tokenId as the original print` as the tokenURI of `tokenId`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `uint256 tokenId` the nft id of the original print&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _designateOriginal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; artist&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC721Extensions: only the artist may designate originals&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_exists&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC721Extensions: Original query for nonexistent token&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;originalId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC721Extensions: Original print has already been designated as a different Id&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If there is no special designation for the original, set it.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        originalId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sets total number printed editions of the original as the tokenURI of `tokenId`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `uint256 _maxEditionSupply` max supply&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _setLimitedEditions&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _maxEditionSupply&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; artist&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC721Extensions: only the artist may designate max supply&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;editionSupply &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC721Extensions: Max number of prints has already been created&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If there is no max supply of prints, set it. Leaving supply at 0 indicates there are no prints of the original&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        editionSupply &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _maxEditionSupply&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Creates `tokenIds` representing the printed editions.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `string memory _tokenURI` the metadata attached to each nft&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _createEditions&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenURI&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; artist&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC721Extensions: only the artist may create prints&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;editionSupply &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC721Extensions: the edition supply is not set to more than 0&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; editionSupply&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            _mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            _setTokenURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _tokenURI&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; internal hashing utility &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `Signature memory _message` the signature message struct to be signed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * the address of this contract is enforced in the hashing&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _message&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;\x19\x01&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            DOMAIN_SEPARATOR&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                SIGNATURE_TYPEHASH&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                _message&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;artist&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                _message&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;wallet&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                _message&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;contents&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Signs a `tokenId` representing a print.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `uint256 _tokenId` id of the NFT being signed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `Signature memory _message` the signed message&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `bytes memory _signature` signature bytes created off-chain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * - `tokenId` must exist.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Emits a {Signed} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _signEdition&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; Signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _message&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; artist&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC721Extensions: only the artist may sign their work&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_signatures&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC721Extensions: this token is already signed&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; digest &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_message&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; recovered &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; ECDSA&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;recover&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;digest&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;recovered &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; artist&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC721Extensions: artist signature mismatch&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _signatures&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; _signature&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Signed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;artist&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; displays a signature from the artist.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `uint256 _tokenId` NFT id to verify isSigned&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * @returns `bytes` gets the signature stored on the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getSignature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_signatures&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC721Extensions: no signature exists for this Id&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _signatures&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; returns `true` if the message is signed by the artist.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `Signature memory _message` the message signed by an artist and published elsewhere&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `bytes memory _signature` the signature on the message&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `uint _tokenId` id of the token to be verified as being signed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * @returns `bool` true if signed by artist&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * The artist may broadcast signature out of band that will verify on the nft&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isSigned&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _message&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; messageHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_message&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; _artist &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; ECDSA&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;recover&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;messageHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;_artist &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; artist &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _equals&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_signatures&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Utility function that checks if two `bytes memory` variables are equal. This is done using hashing,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * which is much more gas efficient then comparing each byte individually.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    * Equality means that:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *  - &amp;#39;self.length == other.length&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *  - For &amp;#39;n&amp;#39; in &amp;#39;[0, self.length)&amp;#39;, &amp;#39;self[n] == other[n]&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _equals&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _other&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; equal&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;_self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span&gt; _other&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span&gt; addr2&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span&gt; len &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            addr &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;BYTES_HEADER_SIZE&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            addr2 &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_other&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;BYTES_HEADER_SIZE&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            equal &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; eq&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; len&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addr2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; len&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;A major role of NFTs is to display uniqueness in digital art. Provenance is a desired feature of works of art, and this standard will help improve a NFT by providing a better way to verify uniqueness. Taking this extra step by an artist to explicitly sign tokens provides a better connection between the artists and their work on the blockchain. Artists can now retain their private key and sign messages in the future showing that the same signature is present on a unique NFT.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal combines already available 721 extensions and is backwards compatible with the ERC-721 standard.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;An example implementation including tests can be found &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;nginnever&#x2F;NFT-editions&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: MIT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;ERC3440.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC721 token with editions extension.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ArtToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC3440&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sets `address artist` as the original artist to the account deploying the NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;     constructor&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _symbol&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _numberOfEditions&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenURI&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _originalId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_name, _symbol) &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _designateArtist&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _setLimitedEditions&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_numberOfEditions&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _createEditions&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenURI&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _designateOriginal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_originalId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        DOMAIN_SEPARATOR &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            EIP712DOMAIN_TYPEHASH&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;Artist&amp;#39;s Editions&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;1&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;            1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Signs a `tokenId` representing a print.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; sign&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; Signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _message&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _signEdition&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _message&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This extension gives an artist the ability to designate an original edition, set the maximum supply of editions as well as print the editions and uses the &lt;code&gt;tokenURI&lt;&#x2F;code&gt; extension to supply a link to the art work. To minimize the risk of an artist changing this value after selling an original piece this function can only happen once. Ensuring that these functions can only happen once provides consistency with uniqueness and verifiability. Due to this, the reference implementation handles these features in the constructor function. An edition may only be signed once, and care should be taken that the edition is signed correctly before release of the token&#x2F;s.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Restricted Chain Context Type Transactions</title>
        <published>2021-04-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Isaac Ardis</name><uri>https://github.com/whilei</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3534/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3534-restricted-chain-context-transaction-type/6112" />
        

        <id>https://wg-eips.ritovision.com/3534/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:3534"
            label="EIP-3534" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3534/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Defines a new transaction type with constraints on ancestor block hash, block author, and&#x2F;or block timestamp.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;We introduce a new EIP-2718 transaction type with the format &lt;code&gt;0x4 || rlp([chainId, chainContext, nonce, gasPrice, gasLimit, to, value, data, access_list, yParity, senderR, senderS])&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This proposed &lt;code&gt;chainContext&lt;&#x2F;code&gt; element adds a constraint on the validity of a transaction to a chain segment meeting the referenced value(s). Four contexts are defined as subclasses of this type:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;segmentId&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;eligibleMinerList&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ineligibleMinerList&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;expiry&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;These contexts can be used in arbitrary combinations. Annotated context value combinations are referenced by a composite integer prefix on the annotation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Establish a protocol-based mechanism with which transactions are able to articulate constraints on eligible chain contexts.
Generally, these constraints give the consumer (the transactor) an ability to express requirements about the transaction&#x27;s relationship to blockchain data and its provenance.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Restrict transaction applicability to a chain context that is currently available and reasoned about under some subjective view.
&lt;ul&gt;
&lt;li&gt;Introduces a way for transactions to describe a dependency on their current view of a chain.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Restrict transaction applicability to a chain context following some foregoing block (and its transactions).
&lt;ul&gt;
&lt;li&gt;Introduces a way for transactions to describe ancestral dependencies at a &quot;macro&quot; (block) level.
Indirectly, this offers a way for a transaction to depend on the presence of another, so long as the dependent transaction is in a different block.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Restrict transaction applicability to blocks benefitting, or &lt;em&gt;not&lt;&#x2F;em&gt; benefitting, a preferred&#x2F;spurned miner address or addresses.
&lt;ul&gt;
&lt;li&gt;Introduces an opportunity&#x2F;market for miners to compete for consumers&#x27; transactions; under the status quo, the current miner-transaction processing service is almost perfectly homogeneous from the consumer perspective.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Restrict transaction applicability time span.
&lt;ul&gt;
&lt;li&gt;Introduces an alternative (to the status quo) way for consumers&#x2F;transactors to have transactions invalidated&#x2F;ejected from the transaction pool.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt; &lt;code&gt;TBD&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TRANSACTION_TYPE_NUMBER&lt;&#x2F;code&gt; &lt;code&gt;0x4&lt;&#x2F;code&gt;.  See EIP-2718.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;As of &lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt;, a new EIP-2718 transaction is introduced with &lt;code&gt;TransactionType&lt;&#x2F;code&gt; &lt;code&gt;TRANSACTION_TYPE_NUMBER&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The EIP-2718 &lt;code&gt;TransactionPayload&lt;&#x2F;code&gt; for this transaction is &lt;code&gt;rlp([chainId, chainContext, nonce, gasPrice, gasLimit, to, value, data, access_list, yParity, senderR, senderS])&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The EIP-2718 &lt;code&gt;ReceiptPayload&lt;&#x2F;code&gt; for this transaction is &lt;code&gt;rlp([status, cumulativeGasUsed, logsBloom, logs])&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;chainContext&lt;&#x2F;code&gt;. The transaction is only valid for blockchain data satisfying ALL OF the annotations.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ANNOTATION_COMPOSITE_PREFIX&lt;&#x2F;code&gt;. A positive integer between &lt;code&gt;1&lt;&#x2F;code&gt; and &lt;code&gt;0xff&lt;&#x2F;code&gt; that represents the set of subclass annotations in the &lt;code&gt;chainContext&lt;&#x2F;code&gt; (&lt;em&gt;ie.&lt;&#x2F;em&gt; &lt;em&gt;which&lt;&#x2F;em&gt; chain context subclasses should the provided values be applied to). This value should be the sum of the subclass&#x27; &lt;code&gt;ANNOTATION_PREFIX&lt;&#x2F;code&gt;s.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ANNOTATION_PREFIX&lt;&#x2F;code&gt;s are defined for Subclasses as octal-derived positive integers, limited to the set &lt;code&gt;2^0,2^1,2^2,2^3,2^4,2^5,2^6,2^7&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;code&gt;chainContext&lt;&#x2F;code&gt; value should be of the form &lt;code&gt;ANNOTATION_COMPOSITE_PREFIX || [{subclass value}...]&lt;&#x2F;code&gt;, where&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;...&lt;&#x2F;code&gt; means &quot;zero or more of the things to the left,&quot; and&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;||&lt;&#x2F;code&gt; denotes the byte&#x2F;byte-array concatenation operator.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;code&gt;chainContext&lt;&#x2F;code&gt; value should be encoded as &lt;code&gt;ANNOTATION_COMPOSITE_PREFIX || rlp[{subclass value}...]&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;validation&quot;&gt;Validation&lt;&#x2F;h3&gt;
&lt;p&gt;The values defined as subclasses below acts as constraints on transaction validity for specific chain contexts.
Transactions defining constraints which are not satisfied by their chain context should be rejected as invalid.
Blocks containing invalid transactions should be rejected as invalid themselves, per the &lt;em&gt;status quo&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;subclass-combination&quot;&gt;Subclass Combination&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;chainContext&lt;&#x2F;code&gt; values annotating more than one subclass reference should provide those values in the following sequential order:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;ANCESTOR_ID&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ELIGIBLE_MINER_LIST&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;INELIGIBLE_MINER_LIST&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;EXPIRY&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;As above, the &lt;code&gt;ANNOTATION_COMPOSITE_PREFIX&lt;&#x2F;code&gt; should be the sum of the designated subclass&#x27; &lt;code&gt;ANNOTATION_PREFIX&lt;&#x2F;code&gt;s.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;subclasses&quot;&gt;Subclasses&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;An &lt;code&gt;ANNOTATION_PREFIX&lt;&#x2F;code&gt; value is used to represent each of the available context subclasses.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;ancestorid&quot;&gt;&lt;code&gt;ancestorId&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ANNOTATION_PREFIX&lt;&#x2F;code&gt; &lt;code&gt;1&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ANCESTOR_ID&lt;&#x2F;code&gt; &lt;code&gt;bytes&lt;&#x2F;code&gt;. A byte array between 4 and 12 bytes in length.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;code&gt;ANCESTOR_ID&lt;&#x2F;code&gt; is a reference to a specific block by concatenating the byte representation of a block number and the first 4 bytes of its hash.
The block number&#x27;s should be encoded as a big endian value and should have left-padding 0&#x27;s removed.
The block number value may be omitted in case of reference to the genesis block.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;ANCESTOR_ID&lt;&#x2F;code&gt; value should be RLP encoded as a byte array for hashing and transmission.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;eligibleminerlist&quot;&gt;&lt;code&gt;eligibleMinerList&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ANNOTATION_PREFIX&lt;&#x2F;code&gt; &lt;code&gt;2&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ELIGIBLE_MINER_LIST&lt;&#x2F;code&gt; &lt;code&gt;[address...]&lt;&#x2F;code&gt;. A list of addresses.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;MAX_ELEMENTS&lt;&#x2F;code&gt; &lt;code&gt;3&lt;&#x2F;code&gt;. The maximum number of addresses that can be provided.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;code&gt;ELIGIBLE_MINER_LIST&lt;&#x2F;code&gt; value is an array of unique, valid addresses.
Any block containing a transaction using this value must have a block beneficiary included in this set.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;ELIGIBLE_MINER_LIST&lt;&#x2F;code&gt; value should be of the type &lt;code&gt;[{20 bytes}+]&lt;&#x2F;code&gt;, where &lt;code&gt;+&lt;&#x2F;code&gt; means &quot;one or more of the thing to the left.&quot;
Non-unique values are not permitted.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;ELIGIBLE_MINER_LIST&lt;&#x2F;code&gt; value should be RLP encoded for hashing and transmission.&lt;&#x2F;p&gt;
&lt;p&gt;An &lt;code&gt;ELIGIBLE_MINER_LIST&lt;&#x2F;code&gt; value may NOT be provided adjacent to an &lt;code&gt;INELIGIBLE_MINER_LIST&lt;&#x2F;code&gt; value.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;ineligibleminerlist&quot;&gt;&lt;code&gt;ineligibleMinerList&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ANNOTATION_PREFIX&lt;&#x2F;code&gt; &lt;code&gt;4&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;INELIGIBLE_MINER_LIST&lt;&#x2F;code&gt; &lt;code&gt;[address...]&lt;&#x2F;code&gt;. A list of addresses.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;MAX_ELEMENTS&lt;&#x2F;code&gt; &lt;code&gt;3&lt;&#x2F;code&gt;. The maximum number of addresses that can be provided.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;code&gt;INELIGIBLE_MINER_LIST&lt;&#x2F;code&gt; value is an array of unique, valid addresses.
Any block containing a transaction using this value must not have a block beneficiary included in this set.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;INELIGIBLE_MINER_LIST&lt;&#x2F;code&gt; value should be of the type &lt;code&gt;[{20 bytes}+]&lt;&#x2F;code&gt;, where &lt;code&gt;+&lt;&#x2F;code&gt; means &quot;one or more of the thing to the left.&quot;
Non-unique values are not permitted.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;INELIGIBLE_MINER_LIST&lt;&#x2F;code&gt; value should be RLP encoded for hashing and transmission.&lt;&#x2F;p&gt;
&lt;p&gt;An &lt;code&gt;INELIGIBLE_MINER_LIST&lt;&#x2F;code&gt; value may NOT be provided adjacent to an &lt;code&gt;ELIGIBLE_MINER_LIST&lt;&#x2F;code&gt; value.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;expiry&quot;&gt;&lt;code&gt;expiry&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ANNOTATION_PREFIX&lt;&#x2F;code&gt; &lt;code&gt;8&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;EXPIRY&lt;&#x2F;code&gt; &lt;code&gt;integer&lt;&#x2F;code&gt;. A positive, unsigned scalar.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;code&gt;EXPIRY&lt;&#x2F;code&gt; value is a scalar equal to the maximum valid block &lt;code&gt;timestamp&lt;&#x2F;code&gt; for a block including this transaction.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;EXPIRY&lt;&#x2F;code&gt; value should be RLP encoded as an integer for hashing and transmission.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;subclasses-1&quot;&gt;Subclasses&lt;&#x2F;h3&gt;
&lt;p&gt;Subclasses are defined with a high level of conceptual independence, and can be modified and&#x2F;or extended independently from this EIP.
Their specification definitions allow arbitrary mutual (&lt;code&gt;AND&lt;&#x2F;code&gt;) combinations.&lt;&#x2F;p&gt;
&lt;p&gt;This design is intended to form a proposal which offers a concrete set of specifics while doing so with enough flexibility for extension or modification later.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;annotation-prefix&quot;&gt;&lt;code&gt;ANNOTATION_PREFIX&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;ANNOTATION_PREFIX&lt;&#x2F;code&gt; values&#x27; use of octal-derived values, ie. &lt;code&gt;1, 2, 4, 8, 16, 32, 64, 128&lt;&#x2F;code&gt;, follows a conventional pattern of representing combinations from a limited set uniquely and succinctly, eg. Unix-style file permissions.
This EIP defines four of the eight possible context subclasses; this seems to leave plenty of room for future growth in this direction if required.
If this limit is met or exceeded, doing so will require a hard fork &lt;em&gt;de facto&lt;&#x2F;em&gt; (by virtue of making consensus protocol facing changes to transaction validation schemes), so revising this scheme as needed should be only incidental and trivial.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;ancestorid-1&quot;&gt;&lt;code&gt;ancestorId&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Constrains the validity of a transaction by referencing a prior canonical block by number and hash.
The transaction is only valid when included in a block which has the annotated block as an ancestor.&lt;&#x2F;p&gt;
&lt;p&gt;Practically, the &quot;designated allowable chain segment&quot; can be understood as the segment of blocks from &lt;code&gt;0..ancestorId&lt;&#x2F;code&gt; inclusive.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;redundancy-to-chainid&quot;&gt;Redundancy to &lt;code&gt;chainId&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;p&gt;This pattern can be understood as a correlate of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt;&#x27;s &lt;code&gt;chainId&lt;&#x2F;code&gt; specification.
EIP155 defines the restriction of transactions between chains; limiting the applicability of any EIP-155 transaction to a chain with the annotated ChainID.
&lt;code&gt;ancestorId&lt;&#x2F;code&gt; further restricts transaction application to one subsection (&quot;segment&quot;) of one chain.&lt;&#x2F;p&gt;
&lt;p&gt;From this constraint hierarchy, we note that an implementation of &lt;code&gt;ancestorId&lt;&#x2F;code&gt; can make &lt;code&gt;chainId&lt;&#x2F;code&gt; conceptually redundant.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;so-why-keep-chainid&quot;&gt;So why keep &lt;code&gt;chainId&lt;&#x2F;code&gt;?&lt;&#x2F;h5&gt;
&lt;p&gt;&lt;code&gt;chainId&lt;&#x2F;code&gt; is maintained as an invariant because:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The use of the transaction type proposed by this EIP is optional, implying the continued necessity of &lt;code&gt;chainId&lt;&#x2F;code&gt; in the protocol infrastructure and tooling for legacy and other transaction types.&lt;&#x2F;li&gt;
&lt;li&gt;The presence of &lt;code&gt;ancestorId&lt;&#x2F;code&gt; in the transaction type proposed by this EIP is optional. If the value is not filled by an RCC transaction, the demand for &lt;code&gt;chainId&lt;&#x2F;code&gt; remains.&lt;&#x2F;li&gt;
&lt;li&gt;A &lt;code&gt;chainId&lt;&#x2F;code&gt; value is not necessarily redundant to &lt;code&gt;ancestorId&lt;&#x2F;code&gt;, namely in cases where forks result in living chains. For example, an &lt;code&gt;ancestorId&lt;&#x2F;code&gt; reference to block &lt;code&gt;1_919_999&lt;&#x2F;code&gt; would be ambiguous between Ethereum and Ethereum Classic.&lt;&#x2F;li&gt;
&lt;li&gt;It would be possible to specify the omission of &lt;code&gt;chainId&lt;&#x2F;code&gt; in case of &lt;code&gt;ancestorId&lt;&#x2F;code&gt;&#x27;s use. This would add infrastructural complexity for the sake of removing the few bytes &lt;code&gt;chainId&lt;&#x2F;code&gt; typically requires; we do not consider this trade-off worth making.
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;chainId&lt;&#x2F;code&gt; is used as the &lt;code&gt;v&lt;&#x2F;code&gt; value (of &lt;code&gt;v,r,s&lt;&#x2F;code&gt;) in the transaction signing scheme; removing or modifying this incurs complexity at a level below encoded transaction fields, demanding additional infrastructural complexity for implementation.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The proposed design for &lt;code&gt;ancestorId&lt;&#x2F;code&gt; does not provide perfect precision (at the benefit of byte-size savings).
In the small chance that the value is ambiguous, the &lt;code&gt;chainId&lt;&#x2F;code&gt; maintains an infallible guarantee for a transaction&#x27;s chain specificity.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;eligibleminerlist-1&quot;&gt;&lt;code&gt;eligibleMinerList&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The transaction is only valid when included in a block having an &lt;code&gt;etherbase&lt;&#x2F;code&gt; contained in the annotated list of addresses.
The use of &quot;whitelist&quot; (&lt;code&gt;eligibleMinerList&lt;&#x2F;code&gt;) in conjunction with a &quot;blacklist&quot; (&lt;code&gt;ineligibleMinerList&lt;&#x2F;code&gt;) is logically inconsistent; their conjunction is not allowed.&lt;&#x2F;p&gt;
&lt;p&gt;A &lt;code&gt;MAX_ELEMENTS&lt;&#x2F;code&gt; limit of &lt;code&gt;3&lt;&#x2F;code&gt; is chosen to balance the interests of limiting the potential size of transactions, and to provide a sufficient level of articulation for the user. At the time of writing, the top 3 miners of Ethereum (by block, measured by known public addresses) account for 52% of all blocks produced.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;ineligibleminerlist-1&quot;&gt;&lt;code&gt;ineligibleMinerList&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The transaction is only valid when included in a block having an &lt;code&gt;etherbase&lt;&#x2F;code&gt; &lt;em&gt;not&lt;&#x2F;em&gt; contained in the annotated list of addresses.
The use of &quot;blacklist&quot; (&lt;code&gt;ineligibleMinerList&lt;&#x2F;code&gt;) in conjunction with a &quot;whitelist&quot; (&lt;code&gt;eligibleMinerList&lt;&#x2F;code&gt;) is logically inconsistent; their conjunction is not allowed.&lt;&#x2F;p&gt;
&lt;p&gt;A &lt;code&gt;MAX_ELEMENTS&lt;&#x2F;code&gt; limit of &lt;code&gt;3&lt;&#x2F;code&gt; is chosen to balance the interests of limiting the potential size of transactions, and to provide a sufficient level of articulation for the user. At the time of writing, the top 3 miners of Ethereum (by block, measured by known public addresses) account for 52% of all blocks produced.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;expiry-1&quot;&gt;&lt;code&gt;expiry&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The transaction is only valid when included in a block having a &lt;code&gt;timestamp&lt;&#x2F;code&gt; less than the value annotated.
A positive integer is used because that corresponds to the specified type of block &lt;code&gt;timestamp&lt;&#x2F;code&gt; header values.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;subclass-combination-1&quot;&gt;Subclass Combination&lt;&#x2F;h3&gt;
&lt;p&gt;Since subclasses use octal-based values for &lt;code&gt;ANNOTATION_PREFIX&lt;&#x2F;code&gt;, they can be distinguishably combined as sums, provided as we assume annotation cardinality (ie ordering).
For example:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ANNOTATION_PREFIX&lt;&#x2F;code&gt; &lt;code&gt;1&lt;&#x2F;code&gt; signals &lt;code&gt;ancestorId&lt;&#x2F;code&gt; exclusively.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ANNOTATION_PREFIX&lt;&#x2F;code&gt; &lt;code&gt;2&lt;&#x2F;code&gt; signals &lt;code&gt;eligibleMinerList&lt;&#x2F;code&gt; exclusively.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ANNOTATION_PREFIX&lt;&#x2F;code&gt; &lt;code&gt;4&lt;&#x2F;code&gt; signals &lt;code&gt;ineligibleMinerList&lt;&#x2F;code&gt; exclusively.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ANNOTATION_PREFIX&lt;&#x2F;code&gt; &lt;code&gt;8&lt;&#x2F;code&gt; signals &lt;code&gt;expiry&lt;&#x2F;code&gt; exclusively.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ANNOTATION_PREFIX&lt;&#x2F;code&gt; &lt;code&gt;1+2=3&lt;&#x2F;code&gt; combines &lt;code&gt;ancestorId&lt;&#x2F;code&gt; and &lt;code&gt;eligibleMinerList&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ANNOTATION_PREFIX&lt;&#x2F;code&gt; &lt;code&gt;1+4=5&lt;&#x2F;code&gt; combines &lt;code&gt;ancestorId&lt;&#x2F;code&gt; and &lt;code&gt;ineligibleMinerList&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ANNOTATION_PREFIX&lt;&#x2F;code&gt; &lt;code&gt;1+8=9&lt;&#x2F;code&gt; combines &lt;code&gt;ancestorId&lt;&#x2F;code&gt; and &lt;code&gt;expiry&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ANNOTATION_PREFIX&lt;&#x2F;code&gt; &lt;code&gt;1+2+8=11&lt;&#x2F;code&gt; combines &lt;code&gt;ancestorId&lt;&#x2F;code&gt; and &lt;code&gt;eligibleMinerList&lt;&#x2F;code&gt; and &lt;code&gt;expiry&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ANNOTATION_PREFIX&lt;&#x2F;code&gt; &lt;code&gt;1+4+8=13&lt;&#x2F;code&gt; combines &lt;code&gt;ancestorId&lt;&#x2F;code&gt; and &lt;code&gt;ineligibleMinerList&lt;&#x2F;code&gt; and &lt;code&gt;expiry&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ANNOTATION_PREFIX&lt;&#x2F;code&gt; &lt;code&gt;2+4=6&lt;&#x2F;code&gt; is NOT PERMITTED. It would combine &lt;code&gt;eligibleMinerList&lt;&#x2F;code&gt; and &lt;code&gt;ineligibleMinerList&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ANNOTATION_PREFIX&lt;&#x2F;code&gt; &lt;code&gt;1+2+4+8=15&lt;&#x2F;code&gt; is NOT PERMITTED. It would combine &lt;code&gt;eligibleMinerList&lt;&#x2F;code&gt; and &lt;code&gt;ineligibleMinerList&lt;&#x2F;code&gt; (and &lt;code&gt;ancestorId&lt;&#x2F;code&gt; and &lt;code&gt;expiry&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Since ordering is defined and demanded for multiple values, annotated references remain distinguishable. For example:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;chainContext&lt;&#x2F;code&gt; &lt;code&gt;3[e4e1c0e78b1ec3,[Df7D7e053933b5cC24372f878c90E62dADAD5d42]]&lt;&#x2F;code&gt; - Transaction can only be included in a block having a canonical ancestor block numbered &lt;code&gt;15_000_000&lt;&#x2F;code&gt; and with a hash prefixed with the bytes &lt;code&gt;e78b1ec3&lt;&#x2F;code&gt;, and if the containing block uses &lt;code&gt;Df7D7e053933b5cC24372f878c90E62dADAD5d42&lt;&#x2F;code&gt; as the beneficiary.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;chainContext&lt;&#x2F;code&gt; &lt;code&gt;10[[Df7D7e053933b5cC24372f878c90E62dADAD5d42],1619008030]&lt;&#x2F;code&gt; - Transaction can only be included in a block naming &lt;code&gt;Df7D7e053933b5cC24372f878c90E62dADAD5d42&lt;&#x2F;code&gt; as the &lt;code&gt;etherbase&lt;&#x2F;code&gt; beneficiary, and which has a timestamp greater than &lt;code&gt;1619008030&lt;&#x2F;code&gt; (Wed Apr 21 07:27:10 CDT 2021).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;eip-2930-inheritance&quot;&gt;EIP-2930 Inheritance&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-2930&quot;&gt;EIP-2930 Optional Access List Type Transaction&lt;&#x2F;a&gt; is used as an assumed &quot;base&quot; transaction type for this proposal.
However, this is NOT a conceptual dependency; the included &lt;code&gt;accessList&lt;&#x2F;code&gt; portion of this proposal (the only differential from post-EIP-155 legacy transaction fields) can readily be removed.
Standing on the shoulders of EIP-2930 is only intended to support and further the adoption of next-generation transactions.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;signature-target&quot;&gt;Signature target&lt;&#x2F;h3&gt;
&lt;p&gt;The signature signs over the transaction type as well as the transaction data.
This is done to ensure that the transaction cannot be “re-interpreted” as a transaction of a different type.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;There are no known backward compatibility issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Segment ID&lt;&#x2F;th&gt;&lt;th&gt;Block Number&lt;&#x2F;th&gt;&lt;th&gt;Canonical Block Hash&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;e78b1ec3&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xe78b1ec31bcb535548ce4b6ef384deccad1e7dc599817b65ab5124eeaaee3e58&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;01e78b1ec3&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xe78b1ec31bcb535548ce4b6ef384deccad1e7dc599817b65ab5124eeaaee3e58&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;e4e1c0e78b1ec3&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;15_000_000&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xe78b1ec31bcb535548ce4b6ef384deccad1e7dc599817b65ab5124eeaaee3e58&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;e8d4a50fffe78b1ec3&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;999_999_999_999&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xe78b1ec31bcb535548ce4b6ef384deccad1e7dc599817b65ab5124eeaaee3e58&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;7fffffffffffffffe78b1ec3&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;9223372036854775807&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xe78b1ec31bcb535548ce4b6ef384deccad1e7dc599817b65ab5124eeaaee3e58&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Further test cases, TODO.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-4-bytes-of-a-block-hash-is-safe-enough-for-the-ancestorid&quot;&gt;Why 4 bytes of a block hash is &quot;safe enough&quot; for the &lt;code&gt;ancestorId&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;TL;DR&lt;&#x2F;strong&gt;: The chance of an ineffectual &lt;code&gt;ancestorId&lt;&#x2F;code&gt; is about 1 in between ~4 billion and ~40 billion, with the greater chance for intentional duplication scenarios, eg. malicious reorgs.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;If a collision &lt;em&gt;does&lt;&#x2F;em&gt; happen&lt;&#x2F;strong&gt;, that means the transaction will be valid on both segments (as is the case under the status quo).&lt;&#x2F;p&gt;
&lt;p&gt;Four bytes, instead of the whole hash (32 bytes), was chosen only to reduce the amount of information required to cross the wire to implement this value.
Using the whole hash would result in a &quot;perfectly safe&quot; implementation, and every additional byte reduces the chance of collision exponentially.&lt;&#x2F;p&gt;
&lt;p&gt;The goal of the &lt;code&gt;ancestorId&lt;&#x2F;code&gt; is to disambiguate one chain segment from another, and in doing so, enable a transaction to define with adequate precision which chain it needs to be on.
When a transaction&#x27;s &lt;code&gt;ancestorId&lt;&#x2F;code&gt; references a block, we want to be pretty sure that that reference won&#x27;t get confused with a different block than the one the author of the transaction had in mind.&lt;&#x2F;p&gt;
&lt;p&gt;We assume the trait of collision resistance is uniformly applicable to all possible subsets of the block hash value, so our preference of using the &lt;em&gt;first&lt;&#x2F;em&gt; 4 bytes is arbitrary and functionally equivalent to any other subset of equal length.&lt;&#x2F;p&gt;
&lt;p&gt;For the sake of legibility and accessibility, the following arguments will reference the hex representation of 4 bytes, which is 8 characters in length, eg. &lt;code&gt;e78b1ec3&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The chance of a colliding &lt;code&gt;ancestorId&lt;&#x2F;code&gt; is &lt;code&gt;1&#x2F;(16^8=4_294_967_296)&lt;&#x2F;code&gt; times whatever we take the chance of the existence of an equivalently-numbered block (on an alternative chain) to be. Assuming a generous ballpark chance of 10% (&lt;code&gt;1&#x2F;10&lt;&#x2F;code&gt;) for any given block having a public uncle, this yields &lt;code&gt;(1&#x2F;(16^8=4_294_967_296) * 1&#x2F;10&lt;&#x2F;code&gt;. Note that this ballpark assumes &quot;normal&quot; chain and network behavior. In the case of an enduring competing chain segment, this value rises to 100% (&lt;code&gt;1&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;eligibleminerlist-2&quot;&gt;&lt;code&gt;eligibleMinerList&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Miners who do not find themselves listed in an annotated &lt;code&gt;eligibleMinerList&lt;&#x2F;code&gt; should be expected to immediately remove the transaction from their transaction pool.&lt;&#x2F;p&gt;
&lt;p&gt;In a pessimistic outlook, we should also expect that these ineligible nodes would not offer rebroadcasts of these transactions, potentially impacting the distribution (and availability) of the transactions to their intended miners. On the other hand, miners are incentivized to make themselves available for reception of such transactions, and there are many ways this is feasible both on-network and off-.&lt;&#x2F;p&gt;
&lt;p&gt;The author of a transaction using the &lt;code&gt;eligibleMinerList&lt;&#x2F;code&gt; must assume that the &quot;general availability&quot; of the blockchain state database for such a transaction will be lower than a nonrestrictive transaction (since only a subset of miners will be able to process the transaction).&lt;&#x2F;p&gt;
&lt;p&gt;A final consideration is the economics of a whitelisted miner concerning the processing order of transactions in which they are whitelisted and those without whitelists.
Transactions without whitelists would appear at first glean to be more competitive, and thus should be processed with priority.
However, miners following such a strategy may find their reputation diminished, and, in the worst case, see the assertive preferences of transaction authors shift to their competitors and beyond their reach.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;ineligibleminerlist-2&quot;&gt;&lt;code&gt;ineligibleMinerList&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;In addition to the concerns and arguments presented by &lt;code&gt;eligibleMinerList&lt;&#x2F;code&gt; above, there is a unique concern for &lt;code&gt;ineligibleMinerList&lt;&#x2F;code&gt;: in order for a miner entity to avoid ineligibility by a blacklist, they only need to use an alternative adhoc address as the block beneficiary.
In principle, this is ineluctable.&lt;&#x2F;p&gt;
&lt;p&gt;However, there are associated costs to the &quot;dodging&quot; miner that should be considered.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The creation of an account requires time and energy. But indeed, this work can be done at any convenient time and circumstance. Probably marginal, but non-zero.&lt;&#x2F;li&gt;
&lt;li&gt;The transfer of funds from multiple accounts requires a commensurate number of transactions. Block rewards are applied after transactions are processed, so the miner is unable to simultaneously shift funds from an adhoc account to a target account in the same block they mine (which would otherwise be a &quot;free&quot; transaction).&lt;&#x2F;li&gt;
&lt;li&gt;In using an adhoc address to dodge a blacklist, the miner may also cause their ineligibility from contemporary whitelist transactions.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;validation-costs&quot;&gt;Validation costs&lt;&#x2F;h3&gt;
&lt;p&gt;Miner lists and expiry depend on easily cached and contextually available conditions (ie. the containing block header). The infrastructural overhead costs for enforcing these validations are expected to be nominal.&lt;&#x2F;p&gt;
&lt;p&gt;Validation of &lt;code&gt;ancestorId&lt;&#x2F;code&gt; demands the assertion of a positive database hit by block number (thereby cross-referencing a stored block&#x27;s hash).
This necessary lookup can be (and maybe already is) cached, but we must expect less than 100% hits on cached values, since the lookup value is arbitrary.
With that in mind, however, the value provided to a transaction using a deep &lt;code&gt;ancestorId&lt;&#x2F;code&gt; is increasingly marginal, so we should expect
most transactions using this field to use a relatively small set of common, shallow, cache-friendly values.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;transaction-size-increase&quot;&gt;Transaction size increase&lt;&#x2F;h3&gt;
&lt;p&gt;The proposed additional fields potentially increase transaction size.
The proposed fields are not associated with any gas costs, establishing no protocol-defined economic mitigation for potential spam.
However, transactions which are considered by a miner to be undesirable can be simply dropped from the transaction pool and ignored.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waved via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Interactive NFTs with Modular Environments</title>
        <published>2021-04-18T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Alexi</name><uri>https://github.com/alexi</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5050/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5050-nft-interaction-standard/9922" />
        

        <id>https://wg-eips.ritovision.com/5050/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:5050"
            label="ERC-5050" />
        

        
        

        
        <summary type="html">Action messaging and discovery protocol for interactions on and between NFTs</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5050/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard defines a broadly applicable action messaging protocol for the transmission of user-initiated actions between tokens. Modular statefulness is achieved with optional state controller contracts (i.e. environments) that manage shared state, and provide arbitration and settlement of the action process.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Tokenized item standards such as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;EIP-1155&lt;&#x2F;a&gt; serve as the objects of the Ethereum computing environment. A growing number of projects are seeking to build interactivity and &lt;em&gt;&quot;digital physics&quot;&lt;&#x2F;em&gt; into NFTs, especially in the contexts of gaming and decentralized identity. A standard action messaging protocol will allow this physics layer to be developed in the same open, Ethereum-native way as the objects they operate on.&lt;&#x2F;p&gt;
&lt;p&gt;The messaging protocol outlined defines how an action is initiated and transmitted between tokens and (optional) shared state environments. It is paired with a common interface for defining functionality that allows off-chain services to aggregate and query supported contracts for functionality and interoperability; creating a discoverable, human-readable network of interactive token contracts. Not only can contracts that implement this standard be automatically discovered by such services, their &lt;em&gt;policies for interaction&lt;&#x2F;em&gt; can be as well. This allows clients to easily discover compatible senders and receivers, and allowed actions.&lt;&#x2F;p&gt;
&lt;p&gt;Aggregators can also parse action event logs to derive analytics on new action types, trending&#x2F;popular&#x2F;new interactive contracts, which token and state contract pairs users are likely to interact with, and other discovery tools to facilitate interaction.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;benefits&quot;&gt;Benefits&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;Make interactive token contracts &lt;strong&gt;discoverable and usable&lt;&#x2F;strong&gt; by applications&lt;&#x2F;li&gt;
&lt;li&gt;Create a decentralized &quot;digital physics&quot; layer for gaming and other applications&lt;&#x2F;li&gt;
&lt;li&gt;Provide developers a simple solution with viable validity guarantees to make dynamic NFTs and other tokens&lt;&#x2F;li&gt;
&lt;li&gt;Allow for generalized action bridges to transmit actions between chains (enabling actions on L1 assets to be saved to L2s, L1 assets to interact with L2 assets, and L2 actions to be &quot;rolled-up&quot;&#x2F;finalized on L1).&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;Smart contracts implementing this EIP standard MUST implement the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;EIP-165&lt;&#x2F;a&gt; supportsInterface function and MUST return the constant value &lt;code&gt;true&lt;&#x2F;code&gt; if the &lt;code&gt;IERC5050Sender&lt;&#x2F;code&gt; interface ID &lt;code&gt;0xc8c6c9f3&lt;&#x2F;code&gt; and&#x2F;or the &lt;code&gt;IERC5050Receiver&lt;&#x2F;code&gt; interface ID &lt;code&gt;0x1a3f02f4&lt;&#x2F;code&gt; is passed through the &lt;code&gt;interfaceID&lt;&#x2F;code&gt; argument (depending on which interface(s) the contract implements).&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the interactive object&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token that is interacting (optional)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Object&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; _address&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; selector&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The bytes4(keccack256()) encoding of the action string&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; user&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the sender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The initiating object&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The receiving object&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; state&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The state controller contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Additional data with no specified format&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Action&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes4&lt;&#x2F;span&gt;&lt;span&gt; selector&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; user&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Object from&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Object to&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; EIP-5050 Interactive NFTs with Modular Environments&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5050Sender&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Send an action to the target address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The action&amp;#39;s `fromContract` is automatically set to `address(this)`,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; and the `from` parameter is set to `msg.sender`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; action&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The action to send&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; sendAction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Action&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; action&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check if an action is valid based on its hash and nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; When an action passes through all three possible contracts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; (`fromContract`, `to`, and `state`) the `state` contract validates the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; action with the initiating `fromContract` using a nonced action hash.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This hash is calculated and saved to storage on the `fromContract` before&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; action handling is initiated. The `state` contract calculates the hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; and verifies it and nonce with the `fromContract`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The hash to validate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The nonce to validate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isValid&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _nonce&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieve list of actions that can be sent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Intended for use by off-chain applications to query compatible contracts,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; and to advertise functionality in human-readable form.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; sendableActions&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Change or reaffirm the approved address for an action&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The zero address indicates there is no approved address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  Throws unless `msg.sender` is the `_account`, or an authorized&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  operator of the `_account`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The account of the account-action pair to approve&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _action&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The action of the account-action pair to approve&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The new approved account-action controller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approveForAction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _action&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Enable or disable approval for a third party (&amp;quot;operator&amp;quot;) to conduct&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  all actions on behalf of `msg.sender`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emits the ApprovalForAll event. The contract MUST allow&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  an unbounded number of operators per owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address to add to the set of authorized operators&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; True if the operator is approved, false to revoke approval&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setApprovalForAllActions&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the approved address for an account-action pair&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws if `_tokenId` is not a valid NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The account of the account-action to find the approved address for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _action&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The action of the account-action to find the approved address for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; approved address for this account-action, or the zero address if&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  there is none&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getApprovedForAction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _action&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Query if an address is an authorized operator for another address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address on whose behalf actions are performed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address that acts on behalf of the account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; True&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if `_operator` is an approved operator for `_account`, false otherwise&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isApprovedForAllActions&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when an action is sent (`sendAction()`)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SendAction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _fromContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _toTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when the approved address for an account-action pair&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  is &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; or reaffirmed. The zero address indicates there is no&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  approved address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ApprovalForAction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _action&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when an operator is enabled or disabled for an account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  The operator can conduct all actions on behalf of the account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ApprovalForAllActions&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5050Receiver&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Handle an action&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Both the `to` contract and `state` contract are called via&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `onActionReceived()`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; action&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The action to handle&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onActionReceived&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Action&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; action&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _nonce&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieve list of actions that can be received.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Intended for use by off-chain applications to query compatible contracts,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; and to advertise functionality in human-readable form.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; receivableActions&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when a valid action is received.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ActionReceived&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _fromContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _toTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;action-naming&quot;&gt;Action Naming&lt;&#x2F;h3&gt;
&lt;p&gt;Actions SHOULD use dot-separation for namespacing (e.g. &lt;code&gt;&quot;spells.cast&quot;&lt;&#x2F;code&gt; specifies the &lt;code&gt;&quot;cast&quot;&lt;&#x2F;code&gt; action with namespace &lt;code&gt;&quot;spells&quot;&lt;&#x2F;code&gt;), and arrow-separation for sequence specification (e.g. &lt;code&gt;&quot;settle&amp;gt;build&quot;&lt;&#x2F;code&gt; indicating &lt;code&gt;&quot;settle&quot;&lt;&#x2F;code&gt; must be received before &lt;code&gt;&quot;build&quot;&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;how-state-contracts-work&quot;&gt;How State Contracts Work&lt;&#x2F;h3&gt;
&lt;p&gt;Actions do not require that a state contract be used. Actions can be transmitted from one token contract (&lt;code&gt;Object&lt;&#x2F;code&gt;) to another, or from a user to a single token contract. In these cases, the sending and receiving contracts each control their own state.&lt;&#x2F;p&gt;
&lt;p&gt;State contracts allow arbitrary senders and receivers to share a user-specified state environment. Each &lt;code&gt;Object&lt;&#x2F;code&gt; MAY define its own action handling, which MAY include reading from the state contract during, but the action MUST be finalized by the state contract. This means the state contract serves as ground truth.&lt;&#x2F;p&gt;
&lt;p&gt;The intended workflow is for state contracts to define stateful game environments, typically with a custom &lt;code&gt;IState&lt;&#x2F;code&gt; interface for use by other contracts. &lt;code&gt;Objects&lt;&#x2F;code&gt; register with state contracts to initialize their state. Then, users commit actions using a specific state contract to make things happen in the game.&lt;&#x2F;p&gt;
&lt;p&gt;The modularity of state contracts allows multiple copies of the same or similar &quot;game environment&quot; to be created and swapped in or out by the client. There are many ways this modularity can be used:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Aggregator services can analyze action events to determine likely state contracts for a given sender&#x2F;receiver&lt;&#x2F;li&gt;
&lt;li&gt;Sender&#x2F;receiver contracts can require a specific state contract&lt;&#x2F;li&gt;
&lt;li&gt;Sender&#x2F;receiver contracts can allow any state contract, but set a default. This is important for NFTs that change their render based on state. This default can also be configurable by the token holder.&lt;&#x2F;li&gt;
&lt;li&gt;State contracts can be bridges to state contracts on another chain, allowing for L1-verification, L2-storage usage pattern (validate action with layer-1 assets, save on l2 where storage is cheaper).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;example&quot;&gt;Example&lt;&#x2F;h4&gt;
&lt;p&gt;State Contract &lt;code&gt;FightGame&lt;&#x2F;code&gt; defines a fighting game environment. Token holders call &lt;code&gt;FightGame.register(contract, tokenId)&lt;&#x2F;code&gt; to randomly initialize their stats (strength&#x2F;hp&#x2F;etc.). An account which holds a registered token A of contract &lt;code&gt;Fighters&lt;&#x2F;code&gt;, calls &lt;code&gt;Fighters.sendAction(AttackAction)&lt;&#x2F;code&gt;, specifying token A from &lt;code&gt;Fighters&lt;&#x2F;code&gt; as the sender, token B from &lt;code&gt;Pacifists&lt;&#x2F;code&gt; contract as the receiver, and &lt;code&gt;FightGame&lt;&#x2F;code&gt; as the state contract.&lt;&#x2F;p&gt;
&lt;p&gt;The action is passed to token B, which may handle the action in whatever way it wants before passing the action to the &lt;code&gt;FightGame&lt;&#x2F;code&gt; state contract. The state contract can verify the stored action hash with the &lt;code&gt;Fighters&lt;&#x2F;code&gt; contract to validate the action is authentic before updating the stats if the tokens, dealing damage to token B.&lt;&#x2F;p&gt;
&lt;p&gt;Tokens A and B may update their metadata based on stats in the &lt;code&gt;FightGame&lt;&#x2F;code&gt; state contract, or based on their own stored data updated in response to sending&#x2F;receiving actions.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;extensions&quot;&gt;Extensions&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;interactive&quot;&gt;Interactive&lt;&#x2F;h4&gt;
&lt;p&gt;Some contracts may have custom user interfaces that facilitate interaction.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; EIP-5050 Interactive NFTs with Modular Environments&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC5050Interactive&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; interfaceURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _action&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;action-proxies&quot;&gt;Action Proxies&lt;&#x2F;h4&gt;
&lt;p&gt;Action proxies can be used to support backwards compatibility with non-upgradeable contracts, and potentially for cross-chain action bridging.&lt;&#x2F;p&gt;
&lt;p&gt;They can be implemented using a modified version of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1820&#x2F;#erc-1820-registry-smart-contract&quot;&gt;EIP-1820&lt;&#x2F;a&gt; that allows &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;173&#x2F;&quot;&gt;EIP-173&lt;&#x2F;a&gt; contract owners to call &lt;code&gt;setManager()&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;controllable&quot;&gt;Controllable&lt;&#x2F;h4&gt;
&lt;p&gt;Users of this standard may want to allow trusted contracts to control the action process to provide security guarantees, and support action bridging. Controllers step through the action chain, calling each contract individually in sequence.&lt;&#x2F;p&gt;
&lt;p&gt;Contracts that support Controllers SHOULD ignore require&#x2F;revert statements related to action verification, and MUST NOT pass the action to the next contract in the chain.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; EIP-5050 Action Controller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IControllable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Enable or disable approval for a third party (&amp;quot;controller&amp;quot;) to force&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  handling of a given action without performing EIP-5050 validity checks.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emits the ControllerApproval event. The contract MUST allow&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  an unbounded number of controllers per action.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _controller&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address to add to the set of authorized controllers&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _action&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Selector of the action for which the controller is approved &#x2F; disapproved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; True if the controller is approved, false to revoke approval&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setControllerApproval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _controller&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _action&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Enable or disable approval for a third party (&amp;quot;controller&amp;quot;) to force&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  action handling without performing EIP-5050 validity checks. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emits the ControllerApproval event. The contract MUST allow&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  an unbounded number of controllers per action.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _controller&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address to add to the set of authorized controllers&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; True if the controller is approved, false to revoke approval&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setControllerApprovalForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _controller&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Query if an address is an authorized controller for a given action.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _controller&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The trusted third party address that can force action handling&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _action&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The action selector to query against&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; True&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if `_controller` is an approved operator for `_account`, false otherwise&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isApprovedController&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _controller&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _action&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when a controller is enabled or disabled for the given&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  action. The controller can force `action` handling on the emitting contract, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  bypassing the standard EIP-5050 validity checks.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ControllerApproval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _controller&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _action&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when a controller is enabled or disabled for all actions.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  Disabling all action approval for a controller does not override explicit action&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  action approvals. Controller&amp;#39;s approved for all actions can force action handling &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  on the emitting contract for any action.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ControllerApprovalForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _controller&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;metadata-update&quot;&gt;Metadata Update&lt;&#x2F;h4&gt;
&lt;p&gt;Interactive NFTs are likely to update their metadata in response to certain actions and developers MAY want to implement &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4906&#x2F;&quot;&gt;EIP-4906&lt;&#x2F;a&gt; event emitters.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The critical features of this interactive token standard are that it 1) creates a common way to define, advertise, and conduct object interaction, 2) enables optional, brokered statefulness with &lt;em&gt;useful&lt;&#x2F;em&gt; validity assurances at minimum gas overhead, 3) is easy for developers to implement, and 4) is easy for end-users to use.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;action-names-selectors&quot;&gt;Action Names &amp;amp; Selectors&lt;&#x2F;h3&gt;
&lt;p&gt;Actions are advertised using human-readable strings, and processed using function selectors (&lt;code&gt;bytes4(keccack256(action_key))&lt;&#x2F;code&gt;). Human-readable strings allow end-users to easily interpret functionality, while function selectors allow efficient comparison operations on arbitrarily long action keys. This scheme also allows for simple namespacing and sequence specification.&lt;&#x2F;p&gt;
&lt;p&gt;Off-chain services can easily convert the strings to &lt;code&gt;bytes4&lt;&#x2F;code&gt; selector encoding when interacting with contracts implementing this EIP or parsing &lt;code&gt;SendAction&lt;&#x2F;code&gt; and &lt;code&gt;ActionReceived&lt;&#x2F;code&gt; event logs.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;validation&quot;&gt;Validation&lt;&#x2F;h3&gt;
&lt;p&gt;Validation of the initiating contract via a hash of the action data was satisfactory to nearly everyone surveyed and was the most gas efficient verification solution explored. We recognize that this solution does not allow the receiving and state contracts to validate the initiating &lt;code&gt;user&lt;&#x2F;code&gt; account beyond using &lt;code&gt;tx.origin&lt;&#x2F;code&gt;, which is vulnerable to phishing attacks.&lt;&#x2F;p&gt;
&lt;p&gt;We considered using a signed message to validate user-intiation, but this approach had two major drawbacks:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;UX&lt;&#x2F;strong&gt; users would be required to perform two steps to commit each action (sign the message, and send the transaction)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Gas&lt;&#x2F;strong&gt; performing signature verification is computationally expensive&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Most importantly, the consensus among the developers surveyed is that strict user validation is not necessary because the concern is only that malicious initiating contracts will phish users to commit actions &lt;em&gt;with&lt;&#x2F;em&gt; the malicious contract&#x27;s assets. &lt;strong&gt;This protocol treats the initiating contract&#x27;s token as the prime mover, not the user.&lt;&#x2F;strong&gt; Anyone can tweet at Bill Gates. Any token can send an action to another token. Which actions are accepted, and how they are handled is left up to the contracts. High-value actions can be reputation-gated via state contracts, or access-gated with allow&#x2F;disallow-lists. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5050&#x2F;#controllable&quot;&gt;&lt;code&gt;Controllable&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; contracts can also be used via trusted controllers as an alternative to action chaining.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Alternatives considered: action transmitted as a signed message, action saved to reusable storage slot on initiating contract&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;state-contracts&quot;&gt;State Contracts&lt;&#x2F;h3&gt;
&lt;p&gt;Moving state logic into dedicated, parameterized contracts makes state an action primitive and prevents state management from being obscured within the contracts. Specifically, it allows users to decide which &quot;environment&quot; to commit the action in, and allows the initiating and receiving contracts to share state data without requiring them to communicate.&lt;&#x2F;p&gt;
&lt;p&gt;The specifics of state contract interfaces are outside the scope of this standard, and are intended to be purpose-built for unique interactive environments.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-and-complexity-regarding-action-chaining&quot;&gt;Gas and Complexity (regarding action chaining)&lt;&#x2F;h3&gt;
&lt;p&gt;Action handling within each contract can be arbitrarily complex, and there is no way to eliminate the possibility that certain contract interactions will run out of gas. However, developers SHOULD make every effort to minimize gas usage in their action handler methods, and avoid the use of for-loops.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Alternatives considered: multi-request action chains that push-pull from one contract to the next.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Non-upgradeable, already deployed token contracts will not be compatible with this standard unless a proxy registry extension is used.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;A reference implementation is included in &lt;code&gt;..&#x2F;assets&#x2F;eip-5050&lt;&#x2F;code&gt; with a simple stateless example &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5050&#x2F;.&#x2F;assets&#x2F;ExampleToken2Token.sol&quot;&gt;&lt;code&gt;ExampleToken2Token.sol&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;, and a stateful example &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5050&#x2F;.&#x2F;assets&#x2F;ExampleStateContract.sol&quot;&gt;&lt;code&gt;ExampleStateContract.sol&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The core security consideration of this protocol is action validation. Actions are passed from one contract to another, meaning it is not possible for the receiving contract to natively verify that the caller of the initiating contract matches the &lt;code&gt;action.from&lt;&#x2F;code&gt; address. One of the most important contributions of this protocol is that it provides an alternative to using signed messages, which require users to perform two operations for every action committed.&lt;&#x2F;p&gt;
&lt;p&gt;As discussed in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5050&#x2F;#validation&quot;&gt;Validation&lt;&#x2F;a&gt;, this is viable because the initiating contract &#x2F; token is treated as the prime mover, not the user.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Transaction Data Opcodes</title>
        <published>2021-04-16T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Papageorgiou</name><uri>https://github.com/alex-ppg</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3508/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-draft-transaction-data-opcodes/6017" />
        

        <id>https://wg-eips.ritovision.com/3508/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:3508"
            label="EIP-3508" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3508/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Provide access to original transaction data.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces the following three EVM instructions: &lt;code&gt;ORIGINDATALOAD&lt;&#x2F;code&gt;, &lt;code&gt;ORIGINDATASIZE&lt;&#x2F;code&gt;, and &lt;code&gt;ORIGINDATACOPY&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;These three instructions are meant to provide access to the original transaction&#x27;s &lt;code&gt;data&lt;&#x2F;code&gt; payload, enabling a gas-efficient way of accessing large data payloads in cross-contract calls.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;As the Ethereum development scene matures, more ambitious and complex features are introduced into smart contracts more often than not requiring the utilization of complex and at times large data structures. Given the inherent limits of the EVM, however, transporting large data structures in between contracts is a costly task that can at times lead to even futile scenarios whereby the gas consumption of such an operation is impossible to execute within the gas limit bounds as well as without sacrificing a large chunk of ETH to facilitate its gas cost.&lt;&#x2F;p&gt;
&lt;p&gt;The purpose of this EIP is to render these features viable by introducing a way via which multi-contract systems are able to access the same in-memory data source without necessarily transmitting the full payload between them.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP enables elaborate smart contract features to become part of a larger call-chain by efficiently reading data from the original transaction payload rather than requiring the data to be passed in as call-level data. Its inclusion will mainly benefit advanced trustless schemes to manifest, such as efficient verification of Merkle Patricia trees validating the storage value of a particular Ethereum block or EVM-based layer 2 solutions.&lt;&#x2F;p&gt;
&lt;p&gt;A side-effect of this change is that smart contract systems relying entirely on origin data inherently guarantee that the data they receive has not been malformed by an intermediate smart contract call.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;origindataload-0x47-origindatasize-0x48-and-origindatacopy-0x49&quot;&gt;ORIGINDATALOAD (&lt;code&gt;0x47&lt;&#x2F;code&gt;), ORIGINDATASIZE (&lt;code&gt;0x48&lt;&#x2F;code&gt;) and ORIGINDATACOPY (&lt;code&gt;0x49&lt;&#x2F;code&gt;)&lt;&#x2F;h3&gt;
&lt;p&gt;These instructions are meant to operate similarly to their call-prefixed counterparts with the exception that they instead operate on the original &lt;code&gt;data&lt;&#x2F;code&gt; of a transaction instead of the current call&#x27;s data. In detail:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;ORIGINDATALOAD (&lt;code&gt;0x47&lt;&#x2F;code&gt;) performs similarly to CALLDATALOAD (&lt;code&gt;0x35&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;ORIGINDATASIZE (&lt;code&gt;0x48&lt;&#x2F;code&gt;) performs similarly to CALLDATASIZE (&lt;code&gt;0x36&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;ORIGINDATACOPY (&lt;code&gt;0x49&lt;&#x2F;code&gt;) performs similarly to CALLDATACOPY (&lt;code&gt;0x37&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;As the data is retrieved once again from the execution environment, the costs for the three instructions will be &lt;code&gt;G_verylow&lt;&#x2F;code&gt;, &lt;code&gt;G_base&lt;&#x2F;code&gt; and &lt;code&gt;G_base + G_verylow * (number of words copied, rounded up)&lt;&#x2F;code&gt; respectively.&lt;&#x2F;p&gt;
&lt;p&gt;The transaction data the &lt;code&gt;ORIGINDATA*&lt;&#x2F;code&gt; opcodes operate on will be equivalent to the &lt;code&gt;calldata&lt;&#x2F;code&gt; specified in the &lt;code&gt;args*&lt;&#x2F;code&gt; parameter to the nearest &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt; (&lt;code&gt;0xf7&lt;&#x2F;code&gt;) up the stack.  If there is no &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt; in the stack then &lt;code&gt;ORIGINDATA*&lt;&#x2F;code&gt; will operate on the transaction&#x27;s original &lt;code&gt;data&lt;&#x2F;code&gt; field.&lt;&#x2F;p&gt;
&lt;p&gt;This interaction ensures full compatibility with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3074&#x2F;&quot;&gt;EIP-3074&lt;&#x2F;a&gt; and ensures that no form of discrimination is introduced back into the system by this EIP e.g. by contracts entirely relying on &lt;code&gt;ORIGINDATA*&lt;&#x2F;code&gt; and thus allowing only EOAs to supply data to them.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;authcall-0xf7-interaction&quot;&gt;AUTHCALL (&lt;code&gt;0xf7&lt;&#x2F;code&gt;) Interaction&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3074&#x2F;&quot;&gt;EIP-3074&lt;&#x2F;a&gt; that will be part of the London fork has introduced a new call instruction called &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt; (&lt;code&gt;0xf7&lt;&#x2F;code&gt;) that will replace a transaction&#x27;s &lt;code&gt;ORIGIN&lt;&#x2F;code&gt; (&lt;code&gt;0x32&lt;&#x2F;code&gt;) with the context variable &lt;code&gt;authorized&lt;&#x2F;code&gt;. The intention of &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt; is to prevent discrimination between smart contracts and EOAs which &lt;code&gt;ORIGIN&lt;&#x2F;code&gt; initially facilitated and as a result, it is sensible also replace the values retrieved by the &lt;code&gt;ORIGINDATA*&lt;&#x2F;code&gt; opcodes to the ones used in the &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;naming-conventions&quot;&gt;Naming Conventions&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;ORIGIN&lt;&#x2F;code&gt;-prefixed instructions attempted to conform to the existing naming convention of &lt;code&gt;CALL&lt;&#x2F;code&gt;-prefixed instructions given the existence of the &lt;code&gt;ORIGIN&lt;&#x2F;code&gt; (&lt;code&gt;0x32&lt;&#x2F;code&gt;) instruction which is equivalent to the &lt;code&gt;CALLER&lt;&#x2F;code&gt; (&lt;code&gt;0x33&lt;&#x2F;code&gt;) instruction but on the original transaction&#x27;s context.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;instruction-address-space&quot;&gt;Instruction Address Space&lt;&#x2F;h3&gt;
&lt;p&gt;The instruction address space of the &lt;code&gt;0x30-0x3f&lt;&#x2F;code&gt; has been exhausted by calls that already provide information about the execution context of a call so a new range had to be identified that is suitable for the purposes of the EIP.&lt;&#x2F;p&gt;
&lt;p&gt;Given that the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1344&#x2F;&quot;&gt;EIP-1344&lt;&#x2F;a&gt; &lt;code&gt;CHAINID&lt;&#x2F;code&gt; opcode was included at &lt;code&gt;0x46&lt;&#x2F;code&gt;, it made sense to include additional transaction-related data beyond it since the Chain ID is also included in transaction payloads apart from the blocks themselves, rendering the &lt;code&gt;0x46-0x4f&lt;&#x2F;code&gt; address space reserved for more transaction-related data that may be necessary in the future, such as the EOA&#x27;s nonce.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-costs&quot;&gt;Gas Costs&lt;&#x2F;h3&gt;
&lt;p&gt;The opcodes ORIGINDATALOAD (&lt;code&gt;0x47&lt;&#x2F;code&gt;), ORIGINDATASIZE (&lt;code&gt;0x48&lt;&#x2F;code&gt;), and ORIGINDATACOPY (&lt;code&gt;0x49&lt;&#x2F;code&gt;) essentially perform the same thing as opcodes CALLDATALOAD (&lt;code&gt;0x35&lt;&#x2F;code&gt;), CALLDATASIZE (&lt;code&gt;0x36&lt;&#x2F;code&gt;), and CALLDATACOPY (&lt;code&gt;0x37&lt;&#x2F;code&gt;) respectively and thus share the exact same gas costs.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;instruction-space-pollution&quot;&gt;Instruction Space Pollution&lt;&#x2F;h3&gt;
&lt;p&gt;One can argue that multiple new EVM instructions pollute the EVM instruction address space and could cause issues in assigning sensible instruction codes to future instructions. This particular issue was assessed and a methodology via which the raw RLP encoded transaction may be accessible to the EVM was ideated. This would &lt;em&gt;future-proof&lt;&#x2F;em&gt; the new instruction set as it would be usable for other members of the transaction that may be desired to be accessible on-chain in the future, however, it would also cause a redundancy in the &lt;code&gt;ORIGIN&lt;&#x2F;code&gt; opcode.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The EIP does not alter or adjust existing functionality provided by the EVM and as such, no known issues exist.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TODO.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;introspective-contracts&quot;&gt;Introspective Contracts&lt;&#x2F;h3&gt;
&lt;p&gt;Atomically, the &lt;code&gt;ORIGINDATALOAD&lt;&#x2F;code&gt; and &lt;code&gt;ORIGINDATACOPY&lt;&#x2F;code&gt; values should be considered insecure as they can easily be spoofed by creating an entry smart contract with the appropriate function signature and arguments that consequently invokes other contracts within the call chain. In brief, one should always assume that &lt;code&gt;tx.data != calldata&lt;&#x2F;code&gt; and these instructions should not be used as an introspection tool alone.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;denial-of-service-attack&quot;&gt;Denial-of-Service Attack&lt;&#x2F;h3&gt;
&lt;p&gt;An initial concern that may arise from this EIP is the additional contextual data that must be provided at the software level of nodes to the EVM in order for it to be able to access the necessary data via the &lt;code&gt;ORIGINDATALOAD&lt;&#x2F;code&gt; and &lt;code&gt;ORIGINDATACOPY&lt;&#x2F;code&gt; instructions.&lt;&#x2F;p&gt;
&lt;p&gt;This would lead to an increase in memory consumption, however, this increase should be negligible if at all existent given that the data of a transaction should already exist in memory as part of its execution process; a step in the overall inclusion of a transaction within a block.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;multi-contract-system-gas-reduction&quot;&gt;Multi-Contract System Gas Reduction&lt;&#x2F;h3&gt;
&lt;p&gt;Given that most complex smart contract systems deployed on Ethereum today rely on cross-contract interactions whereby values are passed from one contract to another via function calls, the &lt;code&gt;ORIGIN&lt;&#x2F;code&gt;-prefixed instruction set would enable a way for smart contract systems to acquire access to the original transaction data at any given step in the call chain execution which could result in cross-contract calls ultimately consuming less gas if the data passed between them is reduced as a side-effect of this change.&lt;&#x2F;p&gt;
&lt;p&gt;The gas reduction, however, would be an implementation-based optimization that would also be solely applicable for rudimentary memory arguments rather than storage-based data, the latter of which is most commonly utilized in these types of calls. As a result, the overall gas reduction observed by this change will be negligible for most implementations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Transaction Destination Opcode</title>
        <published>2021-04-16T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Alex Papageorgiou</name><uri>https://github.com/alex-ppg</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3520/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3520-transaction-destination-opcode/6058" />
        

        <id>https://wg-eips.ritovision.com/3520/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:3520"
            label="EIP-3520" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3520/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Provide access to the original recipient of a transaction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces the following EVM instruction: &lt;code&gt;ENTRYPOINT&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This instruction is meant to provide access to the original recipient of the transaction, the &lt;code&gt;to&lt;&#x2F;code&gt; address, enabling new ways of introspection to be applied in conjunction with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3508&#x2F;&quot;&gt;EIP-3508&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;It is undeniable that smart contracts are becoming more interconnected than ever. Up until this point, smart contracts have entirely relied on compliant interfaces and introspection to introduce a new step in the call chain of a complex multi-contract interaction. However, this presents a forwards-only approach which limits the types of interactions that can manifest.&lt;&#x2F;p&gt;
&lt;p&gt;The purpose of this EIP is to provide a way via which a contract is able to identify the entry-point of a transaction on the blockchain and deduce what was the original intention of the transaction by applying introspection on the original transaction data itself.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP enables the development of new types of smart contracts as it can open new pathways for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; NFTs and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;EIP-20&lt;&#x2F;a&gt; tokens to detect which action their transaction is part of, such as detecting a liquidity provision to a decentralized exchange or a loan within a collateralized lending protocol.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;entrypoint-0x4a&quot;&gt;ENTRYPOINT (&lt;code&gt;0x4a&lt;&#x2F;code&gt;)&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;ENTRYPOINT&lt;&#x2F;code&gt; instruction uses 0 stack arguments and pushes the original &lt;code&gt;to&lt;&#x2F;code&gt; member of the transaction onto the stack. The address yielded by the instruction is a 160-bit value padded to 256-bits. The operation costs &lt;code&gt;G_base&lt;&#x2F;code&gt; to execute, similarly to &lt;code&gt;ORIGIN&lt;&#x2F;code&gt; (&lt;code&gt;0x32&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;The address returned by the &lt;code&gt;ENTRYPOINT&lt;&#x2F;code&gt; opcode will be equivalent to the &lt;code&gt;to&lt;&#x2F;code&gt; address parameter specified in the nearest &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt; up the stack.  If there is no &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt; in the stack then &lt;code&gt;ENTRYPOINT&lt;&#x2F;code&gt; will retrieve the original transaction&#x27;s &lt;code&gt;to&lt;&#x2F;code&gt; field.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;authcall-0xf7-interaction&quot;&gt;AUTHCALL (&lt;code&gt;0xf7&lt;&#x2F;code&gt;) Interaction&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3074&#x2F;&quot;&gt;EIP-3074&lt;&#x2F;a&gt; introduced a new call instruction called &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt; (&lt;code&gt;0xf7&lt;&#x2F;code&gt;) that will replace a transaction&#x27;s &lt;code&gt;ORIGIN&lt;&#x2F;code&gt; (&lt;code&gt;0x32&lt;&#x2F;code&gt;) with the context variable &lt;code&gt;authorized&lt;&#x2F;code&gt;. The intention of &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt; is to prevent discrimination between smart contracts and EOAs which &lt;code&gt;ORIGIN&lt;&#x2F;code&gt; initially facilitated. The &lt;code&gt;ENTRYPOINT&lt;&#x2F;code&gt; opcode by itself re-introduces discrimination into the system as it indirectly allows one to evaluate whether the smart contract code being executed is done so by an EOA by validating that &lt;code&gt;ENTRYPOINT == ADDRESS&lt;&#x2F;code&gt; where &lt;code&gt;ADDRESS&lt;&#x2F;code&gt; (&lt;code&gt;0x30&lt;&#x2F;code&gt;) retrieves the currently executing account address. Therefore, it is sensible also replace the values retrieved by the &lt;code&gt;ENTRYPOINT&lt;&#x2F;code&gt; opcode to the target of an &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This interaction ensures full compatibility with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3074&#x2F;&quot;&gt;EIP-3074&lt;&#x2F;a&gt; and ensures that no form of discrimination is introduced back into the system by this EIP.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;naming-conventions&quot;&gt;Naming Conventions&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;ENTRYPOINT&lt;&#x2F;code&gt; instruction came to be by defining a sensible name that immediately and clearly depicts what it is meant to achieve by signaling the first interaction of a particular call, i.e. the entry-point.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;instruction-address-space&quot;&gt;Instruction Address Space&lt;&#x2F;h3&gt;
&lt;p&gt;Equivalent to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3508&#x2F;&quot;&gt;EIP-3508&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-cost&quot;&gt;Gas Cost&lt;&#x2F;h3&gt;
&lt;p&gt;The opcode ENTRYPOINT (&lt;code&gt;0x4a&lt;&#x2F;code&gt;) essentially performs the same thing as the opcode ORIGIN (&lt;code&gt;0x32&lt;&#x2F;code&gt;) and thus shares the exact same gas cost.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;dependency-on-eip-3508&quot;&gt;Dependency on EIP-3508&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;ENTRYPOINT&lt;&#x2F;code&gt; (&lt;code&gt;0x4a&lt;&#x2F;code&gt;) instruction alone has no perceivable benefit as it can be replaced by the &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt; (&lt;code&gt;0xf7&lt;&#x2F;code&gt;) instruction and as such should solely be introduced to the system in conjunction with the &lt;code&gt;ORIGINDATA*&lt;&#x2F;code&gt; opcodes defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3508&#x2F;&quot;&gt;EIP-3508&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The EIP does not alter or adjust existing functionality provided by the EVM and as such, no known issues exist.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TODO.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;introspective-contracts&quot;&gt;Introspective Contracts&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;ENTRYPOINT&lt;&#x2F;code&gt; instruction allows the association of the &lt;code&gt;ORIGINDATALOAD&lt;&#x2F;code&gt; and &lt;code&gt;ORIGINDATACOPY&lt;&#x2F;code&gt; values with a particular smart contract address and interface, enabling introspection to be applied based on the function signature invoked and the arguments provided to reliably deduce the call-path via which a particular smart contract was invoked and allowing a more granular level of interaction to be defined in such special cases.&lt;&#x2F;p&gt;
&lt;p&gt;However, this type of introspection should solely be applied on pre-approved contracts rather than user-defined ones as the value stemming from this type of introspection entirely relies on a contract&#x27;s code immutability and proper function, both of which a user supplied contract can easily bypass.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;caller-discrimination&quot;&gt;Caller Discrimination&lt;&#x2F;h3&gt;
&lt;p&gt;The instructions of this EIP should not be utilized as a way to discriminate between EOA callers and smart contracts, as this type of differentiation can be broken by an &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt; as defined in the specification chapter.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;contract-creation-behaviour&quot;&gt;Contract Creation Behaviour&lt;&#x2F;h3&gt;
&lt;p&gt;The behaviour of the &lt;code&gt;ENTRYPOINT&lt;&#x2F;code&gt; opcode during a contract creation will result in the opcode yielding the zero-address as the first address interacted with in the transaction. This should be taken into account by contract implementations in a similar fashion to how &lt;code&gt;ecrecover&lt;&#x2F;code&gt; invalid signatures are handled to prevent software misbehaviours from arising.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Reduce access list cost</title>
        <published>2021-04-15T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Matt Garnett</name><uri>https://github.com/lightclient</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3521/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3521-reduce-access-list-cost/6072" />
        

        <id>https://wg-eips.ritovision.com/3521/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:3521"
            label="EIP-3521" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3521/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Reduce the cost of declaring &lt;code&gt;tx.to&lt;&#x2F;code&gt; storage keys in access lists.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, a transaction must read at least 25 distinct storage slots in &lt;code&gt;tx.to&lt;&#x2F;code&gt;
before it&#x27;s more expensive to forego an access list.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ACCESS_LIST_ADDRESS_COST + (ACCESS_LIST_STORAGE_KEY_COST + WARM_STORAGE_READ_COST) * x = COLD_SLOAD_COST * x&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;x = 24&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;EIP-2930 requires the address under which the storage keys reside be declared
explicitly, since it must be added to the EIP-2929 &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt; list.
However, &lt;code&gt;tx.to&lt;&#x2F;code&gt; is a special case that is added by default, so paying
&lt;code&gt;ACCESS_LIST_ADDRESS_COST&lt;&#x2F;code&gt; for &lt;code&gt;tx.to&lt;&#x2F;code&gt; is essentially paying twice for the same
address. Avoiding overpayment here will reduce the differential to just 5 unique
reads before using an access list is cheaper -- making them a more attractive
option.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Treat the first occurrence of &lt;code&gt;tx.to&lt;&#x2F;code&gt; in an access list as &lt;code&gt;calldata&lt;&#x2F;code&gt; for gas
accounting purposes. Do not charge &lt;code&gt;ACCESS_LIST_ADDRESS_COST&lt;&#x2F;code&gt; for it. Storage
keys underneath the address are unaffected.&lt;&#x2F;p&gt;
&lt;p&gt;If &lt;code&gt;tx.to == nil&lt;&#x2F;code&gt;, &lt;code&gt;tx.to&lt;&#x2F;code&gt; is defined be the derived contract address created by
the transaction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-charge-at-all&quot;&gt;Why charge at all?&lt;&#x2F;h3&gt;
&lt;p&gt;EIP-2930 is specifically written to make access lists simple to reason about and
validate. It may be possible to modify the structure of the access list to avoid
including &lt;code&gt;tx.to&lt;&#x2F;code&gt; explicitly, but this would renege on the spirit of EIP-2930.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-charge-as-calldata&quot;&gt;Why charge as &lt;code&gt;calldata&lt;&#x2F;code&gt;?&lt;&#x2F;h3&gt;
&lt;p&gt;The cost of &lt;code&gt;calldata&lt;&#x2F;code&gt; was  thoroughly analyzed in EIP-2028 to determine
a fair value that is not susceptible to denial-of-service attacks. We consider
this the lower bound on how much transaction data should cost. Since there is
no computation burden imposed for adding &lt;code&gt;tx.to&lt;&#x2F;code&gt; to the &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt;
map (it&#x27;s added by default by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;), there is no reason to charge more than
the absolute minimum for the data.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;0xffffffffffffffffffffffffffffffffffffffff&amp;quot;: []&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cost = 320&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;0x00ffffffffffffffffffffffffffffffffffffff&amp;quot;: []&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cost = 308&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;0xffffffffffffffffffffffffffffffffffffffff&amp;quot;: []&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;0xffffffffffffffffffffffffffffffffffffffff&amp;quot;: []&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cost = 2720&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;0xffffffffffffffffffffffffffffffffffffffff&amp;quot;: [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;0x00&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;0xffffffffffffffffffffffffffffffffffffffff&amp;quot;: []&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cost = 4620&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;0xffffffffffffffffffffffffffffffffffffffff&amp;quot;: [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;0x00&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;0xffffffffffffffffffffffffffffffffffffffff&amp;quot;: [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;0x00&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cost = 6520&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;None.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Abstract Storage Bonds</title>
        <published>2021-04-05T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Yu Liu</name><uri>https://github.com/yuliu-debond</uri>
	</author>
	
	<author>
		<name>Varun Deshpande</name><uri>https://github.com/dr-chain</uri>
	</author>
	
	<author>
		<name>Cedric Ngakam</name><uri>https://github.com/drikssy</uri>
	</author>
	
	<author>
		<name>Dhruv Malik</name><uri>https://github.com/dhruvmalik007</uri>
	</author>
	
	<author>
		<name>Samuel Gwlanold Edoumou</name><uri>https://github.com/Edoumou</uri>
	</author>
	
	<author>
		<name>Toufic Batrice</name><uri>https://github.com/toufic0710</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3475/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3475-multiple-callable-bonds-standard/8691" />
        

        <id>https://wg-eips.ritovision.com/3475/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:3475"
            label="ERC-3475" />
        

        
        

        
        <summary type="html">Interface for creating tokenized obligations with abstract on-chain metadata storage</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3475/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;This EIP allows the creation of tokenized obligations with abstract on-chain metadata storage. Issuing bonds with multiple redemption data cannot be achieved with existing token standards.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;This EIP enables each bond class ID to represent a new configurable token type and corresponding to each class, corresponding bond nonces to represent an issuing condition or any other form of data in uint256. Every single nonce of a bond class can have its metadata, supply, and other redemption conditions.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Bonds created by this EIP can also be batched for issuance&#x2F;redemption conditions for efficiency on gas costs and UX side. And finally, bonds created from this standard can be divided and exchanged in a secondary market.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Current LP (Liquidity Provider) tokens are simple &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;EIP-20&lt;&#x2F;a&gt; tokens with no complex data structure. To allow more complex reward and redemption logic to be stored on-chain, we need a new token standard that:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Supports multiple token IDs&lt;&#x2F;li&gt;
&lt;li&gt;Can store on-chain metadata&lt;&#x2F;li&gt;
&lt;li&gt;Doesn&#x27;t require a fixed storage pattern&lt;&#x2F;li&gt;
&lt;li&gt;Is gas-efficient.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Also Some benefits:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;This EIP allows the creation of any obligation with the same interface.&lt;&#x2F;li&gt;
&lt;li&gt;It will enable any 3rd party wallet applications or exchanges to read these tokens&#x27; balance and redemption conditions.&lt;&#x2F;li&gt;
&lt;li&gt;These bonds can also be batched as tradeable instruments. Those instruments can then be divided and exchanged in secondary markets.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;Definition&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Bank: an entity that issues, redeems, or burns bonds after getting the necessary amount of liquidity. Generally, a single entity with admin access to the pool.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Functions&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* transferFrom&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; argument is the address of the bond holder whose balance is about to decrease.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; argument is the address of the bond recipient whose balance is about to increase.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _transactions&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the `Transaction[] calldata` (of type [&amp;#39;classId&amp;#39;, &amp;#39;nonceId&amp;#39;, &amp;#39;_amountBonds&amp;#39;]) structure defined in the rationale section below.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; transferFrom MUST have the `isApprovedFor(_from, _to, _transactions[i].classId)` approval to transfer `_from` address to `_to` address for given classId (i.e for Transaction tuple corresponding to all nonces).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;e.g:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* function transferFrom(0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef, 0x82a55a613429Aeb3D01fbE6841bE1AcA4fFD5b2B, [IERC3475.Transaction(1,14,500)]);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* transfer from `_from` address, to `_to` address, `500000000` bonds of type class`1` and nonce `42`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; Transaction&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _transactions&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* transferAllowanceFrom&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; allows the transfer of only those bond types and nonces being allotted to the _to address using allowance().&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the address of the holder whose balance is about to decrease.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the address of the recipient whose balance is about to increase.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _transactions&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the `Transaction[] calldata` structure defined in the section `rationale` below.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; transferAllowanceFrom MUST have the `allowance(_from, msg.sender, _transactions[i].classId, _transactions[i].nonceId)` (where `i` looping for [ 0 ...Transaction.length - 1] ) &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;e.g:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* function transferAllowanceFrom(0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef, 0x82a55a613429Aeb3D01fbE6841bE1AcA4fFD5b2B, [IERC3475.Transaction(1,14,500)]);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* transfer from `_from` address, to `_to` address, `500000000` bonds of type class`1` and nonce `42`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferAllowanceFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; Transaction&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _transactions&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; ;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* issue &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; allows issuing any number of bond types (defined by values in Transaction tuple as param) to an address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; it MUST be issued by a single entity (for instance, a role-based ownable contract that has integration with the liquidity pool of the deposited collateral by `_to` address).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `_to` argument is the address to which the bond will be issued.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `_transactions` is the `Transaction[] calldata` (ie array of issued bond class, bond nonce and amount of bonds to be issued).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; transferAllowanceFrom MUST have the `allowance(_from, msg.sender, _transactions[i].classId, _transactions[i].nonceId)` (where `i` looping for [ 0 ...Transaction.length - 1] ) &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;e.g:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;example: issue(0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef,[IERC3475.Transaction(1,14,500)]);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;issues `1000` bonds with a class of `0` to address `0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef` with a nonce of `5`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; issue&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; Transaction&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _transaction&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* redeem&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; permits redemption of bond from an address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the calling of this function needs to be restricted to the bond issuer contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `_from` is the address from which the bond will be redeemed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `_transactions` is the `Transaction[] calldata` structure (i.e., array of tuples with the pairs of (class, nonce and amount) of the bonds that are to be redeemed). Further defined in the rationale section.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; redeem function for a given class, and nonce category MUST BE done after certain conditions for maturity (can be end time, total active liquidity, etc.) are met. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; furthermore, it SHOULD ONLY be called by the bank or secondary market maker contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;e.g:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* redeem(0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef, [IERC3475.Transaction(1,14,500)]);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;means “redeem from wallet address(0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef), 500000000 of bond class1 and nonce 42.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; redeem&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; Transaction&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _transactions&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* burn&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; permits nullifying of the bonds (or transferring given bonds to address(0)).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; burn function for given class and nonce MUST BE called by only the controller contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the address of the holder whose bonds are about to burn.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `_transactions` is the `Transaction[] calldata` structure (i.e., array of tuple with the pairs of (class, nonce and amount) of the bonds that are to be burned). further defined in the rationale.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; burn function for a given class, and nonce category MUST BE done only after certain conditions for maturity (can be end time, total active liquidity, etc). &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; furthermore, it SHOULD ONLY be called by the bank or secondary market maker contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* e.g:  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* burn(0x82a55a613429Aeb3D01fbE6841bE1AcA4fFD5b2B,[IERC3475.Transaction(1,14,500)]);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* means burning 500000000 bonds of class 1 nonce 42 owned by address 0x82a55a613429Aeb3D01fbE6841bE1AcA4fFD5b2B.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; burn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; Transaction&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _transactions&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* approve&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Allows `_spender` to withdraw from the msg.sender the bonds of `_amount` and type (classId and nonceId).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If this function is called again, it overwrites the current allowance with the amount.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `approve()` should only be callable by the bank, or the owner of the account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `_spender` argument is the address of the user who is approved to transfer the bonds.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `_transactions` is the `Transaction[] calldata` structure (ie array of tuple with the pairs of (class,nonce, and amount) of the bonds that are to be approved to be spend by _spender). Further defined in the rationale section.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* e.g: &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* approve(0x82a55a613429Aeb3D01fbE6841bE1AcA4fFD5b2B,[IERC3475.Transaction(1,14,500)]);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* means owner of address 0x82a55a613429Aeb3D01fbE6841bE1AcA4fFD5b2B is approved to manage 500 bonds from class 1 and Nonce 14.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; Transaction&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _transactions&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* SetApprovalFor&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; enable or disable approval for a third party (“operator”) to manage all the Bonds in the given class of the caller’s bonds.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If this function is called again, it overwrites the current allowance with the amount.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `approve()` should only be callable by the bank or the owner of the account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `_operator` is the address to add to the set of authorized operators.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `classId` is the class id of the bond.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `_approved` is true if the operator is approved (based on the conditions provided), false meaning approval is revoked.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; contract MUST define internal function regarding the conditions for setting approval and should be callable only by bank or owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* e.g: setApprovalFor(0x82a55a613429Aeb3D01fbE6841bE1AcA4fFD5b2B,0,true);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* means that address 0x82a55a613429Aeb3D01fbE6841bE1AcA4fFD5b2B is authorized to transfer bonds from class 0 (across all nonces).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setApprovalFor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approved&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* totalSupply&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Here, total supply includes burned and redeemed supply.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; classId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the corresponding class Id of the bond.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; nonceId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the nonce Id of the given bond class.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; supply of the bonds&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* e.g:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* totalSupply(0, 1);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* it finds the total supply of the bonds of classid 0 and bond nonce 1.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; classId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* redeemedSupply&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the redeemed supply of the bond identified by (classId,nonceId).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; classId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the corresponding class id of the bond.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; nonceId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the nonce id of the given bond class.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; supply of bonds redeemed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; redeemedSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; classId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* activeSupply&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the active supply of the bond defined by (classId,NonceId).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; classId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the corresponding classId of the bond.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; nonceId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the nonce id of the given bond class.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; non-redeemed, active supply. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; activeSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; classId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* burnedSupply&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the burned supply of the bond in defined by (classId,NonceId).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; classId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the corresponding classId of the bond.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; nonceId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the nonce id of the given bond class.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; gets&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the supply of bonds for given classId and nonceId that are already burned.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; burnedSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; classId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* balanceOf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the balance of the bonds (nonReferenced) of given classId and bond nonce held by the address `_account`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; classId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the corresponding classId of the bond.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; nonceId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the nonce id of the given bond class.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address of the owner whose balance is to be determined.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; this also consists of bonds that are redeemed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; classId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* classMetadata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the JSON metadata of the classes.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The metadata SHOULD follow a set of structures explained later in the metadata.md&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; metadataId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the index-id given bond class information.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; JSON metadata of the nonces. — e.g. `[title, type, description]`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; classMetadata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; metadataId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* nonceMetadata &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the JSON metadata of the nonces.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The metadata SHOULD follow a set of structures explained later in metadata.md&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; classId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the corresponding classId of the bond.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; nonceId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the nonce id of the given bond class.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; metadataId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the index of the JSON storage for given metadata information. more is defined in metadata.md.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* @returns the JSON metadata of the nonces. — e.g. `[title, type, description]`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; nonceMetadata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; classId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; metadataId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* classValues&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; allows anyone to read the values (stored in struct Values for different class) for given bond class `classId`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the values SHOULD follow a set of structures as explained in metadata along with correct mapping corresponding to the given metadata structure&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; classId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the corresponding classId of the bond.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; metadataId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the index of the JSON storage for given metadata information of all values of given metadata. more is defined in metadata.md.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* @returns the Values of the class metadata. — e.g. `[string, uint, address]`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; classValues&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; classId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; metadataId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Values&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* nonceValues&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; allows anyone to read the values (stored in struct Values for different class) for given bond (`nonceId`,`classId`).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the values SHOULD follow a set of structures explained in metadata along with correct mapping corresponding to the given metadata structure&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; classId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the corresponding classId of the bond.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; metadataId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the index of the JSON storage for given metadata information of all values of given metadata. More is defined in metadata.md.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* @returns the Values of the class metadata. — e.g. `[string, uint, address]`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; nonceValues&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; classId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonceId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; metadataId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Values&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* getProgress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the parameters to determine the current status of bonds maturity.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the conditions of redemption SHOULD be defined with one or several internal functions. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; classId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the corresponding classId of the bond.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; nonceId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the nonceId of the given bond class . &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* @returns progressAchieved defines the metric (either related to % liquidity, time, etc.) that defines the current status of the bond.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* @returns progressRemaining defines the metric that defines the remaining time&#x2F; remaining progress. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getProgress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; classId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; progressAchieved&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; progressRemaining&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* allowance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Authorizes to set the allowance for given `_spender` by `_owner` for all bonds identified by (classId, nonceId).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address of the owner of bond(and also msg.sender).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the address authorized to spend the bonds held by _owner of info (classId, nonceId).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; classId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the corresponding classId of the bond.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; nonceId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the nonceId of the given bond class. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the _amount which spender is still allowed to withdraw from _owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; allowance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; classId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* isApprovedFor&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; returns true if address _operator is approved for managing the account’s bonds class.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Queries the approval status of an operator for a given owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; _owner is the owner of bonds. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; _operator is the EOA &#x2F;contract, whose status for approval on bond class for this approval is checked.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* @returns “true” if the operator is approved, “false” if not.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isApprovedFor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;events&quot;&gt;Events&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* Issue&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Issue MUST trigger when Bonds are issued. This SHOULD not include zero value Issuing.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This SHOULD not include zero value issuing.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Issue MUST be triggered when the operator (i.e Bank address) contract issues bonds to the given entity.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* eg: emit Issue(_operator, 0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef,[IERC3475.Transaction(1,14,500)]); &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* issue by address(operator) 500 Bonds(nonce14,class 1) to address 0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Issue&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;Transaction&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _transactions&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* Redeem&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Redeem MUST trigger when Bonds are redeemed. This SHOULD not include zero value redemption.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*e.g: emit Redeem(0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef,0x492Af743654549b12b1B807a9E0e8F397E44236E,[IERC3475.Transaction(1,14,500)]);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* emit event when 5000 bonds of class 1, nonce 14 owned by address 0x492Af743654549b12b1B807a9E0e8F397E44236E are being redeemed by 0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Redeem&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;Transaction&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _transactions&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* Burn.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `Burn` MUST trigger when the bonds are being redeemed via staking (or being invalidated) by the bank contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `Burn` MUST trigger when Bonds are burned. This SHOULD not include zero value burning.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* e.g : emit Burn(0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef,0x492Af743654549b12b1B807a9E0e8F397E44236E,[IERC3475.Transaction(1,14,500)]);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* emits event when 500 bonds of owner 0x492Af743654549b12b1B807a9E0e8F397E44236E of type (class 1, nonce 14) are burned by operator  0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; burn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;Transaction&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _transactions&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* Transfer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; its emitted when the bond is transferred by address(operator) from owner address(_from) to address(_to) with the bonds transferred, whose params are defined by _transactions struct array. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfer MUST trigger when Bonds are transferred. This SHOULD not include zero value transfers.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfer event with the _from `0x0` MUST not create this event(use `event Issued` instead). &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* e.g  emit Transfer(0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef, 0x492Af743654549b12b1B807a9E0e8F397E44236E, _to, [IERC3475.Transaction(1,14,500)]);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* transfer by address(_operator) amount 500 bonds with (Class 1 and Nonce 14) from 0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef, to address(_to).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;Transaction&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _transactions&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* ApprovalFor&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; its emitted when address(_owner) approves the address(_operator) to transfer his bonds.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Approval MUST trigger when bond holders are approving an _operator. This SHOULD not include zero value approval. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* eg: emit ApprovalFor(0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef, 0x492Af743654549b12b1B807a9E0e8F397E44236E, true);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* this means 0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef gives 0x492Af743654549b12b1B807a9E0e8F397E44236E access permission for transfer of its bonds.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ApprovalFor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Metadata&lt;&#x2F;strong&gt;:
The metadata of a bond class or nonce is stored as an array of JSON objects, represented by the following types.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;NOTE: all of the metadata schemas are referenced from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3475&#x2F;assets&#x2F;Metadata&#x2F;&quot;&gt;here&lt;&#x2F;a&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;1-description&quot;&gt;1. Description:&lt;&#x2F;h3&gt;
&lt;p&gt;This defines the additional information about the nature of data being stored in the nonce&#x2F;class metadata structures. They are defined using the structured explained &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3475&#x2F;assets&#x2F;Metadata&#x2F;#1-description-metadata&quot;&gt;here&lt;&#x2F;a&gt;. this will then be used by the frontend of the respective entities participating in the bond markets to interpret the data which is compliant with their jurisdiction.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;2-nonce&quot;&gt;2. Nonce:&lt;&#x2F;h3&gt;
&lt;p&gt;The key value for indexing the information is the &#x27;class&#x27; field. Following are the rules:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The title can be any alphanumeric type that is differentiated by the description of metadata (although it can be dependent on certain jurisdictions).&lt;&#x2F;li&gt;
&lt;li&gt;The title SHOULD not be EMPTY.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Some specific examples of metadata can be the localization of bonds, jurisdiction details etc., and they can be found in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3475&#x2F;assets&#x2F;Metadata&#x2F;&quot;&gt;metadata.md&lt;&#x2F;a&gt; example description.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;3-class-metadata&quot;&gt;3. Class metadata:&lt;&#x2F;h3&gt;
&lt;p&gt;This structure defines the details of the class information (symbol, risk information, etc.). the example is explained &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3475&#x2F;assets&#x2F;Metadata&#x2F;&quot;&gt;here&lt;&#x2F;a&gt; in the class metadata section.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;4-decoding-data&quot;&gt;4. Decoding data&lt;&#x2F;h3&gt;
&lt;p&gt;First, the functions for analyzing the metadata (i.e &lt;code&gt;ClassMetadata&lt;&#x2F;code&gt; and &lt;code&gt;NonceMetadata&lt;&#x2F;code&gt;) are to be used by the corresponding frontend to decode the information of the bond.&lt;&#x2F;p&gt;
&lt;p&gt;This is done via overriding the function interface for functions &lt;code&gt;classValues&lt;&#x2F;code&gt; and &lt;code&gt;nonceValues&lt;&#x2F;code&gt; by defining the key (which SHOULD be an index) to read the corresponding information stored as a JSON object.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;symbol&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;defines the unique identifier name in following format: (symbol, bondType, maturity in months)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;values&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Class Name 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Class Name 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;DBIT Fix 6M&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;e.g. In the above example, to get the &lt;code&gt;symbol&lt;&#x2F;code&gt; of the given class id, we can use the class id as a key to get the &lt;code&gt;symbol&lt;&#x2F;code&gt; value in the values, which then can be used for fetching the detail for instance.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;metadata-structure&quot;&gt;Metadata structure&lt;&#x2F;h3&gt;
&lt;p&gt;Instead of storing the details about the class and their issuances to the user (ie nonce) externally, we store the details in the respective structures. Classes represent the different bond types, and nonces represent the various period of issuances. Nonces under the same class share the same metadata. Meanwhile, nonces are non-fungible. Each nonce can store a different set of metadata. Thus, upon transfer of a bond, all the metadata will be transferred to the new owner of the bond.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Values&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt; stringValue&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span&gt; uintValue&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt; addressValue&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt; boolValue&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt; bytesValue&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Metadata&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt; title&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt; _type&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt; description&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;batch-function&quot;&gt;Batch function&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP supports batch operations. It allows the user to transfer different bonds along with their metadata to a new address instantaneously in a single transaction. After execution, the new owner holds the right to reclaim the face value of each of the bonds. This mechanism helps with the &quot;packaging&quot; of bonds–helpful in use cases like trades on a secondary market.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transaction&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt; classId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt; nonceId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Where:
The &lt;code&gt;classId&lt;&#x2F;code&gt; is the class id of the bond.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;nonceId&lt;&#x2F;code&gt; is the nonce id of the given bond class. This param is for distinctions of the issuing conditions of the bond.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;_amount&lt;&#x2F;code&gt; is the amount of the bond for which the spender is approved.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;amm-optimization&quot;&gt;AMM optimization&lt;&#x2F;h3&gt;
&lt;p&gt;One of the most obvious use cases of this EIP is the multilayered pool. The early version of AMM uses a separate smart contract and an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;EIP-20&lt;&#x2F;a&gt; LP token to manage a pair. By doing so, the overall liquidity inside of one pool is significantly reduced and thus generates unnecessary gas spent and slippage. Using this EIP standard, one can build a big liquidity pool with all the pairs inside (thanks to the presence of the data structures consisting of the liquidity corresponding to the given class and nonce of bonds). Thus by knowing the class and nonce of the bonds, the liquidity can be represented as the percentage of a given token pair for the owner of the bond in the given pool. Effectively, the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;EIP-20&lt;&#x2F;a&gt; LP token (defined by a unique smart contract in the pool factory contract) is aggregated into a single bond and consolidated into a single pool.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The reason behind the standard&#x27;s name (abstract storage bond) is its ability to store all the specifications (metadata&#x2F;values and transaction as defined in the following sections) without needing external storage on-chain&#x2F;off-chain.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Any contract that inherits the interface of this EIP is compatible. This compatibility exists for issuer and receiver of the bonds. Also any client EOA wallet can be compatible with the standard if they are able to sign &lt;code&gt;issue()&lt;&#x2F;code&gt; and &lt;code&gt;redeem()&lt;&#x2F;code&gt; commands.&lt;&#x2F;p&gt;
&lt;p&gt;However, any existing &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;EIP-20&lt;&#x2F;a&gt; token contract can issue its bonds by delegating the minting role to a bank contract with the interface of this standard built-in. Check out our reference implementation for the correct interface definition.&lt;&#x2F;p&gt;
&lt;p&gt;To ensure the indexing of transactions throughout the bond lifecycle (i.e &quot;Issue&quot;, &quot;Redeem&quot; and &quot;Transfer&quot; functions), events cited in specification section MUST be emitted when such transaction is passed.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Note that the this standard interface is also compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;EIP-20&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;EIP-1155&lt;&#x2F;a&gt;interface.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;However, creating a separate bank contract is recommended for reading the bonds and future upgrade needs.&lt;&#x2F;p&gt;
&lt;p&gt;Acceptable collateral can be in the form of fungible (like &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;EIP-20&lt;&#x2F;a&gt;), non-fungible (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;EIP-1155&lt;&#x2F;a&gt;) , or other bonds represented by this standard.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test-case for the minimal reference implementation is &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3475&#x2F;.&#x2F;assets&#x2F;ERC3475.test.ts&quot;&gt;here&lt;&#x2F;a&gt;. Use the Truffle box to compile and test the contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3475&#x2F;.&#x2F;assets&#x2F;interfaces&#x2F;IERC3475.sol&quot;&gt;Interface&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3475&#x2F;.&#x2F;assets&#x2F;ERC3475.sol&quot;&gt;Basic Example&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;This demonstration shows only minimalist implementation.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;function setApprovalFor(address _operatorAddress)&lt;&#x2F;code&gt; gives the operator role to &lt;code&gt;_operatorAddress&lt;&#x2F;code&gt;. It has all the permissions to transfer, burn and redeem bonds by default.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;If the owner wants to give a one-time allocation to an address for specific bonds(classId,bondsId), he should call the &lt;code&gt;function approve()&lt;&#x2F;code&gt; giving the &lt;code&gt;Transaction[]&lt;&#x2F;code&gt; allocated rather than approving all the classes using &lt;code&gt;setApprovalFor&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>SUDO Opcode</title>
        <published>2021-04-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>William Morriss</name><uri>https://github.com/wjmelements</uri>
	</author>
	
	<author>
		<name>Baptiste Vauthey</name><uri>https://github.com/thabaptiser</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3455/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3455-sudo-opcode/5860" />
        

        <id>https://wg-eips.ritovision.com/3455/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:3455"
            label="EIP-3455" />
        

        
        

        
        <summary type="html">A new opcode is introduced to allow calling from an arbitrary sender address.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3455/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;A new opcode, &lt;code&gt;SUDO&lt;&#x2F;code&gt;, is introduced with the same parameters as &lt;code&gt;CALL&lt;&#x2F;code&gt;, plus another parameter to specify the sender address.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;There are many use cases for being able to set the sender.&lt;&#x2F;p&gt;
&lt;p&gt;Many tokens are stuck irretrievably because nobody has the key for the owner address.
In particular, at address zero there is approximately 17 billion USD in tokens and ether, according to etherscan.
With &lt;code&gt;SUDO&lt;&#x2F;code&gt;, anyone could free that value, leading to an economic boom that would end poverty and world hunger.
Instead it is sitting there idle like the gold in Fort Knox.
&lt;code&gt;SUDO&lt;&#x2F;code&gt; fixes this.&lt;&#x2F;p&gt;
&lt;p&gt;It is a common mistake to send &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens to the token address instead of the intended recipient.
This happens because users paste the token address into the recipient fields.
Currently there is no way to recover these tokens.
&lt;code&gt;SUDO&lt;&#x2F;code&gt; fixes this.&lt;&#x2F;p&gt;
&lt;p&gt;Many scammers have fraudulently received tokens and ETH via trust-trading.
Their victims currently have no way to recover their funds.
&lt;code&gt;SUDO&lt;&#x2F;code&gt; fixes this.&lt;&#x2F;p&gt;
&lt;p&gt;Large amounts of users have accidentally locked up tokens and ether by losing their private keys.
This is inefficient and provides a bad user experience.
To accommodate new and inexperienced users, there needs to be a way to recover funds after the private key has been lost.
&lt;code&gt;SUDO&lt;&#x2F;code&gt; fixes this.&lt;&#x2F;p&gt;
&lt;p&gt;Finally, there are many tokens and ether sitting in smart contracts locked due to a bug.
We could finally close EIP issue #156.
We cannot currently reclaim ether from stuck accounts.
&lt;code&gt;SUDO&lt;&#x2F;code&gt; fixes this.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Adds a new opcode (&lt;code&gt;SUDO&lt;&#x2F;code&gt;) at &lt;code&gt;0xf8&lt;&#x2F;code&gt;.
&lt;code&gt;SUDO&lt;&#x2F;code&gt; pops 8 parameters from the stack.
Besides the sender parameter, the parameters shall match &lt;code&gt;CALL&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Gas: Integer; Maximum gas allowance for message call, safely using current gas counter if the counter is lower&lt;&#x2F;li&gt;
&lt;li&gt;Sender: Address, truncated to lower 40 bytes; Sets &lt;code&gt;CALLER&lt;&#x2F;code&gt; inside the call frame&lt;&#x2F;li&gt;
&lt;li&gt;To: Address, truncated to lower 40 bytes; sets &lt;code&gt;ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Value: Integer, raises exception amount specified is less than the value in Sender account; transferred with call to recipient balance, sets &lt;code&gt;CALLVALUE&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;InStart: Integer; beginning of memory to use for &lt;code&gt;CALLDATA&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;InSize: Integer; length of memory to use for &lt;code&gt;CALLDATA&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;OutStart: Integer; beginning of memory to replace with &lt;code&gt;RETURNDATA&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;OutSize: Integer; maximum &lt;code&gt;RETURNDATA&lt;&#x2F;code&gt; to place in memory&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Following execution, &lt;code&gt;SUDO&lt;&#x2F;code&gt; pushes a result value to the stack, indicating success or failure.
If the call ended with &lt;code&gt;STOP&lt;&#x2F;code&gt;, &lt;code&gt;RETURN&lt;&#x2F;code&gt;, or &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;, &lt;code&gt;1&lt;&#x2F;code&gt; is pushed.
If the call ended with &lt;code&gt;REVERT&lt;&#x2F;code&gt;, &lt;code&gt;INVALID&lt;&#x2F;code&gt;, or an EVM assertion, &lt;code&gt;0&lt;&#x2F;code&gt; is pushed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;GAS&lt;&#x2F;code&gt; parameter is first so that callers can tediously compute how much of their remaining gas to send at the last possible moment.
The remaining parameters inherited from &lt;code&gt;CALL&lt;&#x2F;code&gt; are in the same order, with sender inserted between.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;It will be fine.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>MetaProxy Standard</title>
        <published>2021-03-29T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>pinkiebell</name><uri>https://github.com/pinkiebell</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3448/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-3448-metaproxy-factory/5834" />
        

        <id>https://wg-eips.ritovision.com/3448/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:3448"
            label="ERC-3448" />
        

        
        

        
        <summary type="html">A minimal bytecode implementation for creating proxy contracts with immutable metadata attached to the bytecode</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3448/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;By standardizing on a known minimal bytecode proxy implementation with support for immutable metadata, this standard allows users and third party tools (e.g. Etherscan) to:
(a) simply discover that a contract will always redirect in a known manner and
(b) depend on the behavior of the code at the destination contract as the behavior of the redirecting contract and
(c) verify&#x2F;view the attached metadata.&lt;&#x2F;p&gt;
&lt;p&gt;Tooling can interrogate the bytecode at a redirecting address to determine the location of the code that will run along with the associated metadata - and can depend on representations about that code (verified source, third-party audits, etc).
This implementation forwards all calls via &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; and any (calldata) input plus the metadata at the end of the bytecode to the implementation contract and then relays the return value back to the caller.
In the case where the implementation reverts, the revert is passed back along with the payload data.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This standard supports use-cases wherein it is desirable to clone exact contract functionality with different parameters at another address.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The exact bytecode of the MetaProxy contract is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                              20 bytes target contract address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                          ----------------------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;363d3d373d3d3d3d60368038038091363936013d7300000000000000000000000000000000000000005af43d3d93803e603457fd5bf3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;wherein the bytes at indices 21 - 41 (inclusive) are replaced with the 20 byte address of the master functionality contract.
Additionally, everything after the MetaProxy bytecode can be arbitrary metadata and the last 32 bytes (one word) of the bytecode must indicate the length of the metadata in bytes.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;54 bytes metaproxy&amp;gt; &amp;lt;arbitrary data&amp;gt; &amp;lt;length in bytes of arbitrary data (uint256)&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The goals of this effort have been the following:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;a cheap way of storing immutable metadata for each child instead of using storage slots&lt;&#x2F;li&gt;
&lt;li&gt;inexpensive deployment of clones&lt;&#x2F;li&gt;
&lt;li&gt;handles error return bubbling for revert messages&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;There are no backwards compatibility issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Tested with:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;invocation with no arguments&lt;&#x2F;li&gt;
&lt;li&gt;invocation with arguments&lt;&#x2F;li&gt;
&lt;li&gt;invocation with return values&lt;&#x2F;li&gt;
&lt;li&gt;invocation with revert (confirming reverted payload is transferred)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;A solidity contract with the above test cases can be found &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3448&#x2F;.&#x2F;assets&#x2F;MetaProxyTest.sol&quot;&gt;in the EIP asset directory&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;A reference implementation can be found &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3448&#x2F;.&#x2F;assets&#x2F;MetaProxyFactory.sol&quot;&gt;in the EIP asset directory&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;deployment-bytecode&quot;&gt;Deployment bytecode&lt;&#x2F;h3&gt;
&lt;p&gt;A annotated version of the deploy bytecode:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; PUSH1 11;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; CODESIZE;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; SUB;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; DUP1;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; PUSH1 11;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; RETURNDATASIZE;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; CODECOPY;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; RETURNDATASIZE;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; RETURN;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;metaproxy&quot;&gt;MetaProxy&lt;&#x2F;h3&gt;
&lt;p&gt;A annotated version of the MetaProxy bytecode:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; copy args&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; CALLDATASIZE;   calldatasize&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; RETURNDATASIZE; 0, calldatasize&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; RETURNDATASIZE; 0, 0, calldatasize&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; CALLDATACOPY;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; RETURNDATASIZE; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; RETURNDATASIZE; 0, 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; RETURNDATASIZE; 0, 0, 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; RETURNDATASIZE; 0, 0, 0, 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; PUSH1 54;       54, 0, 0, 0, 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; DUP1;           54, 54, 0, 0, 0, 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; CODESIZE;       codesize, 54, 54, 0, 0, 0, 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; SUB;            codesize-54, 54, 0, 0, 0, 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; DUP1;           codesize-54, codesize-54, 54, 0, 0, 0, 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; SWAP2;          54, codesize-54, codesize-54, 0, 0, 0, 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; CALLDATASIZE;   calldatasize, 54, codesize-54, codesize-54, 0, 0, 0, 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; CODECOPY;       codesize-54, 0, 0, 0, 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; CALLDATASIZE;   calldatasize, codesize-54, 0, 0, 0, 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; ADD;            calldatasize+codesize-54, 0, 0, 0, 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; RETURNDATASIZE; 0, calldatasize+codesize-54, 0, 0, 0, 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; PUSH20 0;       addr, 0, calldatasize+codesize-54, 0, 0, 0, 0 - zero is replaced with shl(96, address())&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; GAS;            gas, addr, 0, calldatasize+codesize-54, 0, 0, 0, 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; DELEGATECALL;   (gas, addr, 0, calldatasize() + metadata, 0, 0) delegatecall to the target contract;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; RETURNDATASIZE; returndatasize, retcode, 0, 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; RETURNDATASIZE; returndatasize, returndatasize, retcode, 0, 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; SWAP4;          0, returndatasize, retcode, 0, returndatasize&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; DUP1;           0, 0, returndatasize, retcode, 0, returndatasize&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; RETURNDATACOPY; (0, 0, returndatasize) - Copy everything into memory that the call returned&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; stack = retcode, 0, returndatasize # this is for either revert(0, returndatasize()) or return (0, returndatasize())&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; PUSH1 _SUCCESS_; push jumpdest of _SUCCESS_&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; JUMPI;          jump if delegatecall returned `1`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; REVERT;         (0, returndatasize()) if delegatecall returned `0`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; JUMPDEST _SUCCESS_;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; RETURN;         (0, returndatasize()) if delegatecall returned non-zero (1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;examples&quot;&gt;Examples&lt;&#x2F;h3&gt;
&lt;p&gt;The following code snippets serve only as suggestions and are not a discrete part of this standard.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;proxy-construction-with-bytes-from-abi-encode&quot;&gt;Proxy construction with bytes from abi.encode&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MetaProxy construction via abi encoded bytes.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; createFromBytes&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; a&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; b&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; proxy&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; creates a new proxy where the metadata is the result of abi.encode()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  proxy &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; MetaProxyFactory&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_metaProxyFromBytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;a&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; b&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; c&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;proxy &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; optional one-time setup, a constructor() substitute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  MyContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;proxy&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;init&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;value &lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;proxy-construction-with-bytes-from-calldata&quot;&gt;Proxy construction with bytes from calldata&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MetaProxy construction via calldata.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; createFromCalldata&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; a&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; b&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; proxy&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; creates a new proxy where the metadata is everything after the 4th byte from calldata.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  proxy &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; MetaProxyFactory&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_metaProxyFromCalldata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;proxy &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; optional one-time setup, a constructor() substitute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  MyContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;proxy&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;init&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;value &lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;retrieving-the-metadata-from-calldata-and-abi-decode&quot;&gt;Retrieving the metadata from calldata and abi.decode&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the metadata of this (MetaProxy) contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Only relevant with contracts created via the MetaProxy standard.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function is aimed to be invoked with- &amp;amp; without a call.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getMetadataWithoutCall&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; a&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; b&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span&gt; posOfMetadataSize &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; sub&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;calldatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span&gt; size &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calldataload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;posOfMetadataSize&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span&gt; dataPtr &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; sub&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;posOfMetadataSize&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; size&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    data &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;64&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; increment free memory pointer by metadata size + 32 bytes (length)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    mstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;64&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;size&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    mstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; size&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span&gt; memPtr &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    calldatacopy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;memPtr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; dataPtr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; size&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;decode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;retrieving-the-metadata-via-a-call-to-self&quot;&gt;Retrieving the metadata via a call to self&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the metadata of this (MetaProxy) contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Only relevant with contracts created via the MetaProxy standard.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function is aimed to be invoked via a call.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getMetadataViaCall&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; a&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; b&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span&gt; posOfMetadataSize &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; sub&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;calldatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span&gt; size &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calldataload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;posOfMetadataSize&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span&gt; dataPtr &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; sub&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;posOfMetadataSize&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; size&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    calldatacopy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; dataPtr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; size&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; size&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Apart from the examples above, it is also possible to use Solidity Structures or any custom data encoding.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This standard only covers the bytecode implementation and does not include any serious side effects of itself.
The reference implementation only serves as a example. It is highly recommended to research side effects depending on how the functionality is used and implemented in any project.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Standardized Shamir Secret Sharing Scheme for BIP-39 Mnemonics</title>
        <published>2021-03-29T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Daniel Streit</name><uri>https://github.com/danielstreit</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3450/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-3450-standard-for-applying-shamirs-to-bip-39-mnemonics/5844" />
        

        <id>https://wg-eips.ritovision.com/3450/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:3450"
            label="ERC-3450" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3450/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;A standardized algorithm for applying Shamir&#x27;s Secret Sharing Scheme to BIP-39 mnemonics.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;A standardized approach to splitting a BIP-39 mnemonic into &lt;em&gt;N&lt;&#x2F;em&gt; BIP-39 mnemonics, called shares, so that &lt;em&gt;T&lt;&#x2F;em&gt; shares are required to recover the original mnemonic and no information about the original mnemonic, other than its size, is leaked with less than &lt;em&gt;T&lt;&#x2F;em&gt; shares.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;We&#x27;d like to make it easier for less-technical users to store keys securely.&lt;&#x2F;p&gt;
&lt;p&gt;Currently, many users use BIP-39 mnemonics to store entropy values underlying their keys. These mnemonics are a single point of failure. If lost, the user may never regain access to the assets locked by the keys. If stolen, a malicious actor can steal the assets.&lt;&#x2F;p&gt;
&lt;p&gt;Shamir&#x27;s Secret Sharing Scheme addresses this concern directly. It creates &quot;shares&quot; of the secret, such that a subset can be used to recover the secret, but only if a minimum threshold of shares is reached. Without the minimum, no information about the original secret is leaked.&lt;&#x2F;p&gt;
&lt;p&gt;One concern with Shamir&#x27;s Secret Sharing Scheme is there is no canonical, standard implementation. This puts recovery at risk, as tooling may change over time.&lt;&#x2F;p&gt;
&lt;p&gt;Here, we propose a standardized implementation of Shamir&#x27;s Secret Sharing Scheme applied specifically to BIP-39 mnemonics, so users can easily create shares of their mnemonic, destroy the original, store the shares appropriately, and confidently recover the original mnemonic at a later date.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;shamir-s-secret-sharing-scheme&quot;&gt;Shamir&#x27;s Secret Sharing Scheme&lt;&#x2F;h3&gt;
&lt;p&gt;Shamir&#x27;s Secret Sharing Scheme is a cryptographic method to split a secret into &lt;em&gt;N&lt;&#x2F;em&gt; unique parts, where any &lt;em&gt;T&lt;&#x2F;em&gt; of them are required to reconstruct the secret.&lt;&#x2F;p&gt;
&lt;p&gt;First, a polynomial &lt;em&gt;f&lt;&#x2F;em&gt; of degree &lt;em&gt;T&lt;&#x2F;em&gt; − 1 is constructed. Then, each share is a point on the polynomial&#x27;s curve: an integer &lt;em&gt;x&lt;&#x2F;em&gt;, and its corresponding &lt;em&gt;y&lt;&#x2F;em&gt; point &lt;em&gt;f&lt;&#x2F;em&gt;(&lt;em&gt;x&lt;&#x2F;em&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;With any set of &lt;em&gt;T&lt;&#x2F;em&gt; shares (or points), the initial polynomial can be recovered using polynomial interpolation.&lt;&#x2F;p&gt;
&lt;p&gt;When constructing the initial polynomial, the secret is stored as the coefficient of x&lt;sup&gt;0&lt;&#x2F;sup&gt; and the rest of the coefficients are randomly generated.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;bip-39-mnemonics&quot;&gt;BIP-39 Mnemonics&lt;&#x2F;h3&gt;
&lt;p&gt;BIP-39 is a common standard for storing entropy as a list of words. It is easier to work with for human interactions than raw binary or hexadecimal representations of entropy.&lt;&#x2F;p&gt;
&lt;p&gt;BIP-39 mnemonics encode two pieces of data: the original entropy and a checksum of that entropy. The checksum allows the mnemonic to be validated, ensuring that the user entered it correctly.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;generating-the-mnemonic&quot;&gt;Generating the Mnemonic&lt;&#x2F;h4&gt;
&lt;p&gt;The mnemonic must encode entropy in a multiple of 32 bits. With more entropy security is improved but the sentence length increases. We refer to the initial entropy length as ENT. The allowed size of ENT is 128-256 bits.&lt;&#x2F;p&gt;
&lt;p&gt;First, an initial entropy of ENT bits is generated. A checksum is generated by taking the first &lt;code&gt;ENT &#x2F; 32&lt;&#x2F;code&gt; bits of its SHA256 hash. This checksum is appended to the end of the initial entropy. Next, these concatenated bits are split into groups of 11 bits, each encoding a number from 0-2047, serving as an index into a word list. Finally, we convert these numbers into words and use the joined words as a mnemonic sentence.&lt;&#x2F;p&gt;
&lt;p&gt;The following table describes the relation between the initial entropy length (ENT), the checksum length (CS), and the length of the generated mnemonic sentence (MS) in words.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CS = ENT &#x2F; 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;MS = (ENT + CS) &#x2F; 11&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|  ENT  | CS | ENT+CS |  MS  |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+-------+----+--------+------+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|  128  |  4 |   132  |  12  |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|  160  |  5 |   165  |  15  |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|  192  |  6 |   198  |  18  |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|  224  |  7 |   231  |  21  |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|  256  |  8 |   264  |  24  |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;recovering-the-entropy&quot;&gt;Recovering the Entropy&lt;&#x2F;h4&gt;
&lt;p&gt;The initial entropy can be recovered by reversing the process above. The mnemonic is converted to bits, where each word is converted to 11 bits representing its index in the word list. The entropy portion is defined in the table above, based on the size of the mnemonic.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;word-list&quot;&gt;Word List&lt;&#x2F;h4&gt;
&lt;p&gt;This specification only supports the BIP-39 English word list, but this may be expanded in the future.&lt;&#x2F;p&gt;
&lt;p&gt;See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3450&#x2F;.&#x2F;assets&#x2F;wordlist.txt&quot;&gt;word list&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;applying-shamir-s-scheme-to-bip-39-mnemonics&quot;&gt;Applying Shamir&#x27;s Scheme to BIP-39 Mnemonics&lt;&#x2F;h3&gt;
&lt;p&gt;To ensure that the shares are valid BIP-39 mnemonics, we:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Convert the target BIP-39 mnemonic to its underlying entropy&lt;&#x2F;li&gt;
&lt;li&gt;Apply Shamir&#x27;s Scheme to the entropy&lt;&#x2F;li&gt;
&lt;li&gt;Convert each resulting share&#x27;s &lt;em&gt;y&lt;&#x2F;em&gt; value to a BIP-39 mnemonic&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;By converting to entropy before applying Shamir&#x27;s Scheme, we omit the checksum from the initial secret, allowing us to calculate a new checksum for each share when converting the share &lt;em&gt;y&lt;&#x2F;em&gt; values to mnemonics, ensuring that they are valid according to BIP-39.&lt;&#x2F;p&gt;
&lt;p&gt;When applying Shamir&#x27;s Scheme to the entropy, we apply it separately to each byte of the entropy and GF(256) is used as the underlying finite field. Bytes are interpreted as elements of GF(256) using polynomial representation with operations modulo the Rijndael irreducible polynomial &lt;em&gt;x&lt;&#x2F;em&gt;&lt;sup&gt;8&lt;&#x2F;sup&gt; + &lt;em&gt;x&lt;&#x2F;em&gt;&lt;sup&gt;4&lt;&#x2F;sup&gt; + &lt;em&gt;x&lt;&#x2F;em&gt;&lt;sup&gt;3&lt;&#x2F;sup&gt; + &lt;em&gt;x&lt;&#x2F;em&gt; + 1, following AES.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;share-format&quot;&gt;Share Format&lt;&#x2F;h3&gt;
&lt;p&gt;A share represents a point on the curve described by the underlying polynomial used to split the secret. It includes two pieces of data:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;An ID: the &lt;em&gt;x&lt;&#x2F;em&gt; value of the share&lt;&#x2F;li&gt;
&lt;li&gt;A BIP-39 mnemonic: the &lt;em&gt;y&lt;&#x2F;em&gt; value of the share represented by a mnemonic&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;creating-shares&quot;&gt;Creating Shares&lt;&#x2F;h3&gt;
&lt;p&gt;Inputs: BIP-39 mnemonic, number of shares (&lt;em&gt;N&lt;&#x2F;em&gt;), threshold (&lt;em&gt;T&lt;&#x2F;em&gt;)&lt;&#x2F;p&gt;
&lt;p&gt;Output: N Shares, each share including an ID, { &lt;em&gt;x&lt;&#x2F;em&gt; | 0 &amp;lt; &lt;em&gt;x&lt;&#x2F;em&gt; &amp;lt; 256 }, and a BIP-39 mnemonic of the same length as the input one&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Check the following conditions:
&lt;ul&gt;
&lt;li&gt;1 &amp;lt; T &amp;lt;= N &amp;lt; 256&lt;&#x2F;li&gt;
&lt;li&gt;The mnemonic is valid according to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3450&#x2F;#generating-the-mnemonic&quot;&gt;BIP-39&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3450&#x2F;#recovering-the-entropy&quot;&gt;Recover the underlying entropy of the mnemonic&lt;&#x2F;a&gt; as a vector of bytes&lt;&#x2F;li&gt;
&lt;li&gt;Define values:
&lt;ul&gt;
&lt;li&gt;Let &lt;em&gt;E&lt;&#x2F;em&gt; be the byte-vector representation of the mnemonic&#x27;s entropy&lt;&#x2F;li&gt;
&lt;li&gt;Let &lt;em&gt;n&lt;&#x2F;em&gt; be the length of &lt;em&gt;E&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Let &lt;em&gt;coeff&lt;sub&gt;1&lt;&#x2F;sub&gt;&lt;&#x2F;em&gt;, ... , &lt;em&gt;coeff&lt;sub&gt;T - 1&lt;&#x2F;sub&gt;&lt;&#x2F;em&gt; be byte-vectors belonging to GF(256)&lt;em&gt;&lt;sup&gt;n&lt;&#x2F;sup&gt;&lt;&#x2F;em&gt; generated randomly, independently with uniform distribution from a source suitable for generating cryptographic keys&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Evaluate the polynomial for each share
&lt;ul&gt;
&lt;li&gt;For each &lt;em&gt;x&lt;&#x2F;em&gt; from 1 to &lt;em&gt;N&lt;&#x2F;em&gt;, evaluate the polynomial &lt;em&gt;f(x)&lt;&#x2F;em&gt; = &lt;em&gt;E&lt;&#x2F;em&gt; + &lt;em&gt;coeff&lt;sub&gt;1&lt;&#x2F;sub&gt;x&lt;sup&gt;1&lt;&#x2F;sup&gt;&lt;&#x2F;em&gt; + ... + &lt;em&gt;coeff&lt;sub&gt;T - 1&lt;&#x2F;sub&gt;x&lt;sup&gt;T - 1&lt;&#x2F;sup&gt;&lt;&#x2F;em&gt;, where &lt;em&gt;x&lt;&#x2F;em&gt; is the share ID and &lt;em&gt;f(x)&lt;&#x2F;em&gt; is the share value (as a vector of bytes)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Using &lt;em&gt;f(x)&lt;&#x2F;em&gt; as the underlying entropy, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3450&#x2F;#generating-the-mnemonic&quot;&gt;generate a mnemonic&lt;&#x2F;a&gt; for each share&lt;&#x2F;li&gt;
&lt;li&gt;Return the ID and mnemonic for each share&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;recovering-the-mnemonic&quot;&gt;Recovering the Mnemonic&lt;&#x2F;h3&gt;
&lt;p&gt;To recover the original mnemonic, we interpolate a polynomial &lt;em&gt;f&lt;&#x2F;em&gt; from the given set of shares (or points on the polynomial) and evaluate &lt;em&gt;f(0)&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;polynomial-interpolation&quot;&gt;Polynomial Interpolation&lt;&#x2F;h4&gt;
&lt;p&gt;Given a set of &lt;em&gt;m&lt;&#x2F;em&gt; points (&lt;em&gt;x&lt;sub&gt;i&lt;&#x2F;sub&gt;&lt;&#x2F;em&gt;, &lt;em&gt;y&lt;sub&gt;i&lt;&#x2F;sub&gt;&lt;&#x2F;em&gt;), 1 ≤ &lt;em&gt;i&lt;&#x2F;em&gt; ≤ &lt;em&gt;m&lt;&#x2F;em&gt;, such that no two &lt;em&gt;x&lt;sub&gt;i&lt;&#x2F;sub&gt;&lt;&#x2F;em&gt; values equal, there exists a polynomial that assumes the value &lt;em&gt;y&lt;sub&gt;i&lt;&#x2F;sub&gt;&lt;&#x2F;em&gt; at each point &lt;em&gt;x&lt;sub&gt;i&lt;&#x2F;sub&gt;&lt;&#x2F;em&gt;. The polynomial of lowest degree that satisfies these conditions is uniquely determined and can be obtained using the Lagrange interpolation formula given below.&lt;&#x2F;p&gt;
&lt;p&gt;Since Shamir&#x27;s Secret Sharing Scheme is applied separately to each of the &lt;em&gt;n&lt;&#x2F;em&gt; bytes of the shared mnemonic&#x27;s entropy, we work with &lt;em&gt;y&lt;sub&gt;i&lt;&#x2F;sub&gt;&lt;&#x2F;em&gt; as a vector of &lt;em&gt;n&lt;&#x2F;em&gt; values, where &lt;em&gt;y&lt;sub&gt;i&lt;&#x2F;sub&gt;&lt;&#x2F;em&gt;[&lt;em&gt;k&lt;&#x2F;em&gt;] = &lt;em&gt;f&lt;sub&gt;k&lt;&#x2F;sub&gt;&lt;&#x2F;em&gt;(&lt;em&gt;x&lt;sub&gt;i&lt;&#x2F;sub&gt;&lt;&#x2F;em&gt;), 1 ≤ &lt;em&gt;k&lt;&#x2F;em&gt; ≤ &lt;em&gt;n&lt;&#x2F;em&gt;, and &lt;em&gt;f&lt;sub&gt;k&lt;&#x2F;sub&gt;&lt;&#x2F;em&gt; is the polynomial in the &lt;em&gt;k&lt;&#x2F;em&gt;-th instance of the scheme.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;interpolate-x-xi-yi-1-i-m&quot;&gt;Interpolate(&lt;em&gt;x&lt;&#x2F;em&gt;, {(&lt;em&gt;x&lt;sub&gt;i&lt;&#x2F;sub&gt;&lt;&#x2F;em&gt;, &lt;em&gt;y&lt;sub&gt;i&lt;&#x2F;sub&gt;&lt;&#x2F;em&gt;), 1 ≤ &lt;em&gt;i&lt;&#x2F;em&gt; ≤ &lt;em&gt;m&lt;&#x2F;em&gt;})&lt;&#x2F;h4&gt;
&lt;p&gt;Input: the desired index &lt;em&gt;x&lt;&#x2F;em&gt;, a set of index&#x2F;value-vector pairs {(&lt;em&gt;x&lt;sub&gt;i&lt;&#x2F;sub&gt;&lt;&#x2F;em&gt;, &lt;em&gt;y&lt;&#x2F;em&gt;&lt;sub&gt;&lt;em&gt;i&lt;&#x2F;em&gt;&lt;&#x2F;sub&gt;), 1 ≤ &lt;em&gt;i&lt;&#x2F;em&gt; ≤ &lt;em&gt;m&lt;&#x2F;em&gt;} ⊆ GF(256) × GF(256)&lt;sup&gt;&lt;em&gt;n&lt;&#x2F;em&gt;&lt;&#x2F;sup&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Output: the value-vector (&lt;em&gt;f&lt;&#x2F;em&gt;&lt;sub&gt;1&lt;&#x2F;sub&gt;(&lt;em&gt;x&lt;&#x2F;em&gt;), ... , &lt;em&gt;f&lt;sub&gt;n&lt;&#x2F;sub&gt;&lt;&#x2F;em&gt;(&lt;em&gt;x&lt;&#x2F;em&gt;))&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3450&#x2F;.&#x2F;assets&#x2F;lagrange.gif&quot; alt=&quot;f_k(x) = \sum_{i=1}^m y_i[k] \prod_{\underset{j \neq i}{j=1}}^m \frac{x - x_j}{x_i - x_j}&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;recover-the-mnemonic&quot;&gt;Recover the Mnemonic&lt;&#x2F;h4&gt;
&lt;p&gt;Input: A set of &lt;em&gt;m&lt;&#x2F;em&gt; Shares&lt;&#x2F;p&gt;
&lt;p&gt;Output: The original mnemonic&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3450&#x2F;#recovering-the-entropy&quot;&gt;Recover the underlying entropy of each share&#x27;s mnemonic&lt;&#x2F;a&gt; as a vector of bytes&lt;&#x2F;li&gt;
&lt;li&gt;Calculate &lt;em&gt;E&lt;&#x2F;em&gt; = Interpolate(0, [(&lt;em&gt;x&lt;sub&gt;1&lt;&#x2F;sub&gt;&lt;&#x2F;em&gt;, &lt;em&gt;y&lt;sub&gt;1&lt;&#x2F;sub&gt;&lt;&#x2F;em&gt;),...,(&lt;em&gt;x&lt;sub&gt;m&lt;&#x2F;sub&gt;&lt;&#x2F;em&gt;, &lt;em&gt;y&lt;sub&gt;m&lt;&#x2F;sub&gt;&lt;&#x2F;em&gt;)]), where &lt;em&gt;x&lt;&#x2F;em&gt; is the share ID and &lt;em&gt;y&lt;&#x2F;em&gt; is the byte-vector of the share&#x27;s mnemonic&#x27;s entropy&lt;&#x2F;li&gt;
&lt;li&gt;Using &lt;em&gt;E&lt;&#x2F;em&gt; as the underlying entropy, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3450&#x2F;#generating-the-mnemonic&quot;&gt;generate a mnemonic&lt;&#x2F;a&gt; and return it&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;choice-of-field&quot;&gt;Choice of Field&lt;&#x2F;h3&gt;
&lt;p&gt;The field GF(256) was chosen, because the field arithmetic is easy to implement in any programming language and many implementations are already available since it is used in the AES cipher. Although using GF(256) requires that we convert the mnemonic to its underlying entropy as a byte-vector, this is also easy to implement and many implementations of it exist in a variety of programming languages.&lt;&#x2F;p&gt;
&lt;p&gt;GF(2048) was also considered. Using GF(2048), we could have applied Shamir&#x27;s Scheme directly to the mnemonic, using the word indexes as the values. This would have allowed us to avoid converting the mnemonic to its underlying entropy. But, the resulting shares would not have been valid BIP-39 mnemonics - the checksum portion would not be a valid checksum of the entropy. And, working around this would add considerable complexity.&lt;&#x2F;p&gt;
&lt;p&gt;Another option was GF(2&lt;sup&gt;&lt;em&gt;n&lt;&#x2F;em&gt;&lt;&#x2F;sup&gt;) where &lt;em&gt;n&lt;&#x2F;em&gt; is the size of the entropy in bits. We&#x27;d still convert the mnemonic to entropy, but then apply Shamir&#x27;s Scheme over the entire entropy rather than on a vector of values. The downside of this approach is we&#x27;d need a different field for each mnemonic strength along with an associated irreducible polynomial. Additionally, this would require working with very large numbers that can be cumbersome to work with in some languages.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;valid-share-mnemonics-and-share-ids&quot;&gt;Valid Share Mnemonics and Share IDs&lt;&#x2F;h3&gt;
&lt;p&gt;The shares produced by the specification include an ID, in addition to the BIP-39 mnemonic.&lt;&#x2F;p&gt;
&lt;p&gt;Other options could have encoded the share ID into the mnemonic, simplifying storage - only the mnemonic would need to be stored.&lt;&#x2F;p&gt;
&lt;p&gt;One possibility would be to store the ID instead of the checksum in the mnemonic. The downside of this approach is that the shares would not be &lt;em&gt;valid&lt;&#x2F;em&gt; BIP-39 mnemonics because the &quot;checksum&quot; section of the mnemonic would not match the &quot;entropy&quot; section. Shares with valid BIP-39 mnemonics are useful because they are indistinguishable from any other. And users could store the ID in a variety of ways that obscure it.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;validation-on-recovery&quot;&gt;Validation on Recovery&lt;&#x2F;h3&gt;
&lt;p&gt;We decided &lt;em&gt;not&lt;&#x2F;em&gt; to include a validation mechanism on recovering the original mnemonic. This leaks less information to a potential attacker. There is no indication they&#x27;ve gotten the requisite number of shares until they&#x27;ve obtained &lt;em&gt;T&lt;&#x2F;em&gt; + 1 shares.&lt;&#x2F;p&gt;
&lt;p&gt;We could provide recovery validation by replacing one of the random coefficients with a checksum of the original mnemonic. Then, when recovering the original mnemonic and the polynomial, we could validate that the checksum coefficient is the valid checksum of recovered mnemonic.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Coming soon.&lt;&#x2F;p&gt;
&lt;p&gt;All implementations must be able to:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Split and recover each &lt;code&gt;mnemonic&lt;&#x2F;code&gt; with the given &lt;code&gt;numShares&lt;&#x2F;code&gt; and &lt;code&gt;threshold&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Recover the &lt;code&gt;mnemonic&lt;&#x2F;code&gt; from the given &lt;code&gt;knownShares&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The shares produced by the specification include an ID in addition to the BIP-39 mnemonic. This raises two security concerns:&lt;&#x2F;p&gt;
&lt;p&gt;Users &lt;strong&gt;must&lt;&#x2F;strong&gt; keep this ID in order to recover the original mnemonic. If the ID is lost, or separated from the share mnemonic, it may not be possible to recover the original. (Brute force recovery may or may not be possible depending on how much is known about the number of shares and threshold)&lt;&#x2F;p&gt;
&lt;p&gt;The additional data may hint to an attacker of the existence of other keys and the scheme under which they are stored. Therefore, the ID should be stored in a way that obscures its use.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Expanded Clique Block Choice Rule</title>
        <published>2021-03-25T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Danno Ferrin</name><uri>https://github.com/shemnon</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3436/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3436-expanded-clique-block-choice-rule/5809" />
        

        <id>https://wg-eips.ritovision.com/3436/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:3436"
            label="EIP-3436" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3436/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Add a four step block rule to Clique that should reduce block production deadlocks&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The current specification of Clique allows for multiple competing blocks from producers but does not
provide any strategies to pick blocks aside from the current &quot;highest total difficulty&quot; rule. This
EIP proposes a four step choice rule of highest total difficulty, shortest chain, most recently
in-turn, and lowest hash. This would prevent deadlocks that have occurred in production systems.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;There has been more than one deadlock in the Goerli multi-client Clique network. The number of
active validators was greater than 1&#x2F;2 of the available validators so a chain halt should not have
occurred. The halt was resolved by an inactive validator coming back on line. The state of the chain
was in one of two configurations of 8 validators that can result in a chain halt. Three of the four
clients observed a choice sequence of lowest total difficulty followed by first observed block. Geth
added one extra rule of preferring the shortest chain before preferring the first observed block.
This fork would have resolved itself with Geth&#x27;s rule, but there is still a configuration where the
chain can halt with a shortest chain rule.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;When a Clique validator is arbitrating the canonical status between two different chain head blocks,
they should choose the canonical block with the following ordered priorities.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Choose the block with the most total difficulty.&lt;&#x2F;li&gt;
&lt;li&gt;Then choose the block with the lowest block number.&lt;&#x2F;li&gt;
&lt;li&gt;Then choose the block whose validator had the least recent in-turn block assignment.&lt;&#x2F;li&gt;
&lt;li&gt;Then choose the block with the lowest hash.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;When resolving rule 3 clients should use the following formula, where &lt;code&gt;validator_index&lt;&#x2F;code&gt; is the integer
index of the validator that signed the block when sorted as per epoch checkpointing,
&lt;code&gt;header_number&lt;&#x2F;code&gt; is the number of the header, and &lt;code&gt;validator_count&lt;&#x2F;code&gt; is the count of the current
validators. Clients should choose the block with the &lt;strong&gt;largest&lt;&#x2F;strong&gt; value. Note that an in-turn block
is considered to be the most recent in-turn block.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(header_number - validator_index) % validator_count&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;When resolving rule 4 the hash should be converted into an unsigned 256 bit integer.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Two scenarios of a halted chain are known based on the current total difficulty then first observed
rule. One of the scenarios is also resistant to the shortest chain rule.&lt;&#x2F;p&gt;
&lt;p&gt;For the first scenario where chains of different lengths can halt consider a block with 8
validators, whose addresses sort to the same order as their designation in this example. A fully
in-order chain exists and validator number 8 has just produced an in-turn block and then validators
5, 7 and 8 go offline, leaving validators 1 to 6 to produce blocks. Two forks form, one with an
in-order block from validator 1 and then an out of order block from validator 3. The second fork
forms from validators 2, 4, and 6 in order. Both have a net total difficulty of 3 more than the
common ancestor. So in this case if both forks become aware of the other fork then both are
considered equally viable and neither set of validators should switch to the newly observed fork. In
this case, adding a shortest chain rule would break the deadlock as the even numbered validators
would adopt the shorter chain.&lt;&#x2F;p&gt;
&lt;p&gt;For the second scenario with the same validator set and in-order chain with validator 7 having just
produced an in order block, then validators 7 and 8 go offline. Two forks form, 1,3,5 on one side
and 2,4,6 on the other. Both forks become aware of the other fork after producing their third block.
In this case both forks have equal total difficulty and equal length. So Geth&#x27;s rule would not break
the tie and only the arrival of one of the missing validators fix the chain. In a worst case
scenario the odd and even chains would produce a block for 7 and 8 respectively, and chain halt
would result with no validators that have not chosen a fork. Only a manual rollback would fix this.&lt;&#x2F;p&gt;
&lt;p&gt;One consideration when formulating the rules is that the block choice should be chosen so that it
would encourage the maximum amount of in-order blocks. Selecting a chain based on shortest chain
implicitly prefers the chain with more in-order blocks. When selecting between competing out of
order chains the validator who is closest to producing an in-order block in the future should have
their chain declined so that they are available to produce an in-order block sooner.&lt;&#x2F;p&gt;
&lt;p&gt;At least one client has been observed producing multiple blocks at the same height with the same
difficulty, so a final catch-all standard of lowest block hash should break any remaining ties.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The current block choice rules are a mix of most total difficulty and most total difficulty plus
shortest chain.&lt;&#x2F;p&gt;
&lt;p&gt;As long as the majority of the active validators implement the block choice rules then a client who
only implements the existing difficulty based rule will eventually align with the chain preferred by
these rules. If less than a majority implement these rules then deadlocks can still occur, and
depend on the first observation of problematic blocks, which is no worse than the current situation.&lt;&#x2F;p&gt;
&lt;p&gt;If clients only partially implement the rule as long as every higher ranked rule is also implemented
then the situation will be no worse than today.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Malicious and motivated attackers who are participating in the network can force the chain to halt
with well crafted block production. With a fully deterministic choice rule the opportunity to halt
is diminished. Attackers still have the same opportunities to flood the network with multiple blocks
at the same height. A deterministic rule based on the lowest hash reduces the impact of such a
flooding attack. A malicious validator could exploit this deterministic rule to produce a
replacement block. Such an attack exists in current implementations but a deterministic hash rule
makes such replacements more likely. However the impact of such an attack seems low to trivial at
this time.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Median Gas Premium</title>
        <published>2021-03-18T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>HexZorro</name><uri>https://github.com/hexzorro</uri>
	</author>
	
	<author>
		<name>Mojtaba Tefagh</name><uri>https://github.com/mtefagh</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3416/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3416-median-gas-premium/5755" />
        

        <id>https://wg-eips.ritovision.com/3416/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:3416"
            label="EIP-3416" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3416/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;A transaction pricing mechanism with a fixed-per-block network fee and a median inclusion fee with additive updates.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;There is a base fee per gas in protocol, which can move up or down by a maximum of 1&#x2F;8 in each block. The base fee per gas is adjusted by the protocol to target an average gas usage per block instead of an absolute gas usage per block.  The base fee is increased when blocks are over the gas limit target and decreases when blocks are under the gas limit target. Transaction senders specify their fees by providing &lt;em&gt;only one value&lt;&#x2F;em&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The fee cap which represents the maximum total (base fee + gas premium) that the transaction sender would be willing to pay to get their transaction included, resembles the current maximum gas price specified by senders but in this protocol change proposal the final gas price paid, most of the time, will be lower than the proposed by the transaction sender.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Then there is a gas premium that is directly computed as 50% of (fee cap - base fee). This gas premium gets added onto the base fee to calculate the gas price that will be used in the weighted median computation. The gas premium, determined directly by a specified fee cap, can either be set to a fairly low value to compensate miners for uncle rate risk only with the base fee, or to a high value to compete during sudden bursts of activity. Using all transactions that the miner wants to include in the block, a &lt;strong&gt;weighted median gas premium&lt;&#x2F;strong&gt; is computed, not considering in the computation 5% of gas price outliers on the upper-side for extra robustness against miner manipulation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;We target the following goals:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Gas prices spikes are mathematically smoothed out. EIP1559 does not seems to really tackle gas premium volatility and UX.&lt;&#x2F;li&gt;
&lt;li&gt;Maintain gas price preference, i.e. transaction senders willing to pay extra in fees will be rewarded with early preferential inclusion in the blocks, because the miners want to maximize their profits and include transactions with higher fee caps first to maximize the median.&lt;&#x2F;li&gt;
&lt;li&gt;Final gas price paid by the sender is, most of the time, smaller than the maximum gas price specified by sender.&lt;&#x2F;li&gt;
&lt;li&gt;Gas pricing is more robust to sender manipulation or miner manipulation.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Ethereum currently prices transaction fees using a simple auction mechanism, where users send transactions with bids (&quot;gasprices&quot;) and miners choose transactions with the highest bids, and transactions that get included pay the bid that they specify. This leads to several large sources of inefficiency:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Current extreme volatility of gas prices is hurting user experience&lt;&#x2F;strong&gt;: if you observe  online gas price metrics, the current trends in recommended gas prices can change substantially by the minute, making the user experience in the network very awkward. Also, gas volatility makes the mining business more unpredictable and costly, because miners need to spend money hedging the risks.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Mismatch between volatility of transaction fee levels and social cost of transactions&lt;&#x2F;strong&gt;: bids to include transactions on mature public blockchains, that have enough usage so that blocks are full, tend to be extremely volatile. On Ethereum, minimum bids range between 1 nanoeth (10^9 nanoeth = 1 ETH), but sometimes go over 100 nanoeth and have reached over 200 nanoeth. This clearly creates many inefficiencies, because it&#x27;s absurd to suggest that the cost incurred by the network from accepting one more transaction into a block actually is 200x more when gas prices are 200 nanoeth than when they are 1 nanoeth; in both cases, it&#x27;s a difference between 8 million gas and 8.02 million gas.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Needless delays for users&lt;&#x2F;strong&gt;: because of the hard per-block gas limit coupled with natural volatility in transaction volume, transactions often wait for several blocks before getting included, but this is socially unproductive; no one significantly gains from the fact that there is no &quot;slack&quot; mechanism that allows one block to be bigger and the next block to be smaller to meet block-by-block differences in demand.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Inefficiencies of first price auctions&lt;&#x2F;strong&gt;: The current approach, where transaction senders publish a transaction with a bid a maximum fee, miners choose the highest-paying transactions, and everyone pays what they bid. This is well-known in mechanism design literature to be highly inefficient, and so complex fee estimation algorithms are required. But even these algorithms often end up not working very well, leading to frequent fee overpayment. We need a more stable fee metric that is computed inside the protocol.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The proposal in this EIP is to start with a base fee amount which is adjusted up and down by the protocol based on how congested the network is. When the network exceeds the target per-block gas usage, the base fee increases slightly and when capacity is below the target, it decreases slightly. Because these base fee changes are constrained, the maximum difference in base fee from block to block is predictable. This then allows wallets to auto-set the gas fees for users in a highly reliable fashion. It is expected that most users will not have to manually adjust gas fees, even in periods of high network activity. For most users the base fee will be estimated by their wallet and a small gas premium related to the urgency and the priority they want to instill into the transaction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;p&gt;This is a classic fork without a long migration time.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt;: TBD.  Block number at or after which EIP-3416 transactions are valid.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;GAS_TARGET_MAX_CHANGE&lt;&#x2F;code&gt;: &lt;code&gt;1 &#x2F;&#x2F; 1024&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;BLOCK_GAS_USED&lt;&#x2F;code&gt;: total gas consumed by transaction included in the block.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;PARENT_GAS_USED&lt;&#x2F;code&gt;: same as &lt;code&gt;BLOCK_GAS_USED&lt;&#x2F;code&gt; for parent block.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CURRENT_BLOCK&lt;&#x2F;code&gt;: The current block that is being worked with (either being validated, or being produced).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;BASE_FEE&lt;&#x2F;code&gt;: 16th item in the block header. Represents the amount of attoeth burned for every unit of gas a transaction uses.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;PARENT_BASE_FEE&lt;&#x2F;code&gt;: same as &lt;code&gt;BASE_FEE&lt;&#x2F;code&gt; for parent block.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;BASE_FEE_MAX_CHANGE&lt;&#x2F;code&gt;: &lt;code&gt;1 &#x2F;&#x2F; 8&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;INITIAL_BASE_FEE&lt;&#x2F;code&gt; : Median gas price in &lt;code&gt;FORK_BLOCK_NUMBER - 1&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;process&quot;&gt;Process&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;At &lt;code&gt;block.number == FORK_BLOCK_NUMBER&lt;&#x2F;code&gt; we set &lt;code&gt;BASE_FEE = INITIAL_BASE_FEE&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;BASE_FEE&lt;&#x2F;code&gt; is set, from &lt;code&gt;FORK_BLOCK_NUMBER + 1&lt;&#x2F;code&gt;, as follows
&lt;ul&gt;
&lt;li&gt;Let &lt;code&gt;GAS_DELTA = (PARENT_GAS_USED - PARENT_GAS_TARGET) &#x2F;&#x2F; PARENT_GAS_TARGET&lt;&#x2F;code&gt; (possibly negative).&lt;&#x2F;li&gt;
&lt;li&gt;Set &lt;code&gt;BASE_FEE = PARENT_BASE_FEE + GAS_DELTA * BASE_FEE_MAX_CHANGE&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Transactions since &lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt; are encoded the same as the current ones &lt;code&gt;rlp([nonce, gasPrice, gasLimit, to, value, data, v, r, s])&lt;&#x2F;code&gt; where &lt;code&gt;v,r,s&lt;&#x2F;code&gt; is a signature of &lt;code&gt;rlp([nonce, gasPrice, gasLimit, to, value, data])&lt;&#x2F;code&gt; and &lt;code&gt;gasPrice&lt;&#x2F;code&gt; is the &lt;code&gt;FEE_CAP&lt;&#x2F;code&gt; specified by the sender according to this proposal.&lt;&#x2F;li&gt;
&lt;li&gt;To produce transactions since &lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt;, the new &lt;code&gt;FEE_CAP&lt;&#x2F;code&gt; field (maintaining legacy name of &lt;code&gt;gasPrice&lt;&#x2F;code&gt; in the transaction) is set as follows (and the &lt;code&gt;GAS_PREMIUM&lt;&#x2F;code&gt; is computed as specified):
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;FEE_CAP&lt;&#x2F;code&gt;: &lt;code&gt;tx.gasPrice&lt;&#x2F;code&gt;, serves as the absolute maximum that the transaction sender is willing to pay.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;GAS_PREMIUM = (FEE_CAP - BASE_FEE) &#x2F; 2&lt;&#x2F;code&gt; serves as a sender-preferred median premium to the miner, beyond the base fee.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;FEE_CAP &amp;lt; BASE_FEE&lt;&#x2F;code&gt; then the transaction is considered invalid and cannot be included in the current block, but might be included in future blocks.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;During transaction execution, for EIP3416 transactions we calculate the cost to the &lt;code&gt;tx.origin&lt;&#x2F;code&gt; and the gain to the &lt;code&gt;block.coinbase&lt;&#x2F;code&gt; as follows:
&lt;ul&gt;
&lt;li&gt;Set &lt;code&gt;GASPRICE = BASE_FEE + median((tx_i.gasPrice - BASE_FEE) &#x2F; 2)&lt;&#x2F;code&gt; among all transactions &lt;code&gt;tx_i&lt;&#x2F;code&gt; included in the same block, &lt;em&gt;weighted by gas consumed&lt;&#x2F;em&gt; and not including the top 5% of outlier gas price in calculation. By weighted median without 5% of the upper-side outliers, we mean that each gas unit spent is ordered according to the corresponding transaction by &lt;code&gt;BASE_FEE + tx.gasPrice &#x2F; 2&lt;&#x2F;code&gt; and then the value chosen will be the one separating the lower 95% in two parts.&lt;&#x2F;li&gt;
&lt;li&gt;Let &lt;code&gt;GASUSED&lt;&#x2F;code&gt; be the gas used during the transaction execution&#x2F;state transition.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;tx.origin&lt;&#x2F;code&gt; initially pays &lt;code&gt;GASPRICE * tx.gasLimit&lt;&#x2F;code&gt;, and gets refunded &lt;code&gt;GASPRICE * (tx.gasLimit - GASUSED)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The miners can still use a &lt;code&gt;greedy&lt;&#x2F;code&gt; strategy to include new transactions in the proposed blocks by adding the transactions ordered by larger &lt;code&gt;FEE_CAP&lt;&#x2F;code&gt; first. This is similar to how current blocks are filled, and is a consequence of &lt;code&gt;FEE_CAP&lt;&#x2F;code&gt; and &lt;code&gt;GAS_PREMIUM&lt;&#x2F;code&gt; being a positive linear function of each other.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The rationale behind the premium being 50% of (fee cap - base fee) is that at any given point the average network sender has an average fee cap, and we assume that between base fee and fee cap the sender has no specific preference, as long as the transaction is included in some block. Then, the sender is happy with a median premium among this uniform range. Another justification can be that the user also knows that this new version of the pricing protocol for the complete block uses a median, then is fair for him to apply a median within his preferential range, assuming an uniform sampling there. Simulations (&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;hackmd.io&#x2F;c6kyRNMuTnKf_SlolmevRg#An-improvement-for-the-premium&quot;&gt;here&lt;&#x2F;a&gt;) with Ethereum gas data shows indeed that median one of the most robust metric.s&lt;&#x2F;p&gt;
&lt;p&gt;The 5% top outliers removal, not considered in the median, or similar number, is to give extra robustness against miner manipulation, because as current network utilization has been around 97% for the last 6 months the miners can include their own transactions on the empty 3% to try to manipulate and increase the median price (even this manipulation effect will be very small on the final price).&lt;&#x2F;p&gt;
&lt;p&gt;The rationale for the &lt;code&gt;BASE_FEE&lt;&#x2F;code&gt; update formula is that we are using an additive version (&lt;code&gt;PARENT_BASE_FEE + GAS_DELTA * BASE_FEE_MAX_CHANGE&lt;&#x2F;code&gt;) to avoid an attack of senders sending this fee to zero. This attack was simulated and observed for multiplicative formula proposed in previous version (&lt;code&gt;PARENT_BASE_FEE + PARENT_BASE_FEE * GAS_DELTA * BASE_FEE_MAX_CHANGE&lt;&#x2F;code&gt;). See an article about the attack and the simulation &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;mtefagh.github.io&#x2F;fee&#x2F;&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Another rationale for the additive &lt;code&gt;BASE_FEE&lt;&#x2F;code&gt; update formula is that it guarantees (see &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;pdfs.semanticscholar.org&#x2F;3d2d&#x2F;773983c5201b58586af463f045befae5bbf2.pdf&quot;&gt;this&lt;&#x2F;a&gt; article) that the optimal execution strategy (scheduling broadcasts in order to pay less fee) for a batch of nonurgent transactions is to spread the transactions across different blocks which in turn helps to avoid network congestion and lowers volatility. For the multiplicative formula, it is exactly the reverse, that is, spikes (dumping all your transactions at once) are incentivized as described &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethresear.ch&#x2F;t&#x2F;path-dependence-of-eip-1559-and-the-simulation-of-the-resulting-permanent-loss&#x2F;8964&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The rationale for the &lt;code&gt;BASE_FEE_MAX_CHANGE&lt;&#x2F;code&gt; being &lt;code&gt;1 &#x2F;&#x2F; 8&lt;&#x2F;code&gt; is that the &lt;code&gt;BASE_FEE&lt;&#x2F;code&gt; is designed to be very adaptative to block utilization changes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The backward compatibility is very straightforward because there are no new fields added to the transactions. Pricing of the gas per block on the miner&#x2F;validator side is still fast to compute but a little more complex. Changes only affect miners&#x2F;validators. Wallets are no affected by this proposal.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBD.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Senders cannot manipulate the minimum fee because the minimum &lt;code&gt;BASE_FEE&lt;&#x2F;code&gt; is controlled by the miners with small increments or decrements on each new block proposed.&lt;&#x2F;li&gt;
&lt;li&gt;Above the &lt;code&gt;BASE_FEE&lt;&#x2F;code&gt; the senders have a very limited ability to manipulate and lower the final gas price they pay because they have to move the weighted median close to &lt;code&gt;BASE_FEE&lt;&#x2F;code&gt; and, as we know, this is a very robust statistic.&lt;&#x2F;li&gt;
&lt;li&gt;Miners have a very limited ability to manipulate and raise the final gas price paid by senders above &lt;code&gt;BASE_FEE&lt;&#x2F;code&gt; because to influence the final gas price they have to stuff fake transactions beyond the top 5% of the blocks. In average and currently, only the top 3% of the block is empty, so to fill-up 5% of the block they need to start dropping profitable transactions to reach 5%. Only beyond 5% of the top block gas they can start moving the median a little and the median is still a very robust statistic, not liable to being easily manipulated.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Partial removal of refunds</title>
        <published>2021-03-16T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	<author>
		<name>Martin Swende</name><uri>https://github.com/holiman</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3403/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3298-removal-of-refunds/5430" />
        

        <id>https://wg-eips.ritovision.com/3403/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:3403"
            label="EIP-3403" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3403/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Remove gas refunds for SELFDESTRUCT, and restrict gas refunds for SSTORE to one specific case.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Gas refunds for SSTORE and SELFDESTRUCT were originally introduced to motivate application developers to write applications that practice &quot;good state hygiene&quot;, clearing storage slots and contracts that are no longer needed. However, they are not widely used for this, and poor state hygiene continues to be the norm. It is now widely accepted that the only solution to state growth is some form of statelessness or state expiry, and if such a solution is implemented, then disused storage slots and contracts would start to be ignored automatically.&lt;&#x2F;p&gt;
&lt;p&gt;Gas refunds additionally have multiple harmful consequences:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Refunds give rise to GasToken. GasToken has benefits in moving gas space from low-fee periods to high-fee periods, but it also has downsides to the network, particularly in exacerbating state size (as state slots are effectively used as a &quot;battery&quot; to save up gas) and inefficiently clogging blockchain gas usage&lt;&#x2F;li&gt;
&lt;li&gt;Refunds increase block size variance. The theoretical maximum amount of actual gas consumed in a block is nearly twice the on-paper gas limit (as refunds add gas space for subsequent transactions in a block, though refunds are capped at 50% of a transaction&#x27;s gas used). This is not fatal, but is still undesirable, especially given that refunds can be used to maintain 2x usage spikes for far longer than EIP 1559 can.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;the-mutex-usecase&quot;&gt;The mutex usecase&lt;&#x2F;h3&gt;
&lt;p&gt;There are two typical ways to implement mutexes: &#x27;0-1-0&#x27; and &#x27;1-2-1. Let&#x27;s see how they differ&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&#x27;0-1-0&#x27;:
&lt;ul&gt;
&lt;li&gt;Istanbul: 1612&lt;&#x2F;li&gt;
&lt;li&gt;Berlin: 212&lt;&#x2F;li&gt;
&lt;li&gt;NoRefund: 20112&lt;&#x2F;li&gt;
&lt;li&gt;EIP-3403: 1112&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&#x27;1-2-1&#x27;:
&lt;ul&gt;
&lt;li&gt;Istanbul: 1612&lt;&#x2F;li&gt;
&lt;li&gt;Berlin: 212&lt;&#x2F;li&gt;
&lt;li&gt;NoRefund: 3012&lt;&#x2F;li&gt;
&lt;li&gt;EIP-3403: 3012&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;&#x2F;strong&gt;: In reality, there are never a negative gas cost, since the refund is capped at 0.5 * gasUsed.
However, these tables show the negative values, since a more real-world scenario would likely spend the
extra gas on other operations.&#x27;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FORK_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;TBD&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SSTORE_REFUND_GAS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;19000&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;For blocks where &lt;code&gt;block.number &amp;gt;= FORK_BLOCK&lt;&#x2F;code&gt;, the following changes apply.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Remove the &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; refund.&lt;&#x2F;li&gt;
&lt;li&gt;Remove the &lt;code&gt;SSTORE&lt;&#x2F;code&gt; refund in all cases except for one specific case: if the &lt;em&gt;new value&lt;&#x2F;em&gt; and &lt;em&gt;original value&lt;&#x2F;em&gt; of the storage slot both equal 0 but the &lt;em&gt;current value&lt;&#x2F;em&gt; does not (those terms being defined as in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-1283&quot;&gt;EIP-1283&lt;&#x2F;a&gt;), refund &lt;code&gt;SSTORE_REFUND_GAS&lt;&#x2F;code&gt; gas.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Preserving refunds in the &lt;code&gt;new = original = 0 != current&lt;&#x2F;code&gt; case ensures that a few key use cases that deserve favorable gas cost treatment continue to receive favorable gas cost treatment, particularly:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Anti-reentrancy locks (typically flipped from 0 to 1 right before a child call begins, and then flipped back to 0 when the child call ends)&lt;&#x2F;li&gt;
&lt;li&gt;ERC20 approve-and-send (the &quot;approved value&quot; goes from zero to nonzero when the token transfer is approved, and then back to zero when the token transfer processes)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;It also preserves two key goals of EIP 3298:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Gas tokens continue to be non-viable, because each 19000 refund is only possible because of 19000 extra gas that was paid for flipping that storage slot from zero to nonzero earlier in the same transaction, so you can&#x27;t clear some storage slots and use that saved gas to fill others.&lt;&#x2F;li&gt;
&lt;li&gt;The total amount of gas &lt;em&gt;spent on execution&lt;&#x2F;em&gt; is capped at the gas limit. Every 19000 refund for flipping a storage slot non from zero -&amp;gt; zero is only possible because of 19000 extra gas paid for flipping that slot from zero -&amp;gt; nonzero earlier in the same transaction; that gas paid for a storage write and expansion that were both reverted and so do not actually need to be applied to the Merkle tree. Hence, this extra gas does not contribute to risk.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Refunds are currently only applied &lt;em&gt;after&lt;&#x2F;em&gt; transaction execution, so they cannot affect how much gas is available to any particular call frame during execution. Hence, removing them will not break the ability of any code to execute, though it will render some applications economically nonviable.&lt;&#x2F;p&gt;
&lt;p&gt;Gas tokens in particular will become valueless. DeFi arbitrage bots, which today frequently use either established gas token schemes or a custom alternative to reduce on-chain costs, would benefit from rewriting their code to remove calls to these no-longer-functional gas storage mechanisms.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;2929-gas-costs&quot;&gt;2929 Gas Costs&lt;&#x2F;h3&gt;
&lt;p&gt;Note, there is a difference between &#x27;hot&#x27; and &#x27;cold&#x27; slots. This table shows the values as of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt; assuming that all touched storage slots were already &#x27;hot&#x27; (the difference being a one-time cost of &lt;code&gt;2100&lt;&#x2F;code&gt; gas).&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Code&lt;&#x2F;th&gt;&lt;th&gt;Used Gas&lt;&#x2F;th&gt;&lt;th&gt;Refund&lt;&#x2F;th&gt;&lt;th&gt;Original&lt;&#x2F;th&gt;&lt;th&gt;1st&lt;&#x2F;th&gt;&lt;th&gt;2nd&lt;&#x2F;th&gt;&lt;th&gt;3rd&lt;&#x2F;th&gt;&lt;th&gt;Effective gas (after refund)&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;td&gt;19900&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556002600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;15000&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;-11988&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;2800&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556002600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60026000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;15000&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;-11988&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60026000556003600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60026000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;2800&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60026000556002600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;15000&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;-11988&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556002600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x600160005560006000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;40118&lt;&#x2F;td&gt;&lt;td&gt;19900&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;20218&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x600060005560016000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;5918&lt;&#x2F;td&gt;&lt;td&gt;17800&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;-11882&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;with-eip-3403-partial-refunds&quot;&gt;With EIP-3403 partial refunds&lt;&#x2F;h3&gt;
&lt;p&gt;If refunds were to be partially removed, as specified &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;pull&#x2F;3403&#x2F;&quot;&gt;here&lt;&#x2F;a&gt;, this would be the comparative table. &lt;strong&gt;This table also assumes touched storage slots were already &#x27;hot&#x27;&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Code&lt;&#x2F;th&gt;&lt;th&gt;Used Gas&lt;&#x2F;th&gt;&lt;th&gt;Refund&lt;&#x2F;th&gt;&lt;th&gt;Original&lt;&#x2F;th&gt;&lt;th&gt;1st&lt;&#x2F;th&gt;&lt;th&gt;2nd&lt;&#x2F;th&gt;&lt;th&gt;3rd&lt;&#x2F;th&gt;&lt;th&gt;Effective gas (after refund)&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;td&gt;19000&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;1112&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556002600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556002600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60026000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60026000556003600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60026000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60026000556002600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556002600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x600160005560006000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;40118&lt;&#x2F;td&gt;&lt;td&gt;19000&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;21118&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x600060005560016000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;5918&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;5918&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Refunds are not visible to transaction execution, so this should not have any impact on transaction execution logic.&lt;&#x2F;p&gt;
&lt;p&gt;The maximum amount of gas that can be spent on execution in a block is limited to the gas limit, if we do not count zero-to-nonzero SSTOREs that were later reset back to zero. It is okay to not count those, because if such an SSTORE is reset, storage is not expanded and the client does not need to actually adjust the Merke tree; the gas consumption is refunded, but the effort normally required by the client to process those opcodes is also cancelled. &lt;strong&gt;Clients should make sure to not do a storage write if &lt;code&gt;new_value = original_value&lt;&#x2F;code&gt;; this was a prudent optimization since the beginning of Ethereum but it becomes more important now.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EOF - EVM Object Format v1</title>
        <published>2021-03-16T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	<author>
		<name>Paweł Bylica</name><uri>https://github.com/chfast</uri>
	</author>
	
	<author>
		<name>Andrei Maiboroda</name><uri>https://github.com/gumb0</uri>
	</author>
	
	<author>
		<name>Matt Garnett</name><uri>https://github.com/lightclient</uri>
	</author>
	
	<author>
		<name>Piotr Dobaczewski</name><uri>https://github.com/pdobacz</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3540/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/evm-object-format-eof/5727" />
        

        <id>https://wg-eips.ritovision.com/3540/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:3540"
            label="EIP-3540" />
        

        
        

        
        <summary type="html">EOF is an extensible and versioned container format for EVM bytecode with a once-off validation at deploy time.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3540/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;We introduce an extensible and versioned container format for the EVM with a once-off validation at deploy time. The version described here brings the tangible benefit of code and data separation, and allows for easy introduction of a variety of changes in the future. This change relies on the reserved byte introduced by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3541&#x2F;&quot;&gt;EIP-3541&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;To summarise, EOF bytecode has the following layout:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;magic, version, (section_kind, section_size_or_sizes)+, 0, &amp;lt;section contents&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;On-chain deployed EVM bytecode contains no pre-defined structure today. Code is typically validated in clients to the extent of &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; analysis at runtime, every single time prior to execution. This poses not only an overhead, but also a challenge for introducing new or deprecating existing features.&lt;&#x2F;p&gt;
&lt;p&gt;Validating code during the contract creation process allows code versioning without an additional version field in the account. Versioning is a useful tool for introducing or deprecating features, especially for larger changes (such as significant changes to control flow, or features like account abstraction).&lt;&#x2F;p&gt;
&lt;p&gt;The format described in this EIP introduces a simple and extensible container with a minimal set of changes required to both clients and languages, and introduces validation.&lt;&#x2F;p&gt;
&lt;p&gt;The first tangible feature it provides is separation of code and data. This separation is especially beneficial for on-chain code validators (like those utilised by layer-2 scaling tools, such as Optimism), because they can distinguish code and data (this includes deployment code and constructor arguments too). Currently, they a) require changes prior to contract deployment; b) implement a fragile method; or c) implement an expensive and restrictive jump analysis. Code and data separation can result in ease of use and significant gas savings for such use cases. Additionally, various (static) analysis tools can also benefit, though off-chain tools can already deal with existing code, so the impact is smaller.&lt;&#x2F;p&gt;
&lt;p&gt;A non-exhaustive list of proposed changes which could benefit from this format:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Including a &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt;-table (to avoid analysis at execution time) and&#x2F;or removing &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt;s entirely.&lt;&#x2F;li&gt;
&lt;li&gt;Introducing static jumps (with relative addresses) and jump tables, and disallowing dynamic jumps at the same time.&lt;&#x2F;li&gt;
&lt;li&gt;Multibyte opcodes without any workarounds.&lt;&#x2F;li&gt;
&lt;li&gt;Representing functions as individual code sections instead of subroutines.&lt;&#x2F;li&gt;
&lt;li&gt;Introducing special sections for different use cases, notably Account Abstraction.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “NOT RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;In order to guarantee that every EOF-formatted contract in the state is valid, we need to prevent already deployed (and not validated) contracts from being recognized as such format. This is achieved by choosing a byte sequence for the &lt;em&gt;magic&lt;&#x2F;em&gt; that doesn&#x27;t exist in any of the already deployed contracts.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;remarks&quot;&gt;Remarks&lt;&#x2F;h3&gt;
&lt;p&gt;If code starts with the &lt;code&gt;MAGIC&lt;&#x2F;code&gt;, it is considered to be EOF formatted, otherwise it is considered to be &lt;em&gt;legacy&lt;&#x2F;em&gt; code. For clarity, the &lt;code&gt;MAGIC&lt;&#x2F;code&gt; together with a version number &lt;em&gt;n&lt;&#x2F;em&gt; is denoted as the &lt;em&gt;EOFn prefix&lt;&#x2F;em&gt;, e.g. &lt;em&gt;EOF1 prefix&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;EOF-formatted contracts are created using new instructions which are introduced in a separate EIP.&lt;&#x2F;p&gt;
&lt;p&gt;The opcode &lt;code&gt;0xEF&lt;&#x2F;code&gt; is currently an undefined instruction, therefore: &lt;em&gt;It pops no stack items and pushes no stack items, and it causes an exceptional abort when executed.&lt;&#x2F;em&gt; This means legacy &lt;em&gt;initcode&lt;&#x2F;em&gt; or already deployed legacy &lt;em&gt;code&lt;&#x2F;em&gt; starting with this instruction will continue to abort execution.&lt;&#x2F;p&gt;
&lt;p&gt;Unless otherwise specified, all integers are encoded in big-endian byte order.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;code-validation&quot;&gt;Code validation&lt;&#x2F;h3&gt;
&lt;p&gt;We introduce &lt;em&gt;code validation&lt;&#x2F;em&gt; for new contract creation. To achieve this, we define a format called EVM Object Format (EOF), containing a version indicator, and a ruleset of validity tied to a given version.&lt;&#x2F;p&gt;
&lt;p&gt;Legacy code is not affected by EOF code validation.&lt;&#x2F;p&gt;
&lt;p&gt;Code validation is performed during contract creation, and is elaborated on in separate EIPs.
The EOF format itself and its formal validation are described in the following sections.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;container-specification&quot;&gt;Container specification&lt;&#x2F;h3&gt;
&lt;p&gt;EOF container is a binary format with the capability of providing the EOF version number and a list of EOF sections.&lt;&#x2F;p&gt;
&lt;p&gt;The container starts with the EOF prefix:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;description&lt;&#x2F;th&gt;&lt;th&gt;length&lt;&#x2F;th&gt;&lt;th&gt;value&lt;&#x2F;th&gt;&lt;th&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;magic&lt;&#x2F;td&gt;&lt;td&gt;2-bytes&lt;&#x2F;td&gt;&lt;td&gt;0xEF00&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;version&lt;&#x2F;td&gt;&lt;td&gt;1-byte&lt;&#x2F;td&gt;&lt;td&gt;0x01–0xFF&lt;&#x2F;td&gt;&lt;td&gt;EOF version number&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The EOF prefix is followed by at least one section header. Each section header contains two fields, &lt;code&gt;section_kind&lt;&#x2F;code&gt; and either &lt;code&gt;section_size&lt;&#x2F;code&gt; or &lt;code&gt;section_size_list&lt;&#x2F;code&gt;, depending on the kind. &lt;code&gt;section_size_list&lt;&#x2F;code&gt; is a list of size values when multiple sections of this kind are allowed, encoded as a count of items followed by the items.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;description&lt;&#x2F;th&gt;&lt;th&gt;length&lt;&#x2F;th&gt;&lt;th&gt;value&lt;&#x2F;th&gt;&lt;th&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;section_kind&lt;&#x2F;td&gt;&lt;td&gt;1-byte&lt;&#x2F;td&gt;&lt;td&gt;0x01–0xFF&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint8&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;section_size&lt;&#x2F;td&gt;&lt;td&gt;2-bytes&lt;&#x2F;td&gt;&lt;td&gt;0x0000–0xFFFF&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint16&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;section_size_list&lt;&#x2F;td&gt;&lt;td&gt;dynamic&lt;&#x2F;td&gt;&lt;td&gt;n&#x2F;a&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint16, uint16+&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The list of section headers is terminated with the &lt;em&gt;section headers terminator byte&lt;&#x2F;em&gt; &lt;code&gt;0x00&lt;&#x2F;code&gt;. The body content follows immediately after.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;container-validation-rules&quot;&gt;Container validation rules&lt;&#x2F;h4&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;version&lt;&#x2F;code&gt; MUST NOT be &lt;code&gt;0&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;section_kind&lt;&#x2F;code&gt; MUST NOT be &lt;code&gt;0&lt;&#x2F;code&gt;. The value &lt;code&gt;0&lt;&#x2F;code&gt; is reserved for &lt;em&gt;section headers terminator byte&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;There MUST be at least one section (and therefore section header).&lt;&#x2F;li&gt;
&lt;li&gt;Stray bytes outside of sections MUST NOT be present. This includes trailing bytes after the last section.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;eof-version-1&quot;&gt;EOF version 1&lt;&#x2F;h3&gt;
&lt;p&gt;EOF version 1 is made up of several EIPs, including this one. Some values in this specification are only discussed briefly. To understand the full scope of EOF, it is necessary to review each EIP in-depth.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;container&quot;&gt;Container&lt;&#x2F;h4&gt;
&lt;p&gt;The EOF version 1 container consists of a &lt;code&gt;header&lt;&#x2F;code&gt; and &lt;code&gt;body&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;container := header, body&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;header := &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    magic, version, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    kind_type, type_size, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    kind_code, num_code_sections, code_size+,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    [kind_container, num_container_sections, container_size+,]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    kind_data, data_size,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    terminator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;body := types_section, code_section+, container_section*, data_section&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;types_section := (inputs, outputs, max_stack_increase)+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;em&gt;note: &lt;code&gt;,&lt;&#x2F;code&gt; is a concatenation operator, &lt;code&gt;+&lt;&#x2F;code&gt; should be interpreted as &quot;one or more&quot; of the preceding item, &lt;code&gt;*&lt;&#x2F;code&gt; should be interpreted as &quot;zero or more&quot; of the preceding item, and &lt;code&gt;[item]&lt;&#x2F;code&gt; should be interpreted as an optional item.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;header&quot;&gt;Header&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;name&lt;&#x2F;th&gt;&lt;th&gt;length&lt;&#x2F;th&gt;&lt;th&gt;value&lt;&#x2F;th&gt;&lt;th&gt;description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;magic&lt;&#x2F;td&gt;&lt;td&gt;2 bytes&lt;&#x2F;td&gt;&lt;td&gt;0xEF00&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;version&lt;&#x2F;td&gt;&lt;td&gt;1 byte&lt;&#x2F;td&gt;&lt;td&gt;0x01&lt;&#x2F;td&gt;&lt;td&gt;EOF version&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;kind_type&lt;&#x2F;td&gt;&lt;td&gt;1 byte&lt;&#x2F;td&gt;&lt;td&gt;0x01&lt;&#x2F;td&gt;&lt;td&gt;kind marker for type section&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;type_size&lt;&#x2F;td&gt;&lt;td&gt;2 bytes&lt;&#x2F;td&gt;&lt;td&gt;0x0004-0x1000&lt;&#x2F;td&gt;&lt;td&gt;16-bit unsigned big-endian integer denoting the length of the type section content, 4 bytes per code section&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;kind_code&lt;&#x2F;td&gt;&lt;td&gt;1 byte&lt;&#x2F;td&gt;&lt;td&gt;0x02&lt;&#x2F;td&gt;&lt;td&gt;kind marker for code size section&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;num_code_sections&lt;&#x2F;td&gt;&lt;td&gt;2 bytes&lt;&#x2F;td&gt;&lt;td&gt;0x0001-0x0400&lt;&#x2F;td&gt;&lt;td&gt;16-bit unsigned big-endian integer denoting the number of the code sections&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;code_size&lt;&#x2F;td&gt;&lt;td&gt;2 bytes&lt;&#x2F;td&gt;&lt;td&gt;0x0001-0xFFFF&lt;&#x2F;td&gt;&lt;td&gt;16-bit unsigned big-endian integer denoting the length of the code section content&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;kind_container&lt;&#x2F;td&gt;&lt;td&gt;1 byte&lt;&#x2F;td&gt;&lt;td&gt;0x03&lt;&#x2F;td&gt;&lt;td&gt;kind marker for container size section&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;num_container_sections&lt;&#x2F;td&gt;&lt;td&gt;2 bytes&lt;&#x2F;td&gt;&lt;td&gt;0x0001-0x0100&lt;&#x2F;td&gt;&lt;td&gt;16-bit unsigned big-endian integer denoting the number of the container sections&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;container_size&lt;&#x2F;td&gt;&lt;td&gt;4 bytes&lt;&#x2F;td&gt;&lt;td&gt;0x00000001-0xFFFFFFFF&lt;&#x2F;td&gt;&lt;td&gt;32-bit unsigned big-endian integer denoting the length of the container section content&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;kind_data&lt;&#x2F;td&gt;&lt;td&gt;1 byte&lt;&#x2F;td&gt;&lt;td&gt;0xFF&lt;&#x2F;td&gt;&lt;td&gt;kind marker for data size section&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;data_size&lt;&#x2F;td&gt;&lt;td&gt;2 bytes&lt;&#x2F;td&gt;&lt;td&gt;0x0000-0xFFFF&lt;&#x2F;td&gt;&lt;td&gt;16-bit unsigned big-endian integer denoting the length of the data section content (*)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;terminator&lt;&#x2F;td&gt;&lt;td&gt;1 byte&lt;&#x2F;td&gt;&lt;td&gt;0x00&lt;&#x2F;td&gt;&lt;td&gt;marks the end of the header&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;(*) For not yet deployed containers this can be greater than the actual content length.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;body&quot;&gt;Body&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;name&lt;&#x2F;th&gt;&lt;th&gt;length&lt;&#x2F;th&gt;&lt;th&gt;value&lt;&#x2F;th&gt;&lt;th&gt;description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;types_section&lt;&#x2F;td&gt;&lt;td&gt;variable&lt;&#x2F;td&gt;&lt;td&gt;n&#x2F;a&lt;&#x2F;td&gt;&lt;td&gt;stores code section metadata&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;inputs&lt;&#x2F;td&gt;&lt;td&gt;1 byte&lt;&#x2F;td&gt;&lt;td&gt;0x00-0x7F&lt;&#x2F;td&gt;&lt;td&gt;number of stack elements the code section consumes&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;outputs&lt;&#x2F;td&gt;&lt;td&gt;1 byte&lt;&#x2F;td&gt;&lt;td&gt;0x00-0x7F&lt;&#x2F;td&gt;&lt;td&gt;number of stack elements the code section returns&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;max_stack_increase&lt;&#x2F;td&gt;&lt;td&gt;2 bytes&lt;&#x2F;td&gt;&lt;td&gt;0x0000-0x03FF&lt;&#x2F;td&gt;&lt;td&gt;maximum increase of the operand stack height by the code section&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;code_section&lt;&#x2F;td&gt;&lt;td&gt;variable&lt;&#x2F;td&gt;&lt;td&gt;n&#x2F;a&lt;&#x2F;td&gt;&lt;td&gt;arbitrary bytecode&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;container_section&lt;&#x2F;td&gt;&lt;td&gt;variable&lt;&#x2F;td&gt;&lt;td&gt;n&#x2F;a&lt;&#x2F;td&gt;&lt;td&gt;arbitrary EOF-formatted container&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;data_section&lt;&#x2F;td&gt;&lt;td&gt;variable&lt;&#x2F;td&gt;&lt;td&gt;n&#x2F;a&lt;&#x2F;td&gt;&lt;td&gt;arbitrary sequence of bytes&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;&lt;strong&gt;NOTE&lt;&#x2F;strong&gt;: A special value of &lt;code&gt;outputs&lt;&#x2F;code&gt; being &lt;code&gt;0x80&lt;&#x2F;code&gt; is designated to denote non-returning functions as defined in a separate EIP.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;eof-version-1-validation-rules&quot;&gt;EOF version 1 validation rules&lt;&#x2F;h4&gt;
&lt;p&gt;The following validity constraints are placed on the container format:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;types_size&lt;&#x2F;code&gt; is divisible by &lt;code&gt;4&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;the number of code sections must be equal to &lt;code&gt;types_size &#x2F; 4&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;data body length may be shorter than &lt;code&gt;data_size&lt;&#x2F;code&gt; for a not yet deployed container&lt;&#x2F;li&gt;
&lt;li&gt;the total size of a container must not exceed &lt;code&gt;MAX_INITCODE_SIZE&lt;&#x2F;code&gt; (as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3860&#x2F;&quot;&gt;EIP-3860&lt;&#x2F;a&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;changes-to-execution-semantics&quot;&gt;Changes to execution semantics&lt;&#x2F;h3&gt;
&lt;p&gt;For an EOF contract:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Execution starts at the first byte of code section 0&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CODESIZE&lt;&#x2F;code&gt;, &lt;code&gt;CODECOPY&lt;&#x2F;code&gt;, &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt;, &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt;, &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt;, &lt;code&gt;GAS&lt;&#x2F;code&gt; are rejected by validation in EOF contracts, with no replacements&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CALL&lt;&#x2F;code&gt;, &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;, &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; are rejected by validation in EOF contracts, replacement instructions to be introduced in a separate EIP.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; (or any replacement instruction for EOF) from an EOF contract to a non-EOF contract (legacy contract, EOA, empty account) is disallowed, and it should fail in the same mode as if the call depth check failed. We allow legacy to EOF path for existing proxy contracts to be able to use EOF upgrades.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;For a legacy contract:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If the target account of &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt; is an EOF contract, then it will copy up to 2 bytes from &lt;code&gt;EF00&lt;&#x2F;code&gt;, as if that would be the code.&lt;&#x2F;li&gt;
&lt;li&gt;If the target account of &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; is an EOF contract, then it will return &lt;code&gt;0x9dbf3648db8210552e9c4f75c6a1c3057c0ca432043bd648be15fe7be05646f5&lt;&#x2F;code&gt; (the hash of &lt;code&gt;EF00&lt;&#x2F;code&gt;, as if that would be the code).&lt;&#x2F;li&gt;
&lt;li&gt;If the target account of &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; is an EOF contract, then it will return 2.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;NOTE&lt;&#x2F;strong&gt; Like for legacy targets, the aforementioned behavior of &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt;, &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; and &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; does not apply to EOF contract targets mid-creation, i.e. those report same as accounts without code.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;EVM and&#x2F;or account versioning has been discussed numerous times over the past years. This proposal aims to learn from them.
See &quot;Ethereum account versioning&quot; on the Fellowship of Ethereum Magicians Forum for a good starting point.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;execution-vs-creation-time-validation&quot;&gt;Execution vs. creation time validation&lt;&#x2F;h3&gt;
&lt;p&gt;This specification introduces creation time validation, which means:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;All created contracts with &lt;em&gt;EOFn&lt;&#x2F;em&gt; prefix are valid according to version &lt;em&gt;n&lt;&#x2F;em&gt; rules. This is very strong and useful property. The client can trust that the deployed code is well-formed.&lt;&#x2F;li&gt;
&lt;li&gt;In the future, this allows to serialize &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; map in the EOF container and eliminate the need of implicit &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; analysis required before execution.&lt;&#x2F;li&gt;
&lt;li&gt;Or to completely remove the need for &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; instructions.&lt;&#x2F;li&gt;
&lt;li&gt;This helps with deprecating EVM instructions and&#x2F;or features.&lt;&#x2F;li&gt;
&lt;li&gt;The biggest disadvantage is that deploy-time validation of EOF code must be enabled in two hard-forks. However, the first step (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3541&#x2F;&quot;&gt;EIP-3541&lt;&#x2F;a&gt;) is already deployed in London.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The alternative is to have execution time validation for EOF. This is performed every single time a contract is executed, however clients may be able to cache validation results. This &lt;em&gt;alternative&lt;&#x2F;em&gt; approach has the following properties:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Because the validation is consensus-level execution step, it means the execution always requires the entire code. This makes &lt;em&gt;code merkleization impractical&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Can be enabled via a single hard-fork.&lt;&#x2F;li&gt;
&lt;li&gt;Better backwards compatibility: data contracts starting with the &lt;code&gt;0xEF&lt;&#x2F;code&gt; byte or the &lt;em&gt;EOF prefix&lt;&#x2F;em&gt; can be deployed. This is a dubious benefit, however.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;the-magic&quot;&gt;The MAGIC&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;The first byte &lt;code&gt;0xEF&lt;&#x2F;code&gt; was chosen because it is reserved for this purpose by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3541&#x2F;&quot;&gt;EIP-3541&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The second byte &lt;code&gt;0x00&lt;&#x2F;code&gt; was chosen to avoid clashes with three contracts which were deployed on &lt;strong&gt;Mainnet&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;0xca7bf67ab492b49806e24b6e2e4ec105183caa01&lt;&#x2F;code&gt;: &lt;code&gt;EFF09f918bf09f9fa9&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;0x897da0f23ccc5e939ec7a53032c5e80fd1a947ec&lt;&#x2F;code&gt;: &lt;code&gt;EF&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;0x6e51d4d9be52b623a3d3a2fa8d3c5e3e01175cd0&lt;&#x2F;code&gt;: &lt;code&gt;EF&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;No contracts starting with &lt;code&gt;0xEF&lt;&#x2F;code&gt; bytes exist on public testnets: Goerli, Ropsten, Rinkeby, Kovan and Sepolia at their London fork block.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;strong&gt;NOTE&lt;&#x2F;strong&gt;: This EIP MUST NOT be enabled on chains which contain bytecodes starting with &lt;code&gt;MAGIC&lt;&#x2F;code&gt; and not being valid EOF.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;eof-version-range-start-with-1&quot;&gt;EOF version range start with 1&lt;&#x2F;h3&gt;
&lt;p&gt;The version number 0 will never be used in EOF, so we can call legacy code &lt;em&gt;EOF0&lt;&#x2F;em&gt;.
Also, implementations may use APIs where 0 version number denotes legacy code.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;section-structure&quot;&gt;Section structure&lt;&#x2F;h3&gt;
&lt;p&gt;We have considered different questions for the sections:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Streaming headers (i.e. &lt;code&gt;section_header, section_data, section_header, section_data, ...&lt;&#x2F;code&gt;) are used in some other formats (such as WebAssembly). They are handy for formats which are subject to editing (adding&#x2F;removing sections). That is not a useful feature for EVM. One minor benefit applicable to our case is that they do not require a specific &quot;header terminator&quot;. On the other hand they seem to play worse with code chunking &#x2F; merkleization, as it is better to have all section headers in a single chunk.&lt;&#x2F;li&gt;
&lt;li&gt;Whether to have a header terminator or to encode &lt;code&gt;number_of_sections&lt;&#x2F;code&gt; or &lt;code&gt;total_size_of_headers&lt;&#x2F;code&gt;. Both raise the question of how large of a value these fields should be able to hold. A terminator byte seems to avoid the problem of choosing a size which is too small without any perceptible downside, so it is the path taken.&lt;&#x2F;li&gt;
&lt;li&gt;(EOF1) Whether to encode section sizes as fixed 16-bit (32-bit for container section size) values or some kind of variable length field (e.g. LEB128). We have opted for fixed size. Should this be limiting in the future, a new EOF version could change the format. Besides simplifying client implementations, not using LEB128 also greatly simplifies on-chain parsing.&lt;&#x2F;li&gt;
&lt;li&gt;Whether or not to have more structure to the container header for all EOF versions to follow. In order to allow future formats optimized for chunking and merkleization (verkleization) it was decided to keep it generic and specify the structure only for a specific EOF version.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;data-only-contracts&quot;&gt;Data-only contracts&lt;&#x2F;h3&gt;
&lt;p&gt;See section &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7480&#x2F;#lack-of-extdatacopy&quot;&gt;Lack of &lt;code&gt;EXTDATACOPY&lt;&#x2F;code&gt; in EIP-7480&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;eof1-contracts-can-only-delegatecall-eof1-contracts&quot;&gt;EOF1 contracts can only &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; EOF1 contracts&lt;&#x2F;h3&gt;
&lt;p&gt;Currently contracts can selfdestruct in three different ways (directly through &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;, indirectly through &lt;code&gt;CALLCODE&lt;&#x2F;code&gt; and indirectly through &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;). &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3670&#x2F;&quot;&gt;EIP-3670&lt;&#x2F;a&gt; disables the first two possibilities, however the third possibility remains. Allowing EOF1 contracts to only &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; other EOF1 contracts allows the following strong statement: EOF1 contract can never be destructed. Attacks based on &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; completely disappear for EOF1 contracts. These include destructed library contracts (e.g. Parity Multisig).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;eof1-containers-have-a-size-limit&quot;&gt;EOF1 containers have a size limit&lt;&#x2F;h3&gt;
&lt;p&gt;Imposing an EOF-validation time limit for the size of EOF containers provides a reference limit of how large the containers should EVM implementations be able to handle when validating and processing containers. &lt;code&gt;MAX_INITCODE_SIZE&lt;&#x2F;code&gt; was chosen for EOF1, as it is what contract creation currently allows for.&lt;&#x2F;p&gt;
&lt;p&gt;Given one of the main reasons for the limit is to avoid attack vectors on &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt;-analysis, and EOF removes the need for &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt;-analysis and introduces a cost structure for deploy-time analysis, in the future this limit could be increased or even lifted for EOF.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;kind-data-could-be-0x04-not-0xff&quot;&gt;&lt;code&gt;kind_data&lt;&#x2F;code&gt; could be &lt;code&gt;0x04&lt;&#x2F;code&gt; not &lt;code&gt;0xff&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Putting the data section last as &lt;code&gt;0xff&lt;&#x2F;code&gt; has the advantage of aligning with the fact that it always comes last. We&#x27;re avoiding a situation that a new section kind would need to go before the data section and break the section kind ordering. At the same time, data section being last is advantageous because it is the section which gets data appended to during contract deployment.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This is a breaking change given that any code starting with &lt;code&gt;0xEF&lt;&#x2F;code&gt; was not deployable before (and resulted in exceptional abort if executed), but now some subset of such codes can be deployed and executed successfully.&lt;&#x2F;p&gt;
&lt;p&gt;The choice of &lt;code&gt;MAGIC&lt;&#x2F;code&gt; guarantees that none of the contracts existing on the chain are affected by the new rules.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;With the anticipated EOF extensions, the validation is expected to have linear computational and space complexity.
We think that the validation cost is sufficiently covered by:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3860&#x2F;&quot;&gt;EIP-3860&lt;&#x2F;a&gt; for &lt;em&gt;initcode&lt;&#x2F;em&gt;,&lt;&#x2F;li&gt;
&lt;li&gt;high per-byte cost of deploying &lt;em&gt;code&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Reject new contract code starting with the 0xEF byte</title>
        <published>2021-03-16T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	<author>
		<name>Paweł Bylica</name><uri>https://github.com/chfast</uri>
	</author>
	
	<author>
		<name>Andrei Maiboroda</name><uri>https://github.com/gumb0</uri>
	</author>
	
	<author>
		<name>Alexey Akhunov</name><uri>https://github.com/AlexeyAkhunov</uri>
	</author>
	
	<author>
		<name>Christian Reitwiessner</name><uri>https://github.com/chriseth</uri>
	</author>
	
	<author>
		<name>Martin Swende</name><uri>https://github.com/holiman</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3541/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/evm-object-format-eof/5727" />
        

        <id>https://wg-eips.ritovision.com/3541/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:3541"
            label="EIP-3541" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3541/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Disallow new code starting with the &lt;code&gt;0xEF&lt;&#x2F;code&gt; byte to be deployed. Code already existing in the account trie starting with &lt;code&gt;0xEF&lt;&#x2F;code&gt; byte is not affected semantically by this change.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Contracts conforming to the EVM Object Format (EOF) are going to be validated at deploy time. In order to guarantee that every EOF-formatted contract in the state is valid, we need to prevent already deployed (and not validated) contracts from being recognized as such format. This will be achieved by choosing a byte sequence for the &lt;em&gt;magic&lt;&#x2F;em&gt; that doesn&#x27;t exist in any of the already deployed contracts. To prevent the growth of the search space and to limit the analysis to the contracts existing before this fork, we disallow the starting byte of the format (the first byte of the magic).&lt;&#x2F;p&gt;
&lt;p&gt;Should the EVM Object Format proposal not be deployed in the future, the &lt;em&gt;magic&lt;&#x2F;em&gt; can be used by other features depending on versioning. In the case versioning becomes obsolete, it is simple to roll this back by allowing contracts starting with the &lt;code&gt;0xEF&lt;&#x2F;code&gt; byte to be deployed again.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;After &lt;code&gt;block.number == HF_BLOCK&lt;&#x2F;code&gt; new contract creation (via create transaction, &lt;code&gt;CREATE&lt;&#x2F;code&gt; or &lt;code&gt;CREATE2&lt;&#x2F;code&gt; instructions) results in an exceptional abort if the &lt;em&gt;code&lt;&#x2F;em&gt;&#x27;s first byte is &lt;code&gt;0xEF&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;remarks&quot;&gt;Remarks&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;em&gt;initcode&lt;&#x2F;em&gt; is the code executed in the context of the &lt;em&gt;create&lt;&#x2F;em&gt; transaction, &lt;code&gt;CREATE&lt;&#x2F;code&gt;, or &lt;code&gt;CREATE2&lt;&#x2F;code&gt; instructions. The &lt;em&gt;initcode&lt;&#x2F;em&gt; returns &lt;em&gt;code&lt;&#x2F;em&gt; (via the &lt;code&gt;RETURN&lt;&#x2F;code&gt; instruction), which is inserted into the account. See section 7 (&quot;Contract Creation&quot;) in the Yellow Paper for more information.&lt;&#x2F;p&gt;
&lt;p&gt;The opcode &lt;code&gt;0xEF&lt;&#x2F;code&gt; is currently an undefined instruction, therefore: &lt;em&gt;It pops no stack items and pushes no stack items, and it causes an exceptional abort when executed.&lt;&#x2F;em&gt; This means &lt;em&gt;initcode&lt;&#x2F;em&gt; or already deployed &lt;em&gt;code&lt;&#x2F;em&gt; starting with this instruction will continue to abort execution.&lt;&#x2F;p&gt;
&lt;p&gt;The exceptional abort due to &lt;em&gt;code&lt;&#x2F;em&gt; starting with &lt;code&gt;0xEF&lt;&#x2F;code&gt; behaves exactly the same as any other exceptional abort that can occur during &lt;em&gt;initcode&lt;&#x2F;em&gt; execution, i.e. in case of abort all gas provided to a &lt;code&gt;CREATE*&lt;&#x2F;code&gt; or create transaction is consumed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;0xEF&lt;&#x2F;code&gt; byte was chosen because it resembles &lt;strong&gt;E&lt;&#x2F;strong&gt;xecutable &lt;strong&gt;F&lt;&#x2F;strong&gt;ormat.&lt;&#x2F;p&gt;
&lt;p&gt;Contracts using unassigned opcodes are generally understood to be at risk of changing semantics. Hence using the unassigned &lt;code&gt;0xEF&lt;&#x2F;code&gt; should have lesser effects, than choosing an assigned opcode, such as &lt;code&gt;0xFD&lt;&#x2F;code&gt; (&lt;code&gt;REVERT&lt;&#x2F;code&gt;), &lt;code&gt;0xFE&lt;&#x2F;code&gt; (&lt;code&gt;INVALID)&lt;&#x2F;code&gt;, or &lt;code&gt;0xFF&lt;&#x2F;code&gt; (&lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;). Arguably while such contracts may not be very useful, they are still using valid opcodes.&lt;&#x2F;p&gt;
&lt;p&gt;Analysis in May 2021, on &lt;code&gt;18084433&lt;&#x2F;code&gt; contracts in state, showed that there are 0 existing contracts starting with the &lt;code&gt;0xEF&lt;&#x2F;code&gt; byte, as opposed to 1, 4, and 12 starting with &lt;code&gt;0xFD&lt;&#x2F;code&gt;, &lt;code&gt;0xFE&lt;&#x2F;code&gt;, and &lt;code&gt;0xFF&lt;&#x2F;code&gt;, respectively.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Each test case below may be executed in 3 different contexts:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;create transaction (no account code)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CREATE&lt;&#x2F;code&gt;, with account code: &lt;code&gt;0x6000356000523660006000f0151560165760006000fd5b&lt;&#x2F;code&gt; (Yul code: &lt;code&gt;mstore(0, calldataload(0)) if iszero(create(0, 0, calldatasize())) { revert(0, 0) }&lt;&#x2F;code&gt;),&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CREATE2&lt;&#x2F;code&gt;, with account code: &lt;code&gt;0x60003560005260003660006000f5151560185760006000fd5b&lt;&#x2F;code&gt; (Yul code: &lt;code&gt;mstore(0, calldataload(0)) if iszero(create2(0, 0, calldatasize(), 0)) { revert(0, 0) }&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Case&lt;&#x2F;th&gt;&lt;th&gt;Calldata&lt;&#x2F;th&gt;&lt;th&gt;Expected result&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;deploy one byte &lt;code&gt;ef&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x60ef60005360016000f3&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;new contract not deployed, transaction fails&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;deploy two bytes &lt;code&gt;ef00&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x60ef60005360026000f3&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;new contract not deployed, transaction fails&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;deploy three bytes &lt;code&gt;ef0000&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x60ef60005360036000f3&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;new contract not deployed, transaction fails&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;deploy 32 bytes &lt;code&gt;ef00...00&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x60ef60005360206000f3&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;new contract not deployed, transaction fails&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;deploy one byte &lt;code&gt;fe&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x60fe60005360016000f3&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;new contract deployed, transaction succeeds&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This is a breaking change given new code starting with the &lt;code&gt;0xEF&lt;&#x2F;code&gt; byte will not be deployable, and contract creation will result in a failure. However, given bytecode is executed starting at its first byte, code deployed with &lt;code&gt;0xEF&lt;&#x2F;code&gt; as the first byte is not executable anyway.&lt;&#x2F;p&gt;
&lt;p&gt;While this means no currently executable contract is affected, it does rejects deployment of new data contracts starting with the &lt;code&gt;0xEF&lt;&#x2F;code&gt; byte.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The authors are not aware of any security or DoS risks posed by this change.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>5 FNV primes for ethash</title>
        <published>2021-03-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>mineruniter969</name><uri>https://github.com/mineruniter969</uri>
	</author>
	
	<author>
		<name>mineruniter969</name><email>mineruniter969@tutanota.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3372/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3372-apply-minor-modifications-to-the-ethash-algorithm-to-break-current-asic-implementations-eip-969-resubmission/5655" />
        

        <id>https://wg-eips.ritovision.com/3372/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:3372"
            label="EIP-3372" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3372/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce 5 new FNV primes into the ethash algorithm.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is to kick current ASIC implementations out of the network to keep the Ethereum network secure and healthy by changing the &lt;code&gt;fnv&lt;&#x2F;code&gt; constants.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;ASICs provide a severe centralization risk for the Ethereum network. If we do not get rid of them, small GPU miners will be forced to exit the Ethereum mining because EIP-1559 will make them mining at a loss. Furthermore, ASIC production will be concentrated only at one or two parties, which will make the Ethereum hashrate centralized. Also, it is worth noting that Ethash ASIC machines cost 10k+ USD, while GPUs are priced less than 1000 USD.&lt;&#x2F;p&gt;
&lt;p&gt;With GPUs, miners can switch to other mining algorithms, but with ASICs, it is impossible. Leaving everything as-is will almost certainly a very tough (from the side of miners) integration of the Ethereum 2.0.&lt;&#x2F;p&gt;
&lt;p&gt;In short, this EIP is required to keep the Ethereum network stable and decentralized by keeping the ASIC business away.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= ETHASH11_BLKNUM&lt;&#x2F;code&gt;, activate the &lt;code&gt;ethash1.1&lt;&#x2F;code&gt; algorithm version.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;ethash1-1&quot;&gt;ethash1.1&lt;&#x2F;h3&gt;
&lt;p&gt;Prior to this change, &lt;code&gt;fnv&lt;&#x2F;code&gt; hash function is used throughout the &lt;code&gt;hashimoto&lt;&#x2F;code&gt; function. &lt;code&gt;fnv&lt;&#x2F;code&gt; is identical for all steps, &lt;code&gt;ethash1.1&lt;&#x2F;code&gt; will introduce additional &lt;code&gt;fnvA&lt;&#x2F;code&gt;, &lt;code&gt;fnvB&lt;&#x2F;code&gt;, &lt;code&gt;fnvC&lt;&#x2F;code&gt;, &lt;code&gt;fnvD&lt;&#x2F;code&gt;, and &lt;code&gt;fnvE&lt;&#x2F;code&gt; functions. All those functions will have different FNV constants.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; Previously used FNV prime&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#define FNV_PRIME_0 0x1000193&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; New FNV primes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#define FNV_PRIME_A 0x10001a7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#define FNV_PRIME_B 0x10001ab&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#define FNV_PRIME_C 0x10001cf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#define FNV_PRIME_D 0x10001e3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#define FNV_PRIME_E 0x10001f9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Prior to this EIP, all parts of Ethash are using the &lt;code&gt;fnv&lt;&#x2F;code&gt; (hereinafter referenced as &lt;code&gt;fnv0&lt;&#x2F;code&gt;) function.  As of the introduction of this EIP:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;fnvA&lt;&#x2F;code&gt; replaces &lt;code&gt;fnv0&lt;&#x2F;code&gt; in the DAG item selection step&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;fnvB&lt;&#x2F;code&gt; replaces &lt;code&gt;fnv0&lt;&#x2F;code&gt; in the DAG item mix step&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;fnvC(fnvD(fnvE&lt;&#x2F;code&gt; replaces &lt;code&gt;fnv0(fnv0(fnv0(&lt;&#x2F;code&gt; in the compress mix step&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;fnv0&lt;&#x2F;code&gt; in the DAG generation step should remain unchanged.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;ASIC Miners have become a threat to the future of Ethereum and a hard fork is required to remove them from the network before additional damage is caused. EIP-3372 proposes the minimum necessary to do so and will not affect ETH stakeholders or the network like Ethash 2.0 would. The threat ASICs pose is legal, social, moral, technical, monetary, and environmental. As we continue to come closer to the merge ASICs will attack the network and the developers personally as they have done in the past because miners will always pursue profits.&lt;&#x2F;p&gt;
&lt;p&gt;Legally and socially ASIC&#x27;s have previously been a threat and a nuisance. As Hudson describes Linzhi attacked the EF and developers personally seeking to spread lies and misinformation while sending legal threats during discussions around EIP-1057. His account is &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;Souptacular&#x2F;linzhi&quot;&gt;here&lt;&#x2F;a&gt; and in his own words&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;ASIC manufacturer Linzhi has both pressured me and told lies&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;With their attacks and harassment on staff demonstrated in the below image:
&lt;img src=&quot;upload:&#x2F;&#x2F;n8TJsS8hEEH4DXYJ2WDzblm5qJo.jpeg&quot; alt=&quot;&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Socially and morally the Ethereum community must adopt a no-tolerance policy towards personal attacks on its developers. It is only because of the core developers that Ethereum has value, the community cannot allow large companies free reign to attack them personally and must seek to protect each developer as they are a resource that keeps Ethereum viable. Multiple developers were &quot;burned&quot; during this event. As we accelerate the merge, it is likely that ASIC companies will repeat their actions and again attack the developers personally while pursuing legal options. This is seen not only by their actions during EIP-1057 but recent discussion around EIP-969 where legal threats from them caused the champion of that EIP to dropout and forcing me to submit this EIP anonymously. Ethereum cannot allow its actors to be threatened without consequence and this is a fight that must happen now while they are weak rather than pre-merge where they are stronger which will result in a delayed merge and hurt the value of Ethereum.&lt;&#x2F;p&gt;
&lt;p&gt;ASICs have the greatest incentives and resources to commit bad acts because they are centralized in farms this is why Vitalik designed ETH to be ASIC-resistant because ASICs had ruined BTC&#x27;s principles of decentralization. Each day their power and control over the network grows. ASICs are against the founding principles of Ethereum which promotes a decentralized system run by common people, not a single owner of large warehouses. F2Pool which consists largely of ASIC farms has become the #3 largest pool controlling around 10% of hashrate. Their farms can be viewed on their webpage. In November 2020 they were 23TH&#x2F;s yet today they are 45.6 TH&#x2F;s. That&#x27;s a doubling in 4 months and their growth is accelerating as additional ASICs come online. ASICs are becoming a threat that will soon dominate the network and action must be taken now to head them off.&lt;&#x2F;p&gt;
&lt;p&gt;ASICs on F2Pool have long been known to be &quot;bad actors&quot; on the BTC network. They are known for market manipulation and dumping BTC to manipulate prices (I could not post the source link as this is a new account). What will these ASICs do once they find out that they are about to lose millions prior to the merge? Ethereum is not just a network it is a community and they will use their financial resources and pour millions into delaying the merge as they launch legal case after legal case. They will attack the developers and the community as they seek to squeeze every last dollar.&lt;&#x2F;p&gt;
&lt;p&gt;The reason Ethereum was founded on the principle of being anti-ASIC is because Vitalik had seen the damage ASICs had caused to the BTC network as they pursued profits rather than the betterment of the network. GPU miners are decentralized and disorganized which makes them a much lower threat than warehouses under one central corporation that is outside the legal system and thus cannot be held to account for bad acts.&lt;&#x2F;p&gt;
&lt;p&gt;EIP-3372 also works to protect the environment. Post merge, gpus will go into the secondary market or move to other coins. However, ASICs will become junk. As more ASICs are produced, Ethereum increases its environmental footprint. These ASICs are being mass produced in greater numbers despite it being public that the merge is being accelerated. It is clear that these ASIC manufacturers and buyers must either be ignorant of the accelerated merge or plan to delay it. Because they dump their ETH they have no stake in the network except the money they can squeeze from it and if by making trouble they can give themselves another day than they will do it.&lt;&#x2F;p&gt;
&lt;p&gt;Finally, Ethereum has always sought to pursue &quot;minimum issuance&quot;. By reducing the amount of miners that can pose a threat to the network, Ethereum also decreases how much it needs to pay for protection. Some EIP&#x27;s are being prepared to increase miner incomes post EIP-1559 should a threat appear. EIP-3372 eliminates the need to pay more for security and allows miners to be paid less without compromising the network&#x27;s security. As we go forward closer to the merge, the community must reduce attack vectors so as to reduce the cost of the merge itself and maximize the security of the network. The community already pays too much for protection and by reducing threats we can reduce this cost. ASIC warehouse farms are dumping all the ETH they make which is suppressing the price of ETH. Although rare, several individual GPU miners are taking part in staking or have gone on to join the community in development or our financial endeavors. They thus are more valuable to the community than a warehouse of future junk. There is no need for the Ethereum community to continue to pay for soon-to-be obsolete hardware that will end up in landfills.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;technical-overview&quot;&gt;Technical Overview&lt;&#x2F;h3&gt;
&lt;p&gt;Ethash 1.1 will replace the only FNV prime with five new primes at the stage of the hash computation. The prime used for the DAG generation is remained unchanged, while all others are be changed. This will not prevent ASIC companies from creating new ASICs that adapt but so close to the merge it is unlikely they will do so, and even if they do they are unlikely to be able to produce enough to again be a threat.
The choice of FNV constants are based on the formal specification that is available on &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ietf&quot;&gt;https:&#x2F;&#x2F;tools.ietf.org&#x2F;html&#x2F;draft-eastlake-fnv-14#section-2.1&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;We apologize for the delay in submitting the justification for this EIP. As the community may or may not be aware, the original champion was forced to stop working on this EIP due to legal attacks from ASIC companies. It has taken us this long to review his work and find a new champion. To protect ourselves we are submitting this anonymously and would request the community&#x27;s aid in our endeavor to maintain our anonymity and some lenience given the circumstances and threats we face pursuing this EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Mining hardware that is optimized for ethash may no longer work if the &lt;code&gt;fnv&lt;&#x2F;code&gt; constants are baked into the hardware and cannot be changed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-vectors&quot;&gt;Test Vectors&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;first&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;4242424242424242&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;mixHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;aa6a928db9b548ebf20fc9a74e9200321426f1c2db1571636cdd3a33eb162b36&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;header&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;f901f3a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a09178d0f23c965d81f0834a4c72c6253ce6830f4022b1359aaebfc1ecba442d4ea056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080830f4240808080a058f759ede17a706c93f13030328bcea40c1d1341fb26f2facd21ceb0dae57017884242424242424242&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;seed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;3972318778d2af9d3c5c3dfc463bc2a5ebeebd1a7a04392708ff94d29aa18c5f&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;cache_size&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 16776896&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;full_size&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1073739904&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;header_hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2a8de2adf89af77358250bf908bf04ba94a6e8c3ba87775564a41d269a05e4ce&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;cache_hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;35ded12eecf2ce2e8da2e15c06d463aae9b84cb2530a00b932e4bbc484cde353&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;second&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;307692cf71b12f6d&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;mixHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;4a2ef8287dc21f5def0d4e9694208c56e574b1692d7b254822a3f4704d8ad1ba&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;header&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;f901f7a01bef91439a3e070a6586851c11e6fd79bbbea074b2b836727b8e75c7d4a6b698a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d4934794ea3cb5f94fa2ddd52ec6dd6eb75cf824f4058ca1a00c6e51346be0670ce63ac5f05324e27d20b180146269c5aab844d09a2b108c64a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302004002832fefd880845511ed2a80a0e55d02c555a7969361cf74a9ec6211d8c14e4517930a00442f171bdb1698d17588307692cf71b12f6d&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;seed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;5ab98957ba5520d4e367080f442e37a047cfd9d2857b6e00dd12d82900d108a6&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;cache_size&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 16776896&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;full_size&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1073739904&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;header_hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;100cbec5e5ef82991290d0d93d758f19082e71f234cf479192a8b94df6da6bfe&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;cache_hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;35ded12eecf2ce2e8da2e15c06d463aae9b84cb2530a00b932e4bbc484cde353&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;There are no known security issues with this change.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Predictable Proof-of-Work (POW) Sunsetting</title>
        <published>2021-03-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Query0x</name><uri>https://github.com/Query0x</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3374/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3374-predictable-proof-of-work-sunsetting" />
        

        <id>https://wg-eips.ritovision.com/3374/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:3374"
            label="EIP-3374" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3374/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Sets block reward to 3 and reduces it to 1 linearly over the course of about 1 year.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Sets the block reward to 3 ETH and then incrementally decreases it every block for 2,362,000 blocks (approximately 1 year) until it reaches 1 ETH.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Unnecessarily abrupt changes to the Ethereum ecosystem cause disruption and disharmony resulting in the disenfranchisement of community members while undermining stability and confidence.  While moves from Proof-of-Work to Proof-of-Stake will undoubtedly cause friction between those community members vested in either, all benefit from a measured, predictable transition.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Is issuance neutral over 1 year, and reduces issuance beyond that.&lt;&#x2F;li&gt;
&lt;li&gt;Sets an initial block reward of 3;&lt;&#x2F;li&gt;
&lt;li&gt;Introduces an ongoing, predictable reduction in future mining rewards down to 1, effectively &quot;sunsetting&quot; POW and codifying the move to POS;&lt;&#x2F;li&gt;
&lt;li&gt;Reduces economic incentives for continued development of ASICs;&lt;&#x2F;li&gt;
&lt;li&gt;Allows the impacts of decreasing miner rewards to be measured and monitored rather than relying on conjecture and game theory, so adjustments can be made if necessary.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;TRANSITION_START_BLOCK_NUMBER: TBD&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TRANSITION_DURATION: 2_362_000&lt;&#x2F;code&gt; &#x2F;&#x2F; (about one year)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TRANSITION_END_BLOCK_NUMBER: FORK_BLOCK_NUMBER + TRANSITION_DURATION&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;STARTING_REWARD: 3_000_000_000_000_000_000&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ENDING_REWARD: 1_000_000_000_000_000_000&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;REWARD_DELTA: STARTING_REWARD - ENDING_REWARD&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;block-reward&quot;&gt;Block Reward&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TRANSITION_END_BLOCK_NUMBER&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block_reward&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ENDING_REWARD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;elif&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TRANSITION_START_BLOCK_NUMBER&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block_reward&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; STARTING_REWARD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;elif&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TRANSITION_START_BLOCK_NUMBER&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block_reward&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; STARTING_REWARD&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; REWARD_DELTA&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TRANSITION_DURATION&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TRANSITION_START_BLOCK_NUMBER&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Picking starting and ending block reward values that are equidistant from the current block reward rate of 2 ensures the impact of this EIP will be issuance neutral over the one year time frame.  Temporarily raising the block reward to 3 blunts the initial impact of a sudden miner revenue decrease and the continual reductions thereafter codify Ethereum&#x27;s move to POS by increasingly disincentivizing POW.  Importantly, this approach moderates the rate of change so impacts and threats can be measured and monitored.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;There are no known backward compatibility issues with the introduction of this EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;There are no known security issues with the introduction of this EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via CC0.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Hardcoded Block Gas Limit</title>
        <published>2021-03-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Philippe Castonguay</name><uri>https://github.com/PhABC</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3382/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3382-hardcoded-gas-limit" />
        

        <id>https://wg-eips.ritovision.com/3382/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:3382"
            label="EIP-3382" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3382/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Hardcode the block gas limit to &lt;code&gt;12,500,000&lt;&#x2F;code&gt; gas per block.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Updates the block validation rules such that a block is invalid if the &lt;code&gt;gas_limit&lt;&#x2F;code&gt; header field is not equal to &lt;code&gt;12,500,000&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Both Ethereum&#x27;s Proof of Work and Proof of Stake designs assume that block producers are financially rational, but does not assume block producers to be benevolent. There is one exception however, and it is when block producers choose the gas limit of a block where it is assumed that block producers care about the long term health and decentralisation of the chain. Indeed, the block gas limit is one of the only parameters in Ethereum that is not dictated by node consensus, but instead is chosen by block producers. This decision was initially made to allow urgent changes in the block gas limit if necessary. Both drastically increasing or decreasing this parameter could have serious consequences that may not be desired. It is therefore a critical parameter that should require node consensus to avoid any sudden harmful change imposed by a small number of actors on the rest of the network.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Refer to &lt;code&gt;gasLimit&lt;&#x2F;code&gt; as &lt;code&gt;gasTarget&lt;&#x2F;code&gt; post EIP-1559.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;added-consensus-constraint&quot;&gt;Added Consensus Constraint&lt;&#x2F;h3&gt;
&lt;p&gt;As of &lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt;, the &lt;code&gt;header.gasLimit&lt;&#x2F;code&gt; &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be equal to &lt;code&gt;BLOCK_GAS_LIMIT&lt;&#x2F;code&gt;, where &lt;code&gt;BLOCK_GAS_LIMIT&lt;&#x2F;code&gt; is a hardcoded constant set to &lt;code&gt;12,500,000&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;keeping-gaslimit-in-block-headers&quot;&gt;Keeping gasLimit in Block Headers&lt;&#x2F;h3&gt;
&lt;p&gt;While it would be possible to remove the &lt;code&gt;gasLimit&lt;&#x2F;code&gt; field from block headers, it would change the data structure to be hashed, which could lead to unintended consequences. It is therefore easier to leave the gasLimit as part of block headers.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;chosen-gas-limit&quot;&gt;Chosen Gas Limit&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;12,500,000&lt;&#x2F;code&gt; value is being proposed as it&#x27;s the current block gas limit as of time of writing this EIP. The actual amount could be altered with a subsequent EIP to avoid deviating from the core intent of this EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is backward compatible.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Rapid changes to the gas limit will likely be more difficult to execute, which could be problematic if an urgent situation arise that required changing the gas limit.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Increase block rewards to 3 ETH, with 2 Year Decay to 1 ETH Scheduled</title>
        <published>2021-03-12T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Michael D. Carter</name><uri>https://github.com/BitsBeTrippin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3368/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3368-block-reward-increase-w-decay-for-next-two-years/5550" />
        

        <id>https://wg-eips.ritovision.com/3368/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:3368"
            label="EIP-3368" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3368/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Changes the block reward paid to proof-of-work (POW) miners to 3 ETH from existing 2 ETH and starts a decay schedule for next two years to 1 ETH Block Reward.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Set the block reward to 3 ETH and then decrease it slightly every block for 4,724,000 blocks (approximately 2 years) until it reaches 1 ETH.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;A sudden drop in PoW mining rewards could result in a sudden precipitous decrease in mining profitability that may drive miners to auction off their hashrate to the highest bidder while they figure out what to do with their now &quot;worthless&quot; hardware. If enough hashrate is auctioned off in this way at the same time, an attacker will be able to rent a large amount of hashing power for a short period of time at relatively low cost vs. reward and potentially attack the network. By setting the block reward to X (where X is enough to offset the sudden profitability decrease) and then decreasing it over time to Y (where Y is a number below the sudden profitability decrease), we both avoid introducing long term inflation while at the same time spreading out the rate that individual miners cross into a transitional range. This approach offers a higher level of confidence and published schedule of yield, while allowing mining participants time to gracefully repurpose&#x2F;sell their hardware. This greatly increases ethereums PoW security by keeping incentives aligned to ethereum and not being force projected to short term brokerage for the highest bidder. Additionally the decay promotes a known schedule of a deflationary curve, aligning to the overall Minimal Viable Issuance directive aligned to a 2 year transition schedule for Proof of Stake, consensus replacement of Proof of Work. Security is paramount in cryptocurrency blockchains and the risk to a 51% non-resistant chain is real. The scope of Ethereum&#x27;s current hashrate has expanded to hundreds of thousands of new participants and over 2.5x original ATH hashrate&#x2F;difficulty. While the largest by hashrate crypto is bitcoin, ethereum is not far behind the total network size in security aspects. This proposal is focused to keep that superiority in security one of the key aspects.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Adjust block, uncle, and nephew rewards&lt;&#x2F;p&gt;
&lt;h3 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;TRANSITION_START_BLOCK_NUMBER: TBD&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TRANSITION_DURATION: 4_724_000&lt;&#x2F;code&gt; (about two years)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TRANSITION_END_BLOCK_NUMBER: FORK_BLOCK_NUMBER + TRANSITION_DURATION&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;STARTING_REWARD: 3_000_000_000_000_000_000&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ENDING_REWARD: 1_000_000_000_000_000_000&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;REWARD_DELTA: STARTING_REWARD - ENDING_REWARD&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;block-reward&quot;&gt;Block Reward&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TRANSITION_END_BLOCK_NUMBER&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block_reward&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ENDING_REWARD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;elif&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TRANSITION_START_BLOCK_NUMBER&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block_reward&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; STARTING_REWARD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;elif&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TRANSITION_START_BLOCK_NUMBER&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block_reward&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; STARTING_REWARD&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; REWARD_DELTA&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TRANSITION_DURATION&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TRANSITION_START_BLOCK_NUMBER&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;2 years was chosen because it gives miners sufficient time to find alternative uses for their hardware and&#x2F;or get their hardware back out onto the open market (e.g., in the form of gaming GPUs) without flooding the market suddenly. This proposal should ONLY be considered as a last resort as something we have in our pocket should the &quot;network need to attract hashing power quickly and then bleed it off over time&quot; rather than &quot;something that is scheduled to be included in X hard fork&quot; ; Recommendation to have in a fast track state, but NOT deployed to mainnet unless needed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;There are no known backward compatibility issues with the introduction of this EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;There are no known security issues with the introduction of this EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via CC0.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>ERC-721 and ERC-1155 to ERC-20 Wrapper</title>
        <published>2021-03-12T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Calvin Koder</name><uri>https://github.com/ashrowz</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3386/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/3384" />
        

        <id>https://wg-eips.ritovision.com/3386/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:3386"
            label="ERC-3386" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3386/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;A standard interface for contracts that create generic ERC-20 tokens which derive from a pool of unique ERC-721&#x2F;ERC-1155 tokens.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard outlines a smart contract interface to wrap identifiable tokens with fungible tokens. This allows for derivative &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens to be minted by locking the base &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; non-fungible tokens and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; multi tokens into a pool. The derivative tokens can be burned to redeem base tokens out of the pool. These derivatives have no reference to the unique id of these base tokens, and should have a proportional rate of exchange with the base tokens. As representatives of the base tokens, these generic derivative tokens can be traded and otherwise utilized according to ERC-20, such that the unique identifier of each base token is irrelevant.&lt;&#x2F;p&gt;
&lt;p&gt;ERC-721 and ERC-1155 tokens are considered valid base, tokens because they have unique identifiers and are transferred according to similar rules. This allows for both ERC-721 NFTs and ERC-1155 Multi-Tokens to be wrapped under a single common interface.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The ERC-20 token standard is the most widespread and liquid token standard on Ethereum. ERC-721 and ERC-1155 tokens on the other hand can only be transferred by their individual ids, in whole amounts. Derivative tokens allow for exposure to the base asset while benefiting from contracts which utilize ERC-20 tokens. This allows for the base tokens to be fractionalized, traded and pooled generically on AMMs, collateralized, and be used for any other ERC-20 type contract. Several implementations of this proposal already exist without a common standard.&lt;&#x2F;p&gt;
&lt;p&gt;Given a fixed exchange rate between base and derivative tokens, the value of the derivative token is proportional to the floor price of the pooled tokens. With the derivative tokens being used in AMMs, there is opportunity for arbitrage between derived token markets and the base NFT markets. By specifying a subset of base tokens which may be pooled, the difference between the lowest and highest value token in the pool may be minimized. This allows for higher value tokens within a larger set to be poolable. Additionally, price calculations using methods such as Dutch auctions, as implemented by NFT20, allow for price discovery of subclasses of base tokens. This allows the provider of a higher value base token to receive a proportionally larger number of derivative tokens than a token worth the floor price would receive.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.ietf.org&#x2F;rfc&#x2F;rfc2119.txt&quot;&gt;RFC 2119&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Every IWrapper compliant contract must implement the &lt;code&gt;IWrapper&lt;&#x2F;code&gt; and &lt;code&gt;ERC165&lt;&#x2F;code&gt; interfaces&lt;&#x2F;strong&gt; :&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; IWrapper Identifiable Token Wrapper Standard&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; {Wrapper} refers to any contract implementing this interface.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; {Base} refers to any ERC-721 or ERC-1155 contract. It MAY be the {Wrapper}.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; {Pool} refers to the contract which holds the {Base} tokens. It MAY be the {Wrapper}.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; {Derivative} refers to the ERC-20 contract which is minted&#x2F;burned by the {Wrapper}. It MAY be the {Wrapper}.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; All uses of &amp;quot;single&amp;quot;, &amp;quot;batch&amp;quot; refer to the number of token ids. This includes individual ERC-721 tokens by id, and multiple ERC-1155 by id. An ERC-1155 `TransferSingle` event may emit with a `value` greater than `1`, but it is still considered a single token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; All parameters named `_amount`, `_amounts` refer to the `value` parameters in ERC-1155. When using this interface with ERC-721, `_amount` MUST be 1, and `_amounts` MUST be either an empty list or a list of 1 with the same length as `_ids`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IWrapper&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is ERC165 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST emit when a mint occurs where a single {Base} token is received by the {Pool}.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * The `_from` argument MUST be the address of the account that sent the {Base} token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * The `_to` argument MUST be the address of the account that received the {Derivative} token(s).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * The `_id` argument MUST be the id of the {Base} token transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * The `_amount` argument MUST be the number of {Base} tokens transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * The `_value` argument MUST be the number of {Derivative} tokens minted.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MintSingle&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST emit when a mint occurs where multiple {Base} tokens are received by the {Wrapper}.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * The `_from` argument MUST be the address of the account that sent the {Base} tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * The `_to` argument MUST be the address of the account that received the {Derivative} token(s).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * The `_ids` argument MUST be the list ids of the {Base} tokens transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * The `_amounts` argument MUST be the list of the numbers of {Base} tokens transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * The `_value` argument MUST be the number of {Derivative} tokens minted.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MintBatch&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _ids&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _amounts&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST emit when a burn occurs where a single {Base} token is sent by the {Wrapper}.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * The `_from` argument MUST be the address of the account that sent the {Derivative} token(s).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * The `_to` argument MUST be the address of the account that received the {Base} token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * The `_id` argument MUST be the id of the {Base} token transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * The `_amount` argument MUST be the number of {Base} tokens transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * The `_value` argument MUST be the number of {Derivative} tokens burned.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BurnSingle&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST emit when a mint occurs where multiple {Base} tokens are sent by the {Wrapper}.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * The `_from` argument MUST be the address of the account that sent the {Derivative} token(s).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * The `_to` argument MUST be the address of the account that received the {Base} tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * The `_ids` argument MUST be the list of ids of the {Base} tokens transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * The `_amounts` argument MUST be the list of the numbers of {Base} tokens transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * The `_value` argument MUST be the number of {Derivative} tokens burned.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BurnBatch&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _ids&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _amounts&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfers the {Base} token with `_id` from `msg.sender` to the {Pool} and mints {Derivative} token(s) to `_to`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;       Target address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;       Id of the {Base} token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   Amount of the {Base} token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Emits a {MintSingle} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfers `_amounts[i]` of the {Base} tokens with `_ids[i]` from `msg.sender` to the {Pool} and mints {Derivative} token(s) to `_to`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;       Target address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _ids&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      Ids of the {Base} tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _amounts&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  Amounts of the {Base} tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Emits a {MintBatch} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; batchMint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _ids&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amounts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Burns {Derivative} token(s) from `_from` and transfers `_amounts` of some {Base} token from the {Pool} to `_to`. No guarantees are made as to what token is withdrawn.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     Source address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;       Target address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   Amount of the {Base} tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Emits either a {BurnSingle} or {BurnBatch} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; burn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Burns {Derivative} token(s) from `_from` and transfers `_amounts` of some {Base} tokens from the {Pool} to `_to`. No guarantees are made as to what tokens are withdrawn.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     Source address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;       Target address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _amounts&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  Amounts of the {Base} tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Emits either a {BurnSingle} or {BurnBatch} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; batchBurn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amounts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Burns {Derivative} token(s) from `_from` and transfers `_amounts[i]` of the {Base} tokens with `_ids[i]` from the {Pool} to `_to`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     Source address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;       Target address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;       Id of the {Base} token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   Amount of the {Base} token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Emits either a {BurnSingle} or {BurnBatch} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; idBurn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Burns {Derivative} tokens from `_from` and transfers `_amounts[i]` of the {Base} tokens with `_ids[i]` from the {Pool} to `_to`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     Source address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;       Target address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _ids&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      Ids of the {Base} tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _amounts&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   Amounts of the {Base} tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Emits either a {BurnSingle} or {BurnBatch} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; batchIdBurn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _ids&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amounts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;naming&quot;&gt;Naming&lt;&#x2F;h3&gt;
&lt;p&gt;The ERC-721&#x2F;ERC-1155 tokens which are pooled are called {Base} tokens. Alternative names include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Underlying.&lt;&#x2F;li&gt;
&lt;li&gt;NFT. However, ERC-1155 tokens may be considered &quot;semi-fungible&quot;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The ERC-20 tokens which are minted&#x2F;burned are called {Derivative} tokens. Alternative names include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Wrapped.&lt;&#x2F;li&gt;
&lt;li&gt;Generic.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The function names &lt;code&gt;mint&lt;&#x2F;code&gt; and &lt;code&gt;burn&lt;&#x2F;code&gt; are borrowed from the minting and burning extensions to ERC-20. Alternative names include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;mint&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;redeem&lt;&#x2F;code&gt; (&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;nftx.org&quot;&gt;NFTX&lt;&#x2F;a&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;deposit&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;withdraw&lt;&#x2F;code&gt; (&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;wrappedkitties.com&#x2F;&quot;&gt;WrappedKitties&lt;&#x2F;a&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;wrap&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;unwrap&lt;&#x2F;code&gt; (&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;etherscan.io&#x2F;address&#x2F;0x7c40c393dc0f283f318791d746d894ddd3693572&quot;&gt;MoonCatsWrapped&lt;&#x2F;a&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The function names &lt;code&gt;*idBurn&lt;&#x2F;code&gt; are chosen to reduce confusion on what is being burned. That is, the {Derivative} tokens are burned in order to redeem the id(s).&lt;&#x2F;p&gt;
&lt;p&gt;The wrapper&#x2F;pool itself can be called an &quot;Index fund&quot; according to NFTX, or a &quot;DEX&quot; according to &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;nft20.io&quot;&gt;NFT20&lt;&#x2F;a&gt;. However, the {NFT20Pair} contract allows for direct NFT-NFT swaps which are out of the scope of this standard.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;minting&quot;&gt;Minting&lt;&#x2F;h3&gt;
&lt;p&gt;Minting requires the transfer of the {Base} tokens into the {Pool} in exchange for {Derivative} tokens. The {Base} tokens deposited in this way MUST NOT be transferred again except through the burning functions. This ensures the value of the {Derivative} tokens is representative of the value of the {Base} tokens.&lt;&#x2F;p&gt;
&lt;p&gt;Alternatively to transferring the {Base} tokens into the {Pool}, the tokens may be locked as collateral in exchange for {Derivative} loans, as proposed in NFTX litepaper, similarly to Maker vaults. This still follows the general minting pattern of removing transferability of the {Base} tokens in exchange for {Derivative} tokens.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;burning&quot;&gt;Burning&lt;&#x2F;h3&gt;
&lt;p&gt;Burning requires the transfer of {Base} tokens out of the {Pool} in exchange for burning {Derivative} tokens. The burn functions are distinguished by the quantity and quality of {Base} tokens redeemed.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;For burning without specifying the &lt;code&gt;id&lt;&#x2F;code&gt;: &lt;code&gt;burn&lt;&#x2F;code&gt;, &lt;code&gt;batchBurn&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;For burning with specifying the &lt;code&gt;id&lt;&#x2F;code&gt;(s): &lt;code&gt;idBurn&lt;&#x2F;code&gt;, &lt;code&gt;batchIdBurn&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;By allowing for specific ids to be targeted, higher value {Base} tokens may be selected out of the pool. NFTX proposes an additional fee to be applied for such targeted withdrawals, to offset the desire to drain the {Pool} of {Base} tokens worth more than the floor price.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;pricing&quot;&gt;Pricing&lt;&#x2F;h3&gt;
&lt;p&gt;Prices should not be necessarily fixed. therefore, Mint&#x2F;Burn events MUST include the ERC-20 &lt;code&gt;_value&lt;&#x2F;code&gt; minted&#x2F;burned.&lt;&#x2F;p&gt;
&lt;p&gt;Existing pricing implementations are as follows (measured in base:derivative):&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Equal: Every {Base} costs 1 {Derivative}
&lt;ul&gt;
&lt;li&gt;NFTX&lt;&#x2F;li&gt;
&lt;li&gt;Wrapped Kitties&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Proportional
&lt;ul&gt;
&lt;li&gt;NFT20 sets a fixed rate of 100 {Base} tokens per {Derivative} token.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Variable
&lt;ul&gt;
&lt;li&gt;NFT20 also allows for Dutch auctions when minting.&lt;&#x2F;li&gt;
&lt;li&gt;NFTX proposes an additional fee to be paid when targeting the id of the {Base} token.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Due to the variety of pricing implementations, the Mint* and Burn* events MUST include the number {Derivative} tokens minted&#x2F;burned.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;inheritance&quot;&gt;Inheritance&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;erc-20&quot;&gt;ERC-20&lt;&#x2F;h4&gt;
&lt;p&gt;The {Wrapper} MAY inherit from {ERC20}, in order to directly call &lt;code&gt;super.mint&lt;&#x2F;code&gt; and &lt;code&gt;super.burn&lt;&#x2F;code&gt;.
If the {Wrapper} does not inherit from {ERC20}, the {Derivative} contract MUST be limited such that the {Wrapper} has the sole power to &lt;code&gt;mint&lt;&#x2F;code&gt;, &lt;code&gt;burn&lt;&#x2F;code&gt;, and otherwise change the supply of tokens.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;erc721receiver-erc1155receiver&quot;&gt;ERC721Receiver, ERC1155Receiver&lt;&#x2F;h4&gt;
&lt;p&gt;If not inheriting from {ERC721Receiver} and&#x2F;or {ERC1155Receiver}, the pool MUST be limited such that the base tokens can only be transferred via the Wrapper&#x27;s &lt;code&gt;mint&lt;&#x2F;code&gt;, &lt;code&gt;burn&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;There exists only one of each ERC-721 token of with a given (address, id) pair. However, ERC-1155 tokens of a given (address, id) may have quantities greater than 1. Accordingly, the meaning of &quot;Single&quot; and &quot;Batch&quot; in each standard varies. In both standards, &quot;single&quot; refers to a single id, and &quot;batch&quot; refers to multiple ids. In ERC-1155, a single id event&#x2F;function may involve multiple tokens, according to the &lt;code&gt;value&lt;&#x2F;code&gt; field.&lt;&#x2F;p&gt;
&lt;p&gt;In building a common set of events and functions, we must be aware of these differences in implementation. The current implementation treats ERC-721 tokens as a special case where, in reference to the quantity of each {Base} token:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;All parameters named &lt;code&gt;_amount&lt;&#x2F;code&gt;, MUST be &lt;code&gt;1&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;All parameters named &lt;code&gt;_amounts&lt;&#x2F;code&gt; MUST be either an empty list or a list of &lt;code&gt;1&lt;&#x2F;code&gt; with the same length as &lt;code&gt;_ids&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This keeps a consistent enumeration of tokens along with ERC-1155. Alternative implementations include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A common interface with specialized functions. EX: &lt;code&gt;mintFromERC721&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Separate interfaces for each type. EX: &lt;code&gt;ERC721Wrapper&lt;&#x2F;code&gt;, &lt;code&gt;ERC1155Wrapper&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;erc721-erc1155&quot;&gt;ERC721, ERC1155&lt;&#x2F;h4&gt;
&lt;p&gt;The {Wrapper} MAY inherit from {ERC721} and&#x2F;or {ERC1155} in order to call &lt;code&gt;super.mint&lt;&#x2F;code&gt;, directly. This is optional as minting {Base} tokens is not required in this standard. An &quot;Initial NFT Offering&quot; could use this to create a set of {Base} tokens within the contract, and directly distribute {Derivative} tokens.&lt;&#x2F;p&gt;
&lt;p&gt;If the {Wrapper} does not inherit from {ERC721} or {ERC1155}, it MUST include calls to {IERC721} and {IERC1155} in order to transfer {Base} tokens.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;approval&quot;&gt;Approval&lt;&#x2F;h3&gt;
&lt;p&gt;All of the underlying transfer methods are not tied to the {Wrapper}, but rather call the ERC-20&#x2F;721&#x2F;1155 transfer methods. Implementations of this standard MUST:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Either implement {Derivative} transfer approval for burning, and {Base} transfer approval for minting.&lt;&#x2F;li&gt;
&lt;li&gt;Or check for Approval outside of the {Wrapper} through {IERC721} &#x2F; {IERC1155} before attempting to execute.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Most existing implementations inherit from ERC-20, using functions &lt;code&gt;mint&lt;&#x2F;code&gt; and &lt;code&gt;burn&lt;&#x2F;code&gt;.
Events:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Mint&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;WK: DepositKittyAndMintToken&lt;&#x2F;li&gt;
&lt;li&gt;NFTX: Mint&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Burn&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;WK: BurnTokenAndWithdrawKity&lt;&#x2F;li&gt;
&lt;li&gt;NFTX: Redeem&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ashrowz&#x2F;erc-3386&quot;&gt;ERC-3386 Reference Implementation&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Wrapper contracts are RECOMMENDED to inherit from burnable ERC-20 tokens. If they are not, the supply of the {Derivative} tokens MUST be controlled by the Wrapper. Similarly, price implementations MUST ensure that the supply of {Base} tokens is reflected by the {Derivative} tokens.&lt;&#x2F;p&gt;
&lt;p&gt;With the functions &lt;code&gt;idBurn&lt;&#x2F;code&gt;, &lt;code&gt;idBurns&lt;&#x2F;code&gt;, users may target the most valuable NFT within the generic lot.  If there is a significant difference between tokens values of different ids, the contract SHOULD consider creating specialized pools (NFTX) or pricing (NFT20) to account for this.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Limit account nonce to 2^52</title>
        <published>2021-03-07T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Micah Zoltu</name><uri>https://github.com/MicahZoltu</uri>
	</author>
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3338/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2681-limit-account-nonce-to-2-64-1/4324" />
        

        <id>https://wg-eips.ritovision.com/3338/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:3338"
            label="EIP-3338" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3338/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Limit account nonce to be between &lt;code&gt;0&lt;&#x2F;code&gt; and &lt;code&gt;2^52&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Account nonces are currently specified to be arbitrarily long unsigned integers. Dealing with arbitrary length data in the state witnesses is not optimal, therefore this EIP will allow proofs to represent the nonce in a more optimized way.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally it could prove beneficial to transaction formats, where some improvements are potentially sought by at least three other proposals.&lt;&#x2F;p&gt;
&lt;p&gt;Lastly, this facilitates a minor optimisation in clients, because the nonce no longer needs to be kept as a 256-bit number.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= FORK_BLOCK&lt;&#x2F;code&gt; introduce two new restrictions:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Consider any transaction invalid, where the nonce exceeds &lt;code&gt;2^52&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;CREATE&lt;&#x2F;code&gt; instruction to abort with an exceptional halt, where the account nonce is &lt;code&gt;2^52&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;It is unlikely for any nonce to reach or exceed the proposed limit. If one would want to reach that limit via external transactions, it would cost at least &lt;code&gt;21000 * (2^64-1) = 387_381_625_547_900_583_915_000&lt;&#x2F;code&gt; gas.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;It must be noted that in the past, in the Morden testnet, each new account had a starting nonce of &lt;code&gt;2^20&lt;&#x2F;code&gt; in order to differentiate transactions from mainnet transactions.
This mode of replay protection is out of fashion since &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt; introduced a more elegant way using chain identifiers.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Most clients already consider the nonce field to be 64-bit, such as go-ethereum.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;All integer values &amp;lt;= 2^52 can be encoded in a 64-bit floating point without any loss of precision, making this value easy to work with in languages that only have floating point number support.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;While this is a breaking change, no actual effect should be visible:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;There is no account in the state currently which would have a nonce exceeding that value. As of November 2020, the account &lt;code&gt;0xea674fdde714fd979de3edf0f56aa9716b898ec8&lt;&#x2F;code&gt; is responsible for the highest account nonce at approximately 29 million.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;None.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Paged memory allocation for the EVM</title>
        <published>2021-03-06T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Nick Johnson</name><uri>https://github.com/arachnid</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3336/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eips-3336-and-3337-improving-the-evms-memory-model/5482" />
        

        <id>https://wg-eips.ritovision.com/3336/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:3336"
            label="EIP-3336" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3336/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Changes the memory model for the EVM to use pagination.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Presently, the EVM charges for memory as a linear array starting at address 0 and extending to the highest address that has been read from or written to. This suffices for simple uses, but means that compilers have to generate programs that use memory compactly, which leads to wasted gas with reallocation of memory elements, and makes some memory models such as separate heap and stack areas impractical. This EIP proposes changing to a page-based billing model, which adds minimal complexity to implementations, while providing for much more versatility in EVM programs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Most modern computers implement &quot;virtual memory&quot; for userspace programs, where programs have access to a large address space, with pages of RAM that are allocated as needed by the OS. This allows them to distribute data throughout memory in ways that minimises the amount of reallocation and copying that needs to go on, and permits flexible use of memory for data with different lifetimes. Implementing a simple version of paged memory inside the EVM will provide the same flexibility to compilers targeting the EVM.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FORK_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;TBD&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;PAGE_BITS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;10&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;PAGE_BASE_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;96&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;For blocks where &lt;code&gt;block.number &amp;gt;= FORK_BLOCK&lt;&#x2F;code&gt;, the following changes apply.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;changes-to-memory-allocation-in-evm-implementations&quot;&gt;Changes to memory allocation in EVM implementations&lt;&#x2F;h3&gt;
&lt;p&gt;Memory is now allocated in pages of &lt;code&gt;2**PAGE_BITS&lt;&#x2F;code&gt; bytes each. The most significant &lt;code&gt;256 - PAGE_BITS&lt;&#x2F;code&gt; bits of each memory address denote the page number, while the least significant &lt;code&gt;PAGE_BITS&lt;&#x2F;code&gt; bits of the memory address denote the location in the page. Pages are initialized to contain all zero bytes and allocated when the first byte from a page is read or written.&lt;&#x2F;p&gt;
&lt;p&gt;EVM implementations are encouraged to store the pagetable as an associative array (eg, hashtable or dict) mapping from page number to an array of bytes for the page.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;changes-to-memory-expansion-gas-cost&quot;&gt;Changes to memory expansion gas cost&lt;&#x2F;h3&gt;
&lt;p&gt;Presently, the total cost to extend the memory to &lt;code&gt;a&lt;&#x2F;code&gt; words long is &lt;code&gt;Cmem(a) = 3 * a + floor(a ** 2 &#x2F; 512)&lt;&#x2F;code&gt;. If the memory is already &lt;code&gt;b&lt;&#x2F;code&gt; words long, the incremental cost is &lt;code&gt;Cmem(a) - Cmem(b)&lt;&#x2F;code&gt;. &lt;code&gt;a&lt;&#x2F;code&gt; is the number of words required to cover the range from memory address 0 to the last word that has been read or written by the EVM.&lt;&#x2F;p&gt;
&lt;p&gt;Under this EIP, we define a new memory cost function, based on the number of allocated pages. This function is &lt;code&gt;Cmem&#x27;(p) = max(PAGE_BASE_COST * (p - 1) + floor(2 * (p - 1) ** 2), 0)&lt;&#x2F;code&gt;. As above, if the memory already contains &lt;code&gt;q&lt;&#x2F;code&gt; pages, the incremental cost is &lt;code&gt;Cmem&#x27;(p) - Cmem&#x27;(q)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;changes-to-mload-and-mstore&quot;&gt;Changes to &lt;code&gt;MLOAD&lt;&#x2F;code&gt; and &lt;code&gt;MSTORE&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Loading a word from memory or storing a word to memory requires instantiating any pages that it touches that do not already exist, with the resulting gas cost as described above. If the word being loaded or stored resides in a single page, the gas cost remains unchanged at 3 gas. If the word being loaded spans two pages, the cost is 6 gas.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;changes-to-other-memory-touching-opcodes&quot;&gt;Changes to other memory-touching opcodes&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;CALLDATACOPY&lt;&#x2F;code&gt;, &lt;code&gt;CODECOPY&lt;&#x2F;code&gt;, &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt;, &lt;code&gt;CALL&lt;&#x2F;code&gt;, &lt;code&gt;CALLCODE&lt;&#x2F;code&gt;, &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;, &lt;code&gt;STATICCALL&lt;&#x2F;code&gt;, &lt;code&gt;CREATE&lt;&#x2F;code&gt;, &lt;code&gt;MSTORE8&lt;&#x2F;code&gt; and any other opcodes that read or write memory are modified as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Any page they touch for reading or writing is instantiated if it is not already.&lt;&#x2F;li&gt;
&lt;li&gt;Memory expansion gas is charged as described above.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;memory-expansion-gas-cost&quot;&gt;Memory expansion gas cost&lt;&#x2F;h3&gt;
&lt;p&gt;The new gas cost follows the same curve as the previous one, while ensuring that the new gas cost is always less than or equal to the previous cost. This prevents existing programs that make assumptions about memory allocation gas costs from resulting in errors, without unduly discounting memory below what it costs today. Intuitively, a program that uses up to a page boundary pays for one page less than they would under the old model, while a program that uses one word more than a page boundary pays for one word less than they would under the old model.&lt;&#x2F;p&gt;
&lt;p&gt;We believe that this incremental reduction will not have a significant impact on the effective gas limit, as it gets proportionally smaller as programs use more RAM.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;additional-cost-for-mloads-and-mstores-spanning-two-pages&quot;&gt;Additional cost for MLOADs and MSTOREs spanning two pages&lt;&#x2F;h3&gt;
&lt;p&gt;Loading or storing data spanning two memory pages requires more work from the EVM implementation, which must split the word at the page boundary and update the two (possibly disjoint) pages. Since we cannot guarantee loads and stores in existing EVM programs are page-aligned, we cannot prohibit this behaviour for efficiency. Instead, we propose treating each as two loads or stores for gas accounting purposes. This discourages the use of this functionality, and accounts for the additional execution cost, without prohibiting it outright.&lt;&#x2F;p&gt;
&lt;p&gt;This will result in additional gas costs for any programs that perform these operations. We believe this to be minimal, and hope to do future analysis to confirm this.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The new function for memory expansion gas cost is designed specifically to avoid backwards compatibility issues by always charging less than or equal to the amount the current EVM would charge. Under some circumstances existing programs will be charged more for MLOADs and MSTOREs that span page boundaries as described above; we believe these changes will affect a minimum of programs and have only a small impact on their gas consumption.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Potential CPU DoS issues arising from additional work done under the new model are alleviated by charging more for non-page-aligned reads and writes. Charges for memory expansion asymptotically approach those currently in force, so this change will not permit programs to allocate substantially more memory than they can today.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Frame pointer support for memory load and store operations</title>
        <published>2021-03-06T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Nick Johnson</name><uri>https://github.com/arachnid</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3337/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eips-3336-and-3337-improving-the-evms-memory-model/5482" />
        

        <id>https://wg-eips.ritovision.com/3337/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:3337"
            label="EIP-3337" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3337/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Introduces four new opcodes for loading data from and storing data to memory offset by a frame pointer.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces four new opcodes, &lt;code&gt;MLOADFP&lt;&#x2F;code&gt;, &lt;code&gt;MSTOREFP&lt;&#x2F;code&gt;, &lt;code&gt;GETFP&lt;&#x2F;code&gt; and &lt;code&gt;SETFP&lt;&#x2F;code&gt; that allow for more efficient memory access offset by a user-controlled quantity called the &quot;frame pointer&quot;. This permits compilers to more efficiently offload ephemeral data such as local variables to memory instead of the EVM&#x27;s evaluation stack, which has a number of benefits, including the effective elimination of restrictions on the number of local variables in a function.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;In most commonly used VMs, ephemeral data such as local variables, function arguments, and return addresses is stored in a region of memory called the stack. In contrast to the EVM&#x27;s evaluation stack, this area of memory is randomly accessible, and thus can store an arbitrary amount of data, which can be referenced from anywhere they remain in scope. Although this model is possible in the current EVM design, it is made difficult by the linear model of memory (addressed in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3336&#x2F;&quot;&gt;EIP-3336&lt;&#x2F;a&gt;) and by the lack of opcodes for relative memory access commonly found in other architectures. This EIP proposes new opcodes that permit this form of memory use, without imposing undue burden on EVM implementers or on runtime efficiency.&lt;&#x2F;p&gt;
&lt;p&gt;In the current EVM model, a compiler wishing to use this pattern would have to store the frame pointer - which points to the start or end of the current memory stack frame - in memory, and load it each time they wish to reference it. For example, loading a value from memory offset by the frame pointer would require the following sequence of operations:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Opcode&lt;&#x2F;th&gt;&lt;th&gt;Gas used&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;PUSHn x&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;PUSH1 0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ADD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;This consumes a total of 15 gas, and takes up at least 7 bytes of bytecode each time it is referenced. In contrast, after this EIP, the equivalent sequence of operations is:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Opcode&lt;&#x2F;th&gt;&lt;th&gt;Gas used&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;PUSH1 x&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MLOADFP&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;This consumes only 6 gas, and takes at least 3 bytes of bytecode. The effort required from the EVM implementation is equivalent, costing only one extra addition operation over a regular &lt;code&gt;MLOAD&lt;&#x2F;code&gt;. The alternative of storing values on the stack, which requires 3 gas and 1 byte of bytecode for a &lt;code&gt;DUPn&lt;&#x2F;code&gt; operation, but it is now at most twice as efficient rather than 5 times as efficient, making storing values in memory a viable alternative.&lt;&#x2F;p&gt;
&lt;p&gt;Likewise, before this EIP a frame-pointer relative store requires the following sequence of operations:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Opcode&lt;&#x2F;th&gt;&lt;th&gt;Gas used&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;PUSHn x&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;PUSH1 0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ADD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MSTORE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;This consumes 15 gas and at least 7 bytes of bytecode. After this EIP, the equivalent sequence of operations is:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Opcode&lt;&#x2F;th&gt;&lt;th&gt;Gas used&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;PUSHn x&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MSTOREFP&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Consuming only 6 gas and at least 3 bytes of bytecode, while once again only requiring EVM implementations to do one extra addition operation. The alternative of storing values on the stack requires 6 gas and 2 bytes of bytecode for the sequence &lt;code&gt;SWAPn POP&lt;&#x2F;code&gt;, making it no more efficient than memory storage.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FORK_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;TBD&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;For blocks where &lt;code&gt;block.number &amp;gt;= FORK_BLOCK&lt;&#x2F;code&gt;, the following changes apply.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;frame-pointer&quot;&gt;Frame pointer&lt;&#x2F;h3&gt;
&lt;p&gt;A new EVM internal state variable called the &quot;frame pointer&quot; is introduced. This is a signed integer that starts at 0.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;setfp-opcode&quot;&gt;&lt;code&gt;SETFP&lt;&#x2F;code&gt; opcode&lt;&#x2F;h3&gt;
&lt;p&gt;A new opcode, &lt;code&gt;SETFP&lt;&#x2F;code&gt; is introduced with value &lt;code&gt;0x5c&lt;&#x2F;code&gt;. This opcode costs &lt;code&gt;G_low&lt;&#x2F;code&gt; (3 gas) and takes one argument from the stack. The argument is stored as the new value of the frame pointer.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;getfp-opcode&quot;&gt;&lt;code&gt;GETFP&lt;&#x2F;code&gt; opcode&lt;&#x2F;h3&gt;
&lt;p&gt;A new opcode, &lt;code&gt;GETFP&lt;&#x2F;code&gt; is introduced with value &lt;code&gt;0x5d&lt;&#x2F;code&gt;. This opcode costs &lt;code&gt;G_low&lt;&#x2F;code&gt; (3 gas) and takes no arguments. It takes the current value of the frame pointer and pushes it to the stack.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;mloadfp-opcode&quot;&gt;&lt;code&gt;MLOADFP&lt;&#x2F;code&gt; opcode&lt;&#x2F;h3&gt;
&lt;p&gt;A new opcode &lt;code&gt;MLOADFP&lt;&#x2F;code&gt; is introduced with value &lt;code&gt;0x5e&lt;&#x2F;code&gt;. This opcode acts in all ways identical to &lt;code&gt;MLOAD&lt;&#x2F;code&gt;, except that the value of the frame pointer is added to the address before loading data from memory. An attempt to load data from a negative address should be treated identically to an invalid opcode, consuming all gas and reverting the current execution context.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;mstorefp-opcode&quot;&gt;&lt;code&gt;MSTOREFP&lt;&#x2F;code&gt; opcode&lt;&#x2F;h3&gt;
&lt;p&gt;A new opcode &lt;code&gt;MSTOREFP&lt;&#x2F;code&gt; is introduced with value &lt;code&gt;0x5f&lt;&#x2F;code&gt;. This opcode acts in all ways identical to &lt;code&gt;MSTORE&lt;&#x2F;code&gt;, except that the value of the frame pointer is added to the address before storing data to memory. An attempt to store data to a negative address should be treated identically to an invalid opcode, consuming all gas and reverting the current execution context.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;cost-of-new-opcodes&quot;&gt;Cost of new opcodes&lt;&#x2F;h3&gt;
&lt;p&gt;The cost of the new opcodes &lt;code&gt;MLOADFP&lt;&#x2F;code&gt; and &lt;code&gt;MSTOREFP&lt;&#x2F;code&gt; reflects the cost of &lt;code&gt;MLOAD&lt;&#x2F;code&gt; and &lt;code&gt;MSTORE&lt;&#x2F;code&gt;. They are generally equivalent in cost with the exception of an extra addition operation, which imposes negligible cost.&lt;&#x2F;p&gt;
&lt;p&gt;The cost of the new opcodes &lt;code&gt;SETFP&lt;&#x2F;code&gt; and &lt;code&gt;GETFP&lt;&#x2F;code&gt; is based on other common low-cost opcodes such as &lt;code&gt;PUSH&lt;&#x2F;code&gt; and &lt;code&gt;POP&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;absence-of-mstore8fp&quot;&gt;Absence of &lt;code&gt;MSTORE8FP&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;MSTORE8FP&lt;&#x2F;code&gt; opcode was not included because it is expected that it would be used infrequently, and there is a desire to minimise the size of the instruction set and to conserve opcodes for future use.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP exclusively introduces new opcodes, and as a result should not impact any existing programs unless they operate under the assumption that these opcodes are undefined, which we believe will not be the case.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;DoS risks are mitigated by correct pricing of opcodes to reflect current execution costs. No other security considerations pertain to this EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>MEDGASPRICE Opcode</title>
        <published>2021-03-05T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Justice Hudson</name><uri>https://github.com/jchancehud</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3332/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/medgasprice-opcode-eip/5480" />
        

        <id>https://wg-eips.ritovision.com/3332/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:3332"
            label="EIP-3332" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3332/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;An opcode for getting the median gas price of the parent block.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Adds &lt;code&gt;MEDGASPRICE (0x46)&lt;&#x2F;code&gt; opcode that returns the median gas price for the parent block.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;With the emergence of rollups as core mechanisms in scaling Ethereum there are a number of common transactions that can be front-run. Optimistic rollups rely on the submission of fraud proofs to maintain the integrity of their systems. As a result actors submitting fraud proofs typically receive a financial reward for doing so. This opens a trivial front-running strategy of watching the mempool for fraud proof submissions and copying such transactions with a much higher gas price to reap the reward. Such front-runners do not perform validation independently and de-incentivize others from performing validation. Adding a mechanism enforcing an upper bound on gas prices for a transaction could be an effective defense against such front-running attacks.&lt;&#x2F;p&gt;
&lt;p&gt;Consider a smart contract that wants to implement a first come first serve mechanism. Such a mechanism must defeat the inherently pay-to-win nature of the gas price market. Enforcing a maximum gas price for a transaction relies on the fact that transactions of the same gas price are generally processed in a first in first out way by Ethereum miners. A contract currently has few options for setting a max gas price:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Set a constant value at a reasonable rate given the current gas prices&lt;&#x2F;li&gt;
&lt;li&gt;Allow an individual or group of individuals to adjust a max gas price over time&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;More elaborate schemes could likely be constructed but all would involve storing gas price information on chain increasing the number of transactions and costing Ether.&lt;&#x2F;p&gt;
&lt;p&gt;Given a median gas price opcode a contract can set a maximum gas price as a function of the last blocks gas price. This can easily be implemented using a strategy such as the following:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; Assume that block.medgasprice is bound to MEDGASPRICE (0x46)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function submitFraudProof(bytes calldata proof) public {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  require(tx.gasprice &amp;lt;= maxGasPrice());&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &#x2F;&#x2F; process the fraud proof and provide a reward (if valid)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function maxGasPrice() public view returns (uint) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  return 3 * block.medgasprice;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Given the contract implementation above a client would simply call &lt;code&gt;maxGasPrice&lt;&#x2F;code&gt; to determine the gas price to use when submitting a fraud proof. This particular implementation allows up to 3x the median gas price of the last block to be used.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;forwards-compatibility&quot;&gt;Forwards Compatibility&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-1559&quot;&gt;EIP-1559&lt;&#x2F;a&gt; plans to change the fee market in a number of ways. Most notably is the creation of a base fee that is burned. In this context an &quot;inclusion fee&quot; still exists as a part of the total fee. Consider the following two cases:&lt;&#x2F;p&gt;
&lt;h4 id=&quot;block-sizes-are-increasing-all-available-gas-is-being-consumed&quot;&gt;Block sizes are increasing (all available gas is being consumed)&lt;&#x2F;h4&gt;
&lt;p&gt;In this case there will be bidding contention in the inclusion fee to incentivize miners to include transactions. A median gas price operator would still be helpful as an attacker could supply a high inclusion fee to bump honest transactions.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;block-sizes-are-decreasing-excess-gas-is-available&quot;&gt;Block sizes are decreasing (excess gas is available)&lt;&#x2F;h4&gt;
&lt;p&gt;In this case an attacker could specify a high inclusion fee to incentivize miners to include their transaction early in the block. Miners are incentivized to do so as including expensive transactions first reduces the risk of a revert (and partial refund) occurring.&lt;&#x2F;p&gt;
&lt;p&gt;Given these two cases this EIP seems relevant in the context of EIP-1559.&lt;&#x2F;p&gt;
&lt;p&gt;Post EIP-1559 &lt;code&gt;MEDGASPRICE (0x46)&lt;&#x2F;code&gt; should return the median &lt;code&gt;effective_gas_price&lt;&#x2F;code&gt; of the previous block.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-3198&quot;&gt;EIP-3198&lt;&#x2F;a&gt; is required for the above strategies to be implemented. With the inclusion of &lt;code&gt;BASEFEE (0x48)&lt;&#x2F;code&gt; a contract can subtract the &lt;code&gt;base_fee_per_gas&lt;&#x2F;code&gt; from the &lt;code&gt;effective_gas_price&lt;&#x2F;code&gt; to determine the inclusion fee per gas being paid for the transaction and thus implement an upper bound.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= TBD&lt;&#x2F;code&gt;, add a new opcode &lt;code&gt;MEDGASPRICE (0x46)&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;p&gt;Pushes the median gas price of the parent block onto the stack.&lt;&#x2F;p&gt;
&lt;p&gt;|  Op  	| Input 	| Output 	| Cost 	|
|:----:	|:-----:	|:------:	|:----:	|
| 0x46 	|   0   	|    1   	|   8  	|&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Having access to the current gas price economy allows contracts to implement more robust and automated logic surrounding acceptable transaction gas prices.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;naming-note&quot;&gt;Naming note&lt;&#x2F;h3&gt;
&lt;p&gt;The name &lt;code&gt;MEDGASPRICE&lt;&#x2F;code&gt; was chosen because the median gas price of the network can only be calculated from the latest complete block. Thus transactions being executed should expect the median gas price to be calculated from the previous block.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;There are no known backwards incompabitility issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The strategy described for preventing front-running by setting an upper bound on the gas price of transactions has a few caveats:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;It relies on miners being impartial. Reordering transactions with the same gas price is a trivial means of defeating this strategy.&lt;&#x2F;li&gt;
&lt;li&gt;The value returned by &lt;code&gt;MEDGASPRICE (0x46)&lt;&#x2F;code&gt; may fluctuate rapidly between blocks. If a transaction is not included immediately it may either fail (if the gas price drops) or become vulnerable to front-running (if the gas price increases).&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Wallet Switch Ethereum Chain RPC Method (`wallet_switchEthereumChain`)</title>
        <published>2021-03-04T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Erik Marks</name><uri>https://github.com/rekmarks</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3326/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3326-wallet-switchethereumchain" />
        

        <id>https://wg-eips.ritovision.com/3326/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="interface"
                label="Interface" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:3326"
            label="EIP-3326" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3326/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;An RPC method for switching the wallet&#x27;s active Ethereum chain.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;wallet_switchEthereumChain&lt;&#x2F;code&gt; RPC method allows Ethereum applications (&quot;dapps&quot;) to request that the wallet switches its active Ethereum chain, if the wallet has a concept thereof.
The caller must specify a chain ID.
The wallet application may arbitrarily refuse or accept the request.
&lt;code&gt;null&lt;&#x2F;code&gt; is returned if the active chain was switched, and an error otherwise.&lt;&#x2F;p&gt;
&lt;p&gt;Important cautions for implementers of this method are included in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3326&#x2F;#security-considerations&quot;&gt;Security Considerations&lt;&#x2F;a&gt; section.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;All dapps require the user to interact with one or more Ethereum chains in order to function.
Some wallets only supports interacting with one chain at a time.
We call this the wallet&#x27;s &quot;active chain&quot;.
&lt;code&gt;wallet_switchEthereumChain&lt;&#x2F;code&gt; enables dapps to request that the wallet switches its active chain to whichever one is required by the dapp.
This enables UX improvements for both dapps and wallets.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.ietf.org&#x2F;rfc&#x2F;rfc2119.txt&quot;&gt;RFC-2119&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;wallet-switchethereumchain&quot;&gt;&lt;code&gt;wallet_switchEthereumChain&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The method accepts a single object parameter with a &lt;code&gt;chainId&lt;&#x2F;code&gt; field.
The method returns &lt;code&gt;null&lt;&#x2F;code&gt; if the wallet switched its active chain, and an error otherwise.&lt;&#x2F;p&gt;
&lt;p&gt;The method presupposes that the wallet has a concept of a single &quot;active chain&quot;.
The active chain is defined as the chain that the wallet is forwarding RPC requests to.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;wallet_switchEthereumChain&lt;&#x2F;code&gt; accepts a single object parameter, specified by the following TypeScript interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SwitchEthereumChainParameter&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;If a field does not meet the requirements of this specification, the wallet &lt;strong&gt;MUST&lt;&#x2F;strong&gt; reject the request.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;chainId&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;MUST&lt;&#x2F;strong&gt; specify the integer ID of the chain as a hexadecimal string, per the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;695&#x2F;&quot;&gt;&lt;code&gt;eth_chainId&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; Ethereum RPC method.&lt;&#x2F;li&gt;
&lt;li&gt;The chain ID &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be known to the wallet.&lt;&#x2F;li&gt;
&lt;li&gt;The wallet &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be able to switch to the specified chain and service RPC requests to it.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;returns&quot;&gt;Returns&lt;&#x2F;h4&gt;
&lt;p&gt;The method &lt;strong&gt;MUST&lt;&#x2F;strong&gt; return &lt;code&gt;null&lt;&#x2F;code&gt; if the request was successful, and an error otherwise.&lt;&#x2F;p&gt;
&lt;p&gt;If the wallet does not have a concept of an active chain, the wallet &lt;strong&gt;MUST&lt;&#x2F;strong&gt; reject the request.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;examples&quot;&gt;Examples&lt;&#x2F;h3&gt;
&lt;p&gt;These examples use JSON-RPC, but the method could be implemented using other RPC protocols.&lt;&#x2F;p&gt;
&lt;p&gt;To switch to Mainnet:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;method&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;wallet_switchEthereumChain&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;To switch to the Goerli test chain:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;method&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;wallet_switchEthereumChain&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x5&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The purpose &lt;code&gt;wallet_switchEthereumChain&lt;&#x2F;code&gt; is to provide dapps with a way of requesting to switch the wallet&#x27;s active chain, which they would otherwise have to ask the user to do manually.&lt;&#x2F;p&gt;
&lt;p&gt;The method accepts a single object parameter to allow for future extensibility at virtually no cost to implementers and consumers.&lt;&#x2F;p&gt;
&lt;p&gt;For related work, see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3085&#x2F;&quot;&gt;EIP-3085: &lt;code&gt;wallet_addEthereumChain&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2015&#x2F;&quot;&gt;EIP-2015: &lt;code&gt;wallet_updateEthereumChain&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.
&lt;code&gt;wallet_switchEthereumChain&lt;&#x2F;code&gt; intentionally forgoes the chain metadata parameters included in those EIPs, since it is purely concerned with switching the active chain, regardless of RPC endpoints or any other metadata associated therewith.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;For wallets with a concept of an active chain, switching the active chain has significant implications for pending RPC requests and the user&#x27;s experience.
If the active chain switches without the user&#x27;s awareness, a dapp could induce the user to take actions for unintended chains.&lt;&#x2F;p&gt;
&lt;p&gt;In light of this, the wallet should:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Display a confirmation whenever a &lt;code&gt;wallet_switchEthereumChain&lt;&#x2F;code&gt; is received, clearly identifying the requester and the chain that will be switched to.
&lt;ul&gt;
&lt;li&gt;The confirmation used in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1102&#x2F;&quot;&gt;EIP-1102&lt;&#x2F;a&gt; may serve as a point of reference.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;When switching the active chain, cancel all pending RPC requests and chain-specific user confirmations.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;preserving-user-privacy&quot;&gt;Preserving User Privacy&lt;&#x2F;h3&gt;
&lt;p&gt;Automatically rejecting requests for chains that aren&#x27;t supported or have yet to be added by the wallet allows requesters to infer which chains are supported by the wallet.
Wallet implementers should consider whether this communication channel violates any security properties of the wallet, and if so, take appropriate steps to mitigate it.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Removal of refunds</title>
        <published>2021-02-26T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	<author>
		<name>Martin Swende</name><uri>https://github.com/holiman</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3298/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3298-removal-of-refunds/5430" />
        

        <id>https://wg-eips.ritovision.com/3298/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:3298"
            label="EIP-3298" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3298/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Remove gas refunds for SSTORE and SELFDESTRUCT.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Gas refunds for SSTORE and SELFDESTRUCT were originally introduced to motivate application developers to write applications that practice &quot;good state hygiene&quot;, clearing storage slots and contracts that are no longer needed. However, they are not widely used for this, and poor state hygiene continues to be the norm. It is now widely accepted that the only solution to state growth is some form of &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;hackmd.io&#x2F;@HWeNw8hNRimMm2m2GH56Cw&#x2F;state_size_management&quot;&gt;statelessness or state expiry&lt;&#x2F;a&gt;, and if such a solution is implemented, then disused storage slots and contracts would start to be ignored automatically.&lt;&#x2F;p&gt;
&lt;p&gt;Gas refunds additionally have multiple harmful consequences:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Refunds give rise to &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;gastoken.io&#x2F;&quot;&gt;GasToken&lt;&#x2F;a&gt;. GasToken has benefits in moving gas space from low-fee periods to high-fee periods, but it also has downsides to the network, particularly in exacerbating state size (as state slots are effectively used as a &quot;battery&quot; to save up gas) and inefficiently clogging blockchain gas usage&lt;&#x2F;li&gt;
&lt;li&gt;Refunds increase block size variance. The theoretical maximum amount of actual gas consumed in a block is nearly twice the on-paper gas limit (as refunds add gas space for subsequent transactions in a block, though refunds are capped at 50% of a transaction&#x27;s gas used). This is &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;notes.ethereum.org&#x2F;@vbuterin&#x2F;eip_1559_spikes&quot;&gt;not fatal&lt;&#x2F;a&gt;, but is still undesirable, especially given that refunds can be used to maintain 2x usage spikes for far longer than EIP 1559 can.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FORK_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;TBD&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;For blocks where &lt;code&gt;block.number &amp;gt;= FORK_BLOCK&lt;&#x2F;code&gt;, the following changes apply.&lt;&#x2F;p&gt;
&lt;p&gt;Do not apply the &lt;code&gt;refund&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The description above is sufficient to describe the change, but for the sake of clarity we enumerate all places where gas refunds are currently used and which should&#x2F;could be removed within a node implementation.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Remove all use of the &quot;refund counter&quot; in SSTORE gas accounting, as defined in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-2200&quot;&gt;EIP 2200&lt;&#x2F;a&gt;. Particularly:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If a storage slot is changed and the &lt;em&gt;current value&lt;&#x2F;em&gt; equals the &lt;em&gt;original value&lt;&#x2F;em&gt;, but does not equal the &lt;em&gt;new value&lt;&#x2F;em&gt;, &lt;code&gt;SSTORE_RESET_GAS&lt;&#x2F;code&gt; is deducted (plus &lt;code&gt;COLD_SLOAD_COST&lt;&#x2F;code&gt; if &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-2929#sstore-changes&quot;&gt;prescribed by EIP 2929 rules&lt;&#x2F;a&gt;), but no modifications to the refund counter are made.&lt;&#x2F;li&gt;
&lt;li&gt;If a storage slot is changed and the &lt;em&gt;current value&lt;&#x2F;em&gt; equals neither the &lt;em&gt;new value&lt;&#x2F;em&gt; nor the &lt;em&gt;original value&lt;&#x2F;em&gt; (regardless of whether or not the latter two are equal), &lt;code&gt;SLOAD_GAS&lt;&#x2F;code&gt; is deducted (plus &lt;code&gt;COLD_SLOAD_COST&lt;&#x2F;code&gt; if &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-2929#sstore-changes&quot;&gt;prescribed by EIP 2929 rules&lt;&#x2F;a&gt;), but no modifications to the refund counter are made.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Remove the &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; refund.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;A full removal of refunds is the simplest way to solve the issues with refunds; any gains from partial retention of the refund mechanism are not worth the complexity that that would leave remaining in the Ethereum protocol.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Refunds are currently only applied &lt;em&gt;after&lt;&#x2F;em&gt; transaction execution, so they cannot affect how much gas is available to any particular call frame during execution. Hence, removing them will not break the ability of any code to execute, though it will render some applications economically nonviable.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;gastoken.io&#x2F;&quot;&gt;GasToken&lt;&#x2F;a&gt; in particular will become valueless. DeFi arbitrage bots, which today frequently use either established GasToken schemes or a custom alternative to reduce on-chain costs, would benefit from rewriting their code to remove calls to these no-longer-functional gas storage mechanisms.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;An implementation can be found here: https:&#x2F;&#x2F;gist.github.com&#x2F;holiman&#x2F;460f952716a74eeb9ab358bb1836d821#gistcomment-3642048&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-case-changes&quot;&gt;Test case changes&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;The &quot;original&quot;, &quot;1st&quot;, &quot;2nd&quot;, &quot;3rd&quot; columns refer to the value of storage slot 0 before the execution and after each SSTORE.&lt;&#x2F;li&gt;
&lt;li&gt;The &quot;Berlin (cold)&quot; column gives the post-Berlin (EIP 2929) gas cost assuming the storage slot had not yet been accessed.&lt;&#x2F;li&gt;
&lt;li&gt;The &quot;Berlin (hot)&quot; column gives the post-Berlin gas cost assuming the storage slot has already been accessed.&lt;&#x2F;li&gt;
&lt;li&gt;The &quot;Berlin (hot) + norefund&quot; column gives the post-Berlin gas cost assuming the storage slot has already been accessed, &lt;strong&gt;and assuming this EIP has been implemented&lt;&#x2F;strong&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Gas costs are provided with refunds subtracted; if the number is negative this means that refunds exceed gas costs. The 50% refund limit is not applied (due to the implied assumption that this code is only a small fragment of a much larger execution).&lt;&#x2F;p&gt;
&lt;p&gt;If refunds were to be removed, this would be the comparative table&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Code&lt;&#x2F;th&gt;&lt;th&gt;Original&lt;&#x2F;th&gt;&lt;th&gt;1st&lt;&#x2F;th&gt;&lt;th&gt;2nd&lt;&#x2F;th&gt;&lt;th&gt;3rd&lt;&#x2F;th&gt;&lt;th&gt;Istanbul&lt;&#x2F;th&gt;&lt;th&gt;Berlin (cold)&lt;&#x2F;th&gt;&lt;th&gt;Berlin (hot)&lt;&#x2F;th&gt;&lt;th&gt;Berlin (hot)+norefund&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;1612&lt;&#x2F;td&gt;&lt;td&gt;2312&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;20812&lt;&#x2F;td&gt;&lt;td&gt;22212&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;1612&lt;&#x2F;td&gt;&lt;td&gt;2312&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556002600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;20812&lt;&#x2F;td&gt;&lt;td&gt;22212&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;20812&lt;&#x2F;td&gt;&lt;td&gt;22212&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;-9188&lt;&#x2F;td&gt;&lt;td&gt;-9888&lt;&#x2F;td&gt;&lt;td&gt;-11988&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;1612&lt;&#x2F;td&gt;&lt;td&gt;2312&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556002600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;5812&lt;&#x2F;td&gt;&lt;td&gt;5112&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60026000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;-9188&lt;&#x2F;td&gt;&lt;td&gt;-9888&lt;&#x2F;td&gt;&lt;td&gt;-11988&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60026000556003600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;5812&lt;&#x2F;td&gt;&lt;td&gt;5112&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60026000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;1612&lt;&#x2F;td&gt;&lt;td&gt;2312&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60026000556002600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;5812&lt;&#x2F;td&gt;&lt;td&gt;5112&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;-9188&lt;&#x2F;td&gt;&lt;td&gt;-9888&lt;&#x2F;td&gt;&lt;td&gt;-11988&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556002600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;5812&lt;&#x2F;td&gt;&lt;td&gt;5112&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;1612&lt;&#x2F;td&gt;&lt;td&gt;2312&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x600160005560006000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;21618&lt;&#x2F;td&gt;&lt;td&gt;22318&lt;&#x2F;td&gt;&lt;td&gt;20218&lt;&#x2F;td&gt;&lt;td&gt;40118&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x600060005560016000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;-8382&lt;&#x2F;td&gt;&lt;td&gt;-9782&lt;&#x2F;td&gt;&lt;td&gt;-11882&lt;&#x2F;td&gt;&lt;td&gt;5918&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>PUSH0 instruction</title>
        <published>2021-02-19T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	<author>
		<name>Hugo De la cruz</name><uri>https://github.com/hugo-dc</uri>
	</author>
	
	<author>
		<name>Paweł Bylica</name><uri>https://github.com/chfast</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3855/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3855-push0-instruction/7014" />
        

        <id>https://wg-eips.ritovision.com/3855/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:3855"
            label="EIP-3855" />
        

        
        

        
        <summary type="html">Introduce a new instruction which pushes the constant value 0 onto the stack</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3855/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce the &lt;code&gt;PUSH0&lt;&#x2F;code&gt; (&lt;code&gt;0x5f&lt;&#x2F;code&gt;) instruction, which pushes the constant value 0 onto the stack.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Many instructions expect offsets as inputs, which in a number of cases are zero. A good example is the return data parameters of &lt;code&gt;CALLs&lt;&#x2F;code&gt;, which are set to zeroes in case the contract prefers using &lt;code&gt;RETURNDATA*&lt;&#x2F;code&gt;. This is only one example, but there are many other reasons why a contract would need to push a zero value. They can achieve that today by &lt;code&gt;PUSH1 0&lt;&#x2F;code&gt;, which costs 3 gas at runtime, and is encoded as two bytes which means &lt;code&gt;2 * 200&lt;&#x2F;code&gt; gas deployment cost.&lt;&#x2F;p&gt;
&lt;p&gt;Because of the overall cost many try to use various other instructions to achieve the same effect. Common examples include &lt;code&gt;PC&lt;&#x2F;code&gt;, &lt;code&gt;MSIZE&lt;&#x2F;code&gt;, &lt;code&gt;CALLDATASIZE&lt;&#x2F;code&gt;, &lt;code&gt;RETURNDATASIZE&lt;&#x2F;code&gt;, &lt;code&gt;CODESIZE&lt;&#x2F;code&gt;, &lt;code&gt;CALLVALUE&lt;&#x2F;code&gt;, and &lt;code&gt;SELFBALANCE&lt;&#x2F;code&gt;. Some of these cost only 2 gas and are a single byte long, but their value can depend on the context.&lt;&#x2F;p&gt;
&lt;p&gt;We have conducted an analysis on Mainnet (block ranges 8,567,259…8,582,058 and 12,205,970…12,817,405), and ~11.5% of all the &lt;code&gt;PUSH*&lt;&#x2F;code&gt; instructions executed push a value of zero.&lt;&#x2F;p&gt;
&lt;p&gt;The main motivations for this change include:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Reducing contract code size.&lt;&#x2F;li&gt;
&lt;li&gt;Reducing the risk of contracts (mis)using various instructions as an optimisation measure. Repricing&#x2F;changing those instructions can be more risky.&lt;&#x2F;li&gt;
&lt;li&gt;Reduce the need to use &lt;code&gt;DUP&lt;&#x2F;code&gt; instructions for duplicating zeroes.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;To put the &quot;waste&quot; into perspective, across existing accounts 340,557,331 bytes are wasted on &lt;code&gt;PUSH1 00&lt;&#x2F;code&gt; instructions, which means 68,111,466,200 gas was spent to deploy them. In practice a lot of these accounts share identical bytecode with others, so their total stored size in clients is lower, however the deploy time cost must have been paid nevertheless.&lt;&#x2F;p&gt;
&lt;p&gt;An example for 2) is changing the behaviour of &lt;code&gt;RETURNDATASIZE&lt;&#x2F;code&gt; such that it may not be guaranteed to be zero at the beginning of the call frame.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The instruction &lt;code&gt;PUSH0&lt;&#x2F;code&gt; is introduced at &lt;code&gt;0x5f&lt;&#x2F;code&gt;. It has no immediate data, pops no items from the stack, and places a single item with the value 0 onto the stack. The cost of this instruction is 2 gas (aka &lt;code&gt;base&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;gas-cost&quot;&gt;Gas cost&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;base&lt;&#x2F;code&gt; gas cost is used for instructions which place constant values onto the stack, such as &lt;code&gt;ADDRESS&lt;&#x2F;code&gt;, &lt;code&gt;ORIGIN&lt;&#x2F;code&gt;, and so forth.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;opcode&quot;&gt;Opcode&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;0x5f&lt;&#x2F;code&gt; means it is in a &quot;contiguous&quot; space with the rest of the &lt;code&gt;PUSH&lt;&#x2F;code&gt; implementations and potentially could share the implementation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a new opcode which did not exist previously. Already deployed contracts using this opcode could change their behaviour after this EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;5F&lt;&#x2F;code&gt; -- successful execution, stack consist of a single item, set to zero&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;5F5F..5F&lt;&#x2F;code&gt; (1024 times) -- successful execution, stack consists of 1024 items, all set to zero&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;5F5F..5F&lt;&#x2F;code&gt; (1025 times) -- execution aborts due to out of stack&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The authors are not aware of any impact on security. Note that jumpdest-analysis is unaffected, as &lt;code&gt;PUSH0&lt;&#x2F;code&gt; has no immediate data bytes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Giving Ethereum fees to Future Salaries</title>
        <published>2021-02-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Victor Porton</name><uri>https://github.com/vporton</uri>
	</author>
	
	<author>
		<name>Victor Porton</name><email>porton@narod.ru</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3267/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/discussion-of-eip-3267/5343" />
        

        <id>https://wg-eips.ritovision.com/3267/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:3267"
            label="EIP-3267" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3267/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Transfer a part of Ethereum transfer&#x2F;mining fees to Future Salaries contract&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Transfer a part (exact fractions - TBD) of mining&#x2F;transfer fees + (probably: TBD) some minted ETH to the &lt;code&gt;DonateETH&lt;&#x2F;code&gt; contract configured to transfer to &lt;code&gt;SalaryWithDAO&lt;&#x2F;code&gt; contract.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal solves two problems at once:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;It provides a big amount of &quot;money&quot; to common good producers. That obviously personally benefits common good producers, allowing them to live better human lives, it increases peoples&#x27; and organizations&#x27; both abilities and incentives to produce common goods. That benefits the humanity as a whole and the Ethereum ecosystem in particular. See more in the discussion why it&#x27;s crucial.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;This would effectively decrease circulating ETH supply. The necessity to decrease the (circulating) ETH supply (by locking ETH in Future Salaries system for a long time) is a well-known important thing to be done.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Paradoxically, it will directly benefit miners&#x2F;validators, see the discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;(TBD)&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;SalaryWithDAO&lt;&#x2F;code&gt; = &lt;code&gt;TBD&lt;&#x2F;code&gt; (&lt;code&gt;address&lt;&#x2F;code&gt;)&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;DefaultDAOInterface&lt;&#x2F;code&gt; = &lt;code&gt;TBD&lt;&#x2F;code&gt; (&lt;code&gt;address&lt;&#x2F;code&gt;)&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;MintPerPeriod&lt;&#x2F;code&gt; = &lt;code&gt;TBD&lt;&#x2F;code&gt; (&lt;code&gt;uint256&lt;&#x2F;code&gt;)&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;TransferFraction&lt;&#x2F;code&gt; = &lt;code&gt;TBD&lt;&#x2F;code&gt; (0..1)&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;MineFraction&lt;&#x2F;code&gt; = &lt;code&gt;TBD&lt;&#x2F;code&gt; (0..1)&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3267&#x2F;assets&#x2F;contracts&#x2F;README&#x2F;&quot;&gt;The contract&#x27;s source&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Prior to &lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt;, &lt;code&gt;SalaryWithDAO&lt;&#x2F;code&gt; and &lt;code&gt;DefaultDAOInterface&lt;&#x2F;code&gt; contracts will be deployed to the network and exist at the above specified addresses.&lt;&#x2F;p&gt;
&lt;p&gt;Change the Ethereum clients to transfer at every ETH transfer and every ETH mine a fixed fraction &lt;code&gt;TransferFraction&lt;&#x2F;code&gt; of the transferred ETH and &lt;code&gt;MineFraction&lt;&#x2F;code&gt; of the mined ETH to a fixed account (decide the account number, it can be for example &lt;code&gt;0x00000000000000000000000000000000000000001&lt;&#x2F;code&gt; or even &lt;code&gt;0x00000000000000000000000000000000000000000&lt;&#x2F;code&gt; or a random account).&lt;&#x2F;p&gt;
&lt;p&gt;Change the Ethereum clients to mint &lt;code&gt;MintPerPeriod&lt;&#x2F;code&gt; ETH to the contract &lt;code&gt;DonateETH&lt;&#x2F;code&gt; every some time (e.g. the first transaction of the first block every UTC day - TBD how often).&lt;&#x2F;p&gt;
&lt;p&gt;Change the Ethereum clients to every some time (e.g. the second transaction of the first block every UTC day - TBD how often) transfer the entire ETH from this account to the contract &lt;code&gt;DonateETH&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Because this EIP solves a similar problem, cancel any other EIPs that burn ETH (except gas fees) during transfers or mining. (TBD: We should transfer more ETH in this EIP than we burned accordingly older accepted EIPs, because this EIP has the additional advantages of: 1. funding common goods; 2. better aligning values of ETH and values of tokens).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The Future Salaries is the &lt;em&gt;only&lt;&#x2F;em&gt; known system of distributing significant funds to common good producers. (Quadratic funding aimed to do a similar thing, but in practice as we see on GitCoin it favors a few developers, ignores project of highly advanced scientific research that is hard to explain to an average developer, and encourages colluding, and it just highly random due to small number of donors. Also quadratic funding simply does not gather enough funds to cover common good needs). So this EIP is the only known way to recover the economy.&lt;&#x2F;p&gt;
&lt;p&gt;The economical model of Future Salaries is described in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3267&#x2F;.&#x2F;assets&#x2F;science-salaries.pdf&quot;&gt;this research article preprint&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Funding multiple oracles with different finish time would alleviate the future trouble that the circulating ETH (or other tokens) supply would suddenly increase when the oracle finishes. It would effectively exclude some ETH from the circulation forever.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Because transferring to the aforementioned account is neither mining nor a transaction, we get a new kinds of ETH transfers, so there may be some (expected moderate impact) troubles with applications that have made assumptions about ETH transfers all occurring either as miner payments or transactions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The security considerations are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The DAO that controls account restoration may switch to a non-effective or biased way of voting (for example to being controlled by one human) thus distributing funds unfairly. This problem could be solved by a future fork of Ethereum that would &quot;confiscate&quot; control from the DAO.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;See more in the discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>MCOPY - Memory copying instruction</title>
        <published>2021-02-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	<author>
		<name>Paul Dworzanski</name><uri>https://github.com/poemm</uri>
	</author>
	
	<author>
		<name>Jared Wasinger</name><uri>https://github.com/jwasinger</uri>
	</author>
	
	<author>
		<name>Casey Detrio</name><uri>https://github.com/cdetrio</uri>
	</author>
	
	<author>
		<name>Pawel Bylica</name><uri>https://github.com/chfast</uri>
	</author>
	
	<author>
		<name>Charles Cooper</name><uri>https://github.com/charles-cooper</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5656/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5656-mcopy-instruction/10890" />
        

        <id>https://wg-eips.ritovision.com/5656/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:5656"
            label="EIP-5656" />
        

        
        

        
        <summary type="html">An efficient EVM instruction for copying memory areas</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5656/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Provide an efficient EVM instruction for copying memory areas.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Memory copying is a basic operation, yet implementing it on the EVM comes with overhead.&lt;&#x2F;p&gt;
&lt;p&gt;This was recognised and alleviated early on with the introduction of the &quot;identity&quot; precompile, which accomplishes
memory copying by the use of &lt;code&gt;CALL&lt;&#x2F;code&gt;&#x27;s input and output memory offsets. Its cost is &lt;code&gt;15 + 3 * (length &#x2F; 32)&lt;&#x2F;code&gt; gas, plus
the call overhead. The identity precompile was rendered ineffective by the raise of the cost of &lt;code&gt;CALL&lt;&#x2F;code&gt; to 700, but subsequently
the reduction by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt; made it slightly more economical.&lt;&#x2F;p&gt;
&lt;p&gt;Copying exact words can be accomplished with &lt;code&gt;&amp;lt;offset&amp;gt; MLOAD &amp;lt;offset&amp;gt; MSTORE&lt;&#x2F;code&gt; or &lt;code&gt;&amp;lt;offset&amp;gt; DUP1 MLOAD DUP2 MSTORE&lt;&#x2F;code&gt;,
at a cost of at least 12 gas per word. This is fairly efficient if the offsets are known upfront and the copying can be unrolled.
In case copying is implemented at runtime with arbitrary starting offsets, besides the control flow overhead, the offset
will need to be incremented using &lt;code&gt;32 ADD&lt;&#x2F;code&gt;, adding at least 6 gas per word.&lt;&#x2F;p&gt;
&lt;p&gt;Copying non-exact words is more tricky, as for the last partial word, both the source and destination needs to be loaded,
masked, or&#x27;d, and stored again. This overhead is significant. One edge case is if the last &quot;partial word&quot; is a single byte,
it can be efficiently stored using &lt;code&gt;MSTORE8&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;As example use case, copying 256 bytes costs:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;at least 757 gas pre-EIP-2929 using the identity precompile&lt;&#x2F;li&gt;
&lt;li&gt;at least 157 gas post-EIP-2929 using the identity precompile&lt;&#x2F;li&gt;
&lt;li&gt;at least 96 gas using unrolled &lt;code&gt;MLOAD&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;MSTORE&lt;&#x2F;code&gt; instructions&lt;&#x2F;li&gt;
&lt;li&gt;27 gas using this EIP&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;According to an analysis of blocks 10537502 to 10538702, roughly 10.5% of memory copies would have had improved performance with the
availability of an &lt;code&gt;MCOPY&lt;&#x2F;code&gt; instruction.&lt;&#x2F;p&gt;
&lt;p&gt;Memory copying is used by languages like Solidity and Vyper, where we expect this improvement to provide efficient means of building
data structures, including efficient sliced access and copies of memory objects. Having a dedicated &lt;code&gt;MCOPY&lt;&#x2F;code&gt; instruction would also add
forward protection against future gas cost changes to &lt;code&gt;CALL&lt;&#x2F;code&gt; instructions in general.&lt;&#x2F;p&gt;
&lt;p&gt;Having a special &lt;code&gt;MCOPY&lt;&#x2F;code&gt; instruction makes the job of static analyzers and optimizers easier, since the effects of a &lt;code&gt;CALL&lt;&#x2F;code&gt; in general
have to be fenced, whereas an &lt;code&gt;MCOPY&lt;&#x2F;code&gt; instruction would be known to only have memory effects. Even if special cases are added
for precompiles, a future hard fork could change &lt;code&gt;CALL&lt;&#x2F;code&gt; effects, and so any analysis of code using the identity precompile would only
be valid for a certain range of blocks.&lt;&#x2F;p&gt;
&lt;p&gt;Finally, we expect memory copying to be immensely useful for various computationally heavy operations, such as EVM384,
where it is identified as a significant overhead.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The instruction &lt;code&gt;MCOPY&lt;&#x2F;code&gt; is introduced at &lt;code&gt;0x5E&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;input-stack&quot;&gt;Input stack&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Stack&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;top - 0&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;dst&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;top - 1&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;src&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;top - 2&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;length&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;This ordering matches the other copying instructions, i.e. &lt;code&gt;CALLDATACOPY&lt;&#x2F;code&gt;, &lt;code&gt;RETURNDATACOPY&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-costs&quot;&gt;Gas costs&lt;&#x2F;h3&gt;
&lt;p&gt;Per yellow paper terminology, it should be considered part of the &lt;code&gt;W_copy&lt;&#x2F;code&gt; group of opcodes, and follow the gas calculation for &lt;code&gt;W_copy&lt;&#x2F;code&gt; in the yellow paper. While the calculation in the yellow paper should be considered the final word, for reference, as of time of this writing, that currently means its gas cost is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;words_copied = (length + 31) &#x2F;&#x2F; 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;g_verylow    = 3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;g_copy       = 3 * words_copied + memory_expansion_cost&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gas_cost     = g_verylow + g_copy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;output-stack&quot;&gt;Output stack&lt;&#x2F;h3&gt;
&lt;p&gt;This instruction returns no stack items.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;semantics&quot;&gt;Semantics&lt;&#x2F;h3&gt;
&lt;p&gt;It copies &lt;code&gt;length&lt;&#x2F;code&gt; bytes from the offset pointed at &lt;code&gt;src&lt;&#x2F;code&gt; to the offset pointed at &lt;code&gt;dst&lt;&#x2F;code&gt; in memory.
Copying takes place as if an intermediate buffer was used, allowing the destination and source to overlap.&lt;&#x2F;p&gt;
&lt;p&gt;If &lt;code&gt;length &amp;gt; 0&lt;&#x2F;code&gt; and (&lt;code&gt;src + length&lt;&#x2F;code&gt; or &lt;code&gt;dst + length&lt;&#x2F;code&gt;) is beyond the current memory length, the memory is extended with respective gas cost applied.&lt;&#x2F;p&gt;
&lt;p&gt;The gas cost of this instruction mirrors that of other &lt;code&gt;Wcopy&lt;&#x2F;code&gt; instructions and is &lt;code&gt;Gverylow + Gcopy * ceil(length &#x2F; 32)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Production implementation of exact-word memory copying and partial-word memory copying can be found in the Solidity, Vyper and Fe compilers.&lt;&#x2F;p&gt;
&lt;p&gt;With &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt; the call overhead using the identity precompile was reduced from 700 to 100 gas.
This is still prohibitive for making the precompile a reasonable alternative again.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a new instruction which did not exist previously. Already deployed contracts using this instruction could change their behaviour after this EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;MCOPY 0 32 32&lt;&#x2F;code&gt; - copy 32 bytes from offset 32 to offset 0.&lt;&#x2F;p&gt;
&lt;p&gt;pre (spaces included for readability):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0000000000000000000000000000000000000000000000000000000000000000 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;post:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;gas used: 6&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;MCOPY 0 0 32&lt;&#x2F;code&gt; - copy 32 bytes from offset 0 to offset 0.&lt;&#x2F;p&gt;
&lt;p&gt;pre:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0101010101010101010101010101010101010101010101010101010101010101&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;post:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0101010101010101010101010101010101010101010101010101010101010101&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;gas used: 6&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;MCOPY 0 1 8&lt;&#x2F;code&gt; - copy 8 bytes from offset 1 to offset 0 (overlapping).&lt;&#x2F;p&gt;
&lt;p&gt;pre (space at byte 8):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0001020304050607 080000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;post:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0102030405060708 080000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;gas used: 6&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;MCOPY 1 0 8&lt;&#x2F;code&gt; - copy 8 bytes from offset 0 to offset 1 (overlapping).&lt;&#x2F;p&gt;
&lt;p&gt;pre (space at byte 8):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0001020304050607 080000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;post:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0000010203040506 070000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;gas used: 6&lt;&#x2F;p&gt;
&lt;h3 id=&quot;full-test-suite&quot;&gt;Full test suite&lt;&#x2F;h3&gt;
&lt;p&gt;A full suite of tests can be found in the execution spec tests: &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;execution-spec-tests&#x2F;tree&#x2F;c0065176a79f89d93f4c326186fc257ec5b8d5f1&#x2F;tests&#x2F;cancun&#x2F;eip5656_mcopy&quot;&gt;MCOPY suite&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Clients should take care that their implementation does not use an intermediate buffer (see for instance that the C stdlib &lt;code&gt;memmove&lt;&#x2F;code&gt; function does not use an intermediate buffer), as this is a potential Denial of Service (DoS) vector. Most language builtins &#x2F; standard library functions for moving bytes have the correct performance characteristics here.&lt;&#x2F;p&gt;
&lt;p&gt;This aside, the analysis for Denial of Service (DoS) and memory exhaustion attacks is identical to other opcodes which touch memory, as the memory expansion follows the same pricing rules.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Batch Flash Loans</title>
        <published>2021-01-31T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Alberto Cuesta Cañada</name><uri>https://github.com/albertocuestacanada</uri>
	</author>
	
	<author>
		<name>Fiona Kobayashi</name><uri>https://github.com/fifikobayashi</uri>
	</author>
	
	<author>
		<name>fubuloubu</name><uri>https://github.com/fubuloubu</uri>
	</author>
	
	<author>
		<name>Austin Williams</name><uri>https://github.com/onewayfunction</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3234/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-3234-batch-flash-loans/5271" />
        

        <id>https://wg-eips.ritovision.com/3234/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:3234"
            label="ERC-3234" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3234/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC provides standard interfaces and processes for multiple-asset flash loans.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Flash loans of multiple assets, or batch flash loans, are a common offering of flash lenders, and have a strong use case in the simultaneous refinance of several positions between platforms. At the same time, batch flash loans are more complicated to use than single asset flash loans (ER3156). This divergence of use cases and user profiles calls for independent, but consistent, standards for single asset flash loans and batch flash loans.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;A batch flash lending feature integrates two smart contracts using a callback pattern. These are called the LENDER and the RECEIVER in this EIP.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;lender-specification&quot;&gt;Lender Specification&lt;&#x2F;h3&gt;
&lt;p&gt;A &lt;code&gt;lender&lt;&#x2F;code&gt; MUST implement the IERC3234BatchFlashLender interface.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pragma solidity ^0.7.0 || ^0.8.0;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;import &amp;quot;.&#x2F;IERC3234BatchFlashBorrower.sol&amp;quot;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;interface IERC3234BatchFlashLender {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev The amount of currency available to be lended.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param tokens The currency for each loan in the batch.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @return The maximum amount that can be borrowed for each loan in the batch.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function maxFlashLoan(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address[] calldata tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ) external view returns (uint256[]);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev The fees to be charged for a given batch loan.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param tokens The loan currencies.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param amounts The amounts of tokens lent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @return The amount of each `token` to be charged for each loan, on top of the returned principal.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function flashFee(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address[] calldata tokens,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256[] calldata amounts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ) external view returns (uint256[]);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev Initiate a batch flash loan.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param receiver The receiver of the tokens in the loan, and the receiver of the callback.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param tokens The loan currencies.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param amounts The amount of tokens lent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param data Arbitrary data structure, intended to contain user-defined parameters.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function batchFlashLoan(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        IERC3234BatchFlashBorrower receiver,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address[] calldata tokens,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256[] calldata amounts,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bytes[] calldata data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ) external returns (bool);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;maxFlashLoan&lt;&#x2F;code&gt; function MUST return the maximum loan possible for each &lt;code&gt;token&lt;&#x2F;code&gt;. If a &lt;code&gt;token&lt;&#x2F;code&gt; is not currently supported &lt;code&gt;maxFlashLoan&lt;&#x2F;code&gt; MUST return 0, instead of reverting.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;flashFee&lt;&#x2F;code&gt; function MUST return the fees charged for each loan of &lt;code&gt;amount&lt;&#x2F;code&gt; &lt;code&gt;token&lt;&#x2F;code&gt;. If a token is not supported &lt;code&gt;flashFee&lt;&#x2F;code&gt; MUST revert.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;batchFlashLoan&lt;&#x2F;code&gt; function MUST include a callback to the &lt;code&gt;onBatchFlashLoan&lt;&#x2F;code&gt; function in a &lt;code&gt;IERC3234BatchFlashBorrower&lt;&#x2F;code&gt; contract.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function batchFlashLoan(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    IERC3234BatchFlashBorrower receiver,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address[] calldata tokens,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    uint256[] calldata amounts,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytes calldata data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;) external returns (bool) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    require(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        receiver.onBatchFlashLoan(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            msg.sender,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            tokens,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            amounts,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            fees,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ) == keccak256(&amp;quot;ERC3234BatchFlashBorrower.onBatchFlashLoan&amp;quot;),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;IERC3234: Callback failed&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    );&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;batchFlashLoan&lt;&#x2F;code&gt; function MUST transfer &lt;code&gt;amounts[i]&lt;&#x2F;code&gt; of each &lt;code&gt;tokens[i]&lt;&#x2F;code&gt; to &lt;code&gt;receiver&lt;&#x2F;code&gt; before the callback to the borrower.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;batchFlashLoan&lt;&#x2F;code&gt; function MUST include &lt;code&gt;msg.sender&lt;&#x2F;code&gt; as the &lt;code&gt;initiator&lt;&#x2F;code&gt; to &lt;code&gt;onBatchFlashLoan&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;batchFlashLoan&lt;&#x2F;code&gt; function MUST NOT modify the &lt;code&gt;tokens&lt;&#x2F;code&gt;, &lt;code&gt;amounts&lt;&#x2F;code&gt; and &lt;code&gt;data&lt;&#x2F;code&gt; parameters received, and MUST pass them on to &lt;code&gt;onBatchFlashLoan&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;lender&lt;&#x2F;code&gt; MUST verify that the &lt;code&gt;onBatchFlashLoan&lt;&#x2F;code&gt; callback returns the keccak256 hash of &quot;ERC3234BatchFlashBorrower.onBatchFlashLoan&quot;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;batchFlashLoan&lt;&#x2F;code&gt; function MUST include a &lt;code&gt;fees&lt;&#x2F;code&gt; argument to &lt;code&gt;onBatchFlashLoan&lt;&#x2F;code&gt; with the fee to pay for each individual &lt;code&gt;token&lt;&#x2F;code&gt; and &lt;code&gt;amount&lt;&#x2F;code&gt; lent, ensuring that &lt;code&gt;fees[i] == flashFee(tokens[i], amounts[i])&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;After the callback, for each &lt;code&gt;token&lt;&#x2F;code&gt; in &lt;code&gt;tokens&lt;&#x2F;code&gt;, the &lt;code&gt;batchFlashLoan&lt;&#x2F;code&gt; function MUST take the &lt;code&gt;amounts[i] + fees[i]&lt;&#x2F;code&gt; of &lt;code&gt;tokens[i]&lt;&#x2F;code&gt; from the &lt;code&gt;receiver&lt;&#x2F;code&gt;, or revert if this is not successful.&lt;&#x2F;p&gt;
&lt;p&gt;If successful, &lt;code&gt;batchFlashLoan&lt;&#x2F;code&gt; MUST return &lt;code&gt;true&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;receiver-specification&quot;&gt;Receiver Specification&lt;&#x2F;h3&gt;
&lt;p&gt;A &lt;code&gt;receiver&lt;&#x2F;code&gt; of flash loans MUST implement the IERC3234BatchFlashBorrower interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pragma solidity ^0.7.0 || ^0.8.0;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;interface IERC3234BatchFlashBorrower {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev Receive a flash loan.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param initiator The initiator of the loan.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param tokens The loan currency.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param amounts The amount of tokens lent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param fees The additional amount of tokens to repay.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param data Arbitrary data structure, intended to contain user-defined parameters.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @return The keccak256 hash of &amp;quot;ERC3234BatchFlashBorrower.onBatchFlashLoan&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function onBatchFlashLoan(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address initiator,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address[] calldata tokens,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256[] calldata amounts,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256[] calldata fees,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bytes calldata data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ) external returns (bytes32);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;For the transaction to not revert, for each &lt;code&gt;token&lt;&#x2F;code&gt; in &lt;code&gt;tokens&lt;&#x2F;code&gt;, &lt;code&gt;receiver&lt;&#x2F;code&gt; MUST approve &lt;code&gt;amounts[i] + fees[i]&lt;&#x2F;code&gt; of &lt;code&gt;tokens[i]&lt;&#x2F;code&gt; to be taken by &lt;code&gt;msg.sender&lt;&#x2F;code&gt; before the end of &lt;code&gt;onBatchFlashLoan&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;If successful, &lt;code&gt;onBatchFlashLoan&lt;&#x2F;code&gt; MUST return the keccak256 hash of &quot;ERC3156BatchFlashBorrower.onBatchFlashLoan&quot;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The interfaces described in this ERC have been chosen as to cover the known flash lending use cases, while allowing for safe and gas efficient implementations.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;flashFee&lt;&#x2F;code&gt; reverts on unsupported tokens, because returning a numerical value would be incorrect.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;batchFlashLoan&lt;&#x2F;code&gt; has been chosen as a function name as descriptive enough, unlikely to clash with other functions in the lender, and including both the use cases in which the tokens lended are held or minted by the lender.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;receiver&lt;&#x2F;code&gt; is taken as a parameter to allow flexibility on the implementation of separate loan initiators and receivers.&lt;&#x2F;p&gt;
&lt;p&gt;Existing flash lenders (Aave, dYdX and Uniswap) all provide flash loans of several token types from the same contract (LendingPool, SoloMargin and UniswapV2Pair). Providing a &lt;code&gt;token&lt;&#x2F;code&gt; parameter in both the &lt;code&gt;batchFlashLoan&lt;&#x2F;code&gt; and &lt;code&gt;onBatchFlashLoan&lt;&#x2F;code&gt; functions matches closely the observed functionality.&lt;&#x2F;p&gt;
&lt;p&gt;A &lt;code&gt;bytes calldata data&lt;&#x2F;code&gt; parameter is included for the caller to pass arbitrary information to the &lt;code&gt;receiver&lt;&#x2F;code&gt;, without impacting the utility of the &lt;code&gt;batchFlashLoan&lt;&#x2F;code&gt; standard.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;onBatchFlashLoan&lt;&#x2F;code&gt; has been chosen as a function name as descriptive enough, unlikely to clash with other functions in the &lt;code&gt;receiver&lt;&#x2F;code&gt;, and following the &lt;code&gt;onAction&lt;&#x2F;code&gt; naming pattern used as well in EIP-667.&lt;&#x2F;p&gt;
&lt;p&gt;An &lt;code&gt;initiator&lt;&#x2F;code&gt; will often be required in the &lt;code&gt;onBatchFlashLoan&lt;&#x2F;code&gt; function, which the lender knows as &lt;code&gt;msg.sender&lt;&#x2F;code&gt;. An alternative implementation which would embed the &lt;code&gt;initiator&lt;&#x2F;code&gt; in the &lt;code&gt;data&lt;&#x2F;code&gt; parameter by the caller would require an additional mechanism for the receiver to verify its accuracy, and is not advisable.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;amounts&lt;&#x2F;code&gt; will be required in the &lt;code&gt;onBatchFlashLoan&lt;&#x2F;code&gt; function, which the lender took as a parameter. An alternative implementation which would embed the &lt;code&gt;amounts&lt;&#x2F;code&gt; in the &lt;code&gt;data&lt;&#x2F;code&gt; parameter by the caller would require an additional mechanism for the receiver to verify its accuracy, and is not advisable.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;fees&lt;&#x2F;code&gt; will often be calculated in the &lt;code&gt;batchFlashLoan&lt;&#x2F;code&gt; function, which the &lt;code&gt;receiver&lt;&#x2F;code&gt; must be aware of for repayment. Passing the &lt;code&gt;fees&lt;&#x2F;code&gt; as a parameter instead of appended to &lt;code&gt;data&lt;&#x2F;code&gt; is simple and effective.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;amount + fee&lt;&#x2F;code&gt; are pulled from the &lt;code&gt;receiver&lt;&#x2F;code&gt; to allow the &lt;code&gt;lender&lt;&#x2F;code&gt; to implement other features that depend on using &lt;code&gt;transferFrom&lt;&#x2F;code&gt;, without having to lock them for the duration of a flash loan. An alternative implementation where the repayment is transferred to the &lt;code&gt;lender&lt;&#x2F;code&gt; is also possible, but would need all other features in the lender to be also based in using &lt;code&gt;transfer&lt;&#x2F;code&gt; instead of &lt;code&gt;transferFrom&lt;&#x2F;code&gt;. Given the lower complexity and prevalence of a &quot;pull&quot; architecture over a &quot;push&quot; architecture, &quot;pull&quot; was chosen.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;verification-of-callback-arguments&quot;&gt;Verification of callback arguments&lt;&#x2F;h3&gt;
&lt;p&gt;The arguments of &lt;code&gt;onBatchFlashLoan&lt;&#x2F;code&gt; are expected to reflect the conditions of the flash loan, but cannot be trusted unconditionally. They can be divided in two groups, that require different checks before they can be trusted to be genuine.&lt;&#x2F;p&gt;
&lt;ol start=&quot;0&quot;&gt;
&lt;li&gt;No arguments can be assumed to be genuine without some kind of verification. &lt;code&gt;initiator&lt;&#x2F;code&gt;, &lt;code&gt;tokens&lt;&#x2F;code&gt; and &lt;code&gt;amounts&lt;&#x2F;code&gt; refer to a past transaction that might not have happened if the caller of &lt;code&gt;onBatchFlashLoan&lt;&#x2F;code&gt; decides to lie. &lt;code&gt;fees&lt;&#x2F;code&gt; might be false or calculated incorrectly. &lt;code&gt;data&lt;&#x2F;code&gt; might have been manipulated by the caller.&lt;&#x2F;li&gt;
&lt;li&gt;To trust that the value of &lt;code&gt;initiator&lt;&#x2F;code&gt;, &lt;code&gt;tokens&lt;&#x2F;code&gt;, &lt;code&gt;amounts&lt;&#x2F;code&gt; and &lt;code&gt;fees&lt;&#x2F;code&gt; are genuine a reasonable pattern is to verify that the &lt;code&gt;onBatchFlashLoan&lt;&#x2F;code&gt; caller is in a whitelist of verified flash lenders. Since often the caller of &lt;code&gt;batchFlashLoan&lt;&#x2F;code&gt; will also be receiving the &lt;code&gt;onBatchFlashLoan&lt;&#x2F;code&gt; callback this will be trivial. In all other cases flash lenders will need to be approved if the arguments in &lt;code&gt;onBatchFlashLoan&lt;&#x2F;code&gt; are to be trusted.&lt;&#x2F;li&gt;
&lt;li&gt;To trust that the value of &lt;code&gt;data&lt;&#x2F;code&gt; is genuine, in addition to the check in point 1, it is recommended that the &lt;code&gt;receiver&lt;&#x2F;code&gt; verifies that the &lt;code&gt;initiator&lt;&#x2F;code&gt; is in some list of trusted addresses. Trusting the &lt;code&gt;lender&lt;&#x2F;code&gt; and the &lt;code&gt;initiator&lt;&#x2F;code&gt; is enough to trust that the contents of &lt;code&gt;data&lt;&#x2F;code&gt; are genuine.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;flash-lending-security-considerations&quot;&gt;Flash lending security considerations&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;automatic-approvals-for-untrusted-borrowers&quot;&gt;Automatic approvals for untrusted borrowers&lt;&#x2F;h4&gt;
&lt;p&gt;The safest approach is to implement an approval for &lt;code&gt;amount+fee&lt;&#x2F;code&gt; before the &lt;code&gt;batchFlashLoan&lt;&#x2F;code&gt; is executed.&lt;&#x2F;p&gt;
&lt;p&gt;Including in &lt;code&gt;onBatchFlashLoan&lt;&#x2F;code&gt; the approval for the &lt;code&gt;lender&lt;&#x2F;code&gt; to take the &lt;code&gt;amount + fee&lt;&#x2F;code&gt; needs to be combined with a mechanism to verify that the borrower is trusted, such as those described above.&lt;&#x2F;p&gt;
&lt;p&gt;If an unsuspecting contract with a non-reverting fallback function, or an EOA, would approve a &lt;code&gt;lender&lt;&#x2F;code&gt; implementing ERC3156, and not immediately use the approval, and if the &lt;code&gt;lender&lt;&#x2F;code&gt; would not verify the return value of &lt;code&gt;onBatchFlashLoan&lt;&#x2F;code&gt;, then the unsuspecting contract or EOA could be drained of funds up to their allowance or balance limit. This would be executed by a &lt;code&gt;borrower&lt;&#x2F;code&gt; calling &lt;code&gt;batchFlashLoan&lt;&#x2F;code&gt; on the victim. The flash loan would be executed and repaid, plus any fees, which would be accumulated by the &lt;code&gt;lender&lt;&#x2F;code&gt;. For this reason, it is important that the &lt;code&gt;lender&lt;&#x2F;code&gt; implements the specification in full and reverts if &lt;code&gt;onBatchFlashLoan&lt;&#x2F;code&gt; doesn&#x27;t return the keccak256 hash for &quot;ERC3156FlashBorrower.onBatchFlashLoan&quot;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;flash-minting-external-security-considerations&quot;&gt;Flash minting external security considerations&lt;&#x2F;h3&gt;
&lt;p&gt;The typical quantum of tokens involved in flash mint transactions will give rise to new innovative attack vectors.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;example-1-interest-rate-attack&quot;&gt;Example 1 - interest rate attack&lt;&#x2F;h4&gt;
&lt;p&gt;If there exists a lending protocol that offers stable interests rates, but it does not have floor&#x2F;ceiling rate limits and it does not rebalance the fixed rate based on flash-induced liquidity changes, then it could be susceptible to the following scenario:&lt;&#x2F;p&gt;
&lt;p&gt;FreeLoanAttack.sol&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Flash mint 1 quintillion DAI&lt;&#x2F;li&gt;
&lt;li&gt;Deposit the 1 quintillion DAI + $1.5 million worth of ETH collateral&lt;&#x2F;li&gt;
&lt;li&gt;The quantum of your total deposit now pushes the stable interest rate down to 0.00001% stable interest rate&lt;&#x2F;li&gt;
&lt;li&gt;Borrow 1 million DAI on 0.00001% stable interest rate based on the 1.5M ETH collateral&lt;&#x2F;li&gt;
&lt;li&gt;Withdraw and burn the 1 quint DAI to close the original flash mint&lt;&#x2F;li&gt;
&lt;li&gt;You now have a 1 million DAI loan that is practically interest free for perpetuity ($0.10 &#x2F; year in interest)&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The key takeaway being the obvious need to implement a flat floor&#x2F;ceiling rate limit and to rebalance the rate based on short term liquidity changes.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;example-2-arithmetic-overflow-and-underflow&quot;&gt;Example 2 - arithmetic overflow and underflow&lt;&#x2F;h4&gt;
&lt;p&gt;If the flash mint provider does not place any limits on the amount of flash mintable tokens in a transaction, then anyone can flash mint 2^256-1 amount of tokens.&lt;&#x2F;p&gt;
&lt;p&gt;The protocols on the receiving end of the flash mints will need to ensure their contracts can handle this. One obvious way is to leverage OpenZeppelin&#x27;s SafeMath libraries as a catch-all safety net, however consideration should be given to when it is or isn&#x27;t used given the gas tradeoffs.&lt;&#x2F;p&gt;
&lt;p&gt;If you recall there was a series of incidents in 2018 where exchanges such as OKEx, Poloniex, HitBTC and Huobi had to shutdown deposits and withdrawls of ERC20 tokens due to integer overflows within the ERC20 token contracts.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;flash-minting-internal-security-considerations&quot;&gt;Flash minting internal security considerations&lt;&#x2F;h3&gt;
&lt;p&gt;The coupling of flash minting with business specific features in the same platform can easily lead to unintended consequences.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;example-treasury-draining&quot;&gt;Example - Treasury draining&lt;&#x2F;h4&gt;
&lt;p&gt;In early implementations of the Yield Protocol flash loaned fyDai could be redeemed for Dai, which could be used to liquidate the Yield Protocol CDP vault in MakerDAO:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Flash mint a very large amount of fyDai.&lt;&#x2F;li&gt;
&lt;li&gt;Redeem for Dai as much fyDai as the Yield Protocol collateral would allow.&lt;&#x2F;li&gt;
&lt;li&gt;Trigger a stability rate increase with a call to &lt;code&gt;jug.drip&lt;&#x2F;code&gt; which would make the Yield Protocol uncollateralized.&lt;&#x2F;li&gt;
&lt;li&gt;Liquidate the Yield Protocol CDP vault in MakerDAO.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Deposit Contract Snapshot Interface</title>
        <published>2021-01-29T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Mark Mackey</name><uri>https://github.com/ethDreamer</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4881/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-4881-deposit-contract-snapshot-interface/8554" />
        

        <id>https://wg-eips.ritovision.com/4881/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="interface"
                label="Interface" />
            
        

        
        <category
            term="tag:eip:4881"
            label="EIP-4881" />
        

        
        

        
        <summary type="html">Establishing the format and endpoint for transmitting a snapshot of the deposit Merkle tree</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4881/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP defines a standard format for transmitting the deposit contract Merkle tree in a compressed form during weak subjectivity sync. This allows newly syncing consensus clients to reconstruct the deposit tree much faster than downloading all historical deposits. The format proposed also allows clients to prune deposits that are no longer needed to participate fully in consensus (see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4881&#x2F;#deposit-finalization-flow&quot;&gt;Deposit Finalization Flow&lt;&#x2F;a&gt;).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;To reconstruct the deposit Merkle tree, most client implementations require beacon nodes to download and store every deposit log since the launch of the deposit contract. However, this approach requires beacon nodes to store far more deposits than necessary to participate in consensus. Additionally, this leads to increased sync times for new nodes, which is particularly evident during weak subjectivity sync. This simplistic approach also prevents historical contract logs from being pruned from full nodes, a prospect frequently discussed in the context of limiting state growth.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Consensus clients MAY continue to implement the deposit Merkle tree however they choose. However, when transmitting the tree to newly syncing nodes, clients MUST use the following format:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DepositTreeSnapshot&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    finalized&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Hash32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; DEPOSIT_CONTRACT_DEPTH&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    deposit_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    deposit_count&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    execution_block_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    execution_block_height&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Where &lt;code&gt;finalized&lt;&#x2F;code&gt; is a variable-length list (of maximum size &lt;code&gt;DEPOSIT_CONTRACT_DEPTH&lt;&#x2F;code&gt;) containing the hashes defined in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4881&#x2F;#deposit-finalization-flow&quot;&gt;Deposit Finalization Flow&lt;&#x2F;a&gt; section below. The fields &lt;code&gt;deposit_root&lt;&#x2F;code&gt;, &lt;code&gt;deposit_count&lt;&#x2F;code&gt;, and &lt;code&gt;execution_block_hash&lt;&#x2F;code&gt; store the same information as the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;2b45496fe48fa75450ad29a05bdd48866f86528a&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#eth1data&quot;&gt;&lt;code&gt;Eth1Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; object that corresponds to the snapshot, and &lt;code&gt;execution_block_height&lt;&#x2F;code&gt; is the height of the execution block with hash &lt;code&gt;execution_block_hash&lt;&#x2F;code&gt;. Consensus clients MUST make this structure available via the Beacon Node API endpoint:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;eth&#x2F;v1&#x2F;beacon&#x2F;deposit_snapshot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;deposit-finalization-flow&quot;&gt;Deposit Finalization Flow&lt;&#x2F;h3&gt;
&lt;p&gt;During deposit processing, the beacon chain requires deposits to be submitted along with a Merkle path to the deposit root. This is required exactly once for each deposit. When a deposit has been processed by the beacon chain and the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4881&#x2F;#deposit-finalization-conditions&quot;&gt;deposit finalization conditions&lt;&#x2F;a&gt; have been met, many of the hashes along the path to the deposit root will never be required again to construct Merkle proofs on chain. These unnecessary hashes MAY be pruned to save space. The image below illustrates the evolution of the deposit Merkle tree under this process alongside the corresponding &lt;code&gt;DepositTreeSnapshot&lt;&#x2F;code&gt; as new deposits are added and older deposits become finalized:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4881&#x2F;.&#x2F;assets&#x2F;deposit_tree_evolution.svg&quot; alt=&quot;deposit tree evolution&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The format in this specification was chosen to achieve several goals simultaneously:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Enable reconstruction of the deposit contract Merkle tree without requiring full nodes to store all historical contract logs&lt;&#x2F;li&gt;
&lt;li&gt;Avoid requiring consensus nodes to retain more deposits than necessary to fully participate in consensus&lt;&#x2F;li&gt;
&lt;li&gt;Simplicity of implementation (see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4881&#x2F;#reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;a&gt; section)&lt;&#x2F;li&gt;
&lt;li&gt;Increase speed of weak subjectivity sync&lt;&#x2F;li&gt;
&lt;li&gt;Compatibility with existing implementations of this mechanism (see discussion)&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The proposed &lt;code&gt;DepositTreeSnapshot&lt;&#x2F;code&gt; structure includes both &lt;code&gt;execution_block_hash&lt;&#x2F;code&gt; and &lt;code&gt;execution_block_height&lt;&#x2F;code&gt; for convenience to consensus node implementors. While only one of these fields is strictly necessary, different clients may have already designed their block cache logic around one or the other. Sending only one of these would force some consensus clients to query the execution engine for the other information, but as this is happening in the context of a newly syncing consensus node, it is very likely that the execution engine will not be synced, especially post-merge. The &lt;code&gt;deposit_root&lt;&#x2F;code&gt; field is also not strictly necessary, but by including it, newly syncing consensus nodes can cheaply validate any received snapshot against itself (see the &lt;code&gt;calculate_root()&lt;&#x2F;code&gt; method in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4881&#x2F;#reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;a&gt;).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-not-reconstruct-the-tree-directly-from-the-deposit-contract&quot;&gt;Why not Reconstruct the Tree Directly from the Deposit Contract?&lt;&#x2F;h3&gt;
&lt;p&gt;The deposit contract can only provide the tree at the head of the chain. Because the beacon chain&#x27;s view of the deposit contract lags behind the execution chain by &lt;code&gt;ETH1_FOLLOW_DISTANCE&lt;&#x2F;code&gt;, there are almost always deposits which haven&#x27;t yet been included in the chain that need proofs constructed from an earlier version of the tree than exists at the head.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-not-reconstruct-the-tree-from-a-deposit-in-the-beacon-chain&quot;&gt;Why not Reconstruct the Tree from a Deposit in the Beacon Chain?&lt;&#x2F;h3&gt;
&lt;p&gt;In principle, a node could scan backwards through the chain starting from the weak subjectivity checkpoint to locate a suitable &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;2b45496fe48fa75450ad29a05bdd48866f86528a&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#deposit&quot;&gt;&lt;code&gt;Deposit&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;, and then extract the rightmost branch of the tree from that. The node would also need to extract the &lt;code&gt;execution_block_hash&lt;&#x2F;code&gt; from which to start syncing new deposits from the &lt;code&gt;Eth1Data&lt;&#x2F;code&gt; in the corresponding &lt;code&gt;BeaconState&lt;&#x2F;code&gt;. This approach is less desirable for a few reasons:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;More difficult to implement due to the edge cases involved in finding a suitable deposit to anchor to (the rightmost branch of the latest not-yet-included deposit is required)&lt;&#x2F;li&gt;
&lt;li&gt;This would make backfilling beacon blocks a requirement for reconstructing the deposit tree and therefore a requirement for block production&lt;&#x2F;li&gt;
&lt;li&gt;This is inherently slower than getting this information from the weak subjectivity checkpoint&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal is fully backwards compatible.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases are included in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4881&#x2F;.&#x2F;assets&#x2F;test_cases.yaml&quot;&gt;test_cases.yaml&lt;&#x2F;a&gt;. Each case is structured as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DepositTestCase&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    deposit_data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; DepositData&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;     #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; These are all the inputs to the deposit contract&amp;#39;s deposit() function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    deposit_data_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;     #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The tree hash root of this deposit (calculated for convenience)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    eth1_data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Eth1Data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;           #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An Eth1Data object that can be used to finalize the tree after pushing this deposit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block_height&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;          #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The height of the execution block with this Eth1Data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    snapshot&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; DepositTreeSnapshot&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The resulting DepositTreeSnapshot object if the tree were finalized after this deposit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This EIP also includes other files for testing:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4881&#x2F;.&#x2F;assets&#x2F;deposit_snapshot.py&quot;&gt;deposit_snapshot.py&lt;&#x2F;a&gt; contains the same code as the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4881&#x2F;#reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4881&#x2F;.&#x2F;assets&#x2F;eip_4881.py&quot;&gt;eip_4881.py&lt;&#x2F;a&gt; contains boilerplate declarations&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4881&#x2F;.&#x2F;assets&#x2F;test_deposit_snapshot.py&quot;&gt;test_deposit_snapshot.py&lt;&#x2F;a&gt; includes code for running test cases against the reference implementation&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;If these files are downloaded to the same directory, the test cases can be run by executing &lt;code&gt;pytest&lt;&#x2F;code&gt; in that directory.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;This implementation lacks full error checking and is optimized for readability over efficiency. If &lt;code&gt;tree&lt;&#x2F;code&gt; is a &lt;code&gt;DepositTree&lt;&#x2F;code&gt;, then the &lt;code&gt;DepositTreeSnapshot&lt;&#x2F;code&gt; can be obtained by calling &lt;code&gt;tree.get_snapshot()&lt;&#x2F;code&gt; and a new instance of the tree can be recovered from the snapshot by calling &lt;code&gt;DepositTree.from_snapshot()&lt;&#x2F;code&gt;. See the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4881&#x2F;#deposit-finalization-conditions&quot;&gt;Deposit Finalization Conditions&lt;&#x2F;a&gt; section for discussion on when the tree can be pruned by calling &lt;code&gt;tree.finalize()&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Generating proofs for deposits against an earlier version of the tree is relatively fast in this implementation; just create a copy of the finalized tree with &lt;code&gt;copy = DepositTree.from_snapshot(tree.get_snapshot())&lt;&#x2F;code&gt; and then append the remaining deposits to the desired count with &lt;code&gt;copy.push_leaf(deposit)&lt;&#x2F;code&gt;. Proofs can then be obtained with &lt;code&gt;copy.get_proof(index)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;from&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt; __future__&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; import&lt;&#x2F;span&gt;&lt;span&gt; annotations&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt; typing&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; import&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Optional&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Tuple&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt; dataclasses&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; import&lt;&#x2F;span&gt;&lt;span&gt; dataclass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt; abc&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; import&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ABC&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;abstractmethod&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt; eip_4881&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; import&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; DEPOSIT_CONTRACT_DEPTH&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;Hash32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;sha256&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;to_le_bytes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;zerohashes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;dataclass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DepositTreeSnapshot&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    finalized&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Hash32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; DEPOSIT_CONTRACT_DEPTH&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    deposit_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    deposit_count&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    execution_block_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    execution_block_height&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calculate_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        size&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;deposit_count&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;finalized&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; zerohashes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; level&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; DEPOSIT_CONTRACT_DEPTH&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;size&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sha256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;finalized&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; root&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sha256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; zerohashes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;level&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            size&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; sha256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; to_le_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;deposit_count&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; from_tree_parts&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;finalized&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Hash32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;                        deposit_count&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;                        execution_block&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Tuple&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Hash32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; DepositTreeSnapshot&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        snapshot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; DepositTreeSnapshot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            finalized&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; zerohashes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; deposit_count&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; execution_block&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; execution_block&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A real implementation should store the deposit_root from the eth1_data passed to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; DepositTree.finalize() instead of relying on calculate_root() here. This allows&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the snapshot to be validated using calculate_root().&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        snapshot&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;deposit_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; snapshot&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;calculate_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; snapshot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;dataclass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DepositTree&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    tree&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; MerkleTree&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    mix_in_length&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    finalized_execution_block&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Optional&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Tuple&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Hash32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; new&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; DepositTree&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        merkle&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; MerkleTree&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;create&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; DEPOSIT_CONTRACT_DEPTH&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; DepositTree&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;merkle&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_snapshot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; DepositTreeSnapshot&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;finalized_execution_block&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        finalized&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        deposit_count&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;tree&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get_finalized&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;finalized&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; DepositTreeSnapshot&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_tree_parts&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            finalized&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; deposit_count&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;finalized_execution_block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; from_snapshot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;snapshot&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; DepositTreeSnapshot&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; DepositTree&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; decent validation check on the snapshot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;snapshot&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;deposit_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; snapshot&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;calculate_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        finalized_execution_block&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;snapshot&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;execution_block_hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; snapshot&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;execution_block_height&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        tree&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; MerkleTree&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_snapshot_parts&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            snapshot&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;finalized&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; snapshot&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;deposit_count&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; DEPOSIT_CONTRACT_DEPTH&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; DepositTree&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tree&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; snapshot&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;deposit_count&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; finalized_execution_block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; finalize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; eth1_data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Eth1Data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; execution_block_height&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;finalized_execution_block&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;eth1_data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;block_hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; execution_block_height&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;tree&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;finalize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;eth1_data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;deposit_count&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; DEPOSIT_CONTRACT_DEPTH&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_proof&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; index&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Tuple&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Hash32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Hash32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;mix_in_length&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ensure index &amp;gt; finalized deposit index&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;tree&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get_finalized&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        leaf&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; proof&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;tree&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;generate_proof&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; DEPOSIT_CONTRACT_DEPTH&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        proof&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;to_le_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;mix_in_length&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; leaf&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; proof&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; sha256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;tree&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; to_le_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;mix_in_length&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; push_leaf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; leaf&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;mix_in_length&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;tree&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;tree&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;push_leaf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;leaf&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; DEPOSIT_CONTRACT_DEPTH&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MerkleTree&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    @&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;abstractmethod&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        pass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    @&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;abstractmethod&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; is_full&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        pass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    @&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;abstractmethod&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; push_leaf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; leaf&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; level&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; MerkleTree&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        pass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    @&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;abstractmethod&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; finalize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; deposits_to_finalize&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; level&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; MerkleTree&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        pass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    @&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;abstractmethod&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_finalized&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; result&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Hash32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; returns the number of finalized deposits in the tree&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; while populating result with the finalized hashes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        pass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; create&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;leaves&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Hash32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; depth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; MerkleTree&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;leaves&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; Zero&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;depth&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;depth&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; Leaf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;leaves&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        split&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;depth&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;leaves&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        left&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; MerkleTree&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;create&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;leaves&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;split&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; depth&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        right&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; MerkleTree&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;create&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;leaves&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;split&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; depth&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; Node&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;left&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; right&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; from_snapshot_parts&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;finalized&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Hash32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; deposits&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; level&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; MerkleTree&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;finalized&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; or&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;deposits&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; empty tree&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; Zero&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;level&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; deposits&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span&gt;level&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; Finalized&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;deposits&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; finalized&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        left_subtree&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;level&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; deposits&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span&gt; left_subtree&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            left&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; MerkleTree&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_snapshot_parts&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;finalized&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; deposits&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; level&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            right&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Zero&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;level&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; Node&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;left&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; right&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            left&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Finalized&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;left_subtree&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; finalized&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            right&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; MerkleTree&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_snapshot_parts&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;finalized&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; deposits&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; left_subtree&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; level&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; Node&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;left&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; right&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; generate_proof&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; index&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; depth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Tuple&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Hash32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Hash32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        proof&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        node&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        while&lt;&#x2F;span&gt;&lt;span&gt; depth&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            ith_bit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;depth&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; ith_bit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                proof&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;left&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                node&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; node&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;right&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                proof&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;right&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                node&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; node&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;left&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            depth&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        proof&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;reverse&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; node&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; proof&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;dataclass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Finalized&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;MerkleTree&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    deposit_count&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; is_full&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; True&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; finalize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; deposits_to_finalize&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; level&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; MerkleTree&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_finalized&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; result&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Hash32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        result&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;hash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;deposit_count&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;dataclass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Leaf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;MerkleTree&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; is_full&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; True&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; finalize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; deposits_to_finalize&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; level&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; MerkleTree&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; Finalized&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;hash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_finalized&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; result&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Hash32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;dataclass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Node&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;MerkleTree&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    left&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; MerkleTree&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    right&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; MerkleTree&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; sha256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;left&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;right&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; is_full&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;right&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;is_full&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; push_leaf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; leaf&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; level&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; MerkleTree&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;left&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;is_full&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;left&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;left&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;push_leaf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;leaf&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; level&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;right&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;right&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;push_leaf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;leaf&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; level&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; finalize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; deposits_to_finalize&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; level&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; MerkleTree&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        deposits&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span&gt;level&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; deposits&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span&gt; deposits_to_finalize&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; Finalized&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;deposits&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;left&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;left&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;finalize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;deposits_to_finalize&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; level&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; deposits_to_finalize&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; deposits&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            remaining&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; deposits_to_finalize&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; deposits&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;right&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;right&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;finalize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;remaining&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; level&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_finalized&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; result&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Hash32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;left&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get_finalized&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;right&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get_finalized&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;dataclass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Zero&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;MerkleTree&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    n&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; DEPOSIT_CONTRACT_DEPTH&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Handle the entirely empty tree case. This is included for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; consistency&#x2F;clarity as the zerohashes array is typically&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; only defined from 0 to DEPOSIT_CONTRACT_DEPTH - 1.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; sha256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;zerohashes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; zerohashes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; zerohashes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;n&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; is_full&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; push_leaf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; leaf&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; level&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; MerkleTree&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; MerkleTree&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;create&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;leaf&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; level&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_finalized&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; result&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Hash32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;relying-on-weak-subjectivity-sync&quot;&gt;Relying on Weak Subjectivity Sync&lt;&#x2F;h3&gt;
&lt;p&gt;The upcoming switch to PoS will require newly synced nodes to rely on valid weak subjectivity checkpoints because of long-range attacks. This proposal relies on the weak subjectivity assumption that clients will not bootstrap with an invalid WS checkpoint.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;deposit-finalization-conditions&quot;&gt;Deposit Finalization Conditions&lt;&#x2F;h3&gt;
&lt;p&gt;Care must be taken not to send a snapshot which includes deposits that haven&#x27;t been fully included in the finalized checkpoint. Let &lt;code&gt;state&lt;&#x2F;code&gt; be the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;2b45496fe48fa75450ad29a05bdd48866f86528a&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#beaconstate&quot;&gt;&lt;code&gt;BeaconState&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; at a given block in the chain. Under normal operation, the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;2b45496fe48fa75450ad29a05bdd48866f86528a&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#eth1data&quot;&gt;&lt;code&gt;Eth1Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; stored in &lt;code&gt;state.eth1_data&lt;&#x2F;code&gt; is replaced every &lt;code&gt;EPOCHS_PER_ETH1_VOTING_PERIOD&lt;&#x2F;code&gt; epochs. Thus, finalization of the deposit tree proceeds with increments of &lt;code&gt;state.eth1_data&lt;&#x2F;code&gt;. Let &lt;code&gt;eth1data&lt;&#x2F;code&gt; be some &lt;code&gt;Eth1Data&lt;&#x2F;code&gt;. Both of the following conditions MUST be met to consider &lt;code&gt;eth1data&lt;&#x2F;code&gt; finalized:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;A finalized checkpoint exists where the corresponding &lt;code&gt;state&lt;&#x2F;code&gt; has &lt;code&gt;state.eth1_data == eth1data&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;A finalized checkpoint exists where the corresponding &lt;code&gt;state&lt;&#x2F;code&gt; has &lt;code&gt;state.eth1_deposit_index &amp;gt;= eth1data.deposit_count&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;When these conditions are met, the tree can be pruned in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4881&#x2F;#reference-implementation&quot;&gt;reference implementation&lt;&#x2F;a&gt; by calling &lt;code&gt;tree.finalize(eth1data, execution_block_height)&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Difficulty Bomb Delay to Q2&#x2F;2022</title>
        <published>2021-01-25T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Afri Schoedon</name><uri>https://github.com/q9f</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3238/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/3239" />
        

        <id>https://wg-eips.ritovision.com/3238/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:3238"
            label="EIP-3238" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3238/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Delays the difficulty bomb so 30 second blocks won&#x27;t happen until around Q2&#x2F;2022.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Starting with &lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt; the client will calculate the difficulty based on a fake block number suggesting to the client that the difficulty bomb is adjusting eleven million blocks later than the actual block number.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Even after the Ethereum 2.0 mainnet launch, Ethash proof-of-work mining on the legacy chain should be feasible. It should allow miners sealing new blocks every 13~15 seconds on average for another ten months and allow both Ethereum 1.x and Ethereum 2.0 developers to conclude the merge.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h4 id=&quot;relax-difficulty-with-fake-block-number&quot;&gt;Relax Difficulty with Fake Block Number&lt;&#x2F;h4&gt;
&lt;p&gt;For the purposes of &lt;code&gt;calc_difficulty&lt;&#x2F;code&gt;, simply replace the use of &lt;code&gt;block.number&lt;&#x2F;code&gt;, as used in the exponential ice age component, with the formula:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;fake_block_number = max(0, block.number - 11_000_000) if block.number &amp;gt;= FORK_BLOCK_NUMBER else block.number&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This will delay the ice age by another ~26 million seconds (approximately ~9.89 months), so the chain would be back at ~30 second block times in Q2&#x2F;2022. Hopefully, by then the Eth1-to-Eth2 merge will be concluded and the ice age fulfilled its task.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is not forward compatible and introduces backwards incompatibilities in the difficulty calculation. Therefore, it should be included in a scheduled hardfork at a certain block number. It&#x27;s suggested to consider this EIP either with or shortly after the Berlin hard-fork but not later than July 2021.&lt;&#x2F;p&gt;
&lt;p&gt;Alternatively, in order to maintain stability of the system, a it can be considered to activate this EIP along with EIP-1559 fee market changes in a bundle. With the delay of the ice age, there is a desire to no further increase inflation and rather incentivize users to participate in proof-of-stake consensus instead.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;There are no known security issues with this proposal.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Described Data</title>
        <published>2021-01-23T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Richard Moore</name><uri>https://github.com/ricmoo</uri>
	</author>
	
	<author>
		<name>Nick Johnson</name><uri>https://github.com/arachnid</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3224/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/3225" />
        

        <id>https://wg-eips.ritovision.com/3224/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:3224"
            label="ERC-3224" />
        

        
        

        
        <summary type="html">Contract method to compute human-readable descriptions for signable data.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3224/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Human-readable descriptions for machine executable operations,
described in higher level machine readable data, so that wallets
can provide meaningful feedback to the user describing the
action the user is about to perform.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;When using an Ethereum Wallet (e.g. MetaMask, Clef, Hardware
Wallets) users must accept and authorize signing messages or
sending transactions.&lt;&#x2F;p&gt;
&lt;p&gt;Due to the complexity of Ethereum transactions, wallets are very
limitd in their ability to provide insight into the contents of
transactions user are approving; outside special-cased support
for common transactions such as ERC20 transfers, this often amounts
to asking the user to sign an opaque blob of binary data.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP presents a method for dapp developers to enable a more
comfortable user experience by providing wallets with a means
to generate a better description about what the contract claims
will happen.&lt;&#x2F;p&gt;
&lt;p&gt;It does not address malicious contracts which wish to lie, it
only addresses honest contracts that want to make their user&#x27;s
life better. We believe that this is a reasonable security model,
as transaction descriptions can be audited at the same time as
contract code, allowing auditors and code reviewers to check that
transaction descriptions are accurate as part of their review.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;strong&gt;description string&lt;&#x2F;strong&gt; and &lt;strong&gt;described data&lt;&#x2F;strong&gt; are generated
simultaneously by evaluating the contract
(i.e. the &lt;strong&gt;describer&lt;&#x2F;strong&gt;), passing the &lt;strong&gt;describer inputs&lt;&#x2F;strong&gt; to the
method:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; eipXXXDescribe&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; describer_inputs&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; description_string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; described_data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The method must be executable in a static context, (i.e. any
side effects, such as logX, sstore, etc.), including through
indirect calls may be ignored.&lt;&#x2F;p&gt;
&lt;p&gt;During evaluation, the &lt;code&gt;ADDRESS&lt;&#x2F;code&gt; (i.e. &lt;code&gt;to&lt;&#x2F;code&gt;), &lt;code&gt;CALLER&lt;&#x2F;code&gt;
(i.e. &lt;code&gt;from&lt;&#x2F;code&gt;), &lt;code&gt;VALUE&lt;&#x2F;code&gt;, and &lt;code&gt;GASPRICE&lt;&#x2F;code&gt; must be the same as the
values for the transaction being described, so that the
code generating the description can rely on them. For signing
&lt;strong&gt;described messages&lt;&#x2F;strong&gt;, &lt;code&gt;VALUE&lt;&#x2F;code&gt; should always be 0.&lt;&#x2F;p&gt;
&lt;p&gt;When executing the bytecode, best efforts should be made to
ensure &lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt;, &lt;code&gt;NUMBER&lt;&#x2F;code&gt;, &lt;code&gt;TIMESTAMP&lt;&#x2F;code&gt; and &lt;code&gt;DIFFICULTY&lt;&#x2F;code&gt;
match the &lt;code&gt;&quot;latest&quot;&lt;&#x2F;code&gt; block. The &lt;code&gt;COINBASE&lt;&#x2F;code&gt; should be the zero
address.&lt;&#x2F;p&gt;
&lt;p&gt;The method may revert, in which case the signing must be aborted.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;new-json-rpc-methods&quot;&gt;New JSON-RPC Methods&lt;&#x2F;h3&gt;
&lt;p&gt;Clients which manage private keys should expose additional
methods for interacting with the related accounts.&lt;&#x2F;p&gt;
&lt;p&gt;If an user interface is not present or expected for any other
account-based operations, the description strings should be
ignored and the described data used directly.&lt;&#x2F;p&gt;
&lt;p&gt;These JSON-RPC methods will also be implemented in standard
Ethereum libraries, so the JSON-RPC description is meant more
of a canonical way to describe them.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;signing-described-messages&quot;&gt;Signing Described Messages&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;eth_signDescribedMessage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; describer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; describerInput&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Result: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   description: &amp;quot;text&#x2F;plain;Hello World&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   data: &amp;quot;0x...&amp;quot;, &#x2F;&#x2F; described data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   signature: &amp;quot;0x...&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Compute the &lt;strong&gt;description string&lt;&#x2F;strong&gt; and &lt;strong&gt;described data&lt;&#x2F;strong&gt; by
evaluating the call to &lt;strong&gt;describer&lt;&#x2F;strong&gt;, with the
&lt;strong&gt;describerInput&lt;&#x2F;strong&gt; passed to the ABI encoded call to
&lt;code&gt;eipXXXDescription(bytes)&lt;&#x2F;code&gt;. The &lt;code&gt;VALUE&lt;&#x2F;code&gt; during execution must
be 0.&lt;&#x2F;p&gt;
&lt;p&gt;If the wallet contains a user interface for accepting or
denying signing a message, it should present the description
string to the user. Optionally, a wallet may wish to
additionally provide a way to examine the described data.&lt;&#x2F;p&gt;
&lt;p&gt;If accepted, the computed &lt;strong&gt;described data&lt;&#x2F;strong&gt; is signed
according to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;191&#x2F;&quot;&gt;EIP-191&lt;&#x2F;a&gt;, with the &lt;em&gt;version
byte&lt;&#x2F;em&gt; of &lt;code&gt;0x00&lt;&#x2F;code&gt; and the &lt;em&gt;version specific data&lt;&#x2F;em&gt; of describer
address.&lt;&#x2F;p&gt;
&lt;p&gt;That is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x19   0x00   DESCRIBER_ADDRESS   0xDESCRIBED_DATA&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The returned result includes the &lt;strong&gt;described data&lt;&#x2F;strong&gt;, allowing
dapps that use parameters computed in the contract to be
available.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;sending-described-transactions&quot;&gt;Sending Described Transactions&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;eth_sendDescribedTransaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  to&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;0x...&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1234&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 42&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 42000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  gasPrice&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 9000000000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  describerInput&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;0x1234...&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Result: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   description: &amp;quot;text&#x2F;plain;Hello World&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   transaction: &amp;quot;0x...&amp;quot;, &#x2F;&#x2F; serialized signed transaction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Compute the &lt;strong&gt;description string&lt;&#x2F;strong&gt; and &lt;strong&gt;described data&lt;&#x2F;strong&gt; by
evaluating the call to the &lt;strong&gt;describer&lt;&#x2F;strong&gt; &lt;code&gt;to&lt;&#x2F;code&gt;, with the
&lt;strong&gt;describerInput&lt;&#x2F;strong&gt; passed  to the ABI encoded call to
&lt;code&gt;eipXXXDescription(bytes)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;If the wallet contains a user interface for accepting or
denying a transaction, it should present the description string
along with fee and value information. Optionally, a wallet may
wish to additionally provide a way to further examine the
transaction.&lt;&#x2F;p&gt;
&lt;p&gt;If accepted, the transaction data is set to the computed
&lt;strong&gt;described data&lt;&#x2F;strong&gt;, the derived transaction is signed and sent,
and the &lt;strong&gt;description string&lt;&#x2F;strong&gt; and serialized signed
transaction is returned.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;signing-described-transaction&quot;&gt;Signing Described Transaction&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;eth_signDescribedTransaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  to&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;0x...&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1234&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 42&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 42000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  gasPrice&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 9000000000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  describerInput&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;0x1234...&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Result: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   description: &amp;quot;text&#x2F;plain;Hello World&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   transaction: &amp;quot;0x...&amp;quot;, &#x2F;&#x2F; serialized signed transaction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Compute the &lt;strong&gt;description string&lt;&#x2F;strong&gt; and &lt;strong&gt;described data&lt;&#x2F;strong&gt; by
evaluating the call to the &lt;strong&gt;describer&lt;&#x2F;strong&gt; &lt;code&gt;to&lt;&#x2F;code&gt;, with the
&lt;strong&gt;describerInput&lt;&#x2F;strong&gt; passed  to the ABI encoded call to
&lt;code&gt;eipXXXDescription(bytes)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;If the wallet contains a user interface for accepting or
denying a transaction, it should present the description string
along with fee and value information. Optionally, a wallet may
wish to additionally provide a way to further examine the
transaction.&lt;&#x2F;p&gt;
&lt;p&gt;If accepted, the transaction data is set to the computed
&lt;strong&gt;described data&lt;&#x2F;strong&gt;, the derived transaction is signed (and not
sent) and the &lt;strong&gt;description string&lt;&#x2F;strong&gt; and serialized signed
transaction is returned.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;description-strings&quot;&gt;Description Strings&lt;&#x2F;h3&gt;
&lt;p&gt;A &lt;strong&gt;description string&lt;&#x2F;strong&gt; must begin with a mime-type followed
by a semi-colon (&lt;code&gt;;&lt;&#x2F;code&gt;). This EIP specifies only the &lt;code&gt;text&#x2F;plain&lt;&#x2F;code&gt;
mime-type, but future EIPs may specify additional types to
enable more rich processing, such as &lt;code&gt;text&#x2F;markdown&lt;&#x2F;code&gt; so that
addresses can be linkable within clients or to enable
multi-locale options, similar to multipart&#x2F;form-data.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;meta-description&quot;&gt;Meta Description&lt;&#x2F;h3&gt;
&lt;p&gt;There have been many attempts to solve this problem, many of
which attempt to examine the encoded transaction data or
message data directly.&lt;&#x2F;p&gt;
&lt;p&gt;In many cases, the information that would be necessary for a
meaningful description is not present in the final encoded
transaction data or message data.&lt;&#x2F;p&gt;
&lt;p&gt;Instead this EIP uses an indirect description of the data.&lt;&#x2F;p&gt;
&lt;p&gt;For example, the &lt;code&gt;commit(bytes32)&lt;&#x2F;code&gt; method of ENS places a
commitement &lt;strong&gt;hash&lt;&#x2F;strong&gt; on-chain. The hash contains the
&lt;strong&gt;blinded&lt;&#x2F;strong&gt; name and address; since the name is blinded, the
encoded data (i.e. the hash) no longer contains the original
values and is insufficient to access the necessary values to
be included in a description.&lt;&#x2F;p&gt;
&lt;p&gt;By instead describing the commitment indirectly (with the
original information intact: NAME, ADDRESS and SECRET) a
meaningful description can be computed (e.g. &quot;commit to NAME for ADDRESS (with SECRET)&quot;)
and the matching data can be computed (i.e. &lt;code&gt;commit(hash(name, owner, secret))&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;entangling-the-contract-address&quot;&gt;Entangling the Contract Address&lt;&#x2F;h3&gt;
&lt;p&gt;To prevent data being signed from one contract being used
against another, the contract address is entanlged into
both the transaction (implicitly via the &lt;code&gt;to&lt;&#x2F;code&gt; field) and
in messages by the EIP-191 versions specific data.&lt;&#x2F;p&gt;
&lt;p&gt;The use of the zero address is reserved.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;alternatives&quot;&gt;Alternatives&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;NatSpec and company are a class of more complex languages that attempt to describe the encoded data directly. Because of the language complexity they often end up being quite large requiring entire runtime environments with ample processing power and memory, as well as additional sandboxing to reduce security concerns. One goal of this is to reduce the complexity to something that could execute on hardware wallets and other simple wallets. These also describe the data directly, which in many cases (such as blinded data), cannot adequately describe the data at all&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Custom Languages; due to the complexity of Ethereum transactions, any language used would require a lot of expressiveness and re-inventing the wheel. The EVM already exists (it may not be ideal), but it is there and can handle everything necessary.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Format Strings (e.g. Trustless Signing UI Protocol; format strings can only operate on the class of regular languages, which in many cases is insufficient to describe an Ethereum transaction. This was an issue quite often during early attempts at solving this problem.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The signTypedData &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; has many parallels to what this EIP aims to solve&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;@TODO: More&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;All signatures for messages are generated using &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;191&#x2F;&quot;&gt;EIP-191&lt;&#x2F;a&gt;
which had a previously compatible version byte of &lt;code&gt;0x00&lt;&#x2F;code&gt;, so
there should be no concerns with backwards compatibility.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;All test cases operate against the published and verified contracts:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Formatter: Ropsten @ 0x7a89c0521604008c93c97aa76950198bca73d933&lt;&#x2F;li&gt;
&lt;li&gt;TestFormatter: Ropsten @ 0xab3045aa85cbcabb06ed3f3fe968fa5457727270&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The private key used for signing messages and transactions is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;privateKey = &amp;quot;0x6283185307179586476925286766559005768394338798750211641949889184&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;messages&quot;&gt;Messages&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;Example: login with signed message&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;sends selector login()&lt;&#x2F;li&gt;
&lt;li&gt;received data with selector doLogin(bytes32 timestamp)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Input:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Address:         0xab3045AA85cBCaBb06eD3F3FE968fA5457727270&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Describer Input: 0xb34e97e800000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  i.e.             encode(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                       [ &amp;quot;bytes4&amp;quot; ],&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                       [ SEL(&amp;quot;login()&amp;quot;) ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                   )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Output:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Description:     text&#x2F;plain;Log into ethereum.org?&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Data:            0x14629d78000000000000000000000000000000000000000000000000000000006010d607&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  i.e.             encodeWithSelector(&amp;quot;doLogin(bytes32)&amp;quot;, &amp;quot;0x000000000000000000000000000000000000000000000000000000006010d607&amp;quot; ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Signing:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Preimage:  0x1900ab3045aa85cbcabb06ed3f3fe968fa545772727014629d78000000000000000000000000000000000000000000000000000000006010d607&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Signature: 0x8b9def29343c85797a580c5cd3607c06e78a53351219f9ba706b9985c1a3c91e702bf678e07f5daf5ef48b3e3cc581202de233904b72cf2c4f7d714ce92075b21c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;transactions&quot;&gt;Transactions&lt;&#x2F;h3&gt;
&lt;p&gt;All transaction test cases use the ropsten network (chainId: 3)
and for all unspecified properties use 0.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Example: ERC-20 transfer&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Input:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Address:            0xab3045AA85cBCaBb06eD3F3FE968fA5457727270&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Describer Input:    0xa9059cbb000000000000000000000000000000000000000000000000000000000000000000000000000000008ba1f109551bd432803012645ac136ddd64dba720000000000000000000000000000000000000000000000002b992b75cbeb6000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  i.e.                encode(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                          [ &amp;quot;bytes4&amp;quot;, &amp;quot;address&amp;quot;, &amp;quot;uint&amp;quot;],&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                          [ SEL(&amp;quot;transfer(address,uint256)&amp;quot;), &amp;quot;0x8ba1f109551bD432803012645Ac136ddd64DBA72&amp;quot;, 3.14159e18 ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                      )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Output:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Description:        text&#x2F;plain;Send 3.14159 TOKN to &amp;quot;ricmoose.eth&amp;quot; (0x8ba1f109551bD432803012645Ac136ddd64DBA72)?&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Described Data:     0xa9059cbb0000000000000000000000000000000000000000000000002b992b75cbeb60000000000000000000000000008ba1f109551bd432803012645ac136ddd64dba72&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  i.e.                encodeWithSelector(&amp;quot;transfer(address,uint256)&amp;quot;, &amp;quot;0x8ba1f109551bD432803012645Ac136ddd64DBA72&amp;quot;, 3.14159e18)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Signing:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Signed Transaction: 0xf8a280808094ab3045aa85cbcabb06ed3f3fe968fa545772727080b844a9059cbb0000000000000000000000000000000000000000000000002b992b75cbeb60000000000000000000000000008ba1f109551bd432803012645ac136ddd64dba7229a0f33ea492d326ac32d9b7ae203c61bf7cf0ac576fb0cf8be8e4c63dc89c90de12a06c8efb28aaf3b70c032b3bd1edfc664578c49f040cf749bb19b000da56507fb2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Example: ERC-20 approve&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Input:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Address:            0xab3045AA85cBCaBb06eD3F3FE968fA5457727270&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Describer Input:    0x095ea7b3000000000000000000000000000000000000000000000000000000000000000000000000000000008ba1f109551bd432803012645ac136ddd64dba720000000000000000000000000000000000000000000000002b992b75cbeb6000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  i.e.                encode(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                          [ &amp;quot;bytes4&amp;quot;, &amp;quot;address&amp;quot;, &amp;quot;uint&amp;quot;],&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                          [ SEL(&amp;quot;approve(address,uint256)&amp;quot;), &amp;quot;0x8ba1f109551bD432803012645Ac136ddd64DBA72&amp;quot;, 3.14159e18 ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                      )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Output:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Description:        text&#x2F;plain;Approve &amp;quot;ricmoose.eth&amp;quot; (0x8ba1f109551bD432803012645Ac136ddd64DBA72) to manage 3.14159 TOKN tokens?&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Described Data:     0xa9059cbb0000000000000000000000000000000000000000000000002b992b75cbeb60000000000000000000000000008ba1f109551bd432803012645ac136ddd64dba72&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  i.e.                encodeWithSelector(&amp;quot;approve(address,uint256)&amp;quot;, &amp;quot;0x8ba1f109551bD432803012645Ac136ddd64DBA72&amp;quot;, 3.14159e18)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Signing:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Signed Transaction: 0xf8a280808094ab3045aa85cbcabb06ed3f3fe968fa545772727080b844a9059cbb0000000000000000000000000000000000000000000000002b992b75cbeb60000000000000000000000000008ba1f109551bd432803012645ac136ddd64dba7229a0f33ea492d326ac32d9b7ae203c61bf7cf0ac576fb0cf8be8e4c63dc89c90de12a06c8efb28aaf3b70c032b3bd1edfc664578c49f040cf749bb19b000da56507fb2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Example: ENS commit&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Input:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Address:            0xab3045AA85cBCaBb06eD3F3FE968fA5457727270&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Describer Input:    0x0f0e373f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000e31f43c1d823afaa67a8c5fbb8348176d225a79e65462b0520ef7d3df61b9992ed3bea0c56ead753be7c8b3614e0ce01e4cac41b00000000000000000000000000000000000000000000000000000000000000087269636d6f6f7365000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  i.e.                encode(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                          [ &amp;quot;bytes4&amp;quot;, &amp;quot;string&amp;quot;, &amp;quot;address&amp;quot;, &amp;quot;bytes32&amp;quot;],&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                          [ SEL(&amp;quot;commit(string,address,bytes32)&amp;quot;), &amp;quot;ricmoose&amp;quot;, &amp;quot;0xE31f43C1d823AfAA67A8C5fbB8348176d225A79e&amp;quot;, &amp;quot;0x65462b0520ef7d3df61b9992ed3bea0c56ead753be7c8b3614e0ce01e4cac41b&amp;quot; ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                      )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Output:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Description:        text&#x2F;plain;Commit to the ENS name &amp;quot;ricmoose.eth&amp;quot; for 0xE31f43C1d823AfAA67A8C5fbB8348176d225A79e?&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Described Data:     0xf14fcbc8e4a4f2bb818545497be34c7ab30e6e87e0001df4ba82e7c8b3f224fbaf255b91&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  i.e.                encodeWithSelector(&amp;quot;commit(bytes32)&amp;quot;, makeCommitment(&amp;quot;ricmoose&amp;quot;, &amp;quot;0xE31f43C1d823AfAA67A8C5fbB8348176d225A79e&amp;quot;, &amp;quot;0x65462b0520ef7d3df61b9992ed3bea0c56ead753be7c8b3614e0ce01e4cac41b&amp;quot;))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Signing:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Signed Transaction: 0xf88180808094ab3045aa85cbcabb06ed3f3fe968fa545772727080a4f14fcbc8e4a4f2bb818545497be34c7ab30e6e87e0001df4ba82e7c8b3f224fbaf255b912aa0a62b41d1ebda584fe84cf8a05f61b429fe4ec361e13c17f30a23281106b38a8da00bcdd896fe758d8f0cfac46445a48f76f5e9fe27790d67c51412cb98a12a0844&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Example: WETH mint()&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Input:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Address:            0xab3045AA85cBCaBb06eD3F3FE968fA5457727270&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Describer Input:    0x1249c58b00000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  i.e.                encode(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                          [ &amp;quot;bytes4&amp;quot; ],&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                          [ SEL(&amp;quot;mint()&amp;quot;) ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                      )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Value:              1.23 ether&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Output:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Description:        text&#x2F;plain;Mint 1.23 WETH (spending 1.23 ether)?&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Described Data:     0x1249c58b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  i.e.                encodeWithSelector(&amp;quot;mint()&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Signing:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Signed Transaction: 0xf86980808094ab3045aa85cbcabb06ed3f3fe968fa5457727270881111d67bb1bb0000841249c58b29a012df802e1394a97caab23c15c3a8c931668df4b2d6d604ca23f3f6b836d0aafca0071a2aebef6a9848616b4d618912f2003fb4babde3dba451b5246f866281a654&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;@TODO (consider adding it as one or more files in &lt;code&gt;..&#x2F;assets&#x2F;eip-####&#x2F;&lt;&#x2F;code&gt;)&lt;&#x2F;p&gt;
&lt;p&gt;I will add examples in Solidity and JavaScript.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;escaping-text&quot;&gt;Escaping Text&lt;&#x2F;h3&gt;
&lt;p&gt;Wallets must be careful when displaying text provided by
contracts and proper efforts must be taken to sanitize
it, for example, be sure to consider:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;HTML could be embedded to attempt to trick web-based wallets into executing code using the script tag (possibly uploading any private keys to a server)&lt;&#x2F;li&gt;
&lt;li&gt;In general, extreme care must be used when rendering HTML; consider the ENS names &lt;code&gt;&amp;lt;span style=&quot;display:none&quot;&amp;gt;not-&amp;lt;&#x2F;span&amp;gt;ricmoo.eth&lt;&#x2F;code&gt; or &lt;code&gt;&amp;amp;thinsp;ricmoo.eth&lt;&#x2F;code&gt;, which if rendered without care would appear as &lt;code&gt;ricmoo.eth&lt;&#x2F;code&gt;, which it is not&lt;&#x2F;li&gt;
&lt;li&gt;Other marks which require escaping could be included, such as quotes (&lt;code&gt;&quot;&lt;&#x2F;code&gt;), formatting (&lt;code&gt;\n&lt;&#x2F;code&gt; (new line), &lt;code&gt;\f&lt;&#x2F;code&gt; (form feed), &lt;code&gt;\t&lt;&#x2F;code&gt; (tab), any of many non-standard whitespaces), back-slassh (&lt;code&gt;\&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;UTF-8 has had bugs in the past which could allow arbitrary code execution and crashing renderers; consider using the UTF-8 replacement character (or &lt;em&gt;something&lt;&#x2F;em&gt;) for code-points outside common planes or common sub-sets within planes&lt;&#x2F;li&gt;
&lt;li&gt;Homoglyphs attacks&lt;&#x2F;li&gt;
&lt;li&gt;Right-to-left marks may affect rendering&lt;&#x2F;li&gt;
&lt;li&gt;Many other things, deplnding on your environment&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;distinguished-signed-data&quot;&gt;Distinguished Signed Data&lt;&#x2F;h3&gt;
&lt;p&gt;Applications implementing this EIP to sign message data should
ensure there are no collisions within the data which could
result in ambiguously signed data.&lt;&#x2F;p&gt;
&lt;p&gt;@TODO: Expand on this; compare packed data to ABI encoded data?&lt;&#x2F;p&gt;
&lt;h3 id=&quot;enumeration&quot;&gt;Enumeration&lt;&#x2F;h3&gt;
&lt;p&gt;If an abort occurs during signing, the response from this call
should match the response from a declined signing request;
otherwise this could be used for enumeration attacks, etc. A
random interactive-scale delay should also be added, otherwise
a &amp;lt; 10ms response could be interpreted as an error.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;replayablility&quot;&gt;Replayablility&lt;&#x2F;h3&gt;
&lt;p&gt;Transactions contain an explicit nonce, but signed messages do
not.&lt;&#x2F;p&gt;
&lt;p&gt;For many purposes, such as signing in, a nonce could be
injected (using block.timestamp) into the data. The log in
service can verify this is a recent timestamp. The timestamp
may or may not be omitted from the description string in this
case, as it it largely useful internally only.&lt;&#x2F;p&gt;
&lt;p&gt;In general, when signing messages a nonce often makes sense to
include to prevent the same signed data from being used in the
future.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>BASEFEE opcode</title>
        <published>2021-01-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Abdelhamid Bakhta</name><uri>https://github.com/abdelhamidbakhta</uri>
	</author>
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3198/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3198-basefeeopcode/5162" />
        

        <id>https://wg-eips.ritovision.com/3198/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:3198"
            label="EIP-3198" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3198/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Adds an opcode that gives the EVM access to the block&#x27;s base fee.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Add a &lt;code&gt;BASEFEE (0x48)&lt;&#x2F;code&gt; that returns the value of the base fee of the current block it is executing in.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The intended use case would be for contracts to get the value of the base fee. This feature would enable or improve existing use cases, such as:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Contracts that need to set bounties for anyone to &quot;poke&quot; them with a transaction could set the bounty to be &lt;code&gt;BASEFEE + x&lt;&#x2F;code&gt;, or &lt;code&gt;BASEFEE * (1 + x)&lt;&#x2F;code&gt;. This makes the mechanism more reliable, because they will always pay &quot;enough&quot; regardless of market conditions.&lt;&#x2F;li&gt;
&lt;li&gt;Gas futures can be implemented based on it. This would be more precise than gastokens.&lt;&#x2F;li&gt;
&lt;li&gt;Improve the security for state channels, plasma, optirolls and other fraud proof driven solutions. Having the &lt;code&gt;BASEFEE&lt;&#x2F;code&gt; as an input allows you to lengthen the challenge period automatically if you see that the &lt;code&gt;BASEFEE&lt;&#x2F;code&gt; is high.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Add a &lt;code&gt;BASEFEE&lt;&#x2F;code&gt; opcode at &lt;code&gt;(0x48)&lt;&#x2F;code&gt;, with gas cost &lt;code&gt;G_base&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;|  Op  	| Input 	| Output 	| Cost 	|
|:----:	|:-----:	|:------:	|:----:	|
| 0x48 	|   0   	|    1   	|   2  	|&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;gas-cost&quot;&gt;Gas cost&lt;&#x2F;h3&gt;
&lt;p&gt;The value of the base fee is needed to process transactions. That means it&#x27;s value is already available before running the EVM code.
The opcode does not add extra complexity and additional read&#x2F;write operations, hence the choice of &lt;code&gt;G_base&lt;&#x2F;code&gt; gas cost.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;There are no known backward compatibility issues with this opcode.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;nominal-case&quot;&gt;Nominal case&lt;&#x2F;h3&gt;
&lt;p&gt;Assuming current block base fee is &lt;code&gt;7 wei&lt;&#x2F;code&gt;.
This should push the value &lt;code&gt;7&lt;&#x2F;code&gt; (left padded byte32) to the stack.&lt;&#x2F;p&gt;
&lt;p&gt;Bytecode: &lt;code&gt;0x4800&lt;&#x2F;code&gt; (&lt;code&gt;BASEFEE, STOP&lt;&#x2F;code&gt;)&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Pc&lt;&#x2F;th&gt;&lt;th&gt;Op&lt;&#x2F;th&gt;&lt;th&gt;Cost&lt;&#x2F;th&gt;&lt;th&gt;Stack&lt;&#x2F;th&gt;&lt;th&gt;RStack&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;BASEFEE&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;STOP&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;[7]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Output: 0x
Consumed gas: &lt;code&gt;2&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The value of the base fee is not sensitive and is publicly accessible in the block header. There are no known security implications with this opcode.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EVM trace specification</title>
        <published>2020-12-07T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Martin Holst Swende</name><uri>https://github.com/holiman</uri>
	</author>
	
	<author>
		<name>Marius van der Wijden</name><uri>https://github.com/MariusVanDerWijden</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3155/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3155-create-evm-trace-specification/5007" />
        

        <id>https://wg-eips.ritovision.com/3155/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="last-call"
                label="Last Call" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="interface"
                label="Interface" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:3155"
            label="EIP-3155" />
        

        
        

        
        <summary type="html">A JSON format for EVM traces</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3155/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce a new JSON standard for EVM traces during execution of state tests.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The Ethereum Virtual Machine executes all smart contract code on ethereum.
In order to debug smart contracts and state tests better, a common format was introduced to log every execution step of the EVM.
This format was implemented by Go-Ethereum, Parity-Ethereum, Nethermind and Besu.
Since the common format was not well-defined, the implementations differed slightly, making it hard to develop adequate tooling which reduces the usefulness of tracing significantly.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP has multiple goals:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Move the specification to a more visible place to encourage new clients to implement it&lt;&#x2F;li&gt;
&lt;li&gt;Strictly define corner cases that were not addressed in the previous version&lt;&#x2F;li&gt;
&lt;li&gt;Allow for updates to the specification in case new fields are introduced during execution&lt;&#x2F;li&gt;
&lt;li&gt;Provide sample output&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Implementing this EIP in all major clients allows us to create meaningful differential fuzzers that fuzz EVM implementations for the mainnet and all upcoming hardforks.
It also helps to find differences in execution quickly in the case of a chain split.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP will enable users to create better differential fuzzing infrastructure to compare the EVM implementations of all major Ethereum clients against each other.
This could help to find bugs that are currently present in the client implementations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Clients should be able to execute simple transactions as well as code and return traces. In the following, we will call this client CUT (client under test) and use go-ethereum&#x27;s
&lt;code&gt;evm&lt;&#x2F;code&gt; binary for code examples.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;datatypes&quot;&gt;Datatypes&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Explanation&lt;&#x2F;th&gt;&lt;th&gt;Example&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Number&lt;&#x2F;td&gt;&lt;td&gt;Plain json number&lt;&#x2F;td&gt;&lt;td&gt;&quot;pc&quot;:0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Hex-Number&lt;&#x2F;td&gt;&lt;td&gt;Hex-encoded number&lt;&#x2F;td&gt;&lt;td&gt;&quot;gas&quot;:&quot;0x2540be400&quot;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;String&lt;&#x2F;td&gt;&lt;td&gt;Plain string&lt;&#x2F;td&gt;&lt;td&gt;&quot;opName&quot;:&quot;PUSH1&quot;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Hex-String&lt;&#x2F;td&gt;&lt;td&gt;Hex-encoded string&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Array of x&lt;&#x2F;td&gt;&lt;td&gt;Array of x encoded values&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Key-Value&lt;&#x2F;td&gt;&lt;td&gt;Key-Value structure with key and values encoded as hex strings&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Boolean&lt;&#x2F;td&gt;&lt;td&gt;Json bool can either be true or false&lt;&#x2F;td&gt;&lt;td&gt;&quot;pass&quot;: true&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;output&quot;&gt;Output&lt;&#x2F;h3&gt;
&lt;p&gt;The CUT MUST output a &lt;code&gt;json&lt;&#x2F;code&gt; object for EACH operation.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;required-fields&quot;&gt;Required Fields&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Explanation&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;pc&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Number&lt;&#x2F;td&gt;&lt;td&gt;Program Counter&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;op&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Number&lt;&#x2F;td&gt;&lt;td&gt;OpCode&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;gas&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Hex-Number&lt;&#x2F;td&gt;&lt;td&gt;Gas left before executing this operation&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;gasCost&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Hex-Number&lt;&#x2F;td&gt;&lt;td&gt;Gas cost of this operation&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;memSize&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Number&lt;&#x2F;td&gt;&lt;td&gt;Size of memory array&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;stack&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Array of Hex-Numbers&lt;&#x2F;td&gt;&lt;td&gt;Array of all values on the stack&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;depth&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Number&lt;&#x2F;td&gt;&lt;td&gt;Depth of the call stack&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;returnData&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Hex-String&lt;&#x2F;td&gt;&lt;td&gt;Data returned by function call&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;refund&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Hex-Number&lt;&#x2F;td&gt;&lt;td&gt;Amount of &lt;strong&gt;global&lt;&#x2F;strong&gt; gas refunded&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;optional-fields&quot;&gt;Optional Fields&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Explanation&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;opName&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;String&lt;&#x2F;td&gt;&lt;td&gt;Name of the operation&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;error&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Hex-String&lt;&#x2F;td&gt;&lt;td&gt;Description of an error (should contain revert reason if supported)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;memory&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Array of Hex-Strings&lt;&#x2F;td&gt;&lt;td&gt;Array of all allocated values&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;storage&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Key-Value&lt;&#x2F;td&gt;&lt;td&gt;Array of all stored values&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;&lt;em&gt;Example:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&amp;quot;pc&amp;quot;:0,&amp;quot;op&amp;quot;:96,&amp;quot;gas&amp;quot;:&amp;quot;0x2540be400&amp;quot;,&amp;quot;gasCost&amp;quot;:&amp;quot;0x3&amp;quot;,&amp;quot;memory&amp;quot;:&amp;quot;0x&amp;quot;,&amp;quot;memSize&amp;quot;:0,&amp;quot;stack&amp;quot;:[],&amp;quot;depth&amp;quot;:1,&amp;quot;error&amp;quot;:null,&amp;quot;opName&amp;quot;:&amp;quot;PUSH1&amp;quot;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;stack&lt;&#x2F;code&gt;, &lt;code&gt;memory&lt;&#x2F;code&gt; and &lt;code&gt;memSize&lt;&#x2F;code&gt; are the values &lt;em&gt;before&lt;&#x2F;em&gt; execution of the op.&lt;&#x2F;li&gt;
&lt;li&gt;All array attributes (&lt;code&gt;stack&lt;&#x2F;code&gt;, &lt;code&gt;memory&lt;&#x2F;code&gt;) MUST be initialized to empty arrays (&lt;code&gt;&quot;stack&quot;:[]&lt;&#x2F;code&gt;) NOT to null.&lt;&#x2F;li&gt;
&lt;li&gt;If the CUT will not be outputting values for &lt;code&gt;memory&lt;&#x2F;code&gt; or &lt;code&gt;storage&lt;&#x2F;code&gt; then the &lt;code&gt;memory&lt;&#x2F;code&gt; and &lt;code&gt;storage&lt;&#x2F;code&gt; fields are omitted.
This can happen either because the CUT does not support tracing these fields or it has been configured not to trace it.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;memSize&lt;&#x2F;code&gt; field MUST be present regardless of &lt;code&gt;memory&lt;&#x2F;code&gt; support.&lt;&#x2F;li&gt;
&lt;li&gt;Clients SHOULD implement a way to disable recording the storage as the stateroot includes all storage updates.&lt;&#x2F;li&gt;
&lt;li&gt;Clients SHOULD output the fields in the same order as listed in this EIP.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The CUT MUST NOT output a line for the &lt;code&gt;STOP&lt;&#x2F;code&gt; operation if an error occurred:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Example:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&amp;quot;pc&amp;quot;:2,&amp;quot;op&amp;quot;:0,&amp;quot;gas&amp;quot;:&amp;quot;0x2540be3fd&amp;quot;,&amp;quot;gasCost&amp;quot;:&amp;quot;0x0&amp;quot;,&amp;quot;memory&amp;quot;:&amp;quot;0x&amp;quot;,&amp;quot;memSize&amp;quot;:0,&amp;quot;stack&amp;quot;:[&amp;quot;0x40&amp;quot;],&amp;quot;depth&amp;quot;:1,&amp;quot;error&amp;quot;:null,&amp;quot;opName&amp;quot;:&amp;quot;STOP&amp;quot;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;summary-and-error-handling&quot;&gt;Summary and Error Handling&lt;&#x2F;h3&gt;
&lt;p&gt;At the end of execution, the CUT MUST print summary info; this info SHOULD have the following fields.
The summary should be a single &lt;code&gt;jsonl&lt;&#x2F;code&gt; object.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;required-fields-1&quot;&gt;Required Fields&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Explanation&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;stateRoot&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Hex-String&lt;&#x2F;td&gt;&lt;td&gt;Root of the state trie after executing the transaction&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;output&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;Return values of the function&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;gasUsed&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Hex-Number&lt;&#x2F;td&gt;&lt;td&gt;All gas used by the transaction&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;pass&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Boolean&lt;&#x2F;td&gt;&lt;td&gt;Bool whether transaction was executed successfully&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;optional-fields-1&quot;&gt;Optional Fields&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Explanation&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;time&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Number&lt;&#x2F;td&gt;&lt;td&gt;Time in nanoseconds needed to execute the transaction&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;fork&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;String&lt;&#x2F;td&gt;&lt;td&gt;Name of the fork rules used for execution&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;&lt;em&gt;Example&lt;&#x2F;em&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&amp;quot;stateRoot&amp;quot;:&amp;quot;0xd4c577737f5d20207d338c360c42d3af78de54812720e3339f7b27293ef195b7&amp;quot;,&amp;quot;output&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;gasUsed&amp;quot;:&amp;quot;0x3&amp;quot;,&amp;quot;pass&amp;quot;:&amp;quot;true&amp;quot;,&amp;quot;time&amp;quot;:141485}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is largely based on the previous non-official documentation for EVM tracing.
It tries to cover as many corner cases as possible to enable true client compatibility.
The datatypes and if a field is optional is chosen to be as compatible with current implementations as possible.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is fully backward compatible with ethereum as it only introduces a better tracing infrastructure that is optional for clients to implement.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;clients&quot;&gt;Clients&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP is fully backward compatible with go-ethereum. OpenEthereum, Besu and Nethermind clients would have to change their JSON output of
&lt;code&gt;openethereum-evm&lt;&#x2F;code&gt; &lt;code&gt;evmtool&lt;&#x2F;code&gt; and
&lt;code&gt;nethtest&lt;&#x2F;code&gt; slightly do adhere to the new and stricter specs. New clients would need to implement this change if they want to be part of the differential fuzzing group.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;BESU_HOME&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;&#x2F;bin&#x2F;evmtool --code 0x604080536040604055604060006040600060025afa6040f3 &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;pc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:0,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;op&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:96,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x2540be400&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gasCost&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x3&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;memSize&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:0,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;stack&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;depth&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:1,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;refund&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:0,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;opName&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;PUSH1&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;pc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:2,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;op&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:128,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x2540be3fd&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gasCost&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x3&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;memSize&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:0,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;stack&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x40&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;],&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;depth&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:1,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;refund&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:0,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;opName&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;DUP1&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;pc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:3,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;op&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:83,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x2540be3fa&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gasCost&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0xc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;memSize&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:0,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;stack&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x40&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x40&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;],&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;depth&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:1,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;refund&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:0,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;opName&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;MSTORE8&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;pc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:4,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;op&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:96,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x2540be3ee&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gasCost&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x3&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;memSize&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:96,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;stack&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;depth&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:1,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;refund&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:0,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;opName&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;PUSH1&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;pc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:6,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;op&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:96,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x2540be3eb&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gasCost&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x3&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;memSize&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:96,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;stack&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x40&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;],&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;depth&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:1,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;refund&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:0,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;opName&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;PUSH1&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;pc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:8,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;op&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:85,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x2540be3e8&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gasCost&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x4e20&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;memSize&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:96,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;stack&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x40&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x40&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;],&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;depth&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:1,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;refund&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:0,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;opName&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;SSTORE&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;pc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:9,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;op&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:96,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x2540b95c8&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gasCost&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x3&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;memSize&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:96,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;stack&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;depth&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:1,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;refund&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:0,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;opName&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;PUSH1&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;pc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:11,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;op&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:96,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x2540b95c5&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gasCost&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x3&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;memSize&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:96,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;stack&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x40&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;],&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;depth&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:1,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;refund&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:0,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;opName&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;PUSH1&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;pc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:13,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;op&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:96,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x2540b95c2&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gasCost&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x3&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;memSize&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:96,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;stack&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x40&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;],&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;depth&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:1,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;refund&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:0,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;opName&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;PUSH1&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;pc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:15,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;op&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:96,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x2540b95bf&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gasCost&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x3&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;memSize&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:96,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;stack&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x40&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x40&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;],&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;depth&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:1,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;refund&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:0,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;opName&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;PUSH1&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;pc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:17,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;op&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:96,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x2540b95bc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gasCost&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x3&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;memSize&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:96,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;stack&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x40&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x40&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;],&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;depth&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:1,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;refund&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:0,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;opName&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;PUSH1&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;pc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:19,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;op&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:90,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x2540b95b9&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gasCost&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x2&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;memSize&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:96,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;stack&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x40&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x40&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x2&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;],&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;depth&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:1,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;refund&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:0,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;opName&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;GAS&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;pc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:20,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;op&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:250,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x2540b95b7&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gasCost&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x24abb676c&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;memSize&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:96,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;stack&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x40&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x40&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x2&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x2540b95b7&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;],&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;depth&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:1,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;refund&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:0,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;opName&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;STATICCALL&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;pc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:21,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;op&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:96,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x2540b92a7&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gasCost&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x3&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0xf5a5fd42d16a20302798ef6ed309979b43003d2320d9f0e8ea9831a92759fb4b00000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;memSize&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:96,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;stack&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x1&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;],&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;returnData&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0xf5a5fd42d16a20302798ef6ed309979b43003d2320d9f0e8ea9831a92759fb4b&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;depth&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:1,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;refund&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:0,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;opName&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;PUSH1&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;pc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:23,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;op&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:243,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x2540b92a4&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gasCost&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0xf5a5fd42d16a20302798ef6ed309979b43003d2320d9f0e8ea9831a92759fb4b00000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;memSize&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:96,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;stack&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x1&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x40&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;],&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;returnData&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0xf5a5fd42d16a20302798ef6ed309979b43003d2320d9f0e8ea9831a92759fb4b&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;depth&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:1,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;refund&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:0,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;opName&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;RETURN&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;stateRoot&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x8fa0dcc7f1d2383c89e5737c2843632db881c0946e80b71fe7175365e6538797&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;output&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x40&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gasUsed&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x515c&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;pass&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;:true,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;fork&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Istanbul&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Tracing is expensive.&lt;&#x2F;p&gt;
&lt;p&gt;Exposing an endpoint for creating traces publicly could open up a denial of service vector.&lt;&#x2F;p&gt;
&lt;p&gt;Clients should consider putting trace endpoints behind a separate flag from other endpoints.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Increase block rewards to 5 ETH</title>
        <published>2020-12-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Ben Tinner</name><uri>https://github.com/Terra854</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3143/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3143-increase-block-rewards-to-5-eth/5061" />
        

        <id>https://wg-eips.ritovision.com/3143/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:3143"
            label="EIP-3143" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3143/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Changes the block reward paid to proof-of-work (POW) miners to 5 ETH.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Starting with &lt;code&gt;FORK_BLKNUM&lt;&#x2F;code&gt; block rewards will be increased to a base of 5 ETH, uncle and nephew rewards will be adjusted accordingly.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, the transaction fees (tx fees) portion of the mining rewards makes up a significant portion of the total rewards per block, at times almost exceeded the block reward of 2 ETH. This have resulted in situations where at times of low tx fees, POW miners decide to point their rigs away from ETH as they will always prefer to mine coins that are the most profitable at any point in time, reducing the security of the ETH network till transaction activity picks up again. By increasing the block rewards back to the original 5 ETH when the network first started, the voliatility will be reduced in terms of the percentage of tx fees that make up the mining rewards per block while increasing the total rewards per block, making it more financially attractive to POW miners to mine ETH barring any gigantic ETH price drops. The increase in block rewards will also allow smaller POW miners ample opporturnity to build up their stores of ETH so that when the time comes to fully transition to ETH 2.0, they may be more willing to become validators as they already have earned the requite amount of ETH needed to do so as opposed to having to spend tens of thousands of dollars to purchase the required ETH directly, increasing the number of validators in the network and therefore strengthening network security.&lt;&#x2F;p&gt;
&lt;p&gt;Therefore, the ultimate end goal for this EIP is to give POW miners more incentive to switch to POS once ETH 2.0 is fully implemented since the transition will take a few years to complete and during that time, they will be incentivised to hold on to the tokens instead of selling it straight away in order to prepare to be a validator for ETH 2.0, reducing the selling pressure on ETH and increasing it&#x27;s value in the long run. A side effect of miners staying on Ethereum is that network security will be assured during the transition period.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h4 id=&quot;adjust-block-uncle-and-nephew-rewards&quot;&gt;Adjust Block, Uncle, and Nephew rewards&lt;&#x2F;h4&gt;
&lt;p&gt;Adjust the block reward to &lt;code&gt;new_block_reward&lt;&#x2F;code&gt;, where&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;new_block_reward = 5_000_000_000_000_000_000 if block.number &amp;gt;= FORK_BLKNUM else block.reward&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;(5E18 wei, or 5,000,000,000,000,000,000 wei, or 5 ETH).&lt;&#x2F;p&gt;
&lt;p&gt;Analogue, if an uncle is included in a block for &lt;code&gt;block.number &amp;gt;= FORK_BLKNUM&lt;&#x2F;code&gt; such that &lt;code&gt;block.number - uncle.number = k&lt;&#x2F;code&gt;, the uncle reward is&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;new_uncle_reward = (8 - k) * new_block_reward &#x2F; 8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This is the existing formula for uncle rewards, simply adjusted with &lt;code&gt;new_block_reward&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The nephew reward for &lt;code&gt;block.number &amp;gt;= FORK_BLKNUM&lt;&#x2F;code&gt; is&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;new_nephew_reward = new_block_reward &#x2F; 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This is the existing formula for nephew rewards, simply adjusted with &lt;code&gt;new_block_reward&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;A 5 ETH base reward was chosen as a middle ground between wanting to prevent too high of an inflation rate (10.4% per annum for the first year at 5 ETH per block) and converting as many POW miners as possible into POS validators by making it easier to amass the required ETH needed through POW mining.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;There are no known backward compatibility issues with the introduction of this EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;There are no known security issues presented by this change.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Semi-Fungible Token</title>
        <published>2020-12-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Will Wang</name><uri>https://github.com/will42w</uri>
	</author>
	
	<author>
		<name>Mike Meng</name><email>myan@solv.finance</email>
	</author>
	
	<author>
		<name>Yi Cai</name><uri>https://github.com/YeeTsai</uri><email>yee.tsai@gmail.com</email>
	</author>
	
	<author>
		<name>Ryan Chow</name><email>ryanchow@solv.finance</email>
	</author>
	
	<author>
		<name>Zhongxin Wu</name><uri>https://github.com/Nerverwind</uri>
	</author>
	
	<author>
		<name>AlvisDu</name><uri>https://github.com/AlvisDu</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3525/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3525-the-semi-fungible-token" />
        

        <id>https://wg-eips.ritovision.com/3525/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:3525"
            label="ERC-3525" />
        

        
        

        
        <summary type="html">Defines a specification where ERC-721 compatible tokens with the same SLOT and different IDs are fungible.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3525/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This is a standard for semi-fungible tokens. The set of smart contract interfaces described in this document defines an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; compatible token standard. This standard introduces an &lt;code&gt;&amp;lt;ID, SLOT, VALUE&amp;gt;&lt;&#x2F;code&gt; triple scalar model that represents the semi-fungible structure of a token. It also introduces new transfer models as well as approval models that reflect the semi-fungible nature of the tokens.&lt;&#x2F;p&gt;
&lt;p&gt;Token contains an ERC-721 equivalent ID property to identify itself as a universally unique entity, so that the tokens can be transferred between addresses and approved to be operated in ERC-721 compatible way.&lt;&#x2F;p&gt;
&lt;p&gt;Token also contains a &lt;code&gt;value&lt;&#x2F;code&gt; property, representing the quantitative nature of the token. The meaning of the &#x27;value&#x27; property is quite like that of the &#x27;balance&#x27; property of an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; token. Each token has a &#x27;slot&#x27; attribute, ensuring that the value of two tokens with the same slot be treated as fungible, adding fungibility to the value property of the tokens.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP introduces new token transfer models for semi-fungibility, including value transfer between two tokens of the same slot and value transfer from a token to an address.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Tokenization is one of the most important trends by which to use and control digital assets in crypto. Traditionally, there have been two approaches to do so: fungible and non-fungible tokens. Fungible tokens generally use the ERC-20 standard, where every unit of an asset is identical to each other. ERC-20 is a flexible and efficient way to manipulate fungible tokens. Non-fungible tokens are predominantly ERC-721 tokens, a standard capable of distinguishing digital assets from one another based on identity.&lt;&#x2F;p&gt;
&lt;p&gt;However, both have significant drawbacks. For example, ERC-20 requires that users create a separate ERC-20 contract for each individual data structure or combination of customizable properties. In practice, this results in an extraordinarily large amount of ERC-20 contracts that need to be created. On the other hand, ERC-721 tokens provide no quantitative feature, significantly undercutting their computability, liquidity, and manageability. For example, if one was to create financial instruments such as bonds, insurance policy, or vesting plans using ERC-721, no standard interfaces are available for us to control the value in them, making it impossible, for example, to transfer a portion of the equity in the contract represented by the token.&lt;&#x2F;p&gt;
&lt;p&gt;A more intuitive and straightforward way to solve the problem is to create a semi-fungible token that has the quantitative features of ERC-20 and qualitative attributes of ERC-721. The backwards-compatibility with ERC-721 of such semi-fungible tokens would help utilize existing infrastructures already in use and lead to faster adoption.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Every &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3525&#x2F;&quot;&gt;ERC-3525&lt;&#x2F;a&gt; compliant contract must implement the ERC-3525, ERC-721 and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; interfaces&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-3525 Semi-Fungible Token Standard&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0xd5358140.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC3525&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is IERC165, IERC721 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST emit when value of a token is transferred to another token with the same slot,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  including zero value transfers (_value == 0) as well as transfers when tokens are created&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  (`_fromTokenId` == 0) or destroyed (`_toTokenId` == 0).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _fromTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token id to transfer value from&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _toTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token id to transfer value to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The transferred value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransferValue&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _fromTokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _toTokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST emit when the approval value of a token is set or &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token to approve&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The operator to approve for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The maximum value that `_operator` is allowed to manage&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ApprovalValue&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST emit when the slot of a token is set or &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token of which slot is set or &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _oldSlot&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The previous slot of the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _newSlot&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The updated slot of the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SlotChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _oldSlot&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _newSlot&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the number of decimals the token uses for value - e.g. 6, means the user&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  representation of the value of a token can be calculated by dividing it by 1,000,000.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  Considering the compatibility with third-party wallets, this function is defined as&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  `valueDecimals()` instead of `decimals()` to avoid conflict with ERC-20 tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; number of decimals for value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; valueDecimals&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the value of a token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token for which to query the balance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; value of `_tokenId`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the slot of a token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier for a token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; slot of the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; slotOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Allow an operator to manage the value of a token, up to the `_value`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST revert unless caller is the current owner, an authorized operator, or the approved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  address for `_tokenId`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  MUST emit the ApprovalValue event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token to approve&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The operator to be approved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The maximum value of `_toTokenId` that `_operator` is allowed to manage&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the maximum value of a token that an operator is allowed to manage.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token for which to query the allowance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of an operator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; current approval value of `_tokenId` that `_operator` is allowed to manage&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; allowance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfer value from a specified token to another specified token with the same slot.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Caller MUST be the current owner, an authorized operator or an operator who has been&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  approved the whole `_fromTokenId` or part of it.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  MUST revert if `_fromTokenId` or `_toTokenId` is zero token id or does not exist.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  MUST revert if slots of `_fromTokenId` and `_toTokenId` do not match.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  MUST revert if `_value` exceeds the balance of `_fromTokenId` or its allowance to the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  operator.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  MUST emit `TransferValue` event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _fromTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token to transfer value from&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _toTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token to transfer value to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The transferred value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _fromTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _toTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfer value from a specified token to an address. The caller should confirm that&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  `_to` is capable of receiving ERC-3525 tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function MUST create a new ERC-3525 token with the same slot for `_to`, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  or find an existing token with the same slot owned by `_to`, to receive the transferred value.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  MUST revert if `_fromTokenId` is zero token id or does not exist.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  MUST revert if `_to` is zero address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  MUST revert if `_value` exceeds the balance of `_fromTokenId` or its allowance to the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  operator.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  MUST emit `Transfer` and `TransferValue` events.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _fromTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token to transfer value from&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to transfer value to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The transferred value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; of the token which receives the transferred value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _fromTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The slot&#x27;s enumeration extension is OPTIONAL. This allows your contract to publish its full list of &lt;code&gt;SLOT&lt;&#x2F;code&gt;s and make them discoverable.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-3525 Semi-Fungible Token Standard, optional extension for slot enumeration&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Interfaces for any contract that wants to support enumeration of slots as well as tokens &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *  with the same slot.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0x3b741b9e.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC3525SlotEnumerable&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC3525&lt;&#x2F;span&gt;&lt;span&gt; &#x2F;* , &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC721Enumerable&lt;&#x2F;span&gt;&lt;span&gt; *&#x2F; &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the total amount of slots stored by the contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; total amount of slots&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; slotCount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the slot at the specified index of all slots stored by the contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _index&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The index in the slot list&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; slot at `index` of all slots.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; slotByIndex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the total amount of tokens with the same slot.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The slot to query token supply for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; total amount of tokens with the specified `_slot`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenSupplyInSlot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _slot&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the token at the specified index of all tokens with the same slot.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The slot to query tokens with&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _index&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The index in the token list of the slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; token ID at `_index` of all tokens with `_slot`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenInSlotByIndex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _slot&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The slot level approval is OPTIONAL. This allows any contract that wants to support approval for slots, which allows an operator to manage one&#x27;s tokens with the same slot.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-3525 Semi-Fungible Token Standard, optional extension for approval of slot level&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Interfaces for any contract that wants to support approval of slot level, which allows an&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *  operator to manage one&amp;#39;s tokens with the same slot.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *  See https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-3525&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0xb688be58.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC3525SlotApprovable&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC3525&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST emit when an operator is approved or disapproved to manage all of `_owner`&amp;#39;s&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  tokens with the same slot.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address whose tokens are approved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The slot to approve, all of `_owner`&amp;#39;s tokens with this slot are approved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The operator being approved or disapproved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Identify if `_operator` is approved or disapproved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ApprovalForSlot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _slot&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Approve or disapprove an operator to manage all of `_owner`&amp;#39;s tokens with the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  specified slot.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Caller SHOULD be `_owner` or an operator who has been authorized through&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  `setApprovalForAll`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  MUST emit ApprovalSlot event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address that owns the ERC-3525 tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The slot of tokens being queried approval of&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address for whom to query approval&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Identify if `_operator` would be approved or disapproved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setApprovalForSlot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _slot&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Query if `_operator` is authorized to manage all of `_owner`&amp;#39;s tokens with the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  specified slot.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address that owns the ERC-3525 tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The slot of tokens being queried approval of&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address for whom to query approval&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; True&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if `_operator` is authorized to manage all of `_owner`&amp;#39;s tokens with `_slot`,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  false otherwise.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isApprovedForSlot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _slot&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;erc-3525-token-receiver&quot;&gt;ERC-3525 Token Receiver&lt;&#x2F;h3&gt;
&lt;p&gt;If a smart contract wants to be informed when they receive values from other addresses, it should implement all of the functions in the &lt;code&gt;IERC3525Receiver&lt;&#x2F;code&gt; interface, in the implementation it can decide whether to accept or reject the transfer. See &quot;Transfer Rules&quot; for further detail.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt; pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-3525 token receiver interface&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Interface for a smart contract that wants to be informed by ERC-3525 contracts when receiving values from ANY addresses or ERC-3525 tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0x009ce20b.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC3525Receiver&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Handle the receipt of an ERC-3525 token value.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An ERC-3525 smart contract MUST check whether this function is implemented by the recipient contract, if the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  recipient contract implements this function, the ERC-3525 contract MUST call this function after a &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  value transfer (i.e. `transferFrom(uint256,uint256,uint256,bytes)`).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  MUST return 0x009ce20b (i.e. `bytes4(keccak256(&amp;#39;onERC3525Received(address,uint256,uint256,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  uint256,bytes)&amp;#39;))`) if the transfer is accepted.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  MUST revert or return any value other than 0x009ce20b if the transfer is rejected.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address which triggered the transfer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _fromTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token id to transfer value from&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _toTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token id to transfer value to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The transferred value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Additional data with no specified format&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `bytes4(keccak256(&amp;#39;onERC3525Received(address,uint256,uint256,uint256,bytes)&amp;#39;))` &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  unless the transfer is rejected.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onERC3525Received&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _fromTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _toTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;token-manipulation&quot;&gt;Token Manipulation&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;scenarios&quot;&gt;Scenarios&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Transfer:&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Besides ERC-721 compatible token transfer methods, this EIP introduces two new transfer models: value transfer from ID to ID, and value transfer from ID to address.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _fromTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _toTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _fromTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; toTokenId_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The first one allows value transfers from one token (specified by &lt;code&gt;_fromTokenId&lt;&#x2F;code&gt;) to another token (specified by &lt;code&gt;_toTokenId&lt;&#x2F;code&gt;) within the same slot, resulting in the &lt;code&gt;_value&lt;&#x2F;code&gt; being subtracted from the value of the source token and added to the value of the destination token;&lt;&#x2F;p&gt;
&lt;p&gt;The second one allows value transfers from one token (specified by &lt;code&gt;_fromTokenId&lt;&#x2F;code&gt;) to an address (specified by &lt;code&gt;_to&lt;&#x2F;code&gt;), the value is actually transferred to a token owned by the address, and the id of the destination token should be returned. Further explanation can be found in the &#x27;design decision&#x27; section for this method.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;rules&quot;&gt;Rules&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;approving rules:&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;This EIP provides four kinds of approving functions indicating different levels of approvals, which can be described as full level approval, slot level approval, token ID level approval as well as value level approval.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;setApprovalForAll&lt;&#x2F;code&gt;, compatible with ERC-721, SHOULD indicate the full level of approval, which means that the authorized operators are capable of managing all the tokens, including their values, owned by the owner.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;setApprovalForSlot&lt;&#x2F;code&gt; (optional) SHOULD indicate the slot level of approval, which means that the authorized operators are capable of managing all the tokens with the specified slot, including their values, owned by the owner.&lt;&#x2F;li&gt;
&lt;li&gt;The token ID level &lt;code&gt;approve&lt;&#x2F;code&gt; function, compatible with ERC-721, SHOULD indicate that the authorized operator is capable of managing only the specified token ID, including its value, owned by the owner.&lt;&#x2F;li&gt;
&lt;li&gt;The value level &lt;code&gt;approve&lt;&#x2F;code&gt; function, SHOULD indicate that the authorized operator is capable of managing the specified maximum value of the specified token owned by the owner.&lt;&#x2F;li&gt;
&lt;li&gt;For any approving function, the caller MUST be the owner or has been approved with a higher level of authority.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;transferFrom rules:&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;transferFrom(uint256 _fromTokenId, uint256 _toTokenId, uint256 _value)&lt;&#x2F;code&gt; function, SHOULD indicate value transfers from one token to another token, in accordance with the rules below:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;MUST revert unless &lt;code&gt;msg.sender&lt;&#x2F;code&gt; is the owner of &lt;code&gt;_fromTokenId&lt;&#x2F;code&gt;, an authorized operator or an operator who has been approved the whole token or at least &lt;code&gt;_value&lt;&#x2F;code&gt; of it.&lt;&#x2F;li&gt;
&lt;li&gt;MUST revert if &lt;code&gt;_fromTokenId&lt;&#x2F;code&gt; or &lt;code&gt;_toTokenId&lt;&#x2F;code&gt; is zero token id or does not exist.&lt;&#x2F;li&gt;
&lt;li&gt;MUST revert if slots of &lt;code&gt;_fromTokenId&lt;&#x2F;code&gt; and &lt;code&gt;_toTokenId&lt;&#x2F;code&gt; do not match.&lt;&#x2F;li&gt;
&lt;li&gt;MUST revert if &lt;code&gt;_value&lt;&#x2F;code&gt; exceeds the value of &lt;code&gt;_fromTokenId&lt;&#x2F;code&gt; or its allowance to the operator.&lt;&#x2F;li&gt;
&lt;li&gt;MUST check for the &lt;code&gt;onERC3525Received&lt;&#x2F;code&gt; function if the owner of _toTokenId is a smart contract, if the function exists, MUST call this function after the value transfer, MUST revert if the result is not equal to 0x009ce20b;&lt;&#x2F;li&gt;
&lt;li&gt;MUST emit &lt;code&gt;TransferValue&lt;&#x2F;code&gt; event.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;transferFrom(uint256 _fromTokenId, address _to, uint256 _value)&lt;&#x2F;code&gt; function, which transfers value from one token ID to an address, SHOULD follow the rule below:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;MUST either find a ERC-3525 token owned by the address &lt;code&gt;_to&lt;&#x2F;code&gt; or create a new ERC-3525 token, with the same slot of &lt;code&gt;_fromTokenId&lt;&#x2F;code&gt;, to receive the transferred value.&lt;&#x2F;li&gt;
&lt;li&gt;MUST revert unless &lt;code&gt;msg.sender&lt;&#x2F;code&gt; is the owner of &lt;code&gt;_fromTokenId&lt;&#x2F;code&gt;, an authorized operator or an operator who has been approved the whole token or at least &lt;code&gt;_value&lt;&#x2F;code&gt; of it.&lt;&#x2F;li&gt;
&lt;li&gt;MUST revert if &lt;code&gt;_fromTokenId&lt;&#x2F;code&gt; is zero token id or does not exist.&lt;&#x2F;li&gt;
&lt;li&gt;MUST revert if &lt;code&gt;_to&lt;&#x2F;code&gt; is zero address.&lt;&#x2F;li&gt;
&lt;li&gt;MUST revert if &lt;code&gt;_value&lt;&#x2F;code&gt; exceeds the value of &lt;code&gt;_fromTokenId&lt;&#x2F;code&gt; or its allowance to the operator.&lt;&#x2F;li&gt;
&lt;li&gt;MUST check for the &lt;code&gt;onERC3525Received&lt;&#x2F;code&gt; function if the _to address is a smart contract, if the function exists, MUST call this function after the value transfer, MUST revert if the result is not equal to 0x009ce20b;&lt;&#x2F;li&gt;
&lt;li&gt;MUST emit &lt;code&gt;Transfer&lt;&#x2F;code&gt; and &lt;code&gt;TransferValue&lt;&#x2F;code&gt; events.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;metadata&quot;&gt;Metadata&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;metadata-extensions&quot;&gt;Metadata Extensions&lt;&#x2F;h4&gt;
&lt;p&gt;ERC-3525 metadata extensions are compatible ERC-721 metadata extensions.&lt;&#x2F;p&gt;
&lt;p&gt;This optional interface can be identified with the ERC-165 Standard Interface Detection.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-3525 Semi-Fungible Token Standard, optional extension for metadata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Interfaces for any contract that wants to support query of the Uniform Resource Identifier&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *  (URI) for the ERC-3525 contract as well as a specified slot. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *  Because of the higher reliability of data stored in smart contracts compared to data stored in &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *  centralized systems, it is recommended that metadata, including `contractURI`, `slotURI` and &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *  `tokenURI`, be directly returned in JSON format, instead of being returned with a url pointing &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *  to any resource stored in a centralized system. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *  See https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-3525&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0xe1600902.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC3525Metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    IERC3525&lt;&#x2F;span&gt;&lt;span&gt; &#x2F;* , &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC721Metadata&lt;&#x2F;span&gt;&lt;span&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the Uniform Resource Identifier (URI) for the current ERC-3525 contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function SHOULD return the URI for this contract in JSON format, starting with&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  header `data:application&#x2F;json;`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  See https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-3525 for the JSON schema for contract URI.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; JSON formatted URI of the current ERC-3525 contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; contractURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the Uniform Resource Identifier (URI) for the specified slot.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function SHOULD return the URI for `_slot` in JSON format, starting with header&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  `data:application&#x2F;json;`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *  See https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-3525 for the JSON schema for slot URI.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; JSON formatted URI of `_slot`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; slotURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _slot&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;erc-3525-metadata-uri-json-schema&quot;&gt;ERC-3525 Metadata URI JSON Schema&lt;&#x2F;h4&gt;
&lt;p&gt;This is the &quot;ERC-3525 Metadata JSON Schema for &lt;code&gt;contractURI()&lt;&#x2F;code&gt;&quot; referenced above.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Contract Metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Contract Name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Describes the contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;image&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Optional. Either a base64 encoded imgae data or a URI pointing to a resource with mime type image&#x2F;* representing what this contract represents.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;external_link&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Optional. A URI pointing to an external resource.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;valueDecimals&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;integer&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The number of decimal places that the balance should display - e.g. 18, means to divide the token value by 1000000000000000000 to get its user representation.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This is the &quot;ERC-3525 Metadata JSON Schema for &lt;code&gt;slotURI(uint)&lt;&#x2F;code&gt;&quot; referenced above.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Slot Metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Identifies the asset category to which this slot represents&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Describes the asset category to which this slot represents&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;image&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Optional. Either a base64 encoded imgae data or a URI pointing to a resource with mime type image&#x2F;* representing the asset category to which this slot represents.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;array&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Each item of `properties` SHOULD be organized in object format, including name, description, value, order (optional), display_type (optional), etc.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;items&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The name of this property.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Describes this property.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The value of this property, which may be a string or a number.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;is_intrinsic&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;boolean&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;According to the definition of `slot`, one of the best practice to generate the value of a slot is utilizing the `keccak256` algorithm to calculate the hash value of multi properties. In this scenario, the `properties` field should contain all the properties that are used to calculate the value of `slot`, and if a property is used in the calculation, is_intrinsic must be TRUE.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;order&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;integer&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Optional, related to the value of is_intrinsic. If is_intrinsic is TRUE, it must be the order of this property appeared in the calculation method of the slot.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;display_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Optional. Specifies in what form this property should be displayed.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This is the &quot;ERC-3525 Metadata JSON Schema for &lt;code&gt;tokenURI(uint)&lt;&#x2F;code&gt;&quot; referenced above.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Token Metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Identifies the asset to which this token represents&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Describes the asset to which this token represents&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;image&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Either a base64 encoded imgae data or a URI pointing to a resource with mime type image&#x2F;* representing the asset to which this token represents.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;integer&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;THe value held by this token.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;integer&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The id of the slot that this token belongs to.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Arbitrary properties. Values may be strings, numbers, objects or arrays. Optional, you can use the same schema as the properties section of ERC-3525 Metadata JSON Schema for slotURI(uint) if you need a better description attribute.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;metadata-generation&quot;&gt;Metadata generation&lt;&#x2F;h3&gt;
&lt;p&gt;This token standard is designed to represent semi-fungible assets, which are most suited for financial instruments rather than collectibles or in-game items. For maximum transparency and safety of digital assets, we strongly recommend that all implementations should generate metadata directly from contract code rather than giving out an off-chain server URL.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;design-decision-value-transfer-from-token-to-address&quot;&gt;Design decision: Value transfer from token to address&lt;&#x2F;h3&gt;
&lt;p&gt;The &#x27;value&#x27; of a token is a property of the token and is not linked to an address, so to transfer the value to an address would be actually transferring it to a token owned by that address, not the address itself.&lt;&#x2F;p&gt;
&lt;p&gt;From the implementation perspective, the process of transferring values from token to address could be done as follows: (1) create a new token for the recipient&#x27;s address, (2) transfer the value to the new token from the &#x27;source token&#x27;. So that this method is not fully independent from the ID-to-ID transfer method, and can be viewed as syntactic sugar that wraps the process described above.&lt;&#x2F;p&gt;
&lt;p&gt;In a special case, if the destination address owns one or more tokens with the same slot value as the source token, this method will have an alternative implementation as follows: (1) find one token owned by the address with the same slot value of the source token, (2) transfer the value to the found token.&lt;&#x2F;p&gt;
&lt;p&gt;Both implementations described above should be treated as compliant with this standard.&lt;&#x2F;p&gt;
&lt;p&gt;The purpose of maintaining id-to-address transfer function is to maximize the compatibility with most wallet apps, since for most of the token standards, the destination of token transfer are addresses. This syntactic wrapping will help wallet apps easily implement the value transfer function from a token to any address.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;design-decision-notification-acceptance-mechanism-instead-of-safe-transfer&quot;&gt;Design decision: Notification&#x2F;acceptance mechanism instead of &#x27;Safe Transfer&#x27;&lt;&#x2F;h3&gt;
&lt;p&gt;ERC-721 and some later token standards introduced &#x27;Safe Transfer&#x27; model, for better control of the &#x27;safety&#x27; when transferring tokens, this mechanism leaves the choice of different transfer modes (safe&#x2F;unsafe) to the sender, and may cause some potential problems:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;In most situations the sender does not know how to choose between two kinds of transfer methods (safe&#x2F;unsafe);&lt;&#x2F;li&gt;
&lt;li&gt;If the sender calls the &lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt; method, the transfer may fail if the recipient contract did not implement the callback function, even if that contract is capable of receiving and manipulating the token without issue.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;This EIP defines a simple &#x27;Check, Notify and Response&#x27; model for better flexibility as well as simplicity:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;No extra &lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt; methods are needed, all callers only need to call one kind of transfer;&lt;&#x2F;li&gt;
&lt;li&gt;All ERC-3525 contracts MUST check for the existence of &lt;code&gt;onERC3525Received&lt;&#x2F;code&gt; on the recipient contract and call the function when it exists;&lt;&#x2F;li&gt;
&lt;li&gt;Any smart contract can implement &lt;code&gt;onERC3525Received&lt;&#x2F;code&gt; function for the purpose of being notified after receiving values; this function MUST return 0x009ce20b (i.e. &lt;code&gt;bytes4(keccak256(&#x27;onERC3525Received(address,uint256,uint256,uint256,bytes)&#x27;))&lt;&#x2F;code&gt;) if the transfer is accepted, or any other value if the transfer is rejected.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;There is a special case for this notification&#x2F;acceptance mechanism: since ERC-3525 allows value transfer from an address to itself, when a smart contract which implements &lt;code&gt;onERC3525Received&lt;&#x2F;code&gt; transfers value to itself, &lt;code&gt;onERC3525Received&lt;&#x2F;code&gt; will also be called. This allows for the contract to implement different rules of acceptance between self-value-transfer and receiving value from other addresses.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;design-decision-relationship-between-different-approval-models&quot;&gt;Design decision: Relationship between different approval models&lt;&#x2F;h3&gt;
&lt;p&gt;For semantic compatibility with ERC-721 as well as the flexibility of value manipulation of tokens, we decided to define the relationships between some of the levels of approval like that:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Approval of an id will lead to the ability to partially transfer values from this id by the approved operator; this will simplify the value approval for an id. However, the approval of total values in a token should not lead to the ability to transfer the token entity by the approved operator.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;setApprovalForAll&lt;&#x2F;code&gt; will lead to the ability to partially transfer values from any token, as well as the ability to approve partial transfer of values from any token to a third party; this will simplify the value transfer and approval of all tokens owned by an address.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;As mentioned in the beginning, this EIP is backward compatible with ERC-721.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3525&#x2F;.&#x2F;assets&#x2F;contracts&#x2F;ERC3525.sol&quot;&gt;ERC-3525 implementation&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The value level approval and slot level approval (optional) is isolated from ERC-721 approval models, so that approving value should not affect ERC-721 level approvals. Implementations of this EIP must obey this principle.&lt;&#x2F;p&gt;
&lt;p&gt;Since this EIP is ERC-721 compatible, any wallets and smart contracts that can hold and manipulate standard ERC-721 tokens will have no risks of asset loss for ERC-3525 tokens due to incompatible standards implementations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Flash Loans</title>
        <published>2020-11-15T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Alberto Cuesta Cañada</name><uri>https://github.com/alcueca</uri>
	</author>
	
	<author>
		<name>Fiona Kobayashi</name><uri>https://github.com/fifikobayashi</uri>
	</author>
	
	<author>
		<name>fubuloubu</name><uri>https://github.com/fubuloubu</uri>
	</author>
	
	<author>
		<name>Austin Williams</name><uri>https://github.com/onewayfunction</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3156/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-3156-flash-loans-review-discussion/5077" />
        

        <id>https://wg-eips.ritovision.com/3156/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:3156"
            label="ERC-3156" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3156/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC provides standard interfaces and processes for single-asset flash loans.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;A flash loan is a smart contract transaction in which a lender smart contract lends assets to a borrower smart contract with the condition that the assets are returned, plus an optional fee, before the end of the transaction. This ERC specifies interfaces for lenders to accept flash loan requests, and for borrowers to take temporary control of the transaction within the lender execution. The process for the safe execution of flash loans is also specified.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Flash loans allow smart contracts to lend an amount of tokens without a requirement for collateral, with the condition that they must be returned within the same transaction.&lt;&#x2F;p&gt;
&lt;p&gt;Early adopters of the flash loan pattern have produced different interfaces and different use patterns. The diversification is expected to intensify, and with it the technical debt required to integrate with diverse flash lending patterns.&lt;&#x2F;p&gt;
&lt;p&gt;Some of the high level differences in the approaches across the protocols include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Repayment approaches at the end of the transaction, where some pull the principal plus the fee from the loan receiver, and others where the loan receiver needs to manually return the principal and the fee to the lender.&lt;&#x2F;li&gt;
&lt;li&gt;Some lenders offer the ability to repay the loan using a token that is different to what was originally borrowed, which can reduce the overall complexity of the flash transaction and gas fees.&lt;&#x2F;li&gt;
&lt;li&gt;Some lenders offer a single entry point into the protocol regardless of whether you&#x27;re buying, selling, depositing or chaining them together as a flash loan, whereas other protocols offer discrete entry points.&lt;&#x2F;li&gt;
&lt;li&gt;Some lenders allow to flash mint any amount of their native token without charging a fee, effectively allowing flash loans bounded by computational constraints instead of asset ownership constraints.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;A flash lending feature integrates two smart contracts using a callback pattern. These are called the LENDER and the RECEIVER in this EIP.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;lender-specification&quot;&gt;Lender Specification&lt;&#x2F;h3&gt;
&lt;p&gt;A &lt;code&gt;lender&lt;&#x2F;code&gt; MUST implement the IERC3156FlashLender interface.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pragma solidity ^0.7.0 || ^0.8.0;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;import &amp;quot;.&#x2F;IERC3156FlashBorrower.sol&amp;quot;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;interface IERC3156FlashLender {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev The amount of currency available to be lent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param token The loan currency.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @return The amount of `token` that can be borrowed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function maxFlashLoan(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ) external view returns (uint256);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev The fee to be charged for a given loan.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param token The loan currency.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param amount The amount of tokens lent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @return The amount of `token` to be charged for the loan, on top of the returned principal.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function flashFee(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address token,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ) external view returns (uint256);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev Initiate a flash loan.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param receiver The receiver of the tokens in the loan, and the receiver of the callback.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param token The loan currency.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param amount The amount of tokens lent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param data Arbitrary data structure, intended to contain user-defined parameters.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function flashLoan(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        IERC3156FlashBorrower receiver,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address token,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 amount,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bytes calldata data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ) external returns (bool);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;maxFlashLoan&lt;&#x2F;code&gt; function MUST return the maximum loan possible for &lt;code&gt;token&lt;&#x2F;code&gt;. If a &lt;code&gt;token&lt;&#x2F;code&gt; is not currently supported &lt;code&gt;maxFlashLoan&lt;&#x2F;code&gt; MUST return 0, instead of reverting.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;flashFee&lt;&#x2F;code&gt; function MUST return the fee charged for a loan of &lt;code&gt;amount&lt;&#x2F;code&gt; &lt;code&gt;token&lt;&#x2F;code&gt;. If the token is not supported &lt;code&gt;flashFee&lt;&#x2F;code&gt; MUST revert.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;flashLoan&lt;&#x2F;code&gt; function MUST include a callback to the &lt;code&gt;onFlashLoan&lt;&#x2F;code&gt; function in a &lt;code&gt;IERC3156FlashBorrower&lt;&#x2F;code&gt; contract.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function flashLoan(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    IERC3156FlashBorrower receiver,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address token,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    uint256 amount,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytes calldata data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;) external returns (bool) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  require(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      receiver.onFlashLoan(msg.sender, token, amount, fee, data) == keccak256(&amp;quot;ERC3156FlashBorrower.onFlashLoan&amp;quot;),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &amp;quot;IERC3156: Callback failed&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  );&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;flashLoan&lt;&#x2F;code&gt; function MUST transfer &lt;code&gt;amount&lt;&#x2F;code&gt; of &lt;code&gt;token&lt;&#x2F;code&gt; to &lt;code&gt;receiver&lt;&#x2F;code&gt; before the callback to the receiver.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;flashLoan&lt;&#x2F;code&gt; function MUST include &lt;code&gt;msg.sender&lt;&#x2F;code&gt; as the &lt;code&gt;initiator&lt;&#x2F;code&gt; to &lt;code&gt;onFlashLoan&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;flashLoan&lt;&#x2F;code&gt; function MUST NOT modify the &lt;code&gt;token&lt;&#x2F;code&gt;, &lt;code&gt;amount&lt;&#x2F;code&gt; and &lt;code&gt;data&lt;&#x2F;code&gt; parameter received, and MUST pass them on to &lt;code&gt;onFlashLoan&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;flashLoan&lt;&#x2F;code&gt; function MUST include a &lt;code&gt;fee&lt;&#x2F;code&gt; argument to &lt;code&gt;onFlashLoan&lt;&#x2F;code&gt; with the fee to pay for the loan on top of the principal, ensuring that &lt;code&gt;fee == flashFee(token, amount)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;lender&lt;&#x2F;code&gt; MUST verify that the &lt;code&gt;onFlashLoan&lt;&#x2F;code&gt; callback returns the keccak256 hash of &quot;ERC3156FlashBorrower.onFlashLoan&quot;.&lt;&#x2F;p&gt;
&lt;p&gt;After the callback, the &lt;code&gt;flashLoan&lt;&#x2F;code&gt; function MUST take the &lt;code&gt;amount + fee&lt;&#x2F;code&gt; &lt;code&gt;token&lt;&#x2F;code&gt; from the &lt;code&gt;receiver&lt;&#x2F;code&gt;, or revert if this is not successful.&lt;&#x2F;p&gt;
&lt;p&gt;If successful, &lt;code&gt;flashLoan&lt;&#x2F;code&gt; MUST return &lt;code&gt;true&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;receiver-specification&quot;&gt;Receiver Specification&lt;&#x2F;h3&gt;
&lt;p&gt;A &lt;code&gt;receiver&lt;&#x2F;code&gt; of flash loans MUST implement the IERC3156FlashBorrower interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pragma solidity ^0.7.0 || ^0.8.0;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;interface IERC3156FlashBorrower {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev Receive a flash loan.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param initiator The initiator of the loan.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param token The loan currency.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param amount The amount of tokens lent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param fee The additional amount of tokens to repay.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param data Arbitrary data structure, intended to contain user-defined parameters.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @return The keccak256 hash of &amp;quot;ERC3156FlashBorrower.onFlashLoan&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function onFlashLoan(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address initiator,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address token,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 amount,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 fee,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bytes calldata data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ) external returns (bytes32);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;For the transaction to not revert, &lt;code&gt;receiver&lt;&#x2F;code&gt; MUST approve &lt;code&gt;amount + fee&lt;&#x2F;code&gt; of &lt;code&gt;token&lt;&#x2F;code&gt; to be taken by &lt;code&gt;msg.sender&lt;&#x2F;code&gt; before the end of &lt;code&gt;onFlashLoan&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;If successful, &lt;code&gt;onFlashLoan&lt;&#x2F;code&gt; MUST return the keccak256 hash of &quot;ERC3156FlashBorrower.onFlashLoan&quot;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The interfaces described in this ERC have been chosen as to cover the known flash lending use cases, while allowing for safe and gas efficient implementations.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;flashFee&lt;&#x2F;code&gt; reverts on unsupported tokens, because returning a numerical value would be incorrect.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;flashLoan&lt;&#x2F;code&gt; has been chosen as a function name as descriptive enough, unlikely to clash with other functions in the lender, and including both the use cases in which the tokens lent are held or minted by the lender.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;receiver&lt;&#x2F;code&gt; is taken as a parameter to allow flexibility on the implementation of separate loan initiators and receivers.&lt;&#x2F;p&gt;
&lt;p&gt;Existing flash lenders all provide flash loans of several token types from the same contract. Providing a &lt;code&gt;token&lt;&#x2F;code&gt; parameter in both the &lt;code&gt;flashLoan&lt;&#x2F;code&gt; and &lt;code&gt;onFlashLoan&lt;&#x2F;code&gt; functions matches closely the observed functionality.&lt;&#x2F;p&gt;
&lt;p&gt;A &lt;code&gt;bytes calldata data&lt;&#x2F;code&gt; parameter is included for the caller to pass arbitrary information to the &lt;code&gt;receiver&lt;&#x2F;code&gt;, without impacting the utility of the &lt;code&gt;flashLoan&lt;&#x2F;code&gt; standard.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;onFlashLoan&lt;&#x2F;code&gt; has been chosen as a function name as descriptive enough, unlikely to clash with other functions in the &lt;code&gt;receiver&lt;&#x2F;code&gt;, and following the &lt;code&gt;onAction&lt;&#x2F;code&gt; naming pattern used as well in EIP-667.&lt;&#x2F;p&gt;
&lt;p&gt;A &lt;code&gt;initiator&lt;&#x2F;code&gt; will often be required in the &lt;code&gt;onFlashLoan&lt;&#x2F;code&gt; function, which the lender knows as &lt;code&gt;msg.sender&lt;&#x2F;code&gt;. An alternative implementation which would embed the &lt;code&gt;initiator&lt;&#x2F;code&gt; in the &lt;code&gt;data&lt;&#x2F;code&gt; parameter by the caller would require an additional mechanism for the receiver to verify its accuracy, and is not advisable.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;amount&lt;&#x2F;code&gt; will be required in the &lt;code&gt;onFlashLoan&lt;&#x2F;code&gt; function, which the lender took as a parameter. An alternative implementation which would embed the &lt;code&gt;amount&lt;&#x2F;code&gt; in the &lt;code&gt;data&lt;&#x2F;code&gt; parameter by the caller would require an additional mechanism for the receiver to verify its accuracy, and is not advisable.&lt;&#x2F;p&gt;
&lt;p&gt;A &lt;code&gt;fee&lt;&#x2F;code&gt; will often be calculated in the &lt;code&gt;flashLoan&lt;&#x2F;code&gt; function, which the &lt;code&gt;receiver&lt;&#x2F;code&gt; must be aware of for repayment. Passing the &lt;code&gt;fee&lt;&#x2F;code&gt; as a parameter instead of appended to &lt;code&gt;data&lt;&#x2F;code&gt; is simple and effective.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;amount + fee&lt;&#x2F;code&gt; are pulled from the &lt;code&gt;receiver&lt;&#x2F;code&gt; to allow the &lt;code&gt;lender&lt;&#x2F;code&gt; to implement other features that depend on using &lt;code&gt;transferFrom&lt;&#x2F;code&gt;, without having to lock them for the duration of a flash loan. An alternative implementation where the repayment is transferred to the &lt;code&gt;lender&lt;&#x2F;code&gt; is also possible, but would need all other features in the lender to be also based in using &lt;code&gt;transfer&lt;&#x2F;code&gt; instead of &lt;code&gt;transferFrom&lt;&#x2F;code&gt;. Given the lower complexity and prevalence of a &quot;pull&quot; architecture over a &quot;push&quot; architecture, &quot;pull&quot; was chosen.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backwards compatibility issues identified.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;flash-borrower-reference-implementation&quot;&gt;Flash Borrower Reference Implementation&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pragma solidity ^0.8.0;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;import &amp;quot;.&#x2F;interfaces&#x2F;IERC20.sol&amp;quot;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;import &amp;quot;.&#x2F;interfaces&#x2F;IERC3156FlashBorrower.sol&amp;quot;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;import &amp;quot;.&#x2F;interfaces&#x2F;IERC3156FlashLender.sol&amp;quot;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;contract FlashBorrower is IERC3156FlashBorrower {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    enum Action {NORMAL, OTHER}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    IERC3156FlashLender lender;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    constructor (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        IERC3156FlashLender lender_&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        lender = lender_;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @dev ERC-3156 Flash loan callback&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function onFlashLoan(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address initiator,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address token,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 amount,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 fee,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bytes calldata data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ) external override returns(bytes32) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        require(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            msg.sender == address(lender),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &amp;quot;FlashBorrower: Untrusted lender&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        );&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        require(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            initiator == address(this),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &amp;quot;FlashBorrower: Untrusted loan initiator&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        );&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (Action action) = abi.decode(data, (Action));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        if (action == Action.NORMAL) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &#x2F;&#x2F; do one thing&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        } else if (action == Action.OTHER) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &#x2F;&#x2F; do another&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return keccak256(&amp;quot;ERC3156FlashBorrower.onFlashLoan&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @dev Initiate a flash loan&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function flashBorrow(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address token,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ) public {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bytes memory data = abi.encode(Action.NORMAL);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 _allowance = IERC20(token).allowance(address(this), address(lender));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 _fee = lender.flashFee(token, amount);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 _repayment = amount + _fee;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        IERC20(token).approve(address(lender), _allowance + _repayment);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        lender.flashLoan(this, token, amount, data);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;flash-mint-reference-implementation&quot;&gt;Flash Mint Reference Implementation&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pragma solidity ^0.8.0;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;import &amp;quot;..&#x2F;ERC20.sol&amp;quot;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;import &amp;quot;..&#x2F;interfaces&#x2F;IERC20.sol&amp;quot;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;import &amp;quot;..&#x2F;interfaces&#x2F;IERC3156FlashBorrower.sol&amp;quot;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;import &amp;quot;..&#x2F;interfaces&#x2F;IERC3156FlashLender.sol&amp;quot;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @author Alberto Cuesta Cañada&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @dev Extension of {ERC20} that allows flash minting.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;contract FlashMinter is ERC20, IERC3156FlashLender {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytes32 public constant CALLBACK_SUCCESS = keccak256(&amp;quot;ERC3156FlashBorrower.onFlashLoan&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    uint256 public fee; &#x2F;&#x2F;  1 == 0.01 %.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param fee_ The percentage of the loan `amount` that needs to be repaid, in addition to `amount`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    constructor (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        string memory name,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        string memory symbol,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 fee_&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ) ERC20(name, symbol) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        fee = fee_;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev The amount of currency available to be lent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param token The loan currency.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @return The amount of `token` that can be borrowed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function maxFlashLoan(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ) external view override returns (uint256) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return type(uint256).max - totalSupply();&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev The fee to be charged for a given loan.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param token The loan currency. Must match the address of this contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param amount The amount of tokens lent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @return The amount of `token` to be charged for the loan, on top of the returned principal.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function flashFee(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address token,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ) external view override returns (uint256) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        require(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            token == address(this),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &amp;quot;FlashMinter: Unsupported currency&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        );&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return _flashFee(token, amount);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev Loan `amount` tokens to `receiver`, and takes it back plus a `flashFee` after the ERC3156 callback.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param receiver The contract receiving the tokens, needs to implement the `onFlashLoan(address user, uint256 amount, uint256 fee, bytes calldata)` interface.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param token The loan currency. Must match the address of this contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param amount The amount of tokens lent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param data A data parameter to be passed on to the `receiver` for any custom use.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function flashLoan(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        IERC3156FlashBorrower receiver,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address token,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 amount,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bytes calldata data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ) external override returns (bool){&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        require(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            token == address(this),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &amp;quot;FlashMinter: Unsupported currency&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        );&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 fee = _flashFee(token, amount);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _mint(address(receiver), amount);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        require(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            receiver.onFlashLoan(msg.sender, token, amount, fee, data) == CALLBACK_SUCCESS,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &amp;quot;FlashMinter: Callback failed&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        );&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 _allowance = allowance(address(receiver), address(this));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        require(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            _allowance &amp;gt;= (amount + fee),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &amp;quot;FlashMinter: Repay not approved&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        );&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _approve(address(receiver), address(this), _allowance - (amount + fee));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _burn(address(receiver), amount + fee);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return true;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev The fee to be charged for a given loan. Internal function with no checks.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param token The loan currency.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param amount The amount of tokens lent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @return The amount of `token` to be charged for the loan, on top of the returned principal.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function _flashFee(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address token,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ) internal view returns (uint256) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return amount * fee &#x2F; 10000;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;flash-loan-reference-implementation&quot;&gt;Flash Loan Reference Implementation&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pragma solidity ^0.8.0;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;import &amp;quot;..&#x2F;interfaces&#x2F;IERC20.sol&amp;quot;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;import &amp;quot;..&#x2F;interfaces&#x2F;IERC3156FlashBorrower.sol&amp;quot;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;import &amp;quot;..&#x2F;interfaces&#x2F;IERC3156FlashLender.sol&amp;quot;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @author Alberto Cuesta Cañada&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @dev Extension of {ERC20} that allows flash lending.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;contract FlashLender is IERC3156FlashLender {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytes32 public constant CALLBACK_SUCCESS = keccak256(&amp;quot;ERC3156FlashBorrower.onFlashLoan&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    mapping(address =&amp;gt; bool) public supportedTokens;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    uint256 public fee; &#x2F;&#x2F;  1 == 0.01 %.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param supportedTokens_ Token contracts supported for flash lending.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param fee_ The percentage of the loan `amount` that needs to be repaid, in addition to `amount`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    constructor(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address[] memory supportedTokens_,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 fee_&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        for (uint256 i = 0; i &amp;lt; supportedTokens_.length; i++) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            supportedTokens[supportedTokens_[i]] = true;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        fee = fee_;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev Loan `amount` tokens to `receiver`, and takes it back plus a `flashFee` after the callback.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param receiver The contract receiving the tokens, needs to implement the `onFlashLoan(address user, uint256 amount, uint256 fee, bytes calldata)` interface.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param token The loan currency.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param amount The amount of tokens lent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param data A data parameter to be passed on to the `receiver` for any custom use.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function flashLoan(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        IERC3156FlashBorrower receiver,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address token,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 amount,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bytes calldata data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ) external override returns(bool) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        require(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            supportedTokens[token],&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &amp;quot;FlashLender: Unsupported currency&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        );&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 fee = _flashFee(token, amount);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        require(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            IERC20(token).transfer(address(receiver), amount),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &amp;quot;FlashLender: Transfer failed&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        );&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        require(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            receiver.onFlashLoan(msg.sender, token, amount, fee, data) == CALLBACK_SUCCESS,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &amp;quot;FlashLender: Callback failed&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        );&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        require(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            IERC20(token).transferFrom(address(receiver), address(this), amount + fee),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &amp;quot;FlashLender: Repay failed&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        );&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return true;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev The fee to be charged for a given loan.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param token The loan currency.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param amount The amount of tokens lent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @return The amount of `token` to be charged for the loan, on top of the returned principal.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function flashFee(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address token,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ) external view override returns (uint256) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        require(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            supportedTokens[token],&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &amp;quot;FlashLender: Unsupported currency&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        );&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return _flashFee(token, amount);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev The fee to be charged for a given loan. Internal function with no checks.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param token The loan currency.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param amount The amount of tokens lent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @return The amount of `token` to be charged for the loan, on top of the returned principal.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function _flashFee(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address token,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ) internal view returns (uint256) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return amount * fee &#x2F; 10000;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev The amount of currency available to be lent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param token The loan currency.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @return The amount of `token` that can be borrowed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function maxFlashLoan(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ) external view override returns (uint256) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return supportedTokens[token] ? IERC20(token).balanceOf(address(this)) : 0;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;verification-of-callback-arguments&quot;&gt;Verification of callback arguments&lt;&#x2F;h3&gt;
&lt;p&gt;The arguments of &lt;code&gt;onFlashLoan&lt;&#x2F;code&gt; are expected to reflect the conditions of the flash loan, but cannot be trusted unconditionally. They can be divided in two groups, that require different checks before they can be trusted to be genuine.&lt;&#x2F;p&gt;
&lt;ol start=&quot;0&quot;&gt;
&lt;li&gt;No arguments can be assumed to be genuine without some kind of verification. &lt;code&gt;initiator&lt;&#x2F;code&gt;, &lt;code&gt;token&lt;&#x2F;code&gt; and &lt;code&gt;amount&lt;&#x2F;code&gt; refer to a past transaction that might not have happened if the caller of &lt;code&gt;onFlashLoan&lt;&#x2F;code&gt; decides to lie. &lt;code&gt;fee&lt;&#x2F;code&gt; might be false or calculated incorrectly. &lt;code&gt;data&lt;&#x2F;code&gt; might have been manipulated by the caller.&lt;&#x2F;li&gt;
&lt;li&gt;To trust that the value of &lt;code&gt;initiator&lt;&#x2F;code&gt;, &lt;code&gt;token&lt;&#x2F;code&gt;, &lt;code&gt;amount&lt;&#x2F;code&gt; and &lt;code&gt;fee&lt;&#x2F;code&gt; are genuine a reasonable pattern is to verify that the &lt;code&gt;onFlashLoan&lt;&#x2F;code&gt; caller is in a whitelist of verified flash lenders. Since often the caller of &lt;code&gt;flashLoan&lt;&#x2F;code&gt; will also be receiving the &lt;code&gt;onFlashLoan&lt;&#x2F;code&gt; callback this will be trivial. In all other cases flash lenders will need to be approved if the arguments in &lt;code&gt;onFlashLoan&lt;&#x2F;code&gt; are to be trusted.&lt;&#x2F;li&gt;
&lt;li&gt;To trust that the value of &lt;code&gt;data&lt;&#x2F;code&gt; is genuine, in addition to the check in point 1, it is recommended to verify that the &lt;code&gt;initiator&lt;&#x2F;code&gt; belongs to a group of trusted addresses. Trusting the &lt;code&gt;lender&lt;&#x2F;code&gt; and the &lt;code&gt;initiator&lt;&#x2F;code&gt; is enough to trust that the contents of &lt;code&gt;data&lt;&#x2F;code&gt; are genuine.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;flash-lending-security-considerations&quot;&gt;Flash lending security considerations&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;automatic-approvals&quot;&gt;Automatic approvals&lt;&#x2F;h4&gt;
&lt;p&gt;The safest approach is to implement an approval for &lt;code&gt;amount+fee&lt;&#x2F;code&gt; before the &lt;code&gt;flashLoan&lt;&#x2F;code&gt; is executed.&lt;&#x2F;p&gt;
&lt;p&gt;Any &lt;code&gt;receiver&lt;&#x2F;code&gt; that keeps an approval for a given &lt;code&gt;lender&lt;&#x2F;code&gt; needs to include in &lt;code&gt;onFlashLoan&lt;&#x2F;code&gt; a mechanism to verify that the initiator is trusted.&lt;&#x2F;p&gt;
&lt;p&gt;Any &lt;code&gt;receiver&lt;&#x2F;code&gt; that includes in &lt;code&gt;onFlashLoan&lt;&#x2F;code&gt; the approval for the &lt;code&gt;lender&lt;&#x2F;code&gt; to take the &lt;code&gt;amount + fee&lt;&#x2F;code&gt; needs to be combined with a mechanism to verify that the initiator is trusted.&lt;&#x2F;p&gt;
&lt;p&gt;If an unsuspecting contract with a non-reverting fallback function, or an EOA, would approve a &lt;code&gt;lender&lt;&#x2F;code&gt; implementing ERC3156, and not immediately use the approval, and if the &lt;code&gt;lender&lt;&#x2F;code&gt; would not verify the return value of &lt;code&gt;onFlashLoan&lt;&#x2F;code&gt;, then the unsuspecting contract or EOA could be drained of funds up to their allowance or balance limit. This would be executed by an &lt;code&gt;initiator&lt;&#x2F;code&gt; calling &lt;code&gt;flashLoan&lt;&#x2F;code&gt; on the victim. The flash loan would be executed and repaid, plus any fees, which would be accumulated by the &lt;code&gt;lender&lt;&#x2F;code&gt;. For this reason, it is important that the &lt;code&gt;lender&lt;&#x2F;code&gt; implements the specification in full and reverts if &lt;code&gt;onFlashLoan&lt;&#x2F;code&gt; doesn&#x27;t return the keccak256 hash for &quot;ERC3156FlashBorrower.onFlashLoan&quot;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;flash-minting-external-security-considerations&quot;&gt;Flash minting external security considerations&lt;&#x2F;h3&gt;
&lt;p&gt;The typical quantum of tokens involved in flash mint transactions will give rise to new innovative attack vectors.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;example-1-interest-rate-attack&quot;&gt;Example 1 - interest rate attack&lt;&#x2F;h4&gt;
&lt;p&gt;If there exists a lending protocol that offers stable interests rates, but it does not have floor&#x2F;ceiling rate limits and it does not rebalance the fixed rate based on flash-induced liquidity changes, then it could be susceptible to the following scenario:&lt;&#x2F;p&gt;
&lt;p&gt;FreeLoanAttack.sol&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Flash mint 1 quintillion STAB&lt;&#x2F;li&gt;
&lt;li&gt;Deposit the 1 quintillion STAB + $1.5 million worth of ETH collateral&lt;&#x2F;li&gt;
&lt;li&gt;The quantum of your total deposit now pushes the stable interest rate down to 0.00001% stable interest rate&lt;&#x2F;li&gt;
&lt;li&gt;Borrow 1 million STAB on 0.00001% stable interest rate based on the 1.5M ETH collateral&lt;&#x2F;li&gt;
&lt;li&gt;Withdraw and burn the 1 quint STAB to close the original flash mint&lt;&#x2F;li&gt;
&lt;li&gt;You now have a 1 million STAB loan that is practically interest free for perpetuity ($0.10 &#x2F; year in interest)&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The key takeaway being the obvious need to implement a flat floor&#x2F;ceiling rate limit and to rebalance the rate based on short term liquidity changes.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;example-2-arithmetic-overflow-and-underflow&quot;&gt;Example 2 - arithmetic overflow and underflow&lt;&#x2F;h4&gt;
&lt;p&gt;If the flash mint provider does not place any limits on the amount of flash mintable tokens in a transaction, then anyone can flash mint 2^256-1 amount of tokens.&lt;&#x2F;p&gt;
&lt;p&gt;The protocols on the receiving end of the flash mints will need to ensure their contracts can handle this, either by using a compiler that embeds overflow protection in the smart contract bytecode, or by setting explicit checks.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;flash-minting-internal-security-considerations&quot;&gt;Flash minting internal security considerations&lt;&#x2F;h3&gt;
&lt;p&gt;The coupling of flash minting with business specific features in the same platform can easily lead to unintended consequences.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;example-treasury-draining&quot;&gt;Example - Treasury draining&lt;&#x2F;h4&gt;
&lt;p&gt;Assume a smart contract that flash lends its native token. The same smart contract borrows from a third party when users burn the native token. This pattern would be used to aggregate in the smart contract the collateralized debt of several users into a single account in the third party. The flash mint could be used to cause the lender to borrow to its limit, and then pushing interest rates in the underlying lender, liquidate the flash lender:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Flash mint from &lt;code&gt;lender&lt;&#x2F;code&gt; a very large amount of FOO.&lt;&#x2F;li&gt;
&lt;li&gt;Redeem FOO for BAR, causing &lt;code&gt;lender&lt;&#x2F;code&gt; to borrow from &lt;code&gt;underwriter&lt;&#x2F;code&gt; all the way to its borrowing limit.&lt;&#x2F;li&gt;
&lt;li&gt;Trigger a debt rate increase in &lt;code&gt;underwriter&lt;&#x2F;code&gt;, making &lt;code&gt;lender&lt;&#x2F;code&gt; undercollateralized.&lt;&#x2F;li&gt;
&lt;li&gt;Liquidate the &lt;code&gt;lender&lt;&#x2F;code&gt; for profit.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Block Explorer API Routes</title>
        <published>2020-11-02T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Pedro Gomes</name><uri>https://github.com/pedrouid</uri>
	</author>
	
	<author>
		<name>ligi</name><uri>https://github.com/ligi</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3091/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3091-block-explorer-api-routes/4907" />
        

        <id>https://wg-eips.ritovision.com/3091/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="interface"
                label="Interface" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:3091"
            label="EIP-3091" />
        

        
        

        
        <summary type="html">API Routes for Blockchain explorers</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3091/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal brings standardization between block explorers API routes when linking transactions, blocks, accounts and tokens.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently wallets and dapps link transactions and accounts to block explorer web pages but as chain diversity and layer two solutions grow it becomes harder to maintain a consistent user experience. Adding new chains or layer two solutions becomes harder given these endpoints are inconsistent. Standardizing the API routes to these links improves interoperability between wallets and block explorers.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Block explorers will route their webpages accordingly for the following data:&lt;&#x2F;p&gt;
&lt;h3 id=&quot;blocks&quot;&gt;Blocks&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;&amp;lt;BLOCK_EXPLORER_URL&amp;gt;&#x2F;block&#x2F;&amp;lt;BLOCK_HASH_OR_HEIGHT&amp;gt;&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;transactions&quot;&gt;Transactions&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;&amp;lt;BLOCK_EXPLORER_URL&amp;gt;&#x2F;tx&#x2F;&amp;lt;TX_HASH&amp;gt;&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;accounts&quot;&gt;Accounts&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;&amp;lt;BLOCK_EXPLORER_URL&amp;gt;&#x2F;address&#x2F;&amp;lt;ACCOUNT_ADDRESS&amp;gt;&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;tokens&quot;&gt;Tokens&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;&amp;lt;BLOCK_EXPLORER_URL&amp;gt;&#x2F;token&#x2F;&amp;lt;TOKEN_ADDRESS&amp;gt;&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The particular paths used in this proposal are chosen to be compatible with the majority of existing block explorers.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Incompatible block explorers can use redirects to their existing API routes in order to conform to this EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;None&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>wallet_addEthereumChain RPC Method</title>
        <published>2020-11-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Erik Marks</name><uri>https://github.com/rekmarks</uri>
	</author>
	
	<author>
		<name>Pedro Gomes</name><uri>https://github.com/pedrouid</uri>
	</author>
	
	<author>
		<name>Pandapip1</name><uri>https://github.com/Pandapip1</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3085/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3085-wallet-addethereumchain/5469" />
        

        <id>https://wg-eips.ritovision.com/3085/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="interface"
                label="Interface" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:3085"
            label="EIP-3085" />
        

        
        

        
        <summary type="html">Adds an RPC method to add EVM-compatible chains</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3085/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP adds a wallet-namespaced RPC method: &lt;code&gt;wallet_addEtherereumChain&lt;&#x2F;code&gt;, providing a standard interface for adding chains to Ethereum wallets.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal defines a new RPC method, &lt;code&gt;wallet_addEthereumChain&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;wallet-addethereumchain&quot;&gt;&lt;code&gt;wallet_addEthereumChain&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;wallet_addEthereumChain&lt;&#x2F;code&gt; method is used to suggest to the wallet that a new chain be added to the wallet&#x27;s list of chains. It takes a single parameter and returns &lt;code&gt;null&lt;&#x2F;code&gt; if the chain was added successfully, or an error if the chain was not added.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;wallet-addethereumchain-parameters&quot;&gt;&lt;code&gt;wallet_addEthereumChain&lt;&#x2F;code&gt; Parameters&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;wallet_addEthereumChain&lt;&#x2F;code&gt; method takes a single parameter, an &lt;code&gt;EthereumChainAddRequest&lt;&#x2F;code&gt; object, which is defined as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AddEthereumChainParameter&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  blockExplorerUrls&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  chainName&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  iconUrls&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  nativeCurrency&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    name&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    symbol&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    decimals&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; number&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  rpcUrls&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Only the &lt;code&gt;chainId&lt;&#x2F;code&gt; is required per this specification, but a wallet MAY require any other fields listed, impose additional requirements on them, or ignore them outright.&lt;&#x2F;p&gt;
&lt;p&gt;If a field does not meet the requirements of this specification and the wallet does not ignore the field, the wallet MUST reject the request.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;chainId&lt;&#x2F;code&gt; is the integer ID of the chain as a hexadecimal string, as per &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt;. The &lt;code&gt;blockExplorerUrls&lt;&#x2F;code&gt;, &lt;code&gt;iconUrls&lt;&#x2F;code&gt;, and &lt;code&gt;rpcUrls&lt;&#x2F;code&gt; fields are arrays of strings, each of which MUST be a valid URL. The &lt;code&gt;nativeCurrency&lt;&#x2F;code&gt; field is an object with &lt;code&gt;name&lt;&#x2F;code&gt;, &lt;code&gt;symbol&lt;&#x2F;code&gt;, and &lt;code&gt;decimals&lt;&#x2F;code&gt; fields, where &lt;code&gt;decimals&lt;&#x2F;code&gt; is a non-negative integer, and is to be interpreted like in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;EIP-20&lt;&#x2F;a&gt;. The &lt;code&gt;chainName&lt;&#x2F;code&gt; field is a string that is the human-readable name of the chain.&lt;&#x2F;p&gt;
&lt;p&gt;The wallet MUST reject the request if the &lt;code&gt;chainId&lt;&#x2F;code&gt; is not a valid hexadecimal string, or if the &lt;code&gt;chainId&lt;&#x2F;code&gt; is not a valid chain ID.&lt;&#x2F;p&gt;
&lt;p&gt;The wallet MUST reject the request if the &lt;code&gt;rpcUrls&lt;&#x2F;code&gt; field is not provided, or if the &lt;code&gt;rpcUrls&lt;&#x2F;code&gt; field is an empty array. The wallet MUST reject the request if the &lt;code&gt;rpcUrls&lt;&#x2F;code&gt; contains any strings that are not valid URLs. The wallet must reject the request if the &lt;code&gt;chainId&lt;&#x2F;code&gt; does not match the value of the &lt;code&gt;eth_chainId&lt;&#x2F;code&gt; method for any of the RPC urls.&lt;&#x2F;p&gt;
&lt;p&gt;The wallet MUST reject the request if the &lt;code&gt;nativeCurrency&lt;&#x2F;code&gt; field is provided, and any of the &lt;code&gt;name&lt;&#x2F;code&gt;, &lt;code&gt;symbol&lt;&#x2F;code&gt;, or &lt;code&gt;decimals&lt;&#x2F;code&gt; fields are missing. The wallet MUST reject the request if the &lt;code&gt;decimals&lt;&#x2F;code&gt; field is a negative integer.&lt;&#x2F;p&gt;
&lt;p&gt;The wallet MUST reject the request if the &lt;code&gt;blockExplorerUrls&lt;&#x2F;code&gt; field is provided, and any of the URLs are not valid URLs.&lt;&#x2F;p&gt;
&lt;p&gt;The wallet MUST reject the request if the &lt;code&gt;iconUrls&lt;&#x2F;code&gt; field is provided, and any of the URLs are not valid URLs or do not point to a valid image.&lt;&#x2F;p&gt;
&lt;p&gt;The wallet MUST reject any URLs that use the &lt;code&gt;file:&lt;&#x2F;code&gt; or &lt;code&gt;http:&lt;&#x2F;code&gt; schemes.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;wallet-addethereumchain-returns&quot;&gt;&lt;code&gt;wallet_addEthereumChain&lt;&#x2F;code&gt; Returns&lt;&#x2F;h4&gt;
&lt;p&gt;The method MUST return &lt;code&gt;null&lt;&#x2F;code&gt; if the request was successful, and an error otherwise. The wallet MAY reject the request for any reason.&lt;&#x2F;p&gt;
&lt;p&gt;The chain MUST NOT be assumed to be automatically selected by the wallet, even if the wallet does not reject the request.&lt;&#x2F;p&gt;
&lt;p&gt;A request to add a chain that was already added SHOULD be successful, unless the user declines the request or the validation fails.&lt;&#x2F;p&gt;
&lt;p&gt;The wallet MUST NOT allow the same &lt;code&gt;chainId&lt;&#x2F;code&gt; to be added multiple times. See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3085&#x2F;#security-considerations&quot;&gt;Security Considerations&lt;&#x2F;a&gt; for more information.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The design of &lt;code&gt;wallet_addEthereumChain&lt;&#x2F;code&gt; is deliberately ignorant of what it means to &quot;add&quot; a chain to a wallet.
The meaning of &quot;adding&quot; a chain to a wallet depends on the wallet implementation.&lt;&#x2F;p&gt;
&lt;p&gt;When calling the method, specifying the &lt;code&gt;chainId&lt;&#x2F;code&gt; will always be necessary, since in the universe of Ethereum chains, the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt; chain ID is effectively the chain GUID.
The remaining parameters amount to what, in the estimation of the authors, a wallet will minimally require in order to effectively support a chain and represent it to the user.
The network ID (per the &lt;code&gt;net_version&lt;&#x2F;code&gt; RPC method) is omitted since it is effectively superseded by the chain ID.&lt;&#x2F;p&gt;
&lt;p&gt;For &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3085&#x2F;#security-considerations&quot;&gt;security reasons&lt;&#x2F;a&gt;, a wallet should always attempt to validate the chain metadata provided by the requester, and may choose to fetch the metadata elsewhere entirely.
Either way, only the wallet can know which chain metadata it needs from the requester in order to &quot;add&quot; the chain.
Therefore, all parameters except &lt;code&gt;chainId&lt;&#x2F;code&gt; are specified as optional, even though a wallet may require them in practice.&lt;&#x2F;p&gt;
&lt;p&gt;This specification does not mandate that the wallet &quot;switches&quot; its &quot;active&quot; or &quot;currently selected&quot; chain after a successful request, if the wallet has a concept thereof.
Just like the meaning of &quot;adding&quot; a chain, &quot;switching&quot; between chains is a wallet implementation detail, and therefore out of scope.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;wallet_addEthereumChain&lt;&#x2F;code&gt; is a powerful method that exposes the end user to serious risks if implemented incorrectly.
Many of these risks can be avoided by validating the request data in the wallet, and clearly disambiguating different chains in the wallet UI.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;chain-ids&quot;&gt;Chain IDs&lt;&#x2F;h3&gt;
&lt;p&gt;Since the chain ID used for transaction signing determines which chain the transaction is valid for, handling the chain ID correctly is of utmost importance.
The wallet should:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Ensure that a submitted chain ID is valid.
&lt;ul&gt;
&lt;li&gt;It should be a &lt;code&gt;0x&lt;&#x2F;code&gt;-prefixed hexadecimal string per &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;695&#x2F;&quot;&gt;EIP-695&lt;&#x2F;a&gt;, and parse to an integer number.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Prevent the same chain ID from being added multiple times.
&lt;ul&gt;
&lt;li&gt;See the next section for how to handle multiple RPC endpoints.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Only use the submitted chain ID to sign transactions, &lt;strong&gt;never&lt;&#x2F;strong&gt; a chain ID received from an RPC endpoint.
&lt;ul&gt;
&lt;li&gt;A malicious or faulty endpoint could return arbitrary chain IDs, and potentially cause the user to sign transactions for unintended chains.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Verify that the specified chain ID matches the return value of &lt;code&gt;eth_chainId&lt;&#x2F;code&gt; from the endpoint, as described above.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;rpc-endpoints-and-rpc-urls&quot;&gt;RPC Endpoints and RPC URLs&lt;&#x2F;h3&gt;
&lt;p&gt;Wallets generally interact with chains via an RPC endpoint, identified by some URL.
Most wallets ship with a set of chains and corresponding trusted RPC endpoints.
The endpoints identified by the &lt;code&gt;rpcUrls&lt;&#x2F;code&gt; parameter cannot be assumed to be honest, correct, or even pointing to the same chain.
Moreover, even trusted endpoints can expose users to privacy risks depending on their data collection practices.&lt;&#x2F;p&gt;
&lt;p&gt;Therefore, the wallet should:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Inform users that their on-chain activity and IP address will be exposed to RPC endpoints.&lt;&#x2F;li&gt;
&lt;li&gt;If an endpoint is unknown to the wallet, inform users that the endpoint may behave in unexpected ways.&lt;&#x2F;li&gt;
&lt;li&gt;Observe good web security practices when interacting with the endpoint, such as require HTTPS.&lt;&#x2F;li&gt;
&lt;li&gt;Clearly inform the user which RPC URL is being used to communicate with a chain at any given moment, and inform the user of the risks of using multiple RPC endpoints to interact with the same chain.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;validating-chain-data&quot;&gt;Validating Chain Data&lt;&#x2F;h3&gt;
&lt;p&gt;A wallet that implements &lt;code&gt;wallet_addEthereumChain&lt;&#x2F;code&gt; should expect to encounter requests for chains completely unknown to the wallet maintainers.
That said, community resources exist that can be leveraged to verify requests for many Ethereum chains.
The wallet should maintain a list of known chains, and verify requests to add chains against that list.
Indeed, a wallet may even prefer its own chain metadata over anything submitted with a &lt;code&gt;wallet_addEthereumChain&lt;&#x2F;code&gt; request.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;ux&quot;&gt;UX&lt;&#x2F;h3&gt;
&lt;p&gt;Adding a new chain to the wallet can have significant implications for the wallet&#x27;s functionality and the experience of the user.
A chain should never be added without the explicit consent of the user, and different chains should be clearly differentiated in the wallet UI.
In service of these goals, the wallet should:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;When receiving a &lt;code&gt;wallet_addEthereumChain&lt;&#x2F;code&gt; request, display a confirmation informing the user that a specific requester has requested that the chain be added.&lt;&#x2F;li&gt;
&lt;li&gt;Ensure that any chain metadata, such as &lt;code&gt;nativeCurrency&lt;&#x2F;code&gt; and &lt;code&gt;blockExplorerUrls&lt;&#x2F;code&gt;, are validated and used to maximum effect in the UI.&lt;&#x2F;li&gt;
&lt;li&gt;If any images are provided via &lt;code&gt;iconUrls&lt;&#x2F;code&gt;, ensure that the user understands that the icons could misrepresent the actual chain added.&lt;&#x2F;li&gt;
&lt;li&gt;If the wallet UI has a concept of a &quot;currently selected&quot; or &quot;currently active&quot; chain, ensure that the user understands when a chain added using &lt;code&gt;wallet_addEthereumChain&lt;&#x2F;code&gt; becomes selected.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;preserving-user-privacy&quot;&gt;Preserving User Privacy&lt;&#x2F;h3&gt;
&lt;p&gt;Although a request to add a chain that was already added should generally be considered a success, treating such requests as &lt;em&gt;automatic&lt;&#x2F;em&gt; successes leaks information to requesters about the chains a user has added to their wallet.
In the interest of preserving user privacy, implementers of &lt;code&gt;wallet_addEthereumChain&lt;&#x2F;code&gt; should consider displaying user confirmations even in these cases.
If the user denies the request, the wallet should return the same user rejection error as normal so that requesters cannot learn which chains are supported by the wallet without explicit permission to do so.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Slashing Protection Interchange Format</title>
        <published>2020-10-27T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Michael Sproul</name><uri>https://github.com/michaelsproul</uri>
	</author>
	
	<author>
		<name>Sacha Saint-Leger</name><uri>https://github.com/sachayves</uri>
	</author>
	
	<author>
		<name>Danny Ryan</name><uri>https://github.com/djrtwo</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3076/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3076-validator-client-interchange-format-slashing-protection/4883" />
        

        <id>https://wg-eips.ritovision.com/3076/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="interface"
                label="Interface" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="last-call"
                label="Last Call" />
            
        

        
        <category
            term="tag:eip:3076"
            label="EIP-3076" />
        

        
        

        
        <summary type="html">A JSON interchange format for proof of stake validators to migrate slashing protection data between clients.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3076/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;A standard format for transferring a key&#x27;s signing history allows validators to easily switch between clients without the risk of signing conflicting messages. While a common keystore format provides part of the solution, it does not contain any information about a key&#x27;s signing history. For a validator moving their keys from client A to client B, this could lead to scenarios in which client B inadvertently signs a message that conflicts with an earlier message signed with client A. The interchange format described here provides a solution to this problem.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The proof of stake (PoS) protocol penalises validators for voting in ways that could result in two different versions of the chain being finalised. These types of penalties are called slashings.&lt;&#x2F;p&gt;
&lt;p&gt;For a validator following the protocol correctly, there is, in principle, no risk of being slashed. However, changing clients (from client A to client B, say) can result in a slashing risk if client B is unaware of the blocks and attestations that were signed with client A.&lt;&#x2F;p&gt;
&lt;p&gt;This can occur if client A and client B do not agree on what the present time is. For example, say client A&#x27;s time is accidentally set to a day in the future (225 epochs), and a validator switches from client A to client B without giving B a record of the blocks and attestations signed with A. The validator in question now runs the risk of attesting to two different blocks in the same epoch (a slashable offence) for the next 225 epochs (since they&#x27;ve already voted on these epochs with client A, and now stand to vote on them again with client B). Such time-skew bugs have been observed in the wild.&lt;&#x2F;p&gt;
&lt;p&gt;Another situation in which slashing protection is critical is in the case of re-orgs. During a re-org it is possible for a validator to be assigned new attestation duties for an epoch in which it has already signed an attestation. In this case it is essential that the record of the previous attestation is available, even if the validator just moved from one client to another in the space of a single epoch.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;json-schema&quot;&gt;JSON Schema&lt;&#x2F;h3&gt;
&lt;p&gt;A valid interchange file is one that adheres to the following JSON schema, and is interpreted according to the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3076&#x2F;#conditions&quot;&gt;Conditions&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Signing history&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;This schema provides a record of the blocks and attestations signed by a set of validators&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;interchange_format_version&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The version of the interchange format that this document adheres to&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;genesis_validators_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Calculated at Genesis time; serves to uniquely identify the chain&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;required&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;interchange_format_version&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;genesis_validators_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;array&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;items&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The BLS public key of the validator (encoded as a 0x-prefixed hex string)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;signed_blocks&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;array&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;items&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The slot number of the block that was signed&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;signing_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The output of compute_signing_root(block, domain)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;required&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;signed_attestations&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;array&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;items&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;source_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The attestation.data.source.epoch of the signed attestation&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;target_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The attestation.data.target.epoch of the signed attestation&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;signing_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The output of compute_signing_root(attestation, domain)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;required&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;source_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;target_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;required&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;signed_blocks&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;signed_attestations&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;required&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;example-json-instance&quot;&gt;Example JSON Instance&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;interchange_format_version&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;5&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;genesis_validators_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x04700007fabc8282644aed6d1c7c9e21d38a03a0c4ba193f3afe428824b3a673&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xb845089a1457f811bfc000588fbb4e713669be8ce060ea6be3c6ece09afc3794106c91ca73acda5e5457122d58723bed&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;signed_blocks&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;81952&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;signing_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x4ff6f743a43f3b4f95350831aeaf0a122a1a392922c45d804280284a69eb850b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;81951&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;signed_attestations&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;source_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2290&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;target_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;3007&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;signing_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x587d6a4f59a58fe24f406e0502413e77fe1babddee641fda30034ed37ecc884d&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;source_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2290&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;target_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;3008&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;conditions&quot;&gt;Conditions&lt;&#x2F;h3&gt;
&lt;p&gt;After importing an interchange file with data field &lt;code&gt;data&lt;&#x2F;code&gt;, a signer must respect the following conditions:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Refuse to sign any block that is slashable with respect to the blocks contained in &lt;code&gt;data.signed_blocks&lt;&#x2F;code&gt;. For details of what constitutes a slashable block, see &lt;code&gt;process_proposer_slashing&lt;&#x2F;code&gt; (from &lt;code&gt;consensus-specs&lt;&#x2F;code&gt;). If the &lt;code&gt;signing_root&lt;&#x2F;code&gt; is absent from a block, a signer must assume that any new block with the same &lt;code&gt;slot&lt;&#x2F;code&gt; is slashable with respect to the imported block.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Refuse to sign any block with &lt;code&gt;slot &amp;lt;= min(b.slot for b in data.signed_blocks if b.pubkey == proposer_pubkey)&lt;&#x2F;code&gt;, except if it is a repeat signing as determined by the &lt;code&gt;signing_root&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Refuse to sign any attestation that is slashable with respect to the attestations contained in &lt;code&gt;data.signed_attestations&lt;&#x2F;code&gt;. For details of what constitutes a slashable attestation, see &lt;code&gt;is_slashable_attestation_data&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Refuse to sign any attestation with source epoch less than the minimum source epoch present in that signer&#x27;s attestations (as seen in &lt;code&gt;data.signed_attestations&lt;&#x2F;code&gt;). In pseudocode:&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;source&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;att&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;source_epoch&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; att&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;signed_attestations&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; att&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; attester_pubkey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;{:start=&quot;5&quot;}
5. Refuse to sign any attestation with target epoch less than or equal to the minimum target epoch present in that signer&#x27;s attestations (as seen in &lt;code&gt;data.signed_attestations&lt;&#x2F;code&gt;), except if it is a repeat signing as determined by the &lt;code&gt;signing_root&lt;&#x2F;code&gt;. In pseudocode:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;target_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;att&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;target_epoch&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; att&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;signed_attestations&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; att&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; attester_pubkey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;additional-information&quot;&gt;Additional Information&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;interchange_format_version&lt;&#x2F;code&gt; version is set to 5.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;A signed block or attestation&#x27;s &lt;code&gt;signing_root&lt;&#x2F;code&gt; refers to the message data (hash tree root) that gets signed with a BLS signature. It allows validators to re-sign and re-broadcast blocks or attestations if asked.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;signed_blocks&lt;&#x2F;code&gt; &lt;code&gt;signing_root&lt;&#x2F;code&gt;s are calculated using &lt;code&gt;compute_signing_root(block, domain)&lt;&#x2F;code&gt;: where &lt;code&gt;block&lt;&#x2F;code&gt; is the block (of type &lt;code&gt;BeaconBlock&lt;&#x2F;code&gt; or &lt;code&gt;BeaconBlockHeader&lt;&#x2F;code&gt;) that was signed, and &lt;code&gt;domain&lt;&#x2F;code&gt; is equal to &lt;code&gt;compute_domain(DOMAIN_BEACON_PROPOSER, fork, metadata.genesis_validators_root)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;signed_attestations&lt;&#x2F;code&gt; &lt;code&gt;signing_root&lt;&#x2F;code&gt;s are calculated using &lt;code&gt;compute_signing_root(attestation, domain)&lt;&#x2F;code&gt;: where &lt;code&gt;attestation&lt;&#x2F;code&gt; is the attestation (of type &lt;code&gt;AttestationData&lt;&#x2F;code&gt;) that was signed, and &lt;code&gt;domain&lt;&#x2F;code&gt; is equal to &lt;code&gt;compute_domain(DOMAIN_BEACON_ATTESTER, fork, metadata.genesis_validators_root)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;supporting-different-strategies&quot;&gt;Supporting Different Strategies&lt;&#x2F;h3&gt;
&lt;p&gt;The interchange format is designed to be flexible enough to support the full variety of slashing protection strategies that clients may implement, which may be categorised into two main types:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Complete&lt;&#x2F;strong&gt;: a database containing every message signed by each validator.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Minimal&lt;&#x2F;strong&gt;: a database containing only the latest messages signed by each validator.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The advantage of the minimal strategy is its simplicity and succinctness. Using only the latest messages for each validator, safe slashing protection can be achieved by refusing to sign messages for slots or epochs prior.&lt;&#x2F;p&gt;
&lt;p&gt;On the other hand, the complete strategy can provide safe slashing protection while also avoiding false positives (meaning that it only prevents a validator from signing if doing so would guarantee a slashing).&lt;&#x2F;p&gt;
&lt;p&gt;The two strategies are unified in the interchange format through the inclusion of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3076&#x2F;#conditions&quot;&gt;conditions&lt;&#x2F;a&gt; (2), (4) and (5). This allows the interchange to transfer detailed or succinct information, as desired.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;integer-representation&quot;&gt;Integer Representation&lt;&#x2F;h3&gt;
&lt;p&gt;Most fields in the JSON schema are strings. For fields in which it is possible to encode the value as either a string or an integer, strings were chosen. This choice was made in order to avoid issues with different languages supporting different ranges of integers (specifically JavaScript, where the &lt;code&gt;number&lt;&#x2F;code&gt; type is a 64-bit float). If a validator is yet to sign a block or attestation, the relevant list is simply left empty.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;versioning&quot;&gt;Versioning&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;interchange_format_version&lt;&#x2F;code&gt; is set to 5 because the specification went through several breaking changes during its design, incorporating feedback from implementers.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This specification is not backwards-compatible with previous draft versions that used version numbers less than 5.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;In order to minimise risk and complexity, the format has been designed to map cleanly onto the internal database formats used by implementers. Nevertheless, there are a few pitfalls worth illuminating.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;advice-for-complete-databases&quot;&gt;Advice for Complete Databases&lt;&#x2F;h3&gt;
&lt;p&gt;For implementers who use a complete record of signed messages to implement their slashing protection database, we make the following recommendations:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;You MUST ensure that, in addition to importing all of the messages from an interchange, all the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3076&#x2F;#conditions&quot;&gt;conditions&lt;&#x2F;a&gt; are enforced. In particular, conditions (2), (4) and (5) may not have been enforced by your implementation before adopting the interchange format. Our recommendation is to enforce these rules at all times, to keep the implementation clean and minimise the attack surface. For example: your slashing protection mechanism should not sign a block with a slot number less than, or equal to, the minimum slot number of a previously signed block, &lt;em&gt;irrespective&lt;&#x2F;em&gt; of whether that minimum-slot block was imported from an interchange file, or inserted as part of your database&#x27;s regular operation.&lt;&#x2F;li&gt;
&lt;li&gt;If your database records the signing roots of messages in addition to their slot&#x2F;epochs, you should ensure that imported messages without signing roots are assigned a suitable dummy signing root internally. We suggest using a special &quot;null&quot; value which is distinct from all other signing roots, although a value like &lt;code&gt;0x0&lt;&#x2F;code&gt; may be used instead (as it is extremely unlikely to collide with any real signing root).&lt;&#x2F;li&gt;
&lt;li&gt;Care must be taken to avoid signing messages within a gap in the database (an area of unknown signing activity). This could occur if two interchanges were imported with a large gap between the last entry of the first and the first entry of the second. Signing in this gap is not safe, and would violate conditions (2), (4) and (5). It can be avoided by storing an explicit low watermark in addition to the actual messages of the slashing protection database, or by pruning on import so that the oldest messages from the interchange become the oldest messages in the database.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;advice-for-minimal-databases&quot;&gt;Advice for Minimal Databases&lt;&#x2F;h3&gt;
&lt;p&gt;For implementers who wish to implement their slashing protection database by storing only the latest block and attestation for each validator, we make the following recommendations:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;During import, make sure you take the &lt;em&gt;maximum&lt;&#x2F;em&gt; slot block and &lt;em&gt;maximum&lt;&#x2F;em&gt; source and target attestations for each validator. Although the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3076&#x2F;#conditions&quot;&gt;conditions&lt;&#x2F;a&gt; require the minimums to be enforced, taking the maximums from an interchange file and merging them with any existing values in the database is the recommended approach. For example, if the interchange file includes blocks for validator &lt;code&gt;V&lt;&#x2F;code&gt; at slots 4, 98 and 243, then the latest signed block for validator &lt;code&gt;V&lt;&#x2F;code&gt; should be updated to the one from slot 243.  However, if the database has already included a block for this validator at a slot greater than 243, for example, slot 351, then the database&#x27;s existing value should remain unchanged.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;general-recommendations&quot;&gt;General Recommendations&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;To avoid exporting an outdated interchange file -- an action which creates a slashing risk -- your implementation should only allow the slashing protection database to be exported when the validator client or signer is &lt;em&gt;stopped&lt;&#x2F;em&gt; -- in other words, when the client or signer is no longer adding new messages to the database.&lt;&#x2F;li&gt;
&lt;li&gt;Similarly, your implementation should only allow an interchange file to be imported when the validator client is stopped.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Precompile for BN256 HashToCurve Algorithms</title>
        <published>2020-10-23T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Dr. Christopher Gorman</name><uri>https://github.com/chgormanMH</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3068/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/pre-compile-for-bls/3973" />
        

        <id>https://wg-eips.ritovision.com/3068/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:3068"
            label="EIP-3068" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3068/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP defines a hash-to-curve precompile for use in BN256
and would allow for cheaper BLS signature verification.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;There is currently no inexpensive way to perform BLS signature
verification for arbitrary messages.
This stems from the fact that there is no precompiled contract
in the EVM for a hash-to-curve algorithm for the BN256 elliptic curve.
The gas cost of calling a deterministic hash-to-curve algorithm
written in Solidity is approximately that of one pairing check,
although the latter requires an order of magnitude
more computation.
This EIP remedies this by implementing a hash-to-curve algorithm
for the BN256 G1 curve, which would reduce the cost of
signature verification to essentially that of the pairing check
precompiled contract.
We also include a hash-to-curve algorithm for the BN256 G2 group.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The precompiled contracts in
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;198&#x2F;&quot;&gt;EIP-198&lt;&#x2F;a&gt; and
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1108&#x2F;&quot;&gt;EIP-1108&lt;&#x2F;a&gt;
increased usage of cryptographic operations in the EVM
by reducing the gas costs.
In particular, the cost reduction from
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1108&#x2F;&quot;&gt;EIP-1108&lt;&#x2F;a&gt;
helps increase the use of SNARKs in Ethereum
via an elliptic curve pairing check;
however, a hash-to-curve algorithm enabling arbitrary
BLS signature verification on BN256 in the EVM was noticeably missing.
There is interest in having a precompiled contract which would allow
for signature verification, as noted
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum-magicians.org&#x2F;t&#x2F;pre-compile-for-bls&#x2F;3973&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;At this time, we are able to perform addition, scalar multiplication,
and pairing checks in BN256.
Reducing these costs in
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1108&#x2F;&quot;&gt;EIP-1108&lt;&#x2F;a&gt;
made &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;PhilippSchindler&#x2F;ethdkg&quot;&gt;ETHDKG&lt;&#x2F;a&gt;,
a distributed key generation protocol in Ethereum,
less expensive.
ETHDKG by itself is useful; however, what it is lacking is
the ability to verify arbitrary BLS signatures.
Creating group signatures by aggregating partial signatures
is one goal of a DKG protocol.
The DKG enables the computation of partial signatures to be
combined into a group signature offline, but there is no
easy way to verify partial signatures or group signatures
in the EVM.&lt;&#x2F;p&gt;
&lt;p&gt;In order to perform BLS signature validation, a hash-to-curve
algorithm is required.
While the MapToGroup method initially discussed in the original BLS
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3068&#x2F;.&#x2F;assets&#x2F;weilsigs.pdf&quot;&gt;paper&lt;&#x2F;a&gt;
works in practice, the nondeterministic nature of the algorithm
leaves something to be desired as we would like to bound
the overall computational cost in the EVM.
A deterministic method for mapping to BN curves is given
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3068&#x2F;.&#x2F;assets&#x2F;latincrypt12.pdf&quot;&gt;here&lt;&#x2F;a&gt;;
in the paper, Fouque and Tibouchi proved their mapping
was indifferentiable from a random oracle.
This gives us the desired algorithm.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Here is the pseudocode for the &lt;code&gt;HashToG1&lt;&#x2F;code&gt; function:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function HashToG1(msg)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    fieldElement0 = HashToBase(msg, 0x00, 0x01)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    fieldElement1 = HashToBase(msg, 0x02, 0x03)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    curveElement0 = BaseToG1(fieldElement0)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    curveElement1 = BaseToG1(fieldElement1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    g1Element = ECAdd(curveElement0, curveElement1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return g1Element&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;end function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Here is the pseudocode for &lt;code&gt;HashToBase&lt;&#x2F;code&gt;;
&lt;code&gt;msg&lt;&#x2F;code&gt; is the byte slice to be hashed while &lt;code&gt;dsp1&lt;&#x2F;code&gt; and &lt;code&gt;dsp2&lt;&#x2F;code&gt;
are domain separation parameters.
&lt;code&gt;fieldPrime&lt;&#x2F;code&gt; is the prime of the underlying field.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function HashToBase(msg, dsp1, dsp2)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    hashResult0 = uint256(Keccak256(dsp1||msg))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    hashResult1 = uint256(Keccak256(dsp2||msg))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    constant = 2^256 mod fieldPrime&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    fieldElement0 = hashResult0*constant          mod fieldPrime&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    fieldElement1 = hashResult1                   mod fieldPrime&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    fieldElement  = fieldElement0 + fieldElement1 mod fieldPrime&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return fieldElement&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;end function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Here is the pseudocode for &lt;code&gt;BaseToG1&lt;&#x2F;code&gt;.
All of these operations are performed in the finite field.
&lt;code&gt;inverse&lt;&#x2F;code&gt; computes the multiplicative inverse in the underlying
finite field; we have the convention &lt;code&gt;inverse(0) == 0&lt;&#x2F;code&gt;.
&lt;code&gt;is_square(a)&lt;&#x2F;code&gt; computes the Legendre symbol of the element,
returning 1 if &lt;code&gt;a&lt;&#x2F;code&gt; is a square, -1 if &lt;code&gt;a&lt;&#x2F;code&gt; is not a square,
and 0 if &lt;code&gt;a&lt;&#x2F;code&gt; is 0.
&lt;code&gt;sqrt&lt;&#x2F;code&gt; computes the square root of the element in the finite
field; a square root is assumed to exist.
&lt;code&gt;sign0&lt;&#x2F;code&gt; returns the sign of the finite field element.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function BaseToG1(t)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # All operations are done in the finite field GF(fieldPrime)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Here, the elliptic curve satisfies the equation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    #       y^2 == g(x) == x^3 + curveB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    constant1 = (-1 + sqrt(-3))&#x2F;2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    constant2 = -3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    constant3 = 1&#x2F;3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    constant4 = g(1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    s = (constant4 + t^2)^3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    alpha = inverse(t^2*(constant4 + t^2))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    x1 = constant1 - constant2*t^4*alpha&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    x2 = -1 - x1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    x3 = 1 - constant3*s*alpha&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    a1 = x1^3 + curveB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    a2 = x2^3 + curveB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    residue1 = is_square(a1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    residue2 = is_square(a2)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    index = (residue1 - 1)*(residue2 - 3)&#x2F;4 + 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    coef1 = ConstantTimeEquality(1, index)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    coef2 = ConstantTimeEquality(2, index)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    coef3 = ConstantTimeEquality(3, index)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    x = coef1*x1 + coef2*x2 + coef3*x3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    y = sign0(t)*sqrt(x^3 + curveB)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return (x, y)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;end function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function sign0(t)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if t &amp;lt;= (fieldPrime-1)&#x2F;2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    else&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return fieldPrime-1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    end if&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;end function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function ConstantTimeEquality(a, b)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # This function operates in constant time&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if a == b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    else&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    end if&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;end function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In &lt;code&gt;HashToG2&lt;&#x2F;code&gt;, we first map to the underlying twist curve
and then clear the cofactor to map to G2.
Here is the pseudocode for &lt;code&gt;HashToG2&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function HashToG2(msg)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    fieldElement00 = HashToBase(msg, 0x04, 0x05)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    fieldElement01 = HashToBase(msg, 0x06, 0x07)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    fieldElement10 = HashToBase(msg, 0x08, 0x09)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    fieldElement11 = HashToBase(msg, 0x0a, 0x0b)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    fieldElement0 = (fieldElement00, fieldElement01)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    fieldElement1 = (fieldElement10, fieldElement11)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    twistElement0 = BaseToTwist(fieldElement0)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    twistElement1 = BaseToTwist(fieldElement1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    twistElement = ECAdd(twistElement0, twistElement1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    g2Element = ClearCofactor(twistElement)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return g2Element&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;end function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function ClearCofactor(twistElement)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return ECMul(twistElement, cofactor)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;end function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Here is the pseudocode for &lt;code&gt;BaseToTwist&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function BaseToTwist(t)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # All operations are done in the finite field GF(fieldPrime^2)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Here, the twist curve satisfies the equation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    #       y^2 == g&amp;#39;(x) == x^3 + curveBPrime&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    constant1 = (-1 + sqrt(-3))&#x2F;2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    constant2 = -3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    constant3 = 1&#x2F;3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    constant4 = g&amp;#39;(1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    s = (constant4 + t^2)^3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    alpha = inverse(t^2*(constant4 + t^2))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    x1 = constant1 - constant2*t^4*alpha&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    x2 = -1 - x1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    x3 = 1 - constant3*s*alpha&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    a1 = x1^3 + curveBPrime&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    a2 = x2^3 + curveBPrime&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    residue1 = is_square(a1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    residue2 = is_square(a2)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    index = (residue1 - 1)*(residue2 - 3)&#x2F;4 + 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    coef1 = ConstantTimeEquality(1, index)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    coef2 = ConstantTimeEquality(2, index)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    coef3 = ConstantTimeEquality(3, index)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    x = coef1*x1 + coef2*x2 + coef3*x3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    y = sign0(t)*sqrt(x^3 + curveBPrime)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return (x, y)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;end function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The BaseToG1 algorithm is based on the original Fouque and Tibouchi
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3068&#x2F;.&#x2F;assets&#x2F;latincrypt12.pdf&quot;&gt;paper&lt;&#x2F;a&gt;
with modifications based on Wahby and Boneh&#x27;s
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3068&#x2F;.&#x2F;assets&#x2F;2019-403_BLS12_H2C.pdf&quot;&gt;paper&lt;&#x2F;a&gt;.
There is freedom in choosing the HashToBase function
and this could easily be changed.
Within HashToBase, the particular hashing algorithm
(Keccak256 in our case) could also be modified.
It may be desired to change the call to &lt;code&gt;sign0&lt;&#x2F;code&gt;
at the end of BaseToG1 and BaseToTwist with &lt;code&gt;is_square&lt;&#x2F;code&gt;,
as this would result in the same deterministic map to curve from the
Fouque and Tibouchi
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3068&#x2F;.&#x2F;assets&#x2F;latincrypt12.pdf&quot;&gt;paper&lt;&#x2F;a&gt;
and ensure HashToG1 is indifferentiable from a random oracle;
they proved this result in their paper.
It may be possible to show that switching the &lt;code&gt;is_square&lt;&#x2F;code&gt;
call with &lt;code&gt;sign0&lt;&#x2F;code&gt; does not affect indifferentiability,
although this has not been proven.&lt;&#x2F;p&gt;
&lt;p&gt;The HashToG2 algorithm follows from the Wahby and Boneh
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3068&#x2F;.&#x2F;assets&#x2F;2019-403_BLS12_H2C.pdf&quot;&gt;paper&lt;&#x2F;a&gt;.
Algorithms for computing &lt;code&gt;inverse&lt;&#x2F;code&gt;, &lt;code&gt;is_square&lt;&#x2F;code&gt;, and &lt;code&gt;sqrt&lt;&#x2F;code&gt;
in finite field GF(fieldPrime^2) can be found
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3068&#x2F;.&#x2F;assets&#x2F;2012-685_Square_Root_Even_Ext.pdf&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;We now discuss the potential gas cost for the HashToG1
and HashToG2 operations.
On a local machine, ECMul was clocked at 68 microseconds
per operation.
The same machine clocked HashToG1 at 94 microseconds per operation
when hashing 32 bytes into G1 and 105 microseconds per operation
when hashing 1024 bytes into G1.
Given that it currently costs 6000 gas for ECMul, this gives us
an estimated gas cost for HashToG1 at &lt;code&gt;8500 + len(bytes)&lt;&#x2F;code&gt;.
Similarly, HashToG2 was clocked at 886 microseconds per operation
when hashing 32 bytes into G2 and 912 microseconds per operation when
hashing 1024 bytes into G2.
This allows us to estimate the gas cost at &lt;code&gt;80000 + 3*len(bytes)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;There are no backward compatibility concerns.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Due to recent &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3068&#x2F;.&#x2F;assets&#x2F;2015-1027_exTNFS.pdf&quot;&gt;work&lt;&#x2F;a&gt;, the
128-bit security promised by the BN256 elliptic curve no longer applies;
this was mentioned in the Cloudflare BN256
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;cloudflare&#x2F;bn256&quot;&gt;library&lt;&#x2F;a&gt;.
There has been some discussion on the exact security decrease
from this advancement; see these
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3068&#x2F;.&#x2F;assets&#x2F;2016-1102_Assessing_NFS_Advances.pdf&quot;&gt;two&lt;&#x2F;a&gt;
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3068&#x2F;.&#x2F;assets&#x2F;2017-334.pdf&quot;&gt;papers&lt;&#x2F;a&gt;
for different estimates.
The more conservative estimate puts the security of BN256 at
100-bits.
While this is likely still out of reach for many adversaries,
it should give us pause.
This reduced security was noted in the recent MadNet
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3068&#x2F;.&#x2F;assets&#x2F;madnet.pdf&quot;&gt;whitepaper&lt;&#x2F;a&gt;,
and this security concern was partially mitigated by
requiring Secp256k1 signatures of the partial group signatures
in order for those partial signatures to be valid.
Full disclosure: the author of this EIP works for MadHive,
assisted in the development of MadNet, and
helped write the MadNet whitepaper.&lt;&#x2F;p&gt;
&lt;p&gt;The security concerns of the BN256 elliptic curve
affect any operation using pairing check because it is
related to the elliptic curve pairing;
they are independent of this EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Crosschain Identifier Specification</title>
        <published>2020-10-21T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Weijia Zhang</name><uri>https://github.com/weijia31415</uri>
	</author>
	
	<author>
		<name>Peter Robinson</name><uri>https://github.com/drinkcoffee</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3220/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3220-crosschain-id-specification/5446" />
        

        <id>https://wg-eips.ritovision.com/3220/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:3220"
            label="EIP-3220" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3220/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;A self-verifying unique blockchain identifier that deals with forks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The crosschain-id is a 32 byte hex string and with some bytes extracted from blockchain hash and some manually defined to characterize a blockchain.
We also propose a registration and lookup service to retrieve blockchain metadata from the crosschain-id.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;With the success of Bitcoin and Ethereum, various blockchains such as EOS, Ripple, Litecoin, Besu, Wanchain and the like have been developed and are growing at a fast pace.  There are also other private and consortium blockchains such as Hyperledger Fabric, Hyperledger Besu, Stellar, Corda, Quorum that only allow nodes with permitted identities to join the blockchain network.  The growth of public and private blockchains imposes challenges for inter-chain interoperability, particularly when these chains are heterogeneous and incompatible. Enterprise Ethereum Alliance formed Crosschain Interoperability Task Force (CITF) to look into common crosschain problems and solutions. CITF team noticed that there is a lack of unique identifier to charaterise and describe a blockchain. Several proprosals were discussed in EEA Crosschain Interoperability Task Force meetings and discussions.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt; provides a unique identifier to a blockchain to provide simple relay attack protection.  This specification defines an integer for Chainid for a blockchain and sign the chainid into a transaction data and hence present attackers to send same transaction to different blockchains. This specification will require blockchains to define a chainid and register the chainid in a public repository.&lt;&#x2F;p&gt;
&lt;p&gt;The challenge of using an integer for chainid is that it is not broad enough to cover all blockchains and it does not prevent different blockchains using the same chainid.  Also, it does not address the issue for two forked blockchains having the same chainid.&lt;&#x2F;p&gt;
&lt;p&gt;Hence there is need for a more robust blockchain identifier that will overcome these drawbacks, especially for crosschain operations where multiple chains are involved. A blockchain identifier (crosschain id) should be unique and satisfy the following requirements:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;should provide identification, description, and discovery of blockchains.&lt;&#x2F;li&gt;
&lt;li&gt;should provide unique identification of each blockchain in the crosschain service ecosystem.&lt;&#x2F;li&gt;
&lt;li&gt;should provide descriptions for a blockchain identities such as chainId, name, type, consensus scheme etc.&lt;&#x2F;li&gt;
&lt;li&gt;should provide discovery mechanism for supported blockchains and also for new blockchains in the ecosystem.&lt;&#x2F;li&gt;
&lt;li&gt;should provide a mechanism for a joining blockchain to register to the ecosystem.&lt;&#x2F;li&gt;
&lt;li&gt;should provide a mechanism for a blockchain to edit properties or unregister from the crosschain ecosystem.&lt;&#x2F;li&gt;
&lt;li&gt;should provide a mechanism to get some critical information of the blockchain&lt;&#x2F;li&gt;
&lt;li&gt;should provide a mechanism to differentiate an original blockchain and a forked blockchain&lt;&#x2F;li&gt;
&lt;li&gt;should provide a mechanism to verify a chainid without external registration service&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;definition-of-a-32-byte-crosschain-id&quot;&gt;Definition of a 32 byte crosschain id&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Size(bytes)&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Truncated Block Hash&lt;&#x2F;td&gt;&lt;td&gt;16&lt;&#x2F;td&gt;&lt;td&gt;This is the block hash of the genesis block or the block hash of the block immediate prior to the fork for a fork of a blockchain. The 16 bytes is the 16 least significant bytes, assuming network byte order.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Native Chain ID&lt;&#x2F;td&gt;&lt;td&gt;8&lt;&#x2F;td&gt;&lt;td&gt;This is the &lt;strong&gt;Chain Id&lt;&#x2F;strong&gt; value that should be used with the blockchain when signing transactions. For blockchains that do not have a concept of &lt;strong&gt;Chain Id&lt;&#x2F;strong&gt;, this value is zero.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Chain Type&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;Reserve 0x00 as undefined chaintype. 0x01 as mainnet type. 0x1[0-A]: testnet, 0x2[0-A]: private development network&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Governance Identifier&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;For new blockchains, a governance_identifier can be specified to identify an original &lt;strong&gt;owner&lt;&#x2F;strong&gt; of a blockchain, to help settle forked &#x2F; main chain disputes. For all existing blockchains and for blockchains that do not have the concept of an &lt;strong&gt;owner&lt;&#x2F;strong&gt;, this field is zero.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Reserved&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;Reserved for future use. Use 000000 for now.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Checksum&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;Used to verify the integrity of the identifier. This integrity check is targeted at detecting Crosschain Identifiers mis-typed by human users. The value is calculated as the truncated SHA256 message digest of the rest of the identifier, using the least significant byte, assuming network byte order. Note that this checksum byte only detects integrity with a probability of one in 256. This probability is adequate for the intended usage of detecting typographical errors by people manually entering the Crosschain Identifier.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;We have considered various alternative specifications such as using a random unique hex string to represent a blockchain.  The drawback of this method is that the random id can not be used to verify a blockchain&#x27;s intrinsic identity such as the blockhash of the genesis block.  A second alternative is simply using a genesis blockhash to represent a blockchain id for crosschain operations.  The drawback of this is that this id does not have information about the property of the blockchain and it has problem when a blockchain is forked into two blockchain.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Crosschainid can be backward compatible with EIP-155.  The crosschain id contains an 8 byte segment to record the &lt;code&gt;Native Chain ID&lt;&#x2F;code&gt;.
For Ethereum chains, that can be used for a value intended to be used with EIP-155.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Collision of crosschain id:  Two blockchains can contain the same crosschain id and hence making the mistakenly transfer assets to a wrong blockchain.&lt;br &#x2F;&gt;
This security concern is addressed by comparing the hash of the crosschain id with the hash of the genesis block.  If it matches, then the crosschain id is verified.  If not, the crosschain id can be compared with the forked blockhash.  If none of the blockhash match the crosschain id hash, then the crosschain id cannot be verified.&lt;&#x2F;p&gt;
&lt;p&gt;Preventing relay attack: Although crosschain id by itself is different from chainid and it is not signed into blockchain transaction, the crosschain id can still be used for presenting relay attack. An application that handles crosschain transaction can verified the crosschain id with its blockhash and decide whether the transaction is valid or not. Any transaction with a non-verifiable crosschain id should be rejected.&lt;&#x2F;p&gt;
&lt;p&gt;The crosschain-id are not required to be signed into blockchaid tx.
For blockchains that do not cryptographically sign crosschain id into the blocks, the crosschain id cannot be verified with the blocks itself and have to be verified with external smart contract address and offchain utilities implemented based on the crosschain id specification.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>AUTH and AUTHCALL opcodes</title>
        <published>2020-10-15T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Sam Wilson</name><uri>https://github.com/SamWilsn</uri>
	</author>
	
	<author>
		<name>Ansgar Dietrichs</name><uri>https://github.com/adietrichs</uri>
	</author>
	
	<author>
		<name>Matt Garnett</name><uri>https://github.com/lightclient</uri>
	</author>
	
	<author>
		<name>Micah Zoltu</name><uri>https://github.com/micahzoltu</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3074/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3074-sponsored-transaction-precompile/4880" />
        

        <id>https://wg-eips.ritovision.com/3074/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        

        
        <category
            term="tag:eip:3074"
            label="EIP-3074" />
        

        
        

        
        <summary type="html">Allow externally owned accounts to delegate control to a contract.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3074/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces two EVM instructions &lt;code&gt;AUTH&lt;&#x2F;code&gt; and &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt;. The first sets a context variable &lt;code&gt;authorized&lt;&#x2F;code&gt; based on an ECDSA signature. The second sends a call as the &lt;code&gt;authorized&lt;&#x2F;code&gt; account. This essentially delegates control of the externally owned account (EOA) to a smart contract.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Adding more functionality to EOAs has been a long-standing feature request. The requests have spanned from implementing batching capabilities, allowing for gas sponsoring, expirations, scripting, and beyond. These changes often mean increased complexity and rigidity of the protocol. In some cases, it also means increased attack surfaces.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP takes a different approach. Instead of enshrining these capabilities in the protocol as transaction validity requirements, it allows users to &lt;em&gt;delegate&lt;&#x2F;em&gt; control of their EOA to a contract. This gives developers a flexible framework for developing novel transaction schemes for EOAs. A motivating use case of this EIP is that it allows any EOA to act like a smart contract wallet &lt;em&gt;without&lt;&#x2F;em&gt; deploying a contract.&lt;&#x2F;p&gt;
&lt;p&gt;Although this EIP provides great benefit to individual users, the leading motivation for this EIP is &quot;sponsored transactions&quot;. This is where the fee for a transaction is provided by a different account than the one that originates the call.&lt;&#x2F;p&gt;
&lt;p&gt;With the extraordinary growth of tokens on Ethereum, it has become common for EOAs to hold valuable assets without holding any ether at all. Today, these assets must be converted to ether before they can be used to pay gas fees. However, without ether to pay for the conversion, it&#x27;s impossible to convert them. Sponsored transactions break the circular dependency.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;conventions&quot;&gt;Conventions&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;top - N&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; - the &lt;code&gt;N&lt;&#x2F;code&gt;th most recently pushed value on the EVM stack, where &lt;code&gt;top - 0&lt;&#x2F;code&gt; is the most recent.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;||&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; - byte concatenation operator.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;invalid execution&lt;&#x2F;strong&gt; - execution that is invalid and must exit the current execution frame immediately, consuming all remaining gas (in the same way as a stack underflow or invalid jump).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAGIC&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x04&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;&lt;code&gt;MAGIC&lt;&#x2F;code&gt; is used for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3074&#x2F;&quot;&gt;EIP-3074&lt;&#x2F;a&gt; signatures to prevent signature collisions with other signing formats.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;context-variables&quot;&gt;Context Variables&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Variable&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: left&quot;&gt;Initial Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;authorized&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;address&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;unset&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The context variable &lt;code&gt;authorized&lt;&#x2F;code&gt; shall indicate the active account for &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt; instructions in the current frame of execution. If set, &lt;code&gt;authorized&lt;&#x2F;code&gt; shall only contain an account which has given the contract authorization to act on its behalf. An unset value shall indicate that no such account is set and that there is not yet an active account for &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt; instructions in the current frame of execution.&lt;&#x2F;p&gt;
&lt;p&gt;The variable has the same scope as the program counter -- &lt;code&gt;authorized&lt;&#x2F;code&gt; persists throughout a single frame of execution of the contract, but is not passed through any calls (including &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;). If the same contract is being executed in separate execution frames (ex. a &lt;code&gt;CALL&lt;&#x2F;code&gt; to self), both frames shall have independent values for &lt;code&gt;authorized&lt;&#x2F;code&gt;. Initially in each frame of execution, &lt;code&gt;authorized&lt;&#x2F;code&gt; is always unset, even if a previous execution frame for the same contract has a value.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;auth-0xf6&quot;&gt;&lt;code&gt;AUTH&lt;&#x2F;code&gt; (&lt;code&gt;0xf6&lt;&#x2F;code&gt;)&lt;&#x2F;h3&gt;
&lt;p&gt;A new opcode &lt;code&gt;AUTH&lt;&#x2F;code&gt; shall be created at &lt;code&gt;0xf6&lt;&#x2F;code&gt;. It shall take three stack element inputs (the last two describing a memory range), and it shall return one stack element.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;input&quot;&gt;Input&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;stack&quot;&gt;Stack&lt;&#x2F;h5&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Stack&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;top - 0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;authority&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;top - 1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;offset&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;top - 2&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;length&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h5 id=&quot;memory&quot;&gt;Memory&lt;&#x2F;h5&gt;
&lt;p&gt;The final two stack arguments (&lt;code&gt;offset&lt;&#x2F;code&gt; and &lt;code&gt;length&lt;&#x2F;code&gt;) describe a range of memory. The format of the contents of that range is:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;memory[offset    : offset+1 ]&lt;&#x2F;code&gt; - &lt;code&gt;yParity&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;memory[offset+1  : offset+33]&lt;&#x2F;code&gt; - &lt;code&gt;r&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;memory[offset+33 : offset+65]&lt;&#x2F;code&gt; - &lt;code&gt;s&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;memory[offset+65 : offset+97]&lt;&#x2F;code&gt; - &lt;code&gt;commit&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;output&quot;&gt;Output&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;stack-1&quot;&gt;Stack&lt;&#x2F;h5&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Stack&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;top - 0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;success&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h5 id=&quot;memory-1&quot;&gt;Memory&lt;&#x2F;h5&gt;
&lt;p&gt;Memory is not modified by this instruction.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;behavior&quot;&gt;Behavior&lt;&#x2F;h4&gt;
&lt;p&gt;If &lt;code&gt;length&lt;&#x2F;code&gt; is greater than 97, the extra bytes are ignored for signature verification (they still incur a gas cost as defined later). Bytes outside the range (in the event &lt;code&gt;length&lt;&#x2F;code&gt; is less than 97) are treated as if they had been zeroes.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;authority&lt;&#x2F;code&gt; is the address of the account which generated the signature. If &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; of &lt;code&gt;authority&lt;&#x2F;code&gt; is not zero, consider the operation unsuccessful and unset &lt;code&gt;authorized&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The arguments (&lt;code&gt;yParity&lt;&#x2F;code&gt;, &lt;code&gt;r&lt;&#x2F;code&gt;, &lt;code&gt;s&lt;&#x2F;code&gt;) are interpreted as an ECDSA signature on the secp256k1 curve over the message &lt;code&gt;keccak256(MAGIC || chainId || nonce || invokerAddress || commit)&lt;&#x2F;code&gt;, where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;chainId&lt;&#x2F;code&gt; is the current chain&#x27;s &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt; unique identifier padded to 32 bytes.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;nonce&lt;&#x2F;code&gt; is the signer&#x27;s current nonce, left-padded to 32 bytes.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;invokerAddress&lt;&#x2F;code&gt; is the address of the contract executing &lt;code&gt;AUTH&lt;&#x2F;code&gt; (or the active state address in the context of &lt;code&gt;CALLCODE&lt;&#x2F;code&gt; or &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;), left-padded with zeroes to a total of 32 bytes (ex. &lt;code&gt;0x000000000000000000000000AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;commit&lt;&#x2F;code&gt;, one of the arguments passed into &lt;code&gt;AUTH&lt;&#x2F;code&gt;, is a 32-byte value that can be used to commit to specific additional validity conditions in the invoker&#x27;s pre-processing logic.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Signature validity and signer recovery are handled analogously to transaction signatures, including the stricter &lt;code&gt;s&lt;&#x2F;code&gt; range for preventing ECDSA malleability. Note that &lt;code&gt;yParity&lt;&#x2F;code&gt; is expected to be &lt;code&gt;0&lt;&#x2F;code&gt; or &lt;code&gt;1&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;If the signature is valid and the signer address is equal to &lt;code&gt;authority&lt;&#x2F;code&gt;, the context variable &lt;code&gt;authorized&lt;&#x2F;code&gt; is set to the &lt;code&gt;authority&lt;&#x2F;code&gt;. In particular, this is also true if &lt;code&gt;authority == tx.origin&lt;&#x2F;code&gt;, which used to be handled separately in earlier versions of this EIP (see Security Considerations). If the signature is instead invalid or the signer address does not equal &lt;code&gt;authority&lt;&#x2F;code&gt;, &lt;code&gt;authorized&lt;&#x2F;code&gt; is reset to an unset value.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;AUTH&lt;&#x2F;code&gt; returns &lt;code&gt;1&lt;&#x2F;code&gt; if &lt;code&gt;authorized&lt;&#x2F;code&gt; is set, or &lt;code&gt;0&lt;&#x2F;code&gt; otherwise.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;gas-cost&quot;&gt;Gas Cost&lt;&#x2F;h4&gt;
&lt;p&gt;The gas cost for &lt;code&gt;AUTH&lt;&#x2F;code&gt; is equal to the sum of:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;fixed fee &lt;code&gt;3100&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;memory expansion gas cost (&lt;code&gt;auth_memory_expansion_fee&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;100&lt;&#x2F;code&gt; if &lt;code&gt;authority&lt;&#x2F;code&gt; is warm, &lt;code&gt;2600&lt;&#x2F;code&gt; if it is cold (per &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The fixed fee is equal to the cost for the &lt;code&gt;ecrecover&lt;&#x2F;code&gt; precompile, plus a bit extra to cover a keccak256 hash and some additional logic.&lt;&#x2F;p&gt;
&lt;p&gt;The memory expansion gas cost (&lt;code&gt;auth_memory_expansion_fee&lt;&#x2F;code&gt;) shall be calculated in the same way as &lt;code&gt;RETURN&lt;&#x2F;code&gt;, where memory is expanded if the specified range is outside the current allocation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;authcall-0xf7&quot;&gt;&lt;code&gt;AUTHCALL&lt;&#x2F;code&gt; (&lt;code&gt;0xf7&lt;&#x2F;code&gt;)&lt;&#x2F;h3&gt;
&lt;p&gt;A new opcode &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt; shall be created at &lt;code&gt;0xf7&lt;&#x2F;code&gt;. It shall take seven stack elements and return one stack element. It matches the behavior of the existing &lt;code&gt;CALL&lt;&#x2F;code&gt; (&lt;code&gt;0xF1&lt;&#x2F;code&gt;) instruction, except where noted below.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;input-1&quot;&gt;Input&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Stack&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;top - 0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;gas&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;top - 1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;addr&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;top - 2&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;value&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;top - 3&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;argsOffset&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;top - 4&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;argsLength&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;top - 5&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;retOffset&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;top - 6&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;retLength&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;output-1&quot;&gt;Output&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Stack&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;top - 0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;success&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;behavior-1&quot;&gt;Behavior&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;AUTHCALL&lt;&#x2F;code&gt; is interpreted the same as &lt;code&gt;CALL&lt;&#x2F;code&gt;, except for (note: this list is also the order of precedence for the logical checks):&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If &lt;code&gt;authorized&lt;&#x2F;code&gt; is unset, execution is invalid (as defined above). Otherwise, the caller address for the call is set to &lt;code&gt;authorized&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The gas cost, including how much gas is available for the subcall, is specified in the Gas Cost section.&lt;&#x2F;li&gt;
&lt;li&gt;If the &lt;code&gt;gas&lt;&#x2F;code&gt; operand is equal to &lt;code&gt;0&lt;&#x2F;code&gt;, the instruction will send all available gas as per &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;150&#x2F;&quot;&gt;EIP-150&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If the gas available for the subcall would be less than &lt;code&gt;gas&lt;&#x2F;code&gt;, execution is invalid.&lt;&#x2F;li&gt;
&lt;li&gt;There is no gas stipend, even for non-zero &lt;code&gt;value&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;value&lt;&#x2F;code&gt; is deducted from the balance of &lt;code&gt;authorized&lt;&#x2F;code&gt;. If &lt;code&gt;value&lt;&#x2F;code&gt; is higher than the balance of &lt;code&gt;authorized&lt;&#x2F;code&gt;, execution is invalid.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;code&gt;AUTHCALL&lt;&#x2F;code&gt; must increase the call depth by one. &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt; must not increase the call depth by two as it would if it first called into the authorized account and then into the target.&lt;&#x2F;p&gt;
&lt;p&gt;The return data area accessed with &lt;code&gt;RETURNDATASIZE&lt;&#x2F;code&gt; (&lt;code&gt;0x3d&lt;&#x2F;code&gt;) and &lt;code&gt;RETURNDATACOPY&lt;&#x2F;code&gt; (&lt;code&gt;0x3e&lt;&#x2F;code&gt;) must be set in the same way as the &lt;code&gt;CALL&lt;&#x2F;code&gt; instruction.&lt;&#x2F;p&gt;
&lt;p&gt;Importantly, &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt; does not reset &lt;code&gt;authorized&lt;&#x2F;code&gt;, but leaves it unchanged.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;gas-cost-1&quot;&gt;Gas Cost&lt;&#x2F;h4&gt;
&lt;p&gt;The gas cost for &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt; shall be the &lt;strong&gt;sum&lt;&#x2F;strong&gt; of:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;static gas cost (&lt;code&gt;warm_storage_read&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;memory expansion gas cost (&lt;code&gt;memory_expansion_fee&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;dynamic gas cost (&lt;code&gt;dynamic_gas&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;gas available for execution in the subcall (&lt;code&gt;subcall_gas&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The memory expansion gas cost (&lt;code&gt;memory_expansion_fee&lt;&#x2F;code&gt;) shall be calculated in the same way as &lt;code&gt;CALL&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The dynamic gas portion (&lt;code&gt;dynamic_gas&lt;&#x2F;code&gt;), and the gas available for execution in the subcall (&lt;code&gt;subcall_gas&lt;&#x2F;code&gt;) shall be calculated as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dynamic_gas = 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;if addr not in accessed_addresses:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    dynamic_gas += 2500         # cold_account_access - warm_storage_read&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;if value &amp;gt; 0:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    dynamic_gas += 6700         # NB: Not 9000, like in `CALL`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if is_empty(addr):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        dynamic_gas += 25000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;remaining_gas = available_gas - dynamic_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;all_but_one_64th = remaining_gas - (remaining_gas &#x2F;&#x2F; 64)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;if gas == 0:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    subcall_gas = all_but_one_64th&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;elif all_but_one_64th &amp;lt; gas:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    raise                       # Execution is invalid.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;else:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    subcall_gas = gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;As with &lt;code&gt;CALL&lt;&#x2F;code&gt;, the full gas cost is charged immediately, independently of actually executing the call.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;signature-in-memory&quot;&gt;Signature in Memory&lt;&#x2F;h3&gt;
&lt;p&gt;The signature format (&lt;code&gt;yParity&lt;&#x2F;code&gt;, &lt;code&gt;r&lt;&#x2F;code&gt;, and &lt;code&gt;s&lt;&#x2F;code&gt;) is fixed, so it might seem curious that &lt;code&gt;auth&lt;&#x2F;code&gt; accepts a dynamic memory range. The signature is placed in memory so that &lt;code&gt;auth&lt;&#x2F;code&gt; can be upgraded in the future to work with contract accounts (which might use non-ECDSA signatures) and not just EOAs.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;signing-address-auth-argument&quot;&gt;Signing Address &lt;code&gt;auth&lt;&#x2F;code&gt; Argument&lt;&#x2F;h3&gt;
&lt;p&gt;Including &lt;code&gt;authority&lt;&#x2F;code&gt; (the signing address) as an argument to &lt;code&gt;auth&lt;&#x2F;code&gt; allows future upgrades to the instruction to work with contract accounts, and not just EOAs.&lt;&#x2F;p&gt;
&lt;p&gt;If &lt;code&gt;authority&lt;&#x2F;code&gt; were not included and multiple signature schemes allowed, it would not be possible to compute the authorizing account&#x27;s address from just the signature alone.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;reserving-one-sixty-fourth-of-available-gas&quot;&gt;Reserving One Sixty-Fourth of Available Gas&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;AUTHCALL&lt;&#x2F;code&gt; will not pass more than 63&#x2F;64th of the available gas for the reasons enumerated in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;150&#x2F;&quot;&gt;EIP-150&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;throwing-for-unset-authorized-during-authcall&quot;&gt;Throwing for Unset &lt;code&gt;authorized&lt;&#x2F;code&gt; During &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;A well-behaved contract should never reach an &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt; without having successfully set &lt;code&gt;authorized&lt;&#x2F;code&gt; beforehand. The safest behavior, therefore, is to exit the current frame of execution immediately. This is especially important in the context of transaction sponsoring &#x2F; relaying, which is expected to be one of the main use cases for this EIP. In a sponsored transaction, the inability to distinguish between a sponsee-attributable fault (like a failing sub-call) and a sponsor-attributable fault (like a failing &lt;code&gt;AUTH&lt;&#x2F;code&gt;) is especially dangerous and should be prevented because it charges unfair fees to the sponsee.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;another-sponsored-transaction-eip&quot;&gt;Another Sponsored Transaction EIP&lt;&#x2F;h3&gt;
&lt;p&gt;There are two general approaches to separating the &quot;fee payer&quot; from the &quot;action originator&quot;.&lt;&#x2F;p&gt;
&lt;p&gt;The first is introducing a new transaction type. This requires significant changes to clients to support and is generally less upgradeable than other solutions (e.g. this EIP). This approach is also not immediately compatible with account abstraction (AA). These proposals require a &lt;em&gt;signed&lt;&#x2F;em&gt; transaction from the sponsor&#x27;s account, which is not possible from an AA contract, because it has no private key to sign with. The main advantage of new transaction types is that the validity requirements are enforced by the protocol, therefore invalid transactions do not pollute block space.&lt;&#x2F;p&gt;
&lt;p&gt;The other main approach is to introduce a new mechanism in the EVM to masquerade as other accounts. This EIP introduces &lt;code&gt;AUTH&lt;&#x2F;code&gt; and &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt; to make calls as EOAs. There are many different permutations of this mechanism. An alternative mechanism would be to add an opcode that can make arbitrary calls based on a similar address creation scheme as &lt;code&gt;CREATE2&lt;&#x2F;code&gt;. Although this mechanism would not benefit users today, it would immediately allow for those accounts to send and receive ether -- making it feel like a more first-class primitive.&lt;&#x2F;p&gt;
&lt;p&gt;Besides better compatibility with AA, introducing a new mechanism into the EVM is a much less intrusive change than a new transaction type. This approach requires no changes in existing wallets, and little change in other tooling.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;AUTHCALL&lt;&#x2F;code&gt;&#x27;s single deviation from &lt;code&gt;CALL&lt;&#x2F;code&gt; is to set &lt;code&gt;CALLER&lt;&#x2F;code&gt;. It implements the minimal functionality to enable sender abstraction for sponsored transactions. This single mindedness makes &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt; significantly more composable with existing Ethereum features.&lt;&#x2F;p&gt;
&lt;p&gt;More logic can be implemented around the &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt; instruction, giving more control to invokers and sponsors without sacrificing security or user experience for sponsees.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;what-to-sign&quot;&gt;What to Sign?&lt;&#x2F;h3&gt;
&lt;p&gt;As originally written, this proposal specified a precompile with storage to track nonces. Since a precompile with storage is unprecedented, a revision moved replay protection into the invoker contract, necessitating a certain level of user trust in the invoker. Expanding on this idea of trusted invokers, the other signed fields were eventually eliminated, one by one, until only &lt;code&gt;invoker&lt;&#x2F;code&gt; and &lt;code&gt;commit&lt;&#x2F;code&gt; remained. To appease concerns about cross-chain replay attacks and irrevocable signatures, the &lt;code&gt;chainId&lt;&#x2F;code&gt; and &lt;code&gt;nonce&lt;&#x2F;code&gt; fields returned to the signed message.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;invoker&lt;&#x2F;code&gt; binds a particular signed message to a single invoker. If invoker was not part of the message, any invoker could reuse the signature to completely compromise the EOA. This allows users to trust that their message will be validated as they expect, particularly the values committed to in &lt;code&gt;commit&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;understanding-commit&quot;&gt;Understanding &lt;code&gt;commit&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Earlier iterations of this EIP included mechanisms for replay protection, and also signed over value, gas, and other arguments to &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt;. After further investigation, we revised this EIP to its current state: explicitly delegate these responsibilities to the invoker contract.&lt;&#x2F;p&gt;
&lt;p&gt;A user will specifically interact with an invoker they trust. Because they trust this contract to execute faithfully, they will &quot;commit&quot; to certain properties of a call they would like to make by computing a hash of the call values. They can be certain that the invoker will only allow the call to proceed if it is able to verify the values committed to (e.g. a nonce to protect against replay attacks). This certainty arises from the &lt;code&gt;commit&lt;&#x2F;code&gt; value that is signed over by the user. This is the hash of values which the invoker will validate. A safe invoker should accept the values from the user and compute the commit hash itself. This ensures that invoker operated on the same input that user authorized.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3074&#x2F;.&#x2F;assets&#x2F;auth-msg.png&quot; alt=&quot;auth message format&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Using &lt;code&gt;commit&lt;&#x2F;code&gt; as a hash of values allows for invokers to implement arbitrary constraints. For example, they could allow accounts to have &lt;code&gt;N&lt;&#x2F;code&gt; parallel nonces. Or, they could allow a user to commit to multiple calls with a single signature. This would allow multi-tx flows, such as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; &lt;code&gt;approve&lt;&#x2F;code&gt;-&lt;code&gt;transfer&lt;&#x2F;code&gt; actions, to be condensed into a single transaction with a single signature verification. A commitment to multiple calls would look something like the diagram below.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3074&#x2F;.&#x2F;assets&#x2F;auth-msg-multi-call.png&quot; alt=&quot;multi-call auth message&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Another interesting use is to delegate control of the EOA to other key(s). This would mean the EOA signs a &lt;code&gt;commit&lt;&#x2F;code&gt; message with the address of the key(s) and an access policy, if applicable. When the delegate wants to make a call as the EOA it will construct a signature over the invoker-specified call format and relay it (with the actual call data) onto chain with the signature and commit that granted it access to the account. The invoker will then be able to determine that the EOA has allowed this alternative key to make calls on its behalf.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3074&#x2F;.&#x2F;assets&#x2F;auth-msg-delegate.png&quot; alt=&quot;delegate auth message&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;invoker-contracts&quot;&gt;Invoker Contracts&lt;&#x2F;h3&gt;
&lt;p&gt;The invoker contract is a trustless intermediary between the sponsor and sponsee. A sponsee signs over &lt;code&gt;invoker&lt;&#x2F;code&gt; to require the transaction to be processed only by a contract they trust. This allows them to interact with sponsors without needing to trust them.&lt;&#x2F;p&gt;
&lt;p&gt;Choosing an invoker is similar to choosing a smart contract wallet implementation. It&#x27;s important to choose one that has been thoroughly reviewed, tested, and accepted by the community as secure. We expect a few invoker designs to be utilized by most major transaction relay providers, with a few outliers that offer more novel mechanisms.&lt;&#x2F;p&gt;
&lt;p&gt;An important note is that invoker contracts &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; be upgradeable. If an invoker can be redeployed to the same address with different code, it would be possible to redeploy the invoker with code that does not properly verify &lt;code&gt;commit&lt;&#x2F;code&gt; and any account that signed a message over that invoker would be compromised. Although this sounds scary, it is no different than using a smart contract wallet via &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;. If the wallet is redeployed with different logic, all wallets using its code could be compromised.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;on-call-depth&quot;&gt;On Call Depth&lt;&#x2F;h3&gt;
&lt;p&gt;The EVM limits the maximum number of nested calls, and naively allowing a sponsor to manipulate the call depth before reaching the invoker would introduce a griefing attack against the sponsee. That said, with the 63&#x2F;64th gas rule, and the cost of &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt;, the stack is effectively limited to a much smaller depth than the hard maximum by the &lt;code&gt;gas&lt;&#x2F;code&gt; parameter.&lt;&#x2F;p&gt;
&lt;p&gt;It is, therefore, sufficient for the invoker to guarantee a minimum amount of gas, because there is no way to reach the hard maximum call depth with any reasonable (i.e. less than billions) amount of gas.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;source-of-value&quot;&gt;Source of &lt;code&gt;value&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;In previous iterations of this EIP, it was thought that deducting value from an EOA mid-execution was problematic. This was due to an invariant of pending transactions which allows tx pools to statically determine the validity of a given transaction.&lt;&#x2F;p&gt;
&lt;p&gt;However, after further investigation we found that breaking the invariant is safe. This is mostly due to the fact that the worst case is similar in both instances.&lt;&#x2F;p&gt;
&lt;p&gt;Currently an attacker can queue many transactions in the tx pool, across many accounts, and invalidate them all at once with a block where each of the queued accounts send a tx moving their entire balance. This attack will become easier and cheaper after this EIP, because it will no longer require direct access to the block builder and will not cost a full 21000 gas to originate each tx. However, the attack does not have a substantial impact on the network, so reducing the difficulty and cost is not of concern.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;allowing-tx-origin-as-signer&quot;&gt;Allowing &lt;code&gt;tx.origin&lt;&#x2F;code&gt; as Signer&lt;&#x2F;h3&gt;
&lt;p&gt;Allowing &lt;code&gt;authorized&lt;&#x2F;code&gt; to equal &lt;code&gt;tx.origin&lt;&#x2F;code&gt; enables simple transaction batching, where the sender of the outer transaction would be the signing account. The ERC-20 approve-then-transfer pattern, which currently requires two separate transactions, could be completed in a single transaction with this proposal.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;AUTH&lt;&#x2F;code&gt; allows for signatures to be signed by &lt;code&gt;tx.origin&lt;&#x2F;code&gt;. For any such signatures, subsequent &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt;s have &lt;code&gt;msg.sender == tx.origin&lt;&#x2F;code&gt; in their first layer of execution. Without EIP-3074, this situation can only ever arise in the topmost execution layer of a transaction. This EIP breaks that invariant and so affects smart contracts containing &lt;code&gt;require(msg.sender == tx.origin)&lt;&#x2F;code&gt; checks. This check can be used for at least three purposes:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Ensuring that &lt;code&gt;msg.sender&lt;&#x2F;code&gt; is an EOA (given that &lt;code&gt;tx.origin&lt;&#x2F;code&gt; always has to be an EOA). This invariant does not depend on the execution layer depth and, therefore, is not affected.&lt;&#x2F;li&gt;
&lt;li&gt;Protecting against atomic sandwich attacks like flash loans, that rely on the ability to modify state before and after the execution of the target contract as part of the same atomic transaction. This protection would be broken by this EIP. However, relying on &lt;code&gt;tx.origin&lt;&#x2F;code&gt; in this way is considered bad practice, and can already be circumvented by miners conditionally including transactions in a block.&lt;&#x2F;li&gt;
&lt;li&gt;Preventing reentrancy.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Examples of (1) and (2) can be found in contracts deployed on Ethereum mainnet, with (1) being more common (and unaffected by this proposal.) On the other hand, use case (3) is more severely affected by this proposal, but the authors of this EIP did not find any examples of this form of reentrancy protection, though the search was non-exhaustive.&lt;&#x2F;p&gt;
&lt;p&gt;This distribution of occurrences—many (1), some (2), and no (3)—is exactly what the authors of this EIP expect, because:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Determining if &lt;code&gt;msg.sender&lt;&#x2F;code&gt; is an EOA without &lt;code&gt;tx.origin&lt;&#x2F;code&gt; is difficult (if not impossible.)&lt;&#x2F;li&gt;
&lt;li&gt;The only execution context which is safe from atomic sandwich attacks is the topmost context, and &lt;code&gt;tx.origin == msg.sender&lt;&#x2F;code&gt; is the only way to detect that context.&lt;&#x2F;li&gt;
&lt;li&gt;In contrast, there are many direct and flexible ways of preventing reentrancy (ex. using a storage variable.) Since &lt;code&gt;msg.sender == tx.origin&lt;&#x2F;code&gt; is only true in the topmost context, it would make an obscure tool for preventing reentrancy, rather than other more common approaches.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;There are other approaches to mitigate this restriction which do not break the invariant:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Set &lt;code&gt;tx.origin&lt;&#x2F;code&gt; to a constant &lt;code&gt;ENTRY_POINT&lt;&#x2F;code&gt; address for &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt;s.&lt;&#x2F;li&gt;
&lt;li&gt;Set &lt;code&gt;tx.origin&lt;&#x2F;code&gt; to the invoker address for &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt;s.&lt;&#x2F;li&gt;
&lt;li&gt;Set &lt;code&gt;tx.origin&lt;&#x2F;code&gt; to a special address derived from any of the sender, invoker, and&#x2F;or signer addresses.&lt;&#x2F;li&gt;
&lt;li&gt;Disallow &lt;code&gt;authorized == tx.origin&lt;&#x2F;code&gt;. This would make the simple batching use cases impossible, but could be relaxed in the future.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;authcall-cheaper-than-call-when-sending-value&quot;&gt;&lt;code&gt;AUTHCALL&lt;&#x2F;code&gt; cheaper than &lt;code&gt;CALL&lt;&#x2F;code&gt; when sending value&lt;&#x2F;h3&gt;
&lt;p&gt;Sending non-zero value with &lt;code&gt;CALL&lt;&#x2F;code&gt; increases its cost by 9,000. Of that, 6,700 covers the increased overhead of the balance transfer and 2,300 is used as a stipend into the subcall to seed its gas counter. &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt; does not provide a stipend and thus only charges the base 6,700.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;in-protocol-revocation&quot;&gt;In-Protocol Revocation&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP has gone &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3074&#x2F;#what-to-sign&quot;&gt;back and forth&lt;&#x2F;a&gt; on how to deal with &lt;code&gt;AUTH&lt;&#x2F;code&gt; message revocation. Without revocation, this EIP is a supremely powerful and flexible primitive for developers. However, it does have risk for users who use insecure and&#x2F;or actively malicious invokers.&lt;&#x2F;p&gt;
&lt;p&gt;Much of the risk is due to the new ability for users to batch many operations in a single transaction. It becomes easier for an account to be drained. This is a risk that will continue to grow, regardless of the adoption of this EIP, due to overwhelming desire for the feature and attempts to support it at the protocol level and at the app level.&lt;&#x2F;p&gt;
&lt;p&gt;A new class of risk is introduced for insecure and buggy invokers. If an invoker has implemented replay protection, as per the authors&#x27; recommendation, this should substantially contain the blast radius. However, if the bug allows an adversary to circumvent the replay protection mechanism, it may give them full access to any EOA which has interacted with the vulnerable invoker.&lt;&#x2F;p&gt;
&lt;p&gt;Although this is a truly catastrophic event which is not expected to be possible via reputable wallets, it is a serious consideration. Without in-protocol revocation, users have no way to remove their account from the vulnerable invoker.&lt;&#x2F;p&gt;
&lt;p&gt;For this reason, &lt;code&gt;AUTH&lt;&#x2F;code&gt; requires the &lt;code&gt;nonce&lt;&#x2F;code&gt; in the message to be equal to the signer&#x27;s current nonce. This way, a single tx from the EOA will cause the nonce to increase, invalidating all outstanding authorizations.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;failing-on-extcodesize-check&quot;&gt;Failing on &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; check&lt;&#x2F;h3&gt;
&lt;p&gt;In &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3607&#x2F;&quot;&gt;EIP-3607&lt;&#x2F;a&gt;, it was determined that the protocol should reject any transaction which originates from an account with code. Although this EIP focused on transaction origination, the authors of EIP-3074 feel the intention is clear: an account that has both code and a known private key should not be allowed to make arbitrary calls on behalf of said account. Therefore, the property is upheld in this EIP. For full rationale, please refer to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3607&#x2F;&quot;&gt;EIP-3607&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Although this EIP poses no issues for backwards compatibility, there are concerns that it limits future changes to accounts by further enshrining ECDSA signatures. For example, it might be desirable to eradicate the concept of EOAs altogether, and replace them with smart contract wallets that emulate the same behavior. This is fully compatible with the EIP as written, however, it gets tricky if users can then elect to &quot;upgrade&quot; their smart contract wallets to use other methods of authentication -- e.g. convert into a multi-sig. Without any changes, &lt;code&gt;AUTH&lt;&#x2F;code&gt; would not respect this new logic and continue allowing the old private key to perform actions on behalf of the account.&lt;&#x2F;p&gt;
&lt;p&gt;A solution to this would be at the same time that EOAs are removed, to modify the logic of &lt;code&gt;AUTH&lt;&#x2F;code&gt; to actually call into the account with some standard message and allow the account to determine if the signature &#x2F; witness is valid. Further research should be done to understand how invokers would need to change in this situation and how best to write them in a future-compatible manner.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;secure-invokers&quot;&gt;Secure Invokers&lt;&#x2F;h3&gt;
&lt;p&gt;The following is a non-exhaustive list of checks&#x2F;pitfalls&#x2F;conditions that invokers &lt;em&gt;should&lt;&#x2F;em&gt; be wary of:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Replay protection (ex. a nonce) should be implemented by the invoker, and included in &lt;code&gt;commit&lt;&#x2F;code&gt;. Without it, a malicious actor can reuse a signature, repeating its effects.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;value&lt;&#x2F;code&gt; should be included in &lt;code&gt;commit&lt;&#x2F;code&gt;. Without it, a malicious sponsor could cause unexpected effects in the callee.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;gas&lt;&#x2F;code&gt; should be included in &lt;code&gt;commit&lt;&#x2F;code&gt;. Without it, a malicious sponsor could cause the callee to run out of gas and fail, griefing the sponsee.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;addr&lt;&#x2F;code&gt; and &lt;code&gt;calldata&lt;&#x2F;code&gt; should be included in &lt;code&gt;commit&lt;&#x2F;code&gt;. Without them, a malicious actor may call arbitrary functions in arbitrary contracts.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;A poorly implemented invoker can &lt;em&gt;allow a malicious actor to take near complete control over a signer&#x27;s EOA&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;allowing-tx-origin-as-signer-1&quot;&gt;Allowing &lt;code&gt;tx.origin&lt;&#x2F;code&gt; as Signer&lt;&#x2F;h3&gt;
&lt;p&gt;Allowing &lt;code&gt;authorized&lt;&#x2F;code&gt; to equal &lt;code&gt;tx.origin&lt;&#x2F;code&gt; has the possibility to:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Break atomic sandwich protections which rely on &lt;code&gt;tx.origin&lt;&#x2F;code&gt;;&lt;&#x2F;li&gt;
&lt;li&gt;Break reentrancy guards of the style &lt;code&gt;require(tx.origin == msg.sender)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The authors of this EIP believe the risks of allowing &lt;code&gt;authorized&lt;&#x2F;code&gt; to equal &lt;code&gt;tx.origin&lt;&#x2F;code&gt; are acceptable for the reasons outlined in the Rationale section.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;sponsored-transaction-relayers&quot;&gt;Sponsored Transaction Relayers&lt;&#x2F;h3&gt;
&lt;p&gt;It is possible for the &lt;code&gt;authorized&lt;&#x2F;code&gt; account to cause sponsored transaction relayers to spend gas without being reimbursed by either invalidating the authorization (i.e. increasing the account&#x27;s nonce) or by sweeping the relevant assets out of the account. Relayers should be designed with these cases in mind, possibly by requiring a bond to be deposited or by implementing a reputation system.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Adds `baseFee` to `eth_getBlockByNumber`</title>
        <published>2020-10-14T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Abdelhamid Bakhta</name><uri>https://github.com/abdelhamidbakhta</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3044/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3044-add-basefee-to-eth-getblockbynumber/4828" />
        

        <id>https://wg-eips.ritovision.com/3044/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="interface"
                label="Interface" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:3044"
            label="EIP-3044" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3044/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Add basefee field to &lt;code&gt;eth_getBlockByNumber&lt;&#x2F;code&gt; RPC endpoint response.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Adds &lt;code&gt;baseFee&lt;&#x2F;code&gt; property to the &lt;code&gt;eth_getBlockByNumber&lt;&#x2F;code&gt; JSON-RPC request &lt;code&gt;result&lt;&#x2F;code&gt; object.  This property will contain the value of the base fee for any block after the EIP-1559 fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; introduces a base fee per gas in protocol.
This value is maintained under consensus as a new field in the block header structure.
Users may need value of the base fee at a given block. Base fee value is important to make gas price predictions more accurate.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;eth-getblockbynumber&quot;&gt;&lt;code&gt;eth_getBlockByNumber&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;description&quot;&gt;Description&lt;&#x2F;h4&gt;
&lt;p&gt;Returns information about a block specified by number.
Every block returned by this endpoint whose block number is before the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; fork block &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; include a &lt;code&gt;baseFee&lt;&#x2F;code&gt; field.
Every block returned by this endpoint whose block number is on or after the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; fork block &lt;strong&gt;MUST&lt;&#x2F;strong&gt; include a &lt;code&gt;baseFee&lt;&#x2F;code&gt; field.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h4&gt;
&lt;p&gt;Parameters remain unchanged.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;returns&quot;&gt;Returns&lt;&#x2F;h4&gt;
&lt;p&gt;For the full specification of &lt;code&gt;eth_getBlockByNumber&lt;&#x2F;code&gt; see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;&quot;&gt;EIP-1474&lt;&#x2F;a&gt;.
Add a new JSON field to the &lt;code&gt;result&lt;&#x2F;code&gt; object for block headers containing a base fee (post &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; fork block).&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;baseFee&lt;&#x2F;code&gt; - base fee for this block&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;example&quot;&gt;Example&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;-data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;id&amp;quot;: 1559,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;jsonrpc&amp;quot;: &amp;quot;2.0&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;method&amp;quot;: &amp;quot;eth_getBlockByNumber&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;params&amp;quot;:[&amp;quot;latest&amp;quot;, true]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ur&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; 1559,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;difficulty&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x027f07&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;extraData&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;baseFee&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x7&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gasLimit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x9f759&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gasUsed&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x9f759&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;logsBloom&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;miner&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x4e65fda2159562a496f9f3522f89122a3088497a&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xe04d296d2460cfb8472af2c5fd05b5a214109c25688d3704aed5484f9a7792f2&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1b4&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;parentHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x9646252be9520f6e71339a8df9c55e4d7619deeb018d2a3f2d21fc165dde5eb5&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;sha3Uncles&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;size&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x027f07&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;stateRoot&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xd5855eb08b3387c0af375e9cdb6acfc05eb8f519e419b874b6ff2ffda7ed1dff&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;timestamp&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x54e34e8e&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;totalDifficulty&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x027f07&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transactions&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transactionsRoot&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;uncles&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The addition of a single parameter instead of introducing a whole new endpoint was the simplest change that would be easiest to get integrated.
For backward compatibility we decided to not include the base fee in the response for pre-1559 blocks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Backwards compatible. Calls related to block prior to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; fork block will omit the base fee field in the response.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The added field (&lt;code&gt;baseFee&lt;&#x2F;code&gt;) is informational and does not introduce technical security issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Adds `baseFee` to `eth_getUncleByBlockHashAndIndex`</title>
        <published>2020-10-14T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Abdelhamid Bakhta</name><uri>https://github.com/abdelhamidbakhta</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3045/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/add-basefee-to-eth-getunclebyblockhashandindex/4829" />
        

        <id>https://wg-eips.ritovision.com/3045/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="interface"
                label="Interface" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:3045"
            label="EIP-3045" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3045/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Add basefee field to &lt;code&gt;eth_getUncleByBlockHashAndIndex&lt;&#x2F;code&gt; RPC endpoint response.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Adds &lt;code&gt;baseFee&lt;&#x2F;code&gt; property to the &lt;code&gt;eth_getUncleByBlockHashAndIndex&lt;&#x2F;code&gt; JSON-RPC request &lt;code&gt;result&lt;&#x2F;code&gt; object.  This property will contain the value of the base fee for any block after the EIP-1559 fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; introduces a base fee per gas in protocol.
This value is maintained under consensus as a new field in the block header structure.
Users may need value of the base fee at a given block. Base fee value is important to make gas price predictions more accurate.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;eth-getunclebyblockhashandindex&quot;&gt;&lt;code&gt;eth_getUncleByBlockHashAndIndex&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;description&quot;&gt;Description&lt;&#x2F;h4&gt;
&lt;p&gt;Returns information about an uncle specified by block hash and uncle index position
Every block returned by this endpoint whose block number is before the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; fork block &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; include a &lt;code&gt;baseFee&lt;&#x2F;code&gt; field.
Every block returned by this endpoint whose block number is on or after the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; fork block &lt;strong&gt;MUST&lt;&#x2F;strong&gt; include a &lt;code&gt;baseFee&lt;&#x2F;code&gt; field.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h4&gt;
&lt;p&gt;Parameters remain unchanged.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;returns&quot;&gt;Returns&lt;&#x2F;h4&gt;
&lt;p&gt;For the full specification of &lt;code&gt;eth_getUncleByBlockHashAndIndex&lt;&#x2F;code&gt; see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;&quot;&gt;EIP-1474&lt;&#x2F;a&gt;.
Add a new JSON field to the &lt;code&gt;result&lt;&#x2F;code&gt; object for block headers containing a base fee (post &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; fork block).&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;baseFee&lt;&#x2F;code&gt; - base fee for this block&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;example&quot;&gt;Example&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;-data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;id&amp;quot;: 1559,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;jsonrpc&amp;quot;: &amp;quot;2.0&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;method&amp;quot;: &amp;quot;eth_getUncleByBlockHashAndIndex&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;params&amp;quot;:[&amp;quot;0xc6ef2fc5426d6ad6fd9e2a26abeab0aa2411b7ab17f30a99d3cb96aed1d1055b&amp;quot;, &amp;quot;0x0&amp;quot;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ur&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; 1559,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;difficulty&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x027f07&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;extraData&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;baseFee&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x7&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gasLimit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x9f759&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gasUsed&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x9f759&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;logsBloom&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;miner&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x4e65fda2159562a496f9f3522f89122a3088497a&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xe04d296d2460cfb8472af2c5fd05b5a214109c25688d3704aed5484f9a7792f2&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1b4&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;parentHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x9646252be9520f6e71339a8df9c55e4d7619deeb018d2a3f2d21fc165dde5eb5&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;sha3Uncles&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;size&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x027f07&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;stateRoot&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xd5855eb08b3387c0af375e9cdb6acfc05eb8f519e419b874b6ff2ffda7ed1dff&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;timestamp&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x54e34e8e&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;totalDifficulty&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x027f07&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transactions&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transactionsRoot&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;uncles&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The addition of a single parameter instead of introducing a whole new endpoint was the simplest change that would be easiest to get integrated.
For backward compatibility we decided to not include the base fee in the response for pre-1559 blocks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Backwards compatible. Calls related to block prior to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; fork block will omit the base fee field in the response.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The added field (&lt;code&gt;baseFee&lt;&#x2F;code&gt;) is informational and does not introduce technical security issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Adds `baseFee` to `eth_getUncleByBlockNumberAndIndex`</title>
        <published>2020-10-14T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Abdelhamid Bakhta</name><uri>https://github.com/abdelhamidbakhta</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3046/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/add-basefee-to-eth-getunclebyblocknumberandindex/4830" />
        

        <id>https://wg-eips.ritovision.com/3046/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="interface"
                label="Interface" />
            
        

        
        <category
            term="tag:eip:3046"
            label="EIP-3046" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3046/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Add basefee field to &lt;code&gt;eth_getUncleByBlockNumberAndIndex&lt;&#x2F;code&gt; RPC endpoint response.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Adds &lt;code&gt;baseFee&lt;&#x2F;code&gt; property to the &lt;code&gt;eth_getUncleByBlockNumberAndIndex&lt;&#x2F;code&gt; JSON-RPC request &lt;code&gt;result&lt;&#x2F;code&gt; object.  This property will contain the value of the base fee for any block after the EIP-1559 fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; introduces a base fee per gas in protocol.
This value is maintained under consensus as a new field in the block header structure.
Users may need value of the base fee at a given block. Base fee value is important to make gas price predictions more accurate.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;eth-getunclebyblocknumberandindex&quot;&gt;&lt;code&gt;eth_getUncleByBlockNumberAndIndex&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;description&quot;&gt;Description&lt;&#x2F;h4&gt;
&lt;p&gt;Returns information about an uncle specified by block number and uncle index position
Every block returned by this endpoint whose block number is before the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; fork block &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; include a &lt;code&gt;baseFee&lt;&#x2F;code&gt; field.
Every block returned by this endpoint whose block number is on or after the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; fork block &lt;strong&gt;MUST&lt;&#x2F;strong&gt; include a &lt;code&gt;baseFee&lt;&#x2F;code&gt; field.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h4&gt;
&lt;p&gt;Parameters remain unchanged.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;returns&quot;&gt;Returns&lt;&#x2F;h4&gt;
&lt;p&gt;For the full specification of &lt;code&gt;eth_getUncleByBlockNumberAndIndex&lt;&#x2F;code&gt; see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;&quot;&gt;EIP-1474&lt;&#x2F;a&gt;.
Add a new JSON field to the &lt;code&gt;result&lt;&#x2F;code&gt; object for block headers containing a base fee (post &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; fork block).&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;baseFee&lt;&#x2F;code&gt; - base fee for this block&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;example&quot;&gt;Example&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;-data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;id&amp;quot;: 1559,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;jsonrpc&amp;quot;: &amp;quot;2.0&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;method&amp;quot;: &amp;quot;eth_getUncleByBlockNumberAndIndex&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;params&amp;quot;:[&amp;quot;latest&amp;quot;, &amp;quot;0x0&amp;quot;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ur&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; 1559,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;difficulty&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x027f07&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;extraData&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;baseFee&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x7&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gasLimit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x9f759&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gasUsed&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x9f759&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;logsBloom&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;miner&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x4e65fda2159562a496f9f3522f89122a3088497a&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xe04d296d2460cfb8472af2c5fd05b5a214109c25688d3704aed5484f9a7792f2&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1b4&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;parentHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x9646252be9520f6e71339a8df9c55e4d7619deeb018d2a3f2d21fc165dde5eb5&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;sha3Uncles&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;size&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x027f07&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;stateRoot&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xd5855eb08b3387c0af375e9cdb6acfc05eb8f519e419b874b6ff2ffda7ed1dff&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;timestamp&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x54e34e8e&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;totalDifficulty&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x027f07&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transactions&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transactionsRoot&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;uncles&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The addition of a single parameter instead of introducing a whole new endpoint was the simplest change that would be easiest to get integrated.
For backward compatibility we decided to not include the base fee in the response for pre-1559 blocks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Backwards compatible. Calls related to block prior to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; fork block will omit the base fee field in the response.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The added field (&lt;code&gt;baseFee&lt;&#x2F;code&gt;) is informational and does not introduce technical security issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Adds `baseFee` to `eth_getBlockByHash`</title>
        <published>2020-10-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Abdelhamid Bakhta</name><uri>https://github.com/abdelhamidbakhta</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3041/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3041-add-basefee-in-eth-getblockbyhash-response/4825" />
        

        <id>https://wg-eips.ritovision.com/3041/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="interface"
                label="Interface" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:3041"
            label="EIP-3041" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3041/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Add basefee field to &lt;code&gt;eth_getBlockByHash&lt;&#x2F;code&gt; RPC endpoint response.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Adds &lt;code&gt;baseFee&lt;&#x2F;code&gt; property to the &lt;code&gt;eth_getBlockByHash&lt;&#x2F;code&gt; JSON-RPC request &lt;code&gt;result&lt;&#x2F;code&gt; object.  This property will contain the value of the base fee for any block after the EIP-1559 fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; introduces a base fee per gas in protocol.
This value is maintained under consensus as a new field in the block header structure.
Users may need value of the base fee at a given block. Base fee value is important to make gas price predictions more accurate.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;eth-getblockbyhash&quot;&gt;&lt;code&gt;eth_getBlockByHash&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;description&quot;&gt;Description&lt;&#x2F;h4&gt;
&lt;p&gt;Returns information about a block specified by hash.
Every block returned by this endpoint whose block number is before the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; fork block &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; include a &lt;code&gt;baseFee&lt;&#x2F;code&gt; field.
Every block returned by this endpoint whose block number is on or after the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; fork block &lt;strong&gt;MUST&lt;&#x2F;strong&gt; include a &lt;code&gt;baseFee&lt;&#x2F;code&gt; field.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h4&gt;
&lt;p&gt;Parameters remain unchanged.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;returns&quot;&gt;Returns&lt;&#x2F;h4&gt;
&lt;p&gt;For the full specification of &lt;code&gt;eth_getBlockByHash&lt;&#x2F;code&gt; see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;&quot;&gt;EIP-1474&lt;&#x2F;a&gt;.
Add a new JSON field to the &lt;code&gt;result&lt;&#x2F;code&gt; object for block headers containing a base fee (post &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; fork block).&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;baseFee&lt;&#x2F;code&gt; - base fee for this block&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;example&quot;&gt;Example&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;-data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;id&amp;quot;: 1559,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;jsonrpc&amp;quot;: &amp;quot;2.0&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;method&amp;quot;: &amp;quot;eth_getBlockByHash&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;params&amp;quot;:[&amp;quot;0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331&amp;quot;, true]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ur&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; 1559,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;difficulty&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x027f07&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;extraData&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;baseFee&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x7&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gasLimit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x9f759&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gasUsed&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x9f759&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;logsBloom&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;miner&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x4e65fda2159562a496f9f3522f89122a3088497a&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xe04d296d2460cfb8472af2c5fd05b5a214109c25688d3704aed5484f9a7792f2&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1b4&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;parentHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x9646252be9520f6e71339a8df9c55e4d7619deeb018d2a3f2d21fc165dde5eb5&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;sha3Uncles&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;size&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x027f07&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;stateRoot&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xd5855eb08b3387c0af375e9cdb6acfc05eb8f519e419b874b6ff2ffda7ed1dff&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;timestamp&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x54e34e8e&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;totalDifficulty&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x027f07&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transactions&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transactionsRoot&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;uncles&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The addition of a single parameter instead of introducing a whole new endpoint was the simplest change that would be easiest to get integrated.
For backward compatibility we decided to not include the base fee in the response for pre-1559 blocks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Backwards compatible. Calls related to block prior to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; fork block will omit the base fee field in the response.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The added field (&lt;code&gt;baseFee&lt;&#x2F;code&gt;) is informational and does not introduce technical security issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>BW6-761 curve operations</title>
        <published>2020-10-05T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Youssef El Housni</name><uri>https://github.com/yelhousni</uri>
	</author>
	
	<author>
		<name>Michael Connor</name><uri>https://github.com/iAmMichaelConnor</uri>
	</author>
	
	<author>
		<name>Aurore Guillevic</name><email>aurore.guillevic@inria.fr</email>
	</author>
	
	<author>
		<name>hujw77</name><uri>https://github.com/hujw77</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3026/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3026-bw6-761-curve-operations/4790" />
        

        <id>https://wg-eips.ritovision.com/3026/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:3026"
            label="EIP-3026" />
        

        
        

        
        <summary type="html">Precompiles for BW6-761 curve operations</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3026/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This precompile adds operations for the BW6-761 curve (from the EY&#x2F;Inria &lt;strong&gt;Optimized and secure pairing-friendly elliptic curves suitable for one layer proof composition&lt;&#x2F;strong&gt; research paper) as a precompile in a set necessary to &lt;em&gt;efficiently&lt;&#x2F;em&gt; perform verification of one-layer composed zkSNARKs proofs.
If &lt;code&gt;block.number &amp;gt;= X&lt;&#x2F;code&gt; we introduce &lt;em&gt;seven&lt;&#x2F;em&gt; separate precompiles to perform the following operations (addresses to be determined):&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;BW6_G1_ADD - to perform point addition on a curve defined over a prime field&lt;&#x2F;li&gt;
&lt;li&gt;BW6_G1_MUL - to perform point multiplication on a curve defined over a prime field&lt;&#x2F;li&gt;
&lt;li&gt;BW6_G1_MULTIEXP - to perform multiexponentiation on a curve defined over a prime field&lt;&#x2F;li&gt;
&lt;li&gt;BW6_G2_ADD - to perform point addition on a curve twist defined the base a prime field&lt;&#x2F;li&gt;
&lt;li&gt;BW6_G2_MUL - to perform point multiplication on a curve twist defined over a prime field&lt;&#x2F;li&gt;
&lt;li&gt;BW6_G2_MULTIEXP - to perform multiexponentiation on a curve twist defined over a prime field&lt;&#x2F;li&gt;
&lt;li&gt;BW6_PAIRING - to perform a pairing operations between a set of &lt;em&gt;pairs&lt;&#x2F;em&gt; of (G1, G2) points&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The multiexponentiation operations are a generalization of point multiplication, but separate precompiles are prosposed because running a single MUL through MULTIEXP seems to be 20% more expensive.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is based on and tends to replace matter-labs&#x27; proposal for significant performance reasons. In most applications, BW6-761 is used as an outer curve to BLS12-377 considered in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2539&#x2F;&quot;&gt;EIP-2539&lt;&#x2F;a&gt;.
The motivation of this precompile is to allow efficient one-layer composition of SNARK proofs. Currently this is done by Zexe using the BLS12-377&#x2F;CP6-782 pair of curves. This precompile proposes a replacement of CP6-782 by BW6-761, which allows much faster operations. For example, it was shown that verifying a Groth16 proof with BW6-761 is 30 times faster than with CP6-782.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;proposed-addresses-table&quot;&gt;Proposed addresses table&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Precompile&lt;&#x2F;th&gt;&lt;th&gt;Address&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;BW6_G1_ADD&lt;&#x2F;td&gt;&lt;td&gt;0x1e&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;BW6_G1_MUL&lt;&#x2F;td&gt;&lt;td&gt;0x1f&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;BW6_G1_MULTIEXP&lt;&#x2F;td&gt;&lt;td&gt;0x20&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;BW6_G2_ADD&lt;&#x2F;td&gt;&lt;td&gt;0x21&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;BW6_G2_MUL&lt;&#x2F;td&gt;&lt;td&gt;0x22&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;BW6_G2_MULTIEXP&lt;&#x2F;td&gt;&lt;td&gt;0x23&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;BW6_PAIRING&lt;&#x2F;td&gt;&lt;td&gt;0x24&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Curve parameters:&lt;&#x2F;p&gt;
&lt;p&gt;The BW6-761 &lt;code&gt;y^2=x^3-1&lt;&#x2F;code&gt; curve is fully defined by the following set of parameters:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Base field modulus = 0x122e824fb83ce0ad187c94004faff3eb926186a81d14688528275ef8087be41707ba638e584e91903cebaff25b423048689c8ed12f9fd9071dcd3dc73ebff2e98a116c25667a8f8160cf8aeeaf0a437e6913e6870000082f49d00000000008b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;A coefficient = 0x0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;B coefficient = 0x122e824fb83ce0ad187c94004faff3eb926186a81d14688528275ef8087be41707ba638e584e91903cebaff25b423048689c8ed12f9fd9071dcd3dc73ebff2e98a116c25667a8f8160cf8aeeaf0a437e6913e6870000082f49d00000000008a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Main subgroup order = 0x1ae3a4617c510eac63b05c06ca1493b1a22d9f300f5138f1ef3622fba094800170b5d44300000008508c00000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Extension tower:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Fp3 construction: (Fp3 = Fp[u]&#x2F;u^3+4)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Fp cubic non-residue = 0x122e824fb83ce0ad187c94004faff3eb926186a81d14688528275ef8087be41707ba638e584e91903cebaff25b423048689c8ed12f9fd9071dcd3dc73ebff2e98a116c25667a8f8160cf8aeeaf0a437e6913e6870000082f49d000000000087&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Twist parameters:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Twist type: M&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;twist curve A coefficient c0 = 0x0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                          c1 = 0x0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;twist curve B coefficient c0 = 0x4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        c1 = 0x0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Generators:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;G1:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;X = 0x1075b020ea190c8b277ce98a477beaee6a0cfb7551b27f0ee05c54b85f56fc779017ffac15520ac11dbfcd294c2e746a17a54ce47729b905bd71fa0c9ea097103758f9a280ca27f6750dd0356133e82055928aca6af603f4088f3af66e5b43d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Y = 0x58b84e0a6fc574e6fd637b45cc2a420f952589884c9ec61a7348d2a2e573a3265909f1af7e0dbac5b8fa1771b5b806cc685d31717a4c55be3fb90b6fc2cdd49f9df141b3053253b2b08119cad0fb93ad1cb2be0b20d2a1bafc8f2db4e95363&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;G2:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;X = 0x110133241d9b816c852a82e69d660f9d61053aac5a7115f4c06201013890f6d26b41c5dab3da268734ec3f1f09feb58c5bbcae9ac70e7c7963317a300e1b6bace6948cb3cd208d700e96efbc2ad54b06410cf4fe1bf995ba830c194cd025f1c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Y = 0x17c3357761369f8179eb10e4b6d2dc26b7cf9acec2181c81a78e2753ffe3160a1d86c80b95a59c94c97eb733293fef64f293dbd2c712b88906c170ffa823003ea96fcd504affc758aa2d3a3c5a02a591ec0594f9eac689eb70a16728c73b61&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Pairing parameters:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;e(P,Q)=(ML1(P,Q)*ML2(P,Q)^q)^FE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|loop_count_1| (first miller loop ML1 count) = 0x8508c00000000002&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|loop_count_2| (second miller loop ML2 count) = 0x23ed1347970dec008a442f991fffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;loop_count_1 is negative = false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;loop_count_2 is negative = false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;encoding&quot;&gt;Encoding&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;field-elements-encoding&quot;&gt;Field elements encoding:&lt;&#x2F;h4&gt;
&lt;p&gt;To encode points involved in the operation one has to encode elements of only the base field.&lt;&#x2F;p&gt;
&lt;p&gt;The base field element (Fp) is encoded as &lt;code&gt;96&lt;&#x2F;code&gt; bytes by performing BigEndian encoding of the corresponding (unsigned) integer. The corresponding integer &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be less than the base field modulus.&lt;&#x2F;p&gt;
&lt;p&gt;If encodings do not follow this spec anywhere during parsing in the precompile, the precompile &lt;strong&gt;MUST&lt;&#x2F;strong&gt; revert with &quot;endoding error&quot;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;encoding-of-uncompressed-points&quot;&gt;Encoding of uncompressed points:&lt;&#x2F;h4&gt;
&lt;p&gt;Points in both G1 and G2 can be expressed as &lt;code&gt;(x, y)&lt;&#x2F;code&gt; affine coordinates, where &lt;code&gt;x&lt;&#x2F;code&gt; and &lt;code&gt;y&lt;&#x2F;code&gt; are elements of the base field.
Therefore, points in both G1 and G2 are encoded as the byte concatenation of the field element encodings of the &lt;code&gt;x&lt;&#x2F;code&gt; and &lt;code&gt;y&lt;&#x2F;code&gt; affine coordinates. The total encoding length for a G1&#x2F;G2 point is thus &lt;code&gt;192&lt;&#x2F;code&gt; bytes.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;point-at-infinity-encoding&quot;&gt;Point at infinity encoding:&lt;&#x2F;h4&gt;
&lt;p&gt;Also referred as the &quot;zero point&quot;. For BW6-761 (&lt;code&gt;y^2=x^3-1&lt;&#x2F;code&gt;) and its M-twisted curves (&lt;code&gt;y^3=x^3+4&lt;&#x2F;code&gt;), the point with coordinates &lt;code&gt;(0, 0)&lt;&#x2F;code&gt; (formal zeros in Fp) is &lt;em&gt;not&lt;&#x2F;em&gt; on the curve, and so the encoding of &lt;code&gt;(0, 0)&lt;&#x2F;code&gt; is used as a convention to encode the point at infinity.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;encoding-of-scalars-for-multiplication-and-multiexponentiation-operations&quot;&gt;Encoding of scalars for multiplication and multiexponentiation operations:&lt;&#x2F;h4&gt;
&lt;p&gt;For multiplication and multiexponentiation operations, a scalar is encoded as &lt;code&gt;64&lt;&#x2F;code&gt; bytes by performing BigEndian encoding of the corresponding (unsigned) integer.&lt;&#x2F;p&gt;
&lt;p&gt;Note that the main subgroup order for BW6-761 is actually only &lt;code&gt;377&lt;&#x2F;code&gt; bits (&lt;code&gt;48&lt;&#x2F;code&gt; bytes), but an encoding of &lt;code&gt;64&lt;&#x2F;code&gt; bytes has been chosen to have a &lt;code&gt;32&lt;&#x2F;code&gt;-byte-aligned ABI (representable as e.g. &lt;code&gt;bytes32[2]&lt;&#x2F;code&gt; or &lt;code&gt;uint256[2]&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;The corresponding integer &lt;strong&gt;MAY&lt;&#x2F;strong&gt; be greater than the main subgroup order.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;abi-for-operations&quot;&gt;ABI for operations&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;abi-for-g1-addition&quot;&gt;ABI for G1 addition&lt;&#x2F;h4&gt;
&lt;p&gt;G1 addition call expects &lt;code&gt;384&lt;&#x2F;code&gt; bytes as an input that is interpreted as the byte concatenation of two G1 points (point-encoded as &lt;code&gt;192&lt;&#x2F;code&gt; bytes each). Output is a point-encoding of the addition operation result.&lt;&#x2F;p&gt;
&lt;p&gt;Error cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Either of the points being not on the curve&lt;&#x2F;li&gt;
&lt;li&gt;Input has invalid length&lt;&#x2F;li&gt;
&lt;li&gt;Field element encoding rules apply (obviously)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;abi-for-g1-multiplication&quot;&gt;ABI for G1 multiplication&lt;&#x2F;h4&gt;
&lt;p&gt;G1 multiplication call expects &lt;code&gt;256&lt;&#x2F;code&gt; bytes as an input that is interpreted as the byte concatenation of the point-encoding of a G1 point (&lt;code&gt;192&lt;&#x2F;code&gt; bytes) and the encoding of a scalar value (&lt;code&gt;64&lt;&#x2F;code&gt; bytes). Output is a point-encoding of the multiplication operation result.&lt;&#x2F;p&gt;
&lt;p&gt;Error cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Point being not on the curve&lt;&#x2F;li&gt;
&lt;li&gt;Input has invalid length&lt;&#x2F;li&gt;
&lt;li&gt;Field element encoding rules apply (obviously)&lt;&#x2F;li&gt;
&lt;li&gt;Scalar encoding rules apply (obviously)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;abi-for-g1-multiexponentiation&quot;&gt;ABI for G1 multiexponentiation&lt;&#x2F;h4&gt;
&lt;p&gt;G1 multiplication call expects &lt;code&gt;256*k&lt;&#x2F;code&gt; bytes as an input that is interpreted as the byte concatenation of &lt;code&gt;k&lt;&#x2F;code&gt; slices, each of them being a byte concatenation of the point-encoding of a G1 point (&lt;code&gt;192&lt;&#x2F;code&gt; bytes) and the encoding of a scalar value (&lt;code&gt;64&lt;&#x2F;code&gt; bytes). Output is an encoding of the multiexponentiation operation result.&lt;&#x2F;p&gt;
&lt;p&gt;Error cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Any of the G1 points being not on the curve&lt;&#x2F;li&gt;
&lt;li&gt;Input has invalid length&lt;&#x2F;li&gt;
&lt;li&gt;Field element encoding rules apply (obviously)&lt;&#x2F;li&gt;
&lt;li&gt;Scalar encoding rules apply (obviously)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;abi-for-g2-addition&quot;&gt;ABI for G2 addition&lt;&#x2F;h4&gt;
&lt;p&gt;G2 addition call expects &lt;code&gt;384&lt;&#x2F;code&gt; bytes as an input that is interpreted as the byte concatenation of two G2 points (point-encoded as &lt;code&gt;192&lt;&#x2F;code&gt; bytes each). Output is a point-encoding of the addition operation result.&lt;&#x2F;p&gt;
&lt;p&gt;Error cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Either of points being not on the curve&lt;&#x2F;li&gt;
&lt;li&gt;Input has invalid length&lt;&#x2F;li&gt;
&lt;li&gt;Field elements encoding rules apply (obviously)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;abi-for-g2-multiplication&quot;&gt;ABI for G2 multiplication&lt;&#x2F;h4&gt;
&lt;p&gt;G2 multiplication call expects &lt;code&gt;256&lt;&#x2F;code&gt; bytes as an input that is interpreted as the byte concatenation of the point-encoding of a G2 point (&lt;code&gt;192&lt;&#x2F;code&gt; bytes) and the encoding of a scalar value (&lt;code&gt;64&lt;&#x2F;code&gt; bytes). Output is an encoding of multiplication operation result.&lt;&#x2F;p&gt;
&lt;p&gt;Error cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Point being not on the curve must result in error&lt;&#x2F;li&gt;
&lt;li&gt;Field elements encoding rules apply (obviously)&lt;&#x2F;li&gt;
&lt;li&gt;Input has invalid length&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;abi-for-g2-multiexponentiation&quot;&gt;ABI for G2 multiexponentiation&lt;&#x2F;h4&gt;
&lt;p&gt;G2 multiplication call expects &lt;code&gt;240*k&lt;&#x2F;code&gt; bytes as an input that is interpreted as byte concatenation of &lt;code&gt;k&lt;&#x2F;code&gt; slices each of them being a byte concatenation of encoding of G2 point (&lt;code&gt;192&lt;&#x2F;code&gt; bytes) and encoding of a scalar value (&lt;code&gt;48&lt;&#x2F;code&gt; bytes). Output is an encoding of multiexponentiation operation result.&lt;&#x2F;p&gt;
&lt;p&gt;Error cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Any of G2 points being not on the curve must result in error&lt;&#x2F;li&gt;
&lt;li&gt;Field elements encoding rules apply (obviously)&lt;&#x2F;li&gt;
&lt;li&gt;Input has invalid length&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;abi-for-pairing&quot;&gt;ABI for pairing&lt;&#x2F;h4&gt;
&lt;p&gt;Pairing call expects &lt;code&gt;384*k&lt;&#x2F;code&gt; bytes as an input, that is interpreted as the byte concatenation of &lt;code&gt;k&lt;&#x2F;code&gt; slices. Each slice has the following structure:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;192&lt;&#x2F;code&gt; bytes G1 point encoding&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;192&lt;&#x2F;code&gt; bytes G2 point encoding&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Output is &lt;code&gt;32&lt;&#x2F;code&gt; bytes representing a boolean:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;code&gt; if the pairing result is equal the to multiplicative identity in the pairing target field; and&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;code&gt; otherwise.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Error cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Any of the G1 or G2 points being not on the curve&lt;&#x2F;li&gt;
&lt;li&gt;Any of the G1 or G2 points being not in the correct subgroup&lt;&#x2F;li&gt;
&lt;li&gt;Input has invalid length&lt;&#x2F;li&gt;
&lt;li&gt;Field elements encoding rules apply (obviously)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;prevention-of-ddos-on-error-handling&quot;&gt;Prevention of DDoS on error handling&lt;&#x2F;h3&gt;
&lt;p&gt;This precompile performs extensive computations and in case of any errors during execution it &lt;strong&gt;MUST&lt;&#x2F;strong&gt; consume all gas from the gas schedule for the corresponding operation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-schedule&quot;&gt;Gas schedule&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;g1-addition&quot;&gt;G1 addition&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;180&lt;&#x2F;code&gt; gas&lt;&#x2F;p&gt;
&lt;h4 id=&quot;g1-multiplication&quot;&gt;G1 multiplication&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;64000&lt;&#x2F;code&gt; gas&lt;&#x2F;p&gt;
&lt;h4 id=&quot;g2-addition&quot;&gt;G2 addition&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;180&lt;&#x2F;code&gt; gas&lt;&#x2F;p&gt;
&lt;h4 id=&quot;g2-multiplication&quot;&gt;G2 multiplication&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;64000&lt;&#x2F;code&gt; gas&lt;&#x2F;p&gt;
&lt;h4 id=&quot;g1-g2-multiexponentiation&quot;&gt;G1&#x2F;G2 Multiexponentiation&lt;&#x2F;h4&gt;
&lt;p&gt;Discounts table as a vector of pairs &lt;code&gt;[k, discount]&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[[1, 1266], [2, 733], [3, 561], [4, 474], [5, 422], [6, 387], [7, 362], [8, 344], [9, 329], [10, 318], [11, 308], [12, 300], [13, 296], [14, 289], [15, 283], [16, 279], [17, 275], [18, 272], [19, 269], [20, 266], [21, 265], [22, 260], [23, 259], [24, 256], [25, 255], [26, 254], [27, 252], [28, 251], [29, 250], [30, 249], [31, 249], [32, 220], [33, 228], [34, 225], [35, 223], [36, 219], [37, 216], [38, 214], [39, 212], [40, 209], [41, 209], [42, 205], [43, 203], [44, 202], [45, 200], [46, 198], [47, 196], [48, 199], [49, 195], [50, 192], [51, 192], [52, 191], [53, 190], [54, 187], [55, 186], [56, 185], [57, 184], [58, 184], [59, 181], [60, 181], [61, 181], [62, 180], [63, 178], [64, 179], [65, 176], [66, 177], [67, 176], [68, 175], [69, 174], [70, 173], [71, 171], [72, 171], [73, 170], [74, 170], [75, 169], [76, 168], [77, 168], [78, 167], [79, 167], [80, 166], [81, 165], [82, 167], [83, 166], [84, 166], [85, 165], [86, 165], [87, 164], [88, 164], [89, 163], [90, 163], [91, 162], [92, 162], [93, 160], [94, 163], [95, 159], [96, 162], [97, 159], [98, 160], [99, 159], [100, 159], [101, 158], [102, 158], [103, 158], [104, 158], [105, 157], [106, 157], [107, 156], [108, 155], [109, 155], [110, 156], [111, 155], [112, 155], [113, 154], [114, 155], [115, 154], [116, 153], [117, 153], [118, 153], [119, 152], [120, 152], [121, 152], [122, 152], [123, 151], [124, 151], [125, 151], [126, 151], [127, 151], [128, 150]]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;max_discount = 150&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;pairing-operation&quot;&gt;Pairing operation&lt;&#x2F;h4&gt;
&lt;p&gt;Base cost of the pairing operation is &lt;code&gt;120000*k + 320000&lt;&#x2F;code&gt; where &lt;code&gt;k&lt;&#x2F;code&gt; is a number of pairs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Gas costs are based on &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1962&#x2F;&quot;&gt;EIP-1962&lt;&#x2F;a&gt; estimation strategy (but do not fully include yet parsing of ABI, decoding and encoding of the result as a byte array).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-estimation-strategy&quot;&gt;Gas estimation strategy&lt;&#x2F;h3&gt;
&lt;p&gt;Gas cost is derived by taking the average timing of the same operations over different implementations and assuming a constant &lt;code&gt;30 MGas&#x2F;second&lt;&#x2F;code&gt;. Since the execution time is machine-specific, this constant is determined based on execution times of &lt;em&gt;ECRECOVER&lt;&#x2F;em&gt; and &lt;em&gt;BNPAIR&lt;&#x2F;em&gt; precompiles on my machine and their proposed gas price (&lt;code&gt;43.5 MGas&#x2F;s&lt;&#x2F;code&gt; for ECRECOVER and &lt;code&gt;16.5 MGas&#x2F;s&lt;&#x2F;code&gt; for BNPAIR). Following are the proposed methods to time the precompile operations:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;G1 addition: Average timing of 1000 random samples.&lt;&#x2F;li&gt;
&lt;li&gt;G1 multiplication: Average timing of 1000 samples of random worst-case of double-and-add algorithm (scalar of max bit length and max hamming weight and random base points in G1)&lt;&#x2F;li&gt;
&lt;li&gt;G2 addition: Average timing of 1000 random samples&lt;&#x2F;li&gt;
&lt;li&gt;G2 multiplication: Average timing of 1000 samples of random worst-case of double-and-add algorithm (scalar of max bit length and max hamming weight and random base points in G2)&lt;&#x2F;li&gt;
&lt;li&gt;G1 and G2 multiexponentiations: Expected to be performed by the Peppinger algorithm, with a table prepared for discount in case of &lt;code&gt;k &amp;lt;= 128&lt;&#x2F;code&gt; points in the multiexponentiation with a discount cup &lt;code&gt;max_discount&lt;&#x2F;code&gt; for &lt;code&gt;k &amp;gt; 128&lt;&#x2F;code&gt;. To avoid non-integer arithmetic call cost is calculated as &lt;code&gt;k * multiplication_cost * discount &#x2F; multiplier&lt;&#x2F;code&gt; where &lt;code&gt;multiplier = 1000&lt;&#x2F;code&gt;, &lt;code&gt;k&lt;&#x2F;code&gt; is a number of (scalar, point) pairs for the call, &lt;code&gt;multiplication_cost&lt;&#x2F;code&gt; is a corresponding single multiplication call cost for G1&#x2F;G2.&lt;&#x2F;li&gt;
&lt;li&gt;Pairing: Average timing of 1000 random samples (random points in G1 and G2) for different number of pairs with linear lifting.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;multiexponentiation-as-a-separate-call&quot;&gt;Multiexponentiation as a separate call&lt;&#x2F;h3&gt;
&lt;p&gt;Explicit separate multiexponentiation operation that allows one to save execution time (so gas) by both the algorithm used (namely Peppinger algorithm) and (usually forgotten) by the fact that &lt;code&gt;CALL&lt;&#x2F;code&gt; operation in Ethereum is expensive (at the time of writing), so one would have to pay non-negigible overhead if e.g. for multiexponentiation of &lt;code&gt;100&lt;&#x2F;code&gt; points would have to call the multiplication precompile &lt;code&gt;100&lt;&#x2F;code&gt; times and addition for &lt;code&gt;99&lt;&#x2F;code&gt; times (roughly &lt;code&gt;138600&lt;&#x2F;code&gt; would be saved).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;explicit-subgroup-checks&quot;&gt;Explicit subgroup checks&lt;&#x2F;h3&gt;
&lt;p&gt;G2 subgroup check has the same cost as G1 subgroup check. Endomorphisms can be leverages to optimize this operation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;There are no backward compatibility questions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Due to the large test parameters space we first provide properties that various operations must satisfy. We use additive notation for point operations, capital letters (&lt;code&gt;P&lt;&#x2F;code&gt;, &lt;code&gt;Q&lt;&#x2F;code&gt;) for points, small letters (&lt;code&gt;a&lt;&#x2F;code&gt;, &lt;code&gt;b&lt;&#x2F;code&gt;) for scalars. Generator for G1 is labeled as &lt;code&gt;G&lt;&#x2F;code&gt;, generator for G2 is labeled as &lt;code&gt;H&lt;&#x2F;code&gt;, otherwise we assume random point on a curve in a correct subgroup. &lt;code&gt;0&lt;&#x2F;code&gt; means either scalar zero or point of infinity. &lt;code&gt;1&lt;&#x2F;code&gt; means either scalar one or multiplicative identity. &lt;code&gt;group_order&lt;&#x2F;code&gt; is a main subgroup order. &lt;code&gt;e(P, Q)&lt;&#x2F;code&gt; means pairing operation where &lt;code&gt;P&lt;&#x2F;code&gt; is in G1, &lt;code&gt;Q&lt;&#x2F;code&gt; is in G2.&lt;&#x2F;p&gt;
&lt;p&gt;Requeired properties for basic ops (add&#x2F;multiply):&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Commutativity: &lt;code&gt;P + Q = Q + P&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Additive negation: &lt;code&gt;P + (-P) = 0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Doubling &lt;code&gt;P + P = 2*P&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Subgroup check: &lt;code&gt;group_order * P = 0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Trivial multiplication check: &lt;code&gt;1 * P = P&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Multiplication by zero: &lt;code&gt;0 * P = 0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Multiplication by the unnormalized scalar &lt;code&gt;(scalar + group_order) * P = scalar * P&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Required properties for pairing operation:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Degeneracy &lt;code&gt;e(P, 0*Q) = e(0*P, Q) = 1&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Bilinearity &lt;code&gt;e(a*P, b*Q) = e(a*b*P, Q) = e(P, a*b*Q)&lt;&#x2F;code&gt; (internal test, not visible through ABI)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;There is a various choice of existing implementations:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Libraries:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Rust implementation (EY&#x2F;Zexe): github.com&#x2F;yelhousni&#x2F;zexe&#x2F;tree&#x2F;youssef&#x2F;BW6-761-Fq-ABLR-2ML-M&lt;&#x2F;li&gt;
&lt;li&gt;C++ implementation (EY&#x2F;libff): github.com&#x2F;EYBlockchain&#x2F;zk-swap-libff&lt;&#x2F;li&gt;
&lt;li&gt;Golang implementation (Consensys&#x2F;gurvy): github.com&#x2F;ConsenSys&#x2F;gurvy&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Stand-alone implementation:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Golang implementation with Intel assembly (Onur Kilic): github.com&#x2F;kilic&#x2F;bw6&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Precompiles:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;OpenEthereum (EY&#x2F;Parity): github.com&#x2F;EYBlockchain&#x2F;solidity-elliptic-curves&lt;&#x2F;li&gt;
&lt;li&gt;Frontier (Parity): github.com&#x2F;paritytech&#x2F;frontier&#x2F;pull&#x2F;1049&#x2F;files&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Scripts:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;SageMath and Magma scripts: gitlab.inria.fr&#x2F;zk-curves&#x2F;bw6-761&#x2F;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Strictly following the spec will eliminate security implications or consensus implications in a contrast to the previous BN254 precompile.&lt;&#x2F;p&gt;
&lt;p&gt;Important topic is a &quot;constant time&quot; property for performed operations. We explicitly state that this precompile &lt;strong&gt;IS NOT REQUIRED&lt;&#x2F;strong&gt; to perform all the operations using constant time algorithms.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>eth_symbol JSON-RPC method</title>
        <published>2020-09-30T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Peter Grassberger</name><uri>https://github.com/PeterTheOne</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3014/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/3012" />
        

        <id>https://wg-eips.ritovision.com/3014/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="interface"
                label="Interface" />
            
        

        
        <category
            term="tag:eip:3014"
            label="EIP-3014" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3014/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Add &lt;code&gt;eth_symbol&lt;&#x2F;code&gt; method to the JSON-RPC that returns the symbol of the native coin of the network.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The new method &lt;code&gt;eth_symbol&lt;&#x2F;code&gt; (&lt;code&gt;eth_&lt;&#x2F;code&gt;-namespaced) has no parameters and returns a string of the native coin of the network. For the Ethereum mainnet this will be &lt;code&gt;ETH&lt;&#x2F;code&gt;, other networks will have other symbols.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Wallets that deal with multiple networks need some basic information for every blockchain that they connect to. One of those things is the symbol of the native coin of the network. Instead of requiring the user to research and manually add the symbol it could be provided to the wallet via this proposed JSON-RPC endpoint and used automatically. There are lists of networks with symbols like https:&#x2F;&#x2F;github.com&#x2F;ethereum-lists&#x2F;chains where a user can manually look up the correct values. But this information could easily come from the network itself.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Method: &lt;code&gt;eth_symbol&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Params: none.&lt;&#x2F;p&gt;
&lt;p&gt;Returns: &lt;code&gt;result&lt;&#x2F;code&gt; - the native coin symbol, string&lt;&#x2F;p&gt;
&lt;p&gt;Example:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; --&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{&amp;quot;jsonrpc&amp;quot;:&amp;quot;2.0&amp;quot;,&amp;quot;method&amp;quot;:&amp;quot;eth_symbol&amp;quot;,&amp;quot;params&amp;quot;:[],&amp;quot;id&amp;quot;:1}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Result&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ETH&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This endpoint is similar to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;695&#x2F;&quot;&gt;EIP-695&lt;&#x2F;a&gt; but it provides the symbol instead of &lt;code&gt;chainId&lt;&#x2F;code&gt;. It provides functionality that is already there for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens, but not yet for the native coin of the network. Alternative naming of &lt;code&gt;eth_nativeCurrencySymbol&lt;&#x2F;code&gt; was considered, but the context and the fact that it just returns one value makes it clear that that it returns the symbol for the native coin of the network.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;It is a read only endpoint. The information is only as trusted as the JSON-RPC node itself, it could supply wrong information and thereby trick the user in believing he&#x2F;she is dealing with another native coin.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>BLS Remote Signer HTTP API</title>
        <published>2020-09-30T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Herman Junge</name><uri>https://github.com/hermanjunge</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3030/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3030-bls-remote-signer-http-api-standard/4810" />
        

        <id>https://wg-eips.ritovision.com/3030/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="interface"
                label="Interface" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:3030"
            label="EIP-3030" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3030/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP defines a HTTP API standard for a BLS remote signer, consumed by validator clients to sign block proposals and attestations in the context of Ethereum 2.0 (eth2).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;A &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;eth2.0-specs&#x2F;blob&#x2F;dev&#x2F;specs&#x2F;phase0&#x2F;validator.md&quot;&gt;validator&lt;&#x2F;a&gt; client contributes to the consensus of the Eth2 blockchain by signing proposals and attestations of blocks, using a BLS private key which must be available to this client at all times.&lt;&#x2F;p&gt;
&lt;p&gt;The BLS remote signer API is designed to be consumed by validator clients, looking for a more secure avenue to store their BLS12-381 private key(s), enabling them to run in more permissive and scalable environments.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Eth2 utilizes &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;cfrg&#x2F;draft-irtf-cfrg-bls-signature&#x2F;&quot;&gt;BLS12-381&lt;&#x2F;a&gt; signatures.&lt;&#x2F;p&gt;
&lt;p&gt;Consensus on the eth2 Blockchain is achieved via the proposal and attestation of blocks from validator clients, using a BLS private key (&lt;em&gt;signing&lt;&#x2F;em&gt; key) which must be available each time a message is signed: that is, at least once every epoch (6.4 minutes), during a small window of time within this epoch (a &lt;em&gt;slot&lt;&#x2F;em&gt;, i.e. 12 seconds), as each validator is expected to attest exactly once per epoch.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;eth2.0-specs&quot;&gt;eth2 specification&lt;&#x2F;a&gt; does not explicitly provide a directive on where this BLS private key must&#x2F;should be stored, leaving this implementation detail to the client teams, who assume that this cryptographic secret is stored on the same host as the validator client.&lt;&#x2F;p&gt;
&lt;p&gt;This assumption is sufficient in the use case where the validator client is running in a physically secure network (i.e. nobody, but the operator, has a chance to log-in into the machine hosting the validator client), as such configuration would only allow &lt;em&gt;outbound&lt;&#x2F;em&gt; calls from the validator client. In this situation, only a physical security breach, or a Remote Code Execution (RCE) vulnerability can allow an attacker to either have arbitrary access to the storage or to the memory of the device.&lt;&#x2F;p&gt;
&lt;p&gt;There are, however, use cases where it is required by the operator to run a validator client node in less constrained security environments, as the ones given by a cloud provider. Notwithstanding any security expectation, nothing prevents a rogue operator from gaining arbitrary access to the assets running inside a node.&lt;&#x2F;p&gt;
&lt;p&gt;The situation is not better when the requirement is to execute the validators by leveraging a container orchestration solution (e.g. Kubernetes). The handling of secret keys across nodes can become a burden both from an operational as well as a security perspective.&lt;&#x2F;p&gt;
&lt;p&gt;The proposed solution comprises running a specialized node with exclusive access to the secret keys, listening to a simple API (defined in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3030&#x2F;#specification&quot;&gt;Specification&lt;&#x2F;a&gt; section), and returning the requested signatures. Operators working under this schema must utilize clients with the adequate feature supporting the consumption of this API.&lt;&#x2F;p&gt;
&lt;p&gt;The focus of this specification is the supply of BLS signatures &lt;em&gt;on demand&lt;&#x2F;em&gt;. The aspects of authentication, key management (creation, update, and deletion), and transport encryption are discussed in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3030&#x2F;#rationale&quot;&gt;Rationale&lt;&#x2F;a&gt; section of this document. Moreover, the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3030&#x2F;#threat-model&quot;&gt;Threat Model&lt;&#x2F;a&gt; section of this document provides a (non-exhaustive) list of threats and attack vectors, along with the suggested related mitigation strategy.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;get-upcheck&quot;&gt;&lt;code&gt;GET &#x2F;upcheck&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Responses&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Success&lt;&#x2F;th&gt;&lt;th&gt;&lt;br&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Code&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;200&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Content&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;{&quot;status&quot;: &quot;OK&quot;}&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;hr &#x2F;&gt;
&lt;h3 id=&quot;get-keys&quot;&gt;&lt;code&gt;GET &#x2F;keys&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Returns the identifiers of the keys available to the signer.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Responses&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Success&lt;&#x2F;th&gt;&lt;th&gt;&lt;br&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Code&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;200&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Content&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;{&quot;keys&quot;: &quot;[identifier]&quot;}&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;hr &#x2F;&gt;
&lt;h3 id=&quot;post-sign-identifier&quot;&gt;&lt;code&gt;POST &#x2F;sign&#x2F;:identifier&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;URL Parameter&lt;&#x2F;th&gt;&lt;th&gt;&lt;br&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;:identifier&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;public_key_hex_string_without_0x&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Request&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;JSON Body&lt;&#x2F;th&gt;&lt;th&gt;&lt;br&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;br&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;bls_domain&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;strong&gt;Required&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;The BLS Signature domain.&lt;br&gt;As defined in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;eth2.0-specs&#x2F;blob&#x2F;dev&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#domain-types&quot;&gt;specification&lt;&#x2F;a&gt;, in lowercase, omitting the &lt;code&gt;domain&lt;&#x2F;code&gt; prefix.&lt;br&gt;Supporting &lt;code&gt;beacon_proposer&lt;&#x2F;code&gt;, &lt;code&gt;beacon_attester&lt;&#x2F;code&gt;, and &lt;code&gt;randao&lt;&#x2F;code&gt;.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;data&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;strong&gt;Required&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;The data to be signed.&lt;br&gt;As defined in the specifications for &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;eth2.0-APIs&#x2F;blob&#x2F;master&#x2F;types&#x2F;block.yaml&quot;&gt;block&lt;&#x2F;a&gt;, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;eth2.0-APIs&#x2F;blob&#x2F;master&#x2F;types&#x2F;attestation.yaml&quot;&gt;attestation&lt;&#x2F;a&gt;, and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;eth2.0-APIs&#x2F;blob&#x2F;master&#x2F;types&#x2F;misc.yaml&quot;&gt;epoch&lt;&#x2F;a&gt;.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;fork&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;strong&gt;Required&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;A &lt;code&gt;Fork&lt;&#x2F;code&gt; object containing previous and current versions.&lt;br&gt;As defined in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;eth2.0-APIs&#x2F;blob&#x2F;master&#x2F;types&#x2F;misc.yaml&quot;&gt;specification&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;genesis_validators_root&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;strong&gt;Required&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;A &lt;code&gt;Hash256&lt;&#x2F;code&gt; for domain separation and chain versioning.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;br&gt;&lt;&#x2F;td&gt;&lt;td&gt;Optional&lt;&#x2F;td&gt;&lt;td&gt;Any other field will be ignored by the signer&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Responses&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Success&lt;&#x2F;th&gt;&lt;th&gt;&lt;br&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Code&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;200&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Content&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;{&quot;signature&quot;: &quot;&amp;lt;signature_hex_string&amp;gt;&quot;}&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Where signature is a &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;eth2.0-specs&#x2F;blob&#x2F;dev&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#bls-signatures&quot;&gt;BLS signature&lt;&#x2F;a&gt; byte array encoded as a hexadecimal string.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;or&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Error&lt;&#x2F;th&gt;&lt;th&gt;&lt;br&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Code&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;400&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Content&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;{&quot;error&quot;: &quot;&amp;lt;Bad Request Error Message&amp;gt;&quot;}&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;&lt;em&gt;or&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Error&lt;&#x2F;th&gt;&lt;th&gt;&lt;br&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Code&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;404&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Content&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;{&quot;error&quot;: &quot;Key not found: &amp;lt;identifier&amp;gt;&quot;}&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;hr &#x2F;&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;unix-philosophy-simple-api&quot;&gt;UNIX philosophy: Simple API&lt;&#x2F;h3&gt;
&lt;p&gt;This API specification contains only three methods: one for &lt;strong&gt;status&lt;&#x2F;strong&gt;, one for &lt;strong&gt;listing the available keys&lt;&#x2F;strong&gt;, and one to &lt;strong&gt;produce a signature&lt;&#x2F;strong&gt;. There are no methods for authentication, key management, nor transport encryption.&lt;&#x2F;p&gt;
&lt;p&gt;The following subsections discuss aspects to be considered by the client implementers relative to these subjects.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;implementation-of-additional-features&quot;&gt;Implementation of additional features&lt;&#x2F;h4&gt;
&lt;p&gt;From an API pipeline view, we have two nodes: The validator client (1) that makes requests to the remote signer (2). A more sophisticated chain can be built by introducing elements between these two nodes. Either by setting up reverse proxy services, or by adding plugins to the remote signer implementation.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;authentication&quot;&gt;Authentication&lt;&#x2F;h4&gt;
&lt;p&gt;Can be accomplished through the use of an HTTP Request Header. There are several ways to negotiate and issue a valid token to authenticate the communication between the validator client and the remote signer, each of them with potential drawbacks (e.g replay attacks, challenges in distributing the token to the validator client, etc.). In general, any method of authentication must be combined with transport encryption to be effective.&lt;&#x2F;p&gt;
&lt;p&gt;The operator can also implement network Access Control Lists (ACLs) between the validator client&#x27;s network and the remote signer&#x27;s network, reducing the attack surface by requiring a potential attacker to be positioned in the same network as the validator client.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;key-management&quot;&gt;Key management&lt;&#x2F;h4&gt;
&lt;p&gt;There are several ways to store secret keys, namely Hardware Security Modules (HSM), Secrets management applications (e.g. Hashicorp Vault), cloud storage with tight private network ACL rules, or even raw files in a directory. In general the remote signer implementers will abstract the storage medium from the HTTP API.&lt;&#x2F;p&gt;
&lt;p&gt;It is in this perspective, that any procedure to create, update, or delete keys should be built separate from the client implementation.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;transport-encryption&quot;&gt;Transport Encryption&lt;&#x2F;h4&gt;
&lt;p&gt;If the operator is working with self-signed certificates, it is required that the client enhancement consuming the remote signer allows this option.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;test-data&quot;&gt;Test Data&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;BLS Pair
&lt;ul&gt;
&lt;li&gt;Public key: &lt;code&gt;0xb7354252aa5bce27ab9537fd0158515935f3c3861419e1b4b6c8219b5dbd15fcf907bddf275442f3e32f904f79807a2a&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Secret key: &lt;code&gt;0x68081afeb7ad3e8d469f87010804c3e8d53ef77d393059a55132637206cc59ec&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Signing root: &lt;code&gt;0xb6bb8f3765f93f4f1e7c7348479289c9261399a3c6906685e320071a1a13955c&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Expected signature: &lt;code&gt;0xb5d0c01cef3b028e2c5f357c2d4b886f8e374d09dd660cd7dd14680d4f956778808b4d3b2ab743e890fc1a77ae62c3c90d613561b23c6adaeb5b0e288832304fddc08c7415080be73e556e8862a1b4d0f6aa8084e34a901544d5bb6aeed3a612&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;get-upcheck-1&quot;&gt;&lt;code&gt;GET &#x2F;upcheck&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Success&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;# Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; localhost:9000&#x2F;upcheck&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;# Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt;   Trying 127.0.0.1:9000...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; TCP_NODELAY set&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; Connected to localhost (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;127.0.0.1&lt;&#x2F;span&gt;&lt;span&gt;) port 9000 (&lt;&#x2F;span&gt;&lt;span&gt;#0)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; GET&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &#x2F;upcheck&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; HTTP&#x2F;1.1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Host: localhost:9000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; User-Agent: curl&#x2F;7.68.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Accept: &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; Mark bundle as not supporting multiuse&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; HTTP&#x2F;1.1 200 OK&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; content-type: application&#x2F;json&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; content-length: 15&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; date: Wed, 30 Sep 2020 02:25:08 GMT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; Connection&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;0 to host localhost left intact&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;status&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;OK&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;get-keys-1&quot;&gt;&lt;code&gt;GET &#x2F;keys&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Success&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;# Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; localhost:9000&#x2F;keys&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;# Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt;   Trying 127.0.0.1:9000...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; TCP_NODELAY set&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; Connected to localhost (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;127.0.0.1&lt;&#x2F;span&gt;&lt;span&gt;) port 9000 (&lt;&#x2F;span&gt;&lt;span&gt;#0)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; GET&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &#x2F;publicKeys&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; HTTP&#x2F;1.1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Host: localhost:9000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; User-Agent: curl&#x2F;7.68.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Accept: &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; Mark bundle as not supporting multiuse&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; HTTP&#x2F;1.1 200 OK&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; content-type: application&#x2F;json&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; content-length: 116&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; date: Wed, 30 Sep 2020 02:25:36 GMT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; Connection&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;0 to host localhost left intact&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;keys&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;b7354252aa5bce27ab9537fd0158515935f3c3861419e1b4b6c8219b5dbd15fcf907bddf275442f3e32f904f79807a2a&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;]}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Server Error&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;# Preparation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;# `chmod` keys directory to the octal 311 (-wx--x--x).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;# Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;v&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; localhost:9000&#x2F;keys&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;# Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt;   Trying 127.0.0.1:9000...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; TCP_NODELAY set&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; Connected to localhost (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;127.0.0.1&lt;&#x2F;span&gt;&lt;span&gt;) port 9000 (&lt;&#x2F;span&gt;&lt;span&gt;#0)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; GET&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &#x2F;publicKeys&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; HTTP&#x2F;1.1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Host: localhost:9000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; User-Agent: curl&#x2F;7.68.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Accept: &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; Mark bundle as not supporting multiuse&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; HTTP&#x2F;1.1 500 Internal Server Error&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; content-length: 43&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; date: Wed, 30 Sep 2020 02:26:09 GMT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; Connection&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;0 to host localhost left intact&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Storage error: PermissionDenied&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;post-sign-identifier-1&quot;&gt;&lt;code&gt;POST &#x2F;sign&#x2F;:identifier&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Success&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;# Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;v&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;d&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; @payload.json&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;H&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Content-Type: application&#x2F;json&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; localhost:9000&#x2F;sign&#x2F;b7354252aa5bce27ab9537fd0158515935f3c3861419e1b4b6c8219b5dbd15fcf907bddf275442f3e32f904f79807a2a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;# Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Note:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; Unnecessary&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; use&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; of&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; or&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;-request,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; already&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; inferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt;   Trying 127.0.0.1:9000...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; TCP_NODELAY set&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; Connected to localhost (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;127.0.0.1&lt;&#x2F;span&gt;&lt;span&gt;) port 9000 (&lt;&#x2F;span&gt;&lt;span&gt;#0)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &#x2F;sign&#x2F;b7354252aa5bce27ab9537fd0158515935f3c3861419e1b4b6c8219b5dbd15fcf907bddf275442f3e32f904f79807a2a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; HTTP&#x2F;1.1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Host: localhost:9000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; User-Agent: curl&#x2F;7.68.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Accept: &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Content-Type: application&#x2F;json&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Content-Length: 84&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; upload completely sent off: 84 out of 84 bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; Mark bundle as not supporting multiuse&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; HTTP&#x2F;1.1 200 OK&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; content-type: application&#x2F;json&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; content-length: 210&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; date: Wed, 30 Sep 2020 02:16:02 GMT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; Connection&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;0 to host localhost left intact&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0xb5d0c01cef3b028e2c5f357c2d4b886f8e374d09dd660cd7dd14680d4f956778808b4d3b2ab743e890fc1a77ae62c3c90d613561b23c6adaeb5b0e288832304fddc08c7415080be73e556e8862a1b4d0f6aa8084e34a901544d5bb6aeed3a612&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Bad Request Error&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;# Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;v&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;d&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;foobar&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;H&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Content-Type: application&#x2F;json&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; localhost:9000&#x2F;sign&#x2F;b7354252aa5bce27ab9537fd0158515935f3c3861419e1b4b6c8219b5dbd15fcf907bddf275442f3e32f904f79807a2a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;# Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Note:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; Unnecessary&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; use&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; of&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; or&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;-request,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; already&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; inferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt;   Trying 127.0.0.1:9000...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; TCP_NODELAY set&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; Connected to localhost (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;127.0.0.1&lt;&#x2F;span&gt;&lt;span&gt;) port 9000 (&lt;&#x2F;span&gt;&lt;span&gt;#0)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &#x2F;sign&#x2F;b7354252aa5bce27ab9537fd0158515935f3c3861419e1b4b6c8219b5dbd15fcf907bddf275442f3e32f904f79807a2a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; HTTP&#x2F;1.1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Host: localhost:9000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; User-Agent: curl&#x2F;7.68.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Accept: &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Content-Type: application&#x2F;json&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Content-Length: 23&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; upload completely sent off: 23 out of 23 bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; Mark bundle as not supporting multiuse&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; HTTP&#x2F;1.1 400 Bad Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; content-length: 38&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; date: Wed, 30 Sep 2020 02:15:05 GMT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; Connection&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;0 to host localhost left intact&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Unable to parse body message from JSON: Error(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;expected ident&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;, line: 1, column: 2)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; No Keys Available&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;# Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;v&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;d&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; @payload.json&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;H&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Content-Type: application&#x2F;json&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; localhost:9000&#x2F;sign&#x2F;000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;# Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Note:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; Unnecessary&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; use&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; of&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; or&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;-request,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; already&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; inferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt;   Trying 127.0.0.1:9000...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; TCP_NODELAY set&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; Connected to localhost (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;127.0.0.1&lt;&#x2F;span&gt;&lt;span&gt;) port 9000 (&lt;&#x2F;span&gt;&lt;span&gt;#0)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &#x2F;sign&#x2F;000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; HTTP&#x2F;1.1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Host: localhost:9000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; User-Agent: curl&#x2F;7.68.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Accept: &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Content-Type: application&#x2F;json&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Content-Length: 84&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; upload completely sent off: 84 out of 84 bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; Mark bundle as not supporting multiuse&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; HTTP&#x2F;1.1 404 Not Found&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; content-length: 123&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; date: Wed, 30 Sep 2020 02:18:53 GMT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; Connection&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;0 to host localhost left intact&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Key not found: 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Server Error&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;# Preparation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;# `chmod` both keys directory and file to the octal 311 (-wx--x--x).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;# `chmod` back to 755 to delete them afterwards.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;# Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;v&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;d&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; @payload.json&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;H&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Content-Type: application&#x2F;json&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; localhost:9000&#x2F;sign&#x2F;b7354252aa5bce27ab9537fd0158515935f3c3861419e1b4b6c8219b5dbd15fcf907bddf275442f3e32f904f79807a2a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;# Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Note:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; Unnecessary&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; use&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; of&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; or&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;-request,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; already&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; inferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt;   Trying 127.0.0.1:9000...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; TCP_NODELAY set&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; Connected to localhost (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;127.0.0.1&lt;&#x2F;span&gt;&lt;span&gt;) port 9000 (&lt;&#x2F;span&gt;&lt;span&gt;#0)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &#x2F;sign&#x2F;b7354252aa5bce27ab9537fd0158515935f3c3861419e1b4b6c8219b5dbd15fcf907bddf275442f3e32f904f79807a2a&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; HTTP&#x2F;1.1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Host: localhost:9000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; User-Agent: curl&#x2F;7.68.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Accept: &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Content-Type: application&#x2F;json&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Content-Length: 84&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; upload completely sent off: 84 out of 84 bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; Mark bundle as not supporting multiuse&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; HTTP&#x2F;1.1 500 Internal Server Error&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; content-length: 43&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; date: Wed, 30 Sep 2020 02:21:08 GMT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; Connection&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;0 to host localhost left intact&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Storage error: PermissionDenied&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Repository Url&lt;&#x2F;th&gt;&lt;th&gt;Language&lt;&#x2F;th&gt;&lt;th&gt;Organization&lt;&#x2F;th&gt;&lt;th&gt;Commentary&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;sigp&#x2F;rust-bls-remote-signer&quot;&gt;BLS Remote Signer&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Rust&lt;&#x2F;td&gt;&lt;td&gt;Sigma Prime&lt;&#x2F;td&gt;&lt;td&gt;Supports proposed specification.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;PegaSysEng&#x2F;web3signer&quot;&gt;Web3signer&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Java&lt;&#x2F;td&gt;&lt;td&gt;PegaSys&lt;&#x2F;td&gt;&lt;td&gt;Supports proposed specification, although with &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;pegasyseng.github.io&#x2F;web3signer&#x2F;web3signer-eth2.html&quot;&gt;slightly different methods&lt;&#x2F;a&gt;:&lt;br&gt;{&lt;code&gt;&#x2F;sign&lt;&#x2F;code&gt; =&amp;gt; &lt;code&gt;&#x2F;api&#x2F;v1&#x2F;eth2&#x2F;sign&lt;&#x2F;code&gt;, &lt;code&gt;&#x2F;publicKeys&lt;&#x2F;code&gt; =&amp;gt; &lt;code&gt;&#x2F;api&#x2F;v1&#x2F;eth2&#x2F;publicKeys&lt;&#x2F;code&gt;}.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;docs.prylabs.network&#x2F;docs&#x2F;wallet&#x2F;remote&#x2F;&quot;&gt;Remote Signing Wallet&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Golang&lt;&#x2F;td&gt;&lt;td&gt;Prysmatics Labs&lt;&#x2F;td&gt;&lt;td&gt;Supports both gRPC and JSON over HTTP.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;threat-model&quot;&gt;Threat model&lt;&#x2F;h3&gt;
&lt;p&gt;Let&#x27;s consider the following threats and their mitigations:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Threat&lt;&#x2F;th&gt;&lt;th&gt;Mitigation(s)&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;An attacker can spoof the validator client.&lt;&#x2F;td&gt;&lt;td&gt;See the discussion at &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3030&#x2F;#authentication&quot;&gt;Authentication&lt;&#x2F;a&gt;.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;An attacker can send a crafted message to the signer, leading to a slashing offense.&lt;&#x2F;td&gt;&lt;td&gt;It is the responsibility of the operator of the remote signer to add a validation module, as discussed at &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3030&#x2F;#implementation-of-additional-features&quot;&gt;Implementation of additional features&lt;&#x2F;a&gt;.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;An attacker can create, update, or delete secret keys.&lt;&#x2F;td&gt;&lt;td&gt;Keys are not to be writable via any interface of the remote signer.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;An attacker can repudiate a sent message.&lt;&#x2F;td&gt;&lt;td&gt;Implement logging in the signer. Enhance it by sending logs to a syslog box.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;An attacker can disclose the contents of a private key by retrieving the key from storage.&lt;&#x2F;td&gt;&lt;td&gt;Storage in Hardware security module (HSM).&lt;br&gt;&lt;em&gt;or&lt;&#x2F;em&gt;&lt;br&gt;Storage in Secrets management applications (e.g. Hashicorp Vault).&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;An attacker can eavesdrop on the uploading of a secret key.&lt;&#x2F;td&gt;&lt;td&gt;Upload the keys using a secure channel, based on each storage specification.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;An attacker can eavesdrop on the retrieval of a key from the remote signer.&lt;&#x2F;td&gt;&lt;td&gt;Always pass the data between storage and remote signer node using a secure channel.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;An attacker can dump the memory in the remote signer to disclose a secret key.&lt;&#x2F;td&gt;&lt;td&gt;Prevent physical access to the node running the remote signer.&lt;br&gt;&lt;em&gt;or&lt;&#x2F;em&gt;&lt;br&gt;Prevent access to the terminal of the node running the remote signer: Logs being sent to a syslog box. Deployments triggered by a simple, non-parameterized API.&lt;br&gt;&lt;em&gt;or&lt;&#x2F;em&gt;&lt;br&gt;Implement zeroization of the secret key at memory.&lt;br&gt;&lt;em&gt;or&lt;&#x2F;em&gt;&lt;br&gt;Explore the compilation and running of the remote signer in a Trusted execution environment (TEE).&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;An attacker can DoS the remote signer.&lt;&#x2F;td&gt;&lt;td&gt;Implement IP filtering.&lt;br&gt;&lt;em&gt;or&lt;&#x2F;em&gt;&lt;br&gt;Implement Rate limiting.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Transfer With Authorization</title>
        <published>2020-09-28T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Peter Jihoon Kim</name><uri>https://github.com/petejkim</uri>
	</author>
	
	<author>
		<name>Kevin Britz</name><uri>https://github.com/kbrizzle</uri>
	</author>
	
	<author>
		<name>David Knott</name><uri>https://github.com/DavidLKnott</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3009/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-3009-transfer-with-authorization/25698" />
        

        <id>https://wg-eips.ritovision.com/3009/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:3009"
            label="ERC-3009" />
        

        
        

        
        <summary type="html">Transfer fungible assets via a signed authorization</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3009/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;A set of functions to enable meta-transactions and atomic interactions with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; token contracts via signatures conforming to the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; typed message signing specification.&lt;&#x2F;p&gt;
&lt;p&gt;This enables the user to:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;delegate the gas payment to someone else,&lt;&#x2F;li&gt;
&lt;li&gt;pay gas in the token itself rather than in ETH,&lt;&#x2F;li&gt;
&lt;li&gt;perform one or more token transfers and other operations in a single atomic transaction,&lt;&#x2F;li&gt;
&lt;li&gt;transfer ERC-20 tokens to another address, and have the recipient submit the transaction,&lt;&#x2F;li&gt;
&lt;li&gt;batch multiple transactions with minimal overhead, and&lt;&#x2F;li&gt;
&lt;li&gt;create and perform multiple transactions without having to worry about them failing due to accidental nonce-reuse or improper ordering by the miner.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Please note that this ERC does not apply to smart contract accounts, as the &lt;code&gt;transfer&lt;&#x2F;code&gt; and &lt;code&gt;approve&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;transferFrom&lt;&#x2F;code&gt; functions from the ERC-20 standards can directly be used.&lt;&#x2F;p&gt;
&lt;!-- TODO (Editor&#x27;s note): we don&#x27;t permit links outside of the EIP&#x2F;ERC repositories, with some exceptions noted in EIP-1

This ERC has been live in production within the USDC smart contract since 2020, and serves as a critical component of the [x402](https:&#x2F;&#x2F;www.x402.org&#x2F;) standard.

--&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;There is an existing spec, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2612&#x2F;&quot;&gt;ERC-2612&lt;&#x2F;a&gt;, that also allows meta-transactions, and it is encouraged that a contract implements both for maximum compatibility. The two primary differences between this spec and ERC-2612 are that:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;ERC-2612 uses sequential nonces, but this uses random 32-byte nonces, and that&lt;&#x2F;li&gt;
&lt;li&gt;ERC-2612 relies on the ERC-20 &lt;code&gt;approve&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;transferFrom&lt;&#x2F;code&gt; (&quot;ERC-20 allowance&quot;) pattern.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The biggest issue with the use of sequential nonces is that it does not allow users to perform more than one transaction at a time without risking their transactions failing, because:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;DApps may unintentionally reuse nonces that have not yet been processed in the blockchain.&lt;&#x2F;li&gt;
&lt;li&gt;Miners may process the transactions in the incorrect order.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This can be especially problematic if the gas prices are very high and transactions often get queued up and remain unconfirmed for a long time. Non-sequential nonces allow users to create as many transactions as they want at the same time.&lt;&#x2F;p&gt;
&lt;p&gt;The ERC-20 allowance mechanism is susceptible to the &lt;!-- TODO (Editor&#x27;s note): same note as above.
[multiple withdrawal attack](https:&#x2F;&#x2F;blockchain-projects.readthedocs.io&#x2F;multiple_withdrawal.html) --&gt;&#x2F;&lt;!-- TODO (Editor&#x27;s note): you can copy the SWC into your assets directory because it&#x27;s MIT licensed. [SWC-114](https:&#x2F;&#x2F;swcregistry.io&#x2F;docs&#x2F;SWC-114) --&gt;, and encourages antipatterns such as the use of the &quot;infinite&quot; allowance. The wide prevalence of upgradeable contracts has made the conditions favorable for these attacks to happen in the wild.&lt;&#x2F;p&gt;
&lt;p&gt;The deficiencies of the ERC-20 allowance pattern brought about the development of alternative token standards such as the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;777&#x2F;&quot;&gt;ERC-777&lt;&#x2F;a&gt; and &lt;!-- TODO (Editor&#x27;s note): if you&#x27;d like to link to ERC-677, you&#x27;ll need to pull request it into the repository (i.e. upgrade it) [ERC-677](https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;677) --&gt;. However, they haven&#x27;t been able to gain much adoption due to compatibility and potential security issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;event&quot;&gt;Event&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AuthorizationUsed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; authorizer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; keccak256(&amp;quot;TransferWithAuthorization(address from,address to,uint256 value,uint256 validAfter,uint256 validBefore,bytes32 nonce)&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; TRANSFER_WITH_AUTHORIZATION_TYPEHASH &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x7c7c6cdb67a18743f49ec6fa9b35f50d52ed05cbed4cc592e13b44501c1a2267&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; keccak256(&amp;quot;ReceiveWithAuthorization(address from,address to,uint256 value,uint256 validAfter,uint256 validBefore,bytes32 nonce)&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; RECEIVE_WITH_AUTHORIZATION_TYPEHASH &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xd099cc98ef71107a616c4f0f941f04c322d8e254fe26b3c6668db87aae413de8&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the state of an authorization&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Nonces are randomly generated 32-byte data unique to the authorizer&amp;#39;s&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; authorizer&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    Authorizer&amp;#39;s address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         Nonce of the authorization&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; True&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if the nonce is used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; authorizationState&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; authorizer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Execute a transfer with a signed authorization&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;          Payer&amp;#39;s address (Authorizer)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;            Payee&amp;#39;s address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         Amount to be transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; validAfter&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    The time after which this is valid (unix time)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; validBefore&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   The time before which this is valid (unix time)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         Unique nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;             v of the signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;             r of the signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;             s of the signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferWithAuthorization&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; validAfter&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; validBefore&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; v&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; s&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Receive a transfer with a signed authorization from the payer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This has an additional check to ensure that the payee&amp;#39;s address matches&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * the caller of this function to prevent front-running attacks. (See security&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * considerations)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;          Payer&amp;#39;s address (Authorizer)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;            Payee&amp;#39;s address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         Amount to be transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; validAfter&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    The time after which this is valid (unix time)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; validBefore&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   The time before which this is valid (unix time)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         Unique nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;             v of the signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;             r of the signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;             s of the signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; receiveWithAuthorization&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; validAfter&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; validBefore&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; v&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; s&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Optional:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;event AuthorizationCanceled(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address indexed authorizer,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytes32 indexed nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; keccak256(&amp;quot;CancelAuthorization(address authorizer,bytes32 nonce)&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;bytes32 public constant CANCEL_AUTHORIZATION_TYPEHASH = 0x158b0a9edf7a828aad02f63cd515c68ef2f50ba807396f6d12842833a1597429;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @notice Attempt to cancel an authorization&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @param authorizer    Authorizer&amp;#39;s address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @param nonce         Nonce of the authorization&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @param v             v of the signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @param r             r of the signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @param s             s of the signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function cancelAuthorization(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address authorizer,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytes32 nonce,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    uint8 v,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytes32 r,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytes32 s&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;) external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The arguments &lt;code&gt;v&lt;&#x2F;code&gt;, &lt;code&gt;r&lt;&#x2F;code&gt;, and &lt;code&gt;s&lt;&#x2F;code&gt; must be obtained using the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; typed message signing spec.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Example:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;DomainSeparator := Keccak256(ABIEncode(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Keccak256(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Keccak256(&amp;quot;USD Coin&amp;quot;),                      &#x2F;&#x2F; name&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Keccak256(&amp;quot;2&amp;quot;),                             &#x2F;&#x2F; version&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  1,                                          &#x2F;&#x2F; chainId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48  &#x2F;&#x2F; verifyingContract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;With the domain separator, the typehash, which is used to identify the type of the EIP-712 message being used, and the values of the parameters, you are able to derive a Keccak-256 hash digest which can then be signed using the token holder&#x27;s private key.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Example:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; Transfer With Authorization&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;TypeHash := Keccak256(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &amp;quot;TransferWithAuthorization(address from,address to,uint256 value,uint256 validAfter,uint256 validBefore,bytes32 nonce)&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Params := { From, To, Value, ValidAfter, ValidBefore, Nonce }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; ReceiveWithAuthorization&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;TypeHash := Keccak256(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &amp;quot;ReceiveWithAuthorization(address from,address to,uint256 value,uint256 validAfter,uint256 validBefore,bytes32 nonce)&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Params := { From, To, Value, ValidAfter, ValidBefore, Nonce }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; CancelAuthorization&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;TypeHash := Keccak256(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &amp;quot;CancelAuthorization(address authorizer,bytes32 nonce)&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Params := { Authorizer, Nonce }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; &amp;quot;‖&amp;quot; denotes concatenation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Digest := Keccak256(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  0x1901 ‖ DomainSeparator ‖ Keccak256(ABIEncode(TypeHash, Params...))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{ v, r, s } := Sign(Digest, PrivateKey)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Smart contract functions that wrap &lt;code&gt;receiveWithAuthorization&lt;&#x2F;code&gt; call may choose to reduce the number of arguments by accepting the full ABI-encoded set of arguments for the &lt;code&gt;receiveWithAuthorization&lt;&#x2F;code&gt; call as a single argument of the type &lt;code&gt;bytes&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Example:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; keccak256(&amp;quot;receiveWithAuthorization(address,address,uint256,uint256,uint256,bytes32,uint8,bytes32,bytes32)&amp;quot;)[0:4]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; _RECEIVE_WITH_AUTHORIZATION_SELECTOR &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xef55bec6&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; deposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; receiveAuthorization&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    nonReentrant&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;decode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        receiveAuthorization&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;96&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;to &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Recipient is not this contract&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt; success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; )&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; token&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            _RECEIVE_WITH_AUTHORIZATION_SELECTOR&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            receiveAuthorization&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Failed to transfer tokens&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    .&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;use-with-web3-providers&quot;&gt;Use with web3 providers&lt;&#x2F;h3&gt;
&lt;p&gt;The signature for an authorization can be obtained using a web3 provider with the &lt;code&gt;eth_signTypedData{_v4}&lt;&#x2F;code&gt; method.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Example:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  types&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    EIP712Domain&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;verifyingContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    TransferWithAuthorization&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;from&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;validAfter&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;validBefore&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  domain&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenName&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    version&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenVersion&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    chainId&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; selectedChainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    verifyingContract&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  primaryType&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;TransferWithAuthorization&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  message&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    from&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; userAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    to&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; recipientAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amountBN&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;toString&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    validAfter&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    validBefore&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Math&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;floor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Date&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;now&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3600&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Valid for an hour&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Web3&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;utils&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;randomHex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ethereum&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;request&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  method&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_signTypedData_v4&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  params&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;userAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; JSON&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;stringify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;slice&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;130&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 132&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;slice&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 66&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;slice&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;66&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 130&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;unique-random-nonce-instead-of-sequential-nonce&quot;&gt;Unique Random Nonce, Instead of Sequential Nonce&lt;&#x2F;h3&gt;
&lt;p&gt;One might say transaction ordering is one reason why sequential nonces are preferred. However, sequential nonces do not actually help achieve transaction ordering for meta transactions in practice:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;For native Ethereum transactions, when a transaction with a nonce value that is too-high is submitted to the network, it will stay pending until the transactions consuming the lower unused nonces are confirmed.&lt;&#x2F;li&gt;
&lt;li&gt;However, for meta-transactions, when a transaction containing a sequential nonce value that is too high is submitted, instead of staying pending, it will revert and fail immediately, resulting in wasted gas.&lt;&#x2F;li&gt;
&lt;li&gt;The fact that miners can also reorder transactions and include them in the block in the order they want (assuming each transaction was submitted to the network by different meta-transaction relayers) also makes it possible for the meta-transactions to fail even if the nonces used were correct. (e.g. User submits nonces 3, 4 and 5, but miner ends up including them in the block as 4,5,3, resulting in only 3 succeeding)&lt;&#x2F;li&gt;
&lt;li&gt;Lastly, when using different applications simultaneously, in the absence of some sort of an off-chain nonce tracker, it is not possible to determine what the correct next nonce value is if there exists nonces that are used but haven&#x27;t been submitted and confirmed by the network.&lt;&#x2F;li&gt;
&lt;li&gt;Under high gas price conditions, transactions can often &quot;get stuck&quot; in the pool for a long time. Under such a situation, it is much more likely for the same nonce to be unintentionally reused twice. For example, if you make a meta-transaction that uses a sequential nonce from one app, and switch to another app to make another meta-transaction before the previous one confirms, the same nonce will be used if the app relies purely on the data available on-chain, resulting in one of the transactions failing.&lt;&#x2F;li&gt;
&lt;li&gt;In conclusion, the only way to guarantee transaction ordering is for relayers to submit transactions one at a time, waiting for confirmation between each submission (and the order in which they should be submitted can be part of some off-chain metadata), rendering sequential nonce irrelevant.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;valid-after-and-valid-before&quot;&gt;Valid After and Valid Before&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Relying on relayers to submit transactions for you means you may not have exact control over the timing of transaction submission.&lt;&#x2F;li&gt;
&lt;li&gt;These parameters allow the user to schedule a transaction to be only valid in the future or before a specific deadline, protecting the user from potential undesirable effects that may be caused by the submission being made either too late or too early.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;eip-712&quot;&gt;EIP-712&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;EIP-712 ensures that the signatures generated are valid only for this specific instance of the token contract and cannot be replayed on a different network with a different chain ID.&lt;&#x2F;li&gt;
&lt;li&gt;This is achieved by incorporating the contract address and the chain ID in a Keccak-256 hash digest called the domain separator. The actual set of parameters used to derive the domain separator is up to the implementing contract, but it is highly recommended that the fields &lt;code&gt;verifyingContract&lt;&#x2F;code&gt; and &lt;code&gt;chainId&lt;&#x2F;code&gt; are included.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;New contracts benefit from being able to directly utilize &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3009&#x2F;&quot;&gt;ERC-3009&lt;&#x2F;a&gt; in order to create atomic transactions, but existing contracts may still rely on the conventional ERC-20 allowance pattern (&lt;code&gt;approve&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;transferFrom&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;In order to add support for ERC-3009 to existing contracts (&quot;parent contract&quot;) that use the ERC-20 allowance pattern, a forwarding contract (&quot;forwarder&quot;) can be constructed that takes an authorization and does the following:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Extract the user and deposit amount from the authorization&lt;&#x2F;li&gt;
&lt;li&gt;Call &lt;code&gt;receiveWithAuthorization&lt;&#x2F;code&gt; to transfer specified funds from the user to the forwarder&lt;&#x2F;li&gt;
&lt;li&gt;Approve the parent contract to spend funds from the forwarder&lt;&#x2F;li&gt;
&lt;li&gt;Call the method on the parent contract that spends the allowance set from the forwarder&lt;&#x2F;li&gt;
&lt;li&gt;Transfer the ownership of any resulting tokens back to the user&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;strong&gt;Example:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IDeFiToken&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; deposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DepositForwarder&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; _RECEIVE_WITH_AUTHORIZATION_SELECTOR &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xef55bec6&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    IDeFiToken &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;private&lt;&#x2F;span&gt;&lt;span&gt; _parent&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    IERC20 &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;private&lt;&#x2F;span&gt;&lt;span&gt; _token&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;IDeFiToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; IERC20&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _parent &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _token &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; token&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; deposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; receiveAuthorization&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        nonReentrant&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;decode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            receiveAuthorization&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;96&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;to &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Recipient is not this contract&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt; success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; )&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                _RECEIVE_WITH_AUTHORIZATION_SELECTOR&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                receiveAuthorization&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Failed to transfer to the forwarder&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            _token&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_parent&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;Failed to set the allowance&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; tokensMinted &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;deposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            _parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokensMinted&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;Failed to transfer the minted tokens&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; remainder &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _token&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;remainder &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                _token&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; remainder&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;                &amp;quot;Failed to refund the remainder&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; tokensMinted&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;!-- TODO (Editor&#x27;s note): please move your test cases into your assets directory (assuming they&#x27;re under a permissive license)
## Test Cases

See [EIP3009.test.ts](https:&#x2F;&#x2F;github.com&#x2F;CoinbaseStablecoin&#x2F;eip-3009&#x2F;blob&#x2F;master&#x2F;test&#x2F;EIP3009.test.ts).
--&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;eip3009-sol&quot;&gt;&lt;code&gt;EIP3009.sol&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;abstract&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EIP3009&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC20Transfer&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;EIP712Domain&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; keccak256(&amp;quot;TransferWithAuthorization(address from,address to,uint256 value,uint256 validAfter,uint256 validBefore,bytes32 nonce)&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; TRANSFER_WITH_AUTHORIZATION_TYPEHASH &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x7c7c6cdb67a18743f49ec6fa9b35f50d52ed05cbed4cc592e13b44501c1a2267&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; keccak256(&amp;quot;ReceiveWithAuthorization(address from,address to,uint256 value,uint256 validAfter,uint256 validBefore,bytes32 nonce)&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; RECEIVE_WITH_AUTHORIZATION_TYPEHASH &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xd099cc98ef71107a616c4f0f941f04c322d8e254fe26b3c6668db87aae413de8&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; _authorizationStates&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AuthorizationUsed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; authorizer&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; _INVALID_SIGNATURE_ERROR &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;EIP3009: invalid signature&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; authorizationState&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; authorizer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _authorizationStates&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;authorizer&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;nonce&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferWithAuthorization&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; validAfter&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; validBefore&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; v&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; s&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;now&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; validAfter&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;EIP3009: authorization is not yet valid&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;now&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; validBefore&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;EIP3009: authorization is expired&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            !&lt;&#x2F;span&gt;&lt;span&gt;_authorizationStates&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;nonce&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;EIP3009: authorization is used&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; data &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            TRANSFER_WITH_AUTHORIZATION_TYPEHASH&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            validAfter&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            validBefore&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            EIP712&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;recover&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;DOMAIN_SEPARATOR&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; s&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;EIP3009: invalid signature&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _authorizationStates&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;nonce&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AuthorizationUsed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;ierc20transfer-sol&quot;&gt;&lt;code&gt;IERC20Transfer.sol&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;abstract&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC20Transfer&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;eip712domain-sol&quot;&gt;&lt;code&gt;EIP712Domain.sol&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;abstract&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EIP712Domain&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; DOMAIN_SEPARATOR&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;eip712-sol&quot;&gt;&lt;code&gt;EIP712.sol&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;library&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EIP712&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; keccak256(&amp;quot;EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; EIP712_DOMAIN_TYPEHASH &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; makeDomainSeparator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; version&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        internal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; chainId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            chainId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; chainid&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;                abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    EIP712_DOMAIN_TYPEHASH&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;name&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;version&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    chainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; recover&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; domainSeparator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; v&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; s&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; typeHashAndData&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; digest &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;                &amp;quot;\x19\x01&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                domainSeparator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;typeHashAndData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; recovered &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; ecrecover&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;digest&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; s&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;recovered &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;EIP712: invalid signature&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; recovered&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;A fully working implementation of ERC-3009 can be found in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3009&#x2F;.&#x2F;assets&#x2F;ERC3009.sol&quot;&gt;this repository&lt;&#x2F;a&gt;. The repository also includes &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3009&#x2F;.&#x2F;assets&#x2F;ERC2612.sol&quot;&gt;an implementation of ERC-2612&lt;&#x2F;a&gt; that uses the EIP-712 library code presented above.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Use &lt;code&gt;receiveWithAuthorization&lt;&#x2F;code&gt; instead of &lt;code&gt;transferWithAuthorization&lt;&#x2F;code&gt; when calling from other smart contracts. It is possible for an attacker watching the transaction pool to extract the transfer authorization and front-run the &lt;code&gt;transferWithAuthorization&lt;&#x2F;code&gt; call to execute the transfer without invoking the wrapper function. This could potentially result in unprocessed, locked up deposits. &lt;code&gt;receiveWithAuthorization&lt;&#x2F;code&gt; prevents this by performing an additional check that ensures that the caller is the payee. Additionally, if there are multiple contract functions accepting receive authorizations, the app developer could dedicate some leading bytes of the nonce as an identifier to prevent cross-use.&lt;&#x2F;p&gt;
&lt;p&gt;When submitting multiple transfers simultaneously, be mindful of the fact that relayers and miners will decide the order in which they are processed. This is generally not a problem if the transactions are not dependent on each other, but for transactions that are highly dependent on each other, it is recommended that the signed authorizations are submitted one at a time.&lt;&#x2F;p&gt;
&lt;p&gt;The zero address must be rejected when &lt;code&gt;ecrecover&lt;&#x2F;code&gt; is used to prevent unauthorized transfers and approvals of funds from the zero address. The built-in &lt;code&gt;ecrecover&lt;&#x2F;code&gt; returns the zero address when a malformed signature is provided.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Transfer With Authorization</title>
        <published>2020-09-28T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Peter Jihoon Kim</name><uri>https://github.com/petejkim</uri>
	</author>
	
	<author>
		<name>Kevin Britz</name><uri>https://github.com/kbrizzle</uri>
	</author>
	
	<author>
		<name>David Knott</name><uri>https://github.com/DavidLKnott</uri>
	</author>
	
	<author>
		<name>Dongri Jin</name><uri>https://github.com/dongri</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7758/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-7758-transfer-with-authorization/20859" />
        

        <id>https://wg-eips.ritovision.com/7758/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        

        
        <category
            term="tag:eip:7758"
            label="ERC-7758" />
        

        
        

        
        <summary type="html">Transfer fungible assets via a signed authorization.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7758/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;A set of functions to enable meta-transactions and atomic interactions with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; token contracts via signatures conforming to the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; typed message signing specification.&lt;&#x2F;p&gt;
&lt;p&gt;This enables the user to:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;delegate the gas payment to someone else,&lt;&#x2F;li&gt;
&lt;li&gt;pay for gas in the token itself rather than in ETH,&lt;&#x2F;li&gt;
&lt;li&gt;perform one or more token transfers and other operations in a single atomic transaction,&lt;&#x2F;li&gt;
&lt;li&gt;transfer ERC-20 tokens to another address, and have the recipient submit the transaction,&lt;&#x2F;li&gt;
&lt;li&gt;batch multiple transactions with minimal overhead, and&lt;&#x2F;li&gt;
&lt;li&gt;create and perform multiple transactions without having to worry about them failing due to accidental nonce-reuse or improper ordering by the miner.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;There is an existing spec, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2612&#x2F;&quot;&gt;EIP-2612&lt;&#x2F;a&gt;, that also allows meta-transactions, and it is encouraged that a contract implements both for maximum compatibility. The two primary differences between this spec and EIP-2612 are that:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;EIP-2612 uses sequential nonces, but this uses random 32-byte nonces, and that&lt;&#x2F;li&gt;
&lt;li&gt;EIP-2612 relies on the ERC-20 &lt;code&gt;approve&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;transferFrom&lt;&#x2F;code&gt; (&quot;ERC-20 allowance&quot;) pattern.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The biggest issue with the use of sequential nonces is that it does not allow users to perform more than one transaction at time without risking their transactions failing, because:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;DApps may unintentionally reuse nonces that have not yet been processed in the blockchain.&lt;&#x2F;li&gt;
&lt;li&gt;Miners may process the transactions in the incorrect order.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This can be especially problematic if the gas prices are very high and transactions often get queued up and remain unconfirmed for a long time. Non-sequential nonces allow users to create as many transactions as they want at the same time.&lt;&#x2F;p&gt;
&lt;p&gt;The ERC-20 allowance mechanism is susceptible to the multiple withdrawal attack, and encourages antipatterns such as the use of the &quot;infinite&quot; allowance. The wide-prevalence of upgradeable contracts have made the conditions favorable for these attacks to happen in the wild.&lt;&#x2F;p&gt;
&lt;p&gt;The deficiencies of the ERC-20 allowance pattern brought about the development of alternative token standards such as the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;777&#x2F;&quot;&gt;ERC-777&lt;&#x2F;a&gt;. However, they haven&#x27;t been able to gain much adoption due to compatibility and potential security issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;event&quot;&gt;Event&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AuthorizationUsed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; authorizer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; keccak256(&amp;quot;TransferWithAuthorization(address from,address to,uint256 value,uint256 validAfter,uint256 validBefore,bytes32 nonce)&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; TRANSFER_WITH_AUTHORIZATION_TYPEHASH &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x7c7c6cdb67a18743f49ec6fa9b35f50d52ed05cbed4cc592e13b44501c1a2267&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; keccak256(&amp;quot;ReceiveWithAuthorization(address from,address to,uint256 value,uint256 validAfter,uint256 validBefore,bytes32 nonce)&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; RECEIVE_WITH_AUTHORIZATION_TYPEHASH &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xd099cc98ef71107a616c4f0f941f04c322d8e254fe26b3c6668db87aae413de8&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the state of an authorization&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Nonces are randomly generated 32-byte data unique to the authorizer&amp;#39;s&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; authorizer&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    Authorizer&amp;#39;s address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         Nonce of the authorization&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; True&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if the nonce is used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; authorizationState&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; authorizer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Execute a transfer with a signed authorization&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;          Payer&amp;#39;s address (Authorizer)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;            Payee&amp;#39;s address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         Amount to be transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; validAfter&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    The time after which this is valid (unix time)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; validBefore&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   The time before which this is valid (unix time)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         Unique nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;             v of the signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;             r of the signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;             s of the signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferWithAuthorization&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; validAfter&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; validBefore&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; v&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; s&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Receive a transfer with a signed authorization from the payer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This has an additional check to ensure that the payee&amp;#39;s address matches&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * the caller of this function to prevent front-running attacks. (See security&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * considerations)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;          Payer&amp;#39;s address (Authorizer)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;            Payee&amp;#39;s address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         Amount to be transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; validAfter&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    The time after which this is valid (unix time)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; validBefore&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   The time before which this is valid (unix time)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         Unique nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;             v of the signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;             r of the signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;             s of the signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; receiveWithAuthorization&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; validAfter&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; validBefore&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; v&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; s&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Optional:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;event AuthorizationCanceled(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address indexed authorizer,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytes32 indexed nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; keccak256(&amp;quot;CancelAuthorization(address authorizer,bytes32 nonce)&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;bytes32 public constant CANCEL_AUTHORIZATION_TYPEHASH = 0x158b0a9edf7a828aad02f63cd515c68ef2f50ba807396f6d12842833a1597429;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @notice Attempt to cancel an authorization&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @param authorizer    Authorizer&amp;#39;s address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @param nonce         Nonce of the authorization&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @param v             v of the signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @param r             r of the signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @param s             s of the signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function cancelAuthorization(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address authorizer,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytes32 nonce,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    uint8 v,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytes32 r,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytes32 s&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;) external;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The arguments &lt;code&gt;v&lt;&#x2F;code&gt;, &lt;code&gt;r&lt;&#x2F;code&gt;, and &lt;code&gt;s&lt;&#x2F;code&gt; must be obtained using the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; typed message signing spec.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Example:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;DomainSeparator := Keccak256(ABIEncode(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Keccak256(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Keccak256(&amp;quot;USD Coin&amp;quot;),                      &#x2F;&#x2F; name&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Keccak256(&amp;quot;2&amp;quot;),                             &#x2F;&#x2F; version&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  1,                                          &#x2F;&#x2F; chainId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48  &#x2F;&#x2F; verifyingContract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;With the domain separator, the typehash, which is used to identify the type of the EIP-712 message being used, and the values of the parameters, you are able to derive a Keccak-256 hash digest which can then be signed using the token holder&#x27;s private key.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Example:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; Transfer With Authorization&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;TypeHash := Keccak256(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &amp;quot;TransferWithAuthorization(address from,address to,uint256 value,uint256 validAfter,uint256 validBefore,bytes32 nonce)&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Params := { From, To, Value, ValidAfter, ValidBefore, Nonce }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; ReceiveWithAuthorization&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;TypeHash := Keccak256(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &amp;quot;ReceiveWithAuthorization(address from,address to,uint256 value,uint256 validAfter,uint256 validBefore,bytes32 nonce)&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Params := { From, To, Value, ValidAfter, ValidBefore, Nonce }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; CancelAuthorization&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;TypeHash := Keccak256(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &amp;quot;CancelAuthorization(address authorizer,bytes32 nonce)&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Params := { Authorizer, Nonce }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; &amp;quot;‖&amp;quot; denotes concatenation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Digest := Keecak256(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  0x1901 ‖ DomainSeparator ‖ Keccak256(ABIEncode(TypeHash, Params...))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{ v, r, s } := Sign(Digest, PrivateKey)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Smart contract functions that wrap &lt;code&gt;receiveWithAuthorization&lt;&#x2F;code&gt; call may choose to reduce the number of arguments by accepting the full ABI-encoded set of arguments for the &lt;code&gt;receiveWithAuthorization&lt;&#x2F;code&gt; call as a single argument of the type &lt;code&gt;bytes&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Example:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; keccak256(&amp;quot;receiveWithAuthorization(address,address,uint256,uint256,uint256,bytes32,uint8,bytes32,bytes32)&amp;quot;)[0:4]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; _RECEIVE_WITH_AUTHORIZATION_SELECTOR &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xef55bec6&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; deposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; receiveAuthorization&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    nonReentrant&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;decode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        receiveAuthorization&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;96&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;to &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Recipient is not this contract&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt; success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; )&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; token&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            _RECEIVE_WITH_AUTHORIZATION_SELECTOR&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            receiveAuthorization&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Failed to transfer tokens&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    .&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;use-with-web3-providers&quot;&gt;Use with web3 providers&lt;&#x2F;h3&gt;
&lt;p&gt;The signature for an authorization can be obtained using a web3 provider with the &lt;code&gt;eth_signTypedData{_v4}&lt;&#x2F;code&gt; method.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Example:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  types&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    EIP712Domain&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;verifyingContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    TransferWithAuthorization&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;from&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;validAfter&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;validBefore&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  domain&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenName&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    version&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenVersion&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    chainId&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; selectedChainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    verifyingContract&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  primaryType&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;TransferWithAuthorization&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  message&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    from&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; userAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    to&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; recipientAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amountBN&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;toString&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    validAfter&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    validBefore&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Math&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;floor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Date&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;now&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3600&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Valid for an hour&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Web3&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;utils&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;randomHex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ethereum&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;request&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  method&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_signTypedData_v4&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  params&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;userAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; JSON&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;stringify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;slice&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;130&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 132&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;slice&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 66&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;slice&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;66&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 130&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;unique-random-nonce-instead-of-sequential-nonce&quot;&gt;Unique Random Nonce, Instead of Sequential Nonce&lt;&#x2F;h3&gt;
&lt;p&gt;One might say transaction ordering is one reason why sequential nonces are preferred. However, sequential nonces do not actually help achieve transaction ordering for meta transactions in practice:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;For native Ethereum transactions, when a transaction with a nonce value that is too-high is submitted to the network, it will stay pending until the transactions consuming the lower unused nonces are confirmed.&lt;&#x2F;li&gt;
&lt;li&gt;However, for meta-transactions, when a transaction containing a sequential nonce value that is too high is submitted, instead of staying pending, it will revert and fail immediately, resulting in wasted gas.&lt;&#x2F;li&gt;
&lt;li&gt;The fact that miners can also reorder transactions and include them in the block in the order they want (assuming each transaction was submitted to the network by different meta-transaction relayers) also makes it possible for the meta-transactions to fail even if the nonces used were correct. (e.g. User submits nonces 3, 4 and 5, but miner ends up including them in the block as 4,5,3, resulting in only 3 succeeding)&lt;&#x2F;li&gt;
&lt;li&gt;Lastly, when using different applications simultaneously, in absence of some sort of an off-chain nonce-tracker, it is not possible to determine what the correct next nonce value is if there exists nonces that are used but haven&#x27;t been submitted and confirmed by the network.&lt;&#x2F;li&gt;
&lt;li&gt;Under high gas price conditions, transactions can often &quot;get stuck&quot; in the pool for a long time. Under such a situation, it is much more likely for the same nonce to be unintentionally reused twice. For example, if you make a meta-transaction that uses a sequential nonce from one app, and switch to another app to make another meta-transaction before the previous one confirms, the same nonce will be used if the app relies purely on the data available on-chain, resulting in one of the transactions failing.&lt;&#x2F;li&gt;
&lt;li&gt;In conclusion, the only way to guarantee transaction ordering is for relayers to submit transactions one at a time, waiting for confirmation between each submission (and the order in which they should be submitted can be part of some off-chain metadata), rendering sequential nonce irrelevant.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;valid-after-and-valid-before&quot;&gt;Valid After and Valid Before&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Relying on relayers to submit transactions for you means you may not have exact control over the timing of transaction submission.&lt;&#x2F;li&gt;
&lt;li&gt;These parameters allow the user to schedule a transaction to be only valid in the future or before a specific deadline, protecting the user from potential undesirable effects that may be caused by the submission being made either too late or too early.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;eip-712&quot;&gt;EIP-712&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;EIP-712 ensures that the signatures generated are valid only for this specific instance of the token contract and cannot be replayed on a different network with a different chain ID.&lt;&#x2F;li&gt;
&lt;li&gt;This is achieved by incorporating the contract address and the chain ID in a Keccak-256 hash digest called the domain separator. The actual set of parameters used to derive the domain separator is up to the implementing contract, but it is highly recommended that the fields &lt;code&gt;verifyingContract&lt;&#x2F;code&gt; and &lt;code&gt;chainId&lt;&#x2F;code&gt; are included.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;New contracts benefit from being able to directly utilize this proposal in order to create atomic transactions, but existing contracts may still rely on the conventional &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; allowance pattern (&lt;code&gt;approve&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;transferFrom&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;In order to add support for this proposal to existing contracts (&quot;parent contract&quot;) that use the ERC-20 allowance pattern, a forwarding contract (&quot;forwarder&quot;) can be constructed that takes an authorization and does the following:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Extract the user and deposit amount from the authorization&lt;&#x2F;li&gt;
&lt;li&gt;Call &lt;code&gt;receiveWithAuthorization&lt;&#x2F;code&gt; to transfer specified funds from the user to the forwarder&lt;&#x2F;li&gt;
&lt;li&gt;Approve the parent contract to spend funds from the forwarder&lt;&#x2F;li&gt;
&lt;li&gt;Call the method on the parent contract that spends the allowance set from the forwarder&lt;&#x2F;li&gt;
&lt;li&gt;Transfer the ownership of any resulting tokens back to the user&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;strong&gt;Example:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IDeFiToken&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; deposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DepositForwarder&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; _RECEIVE_WITH_AUTHORIZATION_SELECTOR &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xef55bec6&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    IDeFiToken &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;private&lt;&#x2F;span&gt;&lt;span&gt; _parent&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    IERC20 &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;private&lt;&#x2F;span&gt;&lt;span&gt; _token&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;IDeFiToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; IERC20&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _parent &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _token &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; token&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; deposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; receiveAuthorization&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        nonReentrant&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;decode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            receiveAuthorization&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;96&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;to &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Recipient is not this contract&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt; success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; )&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                _RECEIVE_WITH_AUTHORIZATION_SELECTOR&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                receiveAuthorization&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Failed to transfer to the forwarder&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            _token&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_parent&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;Failed to set the allowance&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; tokensMinted &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;deposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            _parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokensMinted&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;Failed to transfer the minted tokens&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; remainder &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _token&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;remainder &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                _token&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; remainder&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;                &amp;quot;Failed to refund the remainder&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; tokensMinted&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;eip7758-sol&quot;&gt;&lt;code&gt;EIP7758.sol&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;abstract&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EIP7758&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC20Transfer&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;EIP712Domain&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; keccak256(&amp;quot;TransferWithAuthorization(address from,address to,uint256 value,uint256 validAfter,uint256 validBefore,bytes32 nonce)&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; TRANSFER_WITH_AUTHORIZATION_TYPEHASH &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x7c7c6cdb67a18743f49ec6fa9b35f50d52ed05cbed4cc592e13b44501c1a2267&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; keccak256(&amp;quot;ReceiveWithAuthorization(address from,address to,uint256 value,uint256 validAfter,uint256 validBefore,bytes32 nonce)&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; RECEIVE_WITH_AUTHORIZATION_TYPEHASH &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xd099cc98ef71107a616c4f0f941f04c322d8e254fe26b3c6668db87aae413de8&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; _authorizationStates&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AuthorizationUsed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; authorizer&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; _INVALID_SIGNATURE_ERROR &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;EIP7758: invalid signature&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; authorizationState&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; authorizer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _authorizationStates&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;authorizer&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;nonce&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferWithAuthorization&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; validAfter&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; validBefore&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; v&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; s&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;now&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; validAfter&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;EIP7758: authorization is not yet valid&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;now&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; validBefore&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;EIP7758: authorization is expired&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            !&lt;&#x2F;span&gt;&lt;span&gt;_authorizationStates&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;nonce&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;EIP7758: authorization is used&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; data &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            TRANSFER_WITH_AUTHORIZATION_TYPEHASH&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            validAfter&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            validBefore&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            EIP712&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;recover&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;DOMAIN_SEPARATOR&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; s&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;EIP7758: invalid signature&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _authorizationStates&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;nonce&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AuthorizationUsed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;ierc20transfer-sol&quot;&gt;&lt;code&gt;IERC20Transfer.sol&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;abstract&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC20Transfer&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;eip712domain-sol&quot;&gt;&lt;code&gt;EIP712Domain.sol&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;abstract&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EIP712Domain&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; DOMAIN_SEPARATOR&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;eip712-sol&quot;&gt;&lt;code&gt;EIP712.sol&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;library&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EIP712&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; keccak256(&amp;quot;EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; EIP712_DOMAIN_TYPEHASH &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; makeDomainSeparator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; version&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        internal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; chainId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            chainId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; chainid&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;                abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    EIP712_DOMAIN_TYPEHASH&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;name&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;version&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;chainId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; recover&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; domainSeparator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; v&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; s&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; typeHashAndData&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; digest &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;                &amp;quot;\x19\x01&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                domainSeparator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;typeHashAndData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; recovered &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; ecrecover&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;digest&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; s&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;recovered &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;EIP712: invalid signature&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; recovered&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Use &lt;code&gt;receiveWithAuthorization&lt;&#x2F;code&gt; instead of &lt;code&gt;transferWithAuthorization&lt;&#x2F;code&gt; when calling from other smart contracts. It is possible for an attacker watching the transaction pool to extract the transfer authorization and front-run the &lt;code&gt;transferWithAuthorization&lt;&#x2F;code&gt; call to execute the transfer without invoking the wrapper function. This could potentially result in unprocessed, locked up deposits. &lt;code&gt;receiveWithAuthorization&lt;&#x2F;code&gt; prevents this by performing an additional check that ensures that the caller is the payee. Additionally, if there are multiple contract functions accepting receive authorizations, the app developer could dedicate some leading bytes of the nonce could as the identifier to prevent cross-use.&lt;&#x2F;p&gt;
&lt;p&gt;When submitting multiple transfers simultaneously, be mindful of the fact that relayers and miners will decide the order in which they are processed. This is generally not a problem if the transactions are not dependent on each other, but for transactions that are highly dependent on each other, it is recommended that the signed authorizations are submitted one at a time.&lt;&#x2F;p&gt;
&lt;p&gt;The zero address must be rejected when using &lt;code&gt;ecrecover&lt;&#x2F;code&gt; to prevent unauthorized transfers and approvals of funds from the zero address. The built-in &lt;code&gt;ecrecover&lt;&#x2F;code&gt; returns the zero address when a malformed signature is provided.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Batched meta transactions</title>
        <published>2020-09-25T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Matt</name><uri>https://github.com/defifuture</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3005/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3005-the-economic-viability-of-batched-meta-transactions/4673" />
        

        <id>https://wg-eips.ritovision.com/3005/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:3005"
            label="ERC-3005" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3005/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Defines an extension function for ERC-20 (and other fungible token standards), which allows receiving and processing a batch of meta transactions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP defines a new function called &lt;code&gt;processMetaBatch()&lt;&#x2F;code&gt; that extends any fungible token standard, and enables batched meta transactions coming from many senders in one on-chain transaction.&lt;&#x2F;p&gt;
&lt;p&gt;The function must be able to receive multiple meta transactions data and process it. This means validating the data and the signature, before proceeding with token transfers based on the data.&lt;&#x2F;p&gt;
&lt;p&gt;The function enables senders to make gasless transactions, while reducing the relayer&#x27;s gas cost due to batching.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Meta transactions have proven useful as a solution for Ethereum accounts that don&#x27;t have any ether, but hold ERC-20 tokens and would like to transfer them (gasless transactions).&lt;&#x2F;p&gt;
&lt;p&gt;The current meta transaction relayer implementations only allow relaying one meta transaction at a time. Some also allow batched meta transactions from the same sender. But none offers batched meta transactions from &lt;strong&gt;multiple&lt;&#x2F;strong&gt; senders.&lt;&#x2F;p&gt;
&lt;p&gt;The motivation behind this EIP is to find a way to allow relaying batched meta transactions from &lt;strong&gt;many senders&lt;&#x2F;strong&gt; in &lt;strong&gt;one on-chain transaction&lt;&#x2F;strong&gt;, which also &lt;strong&gt;reduces the total gas cost&lt;&#x2F;strong&gt; that a relayer needs to cover.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3005&#x2F;.&#x2F;assets&#x2F;meta-txs-directly-to-token-smart-contract.png&quot; alt=&quot;&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;,  &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;The key words &quot;MUST (BUT WE KNOW YOU WON&#x27;T)&quot;, &quot;SHOULD CONSIDER&quot;, &quot;REALLY SHOULD NOT&quot;, &quot;OUGHT TO&quot;, &quot;WOULD PROBABLY&quot;, &quot;MAY WISH TO&quot;, &quot;COULD&quot;, &quot;POSSIBLE&quot;, and &quot;MIGHT&quot; in this document are to be interpreted as described in RFC 6919.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;meta-transaction-data&quot;&gt;Meta transaction data&lt;&#x2F;h3&gt;
&lt;p&gt;In order to successfully validate and transfer tokens, the &lt;code&gt;processMetaBatch()&lt;&#x2F;code&gt; function MUST process the following data about a meta transaction:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;sender address&lt;&#x2F;li&gt;
&lt;li&gt;receiver address&lt;&#x2F;li&gt;
&lt;li&gt;token amount&lt;&#x2F;li&gt;
&lt;li&gt;relayer fee&lt;&#x2F;li&gt;
&lt;li&gt;a (meta tx) nonce&lt;&#x2F;li&gt;
&lt;li&gt;an expiration date (this COULD be a block number, or it COULD be a block timestamp)&lt;&#x2F;li&gt;
&lt;li&gt;a token address&lt;&#x2F;li&gt;
&lt;li&gt;a relayer address&lt;&#x2F;li&gt;
&lt;li&gt;a signature&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Not all of the data needs to be sent to the function by the relayer (see the function interface specification). Some of the data can be deduced or extracted from other sources (from transaction data and contract state).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;processmetabatch-function-input-data&quot;&gt;&lt;code&gt;processMetaBatch()&lt;&#x2F;code&gt; function input data&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;processMetaBatch()&lt;&#x2F;code&gt; function MUST receive the following data:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;sender address&lt;&#x2F;li&gt;
&lt;li&gt;receiver address&lt;&#x2F;li&gt;
&lt;li&gt;token amount&lt;&#x2F;li&gt;
&lt;li&gt;relayer fee&lt;&#x2F;li&gt;
&lt;li&gt;an expiration date (this COULD be a block number, or it COULD be a block timestamp)&lt;&#x2F;li&gt;
&lt;li&gt;a signature&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The following data is OPTIONAL to be sent to the function, because it can be extracted or derived from other sources:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;a (meta tx) nonce&lt;&#x2F;li&gt;
&lt;li&gt;a token address&lt;&#x2F;li&gt;
&lt;li&gt;a relayer address&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;meta-transaction-data-hash&quot;&gt;Meta transaction data hash&lt;&#x2F;h3&gt;
&lt;p&gt;The pseudocode for creating a hash of meta transaction data is the following:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;keccak256(address(sender)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	   ++ address(recipient)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	   ++ uint256(amount)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	   ++ uint256(relayerFee)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	   ++ uint256(nonce)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	   ++ uint256(expirationDate)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	   ++ address(tokenContract)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	   ++ address(relayer)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The created hash MUST then be signed with the sender&#x27;s private key.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;validation-rules&quot;&gt;Validation rules&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Nonce of a new transaction MUST always be bigger by exactly 1 from the nonce of the last successfully processed meta transaction of the same sender to the same token contract.&lt;&#x2F;li&gt;
&lt;li&gt;Sending to and from a 0x0 address MUST be prohibited.&lt;&#x2F;li&gt;
&lt;li&gt;A meta transaction MUST be processed before the expiration date.&lt;&#x2F;li&gt;
&lt;li&gt;Each sender&#x27;s token balance MUST be equal or greater than the sum of their respective meta transaction token amount and relayer fee.&lt;&#x2F;li&gt;
&lt;li&gt;A transaction where at least one meta transaction in the batch does not satisfy the above requirements MUST not be reverted. Instead, a failed meta transaction MUST be skipped or ignored.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;processmetabatch-function-interface&quot;&gt;&lt;code&gt;processMetaBatch()&lt;&#x2F;code&gt; function interface&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;processMetaBatch()&lt;&#x2F;code&gt; function MUST have the following interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; processMetaBatch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; senders&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                          address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recipients&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                          uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amounts&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                          uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; relayerFees&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                          uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; blocks&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                          uint8&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sigV&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                          bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sigR&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                          bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sigS&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The overview of parameters that are passed:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;senders&lt;&#x2F;code&gt;: an array of meta transaction sender addresses (token senders)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;recipients &lt;&#x2F;code&gt;: an array of token recipients addresses&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;amounts&lt;&#x2F;code&gt;: an array of token amounts that are sent from each sender to each recipient, respectively&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;relayerFees&lt;&#x2F;code&gt;: an array of the relayer fees paid in tokens by senders. The fee receiver is a relayer (&lt;code&gt;msg.address&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;blocks&lt;&#x2F;code&gt;: an array of block numbers that represent an expiration date by which the meta transaction must be processed (alternatively, a timestamp could be used instead of a block number)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;sigV&lt;&#x2F;code&gt;, &lt;code&gt;sigR&lt;&#x2F;code&gt;, &lt;code&gt;sigS&lt;&#x2F;code&gt;: three arrays that represent parts of meta transaction signatures&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Each entry in each of the arrays MUST represent data from one meta transaction. The order of the data is very important. Data from a single meta transaction MUST have the same index in every array.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;meta-transaction-nonce&quot;&gt;Meta transaction nonce&lt;&#x2F;h3&gt;
&lt;p&gt;The token smart contract must keep track of a meta transaction nonce for each token holder.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;mapping&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _metaNonces&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The interface for the &lt;code&gt;nonceOf()&lt;&#x2F;code&gt; function is the following:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; nonceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;token-transfers&quot;&gt;Token transfers&lt;&#x2F;h3&gt;
&lt;p&gt;After a meta transaction is successfully validated, the meta nonce of the meta transaction sender MUST be increased by 1.&lt;&#x2F;p&gt;
&lt;p&gt;Then two token transfers MUST occur:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The specified token amount MUST go to the recipient.&lt;&#x2F;li&gt;
&lt;li&gt;The relayer fee MUST go to the relayer (&lt;code&gt;msg.sender&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;strong&gt;reference implementation&lt;&#x2F;strong&gt; adds a couple of functions to the existing ERC-20 token standard:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;processMetaBatch()&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;nonceOf()&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;You can see the implementation of both functions in this file: &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;defifuture&#x2F;erc20-batched-meta-transactions&#x2F;blob&#x2F;master&#x2F;contracts&#x2F;ERC20MetaBatch.sol&quot;&gt;ERC20MetaBatch.sol&lt;&#x2F;a&gt;. This is an extended ERC-20 contract with added meta transaction batch transfer capabilities.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;processmetabatch&quot;&gt;&lt;code&gt;processMetaBatch()&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;processMetaBatch()&lt;&#x2F;code&gt; function is responsible for receiving and processing a batch of meta transactions that change token balances.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; processMetaBatch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; senders&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                          address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recipients&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                          uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amounts&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                          uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; relayerFees&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                          uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; blocks&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                          uint8&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sigV&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                          bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sigR&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                          bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sigS&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; newNonce&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; relayerFeesSum &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; msgHash&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; loop through all meta txs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; senders&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        sender &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; senders&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        newNonce &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _metaNonces&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sender &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span&gt; recipients&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            continue&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; sender or recipient is 0x0 address, skip this meta tx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the meta tx should be processed until (including) the specified block number, otherwise it is invalid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; blocks&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            continue&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if current block number is bigger than the requested number, skip this meta tx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; check if meta tx sender&amp;#39;s balance is big enough&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;amounts&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; relayerFees&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            continue&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if sender&amp;#39;s balance is less than the amount and the relayer fee, skip this meta tx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; check if the signature is valid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        msgHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; recipients&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amounts&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; relayerFees&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; newNonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; blocks&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sender &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; ecrecover&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;\x19Ethereum Signed Message:\n32&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; msgHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; sigV&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; sigR&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; sigS&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            continue&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if sig is not valid, skip to the next meta tx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; set a new nonce for the sender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _metaNonces&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; newNonce&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; transfer tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;amounts&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; relayerFees&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;recipients&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; amounts&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        relayerFeesSum &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; relayerFees&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; give the relayer the sum of all relayer fees&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    _balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; relayerFeesSum&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;nonceof&quot;&gt;&lt;code&gt;nonceOf()&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Nonces are needed due to the replay protection (see &lt;em&gt;Replay attacks&lt;&#x2F;em&gt; under &lt;em&gt;Security Considerations&lt;&#x2F;em&gt;).&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;mapping&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _metaNonces&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; nonceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; _metaNonces&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The link to the complete implementation (along with gas usage results) is here: &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;defifuture&#x2F;erc20-batched-meta-transactions&quot;&gt;https:&#x2F;&#x2F;github.com&#x2F;defifuture&#x2F;erc20-batched-meta-transactions&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Note that the OpenZeppelin ERC-20 implementation was used here. Some other implementation may have named the &lt;code&gt;_balances&lt;&#x2F;code&gt; mapping differently, which would require minor changes in the &lt;code&gt;processMetaBatch()&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;all-in-one&quot;&gt;All-in-one&lt;&#x2F;h3&gt;
&lt;p&gt;Alternative implementations (like GSN) use multiple smart contracts to enable meta transactions, although this increases gas usage. This implementation (EIP-3005) intentionally keeps everything within one function which reduces complexity and gas cost.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;processMetaBatch()&lt;&#x2F;code&gt; function thus does the job of receiving a batch of meta transactions, validating them, and then transferring tokens from one address to another.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;function-parameters&quot;&gt;Function parameters&lt;&#x2F;h3&gt;
&lt;p&gt;As you can see, the &lt;code&gt;processMetaBatch()&lt;&#x2F;code&gt; function in the reference implementation takes the following parameters:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;an array of &lt;strong&gt;sender addresses&lt;&#x2F;strong&gt; (meta txs senders, not relayers)&lt;&#x2F;li&gt;
&lt;li&gt;an array of &lt;strong&gt;receiver addresses&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;li&gt;an array of &lt;strong&gt;amounts&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;li&gt;an array of &lt;strong&gt;relayer fees&lt;&#x2F;strong&gt; (relayer is &lt;code&gt;msg.sender&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;an array of &lt;strong&gt;block numbers&lt;&#x2F;strong&gt; (a due &quot;date&quot; for meta tx to be processed)&lt;&#x2F;li&gt;
&lt;li&gt;Three arrays that represent parts of a &lt;strong&gt;signature&lt;&#x2F;strong&gt; (v, r, s)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Each item&lt;&#x2F;strong&gt; in these arrays represents &lt;strong&gt;data of one meta transaction&lt;&#x2F;strong&gt;. That&#x27;s why the &lt;strong&gt;correct order&lt;&#x2F;strong&gt; in the arrays is very important.&lt;&#x2F;p&gt;
&lt;p&gt;If a relayer gets the order wrong, the &lt;code&gt;processMetaBatch()&lt;&#x2F;code&gt; function would notice that (when validating a signature), because the hash of the meta transaction values would not match the signed hash. A meta transaction with an invalid signature is &lt;strong&gt;skipped&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;the-alternative-way-of-passing-meta-transaction-data-into-the-function&quot;&gt;The alternative way of passing meta transaction data into the function&lt;&#x2F;h3&gt;
&lt;p&gt;The reference implementation takes parameters as arrays. There&#x27;s a separate array for each meta transaction data category (the ones that cannot be deduced or extracted from other sources).&lt;&#x2F;p&gt;
&lt;p&gt;A different approach would be to bitpack all data of a meta transaction into one value and then unpack it within the smart contract. The data for a batch of meta transactions would be sent in an array, but there would need to be only one array (of packed data), instead of multiple arrays.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-is-nonce-not-one-of-the-parameters-in-the-reference-implementation&quot;&gt;Why is nonce not one of the parameters in the reference implementation?&lt;&#x2F;h3&gt;
&lt;p&gt;Meta nonce is used for constructing a signed hash (see the &lt;code&gt;msgHash&lt;&#x2F;code&gt; line where a &lt;code&gt;keccak256&lt;&#x2F;code&gt; hash is constructed - you&#x27;ll find a nonce there).&lt;&#x2F;p&gt;
&lt;p&gt;Since a new nonce has to always be bigger than the previous one by exactly 1, there&#x27;s no need to include it as a parameter array in the &lt;code&gt;processMetaBatch()&lt;&#x2F;code&gt; function, because its value can be deduced.&lt;&#x2F;p&gt;
&lt;p&gt;This also helps avoid the &quot;Stack too deep&quot; error.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;can-eip-2612-nonces-mapping-be-re-used&quot;&gt;Can EIP-2612 nonces mapping be re-used?&lt;&#x2F;h3&gt;
&lt;p&gt;The EIP-2612 (&lt;code&gt;permit()&lt;&#x2F;code&gt; function) also requires a nonce mapping. At this point, I&#x27;m not sure yet if this mapping should be &lt;strong&gt;re-used&lt;&#x2F;strong&gt; in case a smart contract implements both EIP-3005 and EIP-2612.&lt;&#x2F;p&gt;
&lt;p&gt;At the first glance, it seems the &lt;code&gt;nonces&lt;&#x2F;code&gt; mapping from EIP-2612 could be re-used, but this should be thought through (and tested) for possible security implications.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;token-transfers-1&quot;&gt;Token transfers&lt;&#x2F;h3&gt;
&lt;p&gt;Token transfers in the reference implementation could alternatively be done by calling the &lt;code&gt;_transfer()&lt;&#x2F;code&gt; function (part of the OpenZeppelin ERC-20 implementation), but it would increase the gas usage and it would also revert the whole batch if some meta transaction was invalid (the current implementation just skips it).&lt;&#x2F;p&gt;
&lt;p&gt;Another gas usage optimization is to assign total relayer fees to the relayer at the end of the function, and not with every token transfer inside the for loop (thus avoiding multiple SSTORE calls that cost 5&#x27;000 gas).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The code implementation of batched meta transactions is backwards compatible with any fungible token standard, for example, ERC-20 (it only extends it with one function).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Link to tests: &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;defifuture&#x2F;erc20-batched-meta-transactions&#x2F;tree&#x2F;master&#x2F;test&quot;&gt;https:&#x2F;&#x2F;github.com&#x2F;defifuture&#x2F;erc20-batched-meta-transactions&#x2F;tree&#x2F;master&#x2F;test&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Here is a list of potential security issues and how are they addressed in this implementation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;forging-a-meta-transaction&quot;&gt;Forging a meta transaction&lt;&#x2F;h3&gt;
&lt;p&gt;The solution against a relayer forging a meta transaction is for a user to sign the meta transaction with their private key.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;processMetaBatch()&lt;&#x2F;code&gt; function then verifies the signature using &lt;code&gt;ecrecover()&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;replay-attacks&quot;&gt;Replay attacks&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;processMetaBatch()&lt;&#x2F;code&gt; function is secure against two types of a replay attack:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Using the same meta transaction twice in the same token smart contract&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;A nonce prevents a replay attack where a relayer would send the same meta transaction more than once.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Using the same meta transaction twice in different token smart contracts&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;A token smart contract address must be added into the signed hash (of a meta transaction).&lt;&#x2F;p&gt;
&lt;p&gt;This address does not need to be sent as a parameter into the &lt;code&gt;processMetaBatch()&lt;&#x2F;code&gt; function. Instead, the function uses &lt;code&gt;address(this)&lt;&#x2F;code&gt; when constructing a hash in order to verify the signature. This way a meta transaction not intended for the token smart contract would be rejected (skipped).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;signature-validation&quot;&gt;Signature validation&lt;&#x2F;h3&gt;
&lt;p&gt;Signing a meta transaction and validating the signature is crucial for this whole scheme to work.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;processMetaBatch()&lt;&#x2F;code&gt; function validates a meta transaction signature, and if it&#x27;s &lt;strong&gt;invalid&lt;&#x2F;strong&gt;, the meta transaction is &lt;strong&gt;skipped&lt;&#x2F;strong&gt; (but the whole on-chain transaction is &lt;strong&gt;not reverted&lt;&#x2F;strong&gt;).&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;msgHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; recipients&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amounts&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; relayerFees&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; newNonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; blocks&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sender &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; ecrecover&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;\x19Ethereum Signed Message:\n32&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; msgHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; sigV&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; sigR&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; sigS&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    continue&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if sig is not valid, skip to the next meta tx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Why not reverting the whole on-chain transaction? Because there could be only one problematic meta transaction, and the others should not be dropped just because of one rotten apple.&lt;&#x2F;p&gt;
&lt;p&gt;That said, it is expected of relayers to validate meta transactions in advance before relaying them. That&#x27;s why relayers are not entitled to a relayer fee for an invalid meta transaction.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;malicious-relayer-forcing-a-user-into-over-spending&quot;&gt;Malicious relayer forcing a user into over-spending&lt;&#x2F;h3&gt;
&lt;p&gt;A malicious relayer could delay sending some user&#x27;s meta transaction until the user would decide to make the token transaction on-chain.&lt;&#x2F;p&gt;
&lt;p&gt;After that, the relayer would relay the delayed meta transaction which would mean that the user would have made two token transactions (over-spending).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Solution:&lt;&#x2F;strong&gt; Each meta transaction should have an &quot;expiry date&quot;. This is defined in a form of a block number by which the meta transaction must be relayed on-chain.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; processMetaBatch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                          uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; blocks&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                          .&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; loop through all meta txs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; senders&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the meta tx should be processed until (including) the specified block number, otherwise it is invalid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; blocks&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            continue&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if current block number is bigger than the requested number, skip this meta tx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;front-running-attack&quot;&gt;Front-running attack&lt;&#x2F;h3&gt;
&lt;p&gt;A malicious relayer could scout the Ethereum mempool to steal meta transactions and front-run the original relayer.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Solution:&lt;&#x2F;strong&gt; The protection that &lt;code&gt;processMetaBatch()&lt;&#x2F;code&gt; function uses is that it requires the meta transaction sender to add the relayer&#x27;s Ethereum address as one of the values in the hash (which is then signed).&lt;&#x2F;p&gt;
&lt;p&gt;When the &lt;code&gt;processMetaBatch()&lt;&#x2F;code&gt; function generates a hash it includes the &lt;code&gt;msg.sender&lt;&#x2F;code&gt; address in it:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;msgHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; recipients&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amounts&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; relayerFees&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; newNonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; blocks&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sender &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; ecrecover&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;\x19Ethereum Signed Message:\n32&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; msgHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; sigV&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; sigR&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; sigS&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    continue&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if sig is not valid, skip to the next meta tx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;If the meta transaction was &quot;stolen&quot;, the signature check would fail because the &lt;code&gt;msg.sender&lt;&#x2F;code&gt; address would not be the same as the intended relayer&#x27;s address.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;a-malicious-or-too-impatient-user-sending-a-meta-transaction-with-the-same-nonce-through-multiple-relayers-at-once&quot;&gt;A malicious (or too impatient) user sending a meta transaction with the same nonce through multiple relayers at once&lt;&#x2F;h3&gt;
&lt;p&gt;A user that is either malicious or just impatient could submit a meta transaction with the same nonce (for the same token contract) to various relayers. Only one of them would get the relayer fee (the first one on-chain), while the others would get an invalid meta transaction.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Solution:&lt;&#x2F;strong&gt; Relayers could &lt;strong&gt;share a list of their pending meta transactions&lt;&#x2F;strong&gt; between each other (sort of an info mempool).&lt;&#x2F;p&gt;
&lt;p&gt;The relayers don&#x27;t have to fear that someone would steal their respective pending transactions, due to the front-running protection (see above).&lt;&#x2F;p&gt;
&lt;p&gt;If relayers see meta transactions from a certain sender address that have the same nonce and are supposed to be relayed to the same token smart contract, they can decide that only the first registered meta transaction goes through and others are dropped (or in case meta transactions were registered at the same time, the remaining meta transaction could be randomly picked).&lt;&#x2F;p&gt;
&lt;p&gt;At a minimum, relayers need to share this meta transaction data (in order to detect meta transaction collision):&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;sender address&lt;&#x2F;li&gt;
&lt;li&gt;token address&lt;&#x2F;li&gt;
&lt;li&gt;nonce&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;too-big-due-block-number&quot;&gt;Too big due block number&lt;&#x2F;h3&gt;
&lt;p&gt;The relayer could trick the meta transaction sender into adding too big due block number - this means a block by which the meta transaction must be processed. The block number could be far in the future, for example, 10 years in the future. This means that the relayer would have 10 years to submit the meta transaction.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;One way&lt;&#x2F;strong&gt; to solve this problem is by adding an upper bound constraint for a block number within the smart contract. For example, we could say that the specified due block number must not be bigger than 100&#x27;000 blocks from the current one (this is around 17 days in the future if we assume 15 seconds block time).&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the meta tx should be processed until (including) the specified block number, otherwise it is invalid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; blocks&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span&gt; blocks&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 100000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If current block number is bigger than the requested due block number, skip this meta tx.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Also skip if the due block number is too big (bigger than 100&amp;#39;000 blocks in the future).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    continue&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This addition could open new security implications, that&#x27;s why it is left out of this proof-of-concept. But anyone who wishes to implement it should know about this potential constraint, too.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;The other way&lt;&#x2F;strong&gt; is to keep the &lt;code&gt;processMetaBatch()&lt;&#x2F;code&gt; function as it is and rather check for the too big due block number &lt;strong&gt;on the relayer level&lt;&#x2F;strong&gt;. In this case, the user could be notified about the problem and could issue a new meta transaction with another relayer that would have a much lower block parameter (and the same nonce).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights are waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>IMPERSONATECALL Opcode</title>
        <published>2020-09-24T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Sergio Demian Lerner</name><uri>https://github.com/SergioDemianLerner</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2997/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethresear.ch/t/impersonatecall-opcode/8020" />
        

        <id>https://wg-eips.ritovision.com/2997/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:2997"
            label="EIP-2997" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2997/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Add a new opcode, &lt;code&gt;IMPERSONATECALL&lt;&#x2F;code&gt; at &lt;code&gt;0xf6&lt;&#x2F;code&gt;, which is similar in idea to &lt;code&gt;CALL (0xF1)&lt;&#x2F;code&gt;, except that it impersonates a sender, i.e. the callee sees a sender different from the real caller. The impersonated sender address is derived from the real caller address and a salt.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal enables native multi-user wallets (wallets that serve multiple users) that can be commanded by EIP-712 based messages and therefore enable meta-transactions. Multi-user wallets also enable the aggregation of transfer operations in batches similar to rollups, but maintaining the same address space as normal onchain transactions, so the sender&#x27;s wallet does not need to be upgraded to support sinding ether or tokens to a user of a multi-user wallet.
Additionally, many times a sponsor company wants to deploy non-custodial smart wallets for all its users. The sponsor does not want to pay the deployment cost of each user contract in advance. Counterfactual contract creation enables this, yet it forces the sponsor to create the smart wallet (or a proxy contract to it) when the user wants to transfer ether or tokens out of his&#x2F;her account for the first time. This proposal avoids this extra cost, which is at least 42000 gas per user.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;IMPERSONATECALL&lt;&#x2F;code&gt;: &lt;code&gt;0xf6&lt;&#x2F;code&gt;, takes 7 operands:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;gas&lt;&#x2F;code&gt;: the amount of gas the code may use in order to execute;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;to&lt;&#x2F;code&gt;: the destination address whose code is to be executed;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;in_offset&lt;&#x2F;code&gt;: the offset into memory of the input;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;in_size&lt;&#x2F;code&gt;: the size of the input in bytes;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ret_offset&lt;&#x2F;code&gt;: the offset into memory of the output;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ret_size&lt;&#x2F;code&gt;: the size of the scratch pad for the output.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;salt&lt;&#x2F;code&gt; is a &lt;code&gt;32&lt;&#x2F;code&gt; bytes value (a stack item).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;computation-of-impersonated-sender&quot;&gt;Computation of impersonated sender&lt;&#x2F;h3&gt;
&lt;p&gt;The impersonated sender address is computed as &lt;code&gt;keccak256( 0xff ++ address ++ salt ++ zeros32)[12:]&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;0xff&lt;&#x2F;code&gt; is a single byte,&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;address&lt;&#x2F;code&gt; is always &lt;code&gt;20&lt;&#x2F;code&gt; bytes, and represents the address of the real caller contract.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;salt&lt;&#x2F;code&gt; is always &lt;code&gt;32&lt;&#x2F;code&gt; bytes.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The field zeros32 corresponds to 32 zero bytes.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This scheme emulates &lt;code&gt;CREATE2&lt;&#x2F;code&gt; address derivation, but it cannot practically collude with the &lt;code&gt;CREATE2&lt;&#x2F;code&gt; address space.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;notes&quot;&gt;Notes&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;The opcode behaves exactly as &lt;code&gt;CALL&lt;&#x2F;code&gt; in terms of gas consumption.&lt;&#x2F;li&gt;
&lt;li&gt;In the called context &lt;code&gt;CALLER (0x33)&lt;&#x2F;code&gt; returns the impersonated address.&lt;&#x2F;li&gt;
&lt;li&gt;If value transfer is non-zero in the call, the value is transferred from the impersonated account, and not from the real caller. This can be used to transfer ether out of an impersonated account.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Even if &lt;code&gt;IMPERSONATECALL&lt;&#x2F;code&gt; requires hashing 3 words, implying an additional cost of 180 gas, we think the benefit of accounting for hashing doesn&#x27;t not compensate increasing the complexity of the implementation.&lt;&#x2F;p&gt;
&lt;p&gt;We use the zeros32 field to base address derivation in a pre-image of similar size than CREATE2 and reuse the existing address derivation functions. We also avoid worrying about address collisions between EOA derivation (65 bytes pre-image), CREATE derivation (from 23 to 27 bytes pre-image, for a 32bit nonce) and CREATE2 derivation (85 bytes pre-image).&lt;&#x2F;p&gt;
&lt;p&gt;An option is to omit the zeros32 field: the resulting length of the Keccak pre-image for IMPERSONATECALL address is 53 bytes , which does not generate address collision.&lt;&#x2F;p&gt;
&lt;p&gt;While the same functionality could be provided in a pre-compiled contract, we believe using a new opcode is a cleaner solution.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;clarifications&quot;&gt;Clarifications&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;This EIP makes address collisions possible, yet practically impossible.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;If a contract already exists with an impersonated address, the &lt;code&gt;IMPERSONATECALL&lt;&#x2F;code&gt; is executed in the same way, and the existing code will not be executed. It should  be noted that &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; (&lt;code&gt;0xff&lt;&#x2F;code&gt;) cannot be executed directly with &lt;code&gt;IMPERSONATECALL&lt;&#x2F;code&gt; as no opcode is executed in the context of the impersonated account.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backward-compatibility&quot;&gt;Backward Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The opcode number  &lt;code&gt;0xf6&lt;&#x2F;code&gt; is currently unused and results in an out-of-gas (OOG) exception.  Solidity uses the &lt;code&gt;INVALID (0xfe)&lt;&#x2F;code&gt; opcode (called &lt;code&gt;ABORT&lt;&#x2F;code&gt; by EIP-1803) to raise OOG exceptions, so the  &lt;code&gt;0xf6&lt;&#x2F;code&gt; opcode does not appear in normal Solidity programs. Programmers are already advised not to include this opcode in contracts written in EVM assembly.  Therefore is does not pose any backward compatibility risk.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;We present 4 examples of impersonated address derivation:&lt;&#x2F;p&gt;
&lt;p&gt;Example 0&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;address &lt;code&gt;0x0000000000000000000000000000000000000000&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;salt &lt;code&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;result: &lt;code&gt;0xFFC4F52F884A02BCD5716744CD622127366F2EDF&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Example 1&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;address &lt;code&gt;0xdeadbeef00000000000000000000000000000000&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;salt &lt;code&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;result: &lt;code&gt;0x85F15E045E1244AC03289B48448249DC0A34AA30&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Example 2&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;address &lt;code&gt;0xdeadbeef00000000000000000000000000000000&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;salt &lt;code&gt;0x000000000000000000000000feed000000000000000000000000000000000000&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;result: &lt;code&gt;0x2DB27D1D6BE32C9ABFA484BA3D591101881D4B9F&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Example 3&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;address &lt;code&gt;0x00000000000000000000000000000000deadbeef&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;salt &lt;code&gt;0x00000000000000000000000000000000000000000000000000000000cafebabe&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;result: &lt;code&gt;0x5004E448F43EFE3C7BF32F94B83B843D03901457&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The address derivation scheme prevents address collision with another deployed contract or an externally owned account, as the impersonated sender address is derived from the real caller address and a salt.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Optimistic enactment governance standard</title>
        <published>2020-09-24T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Jorge Izquierdo</name><uri>https://github.com/izqui</uri>
	</author>
	
	<author>
		<name>Fabien Marino</name><uri>https://github.com/bonustrack</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3000/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/3042" />
        

        <id>https://wg-eips.ritovision.com/3000/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:3000"
            label="ERC-3000" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3000/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Interface for scheduling, executing and challenging contract executions based on off-chain approval&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;ERC-3000 presents a basic on-chain spec for contracts to optimistically enact governance decisions made off-chain.&lt;&#x2F;p&gt;
&lt;p&gt;The standard is opinionated in defining the 6 entrypoint functions to contracts supporting the standard. But it allows for any sort of resolver mechanism for the challenge&#x2F;response games characteristic of optimistic contracts.&lt;&#x2F;p&gt;
&lt;p&gt;While the authors currently believe resolving challenges &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;aragon.org&#x2F;blog&#x2F;snapshot&quot;&gt;using a subjective oracle&lt;&#x2F;a&gt; is the right tradeoff, the standard has been designed such that changing to another mechanism is possible (a deterministic resolver like &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;optimism.io&quot;&gt;Optimism&#x27;s OVM&lt;&#x2F;a&gt; uses), even allowing to hot-swap it in the same live instance.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;data-structures&quot;&gt;Data structures&lt;&#x2F;h3&gt;
&lt;p&gt;Some data structures are defined which are later used in the standard interfaces:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;library&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC3000Data&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Container&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        Payload payload&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        Config config&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Payload&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; executionTime&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; submitter&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        IERC3000Executor executor&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        Action&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; actions&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span&gt; proof&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Action&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Config&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; executionDelay&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        Collateral scheduleDeposit&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        Collateral challengeDeposit&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        Collateral vetoDeposit&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; resolver&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span&gt; rules&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Collateral&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; token&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;interface-and-events&quot;&gt;Interface and events&lt;&#x2F;h3&gt;
&lt;p&gt;Given the data structures above, by taking advantage of the Solidity ABI encoder v2, we define four required functions and two optional functions as the interface for contracts to comply with ERC-3000.&lt;&#x2F;p&gt;
&lt;p&gt;All standard functions are expected to revert (whether to include error messages&#x2F;revert reasons as part of the standard is yet to be determined) when pre-conditions are not met or an unexpected error occurs. On success, each function must emit its associated event once and only once.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;abstract&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC3000&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Schedules an action for execution, allowing for challenges and vetos on a defined time window&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; container&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A Container struct holding both the paylaod being scheduled for execution and&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;       the current configuration of the system&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; schedule&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;ERC3000Data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; containerHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Scheduled&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; containerHash&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;ERC3000Data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;Payload&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; payload&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;ERC3000Data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;Collateral&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collateral&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Executes an action after its execution delayed has passed and its state hasn&amp;#39;t been altered by a challenge or veto&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; container&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A ERC3000Data.Container struct holding both the paylaod being scheduled for execution and&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;       the current configuration of the system&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * should be a MUST payload.executor.exec(payload.actions)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; execute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;ERC3000Data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; execResults&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Executed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; containerHash&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; actor&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; execResults&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Challenge a container in case its scheduling is illegal as per Config.rules. Pulls collateral and dispute fees from sender into contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; container&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A ERC3000Data.Container struct holding both the paylaod being scheduled for execution and&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;       the current configuration of the system&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; reason&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Hint for case reviewers as to why the scheduled container is illegal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; challenge&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;ERC3000Data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; container&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; reason&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; resolverId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Challenged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; containerHash&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; actor&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; reason&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; resolverId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;ERC3000Data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;Collateral&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collateral&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Apply arbitrator&amp;#39;s ruling over a challenge once it has come to a final ruling&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; container&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A ERC3000Data.Container struct holding both the paylaod being scheduled for execution and&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;       the current configuration of the system&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; resolverId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; disputeId in the arbitrator in which the dispute over the container was created&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; resolve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;ERC3000Data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; container&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; resolverId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; execResults&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Resolved&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; containerHash&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; actor&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approved&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; OPTIONAL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Apply arbitrator&amp;#39;s ruling over a challenge once it has come to a final ruling&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; payloadHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Hash of the payload being vetoed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; config&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A ERC3000Data.Config struct holding the config attached to the payload being vetoed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; veto&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; payloadHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; ERC3000Data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;Config&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; config&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; reason&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Vetoed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; containerHash&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; actor&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; reason&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;ERC3000Data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;Collateral&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; collateral&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; OPTIONAL: implementer might choose not to implement (initial Configured event MUST be emitted)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Apply a new configuration for all *new* containers to be scheduled&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; config&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A ERC3000Data.Config struct holding all the new params that will control the queue&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; configure&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;ERC3000Data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;Config&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; config&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; configHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Configured&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; containerHash&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; actor&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;ERC3000Data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;Config&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; config&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The authors believe that it is very important that this standard leaves the other open to any resolver mechanism to be implemented and adopted.&lt;&#x2F;p&gt;
&lt;p&gt;That&#x27;s why a lot of the function and variable names were left intentionally bogus to be compatible with future resolvers without changing the standard.&lt;&#x2F;p&gt;
&lt;p&gt;ERC-3000 should be seen as a public good of top of which public infrastrastructure will be built, being way more important than any particular implementation or the interests of specific companies or projects.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The standard allows for the resolver for challenges to be configured, and even have different resolvers for coexisting scheduled payloads. Choosing the right resolver requires making the right tradeoff between security, time to finality, implementation complexity, and external dependencies.&lt;&#x2F;p&gt;
&lt;p&gt;Using a subjective oracle as resolver has its risks, since security depends on the crypto-economic properties of the system. For an analysis of crypto-economic considerations of Aragon Court, you can check &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;aragon&#x2F;aragon-court&#x2F;tree&#x2F;master&#x2F;docs&#x2F;3-cryptoeconomic-considerations&quot;&gt;the following doc&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;On the other hand, implementing a deterministic resolver is prone to dangerous bugs given its complexity, and will rely on a specific version of the off-chain protocol, which could rapidly evolve while the standard matures and gets adopted.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementations&quot;&gt;Implementations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;1-aragon-govern&quot;&gt;1. Aragon Govern&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;aragon&#x2F;govern&#x2F;blob&#x2F;master&#x2F;packages&#x2F;erc3k&quot;&gt;ERC-3000 interface (MIT license)&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;aragon&#x2F;govern&#x2F;blob&#x2F;master&#x2F;packages&#x2F;govern-core&quot;&gt;Implementation (GPL-3.0 license)&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>NFT Royalty Standard</title>
        <published>2020-09-15T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Zach Burks</name><uri>https://github.com/vexycats</uri>
	</author>
	
	<author>
		<name>James Morgan</name><uri>https://github.com/jamesmorgan</uri>
	</author>
	
	<author>
		<name>Blaine Malone</name><uri>https://github.com/blmalone</uri>
	</author>
	
	<author>
		<name>James Seibel</name><uri>https://github.com/seibelj</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2981/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/2907" />
        

        <id>https://wg-eips.ritovision.com/2981/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2981"
            label="ERC-2981" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2981/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal support for royalty payments across all NFT marketplaces and ecosystem participants.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard allows contracts, such as NFTs that support &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; interfaces, to signal a royalty amount to be paid to the NFT creator or rights holder every time the NFT is sold or re-sold. This is intended for NFT marketplaces that want to support the ongoing funding of artists and other NFT creators. The royalty payment must be voluntary, as transfer mechanisms such as &lt;code&gt;transferFrom()&lt;&#x2F;code&gt; include NFT transfers between wallets, and executing them does not always imply a sale occurred. Marketplaces and individuals implement this standard by retrieving the royalty payment information with &lt;code&gt;royaltyInfo()&lt;&#x2F;code&gt;, which specifies how much to pay to which address for a given sale price. The exact mechanism for paying and notifying the recipient will be defined in future EIPs. This ERC should be considered a minimal, gas-efficient building block for further innovation in NFT royalty payments.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;There are many marketplaces for NFTs with multiple unique royalty payment implementations that are not easily compatible or usable by other marketplaces. Just like the early days of ERC-20 tokens, NFT marketplace smart contracts are varied by ecosystem and not standardized. This EIP enables all marketplaces to retrieve royalty payment information for a given NFT. This enables accurate royalty payments regardless of which marketplace the NFT is sold or re-sold at.&lt;&#x2F;p&gt;
&lt;p&gt;Many of the largest NFT marketplaces have implemented bespoke royalty payment solutions that are incompatible with other marketplaces. This standard implements standardized royalty information retrieval that can be accepted across any type of NFT marketplace. This minimalist proposal only provides a mechanism to fetch the royalty amount and recipient. The actual funds transfer is something which the marketplace should execute.&lt;&#x2F;p&gt;
&lt;p&gt;This standard allows NFTs that support &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; interfaces, to have a standardized way of signalling royalty information. More specifically, these contracts can now calculate a royalty amount to provide to the rightful recipient.&lt;&#x2F;p&gt;
&lt;p&gt;Royalty amounts are always a percentage of the sale price. If a marketplace chooses &lt;em&gt;not&lt;&#x2F;em&gt; to implement this EIP, then no funds will be paid for secondary sales. It is believed that the NFT marketplace ecosystem will voluntarily implement this royalty payment standard; in a bid to provide ongoing funding for artists&#x2F;creators. NFT buyers will assess the royalty payment as a factor when making NFT purchasing decisions.&lt;&#x2F;p&gt;
&lt;p&gt;Without an agreed royalty payment standard, the NFT ecosystem will lack an effective means to collect royalties across all marketplaces and artists and other creators will not receive ongoing funding. This will hamper the growth and adoption of NFTs and demotivate NFT creators from minting new and innovative tokens.&lt;&#x2F;p&gt;
&lt;p&gt;Enabling all NFT marketplaces to unify on a single royalty payment standard will benefit the entire NFT ecosystem.&lt;&#x2F;p&gt;
&lt;p&gt;While this standard focuses on NFTs and compatibility with the ERC-721 and ERC-1155 standards, EIP-2981 does not require compatibility with ERC-721 and ERC-1155 standards. Any other contract could integrate with EIP-2981 to return royalty payment information. ERC-2981 is, therefore, a universal royalty standard for many asset types.&lt;&#x2F;p&gt;
&lt;p&gt;At a glance, here&#x27;s an example conversation summarizing NFT royalty payments today:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Artist&lt;&#x2F;strong&gt;: &quot;Do you support royalty payments on your platform?&quot;&lt;br &#x2F;&gt;
&lt;strong&gt;Marketplace&lt;&#x2F;strong&gt;: &quot;Yes we have royalty payments, but if your NFT is sold on another marketplace then we cannot enforce this payment.&quot;&lt;br &#x2F;&gt;
&lt;strong&gt;Artist&lt;&#x2F;strong&gt;: &quot;What about other marketplaces that support royalties, don&#x27;t you share my royalty information to make this work?&quot;&lt;br &#x2F;&gt;
&lt;strong&gt;Marketplace&lt;&#x2F;strong&gt;: &quot;No, we do not share royalty information.&quot;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL
NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot;, and
&quot;OPTIONAL&quot; in this document are to be interpreted as described in
RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;ERC-721 and ERC-1155 compliant contracts MAY implement this ERC for royalties to provide a standard method of specifying royalty payment information.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Marketplaces that support this standard &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; implement some method of transferring royalties to the royalty recipient. Standards for the actual transfer and notification of funds will be specified in future EIPs.&lt;&#x2F;p&gt;
&lt;p&gt;Marketplaces &lt;strong&gt;MUST&lt;&#x2F;strong&gt; pay the royalty in the same unit of exchange as that of the &lt;code&gt;_salePrice&lt;&#x2F;code&gt; passed to &lt;code&gt;royaltyInfo()&lt;&#x2F;code&gt;. This is equivalent to saying that the &lt;code&gt;_salePrice&lt;&#x2F;code&gt; parameter and the &lt;code&gt;royaltyAmount&lt;&#x2F;code&gt; return value &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be denominated in the same monetary unit. For example, if the sale price is in ETH, then the royalty payment must also be paid in ETH, and if the sale price is in USDC, then the royalty payment must also be paid in USDC.&lt;&#x2F;p&gt;
&lt;p&gt;Implementers of this standard &lt;strong&gt;MUST&lt;&#x2F;strong&gt; calculate a percentage of the &lt;code&gt;_salePrice&lt;&#x2F;code&gt; when calculating the royalty amount. Subsequent invocations of &lt;code&gt;royaltyInfo()&lt;&#x2F;code&gt; &lt;strong&gt;MAY&lt;&#x2F;strong&gt; return a different &lt;code&gt;royaltyAmount&lt;&#x2F;code&gt;. Though there are some important considerations for implementers if they choose to perform different percentage calculations between &lt;code&gt;royaltyInfo()&lt;&#x2F;code&gt; invocations.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;royaltyInfo()&lt;&#x2F;code&gt; function is not aware of the unit of exchange for the sale and royalty payment. With that in mind, implementers &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; return a fixed&#x2F;constant &lt;code&gt;royaltyAmount&lt;&#x2F;code&gt;, wherein they&#x27;re ignoring the &lt;code&gt;_salePrice&lt;&#x2F;code&gt;. For the same reason, implementers &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; determine the &lt;code&gt;royaltyAmount&lt;&#x2F;code&gt; based on comparing the &lt;code&gt;_salePrice&lt;&#x2F;code&gt; with constant numbers. In both cases, the &lt;code&gt;royaltyInfo()&lt;&#x2F;code&gt; function makes assumptions on the unit of exchange, which &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be avoided.&lt;&#x2F;p&gt;
&lt;p&gt;The percentage value used must be independent of the sale price for reasons previously mentioned (i.e. if the percentage value 10%, then 10% &lt;strong&gt;MUST&lt;&#x2F;strong&gt; apply whether &lt;code&gt;_salePrice&lt;&#x2F;code&gt; is 10, 10000 or 1234567890). If the royalty fee calculation results in a remainder, implementers &lt;strong&gt;MAY&lt;&#x2F;strong&gt; round up or round down to the nearest integer. For example, if the royalty fee is 10% and &lt;code&gt;_salePrice&lt;&#x2F;code&gt; is 999, the implementer can return either 99 or 100 for &lt;code&gt;royaltyAmount&lt;&#x2F;code&gt;, both are valid.&lt;&#x2F;p&gt;
&lt;p&gt;The implementer &lt;strong&gt;MAY&lt;&#x2F;strong&gt; choose to change the percentage value based on other predictable variables that do not make assumptions about the unit of exchange. For example, the percentage value may drop linearly over time. An approach like this &lt;strong&gt;SHOULD NOT&lt;&#x2F;strong&gt; be based on variables that are unpredictable like &lt;code&gt;block.timestamp&lt;&#x2F;code&gt;, but instead on other more predictable state changes. One more reasonable approach &lt;strong&gt;MAY&lt;&#x2F;strong&gt; use the number of transfers of an NFT to decide which percentage value is used to calculate the &lt;code&gt;royaltyAmount&lt;&#x2F;code&gt;. The idea being that the percentage value could decrease after each transfer of the NFT. Another example could be using a different percentage value for each unique &lt;code&gt;_tokenId&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Marketplaces that support this standard &lt;strong&gt;SHOULD NOT&lt;&#x2F;strong&gt; send a zero-value transaction if the &lt;code&gt;royaltyAmount&lt;&#x2F;code&gt; returned is &lt;code&gt;0&lt;&#x2F;code&gt;. This would waste gas and serves no useful purpose in this EIP.&lt;&#x2F;p&gt;
&lt;p&gt;Marketplaces that support this standard &lt;strong&gt;MUST&lt;&#x2F;strong&gt; pay royalties no matter where the sale occurred or in what currency, including on-chain sales, over-the-counter (OTC) sales and off-chain sales such as at auction houses. As royalty payments are voluntary, entities that respect this EIP must pay no matter where the sale occurred - a sale conducted outside of the blockchain is still a sale. The exact mechanism for paying and notifying the recipient will be defined in future EIPs.&lt;&#x2F;p&gt;
&lt;p&gt;Implementers of this standard &lt;strong&gt;MUST&lt;&#x2F;strong&gt; have all of the following functions:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.6.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERC165.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Interface for the NFT Royalty Standard&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC2981&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC165&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC165 bytes to add to interface array - set in parent contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; implementing this standard&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; bytes4(keccak256(&amp;quot;royaltyInfo(uint256,uint256)&amp;quot;)) == 0x2a55205a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; bytes4 private constant _INTERFACE_ID_ERC2981 = 0x2a55205a;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; _registerInterface(_INTERFACE_ID_ERC2981);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Called with the sale price to determine how much royalty&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;          is owed and to whom.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - the NFT asset queried for royalty information&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _salePrice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - the sale price of the NFT asset specified by _tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; receiver&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - address of who should be sent the royalty payment&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; royaltyAmount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - the royalty payment amount for _salePrice&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; royaltyInfo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _salePrice&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; receiver&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; royaltyAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC165&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Query if a contract implements an interface&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; interfaceID&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The interface identifier, as specified in ERC-165&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Interface identification is specified in ERC-165. This function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  uses less than 30,000 gas.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `true` if the contract implements `interfaceID` and&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  `interfaceID` is not 0xffffffff, `false` otherwise&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;examples&quot;&gt;Examples&lt;&#x2F;h3&gt;
&lt;p&gt;This standard being used on an ERC-721 during deployment:&lt;&#x2F;p&gt;
&lt;h4 id=&quot;deploying-an-erc-721-and-signaling-support-for-erc-2981&quot;&gt;Deploying an ERC-721 and signaling support for ERC-2981&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;constructor&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; symbol&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; baseURI&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _name &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _symbol &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; symbol&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _setBaseURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;baseURI&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; register the supported interfaces to conform to ERC721 via ERC165&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _registerInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_INTERFACE_ID_ERC721&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _registerInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_INTERFACE_ID_ERC721_METADATA&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _registerInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_INTERFACE_ID_ERC721_ENUMERABLE&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Royalties interface&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _registerInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_INTERFACE_ID_ERC2981&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;checking-if-the-nft-being-sold-on-your-marketplace-implemented-royalties&quot;&gt;Checking if the NFT being sold on your marketplace implemented royalties&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; _INTERFACE_ID_ERC2981 &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x2a55205a&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checkRoyalties&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _contract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC165&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_contract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_INTERFACE_ID_ERC2981&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; success&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;optional-royalty-payments&quot;&gt;Optional royalty payments&lt;&#x2F;h3&gt;
&lt;p&gt;It is impossible to know which NFT transfers are the result of sales, and which are merely wallets moving or consolidating their NFTs. Therefore, we cannot force every transfer function, such as &lt;code&gt;transferFrom()&lt;&#x2F;code&gt; in ERC-721, to involve a royalty payment as not every transfer is a sale that would require such payment. We believe the NFT marketplace ecosystem will voluntarily implement this royalty payment standard to provide ongoing funding for artists&#x2F;creators. NFT buyers will assess the royalty payment as a factor when making NFT purchasing decisions.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;simple-royalty-payments-to-a-single-address&quot;&gt;Simple royalty payments to a single address&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP does not specify the manner of payment to the royalty recipient. Furthermore, it is impossible to fully know and efficiently implement all possible types of royalty payments logic. With that said, it is on the royalty payment receiver to implement all additional complexity and logic for fee splitting, multiple receivers, taxes, accounting, etc. in their own receiving contract or off-chain processes. Attempting to do this as part of this standard, it would dramatically increase the implementation complexity, increase gas costs, and could not possibly cover every potential use-case. This ERC should be considered a minimal, gas-efficient building block for further innovation in NFT royalty payments. Future EIPs can specify more details regarding payment transfer and notification.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;royalty-payment-percentage-calculation&quot;&gt;Royalty payment percentage calculation&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP mandates a percentage-based royalty fee model. It is likely that the most common case of percentage calculation will be where the &lt;code&gt;royaltyAmount&lt;&#x2F;code&gt; is always calculated from the &lt;code&gt;_salePrice&lt;&#x2F;code&gt; using a fixed percent i.e. if the royalty fee is 10%, then a 10% royalty fee must apply whether &lt;code&gt;_salePrice&lt;&#x2F;code&gt; is 10, 10000 or 1234567890.&lt;&#x2F;p&gt;
&lt;p&gt;As previously mentioned, implementers can get creative with this percentage-based calculation but there are some important caveats to consider. Mainly, ensuring that the &lt;code&gt;royaltyInfo()&lt;&#x2F;code&gt; function is not aware of the unit of exchange and that unpredictable variables are avoided in the percentage calculation. To follow up on the earlier &lt;code&gt;block.timestamp&lt;&#x2F;code&gt; example, there is some nuance which can be highlighted if the following events ensued:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Marketplace sells NFT.&lt;&#x2F;li&gt;
&lt;li&gt;Marketplace delays &lt;code&gt;X&lt;&#x2F;code&gt; days before invoking &lt;code&gt;royaltyInfo()&lt;&#x2F;code&gt; and sending payment.&lt;&#x2F;li&gt;
&lt;li&gt;Marketplace receives &lt;code&gt;Y&lt;&#x2F;code&gt; for &lt;code&gt;royaltyAmount&lt;&#x2F;code&gt; which was significantly different from the &lt;code&gt;royaltyAmount&lt;&#x2F;code&gt; amount that would&#x27;ve been calculated &lt;code&gt;X&lt;&#x2F;code&gt; days prior if no delay had occurred.&lt;&#x2F;li&gt;
&lt;li&gt;Royalty recipient is dissatisfied with the delay from the marketplace and for this reason, they raise a dispute.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Rather than returning a percentage and letting the marketplace calculate the royalty amount based on the sale price, a &lt;code&gt;royaltyAmount&lt;&#x2F;code&gt; value is returned so there is no dispute with a marketplace over how much is owed for a given sale price. The royalty fee payer must pay the &lt;code&gt;royaltyAmount&lt;&#x2F;code&gt; that &lt;code&gt;royaltyInfo()&lt;&#x2F;code&gt; stipulates.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;unit-less-royalty-payment-across-all-marketplaces-both-on-chain-and-off-chain&quot;&gt;Unit-less royalty payment across all marketplaces, both on-chain and off-chain&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP does not specify a currency or token used for sales and royalty payments. The same percentage-based royalty fee must be paid regardless of what currency, or token was used in the sale, paid in the same currency or token. This applies to sales in any location including on-chain sales, over-the-counter (OTC) sales, and off-chain sales using fiat currency such as at auction houses. As royalty payments are voluntary, entities that respect this EIP must pay no matter where the sale occurred - a sale outside of the blockchain is still a sale. The exact mechanism for paying and notifying the recipient will be defined in future EIPs.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;universal-royalty-payments&quot;&gt;Universal Royalty Payments&lt;&#x2F;h3&gt;
&lt;p&gt;Although designed specifically with NFTs in mind, this standard does not require that a contract implementing EIP-2981 is compatible with either ERC-721 or ERC-1155 standards. Any other contract could use this interface to return royalty payment information, provided that it is able to uniquely identify assets within the constraints of the interface. ERC-2981 is, therefore, a universal royalty standard for many other asset types.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is compatible with current ERC-721 and ERC-1155 standards.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;There are no security considerations related directly to the implementation of this standard.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>IS_STATIC opcode</title>
        <published>2020-09-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2970/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/is-static-opcode-useful-for-aa/4609" />
        

        <id>https://wg-eips.ritovision.com/2970/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:2970"
            label="EIP-2970" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2970/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Add a &lt;code&gt;IS_STATIC (0x4A)&lt;&#x2F;code&gt; opcode that pushes &lt;code&gt;1&lt;&#x2F;code&gt; if the current context is static (ie. the execution is in a &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; or a descendant thereof, so state-changing operations are not possible), and &lt;code&gt;0&lt;&#x2F;code&gt; if it is not.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The main intended use case is to allow account abstraction (EIP 2938) to be extended so that accounts can allow static calls from the outside (which are harmless to AA&#x27;s security model) but not state-changing calls.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Add a &lt;code&gt;IS_STATIC (0x4A)&lt;&#x2F;code&gt; opcode that pushes &lt;code&gt;1&lt;&#x2F;code&gt; if the current context is static (ie. the execution is in a &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; or a descendant thereof, so state-changing operations are not possible), and &lt;code&gt;0&lt;&#x2F;code&gt; if it is not.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Determining staticness is already possibly using the following hacky technique: make a &lt;code&gt;CALL&lt;&#x2F;code&gt; with limited gas, and inside that &lt;code&gt;CALL&lt;&#x2F;code&gt; issue one &lt;code&gt;LOG&lt;&#x2F;code&gt; and exit. If the context is static, the &lt;code&gt;CALL&lt;&#x2F;code&gt; would fail and leave a 0 on the stack; if the context is non-static, the &lt;code&gt;CALL&lt;&#x2F;code&gt; would succeed. However, this technique is fragile against changes to gas costs, and is needlessly wasteful. Hence, the status quo neither allows a reasonably effective way of determining whether or not the context is static, nor provides any kind of invariant that executions that do not fail outright will execute the same way in a static and non-static context. This EIP provides a cleaner way of determining staticness.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Typed Transactions over Gossip</title>
        <published>2020-09-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Micah Zoltu</name><uri>https://github.com/MicahZoltu</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2976/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2976-eth-typed-transactions-over-gossip/4610" />
        

        <id>https://wg-eips.ritovision.com/2976/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="networking"
                label="Networking" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:2976"
            label="EIP-2976" />
        

        
        

        
        <summary type="html">Adds support for transmission of typed transactions over devp2p.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2976/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;Typed Transactions&lt;&#x2F;a&gt; can be sent over devp2p as &lt;code&gt;TransactionType || TransactionPayload&lt;&#x2F;code&gt;.
The exact contents of the &lt;code&gt;TransactionPayload&lt;&#x2F;code&gt; are defined by the &lt;code&gt;TransactionType&lt;&#x2F;code&gt; in future EIPs, and clients may start supporting their gossip without incrementing the devp2p version.
If a client receives a &lt;code&gt;TransactionType&lt;&#x2F;code&gt; that it doesn&#x27;t recognize, it &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; disconnect from the peer who sent it.
Clients &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; send new transaction types before they believe the fork block is reached.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; introduced new transaction types for blocks (which presents itself in the makeup of a block header&#x27;s transaction root and receipts root).
However, without a mechanism for gossiping these transactions, no one can actually include them in a block.
By updating devp2p to support the gossip of Typed Transactions, we can benefit from these new transaction types.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Note: See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; for additional motivations of Typed Transactions.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;All changes specified below apply to all protocol&#x2F;versions retroactively.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;||&lt;&#x2F;code&gt; is the byte&#x2F;byte-array concatenation operator.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;|&lt;&#x2F;code&gt; is the type union operator.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;DEVP2P_VERSION = TBD&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Transaction&lt;&#x2F;code&gt; is either &lt;code&gt;TypedTransaction&lt;&#x2F;code&gt; or &lt;code&gt;LegacyTransaction&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TypedTransaction&lt;&#x2F;code&gt; is a byte array containing &lt;code&gt;TransactionType || TransactionPayload&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TypedTransactionHash&lt;&#x2F;code&gt; is &lt;code&gt;keccak256(TypedTransaction)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TransactionType&lt;&#x2F;code&gt; is a positive unsigned 8-bit number between &lt;code&gt;0&lt;&#x2F;code&gt; and &lt;code&gt;0x7f&lt;&#x2F;code&gt; that represents the type of the transaction&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TransactionPayload&lt;&#x2F;code&gt; is an opaque byte array whose interpretation is dependent on the &lt;code&gt;TransactionType&lt;&#x2F;code&gt; and defined in future EIPs&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;LegacyTransaction&lt;&#x2F;code&gt; is an array of the form &lt;code&gt;[nonce, gasPrice, gasLimit, to, value, data, v, r, s]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;LegacyTransactionHash&lt;&#x2F;code&gt; is &lt;code&gt;keccak256(rlp(LegacyTransaction))&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TransactionId&lt;&#x2F;code&gt; is &lt;code&gt;keccak256(TypedTransactionHash | LegacyTransactionHash)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Receipt&lt;&#x2F;code&gt; is either &lt;code&gt;TypedReceipt&lt;&#x2F;code&gt; or &lt;code&gt;LegacyReceipt&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TypedReceipt&lt;&#x2F;code&gt; is a byte array containing &lt;code&gt;TransactionType || ReceiptPayload&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ReceiptPayload&lt;&#x2F;code&gt; is an opaque byte array whose interpretation is dependent on the &lt;code&gt;TransactionType&lt;&#x2F;code&gt; and defined in future EIPs&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;LegacyReceipt&lt;&#x2F;code&gt; is an array of the form &lt;code&gt;[status, cumulativeGasUsed, logsBloom, logs]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;LegacyReceiptHash&lt;&#x2F;code&gt; is &lt;code&gt;keccak256(rlp(LegacyReceipt))&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;protocol-behavior&quot;&gt;Protocol Behavior&lt;&#x2F;h3&gt;
&lt;p&gt;If a client receives a &lt;code&gt;TransactionType&lt;&#x2F;code&gt; it doesn&#x27;t recognize via any message, it &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; disconnect the peer that sent it.&lt;&#x2F;p&gt;
&lt;p&gt;If a client receives a &lt;code&gt;TransactionPayload&lt;&#x2F;code&gt; that isn&#x27;t valid for the &lt;code&gt;TransactionType&lt;&#x2F;code&gt;, it &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; disconnect the peer that sent it.&lt;&#x2F;p&gt;
&lt;p&gt;Clients &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; send transactions of a new &lt;code&gt;TransactionType&lt;&#x2F;code&gt; until that transaction type&#x27;s introductory fork block.&lt;&#x2F;p&gt;
&lt;p&gt;Clients &lt;strong&gt;MAY&lt;&#x2F;strong&gt; disconnect peers who send transactions of a new &lt;code&gt;TransactionType&lt;&#x2F;code&gt; significantly before that transaction type&#x27;s introductory fork block.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;protocol-messages&quot;&gt;Protocol Messages&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;Transactions (0x02)&lt;&#x2F;code&gt;: &lt;code&gt;[Transaction_0, Transaction_1, ..., Transaction_n]&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;BlockBodies (0x06)&lt;&#x2F;code&gt;: &lt;code&gt;[BlockBody_0, BlockBody_1, ..., BlockBody_n]&lt;&#x2F;code&gt; where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;BlockBody&lt;&#x2F;code&gt; is &lt;code&gt;[TransactionList, UncleList]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TransactionList&lt;&#x2F;code&gt; is &lt;code&gt;[Transaction_0, Transaction_1, ..., Transaction_n]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;UnclesList&lt;&#x2F;code&gt; is defined in previous versions of the devp2p specification&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;code&gt;NewBlock (0x07)&lt;&#x2F;code&gt;: &lt;code&gt;[[BlockHeader, TransactionList, UncleList], TotalDifficulty]&lt;&#x2F;code&gt; where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;BlockHeader&lt;&#x2F;code&gt; is defined in previous versions of the devp2 specification&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TransactionList&lt;&#x2F;code&gt; is &lt;code&gt;[Transaction_0, Transaction_1, ..., Transaction_n]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;UnclesList&lt;&#x2F;code&gt; is defined in previous versions of the devp2p specification&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TotalDifficulty&lt;&#x2F;code&gt; is defined in previous versions of the devp2p specification&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;code&gt;NewPooledTransactionIds (0x08)&lt;&#x2F;code&gt;: &lt;code&gt;[TransactionId_0, TransactionId_1, ..., TransactionId_n]&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;GetPooledTransactions (0x09)&lt;&#x2F;code&gt;: &lt;code&gt;[TransactionId_0, TransactionId_1, ..., TransactionId_n]&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;PooledTransactions (0x0a)&lt;&#x2F;code&gt;: &lt;code&gt;[Transaction_0, Transaction_1, ..., Transaction_n]&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;Receipts (0x10)&lt;&#x2F;code&gt;: &lt;code&gt;[ReceiptList_0, ReceiptList_1, ..., ReceiptList_n]&lt;&#x2F;code&gt; where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ReceiptList&lt;&#x2F;code&gt; is &lt;code&gt;[Receipt_0, Receipt_1, ..., Receipt_n]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-not-specify-each-transaction-type-at-the-protocol-layer&quot;&gt;Why not specify each transaction type at the protocol layer?&lt;&#x2F;h3&gt;
&lt;p&gt;We could have chosen to make the protocol aware of the shape of the transaction payloads.
The authors felt that it would be too much maintenance burden long term to have every new transaction type require an update to devp2p, so instead we merely define that typed transactions are supported.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-have-peers-disconnect-if-they-receive-an-unknown-transaction-type&quot;&gt;Why have peers disconnect if they receive an unknown transaction type?&lt;&#x2F;h3&gt;
&lt;p&gt;We could encourage peers to remain connected to peers that submit an unknown transaction type, in case the transaction is some new transaction type that the receiver isn&#x27;t aware of it.
However, doing so may open clients up to DoS attacks where someone would send them transactions of an undefined &lt;code&gt;TransactionType&lt;&#x2F;code&gt; in order to avoid being disconnected for spamming.
Also, in most cases we expect that by the time new transaction types are being sent over devp2p, a hard fork that requires all connected clients to be aware of the new transaction type is almost certainly imminent.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Legacy transactions are still supported.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;If a client chooses to ignore the &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; recommendation for disconnecting peers that send unknown transaction types they may be susceptible to DoS attacks.
Ignoring this recommendation should be limited to trusted peers only, or other situations where the risk of DoS is extremely low.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Wrapped Legacy Transactions</title>
        <published>2020-09-12T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Micah Zoltu</name><uri>https://github.com/MicahZoltu</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2972/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2972-wrapped-legacy-transactions/4604" />
        

        <id>https://wg-eips.ritovision.com/2972/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:2972"
            label="EIP-2972" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2972/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Two new transaction types for wrapping legacy transactions with and without a chain ID.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Introduces two new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; transactions that are signature compatible with legacy transactions and can be automatically upgraded by any client.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;0x00 || ssz.serialize(yParity, r, s, rlp([nonce, gasPrice, gasLimit, to, value, data]))&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;0x01 || ssz.serialize(yParity, r, s, rlp([nonce, gasPrice, gasLimit, to, value, data, chainId, 0, 0]))&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;We would like to eventually deprecate legacy transactions so we no longer have to retain code in the networking and signer layer that deals with them.
However, we also want to ensure that signatures for transactions that were generated prior to that deprecation are still valid and funds don&#x27;t end up stuck because of an inability to sign a new style transaction.
This EIP provides a mechanism for transmitting&#x2F;including transactions in a way that is &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; compatible while still being signature compatible with legacy transactions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;||&lt;&#x2F;code&gt; is the byte&#x2F;byte-array concatenation operator.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;yParity&lt;&#x2F;code&gt; is the parity (0 for even, 1 for odd) of the &lt;code&gt;y&lt;&#x2F;code&gt; value of the curve point for which &lt;code&gt;r&lt;&#x2F;code&gt; is the &lt;code&gt;x&lt;&#x2F;code&gt; value in the secp256k1 signing process.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;transactions&quot;&gt;Transactions&lt;&#x2F;h3&gt;
&lt;p&gt;As of &lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt;, &lt;code&gt;0x00 || ssz.serialize(yParity, r, s, rlp([nonce, gasPrice, gasLimit, to, value, data]))&lt;&#x2F;code&gt; will be a valid transaction where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;the RLP encoded transaction portion is signed&#x2F;processed&#x2F;handled exactly the same as legacy transactions were signed&#x2F;processed&#x2F;handled, with the exception of the final encoding&lt;&#x2F;li&gt;
&lt;li&gt;TODO: Hashing or Merkleizing for block transaction root&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;As of &lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt;, &lt;code&gt;0x01 || ssz.serialize(yParity, r, s, rlp([nonce, gasPrice, gasLimit, to, value, data, chainId, 0, 0]))&lt;&#x2F;code&gt; will be a valid transaction where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;the RLP encoded transaction portion is signed&#x2F;processed&#x2F;handled exactly the same as legacy transactions were signed&#x2F;processed&#x2F;handled, with the exception of the final encoding&lt;&#x2F;li&gt;
&lt;li&gt;TODO: Hashing or Merkleizing for block transaction root&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The SSZ schema for both transaction types is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Transaction[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  yParity: boolean,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  r: bytes32,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  s: bytes32,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  signedData: bytes,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note: &lt;code&gt;sszencode(yParity, r, s, rlp(...))&lt;&#x2F;code&gt; is the same as &lt;code&gt;yParity || r || s || 0x45000000 || rlp(...)&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;As of &lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt;, &lt;code&gt;rlp(nonce, gasPrice, gasLimit, to, value, data, v, r, s)&lt;&#x2F;code&gt; will no longer be a valid transaction in a block.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;receipts&quot;&gt;Receipts&lt;&#x2F;h3&gt;
&lt;p&gt;As of &lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt;, &lt;code&gt;0 || ssz.serialize(status, cumulativeGasUsed, logsBloom, logs)&lt;&#x2F;code&gt; will be a valid receipt where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;the &lt;code&gt;ReceiptPayload&lt;&#x2F;code&gt; will be generated&#x2F;processed&#x2F;handled exactly the same as legacy receipts were processed&#x2F;handled with the exception of its encoding&lt;&#x2F;li&gt;
&lt;li&gt;TODO: Hashing or Merkleizing for block receipt root&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;As of &lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt;, &lt;code&gt;1 || ssz.serialize(status, cumulativeGasUsed, logsBloom, logs)&lt;&#x2F;code&gt; will be a valid receipt where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;the &lt;code&gt;ReceiptPayload&lt;&#x2F;code&gt; will be generated&#x2F;processed&#x2F;handled exactly the same as legacy receipts were processed&#x2F;handled with the exception of its encoding&lt;&#x2F;li&gt;
&lt;li&gt;TODO: Hashing or Merkleizing for block receipt root&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The SSZ schema for both receipt types is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Log[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  address: bytes20,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  topics: List[bytes32, 4],&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  data: List[uint8, 0xffffff],&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Receipt[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  status: uint8,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  cumulativeGasUsed: uint64,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  logsBloom: BitVector[2048],&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  logs: List[Log, 0xffffff],&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;As of &lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt;, &lt;code&gt;rlp(status, cumulativeGasUsed, logsBloom, logs)&lt;&#x2F;code&gt; will no longer be a valid receipt in a block.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;signature-doesn-t-include-transaction-type-as-first-signature-byte&quot;&gt;Signature doesn&#x27;t include transaction type as first signature byte&lt;&#x2F;h3&gt;
&lt;p&gt;These transaction types are explicitly designed to be signature compatible with legacy transactions, which means we cannot change the data being signed.
See Security Considerations section for more details.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;two-transaction-types-instead-of-one&quot;&gt;Two transaction types instead of one&lt;&#x2F;h3&gt;
&lt;p&gt;With the introduction of typed transactions, we no longer need to do bit packing to avoid changing the shape of the signature.
Legacy transactions introduced chain ID in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt; and wanted to avoid changing the transaction array length, so it bitpacked the chainID into the signature&#x27;s &lt;code&gt;v&lt;&#x2F;code&gt; value.
Since we no longer need to guarantee consistent payload lengths between transaction types, we have opted to have two transaction types with clear fields.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;signature-separate-from-signed-data&quot;&gt;Signature separate from signed data&lt;&#x2F;h3&gt;
&lt;p&gt;When validating a signature, one must first separate out the signed data from the signature and then validate the signature against the signed data.
In the case of legacy transactions, this was a bit of a burden since you had to first RLP decode the transaction, then extract out the signature, then RLP encode a subset of the transaction.
EIP-155 made this process even worse by requiring the validator to further decode the &lt;code&gt;v&lt;&#x2F;code&gt; signature value to extract the chain ID (if present) and include that in the signed data payload.
By having the signed data encoded exactly as it is signed, we make it so one can verify the transaction&#x27;s signature without having to do any decoding before hand.
By having the signature SSZ encoded up front, we can easily extract the signature without even having to use a decoder.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;ssz-for-serialization&quot;&gt;SSZ for serialization&lt;&#x2F;h3&gt;
&lt;p&gt;There is a weak consensus that RLP is not a particularly good encoding scheme for hashed data partially due to its inability to be streamed.
SSZ is almost certainly going to be included in Ethereum at some point in the future, so clients likely have access to an SSZ decoder.
For this particular case, manual decoding without a full SSZ decoder isn&#x27;t too complicated, though it does require doing a bit of &quot;pointer math&quot; since &lt;code&gt;logs&lt;&#x2F;code&gt; is an array of variable length items.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;deprecating-legacy-transactions&quot;&gt;Deprecating legacy transactions&lt;&#x2F;h3&gt;
&lt;p&gt;By deprecating legacy transactions, we make it easier for clients as they can always deal with typed transactions in blocks.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;max-length-of-logs-and-logs-data&quot;&gt;Max length of logs and logs data&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;706&#x2F;&quot;&gt;EIP-706&lt;&#x2F;a&gt; limits devp2p messages to 24 bit length, which gives us a pragmatic cap at that for any single transaction at the moment.
This number seems to far exceed what is reasonable anytime in the near future, so feels like as reasonable of a cap as any.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The new transactions are signature compatible with legacy transactions.
Legacy transactions can be decoded and then encoded as type 0 or type 1 transactions.
This EIP does not introduce any deprecation process for legacy encoded transactions, though the authors do encourage client developers to upgrade legacy encoded transactions to typed transactions as soon as it is reasonable.&lt;&#x2F;p&gt;
&lt;p&gt;The signature compatibility means that a client may see the same transaction encoded both ways.
In such a case the client can choose which to retain, but it is encouraged to retain the typed transaction rather than the legacy encoded transaction.
Since the two transactions would share a nonce, only one will ever be valid in a chain at a time.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;While &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; strongly recommends including the transaction type as the first byte of the signed data, we cannot accomplish that in this case because we need to remain signature compatible with legacy transactions.
Luckily, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; also excludes transaction types &lt;code&gt;0xc0&lt;&#x2F;code&gt; to &lt;code&gt;0xfe&lt;&#x2F;code&gt; from valid transaction types, and the first byte of the signature in this case is in that range so we can be sure this will not conflict with any future transaction types.&lt;&#x2F;p&gt;
&lt;p&gt;A signature for these transaction types &lt;strong&gt;does&lt;&#x2F;strong&gt; collide with legacy transactions, but the transactions will be processed the same so it doesn&#x27;t matter if the transaction ends up included as a legacy transaction or a typed transaction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Swiss Compliant Asset Token</title>
        <published>2020-09-08T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Gianluca Perletti</name><uri>https://github.com/Perlets9</uri>
	</author>
	
	<author>
		<name>Alan Scarpellini</name><uri>https://github.com/alanscarpellini</uri>
	</author>
	
	<author>
		<name>Roberto Gorini</name><uri>https://github.com/robertogorini</uri>
	</author>
	
	<author>
		<name>Manuel Olivi</name><uri>https://github.com/manvel79</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2980/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/2983" />
        

        <id>https://wg-eips.ritovision.com/2980/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:2980"
            label="ERC-2980" />
        

        
        

        
        <summary type="html">An interface for asset tokens, compliant with Swiss Law and compatible with [ERC-20](..&#x2F;00020.md).</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2980/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This new standard is an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; compatible token with restrictions that comply with the following Swiss laws: the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2980&#x2F;.&#x2F;assets&#x2F;Swiss-Confederation-SESTA.pdf&quot;&gt;Stock Exchange Act&lt;&#x2F;a&gt;, the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2980&#x2F;.&#x2F;assets&#x2F;Swiss-Confederation-BA.pdf&quot;&gt;Banking Act&lt;&#x2F;a&gt;, the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2980&#x2F;.&#x2F;assets&#x2F;Swiss-Confederation-FMIA.pdf&quot;&gt;Financial Market Infrastructure Act&lt;&#x2F;a&gt;, the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2980&#x2F;.&#x2F;assets&#x2F;Swiss-Confederation-CISA.pdf&quot;&gt;Act on Collective Investment Schemes&lt;&#x2F;a&gt; and the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2980&#x2F;.&#x2F;assets&#x2F;Swiss-Confederation-AMLA.pdf&quot;&gt;Anti-Money Laundering Act&lt;&#x2F;a&gt;. The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2980&#x2F;.&#x2F;assets&#x2F;Swiss-Confederation-FINSA.pdf&quot;&gt;Financial Services Act&lt;&#x2F;a&gt; and the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2980&#x2F;.&#x2F;assets&#x2F;Swiss-Confederation-FINIA.pdf&quot;&gt;Financial Institutions Act&lt;&#x2F;a&gt; must also be considered. The solution achieved meet also the European jurisdiction.&lt;&#x2F;p&gt;
&lt;p&gt;This new standard meets the new era of asset tokens (known also as &quot;security tokens&quot;). These new methods manage securities ownership during issuance and trading. The issuer is the only role that can manage a white-listing and the only one that is allowed to execute “freeze” or “revoke” functions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;In its ICO guidance dated February 16, 2018, FINMA (Swiss Financial Market Supervisory Authority) defines asset tokens as tokens representing assets and&#x2F;or relative rights (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2980&#x2F;.&#x2F;assets&#x2F;Finma-ICO-Guidelines.pdf&quot;&gt;FINMA ICO Guidelines&lt;&#x2F;a&gt;). It explicitly mentions that asset tokens are analogous to and can economically represent shares, bonds, or derivatives. The long list of relevant financial market laws mentioned above reveal that we need more methods than with Payment and Utility Token.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;The words &quot;asset tokens&quot; and &quot;security tokens&quot; can be considered synonymous.&lt;&#x2F;p&gt;
&lt;p&gt;Every ERC-2980 compliant contract MUST implement the ERC-2980 interface.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;erc-2980-token-contract&quot;&gt;ERC-2980 (Token Contract)&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC2980&lt;&#x2F;span&gt;&lt;span&gt; extends ERC20 &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when funds are reassigned&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FundsReassigned&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when funds are revoked&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FundsRevoked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when an address is frozen&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FundsFrozen&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; target&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; getter to determine if address is in frozenlist&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; frozenlist&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; getter to determine if address is in whitelist&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; whitelist&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The ERC-2980 extends &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;. Due to the indivisible nature of asset tokens, the decimals number MUST be zero.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;whitelist-and-frozenlist&quot;&gt;Whitelist and Frozenlist&lt;&#x2F;h3&gt;
&lt;p&gt;The accomplishment of the Swiss Law requirements is achieved by the use of two distinct lists of address: the Whitelist and the Frozenlist.
Addresses can be added to one or the other list at any time by operators with special privileges, called Issuers, and described below.
Although these lists may look similar, they differ for the following reasons: the Whitelist members are the only ones who can receive tokens from other addresses. There is no restriction on the possibility that these addresses can transfer the tokens already in their ownership.
This can occur when an address, present in the Whitelist, is removed from this list, without however being put in the Frozenlist and remaining in possession of its tokens.
On the other hand, the addresses assigned to the Frozenlist, as suggested by the name itself, have to be considered &quot;frozen&quot;, so they cannot either receive tokens or send tokens to anyone.&lt;&#x2F;p&gt;
&lt;p&gt;Below is an example interface for the implementation of a whitelist-compatible and a frozenlist-compratible contract.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Interface Whitelistable &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; add an address to the whitelist&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * Throws unless `msg.sender` is an Issuer operator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address to add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; true&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if the address was added to the whitelist, false if the address was already in the whitelist&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addAddressToWhitelist&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; remove an address from the whitelist&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * Throws unless `msg.sender` is an Issuer operator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address to remove&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; true&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if the address was removed from the whitelist, false if the address wasn&amp;#39;t in the whitelist in the first place&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; removeAddressFromWhitelist&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Interface Freezable &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; add an address to the frozenlist&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * Throws unless `msg.sender` is an Issuer operator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address to add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; true&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if the address was added to the frozenlist, false if the address was already in the frozenlist&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addAddressToFrozenlist&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; remove an address from the frozenlist&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * Throws unless `msg.sender` is an Issuer operator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address to remove&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; true&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if the address was removed from the frozenlist, false if the address wasn&amp;#39;t in the frozenlist in the first place&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; removeAddressFromFrozenlist&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;issuers&quot;&gt;Issuers&lt;&#x2F;h3&gt;
&lt;p&gt;A key role is played by the Issuer. This figure has the permission to manage Whitelists and Frozenlists, to revoke tokens and reassign them and to transfer the role to another address. No restrictions on the possibility to have more than one Issuer per contract. Issuers are nominated by the Owner of the contract, who also is in charge of remove the role. The possibility of nominating the Owner itself as Issuer at the time of contract creation (or immediately after) is not excluded.&lt;&#x2F;p&gt;
&lt;p&gt;Below is an example interface for the implementation of the Issuer functionalities.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Interface Issuable &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; getter to determine if address has issuer role&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isIssuer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; add a new issuer address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * Throws unless `msg.sender` is the contract owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; true&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if the address was not an issuer, false if the address was already an issuer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addIssuer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; remove an address from issuers&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * Throws unless `msg.sender` is the contract owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; true&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if the address has been removed from issuers, false if the address wasn&amp;#39;t in the issuer list in the first place&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; removeIssuer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Allows the current issuer to transfer its role to a newIssuer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * Throws unless `msg.sender` is an Issuer operator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _newIssuer&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to transfer the issuer role to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferIssuer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _newIssuer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;revoke-and-reassign&quot;&gt;Revoke and Reassign&lt;&#x2F;h3&gt;
&lt;p&gt;Revoke and Reassign methods allow Issuers to move tokens from addresses, even if they are in the Frozenlist. The Revoke method transfers the entire balance of the target address to the Issuer who invoked the method. The Reassign method transfers the entire balance of the target address to another address. These rights for these operations MUST be allowed only to Issuers.&lt;&#x2F;p&gt;
&lt;p&gt;Below is an example interface for the implementation of the Revoke and Reassign functionalities.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Interface RevokableAndReassignable &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Allows the current Issuer to transfer token from an address to itself&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * Throws unless `msg.sender` is an Issuer operator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address from which the tokens are withdrawn&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revoke&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Allows the current Issuer to transfer token from an address to another&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * Throws unless `msg.sender` is an Issuer operator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address from which the tokens are withdrawn&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address who receives the tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; reassign&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;There are currently no token standards that expressly facilitate conformity to securities law and related regulations. EIP-1404 (Simple Restricted Token Standard) it’s not enough to address FINMA requirements around re-issuing securities to Investors.
In Swiss law, an issuer must eventually enforce the restrictions of their token transfer with a “freeze” function. The token must be “revocable”, and we need to apply a white-list method for AML&#x2F;KYC checks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP does not introduce backward incompatibilities and is backward compatible with the older ERC-20 token standard.
This standard allows the implementation of ERC-20 functions transfer, transferFrom, approve and allowance alongside to make a token fully compatible with ERC-20.
The token MAY implement decimals() for backward compatibility with ERC-20. If implemented, it MUST always return 0.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The security considerations mainly concern the role played by the Issuers. This figure, in fact, is not generally present in common ERC-20 tokens but has very powerful rights that allow him to move tokens without being in possession and freeze other addresses, preventing them from transferring tokens. It must be the responsibility of the owner to ensure that the addresses that receive this charge remain in possession of it only for the time for which they have been designated to do so, thus preventing any abuse.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>SET_INDESTRUCTIBLE opcode</title>
        <published>2020-09-04T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2937/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2937-set-indestructible/4571" />
        

        <id>https://wg-eips.ritovision.com/2937/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2937"
            label="EIP-2937" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2937/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Add a &lt;code&gt;SET_INDESTRUCTIBLE (0xA8)&lt;&#x2F;code&gt; opcode that prevents the contract from calling &lt;code&gt;SELFDESTRUCT (0xFF)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The intended use case would be for contracts to make their first byte of code be the &lt;code&gt;SET_INDESTRUCTIBLE&lt;&#x2F;code&gt; opcode if they wish to serve as libraries that guarantee to users that their code will exist unmodified forever. This is useful in account abstraction as well as other contexts.&lt;&#x2F;p&gt;
&lt;p&gt;Unlike EIPs that disable the &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; opcode entirely, this EIP does not modify behavior of any existing contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Add a transaction-wide global variable &lt;code&gt;globals.indestructible: Set[Address]&lt;&#x2F;code&gt; (i.e. a variable that operates the same way as the selfdestructs set), initialized to the empty set.&lt;&#x2F;p&gt;
&lt;p&gt;Add a &lt;code&gt;SET_INDESTRUCTIBLE&lt;&#x2F;code&gt; opcode at &lt;code&gt;0xA8&lt;&#x2F;code&gt;, with gas cost &lt;code&gt;G_base&lt;&#x2F;code&gt;, that adds the current &lt;code&gt;callee&lt;&#x2F;code&gt; to the &lt;code&gt;globals.indestructible&lt;&#x2F;code&gt; set. If in the current execution context the &lt;code&gt;callee&lt;&#x2F;code&gt; is in &lt;code&gt;globals.indestructible&lt;&#x2F;code&gt;, the &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; opcode throws an exception.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Alternative proposals to this include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Simply banning &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; outright. This would be ideal, but has larger backwards compatibility issues.&lt;&#x2F;li&gt;
&lt;li&gt;Using a local variable instead of a global variable. This is problematic because it would be broken by &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This breaks forward compatibility with &lt;em&gt;some&lt;&#x2F;em&gt; forms of state rent, which would simply delete contracts that get too old without paying some maintenance fee. However, this is not the case with all state size control schemes; for example this is not an issue if we use &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ledgerwatch.github.io&#x2F;regenesis_plan.html&quot;&gt;ReGenesis&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;If &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; is ever removed in the future, this EIP would simply become a no-op.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Account Abstraction</title>
        <published>2020-09-04T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	<author>
		<name>Ansgar Dietrichs</name><uri>https://github.com/adietrichs</uri>
	</author>
	
	<author>
		<name>Matt Garnett</name><uri>https://github.com/lightclient</uri>
	</author>
	
	<author>
		<name>Will Villanueva</name><uri>https://github.com/villanuevawill</uri>
	</author>
	
	<author>
		<name>Sam Wilson</name><uri>https://github.com/SamWilsn</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2938/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2938-account-abstraction/4630" />
        

        <id>https://wg-eips.ritovision.com/2938/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:2938"
            label="EIP-2938" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2938/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Account abstraction (AA) allows a contract to be the top-level account that pays fees and starts transaction execution.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;See also: &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum-magicians.org&#x2F;t&#x2F;implementing-account-abstraction-as-part-of-eth1-x&#x2F;4020&quot;&gt;https:&#x2F;&#x2F;ethereum-magicians.org&#x2F;t&#x2F;implementing-account-abstraction-as-part-of-eth1-x&#x2F;4020&lt;&#x2F;a&gt; and the links therein for historical work and motivation.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Transaction validity, as of Muir Glacier, is defined rigidly by the protocol: ECDSA signature, a simple nonce, and account balance. Account abstraction extends the validity conditions of transactions with the execution of arbitrary EVM bytecode (with some limits on what state may be accessed.) To signal validity, we propose a new EVM opcode &lt;code&gt;PAYGAS&lt;&#x2F;code&gt;, which also sets the gas price and gas limit the contract is willing to pay.&lt;&#x2F;p&gt;
&lt;p&gt;We split account abstraction into two tiers: &lt;strong&gt;single-tenant AA&lt;&#x2F;strong&gt;, which is intended to support wallets or other use cases with few participants, and &lt;strong&gt;multi-tenant AA&lt;&#x2F;strong&gt;, which is intended to support applications with many participants (eg. tornado.cash, Uniswap).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The existing limitations preclude innovation in a number of important areas, particularly:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Smart contract wallets that use signature verification other than ECDSA (eg. Schnorr, BLS, post-quantum...)&lt;&#x2F;li&gt;
&lt;li&gt;Smart contract wallets that include features such as multisig verification or social recovery, reducing the highly prevalent risk of funds being lost or stolen&lt;&#x2F;li&gt;
&lt;li&gt;Privacy-preserving systems like &lt;a rel=&quot;external&quot; href=&quot;http:&#x2F;&#x2F;tornado.cash&quot;&gt;tornado.cash&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Attempts to improve gas efficiency of DeFi protocols by preventing transactions that don&#x27;t satisfy high-level conditions (eg. existence of a matching order) from being included on chain&lt;&#x2F;li&gt;
&lt;li&gt;Users being able to pay for transaction fees in a token other than ETH (eg. by converting that token into the ETH needed for fees inside the transaction in real-time)&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Most of the above use cases are currently possible using intermediaries, most notably the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.opengsn.org&#x2F;&quot;&gt;Gas Station Network&lt;&#x2F;a&gt; and application-specific alternatives. These implementations are (i) technically inefficient, due to the extra 21000 gas to pay for the relayer, (ii) economically inefficient, as relayers need to make a profit on top of the gas fees that they pay. Additionally, use of intermediary protocols means that these applications cannot simply rely on base Ethereum infrastructure and need to rely on extra protocols that have smaller userbases and higher risk of no longer being available at some future date.&lt;&#x2F;p&gt;
&lt;p&gt;Out of the five use cases above, single-tenant AA approximately supports (1) and (2), and multi-tenant AA approximately supports (3) and (4). We discuss the differences between the two tiers in the specification and rationale sections below.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;single-tenant&quot;&gt;Single Tenant&lt;&#x2F;h3&gt;
&lt;p&gt;After &lt;code&gt;FORK_BLOCK&lt;&#x2F;code&gt;, the following changes will be recognized by the protocol.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;&lt;code&gt;AA_ENTRY_POINT&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;&lt;code&gt;AA_TX_TYPE&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;&lt;code&gt;FORK_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;TBD&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;&lt;code&gt;AA_BASE_GAS_COST&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;15000&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;new-transaction-type&quot;&gt;New Transaction Type&lt;&#x2F;h4&gt;
&lt;p&gt;A new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; transaction with type &lt;code&gt;AA_TX_TYPE&lt;&#x2F;code&gt; is introduced. Transactions of this type are referred to as &quot;AA transactions&quot;. Their payload should be interpreted as &lt;code&gt;rlp([nonce, target, data])&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The base gas cost of this transaction is set to &lt;code&gt;AA_BASE_GAS_COST&lt;&#x2F;code&gt; instead of 21000 to reflect the lack of &quot;intrinsic&quot; ECDSA and signature.&lt;&#x2F;p&gt;
&lt;p&gt;Nonces are processed analogously to existing transactions (check &lt;code&gt;tx.nonce == tx.target.nonce&lt;&#x2F;code&gt;, transaction is invalid if this fails, otherwise proceed and immediately set &lt;code&gt;tx.nonce += 1&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;Note that this transaction type has no intrinsic gas limit; when beginning execution, the gas limit is simply set to the remaining gas in the block (ie. &lt;code&gt;block.gas_limit&lt;&#x2F;code&gt; minus gas spent on previous transactions), and the &lt;code&gt;PAYGAS&lt;&#x2F;code&gt; opcode (see below) can adjust the gas limit downwards.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;transaction-wide-global-variables&quot;&gt;Transaction-wide global variables&lt;&#x2F;h4&gt;
&lt;p&gt;Introduce some new transaction-wide global variables. These variables work similarly (in particular, have similar reversion logic) to the SSTORE refunds counter.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Variable&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Initial value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;globals.transaction_fee_paid&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;bool&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;False if type(tx) == AA_TX_TYPE else True&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;globals.gas_price&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;int&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0 if type(tx) == AA_TX_TYPE else tx.gas_price&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;globals.gas_limit&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;int&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0 if type(tx) == AA_TX_TYPE else tx.gas_limit&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;nonce-0x48-opcode&quot;&gt;&lt;code&gt;NONCE (0x48)&lt;&#x2F;code&gt; Opcode&lt;&#x2F;h4&gt;
&lt;p&gt;A new opcode &lt;code&gt;NONCE (0x48)&lt;&#x2F;code&gt; is introduced, with gas cost &lt;code&gt;G_base&lt;&#x2F;code&gt;, which pushes the &lt;code&gt;nonce&lt;&#x2F;code&gt; of the callee onto the stack.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;paygas-0x49-opcode&quot;&gt;&lt;code&gt;PAYGAS (0x49)&lt;&#x2F;code&gt; Opcode&lt;&#x2F;h4&gt;
&lt;p&gt;A new opcode &lt;code&gt;PAYGAS (0x49)&lt;&#x2F;code&gt; is introduced, with gas cost &lt;code&gt;G_base&lt;&#x2F;code&gt;. It takes two arguments off the stack: (top) &lt;code&gt;version_number&lt;&#x2F;code&gt;, (second from top) &lt;code&gt;memory_start&lt;&#x2F;code&gt;. In the initial implementation, it will &lt;code&gt;assert version_number == 0&lt;&#x2F;code&gt; and read:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;gas_price = bytes_to_int(vm.memory[memory_start: memory_start + 32])&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;gas_limit = bytes_to_int(vm.memory[memory_start + 32: memory_start + 64])&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Both reads use similar mechanics to MLOAD and CALL, so memory expands if needed.&lt;&#x2F;p&gt;
&lt;p&gt;Future hard forks may add support for different version numbers, in which case the opcode may take different-sized memory slices and interpret them differently. Two particular potential use cases are &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;notes.ethereum.org&#x2F;@vbuterin&#x2F;BkSQmQTS8&quot;&gt;EIP 1559&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethresear.ch&#x2F;t&#x2F;another-simple-gas-fee-model-the-escalator-algorithm-from-the-agoric-papers&#x2F;6399&quot;&gt;the escalator mechanism&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The opcode works as follows. If all three of the following conditions (in addition to the version number check above) are satisfied:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The account&#x27;s balance is &lt;code&gt;&amp;gt;= gas_price * gas_limit&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;globals.transaction_fee_paid == False&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;We are in a top-level AA execution frame (ie. if the currently running EVM execution exits or reverts, the EVM execution of the entire transaction is finished)&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Then do the following:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Subtract &lt;code&gt;gas_price * gas_limit&lt;&#x2F;code&gt; from the contract&#x27;s balance&lt;&#x2F;li&gt;
&lt;li&gt;Set &lt;code&gt;globals.transaction_fee_paid&lt;&#x2F;code&gt; to &lt;code&gt;True&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Set &lt;code&gt;globals.gas_price&lt;&#x2F;code&gt; to &lt;code&gt;gas_price&lt;&#x2F;code&gt;, and &lt;code&gt;globals.gas_limit&lt;&#x2F;code&gt; to &lt;code&gt;gas_limit&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Set the remaining gas in the current execution context to equal &lt;code&gt;gas_limit&lt;&#x2F;code&gt; minus the gas that was already consumed&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;If any of the above three conditions are not satisfied, throw an exception.&lt;&#x2F;p&gt;
&lt;p&gt;At the end of execution of an AA transaction, it is mandatory that &lt;code&gt;globals.transaction_fee_paid == True&lt;&#x2F;code&gt;; if it is not, then the transaction is invalid. At the end of execution, the contract is refunded &lt;code&gt;globals.gas_price * remaining_gas&lt;&#x2F;code&gt; for any remaining gas, and &lt;code&gt;(globals.gas_limit - remaining_gas) * globals.gas_price&lt;&#x2F;code&gt; is transferred to the miner.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;PAYGAS&lt;&#x2F;code&gt; also serves as an EVM execution &lt;em&gt;checkpoint&lt;&#x2F;em&gt;: if the top-level execution frame reverts after &lt;code&gt;PAYGAS&lt;&#x2F;code&gt; has been called, then the execution only reverts up to the point right after &lt;code&gt;PAYGAS&lt;&#x2F;code&gt; was called, and exits there. In that case, the contract receives no refund, and &lt;code&gt;globals.gas_limit * globals.gas_price&lt;&#x2F;code&gt; is transferred to the miner.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;replay-protection&quot;&gt;Replay Protection&lt;&#x2F;h4&gt;
&lt;p&gt;One of the two following approaches must be implemented to safeguard against replay attacks.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;require-set-indestructible&quot;&gt;Require &lt;code&gt;SET_INDESTRUCTIBLE&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;p&gt;Require that contracts targeted by AA transactions begin with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2937&#x2F;&quot;&gt;EIP-2937&lt;&#x2F;a&gt;&#x27;s &lt;code&gt;SET_INDESTRUCTIBLE&lt;&#x2F;code&gt; opcode. AA transactions targeting contracts that do not begin with &lt;code&gt;SET_INDESTRUCTIBLE&lt;&#x2F;code&gt; are invalid, and cannot be included in blocks.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;AA_PREFIX&lt;&#x2F;code&gt; would need to be modified to include this opcode.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;preserve-nonce-on-selfdestruct&quot;&gt;Preserve Nonce on &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;p&gt;The other option is to preserve contract nonces across &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; invocations, instead of setting the nonce to zero.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;miscellaneous&quot;&gt;Miscellaneous&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;If &lt;code&gt;CALLER (0x33)&lt;&#x2F;code&gt; is invoked in the first frame of
execution of a call initiated by an AA transaction, then it must return &lt;code&gt;AA_ENTRY_POINT&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;ORIGIN (0x32)&lt;&#x2F;code&gt; is invoked in any frame of execution of an AA
transaction it must return &lt;code&gt;AA_ENTRY_POINT&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;GASPRICE (0x3A)&lt;&#x2F;code&gt; opcode now pushes the value &lt;code&gt;globals.gas_price&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note that the new definition of &lt;code&gt;GASPRICE&lt;&#x2F;code&gt; does not lead to any changes in behavior in non-AA transactions, because &lt;code&gt;globals.gas_price&lt;&#x2F;code&gt; is initialized to &lt;code&gt;tx.gas_price&lt;&#x2F;code&gt; and cannot be changed as &lt;code&gt;PAYGAS&lt;&#x2F;code&gt; cannot be called.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;mining-and-rebroadcasting-strategies&quot;&gt;Mining and Rebroadcasting Strategies&lt;&#x2F;h4&gt;
&lt;p&gt;Much of the complexity in account abstraction originates from the strategies used by miners and validating nodes to determine whether or not to accept and rebroadcast transactions. Miners need to determine if a transaction will actually pay the fee if they include it after only a small amount of processing to avoid &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;hackingdistributed.com&#x2F;2016&#x2F;06&#x2F;28&#x2F;ethereum-soft-fork-dos-vector&#x2F;&quot;&gt;DoS attacks&lt;&#x2F;a&gt;. Validating nodes need to perform an essentially identical verification to determine whether or not to rebroadcast the transaction.&lt;&#x2F;p&gt;
&lt;p&gt;By keeping the consensus changes minimal, this EIP allows for gradual introduction of AA mempool support by miners and validating nodes. Initial support would be focused on enabling simple, single-tenant use cases, while later steps would additionally allow for more complex, multi-tenant use cases. Earlier stages are deliberately more fully fleshed-out than later stages, as there is still more time before later stages need to be implemented.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;transactions-with-fixed-nonces&quot;&gt;Transactions with Fixed Nonces&lt;&#x2F;h5&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;VERIFICATION_GAS_MULTIPLIER&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;6&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;VERIFICATION_GAS_CAP&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;= VERIFICATION_GAS_MULTIPLIER * AA_BASE_GAS_COST = 90000&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;AA_PREFIX&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;if(msg.sender != shr(-1, 12)) { LOG1(msg.sender, msg.value); return }&lt;&#x2F;code&gt;; compilation to EVM TBD&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;When a node receives an AA transaction, they process it (i.e. attempt to execute it against the current chain head&#x27;s post-state) to determine its validity, continuing to execute until one of several events happens:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If the code of the &lt;code&gt;target&lt;&#x2F;code&gt; is NOT prefixed with &lt;code&gt;AA_PREFIX&lt;&#x2F;code&gt;, exit with failure&lt;&#x2F;li&gt;
&lt;li&gt;If the execution hits any of the following, exit with failure:
&lt;ul&gt;
&lt;li&gt;An environment opcode (&lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt;, &lt;code&gt;COINBASE&lt;&#x2F;code&gt;, &lt;code&gt;TIMESTAMP&lt;&#x2F;code&gt;, &lt;code&gt;NUMBER&lt;&#x2F;code&gt;, &lt;code&gt;DIFFICULTY&lt;&#x2F;code&gt;, &lt;code&gt;GASLIMIT&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;BALANCE&lt;&#x2F;code&gt; (of any account, including the &lt;code&gt;target&lt;&#x2F;code&gt; itself)&lt;&#x2F;li&gt;
&lt;li&gt;An external call&#x2F;create that changes the &lt;code&gt;callee&lt;&#x2F;code&gt; to anything but the &lt;code&gt;target&lt;&#x2F;code&gt; or a precompile (&lt;code&gt;CALL&lt;&#x2F;code&gt;, &lt;code&gt;CALLCODE&lt;&#x2F;code&gt;, &lt;code&gt;STATICCALL&lt;&#x2F;code&gt;, &lt;code&gt;CREATE&lt;&#x2F;code&gt;, &lt;code&gt;CREATE2&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;An external state access that reads code (&lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt;, &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt;, &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt;, but also &lt;code&gt;CALLCODE&lt;&#x2F;code&gt; and &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;), unless the address of the code that is read is the &lt;code&gt;target&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;If the execution consumes more gas than &lt;code&gt;VERIFICATION_GAS_CAP&lt;&#x2F;code&gt; (specified above), or more gas than is available in the block, exit with failure&lt;&#x2F;li&gt;
&lt;li&gt;If the execution reaches &lt;code&gt;PAYGAS&lt;&#x2F;code&gt;, then exit with success or failure depending on whether or not the balance is sufficient (e.g. &lt;code&gt;balance &amp;gt;= gas_price * gas_limit&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Nodes do not keep transactions with nonces higher than the current valid nonce in the mempool. If the mempool already contains a transaction with a currently valid nonce, another incoming transaction to the same contract and with the same nonce either replaces the existing one (if its gas price is sufficiently higher) or is dropped. Thus, the mempool keeps only at most one pending transaction per account.&lt;&#x2F;p&gt;
&lt;p&gt;While processing a new block, take note of which accounts were the &lt;code&gt;target&lt;&#x2F;code&gt; of an AA transaction (each block currently has &lt;code&gt;12500000&lt;&#x2F;code&gt; gas and an AA transaction costs &lt;code&gt;&amp;gt;= 15000&lt;&#x2F;code&gt; so there would be at most &lt;code&gt;12500000 &#x2F;&#x2F; 15000 = 833&lt;&#x2F;code&gt; targeted accounts). Drop all pending transactions targeting those accounts. All other transactions remain in the mempool.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;single-tenant-1&quot;&gt;Single Tenant+&lt;&#x2F;h3&gt;
&lt;p&gt;If the &lt;a rel=&quot;external&quot; href=&quot;http:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;pull&#x2F;2937&quot;&gt;indestructible contracts EIP&lt;&#x2F;a&gt; is added, Single Tenant AA can be adapted to allow for &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; during transaction verification: during execution of a new AA transaction, external state access that reads code (&lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt;, &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt;, &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt;, &lt;code&gt;CALLCODE&lt;&#x2F;code&gt;, &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;) of any contract whose first byte is the &lt;code&gt;SET_INDESTRUCTIBLE&lt;&#x2F;code&gt; opcode is no longer banned. However, calls to anything but the &lt;code&gt;target&lt;&#x2F;code&gt; or a precompile that change the &lt;code&gt;callee&lt;&#x2F;code&gt; (i.e., calls other than &lt;code&gt;CALLCODE&lt;&#x2F;code&gt; and &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;) are still not permitted.&lt;&#x2F;p&gt;
&lt;p&gt;If the &lt;a rel=&quot;external&quot; href=&quot;http:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;pull&#x2F;2975&quot;&gt;IS_STATIC EIP&lt;&#x2F;a&gt; is added, the list of allowed prefixes can be extended to allow a prefix that enables incoming static calls but not state-changing calls.&lt;&#x2F;p&gt;
&lt;p&gt;The list of allowed prefixes can also be extended to enable other benign use cases (eg. logging incoming payments).&lt;&#x2F;p&gt;
&lt;p&gt;External calls &lt;em&gt;into&lt;&#x2F;em&gt; AA accounts can be allowed as follows. We can add an opcode &lt;code&gt;RESERVE_GAS&lt;&#x2F;code&gt;, which takes as argument a value &lt;code&gt;N&lt;&#x2F;code&gt; and has simple behavior: immediately burn &lt;code&gt;N&lt;&#x2F;code&gt; gas and add &lt;code&gt;N&lt;&#x2F;code&gt; gas to the refund. We then add an allowed &lt;code&gt;AA_PREFIX&lt;&#x2F;code&gt; that reserves &lt;code&gt;&amp;gt;= AA_BASE_GAS_COST * 2&lt;&#x2F;code&gt; gas. This ensures that at least &lt;code&gt;AA_BASE_GAS_COST&lt;&#x2F;code&gt; gas must be spent (as refunds can refund max 50% of total consumption) in order to call into an account and invalidate transactions targeting that account in the mempool, preserving that invariant.&lt;&#x2F;p&gt;
&lt;p&gt;Note that accounts may also opt to set a higher &lt;code&gt;RESERVE_GAS&lt;&#x2F;code&gt; value in order to safely have a higher &lt;code&gt;VERIFICATION_GAS_CAP&lt;&#x2F;code&gt;; the goal would be to preserve a &lt;code&gt;VERIFICATION_GAS_MULTIPLIER&lt;&#x2F;code&gt;-to-1 ratio between the minimum gas cost to edit an account (ie. half its &lt;code&gt;RESERVE_GAS&lt;&#x2F;code&gt;) and the &lt;code&gt;VERIFICATION_GAS_CAP&lt;&#x2F;code&gt; that is permitted that account. This would also preserve invariants around maximum reverification gas consumption that are implied by the previous section.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;multi-tenant-beyond&quot;&gt;Multi-Tenant &amp;amp; Beyond&lt;&#x2F;h3&gt;
&lt;p&gt;In a later stage, we can add support for multiple pending transactions per account in the mempool. The main challenge here is that a single transaction can potentially cause state changes that invalidate all other transactions to that same account. Additionally, if we naively prioritize transactions by gasprice, there is an attack vector where the user willing to pay the highest gasprice publishes many (mutually exclusive) versions of their transaction with small alterations, thereby pushing everyone else&#x27;s transactions out of the mempool.&lt;&#x2F;p&gt;
&lt;p&gt;Here is a sketch of a strategy for mitigating this problem. We would require incoming transactions to contain an &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;blob&#x2F;master&#x2F;EIPS&#x2F;.&#x2F;02930.md&quot;&gt;EIP-2930&lt;&#x2F;a&gt;-style access list detailing the storage slots that the transaction reads or modifies, and make it binding; that is, accesses outside the access list would be invalid. A transaction would only be included in the mempool if its access list is disjoint from the access lists of other transactions in the mempool (or if its gasprice is higher). An alternative way to think about this is to have per-storage-slot mempools instead of just per-account mempools, except a transaction could be part of multiple per-storage-slot mempools (if desired it could be capped to eg. 5 storage slots).&lt;&#x2F;p&gt;
&lt;p&gt;Note also that multi-tenant AA will almost certainly require allowing miners to edit the nonces of incoming transactions to put them into sequence, with the result that the final hash of a transaction is unpredictable at publication time. Clients will need to explicitly work around this.&lt;&#x2F;p&gt;
&lt;p&gt;More research is required to refine these ideas, and this is left for later work.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The core problem in an account abstraction setup is always that miners and network nodes need to be able to verify that a transaction that they attempt to include, or rebroadcast, will actually pay a fee. Currently, this is fairly simple, because a transaction is guaranteed to be includable and pay a fee as long as the signature and nonce are valid and the balance and gasprice are sufficient. These checks can be done quickly.&lt;&#x2F;p&gt;
&lt;p&gt;In an account abstraction setup, the goal is to allow accounts to specify EVM code that can establish more flexible conditions for a transaction&#x27;s validity, but with the requirement that this EVM code can be quickly verified, with the same safety properties as the existing setup.&lt;&#x2F;p&gt;
&lt;p&gt;In a normal transaction, the top-level call goes from the &lt;code&gt;tx.sender&lt;&#x2F;code&gt; to &lt;code&gt;tx.to&lt;&#x2F;code&gt; and carries with it &lt;code&gt;tx.value&lt;&#x2F;code&gt;. In an AA transaction, the top-level call goes from the &lt;em&gt;entry point address&lt;&#x2F;em&gt; (&lt;code&gt;0xFFFF...FF&lt;&#x2F;code&gt;) to the &lt;code&gt;tx.target&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The top-level code execution is expected to be split into two phases: the shorter &lt;strong&gt;verification phase&lt;&#x2F;strong&gt; (before &lt;code&gt;PAYGAS&lt;&#x2F;code&gt;) and the longer &lt;strong&gt;execution phase&lt;&#x2F;strong&gt; (after &lt;code&gt;PAYGAS&lt;&#x2F;code&gt;). If execution throws an exception during the verification phase, the transaction is invalid, much like a transaction with an invalid signature in the current system. If execution throws an exception after the verification phase, the transaction pays fees, and so the miner can still include it.&lt;&#x2F;p&gt;
&lt;p&gt;The transition between different stages of AA is entirely done through changes in miner strategy. The first stage supports &lt;strong&gt;single-tenant AA&lt;&#x2F;strong&gt;, where the only use cases that can be easily implemented are where the &lt;code&gt;tx.target&lt;&#x2F;code&gt; is a contract representing a user account (that is, a smart contract wallet, eg. multisig). Later stages improve support for eg. logs and libraries, and also move toward supporting &lt;strong&gt;multi-tenant AA&lt;&#x2F;strong&gt;, where the goal is to try to support cases where the &lt;code&gt;tx.target&lt;&#x2F;code&gt; represents an &lt;em&gt;application&lt;&#x2F;em&gt; that processes incoming activity from multiple users.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;nonces-still-enshrined-in-single-tenant-aa&quot;&gt;Nonces still enshrined in single-tenant AA&lt;&#x2F;h3&gt;
&lt;p&gt;Nonces are still enforced in single-tenant AA to ensure that single-target AA does not break the invariant that each transaction (and hence each transaction hash) can only be included in the chain once. While there is some limited value in allowing arbitrary-order transaction inclusion in single-tenant AA, there is not enough value to justify breaking that invariant.&lt;&#x2F;p&gt;
&lt;p&gt;Note that nonces in AA accounts do end up having a dual-purpose: they are both there for replay protection and for contract address generation when using the &lt;code&gt;CREATE&lt;&#x2F;code&gt; opcode. This does mean that a single transaction could increment the nonce by more than 1. This is deemed acceptable, as the other mechanics introduced by AA already break the ability to easily verify that a chain longer than one transaction can be processed. However, we strongly recommend that AA contracts use &lt;code&gt;CREATE2&lt;&#x2F;code&gt; instead of &lt;code&gt;CREATE&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;In multi-tenant AA, as mentioned above, nonces are expected to become malleable and applications that use multi-tenant AA systems would need to manage this.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;nonces-are-exposed-to-the-evm&quot;&gt;Nonces are exposed to the EVM&lt;&#x2F;h3&gt;
&lt;p&gt;This is done to allow signature checking done in validation code to validate the nonce.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;replay-protection-1&quot;&gt;Replay Protection&lt;&#x2F;h3&gt;
&lt;p&gt;One of the above two approaches (requiring &lt;code&gt;SET_INDESTRUCTIBLE&lt;&#x2F;code&gt; or modifying &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; behavior) must be implemented so that nonces cannot be reused. It must be a consensus change, and not simply part of &lt;code&gt;AA_PREFIX&lt;&#x2F;code&gt;, so that transaction hash uniqueness is maintained.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;miners-refuse-transactions-that-access-external-data-or-the-target-s-own-balance-before-paygas&quot;&gt;Miners refuse transactions that access external data or the target&#x27;s own balance, before PAYGAS&lt;&#x2F;h3&gt;
&lt;p&gt;An important property of traditional transactions is that activity happening as part of transactions that originate outside of some given account X cannot make transactions whose sender is X invalid. The only state change that an outside transaction can impose on X is increasing its balance, which cannot invalidate a transaction.&lt;&#x2F;p&gt;
&lt;p&gt;Allowing AA contracts to access external data (both other accounts and environment variables such as GASPRICE, DIFFICULTY, etc.) before they call &lt;code&gt;PAYGAS&lt;&#x2F;code&gt; (ie. during the verification phase) breaks this invariant. For example, imagine someone sends many thousands of AA transactions that perform an external call &lt;code&gt;if FOO.get_number() != 5: throw()&lt;&#x2F;code&gt;. &lt;code&gt;FOO.number&lt;&#x2F;code&gt; might be set to &lt;code&gt;5&lt;&#x2F;code&gt; when those transactions are all sent, but a single transaction to &lt;code&gt;FOO&lt;&#x2F;code&gt; could set the &lt;code&gt;number&lt;&#x2F;code&gt; to something else, invalidating &lt;em&gt;all of the thousands of AA transactions&lt;&#x2F;em&gt; that depend on it. This would be a serious DoS vector.&lt;&#x2F;p&gt;
&lt;p&gt;The one allowed exception is contracts that are indestructible (that is, whose first byte is the &lt;code&gt;SET_INDESTRUCTIBLE&lt;&#x2F;code&gt; opcode defined in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;hackmd.io&#x2F;@HWeNw8hNRimMm2m2GH56Cw&#x2F;SyNT3Cdmw&quot;&gt;this EIP&lt;&#x2F;a&gt;). This is a safe exception, because the data that is being read cannot be changed.&lt;&#x2F;p&gt;
&lt;p&gt;Disallowing reading &lt;code&gt;BALANCE&lt;&#x2F;code&gt; blocks a milder attack vector: an attacker could force a transaction to be reprocessed at a mere cost of 6700 gas (not 15000 or 21000), in the worst case more than doubling the number of transactions that would need to be reprocessed.&lt;&#x2F;p&gt;
&lt;p&gt;In the long term, AA could be expanded to allow reading external data, though protections such as mandatory access lists would be required.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;aa-transactions-must-call-contracts-with-prefix&quot;&gt;AA transactions must call contracts with prefix&lt;&#x2F;h3&gt;
&lt;p&gt;The prelude is used to ensure that &lt;em&gt;only&lt;&#x2F;em&gt; AA transactions can call the contract. This is another measure taken to ensure the invariant described above. If this check did not occur, it would be possible for a transaction originating outside some AA account X to call into X and make a storage change, forcing transactions targeting that account to be reprocessed at the cost of a mere 5000 gas.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;multi-tenant-aa&quot;&gt;Multi-tenant AA&lt;&#x2F;h3&gt;
&lt;p&gt;Multi-tenant AA extends single-tenant AA by &lt;strong&gt;better handling cases where distinct and uncoordinated users attempt to send transactions for&#x2F;to the same account and those transactions may interfere with each other&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;We can understand the value of multi-tenant AA by examining two example use cases: (i) &lt;a rel=&quot;external&quot; href=&quot;http:&#x2F;&#x2F;tornado.cash&quot;&gt;tornado.cash&lt;&#x2F;a&gt; and (ii) &lt;a rel=&quot;external&quot; href=&quot;http:&#x2F;&#x2F;uniswap.exchange&quot;&gt;Uniswap&lt;&#x2F;a&gt;. In both of these cases, there is a single central contract that represents the application, and not any specific user. Nevertheless, there is important value in using abstraction to do application-specific validation of transactions.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;tornado-cash&quot;&gt;Tornado Cash&lt;&#x2F;h4&gt;
&lt;p&gt;The tornado.cash workflow is as follows:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;A user sends a transaction to the TC contract, depositing some standard quantity of coins (eg. 1 ETH). A record of their deposit, containing the hash of a secret known by the user, is added to a Merkle tree whose root is stored in the TC contract.&lt;&#x2F;li&gt;
&lt;li&gt;When that user later wants to withdraw, they generate and send a ZK-SNARK proving that they know a secret whose hash is in a leaf somewhere in the deposit tree (without revealing where). The TC contract verifies the ZK-SNARK, and also verifies that a nullifier value (also derivable from the secret) has not yet been spent. The contract sends 1 ETH to the user&#x27;s desired address, and saves a record that the user&#x27;s nullifier has been spent.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The privacy provided by TC arises because when a user makes a withdrawal, they can prove that it came from &lt;em&gt;some&lt;&#x2F;em&gt; unique deposit, but no one other than the user knows which deposit it came from. However, implementing TC naively has a fatal flaw: the user usually does not yet have ETH in their withdrawal address, and if the user uses their deposit address to pay for gas, that creates an on-chain link between their deposit address and their withdrawal address.&lt;&#x2F;p&gt;
&lt;p&gt;Currently, this is solved via relayers; a third-party relayer verifies the ZK-SNARK and unspent status of the nullifier, publishes the transaction using their own ETH to pay for gas, and collects the fee back from the user from the TC contract.&lt;&#x2F;p&gt;
&lt;p&gt;AA allows this without relayers: the user could simply send an AA transaction targeting the TC contract, the ZK-SNARK verification and the nullifier checking can be done in the verification step, and PAYGAS can be called directly after that. This allows the withdrawer to pay for gas directly out of the coins going to their withdrawal address, avoiding the need for relayers or for an on-chain link to their deposit address.&lt;&#x2F;p&gt;
&lt;p&gt;Note that fully implementing this functionality requires AA to be structured in a way that supports multiple users sending withdrawals at the same time (requiring nonces would make this difficult), and that allows a single account to support both AA transactions (the withdrawals) and externally-initiated calls (the deposits).&lt;&#x2F;p&gt;
&lt;h4 id=&quot;uniswap&quot;&gt;Uniswap&lt;&#x2F;h4&gt;
&lt;p&gt;A new version of Uniswap could be built that allows transactions to be sent that directly target the Uniswap contract. Users could deposit tokens into Uniswap ahead of time, and Uniswap would store their balances as well as a public key that transactions spending those balances could be verified against. An AA-initiated Uniswap trade would only be able to spend these internal balances.&lt;&#x2F;p&gt;
&lt;p&gt;This would be useless for normal traders, as normal traders have their coins outside the Uniswap contract, but it would be a powerful boon to arbitrageurs. Arbitrageurs would deposit their coins into Uniswap, and they would be able to send transactions that perform arbitrage every time external market conditions change, and logic such as price limits could be enforced during the verification step. Hence, transactions that do not get in (eg. because some other arbitrageur made the trade first) would not be included on-chain, allowing arbitrageurs to not pay gas, and reducing the number of &quot;junk&quot; transactions that get included on-chain. This could significantly increase both de-facto blockchain scalability as well as market efficiency, as arbitrageurs would be able to much more finely correct for cross-exchange discrepancies between prices.&lt;&#x2F;p&gt;
&lt;p&gt;Note that here also, Uniswap would need to support both AA transactions and externally-initiated calls.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This AA implementation preserves the existing transaction type. The use of &lt;code&gt;assert origin == caller&lt;&#x2F;code&gt; to verify that an account is an EOA remains sound, but is not extensible to AA accounts; AA transactions will always have &lt;code&gt;origin == AA_ENTRY_POINT&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Badly-designed single-tenant AA contracts will break the transaction non-malleability invariant. That is, it is possible to take an AA transaction in-flight, modify it, and have the modified version still be valid; AA account contracts can be designed in such a way as to make that not possible, but it is their responsibility. Multi-tenant AA will break the transaction non-malleability invariant much more thoroughly, making the transaction hash unpredictable even for legitimate applications that use the multi-tenant AA features (though the invariant will not further break for applications that existed before then).&lt;&#x2F;p&gt;
&lt;p&gt;AA contracts may not have replay protection unless they build it in explicitly; this can be done with the &lt;code&gt;CHAINID (0x46)&lt;&#x2F;code&gt; opcode introduced in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1344&#x2F;&quot;&gt;EIP 1344&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;See: &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;quilt&#x2F;tests&#x2F;tree&#x2F;account-abstraction&quot;&gt;https:&#x2F;&#x2F;github.com&#x2F;quilt&#x2F;tests&#x2F;tree&#x2F;account-abstraction&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;See: &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;quilt&#x2F;go-ethereum&#x2F;tree&#x2F;account-abstraction&quot;&gt;https:&#x2F;&#x2F;github.com&#x2F;quilt&#x2F;go-ethereum&#x2F;tree&#x2F;account-abstraction&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;See &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethresear.ch&#x2F;t&#x2F;dos-vectors-in-account-abstraction-aa-or-validation-generalization-a-case-study-in-geth&#x2F;7937&quot;&gt;https:&#x2F;&#x2F;ethresear.ch&#x2F;t&#x2F;dos-vectors-in-account-abstraction-aa-or-validation-generalization-a-case-study-in-geth&#x2F;7937&lt;&#x2F;a&gt; for an analysis of DoS issues.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;re-validation&quot;&gt;Re-validation&lt;&#x2F;h3&gt;
&lt;p&gt;When a transaction enters the mempool, the client is able to quickly ascertain whether the transaction is valid. Once it determines this, it can be confident that the transaction will continue to be valid unless a transaction from the same account invalidates it.&lt;&#x2F;p&gt;
&lt;p&gt;There are, however, cases where an attacker can publish a transaction that invalidates existing transactions and requires the network to perform more recomputation than the computation in the transaction itself. The EIP maintains the invariant that recomputation is bounded to a theoretical maximum of six times the block gas limit in a single block; this is somewhat more expensive than before, but not that much more expensive.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;peer-denial-of-service&quot;&gt;Peer denial-of-service&lt;&#x2F;h4&gt;
&lt;p&gt;Denial-of-Service attacks are difficult to defend against, due to the difficulty in identifying sybils within a peer list. At any moment, one may decide (or be bribed) to initiate an attack. This is not a problem that Account Abstraction introduces. It can be accomplished against existing clients today by inundating a target with transactions whose signatures are invalid. However, due to the increased allotment of validation work allowed by AA, it&#x27;s important to bound the amount of computation an adversary can force a client to expend with invalid transactions. For this reason, it&#x27;s best for the miner to follow the recommended mining strategies.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EthPM URI Specification</title>
        <published>2020-09-04T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Nick Gheorghita</name><uri>https://github.com/njgheorghita</uri>
	</author>
	
	<author>
		<name>Piper Merriam</name><uri>https://github.com/pipermerriam</uri>
	</author>
	
	<author>
		<name>g. nicholas d&#x27;andrea</name><uri>https://github.com/gnidan</uri>
	</author>
	
	<author>
		<name>Benjamin Hauser</name><uri>https://github.com/iamdefinitelyahuman</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2942/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/ethpm-v3-specification-working-group/4086/7" />
        

        <id>https://wg-eips.ritovision.com/2942/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2942"
            label="ERC-2942" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2942/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;A custom URI scheme to identify an EthPM registry, package, release, or specific contract asset within a release.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;When interacting with the EthPM ecosystem, users and tooling can benefit from a URI scheme to identify EthPM assets. Being able to specify a package, registry, or release with a single string makes simplifies the steps required to install, publish, or distribute EthPM packages.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;scheme:&#x2F;&#x2F;registry_address[:chain_id][&#x2F;package_name[@package_version[&#x2F;json_pointer]]]&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;scheme&quot;&gt;&lt;code&gt;scheme&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Required&lt;&#x2F;li&gt;
&lt;li&gt;Must be one of &lt;code&gt;ethpm&lt;&#x2F;code&gt; or &lt;code&gt;erc1319&lt;&#x2F;code&gt;. If future versions of the EthPM registry standard are designed and published via the ERC process, those ERCs will also be valid schemes.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;registry-address&quot;&gt;&lt;code&gt;registry_address&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Required&lt;&#x2F;li&gt;
&lt;li&gt;This &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; be either an ENS name or a 0x-prefixed, checksummed address. ENS names are more suitable for cases where mutability of the underlying asset is acceptable and there is implicit trust in the owner of the name. 0x prefixed addresses are more preferable in higher security cases to avoid needing to trust the controller of the name.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;chain-id&quot;&gt;&lt;code&gt;chain_id&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Optional&lt;&#x2F;li&gt;
&lt;li&gt;Integer representing the chain id on which the registry is located&lt;&#x2F;li&gt;
&lt;li&gt;If omitted, defaults to &lt;code&gt;1&lt;&#x2F;code&gt; (mainnet).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;package-name&quot;&gt;&lt;code&gt;package_name&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Optional&lt;&#x2F;li&gt;
&lt;li&gt;String of the target package name&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;package-version&quot;&gt;&lt;code&gt;package_version&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Optional&lt;&#x2F;li&gt;
&lt;li&gt;String of the target package version&lt;&#x2F;li&gt;
&lt;li&gt;If the package version contains any &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Percent-encoding&quot;&gt;url unsafe characters&lt;&#x2F;a&gt;, they &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be safely escaped&lt;&#x2F;li&gt;
&lt;li&gt;Since semver is not strictly enforced by the ethpm spec, if the &lt;code&gt;package_version&lt;&#x2F;code&gt; is omitted from a uri, tooling &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; avoid guessing in the face of any ambiguity and present the user with a choice from the available versions.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;json-pointer&quot;&gt;&lt;code&gt;json_pointer&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Optional&lt;&#x2F;li&gt;
&lt;li&gt;A path that identifies a specific asset within a versioned package release.&lt;&#x2F;li&gt;
&lt;li&gt;This path &lt;strong&gt;MUST&lt;&#x2F;strong&gt; conform to the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;tools.ietf.org&#x2F;html&#x2F;rfc6901&quot;&gt;JSON pointer&lt;&#x2F;a&gt; spec and resolve to an available asset within the package.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Most interactions within the EthPM ecosystem benefit from a single-string representation of EthPM assets; from installing a package, to identifying a registry, to distributing a package. A single string that can faithfully represent any kind of EthPM asset, across the mainnet or testnets, reduces the mental overload for new users, minimizes configuration requirements for frameworks, and simplifies distribution of packages for package authors.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;A JSON file for testing various URIs can be found in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethpm&#x2F;ethpm-spec&#x2F;&quot;&gt;&lt;code&gt;ethpm-spec&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; repository fixtures.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The EthPM URI scheme has been implemented in the following libraries:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;eth-brownie.readthedocs.io&#x2F;en&#x2F;stable&#x2F;&quot;&gt;Brownie&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.trufflesuite.com&#x2F;docs&#x2F;truffle&#x2F;overview&quot;&gt;Truffle&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethpm-cli.readthedocs.io&#x2F;en&#x2F;latest&#x2F;&quot;&gt;EthPM CLI&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;In most cases, an EthPM URI points to an immutable asset, giving full security that the target asset has not been modified. However, in the case where an EthPM URI uses an ENS name as its registry address, it is possible that the ENS name has been redirected to a new registry, in which case the guarantee of immutability no longer exists.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Serve historical block hashes from state</title>
        <published>2020-09-03T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	<author>
		<name>Tomasz Stanczak</name><uri>https://github.com/tkstanczak</uri>
	</author>
	
	<author>
		<name>Guillaume Ballet</name><uri>https://github.com/gballet</uri>
	</author>
	
	<author>
		<name>Gajinder Singh</name><uri>https://github.com/g11tech</uri>
	</author>
	
	<author>
		<name>Tanishq Jasoria</name><uri>https://github.com/tanishqjasoria</uri>
	</author>
	
	<author>
		<name>Ignacio Hagopian</name><uri>https://github.com/jsign</uri>
	</author>
	
	<author>
		<name>Jochem Brouwer</name><uri>https://github.com/jochem-brouwer</uri>
	</author>
	
	<author>
		<name>Sina Mahmoodi</name><uri>https://github.com/s1na</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2935/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2935-save-historical-block-hashes-in-state/4565" />
        

        <id>https://wg-eips.ritovision.com/2935/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2935"
            label="EIP-2935" />
        

        
        

        
        <summary type="html">Store and serve last 8191 block hashes as storage slots of a system contract to allow for stateless execution</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2935/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Store last &lt;code&gt;HISTORY_SERVE_WINDOW&lt;&#x2F;code&gt; historical block hashes in the storage of a system contract as part of the block processing logic. Furthermore this EIP has no impact on &lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt; resolution mechanism (and hence its range&#x2F;costs etc).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;EVM implicitly assumes the client has the recent block (hashes) at hand. This assumption is not future-proof given the prospect of stateless clients. Including the block hashes in the state will allow bundling these hashes in the witness provided to a stateless client. This is already possible in the MPT and will become more efficient post-Verkle.&lt;&#x2F;p&gt;
&lt;p&gt;Extending the range of blocks which &lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt; can serve (&lt;code&gt;BLOCKHASH_SERVE_WINDOW&lt;&#x2F;code&gt;) would have been a semantics change. Using extending that via this contract storage would allow a soft-transition. Rollups can benefit from the longer history window through directly querying this contract.&lt;&#x2F;p&gt;
&lt;p&gt;A side benefit of this approach could be that it allows building&#x2F;validating proofs related to last &lt;code&gt;HISTORY_SERVE_WINDOW&lt;&#x2F;code&gt; ancestors directly against the current state.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;BLOCKHASH_SERVE_WINDOW&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;256&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;HISTORY_SERVE_WINDOW&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;8191&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SYSTEM_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xfffffffffffffffffffffffffffffffffffffffe&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;HISTORY_STORAGE_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x0000F90827F1C53a10cb7A02335B175320002935&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;This EIP specifies for storing last &lt;code&gt;HISTORY_SERVE_WINDOW&lt;&#x2F;code&gt; block hashes in a ring buffer storage of &lt;code&gt;HISTORY_SERVE_WINDOW&lt;&#x2F;code&gt; length. Note that &lt;code&gt;HISTORY_SERVE_WINDOW&lt;&#x2F;code&gt; &amp;gt; &lt;code&gt;BLOCKHASH_SERVE_WINDOW&lt;&#x2F;code&gt; (which remains unchanged).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;block-processing&quot;&gt;Block processing&lt;&#x2F;h3&gt;
&lt;p&gt;At the start of processing any block where this EIP is active (ie. before processing any transactions), call to &lt;code&gt;HISTORY_STORAGE_ADDRESS&lt;&#x2F;code&gt; as &lt;code&gt;SYSTEM_ADDRESS&lt;&#x2F;code&gt; with the 32-byte input of &lt;code&gt;block.parent.hash&lt;&#x2F;code&gt;, a gas limit of &lt;code&gt;30_000_000&lt;&#x2F;code&gt;, and &lt;code&gt;0&lt;&#x2F;code&gt; value. This will trigger the &lt;code&gt;set()&lt;&#x2F;code&gt; routine of the history contract. This is a system operation following the same convention as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4788&#x2F;&quot;&gt;EIP-4788&lt;&#x2F;a&gt; and therefore:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;the call must execute to completion&lt;&#x2F;li&gt;
&lt;li&gt;the call does not count against the block&#x27;s gas limit&lt;&#x2F;li&gt;
&lt;li&gt;the call does not follow the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; burn semantics - no value should be transferred as part of the call&lt;&#x2F;li&gt;
&lt;li&gt;if no code exists at &lt;code&gt;HISTORY_STORAGE_ADDRESS&lt;&#x2F;code&gt;, the call must fail silently&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note: Alternatively clients can choose to directly write to the storage of the contract but EVM calling the contract remains preferred. Refer to the rationale for more info.&lt;&#x2F;p&gt;
&lt;p&gt;Note that, it will take &lt;code&gt;HISTORY_SERVE_WINDOW&lt;&#x2F;code&gt; blocks after the EIP&#x27;s activation to completely fill up the ring buffer. The contract will only contain the parent hash of the fork block and no hashes prior to that.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;evm-changes&quot;&gt;EVM Changes&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt; opcode semantics remains the same as before.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;block-hash-history-contract&quot;&gt;Block hash history contract&lt;&#x2F;h3&gt;
&lt;p&gt;The history contract has two operations: &lt;code&gt;get&lt;&#x2F;code&gt; and &lt;code&gt;set&lt;&#x2F;code&gt;. The &lt;code&gt;set&lt;&#x2F;code&gt; operation is invoked only when the &lt;code&gt;caller&lt;&#x2F;code&gt; is equal to the &lt;code&gt;SYSTEM_ADDRESS&lt;&#x2F;code&gt; as per &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4788&#x2F;&quot;&gt;EIP-4788&lt;&#x2F;a&gt;. Otherwise the &lt;code&gt;get&lt;&#x2F;code&gt; operation is performed.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;get&quot;&gt;&lt;code&gt;get&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;It is used from the EVM for looking up block hashes.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Callers provide the block number they are querying in a big-endian encoding.&lt;&#x2F;li&gt;
&lt;li&gt;If calldata is not 32 bytes, revert.&lt;&#x2F;li&gt;
&lt;li&gt;For any request outside the range of [block.number-&lt;code&gt;HISTORY_SERVE_WINDOW&lt;&#x2F;code&gt;, block.number-1], revert.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;set&quot;&gt;&lt;code&gt;set&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Caller provides &lt;code&gt;block.parent.hash&lt;&#x2F;code&gt; as calldata to the contract.&lt;&#x2F;li&gt;
&lt;li&gt;Set the storage value at &lt;code&gt;block.number-1 % HISTORY_SERVE_WINDOW&lt;&#x2F;code&gt; to be &lt;code&gt;calldata[0:32]&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;bytecode&quot;&gt;Bytecode&lt;&#x2F;h4&gt;
&lt;p&gt;Exact evm assembly that can be used for the history contract:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; https:&#x2F;&#x2F;github.com&#x2F;lightclient&#x2F;sys-asm&#x2F;blob&#x2F;f1c13e285b6aeef2b19793995e00861bf0f32c9a&#x2F;src&#x2F;execution_hash&#x2F;main.eas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;caller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push20 0xfffffffffffffffffffffffffffffffffffffffe&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;eq&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 0x46&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 0x20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;calldatasize&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sub&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 0x42&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sub&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 0x42&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push2 0x1fff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sub&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 0x42&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push2 0x1fff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mod&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 0x20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;revert&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push2 0x1fff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sub&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mod&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;stop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;deployment&quot;&gt;Deployment&lt;&#x2F;h4&gt;
&lt;p&gt;A special synthetic address is generated by working backwards from the desired deployment transaction:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; null&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x3d090&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gasPrice&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xe8d4a51000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;maxPriorityFeePerGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; null&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;maxFeePerGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; null&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;input&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x60538060095f395ff33373fffffffffffffffffffffffffffffffffffffffe14604657602036036042575f35600143038111604257611fff81430311604257611fff9006545f5260205ff35b5f5ffd5b5f35611fff60014303065500&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;v&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x539&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xaa12693182426612186309f02cfe8a80a0000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x67139a552b0d3fffc30c0fa7d0c20d42144138c8fe07fc5691f09c1cce632e15&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note, the input in the transaction has a simple constructor prefixing the desired runtime code.&lt;&#x2F;p&gt;
&lt;p&gt;The sender of the transaction can be calculated as &lt;code&gt;0x3462413Af4609098e1E27A490f554f260213D685&lt;&#x2F;code&gt;. The address of the first contract deployed from the account is &lt;code&gt;rlp([sender, 0])&lt;&#x2F;code&gt; which equals &lt;code&gt;0x0000F90827F1C53a10cb7A02335B175320002935&lt;&#x2F;code&gt;. This is how &lt;code&gt;HISTORY_STORAGE_ADDRESS&lt;&#x2F;code&gt; is determined. Although this style of contract creation is not tied to any specific initcode like create2 is, the synthetic address is cryptographically bound to the input data of the transaction (e.g. the initcode).&lt;&#x2F;p&gt;
&lt;p&gt;Some activation scenarios:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;For the fork to be activated at genesis, no history is written to the genesis state, and at the start of block &lt;code&gt;1&lt;&#x2F;code&gt;, genesis hash will be written as a normal operation to slot &lt;code&gt;0&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;for activation at block &lt;code&gt;1&lt;&#x2F;code&gt;, only genesis hash will be written at slot &lt;code&gt;0&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;for activation at block &lt;code&gt;32&lt;&#x2F;code&gt;, block &lt;code&gt;31&lt;&#x2F;code&gt;&#x27;s hash will be written to slot &lt;code&gt;31&lt;&#x2F;code&gt;. Every other slot will be &lt;code&gt;0&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;eip-161-handling&quot;&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;161&#x2F;&quot;&gt;EIP-161&lt;&#x2F;a&gt; handling&lt;&#x2F;h3&gt;
&lt;p&gt;The bytecode above will be deployed à la &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4788&#x2F;&quot;&gt;EIP-4788&lt;&#x2F;a&gt;. As such the account at &lt;code&gt;HISTORY_STORAGE_ADDRESS&lt;&#x2F;code&gt; will have code and a nonce of 1, and will be exempt from EIP-161 cleanup.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-costs&quot;&gt;Gas costs&lt;&#x2F;h3&gt;
&lt;p&gt;The system update at the beginning of the block, i.e. &lt;code&gt;process_block_hash_history&lt;&#x2F;code&gt; (or via system call to the contract with &lt;code&gt;SYSTEM_ADDRESS&lt;&#x2F;code&gt; caller), will not warm the &lt;code&gt;HISTORY_STORAGE_ADDRESS&lt;&#x2F;code&gt; account or its storage slots as per &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt; rules. As such the first call to the contract will pay for warming up the account and storage slots it accesses.To clarify further any contract call to the &lt;code&gt;HISTORY_STORAGE_ADDRESS&lt;&#x2F;code&gt; will follow normal EVM execution semantics.&lt;&#x2F;p&gt;
&lt;p&gt;Since &lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt; semantics doesn&#x27;t change, this EIP has no impact on &lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt; mechanism and costs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Very similar ideas were proposed before. This EIP is a simplification, removing two sources of needless complexity:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Having a tree-like structure with multiple layers as opposed to a single list&lt;&#x2F;li&gt;
&lt;li&gt;Writing the EIP in EVM code&lt;&#x2F;li&gt;
&lt;li&gt;Serial unbounded storage of hashes for a deep access to the history&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;However after weighing pros and cons, we decided to go with just a limited ring buffer to only serve the requisite &lt;code&gt;HISTORY_SERVE_WINDOW&lt;&#x2F;code&gt; as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4788&#x2F;&quot;&gt;EIP-4788&lt;&#x2F;a&gt; and beacon state accumulators allow (albeit a bit more complex) proof against any ancestor since merge.&lt;&#x2F;p&gt;
&lt;p&gt;Second concern was how to best transition the BLOCKHASH resolution logic post fork by:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Either waiting for  &lt;code&gt;HISTORY_SERVE_WINDOW&lt;&#x2F;code&gt; blocks for the entire relevant history to persist&lt;&#x2F;li&gt;
&lt;li&gt;Storing of all last &lt;code&gt;HISTORY_SERVE_WINDOW&lt;&#x2F;code&gt; block hashes on the fork block.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;We choose to go with the former. It simplifies the logic greatly. It will take roughly a day to bootstrap the contract. Given that this is a new way of accessing history and no contract depends on it, it is deemed a favorable tradeoff.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;inserting-the-parent-block-hash&quot;&gt;Inserting the parent block hash&lt;&#x2F;h3&gt;
&lt;p&gt;Clients have generally two options for inserting the parent block hash into state:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Performing a system call to &lt;code&gt;HISTORY_STORAGE_ADDRESS&lt;&#x2F;code&gt; and letting that handle the storing in state.&lt;&#x2F;li&gt;
&lt;li&gt;Avoid EVM processing and directly write to the state trie.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The latter option is as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; process_block_hash_history&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Block&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; State&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; FORK_TIMESTAMP&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; FORK_TIMESTAMP&lt;&#x2F;span&gt;&lt;span&gt; should&lt;&#x2F;span&gt;&lt;span&gt; be&lt;&#x2F;span&gt;&lt;span&gt; defined&lt;&#x2F;span&gt;&lt;span&gt; outside&lt;&#x2F;span&gt;&lt;span&gt; of&lt;&#x2F;span&gt;&lt;span&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EIP&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;insert_slot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;HISTORY_STORAGE_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; HISTORY_SERVE_WINDOW&lt;&#x2F;span&gt;&lt;span&gt; ,&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;hash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The first option is recommended until the Verkle fork, to stay consistent with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4788&#x2F;&quot;&gt;EIP-4788&lt;&#x2F;a&gt; and to issues for misconfigured networks where this EIP is activated but history contract hasn&#x27;t been deployed. The recommendation may be reconsidered at the Verkle fork if filtering the system contract code chunks is deemed too complex.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;size-of-ring-buffers&quot;&gt;Size of ring buffers&lt;&#x2F;h3&gt;
&lt;p&gt;The ring buffer data structure is sized to hold 8191 hashes. In other system contracts a prime ring buffer size is chosen in because using a prime as the modulus ensures that no value is overwritten until the entire ring buffer has been saturated and thereafter, each value will be updated once per iteration, regardless of if some slot are missing or the slot time changes. However, in this EIP the block number is the value in the modulo operation and it only ever increases by 1 each iteration. Which means we can be confident that the ring buffer will always remain saturated.&lt;&#x2F;p&gt;
&lt;p&gt;For consistency with other system contracts, we have decided to retain the buffer size of 8191. Given the current mainnet values, 8191 roots provides about a day of coverage. This also gives users plenty of time to make a transaction with a verification against a specific hash and get the transaction included on-chain.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces backwards incompatible changes to the block validation rule set. But neither of these changes break anything related to current user activity and experience.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;execution-spec-tests&#x2F;tree&#x2F;3810d22f84f206866f66f4f6bf856187c2893ab1&#x2F;tests&#x2F;prague&#x2F;eip2935_historical_block_hashes_from_state&quot;&gt;EIP-2935 Execution Spec Tests&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Having contracts (system or otherwise) with hot update paths (branches) poses a risk of &quot;branch&quot; poisoning attacks where attacker could sprinkle trivial amounts of eth around these hot paths (branches). But it has been deemed that cost of attack would escalate significantly to cause any meaningful slow down of state root updates.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EXTCLEAR Opcode For SELFDESTRUCTed contracts</title>
        <published>2020-09-03T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>William Morriss</name><uri>https://github.com/wjmelements</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2936/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2936-extclear-for-selfdestruct/4569" />
        

        <id>https://wg-eips.ritovision.com/2936/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2936"
            label="EIP-2936" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2936/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Enable new opcode to clear storage for &lt;code&gt;SELFDESTRUCTED&lt;&#x2F;code&gt;ed contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Changes &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; (&lt;code&gt;0xff&lt;&#x2F;code&gt;) to not clear any storage and adds a new &lt;code&gt;EXTCLEAR&lt;&#x2F;code&gt; (&lt;code&gt;0x5c&lt;&#x2F;code&gt;) opcode that will clear a specific storage slot for a contract that has previously been self destructed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; (&lt;code&gt;0xFF&lt;&#x2F;code&gt;) is unnecessarily complex because it clears an unbounded amount of contract storage.
It is computationally expensive for nodes to track all of the storage used in every contract in case the contract &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;s.
Further, contracts can be re-initialized using &lt;code&gt;CREATE2&lt;&#x2F;code&gt; (&lt;code&gt;0xF5&lt;&#x2F;code&gt;), and then &lt;code&gt;SLOAD&lt;&#x2F;code&gt; (&lt;code&gt;0x54&lt;&#x2F;code&gt;) prior storage.
Therefore, several ethereum clients do not clear storage at all, and just check if the contract was initiated since &lt;code&gt;SSTORE&lt;&#x2F;code&gt; (&lt;code&gt;0x55&lt;&#x2F;code&gt;) during &lt;code&gt;SLOAD&lt;&#x2F;code&gt;.
&lt;code&gt;CREATE2&lt;&#x2F;code&gt; was not intended to complicate &lt;code&gt;SLOAD&lt;&#x2F;code&gt;, and this change reverts that complexity.
Also, bugs in this implementation could split the network.&lt;&#x2F;p&gt;
&lt;p&gt;Instead this defers the time of storage cleanup, and leaves the storage in-place, which reduces the complexity of &lt;code&gt;SLOAD&lt;&#x2F;code&gt; and &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This empowers the &lt;code&gt;CREATE2&lt;&#x2F;code&gt; reincarnation proxy pattern by retaining storage during upgrade, which would otherwise have to be reset again.
An atomic reincarnation upgrade could clear a subset of storage during the upgrade, while the contract is destroyed, before reinstating it.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;After &lt;code&gt;FORK_BLOCK_NUM&lt;&#x2F;code&gt;, a new opcode, &lt;code&gt;EXTCLEAR&lt;&#x2F;code&gt;, is enabled at &lt;code&gt;0x5C&lt;&#x2F;code&gt; to clear storage for &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;ed contracts.
&lt;code&gt;EXTCLEAR&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;does not push any words onto the stack&lt;&#x2F;li&gt;
&lt;li&gt;pops two words off the stack: the destroyed contract address and a storage address&lt;&#x2F;li&gt;
&lt;li&gt;if the contract exists, charge the same gas cost as &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; (&lt;code&gt;0x3F&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;otherwise, if the storage is zero, charge the same gas as &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; plus &lt;code&gt;SLOAD&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;otherwise, the destroyed contract&#x27;s slot is reset to 0, charging the same gas as &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; and &lt;code&gt;SSTORE&lt;&#x2F;code&gt; when resetting storage, while also refunding the amount specified in &lt;code&gt;SSTORE&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; is modified to not clear contract storage.
This change also works retroactively: all prior destroyed contracts can be cleaned up.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;0x5C&lt;&#x2F;code&gt; is available in the same range as &lt;code&gt;SSTORE&lt;&#x2F;code&gt; and &lt;code&gt;SLOAD&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;A reincarnation upgrade mechanism that expects all internal storage to be cleared might break, but such an upgrade mechanism would allow adaptation to this new behavior.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TODO&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Implementation is required on all major clients to add the opcode.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;A reincarnated contract that does not expect its state to be cleared by malicious actors SHOULD reinitialize itself to avoid antagonistic &lt;code&gt;EXTCLEAR&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Gas cost increases for state access opcodes</title>
        <published>2020-09-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	<author>
		<name>Martin Swende</name><uri>https://github.com/holiman</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2929/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2929-gas-cost-increases-for-state-access-opcodes/4558" />
        

        <id>https://wg-eips.ritovision.com/2929/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:2929"
            label="EIP-2929" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2929/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Increases gas cost for &lt;code&gt;SLOAD&lt;&#x2F;code&gt;, &lt;code&gt;*CALL&lt;&#x2F;code&gt;, &lt;code&gt;BALANCE&lt;&#x2F;code&gt;, &lt;code&gt;EXT*&lt;&#x2F;code&gt; and &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; when used for the first time in a transaction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Increase the gas cost of &lt;code&gt;SLOAD&lt;&#x2F;code&gt; (&lt;code&gt;0x54&lt;&#x2F;code&gt;) to 2100, and the &lt;code&gt;*CALL&lt;&#x2F;code&gt; opcode family (&lt;code&gt;0xf1&lt;&#x2F;code&gt;, &lt;code&gt;f2&lt;&#x2F;code&gt;, &lt;code&gt;f4&lt;&#x2F;code&gt;, &lt;code&gt;fA&lt;&#x2F;code&gt;), &lt;code&gt;BALANCE&lt;&#x2F;code&gt; &lt;code&gt;0x31&lt;&#x2F;code&gt; and the &lt;code&gt;EXT*&lt;&#x2F;code&gt; opcode family (&lt;code&gt;0x3b&lt;&#x2F;code&gt;, &lt;code&gt;0x3c&lt;&#x2F;code&gt;, &lt;code&gt;0x3f&lt;&#x2F;code&gt;) to 2600. Exempts (i) precompiles, and (ii) addresses and storage slots that have already been accessed in the same transaction, which get a decreased gas cost. Additionally reforms &lt;code&gt;SSTORE&lt;&#x2F;code&gt; metering and &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; to ensure &quot;de-facto storage loads&quot; inherent in those opcodes are priced correctly.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Generally, the main function of gas costs of opcodes is to be an estimate of the time needed to process that opcode, the goal being for the gas limit to correspond to a limit on the time needed to process a block. However, storage-accessing opcodes (&lt;code&gt;SLOAD&lt;&#x2F;code&gt;, as well as the &lt;code&gt;*CALL&lt;&#x2F;code&gt;, &lt;code&gt;BALANCE&lt;&#x2F;code&gt; and &lt;code&gt;EXT*&lt;&#x2F;code&gt; opcodes) have historically been underpriced. In the 2016 Shanghai DoS attacks, once the most serious client bugs were fixed, one of the more durably successful strategies used by the attacker was to simply send transactions that access or call a large number of accounts.&lt;&#x2F;p&gt;
&lt;p&gt;Gas costs were increased to mitigate this, but recent numbers suggest they were not increased enough. Quoting &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;arxiv.org&#x2F;pdf&#x2F;1909.07220.pdf&quot;&gt;https:&#x2F;&#x2F;arxiv.org&#x2F;pdf&#x2F;1909.07220.pdf&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Although by itself, this issue might seem benign, &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; forces the  client to search the contract ondisk, resulting in IO heavy transactions.  While replaying the Ethereum history on our hardware, the malicious transactions took around 20 to 80 seconds to execute, compared to a few milliseconds for the average transactions&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;This proposed EIP increases the costs of these opcodes by a factor of ~3, reducing the worst-case processing time to ~7-27 seconds. Improvements in database layout that involve redesigning the client to read storage directly instead of hopping through the Merkle tree would decrease this further, though these technologies may take a long time to fully roll out, and even with such technologies the IO overhead of accessing storage would remain substantial.&lt;&#x2F;p&gt;
&lt;p&gt;A secondary benefit of this EIP is that it also performs most of the work needed to make &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum-magicians.org&#x2F;t&#x2F;protocol-changes-to-bound-witness-size&#x2F;3885&quot;&gt;stateless witness sizes&lt;&#x2F;a&gt; in Ethereum acceptable. Assuming &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethresear.ch&#x2F;t&#x2F;binary-trie-format&#x2F;7621&quot;&gt;a switch to binary tries&lt;&#x2F;a&gt;, the theoretical maximum witness size not including code size (hence &quot;most of the work&quot; and not &quot;all&quot;) would decrease from &lt;code&gt;(12500000 gas limit) &#x2F; (700 gas per BALANCE) * (800 witness bytes per BALANCE) ~= 14.3M bytes&lt;&#x2F;code&gt; to &lt;code&gt;12500000 &#x2F; 2600 * 800 ~= 3.85M bytes&lt;&#x2F;code&gt;. Pricing for code access could be changed when code merklization is implemented.&lt;&#x2F;p&gt;
&lt;p&gt;In the further future, there are similar benefits in the case of SNARK&#x2F;STARK witnesses. Recent numbers from Starkware suggest that they are able to prove 10000 Rescue hashes per second on a consumer desktop; assuming 25 hashes per Merkle branch, and a block full of state accesses, at present this would imply a witness would take &lt;code&gt;12500000 &#x2F; 700 * 25 &#x2F; 10000 ~= 44.64&lt;&#x2F;code&gt; seconds to generate, but after this EIP that would reduce to &lt;code&gt;12500000 &#x2F; 2500 * 25 &#x2F; 10000 ~= 12.5&lt;&#x2F;code&gt; seconds, meaning that a single desktop computer would be able to generate witnesses on time under any conditions. Future gains in STARK proving could be spent on either (i) using a more expensive but robust hash function or (ii) reducing proving times further, reducing the delay and hence improving user experience of stateless clients that rely on such witnesses.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FORK_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;12244000&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;COLD_SLOAD_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;2100&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;COLD_ACCOUNT_ACCESS_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;2600&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;WARM_STORAGE_READ_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;For blocks where &lt;code&gt;block.number &amp;gt;= FORK_BLOCK&lt;&#x2F;code&gt;, the following changes apply.&lt;&#x2F;p&gt;
&lt;p&gt;When executing a transaction, maintain a set &lt;code&gt;accessed_addresses: Set[Address]&lt;&#x2F;code&gt; and &lt;code&gt;accessed_storage_keys: Set[Tuple[Address, Bytes32]]&lt;&#x2F;code&gt; .&lt;&#x2F;p&gt;
&lt;p&gt;The sets are transaction-context-wide, implemented identically to other transaction-scoped constructs such as the self-destruct-list and global &lt;code&gt;refund&lt;&#x2F;code&gt; counter. In particular, if a scope reverts, the access lists should be in the state they were in before that scope was entered.&lt;&#x2F;p&gt;
&lt;p&gt;When a transaction execution begins,&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;accessed_storage_keys&lt;&#x2F;code&gt; is initialized to empty, and&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;accessed_addresses&lt;&#x2F;code&gt; is initialized to include
&lt;ul&gt;
&lt;li&gt;the &lt;code&gt;tx.sender&lt;&#x2F;code&gt;, &lt;code&gt;tx.to&lt;&#x2F;code&gt; (or the address being created if it is a contract creation transaction)&lt;&#x2F;li&gt;
&lt;li&gt;and the set of all precompiles.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;storage-read-changes&quot;&gt;Storage read changes&lt;&#x2F;h3&gt;
&lt;p&gt;When an address is either the target of a (&lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; (&lt;code&gt;0x3B&lt;&#x2F;code&gt;), &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt; (&lt;code&gt;0x3C&lt;&#x2F;code&gt;), &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; (&lt;code&gt;0x3F&lt;&#x2F;code&gt;) or &lt;code&gt;BALANCE&lt;&#x2F;code&gt; (&lt;code&gt;0x31&lt;&#x2F;code&gt;)) opcode or the target of a (&lt;code&gt;CALL&lt;&#x2F;code&gt; (&lt;code&gt;0xF1&lt;&#x2F;code&gt;), &lt;code&gt;CALLCODE&lt;&#x2F;code&gt; (&lt;code&gt;0xF2&lt;&#x2F;code&gt;), &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; (&lt;code&gt;0xF4&lt;&#x2F;code&gt;), &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; (&lt;code&gt;0xFA&lt;&#x2F;code&gt;)) opcode, the gas costs are computed as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If the target is not in &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt;, charge &lt;code&gt;COLD_ACCOUNT_ACCESS_COST&lt;&#x2F;code&gt; gas, and add the address to &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Otherwise, charge &lt;code&gt;WARM_STORAGE_READ_COST&lt;&#x2F;code&gt; gas.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In all cases, the gas cost is charged and the map is updated at the time that the opcode is being called.
When a &lt;code&gt;CREATE&lt;&#x2F;code&gt; or &lt;code&gt;CREATE2&lt;&#x2F;code&gt; opcode is called, immediately (ie. before checks are done to determine whether or not the address is unclaimed) add the address being created to &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt;, but gas costs of &lt;code&gt;CREATE&lt;&#x2F;code&gt; and &lt;code&gt;CREATE2&lt;&#x2F;code&gt; are unchanged.
Clarification: If a &lt;code&gt;CREATE&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;CREATE2&lt;&#x2F;code&gt; operation fails later on, e.g during the execution of &lt;code&gt;initcode&lt;&#x2F;code&gt; or has insufficient gas to store the code in the state, the &lt;code&gt;address&lt;&#x2F;code&gt; of the contract itself remains in &lt;code&gt;access_addresses&lt;&#x2F;code&gt; (but any additions made within the inner scope are reverted).&lt;&#x2F;p&gt;
&lt;p&gt;For &lt;code&gt;SLOAD&lt;&#x2F;code&gt;, if the &lt;code&gt;(address, storage_key)&lt;&#x2F;code&gt; pair (where &lt;code&gt;address&lt;&#x2F;code&gt; is the address of the contract whose storage is being read) is not yet in &lt;code&gt;accessed_storage_keys&lt;&#x2F;code&gt;, charge &lt;code&gt;COLD_SLOAD_COST&lt;&#x2F;code&gt; gas and add the pair to &lt;code&gt;accessed_storage_keys&lt;&#x2F;code&gt;. If the pair is already in &lt;code&gt;accessed_storage_keys&lt;&#x2F;code&gt;, charge &lt;code&gt;WARM_STORAGE_READ_COST&lt;&#x2F;code&gt; gas.&lt;&#x2F;p&gt;
&lt;p&gt;Note: For call-variants, the &lt;code&gt;100&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;2600&lt;&#x2F;code&gt; cost is applied immediately (exactly like how &lt;code&gt;700&lt;&#x2F;code&gt; was charged before this EIP), i.e: before calculating the &lt;code&gt;63&#x2F;64ths&lt;&#x2F;code&gt; available for entering the call.&lt;&#x2F;p&gt;
&lt;p&gt;Note 2: There is currently no way to perform a &#x27;cold sload read&#x2F;write&#x27; on a &#x27;cold account&#x27;, simply because in order to read&#x2F;write a &lt;code&gt;slot&lt;&#x2F;code&gt;, the execution must already be inside the &lt;code&gt;account&lt;&#x2F;code&gt;. Therefore, the behaviour of cold  storage reads&#x2F;writes on cold accounts is undefined as of this EIP. Any future EIP which
proposes to add &#x27;remote read&#x2F;write&#x27; would need to define the pricing behaviour of that change.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;sstore-changes&quot;&gt;SSTORE changes&lt;&#x2F;h3&gt;
&lt;p&gt;When calling &lt;code&gt;SSTORE&lt;&#x2F;code&gt;, check if the &lt;code&gt;(address, storage_key)&lt;&#x2F;code&gt; pair is in &lt;code&gt;accessed_storage_keys&lt;&#x2F;code&gt;. If it is not, charge an additional &lt;code&gt;COLD_SLOAD_COST&lt;&#x2F;code&gt; gas, and add the pair to &lt;code&gt;accessed_storage_keys&lt;&#x2F;code&gt;. Additionally, modify the parameters defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2200&#x2F;&quot;&gt;EIP-2200&lt;&#x2F;a&gt; as follows:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Old value&lt;&#x2F;th&gt;&lt;th&gt;New value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SLOAD_GAS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;800&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;= WARM_STORAGE_READ_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SSTORE_RESET_GAS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;5000&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;5000 - COLD_SLOAD_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The other parameters defined in EIP 2200 are unchanged.
Note: The constant &lt;code&gt;SLOAD_GAS&lt;&#x2F;code&gt; is used in several places in EIP 2200, e.g &lt;code&gt;SSTORE_SET_GAS - SLOAD_GAS&lt;&#x2F;code&gt;. Implementations that are using composite definitions have to ensure to update those definitions too.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;selfdestruct-changes&quot;&gt;SELFDESTRUCT changes&lt;&#x2F;h3&gt;
&lt;p&gt;If the ETH recipient of a &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; is not in &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt; (regardless of whether or not the amount sent is nonzero), charge an additional &lt;code&gt;COLD_ACCOUNT_ACCESS_COST&lt;&#x2F;code&gt; on top of the existing gas costs, and add the ETH recipient to the set.&lt;&#x2F;p&gt;
&lt;p&gt;Note: &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; does not charge a &lt;code&gt;WARM_STORAGE_READ_COST&lt;&#x2F;code&gt; in case the recipient is already warm, which differs from how the other call-variants work. The reasoning behind this is to keep the changes small, a &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; already costs &lt;code&gt;5K&lt;&#x2F;code&gt; and is a no-op if invoked more than once.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;opcode-costs-vs-charging-per-byte-of-witness-data&quot;&gt;Opcode costs vs charging per byte of witness data&lt;&#x2F;h3&gt;
&lt;p&gt;The natural alternative path to changing gas costs to reflect witness sizes is to charge per byte of witness data. However, that would take a longer time to implement, hampering the goal of providing short-term security relief. Furthermore, following that path faithfully would lead to extremely high gas costs to transactions that touch contract code, as one would need to charge for all 24576 contract code bytes; this would be an unacceptably high burden on developers. It is better to wait for &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;medium.com&#x2F;ewasm&#x2F;evm-bytecode-merklization-2a8366ab0c90&quot;&gt;code merklization&lt;&#x2F;a&gt; to start trying to properly account for gas costs of accessing individual chunks of code; from a short-term DoS prevention standpoint, accessing 24 kB from disk is not much more expensive than accessing 32 bytes from disk, so worrying about code size is not necessary.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;adding-the-accessed-addresses-accessed-storage-keys-sets&quot;&gt;Adding the accessed_addresses &#x2F; accessed_storage_keys sets&lt;&#x2F;h3&gt;
&lt;p&gt;The sets of already-accessed accounts and storage slots are added to avoid needlessly charging for things that can be cached (and in all performant implementations already are cached). Additionally, it removes the current undesirable status quo where it is needlessly unaffordable to do self-calls or call precompiles, and enables contract breakage mitigations that involve pre-fetching some storage key allowing a future execution to still take the expected amount of gas.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;sstore-gas-cost-change&quot;&gt;SSTORE gas cost change&lt;&#x2F;h3&gt;
&lt;p&gt;The change to SSTORE is needed to avoid the possibility of a DoS attack that &quot;pokes&quot; a randomly chosen zero storage slot, changing it from 0 to 0 at a cost of 800 gas but requiring a de-facto storage load. The &lt;code&gt;SSTORE_RESET_GAS&lt;&#x2F;code&gt; reduction ensures that the total cost of SSTORE (which now requires paying the &lt;code&gt;COLD_SLOAD_COST&lt;&#x2F;code&gt;) remains unchanged. Additionally, note that applications that do &lt;code&gt;SLOAD&lt;&#x2F;code&gt; followed by &lt;code&gt;SSTORE&lt;&#x2F;code&gt; (eg. &lt;code&gt;storage_variable += x&lt;&#x2F;code&gt;) &lt;em&gt;would actually get cheaper&lt;&#x2F;em&gt;!&lt;&#x2F;p&gt;
&lt;h3 id=&quot;change-sstore-accounting-only-minimally&quot;&gt;Change SSTORE accounting only minimally&lt;&#x2F;h3&gt;
&lt;p&gt;The SSTORE gas costs continue to use Wei Tang&#x27;s original&#x2F;current&#x2F;new approach, instead of being redesigned to use a dirty map, because Wei Tang&#x27;s approach correctly accounts for the actual costs of changing storage, which only care about current vs final value and not intermediate values.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;how-would-gas-consumption-of-average-applications-increase-under-this-proposal&quot;&gt;How would gas consumption of average applications increase under this proposal?&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;rough-analysis-from-witness-sizes&quot;&gt;Rough analysis from witness sizes&lt;&#x2F;h4&gt;
&lt;p&gt;We can look at &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;medium.com&#x2F;@akhounov&#x2F;data-from-the-ethereum-stateless-prototype-8c69479c8abc&quot;&gt;Alexey Akhunov&#x27;s earlier work&lt;&#x2F;a&gt; for data on average-case blocks. In summary, average blocks have witness sizes of ~1000 kB, of which ~750 kB is Merkle proofs and not code. Assuming a conservative 2000 bytes per Merkle branch this implies ~375 accesses per block (SLOADs have a similar gas-increase-to-bytes ratio so there&#x27;s no need to analyze them separately).&lt;&#x2F;p&gt;
&lt;p&gt;Data on &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;etherscan.io&#x2F;chart&#x2F;tx&quot;&gt;txs per day&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;etherscan.io&#x2F;chart&#x2F;blocks&quot;&gt;blocks per day&lt;&#x2F;a&gt; from Etherscan gives ~160 transactions per block (reference date: Jul 1), implying a large portion of those accesses are just the &lt;code&gt;tx.sender&lt;&#x2F;code&gt; and &lt;code&gt;tx.to&lt;&#x2F;code&gt; which are excluded from gas cost increases, though likely less than 320 due to duplicate addresses.&lt;&#x2F;p&gt;
&lt;p&gt;Hence, this implies ~50-375 chargeable accesses per block, and each access suffers a gas cost increase of 1900; &lt;code&gt;50 * 1900 = 95000&lt;&#x2F;code&gt; and &lt;code&gt;375 * 1900 = 712500&lt;&#x2F;code&gt;, implying the gas limit would need to be raised by ~1-6% to compensate. However, this analysis may be complicated further in either direction by (i) accounts &#x2F; storage keys being accessed in multiple transactions, which would appear once in the witness but twice in gas cost increases, and (ii) accounts &#x2F; storage keys being accessed multiple times in the same transaction, which lead to gas cost &lt;em&gt;decreases&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;goerli-analysis&quot;&gt;Goerli analysis&lt;&#x2F;h4&gt;
&lt;p&gt;A more precise analysis can be found by scanning Goerli transactions, as done by Martin Swende here: https:&#x2F;&#x2F;github.com&#x2F;holiman&#x2F;gasreprice&lt;&#x2F;p&gt;
&lt;p&gt;The conclusion is that on average gas costs increase by ~2.36%. One major contributing factor to reducing gas costs is that a large number of contracts inefficiently read the same storage slot multiple times, which leads to this EIP giving a few transactions gas cost &lt;em&gt;savings&lt;&#x2F;em&gt; of over 10%.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;These gas cost increases may potentially break contracts that depend on fixed gas costs; see the security considerations section for details and arguments for why we expect the total risks to be low and how if desired they can be reduced further.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Some test cases can be found here: https:&#x2F;&#x2F;gist.github.com&#x2F;holiman&#x2F;174548cad102096858583c6fbbb0649a&lt;&#x2F;p&gt;
&lt;p&gt;Ideally we would test the following:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;SLOAD the same storage slot {1, 2, 3} times&lt;&#x2F;li&gt;
&lt;li&gt;CALL the same address {1, 2, 3} times&lt;&#x2F;li&gt;
&lt;li&gt;(SLOAD | CALL) in a sub-call, then revert, then (SLOAD | CALL) the same (storage slot | address) again&lt;&#x2F;li&gt;
&lt;li&gt;Sub-call, SLOAD, sub-call again, revert the inner sub-call, SLOAD the same storage slot&lt;&#x2F;li&gt;
&lt;li&gt;SSTORE the same storage slot {1, 2, 3} times, using all combinations of zero&#x2F;nonzero for original value and the value being set&lt;&#x2F;li&gt;
&lt;li&gt;SSTORE then SLOAD the same storage slot&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;OP_1&lt;&#x2F;code&gt; then &lt;code&gt;OP_2&lt;&#x2F;code&gt; to the same address where &lt;code&gt;OP_1&lt;&#x2F;code&gt; and &lt;code&gt;OP_2&lt;&#x2F;code&gt; are all combinations of (&lt;code&gt;*CALL&lt;&#x2F;code&gt;, &lt;code&gt;EXT*&lt;&#x2F;code&gt;, &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;Try to &lt;code&gt;CALL&lt;&#x2F;code&gt; an address but with all possible failure modes (not enough gas, not enough ETH...), then (&lt;code&gt;CALL&lt;&#x2F;code&gt; | &lt;code&gt;EXT*&lt;&#x2F;code&gt;) that address again successfully&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;A WIP early-draft implementation for Geth can be found here: https:&#x2F;&#x2F;github.com&#x2F;holiman&#x2F;go-ethereum&#x2F;tree&#x2F;access_lists&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;As with any gas cost increasing EIP, there are three possible cases where it could cause applications to break:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Fixed gas limits to sub-calls in contracts&lt;&#x2F;li&gt;
&lt;li&gt;Applications relying on contract calls that consume close to the full gas limit&lt;&#x2F;li&gt;
&lt;li&gt;The 2300 base limit given to the callee by ETH-transferring calls&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;These risks have been studied before in the context of an earlier gas cost increase, EIP-1884. See &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;holiman&#x2F;eip-1884-security&quot;&gt;Martin Swende&#x27;s earlier report&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;gist.github.com&#x2F;ritzdorf&#x2F;1c6bd72955391e831f8a397d3152b4e0&#x2F;&quot;&gt;Hubert Ritzdorf&#x27;s analysis&lt;&#x2F;a&gt; focusing on (1) and (3). (2) has received less analysis, though one can argue that it is very unlikely both because applications tend to very rarely use close to the entire gas limit in a transaction, and because gas limits were very recently raised from 10 million to 12.5 million. EIP-1884 in practice &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.coindesk.com&#x2F;ethereums-istanbul-upgrade-will-break-680-smart-contracts-on-aragon&quot;&gt;did lead to a small number of contracts breaking&lt;&#x2F;a&gt; for this reason.&lt;&#x2F;p&gt;
&lt;p&gt;There are two ways to look at these risks. First, we can note that as of today developers have had years of warning; gas cost increases on storage-accessing opcodes have been &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum-magicians.org&#x2F;t&#x2F;protocol-changes-to-bound-witness-size&#x2F;3885&quot;&gt;discussed for a long time&lt;&#x2F;a&gt;, with multiple statements made including to major dapp developers around the likelihood of such changes. EIP-1884 itself provided an important wake-up call. Hence, we can argue that risks this time will be significantly lower than EIP-1884.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;contract-breakage-mitigations&quot;&gt;Contract breakage mitigations&lt;&#x2F;h3&gt;
&lt;p&gt;A second way to look at the risks is to explore mitigations. First of all, the existence of an &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt; and &lt;code&gt;accessed_storage_keys&lt;&#x2F;code&gt; map (present in this EIP, absent in EIP-1884) already makes some cases recoverable: in any case where a contract A needs to send funds to some address B, where that address accepts funds from any source but leaves a storage-dependent log, one can recover by first sending a separate call to B to pull it into the cache, and then call A, knowing that the execution of B triggered by A will only charge 100 gas per SLOAD. This fact does not fix all situations, but it does reduce risks significantly.&lt;&#x2F;p&gt;
&lt;p&gt;But there are ways to further expand the usability of this pattern. One possibility is to add a &lt;code&gt;POKE&lt;&#x2F;code&gt; precompile, which would take an address and a storage key as input and allow transactions that attempt to &quot;rescue&quot; stuck contracts by pre-poking all of the storage slots that they will access. This works even if the address only accepts transactions from the contract, and works in many other contexts with present gas limits. The only case where this will not work would be the case where a transaction call &lt;em&gt;must&lt;&#x2F;em&gt; go from an EOA straight into a specific contract that then sub-calls another contract.&lt;&#x2F;p&gt;
&lt;p&gt;Another option is &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930&lt;&#x2F;a&gt;, which would have a similar effect to &lt;code&gt;POKE&lt;&#x2F;code&gt; but is more general: it also works for the EOA -&amp;gt; contract -&amp;gt; contract case, and generally should work for all known cases of breakage due to gas cost increases. This option is more complex, though it is arguably a stepping stone toward access lists being used for other use cases (regenesis, account abstraction, SSA all demand access lists).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Binary trie structure</title>
        <published>2020-09-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Guillaume Ballet</name><uri>https://github.com/gballet</uri>
	</author>
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3102/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethresear.ch/t/binary-trie-format/7621" />
        

        <id>https://wg-eips.ritovision.com/3102/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:3102"
            label="EIP-3102" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3102/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Change the storage structure from hexary to binary, merge the account and storage tries, and use blake2b.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal presents a binary structure and merkelization rule for the account and storage tries, which are merged into a single “state” trie. RLP and most of the MPT’s optimizations are dropped to simplify the design. Keccak256 is replaced with blake2b.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The current design of the Merkle Patricia Trie (MPT) uses an hexary trie. Hexary Merkle trees are more shallow than their binary counterparts, which means less hashing.
Over the course of the 5 years of Ethereum’s existence, it has become apparent that disk accesses are a greater bottleneck than hashing. Clients are therefore moving away from a storage model in which all internal nodes are stored, in favor of a flat (key, value) storage model first used by turbo-geth, in which the intermediate nodes are recalculated only when needed.&lt;&#x2F;p&gt;
&lt;p&gt;There is a push for making Ethereum easier to use in a stateless fashion. Binary tries make for smaller (~4x) proofs than hexary tries, making it the design of choice for a stateless-friendly Ethereum.&lt;&#x2F;p&gt;
&lt;p&gt;For that same reason, the account and storage tries are merged in order to have a single proof for all changes.&lt;&#x2F;p&gt;
&lt;p&gt;The MPT design is also rife with uncanny optimizations for size, that have a limited effect - at the cost of prohibitive complexity. For example, nesting for children whose RLP is less than 32 bytes saves an estimated 1MB of disk space. A paltry compared to the 300GB required by a fast sync at the time of this writing. These optimizations are a significant source of errors, and therefore a consensus-breaking risk.
The reliance on RLP has also been criticized for its complexity, while the overhead of a general-purpose encoding scheme isn’t warranted for the rigid structure of a Merkle trie.&lt;&#x2F;p&gt;
&lt;p&gt;The desire to switch the storage model from an hexary trie to a binary trie provides an opportunity to adopt a simpler trie architecture that pushes optimizations from the protocol level down to that of the client implementors.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;conventions&quot;&gt;Conventions&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&quot;text-align: center&quot;&gt;Code&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;u256(x)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Big endian, 32-byte representation of number &lt;em&gt;x&lt;&#x2F;em&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;`&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;++&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Bit-wise concatenation operator&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;0b0101&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The binary string &lt;code&gt;0101&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;hash()&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The usual hashing function&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;empty_hash&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The empty hash: &lt;code&gt;hash(&quot;&quot;)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;length(x)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The byte length of object &lt;code&gt;x&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;d[a..b]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The big-endian bit sequence taken from byte sequence &lt;code&gt;d&lt;&#x2F;code&gt;, starting at bit index &lt;code&gt;a&lt;&#x2F;code&gt;, up to and including the bit at index &lt;code&gt;b&lt;&#x2F;code&gt;.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;notable-changes-from-the-hexary-structure&quot;&gt;Notable changes from the hexary structure&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Account and storage tries are merged, with key length between 32 and 64 bytes;&lt;&#x2F;li&gt;
&lt;li&gt;RLP is no longer used;&lt;&#x2F;li&gt;
&lt;li&gt;The &quot;leaf marker&quot; bit used in the hex prefix is also dropped. Leaves are identified as nodes with no children;&lt;&#x2F;li&gt;
&lt;li&gt;Serialized nodes are hashed, no matter how small the byte length of the serialized nodes.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;the-trie&quot;&gt;The trie&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;structure&quot;&gt;Structure&lt;&#x2F;h4&gt;
&lt;p&gt;The trie structure is made up of &lt;em&gt;nodes&lt;&#x2F;em&gt;. A node &lt;code&gt;N ≡ (N_l,N_r,N_p,N_v)&lt;&#x2F;code&gt; has the following 4 components:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;N_l&lt;&#x2F;code&gt; is the hash to the node&#x27;s &lt;em&gt;left child&lt;&#x2F;em&gt;. If the node does not have a left child, then &lt;code&gt;N_l&lt;&#x2F;code&gt; is the empty hash &lt;code&gt;empty_hash&lt;&#x2F;code&gt;;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;N_r&lt;&#x2F;code&gt; is the hash to the node&#x27;s &lt;em&gt;right child&lt;&#x2F;em&gt;. If the node does not have a right child, then &lt;code&gt;N_r&lt;&#x2F;code&gt; is the empty hash &lt;code&gt;empty_hash&lt;&#x2F;code&gt;;&lt;&#x2F;li&gt;
&lt;li&gt;the optional &lt;code&gt;N_p&lt;&#x2F;code&gt; is the node&#x27;s &lt;em&gt;prefix&lt;&#x2F;em&gt; : every key into the subtrie rooted at &lt;code&gt;N&lt;&#x2F;code&gt; is prefixed by this bit string;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;N_v&lt;&#x2F;code&gt; is the &lt;em&gt;value&lt;&#x2F;em&gt; stored at this node. The value is &lt;strong&gt;only present in leaf nodes&lt;&#x2F;strong&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Nodes with &lt;code&gt;empty_hash&lt;&#x2F;code&gt; as both children are called &lt;em&gt;leaf nodes&lt;&#x2F;em&gt;, and the remaining nodes are known as &lt;em&gt;internal nodes&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;accessing-account-s-balance-nonce-code-storage-root-and-storage-slots&quot;&gt;Accessing account&#x27;s balance, nonce, code, storage root and storage slots&lt;&#x2F;h4&gt;
&lt;p&gt;Assuming an account &lt;code&gt;A ≡ (A_b, A_n, A_c, A_s)&lt;&#x2F;code&gt; at address &lt;code&gt;A_a&lt;&#x2F;code&gt;, the following elements can be found at the following addresses:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The account balance &lt;code&gt;A_b&lt;&#x2F;code&gt; can be found at key &lt;code&gt;hash(A_a)[0..253] ++ 0b00&lt;&#x2F;code&gt; and is of type &lt;code&gt;uint256&lt;&#x2F;code&gt;;&lt;&#x2F;li&gt;
&lt;li&gt;The account nonce &lt;code&gt;A_n&lt;&#x2F;code&gt; can be found at key &lt;code&gt;hash(A_a)[0..253] ++ 0b01&lt;&#x2F;code&gt; and is of type &lt;code&gt;uint64&lt;&#x2F;code&gt;;&lt;&#x2F;li&gt;
&lt;li&gt;The code &lt;code&gt;A_c&lt;&#x2F;code&gt; is an arbitrary-length byte sequence that can be found at key &lt;code&gt;hash(A_a)[0..253] ++ 0b10&lt;&#x2F;code&gt;;&lt;&#x2F;li&gt;
&lt;li&gt;The root of the storage trie &lt;code&gt;A_s&lt;&#x2F;code&gt; can be found at key &lt;code&gt;hash(A_a)[0..253] ++ 0b11&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;The storage slot number &lt;code&gt;k&lt;&#x2F;code&gt; can be found at key &lt;code&gt;hash(A_a)[0..253] ++ 0b11 ++ hash(k)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;After &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2926&#x2F;&quot;&gt;EIP-2926&lt;&#x2F;a&gt; has been rolled out, &lt;code&gt;A_c&lt;&#x2F;code&gt; will represent the root of the code merkelization tree. The key accessing code chunk number &lt;code&gt;c&lt;&#x2F;code&gt; is &lt;code&gt;hash(A_a)[0..253] ++ 0b10 ++ u256(c)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;In the unlikely future case that extra items are to be added to the trie at account level, a third bit can be reserved for future use.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;node-merkelization-rule&quot;&gt;Node merkelization rule&lt;&#x2F;h3&gt;
&lt;p&gt;Leaves and nodes that have no prefix are hashed according to the rule below:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;internal_hash = hash(left_child_hash || right_child_hash)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;leaf_hash = hash(hash(key) || hash(leaf_value))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;If a prefix is present, the length of the path from the root to the prefixed node is further concatenated with the output of the prefix-less rule, and hashed again:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;internal_hash_with_prefix = hash(u256(path_length_u256 - 1) || internal_hash)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;leaf_hash_with_prefix = hash(u256(path_length_u256 - 1) || leaf_hash)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;blake2b&quot;&gt;blake2b&lt;&#x2F;h3&gt;
&lt;p&gt;BLAKE2 offers better performance, which is key to compensate for the loss of performance associated to a ~4x increase in the number of nodes.&lt;&#x2F;p&gt;
&lt;p&gt;BLAKE3 offers even better performance. No official golang release exists at the time of the writing of this document. This presents a security risk, and therefore BLAKE2 is considered instead.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;merging-of-the-account-and-storage-tries&quot;&gt;Merging of the account and storage tries&lt;&#x2F;h3&gt;
&lt;p&gt;The trend in clients is to store the keys and values in a &quot;flat&quot; database. Having the key of any storage slot prefixed with the address key of the account it belongs to helps grouping all of an account&#x27;s data on disk, as well as simplifying the witness structure.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;prefixes-and-extension-nodes&quot;&gt;Prefixes and extension nodes&lt;&#x2F;h3&gt;
&lt;p&gt;An alternative proposal has been made, which provides optimal witnesses. The trade-off is that extension nodes must be removed.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;node_hash = hash(left_child_hash || right_child_hash)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;leaf_hash = hash(0 || leaf_value)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The removal of extension nodes induces 40x higher hashing costs (on the order of 25ms for a trie with only 1k leaves) and as a result they have been kept.&lt;&#x2F;p&gt;
&lt;p&gt;An attempt to keep extension nodes for witness and not the merkelization rule can be found &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;notes.ethereum.org&#x2F;m5VMkX8FRvi0Q_OOR7TF4A&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Getting rid of complex methods like RLP, the hex prefix and children nesting is already offering great simplification.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;2x32-byte-inputs&quot;&gt;2x32-byte inputs&lt;&#x2F;h3&gt;
&lt;p&gt;It has been requested to keep each node hash calculation as a function that takes two 256-bit integer as an input and outputs one 256-bit integer. This property is expected to play nice with circuit constructions and is therefore expected to greatly help with future zero-knowledge applications.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;binary-tries&quot;&gt;Binary tries&lt;&#x2F;h3&gt;
&lt;p&gt;Binary tries have been chosen primarily because they reduce the witness size. In general, in an &lt;code&gt;N&lt;&#x2F;code&gt;-element tree with each element having &lt;code&gt;k&lt;&#x2F;code&gt; children, the average length of a branch is roughly &lt;code&gt;32 * (k-1) * log(N) &#x2F; log(k)&lt;&#x2F;code&gt; plus a few percent for overhead. 32 is the length of a hash; the &lt;code&gt;k-1&lt;&#x2F;code&gt; refers to the fact that a Merkle proof needs to provide all &lt;code&gt;k-1&lt;&#x2F;code&gt; sister nodes at each level, and &lt;code&gt;log(N) &#x2F; log(k)&lt;&#x2F;code&gt; is an approximation of the number of levels in the tree (eg. a tree where each node has 5 children, with 625 nodes total, would have depth 4, as &lt;code&gt;625 = 5**4&lt;&#x2F;code&gt; and so &lt;code&gt;log(625) &#x2F; log(5) = 4&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;For any &lt;code&gt;N&lt;&#x2F;code&gt;, the expression is minimized at &lt;code&gt;k = 2&lt;&#x2F;code&gt;. Here&#x27;s a table of branch lengths for different &lt;code&gt;k&lt;&#x2F;code&gt; values assuming &lt;code&gt;N = 2**24&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;code&gt;k&lt;&#x2F;code&gt; (children per node)&lt;&#x2F;th&gt;&lt;th&gt;Branch length (chunks)&lt;&#x2F;th&gt;&lt;th&gt;Branch length (bytes)&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;1 * 24 = 24&lt;&#x2F;td&gt;&lt;td&gt;768&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;4&lt;&#x2F;td&gt;&lt;td&gt;3 * 12 = 36&lt;&#x2F;td&gt;&lt;td&gt;1152&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;8&lt;&#x2F;td&gt;&lt;td&gt;7 * 8 = 56&lt;&#x2F;td&gt;&lt;td&gt;1792&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;16&lt;&#x2F;td&gt;&lt;td&gt;15 * 6 = 90&lt;&#x2F;td&gt;&lt;td&gt;2880&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Actual branch lengths will be slightly larger than this due to uneven distribution and overhead, but the pattern of &lt;code&gt;k=2&lt;&#x2F;code&gt; being by far the best remains.&lt;&#x2F;p&gt;
&lt;p&gt;The ethereum tree was originally hexary because this would reduce the number of database reads (eg. 6 instead of 24 in the above example). It is now understood that this reasoning was flawed, because nodes can still &quot;pretend&quot; that a binary tree is a hexary (or even 256-ary) tree at the database layer (eg. see https:&#x2F;&#x2F;ethresear.ch&#x2F;t&#x2F;optimizing-sparse-merkle-trees&#x2F;3751), and thereby get the best-of-both-worlds of having the low proof sizes of the tree being binary from a hash-structure perspective and at the same time a much more efficient representation in the database.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, binary trees are expected to be widely used in Eth2, so this path improves forward-compatibility and reduces long-run total complexity for the protocol.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;path-length-instead-of-bit-prefix&quot;&gt;Path length instead of bit prefix&lt;&#x2F;h3&gt;
&lt;p&gt;In order to remove the complexity associated with byte manipulation, only the bit-length of the extension is used to merkelize a node with a prefix.&lt;&#x2F;p&gt;
&lt;p&gt;Storing the length of the path from the root node instead of that from the parent node has the nice property that siblings need not be hashed when deleting a leaf.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3102&#x2F;.&#x2F;assets&#x2F;sibling.svg&quot; alt=&quot;Sibling deletion diagram&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;On the left, a trie with the prefix length, and on the right, a trie with the full path length. Each both have values &lt;code&gt;10000100&lt;&#x2F;code&gt; and &lt;code&gt;10000000&lt;&#x2F;code&gt;. After deleting &lt;code&gt;10000100&lt;&#x2F;code&gt;,the sibling node has to be updated in the left tree, while it need not be in the case on the right.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;value-hashing&quot;&gt;Value hashing&lt;&#x2F;h3&gt;
&lt;p&gt;Except for the code, all values in the trie are less than 32 bytes. EIP-2926 introduces code chunks, with &lt;code&gt;CHUNK_SIZE = 32 bytes&lt;&#x2F;code&gt;. The hashing of the leaf&#x27;s value could therefore be saved. The authors of the EIP are however considering a future increase of &lt;code&gt;CHUNK_SIZE&lt;&#x2F;code&gt;, making &lt;code&gt;hash(value)&lt;&#x2F;code&gt; the future-proof choice.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;A hard fork is required in order for blocks to have a trie root using a different structure.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;As of &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;gballet&#x2F;multiproof-rs&#x2F;commit&#x2F;6d22b1aef9548581826b3c04b3e00d6cc709388c&quot;&gt;commit 0db87e187dc0bfb96046a47e3d6768c93a2e3331&lt;&#x2F;a&gt;, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;gballet&#x2F;multiproof-rs&quot;&gt;multiproof-rs&lt;&#x2F;a&gt; implements this merkelization rule in the &lt;code&gt;hash_m5()&lt;&#x2F;code&gt; function, found in file &lt;code&gt;src&#x2F;binary_tree.rs&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;An implementation of this structure for go-ethereum is available &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;gballet&#x2F;go-ethereum&#x2F;tree&#x2F;rebased-binary-trie-m5-full-path&quot;&gt;in this branch&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Issues could arise when performing the transition. In particular, a heavy conversion process could incentivize clients to wait the transition out. This could lead to a lowered network security at the time of the transition. A transition process has been proposed with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2584&#x2F;&quot;&gt;EIP-2584&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Optional access lists</title>
        <published>2020-08-29T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	<author>
		<name>Martin Swende</name><uri>https://github.com/holiman</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2930/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2930-optional-access-lists/4561" />
        

        <id>https://wg-eips.ritovision.com/2930/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2930"
            label="EIP-2930" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2930/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Adds a transaction type which contains an access list, a list of addresses and storage keys that the transaction plans to access. Accesses outside the list are possible, but become more expensive.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;We introduce a new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; transaction type, with the format &lt;code&gt;0x01 || rlp([chainId, nonce, gasPrice, gasLimit, to, value, data, accessList, signatureYParity, signatureR, signatureS])&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;accessList&lt;&#x2F;code&gt; specifies a list of addresses and storage keys; these addresses and storage keys are added into the &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt; and &lt;code&gt;accessed_storage_keys&lt;&#x2F;code&gt; global sets (introduced in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;). A gas cost is charged, though at a discount relative to the cost of accessing outside the list.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP serves two functions:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Mitigates contract breakage risks introduced by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;, as transactions could pre-specify and pre-pay for the accounts and storage slots that the transaction plans to access; as a result, in the actual execution, the SLOAD and EXT* opcodes would only cost 100 gas: low enough that it would not only prevent breakage due to that EIP but also &quot;unstuck&quot; any contracts that became stuck due to EIP 1884.&lt;&#x2F;li&gt;
&lt;li&gt;Introduces the access list format and the logic for handling the format. This logic can later be repurposed for many other purposes, including block-wide witnesses, use in ReGenesis, moving toward static state access over time, and more.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;TransactionType&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; &lt;code&gt;1&lt;&#x2F;code&gt;.  See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;ChainId&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; The transaction only valid on networks with this &lt;code&gt;chainID&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;YParity&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; The parity (0 for even, 1 for odd) of the y-value of a secp256k1 signature.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FORK_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;12244000&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ACCESS_LIST_STORAGE_KEY_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;1900&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ACCESS_LIST_ADDRESS_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;2400&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;As of &lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt;, a new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; transaction is introduced with &lt;code&gt;TransactionType&lt;&#x2F;code&gt; &lt;code&gt;1&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; &lt;code&gt;TransactionPayload&lt;&#x2F;code&gt; for this transaction is &lt;code&gt;rlp([chainId, nonce, gasPrice, gasLimit, to, value, data, accessList, signatureYParity, signatureR, signatureS])&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;signatureYParity, signatureR, signatureS&lt;&#x2F;code&gt; elements of this transaction represent a secp256k1 signature over &lt;code&gt;keccak256(0x01 || rlp([chainId, nonce, gasPrice, gasLimit, to, value, data, accessList]))&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; &lt;code&gt;ReceiptPayload&lt;&#x2F;code&gt; for this transaction is &lt;code&gt;rlp([status, cumulativeGasUsed, logsBloom, logs])&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;For the transaction to be valid, &lt;code&gt;accessList&lt;&#x2F;code&gt; must be of type &lt;code&gt;[[{20 bytes}, [{32 bytes}...]]...]&lt;&#x2F;code&gt;, where &lt;code&gt;...&lt;&#x2F;code&gt; means &quot;zero or more of the thing to the left&quot;. For example, the following is a valid access list (all hex strings would in reality be in byte representation):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &amp;quot;0x0000000000000000000000000000000000000000000000000000000000000003&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &amp;quot;0x0000000000000000000000000000000000000000000000000000000000000007&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ],&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;0xbb9bc244d798123fde783fcc1c72d3bb8c189413&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        []&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;At the beginning of execution (ie. at the same time as the &lt;code&gt;21000 + 4 * zeroes + 16 * nonzeroes&lt;&#x2F;code&gt; start gas is charged according to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2028&#x2F;&quot;&gt;EIP-2028&lt;&#x2F;a&gt; rules), we charge additional gas for the access list: &lt;code&gt;ACCESS_LIST_ADDRESS_COST&lt;&#x2F;code&gt; gas per address and &lt;code&gt;ACCESS_LIST_STORAGE_KEY_COST&lt;&#x2F;code&gt; gas per storage key. For example, the above example would be charged &lt;code&gt;ACCESS_LIST_ADDRESS_COST * 2 + ACCESS_LIST_STORAGE_KEY_COST * 2&lt;&#x2F;code&gt; gas.&lt;&#x2F;p&gt;
&lt;p&gt;Note that non-unique addresses and storage keys are not disallowed, though they will be charged for multiple times, and aside from the higher gas cost there is no other difference in execution flow or outcome from multiple-inclusion of a value as opposed to the recommended single-inclusion.&lt;&#x2F;p&gt;
&lt;p&gt;The address and storage keys would be immediately loaded into the &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt; and &lt;code&gt;accessed_storage_keys&lt;&#x2F;code&gt; global sets; this can be done using the following logic (which doubles as a specification-in-code of validation of the RLP-decoded access list)&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; process_access_list&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;access_list&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Tuple&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Set&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Address&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Set&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Pair&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Bytes32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    accessed_addresses&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; set&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    accessed_storage_keys&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; set&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; isinstance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;access_list&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; list&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; item&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; access_list&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; isinstance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;item&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; list&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;item&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Validate and add the address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; item&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; isinstance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        accessed_addresses&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        gas_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ACCESS_LIST_ADDRESS_COST&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Validate and add the storage keys&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; isinstance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;item&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; list&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; item&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; isinstance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            accessed_storage_keys&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            gas_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ACCESS_LIST_STORAGE_KEY_COST&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        accessed_addresses&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        accessed_storage_keys&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        gas_cost&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The access list is NOT charged per-byte fees like tx data is; the per-item costs described above are meant to cover the bandwidth costs of the access list data in addition to the costs of accessing those accounts and storage keys when evaluating the transaction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;charging-less-for-accesses-in-the-access-list&quot;&gt;Charging less for accesses in the access list&lt;&#x2F;h3&gt;
&lt;p&gt;This is done to encourage transactions to use the access list as much as possible, and because processing transactions is easier when their storage reads are predictable (because clients can pre-load the data from databases and&#x2F;or ask for witnesses at the time the transaction is received, or at least load the data in parallel).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;allowing-duplicates&quot;&gt;Allowing duplicates&lt;&#x2F;h3&gt;
&lt;p&gt;This is done because it maximizes simplicity, avoiding questions of what to prevent duplication against: just between two addresses&#x2F;keys in the access list, between the access list and the tx sender&#x2F;recipient&#x2F;newly created contract, other restrictions? Because gas is charged per item, there is no gain and only cost in including a value in the access list twice, so this should not lead to extra chain bloat in practice.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;signature-signs-over-the-transaction-type-as-well-as-the-transaction-data&quot;&gt;Signature signs over the transaction type as well as the transaction data&lt;&#x2F;h3&gt;
&lt;p&gt;This is done to ensure that the transaction cannot be &quot;re-interpreted&quot; as a transaction of a different type.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP does make it more gas-expensive to perform &quot;unexpected&quot; SLOADs and account accesses. Because gas is prepaid and so does not affect fixed-gas local calls, it does not break contracts in the way that previous gas cost increases would risk. However, it does make applications that heavily rely on storage access much less economically viable.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;access-list-generation&quot;&gt;Access list generation&lt;&#x2F;h3&gt;
&lt;p&gt;Access lists are difficult to construct in real-time in many situations, and this is exacerbated in environments where there is a high time lag between transaction generation and signing or simplicity of the transaction generator is highly valued (eg. either or both may apply in hardware wallets).&lt;&#x2F;p&gt;
&lt;p&gt;However, this EIP proposes only a 10% initial discount to access lists, so there is almost no cost to not bothering with access list generation and only making a simple transaction. The cost of accessing state outside the access list is expected to be ramped up in future hard forks over time as tools are developed and access list generation becomes more mature.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;transaction-size-bloating&quot;&gt;Transaction size bloating&lt;&#x2F;h3&gt;
&lt;p&gt;Average block size will increase as a result of access lists being used. However, the per-byte cost of access lists is &lt;code&gt;1900 &#x2F; 32 = 59.375&lt;&#x2F;code&gt; for storage keys and &lt;code&gt;2400 &#x2F; 20 = 120&lt;&#x2F;code&gt; for addresses, making it much more expensive than calldata; hence, worst-case block size will not increase. Additionally, increases in average block size will be partially compensated for by the ability to pre-fetch storage at time of receiving a transaction and&#x2F;or load storage in parallel upon receiving a block.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Staking Reward Calculation</title>
        <published>2020-08-28T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Tony Carson</name><email>tony.carsonn@gmail.com</email>
	</author>
	
	<author>
		<name>Mehmet Sabir Kiraz</name><email>m.kiraz@gmail.com</email>
	</author>
	
	<author>
		<name>Süleyman Kardaş</name><email>skardas@gmail.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2917/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/2925" />
        

        <id>https://wg-eips.ritovision.com/2917/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:2917"
            label="ERC-2917" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2917/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;ERC2917 is a new standardization for on-chain calculation of staking reward.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Based on the product of effective collateral and time, ERC2917 calculates the reward a user can get at any time, and realize the real decentralized DeFi. Here below is the formula for the calculation of reward for a user U:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2917&#x2F;.&#x2F;assets&#x2F;erc-reward-formula.png&quot; alt=&quot;concept image&quot; title=&quot;erc-reward-formula&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;where ∆p&lt;sub&gt;i&lt;&#x2F;sub&gt; denotes individual productivity of the user U between the consecutive block numbers t&lt;sub&gt;i-1&lt;&#x2F;sub&gt;  and t&lt;sub&gt;i&lt;&#x2F;sub&gt;, ∆P&lt;sub&gt;i&lt;&#x2F;sub&gt; denotes global productivity between the consecutive block numbers t&lt;sub&gt;i-1&lt;&#x2F;sub&gt;  and t&lt;sub&gt;i&lt;&#x2F;sub&gt;, and ∆G&lt;sub&gt;i&lt;&#x2F;sub&gt; denotes gross product between the consecutive block numbers t&lt;sub&gt;i-1&lt;&#x2F;sub&gt;  and t&lt;sub&gt;i&lt;&#x2F;sub&gt;. The formula ensures that there is no benefit in case of exiting earlier or entering later in the computation. The reward a user can get for a period is based on his total productivity during that specific time. The formula has been simplified through Solidity and generalized design to make it available across all DeFi products.
We note that the smart contract can be triggered for every computation of on the following events:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;whenever the productivity of a user changes (increase&#x2F;decrease),&lt;&#x2F;li&gt;
&lt;li&gt;whenever a user withdraws.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;One of the main drawbacks of many DeFi projects is the reward distribution mechanism within the smart contract. In fact, there are two main mechanisms are adopted so far.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Distribution of rewards is only given when all users exit the contract&lt;&#x2F;li&gt;
&lt;li&gt;The project collects on-chain data, conducts calculation off-chain, and sends the results
to the chain before starting rewards distribution accordingly&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The first approach conducts all calculation in an on-chain fashion, the cycle of its rewards distribution is too long. Furthermore, users need to remove their collateral before getting the rewards, which can be harmful for their rewards. The second approach is a semi-decentralized model since the main algorithm involves an off-chain computation. Therefore, the fairness and transparency properties cannot be reflected and this can even create the investment barrier for users.&lt;&#x2F;p&gt;
&lt;p&gt;Since there is more DeFi projects coming out everyday, users could not find a proper way  to get to know:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;amount of interests he&#x2F;she would get&lt;&#x2F;li&gt;
&lt;li&gt;how the interest calculated&lt;&#x2F;li&gt;
&lt;li&gt;what is his&#x2F;her contribution compare to the overall&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;By standardizing ERC2917, it abstracts the interface for interests generation process. Making wallet applications easier to collect each DeFi&#x27;s metrics, user friendlier.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Every ERC-2917 compliant contract must implement the ERC2917 and ERC20 interfaces (if necessary):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC2917&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC20&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emit when interests amount per block is &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; by the owner of the contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; It emits with the old interests amount and the new interests amount.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InterestRatePerBlockChanged&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; oldValue&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newValue&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emit when a users&amp;#39; productivity has &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; It emits with the user&amp;#39;s address and the value after the change.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ProductivityIncreased&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emit when a users&amp;#39; productivity has &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; It emits with the user&amp;#39;s address and the value after the change.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ProductivityDecreased&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Return the current contract&amp;#39;s interests rate per block.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; amount of interests currently producing per each block.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; interestsPerBlock&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Change the current contract&amp;#39;s interests rate.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the best practice will be restrict the gross product provider&amp;#39;s contract address to call this.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; true&#x2F;false to notice that the value has successfully &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; or not, when it succeed, it will emite the InterestRatePerBlockChanged event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; changeInterestRatePerBlock&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; It will get the productivity of given user.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; it will return 0 if user has no productivity proved in the contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; user&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&amp;#39;s productivity and overall productivity.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getProductivity&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; increase a user&amp;#39;s productivity.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the best practice will be restrict the callee to prove of productivity&amp;#39;s contract address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; true&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; to confirm that the productivity added success.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; increaseProductivity&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; decrease a user&amp;#39;s productivity.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the best practice will be restrict the callee to prove of productivity&amp;#39;s contract address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; true&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; to confirm that the productivity removed success.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; decreaseProductivity&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; take() will return the interests that callee will get at current block height.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; it will always calculated by block.number, so it will change when block height changes.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; of the interests that user are able to mint() at current block height.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; take&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; similar to take(), but with the block height joined to calculate return.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; for instance, it returns (_amount, _block), which means at block height _block, the callee has accumulated _amount of interests.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; of interests and the block height.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; takeWithBlock&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; mint the available interests to callee.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; once it mint, the amount of interests will transfer to callee&amp;#39;s address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; amount of interests minted.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;interestrateperblockchanged&quot;&gt;InterestRatePerBlockChanged&lt;&#x2F;h3&gt;
&lt;p&gt;This emit when interests amount per block is changed by the owner of the contract. It emits with the old interests amount and the new interests amount.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;productivityincreased&quot;&gt;ProductivityIncreased&lt;&#x2F;h3&gt;
&lt;p&gt;It emits with the user&#x27;s address and the value after the change.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;productivitydecreased&quot;&gt;ProductivityDecreased&lt;&#x2F;h3&gt;
&lt;p&gt;It emits with the user&#x27;s address and the value after the change.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;interestsperblock&quot;&gt;interestsPerBlock&lt;&#x2F;h3&gt;
&lt;p&gt;It returns the amount of interests currently producing per each block.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;changeinterestrateperblock&quot;&gt;changeInterestRatePerBlock&lt;&#x2F;h3&gt;
&lt;p&gt;Note the best practice will be restrict the gross product provider&#x27;s contract address to call this.&lt;&#x2F;p&gt;
&lt;p&gt;The true&#x2F;false to notice that the value has successfully changed or not, when it succeed, it will emite the InterestRatePerBlockChanged event.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;getproductivity&quot;&gt;getProductivity&lt;&#x2F;h3&gt;
&lt;p&gt;It returns user&#x27;s productivity and overall productivity. It returns 0 if user has no productivity proved in the contract.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;increaseproductivity&quot;&gt;increaseProductivity&lt;&#x2F;h3&gt;
&lt;p&gt;It increases a user&#x27;s productivity.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;decreaseproductivity&quot;&gt;decreaseProductivity&lt;&#x2F;h3&gt;
&lt;p&gt;It decreases a user&#x27;s productivity.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;take&quot;&gt;take&lt;&#x2F;h3&gt;
&lt;p&gt;It returns the interests that callee will get at current block height.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;takewithblock&quot;&gt;takeWithBlock&lt;&#x2F;h3&gt;
&lt;p&gt;Similar to take(), but with the block height joined to calculate return.&lt;&#x2F;p&gt;
&lt;p&gt;For instance, it returns (_amount, _block), which means at block height _block, the callee has accumulated _amount of interests.&lt;&#x2F;p&gt;
&lt;p&gt;It returns amount of interests and the block height.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;mint&quot;&gt;mint&lt;&#x2F;h3&gt;
&lt;p&gt;it mints the amount of interests will transfer to callee&#x27;s address. It returns the amount of interests minted.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The implementation code is on the github:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;gnufoo&#x2F;ERC3000-Proposal&quot;&gt;ERC2917 Demo&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Chunk-Based Code Merkleization</title>
        <published>2020-08-25T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Sina Mahmoodi</name><uri>https://github.com/s1na</uri>
	</author>
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	<author>
		<name>Guillaume Ballet</name><uri>https://github.com/gballet</uri>
	</author>
	
	<author>
		<name>Jochem Brouwer</name><uri>https://github.com/jochem-brouwer</uri>
	</author>
	
	<author>
		<name>Ignacio Hagopian</name><uri>https://github.com/jsign</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2926/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2926-chunk-based-code-merkleization/4555" />
        

        <id>https://wg-eips.ritovision.com/2926/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:2926"
            label="EIP-2926" />
        

        
        

        
        <summary type="html">Introduce code-chunking in an MPT context.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2926/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Code merkleization, along with binarification of the trie and gas cost bump of state-accessing opcodes, are considered as the main levers for decreasing block witness sizes in stateless or partial-stateless Eth1x roadmaps. Here we specify a fixed-sized chunk approach to code merkleization and outline how the transition of existing contracts to this model would look like.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Bytecode is currently the second contributor to block witness size, after the proof hashes. Transitioning the trie from hexary to binary reduces the hash section of the witness by 3x, thereby making code the first contributor. By breaking contract code into chunks and committing to those chunks in a merkle tree, stateless clients would only need the chunks that were touched during a given transaction to execute it.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;What follows is structured to have two sections:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;How a given contract code is split into chunks and then merkleized&lt;&#x2F;li&gt;
&lt;li&gt;How to merkleize all existing contract codes during a hardfork&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;constants-and-definitions&quot;&gt;Constants and Definitions&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;CHUNK_SIZE&lt;&#x2F;code&gt;: 31 (bytes)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;VERSION_KEY&lt;&#x2F;code&gt;: &lt;code&gt;max(u256)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;VERSION&lt;&#x2F;code&gt;: 0&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;EMPTY_CODE_ROOT&lt;&#x2F;code&gt;: &lt;code&gt;0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470&lt;&#x2F;code&gt; (==&lt;code&gt;keccak256(&#x27;&#x27;)&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;HF_TIMESTAMP&lt;&#x2F;code&gt;: to be defined&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ITERATOR_STRIDE&lt;&#x2F;code&gt;: &lt;code&gt;TBC&lt;&#x2F;code&gt; but based on verkle numbers, first devnets should use &lt;code&gt;50_000&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;BE(x, N)&lt;&#x2F;code&gt;: casts &lt;code&gt;x&lt;&#x2F;code&gt; to an unsigned integer of &lt;code&gt;N&lt;&#x2F;code&gt; bytes and returns its big-endian representation&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;code-merkleization&quot;&gt;Code merkleization&lt;&#x2F;h3&gt;
&lt;p&gt;For an account record &lt;code&gt;A&lt;&#x2F;code&gt; with code &lt;code&gt;C&lt;&#x2F;code&gt;, two extra optional fields are added: &lt;code&gt;A.codeSize&lt;&#x2F;code&gt; and &lt;code&gt;A.codeRoot&lt;&#x2F;code&gt;. &lt;code&gt;A.codeHash&lt;&#x2F;code&gt; is retained to serve &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;If &lt;code&gt;C&lt;&#x2F;code&gt; is empty, i.e. in the case of an EoA, &lt;code&gt;A.codeRoot&lt;&#x2F;code&gt; and &lt;code&gt;A.codeSize&lt;&#x2F;code&gt; are omitted from the account&#x27;s RLP. This is intended to limit the size overhead of this change.&lt;&#x2F;p&gt;
&lt;p&gt;If &lt;code&gt;C&lt;&#x2F;code&gt; is not empty:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;A.codeSize = len(code)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;A.codeRoot&lt;&#x2F;code&gt; contains the root of &lt;code&gt;codeTrie&lt;&#x2F;code&gt;, a trie with the following leaves:
&lt;ul&gt;
&lt;li&gt;Key: &lt;code&gt;VERSION_KEY&lt;&#x2F;code&gt;, value: &lt;code&gt;BE(VERSION, 1)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;A list of code &lt;code&gt;chunks = [(FIO_0, code_0), ..., (FIO_n, code_n)]&lt;&#x2F;code&gt; which are derived from &lt;code&gt;C&lt;&#x2F;code&gt; as follows:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;code_0 || ... || code_n == C&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;length(code_i) == CHUNK_SIZE&lt;&#x2F;code&gt; where &lt;code&gt;0 &amp;lt;= i &amp;lt; n&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;length(code_n) &amp;lt;= CHUNK_SIZE&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;FIO_i&lt;&#x2F;code&gt; is the offset of the first instruction within the chunk. It should only be greater than zero if the last instruction in &lt;code&gt;code_i-1&lt;&#x2F;code&gt; is a multi-byte instruction (like &lt;code&gt;PUSHN&lt;&#x2F;code&gt;) crossing the chunk boundary. It is set to &lt;code&gt;CHUNK_SIZE&lt;&#x2F;code&gt; in the case where all bytes of a chunk are data.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;code&gt;i&lt;&#x2F;code&gt;th element of &lt;code&gt;chunks&lt;&#x2F;code&gt; is stored in &lt;code&gt;codeTrie&lt;&#x2F;code&gt; with:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Key: &lt;code&gt;BE(i, 4)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Value: &lt;code&gt;BE(FIO_i, 1) || code_i&lt;&#x2F;code&gt;, where &lt;code&gt;||&lt;&#x2F;code&gt; stands for byte-wise concatenation&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;contract-creation-gas-cost&quot;&gt;Contract creation gas cost&lt;&#x2F;h4&gt;
&lt;p&gt;As of now there is a charge of 200 gas per byte of the code stored in state by contract creation operations, be it initiated via &lt;code&gt;CREATE&lt;&#x2F;code&gt;, &lt;code&gt;CREATE2&lt;&#x2F;code&gt;, or an external transaction. This per byte cost is to be increased from &lt;code&gt;200&lt;&#x2F;code&gt; to &lt;code&gt;500&lt;&#x2F;code&gt; to account for the chunking and merkleization costs. This number is inherited from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4762&#x2F;&quot;&gt;EIP-4762&lt;&#x2F;a&gt; and is picked for forward-compatibility.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;updating-existing-code-transition-process&quot;&gt;Updating existing code (transition process)&lt;&#x2F;h3&gt;
&lt;p&gt;The transition process involves reading all contracts in the state and applying the above procedure to them. A process similar to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7612&#x2F;&quot;&gt;EIP-7612&lt;&#x2F;a&gt; is to be used, as the total code size at the time of this EIP edit is &amp;gt;10GB and can not be processed in a single block.&lt;&#x2F;p&gt;
&lt;p&gt;Note that:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Because multiple accounts can share the same code hash, the whole account tree needs to be iterated over to convert each account. Only iterating over the bytecodes isn&#x27;t enough.&lt;&#x2F;li&gt;
&lt;li&gt;Nonetheless, the conversion process should take a few hours, instead of days for a full tree change.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;At &lt;code&gt;HF_TIMESTAMP&lt;&#x2F;code&gt; the EIP gets activated:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;any contract creation and 7702 delegation updates must use the new format.
&lt;ul&gt;
&lt;li&gt;for 7702 accounts, the code size is set to &lt;code&gt;23&lt;&#x2F;code&gt;, and &lt;code&gt;CODESIZE&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;CODECOPY&lt;&#x2F;code&gt; are forwarded to the delegated account. &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt; behave the same as they did before the activation of this EIP.&lt;&#x2F;li&gt;
&lt;li&gt;accounts are NOT converted in case of a balance or nonce update: accounts are converted by the iterator sweep or automatically at creation time.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;at the end of block processing, and after all transactions have been executed but before recomputing the tree root hash, the client iterates over &lt;code&gt;ITERATOR_STRIDE&lt;&#x2F;code&gt; accounts in the tree, and for each account:
&lt;ul&gt;
&lt;li&gt;if the account has empty code, or is a contract using the new format, leave that account untouched,&lt;&#x2F;li&gt;
&lt;li&gt;if the account is a &quot;legacy&quot; contract, convert it and write it back to the tree&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The value for &lt;code&gt;ITERATOR_STRIDE&lt;&#x2F;code&gt; has been chosen to be safe while ensuring the transition process does not last too long. At the current state size and block time, this represents about 10000 blocks, which is about one and a half day.&lt;&#x2F;p&gt;
&lt;p&gt;Following the transition process described in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8032&#x2F;&quot;&gt;EIP-8032&lt;&#x2F;a&gt;, the transition process uses a system contract to store its progress pointers. The transition process has been designed in such a way that if both EIPs are activated at the same time, their transition process can be merged. Refer to that EIP for more details.&lt;&#x2F;p&gt;
&lt;p&gt;Note that for a bytecode used by multiple contracts, the chunking need happen only once. Such contract only need to update their code size and code root, which MAY be cached during the transition process.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;hexary-vs-binary-trie&quot;&gt;Hexary vs binary trie&lt;&#x2F;h3&gt;
&lt;p&gt;The trie format is chosen to be the same as that of the account trie. If a tree conversion happens at a later stage, the chunk tree will have to be converted as well, e.g. the way it is in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6800&#x2F;&quot;&gt;EIP-6800&lt;&#x2F;a&gt; or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7864&#x2F;&quot;&gt;EIP-7864&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;chunk-size&quot;&gt;Chunk size&lt;&#x2F;h3&gt;
&lt;p&gt;The current recommended chunk size of 31 bytes has been selected based on a few observations. Smaller chunks are more efficient (i.e. have higher chunk utilization), but incur a larger hash overhead (i.e. number of hashes as part of the proof) due to a higher trie depth. Larger chunks are less efficient, but incur less hash overhead. We plan to run a larger experiment comparing various chunk sizes to arrive at a final recommendation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;first-instruction-offset&quot;&gt;First instruction offset&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;firstInstructionOffset&lt;&#x2F;code&gt; field allows safe jumpdest analysis when a client doesn&#x27;t have all the chunks, e.g. a stateless clients receiving block witnesses.&lt;&#x2F;p&gt;
&lt;p&gt;Note: there could be an edge case when computing FIO for the chunks where the data bytes at the end of a bytecode (last chunk) resemble a multi-byte instruction. This case can be safely ignored.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-cost-of-code-accessing-opcodes&quot;&gt;Gas cost of code-accessing opcodes&lt;&#x2F;h3&gt;
&lt;p&gt;Details of how the code is stored, is left to the client implementers. However, to reflect the removal of the max code limit and the fact that larger codes will be more expensive to load, reading a non-accessed chunk will incur a 200 warming cost, and chunks written beyond the 24kb limit will cost 500 gas instead of 200.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;different-chunking-logic&quot;&gt;Different chunking logic&lt;&#x2F;h3&gt;
&lt;p&gt;We have considered an alternative option to package chunks, where each chunk is prepended with its &lt;code&gt;chunkLength&lt;&#x2F;code&gt; and would only contain complete opcodes (i.e. any multi-byte opcode not fitting the &lt;code&gt;CHUNK_SIZE&lt;&#x2F;code&gt; would be deferred to the next chunk).&lt;&#x2F;p&gt;
&lt;p&gt;This approach has downsides compared to the one specified:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Requires a larger &lt;code&gt;CHUNK_SIZE&lt;&#x2F;code&gt; -- at least 33 bytes to accommodate the &lt;code&gt;PUSH32&lt;&#x2F;code&gt; instruction.&lt;&#x2F;li&gt;
&lt;li&gt;It is more wasteful. For example, &lt;code&gt;DUP1 PUSH32 &amp;lt;32-byte payload&amp;gt;&lt;&#x2F;code&gt; would be encoded as two chunks, the first chunk contains only &lt;code&gt;DUP1&lt;&#x2F;code&gt;, and the second contains only the &lt;code&gt;PUSH32&lt;&#x2F;code&gt; instruction with its payload.&lt;&#x2F;li&gt;
&lt;li&gt;Calculating the number of chunks is not trivial and would have to be stored explicitly in the metadata.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Additionally we have reviewed many other options (basic block based, Solidity subroutines (requires determining the control flow), EIP-2315 subroutines). This EIP however only focuses on the chunk-based option.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;From the perspective of contracts, the design aims to be transparent, with the exception of changes in gas costs.&lt;&#x2F;p&gt;
&lt;p&gt;Outside of the interface presented for contracts, this proposal introduces major changes to the way contract code is stored, and needs a substantial modification of the Ethereum state. Therefore it can only be introduced via a hard fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;p&gt;Show the &lt;code&gt;codeRoot&lt;&#x2F;code&gt; for the following cases:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;code=&#x27;&#x27;&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;code=&#x27;PUSH1(0) DUP1 REVERT&#x27;&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;code=&#x27;PUSH32(-1)&#x27;&lt;&#x2F;code&gt; (data passing through a chunk boundary)&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;TBA&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>ABI specification for REVERT reason string</title>
        <published>2020-08-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Federico Bond</name><uri>https://github.com/federicobond</uri>
	</author>
	
	<author>
		<name>Renan Rodrigues de Souza</name><uri>https://github.com/RenanSouza2</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/838/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-838-what-is-the-current-status/14671" />
        

        <id>https://wg-eips.ritovision.com/838/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:838"
            label="ERC-838" />
        

        
        

        
        <summary type="html">A proposal to extend the ABI specification to include typed errors in the REVERT reason string.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/838/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal specifies how to encode potential error conditions in the JSON ABI of a smart contract. A high-level language could then provide a syntax for declaring and throwing these errors. The compiler will encode these errors in the reason parameter of the REVERT opcode in a way that can be easily reconstructed by libraries such as web3.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;It&#x27;s important to provide clear feedback to users (and developers) about what went wrong with their Ethereum transactions. The REVERT opcode is a step in the right direction, as it allows smart contract developers to encode a message describing the failure in the reason parameter. There is an implementation under review in Solidity that accepts a string, thus providing a low-level interface to this parameter. However, standardizing a method for passing errors from this parameter back to clients will bring many benefits to both users and developers.&lt;&#x2F;p&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;To conform to this specification, compilers producing JSON ABIs SHOULD include error declarations alongside functions and events. Each error object MUST contain the keys name (string) and arguments (same types as the function’s inputs list). The value of type MUST be &quot;error&quot;.&lt;&#x2F;p&gt;
&lt;p&gt;Example:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{ &amp;quot;type&amp;quot;: &amp;quot;error&amp;quot;, &amp;quot;name&amp;quot;: &amp;quot;InsufficientBalance&amp;quot;, &amp;quot;arguments&amp;quot;: [ { &amp;quot;name&amp;quot;: &amp;quot;amount&amp;quot;, &amp;quot;type&amp;quot;: &amp;quot;uint256&amp;quot; } ] }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;A selector for this error can be computed from its signature (InsufficientBalance() for the example above) in the same way that it&#x27;s currently done for public functions and events. This selector MUST be included in the reason string so that clients can perform a lookup. Any arguments for the error are RLP encoded in the same way as return values from functions. The exact format in which both the selector and the arguments are encoded is to be defined. The Solidity implementation mentioned above leaves room for expansion by prefixing the free-form string with uint256(0).&lt;&#x2F;p&gt;
&lt;p&gt;A high-level language like Solidity can then implement a syntax like this:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;contract MyToken {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  error InsufficientFunds(uint256 amount);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  function transfer(address _to, uint256 _amount) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if (balances[msg.sender] &amp;lt;= _amount)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;       throw InsufficientFunds(_amount);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;possible-extensions&quot;&gt;Possible extensions&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;A NatSpec comment above the error declaration can be used to provide a default error message. Arguments to the error can be interpolated in the message string with familiar NatSpec syntax.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&#x2F; @notice You don&amp;#39;t have enough funds to transfer `amount`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;error InsufficientFunds(uint256 amount);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ol start=&quot;2&quot;&gt;
&lt;li&gt;A function may declare to its callers which errors it can throw. A list of these errors must be included in the JSON ABI item for that function, under the &lt;code&gt;errors&lt;&#x2F;code&gt; key. Example:&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function transfer(address _to, uint256 _amount) throws(InsufficientFunds);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Special consideration should be given to error overloading if we want to support a similar syntax in the future, as errors with same name but different arguments will produce a different selector.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion. &lt;!-- TODO --&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Apps and tools that have not implemented this spec can ignore the encoded reason string when it&#x27;s not prefixed by zero.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion. &lt;!-- TODO --&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Deposit contract and address standard</title>
        <published>2020-08-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Jonathan Underwood</name><uri>https://github.com/junderw</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2876/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/junderw/deposit-contract-poc/issues/1" />
        

        <id>https://wg-eips.ritovision.com/2876/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:2876"
            label="ERC-2876" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2876/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC defines a simple contract interface for managing deposits. It also defines a new address format that encodes the extra data passed into the interface&#x27;s main deposit function.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;An ERC-2876 compatible &lt;strong&gt;deposit system&lt;&#x2F;strong&gt; can accept ETH payments from multiple depositors without the need for managing multiple keys or requiring use of a hot wallet.&lt;&#x2F;p&gt;
&lt;p&gt;An ERC-2876 compatible &lt;strong&gt;wallet application&lt;&#x2F;strong&gt; can send ETH to ERC-2876 compatible &lt;strong&gt;deposit systems&lt;&#x2F;strong&gt; in a way that the &lt;strong&gt;deposit system&lt;&#x2F;strong&gt; can differentiate their payment using the 8 byte id specified in this standard.&lt;&#x2F;p&gt;
&lt;p&gt;Adoption of ERC-2876 by all exchanges (as a deposit system and as a wallet for their withdrawal systems), merchants, and all wallet applications&#x2F;libraries will likely decrease total network gas usage by these systems, since two value transactions cost 42000 gas while a simple ETH forwarding contract will cost closer to 30000 gas depending on the underlying implementation.&lt;&#x2F;p&gt;
&lt;p&gt;This also has the benefit for deposit system administrators of allowing for all deposits to be forwarded to a cold wallet directly without any manual operations to gather deposits from multiple external accounts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Centralized exchanges and merchants (Below: &quot;apps&quot;) require an address format for accepting deposits. Currently the address format used refers to an account (external or contract), but this creates a problem. It requires that apps create a new account for every invoice &#x2F; user. If the account is external, that means the app must have the deposit addresses be hot wallets, or have increased workload for cold wallet operators (as each deposit account will create 1 value tx to sweep). If the account is contract, generating an account costs at least 60k gas for a simple proxy, which is cost-prohibitive.&lt;&#x2F;p&gt;
&lt;p&gt;Therefore, merchant and centralized exchange apps are forced between taking on one of the following:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Large security risk (deposit accounts are hot wallets)&lt;&#x2F;li&gt;
&lt;li&gt;Large manual labor cost (cold account manager spends time sweeping thousands of cold accounts)&lt;&#x2F;li&gt;
&lt;li&gt;Large service cost (deploying a contract-per-deposit-address model).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The timing of this proposal is within the context of increased network gas prices. During times like this, more and more services who enter the space are being forced into hot wallets for deposits, which is a large security risk.&lt;&#x2F;p&gt;
&lt;p&gt;The motivation for this proposal is to lower the cost of deploying and managing a system that accepts deposits from many users, and by standardizing the methodology for this, services across the world can easily use this interface to send value to and from each other without the need to create multiple accounts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;,  &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;The contract interface&lt;&#x2F;code&gt; is the contract component of this ERC.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;The deposit address format&lt;&#x2F;code&gt; is the newly made format described in &quot;Deposit Address Format&quot; for encoding the 20 byte account address and the 8 byte id.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;The contract&lt;&#x2F;code&gt; refers to the contract that implements &lt;code&gt;the contract interface&lt;&#x2F;code&gt; of this ERC.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;The 8 byte &quot;id&quot;&lt;&#x2F;code&gt; is an 8 byte id used as the input parameter for the contract interface.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;The 5 byte &quot;nonce&quot;&lt;&#x2F;code&gt; is the first 5 most significant bytes of the &lt;code&gt;&quot;id&quot;&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;The 3 byte &quot;checksum&quot;&lt;&#x2F;code&gt; is the last 3 least significant bytes of the &lt;code&gt;&quot;id&quot;&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;deposit(bytes8)&lt;&#x2F;code&gt; refers to the function of that signature, which is defined in &lt;code&gt;the contract interface&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;The parent application&lt;&#x2F;code&gt; refers to the application that will use the information gained within the &lt;code&gt;deposit(bytes8)&lt;&#x2F;code&gt; function. (ie. an exchange backend or a non-custodial merchant application)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;The depositor&lt;&#x2F;code&gt; refers to the person that will send value to &lt;code&gt;the contract&lt;&#x2F;code&gt; via the &lt;code&gt;deposit(bytes8)&lt;&#x2F;code&gt; call.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;The wallet&lt;&#x2F;code&gt; refers to any application or library that sends value transactions upon the request of &lt;code&gt;the depositor&lt;&#x2F;code&gt;. (ie. MyEtherWallet, Ledger, blockchain.com, various libraries)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;deposit-address-format&quot;&gt;Deposit Address Format&lt;&#x2F;h3&gt;
&lt;p&gt;In order to add the 8 byte &quot;id&quot; data, we need to encode it along with the 20 byte
account address. The 8 bytes are appended to the 20 byte address.&lt;&#x2F;p&gt;
&lt;p&gt;A 3 byte checksum is included in the id, which is the first 3 bytes of the keccak256
hash of the 20 byte address and first 5 byte nonce of the id concatenated (25 bytes).&lt;&#x2F;p&gt;
&lt;p&gt;The Deposit Address format can be generated with the following JavaScript code:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * Converts a 20 byte account address and a 5 byte nonce to a deposit address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * The format of the return value is 28 bytes as follows. The + operator is byte&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * concatenation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * (baseAddress + nonce + keccak256(baseAddress + nonce)[:3])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;param&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;String&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; baseAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the given HEX address (20 byte hex string with 0x prepended)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;param&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;String&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the given HEX nonce (5 byte hex string with 0x prepended)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;String&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; generateAddress&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;baseAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    !&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;baseAddress&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;match&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;^&lt;&#x2F;span&gt;&lt;span class=&quot;z-string z-regexp&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0-9&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;a-f&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;A-F&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;{40}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    !&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;nonce&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;match&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;^&lt;&#x2F;span&gt;&lt;span class=&quot;z-string z-regexp&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0-9&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;a-f&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;A-F&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;{10}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    throw&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Error&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Base Address and nonce must be 0x hex strings&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; ret&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    baseAddress&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;toLowerCase&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;toLowerCase&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;replace&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;^&lt;&#x2F;span&gt;&lt;span class=&quot;z-string z-regexp&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; myHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; web3&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;utils&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;ret&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ret&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; myHash&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;slice&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; first 3 bytes from the 0x hex string&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The checksum can be verified within the deposit contract itself using the following:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checksumMatch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; chkhash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes5&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes3&lt;&#x2F;span&gt;&lt;span&gt; chkh &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes3&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;chkhash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes3&lt;&#x2F;span&gt;&lt;span&gt; chki &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes3&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes8&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 40&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; chkh &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; chki&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;the-contract-interface&quot;&gt;The Contract Interface&lt;&#x2F;h3&gt;
&lt;p&gt;A contract that follows this ERC:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;The contract&lt;&#x2F;code&gt; MUST revert if sent a transaction where &lt;code&gt;msg.data&lt;&#x2F;code&gt; is null (A pure value transaction).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;The contract&lt;&#x2F;code&gt; MUST have a deposit function as follows:&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DepositEIP&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; deposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;deposit(bytes8)&lt;&#x2F;code&gt; MUST return &lt;code&gt;false&lt;&#x2F;code&gt; when the contract needs to keep the value, but signal to the depositor that the deposit (in terms of the parent application) itself has not yet succeeded. (This can be used for partial payment, ie. the invoice is for 5 ETH, sending 3 ETH returns false, but sending a second tx with 2 ETH will return true.)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;deposit(bytes8)&lt;&#x2F;code&gt; MUST revert if the deposit somehow failed and the contract does not need to keep the value sent.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;deposit(bytes8)&lt;&#x2F;code&gt; MUST return &lt;code&gt;true&lt;&#x2F;code&gt; if the value will be kept and the payment is logically considered complete by the parent application (exchange&#x2F;merchant).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;deposit(bytes8)&lt;&#x2F;code&gt; SHOULD check the checksum contained within the 8 byte id. (See &quot;Deposit Address Format&quot; for an example)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;The parent application&lt;&#x2F;code&gt; SHOULD return any excess value received if the deposit id is a one-time-use invoice that has a set value and the value received is higher than the set value. However, this SHOULD NOT be done by sending back to &lt;code&gt;msg.sender&lt;&#x2F;code&gt; directly, but rather should be noted in the parent application and the depositor should be contacted out-of-band to the best of the application manager&#x27;s ability.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;depositing-value-to-the-contract-from-a-wallet&quot;&gt;Depositing Value to the Contract from a Wallet&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;The wallet&lt;&#x2F;code&gt; MUST accept &lt;code&gt;the deposit address format&lt;&#x2F;code&gt; anywhere the 20-byte address format is accepted for transaction destination.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;The wallet&lt;&#x2F;code&gt; MUST verify the 3 byte checksum and fail if the checksum doesn&#x27;t match.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;The wallet&lt;&#x2F;code&gt; MUST fail if the destination address is &lt;code&gt;the deposit address format&lt;&#x2F;code&gt; and the &lt;code&gt;data&lt;&#x2F;code&gt; field is set to anything besides null.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;The wallet&lt;&#x2F;code&gt; MUST set the &lt;code&gt;to&lt;&#x2F;code&gt; field of the underlying transaction to the first 20 bytes of the deposit address format, and set the &lt;code&gt;data&lt;&#x2F;code&gt; field to &lt;code&gt;0x3ef8e69aNNNNNNNNNNNNNNNN000000000000000000000000000000000000000000000000&lt;&#x2F;code&gt; where &lt;code&gt;NNNNNNNNNNNNNNNN&lt;&#x2F;code&gt; is the last 8 bytes of the deposit address format. (ie. if the deposit address format is set to &lt;code&gt;0x433e064c42e87325fb6ffa9575a34862e0052f26913fd924f056cd15&lt;&#x2F;code&gt; then the &lt;code&gt;to&lt;&#x2F;code&gt; field is &lt;code&gt;0x433e064c42e87325fb6ffa9575a34862e0052f26&lt;&#x2F;code&gt; and the &lt;code&gt;data&lt;&#x2F;code&gt; field is &lt;code&gt;0x3ef8e69a913fd924f056cd15000000000000000000000000000000000000000000000000&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The contract interface and address format combination has one notable drawback, which was brought up in discussion. This ERC can only handle deposits for native value (ETH) and not other protocols such as ERC-20. However, this is not considered a problem, because it is best practice to logically AND key-wise separate wallets for separate currencies in any exchange&#x2F;merchant application for accounting reasons and also for security reasons. Therefore, using this method for the native value currency (ETH) and another method for ERC-20 tokens etc. is acceptable. Any attempt at doing something similar for ERC-20 would require modifying the ERC itself (by adding the id data as a new input argument to the transfer method etc.) which would grow the scope of this ERC too large to manage. However, if this address format catches on, it would be trivial to add the bytes8 id to any updated protocols (though adoption might be tough due to network effects).&lt;&#x2F;p&gt;
&lt;p&gt;The 8 byte size of the id and the checksum 3 : nonce 5 ratio were decided with the following considerations:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;24 bit checksum is better than the average 15 bit checksum of an EIP-55 address.&lt;&#x2F;li&gt;
&lt;li&gt;40 bit nonce allows for over 1 trillion nonces.&lt;&#x2F;li&gt;
&lt;li&gt;64 bit length of the id was chosen as to be long enough to support a decent checksum and plenty of nonces, but not be too long. (Staying under 256 bits makes hashing cheaper in gas costs as well.)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;An address generated with the deposit address format will not be considered a valid address for applications that don&#x27;t support it. If the user is technical enough, they can get around lack of support by verifying the checksum themselves, creating the needed data field by hand, and manually input the data field. (assuming the wallet app allows for arbitrary data input on transactions) A tool could be hosted on github for users to get the needed 20 byte address and msg.data field from a deposit address.&lt;&#x2F;p&gt;
&lt;p&gt;Since a contract following this ERC will reject any plain value transactions, there is no risk of extracting the 20 byte address and sending to it without the calldata.&lt;&#x2F;p&gt;
&lt;p&gt;However, this is a simple format, and easy to implement, so the author of this ERC will first implement in web3.js and encourage adoption with the major wallet applications.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;address&amp;quot;: &amp;quot;0x083d6b05729c58289eb2d6d7c1bb1228d1e3f795&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;nonce&amp;quot;: &amp;quot;0xbdd769c69b&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;depositAddress&amp;quot;: &amp;quot;0x083d6b05729c58289eb2d6d7c1bb1228d1e3f795bdd769c69b3b97b9&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;address&amp;quot;: &amp;quot;0x433e064c42e87325fb6ffa9575a34862e0052f26&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;nonce&amp;quot;: &amp;quot;0x913fd924f0&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;depositAddress&amp;quot;: &amp;quot;0x433e064c42e87325fb6ffa9575a34862e0052f26913fd924f056cd15&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;address&amp;quot;: &amp;quot;0xbbc6597a834ef72570bfe5bb07030877c130e4be&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;nonce&amp;quot;: &amp;quot;0x2c8f5b3348&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;depositAddress&amp;quot;: &amp;quot;0xbbc6597a834ef72570bfe5bb07030877c130e4be2c8f5b3348023045&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;address&amp;quot;: &amp;quot;0x17627b07889cd22e9fae4c6abebb9a9ad0a904ee&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;nonce&amp;quot;: &amp;quot;0xe619dbb618&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;depositAddress&amp;quot;: &amp;quot;0x17627b07889cd22e9fae4c6abebb9a9ad0a904eee619dbb618732ef0&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;address&amp;quot;: &amp;quot;0x492cdf7701d3ebeaab63b4c7c0e66947c3d20247&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;nonce&amp;quot;: &amp;quot;0x6808043984&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;depositAddress&amp;quot;: &amp;quot;0x492cdf7701d3ebeaab63b4c7c0e66947c3d202476808043984183dbe&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;A sample implementation with an example contract and address generation (in the tests) is located here:&lt;&#x2F;p&gt;
&lt;p&gt;https:&#x2F;&#x2F;github.com&#x2F;junderw&#x2F;deposit-contract-poc&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;In general, contracts that implement the contract interface should forward funds received to the deposit(bytes8) function to their cold wallet account. This address SHOULD be hard coded as a constant OR take advantage of the &lt;code&gt;immutable&lt;&#x2F;code&gt; keyword in solidity versions &lt;code&gt;&amp;gt;=0.6.5&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;To prevent problems with deposits being sent after the parent application is shut down, a contract SHOULD have a kill switch that will revert all calls to deposit(bytes8) rather than using &lt;code&gt;selfdestruct(address)&lt;&#x2F;code&gt; (since users who deposit will still succeed, since an external account will receive value regardless of the calldata, and essentially the self-destructed contract would become a black hole for any new deposits)&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Exclusive Claimable Token</title>
        <published>2020-08-10T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Zhenyu Sun</name><uri>https://github.com/Ungigdu</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3135/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/3132" />
        

        <id>https://wg-eips.ritovision.com/3135/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:3135"
            label="ERC-3135" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3135/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;This standard defines a token which can be claimed only by token issuer with payer&#x27;s signature.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP defines a set of additions to the default token standard such as ERC-20, that allows online&#x2F;offline service providers establish micropayment channels with any number of users by signing and verifying messages about the consumption of token off chain. Using this mechanism will reduce interactions with blockchain to minimal for both participants, thus saving gas and improve performance.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;There are two main purposes of this EIP, one is to reduce interactions with blockchain, the second is to link Ethereum to real-world payment problems.&lt;&#x2F;p&gt;
&lt;p&gt;Many small businesses want to build payment system based on blockchain but find it difficult. There are basically two ways:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Directly pay with token. There are many wallet can receive and transfer token but transactions on Ethereum cost gas and take time to confirm.&lt;&#x2F;li&gt;
&lt;li&gt;User lock token on payment smart contract and service provider use payment messages signed by user to release token, establishing a micropayment channel. The advantage is interactions with blockchain is reduced and the signing&#x2F;verifying process is off-chain. But interact with payment contract needs service provider to build a DApp, which require resources many small businesses do not have. Even if they managed to build DApps, they are all different, not standardized. Also, user should have a wallet with DApp browser and has to learn how to use it.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;This EIP helps to standardize the interactions of micropayment system, and make it possible for wallet build a universal UI in the future.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Image&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; url of this token or descriptive resources&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; iconUrl&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Issuer&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; of this token. Only issuer can execute claim function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; issuer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *  &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   Remove consumption from payer&amp;#39;s deposite&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *  &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      Check if msg.sender == issuer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *  &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;          Payer&amp;#39;s address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *  &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    consumption&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   How many token is consumed in this epoch, specified&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *  &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         Epoch increased by 1 after claim or withdraw, at the beginning of each epoch, consumption goes back to 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *  &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     Signature of payment message signed by payer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; claim&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; consumption&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; epoch&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferIssuer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newIssuer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   Move amount from payer&amp;#39;s token balance to deposite balance to ensure payment is sufficient&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; deposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *  &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   Give remaining deposite balance back to &amp;quot;to&amp;quot; account, act as &amp;quot;refund&amp;quot; function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *  &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      In prepayment module, withdraw is executed from issuer account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *            In lock-release module, withdraw is executed from user account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *  &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;            the account receiving remaining deposite&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *  &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;        how many token is returned&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; withdraw&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; depositBalanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; depositBalance&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; epoch&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Deposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Withdraw&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransferIssuer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; oldIssuer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newIssuer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Claim&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; epoch&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; consumption&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;signature&quot;&gt;signature&lt;&#x2F;h3&gt;
&lt;p&gt;the pseudo code generating an ECDSA signature:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sign(keccak256(abi_encode(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;\x19Ethereum Signed Message:\n32&amp;quot;, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        keccak256(abi_encode(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            token_address,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            payer_address,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            token_issuer,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            token_consumption,        &#x2F;&#x2F;calculated by user client&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            epoch&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;,private_key)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;verification-process&quot;&gt;verification process&lt;&#x2F;h3&gt;
&lt;p&gt;the verification contains check about both signature and token_consumption&lt;&#x2F;p&gt;
&lt;p&gt;the pseudo code run by verification server is as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;serving_loop:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    for {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         * unpaied_consumption is calculated by provider&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         * signed_consumption is claimable amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         * tolerance allows payer &amp;quot;owes&amp;quot; provider to a certain degree&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &#x2F;&#x2F;getSignedConsumption returns amount that are already claimable &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        if(unpaied_consumption &amp;lt;  signed_consumption + tolerance){&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            informUser(&amp;quot;user need charge&amp;quot;, unpaied_consumption)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            interruptService() &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }else{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            isServing() || recoverService()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;verification_loop:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    for {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        message = incomingMessage()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        if(recover_signer(message, signature) != payer_address){&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            informUser(&amp;quot;check signature failed&amp;quot;, hash(message))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            continue&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        * optional: when using echo server to sync messages between verification servers&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        * more info about this in Security Considerations section&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        if(query(message) != message){&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            informUser(&amp;quot;message outdate&amp;quot;, hash(message))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            continue   &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        if(epoch != message.epoch || message.consumption &amp;gt; getDepositBalance()){&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            informUser(&amp;quot;invalid message&amp;quot;, epoch, unpaied_consumption)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            continue&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;       &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        signed_consumption = message.consumption&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        save(message)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;claim_process:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if(claim()){&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        unpaied_consumption -= signed_consumption&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        signed_consumption = 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        epoch+=1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;about-withdraw&quot;&gt;About withdraw&lt;&#x2F;h3&gt;
&lt;p&gt;The withdraw function is slightly different based on business models&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;prepayment model&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;In prepayment business model such as using token as recharge card of general store, the user pays (crypto)currency to store in advance for claimable token as recharge card (with bonus or discount). When checking out, the customer signs a message with updated consumption (old consumption + consumption this time) to store and store verifies this message off chain. The shopping process loops without any blockchain involved, until the customer wants to return the card and get money back. Because the store already holds all currency, the withdraw function should be executed by token issuer (store) to return remaining deposit balance after claim. The prepayment model can easily be built into a wallet with QR-code scanning function.&lt;&#x2F;p&gt;
&lt;ol start=&quot;2&quot;&gt;
&lt;li&gt;lock-release model&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;If we run a paid end-to-end encrypted e-mail service that accepts token as payment, we can use lock-release model. Unlike prepayment, we charge X * N token for an e-mail sent to N recipients. In this &quot;pay for usage&quot; scenario, the counting of services happens on both client and server side. The client should not trust charge amount given by server in case the it&#x27;s malfunctioning or malicious. When client decide not to trust server, it stops signing messages, but some of token is taken hostage in deposit balance. To fix this problem, the withdraw function should be executed by payer account with limitation such as epoch didn&#x27;t change in a month.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP targets on ERC-20 tokens due to its widespread adoption. However, this extension is designed to be compatible with other token standard.&lt;&#x2F;p&gt;
&lt;p&gt;The reason we chose to implement those functions in token contract rather than a separate record contract is as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Token can transfer is more convenient and more general than interact with DApp&lt;&#x2F;li&gt;
&lt;li&gt;Token is more standardized and has better UI support&lt;&#x2F;li&gt;
&lt;li&gt;Token is equal to service, make token economy more prosperous&lt;&#x2F;li&gt;
&lt;li&gt;Remove the approve process&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is fully backwards compatible as its implementation extends the functionality of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;mapping&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; StampBalance&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _depositBalance&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; StampBalance&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; balance&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; epoch&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; deposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;value &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    _balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; _balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;sub&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    _depositBalance&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balance &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _depositBalance&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balance&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Deposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; withdraw&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyIssuer&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;value &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _depositBalance&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balance&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    _depositBalance&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balance &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _depositBalance&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balance&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;sub&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    _depositBalance&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;epoch &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    _balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; _balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Withdraw&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; depositBalanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; depositBalance&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; epoch&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;_depositBalance&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;user&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balance&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _depositBalance&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;user&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;epoch&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; prepayment model&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; claim&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; credit&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; epoch&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyIssuer&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;credit &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_depositBalance&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;epoch &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; epoch&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_depositBalance&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balance &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; credit&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; message &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _issuer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; credit&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; epoch&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; msgHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; prefixed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;message&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;recoverSigner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;msgHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; from&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    _depositBalance&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balance &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _depositBalance&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balance&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;sub&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;credit&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    _balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_issuer&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; _balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_issuer&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;credit&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    _depositBalance&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;epoch &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Claim&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; credit&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; epoch&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; prefixed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;\x19Ethereum Signed Message:\n32&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; hash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; recoverSigner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; message&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sig&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;  returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt; s&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; splitSignature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sig&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; ecrecover&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;message&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; s&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; splitSignature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sig&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; v&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; s&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sig&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 65&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        r &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sig&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        s &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sig&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 64&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        v &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; byte&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sig&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 96&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;v&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; s&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;By restricting claim function to issuer, there is no race condition on chain layer. However double spending problem may occur when the issuer use multiple verifiers and payer signs many payment messages simultaneously. Some of those messages may get chance to be checked valid though only the message with the largest consumption can be claimed. This problem can be fixed by introducing an echo server which accepts messages from verifiers, returns the message sequentially with largest consumption and biggest epoch number. If a verifier gets an answer different from the message he send, it updates the message from echo server as the last message it receives along with local storage of the status about this payer. Then the verifier asks the payer again for a new message.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>My Own Messages (MOM)</title>
        <published>2020-08-02T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Giuseppe Bertone</name><uri>https://github.com/Neurone</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2848/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/InternetOfPeers/EIPs/issues/1" />
        

        <id>https://wg-eips.ritovision.com/2848/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2848"
            label="ERC-2848" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2848/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;My Own Messages (MOM) is a standard to create your very own public, always updated, unstoppable, verifiable, message board.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;My Own Messages (MOM) use Ethereum as a certification layer for commands and multihash of your messages. It don&#x27;t use smart contracts but simple self-send transactions with specific payload attached.&lt;&#x2F;p&gt;
&lt;p&gt;To ge more insights, you can test a &lt;a rel=&quot;external&quot; href=&quot;http:&#x2F;&#x2F;internetofpeers.org&#x2F;mom-client&#x2F;&quot;&gt;live client&lt;&#x2F;a&gt;, watch a &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=z1SnoQkQYkU&quot;&gt;full video overview and demo&lt;&#x2F;a&gt; and read a &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2848&#x2F;.&#x2F;assets&#x2F;presentation.pdf&quot;&gt;brief presentation&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;As a &lt;em&gt;developer&lt;&#x2F;em&gt; or &lt;em&gt;pool&#x27;s owner&lt;&#x2F;em&gt;, I&#x27;d like to send messages to my users in a decentralized way. They must be able to easily verify my role in the smart contract context (owner, user, and so on) and they must be able to do it without relying on external, insecure and hackable social media sites (Facebook, Twitter, you name it). Also, I&#x27;d like to read messages from my userbase, in the same secure and verifiable manner.&lt;&#x2F;p&gt;
&lt;p&gt;As a &lt;em&gt;user&lt;&#x2F;em&gt;, I want a method to easily share my thoughts and idea, publish content, send messages, receive feedback, receive tips, and so on, without dealing with any complexity: just write a message, send it and it&#x27;s done. Also, I want to write to some smart contract&#x27;s owner or to the sender of some transaction.&lt;&#x2F;p&gt;
&lt;p&gt;As an &lt;em&gt;explorer service&lt;&#x2F;em&gt;, I want to give my users an effective way to read information by smart contract owners and a place to share ideas and information without using third party services (i.e. Etherscan uses Disqus, and so on)&lt;&#x2F;p&gt;
&lt;p&gt;And in &lt;em&gt;any role&lt;&#x2F;em&gt;, I want a method that does not allow scams - transactions without values, no smart contract&#x27;s address to remember or to fake - and it does not allow spam - it&#x27;s cheap but not free, and even if you can link&#x2F;refer other accounts, you cannot send them messages directly, and others must explicitly follow and listen to your transactions if they want to read your messages.&lt;&#x2F;p&gt;
&lt;p&gt;Main advantages:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;You can send messages to users of your ÐApp or Smart Contract, and they always know it is a voice reliable as the smart contract is.&lt;&#x2F;li&gt;
&lt;li&gt;Create your Ethereum account dedicated to your personal messages, say something only once and it can be seen on every social platform (no more reply of the same post&#x2F;opinion on dozens of sites like Reddit, Twitter, Facebook, Medium, Disqus, and so on...)&lt;&#x2F;li&gt;
&lt;li&gt;Small fee to be free: pay just few cents of dollar to notarize your messages, and distribute them with IPFS, Swarm or any other storage you prefer. Because the multihash of the content is notarized, you can always check the integrity of the message you download even from centralized storage services.&lt;&#x2F;li&gt;
&lt;li&gt;Finally, you can ask and get tips for your words directly into your wallet.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;I know, My Own Messages (MOM) sounds like &lt;em&gt;mom&lt;&#x2F;em&gt;. And yes, pun intended :)&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;,  &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.ietf.org&#x2F;rfc&#x2F;rfc2119.txt&quot;&gt;RFC 2119&lt;&#x2F;a&gt; when, and only when, they appear in all capitals as shown here.&lt;&#x2F;p&gt;
&lt;p&gt;Clients following MOM standard &lt;strong&gt;MUST&lt;&#x2F;strong&gt; allow users to send and to read MOM transaction, creating an &lt;em&gt;updated message list&lt;&#x2F;em&gt; for each address the users are interested in.&lt;&#x2F;p&gt;
&lt;p&gt;Reading MOM transactions, MOM clients &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be able to show the current and updated message list, and they &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; be able to show also all the message history if users ask for it.&lt;&#x2F;p&gt;
&lt;p&gt;Apart from message list, MOM clients &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; be able to download the content of the messages and to show them to the user.&lt;&#x2F;p&gt;
&lt;p&gt;Clients &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; allow users to choose and set the source to download content from, and they &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; be able to use common Content Addressable Networks - i.e. IPFS or Swarm - or HTTP servers. If content is downloaded from HTTP servers, clients &lt;strong&gt;MUST&lt;&#x2F;strong&gt; check the content against the declared multihash.&lt;&#x2F;p&gt;
&lt;p&gt;As the default setting, clients &lt;strong&gt;MUST&lt;&#x2F;strong&gt; consider &lt;code&gt;text&#x2F;markdown&lt;&#x2F;code&gt; (&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.ietf.org&#x2F;rfc&#x2F;rfc7763.txt&quot;&gt;RFC 7763&lt;&#x2F;a&gt;) as the media type of the content represented by a multihash, and in particular &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Markdown&quot;&gt;Markdown&lt;&#x2F;a&gt; text in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;UTF-8&quot;&gt;UTF-8&lt;&#x2F;a&gt; without &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Byte_order_mark&quot;&gt;BOM&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Clients &lt;strong&gt;MAY&lt;&#x2F;strong&gt; let users choose to parse messages considering other content types. In this case they &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; cast a warning to users stating that a content type other than &lt;code&gt;text&#x2F;markdown&lt;&#x2F;code&gt; is used while processing messages.&lt;&#x2F;p&gt;
&lt;p&gt;It&#x27;s &lt;strong&gt;RECOMMENDED&lt;&#x2F;strong&gt; that clients inform users about the actual setting of the default content type.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;mom-transactions&quot;&gt;MOM transactions&lt;&#x2F;h3&gt;
&lt;p&gt;Clients &lt;strong&gt;MUST&lt;&#x2F;strong&gt; assume that &lt;strong&gt;invalid MOM transactions don&#x27;t exist&lt;&#x2F;strong&gt;. If a transaction does not strictly follow the MOM standard, clients &lt;strong&gt;MUST&lt;&#x2F;strong&gt; ignore it and they &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; consider it a MOM transaction at all.&lt;&#x2F;p&gt;
&lt;p&gt;Because there can be security implications parsing data sent by users, clients &lt;strong&gt;SHOULD NOT&lt;&#x2F;strong&gt; try to keep track or interpret transactions as &lt;em&gt;invalid&lt;&#x2F;em&gt; MOM transactions.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;valid-mom-transaction-s-data-structure&quot;&gt;Valid MOM transaction&#x27;s data structure&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&quot;text-align: left&quot;&gt;ATTRIBUTE&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: left&quot;&gt;VALUE&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;to&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;strong&gt;MUST&lt;&#x2F;strong&gt; be the same account signing the transaction.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;value&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;strong&gt;MUST&lt;&#x2F;strong&gt; be &lt;code&gt;0&lt;&#x2F;code&gt; wei.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;data&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;strong&gt;MUST&lt;&#x2F;strong&gt; be at least &lt;code&gt;2&lt;&#x2F;code&gt; bytes. The first byte &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be operational code and following bytes &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be based on the operational codes listed below.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;list-of-supported-operations-and-messages&quot;&gt;List of supported operations and messages&lt;&#x2F;h4&gt;
&lt;p&gt;Each operational code has one or more parameters, and all parameters &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be considered mandatory.&lt;&#x2F;p&gt;
&lt;p&gt;Optional parameters don&#x27;t exist: if parameters for the specific operational code are not all present or they don&#x27;t follow the rules, clients &lt;strong&gt;MUST&lt;&#x2F;strong&gt; ignore the transaction completely.&lt;&#x2F;p&gt;
&lt;p&gt;Messages &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be always referenced with the multihash of their content.&lt;&#x2F;p&gt;
&lt;p&gt;Operations are divided into two sets: &lt;strong&gt;CORE&lt;&#x2F;strong&gt; and &lt;strong&gt;EXTENDED&lt;&#x2F;strong&gt; operations.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Clients &lt;strong&gt;MUST&lt;&#x2F;strong&gt; support all core operations and they &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; support as much extended operations as possible.&lt;&#x2F;li&gt;
&lt;li&gt;Clients &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; support and implement as much extended operations as possible, but they &lt;strong&gt;MAY&lt;&#x2F;strong&gt; choose to implement only some specific extended operations they are interested in.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;core-operations&quot;&gt;Core operations&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;OPERATION&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;CODE&lt;&#x2F;th&gt;&lt;th&gt;PARAMETERS&lt;&#x2F;th&gt;&lt;th&gt;MEANING&lt;&#x2F;th&gt;&lt;th&gt;EFFECT&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;ADD&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;0x00&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;multihash&lt;&#x2F;td&gt;&lt;td&gt;Add a message. The parameter &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be the multihash of the message.&lt;&#x2F;td&gt;&lt;td&gt;Clients &lt;strong&gt;MUST&lt;&#x2F;strong&gt; add the message to the message list of the sender.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;UPDATE&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;0x01&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;multihash, multihash&lt;&#x2F;td&gt;&lt;td&gt;Update a message. The first parameter &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be the multihash of the message to be updated. The second parameter &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be the multihash of the updated message.&lt;&#x2F;td&gt;&lt;td&gt;Clients &lt;strong&gt;MUST&lt;&#x2F;strong&gt; update the message list to show the updated message.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;REPLY&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;0x02&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;multihash, multihash&lt;&#x2F;td&gt;&lt;td&gt;Reply to a message. The first parameter &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be the multihash of the message to reply to. The second parameter &lt;strong&gt;MUST&lt;&#x2F;strong&gt; the multihash of the message.&lt;&#x2F;td&gt;&lt;td&gt;Clients &lt;strong&gt;MUST&lt;&#x2F;strong&gt; insert a new message in the message list and they &lt;strong&gt;MUST&lt;&#x2F;strong&gt; preserve the relationship with the referenced message.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;DELETE&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;0x03&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;multihash&lt;&#x2F;td&gt;&lt;td&gt;Delete a message. The parameter &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be the multihash of the message to delete.&lt;&#x2F;td&gt;&lt;td&gt;Clients &lt;strong&gt;MUST&lt;&#x2F;strong&gt; remove the message from the message list.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;CLOSE ACCOUNT&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;0xFD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;multihash&lt;&#x2F;td&gt;&lt;td&gt;Close an account. The parameter &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be the multihash of the message with the motivations for closing the account.&lt;&#x2F;td&gt;&lt;td&gt;Clients &lt;strong&gt;MUST&lt;&#x2F;strong&gt; add the message with motivations to the message list and they &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; consider MOM messages sent by that address to be valid anymore, ever. In other words, MOM clients &lt;strong&gt;MUST&lt;&#x2F;strong&gt; ignore any other transaction sent by that address while creating the message list. This is useful when users want to change account, for example because the private key seems compromised.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;RAW&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;0xFF&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;any&lt;&#x2F;td&gt;&lt;td&gt;The parameter &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be at least &lt;code&gt;1&lt;&#x2F;code&gt; byte. Content type is not disclosed and it &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; be considered as &lt;code&gt;text&#x2F;markdown&lt;&#x2F;code&gt;.&lt;&#x2F;td&gt;&lt;td&gt;Clients &lt;strong&gt;MUST&lt;&#x2F;strong&gt; add the message to the message list but they &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; try to decode the content. Clients &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; allow users to see this message only if explicitly asked for. This operation can be used for &lt;em&gt;blind&lt;&#x2F;em&gt; notarization that general client can ignore.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;note-about-delete-operational-code&quot;&gt;Note about &lt;code&gt;DELETE&lt;&#x2F;code&gt; operational code&lt;&#x2F;h4&gt;
&lt;p&gt;Please note that sending a &lt;code&gt;DELETE&lt;&#x2F;code&gt; command users are not asking to actually delete anything from the blockchain, they are just asking clients to hide that specific message because it&#x27;s not valid anymore for some reasons. You can think of it like if users say: &lt;em&gt;I changed my mind so please ÐApps don&#x27;t show this anymore&lt;&#x2F;em&gt;. As already stated in the specifications above, clients &lt;strong&gt;MUST&lt;&#x2F;strong&gt; follow this request by the author, unless expressly asked otherwise by the user.&lt;&#x2F;p&gt;
&lt;p&gt;Please also note that, because it&#x27;s usually up to the author of a message to be sure the content is available to everyone, if a &lt;code&gt;DELETE&lt;&#x2F;code&gt; message was sent it&#x27;s very likely the content referenced by the multihash isn&#x27;t available anymore, simply because probably it&#x27;s not shared by anyone.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;extended-operations&quot;&gt;Extended operations&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;OPERATION&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;CODE&lt;&#x2F;th&gt;&lt;th&gt;PARAMETERS&lt;&#x2F;th&gt;&lt;th&gt;MEANING&lt;&#x2F;th&gt;&lt;th&gt;EFFECT&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;ADD &amp;amp; REFER&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;0x04&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;multihash, address&lt;&#x2F;td&gt;&lt;td&gt;Add a message and refer an account. The first parameter &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be the multihash of the message. The second parameter &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be an address referenced by the message.&lt;&#x2F;td&gt;&lt;td&gt;Clients &lt;strong&gt;MUST&lt;&#x2F;strong&gt; add the message to the message list and they &lt;strong&gt;MUST&lt;&#x2F;strong&gt; track the reference to the specified account. This can be useful &lt;em&gt;to invite&lt;&#x2F;em&gt; the owner of the referenced account to read this specific message.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;UPDATE &amp;amp; REFER&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;0x05&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;multihash, multihash, address&lt;&#x2F;td&gt;&lt;td&gt;Update a message. The first parameter &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be the multihash of the message to be updated. The second parameter &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be the multihash of the updated message. The third parameter &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be an address referenced by the message.&lt;&#x2F;td&gt;&lt;td&gt;Clients &lt;strong&gt;MUST&lt;&#x2F;strong&gt; update the message list to show the updated message and they &lt;strong&gt;MUST&lt;&#x2F;strong&gt; track the reference to the specified account. This can be useful &lt;em&gt;to invite&lt;&#x2F;em&gt; the owner of the referenced account to read this specific message.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;ENDORSE&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;0x06&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;multihash&lt;&#x2F;td&gt;&lt;td&gt;Endorse a message identified by the specified multihash. The parameter &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be the multihash of the message to be endorsed.&lt;&#x2F;td&gt;&lt;td&gt;Clients &lt;strong&gt;MUST&lt;&#x2F;strong&gt; record and track the endorsement for that specific message. Think it as a &lt;em&gt;like&lt;&#x2F;em&gt;, a &lt;em&gt;retwitt&lt;&#x2F;em&gt;, etc.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;REMOVE ENDORSEMENT&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;0x07&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;multihash&lt;&#x2F;td&gt;&lt;td&gt;Remove endorsement to the message identified by the specified multihash. The parameter &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be the multihash of the message.&lt;&#x2F;td&gt;&lt;td&gt;Clients &lt;strong&gt;MUST&lt;&#x2F;strong&gt; remove the endorsement for that specific message.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;DISAPPROVE&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;0x08&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;multihash&lt;&#x2F;td&gt;&lt;td&gt;Disapprove a message identified by the specified multihash. The parameter &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be the multihash of the message to disapprove.&lt;&#x2F;td&gt;&lt;td&gt;Clients &lt;strong&gt;MUST&lt;&#x2F;strong&gt; record and track the disapproval for that specific message. Think it as a &lt;em&gt;I don&#x27;t like it&lt;&#x2F;em&gt;.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;REMOVE DISAPPROVAL&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;0x09&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;multihash&lt;&#x2F;td&gt;&lt;td&gt;Remove disapproval of a message identified by the specified multihash. The parameter &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be the multihash of the message.&lt;&#x2F;td&gt;&lt;td&gt;Clients &lt;strong&gt;MUST&lt;&#x2F;strong&gt; remove the disapproval for that specific message.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;ENDORSE &amp;amp; REPLY&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;0x0A&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;multihash, multihash&lt;&#x2F;td&gt;&lt;td&gt;Endorse a message and reply to it. The first parameter &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be the multihash of the message to reply to. The second parameter &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be the multihash of the message.&lt;&#x2F;td&gt;&lt;td&gt;Clients &lt;strong&gt;MUST&lt;&#x2F;strong&gt; insert a new message in the message list and they &lt;strong&gt;MUST&lt;&#x2F;strong&gt; preserve the relationship with the referenced message. Clients &lt;strong&gt;MUST&lt;&#x2F;strong&gt; also record and track the endorsement for that specific message.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;DISAPPROVE &amp;amp; REPLY&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;0x0B&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;multihash, multihash&lt;&#x2F;td&gt;&lt;td&gt;Disapprove a message and reply to it. The first parameter &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be the multihash of the message to reply to. The second parameter &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be the multihash of the message.&lt;&#x2F;td&gt;&lt;td&gt;Clients &lt;strong&gt;MUST&lt;&#x2F;strong&gt; insert a new message in the message list and they &lt;strong&gt;MUST&lt;&#x2F;strong&gt; preserve the relationship with the referenced message. Clients &lt;strong&gt;MUST&lt;&#x2F;strong&gt; also record and track the disapproval for that specific message.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Ethereum is &lt;em&gt;account based&lt;&#x2F;em&gt;, so it&#x27;s good to be identified as a single source of information.&lt;&#x2F;p&gt;
&lt;p&gt;It is also able of doing notarization very well and to impose some restrictions on transaction&#x27;s structure, so it&#x27;s good for commands.&lt;&#x2F;p&gt;
&lt;p&gt;IPFS, Swarm or other CANs (Content Addressable Networks) or storage methods are good to store a lot of information. So, the union of both worlds it&#x27;s a good solution to achieve the objectives of this message standard.&lt;&#x2F;p&gt;
&lt;p&gt;The objective is also to avoid in the first place any kind of scam and malicious behaviors, so MOM don&#x27;t allow to send transactions to other accounts and the value of a MOM transaction is always 0.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-not-using-a-smart-contract&quot;&gt;Why not using a smart contract?&lt;&#x2F;h3&gt;
&lt;p&gt;MOM wants to be useful, easy to implement and read, error proof, fast and cheap, but:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;using a smart contract for messages can leads more easily to errors and misunderstandings:
&lt;ul&gt;
&lt;li&gt;address of the contract can be wrong&lt;&#x2F;li&gt;
&lt;li&gt;smart contract must be deployed on that specific network to send messages&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;executing a smart contract costs much more than sending transactions&lt;&#x2F;li&gt;
&lt;li&gt;executing a smart contract just to store static data is the best example of an anti-pattern (expensive and almost useless)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Without a specific smart contract to rely on, the MOM standard can be implemented and used right now in any existing networks, and even in future ones.&lt;&#x2F;p&gt;
&lt;p&gt;Finally, if you can achieve exactly the same result without a smart contract, you didn&#x27;t need a smart contract at the first place.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-not-storing-messages-directly-on-chain&quot;&gt;Why not storing messages directly on-chain?&lt;&#x2F;h3&gt;
&lt;p&gt;There&#x27;s no benefit to store &lt;em&gt;static&lt;&#x2F;em&gt; messages on-chain, if they are not related to some smart contract&#x27;s state or if they don&#x27;t represent exchange of value. The cost of storing data on-chain is also very high.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-not-storing-op-codes-inside-the-message&quot;&gt;Why not storing op codes inside the message?&lt;&#x2F;h3&gt;
&lt;p&gt;While cost effectiveness is a very important feature in a blockchain related standard, there&#x27;s also a compromise to reach with usability and usefulness.&lt;&#x2F;p&gt;
&lt;p&gt;Storing commands inside the messages forces the client to actually download messages to understand what to do with them. This is very inefficient, bandwidth and time consuming.&lt;&#x2F;p&gt;
&lt;p&gt;Being able to see the commands before downloading the content, it allows the client to recreate the history of all messages and then, at the end, download only updated messages.&lt;&#x2F;p&gt;
&lt;p&gt;Creating a structure for the content of the messages leads to many issues and considerations in parsing the content, if it&#x27;s correct, misspelled, and so on.&lt;&#x2F;p&gt;
&lt;p&gt;Finally, the &lt;strong&gt;content must remain clean&lt;&#x2F;strong&gt;. You really want to notarize the content and not to refer to a data structure, because this can lead to possible false-negative when checking if a content is the same of another.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-multihash&quot;&gt;Why multihash?&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;multiformats&#x2F;multihash&quot;&gt;Multihash&lt;&#x2F;a&gt; is flexible, future-proof and there are already tons of library supporting it. Ethereum must be easily integrable with many different platforms and architectures, so MOM standard follows that idea.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;You can already find few transactions over the Ethereum network that use a pattern similar to this EIP. Sometimes it&#x27;s done to invalidate a previous transaction in memory pool, using the same nonce but with more gas price, so that transaction is mined cancelling the previous one still in the memory pool. This kind of transactions can be easily ignored if created before the approval of this EIP or just checking if the payload follows the correct syntax.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;A MOM-compliant client can be found and tested on &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;InternetOfPeers&#x2F;mom-client&quot;&gt;GitHub&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;You can use the latest version of MOM client directly via &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;internetofpeers.github.io&#x2F;mom-client&quot;&gt;GitHub Pages&lt;&#x2F;a&gt; or via IPFS (see the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;InternetOfPeers&#x2F;mom-client&quot;&gt;client repo&lt;&#x2F;a&gt; for the latest updated address).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;You can use an already working MOM JavaScript package on &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;InternetOfPeers&#x2F;mom-js&#x2F;packages&#x2F;323930&quot;&gt;GitHub Packages&lt;&#x2F;a&gt; or &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.npmjs.com&#x2F;package&#x2F;@internetofpeers&#x2F;mom-js&quot;&gt;npmjs&lt;&#x2F;a&gt;. The package is already used by the MOM client above, and you can use it in your ÐApps too with:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;npm&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; install&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; @internetofpeers&#x2F;mom-js&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Transaction &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;etherscan.io&#x2F;tx&#x2F;0x8e49485c56897757a6f2707b92cd5dad06126afed92261b9fe1a19b110bc34e6&quot;&gt;&lt;code&gt;0x8e49485c56897757a6f2707b92cd5dad06126afed92261b9fe1a19b110bc34e6&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; is an example of a valid MOM transaction already mined on the Main net; it&#x27;s an &lt;code&gt;ADD&lt;&#x2F;code&gt; message.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;MOM is very simple and it has no real security concerns by itself. The standard already considers valid only transactions with &lt;code&gt;0&lt;&#x2F;code&gt; value and where &lt;code&gt;from&lt;&#x2F;code&gt; and &lt;code&gt;to&lt;&#x2F;code&gt; addresses are equals.&lt;&#x2F;p&gt;
&lt;p&gt;The only concerns can come from the payload, but it is more related to the client and not to the standard itself, so here you can find some security suggestions related to clients implementing the standard.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parsing-commands&quot;&gt;Parsing commands&lt;&#x2F;h3&gt;
&lt;p&gt;MOM standard involves parsing payloads generated by potentially malicious clients, so attention must be made to avoid unwanted code execution.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Strictly follow only the standard codes&lt;&#x2F;li&gt;
&lt;li&gt;Don&#x27;t execute any commands outside of the standard ones, unless expressly acknowledged by the user&lt;&#x2F;li&gt;
&lt;li&gt;Ignore malformed transactions (transactions that don&#x27;t strictly follow the rules)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;messages&quot;&gt;Messages&lt;&#x2F;h3&gt;
&lt;p&gt;Default content-type of a message following the MOM standard is Markdown text in UTF8 without BOM. It is highly recommended to disallow the reading of any not-text content-type, unless expressly acknowledged by the user.&lt;&#x2F;p&gt;
&lt;p&gt;Because content multihash is always stored into the chain, clients can download that content from Content Addressable Network (like IPFS or Swarm) or from central servers. In the latter case, a client should always check the integrity of the received messages, or it must warn the user if it cannot do that (feature not implemented or in error).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Add DID related methods to the JSON-RPC</title>
        <published>2020-08-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Joel Thorstensson</name><uri>https://github.com/oed</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2844/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/2845" />
        

        <id>https://wg-eips.ritovision.com/2844/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="interface"
                label="Interface" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2844"
            label="EIP-2844" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2844/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Add new methods to the JSON-RPC for signing and decrypting JOSE objects under a new &lt;code&gt;did_*&lt;&#x2F;code&gt; prefix.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP describes three new methods to add to the JSON-RPC that enables wallets to support &lt;em&gt;Decentralized Identifiers&lt;&#x2F;em&gt; (DIDs) as well as &lt;em&gt;JSON Object Signing and Encryption&lt;&#x2F;em&gt; (JOSE). These standards enables wallets to support data decryption as well as authenticated data, both in standard formats using JOSE. With these new methods apps can request the DID from a users wallet, from which a DID document can be resolved. The DID document contains public keys that can be used for encryption and signature verification. This enables Alice to discover Bobs public keys by only knowing Bobs DID. This EIP does not enforce the user of any particular DID method or JOSE algorithms, wallets are free to implement these however they wish.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;There has been one main previous effort (&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;130&quot;&gt;#130&lt;&#x2F;a&gt;, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;pull&#x2F;1098&quot;&gt;#1098&lt;&#x2F;a&gt;) to add decryption to Ethereum wallets in a standard way. This previous approach used a non standard way to encode and represent data encrypted using &lt;code&gt;x25519-xsalsa20-poly1305&lt;&#x2F;code&gt;. While this approach does provide a functional way to add encryption support to wallets, it does not take into account similar work that has gone into standardizing the way encrypted data is represented, namely using &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;datatracker.ietf.org&#x2F;wg&#x2F;jose&#x2F;documents&#x2F;&quot;&gt;JOSE&lt;&#x2F;a&gt;. This is a standard from IETF for representing signed and encrypted objects. Another shortcoming of the previous approach is that it&#x27;s impossible to retrieve the &lt;code&gt;x25519&lt;&#x2F;code&gt; public key from another user if only an Ethereum address is known. Public key discoverability is at the core of the work that is happening with the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;w3c.github.io&#x2F;did-core&quot;&gt;W3C DID standard&lt;&#x2F;a&gt;, where given a DID a document which contains public keys can always be discovered. Implementations of this standard already exist and are adopted within the Ethereum community, e.g. &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;decentralized-identity&#x2F;ethr-did-resolver&#x2F;&quot;&gt;&lt;code&gt;did:ethr&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;3box&#x2F;3id-resolver&quot;&gt;&lt;code&gt;did:3&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;. Interoperability between JOSE and DIDs &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;decentralized-identity&#x2F;did-jwt&quot;&gt;already exists&lt;&#x2F;a&gt;, and work is being done to &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;decentralized-identity&#x2F;did-jose-extensions&quot;&gt;strengthen it&lt;&#x2F;a&gt;. Adding support for JOSE and DIDs will enable Ethereum wallets to support a wide range of new use cases such as more traditional authentication using JWTs, as well as new emerging technologies such as &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;identity.foundation&#x2F;secure-data-store&#x2F;&quot;&gt;Secure Data Stores&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ipld&#x2F;specs&#x2F;pull&#x2F;269&quot;&gt;encrypted data in IPFS&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Three new JSON-RPC methods are specified under the new &lt;code&gt;did_*&lt;&#x2F;code&gt; prefix.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;auth&quot;&gt;Auth&lt;&#x2F;h3&gt;
&lt;p&gt;Authenticate the current rpc connection to the DID methods.&lt;&#x2F;p&gt;
&lt;p&gt;Prompt the user to give permission to the current connection to access the user DID and the given &lt;code&gt;paths&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;method&quot;&gt;Method:&lt;&#x2F;h5&gt;
&lt;p&gt;&lt;code&gt;did_authenticate&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h5 id=&quot;params&quot;&gt;Params:&lt;&#x2F;h5&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;nonce&lt;&#x2F;code&gt; - a random string used as a challenge&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;aud&lt;&#x2F;code&gt; - the intended audience of the authentication response&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;paths&lt;&#x2F;code&gt; - an array of strings&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;returns&quot;&gt;Returns:&lt;&#x2F;h5&gt;
&lt;p&gt;A JWS with general serialization containing the following properties:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;nonce &lt;&#x2F;code&gt; - the random string which was given as a challenge&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;did&lt;&#x2F;code&gt; - the DID which authentication was given for&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;paths&lt;&#x2F;code&gt; - the paths which was given permission for&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;exp&lt;&#x2F;code&gt; - a unix timestamp after which the JWS should be considered invalid&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;aud&lt;&#x2F;code&gt; - optional audience for the JWS, should match the domain which made the request&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;An additional property &lt;code&gt;kid&lt;&#x2F;code&gt; with the value which represents the DID, and the &lt;code&gt;keyFragment&lt;&#x2F;code&gt; that was used to sign the JWS should be added to the protected header (&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;decentralized-identity&#x2F;did-jose-extensions&#x2F;issues&#x2F;2&quot;&gt;details&lt;&#x2F;a&gt;).&lt;&#x2F;p&gt;
&lt;h4 id=&quot;createjws&quot;&gt;CreateJWS&lt;&#x2F;h4&gt;
&lt;p&gt;Creates a JSON Web Signature (JWS).&lt;&#x2F;p&gt;
&lt;p&gt;An additional property &lt;code&gt;kid&lt;&#x2F;code&gt; with the value which represents the DID, and the &lt;code&gt;keyFragment&lt;&#x2F;code&gt; that was used to sign the JWS should be added to the protected header (&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;decentralized-identity&#x2F;did-jose-extensions&#x2F;issues&#x2F;2&quot;&gt;details&lt;&#x2F;a&gt;). When &lt;code&gt;revocable&lt;&#x2F;code&gt; is set to false the JWS signature should not be possible to revoke. For some DID methods like. &lt;code&gt;did:key&lt;&#x2F;code&gt; this is always the case. For other methods which support key revocation it is necessary to include the &lt;code&gt;version-id&lt;&#x2F;code&gt; in the &lt;code&gt;kid&lt;&#x2F;code&gt; to refer to a specific version of the DID document. When &lt;code&gt;revocable&lt;&#x2F;code&gt; is set to true &lt;code&gt;version-id&lt;&#x2F;code&gt; must not be included in the &lt;code&gt;kid&lt;&#x2F;code&gt; for DID methods that support key revocation.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;method-1&quot;&gt;Method:&lt;&#x2F;h5&gt;
&lt;p&gt;&lt;code&gt;did_createJWS&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h5 id=&quot;params-1&quot;&gt;Params:&lt;&#x2F;h5&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;payload&lt;&#x2F;code&gt; - the payload to sign, json object or &lt;code&gt;base64url&lt;&#x2F;code&gt; encoded string&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;protected&lt;&#x2F;code&gt; - the protected header, json object&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;did&lt;&#x2F;code&gt; - the DID that should sign the message, may include the key fragment, string&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;revocable&lt;&#x2F;code&gt; - makes the JWS revocable when rotating keys, boolean default to &lt;code&gt;false&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;returns-1&quot;&gt;Returns:&lt;&#x2F;h5&gt;
&lt;p&gt;An object containing a JWS with general serialization on the &lt;code&gt;jws&lt;&#x2F;code&gt; property.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;recommendation&quot;&gt;Recommendation:&lt;&#x2F;h5&gt;
&lt;p&gt;Use &lt;code&gt;secp256k1&lt;&#x2F;code&gt; for signing, alternatively &lt;code&gt;ed25519&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;decryptjwe&quot;&gt;DecryptJWE&lt;&#x2F;h4&gt;
&lt;p&gt;Decrypt the given JWE.&lt;&#x2F;p&gt;
&lt;p&gt;If the cleartext object contains a property &lt;code&gt;paths&lt;&#x2F;code&gt; that contains an array of strings and one of the paths in there are already authenticated using &lt;code&gt;did_authenticate&lt;&#x2F;code&gt; the decryption should happen without user confirmation.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;method-2&quot;&gt;Method:&lt;&#x2F;h5&gt;
&lt;p&gt;&lt;code&gt;did_decryptJWE&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h5 id=&quot;params-2&quot;&gt;Params:&lt;&#x2F;h5&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;jwe&lt;&#x2F;code&gt; - a JWE with general serialization, string&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;did&lt;&#x2F;code&gt; - the DID that should try to decrypt the JWE, string&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;returns-2&quot;&gt;Returns:&lt;&#x2F;h5&gt;
&lt;p&gt;An object containing the cleartext, encoded using &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;multiformats&#x2F;multibase&quot;&gt;&lt;code&gt;base64pad&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;, assigned to the &lt;code&gt;cleartext&lt;&#x2F;code&gt; property.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;recommendation-1&quot;&gt;Recommendation:&lt;&#x2F;h5&gt;
&lt;p&gt;Implement decryption using &lt;code&gt;xchacha20poly1305&lt;&#x2F;code&gt; and &lt;code&gt;x25519&lt;&#x2F;code&gt; for key agreement.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP chooses to rely on DIDs and JOSE since there is already support for these standards in many places, by current systems and new systems. By using DIDs and JOSE wallet implementers can also choose which signing and encryption algorithms that they want to support, since these formats are fairly agnostic to specific crypto implementations.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;permission-system&quot;&gt;Permission system&lt;&#x2F;h3&gt;
&lt;p&gt;A simple permission system is proposed where clients can request permissions though path prefixes, e.g. &lt;code&gt;&#x2F;some&#x2F;permission&lt;&#x2F;code&gt;. When decryption of a JWE is requested the wallet should check if the decrypted payload contains a &lt;code&gt;paths&lt;&#x2F;code&gt; property. If this property doesn&#x27;t exist the user may be prompted to confirm that the given rpc connection (app) is allowed to read the decrypted data. If the &lt;code&gt;paths&lt;&#x2F;code&gt; property is present in the decrypted data it should contain an array of string paths. If one of the these path prefixes matches with one of the path prefixes the user has already granted permission for then decryption should happen automatically without any user confirmation.&lt;&#x2F;p&gt;
&lt;p&gt;This simple permission system was inspired by some previous comments (&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;130#issuecomment-329770999&quot;&gt;1&lt;&#x2F;a&gt;, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;medium.com&#x2F;@wighawag&#x2F;3-proposals-for-making-web3-a-better-experience-974f97765700&quot;&gt;2&lt;&#x2F;a&gt;) but avoids data lock in around origins.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;3box&#x2F;identity-wallet-js&#x2F;&quot;&gt;IdentityWallet&lt;&#x2F;a&gt;: An implementation of the wallet side &lt;code&gt;did_*&lt;&#x2F;code&gt; methods using the 3ID DID.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ceramicnetwork&#x2F;key-did-provider-ed25519&quot;&gt;key-did-provider-ed25519&lt;&#x2F;a&gt;:  An implementation of the wallet side &lt;code&gt;did_*&lt;&#x2F;code&gt; methods using the &lt;code&gt;did:key&lt;&#x2F;code&gt; method.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ceramicnetwork&#x2F;js-did&quot;&gt;js-did&lt;&#x2F;a&gt;: A small library which consumes the &lt;code&gt;did_*&lt;&#x2F;code&gt; methods.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;digitalbazaar&#x2F;minimal-cipher&quot;&gt;MinimalCipher&lt;&#x2F;a&gt;: An implementation of DID related encryption for JWE.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Both JOSE and DIDs are standards that have gone though a lot of scrutiny. Their security will not be considered in this document. In the specification section, recommendations are given for which algorithms to use. For signatures &lt;code&gt;secp256k1&lt;&#x2F;code&gt; is already used by ethereum and for decryption &lt;code&gt;xchacha20poly1305&lt;&#x2F;code&gt; is widely available, very performant, and already used in TLS.&lt;&#x2F;p&gt;
&lt;p&gt;The main security consideration of this EIP is the suggested permission system. Here various threat models could be considered. However, this EIP does not go into details about how it should work other than suggesting an approach. In the end it is up to wallet implementations to choose how to ask their users for consent.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Transaction Replacement Message Type</title>
        <published>2020-07-26T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Gregory Markou</name><uri>https://github.com/GregTheGreek</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2831/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2831-transaction-replacement-message-type/4448" />
        

        <id>https://wg-eips.ritovision.com/2831/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="interface"
                label="Interface" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:2831"
            label="EIP-2831" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2831/">&lt;h2 id=&quot;summary&quot;&gt;Summary&lt;&#x2F;h2&gt;
&lt;p&gt;An extension to the JavaScript Ethereum Provider API (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1193&#x2F;&quot;&gt;EIP-1193&lt;&#x2F;a&gt;) this creates a new message type in the event a transaction replacement occurs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The current communication between providers and consumers of providers are fundamentally broken in the event that a transaction in the mempool has been superseded by a newer transactions. Providers currently have no way of communicating a transaction replacement, and consumers are required to poll block by block for the resulting transaction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Exert from EIP-1193&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;A common convention in the Ethereum web application (&quot;dapp&quot;) ecosystem is for key management software (&quot;wallets&quot;) to expose their API via a JavaScript object in the web page.
This object is called &quot;the Provider&quot;.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;Many ingenious developments have been made by wallet developers to improve the overall user experience while interacting with the Ethereum blockchain. One specific innovation was transaction replacement, offering users the ability to effectively cancel a previously sent transaction.&lt;&#x2F;p&gt;
&lt;p&gt;Transaction replacement is not a new concept, but unfortunately causes major user experience problems for dapp developers as the replaced transaction is near impossible to track.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP formalizes a way for both providers and dapp developers to track transaction replacements seamlessly.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.ietf.org&#x2F;rfc&#x2F;rfc2119.txt&quot;&gt;RFC-2119&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;em&gt;This section is non-normative.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Provider
&lt;ul&gt;
&lt;li&gt;A JavaScript object made available to a consumer, that provides access to Ethereum by means of a Client.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Wallet
&lt;ul&gt;
&lt;li&gt;An end-user application that manages private keys, performs signing operations, and acts as a middleware between the Provider and the Client.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Transaction Replacement
&lt;ul&gt;
&lt;li&gt;Submitting a transaction with both: the same nonce and a 10% increase in the gas price, of a previous transaction which a user no longer wishes to send. This must occur before the original transaction is included in the blockchain.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;events&quot;&gt;Events&lt;&#x2F;h3&gt;
&lt;p&gt;These methods &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be implemented per the Node.js &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;nodejs.org&#x2F;api&#x2F;events.html&quot;&gt;&lt;code&gt;EventEmitter&lt;&#x2F;code&gt; API&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The following three events must be implemented: &lt;code&gt;tx_replacement&lt;&#x2F;code&gt;, &lt;code&gt;tx_speedup&lt;&#x2F;code&gt; and &lt;code&gt;tx_cancel&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;A &lt;code&gt;tx_speedup&lt;&#x2F;code&gt; is defined as a transaction replacement in which the user wishes to adjust the &lt;code&gt;gasPrice&lt;&#x2F;code&gt;, to potentially receive a fast block inclusion. For a &lt;code&gt;tx_speedup&lt;&#x2F;code&gt; to be considered valid, the replacement tx must contain the &lt;strong&gt;same&lt;&#x2F;strong&gt; following properties as the one it supersedes:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Nonce&lt;&#x2F;li&gt;
&lt;li&gt;To&lt;&#x2F;li&gt;
&lt;li&gt;Value&lt;&#x2F;li&gt;
&lt;li&gt;Data&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; txSpeedupInfo&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;  readonly&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; oldTx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;  readonly&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newTx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;  readonly&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;  readonly&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Provider&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;on&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;tx_speedup&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; listener&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;txSpeedupInfo&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; txSpeedupInfo&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; void&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Provider&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This event emits the old transaction hash (&lt;code&gt;oldTx&lt;&#x2F;code&gt;), the new transaction hash (&lt;code&gt;newTx&lt;&#x2F;code&gt;), the nonce used for both transactions (&lt;code&gt;nonce&lt;&#x2F;code&gt;), and the signing address for the transaction (&lt;code&gt;from&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;A &lt;code&gt;tx_cancel&lt;&#x2F;code&gt; is defined as a transaction replacement in which the user wishes to nullify a previous transaction before its inclusion. For a &lt;code&gt;tx_cancel&lt;&#x2F;code&gt; to be considered valid, the replacement tx must contain the following properties:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The same nonce as the superseded transaction&lt;&#x2F;li&gt;
&lt;li&gt;The same From and To&lt;&#x2F;li&gt;
&lt;li&gt;Zero value&lt;&#x2F;li&gt;
&lt;li&gt;No data&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; txCancelInfo&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;  readonly&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; oldTx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;  readonly&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newTx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;  readonly&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;  readonly&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Provider&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;on&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;tx_cancel&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; listener&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;txCancelInfo&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; txCancelInfo&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; void&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Provider&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This event emits the old transaction hash (&lt;code&gt;oldTx&lt;&#x2F;code&gt;), the new transaction hash (&lt;code&gt;newTx&lt;&#x2F;code&gt;), the nonce used for both transactions (&lt;code&gt;nonce&lt;&#x2F;code&gt;), and the signing address for the transaction (&lt;code&gt;from&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;A &lt;code&gt;tx_replacement&lt;&#x2F;code&gt; is defined as a transaction replacement in which a user has completely replaced a previous transaction with a completely brand new one. The replacement tx must contain the following properties:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The same nonce as the superseded transaction&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; txReplacementInfo&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;  readonly&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; oldTx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;  readonly&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newTx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;  readonly&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;  readonly&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Provider&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;on&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;tx_replacement&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; listener&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;txReplacementInfo&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; txReplacementInfo&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; void&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Provider&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This event emits the old transaction hash (&lt;code&gt;oldTx&lt;&#x2F;code&gt;), the new transaction hash (&lt;code&gt;newTx&lt;&#x2F;code&gt;), the nonce used for both transactions (&lt;code&gt;nonce&lt;&#x2F;code&gt;), and the signing address for the transaction (&lt;code&gt;from&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The implementation was chosen to help the ease of implementation for both providers and dapp developers. Since &lt;code&gt;ProviderMessage&lt;&#x2F;code&gt; is widely used by dapp developers already it means that the implementation path would be as trivial as adding and additional &lt;code&gt;if&lt;&#x2F;code&gt; clause to their existing message listener. This also provides a benefit to dapps in the event that a provider has not yet implemented the events, it will not cause the dapp panic with &lt;code&gt;undefined&lt;&#x2F;code&gt; should it be implemented natively (eg: &lt;code&gt;ethereum.txCancel(...)&lt;&#x2F;code&gt; which would error with &lt;code&gt;ethereum.txReplacement()&lt;&#x2F;code&gt; is not a function).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Many Providers adopted EIP-1193, as this EIP extends the same event logic, there should be no breaking changes. All providers that do not support the new events should either I) Ignore the subscription or II) Provide some error to the user.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementations&quot;&gt;Implementations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;web3.js&#x2F;issues&#x2F;3723&quot;&gt;Web3.js&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;MetaMask&#x2F;metamask-extension&#x2F;issues&#x2F;9174&quot;&gt;MetaMask&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;None at the current time.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;web3.js&#x2F;issues&#x2F;3585&quot;&gt;Web3.js issue with metamask tx cancel&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;MetaMask&#x2F;metamask-extension&#x2F;issues&#x2F;3347&quot;&gt;Browser doesn&#x27;t know when a transaction is replace&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;appendix-i-examples&quot;&gt;Appendix I: Examples&lt;&#x2F;h2&gt;
&lt;p&gt;These examples assume a web browser environment.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Most Providers are available as window.ethereum on page load.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This is only a convention, not a standard, and may not be the case in practice.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Please consult the Provider implementation&amp;#39;s documentation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; ethereum&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; window&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;ethereum&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; transactionParameters&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ...&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Fill in parameters&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;ethereum&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  .&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;request&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    method&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_sendTransaction&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    params&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;transactionParameters&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  .&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;then&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;txHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    ethereum&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;on&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;tx_cancel&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;info&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      const&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; oldTx&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; newTx&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; message&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      console&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;log&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Tx &lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;oldTx&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; with nonce &lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; from &lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; was cancelled, the new hash is &lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;newTx&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    ethereum&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;on&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;tx_speedup&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;info&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      const&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; oldTx&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; newTx&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; message&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      console&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;log&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Tx &lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;oldTx&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; with nonce &lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; from &lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; was sped up, the new hash is &lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;newTx&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    ethereum&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;on&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;tx_replacement&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;info&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      const&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; oldTx&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; newTx&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; message&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      console&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;log&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Tx &lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;oldTx&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; with nonce &lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; from &lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;from&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; was replaced, the new hash is &lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;newTx&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    console&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;log&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Transaction hash &lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;txHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  .&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;catch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;error&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    console&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;error&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Error sending transaction: &lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;code&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;message&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;</content>
    </entry>
    <entry xml:lang="en">
        <title>CCIP Read—Secure offchain data retrieval</title>
        <published>2020-07-19T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Nick Johnson</name><uri>https://github.com/arachnid</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3668/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/durin-secure-offchain-data-retrieval/6728" />
        

        <id>https://wg-eips.ritovision.com/3668/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:3668"
            label="ERC-3668" />
        

        
        

        
        <summary type="html">CCIP Read provides a mechanism to allow a contract to fetch external data.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3668/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Contracts wishing to support lookup of data from external sources may, instead of returning the data directly, revert using &lt;code&gt;OffchainLookup(address sender, string[] urls, bytes callData, bytes4 callbackFunction, bytes extraData)&lt;&#x2F;code&gt;. Clients supporting this specification then make an RPC call to a URL from &lt;code&gt;urls&lt;&#x2F;code&gt;, supplying &lt;code&gt;callData&lt;&#x2F;code&gt;, and getting back an opaque byte string &lt;code&gt;response&lt;&#x2F;code&gt;. Finally, clients call the function specified by &lt;code&gt;callbackFunction&lt;&#x2F;code&gt; on the contract, providing &lt;code&gt;response&lt;&#x2F;code&gt; and &lt;code&gt;extraData&lt;&#x2F;code&gt;. The contract can then decode and verify the returned data using an implementation-specific method.&lt;&#x2F;p&gt;
&lt;p&gt;This mechanism allows for offchain lookups of data in a way that is transparent to clients, and allows contract authors to implement whatever validation is necessary; in many cases this can be provided without any additional trust assumptions over and above those required if data is stored onchain.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Minimising storage and transaction costs on Ethereum has driven contract authors to adopt a variety of techniques for moving data offchain, including hashing, recursive hashing (eg Merkle Trees&#x2F;Tries) and L2 solutions. While each solution has unique constraints and parameters, they all share in common the fact that enough information is stored onchain to validate the externally stored data when required.&lt;&#x2F;p&gt;
&lt;p&gt;Thus far, applications have tended to devise bespoke solutions rather than trying to define a universal standard. This is practical - although inefficient - when a single offchain data storage solution suffices, but rapidly becomes impractical in a system where multiple end-users may wish to make use of different data storage and availability solutions based on what suits their needs.&lt;&#x2F;p&gt;
&lt;p&gt;By defining a common specification allowing smart contract to fetch data from offchain, we facilitate writing clients that are entirely agnostic to the storage solution being used, which enables new applications that can operate without knowing about the underlying storage details of the contracts they interact with.&lt;&#x2F;p&gt;
&lt;p&gt;Examples of this include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Interacting with &#x27;airdrop&#x27; contracts that store a list of recipients offchain in a merkle trie.&lt;&#x2F;li&gt;
&lt;li&gt;Viewing token information for tokens stored on an L2 solution as if they were native L1 tokens.&lt;&#x2F;li&gt;
&lt;li&gt;Allowing delegation of data such as ENS domains to various L2 solutions, without requiring clients to support each solution individually.&lt;&#x2F;li&gt;
&lt;li&gt;Allowing contracts to proactively request external data to complete a call, without requiring the caller to be aware of the details of that data.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;overview&quot;&gt;Overview&lt;&#x2F;h3&gt;
&lt;p&gt;Answering a query via CCIP read takes place in three steps:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Querying the contract.&lt;&#x2F;li&gt;
&lt;li&gt;Querying the gateway using the URL provided in (1).&lt;&#x2F;li&gt;
&lt;li&gt;Querying or sending a transaction to the contract using the data from (1) and (2).&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;In step 1, a standard blockchain call operation is made to the contract. The contract reverts with an error that specifies the data to complete the call can be found offchain, and provides the url to a service that can provide the answer, along with additional contextual information required for the call in step (3).&lt;&#x2F;p&gt;
&lt;p&gt;In step 2, the client calls the gateway service with the &lt;code&gt;callData&lt;&#x2F;code&gt; from the revert message in step (1). The gateway responds with an answer &lt;code&gt;response&lt;&#x2F;code&gt;, whose content is opaque to the client.&lt;&#x2F;p&gt;
&lt;p&gt;In step 3, the client calls the original contract, supplying the &lt;code&gt;response&lt;&#x2F;code&gt; from step (2) and the &lt;code&gt;extraData&lt;&#x2F;code&gt; returned by the contract in step (1). The contract decodes the provided data and uses it to validate the response and act on it - by returning information to the client or by making changes in a transaction. The contract could also revert with a new error to initiate another lookup, in which case the protocol starts again at step 1.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;┌──────┐                                          ┌────────┐ ┌─────────────┐&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│Client│                                          │Contract│ │Gateway @ url│&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;└──┬───┘                                          └───┬────┘ └──────┬──────┘&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │                                                  │             │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │ somefunc(...)                                    │             │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   ├─────────────────────────────────────────────────►│             │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │                                                  │             │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │ revert OffchainLookup(sender, urls, callData,    │             │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │                     callbackFunction, extraData) │             │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │◄─────────────────────────────────────────────────┤             │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │                                                  │             │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │ HTTP request (sender, callData)                  │             │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   ├──────────────────────────────────────────────────┼────────────►│&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │                                                  │             │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │ Response (result)                                │             │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │◄─────────────────────────────────────────────────┼─────────────┤&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │                                                  │             │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │ callbackFunction(result, extraData)              │             │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   ├─────────────────────────────────────────────────►│             │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │                                                  │             │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │ answer                                           │             │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │◄─────────────────────────────────────────────────┤             │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   │                                                  │             │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;contract-interface&quot;&gt;Contract interface&lt;&#x2F;h3&gt;
&lt;p&gt;A CCIP read enabled contract MUST revert with the following error whenever a function that requires offchain data is called:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OffchainLookup&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; urls&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt; callData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes4&lt;&#x2F;span&gt;&lt;span&gt; callbackFunction&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt; extraData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;sender&lt;&#x2F;code&gt; is the address of the contract that raised the error, and is used to determine if the error was thrown by the contract the client called, or &#x27;bubbled up&#x27; from a nested call.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;urls&lt;&#x2F;code&gt; specifies a list of URL templates to services (known as gateways) that implement the CCIP read protocol and can formulate an answer to the query. &lt;code&gt;urls&lt;&#x2F;code&gt; can be the empty list &lt;code&gt;[]&lt;&#x2F;code&gt;, in which case the client MUST specify the URL template. The order in which URLs are tried is up to the client, but contracts SHOULD return them in order of priority, with the most important entry first.&lt;&#x2F;p&gt;
&lt;p&gt;Each URL may include two substitution parameters, &lt;code&gt;{sender}&lt;&#x2F;code&gt; and &lt;code&gt;{data}&lt;&#x2F;code&gt;. Before a call is made to the URL, &lt;code&gt;sender&lt;&#x2F;code&gt; is replaced with the lowercase 0x-prefixed hexadecimal formatted &lt;code&gt;sender&lt;&#x2F;code&gt; parameter, and &lt;code&gt;data&lt;&#x2F;code&gt; is replaced by the 0x-prefixed hexadecimal formatted &lt;code&gt;callData&lt;&#x2F;code&gt; parameter.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;callData&lt;&#x2F;code&gt; specifies the data to call the gateway with. This value is opaque to the client. Typically this will be ABI-encoded, but this is an implementation detail that contracts and gateways can standardise on as desired.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;callbackFunction&lt;&#x2F;code&gt; is the 4-byte function selector for a function on the original contract to which a callback should be sent.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;extraData&lt;&#x2F;code&gt; is additional data that is required by the callback, and MUST be retained by the client and provided unmodified to the callback function. This value is opaque to the client.&lt;&#x2F;p&gt;
&lt;p&gt;The contract MUST also implement a callback method for decoding and validating the data returned by the gateway. The name of this method is implementation-specific, but it MUST have the signature &lt;code&gt;(bytes response, bytes extraData)&lt;&#x2F;code&gt;, and MUST have the same return type as the function that reverted with &lt;code&gt;OffchainLookup&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;If the client successfully calls the gateway, the callback function specified in the &lt;code&gt;OffchainLookup&lt;&#x2F;code&gt; error will be invoked by the client, with &lt;code&gt;response&lt;&#x2F;code&gt; set to the value returned by the gateway, and &lt;code&gt;extraData&lt;&#x2F;code&gt; set to the value returned in the contract&#x27;s &lt;code&gt;OffchainLookup&lt;&#x2F;code&gt; error. The contract MAY initiate another CCIP read lookup in this callback, though authors should bear in mind that the limits on number of recursive invocations will vary from client to client.&lt;&#x2F;p&gt;
&lt;p&gt;In a call context (as opposed to a transaction), the return data from this call will be returned to the user as if it was returned by the function that was originally invoked.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;example&quot;&gt;Example&lt;&#x2F;h4&gt;
&lt;p&gt;Suppose a contract has the following method:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; balance&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Data for these queries is stored offchain in some kind of hashed data structure, the details of which are not important for this example. The contract author wants the gateway to fetch the proof information for this query and call the following function with it:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOfWithProof&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; response&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; extraData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; balance&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;One example of a valid implementation of &lt;code&gt;balanceOf&lt;&#x2F;code&gt; would thus be:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; balance&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OffchainLookup&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;url&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodeWithSelector&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;Gateway&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;getSignedBalance&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ContractName&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balanceOfWithProof&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note that in this example the contract is returning &lt;code&gt;addr&lt;&#x2F;code&gt; in both &lt;code&gt;callData&lt;&#x2F;code&gt; and &lt;code&gt;extraData&lt;&#x2F;code&gt;, because it is required both by the gateway (in order to look up the data) and the callback function (in order to verify it). The contract cannot simply pass it to the gateway and rely on it being returned in the response, as this would give the gateway an opportunity to respond with an answer to a different query than the one that was initially issued.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;recursive-calls-in-ccip-aware-contracts&quot;&gt;Recursive calls in CCIP-aware contracts&lt;&#x2F;h4&gt;
&lt;p&gt;When a CCIP-aware contract wishes to make a call to another contract, and the possibility exists that the callee may implement CCIP read, the calling contract MUST catch all &lt;code&gt;OffchainLookup&lt;&#x2F;code&gt; errors thrown by the callee, and revert with a different error if the &lt;code&gt;sender&lt;&#x2F;code&gt; field of the error does not match the callee address.&lt;&#x2F;p&gt;
&lt;p&gt;The contract MAY choose to replace all &lt;code&gt;OffchainLookup&lt;&#x2F;code&gt; errors with a different error. Doing so avoids the complexity of implementing support for nested CCIP read calls, but renders them impossible.&lt;&#x2F;p&gt;
&lt;p&gt;Where the possibility exists that a callee implements CCIP read, a CCIP-aware contract MUST NOT allow the default solidity behaviour of bubbling up reverts from nested calls. This is to prevent the following situation:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Contract A calls non-CCIP-aware contract B.&lt;&#x2F;li&gt;
&lt;li&gt;Contract B calls back to A.&lt;&#x2F;li&gt;
&lt;li&gt;In the nested call, A reverts with &lt;code&gt;OffchainLookup&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Contract B does not understand CCIP read and propagates the &lt;code&gt;OffchainLookup&lt;&#x2F;code&gt; to its caller.&lt;&#x2F;li&gt;
&lt;li&gt;Contract A also propagates the &lt;code&gt;OffchainLookup&lt;&#x2F;code&gt; to its caller.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The result of this sequence of operations would be an &lt;code&gt;OffchainLookup&lt;&#x2F;code&gt; that looks valid to the client, as the &lt;code&gt;sender&lt;&#x2F;code&gt; field matches the address of the contract that was called, but does not execute correctly, as it only completes a nested invocation.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;example-1&quot;&gt;Example&lt;&#x2F;h4&gt;
&lt;p&gt;The code below demonstrates one way that a contract may support nested CCIP read invocations. For simplicity this is shown using Solidity&#x27;s try&#x2F;catch syntax, although as of this writing it does not yet support catching custom errors.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NestedLookup&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InvalidOperation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OffchainLookup&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; urls&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt; callData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes4&lt;&#x2F;span&gt;&lt;span&gt; callbackFunction&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt; extraData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; a&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        try&lt;&#x2F;span&gt;&lt;span&gt; target&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;b&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ret&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; ret&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; catch&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OffchainLookup&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; urls&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt; callData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes4&lt;&#x2F;span&gt;&lt;span&gt; callbackFunction&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt; extraData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sender &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;target&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InvalidOperation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OffchainLookup&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                urls&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                callData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                NestedLookup&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;aCallback&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;                abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;target&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; callbackFunction&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; extraData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; aCallback&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; response&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; extraData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; inner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes4&lt;&#x2F;span&gt;&lt;span&gt; innerCallbackFunction&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; innerExtraData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;decode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;extraData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes4&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;decode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;inner&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodeWithSelector&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;innerCallbackFunction&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; response&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; innerExtraData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;gateway-interface&quot;&gt;Gateway Interface&lt;&#x2F;h3&gt;
&lt;p&gt;The URLs returned by a contract may be of any schema, but this specification only defines how clients should handle HTTPS URLs.&lt;&#x2F;p&gt;
&lt;p&gt;Given a URL template returned in an &lt;code&gt;OffchainLookup&lt;&#x2F;code&gt;, the URL to query is composed by replacing  &lt;code&gt;sender&lt;&#x2F;code&gt; with the lowercase 0x-prefixed hexadecimal formatted &lt;code&gt;sender&lt;&#x2F;code&gt; parameter, and replacing &lt;code&gt;data&lt;&#x2F;code&gt; with the 0x-prefixed hexadecimal formatted &lt;code&gt;callData&lt;&#x2F;code&gt; parameter.&lt;&#x2F;p&gt;
&lt;p&gt;For example, if a contract returns the following data in an &lt;code&gt;OffchainLookup&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;urls = [&amp;quot;https:&#x2F;&#x2F;example.com&#x2F;gateway&#x2F;{sender}&#x2F;{data}.json&amp;quot;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sender = &amp;quot;0xaabbccddeeaabbccddeeaabbccddeeaabbccddee&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;callData = &amp;quot;0x00112233&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The request URL to query is &lt;code&gt;https:&#x2F;&#x2F;example.com&#x2F;gateway&#x2F;0xaabbccddeeaabbccddeeaabbccddeeaabbccddee&#x2F;0x00112233.json&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;If the URL template contains the &lt;code&gt;{data}&lt;&#x2F;code&gt; substitution parameter, the client MUST send a GET request after replacing the substitution parameters as described above.&lt;&#x2F;p&gt;
&lt;p&gt;If the URL template does not contain the &lt;code&gt;{data}&lt;&#x2F;code&gt; substitution parameter, the client MUST send a POST request after replacing the substitution parameters as described above. The POST request MUST be sent with a Content-Type of &lt;code&gt;application&#x2F;json&lt;&#x2F;code&gt;, and a payload matching the following schema:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;type&amp;quot;: &amp;quot;object&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;properties&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;data&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &amp;quot;description&amp;quot;: &amp;quot;0x-prefixed hex string containing the `callData` from the contract&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;sender&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &amp;quot;description&amp;quot;: &amp;quot;0x-prefixed hex string containing the `sender` parameter from the contract&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Compliant gateways MUST respond with a Content-Type of &lt;code&gt;application&#x2F;json&lt;&#x2F;code&gt;, with the body adhering to the following JSON schema:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;type&amp;quot;: &amp;quot;object&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;properties&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;data&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &amp;quot;description: &amp;quot;0x-prefixed hex string containing the result data.&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Unsuccessful requests MUST return the appropriate HTTP status code - for example, 404 if the &lt;code&gt;sender&lt;&#x2F;code&gt; address is not supported by this gateway, 400 if the &lt;code&gt;callData&lt;&#x2F;code&gt; is in an invalid format, 500 if the server encountered an internal error, and so forth. If the Content-Type of a 4xx or 5xx response is &lt;code&gt;application&#x2F;json&lt;&#x2F;code&gt;, it MUST adhere to the following JSON schema:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;type&amp;quot;: &amp;quot;object&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;properties&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;message&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &amp;quot;description: &amp;quot;A human-readable error message.&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;examples&quot;&gt;Examples&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;GET request&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Client returned a URL template `https:&#x2F;&#x2F;example.com&#x2F;gateway&#x2F;{sender}&#x2F;{data}.json`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;curl -D - https:&#x2F;&#x2F;example.com&#x2F;gateway&#x2F;0x226159d592E2b063810a10Ebf6dcbADA94Ed68b8&#x2F;0xd5fa2b00.json&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Successful result&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    HTTP&#x2F;2 200&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    content-type: application&#x2F;json; charset=UTF-8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&amp;quot;data&amp;quot;: &amp;quot;0xdeadbeefdecafbad&amp;quot;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Error result&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    HTTP&#x2F;2 404&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    content-type: application&#x2F;json; charset=UTF-8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&amp;quot;message&amp;quot;: &amp;quot;Gateway address not supported.&amp;quot;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;POST request&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Client returned a URL template `https:&#x2F;&#x2F;example.com&#x2F;gateway&#x2F;{sender}.json`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;curl -D - -X POST -H &amp;quot;Content-Type: application&#x2F;json&amp;quot; --data &amp;#39;{&amp;quot;data&amp;quot;:&amp;quot;0xd5fa2b00&amp;quot;,&amp;quot;sender&amp;quot;:&amp;quot;0x226159d592E2b063810a10Ebf6dcbADA94Ed68b8&amp;quot;}&amp;#39; https:&#x2F;&#x2F;example.com&#x2F;gateway&#x2F;0x226159d592E2b063810a10Ebf6dcbADA94Ed68b8.json&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Successful result&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    HTTP&#x2F;2 200&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    content-type: application&#x2F;json; charset=UTF-8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&amp;quot;data&amp;quot;: &amp;quot;0xdeadbeefdecafbad&amp;quot;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Error result&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    HTTP&#x2F;2 404&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    content-type: application&#x2F;json; charset=UTF-8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&amp;quot;message&amp;quot;: &amp;quot;Gateway address not supported.&amp;quot;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Clients MUST support both GET and POST requests. Gateways may implement either or both as needed.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;client-lookup-protocol&quot;&gt;Client Lookup Protocol&lt;&#x2F;h3&gt;
&lt;p&gt;A client that supports CCIP read MUST make contract calls using the following process:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Set &lt;code&gt;data&lt;&#x2F;code&gt; to the call data to supply to the contract, and &lt;code&gt;to&lt;&#x2F;code&gt; to the address of the contract to call.&lt;&#x2F;li&gt;
&lt;li&gt;Call the contract at address &lt;code&gt;to&lt;&#x2F;code&gt; function normally, supplying &lt;code&gt;data&lt;&#x2F;code&gt; as the input data. If the function returns a successful result, return it to the caller and stop.&lt;&#x2F;li&gt;
&lt;li&gt;If the function returns an error other than &lt;code&gt;OffchainLookup&lt;&#x2F;code&gt;, return it to the caller in the usual fashion.&lt;&#x2F;li&gt;
&lt;li&gt;Otherwise, decode the &lt;code&gt;sender&lt;&#x2F;code&gt;, &lt;code&gt;urls&lt;&#x2F;code&gt;, &lt;code&gt;callData&lt;&#x2F;code&gt;, &lt;code&gt;callbackFunction&lt;&#x2F;code&gt; and &lt;code&gt;extraData&lt;&#x2F;code&gt; arguments from the &lt;code&gt;OffchainLookup&lt;&#x2F;code&gt; error.&lt;&#x2F;li&gt;
&lt;li&gt;If the &lt;code&gt;sender&lt;&#x2F;code&gt; field does not match the address of the contract that was called, return an error to the caller and stop.&lt;&#x2F;li&gt;
&lt;li&gt;Construct a request URL by replacing &lt;code&gt;sender&lt;&#x2F;code&gt; with the lowercase 0x-prefixed hexadecimal formatted &lt;code&gt;sender&lt;&#x2F;code&gt; parameter, and replacing &lt;code&gt;data&lt;&#x2F;code&gt; with the 0x-prefixed hexadecimal formatted &lt;code&gt;callData&lt;&#x2F;code&gt; parameter. The client may choose which URLs to try in which order, but SHOULD prioritise URLs earlier in the list over those later in the list.&lt;&#x2F;li&gt;
&lt;li&gt;Make an HTTP GET request to the request URL.&lt;&#x2F;li&gt;
&lt;li&gt;If the response code from step (7) is in the range 400-499, return an error to the caller and stop.&lt;&#x2F;li&gt;
&lt;li&gt;If the response code from step (7) is in the range 500-599, go back to step (5) and pick a different URL, or stop if there are no further URLs to try.&lt;&#x2F;li&gt;
&lt;li&gt;Otherwise, replace &lt;code&gt;data&lt;&#x2F;code&gt; with an ABI-encoded call to the contract function specified by the 4-byte selector &lt;code&gt;callbackFunction&lt;&#x2F;code&gt;, supplying the data returned from step (7) and &lt;code&gt;extraData&lt;&#x2F;code&gt; from step (4), and return to step (1).&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Clients MUST handle HTTP status codes appropriately, employing best practices for error reporting and retries.&lt;&#x2F;p&gt;
&lt;p&gt;Clients MUST handle HTTP 4xx and 5xx error responses that have a content type other than application&#x2F;json appropriately; they MUST NOT attempt to parse the response body as JSON.&lt;&#x2F;p&gt;
&lt;p&gt;This protocol can result in multiple lookups being requested by the same contract. Clients MUST implement a limit on the number of lookups they permit for a single contract call, and this limit SHOULD be at least 4.&lt;&#x2F;p&gt;
&lt;p&gt;The lookup protocol for a client is described with the following pseudocode:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;async&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; httpcall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;urls&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; callData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; args&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;toLowerCase&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; callData&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;toLowerCase&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; url&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; of&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; urls&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; queryUrl&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; url&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;replace&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-character z-escape&quot;&gt;\{&lt;&#x2F;span&gt;&lt;span class=&quot;z-string z-regexp&quot;&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;^&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-string z-regexp&quot;&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-character z-escape&quot;&gt;\}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;g&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;match&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; p1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; args&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;p1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; First argument is URL to fetch, second is optional data for a POST request.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; response&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fetch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;queryUrl&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; url&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;includes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{data}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ?&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; undefined&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; :&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; args&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; result&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; response&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;text&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;result&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;statusCode&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 400&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; result&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;statusCode&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 499&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            throw&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Error&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;error&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;message&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;result&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;statusCode&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 200&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; result&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;statusCode&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 299&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; result&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;async&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; durin_call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;provider&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        try&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; provider&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; catch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;error&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;error&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;code&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !==&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;CALL_EXCEPTION&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                throw&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;error&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            const&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; urls&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; callData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; callbackFunction&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; extraData&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; error&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                throw&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Error&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Cannot handle OffchainLookup raised inside nested call&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; result&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; httpcall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;urls&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; callData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;            data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodeWithSelector&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;callbackFunction&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; result&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; extraData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    throw&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Error&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Too many CCIP read redirects&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;provider&lt;&#x2F;code&gt; is a provider object that facilitates Ethereum blockchain function calls.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;to&lt;&#x2F;code&gt; is the address of the contract to call.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;data&lt;&#x2F;code&gt; is the call data for the contract.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;If the function being called is a standard contract function, the process terminates after the original call, returning the same result as for a regular call. Otherwise, a gateway from &lt;code&gt;urls&lt;&#x2F;code&gt; is called with the &lt;code&gt;callData&lt;&#x2F;code&gt; returned by the &lt;code&gt;OffchainLookup&lt;&#x2F;code&gt; error, and is expected to return a valid response. The response and the &lt;code&gt;extraData&lt;&#x2F;code&gt; are then passed to the specified callback function. This process can be repeated if the callback function returns another &lt;code&gt;OffchainLookup&lt;&#x2F;code&gt; error.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;use-of-ccip-read-for-transactions&quot;&gt;Use of CCIP read for transactions&lt;&#x2F;h3&gt;
&lt;p&gt;While the specification above is for read-only contract calls (eg, &lt;code&gt;eth_call&lt;&#x2F;code&gt;), it is simple to use this method for sending transactions (eg, &lt;code&gt;eth_sendTransaction&lt;&#x2F;code&gt; or &lt;code&gt;eth_sendRawTransaction&lt;&#x2F;code&gt;) that require offchain data. While &#x27;preflighting&#x27; a transaction using &lt;code&gt;eth_estimateGas&lt;&#x2F;code&gt; or &lt;code&gt;eth_call&lt;&#x2F;code&gt;, a client that receives an &lt;code&gt;OffchainLookup&lt;&#x2F;code&gt; revert can follow the procedure described above in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3668&#x2F;#client-lookup-protocol&quot;&gt;Client lookup protocol&lt;&#x2F;a&gt;, substituting a transaction for the call in the last step. This functionality is ideal for applications such as making onchain claims supported by offchain proof data.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;glossary&quot;&gt;Glossary&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Client: A process, such as JavaScript executing in a web browser, or a backend service, that wishes to query a blockchain for data. The client understands how to fetch data using CCIP read.&lt;&#x2F;li&gt;
&lt;li&gt;Contract: A smart contract existing on Ethereum or another blockchain.&lt;&#x2F;li&gt;
&lt;li&gt;Gateway: A service that answers application-specific CCIP read queries, usually over HTTPS.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;use-of-revert-to-convey-call-information&quot;&gt;Use of &lt;code&gt;revert&lt;&#x2F;code&gt; to convey call information&lt;&#x2F;h3&gt;
&lt;p&gt;For offchain data lookup to function as desired, clients must either have some way to know that a function depends on this specification for functionality - such as a specifier in the ABI for the function - or else there must be a way for the contract to signal to the client that data needs to be fetched from elsewhere.&lt;&#x2F;p&gt;
&lt;p&gt;While specifying the call type in the ABI is a possible solution, this makes retrofitting existing interfaces to support offchain data awkward, and either results in contracts with the same name and arguments as the original specification, but with different return data - which will cause decoding errors for clients that do not expect this - or duplicating every function that needs support for offchain data with a different name (eg, &lt;code&gt;balanceOf -&amp;gt; offchainBalanceOf&lt;&#x2F;code&gt;). Neither solutions is particularly satisfactory.&lt;&#x2F;p&gt;
&lt;p&gt;Using a revert, and conveying the required information in the revert data, allows any function to be retrofitted to support lookups via CCIP read so long as the client understands the specification, and so facilitates translation of existing specifications to use offchain data.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;passing-contract-address-to-the-gateway-service&quot;&gt;Passing contract address to the gateway service&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;address&lt;&#x2F;code&gt; is passed to the gateway in order to facilitate the writing of generic gateways, thus reducing the burden on contract authors to provide their own gateway implementations. Supplying &lt;code&gt;address&lt;&#x2F;code&gt; allows the gateway to perform lookups to the original contract for information needed to assist with resolution, making it possible to operate one gateway for any number of contracts implementing the same interface.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;existence-of-extradata-argument&quot;&gt;Existence of &lt;code&gt;extraData&lt;&#x2F;code&gt; argument&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;extraData&lt;&#x2F;code&gt; allows the original contract function to pass information to a subsequent invocation. Since contracts are not persistent, without this data a contract has no state from the previous invocation. Aside from allowing arbitrary contextual information to be propagated between the two calls, this also allows the contract to verify that the query the gateway answered is in fact the one the contract originally requested.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;use-of-get-and-post-requests-for-the-gateway-interface&quot;&gt;Use of GET and POST requests for the gateway interface&lt;&#x2F;h3&gt;
&lt;p&gt;Using a GET request, with query data encoded in the URL, minimises complexity and enables entirely static implementations of gateways - in some applications a gateway can simply be an HTTP server or IPFS instance with a static set of responses in text files.&lt;&#x2F;p&gt;
&lt;p&gt;However, URLs are limited to 2 kilobytes in size, which will impose issues for more complex uses of CCIP read. Thus, we provide for an option to use POST data. This is made at the contract&#x27;s discretion (via the choice of URL template) in order to preserve the ability to have a static gateway operating exclusively using GET when desired.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Existing contracts that do not wish to use this specification are unaffected. Clients can add support for CCIP read to all contract calls without introducing any new overhead or incompatibilities.&lt;&#x2F;p&gt;
&lt;p&gt;Contracts that require CCIP read will not function in conjunction with clients that do not implement this specification. Attempts to call these contracts from non-compliant clients will result in the contract throwing an exception that is propagaged to the user.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;gateway-response-data-validation&quot;&gt;Gateway Response Data Validation&lt;&#x2F;h3&gt;
&lt;p&gt;In order to prevent a malicious gateway from causing unintended side-effects or faulty results, contracts MUST include sufficient information in the &lt;code&gt;extraData&lt;&#x2F;code&gt; argument to allow them to verify the relevance and validity of the gateway&#x27;s response. For example, if the contract is requesting information based on an &lt;code&gt;address&lt;&#x2F;code&gt; supplied to the original call, it MUST include that address in the &lt;code&gt;extraData&lt;&#x2F;code&gt; so that the callback can verify the gateway is not providing the answer to a different query.&lt;&#x2F;p&gt;
&lt;p&gt;Contracts must also implement sufficient validation of the data returned by the gateway to ensure it is valid. The validation required is application-specific and cannot be specified on a global basis. Examples would include verifying a Merkle proof of inclusion for an L2 or other Merkleized state, or verifying a signature by a trusted signer over the response data.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;client-extra-data-validation&quot;&gt;Client Extra Data Validation&lt;&#x2F;h3&gt;
&lt;p&gt;In order to prevent a malicious client from causing unintended effects when making transactions using CCIP read, contracts MUST implement appropriate checks on the &lt;code&gt;extraData&lt;&#x2F;code&gt; returned to them in the callback. Any sanity&#x2F;permission checks performed on input data for the initial call MUST be repeated on the data passed through the &lt;code&gt;extraData&lt;&#x2F;code&gt; field in the callback. For example, if a transaction should only be executable by an authorised account, that authorisation check MUST be done in the callback; it is not sufficient to perform it with the initial call and embed the authorised address in the &lt;code&gt;extraData&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;http-requests-and-fingerprinting-attacks&quot;&gt;HTTP requests and fingerprinting attacks&lt;&#x2F;h3&gt;
&lt;p&gt;Because CCIP read can cause a user&#x27;s browser to make HTTP requests to an address controlled by the contract, there is the potential for this to be used to identify users - for example, to associate their wallet address with their IP address.&lt;&#x2F;p&gt;
&lt;p&gt;The impact of this is application-specific; fingerprinting a user when they resolve an ENS domain may have little privacy impact, as the attacker will not learn the user&#x27;s wallet address, only the fact that the user is resolving a given ENS name from a given IP address - information they can also learn from running a DNS server. On the other hand, fingerprinting a user when they attempt a transaction to transfer an NFT may give an attacker everything they need to identify the IP address of a user&#x27;s wallet.&lt;&#x2F;p&gt;
&lt;p&gt;To minimise the security impact of this, we make the following recommendations:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Client libraries should provide clients with a hook to override CCIP read calls - either by rewriting them to use a proxy service, or by denying them entirely. This mechanism or another should be written so as to easily facilitate adding domains to allowlists or blocklists.&lt;&#x2F;li&gt;
&lt;li&gt;Client libraries should disable CCIP read for transactions (but not for calls) by default, and require the caller to explicitly enable this functionality. Enablement should be possible both on a per-contract, per-domain, or global basis.&lt;&#x2F;li&gt;
&lt;li&gt;App authors should not supply a &#x27;from&#x27; address for contract calls (&#x27;view&#x27; operations) where the call could execute untrusted code (that is, code not authored or trusted by the application author). As a precuationary principle it is safest to not supply this parameter at all unless the author is certain that no attacker-determined smart contract code will be executed.&lt;&#x2F;li&gt;
&lt;li&gt;Wallet authors that are responsible for fetching user information - for example, by querying token contracts - should either ensure CCIP read is disabled for transactions, and that no contract calls are made with a &#x27;from&#x27; address supplied, or operate a proxy on their users&#x27; behalf, rewriting all CCIP read calls to take place via the proxy, or both.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;We encourage client library authors and wallet authors not to disable CCIP read by default, as many applications can be transparently enhanced with this functionality, which is quite safe if the above precautions are observed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Rich Transactions</title>
        <published>2020-07-18T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Micah Zoltu</name><uri>https://github.com/MicahZoltu</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2803/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/rich-transactions-via-evm-bytecode-execution-from-externally-owned-accounts/4025" />
        

        <id>https://wg-eips.ritovision.com/2803/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2803"
            label="EIP-2803" />
        

        
        

        
        <summary type="html">Support &#x27;rich transactions&#x27; by allowing transactions from externally owned accounts to execute bytecode directly.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2803/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;If a transaction has a &lt;code&gt;to&lt;&#x2F;code&gt; of address &lt;code&gt;x&lt;&#x2F;code&gt;, then the &lt;code&gt;data&lt;&#x2F;code&gt; of the transaction will be treated as EVM bytecode and it will be executed from the context of the &lt;code&gt;CALLER&lt;&#x2F;code&gt; of the transaction (aka: the transaction signer).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Many Ethereum DApps presently require users to approve multiple transactions in order to produce one effect - for example, the common pattern of first approving a contract to spend a token, then calling that contract. This results in a poor user-experience, and complicates the experience of interacting with DApps.&lt;&#x2F;p&gt;
&lt;p&gt;Making it possible for externally owned accounts to execute EVM bytecode directly allows a single transaction to execute multiple contract calls, allowing DApps to provide a streamlined experience, where every interaction results in at most one transaction.&lt;&#x2F;p&gt;
&lt;p&gt;While this is in principle possible today using contract wallets, other UX issues, such as the need to fund a sending account with gas money, lack of support for contract wallets in browser integrations, and lack of a consistent API for contract wallets has led to poor adoption of these.This EIP is a way of enhancing the utility of existing EOAs, in the spirit of &quot;don&#x27;t let the perfect be the enemy of the good&quot;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;A new reserved address is specified at &lt;code&gt;x&lt;&#x2F;code&gt;, in the range used for precompiles. When a transaction is sent to this address from an externally owned account, the payload of the transaction is treated as EVM bytecode, and executed with the signer of the transaction as the current account. For clarity:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;ADDRESS&lt;&#x2F;code&gt; opcode returns the address of the EOA that signed the transaction.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;BALANCE&lt;&#x2F;code&gt; opcode returns the balance of the EOA that signed the transaction.&lt;&#x2F;li&gt;
&lt;li&gt;Any &lt;code&gt;CALL&lt;&#x2F;code&gt; operations that send value take their value from the EOA that signed the transaction.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CALL&lt;&#x2F;code&gt; will set the &lt;code&gt;CALLER&lt;&#x2F;code&gt; to the EOA (not &lt;code&gt;x&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; preserves the EOA as the owning account.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;CALLER&lt;&#x2F;code&gt; and &lt;code&gt;ORIGIN&lt;&#x2F;code&gt; opcodes both return the address of the EOA that signed the transaction.&lt;&#x2F;li&gt;
&lt;li&gt;There is no code associated with the precompile address. &lt;code&gt;CODE*&lt;&#x2F;code&gt; and &lt;code&gt;EXTCODE*&lt;&#x2F;code&gt; opcodes behave the same as they do for any empty address.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CALLDATA*&lt;&#x2F;code&gt; opcodes operate on the transaction payload as expected.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SLOAD&lt;&#x2F;code&gt; and &lt;code&gt;SSTORE&lt;&#x2F;code&gt; operate on the storage of the EOA. As a result, an EOA can have data in storage, that persists between transactions.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; opcode does nothing.&lt;&#x2F;li&gt;
&lt;li&gt;All other opcodes behave as expected for a call to a contract address.&lt;&#x2F;li&gt;
&lt;li&gt;The transaction is invalid if there is any value attached.&lt;&#x2F;li&gt;
&lt;li&gt;A call to the precompile address from a contract has no special effect and is equivalent to a call to a nonexistent precompile or an empty address.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The intent of this EIP is for the new precompile to act in all ways possible like a &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; from an externally owned account. Some changes are required to reflect the fact that the code being executed is not stored on chain, and for special cases such as &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;, to prevent introducing new edge-cases such as the ability to zero-out an EOA&#x27;s nonce.&lt;&#x2F;p&gt;
&lt;p&gt;A precompile was used rather than a new EIP-2718 transaction type because a precompile allows us to have a rich transaction with any type of EIP-2718 transaction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a new feature that will need to be implemented in a future hard fork. No backwards compatibility issues with existing code are expected.&lt;&#x2F;p&gt;
&lt;p&gt;Contracts or DApps that assume that an EOA cannot atomically perform multiple operations may be affected by this change, as this now makes it possible for EOAs to execute multiple atomic operations together. The authors do not believe this is a significant use-case, as this &#x27;protection&#x27; is already trivially defeated by miners.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Ethereum Provider Connect&#x2F;Disconnect Events</title>
        <published>2020-07-15T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Micah Zoltu</name><uri>https://github.com/MicahZoltu</uri>
	</author>
	
	<author>
		<name>Erik Marks</name><uri>https://github.com/rekmarks</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2786/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/2787" />
        

        <id>https://wg-eips.ritovision.com/2786/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="interface"
                label="Interface" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        

        
        <category
            term="tag:eip:2786"
            label="EIP-2786" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2786/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;When an Ethereum Provider becomes connected or disconnected, it will emit a &lt;code&gt;connect&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;disconnect&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The Provider is said to be “connected” when it can service RPC requests to at least one chain.
The Provider is said to be “disconnected” when it cannot service RPC requests to any chain at all.
When the Provider switches from a &quot;connected&quot; state to a &quot;disconnected&quot; state, it will emit a &lt;code&gt;connect&lt;&#x2F;code&gt; event.
When the Provider switches from a &quot;disconnected&quot; state to a &quot;connected&quot; state, it will emit a &lt;code&gt;disconnect&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;When an application is hooked up to an Ethereum provider, there is value in having the application be alerted of connect&#x2F;disconnect events that may occur so the application can appropriately inform the user of the situation.
It is left up to the application to decide whether to listen in on these events, and how to handle them.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;connected&quot;&gt;Connected&lt;&#x2F;h4&gt;
&lt;p&gt;The Provider is considered &lt;code&gt;connected&lt;&#x2F;code&gt; when it is able to service RPC requests to at least one chain.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;disconnected&quot;&gt;Disconnected&lt;&#x2F;h4&gt;
&lt;p&gt;The Provider is considered &lt;code&gt;disconnected&lt;&#x2F;code&gt; when it is unable to service RPC requests to any chain.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;events&quot;&gt;Events&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;connect&quot;&gt;&lt;code&gt;connect&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The Provider &lt;strong&gt;MUST&lt;&#x2F;strong&gt; emit a &lt;code&gt;connect&lt;&#x2F;code&gt; event to all attached &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2700&#x2F;&quot;&gt;EIP-2700&lt;&#x2F;a&gt; listeners if it transitions from a &lt;code&gt;disconnected&lt;&#x2F;code&gt; state to a &lt;code&gt;connected&lt;&#x2F;code&gt; state.
All attached listeners &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be called with the parameter &lt;code&gt;{ chainId }&lt;&#x2F;code&gt;.
&lt;code&gt;chainId&lt;&#x2F;code&gt; &lt;strong&gt;MUST&lt;&#x2F;strong&gt; specify the integer ID of the connected chain encoded as a hexadecimal string.
If the Provider supports the &lt;code&gt;eth_chainId&lt;&#x2F;code&gt; JSON-RPC method or a derivation of it, then the &lt;code&gt;chainId&lt;&#x2F;code&gt; &lt;strong&gt;MUST&lt;&#x2F;strong&gt; match the return value of &lt;code&gt;eth_chainId&lt;&#x2F;code&gt;.
The Provider &lt;strong&gt;MAY&lt;&#x2F;strong&gt; call the attached listeners in any order.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is mostly a retrospective EIP meaning it codifies an already existing specification so there isn’t a lot of room for improving things such as by having a connect&#x2F;disconnect event per chain.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The relationship between Ethereum Provider and client is a trusted one, where it is assumed that the user implicitly trusts the Ethereum Provider which is how it managed to get injected into the client, or the client expressly pulled in a connection to it.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;appendix-i-examples&quot;&gt;Appendix I: Examples&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; connect&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;provider&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;on&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;connect&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; chainId&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  console&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;log&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Provider connected to: &lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;</content>
    </entry>
    <entry xml:lang="en">
        <title>Reduce intrinsic transaction gas</title>
        <published>2020-07-11T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Matt Garnett</name><uri>https://github.com/lightclient</uri>
	</author>
	
	<author>
		<name>Uri Klarman</name><uri>https://github.com/uriklarman</uri>
	</author>
	
	<author>
		<name>Ben Adams</name><uri>https://github.com/benaadams</uri>
	</author>
	
	<author>
		<name>Maria Inês Silva</name><uri>https://github.com/misilva73</uri>
	</author>
	
	<author>
		<name>Anders Elowsson</name><uri>https://github.com/anderselowsson</uri>
	</author>
	
	<author>
		<name>Anthony Sassano</name><uri>https://github.com/sassal</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2780/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2780-reduce-intrinsic-cost-of-transactions/4413" />
        

        <id>https://wg-eips.ritovision.com/2780/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:2780"
            label="EIP-2780" />
        

        
        

        
        <summary type="html">Reduce intrinsic transaction gas and charge 25k when a value transfer creates a new account</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2780/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Reduce the intrinsic cost &lt;code&gt;TX_BASE_COST&lt;&#x2F;code&gt; from &lt;code&gt;21,000&lt;&#x2F;code&gt; to &lt;code&gt;4,500&lt;&#x2F;code&gt; and define a consistent gas accounting model based on actual state operations. This more granular approach makes a simple ETH transfer &lt;code&gt;6,000&lt;&#x2F;code&gt; from additional costs related to the &lt;code&gt;to&lt;&#x2F;code&gt; account.&lt;&#x2F;p&gt;
&lt;p&gt;If a non-create transaction has &lt;code&gt;value &amp;gt; 0&lt;&#x2F;code&gt; and targets a non-existent account, charge &lt;code&gt;GAS_NEW_ACCOUNT = 25,000&lt;&#x2F;code&gt; to align with &lt;code&gt;CALL&lt;&#x2F;code&gt; account creation and price in state growth. When this surcharge applies, the recipient pays exactly one cold non-code touch; no code-load cost applies.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP does not change calldata or access-list metering. It also refines related gas schedule items used in derivation and execution accounting:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Split cold-account touches into &lt;code&gt;COLD_ACCOUNT_COST_CODE = 2,600&lt;&#x2F;code&gt; and &lt;code&gt;COLD_ACCOUNT_COST_NOCODE = 500&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Introduce &lt;code&gt;STATE_UPDATE = 1,000&lt;&#x2F;code&gt; as the price of a single account-leaf write.&lt;&#x2F;li&gt;
&lt;li&gt;Reprice value-moving calls as account-leaf writes, replacing &lt;code&gt;CALL_VALUE_COST = 9,000&lt;&#x2F;code&gt; with &lt;code&gt;CALL_VALUE_COST = 2 * STATE_UPDATE = 2,000&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Specify that a &lt;code&gt;PAY&lt;&#x2F;code&gt;-style value-move primitive, if present, does not warm its recipient and never loads code (charged at &lt;code&gt;COLD_ACCOUNT_COST_NOCODE&lt;&#x2F;code&gt; if not already warmed).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Capacity impact (illustrative):&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Metric&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Result&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Change&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Max (minimal txs)&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;13,333 tx &#x2F; block&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;+367%&lt;&#x2F;td&gt;&lt;td&gt;4,500-gas minimal transactions per 60 M block&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Max (ETH transfers)&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;10,000 tx &#x2F; block&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;+250%&lt;&#x2F;td&gt;&lt;td&gt;6,000-gas ETH transfers per 60 M block&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Thoughput (minimal txs)&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;~1,111 TPS&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;+367%&lt;&#x2F;td&gt;&lt;td&gt;4,500-gas minimal transactions per 60 M block per 12sec&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Thoughput (ETH transfers)&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;~833 TPS&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;+250%&lt;&#x2F;td&gt;&lt;td&gt;6,000-gas ETH transfers per 60 M block per 12sec&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Equivalent gas-limit uplift&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;≈ +20.8%&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;-&lt;&#x2F;td&gt;&lt;td&gt;Effective throughput gain for ave tx usage (e.g., 60 M =&amp;gt; ~72.5 M)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;Monetary Context&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Money has three basic functions: a unit of account, a medium of exchange, and a store of value. ETH already meets the last two by design. It carries value without an issuer and settles with finality. Where it falls short is in everyday exchange - the friction of use rather than the nature of the asset.&lt;&#x2F;p&gt;
&lt;p&gt;ETH underpins most onchain liquidity. Pairs are denominated in it, and gas is paid in it - a de-facto tax base that anchors value. Bitcoin&#x27;s monetary role now runs mainly through exchange pairs, hence its drift in focus to store-of-value rather than medium-of-exchange. ETH still clears real activity onchain, yet outside NFTs few people think in ETH terms. In that niche ETH already functions as both unit and medium, but only for high-value items.&lt;&#x2F;p&gt;
&lt;p&gt;For ETH to operate fully as money, it must also handle small transactions. That was impractical when gas sat at 300 gwei, or even 90 gwei on quiet weekends. Post-4844, blobs absorb L2&#x27;s &quot;pay at any price&quot; data and higher gaslimits ease congestion; cost, not capacity, is the bottleneck.&lt;&#x2F;p&gt;
&lt;p&gt;EIP-2780 lowers that fixed cost. By aligning the base gas with the real work of a transaction and by correcting &lt;code&gt;CALL&lt;&#x2F;code&gt; value pricing, it removes the legacy penalty on simple payments. Small transfers become viable again without subsidising calldata or storage. The same logic charges properly for new-account creation, so state growth remains priced in.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Unit of account:&lt;&#x2F;strong&gt; When transfers are cheap and regular, people price in ETH because they use it directly. This proposal turns that habit into equilibrium rather than idealism.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Medium of exchange:&lt;&#x2F;strong&gt; Reducing &lt;code&gt;TX_BASE_COST&lt;&#x2F;code&gt; eliminates the old friction that slowed native circulation. Settlement becomes frequent, not occasional.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Store of value:&lt;&#x2F;strong&gt; Honest pricing reinforces confidence that ETH&#x27;s cost structure is grounded in real computation, not arbitrary constants.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Velocity:&lt;&#x2F;strong&gt; Lower friction raises the rate of final settlement; more frequent, smaller clears in native ETH, without altering calldata or storage economics.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Monetary competition:&lt;&#x2F;strong&gt; Stablecoins and LSTs are welcome, but they compete for onchain &quot;moneyness&quot;. Making native ETH easy to spend keeps it central; not just the fuel, but the money of the system.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;&#x2F;strong&gt; This proposal doesn&#x27;t target ETH specifically, the lower base cost applies to every transaction type. However since &lt;code&gt;TX_BASE_COST&lt;&#x2F;code&gt; makes up nearly all of an ETH transfer&#x27;s gas, while it&#x27;s only a small fraction of contract calls, ETH loses the most friction and gains the most velocity.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Specifics&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The legacy &lt;code&gt;21,000&lt;&#x2F;code&gt; base no longer matches the universal work path under warm&#x2F;cold accounting. Decomposed into signature recovery, one account-leaf write for the sender (nonce + balance coalesced), and one cold non-code touch (sender), the universal path totals &lt;code&gt;4,500&lt;&#x2F;code&gt; gas.&lt;&#x2F;p&gt;
&lt;p&gt;State growth is underpriced for top-level value transfers that create accounts, while &lt;code&gt;CALL&lt;&#x2F;code&gt; pays explicit creation. Charging &lt;code&gt;25,000&lt;&#x2F;code&gt; when a transfer creates an account aligns entry points and internalizes state growth.&lt;&#x2F;p&gt;
&lt;p&gt;A lower base removes the distortion that over-incentivized batching solely to dodge &lt;code&gt;TX_BASE_COST&lt;&#x2F;code&gt;, without subsidizing calldata or storage. The refinement of value-transfer costs and cold-account pricing makes execution charges proportional to actual state work: account touches and leaf writes.&lt;&#x2F;p&gt;
&lt;p&gt;We intentionally do &lt;strong&gt;not&lt;&#x2F;strong&gt; charge per-byte gas for the transaction envelope (&lt;code&gt;nonce&lt;&#x2F;code&gt;, &lt;code&gt;gas*&lt;&#x2F;code&gt;, &lt;code&gt;to&lt;&#x2F;code&gt;, &lt;code&gt;value&lt;&#x2F;code&gt;, &lt;code&gt;v&lt;&#x2F;code&gt;, &lt;code&gt;r&lt;&#x2F;code&gt;, &lt;code&gt;s&lt;&#x2F;code&gt;). Calldata pricing applies only to &lt;code&gt;tx.data&lt;&#x2F;code&gt;. A plain ETH payment has empty &lt;code&gt;tx.data&lt;&#x2F;code&gt;, so it pays zero calldata gas. Lowering &lt;code&gt;TX_BASE_COST&lt;&#x2F;code&gt; to the universal work path makes ETH payments cheaper without subsidizing arbitrary calldata.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;throughput-payload-and-basefee-dynamics&quot;&gt;Throughput, payload, and basefee dynamics&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP affects three independent levers:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Gas-limit equivalence:&lt;&#x2F;strong&gt; Reducing the base cost from &lt;code&gt;21,000&lt;&#x2F;code&gt; to &lt;code&gt;4,500&lt;&#x2F;code&gt; increases transaction capacity at a fixed block gaslimit by approximately +20.8%.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Payload-size bounds:&lt;&#x2F;strong&gt; Per &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7934&#x2F;&quot;&gt;EIP-7934&lt;&#x2F;a&gt; the execution payload cap is &lt;code&gt;MAX_RLP_BLOCK_SIZE = 10,485,760 - 2,097,152 = 8,388,608&lt;&#x2F;code&gt; bytes. Payload size, not gas, may become the dominant block-size constraint at high gaslimits.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Basefee market dynamics:&lt;&#x2F;strong&gt; Lower intrinsic gas reduces the average gas per tx, temporarily increasing utilisation and causing short-term downward adjustment in basefee. Over time, equilibrium restores as inclusion policies adapt.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;These levers are independent; this proposal changes only intrinsic gas, not calldata metering or access-list pricing.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;monetary-effects&quot;&gt;Monetary Effects&lt;&#x2F;h3&gt;
&lt;p&gt;Reducing ETH transfer cost from &lt;code&gt;21,000&lt;&#x2F;code&gt; =&amp;gt; &lt;code&gt;6,000&lt;&#x2F;code&gt; gas increases both transaction frequency and viable payment granularity. At a fixed basefee, smaller payments become economical, raising the &lt;strong&gt;velocity of money&lt;&#x2F;strong&gt; - how often ETH changes hands on L1.&lt;&#x2F;p&gt;
&lt;p&gt;Let $g$ be gas per transaction, $b$ the basefee (in gwei), and $r$ the user&#x27;s tolerated fee share of payment value.&lt;&#x2F;p&gt;
&lt;p&gt;$v_{\text{min}} = \frac{g \times b \times 10^{-9}}{r}$&lt;&#x2F;p&gt;
&lt;p&gt;Since $g$ drops from $21,000$ to $6,000$:&lt;&#x2F;p&gt;
&lt;p&gt;$\frac{v_{\text{min,new}}}{v_{\text{min,old}}} = \frac{6{,}000}{21{,}000} \approx 0.29$&lt;&#x2F;p&gt;
&lt;p&gt;The minimum economical L1 payment falls by about &lt;strong&gt;71 %&lt;&#x2F;strong&gt;, allowing more, smaller transfers to clear directly in ETH.&lt;&#x2F;p&gt;
&lt;p&gt;From the quantity relation $M V = P Q$, with $M$ and $P$ roughly constant over short periods:&lt;&#x2F;p&gt;
&lt;p&gt;$V_{\text{new}} &#x2F; V_{\text{old}} \approx Q_{\text{new}} &#x2F; Q_{\text{old}}$&lt;&#x2F;p&gt;
&lt;p&gt;Pure ETH-transfer capacity rises roughly &lt;strong&gt;3.5x&lt;&#x2F;strong&gt; (+250 %), and the lower $v_{\text{min}}$ further increases $Q$ as more small-value payments become viable.&lt;&#x2F;p&gt;
&lt;p&gt;Together these effects lift $V$, more frequent, smaller, native settlements without changing monetary supply.&lt;&#x2F;p&gt;
&lt;p&gt;ETH thus gains moneyness:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Medium of exchange:&lt;&#x2F;strong&gt; direct use becomes routine, not exceptional.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Unit of account:&lt;&#x2F;strong&gt; frequent native settlement encourages ETH-denominated pricing.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Store of value:&lt;&#x2F;strong&gt; workload-based fees reinforce trust in cost realism.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Price volatility may still lead users to prefer stablecoins for predictability, but this change removes unnecessary friction, restoring ETH’s competitiveness wherever volatility is tolerable.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;25,000&lt;&#x2F;code&gt; surcharge for new-account creation continues to price state growth honestly while everyday transfers become cheaper and faster.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;equivalent-gas-limit-increase&quot;&gt;Equivalent gas-limit increase&lt;&#x2F;h3&gt;
&lt;p&gt;Lowering &lt;code&gt;TX_BASE_COST&lt;&#x2F;code&gt; from &lt;code&gt;21,000&lt;&#x2F;code&gt; to &lt;code&gt;4,500&lt;&#x2F;code&gt; removes up to &lt;code&gt;16,500&lt;&#x2F;code&gt; gas per transaction. Using recent totals of 163 Ggas&#x2F;day and 1.7 M tx&#x2F;day:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Metric&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Calculation&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Result&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Change&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Avg gas per tx&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;163Bn &#x2F; 1.7M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;≈ 95,882 gas&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;-&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;New avg gas per tx&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;95,882 − 16,500&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;≈ 79,382 gas&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;-&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Throughput at fixed gaslimit&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;95,882 &#x2F; 79,382&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;≈ x1.208&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;+20.08%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Daily tx at same gas usage&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;1.7M × 1.208&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;≈ 2.053M tx&#x2F;day&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;+340k&#x2F;day&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Perfnet measurements show EL clients handle &amp;gt;300 MGas&#x2F;s for pure ETH transfers. Expressed under a 4.5k base this corresponds to &lt;code&gt;300 * (4.5&#x2F;21) ~ 64.3 MGas&#x2F;s&lt;&#x2F;code&gt;, i.e. &lt;code&gt;~771 MGas&lt;&#x2F;code&gt; per 12 s slot. This indicates sufficient headroom and that the current base is significantly overcharged, so no extra engineering is required to improve performance to support this change.&lt;&#x2F;p&gt;
&lt;p&gt;Net effect equals raising a 45 M gas limit to ~54.4 M at unchanged calldata and access-list metering. This directly advances Scaling L1.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;After &lt;code&gt;FORK_BLOCK&lt;&#x2F;code&gt;, set the following parameters and rules:&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TX_BASE_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;4,500&lt;&#x2F;td&gt;&lt;td&gt;Base cost of any transaction&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;GAS_NEW_ACCOUNT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;25,000&lt;&#x2F;td&gt;&lt;td&gt;Surcharge when a value-transferring transaction creates a new account&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;STATE_UPDATE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;1,000&lt;&#x2F;td&gt;&lt;td&gt;One account-leaf write in the account trie (nonce and balance coalesce)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;COLD_ACCOUNT_COST_CODE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;2,600&lt;&#x2F;td&gt;&lt;td&gt;Cold touch of an account with code&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;COLD_ACCOUNT_COST_NOCODE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;500&lt;&#x2F;td&gt;&lt;td&gt;Cold touch of an account known to have no code&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;WARM_STATE_READ&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;100&lt;&#x2F;td&gt;&lt;td&gt;Touch of an already-warm account (same as &lt;code&gt;WARM_STORAGE_READ_COST&lt;&#x2F;code&gt;)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The intrinsic gas accounting defined here overrides &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;&#x27;s blanket &quot;all tx addresses are warm&quot; rule.&lt;&#x2F;p&gt;
&lt;p&gt;A transaction’s intrinsic base is decomposed into explicit primitives, so warmth must be priced explicitly.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;tx.sender&lt;&#x2F;code&gt; is charged as a cold non-code account (&lt;code&gt;COLD_ACCOUNT_COST_NOCODE = 500&lt;&#x2F;code&gt;), representing the first access and coalesced account-leaf update.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;tx.to&lt;&#x2F;code&gt; is charged based on its type:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;if a contract create, charge under those rules.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;if an EOA or an empty account, use &lt;code&gt;COLD_ACCOUNT_COST_NOCODE = 500&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;if a contract, use &lt;code&gt;COLD_ACCOUNT_COST_CODE = 2,600&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;if a precompile, it is warm at tx start and charged zero.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Warmth discovered through an access list still applies and overrides the cold cost.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This decomposition replaces the implicit warmth assumptions of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt; and makes the per-account cost explicit in the base or the execution phase as appropriate.&lt;&#x2F;p&gt;
&lt;p&gt;Notes:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;STATE_UPDATE&lt;&#x2F;code&gt; counts writes at the account-leaf granularity. If a single account&#x27;s nonce and balance both change in one transition, charge one &lt;code&gt;STATE_UPDATE&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;COLD_ACCOUNT_COST_NOCODE&lt;&#x2F;code&gt; reflects that non-code accounts do not load code or a storage trie, so have a lower warming cost.&lt;&#x2F;li&gt;
&lt;li&gt;A regular ETH transfer additionally includes a cold touch of at least &lt;code&gt;COLD_ACCOUNT_COST_NOCODE&lt;&#x2F;code&gt; and a &lt;code&gt;STATE_UPDATE&lt;&#x2F;code&gt; of the &lt;code&gt;to&lt;&#x2F;code&gt; address, so the effective minimal productive tx cost is &lt;code&gt;6,000&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Not including the &lt;code&gt;to&lt;&#x2F;code&gt; cold warming and &lt;code&gt;STATE_UPDATE&lt;&#x2F;code&gt; in &lt;code&gt;TX_BASE_COST&lt;&#x2F;code&gt; means a contract-interaction transaction that does not transfer value does not unnecessarily pay these additional costs.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;derivation-non-normative&quot;&gt;Derivation (non-normative)&lt;&#x2F;h3&gt;
&lt;p&gt;Decomposition of the base cost into universal primitives:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Component&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Cost&lt;&#x2F;th&gt;&lt;th&gt;Notes&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;ECRECOVER&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;3,000&lt;&#x2F;td&gt;&lt;td&gt;Elliptic curve signature recovery&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;STATE_UPDATE&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;1,000&lt;&#x2F;td&gt;&lt;td&gt;One account-leaf write (nonce + balance coalesced)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;COLD_ACCOUNT_COST_NOCODE&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;500&lt;&#x2F;td&gt;&lt;td&gt;Sender is cold and has no code&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;TX_BASE_COST&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;strong&gt;4,500&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;Sum of above (3,000 + 1,000 + 500)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;new-account-surcharge&quot;&gt;New-account surcharge&lt;&#x2F;h3&gt;
&lt;p&gt;Apply &lt;code&gt;GAS_NEW_ACCOUNT&lt;&#x2F;code&gt; when &lt;strong&gt;all&lt;&#x2F;strong&gt; are true:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The transaction is not a &lt;code&gt;CREATE&lt;&#x2F;code&gt; transaction.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;value &amp;gt; 0&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;to&lt;&#x2F;code&gt; is not a precompile.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;to&lt;&#x2F;code&gt; is non-existent per &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;161&#x2F;&quot;&gt;EIP-161&lt;&#x2F;a&gt; emptiness at the start of transaction execution.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The &lt;code&gt;GAS_NEW_ACCOUNT = 25,000&lt;&#x2F;code&gt;charge covers state growth (new leaf creation and one &lt;code&gt;STATE_UPDATE&lt;&#x2F;code&gt;).
An additional &lt;code&gt;COLD_ACCOUNT_COST_NOCODE = 500&lt;&#x2F;code&gt; applies for the initial lookup to determine that the account does not exist.&lt;&#x2F;p&gt;
&lt;p&gt;Thus, the &lt;strong&gt;total&lt;&#x2F;strong&gt; intrinsic gas for a value-transferring transaction to a new account is &lt;code&gt;30,000&lt;&#x2F;code&gt; (&lt;code&gt;4,500 base + 500 lookup + 25,000 new-account surcharge&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;For reference, the &lt;strong&gt;total&lt;&#x2F;strong&gt; charges for such transfers change from 21,000 to 30,000.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Component&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Cost&lt;&#x2F;th&gt;&lt;th&gt;Notes&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;TX_BASE_COST&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;4,500&lt;&#x2F;td&gt;&lt;td&gt;Base transaction cost&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;COLD_ACCOUNT_COST_NOCODE&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;500&lt;&#x2F;td&gt;&lt;td&gt;Recipient cold lookup (execution charge)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;GAS_NEW_ACCOUNT&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;25,000&lt;&#x2F;td&gt;&lt;td&gt;Account creation, includes leaf write&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Total&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;strong&gt;30,000&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;Sum of above (4,500 + 500 + 25,000)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Notes:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If &lt;code&gt;value = 0&lt;&#x2F;code&gt; and &lt;code&gt;to&lt;&#x2F;code&gt; is empty per &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;161&#x2F;&quot;&gt;EIP-161&lt;&#x2F;a&gt;, no account is created and no surcharge applies.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CREATE&lt;&#x2F;code&gt; transactions are unchanged; their cost already includes account creation.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;intrinsic-gas-computation&quot;&gt;Intrinsic gas computation&lt;&#x2F;h3&gt;
&lt;p&gt;Clients compute intrinsic gas as today for each typed transaction &lt;strong&gt;except&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Replace any hardcoded &lt;code&gt;21,000&lt;&#x2F;code&gt; with &lt;code&gt;TX_BASE_COST = 4,500&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Add &lt;code&gt;GAS_NEW_ACCOUNT&lt;&#x2F;code&gt; when the &lt;em&gt;New-account surcharge&lt;&#x2F;em&gt; conditions hold.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;pseudocode-normative&quot;&gt;Pseudocode (normative):&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CalculateIntrinsicGas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; state_at_start&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gasCost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TX_BASE_COST&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Existing rules for calldata and access lists remain unchanged by this EIP.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gasCost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; GasForCalldata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;                  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; per active calldata pricing EIPs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;has_access_list&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        gasCost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; GasForAccessList&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;access_list&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;     #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; per EIP-2930&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;is_create&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;       and&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;       and&lt;&#x2F;span&gt;&lt;span&gt; is_precompile&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;       and&lt;&#x2F;span&gt;&lt;span&gt; is_nonexistent_per_eip161&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state_at_start&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        gasCost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GAS_NEW_ACCOUNT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; gasCost&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;evm-gas-schedule-adjustments&quot;&gt;EVM gas schedule adjustments&lt;&#x2F;h3&gt;
&lt;p&gt;These changes refine execution-layer accounting to align with the primitives above.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Value-moving calls.&lt;&#x2F;strong&gt; Replace the legacy &lt;code&gt;CALL_VALUE_COST = 9,000&lt;&#x2F;code&gt; with:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If recipient exists: &lt;code&gt;CALL_VALUE_COST = 2 * STATE_UPDATE = 2,000&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If recipient is EIP-161-empty: &lt;code&gt;CALL_VALUE_COST = STATE_UPDATE + GAS_NEW_ACCOUNT = 26,000&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;This charge is in addition to warm&#x2F;cold account-touch costs per EIP-2929 and the existing &lt;code&gt;CALL&lt;&#x2F;code&gt; base cost. This EIP does not modify the &lt;code&gt;CALL&lt;&#x2F;code&gt; base cost.
The &lt;code&gt;CALL_VALUE_COST = 2,000&lt;&#x2F;code&gt; applies for all value-carrying calls, regardless of whether the callee&#x27;s account has already been updated earlier in the same transaction. This ensures the 2300-gas stipend mechanism remains safe and consistent for simple value forwarding and does not retroactively depend on account-update history.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Cold-account touches.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Use &lt;code&gt;COLD_ACCOUNT_COST_CODE = 2,600&lt;&#x2F;code&gt; when touching an account with code.&lt;&#x2F;li&gt;
&lt;li&gt;Use &lt;code&gt;COLD_ACCOUNT_COST_NOCODE = 500&lt;&#x2F;code&gt; when touching an account known to have no code.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Warmth policy.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Access-list entries (charged via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930&lt;&#x2F;a&gt;) and precompiles are warm at tx start.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CALL&lt;&#x2F;code&gt; warms its &lt;code&gt;to&lt;&#x2F;code&gt; after charging the appropriate cold cost if cold.&lt;&#x2F;li&gt;
&lt;li&gt;A &lt;code&gt;PAY&lt;&#x2F;code&gt;-style pure value-move primitive, if present, does not warm its recipient and never loads code. It pays &lt;code&gt;WARM_STATE_READ = 100&lt;&#x2F;code&gt; if warm for unrelated reasons, else &lt;code&gt;COLD_ACCOUNT_COST_NOCODE = 500&lt;&#x2F;code&gt;, plus the value-write cost above.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Self-transfers.&lt;&#x2F;strong&gt; If &lt;code&gt;from == to&lt;&#x2F;code&gt;, only one &lt;code&gt;STATE_UPDATE&lt;&#x2F;code&gt; occurs. The sender&#x27;s nonce and balance update are coalesced into the same leaf write. No recipient lookup or separate write is charged. (Is a NOP tx other than charging gas and incrementing nonce).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;transaction-reference-cases&quot;&gt;Transaction reference cases&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Case&lt;&#x2F;th&gt;&lt;th&gt;Formula&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Total Cost&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;(NOP) No-transfer to EOA&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;TX_BASE_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;4,500&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;(NOP) No-transfer to empty account&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;TX_BASE_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;4,500&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;(NOP) ETH transfer to self&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;TX_BASE_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;4,500&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;ETH Transfer to existing EOA&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;TX_BASE_COST&lt;&#x2F;code&gt; + &lt;code&gt;COLD_ACCOUNT_COST_NOCODE&lt;&#x2F;code&gt; + &lt;code&gt;STATE_UPDATE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;6,000&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;No-transfer to contract&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;TX_BASE_COST&lt;&#x2F;code&gt; + &lt;code&gt;COLD_ACCOUNT_COST_CODE&lt;&#x2F;code&gt; + &lt;strong&gt;execution&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;7,100 + &lt;strong&gt;execution&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;ETH Transfer to contract&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;TX_BASE_COST&lt;&#x2F;code&gt; + &lt;code&gt;COLD_ACCOUNT_COST_CODE&lt;&#x2F;code&gt; + &lt;code&gt;STATE_UPDATE&lt;&#x2F;code&gt; + &lt;strong&gt;execution&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;8,100 + &lt;strong&gt;execution&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;ETH Transfer creating new account&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;TX_BASE_COST&lt;&#x2F;code&gt; + &lt;code&gt;COLD_ACCOUNT_COST_NOCODE&lt;&#x2F;code&gt; + &lt;code&gt;GAS_NEW_ACCOUNT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;30,000&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;This aligns costs with actual state work rather than legacy flat surcharges.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;edits-and-interactions-with-other-eips&quot;&gt;Edits and interactions with other EIPs&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930&lt;&#x2F;a&gt; (Access List).&lt;&#x2F;strong&gt; Intrinsic gas is &lt;code&gt;TX_BASE_COST&lt;&#x2F;code&gt; after &lt;code&gt;FORK_BLOCK&lt;&#x2F;code&gt;. Access lists keep their existing per-entry charges and warming semantics.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt; (Gas cost increases for state access).&lt;&#x2F;strong&gt; Refined by this EIP to price non-code cold touches at &lt;code&gt;500&lt;&#x2F;code&gt; and code-account cold touches at &lt;code&gt;2,600&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; (Set EOA Code).&lt;&#x2F;strong&gt; &lt;code&gt;TX_BASE_COST&lt;&#x2F;code&gt; remains &lt;code&gt;4,500&lt;&#x2F;code&gt; even if the sender temporarily assumes code for the transaction. Clients must not perform any disk code-load to determine sender type, since 7702 provides code inline. If the transaction executes code that reads or executes its own code, normal &lt;code&gt;COLD_ACCOUNT_COST_CODE&lt;&#x2F;code&gt; or &lt;code&gt;WARM_STATE_READ&lt;&#x2F;code&gt; costs apply at execution time as per the standard cold&#x2F;warm model.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Calldata-pricing EIPs (e.g. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7623&#x2F;&quot;&gt;EIP-7623&lt;&#x2F;a&gt;).&lt;&#x2F;strong&gt; Unchanged. This EIP does not alter calldata pricing.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Price only what every transaction always does: ECDSA recovery, warming &lt;code&gt;sender&lt;&#x2F;code&gt; and &lt;code&gt;to&lt;&#x2F;code&gt;, and one account-leaf write for the sender (nonce + balance change). That sums to &lt;code&gt;4,500&lt;&#x2F;code&gt; gas. Anything not universal should be metered separately.&lt;&#x2F;p&gt;
&lt;p&gt;Calldata remains metered per byte. No calldata allowance is folded into the base. This reinforces ETH as money and payments: a plain ETH transfer carries no calldata, executes no bytecode, and touches no contract storage slots. It adds exactly one recipient touch (when not a smart contract) and one recipient leaf write, so its total is &lt;code&gt;6,000&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;CREATE&lt;&#x2F;code&gt; is unchanged because its cost already includes account creation. Access-list pricing is unchanged.&lt;&#x2F;p&gt;
&lt;p&gt;Legacy pricing undercharged top-level ETH transfers that created new accounts relative to internal &lt;code&gt;CALL&lt;&#x2F;code&gt;-based creations. This EIP corrects that by charging &lt;code&gt;GAS_NEW_ACCOUNT = 25,000&lt;&#x2F;code&gt;, identical to the &lt;code&gt;CALL&lt;&#x2F;code&gt; account-creation surcharge, ensuring consistent pricing for state growth regardless of entry path.&lt;&#x2F;p&gt;
&lt;p&gt;This removes cross-subsidies, aligns charges with resources, and keeps costs equal across paths that perform the same state growth.&lt;&#x2F;p&gt;
&lt;p&gt;Do not fold any calldata allowance into the base. The envelope RLP (&lt;code&gt;nonce&lt;&#x2F;code&gt;, &lt;code&gt;gas*&lt;&#x2F;code&gt;, &lt;code&gt;to&lt;&#x2F;code&gt;, &lt;code&gt;value&lt;&#x2F;code&gt;, &lt;code&gt;v&lt;&#x2F;code&gt;, &lt;code&gt;r&lt;&#x2F;code&gt;, &lt;code&gt;s&lt;&#x2F;code&gt;) is not charged as calldata and remains unmetered per byte. Only &lt;code&gt;tx.data&lt;&#x2F;code&gt; bytes are metered at the existing calldata schedule, and access lists keep their per-entry costs. A vanilla ETH transfer executes no bytecode and touches no contract storage slots; it performs signature recovery, warms the sender, and updates sender and recipient accounts. It therefore receives the base discount and pays only the additional recipient costs.&lt;&#x2F;p&gt;
&lt;p&gt;Bundling multiple transfers into a single contract call avoids repeated &lt;code&gt;TX_BASE_COST&lt;&#x2F;code&gt;, but those transfers then execute serially inside one EVM context. That blocks parallel execution. With a lower per-tx base cost, users have less incentive to bundle, so more transfers remain independent transactions. Independent transactions can be scheduled across threads, which improves parallelism at the client and execution-layer level.&lt;&#x2F;p&gt;
&lt;p&gt;Thus, reducing &lt;code&gt;TX_BASE_COST&lt;&#x2F;code&gt; not only corrects mispricing but also increases the share of transactions that are naturally parallelizable.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP composes cleanly with calldata-pricing proposals such as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7623&#x2F;&quot;&gt;EIP-7623&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7976&#x2F;&quot;&gt;EIP-7976&lt;&#x2F;a&gt;. Those EIPs affect &lt;code&gt;tx.data&lt;&#x2F;code&gt; metering, while this EIP adjusts only transaction-level intrinsic accounting. There is no overlapping scope.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-not-charge-full-tx-data-as-calldata&quot;&gt;Why not charge full tx data as calldata?&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Intrinsic coupling to signed fields.&lt;&#x2F;strong&gt; Pricing full-transaction bytes would make intrinsic gas depend on &lt;code&gt;gas_limit&lt;&#x2F;code&gt; and variable-length signature elements, creating fixed-point estimation issues and incentives for signature-length selection as well as iteration unstablity as &lt;code&gt;gas_limit&lt;&#x2F;code&gt; depends on signiture which contains &lt;code&gt;gas_limit&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Serialization neutrality.&lt;&#x2F;strong&gt; A fee rule keyed to RLP size couples costs to one encoding and weakens &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; type neutrality and future formats such as SSZ. Calldata is treated as opaque bytes so it avoids this coupling.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Policy targeting and market floor.&lt;&#x2F;strong&gt; Calldata floors (for example &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7623&#x2F;&quot;&gt;EIP-7623&lt;&#x2F;a&gt; or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7976&#x2F;&quot;&gt;EIP-7976&lt;&#x2F;a&gt;) price bytes in &lt;code&gt;tx.data&lt;&#x2F;code&gt; to bound EL payload and steer data to blobs; envelope bytes are control-plane. The &lt;code&gt;TX_BASE_COST&lt;&#x2F;code&gt; is the smallest tx size, and having a low encoding-agnostic intrinsic base keeps the minimum inclusion price coupled to the basefee market, without opening a DoS vector.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Native settlement and unit-of-account.&lt;&#x2F;strong&gt; Even though all transactions receive the same absolute gas reduction, it proportionally improves pristine ETH transfers more. With an ETH transfer at ~6,000 gas vs a permissioned ERC-20&#x2F;LST&#x2F;stablecoin transfer at ~48,000 gas, you get ~8x higher payment throughput per unit gas, which reinforces ETH as the settlement asset and reduces reliance on contract-based money (which carries smart contract risk, operator risk, governance risk and censorship risks via smart contract operator).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2780&#x2F;.&#x2F;assets&#x2F;1.png&quot; alt=&quot;Figure 1&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;effects-on-transactions-per-block&quot;&gt;Effects on transactions per block&lt;&#x2F;h3&gt;
&lt;p&gt;For execution-payload size, use &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7934&#x2F;&quot;&gt;EIP-7934&lt;&#x2F;a&gt;’s 8 MiB uncompressed cap: &lt;code&gt;8,388,608 bytes&lt;&#x2F;code&gt;. A typical EIP-1559 ETH transfer encodes at roughly &lt;code&gt;~110 bytes&lt;&#x2F;code&gt;, yielding a size cap of &lt;code&gt;floor(8,388,608 &#x2F; 110) = 76,260 tx&lt;&#x2F;code&gt; per block when size, not gas, is the binding constraint.&lt;&#x2F;p&gt;
&lt;p&gt;There are two useful ceilings to consider:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Minimal transaction with no value and no execution: &lt;code&gt;TX_BASE_COST = 4,500&lt;&#x2F;code&gt; gas.&lt;&#x2F;li&gt;
&lt;li&gt;Minimal ETH payment to an existing EOA: &lt;code&gt;6,000&lt;&#x2F;code&gt; gas (&lt;code&gt;TX_BASE_COST + COLD_ACCOUNT_COST_NOCODE + STATE_UPDATE&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Counts below are &lt;code&gt;floor(gaslimit &#x2F; per-tx-gas)&lt;&#x2F;code&gt;, then capped by &lt;code&gt;76,260&lt;&#x2F;code&gt; when the 8 MiB size limit binds. TPS figures round to the nearest integer.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;scenario-a-minimal-txs-at-4-500-gas&quot;&gt;Scenario A: minimal txs at 4,500 gas&lt;&#x2F;h4&gt;
&lt;p&gt;Binding point for size-cap dominance: &lt;code&gt;76,260 * 4,500 = 343,170,000&lt;&#x2F;code&gt; gas. At gaslimits above ~343.17 M, block size, not gas, limits the tx count for 4,500-gas transactions.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&quot;text-align: right&quot;&gt;Block gaslimit&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Old tx&#x2F;bk (21k)&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;New tx&#x2F;bk (4.5k)&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;TPS @ 12s&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;TPS @ 6s&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;TPS @ 3s&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;TPS @ 1.5s&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;45 M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;2,142&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;10,000&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;833&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;1,667&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;3,333&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;6,667&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;60 M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;2,857&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;13,333&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;1,111&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;2,222&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;4,444&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;8,889&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;100 M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;4,761&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;22,222&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;1,852&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;3,704&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;7,407&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;14,815&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;200 M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;9,523&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;44,444&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;3,704&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;7,407&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;14,815&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;29,629&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;450 M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;21,428&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;†76,260&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;6,355&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;12,710&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;25,420&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;50,840&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;† Size cap binds at 450 M because 450 M &amp;gt; 343.17 M.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;scenario-b-eth-transfers-at-6-000-gas&quot;&gt;Scenario B: ETH transfers at 6,000 gas&lt;&#x2F;h4&gt;
&lt;p&gt;Binding point for size-cap dominance: &lt;code&gt;76,260 * 6,000 = 457,560,000&lt;&#x2F;code&gt; gas. At gaslimits below ~457.56 M, gas limits tx count; above it, the 8 MiB size cap dominates.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&quot;text-align: right&quot;&gt;Block gaslimit&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Old tx&#x2F;bk (21k)&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;New tx&#x2F;bk (6k)&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;TPS @ 12s&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;TPS @ 6s&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;TPS @ 3s&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;TPS @ 1.5s&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;45 M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;2,142&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;7,500&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;625&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;1,250&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;2,500&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;5,000&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;60 M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;2,857&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;10,000&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;833&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;1,667&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;3,333&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;6,667&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;100 M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;4,761&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;16,666&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;1,389&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;2,778&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;5,555&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;11,111&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;200 M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;9,523&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;33,333&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;2,778&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;5,556&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;11,111&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;22,222&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;450 M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;21,428&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;75,000&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;6,250&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;12,500&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;25,000&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;50,000&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;changes-for-common-types-of-txs&quot;&gt;Changes for common types of txs&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Transaction Type&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Old Cost&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;New Cost&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Change&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Simple ETH transfer (existing EOA)&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;21,000&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;6,000&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;−71 %&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;ETH transfer creating new EOA&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;21,000&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;30,000&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;+43 %&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;ERC-20 transfer (typical)&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;63,200&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;48,200&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;−24 %&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;ERC-20 transfer (Solady)&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;33,400&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;18,400&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;−45 %&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Uniswap v3 swap&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;184,500&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;169,500&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;−8 %&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Uniswap v3 add-liquidity&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;216,900&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;201,900&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;−7 %&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;reference-mgas-s-for-gaslimit-vs-slot-time&quot;&gt;Reference MGas&#x2F;s for gaslimit vs slot time&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&quot;text-align: right&quot;&gt;Block gaslimit&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;MGas&#x2F;s @ 12s&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;MGas&#x2F;s @ 6s&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;MGas&#x2F;s @ 3s&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;MGas&#x2F;s @ 1.5s&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;45 M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;3.75&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;7.50&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;15.00&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;30.00&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;60 M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;5.00&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;10.00&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;20.00&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;40.00&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;100 M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;8.33&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;16.67&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;33.33&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;66.67&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;200 M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;16.67&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;33.33&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;66.67&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;133.33&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;450 M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;37.50&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;75.00&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;150.00&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;300.00&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is &lt;strong&gt;not&lt;&#x2F;strong&gt; backward compatible. It is a consensus gas repricing that must be activated at &lt;code&gt;FORK_BLOCK&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Wallets, RPCs, gas estimators, and any logic that assumes a &lt;code&gt;21,000&lt;&#x2F;code&gt; base must update.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;While the benefits of reducing transactions&#x27; intrinsic cost are apparent, such a change should be applied if it imposes no negative externalities, or if such effects are negligible.&lt;&#x2F;p&gt;
&lt;p&gt;Tests should be created with blocks of just ETH transfers and tested on Perfnet across all EL clients to ensure the pricing is correct.&lt;&#x2F;p&gt;
&lt;p&gt;Add explicit test vectors (intrinsic gas only):&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;value &amp;gt; 0&lt;&#x2F;code&gt; to an empty EOA (non-existent per EIP-161): intrinsic &lt;code&gt;30,000&lt;&#x2F;code&gt; (4,500 base + 500 + 25,000 surcharge).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;value &amp;gt; 0&lt;&#x2F;code&gt; to a precompile: intrinsic &lt;code&gt;4,500&lt;&#x2F;code&gt; (no surcharge; precompiles are warm at tx start).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;value = 0&lt;&#x2F;code&gt; to an empty address: intrinsic &lt;code&gt;4,500&lt;&#x2F;code&gt; (no creation, no surcharge).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CREATE&lt;&#x2F;code&gt; transaction: unchanged from prior rules.&lt;&#x2F;li&gt;
&lt;li&gt;EIP-7702 transaction with and without access list: intrinsic uses &lt;code&gt;TX_BASE_COST&lt;&#x2F;code&gt; plus unchanged access-list costs.&lt;&#x2F;li&gt;
&lt;li&gt;Block of txs calling minimal gas contract execution with maximal contract size addresses (so VM is activated for every tx).&lt;&#x2F;li&gt;
&lt;li&gt;Warmth and access list interplay
&lt;ul&gt;
&lt;li&gt;ETH transfer to existing EOA without access list: charge &lt;code&gt;COLD_ACCOUNT_COST_NOCODE = 500&lt;&#x2F;code&gt; for recipient lookup.&lt;&#x2F;li&gt;
&lt;li&gt;Same transaction with recipient in access list: charge &lt;code&gt;WARM_STATE_READ = 100&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;7702 interactions
&lt;ul&gt;
&lt;li&gt;7702 tx where sender assumes code and calls nothing: intrinsic = 4,500, no extra cold-code cost.&lt;&#x2F;li&gt;
&lt;li&gt;7702 tx where sender assumes code and executes self-code: charge &lt;code&gt;COLD_ACCOUNT_COST_CODE&lt;&#x2F;code&gt; when first loaded.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Precompile transfers
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;value &amp;gt; 0&lt;&#x2F;code&gt; to &lt;code&gt;0x01&lt;&#x2F;code&gt;–&lt;code&gt;0x09&lt;&#x2F;code&gt;: intrinsic = 4,500, no surcharge.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Self-transfer &lt;code&gt;from == to&lt;&#x2F;code&gt;: total = 4,500.&lt;&#x2F;li&gt;
&lt;li&gt;Internal CALL repricing
&lt;ul&gt;
&lt;li&gt;Internal &lt;code&gt;CALL&lt;&#x2F;code&gt; to existing EOA with value: &lt;code&gt;CALL_VALUE_COST = 2,000&lt;&#x2F;code&gt; plus cold&#x2F;warm costs.&lt;&#x2F;li&gt;
&lt;li&gt;Internal &lt;code&gt;CALL&lt;&#x2F;code&gt; to EIP-161-empty: &lt;code&gt;CALL_VALUE_COST = 26,000&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Zero-value edge cases &lt;code&gt;value = 0&lt;&#x2F;code&gt; to empty address: intrinsic = &lt;code&gt;4,500&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Perfnet stress
&lt;ul&gt;
&lt;li&gt;Fill block with minimal 4,500-gas tx and 6,000-gas ETH transfers; confirm gas vs byte-size binding per &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7934&#x2F;&quot;&gt;EIP-7934&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;SELFDESTRUCT test: Create-and-destroy in one tx; confirm normal value-transfer costs apply, no deletion repricing.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;As this significantly increases the max tx per block this carries risk.&lt;&#x2F;p&gt;
&lt;p&gt;However this pricing should be the same as performing the component changes inside the transaction; and it factors in the additional costs from state growth which were not originally in the transaction base price.&lt;&#x2F;p&gt;
&lt;p&gt;Current gaslimit testing mostly uses a block with a single transaction; so this should not cause unexpected load compared to what is already being tested.&lt;&#x2F;p&gt;
&lt;p&gt;The semantics of &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; remain unchanged. Following &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6780&#x2F;&quot;&gt;EIP-6780&lt;&#x2F;a&gt;, only contracts created within the same transaction may be fully deleted. This EIP does not reprice or modify any &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; side-effects.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Contract Ownership Governance</title>
        <published>2020-07-04T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Soham Zemse</name><uri>https://github.com/zemse</uri>
	</author>
	
	<author>
		<name>Nick Mudge</name><uri>https://github.com/mudgen</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2767/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/2766" />
        

        <id>https://wg-eips.ritovision.com/2767/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2767"
            label="ERC-2767" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2767/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;A standard for Governance contracts that holds the administrative ownership of other smart contracts with voting power distributed as &lt;code&gt;ERC-20&lt;&#x2F;code&gt; tokens.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The following standard defines the implementation of a standard API for a Governance smart contract based on &lt;code&gt;ERC-20&lt;&#x2F;code&gt;. Existing &lt;code&gt;ERC-173&lt;&#x2F;code&gt; compatible contracts can upgrade from private key wallet ownership to a Governance smart contract. Adhering to a standard API enables general tools to populate governance information of various projects, thus increasing transparency.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Traditionally, many contracts that require that they be owned or controlled in some way use &lt;code&gt;ERC-173&lt;&#x2F;code&gt; which standardized the use of ownership in the smart contracts. For example to withdraw funds or perform administrative actions.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; dApp&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; doSomethingAdministrative&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; admin logic that can be performed by a single wallet&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Often, such administrative rights for a contract are written for maintenance purpose but users need to trust the owner. Rescue operations by an owner have raised questions on decentralised nature of the projects. Also, there is a possibility of compromise of an owner&#x27;s private key.&lt;&#x2F;p&gt;
&lt;p&gt;At present, many governance implementations by ambitious projects need users to visit a specific UI to see governance information about their project. Some examples of live implementations having different API that does the same thing are &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;compound-finance&#x2F;compound-protocol&#x2F;blob&#x2F;master&#x2F;contracts&#x2F;Governance&#x2F;GovernorAlpha.sol#L27&quot;&gt;Compound Governance&lt;&#x2F;a&gt;, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;Uniswap&#x2F;governance&#x2F;blob&#x2F;master&#x2F;contracts&#x2F;GovernorAlpha.sol#L27&quot;&gt;Uniswap Governance&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;sushiswap&#x2F;sushiswap&#x2F;blob&#x2F;master&#x2F;contracts&#x2F;GovernorAlpha.sol#L45&quot;&gt;Sushiswap Governance&lt;&#x2F;a&gt;. It&#x27;s just like if the ERC-20 standard wasn&#x27;t finalized, then token projects would have their own block explorer. Adhering to a standard API would enable general tools (like Etherscan) to populate governance information, thus increasing transparency to users. Using widely popular &lt;code&gt;ERC-20&lt;&#x2F;code&gt; token as a governance token, existing tools built to work with &lt;code&gt;ERC-20&lt;&#x2F;code&gt; can already display voters. This can result in a wide adoption for contract governance over private key based ownership.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;A Governance contract that is compliant with &lt;code&gt;ERC-2767&lt;&#x2F;code&gt; shall implement the following interfaces:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-2767 Governance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-165 InterfaceID: 0xd8b04e0e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC2767&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC165&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Gets number votes required for achieving consensus&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Should cost less than 30000 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Required&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; number of votes for achieving consensus&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; quorumVotes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the Governance ERC20 token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;erc-20-governance-token&quot;&gt;&lt;code&gt;ERC-20&lt;&#x2F;code&gt; Governance Token&lt;&#x2F;h3&gt;
&lt;p&gt;An &lt;code&gt;ERC-2767&lt;&#x2F;code&gt; Governance Contract should reference an address through &lt;code&gt;token()&lt;&#x2F;code&gt; that implements &lt;code&gt;ERC-20&lt;&#x2F;code&gt; interface. &lt;code&gt;token()&lt;&#x2F;code&gt; is allowed to return self address (&lt;code&gt;address(this)&lt;&#x2F;code&gt;), if &lt;code&gt;ERC-20&lt;&#x2F;code&gt; functionalities are implemented in the same contract (one can consider checking out Diamond Standard &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-2535&quot;&gt;&lt;code&gt;ERC-2535&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; to optimise contract size).&lt;&#x2F;p&gt;
&lt;p&gt;Implementations are allowed to have varying &lt;code&gt;ERC-20&lt;&#x2F;code&gt;&#x27;s &lt;code&gt;totalSupply()&lt;&#x2F;code&gt; (through any standard of minting or burning). But having a fixed &lt;code&gt;quorumVotes()&lt;&#x2F;code&gt; return value in this case would cause required votes consensus in &lt;code&gt;%&lt;&#x2F;code&gt; with respect to &lt;code&gt;totalSupply()&lt;&#x2F;code&gt; to change. To automatically account for this, any custom logic under &lt;code&gt;quorumVotes()&lt;&#x2F;code&gt; is allowed to return for e.g. &lt;code&gt;51%&lt;&#x2F;code&gt; of &lt;code&gt;totalSupply()&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;erc-165-interface-identification&quot;&gt;&lt;code&gt;ERC-165&lt;&#x2F;code&gt; Interface Identification&lt;&#x2F;h3&gt;
&lt;p&gt;An &lt;code&gt;ERC-2767&lt;&#x2F;code&gt; Governance Contract should also implement &lt;code&gt;ERC-165&lt;&#x2F;code&gt;. This helps general tools to identify whether a contract is a &lt;code&gt;ERC-2767&lt;&#x2F;code&gt; Governance contract.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC165&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Query if a contract implements an interface&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; interfaceID&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The interface identifier, as specified in ERC-165&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Interface identification is specified in ERC-165. This function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  uses less than 30,000 gas.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `true` if the contract implements `interfaceID` and&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  `interfaceID` is not 0xffffffff, `false` otherwise&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The goals of this EIP have been the following:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Standardize API of Governance contracts to make it easy for analysis tools to be built.&lt;&#x2F;li&gt;
&lt;li&gt;Encourage use of &lt;code&gt;ERC-20&lt;&#x2F;code&gt; based weighted governance over existing multi-sig (&lt;em&gt;generally limited to 50 max owners&lt;&#x2F;em&gt;) for big projects.&lt;&#x2F;li&gt;
&lt;li&gt;Encourage existing &lt;code&gt;ERC-173&lt;&#x2F;code&gt; ownership smart contracts &#x2F; projects to move to Governance based ownership by removing the effort needed to host custom UI for their project.&lt;&#x2F;li&gt;
&lt;li&gt;Encourage availability of publicly audited governance contracts, just like &lt;code&gt;ERC-20&lt;&#x2F;code&gt; which anyone can use.&lt;&#x2F;li&gt;
&lt;li&gt;Make it possible to utilize existing &lt;code&gt;ERC-20&lt;&#x2F;code&gt; tools for owners of governance token analysis.&lt;&#x2F;li&gt;
&lt;li&gt;Make future protocols possible that need to interact with governances of multiple projects.&lt;&#x2F;li&gt;
&lt;li&gt;Keep this EIP minimal and allow another EIPs to standardize any specific functionalities.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Smart contracts that are &lt;code&gt;ERC-173&lt;&#x2F;code&gt; compliant can transfer their ownership to a Governance contract. This enables such contracts to become compatible with &lt;code&gt;ERC-2767&lt;&#x2F;code&gt; Governance.&lt;&#x2F;p&gt;
&lt;p&gt;However, there are some existing projects with governance implementations and most of them have custom APIs (&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;compound-finance&#x2F;compound-protocol&#x2F;blob&#x2F;master&#x2F;contracts&#x2F;Governance&#x2F;GovernorAlpha.sol#L27&quot;&gt;Compound Governance&lt;&#x2F;a&gt;, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;Uniswap&#x2F;governance&#x2F;blob&#x2F;master&#x2F;contracts&#x2F;GovernorAlpha.sol#L27&quot;&gt;Uniswap Governance&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;sushiswap&#x2F;sushiswap&#x2F;blob&#x2F;master&#x2F;contracts&#x2F;GovernorAlpha.sol#L45&quot;&gt;Sushiswap Governance&lt;&#x2F;a&gt;), since a standard did not exist. Not having an &lt;code&gt;ERC-2767&lt;&#x2F;code&gt; compatible governance contract means only that general tools might not be able to populate their governance information without including some special code for the project.&lt;&#x2F;p&gt;
&lt;p&gt;For existing governance contracts to get compatible with &lt;code&gt;ERC-2767&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Projects can deploy a new governance contract and transfer ownership to it to be &lt;code&gt;ERC-2767&lt;&#x2F;code&gt; compatible. This is suitable for those who use Multi-sig wallets for Governance.&lt;&#x2F;li&gt;
&lt;li&gt;It is understood that redeploying governance contracts would be a troublesome task, and contracts who already have functionality similar to &lt;code&gt;ERC-20&lt;&#x2F;code&gt; based (weighted votes) have a bit advanced way to avoid it. Basically, they can create a forwarder contract implements &lt;code&gt;ERC-2767&lt;&#x2F;code&gt; and forwards all calls to the actual non-standard methods. Projects can list the forwarder contract to display the information project&#x27;s governance info without requiring any custom code in analysys tool, but this might have certain limitations depending on the project&#x27;s existing governance implementation. Specification of forwarder contract is out of scope for this EIP and it may be addressed in another EIP if required.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;!-- ## Test Cases --&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The reference implementations are available in this &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;zemse&#x2F;contract-ownership-governance&quot;&gt;repository&lt;&#x2F;a&gt;. Publicly audited implementations will be included in future.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Implementers are free to choose between On-chain and Off-chain consensus. Exact specification is out of scope for this standard (open for other EIPs to standardize). However, this section mentions points that implementers can consider.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;on-chain&quot;&gt;On-chain&lt;&#x2F;h4&gt;
&lt;p&gt;In such implementations, community can create transaction proposals and vote on it by sending on-chain transactions.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;OpenZeppelin Snapshots can be used to prevent double voting.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;off-chain&quot;&gt;Off-chain&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;The signatures in off-chain governance implementation can follow recommendations of &lt;code&gt;ERC-191&lt;&#x2F;code&gt; or &lt;code&gt;ERC-712&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;To prevent replaying signatures, it&#x27;d be best if executer is required to sort the signatures based on increasing addresses.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Meta-Transactions Forwarder Contract</title>
        <published>2020-07-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Alex Forshtat</name><uri>https://github.com/forshtat</uri>
	</author>
	
	<author>
		<name>Dror Tirosh</name><uri>https://github.com/drortirosh</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2770/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-2770-meta-transactions-forwarder-contract/5391" />
        

        <id>https://wg-eips.ritovision.com/2770/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2770"
            label="ERC-2770" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2770/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Standardized contract interface for extensible meta-transaction forwarding.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal defines an external API of an extensible Forwarder whose responsibility is to validate transaction
signatures on-chain and expose the signer to the destination contract, that is expected to accommodate all use-cases.
The ERC-712 structure of the forwarding request can be extended allowing wallets to display readable data even
for types not known during the Forwarder contract deployment.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;There is a growing interest in making it possible for Ethereum contracts to
accept calls from externally owned accounts that do not have ETH to pay for
gas.&lt;&#x2F;p&gt;
&lt;p&gt;This can be accomplished with meta-transactions, which are transactions that have been signed as plain data by one
externally owned account first and then wrapped into an Ethereum transaction by a different account.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;msg.sender&lt;&#x2F;code&gt; is a transaction parameter that can be inspected by a contract to
determine who signed the transaction. The integrity of this parameter is
guaranteed by the Ethereum EVM, but for a meta-transaction verifying
&lt;code&gt;msg.sender&lt;&#x2F;code&gt; is insufficient, and signer address must be recovered as well.&lt;&#x2F;p&gt;
&lt;p&gt;The Forwarder contract described here allows multiple Gas Relays and Relay Recipient contracts to rely
on a single instance of the signature verifying code, improving reliability and security
of any participating meta-transaction framework, as well as avoiding on-chain code duplication.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The Forwarder contract operates by accepting a signed typed data together with it&#x27;s ERC-712 signature,
performing signature verification of incoming data, appending the signer address to the data field and
performing a call to the target.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;forwarder-data-type-registration&quot;&gt;Forwarder data type registration&lt;&#x2F;h3&gt;
&lt;p&gt;Request struct MUST contain the following fields in this exact order:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;struct ForwardRequest {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   address from;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   address to;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   uint256 value;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   uint256 gas;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   uint256 nonce;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   bytes data;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   uint256 validUntil;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;from&lt;&#x2F;code&gt; - an externally-owned account making the request&lt;br &#x2F;&gt;
&lt;code&gt;to&lt;&#x2F;code&gt; - a destination address, normally a smart-contract&lt;br &#x2F;&gt;
&lt;code&gt;value&lt;&#x2F;code&gt; - an amount of Ether to transfer to the destination&lt;br &#x2F;&gt;
&lt;code&gt;gas&lt;&#x2F;code&gt; - an amount of gas limit to set for the execution&lt;br &#x2F;&gt;
&lt;code&gt;nonce&lt;&#x2F;code&gt; - an on-chain tracked nonce of a transaction&lt;br &#x2F;&gt;
&lt;code&gt;data&lt;&#x2F;code&gt; - the data to be sent to the destination&lt;br &#x2F;&gt;
&lt;code&gt;validUntil&lt;&#x2F;code&gt; - the highest block number the request can be forwarded in, or 0 if request validity is not time-limited&lt;&#x2F;p&gt;
&lt;p&gt;The request struct MAY include any other fields, including nested structs, if necessary.
In order for the Forwarder to be able to enforce the names of the fields of this struct, only registered types are allowed.&lt;&#x2F;p&gt;
&lt;p&gt;Registration MUST be performed in advance by a call to the following method:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function registerRequestType(string typeName, string typeSuffix)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;typeName&lt;&#x2F;code&gt; - a name of a type being registered&lt;br &#x2F;&gt;
&lt;code&gt;typeSuffix&lt;&#x2F;code&gt; - an ERC-712 compatible description of a type&lt;&#x2F;p&gt;
&lt;p&gt;For example, after calling&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;registerRequestType(&amp;quot;ExtendedRequest&amp;quot;, &amp;quot;uint256 x,bytes z,ExtraData extraData)ExtraData(uint256 a,uint256 b,uint256 c)&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;the following ERC-712 type will be registered with forwarder:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;* primary type *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;struct ExtendedRequest {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   address from;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   address to;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   uint256 value;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   uint256 gas;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   uint256 nonce;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   bytes data;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   uint256 validUntil;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   uint256 x;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   bytes z;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   ExtraData extraData;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;* subtype *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;struct ExtraData {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   uint256 a;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   uint256 b;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   uint256 c;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;signature-verification&quot;&gt;Signature verification&lt;&#x2F;h3&gt;
&lt;p&gt;The following method performs an ERC-712 signature check on a request:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function verify(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   ForwardRequest forwardRequest,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   bytes32 domainSeparator,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   bytes32 requestTypeHash,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   bytes suffixData,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   bytes signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;) view;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;forwardRequest&lt;&#x2F;code&gt; - an instance of the &lt;code&gt;ForwardRequest&lt;&#x2F;code&gt; struct&lt;br &#x2F;&gt;
&lt;code&gt;domainSeparator&lt;&#x2F;code&gt; - caller-provided domain separator to prevent signature reuse across dapps (refer to ERC-712)
&lt;code&gt;requestTypeHash&lt;&#x2F;code&gt; - hash of the registered relay request type
&lt;code&gt;suffixData&lt;&#x2F;code&gt; - RLP-encoding of the remainder of the request struct
&lt;code&gt;signature&lt;&#x2F;code&gt; - an ERC-712 signature on the concatenation of &lt;code&gt;forwardRequest&lt;&#x2F;code&gt; and &lt;code&gt;suffixData&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;command-execution&quot;&gt;Command execution&lt;&#x2F;h3&gt;
&lt;p&gt;In order for the Forwarder to perform an operation, the following method is to be called:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function execute(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   ForwardRequest forwardRequest,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   bytes32 domainSeparator,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   bytes32 requestTypeHash,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   bytes suffixData,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   bytes signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;public&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;payable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;returns (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   bool success,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   bytes memory ret&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Performs the ‘verify’ internally and if it succeeds performs the following call:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;bytes memory data = abi.encodePacked(forwardRequest.data, forwardRequest.from);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(success, ret) = forwardRequest.to.call{gas: forwardRequest.gas, value: forwardRequest.value}(data);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Regardless of whether the inner call succeeds or reverts, the nonce is incremented, invalidating the signature and preventing a replay of the request.&lt;&#x2F;p&gt;
&lt;p&gt;Note that &lt;code&gt;gas&lt;&#x2F;code&gt; parameter behaves according to EVM rules, specifically EIP-150. The forwarder validates internally that
there is enough gas for the inner call. In case the &lt;code&gt;forwardRequest&lt;&#x2F;code&gt; specifies non-zero value, extra &lt;code&gt;40000 gas&lt;&#x2F;code&gt; is
reserved in case inner call reverts or there is a remaining Ether so there is a need to transfer value from the &lt;code&gt;Forwarder&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt; gasForTransfer &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt; req&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;value &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt; )&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   gasForTransfer &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 40000&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; buffer in case we need to move Ether after the transaction.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;gasleft&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;63&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;64&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; req&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt; gasForTransfer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;FWD: insufficient gas&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In case there is not enough &lt;code&gt;value&lt;&#x2F;code&gt; in the Forwarder the execution of the inner call fails.&lt;br &#x2F;&gt;
Be aware that if the inner call ends up transferring Ether to the &lt;code&gt;Forwarder&lt;&#x2F;code&gt; in a call that did not originally have &lt;code&gt;value&lt;&#x2F;code&gt;, this
Ether will remain inside &lt;code&gt;Forwarder&lt;&#x2F;code&gt; after the transaction is complete.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;erc-712-and-suffixdata-parameter&quot;&gt;ERC-712 and &#x27;suffixData&#x27; parameter&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;suffixData&lt;&#x2F;code&gt; field must provide a valid &#x27;tail&#x27; of an ERC-712 typed data.
For instance, in order to sign on the &lt;code&gt;ExtendedRequest&lt;&#x2F;code&gt; struct, the data will be a concatenation of the following chunks:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;forwardRequest&lt;&#x2F;code&gt; fields will be RLP-encoded as-is, and variable-length &lt;code&gt;data&lt;&#x2F;code&gt; field will be hashed&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;uint256 x&lt;&#x2F;code&gt; will be appended entirely as-is&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;bytes z&lt;&#x2F;code&gt; will be hashed first&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ExtraData extraData&lt;&#x2F;code&gt; will be hashed as a typed data&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;So a valid &lt;code&gt;suffixData&lt;&#x2F;code&gt; is calculated as following:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function calculateSuffixData(ExtendedRequest request) internal pure returns (bytes) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return abi.encode(request.x, keccak256(request.z), hashExtraData(request.extraData));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function hashExtraData(ExtraData extraData) internal pure returns (bytes32) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return keccak256(abi.encode(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            keccak256(&amp;quot;ExtraData(uint256 a,uint256 b,uint256 c)&amp;quot;),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            extraData.a,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            extraData.b,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            extraData.c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;accepting-forwarded-calls&quot;&gt;Accepting Forwarded calls&lt;&#x2F;h3&gt;
&lt;p&gt;In order to support calls performed via the Forwarder, the Recipient contract must read the signer address from the
last 20 bytes of &lt;code&gt;msg.data&lt;&#x2F;code&gt;, as described in ERC-2771.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Further relying on &lt;code&gt;msg.sender&lt;&#x2F;code&gt; to authenticate end users by their externally-owned accounts is taking the Ethereum dapp ecosystem to a dead end.&lt;&#x2F;p&gt;
&lt;p&gt;A need for users to own Ether before they can interact with any contract has made a huge portion of use-cases for smart contracts non-viable,
which in turn limits the mass adoption and enforces this vicious cycle.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;validUntil&lt;&#x2F;code&gt; field uses a block number instead of timestamp in order to allow for better precision and integration
with other common block-based timers.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;All contracts introducing support for the Forwarded requests thereby authorize this contract to perform any operation under any account.
It is critical that this contract has no vulnerabilities or centralization issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Secure Protocol for Native Meta Transactions</title>
        <published>2020-07-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Ronan Sandford</name><uri>https://github.com/wighawag</uri>
	</author>
	
	<author>
		<name>Liraz Siri</name><uri>https://github.com/lirazsiri</uri>
	</author>
	
	<author>
		<name>Dror Tirosh</name><uri>https://github.com/drortirosh</uri>
	</author>
	
	<author>
		<name>Yoav Weiss</name><uri>https://github.com/yoavw</uri>
	</author>
	
	<author>
		<name>Alex Forshtat</name><uri>https://github.com/forshtat</uri>
	</author>
	
	<author>
		<name>Hadrien Croubois</name><uri>https://github.com/Amxx</uri>
	</author>
	
	<author>
		<name>Sachin Tomar</name><uri>https://github.com/tomarsachin2271</uri>
	</author>
	
	<author>
		<name>Patrick McCorry</name><uri>https://github.com/stonecoldpat</uri>
	</author>
	
	<author>
		<name>Nicolas Venturo</name><uri>https://github.com/nventuro</uri>
	</author>
	
	<author>
		<name>Fabian Vogelsteller</name><uri>https://github.com/frozeman</uri>
	</author>
	
	<author>
		<name>Gavin John</name><uri>https://github.com/Pandapip1</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2771/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-2771-secure-protocol-for-native-meta-transactions/4488" />
        

        <id>https://wg-eips.ritovision.com/2771/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:2771"
            label="ERC-2771" />
        

        
        

        
        <summary type="html">A contract interface for receiving meta transactions through a trusted forwarder</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2771/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP defines a contract-level protocol for &lt;code&gt;Recipient&lt;&#x2F;code&gt; contracts to accept meta-transactions through trusted &lt;code&gt;Forwarder&lt;&#x2F;code&gt; contracts. No protocol changes are made. &lt;code&gt;Recipient&lt;&#x2F;code&gt; contracts are sent the effective &lt;code&gt;msg.sender&lt;&#x2F;code&gt; (referred to as &lt;code&gt;_msgSender()&lt;&#x2F;code&gt;) and &lt;code&gt;msg.data&lt;&#x2F;code&gt; (referred to as &lt;code&gt;_msgData()&lt;&#x2F;code&gt;) by appending additional calldata.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;There is a growing interest in making it possible for Ethereum contracts to accept calls from externally owned accounts that do not have ETH to pay for gas. Solutions that allow for third parties to pay for gas costs are called meta transactions. For the purposes of this EIP, meta transactions are transactions that have been authorized by a &lt;strong&gt;Transaction Signer&lt;&#x2F;strong&gt; and relayed by an untrusted third party that pays for the gas (the &lt;strong&gt;Gas Relay&lt;&#x2F;strong&gt;).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;Transaction Signer&lt;&#x2F;strong&gt;: Signs &amp;amp; sends transactions to a Gas Relay&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Gas Relay&lt;&#x2F;strong&gt;: Receives signed requests off-chain from Transaction Signers and pays gas to turn it into a valid transaction that goes through a Trusted Forwarder&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Trusted Forwarder&lt;&#x2F;strong&gt;: A contract trusted by the &lt;code&gt;Recipient&lt;&#x2F;code&gt; to correctly verify signatures and nonces before forwarding the request from Transaction Signers&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Recipient&lt;&#x2F;strong&gt;: A contract that accepts meta-transactions through a Trusted Forwarder&lt;&#x2F;p&gt;
&lt;h3 id=&quot;example-flow&quot;&gt;Example Flow&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2771&#x2F;.&#x2F;assets&#x2F;example-flow.png&quot; alt=&quot;Example flow&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;extracting-the-transaction-signer-address&quot;&gt;Extracting The Transaction Signer address&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;strong&gt;Trusted Forwarder&lt;&#x2F;strong&gt; is responsible for calling the &lt;strong&gt;Recipient&lt;&#x2F;strong&gt; contract and MUST append the address of the &lt;strong&gt;Transaction Signer&lt;&#x2F;strong&gt; (20 bytes of data) to the end of the call data.&lt;&#x2F;p&gt;
&lt;p&gt;For example :&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt; success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; returnData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;call&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;value&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; from&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;strong&gt;Recipient&lt;&#x2F;strong&gt; contract can then extract the &lt;strong&gt;Transaction Signer&lt;&#x2F;strong&gt; address by performing 3 operations:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Check that the &lt;strong&gt;Forwarder&lt;&#x2F;strong&gt; is trusted. How this is implemented is out of the scope of this proposal.&lt;&#x2F;li&gt;
&lt;li&gt;Extract the &lt;strong&gt;Transaction Signer&lt;&#x2F;strong&gt; address from the last 20 bytes of the call data and use that as the original &lt;code&gt;sender&lt;&#x2F;code&gt; of the transaction (instead of &lt;code&gt;msg.sender&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;If the &lt;code&gt;msg.sender&lt;&#x2F;code&gt; is not a trusted forwarder (or if the &lt;code&gt;msg.data&lt;&#x2F;code&gt; is shorter than 20 bytes), then return the original &lt;code&gt;msg.sender&lt;&#x2F;code&gt; as it is.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The &lt;strong&gt;Recipient&lt;&#x2F;strong&gt; MUST check that it trusts the Forwarder to prevent it from
extracting address data appended from an untrusted contract. This could result
in a forged address.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;protocol-support-discovery-mechanism&quot;&gt;Protocol Support Discovery Mechanism&lt;&#x2F;h3&gt;
&lt;p&gt;Unless a &lt;strong&gt;Recipient&lt;&#x2F;strong&gt; contract is being used by a particular frontend that knows that this contract has support for native meta transactions, it would not be possible to offer the user the choice of using meta-transaction to interact with the contract. We thus need a mechanism by which the &lt;strong&gt;Recipient&lt;&#x2F;strong&gt; can let the world know that it supports meta transactions.&lt;&#x2F;p&gt;
&lt;p&gt;This is especially important for meta transactions to be supported at the Web3 wallet level. Such wallets may not necessarily know anything about the &lt;strong&gt;Recipient&lt;&#x2F;strong&gt; contract users may wish to interact with.&lt;&#x2F;p&gt;
&lt;p&gt;As a &lt;strong&gt;Recipient&lt;&#x2F;strong&gt; could trust forwarders with different interfaces and capabilities (e.g., transaction batching, different message signing formats), we need to allow wallets to discover which Forwarder is trusted.&lt;&#x2F;p&gt;
&lt;p&gt;To provide this discovery mechanism a &lt;strong&gt;Recipient&lt;&#x2F;strong&gt; contract MUST implement this function:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isTrustedForwarder&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; forwarder&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;isTrustedForwarder&lt;&#x2F;code&gt; MUST return &lt;code&gt;true&lt;&#x2F;code&gt; if the forwarder is trusted by the Recipient, otherwise it MUST return &lt;code&gt;false&lt;&#x2F;code&gt;. &lt;code&gt;isTrustedForwarder&lt;&#x2F;code&gt; MUST NOT revert.&lt;&#x2F;p&gt;
&lt;p&gt;Internally, the &lt;strong&gt;Recipient&lt;&#x2F;strong&gt; MUST then accept a request from forwarder.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;isTrustedForwarder&lt;&#x2F;code&gt; function MAY be called on-chain, and as such gas restrictions MUST be put in place. It SHOULD NOT consume more than 50,000 gas&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Make it easy for contract developers to add support for meta
transactions by standardizing the simplest viable contract interface.&lt;&#x2F;li&gt;
&lt;li&gt;Without support for meta transactions in the recipient contract, an externally owned
account can not use meta transactions to interact with the recipient contract.&lt;&#x2F;li&gt;
&lt;li&gt;Without a standard contract interface, there is no standard way for a client
to discover whether a recipient supports meta transactions.&lt;&#x2F;li&gt;
&lt;li&gt;Without a standard contract interface, there is no standard way to send a
meta transaction to a recipient.&lt;&#x2F;li&gt;
&lt;li&gt;Without the ability to leverage a trusted forwarder every recipient contract
has to internally implement the logic required to accept meta transactions securely.&lt;&#x2F;li&gt;
&lt;li&gt;Without a discovery protocol, there is no mechanism for a client to discover
whether a recipient supports a specific forwarder.&lt;&#x2F;li&gt;
&lt;li&gt;Making the contract interface agnostic to the internal implementation
details of the trusted forwarder, makes it possible for a recipient contract
to support multiple forwarders with no change to code.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;msg.sender&lt;&#x2F;code&gt; is a transaction parameter that can be inspected by a contract to determine who signed the transaction. The integrity of this parameter is guaranteed by the Ethereum EVM, but for a meta transaction securing &lt;code&gt;msg.sender&lt;&#x2F;code&gt; is insufficient.
&lt;ul&gt;
&lt;li&gt;The problem is that for a contract that is not natively aware of meta transactions, the &lt;code&gt;msg.sender&lt;&#x2F;code&gt; of the transaction will make it appear to be coming from the &lt;strong&gt;Gas Relay&lt;&#x2F;strong&gt; and not the &lt;strong&gt;Transaction Signer&lt;&#x2F;strong&gt;. A secure protocol for a contract to accept meta transactions needs to prevent the &lt;strong&gt;Gas Relay&lt;&#x2F;strong&gt; from forging, modifying or duplicating requests by the &lt;strong&gt;Transaction Signer&lt;&#x2F;strong&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;recipient-example&quot;&gt;Recipient Example&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RecipientExample&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; purchaseItem&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; itemId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; sender &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _msgSender&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ... perform the purchase for sender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; immutable&lt;&#x2F;span&gt;&lt;span&gt; _trustedForwarder&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; trustedForwarder&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _trustedForwarder &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; trustedForwarder&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isTrustedForwarder&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; forwarder&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; forwarder &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; _trustedForwarder&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _msgSender&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        signer &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;20&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isTrustedForwarder&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                signer &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; shr&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;96&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;calldataload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;sub&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;calldatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;A malicious forwarder may forge the value of &lt;code&gt;_msgSender()&lt;&#x2F;code&gt; and effectively send transactions from any address. Therefore, &lt;code&gt;Recipient&lt;&#x2F;code&gt; contracts must be very careful in trusting forwarders. If a forwarder is upgradeable, then one must also trust that the contract won&#x27;t perform a malicious upgrade.&lt;&#x2F;p&gt;
&lt;p&gt;In addition, modifying which forwarders are trusted must be restricted, since an attacker could &quot;trust&quot; their own address to forward transactions, and therefore be able to forge transactions. It is recommended to have the list of trusted forwarders be immutable, and if this is not feasible, then only trusted contract owners should be able to modify it.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Rules Engine Standard</title>
        <published>2020-06-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Aaron Kendall</name><uri>https://github.com/jaerith</uri>
	</author>
	
	<author>
		<name>Juan Blanco</name><uri>https://github.com/juanfranblanco</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2746/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2746-rules-engine-interface/4435" />
        

        <id>https://wg-eips.ritovision.com/2746/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:2746"
            label="ERC-2746" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2746/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;An interface for using a smart contract as a rules engine.  A single deployed contract can register a data domain, create sets of rules that perform actions on that domain, and then invoke a set as an atomic transaction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard proposes an interface that will allow the creation of hierarchal sets of rules (i.e., RuleTrees) that can be invoked to evaluate and manipulate a registered data domain.  At the time of this draft, all intentions to insert additional functionality onto the blockchain requires the coding and creation of a newly deployed contract.  However, this standard will allow users to deploy a contract just once, one which will then allow them to create (and invoke) pipelines of commands within that contract.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;At the time of this draft, all development for Ethereum requires writing the code that forms smart contracts and then deploying those contracts to Ethereum.  In order to create a proper contract, many considerations must be taken into account when designing and implementing the code, especially in terms of efficiency (i.e., gas cost) and security.  Even the simplest contracts require a certain amount of vigilance and examination, before and after deployment. These requirements pertain to all cases, even for simple cases of examining a value and&#x2F;or altering it.&lt;&#x2F;p&gt;
&lt;p&gt;These technical challenges might form an obstacle for many others who might wish to create software around Ethereum.  Less technical companies and users might also want to configure and deploy simple functionality onto the chain, without knowing the relevant languages or details necessary.  By having the data domain and the predefined actions (i.e., types of rules) implemented along with this interface, a deployed instance of such a rules engine contract can provide efficient and safe functionality to no-code or little-code clients, allowing more users of various technical proficiency to interact with the Ethereum ecosystem.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;For the clarification of terminology, an Attribute is a registered data point within the data domain, representing data that exists either in the rules engine contract or elsewhere.  A Rule is an predefined action that occurs upon a single data point (i.e., Attribute) in the predefined data domain.  For example, a Rule could check whether the Attribute &#x27;TokenAmt&#x27; has a value less than the RHL (i.e., right-hand value) of 10.   A RuleSet is a collection of Rules, where their collection invocation creates a boolean result that determines the navigational flow of execution between RuleSets.  A RuleTree is a collection of RuleSets that are organized within a hierarchy, where RuleSets can contain other RuleSets.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.6.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-2746 Rules Engine Standard&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-2746&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERCRulesEngine&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Should emit when a RuleTree is invoked.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        The `ruler` is the ID and owner of the RuleTree being invoked.  It is also likely msg.sender.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CallRuleTree&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ruler&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Should emit when a RuleSet is invoked.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        The `ruler` is the ID and owner of the RuleTree in which the RuleSet is stored.  It is also likely msg.sender.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        The &amp;#39;ruleSetId&amp;#39; is the ID of the RuleSet being invoked.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CallRuleSet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ruler&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tmpRuleSetId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Should emit when a Rule is invoked.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        The `ruler` is the ID and owner of the RuleTree in which the RuleSet is stored.  It is also likely msg.sender.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        The &amp;#39;ruleSetId&amp;#39; is the ID of the RuleSet being invoked.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        The &amp;#39;ruleId&amp;#39; is the ID of the Rule being invoked.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        The &amp;#39;ruleType&amp;#39; is the type of the rule being invoked.        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CallRule&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ruler&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ruleSetId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ruleId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ruleType&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Should emit when a RuleSet fails.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        The `ruler` is the ID and owner of the RuleTree in which the RuleSet is stored.  It is also likely msg.sender.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        The &amp;#39;ruleSetId&amp;#39; is the ID of the RuleSet being invoked.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        The &amp;#39;severeFailure&amp;#39; is the indicator of whether or not the RuleSet is a leaf with a &amp;#39;severe&amp;#39; error flag.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RuleSetError&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ruler&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ruleSetId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; severeFailure&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Adds a new Attribute to the data domain.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Caller should be the deployer&#x2F;owner of the rules engine contract.  An Attribute value can be an optional alternative if it&amp;#39;s not a string or numeric.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _attrName&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    Name&#x2F;ID of the Attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _maxLen&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      Maximum length of the Attribute (if it is a string)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _maxNumVal&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   Maximum numeric value of the Attribute (if it is numeric)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _defaultVal&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  The default value for the Attribute (if one is not found from the source)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _isString&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    Indicator of whether or not the Attribute is a string&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _isNumeric&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   Indicator of whether or not the Attribute is numeric&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addAttribute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _attrName&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _maxLen&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _maxNumVal&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _defaultVal&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _isString&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _isNumeric&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Adds a new RuleTree.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;          Owner&#x2F;ID of the RuleTree&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _ruleTreeName&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   Name of the RuleTree&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _desc&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;           Verbose description of the RuleTree&amp;#39;s purpose&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addRuleTree&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _ruleTreeName&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _desc&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Adds a new RuleSet onto the hierarchy of a RuleTree.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; RuleSets can have child RuleSets, but they will only be called if the parent&amp;#39;s Rules execute to create boolean &amp;#39;true&amp;#39;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;           Owner&#x2F;ID of the RuleTree&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _ruleSetName&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     ID&#x2F;Name of the RuleSet&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _desc&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;            Verbose description of the RuleSet&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _parentRSName&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    ID&#x2F;Name of the parent RuleSet, to which this will be added as a child&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _severalFailFlag&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Indicator of whether or not the RuleSet&amp;#39;s execution (as failure) will result in a failure of the RuleTree.  (This flag only applies to leaves in the RuleTree.)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _useAndOp&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;        Indicator of whether or not the rules in the RuleSet will execute with &amp;#39;AND&amp;#39; between them.  (Otherwise, it will be &amp;#39;OR&amp;#39;.)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _failQuickFlag&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   Indicator of whether or not the RuleSet&amp;#39;s execution (as failure) should immediately stop the RuleTree.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addRuleSet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _ruleSetName&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _desc&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _parentRSName&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _severalFailFlag&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _useAndOp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _failQuickFlag&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Adds a new Rule into a RuleSet.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Rule types can be implemented as any type of action (greater than, less than, etc.)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;           Owner&#x2F;ID of the RuleTree&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _ruleSetName&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     ID&#x2F;Name of the RuleSet to which the Rule will be added&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _ruleName&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;        ID&#x2F;Name of the Rule being added&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _attrName&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;        ID&#x2F;Name of the Attribute upon which the Rule is invoked&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _ruleType&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;        ID of the type of Rule&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _rightHandValue&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  The registered value to be used by the Rule when performing its action upon the Attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _notFlag&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         Indicator of whether or not the NOT operator should be performed on this Rule.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addRule&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _ruleSetName&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _ruleName&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _attrName&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _ruleType&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _rightHandValue&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _notFlag&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Executes a RuleTree.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;           Owner&#x2F;ID of the RuleTree&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; executeRuleTree&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieves the properties of a Rule.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;           Owner&#x2F;ID of the RuleTree&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _ruleSetName&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     ID&#x2F;Name of the RuleSet where the Rule resides&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _ruleIdx&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         Index of the rule in the RuleSet&amp;#39;s listing &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         ID&#x2F;Name of Rule&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;            Type of Rule&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         Target Attribute of Rule&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;          Value mentioned in Rule&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;            Flag for NOT operator in Rule&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;[]       Values that should be provided in delegated call (if Rule is custom operator)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getRuleProps&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _ruleSetName&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _ruleIdx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieves the properties of a RuleSet&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;        Owner&#x2F;ID of the RuleTree&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _ruleSetName&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  ID&#x2F;Name of the RuleSet&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;       Verbose description of the RuleSet&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         Flag that indicates whether this RuleSet&amp;#39;s failure (if a leaf) will cause the RuleTree to fail&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         Flag that indicates whether this RuleSet uses the AND operator when executing rules collectively&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         Indicates the number of rules hosted by this RuleSet&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;[]    The list of RuleSets that are children of this RuleSet&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getRuleSetProps&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _ruleSetName&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieves the properties of a RuleSet&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;        Owner&#x2F;ID of the RuleTree&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      Name of the RuleTree&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;       Verbose description of the RuleTree&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      ID&#x2F;Name of the RuleSet that serves as the root node for the RuleTree&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getRuleTreeProps&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Removes a RuleTree.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;           Owner&#x2F;ID of the RuleTree&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; removeRuleTree&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;considerations&quot;&gt;Considerations&lt;&#x2F;h3&gt;
&lt;p&gt;An argument could be made for interface functions that allow a RuleTree&#x27;s owner to include others users as executors of the RuleTree.&lt;&#x2F;p&gt;
&lt;p&gt;Another argument could be made for interface functions that allow an administrator to configure the origin point of an Attribute, such as whether the Attribute&#x27;s value comes from a data structure (internal to the rules engine contract) or from calling a contract method (like an implementation of the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;2535&quot;&gt;Diamond Standard&lt;&#x2F;a&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;Yet another argument could be made for interface functions that allow an administrator to extend the functionality catalog provided by the rules engine, by allowing other contracts&#x27; methods to be added as a rule operation.&lt;&#x2F;p&gt;
&lt;p&gt;Also, an argument could be made for functions that calculate and report the range of potential cost for invoking a RuleTree.  Unlike the normal execution of a contract method, the Ethereum transaction costs of invoking a RuleTree are more dynamic, depending on its depth&#x2F;breadth and the navigational flow during invocation.  Since the general cost of a RuleTree is unknown until the time of invocation, these functions could report the minimal amount of gas for a transaction (i.e., none of the Rules in a RuleTree are invoked) and the maximum amount for a transaction (i.e., all Rules in a RuleTree are invoked).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;example&quot;&gt;Example&lt;&#x2F;h3&gt;
&lt;p&gt;A company wishes to deploy a contract with data points and functionality that are predefined and&#x2F;or under the control of an administrator, and it aims to build a no-code client that will allow less-technical users to define actions within the rules engine contract.  In this example, the company wants one of its users to write the rules in a proprietary markup language, in order for the calculation of a VAT to be determined.  For the sake of transparency, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ipfs.infura.io&#x2F;ipfs&#x2F;QmPrZ9959c7SzzqdLkVgX28xM7ZrqLeT3ydvRAHCaL1Hsn&quot;&gt;these rules&lt;&#x2F;a&gt; are published onto IPFS, so that they are accessible to auditors and possibly government officials.  The no-code client will then know how to parse the rules from the markup and communicate with the rules engine contract, establishing the RuleTree to be invoked later by the company&#x27;s user(s) or off-chain programs.&lt;&#x2F;p&gt;
&lt;p&gt;In order to calculate the value of the VAT, these provided rules invoke simple mathematical operations that can perform the calculation.  However, the implementation of the rules engine contract could possess other functionality called by rules, ones that could execute more complicated logic or call the methods of other contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;attributes&quot;&gt;Attributes&lt;&#x2F;h3&gt;
&lt;p&gt;The data points are abstracted in order to let the implementation provide the mechanism for retrieving&#x2F;populating the data.  Data can be held by an internal data structure, another contract&#x27;s method, or any number of other options.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;events&quot;&gt;Events&lt;&#x2F;h3&gt;
&lt;p&gt;The events specified will help the caller of the RuleTree after execution, so that they may ascertain the navigational flow of RuleSet execution within the RuleTree and so that they may understand which RuleSets failed.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;right-hand-value&quot;&gt;Right-Hand Value&lt;&#x2F;h3&gt;
&lt;p&gt;In the function addRule(), the data type for the right-hand value is &#x27;string&#x27; since the rule&#x27;s action depends on its type, meaning that the value must be provided in a generic form.  In the case of a Rule that performs numerical operations, the provided value could be transformed into a number when stored in the Rule.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;Nethereum&#x2F;Wonka&#x2F;tree&#x2F;master&#x2F;Solidity&#x2F;WonkaEngine&quot;&gt;Wonka&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;jaerith&#x2F;WonkaRulesBlazorEditor&quot;&gt;Wonka Rules Editor&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The Wonka implementation supports this proposed interface and also implements all of the additional considerations mentioned above.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The deployer of the contract should be the owner and administrator, allowing for the addition of Attributes and RuleTrees.  Since a RuleTree is owned by a particular EOA (or contract address), the only accounts that should be able to execute the RuleTree should be its owner or the contract&#x27;s owner&#x2F;administrator.  If Attributes are defined to exist as data within other contracts, the implementation must take into account the possibility that RuleTree owners must have the security to access the data in those contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;Standards&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2535&#x2F;&quot;&gt;EIP-2535 Diamond Standard&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Transaction Package</title>
        <published>2020-06-16T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Matt Garnett</name><uri>https://github.com/lightclient</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2733/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-transaction-package/4365" />
        

        <id>https://wg-eips.ritovision.com/2733/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:2733"
            label="EIP-2733" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2733/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Creates a new transaction type which executes a package of one or more
transactions, while passing status information to subsequent transactions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce a new transaction type which includes a list of transactions that
must be executed serially by clients. Execution information (e.g. success,
gas_used, etc.) will be propagated forward to the next transaction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Onboarding new users to Ethereum has been notoriously difficult due to the need
for new users to acquire enough ether to pay for their transactions. This
hurdle has seen a significant allocation of resources over the years to solve.
Today, that solution is meta-transactions. This is, unfortunately, a brittle
solution that requires signatures to be recovered within a smart contract to
authenticate the message. This EIP aims to provide a flexible framework for
relayers to &quot;sponsor&quot; many transactions at once, trustlessly.&lt;&#x2F;p&gt;
&lt;p&gt;Meta-transactions often use relay contracts to maintain nonces and allow users
to pay for gas using alternative assets. They have historically been designed
to catch reversions in their inner transactions by only passing a portion of
the available gas to the subcall. This allows them to be certain the outer call
will have enough gas to complete any required account, like processing a gas
payment. This type of subcall has been considered bad practice for a long time,
but in the case of where you don&#x27;t trust the subcalls, it is the only available
solution.&lt;&#x2F;p&gt;
&lt;p&gt;Transaction packages are an alternative that allow multiple transactions to be
bundled into one package and executed atomically, similarly to how relay
contracts operate. Transactions are able to pass their result to subsequent
transactions. This allows for conditional workflows based on the outcome of
previous transactions. Although this functionality is already possible as
described above, workflows using transaction packages are more robust, because
they are protected from future changes to the gas schedule.&lt;&#x2F;p&gt;
&lt;p&gt;An important byproduct of this EIP is that it also facilitates bundling
transactions for single users.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce a new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; transaction type where &lt;code&gt;id = 2&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;structure&quot;&gt;Structure&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;struct TransactionPackage {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    chain_id: u256,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    children: [ChildPackage],&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    nonce: u64,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_price: u256,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    v: u256,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    r: u256,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    s: u256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;hash&quot;&gt;Hash&lt;&#x2F;h5&gt;
&lt;p&gt;&lt;code&gt;keccak256(rlp([2, chain_id, children, nonce, gas_price, v, r, s])&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h5 id=&quot;signature-hash&quot;&gt;Signature Hash&lt;&#x2F;h5&gt;
&lt;p&gt;&lt;code&gt;keccak256(rlp([2, chain_id, children, nonce, gas_price])&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h5 id=&quot;receipt&quot;&gt;Receipt&lt;&#x2F;h5&gt;
&lt;p&gt;Each &lt;code&gt;ChildTransaction&lt;&#x2F;code&gt; transaction will generate a &lt;code&gt;ChildReceipt&lt;&#x2F;code&gt; after execution. Each
of these receipts will be aggregated into a &lt;code&gt;Receipt&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;type Receipt = [ChildReceipt]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;struct ChildReceipt {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    status: u256,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    cumulative_gas_used: u256,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    logs_bloom: [u8; 256],&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    logs: [u8]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;child-transaction&quot;&gt;Child Transaction&lt;&#x2F;h4&gt;
&lt;p&gt;Let &lt;code&gt;ChildPackage&lt;&#x2F;code&gt; be interpreted as follows.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;struct ChildPackage {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    type: u8,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    nonce: u64,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    transactions: [ChildTransaction],&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_gas_price: u256,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    v: u256,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    r: u256,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    s: u256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;struct ChildTransaction {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    flags: u8,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    to: Address,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    value: u256,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    data: [u8],&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    extra: [u8],&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_limit: u256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;types&quot;&gt;Types&lt;&#x2F;h5&gt;
&lt;p&gt;The &lt;code&gt;type&lt;&#x2F;code&gt; field is used to denote whether the &lt;code&gt;Child&lt;&#x2F;code&gt; signer wishes to
delegate the &lt;code&gt;max_gas_price&lt;&#x2F;code&gt; and &lt;code&gt;gas_limit&lt;&#x2F;code&gt; choice to the &lt;code&gt;TransactionPackage&lt;&#x2F;code&gt;
signer.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;type&lt;&#x2F;th&gt;&lt;th&gt;signature hash&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x00&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;keccak256(rlp([0, nonce, transactions, max_gas_price])&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x01&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;keccak256(rlp([1, nonce, transactions_without_gas_limit])&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;validity&quot;&gt;Validity&lt;&#x2F;h3&gt;
&lt;p&gt;A &lt;code&gt;TransactionPackage&lt;&#x2F;code&gt; can be deemed valid or invalid as follows.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;rust&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;fn&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; is_valid&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;config&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Config&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; state&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;State&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransactionPackage&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        config&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;chain_id&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;chain_id &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;children&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        state&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;nonce&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; cum_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;children&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;map&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;sum&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; state&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;balance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; cum_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_price &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; intrinsic_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; child&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;children &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;            child&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;nonce &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; state&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;nonce&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;child&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;            child&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; state&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;balance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;child&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;            child&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_gas_price&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_price&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; child&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;txs &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;                tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;flags &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;                tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;extra&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;                tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; intrinsic_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;results&quot;&gt;Results&lt;&#x2F;h3&gt;
&lt;p&gt;Subsequent &lt;code&gt;ChildTransaction&lt;&#x2F;code&gt;s will be able to receive the result of the
previous &lt;code&gt;ChildTransaction&lt;&#x2F;code&gt; via &lt;code&gt;RETURNDATACOPY (0x3E)&lt;&#x2F;code&gt; in first frame of
execution, before making any subcalls. Each element, except the last, will be
&lt;code&gt;0&lt;&#x2F;code&gt;-padded left to 32 bytes.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;struct Result {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; Status of the previous transaction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    success: bool,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; Total gas used by the previous transaction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_used: u256,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; Cumulative gas used by previous transactions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    cum_gas_used: u256,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; The size of the return value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return_size: u256,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; The return value of the previous transaction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return_value: [u8]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;intrinsic-cost&quot;&gt;Intrinsic Cost&lt;&#x2F;h3&gt;
&lt;p&gt;Let the intrinsic cost of the transaction package be defined as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;fn intrinsic_gas(tx: TransactionPackage) u256 {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    let data_gas = tx.children.map(|c| c.txs.map(|t| data_cost(&amp;amp;c.data)).sum()).sum();&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    17000 + 8000 * tx.children.len() + data_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;execution&quot;&gt;Execution&lt;&#x2F;h3&gt;
&lt;p&gt;Transaction packages should be executed as follows:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Deduct the cumulative cost from the outer signer&#x27;s balance.&lt;&#x2F;li&gt;
&lt;li&gt;Load the first child package, and execute the first child transaction.&lt;&#x2F;li&gt;
&lt;li&gt;Record all state changes, logs, the receipt, and refund any unused gas.&lt;&#x2F;li&gt;
&lt;li&gt;If there are no more child transactions, goto &lt;code&gt;8&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Compute &lt;code&gt;Result&lt;&#x2F;code&gt; for the previously executed transaction.&lt;&#x2F;li&gt;
&lt;li&gt;Prepare &lt;code&gt;Result&lt;&#x2F;code&gt; to be available via return opcodes in the next
transaction&#x27;s first frame.&lt;&#x2F;li&gt;
&lt;li&gt;Execute the next transaction, then goto &lt;code&gt;3&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Load the next child package, then goto &lt;code&gt;7&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;each-child-has-its-own-signature&quot;&gt;Each &lt;code&gt;Child&lt;&#x2F;code&gt; has its own signature&lt;&#x2F;h3&gt;
&lt;p&gt;For simplicity, the author has chosen to require each child package to specify
its own signature, even if the signer is the same as the package signer. This
choice is made to allow for maximum flexibility, with minimal client changes.
This transaction can still be used by a single user at the cost of only one
additional signature recovery.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;childpackage-specifies-max-gas-price-instead-of-gas-price&quot;&gt;&lt;code&gt;ChildPackage&lt;&#x2F;code&gt; specifies &lt;code&gt;max_gas_price&lt;&#x2F;code&gt; instead of &lt;code&gt;gas_price&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Allowing child packages to specify a range of acceptable gas prices is
strictly more versatile than a static price. It gives relayers more flexibility
in terms of building transaction bundles, and it makes it possible for relayers
to try and achieve the best price for the transaction sender. With a fixed
price, the relayer may require the user to sign multiple different
transactions, with varying prices. This can be avoided by specifying a max
price, and communicating out-of-band how the urgency of the transaction (e.g.
the relayer should package it with the max price immediately vs. slowly
increasing the gas price).
A future transaction type can be specified with only a single
signature, if such an optimization is desired.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;childpackage-is-also-typed&quot;&gt;&lt;code&gt;ChildPackage&lt;&#x2F;code&gt; is also typed&lt;&#x2F;h3&gt;
&lt;p&gt;The type element serves a modest role in the transaction type, denoting whether
the transaction signer wishes to delegate control of the gas price and gas
limit to the outer signer. This is a useful UX improvement when interacting
with a trusted relayer, as once the user decides to make a transaction the
relayer can ensure it is included on chain by choosing the best gas price and
limit.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;the-flags-and-extra-fields-aren-t-used&quot;&gt;The &lt;code&gt;flags&lt;&#x2F;code&gt; and &lt;code&gt;extra&lt;&#x2F;code&gt; fields aren&#x27;t used&lt;&#x2F;h3&gt;
&lt;p&gt;These fields are included to better support future changes to the transaction
type. This would likely be used in conjunction with the &lt;code&gt;flags&lt;&#x2F;code&gt; and &lt;code&gt;type&lt;&#x2F;code&gt;
fields. A benefit of explicitly defining them is that specialized serialization
of RLP can be avoided, simplifying clients and downstream infrastructure. The
author believe the cost of 2 bytes per transaction is acceptable for smoother
integration of future features.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Contracts which rely on &lt;code&gt;ORIGIN (0x32) == CALLER (0x33) &amp;amp;&amp;amp; RETURNDATASIZE (0x3D) == 0x00&lt;&#x2F;code&gt; will now always fail in transaction packages, unless they are
the first executed transaction. It’s unknown if any contracts conduct this
check.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;managing-packages-efficiently-in-the-mempool&quot;&gt;Managing packages efficiently in the mempool&lt;&#x2F;h3&gt;
&lt;p&gt;The introduction of a new transaction type brings along new concerns regarding
the mempool. Done naively, it could turn into a DDoS vector for clients. This
EIP has been written to reduce as much validation complexity as possible.&lt;&#x2F;p&gt;
&lt;p&gt;An existing invariant in the mempool that is desirable for new transactions to
maintain, is that transactions can be validated in constant time. This is also
possible for packaged transactions. There is an inherent 10Mb limit for RLPx
frames, so that would be the upper bound on transactions that could be included
in a package. On the other hand, clients can also just configure their own
bound locally (e.g. packages must be less than 1Mb). Validity can then be
determined by using the function above.&lt;&#x2F;p&gt;
&lt;p&gt;Once a package has been validated, it must continuously be monitored for nonce
invalidations within its package. One potential way to achieve this efficiently
is to modify the mempool to operate on thin pointers to the underlying
transaction. This will allow packages to ingest as many &quot;single&quot; transactions,
simplifying the facilities for monitoring changes. These &quot;parts&quot; of the package
can maintain a pointer to a structure with pointers to all the parts of the
package. This way, as soon as one part becomes invalid, it can request the
parent to invalidate all outstanding parts of the package.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Typed Transaction Envelope</title>
        <published>2020-06-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Micah Zoltu</name><uri>https://github.com/MicahZoltu</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2718/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2718-typed-transaction-envelope/4355" />
        

        <id>https://wg-eips.ritovision.com/2718/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:2718"
            label="EIP-2718" />
        

        
        

        
        <summary type="html">Defines a new transaction type that is an envelope for future transaction types.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2718/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;TransactionType || TransactionPayload&lt;&#x2F;code&gt; is a valid transaction and &lt;code&gt;TransactionType || ReceiptPayload&lt;&#x2F;code&gt; is a valid transaction receipt where &lt;code&gt;TransactionType&lt;&#x2F;code&gt; identifies the format of the transaction and &lt;code&gt;*Payload&lt;&#x2F;code&gt; is the transaction&#x2F;receipt contents, which are defined in future EIPs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;In the past, when we have wanted to add new transaction types we have had to ensure they were backward compatible with all other transactions, meaning that you could differentiate them based only on the encoded payload, and it was not possible to have a transaction that matched both types.
This was seen in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt; where the new value was bit-packed into one of the encoded fields.
There are multiple proposals in discussion that define new transaction types such as one that allows EOA accounts to execute code directly within their context, one that enables someone besides &lt;code&gt;msg.sender&lt;&#x2F;code&gt; to pay for gas, and proposals related to layer 1 multi-sig transactions.
These all need to be defined in a way that is mutually compatible, which quickly becomes burdensome to EIP authors and to clients who now have to follow complex rules for differentiating transaction type.&lt;&#x2F;p&gt;
&lt;p&gt;By introducing an envelope transaction type, we only need to ensure backward compatibility with existing transactions and from then on we just need to solve the much simpler problem of ensuring there is no numbering conflict between &lt;code&gt;TransactionType&lt;&#x2F;code&gt;s.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;||&lt;&#x2F;code&gt; is the byte&#x2F;byte-array concatenation operator.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;transactions&quot;&gt;Transactions&lt;&#x2F;h3&gt;
&lt;p&gt;As of &lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt;, the transaction root in the block header &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be the root hash of &lt;code&gt;patriciaTrie(rlp(Index) =&amp;gt; Transaction)&lt;&#x2F;code&gt; where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Index&lt;&#x2F;code&gt; is the index in the block of this transaction&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Transaction&lt;&#x2F;code&gt; is either &lt;code&gt;TransactionType || TransactionPayload&lt;&#x2F;code&gt; or &lt;code&gt;LegacyTransaction&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TransactionType&lt;&#x2F;code&gt; is a positive unsigned 8-bit number between &lt;code&gt;0&lt;&#x2F;code&gt; and &lt;code&gt;0x7f&lt;&#x2F;code&gt; that represents the type of the transaction&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TransactionPayload&lt;&#x2F;code&gt; is an opaque byte array whose interpretation is dependent on the &lt;code&gt;TransactionType&lt;&#x2F;code&gt; and defined in future EIPs&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;LegacyTransaction&lt;&#x2F;code&gt; is &lt;code&gt;rlp([nonce, gasPrice, gasLimit, to, value, data, v, r, s])&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;All signatures for future transaction types &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; include the &lt;code&gt;TransactionType&lt;&#x2F;code&gt; as the first byte of the signed data.
This makes it so we do not have to worry about signatures for one transaction type being used as signatures for a different transaction type.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;receipts&quot;&gt;Receipts&lt;&#x2F;h3&gt;
&lt;p&gt;As of &lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt;, the receipt root in the block header &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be the root hash of &lt;code&gt;patriciaTrie(rlp(Index) =&amp;gt; Receipt)&lt;&#x2F;code&gt; where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Index&lt;&#x2F;code&gt; is the index in the block of the transaction this receipt is for&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Receipt&lt;&#x2F;code&gt; is either &lt;code&gt;TransactionType || ReceiptPayload&lt;&#x2F;code&gt; or &lt;code&gt;LegacyReceipt&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TransactionType&lt;&#x2F;code&gt; is a positive unsigned 8-bit number between &lt;code&gt;0&lt;&#x2F;code&gt; and &lt;code&gt;0x7f&lt;&#x2F;code&gt; that represents the type of the transaction&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ReceiptPayload&lt;&#x2F;code&gt; is an opaque byte array whose interpretation is dependent on the &lt;code&gt;TransactionType&lt;&#x2F;code&gt; and defined in future EIPs&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;LegacyReceipt&lt;&#x2F;code&gt; is &lt;code&gt;rlp([status, cumulativeGasUsed, logsBloom, logs])&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;code&gt;TransactionType&lt;&#x2F;code&gt; of the receipt &lt;strong&gt;MUST&lt;&#x2F;strong&gt; match the &lt;code&gt;TransactionType&lt;&#x2F;code&gt; of the transaction with a matching &lt;code&gt;Index&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;transactiontype-only-goes-up-to-0x7f&quot;&gt;TransactionType only goes up to 0x7f&lt;&#x2F;h3&gt;
&lt;p&gt;For the forseable future, 0x7f is plenty and it leaves open a number of options for extending the range such as using the high bit as a continuation bit.
This also prevents us from colliding with legacy transaction types, which always start with a byte &lt;code&gt;&amp;gt;= 0xc0&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;should-instead-of-must-for-the-transactiontype-being-first-byte-of-signed-data&quot;&gt;&lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; instead of &lt;strong&gt;MUST&lt;&#x2F;strong&gt; for the TransactionType being first byte of signed data&lt;&#x2F;h3&gt;
&lt;p&gt;While it is strongly recommended that all future transactions sign the first byte to ensure that there is no problem with signature reuse, the authors acknowledge that this may not always make sense or be possible.
One example where this isn&#x27;t possible is wrapped legacy transactions that are signature compatible with the legacy signing scheme.
Another potential situation is one where transactions don&#x27;t have a signature in the traditional sense and instead have some other mechanism for determining validity.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;transactiontype-selection-algorithm&quot;&gt;TransactionType selection algorithm&lt;&#x2F;h3&gt;
&lt;p&gt;There was discussion about defining the &lt;code&gt;TransactionType&lt;&#x2F;code&gt; identifier assignment&#x2F;selection algorithm in this standard.
While it would be nice to have a standardized mechanism for assignment, at the time of writing of this standard there is not a strong need for it so it was deemed out of scope.
A future EIP may introduce a standard for TransactionType identifier assignment if it is deemed necessary.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;opaque-byte-array-rather-than-an-rlp-array&quot;&gt;Opaque byte array rather than an RLP array&lt;&#x2F;h3&gt;
&lt;p&gt;By having the second byte on be opaque bytes, rather than an RLP (or other encoding) list, we can support different encoding formats for the transaction payload in the future such as SSZ, LEB128, or a fixed width format.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;origin-and-caller&quot;&gt;ORIGIN and CALLER&lt;&#x2F;h3&gt;
&lt;p&gt;There was discussion about having ORIGIN and CALLER opcodes become dependent on the transaction type, so that each transaction type could define what those opcodes returned.
However, there is a desire to make transaction type opaque to the contracts to discourage contracts treating different types of transactions differently.
There also were concerns over backward compatibility with existing contracts which make assumptions about ORIGIN and CALLER opcodes.
Going forward, we will assume that all transaction types will have an address that reasonably represents a &lt;code&gt;CALLER&lt;&#x2F;code&gt; of the first EVM frame and &lt;code&gt;ORIGIN&lt;&#x2F;code&gt; will be the same address in all cases.
If a transaction type needs to supply additional information to contracts, they will need a new opcode.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Clients can differentiate between the legacy transactions and typed transactions by looking at the first byte.
If it starts with a value in the range &lt;code&gt;[0, 0x7f]&lt;&#x2F;code&gt; then it is a new transaction type, if it starts with a value in the range &lt;code&gt;[0xc0, 0xfe]&lt;&#x2F;code&gt; then it is a legacy transaction type.
&lt;code&gt;0xff&lt;&#x2F;code&gt; is not realistic for an RLP encoded transaction, so it is reserved for future use as an extension sentinel value.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;When designing a new 2718 transaction type, it is &lt;strong&gt;STRONGLY&lt;&#x2F;strong&gt; recommended to include the transaction type as the first byte of the signed payload.  If you fail to do this, it is possible that your transaction may be signature compatible with transactions of another type which can introduce security vulnerabilities for users.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Sponsored, expiring and batch transactions.</title>
        <published>2020-06-11T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Micah Zoltu</name><uri>https://github.com/MicahZoltu</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2711/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2711-separate-gas-payer-from-msg-sender/4353" />
        

        <id>https://wg-eips.ritovision.com/2711/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        

        
        <category
            term="tag:eip:2711"
            label="EIP-2711" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2711/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Creates a new transaction type that supports sponsored transactions (separate gas payer from sender), batch transactions (multiple transactions executed in sequence), and expiring transactions (transactions which are not valid after a certain timestamp).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;An EIP-2718 transaction with the type number &lt;code&gt;2&lt;&#x2F;code&gt; is a new type of transaction that includes support for:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Sponsored Transactions&lt;&#x2F;strong&gt;: an optional additional signature from which the account that will pay for gas (&lt;code&gt;GAS_PAYER&lt;&#x2F;code&gt;) can be recovered&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Batch Transactions&lt;&#x2F;strong&gt;: multiple transactions from the same sender that will be executed in sequence&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Expiring Transactions&lt;&#x2F;strong&gt;: an optional &lt;code&gt;validUntil&lt;&#x2F;code&gt; field that makes the transaction invalid after a certain point in time&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;sponsored-transactions&quot;&gt;Sponsored Transactions&lt;&#x2F;h3&gt;
&lt;p&gt;With the advent of tokens and especially stable coins, it has become common for users to not hold ETH in an account while they may have other assets of value in that account.  Some users don&#x27;t want to be exposed to the perceived volatility of ETH and instead would prefer to transact using other assets.  Unfortunately, since gas &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be paid for with ETH, this prevents the user from transacting with their assets without first acquiring some ETH using some other means, and then using that ETH to pay fees.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP proposes a mechanism by which we can allow people to transact without ever having to own any ETH by allowing someone else to cover gas costs.  The arrangements that enable the covering of gas costs is out of scope for this EIP but it could be an extra-protocol monthly subscription, payment could occur as part of the transaction being submitted, the recipient may be willing to cover gas costs, or it could be a free service offered as a value-add by a company that you are working with.&lt;&#x2F;p&gt;
&lt;p&gt;While it is possible to implement these sort of mechanisms at the individual contract layer, such solutions require integration by just about every contract and those solutions also end up depending on gas costs being stable with time in order to appropriately bake them into contracts without putting either party at risk of malicious participants in the system.  For this reason, it is believed that separating out &lt;code&gt;GAS_PAYER&lt;&#x2F;code&gt; from &lt;code&gt;msg.sender&lt;&#x2F;code&gt; at the protocol layer is valuable.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;batch-transactions&quot;&gt;Batch Transactions&lt;&#x2F;h3&gt;
&lt;p&gt;Often times an EOA may want to execute a series of transactions with a strong guarantee that they happen in order with nothing occurring between them.  For example, one may want to send some tokens to a contract and then follow that up with another transaction that makes a contract call on the destination address that causes those tokens to be registered to them.  By supporting transaction batching at layer 1, we can ensure that the user can get strong guarantees at signing time of cross-transaction atomicity.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;expiring-transactions&quot;&gt;Expiring Transactions&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;If any form of dust-account clearing is introduced, e.g. (https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;168), it will be necessary to introduce a replay protection, such as https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;169 . Having temporal replay protection removes the need to change nonce-behaviour in the state, since transactions would not be replayable at a later date than explicitly set by the user.&lt;&#x2F;li&gt;
&lt;li&gt;In many cases, such as during ICOs, a lot of people want their transactions to either become included soon (within a couple of hours) or not at all. Currently, transactions are queued and may not execute for several days, at a cost for both the user (who ends up paying gas for a failing purchase) and the network, dealing with the large transaction queues.&lt;&#x2F;li&gt;
&lt;li&gt;Node implementations have no commonly agreed metric for which transactions to keep, discard or propagate. Having a TTL on transactions would make it easier to remove stale transactions from the system.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;TransactionType&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; 2.  See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;TransactionSubtype&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; is either 1, 2, 3, or 4.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;ChainId&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; The transaction is valid if this value is &lt;code&gt;0&lt;&#x2F;code&gt; or it is included in a block on a chain whose ID is equal to this value.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;ValidUntil&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; The transaction is valid if this value is &lt;code&gt;0&lt;&#x2F;code&gt; or it is included in a block whose &lt;code&gt;timestamp&lt;&#x2F;code&gt; is less than or equal to this value.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;YParity&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; The parity (0 for even, 1 for odd) of the y-value of a secp256k1 signature.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;ChildTransaction&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; A nested transaction consisting of &lt;code&gt;[to, value, data]&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;SenderPayload&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; Defined based on the &lt;code&gt;TransactionSubtype&lt;&#x2F;code&gt; as follows:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;[1, ChildTransaction[], nonce, ChainId, ValidUntil, gasLimit, gasPrice]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;[2, ChildTransaction[], nonce, ChainId, ValidUntil, gasLimit, gasPrice]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;[3, ChildTransaction[], nonce, ChainId, ValidUntil, gasLimit]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;[4, ChildTransaction[], nonce, ChainId, ValidUntil]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;SenderSignature&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; &lt;code&gt;[YParity, r, s]&lt;&#x2F;code&gt; of &lt;code&gt;secp256k1(keccak256(rlp([TransactionType, SenderPayload])))&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;GasPayerPayload&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; Defined based on the &lt;code&gt;TransactionSubtype&lt;&#x2F;code&gt; as follows:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;[]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;[]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;[gasPrice]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;[gasLimit, gasPrice]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;GasPayerSignature&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; is &lt;code&gt;[]&lt;&#x2F;code&gt; for &lt;code&gt;TransactionSubType&lt;&#x2F;code&gt; &lt;code&gt;1&lt;&#x2F;code&gt; or &lt;code&gt;[YParity, r, s]&lt;&#x2F;code&gt; of &lt;code&gt;secp256k1(keccak256(rlp([SenderPayload, SenderSignature, GasPayerPayload])))&lt;&#x2F;code&gt; for others.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;new-transaction-type&quot;&gt;New Transaction Type&lt;&#x2F;h3&gt;
&lt;p&gt;As of &lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt; an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; transaction with a &lt;code&gt;TransactionType&lt;&#x2F;code&gt; of &lt;code&gt;2&lt;&#x2F;code&gt; will have its &lt;code&gt;Payload&lt;&#x2F;code&gt; interpreted as an RLP encoded tuple of:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[...SenderPayload, ...SenderSignature, ...GasPayerPayload, ...GasPayerSignature]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The address recovered from &lt;code&gt;SenderSignature&lt;&#x2F;code&gt; is the address...&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;...returned by the &lt;code&gt;CALLER&lt;&#x2F;code&gt; opcode (0x33, aka &lt;code&gt;msg.sender&lt;&#x2F;code&gt;) during the first call frame of the transaction&lt;&#x2F;li&gt;
&lt;li&gt;...returned by the &lt;code&gt;ORIGIN&lt;&#x2F;code&gt; opcode (0x32, aka &lt;code&gt;tx.origin&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;...whose &lt;code&gt;nonce&lt;&#x2F;code&gt; is used&lt;&#x2F;li&gt;
&lt;li&gt;...whose ETH balance is deducted if any value is attached to the transaction&lt;&#x2F;li&gt;
&lt;li&gt;...whose ETH balance is deducted to pay for gas if &lt;code&gt;GasPayerSignature&lt;&#x2F;code&gt; is not present&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;If &lt;code&gt;GasPayerSignature&lt;&#x2F;code&gt; is present, then the address recovered from it is the address...&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;...whose ETH balance is deducted to pay for gas&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The base gas cost of transactions of this type will be &lt;code&gt;TRANSACTION_TYPE_2_BASE_GAS_PRICE&lt;&#x2F;code&gt; + &lt;code&gt;TRANSACTION_TYPE_2_CHILD_GAS_PRICE&lt;&#x2F;code&gt; * &lt;code&gt;n&lt;&#x2F;code&gt;, rather than the cost associated with transactions of type &lt;code&gt;0&lt;&#x2F;code&gt; and legacy transactions.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;new-transaction-receipt&quot;&gt;New Transaction Receipt&lt;&#x2F;h3&gt;
&lt;p&gt;As of &lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt; an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; transaction receipt with a &lt;code&gt;TransactionType&lt;&#x2F;code&gt; of &lt;code&gt;2&lt;&#x2F;code&gt; will have its &lt;code&gt;Payload&lt;&#x2F;code&gt; interpreted as a &lt;code&gt;rlp([status, cumulativeGasUsed, logsBloom, logs][])&lt;&#x2F;code&gt; where each item of the array corresponds to the child-transaction at matching offset in the transaction type 2 &lt;code&gt;Payload&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;one-monolithic-eip&quot;&gt;One Monolithic EIP&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP could be split up into multiple EIPs, one for each of the subtypes and one for the meta-type.  Alternatively, each of the subtypes could be a unique TransactionType.  The reason we chose to go with a single EIP with subtypes is because these 4 transactions all have a &lt;em&gt;lot&lt;&#x2F;em&gt; in common and each separate EIP would be almost identical to the previous.  We felt that in this case, splitting into multiple EIPs wasn&#x27;t worth the duplication of EIP content.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;chainid-not-encoded-with-v&quot;&gt;ChainID not encoded with &lt;code&gt;v&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;While we could save one byte in the common case by bundling the y-parity bit of the signature with the Chain ID like in EIP-155, this adds complexity to signing tools that the authors deem not worth it given the size of the transaction overall.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;optionality-of-chainid&quot;&gt;Optionality of ChainID&lt;&#x2F;h3&gt;
&lt;p&gt;Sometimes it is useful to have a transaction that &lt;em&gt;can&lt;&#x2F;em&gt; be replayed on multiple chains.  An example of this is when you construct a vanity signature for a transaction and have the &lt;code&gt;from&lt;&#x2F;code&gt; be whatever address that signature recovers to.  With the ability to have someone else be a gas payer (setting both the gas limit and the gas price), one can have transactions that deploy contracts which live at the same address on every chain.  While this can be accomplished with CREATE2 using legacy transactions, we have the opportunity here to simplify the process and enable potentially other future uses of deterministic transactions by making ChainID optional.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;optionality-of-validuntil&quot;&gt;Optionality of ValidUntil&lt;&#x2F;h3&gt;
&lt;p&gt;A user can set &lt;code&gt;ValidUntil&lt;&#x2F;code&gt; to a very large number which effectively makes it non-expiring.  By making &lt;code&gt;ValidUntil&lt;&#x2F;code&gt; optional, we can save some bytes on the wire by allowing such transactions to simply have a &lt;code&gt;0&lt;&#x2F;code&gt; (1 byte in RLP) value for this field.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;sender-sets-gaslimit-and-gasprice&quot;&gt;&lt;code&gt;SENDER&lt;&#x2F;code&gt; sets &lt;code&gt;gasLimit&lt;&#x2F;code&gt; and &lt;code&gt;gasPrice&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;This type of transaction is useful when the transaction may execute differently depending on what these values are set to.  By having the &lt;code&gt;SENDER&lt;&#x2F;code&gt; set both, we ensure that the &lt;code&gt;SENDER&lt;&#x2F;code&gt; has full control over the transaction details.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;sender-sets-gaslimit-gas-payer-sets-gasprice&quot;&gt;&lt;code&gt;SENDER&lt;&#x2F;code&gt; sets &lt;code&gt;gasLimit&lt;&#x2F;code&gt;, &lt;code&gt;GAS_PAYER&lt;&#x2F;code&gt; sets &lt;code&gt;gasPrice&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;This type of transaction is useful when the transaction may execute differently depending on how much gas it is allowed (e.g., number of loops) but where the &lt;code&gt;SENDER&lt;&#x2F;code&gt; would like to give the &lt;code&gt;GAS_PAYER&lt;&#x2F;code&gt; the ability to price the transaction to maximize chances of inclusion.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-payer-sets-gaslimit-and-gasprice&quot;&gt;&lt;code&gt;GAS_PAYER&lt;&#x2F;code&gt; sets &lt;code&gt;gasLimit&lt;&#x2F;code&gt; and &lt;code&gt;gasPrice&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;This type of transaction allows the &lt;code&gt;SENDER&lt;&#x2F;code&gt; to define what they want to do, and leaves all worry about gas to the &lt;code&gt;GAS_PAYER&lt;&#x2F;code&gt;.  This is useful for transactions where the sender doesn&#x27;t care how much gas is used or the price that is paid and also either trusts the &lt;code&gt;GAS_PAYER&lt;&#x2F;code&gt; to be non-malicious or doesn&#x27;t care if the &lt;code&gt;SENDER&lt;&#x2F;code&gt;&#x27;s nonce is increased.  Such situations are useful when you have extra-protocol trust between the &lt;code&gt;SENDER&lt;&#x2F;code&gt; and &lt;code&gt;GAS_PAYER&lt;&#x2F;code&gt; and you want to separate concerns (what to do vs how to get included) for security or complexity reasons.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;nonces&quot;&gt;Nonces&lt;&#x2F;h3&gt;
&lt;p&gt;The inner transaction needs a nonce to protect themselves from replay attacks.  Since the inner transaction has a nonce, we get replay protection on the outer transaction as well, so it is not critical for security to have multiple parties provide a nonce.&lt;&#x2F;p&gt;
&lt;p&gt;We could have the &lt;code&gt;GAS_PAYER&lt;&#x2F;code&gt; provide a second nonce, but this would increase the payload size and require &lt;code&gt;GAS_PAYER&lt;&#x2F;code&gt; to do replace-by-fee (noisy for gossip) if they want to slip in a new (different inner) transaction with a higher gas price.  It would also create the possibility of a deadlock if the &lt;code&gt;SENDER&lt;&#x2F;code&gt; nonces aren&#x27;t ordered the same as the &lt;code&gt;GAS_PAYER&lt;&#x2F;code&gt; nonces, and if the &lt;code&gt;SENDER&lt;&#x2F;code&gt; nonce isn&#x27;t the lowest valid nonce for the &lt;code&gt;SENDER&lt;&#x2F;code&gt; then the &lt;code&gt;GAS_PAYER&lt;&#x2F;code&gt; can&#x27;t sign and submit yet.  Finally, client complexity increases slightly if a transaction has two nonces because you have to protect yourself from deadlocks and do more work to determine validity.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;validuntil&quot;&gt;ValidUntil&lt;&#x2F;h3&gt;
&lt;p&gt;For the dust-account clearing usecase,&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;This change is much less invasive in the consensus engine.
&lt;ul&gt;
&lt;li&gt;No need to maintain a consensus-field of &#x27;highest-known-nonce&#x27; or cap the number of transactions from a sender in a block.&lt;&#x2F;li&gt;
&lt;li&gt;Only touches the transaction validation part of the consensus engine&lt;&#x2F;li&gt;
&lt;li&gt;Other schemas which uses the &lt;code&gt;nonce&lt;&#x2F;code&gt; can have unintended side-effects,
&lt;ul&gt;
&lt;li&gt;such as inability to create contracts at certain addresses.&lt;&#x2F;li&gt;
&lt;li&gt;more difficult to integrate with offline signers, since more elaborate nonce-schemes requires state access to determine.&lt;&#x2F;li&gt;
&lt;li&gt;More intricate schemes like &lt;code&gt;highest-nonce&lt;&#x2F;code&gt; are a lot more difficult, since highest-known-nonce will be a consensus-struct that is incremented and possibly reverted during transaction execution, requiring one more journalled field.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;validuntil-as-timestamp-instead-of-block-number&quot;&gt;ValidUntil as timestamp instead of block number&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;The unix time is generally available in most settings, even on a computer which is offline. This means that even a setup where blockchain information is unavailable, the party signing a transaction can generate a transaction with the desired properties.&lt;&#x2F;li&gt;
&lt;li&gt;The correlation between time and block number is not fixed; even though a 13s blocktime is &#x27;desired&#x27;, this varies due to both network hashrate and difficulty bomb progression.&lt;&#x2F;li&gt;
&lt;li&gt;The block number is even more unreliable as a timestamp for testnets and private networks.&lt;&#x2F;li&gt;
&lt;li&gt;unix time is more user-friendly, a user can more easily decide on reasonable end-date for a transaction, rather than a suitable number of valid blocks.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No known issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>JavaScript Provider Event Emitter</title>
        <published>2020-06-05T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Micah Zoltu</name><uri>https://github.com/MicahZoltu</uri>
	</author>
	
	<author>
		<name>Erik Marks</name><uri>https://github.com/rekmarks</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2700/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/2701" />
        

        <id>https://wg-eips.ritovision.com/2700/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="interface"
                label="Interface" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:2700"
            label="EIP-2700" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2700/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;A standard mechanism for JavaScript Ethereum Providers to notify clients about chain state changes when both are able to interface with each other via a shared JavaScript object.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard provides the description of an object that is made available to JavaScript applications which they can use to receive notifications from an Ethereum Provider.  This standard only describes the notification mechanism, it does not specify the payloads that are valid nor does it specify how the client or the provider will discover or agree on payload content.&lt;&#x2F;p&gt;
&lt;p&gt;How&#x2F;where this Ethereum Provider object is exposed is left to future standards.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;When working within a JavaScript runtime (such as NodeJS, Electron, Browser, etc.) it may be possible for the runtime or a runtime plugin to inject objects into the runtime.  Someone authoring a runtime or a runtime plugin may choose to expose an Ethereum Provider to any JavaScript apps or scripts running within that runtime in order to provide notifications of blockchain state changes.  In order to achieve maximum compatibility between the provider and the client, a standard is necessary for what the shape of that object is.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;rfc-2119&quot;&gt;RFC-2119&lt;&#x2F;h3&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;,  &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.ietf.org&#x2F;rfc&#x2F;rfc2119.txt&quot;&gt;RFC-2119&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;interface&quot;&gt;Interface&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EthereumProvider&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;	on&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;eventName&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; listener&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;...&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; unknown&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; void&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; void&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;	removeListener&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;eventName&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; listener&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;...&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; unknown&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; void&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; void&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The specific events that can be listened to and the shape of their listener callback functions is left to be defined in separate standards.&lt;&#x2F;p&gt;
&lt;p&gt;If &lt;code&gt;on&lt;&#x2F;code&gt; is called with an &lt;code&gt;eventName&lt;&#x2F;code&gt; that the provider is familiar with then the provider &lt;strong&gt;MUST&lt;&#x2F;strong&gt; call the provided &lt;code&gt;listener&lt;&#x2F;code&gt; when the named event occurs.  If the same &lt;code&gt;listener&lt;&#x2F;code&gt; is added multiple times to the same event via &lt;code&gt;on&lt;&#x2F;code&gt;, the provider &lt;strong&gt;MAY&lt;&#x2F;strong&gt; choose to either callback the listener one time or one time per call to &lt;code&gt;on&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;If &lt;code&gt;removeListener&lt;&#x2F;code&gt; is called with an &lt;code&gt;eventName&lt;&#x2F;code&gt; and &lt;code&gt;listener&lt;&#x2F;code&gt; that was previously added via &lt;code&gt;on&lt;&#x2F;code&gt; then the provider &lt;strong&gt;MUST&lt;&#x2F;strong&gt; decrease the number of times it calls the &lt;code&gt;listener&lt;&#x2F;code&gt; per event by one.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is mostly a retrospective EIP meaning it codifies an already existing specification so there isn&#x27;t a lot of room for improving things such as by using a discriminated union object for listener parameters or having a tighter definition of &lt;code&gt;on&lt;&#x2F;code&gt;.  The specific events are intentionally left out of this specification as that set will be an ever-evolving collection and having the first few listed here doesn&#x27;t add value to this specification (especially if, over time, the first few end up deprecated or unused).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The relationship between Ethereum Provider and client is a trusted one, where it is assumed that the user implicitly trusts the Ethereum Provider which is how it managed to get injected into the client, or the client expressly pulled in a connection to it.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>JavaScript `request` method RPC transport</title>
        <published>2020-06-04T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Micah Zoltu</name><uri>https://github.com/MicahZoltu</uri>
	</author>
	
	<author>
		<name>Erik Marks</name><uri>https://github.com/rekmarks</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2696/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/2697" />
        

        <id>https://wg-eips.ritovision.com/2696/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="interface"
                label="Interface" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:2696"
            label="EIP-2696" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2696/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;A standard for remote procedure calls between an Ethereum Provider and an Ethereum Client when both are able to interface with each other via a shared JavaScript object.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard provides the description of an object that is made available to JavaScript applications which they can use to communicate with the Ethereum blockchain through.  This standard only describes the transport mechanism, it does not specify the payloads that are valid nor does it specify how the client or the provider will discover or agree on payload content.&lt;&#x2F;p&gt;
&lt;p&gt;How&#x2F;where this Ethereum object is exposed is left to future standards.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;When working within a JavaScript runtime (such as NodeJS, Electron, Browser, etc.) it may be possible for the runtime or a runtime plugin to inject objects into the runtime.  Someone authoring a runtime or a runtime plugin may choose to expose an Ethereum Provider to any JavaScript apps or scripts running within that runtime in order to provide indirect access to an Ethereum-like blockchain and potentially signing tools.  In order to achieve maximum compatibility between the provider and the client, a standard is necessary for what the shape of that object is.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;rfc-2119&quot;&gt;RFC-2119&lt;&#x2F;h3&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;,  &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.ietf.org&#x2F;rfc&#x2F;rfc2119.txt&quot;&gt;RFC-2119&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;interface&quot;&gt;Interface&lt;&#x2F;h3&gt;
&lt;p&gt;TypeScript interface definition:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RequestArguments&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;	readonly&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; method&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;	readonly&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; params&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; readonly&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; unknown&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; object&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EthereumProvider&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;	request&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;args&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RequestArguments&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Promise&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;unknown&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The Provider &lt;strong&gt;MUST&lt;&#x2F;strong&gt; implement a &lt;code&gt;request&lt;&#x2F;code&gt; method on the exposed &lt;code&gt;EthereumProvider&lt;&#x2F;code&gt; object.  The &lt;code&gt;request&lt;&#x2F;code&gt; method &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be callable with a single parameter which contains the arguments for the request as defined in the TypeScript &lt;code&gt;interface&lt;&#x2F;code&gt; above.&lt;&#x2F;p&gt;
&lt;p&gt;If the Provider supports a JSON-RPC (https:&#x2F;&#x2F;www.jsonrpc.org&#x2F;specification) request as specified elsewhere, then it &lt;strong&gt;MUST&lt;&#x2F;strong&gt; accept a &lt;code&gt;request&lt;&#x2F;code&gt; call for that JSON-RPC method with the &lt;code&gt;RequestArguments.method&lt;&#x2F;code&gt; argument matching the JSON-RPC &lt;code&gt;method&lt;&#x2F;code&gt; string for the RPC call and the &lt;code&gt;RequestArguments.params&lt;&#x2F;code&gt; matching the &lt;code&gt;params&lt;&#x2F;code&gt; object of the RPC call.  The &lt;code&gt;RequestArguments.params&lt;&#x2F;code&gt; should be encoded as a JavaScript object matching the specified JSON-RPC type, not encoded as a JSON string as would normally be the case when transporting JSON-RPC.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;example&quot;&gt;Example&lt;&#x2F;h4&gt;
&lt;p&gt;If the JSON-RPC request would contain a payload like:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{ &amp;quot;jsonrpc&amp;quot;: &amp;quot;2.0&amp;quot;, &amp;quot;id&amp;quot;: 1, &amp;quot;method&amp;quot;: &amp;quot;do_work&amp;quot;, &amp;quot;params&amp;quot;: [ 5, &amp;quot;hello&amp;quot; ] }&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Then the matching &lt;code&gt;EthereumProvider.request&lt;&#x2F;code&gt; call would be:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;declare&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; provider&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EthereumProvider&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;provider&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;request&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt; method&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;method&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; params&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 5&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;hello&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt; ]&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;results&quot;&gt;Results&lt;&#x2F;h3&gt;
&lt;p&gt;If the Provider supports a JSON-RPC request as specified elsewhere, then it &lt;strong&gt;MUST&lt;&#x2F;strong&gt; return an object that matches the expected &lt;code&gt;result&lt;&#x2F;code&gt; definition for the associated JSON-RPC request.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;example-1&quot;&gt;Example&lt;&#x2F;h4&gt;
&lt;p&gt;If the JSON-RPC response would contain a payload like:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{ &amp;quot;jsonrpc&amp;quot;: &amp;quot;2.0&amp;quot;, &amp;quot;id&amp;quot;: 1, &amp;quot;result&amp;quot;: { &amp;quot;color&amp;quot;: &amp;quot;red&amp;quot;, &amp;quot;value&amp;quot;: 5 } }&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Then the matching &lt;code&gt;EthereumProvider.request&lt;&#x2F;code&gt; response would be:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; color&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;red&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 5&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;errors&quot;&gt;Errors&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ProviderRpcError&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; extends&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; Error&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;	message&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;	code&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; number&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;	data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; unknown&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;code&lt;&#x2F;th&gt;&lt;th&gt;message&lt;&#x2F;th&gt;&lt;th&gt;meaning&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;4001&lt;&#x2F;td&gt;&lt;td&gt;User Rejected Request&lt;&#x2F;td&gt;&lt;td&gt;The user rejected the request.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;4100&lt;&#x2F;td&gt;&lt;td&gt;Unauthorized&lt;&#x2F;td&gt;&lt;td&gt;The requested method and&#x2F;or account has not been authorized by the user.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;4200&lt;&#x2F;td&gt;&lt;td&gt;Unsupported Method&lt;&#x2F;td&gt;&lt;td&gt;The Provider does not support the requested method.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;4900&lt;&#x2F;td&gt;&lt;td&gt;Disconnected&lt;&#x2F;td&gt;&lt;td&gt;The Provider is disconnected from all chains.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;4901&lt;&#x2F;td&gt;&lt;td&gt;Chain Disconnected&lt;&#x2F;td&gt;&lt;td&gt;The Provider is not connected to the requested chain.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;If the Provider is unable to fulfill a request for any reason, it &lt;strong&gt;MUST&lt;&#x2F;strong&gt; resolve the promise as an error.  The resolved error &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be shaped as a &lt;code&gt;ProviderRpcError&lt;&#x2F;code&gt; defined above whenever possible.  &lt;em&gt;While it is impossible to guaranteed that a JavaScript application will never throw an out of memory or stack overflow error, care should be taken to ensure that promise rejections conform to the above shape whenever possible.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;If a &lt;code&gt;code&lt;&#x2F;code&gt; is provided that is listed in the list above, or in the JSON-RPC specification (https:&#x2F;&#x2F;www.jsonrpc.org&#x2F;specification#error_object), or in the associated JSON-RPC request standard being followed, then the error reason &lt;strong&gt;MUST&lt;&#x2F;strong&gt; align with the established meaning of that code and the &lt;code&gt;message&lt;&#x2F;code&gt; &lt;strong&gt;MUST&lt;&#x2F;strong&gt; match the provided &lt;code&gt;message&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;data&lt;&#x2F;code&gt; field &lt;strong&gt;MAY&lt;&#x2F;strong&gt; contain any data that is relevant to the error or would help the user understand or troubleshoot the error.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;While this standard is perhaps not the greatest mechanism for communicating between an application and a blockchain, it is closely aligned with established practices within the community so migration from existing systems to this one should be relatively easy.  Most communication is currently done via JSON-RPC, so aligning with the JSON-RPC standard was desired to enable quick integration with existing systems.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The relationship between Ethereum Provider and client is a trusted one, where it is assumed that the user implicitly trusts the Ethereum Provider which is how it managed to get injected into the client, or the client expressly pulled in a connection to it.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Ethereum 2 wallet layout</title>
        <published>2020-05-29T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Jim McDonald</name><email>Jim@mcdee.net</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2680/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2680-ethereum-2-wallet-layout/4323" />
        

        <id>https://wg-eips.ritovision.com/2680/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2680"
            label="ERC-2680" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2680/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;A standard layout and naming format for walletstore and keystore for both hierarchical (e.g. filesystem, Amazon S3) and non-hierarchical (key&#x2F;value) storage systems.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Ethereum wallets have no standards for their layout in persistent storage, making different wallet implementations incompatible.  This defines a standard for the placement of Ethereum walletstores and keystores, making it possible for different software to work with the same wallets and keys.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;A standard layout for wallets and accounts allows interoperability between validators.  This benefits users, as they can move from one validator software to another (and back) without requiring movement of files.  This is important because any movement of files containing keys involves danger of either deleting them or duplicating them, both of which could cause loss of access to funds.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;There are four elements for a wallet that need to be addressed.  These are defined below.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;base-location&quot;&gt;Base location&lt;&#x2F;h3&gt;
&lt;p&gt;The base location is required to be well-known, either pre-defined or defined by the storage system&#x27;s connection parameters.&lt;&#x2F;p&gt;
&lt;p&gt;For filesystems the pre-defined base location for different operating systems is as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Windows: &lt;code&gt;%APPDATA%\ethereum2\wallets&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;MacOSX: &lt;code&gt;${HOME}&#x2F;Library&#x2F;Application Support&#x2F;ethereum2&#x2F;wallets&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Linux: &lt;code&gt;${HOME}&#x2F;.config&#x2F;ethereum2&#x2F;wallets&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;For other hierarchical stores, for example Amazon S3, the base location MUST be the lower-case hex string representing the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2680&#x2F;.&#x2F;assets&#x2F;sha256-384-512.pdf&quot;&gt;SHA-256&lt;&#x2F;a&gt; hash of the string &quot;Ethereum 2 wallet:&quot; appended with the identifier for the hierarchical store.  For example, if the account ID for a user&#x27;s Amazon S3 account is &quot;AbC0438EB&quot; then:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;string would be &lt;code&gt;Ethereum 2 wallet:AbC0438EB&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;SHA-256 hash of string would be the byte array &lt;code&gt;0x991ec14a8d13836b10d8c3039c9e30876491cb8aa9c9c16967578afc815c9229&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;base location would be the string &lt;code&gt;991ec14a8d13836b10d8c3039c9e30876491cb8aa9c9c16967578afc815c9229&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;For non-hierarchical stores there is no base location.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;wallet-container&quot;&gt;Wallet container&lt;&#x2F;h3&gt;
&lt;p&gt;The wallet container holds the walletstore and related keystores.&lt;&#x2F;p&gt;
&lt;p&gt;The wallet container is identified by the wallet&#x27;s UUID.  It MUST be a string following the syntactic structure as laid out in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;tools.ietf.org&#x2F;html&#x2F;rfc4122#section-3&quot;&gt;section 3 of RFC 4122&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;walletstore&quot;&gt;Walletstore&lt;&#x2F;h3&gt;
&lt;p&gt;The walletstore element contains the walletstore and is held within the wallet container.  It is identified by the wallet&#x27;s UUID.  It MUST be a string following the syntactic structure as laid out in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;tools.ietf.org&#x2F;html&#x2F;rfc4122#section-3&quot;&gt;section 3 of RFC 4122&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;keystore&quot;&gt;Keystore&lt;&#x2F;h3&gt;
&lt;p&gt;The keystore element contains the keystore for a given key and is held within the wallet container.  It is identified by the key&#x27;s UUID.  It MUST be a string following the syntactic structure as laid out in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;tools.ietf.org&#x2F;html&#x2F;rfc4122#section-3&quot;&gt;section 3 of RFC 4122&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;hierarchical-store-example&quot;&gt;Hierarchical store example&lt;&#x2F;h2&gt;
&lt;p&gt;Hierarchical stores are a common way to store and organize information.  The most common example is the filesystem, but a number of object-based stores such as Amazon S3 also provide hierarchical naming.&lt;&#x2F;p&gt;
&lt;p&gt;Putting these elements together for a sample wallet with wallet UUID &lt;code&gt;1f031fff-c51d-44fc-8baf-d6b304cb70a7&lt;&#x2F;code&gt; and key UUIDs &lt;code&gt;1302106c-8441-4e2e-b687-6c77f49fc624&lt;&#x2F;code&gt; and &lt;code&gt;4a320100-83fd-4db7-8126-6d6d205ba834&lt;&#x2F;code&gt; gives the following layout:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;- 1f031fff-c51d-44fc-8baf-d6b304cb70a7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+- 1302106c-8441-4e2e-b687-6c77f49fc624&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+- 1f031fff-c51d-44fc-8baf-d6b304cb70a7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+- 4a320100-83fd-4db7-8126-6d6d205ba834&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;non-hierarchical-store-example&quot;&gt;Non-hierarchical store example&lt;&#x2F;h3&gt;
&lt;p&gt;Non-hierarchical stores use a simplified approach where the wallet UUID and key UUIDs are concatenated using the &#x27;:&#x27; character.  Using the same example wallet and key UUIDs as above would result in objects with the following keys:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;1f031fff-c51d-44fc-8baf-d6b304cb70a7:1302106c-8441-4e2e-b687-6c77f49fc624&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;1f031fff-c51d-44fc-8baf-d6b304cb70a7:1f031fff-c51d-44fc-8baf-d6b304cb70a7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;1f031fff-c51d-44fc-8baf-d6b304cb70a7:4a320100-83fd-4db7-8126-6d6d205ba834&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;protecting-against-concurrent-write-access&quot;&gt;Protecting against concurrent write access&lt;&#x2F;h3&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h3 id=&quot;iterating-over-wallets&quot;&gt;Iterating over wallets&lt;&#x2F;h3&gt;
&lt;p&gt;In the case of hierarchical stores and iteration-capable non-hierarchical stores iteration over wallets is a matter of iterating over the files in the root container.&lt;&#x2F;p&gt;
&lt;p&gt;An implementer MAY include an index in the base location.  If so then it MUST follow the structure as specified in the following &quot;Index format&quot; section.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;iterating-over-accounts&quot;&gt;Iterating over accounts&lt;&#x2F;h3&gt;
&lt;p&gt;In the case of hierarchical stores iteration over accounts is a matter of iterating over the files in the wallet container.&lt;&#x2F;p&gt;
&lt;p&gt;An implementer MAY include an index within a wallet container for accounts within that wallet.  If so then it MUST follow the structure as specified in the following &quot;Index format&quot; section.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;index-format&quot;&gt;Index format&lt;&#x2F;h3&gt;
&lt;p&gt;The index format is the same for both wallets and accounts, following a standard JSON schema.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;array&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;items&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uuid&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;required&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uuid&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The index MUST use the identifier &#x27;index&#x27;.&lt;&#x2F;p&gt;
&lt;p&gt;Public keys must NOT be stored in the index.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;A standard for walletstores, similar to that for keystores, provides a higher level of compatibility between wallets and allows for simpler wallet and key interchange between them.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;A Go implementation of the filesystem layout can be found at &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;wealdtech&#x2F;go-eth2-wallet-filesystem&quot;&gt;https:&#x2F;&#x2F;github.com&#x2F;wealdtech&#x2F;go-eth2-wallet-filesystem&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;A Go implementation of the Amazon S3 layout can be found at &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;wealdtech&#x2F;go-eth2-wallet-s3&quot;&gt;https:&#x2F;&#x2F;github.com&#x2F;wealdtech&#x2F;go-eth2-wallet-s3&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Locations for wallet stores are defined to be within each user&#x27;s personal space, reducing the possibility of accidental exposure of information.  It is, however, still possible for permissions to be set such that this data is world-readable, and applications implementing this EIP should attempt to set, and reset, permissions to ensure that only the relevant user has access to the information.&lt;&#x2F;p&gt;
&lt;p&gt;The names for both wallet and key stores are UUIDs, ensuring that no data is leaked from the metadata.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Revised Ethereum Smart Contract Packaging Standard (EthPM v3)</title>
        <published>2020-05-26T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>g. nicholas d’andrea</name><uri>https://github.com/gnidan</uri>
	</author>
	
	<author>
		<name>Piper Merriam</name><uri>https://github.com/pipermerriam</uri>
	</author>
	
	<author>
		<name>Nick Gheorghita</name><uri>https://github.com/njgheorghita</uri>
	</author>
	
	<author>
		<name>Christian Reitwiessner</name><uri>https://github.com/chriseth</uri>
	</author>
	
	<author>
		<name>Ben Hauser</name><uri>https://github.com/iamdefinitelyahuman</uri>
	</author>
	
	<author>
		<name>Bryant Eisenbach</name><uri>https://github.com/fubuloubu</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2678/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/ethpm-v3-specification-working-group/4086" />
        

        <id>https://wg-eips.ritovision.com/2678/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2678"
            label="ERC-2678" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2678/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;A data format describing a smart contract software package.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP defines a data format for &lt;em&gt;package manifest&lt;&#x2F;em&gt; documents,
representing a package of one or more smart contracts, optionally
including source code and any&#x2F;all deployed instances across multiple
networks. Package manifests are minified JSON objects, to be distributed
via content addressable storage networks, such as IPFS. Packages
are then published to on-chain EthPM registries, defined in
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1319&#x2F;&quot;&gt;EIP-1319&lt;&#x2F;a&gt;, from where they can be freely accessed.&lt;&#x2F;p&gt;
&lt;p&gt;This document presents a natural language description of a formal
specification for version &lt;strong&gt;3&lt;&#x2F;strong&gt; of this format.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This standard aims to encourage the Ethereum development ecosystem
towards software best practices around code reuse. By defining an open,
community-driven package data format standard, this effort seeks to
provide support for package management tools development by offering a
general-purpose solution that has been designed with observed common
practices in mind.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Updates the schema for a &lt;em&gt;package manifest&lt;&#x2F;em&gt; to be compatible with
the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;solidity.readthedocs.io&#x2F;en&#x2F;latest&#x2F;metadata.html&quot;&gt;metadata&lt;&#x2F;a&gt; output for compilers.&lt;&#x2F;li&gt;
&lt;li&gt;Updates the &lt;code&gt;&quot;sources&quot;&lt;&#x2F;code&gt; object definition to support a wider range of source file types and serve as &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;solidity.readthedocs.io&#x2F;en&#x2F;latest&#x2F;using-the-compiler.html#compiler-input-and-output-json-description&quot;&gt;JSON input&lt;&#x2F;a&gt; for a compiler.&lt;&#x2F;li&gt;
&lt;li&gt;Moves compiler definitions to a top-level &lt;code&gt;&quot;compilers&quot;&lt;&#x2F;code&gt; array in order to:
&lt;ul&gt;
&lt;li&gt;Simplify the links between a compiler version, sources, and the
compiled assets.&lt;&#x2F;li&gt;
&lt;li&gt;Simplify packages that use multiple compiler versions.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Updates key formatting from &lt;code&gt;snake_case&lt;&#x2F;code&gt; to &lt;code&gt;camelCase&lt;&#x2F;code&gt; to be
more consistent with &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;google.github.io&#x2F;styleguide&#x2F;jsoncstyleguide.xml?showone=Property_Name_Format#Property_Name_Format&quot;&gt;JSON convention&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;guiding-principles&quot;&gt;Guiding Principles&lt;&#x2F;h3&gt;
&lt;p&gt;This specification makes the following assumptions about the document
lifecycle.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Package manifests are intended to be generated programmatically by
package management software as part of the release process.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Package manifests will be consumed by package managers during tasks
like installing package dependencies or building and deploying new
releases.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Package manifests will typically &lt;strong&gt;not&lt;&#x2F;strong&gt; be stored alongside the
source, but rather by package registries &lt;em&gt;or&lt;&#x2F;em&gt; referenced by package
registries and stored in something akin to IPFS.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Package manifests can be used to verify public deployments of source
contracts.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;use-cases&quot;&gt;Use Cases&lt;&#x2F;h3&gt;
&lt;p&gt;The following use cases were considered during the creation of this
specification.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;owned&lt;&#x2F;strong&gt;: A package which contains contracts which are not meant to be used by themselves but rather as base contracts to provide functionality to other contracts through inheritance.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;transferable&lt;&#x2F;strong&gt;: A package which has a single dependency.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;standard-token&lt;&#x2F;strong&gt;: A package which contains a reusable contract.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;safe-math-lib&lt;&#x2F;strong&gt;: A package which contains deployed instance of one of the package contracts.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;piper-coin&lt;&#x2F;strong&gt;: A package which contains a deployed instance of a reusable contract from a dependency.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;escrow&lt;&#x2F;strong&gt;: A package which contains a deployed instance of a local contract which is linked against a deployed instance of a local library.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;wallet&lt;&#x2F;strong&gt;: A package with a deployed instance of a local contract which is linked against a deployed instance of a library from a dependency.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;wallet-with-send&lt;&#x2F;strong&gt;: A package with a deployed instance which links against a deep dependency.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;simple-auction&lt;&#x2F;strong&gt;: Compiler &lt;code&gt;&quot;metadata&quot;&lt;&#x2F;code&gt; field output.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;package-specification&quot;&gt;Package Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;conventions&quot;&gt;Conventions&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;rfc2119&quot;&gt;RFC2119&lt;&#x2F;h4&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”,
“SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this
document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.ietf.org&#x2F;rfc&#x2F;rfc2119.txt&quot;&gt;https:&#x2F;&#x2F;www.ietf.org&#x2F;rfc&#x2F;rfc2119.txt&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;prefixed-vs-unprefixed&quot;&gt;Prefixed vs Unprefixed&lt;&#x2F;h4&gt;
&lt;p&gt;A &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#prefixed&quot;&gt;prefixed&lt;&#x2F;a&gt; hexadecimal value begins with &lt;code&gt;0x&lt;&#x2F;code&gt;.
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#unprefixed&quot;&gt;Unprefixed&lt;&#x2F;a&gt; values have no prefix. Unless otherwise
specified, all hexadecimal values &lt;strong&gt;should&lt;&#x2F;strong&gt; be represented with the
&lt;code&gt;0x&lt;&#x2F;code&gt; prefix.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Prefixed&lt;&#x2F;strong&gt;: &lt;code&gt;0xdeadbeef&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Unprefixed&lt;&#x2F;strong&gt;: &lt;code&gt;deadbeef&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;document-format&quot;&gt;Document Format&lt;&#x2F;h3&gt;
&lt;p&gt;The canonical format is a single JSON object. Packages &lt;strong&gt;must&lt;&#x2F;strong&gt; conform
to the following serialization rules.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The document &lt;strong&gt;must&lt;&#x2F;strong&gt; be tightly packed, meaning no linebreaks or
extra whitespace.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The keys in all objects &lt;strong&gt;must&lt;&#x2F;strong&gt; be sorted alphabetically.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Duplicate keys in the same object are invalid.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The document &lt;strong&gt;must&lt;&#x2F;strong&gt; use
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;UTF-8&quot;&gt;UTF-8&lt;&#x2F;a&gt;
encoding.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The document &lt;strong&gt;must&lt;&#x2F;strong&gt; not have a trailing newline.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;To ensure backwards compatibility, &lt;code&gt;manifest_version&lt;&#x2F;code&gt; is a forbidden
top-level key.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;document-specification&quot;&gt;Document Specification&lt;&#x2F;h3&gt;
&lt;p&gt;The following fields are defined for the package. Custom fields &lt;strong&gt;may&lt;&#x2F;strong&gt;
be included. Custom fields &lt;strong&gt;should&lt;&#x2F;strong&gt; be prefixed with &lt;code&gt;x-&lt;&#x2F;code&gt; to prevent
name collisions with future versions of the specification.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;See Also&lt;&#x2F;strong&gt;: Formalized (&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;json-schema.org&quot;&gt;JSON-Schema&lt;&#x2F;a&gt;) version of this specification: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;.&#x2F;assets&#x2F;package.spec.json&quot;&gt;package.spec.json&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Jump To&lt;&#x2F;strong&gt;: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#object-definitions&quot;&gt;Definitions&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;ethpm-manifest-version&quot;&gt;EthPM Manifest Version&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;manifest&lt;&#x2F;code&gt; field defines the specification version that this
document conforms to.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Packages &lt;strong&gt;must&lt;&#x2F;strong&gt; include this field.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Required&lt;&#x2F;strong&gt;: Yes&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Key&lt;&#x2F;strong&gt;: &lt;code&gt;manifest&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Type&lt;&#x2F;strong&gt;: String&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Allowed Values&lt;&#x2F;strong&gt;: &lt;code&gt;ethpm&#x2F;3&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;package-name&quot;&gt;Package Name&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;name&lt;&#x2F;code&gt; field defines a human readable name for this package.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Packages &lt;strong&gt;should&lt;&#x2F;strong&gt; include this field to be released on an EthPM
registry.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Package names &lt;strong&gt;must&lt;&#x2F;strong&gt; begin with a lowercase letter and be
comprised of only the lowercase letters &lt;code&gt;a-z&lt;&#x2F;code&gt;, numeric characters &lt;code&gt;0-9&lt;&#x2F;code&gt;, and the
dash character &lt;code&gt;-&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Package names &lt;strong&gt;must&lt;&#x2F;strong&gt; not exceed 255 characters in length.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Required&lt;&#x2F;strong&gt;: If &lt;code&gt;version&lt;&#x2F;code&gt; is included.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Key&lt;&#x2F;strong&gt;: &lt;code&gt;name&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Type&lt;&#x2F;strong&gt;: String&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Format&lt;&#x2F;strong&gt;: &lt;strong&gt;must&lt;&#x2F;strong&gt; match the regular expression &lt;code&gt;^[a-z][-a-z0-9]{0,255}$&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;package-version&quot;&gt;Package Version&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;version&lt;&#x2F;code&gt; field declares the version number of this release.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Packages &lt;strong&gt;should&lt;&#x2F;strong&gt; include this field to be released on an EthPM
registry.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;This value &lt;strong&gt;should&lt;&#x2F;strong&gt; conform to the
&lt;a rel=&quot;external&quot; href=&quot;http:&#x2F;&#x2F;semver.org&#x2F;&quot;&gt;semver&lt;&#x2F;a&gt; version numbering
specification.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Required&lt;&#x2F;strong&gt;: If &lt;code&gt;name&lt;&#x2F;code&gt; is included.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Key&lt;&#x2F;strong&gt;: &lt;code&gt;version&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Type&lt;&#x2F;strong&gt;: String&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;package-metadata&quot;&gt;Package Metadata&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;meta&lt;&#x2F;code&gt; field defines a location for metadata about the package which
is not integral in nature for package installation, but may be important
or convenient to have on-hand for other reasons.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;This field &lt;strong&gt;should&lt;&#x2F;strong&gt; be included in all Packages.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Required&lt;&#x2F;strong&gt;: No&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Key&lt;&#x2F;strong&gt;: &lt;code&gt;meta&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Type&lt;&#x2F;strong&gt;: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#the-package-meta-object&quot;&gt;Package Meta Object&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;sources&quot;&gt;Sources&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;sources&lt;&#x2F;code&gt; field defines a source tree that &lt;strong&gt;should&lt;&#x2F;strong&gt; comprise the
full source tree necessary to recompile the contracts contained in this
release.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Required&lt;&#x2F;strong&gt;: No&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Key&lt;&#x2F;strong&gt;: &lt;code&gt;sources&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Type&lt;&#x2F;strong&gt;: Object (String: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#the-source-object&quot;&gt;Sources Object&lt;&#x2F;a&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;contract-types&quot;&gt;Contract Types&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;contractTypes&lt;&#x2F;code&gt; field hosts the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#contract-type&quot;&gt;Contract
Types&lt;&#x2F;a&gt; which have been included in this release.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Packages &lt;strong&gt;should&lt;&#x2F;strong&gt; only include contract types that can be found in
the source files for this package.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Packages &lt;strong&gt;should not&lt;&#x2F;strong&gt; include contract types from dependencies.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Packages &lt;strong&gt;should not&lt;&#x2F;strong&gt; include abstract contracts in the contract
types section of a release.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Required&lt;&#x2F;strong&gt;: No&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Key&lt;&#x2F;strong&gt;: &lt;code&gt;contractTypes&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Type&lt;&#x2F;strong&gt;: Object (String: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#the-contract-type-object&quot;&gt;Contract Type Object&lt;&#x2F;a&gt;)&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Format&lt;&#x2F;strong&gt;: Keys &lt;strong&gt;must&lt;&#x2F;strong&gt; be valid &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#contract-alias&quot;&gt;Contract Aliases&lt;&#x2F;a&gt;. &lt;br&gt; Values &lt;strong&gt;must&lt;&#x2F;strong&gt; conform to the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#the-contract-type-object&quot;&gt;Contract Type Object&lt;&#x2F;a&gt; definition.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;compilers&quot;&gt;Compilers&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;compilers&lt;&#x2F;code&gt; field holds the information about the compilers and
their settings that have been used to generate the various
&lt;code&gt;contractTypes&lt;&#x2F;code&gt; included in this release.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Required&lt;&#x2F;strong&gt;: No&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Key&lt;&#x2F;strong&gt;: &lt;code&gt;compilers&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Type&lt;&#x2F;strong&gt;: Array (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#the-compiler-information-object&quot;&gt;Compiler Information Object&lt;&#x2F;a&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;deployments&quot;&gt;Deployments&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;deployments&lt;&#x2F;code&gt; field holds the information for the chains on which
this release has &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#contract-instance&quot;&gt;Contract Instances&lt;&#x2F;a&gt; as well
as the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#contract-type&quot;&gt;Contract Types&lt;&#x2F;a&gt; and other deployment
details for those deployed contract instances. The set of chains defined
by the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#bip122-uri&quot;&gt;BIP122 URI&lt;&#x2F;a&gt; keys for this object &lt;strong&gt;must&lt;&#x2F;strong&gt; be
unique. There cannot be two different URI keys in a deployments field
representing the same blockchain.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Required&lt;&#x2F;strong&gt;: No&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Key&lt;&#x2F;strong&gt;: &lt;code&gt;deployments&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Type&lt;&#x2F;strong&gt;: Object (String: Object(String: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#the-contract-instance-object&quot;&gt;Contract Instance Object&lt;&#x2F;a&gt;))&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Format&lt;&#x2F;strong&gt;: Keys &lt;strong&gt;must&lt;&#x2F;strong&gt; be a valid BIP122 URI chain definition. &lt;br&gt;Values &lt;strong&gt;must&lt;&#x2F;strong&gt; be objects which conform to the following format:&lt;br&gt;- Keys &lt;strong&gt;must&lt;&#x2F;strong&gt; be valid &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#contract-instance-name&quot;&gt;Contract Instance Names&lt;&#x2F;a&gt;&lt;br&gt;- Values &lt;strong&gt;must&lt;&#x2F;strong&gt; be a valid &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#the-contract-instance-object&quot;&gt;Contract Instance Object&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;build-dependencies&quot;&gt;Build Dependencies&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;buildDependencies&lt;&#x2F;code&gt; field defines a key&#x2F;value mapping of EthPM
packages that this project depends on.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Required&lt;&#x2F;strong&gt;: No&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Key&lt;&#x2F;strong&gt;: &lt;code&gt;buildDependencies&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Type&lt;&#x2F;strong&gt;: Object (String: String)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Format&lt;&#x2F;strong&gt;: Keys &lt;strong&gt;must&lt;&#x2F;strong&gt; be valid &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#package-name&quot;&gt;package names&lt;&#x2F;a&gt;.&lt;br&gt;Values &lt;strong&gt;must&lt;&#x2F;strong&gt; be a &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#content-addressable-uri&quot;&gt;Content Addressable URI&lt;&#x2F;a&gt; which resolves to a valid package that conforms the same EthPM manifest version as its parent.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;object-definitions&quot;&gt;Object Definitions&lt;&#x2F;h3&gt;
&lt;p&gt;Definitions for different objects used within the Package. All objects
allow custom fields to be included. Custom fields &lt;strong&gt;should&lt;&#x2F;strong&gt; be prefixed
with &lt;code&gt;x-&lt;&#x2F;code&gt; to prevent name collisions with future versions of the
specification.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;the-link-reference-object&quot;&gt;The &lt;em&gt;Link Reference&lt;&#x2F;em&gt; Object&lt;&#x2F;h3&gt;
&lt;p&gt;A &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#link-reference&quot;&gt;Link Reference&lt;&#x2F;a&gt; object has the following
key&#x2F;value pairs. All link references are assumed to be associated with
some corresponding &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#bytecode&quot;&gt;Bytecode&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;offsets-offsets&quot;&gt;Offsets: &lt;code&gt;offsets&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;offsets&lt;&#x2F;code&gt; field is an array of integers, corresponding to each of
the start positions where the link reference appears in the bytecode.
Locations are 0-indexed from the beginning of the bytes representation
of the corresponding bytecode. This field is invalid if it references a
position that is beyond the end of the bytecode.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Required&lt;&#x2F;strong&gt;: Yes&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Type&lt;&#x2F;strong&gt;: Array&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;length-length&quot;&gt;Length: &lt;code&gt;length&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;length&lt;&#x2F;code&gt; field is an integer which defines the length in bytes of
the link reference. This field is invalid if the end of the defined link
reference exceeds the end of the bytecode.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Required&lt;&#x2F;strong&gt;: Yes&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Type&lt;&#x2F;strong&gt;: Integer&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;name-name&quot;&gt;Name: &lt;code&gt;name&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;name&lt;&#x2F;code&gt; field is a string which &lt;strong&gt;must&lt;&#x2F;strong&gt; be a valid
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#identifier&quot;&gt;Identifier&lt;&#x2F;a&gt;. Any link references which &lt;strong&gt;should&lt;&#x2F;strong&gt; be
linked with the same link value &lt;strong&gt;should&lt;&#x2F;strong&gt; be given the same name.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Required&lt;&#x2F;strong&gt;: No&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Type&lt;&#x2F;strong&gt;: String&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Format&lt;&#x2F;strong&gt;: &lt;strong&gt;must&lt;&#x2F;strong&gt; conform to the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#identifier&quot;&gt;Identifier&lt;&#x2F;a&gt; format.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;the-link-value-object&quot;&gt;The &lt;em&gt;Link Value&lt;&#x2F;em&gt; Object&lt;&#x2F;h3&gt;
&lt;p&gt;Describes a single &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#link-value&quot;&gt;Link Value&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;A &lt;strong&gt;Link Value object&lt;&#x2F;strong&gt; is defined to have the following key&#x2F;value
pairs.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;offsets-offsets-1&quot;&gt;Offsets: &lt;code&gt;offsets&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;offsets&lt;&#x2F;code&gt; field defines the locations within the corresponding
bytecode where the &lt;code&gt;value&lt;&#x2F;code&gt; for this link value was written. These
locations are 0-indexed from the beginning of the bytes representation
of the corresponding bytecode.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Required&lt;&#x2F;strong&gt;: Yes&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Type&lt;&#x2F;strong&gt;: Integer&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Format&lt;&#x2F;strong&gt;: See below.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Format&lt;&#x2F;p&gt;
&lt;p&gt;Array of integers, where each integer &lt;strong&gt;must&lt;&#x2F;strong&gt; conform to all of the
following.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;greater than or equal to zero&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;strictly less than the length of the unprefixed hexadecimal
representation of the corresponding bytecode.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;type-type&quot;&gt;Type: &lt;code&gt;type&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;type&lt;&#x2F;code&gt; field defines the &lt;code&gt;value&lt;&#x2F;code&gt; type for determining what is
encoded when &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#linking&quot;&gt;linking&lt;&#x2F;a&gt; the corresponding bytecode.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Required&lt;&#x2F;strong&gt;: Yes&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Type&lt;&#x2F;strong&gt;: String&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Allowed Values&lt;&#x2F;strong&gt;: &lt;code&gt;&quot;literal&quot;&lt;&#x2F;code&gt; for bytecode literals.&lt;br&gt;&lt;code&gt;&quot;reference&quot;&lt;&#x2F;code&gt; for named references to a particular &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#contract-instance&quot;&gt;Contract Instance&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;value-value&quot;&gt;Value: &lt;code&gt;value&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;value&lt;&#x2F;code&gt; field defines the value which should be written when &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#linking&quot;&gt;linking&lt;&#x2F;a&gt; the corresponding bytecode.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Required&lt;&#x2F;strong&gt;: Yes&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Type&lt;&#x2F;strong&gt;: String&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Format&lt;&#x2F;strong&gt;: Determined based on &lt;code&gt;type&lt;&#x2F;code&gt;, see below.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Format&lt;&#x2F;p&gt;
&lt;p&gt;For static value &lt;em&gt;literals&lt;&#x2F;em&gt; (e.g. address), value &lt;strong&gt;must&lt;&#x2F;strong&gt; be a 0x-prefixed
hexadecimal string representing bytes.&lt;&#x2F;p&gt;
&lt;p&gt;To reference the address of a &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#contract-instance&quot;&gt;Contract
Instance&lt;&#x2F;a&gt; from the current package the value
should be the name of that contract instance.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;This value &lt;strong&gt;must&lt;&#x2F;strong&gt; be a valid &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#contract-instance-name&quot;&gt;Contract Instance
Name&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The chain definition under which the contract instance that this
link value belongs to must contain this value within its keys.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;This value &lt;strong&gt;may not&lt;&#x2F;strong&gt; reference the same contract instance that
this link value belongs to.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;To reference a contract instance from a &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#package&quot;&gt;Package&lt;&#x2F;a&gt; from
somewhere within the dependency tree the value is constructed as
follows.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Let &lt;code&gt;[p1, p2, .. pn]&lt;&#x2F;code&gt; define a path down the dependency tree.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Each of &lt;code&gt;p1, p2, pn&lt;&#x2F;code&gt; &lt;strong&gt;must&lt;&#x2F;strong&gt; be valid package names.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;p1&lt;&#x2F;code&gt; &lt;strong&gt;must&lt;&#x2F;strong&gt; be present in keys of the &lt;code&gt;buildDependencies&lt;&#x2F;code&gt; for the
current package.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;For every &lt;code&gt;pn&lt;&#x2F;code&gt; where &lt;code&gt;n &amp;gt; 1&lt;&#x2F;code&gt;, &lt;code&gt;pn&lt;&#x2F;code&gt; &lt;strong&gt;must&lt;&#x2F;strong&gt; be present in the keys
of the &lt;code&gt;buildDependencies&lt;&#x2F;code&gt; of the package for &lt;code&gt;pn-1&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The value is represented by the string
&lt;code&gt;&amp;lt;p1&amp;gt;:&amp;lt;p2&amp;gt;:&amp;lt;...&amp;gt;:&amp;lt;pn&amp;gt;:&amp;lt;contract-instance&amp;gt;&lt;&#x2F;code&gt; where all of &lt;code&gt;&amp;lt;p1&amp;gt;&lt;&#x2F;code&gt;,
&lt;code&gt;&amp;lt;p2&amp;gt;&lt;&#x2F;code&gt;, &lt;code&gt;&amp;lt;pn&amp;gt;&lt;&#x2F;code&gt; are valid package names and &lt;code&gt;&amp;lt;contract-instance&amp;gt;&lt;&#x2F;code&gt; is
a valid &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#contract-name&quot;&gt;Contract Name&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;&amp;lt;contract-instance&amp;gt;&lt;&#x2F;code&gt; value &lt;strong&gt;must&lt;&#x2F;strong&gt; be a valid &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#contract-instance-name&quot;&gt;Contract
Instance Name&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Within the package of the dependency defined by &lt;code&gt;&amp;lt;pn&amp;gt;&lt;&#x2F;code&gt;, all of the
following must be satisfiable:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;There &lt;strong&gt;must&lt;&#x2F;strong&gt; be &lt;em&gt;exactly&lt;&#x2F;em&gt; one chain defined under the
&lt;code&gt;deployments&lt;&#x2F;code&gt; key which matches the chain definition that this
link value is nested under.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;&amp;lt;contract-instance&amp;gt;&lt;&#x2F;code&gt; value &lt;strong&gt;must&lt;&#x2F;strong&gt; be present in the keys
of the matching chain.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;the-bytecode-object&quot;&gt;The &lt;em&gt;Bytecode&lt;&#x2F;em&gt; Object&lt;&#x2F;h3&gt;
&lt;p&gt;A bytecode object has the following key&#x2F;value pairs.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;bytecode-bytecode&quot;&gt;Bytecode: &lt;code&gt;bytecode&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;bytecode&lt;&#x2F;code&gt; field is a string containing the &lt;code&gt;0x&lt;&#x2F;code&gt; prefixed
hexadecimal representation of the bytecode.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Required&lt;&#x2F;strong&gt;: Yes&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Type&lt;&#x2F;strong&gt;:  String&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Format&lt;&#x2F;strong&gt;: &lt;code&gt;0x&lt;&#x2F;code&gt; prefixed hexadecimal.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;link-references-linkreferences&quot;&gt;Link References: &lt;code&gt;linkReferences&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;linkReferences&lt;&#x2F;code&gt; field defines the locations in the corresponding
bytecode which require &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#linking&quot;&gt;linking&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Required&lt;&#x2F;strong&gt;: No&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Type&lt;&#x2F;strong&gt;:  Array&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Format&lt;&#x2F;strong&gt;: All values &lt;strong&gt;must&lt;&#x2F;strong&gt; be valid &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#the-link-reference-object&quot;&gt;Link Reference objects&lt;&#x2F;a&gt;. See also below.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Format&lt;&#x2F;p&gt;
&lt;p&gt;This field is considered invalid if &lt;em&gt;any&lt;&#x2F;em&gt; of the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#link-reference&quot;&gt;Link
References&lt;&#x2F;a&gt; are invalid when applied to the
corresponding &lt;code&gt;bytecode&lt;&#x2F;code&gt; field, &lt;em&gt;or&lt;&#x2F;em&gt; if any of the link references
intersect.&lt;&#x2F;p&gt;
&lt;p&gt;Intersection is defined as two link references which overlap.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;link-dependencies-linkdependencies&quot;&gt;Link Dependencies: &lt;code&gt;linkDependencies&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;linkDependencies&lt;&#x2F;code&gt; defines the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#link-value&quot;&gt;Link Values&lt;&#x2F;a&gt; that
have been used to link the corresponding bytecode.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Required&lt;&#x2F;strong&gt;: No&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Type&lt;&#x2F;strong&gt;:  Array&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Format&lt;&#x2F;strong&gt;: All values &lt;strong&gt;must&lt;&#x2F;strong&gt; be valid &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#the-link-value-object&quot;&gt;Link Value objects&lt;&#x2F;a&gt;. See also below.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Format&lt;&#x2F;p&gt;
&lt;p&gt;Validation of this field includes the following:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Two link value objects &lt;strong&gt;must not&lt;&#x2F;strong&gt; contain any of the same values
for &lt;code&gt;offsets&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Each &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#the-link-value-object&quot;&gt;link value object&lt;&#x2F;a&gt; &lt;strong&gt;must&lt;&#x2F;strong&gt; have a
corresponding &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#the-link-reference-object&quot;&gt;link reference object&lt;&#x2F;a&gt; under
the &lt;code&gt;linkReferences&lt;&#x2F;code&gt; field.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The length of the resolved &lt;code&gt;value&lt;&#x2F;code&gt; &lt;strong&gt;must&lt;&#x2F;strong&gt; be equal to the &lt;code&gt;length&lt;&#x2F;code&gt;
of the corresponding &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#link-reference&quot;&gt;Link Reference&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;the-package-meta-object&quot;&gt;The &lt;em&gt;Package Meta&lt;&#x2F;em&gt; Object&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;em&gt;Package Meta&lt;&#x2F;em&gt; object is defined to have the following key&#x2F;value
pairs.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;authors&quot;&gt;Authors&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;authors&lt;&#x2F;code&gt; field defines a list of human readable names for the
authors of this package. Packages &lt;strong&gt;may&lt;&#x2F;strong&gt; include this field.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Required&lt;&#x2F;strong&gt;: No&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Key&lt;&#x2F;strong&gt;: &lt;code&gt;authors&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Type&lt;&#x2F;strong&gt;:  Array(String)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;license&quot;&gt;License&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;license&lt;&#x2F;code&gt; field declares the license associated with this package.
This value &lt;strong&gt;should&lt;&#x2F;strong&gt; conform to the
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;spdx.org&#x2F;licenses&#x2F;&quot;&gt;SPDX&lt;&#x2F;a&gt;
format. Packages &lt;strong&gt;should&lt;&#x2F;strong&gt; include this field. If a file &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#the-source-object&quot;&gt;Source
Object&lt;&#x2F;a&gt; defines its own license, that license takes
precedence for that particular file over this package-scoped &lt;code&gt;meta&lt;&#x2F;code&gt;
license.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Required&lt;&#x2F;strong&gt;: No&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Key&lt;&#x2F;strong&gt;: &lt;code&gt;license&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Type&lt;&#x2F;strong&gt;:  String&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;description&quot;&gt;Description&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;description&lt;&#x2F;code&gt; field provides additional detail that may be relevant
for the package. Packages &lt;strong&gt;may&lt;&#x2F;strong&gt; include this field.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Required&lt;&#x2F;strong&gt;: No&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Key&lt;&#x2F;strong&gt;: &lt;code&gt;description&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Type&lt;&#x2F;strong&gt;:  String&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;keywords&quot;&gt;Keywords&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;keywords&lt;&#x2F;code&gt; field provides relevant keywords related to this package.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Required&lt;&#x2F;strong&gt;: No&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Key&lt;&#x2F;strong&gt;: &lt;code&gt;keywords&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Type&lt;&#x2F;strong&gt;:  Array(String)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;links&quot;&gt;Links&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;links&lt;&#x2F;code&gt; field provides URIs to relevant resources associated with
this package. When possible, authors &lt;strong&gt;should&lt;&#x2F;strong&gt; use the following keys
for the following common resources.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;website&lt;&#x2F;code&gt;: Primary website for the package.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;documentation&lt;&#x2F;code&gt;: Package Documentation&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;repository&lt;&#x2F;code&gt;: Location of the project source code.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Required&lt;&#x2F;strong&gt;: No&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Key&lt;&#x2F;strong&gt;: &lt;code&gt;links&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Type&lt;&#x2F;strong&gt;:  Object (String: String)&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;the-sources-object&quot;&gt;The &lt;em&gt;Sources&lt;&#x2F;em&gt; Object&lt;&#x2F;h3&gt;
&lt;p&gt;A &lt;em&gt;Sources&lt;&#x2F;em&gt; object is defined to have the following fields.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Key&lt;&#x2F;strong&gt;: A unique identifier for the source file. (String)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Value&lt;&#x2F;strong&gt;: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#the-source-object&quot;&gt;Source Object&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;the-source-object&quot;&gt;The &lt;em&gt;Source&lt;&#x2F;em&gt; Object&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;checksum-checksum&quot;&gt;Checksum: &lt;code&gt;checksum&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Hash of the source file.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Required&lt;&#x2F;strong&gt;: Only &lt;strong&gt;if&lt;&#x2F;strong&gt; the &lt;code&gt;content&lt;&#x2F;code&gt; field is missing and none of the provided URLs contain a content hash.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Key&lt;&#x2F;strong&gt;: &lt;code&gt;checksum&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Value&lt;&#x2F;strong&gt;: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#the-checksum-object&quot;&gt;Checksum Object&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;urls-urls&quot;&gt;URLS: &lt;code&gt;urls&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Array of urls that resolve to the same source file.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Urls &lt;strong&gt;should&lt;&#x2F;strong&gt; be stored on a content-addressable filesystem.
&lt;strong&gt;If&lt;&#x2F;strong&gt; they are not, then either &lt;code&gt;content&lt;&#x2F;code&gt; or &lt;code&gt;checksum&lt;&#x2F;code&gt; &lt;strong&gt;must&lt;&#x2F;strong&gt; be
included.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Urls &lt;strong&gt;must&lt;&#x2F;strong&gt; be prefixed with a scheme.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;If the resulting document is a directory the key &lt;strong&gt;should&lt;&#x2F;strong&gt; be
interpreted as a directory path.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;If the resulting document is a file the key &lt;strong&gt;should&lt;&#x2F;strong&gt; be
interpreted as a file path.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Required&lt;&#x2F;strong&gt;: If &lt;code&gt;content&lt;&#x2F;code&gt; is not included.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Key&lt;&#x2F;strong&gt;: &lt;code&gt;urls&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Value&lt;&#x2F;strong&gt;: Array(String)&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;content-content&quot;&gt;Content: &lt;code&gt;content&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Inlined contract source. If both &lt;code&gt;urls&lt;&#x2F;code&gt; and &lt;code&gt;content&lt;&#x2F;code&gt; are provided, the &lt;code&gt;content&lt;&#x2F;code&gt; value
&lt;strong&gt;must&lt;&#x2F;strong&gt; match the content of the files identified in &lt;code&gt;urls&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Required&lt;&#x2F;strong&gt;: If &lt;code&gt;urls&lt;&#x2F;code&gt; is not included.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Key&lt;&#x2F;strong&gt;: &lt;code&gt;content&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Value&lt;&#x2F;strong&gt;: String&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;install-path-installpath&quot;&gt;Install Path: &lt;code&gt;installPath&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Filesystem path of source file.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Must&lt;&#x2F;strong&gt; be a relative filesystem path that begins with a &lt;code&gt;.&#x2F;&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Must&lt;&#x2F;strong&gt; resolve to a path that is within the current virtual
working directory.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Must&lt;&#x2F;strong&gt; be unique across all included sources.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Must not&lt;&#x2F;strong&gt; contain &lt;code&gt;..&#x2F;&lt;&#x2F;code&gt; to avoid accessing files outside of
the source folder in improper implementations.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Required&lt;&#x2F;strong&gt;: This field &lt;strong&gt;must&lt;&#x2F;strong&gt; be included for the package to be writable to disk.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Key&lt;&#x2F;strong&gt;: &lt;code&gt;installPath&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Value&lt;&#x2F;strong&gt;: String&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;type-type-1&quot;&gt;Type: &lt;code&gt;type&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;type&lt;&#x2F;code&gt; field declares the type of the source file. The field
&lt;strong&gt;should&lt;&#x2F;strong&gt; be one of the following values: &lt;code&gt;solidity&lt;&#x2F;code&gt;, &lt;code&gt;vyper&lt;&#x2F;code&gt;,
&lt;code&gt;abi-json&lt;&#x2F;code&gt;, &lt;code&gt;solidity-ast-json&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Required&lt;&#x2F;strong&gt;: No&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Key&lt;&#x2F;strong&gt;: &lt;code&gt;type&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Value&lt;&#x2F;strong&gt;: String&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;license-license&quot;&gt;License: &lt;code&gt;license&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;license&lt;&#x2F;code&gt; field declares the type of license associated with
this source file. When defined, this license overrides the
package-scoped &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#license&quot;&gt;meta license&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Required&lt;&#x2F;strong&gt;: No&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Key&lt;&#x2F;strong&gt;: &lt;code&gt;license&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Value&lt;&#x2F;strong&gt;: String&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;the-checksum-object&quot;&gt;The &lt;em&gt;Checksum&lt;&#x2F;em&gt; Object&lt;&#x2F;h3&gt;
&lt;p&gt;A &lt;em&gt;Checksum&lt;&#x2F;em&gt; object is defined to have the following key&#x2F;value pairs.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;algorithm-algorithm&quot;&gt;Algorithm: &lt;code&gt;algorithm&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;algorithm&lt;&#x2F;code&gt; used to generate the corresponding hash. Possible
algorithms include, but are not limited to &lt;code&gt;sha3&lt;&#x2F;code&gt;, &lt;code&gt;sha256&lt;&#x2F;code&gt;, &lt;code&gt;md5&lt;&#x2F;code&gt;,
&lt;code&gt;keccak256&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Required&lt;&#x2F;strong&gt;: Yes&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Type&lt;&#x2F;strong&gt;:  String&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;hash-hash&quot;&gt;Hash: &lt;code&gt;hash&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;hash&lt;&#x2F;code&gt; of a source files contents generated with the corresponding
algorithm.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Required&lt;&#x2F;strong&gt;: Yes&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Type&lt;&#x2F;strong&gt;:  String&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;the-contract-type-object&quot;&gt;The &lt;em&gt;Contract Type&lt;&#x2F;em&gt; Object&lt;&#x2F;h3&gt;
&lt;p&gt;A &lt;em&gt;Contract Type&lt;&#x2F;em&gt; object is defined to have the following key&#x2F;value
pairs.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;contract-name-contractname&quot;&gt;Contract Name: &lt;code&gt;contractName&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;contractName&lt;&#x2F;code&gt; field defines the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#contract-name&quot;&gt;Contract
Name&lt;&#x2F;a&gt; for this &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#contract-type&quot;&gt;Contract
Type&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Required&lt;&#x2F;strong&gt;: If the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#contract-name&quot;&gt;Contract Name&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#contract-alias&quot;&gt;Contract Alias&lt;&#x2F;a&gt; are not the same.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Type&lt;&#x2F;strong&gt;:  String&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Format&lt;&#x2F;strong&gt;: &lt;strong&gt;Must&lt;&#x2F;strong&gt; be a valid &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#contract-name&quot;&gt;Contract Name&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;source-id-sourceid&quot;&gt;Source ID: &lt;code&gt;sourceId&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The global source identifier for the source file from which this
contract type was generated.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Required&lt;&#x2F;strong&gt;: No&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Type&lt;&#x2F;strong&gt;:  String&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Format&lt;&#x2F;strong&gt;: &lt;strong&gt;Must&lt;&#x2F;strong&gt; match a unique source ID included in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#the-sources-object&quot;&gt;Sources Object&lt;&#x2F;a&gt; for this package.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;deployment-bytecode-deploymentbytecode&quot;&gt;Deployment Bytecode: &lt;code&gt;deploymentBytecode&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;deploymentBytecode&lt;&#x2F;code&gt; field defines the bytecode for this &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#contract-type&quot;&gt;Contract
Type&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Required&lt;&#x2F;strong&gt;: No&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Type&lt;&#x2F;strong&gt;:  Object&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Format&lt;&#x2F;strong&gt;: &lt;strong&gt;Must&lt;&#x2F;strong&gt; conform to the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#the-bytecode-object&quot;&gt;Bytecode object&lt;&#x2F;a&gt; format.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;runtime-bytecode-runtimebytecode&quot;&gt;Runtime Bytecode: &lt;code&gt;runtimeBytecode&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;runtimeBytecode&lt;&#x2F;code&gt; field defines the unlinked &lt;code&gt;0x&lt;&#x2F;code&gt;-prefixed runtime
portion of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#bytecode&quot;&gt;Bytecode&lt;&#x2F;a&gt; for this &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#contract-type&quot;&gt;Contract
Type&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Required&lt;&#x2F;strong&gt;: No&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Type&lt;&#x2F;strong&gt;:  Object&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Format&lt;&#x2F;strong&gt;: &lt;strong&gt;Must&lt;&#x2F;strong&gt; conform to the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#the-bytecode-object&quot;&gt;Bytecode object&lt;&#x2F;a&gt; format.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;abi-abi&quot;&gt;ABI: &lt;code&gt;abi&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Required&lt;&#x2F;strong&gt;: No&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Type&lt;&#x2F;strong&gt;:  Array&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Format&lt;&#x2F;strong&gt;: &lt;strong&gt;Must&lt;&#x2F;strong&gt; conform to the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;wiki&#x2F;wiki&#x2F;Ethereum-Contract-ABI#json&quot;&gt;Ethereum Contract ABI JSON&lt;&#x2F;a&gt; format.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;userdoc-userdoc&quot;&gt;UserDoc: &lt;code&gt;userdoc&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Required&lt;&#x2F;strong&gt;: No&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Type&lt;&#x2F;strong&gt;:  Object&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Format&lt;&#x2F;strong&gt;: &lt;strong&gt;Must&lt;&#x2F;strong&gt; conform to the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;wiki&#x2F;wiki&#x2F;Ethereum-Natural-Specification-Format#user-documentation&quot;&gt;UserDoc&lt;&#x2F;a&gt; format.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;devdoc-devdoc&quot;&gt;DevDoc: &lt;code&gt;devdoc&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Required&lt;&#x2F;strong&gt;: No&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Type&lt;&#x2F;strong&gt;:  Object&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Format&lt;&#x2F;strong&gt;: &lt;strong&gt;Must&lt;&#x2F;strong&gt; conform to the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;wiki&#x2F;wiki&#x2F;Ethereum-Natural-Specification-Format#developer-documentation&quot;&gt;DevDoc&lt;&#x2F;a&gt; format.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;the-contract-instance-object&quot;&gt;The &lt;em&gt;Contract Instance&lt;&#x2F;em&gt; Object&lt;&#x2F;h3&gt;
&lt;p&gt;A &lt;strong&gt;Contract Instance Object&lt;&#x2F;strong&gt; represents a single deployed &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#contract-instance&quot;&gt;Contract
Instance&lt;&#x2F;a&gt; and is defined to have the following
key&#x2F;value pairs.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;contract-type-contracttype&quot;&gt;Contract Type: &lt;code&gt;contractType&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;contractType&lt;&#x2F;code&gt; field defines the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#contract-type&quot;&gt;Contract
Type&lt;&#x2F;a&gt; for this &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#contract-instance&quot;&gt;Contract
Instance&lt;&#x2F;a&gt;. This can reference any of the
contract types included in this &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#package&quot;&gt;Package&lt;&#x2F;a&gt; &lt;em&gt;or&lt;&#x2F;em&gt; any of the
contract types found in any of the package dependencies from the
&lt;code&gt;buildDependencies&lt;&#x2F;code&gt; section of the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#package-manifest&quot;&gt;Package
Manifest&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Required&lt;&#x2F;strong&gt;: Yes&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Type&lt;&#x2F;strong&gt;:  String&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Format&lt;&#x2F;strong&gt;: See below.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Format&lt;&#x2F;p&gt;
&lt;p&gt;Values for this field &lt;strong&gt;must&lt;&#x2F;strong&gt; conform to &lt;em&gt;one of&lt;&#x2F;em&gt; the two formats
herein.&lt;&#x2F;p&gt;
&lt;p&gt;To reference a contract type from this Package, use the format
&lt;code&gt;&amp;lt;contract-alias&amp;gt;&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;&amp;lt;contract-alias&amp;gt;&lt;&#x2F;code&gt; value &lt;strong&gt;must&lt;&#x2F;strong&gt; be a valid &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#contract-alias&quot;&gt;Contract
Alias&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The value &lt;strong&gt;must&lt;&#x2F;strong&gt; be present in the keys of the &lt;code&gt;contractTypes&lt;&#x2F;code&gt;
section of this Package.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;To reference a contract type from a dependency, use the format
&lt;code&gt;&amp;lt;package-name&amp;gt;:&amp;lt;contract-alias&amp;gt;&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;&amp;lt;package-name&amp;gt;&lt;&#x2F;code&gt; value &lt;strong&gt;must&lt;&#x2F;strong&gt; be present in the keys of the
&lt;code&gt;buildDependencies&lt;&#x2F;code&gt; of this Package.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;&amp;lt;contract-alias&amp;gt;&lt;&#x2F;code&gt; value &lt;strong&gt;must&lt;&#x2F;strong&gt; be be a valid &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#contract-alias&quot;&gt;Contract
Alias&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The resolved package for &lt;code&gt;&amp;lt;package-name&amp;gt;&lt;&#x2F;code&gt; must contain the
&lt;code&gt;&amp;lt;contract-alias&amp;gt;&lt;&#x2F;code&gt; value in the keys of the &lt;code&gt;contractTypes&lt;&#x2F;code&gt; section.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;address-address&quot;&gt;Address: &lt;code&gt;address&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;address&lt;&#x2F;code&gt; field defines the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#address&quot;&gt;Address&lt;&#x2F;a&gt; of the
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#contract-instance&quot;&gt;Contract Instance&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Required&lt;&#x2F;strong&gt;: Yes&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Type&lt;&#x2F;strong&gt;:  String&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Format&lt;&#x2F;strong&gt;: Hex encoded &lt;code&gt;0x&lt;&#x2F;code&gt; prefixed Ethereum address matching the regular expression &lt;code&gt;^0x[0-9a-fA-F]{40}$&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;transaction-transaction&quot;&gt;Transaction: &lt;code&gt;transaction&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;transaction&lt;&#x2F;code&gt; field defines the transaction hash in which this
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#contract-instance&quot;&gt;Contract Instance&lt;&#x2F;a&gt; was created.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Required&lt;&#x2F;strong&gt;: No&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Type&lt;&#x2F;strong&gt;:  String&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Format&lt;&#x2F;strong&gt;: &lt;code&gt;0x&lt;&#x2F;code&gt; prefixed hex encoded transaction hash.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;block-block&quot;&gt;Block: &lt;code&gt;block&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;block&lt;&#x2F;code&gt; field defines the block hash in which this the transaction
which created this &lt;em&gt;contract instance&lt;&#x2F;em&gt; was mined.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Required&lt;&#x2F;strong&gt;: No&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Type&lt;&#x2F;strong&gt;:  String&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Format&lt;&#x2F;strong&gt;: &lt;code&gt;0x&lt;&#x2F;code&gt; prefixed hex encoded block hash.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;runtime-bytecode-runtimebytecode-1&quot;&gt;Runtime Bytecode: &lt;code&gt;runtimeBytecode&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;runtimeBytecode&lt;&#x2F;code&gt; field defines the runtime portion of bytecode for
this &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#contract-instance&quot;&gt;Contract Instance&lt;&#x2F;a&gt;. When present, the
value from this field supersedes the &lt;code&gt;runtimeBytecode&lt;&#x2F;code&gt; from the
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#contract-type&quot;&gt;Contract Type&lt;&#x2F;a&gt; for this &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#contract-instance&quot;&gt;Contract
Instance&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Required&lt;&#x2F;strong&gt;: No&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Type&lt;&#x2F;strong&gt;:  Object&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Format&lt;&#x2F;strong&gt;: &lt;strong&gt;Must&lt;&#x2F;strong&gt; conform to the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#the-bytecode-object&quot;&gt;Bytecode Object&lt;&#x2F;a&gt; format.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Every entry in the &lt;code&gt;linkReferences&lt;&#x2F;code&gt; for this bytecode &lt;strong&gt;must&lt;&#x2F;strong&gt; have a
corresponding entry in the &lt;code&gt;linkDependencies&lt;&#x2F;code&gt; section.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;the-compiler-information-object&quot;&gt;The &lt;em&gt;Compiler Information&lt;&#x2F;em&gt; Object&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;compilers&lt;&#x2F;code&gt; field defines the various compilers and settings used
during compilation of any &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#contract-type&quot;&gt;Contract Types&lt;&#x2F;a&gt; or
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#contract-instance&quot;&gt;Contract Instance&lt;&#x2F;a&gt; included in this package.&lt;&#x2F;p&gt;
&lt;p&gt;A &lt;em&gt;Compiler Information&lt;&#x2F;em&gt; object is defined to have the following
key&#x2F;value pairs.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;name-name-1&quot;&gt;Name: &lt;code&gt;name&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;name&lt;&#x2F;code&gt; field defines which compiler was used in compilation.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Required&lt;&#x2F;strong&gt;: Yes&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Key&lt;&#x2F;strong&gt;: &lt;code&gt;name&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Type&lt;&#x2F;strong&gt;:  String&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;version-version&quot;&gt;Version: &lt;code&gt;version&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;version&lt;&#x2F;code&gt; field defines the version of the compiler. The field
&lt;strong&gt;should&lt;&#x2F;strong&gt; be OS agnostic (OS not included in the string) and take the
form of either the stable version in
&lt;a rel=&quot;external&quot; href=&quot;http:&#x2F;&#x2F;semver.org&#x2F;&quot;&gt;semver&lt;&#x2F;a&gt; format or if built on a
nightly should be denoted in the form of &lt;code&gt;&amp;lt;semver&amp;gt;-&amp;lt;commit-hash&amp;gt;&lt;&#x2F;code&gt; ex:
&lt;code&gt;0.4.8-commit.60cc1668&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Required&lt;&#x2F;strong&gt;: Yes&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Key&lt;&#x2F;strong&gt;: &lt;code&gt;version&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Type&lt;&#x2F;strong&gt;:  String&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;settings-settings&quot;&gt;Settings: &lt;code&gt;settings&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;settings&lt;&#x2F;code&gt; field defines any settings or configuration that was used
in compilation. For the &lt;code&gt;&quot;solc&quot;&lt;&#x2F;code&gt; compiler, this &lt;strong&gt;should&lt;&#x2F;strong&gt; conform to
the &lt;a rel=&quot;external&quot; href=&quot;http:&#x2F;&#x2F;solidity.readthedocs.io&#x2F;en&#x2F;latest&#x2F;using-the-compiler.html#compiler-input-and-output-json-description&quot;&gt;Compiler Input and Output
Description&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Required&lt;&#x2F;strong&gt;: No&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Key&lt;&#x2F;strong&gt;: &lt;code&gt;settings&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Type&lt;&#x2F;strong&gt;:  Object&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;contract-types-contracttypes&quot;&gt;Contract Types: &lt;code&gt;contractTypes&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;A list of the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#contract-alias&quot;&gt;Contract Alias&lt;&#x2F;a&gt; or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#contract-type&quot;&gt;Contract Types&lt;&#x2F;a&gt; in this package
that used this compiler to generate its outputs.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;All &lt;code&gt;contractTypes&lt;&#x2F;code&gt; that locally declare &lt;code&gt;runtimeBytecode&lt;&#x2F;code&gt;
&lt;strong&gt;should&lt;&#x2F;strong&gt; be attributed for by a compiler object.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;A single &lt;code&gt;contractTypes&lt;&#x2F;code&gt; &lt;strong&gt;must&lt;&#x2F;strong&gt; not be attributed to more than one
compiler.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Required&lt;&#x2F;strong&gt;: No&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Key&lt;&#x2F;strong&gt;: &lt;code&gt;contractTypes&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Type&lt;&#x2F;strong&gt;:  Array(&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#contract-alias&quot;&gt;Contract Alias&lt;&#x2F;a&gt;)&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;bip122-uri&quot;&gt;BIP122 URI&lt;&#x2F;h3&gt;
&lt;p&gt;BIP122 URIs are used to define a blockchain via a subset of the
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;bitcoin&#x2F;bips&#x2F;blob&#x2F;master&#x2F;bip-0122.mediawiki&quot;&gt;BIP-122&lt;&#x2F;a&gt;
spec.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;blockchain:&#x2F;&#x2F;&amp;lt;genesis_hash&amp;gt;&#x2F;block&#x2F;&amp;lt;latest confirmed block hash&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;&amp;lt;genesis hash&amp;gt;&lt;&#x2F;code&gt; represents the blockhash of the first block on the
chain, and &lt;code&gt;&amp;lt;latest confirmed block hash&amp;gt;&lt;&#x2F;code&gt; represents the hash of the
latest block that’s been reliably confirmed (package managers should be
free to choose their desired level of confirmations).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;glossary&quot;&gt;Glossary&lt;&#x2F;h3&gt;
&lt;p&gt;The terms in this glossary have been updated to reflect the changes made
in V3.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;abi&quot;&gt;ABI&lt;&#x2F;h4&gt;
&lt;p&gt;The JSON representation of the application binary interface. See the
official
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;solidity.readthedocs.io&#x2F;en&#x2F;develop&#x2F;abi-spec.html&quot;&gt;specification&lt;&#x2F;a&gt;
for more information.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;address&quot;&gt;Address&lt;&#x2F;h4&gt;
&lt;p&gt;A public identifier for an account on a particular chain&lt;&#x2F;p&gt;
&lt;h4 id=&quot;bytecode&quot;&gt;Bytecode&lt;&#x2F;h4&gt;
&lt;p&gt;The set of EVM instructions as produced by a compiler. Unless otherwise
specified this should be assumed to be hexadecimal encoded, representing
a whole number of bytes, and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#prefixed&quot;&gt;prefixed&lt;&#x2F;a&gt; with &lt;code&gt;0x&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Bytecode can either be linked or unlinked. (see
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#linking&quot;&gt;Linking&lt;&#x2F;a&gt;)&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Unlinked Bytecode&lt;&#x2F;strong&gt;: The hexadecimal representation of a contract’s EVM instructions that contains sections of code that requires &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#linking&quot;&gt;linking&lt;&#x2F;a&gt; for the contract to be functional.&lt;br&gt;The sections of code which are unlinked &lt;strong&gt;must&lt;&#x2F;strong&gt; be filled in with zero bytes.&lt;br&gt;&lt;strong&gt;Example&lt;&#x2F;strong&gt;: &lt;code&gt;0x606060405260e06000730000000000000000000000000000000000000000634d536f&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Linked Bytecode&lt;&#x2F;strong&gt;: The hexadecimal representation of a contract’s EVM instructions which has had all &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#link-reference&quot;&gt;Link References&lt;&#x2F;a&gt; replaced with the desired &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#link-value&quot;&gt;Link Values&lt;&#x2F;a&gt;. &lt;strong&gt;Example&lt;&#x2F;strong&gt;: &lt;code&gt;0x606060405260e06000736fe36000604051602001526040518160e060020a634d536f&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;chain-definition&quot;&gt;Chain Definition&lt;&#x2F;h4&gt;
&lt;p&gt;This definition originates from &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;bitcoin&#x2F;bips&#x2F;blob&#x2F;master&#x2F;bip-0122.mediawiki&quot;&gt;BIP122
URI&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;A URI in the format &lt;code&gt;blockchain:&#x2F;&#x2F;&amp;lt;chain_id&amp;gt;&#x2F;block&#x2F;&amp;lt;block_hash&amp;gt;&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;chain_id&lt;&#x2F;code&gt; is the unprefixed hexadecimal representation of the
genesis hash for the chain.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;block_hash&lt;&#x2F;code&gt; is the unprefixed hexadecimal representation of the
hash of a block on the chain.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;A chain is considered to match a chain definition if the genesis
block hash matches the &lt;code&gt;chain_id&lt;&#x2F;code&gt; and the block defined by &lt;code&gt;block_hash&lt;&#x2F;code&gt;
can be found on that chain. It is possible for multiple chains to match
a single URI, in which case all chains are considered valid matches&lt;&#x2F;p&gt;
&lt;h4 id=&quot;content-addressable-uri&quot;&gt;Content Addressable URI&lt;&#x2F;h4&gt;
&lt;p&gt;Any URI which contains a cryptographic hash which can be used to verify
the integrity of the content found at the URI.&lt;&#x2F;p&gt;
&lt;p&gt;The URI format is defined in RFC3986&lt;&#x2F;p&gt;
&lt;p&gt;It is &lt;strong&gt;recommended&lt;&#x2F;strong&gt; that tools support IPFS and Swarm.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;contract-alias&quot;&gt;Contract Alias&lt;&#x2F;h4&gt;
&lt;p&gt;This is a name used to reference a specific &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#contract-type&quot;&gt;Contract
Type&lt;&#x2F;a&gt;. Contract aliases &lt;strong&gt;must&lt;&#x2F;strong&gt; be unique within a
single &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#package&quot;&gt;Package&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The contract alias &lt;strong&gt;must&lt;&#x2F;strong&gt; use &lt;em&gt;one of&lt;&#x2F;em&gt; the following naming schemes:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;&amp;lt;contract-name&amp;gt;&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;&amp;lt;contract-name&amp;gt;&amp;lt;identifier&amp;gt;&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;code&gt;&amp;lt;contract-name&amp;gt;&lt;&#x2F;code&gt; portion &lt;strong&gt;must&lt;&#x2F;strong&gt; be the same as the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#contract-name&quot;&gt;Contract
Name&lt;&#x2F;a&gt; for this contract type.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;&amp;lt;identifier&amp;gt;&lt;&#x2F;code&gt; portion &lt;strong&gt;must&lt;&#x2F;strong&gt; match the regular expression
&lt;code&gt;^[-a-zA-Z0-9]{1,256}$&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;contract-instance&quot;&gt;Contract Instance&lt;&#x2F;h4&gt;
&lt;p&gt;A contract instance a specific deployed version of a &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#contract-type&quot;&gt;Contract
Type&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;All contract instances have an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#address&quot;&gt;Address&lt;&#x2F;a&gt; on some specific
chain.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;contract-instance-name&quot;&gt;Contract Instance Name&lt;&#x2F;h4&gt;
&lt;p&gt;A name which refers to a specific &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#contract-instance&quot;&gt;Contract
Instance&lt;&#x2F;a&gt; on a specific chain from the
deployments of a single &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#package&quot;&gt;Package&lt;&#x2F;a&gt;. This name &lt;strong&gt;must&lt;&#x2F;strong&gt; be
unique across all other contract instances for the given chain. The name
must conform to the regular expression
&lt;code&gt;^[a-zA-Z_$][a-zA-Z0-9_$]{0,255}$&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;In cases where there is a single deployed instance of a given &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#contract-type&quot;&gt;Contract
Type&lt;&#x2F;a&gt;, package managers &lt;strong&gt;should&lt;&#x2F;strong&gt; use the
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#contract-alias&quot;&gt;Contract Alias&lt;&#x2F;a&gt; for that contract type for this
name.&lt;&#x2F;p&gt;
&lt;p&gt;In cases where there are multiple deployed instances of a given contract
type, package managers &lt;strong&gt;should&lt;&#x2F;strong&gt; use a name which provides some added
semantic information as to help differentiate the two deployed instances
in a meaningful way.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;contract-name&quot;&gt;Contract Name&lt;&#x2F;h4&gt;
&lt;p&gt;The name found in the source code that defines a specific &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#contract-type&quot;&gt;Contract
Type&lt;&#x2F;a&gt;. These names &lt;strong&gt;must&lt;&#x2F;strong&gt; conform to the regular
expression &lt;code&gt;^[a-zA-Z_$][a-zA-Z0-9_$]{0,255}$&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;There can be multiple contracts with the same contract name in a
projects source files.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;contract-type&quot;&gt;Contract Type&lt;&#x2F;h4&gt;
&lt;p&gt;Refers to a specific contract in the package source. This term can be
used to refer to an abstract contract, a normal contract, or a library.
Two contracts are of the same contract type if they have the same
bytecode.&lt;&#x2F;p&gt;
&lt;p&gt;Example:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;contract Wallet {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;A deployed instance of the &lt;code&gt;Wallet&lt;&#x2F;code&gt; contract would be of of type
&lt;code&gt;Wallet&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;identifier&quot;&gt;Identifier&lt;&#x2F;h4&gt;
&lt;p&gt;Refers generally to a named entity in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#package&quot;&gt;Package&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;A string matching the regular expression
&lt;code&gt;^[a-zA-Z][-_a-zA-Z0-9]{0,255}$&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;link-reference&quot;&gt;Link Reference&lt;&#x2F;h4&gt;
&lt;p&gt;A location within a contract’s bytecode which needs to be linked. A link
reference has the following properties.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;offset&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: Defines the location within the bytecode where the link reference begins.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;length&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: Defines the length of the reference.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;name&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: (optional) A string to identify the reference.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;link-value&quot;&gt;Link Value&lt;&#x2F;h4&gt;
&lt;p&gt;A link value is the value which can be inserted in place of a &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#link-reference&quot;&gt;Link
Reference&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;linking&quot;&gt;Linking&lt;&#x2F;h4&gt;
&lt;p&gt;The act of replacing &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#link-reference&quot;&gt;Link References&lt;&#x2F;a&gt; with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#link-value&quot;&gt;Link
Values&lt;&#x2F;a&gt; within some &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#bytecode&quot;&gt;Bytecode&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;package&quot;&gt;Package&lt;&#x2F;h4&gt;
&lt;p&gt;Distribution of an application’s source or compiled bytecode along with
metadata related to authorship, license, versioning, et al.&lt;&#x2F;p&gt;
&lt;p&gt;For brevity, the term &lt;strong&gt;Package&lt;&#x2F;strong&gt; is often used metonymously to mean
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#package-manifest&quot;&gt;Package Manifest&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;package-manifest&quot;&gt;Package Manifest&lt;&#x2F;h4&gt;
&lt;p&gt;A machine-readable description of a package.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;prefixed&quot;&gt;Prefixed&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#bytecode&quot;&gt;Bytecode&lt;&#x2F;a&gt; string with leading &lt;code&gt;0x&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Example&lt;&#x2F;strong&gt;: &lt;code&gt;0xdeadbeef&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;unprefixed&quot;&gt;Unprefixed&lt;&#x2F;h4&gt;
&lt;p&gt;Not &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;#prefixed&quot;&gt;Prefixed&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Example&lt;&#x2F;strong&gt;: &lt;code&gt;deadbeef&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;minification&quot;&gt;Minification&lt;&#x2F;h3&gt;
&lt;p&gt;EthPM packages are distributed as alphabetically-ordered &amp;amp; minified JSON to ensure consistency.
Since packages are published on content-addressable filesystems (eg. IPFS), this restriction
guarantees that any given set of contract assets will always resolve to the same content-addressed URI.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;package-names&quot;&gt;Package Names&lt;&#x2F;h3&gt;
&lt;p&gt;Package names are restricted to lower-case characters, numbers, and &lt;code&gt;-&lt;&#x2F;code&gt; to improve the readability
of the package name, in turn improving the security properties for a package. A user is more likely
to accurately identify their target package with this restricted set of characters, and not confuse
a malicious package that disguises itself as a trusted package with similar but different
characters (e.g. &lt;code&gt;O&lt;&#x2F;code&gt; and &lt;code&gt;0&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;bip122&quot;&gt;BIP122&lt;&#x2F;h3&gt;
&lt;p&gt;The BIP-122 standard has been used since EthPM v1 since it is an industry standard URI scheme for
identifying different blockchains and distinguishing between forks.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;compilers-1&quot;&gt;Compilers&lt;&#x2F;h3&gt;
&lt;p&gt;Compilers are now defined in a top-level array, simplifying the task for tooling to identify the compiler types
needed to interact with or validate the contract assets. This also removes unnecessarily duplicated
information, should multiple &lt;code&gt;contractTypes&lt;&#x2F;code&gt; share the same compiler type.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;To improve understanding and readability of the EthPM spec, the
&lt;code&gt;manifest_version&lt;&#x2F;code&gt; field was updated to &lt;code&gt;manifest&lt;&#x2F;code&gt; in v3. To ensure
backwards compatibility, v3 packages &lt;strong&gt;must&lt;&#x2F;strong&gt; define a top-level
&lt;code&gt;&quot;manifest&quot;&lt;&#x2F;code&gt; with a value of &lt;code&gt;&quot;ethpm&#x2F;3&quot;&lt;&#x2F;code&gt;. Additionally,
&lt;code&gt;&quot;manifest_version&quot;&lt;&#x2F;code&gt; is a forbidden top-level key in v3 packages.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Using EthPM packages implicitly requires importing &amp;amp;&#x2F;or executing code written by others. The EthPM spec
guarantees that when using a properly constructed and released EthPM package, the user will have the exact same
code that was included in the package by the package author. However, it is impossible to guarantee that this code
is safe to interact with. Therefore, it is critical that end users only interact with EthPM packages authored and
released by individuals or organizations that they trust to include non-malicious code.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Repricing of precompiles and Keccak256 function</title>
        <published>2020-05-22T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Vlasov</name><uri>https://github.com/shamatar</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2666/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip2666-global-precompiles-repricing-and-many-more-discussion-thread/4332" />
        

        <id>https://wg-eips.ritovision.com/2666/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2666"
            label="EIP-2666" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2666/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP tries to set prices of certain precompiles and built-in EVM function to be in line with their performance, consumed resources and newer changes in EVM itself.&lt;&#x2F;p&gt;
&lt;p&gt;New price formulas are proposed for:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;SHA256 precompile (&lt;code&gt;0x02&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;RIPEMD precompile (&lt;code&gt;0x03&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;KECCAK256 opcode (&lt;code&gt;0x20&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Costs of many precompiles and built-in functions are invalid at the current state of the clients. This EIP contains a list of changes to the pricing formulas to better reflect underlying computations&#x27; structure.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Historical pricing for these functions in EVM does not reflect inner structure of the underlying computations (inner structure of the hash functions).&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;EIP-2046 changes a &lt;code&gt;STATICCALL (0xfa)&lt;&#x2F;code&gt; cost to precompile and it may be necessary to adjust costs of some precompiles that &lt;em&gt;may&lt;&#x2F;em&gt; have taken old large cost (&lt;code&gt;700&lt;&#x2F;code&gt; gas) into account and tried to compensate for it&lt;&#x2F;li&gt;
&lt;li&gt;Some precompiles are overpriced and their pricing formulas do not reflect the structure of underlying functions&lt;&#x2F;li&gt;
&lt;li&gt;Keccak256 built-in function (opcode) in EVM has pricing that does not reflect underlying hash function structure&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;If &lt;code&gt;block_number &amp;gt;= X&lt;&#x2F;code&gt; set the gas cost of the following precompiles and Keccak256 opcode:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;SHA256 (precompile &lt;code&gt;0x02&lt;&#x2F;code&gt;): &lt;code&gt;10 + ((len(input) + 8)&#x2F;64 + 1) * 9&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;RIPEMD (precompile &lt;code&gt;0x03&lt;&#x2F;code&gt;): &lt;code&gt;6 + ((len(input) + 8)&#x2F;64 + 1) * 12&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;KECCAK256 (&lt;code&gt;0x20&lt;&#x2F;code&gt;): &lt;code&gt;13 + (len(input)&#x2F;136 + 1)*15&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This EIP &lt;em&gt;ideally&lt;&#x2F;em&gt; requires that &lt;code&gt;MODEXP&lt;&#x2F;code&gt; repricing is &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2565&#x2F;&quot;&gt;implemented&lt;&#x2F;a&gt; to also accurately reflect that there is no implicit compensation for an old &lt;code&gt;STATICCALL (0xfa)&lt;&#x2F;code&gt; cost (pre-2046).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Cost of functions being executed must accurately reflect real CPU time spent on computations, so benchmarking was performed for current precompiles and Keccak256 function to measure running time versus input parameters.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;detailed-summary-of-repricing-approach&quot;&gt;Detailed summary of repricing approach&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP relies on two facts:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;apriori knowledge of the inner strucute of the hash functions&lt;&#x2F;li&gt;
&lt;li&gt;benchmarks provided by the client teams for some reasonable range of input lengths for random inputs (random byte strings of a given length)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;benchmarks-on-the-most-popular-clients&quot;&gt;Benchmarks on the most popular clients&lt;&#x2F;h3&gt;
&lt;p&gt;Necessary benchmarks for EIP-2666 were provided by the clients and raw form is assembled in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;docs.google.com&#x2F;spreadsheets&#x2F;d&#x2F;1aCQnk7prrp3Mbcf011BE5zZnkbc3Iw7QAixn6mLbKS0&#x2F;edit?usp=sharing&quot;&gt;here&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;SHA256 precompile&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Currently it&#x27;s &lt;code&gt;60&lt;&#x2F;code&gt; gas + &lt;code&gt;12&lt;&#x2F;code&gt; gas per &lt;code&gt;32&lt;&#x2F;code&gt; byte word (number of words is &lt;code&gt;ceil(len(input)&#x2F;word_len)&lt;&#x2F;code&gt; here and in similar places. If there is no &lt;code&gt;floor&lt;&#x2F;code&gt; or &lt;code&gt;ceil&lt;&#x2F;code&gt; specifier all divisions below are integer divisions (floor divisions)). Proposed formula is &lt;code&gt;A * ((len(input) + 8) &#x2F; 64 + 1) + B&lt;&#x2F;code&gt;, with coefficients below&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;&#x2F;th&gt;&lt;th&gt;A&lt;&#x2F;th&gt;&lt;th&gt;B&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Geth&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;OE&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;9&lt;&#x2F;td&gt;&lt;td&gt;4&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Besu&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;td&gt;10&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Nethermind&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;10&lt;&#x2F;td&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;EIP-2666 proposes &lt;code&gt;A = 9&lt;&#x2F;code&gt;, &lt;code&gt;B = 10&lt;&#x2F;code&gt;. There are no large one-off costs in this precompile, so it&#x27;s EIP-2046 - safe.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;RIPEMD precompile&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Currently it&#x27;s &lt;code&gt;600&lt;&#x2F;code&gt; gas + &lt;code&gt;120&lt;&#x2F;code&gt; gas per &lt;code&gt;32&lt;&#x2F;code&gt; byte word. Proposed formula is &lt;code&gt;A * ((len(input) + 8) &#x2F; 64 + 1) + B&lt;&#x2F;code&gt;, with coefficients below&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;&#x2F;th&gt;&lt;th&gt;A&lt;&#x2F;th&gt;&lt;th&gt;B&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Geth&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;12&lt;&#x2F;td&gt;&lt;td&gt;6&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;OE&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;8&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Besu&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;29&lt;&#x2F;td&gt;&lt;td&gt;16&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Nethermind&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;10&lt;&#x2F;td&gt;&lt;td&gt;6&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;EIP-2666 proposes &lt;code&gt;A = 12&lt;&#x2F;code&gt;, &lt;code&gt;B = 6&lt;&#x2F;code&gt;. There are no large one-off costs in this precompile, so it&#x27;s EIP-2046 - safe. Besu expects to have performance improvements by the end of the year.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Keccak256 performance&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Currently it&#x27;s &lt;code&gt;30&lt;&#x2F;code&gt; gas + &lt;code&gt;6&lt;&#x2F;code&gt; gas per &lt;code&gt;32&lt;&#x2F;code&gt; byte word. Proposed formula is &lt;code&gt;A * (len(input) &#x2F; 136 + 1) + B&lt;&#x2F;code&gt;, with coefficients below&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;&#x2F;th&gt;&lt;th&gt;A&lt;&#x2F;th&gt;&lt;th&gt;B&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Geth&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;13&lt;&#x2F;td&gt;&lt;td&gt;13&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;OE&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;15&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Besu&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;19&lt;&#x2F;td&gt;&lt;td&gt;28&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Nethermind&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;16&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;EIP-2666 proposes &lt;code&gt;A = 15&lt;&#x2F;code&gt;, &lt;code&gt;B = 13&lt;&#x2F;code&gt;. There are no large one-off costs in this precompile, so it&#x27;s EIP-2046 - safe. Besu expects to have performance improvements by the end of the year.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;tooling-and-data&quot;&gt;Tooling and data&lt;&#x2F;h3&gt;
&lt;p&gt;Reference material (from benchmarks of different clients) with raw data can be found &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;docs.google.com&#x2F;spreadsheets&#x2F;d&#x2F;1aCQnk7prrp3Mbcf011BE5zZnkbc3Iw7QAixn6mLbKS0&#x2F;edit?usp=sharing&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;There is a repository available with inputs for benchmarking and precompiles testing &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;shamatar&#x2F;bench_precompiles&quot;&gt;here&lt;&#x2F;a&gt; that can be used by client teams to perform all the necessary measurements.&lt;&#x2F;p&gt;
&lt;p&gt;Raw Besu &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;gist.github.com&#x2F;shemnon&#x2F;0ddba91be501fa23291bdec9107fe99a&quot;&gt;benchmarks&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;note-on-formulas-structure&quot;&gt;Note on formulas structure&lt;&#x2F;h3&gt;
&lt;p&gt;There are terms in formulas that look like &lt;code&gt;A * 1&lt;&#x2F;code&gt; and those are explicitly not combined to the &lt;code&gt;B&lt;&#x2F;code&gt; coefficient to reflect that hash of an empty byte array requires to perform a round of hashing anyway.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Precompile repricings has happened in a past and can be considered standard procedure. Gas costs of many contracts is expected to reduce that may break re-entrancy protection measures based on fixed gas costs. In any case, such protection should have never been considered good and final.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Let&#x27;s consider a simple example of Keccak256 hash of &lt;code&gt;0&lt;&#x2F;code&gt;, &lt;code&gt;64&lt;&#x2F;code&gt; and &lt;code&gt;160&lt;&#x2F;code&gt; bytes that can is a simple sanity check for implementation.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Hash &lt;code&gt;0&lt;&#x2F;code&gt; bytes:
&lt;ul&gt;
&lt;li&gt;Old price: &lt;code&gt;30 + 6 * ceil(0 &#x2F; 32) = 30&lt;&#x2F;code&gt; gas&lt;&#x2F;li&gt;
&lt;li&gt;New price: &lt;code&gt;15 * (0&#x2F;136 + 1) + 13 = 28&lt;&#x2F;code&gt; gas&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Hash &lt;code&gt;64&lt;&#x2F;code&gt; bytes
&lt;ul&gt;
&lt;li&gt;Old price: &lt;code&gt;30 + 6 * ceil(64 &#x2F; 32) = 42&lt;&#x2F;code&gt; gas&lt;&#x2F;li&gt;
&lt;li&gt;New price: &lt;code&gt;15 * (64&#x2F;136 + 1) + 13 = 28&lt;&#x2F;code&gt; gas&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Hash &lt;code&gt;160&lt;&#x2F;code&gt; bytes
&lt;ul&gt;
&lt;li&gt;Old price: &lt;code&gt;30 + 6 * ceil(160 &#x2F; 32) = 60&lt;&#x2F;code&gt; gas&lt;&#x2F;li&gt;
&lt;li&gt;New price: &lt;code&gt;15 * (160&#x2F;136 + 1) + 13 = 43&lt;&#x2F;code&gt; gas&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;There is no reference implementation at the time of writing as it requires just a simple change of constants in major clients.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;As described in backward compatibility section in some cases reduction of cost may allow e.g. re-entrancy that was not expected before, but we think that re-entrancy protection based on fixed gas costs is anyway flawed design decision.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Limit size of `initcode`</title>
        <published>2020-05-18T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Martin Holst Swende</name><uri>https://github.com/holiman</uri>
	</author>
	
	<author>
		<name>Paweł Bylica</name><uri>https://github.com/chfast</uri>
	</author>
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2677/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2677-limit-size-of-initcode/4550" />
        

        <id>https://wg-eips.ritovision.com/2677/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        

        
        <category
            term="tag:eip:2677"
            label="EIP-2677" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2677/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Enforce a maximum size limit (&lt;code&gt;max_initcode_size&lt;&#x2F;code&gt;) of &lt;code&gt;49152&lt;&#x2F;code&gt; (&lt;code&gt;0xc000&lt;&#x2F;code&gt;) for &lt;code&gt;initcode&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Enforce a maximum size limit (&lt;code&gt;max_initcode_size&lt;&#x2F;code&gt;) for &lt;code&gt;initcode&lt;&#x2F;code&gt;. If the size of &lt;code&gt;initcode&lt;&#x2F;code&gt; exceeds &lt;code&gt;max_initcode_size&lt;&#x2F;code&gt;, then contract creation fails with an out of gas error.&lt;&#x2F;p&gt;
&lt;p&gt;Since &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;170&#x2F;&quot;&gt;EIP-170&lt;&#x2F;a&gt; was implemented, there has been a size limit of &lt;code&gt;24576&lt;&#x2F;code&gt; (&lt;code&gt;0x6000&lt;&#x2F;code&gt;) on contract code. We propose to also limit the size of executable code to &lt;code&gt;2x&lt;&#x2F;code&gt; the above limit, i.e. &lt;code&gt;49152&lt;&#x2F;code&gt; (&lt;code&gt;0xc000&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;This also leads to two nice properties:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;instruction offset in code fits 16-bit value,&lt;&#x2F;li&gt;
&lt;li&gt;code size fits 16-bit value.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;When a client executes &lt;code&gt;initcode&lt;&#x2F;code&gt;, the client has to perform a jumpdest analysis. In some cases, the client also performs a &lt;code&gt;hash&lt;&#x2F;code&gt; of the code:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;To use as a key in a mapping containing the result of a jumpdest analysis&lt;&#x2F;li&gt;
&lt;li&gt;To use for address calculation within &lt;code&gt;CREATE2&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The work performed during a jumpdest analysis scales linearly with the size of the code. Currently, a transaction can expand the memory once, and reuse the same memory segment (with minor modifications) to force the client to perform a lot of analysis&#x2F;hashing, leading to slow block processing.&lt;&#x2F;p&gt;
&lt;p&gt;Historically, this was exploited in June 2017, precipitating the 1.6.5-patch release of &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;go-ethereum&#x2F;releases&#x2F;tag&#x2F;v1.6.5&quot;&gt;geth&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The work performed during address calculation within &lt;code&gt;CREATE2&lt;&#x2F;code&gt; is charged in proportion with size of the code.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;There are three situations where this is applicable:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;CREATE&lt;&#x2F;code&gt;,&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CREATE2&lt;&#x2F;code&gt;,&lt;&#x2F;li&gt;
&lt;li&gt;creation using a transaction with empty receiver.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In all these (and future) cases, the EVM should fail with Out Of Gas error if the code has a length more than &lt;code&gt;max_initcode_size&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;TBA&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP requires a &quot;network upgrade&quot;, since it modifies consensus-rules.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;For client implementations, this EIP makes attacks based on jumpdest-analysis or hashing of code less problematic, so should increase the robustness of clients.&lt;&#x2F;p&gt;
&lt;p&gt;For layer 2, this EIP introduces failure-modes where there previously were none. There &lt;em&gt;could&lt;&#x2F;em&gt; exist factory-contracts which deploy multi-level contract hierarchies, such that the code for multiple contracts are included in the initcode of the first contract. The author(s) of this EIP are not aware of any such contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases should include the following cases,&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;CREATE&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;CREATE2&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;tx create&lt;&#x2F;code&gt; with &lt;code&gt;initcode_size&lt;&#x2F;code&gt; at &lt;code&gt;max_initcode_size&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CREATE&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;CREATE2&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;tx create&lt;&#x2F;code&gt; with &lt;code&gt;initcode_size&lt;&#x2F;code&gt; at &lt;code&gt;max_initcode_size+1&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TBA&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Hierarchical Deterministic Wallet for Layer-2</title>
        <published>2020-05-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Tom Brand</name><email>tom@starkware.co</email>
	</author>
	
	<author>
		<name>Louis Guthmann</name><email>louis@starkware.co</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2645/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/hierarchical-deterministic-wallet-for-computation-integrity-proof-cip-layer-2/4286" />
        

        <id>https://wg-eips.ritovision.com/2645/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2645"
            label="ERC-2645" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2645/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;In the context of Computation Integrity Proof (CIP) Layer-2 solutions such as ZK-Rollups, users are required to sign messages on new elliptic curves optimized for those environments. We leverage existing work on Key Derivation (&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;bitcoin&#x2F;bips&#x2F;blob&#x2F;master&#x2F;bip-0032.mediawiki&quot;&gt;BIP32&lt;&#x2F;a&gt;, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;bitcoin&#x2F;bips&#x2F;blob&#x2F;master&#x2F;bip-0039.mediawiki&quot;&gt;BIP39&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;bitcoin&#x2F;bips&#x2F;blob&#x2F;master&#x2F;bip-0044.mediawiki&quot;&gt;BIP44&lt;&#x2F;a&gt;) to define an efficient way to securely produce CIP L2s private keys, as well as creating domain separation between Layer-2 applications.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;We provide a Derivation Path allowing a user to derive hierarchical keys for Layer-2 solutions depending on the zk-technology, the application, the user’s Layer-1 address, as well as an efficient grinding method to enforce the private key distribution within the curve domain. The propose Derivation Path is defined as follow&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;m &#x2F; purpose&amp;#39; &#x2F; layer&amp;#39; &#x2F; application&amp;#39; &#x2F; eth_address_1&amp;#39; &#x2F; eth_address_2&amp;#39; &#x2F; index&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;In the context of Computation Integrity Proof (CIP) Layer-2 solutions such as ZK-Rollups, users are required to sign messages on new elliptic curves optimized for those environments. Extensive work has been done to make it secure on Bitcoin via &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;bitcoin&#x2F;bips&#x2F;blob&#x2F;master&#x2F;bip-0032.mediawiki&quot;&gt;BIP32&lt;&#x2F;a&gt;, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;bitcoin&#x2F;bips&#x2F;blob&#x2F;master&#x2F;bip-0039.mediawiki&quot;&gt;BIP39&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;bitcoin&#x2F;bips&#x2F;blob&#x2F;master&#x2F;bip-0044.mediawiki&quot;&gt;BIP44&lt;&#x2F;a&gt;. These protocols are the standard for wallets in the entire industry, independent of the underlying blockchain. As Layer-2 solutions are taking off, it is a necessary requirement to maintain the same standard and security in this new space.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Starkware keys are derived with the following &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;bitcoin&#x2F;bips&#x2F;blob&#x2F;master&#x2F;bip-0043.mediawiki&quot;&gt;BIP43&lt;&#x2F;a&gt;-compatible derivation path, with direct inspiration from &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;bitcoin&#x2F;bips&#x2F;blob&#x2F;master&#x2F;bip-0044.mediawiki&quot;&gt;BIP44&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;m &#x2F; purpose&amp;#39; &#x2F; layer&amp;#39; &#x2F; application&amp;#39; &#x2F; eth_address_1&amp;#39; &#x2F; eth_address_2&amp;#39; &#x2F; index&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;m&lt;&#x2F;code&gt; - the seed.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;purpose&lt;&#x2F;code&gt; - &lt;code&gt;2645&lt;&#x2F;code&gt; (the number of this EIP).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;layer&lt;&#x2F;code&gt; - the 31 lowest bits of sha256 on the layer name. Serve as a domain separator between different technologies. In the context of &lt;code&gt;starkex&lt;&#x2F;code&gt;, the value would be &lt;code&gt;579218131&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;application&lt;&#x2F;code&gt; - the 31 lowest bits of sha256 of the application name. Serve as a domain separator between different applications. In the context of DeversiFi in June 2020, it is the 31 lowest bits of sha256(starkexdvf) and the value would be &lt;code&gt;1393043894&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;eth_address_1 &#x2F; eth_address_2&lt;&#x2F;code&gt; - the first and second 31 lowest bits of the corresponding eth_address.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;index&lt;&#x2F;code&gt; - to allow multiple keys per eth_address.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;As example, the expected path for address 0x0000....0000 assuming seed &lt;code&gt;m&lt;&#x2F;code&gt; and index 0 in the context of DeversiFi in June 2020: &lt;code&gt;m&#x2F;2645&#x27;&#x2F;579218131&#x27;&#x2F;1393043894&#x27;&#x2F;0&#x27;&#x2F;0&#x27;&#x2F;0&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The key derivation should follow the following algorithm&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;N = 2**256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;n = Layer2 curve order&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;path = stark derivation path&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;BIP32() = Official BIP-0032 derivation function on secp256k1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;hash = SHA256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;i = 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;root_key = BIP32(path)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;while True:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	key = hash(root_key|i)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	if (key &amp;lt; (N - (N % n))):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		return key % n&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	i++&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This algorithm has been defined to maintain efficiency on existing restricted devices.&lt;&#x2F;p&gt;
&lt;p&gt;Nota Bene: At each round, the probability for a key to be greater than (N - (N % n)) is &amp;lt; 2^(-5).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP specifies two aspects of keys derivation in the context of Hierarchical Wallets:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Derivation Path&lt;&#x2F;li&gt;
&lt;li&gt;Grinding Algorithm to enforce a uniform distribution over the elliptic curve.
The derivation path is defined to allow efficient keys separation based on technology and application while maintaining a 1-1 relation with the Layer-1 wallet. In such a way, losing EIP-2645 wallets falls back to losing the Layer-1 wallet.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This standard complies with BIP43.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP has been defined to maintain separation of keys while providing foolproof logic on key derivation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Non-Fungible Token with mortgage and rental functions</title>
        <published>2020-04-25T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Kohshi Shiba</name><email>kohshi.shiba@gmail.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2615/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/2616" />
        

        <id>https://wg-eips.ritovision.com/2615/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:2615"
            label="ERC-2615" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2615/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;This standard proposes an extension to ERC721 Non-Fungible Tokens (NFTs) to support rental and mortgage functions. These functions are necessary for NFTs to emulate real property, just like those in the real world.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is an extension of ERC721. It proposes additional roles, the right of tenants to enable rentals, and the right of lien.&lt;&#x2F;p&gt;
&lt;p&gt;With ERC2615, NFT owners will be able to rent out their NFTs and take out a mortgage by collateralizing their NFTs. For example, this standard can apply to:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Virtual items (in-game assets, virtual artwork, etc.)&lt;&#x2F;li&gt;
&lt;li&gt;Physical items (houses, automobiles, etc.)&lt;&#x2F;li&gt;
&lt;li&gt;Intellectual property rights&lt;&#x2F;li&gt;
&lt;li&gt;DAO membership tokens&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;NFT developers are also able to easily integrate ERC2615 since it is fully backwards-compatible with the ERC721 standard.&lt;&#x2F;p&gt;
&lt;p&gt;One notable point is that the person who has the right to use an application is not the owner but the user (i.e. tenant). Application developers must implement this specification into their applications.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;It has been challenging to implement rental and mortgage functions with the ERC721 standard because it only has one role defined (which is the Owner).&lt;&#x2F;p&gt;
&lt;p&gt;Currently, a security deposit is needed for trustless renting with ERC721, and ownership lockup within a contract is necessary whenever one chooses to mortgage their ERC721 property. The tracking and facilitation of these relationships must be done separately from the ERC721 standard.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal eliminates these requirements by integrating basic rights of tenantship and liens. By standardizing these functions, developers can more easily integrate rental and mortgage functions for their applications.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;This standard proposes three user roles: the &lt;strong&gt;Lien Holder&lt;&#x2F;strong&gt;, the &lt;strong&gt;Owner&lt;&#x2F;strong&gt;, and the &lt;strong&gt;User&lt;&#x2F;strong&gt;. Their rights are as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;A &lt;strong&gt;Lien Holder&lt;&#x2F;strong&gt; has the right to:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Transfer the &lt;strong&gt;Owner&lt;&#x2F;strong&gt; role&lt;&#x2F;li&gt;
&lt;li&gt;Transfer the &lt;strong&gt;User&lt;&#x2F;strong&gt; role&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;An &lt;strong&gt;Owner&lt;&#x2F;strong&gt; has the right to:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Transfer the &lt;strong&gt;Owner&lt;&#x2F;strong&gt; role&lt;&#x2F;li&gt;
&lt;li&gt;Transfer the &lt;strong&gt;User&lt;&#x2F;strong&gt; role&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;A &lt;strong&gt;User&lt;&#x2F;strong&gt; has the right to:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Transfer the &lt;strong&gt;User&lt;&#x2F;strong&gt; role&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;erc-2615-interface&quot;&gt;ERC-2615 Interface&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransferUser&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; itemId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ApprovalForUser&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approved&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; itemId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransferOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; itemId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ApprovalForOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approved&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; itemId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ApprovalForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approved&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; LienApproval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; itemId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TenantRightApproval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; itemId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; LienSet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; itemId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; status&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TenantRightSet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; itemId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; status&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOfOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOfUser&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; userOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; itemId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; itemId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeTransferOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; itemId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeTransferOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; itemId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeTransferUser&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; itemId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeTransferUser&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; itemId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approveForOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; itemId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getApprovedForOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; itemId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approveForUser&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; itemId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getApprovedForUser&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; itemId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setApprovalForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approved&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isApprovedForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; requester&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approveLien&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; itemId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getApprovedLien&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; itemId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setLien&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; itemId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getCurrentLien&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; itemId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revokeLien&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; itemId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approveTenantRight&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; itemId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getApprovedTenantRight&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; itemId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setTenantRight&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; itemId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getCurrentTenantRight&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; itemId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revokeTenantRight&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; itemId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;erc-2615-receiver&quot;&gt;ERC-2615 Receiver&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onERCXReceived&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; itemId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; layer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;erc-2615-extensions&quot;&gt;ERC-2615 Extensions&lt;&#x2F;h3&gt;
&lt;p&gt;Extensions here are provided to help developers build with this standard.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;1-erc721-compatible-functions&quot;&gt;1. ERC721 Compatible functions&lt;&#x2F;h4&gt;
&lt;p&gt;This extension makes this standard compatible with ERC721. By adding the following functions, developers can take advantage of the existing tools for ERC721.&lt;&#x2F;p&gt;
&lt;p&gt;Transfer functions in this extension will transfer both the &lt;strong&gt;Owner&lt;&#x2F;strong&gt; and &lt;strong&gt;User&lt;&#x2F;strong&gt; roles when the tenant right has not been set. Conversely, when the tenant right has been set, only the &lt;strong&gt;Owner&lt;&#x2F;strong&gt; role will be transferred.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; itemId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; itemId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getApproved&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; itemId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; itemId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; itemId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; itemId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; pubic&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;2-enumerable&quot;&gt;2. Enumerable&lt;&#x2F;h4&gt;
&lt;p&gt;This extension is analogous to the enumerable extension of the ERC721 standard.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalNumberOfItems&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; itemOfOwnerByIndex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; index&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; layer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; itemId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; itemByIndex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;3-metadata&quot;&gt;3. Metadata&lt;&#x2F;h4&gt;
&lt;p&gt;This extension is analogous to the metadata extension of the ERC721 standard.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; itemURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; itemId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; symbol&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;how-rentals-and-mortgages-work&quot;&gt;How rentals and mortgages work&lt;&#x2F;h2&gt;
&lt;p&gt;This standard does not deal with token or value transfer. Other logic (outside the scope of this standard) must be used to orchestrate these transfers and to implement validation of payment.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;mortgage-functions&quot;&gt;Mortgage functions&lt;&#x2F;h3&gt;
&lt;p&gt;The following diagram demonstrates the mortgaging functionality.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2615&#x2F;.&#x2F;assets&#x2F;mortgage-sequential.jpg&quot; alt=&quot;concept image&quot; title=&quot;mortgage&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Suppose Alice owns an NFT and wants to take out a mortgage, and Bob wants to earn interest by lending tokens to Alice.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Alice approves the setting of a lien for the NFT Alice owns.&lt;&#x2F;li&gt;
&lt;li&gt;Alice sends a loan request to the mortgage contract.&lt;&#x2F;li&gt;
&lt;li&gt;Bob fills the loan request and transfers tokens to the mortgage contract. The lien is then set on the NFT by the mortgage contract.&lt;&#x2F;li&gt;
&lt;li&gt;Alice can now withdraw the borrowed tokens from the mortgage contract.&lt;&#x2F;li&gt;
&lt;li&gt;Alice registers repayment (anyone can pay the repayment).&lt;&#x2F;li&gt;
&lt;li&gt;Bob can finish the agreement if the agreement period ends and the agreement is kept (i.e. repayment is paid without delay).&lt;&#x2F;li&gt;
&lt;li&gt;Bob can revoke the agreement if the agreement is breached (e.g. repayment is not paid on time) and execute the lien and take over the ownership of the NFT.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;rental-functions&quot;&gt;Rental functions&lt;&#x2F;h3&gt;
&lt;p&gt;The following diagram demonstrates the rental functionality.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2615&#x2F;.&#x2F;assets&#x2F;rental-sequential.jpg&quot; alt=&quot;concept image&quot; title=&quot;rental&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Suppose Alice owns NFTs and wants to rent out a NFT, and Bob wants to lease a NFT.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Alice approves the setting of a tenant-right for the NFT Alice owns.&lt;&#x2F;li&gt;
&lt;li&gt;Alice sends a rental listing to the rental contract.&lt;&#x2F;li&gt;
&lt;li&gt;Bob fills the rental request, and the right to use the NFT is transferred to Bob. At the same time, the tenant-right is set, and Alice becomes not able to transfer the right to use the NFT.&lt;&#x2F;li&gt;
&lt;li&gt;Bob registers rent (anyone can pay the rent).&lt;&#x2F;li&gt;
&lt;li&gt;Alice can withdraw the rent from the rental contract.&lt;&#x2F;li&gt;
&lt;li&gt;Alice can finish the agreement if the agreement period has ended and the agreement is kept (i.e. rent is paid without delay).&lt;&#x2F;li&gt;
&lt;li&gt;Alice can revoke the agreement if the agreement is breached (e.g. rent is not paid on time) and revoke the tenant-right and take over the right to use the NFT.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;There have been some attempts to achieve rentals or mortgages with ERC721. However, as I noted before, it has been challenging to achieve. I will explain the reasons and advantages of this standard below.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;no-security-lockup-for-rentals&quot;&gt;No security lockup for rentals&lt;&#x2F;h3&gt;
&lt;p&gt;To achieve trustless rental of NFTs with ERC721, it has been necessary to deposit funds as security. This is required to prevent malicious activity from tenants, as it is impossible to take back ownership once it is transferred.&lt;&#x2F;p&gt;
&lt;p&gt;With this standard, security deposits are no longer needed since the standard natively supports rental and tenantship functions.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;no-ownership-escrow-when-taking-out-a-mortgage&quot;&gt;No ownership escrow when taking out a mortgage&lt;&#x2F;h3&gt;
&lt;p&gt;In order to take out a mortgage on NFTs, it has been necessary to transfer the NFTs to a contract as collateral. This is required to prevent the potential default risk of the mortgage.&lt;&#x2F;p&gt;
&lt;p&gt;However, secured collateral with ERC721 hurts the utility of the NFT. Since most NFT applications provide services to the canonical owner of a NFT, the NFT essentially cannot be utilized under escrow.&lt;&#x2F;p&gt;
&lt;p&gt;With ERC2615, it is possible to collateralize NFTs and use them at the same time.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;easy-integration&quot;&gt;Easy integration&lt;&#x2F;h3&gt;
&lt;p&gt;Because of the above reasons, a great deal of effort is required to implement rental and mortgage functions with ERC721. Adopting this standard is a much easier way to integrate rental and mortgage functionality.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;no-money-token-transactions-within-tokens&quot;&gt;No money&#x2F;token transactions within tokens&lt;&#x2F;h3&gt;
&lt;p&gt;A NFT itself does not handle lending or rental functions directly. This standard is open-source, and there is no platform lockup. Developers can integrate it without having to worry about those risks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backward-compatibility&quot;&gt;Backward compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;As mentioned in the specifications section, this standard can be fully ERC721 compatible by adding an extension function set.&lt;&#x2F;p&gt;
&lt;p&gt;In addition, new functions introduced in this standard have many similarities with the existing functions in ERC721. This allows developers to easily adopt the standard quickly.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;When running the tests, you need to create a test network with Ganache-CLI:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ganache-cli -a 15  --gasLimit=0x1fffffffffffff -e 1000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;And then run the tests using Truffle:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;truffle test -e development&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Powered by Truffle and Openzeppelin test helper.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;kohshiba&#x2F;ERC-X&quot;&gt;Github Repository&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Since the external contract will control lien or tenant rights, flaws within the external contract directly lead to the standard&#x27;s unexpected behavior.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Limit account nonce to 2^64-1</title>
        <published>2020-04-25T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2681/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2681-limit-account-nonce-to-2-64-1/4324" />
        

        <id>https://wg-eips.ritovision.com/2681/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:2681"
            label="EIP-2681" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2681/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Limit account nonce to be between &lt;code&gt;0&lt;&#x2F;code&gt; and &lt;code&gt;2^64-1&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Account nonces are currently specified to be arbitrarily long unsigned integers. Dealing with arbitrary length data in the state witnesses is not optimal, therefore this EIP will allow proofs to represent the nonce in a more optimized way.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally it could prove beneficial to transaction formats, where some improvements are potentially sought by at least three other proposals.&lt;&#x2F;p&gt;
&lt;p&gt;Lastly, this facilitates a minor optimisation in clients, because the nonce no longer needs to be kept as a 256-bit number.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce two new restrictions retroactively from genesis:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Consider any transaction invalid, where the nonce exceeds or equals to &lt;code&gt;2^64-1&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;CREATE&lt;&#x2F;code&gt; and &lt;code&gt;CREATE2&lt;&#x2F;code&gt; instructions&#x27; execution ends with the result &lt;code&gt;0&lt;&#x2F;code&gt; pushed on stack, where the account nonce is &lt;code&gt;2^64-1&lt;&#x2F;code&gt;. Gas for initcode execution is not deducted in this case.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;It is unlikely for any nonce to reach or exceed the proposed limit. If one would want to reach that limit via external transactions, it would cost at least &lt;code&gt;21000 * (2^64-1) = 387_381_625_547_900_583_915_000&lt;&#x2F;code&gt; gas.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;It must be noted that in the past, in the Morden testnet, each new account had a starting nonce of &lt;code&gt;2^20&lt;&#x2F;code&gt; in order to differentiate transactions from mainnet transactions.
This mode of replay protection is out of fashion since &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt; introduced a more elegant way using chain identifiers.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Most clients already consider the nonce field to be 64-bit, such as go-ethereum.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The reason a transaction with nonce &lt;code&gt;2^64-1&lt;&#x2F;code&gt; is invalid, because otherwise after inclusion the sender account&#x27;s nonce would exceed &lt;code&gt;2^64-1&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;While this is a breaking change, no actual effect should be visible:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;There is no account in the state currently which would have a nonce exceeding that value. As of November 2020, the account &lt;code&gt;0xea674fdde714fd979de3edf0f56aa9716b898ec8&lt;&#x2F;code&gt; is responsible for the highest account nonce at approximately 29 million.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;go-ethereum already has this restriction partially in place (&lt;code&gt;state.Account.Nonce&lt;&#x2F;code&gt; and &lt;code&gt;types.txdata.AccountNonce&lt;&#x2F;code&gt; it as a 64-bit number).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;None.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Permit Extension for EIP-20 Signed Approvals</title>
        <published>2020-04-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Martin Lundfall</name><uri>https://github.com/Mrchico</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2612/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/2613" />
        

        <id>https://wg-eips.ritovision.com/2612/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2612"
            label="ERC-2612" />
        

        
        

        
        <summary type="html">EIP-20 approvals via EIP-712 secp256k1 signatures</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2612/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Arguably one of the main reasons for the success of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;EIP-20&lt;&#x2F;a&gt; tokens lies in the interplay between &lt;code&gt;approve&lt;&#x2F;code&gt; and &lt;code&gt;transferFrom&lt;&#x2F;code&gt;, which allows for tokens to not only be transferred between externally owned accounts (EOA), but to be used in other contracts under application specific conditions by abstracting away &lt;code&gt;msg.sender&lt;&#x2F;code&gt; as the defining mechanism for token access control.&lt;&#x2F;p&gt;
&lt;p&gt;However, a limiting factor in this design stems from the fact that the EIP-20 &lt;code&gt;approve&lt;&#x2F;code&gt; function itself is defined in terms of &lt;code&gt;msg.sender&lt;&#x2F;code&gt;. This means that user&#x27;s &lt;em&gt;initial action&lt;&#x2F;em&gt; involving EIP-20 tokens must be performed by an EOA (&lt;em&gt;but see Note below&lt;&#x2F;em&gt;). If the user needs to interact with a smart contract, then they need to make 2 transactions (&lt;code&gt;approve&lt;&#x2F;code&gt; and the smart contract call which will internally call &lt;code&gt;transferFrom&lt;&#x2F;code&gt;). Even in the simple use case of paying another person, they need to hold ETH to pay for transaction gas costs.&lt;&#x2F;p&gt;
&lt;p&gt;This ERC extends the EIP-20 standard with a new function &lt;code&gt;permit&lt;&#x2F;code&gt;, which allows users to modify the &lt;code&gt;allowance&lt;&#x2F;code&gt; mapping using a signed message, instead of through &lt;code&gt;msg.sender&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;For an improved user experience, the signed data is structured following &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt;, which already has wide spread adoption in major RPC providers.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Note:&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt; EIP-20 must be performed by an EOA unless the address owning the token is actually a contract wallet. Although contract wallets solves many of the same problems that motivates this EIP, they are currently only scarcely adopted in the ecosystem. Contract wallets suffer from a UX problem -- since they separate the EOA &lt;code&gt;owner&lt;&#x2F;code&gt; of the contract wallet from the contract wallet itself (which is meant to carry out actions on the &lt;code&gt;owner&lt;&#x2F;code&gt;s behalf and holds all of their funds), user interfaces need to be specifically designed to support them. The &lt;code&gt;permit&lt;&#x2F;code&gt; pattern reaps many of the same benefits while requiring little to no change in user interfaces.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;While EIP-20 tokens have become ubiquitous in the Ethereum ecosystem, their status remains that of second class tokens from the perspective of the protocol. The ability for users to interact with Ethereum without holding any ETH has been a long outstanding goal and the subject of many EIPs.&lt;&#x2F;p&gt;
&lt;p&gt;So far, many of these proposals have seen very little adoption, and the ones that have been adopted (such as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;777&#x2F;&quot;&gt;EIP-777&lt;&#x2F;a&gt;), introduce a lot of additional functionality, causing unexpected behavior in mainstream contracts.&lt;&#x2F;p&gt;
&lt;p&gt;This ERC proposes an alternative solution which is designed to be as minimal as possible and to only address &lt;em&gt;one problem&lt;&#x2F;em&gt;: the lack of abstraction in the EIP-20 &lt;code&gt;approve&lt;&#x2F;code&gt; method.&lt;&#x2F;p&gt;
&lt;p&gt;While it may be tempting to introduce &lt;code&gt;*_by_signature&lt;&#x2F;code&gt; counterparts for every EIP-20 function, they are intentionally left out of this EIP-20 for two reasons:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;the desired specifics of such functions, such as decision regarding fees for &lt;code&gt;transfer_by_signature&lt;&#x2F;code&gt;, possible batching algorithms, varies depending on the use case, and,&lt;&#x2F;li&gt;
&lt;li&gt;they can be implemented using a combination of &lt;code&gt;permit&lt;&#x2F;code&gt; and additional helper contracts without loss of generality.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Compliant contracts must implement 3 new functions in addition to EIP-20:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; permit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; deadline&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; v&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; s&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; nonces&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DOMAIN_SEPARATOR&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The semantics of which are as follows:&lt;&#x2F;p&gt;
&lt;p&gt;For all addresses &lt;code&gt;owner&lt;&#x2F;code&gt;, &lt;code&gt;spender&lt;&#x2F;code&gt;, uint256s &lt;code&gt;value&lt;&#x2F;code&gt;, &lt;code&gt;deadline&lt;&#x2F;code&gt; and &lt;code&gt;nonce&lt;&#x2F;code&gt;, uint8 &lt;code&gt;v&lt;&#x2F;code&gt;, bytes32 &lt;code&gt;r&lt;&#x2F;code&gt; and &lt;code&gt;s&lt;&#x2F;code&gt;,
a call to &lt;code&gt;permit(owner, spender, value, deadline, v, r, s)&lt;&#x2F;code&gt; will set
&lt;code&gt;allowance[owner][spender]&lt;&#x2F;code&gt; to &lt;code&gt;value&lt;&#x2F;code&gt;,
increment &lt;code&gt;nonces[owner]&lt;&#x2F;code&gt; by 1,
and emit a corresponding &lt;code&gt;Approval&lt;&#x2F;code&gt; event,
if and only if the following conditions are met:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The current blocktime is less than or equal to &lt;code&gt;deadline&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;owner&lt;&#x2F;code&gt; is not the zero address.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;nonces[owner]&lt;&#x2F;code&gt; (before the state update) is equal to &lt;code&gt;nonce&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;r&lt;&#x2F;code&gt;, &lt;code&gt;s&lt;&#x2F;code&gt; and &lt;code&gt;v&lt;&#x2F;code&gt; is a valid &lt;code&gt;secp256k1&lt;&#x2F;code&gt; signature from &lt;code&gt;owner&lt;&#x2F;code&gt; of the message:&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;If any of these conditions are not met, the &lt;code&gt;permit&lt;&#x2F;code&gt; call must revert.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;1901&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   DOMAIN_SEPARATOR&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;   keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            deadline&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where &lt;code&gt;DOMAIN_SEPARATOR&lt;&#x2F;code&gt; is defined according to EIP-712. The &lt;code&gt;DOMAIN_SEPARATOR&lt;&#x2F;code&gt; should be unique to the contract and chain to prevent replay attacks from other domains,
and satisfy the requirements of EIP-712, but is otherwise unconstrained.
A common choice for &lt;code&gt;DOMAIN_SEPARATOR&lt;&#x2F;code&gt; is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;DOMAIN_SEPARATOR &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;    abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;#39;EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;name&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;version&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        chainid&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In other words, the message is the EIP-712 typed structure:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;types&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;EIP712Domain&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;verifyingContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Permit&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;spender&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;deadline&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;primaryType&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Permit&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;domain&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; erc20name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; version&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; chainid&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;verifyingContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;message&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;spender&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;deadline&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; deadline&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note that nowhere in this definition we refer to &lt;code&gt;msg.sender&lt;&#x2F;code&gt;. The caller of the &lt;code&gt;permit&lt;&#x2F;code&gt; function can be any address.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;permit&lt;&#x2F;code&gt; function is sufficient for enabling any operation involving EIP-20 tokens to be paid for using the token itself, rather than using ETH.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;nonces&lt;&#x2F;code&gt; mapping is given for replay protection.&lt;&#x2F;p&gt;
&lt;p&gt;A common use case of &lt;code&gt;permit&lt;&#x2F;code&gt; has a relayer submit a &lt;code&gt;Permit&lt;&#x2F;code&gt; on behalf of the &lt;code&gt;owner&lt;&#x2F;code&gt;. In this scenario, the relaying party is essentially given a free option to submit or withhold the &lt;code&gt;Permit&lt;&#x2F;code&gt;. If this is a cause of concern, the &lt;code&gt;owner&lt;&#x2F;code&gt; can limit the time a &lt;code&gt;Permit&lt;&#x2F;code&gt; is valid for by setting &lt;code&gt;deadline&lt;&#x2F;code&gt; to a value in the near future. The &lt;code&gt;deadline&lt;&#x2F;code&gt; argument can be set to &lt;code&gt;uint(-1)&lt;&#x2F;code&gt; to create &lt;code&gt;Permit&lt;&#x2F;code&gt;s that effectively never expire.&lt;&#x2F;p&gt;
&lt;p&gt;EIP-712 typed messages are included because of its wide spread adoption in many wallet providers.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;There are already a couple of &lt;code&gt;permit&lt;&#x2F;code&gt; functions in token contracts implemented in contracts in the wild, most notably the one introduced in the &lt;code&gt;dai.sol&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Its implementation differs slightly from the presentation here in that:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;instead of taking a &lt;code&gt;value&lt;&#x2F;code&gt; argument, it takes a bool &lt;code&gt;allowed&lt;&#x2F;code&gt;, setting approval to 0 or &lt;code&gt;uint(-1)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;the &lt;code&gt;deadline&lt;&#x2F;code&gt; argument is instead called &lt;code&gt;expiry&lt;&#x2F;code&gt;. This is not just a syntactic change, as it effects the contents of the signed message.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;There is also an implementation in the token &lt;code&gt;Stake&lt;&#x2F;code&gt; (Ethereum address &lt;code&gt;0x0Ae055097C6d159879521C384F1D2123D1f195e6&lt;&#x2F;code&gt;) with the same ABI as &lt;code&gt;dai&lt;&#x2F;code&gt; but with different semantics: it lets users issue &quot;expiring approvals&quot;, that only allow &lt;code&gt;transferFrom&lt;&#x2F;code&gt; to occur while &lt;code&gt;expiry &amp;gt;= block.timestamp&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The specification presented here is in line with the implementation in Uniswap V2.&lt;&#x2F;p&gt;
&lt;p&gt;The requirement to revert if the permit is invalid was added when the EIP was already widely deployed, but at the moment it was consistent with all found implementations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Though the signer of a &lt;code&gt;Permit&lt;&#x2F;code&gt; may have a certain party in mind to submit their transaction, another party can always front run this transaction and call &lt;code&gt;permit&lt;&#x2F;code&gt; before the intended party. The end result is the same for the &lt;code&gt;Permit&lt;&#x2F;code&gt; signer, however.&lt;&#x2F;p&gt;
&lt;p&gt;Since the ecrecover precompile fails silently and just returns the zero address as &lt;code&gt;signer&lt;&#x2F;code&gt; when given malformed messages, it is important to ensure &lt;code&gt;owner != address(0)&lt;&#x2F;code&gt; to avoid &lt;code&gt;permit&lt;&#x2F;code&gt; from creating an approval to spend &quot;zombie funds&quot; belong to the zero address.&lt;&#x2F;p&gt;
&lt;p&gt;Signed &lt;code&gt;Permit&lt;&#x2F;code&gt; messages are censorable. The relaying party can always choose to not submit the &lt;code&gt;Permit&lt;&#x2F;code&gt; after having received it, withholding the option to submit it. The &lt;code&gt;deadline&lt;&#x2F;code&gt; parameter is one mitigation to this. If the signing party holds ETH they can also just submit the &lt;code&gt;Permit&lt;&#x2F;code&gt; themselves, which can render previously signed &lt;code&gt;Permit&lt;&#x2F;code&gt;s invalid.&lt;&#x2F;p&gt;
&lt;p&gt;The standard EIP-20 race condition for approvals (SWC-114) applies to &lt;code&gt;permit&lt;&#x2F;code&gt; as well.&lt;&#x2F;p&gt;
&lt;p&gt;If the &lt;code&gt;DOMAIN_SEPARATOR&lt;&#x2F;code&gt; contains the &lt;code&gt;chainId&lt;&#x2F;code&gt; and is defined at contract deployment instead of reconstructed for every signature, there is a risk of possible replay attacks between chains in the event of a future chain split.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Trie format transition with overlay trees</title>
        <published>2020-04-03T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Guillaume Ballet</name><uri>https://github.com/gballet</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2584/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethresear.ch/t/overlay-method-for-hex-bin-tree-conversion/7104" />
        

        <id>https://wg-eips.ritovision.com/2584/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2584"
            label="EIP-2584" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2584/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes a method to convert the state trie format from hexary to binary: new values are directly stored in a binary trie “laid over” the hexary trie. Meanwhile, the hexary trie is converted to a binary trie in the background. When the process is finished, both layers are merged.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP describes a four phase process to complete the conversion.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;In the first phase, all new state writes are made to an overlay binary trie, while the hexary trie is being converted to binary. The block format is changed to have two storage roots: the root of the hexary trie (hereafter called the &quot;base&quot; trie) and the root of the overlay binary trie.&lt;&#x2F;li&gt;
&lt;li&gt;After enough time has been given to miners to perform the conversion, the second phase begins. The overlay tree is progressively merged back into the newly converted binary base trie. A constant number of entries are deleted from the overlay and inserted into the base trie.&lt;&#x2F;li&gt;
&lt;li&gt;The third and final phase begins when the overlay trie is empty. The field holding its root is removed from the block header.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;There is a long running interest in switching the state trie from a hexary format to a binary format, for reasons pertaining to proof and storage sizes. The conversion process poses a catch-up issue, caused by the sheer size of the full state: it can not be translated in a reasonable time (i.e. on the same order of magnitude as the block time).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;This specification follows the notation introduced by the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum.github.io&#x2F;yellowpaper&quot;&gt;Yellow Paper&lt;&#x2F;a&gt;. Prior to reading it is advisable to be familiar with the Yellow Paper.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;binary-tries&quot;&gt;Binary tries&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP assumes that a binary trie is defined like the MPT, except that:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The series of bytes in I₀ is seen as a series of &lt;em&gt;bits&lt;&#x2F;em&gt; and so ∀i≤256, I₀[i] is the ith bit in key I₀&lt;&#x2F;li&gt;
&lt;li&gt;The first item of an &lt;strong&gt;extension&lt;&#x2F;strong&gt; or a &lt;strong&gt;leaf&lt;&#x2F;strong&gt; is replacing nibbles with bits;&lt;&#x2F;li&gt;
&lt;li&gt;A &lt;strong&gt;branch&lt;&#x2F;strong&gt; is a 2 item structure in which both items correspond to each of the two possible bit values for the keys at this point in their traversal;&lt;&#x2F;li&gt;
&lt;li&gt;c(𝕴,i) ≡ RLP((u(0), u(1)) at a branch, where u(j) = n({I : I ∈ 𝕴 ⋀ I₀[i] = j}, i+1)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Let ß be the function that, given a hexary trie, computes the equivalent representation of that trie in the aforementioned binary trie format.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;phase-1&quot;&gt;Phase 1&lt;&#x2F;h3&gt;
&lt;p&gt;Let &lt;em&gt;h₁&lt;&#x2F;em&gt; be the previously agreed-upon block height at which phase 1 starts, and &lt;em&gt;h₂&lt;&#x2F;em&gt; the block at which phase 2 starts. For each block of height h₁ ≤ &lt;em&gt;h&lt;&#x2F;em&gt; &amp;lt; h₂:&lt;&#x2F;p&gt;
&lt;ol start=&quot;0&quot;&gt;
&lt;li&gt;A conversion process is started in the background, to turn the hexary trie into its binary equivalent. The end goal of this process is the calculation of the &lt;em&gt;root hash of the converted binary trie&lt;&#x2F;em&gt;, denoted Hᵣ². The root of the hexary trie is hereafter called Hᵣ¹⁶. Formally, this process is written as Hᵣ² ≡ ß(Hᵣ¹⁶).&lt;&#x2F;li&gt;
&lt;li&gt;Block headers contain a new Hₒ field, which is the &lt;em&gt;root of the overlay binary trie&lt;&#x2F;em&gt;;&lt;&#x2F;li&gt;
&lt;li&gt;Hᵣ ≡ P(H)ᵣ¹⁶, i.e. as long as the conversion from hexary to binary is not complete, the hexary trie root is the same as that of its parent block.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The following is changed in the execution environment:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Upon executing a &lt;em&gt;state read&lt;&#x2F;em&gt;, ϒ first searches for the address in the overlay trie. If the key can not be found there, ϒ then searches the base trie as it did at block heights h&#x27; &amp;lt; h₁;&lt;&#x2F;li&gt;
&lt;li&gt;Upon executing a &lt;em&gt;state write&lt;&#x2F;em&gt;, ϒ inserts or updates the value into the overlay tree. The base tree is left untouched;&lt;&#x2F;li&gt;
&lt;li&gt;If an account is deleted, ϒ inserts the empty hash H(∅) at the address of that account in order to mark its deletion; reads from such an address behave the same as a missing account, regardless of what is present in the base trie.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Phase 1 ends at block height h₂, which is set far enough from h₁ to offer miners enough time to perform the conversion.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;phase-2&quot;&gt;Phase 2&lt;&#x2F;h3&gt;
&lt;p&gt;This phase differs from the previous one on the following points:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;At block height h₂, before the execution of ϒ, Hᵣ ≡ Hᵣ², i.e. the value before the execution of the transition function is set to the root of the converted &lt;em&gt;binary base trie&lt;&#x2F;em&gt;;&lt;&#x2F;li&gt;
&lt;li&gt;Hₒ is still present in the block tree, however the overlay trie content can only be &lt;em&gt;read from or deleted&lt;&#x2F;em&gt;;&lt;&#x2F;li&gt;
&lt;li&gt;At block height h ≥ h₂, before the execution of ϒ, N accounts are being deleted from the binary overlay trie and inserted into the binary base trie;&lt;&#x2F;li&gt;
&lt;li&gt;Upon executing a &lt;em&gt;state write&lt;&#x2F;em&gt;, ϒ will insert or update the value into the &lt;em&gt;base&lt;&#x2F;em&gt; trie. If the search key exists in the overlay trie, it is deleted.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Account deletion is performed according to the following rules:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The first N accounts (in lexicographic order) remaining in the overlay tree are selected; For each of these accounts:&lt;&#x2F;li&gt;
&lt;li&gt;If the value is the empty hash, remove the account at the same address from the binary base trie;&lt;&#x2F;li&gt;
&lt;li&gt;Otherwise, insert&#x2F;update the account at the corresponding address in the base trie with its overlay trie value.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;When the overlay trie is empty, phase 2 ends and phase 3 begins.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;phase-3&quot;&gt;Phase 3&lt;&#x2F;h3&gt;
&lt;p&gt;Phase 3 is the same as phase 2, except for the following change:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Hₒ is dropped from the block header&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Methods that have been discussed until now include a &quot;stop the world&quot; approach, in which the chain is stopped for the significant amount of time that is required by the conversion, and a &quot;copy on write&quot; approach, in which branches are converted upon being accessed.
The approach suggested here has the advantage that the chain continues to operate normally during the conversion process, and that the tree is fully converted to a binary format, in a predictable time.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This requires a fork and will break backwards compatibility, as the hashes and block formats will necessarily be different. This will cause a fork in clients that don&#x27;t implement the overlay tree, and those that do not accept the new binary root. No mitigation is proposed, as this is a hard fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;For testing phase 1, it suffices to check that every key in the hexary trie is also available in the binary trie. A looser but faster test picks 1% of keys in the hexary trie at random, and checks that they are present in the binary trie;&lt;&#x2F;li&gt;
&lt;li&gt;TBD for phase 2 &amp;amp; 3&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;A prototype version of the conversion process (phase 1) is available for &lt;code&gt;geth&lt;&#x2F;code&gt; in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;holiman&#x2F;go-ethereum&#x2F;pull&#x2F;12&quot;&gt;this PR&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;There are three attack vectors that I can foresee:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A targeted attack that would cause the overlay trie to be unreasonably large. Since gas costs will likely increase during the transition process, lengthening phase 2 will make Ethereum more expensive during an extended period of time. This could be solved by increasing the cost of &lt;code&gt;SSTORE&lt;&#x2F;code&gt; during phase 1.&lt;&#x2F;li&gt;
&lt;li&gt;Conversely, if h₂ comes too soon, a majority of miners might not be able to produce the correct value for Hᵣ² in time.&lt;&#x2F;li&gt;
&lt;li&gt;If a group of miners representing more than 51% of the network are reporting an invalid value, they could be stealing funds without anyone having a say.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;community-feedback&quot;&gt;Community feedback&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Preliminary tests indicate that a fast machine can perform the conversion in roughly 30 minutes.&lt;&#x2F;li&gt;
&lt;li&gt;The initial version of this EIP expected miners to vote on the value of the binary base root. This has been removed because of the complexity of this process, and because this functionality is already guaranteed by the &quot;longest chain&quot; rule.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Saving and Displaying Image Onchain for Universal Tokens</title>
        <published>2020-03-28T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Hua Zhang</name><uri>https://github.com/dgczhh</uri>
	</author>
	
	<author>
		<name>Yuefei Tan</name><uri>https://github.com/whtyfhas</uri>
	</author>
	
	<author>
		<name>Derek Zhou</name><uri>https://github.com/zhous</uri>
	</author>
	
	<author>
		<name>Ran Xing</name><uri>https://github.com/lemontreeran</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2569/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-2569-saving-and-displaying-image-onchain-for-universal-tokens/4167" />
        

        <id>https://wg-eips.ritovision.com/2569/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2569"
            label="ERC-2569" />
        

        
        

        
        <summary type="html">A set of interfaces to save an SVG image in Ethereum, and to retrieve the image file from Ethereum for universal tokens.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2569/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This set of interfaces allow a smart contract to save an SVG image in Ethereum and to retrieve an SVG image from Ethereum for fungible tokens, non-fungible tokens and tokens based on standards that will be developed in the future.&lt;&#x2F;p&gt;
&lt;p&gt;The interface set has two interfaces: one to save an SVG file in Ethereum and the other to retrieve an SVG file from Ethereum.&lt;&#x2F;p&gt;
&lt;p&gt;Typical applications include but not limited to:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A solution for storage of a fungible token&#x27;s icon.&lt;&#x2F;li&gt;
&lt;li&gt;A solution for storage of a non-fungible token&#x27;s icon.&lt;&#x2F;li&gt;
&lt;li&gt;A solution for storage of the icon&#x2F;logo of a DAO&#x27;s reputation token.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The ERC-721 token standard is a popular standard to define a non-fungible token in Ethereum. This standard is widely used to specify a crypto gift, crypto medal, crypto collectible etc. The most famous use case is the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.cryptokitties.co&#x2F;&quot;&gt;cryptokitty&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;In most of these applications an image is attached to an ERC-721 token. For example, in the cryptokitty case each kitty has a unique image. While the token&#x27;s code is saved in Ethereum permanently, the image attached to the token is not.&lt;&#x2F;p&gt;
&lt;p&gt;The existing solutions still keep such an image in a centralized server instead of Ethereum. When these applications display an image for a token they retrieve the token&#x27;s information from Ethereum and search the centralized server for the token&#x27;s associated image by using the token&#x27;s information.&lt;&#x2F;p&gt;
&lt;p&gt;Although this is an applicable way to display an image for a token, the image is still vulnerable to risks of being damaged or lost when saved in a centralized server.&lt;&#x2F;p&gt;
&lt;p&gt;Hence we propose a set of interfaces to save an image for a universal token in Ethereum to keep the image permanent and tamper-resistant, and to retrieve an image for a universal token from Ethereum.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;An EIP-2569 compatible contract MUST have a method with the signature getTokenImageSvg(uint256) view returns (string memory) and a method with the signature setTokenImageSvg(uint256 tokenId, string memory imagesvg) internal.&lt;&#x2F;p&gt;
&lt;p&gt;These methods define how a smart contract saves an image for a universal token in Ethereum which keeps the image permanent and tamper-resistant, and how a smart contract retrieves an image from Ethereum for a universal token.&lt;&#x2F;p&gt;
&lt;p&gt;By calling the methods users should access an SVG image.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;getTokenImageSvg(uint256 tokenId) external view returns (string memory): for an ERC-721 or ERC-1155 token or a token implemented by a contract which has a member &quot;ID&quot; to specify its token type or token index we define an interface to get an SVG image by using the token&#x27;s ID number. For an ERC-20 token or a token implemented by a contract which doesn&#x27;t have a member &quot;ID&quot; to specify its token type or token index we define an interface to get an SVG image for it if the token has a member variable string to save the image.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;It has the following parameter:&lt;&#x2F;p&gt;
&lt;p&gt;tokenId: for a non-fungible token such as an ERC-721 token or a multi-token such as an ERC-1155 token which has a member &quot;ID&quot; to specify its token type or token index our proposed interface assigns an SVG image&#x27;s file content to a string variable of the token&#x27;s contract and  associates the SVG image to this &quot;ID&quot; number. This unique ID is used to access its SVG image in both a &quot;set&quot; operation and a &quot;get&quot; operation.
For a fungible token such as an ERC-20 token no such an ID is needed and our proposed interface just assigns an SVG image&#x27;s file content to a string variable of the token&#x27;s contract.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;setTokenImageSvg(uint256 tokenId, string memory imagesvg) internal: for an ERC-721 or ERC-1155 token or a token implemented by a contract which has a member &quot;ID&quot; to specify its token type or token index we define an interface to associate an SVG image to the token&#x27;s ID number. For an ERC-20 token or a token implemented by a contract which doesn&#x27;t have a member &quot;ID&quot; to specify its token type or token index we define an interface to assign an SVG image to a member variable string of this token&#x27;s contract.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;It has the following two parameters:&lt;&#x2F;p&gt;
&lt;p&gt;tokenId: for a non-fungible token such as an ERC-721 token or a multi-token such as an ERC-1155 token which has a member &quot;ID&quot; to specify its token type or token index our proposed interface assigns an SVG image&#x27;s file content to a string variable of the token&#x27;s contract and  associates the SVG image to this &quot;ID&quot; number. This unique ID is used to access its SVG image in both a &quot;set&quot; operation and a &quot;get&quot; operation.
For a fungible token such as an ERC-20 token no such an ID is needed and our proposed interface just assigns an SVG image&#x27;s file content to a string variable of the token&#x27;s contract.&lt;&#x2F;p&gt;
&lt;p&gt;imageSvg: we use a string variable to save an SVG image file&#x27;s content.
An SVG image that will be saved in the imageSvg string should include at least two attributes:&quot;name&quot;, &quot;desc&quot;(description).&lt;&#x2F;p&gt;
&lt;p&gt;The procedure to save an image for a token in Ethereum is as follows:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Step1:&lt;&#x2F;strong&gt; define a string variable or an array of strings to hold an image or an array of images.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Step 2:&lt;&#x2F;strong&gt; define a function to set an (SVG) image&#x27;s file content or an array of image file&#x27;s contents to the string variable or the array of strings.&lt;&#x2F;p&gt;
&lt;p&gt;Step 1: for a token such as an ERC-721 or ERC-1155 token which has a member variable &quot;ID&quot;  to specify a token type or index and a member variable string to keep an (SVG) image associated with the &quot;ID&quot;, retrieve the (SVG) image from Ethereum by calling our proposed &quot;get&quot; interface with the token&#x27;s ID;
for a token which doesn&#x27;t have a member variable &quot;ID&quot; to specify a token type of index but has a member variable string to keep an (SVG) image, retrieve the (SVG) image from Ethereum by calling our proposed &quot;get&quot; without an &quot;ID&quot;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;After Bitcoin was created people have found ways to keep information permanent and tamper-resistant by encoding text messages they want to preserve permanently and tamper-resistantly in blockchain transactions. However existing applications only do this for text information and there are no solutions to keep an image permanent and tamper-resistant.&lt;&#x2F;p&gt;
&lt;p&gt;One of the most significant reasons for not doing so is that in general the size of an image is much bigger than the size of a text file, thus the gas needed to save an image in Ethereum would exceed a block&#x27;s gas limit.&lt;&#x2F;p&gt;
&lt;p&gt;However this changed a lot after the SVG(Scalable Vector Graphics) specification was developed by W3C since 1999.&lt;&#x2F;p&gt;
&lt;p&gt;The SVG specification offers several advantages (for more details about the advantages please refer to a reference link:https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Scalable_Vector_Graphics) over raster images. One of these advantages is its compact file-size.&lt;&#x2F;p&gt;
&lt;p&gt;&quot;Compact file-size – Pixel-based images are saved at a large size from the start because you can only retain the quality when you make the image smaller, but not when you make it larger. This can impact a site’s download speed. Since SVGs are scalable, they can be saved at a minimal file size&quot;.&lt;&#x2F;p&gt;
&lt;p&gt;This feature well fixes the painpoint of saving an image file in Ethereum, therefore we think saving an SVG image in Ethereum is a good solution for keep the image permanent and tamper-resistant.&lt;&#x2F;p&gt;
&lt;p&gt;In most ERC-721 related DAPPs they display an image for a non-fungible token. In most ERC-20 related DAPPs they don&#x27;t have an image for a fungible token. We think displaying an image for a token either based on existing token standards such as ERC-20, ERC-721, ERC-1155 or based on future standards is needed in many use cases. Therefore those DAPPs which currently don&#x27;t display an image for a token will eventually need such a function.&lt;&#x2F;p&gt;
&lt;p&gt;However with regard to most of the existing DAPPs which can display an image for a token they save such an image in a centralized server which, we think, is just a compromised solution. By utilizing the SVG specification we think converting a token&#x27;s image to an SVG image and saving it in Ethereum provides a better solution for DAPPs to access an image for a token.&lt;&#x2F;p&gt;
&lt;p&gt;This solution not only works for tokens based on ERC-721, ERC-1155 and ERC-20 but will work for tokens based on future standards.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;There are no backward compatibility issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;tokenId&lt;&#x2F;code&gt;: a token index in an ERC-721 token or a token type&#x2F;index in an ERC-1155 token. It is a uint256 variable.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;imageSvg&lt;&#x2F;code&gt;: an SVG image&#x27;s file content. It is a string variable. Note: the SVG image should include at least three attributes:&quot;name&quot;, &quot;description&quot; and &quot;issuer&quot;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;setTokenImageSvg&lt;&#x2F;code&gt;: interface to set an SVG image to a token with or without an ID number.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;getTokenImageSvg&lt;&#x2F;code&gt;: interface to get an SVG image for a token with or without an ID number.&lt;&#x2F;p&gt;
&lt;p&gt;We propose to add three sol files in the existing ERC-721 implementation.
Here are the details for the proposed sol files.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ----- IERC721GetImageSvg.sol -------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.5.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC721&#x2F;IERC721.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-721 Non-Fungible Token Standard, optional retrieving SVG image extension&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-721&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC721GetImageSvg&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC721&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getTokenImageSvg&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ----- ERC721GetImageSvg.sol -------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.5.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;GSN&#x2F;Context.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC721&#x2F;.&#x2F;ERC721.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;introspection&#x2F;ERC165.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERC721GetImageSvg.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721GetImageSvg&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Context&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC165&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC721&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC721GetImageSvg&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Mapping for token Images&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _tokenImageSvgs&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *     bytes4(keccak256(&amp;#39;getTokenImageSvg(uint256)&amp;#39;)) == 0x87d2f48c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *     =&amp;gt; 0x87d2f48c == 0x87d2f48c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; _INTERFACE_ID_ERC721_GET_TOKEN_IMAGE_SVG &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x87d2f48c&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Constructor function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; register the supported interfaces to conform to ERC721 via ERC165&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _registerInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_INTERFACE_ID_ERC721_GET_TOKEN_IMAGE_SVG&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns an SVG Image for a given token ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Throws if the token ID does not exist. May return an empty string.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; uint256 ID of the token to query&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getTokenImageSvg&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_exists&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC721GetImageSvg: SVG Image query for nonexistent token&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _tokenImageSvgs&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Internal function to set the token SVG image for a given token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Reverts if the token ID does not exist.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; uint256 ID of the token to set its SVG image&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; imagesvg&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; string SVG  to assign&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setTokenImageSvg&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; imagesvg&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_exists&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC721GetImageSvg: SVG image set of nonexistent token&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _tokenImageSvgs&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; imagesvg&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ----- ERC721ImageSvgMintable.sol -------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.5.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC721&#x2F;ERC721Metadata.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;access&#x2F;roles&#x2F;MinterRole.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;ERC721GetImageSvg.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC721ImageSvgMintable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC721 minting logic with imagesvg.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721ImageSvgMintable&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC721Metadata&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC721GetImageSvg&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;MinterRole&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Function to mint tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address that will receive the minted tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token id to mint.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenImageSvg&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token SVG image of the minted token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; A&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; boolean that indicates if the operation was successful.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mintWithTokenImageSvg&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenImageSvg&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyMinter&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        setTokenImageSvg&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenImageSvg&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;We propose to add three sol files in the existing ERC&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1155&lt;&#x2F;span&gt;&lt;span&gt; implementation&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Here are the details &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt; the proposed sol files&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ----- IERC1155GetImageSvg.sol -------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.5.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERC1155.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-1155 Multi Token Standard, retrieving SVG image for a token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;blob&#x2F;master&#x2F;EIPS&#x2F;.&#x2F;01155.md&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC1155GetImageSvg&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC1155&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getTokenImageSvg&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ----- ERC1155GetImageSvg.sol -------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.5.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;ERC1155.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERC1155GetImageSvg.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC1155GetImageSvg&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC165&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC1155&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC1155GetImageSvg&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Mapping for token Images&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _tokenImageSvgs&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *     bytes4(keccak256(&amp;#39;getTokenImageSvg(uint256)&amp;#39;)) == 0x87d2f48c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *     =&amp;gt; 0x87d2f48c == 0x87d2f48c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; _INTERFACE_ID_ERC1155_GET_TOKEN_IMAGE_SVG &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x87d2f48c&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Constructor function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; register the supported interfaces to conform to ERC1155 via ERC165&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _registerInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_INTERFACE_ID_ERC1155_GET_TOKEN_IMAGE_SVG&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns an SVG Image for a given token ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Throws if the token ID does not exist. May return an empty string.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; uint256 ID of the token to query&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getTokenImageSvg&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_exists&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC1155GetImageSvg: SVG Image query for nonexistent token&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _tokenImageSvgs&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Internal function to set the token SVG image for a given token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Reverts if the token ID does not exist.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; uint256 ID of the token to set its SVG image&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; imagesvg&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; string SVG  to assign&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setTokenImageSvg&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; imagesvg&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_exists&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC1155GetImageSvg: SVG image set of nonexistent token&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _tokenImageSvgs&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; imagesvg&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ----- ERC1155MixedFungibleWithSvgMintable.sol -------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.5.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;ERC1155MixedFungibleMintable.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;ERC1155GetImageSvg.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Mintable form of ERC1155 with SVG images&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    Shows how easy it is to mint new items with SVG images&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC1155MixedFungibleWithSvgMintable&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC1155&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC1155MixedFungibleMintable&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC1155GetImageSvg&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Function to mint non-fungible tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address that will receive the minted tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _type&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token type to mint.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenImageSvg&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token SVG image of the minted token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mintNonFungibleWithImageSvg&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _type&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenImageSvg&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; creatorOnly&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_type&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        mintNonFungible&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_type&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        setTokenImageSvg&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_type&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenImageSvg&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Function to mint fungible tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address that will receive the minted tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token type to mint.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _quantities&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The number of tokens for a type to mint.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenImageSvg&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token SVG image of the minted token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mintFungibleWithImageSvg&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _quantities&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenImageSvg&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; creatorOnly&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        mintFungible&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _quantities&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenImageSvg&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        setTokenImageSvg&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenImageSvg&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;We propose to add three sol files in the existing ERC&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;20&lt;&#x2F;span&gt;&lt;span&gt; implementation&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Here are the details &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt; the proposed sol files&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ----- IERC20GetImageSvg.sol -------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.5.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC20&#x2F;IERC20.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-20 Fungible Token Standard, retrieving SVG image for a token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See https:&#x2F;&#x2F;github.com&#x2F;OpenZeppelin&#x2F;openzeppelin-contracts&#x2F;blob&#x2F;master&#x2F;contracts&#x2F;token&#x2F;ERC20&#x2F;ERC20.sol&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC20GetImageSvg&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC20&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getTokenImageSvg&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ----- ERC20GetImageSvg.sol -------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.5.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@openzeppelin&#x2F;contracts&#x2F;token&#x2F;ERC20&#x2F;ERC20.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;IERC20GetImageSvg.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC20GetImageSvg&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC20&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IERC20GetImageSvg&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _tokenImageSvg&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;将图片实现写在构造器中&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; svgCode&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;_tokenImageSvg &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; svgCode&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns an SVG Image.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getTokenImageSvg&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _tokenImageSvg&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Human Readable Parameters for Contract Function Execution</title>
        <published>2020-03-23T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Joseph Stockermans</name><uri>https://github.com/jstoxrocky</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2566/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/human-readable-parameters-for-contract-function-execution/4154" />
        

        <id>https://wg-eips.ritovision.com/2566/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="interface"
                label="Interface" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2566"
            label="EIP-2566" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2566/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;New Ethereum RPC method &lt;code&gt;eth_sendTransactionToContractFunction&lt;&#x2F;code&gt; that parallels &lt;code&gt;eth_sendTransaction&lt;&#x2F;code&gt; but allows for human-readable contract function execution data to be displayed to users.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;When a dapp prompts a user to execute a smart contract function via a ProviderWallet, confirmation screens displayed in the ProviderWallet layer cannot display the human readable details of the function to be called and the arguments to be passed. This is because the Ethereum RPC method used for contract function execution (&lt;code&gt;eth_sendTransaction&lt;&#x2F;code&gt;) accepts information about what function to call in a non-human readable (and non-recoverable) format. As such, when a ProviderWallet receives this non-human readable information from a dapp, they are unable to display a human readable version since they never received one and cannot recover one from the data.&lt;&#x2F;p&gt;
&lt;p&gt;This creates a poor and potentially dangerous user experience. For example, a malicious dapp could swap out the &lt;code&gt;address&lt;&#x2F;code&gt; argument in a token contract&#x27;s &lt;code&gt;transfer(address,uint256)&lt;&#x2F;code&gt; function and reroute the tokens intended for someone else to themselves. This sleight-of-hand would be quiet and unlikely to be picked up by a casual user glancing over the non-human readable data. By adding a new Ethereum RPC method (&lt;code&gt;eth_sendTransactionToContractFunction&lt;&#x2F;code&gt;) that accepts the function ABI, ProviderWallets can recreate and display the human readable details of contract function execution to users.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;providerwallet-definition&quot;&gt;ProviderWallet Definition&lt;&#x2F;h3&gt;
&lt;p&gt;ProviderWallets like Metamask and Geth are hybrid software that combine an Ethereum API provider with an Ethereum wallet. This allows them to sign transactions on behalf of their users and also broadcast those signed transactions to the Ethereum network. ProviderWallets are used for both convenience and for the protection they give users through human readable confirmation prompts.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;existing-solutions&quot;&gt;Existing Solutions&lt;&#x2F;h3&gt;
&lt;p&gt;Much discussion has been made in the past few years on the topic of human readable Ethereum transaction data. Aragon&#x27;s &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;aragon&#x2F;radspec&quot;&gt;Radspec&lt;&#x2F;a&gt; addresses this issue by requiring contract developers to amend their contract functions with human readable comments. ProviderWallets can then use Aragon&#x27;s Radspec software to parse these comments from the contract code and display them to the end user - substituting in argument values where necessary. Unfortunately, this approach cannot work with contracts that do not have Radspec comments (and may require integration with IPFS).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;1138&quot;&gt;EIP 1138&lt;&#x2F;a&gt; also addresses this issue directly but contains serious security issues - allowing untrusted dapps to generate the human readable message displayed to users. In a similar train of thought, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;go-ethereum&#x2F;pull&#x2F;2940&quot;&gt;Geth&#x27;s #2940 PR&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;blob&#x2F;master&#x2F;EIPS&#x2F;.&#x2F;00191.md&quot;&gt;EIPs 191&lt;&#x2F;a&gt;, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;blob&#x2F;master&#x2F;EIPS&#x2F;.&#x2F;00712.md&quot;&gt;712&lt;&#x2F;a&gt; all highlight the Ethereum community&#x27;s desire for ProviderWallets to better inform users about what data they are actually acting upon.&lt;&#x2F;p&gt;
&lt;p&gt;Finally, the ProviderWallet Metamask already includes some built-in magic for interactions with ERC20 contracts that allows confirmation prompts to display the intended &lt;em&gt;token&lt;&#x2F;em&gt; recipient and &lt;em&gt;token&lt;&#x2F;em&gt; value. Although this is accomplished in an ad hoc fashion for ERC20-like contracts only, the motivation is the same: users deserve better information about the execution of contract functions they are relying on ProviderWallets to perform.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;background&quot;&gt;Background&lt;&#x2F;h3&gt;
&lt;p&gt;At one point or another, a dapp will ask a user to interact with a contract. The interaction between dapps and contracts is a large part of the Ethereum ecosystem and is most commonly brokered by a ProviderWallet. When a dapp asks a user to interact with a contract, it will do so by sending the &lt;code&gt;eth_sendTransaction&lt;&#x2F;code&gt; method name to the Ethereum API exposed by a ProviderWallet along with the relevant transaction data. The &lt;code&gt;data&lt;&#x2F;code&gt; field of the transaction data contains the information necessary for the Ethereum virtual machine to identify and execute the contract&#x27;s function. This field has a specific formatting that is both non-human readable and non-recoverable to its human readable state.&lt;&#x2F;p&gt;
&lt;p&gt;The accepted format for &lt;code&gt;eth_sendTransaction&lt;&#x2F;code&gt;&#x27;s &lt;code&gt;data&lt;&#x2F;code&gt; field is the hexadecimal encoding of the first four bytes of the keccak256 digest of the function signature. This abbreviated hash is then concatenated with the ABI encoded arguments to the function. Since the keccak256 digest of the function signature cannot be converted back into the function signature, the &lt;code&gt;data&lt;&#x2F;code&gt; field is not only non-human readable, its non-recoverable as well. On top of this, additional insight into the concatenated argument values is further obfuscated as information about their data types are held in the function signature preimage.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes increasing the set of Ethereum RPC methods to include a new method - &lt;code&gt;eth_sendTransactionToContractFunction&lt;&#x2F;code&gt;. This method parallels &lt;code&gt;eth_sendTransaction&lt;&#x2F;code&gt; with the only difference being the inclusion of the contract function&#x27;s &lt;code&gt;abi&lt;&#x2F;code&gt; field.&lt;&#x2F;p&gt;
&lt;p&gt;Parameters&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;Object&lt;&#x2F;code&gt; - The transaction object&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;from&lt;&#x2F;code&gt;: &lt;code&gt;DATA&lt;&#x2F;code&gt;, 20 Bytes - The address the transaction is sent from.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;to&lt;&#x2F;code&gt;: &lt;code&gt;DATA&lt;&#x2F;code&gt;, 20 Bytes - (optional when creating new contract) The address the transaction is directed to.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;gas&lt;&#x2F;code&gt;: &lt;code&gt;QUANTITY&lt;&#x2F;code&gt; - (optional, default: 90000) Integer of the gas provided for the transaction execution. It will return unused gas.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;gasPrice&lt;&#x2F;code&gt;: &lt;code&gt;QUANTITY&lt;&#x2F;code&gt; - (optional, default: To-Be-Determined) Integer of the gasPrice used for each paid gas&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;value&lt;&#x2F;code&gt;: &lt;code&gt;QUANTITY&lt;&#x2F;code&gt; - (optional) Integer of the value sent with this transaction&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;data&lt;&#x2F;code&gt;: &lt;code&gt;DATA&lt;&#x2F;code&gt; - The hash of the invoked method signature and encoded parameters&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;abi&lt;&#x2F;code&gt;: &lt;code&gt;DATA&lt;&#x2F;code&gt; - The function ABI&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;nonce&lt;&#x2F;code&gt;: &lt;code&gt;QUANTITY&lt;&#x2F;code&gt; - (optional) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Example Parameters&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  params: [{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;from&amp;quot;: &amp;quot;0x69e6F1b01f34A702Ce63bA6EF83c64fAEC37a227&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;to&amp;quot;: &amp;quot;0xe44127f6fA8A00ee0228730a630fc1F3162C4d52&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;gas&amp;quot;: &amp;quot;0x76c0&amp;quot;, &#x2F;&#x2F; 30400&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;gasPrice&amp;quot;: &amp;quot;0x9184e72a000&amp;quot;, &#x2F;&#x2F; 10000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;value&amp;quot;: &amp;quot;0x9184e72a&amp;quot;, &#x2F;&#x2F; 2441406250&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;abi&amp;quot;: &amp;quot;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &amp;quot;inputs&amp;quot;: [{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;name&amp;quot;: &amp;quot;_address&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;type&amp;quot;: &amp;quot;address&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }, {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;name&amp;quot;: &amp;quot;_value&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;type&amp;quot;: &amp;quot;uint256&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }],&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &amp;quot;name&amp;quot;: &amp;quot;transferTokens&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &amp;quot;outputs&amp;quot;: [{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;name&amp;quot;: &amp;quot;success&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;type&amp;quot;: &amp;quot;bool&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }],&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &amp;quot;stateMutability&amp;quot;: &amp;quot;nonpayable&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &amp;quot;type&amp;quot;: &amp;quot;function&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   &amp;quot;data&amp;quot;: &amp;quot;0xbec3fa170000000000000000000000006Aa89e52c9a826496A8f311c1a9db62fd477E256000000000000000000000000000000000000000000000000000000174876E800&amp;quot;               &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Returns
DATA, 32 Bytes - the transaction hash, or the zero hash if the transaction is not yet available.&lt;&#x2F;p&gt;
&lt;p&gt;Example
&#x2F;&#x2F; Request
curl -X POST --data &#x27;{&quot;jsonrpc&quot;:&quot;2.0&quot;,&quot;method&quot;:&quot;eth_sendTransactionToContractFunction&quot;,&quot;params&quot;:[{see above}],&quot;id&quot;:1}&#x27;&lt;&#x2F;p&gt;
&lt;p&gt;&#x2F;&#x2F; Result
{
&quot;id&quot;:1,
&quot;jsonrpc&quot;: &quot;2.0&quot;,
&quot;result&quot;: &quot;0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331&quot;
}&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP&#x27;s proposed &lt;code&gt;eth_sendTransactionToContractFunction&lt;&#x2F;code&gt; method is intended to parallel &lt;code&gt;eth_sendTransaction&lt;&#x2F;code&gt; as much as possible since both methods result in the same behaviour when executing a contract function. The newly introduced &lt;code&gt;abi&lt;&#x2F;code&gt; field is an element of the contract&#x27;s ABI that corresponds to the intended function. The &lt;code&gt;data&lt;&#x2F;code&gt; field is the same &lt;code&gt;data&lt;&#x2F;code&gt; field from &lt;code&gt;eth_sendTransaction&lt;&#x2F;code&gt;. The &lt;code&gt;abi&lt;&#x2F;code&gt; field can be combined with values parsed from the &lt;code&gt;data&lt;&#x2F;code&gt; field to recreate human readable contract function execution information.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;data&lt;&#x2F;code&gt; field in &lt;code&gt;eth_sendTransactionToContractFunction&lt;&#x2F;code&gt; is the same as that required for &lt;code&gt;eth_sendTransaction&lt;&#x2F;code&gt; allowing the transaction to be completed via the existing mechanisms used for &lt;code&gt;eth_sendTransaction&lt;&#x2F;code&gt;. The input argument values can be parsed from the &lt;code&gt;data&lt;&#x2F;code&gt; field and since we know their types from the &lt;code&gt;abi&lt;&#x2F;code&gt; field, the provider wallet can use this info to encode and display the values in an appropriate human readable format. Furthermore, the hashed and truncated function signature in the &lt;code&gt;data&lt;&#x2F;code&gt; field can be reconstructed using the information provided in the &lt;code&gt;abi&lt;&#x2F;code&gt; field providing an additional check to ensure that the supplied ABI matches the &lt;code&gt;data&lt;&#x2F;code&gt; field.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;With backwards compatibility in mind, this EIP proposes augmenting the set of Ethereum RPC methods with an additional method instead of mutating the existing method. Precedent for adding a new RPC method comes from &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;blob&#x2F;master&#x2F;EIPS&#x2F;.&#x2F;00712.md&quot;&gt;EIP 712&lt;&#x2F;a&gt; in which adding the method &lt;code&gt;eth_signTypedData&lt;&#x2F;code&gt; is proposed for confirmation prompt security. As an alternate approach, the &lt;code&gt;eth_sendTransaction&lt;&#x2F;code&gt; method could be changed to accept an additional &lt;code&gt;abi&lt;&#x2F;code&gt; argument, but this would break all existing code attempting to execute a contract function.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Displaying the contract address, function name, and argument values can provide additional security to users, but it is not a guarantee that a function will execute as the user expects. A poorly implemented contract can still name its function &lt;code&gt;transfer&lt;&#x2F;code&gt; and accept &lt;code&gt;address&lt;&#x2F;code&gt; and &lt;code&gt;uint256&lt;&#x2F;code&gt; arguments - but there is nothing short of contract examination that will let a user know that this contract is indeed a valid ERC20 contract. This EIP does not intend to solve the larger problem around trust in a contract&#x27;s code, but instead intends to give users better tools to understand exactly what is contained within the data they are broadcasting to the Ethereum network.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>ModExp Gas Cost</title>
        <published>2020-03-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Kelly Olson</name><uri>https://github.com/ineffectualproperty</uri>
	</author>
	
	<author>
		<name>Sean Gulley</name><uri>https://github.com/sean-sn</uri>
	</author>
	
	<author>
		<name>Simon Peffers</name><uri>https://github.com/simonatsn</uri>
	</author>
	
	<author>
		<name>Justin Drake</name><uri>https://github.com/justindrake</uri>
	</author>
	
	<author>
		<name>Dankrad Feist</name><uri>https://github.com/dankrad</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2565/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/big-integer-modular-exponentiation-eip-198-gas-cost/4150" />
        

        <id>https://wg-eips.ritovision.com/2565/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2565"
            label="EIP-2565" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2565/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Defines the gas cost of the &lt;code&gt;ModExp&lt;&#x2F;code&gt; (&lt;code&gt;0x00..05&lt;&#x2F;code&gt;) precompile.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;To accurately reflect the real world operational cost of the &lt;code&gt;ModExp&lt;&#x2F;code&gt; precompile, this EIP specifies an algorithm for calculating the gas cost. This algorithm approximates the multiplication complexity cost and multiplies that by an approximation of the iterations required to execute the exponentiation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Modular exponentiation is a foundational arithmetic operation for many cryptographic functions including signatures, VDFs, SNARKs, accumulators, and more. Unfortunately, the ModExp precompile is currently over-priced, making these operations inefficient and expensive. By reducing the cost of this precompile, these cryptographic functions become more practical, enabling improved security, stronger randomness (VDFs), and more.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;As of &lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt;, the gas cost of calling the precompile at address &lt;code&gt;0x0000000000000000000000000000000000000005&lt;&#x2F;code&gt; will be calculated as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def calculate_multiplication_complexity(base_length, modulus_length):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_length = max(base_length, modulus_length)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    words = math.ceil(max_length &#x2F; 8)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return words**2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def calculate_iteration_count(exponent_length, exponent):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    iteration_count = 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if exponent_length &amp;lt;= 32 and exponent == 0: iteration_count = 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    elif exponent_length &amp;lt;= 32: iteration_count = exponent.bit_length() - 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    elif exponent_length &amp;gt; 32: iteration_count = (8 * (exponent_length - 32)) + ((exponent &amp;amp; (2**256 - 1)).bit_length() - 1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return max(iteration_count, 1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def calculate_gas_cost(base_length, modulus_length, exponent_length, exponent):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    multiplication_complexity = calculate_multiplication_complexity(base_length, modulus_length)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    iteration_count = calculate_iteration_count(exponent_length, exponent)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return max(200, math.floor(multiplication_complexity * iteration_count &#x2F; 3))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;After benchmarking the ModExp precompile, we discovered that it is ‘overpriced’ relative to other precompiles. We also discovered that the current gas pricing formula could be improved to better estimate the computational complexity of various ModExp input variables. The following changes improve the accuracy of the &lt;code&gt;ModExp&lt;&#x2F;code&gt; pricing:&lt;&#x2F;p&gt;
&lt;h3 id=&quot;1-modify-computational-complexity-formula-to-better-reflect-the-computational-complexity&quot;&gt;1. Modify ‘computational complexity’ formula to better reflect the computational complexity&lt;&#x2F;h3&gt;
&lt;p&gt;The complexity function defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;198&#x2F;&quot;&gt;EIP-198&lt;&#x2F;a&gt; is as follow:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def mult_complexity(x):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if x &amp;lt;= 64: return x ** 2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    elif x &amp;lt;= 1024: return x ** 2 &#x2F;&#x2F; 4 + 96 * x - 3072&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    else: return x ** 2 &#x2F;&#x2F; 16 + 480 * x - 199680&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where is &lt;code&gt;x&lt;&#x2F;code&gt; is &lt;code&gt;max(length_of_MODULUS, length_of_BASE)&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The complexity formula in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;198&#x2F;&quot;&gt;EIP-198&lt;&#x2F;a&gt; was meant to approximate the difficulty of Karatsuba multiplication. However, we found a better approximation for modelling modular exponentiation. In the complexity formula defined in this EIP, &lt;code&gt;x&lt;&#x2F;code&gt; is divided by 8 to account for the number of limbs in multiprecision arithmetic. A comparison of the current ‘complexity’ function and the proposed function against the execution time can be seen below:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2565&#x2F;.&#x2F;assets&#x2F;Complexity_Regression.png&quot; alt=&quot;Option 1 Graph&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The complexity function defined here has a better fit vs. the execution time when compared to the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;198&#x2F;&quot;&gt;EIP-198&lt;&#x2F;a&gt; complexity function. This better fit is because this complexity formula accounts for the use of binary exponentiation algorithms that are used by ‘bigint’ libraries for large exponents. You may also notice the regression line of the proposed complexity function bisects the test vector data points. This is because the run time varies depending on if the modulus is even or odd.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;2-change-the-value-of-gquaddivisor&quot;&gt;2. Change the value of GQUADDIVISOR&lt;&#x2F;h3&gt;
&lt;p&gt;After changing the &#x27;computational complexity&#x27; formula in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;198&#x2F;&quot;&gt;EIP-198&lt;&#x2F;a&gt; to the one defined here it is necessary to change &lt;code&gt;QGUADDIVSOR&lt;&#x2F;code&gt; to bring the gas costs inline with their runtime. By setting the &lt;code&gt;QGUADDIVISOR&lt;&#x2F;code&gt; to &lt;code&gt;3&lt;&#x2F;code&gt; the cost of the ModExp precompile will have a higher cost (gas&#x2F;second) than other precompiles such as ECRecover.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2565&#x2F;.&#x2F;assets&#x2F;GQuad_Change.png&quot; alt=&quot;Option 2 Graph&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;3-set-a-minimum-gas-cost-to-prevent-abuse&quot;&gt;3. Set a minimum gas cost to prevent abuse&lt;&#x2F;h3&gt;
&lt;p&gt;This prevents the precompile from underpricing small input values.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;There are no changes to the underlying interface or arithmetic algorithms, so the existing test vectors can be reused. Below is a table with the updated test vectors:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Test Case&lt;&#x2F;th&gt;&lt;th&gt;EIP-198 Pricing&lt;&#x2F;th&gt;&lt;th&gt;EIP-2565 Pricing&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_1_square&lt;&#x2F;td&gt;&lt;td&gt;204&lt;&#x2F;td&gt;&lt;td&gt;200&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_1_qube&lt;&#x2F;td&gt;&lt;td&gt;204&lt;&#x2F;td&gt;&lt;td&gt;200&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_1_pow0x10001&lt;&#x2F;td&gt;&lt;td&gt;3276&lt;&#x2F;td&gt;&lt;td&gt;341&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_2_square&lt;&#x2F;td&gt;&lt;td&gt;665&lt;&#x2F;td&gt;&lt;td&gt;200&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_2_qube&lt;&#x2F;td&gt;&lt;td&gt;665&lt;&#x2F;td&gt;&lt;td&gt;200&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_2_pow0x10001&lt;&#x2F;td&gt;&lt;td&gt;10649&lt;&#x2F;td&gt;&lt;td&gt;1365&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_3_square&lt;&#x2F;td&gt;&lt;td&gt;1894&lt;&#x2F;td&gt;&lt;td&gt;341&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_3_qube&lt;&#x2F;td&gt;&lt;td&gt;1894&lt;&#x2F;td&gt;&lt;td&gt;341&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_3_pow0x10001&lt;&#x2F;td&gt;&lt;td&gt;30310&lt;&#x2F;td&gt;&lt;td&gt;5461&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_4_square&lt;&#x2F;td&gt;&lt;td&gt;5580&lt;&#x2F;td&gt;&lt;td&gt;1365&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_4_qube&lt;&#x2F;td&gt;&lt;td&gt;5580&lt;&#x2F;td&gt;&lt;td&gt;1365&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_4_pow0x10001&lt;&#x2F;td&gt;&lt;td&gt;89292&lt;&#x2F;td&gt;&lt;td&gt;21845&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_5_square&lt;&#x2F;td&gt;&lt;td&gt;17868&lt;&#x2F;td&gt;&lt;td&gt;5461&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_5_qube&lt;&#x2F;td&gt;&lt;td&gt;17868&lt;&#x2F;td&gt;&lt;td&gt;5461&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_5_pow0x10001&lt;&#x2F;td&gt;&lt;td&gt;285900&lt;&#x2F;td&gt;&lt;td&gt;87381&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;implementations&quot;&gt;Implementations&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;go-ethereum&#x2F;pull&#x2F;21607&quot;&gt;Geth&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;gist.github.com&#x2F;ineffectualproperty&#x2F;60e34f15c31850c5b60c8cf3a28cd423&quot;&gt;Python&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The biggest security consideration for this EIP is creating a potential DoS vector by making ModExp operations too inexpensive relative to their computation time.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;198&#x2F;&quot;&gt;EIP-198&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Escalator fee market change for ETH 1.0 chain</title>
        <published>2020-03-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Dan Finlay</name><email>dan@danfinlay.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2593/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethresear.ch/t/another-simple-gas-fee-model-the-escalator-algorithm-from-the-agoric-papers/6399" />
        

        <id>https://wg-eips.ritovision.com/2593/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:2593"
            label="EIP-2593" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2593/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;The current &quot;first price auction&quot; fee model in Ethereum is inefficient and needlessly costly to users. This EIP proposes a way to replace this with a mechanism that allows dynamically priced transaction fees and efficient transaction price discovery.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Based on &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;agoric.com&#x2F;papers&#x2F;incentive-engineering-for-computational-resource-management&#x2F;full-text&#x2F;&quot;&gt;The Agoric Papers&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Each transaction would have the option of providing parameters that specify an &quot;escalating&quot; bid, creating a time-based auction for validators to include that transaction.&lt;&#x2F;p&gt;
&lt;p&gt;This creates highly efficient price discovery, where the price will always immediately fall to the highest bid price, which is not necessarily that user&#x27;s highest price they would pay.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;ethresear.ch&#x2F;uploads&#x2F;default&#x2F;original&#x2F;2X&#x2F;0&#x2F;042795efa4c2680d644bc66386cd2984a70293f8.gif&quot; alt=&quot;escalator algorithm price chart&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Ethereum currently prices transaction fees using a simple first-price auction, which leads to well documented inefficiencies (some of which are documented in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;blob&#x2F;master&#x2F;EIPS&#x2F;.&#x2F;01559.md&quot;&gt;EIP-1559&lt;&#x2F;a&gt;) when users are trying to estimate what price will get a transaction included in a block, especially during times of price volatility and full blocks.&lt;&#x2F;p&gt;
&lt;p&gt;EIP 1559 is currently being championed as an improvement for the Ethereum protocol, and while I agree that the gas market is very inefficient, since a change like this will affect all client and wallet implementations, the Ethereum community should make sure to make a selection based on solid reasoning and justifications, which I believe 1559 is currently lacking.&lt;&#x2F;p&gt;
&lt;p&gt;To facilitate a more productive and concrete discussion about the gas fee market, I felt it was important to present an alternative that is clearly superior to the status quo, so that any claimed properties of EIP-1559 can be compared to a plausible alternative improvement.&lt;&#x2F;p&gt;
&lt;p&gt;I suggest the three gas payment algorithms be compared under all combinations of these conditions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Blocks that are regularly half full, Blocks that are regularly less than half full, and blocks that repeatedly full in a surprising (&quot;black swan&quot;) series.&lt;&#x2F;li&gt;
&lt;li&gt;Users that are willing to wait for a price that may be below the market rate, vs users who value inclusion urgently and are willing to pay above market rate.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;We should then ask:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Is the user willing to pay the most in a given scenario also likely to have their transaction processed in a time period they find acceptable?&lt;&#x2F;li&gt;
&lt;li&gt;Are users who want a good price likely to get included in a reasonable period of time? (Ideally within one block)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;I believe that under this analysis we will find that the escalator algorithm outperforms EIP-1559 in both normal and volatile conditions, for both high-stakes transactions and more casual users looking for a good price.&lt;&#x2F;p&gt;
&lt;p&gt;While I think a deeper simulation&#x2F;analysis should be completed, I will share my expected results under these conditions.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore, by introducing tx fee payment related to the current time, we create an incentive for miners to more honestly report the current time.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;user-strategies-under-various-conditions-and-algorithms&quot;&gt;User Strategies Under Various Conditions and Algorithms&lt;&#x2F;h3&gt;
&lt;p&gt;First I will suggest a likely optimal strategy for different players under the conditions of the different algorithms being considered.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Gas Strategy&lt;&#x2F;th&gt;&lt;th&gt;Current Single-Price&lt;&#x2F;th&gt;&lt;th&gt;EIP 1559&lt;&#x2F;th&gt;&lt;th&gt;Escalator&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Blocks regularly half full, user wants urgent inclusion.&lt;&#x2F;td&gt;&lt;td&gt;User bids within the range of prices that have been recently accepted, likely over-pays slightly.&lt;&#x2F;td&gt;&lt;td&gt;User bids one price tier over the current rate, and is likely included.&lt;&#x2F;td&gt;&lt;td&gt;User bids a range from the low end of recently included to the high end, and is likely included at the lowest rate possible.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Blocks regularly half full, user willing to wait for a good price.&lt;&#x2F;td&gt;&lt;td&gt;User bids below or near the low end of the recently accepted prices, may need to wait for a while. If waiting too long, user may need to re-submit with a higher price.&lt;&#x2F;td&gt;&lt;td&gt;User bids under or at the current price tier, and may wait for the price to fall. If waiting too long, user may need to re-submit with a higher price.&lt;&#x2F;td&gt;&lt;td&gt;User bids as low as they&#x27;d like, but set an upper bound on how long they&#x27;re willing to wait before increasing price.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Blocks regularly full, user wants urgent inclusion.&lt;&#x2F;td&gt;&lt;td&gt;User bids over the price of all recently accepted transactions, almost definitely over-paying significantly.&lt;&#x2F;td&gt;&lt;td&gt;User bids over the current price tier, and needs to increase their &lt;code&gt;tip&lt;&#x2F;code&gt; parameter to be competitive on the next block, recreating the single-price auction price problem.&lt;&#x2F;td&gt;&lt;td&gt;User bids over a price that has been accepted consistently, with an escalating price in case that price is not high enough.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Blocks regularly full, user willing to wait for a good price.&lt;&#x2F;td&gt;&lt;td&gt;User bids below the low end of the recently accepted prices, may need to wait for a while. If waiting too long, user may need to re-submit with a higher price.&lt;&#x2F;td&gt;&lt;td&gt;User bids under or at the current price tier, and may wait for the price to fall. If waiting too long, user may need to re-submit with a higher price.&lt;&#x2F;td&gt;&lt;td&gt;User bids as low as they&#x27;d like, but set an upper bound on how long they&#x27;re willing to wait before increasing price.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Blocks regularly under-full, user wants urgent inclusion.&lt;&#x2F;td&gt;&lt;td&gt;User bids within or over the range of prices that have been recently accepted, likely over-pays slightly, and is likely included in the next block.&lt;&#x2F;td&gt;&lt;td&gt;User bids at or over the current price tier, and is likely included in the next block.&lt;&#x2F;td&gt;&lt;td&gt;User submits bid starting within recently accepted prices, is likely accepted in the next block.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Blocks regularly under-full, user willing to wait for a good price.&lt;&#x2F;td&gt;&lt;td&gt;User bids below the low end of the recently accepted prices, may need to wait for a while. If waiting too long, user may need to re-submit with a higher price.&lt;&#x2F;td&gt;&lt;td&gt;User bids at or under the current price tier, and is likely included in the next block. If bidding under and waiting too long, user may need to re-submit with a higher price.&lt;&#x2F;td&gt;&lt;td&gt;User bids as low as they&#x27;d like, but set an upper bound on how long they&#x27;re willing to wait before increasing price, is likely included in the next few blocks at the lowest possible price.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;user-results-under-various-conditions-and-algorithms&quot;&gt;User Results Under Various Conditions and Algorithms&lt;&#x2F;h3&gt;
&lt;p&gt;Now I will consider the ultimate results of the strategies listed above. Are users happy under these conditions? Did we save users money? Were users who wanted urgent inclusion able to secure it?&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Gas Strategy&lt;&#x2F;th&gt;&lt;th&gt;Current Single-Price&lt;&#x2F;th&gt;&lt;th&gt;EIP 1559&lt;&#x2F;th&gt;&lt;th&gt;Escalator&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Blocks regularly half full, user wants urgent inclusion.&lt;&#x2F;td&gt;&lt;td&gt;User pays an expected amount, and gets transaction mined reliably.&lt;&#x2F;td&gt;&lt;td&gt;User pays an expected amount, and gets transaction mined reliably.&lt;&#x2F;td&gt;&lt;td&gt;User pays an expected amount, and gets transaction mined reliably.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Blocks regularly half full, user willing to wait for a good price.&lt;&#x2F;td&gt;&lt;td&gt;User can wait for a better price, but may need to resubmit re-signed transactions.&lt;&#x2F;td&gt;&lt;td&gt;User can wait for a better price, but may need to resubmit re-signed transactions.&lt;&#x2F;td&gt;&lt;td&gt;User can discover the lowest price within their time preference with a single signature.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Blocks regularly full, user wants urgent inclusion.&lt;&#x2F;td&gt;&lt;td&gt;User over-pays, but reliably gets transaction included.&lt;&#x2F;td&gt;&lt;td&gt;Due to &lt;code&gt;tip&lt;&#x2F;code&gt; parameter &quot;breaking tie&quot; within a block, user over-pays for reliable inclusion.&lt;&#x2F;td&gt;&lt;td&gt;User is able to balance the amount of overpayment they risk with the urgency they require.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Blocks regularly full, user willing to wait for a good price.&lt;&#x2F;td&gt;&lt;td&gt;User chooses their price, and waits for it, or manually re-submits.&lt;&#x2F;td&gt;&lt;td&gt;User chooses their price, and waits for it, or manually re-submits.&lt;&#x2F;td&gt;&lt;td&gt;User chooses their lowest price, but also their highest price and maximum wait time, so no resubmission is needed.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Blocks regularly under-full, user wants urgent inclusion.&lt;&#x2F;td&gt;&lt;td&gt;User over-pays, but reliably gets transaction included.&lt;&#x2F;td&gt;&lt;td&gt;User bids at or over current price tier, gets transaction mined reliably.&lt;&#x2F;td&gt;&lt;td&gt;User pays an expected amount, and gets transaction mined reliably.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Blocks regularly under-full, user willing to wait for a good price.&lt;&#x2F;td&gt;&lt;td&gt;User bids below the low end of the recently accepted prices, may need to wait for a while. If waiting too long, user may need to re-submit with a higher price.&lt;&#x2F;td&gt;&lt;td&gt;User chooses their price, and waits for it, or manually re-submits.&lt;&#x2F;td&gt;&lt;td&gt;User chooses their lowest price, but also their highest price and maximum wait time, so no resubmission is needed.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;In all cases, the escalator algorithm as I have described is able to perform optimally.&lt;&#x2F;p&gt;
&lt;p&gt;The current gas auction model works well under half-full and less conditions, but for users with urgent needs, has the downside of overpayment. For users seeking a low price, the current model has the downside of requiring re-submission, but has the benefit of always giving users a path towards reliable block inclusion.&lt;&#x2F;p&gt;
&lt;p&gt;EIP-1559 also performs well under normal conditions, but under conditions where blocks are regularly full, the price discovery mechanism breaks, and miners will fall back to the &lt;code&gt;TIP&lt;&#x2F;code&gt; parameter to choose the transactions to include, meaning that under network congestion, EIP-1559 forces users to &lt;em&gt;either&lt;&#x2F;em&gt; choose efficient prices or certainty of next-block inclusion.&lt;&#x2F;p&gt;
&lt;p&gt;EIP-1559 also has all the re-submission issues of the current model in situations where a user would like to pay under the current market rate, but has certain time constraints limiting their patience. The Escalator algorithm is the only strategy listed here that allows users to discover the lowest possible price given the network conditions and their time constraints.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;Client-Wide Parameters&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;INITIAL_FORK_BLKNUM&lt;&#x2F;code&gt;: TBD&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Transaction Parameters&lt;&#x2F;strong&gt;
The transaction &lt;code&gt;gasPrice&lt;&#x2F;code&gt; parameter is now optional, and if excluded can be replaced by these parameters instead:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;START_PRICE&lt;&#x2F;code&gt;: The lowest price that the user would like to pay for the transaction.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;START_TIME&lt;&#x2F;code&gt;: The first time that this transaction is valid at.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;MAX_PRICE&lt;&#x2F;code&gt;: The maximum price the sender would be willing to pay to have this transaction processed.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;MAX_TIME&lt;&#x2F;code&gt;: The time at which point the user&#x27;s &lt;code&gt;MAX_PRICE&lt;&#x2F;code&gt; is achieved. The transaction remains valid after this time at that price.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Proposal&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;For all blocks where &lt;code&gt;block.number &amp;gt;= INITIAL_FORK_BLKNUM&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;p&gt;When processing a transaction with the new pricing parameters, miners now receive a fee based off of the following linear function, where &lt;code&gt;BLOCK&lt;&#x2F;code&gt; is the current block number:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;IF &lt;code&gt;BLOCK &amp;gt; MAX_TIME&lt;&#x2F;code&gt; then &lt;code&gt;TX_FEE = MAX_PRICE&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TX_FEE = START_PRICE + ((MAX_PRICE - START_PRICE) &#x2F; (MAX_TIME - START_TIME) * (BLOCK - START_TIME))&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;As a JavaScript function:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; txFee&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;startTime&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; startPrice&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; maxTime&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; maxPrice&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; currentTime&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;currentTime&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; maxTime&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; maxPrice&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; priceRange&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; maxPrice&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; startPrice&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; blockRange&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; maxTime&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; startTime&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; slope&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; priceRange&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; blockRange&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; startPrice&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;slope&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;currentTime&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; startTime&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Since a current &lt;code&gt;gasPrice&lt;&#x2F;code&gt; transaction is effectively a flat-escalated transaction bid, it is entirely compatible with this model, and so there is no concrete requirement to deprecate current transaction processing logic, allowing cold wallets and hardware wallets to continue working for the foreseeable future.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The security considerations for this EIP are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;None currently known.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Account gas storage opcodes</title>
        <published>2020-03-04T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>William Morriss</name><uri>https://github.com/wjmelements</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3322/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3322-efficient-gas-storage/5470" />
        

        <id>https://wg-eips.ritovision.com/3322/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:3322"
            label="EIP-3322" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3322/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Allows contract accounts to store gas that can be transferred to the refund counter.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Contracts can persist gas for later transfer to the refund counter.
Three opcodes are introduced to read, add to, and use this gas counter.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The refund mechanism is currently being used by gas tokens to arbitrage gas price.
This brings gas supply elasticity and price stability by moving gas from blocks with less demand to blocks with more demand.
Unfortunately this rewards unnecessary state growth.
By introducing a superior gas storage mechanism, the gas market will require less storage and computation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Contract accounts gain an unsigned gas refund counter, initially zero.&lt;&#x2F;p&gt;
&lt;p&gt;Three new opcodes are introduced to manage this state.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;SELFGAS&lt;&#x2F;code&gt; (&lt;code&gt;0x49&lt;&#x2F;code&gt;): Pushes the current account&#x27;s gas refund counter onto the stack.
Shares gas pricing with &lt;code&gt;SELFBALANCE&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;USEGAS&lt;&#x2F;code&gt; (&lt;code&gt;0x4a&lt;&#x2F;code&gt;): Pops &lt;code&gt;amount&lt;&#x2F;code&gt; from the stack.
The minimum of &lt;code&gt;amount&lt;&#x2F;code&gt; and the current account&#x27;s gas refund counter is transferred to the execution context&#x27;s refund counter.
Costs &lt;code&gt;5000&lt;&#x2F;code&gt; gas.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;STOREGAS&lt;&#x2F;code&gt; (&lt;code&gt;0x4b&lt;&#x2F;code&gt;): Pops &lt;code&gt;amount&lt;&#x2F;code&gt; from the stack.
Costs &lt;code&gt;5000 + amount&lt;&#x2F;code&gt; gas.
Increases the current account&#x27;s gas refund counter by &lt;code&gt;amount&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;By reusing the execution context&#x27;s refund counter we can reuse its 50% DoS protection, which limits its block elasticity contribution to 2x.&lt;&#x2F;p&gt;
&lt;p&gt;The gas costs are based on similar opcodes &lt;code&gt;SELFBALANCE&lt;&#x2F;code&gt; and &lt;code&gt;SSTORE&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Most accounts will store no gas, so the per-account storage overhead should be minimal or even zero in the normal case.&lt;&#x2F;p&gt;
&lt;p&gt;The opcode numbers chosen are in the same &lt;code&gt;0x4X&lt;&#x2F;code&gt; range as &lt;code&gt;SELFBALANCE&lt;&#x2F;code&gt; and &lt;code&gt;GASLIMIT&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Because the gas is added to the refund counter, no compatibility issues are anticipated.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Code&lt;&#x2F;th&gt;&lt;th&gt;Used Gas&lt;&#x2F;th&gt;&lt;th&gt;Refund&lt;&#x2F;th&gt;&lt;th&gt;Original&lt;&#x2F;th&gt;&lt;th&gt;Final&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;0x60004900&lt;&#x2F;td&gt;&lt;td&gt;5003&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x60034900&lt;&#x2F;td&gt;&lt;td&gt;5003&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x60034900&lt;&#x2F;td&gt;&lt;td&gt;5003&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x60034900&lt;&#x2F;td&gt;&lt;td&gt;5003&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;4&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x60034960034900&lt;&#x2F;td&gt;&lt;td&gt;10006&lt;&#x2F;td&gt;&lt;td&gt;4&lt;&#x2F;td&gt;&lt;td&gt;4&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x60034960034900&lt;&#x2F;td&gt;&lt;td&gt;10006&lt;&#x2F;td&gt;&lt;td&gt;6&lt;&#x2F;td&gt;&lt;td&gt;6&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x484900&lt;&#x2F;td&gt;&lt;td&gt;5010&lt;&#x2F;td&gt;&lt;td&gt;100000&lt;&#x2F;td&gt;&lt;td&gt;100000&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x61ffff4a00&lt;&#x2F;td&gt;&lt;td&gt;70538&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;65535&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;DoS is already limited by the 50% refund limit.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>New opcodes TXGASLIMIT and CALLGASLIMIT</title>
        <published>2020-02-29T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Forshtat</name><email>forshtat1@gmail.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2542/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2542-add-txgaslimit-callgaslimit-txgasrefund-opcodes" />
        

        <id>https://wg-eips.ritovision.com/2542/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:2542"
            label="EIP-2542" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2542/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;A mechanism to allow smart contracts to access information on gas limits for the current transaction and execution frame.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, there is an existing opcode &lt;code&gt;0x45 GASLIMIT&lt;&#x2F;code&gt; that provides access to the block gas limit. While this information may be useful in some cases, it is probably not a value that smart contract developers may be concerned about. The opcode &lt;code&gt;0x5a GAS&lt;&#x2F;code&gt; provides the remaining gas, not the initial one. Also, it is worth noting how existing &lt;code&gt;0x32 ORIGIN&lt;&#x2F;code&gt;, &lt;code&gt;0x33 CALLER&lt;&#x2F;code&gt;, &lt;code&gt;0x34 CALLVALUE&lt;&#x2F;code&gt; and &lt;code&gt;0x3a GASPRICE&lt;&#x2F;code&gt; opcodes set a pattern of having access to both the transaction and current execution frame state.
TBD: as 0x30 opcode range is exhausted, the proposed opcodes can be added to 0x50 range, or a new range can be added.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;As concepts of relaying, meta-transactions, gas fees, and account abstraction gain popularity, it becomes critical for some contracts to be able to track gas expenditure with absolute precision. Without access to this data on an EVM level, such contracts resort to approximation, mimicking EVM logic on-chain, and some use-cases even become infeasible.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;If block.number &amp;gt;= TBD, add three new opcodes:&lt;&#x2F;p&gt;
&lt;p&gt;TXGASLIMIT: 0x5c&lt;&#x2F;p&gt;
&lt;p&gt;Pushes the gas limit of the entire transaction onto the stack. This is a value of the &#x27;startgas&#x27; parameter signed by the externally owned account.&lt;br &#x2F;&gt;
Gas costs: 2 (same as &lt;code&gt;GASLIMIT&lt;&#x2F;code&gt;)&lt;&#x2F;p&gt;
&lt;p&gt;CALLGASLIMIT: 0x5d&lt;&#x2F;p&gt;
&lt;p&gt;Pushes the gas limit of the current execution frame onto the stack. This is the &#x27;callGas&#x27; value that was obtained after the application of the EIP-150 “all but one 64th” rule.&lt;br &#x2F;&gt;
Gas costs: 2 (same as &lt;code&gt;GASLIMIT&lt;&#x2F;code&gt;)&lt;&#x2F;p&gt;
&lt;p&gt;Also, consider renaming &lt;code&gt;0x45 GASLIMIT&lt;&#x2F;code&gt; to &lt;code&gt;BLOCKGASLIMIT&lt;&#x2F;code&gt; to avoid confusion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Consider a solidity smart contract that wants to know how much gas the entire transaction or a part of it had consumed. It is not entirely possible with the current EVM. With proposed changes, using a pseudo-Solidity syntax, this information would be easily available:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function keepTrackOfGas(string memory message, uint256 number) public {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    uint gasUsed = msg.gasLimit - gasleft();&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This is an extremely common use case, and multiple implementations suffer from not taking the non-accessible expenses into consideration. The state-of-the-art solution for the &lt;code&gt;gasUsed&lt;&#x2F;code&gt; problem is to access &#x27;gasleft()&#x27; as the first line of your smart contract.&lt;br &#x2F;&gt;
Note how variable transaction input size means the gas used by the transaction depends on the number of zero and non-zero bytes of input, as well &lt;code&gt;GTXDATANONZERO&lt;&#x2F;code&gt;. Another issue is that Solidity handles &lt;code&gt;public&lt;&#x2F;code&gt; methods by loading the entire input from &lt;code&gt;calldata&lt;&#x2F;code&gt; to &lt;code&gt;memory&lt;&#x2F;code&gt;, spending an unpredictable amount of gas.&lt;&#x2F;p&gt;
&lt;p&gt;Another application is for a method to have a requirement for a gas limit given to it. This situation arises quite commonly in the context of meta-transactions, where the msg.sender&#x27;s account holder may not be too interested in the inner transaction&#x27;s success. Exaggerated pseudocode:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function verifyGasLimit(uint256 desiredGasLimit, bytes memory signature, address signer, bytes memory someOtherData) public {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    require(ecrecover(abi.encodePacked(desiredGasLimit, someOtherData), signature) == signer, &amp;quot;Signature does not match&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    require(tx.gasLimit == desiredGasLimit, &amp;quot;Transaction limit does not match the signed value. The signer did not authorize that.&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In this situation it is not possible to rely on &#x27;gasleft()&#x27; value, because it is dynamic, depends on opcode and calldata pricing, and cannot be signed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal introduces two new opcodes and renames an existing one, but stays fully backwards compatible apart from that.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;forwards-compatibility&quot;&gt;Forwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;A major consideration for this proposal is its alignment with one or many possible future modifications to the EVM:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;EIP-2489 Deprecate the GAS opcode (a.k.a. 39-UNGAS proposal)&lt;br &#x2F;&gt;
There is a sentiment that the ability of smart contracts to perform &quot;gas introspection&quot; leads to the contracts being dependent on current opcode pricing.&lt;br &#x2F;&gt;
While criticizing said misconception is beyond the scope of this EIP, in case there is a need to make a breaking change to the behavior of the existing &lt;code&gt;0x5a GAS&lt;&#x2F;code&gt; opcode, the same considerations will apply to the proposed opcodes. This means this EIP does not add any new restraints on EMV evolution.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Stateless Ethereum&lt;br &#x2F;&gt;
The UNGAS proposal is said to be related to the ongoing project of Stateless Ethereum. It’s not strictly necessary for stateless Ethereum, but it is an idea for how to make future breaking changes to gas schedules easier.&lt;br &#x2F;&gt;
As long as the concept of &#x27;gas limit&#x27; is part of the EVM, the author sees no reason proposed opcodes would conflict with Stateless Ethereum. Gas schedules are not exposed by this proposal.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Comparison with other controversial opcodes&lt;br &#x2F;&gt;
There are opcodes that are not proposed for deprecation but face criticism. Examples include &lt;code&gt;0x32 ORIGIN&lt;&#x2F;code&gt; being misused by smart contract developers, or &lt;code&gt;0x46 CHAINID&lt;&#x2F;code&gt; making some smart-contracts &#x27;unforkable&#x27;.&lt;br &#x2F;&gt;
This EIP neither encourages nor enables any bad security practices, and does not introduce any concepts that are new for EVM either.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Existing smart contracts are not affected by this change.&lt;br &#x2F;&gt;
Smart contracts that will use proposed opcodes must not use them for the core of any security features, but only as a source of information about their execution environment.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The implementations must be completed before any EIP is given status &quot;Final&quot;, but it need not be completed before the EIP is accepted. While there is merit to the approach of reaching consensus on the specification and rationale before writing code, the principle of &quot;rough consensus and running code&quot; is still useful when it comes to resolving many discussions of API details.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>ENS Wildcard Resolution</title>
        <published>2020-02-28T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Nick Johnson</name><uri>https://github.com/arachnid</uri>
	</author>
	
	<author>
		<name>0age</name><uri>https://github.com/0age</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2544/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2544-ens-wildcard-resolution" />
        

        <id>https://wg-eips.ritovision.com/2544/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:2544"
            label="ERC-2544" />
        

        
        

        
        <summary type="html">Adds support for &quot;wildcard&quot; resolution of subdomains in ENS.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2544/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The Ethereum Name Service Specification (EIP-137) establishes a two-step name resolution process. First, an ENS client performs the namehash algorithm on the name to determine the associated &quot;node&quot;, and supplies that node to the ENS Registry contract to determine the resolver. Then, if a resolver has been set on the Registry, the client supplies that same node to the resolver contract, which will return the associated address or other record.&lt;&#x2F;p&gt;
&lt;p&gt;As currently specified, this process terminates if a resolver is not set on the ENS Registry for a given node. This EIP changes the name resolution process by adding an additional step if a resolver is not set for a domain. This step strips out the leftmost label from the name, derives the node of the new fragment, and supplies that node to the ENS Registry. If a resolver is located for that node, the client supplies the original, complete node to that resolver contract to derive the relevant records. This step is repeated until a node with a resolver is found.&lt;&#x2F;p&gt;
&lt;p&gt;Further, this specification defines a new way for resolvers to resolve names, using a unified &lt;code&gt;resolve()&lt;&#x2F;code&gt; method that permits more flexible handling of name resolution.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Many applications such as wallet providers, exchanges, and dapps have expressed a desire to issue ENS names for their users via custom subdomains on a shared parent domain. However, the cost of doing so is currently prohibitive for large user bases, as a distinct record must be set on the ENS Registry for each subdomain.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore, users cannot immediately utilize these subdomains upon account creation, as the transaction to assign a resolver for the node of the subdomain must first be submitted and mined on-chain. This adds unnecessary friction when onboarding new users, who coincidentally would often benefit greatly from the usability improvements afforded by an ENS name.&lt;&#x2F;p&gt;
&lt;p&gt;Enabling wildcard support allows for the design of more advanced resolvers that deterministically generate addresses and other records for unassigned subdomains. The generated addresses could map to counterfactual contract deployment addresses (i.e. &lt;code&gt;CREATE2&lt;&#x2F;code&gt; addresses), to designated &quot;fallback&quot; addresses, or other schemes. Additionally, individual resolvers would still be assignable to any given subdomain, which would supersede the wildcard resolution using the parent resolver.&lt;&#x2F;p&gt;
&lt;p&gt;Another critical motivation with EIP-2544 is to enable wildcard resolution in a backwards-compatible fashion. It does not require modifying the current ENS Registry contract or any existing resolvers, and continues to support existing ENS records — legacy ENS clients would simply fail to resolve wildcard records.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;Let:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;namehash&lt;&#x2F;code&gt; be the algorithm defined in EIP 137.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;dnsencode&lt;&#x2F;code&gt; be the process for encoding DNS names specified in section 3.1 of RFC1035, with the exception that there is no limit on the total length of the encoded name. The empty string is encoded identically to the name &#x27;.&#x27;, as a single 0-octet.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;parent&lt;&#x2F;code&gt; be a function that removes the first label from a name (eg, &lt;code&gt;parent(&#x27;foo.eth&#x27;) = &#x27;eth&#x27;&lt;&#x2F;code&gt;). &lt;code&gt;parent(&#x27;tld&#x27;)&lt;&#x2F;code&gt; is defined as the empty string &#x27;&#x27;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ens&lt;&#x2F;code&gt; is the ENS registry contract for the current network.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;EIP-2544-compliant ENS resolvers MAY implement the following function interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;interface ExtendedResolver {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function resolve(bytes calldata name, bytes calldata data) external view returns(bytes);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;If a resolver implements this function, it MUST return true when &lt;code&gt;supportsInterface()&lt;&#x2F;code&gt; is called on it with the interface&#x27;s ID, 0xTBD.&lt;&#x2F;p&gt;
&lt;p&gt;ENS clients will call &lt;code&gt;resolve&lt;&#x2F;code&gt; with the DNS-encoded name to resolve and the encoded calldata for a resolver function (as specified in EIP-137 and elsewhere); the function MUST either return valid return data for that function, or revert if it is not supported.&lt;&#x2F;p&gt;
&lt;p&gt;EIP-2544-compliant ENS clients MUST perform the following procedure when determining the resolver for a given name:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Set &lt;code&gt;currentname = name&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Set &lt;code&gt;resolver = ens.resolver(namehash(currentname))&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;resolver&lt;&#x2F;code&gt; is not the zero address, halt and return &lt;code&gt;resolver&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;name&lt;&#x2F;code&gt; is the empty name (&#x27;&#x27; or &#x27;.&#x27;), halt and return null.&lt;&#x2F;li&gt;
&lt;li&gt;Otherwise, set &lt;code&gt;currentname = parent(currentname)&lt;&#x2F;code&gt; and go to 2.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;If the procedure above returns null, name resolution MUST terminate unsuccessfully. Otherwise, EIP-2544-compliant ENS clients MUST perform the following procedure when resolving a record:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Set &lt;code&gt;calldata&lt;&#x2F;code&gt; to the ABI-encoded call data for the resolution function required - for example, the ABI encoding of &lt;code&gt;addr(namehash(name))&lt;&#x2F;code&gt; when resolving the &lt;code&gt;addr&lt;&#x2F;code&gt; record.&lt;&#x2F;li&gt;
&lt;li&gt;Set &lt;code&gt;supports2544 = resolver.supportsInterface(0xTBD)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;supports2544&lt;&#x2F;code&gt; is true, set &lt;code&gt;result = resolver.resolve(dnsencode(name), calldata)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Otherwise, set &lt;code&gt;result&lt;&#x2F;code&gt; to the result of calling &lt;code&gt;resolver&lt;&#x2F;code&gt; with &lt;code&gt;calldata&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Return &lt;code&gt;result&lt;&#x2F;code&gt; after decoding it using the return data ABI of the corresponding resolution function (eg, for &lt;code&gt;addr()&lt;&#x2F;code&gt;, ABI-decode the result of &lt;code&gt;resolver.resolve()&lt;&#x2F;code&gt; as an &lt;code&gt;address&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Note that in all cases the resolution function (&lt;code&gt;addr()&lt;&#x2F;code&gt; etc) and the &lt;code&gt;resolve&lt;&#x2F;code&gt; function are supplied the original &lt;code&gt;name&lt;&#x2F;code&gt;, &lt;em&gt;not&lt;&#x2F;em&gt; the &lt;code&gt;currentname&lt;&#x2F;code&gt; found in the first stage of resolution.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;pseudocode&quot;&gt;Pseudocode&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function getResolver(name) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    for(let currentname = name; currentname !== &amp;#39;&amp;#39;; currentname = parent(currentname)) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        const node = namehash(currentname);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        const resolver = ens.resolver(node);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        if(resolver != &amp;#39;0x0000000000000000000000000000000000000000&amp;#39;) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            return resolver;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return null;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function resolve(name, func, ...args) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    const resolver = getResolver(name);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if(resolver === null) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return null;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    const supports2544 = resolver.supportsInterface(&amp;#39;0xTBD&amp;#39;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    let result;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if(supports2544) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        const calldata = resolver[func].encodeFunctionCall(namehash(name), ...args);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        result = resolver.resolve(dnsencode(name), calldata);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return resolver[func].decodeReturnData(result);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    } else {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return resolver[func](...args);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The proposed implementation supports wildcard resolution in a manner that minimizes the impact to existing systems. It also reuses existing algorithms and procedures to the greatest possible extent, thereby easing the burden placed on authors and maintainers of various ENS clients.&lt;&#x2F;p&gt;
&lt;p&gt;It also recognizes an existing consensus concerning the desirability of wildcard resolution for ENS, enabling more widespread adoption of the original specification by solving for a key scalability obstacle.&lt;&#x2F;p&gt;
&lt;p&gt;While introducing an optional &lt;code&gt;resolve&lt;&#x2F;code&gt; function for resolvers, taking the unhashed name and calldata for a resolution function increases implementation complexity, it provides a means for resolvers to obtain plaintext labels and act accordingly, which enables many wildcard-related use-cases that would otherwise not be possible - for example, a wildcard resolver could resolve &lt;code&gt;id.nifty.eth&lt;&#x2F;code&gt; to the owner of the NFT with id &lt;code&gt;id&lt;&#x2F;code&gt; in some collection. With only namehashes to work with, this is not possible. Resolvers with simpler requirements can continue to simply implement resolution functions directly and omit support for the &lt;code&gt;resolve&lt;&#x2F;code&gt; function entirely.&lt;&#x2F;p&gt;
&lt;p&gt;The DNS wire format is used for encoding names as it permits quick and gas-efficient hashing of names, as well as other common operations such as fetching or removing individual labels; in contrast, dot-separated names require iterating over every character in the name to find the delimiter.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Existing ENS clients that are compliant with EIP-137 will fail to resolve wildcard records and refuse to interact with them, while those compliant with EIP-2544 will continue to correctly resolve, or reject, existing ENS records. Resolvers wishing to implement the new &lt;code&gt;resolve&lt;&#x2F;code&gt; function for non-wildcard use-cases (eg, where the resolver is set directly on the name being resolved) should consider what to return to legacy clients that call the individual resolution functions for maximum compatibility.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;While compliant ENS clients will continue to refuse to resolve records without a resolver, there is still the risk that an improperly-configured client will refer to an incorrect resolver, or will not reject interactions with the null address when a resolver cannot be located.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, resolvers supporting completely arbitrary wildcard subdomain resolution will increase the likelihood of funds being sent to unintended recipients as a result of typos. Applications that implement such resolvers should consider making additional name validation available to clients depending on the context, or implementing features that support recoverability of funds.&lt;&#x2F;p&gt;
&lt;p&gt;There is also the possibility that some applications might require that no resolver be set for certain subdomains. For this to be problematic, the parent domain would need to successfully resolve the given subdomain node — to the knowledge of the authors, no application currently supports this feature or expects that subdomains should not resolve to a record.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>BLS12-377 curve operations</title>
        <published>2020-02-26T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Vlasov</name><uri>https://github.com/shamatar</uri>
	</author>
	
	<author>
		<name>hujw77</name><uri>https://github.com/hujw77</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2539/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2539-bls12-377-precompile-discussion-thread/4659" />
        

        <id>https://wg-eips.ritovision.com/2539/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2539"
            label="EIP-2539" />
        

        
        

        
        <summary type="html">Precompiles for BLS12-377 curve operations</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2539/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This precompile adds operation on BLS12-377 curve (from Zexe paper) as a precompile in a set necessary to &lt;em&gt;efficiently&lt;&#x2F;em&gt; perform operations such as BLS signature verification and perform SNARKs verifications. Unique properties of BLS12-377 also later allow to have SNARKs that check BLS12-377 pairing in an efficient way and allow e.g. constant-size BLS signature aggregation.&lt;&#x2F;p&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= X&lt;&#x2F;code&gt; we introduce &lt;em&gt;nine&lt;&#x2F;em&gt; separate precompiles to perform the following operations:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;BLS12_377_G1ADD - to perform point addition on a curve defined over prime field&lt;&#x2F;li&gt;
&lt;li&gt;BLS12_377_G1MUL - to perform point multiplication on a curve defined over prime field&lt;&#x2F;li&gt;
&lt;li&gt;BLS12_377_G1MULTIEXP - to perform multiexponentiation on a curve defined over prime field&lt;&#x2F;li&gt;
&lt;li&gt;BLS12_377_G2ADD - to perform point addition on a curve twist defined over quadratic extension of the base field&lt;&#x2F;li&gt;
&lt;li&gt;BLS12_377_G2MUL - to perform point multiplication on a curve twist defined over quadratic extension of the base field&lt;&#x2F;li&gt;
&lt;li&gt;BLS12_377_G2MULTIEXP - to perform multiexponentiation on a curve twist defined over quadratic extension of the base field&lt;&#x2F;li&gt;
&lt;li&gt;BLS12_377_PAIRING - to perform a pairing operations between a set of &lt;em&gt;pairs&lt;&#x2F;em&gt; of (G1, G2) points&lt;&#x2F;li&gt;
&lt;li&gt;BLS12_377_MAP_FP_TO_G1 - maps base field element into the G1 point&lt;&#x2F;li&gt;
&lt;li&gt;BLS12_377_MAP_FP2_TO_G2 - maps extension field element into the G2 point&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Multiexponentiation operation is included to efficiently aggregate public keys or individual signer&#x27;s signatures during BLS signature verification.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;proposed-addresses-table&quot;&gt;Proposed addresses table&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Precompile&lt;&#x2F;th&gt;&lt;th&gt;Address&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;BLS12_377_G1ADD&lt;&#x2F;td&gt;&lt;td&gt;0x15&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;BLS12_377_G1MUL&lt;&#x2F;td&gt;&lt;td&gt;0x16&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;BLS12_377_G1MULTIEXP&lt;&#x2F;td&gt;&lt;td&gt;0x17&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;BLS12_377_G2ADD&lt;&#x2F;td&gt;&lt;td&gt;0x18&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;BLS12_377_G2MUL&lt;&#x2F;td&gt;&lt;td&gt;0x19&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;BLS12_377_G2MULTIEXP&lt;&#x2F;td&gt;&lt;td&gt;0x1a&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;BLS12_377_PAIRING&lt;&#x2F;td&gt;&lt;td&gt;0x1b&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;BLS12_377_MAP_FP_TO_G1&lt;&#x2F;td&gt;&lt;td&gt;0x1c&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;BLS12_377_MAP_FP2_TO_G2&lt;&#x2F;td&gt;&lt;td&gt;0x1d&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Motivation of this precompile is to add a cryptographic primitive that allows to get 120+ bits of security for operations over pairing friendly curve compared to the existing BN254 precompile that only provides 80 bits of security. In addition it allows efficient one-time recursive proof aggregations, e.g. proofs about existence of BLS12-377 based signature.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Curve parameters:&lt;&#x2F;p&gt;
&lt;p&gt;BLS12-377 curve is fully defined by the following set of parameters (coefficient &lt;code&gt;A=0&lt;&#x2F;code&gt; for all BLS12 curves):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Base field modulus = 0x01ae3a4617c510eac63b05c06ca1493b1a22d9f300f5138f1ef3622fba094800170b5d44300000008508c00000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;B coefficient = 0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Main subgroup order = 0x12ab655e9a2ca55660b44d1e5c37b00159aa76fed00000010a11800000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Extension tower:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Fp2 construction:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Fp quadratic non-residue = 0x01ae3a4617c510eac63b05c06ca1493b1a22d9f300f5138f1ef3622fba094800170b5d44300000008508bffffffffffc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Fp6&#x2F;Fp12 construction:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Fp2 cubic non-residue c0 = 0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Fp2 cubic non-residue c1 = 0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Twist parameters:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Twist type: D&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;B coefficient for twist c0 = 0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;B coefficient for twist c1 = 0x010222f6db0fd6f343bd03737460c589dc7b4f91cd5fd889129207b63c6bf8000dd39e5c1ccccccd1c9ed9999999999a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Generators:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;G1:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;X = 0x008848defe740a67c8fc6225bf87ff5485951e2caa9d41bb188282c8bd37cb5cd5481512ffcd394eeab9b16eb21be9ef&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Y = 0x01914a69c5102eff1f674f5d30afeec4bd7fb348ca3e52d96d182ad44fb82305c2fe3d3634a9591afd82de55559c8ea6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;G2:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;X c0 = 0x018480be71c785fec89630a2a3841d01c565f071203e50317ea501f557db6b9b71889f52bb53540274e3e48f7c005196&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;X c1 = 0x00ea6040e700403170dc5a51b1b140d5532777ee6651cecbe7223ece0799c9de5cf89984bff76fe6b26bfefa6ea16afe&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Y c0 = 0x00690d665d446f7bd960736bcbb2efb4de03ed7274b49a58e458c282f832d204f2cf88886d8c7c2ef094094409fd4ddf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Y c1 = 0x00f8169fd28355189e549da3151a70aa61ef11ac3d591bf12463b01acee304c24279b83f5e52270bd9a1cdd185eb8f93&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Pairing parameters:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|x| (miller loop scalar) = 0x8508c00000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;x is negative = false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;fine-points-and-encoding-of-base-elements&quot;&gt;Fine points and encoding of base elements&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;field-elements-encoding&quot;&gt;Field elements encoding:&lt;&#x2F;h4&gt;
&lt;p&gt;To encode points involved in the operation one has to encode elements of the base field and the extension field.&lt;&#x2F;p&gt;
&lt;p&gt;Base field element (Fp) is encoded as &lt;code&gt;64&lt;&#x2F;code&gt; bytes by performing BigEndian encoding of the corresponding (unsigned) integer (top &lt;code&gt;16&lt;&#x2F;code&gt; bytes are always zeroes). &lt;code&gt;64&lt;&#x2F;code&gt; bytes are chosen to have &lt;code&gt;32&lt;&#x2F;code&gt; byte aligned ABI (representable as e.g. &lt;code&gt;bytes32[2]&lt;&#x2F;code&gt; or &lt;code&gt;uint256[2]&lt;&#x2F;code&gt;). Corresponding integer &lt;strong&gt;must&lt;&#x2F;strong&gt; be less than field modulus.&lt;&#x2F;p&gt;
&lt;p&gt;For elements of the quadratic extension field (Fp2) encoding is byte concatenation of individual encoding of the coefficients totaling in &lt;code&gt;128&lt;&#x2F;code&gt; bytes for a total encoding. For an Fp2 element in a form &lt;code&gt;el = c0 + c1 * v&lt;&#x2F;code&gt; where &lt;code&gt;v&lt;&#x2F;code&gt; is formal quadratic non-residue and &lt;code&gt;c0&lt;&#x2F;code&gt; and &lt;code&gt;c1&lt;&#x2F;code&gt; are Fp elements the corresponding byte encoding will be &lt;code&gt;encode(c0) || encode(c1)&lt;&#x2F;code&gt; where &lt;code&gt;||&lt;&#x2F;code&gt; means byte concatenation (or one can use &lt;code&gt;bytes32[4]&lt;&#x2F;code&gt; or &lt;code&gt;uint256[4]&lt;&#x2F;code&gt; in terms of Solidity types).&lt;&#x2F;p&gt;
&lt;p&gt;If encodings do not follow this spec anywhere during parsing in the precompile the precompile &lt;em&gt;must&lt;&#x2F;em&gt; return an error.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;encoding-of-points-in-g1-g2&quot;&gt;Encoding of points in G1&#x2F;G2:&lt;&#x2F;h4&gt;
&lt;p&gt;Points in either G1 (in base field) or in G2 (in extension field) are encoded as byte concatenation of encodings of the &lt;code&gt;x&lt;&#x2F;code&gt; and &lt;code&gt;y&lt;&#x2F;code&gt; affine coordinates. Total encoding length for G1 point is thus &lt;code&gt;128&lt;&#x2F;code&gt; bytes and for G2 point is &lt;code&gt;256&lt;&#x2F;code&gt; bytes.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;point-of-infinity-encoding&quot;&gt;Point of infinity encoding:&lt;&#x2F;h4&gt;
&lt;p&gt;Also referred as &quot;zero point&quot;. For BLS12 curves point with coordinates &lt;code&gt;(0, 0)&lt;&#x2F;code&gt; (formal zeroes in Fp or Fp2) is &lt;em&gt;not&lt;&#x2F;em&gt; on the curve, so encoding of such point &lt;code&gt;(0, 0)&lt;&#x2F;code&gt; is used as a convention to encode point of infinity.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;encoding-of-scalars-for-multiplication-operation&quot;&gt;Encoding of scalars for multiplication operation:&lt;&#x2F;h4&gt;
&lt;p&gt;Scalar for multiplication operation is encoded as &lt;code&gt;32&lt;&#x2F;code&gt; bytes by performing BigEndian encoding of the corresponding (unsigned) integer. Corresponding integer is &lt;strong&gt;not&lt;&#x2F;strong&gt; required to be less than or equal than main subgroup size.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;abi-for-operations&quot;&gt;ABI for operations&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;abi-for-g1-addition&quot;&gt;ABI for G1 addition&lt;&#x2F;h4&gt;
&lt;p&gt;G1 addition call expects &lt;code&gt;256&lt;&#x2F;code&gt; bytes as an input that is interpreted as byte concatenation of two G1 points (&lt;code&gt;128&lt;&#x2F;code&gt; bytes each). Output is an encoding of addition operation result - single G1 point (&lt;code&gt;128&lt;&#x2F;code&gt; bytes).&lt;&#x2F;p&gt;
&lt;p&gt;Error cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Either of points being not on the curve must result in error&lt;&#x2F;li&gt;
&lt;li&gt;Field elements encoding rules apply (obviously)&lt;&#x2F;li&gt;
&lt;li&gt;Input has invalid length&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;abi-for-g1-multiplication&quot;&gt;ABI for G1 multiplication&lt;&#x2F;h4&gt;
&lt;p&gt;G1 multiplication call expects &lt;code&gt;160&lt;&#x2F;code&gt; bytes as an input that is interpreted as byte concatenation of encoding of G1 point (&lt;code&gt;128&lt;&#x2F;code&gt; bytes) and encoding of a scalar value (&lt;code&gt;32&lt;&#x2F;code&gt; bytes). Output is an encoding of multiplication operation result - single G1 point (&lt;code&gt;128&lt;&#x2F;code&gt; bytes).&lt;&#x2F;p&gt;
&lt;p&gt;Error cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Point being not on the curve must result in error&lt;&#x2F;li&gt;
&lt;li&gt;Field elements encoding rules apply (obviously)&lt;&#x2F;li&gt;
&lt;li&gt;Input has invalid length&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;abi-for-g1-multiexponentiation&quot;&gt;ABI for G1 multiexponentiation&lt;&#x2F;h4&gt;
&lt;p&gt;G1 multiexponentiation call expects &lt;code&gt;160*k&lt;&#x2F;code&gt; bytes as an input that is interpreted as byte concatenation of &lt;code&gt;k&lt;&#x2F;code&gt; slices each of them being a byte concatenation of encoding of G1 point (&lt;code&gt;128&lt;&#x2F;code&gt; bytes) and encoding of a scalar value (&lt;code&gt;32&lt;&#x2F;code&gt; bytes). Output is an encoding of multiexponentiation operation result - single G1 point (&lt;code&gt;128&lt;&#x2F;code&gt; bytes).&lt;&#x2F;p&gt;
&lt;p&gt;Error cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Any of G1 points being not on the curve must result in error&lt;&#x2F;li&gt;
&lt;li&gt;Field elements encoding rules apply (obviously)&lt;&#x2F;li&gt;
&lt;li&gt;Input has invalid length&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;abi-for-g2-addition&quot;&gt;ABI for G2 addition&lt;&#x2F;h4&gt;
&lt;p&gt;G2 addition call expects &lt;code&gt;512&lt;&#x2F;code&gt; bytes as an input that is interpreted as byte concatenation of two G2 points (&lt;code&gt;256&lt;&#x2F;code&gt; bytes each). Output is an encoding of addition operation result - single G2 point (&lt;code&gt;256&lt;&#x2F;code&gt; bytes).&lt;&#x2F;p&gt;
&lt;p&gt;Error cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Either of points being not on the curve must result in error&lt;&#x2F;li&gt;
&lt;li&gt;Field elements encoding rules apply (obviously)&lt;&#x2F;li&gt;
&lt;li&gt;Input has invalid length&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;abi-for-g2-multiplication&quot;&gt;ABI for G2 multiplication&lt;&#x2F;h4&gt;
&lt;p&gt;G2 multiplication call expects &lt;code&gt;288&lt;&#x2F;code&gt; bytes as an input that is interpreted as byte concatenation of encoding of G2 point (&lt;code&gt;256&lt;&#x2F;code&gt; bytes) and encoding of a scalar value (&lt;code&gt;32&lt;&#x2F;code&gt; bytes). Output is an encoding of multiplication operation result - single G2 point (&lt;code&gt;256&lt;&#x2F;code&gt; bytes).&lt;&#x2F;p&gt;
&lt;p&gt;Error cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Point being not on the curve must result in error&lt;&#x2F;li&gt;
&lt;li&gt;Field elements encoding rules apply (obviously)&lt;&#x2F;li&gt;
&lt;li&gt;Input has invalid length&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;abi-for-g2-multiexponentiation&quot;&gt;ABI for G2 multiexponentiation&lt;&#x2F;h4&gt;
&lt;p&gt;G2 multiexponentiation call expects &lt;code&gt;288*k&lt;&#x2F;code&gt; bytes as an input that is interpreted as byte concatenation of &lt;code&gt;k&lt;&#x2F;code&gt; slices each of them being a byte concatenation of encoding of G2 point (&lt;code&gt;256&lt;&#x2F;code&gt; bytes) and encoding of a scalar value (&lt;code&gt;32&lt;&#x2F;code&gt; bytes). Output is an encoding of multiexponentiation operation result - single G2 point (&lt;code&gt;256&lt;&#x2F;code&gt; bytes).&lt;&#x2F;p&gt;
&lt;p&gt;Error cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Any of G2 points being not on the curve must result in error&lt;&#x2F;li&gt;
&lt;li&gt;Field elements encoding rules apply (obviously)&lt;&#x2F;li&gt;
&lt;li&gt;Input has invalid length&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;abi-for-pairing&quot;&gt;ABI for pairing&lt;&#x2F;h4&gt;
&lt;p&gt;Pairing call expects &lt;code&gt;384*k&lt;&#x2F;code&gt; bytes as an inputs that is interpreted as byte concatenation of &lt;code&gt;k&lt;&#x2F;code&gt; slices. Each slice has the following structure:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;128&lt;&#x2F;code&gt; bytes of G1 point encoding&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;256&lt;&#x2F;code&gt; bytes of G2 point encoding&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Output is a &lt;code&gt;32&lt;&#x2F;code&gt; bytes where first &lt;code&gt;31&lt;&#x2F;code&gt; bytes are equal to &lt;code&gt;0x00&lt;&#x2F;code&gt; and the last byte is &lt;code&gt;0x01&lt;&#x2F;code&gt; if pairing result is equal to multiplicative identity in a pairing target field and &lt;code&gt;0x00&lt;&#x2F;code&gt; otherwise.&lt;&#x2F;p&gt;
&lt;p&gt;Error cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Invalid encoding of any boolean variable must result in error&lt;&#x2F;li&gt;
&lt;li&gt;Any of G1 or G2 points being not on the curve must result in error&lt;&#x2F;li&gt;
&lt;li&gt;Any of G1 or G2 points are not in the correct subgroup&lt;&#x2F;li&gt;
&lt;li&gt;Field elements encoding rules apply (obviously)&lt;&#x2F;li&gt;
&lt;li&gt;Input has invalid length&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;abi-for-mapping-fp-element-to-g1-point&quot;&gt;ABI for mapping Fp element to G1 point&lt;&#x2F;h4&gt;
&lt;p&gt;Field-to-curve call expects &lt;code&gt;64&lt;&#x2F;code&gt; bytes as input that is interpreted as an element of the base field. Output of this call is &lt;code&gt;128&lt;&#x2F;code&gt; bytes and is G1 point following respective encoding rules.&lt;&#x2F;p&gt;
&lt;p&gt;Error cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Input has invalid length&lt;&#x2F;li&gt;
&lt;li&gt;Input is not a valid field element&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;abi-for-mapping-fp2-element-to-g2-point&quot;&gt;ABI for mapping Fp2 element to G2 point&lt;&#x2F;h4&gt;
&lt;p&gt;Field-to-curve call expects &lt;code&gt;128&lt;&#x2F;code&gt; bytes as input that is interpreted as an element of the quadratic extension field. Output of this call is &lt;code&gt;256&lt;&#x2F;code&gt; bytes and is G2 point following respective encoding rules.&lt;&#x2F;p&gt;
&lt;p&gt;Error cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Input has invalid length&lt;&#x2F;li&gt;
&lt;li&gt;Input is not a valid field element&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;prevention-of-ddos-on-error-handling&quot;&gt;Prevention of DDoS on error handling&lt;&#x2F;h3&gt;
&lt;p&gt;This precompile performs extensive computations and in case of any errors during execution it MUST consume all gas from the gas schedule for the corresponding operation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-schedule&quot;&gt;Gas schedule&lt;&#x2F;h3&gt;
&lt;p&gt;Assuming a constant &lt;code&gt;30 MGas&#x2F;second&lt;&#x2F;code&gt; following prices are suggested.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;g1-addition&quot;&gt;G1 addition&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;600&lt;&#x2F;code&gt; gas&lt;&#x2F;p&gt;
&lt;h4 id=&quot;g1-multiplication&quot;&gt;G1 multiplication&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;12000&lt;&#x2F;code&gt; gas&lt;&#x2F;p&gt;
&lt;h4 id=&quot;g2-addition&quot;&gt;G2 addition&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;4500&lt;&#x2F;code&gt; gas&lt;&#x2F;p&gt;
&lt;h4 id=&quot;g2-multiplication&quot;&gt;G2 multiplication&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;55000&lt;&#x2F;code&gt; gas&lt;&#x2F;p&gt;
&lt;h4 id=&quot;g1-g2-multiexponentiation&quot;&gt;G1&#x2F;G2 Multiexponentiation&lt;&#x2F;h4&gt;
&lt;p&gt;Multiexponentiations are expected to be performed by the Peppinger algorithm (we can also say that it &lt;strong&gt;must&lt;&#x2F;strong&gt; be performed by Peppinger algorithm to have a speedup that results in a discount over naive implementation by multiplying each pair separately and adding the results). For this case there was a table prepared for discount in case of &lt;code&gt;k &amp;lt;= 128&lt;&#x2F;code&gt; points in the multiexponentiation with a discount cap &lt;code&gt;max_discount&lt;&#x2F;code&gt; for &lt;code&gt;k &amp;gt; 128&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;To avoid non-integer arithmetic call cost is calculated as &lt;code&gt;k * multiplication_cost * discount &#x2F; multiplier&lt;&#x2F;code&gt; where &lt;code&gt;multiplier = 1000&lt;&#x2F;code&gt;, &lt;code&gt;k&lt;&#x2F;code&gt; is a number of (scalar, point) pairs for the call, &lt;code&gt;multiplication_cost&lt;&#x2F;code&gt; is a corresponding single multiplication call cost for G1&#x2F;G2.&lt;&#x2F;p&gt;
&lt;p&gt;Discounts table as a vector of pairs &lt;code&gt;[k, discount]&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[[1, 1200], [2, 888], [3, 764], [4, 641], [5, 594], [6, 547], [7, 500], [8, 453], [9, 438], [10, 423], [11, 408], [12, 394], [13, 379], [14, 364], [15, 349], [16, 334], [17, 330], [18, 326], [19, 322], [20, 318], [21, 314], [22, 310], [23, 306], [24, 302], [25, 298], [26, 294], [27, 289], [28, 285], [29, 281], [30, 277], [31, 273], [32, 269], [33, 268], [34, 266], [35, 265], [36, 263], [37, 262], [38, 260], [39, 259], [40, 257], [41, 256], [42, 254], [43, 253], [44, 251], [45, 250], [46, 248], [47, 247], [48, 245], [49, 244], [50, 242], [51, 241], [52, 239], [53, 238], [54, 236], [55, 235], [56, 233], [57, 232], [58, 231], [59, 229], [60, 228], [61, 226], [62, 225], [63, 223], [64, 222], [65, 221], [66, 220], [67, 219], [68, 219], [69, 218], [70, 217], [71, 216], [72, 216], [73, 215], [74, 214], [75, 213], [76, 213], [77, 212], [78, 211], [79, 211], [80, 210], [81, 209], [82, 208], [83, 208], [84, 207], [85, 206], [86, 205], [87, 205], [88, 204], [89, 203], [90, 202], [91, 202], [92, 201], [93, 200], [94, 199], [95, 199], [96, 198], [97, 197], [98, 196], [99, 196], [100, 195], [101, 194], [102, 193], [103, 193], [104, 192], [105, 191], [106, 191], [107, 190], [108, 189], [109, 188], [110, 188], [111, 187], [112, 186], [113, 185], [114, 185], [115, 184], [116, 183], [117, 182], [118, 182], [119, 181], [120, 180], [121, 179], [122, 179], [123, 178], [124, 177], [125, 176], [126, 176], [127, 175], [128, 174]]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;max_discount = 174&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;pairing-operation&quot;&gt;Pairing operation&lt;&#x2F;h4&gt;
&lt;p&gt;Cost of the pairing operation is &lt;code&gt;55000*k + 65000&lt;&#x2F;code&gt; where &lt;code&gt;k&lt;&#x2F;code&gt; is a number of pairs.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;fp-to-g1-mapping-operation&quot;&gt;Fp-to-G1 mapping operation&lt;&#x2F;h4&gt;
&lt;p&gt;Fp -&amp;gt; G1 mapping is &lt;code&gt;5500&lt;&#x2F;code&gt; gas.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;fp2-to-g2-mapping-operation&quot;&gt;Fp2-to-G2 mapping operation&lt;&#x2F;h4&gt;
&lt;p&gt;Fp2 -&amp;gt; G2 mapping is &lt;code&gt;75000&lt;&#x2F;code&gt; gas&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Motivation section covers a total motivation to have operations over BLS12-377 curve available. We also extend a rationale for move specific fine points.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;multiexponentiation-as-a-separate-call&quot;&gt;Multiexponentiation as a separate call&lt;&#x2F;h3&gt;
&lt;p&gt;Explicit separate multiexponentiation operation that allows one to save execution time (so gas) by both the algorithm used (namely Peppinger algorithm) and (usually forgotten) by the fact that &lt;code&gt;CALL&lt;&#x2F;code&gt; operation in Ethereum is expensive (at the time of writing), so one would have to pay non-negigible overhead if e.g. for multiexponentiation of &lt;code&gt;100&lt;&#x2F;code&gt; points would have to call the multipication precompile &lt;code&gt;100&lt;&#x2F;code&gt; times and addition for &lt;code&gt;99&lt;&#x2F;code&gt; times (roughly &lt;code&gt;138600&lt;&#x2F;code&gt; would be saved).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;There are no backward compatibility questions.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;important-notes&quot;&gt;Important notes&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;subgroup-checks&quot;&gt;Subgroup checks&lt;&#x2F;h4&gt;
&lt;p&gt;Subgroup check &lt;strong&gt;is mandatory&lt;&#x2F;strong&gt; during the pairing call. Implementations &lt;em&gt;should&lt;&#x2F;em&gt; use fast subgroup checks: at the time of writing multiplication gas cost is based on &lt;code&gt;double-and-add&lt;&#x2F;code&gt; multiplication method that has a clear &quot;worst case&quot; (all bits are equal to one). For pairing operation it&#x27;s expected that implementation uses faster subgroup check, e.g. by using wNAF multiplication method for elliptic curves that is ~ &lt;code&gt;40%&lt;&#x2F;code&gt; cheaper with windows size equal to 4. (Tested empirically. Savings are due to lower hamming weight of the group order and even lower hamming weight for wNAF. Concretely, subgroup check for both G1 and G2 points in a pair are around &lt;code&gt;35000&lt;&#x2F;code&gt; combined).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Due to the large test parameters space we first provide properties that various operations must satisfy. We use additive notation for point operations, capital letters (&lt;code&gt;P&lt;&#x2F;code&gt;, &lt;code&gt;Q&lt;&#x2F;code&gt;) for points, small letters (&lt;code&gt;a&lt;&#x2F;code&gt;, &lt;code&gt;b&lt;&#x2F;code&gt;) for scalars. Generator for G1 is labeled as &lt;code&gt;G&lt;&#x2F;code&gt;, generator for G2 is labeled as &lt;code&gt;H&lt;&#x2F;code&gt;, otherwise we assume random point on a curve in a correct subgroup. &lt;code&gt;0&lt;&#x2F;code&gt; means either scalar zero or point of infinity. &lt;code&gt;1&lt;&#x2F;code&gt; means either scalar one or multiplicative identity. &lt;code&gt;group_order&lt;&#x2F;code&gt; is a main subgroup order. &lt;code&gt;e(P, Q)&lt;&#x2F;code&gt; means pairing operation where &lt;code&gt;P&lt;&#x2F;code&gt; is in G1, &lt;code&gt;Q&lt;&#x2F;code&gt; is in G2.&lt;&#x2F;p&gt;
&lt;p&gt;Requeired properties for basic ops (add&#x2F;multiply):&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Commutativity: &lt;code&gt;P + Q = Q + P&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Additive negation: &lt;code&gt;P + (-P) = 0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Doubling &lt;code&gt;P + P = 2*P&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Subgroup check: &lt;code&gt;group_order * P = 0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Trivial multiplication check: &lt;code&gt;1 * P = P&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Multiplication by zero: &lt;code&gt;0 * P = 0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Multiplication by the unnormalized scalar &lt;code&gt;(scalar + group_order) * P = scalar * P&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Required properties for pairing operation:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Degeneracy &lt;code&gt;e(P, 0*Q) = e(0*P, Q) = 1&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Bilinearity &lt;code&gt;e(a*P, b*Q) = e(a*b*P, Q) = e(P, a*b*Q)&lt;&#x2F;code&gt; (internal test, not visible through ABI)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Test vector for all operations are expanded in this &lt;code&gt;csv&lt;&#x2F;code&gt; files in matter-labs&#x27; 1962 proposol.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;There is a various choice of existing implementations of the curve operations. It may require extra work to add an ABI:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Code bases with fixed parameters&lt;&#x2F;li&gt;
&lt;li&gt;Rust: matter-labs&lt;&#x2F;li&gt;
&lt;li&gt;C++: matter-labs&lt;&#x2F;li&gt;
&lt;li&gt;Original implementation linked in Zexe paper in Rust: github.com&#x2F;scipr-lab&#x2F;zexe&lt;&#x2F;li&gt;
&lt;li&gt;Standalone in Go: github.com&#x2F;kilic&#x2F;bls12-377&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Strictly following the spec will eliminate security implications or consensus implications in a contrast to the previous BN254 precompile.&lt;&#x2F;p&gt;
&lt;p&gt;Important topic is a &quot;constant time&quot; property for performed operations. We explicitly state that this precompile &lt;strong&gt;IS NOT REQUIRED&lt;&#x2F;strong&gt; to perform all the operations using constant time algorithms.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Phase out refunds</title>
        <published>2020-02-26T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>William Morriss</name><uri>https://github.com/wjmelements</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3300/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3300-phase-out-refunds/5434" />
        

        <id>https://wg-eips.ritovision.com/3300/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:3300"
            label="EIP-3300" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3300/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Phases out the &lt;code&gt;SSTORE&lt;&#x2F;code&gt; and &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; gas refunds.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP would define a block when the &lt;code&gt;SSTORE&lt;&#x2F;code&gt; and &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; refunds would begin to diminish.
The refund would step linearly downward, eroding the implicit value of such refunds at an accelerating pace.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Refunds increase block elasticity, so the block gas target can exceed the number established by miners by up to 2x.
This can cause hesitancy for miners to increase the block gas target.&lt;&#x2F;p&gt;
&lt;p&gt;Refunds, tokenized or not, are valuable to their holders, especially during congestion.
If refunds must be removed, a gradual change in their value would be less-disruptive to the gas market than sudden abolition.
Refund consumption would proceed, especially during periods of congestion, and the refunds would be cleaned up from the state.
Refund creation, driven by demand, would naturally diminish as the efficiency of the refunds fall.
As the refund value approaches the activation cost, the implicit value of the refunds will approach zero, but in periods of congestion they will be cleaned up.&lt;&#x2F;p&gt;
&lt;p&gt;This change is less work for the protocol developers than compensation and cleanup, while likely still achieving cleanup.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Parameters:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;FORK_BLOCK_NUM&lt;&#x2F;code&gt;: EIP-3300 activation block&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;REFUND_DECAY_STEP&lt;&#x2F;code&gt;: 1 gas&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;REFUND_DECAY_FREQUENCY&lt;&#x2F;code&gt;: 100 blocks&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Computed:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;REFUND_DECAY&lt;&#x2F;code&gt;: &lt;code&gt;REFUND_DECAY_STEP * ceil((block.number + 1 - FORK_BLOCK_NUM) &#x2F; REFUND_DECAY_FREQUENCY)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;On the block this EIP activates, and again every &lt;code&gt;REFUND_DECAY_FREQUENCY&lt;&#x2F;code&gt; blocks, all gas refunds, including &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; and &lt;code&gt;SSTORE&lt;&#x2F;code&gt; would diminish by &lt;code&gt;REFUND_DECAY_STEP&lt;&#x2F;code&gt;, until 0.
The current difference is called the &lt;code&gt;REFUND_DECAY&lt;&#x2F;code&gt;, which shall be subtracted from each gas refund.&lt;&#x2F;p&gt;
&lt;p&gt;For gas-cost regimes with refund removals that cancel prior refunds, the invariant that the refund counter cannot go negative will be preserved by diminishing the magnitude of those removals by &lt;code&gt;REFUND_DECAY&lt;&#x2F;code&gt;, until 0.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;eip-2929&quot;&gt;EIP-2929&lt;&#x2F;h3&gt;
&lt;p&gt;The refunds as of EIP-2929 are as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;24000 for SELFDESTRUCT&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SSTORE_RESET_GAS - SLOAD_GAS&lt;&#x2F;code&gt; (5000 - 100)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SSTORE_SET_GAS - SLOAD_GAS&lt;&#x2F;code&gt; (20000 - 100)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SSTORE_SET_GAS - SLOAD_GAS&lt;&#x2F;code&gt; (20000 - 100)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SSTORE_CLEARS_SCHEDULE&lt;&#x2F;code&gt; (15000)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Each of these refunds would be decreased by the current &lt;code&gt;REFUND_DECAY&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;There is also a case where &lt;code&gt;SSTORE_CLEARS_SCHEDULE&lt;&#x2F;code&gt; is removed from the refund counter.
That removal will also diminish by &lt;code&gt;REFUND_DECAY_STEP&lt;&#x2F;code&gt; until 0, maintaining the non-negative refund counter invariant.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Persisted refunds would become worthless before they fall below their activation cost.
Once the refunds are worthless, they can be removed by another hard fork without waiting for 0.
The rate of diminishing specified would currently require (24000-5000) * 100 = 1,900,000 blocks for &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; and (15000-5000) * 100 = 1,000,000 blocks for &lt;code&gt;SSTORE&lt;&#x2F;code&gt;.
This timeframe is currently about a year, which should be enough flexibility for the remaining refunds to be consumed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal breaks gas refunds, which contribute to block elasticity.
The effect of this will be increased gas price volatility: higher highs and lower lows.&lt;&#x2F;p&gt;
&lt;p&gt;Because the refund counter is separate from the gas counter, the block-to-block gas changes will not break &lt;code&gt;eth_estimateGas&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Diamonds, Multi-Facet Proxy</title>
        <published>2020-02-22T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Nick Mudge</name><uri>https://github.com/mudgen</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2535/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/discussion-for-eip2535-diamonds/10459/" />
        

        <id>https://wg-eips.ritovision.com/2535/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2535"
            label="ERC-2535" />
        

        
        

        
        <summary type="html">Create modular smart contract systems that can be extended after deployment.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2535/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;img align=&quot;right&quot; src=&quot;.&#x2F;assets&#x2F;diamond.svg&quot; width=&quot;230&quot; height=&quot;230&quot; alt=&quot;Diamonds contract structure&quot;&gt;
&lt;p&gt;This proposal standardizes diamonds, which are modular smart contract systems that can be upgraded&#x2F;extended after deployment, and have virtually no size limit. More technically, a &lt;strong&gt;diamond&lt;&#x2F;strong&gt; is a contract with external functions that are supplied by contracts called &lt;strong&gt;facets&lt;&#x2F;strong&gt;. Facets are separate, independent contracts that can share internal functions, libraries, and state variables.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;There are a number of different reasons to use diamonds. Here are some of them:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;A single address for unlimited contract functionality.&lt;&#x2F;strong&gt; Using a single address for contract functionality makes deployment, testing and integration with other smart contracts, software and user interfaces easier.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Your contract exceeds the 24KB maximum contract size.&lt;&#x2F;strong&gt; You may have related functionality that it makes sense to keep in a single contract, or at a single contract address. A diamond does not have a max contract size.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;A diamond provides a way to organize contract code and data.&lt;&#x2F;strong&gt; You may want to build a contract system with a lot of functionality. A diamond provides a systematic way to isolate different functionality and connect them together and share data between them as needed in a gas-efficient way.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;A diamond provides a way to upgrade functionality.&lt;&#x2F;strong&gt; Upgradeable diamonds can be upgraded to add&#x2F;replace&#x2F;remove functionality. Because diamonds have no max contract size, there is no limit to the amount of functionality that can be added to diamonds over time. Diamonds can be upgraded without having to redeploy existing functionality. Parts of a diamond can be added&#x2F;replaced&#x2F;removed while leaving other parts alone.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;A diamond can be immutable.&lt;&#x2F;strong&gt; It is possible to deploy an immutable diamond or make an upgradeable diamond immutable at a later time.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;A diamond can reuse deployed contracts.&lt;&#x2F;strong&gt; Instead of deploying contracts to a blockchain, existing already deployed, onchain contracts can be used to create diamonds. Custom diamonds can be created from existing deployed contracts. This enables the creation of on-chain smart contract platforms and libraries.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;This standard is an improvement of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1538&#x2F;&quot;&gt;EIP-1538&lt;&#x2F;a&gt;. The same motivations of that standard apply to this standard.&lt;&#x2F;p&gt;
&lt;p&gt;A deployed facet can be used by any number of diamonds.&lt;&#x2F;p&gt;
&lt;p&gt;The diagram below shows two diamonds using the same two facets.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;FacetA&lt;&#x2F;code&gt; is used by &lt;code&gt;Diamond1&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;FacetA&lt;&#x2F;code&gt; is used by &lt;code&gt;Diamond2&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;FacetB&lt;&#x2F;code&gt; is used by &lt;code&gt;Diamond1&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;FacetB&lt;&#x2F;code&gt; is used by &lt;code&gt;Diamond2&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;img src=&quot;.&#x2F;assets&#x2F;facetreuse.png&quot; alt=&quot;Facet reuse&quot;&gt;
&lt;h3 id=&quot;upgradeable-diamond-vs-centralized-private-database&quot;&gt;Upgradeable Diamond vs. Centralized Private Database&lt;&#x2F;h3&gt;
&lt;p&gt;Why have an upgradeable diamond instead of a centralized, private, mutable database?&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Decentralized Autonomous Organizations (DAOs) and other governance systems can be used to upgrade diamonds.&lt;&#x2F;li&gt;
&lt;li&gt;Wide interaction and integration with the Ethereum ecosystem.&lt;&#x2F;li&gt;
&lt;li&gt;With open storage data and verified source code it is possible to show a provable history of trustworthiness.&lt;&#x2F;li&gt;
&lt;li&gt;With openness bad behavior can be spotted and reported when it happens.&lt;&#x2F;li&gt;
&lt;li&gt;Independent security and domain experts can review the change history of contracts and vouch for their history of trustworthiness.&lt;&#x2F;li&gt;
&lt;li&gt;It is possible for an upgradeable diamond to become immutable and trustless.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;some-diamond-benefits&quot;&gt;Some Diamond Benefits&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;A stable contract address that provides needed functionality.&lt;&#x2F;li&gt;
&lt;li&gt;A single address with the functionality of multiple contracts (facets) that are independent from each other but can share internal functions, libraries and state variables.&lt;&#x2F;li&gt;
&lt;li&gt;Emitting events from a single address can simplify event handling.&lt;&#x2F;li&gt;
&lt;li&gt;A way to add, replace and remove multiple external functions atomically (in the same transaction).&lt;&#x2F;li&gt;
&lt;li&gt;Fine-grained upgrades, so you can change just the parts of a diamond that need to be changed.&lt;&#x2F;li&gt;
&lt;li&gt;Have greater control over when and what functions exist.&lt;&#x2F;li&gt;
&lt;li&gt;Decentralized Autonomous Organizations (DAOs), multisig contracts and other governance systems can be used to upgrade diamonds.&lt;&#x2F;li&gt;
&lt;li&gt;An event that shows what functions are added, replaced and removed.&lt;&#x2F;li&gt;
&lt;li&gt;The ability to show all changes made to a diamond.&lt;&#x2F;li&gt;
&lt;li&gt;Increase trust over time by showing all changes made to a diamond.&lt;&#x2F;li&gt;
&lt;li&gt;A way to look at a diamond to see its current facets and functions.&lt;&#x2F;li&gt;
&lt;li&gt;Have an immutable, trustless diamond.&lt;&#x2F;li&gt;
&lt;li&gt;Solves the 24KB maximum contract size limitation. Diamonds can be any size.&lt;&#x2F;li&gt;
&lt;li&gt;Separate functionality can be implemented in separate facets and used together in a diamond.&lt;&#x2F;li&gt;
&lt;li&gt;Diamonds can be created from already deployed, existing onchain contracts.&lt;&#x2F;li&gt;
&lt;li&gt;Larger contracts have to reduce their size by removing error messages and other things. You can keep your full functionality that you need by implementing a diamond.&lt;&#x2F;li&gt;
&lt;li&gt;Enables zero, partial or full diamond immutability as desired, and when desired.&lt;&#x2F;li&gt;
&lt;li&gt;The ability to develop and improve an application over time with an upgradeable diamond and then make it immutable and trustless if desired.&lt;&#x2F;li&gt;
&lt;li&gt;Develop incrementally and let your diamond grow with your application.&lt;&#x2F;li&gt;
&lt;li&gt;Upgrade diamonds to fix bugs, add functionality and implement new standards.&lt;&#x2F;li&gt;
&lt;li&gt;Organize your code with a diamond and facets.&lt;&#x2F;li&gt;
&lt;li&gt;Diamonds can be large (have many functions) but still be modular because they are compartmented with facets.&lt;&#x2F;li&gt;
&lt;li&gt;Contract architectures that call multiple contracts in a single transaction can save gas by condensing those contracts into a single diamond and accessing state variables directly.&lt;&#x2F;li&gt;
&lt;li&gt;Save gas by converting external functions to internal functions. This done by sharing internal functions between facets.&lt;&#x2F;li&gt;
&lt;li&gt;Save gas by creating external functions for gas-optimized specific use cases, such as bulk transfers.&lt;&#x2F;li&gt;
&lt;li&gt;Diamonds are designed for tooling and user-interface software.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;terms&quot;&gt;Terms&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;A &lt;strong&gt;diamond&lt;&#x2F;strong&gt; is a facade smart contract that &lt;code&gt;delegatecall&lt;&#x2F;code&gt;s into its facets to execute function calls. A diamond is stateful. Data is stored in the contract storage of a diamond.&lt;&#x2F;li&gt;
&lt;li&gt;A &lt;strong&gt;facet&lt;&#x2F;strong&gt; is a stateless smart contract or Solidity library with external functions. A facet is deployed and one or more of its functions are added to one or more diamonds. A facet does not store data within its own contract storage but it can define state and read and write to the storage of one or more diamonds. The term facet comes from the diamond industry. It is a side, or flat surface of a diamond.&lt;&#x2F;li&gt;
&lt;li&gt;A &lt;strong&gt;loupe facet&lt;&#x2F;strong&gt; is a facet that provides introspection functions. In the diamond industry, a loupe is a magnifying glass that is used to look at diamonds.&lt;&#x2F;li&gt;
&lt;li&gt;An &lt;strong&gt;immutable function&lt;&#x2F;strong&gt; is an external function that cannot be replaced or removed (because it is defined directly in the diamond, or because the diamond&#x27;s logic does not allow it to be modified).&lt;&#x2F;li&gt;
&lt;li&gt;A &lt;strong&gt;mapping&lt;&#x2F;strong&gt; for the purposes of this EIP is an association between two things and does not refer to a specific implementation.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The term &lt;strong&gt;contract&lt;&#x2F;strong&gt; is used loosely to mean a smart contract or deployed Solidity library.&lt;&#x2F;p&gt;
&lt;p&gt;When this EIP uses &lt;strong&gt;function&lt;&#x2F;strong&gt; without specifying internal or external, it means external function.&lt;&#x2F;p&gt;
&lt;p&gt;In this EIP the information that applies to external functions also applies to public functions.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;overview&quot;&gt;Overview&lt;&#x2F;h3&gt;
&lt;p&gt;A diamond calls functions from its facets using &lt;code&gt;delegatecall&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;In the diamond industry diamonds are created and shaped by being cut, creating facets. In this standard diamonds are cut by adding, replacing or removing functions from facets.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;a-note-on-implementing-interfaces&quot;&gt;A Note on Implementing Interfaces&lt;&#x2F;h3&gt;
&lt;p&gt;Because of the nature of diamonds, a diamond can implement an interface in one of two ways: directly (&lt;code&gt;contract Contract is Interface&lt;&#x2F;code&gt;), or by adding functions to it from one or more facets. For the purposes of this proposal, when a diamond is said to implement an interface, either method of implementation is permitted.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;fallback-function&quot;&gt;Fallback Function&lt;&#x2F;h3&gt;
&lt;p&gt;When an external function is called on a diamond its fallback function is executed. The fallback function determines which facet to call based on the first four bytes of the call data (known as the function selector) and executes that function from the facet using &lt;code&gt;delegatecall&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;A diamond&#x27;s fallback function and &lt;code&gt;delegatecall&lt;&#x2F;code&gt; enable a diamond to execute a facet&#x27;s function as if it was implemented by the diamond itself. The &lt;code&gt;msg.sender&lt;&#x2F;code&gt; and &lt;code&gt;msg.value&lt;&#x2F;code&gt; values do not change and only the diamond&#x27;s storage is read and written to.&lt;&#x2F;p&gt;
&lt;p&gt;Here is an illustrative example of how a diamond&#x27;s fallback function might be implemented:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Find facet for function that is called and execute the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; function if a facet is found and return any value.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;fallback&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; get facet from function selector&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span&gt; facet &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; selectorTofacet&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sig&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;facet &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Execute external function from facet using delegatecall and return any value.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; copy function selector and any arguments&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    calldatacopy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calldatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; execute function call using the facet&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span&gt; result &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; delegatecall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; facet&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calldatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; get any return value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    returndatacopy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returndatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; return any return value or error back to the caller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    switch result&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      case &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;revert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returndatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      default &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returndatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This diagram shows the structure of a diamond:&lt;&#x2F;p&gt;
&lt;img src=&quot;.&#x2F;assets&#x2F;DiamondDiagram.png&quot; alt=&quot;Mapping facets and storage&quot;&gt;
&lt;h3 id=&quot;storage&quot;&gt;Storage&lt;&#x2F;h3&gt;
&lt;p&gt;A state variable or storage layout organizational pattern is needed because Solidity&#x27;s builtin storage layout system doesn&#x27;t support proxy contracts or diamonds. The particular layout of storage is not defined in this EIP, but may be defined by later proposals. Examples of storage layout patterns that work with diamonds are &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2535&#x2F;.&#x2F;assets&#x2F;storage-examples&#x2F;DiamondStorage.sol&quot;&gt;Diamond Storage&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2535&#x2F;.&#x2F;assets&#x2F;storage-examples&#x2F;AppStorage.sol&quot;&gt;AppStorage&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Facets can share state variables by using the same structs at the same storage positions. Facets can share internal functions and libraries by inheriting the same contracts or using the same libraries. In these ways facets are separate, independent units but can share state and functionality.&lt;&#x2F;p&gt;
&lt;p&gt;The diagram below shows facets with their own data and data shared between them.&lt;&#x2F;p&gt;
&lt;p&gt;Notice that all data is stored in the diamond&#x27;s storage, but different facets have different access to data.&lt;&#x2F;p&gt;
&lt;p&gt;In this diagram&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Only &lt;code&gt;FacetA&lt;&#x2F;code&gt; can access &lt;code&gt;DataA&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Only &lt;code&gt;FacetB&lt;&#x2F;code&gt; can access &lt;code&gt;DataB&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Only the diamond&#x27;s own code can access &lt;code&gt;DataD&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;FacetA&lt;&#x2F;code&gt; and &lt;code&gt;FacetB&lt;&#x2F;code&gt; share access to &lt;code&gt;DataAB&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The diamond&#x27;s own code, &lt;code&gt;FacetA&lt;&#x2F;code&gt; and &lt;code&gt;FacetB&lt;&#x2F;code&gt; share access to &lt;code&gt;DataABD&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;img src=&quot;.&#x2F;assets&#x2F;diamondstorage1.png&quot; alt=&quot;Mapping code, data, and facets&quot;&gt;
&lt;h3 id=&quot;solidity-libraries-as-facets&quot;&gt;Solidity Libraries as Facets&lt;&#x2F;h3&gt;
&lt;p&gt;Smart contracts or deployed Solidity libraries can be facets of diamonds.&lt;&#x2F;p&gt;
&lt;p&gt;Only Solidity libraries that have one or more external functions can be deployed to a blockchain and be a facet.&lt;&#x2F;p&gt;
&lt;p&gt;Solidity libraries that contain internal functions only cannot be deployed and cannot be a facet. Internal functions from Solidity libraries are included in the bytecode of facets and contracts that use them. Solidity libraries with internal functions only are useful for sharing internal functions between facets.&lt;&#x2F;p&gt;
&lt;p&gt;Solidity library facets have a few properties that match their use as facets:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;They cannot be deleted.&lt;&#x2F;li&gt;
&lt;li&gt;They are stateless. They do not have contract storage.&lt;&#x2F;li&gt;
&lt;li&gt;Their syntax prevents declaring state variables outside Diamond Storage.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;adding-replacing-removing-functions&quot;&gt;Adding&#x2F;Replacing&#x2F;Removing Functions&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;idiamond-interface&quot;&gt;&lt;code&gt;IDiamond&lt;&#x2F;code&gt; Interface&lt;&#x2F;h4&gt;
&lt;p&gt;All diamonds must implement the &lt;code&gt;IDiamond&lt;&#x2F;code&gt; interface.&lt;&#x2F;p&gt;
&lt;p&gt;During the deployment of a diamond any immutable functions and any external functions added to the diamond must be emitted in the &lt;code&gt;DiamondCut&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;A &lt;code&gt;DiamondCut&lt;&#x2F;code&gt; event must be emitted any time external functions are added, replaced, or removed.&lt;&#x2F;strong&gt; This applies to all upgrades, all functions changes, at any time, whether through &lt;code&gt;diamondCut&lt;&#x2F;code&gt; or not.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IDiamond&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FacetCutAction&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;Add&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt; Replace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt; Remove&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Add=0, Replace=1, Remove=2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FacetCut&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; facetAddress&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        FacetCutAction action&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes4&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; functionSelectors&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DiamondCut&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;FacetCut&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _diamondCut&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _init&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _calldata&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;DiamondCut&lt;&#x2F;code&gt; event records all function changes to a diamond.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;idiamondcut-interface&quot;&gt;&lt;code&gt;IDiamondCut&lt;&#x2F;code&gt; Interface&lt;&#x2F;h4&gt;
&lt;p&gt;A diamond contains within it a mapping of function selectors to facet addresses. Functions are added&#x2F;replaced&#x2F;removed by modifying this mapping.&lt;&#x2F;p&gt;
&lt;p&gt;Diamonds should implement the &lt;code&gt;IDiamondCut&lt;&#x2F;code&gt; interface if after their deployment they allow modifications to their function selector mapping.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;diamondCut&lt;&#x2F;code&gt; function updates any number of functions from any number of facets in a single transaction. Executing all changes within a single transaction prevents data corruption which could occur in upgrades done over multiple transactions.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;diamondCut&lt;&#x2F;code&gt; is specified for the purpose of interoperability. Diamond tools, software and user-interfaces should expect and use the standard &lt;code&gt;diamondCut&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IDiamondCut&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IDiamond&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Add&#x2F;replace&#x2F;remove any number of functions and optionally execute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         a function with delegatecall&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _diamondCut&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Contains the facet addresses and function selectors&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _init&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the contract or facet to execute _calldata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A function call, including function selector and arguments&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                  _calldata is executed with delegatecall on _init&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; diamondCut&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        FacetCut&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _diamondCut&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _init&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _calldata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;_diamondCut&lt;&#x2F;code&gt; argument is an array of &lt;code&gt;FacetCut&lt;&#x2F;code&gt; structs.&lt;&#x2F;p&gt;
&lt;p&gt;Each &lt;code&gt;FacetCut&lt;&#x2F;code&gt; struct contains a facet address and array of function selectors that are updated in a diamond.&lt;&#x2F;p&gt;
&lt;p&gt;For each &lt;code&gt;FacetCut&lt;&#x2F;code&gt; struct:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If the &lt;code&gt;action&lt;&#x2F;code&gt; is &lt;code&gt;Add&lt;&#x2F;code&gt;, update the function selector mapping for each &lt;code&gt;functionSelectors&lt;&#x2F;code&gt; item to the &lt;code&gt;facetAddress&lt;&#x2F;code&gt;. If any of the &lt;code&gt;functionSelectors&lt;&#x2F;code&gt; had a mapped facet, revert instead.&lt;&#x2F;li&gt;
&lt;li&gt;If the &lt;code&gt;action&lt;&#x2F;code&gt; is &lt;code&gt;Replace&lt;&#x2F;code&gt;, update the function selector mapping for each &lt;code&gt;functionSelectors&lt;&#x2F;code&gt; item to the &lt;code&gt;facetAddress&lt;&#x2F;code&gt;. If any of the &lt;code&gt;functionSelectors&lt;&#x2F;code&gt; had a value equal to &lt;code&gt;facetAddress&lt;&#x2F;code&gt; or the selector was unset, revert instead.&lt;&#x2F;li&gt;
&lt;li&gt;If the &lt;code&gt;action&lt;&#x2F;code&gt; is &lt;code&gt;Remove&lt;&#x2F;code&gt;, remove the function selector mapping for each &lt;code&gt;functionSelectors&lt;&#x2F;code&gt; item. If any of the &lt;code&gt;functionSelectors&lt;&#x2F;code&gt; were previously unset, revert instead.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Any attempt to replace or remove an immutable function must revert.&lt;&#x2F;p&gt;
&lt;p&gt;Being intentional and explicit about adding&#x2F;replacing&#x2F;removing functions helps catch and prevent upgrade mistakes.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;executing-calldata&quot;&gt;Executing &lt;code&gt;_calldata&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;p&gt;After adding&#x2F;replacing&#x2F;removing functions the &lt;code&gt;_calldata&lt;&#x2F;code&gt; argument is executed with &lt;code&gt;delegatecall&lt;&#x2F;code&gt; on &lt;code&gt;_init&lt;&#x2F;code&gt;. This execution is done to initialize data or setup or remove anything needed or no longer needed after adding, replacing and&#x2F;or removing functions.&lt;&#x2F;p&gt;
&lt;p&gt;If the &lt;code&gt;_init&lt;&#x2F;code&gt; value is &lt;code&gt;address(0)&lt;&#x2F;code&gt; then &lt;code&gt;_calldata&lt;&#x2F;code&gt; execution is skipped. In this case &lt;code&gt;_calldata&lt;&#x2F;code&gt; can contain 0 bytes or custom information.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;inspecting-facets-functions&quot;&gt;Inspecting Facets &amp;amp; Functions&lt;&#x2F;h3&gt;
&lt;blockquote&gt;
&lt;p&gt;A loupe is a small magnifying glass used to look at diamonds.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;Diamonds must support inspecting facets and functions by implementing the &lt;code&gt;IDiamondLoupe&lt;&#x2F;code&gt; interface.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;idiamondloupe-interface&quot;&gt;&lt;code&gt;IDiamondLoupe&lt;&#x2F;code&gt; Interface&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A loupe is a small magnifying glass used to look at diamonds.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; These functions look at diamonds&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IDiamondLoupe&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Facet&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; facetAddress&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes4&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; functionSelectors&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Gets all facet addresses and their four byte function selectors.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; facets_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Facet&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; facets&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Facet&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; facets_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Gets all the function selectors supported by a specific facet.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _facet&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The facet address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; facetFunctionSelectors_&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; facetFunctionSelectors&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _facet&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; facetFunctionSelectors_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get all the facet addresses used by a diamond.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; facetAddresses_&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; facetAddresses&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; facetAddresses_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Gets the facet that supports the given selector.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If facet is not found return address(0).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _functionSelector&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The function selector.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; facetAddress_&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The facet address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; facetAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _functionSelector&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; facetAddress_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;See a &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2535&#x2F;#reference-implementation&quot;&gt;reference implementation&lt;&#x2F;a&gt; to see how this can be implemented.&lt;&#x2F;p&gt;
&lt;p&gt;The loupe functions can be used in user-interface software. A user interface calls these functions to provide information about and visualize diamonds.&lt;&#x2F;p&gt;
&lt;p&gt;The loupe functions can be used in deployment functionality, upgrade functionality, testing and other software.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;implementation-points&quot;&gt;Implementation Points&lt;&#x2F;h3&gt;
&lt;p&gt;A diamond must implement the following:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;A diamond contains a fallback function and zero or more immutable functions that are defined within it.&lt;&#x2F;li&gt;
&lt;li&gt;A diamond associates function selectors with facets.&lt;&#x2F;li&gt;
&lt;li&gt;When a function is called on a diamond it executes immediately if it is an &quot;immutable function&quot; defined directly in the diamond. Otherwise the diamond&#x27;s fallback function is executed. The fallback function finds the facet associated with the function and executes the function using &lt;code&gt;delegatecall&lt;&#x2F;code&gt;. If there is no facet for the function then optionally a default function may be executed. If there is no facet for the function and no default function and no other mechanism to handle it then execution reverts.&lt;&#x2F;li&gt;
&lt;li&gt;Each time functions are added, replaced or removed a &lt;code&gt;DiamondCut&lt;&#x2F;code&gt; event is emitted to record it.&lt;&#x2F;li&gt;
&lt;li&gt;A diamond implements the DiamondLoupe interface.&lt;&#x2F;li&gt;
&lt;li&gt;All immutable functions must be emitted in the &lt;code&gt;DiamondCut&lt;&#x2F;code&gt; event as new functions added. And the loupe functions must return information about immutable functions if they exist. The facet address for an immutable function is the diamond&#x27;s address. Any attempt to delete or replace an immutable function must revert.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;A diamond may implement the following:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;EIP-165&lt;&#x2F;a&gt;&#x27;s &lt;code&gt;supportsInterface&lt;&#x2F;code&gt;. If a diamond has the &lt;code&gt;diamondCut&lt;&#x2F;code&gt; function then the interface ID used for it is &lt;code&gt;IDiamondCut.diamondCut.selector&lt;&#x2F;code&gt;. The interface ID used for the diamond loupe interface is &lt;code&gt;IDiamondLoupe.facets.selector ^ IDiamondLoupe.facetFunctionSelectors.selector ^ IDiamondLoupe.facetAddresses.selector ^ IDiamondLoupe.facetAddress.selector&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The diamond address is the address that users interact with. The diamond address does not change. Only facet addresses can change by using the &lt;code&gt;diamondCut&lt;&#x2F;code&gt; function, or other function.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;using-function-selectors&quot;&gt;Using Function Selectors&lt;&#x2F;h3&gt;
&lt;p&gt;User interface software can be used to retrieve function selectors and facet addresses from a diamond in order show what functions a diamond has.&lt;&#x2F;p&gt;
&lt;p&gt;This standard is designed to make diamonds work well with user-interface software. Function selectors with the ABI of a contract provide enough information about functions to be useful for user-interface software.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-considerations&quot;&gt;Gas Considerations&lt;&#x2F;h3&gt;
&lt;p&gt;Delegating function calls does have some gas overhead. This is mitigated in several ways:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Because diamonds do not have a max size limitation it is possible to add gas optimizing functions for use cases. For example someone could use a diamond to implement the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; standard and implement batch transfer functions to reduce gas (and make batch transfers more convenient).&lt;&#x2F;li&gt;
&lt;li&gt;Some contract architectures require calling multiple contracts in one transaction. Gas savings can be realized by condensing those contracts into a single diamond and accessing contract storage directly.&lt;&#x2F;li&gt;
&lt;li&gt;Facets can contain few external functions, reducing gas costs. Because it costs more gas to call a function in a contract with many functions than a contract with few functions.&lt;&#x2F;li&gt;
&lt;li&gt;The Solidity optimizer can be set to a high setting causing more bytecode to be generated but the facets will use less gas when executed.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;versions-of-functions&quot;&gt;Versions of Functions&lt;&#x2F;h3&gt;
&lt;p&gt;Software or a user can verify what version of a function is called by getting the facet address of the function. This can be done by calling the &lt;code&gt;facetAddress&lt;&#x2F;code&gt; function from the &lt;code&gt;IDiamondLoupe&lt;&#x2F;code&gt; interface. This function takes a function selector as an argument and returns the facet address where it is implemented.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;default-function&quot;&gt;Default Function&lt;&#x2F;h3&gt;
&lt;p&gt;Solidity provides the &lt;code&gt;fallback&lt;&#x2F;code&gt; function so that specific functionality can be executed when a function is called on a contract that does not exist in the contract. This same behavior can optionally be implemented in a diamond by implementing and using a default function, which is a function that is executed when a function is called on a diamond that does not exist in the diamond.&lt;&#x2F;p&gt;
&lt;p&gt;A default function can be implemented a number of ways and this standard does not specify how it must be implemented.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;loupe-functions-diamondcut-event&quot;&gt;Loupe Functions &amp;amp; &lt;code&gt;DiamondCut&lt;&#x2F;code&gt; Event&lt;&#x2F;h3&gt;
&lt;p&gt;To find out what functions a regular contract has it is only necessary to look at its verified source code.&lt;&#x2F;p&gt;
&lt;p&gt;The verified source code of a diamond does not include what functions it has so a different mechanism is needed.&lt;&#x2F;p&gt;
&lt;p&gt;A diamond has four standard functions called the loupe functions that are used to show what functions a diamond has.&lt;&#x2F;p&gt;
&lt;p&gt;The loupe functions can be used for many things including:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;To show all functions used by a diamond.&lt;&#x2F;li&gt;
&lt;li&gt;To query services like Etherscan or files to retrieve and show all source code used by a diamond.&lt;&#x2F;li&gt;
&lt;li&gt;To query services like Etherscan or files to retrieve ABI information for a diamond.&lt;&#x2F;li&gt;
&lt;li&gt;To test or verify that a transaction that adds&#x2F;replaces&#x2F;removes functions on a diamond succeeded.&lt;&#x2F;li&gt;
&lt;li&gt;To find out what functions a diamond has before calling functions on it.&lt;&#x2F;li&gt;
&lt;li&gt;To be used by tools and programming libraries to deploy and upgrade diamonds.&lt;&#x2F;li&gt;
&lt;li&gt;To be used by user interfaces to show information about diamonds.&lt;&#x2F;li&gt;
&lt;li&gt;To be used by user interfaces to enable users to call functions on diamonds.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Diamonds support another form of transparency which is a historical record of all upgrades on a diamond. This is done with the &lt;code&gt;DiamondCut&lt;&#x2F;code&gt; event which is used to record all functions that are added, replaced or removed on a diamond.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;sharing-functions-between-facets&quot;&gt;Sharing Functions Between Facets&lt;&#x2F;h3&gt;
&lt;p&gt;In some cases it might be necessary to call a function defined in a different facet. Here are ways to do this:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Copy internal function code in one facet to the other facet.&lt;&#x2F;li&gt;
&lt;li&gt;Put common internal functions in a contract that is inherited by multiple facets.&lt;&#x2F;li&gt;
&lt;li&gt;Put common internal functions in a Solidity library and use the library in facets.&lt;&#x2F;li&gt;
&lt;li&gt;A type safe way to call an external function defined in another facet is to do this: &lt;code&gt;MyOtherFacet(address(this)).myFunction(arg1, arg2)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;A more gas-efficient way to call an external function defined in another facet is to use delegatecall. Here is an example of doing that:&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;DiamondStorage &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;storage&lt;&#x2F;span&gt;&lt;span&gt; ds &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; diamondStorage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span&gt; functionSelector &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes4&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;myFunction(uint256)&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; get facet address of function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; facet &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; ds&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selectorToFacet&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;functionSelector&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; myFunctionCall &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodeWithSelector&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;functionSelector&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt; success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;facet&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;delegatecall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;myFunctionCall&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ol start=&quot;6&quot;&gt;
&lt;li&gt;Instead of calling an external function defined in another facet you can instead create an internal function version of the external function. Add the internal version of the function to the facet that needs to use it.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;facets-can-be-reusable-and-composable&quot;&gt;Facets can be Reusable and Composable&lt;&#x2F;h3&gt;
&lt;p&gt;A deployed facet can be used by any number of diamonds.&lt;&#x2F;p&gt;
&lt;p&gt;Different combinations of facets can be used with different diamonds.&lt;&#x2F;p&gt;
&lt;p&gt;It is possible to create and deploy a set of facets that are reused by different diamonds over time.&lt;&#x2F;p&gt;
&lt;p&gt;The ability to use the same deployed facets for many diamonds reduces deployment costs.&lt;&#x2F;p&gt;
&lt;p&gt;It is possible to implement facets in a way that makes them usable&#x2F;composable&#x2F;compatible with other facets. It is also possible to implement facets in a way that makes them not usable&#x2F;composable&#x2F;compatible with other facets.&lt;&#x2F;p&gt;
&lt;p&gt;A function signature is the name of a function and its parameter types. Example function signature: &lt;code&gt;myfunction(uint256)&lt;&#x2F;code&gt;. A limitation is that two external functions with the same function signature can’t be added to the same diamond at the same time because a diamond, or any contract, cannot have two external functions with the same function signature.&lt;&#x2F;p&gt;
&lt;p&gt;All the functions of a facet do not have to be added to a diamond. Some functions in a facet can be added to a diamond while other functions in the facet are not added to the diamond.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This standard makes upgradeable diamonds compatible with future standards and functionality because new functions can be added and existing functions can be replaced or removed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;All the Solidity code for a complete reference implementation has been put in a single file here: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2535&#x2F;.&#x2F;assets&#x2F;reference&#x2F;Diamond.sol&quot;&gt;Diamond.sol&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The same reference implementation has been organized into multiple files and directories and also includes a deployment script and tests. Download it as a zip file: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2535&#x2F;.&#x2F;assets&#x2F;reference&#x2F;EIP2535-Diamonds-Reference-Implementation.zip&quot;&gt;&lt;code&gt;EIP2535-Diamonds-Reference-Implementation.zip&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;ownership-and-authentication&quot;&gt;Ownership and Authentication&lt;&#x2F;h3&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;&#x2F;strong&gt; The design and implementation of diamond ownership&#x2F;authentication is &lt;strong&gt;not&lt;&#x2F;strong&gt; part of this standard. The examples given in this standard and in the reference implementation are just &lt;strong&gt;examples&lt;&#x2F;strong&gt; of how it could be done.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;It is possible to create many different authentication or ownership schemes with this proposal. Authentication schemes can be very simple or complex, fine grained or coarse. This proposal does not limit it in any way. For example ownership&#x2F;authentication could be as simple as a single account address having the authority to add&#x2F;replace&#x2F;remove functions. Or a decentralized autonomous organization could have the authority to only add&#x2F;replace&#x2F;remove certain functions.&lt;&#x2F;p&gt;
&lt;p&gt;Consensus functionality could be implemented such as an approval function that multiple different people call to approve changes before they are executed with the &lt;code&gt;diamondCut&lt;&#x2F;code&gt; function. These are just examples.&lt;&#x2F;p&gt;
&lt;p&gt;The development of standards and implementations of ownership, control and authentication of diamonds is encouraged.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;arbitrary-execution-with-diamondcut&quot;&gt;Arbitrary Execution with &lt;code&gt;diamondCut&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;diamondCut&lt;&#x2F;code&gt; function allows arbitrary execution with access to the diamond&#x27;s storage (through &lt;code&gt;delegatecall&lt;&#x2F;code&gt;). Access to this function must be restricted carefully.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;do-not-self-destruct&quot;&gt;Do Not Self Destruct&lt;&#x2F;h3&gt;
&lt;p&gt;Use of &lt;code&gt;selfdestruct&lt;&#x2F;code&gt; in a facet is heavily discouraged. Misuse of it can delete a diamond or a facet.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;function-selector-clash&quot;&gt;Function Selector Clash&lt;&#x2F;h3&gt;
&lt;p&gt;A function selector clash occurs when two different function signatures hash to the same four-byte hash. This has the unintended consequence of replacing an existing function in a diamond when the intention was to add a new function. This scenario is not possible with a properly implemented &lt;code&gt;diamondCut&lt;&#x2F;code&gt; function because it prevents adding function selectors that already exist.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;transparency&quot;&gt;Transparency&lt;&#x2F;h3&gt;
&lt;p&gt;Diamonds emit an event every time one or more functions are added, replaced or removed. All source code can be verified. This enables people and software to monitor changes to a contract. If any bad acting function is added to a diamond then it can be seen.&lt;&#x2F;p&gt;
&lt;p&gt;Security and domain experts can review the history of change of a diamond to detect any history of foul play.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Precompile for BLS12-381 curve operations</title>
        <published>2020-02-21T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Vlasov</name><uri>https://github.com/shamatar</uri>
	</author>
	
	<author>
		<name>Kelly Olson</name><uri>https://github.com/ineffectualproperty</uri>
	</author>
	
	<author>
		<name>Alex Stokes</name><uri>https://github.com/ralexstokes</uri>
	</author>
	
	<author>
		<name>Antonio Sanso</name><uri>https://github.com/asanso</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2537/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip2537-bls12-precompile-discussion-thread/4187" />
        

        <id>https://wg-eips.ritovision.com/2537/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2537"
            label="EIP-2537" />
        

        
        

        
        <summary type="html">Adds operation on BLS12-381 curve as a precompile in a set necessary to efficiently perform operations such as BLS signature verification.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2537/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Add functionality to efficiently perform operations over the BLS12-381 curve, including those for BLS signature verification.&lt;&#x2F;p&gt;
&lt;p&gt;Along with the curve arithmetic, multi-scalar-multiplication operations are included to efficiently aggregate public keys or individual signer&#x27;s signatures during BLS signature verification.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The motivation of this precompile is to add a cryptographic primitive that allows to get 120+ bits of security for operations over pairing friendly curve compared to the existing BN254 precompile that only provides 80 bits of security.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Comment&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;BLS12_G1ADD&lt;&#x2F;td&gt;&lt;td&gt;0x0b&lt;&#x2F;td&gt;&lt;td&gt;precompile address&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;BLS12_G1MSM&lt;&#x2F;td&gt;&lt;td&gt;0x0c&lt;&#x2F;td&gt;&lt;td&gt;precompile address&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;BLS12_G2ADD&lt;&#x2F;td&gt;&lt;td&gt;0x0d&lt;&#x2F;td&gt;&lt;td&gt;precompile address&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;BLS12_G2MSM&lt;&#x2F;td&gt;&lt;td&gt;0x0e&lt;&#x2F;td&gt;&lt;td&gt;precompile address&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;BLS12_PAIRING_CHECK&lt;&#x2F;td&gt;&lt;td&gt;0x0f&lt;&#x2F;td&gt;&lt;td&gt;precompile address&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;BLS12_MAP_FP_TO_G1&lt;&#x2F;td&gt;&lt;td&gt;0x10&lt;&#x2F;td&gt;&lt;td&gt;precompile address&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;BLS12_MAP_FP2_TO_G2&lt;&#x2F;td&gt;&lt;td&gt;0x11&lt;&#x2F;td&gt;&lt;td&gt;precompile address&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;We introduce &lt;em&gt;seven&lt;&#x2F;em&gt; separate precompiles to perform the following operations:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;BLS12_G1ADD - to perform point addition in G1 (curve over base prime field) with a gas cost of &lt;code&gt;375&lt;&#x2F;code&gt; gas&lt;&#x2F;li&gt;
&lt;li&gt;BLS12_G1MSM - to perform multi-scalar-multiplication (MSM) in G1 (curve over base prime field) with a gas cost formula defined in the corresponding section&lt;&#x2F;li&gt;
&lt;li&gt;BLS12_G2ADD - to perform point addition in G2 (curve over quadratic extension of the base prime field) with a gas cost of &lt;code&gt;600&lt;&#x2F;code&gt; gas&lt;&#x2F;li&gt;
&lt;li&gt;BLS12_G2MSM - to perform multi-scalar-multiplication (MSM) in G2 (curve over quadratic extension of the base prime field) with a gas cost formula defined in the corresponding section&lt;&#x2F;li&gt;
&lt;li&gt;BLS12_PAIRING_CHECK - to perform a pairing operations between a set of &lt;em&gt;pairs&lt;&#x2F;em&gt; of (G1, G2) points a gas cost formula defined in the corresponding section&lt;&#x2F;li&gt;
&lt;li&gt;BLS12_MAP_FP_TO_G1 - maps base field element into the G1 point with a gas cost of &lt;code&gt;5500&lt;&#x2F;code&gt; gas&lt;&#x2F;li&gt;
&lt;li&gt;BLS12_MAP_FP2_TO_G2 - maps extension field element into the G2 point with a gas cost of &lt;code&gt;23800&lt;&#x2F;code&gt; gas&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;A mapping functions specification is included as a separate &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2537&#x2F;assets&#x2F;field_to_curve&#x2F;&quot;&gt;document&lt;&#x2F;a&gt;. This mapping function does NOT perform mapping of the byte string into a field element (as it can be implemented in many different ways and can be efficiently performed in EVM), but only does field arithmetic to map a field element into a curve point. Such functionality is required for signature schemes.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;curve-parameters&quot;&gt;Curve parameters&lt;&#x2F;h3&gt;
&lt;p&gt;The BLS12 curve is fully defined by the following set of parameters (coefficient &lt;code&gt;A=0&lt;&#x2F;code&gt; for all BLS12 curves):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Base field modulus = p = 0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Fp - finite field of size p&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Curve Fp equation: Y^2 = X^3+B (mod p)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;B coefficient = 0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Main subgroup order = q = 0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Extension tower&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Fp2 construction:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Fp quadratic non-residue = nr2 = 0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaaa&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Fp2 is Fp[X]&#x2F;(X^2-nr2)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Curve Fp2 equation: Y^2 = X^3 + B*(v+1) where v is the square root of nr2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Fp6&#x2F;Fp12 construction:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Fp2 cubic non-residue c0 = 0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Fp2 cubic non-residue c1 = 0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Twist parameters:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Twist type: M&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;B coefficient for twist c0 = 0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;B coefficient for twist c1 = 0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Generators:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;H1:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;X = 0x17f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Y = 0x08b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;H2:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;X c0 = 0x024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;X c1 = 0x13e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Y c0 = 0x0ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Y c1 = 0x0606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Pairing parameters:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|x| (miller loop scalar) = 0xd201000000010000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;x is negative = true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;One should note that base field modulus &lt;code&gt;p&lt;&#x2F;code&gt; is equal to &lt;code&gt;3 mod 4&lt;&#x2F;code&gt; that allows an efficient square root extraction, although as described below gas cost of decompression is larger than gas cost of supplying decompressed point data in &lt;code&gt;calldata&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;fields-and-groups&quot;&gt;Fields and Groups&lt;&#x2F;h3&gt;
&lt;p&gt;Field Fp is defined as the finite field of size &lt;code&gt;p&lt;&#x2F;code&gt; with elements represented as integers between 0 and p-1 (both inclusive).&lt;&#x2F;p&gt;
&lt;p&gt;Field Fp2 is defined as &lt;code&gt;Fp[X]&#x2F;(X^2-nr2)&lt;&#x2F;code&gt; with elements  &lt;code&gt;el = c0 + c1 * v&lt;&#x2F;code&gt;, where &lt;code&gt;v&lt;&#x2F;code&gt; is the formal square root of &lt;code&gt;nr2&lt;&#x2F;code&gt; represented as integer pairs &lt;code&gt;(c0,c1)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Group G1 is defined as a set of Fp pairs (points) &lt;code&gt;(x,y)&lt;&#x2F;code&gt; such that either &lt;code&gt;(x,y)&lt;&#x2F;code&gt; is  &lt;code&gt;(0,0)&lt;&#x2F;code&gt; or &lt;code&gt;x,y&lt;&#x2F;code&gt; satisfy the curve Fp equation.&lt;&#x2F;p&gt;
&lt;p&gt;Group G2 is defined as a set of Fp2 pairs (points) &lt;code&gt;(x&#x27;,y&#x27;)&lt;&#x2F;code&gt; such that either &lt;code&gt;(x,y)&lt;&#x2F;code&gt; is &lt;code&gt;(0,0)&lt;&#x2F;code&gt; or &lt;code&gt;(x&#x27;,y&#x27;)&lt;&#x2F;code&gt; satisfy the curve Fp2 equation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;fine-points-and-encoding-of-base-elements&quot;&gt;Fine points and encoding of base elements&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;field-elements-encoding&quot;&gt;Field elements encoding:&lt;&#x2F;h4&gt;
&lt;p&gt;In order to produce inputs to an operation, one encodes elements of the base field and the extension field.&lt;&#x2F;p&gt;
&lt;p&gt;A base field element (Fp) is encoded as &lt;code&gt;64&lt;&#x2F;code&gt; bytes by performing the BigEndian encoding of the corresponding (unsigned) integer. Due to the size of &lt;code&gt;p&lt;&#x2F;code&gt;, the top &lt;code&gt;16&lt;&#x2F;code&gt; bytes are always zeroes. &lt;code&gt;64&lt;&#x2F;code&gt; bytes are chosen to have &lt;code&gt;32&lt;&#x2F;code&gt; byte aligned ABI (representable as e.g. &lt;code&gt;bytes32[2]&lt;&#x2F;code&gt; or &lt;code&gt;uint256[2]&lt;&#x2F;code&gt; with the latter assuming the BigEndian encoding). The corresponding integer &lt;strong&gt;must&lt;&#x2F;strong&gt; be less than field modulus.&lt;&#x2F;p&gt;
&lt;p&gt;For elements of the quadratic extension field (Fp2), encoding is byte concatenation of individual encoding of the coefficients totaling in &lt;code&gt;128&lt;&#x2F;code&gt; bytes for a total encoding. For an Fp2 element in a form &lt;code&gt;el = c0 + c1 * v&lt;&#x2F;code&gt; where &lt;code&gt;v&lt;&#x2F;code&gt; is the formal square root of a quadratic non-residue and &lt;code&gt;c0&lt;&#x2F;code&gt; and &lt;code&gt;c1&lt;&#x2F;code&gt; are Fp elements the corresponding byte encoding will be &lt;code&gt;encode(c0) || encode(c1)&lt;&#x2F;code&gt; where &lt;code&gt;||&lt;&#x2F;code&gt; means byte concatenation (or one can use &lt;code&gt;bytes32[4]&lt;&#x2F;code&gt; or &lt;code&gt;uint256[4]&lt;&#x2F;code&gt; in terms of Solidity types).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Note on the top &lt;code&gt;16&lt;&#x2F;code&gt; bytes being zero&lt;&#x2F;em&gt;: it is required that an encoded element is &quot;in a field&quot;, which means strictly &lt;code&gt;&amp;lt; modulus&lt;&#x2F;code&gt;. In BigEndian encoding it automatically means that for a modulus that is just &lt;code&gt;381&lt;&#x2F;code&gt; bit long the top &lt;code&gt;16&lt;&#x2F;code&gt; bytes in &lt;code&gt;64&lt;&#x2F;code&gt; bytes encoding are zeroes and this &lt;strong&gt;must&lt;&#x2F;strong&gt; be checked even if only a subslice of input data is used for actual decoding.&lt;&#x2F;p&gt;
&lt;p&gt;On inputs that can not be a valid encodings of field elements the precompile &lt;em&gt;must&lt;&#x2F;em&gt; return an error.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;encoding-of-points-in-g1-g2&quot;&gt;Encoding of points in G1&#x2F;G2:&lt;&#x2F;h4&gt;
&lt;p&gt;Points of G1 and G2 are encoded as byte concatenation of the respective encodings of the &lt;code&gt;x&lt;&#x2F;code&gt; and &lt;code&gt;y&lt;&#x2F;code&gt; coordinates. Total encoding length for a G1 point is thus &lt;code&gt;128&lt;&#x2F;code&gt; bytes and for a G2 point is &lt;code&gt;256&lt;&#x2F;code&gt; bytes.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;point-of-infinity-encoding&quot;&gt;Point of infinity encoding:&lt;&#x2F;h4&gt;
&lt;p&gt;Also referred to as the &quot;zero point&quot;. For BLS12 curves, the point with coordinates &lt;code&gt;(0, 0)&lt;&#x2F;code&gt; (zeroes in Fp or Fp2) is &lt;em&gt;not&lt;&#x2F;em&gt; on the curve, so a sequence of &lt;code&gt;128&lt;&#x2F;code&gt; resp. &lt;code&gt;256&lt;&#x2F;code&gt; zero bytes, which naively would decode as &lt;code&gt;(0, 0)&lt;&#x2F;code&gt; is instead used by convention to encode the point of infinity of G1 resp. G2.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;encoding-of-scalars-for-multiplication-operation&quot;&gt;Encoding of scalars for multiplication operation:&lt;&#x2F;h4&gt;
&lt;p&gt;A scalar for the multiplication operation is encoded as &lt;code&gt;32&lt;&#x2F;code&gt; bytes by performing BigEndian encoding of the corresponding (unsigned) integer. The corresponding integer is &lt;strong&gt;not&lt;&#x2F;strong&gt; required to be less than or equal to main subgroup order &lt;code&gt;q&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;behavior-on-empty-inputs&quot;&gt;Behavior on empty inputs:&lt;&#x2F;h4&gt;
&lt;p&gt;Certain operations have variable length input, such as MSMs (takes a list of pairs &lt;code&gt;(point, scalar)&lt;&#x2F;code&gt;), or pairing (takes a list of &lt;code&gt;(G1, G2)&lt;&#x2F;code&gt; points). While their behavior is well-defined (from an arithmetic perspective) on empty inputs, this EIP discourages such use cases and variable input length operations must return an error if the input is empty.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;abi-for-operations&quot;&gt;ABI for operations&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;abi-for-g1-addition&quot;&gt;ABI for G1 addition&lt;&#x2F;h4&gt;
&lt;p&gt;G1 addition call expects &lt;code&gt;256&lt;&#x2F;code&gt; bytes as an input that is interpreted as byte concatenation of two G1 points (&lt;code&gt;128&lt;&#x2F;code&gt; bytes each). Output is an encoding of addition operation result - single G1 point (&lt;code&gt;128&lt;&#x2F;code&gt; bytes).&lt;&#x2F;p&gt;
&lt;p&gt;Error cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Invalid coordinate encoding&lt;&#x2F;li&gt;
&lt;li&gt;An input is neither a point on the G1 elliptic curve nor the infinity point&lt;&#x2F;li&gt;
&lt;li&gt;Input has invalid length&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note:&lt;&#x2F;p&gt;
&lt;p&gt;There is no subgroup check for the G1 addition precompile.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;abi-for-g1-msm&quot;&gt;ABI for G1 MSM&lt;&#x2F;h4&gt;
&lt;p&gt;G1 MSM call expects &lt;code&gt;160*k&lt;&#x2F;code&gt; (&lt;code&gt;k&lt;&#x2F;code&gt; being a &lt;strong&gt;positive&lt;&#x2F;strong&gt; integer) bytes as an input that is interpreted as byte concatenation of &lt;code&gt;k&lt;&#x2F;code&gt; slices each of them being a byte concatenation of encoding of a G1 point (&lt;code&gt;128&lt;&#x2F;code&gt; bytes) and encoding of a scalar value (&lt;code&gt;32&lt;&#x2F;code&gt; bytes). Output is an encoding of MSM operation result - a single G1 point (&lt;code&gt;128&lt;&#x2F;code&gt; bytes).&lt;&#x2F;p&gt;
&lt;p&gt;Error cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Invalid coordinate encoding&lt;&#x2F;li&gt;
&lt;li&gt;An input is neither a point on the G1 elliptic curve nor the infinity point&lt;&#x2F;li&gt;
&lt;li&gt;An input is on the G1 elliptic curve but not in the correct subgroup&lt;&#x2F;li&gt;
&lt;li&gt;Input has invalid length&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;abi-for-g2-addition&quot;&gt;ABI for G2 addition&lt;&#x2F;h4&gt;
&lt;p&gt;G2 addition call expects &lt;code&gt;512&lt;&#x2F;code&gt; bytes as an input that is interpreted as byte concatenation of two G2 points (&lt;code&gt;256&lt;&#x2F;code&gt; bytes each). Output is an encoding of addition operation result - a single G2 point (&lt;code&gt;256&lt;&#x2F;code&gt; bytes).&lt;&#x2F;p&gt;
&lt;p&gt;Error cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Invalid coordinate encoding&lt;&#x2F;li&gt;
&lt;li&gt;An input is neither a point on the G2 elliptic curve nor the infinity point&lt;&#x2F;li&gt;
&lt;li&gt;Input has invalid length&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note:&lt;&#x2F;p&gt;
&lt;p&gt;There is no subgroup check for the G2 addition precompile.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;abi-for-g2-msm&quot;&gt;ABI for G2 MSM&lt;&#x2F;h4&gt;
&lt;p&gt;G2 MSM call expects &lt;code&gt;288*k&lt;&#x2F;code&gt; (&lt;code&gt;k&lt;&#x2F;code&gt; being a &lt;strong&gt;positive&lt;&#x2F;strong&gt; integer) bytes as an input that is interpreted as byte concatenation of &lt;code&gt;k&lt;&#x2F;code&gt; slices each of them being a byte concatenation of encoding of G2 point (&lt;code&gt;256&lt;&#x2F;code&gt; bytes) and encoding of a scalar value (&lt;code&gt;32&lt;&#x2F;code&gt; bytes). Output is an encoding of MSM operation result - a single G2 point (&lt;code&gt;256&lt;&#x2F;code&gt; bytes).&lt;&#x2F;p&gt;
&lt;p&gt;Error cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Invalid coordinate encoding&lt;&#x2F;li&gt;
&lt;li&gt;An input is neither a point on the G2 elliptic curve nor the infinity point&lt;&#x2F;li&gt;
&lt;li&gt;An input is on the G2 elliptic curve but not in the correct subgroup&lt;&#x2F;li&gt;
&lt;li&gt;Input has invalid length&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;abi-for-pairing-check&quot;&gt;ABI for pairing check&lt;&#x2F;h4&gt;
&lt;p&gt;Pairing check call expects &lt;code&gt;384*k&lt;&#x2F;code&gt;  (&lt;code&gt;k&lt;&#x2F;code&gt; being a &lt;strong&gt;positive&lt;&#x2F;strong&gt; integer)  bytes as an inputs that is interpreted as byte concatenation of &lt;code&gt;k&lt;&#x2F;code&gt; slices. Each slice has the following structure:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;128&lt;&#x2F;code&gt; bytes of G1 point encoding&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;256&lt;&#x2F;code&gt; bytes of G2 point encoding&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Each point is expected to be in the subgroup of order &lt;code&gt;q&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;It checks the equation &lt;code&gt;e(P1, Q1) * e(P2, Q2) * ... * e(Pk, Qk) == 1&lt;&#x2F;code&gt; in the pairing target field where &lt;code&gt;e&lt;&#x2F;code&gt; is the pairing operation. Output is &lt;code&gt;32&lt;&#x2F;code&gt; bytes where first &lt;code&gt;31&lt;&#x2F;code&gt; bytes are equal to &lt;code&gt;0x00&lt;&#x2F;code&gt; and the last byte is either &lt;code&gt;0x00&lt;&#x2F;code&gt; (false) or &lt;code&gt;0x01&lt;&#x2F;code&gt; (true).&lt;&#x2F;p&gt;
&lt;p&gt;Error cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Invalid coordinate encoding&lt;&#x2F;li&gt;
&lt;li&gt;An input is neither a point on its respective elliptic curve nor the infinity point&lt;&#x2F;li&gt;
&lt;li&gt;An input is on its respective elliptic curve but not in the correct subgroup&lt;&#x2F;li&gt;
&lt;li&gt;Input has invalid length&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;abi-for-mapping-fp-element-to-g1-point&quot;&gt;ABI for mapping Fp element to G1 point&lt;&#x2F;h4&gt;
&lt;p&gt;Field-to-curve call expects &lt;code&gt;64&lt;&#x2F;code&gt; bytes as an input that is interpreted as an element of Fp. Output of this call is &lt;code&gt;128&lt;&#x2F;code&gt; bytes and is an encoded G1 point.&lt;&#x2F;p&gt;
&lt;p&gt;Error cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Input has invalid length&lt;&#x2F;li&gt;
&lt;li&gt;Input is not correctly encoded&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;abi-for-mapping-fp2-element-to-g2-point&quot;&gt;ABI for mapping Fp2 element to G2 point&lt;&#x2F;h4&gt;
&lt;p&gt;Field-to-curve call expects &lt;code&gt;128&lt;&#x2F;code&gt; bytes as an input that is interpreted as an element of Fp2. Output of this call is &lt;code&gt;256&lt;&#x2F;code&gt; bytes and is an encoded G2 point.&lt;&#x2F;p&gt;
&lt;p&gt;Error cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Input has invalid length&lt;&#x2F;li&gt;
&lt;li&gt;Input is not correctly encoded&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;gas-burning-on-error&quot;&gt;Gas burning on error&lt;&#x2F;h3&gt;
&lt;p&gt;Following the current state of all other precompiles, if a call to one of the precompiles in this EIP results in an error then all the gas supplied along with a &lt;code&gt;CALL&lt;&#x2F;code&gt; or &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; is burned.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;ddos-protection&quot;&gt;DDoS protection&lt;&#x2F;h3&gt;
&lt;p&gt;A sane implementation of this EIP &lt;em&gt;should not&lt;&#x2F;em&gt; contain potential infinite loops (it is possible and not even hard to implement all the functionality without &lt;code&gt;while&lt;&#x2F;code&gt; loops) and the gas schedule accurately reflects the time spent on computations of the corresponding function (precompiles pricing reflects an amount of gas consumed in the worst case where such a case exists).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-schedule&quot;&gt;Gas schedule&lt;&#x2F;h3&gt;
&lt;p&gt;Assuming &lt;code&gt;EcRecover&lt;&#x2F;code&gt; precompile as a baseline.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;g1-addition&quot;&gt;G1 addition&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;375&lt;&#x2F;code&gt; gas&lt;&#x2F;p&gt;
&lt;h4 id=&quot;g1-multiplication&quot;&gt;G1 multiplication&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;12000&lt;&#x2F;code&gt; gas&lt;&#x2F;p&gt;
&lt;h4 id=&quot;g2-addition&quot;&gt;G2 addition&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;600&lt;&#x2F;code&gt; gas&lt;&#x2F;p&gt;
&lt;h4 id=&quot;g2-multiplication&quot;&gt;G2 multiplication&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;22500&lt;&#x2F;code&gt; gas&lt;&#x2F;p&gt;
&lt;h4 id=&quot;g1-g2-msm&quot;&gt;G1&#x2F;G2 MSM&lt;&#x2F;h4&gt;
&lt;p&gt;MSMs are expected to be performed by Pippenger&#x27;s algorithm (we can also say that it &lt;strong&gt;must&lt;&#x2F;strong&gt; be performed by Pippenger&#x27;s algorithm to have a speedup that results in a discount over naive implementation by multiplying each pair separately and adding the results). For this case there was a table prepared for discount in case of &lt;code&gt;k &amp;lt;= 128&lt;&#x2F;code&gt; points in the MSM with a discount cap &lt;code&gt;max_discount&lt;&#x2F;code&gt; for &lt;code&gt;k &amp;gt; 128&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The call cost is calculated as &lt;code&gt;(k * multiplication_cost * discount) &#x2F;&#x2F; multiplier&lt;&#x2F;code&gt; where &lt;code&gt;multiplier = 1000&lt;&#x2F;code&gt;, &lt;code&gt;k&lt;&#x2F;code&gt; is a number of (scalar, point) pairs for the call, &lt;code&gt;multiplication_cost&lt;&#x2F;code&gt; is a corresponding G1&#x2F;G2 multiplication cost presented above and &lt;code&gt;&#x2F;&#x2F;&lt;&#x2F;code&gt; is an integer division.&lt;&#x2F;p&gt;
&lt;p&gt;G1 and G2 are priced separately, each having their own discount table and &lt;code&gt;max_discount&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;g1-discounts&quot;&gt;G1 discounts&lt;&#x2F;h5&gt;
&lt;p&gt;Discounts table for G1 MSM as a vector of pairs &lt;code&gt;[k, discount]&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[[1, 1000], [2, 949], [3, 848], [4, 797], [5, 764], [6, 750], [7, 738], [8, 728], [9, 719], [10, 712], [11, 705], [12, 698], [13, 692], [14, 687], [15, 682], [16, 677], [17, 673], [18, 669], [19, 665], [20, 661], [21, 658], [22, 654], [23, 651], [24, 648], [25, 645], [26, 642], [27, 640], [28, 637], [29, 635], [30, 632], [31, 630], [32, 627], [33, 625], [34, 623], [35, 621], [36, 619], [37, 617], [38, 615], [39, 613], [40, 611], [41, 609], [42, 608], [43, 606], [44, 604], [45, 603], [46, 601], [47, 599], [48, 598], [49, 596], [50, 595], [51, 593], [52, 592], [53, 591], [54, 589], [55, 588], [56, 586], [57, 585], [58, 584], [59, 582], [60, 581], [61, 580], [62, 579], [63, 577], [64, 576], [65, 575], [66, 574], [67, 573], [68, 572], [69, 570], [70, 569], [71, 568], [72, 567], [73, 566], [74, 565], [75, 564], [76, 563], [77, 562], [78, 561], [79, 560], [80, 559], [81, 558], [82, 557], [83, 556], [84, 555], [85, 554], [86, 553], [87, 552], [88, 551], [89, 550], [90, 549], [91, 548], [92, 547], [93, 547], [94, 546], [95, 545], [96, 544], [97, 543], [98, 542], [99, 541], [100, 540], [101, 540], [102, 539], [103, 538], [104, 537], [105, 536], [106, 536], [107, 535], [108, 534], [109, 533], [110, 532], [111, 532], [112, 531], [113, 530], [114, 529], [115, 528], [116, 528], [117, 527], [118, 526], [119, 525], [120, 525], [121, 524], [122, 523], [123, 522], [124, 522], [125, 521], [126, 520], [127, 520], [128, 519]]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;max_discount = 519&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h5 id=&quot;g2-discounts&quot;&gt;G2 discounts&lt;&#x2F;h5&gt;
&lt;p&gt;Discounts table for G2 MSM as a vector of pairs &lt;code&gt;[k, discount]&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[[1, 1000], [2, 1000], [3, 923], [4, 884], [5, 855], [6, 832], [7, 812], [8, 796], [9, 782], [10, 770], [11, 759], [12, 749], [13, 740], [14, 732], [15, 724], [16, 717], [17, 711], [18, 704], [19, 699], [20, 693], [21, 688], [22, 683], [23, 679], [24, 674], [25, 670], [26, 666], [27, 663], [28, 659], [29, 655], [30, 652], [31, 649], [32, 646], [33, 643], [34, 640], [35, 637], [36, 634], [37, 632], [38, 629], [39, 627], [40, 624], [41, 622], [42, 620], [43, 618], [44, 615], [45, 613], [46, 611], [47, 609], [48, 607], [49, 606], [50, 604], [51, 602], [52, 600], [53, 598], [54, 597], [55, 595], [56, 593], [57, 592], [58, 590], [59, 589], [60, 587], [61, 586], [62, 584], [63, 583], [64, 582], [65, 580], [66, 579], [67, 578], [68, 576], [69, 575], [70, 574], [71, 573], [72, 571], [73, 570], [74, 569], [75, 568], [76, 567], [77, 566], [78, 565], [79, 563], [80, 562], [81, 561], [82, 560], [83, 559], [84, 558], [85, 557], [86, 556], [87, 555], [88, 554], [89, 553], [90, 552], [91, 552], [92, 551], [93, 550], [94, 549], [95, 548], [96, 547], [97, 546], [98, 545], [99, 545], [100, 544], [101, 543], [102, 542], [103, 541], [104, 541], [105, 540], [106, 539], [107, 538], [108, 537], [109, 537], [110, 536], [111, 535], [112, 535], [113, 534], [114, 533], [115, 532], [116, 532], [117, 531], [118, 530], [119, 530], [120, 529], [121, 528], [122, 528], [123, 527], [124, 526], [125, 526], [126, 525], [127, 524], [128, 524]]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;max_discount = 524&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;pairing-check-operation&quot;&gt;Pairing check operation&lt;&#x2F;h4&gt;
&lt;p&gt;The cost of the pairing check operation is &lt;code&gt;32600*k + 37700&lt;&#x2F;code&gt; where &lt;code&gt;k&lt;&#x2F;code&gt; is a number of pairs.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;fp-to-g1-mapping-operation&quot;&gt;Fp-to-G1 mapping operation&lt;&#x2F;h4&gt;
&lt;p&gt;Fp -&amp;gt; G1 mapping is &lt;code&gt;5500&lt;&#x2F;code&gt; gas.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;fp2-to-g2-mapping-operation&quot;&gt;Fp2-to-G2 mapping operation&lt;&#x2F;h4&gt;
&lt;p&gt;Fp2 -&amp;gt; G2 mapping is &lt;code&gt;23800&lt;&#x2F;code&gt; gas&lt;&#x2F;p&gt;
&lt;h4 id=&quot;gas-schedule-clarifications-for-the-variable-length-input&quot;&gt;Gas schedule clarifications for the variable-length input&lt;&#x2F;h4&gt;
&lt;p&gt;For MSM and pairing functions, the gas cost depends on the input length. The current state of how the gas schedule is implemented in major clients (at the time of writing) is that the gas cost function does &lt;em&gt;not&lt;&#x2F;em&gt; perform any validation of the length of the input and never returns an error. So we present a list of rules how the gas cost functions &lt;strong&gt;must&lt;&#x2F;strong&gt; be implemented to ensure consistency between clients and safety.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;gas-schedule-clarifications-for-g1-g2-msm&quot;&gt;Gas schedule clarifications for G1&#x2F;G2 MSM&lt;&#x2F;h5&gt;
&lt;p&gt;Define a constant &lt;code&gt;LEN_PER_PAIR&lt;&#x2F;code&gt; that is equal to &lt;code&gt;160&lt;&#x2F;code&gt; for G1 operation and to &lt;code&gt;288&lt;&#x2F;code&gt; for G2 operation. Define a function &lt;code&gt;discount(k)&lt;&#x2F;code&gt; following the rules in the corresponding section, where &lt;code&gt;k&lt;&#x2F;code&gt; is number of pairs.&lt;&#x2F;p&gt;
&lt;p&gt;The following pseudofunction reflects how gas should be calculated:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;k = floor(len(input) &#x2F; LEN_PER_PAIR);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;if k == 0 {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  return 0;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gas_cost = k * multiplication_cost * discount(k) &#x2F;&#x2F; multiplier;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;return gas_cost;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;We use floor division to get the number of pairs. If the length of the input is not divisible by &lt;code&gt;LEN_PER_PAIR&lt;&#x2F;code&gt; we still produce &lt;em&gt;some&lt;&#x2F;em&gt; result, but later on the precompile will return an error. Also, the case when &lt;code&gt;k = 0&lt;&#x2F;code&gt; is safe: &lt;code&gt;CALL&lt;&#x2F;code&gt; or &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; cost is non-zero, and the case with formal zero gas cost is already used in &lt;code&gt;Blake2f&lt;&#x2F;code&gt; precompile. In any case, the main precompile routine &lt;strong&gt;must&lt;&#x2F;strong&gt; produce an error on such an input because it violated encoding rules.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;gas-schedule-clarifications-for-pairing&quot;&gt;Gas schedule clarifications for pairing&lt;&#x2F;h5&gt;
&lt;p&gt;Define a constant &lt;code&gt;LEN_PER_PAIR = 384&lt;&#x2F;code&gt;;&lt;&#x2F;p&gt;
&lt;p&gt;The following pseudofunction reflects how gas should be calculated:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;k = floor(len(input) &#x2F; LEN_PER_PAIR);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gas_cost = 32600*k + 37700;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;return gas_cost;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;We use floor division to get the number of pairs. If the length of the input is not divisible by &lt;code&gt;LEN_PER_PAIR&lt;&#x2F;code&gt; we still produce &lt;em&gt;some&lt;&#x2F;em&gt; result, but later on the precompile will return an error (the precompile routine &lt;strong&gt;must&lt;&#x2F;strong&gt; produce an error on such an input because it violated encoding rules).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The motivation section covers a total motivation to have operations over the BLS12-381 curves available. We also extend a rationale for more specific fine points.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;msm-as-a-separate-call&quot;&gt;MSM as a separate call&lt;&#x2F;h3&gt;
&lt;p&gt;Explicit separate MSM operation that allows one to save execution time (so gas) by both the algorithm used (namely Pippenger&#x27;s algorithm) and (usually forgotten) by the fact that &lt;code&gt;CALL&lt;&#x2F;code&gt; operation in Ethereum is expensive (at the time of writing), so one would have to pay non-negligible overhead if e.g. for MSM of &lt;code&gt;100&lt;&#x2F;code&gt; points would have to call the multiplication precompile &lt;code&gt;100&lt;&#x2F;code&gt; times and addition for &lt;code&gt;99&lt;&#x2F;code&gt; times (roughly &lt;code&gt;138600&lt;&#x2F;code&gt; would be saved).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;no-dedicated-mul-call&quot;&gt;No dedicated MUL call&lt;&#x2F;h3&gt;
&lt;p&gt;Dedicated MUL precompiles which perform single G1&#x2F;G2 point by scalar multiplication have exactly the same ABI as MSM with &lt;code&gt;k == 1&lt;&#x2F;code&gt;.
MSM has to inspect the input length to reject inputs of invalid lengths. Therefore, it should recognize the case of &lt;code&gt;k == 1&lt;&#x2F;code&gt; and invoke the underlying implementation of single point multiplication to avoid the overhead of more complex multi-scalar multiplication algorithm.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;There are no backward compatibility questions.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;subgroup-checks&quot;&gt;Subgroup checks&lt;&#x2F;h3&gt;
&lt;p&gt;MSMs and pairings MUST perform a subgroup check.
Implementations SHOULD use the optimized subgroup check method detailed in a dedicated &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2537&#x2F;assets&#x2F;fast_subgroup_checks&#x2F;&quot;&gt;document&lt;&#x2F;a&gt;.
On any input that fails the subgroup check, the precompile MUST return an error.
As endomorphism acceleration requires input on the correct subgroup, implementers MAY use endomorphism acceleration.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;field-to-curve-mapping&quot;&gt;Field to curve mapping&lt;&#x2F;h3&gt;
&lt;p&gt;The algorithms and set of parameters for SWU mapping method are provided by a separate &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2537&#x2F;assets&#x2F;field_to_curve&#x2F;&quot;&gt;document&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Due to the large test parameters space, we first provide properties that various operations must satisfy. We use additive notation for point operations, capital letters (&lt;code&gt;P&lt;&#x2F;code&gt;, &lt;code&gt;Q&lt;&#x2F;code&gt;) for points, small letters (&lt;code&gt;a&lt;&#x2F;code&gt;, &lt;code&gt;b&lt;&#x2F;code&gt;) for scalars. The generator for G1 is labeled as &lt;code&gt;G&lt;&#x2F;code&gt;, the generator for G2 is labeled as &lt;code&gt;H&lt;&#x2F;code&gt;, otherwise we assume random points on a curve in a correct subgroup. &lt;code&gt;0&lt;&#x2F;code&gt; means either scalar zero or point at infinity. &lt;code&gt;1&lt;&#x2F;code&gt; means either scalar one or multiplicative identity. &lt;code&gt;group_order&lt;&#x2F;code&gt; is the main subgroup order. &lt;code&gt;e(P, Q)&lt;&#x2F;code&gt; means pairing operation where &lt;code&gt;P&lt;&#x2F;code&gt; is in G1, &lt;code&gt;Q&lt;&#x2F;code&gt; is in G2.&lt;&#x2F;p&gt;
&lt;p&gt;Required properties for basic ops (add&#x2F;multiply):&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Commutativity: &lt;code&gt;P + Q = Q + P&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Identity element: &lt;code&gt;P + 0 = P&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Additive negation: &lt;code&gt;P + (-P) = 0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Doubling &lt;code&gt;P + P = 2*P&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Subgroup check: &lt;code&gt;group_order * P = 0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Trivial multiplication check: &lt;code&gt;1 * P = P&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Multiplication by zero: &lt;code&gt;0 * P = 0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Multiplication by the unnormalized scalar &lt;code&gt;(scalar + group_order) * P = scalar * P&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Required properties for pairing operation:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Bilinearity &lt;code&gt;e(a*P, b*Q) = e(a*b*P, Q) = e(P, a*b*Q)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Non-degeneracy &lt;code&gt;e(P, Q) != 1&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;e(P, 0*Q) = e(0*P, Q) = 1&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;e(P, -Q) = e(-P, Q)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Test vectors can be found &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2537&#x2F;assets&#x2F;test-vectors&#x2F;&quot;&gt;in the test vectors files&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;benchmarking-test-cases&quot;&gt;Benchmarking test cases&lt;&#x2F;h3&gt;
&lt;p&gt;A set of test vectors for quick benchmarking on new implementations is located in a separate &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2537&#x2F;assets&#x2F;bench_vectors&#x2F;&quot;&gt;file&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;There are two fully spec compatible implementations on the day of writing:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;One in Rust language that is based on the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;196&#x2F;&quot;&gt;EIP-196&lt;&#x2F;a&gt; code and integrated with OpenEthereum for this library&lt;&#x2F;li&gt;
&lt;li&gt;One implemented specifically for Geth as a part of the current codebase&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Strictly following the spec will eliminate security implications or consensus implications in a contrast to the previous BN254 precompile.&lt;&#x2F;p&gt;
&lt;p&gt;Important topic is a &quot;constant time&quot; property for performed operations. We explicitly state that this precompile &lt;strong&gt;IS NOT REQUIRED&lt;&#x2F;strong&gt; to perform all the operations using constant time algorithms.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Penalty for account trie misses</title>
        <published>2020-02-21T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Martin Holst Swende</name><uri>https://github.com/holiman</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2583/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2583-penalties-for-trie-misses/4190" />
        

        <id>https://wg-eips.ritovision.com/2583/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:2583"
            label="EIP-2583" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2583/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a gas penalty for opcodes which access the account for trie non-existent accounts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP adds a gas penalty for accesses to the account trie, where the address being looked up does not exist. Non-existing accounts can be used in
DoS attacks, since they bypass cache mechanisms, thus creating a large discrepancy between &#x27;normal&#x27; mode of execution and &#x27;worst-case&#x27; execution of an opcode.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;As the ethereum trie becomes more and more saturated, the number of disk lookups that a node is required to do in order to access a piece of state increases too. This means that checking e.g. &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; of an account at block &lt;code&gt;5&lt;&#x2F;code&gt; was &lt;em&gt;inherently&lt;&#x2F;em&gt; a cheaper operation that it is at, say &lt;code&gt;8.5M&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;From an implementation perspective, a node can (and does) use various caching mechanisms to cope with the problem, but there&#x27;s an inherent problem with caches: when they yield a &#x27;hit&#x27;, they&#x27;re great, but when they &#x27;miss&#x27;, they&#x27;re useless.&lt;&#x2F;p&gt;
&lt;p&gt;This is attackable. By forcing a node to lookup non-existent keys, an attacker can maximize the number of disk lookups.
Sidenote: even if the &#x27;non-existence&#x27; is cached, it&#x27;s trivial to use a new non-existent key the next time, and never hit the same non-existent key again. Thus, caching &#x27;non-existence&#x27; might be dangerous, since it will evict &#x27;good&#x27; entries.&lt;&#x2F;p&gt;
&lt;p&gt;So far, the attempts to handle this problem has been in raising the gas cost, e.g. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;150&#x2F;&quot;&gt;EIP-150&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1884&#x2F;&quot;&gt;EIP-1884&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;However, when determining gas-costs, a secondary problem that arises due to the large discrepancy between &#x27;happy-path&#x27; and &#x27;notorious path&#x27; -- how do we determine the pricing?&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The &#x27;happy-path&#x27;, assuming all items are cached?
&lt;ul&gt;
&lt;li&gt;Doing so would that would underprice all trie-accesses, and could be DoS-attacked.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The &#x27;normal&#x27; usage, based on benchmarks of actual usage?
&lt;ul&gt;
&lt;li&gt;This is basically what we do now, but that means that intentionally notorious executions are underpriced -- which constitutes a DoS vulnerability.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The &#x27;paranoid&#x27; case: price everything as if caching did not exist?
&lt;ul&gt;
&lt;li&gt;This would severely harm basically every contract due to the gas-cost increase. Also, if the gas limits were raised in order to allow the same amount of computation as before, the notorious case could again be used for DoS attacks.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;From an engineering point of view, a node implementor is left with few options:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Implement bloom filters for existence. This is difficult, not least because of the problems of reorgs, and the fact that it&#x27;s difficult to undo bloom filter modifications.&lt;&#x2F;li&gt;
&lt;li&gt;Implement flattened account databases. This is also difficult, both because of reorgs and also because it needs to be an &lt;em&gt;additional&lt;&#x2F;em&gt; data structure aside from the &lt;code&gt;trie&lt;&#x2F;code&gt; -- we need the &lt;code&gt;trie&lt;&#x2F;code&gt; for consensus. So it&#x27;s an extra data structure of around &lt;code&gt;15G&lt;&#x2F;code&gt; that needs to be kept in check. This is currently being pursued by the Geth-team.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This EIP proposes a mechanism to alleviate the situation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;We define the constant &lt;code&gt;penalty&lt;&#x2F;code&gt; as &lt;code&gt;TBD&lt;&#x2F;code&gt; (suggested &lt;code&gt;2000&lt;&#x2F;code&gt; gas).&lt;&#x2F;p&gt;
&lt;p&gt;For opcodes which access the account trie, whenever the operation is invoked targeting an &lt;code&gt;address&lt;&#x2F;code&gt; which does not exist in the trie, then &lt;code&gt;penalty&lt;&#x2F;code&gt; gas is deducted from the available &lt;code&gt;gas&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;detailed-specification&quot;&gt;Detailed specification&lt;&#x2F;h3&gt;
&lt;p&gt;These are the opcodes which triggers lookup into the main account trie:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Opcode&lt;&#x2F;th&gt;&lt;th&gt;Affected&lt;&#x2F;th&gt;&lt;th&gt;Comment&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;BALANCE&lt;&#x2F;td&gt;&lt;td&gt;Yes&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;balance(nonexistent_addr)&lt;&#x2F;code&gt; would incur &lt;code&gt;penalty&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;EXTCODEHASH&lt;&#x2F;td&gt;&lt;td&gt;Yes&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;extcodehash(nonexistent_addr)&lt;&#x2F;code&gt; would incur &lt;code&gt;penalty&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;EXTCODECOPY&lt;&#x2F;td&gt;&lt;td&gt;Yes&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;extcodecopy(nonexistent_addr)&lt;&#x2F;code&gt; would incur &lt;code&gt;penalty&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;EXTCODESIZE&lt;&#x2F;td&gt;&lt;td&gt;Yes&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;extcodesize(nonexistent_addr)&lt;&#x2F;code&gt; would incur &lt;code&gt;penalty&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;CALL&lt;&#x2F;td&gt;&lt;td&gt;Yes&lt;&#x2F;td&gt;&lt;td&gt;See details below about call variants&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;CALLCODE&lt;&#x2F;td&gt;&lt;td&gt;Yes&lt;&#x2F;td&gt;&lt;td&gt;See details below about call variants&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;DELEGATECALL&lt;&#x2F;td&gt;&lt;td&gt;Yes&lt;&#x2F;td&gt;&lt;td&gt;See details below about call variants&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;STATICCALL&lt;&#x2F;td&gt;&lt;td&gt;Yes&lt;&#x2F;td&gt;&lt;td&gt;See details below about call variants&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;SELFDESTRUCT&lt;&#x2F;td&gt;&lt;td&gt;No&lt;&#x2F;td&gt;&lt;td&gt;See details below.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;CREATE&lt;&#x2F;td&gt;&lt;td&gt;No&lt;&#x2F;td&gt;&lt;td&gt;Create destination not explicitly settable, and assumed to be nonexistent already.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;CREATE2&lt;&#x2F;td&gt;&lt;td&gt;No&lt;&#x2F;td&gt;&lt;td&gt;Create destination not explicitly settable, and assumed to be nonexistent already.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;notes-on-call-derivatives&quot;&gt;Notes on Call-derivatives&lt;&#x2F;h3&gt;
&lt;p&gt;A &lt;code&gt;CALL&lt;&#x2F;code&gt; triggers a lookup of the &lt;code&gt;CALL&lt;&#x2F;code&gt; destination address. The base cost for &lt;code&gt;CALL&lt;&#x2F;code&gt; is at &lt;code&gt;700&lt;&#x2F;code&gt; gas. A few other characteristics determine the actual gas cost of a call:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;If the &lt;code&gt;CALL&lt;&#x2F;code&gt; (or &lt;code&gt;CALLCODE&lt;&#x2F;code&gt;) transfers value, an additional &lt;code&gt;9K&lt;&#x2F;code&gt; is added as cost.
1.1 If the &lt;code&gt;CALL&lt;&#x2F;code&gt; destination did not previously exist, an additional &lt;code&gt;25K&lt;&#x2F;code&gt; gas is added to the cost.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;This EIP adds a second rule in the following way:&lt;&#x2F;p&gt;
&lt;ol start=&quot;2&quot;&gt;
&lt;li&gt;If the call does &lt;em&gt;not&lt;&#x2F;em&gt; transfer value and the callee does &lt;em&gt;not&lt;&#x2F;em&gt; exist, then &lt;code&gt;penalty&lt;&#x2F;code&gt; gas is added to the cost.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;In the table below,&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;value&lt;&#x2F;code&gt; means non-zero value transfer,&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;!value&lt;&#x2F;code&gt; means zero value transfer,&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;dest&lt;&#x2F;code&gt; means destination already exists, or is a &lt;code&gt;precompile&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;!dest&lt;&#x2F;code&gt; means destination does not exist and is not a &lt;code&gt;precompile&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Op&lt;&#x2F;th&gt;&lt;th&gt;value,dest&lt;&#x2F;th&gt;&lt;th&gt;value, !dest&lt;&#x2F;th&gt;&lt;th&gt;!value, dest&lt;&#x2F;th&gt;&lt;th&gt;!value, !dest&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;CALL&lt;&#x2F;td&gt;&lt;td&gt;no change&lt;&#x2F;td&gt;&lt;td&gt;no change&lt;&#x2F;td&gt;&lt;td&gt;no change&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;penalty&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;CALLCODE&lt;&#x2F;td&gt;&lt;td&gt;no change&lt;&#x2F;td&gt;&lt;td&gt;no change&lt;&#x2F;td&gt;&lt;td&gt;no change&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;penalty&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;DELEGATECALL&lt;&#x2F;td&gt;&lt;td&gt;N&#x2F;A&lt;&#x2F;td&gt;&lt;td&gt;N&#x2F;A&lt;&#x2F;td&gt;&lt;td&gt;no change&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;penalty&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;STATICCALL&lt;&#x2F;td&gt;&lt;td&gt;N&#x2F;A&lt;&#x2F;td&gt;&lt;td&gt;N&#x2F;A&lt;&#x2F;td&gt;&lt;td&gt;no change&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;penalty&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Whether the rules of this EIP is to be applied for regular ether-sends in &lt;code&gt;transactions&lt;&#x2F;code&gt; is TBD. See the &#x27;Backwards Compatibility&#x27;-section for some more discussion on that topic.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;note-on-selfdestruct&quot;&gt;Note on &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; opcode also triggers an account trie lookup of the &lt;code&gt;beneficiary&lt;&#x2F;code&gt;. However, due to the following reasons, it has been omitted from having a &lt;code&gt;penalty&lt;&#x2F;code&gt; since it already costs &lt;code&gt;5K&lt;&#x2F;code&gt; gas.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;clarifications&quot;&gt;Clarifications:&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;base&lt;&#x2F;code&gt; costs of any opcodes are not modified by the EIP.&lt;&#x2F;li&gt;
&lt;li&gt;The opcode &lt;code&gt;SELFBALANCE&lt;&#x2F;code&gt; is not modified by this EIP, regardless of whether the &lt;code&gt;self&lt;&#x2F;code&gt; address exists or not.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;With this scheme, we could continue to price these operations based on the &#x27;normal&#x27; usage, but gain protection from attacks that try to maximize disk lookups&#x2F;cache misses.
This EIP does not modify anything regarding storage trie accesses, which might be relevant for a future EIP. However, there are a few crucial differences.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Storage tries are typically small, and there&#x27;s a high cost to populate a storage trie with sufficient density for it to be in the same league as the account trie.&lt;&#x2F;li&gt;
&lt;li&gt;If an attacker wants to use an existing large storage trie, e.g. some popular token, he would typically have to make a &lt;code&gt;CALL&lt;&#x2F;code&gt; to cause a lookup in that token -- something like &lt;code&gt;token.balanceOf(&amp;lt;nonexistent-address&amp;gt;)&lt;&#x2F;code&gt;.
That adds quite a lot of extra gas-impediments, as each &lt;code&gt;CALL&lt;&#x2F;code&gt; is another &lt;code&gt;700&lt;&#x2F;code&gt; gas, plus gas for arguments to the &lt;code&gt;CALL&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;determining-the-penalty&quot;&gt;Determining the &lt;code&gt;penalty&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;A transaction with &lt;code&gt;10M&lt;&#x2F;code&gt; gas can today cause ~&lt;code&gt;14K&lt;&#x2F;code&gt; trie lookups.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A &lt;code&gt;penalty&lt;&#x2F;code&gt; of &lt;code&gt;1000&lt;&#x2F;code&gt;would lower the number to ~&lt;code&gt;5800&lt;&#x2F;code&gt; lookups, &lt;code&gt;41%&lt;&#x2F;code&gt; of the original.&lt;&#x2F;li&gt;
&lt;li&gt;A &lt;code&gt;penalty&lt;&#x2F;code&gt; of &lt;code&gt;2000&lt;&#x2F;code&gt;would lower the number to ~&lt;code&gt;3700&lt;&#x2F;code&gt; lookups, &lt;code&gt;26%&lt;&#x2F;code&gt; of the original.&lt;&#x2F;li&gt;
&lt;li&gt;A &lt;code&gt;penalty&lt;&#x2F;code&gt; of &lt;code&gt;3000&lt;&#x2F;code&gt;would lower the number to ~&lt;code&gt;2700&lt;&#x2F;code&gt; lookups, &lt;code&gt;20%&lt;&#x2F;code&gt; of the original.&lt;&#x2F;li&gt;
&lt;li&gt;A &lt;code&gt;penalty&lt;&#x2F;code&gt; of &lt;code&gt;4000&lt;&#x2F;code&gt;would lower the number to ~&lt;code&gt;2100&lt;&#x2F;code&gt; lookups, &lt;code&gt;15%&lt;&#x2F;code&gt; of the original.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;There exists a roofing function for the &lt;code&gt;penalty&lt;&#x2F;code&gt;. Since the &lt;code&gt;penalty&lt;&#x2F;code&gt; is deducted from &lt;code&gt;gas&lt;&#x2F;code&gt;, that means that a malicious contract can always invoke a malicious relay to perform the trie lookup. Let&#x27;s refer to this as the &#x27;shielded relay&#x27; attack.&lt;&#x2F;p&gt;
&lt;p&gt;In such a scenario, the &lt;code&gt;malicious&lt;&#x2F;code&gt; would spend &lt;code&gt;~750&lt;&#x2F;code&gt; gas each call to &lt;code&gt;relay&lt;&#x2F;code&gt;, and would need to provide the &lt;code&gt;relay&lt;&#x2F;code&gt; with at least &lt;code&gt;700&lt;&#x2F;code&gt; gas to do a trie access.&lt;&#x2F;p&gt;
&lt;p&gt;Thus, the effective &lt;code&gt;cost&lt;&#x2F;code&gt; would be on the order of &lt;code&gt;1500&lt;&#x2F;code&gt;. It can thus be argued that &lt;code&gt;penalty&lt;&#x2F;code&gt; above &lt;code&gt;~800&lt;&#x2F;code&gt; would not achieve better protection against trie-miss attacks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP requires a hard-fork.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;ether-transfers&quot;&gt;Ether transfers&lt;&#x2F;h3&gt;
&lt;p&gt;A regular &lt;code&gt;transaction&lt;&#x2F;code&gt; from one EOA to another, with value, is not affected.&lt;&#x2F;p&gt;
&lt;p&gt;A &lt;code&gt;transaction&lt;&#x2F;code&gt; with &lt;code&gt;0&lt;&#x2F;code&gt; value, to a destination which does not exist, would be. This scenario is highly unlikely to matter, since such a &lt;code&gt;transaction&lt;&#x2F;code&gt; is useless -- even during success, all it would accomplish would be to spend some &lt;code&gt;gas&lt;&#x2F;code&gt;. With this EIP, it would potentially spend some more gas.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;layer-2&quot;&gt;Layer 2&lt;&#x2F;h3&gt;
&lt;p&gt;Regarding layer-2 backward compatibility, this EIP is a lot less disruptive than EIPs which modify the &lt;code&gt;base&lt;&#x2F;code&gt; cost of an opcode. For state accesses, there are
seldom legitimate scenarios where&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;A contract checks &lt;code&gt;BALANCE&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; of another contract &lt;code&gt;b&lt;&#x2F;code&gt;, &lt;em&gt;and&lt;&#x2F;em&gt;,&lt;&#x2F;li&gt;
&lt;li&gt;If such &lt;code&gt;b&lt;&#x2F;code&gt; does not exist, continues the execution&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h4 id=&quot;solidity-remote-calls&quot;&gt;Solidity remote calls&lt;&#x2F;h4&gt;
&lt;p&gt;Example: When a remote call is made in Solidity:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    recipient.invokeMethod(1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;Solidity does a pre-flight &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; on &lt;code&gt;recipient&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If the pre-flight check returns &lt;code&gt;0&lt;&#x2F;code&gt;, then &lt;code&gt;revert(0,0)&lt;&#x2F;code&gt; is executed, to stop the execution.&lt;&#x2F;li&gt;
&lt;li&gt;If the pre-flight check returns non-zero, then the execution continues and the &lt;code&gt;CALL&lt;&#x2F;code&gt; is made.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;With this EIP in place, the &#x27;happy-path&#x27; would work as previously, and the &#x27;notorious&#x27;-path where &lt;code&gt;recipient&lt;&#x2F;code&gt; does not exist would cost an extra &lt;code&gt;penalty&lt;&#x2F;code&gt; gas, but the actual execution-flow would be unchanged.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;erc223&quot;&gt;ERC223&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;223&quot;&gt;ERC223 Token Standard&lt;&#x2F;a&gt; is, at the time of writing, marked as &#x27;Draft&#x27;, but is deployed and in use on mainnet today.&lt;&#x2F;p&gt;
&lt;p&gt;The ERC specifies that when a token &lt;code&gt;transfer(_to,...)&lt;&#x2F;code&gt; method is invoked, then:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;This function must transfer tokens and invoke the function &lt;code&gt;tokenFallback (address, uint256, bytes)&lt;&#x2F;code&gt; in &lt;code&gt;_to&lt;&#x2F;code&gt;, if &lt;code&gt;_to&lt;&#x2F;code&gt; is a contract.
...
NOTE: The recommended way to check whether the &lt;code&gt;_to&lt;&#x2F;code&gt; is a contract or an address is to assemble the code of &lt;code&gt;_to&lt;&#x2F;code&gt;. If there is no code in &lt;code&gt;_to&lt;&#x2F;code&gt;, then this is an externally owned address, otherwise it&#x27;s a contract.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;The reference implementations from &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;Dexaran&#x2F;ERC223-token-standard&#x2F;tree&#x2F;development&#x2F;token&#x2F;ERC223&quot;&gt;Dexaran&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;OpenZeppelin&#x2F;openzeppelin-contracts&#x2F;blob&#x2F;1bc923b6a222e79a90f20305a459b0ee779eb918&#x2F;contracts&#x2F;token&#x2F;ERC721&#x2F;ERC721.sol#L499&quot;&gt;OpenZeppelin&lt;&#x2F;a&gt; both implement the &lt;code&gt;isContract&lt;&#x2F;code&gt; check using an &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; invocation.&lt;&#x2F;p&gt;
&lt;p&gt;This scenario &lt;em&gt;could&lt;&#x2F;em&gt; be affected, but in practice should not be. Let&#x27;s consider the possibilities:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The &lt;code&gt;_to&lt;&#x2F;code&gt; is a contract: Then &lt;code&gt;ERC223&lt;&#x2F;code&gt; specifies that the function &lt;code&gt;tokenFallback(...)&lt;&#x2F;code&gt; is invoked.
&lt;ul&gt;
&lt;li&gt;The gas expenditure for that call is at least&lt;code&gt;700&lt;&#x2F;code&gt; gas.&lt;&#x2F;li&gt;
&lt;li&gt;In order for the &lt;code&gt;callee&lt;&#x2F;code&gt; to be able to perform any action, best practice it to ensure that it has at least &lt;code&gt;2300&lt;&#x2F;code&gt; gas along with the call.&lt;&#x2F;li&gt;
&lt;li&gt;In summary: this path requires there to be least &lt;code&gt;3000&lt;&#x2F;code&gt; extra gas available (which is not due to any &lt;code&gt;penalty&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;_to&lt;&#x2F;code&gt; exists, but is no contract. The flow exits here, and is not affected by this EIP&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;_to&lt;&#x2F;code&gt; does not exist: A &lt;code&gt;penalty&lt;&#x2F;code&gt; is deducted.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;In summary, it would seem that &lt;code&gt;ERC223&lt;&#x2F;code&gt; should not be affected, as long as the &lt;code&gt;penalty&lt;&#x2F;code&gt; does not go above around &lt;code&gt;3000&lt;&#x2F;code&gt; gas.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;other&quot;&gt;Other&lt;&#x2F;h3&gt;
&lt;p&gt;The contract &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;etherscan.io&#x2F;address&#x2F;0x08d32b0da63e2c3bcf8019c9c5d849d7a9d791e6#code&quot;&gt;&lt;code&gt;Dentacoin&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; would be affected.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function transfer(address _to, uint256 _value) returns (bool success) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ... &#x2F;&#x2F; omitted for brevity&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        if (balances[msg.sender] &amp;gt;= _value &amp;amp;&amp;amp; balances[_to] + _value &amp;gt; balances[_to]) {               &#x2F;&#x2F; Check if sender has enough and for overflows&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            balances[msg.sender] = safeSub(balances[msg.sender], _value);   &#x2F;&#x2F; Subtract DCN from the sender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if (msg.sender.balance &amp;gt;= minBalanceForAccounts &amp;amp;&amp;amp; _to.balance &amp;gt;= minBalanceForAccounts) {    &#x2F;&#x2F; Check if sender can pay gas and if recipient could&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                balances[_to] = safeAdd(balances[_to], _value);             &#x2F;&#x2F; Add the same amount of DCN to the recipient&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                Transfer(msg.sender, _to, _value);                          &#x2F;&#x2F; Notify anyone listening that this transfer took place&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                return true;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            } else {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                balances[this] = safeAdd(balances[this], DCNForGas);        &#x2F;&#x2F; Pay DCNForGas to the contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                balances[_to] = safeAdd(balances[_to], safeSub(_value, DCNForGas));  &#x2F;&#x2F; Recipient balance -DCNForGas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                Transfer(msg.sender, _to, safeSub(_value, DCNForGas));      &#x2F;&#x2F; Notify anyone listening that this transfer took place&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                if(msg.sender.balance &amp;lt; minBalanceForAccounts) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    if(!msg.sender.send(gasForDCN)) throw;                  &#x2F;&#x2F; Send eth to sender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                if(_to.balance &amp;lt; minBalanceForAccounts) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    if(!_to.send(gasForDCN)) throw;                         &#x2F;&#x2F; Send eth to recipient&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        } else { throw; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The contract checks &lt;code&gt;_to.balance &amp;gt;= minBalanceForAccounts&lt;&#x2F;code&gt;, and if the &lt;code&gt;balance&lt;&#x2F;code&gt; is too low, some &lt;code&gt;DCN&lt;&#x2F;code&gt; is converted to &lt;code&gt;ether&lt;&#x2F;code&gt; and sent to the &lt;code&gt;_to&lt;&#x2F;code&gt;. This is a mechanism to ease on-boarding, whereby a new user who has received some &lt;code&gt;DCN&lt;&#x2F;code&gt; can immediately create a transaction.&lt;&#x2F;p&gt;
&lt;p&gt;Before this EIP:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;When sending &lt;code&gt;DCN&lt;&#x2F;code&gt; to a non-existing address, the additional &lt;code&gt;gas&lt;&#x2F;code&gt; expenditure would be:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;9000&lt;&#x2F;code&gt; for an ether-transfer&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;25000&lt;&#x2F;code&gt; for a new account-creation&lt;&#x2F;li&gt;
&lt;li&gt;(&lt;code&gt;2300&lt;&#x2F;code&gt; would be refunded to the caller later)&lt;&#x2F;li&gt;
&lt;li&gt;A total runtime &lt;code&gt;gas&lt;&#x2F;code&gt;-cost of &lt;code&gt;34K&lt;&#x2F;code&gt; gas would be required to handle this case.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;After this EIP:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;In addition to the &lt;code&gt;34K&lt;&#x2F;code&gt; an additional &lt;code&gt;penalty&lt;&#x2F;code&gt; would be added.
&lt;ul&gt;
&lt;li&gt;Possibly two, since the reference implementation does the balance-check twice, but it&#x27;s unclear whether the compiled code would indeed perform the check twice.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;A total runtime &lt;code&gt;gas&lt;&#x2F;code&gt;-cost of &lt;code&gt;34K+penalty&lt;&#x2F;code&gt; (or &lt;code&gt;34K + 2 * penalty&lt;&#x2F;code&gt;) would be required to handle this case.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;It can be argued that the extra penalty of &lt;code&gt;2-3K&lt;&#x2F;code&gt; gas can be considered marginal in relation to the other &lt;code&gt;34K&lt;&#x2F;code&gt; gas already required to handle this.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;The following cases need to be considered and tested:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;That during creation of a brand new contract, within the constructor, the &lt;code&gt;penalty&lt;&#x2F;code&gt; should not be applied for calls concerning the self-address.&lt;&#x2F;li&gt;
&lt;li&gt;TBD: How the &lt;code&gt;penalty&lt;&#x2F;code&gt; is applied in the case of a contract which has performed a &lt;code&gt;selfdestruct&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;a) previously in the same call-context,&lt;&#x2F;li&gt;
&lt;li&gt;b) previously in the same transaction,&lt;&#x2F;li&gt;
&lt;li&gt;c) previously in the same block,
For any variant of &lt;code&gt;EXTCODEHASH(destructed)&lt;&#x2F;code&gt;, &lt;code&gt;CALL(destructed)&lt;&#x2F;code&gt;, &lt;code&gt;CALLCODE(destructed)&lt;&#x2F;code&gt; etc.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The effects on a &lt;code&gt;transaction&lt;&#x2F;code&gt; with &lt;code&gt;0&lt;&#x2F;code&gt; value going to a non-existent account.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;See &#x27;Backwards Compatibility&#x27;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Not yet available.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;alternative-variants&quot;&gt;Alternative variants&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;alt-1-insta-refunds&quot;&gt;Alt 1: Insta-refunds&lt;&#x2F;h3&gt;
&lt;p&gt;Bump all trie accesses with &lt;code&gt;penalty&lt;&#x2F;code&gt;. &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; becomes &lt;code&gt;2700&lt;&#x2F;code&gt; instead of &lt;code&gt;700&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If a trie access hit an existing item, immediately refund penalty (&lt;code&gt;2K&lt;&#x2F;code&gt; )&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Upside:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;This eliminates the &#x27;shielded relay&#x27; attack&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Downside:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;This increases the up-front cost of many ops (CALL&#x2F;EXTCODEHASH&#x2F;EXTCODESIZE&#x2F;STATICCALL&#x2F;EXTCODESIZE etc)
&lt;ul&gt;
&lt;li&gt;Which may break many contracts.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;alt-2-parent-bail&quot;&gt;Alt 2: Parent bail&lt;&#x2F;h3&gt;
&lt;p&gt;Use &lt;code&gt;penalty&lt;&#x2F;code&gt; as described, but if a child context goes OOG on the &lt;code&gt;penalty&lt;&#x2F;code&gt;, then the remainder is subtracted from the
parent context (recursively).&lt;&#x2F;p&gt;
&lt;p&gt;Upside:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;This eliminates the &#x27;shielded relay&#x27; attack&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Downside:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;This breaks the current invariant that a child context is limited by whatever &lt;code&gt;gas&lt;&#x2F;code&gt; was allocated for it.
&lt;ul&gt;
&lt;li&gt;However, the invariant is not &lt;em&gt;totally&lt;&#x2F;em&gt; thrown out, the new invariant becomes that it is limited to &lt;code&gt;gas + penalty&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;This can be seen as &#x27;messy&#x27; -- since only &lt;em&gt;some&lt;&#x2F;em&gt; types of OOG (penalties) becomes passed up the call chain, but not others, e.g. OOG due to trying
to allocate too much memory. There is a distinction, however:
&lt;ul&gt;
&lt;li&gt;Gas-costs which arise due to not-yet-consumed resources do not get passed to parent. For example: a huge allocation is not actually performed if there is insufficient gas.&lt;&#x2F;li&gt;
&lt;li&gt;Whereas gas-costs which arise due to already-consumed resources &lt;em&gt;do&lt;&#x2F;em&gt; get passed to parent; in this case the penalty is paid post-facto for a trie iteration.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>ENSLogin</title>
        <published>2020-02-19T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Hadrien Croubois</name><uri>https://github.com/amxx</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2525/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/discussion-ens-login/3569" />
        

        <id>https://wg-eips.ritovision.com/2525/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:2525"
            label="ERC-2525" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2525/">&lt;h2 id=&quot;1-abstract&quot;&gt;1. Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This presents a method to improve a universal method of login to the ethereum blockchain, leveraging the metadata storage provided by the ENS. We consider a user to be logged in when we have an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1193&#x2F;&quot;&gt;EIP-1193&lt;&#x2F;a&gt; provider that can sign transaction and messages on his behalf. This method is inspired by &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=1LVwWknE-NQ&quot;&gt;Alex Van de Sande&#x27;s work&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;web3connect.com&quot;&gt;Web3Connect&lt;&#x2F;a&gt;. In the future, the approach described here-after should be extended to work with any blockchain.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;2-motivation&quot;&gt;2. Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Multiple wallet solutions can be used to interact with the Ethereum blockchain. Some (metamask, gnosis, ...) are compatible as they inject a standardized wallet object in the browser without requiring any effort from the Dapp developers, but they require an effort on the user side (user has to install the plugin). Other solutions (Portis, Authereum, Torus, Universal Login, ...) propose a more seamless flow to non-crypto-aware users but require an integration effort from the Dapp developers. Hardware wallet (ledger, trezor, keepkey, ...) also require integration effort from the Dapp developers.&lt;&#x2F;p&gt;
&lt;p&gt;When Dapps integrate login with multiple solutions, they rely on the user choosing the correct wallet-provider. This could prove increasingly difficult as the number of wallet-provider increases, particularly for novice users. Additionally, if decentralized applications pick and choose only a handful of wallets to support, the current incumbent wallets will have a distinct advantage and new wallets will struggle to find adoption. This will create a less competitive environment and stifle innovation. Rather than relying on the user choosing which wallet-provider to connect with (as does Web3Connect), ENSLogin proposes to use user-owned ENS domain as entry points. Metadata attached to these ENS domains is used to detect which wallet-provider if used by the corresponding account.&lt;&#x2F;p&gt;
&lt;p&gt;That way, ENSLogin would allow any user to connect to any Dapp with any wallet, using a simple domain as a login.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;3-description&quot;&gt;3. Description&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;3-1-overview&quot;&gt;3.1. Overview&lt;&#x2F;h3&gt;
&lt;p&gt;The ENSLogin works as follow:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Request an ENS domain from the user&lt;&#x2F;li&gt;
&lt;li&gt;Resolve the ENS domain to retrieve (see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;137&#x2F;&quot;&gt;EIP-137&lt;&#x2F;a&gt;)
&lt;ul&gt;
&lt;li&gt;An address (see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;137&#x2F;&quot;&gt;EIP-137&lt;&#x2F;a&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;A text entry (see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;634&#x2F;&quot;&gt;EIP-634&lt;&#x2F;a&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Interpret the text entry and download the file it points to&lt;&#x2F;li&gt;
&lt;li&gt;Evaluate the content of the downloaded file&lt;&#x2F;li&gt;
&lt;li&gt;Return the corresponding object to the Dapp&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;At this point, the app should process like with any web3 provider. Calling the &lt;code&gt;enable()&lt;&#x2F;code&gt; functions should ask the users for wallet specific credentials is needed.&lt;&#x2F;p&gt;
&lt;p&gt;This workflow is to be implemented by an SDK that Dapp could easily import. The SDK would contain the resolution mechanism and support for both centralized and decentralized storage solution. Wallet-provider specific code should NOT be part of SDK. Wallet-provider specific code should only be present in the external file used to generate the web3 provider.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;3-2-details&quot;&gt;3.2. Details&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Text entry resolution:&lt;&#x2F;strong&gt; A pointer to the code needed to instantiate the wallet-provider is recorded using the ENS support for text entries (see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;634&#x2F;&quot;&gt;EIP-634&lt;&#x2F;a&gt;). The corresponding key is &lt;code&gt;enslogin&lt;&#x2F;code&gt; (&lt;strong&gt;subject to change&lt;&#x2F;strong&gt;). If no value is associated with the key &lt;code&gt;enslogin&lt;&#x2F;code&gt; at the targeted domain, we fallback to metadata store on the parent&#x27;s node with the key &lt;code&gt;enslogin-default&lt;&#x2F;code&gt; (&lt;strong&gt;subject to change&lt;&#x2F;strong&gt;).
&lt;strong&gt;Example:&lt;&#x2F;strong&gt; for the ens domain &lt;code&gt;username.domain.eth&lt;&#x2F;code&gt;, the resolution would look for (in order):&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;resolver.at(ens.owner(nodehash(&quot;username.domain.eth&quot;))).text(nodehash(&quot;username.domain.eth&quot;), &#x27;enslogin&#x27;)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;resolver.at(ens.owner(nodehash(&quot;domain.eth&quot;))).text(nodehash(&quot;domain.eth&quot;), &#x27;enslogin-default&#x27;)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Provider link:&lt;&#x2F;strong&gt; Code for instantiating the wallet-provider must be pointed to in a standardized manner. &lt;strong&gt;This is yet not specified.&lt;&#x2F;strong&gt; The current approach uses a human-readable format &lt;code&gt;scheme:&#x2F;&#x2F;path&lt;&#x2F;code&gt; such as:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;ipfs:&#x2F;&#x2F;Qm12345678901234567890123456789012345678901234&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;https:&#x2F;&#x2F;server.com&#x2F;enslogin-module-someprovider&lt;&#x2F;code&gt;
And adds a suffix depending on the targeted blockchain type (see &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;satoshilabs&#x2F;slips&#x2F;blob&#x2F;master&#x2F;.&#x2F;00044.md&quot;&gt;SLIP 44&lt;&#x2F;a&gt;) and language. Canonical case is a webapp using ethereum so the target would be:&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;ipfs:&#x2F;&#x2F;Qm12345678901234567890123456789012345678901234&#x2F;60&#x2F;js&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;https:&#x2F;&#x2F;server.com&#x2F;enslogin-module-someprovider&#x2F;60&#x2F;js&lt;&#x2F;code&gt;
Note that this suffix mechanism is compatible with http&#x2F;https as well as IPFS. It is a constraint on the storage layer as some may not be able to do this kind of resolution.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Provider instantiation:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;[JAVASCRIPT&#x2F;ETHEREUM] The file containing the wallet-provider&#x27;s code should inject a function &lt;code&gt;global.provider: (config) =&amp;gt; Promise&amp;lt;web3provider&amp;gt;&lt;&#x2F;code&gt; that returns a promise to a standardized provider object. For EVM blockchains, the object should follow &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1193&#x2F;&quot;&gt;EIP-1193&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Other blockchain types&#x2F;langages should be detailed in the future.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Configuration object:&lt;&#x2F;strong&gt; In addition to the username (ENS domain), the Dapp should have the ability to pass a configuration object that could be used by the wallet-provider instantiating function. This configuration should include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A body (common to all provider) that specify details about the targeted chain (network name &#x2F; node, address of the ens entrypoint ...). If any of these are missing, a fallback can be used (mainnet as a default network, bootstrapping an in-browser IPFS node, ...).&lt;&#x2F;li&gt;
&lt;li&gt;Wallet provider-specific fields (&lt;strong&gt;optional&lt;&#x2F;strong&gt;, starting with one underscore &lt;code&gt;_&lt;&#x2F;code&gt;) can be added to pass additional, wallet-provider specific, parameters &#x2F; debugging flags.&lt;&#x2F;li&gt;
&lt;li&gt;SDK specific fields (&lt;strong&gt;optional&lt;&#x2F;strong&gt;, starting with two underscores &lt;code&gt;__&lt;&#x2F;code&gt;) can be used to pass additional arguments.
Minimal configuration:&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	provider: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		network: &amp;#39;goerli&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Example of advanced configuration object:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	provider: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		network: &amp;#39;goerli&amp;#39;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		ens:     &amp;#39;0x112234455c3a32fd11230c42e7bccd4a84e02010&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	},&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	ipfs: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		host: &amp;#39;ipfs.infura.io&amp;#39;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		port: 5001,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		protocol: &amp;#39;https&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	},&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	_authereum: {...},&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	_portis: {...},&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	_unilogin: {...},&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	_torus: {...},&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	__callbacks: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		resolved: (username, addr, descr) =&amp;gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			console.log(`[CALLBACKS] resolved: ${username} ${addr} ${descr}`);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		},&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		loading: (protocol, path) =&amp;gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			console.log(`[CALLBACKS] loading: ${protocol} ${path}`);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		},&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		loaded: (protocol, path) =&amp;gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			console.log(`[CALLBACKS] loaded: ${protocol} ${path}`);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;TODO&lt;&#x2F;strong&gt; &lt;em&gt;(maybe move that part to section 6.1)&lt;&#x2F;em&gt;:
Add &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;satoshilabs&#x2F;slips&#x2F;blob&#x2F;master&#x2F;.&#x2F;00044.md&quot;&gt;SLIP 44&lt;&#x2F;a&gt; compliant blockchain description to the config for better multichain support. This will require a additional field &lt;code&gt;ENS network&lt;&#x2F;code&gt; to know which ethereum network to use for resolution when the targeted blockchain&#x2F;network is not ethereum (could also be used for cross chain resolution on ethereum, for example xDAI login with metadata stored on mainnet)&lt;&#x2F;p&gt;
&lt;h3 id=&quot;3-3-decentralization&quot;&gt;3.3. Decentralization&lt;&#x2F;h3&gt;
&lt;p&gt;Unlike solution like Web3Connect, ENSLogin proposes a modular approach that is decentralized by nature.
The code needed for a Dapp to use ENSLogin (hereafter referred to as the SDK) only contains lookup mechanism for the ethereum blockchain and the data storages solutions. The solution is limited by the protocols (https &#x2F; ipfs &#x2F; ...) that the SDK can interact with. Beyond that, any wallet-provider that follows the expected structure and that is available through one of the supported protocol is automatically compatible with all the Dapps proposing ENSLogin support. There is no need to go through a centralized approval process. Furthermore, deployed SDK do not need to be upgraded to benefit from the latest wallet updates. The only permissioned part of the protocol is in the ENS control of the users over the metadata that describes their wallet-provider implementation. Users could also rely on the fallback mechanism to have the wallet-provider update it for them.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;3-4-incentives&quot;&gt;3.4. Incentives&lt;&#x2F;h3&gt;
&lt;p&gt;We believe ENSLogin&#x27;s biggest strength is the fact that it aligns the incentives of Dapp developers and wallet-providers to follow this standard.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A wallet-provider that implements the required file and make them available will ensure the compatibility of its wallet with all Dapps using ENSLogin. This will remove the burden of asking all Dapps to integrate their solutions, which Dapps are unlikely to do until the wallet as strong userbase. Consequently, ENSLogin will improve the competition between wallet-providers and encourage innovation in that space&lt;&#x2F;li&gt;
&lt;li&gt;A Dapp that uses ENSLogin protocol, either by including the ENSLogin&#x27;s SDK or by implementing compatible behaviour, will make itself available to all the users of all the compatible wallet. At some point, being compatible with ENSLogin will be the easiest to reach a large user-base.&lt;&#x2F;li&gt;
&lt;li&gt;ENSLogin should be mostly transparent for the users. Most wallet provider will set up the necessary entries without requiring any effort from the user. Advanced users can take control over the wallet resolution process, which will be simple once the right tooling is available.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;3-5-drawbacks&quot;&gt;3.5. Drawbacks&lt;&#x2F;h3&gt;
&lt;p&gt;While ENSLogin allows dapps to support any wallet for logging in, dapps still must choose which wallets they suggest to users for registration. This can be done through a component like Web3Connect or BlockNative&#x27;s&lt;&#x2F;p&gt;
&lt;h2 id=&quot;4-prototype&quot;&gt;4. Prototype&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;TODO&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;5-support-by-the-community&quot;&gt;5. Support by the community&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;5-1-adoption&quot;&gt;5.1. Adoption&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Live&lt;&#x2F;th&gt;&lt;th&gt;Module&lt;&#x2F;th&gt;&lt;th&gt;Assigns ENS names&lt;&#x2F;th&gt;&lt;th&gt;support by default&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Argent&lt;&#x2F;td&gt;&lt;td&gt;yes&lt;&#x2F;td&gt;&lt;td&gt;no&lt;&#x2F;td&gt;&lt;td&gt;yes&lt;&#x2F;td&gt;&lt;td&gt;no&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Authereum&lt;&#x2F;td&gt;&lt;td&gt;yes&lt;&#x2F;td&gt;&lt;td&gt;yes&lt;&#x2F;td&gt;&lt;td&gt;yes&lt;&#x2F;td&gt;&lt;td&gt;no&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Fortmatic&lt;&#x2F;td&gt;&lt;td&gt;yes&lt;&#x2F;td&gt;&lt;td&gt;no&lt;&#x2F;td&gt;&lt;td&gt;no&lt;&#x2F;td&gt;&lt;td&gt;no&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Gnosis Safe&lt;&#x2F;td&gt;&lt;td&gt;yes&lt;&#x2F;td&gt;&lt;td&gt;yes*&lt;&#x2F;td&gt;&lt;td&gt;no&lt;&#x2F;td&gt;&lt;td&gt;no&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Ledger&lt;&#x2F;td&gt;&lt;td&gt;yes&lt;&#x2F;td&gt;&lt;td&gt;beta&lt;&#x2F;td&gt;&lt;td&gt;no&lt;&#x2F;td&gt;&lt;td&gt;no&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;KeepKey&lt;&#x2F;td&gt;&lt;td&gt;yes&lt;&#x2F;td&gt;&lt;td&gt;no&lt;&#x2F;td&gt;&lt;td&gt;no&lt;&#x2F;td&gt;&lt;td&gt;no&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Metamask&lt;&#x2F;td&gt;&lt;td&gt;yes&lt;&#x2F;td&gt;&lt;td&gt;yes&lt;&#x2F;td&gt;&lt;td&gt;no&lt;&#x2F;td&gt;&lt;td&gt;no&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Opera&lt;&#x2F;td&gt;&lt;td&gt;yes&lt;&#x2F;td&gt;&lt;td&gt;yes*&lt;&#x2F;td&gt;&lt;td&gt;no&lt;&#x2F;td&gt;&lt;td&gt;no&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Portis&lt;&#x2F;td&gt;&lt;td&gt;yes&lt;&#x2F;td&gt;&lt;td&gt;yes&lt;&#x2F;td&gt;&lt;td&gt;no&lt;&#x2F;td&gt;&lt;td&gt;no&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;SquareLink&lt;&#x2F;td&gt;&lt;td&gt;yes&lt;&#x2F;td&gt;&lt;td&gt;no&lt;&#x2F;td&gt;&lt;td&gt;no&lt;&#x2F;td&gt;&lt;td&gt;no&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Shipl&lt;&#x2F;td&gt;&lt;td&gt;no&lt;&#x2F;td&gt;&lt;td&gt;no&lt;&#x2F;td&gt;&lt;td&gt;no&lt;&#x2F;td&gt;&lt;td&gt;no&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Torus&lt;&#x2F;td&gt;&lt;td&gt;yes&lt;&#x2F;td&gt;&lt;td&gt;yes&lt;&#x2F;td&gt;&lt;td&gt;no&lt;&#x2F;td&gt;&lt;td&gt;no&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Trezor&lt;&#x2F;td&gt;&lt;td&gt;yes&lt;&#x2F;td&gt;&lt;td&gt;no&lt;&#x2F;td&gt;&lt;td&gt;no&lt;&#x2F;td&gt;&lt;td&gt;no&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;UniLogin&lt;&#x2F;td&gt;&lt;td&gt;beta&lt;&#x2F;td&gt;&lt;td&gt;beta&lt;&#x2F;td&gt;&lt;td&gt;yes&lt;&#x2F;td&gt;&lt;td&gt;no&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;*use the metamask module&lt;&#x2F;p&gt;
&lt;h2 id=&quot;6-possible-evolutions&quot;&gt;6. Possible evolutions&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;6-1-multichain-support&quot;&gt;6.1. Multichain support&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;TODO&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;7-faq&quot;&gt;7. FAQ&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;7-1-can-anyone-connect-with-my-login-where-are-my-private-keys-stored&quot;&gt;7.1. Can anyone connect with my login? Where are my private keys stored?&lt;&#x2F;h3&gt;
&lt;p&gt;ENSLogin only has access to what is recorded on the ENS, namely your address and the provider you use. Private key management is a is handled by the provider and is outside ENSLogin&#x27;s scope. Some might store the key on disk. Other might rely on custodial keys stored on a remote (hopefully secure) server. Others might use a dedicated hardware component to handle signature and never directly have access to the private key.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;7-2-how-do-i-get-an-ens-login&quot;&gt;7.2. How do I get an ENS Login?&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;TODO&lt;&#x2F;strong&gt; (this might need a separate ERC)&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Multiple contenthash records for ENS</title>
        <published>2020-02-18T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Filip Štamcar</name><uri>https://github.com/filips123</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2520/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/2393" />
        

        <id>https://wg-eips.ritovision.com/2520/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:2520"
            label="ERC-2520" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2520/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;ENS support for multiple &lt;code&gt;contenthash&lt;&#x2F;code&gt; records on a single ENS name.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Many applications are resolving ENS names to content hosted on distributed systems. To do this, they use &lt;code&gt;contenthash&lt;&#x2F;code&gt; record from ENS domain to know how to resolve names and which distributed system should be used.&lt;&#x2F;p&gt;
&lt;p&gt;However, the domain can store only one &lt;code&gt;contenthash&lt;&#x2F;code&gt; record which means that the site owner needs to decide which hosting system to use. Because there are many ENS-compatible hosting systems available (IPFS, Swarm, recently Onion and ZeroNet), and there will probably be even more in the future, lack of support for multiple records could become problematic. Instead, domains should be able to store multiple &lt;code&gt;contenthash&lt;&#x2F;code&gt; records to allow applications to resolve to multiple hosting systems.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Setting and getting functions &lt;strong&gt;MUST&lt;&#x2F;strong&gt; have the same public interface as specified in EIP 1577. Additionally, they &lt;strong&gt;MUST&lt;&#x2F;strong&gt; also have new public interfaces introduced by this EIP:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;For setting a &lt;code&gt;contenthash&lt;&#x2F;code&gt; record, the &lt;code&gt;setContenthash&lt;&#x2F;code&gt; &lt;strong&gt;MUST&lt;&#x2F;strong&gt; provide additional &lt;code&gt;proto&lt;&#x2F;code&gt; parameter and use it to save the &lt;code&gt;contenthash&lt;&#x2F;code&gt;. When &lt;code&gt;proto&lt;&#x2F;code&gt; is not provided, it &lt;strong&gt;MUST&lt;&#x2F;strong&gt; save the record as default record.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setContenthash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; proto&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; authorised&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;node&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;For getting a &lt;code&gt;contenthash&lt;&#x2F;code&gt; record, the &lt;code&gt;contenthash&lt;&#x2F;code&gt; &lt;strong&gt;MUST&lt;&#x2F;strong&gt; provide additional &lt;code&gt;proto&lt;&#x2F;code&gt; parameter and use it to get the &lt;code&gt;contenthash&lt;&#x2F;code&gt; for requested type. When &lt;code&gt;proto&lt;&#x2F;code&gt; is not provided, it &lt;strong&gt;MUST&lt;&#x2F;strong&gt; return the default record.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; contenthash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; proto&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Resolver that supports multiple &lt;code&gt;contenthash&lt;&#x2F;code&gt; records &lt;strong&gt;MUST&lt;&#x2F;strong&gt; return &lt;code&gt;true&lt;&#x2F;code&gt; for &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; with interface ID &lt;code&gt;0x6de03e07&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Applications that are using ENS &lt;code&gt;contenthash&lt;&#x2F;code&gt; records &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; handle them in the following way:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;If the application only supports one hosting system (like directly handling ENS from IPFS&#x2F;Swarm gateways), it &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; request &lt;code&gt;contenthash&lt;&#x2F;code&gt; with a specific type. The contract &lt;strong&gt;MUST&lt;&#x2F;strong&gt; then return it and application &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; correctly handle it.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;If the application supports multiple hosting systems (like MetaMask), it &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; request &lt;code&gt;contenthash&lt;&#x2F;code&gt; without a specific type (like in EIP 1577). The contract &lt;strong&gt;MUST&lt;&#x2F;strong&gt; then return the default &lt;code&gt;contenthash&lt;&#x2F;code&gt; record.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The proposed implementation was chosen because it is simple to implement and supports all important requested features. However, it doesn&#x27;t support multiple records for the same type and priority order, as they don&#x27;t give much advantage and are harder to implement properly.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The EIP is backwards-compatible with EIP 1577, the only differences are additional overloaded methods. Old applications will still be able to function correctly, as they will receive the default &lt;code&gt;contenthash&lt;&#x2F;code&gt; record.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ContentHashResolver&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; MULTI_CONTENT_HASH_INTERFACE_ID &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x6de03e07&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; hashes&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setContenthash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; proto&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        hashes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;proto&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; hash&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ContenthashChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; hash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; contenthash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; proto&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; hashes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;proto&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; interfaceID &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; MULTI_CONTENT_HASH_INTERFACE_ID&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Implement Difficulty Freeze</title>
        <published>2020-02-10T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>James Hancock</name><uri>https://github.com/madeoftin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2515/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2515-replace-the-difficulty-bomb-with-a-difficulty-freeze/3995" />
        

        <id>https://wg-eips.ritovision.com/2515/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2515"
            label="EIP-2515" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2515/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;The difficulty Freeze is an alternative to the Difficulty Bomb that is implemented within the protocols difficulty adjustment algorithm. The Difficulty Freeze begins at a certain block height, determined in advance, freezes the difficulty and increases by 1% after that block forever. This does not stop the chain, but it incentivizes devs to upgrade at a regular cadence and requires any chain split to address the difficulty freeze.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The difficulty Freeze is a mechanism that is easy to predict and model, and the pressures of missing it are more readily felt by the core developers and client maintainers. The client maintainers are also positioned as the group that is most able to respond to an incoming Difficulty Freeze. This combined with the predictability is more likely to lead to the timely diffusual of the bomb.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The current difficulty bombs&#x27; effect on the Block Time Targeting mechanism is rather complex to model, and it has both appeared when it was not expected (Muir Glacier) and negatively affected miners when they are not the target (in the case of delaying forks due to technical difficulties). Miners are affected by a reduction in block rewards due to the increase in block time. Users are affected as a function of the usability of the chain is affected by increased block times. Both of these groups are unable on their own to address the difficulty bomb. In the case of the Difficulty Freeze, the consequences of missing it are more directly felt by the client maintainers and it is more predictiable and so knowing when to make the change is readily apparent.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Add variable &lt;code&gt;DIFFICULTY_FREEZE_HEIGHT&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The logic of the Difficulty Freeze is defined as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;if (BLOCK_HEIGHT &amp;lt;= DIFFICULTY_FREEZE_HEIGHT):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   block_diff = parent_diff + parent_diff &#x2F;&#x2F; 2048 * max(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                1 - (block_timestamp - parent_timestamp) &#x2F;&#x2F; 10, -99)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;else:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; block_diff = parent_diff + parent_diff * 0.01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Optional Implementation&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Add the variable &lt;code&gt;DIFFICULTY_FREEZE_DIFFERENCE&lt;&#x2F;code&gt; and use the &lt;code&gt;LAST_FORK_HEIGHT&lt;&#x2F;code&gt; to calculate when the Difficulty Freeze would occur.&lt;&#x2F;p&gt;
&lt;p&gt;For example we can set the &lt;code&gt;DFD = 1,800,000 blocks&lt;&#x2F;code&gt; or approximately 9 months. The Difficulty Calculation would then be.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;if (BLOCK_HEIGHT  &amp;lt;= LAST_FORK_HEIGHT + DIFFICULTY_FREEZE_DIFFERENCE) :&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   block_diff = parent_diff + parent_diff &#x2F;&#x2F; 2048 * max(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                1 - (block_timestamp - parent_timestamp) &#x2F;&#x2F; 10, -99)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;else:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; block_diff = parent_diff + parent_diff * 0.01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This approach would have the added benefit that updating the Difficulty Freeze is easier as it happens automatically at the time of every upgrade. The trade-off is that the logic for checking is more complex and would require further analysis and test cases to ensure no consensus bugs arise.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Block height is very easy to predict and evaluate within the system. This removes the effect of the Difficulty Bomb on block time, simplifying the block time targeting mechanism. The addition of an increase in the difficulty was added after feedback that the game theory of the mechanism did not reliably result in .&lt;&#x2F;p&gt;
&lt;p&gt;https:&#x2F;&#x2F;twitter.com&#x2F;quentinc137&#x2F;status&#x2F;1227110578235330562&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward incompatibilities&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The effect of missing the Difficulty Freeze has a different impact than missing the Difficulty Bomb. At the point of a Difficulty freeze, the protocol is no longer able to adapt to changes in hash power on the network. This can lead to one of three scenarios.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The Hash rate Increases:
Block Times would increase on the network for short time until the increase in difficulty is too high for the network to add any more miners.&lt;&#x2F;li&gt;
&lt;li&gt;The Hash rate decreases:
Block times would increase.&lt;&#x2F;li&gt;
&lt;li&gt;The Hash rate stays the same:
A consistent increase in blocktimes.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Clients are motivated to have their client sync fully to the network and so are very motivated to keep this situation from occurring. Simultaneously delaying the Difficulty Freeze is most easily implemented by client teams. Therefore the group that is most negatively affected is also the group that can most efficiently address it.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;economic-considerations&quot;&gt;Economic Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Under the current Difficult, Bomb issuance of ETH is reduced as the Ice Age takes affect. Under the Difficulty Freeze, it is more likely that issuance would increase for a short time; however, clients are motivated to prevent this and keep clients syncing effectively. This means it is much less likely to occur. The increase to the difficulty over time will eventually reduce blocktimes and also issuance.&lt;&#x2F;p&gt;
&lt;p&gt;It is also easy to predict when this change would happen, and stakeholders who are affected (Eth Holders) can keep client developers accountable by observing when the Difficulty Freeze is approaching and yell at them on twitter.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Baby Jubjub Elliptic Curve</title>
        <published>2020-01-29T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Barry WhiteHat</name><uri>https://github.com/barryWhiteHat</uri>
	</author>
	
	<author>
		<name>Marta Bellés</name><uri>https://github.com/bellesmarta</uri>
	</author>
	
	<author>
		<name>Jordi Baylina</name><uri>https://github.com/jbaylina</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2494/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2494-baby-jubjub-elliptic-curve/3968" />
        

        <id>https://wg-eips.ritovision.com/2494/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:2494"
            label="ERC-2494" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2494/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal defines Baby Jubjub, an elliptic curve designed to work inside zk-SNARK circuits in Ethereum.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Two of the main issues behind why blockchain technology is not broadly used by individuals and industry are scalability and privacy guarantees. With a set of cryptographic tools called zero-knowledge proofs (ZKP) it is possible to address both of these problems. More specifically, the most suitable protocols for blockchain are called zk-SNARKs (zero-knowledge Succinct Non-interactive ARguments of Knowledge), as they are non-interactive, have succinct proof size and sublinear verification time. These types of protocols allow proving generic computational statements that can be modelled with arithmetic circuits defined over a finite field (also called zk-SNARK circuits).&lt;&#x2F;p&gt;
&lt;p&gt;To verify a zk-SNARK proof, it is necessary to use an elliptic curve. In Ethereum, the curve is alt_bn128 (also referred as BN254), which has primer order &lt;code&gt;r&lt;&#x2F;code&gt;. With this curve, it is possible to generate and validate proofs of any &lt;code&gt;F_r&lt;&#x2F;code&gt;-arithmetic circuit. This EIP describes &lt;em&gt;Baby Jubjub&lt;&#x2F;em&gt;, an elliptic curve defined over the finite field &lt;code&gt;F_r&lt;&#x2F;code&gt; which can be used inside any zk-SNARK circuit, allowing for the implementation of cryptographic primitives that make use of elliptic curves, such as the Pedersen Hash or the Edwards Digital Signature Algorithm (EdDSA).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;A &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Zero-knowledge_proof&quot;&gt;zero knowledge proof&lt;&#x2F;a&gt; (ZKP) is a protocol that enables one party, the prover, to convince another, the verifier, that a statement is true without revealing any information beyond the veracity of the statement. &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;people.csail.mit.edu&#x2F;silvio&#x2F;Selected%20Scientific%20Papers&#x2F;Zero%20Knowledge&#x2F;Noninteractive_Zero-Knowkedge.pdf&quot;&gt;Non-Interactive ZKPs&lt;&#x2F;a&gt; (NIZK) are a particular type of zero-knowledge proofs in which the prover can generate the proof without interaction with the verifier. NIZK protocols are very suitable for Ethereum applications, because they allow a smart contract to act as a verifier. This way, anyone can generate a proof and send it as part of a transaction to the smart contract, which can perform some action depending on whether the proof is valid or not. In this context, the most preferable NIZK are &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;eprint.iacr.org&#x2F;2013&#x2F;279.pdf&quot;&gt;zk-SNARK&lt;&#x2F;a&gt; (Zero-knowledge Succinct Non Interactive ARgument of Knowledge), a set of non-interactive zero-knowledge protocols that have succinct proof size and sublinear verification time. The importance of these protocols is double: on the one hand, they help improve privacy guarantees, and on the other, they are a possible solution to scalability issues (e.g. see &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;barryWhiteHat&#x2F;roll_up&quot;&gt;zk-Rollup&lt;&#x2F;a&gt; project).&lt;&#x2F;p&gt;
&lt;p&gt;Like most ZKPs, zk-SNARKs permit proving computational statements. For example, one can prove things like: the knowledge of a private key associated with a certain public key, the correct computation of a transaction, or the knowledge of the preimage of a particular hash. Importantly, one can do these things without leaking any information about the statements in question. In other words, without leaking any information about the private key, the transaction details, or the value of the preimage. More specifically, zk-SNARKs permit proving any computational statement that can be modelled with an &lt;code&gt;F_r&lt;&#x2F;code&gt;-arithmetic circuit, a circuit consisting of set of wires that carry values from the field &lt;code&gt;F_r&lt;&#x2F;code&gt; and connect them to addition and multiplication gates &lt;code&gt;mod r&lt;&#x2F;code&gt;. This type of circuits are often called zk-SNARK circuits.&lt;&#x2F;p&gt;
&lt;p&gt;The implementation of most zk-SNARK protocols (e.g. &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;eprint.iacr.org&#x2F;2013&#x2F;279.pdf&quot;&gt;[Pinnochio]&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;eprint.iacr.org&#x2F;2016&#x2F;260.pdf&quot;&gt;[Groth16]&lt;&#x2F;a&gt;) make use of an elliptic curve for validating a proof. In Ethereum, the curve used is alt_bn128 (also referred as BN254), which has prime order &lt;code&gt;r&lt;&#x2F;code&gt;. While it is possible to generate and validate proofs of &lt;code&gt;F_r&lt;&#x2F;code&gt;-arithmetic circuits with BN254, it is not possible to use BN254 to implement elliptic-curve cryptography within these circuits. To implement functions that require the use of elliptic curves inside a zk-SNARK circuit -- such as the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;zcash&#x2F;zips&#x2F;blob&#x2F;master&#x2F;protocol&#x2F;protocol.pdf&quot;&gt;Pedersen Hash&lt;&#x2F;a&gt; or the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;tools.ietf.org&#x2F;html&#x2F;rfc8032&quot;&gt;Edwards Digital Signature Algorithm&lt;&#x2F;a&gt; (EdDSA) -- a new curve with coordinates in &lt;code&gt;F_r&lt;&#x2F;code&gt; is needed. To this end, we propose in this EIP &lt;em&gt;Baby Jubjub&lt;&#x2F;em&gt;, an elliptic curve defined over &lt;code&gt;F_r&lt;&#x2F;code&gt; that can be used inside any &lt;code&gt;F_r&lt;&#x2F;code&gt;-arithmetic circuit. In the next sections we describe in detail the characteristics of the curve, how it was generated, and which security considerations were taken.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    inputs                zk-SNARK (alt_bn128)             output&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            +--------------------------------------------+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            |   +--------------------+                   |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ---&amp;gt;|   | EdDSA (Baby Jubjub)|                   |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            |   +--------------------+                   | &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ---&amp;gt;|                                            |---&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            |          +-----------------------------+   |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ---&amp;gt;|          | Pedersen Hash (Baby Jubjub) |   |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            |          +-----------------------------+   |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            +--------------------------------------------+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;p&gt;Let &lt;code&gt;F_r&lt;&#x2F;code&gt; be the prime finite field with &lt;code&gt;r&lt;&#x2F;code&gt; elements, where&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;r = 21888242871839275222246405745257275088548364400416034343698204186575808495617&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Let &lt;code&gt;E&lt;&#x2F;code&gt; be the twisted Edwards elliptic curve defined over &lt;code&gt;F_r&lt;&#x2F;code&gt; described by equation&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ax^2 + y^2 = 1 + dx^2y^2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;with parameters&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;a = 168700&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;d = 168696&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;We call &lt;strong&gt;Baby Jubjub&lt;&#x2F;strong&gt; the curve &lt;code&gt;E(F_r)&lt;&#x2F;code&gt;, that is, the subgroup of &lt;code&gt;F_r&lt;&#x2F;code&gt;-rational points of &lt;code&gt;E&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;order&quot;&gt;Order&lt;&#x2F;h3&gt;
&lt;p&gt;Baby Jubjub has order&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;n = 21888242871839275222246405745257275088614511777268538073601725287587578984328&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;which factors in&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;n = h x l&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;h = 8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;l = 2736030358979909402780800718157159386076813972158567259200215660948447373041&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The parameter &lt;code&gt;h&lt;&#x2F;code&gt; is called &lt;em&gt;cofactor&lt;&#x2F;em&gt; and &lt;code&gt;l&lt;&#x2F;code&gt; is a prime number of 251 bits.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;generator-point&quot;&gt;Generator Point&lt;&#x2F;h3&gt;
&lt;p&gt;The point &lt;code&gt;G = (x,y)&lt;&#x2F;code&gt; with coordinates&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;x = 995203441582195749578291179787384436505546430278305826713579947235728471134&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;y = 5472060717959818805561601436314318772137091100104008585924551046643952123905&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;generates all &lt;code&gt;n&lt;&#x2F;code&gt; points of the curve.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;base-point&quot;&gt;Base Point&lt;&#x2F;h3&gt;
&lt;p&gt;The point &lt;code&gt;B = (x,y)&lt;&#x2F;code&gt; with coordinates&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;x = 5299619240641551281634865583518297030282874472190772894086521144482721001553&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;y = 16950150798460657717958625567821834550301663161624707787222815936182638968203&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;generates the subgroup of points &lt;code&gt;P&lt;&#x2F;code&gt; of Baby Jubjub satisfying &lt;code&gt;l * P = O&lt;&#x2F;code&gt;. That is, it generates the set of points of order &lt;code&gt;l&lt;&#x2F;code&gt; and origin &lt;code&gt;O&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;arithmetic&quot;&gt;Arithmetic&lt;&#x2F;h3&gt;
&lt;p&gt;Let &lt;code&gt;P1 = (x1, y1)&lt;&#x2F;code&gt; and &lt;code&gt;P2 = (x2, y2)&lt;&#x2F;code&gt; be two arbitrary points of Baby Jubjub. Then &lt;code&gt;P1 + P2 = (x3, y3)&lt;&#x2F;code&gt; is calculated in the following way:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;x3 = (x1*y2 + y1*x2)&#x2F;(1 + d*x1*x2*y1*y2)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;y3 = (y1*y2 - a*x1*x2)&#x2F;(1 - d*x1*x2*y1*y2)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note that both addition and doubling of points can be computed using a single formula.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The search for Baby Jubjub was motivated by the need for an elliptic curve that allows the implementation of elliptic-curve cryptography in &lt;code&gt;F_r&lt;&#x2F;code&gt;-arithmetic circuits. The curve choice was based on three main factors: type of curve, generation process and security criteria. This section describes how these factors were addressed.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Form of the Curve&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Baby Jubjub is a &lt;strong&gt;twisted Edwards&lt;&#x2F;strong&gt; curve birationally equivalent to a &lt;strong&gt;Montgomery&lt;&#x2F;strong&gt; curve. The choice of this form of curve was based on the following facts:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The Edwards-curve Digital Signature Scheme is based on twisted Edwards curves.&lt;&#x2F;li&gt;
&lt;li&gt;Twisted Edwards curves have a single complete formula for addition of points, which makes the implementation of the group law inside circuits very efficient &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;eprint.iacr.org&#x2F;2008&#x2F;013.pdf&quot;&gt;[Crypto08&#x2F;013, Section 6]&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;As a twisted Edwards curve is generally birationally equivalent to a Montgomery curve &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;eprint.iacr.org&#x2F;2008&#x2F;013.pdf&quot;&gt;[Crypto08&#x2F;13,Theorem 3.2]&lt;&#x2F;a&gt;, the curve can be easily converted from one form to another. As addition and doubling of points in a Montgomery curve can be performed very efficiently, computations outside the circuit can be done faster using this form and sped up inside circuits by combining it with twisted Edwards form (see &lt;a rel=&quot;external&quot; href=&quot;http:&#x2F;&#x2F;hyperelliptic.org&#x2F;EFD&#x2F;g1p&#x2F;index.html&quot;&gt;here&lt;&#x2F;a&gt;) for more details).&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;strong&gt;Generation of the Curve&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Baby Jubjub was conceived as a solution to the circuit implementation of cryptographic schemes that require elliptic curves. As with any cryptographic protocol, it is important to reduce the possibility of a backdoor being present. As a result, we designed the generation process to be &lt;strong&gt;transparent&lt;&#x2F;strong&gt; and &lt;strong&gt;deterministic&lt;&#x2F;strong&gt; -- in order to make it clear that no external considerations were taken into account, and to ensure that the process can be reproduced and followed by anyone who wishes to do so.&lt;&#x2F;p&gt;
&lt;p&gt;The algorithm chosen for generating Baby Jubjub is based in the criteria defined in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;tools.ietf.org&#x2F;html&#x2F;rfc7748&quot;&gt;[RFC7748, Appendix A.1]&lt;&#x2F;a&gt; and can be found in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;barryWhiteHat&#x2F;baby_jubjub&quot;&gt;this github repository&lt;&#x2F;a&gt;. Essentially, the algorithm takes a prime number &lt;code&gt;p = 1 mod 4&lt;&#x2F;code&gt; and returns the lowest &lt;code&gt;A&amp;gt;0&lt;&#x2F;code&gt; such that &lt;code&gt;A-2&lt;&#x2F;code&gt; is a multiple of 4 and such that the set of solutions in &lt;code&gt;F_p&lt;&#x2F;code&gt; of &lt;code&gt;y^2 = x^3 + Ax^2 + x&lt;&#x2F;code&gt; defines a Montgomery curve with cofactor 8.&lt;&#x2F;p&gt;
&lt;p&gt;Baby Jubjub was generated by running the algorithm with the prime&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;r =  21888242871839275222246405745257275088548364400416034343698204186575808495617&lt;&#x2F;code&gt;,&lt;&#x2F;p&gt;
&lt;p&gt;which is the order of alt_bn128, the curve used to verify zk-SNARK proofs in Ethereum. The output of the algorithm was &lt;code&gt;A=168698&lt;&#x2F;code&gt;. Afterwards, the corresponding Montgomery curve was transformed into twisted Edwards form. Using SAGE libraries for curves, the order &lt;code&gt;n&lt;&#x2F;code&gt; of the curve and its factorization &lt;code&gt;n = 8*l&lt;&#x2F;code&gt; was calculated.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Choice of generator&lt;&#x2F;strong&gt; : the generator point &lt;code&gt;G&lt;&#x2F;code&gt; is the point of order &lt;code&gt;n&lt;&#x2F;code&gt; with smallest positive &lt;code&gt;x&lt;&#x2F;code&gt;-coordinate in &lt;code&gt;F_r&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Choice of base point&lt;&#x2F;strong&gt;: the base point &lt;code&gt;B&lt;&#x2F;code&gt; is chosen to be &lt;code&gt;B = 8*G&lt;&#x2F;code&gt;, which has order &lt;code&gt;l&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Security Criteria&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;It is crucial that Baby Jubjub be safe against well-known attacks. To that end, we decided that the curve should pass &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;safecurves.cr.yp.to&#x2F;&quot;&gt;SafeCurves&lt;&#x2F;a&gt; security tests, as they are known for gathering the best known attacks against elliptic curves. Supporting evidence that Baby Jubjub satisfies the SafeCurves criteria can be found &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;barryWhiteHat&#x2F;baby_jubjub&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Baby Jubjub is a twisted Edwards elliptic curve birational to different curves. So far, the curve has mainly been used in its original form, in Montomgery form, and in another (different representation) twisted Edwards form -- which we call the reduced twisted Edwards form.&lt;&#x2F;p&gt;
&lt;p&gt;Below are the three representations and the birational maps that make it possible to map points from one form of the curve to another. In all cases, the generator and base points are written in the form &lt;strong&gt;&lt;code&gt;(x,y)&lt;&#x2F;code&gt;.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;forms-of-the-curve&quot;&gt;Forms of the Curve&lt;&#x2F;h3&gt;
&lt;p&gt;All generators and base points are written in the form (x,y).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Twisted Edwards Form&lt;&#x2F;strong&gt; (standard)&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Equation: &lt;code&gt;ax^2 + y^2 = 1 + dx^2y^2&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Parameters: &lt;code&gt;a = 168700, d = 168696&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Generator point:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(995203441582195749578291179787384436505546430278305826713579947235728471134, 5472060717959818805561601436314318772137091100104008585924551046643952123905)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Base point:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(5299619240641551281634865583518297030282874472190772894086521144482721001553, 16950150798460657717958625567821834550301663161624707787222815936182638968203)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Montgomery Form&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Equation: &lt;code&gt;By^2 = x^3 + A x^2 + x&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Parameters: &lt;code&gt;A = 168698, B = 1&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Generator point:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(7, 4258727773875940690362607550498304598101071202821725296872974770776423442226)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Base point:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(7117928050407583618111176421555214756675765419608405867398403713213306743542, 14577268218881899420966779687690205425227431577728659819975198491127179315626)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Reduced Twisted Edwards Form&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Equation: &lt;code&gt;a&#x27; x^2 + y^2 = 1 + d&#x27; x^2y^2&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Parameters:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;a&amp;#39; = -1 &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;d&amp;#39; = 12181644023421730124874158521699555681764249180949974110617291017600649128846&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Generator point:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(4986949742063700372957640167352107234059678269330781000560194578601267663727, 5472060717959818805561601436314318772137091100104008585924551046643952123905)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Base point:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(9671717474070082183213120605117400219616337014328744928644933853176787189663, 16950150798460657717958625567821834550301663161624707787222815936182638968203)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;conversion-of-points&quot;&gt;Conversion of Points&lt;&#x2F;h3&gt;
&lt;p&gt;Following formulas allow to convert points from one form of the curve to another. We will denote the coordinates&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;(u, v)&lt;&#x2F;code&gt; for points in the Montomgery form,&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;(x, y)&lt;&#x2F;code&gt; for points in the Twisted Edwards form and&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;(x&#x27;, y&#x27;)&lt;&#x2F;code&gt; for points in reduced Twisted Edwards form.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note that in the last conversion -- from Twisted Edwards to Reduced Twisted Edwards and back -- we also use the scaling factor &lt;code&gt;f&lt;&#x2F;code&gt;, where:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;f = 6360561867910373094066688120553762416144456282423235903351243436111059670888&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In the expressions one can also use directly &lt;code&gt;-f&lt;&#x2F;code&gt;, where:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-f = 15527681003928902128179717624703512672403908117992798440346960750464748824729&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Montgomery --&amp;gt; Twisted Edwards&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(u, v) --&amp;gt; (x, y)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;x = u&#x2F;v&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;y = (u-1)&#x2F;(u+1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Twisted Edwards --&amp;gt; Montgomery&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(x, y) --&amp;gt; (u, v)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;u = (1+y)&#x2F;(1-y) &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;v = (1+y)&#x2F;((1-y)x)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Montgomery --&amp;gt; Reduced Twisted Edwards&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(u, v) --&amp;gt; (x&amp;#39;, y&amp;#39;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;x&amp;#39; = u*(-f)&#x2F;v &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;y&amp;#39; = (u-1)&#x2F;(u+1) &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Reduced Twisted Edwards --&amp;gt; Montgomery&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(x&amp;#39;, y&amp;#39;) --&amp;gt; (u, v)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;u = (1+y&amp;#39;)&#x2F;(1-y&amp;#39;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;v = (-f)*(1+y&amp;#39;)&#x2F;((1-y&amp;#39;)*x&amp;#39;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Twisted Edwards --&amp;gt; Reduced Twisted Edwards&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(x, y) --&amp;gt; (x&amp;#39;, y&amp;#39;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;x&amp;#39; = x*(-f)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;y&amp;#39; = y&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Reduced Twisted Edwards --&amp;gt; Twisted Edwards&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(x&amp;#39;, y&amp;#39;) --&amp;gt; (x, y)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;x = x&amp;#39;&#x2F;(-f)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;y = y&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This section specifies the safety checks done on Baby Jubjub. The choices of security parameters are based on &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;safecurves.cr.yp.to&quot;&gt;SafeCurves criteria&lt;&#x2F;a&gt;, and supporting evidence that Baby Jubjub satisfies the following requisites can be found &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;barryWhiteHat&#x2F;baby_jubjub&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Curve Parameters&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Check that all parameters in the specification of the curve describe a well-defined elliptic curve over a prime finite field.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The number &lt;code&gt;r&lt;&#x2F;code&gt; is prime.&lt;&#x2F;li&gt;
&lt;li&gt;Parameters &lt;code&gt;a&lt;&#x2F;code&gt; and &lt;code&gt;d&lt;&#x2F;code&gt; define an equation that corresponds to an elliptic curve.&lt;&#x2F;li&gt;
&lt;li&gt;The product of &lt;code&gt;h&lt;&#x2F;code&gt; and &lt;code&gt;l&lt;&#x2F;code&gt; results into the order of the curve and the &lt;code&gt;G&lt;&#x2F;code&gt; point is a generator.&lt;&#x2F;li&gt;
&lt;li&gt;The number &lt;code&gt;l&lt;&#x2F;code&gt; is prime and the &lt;code&gt;B&lt;&#x2F;code&gt; point has order &lt;code&gt;l&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Elliptic Curve Discrete Logarithm Problem&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Check that the discrete logarithm problem remains difficult in the given curve. We checked Baby Jubjub is resistant to the following known attacks.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Rho method&lt;&#x2F;em&gt; &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.cambridge.org&#x2F;core&#x2F;books&#x2F;elliptic-curves-in-cryptography&#x2F;16A2B60636EFA7EBCC3D5A5D01F28546&quot;&gt;[Blake-Seroussi-Smart, Section V.1]&lt;&#x2F;a&gt;: we require the cost for the rho method, which takes on average around &lt;code&gt;0.886*sqrt(l)&lt;&#x2F;code&gt; additions, to be above &lt;code&gt;2^100&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;Additive and multiplicative transfers&lt;&#x2F;em&gt; &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.cambridge.org&#x2F;core&#x2F;books&#x2F;elliptic-curves-in-cryptography&#x2F;16A2B60636EFA7EBCC3D5A5D01F28546&quot;&gt;[Blake-Seroussi-Smart, Section V.2]&lt;&#x2F;a&gt;: we require the embedding degree to be at least &lt;code&gt;(l − 1)&#x2F;100&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;High discriminant&lt;&#x2F;em&gt; &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.cambridge.org&#x2F;core&#x2F;books&#x2F;elliptic-curves-in-cryptography&#x2F;16A2B60636EFA7EBCC3D5A5D01F28546&quot;&gt;[Blake-Seroussi-Smart, Section IX.3]&lt;&#x2F;a&gt;: we require the complex-multiplication field discriminant &lt;code&gt;D&lt;&#x2F;code&gt; to be larger than &lt;code&gt;2^100&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Elliptic Curve Cryptography&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Ladders&lt;&#x2F;em&gt; &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;wstein.org&#x2F;edu&#x2F;Fall2001&#x2F;124&#x2F;misc&#x2F;montgomery.pdf&quot;&gt;[Montgomery]&lt;&#x2F;a&gt;: check the curve supports the Montgomery ladder.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;Twists&lt;&#x2F;em&gt; &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;safecurves.cr.yp.to&#x2F;twist.html&quot;&gt;[SafeCurves, twist]&lt;&#x2F;a&gt;: check it is secure against the small-subgroup attack, invalid-curve attacks and twisted-attacks.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;Completeness&lt;&#x2F;em&gt; &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;safecurves.cr.yp.to&#x2F;complete.html&quot;&gt;[SafeCurves, complete]&lt;&#x2F;a&gt;: check if the curve has complete single-scalar and multiple-scalar formulas.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;Indistinguishability&lt;&#x2F;em&gt; &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;eprint.iacr.org&#x2F;2013&#x2F;325&quot;&gt;[IACR2013&#x2F;325]&lt;&#x2F;a&gt;: check availability of maps that turn elliptic-curve points indistinguishable from uniform random strings.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;Test 1 (Addition)&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Consider the points &lt;code&gt;P1 = (x1, y1)&lt;&#x2F;code&gt; and &lt;code&gt;P2 = (x2, y2)&lt;&#x2F;code&gt; with the following coordinates:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;x1 = 17777552123799933955779906779655732241715742912184938656739573121738514868268&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;y1 = 2626589144620713026669568689430873010625803728049924121243784502389097019475&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;x2 = 16540640123574156134436876038791482806971768689494387082833631921987005038935&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;y2 = 20819045374670962167435360035096875258406992893633759881276124905556507972311&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Then their sum &lt;code&gt; P1+P2 = (x3, y3)&lt;&#x2F;code&gt; is equal to:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;x3 = 7916061937171219682591368294088513039687205273691143098332585753343424131937&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;y3 = 14035240266687799601661095864649209771790948434046947201833777492504781204499&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Test 2 (Doubling)&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Consider the points &lt;code&gt;P1 = (x1, y1)&lt;&#x2F;code&gt; and &lt;code&gt;P2 = (x2, y2)&lt;&#x2F;code&gt; with the following coordinates:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;x1 = 17777552123799933955779906779655732241715742912184938656739573121738514868268,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;y1 = 2626589144620713026669568689430873010625803728049924121243784502389097019475&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;x2 = 17777552123799933955779906779655732241715742912184938656739573121738514868268&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;y2 = 2626589144620713026669568689430873010625803728049924121243784502389097019475&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Then their sum &lt;code&gt; P1+P2 = (x3, y3)&lt;&#x2F;code&gt; is equal to:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;x3 = 6890855772600357754907169075114257697580319025794532037257385534741338397365&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;y3 = 4338620300185947561074059802482547481416142213883829469920100239455078257889&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Test 3 (Doubling the identity)&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Consider the points &lt;code&gt;P1 = (x1, y1)&lt;&#x2F;code&gt; and &lt;code&gt;P2 = (x2, y2)&lt;&#x2F;code&gt; with the following coordinates:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;x1 = 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;y1 = 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;x2 = 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;y2 = 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Then their sum &lt;code&gt; P1+P2 = (x3, y3)&lt;&#x2F;code&gt; results in the same point:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;x3 = 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;y3 = 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Test 4 (Curve membership)&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Point &lt;code&gt;(0,1)&lt;&#x2F;code&gt; is a point on Baby Jubjub.&lt;&#x2F;p&gt;
&lt;p&gt;Point &lt;code&gt;(1,0)&lt;&#x2F;code&gt; is not a point on Baby Jubjub.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Test 5 (Base point choice)&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Check that the base point &lt;code&gt; B = (Bx, By)&lt;&#x2F;code&gt; with coordinates&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Bx = 5299619240641551281634865583518297030282874472190772894086521144482721001553&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;By = 16950150798460657717958625567821834550301663161624707787222815936182638968203&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;is 8 times the generator point &lt;code&gt;G = (Gx, Gy)&lt;&#x2F;code&gt;, where&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Gx = 995203441582195749578291179787384436505546430278305826713579947235728471134&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Gy = 5472060717959818805561601436314318772137091100104008585924551046643952123905&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;That is, check that &lt;code&gt;B = 8 x G&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Test 6 (Base point order)&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Check that the base point &lt;code&gt; B = (Bx, By)&lt;&#x2F;code&gt; with coordinates&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Bx = 5299619240641551281634865583518297030282874472190772894086521144482721001553&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;By = 16950150798460657717958625567821834550301663161624707787222815936182638968203&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;multiplied by &lt;code&gt;l&lt;&#x2F;code&gt;, where&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;l = 2736030358979909402780800718157159386076813972158567259200215660948447373041&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;results in the origin point &lt;code&gt;O = (0, 1)&lt;&#x2F;code&gt;. This test checks that the base point &lt;code&gt;B&lt;&#x2F;code&gt; has order &lt;code&gt;l&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Arithmetic of Baby Jubjub and some cryptographic primitives using the curve have already been implemented in different languages. Here are a few such implementations:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Python: https:&#x2F;&#x2F;github.com&#x2F;barryWhiteHat&#x2F;baby_jubjub_ecc&lt;&#x2F;li&gt;
&lt;li&gt;JavaScript: https:&#x2F;&#x2F;github.com&#x2F;iden3&#x2F;circomlib&#x2F;blob&#x2F;master&#x2F;src&#x2F;babyjub.js&lt;&#x2F;li&gt;
&lt;li&gt;Circuit (circom): https:&#x2F;&#x2F;github.com&#x2F;iden3&#x2F;circomlib&#x2F;blob&#x2F;master&#x2F;circuits&#x2F;babyjub.circom&lt;&#x2F;li&gt;
&lt;li&gt;Rust: https:&#x2F;&#x2F;github.com&#x2F;arnaucube&#x2F;babyjubjub-rs&lt;&#x2F;li&gt;
&lt;li&gt;Solidity: https:&#x2F;&#x2F;github.com&#x2F;yondonfu&#x2F;sol-baby-jubjub&lt;&#x2F;li&gt;
&lt;li&gt;Go: https:&#x2F;&#x2F;github.com&#x2F;iden3&#x2F;go-iden3-crypto&#x2F;tree&#x2F;master&#x2F;babyjub&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Coinbase calls</title>
        <published>2020-01-19T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Ricardo Guilherme Schmidt</name><uri>https://github.com/3esmit</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2474/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethresear.ch/t/gas-abstraction-non-signed-block-validator-only-procedures/4388/2" />
        

        <id>https://wg-eips.ritovision.com/2474/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2474"
            label="EIP-2474" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2474/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Allow contracts to be called directly by &lt;code&gt;block.coinbase&lt;&#x2F;code&gt; (block validator), without a transaction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;em&gt;In proof-of-work blockchains, validators are known as miners.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The validator might want to execute functions directly, without having to sign a transaction. Some examples might be presenting a proof in a contract for a change which also benefits the validator.&lt;&#x2F;p&gt;
&lt;p&gt;A notable example would be when a validator want to act as an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1077&#x2F;&quot;&gt;EIP-1077&lt;&#x2F;a&gt; Gas Relayer, incentivized to pick up fees from meta transactions.
Without this change, they can do so by signing from any address a &lt;code&gt;gasPrice = 0&lt;&#x2F;code&gt; transaction with the gas relayed call.
However this brings an overhead of a signed transaction by validator that does nothing, as &lt;code&gt;msg.sender&lt;&#x2F;code&gt; is never used, and there is no gas cost to EVM charge.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal makes possible to remove this unused ecrecover.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;In order to reduce the overhead of calls that don&#x27;t use &lt;code&gt;msg.sender&lt;&#x2F;code&gt; and are being called by validator with &lt;code&gt;tx.gasPrice = 0&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The calls to be executed by &lt;code&gt;block.coinbase&lt;&#x2F;code&gt; would be included first at block, and would consume normally the gas of block, however they won&#x27;t pay&#x2F;cost gas, instead the call logic would pay the validator in other form.&lt;&#x2F;p&gt;
&lt;p&gt;Would be valid to execute any calls without a transaction by the block coinbase, except when the validator call tries to read &lt;code&gt;msg.sender&lt;&#x2F;code&gt;, which would throw an invalid jump.&lt;&#x2F;p&gt;
&lt;p&gt;Calls included by the validator would have &lt;code&gt;tx.origin = block.coinbase&lt;&#x2F;code&gt; and &lt;code&gt;gas.price = 0&lt;&#x2F;code&gt; for the rest of call stack, the rest follows as normal calls.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;tx.origin = block.coinbase&lt;&#x2F;code&gt; could cause some issues on bad designed contracts, such as using &lt;code&gt;tx.origin&lt;&#x2F;code&gt; to validate a signature, an analysis on how contracts use tx.origin might be useful to decide if this is a good choice.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>eth&#x2F;66 request identifier</title>
        <published>2020-01-17T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Christoph Burgdorf</name><uri>https://github.com/cburgdorf</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2481/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2481-eth-66-request-identifiers/12132" />
        

        <id>https://wg-eips.ritovision.com/2481/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="networking"
                label="Networking" />
            
        

        
        <category
            term="tag:eip:2481"
            label="EIP-2481" />
        

        
        

        
        <summary type="html">Introduces a request id for all requests of the eth protocol</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2481/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;eth&lt;&#x2F;code&gt; protocol defines various request and response commands that are used to exchange data between Ethereum nodes. For example, to ask a peer node for a specific set of headers, a node sends it the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;devp2p&#x2F;blob&#x2F;40ab248bf7e017e83cc9812a4e048446709623e8&#x2F;caps&#x2F;eth.md#getblockheaders-0x03&quot;&gt;&lt;code&gt;GetBlockHeaders&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; command.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Citing from the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;devp2p&#x2F;blob&#x2F;40ab248bf7e017e83cc9812a4e048446709623e8&#x2F;caps&#x2F;eth.md#getblockheaders-0x03&quot;&gt;&lt;code&gt;GetBlockHeaders&lt;&#x2F;code&gt; spec definition&lt;&#x2F;a&gt;:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;[block: {P, B_32}, maxHeaders: P, skip: P, reverse: P in {0, 1}]&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;Require peer to return a &lt;code&gt;BlockHeaders&lt;&#x2F;code&gt; message. Reply must contain a number of block
headers, of rising number when &lt;code&gt;reverse&lt;&#x2F;code&gt; is &lt;code&gt;0&lt;&#x2F;code&gt;, falling when &lt;code&gt;1&lt;&#x2F;code&gt;, &lt;code&gt;skip&lt;&#x2F;code&gt; blocks apart,
beginning at block &lt;code&gt;block&lt;&#x2F;code&gt; (denoted by either number or hash) in the canonical chain, and
with at most &lt;code&gt;maxHeaders&lt;&#x2F;code&gt; items.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;The node that receives the &lt;code&gt;GetBlockHeaders&lt;&#x2F;code&gt; command should answer it with the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;devp2p&#x2F;blob&#x2F;40ab248bf7e017e83cc9812a4e048446709623e8&#x2F;caps&#x2F;eth.md#blockheaders-0x04&quot;&gt;&lt;code&gt;BlockHeaders&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; response command accordingly.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Citing from the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;devp2p&#x2F;blob&#x2F;40ab248bf7e017e83cc9812a4e048446709623e8&#x2F;caps&#x2F;eth.md#blockheaders-0x04&quot;&gt;&lt;code&gt;BlockHeaders&lt;&#x2F;code&gt; spec definition&lt;&#x2F;a&gt;:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;[blockHeader_0, blockHeader_1, ...]&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;Reply to &lt;code&gt;GetBlockHeaders&lt;&#x2F;code&gt;. The items in the list (following the message ID) are block
headers in the format described in the main Ethereum specification, previously asked for
in a GetBlockHeaders message. This may validly contain no block headers if none of the
requested block headers were found. The number of headers that can be requested in a
single message may be subject to implementation-defined limits.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;Let&#x27;s consider a client making many simultaneous requests for &lt;code&gt;GetBlockHeaders&lt;&#x2F;code&gt; to one of its peers. By nature it can not be guaranteed that the expected responses arrive in the same order as they were sent. For the client to associate the incoming responses to the correct requests it has to loop through all pending requests trying to match it with the incoming response based on its contents.&lt;&#x2F;p&gt;
&lt;p&gt;This can be particular tricky for responses that are ambiguous such as empty responses.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP proposes to change the &lt;code&gt;GetBlockHeaders&lt;&#x2F;code&gt; and the &lt;code&gt;BlockHeaders&lt;&#x2F;code&gt; command to include a &lt;code&gt;request_id&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;request_id&lt;&#x2F;code&gt; is a 64-bit integer set by the client when it makes the request. On the responding side, the exact same &lt;code&gt;request_id&lt;&#x2F;code&gt; from the incoming request is put back into the response object.&lt;&#x2F;p&gt;
&lt;p&gt;This change allows the requesting client to match incoming responses &lt;strong&gt;directly&lt;&#x2F;strong&gt; back to their pending requests without going through all of the pending requests to check if they might match based on the response data.&lt;&#x2F;p&gt;
&lt;p&gt;The selected request&#x2F;response pair serves as an example for many similar request&#x2F;response pairs in the &lt;code&gt;eth&lt;&#x2F;code&gt; networking protocol.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The lack of request identifiers in the request &#x2F; response paris of the &lt;code&gt;eth&lt;&#x2F;code&gt; protocol puts unnecessary burden of code complexity into every Ethereum client. It also makes the communication slightly less efficient. Another argument can be made that the addition of request identifiers makes the protocol more aligned with the &lt;code&gt;les&lt;&#x2F;code&gt; protocol which &lt;strong&gt;does&lt;&#x2F;strong&gt; already defines request identifiers for each request &#x2F; response pair.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Change the following message types in the &lt;code&gt;eth&lt;&#x2F;code&gt; protocol:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;GetBlockHeaders (0x03)&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Current (eth&#x2F;65):&lt;&#x2F;strong&gt; &lt;code&gt;[block: {P, B_32}, maxHeaders: P, skip: P, reverse: P in {0, 1}]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Then (eth&#x2F;66)&lt;&#x2F;strong&gt;: &lt;code&gt;[request_id: P, [block: {P, B_32}, maxHeaders: P, skip: P, reverse: P in {0, 1}]]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;BlockHeaders (0x04)&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Current (eth&#x2F;65):&lt;&#x2F;strong&gt; &lt;code&gt;[blockHeader_0, blockHeader_1, ...]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Then (eth&#x2F;66)&lt;&#x2F;strong&gt;: &lt;code&gt;[request_id: P, [blockHeader_0, blockHeader_1, ...]]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;GetBlockBodies (0x05)&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Current (eth&#x2F;65):&lt;&#x2F;strong&gt; &lt;code&gt;[hash_0: B_32, hash_1: B_32, ...]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Then (eth&#x2F;66)&lt;&#x2F;strong&gt;: &lt;code&gt;[request_id: P, [hash_0: B_32, hash_1: B_32, ...]]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;GetPooledTransactions (0x09)&lt;&#x2F;code&gt;:
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Current (eth&#x2F;65)&lt;&#x2F;strong&gt;&lt;code&gt;[hash_0: B_32, hash_1: B_32, ...]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Then (eth&#x2F;66)&lt;&#x2F;strong&gt;&lt;code&gt;[request_id: P, [hash_0: B_32, hash_1: B_32, ...]]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;PooledTransactions (0x0a)&lt;&#x2F;code&gt;:
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Current (eth&#x2F;65)&lt;&#x2F;strong&gt;&lt;code&gt;[[nonce: P, receivingAddress: B_20, value: P, ...], ...]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Then (eth&#x2F;66)&lt;&#x2F;strong&gt;&lt;code&gt;[request_id: P, [[nonce: P, receivingAddress: B_20, value: P, ...], ...]]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;BlockBodies (0x06)&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Current (eth&#x2F;65):&lt;&#x2F;strong&gt; &lt;code&gt;[hash_0: B_32, hash_1: B_32, ...]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Then (eth&#x2F;66)&lt;&#x2F;strong&gt;: &lt;code&gt;[request_id: P, [hash_0: B_32, hash_1: B_32, ...]]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;GetNodeData (0x0d)&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Current (eth&#x2F;65):&lt;&#x2F;strong&gt; &lt;code&gt;[hash_0: B_32, hash_1: B_32, ...]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Then (eth&#x2F;66)&lt;&#x2F;strong&gt;: &lt;code&gt;[request_id: P, [hash_0: B_32, hash_1: B_32, ...]]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;NodeData (0x0e)&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Current (eth&#x2F;65):&lt;&#x2F;strong&gt; &lt;code&gt;[value_0: B, value_1: B, ...]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Then (eth&#x2F;66)&lt;&#x2F;strong&gt;: &lt;code&gt;[request_id: P, [value_0: B, value_1: B, ...]]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;GetReceipts (0x0f)&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Current (eth&#x2F;65):&lt;&#x2F;strong&gt; &lt;code&gt;[blockHash_0: B_32, blockHash_1: B_32, ...]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Then (eth&#x2F;66)&lt;&#x2F;strong&gt;: &lt;code&gt;[request_id: P, [blockHash_0: B_32, blockHash_1: B_32, ...]]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Receipts (0x10)&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Current (eth&#x2F;65):&lt;&#x2F;strong&gt; &lt;code&gt;[[receipt_0, receipt_1], ...]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Then (eth&#x2F;66)&lt;&#x2F;strong&gt;: &lt;code&gt;[request_id: P, [[receipt_0, receipt_1], ...]]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;To elaborate, each command is altered in the following way:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Create a list with the &lt;code&gt;request_id&lt;&#x2F;code&gt; being the first element.&lt;&#x2F;li&gt;
&lt;li&gt;Make the second element the list that defines the whole command in the current scheme.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The &lt;code&gt;request_id&lt;&#x2F;code&gt; has the following characteristics:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;64 bit integer&lt;&#x2F;li&gt;
&lt;li&gt;Doesn&#x27;t need to be sequential (can be random)&lt;&#x2F;li&gt;
&lt;li&gt;Does allow duplicates&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;Q: The efficiency gains might encourage clients to flood their peers with too many simultaneous requests&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Peers can always throttle or disconnect if they don&#x27;t feel treated well. This is the same as today.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Q: If &lt;code&gt;les&lt;&#x2F;code&gt; already defines the commands like this, why not just use the &lt;code&gt;les&lt;&#x2F;code&gt; protocol?&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;In practice, peers that serve the &lt;code&gt;les&lt;&#x2F;code&gt; protocol are much harder to find in the network. The reasons for this are varied but might boil down to client defaults, immature implementations or missing incentives.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Q: Networking works today, isn&#x27;t this just adding bloat?&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;This is adding a single integer per command while at the same time reducing code complexity and improving networking efficiency. The addition seems justified.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Q: Why not demand request ids to be sequential?&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Assuming request ids start always to count from &lt;code&gt;0&lt;&#x2F;code&gt; upon connection, things will become messy when
connections are lost and clients reconnect and start over with the same request ids that they had used
in the previous session.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Q: Why allow duplicate request ids?&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The main benefit is flexibility and simplicity on the implementation side. Clients could decide to share
the same ids across multiple different request types since they are naturally separated anyway. Clients
could even decide to not rely on request ids at all, therefore using the same constant request id across
all requests.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Q: Why choose a 64-bit integer for the request ids&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;64-bit integer were chosen to keep compatibility with the &lt;code&gt;les&lt;&#x2F;code&gt; protocol.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP extends the &lt;code&gt;eth&lt;&#x2F;code&gt; protocol in a backwards incompatible way and requires rolling out a new version, &lt;code&gt;eth&#x2F;66&lt;&#x2F;code&gt;. However, &lt;code&gt;devp2p&lt;&#x2F;code&gt; supports running multiple versions of the same wire protocol side-by-side, so rolling out &lt;code&gt;eth&#x2F;66&lt;&#x2F;code&gt; does not require client coordination, since non-updated clients can keep using &lt;code&gt;eth&#x2F;65&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP does not change the consensus engine, thus does &lt;em&gt;not&lt;&#x2F;em&gt; require a hard fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;These testcases cover RLP-encoding of all the redefined messages types, where the &lt;code&gt;rlp&lt;&#x2F;code&gt; portion is the rlp-encoding of the message defined in the &lt;code&gt;data&lt;&#x2F;code&gt; portion.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;GetBlockHeadersPacket66&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;rlp&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xe8820457e4a000000000000000000000000000000000000000000000000000000000deadc0de050580&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;RequestId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1111&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;Origin&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x00000000000000000000000000000000000000000000000000000000deadc0de&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;Number&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;Amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 5&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;Skip&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 5&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;Reverse&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;GetBlockHeadersPacket66&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;rlp&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xca820457c682270f050580&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;RequestId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1111&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;Origin&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;Number&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 9999&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;Amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 5&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;Skip&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 5&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;Reverse&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;BlockHeadersPacket66&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;rlp&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xf90202820457f901fcf901f9a00000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000940000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008208ae820d0582115c8215b3821a0a827788a00000000000000000000000000000000000000000000000000000000000000000880000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;RequestId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1111&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;BlockHeadersPacket&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;parentHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;sha3Uncles&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;miner&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;stateRoot&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;transactionsRoot&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;receiptsRoot&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;logsBloom&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;difficulty&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x8ae&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xd05&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gasLimit&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x115c&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gasUsed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x15b3&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;timestamp&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1a0a&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;extraData&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x7788&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;mixHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x8c2f2af15b7b563b6ab1e09bed0e9caade7ed730aec98b70a993597a797579a9&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;GetBlockBodiesPacket66&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;rlp&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xf847820457f842a000000000000000000000000000000000000000000000000000000000deadc0dea000000000000000000000000000000000000000000000000000000000feedbeef&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;RequestId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1111&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;GetBlockBodiesPacket&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x00000000000000000000000000000000000000000000000000000000deadc0de&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x00000000000000000000000000000000000000000000000000000000feedbeef&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;BlockBodiesPacket66&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;rlp&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xf902dc820457f902d6f902d3f8d2f867088504a817c8088302e2489435353535353535353535353535353535353535358202008025a064b1702d9298fee62dfeccc57d322a463ad55ca201256d01f62b45b2e1c21c12a064b1702d9298fee62dfeccc57d322a463ad55ca201256d01f62b45b2e1c21c10f867098504a817c809830334509435353535353535353535353535353535353535358202d98025a052f8f61201b2b11a78d6e866abc9c3db2ae8631fa656bfe5cb53668255367afba052f8f61201b2b11a78d6e866abc9c3db2ae8631fa656bfe5cb53668255367afbf901fcf901f9a00000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000940000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008208ae820d0582115c8215b3821a0a827788a00000000000000000000000000000000000000000000000000000000000000000880000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;RequestId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1111&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;BlockBodiesPacket&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;Transactions&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x8&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gasPrice&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x4a817c808&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x2e248&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x3535353535353535353535353535353535353535&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x200&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;input&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;v&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x25&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x64b1702d9298fee62dfeccc57d322a463ad55ca201256d01f62b45b2e1c21c12&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x64b1702d9298fee62dfeccc57d322a463ad55ca201256d01f62b45b2e1c21c10&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x588df025c4c2d757d3e314bd3dfbfe352687324e6b8557ad1731585e96928aed&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x9&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gasPrice&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x4a817c809&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x33450&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x3535353535353535353535353535353535353535&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x2d9&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;input&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;v&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x25&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x52f8f61201b2b11a78d6e866abc9c3db2ae8631fa656bfe5cb53668255367afb&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x52f8f61201b2b11a78d6e866abc9c3db2ae8631fa656bfe5cb53668255367afb&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xf39c7dac06a9f3abf09faf5e30439a349d3717611b3ed337cd52b0d192bc72da&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;Uncles&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;parentHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;sha3Uncles&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;miner&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;stateRoot&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;transactionsRoot&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;receiptsRoot&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;logsBloom&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;difficulty&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x8ae&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xd05&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gasLimit&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x115c&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gasUsed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x15b3&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;timestamp&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1a0a&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;extraData&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x7788&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;mixHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x8c2f2af15b7b563b6ab1e09bed0e9caade7ed730aec98b70a993597a797579a9&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;GetNodeDataPacket66&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;rlp&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xf847820457f842a000000000000000000000000000000000000000000000000000000000deadc0dea000000000000000000000000000000000000000000000000000000000feedbeef&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;RequestId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1111&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;GetNodeDataPacket&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x00000000000000000000000000000000000000000000000000000000deadc0de&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x00000000000000000000000000000000000000000000000000000000feedbeef&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;NodeDataPacket66&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;rlp&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xce820457ca84deadc0de84feedbeef&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;RequestId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1111&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;NodeDataPacket&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xdeadc0de&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xfeedbeef&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;GetReceiptsPacket66&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;rlp&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xf847820457f842a000000000000000000000000000000000000000000000000000000000deadc0dea000000000000000000000000000000000000000000000000000000000feedbeef&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;RequestId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1111&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;GetReceiptsPacket&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x00000000000000000000000000000000000000000000000000000000deadc0de&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x00000000000000000000000000000000000000000000000000000000feedbeef&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ReceiptsPacket66&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;rlp&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xf90172820457f9016cf90169f901668001b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f85ff85d940000000000000000000000000000000000000011f842a0000000000000000000000000000000000000000000000000000000000000deada0000000000000000000000000000000000000000000000000000000000000beef830100ff&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;RequestId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1111&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;ReceiptsPacket&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;root&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;status&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;cumulativeGasUsed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;logsBloom&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;logs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000011&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;topics&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x000000000000000000000000000000000000000000000000000000000000dead&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x000000000000000000000000000000000000000000000000000000000000beef&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0100ff&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;blockNumber&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;transactionHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;transactionIndex&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;blockHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;logIndex&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;removed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;transactionHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x00000000000000000000000000000000000000000000000000000000deadc0de&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;contractAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000011111&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gasUsed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1b207&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;blockHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;transactionIndex&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;GetPooledTransactionsPacket66&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;rlp&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xf847820457f842a000000000000000000000000000000000000000000000000000000000deadc0dea000000000000000000000000000000000000000000000000000000000feedbeef&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;RequestId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1111&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;GetPooledTransactionsPacket&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x00000000000000000000000000000000000000000000000000000000deadc0de&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x00000000000000000000000000000000000000000000000000000000feedbeef&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;PooledTransactionsPacket66&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;rlp&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xf8d7820457f8d2f867088504a817c8088302e2489435353535353535353535353535353535353535358202008025a064b1702d9298fee62dfeccc57d322a463ad55ca201256d01f62b45b2e1c21c12a064b1702d9298fee62dfeccc57d322a463ad55ca201256d01f62b45b2e1c21c10f867098504a817c809830334509435353535353535353535353535353535353535358202d98025a052f8f61201b2b11a78d6e866abc9c3db2ae8631fa656bfe5cb53668255367afba052f8f61201b2b11a78d6e866abc9c3db2ae8631fa656bfe5cb53668255367afb&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;RequestId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1111&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;PooledTransactionsPacket&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x8&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gasPrice&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x4a817c808&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x2e248&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x3535353535353535353535353535353535353535&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x200&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;input&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;v&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x25&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x64b1702d9298fee62dfeccc57d322a463ad55ca201256d01f62b45b2e1c21c12&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x64b1702d9298fee62dfeccc57d322a463ad55ca201256d01f62b45b2e1c21c10&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x588df025c4c2d757d3e314bd3dfbfe352687324e6b8557ad1731585e96928aed&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x9&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gasPrice&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x4a817c809&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x33450&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x3535353535353535353535353535353535353535&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x2d9&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;input&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;v&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x25&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x52f8f61201b2b11a78d6e866abc9c3db2ae8631fa656bfe5cb53668255367afb&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x52f8f61201b2b11a78d6e866abc9c3db2ae8631fa656bfe5cb53668255367afb&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xf39c7dac06a9f3abf09faf5e30439a349d3717611b3ed337cd52b0d192bc72da&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;None&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Singleton Factory</title>
        <published>2020-01-15T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Ricardo Guilherme Schmidt</name><uri>https://github.com/3esmit</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2470/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-2470-singleton-factory/3933" />
        

        <id>https://wg-eips.ritovision.com/2470/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:2470"
            label="ERC-2470" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2470/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Some DApps needs one, and only one, instance of an contract, which have the same address on any chain.&lt;&#x2F;p&gt;
&lt;p&gt;A permissionless factory for deploy of keyless deterministic contracts addresses based on its bytecode.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Some contracts are designed to be Singletons which have the same address no matter what chain they are, which means that should exist one instance for all, such as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1820&#x2F;&quot;&gt;EIP-1820&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;gitlab.com&#x2F;status-im&#x2F;docs&#x2F;EIPs&#x2F;blob&#x2F;secret-multisig-recovery&#x2F;EIPS&#x2F;.&#x2F;02429.md&quot;&gt;EIP-2429&lt;&#x2F;a&gt;. These contracts are usually deployed using a method known as &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;Arachnid&#x2F;&quot;&gt;Nick&lt;&#x2F;a&gt;&#x27;s method, so anyone can deploy those contracts on any chain and they have a deterministic address.
This standard proposes the creation of a CREATE2 factory using this method, so other projects requiring this feature can use this factory in any chain with the same setup, even in development chains.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Code reuse, using the factory becomes easier to deploy singletons.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;erc-2470-singleton-factory&quot;&gt;[ERC-2470] Singleton Factory&lt;&#x2F;h3&gt;
&lt;blockquote&gt;
&lt;p&gt;This is an exact copy of the code of the [ERC2470 factory smart contract].&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0.6.2&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Singleton Factory (EIP-2470)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Exposes CREATE2 (EIP-1014) to deploy bytecode on deterministic addresses based on initialization code and salt.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@author&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Ricardo Guilherme Schmidt (Status Research &amp;amp; Development GmbH)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SingletonFactory&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Deploys `_initCode` using `_salt` for defining the deterministic address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _initCode&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Initialization code.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _salt&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Arbitrary value to modify resulting address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; createdContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Created contract address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; deploy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _initCode&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _salt&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        public&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; createdContract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            createdContract &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; create2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_initCode&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_initCode&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _salt&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; IV is a value &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; to generate the vanity address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; IV: 6583047&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;deployment-transaction&quot;&gt;Deployment Transaction&lt;&#x2F;h3&gt;
&lt;p&gt;Below is the raw transaction which MUST be used to deploy the smart contract on any chain.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xf9016c8085174876e8008303c4d88080b90154608060405234801561001057600080fd5b50610134806100206000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c80634af63f0214602d575b600080fd5b60cf60048036036040811015604157600080fd5b810190602081018135640100000000811115605b57600080fd5b820183602082011115606c57600080fd5b80359060200191846001830284011164010000000083111715608d57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550509135925060eb915050565b604080516001600160a01b039092168252519081900360200190f35b6000818351602085016000f5939250505056fea26469706673582212206b44f8a82cb6b156bfcc3dc6aadd6df4eefd204bc928a4397fd15dacf6d5320564736f6c634300060200331b83247000822470&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The strings of &lt;code&gt;2470&lt;&#x2F;code&gt;&#x27;s at the end of the transaction are the &lt;code&gt;r&lt;&#x2F;code&gt; and &lt;code&gt;s&lt;&#x2F;code&gt; of the signature.
From this deterministic pattern (generated by a human), anyone can deduce that no one knows the private key for the deployment account.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;deployment-method&quot;&gt;Deployment Method&lt;&#x2F;h3&gt;
&lt;p&gt;This contract is going to be deployed using the keyless deployment method---also known as &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;Arachnid&#x2F;&quot;&gt;Nick&lt;&#x2F;a&gt;&#x27;s method---which relies on a single-use address.
(See &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;medium.com&#x2F;@weka&#x2F;how-to-send-ether-to-11-440-people-187e332566b7&quot;&gt;Nick&#x27;s article&lt;&#x2F;a&gt; for more details). This method works as follows:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Generate a transaction which deploys the contract from a new random account.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;ul&gt;
&lt;li&gt;This transaction MUST NOT use &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt; in order to work on any chain.&lt;&#x2F;li&gt;
&lt;li&gt;This transaction MUST have a relatively high gas price to be deployed on any chain. In this case, it is going to be 100 Gwei.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;ol start=&quot;2&quot;&gt;
&lt;li&gt;
&lt;p&gt;Forge a transaction with the following parameters:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    gasPrice&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 100000000000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x608060405234801561001057600080fd5b50610134806100206000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c80634af63f0214602d575b600080fd5b60cf60048036036040811015604157600080fd5b810190602081018135640100000000811115605b57600080fd5b820183602082011115606c57600080fd5b80359060200191846001830284011164010000000083111715608d57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550509135925060eb915050565b604080516001600160a01b039092168252519081900360200190f35b6000818351602085016000f5939250505056fea26469706673582212206b44f8a82cb6b156bfcc3dc6aadd6df4eefd204bc928a4397fd15dacf6d5320564736f6c63430006020033&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    gasLimit&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 247000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    v&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 27&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    r&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x247000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    s&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x2470&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;blockquote&gt;
&lt;p&gt;The &lt;code&gt;r&lt;&#x2F;code&gt; and &lt;code&gt;s&lt;&#x2F;code&gt; values, made of starting &lt;code&gt;2470&lt;&#x2F;code&gt;, are obviously a human determined value, instead of a real signature.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;We recover the sender of this transaction, i.e., the single-use deployment account.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Thus we obtain an account that can broadcast that transaction, but we also have the warranty that nobody knows the private key of that account.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Send exactly 0.0247 ether to this single-use deployment account.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Broadcast the deployment transaction.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Note: 247000 is the double of gas needed to deploy the smart contract, this ensures that future changes in OPCODE pricing are unlikely to cause this deploy transaction to fail out of gas. A left over will sit in the address of about 0.01 ETH will be forever locked in the single use address.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The resulting transaction hash is &lt;code&gt;0x803351deb6d745e91545a6a3e1c0ea3e9a6a02a1a4193b70edfcd2f40f71a01c&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This operation can be done on any chain, guaranteeing that the contract address is always the same and nobody can use that address with a different contract.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;single-use-factory-deployment-account&quot;&gt;Single-use Factory Deployment Account&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;img src=&quot;data:image&#x2F;png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAB0UlEQVR4nO3asW1CQRBAQdpyCa6CIpxTjgujDGTJNEC2QqvjTbDx33c3P7vL79f1fzLf98dobn8&#x2F;o5nuP53p&#x2F;tPzm+5&#x2F;AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4CMBnH6B0&#x2F;23L2AbEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJ8JYPsCtw+w3g9AvB+AeD8A8X4A4v0AxPsBiPcDEO8HIN4PQLwfgHg&#x2F;APF+AOL9AMT7AYj3AxDvP&#x2F;5ByOkApt&#x2F;PvwgCAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgJYDtA9w+gO0fYHsAAGB&#x2F;CQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAdALYfNExnun+9H4B4PwDxfgDi&#x2F;QDE+wGI9wMQ7wcg3g9AvB+AeD8A8X4A4v0AxPsBiPcDEO8HIN4&#x2F;fhCy&#x2F;aDidADb5wcAAGcHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAO8CsH2ApwPY&#x2F;j4Ah+8PAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPB6nlegoDNgrfyiAAAAAElFTkSuQmCC&quot; alt=&quot;&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;0xBb6e024b9cFFACB947A71991E386681B1Cd1477D&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;This account is generated by reverse engineering it from its signature for the transaction.
This way no one knows the private key, but it is known that it is the valid signer of the deployment transaction.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;To deploy the registry, 0.0247 ether MUST be sent to this account &lt;em&gt;first&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h3 id=&quot;factory-contract-address&quot;&gt;Factory Contract Address&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;img src=&quot;data:image&#x2F;png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAABn0lEQVR4nO3coRECMRRF0S2GutCUQzd4WqAMLB4qQGWYP+EecXXeZo&#x2F;OcTrf35Ndbq+l7F&#x2F;rmB6w+wXuvh+A+H4A4vsBiO8HIL4fgPh+AOL7AYjvByC+H4D4fgDi+wGI7wcgvh+A+H4A4vuXAUxfwPX5GG33+wMAgL0&#x2F;AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPgGYHrA9A+cbhoQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA&#x2F;wlgesD0+bvvXz0fgM33AwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB8ATB9gZoNgHgAxAMgHgDxAIgHQDwA4gEQD4B4AMQDIB4A8QCIB0A8AOId0w8caK3V&#x2F;wfA5gEQD4B4AMQDIB4A8QCIB0A8AOIBEA+AeADEAyAeAPEAiAdAPADiARAPgHgAxAMgHgDxAIgHQDwA4gEQD4B4AMQDIB4A8QCItwxg+oECDT8QMT1AAAgAASAABIAAEAACQAAIAAEgAASAANAv+gDxVDRR1CVqRAAAAABJRU5ErkJggg==&quot; alt=&quot;&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;0xce0042B868300000d44A59004Da54A005ffdcf9f&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The contract has the address above for every chain on which it is deployed.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;abi-for-singletonfactory&quot;&gt;ABI for SingletonFactory:&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;internalType&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_initCode&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;internalType&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_salt&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;deploy&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;outputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;internalType&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;createdContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;stateMutability&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;nonpayable&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;SingletonFactory does not allow sending value on create2, this was done to prevent different results on the created object.
SingletonFactory allows user defined salt to facilitate the creation of vanity addresses for other projects. If vanity address is not necessary, salt &lt;code&gt;bytes(0)&lt;&#x2F;code&gt; should be used.
Contracts that are constructed by the SingletonFactory MUST not use &lt;code&gt;msg.sender&lt;&#x2F;code&gt; in their constructor, all variables must came through initialization data. This is intentional, as if allowing a callback after creation to aid initialization state would lead to contracts with same address (but different chains) to have the same address but different initial state.
The resulting address can be calculated in chain by any contract using this formula: &lt;code&gt;address(keccak256(bytes1(0xff), 0xce0042B868300000d44A59004Da54A005ffdcf9f, _salt, keccak256(_code)) &amp;lt;&amp;lt; 96)&lt;&#x2F;code&gt; or in javascript using https:&#x2F;&#x2F;github.com&#x2F;ethereumjs&#x2F;ethereumjs-util&#x2F;blob&#x2F;master&#x2F;docs&#x2F;README.md#const-generateaddress2.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Does not apply as there are no past versions of Singleton Factory being used.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;https:&#x2F;&#x2F;github.com&#x2F;3esmit&#x2F;ERC2470&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Some contracts can possibly not support being deployed on any chain, or require a different address per chain, that can be safely done by using comparison in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1344&#x2F;&quot;&gt;EIP-1344&lt;&#x2F;a&gt; in constructor.
Account contracts are singletons in the point of view of each user, when wallets want to signal what chain id is intended, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1191&#x2F;&quot;&gt;EIP-1191&lt;&#x2F;a&gt; should be used.
Contracts deployed on factory must not use &lt;code&gt;msg.sender&lt;&#x2F;code&gt; in constructor, instead use constructor parameters, otherwise the factory would end up being the controller&#x2F;only owner of those.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>&quot;eth&#x2F;65: transaction announcements and retrievals&quot;</title>
        <published>2020-01-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Péter Szilágyi</name><email>peterke@gmail.com</email>
	</author>
	
	<author>
		<name>Péter Szilágyi</name><uri>https://github.com/karalabe</uri>
	</author>
	
	<author>
		<name>Gary Rong</name><email>garyrong0905@gmail.com</email>
	</author>
	
	<author>
		<name>Tim Beiko</name><uri>https://github.com/timbeiko</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2464/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/2465" />
        

        <id>https://wg-eips.ritovision.com/2464/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="networking"
                label="Networking" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2464"
            label="EIP-2464" />
        

        
        

        
        <summary type="html">Introduces `NewPooledTransactionHashes`, `GetPooledTransactions`, and `PooledTransactions`.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2464/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces three additional message types into the &lt;code&gt;eth&lt;&#x2F;code&gt; protocol (releasing a new version, &lt;code&gt;eth&#x2F;65&lt;&#x2F;code&gt;): &lt;code&gt;NewPooledTransactionHashes (0x08)&lt;&#x2F;code&gt; to announce a set of transactions without their content; &lt;code&gt;GetPooledTransactions (0x09)&lt;&#x2F;code&gt; to request a batch of transactions by their announced hash; and &lt;code&gt;PooledTransactions (0x0a)&lt;&#x2F;code&gt; to reply to a transaction request. This permits reducing the bandwidth used for transaction propagation from linear complexity in the number of peers to square root; and also reducing the initial transaction exchange from 10s-100s MB to &lt;code&gt;len(pool) * 32B ~= 128KB&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;eth&lt;&#x2F;code&gt; network protocol has two ways to propagate a newly mined block: it can be broadcast to a peer in its entirety (via &lt;code&gt;NewBlock (0x07)&lt;&#x2F;code&gt; in &lt;code&gt;eth&#x2F;64&lt;&#x2F;code&gt; and prior or it can be announced only (via &lt;code&gt;NewBlockHashes (0x01)&lt;&#x2F;code&gt;). This duality allows nodes to do the high-bandwidth broadcasting (10s-100s KB) for a square root number of peers; and the low-bandwidth announcing (10s-100s B) for the remaining linear number of peers. The square root broadcast is enough to reach all well connected nodes, but the linear announce is needed to get across degenerate topologies. This works well.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;eth&lt;&#x2F;code&gt; protocol, however, does not have a similar dual mechanism for propagating transactions, so nodes need to rely on broadcasting (via &lt;code&gt;Transactions (0x02)&lt;&#x2F;code&gt;). To cater for degenerate topologies, transactions cannot be broadcast square rooted, rather they need to be transferred linearly to all peers. With N peers, each node will transfer the same transaction N times (counting both directions), whereas 1 would be enough in a perfect world. This is a significant waste.&lt;&#x2F;p&gt;
&lt;p&gt;A similar issue arises when a new network connection is made between two nodes, as they need to sync up their transaction pools, but the pool is just a soup of dangling transactions. Without a way to deduplicate transactions remotely, each node is forced to naively transfer their entire list of transactions to the other side. With pools containing thousands of transactions, a naive transfer amounts to 10s-100s MB, most of which is useless. There is no better way, however.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP introduces three additional message types into the &lt;code&gt;eth&lt;&#x2F;code&gt; protocol (releasing a new version, &lt;code&gt;eth&#x2F;65&lt;&#x2F;code&gt;): &lt;code&gt;NewPooledTransactionHashes (0x08)&lt;&#x2F;code&gt; to announce a set of transactions without their content; &lt;code&gt;GetPooledTransactions (0x09)&lt;&#x2F;code&gt; to request a batch of transactions by their announced hash; and &lt;code&gt;PooledTransactions (0x0a)&lt;&#x2F;code&gt; to reply to a transaction request. This permits reducing the bandwidth used for transaction propagation from linear complexity in the number of peers to square root; and also reducing the initial transaction exchange from 10s-100s MB to &lt;code&gt;len(pool) * 32B ~= 128KB&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;With transaction throughput (and size) picking up in Ethereum, transaction propagation is the current dominant component of the used network resources. Most of these resources are however wasted, as the &lt;code&gt;eth&lt;&#x2F;code&gt; protocol does not have a mechanism to deduplicate transactions remotely, so the same data is transferred over and over again across all network connections.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP proposes a tiny extension to the &lt;code&gt;eth&lt;&#x2F;code&gt; protocol, which permits nodes to agree on the set of transactions that need to be transferred across a network connection, before doing the costly exchange. This should help reduce the global (operational) bandwidth usage of the Ethereum network by at least an order of magnitude.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Add three new message types to the &lt;code&gt;eth&lt;&#x2F;code&gt; protocol:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;NewPooledTransactionHashes (0x08): [hash_0: B_32, hash_1: B_32, ...]&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;Specify one or more transactions that have appeared in the network and which have &lt;strong&gt;not yet been included in a block&lt;&#x2F;strong&gt;. To be maximally helpful, nodes should inform peers of all transactions that they may not be aware of.&lt;&#x2F;li&gt;
&lt;li&gt;There is &lt;strong&gt;no protocol violating hard cap&lt;&#x2F;strong&gt; on the number of hashes a node may announce to a remote peer (apart from the 10MB &lt;code&gt;devp2p&lt;&#x2F;code&gt; network packet limit), but 4096 seems a sane chunk (128KB) to avoid a single packet hogging a network connection.&lt;&#x2F;li&gt;
&lt;li&gt;Nodes should only announce hashes of transactions that the remote peer could reasonably be considered not to know, but it is better to be over zealous than to have a nonce gap in the pool.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;GetPooledTransactions (0x09): [hash_0: B_32, hash_1: B_32, ...]&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;Specify one or more transactions to retrieve from a remote peer&#x27;s &lt;strong&gt;transaction pool&lt;&#x2F;strong&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;There is &lt;strong&gt;no protocol violating hard cap&lt;&#x2F;strong&gt; on the number of transactions a node may request from a remote peer (apart from the 10MB &lt;code&gt;devp2p&lt;&#x2F;code&gt; network packet limit), but the recipient may enforce an arbitrary cap on the reply (size or serving time), which &lt;strong&gt;must not&lt;&#x2F;strong&gt; be considered a protocol violation. To keep wasted bandwidth down (unanswered hashes), 256 seems like a sane upper limit.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;PooledTransactions (0x0a): [[nonce: P, receivingAddress: B_20, value: P, ...], ...]&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;Specify transactions &lt;strong&gt;from the local transaction pool&lt;&#x2F;strong&gt; that the remote node requested via a &lt;code&gt;GetPooledTransactions (0x09)&lt;&#x2F;code&gt; message. The items in the list are transactions in the format described in the main Ethereum specification.&lt;&#x2F;li&gt;
&lt;li&gt;The transactions &lt;strong&gt;must&lt;&#x2F;strong&gt; be in same order as in the request, but it is &lt;strong&gt;ok&lt;&#x2F;strong&gt; to skip transactions that are not available. This way if the response size limit is reached, requesters will know which hashes to request again (everything from the last returned transaction) and which to assume unavailable (all gaps before the last returned transaction).&lt;&#x2F;li&gt;
&lt;li&gt;A peer may respond with an empty reply &lt;strong&gt;iff&lt;&#x2F;strong&gt; none of the hashes match transactions in its pool. It is allowed to announce a transaction that will not be served later if it gets included in a block in between.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;Q: Why limit &lt;code&gt;GetPooledTransactions (0x09)&lt;&#x2F;code&gt; to retrieving items from the pool?&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Apart from the transaction pool, transactions in Ethereum are always bundled together by the hundreds in block bodies and existing network retrievals honor this data layout. Allowing direct access to individual transactions in the database has no actionable use case, but would expose costly database reads into the network.&lt;&#x2F;p&gt;
&lt;p&gt;For transaction propagation purposes there is no reason to allow disk access, as any transaction finalized to disk will be broadcast inside a block anyway, so at worse there is a few hundred millisecond delay when a node gets the transaction.&lt;&#x2F;p&gt;
&lt;p&gt;Block propagation may be made a bit more optimal by transferring the contained transactions on demand only, but that is a whole EIP in itself, so better relax the protocol when all the requirements are known and not in advance. It would probably be enough to maintain a set of transactions included in recent blocks in memory.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Q: Should &lt;code&gt;NewPooledTransactionHashes (0x08)&lt;&#x2F;code&gt; deduplicate from disk?&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Similarly to &lt;code&gt;GetPooledTransactions (0x09)&lt;&#x2F;code&gt;, &lt;code&gt;NewPooledTransactionHashes (0x08)&lt;&#x2F;code&gt; should also only operate on the transaction pool and should ignore the disk altogether. During healthy network conditions, a transaction will propagate through much faster than it&#x27;s included in a block, so it will essentially be non-existent that a newly announced transaction is already on disk. By avoiding disk deduplication, we can avoid a DoS griefing by remote transaction announces.&lt;&#x2F;p&gt;
&lt;p&gt;If we want to be really correct and avoid even the slightest data race when deduplicating announcements, we can use the same recently-included-transactions trick that we discussed above to discard announcements that have recently become stale.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Q: Why not reuse &lt;code&gt;Transaction (0x02)&lt;&#x2F;code&gt; instead of a new &lt;code&gt;PooledTransactions (0x0a)&lt;&#x2F;code&gt;?&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Originally this EIP reused the existing &lt;code&gt;Transaction (0x02)&lt;&#x2F;code&gt; message as the reply to the &lt;code&gt;GetPooledTransactions (0x09)&lt;&#x2F;code&gt; request. This makes client code more complicated, because nodes constantly gossip &lt;code&gt;Transaction (0x02)&lt;&#x2F;code&gt; messages to each other as broadcasts, so it&#x27;s hard to match up which of the many messages is the actual reply to the request.&lt;&#x2F;p&gt;
&lt;p&gt;By keeping &lt;code&gt;Transaction (0x02)&lt;&#x2F;code&gt; and &lt;code&gt;PooledTransactions (0x0a)&lt;&#x2F;code&gt; as separate messages, we can also leave the protocol more flexible for future optimizations (e.g. adding request IDs, which are meaningless for gossip broadcasts).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP extends the &lt;code&gt;eth&lt;&#x2F;code&gt; protocol in a backwards incompatible way and requires rolling out a new version, &lt;code&gt;eth&#x2F;65&lt;&#x2F;code&gt;. However, &lt;code&gt;devp2p&lt;&#x2F;code&gt; supports running multiple versions of the same wire protocol side-by-side, so rolling out &lt;code&gt;eth&#x2F;65&lt;&#x2F;code&gt; does not require client coordination, since non-updated clients can keep using &lt;code&gt;eth&#x2F;64&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP does not change the consensus engine, thus does &lt;em&gt;not&lt;&#x2F;em&gt; require a hard fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;None.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Token Metadata Integrity</title>
        <published>2020-01-02T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Kristijan Sedlak</name><uri>https://github.com/xpepermint</uri>
	</author>
	
	<author>
		<name>William Entriken</name><email>github.com@phor.net</email>
	</author>
	
	<author>
		<name>Witek Radomski</name><email>witek@enjin.io</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2477/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/2483" />
        

        <id>https://wg-eips.ritovision.com/2477/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:2477"
            label="ERC-2477" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2477/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;This specification defines a mechanism by which clients may verify that a fetched token metadata document has been delivered without unexpected manipulation.&lt;&#x2F;p&gt;
&lt;p&gt;This is the Web3 counterpart of the W3C Subresource Integrity (SRI) specification.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;An interface &lt;code&gt;ERC2477&lt;&#x2F;code&gt; with two functions &lt;code&gt;tokenURIIntegrity&lt;&#x2F;code&gt; and &lt;code&gt;tokenURISchemaIntegrity&lt;&#x2F;code&gt; are specified for smart contracts and a narrative is provided to explain how this improves the integrity of the token metadata documents.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Tokens are being used in many applications to represent, trace and provide access to assets off-chain. These assets include in-game digital items in mobile apps, luxury watches and products in our global supply chain, among many other creative uses.&lt;&#x2F;p&gt;
&lt;p&gt;Several token standards allow attaching metadata to specific tokens using a URI (RFC 3986) and these are supported by the applications mentioned above. These metadata standards are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;ERC-721 metadata extension (&lt;code&gt;ERC721Metadata&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;ERC-1155 metadata extension (&lt;code&gt;ERC1155Metadata_URI&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;ERC-1046 (DRAFT) ERC-20 Metadata Extension&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Although all these standards allow storing the metadata entirely on-chain (using the &quot;data&quot; URI, RFC 2397), or using a content-addressable system (e.g. IPFS&#x27;s Content IDentifiers [sic]), nearly every implementation we have found is using Uniform Resource Locators (the exception is The Sandbox which uses IPFS URIs). These URLs provide no guarantees of content correctness or immutability. This standard adds such guarantees.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;design&quot;&gt;Design&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;Approach A:&lt;&#x2F;strong&gt; A token contract may reference metadata by using its URL. This provides no integrity protection because  the referenced metadata and&#x2F;or schema could change at any time if the hosted content is mutable. This is the world before EIP-2477:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;┌───────────────────────┐       ┌────────┐      ┌────────┐&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│        TokenID        │──────▶│Metadata│─────▶│ Schema │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;└───────────────────────┘       └────────┘      └────────┘&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note: according to the JSON Schema project, a metadata document referencing a schema using a URI in the &lt;code&gt;$schema&lt;&#x2F;code&gt; key is a known approach, but it is not standardized.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Approach B:&lt;&#x2F;strong&gt; EIP-2477 provides mechanisms to establish integrity for these references. In one approach, there is integrity for the metadata document. Here, the on-chain data includes a hash of the metadata document. The metadata may or may not reference a schema. In this approach, changing the metadata document will require updating on-chain &lt;code&gt;tokenURIIntegrity&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;┌───────────────────────┐       ┌────────┐      ┌ ─ ─ ─ ─ &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│        TokenID        │──────▶│Metadata│─ ─ ─▶  Schema │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;└───────────────────────┘       └────────┘      └ ─ ─ ─ ─ &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;┌───────────────────────┐            ▲                    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│   tokenURIIntegrity   │════════════╝                    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;└───────────────────────┘                                 &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Approach C:&lt;&#x2F;strong&gt; In a stronger approach, the schema is referenced by the metadata using an extension to JSON Schema, providing integrity. In this approach, changing the metadata document or the schema will require updating on-chain &lt;code&gt;tokenURIIntegrity&lt;&#x2F;code&gt; and the metadata document, additionally changing the schema requires updating the on-chain &lt;code&gt;tokenURISchemaIntegrity&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;┌───────────────────────┐       ┌────────┐      ┌────────┐&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│        TokenID        │──────▶│Metadata│═════▶│ Schema │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;└───────────────────────┘       └────────┘      └────────┘&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;┌───────────────────────┐            ▲                    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│   tokenURIIntegrity   │════════════╝                    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;└───────────────────────┘                                 &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Approach D:&lt;&#x2F;strong&gt; Equally strong, the metadata can make a normal reference (no integrity protection) to the schema and on-chain data also includes a hash of the schema document. In this approach, changing the metadata document will require updating on-chain &lt;code&gt;tokenURIIntegrity&lt;&#x2F;code&gt; and updating the schema document will require updating the &lt;code&gt;tokenURISchemaIntegrity&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;┌───────────────────────┐       ┌────────┐      ┌────────┐&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│        TokenID        │──────▶│Metadata│─────▶│ Schema │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;└───────────────────────┘       └────────┘      └────────┘&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;┌───────────────────────┐            ▲               ▲    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│   tokenURIIntegrity   │════════════╝               ║    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;└───────────────────────┘                            ║    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;┌───────────────────────┐                            ║    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│tokenURISchemaIntegrity│════════════════════════════╝    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;└───────────────────────┘&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Approach E:&lt;&#x2F;strong&gt; Lastly, the schema can be referenced with integrity from the metadata and also using on-chain data. In this approach, changing the metadata document or the schema will require updating on-chain &lt;code&gt;tokenURIIntegrity&lt;&#x2F;code&gt; and the metadata document, additionally changing the schema requires updating the on-chain &lt;code&gt;tokenURISchemaIntegrity&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;┌───────────────────────┐       ┌────────┐      ┌────────┐&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│        TokenID        │──────▶│Metadata│═════▶│ Schema │&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;└───────────────────────┘       └────────┘      └────────┘&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;┌───────────────────────┐            ▲               ▲    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│   tokenURIIntegrity   │════════════╝               ║    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;└───────────────────────┘                            ║    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;┌───────────────────────┐                            ║    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│tokenURISchemaIntegrity│════════════════════════════╝    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;└───────────────────────┘                                 &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;smart-contracts&quot;&gt;Smart contracts&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;Smart contracts implementing the ERC-2477 standard MUST implement the &lt;code&gt;ERC2477&lt;&#x2F;code&gt; interface.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.7&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-2477 Token Metadata Integrity&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-2477&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ERC-165 identifier for this interface is 0x832a7e0e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC2477&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is ERC165 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the cryptographic hash of the specified tokenID&amp;#39;s metadata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;       Identifier for a specific token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; digest&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;        Bytes returned from the hash algorithm, or &amp;quot;&amp;quot; if not available&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; hashAlgorithm&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The name of the cryptographic hash algorithm, or &amp;quot;&amp;quot; if not available&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenURIIntegrity&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; digest&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; hashAlgorithm&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the cryptographic hash for the specified tokenID&amp;#39;s metadata schema&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;       Identifier for a specific token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; digest&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;        Bytes returned from the hash algorithm, or &amp;quot;&amp;quot; if not available&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; hashAlgorithm&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The name of the cryptographic hash algorithm, or &amp;quot;&amp;quot; if not available&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenURISchemaIntegrity&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; digest&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; hashAlgorithm&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The returned cryptographic hashes correspond to the token&#x27;s metadata document and that metadata document&#x27;s schema, respectively.&lt;&#x2F;p&gt;
&lt;p&gt;For example, with ERC-721 &lt;code&gt;tokenURIIntegrity(21)&lt;&#x2F;code&gt; would correspond to &lt;code&gt;tokenURI(21)&lt;&#x2F;code&gt;. With ERC-1155, &lt;code&gt;tokenURIIntegrity(16)&lt;&#x2F;code&gt; would correspond to &lt;code&gt;uri(16)&lt;&#x2F;code&gt;. In both cases, &lt;code&gt;tokenURISchemaIntegrity(32)&lt;&#x2F;code&gt; would correspond to the schema of the document matched by &lt;code&gt;tokenURIIntegrity(32)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Smart contracts implementing the ERC-2477 standard MUST implement the ERC-165 standard, including the interface identifiers above.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Smart contracts implementing the ERC-2477 standard MAY use any hashing or content integrity scheme.&lt;&#x2F;p&gt;
&lt;p&gt;Smart contracts implementing the ERC-2477 standard MAY use or omit a mechanism to notify when the integrity is updated (e.g. an Ethereum logging operation).&lt;&#x2F;p&gt;
&lt;p&gt;Smart contracts implementing the ERC-2477 standard MAY use any mechanism to provide schemas for metadata documents and SHOULD use JSON-LD on the metadata document for this purpose (i.e.  &lt;code&gt;&quot;@schema&quot;:...&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;metadata&quot;&gt;Metadata&lt;&#x2F;h3&gt;
&lt;p&gt;A metadata document MAY conform to this schema to provide referential integrity to its schema document.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;EIP-2477 JSON Object With Refererential Integrity to Schema&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;$schema&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uri&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;$schemaIntegrity&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;digest&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;hashAlgorithm&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;required&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;digest&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;hashAlgorithm&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;required&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;$schema&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;$schemaIntegrity&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;clients&quot;&gt;Clients&lt;&#x2F;h3&gt;
&lt;p&gt;A client implementing the ERC-2477 standard MUST support at least the &lt;code&gt;sha256&lt;&#x2F;code&gt; hash algorithm and MAY support other algorithms.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;caveats&quot;&gt;Caveats&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;This EIP metadata lists ERC-721 and ERC-1155 as &quot;required&quot; for implementation, due to a technical limitation of EIP metadata. In actuality, this standard is usable with any token implementation that has a &lt;code&gt;tokenURI(uint id)&lt;&#x2F;code&gt; or similar function.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;Function and parameter naming&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The W3C Subresource Integrity (SRI) specification uses the attribute &quot;integrity&quot; to perform integrity verification. This ERC-2477 standard provides a similar mechanism and reuses the integrity name so as to be familiar to people that have seen SRI before.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Function return tuple&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The SRI integrity attribute encodes elements of the tuple $$(cryptographic\ hash\ function, digest, options)$$. This ERC-2477 standard returns a digest and hash function name and omits forward-compatibility options.&lt;&#x2F;p&gt;
&lt;p&gt;Currently, the SRI specification does not make use of options. So we cannot know what format they might be when implemented. This is the motivation to exclude this parameter.&lt;&#x2F;p&gt;
&lt;p&gt;The digest return value is first, this is an optimization because we expect on-chain implementations will be more likely to use this return value if they will only be using one of the two.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Function return types&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The digest is a byte array and supports various hash lengths. This is consistent with SRI. Whereas SRI uses base64 encoding to target an HTML document, we use a byte array because Ethereum already allows this encoding.&lt;&#x2F;p&gt;
&lt;p&gt;The hash function name is a string. Currently there is no universal taxonomy of hash function names. SRI recognizes the names &lt;code&gt;sha256&lt;&#x2F;code&gt;, &lt;code&gt;sha384&lt;&#x2F;code&gt; and &lt;code&gt;sha512&lt;&#x2F;code&gt; with case-insensitive matching. We are aware of two authorities which provide taxonomies and canonical names for hash functions: ETSI Object Identifiers and NIST Computer Security Objects Register. However, SRI&#x27;s approach is easier to follow and we have adopted this here.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Function return type — hash length&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Clients must support the SHA-256 algorithm and may optionally support others. This is a departure from the SRI specification where SHA-256, SHA-384 and SHA-512 are all required. The rationale for this less-secure requirement is because we expect some clients to be on-chain. Currently SHA-256 is simple and cheap to do on Ethereum whereas SHA-384 and SHA-512 are more expensive and cumbersome.&lt;&#x2F;p&gt;
&lt;p&gt;The most popular hash function size below 256 bits in current use is SHA-1 at 160 bits. Multiple collisions (the &quot;Shattered&quot; PDF file, the 320 byte file, the chosen prefix) have been published and a recipe is given to generate infinitely more collisions. SHA-1 is broken. The United States National Institute of Standards and Technology (NIST) has first deprecated SHA-1 for certain use cases in November 2015 and has later further expanded this deprecation.&lt;&#x2F;p&gt;
&lt;p&gt;The most popular hash function size above 256 bits in current use is SHA-384 as specified by NIST.&lt;&#x2F;p&gt;
&lt;p&gt;The United States National Security Agency requires a hash length of 384 or more bits for the SHA-2 (CNSA Suite Factsheet) algorithm suite for use on TOP SECRET networks. (No unclassified documents are currently available to specify use cases at higher classification networks.)&lt;&#x2F;p&gt;
&lt;p&gt;We suspect that SHA-256 and the 0xcert Asset Certification will be popular choices to secure token metadata for the foreseeable future.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;In-band signaling&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;One possible way to achieve strong content integrity with the existing token standards would be to include, for example, a &lt;code&gt;?integrity=XXXXX&lt;&#x2F;code&gt; at the end of all URLs. This approach is not used by any existing implementations we know about. There are a few reasons we have not chosen this approach. The strongest reason is that the World Wide Web has the same problem and they chose to use the Sub-Resource Integrity approach, which is a separate data field than the URL.&lt;&#x2F;p&gt;
&lt;p&gt;Other supplementary reasons are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;For on-chain consumers of data, it is easier to parse a direct hash field than to perform string operations.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Maybe there are some URIs which are not amenable to being modified in that way, therefore limiting the generalizability of that approach.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This design justification also applies to &lt;code&gt;tokenURISchemaIntegrity&lt;&#x2F;code&gt;. The current JSON-LD specification allows a JSON document to link to a schema document. But it does not provide integrity. Rather than changing how JSON-LD works, or changing JSON Schemas, we have the &lt;code&gt;tokenURISchemaIntegrity&lt;&#x2F;code&gt; property to just provide the integrity.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Both ERC-721 and ERC-1155 provide compatible token metadata specifications that use URIs and JSON schemas. The ERC-2477 standard is compatible with both, and all specifications are additive. Therefore, there are no backward compatibility regressions.&lt;&#x2F;p&gt;
&lt;p&gt;ERC-1523 Standard for Insurance Policies as ERC-721 Non Fungible Tokens (DRAFT) proposes an extension to ERC-721 which also tightens the requirements on metadata. Because it is wholly an extension of ERC-721, ERC-1523 is automatically supported by ERC-2477 (since this standard already supports ERC-721).&lt;&#x2F;p&gt;
&lt;p&gt;ERC-1046 (DRAFT) ERC-20 Metadata Extension proposes a comparate extension for ERC-20. Such a concept is outside the scope of this ERC-2477 standard. Should ERC-1046 (DRAFT) be finalized, we will welcome a new ERC which copies ERC-2477 and removes the &lt;code&gt;tokenId&lt;&#x2F;code&gt; parameter.&lt;&#x2F;p&gt;
&lt;p&gt;Similarly, ERC-918 (DRAFT) Mineable Token Standard proposes an extension for ERC-20 and also includes metadata. The same comment applies here as ERC-1046.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Following is a token metadata document which is simultaneously compatible with ERC-721, ERC-1155 and ERC-2477 standards.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;$schema&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;URL_TO_SCHEMA_DOCUMENT&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Asset Name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Lorem ipsum...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;image&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&#x2F;&#x2F;s3.amazonaws.com&#x2F;your-bucket&#x2F;images&#x2F;{id}.png&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This above example shows how JSON-LD is employed to reference the schema document (&lt;code&gt;$schema&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;Following is a corresponding schema document which is accessible using the URI &lt;code&gt;&quot;https:&#x2F;&#x2F;URL_TO_SCHEMA_DOCUMENT&quot;&lt;&#x2F;code&gt; above.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Identifies the asset to which this NFT represents&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Describes the asset to which this NFT represents&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;image&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A URI pointing to a resource with mime type image&#x2F;* representing the asset to which this NFT represents. Consider making any images at a width between 320 and 1080 pixels and aspect ratio between 1.91:1 and 4:5 inclusive.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Assume that the metadata and schema above apply to a token with identifier 1234. (In ERC-721 this would be a specific token, in ERC-1155 this would be a token type.) Then these two function calls MAY have the following output:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;function tokenURIIntegrity(1234)&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;bytes digest &lt;&#x2F;code&gt;: &lt;code&gt;3fc58b72faff20684f1925fd379907e22e96b660&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;string hashAlgorithm&lt;&#x2F;code&gt;: &lt;code&gt;sha256&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;function tokenURISchemaIntegrity(1234)&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;bytes digest &lt;&#x2F;code&gt;: &lt;code&gt;ddb61583d82e87502d5ee94e3f2237f864eeff72&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;string hashAlgorithm&lt;&#x2F;code&gt;: &lt;code&gt;sha256&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;To avoid doubt: the previous paragraph specifies &quot;MAY&quot; have that output because other hash functions are also acceptable.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;0xcert Framework supports ERC-2477.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference&quot;&gt;Reference&lt;&#x2F;h2&gt;
&lt;p&gt;Normative standard references&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;RFC 2119 Key words for use in RFCs to Indicate Requirement Levels. https:&#x2F;&#x2F;www.ietf.org&#x2F;rfc&#x2F;rfc2119.txt&lt;&#x2F;li&gt;
&lt;li&gt;ERC-165 Standard Interface Detection. .&#x2F;00165.md&lt;&#x2F;li&gt;
&lt;li&gt;ERC-721 Non-Fungible Token Standard. .&#x2F;00721.md&lt;&#x2F;li&gt;
&lt;li&gt;ERC-1155 Multi Token Standard. .&#x2F;01155.md&lt;&#x2F;li&gt;
&lt;li&gt;JSON-LD. https:&#x2F;&#x2F;www.w3.org&#x2F;TR&#x2F;json-ld&#x2F;&lt;&#x2F;li&gt;
&lt;li&gt;Secure Hash Standard (SHS). https:&#x2F;&#x2F;nvlpubs.nist.gov&#x2F;nistpubs&#x2F;FIPS&#x2F;NIST.FIPS.180-4.pdf&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Other standards&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;ERC-1046 ERC-20 Metadata Extension (DRAFT). .&#x2F;01046.md&lt;&#x2F;li&gt;
&lt;li&gt;ERC-918 Mineable Token Standard (DRAFT). .&#x2F;00918.md&lt;&#x2F;li&gt;
&lt;li&gt;ERC-1523 Standard for Insurance Policies as ERC-721 Non Fungible Tokens (DRAFT). .&#x2F;01523.md&lt;&#x2F;li&gt;
&lt;li&gt;W3C Subresource Integrity (SRI). https:&#x2F;&#x2F;www.w3.org&#x2F;TR&#x2F;SRI&#x2F;&lt;&#x2F;li&gt;
&lt;li&gt;The &quot;data&quot; URL scheme. https:&#x2F;&#x2F;tools.ietf.org&#x2F;html&#x2F;rfc2397&lt;&#x2F;li&gt;
&lt;li&gt;Uniform Resource Identifier (URI): Generic Syntax. https:&#x2F;&#x2F;tools.ietf.org&#x2F;html&#x2F;rfc3986&lt;&#x2F;li&gt;
&lt;li&gt;CID [Specification] (DRAFT). https:&#x2F;&#x2F;github.com&#x2F;multiformats&#x2F;cid&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Discussion&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;JSON-LD discussion of referential integrity. https:&#x2F;&#x2F;lists.w3.org&#x2F;Archives&#x2F;Public&#x2F;public-json-ld-wg&#x2F;2020Feb&#x2F;0003.html&lt;&#x2F;li&gt;
&lt;li&gt;JSON Schema use of &lt;code&gt;$schema&lt;&#x2F;code&gt; key for documents. https:&#x2F;&#x2F;github.com&#x2F;json-schema-org&#x2F;json-schema-spec&#x2F;issues&#x2F;647#issuecomment-417362877&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Other&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;[0xcert Framework supports ERC-2477]. https:&#x2F;&#x2F;github.com&#x2F;0xcert&#x2F;framework&#x2F;pull&#x2F;717&lt;&#x2F;li&gt;
&lt;li&gt;[Shattered] The first collision for full SHA-1. https:&#x2F;&#x2F;shattered.io&#x2F;static&#x2F;shattered.pdf&lt;&#x2F;li&gt;
&lt;li&gt;[320 byte file] The second SHA Collision. https:&#x2F;&#x2F;privacylog.blogspot.com&#x2F;2019&#x2F;12&#x2F;the-second-sha-collision.html&lt;&#x2F;li&gt;
&lt;li&gt;[Chosen prefix] https:&#x2F;&#x2F;sha-mbles.github.io&lt;&#x2F;li&gt;
&lt;li&gt;Transitions: Recommendation for Transitioning the Use of Cryptographic Algorithms and Key Lengths. (Rev. 1. Superseded.) https:&#x2F;&#x2F;csrc.nist.gov&#x2F;publications&#x2F;detail&#x2F;sp&#x2F;800-131a&#x2F;rev-1&#x2F;archive&#x2F;2015-11-06&lt;&#x2F;li&gt;
&lt;li&gt;Commercial National Security Algorithm (CNSA) Suite Factsheet. https:&#x2F;&#x2F;apps.nsa.gov&#x2F;iaarchive&#x2F;library&#x2F;ia-guidance&#x2F;ia-solutions-for-classified&#x2F;algorithm-guidance&#x2F;commercial-national-security-algorithm-suite-factsheet.cfm&lt;&#x2F;li&gt;
&lt;li&gt;ETSI Assigned ASN.1 Object Identifiers. https:&#x2F;&#x2F;portal.etsi.org&#x2F;pnns&#x2F;oidlist&lt;&#x2F;li&gt;
&lt;li&gt;Computer Security Objects Register. https:&#x2F;&#x2F;csrc.nist.gov&#x2F;projects&#x2F;computer-security-objects-register&#x2F;algorithm-registration&lt;&#x2F;li&gt;
&lt;li&gt;The Sandbox implementation. https:&#x2F;&#x2F;github.com&#x2F;pixowl&#x2F;sandbox-smart-contracts&#x2F;blob&#x2F;7022ce38f81363b8b75a64e6457f6923d91960d6&#x2F;src&#x2F;Asset&#x2F;ERC1155ERC721.sol&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Deprecate the CALLCODE opcode</title>
        <published>2019-12-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2488/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2488-deprecate-the-callcode-opcode/3957" />
        

        <id>https://wg-eips.ritovision.com/2488/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:2488"
            label="EIP-2488" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2488/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Deprecate &lt;code&gt;CALLCODE&lt;&#x2F;code&gt; in a &lt;em&gt;somewhat&lt;&#x2F;em&gt; backwards compatible way, by making it always return failure.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;CALLCODE&lt;&#x2F;code&gt; was part of the Frontier release of Ethereum. In the first few weeks&#x2F;months it became clear
that it cannot accomplish its intended design goal. This was rectified with introducing &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;
(&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7&#x2F;&quot;&gt;EIP-7&lt;&#x2F;a&gt;) in the Homestead update (early 2016).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;CALLCODE&lt;&#x2F;code&gt; became never utilized, but it still puts a burden on EVM implementations.&lt;&#x2F;p&gt;
&lt;p&gt;Disabling it will not improve the situation for any client whose goal is to sync from genesis, but would
help light clients or clients planning to sync from a later point in time.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= FORK_BLOCK&lt;&#x2F;code&gt;, the &lt;code&gt;CALLCODE&lt;&#x2F;code&gt; (&lt;code&gt;0xf2&lt;&#x2F;code&gt;) instruction always returns &lt;code&gt;0&lt;&#x2F;code&gt;, which signals failure.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;It would be possible just to remove the opcode and exceptionally abort if it is encountered.
However, by returning failure, the contract has a chance to act on it and potentially recover.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This is a breaking change and has a potential to break contracts. The author expects no contracts of any value
should be affected.&lt;&#x2F;p&gt;
&lt;p&gt;TODO: validate this claim.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;TBA&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBA&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TBA&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Ethereum 2 Hierarchical Deterministic Walletstore</title>
        <published>2019-11-21T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Jim McDonald</name><email>Jim@mcdee.net</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2386/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2386-walletstore/3792" />
        

        <id>https://wg-eips.ritovision.com/2386/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2386"
            label="ERC-2386" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2386/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;A JSON format for the storage and retrieval of Ethereum 2 hierarchical deterministic (HD) wallet definitions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Ethereum has the concept of keystores: pieces of data that define a key (see &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-2335&quot;&gt;EIP-2335&lt;&#x2F;a&gt; for details).  This adds the concept of walletstores: stores that define wallets and how keys in said wallets are created.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Hierarchical deterministic wallets create keys from a &lt;em&gt;seed&lt;&#x2F;em&gt; and a &lt;em&gt;path&lt;&#x2F;em&gt;.  The seed needs to be accessible to create new keys, however it should also be protected to the same extent as private keys to stop it from becoming an easy attack vector.  The path, or at least the variable part of it, needs to be stored to ensure that keys are not duplicated.  Providing a standard method to do this can promote interoperability between wallets and similar software.&lt;&#x2F;p&gt;
&lt;p&gt;Given that a wallet has an amount of data and metadata that is useful when accessing existing keys and creating new keys, standardizing this information and how it is stored allows it to be portable between different wallet providers with minimal effort.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The elements of a hierarchical deterministic walletstore are as follows:&lt;&#x2F;p&gt;
&lt;h3 id=&quot;uuid&quot;&gt;UUID&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;uuid&lt;&#x2F;code&gt; provided in the walletstore is a randomly-generated type 4 UUID as specified by &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;tools.ietf.org&#x2F;html&#x2F;rfc4122&quot;&gt;RFC 4122&lt;&#x2F;a&gt;. It is intended to be used as a 128-bit proxy for referring to a particular wallet, used to uniquely identify wallets.&lt;&#x2F;p&gt;
&lt;p&gt;This element MUST be present.  It MUST be a string following the syntactic structure as laid out in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;tools.ietf.org&#x2F;html&#x2F;rfc4122#section-3&quot;&gt;section 3 of RFC 4122&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;name&quot;&gt;Name&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;name&lt;&#x2F;code&gt; provided in the walletstore is a UTF-8 string.  It is intended to serve as the user-friendly accessor.  The only restriction on the name is that it MUST NOT start with the underscore (&lt;code&gt;_&lt;&#x2F;code&gt;) character.&lt;&#x2F;p&gt;
&lt;p&gt;This element MUST be present.  It MUST be a string.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;version&quot;&gt;Version&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;version&lt;&#x2F;code&gt; provided is the version of the walletstore.&lt;&#x2F;p&gt;
&lt;p&gt;This element MUST be present.  It MUST be the integer &lt;code&gt;1&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;type&quot;&gt;Type&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;type&lt;&#x2F;code&gt; provided is the type of wallet.  This informs mechanisms such as key generation.&lt;&#x2F;p&gt;
&lt;p&gt;This element MUST be present.  It MUST be the string &lt;code&gt;hierarchical deterministic&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;crypto&quot;&gt;Crypto&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;crypto&lt;&#x2F;code&gt; provided is the secure storage of a secret for wallets that require this information.  For hierarchical deterministic wallets this is the seed from which they calculate individual private keys.&lt;&#x2F;p&gt;
&lt;p&gt;This element MUST be present.  It MUST be an object that follows the definition described in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-2335&quot;&gt;EIP-2335&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;next-account&quot;&gt;Next Account&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;nextaccount&lt;&#x2F;code&gt; provided is the index to be supplied to the path &lt;code&gt;m&#x2F;12381&#x2F;60&#x2F;&amp;lt;index&amp;gt;&#x2F;0&lt;&#x2F;code&gt; when creating a new private key from the seed.  The path follows &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-2334&quot;&gt;EIP-2334&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This element MUST be present if the wallet type requires it.  It MUST be a non-negative integer.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;json-schema&quot;&gt;JSON schema&lt;&#x2F;h3&gt;
&lt;p&gt;The walletstore follows a similar format to that of the keystore described in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-2335&quot;&gt;EIP-2335&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;$ref&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;#&#x2F;definitions&#x2F;Walletstore&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;definitions&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;Walletstore&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;crypto&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;kdf&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;$ref&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;#&#x2F;definitions&#x2F;Module&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;checksum&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;$ref&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;#&#x2F;definitions&#x2F;Module&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;cipher&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;$ref&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;#&#x2F;definitions&#x2F;Module&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;nextaccount&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;integer&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uuid&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uuid&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;integer&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;required&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uuid&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;crypto&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;nextaccount&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Walletstore&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;Module&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;message&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;required&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;message&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;A standard for walletstores, similar to that for keystores, provides a higher level of compatibility between wallets and allows for simpler wallet and key interchange between them.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;test-vector&quot;&gt;Test Vector&lt;&#x2F;h3&gt;
&lt;p&gt;Password &lt;code&gt;&#x27;testpassword&#x27;&lt;&#x2F;code&gt;
Seed &lt;code&gt;0x147addc7ec981eb2715a22603813271cce540e0b7f577126011eb06249d9227c&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;crypto&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;checksum&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;sha256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;message&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;8bdadea203eeaf8f23c96137af176ded4b098773410634727bd81c4e8f7f1021&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;cipher&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;aes-128-ctr&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;message&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;7f8211b88dfb8694bac7de3fa32f5f84d0a30f15563358133cda3b287e0f3f4a&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;iv&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;9476702ab99beff3e8012eff49ffb60d&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;kdf&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;pbkdf2&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;message&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 16&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;dklen&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;prf&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;hmac-sha256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;salt&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;dd35b0c08ebb672fe18832120a55cb8098f428306bf5820f5486b514f61eb712&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Test wallet 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;nextaccount&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;hierarchical deterministic&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uuid&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;b74559b8-ed56-4841-b25c-dba1b7c9d9d5&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;A Go implementation of the hierarchical deterministic wallet can be found at &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;wealdtech&#x2F;go-eth2-wallet-hd&quot;&gt;https:&#x2F;&#x2F;github.com&#x2F;wealdtech&#x2F;go-eth2-wallet-hd&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The seed stored in the &lt;code&gt;crypto&lt;&#x2F;code&gt; section of the wallet can be used to generate any key along the derived path.  As such, the security of all keys generated by HD wallets is reduced to the security of the passphrase and strength of the encryption used to protect the seed, regardless of the security of the passphrase and strength of the encryption used to protect individual keystores.&lt;&#x2F;p&gt;
&lt;p&gt;It is possible to work with only the walletstore plus an index for each key, in which case stronger passphrases can be used as decryption only needs to take place once.  It is also possible to use generated keystores without the walletstore, in which case a breach of security will expose only the keystore.&lt;&#x2F;p&gt;
&lt;p&gt;An example high-security configuration may involve the walletstore existing on an offline computer, from which keystores are generated.  The keystores can then be moved individually to an online computer to be used for signing.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Muir Glacier Difficulty Bomb Delay</title>
        <published>2019-11-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Eric Conner</name><uri>https://github.com/econoar</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2384/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2384-difficulty-bomb-delay" />
        

        <id>https://wg-eips.ritovision.com/2384/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2384"
            label="EIP-2384" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2384/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;The average block times are increasing due to the difficulty bomb (also known as the &quot;&lt;em&gt;ice age&lt;&#x2F;em&gt;&quot;) and slowly accelerating. This EIP proposes to delay the difficulty bomb for another 4,000,000 blocks (~611 days).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Starting with &lt;code&gt;MUIR_GLACIER_FORK_BLKNUM&lt;&#x2F;code&gt; the client will calculate the difficulty based on a fake block number suggesting to the client that the difficulty bomb is adjusting 9 million blocks later than the Homestead fork, which is also 7 million blocks later than the Byzantium fork and 4 million blocks later than the Constantinople fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The difficulty bomb started to become noticeable again on October 5th 2019 at block 8,600,000. Block times have been around 13.1s on average and now as of block 8,900,000 are around 14.3s. This will start to accelerate exponentially every 100,000 blocks. Estimating the added impact from the difficulty bomb on block times shows that we will see 20s block times near the end of December 2019 and 30s+ block times starting February 2020. This will start making the chain bloated and more costly to use. It&#x27;s best to delay the difficulty bomb again to around the time of expected launch of the Eth2 finality gadget.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h4 id=&quot;relax-difficulty-with-fake-block-number&quot;&gt;Relax Difficulty with Fake Block Number&lt;&#x2F;h4&gt;
&lt;p&gt;For the purposes of &lt;code&gt;calc_difficulty&lt;&#x2F;code&gt;, simply replace the use of &lt;code&gt;block.number&lt;&#x2F;code&gt;, as used in the exponential ice age component, with the formula:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;fake_block_number = max(0, block.number - 9_000_000) if block.number &amp;gt;= MUIR_GLACIER_FORK_BLKNUM else block.number&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This will delay the ice age by 52 million seconds (approximately 611 days), so the chain would be back at 20 second block times around July 2021. It&#x27;s important to note this pushes the ice age 4,000,000 blocks from ~block 8,800,000 NOT from when this EIP is activated in a fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is not forward compatible and introduces backwards incompatibilities in the difficulty calculation. Therefore, it should be included in a scheduled hardfork at a certain block number. It&#x27;s suggested to include this EIP shortly after the Istanbul fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases shall be created once the specification is to be accepted by the developers or implemented by the clients.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The implementation in it&#x27;s logic does not differ from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;649&#x2F;&quot;&gt;EIP-649&lt;&#x2F;a&gt; or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1234&#x2F;&quot;&gt;EIP-1234&lt;&#x2F;a&gt;; an implementation for Parity-Ethereum is available in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;paritytech&#x2F;parity-ethereum&#x2F;pull&#x2F;9187&quot;&gt;parity-ethereum#9187&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Geo-ENS</title>
        <published>2019-11-15T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>James Choncholas</name><uri>https://github.com/james-choncholas</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2390/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/2959" />
        

        <id>https://wg-eips.ritovision.com/2390/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:2390"
            label="ERC-2390" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2390/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;GeoENS brings geographic split horizon capabilities to ENS. It&#x27;s GeoDNS for ENS!&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP specifies an ENS resolver interface for geographically split horizon DNS.
Geographic split horizon DNS returns resource records that are specific to an end
user&#x27;s location.
This technique is commonly used by CDNs to direct traffic to content caches nearest users.
Geographic split horizon resolution is primarily geared towards ENS
resolvers storing DNS resource records &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1185&#x2F;&quot;&gt;EIP-1185&lt;&#x2F;a&gt;, although the technique could be
used on other interfaces like IPFS content hash storage &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1062&#x2F;&quot;&gt;EIP-1062&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;There are many use cases for traditional GeoDNS systems, like Amazon&#x27;s Route53,
in the centralized web.
These use cases include proximity-based load balancing and serving content
specific to the geographic location of the query.
Unfortunately the ENS specification does not provide a mechanism for
geo-specific resolution.
ENS can respond to queries with IP addresses (as described in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1185&#x2F;&quot;&gt;EIP-1185&lt;&#x2F;a&gt;)
however there is no way to respond to geo-specific queries.
This EIP proposes a standard to give the ENS system geo-proximal awareness
to serve a similar purpose as GeoDNS.&lt;&#x2F;p&gt;
&lt;p&gt;GeoENS can do more than DNS-based solutions.
In addition to geographic split horizon DNS, GeoENS can be used for the following:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Locating digital resources (like smart contracts) that represent physical objects in the real world.&lt;&#x2F;li&gt;
&lt;li&gt;Smart contract managing access to a physical object associated with a specific location.&lt;&#x2F;li&gt;
&lt;li&gt;ENS + IPFS web hosting (as described in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1062&#x2F;&quot;&gt;EIP-1062&lt;&#x2F;a&gt;) with content translated to the native language of the query source.&lt;&#x2F;li&gt;
&lt;li&gt;Tokenizing objects with a physical location.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Because of the decentralized nature of ENS, geo-specific resolution is different than traditional GeoDNS.
GeoDNS works as follows. DNS queries are identified by their source IP address.
This IP is looked up in a database like &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.maxmind.com&#x2F;en&#x2F;geoip2-services-and-databases&quot;&gt;GeoIP2&lt;&#x2F;a&gt;
from MaxMind which maps the IP address to a location.
This method of locating the source of a query is error prone and unreliable.
If the GeoIP database is out of date, queried locations can be vastly different than their true location.
GeoENS does not rely on a database because the user includes a location in their query.&lt;&#x2F;p&gt;
&lt;p&gt;It follows that queries can be made by users for any location, not just their location.
Traditional DNS will only return the resource assigned to a query&#x27;s provenance.
GeoENS does not correlate a query&#x27;s provinance with a location, allowing the
entire globe to be queried from a single location.&lt;&#x2F;p&gt;
&lt;p&gt;An additional shortcoming of traditional DNS is the fact that there is no way to return a list of servers in a certain proximity.
This is paramount for uses cases that require discovering the resource with the lowest latency.
GeoENS allows a list of resources, like IP addresses, to be gathered within a specific location.
Then a client to determine themselves which resource has the lowest latency.&lt;&#x2F;p&gt;
&lt;p&gt;Lastly, publicly facing GeoDNS services do not give fine granularity control
over geographic regions for GeoDNS queries.
Cloud based DNS services like &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;aws.amazon.com&#x2F;route53&#x2F;&quot;&gt;Amazon&#x27;s Route 53&lt;&#x2F;a&gt;
only allow specifying geographic regions at the granularity of a State in
the United States.
GeoENS on the other hand gives 8 characters of geohash resolution which
corresponds to +-20 meter accuracy.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes a new interface to ENS resolvers such that geo-spacial information
can be recorded and retrieved from the blockchain.
The interface changes are described below for &quot;address resolvers&quot; described in EIP137
however the idea applies to any record described in EIP1185 and EIP1062, namely DNS
Resolvers, Text Resolvers, ABI Resolvers, etc.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;what-is-a-geohash&quot;&gt;What is a geohash?&lt;&#x2F;h3&gt;
&lt;p&gt;A &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.m.wikipedia.org&#x2F;wiki&#x2F;Geohash#Algorithm_and_example&quot;&gt;Geohash&lt;&#x2F;a&gt;
is an interleaving of latitude and longitude bits, whose
length determines it&#x27;s precision.
Geohashes are typically encoded in base 32 characters.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;function-setgeoaddr-bytes32-node-string-calldata-geohash-address-addr-external-authorised-node&quot;&gt;function setGeoAddr(bytes32 node, string calldata geohash, address addr) external authorised(node)&lt;&#x2F;h3&gt;
&lt;p&gt;Sets a resource (contract address, IP, ABI, TEXT, etc.) by node and geohash.
Geohashes must be unique per address and are exactly 8 characters long.
This leads to an accuracy of +-20 meters.
Write default initialized resource value, &lt;code&gt;address(0)&lt;&#x2F;code&gt;, to remove a resource from the resolver.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;function-geoaddr-bytes32-node-string-calldata-geohash-external-view-returns-address-memory-ret&quot;&gt;function geoAddr(bytes32 node, string calldata geohash) external view returns (address[] memory ret)&lt;&#x2F;h3&gt;
&lt;p&gt;Query the resolver contract for a specific node and location.
All resources (contract addresses, IP addresses, ABIs, TEXT records, etc.) matching
the node and prefix geohash provided are returned.
This permits querying by exact geohash of 8 characters to return the content at that location,
or querying by geographic bounding box described by a geohash of less than 8 character precision.&lt;&#x2F;p&gt;
&lt;p&gt;Any type of geohash can be used including &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Z-order_curve&quot;&gt;Z-order&lt;&#x2F;a&gt;
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Hilbert_curve&quot;&gt;Hilbert&lt;&#x2F;a&gt; or the more accurate
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;s2geometry.io&#x2F;devguide&#x2F;s2cell_hierarchy.html&quot;&gt;S2 Geometry&lt;&#x2F;a&gt; library
from Google.
There are also ways to search the geographic data using geohashes without
always ending up with a rectangular query region.
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ashwin711&#x2F;proximityhash&quot;&gt;Searching circular shaped regions&lt;&#x2F;a&gt; is
slightly more complex as it requires multiple queries.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The proposed implementation uses a sparse &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;dl.acm.org&#x2F;doi&#x2F;10.1007&#x2F;BF00288933&quot;&gt;Quadtree&lt;&#x2F;a&gt; trie as an index for
resource records as it has low storage overhead and good search performance.
The leaf nodes of the tree store resource records while non-leaves represent one geohash character.
Each node in the tree at depth d corresponds to a geohash of precision d.
The tree has depth 8 because the maximum precision of a geohash is 8 characters.
The tree has fanout 32 because the radix of a geohash character is 32.
The path to get to a leaf node always has depth 8 and the leaf contains the content (like IP address)
of the geohash represented by the path to the leaf.
The tree is sparse as 71% of the Earth&#x27;s surface is covered by water.
The tree facilitates common traversal algorithms (DFS, BFS) to return
lists of resource records within a geographic bounding box.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP does not introduce issues with backwards compatibility.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;See https:&#x2F;&#x2F;github.com&#x2F;james-choncholas&#x2F;resolvers&#x2F;blob&#x2F;master&#x2F;test&#x2F;TestPublicResolver.js&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;This address resolver, written in Solidity, implements the specifications outlined above.
The same idea presented here can be applied to other resolver interfaces as specified in EIP137.
Note that geohashes are passed and stored using 64 bit unsigned integers.
Using integers instead of strings for geohashes is more performant, especially in the &lt;code&gt;geomap&lt;&#x2F;code&gt; mapping.
For comparison purposes, see https:&#x2F;&#x2F;github.com&#x2F;james-choncholas&#x2F;geoens&#x2F;tree&#x2F;master&#x2F;contracts&#x2F;StringOwnedGeoENSResolver.sol for the inefficient string implementation.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.5.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;..&#x2F;ResolverBase.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; GeoENSResolver&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ResolverBase&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; ERC2390 &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x8fbcc5ce&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; MAX_ADDR_RETURNS &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 64&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; TREE_VISITATION_QUEUESZ &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 64&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; ASCII_0 &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 48&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; ASCII_9 &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 57&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; ASCII_a &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 97&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; ASCII_b &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 98&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; ASCII_i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 105&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; ASCII_l &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 108&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; ASCII_o &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 111&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; ASCII_z &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 122&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Node&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0 if not leaf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; children&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; always length 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A geohash is 8, base-32 characters.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A geomap is stored as tree of fan-out 32 (because&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; geohash is base 32) and height 8 (because geohash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; length is 8 characters)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;Node&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; geomap&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; GeoENSRecordChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; geohash&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; only 5 bits of ret value are used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; chartobase32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; c&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; b&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint8&lt;&#x2F;span&gt;&lt;span&gt; ascii &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint8&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;c&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;ascii &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; ASCII_0 &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; ascii &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; ASCII_9&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                (&lt;&#x2F;span&gt;&lt;span&gt;ascii &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; ASCII_a &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; ascii &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; ASCII_z&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ascii &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span&gt; ASCII_a&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ascii &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span&gt; ASCII_i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ascii &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span&gt; ASCII_l&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ascii &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span&gt; ASCII_o&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;ascii &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;ASCII_0 &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 9&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            b &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; ascii &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt; ASCII_0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; base32 b = 10&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ascii &amp;#39;b&amp;#39; = 0x60&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; base32 skips the letter &amp;#39;a&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            b &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; ascii &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt; ASCII_b &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; base32 also skips the following letters&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;ascii &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; ASCII_i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                b &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;ascii &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; ASCII_l&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                b &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;ascii &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; ASCII_o&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                b &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;b &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; base 32 can&amp;#39;t be larger than 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; b&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; geoAddr&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; geohash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; precision&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ret&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; single node georesolver ignores node&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;precision &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; geohash&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ret &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[](&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;MAX_ADDR_RETURNS&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;geomap&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span&gt; ret&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span&gt; ret_i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; walk into the geomap data structure&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span&gt; pointer &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; not actual pointer but index into geomap&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; precision&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            uint8&lt;&#x2F;span&gt;&lt;span&gt; c &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; chartobase32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;geohash&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            uint&lt;&#x2F;span&gt;&lt;span&gt; next &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; geomap&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;pointer&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;children&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;c&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;next &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;                &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; nothing found for this geohash.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;                &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; return early.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                return&lt;&#x2F;span&gt;&lt;span&gt; ret&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                pointer &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; next&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; pointer is now node representing the resolution of the query geohash.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; DFS until all addresses found or ret[] is full.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Do not use recursion because blockchain...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; indexes_to_visit &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;[](&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;TREE_VISITATION_QUEUESZ&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        indexes_to_visit&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; pointer&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span&gt; front_i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span&gt; back_i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        while&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;front_i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span&gt; back_i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            Node &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;memory&lt;&#x2F;span&gt;&lt;span&gt; cur_node &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; geomap&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;indexes_to_visit&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;front_i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            front_i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if not a leaf node...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;cur_node&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;data &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;                &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; visit all the chilins&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt;cur_node&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;children&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;                    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; only visit valid children&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;cur_node&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;children&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                        assert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;back_i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; TREE_VISITATION_QUEUESZ&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        indexes_to_visit&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;back_i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; cur_node&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;children&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        back_i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                ret&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;ret_i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; cur_node&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                ret_i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;ret_i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; MAX_ADDR_RETURNS&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; break&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; ret&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; when setting, geohash must be precise to 8 digits.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setGeoAddr&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; geohash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; authorised&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;node&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; single node georesolver ignores node&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; create root node if not yet created&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;geomap&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            geomap&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;push&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Node&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                parent&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                children&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[](&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; walk into the geomap data structure&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span&gt; pointer &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; not actual pointer but index into geomap&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; geohash&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            uint8&lt;&#x2F;span&gt;&lt;span&gt; c &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; chartobase32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;geohash&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;geomap&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;pointer&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;children&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;c&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;                &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; nothing found for this geohash.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;                &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; we need to create a path to the leaf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                geomap&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;push&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Node&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    parent&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; pointer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    children&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[](&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                geomap&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;pointer&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;children&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;c&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; geomap&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            pointer &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; geomap&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;pointer&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;children&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;c&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        Node &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;storage&lt;&#x2F;span&gt;&lt;span&gt; cur_node &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; geomap&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;pointer&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; storage = get reference&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        cur_node&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;data &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; GeoENSRecordChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; geohash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; interfaceID &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; ERC2390 &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;interfaceID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This contract has similar functionality to ENS Resolvers - refer there for security considerations.
Additionally, this contract has a dimension of data privacy.
Users query via the geoAddr function specifying a geohash of less than 8 characters
which defines the query region.
Users who run light clients leak the query region to their connected full-nodes.
Users who rely on nodes run by third parties (like Infura) will also leak
the query region.
Users who run their own full node or have access to a trusted full node do
not leak any location data.&lt;&#x2F;p&gt;
&lt;p&gt;Given the way most location services work, the query region is likely to contain
the user&#x27;s actual location.
The difference between API access, light, and full nodes has always had
an impact on privacy but now the impact is underscored by the involvement
of coarse granularity user location.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>&quot;eth&#x2F;64: forkid-extended protocol handshake&quot;</title>
        <published>2019-11-08T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Péter Szilágyi</name><email>peterke@gmail.com</email>
	</author>
	
	<author>
		<name>Péter Szilágyi</name><uri>https://github.com/karalabe</uri>
	</author>
	
	<author>
		<name>Tim Beiko</name><uri>https://github.com/timbeiko</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2364/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/2365" />
        

        <id>https://wg-eips.ritovision.com/2364/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="networking"
                label="Networking" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2364"
            label="EIP-2364" />
        

        
        

        
        <summary type="html">Introduces validation of the `forkid` when handshaking with peers.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2364/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP specifies the inclusion of the &lt;code&gt;forkid&lt;&#x2F;code&gt;, originally defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2124&#x2F;&quot;&gt;(EIP-2124)&lt;&#x2F;a&gt;, as a new field in the Ethereum wire protocol (&lt;code&gt;eth&lt;&#x2F;code&gt;) handshake. This change is implemented as a new version of the wire protocol, &lt;code&gt;eth&#x2F;64&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2124&#x2F;&quot;&gt;&lt;code&gt;forkid&lt;&#x2F;code&gt; (EIP-2124)&lt;&#x2F;a&gt; was designed to permit two Ethereum nodes to quickly and cheaply decide if they are compatible or not, not only at a genesis&#x2F;networking level, but also from the perspective of the currently passed network updates (i.e. forks).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2124&#x2F;&quot;&gt;EIP-2124&lt;&#x2F;a&gt; only defines how the &lt;code&gt;forkid&lt;&#x2F;code&gt; is calculated and validated, but does not specify how the &lt;code&gt;forkid&lt;&#x2F;code&gt; should be exchanged between peers. This EIP specifies the inclusion of the &lt;code&gt;forkid&lt;&#x2F;code&gt; as a new field in the Ethereum wire protocol (&lt;code&gt;eth&lt;&#x2F;code&gt;) handshake (releasing a new version, &lt;code&gt;eth&#x2F;64&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;By cross-validating &lt;code&gt;forkid&lt;&#x2F;code&gt; during the handshake, incompatible nodes can disconnect before expensive block exchanges and validations take place (PoW check, EVM execution, state reconstruction). This further prevents peer slots from being taken up by nodes that are incompatible, but have not yet been detected as such.&lt;&#x2F;p&gt;
&lt;p&gt;From a micro perspective, cutting off incompatible nodes from one another ensures that a node only spends its resources on tasks that are genuinely useful to it. The sooner we can decide the remote peer is useless, the less time and processing we expend in vain.&lt;&#x2F;p&gt;
&lt;p&gt;From a macro perspective, keeping incompatible nodes partitioned from one another ensures that disjoint clusters retain more resources for maintaining their own chain, thus raising the quality of service for all networks globally.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Implement &lt;code&gt;forkid&lt;&#x2F;code&gt; generation and validation per &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2124&#x2F;&quot;&gt;EIP-2124&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Advertise a new &lt;code&gt;eth&lt;&#x2F;code&gt; protocol capability (version) at &lt;code&gt;eth&#x2F;64&lt;&#x2F;code&gt;.
&lt;ul&gt;
&lt;li&gt;The old &lt;code&gt;eth&#x2F;63&lt;&#x2F;code&gt; protocol should still be kept alive side-by-side, until &lt;code&gt;eth&#x2F;64&lt;&#x2F;code&gt; is sufficiently adopted by implementors.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Redefine &lt;code&gt;Status (0x00)&lt;&#x2F;code&gt; for &lt;code&gt;eth&#x2F;64&lt;&#x2F;code&gt; to add a trailing &lt;code&gt;forkid&lt;&#x2F;code&gt; field:
&lt;ul&gt;
&lt;li&gt;Old packet: &lt;code&gt;[protocolVersion, networkId, td, bestHash, genesisHash]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;New packet: &lt;code&gt;[protocolVersion, networkId, td, bestHash, genesisHash, forkid]&lt;&#x2F;code&gt;,
where &lt;code&gt;forkid&lt;&#x2F;code&gt; is &lt;code&gt;[forkHash: [4]byte, forkNext: uint64]&lt;&#x2F;code&gt; (fields per &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2124&#x2F;&quot;&gt;EIP-2124&lt;&#x2F;a&gt; ).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Whenever two peers connect using the &lt;code&gt;eth&#x2F;64&lt;&#x2F;code&gt; protocol, the updated &lt;code&gt;Status&lt;&#x2F;code&gt; message must be sent as the protocol handshake, and each peer must validate the remote &lt;code&gt;forkid&lt;&#x2F;code&gt;, disconnecting at a detected incompatibility.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The specification is tiny since most parts are already specified in EIP-2124. &lt;code&gt;eth&#x2F;63&lt;&#x2F;code&gt; is not specified as an EIP, but is maintained in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;devp2p&quot;&gt;ethereum&#x2F;devp2p&lt;&#x2F;a&gt; Github repository.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;eip-2124-mentions-advertising-the-forkid-in-the-discovery-protocol-too-how-does-that-compare-to-advertising-in-the-eth-protocol-why-is-the-redundancy-needed&quot;&gt;EIP-2124 mentions advertising the &lt;code&gt;forkid&lt;&#x2F;code&gt; in the discovery protocol too. How does that compare to advertising in the &lt;code&gt;eth&lt;&#x2F;code&gt; protocol? Why is the redundancy needed?&lt;&#x2F;h3&gt;
&lt;p&gt;Advertising and validating the &lt;code&gt;forkid&lt;&#x2F;code&gt; in the discovery protocol is a more optimal solution, as it can help avoid the cost of setting up the TCP connection and cryptographic RLPx stream, only to be torn down if &lt;code&gt;eth&#x2F;64&lt;&#x2F;code&gt; rejects it.&lt;&#x2F;p&gt;
&lt;p&gt;Compared to the &lt;code&gt;eth&lt;&#x2F;code&gt; protocol however, discovery is a bit fuzzy. The goal there is to suggest potential peers, not to be fool-proof. Information may be outdated, nodes may have changed or disappeared. Discovery can do a rough filtering, but more precision is still needed afterwards.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, &lt;code&gt;forkid&lt;&#x2F;code&gt; validation via the discovery protocol requires ENR implementation (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;778&#x2F;&quot;&gt;EIP-778&lt;&#x2F;a&gt;) and ENR extension support (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;868&#x2F;&quot;&gt;EIP-868&lt;&#x2F;a&gt;), which is not mandated by the Ethereum network currently. Lastly, the discovery protocol is just one way to find peers, but systems that cannot use UDP or that rely on other mechanism (e.g. DNS discovery)) still need a way to filter connections.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;the-forkid-implicitly-contains-the-genesis-hash-checksummed-into-the-fork-hash-field-why-doesn-t-this-proposal-remove-the-genesishash-field-from-the-eth-handshake&quot;&gt;The &lt;code&gt;forkid&lt;&#x2F;code&gt; implicitly contains the genesis hash checksummed into the &lt;code&gt;FORK_HASH&lt;&#x2F;code&gt; field. Why doesn&#x27;t this proposal remove the &lt;code&gt;genesisHash&lt;&#x2F;code&gt; field from the &lt;code&gt;eth&lt;&#x2F;code&gt; handshake?&lt;&#x2F;h3&gt;
&lt;p&gt;Originally this EIP did remove it as redundant data, since filtering based on the &lt;code&gt;forkid&lt;&#x2F;code&gt; is a superset of filtering based on genesis hash. The reason for backing out of that decision was that the genesis hash may be useful for other things too, not just connection filtering (network crawlers use it currently to split nodes across networks).&lt;&#x2F;p&gt;
&lt;p&gt;Although the &lt;code&gt;forkid&lt;&#x2F;code&gt; will hopefully take over all the roles of the genesis hash currently in use, there&#x27;s no reason to be overly aggressive in deduplicating data. It&#x27;s fine to keep both side-by-side for now, and remove in a future version when 3rd party infrastructures switch over.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP extends the &lt;code&gt;eth&lt;&#x2F;code&gt; protocol handshake in a backwards incompatible way and requires rolling out a new version, &lt;code&gt;eth&#x2F;64&lt;&#x2F;code&gt;. However, &lt;code&gt;devp2p&lt;&#x2F;code&gt; supports running multiple versions of the same wire protocol side-by-side, so rolling out &lt;code&gt;eth&#x2F;64&lt;&#x2F;code&gt; does not require client coordination, since non-updated clients can keep using &lt;code&gt;eth&#x2F;63&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP does not change the consensus engine, thus does &lt;em&gt;not&lt;&#x2F;em&gt; require a hard fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;For calculating and validating fork IDs, see test cases in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2124&#x2F;&quot;&gt;EIP-2124&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;None.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Transaction Receipt URI</title>
        <published>2019-11-05T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Ricardo Guilherme Schmidt</name><uri>https://github.com/3esmit</uri>
	</author>
	
	<author>
		<name>Eric Dvorsak</name><uri>https://github.com/yenda</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2400/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2400-transaction-receipt-uri/" />
        

        <id>https://wg-eips.ritovision.com/2400/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2400"
            label="ERC-2400" />
        

        
        

        
        <summary type="html">URI format for submitted transactions with complete information for transaction decoding</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2400/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;A transaction hash is not very meaningful on its own, because it looks just like any other hash, and it might lack important information for reading a transaction.&lt;&#x2F;p&gt;
&lt;p&gt;This standard includes all needed information for displaying a transaction and its details, such as &lt;code&gt;chainId&lt;&#x2F;code&gt;, &lt;code&gt;method&lt;&#x2F;code&gt; signature called, and &lt;code&gt;events&lt;&#x2F;code&gt; signatures emitted.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Interoperability between ethereum clients, allowing different systems to agree on a standard way of representing submitted transactions hashes, optionally with necessary information for decoding transaction details.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;use-cases&quot;&gt;Use-cases&lt;&#x2F;h3&gt;
&lt;p&gt;Transaction Receipt URIs embedded in QR-codes, hyperlinks in web-pages, emails or chat messages provide for robust cross-application signaling between very loosely coupled applications. A standardized URI format allows for instant invocation of the user’s preferred transaction explorer application. Such as:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;In web3 (dapps, mining pools, exchanges), links would automatically open user&#x27;s preferred transaction explorer;&lt;&#x2F;li&gt;
&lt;li&gt;In wallets, for users sharing transaction receipts easier;&lt;&#x2F;li&gt;
&lt;li&gt;In chat applications, as a reply to an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;681&#x2F;&quot;&gt;EIP-681&lt;&#x2F;a&gt; transaction request;&lt;&#x2F;li&gt;
&lt;li&gt;In crypto vending machines, a QRCode can be displayed when transactions are submitted;&lt;&#x2F;li&gt;
&lt;li&gt;Anywhere transaction receipts are presented to users.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;syntax&quot;&gt;Syntax&lt;&#x2F;h3&gt;
&lt;p&gt;Transaction receipt URLs contain &quot;ethereum&quot; in their schema (protocol) part and are constructed as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;receipt                 = schema_part transaction_hash [ &amp;quot;@&amp;quot; chain_id ] [ &amp;quot;?&amp;quot; parameters ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;schema_part             = &amp;quot;ethereum:tx-&amp;quot; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;transaction_hash        = &amp;quot;0x&amp;quot; 64*HEXDIG &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;chain_id                = 1*DIGIT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;parameters              = parameter *( &amp;quot;&amp;amp;&amp;quot; parameter )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;parameter               = key &amp;quot;=&amp;quot; value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;key                     = &amp;quot;method&amp;quot; &#x2F; &amp;quot;events&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;value                   = function_signature &#x2F; event_list&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function_signature      = function_name &amp;quot;(&amp;quot; TYPE *( &amp;quot;,&amp;quot; TYPE) &amp;quot;)&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function_name           = STRING&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;event_list              = event_signature *( &amp;quot;;&amp;quot; event_signature )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;event_signature         = event_name &amp;quot;(&amp;quot; event_type *( &amp;quot;,&amp;quot; event_type) &amp;quot;)&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;event_name              = STRING&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;event_type              = [&amp;quot;!&amp;quot;] TYPE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Where &lt;code&gt;TYPE&lt;&#x2F;code&gt; is a standard ABI type name, as defined in Ethereum Contract ABI specification. &lt;code&gt;STRING&lt;&#x2F;code&gt; is a URL-encoded unicode string of arbitrary length.&lt;&#x2F;p&gt;
&lt;p&gt;The exclamation symbol (&lt;code&gt;!&lt;&#x2F;code&gt;), in &lt;code&gt;event_type&lt;&#x2F;code&gt;, is used to identify indexed event parameters.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;semantics&quot;&gt;Semantics&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;transaction_hash&lt;&#x2F;code&gt; is mandatory. The hash must be looked up in the corresponding &lt;code&gt;chain_id&lt;&#x2F;code&gt; transaction history, if not found it should be looked into the pending transaction queue and rechecked until is found. If not found anequivalent error as &quot;transaction not found error&quot; should be shown instead of the transaction. When the transaction is pending, it should keep checking until the transaction is included in a block and becomes &quot;unrevertable&quot; (usually 12 blocks after transaction is included).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;chain_id&lt;&#x2F;code&gt; is specified by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt; optional and contains the decimal chain ID, such that transactions on various test and private networks can be represented as well. If no &lt;code&gt;chain_id&lt;&#x2F;code&gt; is present, the $ETH&#x2F;mainnet (&lt;code&gt;1&lt;&#x2F;code&gt;) is considered.&lt;&#x2F;p&gt;
&lt;p&gt;If &lt;code&gt;method&lt;&#x2F;code&gt; is not present, this means that the transaction receipt URI does not specify details, or that it was a transaction with no calldata. When present it needs to be validated by comparing the first 4 bytes of transaction calldata with the first 4 bytes of the keccak256 hash of &lt;code&gt;method&lt;&#x2F;code&gt;, if invalid, an equivalent error as &quot;method validation error&quot; must be shown instead of the transaction.&lt;&#x2F;p&gt;
&lt;p&gt;If &lt;code&gt;events&lt;&#x2F;code&gt; is not present, this means that the transaction receipt URI does not specify details, or that the transaction did not raised any events. Pending and failed transactions don&#x27;t validate events, however, when transaction is successful (or changes from pending to success) and events are present in URI, each event in the &lt;code&gt;event_list&lt;&#x2F;code&gt; must occur at least once in the transaction receipt event logs, otherwise an equivalent error as &quot;event validation error: {event(s) [$event_signature, ...] not found}&quot; should be shown instead of the transaction. A URI might contain the event signature for all, some or none of the raised events.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;examples&quot;&gt;Examples&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;simple-eth-transfer&quot;&gt;Simple ETH transfer:&lt;&#x2F;h5&gt;
&lt;p&gt;&lt;code&gt;ethereum:tx-0x1143b5e38fe3cf585fb026fb9b5ce35c85a691786397dc8a23a07a62796d8172@1&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h5 id=&quot;standard-token-transfer&quot;&gt;Standard Token transfer:&lt;&#x2F;h5&gt;
&lt;p&gt;&lt;code&gt;ethereum:tx-0x5375e805b0c6afa20daab8d37352bf09a533efb03129ba56dee869e2ce4f2f92@1?method=&quot;transfer(address,uint256)&quot;&amp;amp;events=&quot;Transfer(!address,!address,uint256)&quot;&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h5 id=&quot;complex-contract-transaction&quot;&gt;Complex contract transaction:&lt;&#x2F;h5&gt;
&lt;p&gt;&lt;code&gt;ethereum:tx-0x4465e7cce3c784f264301bfe26fc17609855305213ec74c716c7561154b76fec@1?method=&quot;issueAndActivateBounty(address,uint256,string,uint256,address,bool,address,uint256)&quot;&amp;amp;events=&quot;Transfer(!address,!address,uint256);BountyIssued(uint256);ContributionAdded(uint256,!address,uint256);BountyActivated(uint256,address)&quot;&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The goal of this standard envolves only the transport of submitted transactions, and therefore transaction data must be loaded from blockchain or pending transaction queue, which also serves as a validation of the transaction existence.&lt;&#x2F;p&gt;
&lt;p&gt;Transaction hash not found is normal in fresh transactions, but can also mean that effectively a transaction was never submitted or have been replaced (through &quot;higher gasPrice&quot; nonce override or through an uncle&#x2F;fork).&lt;&#x2F;p&gt;
&lt;p&gt;In order to decode transaction parameters and events, a part of the ABI is required. The transaction signer have to know the ABI to sign a transaction, and is also who is creating a transaction receipt, so the transaction receipt can optionally be shared with the information needed to decode the transaction call data and it&#x27;s events.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Future upgrades that are partially or fully incompatible with this proposal must use a prefix other than &lt;code&gt;tx-&lt;&#x2F;code&gt; that is separated by a dash (-) character from whatever follows it.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EXTSLOAD opcode</title>
        <published>2019-10-29T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Dominic Letz</name><uri>https://github.com/dominicletz</uri>
	</author>
	
	<author>
		<name>Santiago Palladino</name><uri>https://github.com/spalladino</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2330/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2330-extsload-and-abi-for-lower-gas-cost-and-off-chain-apps/3733" />
        

        <id>https://wg-eips.ritovision.com/2330/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:2330"
            label="EIP-2330" />
        

        
        

        
        <summary type="html">A new EVM opcode to read external contract storage data.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2330/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal adds a new opcode &lt;code&gt;EXTSLOAD&lt;&#x2F;code&gt; at &lt;code&gt;0x5c&lt;&#x2F;code&gt; which pops two items from the stack: &lt;code&gt;&amp;lt;account address&amp;gt; &amp;lt;storage key&amp;gt;&lt;&#x2F;code&gt; and pushes one item: &lt;code&gt;&amp;lt;storage value&amp;gt;&lt;&#x2F;code&gt;. The gas cost is sum of account access cost and storage read based on &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt; Access Lists.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;While any off-chain application can read all contract storage data of all contracts, this is not possible for deployed smart contracts themselves. These are bound to use contract calls for any interaction including reading data from other contracts. This EIP adds an EVM opcode to directly read external contract storage.&lt;&#x2F;p&gt;
&lt;p&gt;The gas cost when reading from registry style contract such as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;EIP-20s&lt;&#x2F;a&gt;, ENS and other data contracts is very high, because they incur cross contract call cost, cost for ABI encoding, decoding and dispatching and finally loading the data. In many cases the underlying storage that is being queried is though just a simple mapping. On top of that, the view function may SLOAD many other slots which caller may not be interested in, which further adds to the gas costs. In these cases a new &lt;code&gt;EXTSLOAD&lt;&#x2F;code&gt; call directly accessing the mapping in storage could not only &lt;strong&gt;reduce the gas cost&lt;&#x2F;strong&gt; of the interaction more than 10x, but also it would make the gas cost &lt;strong&gt;predictable&lt;&#x2F;strong&gt; for the reading contract.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;A new EVM instruction &lt;code&gt;EXTSLOAD (0x5c)&lt;&#x2F;code&gt; that works like &lt;code&gt;SLOAD (0x54)&lt;&#x2F;code&gt; but an additional parameter representing the contract that is to be read from.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;EXTSLOAD&lt;&#x2F;span&gt;&lt;span&gt; (0x5c&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;EXTSLOAD&lt;&#x2F;code&gt; instruction pops 2 values from the stack, first &lt;code&gt;contract&lt;&#x2F;code&gt; a contract address and then second &lt;code&gt;slot&lt;&#x2F;code&gt; a storage address within &lt;code&gt;contract&lt;&#x2F;code&gt;. As result &lt;code&gt;EXTSLOAD&lt;&#x2F;code&gt; pushes on the stack the value from the contract storage of &lt;code&gt;contract&lt;&#x2F;code&gt; at the storage &lt;code&gt;slot&lt;&#x2F;code&gt; address or &lt;code&gt;0&lt;&#x2F;code&gt; in case the account &lt;code&gt;contract&lt;&#x2F;code&gt; does not exist.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-cost-pre-verkle&quot;&gt;Gas cost pre-verkle&lt;&#x2F;h3&gt;
&lt;p&gt;Gas to be charged before Verkle Tree change is specified as &lt;code&gt;ACCOUNT_ACCESS_COST + STORAGE_READ_COST&lt;&#x2F;code&gt; where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ACCOUNT_ACCESS_COST&lt;&#x2F;code&gt; is &lt;code&gt;0&lt;&#x2F;code&gt; if the account address is already in &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt; set, otherwise &lt;code&gt;COLD_ACCOUNT_ACCESS_COST&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;STORAGE_READ_COST&lt;&#x2F;code&gt; is &lt;code&gt;WARM_STORAGE_READ_COST&lt;&#x2F;code&gt; if storage key is already in &lt;code&gt;accessed_storage_keys&lt;&#x2F;code&gt; set, otherwise &lt;code&gt;COLD_STORAGE_READ_COST&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;gas-cost-post-verkle&quot;&gt;Gas cost post-verkle&lt;&#x2F;h3&gt;
&lt;p&gt;It is important to consider that post Verkle tree change, &lt;code&gt;ACCOUNT_ACCESS_COST&lt;&#x2F;code&gt; will not be needed since a single account&#x27;s storage would be spread across the entire global trie. Hence gas to be charged post Verkle Tree change is just &lt;code&gt;STORAGE_READ_COST&lt;&#x2F;code&gt;, which is as specified in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2330&#x2F;#gas-cost-pre-verkle&quot;&gt;Gas cost pre-verkle&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Without this EIP, a contract can still opt-in to make their entire state public, by having a method that simply SLOADs and returns the values (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2330&#x2F;.&#x2F;assets&#x2F;Extsload.sol&quot;&gt;example&lt;&#x2F;a&gt;). The complexity of the gas cost can be seen as &lt;code&gt;1&lt;&#x2F;code&gt;x CALL cost + &lt;code&gt;N&lt;&#x2F;code&gt;x SLOAD cost. Hence, the gas cost specified for using EXTSLOAD opcode on an account for &lt;code&gt;N&lt;&#x2F;code&gt; times, the charge of &lt;code&gt;1&lt;&#x2F;code&gt;x &lt;code&gt;COLD_ACCOUNT_ACCESS_COST&lt;&#x2F;code&gt; and &lt;code&gt;N&lt;&#x2F;code&gt;x &lt;code&gt;STORAGE_READ_COST&lt;&#x2F;code&gt; is hereby justified.&lt;&#x2F;li&gt;
&lt;li&gt;Without this EIP, a contract can still use internal state of other contracts. An external party can supply a value and proof to a contract, which the contract can verify using &lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt;. This is only possible for the previous blocks and not the latest state (since current blockhash cannot be determined before execution).&lt;&#x2F;li&gt;
&lt;li&gt;This opcode can be seen as breaking object-oriented (OO) model because it allows to read storage of other contracts. In usual systems using OO is net positive, because there is no limit on machine code and it hardly adds any cost to add more methods or use single method to get a ton of data while the caller needs to just a small portion of data. However on EVM, there are visible costs, i.e. about $0.2 per SLOAD (20 gwei and ETHUSD 2000). Also, OO has caused misleading assumptions for developers where variables marked as &quot;private&quot; in smart contracts are encrypted in some way&#x2F;impossible to read which has resulted bad designs. Hence, this EIP can be beneficial in terms of making smart contract systems more efficient as well as preventing misconceptions as well.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change is fully backwards compatible since it adds a new instruction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Since the opcode is similar to SLOAD, it should be easy to implement in various clients.&lt;&#x2F;li&gt;
&lt;li&gt;This opcode allows the callee &lt;code&gt;A&lt;&#x2F;code&gt; to re-enter a caller contract &lt;code&gt;B&lt;&#x2F;code&gt; and read state of &lt;code&gt;B&lt;&#x2F;code&gt; and &lt;code&gt;B&lt;&#x2F;code&gt; cannot stop &lt;code&gt;A&lt;&#x2F;code&gt; from doing that. Since this does not change any state, it should not be a security issue. Contracts generally use re-entrancy guards, but that is only added to write methods. So even currently without EXTSLOAD, &lt;code&gt;A&lt;&#x2F;code&gt; can re-enter &lt;code&gt;B&lt;&#x2F;code&gt; and read their state exposed by any view methods and it has not been an issue.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>BEGINDATA opcode</title>
        <published>2019-10-28T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Martin Lundfall</name><uri>https://github.com/MrChico</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2327/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/new-opcode-begindata/3727" />
        

        <id>https://wg-eips.ritovision.com/2327/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:2327"
            label="EIP-2327" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2327/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Introduces a new opcode &lt;code&gt;BEGINDATA&lt;&#x2F;code&gt;, which indicates that the remaining bytes of the contract should be regarded as data rather than contract code
and cannot be executed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;It is common for smart contracts to efficiently store data directly in the contract bytecode. Examples include constructor arguments, constant variables, compiler metadata and the contract runtime during the init phase. Currently, such data is not distinguished from normal bytecode and is still being analysed for &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt;s by EVM interpreters. This EIP introduces a new opcode &lt;code&gt;BEGINDATA&lt;&#x2F;code&gt; at byte &lt;code&gt;0xb6&lt;&#x2F;code&gt;, which marks the remainding bytecode as data, indicating to EVM interpreters, static analysis tools and chain explorers that the remaining bytes do not represent opcodes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;BEGINDATA&lt;&#x2F;code&gt; opcode has been suggested before as part of the EIP &lt;code&gt;Subroutines and Static Jumps for the EVM&lt;&#x2F;code&gt; &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;615&#x2F;&quot;&gt;EIP-615&lt;&#x2F;a&gt; as a way to determine the position of jumptables in contract bytecode. It is here introduced in its own right in order to exclude data from the &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; analysis of contracts, making it impossible to jump to data. This makes it easier for static analysis tools to analyse contracts, allows disassemblers, chain explorers and debuggers to not display data as a mess of INVALID opcodes and may even provide a marginal improvement in performance. It also helps scalability because it improves on-chain evaluation of transactions from other chains in that the validation that the code conforms to a certain pattern does not need to do a full jumpdest analysis to see that data is not executed and thus does not have to conform to the pattern (used by the optimism project). Additionally, it paves the way for suggestions such as &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;pull&#x2F;1712&quot;&gt;EIP-1712&lt;&#x2F;a&gt; to disallow unused opcodes, jumptables &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;615&#x2F;&quot;&gt;EIP-615&lt;&#x2F;a&gt; and speculative proposals to disallow for deployment of contracts with stack usage violations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;While computing the valid &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt;s of a contract, halt analysis once the first &lt;code&gt;BEGINDATA&lt;&#x2F;code&gt; is encountered. In other words: A jump to any codelocation equal to or greater than the location of the first &lt;code&gt;BEGINDATA&lt;&#x2F;code&gt; causes a &lt;code&gt;BAD_JUMP_DESTINATION&lt;&#x2F;code&gt; error.
If &lt;code&gt;BEGINDATA&lt;&#x2F;code&gt; is encountered during contract execution, it has the same semantics as &lt;code&gt;STOP&lt;&#x2F;code&gt;. It uses 0 gas.&lt;&#x2F;p&gt;
&lt;p&gt;Bytes past &lt;code&gt;BEGINDATA&lt;&#x2F;code&gt; remain accessible via &lt;code&gt;CODECOPY&lt;&#x2F;code&gt; and &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt;. &lt;code&gt;BEGINDATA&lt;&#x2F;code&gt; does not influence &lt;code&gt;CODESIZE&lt;&#x2F;code&gt; or &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The byte &lt;code&gt;0xb6&lt;&#x2F;code&gt; was chosen to align with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;615&#x2F;&quot;&gt;EIP-615&lt;&#x2F;a&gt;.
The choice to &lt;code&gt;STOP&lt;&#x2F;code&gt; if &lt;code&gt;BEGINDATA&lt;&#x2F;code&gt; is encountered is somewhat arbitrary. An alternative would be to be to abort the execution with an out-of-gas error.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The proposal will not change any existing contracts unless their current behaviour relies upon the usage of unused opcodes.&lt;&#x2F;p&gt;
&lt;p&gt;Since contracts have been using data from the very start, in a sense all of them use unused opcodes,
but they would have to use data in a way that it is skipped during execution and jumped over.
The Solidity compiler never generated such code. It has to be evaluated whether contracts created by other means
could have such a code structure.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases should include:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;A contract which jumps to a destination &lt;code&gt;X&lt;&#x2F;code&gt;, where &lt;code&gt;X&lt;&#x2F;code&gt; has a pc value higher than the &lt;code&gt;BEGINDATA&lt;&#x2F;code&gt; opcode, and the byte at &lt;code&gt;X&lt;&#x2F;code&gt; is &lt;code&gt;0x5b&lt;&#x2F;code&gt;. This should fail with a &lt;code&gt;BAD_JUMP_DESTINATION&lt;&#x2F;code&gt; error.&lt;&#x2F;li&gt;
&lt;li&gt;A contract which encounters the &lt;code&gt;BEGINDATA&lt;&#x2F;code&gt; opcode (should stop executing the current call frame)&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Not yet.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Simple Subroutines for the EVM</title>
        <published>2019-10-17T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Greg Colvin</name><uri>https://github.com/gcolvin</uri>
	</author>
	
	<author>
		<name>Martin Holst Swende</name><uri>https://github.com/holiman</uri>
	</author>
	
	<author>
		<name>Brooklyn Zelenka</name><uri>https://github.com/expede</uri>
	</author>
	
	<author>
		<name>John Max Skaller</name><email>skaller@internode.on.net</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2315/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2315-simple-subroutines-for-the-evm/3941" />
        

        <id>https://wg-eips.ritovision.com/2315/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:2315"
            label="EIP-2315" />
        

        
        

        
        <summary type="html">Two opcodes for efficient, safe, and static subroutines.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2315/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal provides a &lt;em&gt;complete&lt;&#x2F;em&gt;, &lt;em&gt;efficient&lt;&#x2F;em&gt;, &lt;em&gt;safe&lt;&#x2F;em&gt; and &lt;em&gt;static&lt;&#x2F;em&gt; control-flow facility.&lt;&#x2F;p&gt;
&lt;p&gt;It introduces two new opcodes to support calling and returning from subroutines:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;RJUMPSUB relative_offset&lt;&#x2F;code&gt; -- relative jump to subroutine&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RETURNSUB&lt;&#x2F;code&gt; -- return to &lt;code&gt;PC&lt;&#x2F;code&gt; after most recent &lt;code&gt;RJUMPSUB&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;It depends on the two new opcodes proposed by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4200&#x2F;&quot;&gt;EIP-4200&lt;&#x2F;a&gt; to support static jumps:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;RJUMP relative_offset&lt;&#x2F;code&gt; — relative jump to &lt;code&gt;PC + relative_offset&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RJUMPI relative_offset&lt;&#x2F;code&gt; — conditional relative jump&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;It deprecates &lt;code&gt;JUMP&lt;&#x2F;code&gt; and &lt;code&gt;JUMPI&lt;&#x2F;code&gt;, allowing valid code to support streaming, one-pass, and other near-linear compilers.&lt;&#x2F;p&gt;
&lt;p&gt;In concert with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3540&#x2F;&quot;&gt;EIP-3540&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3670&#x2F;&quot;&gt;EIP-3670&lt;&#x2F;a&gt; it ensures, at initialization time, that valid code will not execute invalid instructions or jump to invalid locations, will not underflow stack, will maintain consistent numbers of inputs and outputs for subroutines, and will have bounded stack height in the absence of recursion.&lt;&#x2F;p&gt;
&lt;p&gt;This is among the simplest possible proposals that meets these requirements.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;a-complete-control-flow-facility&quot;&gt;A complete control-flow facility.&lt;&#x2F;h3&gt;
&lt;p&gt;Jumps, conditional jumps and subroutines were proposed by Alan Turing in 1945 as a means of organizing the logic of the code and the design of the memory crystals for his Automatic Computing Engine:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;We wish to be able to arrange that sequences of orders can divide at various points, continuing in different ways according to the outcome of the calculations to date...  We also wish to be able to arrange for the splitting up of operations into subsidiary operations... To start on a subsidiary operation we need only make a note of where we left off the major operation and then apply the first instruction of the subsidiary.  When the subsidiary is over we look up the note and continue with the major operation.&lt;&#x2F;p&gt;
&lt;p&gt;— Alan Turing — in B.E. Carpenter, R.W. Doran, &quot;The other Turing machine.&quot; The Computer Journal, Volume 20, Issue 3, January 1977.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;In more contemporary terms, we have sequences of instructions, jumps and conditional jumps that divide sequences into blocks, subroutine calls, and a stack of addresses to return to.  The details vary, but similar facilities have proven their value across a long line of important machines over the last 75 years, including most all of the machines we have programmed or implemented -- physical machines including the Burroughs 5000, CDC 7600, IBM 360, DEC PDP-11 and VAX, Motorola 68000, Sun SPARC, and Intel x86s, as well as virtual machines for Scheme, Forth, Pascal, Java, Wasm, and others.&lt;&#x2F;p&gt;
&lt;p&gt;Unlike these machines, the Ethereum Virtual Machine &lt;em&gt;does not&lt;&#x2F;em&gt; provide subroutine operations. Instead, they must be synthesized using the dynamic &lt;code&gt;JUMP&lt;&#x2F;code&gt; instruction, which takes its destination on the stack. Further, the EVM provides &lt;em&gt;only&lt;&#x2F;em&gt; dynamic jumps, impeding the static analysis we need.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;efficient-control-flow&quot;&gt;Efficient control-flow.&lt;&#x2F;h3&gt;
&lt;p&gt;Efficient to write by hand, compile from high level labguages, validate at deploy time, interpret by VMs, and compile to machine code.&lt;&#x2F;p&gt;
&lt;p&gt;Static jumps, conditional jumps, and subroutines are sufficient and efficient in space and time, as shown by historical experience and as we will show for the EVM below.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;safe-control-flow&quot;&gt;Safe control-flow.&lt;&#x2F;h3&gt;
&lt;p&gt;The EVM has unusually high requirements for safety.  Not only do many smart contracts control inordinately large amounts of valuable Ether, but once placed on the blockchain any defects are visible to attackers and cannot be repaired.  We propose to statically validate important safety constraints on code at initialization time.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;static-control-flow&quot;&gt;Static control-flow.&lt;&#x2F;h3&gt;
&lt;p&gt;The EVM&#x27;s dynamic jumps cause two major problems. First, the need to synthesize static jumps and subroutines with dynamic jumps wastes space and gas with needlessly complex code, as we will show below.&lt;&#x2F;p&gt;
&lt;p&gt;Worse, jumps that can dynamically branch to any destination in the code can cause quadratic &quot;path explosions&quot; when traversing the flow of control. For Ethereum, this is a denial-of-service vulnerability that prevents us, at initialization time, from validating the safe use of EVM code and from compiling EVM code to machine code.&lt;&#x2F;p&gt;
&lt;p&gt;We &lt;em&gt;need&lt;&#x2F;em&gt; static control-flow to validate program safety and to compile EVM bytecode to machine code -- in time and space linear in the size of the code.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;opcodes&quot;&gt;Opcodes&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;rjumpsub-0x5f-relative-offset&quot;&gt;&lt;code&gt;RJUMPSUB (0x5f) relative_offset&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Transfers control to a subroutine.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Decode the &lt;code&gt;relative_offset&lt;&#x2F;code&gt; from the immediate data at &lt;code&gt;PC&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Push the current &lt;code&gt;PC + 3&lt;&#x2F;code&gt; to the &lt;code&gt;return stack&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Set &lt;code&gt;PC&lt;&#x2F;code&gt; to &lt;code&gt;PC + relative_offset&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The &lt;code&gt;relative_offset&lt;&#x2F;code&gt; is relative to the current &lt;code&gt;PC&lt;&#x2F;code&gt;. The offset is encoded as a two-byte, twos-complement signed integer, stored MSB-first.&lt;&#x2F;p&gt;
&lt;p&gt;The gas cost is &lt;em&gt;low&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;returnsub-0x5e&quot;&gt;&lt;code&gt;RETURNSUB (0x5e)&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Returns control to the caller of a subroutine.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Pop the &lt;code&gt;return stack&lt;&#x2F;code&gt; to &lt;code&gt;PC&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The gas cost is &lt;em&gt;verylow&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Notes:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Values popped off the &lt;code&gt;return stack&lt;&#x2F;code&gt; do not need to be validated, since they are alterable only by &lt;code&gt;RJUMPSUB&lt;&#x2F;code&gt; and &lt;code&gt;RETURNSUB&lt;&#x2F;code&gt;.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;The description above lays out the semantics of these instructions in terms of a &lt;code&gt;return stack&lt;&#x2F;code&gt;.  But the actual state of the &lt;code&gt;return stack&lt;&#x2F;code&gt; is not observable by EVM code or consensus-critical to the protocol.  (For example, a node implementer may code &lt;code&gt;RJUMPSUB&lt;&#x2F;code&gt; to unobservably push &lt;code&gt;PC&lt;&#x2F;code&gt; on the &lt;code&gt;return stack&lt;&#x2F;code&gt; rather than &lt;code&gt;PC + 1&lt;&#x2F;code&gt;, which is allowed so long as &lt;code&gt;RETURNSUB&lt;&#x2F;code&gt; observably returns control to the &lt;code&gt;PC + 3&lt;&#x2F;code&gt; location.)&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;validity&quot;&gt;Validity&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;em&gt;Execution&lt;&#x2F;em&gt; is defined in the Yellow Paper as a sequence of changes in the EVM state.  The conditions on valid code are preserved by state changes.  At runtime, if execution of an instruction would violate a condition the execution is in an exceptional halting state.  The Yellow Paper defines six such states.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Insufficient gas&lt;&#x2F;li&gt;
&lt;li&gt;More than 1024 stack items&lt;&#x2F;li&gt;
&lt;li&gt;State modification during a static call&lt;&#x2F;li&gt;
&lt;li&gt;Insufficient stack items&lt;&#x2F;li&gt;
&lt;li&gt;Invalid jump destination&lt;&#x2F;li&gt;
&lt;li&gt;Invalid instruction&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;We would like to consider EVM code valid iff no execution of the program can lead to an exceptional halting state.  In practice, we must test at runtime for the first three conditions.  We don’t know how much gas there will be, we don’t know how deep a recursion may go, analysis of stack depth even for non-recursive programs is nontrivial, and we don&#x27;t know whether a call will be static.  All of the remaining conditions MUST be validated statically, in time and space quasi-linear in the size of the code.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;static-constraints-on-valid-code&quot;&gt;Static Constraints on Valid Code&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Every instruction MUST be valid:
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;JUMP&lt;&#x2F;code&gt; and &lt;code&gt;JUMPI&lt;&#x2F;code&gt; instructions ARE NOT valid.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Every jump MUST be valid:
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;RJUMP&lt;&#x2F;code&gt;, &lt;code&gt;RJUMPI&lt;&#x2F;code&gt;, or &lt;code&gt;RJUMPSUB&lt;&#x2F;code&gt; instructions MUST NOT address immediate data or addresses outside of their code section.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The stacks MUST be valid:
&lt;ul&gt;
&lt;li&gt;The number of items on the &lt;code&gt;data stack&lt;&#x2F;code&gt; MUST always be positive.&lt;&#x2F;li&gt;
&lt;li&gt;The number of items on the &lt;code&gt;return stack &lt;&#x2F;code&gt;MUST always be positive.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The data stack MUST be consistently aligned:
&lt;ul&gt;
&lt;li&gt;The data stack height is
&lt;ul&gt;
&lt;li&gt;the absolute difference between the current &lt;code&gt;stack pointer&lt;&#x2F;code&gt; and the &lt;code&gt;stack pointer&lt;&#x2F;code&gt; on entry to the current subroutine.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;It MUST be the same for every reachable path through a given &lt;code&gt;PC&lt;&#x2F;code&gt; and&lt;&#x2F;li&gt;
&lt;li&gt;MUST NOT exceed 1024.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This is a purely semantic specification, placing no constraints on the syntax of code sections beyond being a sequence of opcodes and immediate data – a subroutine is not a contiguous sequence of bytecode, it is a subgraph of the bytecode&#x27;s control-flow graph.  The EVM is a simple state machine.  We only promise that valid code will not, as it were, jam up the gears of the machine.&lt;&#x2F;p&gt;
&lt;p&gt;By avoiding syntactic constraints we allow for optimizations like tail call elimination, multiple-entry subroutines, moving &quot;cold&quot; code out of line, and other ways of reducing redundancy and keeping &quot;hot&quot; code in cache.   Since we wish to support one-pass compilation of EVM code to machine code it is crucial that the EVM code be as well optimized as possible up front.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;validation&quot;&gt;Validation&lt;&#x2F;h3&gt;
&lt;p&gt;Rather than enforce constraints via syntax, we enforce them via validation.&lt;&#x2F;p&gt;
&lt;p&gt;The constraints on valid code cover all of the exceptional halting states that we can validate and allow code to be validated and compiled in time and space quasi-linear in the size of the code.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;RJUMP&lt;&#x2F;code&gt;, &lt;code&gt;RJUMPI&lt;&#x2F;code&gt; and &lt;code&gt;RJUMPSUB&lt;&#x2F;code&gt; instructions take their &lt;em&gt;relative_offset&lt;&#x2F;em&gt; as immediate arguments, which cannot change at runtime.  Having constant destinations for all jumps means that all jump destinations can be validated at initialization time, not runtime.  Dynamic jumps can branch to any destination in the code, so exploitable quadratic &quot;path explosions&quot; are possible when traversing the control flow graph. Deprecating &lt;code&gt;JUMP&lt;&#x2F;code&gt; and &lt;code&gt;JUMPI&lt;&#x2F;code&gt; prevents this.&lt;&#x2F;p&gt;
&lt;p&gt;Requiring a consistently aligned &lt;code&gt;data stack&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;prevents stack underflow&lt;&#x2F;li&gt;
&lt;li&gt;ensures that all calls to a subroutine have the same number of inputs and the same number of outputs and&lt;&#x2F;li&gt;
&lt;li&gt;ensures that stack height is bounded in the absence of recursion.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Requiring a consistently aligned &lt;code&gt;data stack&lt;&#x2F;code&gt; also allows some algorithms that traverse the control-flow graph -- including code validation and compilation -- to break cycles at joins, again preventing quadratic path explosion.  When a traversal gets to a &lt;code&gt;PC&lt;&#x2F;code&gt; it has visited before it is either at the beginning of a loop or the entry to a function.  Since the stack height at that &lt;code&gt;PC&lt;&#x2F;code&gt; is constant we know that loops will not grow stack, and that the number of arguments to a subroutine will always be the same -- there may be no need to traverse that path again.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Note: The JVM and Wasm enforce similar constraints for similar reasons.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;alternative-designs&quot;&gt;Alternative Designs&lt;&#x2F;h3&gt;
&lt;p&gt;There are a few major designs for a subroutine facility, two of which are considered here.  The others are mostly not appropriate for the EVM, such as the Wheeler Jump -- self-modifying code that writes return addresses into called subroutines.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;1. Keep return addresses on a dedicated return stack.&lt;&#x2F;em&gt; Turing&#x27;s design is often used by stack machines, including those for Forth, Java, Wasm, and others.  The data stack is used for computation, with a dedicated stack for return addresses.  A single instruction suffices to call, and another to return from a routine.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;2. Keep return addresses on the data stack.&lt;&#x2F;em&gt;  This design is often used by register machines, including those from CDC, IBM, DEC, Intel, and ARM.  The registers are used primarily for computation, and the stack maintains call frames for return addresses, arguments, and local variables.  On the EVM there are no registers for computation, so using the stack for both purposes can cause the sort of inefficiencies we see below.  Pascal p-code does use this design, but as part of a complex calling convention with dedicated registers.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;we-prefer-the-dedicated-return-stack&quot;&gt;We prefer the dedicated return stack.&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;It maintains a clear separation between calculation and flow of control:
&lt;ul&gt;
&lt;li&gt;the data stack is free of vulnerable return addresses and&lt;&#x2F;li&gt;
&lt;li&gt;it&#x27;s impossible to overwrite the return stack.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;It improves efficiency:
&lt;ul&gt;
&lt;li&gt;it uses native arithmetic rather than 256-bit EVM instructions for the return address,&lt;&#x2F;li&gt;
&lt;li&gt;doesn&#x27;t use up a &lt;code&gt;data stack&lt;&#x2F;code&gt; slot for the return address and&lt;&#x2F;li&gt;
&lt;li&gt;needs less motion of 256-bit data on the stack.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;efficiency&quot;&gt;Efficiency&lt;&#x2F;h3&gt;
&lt;p&gt;We illustrate here how subroutine instructions can be used to reduce the complexity and gas costs of both ordinary and optimized subroutine calls compared to using &lt;code&gt;JUMP&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;simple-subroutine-call&quot;&gt;&lt;strong&gt;Simple Subroutine Call&lt;&#x2F;strong&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Consider these examples of a fairly minimal subroutine, including the code to call it.&lt;&#x2F;p&gt;
&lt;p&gt;Subroutine call, using &lt;code&gt;RJUMPSUB&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SQUARE:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    dup1            ; 3 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    mul             ; 5 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    returnsub       ; 3 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CALL_SQUARE:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    push 0x02       ; 3 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    rjumpsub SQUARE ; 5 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;em&gt;Total gas: 19&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Subroutine call, using &lt;code&gt;JUMP&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SQUARE:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    jumpdest        ; 1 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    swap1           ; 3 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    dup1            ; 3 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    mul             ; 5 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    swap1           ; 3 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    jump            ; 8 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CALL_SQUARE:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    jumpdest        ; 1 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    push 0x02       ; 3 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    push RTN_CALL:  ; 3 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    push SQUARE     ; 3 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    jump            ; 8 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;RTN_CALL:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    jumpdest        ; 1 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;em&gt;Total: 41 gas&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Using &lt;code&gt;RJUMPSUB&lt;&#x2F;code&gt; versus &lt;code&gt;JUMP&lt;&#x2F;code&gt; saves &lt;em&gt;41 - 19 = 22 gas&lt;&#x2F;em&gt; — a &lt;em&gt;54%&lt;&#x2F;em&gt; improvement.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;tail-call-optimization&quot;&gt;&lt;strong&gt;Tail Call Optimization&lt;&#x2F;strong&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Of course in cases like this one we can optimize the tail call, so that the return from &lt;code&gt;SQUARE&lt;&#x2F;code&gt; actually returns from &lt;code&gt;TEST_SQUARE&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Tail call optimization, using &lt;code&gt;RJUMPSUB&lt;&#x2F;code&gt; and &lt;code&gt;RETURNSUB&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SQUARE:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    dup1            ; 3 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    mul             ; 5 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    returnsub       ; 3 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CALL_SQUARE:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    push 0x02       ; 3 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    rjump SQUARE    ; 3 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;em&gt;Total: 17 gas&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Tail call optimization, using &lt;code&gt;JUMP&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SQUARE:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    jumpdest        ; 1 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    swap1           ; 3 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    dup1            ; 3 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    mul             ; 5 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    swap2           ; 3 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    jump            ; 8 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CALL_SQUARE:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    jumpdest        ; 1 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    push 0x02       ; 3 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    push SQUARE     ; 3 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    jump            ; 8 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;em&gt;Total: 38 gas&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Using &lt;code&gt;RJUMPSUB&lt;&#x2F;code&gt; versus &lt;code&gt;JUMP&lt;&#x2F;code&gt; saves &lt;em&gt;38 - 17 = 21 gas&lt;&#x2F;em&gt; — a &lt;em&gt;55%&lt;&#x2F;em&gt; improvement.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;efficiency-caveats&quot;&gt;Efficiency Caveats&lt;&#x2F;h4&gt;
&lt;p&gt;We can see that these instructions provide a simpler and more gas-efficient subroutine mechanism than using &lt;code&gt;JUMP&lt;&#x2F;code&gt; — in our examples they cut gas use by about half.&lt;&#x2F;p&gt;
&lt;p&gt;Clearly, the benefits of this efficiency are greater for programs that have been factored into smaller subroutines.  How small?  Wrapping code in a subroutine costs only &lt;em&gt;8 gas&lt;&#x2F;em&gt; using &lt;code&gt;RJUMPSUB&lt;&#x2F;code&gt; and &lt;code&gt;RETURNSUB&lt;&#x2F;code&gt; versus &lt;em&gt;30 gas&lt;&#x2F;em&gt; using &lt;code&gt;JUMP&lt;&#x2F;code&gt;, &lt;code&gt;PUSH&lt;&#x2F;code&gt; and &lt;code&gt;SWAP&lt;&#x2F;code&gt; as above.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;costs&quot;&gt;Costs&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;em&gt;low&lt;&#x2F;em&gt; cost of &lt;code&gt;RJUMPSUB&lt;&#x2F;code&gt; versus the &lt;em&gt;mid&lt;&#x2F;em&gt; cost of &lt;code&gt;JUMP&lt;&#x2F;code&gt; is justified by needing only to decode the immediate two byte destination to the &lt;code&gt;PC&lt;&#x2F;code&gt; and push the return address on the &lt;code&gt;return stack&lt;&#x2F;code&gt;, all using native arithmetic, versus using the data stack with emulated 256-bit instructions.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;em&gt;verylow&lt;&#x2F;em&gt; cost of &lt;code&gt;RETURNSUB&lt;&#x2F;code&gt; is justified by needing only to pop the &lt;code&gt;return stack&lt;&#x2F;code&gt; into the &lt;code&gt;PC&lt;&#x2F;code&gt;.  Benchmarking will be needed to tell if the costs are well-balanced.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;These changes affect the semantics of existing EVM code: bytes that would have been interpreted as valid jump destinations may now be interpreted as immediate data.  Since this proposal depends on the Ethereum Object Format to signal the change this is not a practical issue.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;simple-routine&quot;&gt;Simple routine&lt;&#x2F;h3&gt;
&lt;p&gt;This should jump into a subroutine, back out and stop.&lt;&#x2F;p&gt;
&lt;p&gt;Bytecode: &lt;code&gt;0x5f0003005e&lt;&#x2F;code&gt; (&lt;code&gt;RJUMPSUB 3, RETURNSUB, STOP&lt;&#x2F;code&gt;)&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Pc&lt;&#x2F;th&gt;&lt;th&gt;Op&lt;&#x2F;th&gt;&lt;th&gt;Cost&lt;&#x2F;th&gt;&lt;th&gt;Stack&lt;&#x2F;th&gt;&lt;th&gt;RStack&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;RJUMPSUB&lt;&#x2F;td&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;STOP&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;RETURNSUB&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Output: 0x
Consumed gas: &lt;code&gt;10&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;two-levels-of-subroutines&quot;&gt;Two levels of subroutines&lt;&#x2F;h3&gt;
&lt;p&gt;This should execute fine, going into one two depths of subroutines&lt;&#x2F;p&gt;
&lt;p&gt;Bytecode: &lt;code&gt;0x5f00045F00025200&lt;&#x2F;code&gt; (&lt;code&gt;RJUMPSUB 4, RJUMPSUB 2, RETURNSUB, RETURNSUB, STOP&lt;&#x2F;code&gt;)&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Pc&lt;&#x2F;th&gt;&lt;th&gt;Op&lt;&#x2F;th&gt;&lt;th&gt;Cost&lt;&#x2F;th&gt;&lt;th&gt;Stack&lt;&#x2F;th&gt;&lt;th&gt;RStack&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;RJUMPSUB&lt;&#x2F;td&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;RJUMPSUB&lt;&#x2F;td&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;4&lt;&#x2F;td&gt;&lt;td&gt;RETURNSUB&lt;&#x2F;td&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;td&gt;RETURNSUB&lt;&#x2F;td&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;6&lt;&#x2F;td&gt;&lt;td&gt;STOP&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Consumed gas: &lt;code&gt;20&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;failure-1-invalid-jump&quot;&gt;Failure 1: invalid jump&lt;&#x2F;h3&gt;
&lt;p&gt;This should fail, since the given location is outside of the code-range.&lt;&#x2F;p&gt;
&lt;p&gt;Bytecode: &lt;code&gt;0X5fff&lt;&#x2F;code&gt;(&lt;code&gt;RJUMPSUB -1&lt;&#x2F;code&gt;)&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Pc&lt;&#x2F;th&gt;&lt;th&gt;Op&lt;&#x2F;th&gt;&lt;th&gt;Cost&lt;&#x2F;th&gt;&lt;th&gt;Stack&lt;&#x2F;th&gt;&lt;th&gt;RStack&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;RJUMPSUB&lt;&#x2F;td&gt;&lt;td&gt;10&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Error: at pc=0, op=RJUMPSUB: invalid jump destination&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;failure-2-shallow-return-stack&quot;&gt;Failure 2: shallow &lt;code&gt;return stack&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;This should fail at first opcode, due to shallow &lt;code&gt;return_stack&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Bytecode: &lt;code&gt;0x5e&lt;&#x2F;code&gt; (&lt;code&gt;RETURNSUB&lt;&#x2F;code&gt;)&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Pc&lt;&#x2F;th&gt;&lt;th&gt;Op&lt;&#x2F;th&gt;&lt;th&gt;Cost&lt;&#x2F;th&gt;&lt;th&gt;Stack&lt;&#x2F;th&gt;&lt;th&gt;RStack&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;RETURNSUB&lt;&#x2F;td&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Error: at pc=0, op=RETURNSUB: invalid retsub&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;subroutine-at-end-of-code&quot;&gt;Subroutine at end of code&lt;&#x2F;h3&gt;
&lt;p&gt;In this example the RJUMPSUB is on the last byte of code. When the subroutine returns, it should hit the &#x27;virtual stop&#x27; &lt;em&gt;after&lt;&#x2F;em&gt; the bytecode, and not exit with error&lt;&#x2F;p&gt;
&lt;p&gt;Bytecode: &lt;code&gt;0x5c00045e5fffff&lt;&#x2F;code&gt; (&lt;code&gt;RJUMP 4, RETURNSUB, RJUMPSUB -1&lt;&#x2F;code&gt;)&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Pc&lt;&#x2F;th&gt;&lt;th&gt;Op&lt;&#x2F;th&gt;&lt;th&gt;Cost&lt;&#x2F;th&gt;&lt;th&gt;Stack&lt;&#x2F;th&gt;&lt;th&gt;RStack&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;RJUMP&lt;&#x2F;td&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;RETURNSUB&lt;&#x2F;td&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;4&lt;&#x2F;td&gt;&lt;td&gt;RJUMPSUB&lt;&#x2F;td&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;7&lt;&#x2F;td&gt;&lt;td&gt;STOP&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Consumed gas: &lt;code&gt;15&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The following is a pseudo-Python implementation of an algorithm for predicating code validity.  An equivalent algorithm must be run at initialization time.&lt;&#x2F;p&gt;
&lt;p&gt;This algorithm performs a symbolic execution of the program that recursively traverses the &lt;em&gt;code&lt;&#x2F;em&gt;, emulating its control flow and stack use and checking for violations of the rules above.&lt;&#x2F;p&gt;
&lt;p&gt;It runs in time equal to &lt;code&gt;O(vertices + edges)&lt;&#x2F;code&gt; in the program&#x27;s control-flow graph, where edges represent control flow and the vertices represent &lt;em&gt;basic blocks&lt;&#x2F;em&gt; — thus the algorithm takes time proportional to the size of the &lt;em&gt;code&lt;&#x2F;em&gt;. It maintains a stack of continuations for conditional jumps, the size of which is at most proportional to the size of the &lt;em&gt;code&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;validation-function&quot;&gt;Validation Function&lt;&#x2F;h3&gt;
&lt;p&gt;** Note: this function is known to be incomplete and incorrect. **&lt;&#x2F;p&gt;
&lt;p&gt;For simplicity&#x27;s sake we assume that all jumpdest analysis and prior validation has been done, including EIP-3540, EIP-3670, and EIP-4200, so EOF headers and sections are well-formed, and there are no invalid instructions or jumps.  In practice, all passes of validation can be folded into a single loop no recursion.&lt;&#x2F;p&gt;
&lt;p&gt;We also assume some helper functions.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;is_valid(opcode)&lt;&#x2F;code&gt; returns true iff opcode is valid.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;is_terminator(opcode)&lt;&#x2F;code&gt; returns true iff opcode is terminator.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;is_valid_jumpdest(pc)&lt;&#x2F;code&gt; returns true iff &lt;code&gt;pc&lt;&#x2F;code&gt; is a valid jump destination.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;immediate_data(pc)&lt;&#x2F;code&gt; returns the immediate data for the instruction at &lt;code&gt;pc&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;immediate_size(opcode)&lt;&#x2F;code&gt; returns the size of the immediate data for an opcode.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;removed_items(opcode)&lt;&#x2F;code&gt; returns the number of items removed from the &lt;code&gt;data_stack&lt;&#x2F;code&gt; by the &lt;code&gt;opcode&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;added_items(opcode)&lt;&#x2F;code&gt; returns the number of items added to the &lt;code&gt;data_stack&lt;&#x2F;code&gt; by the &lt;code&gt;opcode&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# returns true iff code is valid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def validate_code(code: bytes, pc: int, sp: int, bp: int) -&amp;gt; boolean:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    continuations = []&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    do&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        while pc &amp;lt; len(code):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            opcode = code[pc]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if !is_valid(opcode):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                return false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if is_terminator(opcode):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                return true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            # check stack height and return if we have been here before&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            stack_height = sp - bp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if stack_height &amp;gt; 1024&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                return false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if pos in stack_heights:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                if stack_height != stack_heights[pos]:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    return false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                return true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            else:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                stack_heights[pos] = stack_height&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if opcode == RJUMP:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                # reset pc to destination of jump&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                jumpdest = immediate_data(pc)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                pc += jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                if !is_valid_jumpdest(pc)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    return false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            elif opcode == RJUMPI:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                jumpdest = pc + immediate_data(pc)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                if !is_valid_jumpdest(pc)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    return false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                # continue true side of conditional later&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                continations.push((jumpdest, sp, bp))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                # continue false side of conditional now&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            elif opcode == RJUMPSUB:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                # will enter subroutine at destination&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                bp = sp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                # push return address and reset pc to destination&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                jumpdest = pc + immediate_data(pc)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                if !is_valid_jumpdest(pc)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    return false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                push(return_stack, pc + 3)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                pc = jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                continue&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            elif opcode == RETURNSUB:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                # will return to subroutine at destination&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                bp = sp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                # pop return address and check for preceding call&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                pc = pop(return_stack)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                if code[pc - 3] != RJUMPSUB:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                   return false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            # apply instructions to stack&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            sp -= removed_items(opcode)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if sp &amp;lt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                return false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            sp += added_items(opcode)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            # Skip opcode and immediate data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            pc += 1 + immediate_size(opcode)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        while (pc, sp, bp) = continuations.pop()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;These changes introduce new flow control instructions.  They do not introduce any new security considerations. This EIP is intended to improve security by validating a higher level of safety for EVM code deployed on the blockchain.  The validation algorithm must be quasi-linear in time and space to not be a denial of service vulnerability.  The algorithm here makes one linear-time pass of the bytecode, and uses a stack of continuations that cannot exceed the number of &lt;code&gt;RJUMPI&lt;&#x2F;code&gt; instructions in the code.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>ERC-721 Consecutive Transfer Extension</title>
        <published>2019-10-08T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Sean Papanikolas</name><uri>https://github.com/pizzarob</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2309/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/2309" />
        

        <id>https://wg-eips.ritovision.com/2309/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:2309"
            label="ERC-2309" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2309/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;A standardized event emitted when creating&#x2F;transferring one, or many non-fungible tokens using consecutive token identifiers.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The optional ERC-721 Consecutive Transfer Extension provides a standardized event which could be emitted during the creation&#x2F;transfer of one, or many non-fungible tokens. This standard does not set the expectation of how you might create&#x2F;transfer many tokens it is only concerned with the event emitted after the creation, or transfer of ownership of these tokens. This extension assumes that token identifiers are in consecutive order.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This extension provides even more scalibility of the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721 specification&lt;&#x2F;a&gt;. It is possible to create, transfer, and burn 2^256 non-fungible tokens in one transaction. However, it is not possible to emit that many &lt;code&gt;Transfer&lt;&#x2F;code&gt; events in one transaction. The &lt;code&gt;Transfer&lt;&#x2F;code&gt; event is part of the original specification which states:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;This emits when ownership of any NFT changes by any mechanism.
This event emits when NFTs are created (&lt;code&gt;from&lt;&#x2F;code&gt; == 0) and destroyed
(&lt;code&gt;to&lt;&#x2F;code&gt; == 0). Exception: during contract creation, any number of NFTs
may be created and assigned without emitting Transfer. At the time of
any transfer, the approved address for that NFT (if any) is reset to none.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;This allows for the original &lt;code&gt;Transfer&lt;&#x2F;code&gt; event to be emitted for one token at a time, which in turn gives us O(n) time complexity. Minting one billion NFTs can be done in one transaction using efficient data structures, but in order to emit the &lt;code&gt;Transfer&lt;&#x2F;code&gt; event - according to the original spec - one would need a loop with one billion iterations which is bound to run out of gas, or exceed transaction timeout limits. This cannot be accomplished with the current spec. This extension solves that problem.&lt;&#x2F;p&gt;
&lt;p&gt;Many decentralized marketplaces and block explorers utilize the &lt;code&gt;Transfer&lt;&#x2F;code&gt; event as a way to determine which NFTs an address owns. The Consecutive Transfer Extension provides a standard mechanism for these platforms to use to determine ownership of many tokens.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL
NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot;, and
&quot;OPTIONAL&quot; in this document are to be interpreted as described in
RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;ERC-721 compliant contracts MAY implement this Consecutive Transfer Extension to provide a standard event to be emitted at the time of creation, burn, or transfer of one or many consecutive tokens&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The address executing the transaction &lt;strong&gt;MUST&lt;&#x2F;strong&gt; own all the tokens within the range of &lt;code&gt;fromTokenId&lt;&#x2F;code&gt; and &lt;code&gt;toTokenId&lt;&#x2F;code&gt;, or &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be an approved operator to act on the owners behalf.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;fromTokenId&lt;&#x2F;code&gt; and &lt;code&gt;toTokenId&lt;&#x2F;code&gt; &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be a consecutive range of tokens IDs.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;fromTokenId&lt;&#x2F;code&gt;, &lt;code&gt;fromAddress&lt;&#x2F;code&gt;, and &lt;code&gt;toAddress&lt;&#x2F;code&gt; &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be indexed parameters&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;toTokenId&lt;&#x2F;code&gt; &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; be an indexed parameter&lt;&#x2F;p&gt;
&lt;p&gt;When minting&#x2F;creating tokens, the &lt;code&gt;fromAddress&lt;&#x2F;code&gt; argument &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be set to &lt;code&gt;0x0&lt;&#x2F;code&gt; (i.e. zero address).&lt;&#x2F;p&gt;
&lt;p&gt;When burning&#x2F;destroying tokens, the &lt;code&gt;toAddress&lt;&#x2F;code&gt; argument &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be set to &lt;code&gt;0x0&lt;&#x2F;code&gt; (i.e. zero address).&lt;&#x2F;p&gt;
&lt;p&gt;When emitting the ConsecutiveTransfer event the Transfer event &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; be emitted&lt;&#x2F;p&gt;
&lt;p&gt;Contracts that implement the &lt;code&gt;ConsecutiveTransfer&lt;&#x2F;code&gt; event &lt;strong&gt;MAY&lt;&#x2F;strong&gt; still use the original &lt;code&gt;Transfer&lt;&#x2F;code&gt; event, however when emitting the &lt;code&gt;ConsecutiveTransfer&lt;&#x2F;code&gt; event the &lt;code&gt;Transfer&lt;&#x2F;code&gt; event &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; be emitted.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ConsecutiveTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; fromTokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; toTokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; fromAddress&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; toAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;examples&quot;&gt;Examples&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;ConsecutiveTransfer&lt;&#x2F;code&gt; event can be used for a single token as well as many tokens:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Single token creation&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;emit ConsecutiveTransfer(1, 1, address(0), toAddress);&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Batch token creation&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;emit ConsecutiveTransfer(1, 100000, address(0), toAddress);&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Batch token transfer&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;emit ConsecutiveTransfer(1, 100000, fromAddress, toAddress);&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Burn&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;emit ConsecutiveTransfer(1, 100000, from, address(0));&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Standardizing the &lt;code&gt;ConsecutiveTransfer&lt;&#x2F;code&gt; event gives decentralized platforms a standard way of determining ownership of large quantities of non-fungible tokens without the need to support a new token standard. There are many ways in which the batch creation and transfer of NFTs can be implemented. The Consecutive Transfer Extension allows contract creators to implement batch creation, transfer, and burn methods however they see fit, but provides a standardized event in which all implementations can use. By specifying a range of consecutive token identifiers we can easily cover the transfer, or creation of 2^(256) tokens and decentralized platforms can react accordingly.&lt;&#x2F;p&gt;
&lt;p&gt;Take this example. I sell magical fruit and have a farm with 10,000 magical fruit trees each with different fruit and 1,000 new trees every few years. I want to turn each tree into a non-fungible token that people can own. Each person that owns one of my non-fungible tree tokens will receive a quarterly percentage of each harvest from that tree. The problem is that I would need to create and transfer each of these tokens individually - which will cost me a lot of time and money and frankly would keep me from doing this.&lt;&#x2F;p&gt;
&lt;p&gt;With this extension I would be able to mint my initial 10,000  tree tokens in one transaction. I would be able to quickly and cheaply mint my additional 1,000  tree tokens when a new batch is planted. I would then be able to transfer all of the 10,000+ tree tokens to a special smart contract that keeps track of the selling and distribution of funds in one transaction all while adhering to a specified standard.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Rationale to have a single event that covers minting, burning, and transferring&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;ConsecutiveTransfer&lt;&#x2F;code&gt; event can be used to cover minting, burning, and transferring events. While there may have been confusion in the beginning adhering to transfer to&#x2F;from &quot;0&quot; pattern this is mitigated by checking for the &lt;code&gt;ConsecutiveTransfer&lt;&#x2F;code&gt; topic and verifying the emitting contract supports the ERC-721 interface by using the ERC-165 standard.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Indexed event parameters&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Events in Solidity can have up to three indexed parameters which will make it possible to filter for specific values of indexed arguments. This standard sets the &lt;code&gt;fromAddress&lt;&#x2F;code&gt;, &lt;code&gt;toAddress&lt;&#x2F;code&gt;, and &lt;code&gt;fromTokenId&lt;&#x2F;code&gt; as the indexed parameters. The &lt;code&gt;toTokenId&lt;&#x2F;code&gt; can be retrieved from the data part of the log. The reason for this is that more often than not one may be searching for events to learn about the history of ownership for a given address. The &lt;code&gt;fromTokenId&lt;&#x2F;code&gt; can then be retrieved along with the other two indexed parameters for simplicity. Then one only needs to decode the log data which is ensured to be the &lt;code&gt;toTokenId&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Rationale to not emit &lt;code&gt;Transfer&lt;&#x2F;code&gt; when &lt;code&gt;ConsecutiveTransfer&lt;&#x2F;code&gt; is also emitted&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;This can lead to bugs and unnecessary complex logic for platforms using these events to track token ownership. When transferring a single token it is acceptable to emit the original &lt;code&gt;Transfer&lt;&#x2F;code&gt; event, but the &lt;code&gt;ConsecutiveTransfer&lt;&#x2F;code&gt; event should not be emitted during the same transaction and vice-versa.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Comparing 2309 and 1155&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;As the NFT market continues to grow so does the need for the ability to scale the smart contracts. Users need to be able to do things like mint a massive amount of tokens at one time, transfer a massive amount of tokens, and be able to track ownership of all these assets. We need to do this in a way that is cost effective and doesn’t fail under the confines of the Ethereum blockchain. As millions of tokens are minted we need contracts with the ability to scale.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; was created and added as a standard in 2019 to try to solve these problems, but it falls short when it comes to minting massive amounts of unique tokens in a cost-effective way. With ERC-1155 it’s either going to cost hundreds (or thousands) of dollars or it’s going to run out of gas. ERC-1155 works well when minting many semi-fungible tokens but falls short when minting many unique tokens. Using the 2309 standard you could mint millions of blank NFTs upfront and update the metadata for each one in a cost effective way.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This extension was written to allow for the smallest change possible to the original ERC-721 spec while still providing a mechanism to track the creation, transfer, and deletion of a massive amount of tokens. While it is a minimal change the effects on platforms that only use the original &lt;code&gt;Transfer&lt;&#x2F;code&gt; event to index token ownership would be severe. They would not be properly recording token ownership information that could be known by listening for the &lt;code&gt;ConsecutiveTransfer&lt;&#x2F;code&gt; event. For platforms that wish to support the &lt;code&gt;ConsecutiveTransfer&lt;&#x2F;code&gt; event it would be best to support both the original &lt;code&gt;Transfer&lt;&#x2F;code&gt; event and the &lt;code&gt;ConsecutiveTransfer&lt;&#x2F;code&gt; event to track token ownership.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;There are no security considerations related directly to the implementation of this standard.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>BLS12-381 Key Generation</title>
        <published>2019-09-30T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Carl Beekhuizen</name><uri>https://github.com/CarlBeek</uri><email>carl@ethereum.org</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2333/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/bls-keys-related-erc-discussion-erc-2333-2334-2335/19774" />
        

        <id>https://wg-eips.ritovision.com/2333/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2333"
            label="ERC-2333" />
        

        
        

        
        <summary type="html">BLS12-381 Key Generation using a hierarchical tree</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2333/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is a method for deriving a tree-hierarchy of BLS12-381 keys based on an entropy seed. Starting with the aforementioned seed, a tree of keys is built out using only the parent node&#x27;s private key and the index of the desired child. This allows for a practically limitless number of keys to be derived for many different purposes while only requiring knowledge of a single ancestor key in the tree. This allows for keys, or families thereof, to be provisioned for different purposes by further standards.&lt;&#x2F;p&gt;
&lt;p&gt;In addition to the above, this method of deriving keys provides an emergency backup signature scheme that is resistant to quantum computers for in the event that BLS12-381 is ever deemed insecure.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;deficiencies-of-the-existing-mechanism&quot;&gt;Deficiencies of the existing mechanism&lt;&#x2F;h3&gt;
&lt;p&gt;The curve BLS12-381 used for BLS signatures within the Beacon chain (alongside many other projects) mandates a new key derivation scheme. The most commonly used scheme for key derivation within Ethereum for secp256k1 keys is &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;bitcoin&#x2F;bips&#x2F;blob&#x2F;43ce3a461dfb48e62ffa0cfc70f5f54d1eb5c577&#x2F;bip-0032.mediawiki&quot;&gt;BIP32&lt;&#x2F;a&gt; (also known as HD derivation) which deems keys greater than the curve order invalid. Based on the order of the private key subgroup of BLS12-381 and the size of the entropy utilised, more than 54% of keys generated by BIP32 would be invalid. (secp256k1 keys derived by BIP32 are invalid with probability less than 1 in 2&lt;sup&gt;-127&lt;&#x2F;sup&gt;.)&lt;&#x2F;p&gt;
&lt;h3 id=&quot;establishing-a-multi-chain-standard-early-on&quot;&gt;Establishing a multi-chain standard early on&lt;&#x2F;h3&gt;
&lt;p&gt;By establishing a standard before the first users begin to generate their keys, the hope is that a single standard is highly pervasive and therefore can be assumed to be the method by which the majority of keys are provided. This is valuable for two reasons, firstly in order for a post-quantum backup mechanism to be effective, there needs to be an enshrined mechanism whereby users can switch to a post-quantum signature scheme with pre-shared public keys (something this EIP provides at 0 extra storage cost). Secondly, this unifies the inter- and intra-chain ecosystem by having common tooling ideally allowing users to switch between key-management systems.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;a-post-quantum-backup&quot;&gt;A post-quantum backup&lt;&#x2F;h3&gt;
&lt;p&gt;This key derivation scheme has a Lamport key pair which is generated as a intermediate step in the key generation process. This key pair can be used to provide a Lamport signature which is a useful backup in the event of BLS12-381 no longer being considered secure (in the event of quantum computing making a sudden advancement, for example). The idea is the Lamport signature will act as a bridge to a new signature scheme which is deemed to be secure.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;version&quot;&gt;Version&lt;&#x2F;h3&gt;
&lt;p&gt;Due to the evolving BLS signatures CFRG draft (currently v4), the &lt;code&gt;KeyGen&lt;&#x2F;code&gt; function was updated, meaning that &lt;code&gt;hkdf_mod_r&lt;&#x2F;code&gt; no longer reflected what appeared in the BLS standard. This EIP was updated on the 17th of September 2020 to reflect this new method for deriving keys, &lt;strong&gt;if you are implementing this EIP, please make sure your version is up to date.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;specification-1&quot;&gt;Specification&lt;&#x2F;h3&gt;
&lt;p&gt;Keys are defined in terms of a tree structure where a key is determined by the tree&#x27;s seed and a tree path. This is very useful as one can start with a single source of entropy and build out a practically unlimited number of keys. The specification can be broken into two sub-components: generating the master key, and constructing a child key from its parent. The master key is used as the root of the tree and then the tree is built in layers on top of this root.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;the-tree-structure&quot;&gt;The Tree Structure&lt;&#x2F;h3&gt;
&lt;p&gt;The key tree is defined purely through the relationship between a child-node and its ancestors. Starting with the root of the tree, the &lt;em&gt;master key&lt;&#x2F;em&gt;, a child node can be derived by knowing the parent&#x27;s private key and the index of the child. The tree is broken up into depths which are indicated by &lt;code&gt;&#x2F;&lt;&#x2F;code&gt; and the master node is described as &lt;code&gt;m&lt;&#x2F;code&gt;. The first child of the master node is therefore described as &lt;code&gt;m &#x2F; 0&lt;&#x2F;code&gt; and &lt;code&gt;m &#x2F; 0&lt;&#x2F;code&gt;&#x27;s siblings are &lt;code&gt;m &#x2F; i&lt;&#x2F;code&gt; for all &lt;code&gt;0 &amp;lt;= i &amp;lt; 2**32&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      [m &#x2F; 0] - [m &#x2F; 0 &#x2F; 0]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     &#x2F;        \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;           [m &#x2F; 0 &#x2F; 1]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[m] - [m &#x2F; 1]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      [m &#x2F; i]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;key-derivation&quot;&gt;Key derivation&lt;&#x2F;h3&gt;
&lt;p&gt;Every key generated via the key derivation process derives a child key via a set of intermediate Lamport keys. The idea behind the Lamport keys is to provide a post-quantum backup in case BLS12-381 is no longer deemed secure. At a high level, the key derivation process works by using the parent node&#x27;s privkey as an entropy source for the Lamport private keys which are then hashed together into a compressed Lamport public key, this public key is then hashed into BLS12-381&#x27;s private key group.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;ikm-to-lamport-sk&quot;&gt;&lt;code&gt;IKM_to_lamport_SK&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;inputs&quot;&gt;Inputs&lt;&#x2F;h5&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;IKM&lt;&#x2F;code&gt;, a secret octet string&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;salt&lt;&#x2F;code&gt;, an octet string&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;outputs&quot;&gt;Outputs&lt;&#x2F;h5&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;lamport_SK&lt;&#x2F;code&gt;, an array of 255 32-octet strings&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h5&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;HKDF-Extract&lt;&#x2F;code&gt; is as defined in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc5869&quot;&gt;RFC5869&lt;&#x2F;a&gt;, instantiated with SHA256&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;HKDF-Expand&lt;&#x2F;code&gt; is as defined in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc5869&quot;&gt;RFC5869&lt;&#x2F;a&gt;, instantiated with SHA256&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;K = 32&lt;&#x2F;code&gt; is the digest size (in octets) of the hash function (SHA256)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;L = K * 255&lt;&#x2F;code&gt; is the HKDF output size (in octets)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;&quot;&quot;&lt;&#x2F;code&gt; is the empty string&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;bytes_split&lt;&#x2F;code&gt; is a function takes in an octet string and splits it into &lt;code&gt;K&lt;&#x2F;code&gt;-byte chunks which are returned as an array&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;procedure&quot;&gt;Procedure&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0. PRK = HKDF-Extract(salt, IKM)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;1. OKM = HKDF-Expand(PRK, &amp;quot;&amp;quot; , L)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;2. lamport_SK = bytes_split(OKM, K)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;3. return lamport_SK&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;parent-sk-to-lamport-pk&quot;&gt;&lt;code&gt;parent_SK_to_lamport_PK&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;inputs-1&quot;&gt;Inputs&lt;&#x2F;h5&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;parent_SK&lt;&#x2F;code&gt;, the BLS Secret Key of the parent node&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;index&lt;&#x2F;code&gt;, the index of the desired child node, an integer &lt;code&gt;0 &amp;lt;= index &amp;lt; 2^32&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;outputs-1&quot;&gt;Outputs&lt;&#x2F;h5&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;lamport_PK&lt;&#x2F;code&gt;, the compressed lamport PK, a 32 octet string&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;definitions-1&quot;&gt;Definitions&lt;&#x2F;h5&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;I2OSP&lt;&#x2F;code&gt; is as defined in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc3447&quot;&gt;RFC3447&lt;&#x2F;a&gt; (Big endian decoding)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;flip_bits&lt;&#x2F;code&gt; is a function that returns the bitwise negation of its input&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;&quot;&quot;&lt;&#x2F;code&gt; is the empty string&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;a | b&lt;&#x2F;code&gt; is the concatenation of &lt;code&gt;a&lt;&#x2F;code&gt; with &lt;code&gt;b&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;procedure-1&quot;&gt;Procedure&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0. salt = I2OSP(index, 4)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;1. IKM = I2OSP(parent_SK, 32)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;2. lamport_0 = IKM_to_lamport_SK(IKM, salt)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;3. not_IKM = flip_bits(IKM)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;4. lamport_1 = IKM_to_lamport_SK(not_IKM, salt)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;5. lamport_PK = &amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;6. for i  in 1, .., 255&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;       lamport_PK = lamport_PK | SHA256(lamport_0[i])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;7. for i  in 1, .., 255&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;       lamport_PK = lamport_PK | SHA256(lamport_1[i])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;8. compressed_lamport_PK = SHA256(lamport_PK)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;9. return compressed_lamport_PK&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;&#x2F;strong&gt; The indexing, &lt;code&gt;i&lt;&#x2F;code&gt;, in the above procedure iterates from 1 to 255 (inclusive). This is due to the limit to which HKDF can stretch the input bytes (255 times the length of the input bytes). The result of this is that the security of the lamport-backup signature is *only* 127.5 bit.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;hkdf-mod-r&quot;&gt;&lt;code&gt;HKDF_mod_r&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;hkdf_mod_r()&lt;&#x2F;code&gt; is used to hash 32 random bytes into the subgroup of the BLS12-381 private keys.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;inputs-2&quot;&gt;Inputs&lt;&#x2F;h5&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;IKM&lt;&#x2F;code&gt;, a secret octet string &amp;gt;= 256 bits in length&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;key_info&lt;&#x2F;code&gt;, an optional octet string (default=&lt;code&gt;&quot;&quot;&lt;&#x2F;code&gt;, the empty string)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;outputs-2&quot;&gt;Outputs&lt;&#x2F;h5&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;SK&lt;&#x2F;code&gt;, the corresponding secret key, an integer 0 &amp;lt;= SK &amp;lt; r.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;definitions-2&quot;&gt;Definitions&lt;&#x2F;h5&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;HKDF-Extract&lt;&#x2F;code&gt; is as defined in RFC5869, instantiated with hash H.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;HKDF-Expand&lt;&#x2F;code&gt; is as defined in RFC5869, instantiated with hash H.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;L&lt;&#x2F;code&gt; is the integer given by &lt;code&gt;ceil((3 * ceil(log2(r))) &#x2F; 16)&lt;&#x2F;code&gt;.(&lt;code&gt;L=48&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;&quot;BLS-SIG-KEYGEN-SALT-&quot;&lt;&#x2F;code&gt; is an ASCII string comprising 20 octets.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;OS2IP&lt;&#x2F;code&gt; is as defined in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc3447&quot;&gt;RFC3447&lt;&#x2F;a&gt; (Big endian encoding)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;I2OSP&lt;&#x2F;code&gt; is as defined in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc3447&quot;&gt;RFC3447&lt;&#x2F;a&gt; (Big endian decoding)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;r&lt;&#x2F;code&gt; is the order of the BLS 12-381 curve defined in the draft IETF BLS signature scheme standard.&lt;code&gt;r=52435875175126190479447740508185965837690552500527637822603658699938581184513&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;procedure-2&quot;&gt;Procedure&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;1. salt = &amp;quot;BLS-SIG-KEYGEN-SALT-&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;2. SK = 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;3. while SK == 0:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;4.     salt = H(salt)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;5.     PRK = HKDF-Extract(salt, IKM || I2OSP(0, 1))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;6.     OKM = HKDF-Expand(PRK, key_info || I2OSP(L, 2), L)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;7.     SK = OS2IP(OKM) mod r&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;8. return SK&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;derive-child-sk&quot;&gt;&lt;code&gt;derive_child_SK&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The child key derivation function takes in the parent&#x27;s private key and the index of the child and returns the child private key.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;inputs-3&quot;&gt;Inputs&lt;&#x2F;h5&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;parent_SK&lt;&#x2F;code&gt;, the secret key of the parent node, a big endian encoded integer&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;index&lt;&#x2F;code&gt;, the index of the desired child node, an integer &lt;code&gt;0 &amp;lt;= index &amp;lt; 2^32&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;outputs-3&quot;&gt;Outputs&lt;&#x2F;h5&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;child_SK&lt;&#x2F;code&gt;, the secret key of the child node, a big endian encoded integer&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;procedure-3&quot;&gt;Procedure&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0. compressed_lamport_PK = parent_SK_to_lamport_PK(parent_SK, index)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;1. SK = HKDF_mod_r(compressed_lamport_PK)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;2. return SK&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;derive-master-sk&quot;&gt;&lt;code&gt;derive_master_SK&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The child key derivation function takes in the parent&#x27;s private key and the index of the child and returns the child private key. The seed should ideally be derived from a mnemonic, with the intention being that the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;bitcoin&#x2F;bips&#x2F;blob&#x2F;43ce3a461dfb48e62ffa0cfc70f5f54d1eb5c577&#x2F;bip-0039.mediawiki&quot;&gt;BIP-39 mnemonic_to_seed method&lt;&#x2F;a&gt; be used.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;inputs-4&quot;&gt;Inputs&lt;&#x2F;h5&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;seed&lt;&#x2F;code&gt;, the source entropy for the entire tree, a octet string &amp;gt;= 256 bits in length&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;outputs-4&quot;&gt;Outputs&lt;&#x2F;h5&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;SK&lt;&#x2F;code&gt;, the secret key of master node within the tree, a big endian encoded integer&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;procedure-4&quot;&gt;Procedure&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0. SK = HKDF_mod_r(seed)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;1. return SK&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;lamport-signatures&quot;&gt;Lamport signatures&lt;&#x2F;h3&gt;
&lt;p&gt;Lamport signatures are used as the backup mechanism because of their relative simplicity for a post-quantum signature scheme. Lamport signatures are very easy both to explain and implement as the sole cryptographic dependency is a secure hash function. This is important as it minimises the complexity of implementing this standard as well as the compute time for deriving a key. Lamport signatures have very large key sizes which make them impractical for many use cases, but this is not deemed to be an issue in this case as this scheme is only meant to be a once-off event to migrate to a new scheme.&lt;&#x2F;p&gt;
&lt;p&gt;Revealing the associated Lamport public key for a corresponding BLS key is done by verifying that the Lamport public key is the pre-image of the corresponding BLS private key (which in turn is verified against the BLS public key). This means that using a key&#x27;s Lamport signature reveals the BLS private key rendering the BLS key pair unsafe. This has the upside of not requiring additional storage space for backup keys alongside BLS keys but does require that the Lamport signatures be used once and that the BLS key is no longer trusted after that point.&lt;&#x2F;p&gt;
&lt;p&gt;The Lamport signatures used within this scheme have 255 bits worth of security, not 256. This is done because HKDF-SHA256, the mechanism used to stretch a key&#x27;s entropy, has a length-limit of &lt;code&gt;255 * hash_function_digest_size&lt;&#x2F;code&gt;. The 1-bit reduction in security is deemed preferable over increasing the complexity of the entropy stretching mechanism.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;sha256&quot;&gt;SHA256&lt;&#x2F;h3&gt;
&lt;p&gt;SHA256 is used as the hash function throughout this standard as it is the hash function chosen by the IETF BLS signature proposed standard. Using a single hash function for everything decreases the number of cryptographic primitives required to implement the entire BLS standardised key-stack while reducing the surface for flaws in the overall system.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;hkdf-mod-r-1&quot;&gt;&lt;code&gt;hkdf_mod_r()&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The function &lt;code&gt;hkdf_mod_r()&lt;&#x2F;code&gt; in this standard is the same as the &lt;code&gt;KeyGen&lt;&#x2F;code&gt; function described in the draft IETF signature standard and therefore the private key obtained from &lt;code&gt;KeyGen&lt;&#x2F;code&gt; is equal to that obtained from &lt;code&gt;hkdf_mod_r&lt;&#x2F;code&gt; for the same seed bytes. This means that common engineering can be done when implementing this function. Additionally because of its inclusion in an IETF standard, it has had much scrutiny by many cryptographers and cryptanalysts, thereby lending credence to its safety as a key derivation mechanism.&lt;&#x2F;p&gt;
&lt;p&gt;While &lt;code&gt;hkdf_mod_r()&lt;&#x2F;code&gt; has modulo bias, the magnitude of this bias is minuscule (the output size of HKDF is set to 48 bytes which is greater 2&lt;sup&gt;128&lt;&#x2F;sup&gt; time larger than the curve order). This bias is deemed acceptable in light of the simplicity of the constant time scheme.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;only-using-hardened-keys&quot;&gt;Only using hardened keys&lt;&#x2F;h3&gt;
&lt;p&gt;Widely accepted standards that existed before this one (&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;bitcoin&#x2F;bips&#x2F;blob&#x2F;43ce3a461dfb48e62ffa0cfc70f5f54d1eb5c577&#x2F;bip-0032.mediawiki&quot;&gt;BIP32&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;bitcoin&#x2F;bips&#x2F;blob&#x2F;43ce3a461dfb48e62ffa0cfc70f5f54d1eb5c577&#x2F;bip-0044.mediawiki&quot;&gt;BIP44&lt;&#x2F;a&gt;) utilise the notion of hardened and non-hardened keys whereas this specification only offers the former. Non-hardened keys are primarily useful in a UTXO system in which having one&#x27;s balance spilt amongst many accounts does not present much additionally complexity, but such keys are much less useful outside of this context. Further complicating matters is the problem of deriving non-hardened keys using a post-quantum signature scheme as non-hardened keys are made possible by the very group arithmetic quantum computers gain an advantage over.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;There are no major backwards compatibility issues brought upon by this EIP as it is not designed for use with secp256k1 keys. That said, this standard is not compatible with BIP32&#x2F; BIP44 style paths as paths specified by these systems make use of non-hardened keys, something that does not exist within this standard.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;test-case-0&quot;&gt;Test Case 0&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;seed = 0xc55257c360c07c72029aebc1b53c05ed0362ada38ead3e3e9efa3708e53495531f09a6987599d18264c1e1c92f2cf141630c7a3c4ab7c81b2f001698e7463b04&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;master_SK = 6083874454709270928345386274498605044986640685124978867557563392430687146096&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;child_index = 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;child_SK = 20397789859736650942317412262472558107875392172444076792671091975210932703118&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This test case can be extended to test the entire mnemonic-to-&lt;code&gt;child_SK&lt;&#x2F;code&gt; stack, assuming &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;bitcoin&#x2F;bips&#x2F;blob&#x2F;43ce3a461dfb48e62ffa0cfc70f5f54d1eb5c577&#x2F;bip-0039.mediawiki&quot;&gt;BIP39&lt;&#x2F;a&gt; is used as the mnemonic generation mechanism. Using the following parameters, the above seed can be calculated:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mnemonic = &amp;quot;abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;passphrase = &amp;quot;TREZOR&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This test case can be extended to test the entire &lt;code&gt;mnemonic-to -child_SK&lt;&#x2F;code&gt; stack, assuming &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;bitcoin&#x2F;bips&#x2F;blob&#x2F;43ce3a461dfb48e62ffa0cfc70f5f54d1eb5c577&#x2F;bip-0039.mediawiki&quot;&gt;BIP39&lt;&#x2F;a&gt; is used as the mnemonic generation mechanism. Using the following parameters, the above seed can be calculated:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mnemonic = &amp;quot;abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;passphrase = &amp;quot;TREZOR&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;test-case-1&quot;&gt;Test Case 1&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;seed = 0x3141592653589793238462643383279502884197169399375105820974944592&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;master_SK = 29757020647961307431480504535336562678282505419141012933316116377660817309383&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;child_index = 3141592653&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;child_SK = 25457201688850691947727629385191704516744796114925897962676248250929345014287&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;test-case-2&quot;&gt;Test Case 2&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;seed = 0x0099FF991111002299DD7744EE3355BBDD8844115566CC55663355668888CC00&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;master_SK = 27580842291869792442942448775674722299803720648445448686099262467207037398656&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;child_index = 4294967295&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;child_SK = 29358610794459428860402234341874281240803786294062035874021252734817515685787&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;test-case-3&quot;&gt;Test Case 3&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;seed = 0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;master_SK = 19022158461524446591288038168518313374041767046816487870552872741050760015818&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;child_index = 42&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;child_SK = 31372231650479070279774297061823572166496564838472787488249775572789064611981&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;test-vector-with-intermediate-values&quot;&gt;Test Vector with Intermediate values&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;seed = 0xc55257c360c07c72029aebc1b53c05ed0362ada38ead3e3e9efa3708e53495531f09a6987599d18264c1e1c92f2cf141630c7a3c4ab7c81b2f001698e7463b04&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;master_SK = 6083874454709270928345386274498605044986640685124978867557563392430687146096&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;child_index = 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;lamport_0 = [0xe345d0ad7be270737de05cf036f688f385d5f99c7fddb054837658bdd2ebd519,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x65050bd4db9c77c051f67dcc801bf1cdf33d81131e608505bb3e4523868eb76c,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xc4f8e8d251fbdaed41bdd9c135b9ed5f83a614f49c38fffad67775a16575645a,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x638ad0feace7567255120a4165a687829ca97e0205108b8b73a204fba6a66faa,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xb29f95f64d0fcd0f45f265f15ff7209106ab5f5ce6a566eaa5b4a6f733139936,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xbcfbdd744c391229f340f02c4f2d092b28fe9f1201d4253b9045838dd341a6bf,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x8b9cf3531bfcf0e4acbfd4d7b4ed614fa2be7f81e9f4eaef53bedb509d0b186f,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xb32fcc5c4e2a95fb674fa629f3e2e7d85335f6a4eafe7f0e6bb83246a7eced5f,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xb4fe80f7ac23065e30c3398623b2761ac443902616e67ce55649aaa685d769ce,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xb99354f04cfe5f393193c699b8a93e5e11e6be40ec16f04c739d9b58c1f55bf3,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x93963f58802099ededb7843219efc66a097fab997c1501f8c7491991c780f169,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x430f3b027dbe9bd6136c0f0524a0848dad67b253a11a0e4301b44074ebf82894,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xd635c39b4a40ad8a54d9d49fc8111bd9d11fb65c3b30d8d3eaef7d7556aac805,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x1f7253a6474cf0b2c05b02a7e91269137acddedcb548144821f9a90b10eccbab,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x6e3bdb270b00e7b6eb8b044dbfae07b51ea7806e0d24218c59a807a7fd099c18,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x895488ad2169d8eaae332ce5b0fe1e60ffab70e62e1cb15a2a1487544af0a6e8,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x32d45a99d458c90e173a3087ea3661ab62d429b285089e92806a9663ba825342,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xc15c52106c3177f5848a173076a20d46600ca65958a1e3c7d45a593aaa9670ed,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xd8180c550fbe4cd6d5b676ff75e0728729d8e28a3b521d56152594ac6959d563,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x58fe153fac8f4213aaf175e458435e06304548024bcb845844212c774bdffb2a,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x10fff610a50f4bee5c978f512efa6ab4fafacb65929606951ba5b93eeb617b5a,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x78ac9819799b52eba329f13dd52cf0f6148a80bf04f93341814c4b47bb4aa5ec,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xa5c3339caa433fc11e74d1765bec577a13b054381a44b23c2482e750696876a9,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x9f716640ab5cdc2a5eb016235cddca2dc41fa4ec5acd7e58af628dade99ec376,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x2544364320e67577c4fed8c7c7c839deed93c24076d5343c5b8faca4cc6dc2d8,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x62553e782541f822c589796be5d5c83bfc814819100b2be0710b246f5aa7149c,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x229fb761c46c04b22ba5479f2696be0f936fded68d54dd74bcd736b8ba512afb,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0af23996a65b98a0ebaf19f3ec0b3ef20177d1bfd6eb958b3bd36e0bdbe04c8c,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x6f0954f9deab52fd4c8d2daba69f73a80dea143dd49d9705c98db3d653adf98c,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xfa9221dd8823919a95b35196c1faeb59713735827f3e84298c25c83ac700c480,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x70c428e3ff9e5e3cda92d6bb85018fb89475c19f526461cca7cda64ebb2ff544,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xdcaac3413e22314f0f402f8058a719b62966b3a7429f890d947be952f2e314ba,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xb6b383cb5ec25afa701234824491916bfe6b09d28cf88185637e2367f0cf6edc,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x7b0d91488fc916aba3e9cb61a5a5645b9def3b02e4884603542f679f602afb8d,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xe9c20abca284acfde70c59584b9852b85c52fa7c263bb981389ff8d638429cd7,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x838524f798daee6507652877feb9597f5c47e9bb5f9aa52a35fb6fff796813b9,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xbe1ca18faf9bf322474fad1b3d9b4f1bc76ae9076e38e6dd2b16e2faf487742b,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xbf02d70f1a8519343a16d24bade7f7222912fd57fe4f739f367dfd99d0337e8e,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xc979eb67c107ff7ab257d1c0f4871adf327a4f2a69e01c42828ea27407caf058,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xf769123d3a3f19eb7b5c3fd4f467a042944a7c5ff8834cebe427f47dbd71460c,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xaefc8edc23257e1168a35999fe3832bcbc25053888cc89c38667482d6748095b,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x8ff399f364d3a2428b1c92213e4fdc5341e7998007da46a5a2f671929b42aaab,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xcf2a3d9e6963b24c5001fbba1e5ae7f45dd6cf520fd24861f745552db86bab48,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xb380e272d7f3091e5c887fa2e7c690c67d59f4d95f8376d150e555da8c738559,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xc006a749b091d91204dbb64f59059d284899de5986a7f84f8877afd5e0e4c253,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x818d8bb9b7da2dafa2ef059f91975e7b6257f5e199d217320de0a576f020de5c,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x7aabf4a1297d2e550a2ee20acb44c1033569e51b6ec09d95b22a8d131e30fd32,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xdd01c80964a5d682418a616fb10810647c9425d150df643c8ddbbe1bfb2768b7,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x1e2354e1d97d1b06eb6cfe9b3e611e8d75b5c57a444523e28a8f72a767eff115,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x989c9a649dca0580256113e49ea0dd232bbfd312f68c272fe7c878acc5da7a2c,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x14ee1efe512826fff9c028f8c7c86708b841f9dbf47ce4598298b01134ebdc1a,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x6f861dba4503f85762d9741fa8b652ce441373f0ef2b7ebbd5a794e48cdab51b,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xda110c9492ffdb87efe790214b7c9f707655a5ec08e5af19fb2ab2acc428e7dc,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x5576aa898f6448d16e40473fcb24c46c609a3fc46a404559faa2d0d34d7d49ce,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x9bd9a35675f2857792bc45893655bfdf905ffeaee942d93ad39fbcadd4ca9e11,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xfa95e4c37db9303d5213890fd984034089cbc9c6d754741625da0aa59cc45ccf,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xfef7d2079713f17b47239b76c8681bf7f800b1bfeac7a53265147579572ddf29,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x39aa7c0fecf9a1ed037c685144745fda16da36f6d2004844cf0e2d608ef6ed0e,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x5530654d502d6ba30f2b16f49cc5818279697308778fd8d40db8e84938144fb6,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xb1beaa36397ba1521d7bf7df16536969d8a716e63510b1b82a715940180eb29f,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x21abe342789f7c15a137afa373f686330c0db8c861572935a3cd8dcf9e4e1d45,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x27b5a1acda55b4e0658887bd884d3203696fcae0e94f19e31bfe931342b1c257,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x58401a02502d7708a812c0c72725f768f5a556480517258069f2d72543cda888,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x4b38f291548f51bee7e4cf8cc5c8aa8f4ad3ec2461dba4ccbab70f1c1bfd7feb,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x9b39a53fdafaaf1d23378e0aa8ae65d38480de69821de2910873eefc9f508568,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x932200566a3563ee9141913d12fd1812cb008cb735724e8610890e101ec10112,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x6a72f70b4ec5491f04780b17c4776a335fcc5bff5073d775150e08521dc74c91,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x86d5c60e627a4b7d5d075b0ba33e779c45f3f46d22ed51f31360afd140851b67,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x5ca2a736bb642abc4104faa781c9aff13d692a400d91dc961aec073889836946,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xa14bca5a262ac46ceac21388a763561fc85fb9db343148d786826930f3e510cd,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x87be03a87a9211504aa70ec149634ee1b97f7732c96377a3c04e98643dcba915,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x8fe283bc19a377823377e9c326374ebb3f29527c12ea77bfb809c18eef8943b0,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x8f519078b39a3969f7e4caeca9839d4e0eccc883b89e4a86d0e1731bfc5e33fc,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x33d7c28c3d26fdfc015a8c2131920e1392ef0aea55505637b54ea63069c7858e,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xe57de7c189fcc9170320c7acedb38798562a48dbc9943b2a8cd3441d58431128,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x513dac46017050f82751a07b6c890f14ec43cadf687f7d202d2369e35b1836b4,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xfd967d9f805bb7e78f7b7caa7692fdd3d6b5109c41ad239a08ad0a38eeb0ac4c,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xf2013e4da9abcc0f03ca505ed94ec097556dbfd659088cd24ec223e02ac43329,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xe0dcfac50633f7417f36231df2c81fa1203d358d5f57e896e1ab4b512196556b,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xf022848130e73fe556490754ef0ecfcdaaf3b9ff16ae1eda7d38c95c4f159ded,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x2147163a3339591ec7831d2412fb2d0588c38da3cd074fa2a4d3e5d21f9f1d2d,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x11ee2404731962bf3238dca0d9759e06d1a5851308b4e6321090886ec5190b69,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xf7679ecd07143f8ac166b66790fa09aed39352c09c0b4766bbe500b1ebace5a5,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xc7a0e95f09076472e101813a95e6ea463c35bd5ee9cfda3e5d5dbccb35888ef0,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xde625d3b547eb71bea5325a0191a592fa92a72e4b718a499fdba32e245ddf37e,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x7e5bdccd95df216e8c59665073249072cb3c9d0aef6b341afc0ca90456942639,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xc27f65fd9f797ede374e06b4ddb6e8aa59c7d6f36301f18b42c48b1889552fe3,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x8175730a52ea571677b035f8e2482239dda1cfbff6bc5cde00603963511a81af,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x09e440f2612dad1259012983dc6a1e24a73581feb1bd69d8a356eea16ba5fd0e,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x59dcc81d594cbe735a495e38953e8133f8b3825fd84767af9e4ea06c49dbabfa,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x6c8480b59a1a958c434b9680edea73b1207077fb9a8a19ea5f9fbbf6f47c4124,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x81f5c89601893b7a5a231a7d37d6ab9aa4c57f174fcfc6b40002fa808714c3a1,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x41ba4d6b4da141fcc1ee0f4b47a209cfd143d34e74fc7016e9956cedeb2db329,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x5e0b5b404c60e9892040feacfb4a84a09c2bc4a8a5f54f3dad5dca4acdc899dc,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xe922eebf1f5f15000d8967d16862ed274390cde808c75137d2fb9c2c0a80e391,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xbf49d31a59a20484f0c08990b2345dfa954509aa1f8901566ab9da052b826745,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xb84e07da828ae668c95d6aa31d4087504c372dbf4b5f8a8e4ded1bcf279fd52b,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x89288bf52d8c4a9561421ad199204d794038c5d19ae9fee765ee2b5470e68e7e,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xf6f618be99b85ec9a80b728454a417c647842215e2160c6fe547dd5a69bd9302,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xdd9adc002f98c9a47c7b704fc0ce0a5c7861a5e2795b6014749cde8bcb8a034b,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xd119a4b2c0db41fe01119115bcc35c4b7dbfdb42ad3cf2cc3f01c83732acb561,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x9c66bc84d416b9193bad9349d8c665a9a06b835f82dc93ae0cccc218f808aad0,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xd4b50eefcd2b5df075f14716cf6f2d26dfc8ae02e3993d711f4a287313038fde,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xaf72bfb346c2f336b8bc100bff4ba35d006a3dad1c5952a0adb40789447f2704,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xc43ca166f01dc955e7b4330227635feb1b0e0076a9c5633ca5c614a620244e5b,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x5efca76970629521cfa053fbbbda8d3679cadc018e2e891043b0f52989cc2603,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x35c57de1c788947f187051ce032ad1e899d9887d865266ec6fcfda49a8578b2b,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x56d4be8a65b257216eab7e756ee547db5a882b4edcd12a84ed114fbd4f5be1f1,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x257e858f8a4c07a41e6987aabaa425747af8b56546f2a3406f60d610bcc1f269,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x40bd9ee36d52717ab22f1f6b0ee4fb38b594f58399e0bf680574570f1b4b8c90,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xcb6ac01c21fc288c12973427c5df6eb8f6aefe64b92a6420c6388acdf36bc096,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xa5716441312151a5f0deb52993a293884c6c8f445054ce1e395c96adeee66c6d,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xe15696477f90113a10e04ba8225c28ad338c3b6bdd7bdeb95c0722921115ec85,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x8faeaa52ca2f1d791cd6843330d16c75eaf6257e4ba236e3dda2bc1a644aee00,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xc847fe595713bf136637ce8b43f9de238762953fed16798878344da909cc76ae,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xb5740dc579594dd110078ce430b9696e6a308078022dde2d7cfe0ef7647b904e,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x551a06d0771fcd3c53aea15aa8bf700047138ef1aa22265bee7fb965a84c9615,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x9a65397a5907d604030508d41477de621ce4a0d79b772e81112d634455e7a4da,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x6462d4cc2262d7faf8856812248dc608ae3d197bf2ef410f00c3ae43f2040995,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x6782b1bd319568e30d54b324ab9ed8fdeac6515e36b609e428a60785e15fb301,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x8bcdcf82c7eb2a07e14db20d80d9d2efea8d40320e121923784c92bf38250a8e,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x46ed84fa17d226d5895e44685747ab82a97246e97d6237014611aaaba65ed268,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x147e87981673326c5a2bdb06f5e90eaaa9583857129451eed6dde0c117fb061f,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x4141d6fe070104c29879523ba6669552f3d457c0929bb878d2751f4ff059b895,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xd866ce4ef226d74841f950fc28cdf2235db21e0e3f07a0c8f807704464db2210,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xa804f9118bf92558f684f90c2bda832a4f51ef771ffb2765cde3ec6f48124f32,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xc436d4a65910124e00cded9a637178914a8fbc090400f3f031c03eac4d0295a5,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x643fdb9243656512316528de04dcc7344ca33783580ad0c3debf8c4a6e7c8bc4,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x7f4a345b41706b281b2de998e91ff62d908eb29fc333ee336221757753c96e23,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x6bdc086a5b11de950cabea33b72d98db886b291c4c2f02d3e997edc36785d249,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xfb10b5b47d374078c0a52bff7174bf1cd14d872c7d20b4a009e2afd3017a9a17,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x1e07e605312db5380afad8f3d7bd602998102fdd39565b618ac177b13a6527e6,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xc3161b5a7b93aabf05652088b0e5b4803a18be693f590744c42c24c7aaaeef48,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xa47e4f25112a7d276313f153d359bc11268b397933a5d5375d30151766bc689a,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xb24260e2eff88716b5bf5cb75ea171ac030f5641a37ea89b3ac45acb30aae519,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x2bcacbebc0a7f34406db2c088390b92ee34ae0f2922dedc51f9227b9afb46636,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xc78c304f6dbe882c99c5e1354ce6077824cd42ed876db6706654551c7472a564,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x6e2ee19d3ee440c78491f4e354a84fa593202e152d623ed899e700728744ac85,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x2a3f438c5dc012aa0997b66f661b8c10f4a0cd7aa5b6e5922b1d73020561b27f,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xd804f755d93173408988b95e9ea0e9feae10d404a090f73d9ff84df96f081cf7,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xe06fda941b6936b8b33f00ffa02c8b05fd78fbec953da61da2043f5644b30a50,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x45ee279b465d53148850a16cc7f6bd33e7627aef554a9418ed012ca8f9717f80,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x9c79348c1bcd6aa2135452491d73564413a247ea8cc38fa7dcc6c43f8a2d61d5,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x7c91e056f89f2a77d3e3642e595bcf4973c3bca68dd2b10f51ca0d8945e4255e,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x669f976ebe38cbd22c5b1f785e14b76809d673d2cb1458983dbda41f5adf966b,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x8bc71e99ffcc119fd8bd604af54c0663b0325a3203a214810fa2c588089ed5a7,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x36b3f1ffeae5d9855e0965eef33f4c5133d99685802ac5ce5e1bb288d308f889,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0aad33df38b3f31598e04a42ec22f20bf2e2e9472d02371eb1f8a06434621180,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x38c5632b81f90efbc51a729dcae03626a3063aa1f0a102fd0e4326e86a08a732,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x6ea721753348ed799c98ffa330d801e6760c882f720125250889f107915e270a,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xe700dd57ce8a653ce4269e6b1593a673d04d3de8b79b813354ac7c59d1b99adc,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xe9294a24b560d62649ca898088dea35a644d0796906d41673e29e4ea8cd16021,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xf20bb60d13a498a0ec01166bf630246c2f3b7481919b92019e2cfccb331f2791,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xf639a667209acdd66301c8e8c2385e1189b755f00348d614dc92da14e6866b38,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x49041904ee65c412ce2cd66d35570464882f60ac4e3dea40a97dd52ffc7b37a2,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xdb36b16d3a1010ad172fc55976d45df7c03b05eab5432a77be41c2f739b361f8,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x71400cdd2ea78ac1bf568c25a908e989f6d7e2a3690bc869c7c14e09c255d911,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xf0d920b2d8a00b88f78e7894873a189c580747405beef5998912fc9266220d98,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x1a2baefbbd41aa9f1cc5b10e0a7325c9798ba87de6a1302cf668a5de17bc926a,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x449538a20e52fd61777c45d35ff6c2bcb9d9165c7eb02244d521317f07af6691,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x97006755b9050b24c1855a58c4f4d52f01db4633baff4b4ef3d9c44013c5c665,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xe441363a27b26d1fff3288222fa8ed540f8ca5d949ddcc5ff8afc634eec05336,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xed587aa8752a42657fea1e68bc9616c40c68dcbbd5cb8d781e8574043e29ef28,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x47d896133ba81299b8949fbadef1c00313d466827d6b13598685bcbb8776c1d2,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x7786bc2cb2d619d07585e2ea4875f15efa22110e166af87b29d22af37b6c047d,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x956b76194075fe3daf3ca508a6fad161deb05d0026a652929e37c2317239cbc6,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xec9577cb7b85554b2383cc4239d043d14c08d005f0549af0eca6994e203cb4e7,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0722d0c68d38b23b83330b972254bbf9bfcf32104cc6416c2dad67224ac52887,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x532b19d54fb6d77d96452d3e562b79bfd65175526cd793f26054c5f6f965df39,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x4d62e065e57cbf60f975134a360da29cabdcea7fcfc664cf2014d23c733ab3b4,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x09be0ea6b363fd746b303e482cb4e15ef25f8ae57b7143e64cbd5c4a1d069ebe,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x69dcddc3e05147860d8d0e90d602ac454b609a82ae7bb960ee2ecd1627d77777,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xa5e2ae69d902971000b1855b8066a4227a5be7234ac9513b3c769af79d997df4,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xc287d4bc953dcff359d707caf2ccba8cc8312156eca8aafa261fb72412a0ea28,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xb27584fd151fb30ed338f9cba28cf570f7ca39ebb03eb2e23140423af940bd96,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x7e02928194441a5047af89a6b6555fea218f1df78bcdb5f274911b48d847f5f8,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x9ba611add61ea6ba0d6d494c0c4edd03df9e6c03cafe10738cee8b7f45ce9476,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x62647ec3109ac3db3f3d9ea78516859f0677cdde3ba2f27f00d7fda3a447dd01,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xfa93ff6c25bfd9e17d520addf5ed2a60f1930278ff23866216584853f1287ac1,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x3b391c2aa79c2a42888102cd99f1d2760b74f772c207a39a8515b6d18e66888a,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xcc9ae3c14cbfb40bf01a09bcde913a3ed208e13e4b4edf54549eba2c0c948517,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xc2b8bce78dd4e876da04c54a7053ca8b2bedc8c639cee82ee257c754c0bea2b2,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xdb186f42871f438dba4d43755c59b81a6788cb3b544c0e1a3e463f6c2b6f7548,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xb7f8ba137c7783137c0729de14855e20c2ac4416c33f5cac3b235d05acbab634,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x282987e1f47e254e86d62bf681b0803df61340fdc9a8cf625ef2274f67fc6b5a,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x04aa195b1aa736bf8875777e0aebf88147346d347613b5ab77bef8d1b502c08c,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x3f732c559aee2b1e1117cf1dec4216a070259e4fa573a7dcadfa6aab74aec704,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x72699d1351a59aa73fcede3856838953ee90c6aa5ef5f1f7e21c703fc0089083,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x6d9ce1b8587e16a02218d5d5bed8e8d7da4ac40e1a8b46eeb412df35755c372c,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x4f9c19b411c9a74b8616db1357dc0a7eaf213cb8cd2455a39eb7ae4515e7ff34,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x9163dafa55b2b673fa7770b419a8ede4c7122e07919381225c240d1e90d90470,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x268ff4507b42e623e423494d3bb0bc5c0917ee24996fb6d0ebedec9ce8cd9d5c,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xff6e6169d233171ddc834e572024586eeb5b1bda9cb81e5ad1866dbc53dc75fe,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xb379a9c8279205e8753b6a5c865fbbf70eb998f9005cd7cbde1511f81aed5256,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x3a6b145e35a592e037c0992c9d259ef3212e17dca81045e446db2f3686380558,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x60fb781d7b3137481c601871c1c3631992f4e01d415841b7f5414743dcb4cfd7,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x90541b20b0c2ea49bca847e2db9b7bba5ce15b74e1d29194a12780e73686f3dd,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xe2b0507c13ab66b4b769ad1a1a86834e385b315da2f716f7a7a8ff35a9e8f98c,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xeefe54bc9fa94b921b20e7590979c28a97d8191d1074c7c68a656953e2836a72,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x8676e7f59d6f2ebb0edda746fc1589ef55e07feab00d7008a0f2f6f129b7bb3a,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x78a3d93181b40152bd5a8d84d0df7f2adde5db7529325c13bc24a5b388aed3c4,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xcc0e2d0cba7aaa19c874dbf0393d847086a980628f7459e9204fda39fad375c0,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x6e46a52cd7745f84048998df1a966736d2ac09a95a1c553016fef6b9ec156575,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x204ac2831d2376d4f9c1f5c106760851da968dbfc488dc8a715d1c764c238263,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xbdb8cc7b7e5042a947fca6c000c10b9b584e965c3590f92f6af3fe4fb23e1358,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x4a55e4b8a138e8508e7b11726f617dcf4155714d4600e7d593fd965657fcbd89,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xdfe064bb37f28d97b16d58b575844964205e7606dce914a661f2afa89157c45b,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x560e374fc0edda5848eef7ff06471545fcbdd8aefb2ecddd35dfbb4cb03b7ddf,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x10a66c82e146da5ec6f48b614080741bc51322a60d208a87090ad7c7bf6b71c6,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x62534c7dc682cbf356e6081fc397c0a17221b88508eaeff798d5977f85630d4f,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0138bba8de2331861275356f6302b0e7424bbc74d88d8c534479e17a3494a15b,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x580c7768bf151175714b4a6f2685dc5bcfeb088706ee7ed5236604888b84d3e4,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xd290adb1a5dfc69da431c1c0c13da3be788363238d7b46bc20185edb45ab9139,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x1689879db6c78eb4d3038ed81be1bc106f8cfa70a7c6245bd4be642bfa02ebd7,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x6064c384002c8b1594e738954ed4088a0430316738def62822d08b2285514918,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x01fd23493f4f1cc3c5ff4e96a9ee386b2a144b50a428a6b5db654072bddadfe7,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xd5d05bb7f23ab0fa2b82fb1fb14ac29c2477d81a85423d0a45a4b7d5bfd81619,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xd72b9a73ae7b24db03b84e01106cea734d4b9d9850b0b7e9d65d6001d859c772,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x156317cb64578db93fee2123749aff58c81eae82b189b0d6f466f91de02b59df,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x5fba299f3b2c099edbac18d785be61852225890fc004bf6be0787d62926a79b3,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x004154f28f685bdbf0f0d6571e7a962a4c29b6c3ebedaaaf66097dfe8ae5f756,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x4b45816f9834c3b289affce7a3dc80056c2b7ffd3e3c250d6dff7f923e7af695,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x6ca53bc37816fff82346946d83bef87860626bbee7fd6ee9a4aeb904d893a11f,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xf48b2f43184358d66d5b5f7dd2b14a741c7441cc7a33ba3ebcc94a7b0192d496,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x3cb98f4baa429250311f93b46e745174f65f901fab4eb8075d380908aaaef650,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x343dfc26b4473b3a20e706a8e87e5202a4e6b96b53ed448afb9180c3f766e5f8,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x1ace0e8a735073bcbaea001af75b681298ef3b84f1dbab46ea52cee95ab0e7f9,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xd239b110dd71460cdbc41ddc99494a7531186c09da2a697d6351c116e667733b,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x22d6955236bd275969b8a6a30c23932670a6067f68e236d2869b6a8b4b493b83,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x53c1c01f8d061ac89187e5815ef924751412e6a6aa4dc8e3abafb1807506b4e0,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x2f56dd20c44d7370b713e7d7a1bfb1a800cac33f8a6157f278e17a943806a1f7,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xc99773d8a5b3e60115896a65ac1d6c15863317d403ef58b90cb89846f4715a7f,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x9f4b6b77c254094621cd336da06fbc6cbb7b8b1d2afa8e537ceca1053c561ef5,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x87944d0b210ae0a6c201cba04e293f606c42ebaed8b4a5d1c33f56863ae7e1b5,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xa7d116d962d03ca31a455f9cda90f33638fb36d3e3506605aa19ead554487a37,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x4042e32e224889efd724899c9edb57a703e63a404129ec99858048fbc12f2ce0,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x36759f7a0faeea1cd4cb91e404e4bf09908de6e53739603d5f0db52b664158a3,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xa4d50d005fb7b9fea8f86f1c92439cc9b8446efef7333ca03a8f6a35b2d49c38,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x80cb7c3e20f619006542edbe71837cdadc12161890a69eea8f41be2ee14c08a3,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xbb3c44e1df45f2bb93fb80e7f82cee886c153ab484c0095b1c18df03523629b4,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x04cb749e70fac3ac60dea779fceb0730b2ec5b915b0f8cf28a6246cf6da5db29,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x4f5189b8f650687e65a962ef3372645432b0c1727563777433ade7fa26f8a728,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x322eddddf0898513697599b68987be5f88c0258841affec48eb17cf3f61248e8,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x6416be41cda27711d9ec22b3c0ed4364ff6975a24a774179c52ef7e6de9718d6,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0622d31b8c4ac7f2e30448bdadfebd5baddc865e0759057a6bf7d2a2c8b527e2,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x40f096513588cc19c08a69e4a48ab6a43739df4450b86d3ec2fb3c6a743b5485,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x09fcf7d49290785c9ea2d54c3d63f84f6ea0a2e9acfcdbb0cc3a281ce438250e,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x2000a519bf3da827f580982d449b5c70fcc0d4fa232addabe47bb8b1c471e62e,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xf4f80008518e200c40b043f34fb87a6f61b82f8c737bd784292911af3740245e,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x939eaab59f3d2ad49e50a0220080882319db7633274a978ced03489870945a65,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xadcad043d8c753fb10689280b7670f313253f5d719039e250a673d94441ee17c,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x58b7b75f090166b8954c61057074707d7e38d55ce39d9b2251bbc3d72be458f8,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xf61031890c94c5f87229ec608f2a9aa0a3f455ba8094b78395ae312cbfa04087,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x356a55def50139f94945e4ea432e7a9defa5db7975462ebb6ca99601c614ea1d,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x65963bb743d5db080005c4db59e29c4a4e86f92ab1dd7a59f69ea7eaf8e9aa79]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;lamport_1 = [0x9c0bfb14de8d2779f88fc8d5b016f8668be9e231e745640096d35dd5f53b0ae2,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x756586b0f3227ab0df6f4b7362786916bd89f353d0739fffa534368d8d793816,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x710108dddc39e579dcf0819f9ad107b3c56d1713530dd94325db1d853a675a37,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x8862b5f428ce5da50c89afb50aa779bb2c4dfe60e6f6a070b3a0208a4a970fe5,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x54a9cd342fa3a4bf685c01d1ce84f3068b0d5b6a58ee22dda8fbac4908bb9560,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0fa3800efeaddd28247e114a1cf0f86b9014ccae9c3ee5f8488168b1103c1b44,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xbb393428b7ebfe2eda218730f93925d2e80c020d41a29f4746dcbb9138f7233a,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x7b42710942ef38ef2ff8fe44848335f26189c88c22a49fda84a51512ac68cd5d,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x90e99786a3e8b04db95ccd44d01e75558d75f3ddd12a1e9a2c2ce76258bf4813,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x3f6f71e40251728aa760763d25deeae54dc3a9b53807c737deee219120a2230a,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xe56081a7933c6eaf4ef2c5a04e21ab8a3897785dd83a34719d1b62d82cfd00c2,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x76cc54fa15f53e326575a9a2ac0b8ed2869403b6b6488ce4f3934f17db0f6bee,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x1cd9cd1d882ea3830e95162b5de4beb5ddff34fdbf7aec64e83b82a6d11b417c,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xb8ca8ae36d717c448aa27405037e44d9ee28bb8c6cc538a5d22e4535c8befd84,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x5c4492108c25f873a23d5fd7957b3229edc22858e8894febe7428c0831601982,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x907bcd75e7465e9791dc34e684742a2c0dc7007736313a95070a7e6b961c9c46,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xe7134b1511559e6b2440672073fa303ec3915398e75086149eb004f55e893214,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x2ddc2415e4753bfc383d48733e8b2a3f082883595edc5515514ebb872119af09,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xf2ad0f76b08ffa1eee62228ba76f4982fab4fbede5d4752c282c3541900bcd5b,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0a84a6b15abd1cbc2da7092bf7bac418b8002b7000236dfba7c8335f27e0f1d4,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x97404e02b9ff5478c928e1e211850c08cc553ebac5d4754d13efd92588b1f20d,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xfa6ca3bcff1f45b557cdec34cb465ab06ade397e9d9470a658901e1f0f124659,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x5bd972d55f5472e5b08988ee4bccc7240a8019a5ba338405528cc8a38b29bc21,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x52952e4f96c803bb76749800891e3bfe55f7372facd5b5a587a39ac10b161bcc,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xf96731ae09abcad016fd81dc4218bbb5b2cb5fe2e177a715113f381814007314,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xe7d79e07cf9f2b52623491519a21a0a3d045401a5e7e10dd8873a85076616326,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xe4892f3777a4614ee6770b22098eaa0a3f32c5c44b54ecedacd69789d676dffe,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x20c932574779e2cc57780933d1dc6ce51a5ef920ce5bf681f7647ac751106367,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x057252c573908e227cc07797117701623a4835f4b047dcaa9678105299e48e70,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x20bad780930fa2a036fe1dea4ccbf46ac5b3c489818cdb0f97ae49d6e2f11fbf,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xc0d7dd26ffecdb098585a1694e45a54029bb1e31c7c5209289058efebb4cc91b,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x9a8744beb1935c0abe4b11812fc02748ef7c8cb650db3024dde3c5463e9d8714,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x8ce6eea4585bbeb657b326daa4f01f6aef34954338b3ca42074aedd1110ba495,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x1c85b43f5488b370721290d2faea19d9918d094c99963d6863acdfeeca564363,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xe88a244347e448349e32d0525b40b18533ea227a9d3e9b78a9ff14ce0a586061,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x352ca61efc5b8ff9ee78e738e749142dd1606154801a1449bbb278fa6bcc3dbe,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xa066926f9209220b24ea586fb20eb8199a05a247c82d7af60b380f6237429be7,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x3052337ccc990bfbae26d2f9fe5d7a4eb8edfb83a03203dca406fba9f4509b6e,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x343ce573a93c272688a068d758df53c0161aa7f9b55dec8beced363a38b33069,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0f16b5593f133b58d706fe1793113a10750e8111eadee65301df7a1e84f782d3,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x808ae8539357e85b648020f1e9d255bc4114bee731a6220d7c5bcb5b85224e03,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x3b2bd97e31909251752ac57eda6015bb05b85f2838d475095cfd146677430625,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xe4f857c93b2d8b250050c7381a6c7c660bd29066195806c8ef11a2e6a6640236,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x23d91589b5070f443ddcefa0838c596518d54928119251ecf3ec0946a8128f52,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xb72736dfad52503c7f5f0c59827fb6ef4ef75909ff9526268abc0f296ee37296,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x80a8c66436d86b8afe87dde7e53a53ef87e057a5d4995963e76d159286de61b6,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xbec92c09ee5e0c84d5a8ba6ca329683ff550ace34631ea607a3a21f99cd36d67,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x83c97c9807b9ba6d9d914ae49dabdb4c55e12e35013f9b179e6bc92d5d62222b,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x8d9c79f6af3920672dc4cf97a297c186e75083d099aeb5c1051207bad0c98964,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x2aaa5944a2bd852b0b1be3166e88f357db097b001c1a71ba92040b473b30a607,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x46693d27ec4b764fbb516017c037c441f4558aebfe972cdcd03da67c98404e19,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x903b25d9e12208438f203c9ae2615b87f41633d5ffda9cf3f124c1c3922ba08f,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x3ec23dc8bc1b49f5c7160d78008f3f235252086a0a0fa3a7a5a3a53ad29ec410,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xa1fe74ceaf3cccd992001583a0783d7d7b7a245ea374f369133585b576b9c6d8,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xb2d6b0fe4932a2e06b99531232398f39a45b0f64c3d4ebeaaebc8f8e50a80607,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xe19893353f9214eebf08e5d83c6d44c24bffe0eceee4dc2e840d42eab0642536,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x5b798e4bc099fa2e2b4b5b90335c51befc9bbab31b4dd02451b0abd09c06ee79,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xbab2cdec1553a408cac8e61d9e6e19fb8ccfb48efe6d02bd49467a26eeeca920,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x1c1a544c28c38e5c423fe701506693511b3bc5f2af9771b9b2243cd8d41bebfc,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x704d6549d99be8cdefeec9a58957f75a2be4af7bc3dc4655fa606e7f3e03b030,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x051330f43fe39b08ed7d82d68c49b36a8bfa31357b546bfb32068712df89d190,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xe69174c7b03896461cab2dfaab33d549e3aac15e6b0f6f6f466fb31dae709b9b,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xe5f668603e0ddbbcde585ac41c54c3c4a681fffb7a5deb205344de294758e6ac,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xca70d5e4c3a81c1f21f246a3f52c41eaef9a683f38eb7c512eac8b385f46cbcd,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x3173a6b882b21cd147f0fc60ef8f24bbc42104caed4f9b154f2d2eafc3a56907,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xc71469c192bf5cc36242f6365727f57a19f924618b8a908ef885d8f459833cc3,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x59c596fc388afd8508bd0f5a1e767f3dda9ed30f6646d15bc59f0b07c4de646f,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xb200faf29368581f551bd351d357b6fa8cbf90bdc73b37335e51cad36b4cba83,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x275cede69b67a9ee0fff1a762345261cb20fa8191470159cc65c7885cfb8313c,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0ce4ef84916efbe1ba9a0589bed098793b1ea529758ea089fd79151cc9dc7494,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0f08483bb720e766d60a3cbd902ce7c9d835d3f7fdf6dbe1f37bcf2f0d4764a2,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xb30a73e5db2464e6da47d10667c82926fa91fceb337d89a52db5169008bc6726,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x6b9c50fed1cc404bf2dd6fffbfd18e30a4caa1500bfeb080aa93f78d10331aaf,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xf17c84286df03ce175966f560600dd562e0f59f18f1d1276b4d8aca545d57856,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x11455f2ef96a6b2be69854431ee219806008eb80ea38c81e45b2e58b3f975a20,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x9a61e03e2157a5c403dfcde690f7b7d704dd56ea1716cf14cf7111075a8d6491,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x30312c910ce6b39e00dbaa669f0fb7823a51f20e83eaeb5afa63fb57668cc2f4,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x17c18d261d94fba82886853a4f262b9c8b915ed3263b0052ece5826fd7e7d906,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x2d8f6ea0f5b9d0e4bc1478161f5ed2ad3d8495938b414dcaec9548adbe572671,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x19954625f13d9bab758074bf6dee47484260d29ee118347c1701aaa74abd9848,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x842ef2ad456e6f53d75e91e8744b96398df80350cf7af90b145fea51fbbcf067,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x34a8b0a76ac20308aa5175710fb3e75c275b1ff25dba17c04e3a3e3c48ca222c,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x58efcbe75f32577afe5e9ff827624368b1559c32fcca0cf4fd704af8ce019c63,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x411b4d242ef8f14d92bd8b0b01cb4fa3ca6f29c6f9073cfdd3ce614fa717463b,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xf76dbda66ede5e789314a88cff87ecb4bd9ca418c75417d4d920e0d21a523257,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xd801821a0f87b4520c1b003fe4936b6852c410ee00b46fb0f81621c9ac6bf6b4,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x97ad11d6a29c8cf3c548c094c92f077014de3629d1e9053a25dbfaf7eb55f72d,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xa87012090cd19886d49521d564ab2ad0f18fd489599050c42213bb960c9ee8ff,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x8868d8a26e758d50913f2bf228da0444a206e52853bb42dd8f90f09abe9c859a,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xc257fb0cc9970e02830571bf062a14540556abad2a1a158f17a18f14b8bcbe95,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xfe611ce27238541b14dc174b652dd06719dfbcda846a027f9d1a9e8e9df2c065,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xc9b25ea410f420cc2d4fc6057801d180c6cab959bce56bf6120f555966e6de6d,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x95437f0524ec3c04d4132c83be7f1a603e6f4743a85ede25aa97a1a4e3f3f8fc,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x82a12910104065f35e983699c4b9187aed0ab0ec6146f91728901efecc7e2e20,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x6622dd11e09252004fb5aaa39e283333c0686065f228c48a5b55ee2060dbd139,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x89a2879f25733dab254e4fa6fddb4f04b8ddf018bf9ad5c162aea5c858e6faaa,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x8a71b62075a6011fd9b65d956108fa79cc9ebb8f194d64d3105a164e01cf43a6,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x103f4fe9ce211b6452181371f0dc4a30a557064b684645a4495136f4ebd0936a,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x97914adc5d7ce80147c2f44a6b29d0b495d38dedd8cc299064abcc62ed1ddabc,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x825c481da6c836a8696d7fda4b0563d204a9e7d9e4c47b46ded26db3e2d7d734,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xf8c0637ba4c0a383229f1d730db733bc11d6a4e33214216c23f69ec965dcaaad,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xaed3bdaf0cb12d37764d243ee0e8acdefc399be2cabbf1e51dc43454efd79cbd,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xe8427f56cc5cec8554e2f5f586b57adccbea97d5fc3ef7b8bbe97c2097cf848c,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xba4ad0abd5c14d526357fd0b6f8676ef6126aeb4a6d80cabe1f1281b9d28246c,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x4cff20b72e2ab5af3fafbf9222146949527c25f485ec032f22d94567ff91b22f,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0d32925d89dd8fed989912afcbe830a4b5f8f7ae1a3e08ff1d3a575a77071d99,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xe51a1cbeae0be5d2fdbc7941aea904d3eade273f7477f60d5dd6a12807246030,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xfb8615046c969ef0fa5e6dc9628c8a9880e86a5dc2f6fc87aff216ea83fcf161,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x64dd705e105c88861470d112c64ca3d038f67660a02d3050ea36c34a9ebf47f9,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xb6ad148095c97528180f60fa7e8609bf5ce92bd562682092d79228c2e6f0750c,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x5bae0cd81f3bd0384ca3143a72068e6010b946462a73299e746ca639c026781c,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xc39a0fc7764fcfc0402b12fb0bbe78fe3633cbfb33c7f849279585a878a26d7c,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x2b752fda1c0c53d685cc91144f78d371db6b766725872b62cc99e1234cca8c1a,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x40ee6b9635d87c95a528757729212a261843ecb06d975de91352d43ca3c7f196,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x75e2005d3726cf8a4bb97ea5287849a361e3f8fdfadc3c1372feed1208c89f6b,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0976f8ab556153964b58158678a5297da4d6ad92e284da46052a791ee667aee4,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xdbeef07841e41e0672771fb550a5b9233ae8e9256e23fa0d34d5ae5efe067ec8,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xa890f412ab6061c0c5ee661e80d4edc5c36b22fb79ac172ddd5ff26a7dbe9751,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xb666ae07f9276f6d0a33f9efeb3c5cfcba314fbc06e947563db92a40d7a341e8,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x83a082cf97ee78fbd7f31a01ae72e40c2e980a6dab756161544c27da86043528,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xfa726a919c6f8840c456dc77b0fec5adbed729e0efbb9317b75f77ed479c0f44,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xa8606800c54faeab2cbc9d85ff556c49dd7e1a0476027e0f7ce2c1dc2ba7ccbf,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x2796277836ab4c17a584c9f6c7778d10912cb19e541fb75453796841e1f6cd1c,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xf648b8b3c7be06f1f8d9cda13fd6d60f913e5048a8e0b283b110ca427eeb715f,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xa21d00b8fdcd77295d4064e00fbc30bed579d8255e9cf3a9016911d832390717,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xe741afcd98cbb3bb140737ed77bb968ac60d5c00022d722f9f04f56e97235dc9,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xbeecc9638fac39708ec16910e5b02c91f83f6321f6eb658cf8a96353cfb49806,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x912eee6cabeb0fed8d6e6ca0ba61977fd8e09ea0780ff8fbec995e2a85e08b52,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xc665bc0bb121a1229bc56ecc07a7e234fd24c523ea14700aa09e569b5f53ad33,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x39501621c2bdff2f62ab8d8e3fe47fe1701a98c665697c5b750ee1892f11846e,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x03d32e16c3a6c913daefb139f131e1e95a742b7be8e20ee39b785b4772a50e44,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x4f504eb46a82d440f1c952a06f143994bc66eb9e3ed865080cd9dfc6d652b69c,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xad753dc8710a46a70e19189d8fc7f4c773e4d9ccc7a70c354b574fe377328741,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xf7f5464a2d723b81502adb9133a0a4f0589b4134ca595a82e660987c6b011610,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x216b60b1c3e3bb4213ab5d43e04619d13e1ecedbdd65a1752bda326223e3ca3e,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x763664aa96d27b6e2ac7974e3ca9c9d2a702911bc5d550d246631965cf2bd4a2,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x292b5c8c8431b040c04d631f313d4e6b67b5fd3d4b8ac9f2edb09d13ec61f088,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x80db43c2b9e56eb540592f15f5900222faf3f75ce62e78189b5aa98c54568a5e,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x1b5fdf8969bcd4d65e86a2cefb3a673e18d587843f4f50db4e3ee77a0ba2ef1c,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x11e237953fff3e95e6572da50a92768467ffdfd0640d3384aa1c486357e7c24a,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x1fabd4faa8dba44808cc87d0bc389654a98496745578f3d17d134adc7f7b10f3,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x5eca4aa96f20a56197772ae6b600762154ca9d2702cab12664ea47cbff1a440c,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0b4234f5bb02abcf3b5ce6c44ea85f55ec7db98fa5a7b90abef6dd0df034743c,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x316761e295bf350313c4c92efea591b522f1df4211ce94b22e601f30aefa51ef,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xe93a55ddb4d7dfe02598e8f909ff34b3de40a1c0ac8c7fba48cb604ea60631fb,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xe6e6c877b996857637f8a71d0cd9a6d47fdeb03752c8965766f010073332b087,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xa4f95c8874e611eddd2c4502e4e1196f0f1be90bfc37db35f8588e7d81d34aeb,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x9351710a5633714bb8b2d226e15ba4caa6f50f56c5508e5fa1239d5cc6a7e1aa,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x8d0aef52ec7266f37adb572913a6213b8448caaf0384008373dec525ae6cdff1,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x718e24c3970c85bcb14d2763201812c43abac0a7f16fc5787a7a7b2f37288586,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x3600ce44cebc3ee46b39734532128eaf715c0f3596b554f8478b961b0d6e389a,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x50dd1db7b0a5f6bd2d16252f43254d0f5d009e59f61ebc817c4bbf388519a46b,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x67861ed00f5fef446e1f4e671950ac2ddae1f3b564f1a6fe945e91678724ef03,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0e332c26e169648bc20b4f430fbf8c26c6edf1a235f978d09d4a74c7b8754aad,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x6c9901015adf56e564dfb51d41a82bde43fb67273b6911c9ef7fa817555c9557,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x53c83391e5e0a024f68d5ade39b7a769f10664e12e4942c236398dd5dbce47a1,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x78619564f0b2399a9fcb229d938bf1e298d62b03b7a37fe6486034185d7f7d27,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x4625f15381a8723452ec80f3dd0293c213ae35de737c508f42427e1735398c3a,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x69542425ddb39d3d3981e76b41173eb1a09500f11164658a3536bf3e292f8b6a,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x82ac4f5bb40aece7d6706f1bdf4dfba5c835c09afba6446ef408d8ec6c09300f,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x740f9180671091b4c5b3ca59b9515bd0fc751f48e488a9f7f4b6848602490e21,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x9a04b08b4115986d8848e80960ad67490923154617cb82b3d88656ec1176c24c,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xf9ffe528eccffad519819d9eef70cef317af33899bcaee16f1e720caf9a98744,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x46da5e1a14b582b237f75556a0fd108c4ea0d55c0edd8f5d06c59a42e57410df,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x098f3429c8ccda60c3b5b9755e5632dd6a3f5297ee819bec8de2d8d37893968a,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x1a5b91af6025c11911ac072a98b8a44ed81f1f3c76ae752bd28004915db6f554,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x8bed50c7cae549ed4f8e05e02aa09b2a614c0af8eec719e4c6f7aee975ec3ec7,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xd86130f624b5dcc116f2dfbb5219b1afde4b7780780decd0b42694e15c1f8d8b,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x4167aa9bc0075f624d25d40eb29139dd2c452ebf17739fab859e14ac6765337a,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xa258ce5db20e91fb2ea30d607ac2f588bdc1924b21bbe39dc881e19889a7f5c6,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xe5ef8b5ab3cc8894452d16dc875b69a55fd925808ac7cafef1cd19485d0bb50a,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x120df2b3975d85b6dfca56bb98a82025ade5ac1d33e4319d2e0105b8de9ebf58,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xc964291dd2e0807a468396ebba3d59cfe385d949f6d6215976fc9a0a11de209a,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xf23f14cb709074b79abe166f159bc52b50de687464df6a5ebf112aa953c95ad5,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x622c092c9bd7e30f880043762e26d8e9c73ab7c0d0806f3c5e472a4152b35a93,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x8a5f090662731e7422bf651187fb89812419ab6808f2c62da213d6944fccfe9f,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xfbea3c0d92e061fd2399606f42647d65cc54191fa46d57b325103a75f5c22ba6,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x2babfbcc08d69b52c3747ddc8dcad4ea5511edabf24496f3ff96a1194d6f680e,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x4d3d019c28c779496b616d85aee201a3d79d9eecf35f728d00bcb12245ace703,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xe76fcee1f08325110436f8d4a95476251326b4827399f9b2ef7e12b7fb9c4ba1,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x4884d9c0bb4a9454ea37926591fc3eed2a28356e0506106a18f093035638da93,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x74c3f303d93d4cc4f0c1eb1b4378d34139220eb836628b82b649d1deb519b1d3,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xacb806670b278d3f0c84ba9c7a68c7df3b89e3451731a55d7351468c7c864c1c,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x8660fb8cd97e585ea7a41bccb22dd46e07eee8bbf34d90f0f0ca854b93b1ebee,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x2fc9c89cdca71a1c0224d469d0c364c96bbd99c1067a7ebe8ef412c645357a76,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x8ec6d5ab6ad7135d66091b8bf269be44c20af1d828694cd8650b5479156fd700,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x50ab4776e8cabe3d864fb7a1637de83f8fbb45d6e49645555ffe9526b27ebd66,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xbf39f5e17082983da4f409f91c7d9059acd02ccbefa69694aca475bb8d40b224,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x3135b3b981c850cc3fe9754ec6af117459d355ad6b0915beb61e84ea735c31bf,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xa7971dab52ce4bf45813223b0695f8e87f64b614c9c5499faac6f842e5c41be9,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x9e480f5617323ab104b4087ac4ef849a5da03427712fb302ac085507c77d8f37,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x57a6d474654d5e8d408159be39ad0e7026e6a4c6a6543e23a63d30610dc8dfc1,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x09eb3e01a5915a4e26d90b4c58bf0cf1e560fdc8ba53faed9d946ad3e9bc78fa,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x29c6d25da80a772310226b1b89d845c7916e4a4bc94d75aa330ec3eaa14b1e28,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x1a1ccfee11edeb989ca02e3cb89f062612a22a69ec816a625835d79370173987,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x1cb63dc541cf7f71c1c4e8cabd2619c3503c0ea1362dec75eccdf1e9efdbfcfc,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xac9dff32a69e75b396a2c250e206b36c34c63b955c9e5732e65eaf7ccca03c62,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x3e1b4f0c3ebd3d38cec389720147746774fc01ff6bdd065f0baf2906b16766a8,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x5cc8bed25574463026205e90aad828521f8e3d440970d7e810d1b46849681db5,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x255185d264509bd3a768bb0d50b568e66eb1fec96d573e33aaacc716d7c8fb93,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xe81b86ba631973918a859ff5995d7840b12511184c2865401f2693a71b9fa07e,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x61e67e42616598da8d36e865b282127c761380d3a56d26b8d35fbbc7641433c5,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x60c62ffef83fe603a34ca20b549522394e650dad5510ae68b6e074f0cd209a56,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x78577f2caf4a54f6065593535d76216f5f4075af7e7a98b79571d33b1822920c,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xfd4cb354f2869c8650200de0fe06f3d39e4dbebf19b0c1c2677da916ea84f44d,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x453769cef6ff9ba2d5c917982a1ad3e2f7e947d9ea228857556af0005665e0b0,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xe567f93f8f88bf1a6b33214f17f5d60c5dbbb531b4ab21b8c0b799b6416891e0,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x7e65a39a17f902a30ceb2469fe21cba8d4e0da9740fcefd5c647c81ff1ae95fa,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x03e4a7eea0cd6fc02b987138ef88e8795b5f839636ca07f6665bbae9e5878931,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xc3558e2b437cf0347cabc63c95fa2710d3f43c65d380feb998511903f9f4dcf0,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xe3a615f80882fb5dfbd08c1d7a8b0a4d3b651d5e8221f99b879cb01d97037a9c,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xb56db4a5fea85cbffaee41f05304689ea321c40d4c108b1146fa69118431d9b2,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xab28e1f077f18117945910c235bc9c6f9b6d2b45e9ef03009053006c637e3e26,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xefcabc1d5659fd6e48430dbfcc9fb4e08e8a9b895f7bf9b3d6c7661bfc44ada2,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xc7547496f212873e7c3631dafaca62a6e95ac39272acf25a7394bac6ea1ae357,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xc482013cb01bd69e0ea9f447b611b06623352e321469f4adc739e3ee189298eb,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x5942f42e91e391bb44bb2c4d40da1906164dbb6d1c184f00fa62899baa0dba2c,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xb4bcb46c80ad4cd603aff2c1baf8f2c896a628a46cc5786f0e58dae846694677,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xd0a7305b995fa8c317c330118fee4bfef9f65f70b54558c0988945b08e90ff08,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x687f801b7f32fdfa7d50274cc7b126efedbdae8de154d36395d33967216f3086,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xeb19ec10ac6c15ffa619fa46792971ee22a9328fa53bd69a10ed6e9617dd1bbf,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xa2bb3f0367f62abdb3a9fa6da34b20697cf214a4ff14fd42826da140ee025213,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x070a76511f32c882374400af59b22d88974a06fbc10d786dd07ca7527ebd8b90,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x8f195689537b446e946b376ec1e9eb5af5b4542ab47be550a5700fa5d81440d5,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x10cc09778699fc8ac109e7e6773f83391eeba2a6db5226fbe953dd8d99126ca5,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x8cc839cb7dc84fd3b8c0c7ca637e86a2f72a8715cc16c7afb597d12da717530b,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xa32504e6cc6fd0ee441440f213f082fcf76f72d36b5e2a0f3b6bdd50cdd825a2,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x8f45151db8878e51eec12c450b69fa92176af21a4543bb78c0d4c27286e74469,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x23f5c465bd35bcd4353216dc9505df68324a27990df9825a242e1288e40a13bb,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x35f409ce748af33c20a6ae693b8a48ba4623de9686f9834e22be4410e637d24f,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xb962e5845c1db624532562597a99e2acc5e434b97d8db0725bdeddd71a98e737,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0f8364f99f43dd52b4cfa9e426c48f7b6ab18dc40a896e96a09eceebb3363afe,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xa842746868da7644fccdbb07ae5e08c71a6287ab307c4f9717eadb414c9c99f4,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xa59064c6b7fe7d2407792d99ed1218d2dc2f240185fbd8f767997438241b92e9,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xb6ea0d58e8d48e05b9ff4d75b2ebe0bd9752c0e2691882f754be66cdec7628d3,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xf16b78c9d14c52b2b5156690b6ce37a5e09661f49674ad22604c7d3755e564d1,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xbfa8ef74e8a37cd64b8b4a4260c4fc162140603f9c2494b9cf4c1e13de522ed9,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xf4b89f1776ebf30640dc5ec99e43de22136b6ef936a85193ef940931108e408a,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xefb9a4555d495a584dbcc2a50938f6b9827eb014ffae2d2d0aae356a57894de8,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0627a466d42a26aca72cf531d4722e0e5fc5d491f4527786be4e1b641e693ac2,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x7d10d21542de3d8f074dbfd1a6e11b3df32c36272891aae54053029d39ebae10,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0f21118ee9763f46cc175a21de876da233b2b3b62c6f06fa2df73f6deccf37f3,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x143213b96f8519c15164742e2350cc66e814c9570634e871a8c1ddae4d31b6b5,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x8d2877120abae3854e00ae8cf5c8c95b3ede10590ab79ce2be7127239507e18d,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xaccd0005d59472ac04192c059ed9c10aea42c4dabec9e581f6cb10b261746573,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x67bc8dd5422f39e741b9995e6e60686e75d6620aa0d745b84191f5dba9b5bb18,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x11b8e95f6a654d4373cefbbac29a90fdd8ae098043d1969b9fa7885318376b34,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x431a0b8a6f08760c942eeff5791e7088fd210f877825ce4dcabe365e03e4a65c,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x704007f11bae513f428c9b0d23593fd2809d0dbc4c331009856135dafec23ce4,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xc06dee39a33a05e30c522061c1d9272381bde3f9e42fa9bd7d5a5c8ef11ec6ec,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x66b4157baaae85db0948ad72882287a80b286df2c40080b8da4d5d3db0a61bd2,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xef1983b1906239b490baaaa8e4527f78a57a0a767d731f062dd09efb59ae8e3d,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xf26d0d5c520cce6688ca5d51dee285af26f150794f2ea9f1d73f6df213d78338,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x8b28838382e6892f59c42a7709d6d38396495d3af5a8d5b0a60f172a6a8940bd,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x261a605fa5f2a9bdc7cffac530edcf976e7ea7af4e443b625fe01ed39dad44b6]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;compressed_lamport_PK = 0xdd635d27d1d52b9a49df9e5c0c622360a4dd17cba7db4e89bce3cb048fb721a5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;child_SK = 20397789859736650942317412262472558107875392172444076792671091975210932703118&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;None.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>BLS12-381 Deterministic Account Hierarchy</title>
        <published>2019-09-30T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Carl Beekhuizen</name><uri>https://github.com/CarlBeek</uri><email>carl@ethereum.org</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2334/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/bls-keys-related-erc-discussion-erc-2333-2334-2335/19774" />
        

        <id>https://wg-eips.ritovision.com/2334/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        

        
        <category
            term="tag:eip:2334"
            label="ERC-2334" />
        

        
        

        
        <summary type="html">BLS12-381 Deterministic account hierarchy structure</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2334/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;A standard for allocating keys generated by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2333&#x2F;&quot;&gt;ERC-2333&lt;&#x2F;a&gt; to a specific purpose. It defines a &lt;code&gt;path&lt;&#x2F;code&gt; which is a string that parses into the indices to be used when traversing the tree of keys that &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2333&#x2F;&quot;&gt;ERC-2333&lt;&#x2F;a&gt; generates.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The Beacon chain uses BLS signatures over BLS12-381. This new scheme requires a new key derivation mechanism, which is established within &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2333&#x2F;&quot;&gt;ERC-2333&lt;&#x2F;a&gt;. This new scheme is incompatible with &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;bitcoin&#x2F;bips&#x2F;blob&#x2F;43ce3a461dfb48e62ffa0cfc70f5f54d1eb5c577&#x2F;bip-0044.mediawiki&quot;&gt;BIP44&lt;&#x2F;a&gt; due to the exclusive use of hardened keys, the increased number of keys per level, not using &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;bitcoin&#x2F;bips&#x2F;blob&#x2F;43ce3a461dfb48e62ffa0cfc70f5f54d1eb5c577&#x2F;bip-0032.mediawiki&quot;&gt;BIP32&lt;&#x2F;a&gt; for key derivation. It is therefore necessary to establish a new &lt;em&gt;path&lt;&#x2F;em&gt; for traversing the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2333&#x2F;&quot;&gt;ERC-2333&lt;&#x2F;a&gt; key-tree.&lt;&#x2F;p&gt;
&lt;p&gt;The path structure specified in this ERC aims to be more general than &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;bitcoin&#x2F;bips&#x2F;blob&#x2F;43ce3a461dfb48e62ffa0cfc70f5f54d1eb5c577&#x2F;bip-0044.mediawiki&quot;&gt;BIP44&lt;&#x2F;a&gt; by not having UTXO-centric features which gave rise to the 4 different types of wallet paths being used within Ethereum in the past and gave rise to (draft) &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;600&#x2F;&quot;&gt;ERC-600&lt;&#x2F;a&gt; &amp;amp; &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;601&#x2F;&quot;&gt;ERC-601&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;path&quot;&gt;Path&lt;&#x2F;h3&gt;
&lt;p&gt;The path traversed through the tree of keys is defined by integers (which indicate the sibling index) separated by &lt;code&gt;&#x2F;&lt;&#x2F;code&gt; which denote ancestor relations. There are 4 levels (plus the master node) in the path and at least 4 (5 including the master node) MUST be used.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;m &#x2F; purpose &#x2F; coin_type &#x2F;  account &#x2F; use&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;notation&quot;&gt;Notation&lt;&#x2F;h4&gt;
&lt;p&gt;The notation used within the path is specified within the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2333&#x2F;&quot;&gt;ERC-2333&lt;&#x2F;a&gt;, but is summarized again below for convenience.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;m&lt;&#x2F;code&gt; Denotes the master node (or root) of the tree&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;&#x2F;&lt;&#x2F;code&gt; Separates the tree into depths, thus &lt;code&gt;i &#x2F; j&lt;&#x2F;code&gt; signifies that &lt;code&gt;j&lt;&#x2F;code&gt; is a child of &lt;code&gt;i&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;purpose&quot;&gt;Purpose&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;purpose&lt;&#x2F;code&gt; is set to &lt;code&gt;12381&lt;&#x2F;code&gt; which is the name of the new curve (BLS12-381). In order to be in compliance with this standard, the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2333&#x2F;&quot;&gt;ERC-2333&lt;&#x2F;a&gt; MUST be implemented as the KDF and therefore, the purpose &lt;code&gt;12381&lt;&#x2F;code&gt; MAY NOT be used unless this is the case.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;coin-type&quot;&gt;Coin Type&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;coin_type&lt;&#x2F;code&gt; here reflects the coin number for an individual coin thereby acting as a means of separating the keys used for different chains.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;account&quot;&gt;Account&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;account&lt;&#x2F;code&gt; is a field that provides the ability for a user to have distinct sets of keys for different purposes, if they so choose. This is the level at which different accounts for a single user SHOULD to be implemented.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;use&quot;&gt;Use&lt;&#x2F;h3&gt;
&lt;p&gt;This level is designed to provide a set of related keys that can be used for any purpose. The idea being that a single account has many uses which are related yet should remain separate for security reasons. It is required to support this level in the tree, although, for many purposes it will remain &lt;code&gt;0&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;beacon-chain-specific-parameters&quot;&gt;Beacon Chain Specific Parameters&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;coin-type-1&quot;&gt;Coin type&lt;&#x2F;h4&gt;
&lt;p&gt;The coin type used for the BLS12-381 keys in Ethereum is &lt;code&gt;3600&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;validator-keys&quot;&gt;Validator keys&lt;&#x2F;h4&gt;
&lt;p&gt;Each Beacon chain validator has two keys, one for withdrawals and transfers (called the &lt;em&gt;withdrawal key&lt;&#x2F;em&gt;), and the other for performing their duties as a validator (henceforth referred to as the &lt;em&gt;signing key&lt;&#x2F;em&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;The path for withdrawal keys is &lt;code&gt;m&#x2F;12381&#x2F;3600&#x2F;i&#x2F;0&lt;&#x2F;code&gt; where &lt;code&gt;i&lt;&#x2F;code&gt; indicates the &lt;code&gt;i&lt;&#x2F;code&gt;th set of validator keys.&lt;&#x2F;p&gt;
&lt;p&gt;The path for the signing key is &lt;code&gt;m&#x2F;12381&#x2F;3600&#x2F;i&#x2F;0&#x2F;0&lt;&#x2F;code&gt; where again, &lt;code&gt;i&lt;&#x2F;code&gt; indicates the &lt;code&gt;i&lt;&#x2F;code&gt;th set of validator keys. Another way of phrasing this is that the signing key is the &lt;code&gt;0&lt;&#x2F;code&gt;th child of the associated withdrawal key for that validator.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;&#x2F;strong&gt; If the above description of key paths is not feasible in a specific use case (eg. with secret-shared or custodial validators), then the affected keys may be omitted and derived via another means. Implementations of this ERC, must endeavour to use the appropriate keys for the given use case to the extent that is reasonably possible. (eg, in the case of custodial staking, the user making the deposits will follow this standard for their withdrawal keys which has no bearing on how the service provide derives the corresponding signing keys.)&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;purpose&lt;&#x2F;code&gt;, &lt;code&gt;coin_type&lt;&#x2F;code&gt;, and &lt;code&gt;account&lt;&#x2F;code&gt; are widely-adopted terms as per &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;bitcoin&#x2F;bips&#x2F;blob&#x2F;43ce3a461dfb48e62ffa0cfc70f5f54d1eb5c577&#x2F;bip-0043.mediawiki&quot;&gt;BIP43&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;bitcoin&#x2F;bips&#x2F;blob&#x2F;43ce3a461dfb48e62ffa0cfc70f5f54d1eb5c577&#x2F;bip-0044.mediawiki&quot;&gt;BIP44&lt;&#x2F;a&gt; and therefore reusing these terms and their associated meanings makes sense.&lt;&#x2F;p&gt;
&lt;p&gt;The purpose needs to be distinct from these standards as the KDF and path are not inter-compatible and &lt;code&gt;12381&lt;&#x2F;code&gt; is an obvious choice.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;account&lt;&#x2F;code&gt; separates user activity into distinct categories thereby allowing users to separate their concerns however they desire.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;use&lt;&#x2F;code&gt; will commonly be determined at the application level providing distinct keys for non-intersecting use cases.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;beacon-chain-specific-parameters-1&quot;&gt;Beacon Chain Specific Parameters&lt;&#x2F;h3&gt;
&lt;p&gt;A new coin type is chosen for Beacon Chain BLS keys to help ensure a clean separation between BLS12-381 and secp256k1 keys.  &lt;code&gt;3600&lt;&#x2F;code&gt; is chosen specifically because it is the square of the Ethereum&#x27;s secp256k1 &lt;code&gt;coin_type&lt;&#x2F;code&gt; (&lt;code&gt;3600==60^2&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;The primary reason validators have separate signing and withdrawal keys is to allow for the different security concerns of actions within the Beacon Chain. The signing key is given to the validator client where it signs messages as per the requirements of being a validator, it is therefore a &quot;hot key&quot;. If this key is compromised, the worst that can happen (locally) is that a slashable message is signed, resulting in the validator being slashed and forcibly exited. The withdrawal key is only needed when a validator wishes to perform an action not related to validating and has access to the full funds at stake for that validator. The withdrawal key therefore has higher security concerns and should be handled as a &quot;cold key&quot;. By having the signing key be a child of the withdrawal key, secure storage of the withdrawal key is sufficient to recover the signing key should the need arise.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;bitcoin&#x2F;bips&#x2F;blob&#x2F;43ce3a461dfb48e62ffa0cfc70f5f54d1eb5c577&#x2F;bip-0043.mediawiki&quot;&gt;BIP43&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;bitcoin&#x2F;bips&#x2F;blob&#x2F;43ce3a461dfb48e62ffa0cfc70f5f54d1eb5c577&#x2F;bip-0044.mediawiki&quot;&gt;BIP44&lt;&#x2F;a&gt;. Due to the use of a new KDF within &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2333&#x2F;&quot;&gt;ERC-2333&lt;&#x2F;a&gt;, a new path standard is required. This ERC implements this, with minor changes.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;purpose&lt;&#x2F;code&gt; &lt;code&gt;12381&lt;&#x2F;code&gt; paths do not support hardened keys and therefore the &lt;code&gt;&#x27;&lt;&#x2F;code&gt; character is invalid.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;None.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>BLS12-381 Keystore</title>
        <published>2019-09-30T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Carl Beekhuizen</name><uri>https://github.com/CarlBeek</uri><email>carl@ethereum.org</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2335/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/bls-keys-related-erc-discussion-erc-2333-2334-2335/19774" />
        

        <id>https://wg-eips.ritovision.com/2335/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        

        
        <category
            term="tag:eip:2335"
            label="ERC-2335" />
        

        
        

        
        <summary type="html">Keystore for storing BLS12-381 keys</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2335/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;A keystore is a mechanism for storing private keys. It is a JSON file that encrypts a private key and is the standard for interchanging keys between devices as until a user provides their password, their key is safe.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The secure storage and exchange of keys is a vital component of the user experience as people are expected to hold their own keys. It allows users to control access to individual keys and their use by applications.&lt;&#x2F;p&gt;
&lt;p&gt;In Ethereum, Web3 Secret Storage (commonly referred to as &quot;keystores&quot;) fulfills these requirements, however it is not perfectly suitable for these purposes moving forward. Specifically the problems with the existing standard are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;The use of Keccak256.&lt;&#x2F;strong&gt; Web3 Secret Stores use Keccak for their checksum. BLS signatures, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2333&#x2F;&quot;&gt;keys (ERC-2333)&lt;&#x2F;a&gt;, and key-storage are inter-chain standards, the establishment and proliferation of which hinges on them being neutral to all chains, something which Keccak is not.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;A lack of abstraction.&lt;&#x2F;strong&gt; Web3 Secret Stores are a result of an iterative design process whereby functionality was added and modified as needed without considering how abstractions could simplify the notion of different properties.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The process of decrypting the secret held within a keystore can be broken down into 3 sub-processes: obtaining the decryption key, verifying the password and decrypting the secret. Each process has its own functions which can be selected from as well as parameters required for the function all of which are specified within the keystore file itself.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;password-requirements&quot;&gt;Password requirements&lt;&#x2F;h3&gt;
&lt;p&gt;The password is a string of arbitrary unicode characters. The password is first converted to its NFKD representation, then the control codes (specified below) are stripped from the password and finally it is UTF-8 encoded.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;control-codes-removal&quot;&gt;Control codes removal&lt;&#x2F;h4&gt;
&lt;p&gt;The C0, C1, and &lt;code&gt;Delete&lt;&#x2F;code&gt; control codes are not valid characters in the password and should therefore be stripped from the password. C0 are the control codes between &lt;code&gt;0x00&lt;&#x2F;code&gt; - &lt;code&gt;0x1F&lt;&#x2F;code&gt; (inclusive) and C1 codes lie between &lt;code&gt;0x80&lt;&#x2F;code&gt; and &lt;code&gt;0x9F&lt;&#x2F;code&gt; (inclusive). &lt;code&gt;Delete&lt;&#x2F;code&gt;, commonly known as &quot;backspace&quot;, is the UTF-8 character &lt;code&gt;7F&lt;&#x2F;code&gt; which must also be stripped. Note that space (&lt;code&gt;Sp&lt;&#x2F;code&gt; UTF-8 &lt;code&gt;0x20&lt;&#x2F;code&gt;) is a valid character in passwords despite it being a pseudo-control character.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;modules&quot;&gt;Modules&lt;&#x2F;h3&gt;
&lt;p&gt;This standard makes use of the notion of a &lt;em&gt;module&lt;&#x2F;em&gt; which serves to represent, in an abstract sense, the different  cryptographic constructions and corresponding parameters for each component of the keystore. The idea being that components can be swapped out without affecting the rest of the specification should the need arise.&lt;&#x2F;p&gt;
&lt;p&gt;A module is comprised of a &lt;code&gt;function&lt;&#x2F;code&gt;, which defines which cryptographic construct is being used, &lt;code&gt;params&lt;&#x2F;code&gt;, the parameters required by the function, and &lt;code&gt;message&lt;&#x2F;code&gt; the primary input to the function.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;decryption-key&quot;&gt;Decryption key&lt;&#x2F;h3&gt;
&lt;p&gt;The decryption key is an intermediate key which is used both to verify the user-supplied password is correct, as well as for the final secret decryption. This key is simply derived from the password, the &lt;code&gt;function&lt;&#x2F;code&gt;, and the &lt;code&gt;params&lt;&#x2F;code&gt; specified by the&lt;code&gt;kdf&lt;&#x2F;code&gt; module as per the keystore file.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;KDF&lt;&#x2F;th&gt;&lt;th&gt;&lt;code&gt;&quot;function&quot;&lt;&#x2F;code&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;code&gt;&quot;params&quot;&lt;&#x2F;code&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;code&gt;&quot;message&quot;&lt;&#x2F;code&gt;&lt;&#x2F;th&gt;&lt;th&gt;Definition&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;PBKDF2-SHA-256&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;&quot;pbkdf2&quot;&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;ul&gt;&lt;li&gt;&lt;code&gt;&quot;c&quot;&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;&lt;li&gt;&lt;code&gt;&quot;dklen&quot;&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;&lt;li&gt;&lt;code&gt;&quot;prf: &quot;hmac-sha256&quot;&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;&lt;li&gt;&lt;code&gt;&quot;salt&quot;&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;&lt;&#x2F;ul&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc2898&quot;&gt;RFC 2898&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;scrypt&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;&quot;scrypt&quot;&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;ul&gt;&lt;li&gt;&lt;code&gt;&quot;dklen&quot;&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;&lt;li&gt;&lt;code&gt;&quot;n&quot;&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;&lt;li&gt;&lt;code&gt;&quot;p&quot;&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;&lt;li&gt;&lt;code&gt;&quot;r&quot;&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;&lt;li&gt;&lt;code&gt;&quot;salt&quot;&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;&lt;&#x2F;ul&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc7914&quot;&gt;RFC 7914&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;password-verification&quot;&gt;Password verification&lt;&#x2F;h3&gt;
&lt;p&gt;The password verification step verifies that the password is correct with respect to the &lt;code&gt;checksum.message&lt;&#x2F;code&gt;, &lt;code&gt;cipher.message&lt;&#x2F;code&gt;, and &lt;code&gt;kdf&lt;&#x2F;code&gt;. This is done by appending the &lt;code&gt;cipher.message&lt;&#x2F;code&gt; to the 2nd 16 bytes of the decryption key, obtaining its SHA256 hash and verifying whether it matches the &lt;code&gt;checksum.message&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;inputs&quot;&gt;Inputs&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;decryption_key&lt;&#x2F;code&gt;, the octet string obtained from decryption key process&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;cipher_message&lt;&#x2F;code&gt;, the octet string obtained from keystore file from &lt;code&gt;crypto.cipher.message&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;checksum_message&lt;&#x2F;code&gt;, the octet string obtained from keystore file from &lt;code&gt;crypto.checksum.message&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;outputs&quot;&gt;Outputs&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;valid_password&lt;&#x2F;code&gt;, a boolean value indicating whether the password is valid&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;a[0:3]&lt;&#x2F;code&gt; returns a slice of &lt;code&gt;a&lt;&#x2F;code&gt; including octets 0, 1, 2&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;a | b&lt;&#x2F;code&gt; is the concatenation of &lt;code&gt;a&lt;&#x2F;code&gt; with &lt;code&gt;b&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;procedure&quot;&gt;Procedure&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0. DK_slice = decryption_key[16:32]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;1. pre_image = DK_slice | cipher_message&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;2. checksum = SHA256(pre_image)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;3. valid_password = checksum == checksum_message&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;4. return valid_password&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Hash&lt;&#x2F;th&gt;&lt;th&gt;&lt;code&gt;&quot;function&quot;&lt;&#x2F;code&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;code&gt;&quot;params&quot;&lt;&#x2F;code&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;code&gt;&quot;message&quot;&lt;&#x2F;code&gt;&lt;&#x2F;th&gt;&lt;th&gt;Definition&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;SHA-256&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;&quot;sha256&quot;&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc6234&quot;&gt;RFC 6234&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;secret-decryption&quot;&gt;Secret decryption&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;cipher.function&lt;&#x2F;code&gt; encrypts the secret using the decryption key, thus to decrypt it, the decryption key along with the &lt;code&gt;cipher.function&lt;&#x2F;code&gt; and &lt;code&gt;cipher.params&lt;&#x2F;code&gt; must be used. If the &lt;code&gt;decryption_key&lt;&#x2F;code&gt; is longer than the key size required by the cipher, it is truncated to the correct number of bits. In the case of aes-128-ctr, only the first 16 bytes of the &lt;code&gt;decryption_key&lt;&#x2F;code&gt; are used as the AES key.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Cipher&lt;&#x2F;th&gt;&lt;th&gt;&lt;code&gt;&quot;function&quot;&lt;&#x2F;code&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;code&gt;&quot;params&quot;&lt;&#x2F;code&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;code&gt;&quot;message&quot;&lt;&#x2F;code&gt;&lt;&#x2F;th&gt;&lt;th&gt;Definition&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;AES-128 Counter Mode&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;&quot;aes-128-ctr&quot;&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;ul&gt;&lt;li&gt;&lt;code&gt;&quot;iv&quot;&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;&lt;&#x2F;ul&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc3686&quot;&gt;RFC 3686&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;description&quot;&gt;Description&lt;&#x2F;h3&gt;
&lt;p&gt;This field is an optional field to help explain the purpose and identify a particular keystores in a user-friendly manner. While this field can, and should, be used to help distinguish keystores from one-another, the &lt;code&gt;description&lt;&#x2F;code&gt; &lt;strong&gt;is not necessarily unique&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;pubkey&quot;&gt;PubKey&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;pubkey&lt;&#x2F;code&gt; is the public key associated with the private key secured within the keystore. It is stored here to improve user experience and security which is achieved by not requiring users to enter their password just to obtain their public keys. This field is required if the secret being stored within the keystore is a private key. The encoding of the &lt;code&gt;pubkey&lt;&#x2F;code&gt; is specified in the in the appropriate signature standard (eg. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2333&#x2F;&quot;&gt;ERC-2333&lt;&#x2F;a&gt;), but can be seen as a byte-string in the abstract and should be directly compatible with the appropriate signature library.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;path&quot;&gt;Path&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;path&lt;&#x2F;code&gt; indicates where in the key-tree a key originates from. It is a string defined by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2334&#x2F;&quot;&gt;ERC-2334&lt;&#x2F;a&gt;, if no path is known or the path is not relevant, the empty string, &lt;code&gt;&quot;&quot;&lt;&#x2F;code&gt; indicates this. The &lt;code&gt;path&lt;&#x2F;code&gt; can specify an arbitrary depth within the tree and the deepest node within the tree indicates the depth of the key stored within this file.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;uuid&quot;&gt;UUID&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;uuid&lt;&#x2F;code&gt; provided in the keystore is a randomly generated UUID as specified by &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc4122&quot;&gt;RFC 4122&lt;&#x2F;a&gt;. It is used as a 128-bit proxy for referring to a particular set of keys or account.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;version&quot;&gt;Version&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;version&lt;&#x2F;code&gt; is set to &lt;code&gt;4&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;json-schema&quot;&gt;JSON schema&lt;&#x2F;h3&gt;
&lt;p&gt;The keystore, at its core, is constructed with modules which allow for the configuration of the cryptographic constructions used password hashing, password verification and secret decryption. Each module is composed of: &lt;code&gt;function&lt;&#x2F;code&gt;, &lt;code&gt;params&lt;&#x2F;code&gt;, and &lt;code&gt;message&lt;&#x2F;code&gt; which corresponds with which construction is to be used, what the configuration for the construction is, and what the input is.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;$ref&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;#&#x2F;definitions&#x2F;Keystore&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;definitions&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;Keystore&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;crypto&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;kdf&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;$ref&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;#&#x2F;definitions&#x2F;Module&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;checksum&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;$ref&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;#&#x2F;definitions&#x2F;Module&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;cipher&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;$ref&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;#&#x2F;definitions&#x2F;Module&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;path&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uuid&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uuid&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;integer&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;required&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;crypto&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;path&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uuid&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Keystore&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;Module&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;message&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;required&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;message&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;None.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The rationale behind the design of this specification is largely the same as that behind the Ethereum Web3 Secret Storage Definition except for the lack of support for Keccak (explained in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2335&#x2F;#motivation&quot;&gt;motivation above&lt;&#x2F;a&gt;) and the notion of modules.&lt;&#x2F;p&gt;
&lt;p&gt;Modules provide a very useful level of abstraction which allow the Key-Derivation-Function, Checksum, and Cipher to be thought of as instances of the same thing allowing for their substitution with minimal effort.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;version&lt;&#x2F;code&gt; is set to 4 to prevent collisions with the existing Ethereum keystore standard.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This specification is not backwards compatible with the Ethereum Web3 Secret Storage Definition due to the lack of Keccak256 checksums as explained above. While this format is capable of supporting Keccak checksums via the Checksum module, it would defeat the purpose of this standard to include it as this standard could no longer be considered neutral with respect to other projects in the industry.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;scrypt-test-vector&quot;&gt;Scrypt Test Vector&lt;&#x2F;h3&gt;
&lt;p&gt;Password &lt;code&gt;&quot;𝔱𝔢𝔰𝔱𝔭𝔞𝔰𝔰𝔴𝔬𝔯𝔡🔑&quot;&lt;&#x2F;code&gt;
Encoded Password: &lt;code&gt;0x7465737470617373776f7264f09f9491&lt;&#x2F;code&gt;
Secret &lt;code&gt;0x000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;crypto&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;kdf&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;scrypt&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;dklen&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 262144&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;p&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;salt&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;d4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;message&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;checksum&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;sha256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;message&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;d2217fe5f3e9a1e34581ef8a78f7c9928e436d36dacc5e846690a5581e8ea484&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;cipher&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;aes-128-ctr&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;iv&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;264daa3f303d7259501c93d997d84fe6&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;message&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;06ae90d55fe0a6e9c5c3bc5b170827b2e5cce3929ed3f116c2811e6366dfe20f&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;This is a test keystore that uses scrypt to secure the secret.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;9612d7a727c9d0a22e185a1c768478dfe919cada9266988cb32359c11f2b7b27f4ae4040902382ae2910c15e2b420d07&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;path&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;m&#x2F;12381&#x2F;60&#x2F;3141592653&#x2F;589793238&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uuid&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1d85ae20-35c5-4611-98e8-aa14a633906f&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;pbkdf2-test-vector&quot;&gt;PBKDF2 Test Vector&lt;&#x2F;h3&gt;
&lt;p&gt;Password &lt;code&gt;&quot;𝔱𝔢𝔰𝔱𝔭𝔞𝔰𝔰𝔴𝔬𝔯𝔡🔑&quot;&lt;&#x2F;code&gt;
Encoded Password: &lt;code&gt;0x7465737470617373776f7264f09f9491&lt;&#x2F;code&gt;
Secret &lt;code&gt;0x000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;crypto&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;kdf&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;pbkdf2&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;dklen&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 262144&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;prf&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;hmac-sha256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;salt&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;d4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;message&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;checksum&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;sha256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;message&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;8a9f5d9912ed7e75ea794bc5a89bca5f193721d30868ade6f73043c6ea6febf1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;cipher&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;aes-128-ctr&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;iv&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;264daa3f303d7259501c93d997d84fe6&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;message&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;cee03fde2af33149775b7223e7845e4fb2c8ae1792e5f99fe9ecf474cc8c16ad&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;This is a test keystore that uses PBKDF2 to secure the secret.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;9612d7a727c9d0a22e185a1c768478dfe919cada9266988cb32359c11f2b7b27f4ae4040902382ae2910c15e2b420d07&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;path&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;m&#x2F;12381&#x2F;60&#x2F;0&#x2F;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uuid&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;64625def-3331-4eea-ab6f-782f3ed16a83&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations-1&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;None.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Multichain address resolution for ENS</title>
        <published>2019-09-09T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Nick Johnson</name><email>nick@ens.domains</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2304/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://discuss.ens.domains/t/new-standard-proposal-ens-multicoin-support/1148" />
        

        <id>https://wg-eips.ritovision.com/2304/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:2304"
            label="ERC-2304" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2304/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces new overloads for the &lt;code&gt;addr&lt;&#x2F;code&gt; field for ENS resolvers, which permit resolution of addresses for other blockchains via ENS.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;With the increasing uptake of ENS by multi-coin wallets, wallet authors have requested the ability to resolve addresses for non-Ethereum chains inside ENS. This specification standardises a way to enter and retrieve these addresses in a cross-client fashion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;A new accessor function for resolvers is specified:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; coinType&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The EIP165 interface ID for this function is 0xf1cb7e06.&lt;&#x2F;p&gt;
&lt;p&gt;When called on a resolver, this function must return the cryptocurrency address for the specified namehash and coin type. A zero-length string must be returned if the specified coin ID does not exist on the specified node.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;coinType&lt;&#x2F;code&gt; is the cryptocurrency coin type index from &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;satoshilabs&#x2F;slips&#x2F;blob&#x2F;master&#x2F;.&#x2F;00044.md&quot;&gt;SLIP44&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The return value is the cryptocurency address in its native binary format. Detailed descriptions of the binary encodings for several popular chains are provided in the Address Encoding section below.&lt;&#x2F;p&gt;
&lt;p&gt;A new event for resolvers is defined:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AddressChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; coinType&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Resolvers MUST emit this event on each change to the address for a name and coin type.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;recommended-accessor-functions&quot;&gt;Recommended accessor functions&lt;&#x2F;h3&gt;
&lt;p&gt;The following function provides the recommended interface for changing the addresses stored for a node. Resolvers SHOULD implement this interface for setting addresses unless their needs dictate a different interface.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setAddr&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; coinType&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;setAddr&lt;&#x2F;code&gt; adds or replaces the address for the given node and coin type.  The parameters for this function are as per those described in &lt;code&gt;addr()&lt;&#x2F;code&gt; above.&lt;&#x2F;p&gt;
&lt;p&gt;This function emits an &lt;code&gt;AddressChanged&lt;&#x2F;code&gt; event with the new address; see also the backwards compatibility section below for resolvers that also support &lt;code&gt;addr(bytes32)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;address-encoding&quot;&gt;Address Encoding&lt;&#x2F;h3&gt;
&lt;p&gt;In general, the native binary representation of the address should be used, without any checksum commonly used in the text representation.&lt;&#x2F;p&gt;
&lt;p&gt;A table of encodings for common blockchains is provided, followed by a more detailed description of each format. In the table, &#x27;encodings&#x27; lists the address encodings supported by that chain, along with any relevant parameters. Details of those address encodings are described in the following sections.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Cryptocurrency&lt;&#x2F;th&gt;&lt;th&gt;Coin Type&lt;&#x2F;th&gt;&lt;th&gt;Encoding&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Bitcoin&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;P2PKH(0x00), P2SH(0x05), SegWit(&#x27;bc&#x27;)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Litecoin&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;P2PKH(0x30), P2SH(0x32), P2SH(0x05), SegWit(&#x27;ltc&#x27;)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Dogecoin&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;P2PKH(0x1e), P2SH(0x16)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Monacoin&lt;&#x2F;td&gt;&lt;td&gt;22&lt;&#x2F;td&gt;&lt;td&gt;P2PKH(0x32), P2SH(0x05)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Ethereum&lt;&#x2F;td&gt;&lt;td&gt;60&lt;&#x2F;td&gt;&lt;td&gt;ChecksummedHex&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Ethereum Classic&lt;&#x2F;td&gt;&lt;td&gt;61&lt;&#x2F;td&gt;&lt;td&gt;ChecksummedHex&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Rootstock&lt;&#x2F;td&gt;&lt;td&gt;137&lt;&#x2F;td&gt;&lt;td&gt;ChecksummedHex(30)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Ripple&lt;&#x2F;td&gt;&lt;td&gt;144&lt;&#x2F;td&gt;&lt;td&gt;Ripple&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Bitcoin Cash&lt;&#x2F;td&gt;&lt;td&gt;145&lt;&#x2F;td&gt;&lt;td&gt;P2PKH(0x00), P2SH(0x05), CashAddr&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Binance&lt;&#x2F;td&gt;&lt;td&gt;714&lt;&#x2F;td&gt;&lt;td&gt;Bech32(&#x27;bnb&#x27;)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;p2pkh-version&quot;&gt;P2PKH(version)&lt;&#x2F;h4&gt;
&lt;p&gt;Pay to Public Key Hash addresses are &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.bitcoin.it&#x2F;wiki&#x2F;Base58Check_encoding&quot;&gt;base58check&lt;&#x2F;a&gt; encoded. After decoding, the first byte is a version byte. For example, the Bitcoin address &lt;code&gt;1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa&lt;&#x2F;code&gt; base58check decodes to the 21 bytes &lt;code&gt;0062e907b15cbf27d5425399ebf6f0fb50ebb88f18&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;P2PKH addresses have a version byte, followed by a 20 byte pubkey hash. Their canonical encoding is their scriptPubkey encoding (specified &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.bitcoin.it&#x2F;wiki&#x2F;Transaction#Types_of_Transaction&quot;&gt;here&lt;&#x2F;a&gt;) is &lt;code&gt;OP_DUP OP_HASH160 &amp;lt;pubKeyHash&amp;gt; OP_EQUALVERIFY OP_CHECKSIG&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The above example address is thus encoded as the 25 bytes &lt;code&gt;76a91462e907b15cbf27d5425399ebf6f0fb50ebb88f1888ac&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;p2sh-version&quot;&gt;P2SH(version)&lt;&#x2F;h5&gt;
&lt;p&gt;P2SH addresses are base58check encoded in the same manner as P2PKH addresses.
P2SH addresses have a version, followed by a 20 byte script hash. Their scriptPubkey encoding (specified &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.bitcoin.it&#x2F;wiki&#x2F;Transaction#Pay-to-Script-Hash&quot;&gt;here&lt;&#x2F;a&gt;) is &lt;code&gt;OP_HASH160 &amp;lt;scriptHash&amp;gt; OP_EQUAL&lt;&#x2F;code&gt;. A Bitcoin address of &lt;code&gt;3Ai1JZ8pdJb2ksieUV8FsxSNVJCpoPi8W6&lt;&#x2F;code&gt; decodes to the 21 bytes &lt;code&gt;0562e907b15cbf27d5425399ebf6f0fb50ebb88f18&lt;&#x2F;code&gt; and is encoded as the 23 bytes &lt;code&gt;a91462e907b15cbf27d5425399ebf6f0fb50ebb88f1887&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;segwit-hrp&quot;&gt;SegWit(hrp)&lt;&#x2F;h5&gt;
&lt;p&gt;SegWit addresses are encoded with &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;bitcoin&#x2F;bips&#x2F;blob&#x2F;master&#x2F;bip-0173.mediawiki&quot;&gt;bech32&lt;&#x2F;a&gt;. Bech32 addresses consist of a human-readable part - &#x27;bc&#x27; for Bitcoin mainnet - and a machine readable part. For SegWit addresses, this decodes to a &#x27;witness version&#x27;, between 0 and 15, and a &#x27;witness program&#x27;, as defined in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;bitcoin&#x2F;bips&#x2F;blob&#x2F;master&#x2F;bip-0173.mediawiki&quot;&gt;BIP141&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The scriptPubkey encoding for a bech32 address, as defined in BIP141, is &lt;code&gt;OP_n&lt;&#x2F;code&gt;, where &lt;code&gt;n&lt;&#x2F;code&gt; is the witness version, followed by a push of the witness program. Note this warning from BIP173:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Implementations should take special care when converting the address to a scriptPubkey, where witness version n is stored as OP_n. OP_0 is encoded as 0x00, but OP_1 through OP_16 are encoded as 0x51 though 0x60 (81 to 96 in decimal). If a bech32 address is converted to an incorrect scriptPubKey the result will likely be either unspendable or insecure.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;For example, the Bitcoin SegWit address &lt;code&gt;BC1QW508D6QEJXTDG4Y5R3ZARVARY0C5XW7KV8F3T4&lt;&#x2F;code&gt; decodes to a version of &lt;code&gt;0&lt;&#x2F;code&gt; and a witness script of &lt;code&gt;751e76e8199196d454941c45d1b3a323f1433bd6&lt;&#x2F;code&gt;, and then encodes to a scriptPubkey of &lt;code&gt;0014751e76e8199196d454941c45d1b3a323f1433bd6&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;checksummedhex-chainid&quot;&gt;ChecksummedHex(chainId?)&lt;&#x2F;h4&gt;
&lt;p&gt;To translate a text format checksummed hex address into binary format, simply remove the &#x27;0x&#x27; prefix and hex decode it. &lt;code&gt;0x314159265dD8dbb310642f98f50C066173C1259b&lt;&#x2F;code&gt; is hex-decoded and stored as the 20 bytes &lt;code&gt;314159265dd8dbb310642f98f50c066173c1259b&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;A checksum format is specified by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;55&#x2F;&quot;&gt;EIP-55&lt;&#x2F;a&gt;, and extended by &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;rsksmart&#x2F;RSKIPs&#x2F;blob&#x2F;master&#x2F;IPs&#x2F;RSKIP60.md&quot;&gt;RSKIP60&lt;&#x2F;a&gt;, which specifies a means of including the chain ID in the checksum. The checksum on a text format address must be checked. Addresses with invalid checksums that are not all uppercase or all lowercase MUST be rejected with an error. Implementations may choose whether to accept non-checksummed addresses, but the authors recommend at least providing a warning to users in this situation.&lt;&#x2F;p&gt;
&lt;p&gt;When encoding an address from binary to text, an EIP55&#x2F;RSKIP60 checksum MUST be used - so the correct encoding of the above address for Ethereum is &lt;code&gt;0x314159265dD8dbb310642f98f50C066173C1259b&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;ripple&quot;&gt;Ripple&lt;&#x2F;h4&gt;
&lt;p&gt;Ripple addresses are encoded using a version of base58check with an alternative alphabet, described &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;xrpl.org&#x2F;base58-encodings.html&quot;&gt;here&lt;&#x2F;a&gt;. Two types of ripple addresses are supported, &#x27;r-addresses&#x27;, and &#x27;X-addresss&#x27;. r-addresses consist of a version byte followed by a 20 byte hash, while X-addresses consist of a version byte, a 20 byte hash, and a tag, specified &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;xrp-community&#x2F;standards-drafts&#x2F;issues&#x2F;6&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Both address types should be stored in ENS by performing ripple&#x27;s version of base58check decoding and storing them directly (including version byte). For example, the ripple address &lt;code&gt;rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn&lt;&#x2F;code&gt; decodes to and is stored as &lt;code&gt;004b4e9c06f24296074f7bc48f92a97916c6dc5ea9&lt;&#x2F;code&gt;, while the address &lt;code&gt;X7qvLs7gSnNoKvZzNWUT2e8st17QPY64PPe7zriLNuJszeg&lt;&#x2F;code&gt; decodes to and is stored as &lt;code&gt;05444b4e9c06f24296074f7bc48f92a97916c6dc5ea9000000000000000000&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;cashaddr&quot;&gt;CashAddr&lt;&#x2F;h4&gt;
&lt;p&gt;Bitcoin Cash defines a new address format called &#x27;CashAddr&#x27;, specified &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;bitcoincashorg&#x2F;bitcoincash.org&#x2F;blob&#x2F;master&#x2F;spec&#x2F;cashaddr.md&quot;&gt;here&lt;&#x2F;a&gt;. This uses a variant of bech32 encoding to encode and decode (non-segwit) Bitcoin Cash addresses, using a prefix of &#x27;bitcoincash:&#x27;. A CashAddr should be decoded using this bech32 variant, then converted and stored based on its type (P2PKH or P2SH) as described in the relevant sections above.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;bech32&quot;&gt;Bech32&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;bitcoin&#x2F;bips&#x2F;blob&#x2F;master&#x2F;bip-0173.mediawiki&quot;&gt;Bech32&lt;&#x2F;a&gt; addresses consist of a human-readable part - for example, &#x27;bnb&#x27; for Binance - and a machine readable part. The encoded data is simply the address, which can be converted to binary and stored directly.&lt;&#x2F;p&gt;
&lt;p&gt;For example, the BNB address &lt;code&gt;bnb1grpf0955h0ykzq3ar5nmum7y6gdfl6lxfn46h2&lt;&#x2F;code&gt; decodes to the binary representation &lt;code&gt;40c2979694bbc961023d1d27be6fc4d21a9febe6&lt;&#x2F;code&gt;, which is stored directly in ENS.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;example&quot;&gt;Example&lt;&#x2F;h3&gt;
&lt;p&gt;An example implementation of a resolver that supports this EIP is provided here:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.5.8&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AddrResolver&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ResolverBase&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; ADDR_INTERFACE_ID &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x3b3b57de&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; ADDRESS_INTERFACE_ID &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xf1cb7e06&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; COIN_TYPE_ETH &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 60&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AddrChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; a&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AddressChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; coinType&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; _addresses&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Sets the address associated with an ENS node.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * May only be called by the owner of that node in the ENS registry.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; node&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The node to update.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to set.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setAddr&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; a&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; authorised&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;node&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        setAddr&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; COIN_TYPE_ETH&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addressToBytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;a&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Returns the address associated with an ENS node.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; node&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ENS node to query.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; associated address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; a &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; COIN_TYPE_ETH&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;a&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; bytesToAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;a&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setAddr&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; coinType&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; a&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; authorised&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;node&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AddressChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; coinType&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; a&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;coinType &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; COIN_TYPE_ETH&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AddrChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; bytesToAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;a&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _addresses&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;coinType&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; a&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; coinType&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _addresses&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;coinType&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; interfaceID &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; ADDR_INTERFACE_ID &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span&gt; interfaceID &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; ADDRESS_INTERFACE_ID &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;interfaceID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h3&gt;
&lt;p&gt;An implementation of this interface is provided in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ensdomains&#x2F;resolvers&#x2F;&quot;&gt;ensdomains&#x2F;resolvers&lt;&#x2F;a&gt; repository.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;If the resolver supports the &lt;code&gt;addr(bytes32)&lt;&#x2F;code&gt; interface defined in EIP137, the resolver MUST treat this as a special case of this new specification in the following ways:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The value returned by &lt;code&gt;addr(node)&lt;&#x2F;code&gt; from EIP137 should always match the value returned by &lt;code&gt;addr(node, 60)&lt;&#x2F;code&gt; (60 is the coin type ID for Ethereum).&lt;&#x2F;li&gt;
&lt;li&gt;Anything that causes the &lt;code&gt;AddrChanged&lt;&#x2F;code&gt; event from EIP137 to be emitted must also emit an &lt;code&gt;AddressChanged&lt;&#x2F;code&gt; event from this EIP, with the &lt;code&gt;coinType&lt;&#x2F;code&gt; specified as 60, and vice-versa.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;tests&quot;&gt;Tests&lt;&#x2F;h2&gt;
&lt;p&gt;The table below specifies test vectors for valid address encodings for each cryptocurrency described above.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Cryptocurrency&lt;&#x2F;th&gt;&lt;th&gt;Coin Type&lt;&#x2F;th&gt;&lt;th&gt;Text&lt;&#x2F;th&gt;&lt;th&gt;Onchain (hex)&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Bitcoin&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;76a91462e907b15cbf27d5425399ebf6f0fb50ebb88f1888ac&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;3Ai1JZ8pdJb2ksieUV8FsxSNVJCpoPi8W6&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;a91462e907b15cbf27d5425399ebf6f0fb50ebb88f1887&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;BC1QW508D6QEJXTDG4Y5R3ZARVARY0C5XW7KV8F3T4&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0014751e76e8199196d454941c45d1b3a323f1433bd6&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Litecoin&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;LaMT348PWRnrqeeWArpwQPbuanpXDZGEUz&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;76a914a5f4d12ce3685781b227c1f39548ddef429e978388ac&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;MQMcJhpWHYVeQArcZR3sBgyPZxxRtnH441&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;a914b48297bff5dadecc5f36145cec6a5f20d57c8f9b87&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;ltc1qdp7p2rpx4a2f80h7a4crvppczgg4egmv5c78w8&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0014687c150c26af5493befeed7036043812115ca36c&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Dogecoin&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;DBXu2kgc3xtvCUWFcxFE3r9hEYgmuaaCyD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;76a9144620b70031f0e9437e374a2100934fba4911046088ac&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;AF8ekvSf6eiSBRspJjnfzK6d1EM6pnPq3G&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;a914f8f5d99a9fc21aa676e74d15e7b8134557615bda87&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Monacoin&lt;&#x2F;td&gt;&lt;td&gt;22&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;MHxgS2XMXjeJ4if2PRRbWYcdwZPWfdwaDT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;76a9146e5bb7226a337fe8307b4192ae5c3fab9fa9edf588ac&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Ethereum&lt;&#x2F;td&gt;&lt;td&gt;60&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x314159265dD8dbb310642f98f50C066173C1259b&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;314159265dd8dbb310642f98f50c066173c1259b&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Ethereum Classic&lt;&#x2F;td&gt;&lt;td&gt;61&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x314159265dD8dbb310642f98f50C066173C1259b&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;314159265dd8dbb310642f98f50c066173c1259b&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Rootstock&lt;&#x2F;td&gt;&lt;td&gt;137&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x5aaEB6053f3e94c9b9a09f33669435E7ef1bEAeD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;5aaeb6053f3e94c9b9a09f33669435e7ef1beaed&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Ripple&lt;&#x2F;td&gt;&lt;td&gt;144&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;004b4e9c06f24296074f7bc48f92a97916c6dc5ea9&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;X7qvLs7gSnNoKvZzNWUT2e8st17QPY64PPe7zriLNuJszeg&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;05444b4e9c06f24296074f7bc48f92a97916c6dc5ea9000000000000000000&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Bitcoin Cash&lt;&#x2F;td&gt;&lt;td&gt;145&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;1BpEi6DfDAUFd7GtittLSdBeYJvcoaVggu&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;76a91476a04053bda0a88bda5177b86a15c3b29f55987388ac&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;bitcoincash:qpm2qsznhks23z7629mms6s4cwef74vcwvy22gdx6a&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;76a91476a04053bda0a88bda5177b86a15c3b29f55987388ac&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;3CWFddi6m4ndiGyKqzYvsFYagqDLPVMTzC&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;a91476a04053bda0a88bda5177b86a15c3b29f55987387&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;bitcoincash:ppm2qsznhks23z7629mms6s4cwef74vcwvn0h829pq&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;a91476a04053bda0a88bda5177b86a15c3b29f55987387&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Binance&lt;&#x2F;td&gt;&lt;td&gt;714&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;bnb1grpf0955h0ykzq3ar5nmum7y6gdfl6lxfn46h2&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;40c2979694bbc961023d1d27be6fc4d21a9febe6&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>wallet_getOwnedAssets JSON-RPC Method</title>
        <published>2019-08-29T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Loredana Cirstea</name><uri>https://github.com/loredanacirstea</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2256/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2256-add-wallet-getownedassets-json-rpc-method/3600" />
        

        <id>https://wg-eips.ritovision.com/2256/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="interface"
                label="Interface" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2256"
            label="EIP-2256" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2256/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;This is a proposal for a new JSON-RPC call for retrieving from a wallet a selection of owned assets by an Ethereum address, with the user&#x27;s permission.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;There is no standardized way for a dApp to request a list of owned assets from a user. Now, each dApp needs to keep a list of all the popular or existing assets and check the user&#x27;s balance against the blockchain, for each of these assets. This leads to duplicated effort across dApps. It also leads to the user being presented with asset options that the user does not care about, from various, unwanted airdrops.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;There are financial dApps that require a list of owned assets from a user, for various purposes - calculating taxes, selecting customized payment options, etc. Each of these dApps are now forced to keep a list of popular assets (smart contract addresses, ABIs) and retrieve the user&#x27;s data from the blockchain, for each asset. This leads to effort duplication and nonoptimal UX where the user is presented with either more or less asset options than the user would like - various airdrops, incomplete list of assets kept by the dApp.&lt;&#x2F;p&gt;
&lt;p&gt;This list of owned assets can be retrieved from the wallet used by the user. The wallet can allow the user to manage only the assets that the user is interested in. Therefore, a new JSON-RPC method is proposed: &lt;code&gt;wallet_getOwnedAssets&lt;&#x2F;code&gt;. This method is complementary to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;747&#x2F;&quot;&gt;EIP-747&lt;&#x2F;a&gt;, which proposes a way for sites to suggest users new assets to watch on their wallet.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;New JSON-RPC method to be added to web3 browsers: &lt;code&gt;wallet_getOwnedAssets&lt;&#x2F;code&gt;. This method is for dApp-wallet communication and only targets the assets that have already been whitelisted by the wallet, for the user account.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Arguments:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;type &lt;code&gt;address&lt;&#x2F;code&gt;, Ethereum address that owns the assets&lt;&#x2F;li&gt;
&lt;li&gt;options object, optional:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;chainId&lt;&#x2F;code&gt; - type &lt;code&gt;uint&lt;&#x2F;code&gt;, chain id respecting &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt;; optional&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;limit&lt;&#x2F;code&gt; - type &lt;code&gt;uint&lt;&#x2F;code&gt;, the maximum number of owned assets expected by the dApp to be returned; optional&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;types&lt;&#x2F;code&gt; - type &lt;code&gt;string[]&lt;&#x2F;code&gt;, array of asset interface identifiers such as &lt;code&gt;[&#x27;ERC20&#x27;, &#x27;ERC721&#x27;]&lt;&#x2F;code&gt;; optional&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;justification&lt;&#x2F;code&gt; - type &lt;code&gt;string&lt;&#x2F;code&gt;, human-readable text provided by the dApp, explaining the intended purpose of this request; optional but recommended&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Result:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;array with asset records:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;address&lt;&#x2F;code&gt; - type &lt;code&gt;address&lt;&#x2F;code&gt;, Ethereum checksummed address&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;chainId&lt;&#x2F;code&gt; - type &lt;code&gt;uint&lt;&#x2F;code&gt;, identifier for the chain on which the assets are deployed&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;type&lt;&#x2F;code&gt; - type &lt;code&gt;string&lt;&#x2F;code&gt;, asset interface ERC identifier; e.g. &lt;code&gt;ERC20&lt;&#x2F;code&gt;; optional - &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1820&#x2F;&quot;&gt;EIP-1820&lt;&#x2F;a&gt; could be used&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;options&lt;&#x2F;code&gt; - an object with asset-specific fields; &lt;code&gt;ERC20&lt;&#x2F;code&gt; tokens example:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;name&lt;&#x2F;code&gt; - type &lt;code&gt;string&lt;&#x2F;code&gt;, token name; optional if the token does not implement it&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;symbol&lt;&#x2F;code&gt; - type &lt;code&gt;string&lt;&#x2F;code&gt;, token symbol; optional if the token does not implement it&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;icon&lt;&#x2F;code&gt;- type &lt;code&gt;base64&lt;&#x2F;code&gt;, token icon; optional&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;balance&lt;&#x2F;code&gt; - type &lt;code&gt;uint&lt;&#x2F;code&gt;, the number of tokens that the user owns, in the smallest token denomination&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;decimals&lt;&#x2F;code&gt; - type &lt;code&gt;uint&lt;&#x2F;code&gt;, the number of decimals implemented by the token; optional&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;examples&quot;&gt;Examples&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;1) A request to return all of the user&#x27;s owned assets:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;method&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;wallet_getOwnedAssets&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x3333333333333333333333333333333333333333&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;justification&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The dApp needs to know about all your assets in order to calculate your taxes properly.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Result:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ERC20&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;options&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;TokenA&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;symbol&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;TKA&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;icon&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;data:image&#x2F;gif;base64,R0lGODlhAQABAIABAP&#x2F;&#x2F;&#x2F;wAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1000000000000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;decimals&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 18&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000002&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ERC20&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;options&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;TokenB&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;symbol&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;TKB&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;icon&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;data:image&#x2F;gif;base64,R0lGODlhAQABAIABAP&#x2F;&#x2F;&#x2F;wAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2000000000000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;decimals&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 18&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000003&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 42&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ERC721&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;options&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;TokenC&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;symbol&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;TKC&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;icon&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;data:image&#x2F;gif;base64,R0lGODlhAQABAIABAP&#x2F;&#x2F;&#x2F;wAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;2) A request to return one &lt;code&gt;ERC20&lt;&#x2F;code&gt; owned asset, deployed on &lt;code&gt;chainId&lt;&#x2F;code&gt; 1:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;method&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;wallet_getOwnedAssets&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x3333333333333333333333333333333333333333&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;types&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ERC20&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;justification&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Select your token of choice, in order to pay for our services.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Result:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ERC20&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;options&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;TokenA&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;symbol&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;TKA&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;icon&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;data:image&#x2F;gif;base64,R0lGODlhAQABAIABAP&#x2F;&#x2F;&#x2F;wAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1000000000000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;decimals&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 18&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;ui-best-practices&quot;&gt;UI Best Practices&lt;&#x2F;h3&gt;
&lt;p&gt;The wallet should display a UI to the user, showing the request.
The user can:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;accept the request, in which case the dApp receives all the requested assets&lt;&#x2F;li&gt;
&lt;li&gt;reject the request&lt;&#x2F;li&gt;
&lt;li&gt;amend the request by lowering the number of owned assets returned to the dApp&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;If all owned assets are requested, the total number of owned assets will be shown to the user. The user can also choose to select the assets that will be returned to the dApp, amending the request.&lt;&#x2F;p&gt;
&lt;p&gt;If a selection is requested, the user will select from the list of owned assets.&lt;&#x2F;p&gt;
&lt;p&gt;As an optimization, wallets can keep a list of frequently used assets by the user, and show that list first, with the option of expanding that list with owned assets that the user uses less frequently.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;In order to avoid duplication of effort for dApps that require keeping a list of all or popular assets and to provide optimal UX, the &lt;code&gt;wallet_getOwnedAssets&lt;&#x2F;code&gt; JSON-RPC method is proposed.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;chainId&lt;&#x2F;code&gt; and &lt;code&gt;types&lt;&#x2F;code&gt; optional parameters enable dApps to provide options in order to restrict the selection list that the user will be presented with by the wallet, in accordance with the dApp&#x27;s functionality. The &lt;code&gt;limit&lt;&#x2F;code&gt; parameter enables the dApp to tell the user an upper limit of accounts that the user can select. It remains to be seen if a lower bound should also be provided. At the moment, this lower bound can be considered as being &lt;code&gt;1&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;options&lt;&#x2F;code&gt; response field provides the dApp with asset-specific options, enabling better UX through using the same visual and text identifiers that the wallet uses, making it easier for the user to understand the dApp&#x27;s UI.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;address&lt;&#x2F;code&gt;, &lt;code&gt;type&lt;&#x2F;code&gt; response fields provide enough information about the asset, enabling dApps to provide additional asset-specific functionality.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;balance&lt;&#x2F;code&gt; response field is an optimization, allowing dApps to show the user&#x27;s balance without querying the blockchain. Usually, this information is already public.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Not relevant, as this is a new method.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;To be done.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;To be done.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Wallet Permissions System</title>
        <published>2019-08-22T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Dan Finlay</name><uri>https://github.com/danfinlay</uri>
	</author>
	
	<author>
		<name>Erik Marks</name><uri>https://github.com/rekmarks</uri>
	</author>
	
	<author>
		<name>Gavin John</name><uri>https://github.com/Pandapip1</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2255/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/web3-login-permissions/3583" />
        

        <id>https://wg-eips.ritovision.com/2255/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="interface"
                label="Interface" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2255"
            label="EIP-2255" />
        

        
        

        
        <summary type="html">An interface to restrict access to sensitive methods</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2255/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP adds two new wallet-namespaced RPC endpoints, &lt;code&gt;wallet_getPermissions&lt;&#x2F;code&gt; and &lt;code&gt;wallet_requestPermissions&lt;&#x2F;code&gt;, providing a standard interface for requesting and checking permissions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Wallets are responsible for mediating interactions between untrusted applications and users&#x27; keys through appropriate user consent. Today, wallets always prompt the user for every action. This provides security at the cost of substantial user friction. We believe that a single permissions request can achieve the same level of security with vastly improved UX.&lt;&#x2F;p&gt;
&lt;p&gt;The pattern of permissions requests (typically using Oauth2) is common around the web, making it a very familiar pattern:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2255&#x2F;.&#x2F;assets&#x2F;facebook_permissions.png&quot; alt=&quot;Facebook Permissions&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2255&#x2F;.&#x2F;assets&#x2F;log_in_with_apple.jpeg&quot; alt=&quot;Log in With Apple&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Many web3 applications today begin their sessions with a series of repetitive requests:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Reveal your wallet address to this site.&lt;&#x2F;li&gt;
&lt;li&gt;Switch to a preferred network.&lt;&#x2F;li&gt;
&lt;li&gt;Sign a cryptographic challenge.&lt;&#x2F;li&gt;
&lt;li&gt;Grant a token allowance to our contract.&lt;&#x2F;li&gt;
&lt;li&gt;Send a transaction to our contract.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Many of these (and possibly all), and many more (like decryption), could be generalized into a set of human-readable permissions prompts on the original sign-in screen, and additional permissions could be requested only as needed:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2255&#x2F;.&#x2F;assets&#x2F;permissions.png&quot; alt=&quot;Sample prompt screenshot&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Each of these permissions could be individually rejected, or even &lt;em&gt;attenuated&lt;&#x2F;em&gt;--adjusted to meet the user&#x27;s terms (for example, a sign-in request could have a user-added expiration date, and a token allowance could be adjusted by the user when it is requested).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal adds two new methods to a wallet&#x27;s web3 provider API: &lt;code&gt;wallet_getPermissions&lt;&#x2F;code&gt; and &lt;code&gt;wallet_requestPermissions&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;wallet-getpermissions&quot;&gt;&lt;code&gt;wallet_getPermissions&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;wallet_getPermissions&lt;&#x2F;code&gt; method is used for getting an array of current permissions (empty by default). It takes no parameters and returns an array of &lt;code&gt;Permission&lt;&#x2F;code&gt; objects.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;wallet-getpermissions-returns&quot;&gt;&lt;code&gt;wallet_getPermissions&lt;&#x2F;code&gt; Returns&lt;&#x2F;h4&gt;
&lt;p&gt;The format of the returned permissions MUST be an array of &lt;code&gt;Permission&lt;&#x2F;code&gt; objects, which are defined as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Caveat&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; any&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Permission&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  invoker&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  parentCapability&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  caveats&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Caveat&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;invoker&lt;&#x2F;code&gt; is a URI used to identify the source of the current dapp (e.g. &lt;code&gt;https:&#x2F;&#x2F;your-site.com&#x2F;&lt;&#x2F;code&gt;). The term &lt;code&gt;parentCapability&lt;&#x2F;code&gt; refers to the method that is being permitted (e.g. &lt;code&gt;eth_accounts&lt;&#x2F;code&gt;). The &lt;code&gt;caveats&lt;&#x2F;code&gt; array represents the specific restrictions applied to the permitted method. The &lt;code&gt;type&lt;&#x2F;code&gt; of a &lt;code&gt;Caveat&lt;&#x2F;code&gt; is a string, and the &lt;code&gt;value&lt;&#x2F;code&gt; is an arbitrary JSON value. The &lt;code&gt;value&lt;&#x2F;code&gt; of a &lt;code&gt;Caveat&lt;&#x2F;code&gt; is only meaningful in the context of the &lt;code&gt;type&lt;&#x2F;code&gt; of the &lt;code&gt;Caveat&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;wallet-requestpermissions&quot;&gt;&lt;code&gt;wallet_requestPermissions&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;wallet_requestPermissions&lt;&#x2F;code&gt; method is used for an application to request additional permissions. It MUST take a single parameter, a &lt;code&gt;PermissionRequest&lt;&#x2F;code&gt; object, and MUST return an array of &lt;code&gt;RequestedPermission&lt;&#x2F;code&gt; objects.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;wallet-requestpermissions-parameters&quot;&gt;&lt;code&gt;wallet_requestPermissions&lt;&#x2F;code&gt; Parameters&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;wallet_requestPermissions&lt;&#x2F;code&gt; method takes a single parameter, a &lt;code&gt;PermissionRequest&lt;&#x2F;code&gt; object, which is defined as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PermissionRequest&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;methodName&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;caveatName&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; any&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;methodName&lt;&#x2F;code&gt; is the name of the method for which the permission is being requested (e.g. &lt;code&gt;eth_accounts&lt;&#x2F;code&gt;). The &lt;code&gt;caveatName&lt;&#x2F;code&gt; is the name of the caveat being applied to the permission (e.g. &lt;code&gt;requiredMethods&lt;&#x2F;code&gt;). The caveat value is the value of the caveat (e.g. &lt;code&gt;[&quot;signTypedData_v3&quot;]&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;Attempted requests to a restricted method must fail with an error, until a &lt;code&gt;wallet_requestPermissions&lt;&#x2F;code&gt; request is made and accepted by the user.&lt;&#x2F;p&gt;
&lt;p&gt;If a &lt;code&gt;wallet_requestPermissions&lt;&#x2F;code&gt; request is rejected, it should throw an error with a &lt;code&gt;code&lt;&#x2F;code&gt; value equal to &lt;code&gt;4001&lt;&#x2F;code&gt; as per &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1193&#x2F;&quot;&gt;EIP-1193&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;wallet-requestpermissions-returns&quot;&gt;&lt;code&gt;wallet_requestPermissions&lt;&#x2F;code&gt; Returns&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;wallet_requestPermissions&lt;&#x2F;code&gt; method returns an array of &lt;code&gt;RequestedPermission&lt;&#x2F;code&gt; objects, which are defined as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RequestedPermission&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  parentCapability&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  date&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; number&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;parentCapability&lt;&#x2F;code&gt; is the name of the method for which the permission is being requested (e.g. &lt;code&gt;eth_accounts&lt;&#x2F;code&gt;). The &lt;code&gt;date&lt;&#x2F;code&gt; is the timestamp of the request, in Unix time, and is optional.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;While the current model of getting user consent on a per-action basis has high security, there are huge usability gains to be had bo getting more general user consent which can cover broad categories of usage, which can be expressed in a more human-readable way. This pattern has a variety of benefits to offer different functions within a web3 wallet.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;requestPermissions&lt;&#x2F;code&gt; method can be expanded to include other options related to the requested permissions, for example, sites could request accounts with specific abilities. For example, a website like an exchange that requires &lt;code&gt;signTypedData_v3&lt;&#x2F;code&gt; (which is not supported by some hardware wallets), might want to specify that requirement. This would allow wallets to display only compatible accounts, while preserving the user&#x27;s privacy and choice regarding how they are storing their keys.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;requesting-permissions&quot;&gt;Requesting permissions&lt;&#x2F;h3&gt;
&lt;p&gt;The following example should prompt the user to approve the &lt;code&gt;eth_accounts&lt;&#x2F;code&gt; permission, and return the permission object if approved.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;provider&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;request&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  method&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;requestPermissions&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  params&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_accounts&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        requiredMethods&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;signTypedData_v3&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;getting-permissions&quot;&gt;Getting permissions&lt;&#x2F;h3&gt;
&lt;p&gt;The following example should return the current permissions object.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;provider&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;request&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  method&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;getPermissions&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;server-side-request-forgery-ssrf&quot;&gt;Server-Side Request Forgery (SSRF)&lt;&#x2F;h3&gt;
&lt;p&gt;This consideration is applicable if the favicon of a website is to be displayed.&lt;&#x2F;p&gt;
&lt;p&gt;Wallets should be careful about making arbitrary requests to URLs. As such, it is recommended for wallets to sanitize the URI by whitelisting specific schemes and ports. A vulnerable wallet could be tricked into, for example, modifying data on a locally-hosted redis database.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Atomic Swap-based American Call Option Contract Standard</title>
        <published>2019-08-17T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Runchao Han</name><email>runchao.han@monash.edu</email>
	</author>
	
	<author>
		<name>Haoyu Lin</name><email>chris.haoyul@gmail.com</email>
	</author>
	
	<author>
		<name>Jiangshan Yu</name><email>jiangshan.yu@monash.edu</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2266/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/2266" />
        

        <id>https://wg-eips.ritovision.com/2266/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="last-call"
                label="Last Call" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:2266"
            label="ERC-2266" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2266/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;A standard for token contracts providing Atomic Swap-based American Call Option functionalities.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard provides functionality to make Atomic Swap-based American Call Option payment. The Atomic Swap protocol based on Hashed Time-Locked Contract (HTLC) &lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-1-1&quot;&gt;&lt;a href=&quot;#fn-1&quot;&gt;1&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; has optionality &lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-2-1&quot;&gt;&lt;a href=&quot;#fn-2&quot;&gt;2&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;, and such optionality can be utilised to construct American Call Options without trusted third party. This standard defines the common way of implementing this protocol. In particular, this EIP defines technical terms, provides interfaces, and gives reference implementations of this protocol.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Atomic Swap allows users to atomically exchange their tokens without trusted third parties while the HTLC is commonly used for the implementation. However, the HTLC-based Atomic Swap has optionality. More specifically, the swap initiator can choose to proceed or abort the swap for several hours, which gives him time for speculating according to the exchange rate. A discussion&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-2-2&quot;&gt;&lt;a href=&quot;#fn-2&quot;&gt;2&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; shows that the HTLC-based Atomic Swap is equivalent to an American Call Option in finance. On the other hand,thanks to such optionality, the HTLC-based Atomic Swap can be utilised to construct American Call Options without trusted third party. A paper&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-3-1&quot;&gt;&lt;a href=&quot;#fn-3&quot;&gt;3&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; proposes a secure Atomic-Swap-based American Call Option protocol on smart contracts. This protocol not only eliminates the arbitrage opportunity but also prevents any party from locking the other party&#x27;s money maliciously. This EIP aims at providing the standard of implementing this protocol in existing token standards.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The Atomic Swap-based American Call Option smart contract should follow the syntax and semantics of Ethereum smart contracts.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;initiator&lt;&#x2F;code&gt;: the party who publishes the advertisement of the swap.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;participant&lt;&#x2F;code&gt;: the party who agrees on the advertisement and participates in the swap with &lt;code&gt;initiator&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;asset&lt;&#x2F;code&gt;: the amount of token(s) to be exchanged.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;premium&lt;&#x2F;code&gt;: the amount of token(s) that &lt;code&gt;initiator&lt;&#x2F;code&gt; pays to &lt;code&gt;participant&lt;&#x2F;code&gt; as the premium.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;redeem&lt;&#x2F;code&gt;: the action to claim the token from the other party.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;refund&lt;&#x2F;code&gt;: the action to claim the token from the party herself&#x2F;himself, because of timelock expiration.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;secrect&lt;&#x2F;code&gt;: a random string chosen by &lt;code&gt;initiator&lt;&#x2F;code&gt; as the preimage of a hash.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;secrectHash&lt;&#x2F;code&gt;: a string equals to the hash of &lt;code&gt;secrect&lt;&#x2F;code&gt;, used for constructing HTLCs.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;timelock&lt;&#x2F;code&gt;: a timestamp representing the timelimit, before when the asset can be redeemed, and otherwise can only be refunded.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;storage-variables&quot;&gt;Storage Variables&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;swap&quot;&gt;swap&lt;&#x2F;h4&gt;
&lt;p&gt;This mapping stores the metadata of the swap contracts, including the parties and tokens involved. Each contract uses different &lt;code&gt;secretHash&lt;&#x2F;code&gt;, and is distinguished by &lt;code&gt;secretHash&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Swap&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; swap&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;initiatorasset&quot;&gt;initiatorAsset&lt;&#x2F;h4&gt;
&lt;p&gt;This mapping stores the detail of the asset initiators want to sell, including the amount, the timelock and the state. It is associated with the swap contract with the same &lt;code&gt;secretHash&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; InitiatorAsset&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; initiatorAsset&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;participantasset&quot;&gt;participantAsset&lt;&#x2F;h4&gt;
&lt;p&gt;This mapping stores the details of the asset participants want to sell, including the amount, the timelock and the state. It is associated with the swap contract with the same &lt;code&gt;secretHash&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; ParticipantAsset&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; participantAsset&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;premiumasset&quot;&gt;premiumAsset&lt;&#x2F;h4&gt;
&lt;p&gt;This mapping stores the details of the premium initiators attach in the swap contract, including the amount, the timelock and the state. It is associated with the swap contract with the same &lt;code&gt;secretHash&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Premium&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; premium&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;methods&quot;&gt;Methods&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;setup&quot;&gt;setup&lt;&#x2F;h4&gt;
&lt;p&gt;This function sets up the swap contract, including the both parties involved, the tokens to exchanged, and so on.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setup&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; secretHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; initiator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenA&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenB&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; initiatorAssetAmount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; participant&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; participantAssetAmount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; premiumAmount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;initiate&quot;&gt;initiate&lt;&#x2F;h4&gt;
&lt;p&gt;The initiator invokes this function to fill and lock the token she&#x2F;he wants to sell and join the contract.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; initiate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; secretHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; assetRefundTime&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;fillpremium&quot;&gt;fillPremium&lt;&#x2F;h4&gt;
&lt;p&gt;The initiator invokes this function to fill and lock the premium.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fillPremium&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; secretHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; premiumRefundTime&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;participate&quot;&gt;participate&lt;&#x2F;h4&gt;
&lt;p&gt;The participant invokes this function to fill and lock the token she&#x2F;he wants to sell and join the contract.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; participate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; secretHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; assetRefundTime&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;redeemasset&quot;&gt;redeemAsset&lt;&#x2F;h4&gt;
&lt;p&gt;One of the parties invokes this function to get the token from the other party, by providing the preimage of the hash lock &lt;code&gt;secret&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; redeemAsset&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; secret&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; secretHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;refundasset&quot;&gt;refundAsset&lt;&#x2F;h4&gt;
&lt;p&gt;One of the parties invokes this function to get the token back after the timelock expires.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; refundAsset&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; secretHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;redeempremium&quot;&gt;redeemPremium&lt;&#x2F;h4&gt;
&lt;p&gt;The participant invokes this function to get the premium. This can be invoked only if the participant has already invoked &lt;code&gt;participate&lt;&#x2F;code&gt; and the participant&#x27;s token is redeemed or refunded.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; redeemPremium&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; secretHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;refundpremium&quot;&gt;refundPremium&lt;&#x2F;h4&gt;
&lt;p&gt;The initiator invokes this function to get the premium back after the timelock expires.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; refundPremium&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; secretHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;events&quot;&gt;Events&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;setup-1&quot;&gt;SetUp&lt;&#x2F;h4&gt;
&lt;p&gt;This event indicates that one party has set up the contract using the function &lt;code&gt;setup()&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SetUp&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; secretHash&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; initiator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; participant&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenA&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenB&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; initiatorAssetAmount&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; participantAssetAmount&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; premiumAmount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;initiated&quot;&gt;Initiated&lt;&#x2F;h4&gt;
&lt;p&gt;This event indicates that &lt;code&gt;initiator&lt;&#x2F;code&gt; has filled and locked the token to be exchanged using the function &lt;code&gt;initiate()&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Initiated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; initiateTimestamp&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; secretHash&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; initiator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; participant&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; initiatorAssetToken&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; initiatorAssetAmount&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; initiatorAssetRefundTimestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;participated&quot;&gt;Participated&lt;&#x2F;h4&gt;
&lt;p&gt;This event indicates that &lt;code&gt;participant&lt;&#x2F;code&gt; has filled and locked the token to be exchanged using the function &lt;code&gt;participate()&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Participated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; participateTimestamp&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; secretHash&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; initiator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; participant&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; participantAssetToken&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; participantAssetAmount&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; participantAssetRefundTimestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;premiumfilled&quot;&gt;PremiumFilled&lt;&#x2F;h4&gt;
&lt;p&gt;This event indicates that &lt;code&gt;initiator&lt;&#x2F;code&gt; has filled and locked &lt;code&gt;premium&lt;&#x2F;code&gt; using the function &lt;code&gt;fillPremium()&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PremiumFilled&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; fillPremiumTimestamp&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; secretHash&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; initiator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; participant&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; premiumToken&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; premiumAmount&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; premiumRefundTimestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;initiatorassetredeemed-participantassetredeemed&quot;&gt;InitiatorAssetRedeemed&#x2F;ParticipantAssetRedeemed&lt;&#x2F;h4&gt;
&lt;p&gt;These two events indicate that &lt;code&gt;asset&lt;&#x2F;code&gt; has been redeemed by the other party before the timelock by providing &lt;code&gt;secret&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InitiatorAssetRedeemed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; redeemTimestamp&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; secretHash&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; secret&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; redeemer&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; assetToken&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ParticipantAssetRedeemed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; redeemTimestamp&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; secretHash&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; secret&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; redeemer&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; assetToken&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;initiatorassetrefunded-participantassetrefunded&quot;&gt;InitiatorAssetRefunded&#x2F;ParticipantAssetRefunded&lt;&#x2F;h4&gt;
&lt;p&gt;These two events indicate that &lt;code&gt;asset&lt;&#x2F;code&gt; has been refunded by the original owner after the timelock expires.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InitiatorAssetRefunded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; refundTimestamp&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; secretHash&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; refunder&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; assetToken&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ParticipantAssetRefunded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; refundTimestamp&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; secretHash&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; refunder&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; assetToken&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;premiumredeemed&quot;&gt;PremiumRedeemed&lt;&#x2F;h4&gt;
&lt;p&gt;This event indicates that &lt;code&gt;premium&lt;&#x2F;code&gt; has been redeemed by &lt;code&gt;participant&lt;&#x2F;code&gt;. This implies that &lt;code&gt;asset&lt;&#x2F;code&gt; is either redeemed by &lt;code&gt;initiator&lt;&#x2F;code&gt; if it can provide the preimage of &lt;code&gt;secrectHash&lt;&#x2F;code&gt; before  &lt;code&gt;asset&lt;&#x2F;code&gt; timelock expires; or refunded by &lt;code&gt;participant&lt;&#x2F;code&gt; if &lt;code&gt;asset&lt;&#x2F;code&gt; timelock expires.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PremiumRedeemed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; redeemTimestamp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; secretHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; redeemer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;premiumrefunded&quot;&gt;PremiumRefunded&lt;&#x2F;h4&gt;
&lt;p&gt;This event indicates that &lt;code&gt;premium&lt;&#x2F;code&gt; has been refunded back to &lt;code&gt;initiator&lt;&#x2F;code&gt;, because of &lt;code&gt;participant&lt;&#x2F;code&gt; doesn&#x27;t participate at all, by the time of &lt;code&gt;premium&lt;&#x2F;code&gt; timelock expires.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PremiumRefunded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; refundTimestamp&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; secretHash&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; refunder&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;To achieve the atomicity, HTLC is used.&lt;&#x2F;li&gt;
&lt;li&gt;The participant should decide whether to participate after the initiator locks the token and sets up the timelock.&lt;&#x2F;li&gt;
&lt;li&gt;The initiator should decide whether to proceed the swap (redeem the tokens from the participant and reveal the preimage of the hash lock), after the participant locks the tokens and sets up the time locks.&lt;&#x2F;li&gt;
&lt;li&gt;Premium is redeemable for the participant only if the participant participates in the swap and redeems the initiator&#x27;s token before premium&#x27;s timelock expires.&lt;&#x2F;li&gt;
&lt;li&gt;Premium is refundable for the initiator only if the initiator initiates but the participant does not participate in the swap at all.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;initiateTimestamp&lt;&#x2F;code&gt; should cover the whole swap process.&lt;&#x2F;li&gt;
&lt;li&gt;The participant should never participate before the premium has been deposited.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal is fully backward compatible. Functionalities of existing standards will not be affected by this proposal, as it only provides additional features to them.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Please visit &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2266&#x2F;.&#x2F;assets&#x2F;Example.sol&quot;&gt;here&lt;&#x2F;a&gt; to find our example implementation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;&#x2F;h2&gt;
&lt;section class=&quot;footnotes&quot;&gt;
&lt;ol class=&quot;footnotes-list&quot;&gt;
&lt;li id=&quot;fn-1&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.bitcoin.it&#x2F;wiki&#x2F;Hash_Time_Locked_Contracts&quot;&gt;Hash Time Locked Contracts&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-1-1&quot;&gt;↩&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li id=&quot;fn-2&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;lists.linuxfoundation.org&#x2F;pipermail&#x2F;lightning-dev&#x2F;2019-January&#x2F;001798.html&quot;&gt;An Argument For Single-Asset Lightning Network&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-2-1&quot;&gt;↩&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-2-2&quot;&gt;↩2&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li id=&quot;fn-3&quot;&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;eprint.iacr.org&#x2F;2019&#x2F;896&quot;&gt;On the optionality and fairness of Atomic Swaps&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-3-1&quot;&gt;↩&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;section&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Transaction Postdata</title>
        <published>2019-08-16T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>John Adler</name><uri>https://github.com/adlerjohn</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2242/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2242-transaction-postdata/3557" />
        

        <id>https://wg-eips.ritovision.com/2242/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:2242"
            label="EIP-2242" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2242/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;An additional, optional transaction field is added for &quot;postdata,&quot; data that is posted on-chain but that cannot be read from the EVM.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;A paradigm shift in how blockchains are used has been seen recently in Eth 2.0, with the rise of &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;notes.ethereum.org&#x2F;w1Pn2iMmSTqCmVUTGV4T5A?view&quot;&gt;&lt;em&gt;Execution Environments&lt;&#x2F;em&gt;&lt;&#x2F;a&gt; (EEs), and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethresear.ch&#x2F;t&#x2F;the-stateless-client-concept&#x2F;172&quot;&gt;&lt;em&gt;stateless clients&lt;&#x2F;em&gt;&lt;&#x2F;a&gt;. This shift involves blockchains serving as a secure data availability and arbitration layer, &lt;em&gt;i.e.&lt;&#x2F;em&gt;, they provide a globally-accepted source of available data, and process fraud&#x2F;validity and data availability proofs. This same paradigm can be applied on Eth 1.x, replacing EEs with &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethresear.ch&#x2F;t&#x2F;building-scalable-decentralized-payment-systems-request-for-feedback&#x2F;5312&quot;&gt;trust-minimized side chains&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;While &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2028&#x2F;&quot;&gt;EIP-2028&lt;&#x2F;a&gt; provides a reduction in gas cost of calldata, and is a step in the right direction of encouraging use of history rather than state, the EVM does not actually need to see all data that is posted on-chain. Following the principle of &quot;don&#x27;t pay for what you don&#x27;t use,&quot; a distinct way of posting data on-chain, but without actually being usable within the EVM, is needed.&lt;&#x2F;p&gt;
&lt;p&gt;For &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethresear.ch&#x2F;t&#x2F;minimal-viable-merged-consensus&#x2F;5617&quot;&gt;trust-minimized side chains with fraud proofs&lt;&#x2F;a&gt;, we simply need to ensure that the side chain block proposer has attested that &lt;em&gt;some&lt;&#x2F;em&gt; data is available. Authentication can be performed as part of a fraud proof should that data end up invalid. Note that &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethresear.ch&#x2F;t&#x2F;on-chain-scaling-to-potentially-500-tx-sec-through-mass-tx-validation&#x2F;3477&quot;&gt;trust-minimized side chains with validity proofs&lt;&#x2F;a&gt; can&#x27;t make use of the changes proposed in this EIP, as they required immediate authentication of the posted data. This will be &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethresear.ch&#x2F;t&#x2F;multi-threaded-data-availability-on-eth-1&#x2F;5899&quot;&gt;the topic of a future EIP&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;We propose a consensus modification, beginning at &lt;code&gt;FORK_BLKNUM&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;p&gt;An additional optional field, &lt;code&gt;postdata&lt;&#x2F;code&gt;, is added to transactions. Serialized transactions now have the format:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;quot;from&amp;quot;: bytes20,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;quot;to&amp;quot;: bytes20,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;quot;startGas&amp;quot;: uint256,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;quot;gasPrice&amp;quot;: uint256,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;quot;value&amp;quot;: uint256,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;quot;data&amp;quot;: bytes,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;quot;nonce&amp;quot;: uint256,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&amp;quot;postdata&amp;quot;: bytes],&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;with witnesses signing over the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;wiki&#x2F;wiki&#x2F;RLP&quot;&gt;RLP encoding&lt;&#x2F;a&gt; of the above. &lt;code&gt;postdata&lt;&#x2F;code&gt; is data that is posted on-chain, for later historical retrieval by layer-2 systems.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;postdata&lt;&#x2F;code&gt; is an RLP-encoded twople &lt;code&gt;(version: uint64, data: bytes)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;version&lt;&#x2F;code&gt; is &lt;code&gt;0&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;data&lt;&#x2F;code&gt; is an RLP-encoded list of binary data. This EIP does not interpret the data in any way, simply considering it as a binary blob, though future EIPs may introduce different interpretation schemes for different values of &lt;code&gt;version&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The gas cost of the posted data is &lt;code&gt;1 gas per byte&lt;&#x2F;code&gt;. This cost is deducted from the &lt;code&gt;startGas&lt;&#x2F;code&gt;; if the remaining gas is non-positive the transaction immediately reverts with an out of gas exception.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The changes proposed are as minimal and non-disruptive to the existing EVM and transaction format as possible while also supporting possible &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethresear.ch&#x2F;t&#x2F;multi-threaded-data-availability-on-eth-1&#x2F;5899&quot;&gt;future extensions&lt;&#x2F;a&gt; through a version code.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The new transaction format is backwards compatible, as the new &lt;code&gt;postdata&lt;&#x2F;code&gt; field is optionally appended to existing transactions.&lt;&#x2F;p&gt;
&lt;p&gt;The proposed changes are not forwards-compatible, and will require a hard fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TODO&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TODO&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Structured Definitions for Net Gas Metering</title>
        <published>2019-07-18T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Wei Tang</name><uri>https://github.com/sorpaas</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2200/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/sorpaas/EIPs/issues/1" />
        

        <id>https://wg-eips.ritovision.com/2200/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:2200"
            label="EIP-2200" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2200/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;This is an EIP that implements net gas metering. It&#x27;s a combined
version of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1283&#x2F;&quot;&gt;EIP-1283&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1706&#x2F;&quot;&gt;EIP-1706&lt;&#x2F;a&gt;, with a structured definition so as
to make it interoperable with other gas changes such as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1884&#x2F;&quot;&gt;EIP-1884&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP provides a structured definition of net gas metering changes
for &lt;code&gt;SSTORE&lt;&#x2F;code&gt; opcode, enabling new usages for contract storage, and
reducing excessive gas costs where it doesn’t match how most
implementation works.&lt;&#x2F;p&gt;
&lt;p&gt;This is a combination of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1283&#x2F;&quot;&gt;EIP-1283&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1706&#x2F;&quot;&gt;EIP-1706&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes a way for gas metering on &lt;code&gt;SSTORE&lt;&#x2F;code&gt;, using information
that is more universally available to most implementations, and
require as little change in implementation structures as possible.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Storage slot’s original value.&lt;&#x2F;li&gt;
&lt;li&gt;Storage slot’s current value.&lt;&#x2F;li&gt;
&lt;li&gt;Refund counter.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Usages that benefits from this EIP’s gas reduction scheme includes:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Subsequent storage write operations within the same call frame. This
includes reentry locks, same-contract multi-send, etc.&lt;&#x2F;li&gt;
&lt;li&gt;Exchange storage information between sub call frame and parent call
frame, where this information does not need to be persistent outside
of a transaction. This includes sub-frame error codes and message
passing, etc.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The original definition of EIP-1283 created a danger of a new kind of
reentrancy attacks on existing contracts as Solidity by default grants
a &quot;stipend&quot; of 2300 gas to simple transfer calls. This danger is
easily mitigated if &lt;code&gt;SSTORE&lt;&#x2F;code&gt; is not allowed in low gasleft state,
without breaking the backward compatibility and the original intention
of EIP-1283.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP also replaces the original EIP-1283 value definitions of gas
by parameters, so that it&#x27;s more structured, and easier to define
changes in the future.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Define variables &lt;code&gt;SLOAD_GAS&lt;&#x2F;code&gt;, &lt;code&gt;SSTORE_SET_GAS&lt;&#x2F;code&gt;, &lt;code&gt;SSTORE_RESET_GAS&lt;&#x2F;code&gt; and
&lt;code&gt;SSTORE_CLEARS_SCHEDULE&lt;&#x2F;code&gt;. The old and new values for those variables
are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;SLOAD_GAS&lt;&#x2F;code&gt;: changed from &lt;code&gt;200&lt;&#x2F;code&gt; to &lt;code&gt;800&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SSTORE_SET_GAS&lt;&#x2F;code&gt;: &lt;code&gt;20000&lt;&#x2F;code&gt;, not changed.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SSTORE_RESET_GAS&lt;&#x2F;code&gt;: &lt;code&gt;5000&lt;&#x2F;code&gt;, not changed.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SSTORE_CLEARS_SCHEDULE&lt;&#x2F;code&gt;: &lt;code&gt;15000&lt;&#x2F;code&gt;, not changed.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Change the definition of EIP-1283 using those variables. The new
specification, combining EIP-1283 and EIP-1706, will look like
below. The terms &lt;em&gt;original value&lt;&#x2F;em&gt;, &lt;em&gt;current value&lt;&#x2F;em&gt; and &lt;em&gt;new value&lt;&#x2F;em&gt; are
defined in EIP-1283.&lt;&#x2F;p&gt;
&lt;p&gt;Replace &lt;code&gt;SSTORE&lt;&#x2F;code&gt; opcode gas cost calculation (including refunds) with
the following logic:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If &lt;em&gt;gasleft&lt;&#x2F;em&gt; is less than or equal to gas stipend, fail the current
call frame with &#x27;out of gas&#x27; exception.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;em&gt;current value&lt;&#x2F;em&gt; equals &lt;em&gt;new value&lt;&#x2F;em&gt; (this is a no-op), &lt;code&gt;SLOAD_GAS&lt;&#x2F;code&gt;
is deducted.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;em&gt;current value&lt;&#x2F;em&gt; does not equal &lt;em&gt;new value&lt;&#x2F;em&gt;
&lt;ul&gt;
&lt;li&gt;If &lt;em&gt;original value&lt;&#x2F;em&gt; equals &lt;em&gt;current value&lt;&#x2F;em&gt; (this storage slot has
not been changed by the current execution context)
&lt;ul&gt;
&lt;li&gt;If &lt;em&gt;original value&lt;&#x2F;em&gt; is 0, &lt;code&gt;SSTORE_SET_GAS&lt;&#x2F;code&gt; is deducted.&lt;&#x2F;li&gt;
&lt;li&gt;Otherwise, &lt;code&gt;SSTORE_RESET_GAS&lt;&#x2F;code&gt; gas is deducted. If &lt;em&gt;new value&lt;&#x2F;em&gt; is
0, add &lt;code&gt;SSTORE_CLEARS_SCHEDULE&lt;&#x2F;code&gt; gas to refund counter.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;em&gt;original value&lt;&#x2F;em&gt; does not equal &lt;em&gt;current value&lt;&#x2F;em&gt; (this storage
slot is dirty), &lt;code&gt;SLOAD_GAS&lt;&#x2F;code&gt; gas is deducted. Apply both of the
following clauses.
&lt;ul&gt;
&lt;li&gt;If &lt;em&gt;original value&lt;&#x2F;em&gt; is not 0
&lt;ul&gt;
&lt;li&gt;If &lt;em&gt;current value&lt;&#x2F;em&gt; is 0 (also means that &lt;em&gt;new value&lt;&#x2F;em&gt; is not
0), remove &lt;code&gt;SSTORE_CLEARS_SCHEDULE&lt;&#x2F;code&gt; gas from refund
counter.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;em&gt;new value&lt;&#x2F;em&gt; is 0 (also means that &lt;em&gt;current value&lt;&#x2F;em&gt; is not
0), add &lt;code&gt;SSTORE_CLEARS_SCHEDULE&lt;&#x2F;code&gt; gas to refund counter.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;em&gt;original value&lt;&#x2F;em&gt; equals &lt;em&gt;new value&lt;&#x2F;em&gt; (this storage slot is
reset)
&lt;ul&gt;
&lt;li&gt;If &lt;em&gt;original value&lt;&#x2F;em&gt; is 0, add &lt;code&gt;SSTORE_SET_GAS - SLOAD_GAS&lt;&#x2F;code&gt; to
refund counter.&lt;&#x2F;li&gt;
&lt;li&gt;Otherwise, add &lt;code&gt;SSTORE_RESET_GAS - SLOAD_GAS&lt;&#x2F;code&gt; gas to refund
counter.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;An implementation should also note that with the above definition, if
the implementation uses call-frame refund counter, the counter can go
negative. If the implementation uses transaction-wise refund counter,
the counter always stays positive.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP mostly achieves what a transient storage tries to do
(&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1087&#x2F;&quot;&gt;EIP-1087&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1153&#x2F;&quot;&gt;EIP-1153&lt;&#x2F;a&gt;), but without the complexity of introducing the
concept of &quot;dirty maps&quot;, or an extra storage struct.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;We don&#x27;t suffer from the optimization limitation of
EIP-1087. EIP-1087 requires keeping a dirty map for storage changes,
and implicitly makes the assumption that a transaction&#x27;s storage
changes are committed to the storage trie at the end of a
transaction. This works well for some implementations, but not for
others. After &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;658&#x2F;&quot;&gt;EIP-658&lt;&#x2F;a&gt;, an efficient storage cache implementation
would probably use an in-memory trie (without RLP encoding&#x2F;decoding)
or other immutable data structures to keep track of storage changes,
and only commit changes at the end of a block. For them, it is
possible to know a storage&#x27;s original value and current value, but
it is not possible to iterate over all storage changes without
incurring additional memory or processing costs.&lt;&#x2F;li&gt;
&lt;li&gt;It never costs more gas compared with the current scheme.&lt;&#x2F;li&gt;
&lt;li&gt;It covers all usages for a transient storage. Clients that are easy
to implement EIP-1087 will also be easy to implement this
specification. Some other clients might require a little bit extra
refactoring on this. Nonetheless, no extra memory or processing cost
is needed on runtime.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Regarding &lt;code&gt;SSTORE&lt;&#x2F;code&gt; gas cost and refunds, see Appendix for proofs of
properties that this EIP satisfies.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;For &lt;em&gt;absolute gas used&lt;&#x2F;em&gt; (that is, actual &lt;em&gt;gas used&lt;&#x2F;em&gt; minus &lt;em&gt;refund&lt;&#x2F;em&gt;),
this EIP is equivalent to EIP-1087 for all cases.&lt;&#x2F;li&gt;
&lt;li&gt;For one particular case, where a storage slot is changed, reset to
its original value, and then changed again, EIP-1283 would move more
gases to refund counter compared with EIP-1087.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Examine examples provided in EIP-1087&#x27;s Motivation (with &lt;code&gt;SLOAD_GAS&lt;&#x2F;code&gt; being
&lt;code&gt;200&lt;&#x2F;code&gt;):&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If a contract with empty storage sets slot 0 to 1, then back to 0,
it will be charged &lt;code&gt;20000 + 200 - 19800 = 400&lt;&#x2F;code&gt; gas.&lt;&#x2F;li&gt;
&lt;li&gt;A contract with empty storage that increments slot 0 5 times will be
charged &lt;code&gt;20000 + 5 * 200 = 21000&lt;&#x2F;code&gt; gas.&lt;&#x2F;li&gt;
&lt;li&gt;A balance transfer from account A to account B followed by a
transfer from B to C, with all accounts having nonzero starting and
ending balances, it will cost &lt;code&gt;5000 * 3 + 200 - 4800 = 10400&lt;&#x2F;code&gt; gas.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In order to keep in place the implicit reentrancy protection of
existing contracts, transactions should not be allowed to modify state
if the remaining gas is lower than the gas stipend given to
&quot;transfer&quot;&#x2F;&quot;send&quot; in Solidity. These are other proposed remediations
and objections to implementing them:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Drop EIP-1283 and abstain from modifying &lt;code&gt;SSTORE&lt;&#x2F;code&gt; cost
&lt;ul&gt;
&lt;li&gt;EIP-1283 is an important update&lt;&#x2F;li&gt;
&lt;li&gt;It was accepted and implemented on test networks and in clients.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Add a new call context that permits LOG opcodes but not changes to state.
&lt;ul&gt;
&lt;li&gt;Adds another call type beyond existing regular&#x2F;staticcall&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Raise the cost of &lt;code&gt;SSTORE&lt;&#x2F;code&gt; to dirty slots to &amp;gt;=2300 gas
&lt;ul&gt;
&lt;li&gt;Makes net gas metering much less useful.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Reduce the gas stipend
&lt;ul&gt;
&lt;li&gt;Makes the stipend almost useless.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Increase the cost of writes to dirty slots back to 5000 gas, but add
4800 gas to the refund counter
&lt;ul&gt;
&lt;li&gt;Still doesn’t make the invariant explicit.&lt;&#x2F;li&gt;
&lt;li&gt;Requires callers to supply more gas, just to have it refunded&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Add contract metadata specifying per-contract EVM version, and only
apply &lt;code&gt;SSTORE&lt;&#x2F;code&gt; changes to contracts deployed with the new version.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP requires a hard fork to implement. No gas cost increase is
anticipated, and many contracts will see gas reduction.&lt;&#x2F;p&gt;
&lt;p&gt;Performing &lt;code&gt;SSTORE&lt;&#x2F;code&gt; has never been possible with less than 5000 gas, so
it does not introduce incompatibility to the Ethereum Mainnet. Gas
estimation should account for this requirement.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Code&lt;&#x2F;th&gt;&lt;th&gt;Used Gas&lt;&#x2F;th&gt;&lt;th&gt;Refund&lt;&#x2F;th&gt;&lt;th&gt;Original&lt;&#x2F;th&gt;&lt;th&gt;1st&lt;&#x2F;th&gt;&lt;th&gt;2nd&lt;&#x2F;th&gt;&lt;th&gt;3rd&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;1612&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;20812&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;20812&lt;&#x2F;td&gt;&lt;td&gt;19200&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556002600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;20812&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;20812&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;5812&lt;&#x2F;td&gt;&lt;td&gt;15000&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;5812&lt;&#x2F;td&gt;&lt;td&gt;4200&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556002600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;5812&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60026000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;5812&lt;&#x2F;td&gt;&lt;td&gt;15000&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60026000556003600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;5812&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60026000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;5812&lt;&#x2F;td&gt;&lt;td&gt;4200&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60026000556002600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;5812&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;5812&lt;&#x2F;td&gt;&lt;td&gt;15000&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556002600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;5812&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;1612&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x600160005560006000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;40818&lt;&#x2F;td&gt;&lt;td&gt;19200&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x600060005560016000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;10818&lt;&#x2F;td&gt;&lt;td&gt;19200&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;To be added.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;appendix-proof&quot;&gt;Appendix: Proof&lt;&#x2F;h2&gt;
&lt;p&gt;Because the &lt;em&gt;storage slot&#x27;s original value&lt;&#x2F;em&gt; is defined as the value
when a reversion happens on the &lt;em&gt;current transaction&lt;&#x2F;em&gt;, it&#x27;s easy to
see that call frames won&#x27;t interfere &lt;code&gt;SSTORE&lt;&#x2F;code&gt; gas calculation. So
although the below proof is discussed without call frames, it applies
to all situations with call frames. We will discuss the case
separately for &lt;em&gt;original value&lt;&#x2F;em&gt; being zero and not zero, and use
&lt;em&gt;induction&lt;&#x2F;em&gt; to prove some properties of &lt;code&gt;SSTORE&lt;&#x2F;code&gt; gas cost.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Final value&lt;&#x2F;em&gt; is the value of a particular storage slot at the end of
a transaction. &lt;em&gt;Absolute gas used&lt;&#x2F;em&gt; is the absolute value of &lt;em&gt;gas used&lt;&#x2F;em&gt;
minus &lt;em&gt;refund&lt;&#x2F;em&gt;. We use &lt;code&gt;N&lt;&#x2F;code&gt; to represent the total number of &lt;code&gt;SSTORE&lt;&#x2F;code&gt;
operations on a storage slot. For states discussed below, refer to
&lt;em&gt;State Transition&lt;&#x2F;em&gt; in &lt;em&gt;Explanation&lt;&#x2F;em&gt; section.&lt;&#x2F;p&gt;
&lt;p&gt;Below we do the proof under the assumption that all parameters are
unchanged, meaning &lt;code&gt;SLOAD_GAS&lt;&#x2F;code&gt; is &lt;code&gt;200&lt;&#x2F;code&gt;. However, note that the proof
still applies no matter how &lt;code&gt;SLOAD_GAS&lt;&#x2F;code&gt; is changed.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;original-value-being-zero&quot;&gt;Original Value Being Zero&lt;&#x2F;h3&gt;
&lt;p&gt;When &lt;em&gt;original value&lt;&#x2F;em&gt; is 0, we want to prove that:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Case I&lt;&#x2F;strong&gt;: If the &lt;em&gt;final value&lt;&#x2F;em&gt; ends up still being 0, we want to charge &lt;code&gt;200 * N&lt;&#x2F;code&gt; gases, because no disk write is needed.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Case II&lt;&#x2F;strong&gt;: If the &lt;em&gt;final value&lt;&#x2F;em&gt; ends up being a non-zero value, we want to
charge &lt;code&gt;20000 + 200 * (N-1)&lt;&#x2F;code&gt; gas, because it requires writing this
slot to disk.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;base-case&quot;&gt;Base Case&lt;&#x2F;h4&gt;
&lt;p&gt;We always start at state A. The first &lt;code&gt;SSTORE&lt;&#x2F;code&gt; can:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Go to state A: 200 gas is deducted. We satisfy &lt;em&gt;Case I&lt;&#x2F;em&gt; because
&lt;code&gt;200 * N == 200 * 1&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Go to state B: 20000 gas is deducted. We satisfy &lt;em&gt;Case II&lt;&#x2F;em&gt; because
&lt;code&gt;20000 + 200 * (N-1) == 20000 + 200 * 0&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;inductive-step&quot;&gt;Inductive Step&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;From A to A. The previous gas cost is &lt;code&gt;200 * (N-1)&lt;&#x2F;code&gt;. The current
gas cost is &lt;code&gt;200 + 200 * (N-1)&lt;&#x2F;code&gt;. It satisfy &lt;em&gt;Case I&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;From A to B. The previous gas cost is &lt;code&gt;200 * (N-1)&lt;&#x2F;code&gt;. The current
gas cost is &lt;code&gt;20000 + 200 * (N-1)&lt;&#x2F;code&gt;. It satisfy &lt;em&gt;Case II&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;From B to B. The previous gas cost is &lt;code&gt;20000 + 200 * (N-2)&lt;&#x2F;code&gt;. The
current gas cost is &lt;code&gt;200 + 20000 + 200 * (N-2)&lt;&#x2F;code&gt;. It satisfy
&lt;em&gt;Case II&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;From B to A. The previous gas cost is &lt;code&gt;20000 + 200 * (N-2)&lt;&#x2F;code&gt;. The
current gas cost is &lt;code&gt;200 - 19800 + 20000 + 200 * (N-2)&lt;&#x2F;code&gt;. It satisfy
&lt;em&gt;Case I&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;original-value-not-being-zero&quot;&gt;Original Value Not Being Zero&lt;&#x2F;h3&gt;
&lt;p&gt;When &lt;em&gt;original value&lt;&#x2F;em&gt; is not 0, we want to prove that:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Case I&lt;&#x2F;strong&gt;: If the &lt;em&gt;final value&lt;&#x2F;em&gt; ends up unchanged, we want to
charge &lt;code&gt;200 * N&lt;&#x2F;code&gt; gases, because no disk write is needed.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Case II&lt;&#x2F;strong&gt;: If the &lt;em&gt;final value&lt;&#x2F;em&gt; ends up being zero, we want to
charge &lt;code&gt;5000 - 15000 + 200 * (N-1)&lt;&#x2F;code&gt; gas. Note that &lt;code&gt;15000&lt;&#x2F;code&gt; is the
refund in actual definition.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Case III&lt;&#x2F;strong&gt;: If the &lt;em&gt;final value&lt;&#x2F;em&gt; ends up being a changed non-zero
value, we want to charge &lt;code&gt;5000 + 200 * (N-1)&lt;&#x2F;code&gt; gas.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;base-case-1&quot;&gt;Base Case&lt;&#x2F;h4&gt;
&lt;p&gt;We always start at state X. The first &lt;code&gt;SSTORE&lt;&#x2F;code&gt; can:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Go to state X: 200 gas is deducted. We satisfy &lt;em&gt;Case I&lt;&#x2F;em&gt; because
&lt;code&gt;200 * N == 200 * 1&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Go to state Y: 5000 gas is deducted. We satisfy &lt;em&gt;Case III&lt;&#x2F;em&gt; because
&lt;code&gt;5000 + 200 * (N-1) == 5000 + 200 * 0&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Go to state Z: The absolute gas used is &lt;code&gt;5000 - 15000&lt;&#x2F;code&gt; where 15000
is the refund. We satisfy &lt;em&gt;Case II&lt;&#x2F;em&gt; because &lt;code&gt;5000 - 15000 + 200 * (N-1) == 5000 - 15000 + 200 * 0&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;inductive-step-1&quot;&gt;Inductive Step&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;From X to X. The previous gas cost is &lt;code&gt;200 * (N-1)&lt;&#x2F;code&gt;. The current gas
cost is &lt;code&gt;200 + 200 * (N-1)&lt;&#x2F;code&gt;. It satisfy &lt;em&gt;Case I&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;From X to Y. The previous gas cost is &lt;code&gt;200 * (N-1)&lt;&#x2F;code&gt;. The current gas
cost is &lt;code&gt;5000 + 200 * (N-1)&lt;&#x2F;code&gt;. It satisfy &lt;em&gt;Case III&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;From X to Z. The previous gas cost is &lt;code&gt;200 * (N-1)&lt;&#x2F;code&gt;. The current
absolute gas cost is &lt;code&gt;5000 - 15000 + 200 * (N-1)&lt;&#x2F;code&gt;. It satisfy &lt;em&gt;Case
II&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;From Y to X. The previous gas cost is &lt;code&gt;5000 + 200 * (N-2)&lt;&#x2F;code&gt;. The
absolute current gas cost is &lt;code&gt;200 - 4800 + 5000 + 200 * (N-2)&lt;&#x2F;code&gt;. It
satisfy &lt;em&gt;Case I&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;From Y to Y. The previous gas cost is &lt;code&gt;5000 + 200 * (N-2)&lt;&#x2F;code&gt;. The
current gas cost is &lt;code&gt;200 + 5000 + 200 * (N-2)&lt;&#x2F;code&gt;. It satisfy &lt;em&gt;Case
III&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;From Y to Z. The previous gas cost is &lt;code&gt;5000 + 200 * (N-2)&lt;&#x2F;code&gt;. The
current absolute gas cost is &lt;code&gt;200 - 15000 + 5000 + 200 * (N-2)&lt;&#x2F;code&gt;. It
satisfy &lt;em&gt;Case II&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;From Z to X. The previous gas cost is &lt;code&gt;5000 - 15000 + 200 * (N-2)&lt;&#x2F;code&gt;. The current absolute gas cost is &lt;code&gt;200 + 10200 + 5000 - 15000 + 200 * (N-2)&lt;&#x2F;code&gt;. It satisfy &lt;em&gt;Case I&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;From Z to Y. The previous gas cost is &lt;code&gt;5000 - 15000 + 200 * (N-2)&lt;&#x2F;code&gt;. The current absolute gas cost is &lt;code&gt;200 + 15000 + 5000 - 15000 + 200 * (N-2)&lt;&#x2F;code&gt;. It satisfy &lt;em&gt;Case III&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;From Z to Z. The previous gas cost is &lt;code&gt;5000 - 15000 + 200 * (N-2)&lt;&#x2F;code&gt;. The current absolute gas cost is &lt;code&gt;200 + 5000 - 15000 + 200 * (N-2)&lt;&#x2F;code&gt;. It satisfy &lt;em&gt;Case II&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>dType Alias Extension - Decentralized Type System</title>
        <published>2019-07-16T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Loredana Cirstea</name><uri>https://github.com/loredanacirstea</uri>
	</author>
	
	<author>
		<name>Christian Tzurcanu</name><uri>https://github.com/ctzurcanu</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2193/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/2192" />
        

        <id>https://wg-eips.ritovision.com/2193/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2193"
            label="ERC-2193" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2193/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;We are proposing Alias - a semantic standard for identifying on-chain resources by human-readable qualifiers, supporting any type of data.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The dType Alias is a system for providing human-readable resource identifiers to on-chain content. A resource identifier is based on the type of data (identifier provided by dType, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1900&#x2F;&quot;&gt;EIP-1900&lt;&#x2F;a&gt;) and the data content (identifier provided by a dType Storage Contract, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2157&#x2F;&quot;&gt;EIP-2157&lt;&#x2F;a&gt;). It is a universal way of addressing content, supporting any type of data.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;There are standards that currently address the need for attaching human-readable identifiers to Ethereum accounts, such as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;137&#x2F;&quot;&gt;EIP-137&lt;&#x2F;a&gt;. These standards are an attempt to bring domain names to Ethereum, following the same format as DNS: &lt;code&gt;subdomain.domain.tld&lt;&#x2F;code&gt;. This leaf -&amp;gt; root format is unintuitive and contradicts the semantic meaning that &lt;code&gt;.&lt;&#x2F;code&gt; has in programming languages, which is a root -&amp;gt; leaf connection (e.g. in OOP, when accessing an object&#x27;s property). A more intuitive and widely used approach is a root-&amp;gt;leaf format, used in file browsers, hierarchical menus, and even in other decentralized systems, which give unique identifiers to resources (e.g. &lt;code&gt;0x56.Currency.TCoin&lt;&#x2F;code&gt; in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;medium.com&#x2F;r&#x2F;?url=https%3A%2F%2Fdevelopers.libra.org&quot;&gt;Libra&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Moreover, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;137&#x2F;&quot;&gt;EIP-137&lt;&#x2F;a&gt; is not flexible enough to address smart contract content,  which can contain heterogeneous data that belongs to various accounts. For example, a &lt;code&gt;PaymentChannel&lt;&#x2F;code&gt; smart contract can have an domain name. However, the &lt;code&gt;Alice-Bob&lt;&#x2F;code&gt; channel data from inside the smart contract, cannot have a subdomain name. Having uniquely identified, granular resources opens the way to creating both human and machine-readable protocols on top of Ethereum. It also provides a basis for protocols based on functional programming.&lt;&#x2F;p&gt;
&lt;p&gt;This ERC proposes a set of separators which maintain their semantic meaning and provides a way to address any type of resource - from Ethereum addresses, to individual &lt;code&gt;struct&lt;&#x2F;code&gt; instances inside smart contracts.&lt;&#x2F;p&gt;
&lt;p&gt;Imagine the following dType types: &lt;code&gt;SocialNetwork&lt;&#x2F;code&gt; and &lt;code&gt;Profile&lt;&#x2F;code&gt;, with related storage data about user profiles. One could access such a profile using an alias for the data content: &lt;code&gt;alice@socialnetwork.profile&lt;&#x2F;code&gt;. For a &lt;code&gt;PaymentChannel&lt;&#x2F;code&gt; type, Alice can refer to her channel with Bob with &lt;code&gt;alice-bob.paymentchannel&lt;&#x2F;code&gt;.
This alias system can be used off-chain, to replace the old DNS system with a deterministic and machine-readable way of displaying content, based on the dType type&#x27;s metadata.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The dType registry will provide domain and subdomain names for the resource type. Subdomains can be attributed recursively, to dType types which contain other complex types in their composition.&lt;&#x2F;p&gt;
&lt;p&gt;We define an &lt;code&gt;Alias&lt;&#x2F;code&gt; registry contract, that keeps track of the human-readable identifiers for data resources, which exist in dType storage contracts.
Anyone can set an alias in the &lt;code&gt;Alias&lt;&#x2F;code&gt; registry, as long as the Ethereum address that signs the alias data has ownership on the resource, in the dType storage contract. Storage contract data ownership will be detailed in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2157&#x2F;&quot;&gt;EIP-2157&lt;&#x2F;a&gt;. An owner can update or delete an alias at any time.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Alias&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AliasSet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; dtypeIdentifier&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes1&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; separator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; identifier&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setAlias&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; dtypeIdentifier&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes1&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; separator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; identifier&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getAliased&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes1&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; separator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; identifier&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;dtypeIdentifier&lt;&#x2F;code&gt;: Type identifier from the dType registry, needed to ensure uniqueness of &lt;code&gt;name&lt;&#x2F;code&gt; for a dType type. &lt;code&gt;dtypeIdentifier&lt;&#x2F;code&gt; is checked to see if it exists in the dType registry. The dType registry also links the type&#x27;s data storage contract, where the existence and ownership of the &lt;code&gt;identifier&lt;&#x2F;code&gt; is checked.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;name&lt;&#x2F;code&gt;: user-defined human-readable name for the resource referenced by &lt;code&gt;identifier&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;separator&lt;&#x2F;code&gt;: Character acting as a separator between the name and the rest of the alias. Allowed values:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;.&lt;&#x2F;code&gt;: general domain separation, using root-&amp;gt;leaf semantics. E.g. &lt;code&gt;domain.subdomain.leafsubdomain.resource&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;@&lt;&#x2F;code&gt;: identifying actor-related data, such as user profiles, using leaf-&amp;gt;root semantics. E.g. &lt;code&gt;alice@socialnetwork.profile&lt;&#x2F;code&gt; or &lt;code&gt;alice@dao@eth&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;#&lt;&#x2F;code&gt;: identifying concepts, using root-&amp;gt;leaf semantics. E.g. &lt;code&gt;topicX#postY&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;&#x2F;&lt;&#x2F;code&gt;: general resource path definition, using root-&amp;gt;leaf semantics. E.g. &lt;code&gt;resourceRoot&#x2F;resource&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;identifier&lt;&#x2F;code&gt;: Resource identifier from a smart contract linked with dType&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;signature&lt;&#x2F;code&gt;: Alias owner signature on &lt;code&gt;dtypeIdentifier&lt;&#x2F;code&gt;, &lt;code&gt;identifier&lt;&#x2F;code&gt;, &lt;code&gt;name&lt;&#x2F;code&gt;, &lt;code&gt;separator&lt;&#x2F;code&gt;, &lt;code&gt;nonce&lt;&#x2F;code&gt;, &lt;code&gt;aliasAddress&lt;&#x2F;code&gt;, &lt;code&gt;chainId&lt;&#x2F;code&gt;.
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;nonce&lt;&#x2F;code&gt;: monotonically increasing counter, used to prevent replay attacks&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;aliasAddress&lt;&#x2F;code&gt;: Ethereum address of &lt;code&gt;Alias&lt;&#x2F;code&gt; contract&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;chainId&lt;&#x2F;code&gt;: chain on which the &lt;code&gt;Alias&lt;&#x2F;code&gt; contract is deployed, as detailed in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt;, used to prevent replay attacks when updating the &lt;code&gt;identifier&lt;&#x2F;code&gt; for an alias.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Content addressability can be done:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;using the &lt;code&gt;bytes32&lt;&#x2F;code&gt; identifiers directly, e.g. &lt;code&gt;0x0b5e76559822448f6243a6f76ac7864eba89c810084471bdee2a63429c92d2e7@0x9dbb9abe0c47484c5707699b3ceea23b1c2cca2ac72681256ab42ae01bd347da&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;using the human identifiers, e.g. &lt;code&gt;alice@socialnetwork&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Both of the above examples will resolve to the same content.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Current attempts to solve content addressability, such as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;137&#x2F;&quot;&gt;EIP-137&lt;&#x2F;a&gt;, only target Ethereum accounts. These are based on inherited concepts from HTTP and DNS, which are not machine friendly.&lt;&#x2F;p&gt;
&lt;p&gt;With &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1900&#x2F;&quot;&gt;EIP-1900&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2157&#x2F;&quot;&gt;EIP-2157&lt;&#x2F;a&gt;, general content addressability can be achieved. dType provides type information and a reference to the smart contract where the type instances are stored. Additionally, Alias uses the semantic meaning of subdomain separators to have a &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;loredanacirstea&#x2F;articles&#x2F;blob&#x2F;master&#x2F;articles&#x2F;Flexible_Alias_or_Why_ENS_is_Obsolete.md&quot;&gt;intuitive order rule&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Multiple aliases can be assigned to a single resource. Either by using a different &lt;code&gt;name&lt;&#x2F;code&gt; or by using a different &lt;code&gt;separator&lt;&#x2F;code&gt;. Each &lt;code&gt;separator&lt;&#x2F;code&gt; can have a specific standard for displaying and processing data, based on its semantic meaning.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Will be added.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Will be added.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;An in-work implementation can be found at https:&#x2F;&#x2F;github.com&#x2F;pipeos-one&#x2F;dType&#x2F;blob&#x2F;master&#x2F;contracts&#x2F;contracts&#x2F;Alias.sol.
This proposal will be updated with an appropriate implementation when consensus is reached on the specifications.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Common Prometheus Metrics Names for Clients</title>
        <published>2019-07-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Adrian Sutton</name><uri>https://github.com/ajsutton</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2159/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/common-chain-metrics/3415" />
        

        <id>https://wg-eips.ritovision.com/2159/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="interface"
                label="Interface" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:2159"
            label="EIP-2159" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2159/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Standardized names of common metrics for Ethereum clients to use with Prometheus, a widely used monitoring and alerting solution.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Many Ethereum clients expose a range of metrics in a format compatible with Prometheus to allow operators to monitor the client&#x27;s behaviour and performance and raise alerts if the chain isn&#x27;t progressing or there are other indications of errors.
While the majority of these metrics are highly client-specific, reporting on internal implementation details of the client, some are applicable to all clients.
By standardizing the naming and format of these common metrics, operators are able to monitor the operation of multiple clients in a single dashboard or alerting configuration.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Using common names and meanings for metrics which apply to all clients allows node operators to monitor clusters of nodes using heterogeneous clients using a single dashboard and alerting configuration.
Currently there are no agreed names or meanings, leaving client developers to invent their own making it difficult to monitor a heterogeneous cluster.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The table below defines metrics which may be captured by Ethereum clients which expose metrics to Prometheus. Clients may expose additional metrics however these should not use the &lt;code&gt;ethereum_&lt;&#x2F;code&gt; prefix.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Metric type&lt;&#x2F;th&gt;&lt;th&gt;Definition&lt;&#x2F;th&gt;&lt;th&gt;JSON-RPC Equivalent&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;ethereum_blockchain_height&lt;&#x2F;td&gt;&lt;td&gt;Gauge&lt;&#x2F;td&gt;&lt;td&gt;The current height of the canonical chain&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;eth_blockNumber&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;ethereum_best_known_block_number&lt;&#x2F;td&gt;&lt;td&gt;Gauge&lt;&#x2F;td&gt;&lt;td&gt;The estimated highest block available&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;highestBlock&lt;&#x2F;code&gt; of &lt;code&gt;eth_syncing&lt;&#x2F;code&gt; or &lt;code&gt;eth_blockNumber&lt;&#x2F;code&gt; if not syncing&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;ethereum_peer_count&lt;&#x2F;td&gt;&lt;td&gt;Gauge&lt;&#x2F;td&gt;&lt;td&gt;The current number of peers connected&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;net_peerCount&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;ethereum_peer_limit&lt;&#x2F;td&gt;&lt;td&gt;Gauge&lt;&#x2F;td&gt;&lt;td&gt;The maximum number of peers this node allows to connect&lt;&#x2F;td&gt;&lt;td&gt;No equivalent&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Note that &lt;code&gt;ethereum_best_known_block_number&lt;&#x2F;code&gt; always has a value. When the &lt;code&gt;eth_syncing&lt;&#x2F;code&gt; JSON-RPC method would return &lt;code&gt;false&lt;&#x2F;code&gt;, the current chain height is used.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The defined metrics are independent of Ethereum client implementation but provide sufficient information to create an overview dashboard to support monitoring a group of Ethereum nodes.&lt;&#x2F;p&gt;
&lt;p&gt;There is a similar, though more prescriptive, specification for beacon chain client metrics.
The specific details of how to expose the metrics has been omitted as there is variance in existing implementations and standardising this does not provide any significant benefit.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This is &lt;em&gt;not&lt;&#x2F;em&gt; a consensus affecting change.&lt;&#x2F;p&gt;
&lt;p&gt;Clients may already be publishing these metrics using different names and changing to the new form may break existing alerts or dashboards. Clients that want to avoid this incompatibility can expose the metrics under both the old and new names.&lt;&#x2F;p&gt;
&lt;p&gt;Clients may also be publishing metrics with a different meaning using these names. Backwards compatibility cannot be preserved in this case.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Pantheon switched to using these standard metric names in its 1.2 release: https:&#x2F;&#x2F;github.com&#x2F;PegaSysEng&#x2F;pantheon&#x2F;pull&#x2F;1634.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;Prometheus. https:&#x2F;&#x2F;prometheus.io&lt;&#x2F;li&gt;
&lt;li&gt;Beacon chain metrics specification. https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;eth2.0-metrics&#x2F;blob&#x2F;master&#x2F;metrics.md&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>dType Storage Extension - Decentralized Type System for EVM</title>
        <published>2019-06-28T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Loredana Cirstea</name><uri>https://github.com/loredanacirstea</uri>
	</author>
	
	<author>
		<name>Christian Tzurcanu</name><uri>https://github.com/ctzurcanu</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2157/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/2157" />
        

        <id>https://wg-eips.ritovision.com/2157/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:2157"
            label="ERC-2157" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2157/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC is an extension of ERC-1900, proposing an optional storage extension for dType, a decentralized type system, specifying a general ABI for all storage contracts that contain type instances.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The storage extension will enable easy navigation and retrieval of type data that is intended to be of public use. This is possible through standardizing the ABI of the dType storage contracts, with the effect of having a deterministic path to a type instance record. This standardization enables a more effective on-chain and off-chain use of data and opens up possibilities for decentralized applications, enabling developers to build on top of public global data.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, Ethereum does not have standardization of data addressability. This might not be needed for data that is meant to be quasi-private, however, it is needed for data that is meant for public consumption. ERC-1900 has started standardizing data types for increasing interoperability between projects, but this is not enough if we want to build a global ecosystem. Deterministic data addressability will enable anyone to build upon the same public data sets, off-chain or on-chain.&lt;&#x2F;p&gt;
&lt;p&gt;It is true that with ERC-1900, blockchain data analysis and type-specific data retrieval will be possible off-chain, but this implies relying on centralized data caches (blockchain explorers) or maintaining your own data cache. Moreover, this option does not allow on-chain standardization on data retrieval paths, therefore limiting the type of on-chain interoperable operations that can be done.&lt;&#x2F;p&gt;
&lt;p&gt;Having a clear way of retrieving data, instead of analyzing the blockchain for contracts that have a certain type in their ABI or bytecode, will make development easier and more decentralized for applications that target global data on specific types.&lt;&#x2F;p&gt;
&lt;p&gt;For example, a decentralized market place can be built on top of some marketplace-specific types, and by knowing exactly where the type data is stored, it is easy to create custom algorithms that provide the user with the product information they seek. Everyone has access to the data and the data path is standardized.&lt;&#x2F;p&gt;
&lt;p&gt;Moreover, by standardizing storage contract interfaces, ABI inference is possible. The common interface, together with the dType registry will provide all the data needed to reconstruct the ABI.&lt;&#x2F;p&gt;
&lt;p&gt;This system can be extended with access and mutability control later on, in a future proposal. Access and mutability control will be necessary for public-use global systems. Moreover, we can have a homogeneous application of permissions across system components. This is not detailed in the present proposal.&lt;&#x2F;p&gt;
&lt;p&gt;Another use case is data bridges between Ethereum shards or between Ethereum and other chains. Data syncing between shards&#x2F;chains can be done programmatically, across data types (from various projects). Imagine a user having a public profile&#x2F;identity contract on one chain, wishing to move that profile on Ethereum. By supporting the origin chain types and having a standardized storage mechanism, data moving processes will be the same.&lt;&#x2F;p&gt;
&lt;p&gt;This pattern of separating data type definitions and storage allows developers to create functional programming-like patterns on Ethereum, even though languages such as Solidity are not functional.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;typerootcontract&quot;&gt;TypeRootContract&lt;&#x2F;h3&gt;
&lt;p&gt;ERC-1900 defines a &lt;code&gt;contractAddress&lt;&#x2F;code&gt; field in the type metadata. For the limited purpose of ERC-1900, this field contains the value of the Ethereum type library in which the type definition exists. For the purpose of this ERC, the &lt;code&gt;contractAddress&lt;&#x2F;code&gt; will contain the Etherereum address of a &lt;code&gt;TypeRootContract&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TypeRootContract&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; libraryAddress&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; storageAddress&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _library&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _storage&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    libraryAddress &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _library&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    storageAddress &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _storage&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;libraryAddress&lt;&#x2F;code&gt; - Ethereum address of the type definition library, from ERC-1900&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;storageAddress&lt;&#x2F;code&gt; - Ethereum address of the type data storage contract&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;typestoragecontract&quot;&gt;TypeStorageContract&lt;&#x2F;h3&gt;
&lt;p&gt;This contract will use the type library to define the internal data stored in it. Each record will be a type instance, addressable by a primary identifier. The primary identifier is calculated by the type library&#x27;s &lt;code&gt;getIdentifier&lt;&#x2F;code&gt; function, based on the type instance values.&lt;&#x2F;p&gt;
&lt;p&gt;We propose a Solidity CRUD pattern, as described in https:&#x2F;&#x2F;medium.com&#x2F;robhitchens&#x2F;solidity-crud-part-1-824ffa69509a, where records can also be retrieved using their index - a monotonically increasing counter.&lt;&#x2F;p&gt;
&lt;p&gt;An stub implementation for the TypeStorageContract would look like:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;#39;.&#x2F;TypeALib.sol&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TypeAStorage&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    using&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TypeALib&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TypeALib&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;TypeA&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; typeIndex&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Type&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; typeStruct&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Type&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        TypeALib&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;TypeA data&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; index&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; LogNew&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; identifier&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; LogUpdate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; identifier&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; LogRemove&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; identifier&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; insert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;TypeALib&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;TypeA&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; identifier&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; insertBytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; identifier&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; remove&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; identifier&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; update&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; identifier&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; TypeALib&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;TypeA&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; identifier&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isStored&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; identifier&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; stored&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getByHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; identifier&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;TypeALib&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;TypeA&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getByIndex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;TypeALib&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;TypeA&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; count&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; counter&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;We are now thinking about a building block as a smart contract with an encapsulated object that contains state changing functions that are only understood from within. This is more akin to Object-Oriented Programming and poses interoperability and scalability issues. Not necessarily for an individual project, but for a global Ethereum OS. This is why we are proposing to separate data from business logic and data structure definitions.&lt;&#x2F;p&gt;
&lt;p&gt;When you have public aggregated data, categorized on each type, anyone can build tools on top of it. This is a radical change from the closed or dispersed data patterns that we find in web2.&lt;&#x2F;p&gt;
&lt;p&gt;We have chosen to define a &lt;code&gt;TypeRootContract&lt;&#x2F;code&gt; instead of extending the dType registry with fields for the TypeStorage contract, because this approach enables easier interface updates in the future. It is more extensible.&lt;&#x2F;p&gt;
&lt;p&gt;The storage pattern used for dType itself and all the Type Storage contracts can be the same. This lowers the cost of building, testing and auditing the code.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;TypeStorageContract&lt;&#x2F;code&gt; pattern should ensure:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;type instance addressability by the primary identifier&lt;&#x2F;li&gt;
&lt;li&gt;a way to retrieve all records from the contract&lt;&#x2F;li&gt;
&lt;li&gt;counting the number of records&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal does not affect existent Ethereum standards or implementations. It uses the present experimental version of ABIEncoderV2.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Will be added.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;An in-work implementation can be found at https:&#x2F;&#x2F;github.com&#x2F;pipeos-one&#x2F;dType&#x2F;tree&#x2F;master&#x2F;contracts&#x2F;contracts.
This proposal will be updated with an appropriate implementation when consensus is reached on the specifications.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Consumable Interface (Tickets, etc)</title>
        <published>2019-06-23T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Zainan Victor Zhou</name><uri>https://github.com/xinbenlv</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2135/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2135-erc-consumable-interface/3439" />
        

        <id>https://wg-eips.ritovision.com/2135/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:2135"
            label="ERC-2135" />
        

        
        

        
        <summary type="html">An interface extending ERC-721 and ERC-1155 for consumability, supporting use case such as an event ticket.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2135/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP defines an interface to mark a digital asset as &quot;consumable&quot; and to react to its &quot;consumption.&quot;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Digital assets sometimes need to be consumed. One of the most common examples is a concert ticket.
It is &quot;consumed&quot; when the ticket-holder enters the concert hall.&lt;&#x2F;p&gt;
&lt;p&gt;Having a standard interface enables interoperability for services, clients, UI, and inter-contract functionalities on top of this use-case.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Any compliant contract &lt;strong&gt;MUST&lt;&#x2F;strong&gt; implement the following interface:&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; &amp;gt;=0.7.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0.9&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ERC-165 identifier of this interface is 0xdd691946&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC2135&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The consume function consumes a token every time it succeeds.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _consumer&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the address of consumer of this token. It doesn&amp;#39;t have&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                  to be the EOA or contract Account that initiates the TX.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _assetId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  the NFT asset being consumed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     extra data passed in for consume for extra message&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                  or future extension.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; consume&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _consumer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _assetId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The interface to check whether an asset is consumable.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _consumer&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the address of consumer of this token. It doesn&amp;#39;t have&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                  to be the EOA or contract Account that initiates the TX.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _assetId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  the NFT asset being consumed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   the amount of the asset being consumed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isConsumableBy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _consumer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _assetId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _consumable&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The event emitted when there is a successful consumption.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; consumer&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the address of consumer of this token. It doesn&amp;#39;t have&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                  to be the EOA or contract Account that initiates the TX.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; assetId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  the NFT asset being consumed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   the amount of the asset being consumed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     extra data passed in for consume for extra message&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                  or future extension.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OnConsumption&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; consumer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; assetId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ol start=&quot;2&quot;&gt;
&lt;li&gt;
&lt;p&gt;If the compliant contract is an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; token, in addition to &lt;code&gt;OnConsumption&lt;&#x2F;code&gt;, it &lt;strong&gt;MUST&lt;&#x2F;strong&gt; also emit the &lt;code&gt;Transfer&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;TransferSingle&lt;&#x2F;code&gt; event (as applicable) as if a token has been transferred from the current holder to the zero address if the call to &lt;code&gt;consume&lt;&#x2F;code&gt; method succeeds.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;supportsInterface(0xdd691946)&lt;&#x2F;code&gt; &lt;strong&gt;MUST&lt;&#x2F;strong&gt; return &lt;code&gt;true&lt;&#x2F;code&gt; for any compliant contract, as per &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;The function &lt;code&gt;consume&lt;&#x2F;code&gt; performs the consume action. This EIP does not assume:&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;ul&gt;
&lt;li&gt;who has the power to perform consumption&lt;&#x2F;li&gt;
&lt;li&gt;under what condition consumption can occur&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;It does, however, assume the asset can be identified in a &lt;code&gt;uint256&lt;&#x2F;code&gt; asset id as in the parameter. A design convention and compatibility consideration is put in place to follow the ERC-721 pattern.&lt;&#x2F;p&gt;
&lt;ol start=&quot;2&quot;&gt;
&lt;li&gt;
&lt;p&gt;The event notifies subscribers whoever are interested to learn an asset is being consumed.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;To keep it simple, this standard &lt;em&gt;intentionally&lt;&#x2F;em&gt; contains no functions or events related to the creation of a consumable asset. This is because the creation of a consumable asset will need to make assumptions about the nature of an actual use-case. If there are common use-cases for creation, another follow up standard can be created.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Metadata associated to the consumables is not included the standard. If necessary, related metadata can be created with a separate metadata extension interface like &lt;code&gt;ERC721Metadata&lt;&#x2F;code&gt; from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;We choose to include an &lt;code&gt;address consumer&lt;&#x2F;code&gt; for &lt;code&gt;consume&lt;&#x2F;code&gt; function and &lt;code&gt;isConsumableBy&lt;&#x2F;code&gt; so that an NFT MAY be consumed for someone other than the transaction initiator.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;We choose to include an extra &lt;code&gt;_data&lt;&#x2F;code&gt; field for future extension, such as
adding crypto endorsements.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;We explicitly stay opinion-less about whether ERC-721 or ERC-1155 shall be required because
while we design this EIP with ERC-721 and ERC-1155 in mind mostly, we don&#x27;t want to rule out
the potential future case someone use a different token standard or use it in different use cases.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The boolean view function of &lt;code&gt;isConsumableBy&lt;&#x2F;code&gt; can be used to check whether an asset is
consumable by the &lt;code&gt;_consumer&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This interface is designed to be compatible with ERC-721 and NFT of ERC-1155. It can be tweaked to used for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;777&#x2F;&quot;&gt;ERC-777&lt;&#x2F;a&gt; and Fungible Token of ERC-1155.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  describe&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Consumption&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    it&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Should consume when minted&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; async&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; fakeTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1234&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      const&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; addr1&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; loadFixture&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;deployFixture&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;safeMint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;addr1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; fakeTokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;addr1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;fakeTokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;addr1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isConsumableBy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;addr1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; fakeTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;be&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;consume&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;addr1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; fakeTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; receipt&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;wait&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; events&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; receipt&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;events&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;filter&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; any&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; x&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;OnConsumption&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;events&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;events&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;args&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;consumer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;addr1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;events&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;args&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;assetId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;fakeTokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;events&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;args&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;addr1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      await&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;fakeTokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        .&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;be&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;rejectedWith&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ERC721: invalid token ID&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      await&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isConsumableBy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;addr1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; fakeTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        .&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;be&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;rejectedWith&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ERC721: invalid token ID&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  describe&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;EIP-165 Identifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    it&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Should match&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; async&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      const&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; loadFixture&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;deployFixture&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;get165&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xdd691946&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      expect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xdd691946&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;be&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;A deployment of version 0x1002 has been deployed onto &lt;code&gt;goerli&lt;&#x2F;code&gt; testnet at address &lt;code&gt;0x3682bcD67b8A5c0257Ab163a226fBe07BF46379B&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Find the reference contract verified source code on Etherscan&#x27;s
&lt;code&gt;goerli&lt;&#x2F;code&gt; site for the address above.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Compliant contracts should pay attention to the balance change when a token is consumed.
When the contract is being paused, or the user is being restricted from transferring a token,
the consumeability should be consistent with the transferral restriction.&lt;&#x2F;p&gt;
&lt;p&gt;Compliant contracts should also carefully define access control, particularly whether any EOA or contract account may or may not initiate a &lt;code&gt;consume&lt;&#x2F;code&gt; method in their own use case.&lt;&#x2F;p&gt;
&lt;p&gt;Security audits and tests should be used to verify that the access control to the &lt;code&gt;consume&lt;&#x2F;code&gt;
function behaves as expected.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Particle gas costs for EVM opcodes</title>
        <published>2019-05-17T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Casey Detrio</name><uri>https://github.com/cdetrio</uri>
	</author>
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2045/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2045-fractional-gas-costs/3311" />
        

        <id>https://wg-eips.ritovision.com/2045/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:2045"
            label="EIP-2045" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2045/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;According to recent benchmarks, EVM opcodes for computation (&lt;code&gt;ADD&lt;&#x2F;code&gt;, &lt;code&gt;SUB&lt;&#x2F;code&gt;, &lt;code&gt;MUL&lt;&#x2F;code&gt;, etc.) are generally overpriced relative to opcodes for storage I&#x2F;O (&lt;code&gt;SLOAD&lt;&#x2F;code&gt;, &lt;code&gt;SSTORE&lt;&#x2F;code&gt;, etc.). Currently the minimum gas cost is 1 (i.e. one unit of gas), and most computational opcodes have a cost near to 1 (e.g. 3, 5, or 8), so the range in possible cost reduction is limited. A new minimum unit of gas, called a &quot;particle&quot;, which is a fraction of 1 gas, would expand the range of gas costs and thus enable reductions below the current minimum.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The transaction capacity of an Ethereum block is determined by the gas cost of transactions relative to the block gas limit. One way to boost the transaction capacity is to raise the block gas limit. Unfortunately, raising the block gas limit would also increase the rate of state growth, unless the costs of state-expanding storage opcodes (&lt;code&gt;SSTORE&lt;&#x2F;code&gt;, &lt;code&gt;CREATE&lt;&#x2F;code&gt;, etc.) are simultaneously increased to the same proportion. Increasing the cost of storage opcodes may have adverse side effects, such as shifting the economic assumptions around gas fees of deployed contracts, or possibly breaking invariants in current contract executions (as mentioned in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2035&#x2F;&quot;&gt;EIP-2035&lt;&#x2F;a&gt;&lt;sup&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2045&#x2F;#eip2035&quot;&gt;1&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;, more research is needed on the potential effects of increasing the cost of storage opcodes).&lt;&#x2F;p&gt;
&lt;p&gt;Another way to boost the transaction capacity of a block is to reduce the gas cost of transactions. Reducing the gas costs of computational opcodes while keeping the cost of storage opcodes the same, is effectively equivalent to raising the block gas limit and simultaneously increasing the cost of storage opcodes. However, reducing the cost of computational opcodes might avoid the adverse side effects of an increase in cost of storage opcodes (again, more research is needed on this topic).&lt;&#x2F;p&gt;
&lt;p&gt;Currently, computational opcode costs are already too close to the minimum unit of 1 gas to achieve the large degree of cost reductions that recent benchmarks&lt;sup&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2045&#x2F;#evmbenchmarks&quot;&gt;2&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; indicate would be needed to tune opcode gas costs to the performance of optimized EVM implementations. A smaller minimum unit called a &quot;particle&quot;, which is a fraction (or subdivision) of 1 gas, would enable large cost reductions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;A new gas counter &lt;code&gt;particlesUsed&lt;&#x2F;code&gt; is added to the EVM, in addition to the existing gas counter &lt;code&gt;gasUsed&lt;&#x2F;code&gt;. The unit 1 gas is equal to 10000 particles (&lt;code&gt;PARTICLES_PER_GAS&lt;&#x2F;code&gt;). The &lt;code&gt;particlesUsed&lt;&#x2F;code&gt; counter is only increased for opcodes priced in particles (i.e. opcodes that cost less than 1 gas). If increasing &lt;code&gt;particlesUsed&lt;&#x2F;code&gt; results in an excess of 1 gas, then 1 gas is added to &lt;code&gt;gasUsed&lt;&#x2F;code&gt; (and deducted from &lt;code&gt;particlesUsed&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;Where the current gas logic looks like this:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; vm_execute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;ext&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; msg&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Initialize stack, memory, program counter, etc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    compustate&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Compustate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    codelen&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    while&lt;&#x2F;span&gt;&lt;span&gt; compustate&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pc&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; codelen&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        opcode&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; code&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;compustate&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pc&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        compustate&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pc&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        compustate&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gasUsed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; opcode&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_fee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; out of gas error&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; compustate&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gasUsed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; compustate&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gasLimit&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; vm_exception&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;OUT OF GAS&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; op&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;STOP&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; peaceful_exit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        elif&lt;&#x2F;span&gt;&lt;span&gt; op&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ADD&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            stk&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;stk&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; stk&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        elif&lt;&#x2F;span&gt;&lt;span&gt; op&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;SUB&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            stk&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;stk&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; stk&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        elif&lt;&#x2F;span&gt;&lt;span&gt; op&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;MUL&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            stk&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;stk&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; stk&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The new gas logic using particles might look like this:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;PARTICLES_PER_GAS&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; vm_execute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;ext&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; msg&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Initialize stack, memory, program counter, etc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    compustate&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Compustate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    codelen&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    while&lt;&#x2F;span&gt;&lt;span&gt; compustate&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pc&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; codelen&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        opcode&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; code&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;compustate&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pc&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        compustate&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pc&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; opcode&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_fee&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            compustate&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gasUsed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; opcode&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_fee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        elif&lt;&#x2F;span&gt;&lt;span&gt; opcode&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;particle_fee&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            compustate&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;particlesUsed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; opcode&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;particle_fee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; compustate&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;particlesUsed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; PARTICLES_PER_GAS&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;                #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; particlesUsed will be between 1 and 2 gas (over 10000 but under 20000)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                compustate&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gasUsed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;                #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; remainder stays in particle counter&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                compustate&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;particlesUsed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; compustate&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;particlesUsed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; PARTICLES_PER_GAS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; out of gas error&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; compustate&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gasUsed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; compustate&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gasLimit&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; vm_exception&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;OUT OF GAS&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; op&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;STOP&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; peaceful_exit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        elif&lt;&#x2F;span&gt;&lt;span&gt; op&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ADD&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            stk&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;stk&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; stk&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        elif&lt;&#x2F;span&gt;&lt;span&gt; op&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;SUB&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            stk&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;stk&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; stk&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        elif&lt;&#x2F;span&gt;&lt;span&gt; op&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;MUL&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            stk&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;stk&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; stk&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The above pseudocode is written for clarity. A more performant implementation might instead keep a single &lt;code&gt;particlesUsed&lt;&#x2F;code&gt; counter by multiplying opcode gas costs by 10000 and the &lt;code&gt;gasLimit&lt;&#x2F;code&gt; by 10000, and convert particles back to gas with &lt;code&gt;ceil(particlesUsed &#x2F; PARTICLES_PER_GAS)&lt;&#x2F;code&gt; at the end of execution. It may also be more performant to use a &lt;code&gt;PARTICLES_PER_GAS&lt;&#x2F;code&gt; ratio that is a power of 2 (such as 8192 or 16384) instead of 10000; the spec above is a draft and updates in response to feedback are expected.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;opcode-cost-changes&quot;&gt;Opcode cost changes&lt;&#x2F;h4&gt;
&lt;p&gt;Many computational opcodes will undergo a cost reduction, with new costs suggested by benchmark analyses. For example, the cost of &lt;code&gt;DUP&lt;&#x2F;code&gt; and &lt;code&gt;SWAP&lt;&#x2F;code&gt; are reduced from 3 gas to 3000 particles (i.e. 0.3 gas). The cost of &lt;code&gt;ADD&lt;&#x2F;code&gt; and &lt;code&gt;SUB&lt;&#x2F;code&gt; are reduced from 3 gas to 6000 particles. The cost of &lt;code&gt;MUL&lt;&#x2F;code&gt; is reduced from 5 gas to 5000 particles (i.e. 0.5 gas).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Adoption of fractional gas costs should only be an implementation detail inside the EVM, and not alter the current user experience around transaction gas limits and block gas limits. The concept of &lt;code&gt;particles&lt;&#x2F;code&gt; need not be exposed to Ethereum users nor most contract authors, but only to EVM implementers and contract developers concerned with optimized gas usage. Furthermore, only the EVM logic for charging gas per opcode executed should be affected by this change. All other contexts dealing with gas and gas limits, such as block headers and transaction formats, should be unaffected.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;ewasm&quot;&gt;Ewasm&lt;&#x2F;h3&gt;
&lt;p&gt;The term &quot;particles&quot; was first introduced for Ewasm&lt;sup&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2045&#x2F;#particle&quot;&gt;3&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; to enable gas accounting for low cost wasm instructions, while remaining compatible with EVM gas costs. This EIP proposes introducing particles as a new minimum gas unit for EVM opcodes, and is not related to Ewasm.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change is not backwards compatible and requires a hard fork to be activated.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TODO&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TODO&lt;&#x2F;p&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a name=&quot;eip2035&quot;&gt;1&lt;&#x2F;a&gt;. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2035&#x2F;&quot;&gt;EIP-2035&lt;&#x2F;a&gt;: Stateless Clients - Repricing SLOAD and SSTORE to pay for block proofs&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;evmbenchmarks&quot;&gt;2&lt;&#x2F;a&gt;. https:&#x2F;&#x2F;github.com&#x2F;ewasm&#x2F;benchmarking&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;particle&quot;&gt;3&lt;&#x2F;a&gt;. The term &quot;particle&quot; was inspired by a proposal for &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ewasm&#x2F;design&#x2F;blob&#x2F;e77d8e3de42784f40a803a23f58ef06881142d9f&#x2F;determining_wasm_gas_costs.md&quot;&gt;Ewasm gas costs&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Reduced gas cost for static calls made to precompiles</title>
        <published>2019-05-17T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2046/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2046-reduced-gas-cost-for-static-calls-made-to-precompiles/3291" />
        

        <id>https://wg-eips.ritovision.com/2046/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2046"
            label="EIP-2046" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2046/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;This change reduces the gas cost of using precompiled contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Reduce the base gas cost of calling precompiles using &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; from 700 to 40. This should allow more efficient use of precompiles as well as precompiles with a total cost below 700.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The Spurious Dragon hard fork increased the cost of calls significantly to account for loading contract code from the state without making an exception for precompiles, whose &quot;code&quot; is always loaded.&lt;&#x2F;p&gt;
&lt;p&gt;This made use of certain precompiles impractical.&lt;&#x2F;p&gt;
&lt;p&gt;FIXME: extend this with recent reasoning about ECC repricings.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;After block &lt;code&gt;HF&lt;&#x2F;code&gt; the &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; (&lt;code&gt;0xfa&lt;&#x2F;code&gt;) instruction charges different basic gas cost (G&lt;sub&gt;call&lt;&#x2F;sub&gt; in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;yellowpaper&quot;&gt;Yellow Paper&lt;&#x2F;a&gt;&#x27;s notation) depending on the destination address provided:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;for precompiles (address range as per &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1352&#x2F;&quot;&gt;EIP-1352&lt;&#x2F;a&gt;) the cost is &lt;code&gt;40&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;for every other address the cost remains unchanged (&lt;code&gt;700&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Only the &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; instruction was changed to reduce the impact of the change. This should not be a limiting factor, given precompiles (currently) do not have a state and cannot change the state.
However, contracts created and deployed before Byzantium likely will not use &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; and as a result this change will not reduce their costs.&lt;&#x2F;p&gt;
&lt;p&gt;Contrary to EIP-1109 gas reduction to &lt;code&gt;0&lt;&#x2F;code&gt; is not proposed. The cost &lt;code&gt;40&lt;&#x2F;code&gt; is kept as a cost representing the context switching needed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP should be backwards compatible. The only effect is that the cost is reduced. Since the cost is not reduced to zero, it should not be possible for a malicious proxy contract, when deployed before
the &lt;code&gt;HF&lt;&#x2F;code&gt;, to do any state changing operation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBA&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TBA&lt;&#x2F;p&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;&#x2F;h2&gt;
&lt;p&gt;This has been previously suggested as part of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1109&#x2F;&quot;&gt;EIP-1109&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;pull&#x2F;1231&quot;&gt;EIP-1231&lt;&#x2F;a&gt;.
However EIP-1109 was later changed to a very different approach. The author &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum-magicians.org&#x2F;t&#x2F;eip-1109-remove-call-costs-for-precompiled-contracts&#x2F;447&#x2F;7&quot;&gt;has suggested to change EIP-1109&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;acknowledgements&quot;&gt;Acknowledgements&lt;&#x2F;h2&gt;
&lt;p&gt;Jordi Baylina (@jbaylina) and Matthew Di Ferrante (@mattdf) who have proposed this before.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Stateless Clients - Repricing SLOAD and SSTORE to pay for block proofs</title>
        <published>2019-05-16T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alexey Akhunov</name><uri>https://github.com/AlexeyAkhunov</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2035/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2035-stateless-clients-repricing-sload-and-sstore-to-pay-for-block-proofs/3284" />
        

        <id>https://wg-eips.ritovision.com/2035/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:2035"
            label="EIP-2035" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2035/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;The gas cost of EVM opcodes &lt;code&gt;SLOAD&lt;&#x2F;code&gt; and &lt;code&gt;SSTORE&lt;&#x2F;code&gt; increases in order to accommodate extra bandwidth required to propagate block proof together with the block
headers and block bodies, as explained &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;medium.com&#x2F;@akhounov&#x2F;data-from-the-ethereum-stateless-prototype-8c69479c8abc&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;It is part of the State Rent roadmap. This particular change prepares Ethereum for introduction of the block proofs (current understanding is that they
can be introuced without a hard fork). The introduction of the block proofs allows any Ethereum node that wishes to receive them, to process transactions
in the blocks without needing to access the Ethereum state. All necessary information for the execution (and the proof of validity) is continued in the
block proofs. In most Ethereum nodes, it will speed up the block processing and reduce the memory footprint of such processing. For mining nodes, however,
there will be more work to do to construct and transmit the block proofs. Therefore, the extra charge (payable to the miners) is introduced. In the first
phase, only contract storage will be covered by the block proofs. It means that the Ethereum nodes will still need access to the accounts in the state,
but block proofs will make it optional to have access to contract storage for executing transactions. Therefore, only &lt;code&gt;SSTORE&lt;&#x2F;code&gt; and &lt;code&gt;SLOAD&lt;&#x2F;code&gt; opcodes are
affected.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;There is &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;holiman&#x2F;vmstats&#x2F;blob&#x2F;master&#x2F;README.md&quot;&gt;empirical analysis&lt;&#x2F;a&gt; showing that &lt;code&gt;SLOAD&lt;&#x2F;code&gt; opcode is currently underpriced in terms
of execution latency it adds to the block processing. The hypothesis is that it is due to the latency of the database accesses. In the same
analysis, &lt;code&gt;SSTORE&lt;&#x2F;code&gt; is not considered, because its effect on the database accesses can be (and are in many implementations) delayed until the end of
the block. Stateless clients approach to the contract storage will largely negate that latency because no database accesses will be required.
Instead, bandwidth consumption goes up. There is emprical analysis (unpublished, but will be) suggesting that 1 uncached &lt;code&gt;SSTORE&lt;&#x2F;code&gt; or &lt;code&gt;SLOAD&lt;&#x2F;code&gt; adds
at most 1 kB to the block proofs. At the current cost of data transmission (68 gas per byte), this translates to the increase of gas cost of both
operations by 69k gas. However, in light of proposal in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2028&#x2F;&quot;&gt;EIP-2028&lt;&#x2F;a&gt;, the increase can be made much smaller.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Not very formal at the moment, but will be formalised with more research and prototyping. Gas of operations &lt;code&gt;SLOAD&lt;&#x2F;code&gt; and &lt;code&gt;SSTORE&lt;&#x2F;code&gt; increases by &lt;code&gt;X&lt;&#x2F;code&gt; gas when the storage slots accessed (read by &lt;code&gt;SLOAD&lt;&#x2F;code&gt; or written by &lt;code&gt;SSTORE&lt;&#x2F;code&gt;) were not previously accessed (by another &lt;code&gt;SLOAD&lt;&#x2F;code&gt; or &lt;code&gt;SSTORE&lt;&#x2F;code&gt;) during the same transaction.&lt;&#x2F;p&gt;
&lt;p&gt;Future variant (will be possible after the implementation of the &lt;em&gt;Gross contract size acccounting&lt;&#x2F;em&gt;) is researched, where the increase is varied
depending on the size of the contract storage, i.e. &lt;code&gt;SLOAD&lt;&#x2F;code&gt; and &lt;code&gt;SSTORE&lt;&#x2F;code&gt; for smaller contracts will be cheaper.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1884&#x2F;&quot;&gt;EIP-1884&lt;&#x2F;a&gt; seeks to increase the gas cost of &lt;code&gt;SLOAD&lt;&#x2F;code&gt; but using a different justification
(latency of the execution as described in the Motivation). This EIP is likely to increase the cost of &lt;code&gt;SLOAD&lt;&#x2F;code&gt; by a larger amount, therefore partially
(because EIP-1884 also proposed other increases) supersedes EIP-1884.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2028&#x2F;&quot;&gt;EIP-2028&lt;&#x2F;a&gt; describes the model that can be used for deciding the gas cost of data transmission. It is relevant
because in the stateless client regime &lt;code&gt;SSTORE&lt;&#x2F;code&gt; and &lt;code&gt;SLOAD&lt;&#x2F;code&gt; operations add more data to be transmitted (as well as computation to verify the proofs).&lt;&#x2F;p&gt;
&lt;p&gt;The main alternate design is the rent proportional to the size of the contract storage, which unfortunately introduces a serious griefing
vulnerability problem, and so far the solution seems to be in redesigning and rewriting smart contracts in a way, which makes them not vulnerable.
However, this approach is likely to be very expensive on the non-technical (ecosystem) level.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change is not backwards compatible and requires hard fork to be activated.
There might also be an adverse effect of this change on the already deployed contract. It is expected that after this EIP and
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2026&#x2F;&quot;&gt;EIP-2026&lt;&#x2F;a&gt; (rent prepayment for accounts), the recommendation will be made to raise the gas limit. This can somewhat dampen the
adverse effect of EIP. The most problematic cases would be with the contracts that assume certain gas costs of &lt;code&gt;SLOAD&lt;&#x2F;code&gt;
and &lt;code&gt;SSTORE&lt;&#x2F;code&gt; and hard-code them in their internal gas computations. For others, the cost of interacting with the contract
storage will rise and may make some dApps based on such interactions, non-viable. This is a trade off to avoid even bigger
adverse effect of the rent proportional to the contract storage size. However, more research is needed to more fully
analyse the potentially impacted contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Tests cases will be generated out of a reference implementation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;There will be proof of concept implementation to refine and clarify the specification.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>State Rent A - State counters contract</title>
        <published>2019-05-15T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alexey Akhunov</name><uri>https://github.com/AlexeyAkhunov</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2029/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2029-state-counters-contract-change-a-from-state-rent-v3-proposal/3279" />
        

        <id>https://wg-eips.ritovision.com/2029/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:2029"
            label="EIP-2029" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2029/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;A smart contract is deployed on all Ethereum networks, at a pre-determined address, with the code that simply reads the slot in its storage specified by the
only parameter. Later, this contract becomes &quot;special&quot; in that Ethereum start writing state counters (number of total transactions, number of accounts,
etc.) into that contract.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This is part of the State Rent roadmap. This particular change introduces a place in the Ethereum state where various state counters can be stored. At this
point, the most important counter is the total number of transactions happened, and this counter will be used to populate the nonces of newly created
non-contract accounts. This way of populating nonce ensures replay protection for accounts that were evicted and then brought back by sending ether to them.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Ethereum currently does not have a special place in the state for tracking state counters such as number of transactions or number of accounts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Prior to the block A, a contract is deployed with the following code:
&lt;code&gt;0x60 0x20 0x60 0x00 0x80 0x80 0x35 0x54 0x90 0x52 0xF3&lt;&#x2F;code&gt;, which corresponds to this assembly:
&lt;code&gt;PUSH1 32 PUSH1 0 DUP1 DUP1 CALLDATALOAD SLOAD SWAP1 MSTORE RETURN&lt;&#x2F;code&gt;
Call to this contract accepts one 32-byte argument, &lt;code&gt;x&lt;&#x2F;code&gt;, and returns the value of the storage item [&lt;code&gt;x&lt;&#x2F;code&gt;].&lt;&#x2F;p&gt;
&lt;p&gt;This contract is deployed using &lt;code&gt;CREATE2&lt;&#x2F;code&gt; opcode in such a way that it has the same address on any network.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Two alternative solutions were considered so far:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Extending the structure of the Ethereum state to introduce more fields, and hence change the way the state root is constructed. The main downside of this
approach is the impact on the software what is currently coupled with the particular way the state root is constructed. Particularly it affects the software
that deals with merkle proofs derived from the state root.&lt;&#x2F;li&gt;
&lt;li&gt;Extended State Oracle (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2014&#x2F;&quot;&gt;EIP-2014&lt;&#x2F;a&gt;). Under such proposal, there will be a precompile contract with standardised interface, capable of returning
current values of the counters. However, the actual data being returned by such oracle is not explicitly in the state, and is not Merkelised. It means that all the counters need to be added to the snapshots when the snapshot sync is perform, so they still present in the state, but implicitly.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change is backwards compatible and does not require hard fork to be activated.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Tests cases will be created to ensure that the state counter contract returns its storage items correctly.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Implementation is envisaged as a transaction that can be posted from any Ethereum address and will cause the deployment of the state counter contract.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>State Rent B - Net transaction counter</title>
        <published>2019-05-15T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alexey Akhunov</name><uri>https://github.com/AlexeyAkhunov</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2031/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2031-net-transaction-counter-change-b-from-state-rent-v3-proposal/3283" />
        

        <id>https://wg-eips.ritovision.com/2031/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:2031"
            label="EIP-2031" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2031/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Ethereum starts to track the number of transactions inside its state (for now, only number of transactions after this change is introduced, therefore
it is called &lt;em&gt;Net&lt;&#x2F;em&gt; transaction count).
It is done by incrementing a storage slot in the special contract, called &lt;em&gt;State counter contract&lt;&#x2F;em&gt; (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2029&#x2F;&quot;&gt;EIP-2029&lt;&#x2F;a&gt;).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;It is part of the State Rent roadmap. This particular change makes any Ethereum transaction increment the transaction counter, which is a special storage slot
in the &lt;em&gt;State counter contract&lt;&#x2F;em&gt;. This counter will be used to populate the nonces of newly created
non-contract accounts. This way of populating nonce ensures replay protection for accounts that were evicted and then brought back by sending ether to them.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Ethereum currently does not have a special place in the state for tracking number of transactions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;A new field, with the location 0 (that means it resides in the storage slot 0 in the state counter contract, and can
be read by calling that contract with argument being 32 zero bytes), is added to the state counter contract. It will eventually contain &lt;code&gt;txCount&lt;&#x2F;code&gt;, the total number of transactions processed up until that point.
On an after block B, or after the deployment of the state counter contract (which comes first), the field &lt;code&gt;txCount&lt;&#x2F;code&gt; is incremented after each transaction. Updating &lt;code&gt;txCount&lt;&#x2F;code&gt; means updating the storage of state counter contract at the location 0. These changes are never reverted.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Two main alternatives were proposed for the replay protection of the accounts that were evicted by subsequently brought back by sending ether to them:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Temporal replay protection. The nonce of the new accounts (and those brought back) is still zero, but a new &lt;code&gt;valid-until&lt;&#x2F;code&gt; field is introduced, making
transactions invalid for inclusion after the time specified in this field. This, however, has unwanted side effected related to the fact that account
nonces are not only used for replay protection, but also for computing the addresses of the deployed contracts (except those created by &lt;code&gt;CREATE2&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;Setting nonce of new accounts (and those brought back) to something depending on the current block number. This approach requires coming up with
an arbitrary parameter, which is the maximum number of transaction in the block, so that the new nonces never clash with the existing nonces.
This is mostly a concern for private networks at the moment, because they will potentially have significantly more transactions in a block.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change is not backwards compatible and requires hard fork to be activated.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Tests cases will be generated out of a reference implementation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;There will be proof of concept implementation to refine and clarify the specification.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>State Rent H - Fixed Prepayment for accounts</title>
        <published>2019-05-14T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alexey Akhunov</name><uri>https://github.com/AlexeyAkhunov</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2026/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2026-fixed-rent-prepayment-for-all-accounts-change-h-from-state-rent-v3-proposal/3273" />
        

        <id>https://wg-eips.ritovision.com/2026/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:2026"
            label="EIP-2026" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2026/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Creation of new accounts (both contracts and non-contracts) requires a fixed one-off rent prepayment. Pre-existed accounts require the same prepayment upon
the first modification. The act of rent prepayment causes the addition of an extra field to accounts, called &lt;code&gt;rentbalance&lt;&#x2F;code&gt;. This field becomes part of state.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This is part of the State Rent roadmap. This particular change introduces a fixed charge for state expansion that comes from adding new accounts to the state. Theoretically, it puts a bound on the number of accounts that can be ever created, because that fixed charge cannot be recycled via mining.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The penalty is levied to the transaction sender. Rather than raising the gas cost of account creation (that would direct levy towards the miner), this change directs prepayment into the account&#x27;s special field, &lt;code&gt;rentbalance&lt;&#x2F;code&gt;. It addresses several shortcomings of the simple raising of the gas cost:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Prepayments cannot be recycled via mining, which puts a theoretical bound on number of accounts in the state (though it is unlikely to ever be reached).&lt;&#x2F;li&gt;
&lt;li&gt;It is not possible for miners to circumvent the penalty or to extend such circumventions onto other users (via private fee rebates, for example).&lt;&#x2F;li&gt;
&lt;li&gt;This prepayment will be used to cover state rent in the future, and it will allow newly created contracts with 0 endowment not to be evicted in the same block.&lt;&#x2F;li&gt;
&lt;li&gt;It makes is possible to refund &lt;code&gt;rentbalance&lt;&#x2F;code&gt; upon self-destruction - when contract is self-destructed, both &lt;code&gt;balance&lt;&#x2F;code&gt; and &lt;code&gt;rentbalance&lt;&#x2F;code&gt; are returned.&lt;&#x2F;li&gt;
&lt;li&gt;Prepayments on pre-existing accounts are necessary to prevent hoarding of accounts ahead of this change.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;On and after block &lt;code&gt;H&lt;&#x2F;code&gt;, every newly created account gets a new field &lt;code&gt;rentbalance&lt;&#x2F;code&gt; of type unsigned 256-bit integer.
On and after block &lt;code&gt;H&lt;&#x2F;code&gt;, any operation that leads to the creation of a new account, deducts the amount &lt;code&gt;ACCOUNT_PREPAYMENT&lt;&#x2F;code&gt; from &lt;code&gt;tx.origin&lt;&#x2F;code&gt;. This amount is added to the &lt;code&gt;rentbalance&lt;&#x2F;code&gt; field of the created account.
On and after block &lt;code&gt;H&lt;&#x2F;code&gt;, any operation that modifies an account that does not yet have &lt;code&gt;rentbalance&lt;&#x2F;code&gt; field, deducts the amount &lt;code&gt;ACCOUNT_PREPAYEMENT&lt;&#x2F;code&gt; from &lt;code&gt;tx.origin&lt;&#x2F;code&gt;. This amount is added to the &lt;code&gt;rentbalance&lt;&#x2F;code&gt; field of the modified account. This is an anti-hoarding measure.&lt;&#x2F;p&gt;
&lt;p&gt;Operations leading to the creations of a new account:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Creation of a non-contract account by sending non-zero ETH to an address with no associated account&lt;&#x2F;li&gt;
&lt;li&gt;Creation of a non-contract account by the block with &lt;code&gt;coinbase&lt;&#x2F;code&gt; pointing to an address with no associated account&lt;&#x2F;li&gt;
&lt;li&gt;Creation of a non-contract account by &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; with the argument being an address with no associated account&lt;&#x2F;li&gt;
&lt;li&gt;Creation of a contract by transaction without destination but with data. This can result in either converting a non-countract account into a contract account, or creation of a contract account.&lt;&#x2F;li&gt;
&lt;li&gt;Creation of a contract by execution of &lt;code&gt;CREATE&lt;&#x2F;code&gt; or &lt;code&gt;CREATE2&lt;&#x2F;code&gt;. This can result in either converting a non-countract account into a contract account, or creation of a contract account.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;After prepayments are introduced, there can be two reasons for ether to be deducted from &lt;code&gt;tx.origin&lt;&#x2F;code&gt;: purchasing and spending gas, and spending gas for prepayments. Gaslimit of a transaction currently plays a role of safety limit, where &lt;code&gt;gaslimit&lt;&#x2F;code&gt;  * &lt;code&gt;gasprice&lt;&#x2F;code&gt; represents the maximum amount of wei the sender (&lt;code&gt;tx.origin&lt;&#x2F;code&gt;) authorises the transaction to deduct from its account.
After prepayments are introduced, &lt;code&gt;gaslimit&lt;&#x2F;code&gt; * &lt;code&gt;gasprice&lt;&#x2F;code&gt; will still represent the maximum amount of wei spend, but it will be used for both gas purchases and prepayments, as necessary.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Prior to rent prepayments, other alternatives were considered:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Simple raising of the gas cost - discussed in the Motivation section.&lt;&#x2F;li&gt;
&lt;li&gt;In &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ledgerwatch&#x2F;eth_state&#x2F;blob&#x2F;master&#x2F;State_rent.pdf&quot;&gt;first version of State Rent proposal&lt;&#x2F;a&gt;, there was no notion of extra levy upon account creation. It created a slight usability issue, where newly created contracts with 0 endowment would be evicted in the same block (when rent is introduced). It delays the benefits of the State Rent programme until the actual introduction of rent (in second or third hard-fork).&lt;&#x2F;li&gt;
&lt;li&gt;In the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ledgerwatch&#x2F;eth_state&#x2F;blob&#x2F;master&#x2F;State_Rent_2.pdf&quot;&gt;second version of State Rent proposal&lt;&#x2F;a&gt;, there was a notion of lock-up. It is very similar to rent prepayment, with the different that lock-up would not be covering future rent payments.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;An alternative approach to limiting the prepayments (instead of the using &lt;code&gt;gaslimit&lt;&#x2F;code&gt; * &lt;code&gt;gasprice&lt;&#x2F;code&gt; as the limit) is to introduce a new dedicated field &lt;code&gt;prepaymenlimit&lt;&#x2F;code&gt; into the transaction. This field would only limit prepayments. Such approach would require changes in the transaction format, as well as changes in the user interface for transaction sender, and having two counters during the transaction execution - one for gas, and one for prepayments.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change is not backwards compatible and requires hard fork to be activated.
It might have some adverse effects on the existing contracts, due to more gas needed to be allocated for the creation of new accounts. These adverse effects need to analysed in more detail.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Tests cases will be generated out of a reference implementation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;There will be proof of concept implementation to refine and clarify the specification.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>State Rent C - Net contract size accounting</title>
        <published>2019-05-14T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alexey Akhunov</name><uri>https://github.com/AlexeyAkhunov</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2027/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2027-net-contract-size-accounting-change-c-from-state-rent-v3-proposal/3275" />
        

        <id>https://wg-eips.ritovision.com/2027/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:2027"
            label="EIP-2027" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2027/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Ethereum starts counting the number of storage slots filled and emptied in the contracts. Since the number of pre-existing slots is not currently accounted
in the state, effectively, only net change in the number of slots is tracked. In the subsequent change, called &lt;em&gt;Gross contract size accounting&lt;&#x2F;em&gt;, the total
number of storage slots starts being tracked.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This is part of the State Rent roadmap. This particular change introduces initial, net accounting of the number of the contract storage slots. Though not very
useful on its own, it makes it possible to introduce gross accounting of the number of storage slots, which is useful for number of things:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Gas cost of operations suchs as &lt;code&gt;SLOAD&lt;&#x2F;code&gt; and &lt;code&gt;SSTORE&lt;&#x2F;code&gt; will need to be increased to compensate for extra bandwidth consumed by the block proofs. Although in
the beginning the cost would be fixed, it will later be automatically calibrated depending on the size of the contract &lt;code&gt;SLOAD&lt;&#x2F;code&gt; and &lt;code&gt;SSTORE&lt;&#x2F;code&gt; operate on.&lt;&#x2F;li&gt;
&lt;li&gt;Snapshot sync protocols, like &lt;em&gt;fast sync&lt;&#x2F;em&gt;, &lt;em&gt;warp sync&lt;&#x2F;em&gt;, &lt;em&gt;firehose&lt;&#x2F;em&gt;, &lt;em&gt;red queen&lt;&#x2F;em&gt;, and perhaps others, will benefit from having the correct size of the
contract storage present in the state (and therefore being provable via Merkle proofs).&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Ethereum currently does not track the number of contract storage slots at all, and producing such number given the downloaded state cannot be done in
constant &lt;em&gt;O(1)&lt;&#x2F;em&gt; time.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Each contract (account with &lt;code&gt;codeHash&lt;&#x2F;code&gt; field not equal to 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470, which the hash of the empty code) gets a new uint64 field, called &lt;code&gt;storagesize&lt;&#x2F;code&gt;. On and after block &lt;code&gt;C&lt;&#x2F;code&gt;, the semantics of the operation &lt;code&gt;SSTORE&lt;&#x2F;code&gt; (&lt;code&gt;location&lt;&#x2F;code&gt;, &lt;code&gt;value&lt;&#x2F;code&gt;) changes as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If previous value of the [&lt;code&gt;location&lt;&#x2F;code&gt;] is 0, and value is not 0, &lt;em&gt;increment&lt;&#x2F;em&gt; &lt;code&gt;storagesize&lt;&#x2F;code&gt; (semantics of &lt;em&gt;increment&lt;&#x2F;em&gt; described below)&lt;&#x2F;li&gt;
&lt;li&gt;If previous value of the [&lt;code&gt;location&lt;&#x2F;code&gt;] is not 0, and value is 0, &lt;em&gt;decrement&lt;&#x2F;em&gt; &lt;code&gt;storagesize&lt;&#x2F;code&gt; (semantics of &lt;em&gt;decrement&lt;&#x2F;em&gt; described below)&lt;&#x2F;li&gt;
&lt;li&gt;As with other state changes, changes of &lt;code&gt;storagesize&lt;&#x2F;code&gt; get reverted when the execution frame reverts, i.e. it needs to use the same techniques as storage values, like journalling (in Geth), and substates (in Parity).
Value of &lt;code&gt;storagesize&lt;&#x2F;code&gt; is not observable from contracts at this point.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;semantics-of-increment-storagesize&quot;&gt;Semantics of &lt;em&gt;increment&lt;&#x2F;em&gt; &lt;code&gt;storagesize&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;If &lt;code&gt;storagesize&lt;&#x2F;code&gt; is not present, &lt;code&gt;storagesize&lt;&#x2F;code&gt; = &lt;code&gt;HUGE_NUMBER&lt;&#x2F;code&gt; + 1.
If &lt;code&gt;storagesize&lt;&#x2F;code&gt; is present, &lt;code&gt;storagesize&lt;&#x2F;code&gt; = &lt;code&gt;storagesize&lt;&#x2F;code&gt; + 1.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;semantics-of-decrement-storagesize&quot;&gt;Semantics of &lt;em&gt;decrement&lt;&#x2F;em&gt; &lt;code&gt;storagesize&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;If &lt;code&gt;storagesize&lt;&#x2F;code&gt; is not present, &lt;code&gt;storagesize&lt;&#x2F;code&gt; = &lt;code&gt;HUGE_NUMBER&lt;&#x2F;code&gt; - 1.
If &lt;code&gt;storagesize&lt;&#x2F;code&gt; is present, &lt;code&gt;storagesize&lt;&#x2F;code&gt; = &lt;code&gt;storagesize&lt;&#x2F;code&gt; - 1.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;note-of-huge-number&quot;&gt;Note of &lt;code&gt;HUGE_NUMBER&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;There is a constant &lt;code&gt;HUGE_NUMBER&lt;&#x2F;code&gt;. It needs to be large enough so that no real metrics (contract storage size, number of accounts, number of contracts, total size of code, total size of storage) will never reach that number, and small enough that it fits in an unsigned 64-bit integer.
Current suggestion is to have &lt;code&gt;HUGE_NUMBER&lt;&#x2F;code&gt; = 2^63, which is binary representation is the a single bit in a 64-bit number.&lt;&#x2F;p&gt;
&lt;p&gt;The idea is to make it decidable later whether the storagesize was ever incremented&#x2F;decremented (presence of the field), and whether it has been converted from net to gross (by value being smaller than &lt;code&gt;HUGE_NUMBER&#x2F;2&lt;&#x2F;code&gt; - because it will not be possible for any contract be larger than 2^62 at the block &lt;code&gt;C&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;A mechanism for estimation of contract storage size has been proposed &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;medium.com&#x2F;@akhounov&#x2F;estimation-approximate-of-the-size-of-contracst-in-ethereum-4642fe92d6fe&quot;&gt;here&lt;&#x2F;a&gt;. But it does have a big drawback of introducing a lot of complexity into the consensus
(in the form of estimation algorithm, which has quite a few edge cases to cater for different sizes of the storage).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change is not backwards compatible and requires hard fork to be activated. Since the newly introduced field is not observable, this change does not impact any operations of the existing smart contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Tests cases will be generated out of a reference implementation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;There will be proof of concept implementation to refine and clarify the specification.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>wallet_updateEthereumChain RPC Method</title>
        <published>2019-05-12T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Pedro Gomes</name><uri>https://github.com/pedrouid</uri>
	</author>
	
	<author>
		<name>Erik Marks</name><uri>https://github.com/rekmarks</uri>
	</author>
	
	<author>
		<name>Pandapip1</name><uri>https://github.com/Pandapip1</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2015/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2015-wallet-update-chain-json-rpc-method-wallet-updatechain/3274" />
        

        <id>https://wg-eips.ritovision.com/2015/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="interface"
                label="Interface" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2015"
            label="EIP-2015" />
        

        
        

        
        <summary type="html">Adds an RPC method to switch between EVM-compatible chains</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2015/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP adds a wallet-namespaced RPC endpoint, &lt;code&gt;wallet_updateEthereumChain&lt;&#x2F;code&gt;, providing a standard interface for switching chains. The method takes the minimal parameters of &lt;code&gt;chainId&lt;&#x2F;code&gt;, &lt;code&gt;chainName&lt;&#x2F;code&gt;, &lt;code&gt;rpcUrl&lt;&#x2F;code&gt;, &lt;code&gt;nativeCurrency&lt;&#x2F;code&gt; and &lt;code&gt;blockExplorerUrl&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal adds a method to a wallet&#x27;s web3 provider API: &lt;code&gt;wallet_updateEthereumChain&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;wallet-updateethereumchain&quot;&gt;&lt;code&gt;wallet_updateEthereumChain&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;wallet_updateEthereumChain&lt;&#x2F;code&gt; method is used to switch to a network, and registering it with the wallet if it isn&#x27;t already recognized.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;wallet_updateEthereumChain&lt;&#x2F;code&gt; method takes one parameter, an &lt;code&gt;EthereumChainSwitchRequest&lt;&#x2F;code&gt; object, defined below:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NativeCurrencyData&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  name&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  symbol&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  decimals&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; number&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EthereumChainSwitchRequest&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  chainName&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  rpcUrls&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  nativeCurrency&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NativeCurrencyData&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  blockExplorerUrl&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;chainId&lt;&#x2F;code&gt; is the &lt;code&gt;0x&lt;&#x2F;code&gt;-prefixed &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt;-compliant chain ID. The &lt;code&gt;chainName&lt;&#x2F;code&gt; is a suggested human-readable name of the chain, to be displayed to the user. The &lt;code&gt;rpcUrls&lt;&#x2F;code&gt; array is a list of RPC endpoints for the given &lt;code&gt;chainId&lt;&#x2F;code&gt;. The &lt;code&gt;nativeCurrency&lt;&#x2F;code&gt; object suggests how the native currency should be displayed. Its parameters, &lt;code&gt;name&lt;&#x2F;code&gt;, &lt;code&gt;symbol&lt;&#x2F;code&gt;, and &lt;code&gt;decimals&lt;&#x2F;code&gt;, should be interpreted like in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;. Finally, the &lt;code&gt;blockExplorerUrl&lt;&#x2F;code&gt; should link to a block explorer compatible with the given &lt;code&gt;chainId&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;All keys other than the &lt;code&gt;chainId&lt;&#x2F;code&gt; are optional. All keys other than &lt;code&gt;chainId&lt;&#x2F;code&gt; are suggestions to the wallet. Wallets can choose to ignore or display other data to users. Wallets should prompt the user before switching or adding chains. Wallets should also store a default list of data for commonly-used chains, in order to avoid phishing attacks. Wallets MUST sanitize each RPC url before using it to send other requests, including ensuring that it responds correctly to the &lt;code&gt;net_version&lt;&#x2F;code&gt; and &lt;code&gt;eth_chainId&lt;&#x2F;code&gt; methods.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;wallet_updateEthereumChain&lt;&#x2F;code&gt; method returns &lt;code&gt;true&lt;&#x2F;code&gt; if the active chain matches the requested chain, regardless of whether the chain was already active or was added to the wallet previously. If the user rejects the request, it must return an error with code &lt;code&gt;4001&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;wallet_updateEthereumChain&lt;&#x2F;code&gt; method is designed to be as simple as possible, while still providing the necessary information for a wallet to switch to a new chain. The &lt;code&gt;chainId&lt;&#x2F;code&gt; is the only required parameter, as it is the only parameter that is guaranteed to be unique. The &lt;code&gt;chainName&lt;&#x2F;code&gt; is included to provide a human-readable name for the chain, and the &lt;code&gt;rpcUrls&lt;&#x2F;code&gt; array is included to provide a list of RPC endpoints for the chain. The &lt;code&gt;nativeCurrency&lt;&#x2F;code&gt; object is included to provide a suggestion for how the native currency should be displayed. Finally, the &lt;code&gt;blockExplorerUrl&lt;&#x2F;code&gt; is included to provide a link to a block explorer for the chain.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;wallet_updateEthereumChain&lt;&#x2F;code&gt; method is namespaced under &lt;code&gt;wallet_&lt;&#x2F;code&gt; to avoid conflicts with other methods. The &lt;code&gt;wallet_&lt;&#x2F;code&gt; prefix is used by other methods that are wallet-specific, such as &lt;code&gt;wallet_addEthereumChain&lt;&#x2F;code&gt; and &lt;code&gt;wallet_switchEthereumChain&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is fully backwards compatible.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;server-side-request-forgery-ssrf&quot;&gt;Server-Side Request Forgery (SSRF)&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;rpcUrls&lt;&#x2F;code&gt; parameter is a list of RPC endpoints for the chain. Wallets should sanitize each RPC url before using it to send other requests, including ensuring that it responds correctly to the &lt;code&gt;net_version&lt;&#x2F;code&gt; and &lt;code&gt;eth_chainId&lt;&#x2F;code&gt; methods.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;phishing&quot;&gt;Phishing&lt;&#x2F;h3&gt;
&lt;p&gt;Wallets should store a default list of data for commonly-used chains, in order to avoid phishing attacks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Extended State Oracle</title>
        <published>2019-05-10T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2014/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2014-extended-state-oracle/3301" />
        

        <id>https://wg-eips.ritovision.com/2014/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2014"
            label="EIP-2014" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2014/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce a new system contract with an extensible interface following the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;solidity.readthedocs.io&#x2F;en&#x2F;latest&#x2F;abi-spec.html&quot;&gt;Contract ABI Encoding&lt;&#x2F;a&gt; to access extended data sets, such as chain identifiers, block hashes, etc.&lt;&#x2F;p&gt;
&lt;p&gt;This allows Ethereum contract languages to interact with this contract as if it were a regular contract and not needing any language support.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Over the past couple of years several proposals were made to extend the EVM with more data. Some examples include extended access to block hashes (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;210&#x2F;&quot;&gt;EIP-210&lt;&#x2F;a&gt;) and chain identifiers (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1344&#x2F;&quot;&gt;EIP-1344&lt;&#x2F;a&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;Adding them as EVM opcodes seems to be using the scarce opcode space for relatively less frequently used features, while adding them as precompiles is perceived as more complicated due to an interface
needs to be defined and agreed on for every case.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal tries to solve both issues with defining an extensible standard interface.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;A new system contract (&quot;precompile&quot;) is introduced at address &lt;code&gt;0x0000000000000000000000000000000000000009&lt;&#x2F;code&gt; called ESO (Extended State Oracle).&lt;&#x2F;p&gt;
&lt;p&gt;It can be queried using &lt;code&gt;CALL&lt;&#x2F;code&gt; or &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; and follows the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;solidity.readthedocs.io&#x2F;en&#x2F;latest&#x2F;abi-spec.html&quot;&gt;Contract ABI Encoding&lt;&#x2F;a&gt; for the inputs and outputs. Using elementary types in the ABI encoding is encouraged to keep complexity low.&lt;&#x2F;p&gt;
&lt;p&gt;In the future it could be possible to extend ESO to have a state and accept transactions from a system address to store the passed data -- similarly to what &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;210&#x2F;&quot;&gt;EIP-210&lt;&#x2F;a&gt; proposed.&lt;&#x2F;p&gt;
&lt;p&gt;Proposals wanting to introduce more data to the state, which is not part of blocks or transactions, should aim to extend the ESO.&lt;&#x2F;p&gt;
&lt;p&gt;At this time it is not proposed to make the ESO into a contract existing in the state, but to include it as a precompile and leave the implementation details to the client.
In the future if it is sufficiently extended and a need arises to have a state, it would make sense to move it from being a precompile and have actual code.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;chain-identifier&quot;&gt;Chain identifier&lt;&#x2F;h3&gt;
&lt;p&gt;Initially, a feature to read the current chain identifier is introduced: &lt;code&gt;getCurrentChainId()&lt;&#x2F;code&gt; returns the current chain identifier as a &lt;code&gt;uint64&lt;&#x2F;code&gt; encoded value.
It should be a non-payable function, which means sending any value would revert the transaction as described in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;140&#x2F;&quot;&gt;EIP-140&lt;&#x2F;a&gt;.
This has been proposed as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1344&#x2F;&quot;&gt;EIP-1344&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The contract ABI JSON is the following:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;getCurrentChainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;outputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;stateMutability&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This will be translated into sending the bytes &lt;code&gt;5cf0e8a4&lt;&#x2F;code&gt; to the ESO and returning the bytes &lt;code&gt;0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;code&gt; for Ethereum mainnet.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;&#x2F;strong&gt; It should be possible to introduce another interface checking the validity of a chain identifier in the chain history or for a given block (see &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;pull&#x2F;1959&quot;&gt;EIP-1959&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;pull&#x2F;1965&quot;&gt;EIP-1965&lt;&#x2F;a&gt;).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;TBA&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;TBA&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBA&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TBA&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Fundable Token</title>
        <published>2019-05-10T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Fernando Paris</name><email>fer@io.builders</email>
	</author>
	
	<author>
		<name>Julio Faura</name><email>julio@adhara.io</email>
	</author>
	
	<author>
		<name>Daniel Lehrner</name><email>daniel@io.builders</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2019/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/2105" />
        

        <id>https://wg-eips.ritovision.com/2019/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:2019"
            label="ERC-2019" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2019/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;An extension to the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; standard token that allows Token wallet owners to request a wallet to be funded, by calling the smart contract and attaching a fund instruction string.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;actors&quot;&gt;Actors&lt;&#x2F;h2&gt;
&lt;h4 id=&quot;token-wallet-owners&quot;&gt;Token Wallet Owners&lt;&#x2F;h4&gt;
&lt;p&gt;The person or company who owns the wallet, and will order a token fund request into the wallet.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;token-contract-owner-agent&quot;&gt;Token contract owner &#x2F; agent&lt;&#x2F;h4&gt;
&lt;p&gt;The entity, company responsible&#x2F;owner of the token contract, and token issuing&#x2F;minting. This actor is in charge of trying to fulfill all fund request(s), reading the fund instruction(s), and correlate the private payment details.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;orderer&quot;&gt;Orderer&lt;&#x2F;h4&gt;
&lt;p&gt;An actor who is enabled to initiate funding orders on behalf of a token wallet owner.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Token wallet owners (or approved addresses) can order tokenization requests through  blockchain. This is done by calling the &lt;code&gt;orderFund&lt;&#x2F;code&gt; or &lt;code&gt;orderFundFrom&lt;&#x2F;code&gt; methods, which initiate the workflow for the token contract operator to either honor or reject the fund request. In this case, fund instructions are provided when submitting the request, which are used by the operator to determine the source of the funds to be debited in order to do fund the token wallet (through minting).&lt;&#x2F;p&gt;
&lt;p&gt;In general, it is not advisable to place explicit routing instructions for debiting funds on a verbatim basis on the blockchain, and it is advised to use a private communication alternatives, such as private channels, encrypted storage or similar,  to do so (external to the blockchain ledger). Another (less desirable) possibility is to place these instructions on the instructions field in encrypted form.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Nowadays most of the token issuing&#x2F;funding request, based on any fiat based payment method  need a previous centralized transaction, to be able to get the desired tokens issued on requester&#x27;s wallet.
In the aim of trying to bring all the needed steps into decentralization, exposing all the needed steps of token lifecycle and payment transactions, a funding request can allow wallet owner to initiate the funding request via  blockchain.
Key benefits:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Funding and payment traceability is enhanced bringing the initiation into the ledger. All payment stat
s can be stored on chain.&lt;&#x2F;li&gt;
&lt;li&gt;Almost all money&#x2F;token lifecycle is covered via a decentralized approach, complemented with private communications which is common use in the ecosystem.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IFundable&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is ERC-20 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FundStatusCode&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        Nonexistent&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        Ordered&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        InProcess&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        Executed&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        Rejected&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        Cancelled&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; authorizeFundOperator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; orderer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revokeFundOperator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; orderer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; ;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; orderFund&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operationId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; instructions&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; orderFundFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operationId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; walletToFund&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; instructions&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; cancelFund&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operationId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; processFund&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operationId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; executeFund&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operationId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; rejectFund&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operationId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; reason&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isFundOperatorFor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; walletToFund&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; orderer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; retrieveFundData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; orderer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operationId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; walletToFund&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;       uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; instructions&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; FundStatusCode&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; status&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FundOrdered&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; orderer&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operationId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span&gt; ,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,         &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; instructions&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FundInProcess&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; orderer&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operationId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FundExecuted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; orderer&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operationId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FundRejected&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; orderer&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operationId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; reason&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FundCancelled&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; orderer&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operationId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FundOperatorAuthorized&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; walletToFund&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; orderer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FundOperatorRevoked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; walletToFund&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; orderer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;functions&quot;&gt;Functions&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;authorizefundoperator&quot;&gt;authorizeFundOperator&lt;&#x2F;h4&gt;
&lt;p&gt;Wallet owner, authorizes a given address to be fund orderer.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;orderer&lt;&#x2F;td&gt;&lt;td&gt;The address of the orderer.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;revokefundoperator&quot;&gt;revokeFundOperator&lt;&#x2F;h4&gt;
&lt;p&gt;Wallet owner, revokes a given address to be fund orderer.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;orderer&lt;&#x2F;td&gt;&lt;td&gt;The address of the orderer.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;orderfund&quot;&gt;orderFund&lt;&#x2F;h4&gt;
&lt;p&gt;Creates a fund request, that will be processed by the token operator. The function must revert if the operation ID has been used before.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;operationId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID to identify the request&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;value&lt;&#x2F;td&gt;&lt;td&gt;The amount to be funded.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;instruction&lt;&#x2F;td&gt;&lt;td&gt;A string including the payment instruction.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;orderfundfrom&quot;&gt;orderFundFrom&lt;&#x2F;h4&gt;
&lt;p&gt;Creates a fund request, on behalf of a wallet owner, that will be processed by the token operator. The function must revert if the operation ID has been used before.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;operationId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID to identify the request&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;walletToFund&lt;&#x2F;td&gt;&lt;td&gt;The wallet to be funded on behalf.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;value&lt;&#x2F;td&gt;&lt;td&gt;The amount to be funded.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;instruction&lt;&#x2F;td&gt;&lt;td&gt;A string including the payment instruction.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;cancelfund&quot;&gt;cancelFund&lt;&#x2F;h4&gt;
&lt;p&gt;Cancels a funding request.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;operationId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID to identify the request that is going to be cancelled. This can only be done by token holder, or the fund initiator.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;processfund&quot;&gt;processFund&lt;&#x2F;h4&gt;
&lt;p&gt;Marks a funding request as on process. After the status is on process, order cannot be cancelled.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;operationId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID to identify the request is in process.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;executefund&quot;&gt;executeFund&lt;&#x2F;h4&gt;
&lt;p&gt;Issues the amount of tokens and marks a funding request as executed.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;operationId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID to identify the request that has been executed.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;rejectfund&quot;&gt;rejectFund&lt;&#x2F;h4&gt;
&lt;p&gt;Rejects a given operation with a reason.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;operationId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID to identify the request that has been executed.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;reason&lt;&#x2F;td&gt;&lt;td&gt;The specific reason that explains why the fund request was rejected. EIP 1066 codes can be used&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;isfundoperatorfor&quot;&gt;isFundOperatorFor&lt;&#x2F;h4&gt;
&lt;p&gt;Checks that given player is allowed to order fund requests, for a given wallet.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;walletToFund&lt;&#x2F;td&gt;&lt;td&gt;The wallet to be funded, and checked for approval permission.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;orderer&lt;&#x2F;td&gt;&lt;td&gt;The address of the orderer, to be checked for approval permission.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;retrievefunddata&quot;&gt;retrieveFundData&lt;&#x2F;h4&gt;
&lt;p&gt;Retrieves all the fund request data. Only operator, tokenHolder, and orderer can get the given operation data.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;operationId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID to identify the fund order.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;events&quot;&gt;Events&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;fundordered&quot;&gt;FundOrdered&lt;&#x2F;h4&gt;
&lt;p&gt;Emitted when an token wallet owner orders a funding request.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;operationId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID to identify the request&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;walletToFund&lt;&#x2F;td&gt;&lt;td&gt;The wallet that the player is allowed to start funding requests&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;value&lt;&#x2F;td&gt;&lt;td&gt;The amount to be funded.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;instruction&lt;&#x2F;td&gt;&lt;td&gt;A string including the payment instruction.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;fundinprocess&quot;&gt;FundInProcess&lt;&#x2F;h4&gt;
&lt;p&gt;Emitted when an operator starts a funding request after validating the instruction, and the operation is marked as in process.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;orderer&lt;&#x2F;td&gt;&lt;td&gt;The address of the fund request orderer.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;operationId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID to identify the fund.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;fundexecuted&quot;&gt;FundExecuted&lt;&#x2F;h4&gt;
&lt;p&gt;Emitted when an operator has executed a funding request.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;orderer&lt;&#x2F;td&gt;&lt;td&gt;The address of the fund request orderer.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;operationId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID to identify the fund.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;fundrejected&quot;&gt;FundRejected&lt;&#x2F;h4&gt;
&lt;p&gt;Emitted when an operator has rejected a funding request.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;orderer&lt;&#x2F;td&gt;&lt;td&gt;The address of the fund request orderer.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;operationId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID to identify the fund.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;reason&lt;&#x2F;td&gt;&lt;td&gt;The specific reason that explains why the fund request was rejected. EIP 1066 codes can be used&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;fundcancelled&quot;&gt;FundCancelled&lt;&#x2F;h4&gt;
&lt;p&gt;Emitted when a token holder, orderer,  has cancelled a funding request. This can only be done if the operator hasn&#x27;t put the funding order in process.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;orderer&lt;&#x2F;td&gt;&lt;td&gt;The address of the fund request orderer.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;operationId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID to identify the fund.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;fundoperatorauthorized&quot;&gt;FundOperatorAuthorized&lt;&#x2F;h4&gt;
&lt;p&gt;Emitted when a given player, operator, company or a given persona, has been approved to start fund request for a given token holder.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;walletToFund&lt;&#x2F;td&gt;&lt;td&gt;The wallet that the player is allowed to start funding requests&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;orderer&lt;&#x2F;td&gt;&lt;td&gt;The address that allows the player to start requests.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;fundoperatorrevoked&quot;&gt;FundOperatorRevoked&lt;&#x2F;h4&gt;
&lt;p&gt;Emitted when a given player has been revoked initiate funding requests.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;walletToFund&lt;&#x2F;td&gt;&lt;td&gt;The wallet that the player is allowed to start funding requests&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;orderer&lt;&#x2F;td&gt;&lt;td&gt;The address that allows the player to start requests.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This standards provides a functionality to allow token holders to start funding requests in a decentralized way.&lt;&#x2F;p&gt;
&lt;p&gt;It&#x27;s important to highlight that the token operator, need to process all funding request, updating the fund status based on the linked payment that will be done.&lt;&#x2F;p&gt;
&lt;p&gt;Funding instruction format is open. ISO payment standard like is a good start point,&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;operationId&lt;&#x2F;code&gt; is a string and not something more gas efficient to allow easy traceability of the hold and allow human readable ids. It is up to the implementer if the string should be stored on-chain or only its hash, as it is enough to identify a hold.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;operationId&lt;&#x2F;code&gt; is a competitive resource. It is recommended, but not required, that the hold issuers used a unique prefix to avoid collisions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is fully backwards compatible as its implementation extends the functionality of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The GitHub repository &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;IoBuilders&#x2F;fundable-token&quot;&gt;IoBuilders&#x2F;fundable-token&lt;&#x2F;a&gt; contains the work in progress implementation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;contributors&quot;&gt;Contributors&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal has been collaboratively implemented by &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;adhara.io&#x2F;&quot;&gt;adhara.io&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;io.builders&#x2F;&quot;&gt;io.builders&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>E-Money Standard Token</title>
        <published>2019-05-10T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Julio Faura</name><email>julio@adhara.io</email>
	</author>
	
	<author>
		<name>Fernando Paris</name><email>fer@io.builders</email>
	</author>
	
	<author>
		<name>Daniel Lehrner</name><email>daniel@io.builders</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2020/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/2407" />
        

        <id>https://wg-eips.ritovision.com/2020/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:2020"
            label="ERC-2020" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2020/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;The E-Money Standard Token aims to enable the issuance of regulated electronic money on blockchain networks, and its practical usage in real financial applications.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;actors&quot;&gt;Actors&lt;&#x2F;h2&gt;
&lt;h4 id=&quot;operator&quot;&gt;Operator&lt;&#x2F;h4&gt;
&lt;p&gt;An account, which has been approved by an account to perform an action on the behalf of another account.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Financial institutions work today with electronic systems, which hold account balances in databases on core banking systems. In order for an institution to be allowed to maintain records of client balances segregated and available for clients, such institution must be regulated under a known legal framework and must possess a license to do so. Maintaining a license under regulatory supervision entails ensuring compliance (i.e. performing KYC on all clients and ensuring good AML practices before allowing transactions) and demonstrating technical and operational solvency through periodic audits, so clients depositing funds with the institution can rest assured that their money is safe.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;There are only a number of potential regulatory license frameworks that allow institutions to issue and hold money balances for customers (be it retail corporate or institutional types). The most important and practical ones are three:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Electronic money entities&lt;&#x2F;strong&gt;: these are legally regulated vehicles that are mostly used today for cash and payments services, instead of more complex financial services. For example prepaid cards or online payment systems such as PayPal run on such schemes. In most jurisdictions, electronic money balances are required to be 100% backed by assets, which often entails holding cash on an omnibus account at a bank with 100% of the funds issued to clients in the electronic money ledger.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Banking licenses&lt;&#x2F;strong&gt;: these include commercial and investment banks, which segregate client funds using current and other type of accounts implemented on core banking systems. Banks can create money by lending to clients, so bank money can be backed by promises to pay and other illiquid assets.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Central banks&lt;&#x2F;strong&gt;: central banks hold balances for banks in RTGS systems, similar to core banking systems but with much more restricted yet critical functionality. Central banks create money by lending it to banks, which pledge their assets to central banks as a lender of last resort for an official interest rate.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Regulations for all these types of electronic money are local, i.e. only valid for each jurisdiction and not valid in others. Regulations can vary as well dramatically in different jurisdictions — for example there are places with no electronic money frameworks, on everything has to be done through banking licenses or directly with a central bank. But in all cases compliance with existing regulation needs to ensured, in particular:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Know Your Customer (KYC)&lt;&#x2F;strong&gt;: the institution needs to identify the client before providing them with the possibility of depositing money or transact. In different jurisdictions and for different types of licenses there are different levels of balance and activity that can be allowed for different levels of KYC. For example, low KYC requirements with little checks or even no checks at all can usually be acceptable in many jurisdictions if cashin balances are kept low (i.e. hundreds of dollars)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Anti Money Laundering (AML)&lt;&#x2F;strong&gt;: the institution needs to perform checks of parties transacting with its clients, typically checking against black lists and doing sanction screening, most notably in the context of international transactions&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Beyond cash, financial instruments such as equities or bonds are also registered in electronic systems in most cases, although all these systems and the bank accounting systems are only connected through rudimentary messaging means, which leads to the need for reconciliations and manual management in many cases. Cash systems to provide settlement of transactions in the capital markets are not well-connected to the transactional systems, and often entail delays and settlement risk.&lt;&#x2F;p&gt;
&lt;p&gt;The E-Money Standard Token builds on Ethereum standards currently in use such as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;, but it extends them to provide few key additional pieces of functionality, needed in the regulated financial world:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Compliance&lt;&#x2F;strong&gt;: E-Money Standard Token implements a set of methods to check in advance whether user-initiated transactions can be done from a compliance point of view. Implementations must &lt;code&gt;require&lt;&#x2F;code&gt; that these methods return a positive answer before executing the transaction.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Clearing&lt;&#x2F;strong&gt;: In addition to the standard &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; &lt;code&gt;transfer&lt;&#x2F;code&gt; method, E-Money Standard Token provides a way to submit transfers that need to be cleared by the token issuing authority off-chain. These transfers are then executed in two steps:
&lt;ol&gt;
&lt;li&gt;transfers are ordered&lt;&#x2F;li&gt;
&lt;li&gt;after clearing them, transfers are executed or rejected by the operator of the token contract&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Holds&lt;&#x2F;strong&gt;: token balances can be put on hold, which will make the held amount unavailable for further use until the hold is resolved (i.e. either executed or released). Holds have a payer, a payee, and a notary who is in charge of resolving the hold. Holds also implement expiration periods, after which anyone can release the hold Holds are similar to escrows in that are firm and lead to final settlement. Holds can also be used to implement collateralization.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Funding requests&lt;&#x2F;strong&gt;: users can request for a wallet to be funded by calling the smart contract and attaching a debit instruction string. The tokenizer reads this request, interprets the debit instructions, and triggers a transfer in the bank ledger to initiate the tokenization process.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Payouts&lt;&#x2F;strong&gt;: users can request payouts by calling the smart contract and attaching a payment instruction string. The (de)tokenizer reads this request, interprets the payment instructions, and triggers the transfer of funds (typically from the omnibus account) into the destination account, if possible. Note that a redemption request is a special type of payout in which the destination (bank) account for the payout is the bank account linked to the token wallet.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The E-Money Standard Token is thus different from other tokens commonly referred to as &quot;stable coins&quot; in that it is designed to be issued, burnt and made available to users in a compliant manner (i.e. with full KYC and AML compliance) through a licensed vehicle (an electronic money entity, a bank, or a central bank), and in that it provides the additional functionality described above, so it can be used by other smart contracts implementing more complex financial applications such as interbank payments, supply chain finance instruments, or the creation of E-Money Standard Token denominated bonds and equities with automatic delivery-vs-payment.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EMoneyToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is ERC-1996, ERC-2018, ERC-2019, ERC-2021 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; currency&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; version&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; availableFunds&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checkTransferAllowed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; status&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checkApproveAllowed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; status&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checkHoldAllowed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; notary&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; status&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checkAuthorizeHoldOperatorAllowed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; status&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checkOrderTransferAllowed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; status&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checkAuthorizeClearableTransferOperatorAllowed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; status&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checkOrderFundAllowed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; status&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checkAuthorizeFundOperatorAllowed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; status&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checkOrderPayoutAllowed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; status&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checkAuthorizePayoutOperatorAllowed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; status&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;mandatory-checks&quot;&gt;Mandatory checks&lt;&#x2F;h3&gt;
&lt;p&gt;The checks must be verified in their corresponding actions. The action must only be successful if the check return an &lt;code&gt;Allowed&lt;&#x2F;code&gt; status code. In any other case the functions must revert.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;status-codes&quot;&gt;Status codes&lt;&#x2F;h3&gt;
&lt;p&gt;If an action is allowed &lt;code&gt;0x11&lt;&#x2F;code&gt; (Allowed), or an issuer-specific code with equivalent but more precise meaning must be returned. If the action is not allowed the status must be &lt;code&gt;0x10&lt;&#x2F;code&gt; (Disallowed), or an issuer-specific code with equivalent but more precise meaning.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;functions&quot;&gt;Functions&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;currency&quot;&gt;currency&lt;&#x2F;h4&gt;
&lt;p&gt;Returns the currency that backs the token. The value must be a code defined in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;ISO_4217&quot;&gt;ISO 4217&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;-&lt;&#x2F;td&gt;&lt;td&gt;-&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;version&quot;&gt;version&lt;&#x2F;h4&gt;
&lt;p&gt;Returns the current version of the smart contract. The format of the version is up to the implementer of the EIP.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;-&lt;&#x2F;td&gt;&lt;td&gt;-&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;availablefunds&quot;&gt;availableFunds&lt;&#x2F;h4&gt;
&lt;p&gt;Returns the total net funds of an account. Taking into consideration the outright balance and the held balances.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;account&lt;&#x2F;td&gt;&lt;td&gt;The account which available funds should be returned&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;checktransferallowed&quot;&gt;checkTransferAllowed&lt;&#x2F;h4&gt;
&lt;p&gt;Checks if the &lt;code&gt;transfer&lt;&#x2F;code&gt; or &lt;code&gt;transferFrom&lt;&#x2F;code&gt; function is allowed to be executed with the given parameters.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;from&lt;&#x2F;td&gt;&lt;td&gt;The address of the payer, from whom the tokens are to be taken if executed&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;to&lt;&#x2F;td&gt;&lt;td&gt;The address of the payee, to whom the tokens are to be transferred if executed&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;value&lt;&#x2F;td&gt;&lt;td&gt;The amount to be transferred&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;checkapproveallowed&quot;&gt;checkApproveAllowed&lt;&#x2F;h4&gt;
&lt;p&gt;Checks if the &lt;code&gt;approve&lt;&#x2F;code&gt; function is allowed to be executed with the given parameters.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;from&lt;&#x2F;td&gt;&lt;td&gt;The address of the payer, from whom the tokens are to be taken if executed&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;spender&lt;&#x2F;td&gt;&lt;td&gt;The address of the spender, which potentially can initiate transfers on behalf of &lt;code&gt;from&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;value&lt;&#x2F;td&gt;&lt;td&gt;The maximum amount to be transferred&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;checkholdallowed&quot;&gt;checkHoldAllowed&lt;&#x2F;h4&gt;
&lt;p&gt;Checks if the &lt;code&gt;hold&lt;&#x2F;code&gt; function is allowed to be executed with the given parameters.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;from&lt;&#x2F;td&gt;&lt;td&gt;The address of the payer, from whom the tokens are to be taken if executed&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;to&lt;&#x2F;td&gt;&lt;td&gt;The address of the payee, to whom the tokens are to be transferred if executed&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;notary&lt;&#x2F;td&gt;&lt;td&gt;The address of the notary who is going to determine whether the hold is to be executed or released&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;value&lt;&#x2F;td&gt;&lt;td&gt;The amount to be transferred. Must be less or equal than the balance of the payer&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;checkauthorizeholdoperatorallowed&quot;&gt;checkAuthorizeHoldOperatorAllowed&lt;&#x2F;h4&gt;
&lt;p&gt;Checks if the &lt;code&gt;checkAuthorizeHoldOperatorAllowed&lt;&#x2F;code&gt; function is allowed to be executed with the given parameters.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;operator&lt;&#x2F;td&gt;&lt;td&gt;The address to be approved as operator of clearable transfers&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;from&lt;&#x2F;td&gt;&lt;td&gt;The address on which behalf holds could potentially be issued&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;checkordertransferallowed&quot;&gt;checkOrderTransferAllowed&lt;&#x2F;h4&gt;
&lt;p&gt;Checks if the &lt;code&gt;orderTransfer&lt;&#x2F;code&gt; function is allowed to be executed with the given parameters.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;from&lt;&#x2F;td&gt;&lt;td&gt;The address of the payer, from whom the tokens are to be taken if executed&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;to&lt;&#x2F;td&gt;&lt;td&gt;The address of the payee, to whom the tokens are to be paid if executed&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;value&lt;&#x2F;td&gt;&lt;td&gt;The amount to be transferred. Must be less or equal than the balance of the payer&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;checkauthorizeclearabletransferoperatorallowed&quot;&gt;checkAuthorizeClearableTransferOperatorAllowed&lt;&#x2F;h4&gt;
&lt;p&gt;Checks if the &lt;code&gt;authorizeClearableTransferOperator&lt;&#x2F;code&gt; function is allowed to be executed with the given parameters.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;operator&lt;&#x2F;td&gt;&lt;td&gt;The address to be approved as operator of clearable transfers&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;from&lt;&#x2F;td&gt;&lt;td&gt;The address on which behalf clearable transfers could potentially be ordered&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;checkorderfundallowed&quot;&gt;checkOrderFundAllowed&lt;&#x2F;h4&gt;
&lt;p&gt;Checks if the &lt;code&gt;orderFund&lt;&#x2F;code&gt; function is allowed to be executed with the given parameters.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;to&lt;&#x2F;td&gt;&lt;td&gt;The address to which the tokens are to be given if executed&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;operator&lt;&#x2F;td&gt;&lt;td&gt;The address of the requester, which initiates the funding order&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;value&lt;&#x2F;td&gt;&lt;td&gt;The amount to be funded&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;checkauthorizefundoperatorallowed&quot;&gt;checkAuthorizeFundOperatorAllowed&lt;&#x2F;h4&gt;
&lt;p&gt;Checks if the &lt;code&gt;authorizeFundOperator&lt;&#x2F;code&gt; function is allowed to be executed with the given parameters.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;operator&lt;&#x2F;td&gt;&lt;td&gt;The address to be approved as operator of ordering funding&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;to&lt;&#x2F;td&gt;&lt;td&gt;The address which the tokens are to be given if executed&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;checkorderpayoutallowed&quot;&gt;checkOrderPayoutAllowed&lt;&#x2F;h4&gt;
&lt;p&gt;Checks if the &lt;code&gt;orderPayout&lt;&#x2F;code&gt; function is allowed to be executed with the given parameters.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;from&lt;&#x2F;td&gt;&lt;td&gt;The address from whom the tokens are to be taken if executed&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;operator&lt;&#x2F;td&gt;&lt;td&gt;The address of the requester, which initiates the payout request&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;value&lt;&#x2F;td&gt;&lt;td&gt;The amount to be paid out&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;checkauthorizepayoutoperatorallowed&quot;&gt;checkAuthorizePayoutOperatorAllowed&lt;&#x2F;h4&gt;
&lt;p&gt;Checks if the &lt;code&gt;authorizePayoutOperator&lt;&#x2F;code&gt; function is allowed to be executed with the given parameters.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;operator&lt;&#x2F;td&gt;&lt;td&gt;The address to be approved as operator of ordering payouts&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;from&lt;&#x2F;td&gt;&lt;td&gt;The address from which the tokens are to be taken if executed&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP unifies &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1996&#x2F;&quot;&gt;ERC-1996&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2018&#x2F;&quot;&gt;ERC-2018&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2019&#x2F;&quot;&gt;ERC-2019&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2021&#x2F;&quot;&gt;ERC-2021&lt;&#x2F;a&gt; and adds the checks for the compliance on top of it. By this way the separate EIPs are otherwise independent of each other, and the E-Money Standard Token offers a solution for all necessary functionality of regulated electronic money.&lt;&#x2F;p&gt;
&lt;p&gt;While not requiring it, the naming of the check functions was adopted from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1462&#x2F;&quot;&gt;ERC-1462&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is fully backwards compatible as its implementation extends the functionality of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1996&#x2F;&quot;&gt;ERC-1996&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2018&#x2F;&quot;&gt;ERC-2018&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2019&#x2F;&quot;&gt;ERC-2019&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2021&#x2F;&quot;&gt;ERC-2021&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1066&#x2F;&quot;&gt;ERC-1066&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The GitHub repository &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;IoBuilders&#x2F;em-token&quot;&gt;IoBuilders&#x2F;em-token&lt;&#x2F;a&gt; contains the work in progress implementation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;contributors&quot;&gt;Contributors&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal has been collaboratively implemented by &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;adhara.io&#x2F;&quot;&gt;adhara.io&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;io.builders&#x2F;&quot;&gt;io.builders&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Payoutable Token</title>
        <published>2019-05-10T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Fernando Paris</name><email>fer@io.builders</email>
	</author>
	
	<author>
		<name>Julio Faura</name><email>julio@adhara.io</email>
	</author>
	
	<author>
		<name>Daniel Lehrner</name><email>daniel@io.builders</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2021/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/2106" />
        

        <id>https://wg-eips.ritovision.com/2021/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2021"
            label="ERC-2021" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2021/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;An extension to the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; standard token that allows Token wallet owners to request payout from their wallet, by calling the smart contract and attaching a payout instruction string.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;actors&quot;&gt;Actors&lt;&#x2F;h2&gt;
&lt;h4 id=&quot;token-wallet-owners&quot;&gt;Token Wallet Owners&lt;&#x2F;h4&gt;
&lt;p&gt;The person or company who owns the wallet, and will order payout.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;token-contract-owner-agent&quot;&gt;Token contract owner &#x2F; agent&lt;&#x2F;h4&gt;
&lt;p&gt;The entity, company responsible&#x2F;owner of the token contract, and token issuing&#x2F;minting. This actor is in charge of trying to fulfill all payout request(s), reading the payout instruction(s), and correlate the payout details.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;orderer&quot;&gt;Orderer&lt;&#x2F;h4&gt;
&lt;p&gt;An actor who is enabled to initiate payout orders on behalf of a token wallet owner.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Token wallet owners (or approved addresses) can order payout requests through  blockchain. This is done by calling the &lt;code&gt;orderPayoutFrom&lt;&#x2F;code&gt; or &lt;code&gt;orderPayoutFrom&lt;&#x2F;code&gt; methods, which initiate the workflow for the token contract operator to either honor or reject the payout request. In this case, payout instructions are provided when submitting the request, which are used by the operator to determine the destination of the funds.&lt;&#x2F;p&gt;
&lt;p&gt;In general, it is not advisable to place explicit routing instructions for the payouts on a verbatim basis on the blockchain, and it is advised to use a private communication alternatives, such as private channels, encrypted storage or similar, to do so (external to the blockchain ledger). Another (less desirable) possibility is to place these instructions on the instructions field in encrypted form.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Nowadays most of the token payout requests, need a previous centralized transaction, to be able to define the payout destination to be able to execute the payout (burn transaction).
In the aim of trying to bring all the needed steps into decentralization, exposing all the needed steps of token lifecycle and payment transactions, a payout request can allow wallet owner to initiate the payout order via blockchain.
Key benefits:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Payout, burning  traceability is enhanced bringing the initiation into the ledger. All payment, payout statuses can be stored on chain.&lt;&#x2F;li&gt;
&lt;li&gt;Almost all money&#x2F;token lifecycle is covered via a decentralized approach, complemented with private communications which is common use in the ecosystem.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In this case, the following movement of tokens are done as the process progresses:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Upon launch of the payout request, the appropriate amount of funds are placed on a hold with a predefined notary defined by the platform, and the payout is placed into a &lt;code&gt;Ordered&lt;&#x2F;code&gt; state&lt;&#x2F;li&gt;
&lt;li&gt;The operator then can put the payout request &lt;code&gt;InProcess&lt;&#x2F;code&gt;, which prevents the &lt;em&gt;orderer&lt;&#x2F;em&gt; of the payout from being able to cancel the payout request&lt;&#x2F;li&gt;
&lt;li&gt;After checking the payout is actually possible the operator then executes the hold, which moves the funds to a suspense wallet and places the payout into the &lt;code&gt;FundsInSuspense&lt;&#x2F;code&gt; state&lt;&#x2F;li&gt;
&lt;li&gt;The operator then moves the funds offchain (usually from the omnibus account)  to the appropriate destination account, then burning the tokens from the suspense wallet and rendering the payout into the &lt;code&gt;Executed&lt;&#x2F;code&gt; state&lt;&#x2F;li&gt;
&lt;li&gt;Either before or after placing the request &lt;code&gt;InProcess&lt;&#x2F;code&gt;, the operator can also reject the payout, which returns the funds to the payer and eliminates the hold. The resulting end state of the payout is &lt;code&gt;Rejected&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;When the payout is &lt;code&gt;Ordered&lt;&#x2F;code&gt; and before the operator places it into the &lt;code&gt;InProcess&lt;&#x2F;code&gt; state, the orderer of the payout can also cancel it, which frees up the hold and puts the payout into the final &lt;code&gt;Cancelled&lt;&#x2F;code&gt; state&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IPayoutable&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is ERC-20 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PayoutStatusCode&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        Nonexistent&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        Ordered&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        InProcess&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        FundsInSuspense&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        Executed&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        Rejected&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        Cancelled&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; authorizePayoutOperator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; orderer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revokePayoutOperator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; orderer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; orderPayout&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operationId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; instructions&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; orderPayoutFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operationId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; walletToBePaidOut&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; instructions&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; cancelPayout&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operationId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; processPayout&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operationId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; putFundsInSuspenseInPayout&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operationId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; executePayout&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operationId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; rejectPayout&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operationId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; reason&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isPayoutOperatorFor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; walletToDebit&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; orderer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; retrievePayoutData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operationId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; walletToDebit&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; instructions&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; PayoutStatusCode&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; status&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PayoutOrdered&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; orderer&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operationId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; walletToDebit&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; instructions&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PayoutInProcess&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; orderer&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operationId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PayoutFundsInSuspense&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; orderer&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operationId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PayoutExecuted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; orderer&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operationId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PayoutRejected&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; orderer&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operationId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; reason&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PayoutCancelled&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; orderer&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operationId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PayoutOperatorAuthorized&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; walletToBePaidOut&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; orderer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PayoutOperatorRevoked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; walletToBePaidOut&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; orderer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;functions&quot;&gt;Functions&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;authorizepayoutoperator&quot;&gt;authorizePayoutOperator&lt;&#x2F;h4&gt;
&lt;p&gt;Wallet owner, allows a given address to be payout orderer.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;orderer&lt;&#x2F;td&gt;&lt;td&gt;The address of the orderer.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;revokepayoutoperator&quot;&gt;revokePayoutOperator&lt;&#x2F;h4&gt;
&lt;p&gt;Wallet owner, Revokes a given address to be payout orderer.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;orderer&lt;&#x2F;td&gt;&lt;td&gt;The address of the orderer.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;orderpayout&quot;&gt;orderPayout&lt;&#x2F;h4&gt;
&lt;p&gt;Creates a payout request, that will be processed by the token operator. The function must revert if the operation ID has been used before.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;operationId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID to identify the request&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;value&lt;&#x2F;td&gt;&lt;td&gt;The amount to be paid out.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;instruction&lt;&#x2F;td&gt;&lt;td&gt;A string including the payment instruction.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;orderpayoutfrom&quot;&gt;orderPayoutFrom&lt;&#x2F;h4&gt;
&lt;p&gt;Creates a payout request, on behalf of a wallet owner, that will be processed by the token operator. The function must revert if the operation ID has been used before.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;operationId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID to identify the request&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;walletToBePaidOut&lt;&#x2F;td&gt;&lt;td&gt;The wallet to be paid out on behalf.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;value&lt;&#x2F;td&gt;&lt;td&gt;The amount to be paid out.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;instruction&lt;&#x2F;td&gt;&lt;td&gt;A string including the payment instruction.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;cancelpayout&quot;&gt;cancelPayout&lt;&#x2F;h4&gt;
&lt;p&gt;Cancels a payout request.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;operationId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID to identify the request that is going to be cancelled. This can only be done by token holder, or the payout initiator&#x2F;orderer.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;reason&lt;&#x2F;td&gt;&lt;td&gt;The specific reason that explains why the payout request was rejected. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1066&#x2F;&quot;&gt;EIP-1066&lt;&#x2F;a&gt; codes can be used.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;processpayout&quot;&gt;processPayout&lt;&#x2F;h4&gt;
&lt;p&gt;Marks a payout request as on process. After the status is on process, order cannot be cancelled.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;operationId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID to identify that the request is in process.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;putfundsinsuspenseinpayout&quot;&gt;putFundsInSuspenseInPayout&lt;&#x2F;h4&gt;
&lt;p&gt;Put a given payout in suspense. Can only be done if it is in process.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;operationId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID to identify that the request is in process.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;executepayout&quot;&gt;executePayout&lt;&#x2F;h4&gt;
&lt;p&gt;Burn the amount of tokens and marks a payout request as executed.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;operationId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID to identify the request that has been executed.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;rejectpayout&quot;&gt;rejectPayout&lt;&#x2F;h4&gt;
&lt;p&gt;Rejects a given operation with a reason.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;operationId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID to identify the request that has been executed.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;reason&lt;&#x2F;td&gt;&lt;td&gt;The specific reason that explains why the payout request was rejected. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1066&#x2F;&quot;&gt;EIP-1066&lt;&#x2F;a&gt; codes can be used&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;isapprovedtoorderpayout&quot;&gt;isApprovedToOrderPayout&lt;&#x2F;h4&gt;
&lt;p&gt;Checks that given player is allowed to order payout  requests, for a given wallet.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;walletToBePaidOut&lt;&#x2F;td&gt;&lt;td&gt;The wallet to be paid out, and checked for approval permission.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;orderer&lt;&#x2F;td&gt;&lt;td&gt;The address of the orderer, to be checked for approval permission.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;retrievepayoutdata&quot;&gt;retrievePayoutData&lt;&#x2F;h4&gt;
&lt;p&gt;Retrieves all the payout request data. Only operator, tokenHolder, and orderer can get the given operation data.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;orderer&lt;&#x2F;td&gt;&lt;td&gt;The address of the orderer, to correlate the right data.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;operationId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID to identify the payout order.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;events&quot;&gt;Events&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;payout-ordered&quot;&gt;Payout Ordered&lt;&#x2F;h4&gt;
&lt;p&gt;Emitted when an token wallet owner orders a payout request.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;operationId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID to identify the request&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;walletToBePaidOut&lt;&#x2F;td&gt;&lt;td&gt;The wallet that is requested to be paid out&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;value&lt;&#x2F;td&gt;&lt;td&gt;The amount to be funded.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;instruction&lt;&#x2F;td&gt;&lt;td&gt;A string including the payment instruction.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;payoutfundsinsuspense&quot;&gt;PayoutFundsInSuspense&lt;&#x2F;h4&gt;
&lt;p&gt;Emitted when an operator puts fund in suspense.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;orderer&lt;&#x2F;td&gt;&lt;td&gt;The address of the payout request orderer.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;operationId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID to identify the payout.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;payoutinprocess&quot;&gt;PayoutInProcess&lt;&#x2F;h4&gt;
&lt;p&gt;Emitted when an operator accepts a payout request, and the operation is in process.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;orderer&lt;&#x2F;td&gt;&lt;td&gt;The address of the payout request orderer.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;operationId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID to identify the payout.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;payoutexecuted&quot;&gt;PayoutExecuted&lt;&#x2F;h4&gt;
&lt;p&gt;Emitted when an operator has executed a payout request.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;orderer&lt;&#x2F;td&gt;&lt;td&gt;The address of the payout request orderer.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;operationId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID to identify the payout.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;payoutrejected&quot;&gt;PayoutRejected&lt;&#x2F;h4&gt;
&lt;p&gt;Emitted when an operator has rejected a payout request.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;orderer&lt;&#x2F;td&gt;&lt;td&gt;The address of the payout request orderer.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;operationId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID to identify the payout.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;reason&lt;&#x2F;td&gt;&lt;td&gt;The specific reason that explains why the payout request was rejected. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1066&#x2F;&quot;&gt;EIP-1066&lt;&#x2F;a&gt; codes can be used&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;payoutcancelled&quot;&gt;PayoutCancelled&lt;&#x2F;h4&gt;
&lt;p&gt;Emitted when a token holder, orderer,  has cancelled a payout request. This can only be done if the operator hasn&#x27;t put the payout order in process.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;orderer&lt;&#x2F;td&gt;&lt;td&gt;The address of the payout request orderer.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;operationId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID per payout issuer to identify the payout.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;payoutoperatorauthorized&quot;&gt;PayoutOperatorAuthorized&lt;&#x2F;h4&gt;
&lt;p&gt;Emitted when a given player, operator, company or a given persona, has been approved to start payout request for a given token holder.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;walletToBePaidOut&lt;&#x2F;td&gt;&lt;td&gt;The wallet that the player is allowed to start payout requests&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;orderer&lt;&#x2F;td&gt;&lt;td&gt;The address that allows the player to start requests.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;payoutoperatorrevoked&quot;&gt;PayoutOperatorRevoked&lt;&#x2F;h4&gt;
&lt;p&gt;Emitted when a given player has been revoked initiate payout requests.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;walletToBePaidOut&lt;&#x2F;td&gt;&lt;td&gt;The wallet that the player is allowed to start payout requests&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;orderer&lt;&#x2F;td&gt;&lt;td&gt;The address that allows the player to start requests.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This standards provides a functionality to allow token holders to start payout requests in a decentralized way.&lt;&#x2F;p&gt;
&lt;p&gt;It&#x27;s important to highlight that the token operator, need to process all payout request, updating the payout status based on the linked payment that will be done.&lt;&#x2F;p&gt;
&lt;p&gt;Payout instruction format is open. ISO payment standard like is a good start point.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP uses &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1996&#x2F;&quot;&gt;EIP-1996&lt;&#x2F;a&gt; to hold the money after a payout is ordered. The token contract owner or agent, whose implementation is not part of this proposal, acts as a predefined notary to decide if the payout is executed or not.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;operationId&lt;&#x2F;code&gt; is a string and not something more gas efficient to allow easy traceability of the hold and allow human readable ids. It is up to the implementer if the string should be stored on-chain or only its hash, as it is enough to identify a hold.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;operationId&lt;&#x2F;code&gt; is a competitive resource. It is recommended, but not required, that the hold issuers used a unique prefix to avoid collisions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is fully backwards compatible as its implementation extends the functionality of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; and [ERC-1996].&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The GitHub repository &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;IoBuilders&#x2F;payoutable-token&quot;&gt;IoBuilders&#x2F;payoutable-token&lt;&#x2F;a&gt; contains the reference implementation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;contributors&quot;&gt;Contributors&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal has been collaboratively implemented by &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;adhara.io&#x2F;&quot;&gt;adhara.io&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;io.builders&#x2F;&quot;&gt;io.builders&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EVMC modules for implementations of precompiled contracts</title>
        <published>2019-05-09T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Paweł Bylica</name><uri>https://github.com/chfast</uri>
	</author>
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2003/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/evmc/issues/259" />
        

        <id>https://wg-eips.ritovision.com/2003/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="interface"
                label="Interface" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:2003"
            label="EIP-2003" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2003/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;evmc&quot;&gt;EVMC&lt;&#x2F;a&gt; specifies a generic API for Ethereum execution engines.
This EIP specifies a way of providing implementations of Ethereum precompiled contracts
using the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum.github.io&#x2F;evmc&#x2F;vmguide.html&quot;&gt;EVMC VM API&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;For the complete &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;evmc&quot;&gt;EVMC&lt;&#x2F;a&gt; specification visit the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum.github.io&#x2F;evmc&#x2F;&quot;&gt;EVMC documentation&lt;&#x2F;a&gt; first.
This EIP is based on and is compatible with EVMC ABI version 6.&lt;&#x2F;p&gt;
&lt;p&gt;The EVMC module with implementations of precompiled contracts SHOULD:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Advertise the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum.github.io&#x2F;evmc&#x2F;group__EVMC.html#gga44f9ecb88cf6422a0072936494fd6ac7a43ea2aa7b099a2d67bc53c118ff3683d&quot;&gt;&lt;code&gt;EVMC_CAPABILITY_PRECOMPILES&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; capability
in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum.github.io&#x2F;evmc&#x2F;structevmc__instance.html#ae63b9ca898aa41cbd1e2fe86ca8f4e1c&quot;&gt;&lt;code&gt;get_capabilities()&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; method.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Implement the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum.github.io&#x2F;evmc&#x2F;structevmc__instance.html#a0823ebff21f9b0395b157e8c6b14a207&quot;&gt;&lt;code&gt;execute()&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; method in the following way:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Validate the incoming execution request requirements:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;The message kind (&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum.github.io&#x2F;evmc&#x2F;structevmc__message.html#a691cb93e81d6dfd4fd7e2fa3d06a6bfa&quot;&gt;&lt;code&gt;evmc_message::kind&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;) is a call (&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum.github.io&#x2F;evmc&#x2F;group__EVMC.html#ggab2fa68a92a6828064a61e46060abc634abcf3ae29d9a88ff70b98374fc665694a&quot;&gt;&lt;code&gt;EVMC_CALL&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The call destination address (&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum.github.io&#x2F;evmc&#x2F;structevmc__message.html#a88ecfaa03a85a31c6da36fa043b98cea&quot;&gt;&lt;code&gt;evmc_message::destination&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;)
is within the range of precompiled contracts defined by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1352&#x2F;&quot;&gt;EIP-1352&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;There is no code provided (the &lt;code&gt;code&lt;&#x2F;code&gt; argument is &lt;code&gt;NULL&lt;&#x2F;code&gt; and &lt;code&gt;code_size&lt;&#x2F;code&gt; argument is &lt;code&gt;0&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;If the requirements are not fulfilled, abort execution with the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum.github.io&#x2F;evmc&#x2F;group__EVMC.html#gga4c0be97f333c050ff45321fcaa34d920a2f3e0d8777f8d974ead27ae2a6eb2005&quot;&gt;&lt;code&gt;EVMC_REJECTED&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; status code.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Check if the call destination address (&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum.github.io&#x2F;evmc&#x2F;structevmc__message.html#a88ecfaa03a85a31c6da36fa043b98cea&quot;&gt;&lt;code&gt;evmc_message::destination&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;)
targets existing precompiled contract.
Consider the EVM revision (&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum.github.io&#x2F;evmc&#x2F;group__EVMC.html#gae5759b1590071966ccf6a505b52a0ef7&quot;&gt;&lt;code&gt;evmc_revision&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;) requested by
the &lt;code&gt;rev&lt;&#x2F;code&gt; parameter of &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum.github.io&#x2F;evmc&#x2F;structevmc__instance.html#a0823ebff21f9b0395b157e8c6b14a207&quot;&gt;&lt;code&gt;execute()&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;If yes, execute as follows:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Inspect the input data (&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum.github.io&#x2F;evmc&#x2F;structevmc__message.html#a1adee3454b105eb29cd659ee0cf65c77&quot;&gt;&lt;code&gt;evmc_message::input_data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum.github.io&#x2F;evmc&#x2F;structevmc__message.html#a2cf1deebd0dbbb20f25ecdfa299f4b5d&quot;&gt;&lt;code&gt;evmc_message::input_size&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;)
and calculate the &lt;em&gt;gas cost&lt;&#x2F;em&gt; of the execution.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Compute the amount of &lt;em&gt;gas left&lt;&#x2F;em&gt; after execution by
subtracting the &lt;em&gt;gas cost&lt;&#x2F;em&gt; from the call gas limit (&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum.github.io&#x2F;evmc&#x2F;structevmc__message.html#ae8deff46588584fa27890e74c82db5e7&quot;&gt;&lt;code&gt;evmc_message::gas&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;If &lt;em&gt;gas left&lt;&#x2F;em&gt; is negative,
abort execution with the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum.github.io&#x2F;evmc&#x2F;group__EVMC.html#gga4c0be97f333c050ff45321fcaa34d920abfc47f75656c996c0b29c0553c00fc18&quot;&gt;&lt;code&gt;EVMC_OUT_OF_GAS&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; status code.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Otherwise,
execute the code of the precompiled contract,
return the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum.github.io&#x2F;evmc&#x2F;group__EVMC.html#gga4c0be97f333c050ff45321fcaa34d920a4bc3069fec2bab2a55355a72b7db68b7&quot;&gt;&lt;code&gt;EVMC_SUCCESS&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; status code, the output and &lt;em&gt;gas left&lt;&#x2F;em&gt;
(&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum.github.io&#x2F;evmc&#x2F;structevmc__result.html#a61978e85f9d795a7b9695b9cbf1748d6&quot;&gt;&lt;code&gt;evmc_result::output_data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum.github.io&#x2F;evmc&#x2F;structevmc__result.html#a93bb7419aff492cdef754421c6d74e26&quot;&gt;&lt;code&gt;evmc_result::output_size&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum.github.io&#x2F;evmc&#x2F;structevmc__result.html#af8478c93dbcc3cb2876037c5a5afd4c0&quot;&gt;&lt;code&gt;evmc_result::gas_left&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Otherwise, emulate execution of empty code by returning
the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum.github.io&#x2F;evmc&#x2F;group__EVMC.html#gga4c0be97f333c050ff45321fcaa34d920a4bc3069fec2bab2a55355a72b7db68b7&quot;&gt;&lt;code&gt;EVMC_SUCCESS&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; status code
and &lt;em&gt;gas left&lt;&#x2F;em&gt; equal the call gas limit (&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum.github.io&#x2F;evmc&#x2F;structevmc__message.html#ae8deff46588584fa27890e74c82db5e7&quot;&gt;&lt;code&gt;evmc_message::gas&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Precompiled contract implementations are allowed to return two more EVMC error codes:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum.github.io&#x2F;evmc&#x2F;group__EVMC.html#gga4c0be97f333c050ff45321fcaa34d920aed5b2a4afa5a47af732569445920a4a9&quot;&gt;&lt;code&gt;EVMC_FAILURE&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; if the failure was caused due to something other than out of gas (e.g. input validation error)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum.github.io&#x2F;evmc&#x2F;group__EVMC.html#gga4c0be97f333c050ff45321fcaa34d920aed708e84d49cc1270e54ec20b0ca0a05&quot;&gt;&lt;code&gt;EVMC_REVERT&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; if the precompile doesn&#x27;t want to forfeit all supplied gas (as of May 2019 no such precompile exists)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The Client is not required to provide the Host interface ([&lt;code&gt;evmc_context&lt;&#x2F;code&gt;] argument of &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum.github.io&#x2F;evmc&#x2F;structevmc__instance.html#a0823ebff21f9b0395b157e8c6b14a207&quot;&gt;&lt;code&gt;execute()&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; is set to NULL).
Therefore, the precompiled contracts implementation MUST NOT access the &lt;code&gt;evmc_context&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;It is very unlikely that any precompile will need to access or modify a contract state.
Not requiring the Client to implement the EVMC Host interface removes the big portion of work
needed for full EVMC integration.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;EVMC provides the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;evmc.ethereum.org&#x2F;vmtester.html&quot;&gt;evmc-vmtester&lt;&#x2F;a&gt; tool for checking compatibility with the EVMC specification.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementations&quot;&gt;Implementations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;evmc&#x2F;blob&#x2F;master&#x2F;examples&#x2F;example_precompiles_vm&#x2F;example_precompiles_vm.cpp&quot;&gt;Example of Precompiles VM implementation&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ewasm&#x2F;ewasm-precompiles&quot;&gt;ewasm precompiles&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Aleth code for precompiles&lt;&#x2F;li&gt;
&lt;li&gt;Parity code for precompiles&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;axic&#x2F;eip1962-evmc&quot;&gt;EIP-1962 implemented as an EVMC precompile module&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;evmc&quot;&gt;EVMC – Ethereum Client-VM Connector API&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum.github.io&#x2F;evmc&#x2F;&quot;&gt;EVMC documentation&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum.github.io&#x2F;evmc&#x2F;vmguide.html&quot;&gt;EVMC VM Implementation Guide&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1352&#x2F;&quot;&gt;EIP 1352: Specify restricted address range for precompiles&#x2F;system contracts&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Compliance Service</title>
        <published>2019-05-09T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Daniel Lehrner</name><email>daniel@io.builders</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2009/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/2022" />
        

        <id>https://wg-eips.ritovision.com/2009/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2009"
            label="ERC-2009" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2009/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes a service for decentralized compliance checks for regulated tokens.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;actors&quot;&gt;Actors&lt;&#x2F;h2&gt;
&lt;h4 id=&quot;operator&quot;&gt;Operator&lt;&#x2F;h4&gt;
&lt;p&gt;An account which has been approved by a token to update the tokens accumulated.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;token&quot;&gt;Token&lt;&#x2F;h4&gt;
&lt;p&gt;An account, normally a smart contract, which uses the &lt;code&gt;Compliance Service&lt;&#x2F;code&gt; to check if the an action can be executed or not.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;token-holder&quot;&gt;Token holder&lt;&#x2F;h4&gt;
&lt;p&gt;An account which is in possession of tokens and on for which the checks are made.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;A regulated token needs to comply with several legal requirements, especially &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Know_your_customer&quot;&gt;KYC&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Money_laundering#Anti-money_laundering&quot;&gt;AML&lt;&#x2F;a&gt;. If the necessary checks have to be made off-chain the token transfer becomes centralized. Further the transfer in this case takes longer to complete as it can not be done in one transaction, but requires a second confirmation step. The goal of this proposal is to make this second step unnecessary by providing a service for compliance checks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently there is no proposal on how to accomplish decentralized compliance checks. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1462&#x2F;&quot;&gt;ERC-1462&lt;&#x2F;a&gt; proposes a basic set of functions to check if &lt;code&gt;transfer&lt;&#x2F;code&gt;, &lt;code&gt;mint&lt;&#x2F;code&gt; and &lt;code&gt;burn&lt;&#x2F;code&gt; are allowed for a user, but not how those checks should be implemented. This EIP proposes a way to implement them fully on-chain while being generic enough to leave the actual implementation of the checks up to the implementers, as these may vary a lot between different tokens.&lt;&#x2F;p&gt;
&lt;p&gt;The proposed &lt;code&gt;Compliance Service&lt;&#x2F;code&gt; supports more than one token. Therefore it could be used by law-makers to maintain the compliance rules of regulated tokens in one smart contract. This smart contract could be used by all of the tokens that fall under this jurisdiction and ensure compliance with the current laws.&lt;&#x2F;p&gt;
&lt;p&gt;By having a standard for compliance checks third-party developers can use them to verify if token movements for a specific account are allowed and act accordingly.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CompliantService&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checkTransferAllowed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;byte&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checkTransferFromAllowed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;byte&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checkMintAllowed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;byte&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checkBurnAllowed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;byte&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; updateTransferAccumulated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; updateMintAccumulated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; updateBurnAccumulated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; replaceToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; removeToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getTokenId&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; authorizeAccumulatedOperator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revokeAccumulatedOperator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isAccumulatedOperatorFor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TokenAdded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TokenReplaced&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; previousAddress&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TokenRemoved&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AuthorizedAccumulatedOperator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RevokedAccumulatedOperator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;mandatory-checks&quot;&gt;Mandatory checks&lt;&#x2F;h3&gt;
&lt;p&gt;The checks must be verified in their corresponding actions. The action must only be successful if the check return an &lt;code&gt;Allowed&lt;&#x2F;code&gt; status code. In any other case the functions must revert.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;status-codes&quot;&gt;Status codes&lt;&#x2F;h3&gt;
&lt;p&gt;If an action is allowed &lt;code&gt;0x11&lt;&#x2F;code&gt; (Allowed) or an issuer-specific code with equivalent but more precise meaning must be returned. If the action is not allowed the status must be &lt;code&gt;0x10&lt;&#x2F;code&gt; (Disallowed) or an issuer-specific code with equivalent but more precise meaning.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;functions&quot;&gt;Functions&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;checktransferallowed&quot;&gt;checkTransferAllowed&lt;&#x2F;h4&gt;
&lt;p&gt;Checks if the &lt;code&gt;transfer&lt;&#x2F;code&gt; function is allowed to be executed with the given parameters.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;tokenId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID which identifies a token&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;from&lt;&#x2F;td&gt;&lt;td&gt;The address of the payer, from whom the tokens are to be taken if executed&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;to&lt;&#x2F;td&gt;&lt;td&gt;The address of the payee, to whom the tokens are to be transferred if executed&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;value&lt;&#x2F;td&gt;&lt;td&gt;The amount to be transferred&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;checktransferfromallowed&quot;&gt;checkTransferFromAllowed&lt;&#x2F;h4&gt;
&lt;p&gt;Checks if the &lt;code&gt;transferFrom&lt;&#x2F;code&gt; function is allowed to be executed with the given parameters.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;tokenId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID which identifies a token&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;sender&lt;&#x2F;td&gt;&lt;td&gt;The address of the sender, who initiated the transaction&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;from&lt;&#x2F;td&gt;&lt;td&gt;The address of the payer, from whom the tokens are to be taken if executed&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;to&lt;&#x2F;td&gt;&lt;td&gt;The address of the payee, to whom the tokens are to be transferred if executed&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;value&lt;&#x2F;td&gt;&lt;td&gt;The amount to be transferred&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;checkmintallowed&quot;&gt;checkMintAllowed&lt;&#x2F;h4&gt;
&lt;p&gt;Checks if the &lt;code&gt;mint&lt;&#x2F;code&gt; function is allowed to be executed with the given parameters.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;tokenId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID which identifies a token&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;to&lt;&#x2F;td&gt;&lt;td&gt;The address of the payee, to whom the tokens are to be given if executed&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;value&lt;&#x2F;td&gt;&lt;td&gt;The amount to be minted&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;checkburnallowed&quot;&gt;checkBurnAllowed&lt;&#x2F;h4&gt;
&lt;p&gt;Checks if the &lt;code&gt;burn&lt;&#x2F;code&gt; function is allowed to be executed with the given parameters.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;tokenId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID which identifies a token&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;from&lt;&#x2F;td&gt;&lt;td&gt;The address of the payer, from whom the tokens are to be taken if executed&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;value&lt;&#x2F;td&gt;&lt;td&gt;The amount to be burned&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;updatetransferaccumulated&quot;&gt;updateTransferAccumulated&lt;&#x2F;h4&gt;
&lt;p&gt;Must be called in the same transaction as &lt;code&gt;transfer&lt;&#x2F;code&gt; or &lt;code&gt;transferFrom&lt;&#x2F;code&gt;. It must revert if the update violates any of the compliance rules. It is up to the implementer which specific logic is executed in the function.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;tokenId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID which identifies a token&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;from&lt;&#x2F;td&gt;&lt;td&gt;The address of the payer, from whom the tokens are to be taken if executed&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;to&lt;&#x2F;td&gt;&lt;td&gt;The address of the payee, to whom the tokens are to be transferred if executed&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;value&lt;&#x2F;td&gt;&lt;td&gt;The amount to be transferred&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;updatemintaccumulated&quot;&gt;updateMintAccumulated&lt;&#x2F;h4&gt;
&lt;p&gt;Must be called in the same transaction as &lt;code&gt;mint&lt;&#x2F;code&gt;. It must revert if the update violates any of the compliance rules. It is up to the implementer which specific logic is executed in the function.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;tokenId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID which identifies a token&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;to&lt;&#x2F;td&gt;&lt;td&gt;The address of the payee, to whom the tokens are to be given if executed&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;value&lt;&#x2F;td&gt;&lt;td&gt;The amount to be minted&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;updateburnaccumulated&quot;&gt;updateBurnAccumulated&lt;&#x2F;h4&gt;
&lt;p&gt;Must be called in the same transaction as &lt;code&gt;burn&lt;&#x2F;code&gt;. It must revert if the update violates any of the compliance rules. It is up to the implementer which specific logic is executed in the function.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;tokenId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID which identifies a token&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;from&lt;&#x2F;td&gt;&lt;td&gt;The address of the payer, from whom the tokens are to be taken if executed&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;value&lt;&#x2F;td&gt;&lt;td&gt;The amount to be minted&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;addtoken&quot;&gt;addToken&lt;&#x2F;h4&gt;
&lt;p&gt;Adds a token to the service, which allows the token to call the functions to update the accumulated. If an existing token id is used the function must revert. It is up to the implementer if adding a token should be restricted or not.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;tokenId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID which identifies a token&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;token&lt;&#x2F;td&gt;&lt;td&gt;The address from which the update functions will be called&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;replacetoken&quot;&gt;replaceToken&lt;&#x2F;h4&gt;
&lt;p&gt;Replaces the address of a added token with another one. It is up to the implementer if replacing a token should be restricted or not, but a token should be able to replace its own address.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;tokenId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID which identifies a token&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;token&lt;&#x2F;td&gt;&lt;td&gt;The address from which the update functions will be called&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;removetoken&quot;&gt;removeToken&lt;&#x2F;h4&gt;
&lt;p&gt;Removes a token from the service, which disallows the token to call the functions to update the accumulated. It is up to the implementer if removing a token should be restricted or not.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;tokenId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID which identifies a token&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;istoken&quot;&gt;isToken&lt;&#x2F;h4&gt;
&lt;p&gt;Returns &lt;code&gt;true&lt;&#x2F;code&gt; if the address has been added to the service, &lt;code&gt;false&lt;&#x2F;code&gt; if not.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;token&lt;&#x2F;td&gt;&lt;td&gt;The address which should be checked&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;gettokenid&quot;&gt;getTokenId&lt;&#x2F;h4&gt;
&lt;p&gt;Returns the token id of a token. If the token has not been added to the service, &#x27;0&#x27; must be returned.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;token&lt;&#x2F;td&gt;&lt;td&gt;The address which token id should be returned&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;authorizeaccumulatedoperator&quot;&gt;authorizeAccumulatedOperator&lt;&#x2F;h4&gt;
&lt;p&gt;Approves an operator to update accumulated on behalf of the token id of msg.sender.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;operator&lt;&#x2F;td&gt;&lt;td&gt;The address to be approved as operator of accumulated updates&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;revokeaccumulatedoperator&quot;&gt;revokeAccumulatedOperator&lt;&#x2F;h4&gt;
&lt;p&gt;Revokes the approval to update accumulated on behalf the token id the token id ofof msg.sender.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;operator&lt;&#x2F;td&gt;&lt;td&gt;The address to be revoked as operator of accumulated updates&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;isaccumulatedoperatorfor&quot;&gt;isAccumulatedOperatorFor&lt;&#x2F;h4&gt;
&lt;p&gt;Retrieves if an operator is approved to create holds on behalf of &lt;code&gt;tokenId&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;operator&lt;&#x2F;td&gt;&lt;td&gt;The address which is operator of updating the accumulated&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;tokenId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID which identifies a token&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;events&quot;&gt;Events&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;tokenadded&quot;&gt;TokenAdded&lt;&#x2F;h4&gt;
&lt;p&gt;Must be emitted after a token has been added.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;tokenId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID which identifies a token&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;token&lt;&#x2F;td&gt;&lt;td&gt;The address from which the update functions will be called&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;tokenreplaced&quot;&gt;TokenReplaced&lt;&#x2F;h4&gt;
&lt;p&gt;Must be emitted after the address of a token has been replaced.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;tokenId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID which identifies a token&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;previousAddress&lt;&#x2F;td&gt;&lt;td&gt;The previous address which was used before&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;newAddress&lt;&#x2F;td&gt;&lt;td&gt;The address which will be used from now on&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;tokenremoved&quot;&gt;TokenRemoved&lt;&#x2F;h4&gt;
&lt;p&gt;Must be emitted after the a token has been removed.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;tokenId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID which identifies a token&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;authorizedaccumulatedoperator&quot;&gt;AuthorizedAccumulatedOperator&lt;&#x2F;h4&gt;
&lt;p&gt;Emitted when an operator has been approved to update the accumulated on behalf of a token.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;operator&lt;&#x2F;td&gt;&lt;td&gt;The address which is operator of updating the accumulated&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;tokenId&lt;&#x2F;td&gt;&lt;td&gt;Token id on which behalf updates of the accumulated will potentially be made&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;revokedholdoperator&quot;&gt;RevokedHoldOperator&lt;&#x2F;h4&gt;
&lt;p&gt;Emitted when an operator has been revoked from updating the accumulated on behalf of a token.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;operator&lt;&#x2F;td&gt;&lt;td&gt;The address which was operator of updating the accumulated&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;tokenId&lt;&#x2F;td&gt;&lt;td&gt;Token id on which behalf updates of the accumulated could be made&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The usage of a token id instead of the address has been chosen to give tokens the possibility to update their smart contracts and keeping all their associated accumulated. If the address would be used, a migration process would needed to be done after a smart contract update.&lt;&#x2F;p&gt;
&lt;p&gt;No event is emitted after updating the accumulated as those are always associated with a &lt;code&gt;transfer&lt;&#x2F;code&gt;, &lt;code&gt;mint&lt;&#x2F;code&gt; or &lt;code&gt;burn&lt;&#x2F;code&gt; of a token which already emits an event of itself.&lt;&#x2F;p&gt;
&lt;p&gt;While not requiring it, the naming of the functions &lt;code&gt;checkTransferAllowed&lt;&#x2F;code&gt;, &lt;code&gt;checkTransferFromAllowed&lt;&#x2F;code&gt;, &lt;code&gt;checkMintAllowed&lt;&#x2F;code&gt; and &lt;code&gt;checkBurnAllowed&lt;&#x2F;code&gt; was adopted from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1462&#x2F;&quot;&gt;ERC-1462&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;While not requiring it, the naming of the functions &lt;code&gt;authorizeAccumulatedOperator&lt;&#x2F;code&gt;, &lt;code&gt;revokeAccumulatedOperator&lt;&#x2F;code&gt; and &lt;code&gt;isAccumulatedOperatorFor&lt;&#x2F;code&gt; follows the naming convention of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;777&#x2F;&quot;&gt;ERC-777&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Localization is not part of this EIP, but &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1066&#x2F;&quot;&gt;ERC-1066&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1444&#x2F;&quot;&gt;ERC-1444&lt;&#x2F;a&gt; can be used together to achieve it.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;As the EIP is not using any existing EIP there are no backwards compatibilities to take into consideration.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The GitHub repository &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;IoBuilders&#x2F;compliance-service&quot;&gt;IoBuilders&#x2F;compliance-service&lt;&#x2F;a&gt; contains the work in progress implementation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;contributors&quot;&gt;Contributors&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal has been collaboratively implemented by &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;adhara.io&#x2F;&quot;&gt;adhara.io&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;io.builders&#x2F;&quot;&gt;io.builders&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Transaction data gas cost reduction</title>
        <published>2019-05-03T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alexey Akhunov</name><uri>https://github.com/AlexeyAkhunov</uri>
	</author>
	
	<author>
		<name>Eli Ben Sasson</name><email>eli@starkware.co</email>
	</author>
	
	<author>
		<name>Tom Brand</name><email>tom@starkware.co</email>
	</author>
	
	<author>
		<name>Louis Guthmann</name><email>louis@starkware.co</email>
	</author>
	
	<author>
		<name>Avihu Levy</name><email>avihu@starkware.co</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2028/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2028-calldata-gas-cost-reduction/3280" />
        

        <id>https://wg-eips.ritovision.com/2028/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2028"
            label="EIP-2028" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2028/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;We propose to reduce the gas cost of Calldata (&lt;code&gt;GTXDATANONZERO&lt;&#x2F;code&gt;) from its current value of 68 gas per byte to 16 gas per byte, to be backed by mathematical modeling and empirical estimates. The mathematical model is the one used in the works of Sompolinsky and Zohar [1] and Pass, Seeman and Shelat [2], which relates network security to network delay. We shall (1) evaluate the theoretical impact of lower Calldata gas cost on network delay using this model, (2) validate the model empirically, and (3) base the proposed gas cost on our findings.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;There are a couple of main benefits to accepting this proposal and lowering gas cost of Calldata
On-Chain Scalability: Generally speaking, higher bandwidth of Calldata improves scalability, as more data can fit within a single block.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Layer two scalability: Layer two scaling solutions can improve scalability by moving storage and computation off-chain, but often introduce data transmission instead.
&lt;ul&gt;
&lt;li&gt;Proof systems such as STARKs and SNARKs use a single proof that attests to the computational integrity of a large computation, say, one that processes a large batch of transactions.&lt;&#x2F;li&gt;
&lt;li&gt;Some solutions use fraud proofs which requires a transmission of merkle proofs.&lt;&#x2F;li&gt;
&lt;li&gt;Moreover, one optional data availability solution to layer two is to place data on the main chain, via Calldata.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Stateless clients: The same model will be used to determine the price of the state access for the stateless client regime, which will be proposed in the State Rent (from version 4). There, it is expected that the gas cost of state accessing operation will increase roughly proportional to the extra bandwidth required to transmit the “block proofs” as well as extra processing required to verify those block proofs.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The gas per non-zero byte is reduced from 68 to 16. Gas cost of zero bytes is unchanged.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Roughly speaking, reducing the gas cost of Calldata leads to potentially larger blocks, which increases the network delay associated with data transmission over the network. This is only part of the full network delay, other factors are block processing time (and storage access, as part of it). Increasing network delay affects security by lowering the cost of attacking the network, because at any given point in time fewer nodes are updated on the latest state of the blockchain.&lt;&#x2F;p&gt;
&lt;p&gt;Yonatan Sompolinsky and Aviv Zohar suggested in [1] an elegant model to relate network delay to network security, and this model is also used in the work of Rafael Pass, Lior Seeman and Abhi Shelat [2]. We briefly explain this model below, because we shall study it theoretically and validate it by empirical measurements to reach the suggested lower gas cost for Calldata.&lt;&#x2F;p&gt;
&lt;p&gt;The model uses the following natural parameters:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;lambda&lt;&#x2F;em&gt;  denotes the block creation rate [1&#x2F;s]: We treat the process of finding a PoW
solution as a poisson process with rate &lt;em&gt;lambda&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;beta&lt;&#x2F;em&gt; - chain growth rate [1&#x2F;s]: the rate at which new blocks are added to
the heaviest chain.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;D&lt;&#x2F;em&gt; - block delay [s]: The time that elapses between the mining of a new block and its acceptance by all the miners (all miners switched to mining on top of that block).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;beta-lower-bound&quot;&gt;&lt;em&gt;Beta&lt;&#x2F;em&gt; Lower Bound&lt;&#x2F;h3&gt;
&lt;p&gt;Notice that &lt;em&gt;lambda&lt;&#x2F;em&gt; =&amp;gt; &lt;em&gt;beta&lt;&#x2F;em&gt;, because not all blocks that are found will enter the main chain (as is the case with uncles). In [1] it was shown that for a blockchain using the longest chain rule, one may bound &lt;em&gt;beta&lt;&#x2F;em&gt; from below by &lt;em&gt;lambda&lt;&#x2F;em&gt;&#x2F; (1+ D * &lt;em&gt;lambda&lt;&#x2F;em&gt;). This lower bound holds in the extremal case where the topology of the network is a clique in which the delay between each pair of nodes is D, the maximal possible delay. Recording both the lower and upper bounds on &lt;em&gt;beta&lt;&#x2F;em&gt; we get&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;_lambda_ &amp;gt;= _beta_ &amp;gt;= _lambda_ &#x2F; (1 + D * _lambda_)               (*)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Notice, as a sanity check, that when there is no delay (D=0) then &lt;em&gt;beta&lt;&#x2F;em&gt; equals &lt;em&gt;lambda&lt;&#x2F;em&gt;, as expected.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;security-of-the-network&quot;&gt;Security of the network&lt;&#x2F;h3&gt;
&lt;p&gt;An attacker attempting to reorganize the main chain needs to generate blocks at a rate that is greater than &lt;em&gt;beta&lt;&#x2F;em&gt;.
Fixing the difficulty level of the PoW puzzle, the total hash rate in the system is correlated to &lt;em&gt;lambda&lt;&#x2F;em&gt;. Thus, &lt;em&gt;beta&lt;&#x2F;em&gt; &#x2F; &lt;em&gt;lambda&lt;&#x2F;em&gt; is defined as the &lt;em&gt;efficiency&lt;&#x2F;em&gt; of the system, as it measures the fraction of total hash power that is used to generate the main chain of the network.&lt;&#x2F;p&gt;
&lt;p&gt;Rearranging (*) gives the following lower bound on efficiency in terms of delay:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;_beta_ &#x2F; _lambda_ &amp;gt;= 1 &#x2F; (1 + D * _lambda_)                 (**)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;the-delay-parameter-d&quot;&gt;The &lt;em&gt;delay&lt;&#x2F;em&gt; parameter D&lt;&#x2F;h3&gt;
&lt;p&gt;The network delay depends on the location of the mining node within the network and on the current network topology (which changes dynamically), and consequently is somewhat difficult to measure directly.
Previously, Christian Decker and Roger Wattenhofer [3] showed that propagation time scales with blocksize,  and Vitalik Buterin showed that uncle rate, which is tightly related to efficiency (**) measure, also scales with block size [4].&lt;&#x2F;p&gt;
&lt;p&gt;However, the delay function can be decomposed into two parts D = &lt;em&gt;D_t&lt;&#x2F;em&gt; + &lt;em&gt;D_p&lt;&#x2F;em&gt;, where &lt;em&gt;D_t&lt;&#x2F;em&gt; is the delay caused by the transmission of the block and &lt;em&gt;D_p&lt;&#x2F;em&gt; is the delay caused by the processing of the block by the node. Our model and tests will examine the effect of Calldata on each of &lt;em&gt;D_t&lt;&#x2F;em&gt; and &lt;em&gt;D_p&lt;&#x2F;em&gt;, postulating that their effect is different. This may be particularly relevant for Layer 2 Scalability and for Stateless Clients (Rationales 2, 3 above) because most of the Calldata associated with these goals are Merkle authentication paths that have a large &lt;em&gt;D_t&lt;&#x2F;em&gt; component but relatively small &lt;em&gt;D_p&lt;&#x2F;em&gt; values.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;To suggest the gas cost of calldata we shall conduct two types of tests:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Network tests, conducted on the Ethereum mainnet, used to estimate the effect on increasing block size on &lt;em&gt;D_p&lt;&#x2F;em&gt; and &lt;em&gt;D_t&lt;&#x2F;em&gt;, on the overall network delay D and the efficiency ratio (**), as well as delays between different mining pools. Those tests will include regression tests on existing data, and stress tests to introduce extreme scenarios.&lt;&#x2F;li&gt;
&lt;li&gt;Local tests, conducted on a single node and measuring the processing time as a function of Calldata amount and general computation limits.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;liorgold2&#x2F;parity-ethereum&#x2F;pull&#x2F;1&quot;&gt;Parity&lt;&#x2F;a&gt;
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;liorgold2&#x2F;go-ethereum&#x2F;pull&#x2F;1&quot;&gt;Geth&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;&#x2F;h2&gt;
&lt;p&gt;[1] Yonatan Sompolinsky, Aviv Zohar: &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;eprint.iacr.org&#x2F;2013&#x2F;881.pdf&quot;&gt;Secure High-Rate Transaction Processing in Bitcoin&lt;&#x2F;a&gt;. Financial Cryptography 2015: 507-527&lt;&#x2F;p&gt;
&lt;p&gt;[2] Rafael Pass, Lior Seeman, Abhi Shelat: &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;eprint.iacr.org&#x2F;2016&#x2F;454.pdf&quot;&gt;Analysis of the Blockchain Protocol in Asynchronous Networks&lt;&#x2F;a&gt;, ePrint report 2016&#x2F;454&lt;&#x2F;p&gt;
&lt;p&gt;[3] Christian Decker, Roger Wattenhofer: &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.gsd.inesc-id.pt&#x2F;~ler&#x2F;docencia&#x2F;rcs1314&#x2F;papers&#x2F;P2P2013_041.pdf&quot;&gt;Information propagation in the Bitcoin network&lt;&#x2F;a&gt;. P2P 2013: 1-10&lt;&#x2F;p&gt;
&lt;p&gt;[4] Vitalik Buterin: &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;blog.ethereum.org&#x2F;2016&#x2F;10&#x2F;31&#x2F;uncle-rate-transaction-fee-analysis&#x2F;&quot;&gt;Uncle Rate and Transaction Fee Analysis&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Fork identifier for chain compatibility checks</title>
        <published>2019-05-03T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Péter Szilágyi</name><email>peterke@gmail.com</email>
	</author>
	
	<author>
		<name>Felix Lange</name><email>fjl@ethereum.org</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2124/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/2125" />
        

        <id>https://wg-eips.ritovision.com/2124/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="networking"
                label="Networking" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:2124"
            label="EIP-2124" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2124/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Currently nodes in the Ethereum network try to find each other by establishing random connections to remote machines &quot;looking&quot; like an Ethereum node (public networks, private networks, test networks, etc), hoping that they found a useful peer (same genesis, same forks). This wastes time and resources, especially for smaller networks.&lt;&#x2F;p&gt;
&lt;p&gt;To avoid this overhead, Ethereum needs a mechanism that can precisely identify whether a node will be useful, as early as possible. Such a mechanism requires a way to summarize chain configurations, as well as a way to disseminate said summaries in the network.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal focuses only on the definition of said summary - a generally useful &lt;em&gt;fork identifier&lt;&#x2F;em&gt; - and it&#x27;s validation rules, allowing it to be embedded into arbitrary network protocols (e.g. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;778&#x2F;&quot;&gt;discovery ENRs&lt;&#x2F;a&gt; or &lt;code&gt;eth&#x2F;6x&lt;&#x2F;code&gt; handshakes).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;There are many public and private Ethereum networks, but the discovery protocol doesn&#x27;t differentiate between them. The only way to check if a peer is good or bad (same chain or not), is to establish a TCP&#x2F;IP connection, wrap it with RLPx cryptography, then execute an &lt;code&gt;eth&lt;&#x2F;code&gt; handshake. This is an extreme cost to bear if it turns out that the remote peer is on a different network and it&#x27;s not even precise enough to differentiate Ethereum and Ethereum Classic. This cost is magnified for small networks, where a lot more trial and errors are needed to find good nodes.&lt;&#x2F;p&gt;
&lt;p&gt;Even if the peer &lt;strong&gt;is&lt;&#x2F;strong&gt; on the same chain, during non-controversial consensus upgrades, not everybody updates their nodes in time (developer nodes, leftovers, etc). These stale nodes put a meaningless burden on the peer-to-peer network, since they just latch on to good nodes, but don&#x27;t accept upgraded blocks. This causes valuable peer slots and bandwidth to be lost until the stale nodes finally update. This is a serious issue for test networks, where leftovers can linger for months.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP proposes a new identity scheme to both precisely and concisely summarize the chain&#x27;s current status (genesis and all applied forks). The conciseness is particularly important to make the identity useful across datagram protocols too. The EIP solves a number of issues:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If two nodes are on different networks, they should never even consider connecting.&lt;&#x2F;li&gt;
&lt;li&gt;If a hard fork passes, upgraded nodes should reject non-upgraded ones, but &lt;strong&gt;NOT&lt;&#x2F;strong&gt; before.&lt;&#x2F;li&gt;
&lt;li&gt;If two chains share the same genesis, but not forks (ETH &#x2F; ETC), they should reject each other.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This EIP does not attempt to solve the clean separation of 3-way-forks! If at the same future block number, the network splits into three (non-fork, fork-A and fork-B), separating the forkers from each another will need case-by-case special handling. Not handling this keeps the proposal pragmatic, simple and also avoids making it too easy to fork off mainnet.&lt;&#x2F;p&gt;
&lt;p&gt;To keep the scope limited, this EIP only defines the identity scheme and validation rules. The same scheme and algorithm can be embedded into various networking protocols, allowing both the &lt;code&gt;eth&#x2F;6x&lt;&#x2F;code&gt; handshake to be more precise (Ethereum vs. Ethereum Classic); as well as the discovery to be more useful (reject surely peers without ever connecting).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Peer-to-peer networking is messy and hard due to firewalls and network address translation (NAT). Generally only a small fraction of nodes have publicly routed addresses and P2P networks rely mainly on these for forwarding data for everyone else. The best way to maximize the utility of the public nodes is to ensure their resources aren&#x27;t wasted on tasks that are worthless to the network.&lt;&#x2F;p&gt;
&lt;p&gt;By aggressively cutting off incompatible nodes from each other we can extract a lot more value from the public nodes, making the entire P2P network much more robust and reliable. Supporting this network partitioning at a discovery layer can further enhance performance as we avoid the costly crypto and latency&#x2F;bandwidth hit associated with establishing a stream connection in the first place.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Each node maintains the following values:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;FORK_HASH&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: IEEE CRC32 checksum (&lt;code&gt;[4]byte&lt;&#x2F;code&gt;) of the genesis hash and fork blocks numbers that already passed.
&lt;ul&gt;
&lt;li&gt;The fork block numbers are fed into the CRC32 checksum in ascending order.&lt;&#x2F;li&gt;
&lt;li&gt;If multiple forks are applied at the same block, the block number is checksummed only once.&lt;&#x2F;li&gt;
&lt;li&gt;Block numbers are regarded as &lt;code&gt;uint64&lt;&#x2F;code&gt; integers, encoded in big endian format when checksumming.&lt;&#x2F;li&gt;
&lt;li&gt;If a chain is configured to start with a non-Frontier ruleset already in its genesis, that is NOT considered a fork.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;FORK_NEXT&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: Block number (&lt;code&gt;uint64&lt;&#x2F;code&gt;) of the next upcoming fork, or &lt;code&gt;0&lt;&#x2F;code&gt; if no next fork is known.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;E.g. &lt;code&gt;FORK_HASH&lt;&#x2F;code&gt; for mainnet would be:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;forkhash₀ = &lt;code&gt;0xfc64ec04&lt;&#x2F;code&gt; (Genesis) = &lt;code&gt;CRC32(&amp;lt;genesis-hash&amp;gt;)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;forkhash₁ = &lt;code&gt;0x97c2c34c&lt;&#x2F;code&gt; (Homestead) = &lt;code&gt;CRC32(&amp;lt;genesis-hash&amp;gt; || uint64(1150000))&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;forkhash₂ = &lt;code&gt;0x91d1f948&lt;&#x2F;code&gt; (DAO fork) = &lt;code&gt;CRC32(&amp;lt;genesis-hash&amp;gt; || uint64(1150000) || uint64(1920000))&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;em&gt;fork identifier&lt;&#x2F;em&gt; is defined as &lt;code&gt;RLP([FORK_HASH, FORK_NEXT])&lt;&#x2F;code&gt;. This &lt;code&gt;forkid&lt;&#x2F;code&gt; is cross validated (&lt;strong&gt;NOT&lt;&#x2F;strong&gt; naively compared) to assess a remote chain&#x27;s compatibility. Irrespective of fork state, both parties must come to the same conclusion to avoid indefinite reconnect attempts from one side.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;validation-rules&quot;&gt;Validation rules&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;ol&gt;
&lt;li&gt;If local and remote &lt;code&gt;FORK_HASH&lt;&#x2F;code&gt; matches, compare local head to &lt;code&gt;FORK_NEXT&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;ul&gt;
&lt;li&gt;The two nodes are in the same fork state currently. They might know of differing future forks, but that&#x27;s not relevant until the fork triggers (might be postponed, nodes might be updated to match).
&lt;ul&gt;
&lt;li&gt;1a) A remotely announced but remotely not passed block is already passed locally, disconnect, since the chains are incompatible.&lt;&#x2F;li&gt;
&lt;li&gt;1b) No remotely announced fork; or not yet passed locally, connect.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;ol start=&quot;2&quot;&gt;
&lt;li&gt;If the remote &lt;code&gt;FORK_HASH&lt;&#x2F;code&gt; is a subset of the local past forks and the remote &lt;code&gt;FORK_NEXT&lt;&#x2F;code&gt; matches with the locally following fork block number, connect.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;ul&gt;
&lt;li&gt;Remote node is currently syncing. It might eventually diverge from us, but at this current point in time we don&#x27;t have enough information.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;ol start=&quot;3&quot;&gt;
&lt;li&gt;If the remote &lt;code&gt;FORK_HASH&lt;&#x2F;code&gt; is a superset of the local past forks and can be completed with locally known future forks, connect.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;ul&gt;
&lt;li&gt;Local node is currently syncing. It might eventually diverge from the remote, but at this current point in time we don&#x27;t have enough information.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;ol start=&quot;4&quot;&gt;
&lt;li&gt;Reject in all other cases.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;stale-software-examples&quot;&gt;Stale software examples&lt;&#x2F;h4&gt;
&lt;p&gt;The examples below try to exhaust the fork combination possibilities that arise when nodes do not run matching software versions, but otherwise follow the same chain (mainnet nodes, testnet nodes, etc).&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&quot;text-align: center&quot;&gt;Past forks&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;Future forks&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;Head&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;Remote &lt;code&gt;FORK_HASH&lt;&#x2F;code&gt;&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;Remote &lt;code&gt;FORK_NEXT&lt;&#x2F;code&gt;&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;Connect&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;Reason&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;A&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;A&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;Yes (1b)&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;Same forks, same sync state.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;A&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&amp;lt; B&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;A&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;B&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;Yes (1b)&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;Remote is advertising a future fork, but that is uncertain.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;A&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&amp;gt;= B&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;A&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;B&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;No (1a)&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;Remote is advertising a future fork that passed locally.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;A&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;B&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;A&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;Yes (1b)&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;Local knows about a future fork, but that is uncertain.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;A&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;B&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;A&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;B&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;Yes (1b)&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;Both know about a future fork, but that is uncertain.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;A&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;B1&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&amp;lt; B2&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;A&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;B2&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;Yes (1b)&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;Both know about differing future forks, but those are uncertain.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;A&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;B1&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&amp;gt;= B2&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;A&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;B2&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;No (1a)&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;Both know about differing future forks, but the remote one passed locally.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;[A,B]&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;A&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;B&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;Yes (2)&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;Remote out of sync.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;[A,B,C]&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;A&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;B&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;Yes¹ (2)&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;Remote out of sync. Remote will need a software update, but we don&#x27;t know it yet.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;A&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;B&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;A ⊕ B&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;Yes (3)&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;Local out of sync.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;A&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;B,C&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;A ⊕ B&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;Yes (3)&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;Local out of sync. Local also knows about a future fork, but that is uncertain yet.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;A&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;A ⊕ B&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;No (4)&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;Local needs software update.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;A&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;B&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;A ⊕ B ⊕ C&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;No² (4)&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;Local needs software update.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;[A,B]&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;A&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;No (4)&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;Remote needs software update.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;&lt;em&gt;Note, there&#x27;s one asymmetry in the table, marked with ¹ and ². Since we don&#x27;t have access to a remote node&#x27;s future fork list (just the next one), we can&#x27;t detect that it&#x27;s software is stale until it syncs up. This is acceptable as 1) the remote node will disconnect from us anyway, and 2) this is a temporary fluke during sync, not permanent with a leftover node.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h5 id=&quot;why-flatten-fork-hash-into-4-bytes-why-not-share-the-entire-genesis-and-fork-list&quot;&gt;Why flatten &lt;code&gt;FORK_HASH&lt;&#x2F;code&gt; into 4 bytes? Why not share the entire genesis and fork list?&lt;&#x2F;h5&gt;
&lt;p&gt;Whilst the &lt;code&gt;eth&lt;&#x2F;code&gt; devp2p protocol permits arbitrarily much data to be transmitted, the discovery protocol&#x27;s total space allowance for all ENR entries is 300 bytes.&lt;&#x2F;p&gt;
&lt;p&gt;Reducing the &lt;code&gt;FORK_HASH&lt;&#x2F;code&gt; into a 4 bytes checksum ensures that we leave ample room in the ENR for future extensions; and 4 bytes is more than enough for arbitrarily many Ethereum networks from a (practical) collision perspective.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;why-use-ieee-crc32-as-the-checksum-instead-of-keccak256&quot;&gt;Why use IEEE CRC32 as the checksum instead of Keccak256?&lt;&#x2F;h5&gt;
&lt;p&gt;We need a mechanism that can flatten arbitrary data into 4 bytes, without ignoring any of the input. Any other checksum or hashing algorithm would work, but since nodes can lie at any time, there&#x27;s no value in cryptographic hash functions.&lt;&#x2F;p&gt;
&lt;p&gt;Instead of just taking the first 4 bytes of a Keccak256 hash (seems odd) or XOR-ing all the 4-byte groups (messy), CRC32 is a better alternative, as this is exactly what it was designed for. IEEE CRC32 is also used by ethernet, gzip, zip, png, etc, so every programming language support should not be a problem.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;we-re-not-using-fork-next-for-much-can-t-we-get-rid-of-it-somehow&quot;&gt;We&#x27;re not using &lt;code&gt;FORK_NEXT&lt;&#x2F;code&gt; for much, can&#x27;t we get rid of it somehow?&lt;&#x2F;h5&gt;
&lt;p&gt;We need to be able to differentiate whether a remote node is out of sync or whether its software is stale. Sharing only the past forks cannot tell us if the node is legitimately behind or stuck.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;why-advertise-only-one-next-fork-instead-of-hashing-all-known-future-ones-like-the-fork-hash&quot;&gt;Why advertise only one next fork, instead of &quot;hashing&quot; all known future ones like the &lt;code&gt;FORK_HASH&lt;&#x2F;code&gt;?&lt;&#x2F;h5&gt;
&lt;p&gt;Opposed to past forks that have already passed (for us locally) and can be considered immutable, we don&#x27;t know anything about future ones. Maybe we&#x27;re out of sync or maybe the fork didn&#x27;t pass yet. If it didn&#x27;t pass yet, it might be postponed, so enforcing it would split the network apart. It could also happen that we&#x27;re not yet aware of all future forks (haven&#x27;t updated our software in a while).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP only defines an identity scheme, it does not define functional changes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Here&#x27;s a full suite of tests for all possible fork IDs that Mainnet, Ropsten, Rinkeby and Görli can advertise given the Petersburg fork cap (time of writing).&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;go&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; testcase&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; struct&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	head&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	want&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tests&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; :=&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	config&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;  *&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;params&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ChainConfig&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	genesis&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; common&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	cases&lt;&#x2F;span&gt;&lt;span&gt;   [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;testcase&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Mainnet test cases&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		params&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;MainnetChainConfig&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		params&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;MainnetGenesisHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;testcase&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;fc64ec04&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1150000&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;       &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Unsynced&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1149999&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;fc64ec04&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1150000&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Last Frontier block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1150000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;97c2c34c&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1920000&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; First Homestead block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1919999&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;97c2c34c&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1920000&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Last Homestead block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1920000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;91d1f948&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2463000&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; First DAO block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2462999&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;91d1f948&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2463000&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Last DAO block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2463000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7a64da13&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2675000&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; First Tangerine block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2674999&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7a64da13&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2675000&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Last Tangerine block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2675000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3edd5b10&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 4370000&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; First Spurious block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4369999&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3edd5b10&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 4370000&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Last Spurious block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4370000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;a00bc324&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 7280000&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; First Byzantium block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7279999&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;a00bc324&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 7280000&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Last Byzantium block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7280000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;668db0af&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;       &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; First and last Constantinople, first Petersburg block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7987396&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;668db0af&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;       &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Today Petersburg block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Ropsten test cases&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		params&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;TestnetChainConfig&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		params&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;TestnetGenesisHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;testcase&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;30c7ddbc&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Unsynced, last Frontier, Homestead and first Tangerine block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;9&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;30c7ddbc&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Last Tangerine block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;63760190&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1700000&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; First Spurious block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1699999&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;63760190&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1700000&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Last Spurious block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1700000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3ea159c7&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 4230000&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; First Byzantium block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4229999&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3ea159c7&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 4230000&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Last Byzantium block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4230000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;97b544f3&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 4939394&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; First Constantinople block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4939393&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;97b544f3&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 4939394&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Last Constantinople block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4939394&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;d6e2149b&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 6485846&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; First Petersburg block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;6485845&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;d6e2149b&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 6485846&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Last Petersburg block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;6485846&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4bc66396&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;       &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; First Istanbul block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7500000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4bc66396&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;       &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Future Istanbul block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Rinkeby test cases&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		params&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;RinkebyChainConfig&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		params&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;RinkebyGenesisHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;testcase&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3b8e0691&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;             &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Unsynced, last Frontier block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;60949295&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;             &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; First and last Homestead block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;8bde40dd&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;             &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; First and last Tangerine block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;cb3a64bb&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1035301&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;       &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; First Spurious block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1035300&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;cb3a64bb&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1035301&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Last Spurious block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1035301&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;8d748b57&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3660663&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; First Byzantium block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3660662&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;8d748b57&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3660663&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Last Byzantium block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3660663&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;e49cab14&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 4321234&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; First Constantinople block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4321233&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;e49cab14&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 4321234&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Last Constantinople block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4321234&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;afec6b27&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 5435345&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; First Petersburg block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;5435344&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;afec6b27&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 5435345&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Last Petersburg block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;5435345&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;cbdb8838&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;       &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; First Istanbul block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;6000000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;cbdb8838&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;       &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Future Istanbul block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Goerli test cases&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		params&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;GoerliChainConfig&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		params&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;GoerliGenesisHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;testcase&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;a3f5ab08&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1561651&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;       &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Unsynced, last Frontier, Homestead, Tangerine, Spurious, Byzantium, Constantinople and first Petersburg block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1561650&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;a3f5ab08&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1561651&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Last Petersburg block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1561651&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;c25efa5c&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;       &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; First Istanbul block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2000000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;c25efa5c&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;       &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Future Istanbul block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Here&#x27;s a suite of tests of the different states a Mainnet node might be in and the different remote fork identifiers it might be required to validate and decide to accept or reject:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;go&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tests&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; :=&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	head&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	id&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;   ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	err&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  error&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Local is mainnet Petersburg, remote announces the same. No future fork is announced.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7987396&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;668db0af&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; nil&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Local is mainnet Petersburg, remote announces the same. Remote also announces a next fork&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; at block 0xffffffff, but that is uncertain.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7987396&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;668db0af&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; math&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;MaxUint64&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; nil&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Local is mainnet currently in Byzantium only (so it&amp;#39;s aware of Petersburg), remote announces&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; also Byzantium, but it&amp;#39;s not yet aware of Petersburg (e.g. non updated node before the fork).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; In this case we don&amp;#39;t know if Petersburg passed yet or not.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7279999&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;a00bc324&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; nil&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Local is mainnet currently in Byzantium only (so it&amp;#39;s aware of Petersburg), remote announces&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; also Byzantium, and it&amp;#39;s also aware of Petersburg (e.g. updated node before the fork). We&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; don&amp;#39;t know if Petersburg passed yet (will pass) or not.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7279999&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;a00bc324&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 7280000&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; nil&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Local is mainnet currently in Byzantium only (so it&amp;#39;s aware of Petersburg), remote announces&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; also Byzantium, and it&amp;#39;s also aware of some random fork (e.g. misconfigured Petersburg). As&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; neither forks passed at neither nodes, they may mismatch, but we still connect for now.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7279999&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;a00bc324&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; math&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;MaxUint64&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; nil&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Local is mainnet Petersburg, remote announces Byzantium + knowledge about Petersburg. Remote&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is simply out of sync, accept.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7987396&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;a00bc324&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 7280000&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; nil&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Local is mainnet Petersburg, remote announces Spurious + knowledge about Byzantium. Remote&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is definitely out of sync. It may or may not need the Petersburg update, we don&amp;#39;t know yet.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7987396&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3edd5b10&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 4370000&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; nil&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Local is mainnet Byzantium, remote announces Petersburg. Local is out of sync, accept.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7279999&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;668db0af&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; nil&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Local is mainnet Spurious, remote announces Byzantium, but is not aware of Petersburg. Local&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; out of sync. Local also knows about a future fork, but that is uncertain yet.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4369999&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;a00bc324&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; nil&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Local is mainnet Petersburg. remote announces Byzantium but is not aware of further forks.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Remote needs software update.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7987396&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;a00bc324&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ErrRemoteStale&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Local is mainnet Petersburg, and isn&amp;#39;t aware of more forks. Remote announces Petersburg +&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0xffffffff. Local needs software update, reject.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7987396&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;5cddc0e1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ErrLocalIncompatibleOrStale&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Local is mainnet Byzantium, and is aware of Petersburg. Remote announces Petersburg +&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0xffffffff. Local needs software update, reject.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7279999&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;5cddc0e1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ErrLocalIncompatibleOrStale&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Local is mainnet Petersburg, remote is Rinkeby Petersburg.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7987396&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;afec6b27&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ErrLocalIncompatibleOrStale&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Local is mainnet Petersburg, far in the future. Remote announces Gopherium (non existing fork)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; at some future block 88888888, for itself, but past block for local. Local is incompatible.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This case detects non-upgraded nodes with majority hash power (typical Ropsten mess).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;88888888&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;668db0af&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 88888888&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ErrLocalIncompatibleOrStale&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Local is mainnet Byzantium. Remote is also in Byzantium, but announces Gopherium (non existing&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; fork) at block 7279999, before Petersburg. Local is incompatible.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	{&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7279999&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;a00bc324&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 7279999&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ErrLocalIncompatibleOrStale&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Here&#x27;s a couple of tests to verify the proper RLP encoding (since &lt;code&gt;FORK_HASH&lt;&#x2F;code&gt; is a 4 byte binary but &lt;code&gt;FORK_NEXT&lt;&#x2F;code&gt; is an 8 byte quantity):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;go&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tests&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; :=&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  id&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;   ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  want&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;byte&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    common&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Hex2Bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;c6840000000080&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;deadbeef&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;BADDCAFE&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    common&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Hex2Bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ca84deadbeef84baddcafe&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    ID&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; math&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;MaxUint32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Next&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; math&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;MaxUint64&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    common&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Hex2Bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ce84ffffffff88ffffffffffffffff&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Geth: https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;go-ethereum&#x2F;tree&#x2F;master&#x2F;core&#x2F;forkid&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Clearable Token</title>
        <published>2019-04-30T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Julio Faura</name><email>julio@adhara.io</email>
	</author>
	
	<author>
		<name>Fernando Paris</name><email>fer@io.builders</email>
	</author>
	
	<author>
		<name>Daniel Lehrner</name><email>daniel@io.builders</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2018/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/2104" />
        

        <id>https://wg-eips.ritovision.com/2018/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2018"
            label="ERC-2018" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2018/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;blockquote&gt;
&lt;p&gt;&quot;In banking and finance, clearing denotes all activities from the time a commitment is made for a transaction until it is settled.&quot; &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Clearing_(finance)&quot;&gt;[1]&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h2 id=&quot;actors&quot;&gt;Actors&lt;&#x2F;h2&gt;
&lt;h4 id=&quot;clearing-agent&quot;&gt;Clearing Agent&lt;&#x2F;h4&gt;
&lt;p&gt;An account which processes, executes or rejects a clearable transfer.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;operator&quot;&gt;Operator&lt;&#x2F;h4&gt;
&lt;p&gt;An account which has been approved by an account to order clearable transfers on its behalf.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;orderer&quot;&gt;Orderer&lt;&#x2F;h4&gt;
&lt;p&gt;The account which orders a clearable transfer. This can be the account owner itself, or any account, which has been approved as an operator for the account.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The clearing process turns the promise of a transfer into the actual movement of money from one account to another. A clearing agent decides if the transfer can be executed or not. The amount which should be transferred is not deducted from the balance of the payer, but neither is it available for another transfer and therefore ensures, that the execution of the transfer will be successful when it is executed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;A regulated token needs to comply with all the legal requirements, especially &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Know_your_customer&quot;&gt;KYC&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Money_laundering#Anti-money_laundering&quot;&gt;AML&lt;&#x2F;a&gt;. Some of these checks may not be able to be done on-chain and therefore a transfer may not be completed in one step. Currently there is no EIP to make such off-chain checks possible. This proposal allows a user to order a transfer, which can be checked by a clearing agent off-chain. Depending on the result of it, the clearing agent will either execute or cancel the transfer. To provide more information why a transfer is cancelled, the clearing agent can add a reason why it is not executed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ClearableToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is ERC-1996 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ClearableTransferStatusCode&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt; Nonexistent&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt; Ordered&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt; InProcess&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt; Executed&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt; Rejected&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt; Cancelled&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; orderTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operationId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; orderTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operationId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; cancelTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operationId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; processClearableTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operationId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; executeClearableTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operationId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; rejectClearableTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operationId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; reason&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; retrieveClearableTransferData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operationId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; ClearableTransferStatusCode&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; status&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; authorizeClearableTransferOperator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revokeClearableTransferOperator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isClearableTransferOperatorFor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ClearableTransferOrdered&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; orderer&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operationId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ClearableTransferInProcess&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; orderer&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operationId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ClearableTransferExecuted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; orderer&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operationId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ClearableTransferRejected&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; orderer&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operationId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; reason&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ClearableTransferCancelled&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; orderer&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operationId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AuthorizedClearableTransferOperator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RevokedClearableTransferOperator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;functions&quot;&gt;Functions&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;ordertransfer&quot;&gt;orderTransfer&lt;&#x2F;h4&gt;
&lt;p&gt;Orders a clearable transfer on behalf of the msg.sender in favor of &lt;code&gt;to&lt;&#x2F;code&gt;. A clearing agent is responsible to either execute or reject the transfer. The function must revert if the operation ID has been used before.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;operationId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID to identify the clearable transfer&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;to&lt;&#x2F;td&gt;&lt;td&gt;The address of the payee, to whom the tokens are to be paid if executed&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;value&lt;&#x2F;td&gt;&lt;td&gt;The amount to be transferred. Must be less or equal than the balance of the payer.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;ordertransferfrom&quot;&gt;orderTransferFrom&lt;&#x2F;h4&gt;
&lt;p&gt;Orders a clearable transfer on behalf of the payer in favor of the &lt;code&gt;to&lt;&#x2F;code&gt;. A clearing agent is responsible to either execute or reject the transfer. The function must revert if the operation ID has been used before.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;operationId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID to identify the clearable transfer&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;from&lt;&#x2F;td&gt;&lt;td&gt;The address of the payer, from whom the tokens are to be taken if executed&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;to&lt;&#x2F;td&gt;&lt;td&gt;The address of the payee, to whom the tokens are to be paid if executed&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;value&lt;&#x2F;td&gt;&lt;td&gt;The amount to be transferred. Must be less or equal than the balance of the payer.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;canceltransfer&quot;&gt;cancelTransfer&lt;&#x2F;h4&gt;
&lt;p&gt;Cancels the order of a clearable transfer. Only the orderer can cancel their own orders. It must not be successful as soon as the transfer is in status &lt;code&gt;InProcess&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;operationId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID to identify the clearable transfer&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;processclearabletransfer&quot;&gt;processClearableTransfer&lt;&#x2F;h4&gt;
&lt;p&gt;Sets a clearable transfer to status &lt;code&gt;InProcess&lt;&#x2F;code&gt;. Only a clearing agent can successfully execute this action. This status is optional, but without it the orderer can cancel the transfer at any time.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;operationId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID to identify the clearable transfer&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;executeclearabletransfer&quot;&gt;executeClearableTransfer&lt;&#x2F;h4&gt;
&lt;p&gt;Executes a clearable transfer, which means that the tokens are transferred from the payer to the payee. Only a clearing agent can successfully execute this action.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;operationId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID to identify the clearable transfer&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;rejectclearabletransfer&quot;&gt;rejectClearableTransfer&lt;&#x2F;h4&gt;
&lt;p&gt;Rejects a clearable transfer, which means that the amount that is held is available again to the payer and no transfer is done. Only a clearing agent can successfully execute this action.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;operationId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID to identify the clearable transfer&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;reason&lt;&#x2F;td&gt;&lt;td&gt;A reason given by the clearing agent why the transfer has been rejected&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;retrieveclearabletransferdata&quot;&gt;retrieveClearableTransferData&lt;&#x2F;h4&gt;
&lt;p&gt;Retrieves all the information available for a particular clearable transfer.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;operationId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID to identify the clearable transfer&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;authorizeclearabletransferoperator&quot;&gt;authorizeClearableTransferOperator&lt;&#x2F;h4&gt;
&lt;p&gt;Approves an operator to order transfers on behalf of msg.sender.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;operator&lt;&#x2F;td&gt;&lt;td&gt;The address to be approved as operator of clearable transfers&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;revokeclearabletransferoperator&quot;&gt;revokeClearableTransferOperator&lt;&#x2F;h4&gt;
&lt;p&gt;Revokes the approval to order transfers on behalf of msg.sender.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;operator&lt;&#x2F;td&gt;&lt;td&gt;The address to be revoked as operator of clearable transfers&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;isclearabletransferoperatorfor&quot;&gt;isClearableTransferOperatorFor&lt;&#x2F;h4&gt;
&lt;p&gt;Returns if an operator is approved to order transfers on behalf of &lt;code&gt;from&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;operator&lt;&#x2F;td&gt;&lt;td&gt;The address to be an operator of clearable transfers&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;from&lt;&#x2F;td&gt;&lt;td&gt;The address on which the holds would be created&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;transfer&quot;&gt;transfer&lt;&#x2F;h4&gt;
&lt;p&gt;It is up to the implementer of the EIP if the &lt;code&gt;transfer&lt;&#x2F;code&gt; function of ERC-20 should always revert or is allowed under certain circumstances.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;transferfrom&quot;&gt;transferFrom&lt;&#x2F;h4&gt;
&lt;p&gt;It is up to the implementer of the EIP if the &lt;code&gt;transferFrom&lt;&#x2F;code&gt; function of ERC-20 should always revert or is allowed under certain circumstances.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;events&quot;&gt;Events&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;clearabletransferordered&quot;&gt;ClearableTransferOrdered&lt;&#x2F;h4&gt;
&lt;p&gt;Must be emitted when a clearable transfer is ordered.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;orderer&lt;&#x2F;td&gt;&lt;td&gt;The address of the orderer of the transfer&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;operationId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID to identify the clearable transfer&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;from&lt;&#x2F;td&gt;&lt;td&gt;The address of the payer, from whom the tokens are to be taken if executed&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;to&lt;&#x2F;td&gt;&lt;td&gt;The address of the payee, to whom the tokens are to be paid if executed&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;value&lt;&#x2F;td&gt;&lt;td&gt;The amount to be transferred if executed&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;clearabletransferinprocess&quot;&gt;ClearableTransferInProcess&lt;&#x2F;h4&gt;
&lt;p&gt;Must be emitted when a clearable transfer is put in status &lt;code&gt;ÌnProcess&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;orderer&lt;&#x2F;td&gt;&lt;td&gt;The address of the orderer of the transfer&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;operationId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID to identify the clearable transfer&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;clearabletransferexecuted&quot;&gt;ClearableTransferExecuted&lt;&#x2F;h4&gt;
&lt;p&gt;Must be emitted when a clearable transfer is executed.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;orderer&lt;&#x2F;td&gt;&lt;td&gt;The address of the orderer of the transfer&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;operationId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID to identify the clearable transfer&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;clearabletransferrejected&quot;&gt;ClearableTransferRejected&lt;&#x2F;h4&gt;
&lt;p&gt;Must be emitted when a clearable transfer is rejected.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;orderer&lt;&#x2F;td&gt;&lt;td&gt;The address of the orderer of the transfer&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;operationId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID to identify the clearable transfer&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;reason&lt;&#x2F;td&gt;&lt;td&gt;A reason given by the clearing agent why the transfer has been rejected&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;clearabletransfercancelled&quot;&gt;ClearableTransferCancelled&lt;&#x2F;h4&gt;
&lt;p&gt;Must be emitted when a clearable transfer is cancelled by its orderer.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;orderer&lt;&#x2F;td&gt;&lt;td&gt;The address of the orderer of the transfer&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;operationId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID to identify the clearable transfer&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;authorizedclearabletransferoperator&quot;&gt;AuthorizedClearableTransferOperator&lt;&#x2F;h4&gt;
&lt;p&gt;Emitted when an operator has been approved to order transfers on behalf of another account.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;operator&lt;&#x2F;td&gt;&lt;td&gt;The address which has been approved as operator of clearable transfers&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;account&lt;&#x2F;td&gt;&lt;td&gt;Address on which behalf transfers will potentially be ordered&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;revokedclearabletransferoperator&quot;&gt;RevokedClearableTransferOperator&lt;&#x2F;h4&gt;
&lt;p&gt;Emitted when an operator has been revoked from ordering transfers on behalf of another account.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;operator&lt;&#x2F;td&gt;&lt;td&gt;The address which has been revoked as operator of clearable transfers&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;account&lt;&#x2F;td&gt;&lt;td&gt;Address on which behalf transfers could potentially be ordered&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP uses &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1996&#x2F;&quot;&gt;EIP-1996&lt;&#x2F;a&gt; to hold the money after a transfer is ordered. A clearing agent, whose implementation is not part of this proposal, acts as a predefined notary to decide if the transfer complies with the rules of the token or not.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;operationId&lt;&#x2F;code&gt; is a string and not something more gas efficient to allow easy traceability of the hold and allow human readable ids. It is up to the implementer if the string should be stored on-chain or only its hash, as it is enough to identify a hold.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;operationId&lt;&#x2F;code&gt; is a competitive resource. It is recommended, but not required, that the hold issuers used a unique prefix to avoid collisions.&lt;&#x2F;p&gt;
&lt;p&gt;While not requiring it, the naming of the functions &lt;code&gt;authorizeClearableTransferOperator&lt;&#x2F;code&gt;, &lt;code&gt;revokeClearableTransferOperator&lt;&#x2F;code&gt; and &lt;code&gt;isClearableTransferOperatorFor&lt;&#x2F;code&gt; follows the naming convention of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;777&#x2F;&quot;&gt;ERC-777&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is fully backwards compatible as its implementation extends the functionality of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1996&#x2F;&quot;&gt;EIP-1996&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The GitHub repository &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;IoBuilders&#x2F;clearable-token&quot;&gt;IoBuilders&#x2F;clearable-token&lt;&#x2F;a&gt; contains the reference implementation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;contributors&quot;&gt;Contributors&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal has been collaboratively implemented by &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;adhara.io&#x2F;&quot;&gt;adhara.io&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;io.builders&#x2F;&quot;&gt;io.builders&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;[1] https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Clearing_(finance)&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Proxy Storage Slots</title>
        <published>2019-04-24T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Santiago Palladino</name><uri>https://github.com/spalladino</uri>
	</author>
	
	<author>
		<name>Francisco Giordano</name><uri>https://github.com/frangio</uri>
	</author>
	
	<author>
		<name>Hadrien Croubois</name><uri>https://github.com/Amxx</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1967/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-1967-standard-proxy-storage-slots/3185" />
        

        <id>https://wg-eips.ritovision.com/1967/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:1967"
            label="ERC-1967" />
        

        
        

        
        <summary type="html">A consistent location where proxies store the address of the logic contract they delegate to, as well as other proxy-specific information.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1967/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Delegating &lt;strong&gt;proxy contracts&lt;&#x2F;strong&gt; are widely used for both upgradeability and gas savings. These proxies rely on a &lt;strong&gt;logic contract&lt;&#x2F;strong&gt; (also known as implementation contract or master copy) that is called using &lt;code&gt;delegatecall&lt;&#x2F;code&gt;. This allows proxies to keep a persistent state (storage and balance) while the code is delegated to the logic contract.&lt;&#x2F;p&gt;
&lt;p&gt;To avoid clashes in storage usage between the proxy and logic contract, the address of the logic contract is typically saved in a specific storage slot (for example &lt;code&gt;0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc&lt;&#x2F;code&gt; in OpenZeppelin contracts) guaranteed to be never allocated by a compiler. This EIP proposes a set of standard slots to store proxy information. This allows clients like block explorers to properly extract and show this information to end users, and logic contracts to optionally act upon it.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Delegating proxies are widely in use, as a means to both support upgrades and reduce gas costs of deployments. Examples of these proxies are found in OpenZeppelin Contracts, Gnosis, AragonOS, Melonport, Limechain, WindingTree, Decentraland, and many others.&lt;&#x2F;p&gt;
&lt;p&gt;However, the lack of a common interface for obtaining the logic address for a proxy makes it impossible to build common tools that act upon this information.&lt;&#x2F;p&gt;
&lt;p&gt;A classic example of this is a block explorer. Here, the end user wants to interact with the underlying logic contract and not the proxy itself. Having a common way to retrieve the logic contract address from a proxy allows a block explorer to show the ABI of the logic contract and not that of the proxy. The explorer checks the storage of the contract at the distinguished slots to determine if it is indeed a proxy, in which case it shows information on both the proxy and the logic contract. As an example, this is how &lt;code&gt;0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48&lt;&#x2F;code&gt; is shown on Etherscan:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1967&#x2F;.&#x2F;assets&#x2F;Sample-proxy-on-etherscan.png&quot; alt=&quot;Sample proxy on Etherscan&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Another example is logic contracts that explicitly act upon the fact that they are being proxied. This allows them to potentially trigger a code update as part of their logic. A common storage slot allows these use cases independently of the specific proxy implementation being used.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Monitoring of proxies is essential to the security of many applications. It is thus essential to have the ability to track changes to the implementation and admin slots. Unfortunately, tracking changes to storage slots is not easy. Consequently, it is recommended that any function that changes any of these slots SHOULD also emit the corresponding event. This includes initialization, from &lt;code&gt;0x0&lt;&#x2F;code&gt; to the first non-zero value.&lt;&#x2F;p&gt;
&lt;p&gt;The proposed storage slots for proxy-specific information are the following. More slots for additional information can be added in subsequent ERCs as needed.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;logic-contract-address&quot;&gt;Logic contract address&lt;&#x2F;h3&gt;
&lt;p&gt;Storage slot &lt;code&gt;0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc&lt;&#x2F;code&gt;
(obtained as &lt;code&gt;bytes32(uint256(keccak256(&#x27;eip1967.proxy.implementation&#x27;)) - 1)&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;Holds the address of the logic contract that this proxy delegates to. SHOULD be empty if a beacon is used instead. Changes to this slot SHOULD be notified by the event:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Upgraded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; implementation&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;beacon-contract-address&quot;&gt;Beacon contract address&lt;&#x2F;h3&gt;
&lt;p&gt;Storage slot &lt;code&gt;0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50&lt;&#x2F;code&gt; (obtained as &lt;code&gt;bytes32(uint256(keccak256(&#x27;eip1967.proxy.beacon&#x27;)) - 1)&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;Holds the address of the beacon contract this proxy relies on (fallback). SHOULD be empty if a logic address is used directly instead, and should only be considered if the logic contract slot is empty. Changes to this slot SHOULD be notified by the event:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BeaconUpgraded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; beacon&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Beacons are used for keeping the logic address for multiple proxies in a single location, allowing the upgrade of multiple proxies by modifying a single storage slot. A beacon contract MUST implement the function:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function implementation() returns (address)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Beacon based proxy contracts do not use the logic contract slot. Instead, they use the beacon contract slot to store the address of the beacon they are attached to. In order to know the logic contract used by a beacon proxy, a client SHOULD:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Read the address of the beacon for the beacon logic storage slot;&lt;&#x2F;li&gt;
&lt;li&gt;Call the &lt;code&gt;implementation()&lt;&#x2F;code&gt; function on the beacon contract.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The result of the &lt;code&gt;implementation()&lt;&#x2F;code&gt; function on the beacon contract SHOULD NOT depend on the caller (&lt;code&gt;msg.sender&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;admin-address&quot;&gt;Admin address&lt;&#x2F;h3&gt;
&lt;p&gt;Storage slot &lt;code&gt;0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103&lt;&#x2F;code&gt;
(obtained as &lt;code&gt;bytes32(uint256(keccak256(&#x27;eip1967.proxy.admin&#x27;)) - 1)&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;Holds the address that is allowed to upgrade the logic contract address for this proxy (optional). Changes to this slot SHOULD be notified by the event:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AdminChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; previousAdmin&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newAdmin&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP standardises the &lt;strong&gt;storage slot&lt;&#x2F;strong&gt; for the logic contract address, instead of a public method on the proxy contract. The rationale for this is that proxies should never expose functions to end users that could potentially clash with those of the logic contract.&lt;&#x2F;p&gt;
&lt;p&gt;Note that a clash may occur even among functions with different names, since the ABI relies on just four bytes for the function selector. This can lead to unexpected errors, or even exploits, where a call to a proxied contract returns a different value than expected, since the proxy intercepts the call and answers with a value of its own.&lt;&#x2F;p&gt;
&lt;p&gt;From &lt;em&gt;Malicious backdoors in Ethereum proxies&lt;&#x2F;em&gt; by Nomic Labs:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Any function in the Proxy contract whose selector matches with one in the implementation contract will be called directly, completely skipping the implementation code.&lt;&#x2F;p&gt;
&lt;p&gt;Because the function selectors use a fixed amount of bytes, there will always be the possibility of a clash. This isn’t an issue for day to day development, given that the Solidity compiler will detect a selector clash within a contract, but this becomes exploitable when selectors are used for cross-contract interaction. Clashes can be abused to create a seemingly well-behaved contract that’s actually concealing a backdoor.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;The fact that proxy public functions are potentially exploitable makes it necessary to standardise the logic contract address in a different way.&lt;&#x2F;p&gt;
&lt;p&gt;The main requirement for the storage slots chosen is that they must never be picked by the compiler to store any contract state variable. Otherwise, a logic contract could inadvertently overwrite this information on the proxy when writing to a variable of its own.&lt;&#x2F;p&gt;
&lt;p&gt;Solidity maps variables to storage based on the order in which they were declared, after the contract inheritance chain is linearized: the first variable is assigned the first slot, and so on. The exception is values in dynamic arrays and mappings, which are stored in the hash of the concatenation of the key and the storage slot. The Solidity development team has confirmed that the storage layout is to be preserved among new versions:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;The layout of state variables in storage is considered to be part of the external interface of Solidity due to the fact that storage pointers can be passed to libraries. This means that any change to the rules outlined in this section is considered a breaking change of the language and due to its critical nature should be considered very carefully before being executed. In the event of such a breaking change, we would want to release a compatibility mode in which the compiler would generate bytecode supporting the old layout.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;Vyper seems to follow the same strategy as Solidity. Note that contracts written in other languages, or directly in assembly, may incur in clashes.&lt;&#x2F;p&gt;
&lt;p&gt;They are chosen in such a way so they are guaranteed to not clash with state variables allocated by the compiler, since they depend on the hash of a string that does not start with a storage index. Furthermore, a &lt;code&gt;-1&lt;&#x2F;code&gt; offset is added so the preimage of the hash cannot be known, further reducing the chances of a possible attack.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * implementation address that can be &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;. This address is stored in storage in the location specified by&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-1967[EIP1967], so that it doesn&amp;#39;t conflict with the storage layout of the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * implementation behind the proxy.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC1967Proxy&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Proxy&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC1967Upgrade&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Initializes the upgradeable proxy with an initial implementation specified by `_logic`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * If `_data` is nonempty, it&amp;#39;s used as data in a delegate call to `_logic`. This will typically be an encoded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * function call, and allows initializing the storage of the proxy like a Solidity constructor.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _logic&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; payable &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_IMPLEMENTATION_SLOT &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;eip1967.proxy.implementation&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _upgradeToAndCall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_logic&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the current implementation address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _implementation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; impl&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; ERC1967Upgrade&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_getImplementation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This abstract contract provides getters and event emitting update functions for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-1967[EIP1967] slots.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;abstract&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC1967Upgrade&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This is the keccak-256 hash of &amp;quot;eip1967.proxy.rollback&amp;quot; subtracted by 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; _ROLLBACK_SLOT &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Storage slot with the address of the current implementation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * This is the keccak-256 hash of &amp;quot;eip1967.proxy.implementation&amp;quot; subtracted by 1, and is&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * validated in the constructor.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; _IMPLEMENTATION_SLOT &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when the implementation is upgraded.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Upgraded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; implementation&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the current implementation address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _getImplementation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; StorageSlot&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getAddressSlot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_IMPLEMENTATION_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Stores a new address in the EIP1967 implementation slot.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _setImplementation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newImplementation&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;Address&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;newImplementation&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC1967: new implementation is not a contract&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        StorageSlot&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getAddressSlot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_IMPLEMENTATION_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;value &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; newImplementation&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Perform implementation upgrade&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Emits an {Upgraded} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _upgradeTo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newImplementation&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _setImplementation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;newImplementation&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Upgraded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;newImplementation&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Perform implementation upgrade with additional setup call.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Emits an {Upgraded} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _upgradeToAndCall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newImplementation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; forceCall&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _upgradeTo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;newImplementation&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span&gt; forceCall&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            Address&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;functionDelegateCall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;newImplementation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Emits an {Upgraded} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _upgradeToAndCallSecure&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newImplementation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; forceCall&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; oldImplementation &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _getImplementation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Initial upgrade and setup call&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _setImplementation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;newImplementation&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span&gt; forceCall&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            Address&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;functionDelegateCall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;newImplementation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Perform rollback test if not already in progress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        StorageSlot&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;BooleanSlot &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;storage&lt;&#x2F;span&gt;&lt;span&gt; rollbackTesting &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; StorageSlot&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getBooleanSlot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_ROLLBACK_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;rollbackTesting&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Trigger rollback using upgradeTo from the new implementation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            rollbackTesting&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;value &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            Address&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;functionDelegateCall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                newImplementation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;                abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodeWithSignature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;upgradeTo(address)&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; oldImplementation&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            rollbackTesting&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;value &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check rollback was effective&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;oldImplementation &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _getImplementation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC1967Upgrade: upgrade breaks further upgrades&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Finally reset to the new implementation and log the upgrade&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            _upgradeTo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;newImplementation&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Storage slot with the admin of the contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * This is the keccak-256 hash of &amp;quot;eip1967.proxy.admin&amp;quot; subtracted by 1, and is&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * validated in the constructor.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; _ADMIN_SLOT &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when the admin account has &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AdminChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; previousAdmin&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newAdmin&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the current admin.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _getAdmin&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; StorageSlot&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getAddressSlot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_ADMIN_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Stores a new address in the EIP1967 admin slot.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _setAdmin&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newAdmin&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;newAdmin &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC1967: new admin is the zero address&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        StorageSlot&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getAddressSlot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_ADMIN_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;value &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; newAdmin&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Changes the admin of the proxy.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Emits an {AdminChanged} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _changeAdmin&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newAdmin&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AdminChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_getAdmin&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; newAdmin&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _setAdmin&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;newAdmin&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * This is bytes32(uint256(keccak256(&amp;#39;eip1967.proxy.beacon&amp;#39;)) - 1)) and is validated in the constructor.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; _BEACON_SLOT &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when the beacon is upgraded.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BeaconUpgraded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; beacon&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the current beacon.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _getBeacon&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; StorageSlot&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getAddressSlot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_BEACON_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Stores a new beacon in the EIP1967 beacon slot.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _setBeacon&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newBeacon&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;Address&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;newBeacon&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;ERC1967: new beacon is not a contract&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            Address&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IBeacon&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;newBeacon&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;implementation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;ERC1967: beacon implementation is not a contract&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        StorageSlot&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getAddressSlot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_BEACON_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;value &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; newBeacon&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Perform beacon upgrade with additional setup call. &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: This upgrades the address of the beacon, it does&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Emits a {BeaconUpgraded} event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _upgradeBeaconToAndCall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newBeacon&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; forceCall&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _setBeacon&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;newBeacon&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BeaconUpgraded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;newBeacon&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span&gt; forceCall&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            Address&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;functionDelegateCall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;IBeacon&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;newBeacon&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;implementation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This abstract contract provides a fallback function that delegates all calls to another contract using the EVM&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * be specified by overriding the virtual {_implementation} function.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * different contract through the {_delegate} function.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * The success and return data of the delegated call will be returned back to the caller of the proxy.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;abstract&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Proxy&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Delegates the current call to `implementation`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * This function does not return to its internal call site, it will return directly to the external caller.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _delegate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; implementation&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Copy msg.data. We take full control of memory in this inline assembly&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; block because it will not return to Solidity code. We overwrite the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Solidity scratch pad at memory position 0.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            calldatacopy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calldatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Call the implementation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; out and outsize are 0 because we don&amp;#39;t know the size yet.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            let&lt;&#x2F;span&gt;&lt;span&gt; result &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; delegatecall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; implementation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calldatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Copy the returned data.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            returndatacopy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returndatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            switch result&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; delegatecall returns 0 on error.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            case &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                revert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returndatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            default &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                return&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returndatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This is a virtual function that should be overridden so it returns the address to which the fallback function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * and {_fallback} should delegate.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _implementation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Delegates the current call to the address returned by `_implementation()`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * This function does not return to its internal call site, it will return directly to the external caller.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _fallback&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _beforeFallback&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _delegate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_implementation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * function in the contract matches the call data.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    fallback&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _fallback&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * is empty.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    receive&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _fallback&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * call, or as part of the Solidity `fallback` or `receive` functions.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * If overridden should call `super._beforeFallback()`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _beforeFallback&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Library for reading and writing primitive types to specific storage slots.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * This library helps with reading and writing to such slots without the need for inline assembly.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;library&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; StorageSlot&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AddressSlot&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BooleanSlot&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Bytes32Slot&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Uint256Slot&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns an `AddressSlot` with member `value` located at `slot`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getAddressSlot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; slot&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;AddressSlot&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; storage&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; r&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            r&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span&gt; slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns an `BooleanSlot` with member `value` located at `slot`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getBooleanSlot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; slot&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;BooleanSlot&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; storage&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; r&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            r&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span&gt; slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns an `Bytes32Slot` with member `value` located at `slot`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getBytes32Slot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; slot&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Bytes32Slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; storage&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; r&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            r&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span&gt; slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns an `Uint256Slot` with member `value` located at `slot`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getUint256Slot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; slot&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Uint256Slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; storage&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; r&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            r&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span&gt; slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC relies on the fact that the chosen storage slots are &lt;strong&gt;not&lt;&#x2F;strong&gt; to be allocated by the solidity compiler. This guarantees that an implementation contract will not accidentally overwrite any of the information required for the proxy to operate. As such, locations with a high slot number were chosen to avoid clashes with the slots allocated by the compiler. Also, locations with no known preimage were picked, to ensure that a write to mapping with a maliciously crafted key could not overwrite it.&lt;&#x2F;p&gt;
&lt;p&gt;Logic contracts that intend to modify proxy-specific information must do so deliberately (as is the case with UUPS) by writing to the specific storage slot.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EC arithmetic and pairings with runtime definitions</title>
        <published>2019-04-22T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Vlasov</name><uri>https://github.com/shamatar</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1962/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/generalised-precompile-for-elliptic-curve-arithmetics-and-pairings-working-group/3208/2" />
        

        <id>https://wg-eips.ritovision.com/1962/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:1962"
            label="EIP-1962" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1962/">&lt;h1 id=&quot;simple-summary&quot;&gt;Simple summary&lt;&#x2F;h1&gt;
&lt;p&gt;This proposal is an extension and formalization of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1829&#x2F;&quot;&gt;EIP-1829&lt;&#x2F;a&gt; with an inclusion of pairings. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1109&#x2F;&quot;&gt;EIP-1109&lt;&#x2F;a&gt; is required due to low cost of some operations compared to the &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; opcode (more information in the corresponding section below).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes a new precompile to bring cryptographic functionality desired for privacy and scaling solutions. Functionality of such precompile will require the following:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Implementation the following operations over elliptic curves in the Weierstrass form with curve parameters such as base field, A, B coefficients defined in runtime:
&lt;ul&gt;
&lt;li&gt;Point addition&lt;&#x2F;li&gt;
&lt;li&gt;Multiplication of a single point over a scalar&lt;&#x2F;li&gt;
&lt;li&gt;Multiexponentiation&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Implementation pairing operation over elliptic curves from the following &quot;families&quot; with parameters such as base field, extension tower structure, coefficients defined in runtime:
&lt;ul&gt;
&lt;li&gt;BLS12&lt;&#x2F;li&gt;
&lt;li&gt;BN&lt;&#x2F;li&gt;
&lt;li&gt;MNT4&#x2F;6 (Ate pairing)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Full functionality of the precompile is described below in &lt;code&gt;Specification&lt;&#x2F;code&gt; section.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;There is a pending proposal to implement base elliptic curve arithmetic is covered by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1829&#x2F;&quot;&gt;EIP-1829&lt;&#x2F;a&gt; and will allow to implement various privacy-preserving protocols with a reasonable gas costs per operation.&lt;&#x2F;li&gt;
&lt;li&gt;Pairings are an important extension for basic arithmetic and so this new precompile is proposed with the following benefits:
&lt;ul&gt;
&lt;li&gt;Extended set of curves will be available to allow Ethereum users to choose their security parameters and required functionality.&lt;&#x2F;li&gt;
&lt;li&gt;Generic approach of this precompile will allow Ethereum users to experiment with newly found curves of their choice and new constructions constructions without waiting for new forks.&lt;&#x2F;li&gt;
&lt;li&gt;EC arithmetic is indeed re-implemented in this precompile, but it&#x27;s strictly required. Most of the pairing-based protocols still need to perform standard EC multiplications or additions and thus such operations must be available on generic set of curves.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Gas costs - this EIP is designed to estimate gas-cost of performed operation as early as possible during the call and base if solely on specified parameters and operation type. This is a strict requirement for any precompile to allow Ethereum nodes to efficiently reject transactions and operations as early as possible.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Functionality of this newly proposed precompile is different from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1829&#x2F;&quot;&gt;EIP-1829&lt;&#x2F;a&gt; in the following aspects:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Operation on arbitrary-length modulus (up to some upper-limit) for a base field and scalar field of the curve&lt;&#x2F;li&gt;
&lt;li&gt;Pairing operations are introduced&lt;&#x2F;li&gt;
&lt;li&gt;Different ABI due to variable parameter length&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= XXXXX&lt;&#x2F;code&gt;, define a set of &lt;code&gt;10&lt;&#x2F;code&gt; new precompiles with an addresses &lt;code&gt;[0x.., 0x.., ...]&lt;&#x2F;code&gt; and the following functionality.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Addition of points on the curve defined over base field&lt;&#x2F;li&gt;
&lt;li&gt;Multiplication of a point on the curve defined over base field&lt;&#x2F;li&gt;
&lt;li&gt;Multiexponentiation for &lt;code&gt;N&lt;&#x2F;code&gt; pairs of &lt;code&gt;(scalar, point)&lt;&#x2F;code&gt; on the curve defined over base field&lt;&#x2F;li&gt;
&lt;li&gt;Addition of points on the curve defined over quadratic or cubic extension of the base field&lt;&#x2F;li&gt;
&lt;li&gt;Multiplication of a point on the curve defined over quadratic or cubic extension of the base field&lt;&#x2F;li&gt;
&lt;li&gt;Multiexponentiation for &lt;code&gt;N&lt;&#x2F;code&gt; pairs of &lt;code&gt;(scalar, point)&lt;&#x2F;code&gt; on the curve defined over quadratic or cubic extension of the base field&lt;&#x2F;li&gt;
&lt;li&gt;Pairing operation on the curve of &lt;code&gt;BLS12&lt;&#x2F;code&gt; family&lt;&#x2F;li&gt;
&lt;li&gt;Pairing operation on the curve of &lt;code&gt;BN&lt;&#x2F;code&gt; family&lt;&#x2F;li&gt;
&lt;li&gt;Pairing operation on the curve of &lt;code&gt;MNT4&lt;&#x2F;code&gt; family&lt;&#x2F;li&gt;
&lt;li&gt;Pairing operation on the curve of &lt;code&gt;MNT6&lt;&#x2F;code&gt; family&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Due to actuve development of the precompile and a lot of ongoing changes there is a single &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;matter-labs&#x2F;eip1962&#x2F;tree&#x2F;master&#x2F;documentation&quot;&gt;source of truth&lt;&#x2F;a&gt;. It covers binary interface, gas schedule, integration guide for existing implementations.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;possible-simplifications&quot;&gt;Possible simplifications&lt;&#x2F;h3&gt;
&lt;p&gt;Due to high complexity of the proposed operations in the aspects of implementation, debugging and evaluation of the factors for gas costs it may be appropriate to either limit the set of curves at the moment of acceptance to some list and then extend it. Another approach (if it&#x27;s technically possible) would be to have the &quot;whilelist&quot; contract that can be updated without consensus changes (w&#x2F;o fork).&lt;&#x2F;p&gt;
&lt;p&gt;In the case of limited set of curve the following set is proposed as a minimal:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;BN254 curve from the current version of Ethereum&lt;&#x2F;li&gt;
&lt;li&gt;BN curve from DIZK with 2^32 roots of unity&lt;&#x2F;li&gt;
&lt;li&gt;BLS12-381&lt;&#x2F;li&gt;
&lt;li&gt;BLS12-377 from ZEXE with large number of roots of unity&lt;&#x2F;li&gt;
&lt;li&gt;MNT4&#x2F;6 cycle from the original &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;eprint.iacr.org&#x2F;2014&#x2F;595.pdf&quot;&gt;paper&lt;&#x2F;a&gt;. It&#x27;s not too secure, but may give some freedom for experiments.&lt;&#x2F;li&gt;
&lt;li&gt;MNT4&#x2F;6 cycle from Coda if performance allows&lt;&#x2F;li&gt;
&lt;li&gt;Set of CP generated curves that would allow embedding of BLS12-377 and may be some BN curve that would have large power of two divisor for both base field and scalar field modulus (example of CP curve for BLS12-377 can be found in ZEXE).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Only the largest design decisions will be covered:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;While there is no arithmetic over the scalar field (which is modulo size of the main group) of the curve, it&#x27;s required for gas estimation purposes.&lt;&#x2F;li&gt;
&lt;li&gt;Multiexponentiation is a separate operation due to large cost saving&lt;&#x2F;li&gt;
&lt;li&gt;There are no point decompressions due to impossibility to get universal gas estimation of square root operation. For a limited number of &quot;good&quot; cases prices would be too different, so specifying the &quot;worst case&quot; is expensive and inefficient, while introduction of another level if complexity into already complicated gas costs formula is not worth is.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;this-precompile-and-eip-1109&quot;&gt;This precompile and EIP 1109&lt;&#x2F;h3&gt;
&lt;p&gt;While there is no strict requirement of EIP 1109 for functionality, here is an example why it would be desired:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;BLS12-381 curve, 381 bit modulus, 255 bit scalar field, no native arithmetic is available in EVM for this&lt;&#x2F;li&gt;
&lt;li&gt;Point addition would take 5000ns (quite overestimated)&lt;&#x2F;li&gt;
&lt;li&gt;Point multiplication would take roughly 150000ns&lt;&#x2F;li&gt;
&lt;li&gt;Crude gas schedule 15 Mgas&#x2F;second from ECRecover precompile&lt;&#x2F;li&gt;
&lt;li&gt;Point addition would cost 75 gas, with &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; adding another 700&lt;&#x2F;li&gt;
&lt;li&gt;Point multiplication would cost 2250 gas&lt;&#x2F;li&gt;
&lt;li&gt;One should also add the cost of memory allocation that is at least &lt;code&gt;1 + 1 + 48 + 48 + 48 + 1 + 32 + 2*48 + 2*48 = 371 byte&lt;&#x2F;code&gt; that is around 12 native Ethereum &quot;words&quot; and will require extra 36 gas (with negligible price for memory extension)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Based on these quite crude estimations one can see that &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; price will dominate the total cost (in case of addition) or bring significant overhead (in case of multiplication operation) in case of calls to this precompile.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change is not backwards compatible and requires hard fork to be activated.&lt;&#x2F;p&gt;
&lt;p&gt;Functionality of the new precompile itself does not affect any existing functionality of Ethereum or EVM.&lt;&#x2F;p&gt;
&lt;p&gt;This precompile may serve as a complete replacement of the current set of &lt;code&gt;ECADD&lt;&#x2F;code&gt;, &lt;code&gt;ECMUL&lt;&#x2F;code&gt; and pairing check precompiles (&lt;code&gt;0x06&lt;&#x2F;code&gt;, &lt;code&gt;0x07&lt;&#x2F;code&gt;, &lt;code&gt;0x08&lt;&#x2F;code&gt;)&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases are the part of the implementation with a link below.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;There is an ongoing implementation effort &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;matter-labs&#x2F;eip1829&quot;&gt;here&lt;&#x2F;a&gt;. Right now:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Non-pairing operations are implemented and tested.&lt;&#x2F;li&gt;
&lt;li&gt;BLS12 family is completed and tested for BLS12-381 and BLS12-377 curves.&lt;&#x2F;li&gt;
&lt;li&gt;BN family is completed and tested with BN254 curve.&lt;&#x2F;li&gt;
&lt;li&gt;Cocks-Pinch method curve is tested for k=6 curve from ZEXE.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;preliminary-benchmarks&quot;&gt;Preliminary benchmarks&lt;&#x2F;h2&gt;
&lt;p&gt;cp6 in benchmarks is a Cocks-Pinch method curve that embeds BLS12-377. Machine: Core i7, 2.9 GHz.&lt;&#x2F;p&gt;
&lt;p&gt;Multiexponentiation benchmarks take 100 pairs &lt;code&gt;(generator, random scalar)&lt;&#x2F;code&gt; as input. Due to the same &quot;base&quot; it may be not too representative benchmark and will be updated.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;test pairings::bls12::tests::bench_bls12_381_pairing    ... bench:   2,348,317 ns&#x2F;iter (+&#x2F;- 605,340)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;test pairings::cp::tests::bench_cp6_pairing             ... bench:  86,328,825 ns&#x2F;iter (+&#x2F;- 11,802,073)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;test tests::bench_addition_bn254                        ... bench:         388 ns&#x2F;iter (+&#x2F;- 73)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;test tests::bench_doubling_bn254                        ... bench:         187 ns&#x2F;iter (+&#x2F;- 4)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;test tests::bench_field_inverse                         ... bench:       2,478 ns&#x2F;iter (+&#x2F;- 167)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;test tests::bench_field_mont_inverse                    ... bench:       2,356 ns&#x2F;iter (+&#x2F;- 51)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;test tests::bench_multiplication_bn254                  ... bench:      81,744 ns&#x2F;iter (+&#x2F;- 6,984)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;test tests::bench_multiplication_bn254_into_affine      ... bench:      81,925 ns&#x2F;iter (+&#x2F;- 3,323)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;test tests::bench_multiplication_bn254_into_affine_wnaf ... bench:      74,716 ns&#x2F;iter (+&#x2F;- 4,076)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;test tests::bench_naive_multiexp_bn254                  ... bench:  10,659,911 ns&#x2F;iter (+&#x2F;- 559,790)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;test tests::bench_peppinger_bn254                       ... bench:   2,678,743 ns&#x2F;iter (+&#x2F;- 148,914)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;test tests::bench_wnaf_multiexp_bn254                   ... bench:   9,161,281 ns&#x2F;iter (+&#x2F;- 456,137)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>New Opcode to check if a chainID is part of the history of chainIDs</title>
        <published>2019-04-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Ronan Sandford</name><uri>https://github.com/wighawag</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1959/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-1959-valid-chainid-opcode/3170" />
        

        <id>https://wg-eips.ritovision.com/1959/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:1959"
            label="EIP-1959" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1959/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;To protect off-chain messages from being reused across different chain, a mechanism need to be given to smart contract to only accept messages for that chain. Since a chain can change its chainID, the mechanism should consider old chainID valid.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP adds an opcode that returns whether the specific number passed in has been a valid chainID (EIP-155 unique identifier) in the history of the chain (including the current chainID).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt; proposes to use the chain ID to prevent replay attacks between different chains. It would be a great benefit to have the same possibility inside smart contracts when handling signatures, especially for Layer 2 signature schemes using &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1344&#x2F;&quot;&gt;EIP-1344&lt;&#x2F;a&gt; is attempting to solve this by giving smart contract access to the tip of the chainID history. This is insufficient as such value is changing. Hence why EIP-1344 describes a contract based solution to work around the problem. It would be better to solve it in a simpler, cheaper and safer manner, removing the potential risk of misuse present in EIP-1344.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Adds a new opcode &lt;code&gt;VALID_CHAINID&lt;&#x2F;code&gt; at 0x46, which uses 1 stack argument : a 32 bytes value that represent the chainID to test. It will push &lt;code&gt;0x1&lt;&#x2F;code&gt; onto the stack if the uint256 value is part of the history (since genesis) of chainIDs of that chain, &lt;code&gt;0x0&lt;&#x2F;code&gt; otherwise.&lt;&#x2F;p&gt;
&lt;p&gt;The operation costs &lt;code&gt;G_blockhash&lt;&#x2F;code&gt; to execute.&lt;&#x2F;p&gt;
&lt;p&gt;The cost of the operation might need to be adjusted later as the number of chainID in the history of the chain grows.&lt;&#x2F;p&gt;
&lt;p&gt;Note though that the alternative to keep track of old chainID is to implement a smart contract based caching solution as EIP-1344 proposes comes with an overall higher gas cost. As such the gas cost is simply a necessary cost for the feature.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The only approach available today is to specify the chain ID at compile time. Using this approach will result in problems after a contentious hardfork as the contract can&#x27;t accept message signed with a new chainID.&lt;&#x2F;p&gt;
&lt;p&gt;The approach proposed by EIP-1344 is to give access to the latest chainID. This is in itself not sufficient and pose the opposite of the problem mentioned above since as soon as a hardfork that change the chainID happens, every L2 messages signed as per &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; (with the previous chainID) will fails to be accepted by the contracts after the fork.&lt;&#x2F;p&gt;
&lt;p&gt;That&#x27;s why in the rationale of EIP-1344 it is mentioned that users need to implement&#x2F;use a mechanism to verify the validity of past chainID via a trustless cache implemented via smart contract.&lt;&#x2F;p&gt;
&lt;p&gt;While this works (except for a temporary gap where the immediately previous chainID is not considered valid), this is actually a required procedure for all contracts that want to accept L2 messages since without it, messages signed before a hardfork that updated the chainID would be rejected. In other words, EIP-1344 expose such risk and it is easy for contract to not consider it by simply checking &lt;code&gt;chainID == CHAIN_ID()&lt;&#x2F;code&gt; without considering past chainIDs.&lt;&#x2F;p&gt;
&lt;p&gt;Indeed letting contracts access the latest chainID for L2 message verification is dangerous. The latest chainID is only the tip of the chainID history. As a changing value, the latest chainID is thus not appropriate to ensure the validity of L2 messages.&lt;&#x2F;p&gt;
&lt;p&gt;Users signing off-chain messages expect their messages to be valid from the time of signing and do not expect these message to be affected by a future hardfork. If the contract use the latest chainID as is for verification, the messages would be invalid as soon as a hardfork that update the chainID happens. For some applications, this will require users to resubmit a new message (think meta transaction), causing them potential loss (or some inconvenience during the hardfork transition), but for some other applications (think state channel) the whole off-chain state become inaccessible, resulting in potentially disastrous situations.&lt;&#x2F;p&gt;
&lt;p&gt;In other words, we should consider all off-chain messages (with valid chainID) as part of the chain&#x27;s offchain state. The opcode proposed here, offer smart contracts a simple and safe method to ensure that the offchain state stay valid across fork.&lt;&#x2F;p&gt;
&lt;p&gt;As for replay protection, the idea of considering all of the off-chain messages signed with valid chainID as part of the chain&#x27;s offchain-state means that all of these off-chain messages can be reused on the different forks which share a common chainID history (up to where they differ). This is actually an important feature since as mentioned, users expect their signed messages to be valid from the time of signing. From that time onwards these messages should be considered as part of the chain&#x27;s offchain state. A hardfork should not thus render them invalid. This is similar to how the previous on-chain state is shared between 2 hardforks.&lt;&#x2F;p&gt;
&lt;p&gt;The wallets will make sure that at any time, a signing message request use the latest chainID of the chain being used. This prevent replay attack onto chain that have different chainID histories (they would not have the same latest chainID).&lt;&#x2F;p&gt;
&lt;p&gt;Now it is argued in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum-magicians.org&#x2F;t&#x2F;eip-1344-add-chain-id-opcode&#x2F;1131&quot;&gt;EIP1344 discussion&lt;&#x2F;a&gt; that when a contentious hardfork happen and one side of the fork decide to not update its chainID, that side of the chain would be vulnerable to replays since users will keep signing with a chainID that is also valid in the chain that forked. An issue also present in EIP-1344.&lt;&#x2F;p&gt;
&lt;p&gt;This is simply a natural consequence of using chainID as the only anti-replay information for L2 messages. But this can indeed be an issue if the hardfork is created by a small minority. In that case if the majority ignore the fork and do not update its chainID, then all new message from the majority chain (until they update their chainID) can be replayed on the minority-led hardfork since the majority&#x27;s current chainID is also part of the minority-led fork&#x27;s chainID history.&lt;&#x2F;p&gt;
&lt;p&gt;To fix this, every message could specify the block number representing the time it was signed. The contract could then verify that chainID specified as part of that message was valid at that particular block.&lt;&#x2F;p&gt;
&lt;p&gt;While EIP-1344 can&#x27;t do that accurately as the caching system might leave a gap, this proposal can solve it if it is modified to return the blockNumber at which a chainID become invalid. Unfortunately, this would be easy for contracts to not perform that check. And since it suffice of only one important applications to not follow this procedure to put the minority-led fork at a disadvantage, this would fail to achieve the desired goal of protecting the minority-led fork from replay.&lt;&#x2F;p&gt;
&lt;p&gt;Since a minority-led fork ignored by the majority means that the majority will not keep track of the messages to be submitted (state channel, ...), if such fork get traction later, this would be at the expense of majority users who were not aware of it. As such this proposal assume that minority-led fork will not get traction later and thus do not require to be protected.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is fully backwards compatible with all chains which implement EIP-155 chain ID domain separator for transaction signing. Existing contract are not affected.&lt;&#x2F;p&gt;
&lt;p&gt;Similarly to EIP-1344, it might be beneficial to update EIP-712 (still in Draft) to deal with chainID separately from the domain separator. Indeed since chainID is expected to change, if the domain separator include chainID, it would have to be dynamically computed. A caching mechanism could be used by smart contract instead though.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;&#x2F;h2&gt;
&lt;p&gt;This was previously suggested as part of &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum-magicians.org&#x2F;t&#x2F;eip-1344-add-chain-id-opcode&#x2F;1131&#x2F;39&quot;&gt;EIP-1344 discussion&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Method to check if a chainID is valid at a specific block Number</title>
        <published>2019-04-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Ronan Sandford</name><uri>https://github.com/wighawag</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1965/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-1965-valid-chainid-for-specific-blocknumber-protect-all-forks/3181" />
        

        <id>https://wg-eips.ritovision.com/1965/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1965"
            label="EIP-1965" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1965/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP adds a precompile that returns whether a specific chainID (EIP-155 unique identifier) is valid at a specific blockNumber. ChainID are assumed to be valid up to the blockNumber at which they get replaced by a new chainID.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt; proposes to use the chain ID to prevent the replay of transactions between different chains. It would be a great benefit to have the same possibility inside smart contracts when handling off-chain message signatures, especially for Layer 2 signature schemes using &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1344&#x2F;&quot;&gt;EIP-1344&lt;&#x2F;a&gt; is attempting to solve this by giving smart contract access to the tip of the chainID history. This is insufficient as such value is changing. Hence why EIP-1344 describes a contract based solution to work around the problem. It would be better to solve it in a simpler, cheaper and safer manner, removing the potential risk of misuse present in EIP-1344. Furthermore EIP-1344 can&#x27;t protect replay properly for minority-led hardfork as the caching system cannot guarantee accuracy of the blockNumber at which the new chainID has been introduced.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1959&#x2F;&quot;&gt;EIP-1959&lt;&#x2F;a&gt; solves the issue of EIP-1344 but does not attempt to protect from minority-led hardfork as mentioned in the rationale. We consider this a mistake, since it removes some freedom to fork. We consider that all fork should be given equal opportunities. And while there will always be issues we can&#x27;t solve for the majority that ignore a particular fork, &lt;strong&gt;users that decide to use both the minority-fork and the majority-chain should be protected from replay without having to wait for the majority chain to update its chainID.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Adds a new precompile which uses 2 arguments : a 32 bytes value that represents the chainID to test and a 32 bytes value representing the blockNumber at which the chainID is tested. It returns 0x1  if the chainID is valid at the specific blockNumber, 0x0 otherwise. Note that chainID are considered valid up to the blockNumber at which they are replaced. So they are valid for every blockNumber past their replacement.&lt;&#x2F;p&gt;
&lt;p&gt;The operation will costs no more than &lt;code&gt;G_blockhash&lt;&#x2F;code&gt; + &lt;code&gt;G_verylow&lt;&#x2F;code&gt; to execute. This could be lower as chainID are only introduced during hardfork.&lt;&#x2F;p&gt;
&lt;p&gt;The cost of the operation might need to be adjusted later as the number of chainID in the history of the chain grows.&lt;&#x2F;p&gt;
&lt;p&gt;Note though that the alternative to keep track of old chainID is to implement a smart contract based caching solution as EIP-1344 proposes comes with an overall higher gas cost and exhibit issues for minority-led hardfork (see Rationale section below). As such the gas cost is simply a necessary cost for the feature.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The rationale at EIP-1959 applies here as well too :&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;An opcode is better than a caching system for past chainID, It is cheaper, safer and does not include gaps.&lt;&#x2F;li&gt;
&lt;li&gt;Direct access to the latest chainID is dangerous since it makes it easy for contracts to use it as a replay protection mechanism while preventing otherwise valid old messages to be valid after a fork that changes the chainID. This can have disastrous consequences on users.&lt;&#x2F;li&gt;
&lt;li&gt;all off-chain messages signed before a fork should be valid across all side of the fork.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The only difference is that this current proposal proposes a solution to protect hardfork led by a minority.&lt;&#x2F;p&gt;
&lt;p&gt;To summarize there is 2 possible fork scenario :&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;The majority decide to make a hardfork but a minority disagree with it (ETC is such example). The fork is planned for block X. If the majority is not taking any action to automate the process of assigning a different chainID for both, the minority has plenty of time to plan for a chainID upgrade to happen at that same block X. Now if they do not do it, their users will face the problem that their messages will be replayable on the majority chain (Note that this is not true the other way around as we assume the majority decided to change the chainID). As such there is no reason that they will leave it that way.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;A minority decide to create a hardfork that the majority disagree with (or simply ignore). Now, the same as above can happen but since we are talking about a minority there is a chance that the majority does not care about the minority. In that case, there would be no incentive for the majority to upgrade the chainID. This means that users of both sides of the fork will have the messages meant for the majority chain replayable on the minority-chain (even if this one changed its chainID) unless extra precaution is taken.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The solution is to add the blockNumber representing the time at which the message was signed and use it as an argument to the opcode proposed here. This way, when the minority forks with a new chainID, the previous chainID become invalid from that time onward. So new messages destined to the majority chain can&#x27;t be replayed on the minority fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;EIP-712 is still in draft but would need to be updated to include the blockNumber as part of the values that wallets need to verify for the protection of their users.&lt;&#x2F;p&gt;
&lt;p&gt;Since chainID and blockNumber will vary, they should not be part of the domain separator (meant to be generated once) but another part of the message.&lt;&#x2F;p&gt;
&lt;p&gt;While the pair could be optional for contract that do not care about replays or have other ways to prevent them, if chainID is present, the blockNumber must be present too. And if any of them is present, wallet need to ensure that the chainID is indeed the latest one of the chain being used, while the blockNumber is the latest one at the point of signing. During fork transition, the wallet can use the blockNumber to know which chainID to use.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;&#x2F;h2&gt;
&lt;p&gt;This was previously suggested as part of &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum-magicians.org&#x2F;t&#x2F;eip-1959-valid-chainid-opcode&#x2F;3170&quot;&gt;EIP1959 discussion&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Block Rewards Proposal for funding Eth1.x</title>
        <published>2019-04-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>James Hancock</name><uri>https://github.com/madeoftin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2025/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/MadeofTin/EIPs/issues" />
        

        <id>https://wg-eips.ritovision.com/2025/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2025"
            label="EIP-2025" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2025/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Add &lt;code&gt;0.0055 ETH&lt;&#x2F;code&gt; per block for 18 months (A total of 17050 ETH) as a developer block reward reserved for funding specific Ethereum1.X working groups. The working groups are State rent (750k), Better sync (360k), Finality gadget (360k), Fee market (360k), Testing infrastructure (360k). Governance of the funds will be through a multisig of trusted individuals from the ecosystem including client teams, the foundation, and the community.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1890&#x2F;&quot;&gt;EIP-1890&lt;&#x2F;a&gt; proposes a mechanism to capture a portion of block rewards for sustainably funding ongoing network development. That EIP sets values and addresses to zero and so does not actually collect any rewards. This proposal is to explicitly set those values and begin collecting a portion of block rewards for 18 months in order to fund Ethereum 1.X working groups and organization efforts. This funding will be used to repay an initial loan provided by investors in the community funding this work with a small amount of interest. After 18 months the block reward would again reduce to zero.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP extends the mechanism established in EIP-1890 to add &lt;code&gt;0.0055 ETH&lt;&#x2F;code&gt; to the block reward for a specific distribution period of &lt;code&gt;3,100,000 BLOCKS&lt;&#x2F;code&gt;(≈ 18 months). The &lt;code&gt;RECIPIENT_ADDRESS&lt;&#x2F;code&gt; is set to a smart contract with hardcoded denominations that distributes incoming ETH to a set of addresses for the purpose of Eth1.X development. The emission schedule would start at the hard fork block number and continue for &lt;code&gt;3,100,000 BLOCKS&lt;&#x2F;code&gt; (≈ 18 months) at which point the address and amount would again return to 0. Any further distribution would require a future hard fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The context for this proposal came from attending the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=Au1Qll-86v0&quot;&gt;Core Dev Eth1.X Meeting&lt;&#x2F;a&gt; in Berlin. Development is needed to move Eth1.X forward, and I observed that a lack of funding is the primary barrier to this work. This work can only be effectively conducted by working groups forming around these issues, and these working groups need funding in order to pay dedicated contractors and project managers. This proposal is a plan for funding these groups and supporting their operation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Two constants will be introduced:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;REWARD_DURATION_IN_BLOCKS&lt;&#x2F;code&gt;, which specifies the number of blocks after &lt;code&gt;ISTANBUL_BLOCK_HEIGHT&lt;&#x2F;code&gt; when the reward collection will terminate (i.e., at block &lt;code&gt;ISTANBUL_BLOCK_HEIGHT + REWARD_DURATION_IN_BLOCKS&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;BENEFICIARY_ADDRESSES&lt;&#x2F;code&gt;, a list of tuples containing the address and the amount to be transferred to this address per block. These amounts will be determined as the loan is collected from participating organizations and the addresses for repayment will be specified by them. The total of the amounts will sum to 0.0055. At the end of &lt;code&gt;REWARD_DURATION_IN_BLOCKS&lt;&#x2F;code&gt; the loan will be completely repaid.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;REWARD_DURATION_IN_BLOCKS = 3100000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;DEVFUND_BLOCK_REWARD = 0.0055&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;BENEFICIARY_ADDRESSES = [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; (&amp;lt;address&amp;gt;, &amp;lt;amount_in_eth&amp;gt;),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; (&amp;lt;address&amp;gt;, &amp;lt;amount_in_eth&amp;gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Beginning with block &lt;code&gt;ISTANBUL_BLOCK_HEIGHT&lt;&#x2F;code&gt;, the reward is added to the participating addresses within &lt;code&gt;BENEFICIARY_ADDRESSES&lt;&#x2F;code&gt; at each block until the end of the &lt;code&gt;REWARD_DURATION_IN_BLOCKS&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;IF (CURRENT_BLOCK - ISTANBUL_BLOCK_HEIGHT &amp;lt;= REWARD_DURATION_IN_BLOCKS)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;FOR BENEFICIARY in BENEFICIARY_ADDRESSES:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  BENEFICIARY[0].balance += BENEFICIARY[1]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rewards-distribution-rationale&quot;&gt;Rewards Distribution Rationale&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; Development loan repayment: 0.005 ETH per block: 15500 ETH total&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; Development loan interest (10% total over the period, simple interest): 0.0005 ETH per block: 1550 ETH total&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; Total Block Reward Increase = `0.0055` ETH per block: 17050 ETH Total&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;em&gt;With a price of Ethereum at $150.00 this will raise approx USD $2,325,000.00 for developing Eth1.X over the next 18 months.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2025&#x2F;.&#x2F;assets&#x2F;block_rewards_distribution.png&quot; alt=&quot;Block Rewards Distribution&quot; &#x2F;&gt; *Specific Addresses to be determined&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2025&#x2F;#why-hardcoded-values&quot;&gt;FAQ - Why hardcoded values?&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;There has been great public debate concerning EIP-1890, and one of the primary concerns is that it is difficult to evaluate the proposal without more complete information on how funds would be raised, how they would be administered, and how they would be used. There is a need for funding Eth1.x development and it is currently unclear where those funds will come from. This proposal is intended to give a more comprehensive proposal for its funding. In the case that ETH1.x is fully funded before the Istanbul upgrade I will withdraw this EIP. Until that point I intend to continue championing this proposal as a valid funding mechanism for this work.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-a-loan&quot;&gt;Why a loan?&lt;&#x2F;h3&gt;
&lt;p&gt;The Eth1x initiative needs funding now, not in 18 months. A loan is necessary to complete certain stages of work before the funding mechanism begins to provide funds. A loan would provide this necessary funding today, and the investors willing to front this cost can recoup their contribution + a reward of &lt;em&gt;a fixed interest rate&lt;&#x2F;em&gt; for the risk on their loan. This arrangement will make it easier to find investors willing to participate who have sufficient funds.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;loan-repayment&quot;&gt;Loan Repayment&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2025&#x2F;.&#x2F;assets&#x2F;loan_state.png&quot; alt=&quot;Loan State Diagram&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;There is a risk that the investors lose part of their contribution in the case that this EIP is rejected by the community between the time the funds have been collected and the beginning of the payout schedule. In this case all remaining funds will be returned to the contributors. The interest on the loan is an incentive for investors to participate in spite of this risk. Their downside is limited to the amount of funds spent before this EIP is accepted or rejected, which should be no more than about 5%, while their upside consists of the 10% simple interest paid over the period.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;development-loan&quot;&gt;Development Loan&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;Development Loan: 0.005&lt;&#x2F;code&gt; over 3.1 Million blocks = 15500 ETH&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Funding Working Groups on 1.X&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Funding Contractors, Coordinators, and project managers&lt;&#x2F;li&gt;
&lt;li&gt;Working Groups defined with clear mandates&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Budget&lt;&#x2F;p&gt;
&lt;p&gt;Working groups&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;State rent (750k)&lt;&#x2F;li&gt;
&lt;li&gt;Better sync (360k)&lt;&#x2F;li&gt;
&lt;li&gt;finality gadget (360k)&lt;&#x2F;li&gt;
&lt;li&gt;Fee market (360k)&lt;&#x2F;li&gt;
&lt;li&gt;testing infrastructure (360k)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;ETH1.X Core Dev Gatherings&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Funding hosting, traveling, and accommodations for necessary in-person gatherings of ETH1.X core developers similar to the Stanford and Berlin ETH1.X Core Dev Meeting held earlier this year.&lt;&#x2F;p&gt;
&lt;p&gt;At the end of the 18 Months, the whole process would be torn down to prevent any internal tyranny of structurelessness forming within.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2025&#x2F;#how-will-funding-the-devs-be-organized&quot;&gt;FAQ - How will the funding of the devs be organized?&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;accountability&quot;&gt;Accountability&lt;&#x2F;h2&gt;
&lt;p&gt;The funds will be transferred into DAI and secured in a multi-sig comprised of members of the community. Representatives from the following groups will receive a key.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;EIP Editors&lt;&#x2F;li&gt;
&lt;li&gt;Geth&lt;&#x2F;li&gt;
&lt;li&gt;Parity&lt;&#x2F;li&gt;
&lt;li&gt;ConsenSys&#x2F;PegaSys (PegaSys)&lt;&#x2F;li&gt;
&lt;li&gt;The Ethereum Foundation (Hudson Jameson)&lt;&#x2F;li&gt;
&lt;li&gt;Community&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;personal-notes-and-disclosure&quot;&gt;Personal Notes and Disclosure&lt;&#x2F;h2&gt;
&lt;p&gt;I want to address any concerns about conflicts of interests directly. My participation with Eth1.X currently has been as a volunteer. I am in talks about a possible funded role helping with testing and coordination. If my work for with Eth1.x is funded, I will accept no additional funding collected by the mechanism proposed in this EIP.&lt;&#x2F;p&gt;
&lt;p&gt;Eth1.X is the now of Ethereum and I would like to see it succeed. This is the intent of my proposal.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;coi&quot;&gt;COI&lt;&#x2F;h3&gt;
&lt;p&gt;Previously I was PM for Tennagraph, a signalling solution for Ethereum. An Aragon grant funded this project and was distributed through Giveth and an AragonDAO. I have not received any funding from the project beyond this grant. All of this is verifiable on-chain. I am stepping down from any paid role on the project to continue as an advisor. I am also stepping down as a moderator for stances as there is a COI moderating stances for EIPs I am working with directly.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;disclaimer&quot;&gt;Disclaimer&lt;&#x2F;h3&gt;
&lt;p&gt;I do not claim to represent the community with my views; any members who wish to join supporting me with this proposal are free to do so. This is as fair of a proposal as I can personally conceive.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP has no impact on backwards compatibility.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Not Implemented&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Not Implemented&lt;&#x2F;p&gt;
&lt;h2 id=&quot;faq&quot;&gt;FAQ&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-hardcoded-values&quot;&gt;Why Hardcoded Values?&lt;&#x2F;h3&gt;
&lt;p&gt;Why not use a smart contract with some governance mechanism to allow changing the distribution of funds? Wouldn’t that be more flexible and effective?&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;TLDR: This EIP is not about governance reform&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;First, the payment of the loan will be hardcoded. Once agreed, the terms must be kept to give the lenders confidence in the repayment of the loan. As long as blocks are created the debt will be paid back. This is the essence of a trustless smart contract.&lt;&#x2F;p&gt;
&lt;p&gt;After the loan, there is the option to allow the amounts (limited to less than .05ETH), and the locations (orgs that receive ecosystem funding) to be changed throughout the emission schedule. It is pretty easy to imagine a smart contract or DAO fulfilling this role. However, there are three classes of options available today we can consider when governing changes.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Give the Keys to the Hands of the Few (Oligarchy)&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Create a multisig that allows a group of individuals to update the smart contract. The most likely candidates for this are the Core Devs themselves, but it could also be a trusted few from the community&#x2F;stakeholders. No matter how you slice it, there is a fundamental issue in deciding who gets to decide. There currently is not a trusted&#x2F;adopted governance mechanism to make these decisions within the Ethereum ecosystem. Also, preventing changing the contract in self interest is difficult without a well-engineered governance system of checks and balances. This EIP does not claim nor aim to solve these issues.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Give the Keys to the Hands of the Many (Plutarchy)&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Allow ethereum holders with coin votes to update the smart contract. Using holographic consensus could overcome the issue of voter turnout as it scales as participation scales, even to the size of the whole network. This has some benefits as the entire network can participate. However, the problem is that some individuals in the network are over represented -- the wealthy. Without a solution to identity that has been agreed to and implemented by the entire Ethereum Network, there is no way around giving more power in votes to the rich. This EIP does not claim, nor aim to solve these issues.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Use Ethereum Governance as it is Today&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Criticisms or support aside, there is a system that governs Ethereum today. It is a mix of rough consensus among core devs, miners running nodes, clients implementing changes, and stakeholders adopting those changes. It includes yelling or not yelling on twitter and reddit. It is complicated and I don’t claim to understand it. Even without a clear view of how it works, there is evidence of its existence. This evidence is there are changes that have allowed to be implemented, and changes that have not allowed to be implemented in Ethereum.&lt;&#x2F;p&gt;
&lt;p&gt;I do not aim to change Ethereum governance. Because this EIP has hardcoded values, it must go through the existing governance process, whatever that is, before it is implemented. It will then continue to operate until the end of the emission schedule. This is intentional. This makes it uncapturable. No party other then the ecosystem itself can modify the contract once it has been deployed.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP is not about governance reform.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-not-allow-current-client-implementors-fund-this-work-ef-consensys-parity-etc&quot;&gt;Why not allow current client implementors fund this work? (EF, Consensys, Parity, etc...)&lt;&#x2F;h3&gt;
&lt;p&gt;Historically there has been a precedent that the Ethereum Foundation is solely responsible for funding the development of Ethereum. This process has evolved as the development has become more distributed. Aya Miyaguchi observed in a recent &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.coindesk.com&#x2F;ethereum-foundation-director-sets-new-vision-for-blockchain-non-profit&quot;&gt;Coindesk article&lt;&#x2F;a&gt;, “it really is not only Ethereum Foundation people who are building [Ethereum]”. Yes, we could rely on the Ethereum Foundation to fund Eth1.X. But, why should we? This is a call for the network to come together and fund its own development. Ethereum &lt;em&gt;the network&lt;&#x2F;em&gt; is not owned by any one organization or group of people. We are lucky to have the EF and I consider this EIP in support of their coordination efforts.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;how-will-funding-the-devs-be-organized&quot;&gt;How Will Funding the Devs be Organized&lt;&#x2F;h3&gt;
&lt;p&gt;I do not profess to know the best way to organize these funds. There is work already in progress to organize these efforts championed by Alexey Akhunov. The following is a quote from a &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;medium.com&#x2F;@akhounov&#x2F;ethereum-1x-as-an-attempt-to-change-the-process-783efa23cf60&quot;&gt;recent medium article&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;“Going from funding a few implementation teams continuously and letting them do &#x27;their stuff&#x27; to funding more specific and temporary initiatives requires looking at funding through different lenses. How much &#x27;due diligence&#x27; and oversight is too much (in terms of overhead), who can decide whether working groups actually deliver, etc. This is also solvable, and also more on this will come later (not in this post).&quot;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;My suggestion would be to create an Eth1.X core developer DAO using &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;daostack.io&#x2F;&quot;&gt;DaoStack&lt;&#x2F;a&gt; to coordinate membership and payment of the Core Devs, but ultimately they are capable of determining the system that works best for them. As long as the system is transparent and mature enough to distribute funds when the time comes, this is sufficient for now.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;isn-t-a-loan-considered-a-security-or-is-it&quot;&gt;Isn&#x27;t a loan considered a security, or is it?&lt;&#x2F;h3&gt;
&lt;p&gt;I am not a lawyer and will seek further guidance from lawyers in the field on this point in particular. From the research I have done and conversations I have had there is a very good argument that a loan of this nature will not be considered a security by the US Supreme Court.
As the result of &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;casetext.com&#x2F;case&#x2F;reves-v-ernst-young&quot;&gt;REVES ET AL. v . ERNST YOUNG 1990&lt;&#x2F;a&gt;, the court stated that a home loan, consumer financing, a loan secured by a lien on a small business or some assets of a small business, short term notes, or notes that formalize a debt incurred in the ordinary course of business are not securities. If the note resembles the items listed above (home loans, etc.) then the note will not be deemed a security. The Supreme Court provided four factors to determine if a note sufficiently resembles the types of notes that are not classified as securities. (&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.invigorlaw.com&#x2F;loan-subject-securities-regulations&#x2F;&quot;&gt;source&lt;&#x2F;a&gt;)&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Family Resemblance Test&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The intentions of the company and the individual—if the company raised money for general use in a business enterprise, then the note is more likely to be a security; if the individual agreed to the loan primarily for the profit the note was expected to generate, the note is more likely to be a security.&lt;&#x2F;li&gt;
&lt;li&gt;The plan of distribution—the more widely the note is offered, the more likely it is to be found a security.&lt;&#x2F;li&gt;
&lt;li&gt;The expectations of the investing public—if the investors thought they were investing in a business to make a profit on their investment, the note is more likely to be found a security.&lt;&#x2F;li&gt;
&lt;li&gt;Other risk-reducing factor—if the note is collateralized or otherwise less risky than common notes, the note is less likely to be found to be a security.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The loan is for the specific use of supporting Eth1.X research and development. The distribution will not be widely offered and the note will be collateralized by the network itself, provided in ETH and repaid in ETH. In coordinating the collection of these funds recognise I may be legally liable for some of this work and I will do all of the due dilegence I can, seek legal counsel, and accept any legal repercussions resulting from this work.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Non-fungible Data Token</title>
        <published>2019-04-18T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Johann Barbie</name><uri>https://github.com/johannbarbie</uri>
	</author>
	
	<author>
		<name>Ben Bollen</name><email>ben@ost.com</email>
	</author>
	
	<author>
		<name>pinkiebell</name><uri>https://github.com/pinkiebell</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1948/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-non-fungible-data-token/3139" />
        

        <id>https://wg-eips.ritovision.com/1948/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1948"
            label="ERC-1948" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1948/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Some NFT use-cases require to have dynamic data associated with a non-fungible token that can change during its lifetime. Examples for dynamic data:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;cryptokitties that can change color&lt;&#x2F;li&gt;
&lt;li&gt;intellectual property tokens that encode rights holders&lt;&#x2F;li&gt;
&lt;li&gt;tokens that store data to transport them across chains&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The existing metadata standard does not suffice as data can only be set at minting time and not modified later.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Non-fungible tokens (NFTs) are extended with the ability to store dynamic data. A 32 bytes data field is added and a read function allows to access it. The write function allows to update it, if the caller is the owner of the token. An event is emitted every time the data updates and the previous and new value is emitted in it.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The proposal is made to standardize on tokens with dynamic data. Interactions with bridges for side-chains like xDAI or Plasma chains will profit from the ability to use such tokens. Protocols that build on data tokens like &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethresear.ch&#x2F;t&#x2F;a-distributed-breeding-function&#x2F;5264&quot;&gt;distributed breeding&lt;&#x2F;a&gt; will be enabled.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;An extension of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; interface with the following functions and events is suggested:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.5.2&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Interface of the ERC1948 contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC1948&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emitted when `oldData` is replaced with `newData` in storage of `tokenId`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; that `oldData` or `newData` may be empty bytes.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DataUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; oldData&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Reads the data of a specified token. Returns the current data in&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * storage of `tokenId`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token to read the data off.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; A&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; bytes32 representing the current data stored in the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; readData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Updates the data of a specified token. Writes `newData` into storage&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * of `tokenId`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token to write data to.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; newData&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The data to be written to the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * Emits a `DataUpdated` event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; writeData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The suggested data field in the NFT is used either for storing data directly, like a counter or address. If more data is required the implementer should fall back to authenticated data structures, like merkle- or patricia-trees.&lt;&#x2F;p&gt;
&lt;p&gt;The proposal for this ERC stems from the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethresear.ch&#x2F;t&#x2F;a-distributed-breeding-function&#x2F;5264&quot;&gt;distributed breeding proposal&lt;&#x2F;a&gt; to allow better integration of NFTs across side-chains. &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ost.com&#x2F;&quot;&gt;ost.com&lt;&#x2F;a&gt;, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;skalelabs.com&#x2F;&quot;&gt;Skale&lt;&#x2F;a&gt;, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;poa.network&#x2F;&quot;&gt;POA&lt;&#x2F;a&gt;, and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;leapdao.org&#x2F;&quot;&gt;LeapDAO&lt;&#x2F;a&gt; have been part of the discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;🤷‍♂️ No related proposals are known to the author, hence no backwards compatibility to consider.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Simple happy test:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; ERC1948&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; artifacts&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;.&#x2F;ERC1948.sol&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ERC1948&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;accounts&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; firstTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 100&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; empty&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0101010101010101010101010101010101010101010101010101010101010101&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; dataToken&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  beforeEach&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt;async&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    dataToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; ERC1948&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;new&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; dataToken&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;accounts&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; firstTokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  it&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;should allow to write and read&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; async&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; rsp&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; dataToken&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;readData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;firstTokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;rsp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; empty&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; dataToken&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;writeData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;firstTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    rsp&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; dataToken&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;readData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;firstTokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;rsp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;An example implementation of the interface in solidity would look like this:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Implementation of ERC721 token and the `IERC1948` interface.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * ERC1948 is a non-fungible token (NFT) extended with the ability to store&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * dynamic data. The data is a bytes32 field for each tokenId. If 32 bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * do not suffice to store the data, an authenticated data structure (hash or&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * merkle tree) shall be used.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC1948&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC1948&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC721&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See `IERC1948.readData`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * - `tokenId` needs to exist.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; readData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_exists&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See `IERC1948.writeData`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * Requirements:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * - `msg.sender` needs to be owner of `tokenId`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; writeData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DataUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; newData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    data&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; newData&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Fee market change for ETH 1.0 chain</title>
        <published>2019-04-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	<author>
		<name>Eric Conner</name><uri>https://github.com/econoar</uri>
	</author>
	
	<author>
		<name>Rick Dudley</name><uri>https://github.com/AFDudley</uri>
	</author>
	
	<author>
		<name>Matthew Slipper</name><uri>https://github.com/mslipper</uri>
	</author>
	
	<author>
		<name>Ian Norden</name><uri>https://github.com/i-norden</uri>
	</author>
	
	<author>
		<name>Abdelhamid Bakhta</name><uri>https://github.com/abdelhamidbakhta</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1559/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-1559-fee-market-change-for-eth-1-0-chain/2783" />
        

        <id>https://wg-eips.ritovision.com/1559/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:1559"
            label="EIP-1559" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1559/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;A transaction pricing mechanism that includes fixed-per-block network fee that is burned and dynamically expands&#x2F;contracts block sizes to deal with transient congestion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;We introduce a new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; transaction type, with the format &lt;code&gt;0x02 || rlp([chain_id, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit, destination, amount, data, access_list, signature_y_parity, signature_r, signature_s])&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;There is a base fee per gas in protocol, which can move up or down each block according to a formula which is a function of gas used in parent block and gas target (block gas limit divided by elasticity multiplier) of parent block.
The algorithm results in the base fee per gas increasing when blocks are above the gas target, and decreasing when blocks are below the gas target.
The base fee per gas is burned.
Transactions specify the maximum fee per gas they are willing to give to miners to incentivize them to include their transaction (aka: priority fee).
Transactions also specify the maximum fee per gas they are willing to pay total (aka: max fee), which covers both the priority fee and the block&#x27;s network fee per gas (aka: base fee).
Senders will always pay the base fee per gas of the block their transaction was included in, and they will pay the priority fee per gas set in the transaction, as long as the combined amount of the two fees doesn&#x27;t exceed the transaction&#x27;s maximum fee per gas.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Ethereum historically priced transaction fees using a simple auction mechanism, where users send transactions with bids (&quot;gasprices&quot;) and miners choose transactions with the highest bids, and transactions that get included pay the bid that they specify. This leads to several large sources of inefficiency:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Mismatch between volatility of transaction fee levels and social cost of transactions&lt;&#x2F;strong&gt;: bids to include transactions on mature public blockchains, that have enough usage so that blocks are full, tend to be extremely volatile. It&#x27;s absurd to suggest that the cost incurred by the network from accepting one more transaction into a block actually is 10x more when the cost per gas is 10 nanoeth compared to when the cost per gas is 1 nanoeth; in both cases, it&#x27;s a difference between 8 million gas and 8.02 million gas.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Needless delays for users&lt;&#x2F;strong&gt;: because of the hard per-block gas limit coupled with natural volatility in transaction volume, transactions often wait for several blocks before getting included, but this is socially unproductive; no one significantly gains from the fact that there is no &quot;slack&quot; mechanism that allows one block to be bigger and the next block to be smaller to meet block-by-block differences in demand.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Inefficiencies of first price auctions&lt;&#x2F;strong&gt;: The current approach, where transaction senders publish a transaction with a bid a maximum fee, miners choose the highest-paying transactions, and everyone pays what they bid. This is well-known in mechanism design literature to be highly inefficient, and so complex fee estimation algorithms are required. But even these algorithms often end up not working very well, leading to frequent fee overpayment.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Instability of blockchains with no block reward&lt;&#x2F;strong&gt;: In the long run, blockchains where there is no issuance (including Bitcoin and Zcash) at present intend to switch to rewarding miners entirely through transaction fees. However, there are known issues with this that likely leads to a lot of instability, incentivizing mining &quot;sister blocks&quot; that steal transaction fees, opening up much stronger selfish mining attack vectors, and more. There is at present no good mitigation for this.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The proposal in this EIP is to start with a base fee amount which is adjusted up and down by the protocol based on how congested the network is. When the network exceeds the target per-block gas usage, the base fee increases slightly and when capacity is below the target, it decreases slightly. Because these base fee changes are constrained, the maximum difference in base fee from block to block is predictable. This then allows wallets to auto-set the gas fees for users in a highly reliable fashion. It is expected that most users will not have to manually adjust gas fees, even in periods of high network activity. For most users the base fee will be estimated by their wallet and a small priority fee, which compensates miners taking on orphan risk (e.g. 1 nanoeth), will be automatically set. Users can also manually set the transaction max fee to bound their total costs.&lt;&#x2F;p&gt;
&lt;p&gt;An important aspect of this fee system is that miners only get to keep the priority fee. The base fee is always burned (i.e. it is destroyed by the protocol). This ensures that only ETH can ever be used to pay for transactions on Ethereum, cementing the economic value of ETH within the Ethereum platform and reducing risks associated with miner extractable value (MEV). Additionally, this burn counterbalances Ethereum inflation while still giving the block reward and priority fee to miners. Finally, ensuring the miner of a block does not receive the base fee is important because it removes miner incentive to manipulate the fee in order to extract more fees from users.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Block validity is defined in the reference implementation below.
The &lt;code&gt;GASPRICE&lt;&#x2F;code&gt; (&lt;code&gt;0x3a&lt;&#x2F;code&gt;) opcode &lt;strong&gt;MUST&lt;&#x2F;strong&gt; return the &lt;code&gt;effective_gas_price&lt;&#x2F;code&gt; as defined in the reference implementation below.&lt;&#x2F;p&gt;
&lt;p&gt;As of &lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt;, a new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; transaction is introduced with &lt;code&gt;TransactionType&lt;&#x2F;code&gt; 2.&lt;&#x2F;p&gt;
&lt;p&gt;The intrinsic cost of the new transaction is inherited from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930&lt;&#x2F;a&gt;, specifically &lt;code&gt;21000 + 16 * non-zero calldata bytes + 4 * zero calldata bytes + 1900 * access list storage key count + 2400 * access list address count&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; &lt;code&gt;TransactionPayload&lt;&#x2F;code&gt; for this transaction is &lt;code&gt;rlp([chain_id, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit, destination, amount, data, access_list, signature_y_parity, signature_r, signature_s])&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;signature_y_parity, signature_r, signature_s&lt;&#x2F;code&gt; elements of this transaction represent a secp256k1 signature over &lt;code&gt;keccak256(0x02 || rlp([chain_id, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit, destination, amount, data, access_list]))&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; &lt;code&gt;ReceiptPayload&lt;&#x2F;code&gt; for this transaction is &lt;code&gt;rlp([status, cumulative_transaction_gas_used, logs_bloom, logs])&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Note: &lt;code&gt;&#x2F;&#x2F;&lt;&#x2F;code&gt; is integer division, round down.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt; typing&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; import&lt;&#x2F;span&gt;&lt;span&gt; Union&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Dict&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Sequence&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Tuple&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Literal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt; dataclasses&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; import&lt;&#x2F;span&gt;&lt;span&gt; dataclass&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; field&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt; abc&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; import&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ABC&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; abstractmethod&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;dataclass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransactionLegacy&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	signer_nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	gas_price&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	gas_limit&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	destination&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	amount&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	payload&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	v&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	r&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	s&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;dataclass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transaction2930Payload&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	chain_id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	signer_nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	gas_price&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	gas_limit&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	destination&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	amount&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	payload&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	access_list&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Tuple&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; field&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;default_factory&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;list&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	signature_y_parity&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	signature_r&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	signature_s&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;dataclass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transaction2930Envelope&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Literal&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	payload&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Transaction2930Payload&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Transaction2930Payload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;dataclass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transaction1559Payload&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	chain_id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	signer_nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	max_priority_fee_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	max_fee_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	gas_limit&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	destination&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	amount&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	payload&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	access_list&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Tuple&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; field&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;default_factory&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;list&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	signature_y_parity&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	signature_r&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	signature_s&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;dataclass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transaction1559Envelope&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Literal&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	payload&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Transaction1559Payload&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Transaction1559Payload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Transaction2718&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Union&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Transaction1559Envelope&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Transaction2930Envelope&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Transaction&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Union&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;TransactionLegacy&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Transaction2718&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;dataclass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NormalizedTransaction&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	signer_address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	signer_nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	max_priority_fee_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	max_fee_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	gas_limit&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	destination&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	amount&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	payload&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	access_list&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Tuple&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; field&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;default_factory&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;list&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;dataclass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Block&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	parent_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	uncle_hashes&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Sequence&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; field&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;default_factory&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;list&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	author&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	state_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	transaction_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	transaction_receipt_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	logs_bloom&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	difficulty&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	number&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	gas_limit&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; note the gas_limit is the gas_target * ELASTICITY_MULTIPLIER&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	gas_used&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	timestamp&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	extra_data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	proof_of_work&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	base_fee_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;dataclass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Account&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	balance&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	storage_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	code_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;INITIAL_BASE_FEE&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;INITIAL_FORK_BLOCK_NUMBER&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; TBD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;BASE_FEE_MAX_CHANGE_DENOMINATOR&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;ELASTICITY_MULTIPLIER&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; World&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;ABC&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validate_block&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		parent_gas_target&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ELASTICITY_MULTIPLIER&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		parent_gas_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;		#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; on the fork block, don&amp;#39;t account for the ELASTICITY_MULTIPLIER to avoid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;		#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; unduly halving the gas target.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		if&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; INITIAL_FORK_BLOCK_NUMBER&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			parent_gas_target&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			parent_gas_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ELASTICITY_MULTIPLIER&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		parent_base_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;base_fee_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		parent_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		transactions&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;transactions&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;		#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; check if the block used too much gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		assert&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;invalid block: too much gas used&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;		#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; check if the block changed the gas limit too much&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		assert&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; parent_gas_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; parent_gas_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1024&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;invalid block: gas limit increased too much&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		assert&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; parent_gas_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; parent_gas_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1024&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;invalid block: gas limit decreased too much&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;		#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; check if the gas limit is at least the minimum gas limit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		assert&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 5000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;		#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; check if the base fee is correct&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		if&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; INITIAL_FORK_BLOCK_NUMBER&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			expected_base_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; INITIAL_BASE_FEE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		elif&lt;&#x2F;span&gt;&lt;span&gt; parent_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; parent_gas_target&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			expected_base_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; parent_base_fee_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		elif&lt;&#x2F;span&gt;&lt;span&gt; parent_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; parent_gas_target&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			gas_used_delta&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; parent_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; parent_gas_target&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			base_fee_per_gas_delta&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;parent_base_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; gas_used_delta&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; parent_gas_target&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BASE_FEE_MAX_CHANGE_DENOMINATOR&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			expected_base_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; parent_base_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; base_fee_per_gas_delta&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			gas_used_delta&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; parent_gas_target&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; parent_gas_used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			base_fee_per_gas_delta&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; parent_base_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; gas_used_delta&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; parent_gas_target&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BASE_FEE_MAX_CHANGE_DENOMINATOR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			expected_base_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; parent_base_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; base_fee_per_gas_delta&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		assert&lt;&#x2F;span&gt;&lt;span&gt; expected_base_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;base_fee_per_gas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;invalid block: base fee not correct&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;		#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; execute transactions and do gas accounting&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		cumulative_transaction_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		for&lt;&#x2F;span&gt;&lt;span&gt; unnormalized_transaction&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; transactions&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;			#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Note: this validates transaction signature and chain ID which must happen before we normalize below since normalized transactions don&amp;#39;t include signature or chain ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			signer_address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validate_and_recover_signer_address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;unnormalized_transaction&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			transaction&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;normalize_transaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;unnormalized_transaction&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signer_address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			signer&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signer_address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			signer&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -=&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;			assert&lt;&#x2F;span&gt;&lt;span&gt; signer&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;invalid transaction: signer does not have enough ETH to cover attached value&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;			#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the signer must be able to afford the transaction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;			assert&lt;&#x2F;span&gt;&lt;span&gt; signer&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_fee_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;			#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ensure that the user was willing to at least pay the base fee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;			assert&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;base_fee_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;			#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Prevent impossibly large numbers&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;			assert&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;			#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Prevent impossibly large numbers&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;			assert&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_priority_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;			#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The total must be the larger of the two&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;			assert&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_priority_fee_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;			#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; priority fee is capped because the base fee is filled first&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			priority_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_priority_fee_per_gas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;base_fee_per_gas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;			#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; signer pays both the priority fee and the base fee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			effective_gas_price&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; priority_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;base_fee_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			signer&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -=&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; effective_gas_price&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;			assert&lt;&#x2F;span&gt;&lt;span&gt; signer&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;invalid transaction: signer does not have enough ETH to cover gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;execute_transaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;transaction&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; effective_gas_price&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			gas_refund&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; gas_used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			cumulative_transaction_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; gas_used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;			#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; signer gets refunded for unused gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			signer&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; gas_refund&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; effective_gas_price&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;			#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; miner only receives the priority fee; note that the base fee is not given to anyone (it is burned)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;			self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;author&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; priority_fee_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;		#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; check if the block spent too much gas transactions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		assert&lt;&#x2F;span&gt;&lt;span&gt; cumulative_transaction_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_used&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;invalid block: gas_used does not equal total gas used in all transactions&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;		#&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; TODO&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: verify account balances match block&amp;#39;s account balances (via state root comparison)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;		#&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; TODO&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: validate the rest of the block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; normalize_transaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Transaction&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; signer_address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; NormalizedTransaction&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;		#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; legacy transactions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; isinstance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;transaction&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; TransactionLegacy&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;			return&lt;&#x2F;span&gt;&lt;span&gt; NormalizedTransaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;				signer_address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; signer_address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;				signer_nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;signer_nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;				gas_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;				max_priority_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_price&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;				max_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_price&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;				destination&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;destination&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;				amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;				payload&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;				access_list&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;		#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 2930 transactions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		elif&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; isinstance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;transaction&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Transaction2930Envelope&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;			return&lt;&#x2F;span&gt;&lt;span&gt; NormalizedTransaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;				signer_address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; signer_address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;				signer_nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;signer_nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;				gas_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;				max_priority_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_price&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;				max_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_price&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;				destination&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;destination&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;				amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;				payload&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;				access_list&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;access_list&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;		#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 1559 transactions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		elif&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; isinstance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;transaction&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Transaction1559Envelope&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;			return&lt;&#x2F;span&gt;&lt;span&gt; NormalizedTransaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;				signer_address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; signer_address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;				signer_nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;signer_nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;				gas_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;				max_priority_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_priority_fee_per_gas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;				max_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_fee_per_gas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;				destination&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;destination&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;				amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;				payload&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;				access_list&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;access_list&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;			raise&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; Exception&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;invalid transaction: unexpected number of items&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;	@&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;abstractmethod&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Block&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; pass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;	@&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;abstractmethod&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; block_hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; pass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;	@&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;abstractmethod&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transactions&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Sequence&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Transaction&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; pass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; effective_gas_price is the value returned by the GASPRICE (0x3a) opcode&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;	@&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;abstractmethod&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; execute_transaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; NormalizedTransaction&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; effective_gas_price&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; pass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;	@&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;abstractmethod&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validate_and_recover_signer_address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Transaction&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; pass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;	@&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;abstractmethod&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Account&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; pass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Legacy Ethereum transactions will still work and be included in blocks, but they will not benefit directly from the new pricing system.  This is due to the fact that upgrading from legacy transactions to new transactions results in the legacy transaction&#x27;s &lt;code&gt;gas_price &lt;&#x2F;code&gt; entirely being consumed either by the &lt;code&gt;base_fee_per_gas&lt;&#x2F;code&gt; and the &lt;code&gt;priority_fee_per_gas&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;block-hash-changing&quot;&gt;Block Hash Changing&lt;&#x2F;h3&gt;
&lt;p&gt;The datastructure that is passed into keccak256 to calculate the block hash is changing, and all applications that are validating blocks are valid or using the block hash to verify block contents will need to be adapted to support the new datastructure (one additional item).  If you only take the block header bytes and hash them you should still correctly get a hash, but if you construct a block header from its constituent elements you will need to add in the new one at the end.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gasprice&quot;&gt;GASPRICE&lt;&#x2F;h3&gt;
&lt;p&gt;Previous to this change, &lt;code&gt;GASPRICE&lt;&#x2F;code&gt; represented both the ETH paid by the signer per gas for a transaction as well as the ETH received by the miner per gas.  As of this change, &lt;code&gt;GASPRICE&lt;&#x2F;code&gt; now only represents the amount of ETH paid by the signer per gas, and the amount a miner was paid for the transaction is no longer accessible directly in the EVM.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;increased-max-block-size-complexity&quot;&gt;Increased Max Block Size&#x2F;Complexity&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP will increase the maximum block size, which could cause problems if miners are unable to process a block fast enough as it will force them to mine an empty block.  Over time, the average block size should remain about the same as without this EIP, so this is only an issue for short term size bursts.  It is possible that one or more clients may handle short term size bursts poorly and error (such as out of memory or similar) and client implementations should make sure their clients can appropriately handle individual blocks up to max size.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;transaction-ordering&quot;&gt;Transaction Ordering&lt;&#x2F;h3&gt;
&lt;p&gt;With most people not competing on priority fees and instead using a baseline fee to get included, transaction ordering now depends on individual client internal implementation details such as how they store the transactions in memory.  It is recommended that transactions with the same priority fee be sorted by time the transaction was received to protect the network from spamming attacks where the attacker throws a bunch of transactions into the pending pool in order to ensure that at least one lands in a favorable position.  Miners should still prefer higher gas premium transactions over those with a lower gas premium, purely from a selfish mining perspective.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;miners-mining-empty-blocks&quot;&gt;Miners Mining Empty Blocks&lt;&#x2F;h3&gt;
&lt;p&gt;It is possible that miners will mine empty blocks until such time as the base fee is very low and then proceed to mine half full blocks and revert to sorting transactions by the priority fee.  While this attack is possible, it is not a particularly stable equilibrium as long as mining is decentralized.  Any defector from this strategy will be more profitable than a miner participating in the attack for as long as the attack continues (even after the base fee reached 0).  Since any miner can anonymously defect from a cartel, and there is no way to prove that a particular miner defected, the only feasible way to execute this attack would be to control 50% or more of hashing power.  If an attacker had exactly 50% of hashing power, they would make no Ether from priority fee while defectors would make double the Ether from priority fees.  For an attacker to turn a profit, they need to have some amount over 50% hashing power, which means they can instead execute double spend attacks or simply ignore any other miners which is a far more profitable strategy.&lt;&#x2F;p&gt;
&lt;p&gt;Should a miner attempt to execute this attack, we can simply increase the elasticity multiplier (currently 2x) which requires they have even more hashing power available before the attack can even be theoretically profitable against defectors.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;eth-burn-precludes-fixed-supply&quot;&gt;ETH Burn Precludes Fixed Supply&lt;&#x2F;h3&gt;
&lt;p&gt;By burning the base fee, we can no longer guarantee a fixed Ether supply.  This could result in economic instability as the long term supply of ETH will no longer be constant over time.  While a valid concern, it is difficult to quantify how much of an impact this will have.  If more is burned on base fee than is generated in mining rewards then ETH will be deflationary and if more is generated in mining rewards than is burned then ETH will be inflationary.  Since we cannot control user demand for block space, we cannot assert at the moment whether ETH will end up inflationary or deflationary, so this change causes the core developers to lose some control over Ether&#x27;s long term quantity.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>CALLs with strict gas semantic. Revert if not enough gas available.</title>
        <published>2019-04-10T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Ronan Sandford</name><uri>https://github.com/wighawag</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1930/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/1930" />
        

        <id>https://wg-eips.ritovision.com/1930/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1930"
            label="EIP-1930" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1930/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Add the ability for smart contract to execute calls with a specific amount of gas. If this is not possible the execution should revert.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The current CALL, DELEGATE_CALL, STATIC_CALL opcode do not enforce the gas being sent, they simply consider the gas value as a maximum. This pose serious problem for applications that require the call to be executed with a precise amount of gas.&lt;&#x2F;p&gt;
&lt;p&gt;This is for example the case for meta-transaction where the contract needs to ensure the call is executed exactly as the signing user intended.&lt;&#x2F;p&gt;
&lt;p&gt;But this is also the case for common use cases, like checking &quot;on-chain&quot; if a smart contract support a specific interface (via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;EIP-165&lt;&#x2F;a&gt; for example).&lt;&#x2F;p&gt;
&lt;p&gt;The solution presented here is to add new call semantic that enforce the amount of gas specified : the call either proceed with the exact amount of gas or do not get executed and the current call revert.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h3&gt;
&lt;p&gt;There are 2 possibilities&lt;&#x2F;p&gt;
&lt;p&gt;a) one is to add opcode variant that have a stricter gas semantic&lt;&#x2F;p&gt;
&lt;p&gt;b) The other is to consider a specific gas value range (one that have never been used before) to have strict gas semantic, while leaving other values as before&lt;&#x2F;p&gt;
&lt;p&gt;Here are the details description&lt;&#x2F;p&gt;
&lt;h4 id=&quot;option-a&quot;&gt;option a)&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;add a new variant of the CALL opcode where the gas specified is enforced so that if the gas left at the point of call is not enough to give the specified gas to the destination, the current call revert&lt;&#x2F;li&gt;
&lt;li&gt;add a new variant of the DELEGATE_CALL opcode where the gas specified is enforced so that if the gas left at the point of call is not enough to give the specified gas to the destination, the current call revert&lt;&#x2F;li&gt;
&lt;li&gt;add a new variant of the STATIC_CALL opcode where the gas specified is enforced so that if the gas left at the point of call is not enough to give the specified gas to the destination, the current call revert&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;rational-for-a&quot;&gt;Rational for a)&lt;&#x2F;h5&gt;
&lt;p&gt;This solution has the merit to avoid any possibility of old contract be affected by the change. On the other hand it introduce 3 new opcodes. With EIP-1702, we could render the old opcode obsolete though.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;option-b&quot;&gt;option b)&lt;&#x2F;h4&gt;
&lt;p&gt;For all opcode that allow to pass gas to another contract, do the following:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If the most significant bit is one, consider the 31 less significant bit as the amount of gas to be given to the receiving contract in the strict sense. SO like a) if the gas left at the point of call is not enough to give the specified gas to the destination, the current call revert.&lt;&#x2F;li&gt;
&lt;li&gt;If the 2nd most significant bit is zero, consider the whole value to behave like before, that is, it act as a maximum value, and even if not enough gas is present, the gas that can be given is given to the receiving contract&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;rational-for-b&quot;&gt;Rational for b)&lt;&#x2F;h5&gt;
&lt;p&gt;This solution relies on the fact that no contract would have given any value bigger or equal to 0x8000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;p&gt;
&lt;p&gt;Note that solidity for example do not use value like 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF as it is more expensive than passing the gasLeft.&lt;&#x2F;p&gt;
&lt;p&gt;Its main benefit though is that it does not require extra opcodes.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;strict-gas-semantic&quot;&gt;strict gas semantic&lt;&#x2F;h4&gt;
&lt;p&gt;To be precise, regarding the strict gas semantic, based on &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;150&#x2F;&quot;&gt;EIP-150&lt;&#x2F;a&gt;, the current call must revert unless G &amp;gt;= I x 64&#x2F;63 where G is gas left at the point of call (after deducing the cost of the call itself) and I is the gas specified.&lt;&#x2F;p&gt;
&lt;p&gt;So instead of&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;availableGas = availableGas - base&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gas := availableGas - availableGas&#x2F;64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;if !callCost.IsUint64() || gas &amp;lt; callCost.Uint64() {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return gas, nil&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;see https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;go-ethereum&#x2F;blob&#x2F;7504dbd6eb3f62371f86b06b03ffd665690951f2&#x2F;core&#x2F;vm&#x2F;gas.go#L41-L48&lt;&#x2F;p&gt;
&lt;p&gt;we would have&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;availableGas = availableGas - base&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gas := availableGas - availableGas&#x2F;64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;if !callCost.IsUint64() || gas &amp;lt; callCost.Uint64() {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return 0, errNotEnoughGas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h3&gt;
&lt;p&gt;Currently the gas specified as part of these opcodes is simply a maximum value. And due to the behavior of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;150&#x2F;&quot;&gt;EIP-150&lt;&#x2F;a&gt; it is possible for an external call to be given less gas than intended (less than the gas specified as part of the CALL) while the rest of the current call is given enough to continue and succeed. Indeed since with EIP-150, the external call is given at max  &lt;code&gt;G - Math.floor(G&#x2F;64)&lt;&#x2F;code&gt; where G is the gasleft() at the point of the CALL, the rest of the current call is given &lt;code&gt;Math.floor(G&#x2F;64)&lt;&#x2F;code&gt; which can be plenty enough for the transaction to succeed. For example, when G = 6,400,000 the rest of the transaction will be given 100,000 gas plenty enough in many case to succeed.&lt;&#x2F;p&gt;
&lt;p&gt;This is an issue for contracts that require external call to only fails if they would fails with enough gas. This requirement is present in smart contract wallet and meta transaction in general, where the one executing the transaction is not the signer of the execution data. Because in such case, the contract needs to ensure the call is executed exactly as the signing user intended.&lt;&#x2F;p&gt;
&lt;p&gt;But this is also true for simple use case, like checking if a contract implement an interface via EIP-165. Indeed as specified by such EIP, the &lt;code&gt;supporstInterface&lt;&#x2F;code&gt; method is bounded to use 30,000 gas so that it is theoretically possible to ensure that the throw is not a result of a lack of gas. Unfortunately due to how the different CALL opcodes behave contracts can&#x27;t simply rely on the gas value specified. They have to ensure by other means that there is enough gas for the call.&lt;&#x2F;p&gt;
&lt;p&gt;Indeed, if the caller do not ensure that 30,000 gas or more is provided to the callee, the callee might throw because of a lack of gas (and not because it does not support the interface), and the parent call will be given up to 476 gas to continue. This would result in the caller interpreting wrongly that the callee is not implementing the interface in question.&lt;&#x2F;p&gt;
&lt;p&gt;While such requirement can be enforced by checking the gas left according to EIP-150 and the precise gas required before the call (see solution presented in that &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;web.solidified.io&#x2F;contract&#x2F;5b4769b1e6c0d80014f3ea4e&#x2F;bug&#x2F;5c83d86ac2dd6600116381f9&quot;&gt;bug report&lt;&#x2F;a&gt; or after the call (see the native meta transaction implementation &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;pixowl&#x2F;thesandbox-contracts&#x2F;blob&#x2F;623f4d4ca10644dcee145bcbd9296579a1543d3d&#x2F;src&#x2F;Sand&#x2F;erc20&#x2F;ERC20MetaTxExtension.sol#L176&quot;&gt;here&lt;&#x2F;a&gt;, it would be much better if the EVM allowed us to strictly specify how much gas is to be given to the CALL so contract implementations do not need to follow &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;150&#x2F;&quot;&gt;EIP-150&lt;&#x2F;a&gt; behavior and the current gas pricing so closely.&lt;&#x2F;p&gt;
&lt;p&gt;This would also allow the behaviour of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;150&#x2F;&quot;&gt;EIP-150&lt;&#x2F;a&gt; to be changed without having to affect contract that require this strict gas behaviour.&lt;&#x2F;p&gt;
&lt;p&gt;As mentioned, such strict gas behaviour is important for smart contract wallet and meta transaction in general.
The issue is actually already a problem in the wild as can be seen in the case of Gnosis safe which did not consider the behavior of EIP-150 and thus fails to check the gas properly, requiring the safe owners to add otherwise unnecessary extra gas to their signed message to avoid the possibility of losing funds. See https:&#x2F;&#x2F;github.com&#x2F;gnosis&#x2F;safe-contracts&#x2F;issues&#x2F;100&lt;&#x2F;p&gt;
&lt;p&gt;As for EIP-165, the issue already exists in the example implementation presented in the EIP. Please see the details of the issue &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;pull&#x2F;881#issuecomment-491677748&quot;&gt;here&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The same issue exists also on OpenZeppelin implementation, a library used by many. It does not for perform any check on gas before calling &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; with 30,000 gas (see &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;OpenZeppelin&#x2F;openzeppelin-solidity&#x2F;blob&#x2F;fa004a7f5de572b3dbcde1a8a81f9a87e353e799&#x2F;contracts&#x2F;introspection&#x2F;ERC165Checker.sol#L37&quot;&gt;here&lt;&#x2F;a&gt; and is thus vulnerable to the issue mentioned.&lt;&#x2F;p&gt;
&lt;p&gt;While such issue can be prevented today by checking the gas with EIP-150 in mind, a solution at the opcode level is more elegant.&lt;&#x2F;p&gt;
&lt;p&gt;Indeed, the two possible ways to currently enforce that the correct amount of gas is sent are as follow :&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;check done before the call&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;uint256 gasAvailable = gasleft() - E;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;require(gasAvailable - gasAvailable &#x2F; 64  &amp;gt;= `txGas`, &amp;quot;not enough gas provided&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;to.call.gas(txGas)(data); &#x2F;&#x2F; CALL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where E is the gas required for the operation between the call to &lt;code&gt;gasleft()&lt;&#x2F;code&gt; and the actual call PLUS the gas cost of the call itself.
While it is possible to simply over estimate &lt;code&gt;E&lt;&#x2F;code&gt; to prevent call to be executed if not enough gas is provided to the current call it would be better to have the EVM do the precise work itself. As gas pricing continue to evolve, this is important to have a mechanism to ensure a specific amount of gas is passed to the call so such mechanism can be used without having to relies on a specific gas pricing.&lt;&#x2F;p&gt;
&lt;ol start=&quot;2&quot;&gt;
&lt;li&gt;check done after the call:&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;to.call.gas(txGas)(data); &#x2F;&#x2F; CALL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;require(gasleft() &amp;gt; txGas &#x2F; 63, &amp;quot;not enough gas left&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This solution does not require to compute a &lt;code&gt;E&lt;&#x2F;code&gt; value and thus do not relies on a specific gas pricing (except for the behaviour of EIP-150) since if the call is given not enough gas and fails for that reason, the condition above will always fail, ensuring the current call will revert.
But this check still pass if the gas given was less AND the external call reverted or succeeded EARLY (so that the gas left after the call &amp;gt; txGas &#x2F; 63).
This can be an issue if the code executed as part of the CALL is reverting as a result of a check against the gas provided. Like a meta transaction in a meta transaction.&lt;&#x2F;p&gt;
&lt;p&gt;Similarly to the previous solution, an EVM mechanism would be much better.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;for specification a) : Backwards compatible as it introduce new opcodes.&lt;&#x2F;p&gt;
&lt;p&gt;for specification b) : Backwards compatible as it use value range outside of what is used by existing contract (to be verified)&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;None fully implemented yet. But see Specifications for an example in geth.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;EIP-150, .&#x2F;00150.md&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Holdable Token</title>
        <published>2019-04-10T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Julio Faura</name><email>julio@adhara.io</email>
	</author>
	
	<author>
		<name>Fernando Paris</name><email>fer@io.builders</email>
	</author>
	
	<author>
		<name>Daniel Lehrner</name><email>daniel@io.builders</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1996/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/2103" />
        

        <id>https://wg-eips.ritovision.com/1996/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1996"
            label="ERC-1996" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1996/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;An extension to the ERC-20 standard token that allows tokens to be put on hold. This guarantees a future transfer and makes the held tokens unavailable for transfer in the mean time. Holds are similar to escrows in that are firm and lead to final settlement.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;actors&quot;&gt;Actors&lt;&#x2F;h2&gt;
&lt;h4 id=&quot;operator&quot;&gt;Operator&lt;&#x2F;h4&gt;
&lt;p&gt;An account which has been approved by an account to create holds on its behalf.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;hold-issuer&quot;&gt;Hold issuer&lt;&#x2F;h4&gt;
&lt;p&gt;The account, which creates a hold. This can be the account owner itself, or any account, which has been approved as an operator for the account.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;notary&quot;&gt;Notary&lt;&#x2F;h4&gt;
&lt;p&gt;The account which decides if a hold should be executed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;A hold specifies a payer, a payee, a maximum amount, a notary and an expiration time. When the hold is created, the specified token balance from the payer is put on hold. A held balance cannot be transferred until the hold is either executed or released. The hold can only be executed by the notary, which triggers the transfer of the tokens from the payer to the payee. If a hold is released, either by the notary at any time, or by anyone after the expiration, no transfer is carried out and the amount is available again for the payer.&lt;&#x2F;p&gt;
&lt;p&gt;A hold can be partially executed, if the execution specifies an amount less than the maximum amount. In this case the specified amount is transferred to the payee and the remaining amount is available again to the payer.&lt;&#x2F;p&gt;
&lt;p&gt;Holds can be specified to be perpetual. In this case, the hold cannot be released upon expiration, and thus can only be executed by the notary or released by the notary or payee.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;A hold has to be used in different scenarios where a immediate transfer between accounts is not possible or has to be guaranteed beforehand:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;A regulated token may not allow to do a token transfer between accounts without verifying first, that it follows all the regulations. In this case a clearable transfer has to be used. During the clearing process a hold is created to ensure, that the transfer is successful after all checks have passed. If the transfer violates any of the regulations, it is cleared and not further processed.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;In certain business situations a payment has to be guaranteed before its services can be used. For example: When checking in a hotel, the hotel will put a hold on the guest&#x27;s account to ensure that enough balance is available to pay for the room before handing over the keys.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;In other occasions a payment has to be guaranteed without knowing the exact amount beforehand. To stay with the hotel example: The hotel can put a hold on the guest&#x27;s account as a guarantee for any possible extras, like room service. When the guest checks out the hold is partially executed and the remaining amount is available again on the guest&#x27;s account.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The ERC-20 &lt;code&gt;approve&lt;&#x2F;code&gt; function provides some of the necessary functionality for the use cases above. The main difference to holds, is that &lt;code&gt;approve&lt;&#x2F;code&gt; does not ensure a payment, as the approved money is not blocked and can be transferred at any moment.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IHoldable&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is ERC-20 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; HoldStatusCode&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        Nonexistent&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        Ordered&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        Executed&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        ReleasedByNotary&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        ReleasedByPayee&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        ReleasedOnExpiration&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; hold&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operationId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; notary&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; timeToExpiration&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; holdFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operationId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; notary&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; timeToExpiration&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; releaseHold&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operationId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; executeHold&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operationId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; renewHold&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operationId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; timeToExpiration&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; retrieveHoldData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operationId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; notary&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expiration&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; HoldStatusCode&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; status&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOnHold&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; netBalanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalSupplyOnHold&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; authorizeHoldOperator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revokeHoldOperator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isHoldOperatorFor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; HoldCreated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; holdIssuer&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;  operationId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; notary&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expiration&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; HoldExecuted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; holdIssuer&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operationId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; notary&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; heldValue&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; transferredValue&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; HoldReleased&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; holdIssuer&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operationId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;HoldStatusCode&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; status&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; HoldRenewed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; holdIssuer&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operationId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; oldExpiration&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newExpiration&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AuthorizedHoldOperator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RevokedHoldOperator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;functions&quot;&gt;Functions&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;hold&quot;&gt;hold&lt;&#x2F;h4&gt;
&lt;p&gt;Creates a hold on behalf of the msg.sender in favor of the payee. It specifies a notary who is responsible to either execute or release the hold. The function must revert if the operation ID has been used before.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;operationId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID to identify the hold&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;to&lt;&#x2F;td&gt;&lt;td&gt;The address of the payee, to whom the tokens are to be transferred if executed&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;notary&lt;&#x2F;td&gt;&lt;td&gt;The address of the notary who is going to determine whether the hold is to be executed or released&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;value&lt;&#x2F;td&gt;&lt;td&gt;The amount to be transferred. Must be less or equal than the balance of the payer.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;timeToExpiration&lt;&#x2F;td&gt;&lt;td&gt;The duration until the hold is expired. If it is &#x27;0&#x27; the hold must be perpetual.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;holdfrom&quot;&gt;holdFrom&lt;&#x2F;h4&gt;
&lt;p&gt;Creates a hold on behalf of the payer in favor of the payee. The &lt;code&gt;from&lt;&#x2F;code&gt; account has to approve beforehand, that another account can issue holds on its behalf by calling &lt;code&gt;approveToHold&lt;&#x2F;code&gt;. The function must revert if the operation ID has been used before.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;operationId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID to identify the hold&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;from&lt;&#x2F;td&gt;&lt;td&gt;The address of the payer, from whom the tokens are to be taken if executed&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;to&lt;&#x2F;td&gt;&lt;td&gt;The address of the payee, to whom the tokens are to be transferred if executed&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;notary&lt;&#x2F;td&gt;&lt;td&gt;The address of the notary who is going to determine whether the hold is to be executed or released&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;value&lt;&#x2F;td&gt;&lt;td&gt;The amount to be transferred. Must be less or equal than the balance of the payer.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;timeToExpiration&lt;&#x2F;td&gt;&lt;td&gt;The duration until the hold is expired. If it is &#x27;0&#x27; the hold must be perpetual.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;releasehold&quot;&gt;releaseHold&lt;&#x2F;h4&gt;
&lt;p&gt;Releases a hold. Release means that the transfer is not executed and the held amount is available again for the payer. Until a hold has expired it can only be released by the notary or the payee. After it has expired it can be released by anyone.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;operationId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID to identify the hold&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;executehold&quot;&gt;executeHold&lt;&#x2F;h4&gt;
&lt;p&gt;Executes a hold. Execute means that the specified value is transferred from the payer to the payee. If the specified value is less than the hold value the remaining amount is available again to the payer. The implementation must verify that only the notary is able to successfully call the function.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;operationId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID to identify the hold&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;value&lt;&#x2F;td&gt;&lt;td&gt;The amount to be transferred. This amount has to be less or equal than the hold value&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;renewhold&quot;&gt;renewHold&lt;&#x2F;h4&gt;
&lt;p&gt;Renews a hold. The new expiration time must be the block timestamp plus the given &lt;code&gt;timeToExpiration&lt;&#x2F;code&gt;, independently if the hold was perpetual or not before that. Furthermore a hold must be made perpetual if &lt;code&gt;timeToExpiration&lt;&#x2F;code&gt; is &#x27;0&#x27;. The implementation must verify that only the payer or operator are able to successfully call the function. Furthermore the only a hold, which has not yet expired can be successfully renewed.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;operationId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID to identify the hold&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;timeToExpiration&lt;&#x2F;td&gt;&lt;td&gt;The new duration until the hold is expired.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;retrieveholddata&quot;&gt;retrieveHoldData&lt;&#x2F;h4&gt;
&lt;p&gt;Retrieves all the information available for a particular hold.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;operationId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID to identify the hold&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;balanceonhold&quot;&gt;balanceOnHold&lt;&#x2F;h4&gt;
&lt;p&gt;Retrieves how much of the balance is currently held and therefore not available for transfer.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;account&lt;&#x2F;td&gt;&lt;td&gt;The address which held balance should be returned&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;netbalanceof&quot;&gt;netBalanceOf&lt;&#x2F;h4&gt;
&lt;p&gt;Retrieves the net balance, which is the sum of &lt;code&gt;balanceOf&lt;&#x2F;code&gt; and &lt;code&gt;balanceOnHold&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;account&lt;&#x2F;td&gt;&lt;td&gt;The address which net balance should be returned&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;totalsupplyonhold&quot;&gt;totalSupplyOnHold&lt;&#x2F;h4&gt;
&lt;p&gt;Retrieves the total sum of how many tokens are on hold.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;-&lt;&#x2F;td&gt;&lt;td&gt;-&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;authorizeholdoperator&quot;&gt;authorizeHoldOperator&lt;&#x2F;h4&gt;
&lt;p&gt;Approves an operator to issue holds on behalf of msg.sender.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;operator&lt;&#x2F;td&gt;&lt;td&gt;The address to be approved as operator of holds&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;revokeholdoperator&quot;&gt;revokeHoldOperator&lt;&#x2F;h4&gt;
&lt;p&gt;Revokes the approval to issue holds on behalf of msg.sender.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;operator&lt;&#x2F;td&gt;&lt;td&gt;The address to be revoked as operator of holds&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;isholdoperatorfor&quot;&gt;isHoldOperatorFor&lt;&#x2F;h4&gt;
&lt;p&gt;Retrieves if an operator is approved to create holds on behalf of &lt;code&gt;from&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;operator&lt;&#x2F;td&gt;&lt;td&gt;The address to be a operator of holds&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;from&lt;&#x2F;td&gt;&lt;td&gt;The address on which the holds would be created&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;balanceof&quot;&gt;balanceOf&lt;&#x2F;h4&gt;
&lt;p&gt;The standard implementation of ERC-20 has to be changed in order to deduct the held balance from the ERC-20 balance.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;transfer&quot;&gt;transfer&lt;&#x2F;h4&gt;
&lt;p&gt;The standard implementation of ERC-20 has to be changed in order to deduct the held balance from the ERC-20 balance. Any amount that is held must not be transferred.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;transferfrom&quot;&gt;transferFrom&lt;&#x2F;h4&gt;
&lt;p&gt;The standard implementation of ERC-20 has to be changed in order to deduct the held balance from the ERC-20 balance. Any amount that is held must not be transferred.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;events&quot;&gt;Events&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;holdcreated&quot;&gt;HoldCreated&lt;&#x2F;h4&gt;
&lt;p&gt;Emitted when a hold has been created.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;holdIssuer&lt;&#x2F;td&gt;&lt;td&gt;The address of the hold issuer of the hold&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;operationId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID to identify the hold&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;from&lt;&#x2F;td&gt;&lt;td&gt;The address of the payer, from whom the tokens are to be taken if executed&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;to&lt;&#x2F;td&gt;&lt;td&gt;The address of the payee, to whom the tokens are to be paid if executed&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;notary&lt;&#x2F;td&gt;&lt;td&gt;The address of the notary who is going to determine whether the hold is to be executed or released&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;value&lt;&#x2F;td&gt;&lt;td&gt;The amount to be transferred. Must be less or equal than the balance of the payer.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;expiration&lt;&#x2F;td&gt;&lt;td&gt;The unix timestamp when the hold is expired&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;holdexecuted&quot;&gt;HoldExecuted&lt;&#x2F;h4&gt;
&lt;p&gt;Emitted when a hold has been executed.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;holdIssuer&lt;&#x2F;td&gt;&lt;td&gt;The address of the hold issuer of the hold&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;operationId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID to identify the hold&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;notary&lt;&#x2F;td&gt;&lt;td&gt;The address of the notary who executed the hold&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;heldValue&lt;&#x2F;td&gt;&lt;td&gt;The amount which was put on hold during creation&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;transferredValue&lt;&#x2F;td&gt;&lt;td&gt;The amount which was used for the transfer&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;holdreleased&quot;&gt;HoldReleased&lt;&#x2F;h4&gt;
&lt;p&gt;Emitted when a hold has been released.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;holdIssuer&lt;&#x2F;td&gt;&lt;td&gt;The address of the hold issuer of the hold&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;operationId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID to identify the hold&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;status&lt;&#x2F;td&gt;&lt;td&gt;Can be one of the following values: &lt;code&gt;ReleasedByNotary&lt;&#x2F;code&gt;, &lt;code&gt;ReleasedByPayee&lt;&#x2F;code&gt;, &lt;code&gt;ReleasedOnExpiration&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;holdrenewed&quot;&gt;HoldRenewed&lt;&#x2F;h4&gt;
&lt;p&gt;Emitted when a hold has been renewed.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;holdIssuer&lt;&#x2F;td&gt;&lt;td&gt;The address of the hold issuer of the hold&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;operationId&lt;&#x2F;td&gt;&lt;td&gt;The unique ID to identify the hold&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;oldExpiration&lt;&#x2F;td&gt;&lt;td&gt;The expiration time before the renewal&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;newExpiration&lt;&#x2F;td&gt;&lt;td&gt;The expiration time after the renewal&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;authorizedholdoperator&quot;&gt;AuthorizedHoldOperator&lt;&#x2F;h4&gt;
&lt;p&gt;Emitted when an operator has been approved to create holds on behalf of another account.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;operator&lt;&#x2F;td&gt;&lt;td&gt;The address to be a operator of holds&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;account&lt;&#x2F;td&gt;&lt;td&gt;Address on which behalf holds will potentially be created&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;revokedholdoperator&quot;&gt;RevokedHoldOperator&lt;&#x2F;h4&gt;
&lt;p&gt;Emitted when an operator has been revoked from creating holds on behalf of another account.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;operator&lt;&#x2F;td&gt;&lt;td&gt;The address to be a operator of holds&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;account&lt;&#x2F;td&gt;&lt;td&gt;Address on which behalf holds could potentially be created&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This standards provides a functionality, to guarantee future payments, which is needed for many business cases where transfers have to be guaranteed.&lt;&#x2F;p&gt;
&lt;p&gt;It goes a step further than the ERC-20 &lt;code&gt;approve&lt;&#x2F;code&gt; function by ensuring that the held balance will be available when the transfer is done. Something that can not be done with &lt;code&gt;approve&lt;&#x2F;code&gt;, as the approved amount is only a maximum spending amount, but never guaranteed to be available.&lt;&#x2F;p&gt;
&lt;p&gt;While not requiring it, the naming of the functions &lt;code&gt;authorizeHoldOperator&lt;&#x2F;code&gt;, &lt;code&gt;revokeHoldOperator&lt;&#x2F;code&gt; and &lt;code&gt;isHoldOperatorFor&lt;&#x2F;code&gt; follows the naming convention of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;777&#x2F;&quot;&gt;ERC-777&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;operationId&lt;&#x2F;code&gt; is a string and not something more gas efficient to allow easy traceability of the hold and allow human readable ids. It is up to the implementer if the string should be stored on-chain or only its hash, as it is enough to identify a hold.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;operationId&lt;&#x2F;code&gt; is a competitive resource. It is recommended, but nor required, that the hold issuers used a unique prefix to avoid collisions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is fully backwards compatible as its implementation extends the functionality of ERC-20.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The GitHub repository &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;IoBuilders&#x2F;holdable-token&quot;&gt;IoBuilders&#x2F;holdable-token&lt;&#x2F;a&gt; contains the reference implementation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;contributors&quot;&gt;Contributors&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal has been collaboratively implemented by &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;adhara.io&#x2F;&quot;&gt;adhara.io&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;io.builders&#x2F;&quot;&gt;io.builders&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>dType Functions Extension</title>
        <published>2019-04-06T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Loredana Cirstea</name><uri>https://github.com/loredanacirstea</uri>
	</author>
	
	<author>
		<name>Christian Tzurcanu</name><uri>https://github.com/ctzurcanu</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1921/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/1921" />
        

        <id>https://wg-eips.ritovision.com/1921/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:1921"
            label="ERC-1921" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1921/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;In the context of dType, the Decentralized Type System described in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1900&#x2F;&quot;&gt;EIP-1900&lt;&#x2F;a&gt;, we are proposing to add support for registering functions (with a preference for &lt;code&gt;pure&lt;&#x2F;code&gt; and &lt;code&gt;view&lt;&#x2F;code&gt;) in the dType Registry.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal is part of a series of EIPs focused on expanding the concept of a Decentralized Type System, as explained in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1900&#x2F;&quot;&gt;EIP-1900&lt;&#x2F;a&gt;.
The current EIP specifies the data definitions and interfaces needed to support registering individual smart contract functions, as entries in the dType Registry.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;In order to evolve the EVM into a Singleton Operating System, we need a way to register, find and address contract functions that we want to run in an automated way.
This implies having access to all the data needed to run the function inside the EVM.&lt;&#x2F;p&gt;
&lt;p&gt;Aside from the above motivation, there are also near future benefits for this proposal. Having a globally available, non-custodial functions registry, will democratize the development of tools, such as those targeting: blockchain data analysis (e.g. block explorers), smart contract IDEs, security analysis of smart contracts.&lt;&#x2F;p&gt;
&lt;p&gt;Registering new smart contract functions can be done through the same consensus mechanism as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1900&#x2F;&quot;&gt;EIP-1900&lt;&#x2F;a&gt; mentions, in order to avoid burdening the chain state with redundant or improper records.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;This specification targets &lt;code&gt;pure&lt;&#x2F;code&gt; and &lt;code&gt;view&lt;&#x2F;code&gt; functions.&lt;&#x2F;p&gt;
&lt;p&gt;For each function, we can store:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;name&lt;&#x2F;code&gt; - type &lt;code&gt;string&lt;&#x2F;code&gt; unique function name, as defined in EIP-1900; required&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;types&lt;&#x2F;code&gt; - the type data and label of each input, as defined in EIP-1900; required&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;outputs&lt;&#x2F;code&gt; - the type data and label of each output; required&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;contractAddress&lt;&#x2F;code&gt; - type &lt;code&gt;address&lt;&#x2F;code&gt; - smart contract where the function resides, as defined in EIP-1900; optional for interfaces&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;source&lt;&#x2F;code&gt; - type &lt;code&gt;bytes32&lt;&#x2F;code&gt; - reference to an external file containing the function source code, as defined in EIP-1900; optional&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Therefore, this proposal adds &lt;code&gt;outputs&lt;&#x2F;code&gt; to the EIP-1900 type registration definition.&lt;&#x2F;p&gt;
&lt;p&gt;An example of a function registration object for the dType registry is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;name&amp;quot;: &amp;quot;setStaked&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;types&amp;quot;: [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&amp;quot;name&amp;quot;: &amp;quot;TypeA&amp;quot;, &amp;quot;label&amp;quot;: &amp;quot;typeA&amp;quot;, &amp;quot;relation&amp;quot;:0, &amp;quot;dimensions&amp;quot;:[]}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ],&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;typeChoice&amp;quot;: 4,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;contractAddress&amp;quot;: &amp;lt;address of the deployed smart contract where the function is defined&amp;gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;source&amp;quot;: &amp;lt;bytes32 hash for referencing source files&amp;gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;outputs&amp;quot;: [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&amp;quot;name&amp;quot;: &amp;quot;TypeB&amp;quot;, &amp;quot;label&amp;quot;: &amp;quot;typeB&amp;quot;, &amp;quot;relation&amp;quot;:0, &amp;quot;dimensions&amp;quot;:[]}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The above object will be passed to &lt;code&gt;&amp;lt;dType registry&amp;gt;.insert({...})&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;An additional &lt;code&gt;setOutputs&lt;&#x2F;code&gt; function is proposed for the dType registry:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function setOutputs(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytes32 identifier,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    dTypes[] memory outputs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    public&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;identifier&lt;&#x2F;code&gt; - type &lt;code&gt;bytes32&lt;&#x2F;code&gt;, the type&#x27;s identifier, as defined in EIP-1900&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;outputs&lt;&#x2F;code&gt; - type &lt;code&gt;dTypes&lt;&#x2F;code&gt;, as defined in EIP-1900&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;implementation-suggestions&quot;&gt;Implementation Suggestions&lt;&#x2F;h3&gt;
&lt;p&gt;In the dType registry implementation, &lt;code&gt;outputs&lt;&#x2F;code&gt; can be stored in a &lt;code&gt;mapping&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mapping(bytes32 =&amp;gt; dTypes[]) public outputs;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The suggestion to treat each &lt;code&gt;pure&lt;&#x2F;code&gt; or &lt;code&gt;view&lt;&#x2F;code&gt; function as a separate entity instead of having a contract-based approach allows us to:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;have a global context of readily available functions&lt;&#x2F;li&gt;
&lt;li&gt;scale designs through functional programming patterns rather than contract-encapsulated logic (which can be successfully used to scale development efforts independently)&lt;&#x2F;li&gt;
&lt;li&gt;bidirectionally connect functions with the types they use, making automation easier&lt;&#x2F;li&gt;
&lt;li&gt;cherry-pick functions from already deployed contracts if the other contract functions do not pass community consensus&lt;&#x2F;li&gt;
&lt;li&gt;have scope-restricted improvements - instead of redeploying entire contracts, we can just redeploy the new function versions that we want to be added to the registry&lt;&#x2F;li&gt;
&lt;li&gt;enable fine-grained auditing of individual functions, for the common good&lt;&#x2F;li&gt;
&lt;li&gt;enable testing directly on a production chain, without state side-effects&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The proposal to store the minimum ABI information on-chain, for each function, allows us to:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;enable on-chain automation (e.g. function chaining and composition)&lt;&#x2F;li&gt;
&lt;li&gt;be backward compatible in case the function signature format changes (e.g. from &lt;code&gt;bytes4&lt;&#x2F;code&gt; to &lt;code&gt;bytes32&lt;&#x2F;code&gt;): multiple signature calculation functions can be registered with dType. Examples:&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function getSignatureBytes4(bytes32 identifier)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    public&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    returns (bytes4 signature)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function getSignatureBytes32(bytes32 identifier)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    public&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    returns (bytes32 signature)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;identifier&lt;&#x2F;code&gt; - the type&#x27;s identifier, as defined in EIP-1900&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;signature&lt;&#x2F;code&gt; - the function&#x27;s signature&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Concerns about this design might be:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;redundancy of storing &lt;code&gt;contractAddress&lt;&#x2F;code&gt; for each function that is part of the same contract&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;We think that state&#x2F;storage cost will be compensated through DRYness across the chain, due to reusing types and functions that have already been registered and are now easy to find. Other state&#x2F;storage cost calculations will be added once the specification and implementation are closer to be finalized.&lt;&#x2F;p&gt;
&lt;p&gt;Note that the input and output types are based on types that have already been registered. This lowers the amount of ABI information needed to be stored for each function and enables developers to aggregate and find functions that use the same types for their I&#x2F;O. This can be a powerful tool for interoperability and smart contract composition.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal does not affect extant Ethereum standards or implementations. Registering functions for existing contract deployments should be fully supported.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Will be added.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;In-work implementation examples can be found at https:&#x2F;&#x2F;github.com&#x2F;pipeos-one&#x2F;dType.
This proposal will be updated with an appropriate implementation when consensus is reached on the specifications.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Add `blockHash` to defaultBlock methods</title>
        <published>2019-04-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Charles Cooper</name><uri>https://github.com/charles-cooper</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1898/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-1898-add-blockhash-option-to-json-rpc-methods-that-currently-support-defaultblock-parameter/11757" />
        

        <id>https://wg-eips.ritovision.com/1898/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="interface"
                label="Interface" />
            
        

        
        <category
            term="tag:eip:1898"
            label="EIP-1898" />
        

        
        

        
        <summary type="html">Add `blockHash` option to JSON-RPC methods that currently support defaultBlock parameter.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1898/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;For JSON-RPC methods which currently accept a default block parameter, additionally allow the parameter to be a block hash.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP can be considered a generalization of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;234&#x2F;&quot;&gt;EIP-234&lt;&#x2F;a&gt;. It would enable clients to unambiguously specify the block they want to query for certain JSON-RPC methods, even if the block is not in the canonical chain. This allows clients to maintain a coherent picture of blockchain state that they are interested in, even in the presence of reorgs, without requiring that the node maintain a persistent connection with the client or store any client-specific state.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The following JSON-RPC methods are affected:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;eth_getBalance&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;eth_getStorageAt&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;eth_getTransactionCount&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;eth_getCode&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;eth_call&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;eth_getProof&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The following options, quoted from the Ethereum JSON-RPC spec, are currently possible for the defaultBlock parameter:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;HEX String - an integer block number&lt;&#x2F;li&gt;
&lt;li&gt;String &quot;earliest&quot; for the earliest&#x2F;genesis block&lt;&#x2F;li&gt;
&lt;li&gt;String &quot;latest&quot; - for the latest canonical block&lt;&#x2F;li&gt;
&lt;li&gt;String &quot;pending&quot; - for the pending state&#x2F;transactions&lt;&#x2F;li&gt;
&lt;li&gt;String &quot;safe&quot; - for the most recent safe block&lt;&#x2F;li&gt;
&lt;li&gt;String &quot;finalized&quot; - for the most recent finalized block&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;Since there is no way to clearly distinguish between a DATA parameter and a QUANTITY parameter, this EIP proposes a new scheme for the block parameter. The following option is additionally allowed:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;OBJECT
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;blockNumber&lt;&#x2F;code&gt;: QUANTITY - a block number&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;blockHash&lt;&#x2F;code&gt;: DATA - a block hash&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;If the block is not found, the callee SHOULD raise a JSON-RPC error (the recommended error code is &lt;code&gt;-32001: Resource not found&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;If the tag is &lt;code&gt;blockHash&lt;&#x2F;code&gt;, an additional boolean field may be supplied to the block parameter, &lt;code&gt;requireCanonical&lt;&#x2F;code&gt;, which defaults to &lt;code&gt;false&lt;&#x2F;code&gt; and defines whether the block must be a canonical block according to the callee. If &lt;code&gt;requireCanonical&lt;&#x2F;code&gt; is &lt;code&gt;false&lt;&#x2F;code&gt;, the callee should raise a JSON-RPC error only if the block is not found (as described above). If &lt;code&gt;requireCanonical&lt;&#x2F;code&gt; is &lt;code&gt;true&lt;&#x2F;code&gt;, the callee SHOULD additionally raise a JSON-RPC error if the block is not in the canonical chain (the recommended error code is &lt;code&gt;-32000: Invalid input&lt;&#x2F;code&gt; and in any case should be different than the error code for the block not found case so that the caller can distinguish the cases). The block-not-found check SHOULD take precedence over the block-is-canonical check, so that if the block is not found the callee raises block-not-found rather than block-not-canonical.&lt;&#x2F;p&gt;
&lt;p&gt;To maintain backwards compatibility, the block number MAY be specified either as a hex string or using the new block parameter scheme. In other words, the following are equivalent for the default block parameter:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;&quot;earliest&quot;&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;&quot;0x0&quot;&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;{ &quot;blockNumber&quot;: &quot;0x0&quot; }&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;{ &quot;blockHash&quot;: &quot;0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3&quot; }&lt;&#x2F;code&gt; (hash of the genesis block on the Ethereum main chain)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;{ &quot;blockHash&quot;: &quot;0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3&quot;, &quot;requireCanonical&quot;: true }&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;{ &quot;blockHash&quot;: &quot;0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3&quot;, &quot;requireCanonical&quot;: false }&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, the state-querying JSON-RPC methods specified above have no option to unambiguously specify which block to query the state for. This can cause issues for applications which need to make multiple calls to the RPC. For instance, a wallet which just executed a transfer may want to display the balances of both the sender and recipient. If there is a re-org in between when the balance of the sender is queried via &lt;code&gt;eth_getBalance&lt;&#x2F;code&gt; and when the balance of the recipient is queried, the balances may not reconcile. As a slightly more complicated example, the UI for a decentralized exchange (which hosts orders on-chain) may walk a list of orders by calling &lt;code&gt;eth_call&lt;&#x2F;code&gt; for each of them to get the order data. Another type of use case is where an application needs to make a decision based on multiple pieces of state, e.g. a payout predicated on simultaneous ownership of two NFTs.&lt;&#x2F;p&gt;
&lt;p&gt;In order to ensure that the state is coherent (i.e., &lt;code&gt;eth_call&lt;&#x2F;code&gt; was called with exactly the same block for every call), the application may currently use one of several strategies:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Decide on a block number to use (e.g., the latest block number known to the application). After each &lt;code&gt;eth_call&lt;&#x2F;code&gt; using that block number, call &lt;code&gt;eth_getBlockByNumber&lt;&#x2F;code&gt;, also with that block number. If the block hash does not match the known hash for that block number, rollback the current activity and retry from the beginning. This adds &lt;code&gt;O(n)&lt;&#x2F;code&gt; invocations as baseline overhead and another &lt;code&gt;O(n)&lt;&#x2F;code&gt; invocations for every retry needed. Moreover, there is no way to detect the (unlikely but possible) case that the relevant block was reorged out before &lt;code&gt;eth_call&lt;&#x2F;code&gt;, and then reorged back in before &lt;code&gt;eth_getBlockByNumber&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Rely on logs, which &lt;em&gt;can&lt;&#x2F;em&gt; be queried unambiguously thanks to the &lt;code&gt;blockHash&lt;&#x2F;code&gt; parameter. However, this requires semantic support from the smart contract; if the smart contract does not emit appropriate events, the client will not be able to reconstruct the specific state it is interested in.&lt;&#x2F;li&gt;
&lt;li&gt;Rely on non-standard extensions like &lt;code&gt;parity_subscribe&lt;&#x2F;code&gt;. This requires a persistent connection between the client and node (via IPC or websockets), increases coupling between the client and the node, and cannot handle use cases where there are dependencies between invocations of &lt;code&gt;eth_call&lt;&#x2F;code&gt;, for example, walking a linked list.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Allowing &lt;code&gt;eth_call&lt;&#x2F;code&gt; and friends to unambiguously specify the block to be queried give the application developer a robust and intuitive way to solve these problems. Multiple sequential queries will query the same state, enabling the application developer to not worry about inconsistencies in their view of the blockchain state.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Backwards compatible.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;eth_getStorageAt [ &quot;0x&amp;lt;address&amp;gt;&quot;, { &quot;blockNumber&quot;: &quot;0x0&quot; }&lt;&#x2F;code&gt; -&amp;gt; return storage at given address in genesis block&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;eth_getStorageAt [ &quot;0x&amp;lt;address&amp;gt;&quot;, { &quot;blockHash&quot;: &quot;0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3&quot; }&lt;&#x2F;code&gt; -&amp;gt; return storage at given address in genesis block&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;eth_getStorageAt [ &quot;0x&amp;lt;address&amp;gt;&quot;, { &quot;blockHash&quot;: &quot;0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3&quot;, &quot;requireCanonical&quot;: false }&lt;&#x2F;code&gt; -&amp;gt; return storage at given address in genesis block&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;eth_getStorageAt [ &quot;0x&amp;lt;address&amp;gt;&quot;, { &quot;blockHash&quot;: &quot;0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3&quot;, &quot;requireCanonical&quot;: true }&lt;&#x2F;code&gt; -&amp;gt; return storage at given address in genesis block&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;eth_getStorageAt [ &quot;0x&amp;lt;address&amp;gt;&quot;, { &quot;blockHash&quot;: &quot;0x&amp;lt;non-existent-block-hash&amp;gt;&quot; }&lt;&#x2F;code&gt; -&amp;gt; raise block-not-found error&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;eth_getStorageAt [ &quot;0x&amp;lt;address&amp;gt;&quot;, { &quot;blockHash&quot;: &quot;0x&amp;lt;non-existent-block-hash&amp;gt;&quot;, &quot;requireCanonical&quot;: false }&lt;&#x2F;code&gt; -&amp;gt; raise block-not-found error&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;eth_getStorageAt [ &quot;0x&amp;lt;address&amp;gt;&quot;, { &quot;blockHash&quot;: &quot;0x&amp;lt;non-existent-block-hash&amp;gt;&quot;, &quot;requireCanonical&quot;: true }&lt;&#x2F;code&gt; -&amp;gt; raise block-not-found error&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;eth_getStorageAt [ &quot;0x&amp;lt;address&amp;gt;&quot;, { &quot;blockHash&quot;: &quot;0x&amp;lt;non-canonical-block-hash&amp;gt;&quot; }&lt;&#x2F;code&gt; -&amp;gt; return storage at given address in specified block&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;eth_getStorageAt [ &quot;0x&amp;lt;address&amp;gt;&quot;, { &quot;blockHash&quot;: &quot;0x&amp;lt;non-canonical-block-hash&amp;gt;&quot;, &quot;requireCanonical&quot;: false }&lt;&#x2F;code&gt; -&amp;gt; return storage at given address in specified block&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;eth_getStorageAt [ &quot;0x&amp;lt;address&amp;gt;&quot;, { &quot;blockHash&quot;: &quot;0x&amp;lt;non-canonical-block-hash&amp;gt;&quot;, &quot;requireCanonical&quot;: true }&lt;&#x2F;code&gt; -&amp;gt; raise block-not-canonical error&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;None&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Scalable Rewards</title>
        <published>2019-04-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Lee Raj</name><uri>https://github.com/lerajk</uri>
	</author>
	
	<author>
		<name>Qin Jian</name><uri>https://github.com/qinjian</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1973/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/1973/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1973"
            label="ERC-1973" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1973/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;A mintable token rewards interface that mints &#x27;n&#x27; tokens per block which are distributed equally among the &#x27;m&#x27; participants in the DAPP&#x27;s ecosystem.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The mintable token rewards interface allows DApps to build a token economy where token rewards are distributed equally among the active participants. The tokens are minted based on per block basis that are configurable (E.g. 10.2356 tokens per block, 0.1 token per block, 1350 tokens per block) and the mint function can be initiated by any active participant. The token rewards distributed to each participant is dependent on the number of participants in the network. At the beginning, when the network has low volume, the tokens rewards per participant is high but as the network scales the token rewards decreases dynamically.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Distributing tokens through a push system to a large amount of participants fails due to block gas limit. As the number of participants in the network grow to tens of thousands, keeping track of the iterable registry of participants and their corresponding rewards in a push system becomes unmanagable. E.g. Looping through 5000 addresses to distribute 0.0000001 reward tokens is highly inefficient. Furthermore, the gas fees in these transactions are high and needs to be undertaken by the DApp developer or the respective company, leading to centralization concerns.&lt;&#x2F;p&gt;
&lt;p&gt;A pull system is required to keep the application completely decentralized and to avoid the block gas limit problem. However, no standard solution has been proposed to distribute scalable rewards to tens of thousands participants with a pull system. This is what we propose with this EIP through concepts like TPP, round mask, participant mask.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;token amount per participant in the ecosytem or TPP (token per participant)&lt;&#x2F;code&gt;: TPP = (token amount to mint &#x2F; total active participants)&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;roundMask&lt;&#x2F;code&gt;: the cumulative snapshot of TPP over time for the token contract. E.g. transactionOne = 10 tokens are minted with 100 available participants (TPP = 10 &#x2F; 100) , transactionTwo = 12 tokens are minted with 95 participants (TPP = 12 &#x2F; 95 )&lt;&#x2F;p&gt;
&lt;p&gt;roundMask = (10&#x2F;100) + (12&#x2F;95)&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;participantMask&lt;&#x2F;code&gt;: is used to keep track of a &lt;code&gt;msg.sender&lt;&#x2F;code&gt; (participant) rewards over time. When a &lt;code&gt;msg.sender&lt;&#x2F;code&gt; joins or leaves the ecosystem, the player mask is updated&lt;&#x2F;p&gt;
&lt;p&gt;participantMask = previous roundMask OR (current roundMask - TPP)&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;rewards for msg.sender&lt;&#x2F;code&gt;: roundMask - participantMask&lt;&#x2F;p&gt;
&lt;p&gt;E.g. Let&#x27;s assume a total of 6 transactions (smart contract triggers or functions calls) are in place with 10 existing participants (denominator) and 20 tokens (numerator) are minted per transaction. At 2nd transaction, the 11th participant joins the network and exits before 5th transaction, the 11th participant&#x27;s balance is as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;t1 roundMask = (20&#x2F;10)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;t2 roundMask = (20&#x2F;10) + (20&#x2F;11) &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;t3 roundMask = (20&#x2F;10) + (20&#x2F;11) + (20&#x2F;11)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;t4 roundMask = (20&#x2F;10) + (20&#x2F;11) + (20&#x2F;11) + (20&#x2F;11)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;t5 roundMask = (20&#x2F;10) + (20&#x2F;11) + (20&#x2F;11) + (20&#x2F;11)+ (20&#x2F;10)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;t6 roundMask = (20&#x2F;10) + (20&#x2F;11) + (20&#x2F;11) + (20&#x2F;11)+ (20&#x2F;10) + (20&#x2F;10)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Total tokens released in 6 transactions = 60 tokens&lt;&#x2F;p&gt;
&lt;p&gt;As the participant joins at t2 and leaves before t5, the participant deserves the rewards between t2 and t4. When the participant joins at t2, the &#x27;participantMask = (20&#x2F;10)&#x27;, when the participant leaves before t5, the cumulative deserved reward tokens are :&lt;&#x2F;p&gt;
&lt;p&gt;rewards for msg.sender: &lt;code&gt;[t4 roundMask = (20&#x2F;10) + (20&#x2F;11)+ (20&#x2F;11) + (20&#x2F;11)] - [participantMask = (20&#x2F;10)] = [rewards = (20&#x2F;11)+ (20&#x2F;11) + (20&#x2F;11)]&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;When the same participant joins the ecosystem at a later point (t27 or t35), a new &#x27;participantMask&#x27; is given that is used to calculate the new deserved reward tokens when the participant exits. This process continues dynamically for each participant.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;tokensPerBlock&lt;&#x2F;code&gt;: the amount of tokens that will be released per block&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;blockFreezeInterval&lt;&#x2F;code&gt;: the number of blocks that need to pass until the next mint. E.g. if set to 50 and &#x27;n&#x27; tokens were minted at block &#x27;b&#x27;, the next &#x27;n&#x27; tokens won&#x27;t be minted until &#x27;b + 50&#x27; blocks have passed&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;lastMintedBlockNumber&lt;&#x2F;code&gt;: the block number on which last &#x27;n&#x27; tokens were minted&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;totalParticipants&lt;&#x2F;code&gt; : the total number of participants in the DApp network&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;tokencontractAddress&lt;&#x2F;code&gt; : the contract address to which tokens will be minted, default is address(this)&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.5.2&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;openzeppelin-solidity&#x2F;contracts&#x2F;token&#x2F;ERC20&#x2F;ERC20Mintable.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;openzeppelin-solidity&#x2F;contracts&#x2F;token&#x2F;ERC20&#x2F;ERC20Detailed.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Rewards&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC20Mintable&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC20Detailed&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;using&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SafeMath&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; roundMask&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; lastMintedBlockNumber&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; totalParticipants &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; tokensPerBlock&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; blockFreezeInterval&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; tokencontractAddress &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; participantMask&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; constructor, initializes variables.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokensPerBlock&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of token that will be released per block, entered in wei format (E.g. 1000000000000000000)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _blockFreezeInterval&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of blocks that need to pass (E.g. 1, 10, 100) before more tokens are brought into the ecosystem.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokensPerBlock&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _blockFreezeInterval&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC20Detailed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;&amp;quot;Simple Token&amp;quot;, &amp;quot;SIM&amp;quot;, 18)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;lastMintedBlockNumber &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tokensPerBlock &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _tokensPerBlock&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;blockFreezeInterval &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _blockFreezeInterval&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Modifier to check if msg.sender is whitelisted as a minter. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;modifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isAuthorized&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isMinter&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;_&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Function to add participants in the network. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _minter&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address that will be able to mint tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; A&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; boolean that indicates if the operation was successful.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addMinters&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _minter&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_addMinter&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_minter&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;totalParticipants &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; totalParticipants&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;updateParticipantMask&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_minter&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Function to remove participants in the network. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _minter&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address that will be unable to mint tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; A&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; boolean that indicates if the operation was successful.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; removeMinters&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _minter&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;totalParticipants &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; totalParticipants&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;sub&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_removeMinter&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_minter&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Function to introduce new tokens in the network. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; A&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; boolean that indicates if the operation was successful.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; trigger&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isAuthorized&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt; res &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; readyToMint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;res &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;mintTokens&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Function to withdraw rewarded tokens by a participant. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; A&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; boolean that indicates if the operation was successful.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; withdraw&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isAuthorized&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; amount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calculateRewards&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;amount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokencontractAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Function to check if new tokens are ready to be minted. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; A&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; boolean that indicates if the operation was successful.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; readyToMint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; currentBlockNumber &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; lastBlockNumber &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; lastMintedBlockNumber&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;currentBlockNumber &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; lastBlockNumber &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt; blockFreezeInterval&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Function to calculate current rewards for a participant. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; A&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; uint that returns the calculated rewards amount.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calculateRewards&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; playerMask &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; participantMask&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; rewards &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; roundMask&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;sub&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;playerMask&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;updateParticipantMask&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span&gt; rewards&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Function to mint new tokens into the economy. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; A&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; boolean that indicates if the operation was successful.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mintTokens&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; currentBlockNumber &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; tokenReleaseAmount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;currentBlockNumber&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;sub&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;lastMintedBlockNumber&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;mul&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokensPerBlock&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;lastMintedBlockNumber &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; currentBlockNumber&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokencontractAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenReleaseAmount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;calculateTPP&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenReleaseAmount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Function to calculate TPP (token amount per participant).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; A&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; boolean that indicates if the operation was successful.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calculateTPP&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokens&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; tpp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; tokens&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;div&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;totalParticipants&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;updateRoundMask&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tpp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Function to update round mask. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; A&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; boolean that indicates if the operation was successful.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; updateRoundMask&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tpp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;roundMask &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; roundMask&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tpp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Function to update participant mask (store the previous round mask)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;* &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; A&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; boolean that indicates if the operation was successful.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; updateParticipantMask&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; participant&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; previousRoundMask &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; roundMask&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;participantMask&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;participant&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; previousRoundMask&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, there is no standard for a scalable reward distribution mechanism. In order to create a sustainable cryptoeconomic environment within DAPPs, incentives play a large role. However, without a scalable way to distribute rewards to tens of thousands of participants, most DAPPs lack a good incentive structure. The ones with a sustainable cryptoeconomic environment depend heavily on centralized servers or a group of selective nodes to trigger the smart contracts. But, in order to keep an application truly decentralized, the reward distribution mechanism must depend on the active participants itself and scale as the number of participants grow. This is what this EIP intends to accomplish.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Not Applicable.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;WIP, will be added.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;WIP, a proper implementation will be added later.A sample example is below:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;etherscan rewards contract&lt;&#x2F;code&gt; : https:&#x2F;&#x2F;ropsten.etherscan.io&#x2F;address&#x2F;0x8b0abfc541ab7558857816a67e186221adf887bc#tokentxns&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;Step 1&lt;&#x2F;code&gt; : deploy Rewards contract with the following parameters_tokensPerBlock = 1e18, _blockFreezeInterval = 1&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;Step 2&lt;&#x2F;code&gt; : add Alice(0x123) and Bob(0x456) as minters, addMinters(address _minter)&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;Step 3&lt;&#x2F;code&gt; : call trigger() from Alice &#x2F; Bob&#x27;s account. 65 blocks are passed, hence 65 SIM tokens are minted. The RM is 32500000000000000000&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;Step 4&lt;&#x2F;code&gt; : Alice withdraws and receives 32.5 SIM tokens (65 tokens &#x2F; 2 participants) and her PM = 32500000000000000000&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;Step 5&lt;&#x2F;code&gt; : add Satoshi(0x321) and Vitalik(0x654) as minters, addMinters(address _minter)&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;Step 6&lt;&#x2F;code&gt; : call trigger() from Alice &#x2F; Bob&#x27;s &#x2F; Satoshi &#x2F; Vitalik account. 101 blocks are passed, hence 101 SIM tokens are minted. The RM is 57750000000000000000&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;Step 7&lt;&#x2F;code&gt; : Alice withdraws and receives 25.25 SIM tokens (101 tokens &#x2F; 4 participants) and her PM = 57750000000000000000&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;Step 8&lt;&#x2F;code&gt; : Bob withdraws and receives 57.75 SIM tokens ((65 tokens &#x2F; 2 participants) + (101 tokens &#x2F; 4 participants)). Bob&#x27;s PM = 57750000000000000000&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via CC0.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Scalable Reward Distribution on the Ethereum Blockchain by Bogdan Batog, Lucian Boca and Nick Johnson&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Fomo3d DApp, https:&#x2F;&#x2F;fomo3d.hostedwiki.co&#x2F;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Commitment to Sustainable Ecosystem Funding</title>
        <published>2019-03-31T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Gregory Markou</name><email>greg@chainsafe.io</email>
	</author>
	
	<author>
		<name>Kevin Owocki</name><email>kevin@gitcoin.co</email>
	</author>
	
	<author>
		<name>Lane Rettig</name><email>lane@ethereum.org</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1890/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://t.me/joinchat/DwEd_xahL5hHvzNYH2RnQA" />
        

        <id>https://wg-eips.ritovision.com/1890/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:1890"
            label="EIP-1890" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1890/">&lt;h1 id=&quot;commitment-to-sustainable-ecosystem-funding&quot;&gt;Commitment to Sustainable Ecosystem Funding&lt;&#x2F;h1&gt;
&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Ethereum currently provides a block reward to proof of work miners every block, but it does not capture any block rewards for ecosystem funding. This EIP adds a simple mechanism for capturing a portion of block rewards for ecosystem funding as a credible commitment to doing so in future, but it does not actually capture any such rewards.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;A mechanism that allows specification of two parameters, a beneficiary address and a per-block reward denominated in wei, that allows a portion of block rewards to be captured for the purpose of ecosystem funding. Both values are set to zero.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;In order for Ethereum to succeed, it needs talented, motivated researchers and developers to continue to develop and maintain the platform. Those talented researchers and developers deserve to be paid fairly for their work. At present there is no mechanism in the Ethereum ecosystem that rewards R&amp;amp;D teams fairly for their work on the platform.&lt;&#x2F;p&gt;
&lt;p&gt;We recognize that, while technically trivial, the real challenge in inflation-based funding is social: how to fairly capture, govern, and distribute block rewards. It will take time to work out the answer to these questions. For this reason, this EIP only seeks to make a credible commitment on the part of core developers to securing the funding they need to keep Ethereum alive and healthy by adding a mechanism to do so, but the actual amount of rewards captured remains at zero, i.e., there is no change at present to Ethereum’s economics. Raising the amount captured above zero would require a future EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Two new constants are introduced: BENEFICIARY_ADDRESS, an Address, and DEVFUND_BLOCK_REWARD, an amount denominated in wei. Both are set to zero.&lt;&#x2F;p&gt;
&lt;p&gt;Beginning with block ISTANBUL_BLOCK_HEIGHT, DEVFUND_BLOCK_REWARD wei is added to the balance of BENEFICIARY_ADDRESS at each block.&lt;&#x2F;p&gt;
&lt;p&gt;We may optionally add another constant, DECAY_FACTOR, which specifies a linear or exponenential decay factor that reduces the reward at every block &amp;gt; ISTANBUL_BLOCK_HEIGHT until it decays to zero. For simplicity, it has been omitted from this proposal.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;We believe that the technical design of this EIP is straightforward. The social rationale is explained in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;medium.com&#x2F;gitcoin&#x2F;funding-open-source-in-the-blockchain-era-8ded753bf05f&quot;&gt;this article&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP has no impact on backwards compatibility.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP makes no changes to existing state transitions. Existing consensus tests should be sufficient.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Reference implementations are included for the Trinity, go-ethereum, and parity clients.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Repricing for trie-size-dependent opcodes</title>
        <published>2019-03-28T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Martin Holst Swende</name><uri>https://github.com/holiman</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1884/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/opcode-repricing/3024" />
        

        <id>https://wg-eips.ritovision.com/1884/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1884"
            label="EIP-1884" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1884/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes repricing certain opcodes, to obtain a good balance between gas expenditure and resource consumption.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The growth of the Ethereum state has caused certain opcodes to be more resource-intensive at this point than
they were previously. This EIP proposes to raise the &lt;code&gt;gasCost&lt;&#x2F;code&gt; for those opcodes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;An imbalance between the price of an operation and the resource consumption (CPU time, memory etc)
has several drawbacks:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;It could be used for attacks, by filling blocks with underpriced operations which causes excessive block processing time.&lt;&#x2F;li&gt;
&lt;li&gt;Underpriced opcodes cause a skewed block gas limit, where sometimes blocks finish quickly but other blocks with similar gas use finish slowly.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;If operations are well-balanced, we can maximise the block gaslimit and have a more stable processing time.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;At block &lt;code&gt;N&lt;&#x2F;code&gt;,&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;SLOAD&lt;&#x2F;code&gt; (&lt;code&gt;0x54&lt;&#x2F;code&gt;) operation changes from &lt;code&gt;200&lt;&#x2F;code&gt; to &lt;code&gt;800&lt;&#x2F;code&gt; gas,&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;BALANCE&lt;&#x2F;code&gt; (&lt;code&gt;0x31&lt;&#x2F;code&gt;) operation changes from &lt;code&gt;400&lt;&#x2F;code&gt; to &lt;code&gt;700&lt;&#x2F;code&gt; gas,&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; (&lt;code&gt;0x3F&lt;&#x2F;code&gt;) operation changes from &lt;code&gt;400&lt;&#x2F;code&gt; to &lt;code&gt;700&lt;&#x2F;code&gt; gas,&lt;&#x2F;li&gt;
&lt;li&gt;A new opcode, &lt;code&gt;SELFBALANCE&lt;&#x2F;code&gt; is introduced at &lt;code&gt;0x47&lt;&#x2F;code&gt;.
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;SELFBALANCE&lt;&#x2F;code&gt; pops &lt;code&gt;0&lt;&#x2F;code&gt; arguments off the stack,&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SELFBALANCE&lt;&#x2F;code&gt; pushes the &lt;code&gt;balance&lt;&#x2F;code&gt; of the current address to the stack,&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SELFBALANCE&lt;&#x2F;code&gt; is priced as &lt;code&gt;GasFastStep&lt;&#x2F;code&gt;, at &lt;code&gt;5&lt;&#x2F;code&gt; gas.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Here are two charts, taken from a full sync using Geth. The execution time was measured for every opcode, and aggregated for 10K blocks. These bar charts show the top 25 &#x27;heavy&#x27; opcodes in the ranges 5M to 6M and 6M to 7M:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1884&#x2F;.&#x2F;assets&#x2F;run3.total-bars-5.png&quot; alt=&quot;bars1&quot; &#x2F;&gt;
&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1884&#x2F;.&#x2F;assets&#x2F;run3.total-bars-6.png&quot; alt=&quot;bars2&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Note: It can also be seen that the &lt;code&gt;SLOAD&lt;&#x2F;code&gt; moves towards the top position. The &lt;code&gt;GASPRICE&lt;&#x2F;code&gt; (&lt;code&gt;0x3a&lt;&#x2F;code&gt;) opcode has position one which I believe can be optimized away within the client -- which is not the case with &lt;code&gt;SLOAD&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;BALANCE&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Here is another chart, showing a full sync with Geth. It represents the blocks &lt;code&gt;0&lt;&#x2F;code&gt; to &lt;code&gt;5.7M&lt;&#x2F;code&gt;, and highlights what the block processing time is spent on.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1884&#x2F;.&#x2F;assets&#x2F;geth_processing.png&quot; alt=&quot;geth&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;It can be seen that &lt;code&gt;storage_reads&lt;&#x2F;code&gt; and &lt;code&gt;account_reads&lt;&#x2F;code&gt; are the two most significant factors contributing to the block processing time.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;sload&quot;&gt;&lt;code&gt;SLOAD&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;SLOAD&lt;&#x2F;code&gt; was repriced at &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;150&#x2F;&quot;&gt;EIP-150&lt;&#x2F;a&gt;, from &lt;code&gt;50&lt;&#x2F;code&gt; to &lt;code&gt;200&lt;&#x2F;code&gt;.
The following graph shows a go-ethereum full sync, where each data point represents
10K blocks. During those 10K blocks, the execution time for the opcode was aggregated.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1884&#x2F;.&#x2F;assets&#x2F;SLOAD-run3.png&quot; alt=&quot;graph&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;It can be seen that the repricing at &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;150&#x2F;&quot;&gt;EIP-150&lt;&#x2F;a&gt; caused a steep drop, from around &lt;code&gt;67&lt;&#x2F;code&gt; to &lt;code&gt;23&lt;&#x2F;code&gt;.
Around block &lt;code&gt;5M&lt;&#x2F;code&gt;, it started reaching pre-&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;150&#x2F;&quot;&gt;EIP-150&lt;&#x2F;a&gt; levels, and at block &lt;code&gt;7M&lt;&#x2F;code&gt;
it was averaging on around &lt;code&gt;150&lt;&#x2F;code&gt; - more than double pre-eip-150 levels.&lt;&#x2F;p&gt;
&lt;p&gt;Increasing the cost of &lt;code&gt;SLOAD&lt;&#x2F;code&gt; by &lt;code&gt;4&lt;&#x2F;code&gt; would bring it back down to around &lt;code&gt;40&lt;&#x2F;code&gt;.
It is to be expected that it will rise again in the future, and may need future repricing, unless
state clearing efforts are implemented before that happens.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;balance&quot;&gt;&lt;code&gt;BALANCE&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;BALANCE&lt;&#x2F;code&gt; (a.k.a &lt;code&gt;EXTBALANCE&lt;&#x2F;code&gt;) is an operation which fetches data from the state trie. It was repriced at &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;150&#x2F;&quot;&gt;EIP-150&lt;&#x2F;a&gt; from &lt;code&gt;20&lt;&#x2F;code&gt; to &lt;code&gt;400&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1884&#x2F;.&#x2F;assets&#x2F;BALANCE-run3.png&quot; alt=&quot;graph&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;It is comparable to &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; and &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt;, which are priced at &lt;code&gt;700&lt;&#x2F;code&gt; already.&lt;&#x2F;p&gt;
&lt;p&gt;It has a built-in high variance, since it is often used for checking the balance of &lt;code&gt;this&lt;&#x2F;code&gt;,
which is an inherently cheap operation, however, it can be used to lookup the balance of arbitrary account which often require trie (disk) access.&lt;&#x2F;p&gt;
&lt;p&gt;In hindsight, it might have been a better choice to have two
opcodes: &lt;code&gt;EXTBALANCE(address)&lt;&#x2F;code&gt; and &lt;code&gt;SELFBALANCE&lt;&#x2F;code&gt;, and have two different prices.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;This EIP proposes to extend the current opcode set.
&lt;ul&gt;
&lt;li&gt;Unfortunately, the opcode span &lt;code&gt;0x3X&lt;&#x2F;code&gt; is already full, hence the suggestion to place &lt;code&gt;SELFBALANCE&lt;&#x2F;code&gt; in the &lt;code&gt;0x4X&lt;&#x2F;code&gt; range.&lt;&#x2F;li&gt;
&lt;li&gt;As for why it is priced at &lt;code&gt;5&lt;&#x2F;code&gt; (&lt;code&gt;GasFastStep&lt;&#x2F;code&gt;) instead of &lt;code&gt;2&lt;&#x2F;code&gt; (&lt;code&gt;GasQuickStep&lt;&#x2F;code&gt;), like other similar operations: the EVM execution engine still needs a lookup into the (cached) trie, and &lt;code&gt;balance&lt;&#x2F;code&gt;, unlike &lt;code&gt;gasPrice&lt;&#x2F;code&gt; or &lt;code&gt;timeStamp&lt;&#x2F;code&gt;, is not constant during the execution, so it has a bit more inherent overhead.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;extcodehash&quot;&gt;&lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; was introduced in Constantinople, with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1052&#x2F;&quot;&gt;EIP-1052&lt;&#x2F;a&gt;. It was priced at &lt;code&gt;400&lt;&#x2F;code&gt; with the reasoning:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;The gas cost is the same as the gas cost for the &lt;code&gt;BALANCE&lt;&#x2F;code&gt; opcode because the execution of the &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; requires the same account lookup as in &lt;code&gt;BALANCE&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;Ergo, if we increase &lt;code&gt;BALANCE&lt;&#x2F;code&gt;, we should also increase &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The changes require a hardfork. The changes have the following consequences:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Certain calls will become more expensive.&lt;&#x2F;li&gt;
&lt;li&gt;Default-functions which access the storage and may in some cases require more than&lt;code&gt;2300&lt;&#x2F;code&gt; gas (the minimum gas that is always available in calls).&lt;&#x2F;li&gt;
&lt;li&gt;Contracts that assume a certain fixed gas cost for calls (or internal sections) may cease to function.
&lt;ul&gt;
&lt;li&gt;A fixed gas cost is specified in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; and implementations of this interface do use the affected opcodes.
&lt;ul&gt;
&lt;li&gt;The ERC-165 method &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; must return a &lt;code&gt;bool&lt;&#x2F;code&gt; and use at most &lt;code&gt;30,000&lt;&#x2F;code&gt; gas.&lt;&#x2F;li&gt;
&lt;li&gt;The two example implementations from the EIP were, at the time of writing
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;586&lt;&#x2F;code&gt; gas for any input, and&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;236&lt;&#x2F;code&gt; gas, but increases linearly with a higher number of supported interfaces&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;It is unlikely that any ERC-165 &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; implementation will go above &lt;code&gt;30.000&lt;&#x2F;code&gt; gas. That would require that the second variant is used, and thirty:ish interfaces are supported.&lt;&#x2F;li&gt;
&lt;li&gt;However, these operations have already been repriced earlier, so there is a historical precedent that &#x27;the gascost for these operations may change&#x27;, which should have prevented such fixed-gas-cost assumptions from being implemented.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;I expect that certain patterns will be less used, for example the use of multiple modifiers which &lt;code&gt;SLOAD&lt;&#x2F;code&gt;s the same opcode will be merged into one. It may also lead to less &lt;code&gt;log&lt;&#x2F;code&gt; operations containing &lt;code&gt;SLOAD&lt;&#x2F;code&gt;ed values that are not strictly necessary.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Testcases that should be implemented:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Test that &lt;code&gt;selfbalance == balance(address)&lt;&#x2F;code&gt;,&lt;&#x2F;li&gt;
&lt;li&gt;Test that &lt;code&gt;balance(this)&lt;&#x2F;code&gt; costs as before,&lt;&#x2F;li&gt;
&lt;li&gt;Test that &lt;code&gt;selfbalance&lt;&#x2F;code&gt; does not pop from stack&lt;&#x2F;li&gt;
&lt;li&gt;Gascost verification of &lt;code&gt;SLOAD&lt;&#x2F;code&gt;, &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; and &lt;code&gt;SELFBALANCE&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Verify that &lt;code&gt;SELFBALANCE&lt;&#x2F;code&gt; is invalid before Istanbul&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Some testcases have been implemented as statetests at https:&#x2F;&#x2F;github.com&#x2F;holiman&#x2F;IstanbulTests&#x2F;tree&#x2F;master&#x2F;GeneralStateTests&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP has not yet been implemented in any client.
Both these opcodes have been repriced before, and the client internals for managing reprices are already in place.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;selfbalance&quot;&gt;&lt;code&gt;SELFBALANCE&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;This is the implementation for the new opcode in go-ethereum:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;go&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;func&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; opSelfBalance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;pc&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interpreter&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;EVMInterpreter&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Memory&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; stack&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Stack&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;byte&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; error&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	stack&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;push&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;interpreter&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;intPool&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;get&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Set&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;interpreter&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;StateDB&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;GetBalance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;	return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; nil&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; nil&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security considerations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;See backwards compatibility section.&lt;&#x2F;li&gt;
&lt;li&gt;There are no special edgecases regarding &lt;code&gt;SELFBALANCE&lt;&#x2F;code&gt;, if we define it as &lt;code&gt;BALANCE&lt;&#x2F;code&gt; with &lt;code&gt;address&lt;&#x2F;code&gt; instead of popping an address from the stack -- since &lt;code&gt;BALANCE&lt;&#x2F;code&gt; is already well-defined.&lt;&#x2F;li&gt;
&lt;li&gt;It should be investigated if Solidity contains any hardcoded expectations on the gas cost of these operations.&lt;&#x2F;li&gt;
&lt;li&gt;In many cases, a recipient of &lt;code&gt;ether&lt;&#x2F;code&gt; from a &lt;code&gt;CALL&lt;&#x2F;code&gt; will want to issue a &lt;code&gt;LOG&lt;&#x2F;code&gt;. The &lt;code&gt;LOG&lt;&#x2F;code&gt; operation costs &lt;code&gt;375&lt;&#x2F;code&gt; plus &lt;code&gt;375&lt;&#x2F;code&gt; per topic. If the &lt;code&gt;LOG&lt;&#x2F;code&gt; also wants to do an &lt;code&gt;SLOAD&lt;&#x2F;code&gt;, this change may make some such transfers fail.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>dType - Decentralized Type System for EVM</title>
        <published>2019-03-28T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Loredana Cirstea</name><uri>https://github.com/loredanacirstea</uri>
	</author>
	
	<author>
		<name>Christian Tzurcanu</name><uri>https://github.com/ctzurcanu</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1900/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/1882" />
        

        <id>https://wg-eips.ritovision.com/1900/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:1900"
            label="ERC-1900" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1900/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;The EVM and related languages such as Solidity need consensus on an extensible Type System in order to further evolve into the Singleton Operating System (The World Computer).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;We are proposing a decentralized Type System for Ethereum, to introduce data definition (and therefore ABI) consistency. This ERC focuses on defining an on-chain Type Registry (named &lt;code&gt;dType&lt;&#x2F;code&gt;) and a common interface for creating types, based on &lt;code&gt;struct&lt;&#x2F;code&gt;s.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;In order to build a network of interoperable protocols on Ethereum, we need data standardization, to ensure a smooth flow of on-chain information. Off-chain, the Type Registry will allow a better analysis of blockchain data (e.g. for blockchain explorers) and creation of smart contract development tools for easily using existing types in a new smart contract.&lt;&#x2F;p&gt;
&lt;p&gt;However, this is only the first phase. As defined in this document and in the future proposals that will be based on this one, we are proposing something more: a decentralized Type System with Data Storage - &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;pull&#x2F;2158&quot;&gt;ERC-2158&lt;&#x2F;a&gt;. In addition, developers can create libraries of &lt;code&gt;pure&lt;&#x2F;code&gt; functions that know how to interact and modify the data entries - &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;1921&quot;&gt;dType Functions Extension&lt;&#x2F;a&gt;. This will effectively create the base for a general functional programming system on Ethereum, where developers can use previously created building blocks.&lt;&#x2F;p&gt;
&lt;p&gt;To summarize:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;We would like to have a good decentralized medium for integrating all Ethereum data, and relationships between the different types of data. Also, a way to address the behavior related to each data type.&lt;&#x2F;li&gt;
&lt;li&gt;Functional programming becomes easier. Functions like &lt;code&gt;map&lt;&#x2F;code&gt;, &lt;code&gt;reduce&lt;&#x2F;code&gt;, &lt;code&gt;filter&lt;&#x2F;code&gt;, are implemented by each type library.&lt;&#x2F;li&gt;
&lt;li&gt;Solidity development tools could be transparently extended to include the created types (For example in IDEs like Remix). At a later point, the EVM itself can have precompiled support for these types.&lt;&#x2F;li&gt;
&lt;li&gt;The system can be easily extended to types pertaining to other languages. (With type definitions in the source (Swarm stored source code in the respective language))&lt;&#x2F;li&gt;
&lt;li&gt;The dType database should be part of the System Registry for the Operating System of The World Computer&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The Type Registry can have a governance protocol for its CRUD operations. However, this, and other permission guards are not covered in this proposal.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;type-definition-and-metadata&quot;&gt;Type Definition and Metadata&lt;&#x2F;h3&gt;
&lt;p&gt;The dType registry should support the registration of Solidity&#x27;s elementary and complex types. In addition, it should also support contract events definitions. In this EIP, the focus will be on describing the minimal on-chain type definition and metadata needed for registering Solidity user-defined types.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;type-definition-typelibrary&quot;&gt;Type Definition: TypeLibrary&lt;&#x2F;h4&gt;
&lt;p&gt;A type definition consists of a type library containing:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;the nominal &lt;code&gt;struct&lt;&#x2F;code&gt; used to define the type&lt;&#x2F;li&gt;
&lt;li&gt;additional functions:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;isInstanceOf&lt;&#x2F;code&gt;: checks whether a given variable is an instance of the defined type. Additional rules can be defined for each type fields, e.g. having a specific range for a &lt;code&gt;uint16 amount&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;provide HOFs such as &lt;code&gt;map&lt;&#x2F;code&gt;, &lt;code&gt;filter&lt;&#x2F;code&gt;, &lt;code&gt;reduce&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;structureBytes&lt;&#x2F;code&gt; and &lt;code&gt;destructureBytes&lt;&#x2F;code&gt;: provide type structuring and destructuring. This can be useful for low-level calls or assembly code, when importing contract interfaces is not an efficient option. It can also be used for type checking.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;A simple example is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.5.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; experimental&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ABIEncoderV2&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;library&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; myBalanceLib&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; myBalance&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span&gt; accountName&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; structureBytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;myBalance&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; balance&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; destructureBytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;myBalance&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balance&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isInstanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;myBalance&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balance&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; isInstance&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; map&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; callbackAddr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; callbackSig&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        myBalance&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceArr&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        internal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;myBalance&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Types can also use existing types in their composition. However, this will always result in a directed acyclic graph.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;library&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; myTokenLib&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    using&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; myBalanceLib&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; myBalanceLib&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;myBalance&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; myToken&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; token&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        myBalanceLib&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;myBalance&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;type-metadata-dtype-registry&quot;&gt;Type Metadata: dType Registry&lt;&#x2F;h4&gt;
&lt;p&gt;Type metadata will be registered on-chain, in the dType registry contract. This consists of:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;name&lt;&#x2F;code&gt; - the type&#x27;s name, as it would be used in Solidity; it can be stored as a &lt;code&gt;string&lt;&#x2F;code&gt; or encoded as &lt;code&gt;bytes&lt;&#x2F;code&gt;. The name can have a human-readable part and a version number.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;typeChoice&lt;&#x2F;code&gt; - used for storing additional ABI data that differentiate how types are handled on and off chain. It is defined as an &lt;code&gt;enum&lt;&#x2F;code&gt; with the following options: &lt;code&gt;BaseType&lt;&#x2F;code&gt;, &lt;code&gt;PayableFunction&lt;&#x2F;code&gt;, &lt;code&gt;StateFunction&lt;&#x2F;code&gt;, &lt;code&gt;ViewFunction&lt;&#x2F;code&gt;, &lt;code&gt;PureFunction&lt;&#x2F;code&gt;, &lt;code&gt;Event&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;contractAddress&lt;&#x2F;code&gt; - the Ethereum &lt;code&gt;address&lt;&#x2F;code&gt; of the &lt;code&gt;TypeRootContract&lt;&#x2F;code&gt;. For this proposal, we can consider the Type Library address as the &lt;code&gt;TypeRootContract&lt;&#x2F;code&gt;. Future EIPs will make it more flexible and propose additional TypeStorage contracts that will modify the scope of &lt;code&gt;contractAddress&lt;&#x2F;code&gt; - &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;pull&#x2F;2158&quot;&gt;ERC-2158&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;source&lt;&#x2F;code&gt; - a &lt;code&gt;bytes32&lt;&#x2F;code&gt; Swarm hash where the source code of the type library and contracts can be found; in future EIPs, where dType will be extended to support other languages (e.g. JavaScript, Rust), the file identified by the Swarm hash will contain the type definitions in that language.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;types&lt;&#x2F;code&gt; - metadata for subtypes: the first depth level internal components. This is an array of objects (&lt;code&gt;structs&lt;&#x2F;code&gt;), with the following fields:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;name&lt;&#x2F;code&gt; - the subtype name, of type &lt;code&gt;string&lt;&#x2F;code&gt;, similar to the above &lt;code&gt;name&lt;&#x2F;code&gt; definition&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;label&lt;&#x2F;code&gt; - the subtype label&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;dimensions&lt;&#x2F;code&gt; - &lt;code&gt;string[]&lt;&#x2F;code&gt; used for storing array dimensions. E.g.:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;[]&lt;&#x2F;code&gt; -&amp;gt; &lt;code&gt;TypeA&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;[&quot;&quot;]&lt;&#x2F;code&gt; -&amp;gt; &lt;code&gt;TypeA[]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;[&quot;2&quot;]&lt;&#x2F;code&gt; -&amp;gt; &lt;code&gt;TypeA[2]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;[&quot;&quot;,&quot;&quot;]&lt;&#x2F;code&gt; -&amp;gt; &lt;code&gt;TypeA[][]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;[&quot;2&quot;,&quot;3&quot;]&lt;&#x2F;code&gt; -&amp;gt; &lt;code&gt;TypeA[2][3]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Examples of metadata, for simple, value types:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;contractAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;typeChoice&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;source&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;types&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;contractAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;typeChoice&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;source&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;types&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Composed types can be defined as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;contractAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x105631C6CdDBa84D12Fa916f0045B1F97eC9C268&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;typeChoice&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;source&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; SWARM&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; for&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; source&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; code&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; files&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &amp;quot;name&amp;quot;: &amp;quot;myBalance&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &amp;quot;types&amp;quot;: [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;label&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;accountName&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; dimensions&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;label&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; dimensions&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Composed types can be further composed:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;contractAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x91E3737f15e9b182EdD44D45d943cF248b3a3BF9&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;typeChoice&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;source&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; SWARM&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; for&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; source&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; code&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; files&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &amp;quot;name&amp;quot;: &amp;quot;myToken&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &amp;quot;types&amp;quot;: [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;label&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;token&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; dimensions&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;myBalance&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;label&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; dimensions&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;myToken&lt;&#x2F;code&gt; type will have the final data format: &lt;code&gt;(address,(string,uint256))&lt;&#x2F;code&gt; and a labeled format: &lt;code&gt;(address token, (string accountName, uint256 amount))&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;dtype-registry-data-structures-and-interface&quot;&gt;dType Registry Data Structures and Interface&lt;&#x2F;h5&gt;
&lt;p&gt;To store this metadata, the dType registry will have the following data structures:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TypeChoices&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;    BaseType&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;    PayableFunction&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;    StateFunction&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;    ViewFunction&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;    PureFunction&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;    Event&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; dTypes&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span&gt; label&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; dimensions&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; dType&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    TypeChoices typeChoice&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; contractAddress&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; source&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    dTypes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; types&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;For storage, we propose a pattern which isolates the type metadata from additional storage-specific data and allows CRUD operations on records.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; key: identifier&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Type&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; typeStruct&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of identifiers&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; typeIndex&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Type&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  dType data&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span&gt; index&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note that we are proposing to define the type&#x27;s primary identifier, &lt;code&gt;identifier&lt;&#x2F;code&gt;, as &lt;code&gt;keccak256(abi.encodePacked(name))&lt;&#x2F;code&gt;. If the system is extended to other programming languages, we can define &lt;code&gt;identifier&lt;&#x2F;code&gt; as &lt;code&gt;keccak256(abi.encodePacked(language, name))&lt;&#x2F;code&gt;.
Initially, single word English names can be disallowed, avoiding name squatting.&lt;&#x2F;p&gt;
&lt;p&gt;The dType registry interface is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;#39;.&#x2F;dTypeLib.sol&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; dType&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; LogNew&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; identifier&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; LogUpdate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; identifier&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; LogRemove&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; identifier&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; insert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;dTypeLib&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;dType&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; identifier&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; remove&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; identifier&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; count&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; counter&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getTypeIdentifier&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; identifier&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getByIdentifier&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; identifier&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;dTypeLib&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;dType&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; dtype&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;dTypeLib&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;dType&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; dtype&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isRegistered&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; identifier&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; registered&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Notes:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;To ensure backward compatibility, we suggest that updating types should not be supported.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;remove&lt;&#x2F;code&gt; function can also be removed from the interface, to ensure immutability. One reason for keeping it would be clearing up storage for types that are not in use or have been made obsolete. However, this can have undesired effects and should be accompanied by a solid permissions system, testing and governance process. This part will be updated when enough feedback has been received.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The Type Registry must store the minimum amount of information for rebuilding the type ABI definition. This allows us to:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;support on-chain interoperability&lt;&#x2F;li&gt;
&lt;li&gt;decode blockchain side effects off-chain (useful for block explorers)&lt;&#x2F;li&gt;
&lt;li&gt;allow off-chain tools to cache and search through the collection (e.g. editor plugin for writing typed smart contracts)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;There is one advantage that has become clear with the emergence of global operating systems, like Ethereum: we can have a global type system through which the system’s parts can interoperate. Projects should agree on standardizing types and a type registry, continuously working on improving them, instead of creating encapsulated projects, each with their own types.&lt;&#x2F;p&gt;
&lt;p&gt;The effort of having consensus on new types being added or removing unused ones is left to the governance system.&lt;&#x2F;p&gt;
&lt;p&gt;After the basis of such a system is specified, we can move forward to building a static type checking system at compile time, based on the type definitions and rules stored in the dType registry.&lt;&#x2F;p&gt;
&lt;p&gt;The Type Library must express the behavior strictly pertinent to its defined type. Additional behavior, required by various project&#x27;s business logic can be added later, through libraries containing functions that handle the respective type. These can also be registered in dType, but will be detailed in a future ERC.&lt;&#x2F;p&gt;
&lt;p&gt;This is an approach that will separate definitions from stored data and behavior, allowing for easier and more secure fine-grained upgrades.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal does not affect extant Ethereum standards or implementations. It uses the present experimental version of ABIEncoderV2.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Will be added.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;An in-work implementation can be found at https:&#x2F;&#x2F;github.com&#x2F;pipeos-one&#x2F;dType&#x2F;tree&#x2F;master&#x2F;contracts&#x2F;contracts.
This proposal will be updated with an appropriate implementation when consensus is reached on the specifications.&lt;&#x2F;p&gt;
&lt;p&gt;A video demo of the current implementation (a more extended version of this proposal) can be seen at https:&#x2F;&#x2F;youtu.be&#x2F;pcqi4yWBDuQ.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>ENS Interface Discovery</title>
        <published>2019-03-15T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Nick Johnson</name><uri>https://github.com/arachnid</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1844/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/ens-interface-discovery/2924" />
        

        <id>https://wg-eips.ritovision.com/1844/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1844"
            label="ERC-1844" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1844/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Defines a method of associating contract interfaces with ENS names and addresses, and of discovering those interfaces.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP specifies a method for exposing interfaces associated with an ENS name or an address (typically a contract address) and allowing applications to discover those interfaces and interact with them. Interfaces can be implemented either by the target contract (if any) or by any other contract.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;EIP 165 supports interface discovery - determining if the contract at a given address supports a requested interface. However, in many cases it&#x27;s useful to be able to discover functionality associated with a name or an address that is implemented by other contracts.&lt;&#x2F;p&gt;
&lt;p&gt;For example, a token contract may not itself provide any kind of &#x27;atomic swap&#x27; functionality, but there may be associated contracts that do. With ENS interface discovery, the token contract can expose this metadata, informing applications where they can find that functionality.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;A new profile for ENS resolvers is defined, consisting of the following method:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; interfaceImplementer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The EIP-165 interface ID of this interface is &lt;code&gt;0xb8f2bbb4&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Given an ENS name hash &lt;code&gt;node&lt;&#x2F;code&gt; and an EIP-165 &lt;code&gt;interfaceID&lt;&#x2F;code&gt;, this function returns the address of an appropriate implementer of that interface. If there is no interface matching that interface ID for that node, 0 is returned.&lt;&#x2F;p&gt;
&lt;p&gt;The address returned by &lt;code&gt;interfaceImplementer&lt;&#x2F;code&gt; MUST refer to a smart contract.&lt;&#x2F;p&gt;
&lt;p&gt;The smart contract at the returned address SHOULD implement EIP-165.&lt;&#x2F;p&gt;
&lt;p&gt;Resolvers implementing this interface MAY utilise a fallback strategy: If no matching interface was explicitly provided by the user, query the contract returned by &lt;code&gt;addr()&lt;&#x2F;code&gt;, returning its address if the requested interface is supported by that contract, and 0 otherwise. If they do this, they MUST ensure they return 0, rather than reverting, if the target contract reverts.&lt;&#x2F;p&gt;
&lt;p&gt;This field may be used with both forward resolution and reverse resolution.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;A naive approach to this problem would involve adding this method directly to the target contract. However, doing this has several shortcomings:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Each contract must maintain its own list of interface implementations.&lt;&#x2F;li&gt;
&lt;li&gt;Modifying this list requires access controls, which the contract may not have previously required.&lt;&#x2F;li&gt;
&lt;li&gt;Support for this must be designed in when the contract is written, and cannot be retrofitted afterwards.&lt;&#x2F;li&gt;
&lt;li&gt;Only one canonical list of interfaces can be supported.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Using ENS resolvers instead mitigates these shortcomings, making it possible for anyone to associate interfaces with a name, even for contracts not previously built with this in mind.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;There are no backwards compatibility issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The PublicResolver in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ensdomains&#x2F;resolvers&#x2F;&quot;&gt;ensdomains&#x2F;resolvers&lt;&#x2F;a&gt; repository implements this interface.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Compact Signature Representation</title>
        <published>2019-03-14T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Richard Moore</name><uri>https://github.com/ricmoo</uri>
	</author>
	
	<author>
		<name>Nick Johnson</name><email>nick@ethereum.org</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2098/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/2440" />
        

        <id>https://wg-eips.ritovision.com/2098/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:2098"
            label="ERC-2098" />
        

        
        

        
        <summary type="html">A compact representation of an Ethereum Signature.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2098/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The secp256k1 curve permits the computation of the public key of signed
digest when coupled with a signature, which is used implicitly to
establish the origin of a transaction from an Externally Owned Account
as well as on-chain in EVM contracts for example, in meta-transactions and
multi-sig contracts.&lt;&#x2F;p&gt;
&lt;p&gt;Currently signatures require 65 bytes to represent, which when aligned
to 256-bit words, requires 96 bytes (with 31 zero bytes injected). The
yParity in RLP-encoded transactions also require (on average) 1.5 bytes.
With compact signatures, this can be reduced to 64 bytes, which remains 64
bytes when word-aligned, and in the case of RLP-encoded transactions
saves the 1.5 bytes required for the yParity.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The motivations for a compact representation are to simplify handling
transactions in client code, reduce gas costs and reduce transaction sizes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;A secp256k1 signature is made up of 3 parameters, &lt;code&gt;r&lt;&#x2F;code&gt;, &lt;code&gt;s&lt;&#x2F;code&gt; and &lt;code&gt;yParity&lt;&#x2F;code&gt;.
The &lt;code&gt;r&lt;&#x2F;code&gt; represents the &lt;code&gt;x&lt;&#x2F;code&gt; component on the curve (from which the &lt;code&gt;y&lt;&#x2F;code&gt; can be
computed), and the &lt;code&gt;s&lt;&#x2F;code&gt; represents the challenge solution for signing by a
private key. Due to the symmetric nature of an elliptic curve, a &lt;code&gt;yParity&lt;&#x2F;code&gt;
is required, which indicates which of the 2 possible solutions was intended,
by indicating its parity (odd-ness).&lt;&#x2F;p&gt;
&lt;p&gt;Two key observations are required to create a compact representation.&lt;&#x2F;p&gt;
&lt;p&gt;First, the &lt;code&gt;yParity&lt;&#x2F;code&gt; parameter is always either 0 or 1 (canonically the values
used have historically been 27 and 28, as these values didn&#x27;t collide with other
binary prefixes used in Bitcoin).&lt;&#x2F;p&gt;
&lt;p&gt;Second, the top bit of the &lt;code&gt;s&lt;&#x2F;code&gt; parameters is &lt;strong&gt;always&lt;&#x2F;strong&gt; 0, due to the use of
canonical signatures which flip the solution parity to prevent negative values,
which was introduced as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2&#x2F;&quot;&gt;a constraint in Homestead&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;So, we can hijack the top bit in the &lt;code&gt;s&lt;&#x2F;code&gt; parameter to store the value of
&lt;code&gt;yParity&lt;&#x2F;code&gt;, resulting in:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[256-bit r value][1-bit yParity value][255-bit s value]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;example-implementation-in-python&quot;&gt;Example Implementation In Python&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Assume yParity is 0 or 1, normalized from the canonical 27 or 28&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; to_compact&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; s&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; yParity&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;yParityAndS&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;yParity&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 255&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span&gt; s&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; to_canonical&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; yParityAndS&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; yParityAndS&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 255&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;yParity&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;yParityAndS&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 255&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The compact representation proposed is simple to both compose and decompose
in clients and in Solidity, so that it can be easily (and intuitively) supported,
while reducing transaction sizes and gas costs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The Compact Representation does not collide with canonical signature as
it uses 2 parameters (r, yParityAndS) and is 64 bytes long while canonical
signatures involve 3 separate parameters (r, s, yParity) and are 65 bytes long.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Private Key: 0x1234567890123456789012345678901234567890123456789012345678901234&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Message: &amp;quot;Hello World&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Signature:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  r:  0x68a020a209d3d56c46f38cc50a33f704f4a9a10a59377f8dd762ac66910e9b90&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  s:  0x7e865ad05c4035ab5792787d4a0297a43617ae897930a6fe4d822b8faea52064&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  v:  27&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Compact Signature:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  r:           0x68a020a209d3d56c46f38cc50a33f704f4a9a10a59377f8dd762ac66910e9b90&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  yParityAndS: 0x7e865ad05c4035ab5792787d4a0297a43617ae897930a6fe4d822b8faea52064&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Private Key: 0x1234567890123456789012345678901234567890123456789012345678901234&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Message: &amp;quot;It&amp;#39;s a small(er) world&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Signature:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  r:  0x9328da16089fcba9bececa81663203989f2df5fe1faa6291a45381c81bd17f76&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  s:  0x139c6d6b623b42da56557e5e734a43dc83345ddfadec52cbe24d0cc64f550793&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  v:  28&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Compact Signature:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  r:           0x9328da16089fcba9bececa81663203989f2df5fe1faa6291a45381c81bd17f76&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  yParityAndS: 0x939c6d6b623b42da56557e5e734a43dc83345ddfadec52cbe24d0cc64f550793  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The ethers.js library &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethers-io&#x2F;ethers.js&#x2F;blob&#x2F;ethers-v5-beta&#x2F;packages&#x2F;bytes&#x2F;src.ts&#x2F;index.ts#L323&quot;&gt;supports this in v5&lt;&#x2F;a&gt;
as an unofficial property of split signatures (i.e. &lt;code&gt;sig._vs&lt;&#x2F;code&gt;), but should be
considered an internal property that may change at discretion of the community
and any changes to this EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;There are no additional security concerns introduced by this EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Precompile for Elliptic Curve Linear Combinations</title>
        <published>2019-03-06T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Remco Bloemen</name><email>Recmo@0x.org</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1829/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/ewasm-precompile-for-general-elliptic-curve-math/2581" />
        

        <id>https://wg-eips.ritovision.com/1829/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:1829"
            label="EIP-1829" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1829/">&lt;h1 id=&quot;precompile-for-elliptic-curve-linear-combinations&quot;&gt;Precompile for Elliptic Curve Linear Combinations&lt;&#x2F;h1&gt;
&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Currently the EVM only supports &lt;em&gt;secp256k1&lt;&#x2F;em&gt; in a limited way through &lt;code&gt;ecrecover&lt;&#x2F;code&gt; and &lt;em&gt;altbn128&lt;&#x2F;em&gt; through two pre-compiles. There are draft proposals to add more curves. There are many more elliptic curves that have useful applications for integration with existing systems or newly developed curves for zero-knowledge proofs.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP adds a precompile that allows whole classes of curves to be used.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;A precompile that takes a curve and computes a linear combination of curve points.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Given integers &lt;code&gt;m, α&lt;&#x2F;code&gt; and &lt;code&gt;β&lt;&#x2F;code&gt;, scalars &lt;code&gt;s_i&lt;&#x2F;code&gt;, and curve points &lt;code&gt;A_i&lt;&#x2F;code&gt; construct the elliptic curve&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;y² = x³ + α ⋅ x + β  mod  m&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;and compute the following&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;C = s₀ ⋅ A₀ + s₁ ⋅ A₁ + ⋯ + s_n ⋅ A_n&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;aka &lt;em&gt;linear combination&lt;&#x2F;em&gt;, &lt;em&gt;inner product&lt;&#x2F;em&gt;, &lt;em&gt;multi-multiplication&lt;&#x2F;em&gt; or even &lt;em&gt;multi-exponentiation&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(Cx, Cy) := ecmul(m, α, β,  s0, Ax0, As0, s1, Ax1, As1, ...)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;gas-cost&quot;&gt;Gas cost&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;BASE_GAS = ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ADD_GAS  = ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;MUL_GAS  = ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The total gas cost is &lt;code&gt;BASE_GAS&lt;&#x2F;code&gt; plus &lt;code&gt;ADD_GAS&lt;&#x2F;code&gt; for each &lt;code&gt;s_i&lt;&#x2F;code&gt; that is &lt;code&gt;1&lt;&#x2F;code&gt; and &lt;code&gt;MUL_GAS&lt;&#x2F;code&gt; for each &lt;code&gt;s_i &amp;gt; 1&lt;&#x2F;code&gt; (&lt;code&gt;s_i = 0&lt;&#x2F;code&gt; is free).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;encoding-of-points&quot;&gt;Encoding of points&lt;&#x2F;h3&gt;
&lt;p&gt;Encode as &lt;code&gt;(x, y&#x27;)&lt;&#x2F;code&gt; where &lt;code&gt;s&lt;&#x2F;code&gt; indicates whether &lt;code&gt;y&lt;&#x2F;code&gt; or &lt;code&gt;-y&lt;&#x2F;code&gt; is to be taken. It follows SEC 1 v 1.9 2.3.4, except uncompressed points (&lt;code&gt;y&#x27; = 0x04&lt;&#x2F;code&gt;) are not supported.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;code&gt;y&#x27;&lt;&#x2F;code&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;code&gt;(x, y)&lt;&#x2F;code&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x00&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Point at infinity&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x02&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Solution with &lt;code&gt;y&lt;&#x2F;code&gt; even&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x03&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Solution with &lt;code&gt;y&lt;&#x2F;code&gt; odd&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Conversion from affine coordinates to compressed coordinates is trivial: &lt;code&gt;y&#x27; = 0x02 | (y &amp;amp; 0x01)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;special-cases&quot;&gt;Special cases&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;Coordinate recovery.&lt;&#x2F;strong&gt; Set &lt;code&gt;s₀ = 1&lt;&#x2F;code&gt;. The output will be the recovered coordinates of &lt;code&gt;A₀&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;On-curve checking.&lt;&#x2F;strong&gt; Do coordinate recovery and compare &lt;code&gt;y&lt;&#x2F;code&gt; coordinate.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Addition.&lt;&#x2F;strong&gt; Set &lt;code&gt;s₀ = s₁ = 1&lt;&#x2F;code&gt;, the output will be &lt;code&gt;A₀ + A₁&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Doubling.&lt;&#x2F;strong&gt; Set &lt;code&gt;s₀ = 2&lt;&#x2F;code&gt;. The output will be &lt;code&gt;2 ⋅ A₀&lt;&#x2F;code&gt;. (Note: under the current gas model, this may be more costly than self-addition!)&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Scalar multiplication.&lt;&#x2F;strong&gt; Set only &lt;code&gt;s₀&lt;&#x2F;code&gt; and &lt;code&gt;A₀&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Modular square root.&lt;&#x2F;strong&gt; Set &lt;code&gt;α = s₀ = A = 0&lt;&#x2F;code&gt; the output will have &lt;code&gt;Cy² = β   mod  m&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;edge-cases&quot;&gt;Edge cases&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Non-prime moduli or too small modulus&lt;&#x2F;li&gt;
&lt;li&gt;Field elements larger than modulus&lt;&#x2F;li&gt;
&lt;li&gt;Curve has singular points (&lt;code&gt;4 α³ + 27 β² = 0&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;Invalid sign bytes&lt;&#x2F;li&gt;
&lt;li&gt;x coordinate not on curve&lt;&#x2F;li&gt;
&lt;li&gt;Returning the point at infinity&lt;&#x2F;li&gt;
&lt;li&gt;(Please add if you spot more)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;Generic Field and Curve.&lt;&#x2F;strong&gt; Many important optimizations are independent of the field and curve used. Some missed specific optimizations are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Reductions specific to the binary structure of the field prime.&lt;&#x2F;li&gt;
&lt;li&gt;Precomputation of Montgomery factors.&lt;&#x2F;li&gt;
&lt;li&gt;Precomputation of multiples of certain popular points like the generator.&lt;&#x2F;li&gt;
&lt;li&gt;Special point addition&#x2F;doubling &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.hyperelliptic.org&#x2F;EFD&#x2F;g1p&#x2F;auto-shortw.html&quot;&gt;formulas&lt;&#x2F;a&gt; for &lt;code&gt;α = -3&lt;&#x2F;code&gt;, &lt;code&gt;α = -1&lt;&#x2F;code&gt;, &lt;code&gt;α = 0&lt;&#x2F;code&gt;, &lt;code&gt;β = 0&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;TODO: The special cases for &lt;code&gt;α&lt;&#x2F;code&gt; and &lt;code&gt;β&lt;&#x2F;code&gt; might be worth implementing and offering a gas discount.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Compressed Coordinates.&lt;&#x2F;strong&gt; Compressed coordinates allow contract to work with only &lt;code&gt;x&lt;&#x2F;code&gt; coordinates and sign bytes. It also prevents errors around points not being on-curve. Conversion to compressed coordinates is trivial.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Linear Combination.&lt;&#x2F;strong&gt; We could instead have a simple multiply &lt;code&gt;C = r ⋅ A&lt;&#x2F;code&gt;. In this case we would need a separate pre-compile for addition. In addition, a linear combination allows for optimizations that like Shamir&#x27;s trick that are not available in a single scalar multiplication. ECDSA requires &lt;code&gt;s₀ ⋅ A₀ + s₁ ⋅ A₁&lt;&#x2F;code&gt; and would benefit from this.&lt;&#x2F;p&gt;
&lt;p&gt;The BN254 (aka alt_bn8) multiplication operation introduced by the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;196&#x2F;&quot;&gt;EIP-196&lt;&#x2F;a&gt; precompile only handles a single scalar multiplication. The missed performance is such that for two or more points it is cheaper to use EVM, as practically demonstrated by &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;medium.com&#x2F;aztec-protocol&#x2F;huffing-for-crypto-with-weierstrudel-9c9568c06901&quot;&gt;Weierstrudel&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Variable Time Math.&lt;&#x2F;strong&gt; When called during a transaction, there is no assumption of privacy and no mitigations for side-channel attacks are necessary.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Prime Fields.&lt;&#x2F;strong&gt; This EIP is for fields of large characteristic. It does not cover Binary fields and other fields of non-prime characteristic.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;256-bit modulus.&lt;&#x2F;strong&gt; This EIP is for field moduli less than &lt;code&gt;2^{256}&lt;&#x2F;code&gt;. This covers many of the popular curves while still having all parameters fit in a single EVM word.&lt;&#x2F;p&gt;
&lt;p&gt;TODO: Consider a double-word version. 512 bits would cover all known curves except E-521. In particular it will cover the NIST P-384 curve used by the Estonian e-Identity and the BLS12-381 curve used by &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;z.cash&#x2F;blog&#x2F;new-snark-curve&#x2F;&quot;&gt;ZCash Sappling&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Short Weierstrass Curves.&lt;&#x2F;strong&gt; This EIP is for fields specified in short Weierstrass form. While any curve can be converted to short Weierstrass form through a &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;safecurves.cr.yp.to&#x2F;equation.html&quot;&gt;substitution of variables&lt;&#x2F;a&gt;, this misses out on the performance advantages of those specific forms.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;There will be a reference implementation in Rust based on the existing libraries (in particular those by ZCash and The Matter Inc.).&lt;&#x2F;p&gt;
&lt;p&gt;The reference implementation will be production grade and compile to a native library with a C api and a webassembly version. Node developers are encouraged to use the reference implementation and can use either the rust library, the native C bindings or the webassembly module. Node developers can of course always decide to implement their own.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP overlaps in scope with&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;196&#x2F;&quot;&gt;EIP-196&lt;&#x2F;a&gt;: ecadd, ecmul for altbn128&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;603&quot;&gt;EIP issue 603&lt;&#x2F;a&gt;: ecadd, ecmul for SECP256k1.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;665&#x2F;&quot;&gt;EIP-665&lt;&#x2F;a&gt;: ECDSA verify for ED25519.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1108&#x2F;&quot;&gt;EIP-1108&lt;&#x2F;a&gt;: Optimize ecadd and ecmul for altbn128.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Pseudo-introspection Registry Contract</title>
        <published>2019-03-04T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Jordi Baylina</name><email>jordi@baylina.cat</email>
	</author>
	
	<author>
		<name>Jacques Dafflon</name><email>mail@0xjac.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1820/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/pull/1820" />
        

        <id>https://wg-eips.ritovision.com/1820/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1820"
            label="ERC-1820" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1820/">&lt;blockquote&gt;
&lt;p&gt;:information_source: &lt;strong&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1820&#x2F;&quot;&gt;ERC-1820&lt;&#x2F;a&gt; has superseded &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;820&#x2F;&quot;&gt;ERC-820&lt;&#x2F;a&gt;.&lt;&#x2F;strong&gt; :information_source:&lt;br &#x2F;&gt;
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1820&#x2F;&quot;&gt;ERC-1820&lt;&#x2F;a&gt; fixes the incompatibility in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; logic which was introduced by the Solidity 0.5 update.&lt;br &#x2F;&gt;
Have a look at the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;820#issuecomment-464109166&quot;&gt;official announcement&lt;&#x2F;a&gt;, and the comments about the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;820#issuecomment-452465748&quot;&gt;bug&lt;&#x2F;a&gt; and the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;820#issuecomment-454021564&quot;&gt;fix&lt;&#x2F;a&gt;.&lt;br &#x2F;&gt;
Apart from this fix, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1820&#x2F;&quot;&gt;ERC-1820&lt;&#x2F;a&gt; is functionally equivalent to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;820&#x2F;&quot;&gt;ERC-820&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;:warning: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1820&#x2F;&quot;&gt;ERC-1820&lt;&#x2F;a&gt; MUST be used in lieu of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;820&#x2F;&quot;&gt;ERC-820&lt;&#x2F;a&gt;. :warning:&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;This standard defines a universal registry smart contract where any address (contract or regular account) can register which interface it supports and which smart contract is responsible for its implementation.&lt;&#x2F;p&gt;
&lt;p&gt;This standard keeps backward compatibility with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard defines a registry where smart contracts and regular accounts can publish which functionality they implement---either directly or through a proxy contract.&lt;&#x2F;p&gt;
&lt;p&gt;Anyone can query this registry to ask if a specific address implements a given interface and which smart contract handles its implementation.&lt;&#x2F;p&gt;
&lt;p&gt;This registry MAY be deployed on any chain and shares the same address on all chains.&lt;&#x2F;p&gt;
&lt;p&gt;Interfaces with zeroes (&lt;code&gt;0&lt;&#x2F;code&gt;) as the last 28 bytes are considered &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; interfaces,
and this registry SHALL forward the call to the contract to see if it implements the interface.&lt;&#x2F;p&gt;
&lt;p&gt;This contract also acts as an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; cache to reduce gas consumption.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;There have been different approaches to define pseudo-introspection in Ethereum.
The first is &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; which has the limitation that it cannot be used by regular accounts.
The second attempt is &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;672&quot;&gt;ERC-672&lt;&#x2F;a&gt; which uses reverse &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ens.domains&#x2F;&quot;&gt;ENS&lt;&#x2F;a&gt;. Using reverse &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ens.domains&#x2F;&quot;&gt;ENS&lt;&#x2F;a&gt; has two issues.
First, it is unnecessarily complicated, and second, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ens.domains&#x2F;&quot;&gt;ENS&lt;&#x2F;a&gt; is still a centralized contract controlled by a multisig.
This multisig theoretically would be able to modify the system.&lt;&#x2F;p&gt;
&lt;p&gt;This standard is much simpler than &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;672&quot;&gt;ERC-672&lt;&#x2F;a&gt;, and it is &lt;em&gt;fully&lt;&#x2F;em&gt; decentralized.&lt;&#x2F;p&gt;
&lt;p&gt;This standard also provides a &lt;em&gt;unique&lt;&#x2F;em&gt; address for all chains.
Thus solving the problem of resolving the correct registry address for different chains.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;erc-1820-registry-smart-contract&quot;&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1820&#x2F;&quot;&gt;ERC-1820&lt;&#x2F;a&gt; Registry Smart Contract&lt;&#x2F;h3&gt;
&lt;blockquote&gt;
&lt;p&gt;This is an exact copy of the code of the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;0xjac&#x2F;ERC1820&#x2F;blob&#x2F;master&#x2F;contracts&#x2F;ERC1820Registry.sol&quot;&gt;ERC1820 registry smart contract&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC1820 Pseudo-introspection Registry Contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * This standard defines a universal registry smart contract where any address (contract or regular account) can&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * register which interface it supports and which smart contract is responsible for its implementation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * Written in 2019 by Jordi Baylina and Jacques Dafflon&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * this software to the public domain worldwide. This software is distributed without any warranty.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &amp;lt;http:&#x2F;&#x2F;creativecommons.org&#x2F;publicdomain&#x2F;zero&#x2F;1.0&#x2F;&amp;gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *    ███████╗██████╗  ██████╗ ██╗ █████╗ ██████╗  ██████╗&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *    ██╔════╝██╔══██╗██╔════╝███║██╔══██╗╚════██╗██╔═████╗&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *    █████╗  ██████╔╝██║     ╚██║╚█████╔╝ █████╔╝██║██╔██║&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *    ██╔══╝  ██╔══██╗██║      ██║██╔══██╗██╔═══╝ ████╔╝██║&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *    ███████╗██║  ██║╚██████╗ ██║╚█████╔╝███████╗╚██████╔╝&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *    ╚══════╝╚═╝  ╚═╝ ╚═════╝ ╚═╝ ╚════╝ ╚══════╝ ╚═════╝&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *    ██████╗ ███████╗ ██████╗ ██╗███████╗████████╗██████╗ ██╗   ██╗&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *    ██╔══██╗██╔════╝██╔════╝ ██║██╔════╝╚══██╔══╝██╔══██╗╚██╗ ██╔╝&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *    ██████╔╝█████╗  ██║  ███╗██║███████╗   ██║   ██████╔╝ ╚████╔╝&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *    ██╔══██╗██╔══╝  ██║   ██║██║╚════██║   ██║   ██╔══██╗  ╚██╔╝&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *    ██║  ██║███████╗╚██████╔╝██║███████║   ██║   ██║  ██║   ██║&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *    ╚═╝  ╚═╝╚══════╝ ╚═════╝ ╚═╝╚══════╝   ╚═╝   ╚═╝  ╚═╝   ╚═╝&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0.5.3&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; IV is value needed to have a vanity address starting with &amp;#39;0x1820&amp;#39;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; IV: 53759&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The interface a contract MUST implement if it is the implementer of&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; some (other) interface for any address other than itself.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC1820ImplementerInterface&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Indicates whether the contract implements the interface &amp;#39;interfaceHash&amp;#39; for the address &amp;#39;addr&amp;#39; or not.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; interfaceHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; keccak256 hash of the name of the interface&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address for which the contract will implement the interface&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ERC1820_ACCEPT_MAGIC&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; only if the contract implements &amp;#39;interfaceHash&amp;#39; for the address &amp;#39;addr&amp;#39;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; canImplementInterfaceForAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC1820 Pseudo-introspection Registry Contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @author&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Jordi Baylina and Jacques Dafflon&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This contract is the official implementation of the ERC1820 Registry.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; For more details, see https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-1820&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC1820Registry&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC165 Invalid ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; INVALID_ID &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xffffffff&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Method ID for the ERC165 supportsInterface method (= `bytes4(keccak256(&amp;#39;supportsInterface(bytes4)&amp;#39;))`).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; ERC165ID &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x01ffc9a7&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Magic value which is returned if a contract implements an interface on behalf of some other address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; ERC1820_ACCEPT_MAGIC &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;ERC1820_ACCEPT_MAGIC&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; mapping from addresses and interface hashes to their implementers.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; interfaces&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; mapping from addresses to their manager.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; managers&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; flag for each address and erc165 interface to indicate if it is cached.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; erc165Cached&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Indicates a contract is the &amp;#39;implementer&amp;#39; of &amp;#39;interfaceHash&amp;#39; for &amp;#39;addr&amp;#39;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InterfaceImplementerSet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceHash&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; implementer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Indicates &amp;#39;newManager&amp;#39; is the address of the new manager for &amp;#39;addr&amp;#39;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ManagerChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newManager&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Query if an address implements an interface and through which contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address being queried for the implementer of an interface.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; (If &amp;#39;_addr&amp;#39; is the zero address then &amp;#39;msg.sender&amp;#39; is assumed.)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _interfaceHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Keccak256 hash of the name of the interface as a string.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; E.g., &amp;#39;web3.utils.keccak256(&amp;quot;ERC777TokensRecipient&amp;quot;)&amp;#39; for the &amp;#39;ERC777TokensRecipient&amp;#39; interface.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address of the contract which implements the interface &amp;#39;_interfaceHash&amp;#39; for &amp;#39;_addr&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; or &amp;#39;0&amp;#39; if &amp;#39;_addr&amp;#39; did not register an implementer for this interface.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getInterfaceImplementer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _addr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _interfaceHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; addr &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _addr &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ?&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; :&lt;&#x2F;span&gt;&lt;span&gt; _addr&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isERC165Interface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_interfaceHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes4&lt;&#x2F;span&gt;&lt;span&gt; erc165InterfaceHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes4&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_interfaceHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; implementsERC165Interface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; erc165InterfaceHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ?&lt;&#x2F;span&gt;&lt;span&gt; addr &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; interfaces&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_interfaceHash&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sets the contract which implements a specific interface for an address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Only the manager defined for that address can set it.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; (Each address is the manager for itself until it sets a new manager.)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address for which to set the interface.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; (If &amp;#39;_addr&amp;#39; is the zero address then &amp;#39;msg.sender&amp;#39; is assumed.)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _interfaceHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Keccak256 hash of the name of the interface as a string.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; E.g., &amp;#39;web3.utils.keccak256(&amp;quot;ERC777TokensRecipient&amp;quot;)&amp;#39; for the &amp;#39;ERC777TokensRecipient&amp;#39; interface.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _implementer&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Contract address implementing &amp;#39;_interfaceHash&amp;#39; for &amp;#39;_addr&amp;#39;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setInterfaceImplementer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _addr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _interfaceHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _implementer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; addr &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _addr &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ?&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; :&lt;&#x2F;span&gt;&lt;span&gt; _addr&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getManager&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Not the manager&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isERC165Interface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_interfaceHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Must not be an ERC165 hash&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;_implementer &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; _implementer &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;                ERC1820ImplementerInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_implementer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    .&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;canImplementInterfaceForAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_interfaceHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; ERC1820_ACCEPT_MAGIC&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;                &amp;quot;Does not implement the interface&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        interfaces&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_interfaceHash&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; _implementer&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InterfaceImplementerSet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _interfaceHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _implementer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sets &amp;#39;_newManager&amp;#39; as manager for &amp;#39;_addr&amp;#39;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The new manager will be able to call &amp;#39;setInterfaceImplementer&amp;#39; for &amp;#39;_addr&amp;#39;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address for which to set the new manager.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _newManager&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the new manager for &amp;#39;addr&amp;#39;. (Pass &amp;#39;0x0&amp;#39; to reset the manager to &amp;#39;_addr&amp;#39;.)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setManager&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _addr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _newManager&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getManager&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Not the manager&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        managers&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; _newManager &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; _addr &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; :&lt;&#x2F;span&gt;&lt;span&gt; _newManager&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ManagerChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_addr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _newManager&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the manager of an address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address for which to return the manager.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; of the manager for a given address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getManager&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; By default the manager of an address is the same address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;managers&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; _addr&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; managers&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Compute the keccak256 hash of an interface given its name.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _interfaceName&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Name of the interface.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; keccak256 hash of an interface name.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; interfaceHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _interfaceName&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_interfaceName&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; --- ERC165 Related Functions --- &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; --- Developed in collaboration with William Entriken. --- &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Updates the cache with whether the contract implements an ERC165 interface or not.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the contract for which to update the cache.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _interfaceId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC165 interface for which to update the cache.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; updateERC165Cache&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        interfaces&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_contract&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_interfaceId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; implementsERC165InterfaceNoCache&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            _contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ?&lt;&#x2F;span&gt;&lt;span&gt; _contract &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        erc165Cached&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_contract&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_interfaceId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Checks whether a contract implements an ERC165 interface or not.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  If the result is not cached a direct lookup on the contract address is performed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  If the result is not cached or the cached value is out-of-date, the cache MUST be updated manually by calling&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  &amp;#39;updateERC165Cache&amp;#39; with the contract address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the contract to check.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _interfaceId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC165 interface to check.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; True&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if &amp;#39;_contract&amp;#39; implements &amp;#39;_interfaceId&amp;#39;, false otherwise.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; implementsERC165Interface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;erc165Cached&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_contract&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_interfaceId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; implementsERC165InterfaceNoCache&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; interfaces&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_contract&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_interfaceId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; _contract&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Checks whether a contract implements an ERC165 interface or not without using nor updating the cache.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the contract to check.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _interfaceId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC165 interface to check.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; True&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if &amp;#39;_contract&amp;#39; implements &amp;#39;_interfaceId&amp;#39;, false otherwise.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; implementsERC165InterfaceNoCache&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; success&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; result&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span&gt;success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; noThrowCall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; ERC165ID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;success &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span&gt; result &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span&gt;success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; noThrowCall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; INVALID_ID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;success &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span&gt; result &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span&gt;success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; noThrowCall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;success &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; result &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Checks whether the hash is a ERC165 interface (ending with 28 zeroes) or not.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _interfaceHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The hash to check.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; True&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if &amp;#39;_interfaceHash&amp;#39; is an ERC165 interface (ending with 28 zeroes), false otherwise.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isERC165Interface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _interfaceHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _interfaceHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Make a call on a contract without throwing if the function does not exist.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; noThrowCall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes4&lt;&#x2F;span&gt;&lt;span&gt; erc165ID &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; ERC165ID&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            let&lt;&#x2F;span&gt;&lt;span&gt; x &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x40&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;               &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Find empty storage location using &amp;quot;free memory pointer&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            mstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;x&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; erc165ID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Place signature at beginning of empty storage&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            mstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;x&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x04&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Place first argument directly next to signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            success &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; staticcall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;                30000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                         &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 30k gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                _contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                     &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; To addr&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                x&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                             &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Inputs are stored at location x&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;                0x24&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                          &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Inputs are 36 (4 + 32) bytes long&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                x&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                             &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Store output over input (saves space)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;                0x20&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                           &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Outputs are 32 bytes long&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            result &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;x&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                 &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Load the result&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;deployment-transaction&quot;&gt;Deployment Transaction&lt;&#x2F;h3&gt;
&lt;p&gt;Below is the raw transaction which MUST be used to deploy the smart contract on any chain.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xf90a388085174876e800830c35008080b909e5608060405234801561001057600080fd5b506109c5806100206000396000f3fe608060405234801561001057600080fd5b50600436106100a5576000357c010000000000000000000000000000000000000000000000000000000090048063a41e7d5111610078578063a41e7d51146101d4578063aabbb8ca1461020a578063b705676514610236578063f712f3e814610280576100a5565b806329965a1d146100aa5780633d584063146100e25780635df8122f1461012457806365ba36c114610152575b600080fd5b6100e0600480360360608110156100c057600080fd5b50600160a060020a038135811691602081013591604090910135166102b6565b005b610108600480360360208110156100f857600080fd5b5035600160a060020a0316610570565b60408051600160a060020a039092168252519081900360200190f35b6100e06004803603604081101561013a57600080fd5b50600160a060020a03813581169160200135166105bc565b6101c26004803603602081101561016857600080fd5b81019060208101813564010000000081111561018357600080fd5b82018360208201111561019557600080fd5b803590602001918460018302840111640100000000831117156101b757600080fd5b5090925090506106b3565b60408051918252519081900360200190f35b6100e0600480360360408110156101ea57600080fd5b508035600160a060020a03169060200135600160e060020a0319166106ee565b6101086004803603604081101561022057600080fd5b50600160a060020a038135169060200135610778565b61026c6004803603604081101561024c57600080fd5b508035600160a060020a03169060200135600160e060020a0319166107ef565b604080519115158252519081900360200190f35b61026c6004803603604081101561029657600080fd5b508035600160a060020a03169060200135600160e060020a0319166108aa565b6000600160a060020a038416156102cd57836102cf565b335b9050336102db82610570565b600160a060020a031614610339576040805160e560020a62461bcd02815260206004820152600f60248201527f4e6f7420746865206d616e616765720000000000000000000000000000000000604482015290519081900360640190fd5b6103428361092a565b15610397576040805160e560020a62461bcd02815260206004820152601a60248201527f4d757374206e6f7420626520616e204552433136352068617368000000000000604482015290519081900360640190fd5b600160a060020a038216158015906103b85750600160a060020a0382163314155b156104ff5760405160200180807f455243313832305f4143434550545f4d4147494300000000000000000000000081525060140190506040516020818303038152906040528051906020012082600160a060020a031663249cb3fa85846040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018083815260200182600160a060020a0316600160a060020a031681526020019250505060206040518083038186803b15801561047e57600080fd5b505afa158015610492573d6000803e3d6000fd5b505050506040513d60208110156104a857600080fd5b5051146104ff576040805160e560020a62461bcd02815260206004820181905260248201527f446f6573206e6f7420696d706c656d656e742074686520696e74657266616365604482015290519081900360640190fd5b600160a060020a03818116600081815260208181526040808320888452909152808220805473ffffffffffffffffffffffffffffffffffffffff19169487169485179055518692917f93baa6efbd2244243bfee6ce4cfdd1d04fc4c0e9a786abd3a41313bd352db15391a450505050565b600160a060020a03818116600090815260016020526040812054909116151561059a5750806105b7565b50600160a060020a03808216600090815260016020526040902054165b919050565b336105c683610570565b600160a060020a031614610624576040805160e560020a62461bcd02815260206004820152600f60248201527f4e6f7420746865206d616e616765720000000000000000000000000000000000604482015290519081900360640190fd5b81600160a060020a031681600160a060020a0316146106435780610646565b60005b600160a060020a03838116600081815260016020526040808220805473ffffffffffffffffffffffffffffffffffffffff19169585169590951790945592519184169290917f605c2dbf762e5f7d60a546d42e7205dcb1b011ebc62a61736a57c9089d3a43509190a35050565b600082826040516020018083838082843780830192505050925050506040516020818303038152906040528051906020012090505b92915050565b6106f882826107ef565b610703576000610705565b815b600160a060020a03928316600081815260208181526040808320600160e060020a031996909616808452958252808320805473ffffffffffffffffffffffffffffffffffffffff19169590971694909417909555908152600284528181209281529190925220805460ff19166001179055565b600080600160a060020a038416156107905783610792565b335b905061079d8361092a565b156107c357826107ad82826108aa565b6107b85760006107ba565b815b925050506106e8565b600160a060020a0390811660009081526020818152604080832086845290915290205416905092915050565b6000808061081d857f01ffc9a70000000000000000000000000000000000000000000000000000000061094c565b909250905081158061082d575080155b1561083d576000925050506106e8565b61084f85600160e060020a031961094c565b909250905081158061086057508015155b15610870576000925050506106e8565b61087a858561094c565b909250905060018214801561088f5750806001145b1561089f576001925050506106e8565b506000949350505050565b600160a060020a0382166000908152600260209081526040808320600160e060020a03198516845290915281205460ff1615156108f2576108eb83836107ef565b90506106e8565b50600160a060020a03808316600081815260208181526040808320600160e060020a0319871684529091529020549091161492915050565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff161590565b6040517f01ffc9a7000000000000000000000000000000000000000000000000000000008082526004820183905260009182919060208160248189617530fa90519096909550935050505056fea165627a7a72305820377f4a2d4301ede9949f163f319021a6e9c687c292a5e2b2c4734c126b524e6c00291ba01820182018201820182018201820182018201820182018201820182018201820a01820182018201820182018201820182018201820182018201820182018201820&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The strings of &lt;code&gt;1820&lt;&#x2F;code&gt;&#x27;s at the end of the transaction are the &lt;code&gt;r&lt;&#x2F;code&gt; and &lt;code&gt;s&lt;&#x2F;code&gt; of the signature.
From this deterministic pattern (generated by a human), anyone can deduce that no one knows the private key for the deployment account.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;deployment-method&quot;&gt;Deployment Method&lt;&#x2F;h3&gt;
&lt;p&gt;This contract is going to be deployed using the keyless deployment method---also known as &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;Arachnid&#x2F;&quot;&gt;Nick&lt;&#x2F;a&gt;&#x27;s method---which relies on a single-use address.
(See &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;medium.com&#x2F;@weka&#x2F;how-to-send-ether-to-11-440-people-187e332566b7&quot;&gt;Nick&#x27;s article&lt;&#x2F;a&gt; for more details). This method works as follows:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Generate a transaction which deploys the contract from a new random account.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;ul&gt;
&lt;li&gt;This transaction MUST NOT use &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt; in order to work on any chain.&lt;&#x2F;li&gt;
&lt;li&gt;This transaction MUST have a relatively high gas price to be deployed on any chain. In this case, it is going to be 100 Gwei.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;ol start=&quot;2&quot;&gt;
&lt;li&gt;
&lt;p&gt;Set the &lt;code&gt;v&lt;&#x2F;code&gt;, &lt;code&gt;r&lt;&#x2F;code&gt;, &lt;code&gt;s&lt;&#x2F;code&gt; of the transaction signature to the following values:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;v: 27,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;r: 0x1820182018201820182018201820182018201820182018201820182018201820&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;s: 0x1820182018201820182018201820182018201820182018201820182018201820&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Those &lt;code&gt;r&lt;&#x2F;code&gt; and &lt;code&gt;s&lt;&#x2F;code&gt; values---made of a repeating pattern of &lt;code&gt;1820&lt;&#x2F;code&gt;&#x27;s---are predictable &quot;random numbers&quot; generated deterministically by a human.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;We recover the sender of this transaction, i.e., the single-use deployment account.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Thus we obtain an account that can broadcast that transaction, but we also have the warranty that nobody knows the private key of that account.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Send exactly 0.08 ether to this single-use deployment account.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Broadcast the deployment transaction.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;This operation can be done on any chain, guaranteeing that the contract address is always the same and nobody can use that address with a different contract.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;single-use-registry-deployment-account&quot;&gt;Single-use Registry Deployment Account&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xa990077c3205cbDf861e17Fa532eeB069cE9fF96&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This account is generated by reverse engineering it from its signature for the transaction.
This way no one knows the private key, but it is known that it is the valid signer of the deployment transaction.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;To deploy the registry, 0.08 ether MUST be sent to this account &lt;em&gt;first&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h3 id=&quot;registry-contract-address&quot;&gt;Registry Contract Address&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The contract has the address above for every chain on which it is deployed.&lt;&#x2F;p&gt;
&lt;details&gt;
&lt;summary&gt;Raw metadata of &lt;code&gt;.&#x2F;contracts&#x2F;ERC1820Registry.sol&lt;&#x2F;code&gt;&lt;&#x2F;summary&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;compiler&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0.5.3+commit.10d17f24&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;language&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;output&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_interfaceHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_implementer&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;setInterfaceImplementer&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;outputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;stateMutability&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;nonpayable&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;getManager&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;outputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;stateMutability&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;view&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_newManager&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;setManager&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;outputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;stateMutability&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;nonpayable&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_interfaceName&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;interfaceHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;outputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;stateMutability&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_interfaceId&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;updateERC165Cache&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;outputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;stateMutability&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;nonpayable&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_interfaceHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;getInterfaceImplementer&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;outputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;stateMutability&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;view&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_interfaceId&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;implementsERC165InterfaceNoCache&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;outputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;stateMutability&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;view&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_interfaceId&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;implementsERC165Interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;outputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;stateMutability&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;view&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;anonymous&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;interfaceHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;implementer&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;InterfaceImplementerSet&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;anonymous&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;newManager&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ManagerChanged&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;devdoc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;author&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Jordi Baylina and Jacques Dafflon&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;methods&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;getInterfaceImplementer(address,bytes32)&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;_addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Address being queried for the implementer of an interface. (If &amp;#39;_addr&amp;#39; is the zero address then &amp;#39;msg.sender&amp;#39; is assumed.)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;_interfaceHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Keccak256 hash of the name of the interface as a string. E.g., &amp;#39;web3.utils.keccak256(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ERC777TokensRecipient&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;)&amp;#39; for the &amp;#39;ERC777TokensRecipient&amp;#39; interface.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The address of the contract which implements the interface &amp;#39;_interfaceHash&amp;#39; for &amp;#39;_addr&amp;#39; or &amp;#39;0&amp;#39; if &amp;#39;_addr&amp;#39; did not register an implementer for this interface.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;getManager(address)&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;_addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Address for which to return the manager.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Address of the manager for a given address.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;implementsERC165Interface(address,bytes4)&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;_contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Address of the contract to check.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;_interfaceId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ERC165 interface to check.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;True if &amp;#39;_contract&amp;#39; implements &amp;#39;_interfaceId&amp;#39;, false otherwise.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;implementsERC165InterfaceNoCache(address,bytes4)&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;_contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Address of the contract to check.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;_interfaceId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ERC165 interface to check.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;True if &amp;#39;_contract&amp;#39; implements &amp;#39;_interfaceId&amp;#39;, false otherwise.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;interfaceHash(string)&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;_interfaceName&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Name of the interface.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The keccak256 hash of an interface name.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;setInterfaceImplementer(address,bytes32,address)&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;_addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Address for which to set the interface. (If &amp;#39;_addr&amp;#39; is the zero address then &amp;#39;msg.sender&amp;#39; is assumed.)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;_implementer&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Contract address implementing &amp;#39;_interfaceHash&amp;#39; for &amp;#39;_addr&amp;#39;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;_interfaceHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Keccak256 hash of the name of the interface as a string. E.g., &amp;#39;web3.utils.keccak256(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ERC777TokensRecipient&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;)&amp;#39; for the &amp;#39;ERC777TokensRecipient&amp;#39; interface.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;setManager(address,address)&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;_addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Address for which to set the new manager.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;_newManager&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Address of the new manager for &amp;#39;addr&amp;#39;. (Pass &amp;#39;0x0&amp;#39; to reset the manager to &amp;#39;_addr&amp;#39;.)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;updateERC165Cache(address,bytes4)&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;_contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Address of the contract for which to update the cache.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;_interfaceId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ERC165 interface for which to update the cache.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ERC1820 Pseudo-introspection Registry Contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;userdoc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;methods&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;getInterfaceImplementer(address,bytes32)&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Query if an address implements an interface and through which contract.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;getManager(address)&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Get the manager of an address.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;implementsERC165InterfaceNoCache(address,bytes4)&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Checks whether a contract implements an ERC165 interface or not without using nor updating the cache.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;interfaceHash(string)&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Compute the keccak256 hash of an interface given its name.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;setInterfaceImplementer(address,bytes32,address)&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Sets the contract which implements a specific interface for an address. Only the manager defined for that address can set it. (Each address is the manager for itself until it sets a new manager.)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;setManager(address,address)&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Sets &amp;#39;_newManager&amp;#39; as manager for &amp;#39;_addr&amp;#39;. The new manager will be able to call &amp;#39;setInterfaceImplementer&amp;#39; for &amp;#39;_addr&amp;#39;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;              &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;updateERC165Cache(address,bytes4)&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Updates the cache with whether the contract implements an ERC165 interface or not.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;This contract is the official implementation of the ERC1820 Registry.For more details, see https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-1820&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;settings&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;compilationTarget&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;.&#x2F;contracts&#x2F;ERC1820Registry.sol&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ERC1820Registry&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;evmVersion&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;byzantium&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;libraries&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;optimizer&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;enabled&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;runs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 200&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;remappings&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;sources&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;.&#x2F;contracts&#x2F;ERC1820Registry.sol&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;content&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&#x2F;* ERC1820 Pseudo-introspection Registry Contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; * This standard defines a universal registry smart contract where any address (contract or regular account) can&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; * register which interface it supports and which smart contract is responsible for its implementation.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; * Written in 2019 by Jordi Baylina and Jacques Dafflon&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; * To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; * this software to the public domain worldwide. This software is distributed without any warranty.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; * You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; * &amp;lt;http:&#x2F;&#x2F;creativecommons.org&#x2F;publicdomain&#x2F;zero&#x2F;1.0&#x2F;&amp;gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; *    ███████╗██████╗  ██████╗ ██╗ █████╗ ██████╗  ██████╗&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; *    ██╔════╝██╔══██╗██╔════╝███║██╔══██╗╚════██╗██╔═████╗&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; *    █████╗  ██████╔╝██║     ╚██║╚█████╔╝ █████╔╝██║██╔██║&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; *    ██╔══╝  ██╔══██╗██║      ██║██╔══██╗██╔═══╝ ████╔╝██║&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; *    ███████╗██║  ██║╚██████╗ ██║╚█████╔╝███████╗╚██████╔╝&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; *    ╚══════╝╚═╝  ╚═╝ ╚═════╝ ╚═╝ ╚════╝ ╚══════╝ ╚═════╝&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; *    ██████╗ ███████╗ ██████╗ ██╗███████╗████████╗██████╗ ██╗   ██╗&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; *    ██╔══██╗██╔════╝██╔════╝ ██║██╔════╝╚══██╔══╝██╔══██╗╚██╗ ██╔╝&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; *    ██████╔╝█████╗  ██║  ███╗██║███████╗   ██║   ██████╔╝ ╚████╔╝&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; *    ██╔══██╗██╔══╝  ██║   ██║██║╚════██║   ██║   ██╔══██╗  ╚██╔╝&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; *    ██║  ██║███████╗╚██████╔╝██║███████║   ██║   ██║  ██║   ██║&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; *    ╚═╝  ╚═╝╚══════╝ ╚═════╝ ╚═╝╚══════╝   ╚═╝   ╚═╝  ╚═╝   ╚═╝&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;pragma solidity 0.5.3;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&#x2F;&#x2F; IV is value needed to have a vanity address starting with &amp;#39;0x1820&amp;#39;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&#x2F;&#x2F; IV: 53759&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&#x2F;&#x2F;&#x2F; @dev The interface a contract MUST implement if it is the implementer of&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&#x2F;&#x2F;&#x2F; some (other) interface for any address other than itself.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;interface ERC1820ImplementerInterface {&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @notice Indicates whether the contract implements the interface &amp;#39;interfaceHash&amp;#39; for the address &amp;#39;addr&amp;#39; or not.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @param interfaceHash keccak256 hash of the name of the interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @param addr Address for which the contract will implement the interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @return ERC1820_ACCEPT_MAGIC only if the contract implements &amp;#39;interfaceHash&amp;#39; for the address &amp;#39;addr&amp;#39;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    function canImplementInterfaceForAddress(bytes32 interfaceHash, address addr) external view returns(bytes32);&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&#x2F;&#x2F;&#x2F; @title ERC1820 Pseudo-introspection Registry Contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&#x2F;&#x2F;&#x2F; @author Jordi Baylina and Jacques Dafflon&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&#x2F;&#x2F;&#x2F; @notice This contract is the official implementation of the ERC1820 Registry.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&#x2F;&#x2F;&#x2F; @notice For more details, see https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-1820&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;contract ERC1820Registry {&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @notice ERC165 Invalid ID.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    bytes4 constant internal INVALID_ID = 0xffffffff;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @notice Method ID for the ERC165 supportsInterface method (= `bytes4(keccak256(&amp;#39;supportsInterface(bytes4)&amp;#39;))`).&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    bytes4 constant internal ERC165ID = 0x01ffc9a7;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @notice Magic value which is returned if a contract implements an interface on behalf of some other address.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    bytes32 constant internal ERC1820_ACCEPT_MAGIC = keccak256(abi.encodePacked(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ERC1820_ACCEPT_MAGIC&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;));&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @notice mapping from addresses and interface hashes to their implementers.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    mapping(address =&amp;gt; mapping(bytes32 =&amp;gt; address)) internal interfaces;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @notice mapping from addresses to their manager.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    mapping(address =&amp;gt; address) internal managers;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @notice flag for each address and erc165 interface to indicate if it is cached.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    mapping(address =&amp;gt; mapping(bytes4 =&amp;gt; bool)) internal erc165Cached;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @notice Indicates a contract is the &amp;#39;implementer&amp;#39; of &amp;#39;interfaceHash&amp;#39; for &amp;#39;addr&amp;#39;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    event InterfaceImplementerSet(address indexed addr, bytes32 indexed interfaceHash, address indexed implementer);&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @notice Indicates &amp;#39;newManager&amp;#39; is the address of the new manager for &amp;#39;addr&amp;#39;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    event ManagerChanged(address indexed addr, address indexed newManager);&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @notice Query if an address implements an interface and through which contract.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @param _addr Address being queried for the implementer of an interface.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; (If &amp;#39;_addr&amp;#39; is the zero address then &amp;#39;msg.sender&amp;#39; is assumed.)&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @param _interfaceHash Keccak256 hash of the name of the interface as a string.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; E.g., &amp;#39;web3.utils.keccak256(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ERC777TokensRecipient&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;)&amp;#39; for the &amp;#39;ERC777TokensRecipient&amp;#39; interface.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @return The address of the contract which implements the interface &amp;#39;_interfaceHash&amp;#39; for &amp;#39;_addr&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; or &amp;#39;0&amp;#39; if &amp;#39;_addr&amp;#39; did not register an implementer for this interface.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    function getInterfaceImplementer(address _addr, bytes32 _interfaceHash) external view returns (address) {&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        address addr = _addr == address(0) ? msg.sender : _addr;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        if (isERC165Interface(_interfaceHash)) {&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;            bytes4 erc165InterfaceHash = bytes4(_interfaceHash);&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;            return implementsERC165Interface(addr, erc165InterfaceHash) ? addr : address(0);&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        return interfaces[addr][_interfaceHash];&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    }&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @notice Sets the contract which implements a specific interface for an address.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; Only the manager defined for that address can set it.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; (Each address is the manager for itself until it sets a new manager.)&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @param _addr Address for which to set the interface.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; (If &amp;#39;_addr&amp;#39; is the zero address then &amp;#39;msg.sender&amp;#39; is assumed.)&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @param _interfaceHash Keccak256 hash of the name of the interface as a string.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; E.g., &amp;#39;web3.utils.keccak256(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ERC777TokensRecipient&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;)&amp;#39; for the &amp;#39;ERC777TokensRecipient&amp;#39; interface.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @param _implementer Contract address implementing &amp;#39;_interfaceHash&amp;#39; for &amp;#39;_addr&amp;#39;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    function setInterfaceImplementer(address _addr, bytes32 _interfaceHash, address _implementer) external {&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        address addr = _addr == address(0) ? msg.sender : _addr;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        require(getManager(addr) == msg.sender, &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Not the manager&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;);&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        require(!isERC165Interface(_interfaceHash), &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Must not be an ERC165 hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;);&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        if (_implementer != address(0) &amp;amp;&amp;amp; _implementer != msg.sender) {&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;            require(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;                ERC1820ImplementerInterface(_implementer)&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;                    .canImplementInterfaceForAddress(_interfaceHash, addr) == ERC1820_ACCEPT_MAGIC,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;                \&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Does not implement the interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;            );&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        interfaces[addr][_interfaceHash] = _implementer;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        emit InterfaceImplementerSet(addr, _interfaceHash, _implementer);&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    }&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @notice Sets &amp;#39;_newManager&amp;#39; as manager for &amp;#39;_addr&amp;#39;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; The new manager will be able to call &amp;#39;setInterfaceImplementer&amp;#39; for &amp;#39;_addr&amp;#39;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @param _addr Address for which to set the new manager.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @param _newManager Address of the new manager for &amp;#39;addr&amp;#39;. (Pass &amp;#39;0x0&amp;#39; to reset the manager to &amp;#39;_addr&amp;#39;.)&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    function setManager(address _addr, address _newManager) external {&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        require(getManager(_addr) == msg.sender, &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Not the manager&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;);&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        managers[_addr] = _newManager == _addr ? address(0) : _newManager;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        emit ManagerChanged(_addr, _newManager);&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    }&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @notice Get the manager of an address.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @param _addr Address for which to return the manager.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @return Address of the manager for a given address.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    function getManager(address _addr) public view returns(address) {&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        &#x2F;&#x2F; By default the manager of an address is the same address&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        if (managers[_addr] == address(0)) {&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;            return _addr;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        } else {&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;            return managers[_addr];&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    }&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @notice Compute the keccak256 hash of an interface given its name.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @param _interfaceName Name of the interface.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @return The keccak256 hash of an interface name.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    function interfaceHash(string calldata _interfaceName) external pure returns(bytes32) {&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        return keccak256(abi.encodePacked(_interfaceName));&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    }&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;* --- ERC165 Related Functions --- *&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;* --- Developed in collaboration with William Entriken. --- *&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @notice Updates the cache with whether the contract implements an ERC165 interface or not.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @param _contract Address of the contract for which to update the cache.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @param _interfaceId ERC165 interface for which to update the cache.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    function updateERC165Cache(address _contract, bytes4 _interfaceId) external {&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        interfaces[_contract][_interfaceId] = implementsERC165InterfaceNoCache(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;            _contract, _interfaceId) ? _contract : address(0);&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        erc165Cached[_contract][_interfaceId] = true;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    }&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @notice Checks whether a contract implements an ERC165 interface or not.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;  If the result is not cached a direct lookup on the contract address is performed.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;  If the result is not cached or the cached value is out-of-date, the cache MUST be updated manually by calling&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;  &amp;#39;updateERC165Cache&amp;#39; with the contract address.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @param _contract Address of the contract to check.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @param _interfaceId ERC165 interface to check.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @return True if &amp;#39;_contract&amp;#39; implements &amp;#39;_interfaceId&amp;#39;, false otherwise.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    function implementsERC165Interface(address _contract, bytes4 _interfaceId) public view returns (bool) {&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        if (!erc165Cached[_contract][_interfaceId]) {&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;            return implementsERC165InterfaceNoCache(_contract, _interfaceId);&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        return interfaces[_contract][_interfaceId] == _contract;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    }&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @notice Checks whether a contract implements an ERC165 interface or not without using nor updating the cache.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @param _contract Address of the contract to check.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @param _interfaceId ERC165 interface to check.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @return True if &amp;#39;_contract&amp;#39; implements &amp;#39;_interfaceId&amp;#39;, false otherwise.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    function implementsERC165InterfaceNoCache(address _contract, bytes4 _interfaceId) public view returns (bool) {&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        uint256 success;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        uint256 result;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        (success, result) = noThrowCall(_contract, ERC165ID);&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        if (success == 0 || result == 0) {&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;            return false;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        (success, result) = noThrowCall(_contract, INVALID_ID);&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        if (success == 0 || result != 0) {&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;            return false;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        (success, result) = noThrowCall(_contract, _interfaceId);&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        if (success == 1 &amp;amp;&amp;amp; result == 1) {&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;            return true;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        return false;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    }&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @notice Checks whether the hash is a ERC165 interface (ending with 28 zeroes) or not.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @param _interfaceHash The hash to check.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @return True if &amp;#39;_interfaceHash&amp;#39; is an ERC165 interface (ending with 28 zeroes), false otherwise.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    function isERC165Interface(bytes32 _interfaceHash) internal pure returns (bool) {&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        return _interfaceHash &amp;amp; 0x00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF == 0;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    }&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @dev Make a call on a contract without throwing if the function does not exist.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    function noThrowCall(address _contract, bytes4 _interfaceId)&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        internal view returns (uint256 success, uint256 result)&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        bytes4 erc165ID = ERC165ID;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        assembly {&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;            let x := mload(0x40)               &#x2F;&#x2F; Find empty storage location using &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;free memory pointer&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;            mstore(x, erc165ID)                &#x2F;&#x2F; Place signature at beginning of empty storage&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;            mstore(add(x, 0x04), _interfaceId) &#x2F;&#x2F; Place first argument directly next to signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;            success := staticcall(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;                30000,                         &#x2F;&#x2F; 30k gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;                _contract,                     &#x2F;&#x2F; To addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;                x,                             &#x2F;&#x2F; Inputs are stored at location x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;                0x24,                          &#x2F;&#x2F; Inputs are 36 (4 + 32) bytes long&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;                x,                             &#x2F;&#x2F; Store output over input (saves space)&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;                0x20                           &#x2F;&#x2F; Outputs are 32 bytes long&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;            )&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;            result := mload(x)                 &#x2F;&#x2F; Load the result&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    }&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x64025ecebddb6e126a5075c1fd6c01de2840492668e2909cef7157040a9d1945&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;details&gt;
&lt;h3 id=&quot;interface-name&quot;&gt;Interface Name&lt;&#x2F;h3&gt;
&lt;p&gt;Any interface name is hashed using &lt;code&gt;keccak256&lt;&#x2F;code&gt; and sent to &lt;code&gt;getInterfaceImplementer()&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;If the interface is part of a standard, it is best practice to explicitly state the interface name and link to this published &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1820&#x2F;&quot;&gt;ERC-1820&lt;&#x2F;a&gt; such that other people don&#x27;t have to come here to look up these rules.&lt;&#x2F;p&gt;
&lt;p&gt;For convenience, the registry provides a function to compute the hash on-chain:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; interfaceHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _interfaceName&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Compute the keccak256 hash of an interface given its name.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;small&gt;&lt;strong&gt;identifier:&lt;&#x2F;strong&gt; &lt;code&gt;65ba36c1&lt;&#x2F;code&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;strong&gt;parameters&lt;&#x2F;strong&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;_interfaceName&lt;&#x2F;code&gt;: Name of the interface.&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;strong&gt;returns:&lt;&#x2F;strong&gt; The &lt;code&gt;keccak256&lt;&#x2F;code&gt; hash of an interface name.&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h4 id=&quot;approved-ercs&quot;&gt;&lt;strong&gt;Approved ERCs&lt;&#x2F;strong&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;If the interface is part of an approved ERC, it MUST be named &lt;code&gt;ERC###XXXXX&lt;&#x2F;code&gt; where &lt;code&gt;###&lt;&#x2F;code&gt; is the number of the ERC and XXXXX should be the name of the interface in CamelCase.
The meaning of this interface SHOULD be defined in the specified ERC.&lt;&#x2F;p&gt;
&lt;p&gt;Examples:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;keccak256(&quot;ERC20Token&quot;)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;keccak256(&quot;ERC777Token&quot;)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;keccak256(&quot;ERC777TokensSender&quot;)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;keccak256(&quot;ERC777TokensRecipient&quot;)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;erc-165-compatible-interfaces&quot;&gt;&lt;strong&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; Compatible Interfaces&lt;&#x2F;strong&gt;&lt;&#x2F;h4&gt;
&lt;blockquote&gt;
&lt;p&gt;The compatibility with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt;, including the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1820&#x2F;#erc165-cache&quot;&gt;ERC165 Cache&lt;&#x2F;a&gt;, has been designed and developed with &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;fulldecent&quot;&gt;William Entriken&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;Any interface where the last 28 bytes are zeroes (&lt;code&gt;0&lt;&#x2F;code&gt;) SHALL be considered an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; interface.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; Lookup&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Anyone can explicitly check if a contract implements an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; interface using the registry by calling one of the two functions below:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; implementsERC165Interface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Checks whether a contract implements an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; interface or not.&lt;&#x2F;p&gt;
&lt;p&gt;If the result is not cached a direct lookup on the contract address is performed.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;NOTE&lt;&#x2F;em&gt;: If the result is not cached or the cached value is out-of-date, the cache MUST be updated manually by calling &lt;code&gt;updateERC165Cache&lt;&#x2F;code&gt; with the contract address.
(See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1820&#x2F;#erc165-cache&quot;&gt;ERC165 Cache&lt;&#x2F;a&gt; for more details.)&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;small&gt;&lt;strong&gt;identifier:&lt;&#x2F;strong&gt; &lt;code&gt;f712f3e8&lt;&#x2F;code&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;strong&gt;parameters&lt;&#x2F;strong&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;_contract&lt;&#x2F;code&gt;: Address of the contract to check.&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;_interfaceId&lt;&#x2F;code&gt;: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; interface to check.&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;strong&gt;returns:&lt;&#x2F;strong&gt; &lt;code&gt;true&lt;&#x2F;code&gt; if &lt;code&gt;_contract&lt;&#x2F;code&gt; implements &lt;code&gt;_interfaceId&lt;&#x2F;code&gt;, &lt;code&gt;false&lt;&#x2F;code&gt; otherwise.&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; implementsERC165InterfaceNoCache&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Checks whether a contract implements an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; interface or not without using nor updating the cache.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;small&gt;&lt;strong&gt;identifier:&lt;&#x2F;strong&gt; &lt;code&gt;b7056765&lt;&#x2F;code&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;strong&gt;parameters&lt;&#x2F;strong&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;_contract&lt;&#x2F;code&gt;: Address of the contract to check.&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;_interfaceId&lt;&#x2F;code&gt;: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; interface to check.&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;strong&gt;returns:&lt;&#x2F;strong&gt; &lt;code&gt;true&lt;&#x2F;code&gt; if &lt;code&gt;_contract&lt;&#x2F;code&gt; implements &lt;code&gt;_interfaceId&lt;&#x2F;code&gt;, false otherwise.&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; Cache&lt;&#x2F;strong&gt; &lt;a id=&quot;erc165-cache&quot;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Whether a contract implements an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; interface or not can be cached manually to save gas.&lt;&#x2F;p&gt;
&lt;p&gt;If a contract dynamically changes its interface and relies on the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; cache of the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1820&#x2F;&quot;&gt;ERC-1820&lt;&#x2F;a&gt; registry, the cache MUST be updated manually---there is no automatic cache invalidation or cache update.
Ideally the contract SHOULD automatically update the cache when changing its interface.
However anyone MAY update the cache on the contract&#x27;s behalf.&lt;&#x2F;p&gt;
&lt;p&gt;The cache update MUST be done using the &lt;code&gt;updateERC165Cache&lt;&#x2F;code&gt; function:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; updateERC165Cache&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;small&gt;&lt;strong&gt;identifier:&lt;&#x2F;strong&gt; &lt;code&gt;a41e7d51&lt;&#x2F;code&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;strong&gt;parameters&lt;&#x2F;strong&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;_contract&lt;&#x2F;code&gt;: Address of the contract for which to update the cache.&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;_interfaceId&lt;&#x2F;code&gt;: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; interface for which to update the cache.&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h4 id=&quot;private-user-defined-interfaces&quot;&gt;&lt;strong&gt;Private User-defined Interfaces&lt;&#x2F;strong&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;This scheme is extensible.
You MAY make up your own interface name and raise awareness to get other people to implement it and then check for those implementations.
Have fun but please, you MUST not conflict with the reserved designations above.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;set-an-interface-for-an-address&quot;&gt;Set An Interface For An Address&lt;&#x2F;h3&gt;
&lt;p&gt;For any address to set a contract as the interface implementation, it must call the following function of the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1820&#x2F;&quot;&gt;ERC-1820&lt;&#x2F;a&gt; registry:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setInterfaceImplementer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _addr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _interfaceHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _implementer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Sets the contract which implements a specific interface for an address.&lt;&#x2F;p&gt;
&lt;p&gt;Only the &lt;code&gt;manager&lt;&#x2F;code&gt; defined for that address can set it.
(Each address is the manager for itself, see the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1820&#x2F;#manager&quot;&gt;manager&lt;&#x2F;a&gt; section for more details.)&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;NOTE&lt;&#x2F;em&gt;: If  &lt;code&gt;_addr&lt;&#x2F;code&gt; and &lt;code&gt;_implementer&lt;&#x2F;code&gt; are two different addresses, then:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;_implementer&lt;&#x2F;code&gt; MUST implement the &lt;code&gt;ERC1820ImplementerInterface&lt;&#x2F;code&gt; (detailed below).&lt;&#x2F;li&gt;
&lt;li&gt;Calling &lt;code&gt;canImplementInterfaceForAddress&lt;&#x2F;code&gt; on &lt;code&gt;_implementer&lt;&#x2F;code&gt; with the given &lt;code&gt;_addr&lt;&#x2F;code&gt; and  &lt;code&gt;_interfaceHash&lt;&#x2F;code&gt; MUST return the &lt;code&gt;ERC1820_ACCEPT_MAGIC&lt;&#x2F;code&gt; value.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;NOTE&lt;&#x2F;em&gt;: The &lt;code&gt;_interfaceHash&lt;&#x2F;code&gt; MUST NOT be an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; interface---it MUST NOT end with 28 zeroes (&lt;code&gt;0&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;NOTE&lt;&#x2F;em&gt;: The &lt;code&gt;_addr&lt;&#x2F;code&gt; MAY be &lt;code&gt;0&lt;&#x2F;code&gt;, then &lt;code&gt;msg.sender&lt;&#x2F;code&gt; is assumed.
This default value simplifies interactions via multisigs where the data of the transaction to sign is constant regardless of the address of the multisig instance.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;small&gt;&lt;strong&gt;identifier:&lt;&#x2F;strong&gt; &lt;code&gt;29965a1d&lt;&#x2F;code&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;strong&gt;parameters&lt;&#x2F;strong&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;_addr&lt;&#x2F;code&gt;: Address for which to set the interface. (If &lt;code&gt;_addr&lt;&#x2F;code&gt; is the zero address then &lt;code&gt;msg.sender&lt;&#x2F;code&gt; is assumed.)&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;_interfaceHash&lt;&#x2F;code&gt;: Keccak256 hash of the name of the interface as a string, for example &lt;code&gt;web3.utils.keccak256(&#x27;ERC777TokensRecipient&#x27;)&lt;&#x2F;code&gt; for the ERC777TokensRecipient interface.&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;_implementer&lt;&#x2F;code&gt;: Contract implementing &lt;code&gt;_interfaceHash&lt;&#x2F;code&gt; for &lt;code&gt;_addr&lt;&#x2F;code&gt;.&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h3 id=&quot;get-an-implementation-of-an-interface-for-an-address&quot;&gt;Get An Implementation Of An Interface For An Address&lt;&#x2F;h3&gt;
&lt;p&gt;Anyone MAY query the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1820&#x2F;&quot;&gt;ERC-1820&lt;&#x2F;a&gt; Registry to obtain the address of a contract implementing an interface on behalf of some address using the &lt;code&gt;getInterfaceImplementer&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getInterfaceImplementer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _addr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _interfaceHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Query if an address implements an interface and through which contract.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;NOTE&lt;&#x2F;em&gt;: If the last 28 bytes of the &lt;code&gt;_interfaceHash&lt;&#x2F;code&gt; are zeroes (&lt;code&gt;0&lt;&#x2F;code&gt;), then the first 4 bytes are considered an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; interface and the registry SHALL forward the call to the contract at &lt;code&gt;_addr&lt;&#x2F;code&gt; to see if it implements the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; interface (the first 4 bytes of &lt;code&gt;_interfaceHash&lt;&#x2F;code&gt;).
The registry SHALL also cache &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; queries to reduce gas consumption. Anyone MAY call the &lt;code&gt;erc165UpdateCache&lt;&#x2F;code&gt; function to update whether a contract implements an interface or not.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;NOTE&lt;&#x2F;em&gt;: The &lt;code&gt;_addr&lt;&#x2F;code&gt; MAY be &lt;code&gt;0&lt;&#x2F;code&gt;, then &lt;code&gt;msg.sender&lt;&#x2F;code&gt; is assumed.
This default value is consistent with the behavior of the &lt;code&gt;setInterfaceImplementer&lt;&#x2F;code&gt; function and simplifies interactions via multisigs where the data of the transaction to sign is constant regardless of the address of the multisig instance.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;small&gt;&lt;strong&gt;identifier:&lt;&#x2F;strong&gt; &lt;code&gt;aabbb8ca&lt;&#x2F;code&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;strong&gt;parameters&lt;&#x2F;strong&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;_addr&lt;&#x2F;code&gt;: Address being queried for the implementer of an interface. (If &lt;code&gt;_addr&lt;&#x2F;code&gt; is the zero address then &lt;code&gt;msg.sender&lt;&#x2F;code&gt; is assumed.)&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;_interfaceHash&lt;&#x2F;code&gt;: keccak256 hash of the name of the interface as a string. E.g. &lt;code&gt;web3.utils.keccak256(&#x27;ERC777Token&#x27;)&lt;&#x2F;code&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;strong&gt;returns:&lt;&#x2F;strong&gt; The address of the contract which implements the interface &lt;code&gt;_interfaceHash&lt;&#x2F;code&gt; for &lt;code&gt;_addr&lt;&#x2F;code&gt; or &lt;code&gt;0&lt;&#x2F;code&gt; if &lt;code&gt;_addr&lt;&#x2F;code&gt; did not register an implementer for this interface.&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h3 id=&quot;interface-implementation-erc1820implementerinterface&quot;&gt;Interface Implementation (&lt;code&gt;ERC1820ImplementerInterface&lt;&#x2F;code&gt;)&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC1820ImplementerInterface&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Indicates whether the contract implements the interface `interfaceHash` for the address `addr` or not.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; interfaceHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; keccak256 hash of the name of the interface&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address for which the contract will implement the interface&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ERC1820_ACCEPT_MAGIC&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; only if the contract implements `interfaceHash` for the address `addr`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; canImplementInterfaceForAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Any contract being registered as the implementation of an interface for a given address MUST implement said interface.
In addition if it implements an interface on behalf of a different address, the contract MUST implement the &lt;code&gt;ERC1820ImplementerInterface&lt;&#x2F;code&gt; shown above.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; canImplementInterfaceForAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Indicates whether a contract implements an interface (&lt;code&gt;interfaceHash&lt;&#x2F;code&gt;) for a given address (&lt;code&gt;addr&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;If a contract implements the interface (&lt;code&gt;interfaceHash&lt;&#x2F;code&gt;) for a given address (&lt;code&gt;addr&lt;&#x2F;code&gt;), it MUST return &lt;code&gt;ERC1820_ACCEPT_MAGIC&lt;&#x2F;code&gt; when called with the &lt;code&gt;addr&lt;&#x2F;code&gt; and the &lt;code&gt;interfaceHash&lt;&#x2F;code&gt;.
If it does not implement the &lt;code&gt;interfaceHash&lt;&#x2F;code&gt; for a given address (&lt;code&gt;addr&lt;&#x2F;code&gt;), it MUST NOT return &lt;code&gt;ERC1820_ACCEPT_MAGIC&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;small&gt;&lt;strong&gt;identifier:&lt;&#x2F;strong&gt; &lt;code&gt;f0083250&lt;&#x2F;code&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;strong&gt;parameters&lt;&#x2F;strong&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;interfaceHash&lt;&#x2F;code&gt;: Hash of the interface which is implemented&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;addr&lt;&#x2F;code&gt;: Address for which the interface is implemented&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;strong&gt;returns:&lt;&#x2F;strong&gt; &lt;code&gt;ERC1820_ACCEPT_MAGIC&lt;&#x2F;code&gt; only if the contract implements &lt;code&gt;ìnterfaceHash&lt;&#x2F;code&gt; for the address &lt;code&gt;addr&lt;&#x2F;code&gt;.&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;The special value &lt;code&gt;ERC1820_ACCEPT_MAGIC&lt;&#x2F;code&gt; is defined as the &lt;code&gt;keccka256&lt;&#x2F;code&gt; hash of the string &lt;code&gt;&quot;ERC1820_ACCEPT_MAGIC&quot;&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; ERC1820_ACCEPT_MAGIC &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;ERC1820_ACCEPT_MAGIC&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;blockquote&gt;
&lt;p&gt;The reason to return &lt;code&gt;ERC1820_ACCEPT_MAGIC&lt;&#x2F;code&gt; instead of a boolean is to prevent cases where a contract fails to implement the &lt;code&gt;canImplementInterfaceForAddress&lt;&#x2F;code&gt; but implements a fallback function which does not throw. In this case, since &lt;code&gt;canImplementInterfaceForAddress&lt;&#x2F;code&gt; does not exist, the fallback function is called instead, executed without throwing and returns &lt;code&gt;1&lt;&#x2F;code&gt;. Thus making it appear as if &lt;code&gt;canImplementInterfaceForAddress&lt;&#x2F;code&gt; returned &lt;code&gt;true&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h3 id=&quot;manager&quot;&gt;Manager&lt;&#x2F;h3&gt;
&lt;p&gt;The manager of an address (regular account or a contract) is the only entity allowed to register implementations of interfaces for the address.
By default, any address is its own manager.&lt;&#x2F;p&gt;
&lt;p&gt;The manager can transfer its role to another address by calling &lt;code&gt;setManager&lt;&#x2F;code&gt; on the registry contract with the address for which to transfer the manager and the address of the new manager.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;setManager&lt;&#x2F;code&gt; Function&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setManager&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _addr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _newManager&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Sets &lt;code&gt;_newManager&lt;&#x2F;code&gt; as manager for &lt;code&gt;_addr&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The new manager will be able to call &lt;code&gt;setInterfaceImplementer&lt;&#x2F;code&gt; for &lt;code&gt;_addr&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;If &lt;code&gt;_newManager&lt;&#x2F;code&gt; is &lt;code&gt;0x0&lt;&#x2F;code&gt;, the manager is reset to &lt;code&gt;_addr&lt;&#x2F;code&gt; itself as the manager.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;small&gt;&lt;strong&gt;identifier:&lt;&#x2F;strong&gt; &lt;code&gt;5df8122f&lt;&#x2F;code&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;strong&gt;parameters&lt;&#x2F;strong&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;_addr&lt;&#x2F;code&gt;: Address for which to set the new manager.&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;_newManager&lt;&#x2F;code&gt;: The address of the new manager for &lt;code&gt;_addr&lt;&#x2F;code&gt;. (Pass &lt;code&gt;0x0&lt;&#x2F;code&gt; to reset the manager to &lt;code&gt;_addr&lt;&#x2F;code&gt;.)&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;getManager&lt;&#x2F;code&gt; Function&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getManager&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Get the manager of an address.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;small&gt;&lt;strong&gt;identifier:&lt;&#x2F;strong&gt; &lt;code&gt;3d584063&lt;&#x2F;code&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;strong&gt;parameters&lt;&#x2F;strong&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;_addr&lt;&#x2F;code&gt;: Address for which to return the manager.&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;strong&gt;returns:&lt;&#x2F;strong&gt; Address of the manager for a given address.&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This standards offers a way for any type of address (externally owned and contracts) to implement an interface and potentially delegate the implementation of the interface to a proxy contract.
This delegation to a proxy contract is necessary for externally owned accounts and useful to avoid redeploying existing contracts such as multisigs and DAOs.&lt;&#x2F;p&gt;
&lt;p&gt;The registry can also act as a &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; cache in order to save gas when looking up if a contract implements a specific &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; interface.
This cache is intentionally kept simple, without automatic cache update or invalidation.
Anyone can easily and safely update the cache for any interface and any contract by calling the &lt;code&gt;updateERC165Cache&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;p&gt;The registry is deployed using a keyless deployment method relying on a single-use deployment address to ensure no one controls the registry, thereby ensuring trust.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backward-compatibility&quot;&gt;Backward Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is backward compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt;, as both methods MAY be implemented without conflicting with each other.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Please check the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;0xjac&#x2F;ERC1820&quot;&gt;0xjac&#x2F;ERC1820&lt;&#x2F;a&gt; repository for the full test suite.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The implementation is available in the repo: &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;0xjac&#x2F;ERC1820&quot;&gt;0xjac&#x2F;ERC1820&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Universal Upgradeable Proxy Standard (UUPS)</title>
        <published>2019-03-04T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Gabriel Barros</name><email>gabriel@terminal.co</email>
	</author>
	
	<author>
		<name>Patrick Gallagher</name><email>blockchainbuddha@gmail.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1822/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-1822-universal-upgradeable-proxy-standard-uups" />
        

        <id>https://wg-eips.ritovision.com/1822/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:1822"
            label="ERC-1822" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1822/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Standard upgradeable proxy contract.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The following describes a standard for proxy contracts which is universally compatible with all contracts, and does not create incompatibility between the proxy and business-logic contracts. This is achieved by utilizing a unique storage position in the proxy contract to store the Logic Contract&#x27;s address. A compatibility check ensures successful upgrades. Upgrading can be performed unlimited times, or as determined by custom logic. In addition, a method for selecting from multiple constructors is provided, which does not inhibit the ability to verify bytecode.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Improve upon existing proxy implementations to improve developer experience for deploying and maintaining Proxy and Logic Contracts.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Standardize and improve the methods for verifying the bytecode used by the Proxy Contract.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;terminology&quot;&gt;Terminology&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;delegatecall()&lt;&#x2F;code&gt; - Function in contract &lt;strong&gt;A&lt;&#x2F;strong&gt; which allows an external contract &lt;strong&gt;B&lt;&#x2F;strong&gt; (delegating) to modify &lt;strong&gt;A&lt;&#x2F;strong&gt;&#x27;s storage (see diagram below, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;solidity.readthedocs.io&#x2F;en&#x2F;v0.5.3&#x2F;introduction-to-smart-contracts.html#delegatecall-callcode-and-libraries&quot;&gt;Solidity docs&lt;&#x2F;a&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Proxy Contract&lt;&#x2F;strong&gt; - The contract &lt;strong&gt;A&lt;&#x2F;strong&gt; which stores data, but uses the logic of external contract &lt;strong&gt;B&lt;&#x2F;strong&gt; by way of &lt;code&gt;delegatecall()&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Logic Contract&lt;&#x2F;strong&gt; - The contract &lt;strong&gt;B&lt;&#x2F;strong&gt; which contains the logic used by Proxy Contract &lt;strong&gt;A&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Proxiable Contract&lt;&#x2F;strong&gt; - Inherited in Logic Contract &lt;strong&gt;B&lt;&#x2F;strong&gt; to provide the upgrade functionality&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1822&#x2F;.&#x2F;assets&#x2F;proxy-diagram.png&quot; alt=&quot;&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The Proxy Contract proposed here should be deployed &lt;em&gt;as is&lt;&#x2F;em&gt;, and used as a drop-in replacement for any existing methods of lifecycle management of contracts. In addition to the Proxy Contract, we propose the Proxiable Contract interface&#x2F;base which establishes a pattern for the upgrade which does not interfere with existing business rules. The logic for allowing upgrades can be implemented as needed.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;proxy-contract&quot;&gt;Proxy Contract&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;functions&quot;&gt;Functions&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;fallback&quot;&gt;&lt;code&gt;fallback&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;p&gt;The proposed fallback function follows the common pattern seen in other Proxy Contract implementations such as &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;maraoz&#x2F;solidity-proxy&#x2F;blob&#x2F;master&#x2F;contracts&#x2F;Dispatcher.sol&quot;&gt;Zeppelin&lt;&#x2F;a&gt; or &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;blog.gnosis.pm&#x2F;solidity-delegateproxy-contracts-e09957d0f201&quot;&gt;Gnosis&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;However, rather than forcing use of a variable, the address of the Logic Contract is stored at the defined storage position &lt;code&gt;keccak256(&quot;PROXIABLE&quot;)&lt;&#x2F;code&gt;. This eliminates the possibility of collision between variables in the Proxy and Logic Contracts, thus providing &quot;universal&quot; compatibility with any Logic Contract.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; solium-disable-line&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contractLogic&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; :&lt;&#x2F;span&gt;&lt;span&gt;= &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xc5f16f0fcc639fa48a6947836d9850f504798523bf8c9a3a87d5876cf622bcf7&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        calldatacopy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; calldatasize&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; success&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; :&lt;&#x2F;span&gt;&lt;span&gt;= &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;delegatecall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;sub&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; 10000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; contractLogic&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calldatasize&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; retSz&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; :&lt;&#x2F;span&gt;&lt;span&gt;= &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;returndatasize&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        returndatacopy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; retSz&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        switch&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; success&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        case&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            revert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; retSz&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        default&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; retSz&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;constructor&quot;&gt;&lt;code&gt;constructor&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The proposed constructor accepts any number of arguments of any type, and thus is compatible with any Logic Contract constructor function.&lt;&#x2F;p&gt;
&lt;p&gt;In addition, the arbitrary nature of the Proxy Contract&#x27;s constructor provides the ability to select from one or more constructor functions available in the Logic Contract source code (e.g., &lt;code&gt;constructor1&lt;&#x2F;code&gt;, &lt;code&gt;constructor2&lt;&#x2F;code&gt;, ... etc. ). Note that if multiple constructors are included in the Logic Contract, a check should be included to prohibit calling a constructor again post-initialization.&lt;&#x2F;p&gt;
&lt;p&gt;It&#x27;s worth noting that the added functionality of supporting multiple constructors does not inhibit verification of the Proxy Contract&#x27;s bytecode, since the initialization tx call data (input) can be decoded by first using the Proxy Contract ABI, and then using the Logic Contract ABI.&lt;&#x2F;p&gt;
&lt;p&gt;The contract below shows the proposed implementation of the Proxy Contract.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Proxy&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Code position in storage is keccak256(&amp;quot;PROXIABLE&amp;quot;) = &amp;quot;0xc5f16f0fcc639fa48a6947836d9850f504798523bf8c9a3a87d5876cf622bcf7&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; constructData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contractLogic&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; save the code address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; solium-disable-line&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xc5f16f0fcc639fa48a6947836d9850f504798523bf8c9a3a87d5876cf622bcf7&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contractLogic&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _&lt;&#x2F;span&gt;&lt;span&gt; )&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contractLogic&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;delegatecall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;constructData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; solium-disable-line&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Construction failed&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; solium-disable-line&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contractLogic&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; :&lt;&#x2F;span&gt;&lt;span&gt;= &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xc5f16f0fcc639fa48a6947836d9850f504798523bf8c9a3a87d5876cf622bcf7&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            calldatacopy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; calldatasize&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; success&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; :&lt;&#x2F;span&gt;&lt;span&gt;= &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;delegatecall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;sub&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; 10000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; contractLogic&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calldatasize&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; retSz&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; :&lt;&#x2F;span&gt;&lt;span&gt;= &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;returndatasize&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            returndatacopy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; retSz&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            switch&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; success&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            case&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;                revert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; retSz&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            default&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                return&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; retSz&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;proxiable-contract&quot;&gt;Proxiable Contract&lt;&#x2F;h3&gt;
&lt;p&gt;The Proxiable Contract is included in the Logic Contract, and provides the functions needed to perform an upgrade. The compatibility check &lt;code&gt;proxiable&lt;&#x2F;code&gt; prevents irreparable updates during an upgrade.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;:warning: Warning: &lt;code&gt;updateCodeAddress&lt;&#x2F;code&gt; and &lt;code&gt;proxiable&lt;&#x2F;code&gt; must be present in the Logic Contract. Failure to include these may prevent upgrades, and could allow the Proxy Contract to become entirely unusable. See below &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1822&#x2F;#restricting-dangerous-functions&quot;&gt;Restricting dangerous functions&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h4 id=&quot;functions-1&quot;&gt;Functions&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;proxiable&quot;&gt;&lt;code&gt;proxiable&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;p&gt;Compatibility check to ensure the new Logic Contract implements the Universal Upgradeable Proxy Standard. Note that in order to support future implementations, the &lt;code&gt;bytes32&lt;&#x2F;code&gt; comparison could be changed e.g., &lt;code&gt;keccak256(&quot;PROXIABLE-ERC1822-v1&quot;)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;updatecodeaddress&quot;&gt;&lt;code&gt;updateCodeAddress&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;p&gt;Stores the Logic Contract&#x27;s address at storage &lt;code&gt;keccak256(&quot;PROXIABLE&quot;)&lt;&#x2F;code&gt; in the Proxy Contract.&lt;&#x2F;p&gt;
&lt;p&gt;The contract below shows the proposed implementation of the Proxiable Contract.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Proxiable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Code position in storage is keccak256(&amp;quot;PROXIABLE&amp;quot;) = &amp;quot;0xc5f16f0fcc639fa48a6947836d9850f504798523bf8c9a3a87d5876cf622bcf7&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; updateCodeAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xc5f16f0fcc639fa48a6947836d9850f504798523bf8c9a3a87d5876cf622bcf7&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Proxiable&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;newAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;proxiableUUID&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Not compatible&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; solium-disable-line&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xc5f16f0fcc639fa48a6947836d9850f504798523bf8c9a3a87d5876cf622bcf7&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; newAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; proxiableUUID&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xc5f16f0fcc639fa48a6947836d9850f504798523bf8c9a3a87d5876cf622bcf7&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;pitfalls-when-using-a-proxy&quot;&gt;Pitfalls when using a proxy&lt;&#x2F;h2&gt;
&lt;p&gt;The following common best practices should be employed for all Logic Contracts when using a proxy contract.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;separating-variables-from-logic&quot;&gt;Separating Variables from Logic&lt;&#x2F;h3&gt;
&lt;p&gt;Careful consideration should be made when designing a new Logic Contract to prevent incompatibility with the existing storage of the Proxy Contract after an upgrade. Specifically, the order in which variables are instantiated in the new contract should not be modified, and any new variables should be added after all existing variables from the previous Logic Contract&lt;&#x2F;p&gt;
&lt;p&gt;To facilitate this practice, we recommend utilizing a single &quot;base&quot; contract which holds all variables, and which is inherited in subsequent logic contract(s). This practice greatly reduces the chances of accidentally reordering variables or overwriting them in storage.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;restricting-dangerous-functions&quot;&gt;Restricting dangerous functions&lt;&#x2F;h3&gt;
&lt;p&gt;The compatibility check in the Proxiable Contract is a safety mechanism to prevent upgrading to a Logic Contract which does not implement the Universal Upgradeable Proxy Standard. However, as occurred in the parity wallet hack, it is still possible to perform irreparable damage to the Logic Contract itself.&lt;&#x2F;p&gt;
&lt;p&gt;In order to prevent damage to the Logic Contract, we recommend restricting permissions for any potentially damaging functions to &lt;code&gt;onlyOwner&lt;&#x2F;code&gt;, and giving away ownership of the Logic Contract immediately upon deployment to a null address (e.g., address(1)). Potentially damaging functions include native functions such as &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;, as well functions whose code may originate externally such as &lt;code&gt;CALLCODE&lt;&#x2F;code&gt;, and &lt;code&gt;delegatecall()&lt;&#x2F;code&gt;. In the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1822&#x2F;#erc-20-token&quot;&gt;ERC-20 Token&lt;&#x2F;a&gt; example below, a &lt;code&gt;LibraryLock&lt;&#x2F;code&gt; contract is used to prevent destruction of the logic contract.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;examples&quot;&gt;Examples&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;owned&quot;&gt;Owned&lt;&#x2F;h3&gt;
&lt;p&gt;In this example, we show the standard ownership example, and restrict the &lt;code&gt;updateCodeAddress&lt;&#x2F;code&gt; to only the owner.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Owned&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Proxiable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ensures no one can manipulate this contract once it is deployed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constructor1&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ensures this can be called only once per *proxy* contract deployed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; updateCode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newCode&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        updateCodeAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;newCode&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    modifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Only owner is allowed to perform this action&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        _&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;erc-20-token&quot;&gt;ERC-20 Token&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;proxy-contract-1&quot;&gt;Proxy Contract&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ^&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;5&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Proxy&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Code position in storage is keccak256(&amp;quot;PROXIABLE&amp;quot;) = &amp;quot;0xc5f16f0fcc639fa48a6947836d9850f504798523bf8c9a3a87d5876cf622bcf7&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; constructData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contractLogic&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; save the code address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; solium-disable-line&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xc5f16f0fcc639fa48a6947836d9850f504798523bf8c9a3a87d5876cf622bcf7&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contractLogic&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _&lt;&#x2F;span&gt;&lt;span&gt; )&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contractLogic&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;delegatecall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;constructData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; solium-disable-line&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Construction failed&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; solium-disable-line&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contractLogic&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; :&lt;&#x2F;span&gt;&lt;span&gt;= &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xc5f16f0fcc639fa48a6947836d9850f504798523bf8c9a3a87d5876cf622bcf7&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            calldatacopy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; calldatasize&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; success&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; :&lt;&#x2F;span&gt;&lt;span&gt;= &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;delegatecall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;sub&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; 10000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; contractLogic&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calldatasize&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; retSz&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; :&lt;&#x2F;span&gt;&lt;span&gt;= &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;returndatasize&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            returndatacopy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; retSz&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            switch&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; success&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            case&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;                revert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; retSz&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            default&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                return&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; retSz&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;token-logic-contract&quot;&gt;Token Logic Contract&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Proxiable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Code position in storage is keccak256(&amp;quot;PROXIABLE&amp;quot;) = &amp;quot;0xc5f16f0fcc639fa48a6947836d9850f504798523bf8c9a3a87d5876cf622bcf7&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; updateCodeAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xc5f16f0fcc639fa48a6947836d9850f504798523bf8c9a3a87d5876cf622bcf7&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Proxiable&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;newAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;proxiableUUID&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Not compatible&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; solium-disable-line&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xc5f16f0fcc639fa48a6947836d9850f504798523bf8c9a3a87d5876cf622bcf7&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; newAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; proxiableUUID&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xc5f16f0fcc639fa48a6947836d9850f504798523bf8c9a3a87d5876cf622bcf7&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Owned&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    modifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Only owner is allowed to perform this action&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        _&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; LibraryLockDataLayout&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; initialized&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; LibraryLock&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; LibraryLockDataLayout&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Ensures no one can manipulate the Logic Contract once it is deployed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; PARITY WALLET HACK PREVENTION&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    modifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; delegatedOnly&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;initialized&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The library is locked. No direct &amp;#39;call&amp;#39; is allowed&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        _&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; initialize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        initialized&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ERC20DataLayout&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; LibraryLockDataLayout&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; totalSupply&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;=&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokens&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; ERC20&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tokens&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Not enough funds for transfer&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        tokens&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        tokens&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; MyToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ERC20DataLayout&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; ERC20&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Owned&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Proxiable&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; LibraryLock&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constructor1&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _initialSupply&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        totalSupply&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _initialSupply&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        tokens&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _initialSupply&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        initialize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        setOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; updateCode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newCode&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; delegatedOnly&lt;&#x2F;span&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        updateCodeAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;newCode&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; delegatedOnly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;        ERC20&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;references&quot;&gt;References&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;medium.com&#x2F;terminaldotco&#x2F;escape-hatch-proxy-efb681de108d&quot;&gt;&quot;Escape-hatch&quot; proxy Medium Post&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Ethereum Verifiable Claims</title>
        <published>2019-03-03T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Pelle Braendgaard</name><uri>https://github.com/pelle</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1812/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-1812-ethereum-verifiable-claims/2814" />
        

        <id>https://wg-eips.ritovision.com/1812/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1812"
            label="ERC-1812" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1812/">&lt;h1 id=&quot;ethereum-verifiable-claims&quot;&gt;Ethereum Verifiable Claims&lt;&#x2F;h1&gt;
&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Reusable Verifiable Claims using &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP 712 Signed Typed Data&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;A new method for Off-Chain Verifiable Claims built on &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt;. These Claims can be issued by any user with a EIP 712 compatible web3 provider. Claims can be stored off chain and verified on-chain by Solidity Smart Contracts, State Channel Implementations or off-chain libraries.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Reusable Off-Chain Verifiable Claims provide an important piece of integrating smart contracts with real world organizational requirements such as meeting regulatory requirements such as KYC, GDPR, Accredited Investor rules etc.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;735&quot;&gt;ERC-735&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;780&quot;&gt;ERC-780&lt;&#x2F;a&gt; provide methods of making claims that live on chain. This is useful for some particular use cases, where some claim about an address must be verified on chain.&lt;&#x2F;p&gt;
&lt;p&gt;In most cases though it is both dangerous and in some cases illegal (according to EU GDPR rules for example) to record Identity Claims containing Personal Identifying Information (PII) on an immutable public database such as the Ethereum blockchain.&lt;&#x2F;p&gt;
&lt;p&gt;The W3C &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.w3.org&#x2F;TR&#x2F;verifiable-claims-data-model&#x2F;&quot;&gt;Verifiable Claims Data Model and Representations&lt;&#x2F;a&gt; as well as uPorts &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;developer.uport.me&#x2F;messages&#x2F;verification&quot;&gt;Verification Message Spec&lt;&#x2F;a&gt; are proposed off-chain solutions.&lt;&#x2F;p&gt;
&lt;p&gt;While built on industry standards such as &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;json-ld.org&quot;&gt;JSON-LD&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;jwt.io&quot;&gt;JWT&lt;&#x2F;a&gt; neither of them are easy to integrate with the Ethereum ecosystem.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; introduces a new method of signing off chain Identity data. This provides both a data format based on Solidity ABI encoding that can easily be parsed on-chain an a new JSON-RPC call that is easily supported by existing Ethereum wallets and Web3 clients.&lt;&#x2F;p&gt;
&lt;p&gt;This format  allows reusable off-chain Verifiable Claims to be cheaply issued to users, who can present them when needed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;prior-art&quot;&gt;Prior Art&lt;&#x2F;h2&gt;
&lt;p&gt;Verified Identity Claims such as those proposed by &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;developer.uport.me&#x2F;messages&#x2F;verification&quot;&gt;uPort&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.w3.org&#x2F;2017&#x2F;vc&#x2F;WG&#x2F;&quot;&gt;W3C Verifiable Claims Working Group&lt;&#x2F;a&gt; form an important part of building up reusable identity claims.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;735&quot;&gt;ERC-735&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;780&quot;&gt;ERC-780&lt;&#x2F;a&gt; provide on-chain storage and lookups of Verifiable Claims.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;claims&quot;&gt;Claims&lt;&#x2F;h3&gt;
&lt;p&gt;Claims can be generalized like this:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Issuer makes the claim that Subject is something or has some attribute and value.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;Claims should be deterministic, in that the same claim signed multiple times by the same signer.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;claims-data-structure&quot;&gt;Claims data structure&lt;&#x2F;h3&gt;
&lt;p&gt;Each claim should be typed based on its specific use case, which EIP 712 lets us do effortlessly. But there are 3 minimal attributes required of the claims structure.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;subject&lt;&#x2F;code&gt; the subject of the claim as an &lt;code&gt;address&lt;&#x2F;code&gt; (who the claim is about)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;validFrom&lt;&#x2F;code&gt; the time in seconds encoded as a &lt;code&gt;uint256&lt;&#x2F;code&gt; of start of validity of claim. In most cases this would be the time of issuance, but some claims may be valid in the future or past.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;validTo&lt;&#x2F;code&gt; the time in seconds encoded as a &lt;code&gt;uint256&lt;&#x2F;code&gt; of when the validity of  the claim expires. If you intend for the claim not to expire use &lt;code&gt;0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The basic minimal claim data structure as a Solidity struct:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;CLAIM TYPE&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	address&lt;&#x2F;span&gt;&lt;span&gt; subject&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	uint256&lt;&#x2F;span&gt;&lt;span&gt; validFrom&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	uint256&lt;&#x2F;span&gt;&lt;span&gt; validTo&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The CLAIM TYPE is the actual name of the claim. While not required, in most cases use the taxonomy developed by &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;schema.org&#x2F;docs&#x2F;full.html&quot;&gt;schema.org&lt;&#x2F;a&gt; which is also commonly used in other Verifiable Claims formats.&lt;&#x2F;p&gt;
&lt;p&gt;Example claim that issuer knows a subject:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Know&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	address&lt;&#x2F;span&gt;&lt;span&gt; subject&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	uint256&lt;&#x2F;span&gt;&lt;span&gt; validFrom&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	uint256&lt;&#x2F;span&gt;&lt;span&gt; validTo&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;presenting-a-verifiable-claim&quot;&gt;Presenting a Verifiable Claim&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;verifying-contract&quot;&gt;Verifying Contract&lt;&#x2F;h4&gt;
&lt;p&gt;When defining Verifiable Claims formats a Verifying Contract should be created with a public &lt;code&gt;verify()&lt;&#x2F;code&gt;  view function. This makes it very easy for other smart contracts to verify a claim correctly.&lt;&#x2F;p&gt;
&lt;p&gt;It also provides a convenient interface for web3 and state channel apps to verify claims securely.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verifyIssuer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Know&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; claim&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; v&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; s&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	bytes32&lt;&#x2F;span&gt;&lt;span&gt; digest &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;	  abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;	    &amp;quot;\x19\x01&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	    DOMAIN_SEPARATOR&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;	    hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;claim&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	  )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;	require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		(&lt;&#x2F;span&gt;&lt;span&gt;claim&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validFrom &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; claim&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validTo&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;invalid issuance timestamps&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;	return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; ecrecover&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;digest&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; s&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;calling-a-smartcontract-function&quot;&gt;Calling a SmartContract function&lt;&#x2F;h4&gt;
&lt;p&gt;Verifiable Claims can be presented to a solidity function call as it’s struct together with the &lt;code&gt;v&lt;&#x2F;code&gt;, &lt;code&gt;r&lt;&#x2F;code&gt; and &lt;code&gt;s&lt;&#x2F;code&gt; signature components.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; vouch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Know&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; claim&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; v&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; s&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	address&lt;&#x2F;span&gt;&lt;span&gt; issuer &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; verifier&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;verifyIssuer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;claim&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; s&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;	require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;issuer &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;#39;0x0&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	knows&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;issuer&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;claim&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;subject&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;	return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;embedding-a-verifiable-claim-in-another-signed-typed-data-structure&quot;&gt;Embedding a Verifiable Claim in another Signed Typed Data  structure&lt;&#x2F;h4&gt;
&lt;p&gt;The Claim struct should be embedded in another struct together with the &lt;code&gt;v&lt;&#x2F;code&gt;, &lt;code&gt;r&lt;&#x2F;code&gt; and &lt;code&gt;s&lt;&#x2F;code&gt; signature parameters.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Know&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	address&lt;&#x2F;span&gt;&lt;span&gt; subject&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	uint256&lt;&#x2F;span&gt;&lt;span&gt; validFrom&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	uint256&lt;&#x2F;span&gt;&lt;span&gt; validTo&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; VerifiableReference&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	Know delegate&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	uint8&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	bytes32&lt;&#x2F;span&gt;&lt;span&gt; r&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	bytes32&lt;&#x2F;span&gt;&lt;span&gt; s&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Introduction&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	address&lt;&#x2F;span&gt;&lt;span&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	VerifiableReference issuer&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Each Verifiable Claim should be individually verified  together with the parent Signed Typed Data structure.&lt;&#x2F;p&gt;
&lt;p&gt;Verifiable Claims issued to different EIP 712 Domains can be embedded within each other.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;state-channels&quot;&gt;State Channels&lt;&#x2F;h4&gt;
&lt;p&gt;This proposal will not show how to use Eth Verifiable Claims  as part of a specific State Channel method.&lt;&#x2F;p&gt;
&lt;p&gt;Any State Channel based on EIP712 should be able to include the embeddable Verifiable Claims as part of its protocol. This could be useful for exchanging private Identity Claims between the parties for regulatory reasons, while ultimately not posting them to the blockchain on conclusion of a channel.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;key-delegation&quot;&gt;Key Delegation&lt;&#x2F;h3&gt;
&lt;p&gt;In most simple cases the issuer of a Claim is the signer of the data. There are cases however where signing should be delegated to an intermediary key.&lt;&#x2F;p&gt;
&lt;p&gt;KeyDelegation can be used to implement off chain signing for smart contract based addresses, server side key rotation as well as employee permissions in complex  business use cases.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;erc1056-signing-delegation&quot;&gt;ERC1056 Signing Delegation&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1056&#x2F;&quot;&gt;ERC-1056&lt;&#x2F;a&gt; provides a method for addresses to assign delegate signers. One of the primary use cases for this is that a smart contract can allow a key pair to sign on its behalf for a certain period. It also allows server based issuance tools to institute key rotation.&lt;&#x2F;p&gt;
&lt;p&gt;To support this an additional &lt;code&gt;issuer&lt;&#x2F;code&gt; attribute can be added to the Claim Type struct. In this case the verification code should lookup the EthereumDIDRegistry to see if the signer of the data is an allowed signing delegate for the &lt;code&gt;issuer&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The following is the minimal struct for a Claim containing an issuer:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;CLAIM TYPE&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	address&lt;&#x2F;span&gt;&lt;span&gt; subject&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span&gt; issuer&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	uint256&lt;&#x2F;span&gt;&lt;span&gt; validFrom&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	uint256&lt;&#x2F;span&gt;&lt;span&gt; validTo&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;If the &lt;code&gt;issuer&lt;&#x2F;code&gt; is specified in the struct In addition to performing the standard ERC712 verification the verification code MUST also verify that the signing address is a valid &lt;code&gt;veriKey&lt;&#x2F;code&gt; delegate for the address specified in the issuer.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;registry&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;validDelegate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;issuer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;#39;veriKey&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; recoveredAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;embedded-delegation-proof&quot;&gt;Embedded Delegation Proof&lt;&#x2F;h4&gt;
&lt;p&gt;There may be applications, in particularly where organizations want to allow delegates to issue claims about specific domains and types.&lt;&#x2F;p&gt;
&lt;p&gt;For this purpose instead of the &lt;code&gt;issuer&lt;&#x2F;code&gt; we allow a special claim to be embedded following this same format:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Delegate&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	address&lt;&#x2F;span&gt;&lt;span&gt; issuer&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	address&lt;&#x2F;span&gt;&lt;span&gt; subject&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	uint256&lt;&#x2F;span&gt;&lt;span&gt; validFrom&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	uint256&lt;&#x2F;span&gt;&lt;span&gt; validTo&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; VerifiableDelegate&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	Delegate delegate&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	uint8&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	bytes32&lt;&#x2F;span&gt;&lt;span&gt; r&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	bytes32&lt;&#x2F;span&gt;&lt;span&gt; s&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;CLAIM TYPE&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	address&lt;&#x2F;span&gt;&lt;span&gt; subject&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	VerifiedDelegate issuer&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	uint256&lt;&#x2F;span&gt;&lt;span&gt; validFrom&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	uint256&lt;&#x2F;span&gt;&lt;span&gt; validTo&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Delegates should be created for specific EIP 712 Domains and not be reused across Domains.&lt;&#x2F;p&gt;
&lt;p&gt;Implementers of new EIP 712 Domains can add further data to the &lt;code&gt;Delegate&lt;&#x2F;code&gt; struct to allow finer grained application specific rules to it.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;claim-types&quot;&gt;Claim Types&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;binary-claims&quot;&gt;Binary Claims&lt;&#x2F;h4&gt;
&lt;p&gt;A Binary claim is something that doesn’t have a particular value. It either is issued or not.&lt;&#x2F;p&gt;
&lt;p&gt;Examples:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;subject is a Person&lt;&#x2F;li&gt;
&lt;li&gt;subject is my owner (eg. Linking an ethereum account to an owner identity)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Example:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Person&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	address&lt;&#x2F;span&gt;&lt;span&gt; issuer&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	address&lt;&#x2F;span&gt;&lt;span&gt; subject&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	uint256&lt;&#x2F;span&gt;&lt;span&gt; validFrom&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	uint256&lt;&#x2F;span&gt;&lt;span&gt; validTo&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This is exactly the same as the minimal claim above with the CLAIM TYPE set to &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;schema.org&#x2F;Person&quot;&gt;Person&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;value-claims&quot;&gt;Value Claims&lt;&#x2F;h3&gt;
&lt;p&gt;Value claims can be used to make a claim about the subject containing a specific readable value.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;WARNING&lt;&#x2F;strong&gt;: Be very careful about  using Value Claims  as part of Smart Contract transactions. Identity Claims containing values could be a GDPR violation for the business or developer encouraging a user to post it to a public blockchain.&lt;&#x2F;p&gt;
&lt;p&gt;Examples:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;subject’s name is Alice&lt;&#x2F;li&gt;
&lt;li&gt;subjects average account balance is 1234555&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Each value should use the &lt;code&gt;value&lt;&#x2F;code&gt; field to indicate the value.&lt;&#x2F;p&gt;
&lt;p&gt;A Name Claim&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Name&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	address&lt;&#x2F;span&gt;&lt;span&gt; issuer&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	address&lt;&#x2F;span&gt;&lt;span&gt; subject&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	string&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	uint256&lt;&#x2F;span&gt;&lt;span&gt; validFrom&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	uint256&lt;&#x2F;span&gt;&lt;span&gt; validTo&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Average Balance&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AverageBalance&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	address&lt;&#x2F;span&gt;&lt;span&gt; issuer&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	address&lt;&#x2F;span&gt;&lt;span&gt; subject&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	uint256&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	uint256&lt;&#x2F;span&gt;&lt;span&gt; validFrom&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	uint256&lt;&#x2F;span&gt;&lt;span&gt; validTo&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;hashed-claims&quot;&gt;Hashed Claims&lt;&#x2F;h3&gt;
&lt;p&gt;Hashed claims can be used to make a claim about the subject containing the hash of a claim value. Hashes should use ethereum standard &lt;code&gt;keccak256&lt;&#x2F;code&gt; hashing function.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;WARNING&lt;&#x2F;strong&gt;: Be very careful about  using Hashed Claims  as part of Smart Contract transactions. Identity Claims containing hashes of known values could be a GDPR violation for the business or developer encouraging a user to post it to a public blockchain.&lt;&#x2F;p&gt;
&lt;p&gt;Examples:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;input disabled=&quot;&quot; type=&quot;checkbox&quot;&#x2F;&gt;
hash of subject’s name is &lt;code&gt;keccak256(“Alice Torres”)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;input disabled=&quot;&quot; type=&quot;checkbox&quot;&#x2F;&gt;
hash of subject’s email is &lt;code&gt;keccak256(“alice@example.com”)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Each value should use the &lt;code&gt;keccak256 &lt;&#x2F;code&gt; field to indicate the hashed value. Question. The choice of using this name  is that we can easily add support for future algorithms as well as maybe zkSnark proofs.&lt;&#x2F;p&gt;
&lt;p&gt;A Name Claim&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Name&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	address&lt;&#x2F;span&gt;&lt;span&gt; issuer&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	address&lt;&#x2F;span&gt;&lt;span&gt; subject&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	uint256&lt;&#x2F;span&gt;&lt;span&gt; validFrom&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	uint256&lt;&#x2F;span&gt;&lt;span&gt; validTo&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Email Claim&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Email&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	address&lt;&#x2F;span&gt;&lt;span&gt; issuer&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	address&lt;&#x2F;span&gt;&lt;span&gt; subject&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	uint256&lt;&#x2F;span&gt;&lt;span&gt; validFrom&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	uint256&lt;&#x2F;span&gt;&lt;span&gt; validTo&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;eip-712-domain&quot;&gt;EIP 712 Domain&lt;&#x2F;h3&gt;
&lt;p&gt;The EIP 712 Domain specifies what kind of message that is to be signed and is used to differentiate between signed data types. The content MUST contain the following:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  name&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;EIP1???Claim&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  version&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; for mainnet&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  verifyingContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;x &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; TBD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  salt&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; .&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;full-combined-format-for-eip-712-signing&quot;&gt;Full Combined format for EIP 712 signing:&lt;&#x2F;h4&gt;
&lt;p&gt;Following the EIP 712 standard we can combine the Claim Type with the EIP 712 Domain and the claim itself (in the &lt;code&gt;message&lt;&#x2F;code&gt;)  attribute.&lt;&#x2F;p&gt;
&lt;p&gt;Eg:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;types&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;      &amp;quot;EIP712Domain&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;          &amp;quot;name&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;name&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;          &amp;quot;type&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;string&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;          &amp;quot;name&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;version&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;          &amp;quot;type&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;string&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;          &amp;quot;name&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;chainId&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;          &amp;quot;type&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;uint256&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;          &amp;quot;name&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;verifyingContract&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;          &amp;quot;type&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;address&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;      &amp;quot;Email&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;          &amp;quot;name&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;subject&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;          &amp;quot;type&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;address&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;          &amp;quot;name&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;keccak256&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;          &amp;quot;type&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;bytes32&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;          &amp;quot;name&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;validFrom&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;          &amp;quot;type&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;uint256&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;          &amp;quot;name&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;validTo&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;          &amp;quot;type&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;uint256&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;primaryType&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Email&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;domain&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;      &amp;quot;name&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;EIP1??? Claim&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;      &amp;quot;version&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;1&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;      &amp;quot;chainId&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;      &amp;quot;verifyingContract&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;message&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;      &amp;quot;subject&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;0x5792e817336f41de1d8f54feab4bc200624a1d9d&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;      &amp;quot;value&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;9c8465d9ae0b0bc167dee7f62880034f59313100a638dcc86a901956ea52e280&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;      &amp;quot;validFrom&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;0x0000000000000000000000000000000000000000000000000001644b74c2a0&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;      &amp;quot;validTo&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;revocation&quot;&gt;Revocation&lt;&#x2F;h3&gt;
&lt;p&gt;Both Issuers and Subjects should be allowed to revoke Verifiable Claims. Revocations can be handled through a simple on-chain registry.&lt;&#x2F;p&gt;
&lt;p&gt;The ultimate rules of who should be able to revoke a claim is determined by the Verifying contract.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;digest&lt;&#x2F;code&gt; used for revocation is the EIP712 Signed Typed Data digest.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RevocationRegistry&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  mapping&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; mapping&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; revocations&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revoke&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; digest&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    revocations&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;digest&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revoked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; party&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; digest&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; revocations&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;digest&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;party&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;A verifying contract can query the Revocation Registry as such:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt; digest &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;  abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;\x19\x01&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    DOMAIN_SEPARATOR&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;claim&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;valid&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;claim&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validFrom&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; claim&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validTo&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;invalid issuance timestamps&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; issuer &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; ecrecover&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;digest&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; s&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;revocations&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;revoked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;issuer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; digest&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;claim was revoked by issuer&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;revocations&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;revoked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;claim&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;subject&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; digest&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;claim was revoked by subject&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;creation-of-verifiable-claims-domains&quot;&gt;Creation of Verifiable Claims Domains&lt;&#x2F;h3&gt;
&lt;p&gt;Creating specific is Verifiable Claims Domains is out of the scope of this EIP.   The Example Code has a few examples.&lt;&#x2F;p&gt;
&lt;p&gt;EIP’s or another process could be used to standardize specific important Domains that are universally useful across the Ethereum world.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Signed Typed Data provides a strong foundation for Verifiable Claims that can be used in many different kinds of applications built on both Layer 1 and Layer 2 of Ethereum.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;rationale-for-using-not-using-a-single-eip-712-domain&quot;&gt;Rationale for using not using a single EIP 712 Domain&lt;&#x2F;h3&gt;
&lt;p&gt;EIP712 supports complex types and domains in itself, that we believe are perfect building blocks for building Verifiable Claims for specific purposes.&lt;&#x2F;p&gt;
&lt;p&gt;The Type and Domain of a Claim is itself an important part of a claim and ensures that Verifiable Claims are used for the specific purposes required and not misused.&lt;&#x2F;p&gt;
&lt;p&gt;EIP712 Domains also allow rapid experimentation, allowing taxonomies to be built up by the community.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;There is a repo with a few example verifiers and consuming smart contracts written in Solidity:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Example Verifiers&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;uport-project&#x2F;eip712-claims-experiments&#x2F;blob&#x2F;master&#x2F;contracts&#x2F;IdentityClaimsVerifier.sol&quot;&gt;Verifier for very simple IdVerification Verifiable Claims containing minimal Personal Data&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;uport-project&#x2F;eip712-claims-experiments&#x2F;blob&#x2F;master&#x2F;contracts&#x2F;OwnershipProofVerifier.sol&quot;&gt;Verifier for OwnershipProofs signed by a users wallet&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Example Smart Contracts&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;uport-project&#x2F;eip712-claims-experiments&#x2F;blob&#x2F;master&#x2F;contracts&#x2F;KYCCoin.sol&quot;&gt;KYCCoin.sol&lt;&#x2F;a&gt; - Example Token allows reusable IdVerification claims issued by trusted verifiers and users to whitelist their own addresses using OwnershipProofs&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;uport-project&#x2F;eip712-claims-experiments&#x2F;blob&#x2F;master&#x2F;contracts&#x2F;ConsortiumAgreements.sol&quot;&gt;ConsortiumAgreement.sol&lt;&#x2F;a&gt; - Example Consortium Agreement smart contract. Consortium Members can issue Delegated Claims to employees or servers to interact on their behalf.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Shared Registries&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;uport-project&#x2F;eip712-claims-experiments&#x2F;blob&#x2F;master&#x2F;contracts&#x2F;RevocationRegistry.sol&quot;&gt;RevocationRegistry.sol&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Add OpenRPC Service Discovery To JSON-RPC Services</title>
        <published>2019-02-25T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Shane Jonas</name><uri>https://github.com/shanejonas</uri>
	</author>
	
	<author>
		<name>Zachary Belford</name><uri>https://github.com/belfordz</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1901/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/1902" />
        

        <id>https://wg-eips.ritovision.com/1901/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="interface"
                label="Interface" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1901"
            label="EIP-1901" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1901/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;what-is-this&quot;&gt;What is this?&lt;&#x2F;h3&gt;
&lt;p&gt;This is a proposal to add &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;open-rpc&#x2F;spec&quot;&gt;OpenRPC&lt;&#x2F;a&gt; support to existing and future JSON-RPC services by adding the method &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;open-rpc&#x2F;spec#service-discovery-method&quot;&gt;&lt;code&gt;rpc.discover&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; to the projects &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.jsonrpc.org&#x2F;specification&quot;&gt;JSON-RPC&lt;&#x2F;a&gt; APIs, enabling automation and tooling.&lt;&#x2F;p&gt;
&lt;p&gt;The OpenRPC Document and generated Documentation that specifies all the methods an EVM-based blockchain should implement can be found &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;etclabscore&#x2F;ethereum-json-rpc-specification&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This was first proposed &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;etclabscore&#x2F;ECIPs&#x2F;blob&#x2F;master&#x2F;ECIPs&#x2F;..&#x2F;01053.md&quot;&gt;here as an ECIP&lt;&#x2F;a&gt;, but the benefits of this kind of tooling is apparent across Bitcoin, Ethereum Classic, Ethereum and other JSON-RPC accessible blockchains.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Although &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;&quot;&gt;EIP-1474&lt;&#x2F;a&gt; outlines a JSON-RPC specification. Ethereum still lacks a machine-readable JSON-RPC Specification that can be used as the industry standard for tooling. This proposal attempts to standardize such a specification in a way that is versionable, and both human and machine readable.&lt;&#x2F;p&gt;
&lt;p&gt;Ethereum clients can expose RPC endpoints with different method signatures and cause compatibility issues between clients.&lt;&#x2F;p&gt;
&lt;p&gt;Developers need a reliable developer experience, and an industry standard way to describe Ethereum JSON-RPC 2.0 APIs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;what-is-openrpc&quot;&gt;What is OpenRPC?&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;open-rpc&#x2F;spec&quot;&gt;OpenRPC&lt;&#x2F;a&gt; Specification defines a standard, programming language-agnostic interface description for &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.jsonrpc.org&#x2F;specification&quot;&gt;JSON-RPC 2.0&lt;&#x2F;a&gt; APIs, which allows both humans and computers to discover and understand the capabilities of a service without requiring access to source code, additional documentation, or inspection of network traffic. When properly defined via OpenRPC, a consumer can understand and interact with the remote service with a minimal amount of implementation logic, and share these logic patterns across use cases. Similar to what interface descriptions have done for lower-level programming, the OpenRPC Specification removes guesswork in calling a service.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;structure&quot;&gt;Structure&lt;&#x2F;h5&gt;
&lt;p&gt;This is the structure of an OpenRPC Document:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1901&#x2F;.&#x2F;assets&#x2F;OpenRPC_structure.png&quot; alt=&quot;openrpc-spec-structure&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;JSON-RPC APIs can support the OpenRPC specification by implementing a service discovery method that will return the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;open-rpc&#x2F;spec#openrpc-document&quot;&gt;OpenRPC document&lt;&#x2F;a&gt; for the JSON-RPC API. The method MUST be named &lt;code&gt;rpc.discover&lt;&#x2F;code&gt;. The &lt;code&gt;rpc.&lt;&#x2F;code&gt; prefix is a reserved method prefix for &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.jsonrpc.org&#x2F;specification&quot;&gt;JSON-RPC 2.0 Specification&lt;&#x2F;a&gt; system extensions.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;use-case&quot;&gt;Use Case&lt;&#x2F;h3&gt;
&lt;p&gt;This is the vision for the use case of OpenRPC and how it would relate to a client implementation like multi-geth:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1901&#x2F;.&#x2F;assets&#x2F;multi-geth-use-case.png&quot; alt=&quot;MultGethRpc-usecase&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-would-we-do-this&quot;&gt;Why would we do this?&lt;&#x2F;h3&gt;
&lt;p&gt;Services need to figure out how to talk to each other. If we really want to build the next generation of automation, then having up to date libraries, documented APIs, and modern tools are going to provide easy discovery, on-boarding, and enable end user and developer interaction.&lt;&#x2F;p&gt;
&lt;p&gt;Use cases for machine-readable &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.jsonrpc.org&#x2F;specification&quot;&gt;JSON-RPC 2.0&lt;&#x2F;a&gt; API definition documents include, but are not limited to:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A common vocabulary and document will keep developers, testers, architects, and technical writers all in sync.&lt;&#x2F;li&gt;
&lt;li&gt;Server stubs&#x2F;skeletons generated in many languages&lt;&#x2F;li&gt;
&lt;li&gt;Clients generated in many languages&lt;&#x2F;li&gt;
&lt;li&gt;Mock Server generated in many languages&lt;&#x2F;li&gt;
&lt;li&gt;Tests generated in many languages&lt;&#x2F;li&gt;
&lt;li&gt;Documentation Generation&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;alternative&quot;&gt;Alternative&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;open-rpc&#x2F;spec&quot;&gt;OpenRPC&lt;&#x2F;a&gt; documents just describe &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.jsonrpc.org&#x2F;specification&quot;&gt;JSON-RPC&lt;&#x2F;a&gt; APIs services, and are represented in JSON format. These documents may be produced and served statically OR generated dynamically from an application and returned via the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;open-rpc&#x2F;spec#service-discovery-method&quot;&gt;&lt;code&gt;rpc.discover&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; method. This gives projects and communities the opportunity to adopt tools, documentation, and clients outlined in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;&quot;&gt;etclabscore&#x2F;ethereum-json-rpc-specification&lt;&#x2F;a&gt; before the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;open-rpc&#x2F;spec#service-discovery-method&quot;&gt;&lt;code&gt;rpc.discover&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; method is implemented for a particular client.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;multi-geth&#x2F;multi-geth#openrpc-discovery&quot;&gt;Multi-Geth OpenRPC Discovery&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;tooling&quot;&gt;Tooling&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;interactive-documentation-playground&quot;&gt;Interactive Documentation Playground&lt;&#x2F;h4&gt;
&lt;p&gt;You can view the interactive documentation &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;playground.open-rpc.org&#x2F;?schemaUrl=https:&#x2F;&#x2F;raw.githubusercontent.com&#x2F;etclabscore&#x2F;ethereum-json-rpc-specification&#x2F;master&#x2F;openrpc.json&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;OR&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Using &lt;code&gt;rpc.discover&lt;&#x2F;code&gt; via multi-geth, the playground can discover and display the documentation for the Ethereum JSON-RPC API:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1901&#x2F;.&#x2F;assets&#x2F;eth-playground-openrpc.gif&quot; alt=&quot;eth-playground-openrpc&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;generated-client&quot;&gt;Generated Client&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;etclabscore&#x2F;ethereum-json-rpc-specification#clients&quot;&gt;clients&lt;&#x2F;a&gt; are generated from the OpenRPC Document openrpc.json outlined in this EIP, and can be used as an alternative to web3.js or ethers.js but for various languages:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1901&#x2F;.&#x2F;assets&#x2F;eth-generated-client-openrpc.gif&quot; alt=&quot;eth-generated-client-openrpc&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;mock-server&quot;&gt;Mock Server&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;open-rpc&#x2F;mock-server&quot;&gt;OpenRPC mock server&lt;&#x2F;a&gt; provides a mock server for any given OpenRPC Document which allows testing without booting up a real network.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1901&#x2F;.&#x2F;assets&#x2F;inspector-mock-server-openrpc.png&quot; alt=&quot;inspector-mock-server-openrpc&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;resources&quot;&gt;Resources&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;multi-geth&#x2F;multi-geth#openrpc-discovery&quot;&gt;Multi-Geth OpenRPC Discovery&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=UgSPMZ9FQ4Q&quot;&gt;EDCON 2019 talk on OpenRPC and The Future of JSON-RPC Tooling&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;etclabscore&#x2F;ethereum-json-rpc-specification&quot;&gt;etclabscore&#x2F;ethereum-json-rpc-specification&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;open-rpc.org&quot;&gt;open-rpc.org&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>App Keys, application specific wallet accounts</title>
        <published>2019-02-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Vincent Eli</name><uri>https://github.com/Bunjin</uri>
	</author>
	
	<author>
		<name>Dan Finlay</name><uri>https://github.com/DanFinlay</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1775/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-erc-app-keys-application-specific-wallet-accounts/2742" />
        

        <id>https://wg-eips.ritovision.com/1775/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:1775"
            label="ERC-1775" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1775/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Among others cryptographic applications, scalability and privacy solutions for ethereum blockchain require that an user performs a significant amount of signing operations. It may also require her to watch some state and be ready to sign data automatically (e.g. sign a state or contest a withdraw). The way wallets currently implement accounts poses several obstacles to the development of a complete web3.0 experience both in terms of UX, security and privacy.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal describes a standard and api for a new type of wallet accounts that are derived specifically for a each given application. We propose to call them &lt;code&gt;app keys&lt;&#x2F;code&gt;. They allow to isolate the accounts used for each application, thus potentially increasing privacy. They also allow to give more control to the applications developers over account management and signing delegation. For these app keys, wallets can have a more permissive level of security (e.g. not requesting user&#x27;s confirmation) while keeping main accounts secure. Finally wallets can also implement a different behavior such as allowing to sign transactions without broadcasting them.&lt;&#x2F;p&gt;
&lt;p&gt;This new accounts type can allow to significantly improve UX and permit new designs for applications of the crypto permissionned web.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;In a wallet, an user often holds most of her funds in her main accounts. These accounts require a significant level of security and should not be delegated in any way, this significantly impacts the design of cryptographic applications if a user has to manually confirm every action. Also often an user uses the same accounts across apps, which is a privacy and potentially also a security issue.&lt;&#x2F;p&gt;
&lt;p&gt;We introduce here a new account type, app keys, which permits signing delegation and accounts isolation across applications for privacy and security.&lt;&#x2F;p&gt;
&lt;p&gt;In this EIP, we provide a proposal on how to uniquely identify and authenticate each application, how to derive a master account (or app key) unique for the domain from an user private key (her root private key or any other private key of an account derived or not from her root one). This EIP aims at becoming a standard on how to derive keys specific to each application that can be regenerated from scratch without further input from the user if she restores her wallet and uses again the application for which this key was derived.
These app keys can then be endowed a different set of permissions (through the requestPermission model introduced in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2255&#x2F;&quot;&gt;EIP-2255&lt;&#x2F;a&gt;). This will potentially allow an user to partly trust some apps to perform some crypto operations on their behalf without compromising any security with respect to her main accounts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Wallets developers have agreed on an HD derivation path for ethereum accounts using BIP32, BIP44, SLIP44, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;84&quot;&gt;(see the discussion here)&lt;&#x2F;a&gt;. Web3 wallets have implemented in a roughly similar way the rpc eth api. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1102&#x2F;&quot;&gt;EIP-1102&lt;&#x2F;a&gt; introduced privacy through non automatic opt-in of a wallet account into an app increasing privacy.&lt;&#x2F;p&gt;
&lt;p&gt;However several limitations remain in order to allow for proper design and UX for crypto permissioned apps.&lt;&#x2F;p&gt;
&lt;p&gt;Most of GUI based current wallets don&#x27;t allow to:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;being able to automatically and effortlessly use different keys &#x2F; accounts for each apps,&lt;&#x2F;li&gt;
&lt;li&gt;being able to sign some app&#x27;s action without prompting the user with the same level of security as sending funds from their main accounts,&lt;&#x2F;li&gt;
&lt;li&gt;being able to use throwable keys to improve anonymity,&lt;&#x2F;li&gt;
&lt;li&gt;effortlessly signing transactions for an app without broadcasting these while still being able to perform other transaction signing as usual from their main accounts,&lt;&#x2F;li&gt;
&lt;li&gt;All this while being fully restorable using the user&#x27;s mnemonic or hardware wallet and the HD Path determined uniquely by the app&#x27;s ens name.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;We try to overcome these limitations by introducing a new account&#x27;s type, app keys, made to be used along side the existing main accounts.&lt;&#x2F;p&gt;
&lt;p&gt;These new app keys can permit to give more power and flexibility to the crypto apps developers. This can allow to improve a lot the UX of crypto dapps and to create new designs that were not possible before leveraging the ability to create and handle many accounts, to presign messages and broadcast them later. These features were not compatible with the level of security we were requesting for main accounts that hold most of an user&#x27;s funds.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;applications&quot;&gt;Applications&lt;&#x2F;h3&gt;
&lt;p&gt;An app is a website (or other) that would like to request from a wallet to access a cryptographic key specifically derived for this usage. It can be any form of cryptography&#x2F;identity relying application, Ethereum based but not only.&lt;&#x2F;p&gt;
&lt;p&gt;Once connected to a wallet, an application can request to access an account derived exclusively for that application using the following algorithm.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;private-app-key-generation-algorithm&quot;&gt;Private App Key generation algorithm&lt;&#x2F;h3&gt;
&lt;p&gt;We now propose an algorithm to generate application keys that:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;are uniquely defined, with respect to the account that the user selected to generate these keys,&lt;&#x2F;li&gt;
&lt;li&gt;and thus can be isolated when changing the user account, allowing persona management (see next section),&lt;&#x2F;li&gt;
&lt;li&gt;are specific to each application,&lt;&#x2F;li&gt;
&lt;li&gt;can be fully restored from the user master seed mnemonic and the applications&#x27; names.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;using-different-accounts-as-personas&quot;&gt;Using different accounts as personas&lt;&#x2F;h4&gt;
&lt;p&gt;We allow the user to span a different set of application keys by changing the account selected to generate each key. Thus from the same master seed mnemonic, an user can use each of her account index to generate an alternative set of application keys. One can describe this as using different personas.
This would allow potentially an user to fully isolate her interaction with a given app across personas. One can use this for instance to create a personal and business profile for a given&#x27;s domain both backup up from the same mnemonic, using 2 different accounts to generate these. The app or domain, will not be aware that it is the same person and mnemonic behind both.
If an application interacts with several main accounts of an user, one of these accounts, a master account can be used as persona and the others as auxiliary accounts.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP is agnostic about the way one generates the private keys used to span different app keys spaces. However for compatibility purposes and for clean disambiguation between personas and cryptocurrency accounts, a new EIP, distinct from this one but to be used alongside, will be proposed soon introducing clean persona generation and management.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;applications-unique-identifiers&quot;&gt;Applications&#x27; Unique Identifiers&lt;&#x2F;h4&gt;
&lt;p&gt;Each application is uniquely defined and authenticated by its origin, a domain string. It can be a Domain Name Service (DNS) name or, in the future, an Ethereum Name Service (ENS) name or IPFS hash.&lt;&#x2F;p&gt;
&lt;p&gt;For Ipfs or swam origins, but we could probably use the ipfs or swarm addresses as origin or we could require those to be pointed at through an ENS entry and use the ENS address as origin, although this would mean that the content it refers to could change. It would thus allow for different security and updatibility models.&lt;&#x2F;p&gt;
&lt;p&gt;We will probably require for protocol prefixes when using an ENS domain to point to an IPFS address:
&lt;code&gt;ens:&#x2F;&#x2F;ipfs.snap.eth&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;private-app-key-generation-algorithm-1&quot;&gt;Private App Key generation algorithm&lt;&#x2F;h4&gt;
&lt;p&gt;Using the domain name of an application, we generate a private key for each application (and per main account) :&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;const appKeyPrivKey = keccak256(privKey + originString)&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;where &lt;code&gt;+&lt;&#x2F;code&gt; is concatenation, &lt;code&gt;privKey&lt;&#x2F;code&gt; is the private key of the user&#x27;s account selected to span the application key and &lt;code&gt;originString&lt;&#x2F;code&gt; represents the origin url from which the permission call to access the application key is originated from.&lt;&#x2F;p&gt;
&lt;p&gt;This is exposed as an RPC method to allow any domain to request its own app key associated with the current requested account (if available):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;const appKey = await provider.send({&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  method: &amp;#39;wallet_getAppKeyForAccount&amp;#39;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  params: [address1]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;});&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;See here for an implementation:
https:&#x2F;&#x2F;github.com&#x2F;MetaMask&#x2F;eth-simple-keyring&#x2F;blob&#x2F;master&#x2F;index.js#L169&lt;&#x2F;p&gt;
&lt;h4 id=&quot;app-keys-and-hierarchical-deterministic-keys&quot;&gt;App keys and Hierarchical Deterministic keys&lt;&#x2F;h4&gt;
&lt;p&gt;The app keys generated using the algorithm described in the previous section will not be BIP32 compliant. Therefore apps will not be able to create several app keys or use non-hardening and extended public keys techniques directly. They get a single private key (per origin, per persona).
Yet they can use this as initial entropy to span a new HD tree and generate addresses that can be either hardened or not. Thus we should not be losing use cases.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;sharing-application-keys-across-domains&quot;&gt;Sharing application keys across domains:&lt;&#x2F;h3&gt;
&lt;p&gt;While this does not explicit cover cases of sharing these app keys between pages on its own, this need can be met by composition:&lt;&#x2F;p&gt;
&lt;p&gt;Since a domain would get a unique key per persona, and because domains can intercommunicate, one domain (app) could request another domain (signer) to perform its cryptographic operation on some data, with its appKey as a seed, potentially allowing new signing strategies to be added as easily as new websites.&lt;&#x2F;p&gt;
&lt;p&gt;This could also pass it to domains that are loading specific signing strategies. This may sound dangerous at first, but if a domain represents a static hash of a trusted cryptographic function implementation, it could be as safe as calling any audited internal dependency.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;privacy-and-the-funding-trail&quot;&gt;Privacy and the funding trail&lt;&#x2F;h3&gt;
&lt;p&gt;If all an application needs to do with its keys is to sign messages and it does not require funding, then this EIP allows for privacy through the use of distinct keys for each application with a simple deterministic standard compatible across wallets.&lt;&#x2F;p&gt;
&lt;p&gt;However if these application keys require funding, there can be trail and the use of app keys would not fully solve the privacy problem there.&lt;&#x2F;p&gt;
&lt;p&gt;Mixers or anonymous ways of funding an ethereum address (ring signatures) along with this proposal would guarantee privacy.&lt;&#x2F;p&gt;
&lt;p&gt;Even if privacy is not solved fully without this anonymous funding method, we still need a way to easily create and restore different accounts&#x2F;addresses for each application&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;From a wallet point of view, there does not seem to be compatibility issues since these are separate accounts from those that were used previously by wallets and they are supposed to be used along-side in synergy.&lt;&#x2F;p&gt;
&lt;p&gt;However, for applications that associated in some way their users to their main accounts may want to reflect on if and how they would like to leverage the power offered by &lt;code&gt;app keys&lt;&#x2F;code&gt; to migrate to them and leverage on the new app designs they permit.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Here is an early implementation of app keys for standard (non HW) MetaMask accounts.
https:&#x2F;&#x2F;github.com&#x2F;MetaMask&#x2F;eth-simple-keyring&#x2F;blob&#x2F;6d12bd9d73adcccbe0b0c7e32a99d279085e2934&#x2F;index.js#L139-L152&lt;&#x2F;p&gt;
&lt;p&gt;See here for a fork of MetaMask that implements app keys along side plugins:
https:&#x2F;&#x2F;github.com&#x2F;MetaMask&#x2F;metamask-snaps-beta
https:&#x2F;&#x2F;github.com&#x2F;MetaMask&#x2F;metamask-snaps-beta&#x2F;wiki&#x2F;Plugin-API&lt;&#x2F;p&gt;
&lt;h2 id=&quot;example-use-cases&quot;&gt;Example use cases&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;signing transactions without broadcasting them
https:&#x2F;&#x2F;github.com&#x2F;MetaMask&#x2F;metamask-extension&#x2F;issues&#x2F;3475&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;token contract
https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;85&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;default account for dapps
https:&#x2F;&#x2F;ethereum-magicians.org&#x2F;t&#x2F;default-accounts-for-dapps&#x2F;904&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;non wallet&#x2F;crypto accounts
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1581&#x2F;&quot;&gt;EIP1581: Non-wallet usage of keys derived from BIP32 trees&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;state channel application&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;privacy solution&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;non custodian cross cryptocurrency exchange...&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;acknowledgements&quot;&gt;Acknowledgements&lt;&#x2F;h2&gt;
&lt;p&gt;MetaMask team, Christian Lundkvist, Counterfactual team, Liam Horne, Erik Bryn, Richard Moore, Jeff Coleman.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;hd-and-mnemonics&quot;&gt;HD and mnemonics&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;bips&quot;&gt;BIPs&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;bitcoin&#x2F;bips&#x2F;blob&#x2F;master&#x2F;bip-0032.mediawiki&quot;&gt;BIP32: Hierarchical Deterministic Wallets:&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;bitcoin&#x2F;bips&#x2F;blob&#x2F;master&#x2F;bip-0039.mediawiki&quot;&gt;BIP39: Mnemonic code for generating deterministic keys:&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;satoshilabs&#x2F;slips&#x2F;blob&#x2F;master&#x2F;.&#x2F;00044.md&quot;&gt;SLIP44: Registered coin types for BIP44&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;derivation-path-for-eth&quot;&gt;Derivation path for eth&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;84&quot;&gt;Issue 84&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;85&quot;&gt;Issue 85&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;600&#x2F;&quot;&gt;EIP600 Ethereum purpose allocation for Deterministic Wallets&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;601&#x2F;&quot;&gt;EIP601 Ethereum hierarchy for deterministic wallets&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;previous-proposals-and-discussions-related-to-app-keys&quot;&gt;Previous proposals and discussions related to app keys&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum-magicians.org&#x2F;t&#x2F;meta-we-should-value-privacy-more&#x2F;2475&quot;&gt;Meta: we should value privacy more&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1102&#x2F;&quot;&gt;EIP1102: Opt-in account exposure&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1581&#x2F;&quot;&gt;EIP1581: Non-wallet usage of keys derived from BIP-32 trees&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum-magicians.org&#x2F;t&#x2F;non-wallet-usage-of-keys-derived-from-bip-32-trees&#x2F;1817&#x2F;4&quot;&gt;EIP1581: discussion&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;satoshilabs&#x2F;slips&#x2F;blob&#x2F;master&#x2F;.&#x2F;00013.md&quot;&gt;SLIP13: Authentication using deterministic hierarchy&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Scoped Approval Interface</title>
        <published>2019-02-18T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Witek Radomski</name><email>witek@enjin.io</email>
	</author>
	
	<author>
		<name>Andrew Cooke</name><email>ac0dem0nk3y@gmail.com</email>
	</author>
	
	<author>
		<name>James Therien</name><email>james@enjin.io</email>
	</author>
	
	<author>
		<name>Eric Binet</name><email>eric@enjin.io</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1761/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/1761" />
        

        <id>https://wg-eips.ritovision.com/1761/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:1761"
            label="ERC-1761" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1761/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;A standard interface to permit restricted approval in token contracts by defining &quot;scopes&quot; of one or more Token IDs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This interface is designed for use with token contracts that have an &quot;ID&quot; domain, such as ERC-1155 or ERC-721. This enables restricted approval of one or more Token IDs to a specific &quot;scope&quot;. When considering a smart contract managing tokens from multiple different domains, it makes sense to limit approvals to those domains. Scoped approval is a generalization of this idea. Implementors can define scopes as needed.&lt;&#x2F;p&gt;
&lt;p&gt;Sample use cases for scopes:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A company may represent its fleet of vehicles on the blockchain and it could create a scope for each regional office.&lt;&#x2F;li&gt;
&lt;li&gt;Game developers could share an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; contract where each developer manages tokens under a specified scope.&lt;&#x2F;li&gt;
&lt;li&gt;Tokens of different value could be split into separate scopes. High-value tokens could be kept in smaller separate scopes while low-value tokens might be kept in a shared scope. Users would approve the entire low-value token scope to a third-party smart contract, exchange, or other application without concern about losing their high-value tokens in the event of a problem.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;It may be desired to restrict approval in some applications. Restricted approval can prevent losses in cases where users do not audit the contracts they&#x27;re approving. No standard API is supplied to manage scopes as this is implementation specific. Some implementations may opt to offer a fixed number of scopes, or assign a specific set of scopes to certain types. Other implementations may open up scope configuration to its users and offer methods to create scopes and assign IDs to them.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h1&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.5.2&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: The ERC-165 identifier for this interface is 0x30168307.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ScopedApproval&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST emit when approval changes for scope.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ApprovalForScope&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _scope&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST emit when the token IDs are added to the scope.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        By default, IDs are in no scope.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        The range is inclusive: _idStart, _idEnd, and all IDs in between have been added to the scope.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        _idStart must be lower than or equal to _idEnd.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IdsAddedToScope&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _idStart&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _idEnd&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _scope&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST emit when the token IDs are removed from the scope.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        The range is inclusive: _idStart, _idEnd, and all IDs in between have been removed from the scope.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        _idStart must be lower than or equal to _idEnd.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IdsRemovedFromScope&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _idStart&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _idEnd&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _scope&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST emit when a scope URI is set or changes.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        URIs are defined in RFC 3986.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        The URI MUST point a JSON file that conforms to the &amp;quot;Scope Metadata JSON Schema&amp;quot;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ScopeURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _scope&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     Returns the number of scopes that contain _id.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  The token ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;     The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; number of scopes containing the ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; scopeCountForId&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;             Returns a scope that contains _id.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;          The token ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _scopeIndex&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  The scope index to  query (valid values are 0 to scopeCountForId(_id)-1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;             The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Nth scope containing the ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; scopeForId&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _scopeIndex&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns a URI that can be queried to get scope metadata. This URI should return a JSON document containing, at least the scope name and description. Although supplying a URI for every scope is recommended, returning an empty string &amp;quot;&amp;quot; is accepted for scopes without a URI.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  _scope&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  The queried scope&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;         The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; URI describing this scope.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; scopeUri&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _scope&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Enable or disable approval for a third party (&amp;quot;operator&amp;quot;) to manage the caller&amp;#39;s tokens in the specified scope.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST emit the ApprovalForScope event on success.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    Address to add to the set of authorized operators&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _scope&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;       Approval scope (can be identified by calling scopeForId)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    True if the operator is approved, false to revoke approval&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setApprovalForScope&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _scope&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Queries the approval status of an operator for a given owner, within the specified scope.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;       The owner of the Tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    Address of authorized operator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _scope&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;       Scope to test for approval (can be identified by calling scopeForId)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;             True&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if the operator is approved, false otherwise&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isApprovedForScope&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _scope&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;scope-metadata-json-schema&quot;&gt;Scope Metadata JSON Schema&lt;&#x2F;h2&gt;
&lt;p&gt;This schema allows for localization. &lt;code&gt;{id}&lt;&#x2F;code&gt; and &lt;code&gt;{locale}&lt;&#x2F;code&gt; should be replaced with the appropriate values by clients.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Scope Metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;required&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Identifies the scope in a human-readable way.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Describes the scope to allow users to make informed approval decisions.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;localization&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;required&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uri&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;default&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;locales&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uri&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The URI pattern to fetch localized data from. This URI should contain the substring `{locale}` which will be replaced with the appropriate locale value before sending the request.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;default&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The locale of the default data within the base JSON&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;locales&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;array&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The list of locales for which data is available. These locales should conform to those defined in the Unicode Common Locale Data Repository (http:&#x2F;&#x2F;cldr.unicode.org&#x2F;).&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;localization&quot;&gt;Localization&lt;&#x2F;h3&gt;
&lt;p&gt;Metadata localization should be standardized to increase presentation uniformity across all languages. As such, a simple overlay method is proposed to enable localization. If the metadata JSON file contains a &lt;code&gt;localization&lt;&#x2F;code&gt; attribute, its content may be used to provide localized values for fields that need it. The &lt;code&gt;localization&lt;&#x2F;code&gt; attribute should be a sub-object with three attributes: &lt;code&gt;uri&lt;&#x2F;code&gt;, &lt;code&gt;default&lt;&#x2F;code&gt; and &lt;code&gt;locales&lt;&#x2F;code&gt;. If the string &lt;code&gt;{locale}&lt;&#x2F;code&gt; exists in any URI, it MUST be replaced with the chosen locale by all client software.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The initial design was proposed as an extension to ERC-1155: &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;1155#issuecomment-459505728&quot;&gt;Discussion Thread - Comment 1&lt;&#x2F;a&gt;. After some discussion: &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;1155#issuecomment-460603439&quot;&gt;Comment 2&lt;&#x2F;a&gt; and suggestions by the community to implement this approval mechanism in an external contract &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;1155#issuecomment-461758755&quot;&gt;Comment 3&lt;&#x2F;a&gt;, it was decided that as an interface standard, this design would allow many different token standards such as ERC-721 and ERC-1155 to implement scoped approvals without forcing the system into all implementations of the tokens.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;metadata-json&quot;&gt;Metadata JSON&lt;&#x2F;h3&gt;
&lt;p&gt;The Scope Metadata JSON Schema was added in order to support human-readable scope names and descriptions in more than one language.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;Standards&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155 Multi Token Standard&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165 Standard Interface Detection&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;json-schema.org&#x2F;&quot;&gt;JSON Schema&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Implementations&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;enjincoin.io&quot;&gt;Enjin Coin&lt;&#x2F;a&gt; (&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;enjin&quot;&gt;github&lt;&#x2F;a&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Articles &amp;amp; Discussions&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;1761&quot;&gt;GitHub - Original Discussion Thread&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;1155&quot;&gt;GitHub - ERC-1155 Discussion Thread&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>GraphQL interface to Ethereum node data</title>
        <published>2019-02-14T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Nick Johnson</name><uri>https://github.com/arachnid</uri>
	</author>
	
	<author>
		<name>Raúl Kripalani</name><uri>https://github.com/raulk</uri>
	</author>
	
	<author>
		<name>Kris Shinn</name><uri>https://github.com/kshinn</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1767/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/graphql-interface-to-ethereum-node-data/2710" />
        

        <id>https://wg-eips.ritovision.com/1767/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="interface"
                label="Interface" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:1767"
            label="EIP-1767" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1767/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP specifies a GraphQL schema for accessing data stored on an Ethereum node. It aims to provide a complete replacement to the read-only information exposed via the present JSON-RPC interface, while improving on usability, consistency, efficiency, and future-proofing.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The current JSON-RPC interface for Ethereum nodes has a number of shortcomings. It&#x27;s informally and incompletely specified in areas, which has led to incompatibilities around issues such as representation of empty byte strings (&quot;&quot; vs &quot;0x&quot; vs &quot;0x0&quot;), and it has to make educated guesses about the data a user will request, which often leads to unnecessary work.&lt;&#x2F;p&gt;
&lt;p&gt;For example, the &lt;code&gt;totalDifficulty&lt;&#x2F;code&gt; field is stored separately from the block header in common Ethereum node implementations, and many callers do not require this field. However, every call to &lt;code&gt;eth_getBlock&lt;&#x2F;code&gt; still retrieves this field, requiring a separate disk read, because the RPC server has no way of knowing if the user requires this field or not.&lt;&#x2F;p&gt;
&lt;p&gt;Similarly, transaction receipts in go-ethereum are stored on disk as a single binary blob for each block. Fetching a receipt for a single transaction requires fetching and deserializing this blob, then finding the relevant entry and returning it; this is accomplished by the &lt;code&gt;eth_getTransactionReceipt&lt;&#x2F;code&gt; API call. A common task for API consumers is to fetch all the receipts in a block; as a result, node implementations end up fetching and deserializing the same data repeatedly, leading to &lt;code&gt;O(n^2)&lt;&#x2F;code&gt; effort to fetch all transaction receipts from a block instead of &lt;code&gt;O(n)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Some of these issues could be fixed with changes to the existing JSON-RPC interface, at the cost of complicating the interface somewhat. Instead, we propose adopting a standard query language, GraphQL, which facilitates more efficient API implementations, while also increasing flexibility.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;prior-art&quot;&gt;Prior Art&lt;&#x2F;h2&gt;
&lt;p&gt;Nick Johnson and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ConsenSys&#x2F;ethql&quot;&gt;EthQL&lt;&#x2F;a&gt; independently developed a GraphQL schema for node data. Once the parties were made aware of the shared effort, they made efforts to bring their schemas into alignment. The current schema proposed in this EIP is derived primarily from the EthQL schema.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;node-api&quot;&gt;Node API&lt;&#x2F;h3&gt;
&lt;p&gt;Compatible nodes MUST provide a GraphQL endpoint available over HTTP. This SHOULD be offered on port 8547 by default. The path to the GraphQL endpoint SHOULD be &#x27;&#x2F;graphql&#x27;.&lt;&#x2F;p&gt;
&lt;p&gt;Compatible nodes MAY offer a GraphiQL interactive query explorer on the root path (&#x27;&#x2F;&#x27;).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;schema&quot;&gt;Schema&lt;&#x2F;h3&gt;
&lt;p&gt;The GraphQL schema for this service is defined as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Bytes32 is a 32 byte binary string, represented as 0x-prefixed hexadecimal.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;scalar Bytes32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Address is a 20 byte Ethereum address, represented as 0x-prefixed hexadecimal.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;scalar Address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Bytes is an arbitrary length binary string, represented as 0x-prefixed hexadecimal.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# An empty byte string is represented as &amp;#39;0x&amp;#39;. Byte strings must have an even number of hexadecimal nybbles.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;scalar Bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# BigInt is a large integer. Input is accepted as either a JSON number or as a string.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Strings may be either decimal or 0x-prefixed hexadecimal. Output values are all&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# 0x-prefixed hexadecimal.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;scalar BigInt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Long is a 64 bit unsigned integer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;scalar Long&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;schema {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    query: Query&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    mutation: Mutation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Account is an Ethereum account at a particular block.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;type Account {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Address is the address owning the account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address: Address!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Balance is the balance of the account, in wei.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    balance: BigInt!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # TransactionCount is the number of transactions sent from this account,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # or in the case of a contract, the number of contracts created. Otherwise&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # known as the nonce.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    transactionCount: Long!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Code contains the smart contract code for this account, if the account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # is a (non-self-destructed) contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    code: Bytes!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Storage provides access to the storage of a contract account, indexed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # by its 32 byte slot identifier.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    storage(slot: Bytes32!): Bytes32!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Log is an Ethereum event log.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;type Log {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Index is the index of this log in the block.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    index: Int!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Account is the account which generated this log - this will always&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # be a contract account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    account(block: Long): Account!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Topics is a list of 0-4 indexed topics for the log.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    topics: [Bytes32!]!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Data is unindexed data for this log.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    data: Bytes!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Transaction is the transaction that generated this log entry.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    transaction: Transaction!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Transaction is an Ethereum transaction.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;type Transaction {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Hash is the hash of this transaction.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    hash: Bytes32!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Nonce is the nonce of the account this transaction was generated with.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    nonce: Long!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Index is the index of this transaction in the parent block. This will&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # be null if the transaction has not yet been mined.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    index: Int&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # From is the account that sent this transaction - this will always be&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # an externally owned account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    from(block: Long): Account!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # To is the account the transaction was sent to. This is null for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # contract-creating transactions.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    to(block: Long): Account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Value is the value, in wei, sent along with this transaction.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    value: BigInt!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # GasPrice is the price offered to miners for gas, in wei per unit.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gasPrice: BigInt!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Gas is the maximum amount of gas this transaction can consume.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas: Long!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # InputData is the data supplied to the target of the transaction.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    inputData: Bytes!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Block is the block this transaction was mined in. This will be null if&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # the transaction has not yet been mined.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block: Block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Status is the return status of the transaction. This will be 1 if the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # transaction succeeded, or 0 if it failed (due to a revert, or due to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # running out of gas). If the transaction has not yet been mined, this&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # field will be null.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    status: Long&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # GasUsed is the amount of gas that was used processing this transaction.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # If the transaction has not yet been mined, this field will be null.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gasUsed: Long&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # CumulativeGasUsed is the total gas used in the block up to and including&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # this transaction. If the transaction has not yet been mined, this field&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # will be null.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    cumulativeGasUsed: Long&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # CreatedContract is the account that was created by a contract creation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # transaction. If the transaction was not a contract creation transaction,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # or it has not yet been mined, this field will be null.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    createdContract(block: Long): Account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Logs is a list of log entries emitted by this transaction. If the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # transaction has not yet been mined, this field will be null.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    logs: [Log!]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# BlockFilterCriteria encapsulates log filter criteria for a filter applied&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# to a single block.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;input BlockFilterCriteria {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Addresses is list of addresses that are of interest. If this list is&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # empty, results will not be filtered by address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    addresses: [Address!]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Topics list restricts matches to particular event topics. Each event has a list&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  # of topics. Topics matches a prefix of that list. An empty element array matches any&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  # topic. Non-empty elements represent an alternative that matches any of the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  # contained topics.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  #&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  # Examples:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  #  - [] or nil          matches any topic list&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  #  - [[A]]              matches topic A in first position&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  #  - [[], [B]]          matches any topic in first position, B in second position&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  #  - [[A], [B]]         matches topic A in first position, B in second position&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  #  - [[A, B]], [C, D]]  matches topic (A OR B) in first position, (C OR D) in second position&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    topics: [[Bytes32!]!]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Block is an Ethereum block.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;type Block {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Number is the number of this block, starting at 0 for the genesis block.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    number: Long!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Hash is the block hash of this block.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    hash: Bytes32!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Parent is the parent block of this block.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    parent: Block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Nonce is the block nonce, an 8 byte sequence determined by the miner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    nonce: Bytes!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # TransactionsRoot is the keccak256 hash of the root of the trie of transactions in this block.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    transactionsRoot: Bytes32!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # TransactionCount is the number of transactions in this block. if&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # transactions are not available for this block, this field will be null.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    transactionCount: Int&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # StateRoot is the keccak256 hash of the state trie after this block was processed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    stateRoot: Bytes32!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # ReceiptsRoot is the keccak256 hash of the trie of transaction receipts in this block.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    receiptsRoot: Bytes32!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Miner is the account that mined this block.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    miner(block: Long): Account!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # ExtraData is an arbitrary data field supplied by the miner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    extraData: Bytes!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # GasLimit is the maximum amount of gas that was available to transactions in this block.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gasLimit: Long!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # GasUsed is the amount of gas that was used executing transactions in this block.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gasUsed: Long!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Timestamp is the unix timestamp at which this block was mined.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    timestamp: BigInt!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # LogsBloom is a bloom filter that can be used to check if a block may&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # contain log entries matching a filter.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    logsBloom: Bytes!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # MixHash is the hash that was used as an input to the PoW process.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    mixHash: Bytes32!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Difficulty is a measure of the difficulty of mining this block.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    difficulty: BigInt!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # TotalDifficulty is the sum of all difficulty values up to and including&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # this block.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    totalDifficulty: BigInt!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # OmmerCount is the number of ommers (AKA uncles) associated with this&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # block. If ommers are unavailable, this field will be null.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ommerCount: Int&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Ommers is a list of ommer (AKA uncle) blocks associated with this block.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # If ommers are unavailable, this field will be null. Depending on your&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # node, the transactions, transactionAt, transactionCount, ommers,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # ommerCount and ommerAt fields may not be available on any ommer blocks.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ommers: [Block]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # OmmerAt returns the ommer (AKA uncle) at the specified index. If ommers&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # are unavailable, or the index is out of bounds, this field will be null.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ommerAt(index: Int!): Block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # OmmerHash is the keccak256 hash of all the ommers (AKA uncles)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # associated with this block.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ommerHash: Bytes32!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Transactions is a list of transactions associated with this block. If&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # transactions are unavailable for this block, this field will be null.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    transactions: [Transaction!]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # TransactionAt returns the transaction at the specified index. If&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # transactions are unavailable for this block, or if the index is out of&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # bounds, this field will be null.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    transactionAt(index: Int!): Transaction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Logs returns a filtered set of logs from this block.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    logs(filter: BlockFilterCriteria!): [Log!]!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Account fetches an Ethereum account at the current block&amp;#39;s state.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    account(address: Address!): Account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Call executes a local call operation at the current block&amp;#39;s state.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    call(data: CallData!): CallResult&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # EstimateGas estimates the amount of gas that will be required for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # successful execution of a transaction at the current block&amp;#39;s state.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    estimateGas(data: CallData!): Long!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# CallData represents the data associated with a local contract call.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# All fields are optional.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;input CallData {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # From is the address making the call.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    from: Address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # To is the address the call is sent to.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    to: Address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Gas is the amount of gas sent with the call.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas: Long&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # GasPrice is the price, in wei, offered for each unit of gas.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gasPrice: BigInt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Value is the value, in wei, sent along with the call.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    value: BigInt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Data is the data sent to the callee.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    data: Bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# CallResult is the result of a local call operation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;type CallResult {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Data is the return data of the called contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    data: Bytes!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # GasUsed is the amount of gas used by the call, after any refunds.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gasUsed: Long!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Status is the result of the call - 1 for success or 0 for failure.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    status: Long!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# FilterCriteria encapsulates log filter criteria for searching log entries.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;input FilterCriteria {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # FromBlock is the block at which to start searching, inclusive. Defaults&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # to the latest block if not supplied.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    fromBlock: Long&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # ToBlock is the block at which to stop searching, inclusive. Defaults&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # to the latest block if not supplied.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    toBlock: Long&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Addresses is a list of addresses that are of interest. If this list is&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # empty, results will not be filtered by address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    addresses: [Address!]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Topics list restricts matches to particular event topics. Each event has a list&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  # of topics. Topics matches a prefix of that list. An empty element array matches any&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  # topic. Non-empty elements represent an alternative that matches any of the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  # contained topics.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  #&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  # Examples:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  #  - [] or nil          matches any topic list&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  #  - [[A]]              matches topic A in first position&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  #  - [[], [B]]          matches any topic in first position, B in second position&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  #  - [[A], [B]]         matches topic A in first position, B in second position&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  #  - [[A, B]], [C, D]]  matches topic (A OR B) in first position, (C OR D) in second position&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    topics: [[Bytes32!]!]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# SyncState contains the current synchronisation state of the client.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;type SyncState{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # StartingBlock is the block number at which synchronisation started.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    startingBlock: Long!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # CurrentBlock is the point at which synchronisation has presently reached.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    currentBlock: Long!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # HighestBlock is the latest known block number.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    highestBlock: Long!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # PulledStates is the number of state entries fetched so far, or null&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # if this is not known or not relevant.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    pulledStates: Long&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # KnownStates is the number of states the node knows of so far, or null&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # if this is not known or not relevant.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    knownStates: Long&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Pending represents the current pending state.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;type Pending {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  # TransactionCount is the number of transactions in the pending state.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  transactionCount: Int!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  # Transactions is a list of transactions in the current pending state.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  transactions: [Transaction!]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  # Account fetches an Ethereum account for the pending state.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  account(address: Address!): Account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  # Call executes a local call operation for the pending state.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  call(data: CallData!): CallResult&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  # EstimateGas estimates the amount of gas that will be required for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  # successful execution of a transaction for the pending state.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  estimateGas(data: CallData!): Long!  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;type Query {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Block fetches an Ethereum block by number or by hash. If neither is&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # supplied, the most recent known block is returned.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block(number: Long, hash: Bytes32): Block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Blocks returns all the blocks between two numbers, inclusive. If&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # to is not supplied, it defaults to the most recent known block.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    blocks(from: Long!, to: Long): [Block!]!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Pending returns the current pending state.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    pending: Pending!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Transaction returns a transaction specified by its hash.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    transaction(hash: Bytes32!): Transaction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Logs returns log entries matching the provided filter.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    logs(filter: FilterCriteria!): [Log!]!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # GasPrice returns the node&amp;#39;s estimate of a gas price sufficient to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # ensure a transaction is mined in a timely fashion.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gasPrice: BigInt!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # ProtocolVersion returns the current wire protocol version number.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    protocolVersion: Int!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Syncing returns information on the current synchronisation state.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    syncing: SyncState&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;type Mutation {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # SendRawTransaction sends an RLP-encoded transaction to the network.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sendRawTransaction(data: Bytes!): Bytes32!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Nodes MAY offer a superset of this schema, by adding new fields or types. Experimental or client-specific fields MUST be prefixed with &#x27;&lt;em&gt;client&lt;&#x2F;em&gt;&#x27; (eg, &#x27;&lt;em&gt;geth&lt;&#x2F;em&gt;&#x27; or &#x27;&lt;em&gt;parity&lt;&#x2F;em&gt;&#x27;). Unprefixed fields MUST be specified in a new EIP that extends this one.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Ethereum nodes have been moving away from providing read-write functionality such as transaction and message signing, and from other services such as code compilation, in favor of a more &#x27;unix-like&#x27; approach where each task is performed by a dedicated process. We have thus specified a core set of types and fields that reflects this trend, leaving out functionality that is presently, or intended to be, deprecated:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;eth_compile*&lt;&#x2F;code&gt; calls are deprecated, and hence not provided here.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;eth_accounts&lt;&#x2F;code&gt;, &lt;code&gt;eth_sign&lt;&#x2F;code&gt;, and &lt;code&gt;eth_sendTransaction&lt;&#x2F;code&gt; are considered by many to be deprecated, and are not provided here; callers should use local accounts or a separate signing daemon instead.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Further, two areas of the current API interface have been omitted for simplicity in this initial standard, with the intention that they will be defined in a later EIP:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Filters will require use of GraphQL subscriptions, and require careful consideration around the desire for nodes without local per-caller state.&lt;&#x2F;li&gt;
&lt;li&gt;Mining functionality is less-used and benefits less from reimplementation in GraphQL, and should be specified in a separate EIP.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This schema implements the bulk of the current read-only functionality provided by the JSON-RPC node interface. Existing RPC calls can be mapped to GraphQL queries as follows:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;RPC&lt;&#x2F;th&gt;&lt;th&gt;Status&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;eth_blockNumber&lt;&#x2F;td&gt;&lt;td&gt;IMPLEMENTED&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;{ block { number } }&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;eth_call&lt;&#x2F;td&gt;&lt;td&gt;IMPLEMENTED&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;{ call(data: { to: &quot;0x...&quot;, data: &quot;0x...&quot; }) { data status gasUsed } }&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;eth_estimateGas&lt;&#x2F;td&gt;&lt;td&gt;IMPLEMENTED&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;{ estimateGas(data: { to: &quot;0x...&quot;, data: &quot;0x...&quot; }) }&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;eth_gasPrice&lt;&#x2F;td&gt;&lt;td&gt;IMPLEMENTED&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;{ gasPrice }&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;eth_getBalance&lt;&#x2F;td&gt;&lt;td&gt;IMPLEMENTED&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;{ account(address: &quot;0x...&quot;) { balance } }&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;eth_getBlockByHash&lt;&#x2F;td&gt;&lt;td&gt;IMPLEMENTED&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;{ block(hash: &quot;0x...&quot;) { ... } }&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;eth_getBlockByNumber&lt;&#x2F;td&gt;&lt;td&gt;IMPLEMENTED&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;{ block(number: 123) { ... } }&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;eth_getBlockTransactionCountByHash&lt;&#x2F;td&gt;&lt;td&gt;IMPLEMENTED&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;{ block(hash: &quot;0x...&quot;) { transactionCount } }&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;eth_getBlockTransactionCountByNumber&lt;&#x2F;td&gt;&lt;td&gt;IMPLEMENTED&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;{ block(number: x) { transactionCounnt } }&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;eth_getCode&lt;&#x2F;td&gt;&lt;td&gt;IMPLEMENTED&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;{ account(address: &quot;0x...&quot;) { code } }&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;eth_getLogs&lt;&#x2F;td&gt;&lt;td&gt;IMPLEMENTED&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;{ logs(filter: { ... }) { ... } }&lt;&#x2F;code&gt; or &lt;code&gt;{ block(...) { logs(filter: { ... }) { ... } } }&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;eth_getStorageAt&lt;&#x2F;td&gt;&lt;td&gt;IMPLEMENTED&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;{ account(address: &quot;0x...&quot;) { storage(slot: &quot;0x...&quot;) } }&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;eth_getTransactionByBlockHashAndIndex&lt;&#x2F;td&gt;&lt;td&gt;IMPLEMENTED&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;{ block(hash: &quot;0x...&quot;) { transactionAt(index: x) { ... } } }&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;eth_getTransactionByBlockNumberAndIndex&lt;&#x2F;td&gt;&lt;td&gt;IMPLEMENTED&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;{ block(number: n) { transactionAt(index: x) { ... } } }&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;eth_getTransactionByHash&lt;&#x2F;td&gt;&lt;td&gt;IMPLEMENTED&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;{ transaction(hash: &quot;0x...&quot;) { ... } }&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;eth_getTransactionCount&lt;&#x2F;td&gt;&lt;td&gt;IMPLEMENTED&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;{ account(address: &quot;0x...&quot;) { transactionCount } }&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;eth_getTransactionReceipt&lt;&#x2F;td&gt;&lt;td&gt;IMPLEMENTED&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;{ transaction(hash: &quot;0x...&quot;) { ... } }&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;eth_getUncleByBlockHashAndIndex&lt;&#x2F;td&gt;&lt;td&gt;IMPLEMENTED&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;{ block(hash: &quot;0x...&quot;) { ommerAt(index: x) { ... } } }&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;eth_getUncleByBlockNumberAndIndex&lt;&#x2F;td&gt;&lt;td&gt;IMPLEMENTED&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;{ block(number: n) { ommerAt(index: x) { ... } } }&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;eth_getUncleCountByBlockHash&lt;&#x2F;td&gt;&lt;td&gt;IMPLEMENTED&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;{ block(hash: &quot;0x...&quot;) { ommerCount } }&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;eth_getUncleCountByBlockNumber&lt;&#x2F;td&gt;&lt;td&gt;IMPLEMENTED&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;{ block(number: x) { ommerCount } }&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;eth_protocolVersion&lt;&#x2F;td&gt;&lt;td&gt;IMPLEMENTED&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;{ protocolVersion }&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;eth_sendRawTransaction&lt;&#x2F;td&gt;&lt;td&gt;IMPLEMENTED&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;mutation { sendRawTransaction(data: data) }&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;eth_syncing&lt;&#x2F;td&gt;&lt;td&gt;IMPLEMENTED&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;{ syncing { ... } }&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;eth_getCompilers&lt;&#x2F;td&gt;&lt;td&gt;NOT IMPLEMENTED&lt;&#x2F;td&gt;&lt;td&gt;Compiler functionality is deprecated in JSON-RPC.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;eth_compileLLL&lt;&#x2F;td&gt;&lt;td&gt;NOT IMPLEMENTED&lt;&#x2F;td&gt;&lt;td&gt;Compiler functionality is deprecated in JSON-RPC.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;eth_compileSolidity&lt;&#x2F;td&gt;&lt;td&gt;NOT IMPLEMENTED&lt;&#x2F;td&gt;&lt;td&gt;Compiler functionality is deprecated in JSON-RPC.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;eth_compileSerpent&lt;&#x2F;td&gt;&lt;td&gt;NOT IMPLEMENTED&lt;&#x2F;td&gt;&lt;td&gt;Compiler functionality is deprecated in JSON-RPC.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;eth_newFilter&lt;&#x2F;td&gt;&lt;td&gt;NOT IMPLEMENTED&lt;&#x2F;td&gt;&lt;td&gt;Filter functionality may be specified in a future EIP.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;eth_newBlockFilter&lt;&#x2F;td&gt;&lt;td&gt;NOT IMPLEMENTED&lt;&#x2F;td&gt;&lt;td&gt;Filter functionality may be specified in a future EIP.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;eth_newPendingTransactionFilter&lt;&#x2F;td&gt;&lt;td&gt;NOT IMPLEMENTED&lt;&#x2F;td&gt;&lt;td&gt;Filter functionality may be specified in a future EIP.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;eth_uninstallFilter&lt;&#x2F;td&gt;&lt;td&gt;NOT IMPLEMENTED&lt;&#x2F;td&gt;&lt;td&gt;Filter functionality may be specified in a future EIP.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;eth_getFilterChanges&lt;&#x2F;td&gt;&lt;td&gt;NOT IMPLEMENTED&lt;&#x2F;td&gt;&lt;td&gt;Filter functionality may be specified in a future EIP.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;eth_getFilterLogs&lt;&#x2F;td&gt;&lt;td&gt;NOT IMPLEMENTED&lt;&#x2F;td&gt;&lt;td&gt;Filter functionality may be specified in a future EIP.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;eth_accounts&lt;&#x2F;td&gt;&lt;td&gt;NOT IMPLEMENTED&lt;&#x2F;td&gt;&lt;td&gt;Accounts functionality is not part of the core node API.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;eth_sign&lt;&#x2F;td&gt;&lt;td&gt;NOT IMPLEMENTED&lt;&#x2F;td&gt;&lt;td&gt;Accounts functionality is not part of the core node API.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;eth_sendTransaction&lt;&#x2F;td&gt;&lt;td&gt;NOT IMPLEMENTED&lt;&#x2F;td&gt;&lt;td&gt;Accounts functionality is not part of the core node API.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;eth_coinbase&lt;&#x2F;td&gt;&lt;td&gt;NOT IMPLEMENTED&lt;&#x2F;td&gt;&lt;td&gt;Mining functionality to be defined separately.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;eth_getWork&lt;&#x2F;td&gt;&lt;td&gt;NOT IMPLEMENTED&lt;&#x2F;td&gt;&lt;td&gt;Mining functionality to be defined separately.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;eth_hashRate&lt;&#x2F;td&gt;&lt;td&gt;NOT IMPLEMENTED&lt;&#x2F;td&gt;&lt;td&gt;Mining functionality to be defined separately.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;eth_mining&lt;&#x2F;td&gt;&lt;td&gt;NOT IMPLEMENTED&lt;&#x2F;td&gt;&lt;td&gt;Mining functionality to be defined separately.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;eth_submitHashrate&lt;&#x2F;td&gt;&lt;td&gt;NOT IMPLEMENTED&lt;&#x2F;td&gt;&lt;td&gt;Mining functionality to be defined separately.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;eth_submitWork&lt;&#x2F;td&gt;&lt;td&gt;NOT IMPLEMENTED&lt;&#x2F;td&gt;&lt;td&gt;Mining functionality to be defined separately.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;For specific reasoning behind omitted functionality, see the Rationale section.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBD.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Implemented and released in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;go-ethereum&#x2F;releases&#x2F;tag&#x2F;v1.9.0&quot;&gt;Go-ethereum 1.9.0&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Implemented and released in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;PegaSysEng&#x2F;pantheon&#x2F;blob&#x2F;master&#x2F;CHANGELOG.md#111&quot;&gt;Pantheon 1.1.1&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Work in progress in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;trinity&#x2F;issues&#x2F;302&quot;&gt;Trinity&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Work in progress in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;paritytech&#x2F;parity-ethereum&#x2F;issues&#x2F;10933&quot;&gt;Parity&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Smart Contract Interface for Licences</title>
        <published>2019-02-06T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Lucas Cullen</name><uri>https://github.com/BitcoinBrisbane</uri>
	</author>
	
	<author>
		<name>Kai Yeung</name><uri>https://github.com/CivicKai</uri>
	</author>
	
	<author>
		<name>Anna Crowley</name><email>annaelizabethcrowley@gmail.com</email>
	</author>
	
	<author>
		<name>Caroline Marshall</name><email>caroline.marshall888@gmail.com</email>
	</author>
	
	<author>
		<name>Katrina Donaghy</name><email>katrina@civicledger.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1753/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/1753/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1753"
            label="ERC-1753" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1753/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This Ethereum Improvement Proposal (EIP) proposes an Ethereum standard for the issuance of licences, permits and grants (Licences).&lt;&#x2F;p&gt;
&lt;p&gt;A Licence is a limited and temporary authority, granted to a natural (e.g. you) or legal person (e.g. a corporation), to do something that would otherwise be unlawful pursuant to a legal framework. A public Licence is granted by the government, directly (e.g. by the New South Wales Department of Primary Industries, Australia) or indirectly (e.g. by an agent operating under the government’s authority), and derives its authority from legislation, though this is often practically achieved via delegated legislation such as regulations. This can be contrasted to a private licence – for example, the licence you grant to a visitor who comes onto your property.&lt;&#x2F;p&gt;
&lt;p&gt;A Licence has the following properties:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;granted personally to the licencee (Licencee), though it may be transferrable to another person or company;&lt;&#x2F;li&gt;
&lt;li&gt;conferring a temporary right to the Licencee to own, use or do something that would otherwise be prohibited, without conferring any property interest in the underlying thing. For example, you may be granted a licence to visit a national park without acquiring any ownership in or over the park itself;&lt;&#x2F;li&gt;
&lt;li&gt;allowing the government authority responsible for the Licence to amend, revoke, renew, suspend or deny the issuance of the Licence, or to impose conditions or penalties for non-compliance; and&lt;&#x2F;li&gt;
&lt;li&gt;usually issued only after the payment of a fee or the meeting of some criteria.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Additionally, a Licence may be granted in respect of certain information. For example, a Licence may be issued in respect of a vehicle registration number and attaching to that specific registered vehicle.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Governments are responsible for the issuance and management of Licences. However, maintaining and sharing this data can be complicated and inefficient. The granting of Licences usually requires the filing of paper-based application forms, manual oversight of applicable legislation and data entry into registries, as well as the issuance of paper based Licences. If individuals wish to sight information on Licence registries, they often need to be present at the government office and complete further paper-based enquiry forms in order to access that data (if available publicly).&lt;&#x2F;p&gt;
&lt;p&gt;This EIP seeks to define a standard that will allow for the granting and&#x2F;or management of Licences via Ethereum smart contracts. The motivation is, in essence, to address the inefficiencies inherent in current licencing systems.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;methods&quot;&gt;Methods&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;NOTES&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The following specifications use syntax from Solidity &lt;code&gt;0.4.17&lt;&#x2F;code&gt; (or above)&lt;&#x2F;li&gt;
&lt;li&gt;Callers MUST handle &lt;code&gt;false&lt;&#x2F;code&gt; from &lt;code&gt;returns (bool success)&lt;&#x2F;code&gt;.  Callers MUST NOT assume that &lt;code&gt;false&lt;&#x2F;code&gt; is never returned!&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;name&quot;&gt;name&lt;&#x2F;h4&gt;
&lt;p&gt;Returns the name of the permit - e.g. &lt;code&gt;&quot;MyPermit&quot;&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;totalsupply&quot;&gt;totalSupply&lt;&#x2F;h4&gt;
&lt;p&gt;Returns the total permit supply.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;grantauthority&quot;&gt;grantAuthority&lt;&#x2F;h4&gt;
&lt;p&gt;Adds an ethereum address to a white list of addresses that have authority to modify a permit.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; grantAuthority&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; who&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;revokeauthority&quot;&gt;revokeAuthority&lt;&#x2F;h4&gt;
&lt;p&gt;Removes an ethereum address from a white list of addresses that have authority to modify a permit.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revokeAuthority&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; who&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;hasauthority&quot;&gt;hasAuthority&lt;&#x2F;h4&gt;
&lt;p&gt;Checks to see if the address has authority to grant or revoke permits.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; hasAuthority&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; who&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; view&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;issue&quot;&gt;issue&lt;&#x2F;h4&gt;
&lt;p&gt;Issues an ethereum address a permit between the specified date range.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; issue&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; who&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; validFrom&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; validTo&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;revoke&quot;&gt;revoke&lt;&#x2F;h4&gt;
&lt;p&gt;Revokes a permit from an ethereum address.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revoke&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; who&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;hasvalid&quot;&gt;hasValid&lt;&#x2F;h4&gt;
&lt;p&gt;Checks to see if an ethereum address has a valid permit.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; hasValid&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; who&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;purchase&quot;&gt;purchase&lt;&#x2F;h4&gt;
&lt;p&gt;Allows a user to self procure a licence.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; purchase&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; validFrom&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; validTo&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The use of smart contracts to apply for, renew, suspend and revoke Licences will free up much needed government resources and allow for the more efficient management of Licences. The EIP also seeks to improve the end user experience of the Licence system. In an era of open government, there is also an increased expectation that individuals will be able to easily access Licence registries, and that the process will be transparent and fair.&lt;&#x2F;p&gt;
&lt;p&gt;By creating an EIP, we hope to increase the use of Ethereum based and issued Licences, which will address these issues.&lt;&#x2F;p&gt;
&lt;p&gt;The Ethereum blockchain is adaptable to various Licences and government authorities. It will also be easily translatable into other languages and can be used by other governmental authorities across the world. Moreover, a blockchain will more effectively protect the privacy of Licence-holders’ data, particularly at a time of an ever-increasing volume of government data breaches.&lt;&#x2F;p&gt;
&lt;p&gt;The EIP has been developed following the review of a number of licensing regulations at the national and state level in Australia. The review allowed the identification of the common licence requirements and criteria for incorporation into the EIP. We have included these in the proposed standard but seek feedback on whether these criteria are sufficient and universal.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;A real world example of a Licence is a permit required to camp in a national park in Australia (e.g. Kakadu national park in the Northern Territory of Australia) under the Environment Protection and Biodiversity Conservation Regulations 2000 (Cth) (EPBC Act) and the Environment Protection and Biodiversity Conservation Regulations 2000 (the Regulations). Pursuant to the EPBC Act and the Regulations, the Director of National Parks oversees a camping permit system, which is intended to help regulate certain activities in National Parks. Permits allowing access to National Parks can be issued to legal or natural persons if the applicant has met certain conditions.&lt;&#x2F;p&gt;
&lt;p&gt;The current digital portal and application form to camp at Kakadu National Park (the Application) can be accessed at: https:&#x2F;&#x2F;www.environment.gov.au&#x2F;system&#x2F;files&#x2F;resources&#x2F;b3481ed3-164b-4e72-a9f8-91fc987d90e7&#x2F;files&#x2F;kakadu-camping-permit-form-19jan2015-pdf.pdf&lt;&#x2F;p&gt;
&lt;p&gt;The user must provide the following details when making an Application:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The full name and contact details of each person to whom the permit is to be issued;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;If the applicant is a company or other incorporated body:&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;o the name, business address and postal address of the company or incorporated body;&lt;&#x2F;p&gt;
&lt;p&gt;o if the applicant is a company—&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;the full name of each of the directors of the company;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;the full name and contact details of the person completing the application form;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;the ACN or ABN of the company or other incorporated body (if applicable);&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Details of the proposed camping purpose (e.g. private camping, school group, etc.);&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;A start date and duration for the camping (up to the maximum duration allowed by law);&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Number of campers (up to the maximum allowed by law);&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;All other required information not essential to the issuance of the Licence (e.g. any particular medical needs of the campers); and&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Fees payable depending on the site, duration and number of campers.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The Regulations also set out a number of conditions that must be met by licensees when the permit has been issued. The Regulations allow the Director of National Parks to cancel, renew or transfer the licence. The above workflow could be better performed by way of a smart contract.&lt;&#x2F;p&gt;
&lt;p&gt;The key criteria required as part of this process form part of the proposed Ethereum standard. We have checked this approach by also considering the issuance of a Commercial Fishing Licence under Part 8 “Licensing and other commercial fisheries management” of the Fisheries Management (General) Regulation 2010 (NSW) (Fisheries Regulations) made pursuant to the Fisheries Management Act 1994 (NSW) (Fisheries Act).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The issuance and ownership of a Licence can be digitally represented on the Ethereum blockchain.&lt;&#x2F;p&gt;
&lt;p&gt;Smart contracts can be used to embed regulatory requirements with respect to the relevant Licence in the blockchain. The Licence would be available electronically in the form of a token. This might be practically represented by a QR code, for example, displaying the current Licence information. The digital representation of the Licence would be stored in a digital wallet, typically an application on a smartphone or tablet computer. The proposed standard allows issuing authorities or regulators to amend, revoke or deny Licences from time to time, with the result of their determinations reflected in the Licence token in near real-time. Licence holders will therefore be notified almost instantly of any amendments, revocations or issues involving their Licence.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;interface&quot;&gt;Interface&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;solidity-example&quot;&gt;Solidity Example&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EIP1753&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; grantAuthority&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; who&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revokeAuthority&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; who&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; hasAuthority&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; who&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; issue&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; who&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revoke&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; who&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; hasValid&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; who&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; purchase&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; validFrom&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; validTo&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.5.3&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EIP&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EIP1753&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; name &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Kakadu National Park Camping Permit&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; totalSupply&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _authorities&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Permit&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _holders&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Permit&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		address&lt;&#x2F;span&gt;&lt;span&gt; issuer&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		uint256&lt;&#x2F;span&gt;&lt;span&gt; validFrom&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		uint256&lt;&#x2F;span&gt;&lt;span&gt; validTo&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		_owner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; grantAuthority&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; who&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		_authorities&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;who&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revokeAuthority&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; who&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		delete&lt;&#x2F;span&gt;&lt;span&gt; _authorities&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;who&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; hasAuthority&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; who&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		return&lt;&#x2F;span&gt;&lt;span&gt; _authorities&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;who&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; issue&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; who&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; start&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; end&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyAuthority&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		_holders&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;who&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Permit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; start&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; end&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		totalSupply &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revoke&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; who&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyAuthority&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		delete&lt;&#x2F;span&gt;&lt;span&gt; _holders&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;who&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; hasValid&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; who&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;	    return&lt;&#x2F;span&gt;&lt;span&gt; _holders&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;who&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validFrom &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; now&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; _holders&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;who&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validTo &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; now&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; purchase&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; validFrom&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; validTo&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;	    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;value &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ether&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Incorrect fee&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;	    issue&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; validFrom&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; validTo&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	modifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Only owner can perform this function&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;		_&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	modifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyAuthority&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;hasAuthority&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Only an authority can perform this function&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        _&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Disable SSTORE with gasleft lower than call stipend</title>
        <published>2019-01-15T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Forshtat</name><email>alex@tabookey.com</email>
	</author>
	
	<author>
		<name>Yoav Weiss</name><email>yoav@tabookey.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1706/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/alex-forshtat-tbk/EIPs/issues/1" />
        

        <id>https://wg-eips.ritovision.com/1706/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        

        
        <category
            term="tag:eip:1706"
            label="EIP-1706" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1706/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;The proposal that had been accepted changes security properties of a large portion of an existing contract code base that may be infeasible to update and validate. This proposal will make the old assumptions hold even after a network upgrade.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1283&#x2F;&quot;&gt;EIP-1283&lt;&#x2F;a&gt; significantly lowers the gas costs of writing to contract&#x27;s storage. This created a danger of a new kind of reentrancy attacks on existing contracts as Solidity by default grants a &#x27;stipend&#x27; of 2300 gas to simple transfer calls.
This danger is easily mitigated if SSTORE is not allowed in low gasleft state, without breaking the backward compatibility and the original intention of this EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;An attack that is described in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;medium.com&#x2F;chainsecurity&#x2F;constantinople-enables-new-reentrancy-attack-ace4088297d9&quot;&gt;this article&lt;&#x2F;a&gt;.
Explicitly specifying the call stipend as an invariant will have a positive effect on Ethereum protocol security:
https:&#x2F;&#x2F;www.reddit.com&#x2F;r&#x2F;ethereum&#x2F;comments&#x2F;agdqsm&#x2F;security_alert_ethereum_constantinople&#x2F;ee5uvjt&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Add the following condition to the SSTORE opcode gas cost calculation:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If &lt;em&gt;gasleft&lt;&#x2F;em&gt; is less than or equal to 2300, fail the current call frame
with &#x27;out of gas&#x27; exception.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;In order to keep in place the implicit reentrancy protection of existing contracts, transactions should not be allowed to modify state if the remaining gas is lower then the 2300 stipend given to &#x27;transfer&#x27;&#x2F;&#x27;send&#x27; in Solidity.
These are other proposed remediations and objections to implementing them:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Drop EIP-1283 and abstain from modifying SSTORE cost
&lt;ul&gt;
&lt;li&gt;EIP-1283 is an important update&lt;&#x2F;li&gt;
&lt;li&gt;It was accepted and implemented on test networks and in clients.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Add a new call context that permits LOG opcodes but not changes to state.
&lt;ul&gt;
&lt;li&gt;Adds another call type beyond existing regular&#x2F;staticcall&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Raise the cost of SSTORE to dirty slots to &amp;gt;=2300 gas
&lt;ul&gt;
&lt;li&gt;Makes net gas metering much less useful.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Reduce the gas stipend
&lt;ul&gt;
&lt;li&gt;Makes the stipend almost useless.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Increase the cost of writes to dirty slots back to 5000 gas, but add 4800 gas to the refund counter
&lt;ul&gt;
&lt;li&gt;Still doesn’t make the invariant explicit.&lt;&#x2F;li&gt;
&lt;li&gt;Requires callers to supply more gas, just to have it refunded&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Add contract metadata specifying per-contract EVM version, and only apply SSTORE changes to contracts deployed with the new version.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Performing SSTORE has never been possible with less than 5000 gas, so it does not introduce incompatibility to the Ethereum mainnet. Gas estimation should account for this requirement.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases for an implementation are mandatory for EIPs that are affecting consensus changes. Other EIPs can choose to include links to test cases if applicable.
TODO&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TODO&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>URL Format for Web3 Browsers</title>
        <published>2019-01-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Bruno Barbieri</name><uri>https://github.com/brunobar79</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1710/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/standarize-url-format-for-web3-browsers/2422" />
        

        <id>https://wg-eips.ritovision.com/1710/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1710"
            label="ERC-1710" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1710/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;A standard way of representing web3 browser URLs for decentralized applications.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Since most normal web browsers (specifically on mobile devices) can not run decentralized applications correctly because of the lack of web3 support, it is necessary to differentiate them from normal urls, so they can be opened in web3 browsers if available.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Lots of dApps that are trying to improve their mobile experience are currently (deep)linking to specific mobile web3 browsers which are currently using their own url scheme.&lt;&#x2F;p&gt;
&lt;p&gt;In order to make the experience more seamless, dApps should still be able to recommend a specific mobile web3 browser via &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Deferred_deep_linking&quot;&gt;deferred deeplinking&lt;&#x2F;a&gt; but by having a standard url format, if the user already has a web3 browser installed that implements this standard, it will be automatically linked to it.&lt;&#x2F;p&gt;
&lt;p&gt;There is also a compatibility problem with the current &lt;code&gt;ethereum:&lt;&#x2F;code&gt; url scheme described in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;831&#x2F;&quot;&gt;EIP-831&lt;&#x2F;a&gt; where any ethereum related app (wallets, identity management, etc) already registered it and because of iOS unpredictable behavior for multiple apps handling a single url scheme, users can end up opening an &lt;code&gt;ethereum:&lt;&#x2F;code&gt; link in an app that doesn not include a web3 browser and will not be able to handle the deeplink correctly.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;syntax&quot;&gt;Syntax&lt;&#x2F;h3&gt;
&lt;p&gt;Web3 browser URLs contain &quot;dapp&quot; in their schema (protocol) part and are constructed as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;request                 = &amp;quot;dapp&amp;quot; &amp;quot;:&amp;quot; [chain_id &amp;quot;@&amp;quot;] dapp_url&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;chain_id                = 1*DIGIT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dapp_url                = URI&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;semantics&quot;&gt;Semantics&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;chain_id&lt;&#x2F;code&gt; is optional and it is a parameter for the browser to automatically select the corresponding chain ID as specified in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt; before opening the dApp.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;dapp_url&lt;&#x2F;code&gt; is a valid &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.ietf.org&#x2F;rfc&#x2F;rfc3986.txt&quot;&gt;RFC3986&lt;&#x2F;a&gt; URI&lt;&#x2F;p&gt;
&lt;p&gt;This a complete example url:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;dapp:1@peepeth.com&#x2F;brunobar79?utm_source=github&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;which will open the web3 browser, select &lt;code&gt;mainnet&lt;&#x2F;code&gt; (chain_id = 1) and then navigate to:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;https:&#x2F;&#x2F;peepeth.com&#x2F;brunobar79?utm_source=github&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The proposed format attempts to solve the problem of vendor specific protocols for web3 browsers, avoiding conflicts with the existing &#x27;ethereum:&#x27; URL scheme while also adding an extra feature: &lt;code&gt;chain_id&lt;&#x2F;code&gt; which will help dApps to be accessed with the right network preselected, optionally extracting away that complexity from end users.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Temporal Replay Protection</title>
        <published>2019-01-08T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Martin Holst Swende</name><uri>https://github.com/holiman</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1681/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/temporal-replay-protection/2355" />
        

        <id>https://wg-eips.ritovision.com/1681/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:1681"
            label="EIP-1681" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1681/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes adding a &#x27;temporal&#x27; replay protection to transactions, in the form of a &lt;code&gt;valid-until&lt;&#x2F;code&gt; timestamp.
This EIP is very similar to https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;pull&#x2F;599 by Nick Johnson and Konrad Feldmeier, the main difference
being that this EIP is based on clock-time &#x2F; walltime instead of block numbers.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;There are a couple of different motivators for introducing a timebased transaction validity.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If any form of dust-account clearing is introduced, e.g. (https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;168), it will be necessary
to introduce a replay protection, such as https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;169 . Having temporal replay protection removes the need
to change nonce-behaviour in the state, since transactions would not be replayable at a later date than explicitly set by the user.&lt;&#x2F;li&gt;
&lt;li&gt;In many cases, such as during ICOs, a lot of people want their transactions to either become included soon (within a couple of hours) or not at all. Currently,
transactions are queued and may not execute for several days, at a cost for both the user (who ends up paying gas for a failing purchase) and the network, dealing with the large transaction queues.&lt;&#x2F;li&gt;
&lt;li&gt;Node implementations have no commonly agreed metric for which transactions to keep, discard or propagate. Having a TTL on transactions would make it easier to remove stale transactions from the system.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The roll-out would be performed in two phases, &lt;code&gt;X&lt;&#x2F;code&gt; (hardfork), and &lt;code&gt;Y&lt;&#x2F;code&gt; (softfork).&lt;&#x2F;p&gt;
&lt;p&gt;At block &lt;code&gt;X&lt;&#x2F;code&gt;,&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Add an optional field &lt;code&gt;valid-until&lt;&#x2F;code&gt; to the RLP-encoded transaction, defined as a &lt;code&gt;uint64&lt;&#x2F;code&gt; (same as &lt;code&gt;nonce&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;If the field is present in transaction &lt;code&gt;t&lt;&#x2F;code&gt;, then
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;t&lt;&#x2F;code&gt; is only eligible for inclusion in a block if &lt;code&gt;block.timestamp&lt;&#x2F;code&gt; &amp;lt; &lt;code&gt;t.valid-until&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;At block &lt;code&gt;Y&lt;&#x2F;code&gt;,&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Make &lt;code&gt;valid-until&lt;&#x2F;code&gt; mandatory, and consider any transaction without &lt;code&gt;valid-until&lt;&#x2F;code&gt; to be invalid.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;rationale-for-this-eip&quot;&gt;Rationale for this EIP&lt;&#x2F;h3&gt;
&lt;p&gt;For the dust-account clearing usecase,&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;This change is much less invasive in the consensus engine.
&lt;ul&gt;
&lt;li&gt;No need to maintain a consensus-field of &#x27;highest-known-nonce&#x27; or cap the number of transactions from a sender in a block.&lt;&#x2F;li&gt;
&lt;li&gt;Only touches the transaction validation part of the consensus engine&lt;&#x2F;li&gt;
&lt;li&gt;Other schemas which uses the &lt;code&gt;nonce&lt;&#x2F;code&gt; can have unintended side-effects,
&lt;ul&gt;
&lt;li&gt;such as inability to create contracts at certain addresses.&lt;&#x2F;li&gt;
&lt;li&gt;more difficult to integrate with offline signers, since more elaborate nonce-schemes requires state access to determine.&lt;&#x2F;li&gt;
&lt;li&gt;More intricate schemes like &lt;code&gt;highest-nonce&lt;&#x2F;code&gt; are a lot more difficult, since highest-known-nonce will be a consensus-struct that is incremented and possibly reverted during transaction execution, requiring one more journalled field.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;rationale-for-walltime&quot;&gt;Rationale for walltime&lt;&#x2F;h3&gt;
&lt;p&gt;Why use walltime instead of block numbers, as proposed in https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;pull&#x2F;599 ?&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The UTC time is generally available in most settings, even on a computer which is offline. This means that even a setup where blockchain information is unavailable, the party signing a transaction can generate a transaction with the desired properties.&lt;&#x2F;li&gt;
&lt;li&gt;The correlation between time and block number is not fixed; even though a 14s blocktime is &#x27;desired&#x27;, this varies due to both network hashrate and difficulty bomb progression.&lt;&#x2F;li&gt;
&lt;li&gt;The block number is even more unreliable as a timestamp for testnets and private networks.&lt;&#x2F;li&gt;
&lt;li&gt;UTC time is more user-friendly, a user can more easily decide on reasonable end-date for a transaction, rather than a suitalbe number of valid blocks.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP means that all software&#x2F;hardware that creates transactions need to add timestamps to the transactions, or will otherwise be incapable of signing transactions after block &lt;code&gt;Y&lt;&#x2F;code&gt;. Note: this EIP does not introduce any maximum &lt;code&gt;valid-until&lt;&#x2F;code&gt; date, so it would still be possible to create
transactions with near infinite validity.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;todo&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;None yet&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The most notable security impact is that pre-signed transactions stored on paper backups, will become invalid as of block &lt;code&gt;Y&lt;&#x2F;code&gt;. There are a couple of cases where this might be used&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Pregenerated onetime &#x27;bootstrap&#x27; transactions, e.g. to onboard a user into Ethereum. Instead of giving a user a giftcard with actual ether on it, someone may instead give the person a one-time pregenerated transaction that will only send those ether to the card once the
user actively wants to start using it.&lt;&#x2F;li&gt;
&lt;li&gt;If a user has an offline paper-wallet, he may have pregenerated transactions to send value to e.g. an exchange. This is sometimes done to be able to send ether to an exchange without having to go through all the hoops of bringing the paper wallet back to &#x27;life&#x27;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Secondary security impacts are that the addition of a timestamp would make the transactions a little bit larger.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>zk-SNARK Verifier Registry Standard</title>
        <published>2018-12-22T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Michael Connor</name><email>michael.connor@uk.ey.com</email>
	</author>
	
	<author>
		<name>Chaitanya Konda</name><email>chaitanya.konda@uk.ey.com</email>
	</author>
	
	<author>
		<name>Duncan Westland</name><email>duncan.westland@uk.ey.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1923/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/1923" />
        

        <id>https://wg-eips.ritovision.com/1923/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:1923"
            label="ERC-1923" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1923/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;A standard interface for a &quot;Verifier Registry&quot;&#x27;&quot; contract, through which all zk-SNARK verification activity can be registered.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The following standard allows for the implementation of a standard contract API for the registration of zk-SNARKs (&quot;Zero-Knowledge Succinct Non-Interactive Arguments of Knowledge&quot;), also known as &quot;proofs&quot;, &quot;arguments&quot;, or &quot;commitments&quot;.&lt;&#x2F;p&gt;
&lt;p&gt;TODO: Which functionality is exposed in this standard interface?&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;zk-SNARKs are a promising area of interest for the Ethereum community. Key applications of zk-SNARKs include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Private transactions&lt;&#x2F;li&gt;
&lt;li&gt;Private computations&lt;&#x2F;li&gt;
&lt;li&gt;Ethereum scaling through proofs of &#x27;bundled&#x27; transactions&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;A standard interface for registering all zk-SNARKs will allow applications to more easily implement private transactions, private contracts, and scaling solutions; and to extract and interpret the limited information which gets emitted during zk-SNARK verifications.&lt;&#x2F;p&gt;
&lt;p&gt;:warning: TODO: Explain the motivation for standardizing a registry, other than simply standardizing the verifier interactions.&lt;&#x2F;p&gt;
&lt;p&gt;⚠️ TODO: Explain the benefits to and perspective of a consumer of information. I.e. the thing that interfaces with the standard verifier registry.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.5.6&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; EIP-XXXX zk-SNARK Verifier Registry Standard&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See https:&#x2F;&#x2F;github.com&#x2F;EYBlockchain&#x2F;zksnark-verifier-standard&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;  Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0xXXXXXXXXX.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ⚠️ &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;TODO&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: Set the interface identifier&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EIP&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt;XXXX &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is ERC165 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NewProofSubmitted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _proofId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _proof&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _inputs&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NewVkRegistered&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _vkId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NewVerifierContractRegistered&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _contractAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NewAttestation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _proofId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _verifier&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getVk&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _vkId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; registerVerifierContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _verifierContract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; registerVk&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _vk&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _verifierContracts&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; submitProof&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _proof&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _inputs&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _vkId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; submitProof&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _proof&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _inputs&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _vkId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _verifierContract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; submitProofAndVerify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _proof&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _inputs&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _vkId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _verifierContract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; attestProof&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _proofId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _vkId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; attestProofs&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _proofIds&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _vkIds&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _results&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; challengeAttestation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _proofId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _proof&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;  _inputs&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _verifierContract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; createNewVkId&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _vk&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; createNewProofId&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _proof&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _inputs&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;interface&quot;&gt;Interface&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC165&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Query if a contract implements an interface&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; interfaceID&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The interface identifier, as specified in ERC-165&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Interface identification is specified in ERC-165. This function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  uses less than 30,000 gas.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `true` if the contract implements `interfaceID` and&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  `interfaceID` is not 0xffffffff, `false` otherwise&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;⚠️ TODO: Add Rationale section.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h3&gt;
&lt;p&gt;⚠️ TODO: Add Backwards Compatibility section.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h3&gt;
&lt;p&gt;Truffle tests of example implementations are included in this Repo.&lt;&#x2F;p&gt;
&lt;p&gt;⚠️ TODO: Reference specific test cases because there are many currently in the repository.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementations&quot;&gt;Implementations&lt;&#x2F;h2&gt;
&lt;p&gt;Detailed example implementations and Truffle tests of these example implementations are included in this Repo.&lt;&#x2F;p&gt;
&lt;p&gt;⚠️ TODO: Update referenced verifier registry implementations so that they are ready-to-deploy or reference deployed versions of those implementations. At current, the referenced code specifically states &quot;DO NOT USE THIS IN PRODUCTION&quot;.&lt;&#x2F;p&gt;
&lt;p&gt;⚠️ TODO: Provide reference to an implementation which interrogates a standard verifier registry contract that implements this standard.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;&#x2F;h2&gt;
&lt;p&gt;⚠️ TODO: Update references and confirm that each reference is cited (parenthetical documentation not necessary) in the text.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Standards&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;ERC-20 Token Standard. .&#x2F;00020.md&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;ERC-165 Standard Interface Detection. .&#x2F;00165.md&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;ERC-173 Contract Ownership Standard (DRAFT). .&#x2F;00173.md&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;ERC-196 Precompiled contracts for addition and scalar multiplication on the elliptic curve alt_bn128. .&#x2F;00196.md&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;ERC-197 Precompiled contracts for optimal ate pairing check on the elliptic curve alt_bn128. .&#x2F;00197.md&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Ethereum Name Service (ENS). https:&#x2F;&#x2F;ens.domains&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;RFC 2119 Key words for use in RFCs to Indicate Requirement Levels. https:&#x2F;&#x2F;www.ietf.org&#x2F;rfc&#x2F;rfc2119.txt&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h5 id=&quot;educational-material-zk-snarks&quot;&gt;Educational material:  zk-SNARKs&lt;&#x2F;h5&gt;
&lt;ol&gt;
&lt;li&gt;Zcash. What are zk-SNARKs? https:&#x2F;&#x2F;z.cash&#x2F;technology&#x2F;zksnarks.html&lt;&#x2F;li&gt;
&lt;li&gt;Vitalik Buterin. zk-SNARKs: Under the Hood. https:&#x2F;&#x2F;medium.com&#x2F;@VitalikButerin&#x2F;zk-snarks-under-the-hood-b33151a013f6&lt;&#x2F;li&gt;
&lt;li&gt;Christian Reitweissner. zk-SNARKs in a Nutshell. https:&#x2F;&#x2F;blog.ethereum.org&#x2F;2016&#x2F;12&#x2F;05&#x2F;zksnarks-in-a-nutshell&#x2F;&lt;&#x2F;li&gt;
&lt;li&gt;Ben-Sasson, Chiesa, Tromer, et. al. Succinct Non-Interactive Zero Knowledge for a von Neumann Architecture. https:&#x2F;&#x2F;eprint.iacr.org&#x2F;2013&#x2F;879.pdf&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h5 id=&quot;notable-applications-of-zk-snarks&quot;&gt;Notable applications of zk-SNARKs&lt;&#x2F;h5&gt;
&lt;ol&gt;
&lt;li&gt;EY. Implementation of a business agreement through Token Commitment transactions on the Ethereum mainnet. https:&#x2F;&#x2F;github.com&#x2F;EYBlockchain&#x2F;ZKPChallenge&lt;&#x2F;li&gt;
&lt;li&gt;Zcash. https:&#x2F;&#x2F;z.cash&lt;&#x2F;li&gt;
&lt;li&gt;Zcash. How Transactions Between Shielded Addresses Work. https:&#x2F;&#x2F;blog.z.cash&#x2F;zcash-private-transactions&#x2F;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h5 id=&quot;notable-projects-relating-to-zk-snarks&quot;&gt;Notable projects relating to zk-SNARKs&lt;&#x2F;h5&gt;
&lt;ol&gt;
&lt;li&gt;libsnark: A C++ Library for zk-SNARKs (&quot;project README)&quot;. https:&#x2F;&#x2F;github.com&#x2F;scipr-lab&#x2F;libsnark&lt;&#x2F;li&gt;
&lt;li&gt;ZoKrates: Scalable Privacy-Preserving Off-Chain Computations. https:&#x2F;&#x2F;www.ise.tu-berlin.de&#x2F;fileadmin&#x2F;fg308&#x2F;publications&#x2F;2018&#x2F;2018_eberhardt_ZoKrates.pdf&lt;&#x2F;li&gt;
&lt;li&gt;ZoKrates Project Repository. https:&#x2F;&#x2F;github.com&#x2F;JacobEberhardt&#x2F;ZoKrates&lt;&#x2F;li&gt;
&lt;li&gt;Joseph Stockermans. zkSNARKs: Driver&#x27;s Ed. https:&#x2F;&#x2F;github.com&#x2F;jstoxrocky&#x2F;zksnarks_example&lt;&#x2F;li&gt;
&lt;li&gt;Christian Reitweissner - snarktest.solidity. https:&#x2F;&#x2F;gist.github.com&#x2F;chriseth&#x2F;f9be9d9391efc5beb9704255a8e2989d&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h5 id=&quot;notable-alternatives-to-zk-snarks-areas-of-ongoing-zero-knowledge-proof-research&quot;&gt;Notable &#x27;alternatives&#x27; to zk-SNARKs - areas of ongoing zero-knowledge proof research&lt;&#x2F;h5&gt;
&lt;ol&gt;
&lt;li&gt;Vitalik Buterin. STARKs. https:&#x2F;&#x2F;web.archive.org&#x2F;web&#x2F;20230425101334&#x2F;https:&#x2F;&#x2F;vitalik.ca&#x2F;general&#x2F;2017&#x2F;11&#x2F;09&#x2F;starks_part_1.html&lt;&#x2F;li&gt;
&lt;li&gt;Bu ̈nz, Bootle, Boneh, et. al. Bulletproofs. https:&#x2F;&#x2F;eprint.iacr.org&#x2F;2017&#x2F;1066.pdf&lt;&#x2F;li&gt;
&lt;li&gt;Range Proofs. https:&#x2F;&#x2F;www.cosic.esat.kuleuven.be&#x2F;ecrypt&#x2F;provpriv2012&#x2F;abstracts&#x2F;canard.pdf&lt;&#x2F;li&gt;
&lt;li&gt;Apple. Secure Enclaves. https:&#x2F;&#x2F;developer.apple.com&#x2F;documentation&#x2F;security&#x2F;certificate_key_and_trust_services&#x2F;keys&#x2F;storing_keys_in_the_secure_enclave&lt;&#x2F;li&gt;
&lt;li&gt;Intel Software Guard Extensions. https:&#x2F;&#x2F;software.intel.com&#x2F;en-us&#x2F;sgx&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Money Streaming</title>
        <published>2018-11-24T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Paul Berg</name><uri>https://github.com/PaulRBerg</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1620/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/1620" />
        

        <id>https://wg-eips.ritovision.com/1620/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1620"
            label="ERC-1620" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1620/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Money streaming represents the idea of continuous payments over a finite period of time. Block numbers are used as a proxy of time to continuously update balances.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The following describes a standard whereby time is measured using block numbers and streams are mappings in a master contract.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;A provider sets up a money streaming contract.&lt;&#x2F;li&gt;
&lt;li&gt;A prospective payer can interact with the contract and start the stream right away by depositing the funds required for the chosen period.&lt;&#x2F;li&gt;
&lt;li&gt;The payee is able to withdraw money from the contract based on its ongoing solvency. That is: &lt;code&gt;payment rate * (current block height - starting block height)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;The stream terms (payment rate, length, metadata) can be updated at any time if both parties pledge their signatures.&lt;&#x2F;li&gt;
&lt;li&gt;The stream can be stopped at any point in time by any party without on-chain consensus.&lt;&#x2F;li&gt;
&lt;li&gt;If the stream period ended and it was not previously stopped by any party, the payee is entitled to withdraw all the deposited funds.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This standardised interface aims to change the way we think about long-term financial commitments. Thanks to blockchains, payments need not be sent in chunks (e.g. monthly salaries), as there is much less overhead in paying-as-you-go. Money as a function of time would better align incentives in a host of scenarios.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;use-cases&quot;&gt;Use Cases&lt;&#x2F;h3&gt;
&lt;p&gt;This is just a preliminary list of use cases. There are other spooky ideas interesting to explore, such as time-dependent disincetivisation, but, for brevity, we have not included them here.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Salaries&lt;&#x2F;li&gt;
&lt;li&gt;Subscriptions&lt;&#x2F;li&gt;
&lt;li&gt;Consultancies&lt;&#x2F;li&gt;
&lt;li&gt;CDPs&lt;&#x2F;li&gt;
&lt;li&gt;Rent&lt;&#x2F;li&gt;
&lt;li&gt;Parking&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;crowdsales&quot;&gt;Crowdsales&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;lukso-network&#x2F;rico&quot;&gt;RICOs&lt;&#x2F;a&gt;, or Reversible ICOs, were introduced at Devcon4 by @frozeman. The idea is to endow investors with more power and safety guarantees by allowing them to &quot;reverse&quot; the investment based on the evolution of the project. We previously discussed a similar concept called SICOs, or Streamable ICOs, in this research &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethresear.ch&#x2F;t&#x2F;chronos-a-quirky-application-proposal-for-plasma&#x2F;2928&#x2F;14?u=paulrberg&quot;&gt;thread&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Instead of investing a lump sum and giving the money away to the project developers, funds are held in a smart contract which allocates money based on the passage of time. Project developers can withdraw funds as the stream stays active, while investors have the power to get back a significant percentage of their initial commitment if the project halts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;structs&quot;&gt;Structs&lt;&#x2F;h3&gt;
&lt;p&gt;The structure of a &lt;code&gt;stream&lt;&#x2F;code&gt; should be as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;stream&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;sender&lt;&#x2F;code&gt;: the &lt;code&gt;address&lt;&#x2F;code&gt; of the entity funding the stream&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;recipient&lt;&#x2F;code&gt;: the &lt;code&gt;address&lt;&#x2F;code&gt; where the money is being delivered to&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;tokenAddress&lt;&#x2F;code&gt;: the &lt;code&gt;address&lt;&#x2F;code&gt; of the ERC20 token used as payment asset&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;balance&lt;&#x2F;code&gt;: the total funds left in the stream&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;timeframe&lt;&#x2F;code&gt;: as defined below&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;rate&lt;&#x2F;code&gt;: as defined below&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Stream&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; balance&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Timeframe timeframe&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Rate rate&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;timeframe&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;start&lt;&#x2F;code&gt;: the starting block number of the stream&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;stop&lt;&#x2F;code&gt;: the stopping block number of the stream&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Timeframe&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; start&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; stop&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;rate&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;payment&lt;&#x2F;code&gt;: how much money moves from &lt;code&gt;sender&lt;&#x2F;code&gt; to &lt;code&gt;recipient&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;interval&lt;&#x2F;code&gt;: how often &lt;code&gt;payment&lt;&#x2F;code&gt; moves from &lt;code&gt;sender&lt;&#x2F;code&gt; to &lt;code&gt;recipient&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Rate&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span&gt; payment&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span&gt; interval&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;hr &#x2F;&gt;
&lt;h3 id=&quot;methods&quot;&gt;Methods&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;balanceof&quot;&gt;balanceOf&lt;&#x2F;h4&gt;
&lt;p&gt;Returns available funds for the given stream id and address.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _streamId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;getstream&quot;&gt;getStream&lt;&#x2F;h4&gt;
&lt;p&gt;Returns the full stream data, if the id points to a valid stream.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getStream&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _streamId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; balance&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; startBlock&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; stopBlock&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; payment&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interval&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;create&quot;&gt;create&lt;&#x2F;h4&gt;
&lt;p&gt;Creates a new stream between &lt;code&gt;msg.sender&lt;&#x2F;code&gt; and &lt;code&gt;_recipient&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;MUST allow senders to create multiple streams in parallel. SHOULD not accept Ether and only use ERC20-compatible tokens.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Triggers Event&lt;&#x2F;strong&gt;: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1620&#x2F;#logcreate&quot;&gt;LogCreate&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; create&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _recipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _startBlock&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _stopBlock&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _payment&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _interval&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;withdraw&quot;&gt;withdraw&lt;&#x2F;h4&gt;
&lt;p&gt;Withdraws all or a fraction of the available funds.&lt;&#x2F;p&gt;
&lt;p&gt;MUST allow only the recipient to perform this action.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Triggers Event&lt;&#x2F;strong&gt;: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1620&#x2F;#logwithdraw&quot;&gt;LogWithdraw&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; withdraw&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _streamId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _funds&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;redeem&quot;&gt;redeem&lt;&#x2F;h4&gt;
&lt;p&gt;Redeems the stream by distributing the funds to the sender and the recipient.&lt;&#x2F;p&gt;
&lt;p&gt;SHOULD allow any party to redeem the stream.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Triggers Event&lt;&#x2F;strong&gt;: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1620&#x2F;#logredeem&quot;&gt;LogRedeem&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; redeem&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _streamId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;confirmupdate&quot;&gt;confirmUpdate&lt;&#x2F;h4&gt;
&lt;p&gt;Signals one party&#x27;s willingness to update the stream&lt;&#x2F;p&gt;
&lt;p&gt;SHOULD allow any party to do this but MUST NOT be executed without consent from all involved parties.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Triggers Event&lt;&#x2F;strong&gt;: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1620&#x2F;#logconfirmupdate&quot;&gt;LogConfirmUpdate&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Triggers Event&lt;&#x2F;strong&gt;: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1620&#x2F;#logexecuteupdate&quot;&gt;LogExecuteUpdate&lt;&#x2F;a&gt; when the last involved party calls this function&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; update&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _streamId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _stopBlock&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _payment&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _interval&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;revokeupdate&quot;&gt;revokeUpdate&lt;&#x2F;h4&gt;
&lt;p&gt;Revokes an update proposed by one of the involved parties.&lt;&#x2F;p&gt;
&lt;p&gt;MUST allow any party to do this.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Triggers Event&lt;&#x2F;strong&gt;: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1620&#x2F;#logrevokeupdate&quot;&gt;LogRevokeUpdate&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; confirmUpdate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _streamId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _stopBlock&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _payment&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _interval&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;hr &#x2F;&gt;
&lt;h3 id=&quot;events&quot;&gt;Events&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;logcreate&quot;&gt;LogCreate&lt;&#x2F;h4&gt;
&lt;p&gt;MUST be triggered when &lt;code&gt;create&lt;&#x2F;code&gt; is successfully called.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; LogCreate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _streamId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _sender&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _recipient&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _startBlock&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _stopBlock&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _payment&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _interval&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;logwithdraw&quot;&gt;LogWithdraw&lt;&#x2F;h4&gt;
&lt;p&gt;MUST be triggered when &lt;code&gt;withdraw&lt;&#x2F;code&gt; is successfully called.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; LogWithdraw&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _streamId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _recipient&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _funds&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;logredeem&quot;&gt;LogRedeem&lt;&#x2F;h4&gt;
&lt;p&gt;MUST be triggered when &lt;code&gt;redeem&lt;&#x2F;code&gt; is successfully called.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; LogRedeem&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _streamId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _sender&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _recipient&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _senderBalance&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _recipientBalance&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;logconfirmupdate&quot;&gt;LogConfirmUpdate&lt;&#x2F;h4&gt;
&lt;p&gt;MUST be triggered when &lt;code&gt;confirmUpdate&lt;&#x2F;code&gt; is successfully called.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; LogConfirmUpdate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _streamId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _confirmer&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _newTokenAddress&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _newStopBlock&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _newPayment&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _newInterval&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;logrevokeupdate&quot;&gt;LogRevokeUpdate&lt;&#x2F;h4&gt;
&lt;p&gt;MUST be triggered when &lt;code&gt;revokeUpdate&lt;&#x2F;code&gt; is successfully called.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; LogRevokeUpdate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _streamId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; revoker&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _newTokenAddress&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _newStopBlock&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _newPayment&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _newInterval&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;logexecuteupdate&quot;&gt;LogExecuteUpdate&lt;&#x2F;h4&gt;
&lt;p&gt;MUST be triggered when an update is approved by all involved parties.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; LogExecuteUpdate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _newStreamId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _sender&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _recipient&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _newTokenAddress&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _newStopBlock&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _newPayment&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _newInterval&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This specification was designed to serve as an entry point to the quirky concept of money as a function of time and it is definitely not set in stone. Several other designs, including payment channels and Plasma chains were also considered, but they were eventually deemed dense in assumptions unnecessary for an initial version.&lt;&#x2F;p&gt;
&lt;!--
- Block times and oracles for time calculation
    - GCD
    - Miners
- Sidechain-compatible (and preferable)
- The `update` function
- Multi-hop streams
--&gt;
&lt;p&gt;Block times are a reasonable, trustless proxy for time on the blockchain. Between 2016 and 2018, the Ethereum block time average value &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;etherscan.io&#x2F;chart&#x2F;blocktime&quot;&gt;hovered&lt;&#x2F;a&gt; around 14 seconds, excluding the last two quarters of 2017. Mathematically speaking, it would be ideal to have a standard deviation as close to 0 as possible, but that is not how things work in the real world. This has huge implications on the feasibility of this ERC which we shall investigate below.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gcd&quot;&gt;GCD&lt;&#x2F;h3&gt;
&lt;p&gt;When setting up a stream, a payer and a payee may want to make the total streaming duration a multiple of the &quot;greatest common denominator&quot; (GCD) of the chain they operate on; that is, the average block time. This is not imperative in the smart contracts per se, but there needs to be an off-chain process to map streams to real world time units in order to create a sound and fair payment mechanism.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;block-times&quot;&gt;Block Times&lt;&#x2F;h3&gt;
&lt;p&gt;Because there is uncertainty regarding block times, streams may not be settled on the blockchain as initially planned. Let &lt;code&gt;$d&lt;&#x2F;code&gt; be the total streaming duration measured in seconds, &lt;code&gt;$t&lt;&#x2F;code&gt; the average block time before the stream started and &lt;code&gt;$t&#x27;&lt;&#x2F;code&gt; the actual average block time over &lt;code&gt;$d&lt;&#x2F;code&gt; after the stream started. We distinguish two undesirable scenarios:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;$t&lt;&#x2F;code&gt; &amp;lt; &lt;code&gt;$t&#x27;&lt;&#x2F;code&gt;: the payee will get their funds &lt;em&gt;later&lt;&#x2F;em&gt; than expected&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;$t&lt;&#x2F;code&gt; &amp;gt; &lt;code&gt;$t&#x27;&lt;&#x2F;code&gt;: the payee will get their funds &lt;em&gt;sooner&lt;&#x2F;em&gt; than expected&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;If the combined error delta is smaller than the payment rate (fifth parameter of the &lt;code&gt;create&lt;&#x2F;code&gt; method, measured in wei), there is no problem at all. Conversely, we stumble upon trust issues because real-world time frames do not correspond to the stream terms. For instance, if an employee is normally entitled to withdraw all the funds from the stream at the end of the month, but block times cause case 1 from above to occur, the employee is in a financial disadvantage because their continuous effort is not compensated as promised.&lt;&#x2F;p&gt;
&lt;p&gt;Limiting the problem scope only to Ethereum, we propose two remedies:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Consensus on calling the &lt;code&gt;update&lt;&#x2F;code&gt; function to correct the stream terms. This might sound preposterous, but in most cases the stakes are low and stream participants are involved in long-term financial commitments. There is a high disincentive to refuse to cooperate.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Autonomously fix significant error deltas. In theory, we could achieve this using previous blocks&#x27; timestamps, &quot;checkpointing&quot; the stream once in a predefined number of blocks. This is still an area of active research because of potentially high overheads in gas costs.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Nonetheless, it is important to note that this is still a major improvement on the traditional model where absolute trust is required.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;sidechains&quot;&gt;Sidechains&lt;&#x2F;h3&gt;
&lt;p&gt;It could be more efficient to implement this standard on independent sidechains like &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;poa.network&quot;&gt;POA Network&lt;&#x2F;a&gt; or &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;medium.com&#x2F;poa-network&#x2F;poa-network-partners-with-makerdao-on-xdai-chain-the-first-ever-usd-stable-blockchain-65a078c41e6a&quot;&gt;xDai&lt;&#x2F;a&gt; - thanks to their rather predictable nature. Admittedly, security is traded for scalability, but proper cryptoeconomic stakes could alleviate potential problems.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore, it is intriguing to explore the prospect of stream-specific sidechains.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;oracles&quot;&gt;Oracles&lt;&#x2F;h3&gt;
&lt;p&gt;The proposed specification uses block numbers to proxy time, but this need not be the only method. Albeit it would imply different trust assumptions, oracles could be used to provide a feed of timestamps. Coupled with the aforementioned idea of stream-specific sidechains, oracles could efficiently solve the problems outlined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1620&#x2F;#block-times&quot;&gt;Block Times&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;multi-hop-streams&quot;&gt;Multi-Hop Streams&lt;&#x2F;h3&gt;
&lt;p&gt;Future or upgraded versions of this standard may describe &quot;multi-hop&quot; streams. If:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;There is a stream between A and B&lt;&#x2F;li&gt;
&lt;li&gt;There is another stream between B and C&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;There could be a way to avoid running two different streams in parallel. That is, a fraction or all of the funds being streamed from A to B could be automatically wired to C. An interesting use case for this is taxes. Instead of manually moving money around, proactively calculating how much you owe and then transfer it, a stream could atomically perform those operations for you.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ChronosProtocol&#x2F;monorepo&quot;&gt;ChronosProtocol WIP implementation&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;additional-references&quot;&gt;Additional References&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethresear.ch&#x2F;t&#x2F;chronos-a-quirky-application-proposal-for-plasma&#x2F;2928?u=paulrberg&quot;&gt;Chronos Protocol Ethresear.ch Plasma Proposal&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;http:&#x2F;&#x2F;chronosprotocol.org&#x2F;chronos-white-paper.pdf&quot;&gt;Chronos Protocol White Paper&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;devpost.com&#x2F;software&#x2F;flipper-3gvl4b&quot;&gt;Flipper: Streaming Salaries @ CryptoLife Hackathon&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethresear.ch&#x2F;t&#x2F;chronos-a-quirky-application-proposal-for-plasma&#x2F;2928&#x2F;14?u=paulrberg&quot;&gt;SICOs or Streamed ICOs&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;twitter.com&#x2F;feindura&#x2F;status&#x2F;1058057076306518017&quot;&gt;RICOs or Reversible ICOs&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=gF_ZQ_eijPs&quot;&gt;Andreas Antonopoulos&#x27; Keynote on Bitcoin, Lightning and Money Streaming&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;final-notes&quot;&gt;Final Notes&lt;&#x2F;h2&gt;
&lt;p&gt;Many thanks to @mmilton41 for countless brainstorming sessions. We have been doing research on the topic of money streaming for quite a while within the context of @ChronosProtocol. In August this year, we published the first version of our white paper describing a Plasma approach. However, in the meantime, we realised that it would be much more &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;twitter.com&#x2F;PaulRBerg&#x2F;status&#x2F;1056595919116910592&quot;&gt;fun&lt;&#x2F;a&gt; and easier to start small on Ethereum itself and sidechains like &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;blockscout.com&#x2F;poa&#x2F;dai&quot;&gt;xDai&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Attribute Registry Standard</title>
        <published>2018-11-23T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>0age</name><uri>https://github.com/0age</uri>
	</author>
	
	<author>
		<name>Santiago Palladino</name><uri>https://github.com/spalladino</uri>
	</author>
	
	<author>
		<name>Leo Arias</name><uri>https://github.com/elopio</uri>
	</author>
	
	<author>
		<name>Alejo Salles</name><uri>https://github.com/fiiiu</uri>
	</author>
	
	<author>
		<name>Stephane Gosselin</name><uri>https://github.com/thegostep</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1616/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/1616" />
        

        <id>https://wg-eips.ritovision.com/1616/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:1616"
            label="ERC-1616" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1616/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;EIP-1616 provides a basic interface for querying a registry for attribute metadata assigned to Ethereum accounts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP contains the following core ideas:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Instead of relying directly on the reputation of a claims issuer to assess the veracity of a given claim, trust can be brought up to the level of a registry curator. This registry which we call an &quot;&lt;strong&gt;Attribute Registry&lt;&#x2F;strong&gt;&quot; allows for reduced complexity in implementation since a party needing to verify an attribute can now work with a trusted claims aggregator instead of relying on individual claim providers.&lt;&#x2F;li&gt;
&lt;li&gt;Claims are abstracted as standard &quot;attributes&quot; which represent metadata assigned to an account, with claims decoupled from the issuing party. Attributes are registered as a flat &lt;code&gt;uint256 -&amp;gt; uint256&lt;&#x2F;code&gt; key-value pair on each account, with the important property that &lt;strong&gt;each attribute type has one canonical value per address&lt;&#x2F;strong&gt;. This property allows for composability of attribute registries and advanced attribute formation.&lt;&#x2F;li&gt;
&lt;li&gt;There is a generic method for determining the set of attribute keys or IDs made available by the registry. The standard does not specify requirements or recommendations for how attributes and their values are managed, or what additional metadata may be associated with attributes. It is likely that a standard set of attribute names and metadata schema could be proposed in a separate EIP.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Potential advanced uses of attribute registries include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Encoding complex boolean expressions which combine multiple attributes into a single uint256 key, which is then parsed and evaluated by the registry logic.&lt;&#x2F;li&gt;
&lt;li&gt;Using values associated with an attribute to query additional on-chain or off-chain metadata.&lt;&#x2F;li&gt;
&lt;li&gt;Resolving attribute values by calling into separate attribute registries or other contracts, delegating authority without changing the interface of the registry.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is motivated by the need for contracts and external accounts to be able to verify information about a given address from a single trusted source &lt;strong&gt;without concerning themselves with the particular details of how the information was obtained&lt;&#x2F;strong&gt;, and to do so in as simple a manner as possible. It is also motivated by the desire to promote broad &lt;strong&gt;cross-compatibility and composability&lt;&#x2F;strong&gt; between attribute registries, a property which is amplified by both the simplicity of the interface as well as by the guarantees on uniqueness provided by the proposed standard.&lt;&#x2F;p&gt;
&lt;p&gt;Existing EIPs for assigning metadata to an account include EIP-735 and EIP-780, which both allow for multiple claims to be issued on the same address for any given claim topic. This forces verifiers of said metadata to assess the veracity of each claim, taking into account the relative reputation of each claim issuer. It also prescribes a methodology for adding and removing claims, which may not be appropriate for all use cases.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP proposes a light-weight abstraction layer for a standard account metadata registry interface. This abstraction layer can sit on top of claims registries like EIP-735 and EIP-780 or others as the attribute registry curator selects trusted data sources.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The Attribute Registry interface contains four functions, outlined as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; EIP-1616 Attribute Registry Standard interface. EIP-165 ID: 0x5f46473f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AttributeRegistryInterface&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; hasAttribute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attributeTypeID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getAttributeValue&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attributeTypeID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; countAttributeTypes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getAttributeTypeID&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Contracts that comply with the Attribute Registry EIP MUST implement the above interface.&lt;&#x2F;p&gt;
&lt;p&gt;As an additional requirement, the ERC-165 interface MUST be included:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; EIP-165 interface. EIP-165 ID: 0x01ffc9a7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EIP&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;165&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; EIP-165 support. Attribute Registry interface ID is 0x5f46473f.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _interfaceID&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The interface identifier, as specified in EIP-165&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; True&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; for 0x01ffc9a7 &amp;amp; 0x5f46473f, false for unsupported interfaces.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _interfaceID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The implementation MUST follow the specifications described below.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;view-functions&quot;&gt;View Functions&lt;&#x2F;h3&gt;
&lt;p&gt;The view functions detailed below MUST be implemented.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;hasattribute-function&quot;&gt;&lt;code&gt;hasAttribute&lt;&#x2F;code&gt; function&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; hasAttribute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attributeTypeID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Check if an attribute has been assigned to a given account on the registry and is currently valid.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;NOTE&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt;: This function MUST return either true or false - i.e. calling this function MUST NOT cause the caller to revert. Implementations that wish to call into another contract during execution of this function MUST catch any &lt;code&gt;revert&lt;&#x2F;code&gt; and instead return &lt;code&gt;false&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;NOTE&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt;: This function MUST return two equal values when performing two directly consecutive function calls with identical &lt;code&gt;account&lt;&#x2F;code&gt; and &lt;code&gt;attributeTypeID&lt;&#x2F;code&gt; parameters, regardless of differences in the caller&#x27;s address, the transaction origin, or other out-of-band information.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;getattributevalue-function&quot;&gt;&lt;code&gt;getAttributeValue&lt;&#x2F;code&gt; function&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getAttributeValue&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attributeTypeID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Retrieve the &lt;code&gt;uint256&lt;&#x2F;code&gt; value of an attribute on a given account on the registry, assuming the attribute is currently valid.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;NOTE&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt;: This function MUST revert if a directly preceding or subsequent function call to &lt;code&gt;hasAttribute&lt;&#x2F;code&gt; with identical &lt;code&gt;account&lt;&#x2F;code&gt; and &lt;code&gt;attributeTypeID&lt;&#x2F;code&gt; parameters would return false.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;NOTE&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt;: This function MUST return two equal values when performing two directly consecutive function calls with identical &lt;code&gt;account&lt;&#x2F;code&gt; and &lt;code&gt;attributeTypeID&lt;&#x2F;code&gt; parameters, regardless of differences in the caller&#x27;s address, the transaction origin, or other out-of-band information.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;countattributetypes-function&quot;&gt;&lt;code&gt;countAttributeTypes&lt;&#x2F;code&gt; function&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; countAttributeTypes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Retrieve the total number of valid attribute types defined on the registry. Used alongside &lt;code&gt;getAttributeTypeID&lt;&#x2F;code&gt; to determine all of the attribute types that are available on the registry.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;NOTE&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt;: This function MUST return a positive integer value  - i.e. calling this function MUST NOT cause the caller to revert.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;NOTE&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt;: This function MUST return a value that encompasses all indexes of attribute type IDs whereby a call to &lt;code&gt;hasAttribute&lt;&#x2F;code&gt; on some address with an attribute type ID at the given index would return &lt;code&gt;true&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;getattributetypeid-function&quot;&gt;&lt;code&gt;getAttributeTypeID&lt;&#x2F;code&gt; function&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getAttributeTypeID&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Retrieve an ID of an attribute type defined on the registry by index. Used alongside &lt;code&gt;countAttributeTypes&lt;&#x2F;code&gt; to determine all of the attribute types that are available on the registry.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;NOTE&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt;: This function MUST revert if the provided &lt;code&gt;index&lt;&#x2F;code&gt; value falls outside of the range of the value returned from a directly preceding or subsequent function call to &lt;code&gt;countAttributeTypes&lt;&#x2F;code&gt;. It MUST NOT revert if the provided &lt;code&gt;index&lt;&#x2F;code&gt; value falls inside said range.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;NOTE&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt;: This function MUST return an &lt;code&gt;attributeTypeID&lt;&#x2F;code&gt; value on &lt;em&gt;some&lt;&#x2F;em&gt; index if the same &lt;code&gt;attributeTypeID&lt;&#x2F;code&gt; value would cause a given call to &lt;code&gt;hasAttribute&lt;&#x2F;code&gt; to return &lt;code&gt;true&lt;&#x2F;code&gt; when passed as a parameter.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This standard extends the applicability of metadata assignment to those use cases that are not adequately represented by EIP-735, EIP-780, or similar proposals. Namely, it enforces the constraint of one attribute value per attribute ID per address, as opposed to one value per ID per address &lt;em&gt;per issuer&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Aside from the prescribed attribute value, attribute properties are deliberately omitted from the standard. While many attribute registries will require additional metadata on attributes at both the instance and the class level, reliable and flexible interoperability between highly variable registry extensions is facilitated more effectively by enforcing a widely-applicable base layer for attributes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;There are no backwards compatibility concerns.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Targeted test cases with 100% code coverage can be found at &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;0age&#x2F;AttributeRegistry&quot;&gt;this repository&lt;&#x2F;a&gt;. See &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;TPL-protocol&#x2F;tpl-contracts&quot;&gt;here&lt;&#x2F;a&gt; for tests on a more complex contract that implements the application registry interface.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The basic implementation that follows can be found at &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;0age&#x2F;AttributeRegistry&quot;&gt;this repository&lt;&#x2F;a&gt; (see &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;TPL-protocol&#x2F;tpl-contracts&#x2F;blob&#x2F;master&#x2F;contracts&#x2F;BasicJurisdiction.sol#L399&quot;&gt;here&lt;&#x2F;a&gt; for an example of a more complex implementing contract):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.4.25&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Attribute Registry interface. EIP-165 ID: 0x5f46473f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AttributeRegistryInterface&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check if an attribute of the type with ID `attributeTypeID` has&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * been assigned to the account at `account` and is currently valid.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address The account to check for a valid attribute.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; attributeTypeID&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; uint256 The ID of the attribute type to check for.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; True&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if the attribute is assigned and valid, false otherwise.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function MUST return either true or false - i.e. calling this&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * function MUST NOT cause the caller to revert.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; hasAttribute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attributeTypeID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieve the value of the attribute of the type with ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * `attributeTypeID` on the account at `account`, assuming it is valid.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address The account to check for the given attribute value.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; attributeTypeID&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; uint256 The ID of the attribute type to check for.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; attribute value if the attribute is valid, reverts otherwise.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function MUST revert if a directly preceding or subsequent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * function call to `hasAttribute` with identical `account` and&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * `attributeTypeID` parameters would return false.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getAttributeValue&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attributeTypeID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Count the number of attribute types defined by the registry.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; number of available attribute types.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function MUST return a positive integer value  - i.e. calling&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * this function MUST NOT cause the caller to revert.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; countAttributeTypes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the ID of the attribute type at index `index`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; index&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; uint256 The index of the attribute type in &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;question&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the attribute type.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function MUST revert if the provided `index` value falls outside&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * of the range of the value returned from a directly preceding or subsequent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * function call to `countAttributeTypes`. It MUST NOT revert if the provided&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * `index` value falls inside said range.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getAttributeTypeID&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A simple example of an Attribute Registry implementation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AttributeRegistry&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AttributeRegistryInterface&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This particular implementation just defines two attribute types.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Affiliation&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt; Whitehat&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt; Blackhat&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Top-level information about attribute types held in a static array.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _attributeTypeIDs&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The number of attributes currently issued tracked in a static array.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _issuedAttributeCounters&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Issued attributes held in a nested mapping by account &amp;amp; attribute type.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _issuedAttributes&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Issued attribute values held in a nested mapping by account &amp;amp; type.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _issuedAttributeValues&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The constructor function, defines the two attribute types available&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * on this particular registry.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Set the attribute type IDs for whitehats (8008) and blackhats (1337).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    _attributeTypeIDs &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;8008&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1337&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Assign a &amp;quot;whitehat&amp;quot; attribute type to `msg.sender`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The function may not be called by accounts with a &amp;quot;blackhat&amp;quot; attribute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * type already assigned. This function is arbitrary and not part of the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * Attribute Registry specification.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; joinWhitehats&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the index of the blackhat attribute type on the attribute registry.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; blackhatIndex &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;Affiliation&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;Blackhat&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the attribute type ID of the blackhat attribute type.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; blackhatAttributeTypeID &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _attributeTypeIDs&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;blackhatIndex&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Do not allow the whitehat attribute to be set if blackhat is already set.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      !&lt;&#x2F;span&gt;&lt;span&gt;_issuedAttributes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;blackhatAttributeTypeID&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;      &amp;quot;no blackhats allowed!&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the index of the whitehat attribute type on the attribute registry.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; whitehatIndex &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;Affiliation&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;Whitehat&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the attribute type ID of the whitehat attribute type.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; whitehatAttributeTypeID &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _attributeTypeIDs&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;whitehatIndex&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Mark the attribute as issued on the given address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    _issuedAttributes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;whitehatAttributeTypeID&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Calculate the new number of total whitehat attributes.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; incrementCounter &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _issuedAttributeCounters&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;whitehatIndex&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Set the attribute value to the new total assigned whitehat attributes.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    _issuedAttributeValues&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;whitehatAttributeTypeID&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; incrementCounter&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Update the value of the counter for total whitehat attributes.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    _issuedAttributeCounters&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;whitehatIndex&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; incrementCounter&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Assign a &amp;quot;blackhat&amp;quot; attribute type to `msg.sender`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The function may be called by any account, but assigned &amp;quot;whitehat&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * attributes will be removed. This function is arbitrary and not part of the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * Attribute Registry specification.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; joinBlackhats&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the index of the blackhat attribute type on the attribute registry.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; blackhatIndex &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;Affiliation&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;Blackhat&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the attribute type ID of the blackhat attribute type.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; blackhatAttributeTypeID &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _attributeTypeIDs&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;blackhatIndex&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Mark the attribute as issued on the given address.    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    _issuedAttributes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;blackhatAttributeTypeID&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Calculate the new number of total blackhat attributes.    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; incrementCounter &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _issuedAttributeCounters&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;blackhatIndex&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Set the attribute value to the new total assigned blackhat attributes.    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    _issuedAttributeValues&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;blackhatAttributeTypeID&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; incrementCounter&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Update the value of the counter for total blackhat attributes.    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    _issuedAttributeCounters&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;blackhatIndex&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; incrementCounter&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the index of the whitehat attribute type on the attribute registry.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; whitehatIndex &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;Affiliation&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;Whitehat&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the attribute type ID of the whitehat attribute type.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; whitehatAttributeTypeID &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _attributeTypeIDs&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;whitehatIndex&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Determine if a whitehat attribute type has been assigned.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;_issuedAttributes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;whitehatAttributeTypeID&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If so, delete the attribute.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      delete&lt;&#x2F;span&gt;&lt;span&gt; _issuedAttributes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;whitehatAttributeTypeID&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Delete the attribute value as well.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      delete&lt;&#x2F;span&gt;&lt;span&gt; _issuedAttributeValues&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;whitehatAttributeTypeID&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Set the attribute value to the new total assigned whitehat attributes.      &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      uint256&lt;&#x2F;span&gt;&lt;span&gt; decrementCounter &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _issuedAttributeCounters&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;whitehatIndex&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Update the value of the counter for total whitehat attributes.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      _issuedAttributeCounters&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;whitehatIndex&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; decrementCounter&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the total number of assigned whitehat and blackhat attributes.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Array&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; with counts of assigned whitehat and blackhat attributes.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function is arbitrary and not part of the Attribute Registry&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * specification.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalHats&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Return the array containing counter values.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; _issuedAttributeCounters&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check if an attribute of the type with ID `attributeTypeID` has&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * been assigned to the account at `account` and is currently valid.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address The account to check for a valid attribute.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; attributeTypeID&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; uint256 The ID of the attribute type to check for.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; True&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if the attribute is assigned and valid, false otherwise.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function MUST return either true or false - i.e. calling this&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * function MUST NOT cause the caller to revert.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; hasAttribute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attributeTypeID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Return assignment status of attribute by account and attribute type ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; _issuedAttributes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;attributeTypeID&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieve the value of the attribute of the type with ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * `attributeTypeID` on the account at `account`, assuming it is valid.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address The account to check for the given attribute value.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; attributeTypeID&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; uint256 The ID of the attribute type to check for.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; attribute value if the attribute is valid, reverts otherwise.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function MUST revert if a directly preceding or subsequent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * function call to `hasAttribute` with identical `account` and&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * `attributeTypeID` parameters would return false.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getAttributeValue&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attributeTypeID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Revert if attribute with given account &amp;amp; attribute type ID is unassigned&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      _issuedAttributes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;attributeTypeID&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;      &amp;quot;could not find a value with the provided account and attribute type ID&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Return the attribute value.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; _issuedAttributeValues&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;attributeTypeID&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Count the number of attribute types defined by the registry.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; number of available attribute types.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function MUST return a positive integer value  - i.e. calling&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * this function MUST NOT cause the caller to revert.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; countAttributeTypes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Return the length of the attribute type IDs array.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; _attributeTypeIDs&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the ID of the attribute type at index `index`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; index&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; uint256 The index of the attribute type in &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;question&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ID of the attribute type.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function MUST revert if the provided `index` value falls outside&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * of the range of the value returned from a directly preceding or subsequent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * function call to `countAttributeTypes`. It MUST NOT revert if the provided&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * `index` value falls inside said range.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getAttributeTypeID&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Revert if the provided index is out of range.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      index &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; _attributeTypeIDs&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;      &amp;quot;provided index is outside of the range of defined attribute type IDs&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Return the attribute type ID at the given index in the array.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; _attributeTypeIDs&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Gas stations network</title>
        <published>2018-11-18T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Yoav Weiss</name><email>yoav@tabookey.com</email>
	</author>
	
	<author>
		<name>Dror Tirosh</name><email>dror@tabookey.com</email>
	</author>
	
	<author>
		<name>Alex Forshtat</name><email>alex@tabookey.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1613/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/yoav-tabookey/EIPs/issues/1" />
        

        <id>https://wg-eips.ritovision.com/1613/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1613"
            label="ERC-1613" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1613/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Make smart contracts (e.g. dapps) accessible to non-ether users by allowing contracts to accept &quot;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Collect_call&quot;&gt;collect-calls&lt;&#x2F;a&gt;&quot;, paying for incoming calls.
Let contracts &quot;listen&quot; on publicly accessible channels (e.g. web URL or a whisper address).
Incentivize nodes to run &quot;gas stations&quot; to facilitate this.
Require no network changes, and minimal contract changes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Communicating with dapps currently requires paying ETH for gas, which limits dapp adoption to ether users.
Therefore, contract owners may wish to pay for the gas to increase user acquisition, or let their users pay for gas with fiat money.
Alternatively, a 3rd party may wish to subsidize the gas costs of certain contracts.
Solutions such as described in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1077&#x2F;&quot;&gt;EIP-1077&lt;&#x2F;a&gt; could allow transactions from addresses that hold no ETH.&lt;&#x2F;p&gt;
&lt;p&gt;The gas stations network is an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1077&#x2F;&quot;&gt;EIP-1077&lt;&#x2F;a&gt; compliant effort to solve the problem by creating an incentive for nodes to run gas stations, where gasless transactions can be &quot;fueled up&quot;.
It abstracts the implementation details from both the dapp maintainer and the user, making it easy to convert existing dapps to accept &quot;collect-calls&quot;.&lt;&#x2F;p&gt;
&lt;p&gt;The network consists of a single public contract trusted by all participating dapp contracts, and a decentralized network of relay nodes (gas stations) incentivized to listen on non-ether interfaces such as web or whisper,
pay for transactions and get compensated by that contract. The trusted contract can be verified by anyone, and the system is otherwise trustless.
Gas stations cannot censor transactions as long as there&#x27;s at least one honest gas station. Attempts to undermine the system can be proven on-chain and offenders can be penalized.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Increase user adoption of smart contracts by:
&lt;ul&gt;
&lt;li&gt;Removing the user hassle of acquiring ETH. Transactions are still paid by ETH but costs can be borne by the dapp or paid by the user through other means.&lt;&#x2F;li&gt;
&lt;li&gt;Removing the need to interact directly with the blockchain, while maintaining decentralization and censorship-resistance.
Contracts can &quot;listen&quot; on multiple public channels, and users can interact with the contracts through common protocols that are generally permitted even in restrictive environments.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Ethereum nodes get a revenue source without requiring mining equipment. The entire network benefits from having more nodes.&lt;&#x2F;li&gt;
&lt;li&gt;No protocol changes required. The gas station network is self-organized via a smart contract, and dapps interact with the network by implementing an interface.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The system consists of a &lt;code&gt;RelayHub&lt;&#x2F;code&gt; singleton contract, participating contracts inheriting the &lt;code&gt;RelayRecipient&lt;&#x2F;code&gt; contract, a decentralized network of &lt;code&gt;Relay&lt;&#x2F;code&gt; nodes, a.k.a. Gas Stations,
and user applications (e.g. mobile or web) interacting with contracts via relays.&lt;&#x2F;p&gt;
&lt;p&gt;Roles of the &lt;code&gt;RelayHub&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Maintain a list of active relays. Senders select a &lt;code&gt;Relay&lt;&#x2F;code&gt; from this list for each transaction. The selection process is discussed below.&lt;&#x2F;li&gt;
&lt;li&gt;Mediate all communication between relays and contracts.&lt;&#x2F;li&gt;
&lt;li&gt;Provide contracts with trusted versions of the real msg.sender and msg.data.&lt;&#x2F;li&gt;
&lt;li&gt;Hold ETH stakes placed by relays. A minimum stake size is enforced.  Stake can be withdrawn after a relay unregisters and waits for a cooldown period.&lt;&#x2F;li&gt;
&lt;li&gt;Hold ETH prepayments made by contracts and use them to compensate relays.&lt;&#x2F;li&gt;
&lt;li&gt;Penalize provably-offensive relays by giving their stakes to an address providing the proof, thus keeping relays honest.&lt;&#x2F;li&gt;
&lt;li&gt;Provide a free way for relays to know whether they&#x27;ll be compensated for a future transaction.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Roles of a &lt;code&gt;Relay&lt;&#x2F;code&gt; node:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Maintain a hot wallet with a small amount of ETH, to pay for gas.&lt;&#x2F;li&gt;
&lt;li&gt;Provide a public interface for user apps to send gasless transactions via channels such as https or whisper.&lt;&#x2F;li&gt;
&lt;li&gt;Publish it&#x27;s public interfaces and its price (as a multiplier of the actual transaction gas cost) in &lt;code&gt;RelayHub&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Optionally monitor reverted transactions of other relays through RelayHub, catching offending relays and claiming their stakes. This can be done by anyone, not just a relay.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Implementing a &lt;code&gt;RelayRecipient&lt;&#x2F;code&gt; contract:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Know the address of &lt;code&gt;RelayHub&lt;&#x2F;code&gt; and trust it to provide information about the transaction.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Maintain a small balance of ETH gas prepayment deposit in &lt;code&gt;RelayHub&lt;&#x2F;code&gt;. Can be paid directly by the &lt;code&gt;RelayRecipient&lt;&#x2F;code&gt; contract, or by the dapp&#x27;s owner on behalf of the &lt;code&gt;RelayRecipient&lt;&#x2F;code&gt; address.
The dapp owner is responsible for ensuring sufficient balance for the next transactions, and can stop depositing if something goes wrong, thus limiting the potential for abuse of system bugs. In DAO usecases it will be up to the DAO logic to maintain a sufficient deposit.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Use &lt;code&gt;getSender()&lt;&#x2F;code&gt; and &lt;code&gt;getMessageData()&lt;&#x2F;code&gt; instead of &lt;code&gt;msg.sender&lt;&#x2F;code&gt; and &lt;code&gt;msg.data&lt;&#x2F;code&gt;, everywhere. &lt;code&gt;RelayRecipient&lt;&#x2F;code&gt; provides these functions and gets the information from &lt;code&gt;RelayHub&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Implement a &lt;code&gt;acceptRelayedCall(address relay, address from, bytes memory encodedFunction, uint gasPrice, uint transactionFee, bytes memory approval)&lt;&#x2F;code&gt; view function that returns &lt;strong&gt;zero&lt;&#x2F;strong&gt; if and only if it is willing to accept a transaction and pay for it.
&lt;code&gt;acceptRelayedCall&lt;&#x2F;code&gt; is called by &lt;code&gt;RelayHub&lt;&#x2F;code&gt; as a view function when a &lt;code&gt;Relay&lt;&#x2F;code&gt; inquires it, and also during the actual transaction. Transactions are reverted if &lt;strong&gt;non-zero&lt;&#x2F;strong&gt;, and &lt;code&gt;Relay&lt;&#x2F;code&gt; only gets compensated for transactions (whether successful or reverted) if &lt;code&gt;acceptRelayedCall&lt;&#x2F;code&gt; returns &lt;strong&gt;zero&lt;&#x2F;strong&gt;. Some examples of &lt;code&gt;acceptRelayedCall()&lt;&#x2F;code&gt; implementations:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Whitelist of trusted dapp members.&lt;&#x2F;li&gt;
&lt;li&gt;Balance sheet of registered users, maintained by the dapp owner. Users pay the dapp with a credit card or other non-ETH means, and are credited in the &lt;code&gt;RelayRecipient&lt;&#x2F;code&gt; balance sheet.
Users can never cost the dapp more than they were credited for.&lt;&#x2F;li&gt;
&lt;li&gt;A dapp can provide off-chain a signed message called &lt;code&gt;approval&lt;&#x2F;code&gt; to a transaction sender and validate it.&lt;&#x2F;li&gt;
&lt;li&gt;Whitelist of known transactions used for onboarding new users. This allows certain anonymous calls and is subject to Sybil attacks.
Therefore it should be combined with a restricted gasPrice, and a whitelist of trusted relays, to reduce the incentive for relays to create bogus transactions and rob the dapp&#x27;s prepaid gas deposit.
Dapps allowing anonymous onboarding transactions might benefit from registering their own &lt;code&gt;Relay&lt;&#x2F;code&gt; and accepting anonymous transactions only from that &lt;code&gt;Relay&lt;&#x2F;code&gt;, whereas other transactions can be accepted from any relay.
Alternatively, dapps may use the balance sheet method for onboarding as well, by applying the methods suggested in the attacks&#x2F;mitigations section below.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Implement &lt;code&gt;preRelayedCall(address relay, address from, bytes memory encodedFunction, uint transactionFee) returns (bytes32)&lt;&#x2F;code&gt;. This method is called before a transaction is relayed. By default, it does nothing.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Implement &lt;code&gt;postRelayedCall(ddress relay, address from, bytes memory encodedFunction, bool success, uint usedGas, uint transactionFee, bytes32 preRetVal)&lt;&#x2F;code&gt;. This method is called after a transaction is relayed. By default, it does nothing.&lt;&#x2F;p&gt;
&lt;p&gt;These two methods can be used to charge the user in dapp-specific manner.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Glossary of terms used in the processes below:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;RelayHub&lt;&#x2F;code&gt; - the RelayHub singleton contract, used by everyone.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Recipient&lt;&#x2F;code&gt; - a contract implementing &lt;code&gt;RelayRecipient&lt;&#x2F;code&gt;, accepting relayed transactions from the RelayHub contract and paying for the incoming transactions.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Sender&lt;&#x2F;code&gt; - an external address with a valid key pair but no ETH to pay for gas.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Relay&lt;&#x2F;code&gt; - a node holding ETH in an external address, listed in RelayHub and relaying transactions from Senders to RelayHub for a fee.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1613&#x2F;.&#x2F;assets&#x2F;sequence.png&quot; alt=&quot;Sequence Diagram&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The process of registering&#x2F;refreshing a &lt;code&gt;Relay&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Relay starts listening as a web app (or on some other communication channel).&lt;&#x2F;li&gt;
&lt;li&gt;If starting for the first time (no key yet), generate a key pair for Relay&#x27;s address.&lt;&#x2F;li&gt;
&lt;li&gt;If Relay&#x27;s address doesn&#x27;t hold sufficient funds for gas (e.g. because it was just generated), Relay stays inactive until its owner funds it.&lt;&#x2F;li&gt;
&lt;li&gt;Relay&#x27;s owner funds it.&lt;&#x2F;li&gt;
&lt;li&gt;Relay&#x27;s owner sends the required stake to &lt;code&gt;RelayHub&lt;&#x2F;code&gt; by calling &lt;code&gt;RelayHub.stake(address relay, uint unstakeDelay)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RelayHub&lt;&#x2F;code&gt; puts the &lt;code&gt;owner&lt;&#x2F;code&gt; and &lt;code&gt;unstake delay&lt;&#x2F;code&gt; in the relays map, indexed by &lt;code&gt;relay&lt;&#x2F;code&gt; address.&lt;&#x2F;li&gt;
&lt;li&gt;Relay calls &lt;code&gt;RelayHub.registerRelay(uint transactionFee, string memory url)&lt;&#x2F;code&gt; with the relay&#x27;s &lt;code&gt;transaction fee&lt;&#x2F;code&gt; (as a multiplier on transaction gas cost), and a URL for incoming transactions.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RelayHub&lt;&#x2F;code&gt; ensures that Relay has a sufficient stake.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RelayHub&lt;&#x2F;code&gt; puts the &lt;code&gt;transaction fee&lt;&#x2F;code&gt; in the relays map.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RelayHub&lt;&#x2F;code&gt; emits an event, &lt;code&gt;RelayAdded(Relay, owner, transactionFee, relayStake, unstakeDelay, url)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Relay starts a timer to perform a &lt;code&gt;keepalive&lt;&#x2F;code&gt; transaction every 6000 blocks.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Relay&lt;&#x2F;code&gt; goes to sleep and waits for signing requests.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The process of sending a relayed transaction:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Sender&lt;&#x2F;code&gt; selects a live &lt;code&gt;Relay&lt;&#x2F;code&gt; from RelayHub&#x27;s list by looking at &lt;code&gt;RelayAdded&lt;&#x2F;code&gt; events from &lt;code&gt;RelayHub&lt;&#x2F;code&gt;, and sorting based on its own criteria. Selection may be based on a mix of:
&lt;ul&gt;
&lt;li&gt;Relay published transaction fees.&lt;&#x2F;li&gt;
&lt;li&gt;Relay stake size and lock-up time.&lt;&#x2F;li&gt;
&lt;li&gt;Recent relay transactions (visible through &lt;code&gt;TransactionRelayed&lt;&#x2F;code&gt; events from &lt;code&gt;RelayHub&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;Optionally, reputation&#x2F;blacklist&#x2F;whitelist held by the sender app itself, or its backend, on per-app basis (not part of the gas stations network).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Sender prepares the transaction with Sender&#x27;s address, the recipient address, the actual transaction data, Relay&#x27;s transaction fee, gas price, gas limit, its current nonce from &lt;code&gt;RelayHub.nonces&lt;&#x2F;code&gt;, RelayHub&#x27;s address, and Relay&#x27;s address, and then signs it.&lt;&#x2F;li&gt;
&lt;li&gt;Sender verifies that &lt;code&gt;RelayHub.balances[recipient]&lt;&#x2F;code&gt; holds enough ETH to pay Relay&#x27;s fee.&lt;&#x2F;li&gt;
&lt;li&gt;Sender verifies that &lt;code&gt;Relay.balance&lt;&#x2F;code&gt; has enough eth to send the transaction&lt;&#x2F;li&gt;
&lt;li&gt;Sender reads the Relay&#x27;s current &lt;code&gt;nonce&lt;&#x2F;code&gt; value and decides on the &lt;code&gt;max_nonce&lt;&#x2F;code&gt; parameter.&lt;&#x2F;li&gt;
&lt;li&gt;Sender sends the signed transaction amd metadata to Relay&#x27;s web interface.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Relay&lt;&#x2F;code&gt; wraps the transaction with a transaction to &lt;code&gt;RelayHub&lt;&#x2F;code&gt;, with zero ETH value.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Relay&lt;&#x2F;code&gt; signs the wrapper transaction with its key in order to pay for gas.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Relay&lt;&#x2F;code&gt; verifies that:
&lt;ul&gt;
&lt;li&gt;The transaction&#x27;s recipient contract will accept this transaction when submitted, by calling &lt;code&gt;RelayHub.canRelay()&lt;&#x2F;code&gt;, a view function,
which checks the recipient&#x27;s &lt;code&gt;acceptRelayedCall&lt;&#x2F;code&gt;, also a view function, stating whether it&#x27;s willing to accept the charges).&lt;&#x2F;li&gt;
&lt;li&gt;The transaction nonce matches &lt;code&gt;RelayHub.nonces[sender]&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The relay address in the transaction matches Relay&#x27;s address.&lt;&#x2F;li&gt;
&lt;li&gt;The transaction&#x27;s recipient has enough ETH deposited in &lt;code&gt;RelayHub&lt;&#x2F;code&gt; to pay the transaction fee.&lt;&#x2F;li&gt;
&lt;li&gt;Relay has enough ETH to pay for the gas required by the transaction.&lt;&#x2F;li&gt;
&lt;li&gt;Value of &lt;code&gt;max_nonce&lt;&#x2F;code&gt; is higher than current Relay&#x27;s &lt;code&gt;nonce&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;If any of Relay&#x27;s checks fail, it returns an error to sender, and doesn&#x27;t proceed.&lt;&#x2F;li&gt;
&lt;li&gt;Relay submits the signed wrapped transaction to the blockchain.&lt;&#x2F;li&gt;
&lt;li&gt;Relay immediately returns the signed wrapped transaction to the sender.  This step is discussed below, in attacks&#x2F;mitigations.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Sender&lt;&#x2F;code&gt; receives the wrapped transaction and verifies that:
&lt;ul&gt;
&lt;li&gt;It&#x27;s a valid relay call to &lt;code&gt;RelayHub&lt;&#x2F;code&gt;. from Relay&#x27;s address.&lt;&#x2F;li&gt;
&lt;li&gt;The transaction&#x27;s ethereum nonce matches Relay&#x27;s current nonce.&lt;&#x2F;li&gt;
&lt;li&gt;The transaction&#x27;s ethereum nonce is lower than or equal to &lt;code&gt;max_nonce&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Relay&lt;&#x2F;code&gt; is sufficiently funded to pay for it.&lt;&#x2F;li&gt;
&lt;li&gt;The wrapped transaction is valid and signed by &lt;code&gt;sender&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Recipient contract has sufficient funds in &lt;code&gt;RelayHub.balances&lt;&#x2F;code&gt; to pay for Relay&#x27;s fee as stated in the transaction.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;If any of sender&#x27;s checks fails, it goes back to selecting a new Relay. Sender may also file a report on the unresponsive relay to its backend or save it locally, to down-sort this relay in future transactions.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Sender&lt;&#x2F;code&gt; may also submit the raw wrapped transaction to the blockchain without paying for gas, through any Ethereum node.
This submission is likely ignored because an identical transaction is already in the network&#x27;s pending transactions, but no harm in putting it twice, to ensure that it happens.
This step is not strictly necessary, for reasons discussed below in attacks&#x2F;mitigations, but may speed things up.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Sender&lt;&#x2F;code&gt; monitors the blockchain, waiting for the transaction to be mined.
The transaction was verified, with Relay&#x27;s current nonce, so mining must be successful unless Relay submitted another (different) transaction with the same nonce.
If mining fails due to such attack, sender may call &lt;code&gt;RelayHub.penalizeRepeatedNonce&lt;&#x2F;code&gt; through another relay, to collect his reward and burn the remainder of the offending relay&#x27;s stake, and then go back to selecting a new Relay for the transaction.
See discussion in the attacks&#x2F;mitigations section below.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RelayHub&lt;&#x2F;code&gt; receives the transaction:
&lt;ul&gt;
&lt;li&gt;Records &lt;code&gt;gasleft()&lt;&#x2F;code&gt; as &lt;code&gt;initialGas&lt;&#x2F;code&gt; for later payment.&lt;&#x2F;li&gt;
&lt;li&gt;Verifies the transaction is sent from a registered relay.&lt;&#x2F;li&gt;
&lt;li&gt;Verifies that the signature of the internal transaction matches its stated origin (sender&#x27;s key).&lt;&#x2F;li&gt;
&lt;li&gt;Verifies that the relay address written in the transaction matches msg.sender.&lt;&#x2F;li&gt;
&lt;li&gt;Verifies that the transaction&#x27;s &lt;code&gt;nonce&lt;&#x2F;code&gt; matches the stated origin&#x27;s nonce in &lt;code&gt;RelayHub.nonces&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Calls recipient&#x27;s &lt;code&gt;acceptRelayedCall&lt;&#x2F;code&gt; function, asking whether it&#x27;s going to accept the transaction. If not, the &lt;code&gt;TransactionRelayed&lt;&#x2F;code&gt; will be emitted with status &lt;code&gt;CanRelayFailed&lt;&#x2F;code&gt;, and &lt;code&gt;chargeOrCanRelayStatus&lt;&#x2F;code&gt; will contain the return value of &lt;code&gt;acceptRelayedCall&lt;&#x2F;code&gt;. In this case, Relay doesn&#x27;t get paid, as it was its responsibility to check &lt;code&gt;RelayHub.canRelay&lt;&#x2F;code&gt; before releasing the transaction.&lt;&#x2F;li&gt;
&lt;li&gt;Calls recipient&#x27;s &lt;code&gt;preRelayedCall&lt;&#x2F;code&gt; function. If this call reverts the &lt;code&gt;TransactionRelayed&lt;&#x2F;code&gt; will be emitted with status &lt;code&gt;PreRelayedFailed&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Sends the transaction to the recipient.  If this call reverts the &lt;code&gt;TransactionRelayed&lt;&#x2F;code&gt; will be emitted with status &lt;code&gt;RelayedCallFailed&lt;&#x2F;code&gt;.
When passing gas to &lt;code&gt;call()&lt;&#x2F;code&gt;, enough gas is preserved by &lt;code&gt;RelayHub&lt;&#x2F;code&gt;, for post-call handling. Recipient may run out of gas, but &lt;code&gt;RelayHub&lt;&#x2F;code&gt; never does.
&lt;code&gt;RelayHub&lt;&#x2F;code&gt; also sends sender&#x27;s address at the end of &lt;code&gt;msg.data&lt;&#x2F;code&gt;, so &lt;code&gt;RelayRecipient.getSender()&lt;&#x2F;code&gt; will be able to extract the real sender, and trust it because the transaction came from the known &lt;code&gt;RelayHub&lt;&#x2F;code&gt; address.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Recipient contract handles the transaction.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RelayHub&lt;&#x2F;code&gt; calls recipient&#x27;s &lt;code&gt;postRelayedCall&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RelayHub&lt;&#x2F;code&gt; checks call&#x27;s return value of call, and emits &lt;code&gt;TransactionRelayed(address relay, address from, address to, bytes4 selector, uint256 status, uint256 chargeOrCanRelayStatus)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RelayHub&lt;&#x2F;code&gt; increases &lt;code&gt;RelayHub.nonces[sender]&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RelayHub&lt;&#x2F;code&gt; transfers ETH balance from recipient to &lt;code&gt;Relay.owner&lt;&#x2F;code&gt;, to pay the transaction fee, based on the measured transaction cost.
Note on relay payment: The relay gets paid for actual gas used, regardless of whether the recipient reverted.
The only case where the relay sustains a loss, is if &lt;code&gt;canRelay&lt;&#x2F;code&gt; returns non-zero, since the relay was responsible to verify this view function prior to submitting.
Any other revert is caught and paid for. See attacks&#x2F;mitigations below.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Relay&lt;&#x2F;code&gt; keeps track of transactions it sent, and waits for &lt;code&gt;TransactionRelayed&lt;&#x2F;code&gt; events to see the charge.
If a transaction reverts and goes unpaid, which means the recipient&#x27;s &lt;code&gt;acceptRelayedCall()&lt;&#x2F;code&gt; function was inconsistent, &lt;code&gt;Relay&lt;&#x2F;code&gt; refuses service to that recipient for a while (or blacklists it indefinitely, if it happens often).
See attacks&#x2F;mitigations below.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The process of winding a &lt;code&gt;Relay&lt;&#x2F;code&gt; down:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Relay&#x27;s owner (the address that initially funded it) calls &lt;code&gt;RelayHub.removeRelayByOwner(Relay)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RelayHub&lt;&#x2F;code&gt; ensures that the sender is indeed Relay&#x27;s owner, then removes &lt;code&gt;Relay&lt;&#x2F;code&gt;, and emits &lt;code&gt;RelayRemoved(Relay)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RelayHub&lt;&#x2F;code&gt; starts the countdown towards releasing the owner&#x27;s stake.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Relay&lt;&#x2F;code&gt; receives its &lt;code&gt;RelayRemoved&lt;&#x2F;code&gt; event.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Relay&lt;&#x2F;code&gt; sends all its remaining ETH to its owner.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Relay&lt;&#x2F;code&gt; shuts down.&lt;&#x2F;li&gt;
&lt;li&gt;Once the owner&#x27;s unstake delay is over, owner calls &lt;code&gt;RelayHub.unstake()&lt;&#x2F;code&gt;, and withdraws the stake.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The rationale for the gas stations network design is a combination of two sets of requirements: Easy adoption, and robustness.&lt;&#x2F;p&gt;
&lt;p&gt;For easy adoption, the design goals are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;No network changes.&lt;&#x2F;li&gt;
&lt;li&gt;Minimal changes to contracts, apps and frameworks.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The robustness requirement translates to decentralization and attack resistance. The gas stations network is decentralized, and we have to assume that any entity may attack other entities in the system.&lt;&#x2F;p&gt;
&lt;p&gt;Specifically we&#x27;ve considered the following types of attacks:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Denial-of-service attacks against individual senders, i.e. transactions censorship.&lt;&#x2F;li&gt;
&lt;li&gt;Denial-of-service and financial attacks against individual relays.&lt;&#x2F;li&gt;
&lt;li&gt;Denial-of-service and financial attacks against individual contracts.&lt;&#x2F;li&gt;
&lt;li&gt;Denial-of-service attacks against the entire network, either by attacking existing entities, or by introducing any number of malicious entities.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;attacks-and-mitigations&quot;&gt;Attacks and mitigations&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;attack-relay-attempts-to-censor-a-transaction-by-not-signing-it-or-otherwise-ignoring-a-user-request&quot;&gt;Attack: Relay attempts to censor a transaction by not signing it, or otherwise ignoring a user request.&lt;&#x2F;h5&gt;
&lt;p&gt;Relay is expected to return the signed transaction to the sender, immediately.
Sender doesn&#x27;t need to wait for the transaction to be mined, and knows immediately whether it&#x27;s request has been served.
If a relay doesn&#x27;t return a signed transaction within a couple of seconds, sender cancels the operation, drops the connection, and switches to another relay.
It also marks Relay as unresponsive in its private storage to avoid using it in the near future.&lt;&#x2F;p&gt;
&lt;p&gt;Therefore, the maximal damage a relay can cause with such attack, is a one-time delay of a couple of seconds. After a while, senders will avoid it altogether.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;attack-relay-attempts-to-censor-a-transaction-by-signing-it-returning-it-to-the-sender-but-never-putting-it-on-the-blockchain&quot;&gt;Attack: Relay attempts to censor a transaction by signing it, returning it to the sender, but never putting it on the blockchain.&lt;&#x2F;h5&gt;
&lt;p&gt;This attack will backfire and not censor the transaction.
The sender can submit the transaction signed by Relay to the blockchain as a raw transaction through any node, so the transaction does happen,
but Relay may be unaware and therefore be stuck with a bad nonce which will break its next transaction.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;attack-relay-attempts-to-censor-a-transaction-by-signing-it-but-publishing-a-different-transaction-with-the-same-nonce&quot;&gt;Attack: Relay attempts to censor a transaction by signing it, but publishing a different transaction with the same nonce.&lt;&#x2F;h5&gt;
&lt;p&gt;Reusing the nonce is the only DoS performed by a Relay, that cannot be detected within a couple of seconds during the http request.
It will only be detected when the malicious transaction with the same nonce gets mined and triggers the &lt;code&gt;RelayHub.TransactionRelayed&lt;&#x2F;code&gt; event.
However, the attack will backfire and cost Relay its entire stake.&lt;&#x2F;p&gt;
&lt;p&gt;Sender has a signed transaction from Relay with nonce N, and also gets a mined transaction from the blockchain with nonce N, also signed by Relay.
This proves that Relay performed a DoS attack against the sender.
The sender calls &lt;code&gt;RelayHub.penalizeRepeatedNonce(bytes transaction1, bytes transaction2)&lt;&#x2F;code&gt;, which verifies the attack, confiscates Relay&#x27;s stake,
and sends half of it to the sender who delivered the &lt;code&gt;penalizeRepeatedNonce&lt;&#x2F;code&gt; call. The other half of the stake is burned by sending it to &lt;code&gt;address(0)&lt;&#x2F;code&gt;. Burning is done to prevent cheating relays from effectively penalizing themselves and getting away without any loss.
The sender then proceeds to select a new relay and send the original transaction.&lt;&#x2F;p&gt;
&lt;p&gt;The result of such attack is a delay of a few blocks in sending the transaction (until the attack is detected) but the relay gets removed and loses its entire stake.
Scaling such attack would be prohibitively expensive, and actually quite profitable for senders and honest relays.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;attack-relay-attempts-to-censor-a-transaction-by-signing-it-but-using-a-nonce-higher-than-it-s-current-nonce&quot;&gt;Attack: Relay attempts to censor a transaction by signing it, but using a nonce higher than it&#x27;s current nonce.&lt;&#x2F;h5&gt;
&lt;p&gt;In this attack, the Relay did create and return a perfectly valid transaction, but it will not be mined until this Relay fills the gap in the nonce with &#x27;missing&#x27; transactions.
This may delay the relaying of some transactions indefinitely. In order to mitigate that, the sender includes a &lt;code&gt;max_nonce&lt;&#x2F;code&gt; parameter with it&#x27;s signing request.
It is suggested to be higher by 2-3 from current nonce, to allow the relay process several transactions.&lt;&#x2F;p&gt;
&lt;p&gt;When the sender receives a transaction signed by a Relay he validates that the nonce used is valid, and if it is not, the client will ignore the given relay and use other relays to relay given transaction. Therefore, there will be no actual delay introduced by such attack.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;attack-dapp-attempts-to-burn-relays-funds-by-implementing-an-inconsistent-acceptrelayedcall-and-using-multiple-sender-addresses-to-generate-expensive-transactions-thus-performing-a-dos-attack-on-relays-and-reducing-their-profitability&quot;&gt;Attack: Dapp attempts to burn relays funds by implementing an inconsistent acceptRelayedCall() and using multiple sender addresses to generate expensive transactions, thus performing a DoS attack on relays and reducing their profitability.&lt;&#x2F;h5&gt;
&lt;p&gt;In this attack, a contract sets an inconsistent acceptRelayedCall (e.g. return zero for even blocks, nonzero for odd blocks), and uses it to exhaust relay resources through unpaid transactions.
Relays can easily detect it after the fact.
If a transaction goes unpaid, the relay knows that the recipient contract&#x27;s acceptRelayedCall has acted inconsistently, because the relay has verified its view function before sending the transaction.
It might be the result of a rare race condition where the contract&#x27;s state has changed between the view call and the transaction, but if it happens too frequently, relays will blacklist this contract and refuse to serve transactions to it.
Each offending contract can only cause a small damage (e.g. the cost of 2-3 transactions) to a relay, before getting blacklisted.&lt;&#x2F;p&gt;
&lt;p&gt;Relays may also look at recipients&#x27; history on the blockchain, looking for past unpaid transactions (reverted by RelayHub without pay), and denying service to contracts with a high failure rate.
If a contract caused this minor loss to a few relays, all relays will stop serving it, so it can&#x27;t cause further damage.&lt;&#x2F;p&gt;
&lt;p&gt;This attack doesn&#x27;t scale because the cost of creating a malicious contract is in the same order of magnitude as the damage it can cause to the network.
Causing enough damage to exhaust the resources of all relays, would be prohibitively expensive.&lt;&#x2F;p&gt;
&lt;p&gt;The attack can be made even more impractical by setting RelayHub to require a stake from dapps before they can be served, and enforcing an unstaking delay,
so that attackers will have to raise a vast amount of ETH in order to simultaneously create enough malicious contracts and attack relays.
This protection is probably an overkill, since the attack doesn&#x27;t scale regardless.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;attack-user-attempts-to-rob-dapps-by-registering-its-own-relay-and-sending-expensive-transactions-to-dapps&quot;&gt;Attack: User attempts to rob dapps by registering its own relay and sending expensive transactions to dapps.&lt;&#x2F;h5&gt;
&lt;p&gt;If a malicious sender repeatedly abuses a recipient by sending meaningless&#x2F;reverted transactions and causing the recipient to pay a relay for nothing,
it is the recipient&#x27;s responsibility to blacklist that sender and have its acceptRelayedCall function return nonzero for that sender.
Collect calls are generally not meant for anonymous senders unknown to the recipient.
Dapps that utilize the gas station networks should have a way to blacklist malicious users in their system and prevent Sybil attacks.&lt;&#x2F;p&gt;
&lt;p&gt;A simple method that mitigates such Sybil attack, is that the dapp lets users buy credit with a credit card, and credit their account in the dapp contract,
so acceptRelayedCall() only returns zero for users that have enough credit, and deduct the amount paid to the relay from the user&#x27;s balance, whenever a transaction is relayed for the user.
With this method, the attacker can only burn its own resources, not the dapp&#x27;s.&lt;&#x2F;p&gt;
&lt;p&gt;A variation of this method, for free dapps (that don&#x27;t charge the user, and prefer to pay for their users transactions) is to require a captcha during user creation in their web interface,
or to login with a Google&#x2F;Facebook account, which limits the rate of the attack to the attacker&#x27;s ability to open many Google&#x2F;Facebook accounts.
Only a user that passed that process is given credit in RelayRecipient. The rate of such Sybil attack would be too low to cause any real damage.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;attack-attacker-attempts-to-reduce-network-availability-by-registering-many-unreliable-relays&quot;&gt;Attack: Attacker attempts to reduce network availability by registering many unreliable relays.&lt;&#x2F;h5&gt;
&lt;p&gt;Registering a relay requires placing a stake in RelayHub, and the stake can only be withdrawn after the relay is unregistered and a long cooldown period has passed, e.g. a month.&lt;&#x2F;p&gt;
&lt;p&gt;Each unreliable relay can only cause a couple of seconds delay to senders, once, and then it gets blacklisted by them, as described in the first attack above.
After it caused this minor delay and got blacklisted, the attacker must wait a month before reusing the funds to launch another unreliable relay.
Simultaneously bringing up a number of unreliable relays, large enough to cause a noticeable network delay, would be prohibitively expensive due to the required stake,
and even then, all those relays will get blacklisted within a short time.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;attack-attacker-attempts-to-replay-a-relayed-transaction&quot;&gt;Attack: Attacker attempts to replay a relayed transaction.&lt;&#x2F;h5&gt;
&lt;p&gt;Transactions include a nonce. RelayHub maintains a nonce (counter) for each sender. Transactions with bad nonces get reverted by RelayHub. Each transaction can only be relayed once.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;attack-user-does-not-execute-the-raw-transaction-received-from-the-relayer-therefore-blocking-the-execution-of-all-further-transactions-signed-by-this-relayer&quot;&gt;Attack: User does not execute the raw transaction received from the Relayer, therefore blocking the execution of all further transactions signed by this relayer&lt;&#x2F;h5&gt;
&lt;p&gt;The user doesn&#x27;t really have to execute the raw transaction. It&#x27;s enough that the user can. The relationship between relay and sender is mutual distrust. The process described above incentivizes the relay to execute the transaction, so the user doesn&#x27;t need to wait for actual mining to know that the transaction has been executed.&lt;&#x2F;p&gt;
&lt;p&gt;Once relay returns the signed transaction, which should happen immediately, the relay is incentivized to also execute it on chain, so that it can advance its nonce and serve the next transaction. The user can (but doesn&#x27;t have to) also execute the transaction. To understand why the attack isn&#x27;t viable, consider the four possible scenarios after the signed transaction was returned to the sender:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Relay executes the transaction, and the user doesn&#x27;t. In this scenario the transaction is executed, so no problem. This is the case described in this attack.&lt;&#x2F;li&gt;
&lt;li&gt;Relay doesn&#x27;t execute the transaction, but the user does. Similarly to 1, the transaction is executed, so no problem.&lt;&#x2F;li&gt;
&lt;li&gt;Both of them execute the transaction. The transactions are identical in the pending transactions pool, so the transaction gets executed once. No problem.&lt;&#x2F;li&gt;
&lt;li&gt;None of them execute the transaction. In this case the transaction doesn&#x27;t get executed, but the relay is stuck. It can&#x27;t serve the next transaction with the next nonce, because its nonce hasn&#x27;t been advanced on-chain. It also can&#x27;t serve the next transaction with the current nonce, as this can be proven by the user, having two different transactions signed by the same relay, with the same nonce. The user could use this to take the relay&#x27;s nonce. So the relay is stuck unless it executes the transaction.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;As this matrix shows, the relay is &lt;strong&gt;always&lt;&#x2F;strong&gt; incentivized to execute the transaction, once it returned it to the user, in order to end up in #1 or #3, and avoid the risk of #4. It&#x27;s just a way to commit the relay to do its work, without requiring the user to wait for on-chain confirmation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The gas stations network is implemented as smart contracts and external entities, and does not require any network changes.&lt;&#x2F;p&gt;
&lt;p&gt;Dapps adding gas station network support remain backwards compatible with their existing apps&#x2F;users. The added methods apply on top of the existing ones, so no changes are required for existing apps.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;A working implementation of the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;tabookey-dev&#x2F;tabookey-gasless&quot;&gt;&lt;strong&gt;gas stations network&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; is being developed by &lt;strong&gt;TabooKey&lt;&#x2F;strong&gt;. It consists of &lt;code&gt;RelayHub&lt;&#x2F;code&gt;, &lt;code&gt;RelayRecipient&lt;&#x2F;code&gt;, &lt;code&gt;web3 hooks&lt;&#x2F;code&gt;, an implementation of a gas station inside &lt;code&gt;geth&lt;&#x2F;code&gt;, and sample dapps using the gas stations network.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Re-Fungible Token Standard (RFT)</title>
        <published>2018-11-18T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Billy Rennekamp</name><uri>https://github.com/okwme</uri>
	</author>
	
	<author>
		<name>Dan Long</name><email>dan@artblx.com</email>
	</author>
	
	<author>
		<name>Kiryl Yermakou</name><email>kiryl@artblx.com</email>
	</author>
	
	<author>
		<name>Nate van der Ende</name><email>nate@artblx.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1633/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/1634" />
        

        <id>https://wg-eips.ritovision.com/1633/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:1633"
            label="ERC-1633" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1633/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; extension for proportional ownership of an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; token.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The intention of this proposal, the Re-Fungible Token Standard, is to extend the ERC-20 Token Standard and utilize ERC-165 Standard Interface Detection in order to represent the shared ownership of an ERC-721 Non-Fungible Token. The ERC-20 Token Standard was modified as little as possible in order to allow this new class of token to operate in all of the ways and locations which are familiar to assets that follow the original ERC-20 specification. While there are many possible variations of this specification that would enable many different capabilities and scenarios for shared ownership, this proposal is focused on the minimal commonalities to enable as much flexibility as possible for various further extensions. This proposal makes it possible to verify, from the contract level or from an external query, whether a fungible token represents a form of shared ownership of a non-fungible token. The inclusion of ERC-165 makes it possible to verify, from the contract level or from an external query, whether a non-fungible token is owned by ERC-20 token representing shared ownership.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Shared ownership occurs across many industries and for many reasons. As more assets are registered, regulated and&#x2F;or represented by the ERC-721 Non-Fungible Token Standard there will be more instances where the need for shared ownership of these assets will arise. For example, ARTBLX Inc. is working towards facilitating a protocol for collective ownership of physical, digital and conceptual artworks. The fungible tokens created from this process will have a value attached to the non-fungible tokens which they represent. This will be useful for price discovery of the underlying asset, liquidity for shared owners and as a new class of asset which can be used as collateral for loans or other financial instruments like stable coins. Providing an interface to this special class of fungible tokens is necessary to allow third parties to recognize them as a special class of fungible token and to recognize when a non-fungible token is collectively owned. This might be useful in the case of a wallet who would want to utilize the metadata of the underlying NFT to show additional info next to an RFT, or on an exchange who might want to make that sort of info similarly available, or an NFT marketplace who may want to direct customers to a relevant exchange who wish to purchase shares in a NFT which is owned by an RFT. Anywhere an ERC-20 is applicable it would be useful for a user to know whether that token represents a shared NFT, and what attributes that NFT may have.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;At a minimum, third parties need two things: 1) to be able to distinguish re-fungible tokens from other token standards and 2) to determine when a non-fungible token is collectively owned. These two scenarios can be encountered from the perspective of initial contact with the non-fungible token or from the perspective of initial contact with the re-fungible token.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;initial-contact-with-the-re-fungible-token&quot;&gt;Initial Contact with the Re-Fungible Token&lt;&#x2F;h4&gt;
&lt;p&gt;In order for a third party to confirm which non-fungible token is owned by the re-fungible token there needs to be a pointer from the RFT contract to the NFT contract and the relevant token id. This is possible with two public getters named &lt;code&gt;parentToken()&lt;&#x2F;code&gt; and &lt;code&gt;parentTokenId()&lt;&#x2F;code&gt;. The first getter returns a variable of type &lt;code&gt;address&lt;&#x2F;code&gt; and designates the contract address of the Non-Fungible Token contract. The second getter returns a variable of type &lt;code&gt;uint256&lt;&#x2F;code&gt; and designates the token ID of the Non-Fungible Token. With these getters, the identity of the Non-Fungible Token can be determined. Below is an example of the Re-Fungible Token Standard interface that includes these getter functions:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.4.20&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0x5755c3f2.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RFT&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is ERC20, ERC165 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; parentToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _parentToken&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; parentTokenId&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _parentTokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The validity of this claim can be confirmed from another contract (on-chain) or from interacting with an RPC endpoint (off-chain). Below is an example of the on-chain scenario:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.4.20&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;#39;.&#x2F;RFT.sol&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;#39;.&#x2F;ERC721.sol&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ConfirmRFT&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; confirmRFT&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _RFT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; _NFT &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RFT&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_RFT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;parentToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; returns address of NFT contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; _tokenId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RFT&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_RFT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;parentTokenId&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; returns id of ID of NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      NFT&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_NFT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x80ac58cd&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; confirm it is ERC-721&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      NFT&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_NFT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; _RFT&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; confirm the owner of the NFT is the RFT contract address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Below is an off-chain example using an instance of web3.js in javascript:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;async&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; confirmRFT&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;web3&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; ERC721ABI&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;...&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; abi for ERC721&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; RFTABI&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;...&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; abi for RFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; RFTAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0123456789abcdef0123456789abcdef&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address for the deployed RFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; RFTContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; web3&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;eth&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Contract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;RFTABI&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; RFTAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; deployed RFT contract instance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; ERC721Address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; RFTcontract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;methods&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;parentToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; returns address of NFT contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; ERC721TokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; RFTcontract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;methods&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;parentTokenId&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; returns id of ID of NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; ERC721Contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; web3&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;eth&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Contract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;ERC721ABI&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ERC721Address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; deployed ERC721 (as reported by RFT)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; isERC721&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ERC721Contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;methods&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x80ac58cd&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; confirm it is ERC-721&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; ownerOfAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ERC721Contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;methods&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;ERC721TokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; get the owner of the NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ERC721Response&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;toLowerCase&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ===&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; RFTAddress&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;toLowerCase&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; confirm the owner of the NFT is the RFT contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;initial-contact-with-the-non-fungible-token&quot;&gt;Initial Contact with the Non-Fungible Token&lt;&#x2F;h4&gt;
&lt;p&gt;When checking the owner of a specific non-fungible token it&#x27;s important to be able to determine whether owner is in fact a re-fungible token contract. This is possible by utilizing ERC-165 Standard Interface Detection. In order to comply with that standard a contract must include the following getter function which returns &lt;code&gt;true&lt;&#x2F;code&gt; when passed the &lt;code&gt;bytes4&lt;&#x2F;code&gt; parameter &lt;code&gt;0x01ffc9a7&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function supportsInterface(bytes4 interfaceID) external view returns (bool);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;After establishing support for this interface it becomes useful in determining whether the contract adheres to the Re-Fungible Token Standard. To do so the &lt;code&gt;supportsInterface(bytes4 interfaceID)&lt;&#x2F;code&gt; getter function must return &lt;code&gt;true&lt;&#x2F;code&gt; when passed the &lt;code&gt;bytes4&lt;&#x2F;code&gt; parameter &lt;code&gt;0x5755c3f2&lt;&#x2F;code&gt; which is the result of &lt;code&gt;bytes4(keccak256(&#x27;parentToken()&#x27;)) ^ bytes4(keccak256(&#x27;parentTokenId()&#x27;))&lt;&#x2F;code&gt; or &lt;code&gt;parentToken.selector ^ parentTokenId.selector&lt;&#x2F;code&gt;. This could be achieved with the following code:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.4.20&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;ERC20.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0x5755c3f2.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RFT&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC20&lt;&#x2F;span&gt;&lt;span&gt; &#x2F;*, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC165&lt;&#x2F;span&gt;&lt;span&gt; *&#x2F; &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      interfaceID &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC165&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      interfaceID &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parentToken&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; parentToken()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      interfaceID &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parentTokenId&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; parentTokenId()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      interfaceID &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parentToken&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;^&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parentTokenId&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; RFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; parentToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _parentToken&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; parentTokenId&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _parentTokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The flow of actually checking the status of a non-fungible token owner as a re-fungible token contract can be done from another contract (on-chain) as well as with an RPC endpoint (off-chain). Below is an example of the on-chain scenario:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.4.20&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;#39;.&#x2F;RFT.sol&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;#39;.&#x2F;ERC721.sol&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ConfirmRFT&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; confirmRFT&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _NFT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; _RFT &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_NFT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; get the owner of the NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      RFT&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_RFT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01ffc9a7&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; confirm it supports ERC-165&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      RFT&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_RFT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x5755c3f2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; confirm it is RFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Below is an off-chain example using web3.js in javascript:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;async&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; confirmRFT&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;web3&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; ERC721ABI&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;...&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; abi for ERC721&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; RFTABI&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;...&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; abi for RFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; ERC721Address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0123456789abcdef0123456789abcdef&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address for the deployed NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; ERC721TokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;7&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; token Id of the NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; ERC721Contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; web3&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;eth&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Contract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;ERC721ABI&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ERC721Address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; deployed ERC721&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; RFTAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ERC721Contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;methods&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;ERC721TokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; owner address of the NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; RFTContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; web3&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;eth&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Contract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;RFTABI&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; RFTAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; deployed RFT contract instance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; isERC165&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; RFTContract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;methods&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x01ffc9a7&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; confirm it is ERC-165&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; isERC165&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; RFTContract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;methods&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x5755c3f2&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; confirm it is RFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Most of the decisions made around the design of this standard were done in the hopes of keeping it as flexible as possible for as many use cases as possible. This includes making the standard 100% backwards compatible with ERC-20 Token Standard and able to interact with any previously deployed or future ERC-721 non-fungible token. This allows for each project to determine their own system for minting, burning and governing their re-fungible tokens depending on their specific use case.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The Re-Fungible Token Standard is 100% backwards compatible with ERC-20 Token Standard. It is a small extension to the original specification and meant to be further extended for more specific use cases. Keeping the standard compatible with ERC-20 is important to allow for this token to benefit from the ecosystem that has grown around supporting the ubiquitous ERC-20 Token Standard.&lt;&#x2F;p&gt;
&lt;p&gt;The Re-Fungible Token Standard is intended to interact with the ERC-721 Non-Fungible Token Standard. It is kept purposefully agnostic to extensions beyond the standard in order to allow specific projects to design their own token relationships such as governance over, rights to or permissions on each non-fungible token relative to the respective re-fungible token owners.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.4.20&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0x5755c3f2.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RFT&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is ERC20, ERC165 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; parentToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _parentToken&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; parentTokenId&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _parentTokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>contenthash field for ENS</title>
        <published>2018-11-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Dean Eigenmann</name><email>dean@ens.domains</email>
	</author>
	
	<author>
		<name>Nick Johnson</name><email>nick@ens.domains</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1577/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/1577/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:1577"
            label="ERC-1577" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1577/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces the new &lt;code&gt;contenthash&lt;&#x2F;code&gt; field for ENS resolvers, allowing for a better defined system of mapping names to network and content addresses. Additionally the &lt;code&gt;content&lt;&#x2F;code&gt; and &lt;code&gt;multihash&lt;&#x2F;code&gt; fields are deprecated.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Multiple applications including &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;metamask.io&#x2F;&quot;&gt;Metamask&lt;&#x2F;a&gt; and mobile clients such as &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;status.im&quot;&gt;Status&lt;&#x2F;a&gt; have begun resolving ENS names to content hosted on distributed systems such as &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ipfs.io&#x2F;&quot;&gt;IPFS&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;swarm-guide.readthedocs.io&quot;&gt;Swarm&lt;&#x2F;a&gt;. Due to the various ways content can be stored and addressed, a standard is required so these applications know how to resolve names and that domain owners know how their content will be resolved.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;contenthash&lt;&#x2F;code&gt; field allows for easy specification of network and content addresses in ENS.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The field &lt;code&gt;contenthash&lt;&#x2F;code&gt; is introduced, which permits a wide range of protocols to be supported by ENS names. Resolvers supporting this field MUST return &lt;code&gt;true&lt;&#x2F;code&gt; when the &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; function is called with argument &lt;code&gt;0xbc1c58d1&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The fields &lt;code&gt;content&lt;&#x2F;code&gt; and &lt;code&gt;multihash&lt;&#x2F;code&gt; are deprecated.&lt;&#x2F;p&gt;
&lt;p&gt;The value returned by &lt;code&gt;contenthash&lt;&#x2F;code&gt; MUST be represented as a machine-readable &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;multiformats&#x2F;multicodec&quot;&gt;multicodec&lt;&#x2F;a&gt;. The format is specified as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;protoCode uvarint&amp;gt;&amp;lt;value []byte&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;protoCodes and their meanings are specified in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;multiformats&#x2F;multicodec&quot;&gt;multiformats&#x2F;multicodec&lt;&#x2F;a&gt; repository.&lt;&#x2F;p&gt;
&lt;p&gt;The encoding of the value depends on the content type specified by the protoCode. Values with protocodes of 0xe3 and 0xe4 represent IPFS and Swarm content; these values are encoded as v1 &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;multiformats&#x2F;cid&quot;&gt;CIDs&lt;&#x2F;a&gt; without a base prefix, meaning their value is formatted as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;protoCode uvarint&amp;gt;&amp;lt;cid-version&amp;gt;&amp;lt;multicodec-content-type&amp;gt;&amp;lt;multihash-content-address&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;When resolving a &lt;code&gt;contenthash&lt;&#x2F;code&gt;, applications MUST use the protocol code to determine what type of address is encoded, and resolve the address appropriately for that protocol, if supported.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;example&quot;&gt;Example&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;ipfs&quot;&gt;IPFS&lt;&#x2F;h4&gt;
&lt;p&gt;Input data:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;storage system: IPFS (0xe3)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CID version: 1 (0x01)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;content type: dag-pb (0x70)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;hash function: sha2-256 (0x12)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;hash length: 32 bytes (0x20)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;hash: 29f2d17be6139079dc48696d1f582a8530eb9805b561eda517e22a892c7e3f1f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Binary format:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xe3010170122029f2d17be6139079dc48696d1f582a8530eb9805b561eda517e22a892c7e3f1f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Text format:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ipfs:&#x2F;&#x2F;QmRAQB6YaCyidP37UdDnjFY5vQuiBrcqdyoW1CuDgwxkD4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;swarm&quot;&gt;Swarm&lt;&#x2F;h3&gt;
&lt;p&gt;Input data:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;storage system: Swarm (0xe4)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CID version: 1 (0x01)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;content type: swarm-manifest (0xfa)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;hash function: keccak256 (0x1b)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;hash length: 32 bytes (0x20)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;hash: d1de9994b4d039f6548d191eb26786769f580809256b4685ef316805265ea162&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Binary format:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xe40101fa011b20d1de9994b4d039f6548d191eb26786769f580809256b4685ef316805265ea162&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Text format:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;bzz:&#x2F;&#x2F;d1de9994b4d039f6548d191eb26786769f580809256b4685ef316805265ea162&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Example usage with swarm hash:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ swarm hash ens contenthash d1de9994b4d039f6548d191eb26786769f580809256b4685ef316805265ea162                                 &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;gt; e40101fa011b20d1de9994b4d039f6548d191eb26786769f580809256b4685ef316805265ea162&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;fallback&quot;&gt;Fallback&lt;&#x2F;h3&gt;
&lt;p&gt;In order to support names that have an IPFS or Swarm hash in their &lt;code&gt;content&lt;&#x2F;code&gt; field, a grace period MUST be implemented offering those name holders time to update their names. If a resolver does not support the &lt;code&gt;multihash&lt;&#x2F;code&gt; interface, it MUST be checked whether they support the &lt;code&gt;content&lt;&#x2F;code&gt; interface. If they do, the value of that field SHOULD be treated in a context dependent fashion and resolved. This condition MUST be enforced until at least March 31st, 2019.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h3&gt;
&lt;p&gt;To support &lt;code&gt;contenthash&lt;&#x2F;code&gt;, a new resolver has been developed and can be found &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ensdomains&#x2F;resolvers&#x2F;blob&#x2F;master&#x2F;contracts&#x2F;PublicResolver.sol&quot;&gt;here&lt;&#x2F;a&gt;, you can also find this smart contract deployed on:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Mainnet : &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;etherscan.io&#x2F;address&#x2F;0xd3ddccdd3b25a8a7423b5bee360a42146eb4baf3&quot;&gt;0xd3ddccdd3b25a8a7423b5bee360a42146eb4baf3&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Ropsten : &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ropsten.etherscan.io&#x2F;address&#x2F;0xde469c7106a9fbc3fb98912bb00be983a89bddca&quot;&gt;0xde469c7106a9fbc3fb98912bb00be983a89bddca&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;There are also implementations in multiple languages to encode and decode &lt;code&gt;contenthash&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;pldespaigne&#x2F;content-hash&quot;&gt;JavaScript&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;filips123&#x2F;ContentHashPy&quot;&gt;Python&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Non-wallet usage of keys derived from BIP-32 trees</title>
        <published>2018-11-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Michele Balistreri</name><uri>https://github.com/bitgamma</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1581/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/non-wallet-usage-of-keys-derived-from-bip-32-trees/1817" />
        

        <id>https://wg-eips.ritovision.com/1581/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:1581"
            label="ERC-1581" />
        

        
        

        
        <summary type="html">A derivation path structure for BIP32 trees to generate key pairs not meant to hold crypto assets.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1581/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;BIP32 defines a way to generate hierarchical trees of keys which can be derived from a common master key. BIP32 and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;bitcoin&#x2F;bips&#x2F;blob&#x2F;master&#x2F;bip-0044.mediawiki&quot;&gt;BIP44&lt;&#x2F;a&gt; defines the usage of these keys as wallets. In this EIP we describe the usage of such keys outside the scope of the blockchain defining a logical tree for key usage which can coexist (and thus share the same master) with existing BIP44 compatible wallets.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Applications interacting with the blockchain often make use of additional, non-blockchain technologies to perform the task they are designed for. For privacy and security sensitive mechanisms, sets of keys are needed. Reusing keys used for wallets can prove to be insecure, while keeping completely independent keys make backup and migration of the full set of credentials more complex. Defining a separate (from BIP44 compliant wallets) derivation branch allows combining the security of independent keys with the convenience of having a single piece of information which needs to be backup or migrated.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;path-levels&quot;&gt;Path levels&lt;&#x2F;h3&gt;
&lt;p&gt;We define the following levels in BIP32 path:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;m &#x2F; purpose&#x27; &#x2F; coin_type&#x27; &#x2F; subpurpose&#x27; &#x2F; key_type&#x27; &#x2F; key_index&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Apostrophe in the path indicates that BIP32 hardened derivation is used.&lt;&#x2F;p&gt;
&lt;p&gt;This structure follows the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;bitcoin&#x2F;bips&#x2F;blob&#x2F;master&#x2F;bip-0043.mediawiki&quot;&gt;BIP43&lt;&#x2F;a&gt; recommendations and its &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;bitcoin&#x2F;bips&#x2F;pull&#x2F;523&#x2F;files&quot;&gt;amendments for non-Bitcoin usage&lt;&#x2F;a&gt;. Each level has a special meaning, described in the chapters below.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;purpose-coin-type-subpurpose&quot;&gt;Purpose&#x2F;Coin Type&#x2F;Subpurpose&lt;&#x2F;h3&gt;
&lt;p&gt;This part is constant and set to &lt;code&gt;m &#x2F; 43&#x27; &#x2F; 60&#x27; &#x2F; 1581&#x27;&lt;&#x2F;code&gt;, meaning BIP 43 -&amp;gt; Ethereum -&amp;gt; This EIP.&lt;&#x2F;p&gt;
&lt;p&gt;All subtrees under this prefix are the scope of this EIP.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;key-type&quot;&gt;Key type&lt;&#x2F;h3&gt;
&lt;p&gt;Describes the purpose for which the key is being used. Key types should be generic. &quot;Instant messaging&quot; is a good example whereas &quot;Whisper&quot; is not. The reason is that you want to be able to use the same identity across different services. Key types are defined at: TBD&lt;&#x2F;p&gt;
&lt;p&gt;Hardened derivation is used at this level.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;key-index&quot;&gt;Key index&lt;&#x2F;h3&gt;
&lt;p&gt;The key index is a field of variable length identifying a specific key. In its simplest case, it is a number from 0 to 2^31-1. If a larger identifier is desired (for example representing a hash or a GUID), the value must be split
across several BIP32 nesting levels, most significant bit first and left aligned, bit-padded with 0s if needed. All levels, except the last one must used hardened key derivation. The last level must use public derivation. This means that every level can carry 31-bit of the identifier to represent.&lt;&#x2F;p&gt;
&lt;p&gt;As an example, let&#x27;s assume we have a key with key type 4&#x27; and a key_index representing a 62-bit ID represented as hexadecimal 0x2BCDEFFEDCBAABCD the complete keypath would be  &lt;code&gt;m &#x2F; 43&#x27; &#x2F; 60&#x27; &#x2F; 1581&#x27; &#x2F; 4&#x27; &#x2F; ‭1469833213‬&#x27; &#x2F; ‭1555737549‬ &lt;&#x2F;code&gt;. If you are using random identifiers, it might be convenient to generate a conventional GUID, for example 128-bit just fix the value of the most significant bit of each 32-bit word to 1 for all of them, except the last one which will be 0.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The structure proposed above follows the BIP43 generic structure and is similar to the widely adopted BIP44 specification.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Storage Rent</title>
        <published>2018-11-10T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Felix J Lange</name><uri>https://github.com/fjl</uri>
	</author>
	
	<author>
		<name>Martin Holst Swende</name><uri>https://github.com/holiman</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1682/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/storage-rent-eip/2357" />
        

        <id>https://wg-eips.ritovision.com/1682/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1682"
            label="EIP-1682" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1682/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP describes a scheme to charge for data in state, and &#x27;archive&#x27; data which is no longer being paid for. It also describes how resurrection of &#x27;archived&#x27; data happens.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The Ethereum blockchain in its current form is not sustainable because it grows
indefinitely. This is true of any blockchain, but Ethereum grows faster than most chains.
Many implementation strategies to slow down growth exist. A common strategy is &#x27;state
pruning&#x27; which discards historical state, keeping only the active copy of contract data
and a few recent versions to deal with short-range chain reorganizations. Several
implementations also employ compression techniques to keep the active copy of the state as
small as possible.&lt;&#x2F;p&gt;
&lt;p&gt;A full node participating in consensus today requires storing large amounts of data even
with advanced storage optimizations applied. Future storage requirements are unbounded
because any data stored in a contract must be retained forever as dictated by the
protocol. This EIP attempts to correct this by adding new consensus rules that put an
upper bound on the size of the Ethereum state.&lt;&#x2F;p&gt;
&lt;p&gt;Adding these new rules changes fundamental guarantees of the system and requires a hard
fork. Users of Ethereum already pay for the creation and modification of accounts and
their storage entries. Under the rules introduced in this EIP, users must also pay to keep
accounts accessible. A similar rent scheme was proposed in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;35&quot;&gt;EIP-103&lt;&#x2F;a&gt; but rejected
even back then because the proposal would&#x27;ve upset peoples expectations. As implementers
of Ethereum, we still feel that state rent is the right path to long-term sustainability
of the Ethereum blockchain and that its undesirable implications can be overcome with
off-protocol tooling and careful design.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The cost of storing an account over time is called &lt;code&gt;rent&lt;&#x2F;code&gt;. The amount of &lt;code&gt;rent&lt;&#x2F;code&gt; due depends
on the size of the account. The &lt;code&gt;ether&lt;&#x2F;code&gt; that is paid for &lt;code&gt;rent&lt;&#x2F;code&gt; is destroyed. The &lt;code&gt;rent&lt;&#x2F;code&gt; is deducted whenever an account is touched.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;rent&lt;&#x2F;code&gt; can be paid from the account&#x27;s regular &lt;code&gt;balance&lt;&#x2F;code&gt; or from its &#x27;rent balance&#x27;. Accounts
can be endowed with &lt;code&gt;rent balance&lt;&#x2F;code&gt; through a new EVM opcode. When &lt;code&gt;rent&lt;&#x2F;code&gt; is charged, it is
first taken from the &lt;code&gt;rent balance&lt;&#x2F;code&gt;. When &lt;code&gt;rent balance&lt;&#x2F;code&gt; is zero, it is instead charged from the account&#x27;s regular &lt;code&gt;balance&lt;&#x2F;code&gt; instead.&lt;&#x2F;p&gt;
&lt;p&gt;The reason to separate &lt;code&gt;balance&lt;&#x2F;code&gt; and &lt;code&gt;rent balance&lt;&#x2F;code&gt; is that certain contracts do not accept &lt;code&gt;ether&lt;&#x2F;code&gt; sends, or always send the entire balance off to some other destination. For these cases, a separate&lt;code&gt;rent balance&lt;&#x2F;code&gt; is required.&lt;&#x2F;p&gt;
&lt;p&gt;When an account&#x27;s &lt;code&gt;balance&lt;&#x2F;code&gt; is insufficient to pay rent, the account becomes &lt;code&gt;inactive&lt;&#x2F;code&gt;. Its
storage and contract code are removed. Inactive accounts cannot be interacted with, i.e.
it behaves as if it has no contract code.&lt;&#x2F;p&gt;
&lt;p&gt;Inactive accounts can be restored by re-uploading their storage. To restore an inactive
account &lt;code&gt;A&lt;&#x2F;code&gt;, a new account &lt;code&gt;B&lt;&#x2F;code&gt; is created with arbitrary code and its storage modified
with &lt;code&gt;SSTORE&lt;&#x2F;code&gt; operations until it matches the storage root of &lt;code&gt;A&lt;&#x2F;code&gt;. Account &lt;code&gt;B&lt;&#x2F;code&gt; can restore
&lt;code&gt;A&lt;&#x2F;code&gt; through the &lt;code&gt;RESTORETO&lt;&#x2F;code&gt; opcode. This means the cost of restoring an account is
equivalent to recreating it via successive &lt;code&gt;SSTORE&lt;&#x2F;code&gt; operations.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;changes-to-state&quot;&gt;Changes To State&lt;&#x2F;h3&gt;
&lt;p&gt;At the top level, a new key &lt;code&gt;size&lt;&#x2F;code&gt; is added to the accounts trie. This key tracks the
total number of trie nodes across all accounts, including storage trie nodes. To track
rent, the structure of account entries is changed as well.&lt;&#x2F;p&gt;
&lt;p&gt;Before processing the block in which this EIP becomes active, clients iterate the whole
state once to count the number of trie nodes and to change the representation of all
accounts to the new format.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;account-representation&quot;&gt;Account Representation&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;account = [nonce, balance, storageroot, codehash, rentbalance, rentblock, storagesize]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Each account gets three additional properties: &lt;code&gt;rentbalance&lt;&#x2F;code&gt;, &lt;code&gt;rentblock&lt;&#x2F;code&gt; and
&lt;code&gt;storagesize&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;rentbalace&lt;&#x2F;code&gt; field tracks the amount of &lt;code&gt;rent balance&lt;&#x2F;code&gt; available to the account. Upon
self-destruction any remaining &lt;code&gt;rent balance&lt;&#x2F;code&gt; is transferred to the beneficiary. Any
modification of the account recomputes its current &lt;code&gt;rent balance&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;rentblock&lt;&#x2F;code&gt; field tracks the block number in which the &lt;code&gt;rent balance&lt;&#x2F;code&gt; was last
recomputed. Upon creation, this field is initialized with the current block number.
&lt;code&gt;rentblock&lt;&#x2F;code&gt; is also updated with the current block number whenever the account is
modified.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;storagesize&lt;&#x2F;code&gt; field tracks the amount of storage related to the account. It is a
number containing the number of storage slots currently set. The &lt;code&gt;storagesize&lt;&#x2F;code&gt; of an
inactive account is zero.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;charging-rent&quot;&gt;Charging Rent&lt;&#x2F;h3&gt;
&lt;p&gt;There is a new protocol constant &lt;code&gt;MAX_STORAGE_SIZE&lt;&#x2F;code&gt; that specifies the upper bound on the
number of state tree nodes:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;MAX_STORAGE_SIZE&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ~160GB of state&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;A &#x27;storage fee factor&#x27; for each block is derived from this constant such that fees
increase as the limit is approached.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; storagefee_factor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ramp&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_STORAGE_SIZE&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;MAX_STORAGE_SIZE&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; total_storage_size&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;22&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; ramp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;When a block is processed, &lt;code&gt;rent&lt;&#x2F;code&gt; is deducted from all accounts modified by transactions in
the block after the transactions have been processed. The amount due for each account is
based on the account&#x27;s storage size.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; rent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;prestate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; poststate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; currentblock&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;prestate&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;rentblock&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; currentblock&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; storagefee_factor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;b&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; prestate&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;storagesize&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; storagefee_factor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;currentblock&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; poststate&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;storagesize&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; charge_rent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;prestate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; poststate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; currentblock&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; rent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;prestate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; poststate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; currentblock&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span&gt; poststate&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;rentbalance&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        poststate&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;rentbalance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -=&lt;&#x2F;span&gt;&lt;span&gt; fee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -=&lt;&#x2F;span&gt;&lt;span&gt; poststate&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;rentbalance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        poststate&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;rentbalance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        poststate&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;poststate&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balance&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; fee&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    poststate&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;rentblock&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; currentblock&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;new-evm-opcodes&quot;&gt;New EVM Opcodes&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;payrent-amount-addr&quot;&gt;&lt;code&gt;PAYRENT &amp;lt;amount&amp;gt; &amp;lt;addr&amp;gt;&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;At any time, the &lt;code&gt;rent balance&lt;&#x2F;code&gt; of an account may be topped up by the &lt;code&gt;PAYRENT&lt;&#x2F;code&gt; opcode.
&lt;code&gt;PAYRENT&lt;&#x2F;code&gt; deducts the given amount of &lt;code&gt;ether&lt;&#x2F;code&gt; from the account executing the opcode and adds
it to the &lt;code&gt;rent balance&lt;&#x2F;code&gt; of the address specified as beneficiary.&lt;&#x2F;p&gt;
&lt;p&gt;Any participant can pay the rent for any other participant.&lt;&#x2F;p&gt;
&lt;p&gt;Gas cost: TBD&lt;&#x2F;p&gt;
&lt;h4 id=&quot;rentbalance-addr&quot;&gt;&lt;code&gt;RENTBALANCE &amp;lt;addr&amp;gt;&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;rent balance&lt;&#x2F;code&gt; of an account may be queried through the &lt;code&gt;RENTBALANCE&lt;&#x2F;code&gt; opcode. It pushes the
&lt;code&gt;rentbalance&lt;&#x2F;code&gt; field of the given address to the stack.&lt;&#x2F;p&gt;
&lt;p&gt;Gas cost: like &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;ssize-addr&quot;&gt;&lt;code&gt;SSIZE &amp;lt;addr&amp;gt;&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;This opcode pushes the &lt;code&gt;storagesize&lt;&#x2F;code&gt; field of the given account to the stack.&lt;&#x2F;p&gt;
&lt;p&gt;Gas cost: like &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;restoreto-addr-codeaddr&quot;&gt;&lt;code&gt;RESTORETO &amp;lt;addr&amp;gt; &amp;lt;codeaddr&amp;gt;&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;This opcode restores the inactive account at the given address. This is a bit like
&lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; but has more specific semantics.&lt;&#x2F;p&gt;
&lt;p&gt;The account at &lt;code&gt;addr&lt;&#x2F;code&gt; must be &lt;code&gt;inactive&lt;&#x2F;code&gt; (i.e. have &lt;code&gt;storagesize&lt;&#x2F;code&gt; zero) and its
&lt;code&gt;storageroot&lt;&#x2F;code&gt; must match the &lt;code&gt;storageroot&lt;&#x2F;code&gt; of the contract executing &lt;code&gt;RESTORETO&lt;&#x2F;code&gt;. The
&lt;code&gt;codeaddr&lt;&#x2F;code&gt; specifies the address of a contract from which code is taken. The code of the
&lt;code&gt;codeaddr&lt;&#x2F;code&gt; account must match the &lt;code&gt;codehash&lt;&#x2F;code&gt; of &lt;code&gt;addr&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;If all these preconditions are met, &lt;code&gt;RESTORETO&lt;&#x2F;code&gt; transfers the storage of the account
executing the opcode to &lt;code&gt;addr&lt;&#x2F;code&gt; and resets its &lt;code&gt;storagesize&lt;&#x2F;code&gt; to the full size of the
storage. The code of &lt;code&gt;addr&lt;&#x2F;code&gt; is restored as well. &lt;code&gt;RESTORETO&lt;&#x2F;code&gt; also transfers any remaining
balance and rent balance to &lt;code&gt;addr&lt;&#x2F;code&gt;. The contract executing &lt;code&gt;RESTORETO&lt;&#x2F;code&gt; is deleted.&lt;&#x2F;p&gt;
&lt;p&gt;Gas cost: TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-do-we-need-a-separate-rent-balance&quot;&gt;Why do we need a separate rent balance?&lt;&#x2F;h3&gt;
&lt;p&gt;Accounts need a separate rent balance because some contracts are non-payable, i.e. they
reject regular value transfers. Such contracts might not be able to keep themselves alive,
but users of those contracts can keep them alive by paying rent for them.&lt;&#x2F;p&gt;
&lt;p&gt;Having the additional balance also makes things easier for contracts that hold balance on
behalf of a user. Consider the canonical crowdfunding example, a contract which changes
behavior once a certain balance is reached and which tracks individual user&#x27;s balances.
Deducting rent from the main balance of the contract would mess up the contract&#x27;s
accounting, leaving it unable to pay back users accurately if the threshold balance isn&#x27;t
reached.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-restoration&quot;&gt;Why restoration?&lt;&#x2F;h3&gt;
&lt;p&gt;One of the fundamental guarantees provided by Ethereum is that changes to contract storage
can only be made by the contract itself and storage will persist forever. If you hold a
token balance in a contract, you&#x27;ll have those tokens forever. By adding restoration, we
can maintain this guarantee to a certain extent.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;implementation-impact&quot;&gt;Implementation Impact&lt;&#x2F;h3&gt;
&lt;p&gt;The proposed changes tries to fit within the existing state transition model. Note that
there is no mechanism for deactivating accounts the moment they can&#x27;t pay rent. Users must
touch accounts to ensure their storage is removed because we&#x27;d need to track all accounts
and their rent requirements in an auxlilary data structure otherwise.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;TBA&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBA&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TBA&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EthereumStratum&#x2F;2.0.0</title>
        <published>2018-11-09T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Andrea Lanfranchi</name><uri>https://github.com/AndreaLanfranchi</uri>
	</author>
	
	<author>
		<name>Pawel Bylica</name><uri>https://github.com/chfast</uri>
	</author>
	
	<author>
		<name>Marius Van Der Wijden</name><uri>https://github.com/MariusVanDerWijden</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1571/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/AndreaLanfranchi/EthereumStratum-2.0.0/issues" />
        

        <id>https://wg-eips.ritovision.com/1571/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="interface"
                label="Interface" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1571"
            label="EIP-1571" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1571/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This draft contains the guidelines to define a new standard for the Stratum protocol used by Ethereum miners to communicate with mining pool servers.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;conventions&quot;&gt;Conventions&lt;&#x2F;h3&gt;
&lt;p&gt;The key words &lt;code&gt;MUST&lt;&#x2F;code&gt;, &lt;code&gt;MUST NOT&lt;&#x2F;code&gt;, &lt;code&gt;REQUIRED&lt;&#x2F;code&gt;, &lt;code&gt;SHALL&lt;&#x2F;code&gt;, &lt;code&gt;SHALL NOT&lt;&#x2F;code&gt;, &lt;code&gt;SHOULD&lt;&#x2F;code&gt;, &lt;code&gt;SHOULD NOT&lt;&#x2F;code&gt;, &lt;code&gt;RECOMMENDED&lt;&#x2F;code&gt;, &lt;code&gt;MAY&lt;&#x2F;code&gt;, and &lt;code&gt;OPTIONAL&lt;&#x2F;code&gt; in this document are to be interpreted as described in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;tools.ietf.org&#x2F;html&#x2F;rfc2119&quot;&gt;RFC 2119&lt;&#x2F;a&gt;.
The definition &lt;code&gt;mining pool server&lt;&#x2F;code&gt;, and it&#x27;s plural form, is to be interpreted as &lt;code&gt;work provider&lt;&#x2F;code&gt; and later in this document can be shortened as &lt;code&gt;pool&lt;&#x2F;code&gt; or &lt;code&gt;server&lt;&#x2F;code&gt;.
The definition &lt;code&gt;miner(s)&lt;&#x2F;code&gt;, and it&#x27;s plural form, is to be interpreted as &lt;code&gt;work receiver&#x2F;processor&lt;&#x2F;code&gt; and later in this document can be shortened as &lt;code&gt;miner&lt;&#x2F;code&gt; or &lt;code&gt;client&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h3&gt;
&lt;p&gt;Ethereum does not have an official Stratum implementation yet. It officially supports only getWork which requires miners to constantly pool the work provider. Only recently go-ethereum have implemented a &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;go-ethereum&#x2F;pull&#x2F;17347&quot;&gt;push mechanism&lt;&#x2F;a&gt; to notify clients for mining work, but whereas the vast majority of miners do not run a node, it&#x27;s main purpose is to facilitate mining pools rather than miners.
The Stratum protocol on the other hand relies on a standard stateful TCP connection which allows two-way exchange of line-based messages. Each line contains the string representation of a JSON object following the rules of either &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.jsonrpc.org&#x2F;specification_v1&quot;&gt;JSON-RPC 1.0&lt;&#x2F;a&gt; or &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.jsonrpc.org&#x2F;specification&quot;&gt;JSON-RPC 2.0&lt;&#x2F;a&gt;.
Unfortunately, in absence of a well defined standard, various flavours of Stratum have bloomed for Ethereum mining as a derivative work for different mining pools implementations. The only attempt to define a standard was made by NiceHash with their &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;nicehash&#x2F;Specifications&#x2F;blob&#x2F;master&#x2F;EthereumStratum_NiceHash_v1.0.0.txt&quot;&gt;EthereumStratum&#x2F;1.0.0&lt;&#x2F;a&gt; implementation which is the main source this work inspires from.
Mining activity, thus the interaction among pools and miners, is at it&#x27;s basics very simple, and can be summarized with &quot;&lt;em&gt;please find a number (nonce) which coupled to this data as input for a given hashing algorithm produces, as output, a result which is below a certain target&lt;&#x2F;em&gt;&quot;. Other messages which may or have to be exchanged among parties during a session are needed to support this basic concept.
Due to the simplicity of the subject, the proponent, means to stick with JSON formatted objects rather than investigating more verbose solutions, like for example  &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;developers.google.com&#x2F;protocol-buffers&#x2F;docs&#x2F;overview&quot;&gt;Google&#x27;s Protocol Buffers&lt;&#x2F;a&gt; which carry the load of strict object definition.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;stratum-design-flaws&quot;&gt;Stratum design flaws&lt;&#x2F;h3&gt;
&lt;p&gt;The main Stratum design flaw is the absence of a well defined standard. This implies that miners (and mining software developers) have to struggle with different flavours which make their life hard when switching from one pool to another or even when trying to &quot;guess&quot; which is the flavour implemented by a single pool. Moreover all implementations still suffer from an excessive verbosity for a chain with a very small block time like Ethereum. A few numbers may help understand. A normal &lt;code&gt;mining.notify&lt;&#x2F;code&gt; message weigh roughly 240 bytes: assuming the dispatch of 1 work per block to an audience of 50k connected TCP sockets means the transmission of roughly 1.88TB of data a month. And this can be an issue for large pools. But if we see the same figures the other way round, from a miner&#x27;s perspective, we totally understand how mining decentralization is heavily affected by the quality of internet connections.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;sources-of-inspiration&quot;&gt;Sources of inspiration&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;nicehash&#x2F;Specifications&#x2F;blob&#x2F;master&#x2F;EthereumStratum_NiceHash_v1.0.0.txt&quot;&gt;NiceHash EthereumStratum&#x2F;1.0.0&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;zcash&#x2F;zips&#x2F;blob&#x2F;23d74b0373c824dd51c7854c0e3ea22489ba1b76&#x2F;drafts&#x2F;str4d-stratum&#x2F;draft1.rst#json-rpc-1-0&quot;&gt;Zcash variant of the Stratum protocol&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The Stratum protocol is an instance of &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.jsonrpc.org&#x2F;specification&quot;&gt;JSON-RPC-2.0&lt;&#x2F;a&gt;. The miner is a JSON-RPC client, and the server is a JSON-RPC server. All communications exist within the scope of a &lt;code&gt;session&lt;&#x2F;code&gt;. A session starts at the moment a client opens a TCP connection to the server till the moment either party do voluntary close the very same connection or it gets broken. Servers &lt;strong&gt;MAY&lt;&#x2F;strong&gt; support session resuming if this is initially negotiated (on first session handshaking) between the client and the server. During a session all messages exchanged among server and client are line-based which means all messages are JSON strings terminated by ASCII LF character (which may also be denoted as &lt;code&gt;\n&lt;&#x2F;code&gt; in this document). The LF character &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; appear elsewhere in a message. Client and server implementations &lt;strong&gt;MUST&lt;&#x2F;strong&gt; assume that once they read a LF character, the current message has been completely received and can be processed.
Line messages are of three types:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Requests&lt;&#x2F;code&gt; : messages for which the issuer expects a response. The receiver &lt;strong&gt;MUST&lt;&#x2F;strong&gt; reply back to any request individually&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Responses&lt;&#x2F;code&gt; : solicited messages by a previous request. The responder &lt;strong&gt;MUST&lt;&#x2F;strong&gt; label the response with the same identifier of the originating request.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Notifications&lt;&#x2F;code&gt; : unsolicited messages for which the issuer is not interested nor is expecting a response. Nevertheless a response (eg. an acknowledgement) &lt;strong&gt;MAY&lt;&#x2F;strong&gt; be sent by the receiver.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;During a &lt;code&gt;session&lt;&#x2F;code&gt; both parties &lt;strong&gt;CAN&lt;&#x2F;strong&gt; exchange messages of the above depicted three types.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;json-rpc-2-0-compliances&quot;&gt;JSON-RPC-2.0 Compliances&lt;&#x2F;h3&gt;
&lt;p&gt;As per &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.jsonrpc.org&#x2F;specification&quot;&gt;JSON-RPC-2.0&lt;&#x2F;a&gt; specification requests and responses differ from notifications by the identifier (&lt;code&gt;id&lt;&#x2F;code&gt;) member in the JSON object:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Requests &lt;strong&gt;MUST&lt;&#x2F;strong&gt; have an &lt;code&gt;id&lt;&#x2F;code&gt; member&lt;&#x2F;li&gt;
&lt;li&gt;Responses &lt;strong&gt;MUST&lt;&#x2F;strong&gt; have an &lt;code&gt;id&lt;&#x2F;code&gt; member valued exactly as the &lt;code&gt;id&lt;&#x2F;code&gt; member of the request this response is for&lt;&#x2F;li&gt;
&lt;li&gt;Notifications &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; have an &lt;code&gt;id&lt;&#x2F;code&gt; member&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;json-rpc-2-0-defiances&quot;&gt;JSON-RPC-2.0 Defiances&lt;&#x2F;h3&gt;
&lt;p&gt;In order to get the most concise messages among parties of a session&#x2F;conversation this implementation enforces the following defiances:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;JSON member &lt;code&gt;jsonrpc&lt;&#x2F;code&gt; (always valued to &quot;2.0&quot;) &lt;strong&gt;MUST ALWAYS BE OMITTED&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;li&gt;JSON member &lt;code&gt;id&lt;&#x2F;code&gt; &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; be &lt;code&gt;null&lt;&#x2F;code&gt;. When member is present, mandatorily in requests and responses, it &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be valued to an integer Number ranging from 0 to 65535. Please note that a message with &lt;code&gt;&quot;id&quot;: 0&lt;&#x2F;code&gt; &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; be interpreted as a notification: it&#x27;s a request with identifier 0&lt;&#x2F;li&gt;
&lt;li&gt;JSON member &lt;code&gt;id&lt;&#x2F;code&gt; &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be only of type primitive number. The removal of other identifier types (namely strings) is due to the need to reduce the number of bytes transferred.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;conventions-1&quot;&gt;Conventions&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;The representation of a JSON object is, at it&#x27;s base, a string&lt;&#x2F;li&gt;
&lt;li&gt;The conversation among the client and the server is made of strings. Each string ending with a LF (ASCII char 10) denotes a &lt;code&gt;line&lt;&#x2F;code&gt;. Each line &lt;strong&gt;MUST&lt;&#x2F;strong&gt; contain only one JSON root object. Eventually the root object &lt;strong&gt;MAY&lt;&#x2F;strong&gt; contain additional JSON objects in it&#x27;s members.&lt;&#x2F;li&gt;
&lt;li&gt;Aside the &lt;code&gt;LF&lt;&#x2F;code&gt; delimiter each &lt;code&gt;line&lt;&#x2F;code&gt; &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be made of printable ASCII chars in the range 32..126&lt;&#x2F;li&gt;
&lt;li&gt;It&#x27;s implicit and mandatory that each line message corresponds to a well formatted JSON object: see &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.json.org&#x2F;&quot;&gt;JSON documentation&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;JSON objects are made of &lt;code&gt;members&lt;&#x2F;code&gt; which can be of type : primitive of string&#x2F;number, JSON object, JSON arrays&lt;&#x2F;li&gt;
&lt;li&gt;JSON &lt;code&gt;member&lt;&#x2F;code&gt;&#x27;s names are strings which &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be composed of printable chars only in the ASCII range 48..57 (numbers) and 97..122 (lower case letters).&lt;&#x2F;li&gt;
&lt;li&gt;JSON &lt;code&gt;member&lt;&#x2F;code&gt;&#x27;s names &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; begin with a number.&lt;&#x2F;li&gt;
&lt;li&gt;JSON values &lt;code&gt;arrays&lt;&#x2F;code&gt; : although the JSON notation allows the insertion of different data types within the same array, this behavior is generally not accepted in coding languages. Due to this, by the means of EthereumStratum&#x2F;2.0.0, all implementers &lt;strong&gt;MUST&lt;&#x2F;strong&gt; assume that an array is made of elements of the very same data type.&lt;&#x2F;li&gt;
&lt;li&gt;JSON values &lt;code&gt;booleans&lt;&#x2F;code&gt; : the JSON notation allows to express boolean values as &lt;code&gt;true&lt;&#x2F;code&gt; or &lt;code&gt;false&lt;&#x2F;code&gt;. In EthereumStratum&#x2F;2.0.0, for better compatibility within arrays, boolean values will be expressed in the hex form of &quot;0&quot; (false) or &quot;1&quot; (true)&lt;&#x2F;li&gt;
&lt;li&gt;JSON values &lt;code&gt;strings&lt;&#x2F;code&gt; : any string value &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be composed of printable ASCII chars only in the ASCII range 32..126. Each string is delimited by a &lt;code&gt;&quot;&lt;&#x2F;code&gt; (ASCII 34) at the beginning and at the end. Should the string value contain a &lt;code&gt;&quot;&lt;&#x2F;code&gt; this must be escaped as &lt;code&gt;\&quot;&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Hex values : a Hexadecimal representation of a number is actually a string data type. As a convention, and to reduce the number of transmitted bytes, the prefix &quot;0x&quot; &lt;strong&gt;MUST&lt;&#x2F;strong&gt; always be omitted. In addition any hex number &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be transferred only for their significant part i.e. the non significant zeroes &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be omitted (example : the decimal &lt;code&gt;456&lt;&#x2F;code&gt; must be represented as &lt;code&gt;&quot;1c8&quot;&lt;&#x2F;code&gt; and not as &lt;code&gt;&quot;01c8&quot;&lt;&#x2F;code&gt; although the conversion produces the same decimal value). This directive &lt;strong&gt;DOES NOT APPLY&lt;&#x2F;strong&gt; to hashes and extranonces&lt;&#x2F;li&gt;
&lt;li&gt;Hex values casing : all letters in Hexadecimal values &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be lower case. (example : the decimal &lt;code&gt;456&lt;&#x2F;code&gt; must be represented as &lt;code&gt;&quot;1c8&quot;&lt;&#x2F;code&gt; and not as &lt;code&gt;&quot;1C8&quot;&lt;&#x2F;code&gt; although the conversion produces the same decimal value). This directive &lt;strong&gt;DOES NOT APPLY&lt;&#x2F;strong&gt; to hashes.&lt;&#x2F;li&gt;
&lt;li&gt;Numbers : any non-fractional number &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be transferred by it&#x27;s hexadecimal representation&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;requests&quot;&gt;Requests&lt;&#x2F;h3&gt;
&lt;p&gt;The JSON representation of &lt;code&gt;request&lt;&#x2F;code&gt; object is made of these parts:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;mandatory &lt;code&gt;id&lt;&#x2F;code&gt; member of type Integer : the identifier established by the issuer&lt;&#x2F;li&gt;
&lt;li&gt;mandatory &lt;code&gt;method&lt;&#x2F;code&gt; member of type String : the name of the method to be invoked on the receiver side&lt;&#x2F;li&gt;
&lt;li&gt;optional &lt;code&gt;params&lt;&#x2F;code&gt; member : in case the method invocation on the receiver side requires the application of additional parameters to be executed. The type &lt;strong&gt;CAN&lt;&#x2F;strong&gt; be Object (with named members of different types) or Array of single type. In case of an array the parameters will be applied by their ordinal position. If the method requested for invocation on the receiver side does not require the application of additional parameters this member &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; be present. The notation &lt;code&gt;&quot;params&quot; : null&lt;&#x2F;code&gt; &lt;strong&gt;IS NOT PERMITTED&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;responses&quot;&gt;Responses&lt;&#x2F;h3&gt;
&lt;p&gt;The JSON representation of &lt;code&gt;response&lt;&#x2F;code&gt; object is made of these parts:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;mandatory &lt;code&gt;id&lt;&#x2F;code&gt; member of type Integer : the identifier of the request this response corresponds to&lt;&#x2F;li&gt;
&lt;li&gt;optional &lt;code&gt;error&lt;&#x2F;code&gt; member : whether an error occurred during the parsing of the method or during it&#x27;s execution this member &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be present and valued. If no errors occurred this member &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; be present. For a detailed structure of the &lt;code&gt;error&lt;&#x2F;code&gt; member see below.&lt;&#x2F;li&gt;
&lt;li&gt;optional &lt;code&gt;result&lt;&#x2F;code&gt; member : This has to be set, if the corresponding request requires a result from the user. If no errors occurred by invoking the corresponding function, this member &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be present even if one or more information are null. The type can be of Object or single type Array or Primitive string&#x2F;number. If no data is meant back for the issuer (the method is void on the receiver) or an error occurred this member &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; be present.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;You&#x27;ll notice here some differences with standard JSON-RPC-2.0. Namely the result member is not always required. Basically a response like this:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;means &quot;request received and processed correctly with no data to send back&quot;.&lt;&#x2F;p&gt;
&lt;p&gt;To better clarify the concept and clear the field of free interpretations let&#x27;s take another example of &lt;strong&gt;wrong response&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This response syntax leaves room to many interpretations: is it an error? is &lt;code&gt;false&lt;&#x2F;code&gt; the legit response value to the issued request?&lt;&#x2F;p&gt;
&lt;p&gt;For this reason responses, we reiterate, &lt;strong&gt;MUST BE&lt;&#x2F;strong&gt; of two types:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;success responses : no error occurred during the processing, the request was legit, syntactically correct, and the receiver had no issues processing it. This kind of responses &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; have the &lt;code&gt;error&lt;&#x2F;code&gt; member and &lt;strong&gt;MAY&lt;&#x2F;strong&gt; have the &lt;code&gt;result&lt;&#x2F;code&gt; member if a value is expected back to the issuer.&lt;&#x2F;li&gt;
&lt;li&gt;failure responses : something wrong with the request, it&#x27;s syntax, it&#x27;s validity scope, or server processing problems. This kind of responses &lt;strong&gt;MUST HAVE&lt;&#x2F;strong&gt; the &lt;code&gt;error&lt;&#x2F;code&gt; member and &lt;strong&gt;MAY&lt;&#x2F;strong&gt; have the &lt;code&gt;result&lt;&#x2F;code&gt; member.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The latter deserves a better explanation: failure responses can be distinguished by a severity degree.
Example 1 : a client submits a solution and server rejects it cause it&#x27;s not below target. Server &lt;strong&gt;MUST&lt;&#x2F;strong&gt; respond like this;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 31&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;code&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 406&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;message&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; :&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Bad nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Example 2 : a client submits a solution and server &lt;strong&gt;accepts&lt;&#x2F;strong&gt; it &lt;strong&gt;but&lt;&#x2F;strong&gt; it accounts the share as stale. Server &lt;strong&gt;MUST&lt;&#x2F;strong&gt; respond like this;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 31&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;code&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 202&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;message&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; :&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Stale&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Example 3 : a client submits an authorization request specifying an invalid workername. Server authorizes the account but rejects worker name. Server &lt;strong&gt;MUST&lt;&#x2F;strong&gt; respond like this;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;code&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 215&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;message&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; :&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Invalid Worker Name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Example 1 depicts the condition of a severe failure while Example 2 and 3 depict a situation where the request has been accepted and processed properly but the result &lt;strong&gt;MAY NOT&lt;&#x2F;strong&gt; be what expected by the client.
It&#x27;s up to the client to evaluate the severity of the error and decide whether to proceed or not.&lt;&#x2F;p&gt;
&lt;p&gt;Using proper error codes pools may properly inform miners of the condition of their requests. Error codes &lt;strong&gt;MUST&lt;&#x2F;strong&gt; honor this scheme:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Error codes 2xx : request accepted and processed but some additional info in the &lt;code&gt;error&lt;&#x2F;code&gt; member may give hint&lt;&#x2F;li&gt;
&lt;li&gt;Error codes 3xx : server could not process the request due to a lack of authorization by the client&lt;&#x2F;li&gt;
&lt;li&gt;Error codes 4xx : server could not process the request due to syntactic problems (method not found, missing params, wrong data types ecc.) or passed &lt;code&gt;param&lt;&#x2F;code&gt; values are not valid.&lt;&#x2F;li&gt;
&lt;li&gt;Error codes 5xx : server could not process the request due to internal errors&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;notifications&quot;&gt;Notifications&lt;&#x2F;h3&gt;
&lt;p&gt;A notification message has the very same representation of a &lt;code&gt;request&lt;&#x2F;code&gt; with the only difference the &lt;code&gt;id&lt;&#x2F;code&gt; member &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; be present. This means the issuer is not interested nor expects any response to this message. It&#x27;s up to the receiver to take actions accordingly. For instance the receiver &lt;strong&gt;MAY&lt;&#x2F;strong&gt; decide to execute the method, or, in case of errors or methods not allowed, drop the connection thus closing the session.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;error-member&quot;&gt;Error member&lt;&#x2F;h4&gt;
&lt;p&gt;As seen above a &lt;code&gt;response&lt;&#x2F;code&gt; &lt;strong&gt;MAY&lt;&#x2F;strong&gt; contain an &lt;code&gt;error&lt;&#x2F;code&gt; member. When present this member &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be an Object with:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;mandatory member &lt;code&gt;code&lt;&#x2F;code&gt; : a Number which identifies the error occurred&lt;&#x2F;li&gt;
&lt;li&gt;mandatory member &lt;code&gt;message&lt;&#x2F;code&gt; : a short human readable sentence describing the error occurred&lt;&#x2F;li&gt;
&lt;li&gt;optional member &lt;code&gt;data&lt;&#x2F;code&gt; : a Structured or Primitive value that contains additional information about the error. The value of this member is defined by the Server (e.g. detailed error information, nested errors etc.).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;protocol-flow&quot;&gt;Protocol Flow&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Client starts session by opening a TCP socket to the server&lt;&#x2F;li&gt;
&lt;li&gt;Client advertises and request protocol compatibility&lt;&#x2F;li&gt;
&lt;li&gt;Server confirms compatibility and declares ready&lt;&#x2F;li&gt;
&lt;li&gt;Client starts&#x2F;resumes a session&lt;&#x2F;li&gt;
&lt;li&gt;Client sends request for authorization for each of it&#x27;s workers&lt;&#x2F;li&gt;
&lt;li&gt;Server replies back with responses for each authorization&lt;&#x2F;li&gt;
&lt;li&gt;Server sends &lt;code&gt;mining.set&lt;&#x2F;code&gt; for constant values to be adopted for following mining jobs&lt;&#x2F;li&gt;
&lt;li&gt;Server sends &lt;code&gt;mining.notify&lt;&#x2F;code&gt; with minimal job info&lt;&#x2F;li&gt;
&lt;li&gt;Client mines on job&lt;&#x2F;li&gt;
&lt;li&gt;Client sends &lt;code&gt;mining.submit&lt;&#x2F;code&gt; if any solution found for the job&lt;&#x2F;li&gt;
&lt;li&gt;Server replies whether solution is accepted&lt;&#x2F;li&gt;
&lt;li&gt;Server optionally sends &lt;code&gt;mining.set&lt;&#x2F;code&gt; for constant values to be adopted for following mining jobs (if something changed)&lt;&#x2F;li&gt;
&lt;li&gt;Server sends &lt;code&gt;mining.notify&lt;&#x2F;code&gt; with minimal job info&lt;&#x2F;li&gt;
&lt;li&gt;... (continue)&lt;&#x2F;li&gt;
&lt;li&gt;Eventually either party closes session and TCP connection&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;session-handling-hello&quot;&gt;Session Handling - Hello&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;del&gt;One of the worst annoyances until now is that server, at the very moment of socket connection, does not provide any useful information about the stratum flavour implemented. This means the client has to start a conversation by iteratively trying to connect via different protocol flavours. This proposal amends the situation making mandatory for the server to advertise itself to the client.
When a new client connects to the server, the server &lt;strong&gt;MUST&lt;&#x2F;strong&gt; send a &lt;code&gt;mining.hello&lt;&#x2F;code&gt; notification :&lt;&#x2F;del&gt;&lt;&#x2F;p&gt;
&lt;p&gt;It&#x27;s been noted that charging the server of the duty to advertise itself as first message of the conversation could potentially be harmful in respect of traffic amplification attacks using spoofed IP addresses or in traditional DDos attacks where an attacker need to spend very little resources to force the server to send a large packet back.
For this reason the duty of first advertisement is kept on client which will issue a &lt;code&gt;mining.hello&lt;&#x2F;code&gt; request like this:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; :&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;method&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;mining.hello&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;agent&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ethminer-0.17&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;host&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; :&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;somemininigpool.com&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;port&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; :&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;4d2&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;proto&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;EthereumStratum&#x2F;2.0.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;params&lt;&#x2F;code&gt; member object has these mandatory members:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;agent&lt;&#x2F;code&gt; (string) the mining software version&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;host&lt;&#x2F;code&gt; (string) the host name of the server this client is willing to connect to&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;port&lt;&#x2F;code&gt; (hex) the port number of the server this client is willing to connect to&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;proto&lt;&#x2F;code&gt; (string) which reports the stratum flavour requested and expected to be implemented by the server;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The rationale behind sending host and port is it enables virtual hosting, where virtual pools or private URLs might be used for DDoS protection, but that are aggregated on Stratum server backends. As with HTTP, the server CANNOT trust the host string. The port is included separately to parallel the client.reconnect method (see below).&lt;&#x2F;p&gt;
&lt;p&gt;If the server is prepared to start&#x2F;resume a session with such requirements it &lt;strong&gt;MUST&lt;&#x2F;strong&gt; reply back with a response like this:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; :&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;proto&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; :&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;EthereumStratum&#x2F;2.0.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;encoding&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; :&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;gzip&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;resume&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; :&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;timeout&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; :&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;b4&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;maxerrors&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; :&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;5&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;node&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; :&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Geth&#x2F;v1.8.18-unstable-f08f596a&#x2F;linux-amd64&#x2F;go1.10.4&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Where the &lt;code&gt;result&lt;&#x2F;code&gt; is an object made of 5 mandatory members&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;proto&lt;&#x2F;code&gt; (string) which &lt;strong&gt;MUST&lt;&#x2F;strong&gt; match the exact version requested by the client&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;encoding&lt;&#x2F;code&gt; (string) which value states whether or not all &lt;strong&gt;next messages&lt;&#x2F;strong&gt; should be gzip compressed or not. Possible values are &quot;gzip&quot; or &quot;plain&quot;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;resume&lt;&#x2F;code&gt; (hex) which value states whether or not the host can resume a previously created session;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;timeout&lt;&#x2F;code&gt; (hex) which reports the number of seconds after which the server is allowed to drop connection if no messages from the client&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;maxerrors&lt;&#x2F;code&gt; (hex) the maximum number of errors the server will bear before abruptly close connection&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;node&lt;&#x2F;code&gt; (string) the node software version underlying the pool&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;When the server replies back with &lt;code&gt;&quot;encoding&quot; : &quot;gzip&quot;&lt;&#x2F;code&gt; to the client, both parties &lt;strong&gt;MUST&lt;&#x2F;strong&gt; gzip compress all next messages. In case the client is not capable of compression it &lt;strong&gt;MUST&lt;&#x2F;strong&gt; close the connection immediately.
Should the server, after this reply, receive other messages as plain text, it &lt;strong&gt;MUST&lt;&#x2F;strong&gt; close the connection.&lt;&#x2F;p&gt;
&lt;p&gt;Eventually the client will continue with &lt;code&gt;mining.subscribe&lt;&#x2F;code&gt; (further on descripted)&lt;&#x2F;p&gt;
&lt;p&gt;Otherwise, in case of errors or rejection to start the conversation, the server &lt;strong&gt;MAY&lt;&#x2F;strong&gt; reply back with an error giving the other party useful information or, at server&#x27;s maintainers discretion, abruptly close the connection.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; :&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;code&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 400&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;message&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; :&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Bad protocol request&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;or&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; :&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;code&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 403&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;message&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; :&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Forbidden - Banned IP address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;em&gt;The above two JSON error values are only samples&lt;&#x2F;em&gt;
Eventually the server will close the connection.&lt;&#x2F;p&gt;
&lt;p&gt;Why a pool should advertise the node&#x27;s version? It&#x27;s a matter of transparency : miners should know whether or not pool have upgraded to latest patches&#x2F;releases for node&#x27;s software.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;session-handling-bye&quot;&gt;Session Handling - Bye&lt;&#x2F;h3&gt;
&lt;p&gt;Disconnection are not gracefully handled in Stratum. Client disconnections from pool may be due to several errors and this leads to waste of TCP sockets on server&#x27;s side which wait for keepalive timeouts to trigger. A useful notification is &lt;code&gt;mining.bye&lt;&#x2F;code&gt; which, once processed, allows both parties of the session to stop receiving and gracefully close TCP connections&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;method&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;mining.bye&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The party receiving this message aknowledges the other party wants to stop the conversation and closes the socket. The issuer will close too. The explicit issuance of this notification implies the session gets abandoned so no session resuming will be possible even on server which support session-resuming. Client reconnecting to the same server which implements session resuming &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; expect a new session id and &lt;strong&gt;MUST&lt;&#x2F;strong&gt; re-authorize all their workers.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;session-handling-session-subscription&quot;&gt;Session Handling - Session Subscription&lt;&#x2F;h3&gt;
&lt;p&gt;After receiving the response to &lt;code&gt;mining.hello&lt;&#x2F;code&gt; from server, the client, in case the server does support session resuming &lt;strong&gt;MAY&lt;&#x2F;strong&gt; request to resume a previously interrupted session with &lt;code&gt;mining.subscribe&lt;&#x2F;code&gt; request:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;method&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;mining.subscribe&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;s-12345&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where &lt;code&gt;params&lt;&#x2F;code&gt; is the id of the session the client wants to resume.&lt;&#x2F;p&gt;
&lt;p&gt;Otherwise, if client wants to start a new session &lt;strong&gt;OR&lt;&#x2F;strong&gt; server does not support session resuming, the request of subscription &lt;strong&gt;MUST&lt;&#x2F;strong&gt; omit the &lt;code&gt;params&lt;&#x2F;code&gt; member:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;method&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;mining.subscribe&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;session-handling-response-to-subscription&quot;&gt;Session Handling - Response to Subscription&lt;&#x2F;h3&gt;
&lt;p&gt;A server receiving a client session subscription &lt;strong&gt;MUST&lt;&#x2F;strong&gt; reply back with&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;s-12345&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;A server receiving a subscription request with &lt;code&gt;params&lt;&#x2F;code&gt; being a string holding the session id. This cases may apply&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If session resuming is not supported &lt;code&gt;result&lt;&#x2F;code&gt; will hold a new session Id which &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be a different value from the &lt;code&gt;session&lt;&#x2F;code&gt; member issued by client in previous &lt;code&gt;mining.subscribe&lt;&#x2F;code&gt; method&lt;&#x2F;li&gt;
&lt;li&gt;If session resuming is supported it will retrieve working values from cache and &lt;code&gt;result&lt;&#x2F;code&gt; will have the same id requested by the client. This means a session is &quot;resumed&quot;: as a consequence the server &lt;strong&gt;CAN&lt;&#x2F;strong&gt; start pushing jobs omitting to precede them with &lt;code&gt;mining.set&lt;&#x2F;code&gt; (see below) and the client &lt;strong&gt;MUST&lt;&#x2F;strong&gt; continue to use values lastly received within the same session scope. In addition the client &lt;strong&gt;CAN&lt;&#x2F;strong&gt; omit to re-authorize all it&#x27;s workers.&lt;&#x2F;li&gt;
&lt;li&gt;If session resuming is supported but the requested session has expired or it&#x27;s cache values have been purged &lt;code&gt;result&lt;&#x2F;code&gt; will hold a new session Id which &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be a different value from the &lt;code&gt;session&lt;&#x2F;code&gt; member issued by client in previous &lt;code&gt;mining.subscribe&lt;&#x2F;code&gt; method. As a consequence the server &lt;strong&gt;MUST&lt;&#x2F;strong&gt; wait for client to request authorization for it&#x27;s workers and &lt;strong&gt;MUST&lt;&#x2F;strong&gt; send &lt;code&gt;mining.set&lt;&#x2F;code&gt; values before pushing jobs. The client &lt;strong&gt;MUST&lt;&#x2F;strong&gt; prepare for a new session discarding all previously cached values (if any).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;A server implementing session-resuming &lt;strong&gt;MUST&lt;&#x2F;strong&gt; cache:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The session Ids&lt;&#x2F;li&gt;
&lt;li&gt;Any active job per session&lt;&#x2F;li&gt;
&lt;li&gt;The extraNonce&lt;&#x2F;li&gt;
&lt;li&gt;Any authorized worker&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Servers &lt;strong&gt;MAY&lt;&#x2F;strong&gt; drop entries from the cache on their own schedule. It&#x27;s up to server to enforce session validation for same agent and&#x2F;or ip.&lt;&#x2F;p&gt;
&lt;p&gt;A client which successfully subscribes and resumes session (the &lt;code&gt;session&lt;&#x2F;code&gt; value in server response is identical to &lt;code&gt;session&lt;&#x2F;code&gt; value requested by client on &lt;code&gt;mining.subscribe&lt;&#x2F;code&gt;) &lt;strong&gt;CAN&lt;&#x2F;strong&gt; omit to issue the authorization request for it&#x27;s workers.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;session-handling-noop&quot;&gt;Session Handling - Noop&lt;&#x2F;h3&gt;
&lt;p&gt;There are cases when a miner struggles to find a solution in a reasonable time so it may trigger the timeout imposed by the server in case of no communications (the server, in fact, may think the client got disconnected). To mitigate the problem a new method &lt;code&gt;mining.noop&lt;&#x2F;code&gt;(with no additional parameters) may be requested by the client.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 50&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;method&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;mining.noop&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;session-handling-reconnect&quot;&gt;Session Handling - Reconnect&lt;&#x2F;h3&gt;
&lt;p&gt;Under certain circumstances the server may need to free some resources and or to relocate miners to another machine. Until now the only option for servers was to abruptly close the connection. On the miner&#x27;s side this action is interpreted as a server malfunction and they, more often than not, switch to a failover pool.
The implementation of the notification &lt;code&gt;mining.reconnect&lt;&#x2F;code&gt; helps client to better merge with logic of handling of large mining pools.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;method&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;mining.reconnect&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;host&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;someotherhost.com&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;port&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;d80&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;resume&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This notification is meant only from servers to clients. Should a server receive such a notification it will simply ignore it. After the notification has been properly sent, the server is ALLOWED to close the connection, while the client will take the proper actions to reconnect to the suggested end-point.
The &lt;code&gt;host&lt;&#x2F;code&gt; member in &lt;code&gt;params&lt;&#x2F;code&gt; object &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; report a host DNS name and not an IP address: TLS encrypted connections require to validate the CN name in the certificate which, 99% of the cases, is a host name.
The third member &lt;code&gt;resume&lt;&#x2F;code&gt; of the &lt;code&gt;params&lt;&#x2F;code&gt; object sets whether or not the receiving server is prepared for session resuming.
After this notification has been issued by the server, the client should expect no further messages and &lt;strong&gt;MUST&lt;&#x2F;strong&gt; disconnect.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;workers-authorization&quot;&gt;Workers Authorization&lt;&#x2F;h3&gt;
&lt;p&gt;The miner &lt;strong&gt;MUST&lt;&#x2F;strong&gt; authorize at least one worker in order to begin receiving jobs and submit solutions or hashrates. The miner &lt;strong&gt;MAY&lt;&#x2F;strong&gt; authorize multiple workers in the same session. The server &lt;strong&gt;MUST&lt;&#x2F;strong&gt; allow authorization for multiple workers within a session and &lt;strong&gt;MUST&lt;&#x2F;strong&gt; validate at least one authorization from the client before starting to send jobs. A &lt;code&gt;worker&lt;&#x2F;code&gt; is a tuple of the address where rewards must be credited coupled with identifier of the machine actually doing the work. For Ethereum the most common form is &lt;code&gt;&amp;lt;account&amp;gt;.&amp;lt;MachineName&amp;gt;&lt;&#x2F;code&gt;. The same account can be bound to multiple machines. For pool&#x27;s allowing anonymous mining the account is the address where rewards must be credited, while, for pools requiring registration, the account is the login name. Each time a solution is submitted by the client it must be labelled with the Worker identifier. It&#x27;s up to server to keep the correct accounting for different addresses.&lt;&#x2F;p&gt;
&lt;p&gt;The syntax for the authorization request is the following:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;method&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;mining.authorize&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;lt;account&amp;gt;[.&amp;lt;MachineName&amp;gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;password&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;params&lt;&#x2F;code&gt; member must be an Array of 2 string elements. For anonymous mining the &quot;password&quot; can be any string value or empty but not null. Pools allowing anonymous mining will simply ignore the value.
The server &lt;strong&gt;MUST&lt;&#x2F;strong&gt; reply back either with an error or, in case of success, with&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;w-123&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Where the &lt;code&gt;result&lt;&#x2F;code&gt; member is a string which holds an unique - within the scope of the &lt;code&gt;session&lt;&#x2F;code&gt; - token which identifies the authorized worker. For every further request issued by the client, and related to a Worker action, the client &lt;strong&gt;MUST&lt;&#x2F;strong&gt; use the token given by the server in response to an &lt;code&gt;mining.authorize&lt;&#x2F;code&gt; request. This reduces the number of bytes transferred for solution and &#x2F;or hashrate submission.&lt;&#x2F;p&gt;
&lt;p&gt;If client is resuming a previous session it &lt;strong&gt;CAN&lt;&#x2F;strong&gt; omit the authorization request for it&#x27;s workers and, in this case, &lt;strong&gt;MUST&lt;&#x2F;strong&gt; use the tokens assigned in the originating session. It&#x27;s up to the server to keep the correct map between tokens and workers.
The server receiving an authorization request where the credentials match previously authorized ones within the same session &lt;strong&gt;MUST&lt;&#x2F;strong&gt; reply back with the previously generated unique token.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;prepare-for-mining&quot;&gt;Prepare for mining&lt;&#x2F;h3&gt;
&lt;p&gt;A lot of data is sent over the wire multiple times with useless redundancy. For instance the seed hash is meant to change only every 30000 blocks (roughly 5 days) while fixed-diff pools rarely change the work target. Moreover pools must optimize the search segments among miners trying to assign to every session a different &quot;startNonce&quot; (AKA extraNonce).
For this purpose the &lt;code&gt;notification&lt;&#x2F;code&gt; method &lt;code&gt;mining.set&lt;&#x2F;code&gt; allows to set (on miner&#x27;s side) only those params which change less frequently. The server will keep track of seed, target and extraNonce at session level and will push a notification &lt;code&gt;mining.set&lt;&#x2F;code&gt; whenever any (or all) of those values change to the connected miner.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;method&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;mining.set&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; :&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;dc&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;target&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; :&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0112e0be826d694b2e62d01511f12a6061fbaec8bc02357593e70e52ba&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;algo&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; :&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ethash&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;extranonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; :&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;af4c&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;At the beginning of each &lt;code&gt;session&lt;&#x2F;code&gt; the server &lt;strong&gt;MUST&lt;&#x2F;strong&gt; send this notification before any &lt;code&gt;mining.notify&lt;&#x2F;code&gt;. All values passed by this notification will be valid for all &lt;strong&gt;NEXT&lt;&#x2F;strong&gt; jobs until a new &lt;code&gt;mining.set&lt;&#x2F;code&gt; notification overwrites them. Description of members is as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;optional &lt;code&gt;epoch&lt;&#x2F;code&gt; (hex) : unlike all actual Stratum implementations the server should inform the client of the epoch number instead of passing the seed hash. This is enforced by two reasons: the main one is that client has only one way to compute the epoch number and this is by a linear search from epoch 0 iteratively trying increasing epochs till the hash matches the seed hash. Second reason is that epoch number is more concise than seed hash. In the end the seed hash is only transmitted to inform the client about the epoch and is not involved in the mining algorithm.&lt;&#x2F;li&gt;
&lt;li&gt;optional &lt;code&gt;target&lt;&#x2F;code&gt; (hex) : this is the boundary hash already adjusted for pool difficulty. Unlike in EthereumStratum&#x2F;1.0.0, which provides a &lt;code&gt;mining.set_difficulty&lt;&#x2F;code&gt; notification of an &lt;em&gt;index of difficulty&lt;&#x2F;em&gt;, the proponent opt to pass directly the boundary hash. If omitted the client &lt;strong&gt;MUST&lt;&#x2F;strong&gt; assume a boundary of &lt;code&gt;&quot;0x00000000ffff0000000000000000000000000000000000000000000000000000&quot;&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;optional &lt;code&gt;algo&lt;&#x2F;code&gt; (string) : the algorithm the miner is expected to mine on. If omitted the client &lt;strong&gt;MUST&lt;&#x2F;strong&gt; assume &lt;code&gt;&quot;algo&quot;: &quot;ethash&quot;&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;optional &lt;code&gt;extranonce&lt;&#x2F;code&gt; (hex) : a starting search segment nonce assigned by server to clients so they possibly do not overlap their search segments. If server wants to &quot;cancel&quot; a previously set extranonce it must pass this member valued as an empty string.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Whenever the server detects that one, or two, or three or four values change within the session, the server will issue a notification with one, or two or three or four members in the &lt;code&gt;param&lt;&#x2F;code&gt; object. For this reason on each &lt;strong&gt;new&lt;&#x2F;strong&gt; session the server &lt;strong&gt;MUST&lt;&#x2F;strong&gt; pass all four members. As a consequence the miner is instructed to adapt those values on &lt;strong&gt;next&lt;&#x2F;strong&gt; job which gets notified.
The new &lt;code&gt;algo&lt;&#x2F;code&gt; member is defined to be prepared for possible presence of algorithm variants to ethash, namely ethash1a or ProgPow.
Pools providing multicoin switching will take care to send a new &lt;code&gt;mining.set&lt;&#x2F;code&gt; to miners before pushing any job after a switch.
The client which can&#x27;t support the data provided in the &lt;code&gt;mining.set&lt;&#x2F;code&gt; notification &lt;strong&gt;MAY&lt;&#x2F;strong&gt; close connection or stay idle till new values satisfy it&#x27;s configuration (see &lt;code&gt;mining.noop&lt;&#x2F;code&gt;).
All client&#x27;s implementations &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be prepared to accept new extranonces during the session: unlike in EthereumStratum&#x2F;1.0.0 the optional client advertisement &lt;code&gt;mining.extranonce.subscribe&lt;&#x2F;code&gt; is now implicit and mandatory.&lt;&#x2F;p&gt;
&lt;p&gt;The miner receiving the &lt;code&gt;extranonce&lt;&#x2F;code&gt; &lt;strong&gt;MUST&lt;&#x2F;strong&gt; initialize the search segment for next job resizing the extranonce to a hex of 16 bytes thus appending as many zeroes as needed.
Extranonce &quot;af4c&quot; means &quot;&lt;em&gt;search segment of next jobs starts from 0xaf4c000000000000&lt;&#x2F;em&gt;&quot;
If &lt;code&gt;extranonce&lt;&#x2F;code&gt; is valued to an empty string, or it&#x27;s never been set within the session scope, the client is free pick any starting point of it&#x27;s own search segment on subsequent &lt;code&gt;mining.notify&lt;&#x2F;code&gt; jobs.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;a-detail-of-extranonce&quot;&gt;A detail of &quot;extranonce&quot;&lt;&#x2F;h3&gt;
&lt;p&gt;Miners connected to a pool might likely process the very same nonces thus wasting a lot of duplicate jobs. A &lt;code&gt;nonce&lt;&#x2F;code&gt; is any valid number which, applied to algorithm and job specifications, produces a result which is below a certain target. For every job pushed by server to client(s) there are 2^64 possible nonces to test.&lt;&#x2F;p&gt;
&lt;p&gt;To be noted that:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Any nonce in the 2^64 has the very same possibility to be the right one.&lt;&#x2F;li&gt;
&lt;li&gt;A certain hashing job can be solved by more than one nonce&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Every &quot;test&quot; over a number is called a hash. Assuming a miner should receive a job for each block and considering the actual average block time of 15 seconds that would mean a miner should try&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ( 2^64 &#x2F; 15 ) &#x2F; 1T ~ 1,229,782.94 TeraHashes per second&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This computation capacity is well beyond any miner on the market (including ASICs). For this reason single miners can process only small chunks (segments) of this humongous range. The way miners pick the segments to search on is beyond the scope of this work. Fact is as miners are not coordinated there is no knowledge - for a single miner - of segments picked by other miners.
Extranonce concept is here to mitigate this possibility of duplicate jobs charging the server (the work provider) to give miners, at the maximum possible extent, different segments to search on.&lt;&#x2F;p&gt;
&lt;p&gt;Giving the above assumptions we can depict a nonce as any number in the hex range:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Min 0x0000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Max 0xffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;em&gt;the prefix 0x is voluntarily inserted here only to give a better visual representation&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;extranonce&lt;&#x2F;code&gt; is, at it&#x27;s basics, the message of the server saying the client &quot;&lt;em&gt;I give you the first number to start search from&lt;&#x2F;em&gt;&quot;. More in detail the &lt;code&gt;extranonce&lt;&#x2F;code&gt; is the leftmost part of that number.
Assume a pool notifies the client the usage of extranonce &lt;code&gt;ab5d&lt;&#x2F;code&gt; this means the client will see it&#x27;s search segment narrowed as&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Min 0xab5d000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Max 0xab5dffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Pushing an extranonce of 4 bytes (like in the example) will give pool the possibility to separate segment 65535 different miners ( or if you prefer 0xffff miners ) while leaving the miner still a segment of 2^48 possible nonces to search on.
Recalculating, as above, the computation capacity needed to search this segment we get&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ( 2^48 &#x2F; 15 ) &#x2F; 1T ~ 18.76 TeraHashes per second&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Which is still a wide segment where miners can randomly (or using other ergodic techniques) pick their internal search segments.&lt;&#x2F;p&gt;
&lt;p&gt;Extranonce &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be passed with all relevant bytes (no omission of left zeroes) for a specific reason. Assume an extranonce of &quot;01ac&quot; : it  has the same decimal value of &quot;1ac&quot; but the number of bytes changes thus changing available search segment&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  When &amp;quot;01ac&amp;quot;               When &amp;quot;1ac&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Segment is                Segment is&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Min  0x01ac000000000000   Min  0x1ac0000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Max  0x01acffffffffffff   Max  0x1acfffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;As you can see resulting segments are quite different&lt;&#x2F;p&gt;
&lt;p&gt;This all said pools (server), when making use of extranonce, &lt;strong&gt;MUST&lt;&#x2F;strong&gt; observe a maximum length of 6 bytes (hex).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;jobs-notification&quot;&gt;Jobs notification&lt;&#x2F;h3&gt;
&lt;p&gt;When available server will dispatch jobs to connected miners issuing a &lt;code&gt;mining.notify&lt;&#x2F;code&gt; notification.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;method&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;mining.notify&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bf0488aa&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;6526d5&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;645cf20198c2f3861e947d4f67e3ab63b7b2e24dcc9095bd9123e7b33371f6cc&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;params&lt;&#x2F;code&gt; member is made of 4 mandatory elements:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;1st element is jobId as specified by pool. To reduce the amount of data sent over the wire pools &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; keep their job IDs as concise as possible. Pushing a Job id which is identical to headerhash is a bad practice and is highly discouraged.&lt;&#x2F;li&gt;
&lt;li&gt;2nd element is the hex number of the block id&lt;&#x2F;li&gt;
&lt;li&gt;3rd element is the headerhash.&lt;&#x2F;li&gt;
&lt;li&gt;4th element is an hex boolean indicating whether or not eventually found shares from previous jobs will be accounted for sure as stale.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;solution-submission&quot;&gt;Solution submission&lt;&#x2F;h3&gt;
&lt;p&gt;When a miner finds a solution for a job he is mining on it sends a &lt;code&gt;mining.submit&lt;&#x2F;code&gt; request to server.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 31&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;method&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;mining.submit&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bf0488aa&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;68765fccd712&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;w-123&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;First element of &lt;code&gt;params&lt;&#x2F;code&gt; array is the jobId this solution refers to (as sent in the &lt;code&gt;mining.notify&lt;&#x2F;code&gt; message from the server). Second element is the &lt;code&gt;miner nonce&lt;&#x2F;code&gt; as hex. Third element is the token given to the worker previous &lt;code&gt;mining.authorize&lt;&#x2F;code&gt; request. Any &lt;code&gt;mining.submit&lt;&#x2F;code&gt; request bound to a worker which was not successfully authorized - i.e. the token does not exist in the session - &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be rejected.&lt;&#x2F;p&gt;
&lt;p&gt;You&#x27;ll notice in the sample above the &lt;code&gt;miner nonce&lt;&#x2F;code&gt; is only 12 bytes wide (should be 16). Why?
That&#x27;s because in the previous &lt;code&gt;mining.set&lt;&#x2F;code&gt; the server has set an &lt;code&gt;extranonce&lt;&#x2F;code&gt; of &lt;code&gt;af4c&lt;&#x2F;code&gt;. This means the full nonce is &lt;code&gt;af4c68765fccd712&lt;&#x2F;code&gt;
In presence of extranonce the miner &lt;strong&gt;MUST&lt;&#x2F;strong&gt; submit only the chars to append to the extranonce to build the final hex value. If no extranonce is set for the session or for the work the miner &lt;strong&gt;MUST&lt;&#x2F;strong&gt; send all 16 bytes.&lt;&#x2F;p&gt;
&lt;p&gt;It&#x27;s server duty to keep track of the tuples &lt;code&gt;job ids &amp;lt;-&amp;gt; extranonces&lt;&#x2F;code&gt; per session.&lt;&#x2F;p&gt;
&lt;p&gt;When the server receives this request it either responds success using the short form&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 31&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;or, in case of any error or condition with a detailed error object&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 31&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;code&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 404&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;message&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; :&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Job not found&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Client &lt;strong&gt;should&lt;&#x2F;strong&gt; treat errors as &quot;soft&quot; errors (stales) or &quot;hard&quot; (bad nonce computation, job not found etc.). Errors in 5xx range are server errors and suggest the miner to abandon the connection and switch to a failover.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;hashrate&quot;&gt;Hashrate&lt;&#x2F;h3&gt;
&lt;p&gt;Most pools offer statistic information, in form of graphs or by API calls, about the calculated hashrate expressed by the miner while miners like to compare this data with the hashrate they read on their devices. Communication about parties of these information have never been coded in Stratum and most pools adopt the method from getWork named &lt;code&gt;eth_submitHashrate&lt;&#x2F;code&gt;.
In this document we propose an official implementation of the &lt;code&gt;mining.hashrate&lt;&#x2F;code&gt; request.
This method behaves differently when issued from client or from server.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;client-communicates-it-s-hashrate-to-server&quot;&gt;Client communicates it&#x27;s hashrate to server.&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; :&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 16&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;method&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;mining.hashrate&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;500000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;w-123&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where &lt;code&gt;params&lt;&#x2F;code&gt; is an array made of two elements: the first is a hexadecimal string representation (32 bytes) of the hashrate the miner reads on it&#x27;s devices and the latter is the authorization token issued to worker this hashrate is refers to (see above for &lt;code&gt;mining.authorization&lt;&#x2F;code&gt;).
Server &lt;strong&gt;MUST&lt;&#x2F;strong&gt; respond back with either an aknowledgment message&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 16&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Optionally the server can reply back reporting it&#x27;s findings about calculated hashrate &lt;strong&gt;for the same worker&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 16&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; :&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;4f0000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;w-123&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In case of errors - for example when the client submits too frequently - with&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 16&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; :&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;code&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 220&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;message&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Enhance your calm. Too many requests&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;server-communicates-hashrate-to-client&quot;&gt;Server communicates hashrate to client&lt;&#x2F;h4&gt;
&lt;p&gt;Optionally the server can &lt;strong&gt;notify&lt;&#x2F;strong&gt; client about it&#x27;s overall performance (according to schedule set on server) with a &lt;code&gt;mining.hashrate&lt;&#x2F;code&gt; notification composed like this&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;method&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;mining.hashrate&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;interval&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 60&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;hr&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;500000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;accepted&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3692&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;20&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;rejected&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Where &lt;code&gt;params&lt;&#x2F;code&gt; is an object which holds these members for values of the &lt;strong&gt;whole session&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;interval&lt;&#x2F;code&gt; (number) the width, in minutes, of the observation window. &quot;&lt;em&gt;in the last x minutes we calculated ...&lt;&#x2F;em&gt;&quot;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;hr&lt;&#x2F;code&gt; (hex) representation of the hashrate the pool has calculated for the miner&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;accepted&lt;&#x2F;code&gt; is an array of two number elements : the first is the overall count of accepted shares and the second is the number of stale shares. The array must be interpreted as &quot;total accepted of which x are stale&quot;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;rejected&lt;&#x2F;code&gt; (number) the overall number of rejected shares&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The client will eventually take internal actions to reset&#x2F;restart it&#x27;s workers.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Address and ERC20-compliant transfer rules</title>
        <published>2018-11-09T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Cyril Lapinte</name><email>cyril.lapinte@mtpelerin.com</email>
	</author>
	
	<author>
		<name>Laurent Aapro</name><email>laurent.aapro@mtpelerin.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1592/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/1597" />
        

        <id>https://wg-eips.ritovision.com/1592/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:1592"
            label="ERC-1592" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1592/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;We propose a standard and an interface to define transfer rules, in the context of ERC20 tokens and possibly beyond.&lt;&#x2F;p&gt;
&lt;p&gt;A rule can act based on sender, destination and amount, and is triggered (and rejects the transfer) according to any required business logic.&lt;&#x2F;p&gt;
&lt;p&gt;To ease rule reusability and composition, we also propose an interface and base implementation for a rule engine.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard proposal should answer the following challenges:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Enable integration of rules with interacting platforms such as exchanges, decentralized wallets and DApps.&lt;&#x2F;li&gt;
&lt;li&gt;Externale code and storage, improve altogether reusability, gas costs and contracts&#x27; memory footprint.&lt;&#x2F;li&gt;
&lt;li&gt;Highlight contract behavior and its evolution, in order to ease user interaction with such contract.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;If these challenges are answered, this proposal will provide a unified basis for transfer rules and hopefully address the transfer restriction needs of other EIPs as well, e.g.
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;902&#x2F;&quot;&gt;EIP-902&lt;&#x2F;a&gt;,
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1066&#x2F;&quot;&gt;EIP-1066&lt;&#x2F;a&gt;
and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1175&#x2F;&quot;&gt;EIP-1175&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This document proposes specifications for a standard of &lt;strong&gt;transfer rules&lt;&#x2F;strong&gt; and interfaces to both the rules and the rule engine, which was made to be inherited by a token, but may have a much broader scope in the authors&#x27; opinion.&lt;&#x2F;p&gt;
&lt;p&gt;The last section of this document illustrates the proposal with a rule template and links to rule implementations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;ERC20 was designed as a standard interface allowing any token on Ethereum to be handled by other applications: from wallets to decentralized exchanges. This has been extremely powerful, but future developments in the industry of tokenization are bringing new challenges. For example it is already hard to know exactly why an ERC20 transfer failed, and it will become even harder when many tokens add their own transfer rules to the mix; we propose that it should be trivial to determine before a tx is sent, whether the transfer should turn out valid or invalid, and why (unless conditions change in the meantime obviously). On the other hand, if the rules were changed, it should also be easily detected, so that the interacting party knows it must adjust its expectations or model.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;We define below an interface for a rule. Rules are meant to be as simple as possible, to limit gas expenditure, since that logic will be executed on every transfer. Another reason for keeping rules simple and short, and strive for atomicity, is to facilitate both composition and interpretation of rejected transfers. By knowing which rule was triggered, we obtain a clear picture of the reason for rejection.&lt;&#x2F;p&gt;
&lt;p&gt;The engine we propose executes all the rules defined by its owner, on every transfer and it is easy to add and remove rules individually, although we have chosen to use quite a raw rule update method, to save on deployment costs, which are often tight when it comes to token smart contracts.&lt;&#x2F;p&gt;
&lt;p&gt;Rules are deployed on the blockchain as individual smart contracts, and called upon by the rule engine they were attached to. But any third party, for example an exchange preparing a cashout for a customer, can very cheaply query the rule engine of the token, or a single rule directly, to verify the validity of a transfer before execution, so as to never get a rejected transaction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rule-interface&quot;&gt;Rule interface&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;IRule&lt;&#x2F;code&gt; interface should provide a way to validate if an address or a transfer is valid.&lt;&#x2F;p&gt;
&lt;p&gt;If one of these two methods is not applicable, it can simply be made to return true systematically.
If any parameter of &lt;code&gt;isTransferValid&lt;&#x2F;code&gt; is not needed, its name should be commented out with &lt;code&gt;&#x2F;* *&#x2F;&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ^&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;25&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IRule&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isAddressValid&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isTransferValid&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;withrules-interface&quot;&gt;WithRules interface&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;WithRules&lt;&#x2F;code&gt; interface describes the integration of rules to a rule engine.
Developers may choose to not implement this interface if their code will only deal with one rule, or if it is not desirable to update the rules.&lt;&#x2F;p&gt;
&lt;p&gt;The rules ordering must be thought through carefully.
Rules which are cheaper to validate or have a higher chance to break should be put first to reduce global gas expenditure, then business logic should guide the ordering of rules. That is why rules for a given context should be defined as a whole and not individually.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ^&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;25&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;.&#x2F;IRule.sol&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IWithRules&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ruleLength&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; rule&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _ruleId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;IRule&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validateAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validateTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; defineRules&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;IRule&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _rules&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RulesDefined&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; count&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;withrules-implementation&quot;&gt;WithRules implementation&lt;&#x2F;h2&gt;
&lt;p&gt;We also propose a simple implementation of the rule engine, available &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;MtPelerin&#x2F;MtPelerin-protocol&#x2F;blob&#x2F;master&#x2F;contracts&#x2F;rule&#x2F;WithRules.sol&quot;&gt;here&lt;&#x2F;a&gt;. It has been kept minimal both to save on gas costs on each transfer, and to reduce the deployment cost overhead for the derived smart contract.&lt;&#x2F;p&gt;
&lt;p&gt;On top of implementing the interface above, this engine also defines two modifiers (&lt;code&gt;whenAddressRulesAreValid&lt;&#x2F;code&gt;and  &lt;code&gt;whenTransferRulesAreValid&lt;&#x2F;code&gt;), which can be used throughout the token contract to restrict &lt;code&gt;transfer()&lt;&#x2F;code&gt;, &lt;code&gt;transferFrom&lt;&#x2F;code&gt; and any other function that needs to respect either a simple whitelist or complex transfer rules.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;integration&quot;&gt;Integration&lt;&#x2F;h2&gt;
&lt;p&gt;To use rules within a token is as easy as having the token inherit from WithRules, then writing rules according to the IRule interface and deploying each rule individually. The token owner can then use &lt;code&gt;defineRules()&lt;&#x2F;code&gt; to attach all rules in the chosen order, within a single transaction.&lt;&#x2F;p&gt;
&lt;p&gt;Below is a template for a rule.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;..&#x2F;interface&#x2F;IRule.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TemplateRule&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IRule&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; state vars for business logic&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; arguments for init &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; initializations&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isAddressValid&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    boolean isValid&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; business logic &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; isValid&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isTransferValid&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    boolean isValid&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; business logic &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; isValid&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;*** Notes ***
The MPS (Mt Pelerin&#x27;s Share) token is the current live implementation of this standard.
Other implementations may be written with different trade-offs: from gas savings to improved security.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;example-of-rules-implementations&quot;&gt;Example of rules implementations&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;MtPelerin&#x2F;MtPelerin-protocol&#x2F;tree&#x2F;master&#x2F;contracts&#x2F;rule&#x2F;YesNoRule.sol&quot;&gt;YesNo rule&lt;&#x2F;a&gt;: Trivial rule used to demonstrate both a rule and the rule engine.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;MtPelerin&#x2F;MtPelerin-protocol&#x2F;tree&#x2F;master&#x2F;contracts&#x2F;rule&#x2F;FreezeRule.sol&quot;&gt;Freeze rule&lt;&#x2F;a&gt;: This rule allows to prevent any transfer of tokens to or from chosen addresses. A smart blacklist.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;MtPelerin&#x2F;MtPelerin-protocol&#x2F;tree&#x2F;master&#x2F;contracts&#x2F;rule&#x2F;LockRule.sol&quot;&gt;Lock rule&lt;&#x2F;a&gt;: Define a global transfer policy preventing either sending or receiving tokens within a period of time. Exceptions may be granted to some addresses by the token admin. A smart whitelist.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;MtPelerin&#x2F;MtPelerin-protocol&#x2F;tree&#x2F;master&#x2F;contracts&#x2F;rule&#x2F;UserKycRule.sol&quot;&gt;User Kyc Rule&lt;&#x2F;a&gt;: Rule example relying on an existing whitelist to assert transfer and addresses validity. It is a good example of a rule that completely externalizes it&#x27;s tasks.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;example-implementations-are-available-at&quot;&gt;Example implementations are available at&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;MtPelerin&#x2F;MtPelerin-protocol&#x2F;tree&#x2F;master&#x2F;contracts&#x2F;rule&quot;&gt;Mt Pelerin Bridge protocol rules implementation&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;MtPelerin&#x2F;MtPelerin-protocol&#x2F;blob&#x2F;master&#x2F;contracts&#x2F;token&#x2F;component&#x2F;TokenWithRules.sol&quot;&gt;Mt Pelerin Token with rules&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;history&quot;&gt;History&lt;&#x2F;h2&gt;
&lt;p&gt;Historical links related to this standard:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The first regulated tokenized share issued by Mt Pelerin (MPS token) is using an early version of this proposal: https:&#x2F;&#x2F;www.mtpelerin.com&#x2F;blog&#x2F;world-first-tokenized-shares
The rule engine was updated several times, after the token issuance and during the tokensale, to match changing business and legal requirements, showcasing the solidity and flexibility of the rule engine.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.
External references outside this repository will have their own specific copyrights.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>TEthashV1</title>
        <published>2018-11-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>trustfarm</name><email>trustfarm.info@gmail.com</email>
	</author>
	
	<author>
		<name>trustfarm</name><email>cpplover@trustfarm.net</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1485/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/anti-eth-asic-mining-eip-1488-pr/1807" />
        

        <id>https://wg-eips.ritovision.com/1485/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1485"
            label="EIP-1485" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1485/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP modifies ethash in order to break ASIC miners specialized for the current ethash mining algorithm.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP pursue &quot;obsolete current ASIC miners&quot; by modifying PoW algorithm in a very low risk manner and update to latest hash algorithm from deprecated FNV Hash algorithms.&lt;&#x2F;p&gt;
&lt;p&gt;Following TEthashV1 algorithm suggests safe transition of PoW algorithms and secure the FNV Algorithm in MIX Parts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Provide original Ethash proof of work verification with minimal set of changes by updating FNV0 algorithm&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h4 id=&quot;1-reference-materials-on-ethash-fnv0&quot;&gt;1. Reference materials on ETHASH FNV0&lt;&#x2F;h4&gt;
&lt;h4 id=&quot;where-fnv-applied-on-ethash&quot;&gt;Where FNV Applied on ETHASH&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;In &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;web.archive.org&#x2F;web&#x2F;20200505215203&#x2F;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;wiki&#x2F;wiki&#x2F;Ethash&quot;&gt;ETHASH&lt;&#x2F;a&gt;, FNV Hash is used on&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;ol&gt;
&lt;li&gt;On data aggregation function, MIX parts.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Ethash Algorithm&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Header + Nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      Keccak &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    **[MIX 0]**  --&amp;gt; **[DAG Page]**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         |               |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;       Mixing         &amp;lt;--|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    **[Mix 63]**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         |-----&amp;gt; Mix64  [Process] ---&amp;gt; Mix Digest [32B]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;FNV used in DAG Generation
and Mixing for random access or DAG Page.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;2-current-applied-ethash-fnv-hash-implementation-is-deprecated-now&quot;&gt;2. Current applied Ethash FNV hash implementation is deprecated now.&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Fowler%E2%80%93Noll%E2%80%93Vo_hash_function#FNV-0_hash_(deprecated)&quot;&gt;FNV-0_hash (deprecated)&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;It is a simple way of hashing algorithm&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; hash = 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; for each byte_of_data to be hashed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; 	hash = hash × FNV_prime&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; 	hash = hash XOR octet_of_data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; return hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;When analysed FNV-0 , there&#x27;s very weak &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;simple.wikipedia.org&#x2F;wiki&#x2F;Avalanche_effect&quot;&gt;avalanche effect&lt;&#x2F;a&gt;, when hash input changes on 1~2bits. refer &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;tao-foundation&#x2F;FNV-Analysis#how-to-test-and-analysis-reference-test-code&quot;&gt;FNV-Analysis reference section&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;We need to research and apply newer FNV hash or short message hash algorithm.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;3-fnv1a-hash-algorithm-description&quot;&gt;3. FNV1A hash algorithm description&lt;&#x2F;h4&gt;
&lt;p&gt;Previous proposed algorithm based on FNV1 &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1355&#x2F;&quot;&gt;EIP-1355&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;There&#x27;s an implementation that looks like &quot;Missing Offset Bias&quot; at &lt;strong&gt;FNV1A&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Quotation of &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Fowler%E2%80%93Noll%E2%80%93Vo_hash_function#FNV-1a_hash&quot;&gt;original algorithm FNV1A&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;use hash offset&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;FNV-1a hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;The FNV-1a hash differs from the FNV-1 hash by only the order in which the multiply and XOR is performed:[8][10]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   hash = FNV_offset_basis&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   for each byte_of_data to be hashed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   	hash = hash XOR byte_of_data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   	hash = hash × FNV_prime&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   return hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;FNV_offset_basis and computation order change of xor and multiplication Makes one more xor and multiply computation, but more secure hash effects than FNV0.
and make dispersion boundary condition (0, even number, ..) by using of Prime Number.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;4-real-implementation-for-fnv1a&quot;&gt;4. Real Implementation for FNV1A&lt;&#x2F;h4&gt;
&lt;p&gt;Consider real computation resources, in TEthashV1 uses hash byte_of_data to 4bytes aligned data.&lt;&#x2F;p&gt;
&lt;p&gt;In TETHashV1, Adapts fully follow the FNV1A implementation.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;TETHASHV1 FNV1A implementation&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Following are reference implementation of FNV1A adapted in TETHashV1.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;cpp&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Reference Pseudo c&#x2F;cpp implementation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;define&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FNV_PRIME&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;01000193&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;U&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;define&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FNV_OFFSET_BASIS&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;  0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;811c9dc5&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;U&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;define&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fnv1a&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;x&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; y&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;         (&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;FNV_OFFSET_BASIS&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;^&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;x&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt;FNV_PRIME&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ^&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;y&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; FNV_PRIME&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;define&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fnv1a_reduce&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;b&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;d&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;fnv1a&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;fnv1a&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;fnv1a&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;a&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; b&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; c&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; d&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Another Byte aligned implementation of FNV1A , call to FNV1c&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;cpp&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;define&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FNV_PRIME&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;   0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;01000193&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;U&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;define&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FNV_OFFSET_BASIS&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;  0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;811c9dc5&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;U&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;define&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fnv1i&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;x&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;           (&lt;&#x2F;span&gt;&lt;span&gt;  (&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;                                          \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                (&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;FNV_OFFSET_BASIS&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;^&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;x&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;24&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;000000ff&lt;&#x2F;span&gt;&lt;span&gt; )&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; FNV_PRIME&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                            ^&lt;&#x2F;span&gt;&lt;span&gt;   (&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;x&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;16&lt;&#x2F;span&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;000000ff&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; FNV_PRIME&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                            ^&lt;&#x2F;span&gt;&lt;span&gt;   (&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;x&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;8&lt;&#x2F;span&gt;&lt;span&gt;   )&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;000000ff&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; FNV_PRIME&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                            ^&lt;&#x2F;span&gt;&lt;span&gt;   (&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;x&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;      )&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;000000ff&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; FNV_PRIME&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;define&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fnv1c&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;x&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; y&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;            (&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;fnv1i&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;x&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ^&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;y&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; FNV_PRIME&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;5-fnv-analysis&quot;&gt;5. &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;tao-foundation&#x2F;FNV-Analysis&quot;&gt;FNV-Analysis&lt;&#x2F;a&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;FNV Mix Algorithm Analysis for TEthashV1&lt;&#x2F;p&gt;
&lt;h4 id=&quot;how-to-test-and-analysis-reference-test-code&quot;&gt;How to test and analysis reference test code.&lt;&#x2F;h4&gt;
&lt;p&gt;You can compile it with simple in terminal.
No additional library needs,&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gcc&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; fnvtest&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; fnvcltest.c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;And You can execute it&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;fnvtest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;F(00,00)::VEC(0, 0, ffffffff, 0)::      FNV  :00000000, DF=00000000(00) DS(00000000), FNV1 :00000000, DF=00000000(00) DS(00000000), FNV1a:117697cd, DF=117697cd(17) DS(117697cd), FNV1c:1210d00f, DF=127f8dbf(20) DS(11a1725f),         F___RC=efe1b9c4, DF:efe1b9c4(19) , F1__RC=deb68dfe, DF:deb68dfe(22) , F1A_RC=99bad28b, DF:99bad28b(17) , F1C_RC=e29fa497, DF:e29fa497(18)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;F(00,01)::VEC(0, 1, ffffffff, 0)::      FNV  :00000001, DF=00000001(01) DS(00000001), FNV1 :01000193, DF=01000193(06) DS(01000193), FNV1a:1076963a, DF=010001f7(09) DS(01000193), FNV1c:1110ce7c, DF=03001e73(11) DS(01000193),         F___RC=fefffe6d, DF:111e47a9(14) , F1__RC=d9fd8597, DF:074b0869(12) , F1A_RC=72c287e0, DF:eb78556b(19) , F1C_RC=6b6991ef, DF:89f63578(17)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;F(00,02)::VEC(0, 2, ffffffff, 0)::      FNV  :00000002, DF=00000003(02) DS(00000001), FNV1 :02000326, DF=030002b5(08) DS(01000193), FNV1a:0f7694a7, DF=1f00029d(11) DS(01000193), FNV1c:1410d335, DF=05001d49(09) DS(030004b9),         F___RC=d8fd8404, DF:26027a69(13) , F1__RC=9b16d24c, DF:42eb57db(19) , F1A_RC=c17f0ecb, DF:b3bd892b(18) , F1C_RC=a5be8e78, DF:ced71f97(21)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;F(00,03)::VEC(0, 3, ffffffff, 0)::      FNV  :00000003, DF=00000001(01) DS(00000001), FNV1 :030004b9, DF=0100079f(10) DS(01000193), FNV1a:0e769314, DF=010007b3(09) DS(01000193), FNV1c:1310d1a2, DF=07000297(09) DS(01000193),         F___RC=b2fb099b, DF:6a068d9f(16) , F1__RC=5c301f01, DF:c726cd4d(17) , F1A_RC=94cf402e, DF:55b04ee5(16) , F1C_RC=aea1a025, DF:0b1f2e5d(17)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;F(00,04)::VEC(0, 4, ffffffff, 0)::      FNV  :00000004, DF=00000007(03) DS(00000001), FNV1 :0400064c, DF=070002f5(10) DS(01000193), FNV1a:0d769181, DF=03000295(07) DS(01000193), FNV1c:0e10c9c3, DF=1d001861(09) DS(050007df),         F___RC=8cf88f32, DF:3e0386a9(14) , F1__RC=1d496bb6, DF:417974b7(17) , F1A_RC=89401d59, DF:1d8f5d77(20) , F1C_RC=e4e96c7c, DF:4a48cc59(13)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;F(00,05)::VEC(0, 5, ffffffff, 0)::      FNV  :00000005, DF=00000001(01) DS(00000001), FNV1 :050007df, DF=01000193(06) DS(01000193), FNV1a:0c768fee, DF=01001e6f(11) DS(01000193), FNV1c:0d10c830, DF=030001f3(09) DS(01000193),         F___RC=66f614c9, DF:ea0e9bfb(20) , F1__RC=de62b86b, DF:c32bd3dd(19) , F1A_RC=346e222c, DF:bd2e3f75(21) , F1C_RC=502e5f82, DF:b4c733fe(20)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;F(00,06)::VEC(0, 6, ffffffff, 0)::      FNV  :00000006, DF=00000003(02) DS(00000001), FNV1 :06000972, DF=03000ead(10) DS(01000193), FNV1a:0b768e5b, DF=070001b5(09) DS(01000193), FNV1c:1010cce9, DF=1d0004d9(10) DS(030004b9),         F___RC=40f39a60, DF:26058ea9(13) , F1__RC=9f7c0520, DF:411ebd4b(16) , F1A_RC=b376a527, DF:8718870b(13) , F1C_RC=1241a9a4, DF:426ff626(17)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;F(00,07)::VEC(0, 7, ffffffff, 0)::      FNV  :00000007, DF=00000001(01) DS(00000001), FNV1 :07000b05, DF=01000277(08) DS(01000193), FNV1a:0a768cc8, DF=01000293(06) DS(01000193), FNV1c:0f10cb56, DF=1f0007bf(15) DS(01000193),         F___RC=1af11ff7, DF:5a028597(13) , F1__RC=609551d5, DF:ffe954f5(22) , F1A_RC=14293bea, DF:a75f9ecd(21) , F1C_RC=49d34bba, DF:5b92e21e(16)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;F(00,08)::VEC(0, 8, ffffffff, 0)::      FNV  :00000008, DF=0000000f(04) DS(00000001), FNV1 :08000c98, DF=0f00079d(12) DS(01000193), FNV1a:09768b35, DF=030007fd(12) DS(01000193), FNV1c:1a10dca7, DF=150017f1(12) DS(0b001151),         F___RC=f4eea58e, DF:ee1fba79(21) , F1__RC=21ae9e8a, DF:413bcf5f(19) , F1A_RC=eeebb7a5, DF:fac28c4f(17) , F1C_RC=7da04f47, DF:347304fd(16)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;F(00,09)::VEC(0, 9, ffffffff, 0)::      FNV  :00000009, DF=00000001(01) DS(00000001), FNV1 :09000e2b, DF=010002b3(07) DS(01000193), FNV1a:087689a2, DF=01000297(07) DS(01000193), FNV1c:1910db14, DF=030007b3(10) DS(01000193),         F___RC=ceec2b25, DF:3a028eab(14) , F1__RC=e2c7eb3f, DF:c36975b5(18) , F1A_RC=54e1aef8, DF:ba0a195d(15) , F1C_RC=d425e1af, DF:a985aee8(16)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;F(00,0a)::VEC(0, a, ffffffff, 0)::      FNV  :0000000a, DF=00000003(02) DS(00000001), FNV1 :0a000fbe, DF=03000195(07) DS(01000193), FNV1a:0776880f, DF=0f0001ad(10) DS(01000193), FNV1c:1c10dfcd, DF=050004d9(08) DS(030004b9),         F___RC=a8e9b0bc, DF:66059b99(15) , F1__RC=a3e137f4, DF:4126dccb(15) , F1A_RC=213fcd63, DF:75de639b(20) , F1C_RC=7e1d2751, DF:aa38c6fe(18)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;F(00,0b)::VEC(0, b, ffffffff, 0)::      FNV  :0000000b, DF=00000001(01) DS(00000001), FNV1 :0b001151, DF=01001eef(12) DS(01000193), FNV1a:0676867c, DF=01000e73(09) DS(01000193), FNV1c:1b10de3a, DF=070001f7(11) DS(01000193),         F___RC=82e73653, DF:2a0e86ef(16) , F1__RC=64fa84a9, DF:c71bb35d(19) , F1A_RC=5598ce46, DF:74a70325(14) , F1C_RC=6400c630, DF:1a1de161(14)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;F(00,0c)::VEC(0, c, ffffffff, 0)::      FNV  :0000000c, DF=00000007(03) DS(00000001), FNV1 :0c0012e4, DF=070003b5(10) DS(01000193), FNV1a:057684e9, DF=03000295(07) DS(01000193), FNV1c:1610d65b, DF=0d000861(07) DS(050007df),         F___RC=5ce4bbea, DF:de038db9(17) , F1__RC=2613d15e, DF:42e955f7(18) , F1A_RC=6a220ff1, DF:3fbac1b7(20) , F1C_RC=6e781da4, DF:0a78db94(15)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;F(00,0d)::VEC(0, d, ffffffff, 0)::      FNV  :0000000d, DF=00000001(01) DS(00000001), FNV1 :0d001477, DF=01000693(07) DS(01000193), FNV1a:04768356, DF=010007bf(11) DS(01000193), FNV1c:1510d4c8, DF=03000293(07) DS(01000193),         F___RC=36e24181, DF:6a06fa6b(17) , F1__RC=e72d1e13, DF:c13ecf4d(18) , F1A_RC=168d4944, DF:7caf46b5(19) , F1C_RC=65bbcfa1, DF:0bc3d205(13)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;F(00,0e)::VEC(0, e, ffffffff, 0)::      FNV  :0000000e, DF=00000003(02) DS(00000001), FNV1 :0e00160a, DF=0300027d(09) DS(01000193), FNV1a:037681c3, DF=07000295(08) DS(01000193), FNV1c:1810d981, DF=0d000d49(09) DS(030004b9),         F___RC=10dfc718, DF:263d8699(15) , F1__RC=a8466ac8, DF:4f6b74db(20) , F1A_RC=93e667bf, DF:856b2efb(19) , F1C_RC=76f80ee3, DF:1343c142(11)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;F(00,0f)::VEC(0, f, ffffffff, 0)::      FNV  :0000000f, DF=00000001(01) DS(00000001), FNV1 :0f00179d, DF=01000197(07) DS(01000193), FNV1a:02768030, DF=010001f3(08) DS(01000193), FNV1c:1710d7ee, DF=0f000e6f(13) DS(01000193),         F___RC=eadd4caf, DF:fa028bb7(17) , F1__RC=695fb77d, DF:c119ddb5(17) , F1A_RC=0f485682, DF:9cae313d(17) , F1C_RC=3667e8dc, DF:409fe63f(18)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;F(00,10)::VEC(0, 10, ffffffff, 0)::     FNV  :00000010, DF=0000001f(05) DS(00000001), FNV1 :10001930, DF=1f000ead(13) DS(01000193), FNV1a:01767e9d, DF=0300fead(14) DS(01000193), FNV1c:0210b6df, DF=15006131(09) DS(1500210f),         F___RC=c4dad246, DF:2e079ee9(17) , F1__RC=2a790432, DF:4326b34f(16) , F1A_RC=d10adebd, DF:de42883f(16) , F1C_RC=1ce48e12, DF:2a8366ce(15)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;F(00,01)&lt;&#x2F;code&gt; : is input x,y&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;VEC(0, 1, ffffffff, 0)&lt;&#x2F;code&gt;  : is &lt;code&gt;fnv_reduce&lt;&#x2F;code&gt; input vector (a,b,c,d)&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;FNV  :00000001, DF=00000001(01) DS(00000001)&lt;&#x2F;code&gt; :&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;FNV(00,01)&lt;&#x2F;code&gt; result is 00000001 ,&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;DF&lt;&#x2F;code&gt; : is changed bitcounts, compared with previous outputs, in this case prev[00,00] current[00,01] input is 1bit changed, and output result 1bit changed.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;DS&lt;&#x2F;code&gt; : is distances of previous result and current result , ABS(prev_fnvresult,current_fnvresult).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;** Basically, &lt;code&gt;DF&lt;&#x2F;code&gt; is higher is best on hash algorithm.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;F___RC=fefffe6d, DF:111e47a9(14)&lt;&#x2F;code&gt; : &lt;code&gt;fnv_reduce = fnv(fnv(fnv(a,b),c),d) &lt;&#x2F;code&gt; result is fefffe6d , and Different Bits counts are &lt;code&gt;14&lt;&#x2F;code&gt; bits.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;In case of ethash algorithm, it can&#x27;t prevent ASIC forever.&lt;&#x2F;p&gt;
&lt;p&gt;And, current ethash algorithm&#x27;s FNV function is deprecated.&lt;&#x2F;p&gt;
&lt;p&gt;So, It needs to be upgraded and it will make current ethash based ASICs obsolete.&lt;&#x2F;p&gt;
&lt;p&gt;And current TETHASHV1 FNV1A implementation is based on most of ethash , which is verified for a long time.&lt;&#x2F;p&gt;
&lt;p&gt;Another propose of big differencing the Ethash algorithm need to crypto analysis for a long times and need to GPU code optimization times.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Verification and Optimization timeline Examples&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;original ethminer (2015) -&amp;gt; claymore optimized miner (2016) [1year]&lt;&#x2F;p&gt;
&lt;p&gt;genoil ethminer (2015) -&amp;gt; ethereum-mining&#x2F;ethminer (2017) [2year]&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-results&quot;&gt;Test Results::&lt;&#x2F;h2&gt;
&lt;p&gt;Tethash miner has 2~3% of hashrate degrade on GPU, due to more core computation time.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;This work is licensed under a &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;creativecommons.org&#x2F;licenses&#x2F;by-nc-sa&#x2F;4.0&#x2F;&quot;&gt;Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Transparent Contract Standard</title>
        <published>2018-10-31T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Nick Mudge</name><email>nick@perfectabstractions.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1538/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/1538" />
        

        <id>https://wg-eips.ritovision.com/1538/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:1538"
            label="ERC-1538" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1538/">&lt;p&gt;Replaced by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2535&#x2F;&quot;&gt;EIP-2535 Diamond Standard&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;This standard provides a contract architecture that makes upgradeable contracts flexible, unlimited in size, and transparent.&lt;&#x2F;p&gt;
&lt;p&gt;A transparent contract publicly documents the full history of all changes made to it.&lt;&#x2F;p&gt;
&lt;p&gt;All changes to a transparent contract are reported in a standard format.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;A transparent contract is a proxy contract design pattern that provides the following:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;A way to add, replace and remove multiple functions of a contract atomically (at the same time).&lt;&#x2F;li&gt;
&lt;li&gt;Standard events to show what functions are added, replaced and removed from a contract, and why the changes are made.&lt;&#x2F;li&gt;
&lt;li&gt;A standard way to query a contract to discover and retrieve information about all functions exposed by it.&lt;&#x2F;li&gt;
&lt;li&gt;Solves the 24KB maximum contract size limitation, making the maximum contract size of a transparent contract practically unlimited. This standard makes the worry about contract size a thing of the past.&lt;&#x2F;li&gt;
&lt;li&gt;Enables an upgradeable contract to become immutable in the future if desired.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;A fundamental benefit of Ethereum contracts is that their code is immutable, thereby acquiring trust by trustlessness. People do not have to trust others if it is not possible for a contract to be changed.&lt;&#x2F;p&gt;
&lt;p&gt;However, a fundamental problem with trustless contracts that cannot be changed is that they cannot be changed.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;bugs&quot;&gt;Bugs&lt;&#x2F;h4&gt;
&lt;p&gt;Bugs and security vulnerabilities are unwittingly written into immutable contracts that ruin them.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;improvements&quot;&gt;Improvements&lt;&#x2F;h4&gt;
&lt;p&gt;Immutable, trustless contracts cannot be improved, resulting in increasingly inferior contracts over time.&lt;&#x2F;p&gt;
&lt;p&gt;Contract standards evolve, new ones come out. People, groups and organizations learn over time what people want and what is better and what should be built next. Contracts that cannot be improved not only hold back the authors that create them, but everybody who uses them.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;upgradeable-contracts-vs-centralized-private-database&quot;&gt;Upgradeable Contracts vs. Centralized Private Database&lt;&#x2F;h4&gt;
&lt;p&gt;Why have an upgradeable contract instead of a centralized, private, mutable database?
Here are some reasons:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Because of the openness of storage data and verified code, it is possible to show a provable history of trustworthiness.&lt;&#x2F;li&gt;
&lt;li&gt;Because of the openness, bad behavior can be spotted and reported when it happens.&lt;&#x2F;li&gt;
&lt;li&gt;Independent security and domain experts can review the change history of contracts and vouch for their history of trustworthiness.&lt;&#x2F;li&gt;
&lt;li&gt;It is possible for an upgradeable contract to become immutable and trustless.&lt;&#x2F;li&gt;
&lt;li&gt;An upgradeable contract can have parts of it that are not upgradeable and so are partially immutable and trustless.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h4 id=&quot;immutability&quot;&gt;Immutability&lt;&#x2F;h4&gt;
&lt;p&gt;In some cases immutable, trustless contracts are the right fit. This is the case when a contract is only needed for a short time or it is known ahead of time that there will never be any reason to change or improve it.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;middle-ground&quot;&gt;Middle Ground&lt;&#x2F;h3&gt;
&lt;p&gt;Transparent contracts provide a middle ground between immutable trustless contracts that can&#x27;t be improved and upgradeable contracts that can&#x27;t be trusted.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;purposes&quot;&gt;Purposes&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;Create upgradeable contracts that earn trust by showing a provable history of trustworthiness.&lt;&#x2F;li&gt;
&lt;li&gt;Document the development of contracts so their development and change is provably public and can be understood.&lt;&#x2F;li&gt;
&lt;li&gt;Create upgradeable contracts that can become immutable in the future if desired.&lt;&#x2F;li&gt;
&lt;li&gt;Create contracts that are not limited by a max size.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;benefits-use-cases&quot;&gt;Benefits &amp;amp; Use Cases&lt;&#x2F;h3&gt;
&lt;p&gt;This standard is for use cases that benefit from the following:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The ability to add, replace or remove multiple functions of a contract atomically (at the same time).&lt;&#x2F;li&gt;
&lt;li&gt;Each time a function is added, replaced or removed, it is documented with events.&lt;&#x2F;li&gt;
&lt;li&gt;Build trust over time by showing all changes made to a contract.&lt;&#x2F;li&gt;
&lt;li&gt;Unlimited contract size.&lt;&#x2F;li&gt;
&lt;li&gt;The ability to query information about functions currently supported by the contract.&lt;&#x2F;li&gt;
&lt;li&gt;One contract address that provides all needed functionality and never needs to be replaced by another contract address.&lt;&#x2F;li&gt;
&lt;li&gt;The ability for a contract to be upgradeable for a time, and then become immutable.&lt;&#x2F;li&gt;
&lt;li&gt;Add trustless guarantees to a contract with &quot;unchangeable functions&quot;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;new-software-possibilities&quot;&gt;New Software Possibilities&lt;&#x2F;h3&gt;
&lt;p&gt;This standard enables a form of contract version control software to be written.&lt;&#x2F;p&gt;
&lt;p&gt;Software and user interfaces can be written to filter the &lt;code&gt;FunctionUpdate&lt;&#x2F;code&gt; and &lt;code&gt;CommitMessage&lt;&#x2F;code&gt; events of a contract address. Such software can show the full history of changes of any contract that implements this standard.&lt;&#x2F;p&gt;
&lt;p&gt;User interfaces and software can also use this standard to assist or automate changes of contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;&#x2F;strong&gt;
The solidity &lt;code&gt;delegatecall&lt;&#x2F;code&gt; opcode enables a contract to execute a function from another contract, but it is executed as if the function was from the calling contract. Essentially &lt;code&gt;delegatecall&lt;&#x2F;code&gt; enables a contract to &quot;borrow&quot; another contract&#x27;s function. Functions executed with &lt;code&gt;delegatecall&lt;&#x2F;code&gt; affect the storage variables of the calling contract, not the contract where the functions are defined.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h3 id=&quot;general-summary&quot;&gt;General Summary&lt;&#x2F;h3&gt;
&lt;p&gt;A transparent contract delegates or forwards function calls to it to other contracts using &lt;code&gt;delegatecode&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;A transparent contract has an &lt;code&gt;updateContract&lt;&#x2F;code&gt; function that enables multiple functions to be added, replaced or removed.&lt;&#x2F;p&gt;
&lt;p&gt;An event is emitted for every function that is added, replaced or removed so that all changes to a contract can be tracked in a standard way.&lt;&#x2F;p&gt;
&lt;p&gt;A transparent contract is a contract that implements and complies with the design points below.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;terms&quot;&gt;Terms&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;In this standard a &lt;strong&gt;delegate contract&lt;&#x2F;strong&gt; is a contract that a transparent contract fallback function forwards function calls to using &lt;code&gt;delegatecall&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;In this standard an &lt;strong&gt;unchangeable function&lt;&#x2F;strong&gt; is a function that is defined directly in a transparent contract and so cannot be replaced or removed.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;design-points&quot;&gt;Design Points&lt;&#x2F;h3&gt;
&lt;p&gt;A contract is a transparent contract if it implements the following design points:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;A transparent contract is a contract that contains a fallback function, a constructor, and zero or more unchangeable functions that are defined directly within it.&lt;&#x2F;li&gt;
&lt;li&gt;The constructor of a transparent contract associates the &lt;code&gt;updateContract&lt;&#x2F;code&gt; function with a contract that implements the ERC1538 interface. The &lt;code&gt;updateContract&lt;&#x2F;code&gt; function can be an &quot;unchangeable function&quot; that is defined directly in the transparent contract or it can be defined in a delegate contract. Other functions can also be associated with contracts in the constructor.&lt;&#x2F;li&gt;
&lt;li&gt;After a transparent contract is deployed functions are added, replaced and removed by calling the &lt;code&gt;updateContract&lt;&#x2F;code&gt; function.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;updateContract&lt;&#x2F;code&gt; function associates functions with contracts that implement those functions, and emits the &lt;code&gt;CommitMessage&lt;&#x2F;code&gt; and &lt;code&gt;FunctionUpdate&lt;&#x2F;code&gt; events that document function changes.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;FunctionUpdate&lt;&#x2F;code&gt; event is emitted for each function that is added, replaced or removed. The &lt;code&gt;CommitMessage&lt;&#x2F;code&gt; event is emitted one time for each time the &lt;code&gt;updateContract&lt;&#x2F;code&gt; function is called and is emitted after any &lt;code&gt;FunctionUpdate&lt;&#x2F;code&gt; events are emitted.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;updateContract&lt;&#x2F;code&gt; function can take a list of multiple function signatures in its &lt;code&gt;_functionSignatures&lt;&#x2F;code&gt; parameter and so add&#x2F;replace&#x2F;remove multiple functions at the same time.&lt;&#x2F;li&gt;
&lt;li&gt;When a function is called on a transparent contract it executes immediately if it is an &quot;unchangeable function&quot;. Otherwise the fallback function is executed. The fallback function finds the delegate contract associated with the function and executes the function using &lt;code&gt;delegatecall&lt;&#x2F;code&gt;. If there is no delegate contract for the function then execution reverts.&lt;&#x2F;li&gt;
&lt;li&gt;The source code of a transparent contract and all delegate contracts used by it are publicly viewable and verified.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The transparent contract address is the address that users interact with. The transparent contract address never changes. Only delegate addresses can change by using the &lt;code&gt;updateContracts&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;p&gt;Typically some kind of authentication is needed for adding&#x2F;replacing&#x2F;removing functions from a transparent contract, &lt;strong&gt;however the scheme for authentication or ownership is not part of this standard&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;example&quot;&gt;Example&lt;&#x2F;h3&gt;
&lt;p&gt;Here is an example of an implementation of a transparent contract. Please note that the example below is an &lt;strong&gt;example only.  It is not the standard&lt;&#x2F;strong&gt;. A contract is a transparent contract when it implements and complies with the design points listed above.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.5.7&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ExampleTransparentContract&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; owner of the contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; contractOwner&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OwnershipTransferred&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; previousOwner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newOwner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; maps functions to the delegate contracts that execute the functions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; funcId =&amp;gt; delegate contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; delegates&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; maps each function signature to its position in the funcSignatures array.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; signature =&amp;gt; index+1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; funcSignatureToIndex&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CommitMessage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; message&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FunctionUpdate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; functionId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; oldDelegate&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newDelegate&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; functionSignature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; this is an example of an &amp;quot;unchangeable function&amp;quot;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; return the delegate contract address for the supplied function signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; delegateAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _functionSignature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;funcSignatureToIndex&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_functionSignature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Function signature not found.&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; delegates&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_functionSignature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; add a function using the updateContract function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; this is an internal helper function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addFunction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _erc1538Delegate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contractAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _functionSignatures&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _commitMessage&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0x03A9BCCF == bytes4(keccak256(&amp;quot;updateContract(address,string,string)&amp;quot;))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; funcdata &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodeWithSelector&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x03A9BCCF&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; contractAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _functionSignatures&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _commitMessage&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bool&lt;&#x2F;span&gt;&lt;span&gt; success&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      success &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; delegatecall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;gas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _erc1538Delegate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;funcdata&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;funcdata&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; funcdata&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Adding a function failed&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;   &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _erc1538Delegate&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    contractOwner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OwnershipTransferred&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; adding ERC1538 updateContract function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; signature &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;updateContract(address,string,string)&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes4&lt;&#x2F;span&gt;&lt;span&gt; funcId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes4&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    delegates&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;funcId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; _erc1538Delegate&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FunctionUpdate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;funcId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _erc1538Delegate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CommitMessage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;Added ERC1538 updateContract function at contract creation&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; associate &amp;quot;unchangeable functions&amp;quot; with this transparent contract address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; prevents function selector clashes with delegate contract functions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; uses the updateContract function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; functions &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;delegateAddress(string)&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    addFunction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_erc1538Delegate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; functions&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Associating unchangeable functions&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; adding ERC1538Query interface functions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    functions &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;functionByIndex(uint256)functionExists(string)delegateAddresses()delegateFunctionSignatures(address)functionById(bytes4)functionBySignature(string)functionSignatures()totalFunctions()&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &amp;quot;0x01234567891011121314&amp;quot; is an example address of an ERC1538Query delegate contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    addFunction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_erc1538Delegate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x01234567891011121314&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; functions&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Adding ERC1538Query functions&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; additional functions could be added at this point&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Making the fallback function payable makes it work for delegate contract functions &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; that are payable and not payable.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Delegate every function call to a delegate contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; delegate &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; delegates&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sig&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;delegate &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Function does not exist.&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      let&lt;&#x2F;span&gt;&lt;span&gt; ptr &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x40&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      calldatacopy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ptr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; calldatasize&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      let&lt;&#x2F;span&gt;&lt;span&gt; result &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; delegatecall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;gas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; delegate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; ptr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; calldatasize&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      let&lt;&#x2F;span&gt;&lt;span&gt; size &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span&gt; returndatasize&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      returndatacopy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ptr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; size&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      switch result&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      case &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;revert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ptr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; size&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      default &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;ptr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; size&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;As can be seen in the above example, every function call is delegated to a delegate contract, unless the function is defined directly in the transparent contract (making it an unchangeable function).&lt;&#x2F;p&gt;
&lt;p&gt;The constructor function adds the &lt;code&gt;updateContract&lt;&#x2F;code&gt; function to the transparent contract, which is then used to add other functions to the transparent contract.&lt;&#x2F;p&gt;
&lt;p&gt;Each time a function is added to a transparent contract the events &lt;code&gt;CommitMessage&lt;&#x2F;code&gt; and &lt;code&gt;FunctionUpdate&lt;&#x2F;code&gt; are emitted to document exactly what functions where added or replaced and why.&lt;&#x2F;p&gt;
&lt;p&gt;The delegate contract that implements the &lt;code&gt;updateContract&lt;&#x2F;code&gt; function implements the following interface:&lt;&#x2F;p&gt;
&lt;h3 id=&quot;erc1538-interface&quot;&gt;ERC1538 Interface&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.5.7&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC1538 Transparent Contract Standard&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Required interface&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;  Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0x61455567&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC1538&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when one or a set of functions are updated in a transparent contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  The message string should give a short description of the change and why&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  the change was made.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CommitMessage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; message&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits for each function that is updated in a transparent contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  functionId is the bytes4 of the keccak256 of the function signature.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  oldDelegate is the delegate contract address of the old delegate contract if&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  the function is being replaced or removed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  oldDelegate is the zero value address(0) if a function is being added for the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  first time.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  newDelegate is the delegate contract address of the new delegate contract if &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  the function is being added for the first time or if the function is being &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  replaced.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  newDelegate is the zero value address(0) if the function is being removed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FunctionUpdate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; functionId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; oldDelegate&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newDelegate&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; functionSignature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Updates functions in a transparent contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If the value of _delegate is zero then the functions specified &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  in _functionSignatures are removed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  If the value of _delegate is a delegate contract address then the functions &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  specified in _functionSignatures will be delegated to that address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _delegate&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of a delegate contract to delegate to or zero&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;        to remove functions.      &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _functionSignatures&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A list of function signatures listed one after the other&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _commitMessage&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A short description of the change and why it is made&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;        This message is passed to the CommitMessage event.          &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; updateContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _delegate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _functionSignatures&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _commitMessage&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;function-signatures-string-format&quot;&gt;Function Signatures String Format&lt;&#x2F;h3&gt;
&lt;p&gt;The text format for the &lt;code&gt;_functionSignatures&lt;&#x2F;code&gt; parameter is simply a string of function signatures. For example: &lt;code&gt;&quot;myFirstFunction()mySecondFunction(string)&quot;&lt;&#x2F;code&gt; This format is easy to parse and is concise.&lt;&#x2F;p&gt;
&lt;p&gt;Here is an example of calling the &lt;code&gt;updateContract&lt;&#x2F;code&gt; function that adds the ERC721 standard functions to a transparent contract:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;functionSignatures&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;approve(address,uint256)balanceOf(address)getApproved(uint256)isApprovedForAll(address,address)ownerOf(uint256)safeTransferFrom(address,address,uint256)safeTransferFrom(address,address,uint256,bytes)setApprovalForAll(address,bool)transferFrom(address,address,uint256)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; transparentContract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;updateContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;erc721Delegate&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; functionSignatures&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Adding ERC721 functions&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;removing-functions&quot;&gt;Removing Functions&lt;&#x2F;h3&gt;
&lt;p&gt;Functions are removed by passing &lt;code&gt;address(0)&lt;&#x2F;code&gt; as the first argument to the &lt;code&gt;updateContract&lt;&#x2F;code&gt; function. The list of functions that are passed in are removed.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;source-code-verification&quot;&gt;Source Code Verification&lt;&#x2F;h3&gt;
&lt;p&gt;The transparent contract source code and the source code for the delegate contracts should be verified in a provable way by a third party source such as etherscan.io.&lt;&#x2F;p&gt;
&lt;!--
A transparent contract must implement the [ERC-165 Standard Interface Detection standard](.&#x2F;00165.md) via a delegate contract by adding the `supportsInterface` function using the `updateContract` function. The interfaceID for the ERC1538 standard is `0x61455567`.
--&gt;
&lt;h3 id=&quot;function-selector-clash&quot;&gt;Function Selector Clash&lt;&#x2F;h3&gt;
&lt;p&gt;A function selector clash occurs when a function is added to a contract that hashes to the same four-byte hash as an existing function. This is unlikely to occur but should be prevented in the implementation of the &lt;code&gt;updateContract&lt;&#x2F;code&gt; function. See the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;mudgen&#x2F;transparent-contracts-erc1538&quot;&gt;reference implementation of ERC1538&lt;&#x2F;a&gt; to see an example of how function clashes can be prevented.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;erc1538query&quot;&gt;ERC1538Query&lt;&#x2F;h3&gt;
&lt;p&gt;Optionally, the function signatures of a transparent contract can be stored in an array in the transparent contract and queried to get what functions the transparent contract supports and what their delegate contract addresses are.&lt;&#x2F;p&gt;
&lt;p&gt;The following is an optional interface for querying function information from a transparent contract:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.5.7&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC1538Query&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Gets the total number of functions the transparent contract has.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; number of functions the transparent contract has,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  not including the fallback function.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalFunctions&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Gets information about a specific function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws if `_index` &amp;gt;= `totalFunctions()`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _index&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The index position of a function signature that is stored in an array&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; function signature, the function selector and the delegate contract address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; functionByIndex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    view&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; functionSignature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; functionId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; delegate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Checks to see if a function exists&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; function signature to check&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; True&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if the function exists, false otherwise&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; functionExists&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _functionSignature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Gets all the function signatures of functions supported by the transparent contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; A&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; string containing a list of function signatures&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; functionSignatures&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Gets all the function signatures supported by a specific delegate contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _delegate&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The delegate contract address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; A&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; string containing a list of function signatures&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; delegateFunctionSignatures&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _delegate&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Gets the delegate contract address that supports the given function signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; function signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; delegate contract address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; delegateAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _functionSignature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Gets information about a function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws if no function is found&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _functionId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The id of the function to get information about&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; function signature and the contract address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; functionById&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _functionId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    view&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; delegate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get all the delegate contract addresses used by the transparent contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; An&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; array of all delegate contract addresses&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; delegateAddresses&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;See the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;mudgen&#x2F;transparent-contracts-erc1538&quot;&gt;reference implementation of ERC1538&lt;&#x2F;a&gt; to see how this is implemented.&lt;&#x2F;p&gt;
&lt;p&gt;The text format for the list of function signatures returned from the &lt;code&gt;delegateFunctionSignatures&lt;&#x2F;code&gt; and &lt;code&gt;functionSignatures&lt;&#x2F;code&gt; functions is simply a string of function signatures. Here is an example of such a string: &lt;code&gt;&quot;approve(address,uint256)balanceOf(address)getApproved(uint256)isApprovedForAll(address,address)ownerOf(uint256)safeTransferFrom(address,address,uint256)safeTransferFrom(address,address,uint256,bytes)setApprovalForAll(address,bool)transferFrom(address,address,uint256)&quot;&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;how-to-deploy-a-transparent-contract&quot;&gt;How To Deploy A Transparent Contract&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;Create and deploy to a blockchain a contract that implements the ERC1538 interface. You can skip this step if there is already such a contract deployed to the blockchain.&lt;&#x2F;li&gt;
&lt;li&gt;Create your transparent contract with a fallback function as given above. Your transparent contract also needs a constructor that adds the &lt;code&gt;updateContract&lt;&#x2F;code&gt; function.&lt;&#x2F;li&gt;
&lt;li&gt;Deploy your transparent contract to a blockchain. Pass in the address of the ERC1538 delegate contract to your constructor if it requires it.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;See the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;mudgen&#x2F;transparent-contracts-erc1538&quot;&gt;reference implementation&lt;&#x2F;a&gt; for examples of these contracts.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;wrapper-contract-for-delegate-contracts-that-depend-on-other-delegate-contracts&quot;&gt;Wrapper Contract for Delegate Contracts that Depend on Other Delegate Contracts&lt;&#x2F;h3&gt;
&lt;p&gt;In some cases some delegate contracts may need to call external&#x2F;public functions that reside in other delegate contracts. A convenient way to solve this problem is to create a contract that contains empty implementations of functions that are needed and import and extend this contract in delegate contracts that call functions from other delegate contracts. This enables delegate contracts to compile without having to provide implementations of the functions that are already given in other delegate contracts. This is a way to save gas, prevent reaching the max contract size limit, and prevent duplication of code. This strategy was given by @amiromayer. &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;1538#issuecomment-451985155&quot;&gt;See his comment for more information.&lt;&#x2F;a&gt; Another way to solve this problem is to use assembly to call functions provided by other delegate contracts.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;decentralized-authority&quot;&gt;Decentralized Authority&lt;&#x2F;h3&gt;
&lt;p&gt;It is possible to extend this standard to add consensus functionality such as an approval function that multiple different people call to approve changes before they are submitted with the &lt;code&gt;updateContract&lt;&#x2F;code&gt; function. Changes only go into effect when the changes are fully approved. The &lt;code&gt;CommitMessage&lt;&#x2F;code&gt; and &lt;code&gt; FunctionUpdate&lt;&#x2F;code&gt; events should only be emitted when changes go into effect.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security&quot;&gt;Security&lt;&#x2F;h2&gt;
&lt;blockquote&gt;
&lt;p&gt;This standard refers to &lt;strong&gt;owner(s)&lt;&#x2F;strong&gt; as one or more individuals that have the power to add&#x2F;replace&#x2F;remove functions of an upgradeable contract.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h3 id=&quot;general&quot;&gt;General&lt;&#x2F;h3&gt;
&lt;p&gt;The owners(s) of an upgradeable contract have the ability to alter, add or remove data from the contract&#x27;s data storage. Owner(s) of a contract can also execute any arbitrary code in the contract on behalf of any address. Owners(s) can do these things by adding a function to the contract that they call to execute arbitrary code. This is an issue for upgradeable contracts in general and is not specific to transparent contracts.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;&#x2F;strong&gt; The design and implementation of contract ownership is &lt;strong&gt;not&lt;&#x2F;strong&gt; part of this standard. The examples given in this standard and in the reference implementation are just &lt;strong&gt;examples&lt;&#x2F;strong&gt; of how it could be done.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h3 id=&quot;unchangeable-functions&quot;&gt;Unchangeable Functions&lt;&#x2F;h3&gt;
&lt;p&gt;&quot;Unchangeable functions&quot; are functions defined in a transparent contract itself and not in a delegate contract. The owner(s) of a transparent contract are not able to replace these functions. The use of unchangeable functions is limited because in some cases they can still be manipulated if they read or write data to the storage of the transparent contract. Data read from the transparent contract&#x27;s storage could have been altered by the owner(s) of the contract. Data written to the transparent contract&#x27;s storage can be undone or altered by the owner(s) of the contract.&lt;&#x2F;p&gt;
&lt;p&gt;In some cases unchangeble functions add trustless guarantees to a transparent contract.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;transparency&quot;&gt;Transparency&lt;&#x2F;h3&gt;
&lt;p&gt;Contracts that implement this standard emit an event every time a function is added, replaced or removed. This enables people and software to monitor the changes to a contract. If any bad acting function is added to a contract then it can be seen. To comply with this standard all source code of a transparent contract and delegate contracts must be publicly available and verified.&lt;&#x2F;p&gt;
&lt;p&gt;Security and domain experts can review the history of change of any transparent contract to detect any history of foul play.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;string-of-function-signatures-instead-of-bytes4-array-of-function-selectors&quot;&gt;String of Function Signatures Instead of bytes4[] Array of Function Selectors&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;updateContract&lt;&#x2F;code&gt; function takes a &lt;code&gt;string&lt;&#x2F;code&gt; list of functions signatures as an argument instead of a &lt;code&gt;bytes4[]&lt;&#x2F;code&gt; array of function selectors for three reasons:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Passing in function signatures enables the implementation of &lt;code&gt;updateContract&lt;&#x2F;code&gt; to prevent selector clashes.&lt;&#x2F;li&gt;
&lt;li&gt;A major part of this standard is to make upgradeable contracts more transparent by making it easier to see what has changed over time and why. When a function is added, replaced or removed its function signature is included in the FunctionUpdate event that is emitted. This makes it relatively easy to write software that filters the events of a contract to display to people what functions have been added&#x2F;removed and changed over time without needing access to the source code or ABI of the contract. If only four-byte function selectors were provided this would not be possible.&lt;&#x2F;li&gt;
&lt;li&gt;By looking at the source code of a transparent contract it is not possible to see all the functions that it supports. This is why the ERC1538Query interface exists, so that people and software have a way to look up and examine or show all functions currently supported by a transparent contract. Function signatures are used so that ERC1538Query functions can show them.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;gas-considerations&quot;&gt;Gas Considerations&lt;&#x2F;h3&gt;
&lt;p&gt;Delegating function calls does have some gas overhead. This is mitigated in two ways:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Delegate contracts can be small, reducing gas costs. Because it costs more gas to call a function in a contract with many functions than a contract with few functions.&lt;&#x2F;li&gt;
&lt;li&gt;Because transparent contracts do not have a max size limitation it is possible to add gas optimizing functions for use cases. For example someone could use a transparent contract to implement the ERC721 standard and implement batch transfer functions from the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;1412&quot;&gt;ERC1412 standard&lt;&#x2F;a&gt; to help reduce gas (and make batch transfers more convenient).&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;storage&quot;&gt;Storage&lt;&#x2F;h3&gt;
&lt;p&gt;The standard does not specify how data is stored or organized by a transparent contract. But here are some suggestions:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Inherited Storage&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;The storage variables of a transparent contract consist of the storage variables defined in the transparent contract source code and the source code of delegate contracts that have been added.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;A delegate contract can use any storage variable that exists in a transparent contract as long as it defines within it all the storage variables that exist, in the order that they exist, up to and including the ones being used.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;A delegate contract can create new storage variables as long as it has defined, in the same order, all storage variables that exist in the transparent contract.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Here is a simple way inherited storage could be implemented:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Create a storage contract that contains the storage variables that your transparent contract and delegate contracts will use.&lt;&#x2F;li&gt;
&lt;li&gt;Make your delegate contracts inherit the storage contract.&lt;&#x2F;li&gt;
&lt;li&gt;If you want to add a new delegate contract that adds new storage variables then create a new storage contract that adds the new storage variables and inherits from the old storage contract. Use your new storage contract with your new delegate contract.&lt;&#x2F;li&gt;
&lt;li&gt;Repeat steps 2 or 3 for every new delegate contract.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;strong&gt;Unstructured Storage&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Assembly is used to store and read data at specific storage locations. An advantage to this approach is that previously used storage locations don&#x27;t have to be defined or mentioned in a delegate contract if they aren&#x27;t used by it.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Eternal Storage&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Data can be stored using a generic API based on the type of data. &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;930&quot;&gt;See ERC930 for more information.&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;becoming-immutable&quot;&gt;Becoming Immutable&lt;&#x2F;h3&gt;
&lt;p&gt;It is possible to make a transparent contract become immutable. This is done by calling the &lt;code&gt;updateContract&lt;&#x2F;code&gt; function to remove the &lt;code&gt;updateContract&lt;&#x2F;code&gt; function. With this gone it is no longer possible to add, replace and remove functions.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;versions-of-functions&quot;&gt;Versions of Functions&lt;&#x2F;h3&gt;
&lt;p&gt;Software or a user can verify what version of a function is called by getting the delegate contract address of the function. This can be done by calling the &lt;code&gt;delegateAddress&lt;&#x2F;code&gt; function from the ERC1538Query interface if it is implemented. This function takes a function signature as an argument and returns the delegate contract address where it is implemented.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;best-practices-tools-and-more-information&quot;&gt;Best Practices, Tools and More Information&lt;&#x2F;h3&gt;
&lt;blockquote&gt;
&lt;p&gt;More information, tools, tutorials and best practices concerning transparent contracts need to be developed and published.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;Below is a growing list of articles concerning transparent contracts and their use.  If you have an article about transparent contracts you would like to share then please submit a comment to this issue about it to get it added.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;coinjournal.net&#x2F;erc1538-future-proofing-smart-contacts-and-tokens&#x2F;&quot;&gt;ERC1538: Future Proofing Smart Contracts and Tokens&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.crypto-economy.net&#x2F;en&#x2F;ethereum-eth-erc1538-transparent-contract-standard&#x2F;&quot;&gt;The ERC1538 improving towards the “transparent contract” standard&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;inspiration&quot;&gt;Inspiration&lt;&#x2F;h3&gt;
&lt;p&gt;This standard was inspired by ZeppelinOS&#x27;s implementation of &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;zeppelinos&#x2F;labs&#x2F;tree&#x2F;master&#x2F;upgradeability_with_vtable&quot;&gt;Upgradeability with vtables&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This standard was also inspired by the design and implementation of the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;etherscan.io&#x2F;address&#x2F;0xc1eab49cf9d2e23e43bcf23b36b2be14fc2f8838#code&quot;&gt;Mokens contract&lt;&#x2F;a&gt; from the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;Mokens&#x2F;MIPs&#x2F;blob&#x2F;master&#x2F;MIPS&#x2F;mip-2-Goals-and-Objectives.md&quot;&gt;Mokens project&lt;&#x2F;a&gt;. The Mokens contract has been &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;etherscan.io&#x2F;address&#x2F;0x0ac5637fe62ec14fd9e237a81a9679d4adef701f#code&quot;&gt;upgraded to implement this standard&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This standard makes a contract compatible with future standards and functionality because new functions can be added and existing functions can be replaced or removed.&lt;&#x2F;p&gt;
&lt;p&gt;This standard future proofs a contract.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;A reference implementation of this standard is given in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;mudgen&#x2F;transparent-contracts-erc1538&quot;&gt;transparent-contracts-erc1538&lt;&#x2F;a&gt; repository.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Upgradable Smart Contract</title>
        <published>2018-10-17T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Kaidong Wu</name><email>wukd94@pku.edu.cn</email>
	</author>
	
	<author>
		<name>Chuqiao Ren</name><email>cr025@bucknell.edu</email>
	</author>
	
	<author>
		<name>Ruthia He</name><email>rujiahe@gmail.com</email>
	</author>
	
	<author>
		<name>Yun Ma</name><email>mayun@pku.edu.cn</email>
	</author>
	
	<author>
		<name>Xuanzhe Liu</name><email>liuxuanzhe@pku.edu.cn</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1504/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/1503" />
        

        <id>https://wg-eips.ritovision.com/1504/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:1504"
            label="ERC-1504" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1504/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;A standard interface&#x2F;guideline that makes a smart contract upgradable.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Ethereum smart contracts have suffered a number of security issues in the past few years. The cost of fixing such a bug in smart contract is significant; for example, the consequences of The DAO attack in June 2016 caused tremendous financial loss and the hard fork of Ethereum blockchain.&lt;&#x2F;p&gt;
&lt;p&gt;The following standard makes it possible to upgrade a standard API within smart contracts. This standard provides basic functionalities to upgrade the operations of the contract without data migration. To ensure the decentralization&#x2F;community interests, it also contains a voting mechanism to control the upgrading process.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Smart contract is immutable after deployment. If any security risk is identified or program bug is detected, developers always have to destruct the old contract, deploy a new one and potentially migrate the data (hard fork) to the new contract. In some cases, deploying a smart contract with bugs and potential security vulnerabilities can cause a significant amount of financial loss.&lt;&#x2F;p&gt;
&lt;p&gt;We propose this upgradable contract to fix the current situation. With the upgradable contract, developers can deploy a new version of smart contract after previous deployment and retain the data at the same time.&lt;&#x2F;p&gt;
&lt;p&gt;For example, after an ERC20-compliant token contract is deployed, the users exploit a vulnerability in the source code.  Without the support of upgradable contract, developers have to fix this issue by deploy a new, secured contract otherwise the attackers would take advantage of the security hole, which may cause a tremendous financial loss. A challenge is how to migrate data from the old contract to a new one. With the upgradable contract below, this will become relatively easy as developers only have to upgrade the Handler contract to fix bugs while the Data contract will remain the same.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The upgradable contract consists of three parts:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Handler contract&lt;&#x2F;strong&gt; (implements &lt;strong&gt;Handler interface&lt;&#x2F;strong&gt;) defines operations and provides services. This contract can be upgraded;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Data contract&lt;&#x2F;strong&gt; keeps the resources (data) and is controlled by the Handler contract;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Upgrader contract (optional)&lt;&#x2F;strong&gt; deals with the voting mechanism and upgrades the Handler contract. The voters are pre-defined by the contract owner.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;blockquote&gt;
&lt;p&gt;The following codes are exact copies of the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;gist.github.com&#x2F;swordghost&#x2F;77c96a972106af6ec6ccea9c2d66e768&quot;&gt;ERC-1504 Upgradable Smart Contract.&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h3 id=&quot;handler-contract-and-handler-interface&quot;&gt;Handler contract and Handler interface&lt;&#x2F;h3&gt;
&lt;p&gt;Functions of the Handler contract vary with requirements, so developers would better design interfaces for Handler contracts to limit them and make sure external applications are always supported.&lt;&#x2F;p&gt;
&lt;p&gt;Below is the specification of Handler interface. In the Handler interface we define the following actions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Initialize the Data contract;&lt;&#x2F;li&gt;
&lt;li&gt;Register the Upgrader contract address;&lt;&#x2F;li&gt;
&lt;li&gt;Destruct the Handler contract after upgrading is done;&lt;&#x2F;li&gt;
&lt;li&gt;Verify the current Handler is the working one → it should always return true.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Developers have to define their business-related functions as well.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Handler interface.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Handler defines business related functions.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Use the interface to ensure that your external services are always supported.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Because of function live(), we design IHandler as an abstract contract rather than a true interface.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IHandler&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Initialize the data contarct.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  _str&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    value of exmStr of Data contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  _int&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    value of exmInt of Data contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  _array&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  value of exmArray of Data contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; initialize&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _str&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint16&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _array&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Register Upgrader contract address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  _upgraderAddr&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   address of the Upgrader contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; registerUpgrader&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _upgraderAddr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Upgrader contract calls this to check if it is registered.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; if&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the Upgrader contract is registered.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isUpgraderRegistered&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Handler has been upgraded so the original one has to self-destruct.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; done&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check if the Handler contract is a working Handler contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; It is used to prove the contract is a Handler contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; always&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; true.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; live&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Functions - define functions here &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Events - add events here &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The process of deploying a Handler contract:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Deploy Data contract;&lt;&#x2F;li&gt;
&lt;li&gt;Deploy a Handler contract at a given address specified in the Data contract;&lt;&#x2F;li&gt;
&lt;li&gt;Register the Handler contract address by calling setHandler() in the Data contract, or use an Upgrader contract to switch the Handler contract, which requires that Data contract is initialized;&lt;&#x2F;li&gt;
&lt;li&gt;Initialize Data contract if haven’t done it already.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;data-contract&quot;&gt;Data Contract&lt;&#x2F;h3&gt;
&lt;p&gt;Below is the specification of Data contract. There are three parts in the Data contract:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Administrator Data&lt;&#x2F;strong&gt;: owner’s address, Handler contract’s address and a boolean indicating whether the contract is initialized or not;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Upgrader Data&lt;&#x2F;strong&gt;: Upgrader contract’s address, upgrade proposal’s submission timestamp and proposal’s time period;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Resource Data&lt;&#x2F;strong&gt;: all other resources that the contract needs to keep and manage.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Data Contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DataContract&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Management data &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Owner and Handler contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; handlerAddr&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Ready?&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; valid&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Upgrader data &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; upgraderAddr&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; proposalBlockNumber&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; proposalPeriod&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Upgrading status of the Handler contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UpgradingStatus&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; Can be upgraded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        Done&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; In upgrading&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        InProgress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; Another proposal is in progress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        Blocked&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; Expired&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        Expired&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F; Original Handler contract error&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        Error&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Data resources - define variables here &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Modifiers &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check if msg.sender is the Handler contract. It is used for setters.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If fail, throw PermissionException.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    modifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyHandler&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; Check if msg.sender is not permitted to call getters. It is used for getters (if necessary)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;If&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fail&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;throw&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; GetterPermissionException&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    modifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; allowedAddress&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Check&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; if&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; working&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;It&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; used&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; for&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; all&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; functions&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; providing&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; services&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; after&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; initialization&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;If&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fail&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;throw&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UninitializationException&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    modifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ready&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;** &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Management&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; functions&lt;&#x2F;span&gt;&lt;span&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Initializer&lt;&#x2F;span&gt;&lt;span&gt;. &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Just&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Handler&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; can&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; call&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; it&lt;&#x2F;span&gt;&lt;span&gt;. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;param&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  _str&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    default&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; of&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;exmStr&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;param&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  _int&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    default&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; of&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;exmInt&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;param&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  _array&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  default&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; of&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;exmArray&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;exception&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;   PermissionException&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Handler&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;exception&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;   ReInitializationException&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;   contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; has&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; been&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; initialized&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; if&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; initialization&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; succeeds&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; initialize&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _str&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _int&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;uint16&lt;&#x2F;span&gt;&lt;span&gt; [] &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_array&lt;&#x2F;span&gt;&lt;span&gt;) &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyHandler&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Set&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Handler&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; for&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;. &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; must&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; set&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; one&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; initialize&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Data&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Handler&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; can&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; be&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; set&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; by&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; or&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Upgrader&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;param&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  _handlerAddr&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; of&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; deployed&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Handler&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;param&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  _originalHandlerAddr&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; of&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; original&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Handler&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;only&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; used&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; when&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; an&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Upgrader&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; want&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; set&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Handler&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;exception&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;   PermissionException&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; nor&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; registered&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Upgrader&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;exception&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;   UpgraderException&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;   Upgrader&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; does&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; provide&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; right&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; of&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; original&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Handler&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; if&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Handler&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; successfully&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; set&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setHandler&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _handlerAddr&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _originalHandlerAddr&lt;&#x2F;span&gt;&lt;span&gt;) &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;** &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Upgrader&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; functions&lt;&#x2F;span&gt;&lt;span&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Register&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; an&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Upgrader&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;If&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; proposal&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; has&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; been&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; accepted&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; until&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; proposalBlockNumber&lt;&#x2F;span&gt;&lt;span&gt; + &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;proposalPeriod&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;it&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; can&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; be&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; replaced&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; by&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; one&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;param&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  _upgraderAddr&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; of&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; deployed&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Upgrader&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;exception&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;   PermissionException&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;exception&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;   UpgraderConflictException&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;   Another&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Upgrader&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; working&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; if&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Upgrader&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; successfully&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; registered&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; startUpgrading&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _upgraderAddr&lt;&#x2F;span&gt;&lt;span&gt;) &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Getter&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; of&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; proposalPeriod&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;exception&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;   UninitializationException&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;   uninitialized&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;exception&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;   GetterPermissionException&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;   msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; permitted&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; call&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getter&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;proposalPeriod&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getProposalPeriod&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;) &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isReady&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; allowedAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Setter&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; of&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; proposalPeriod&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;param&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  _proposalPeriod&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; of&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;proposalPeriod&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;exception&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;   UninitializationException&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;   uninitialized&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;exception&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;   PermissionException&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; if&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;proposalPeriod&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; successfully&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; set&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setProposalPeriod&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _proposalPeriod&lt;&#x2F;span&gt;&lt;span&gt;) &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isReady&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; upgrading&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; status&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; for&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Upgrader&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; contracts&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;param&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  _originalHandlerAddr&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; of&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; original&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Handler&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;exception&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;   UninitializationException&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;   uninitialized&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Handler&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; upgrading&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; status&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; canBeUpgraded&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _originalHandlerAddr&lt;&#x2F;span&gt;&lt;span&gt;) &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isReady&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;UpgradingStatus&lt;&#x2F;span&gt;&lt;span&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Check&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; if&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; has&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; been&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; initialized&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F;&#x2F; @&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; if&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; has&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; been&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; initialized&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; live&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;) &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;** &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Getters&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; and&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setters&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; of&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; resources&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;define&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; functions&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; here&lt;&#x2F;span&gt;&lt;span&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;upgrader-contract-optional&quot;&gt;Upgrader Contract (Optional)&lt;&#x2F;h3&gt;
&lt;p&gt;Handler contract can be upgraded by calling setHandler() of Data contract. If the owner wants to collect ideas from users, an Upgrader contract will help him&#x2F;her manage voting and upgrading.&lt;&#x2F;p&gt;
&lt;p&gt;Below is the specification of Upgrader contract:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The Upgrader contract has the ability to take votes from the registered voters.
&lt;ul&gt;
&lt;li&gt;The contract owner is able to add voters any time before the proposal expires;&lt;&#x2F;li&gt;
&lt;li&gt;Voter can check the current status of the proposal (succeed or expired).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Developers are able to delete this Upgrader contract by calling done() any time after deployment.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The Upgrader contract works as follows:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Verify the Data contract, its corresponding Handler contract and the new Handler contract have all been deployed;&lt;&#x2F;li&gt;
&lt;li&gt;Deploy an Upgrader contract using Data contract address, previous Handler contract address and new Handler contract address;&lt;&#x2F;li&gt;
&lt;li&gt;Register upgrader address in the new Handler contract first, then the original handler and finally the Data contract;&lt;&#x2F;li&gt;
&lt;li&gt;Call startProposal() to start the voting process;&lt;&#x2F;li&gt;
&lt;li&gt;Call getResolution() before the expiration;&lt;&#x2F;li&gt;
&lt;li&gt;Upgrading succeed or proposal is expired.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Note:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Function done() can be called at any time to let upgrader destruct itself.&lt;&#x2F;li&gt;
&lt;li&gt;Function status() can be called at any time to show caller status of the upgrader.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Handler upgrader&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Upgrader&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Data contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    DataContract &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;public&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Original Handler contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    IHandler &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;public&lt;&#x2F;span&gt;&lt;span&gt; originalHandler&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; New Handler contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; newHandlerAddr&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Marker &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; UpgraderStatus&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        Preparing&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        Voting&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        Success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        Expired&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        End&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    UpgraderStatus &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;public&lt;&#x2F;span&gt;&lt;span&gt; status&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check if the proposal is expired.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If so, contract would be marked as expired.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; exception   PreparingUpgraderException  proposal has not been started.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; exception   ReupgradingException    upgrading has been done.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; exception   ExpirationException proposal is expired.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    modifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; notExpired&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;status &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span&gt; UpgraderStatus&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;Preparing&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Invalid proposal!&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;status &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span&gt; UpgraderStatus&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;Success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Upgrading has been done!&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;status &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span&gt; UpgraderStatus&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;Expired&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Proposal is expired!&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;canBeUpgraded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;originalHandler&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; DataContract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;UpgradingStatus&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;InProgress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            status &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; UpgraderStatus&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;Expired&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Proposal is expired!&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        _&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Start voting.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Upgrader must do upgrading check, namely checking if Data contract and 2 Handler contracts are ok.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; exception   RestartingException proposal has been already started.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; exception   PermissionException msg.sender is not the owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; exception   UpgraderConflictException   another upgrader is working.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; exception   NoPreparationException  original or new Handler contract is not prepared.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; startProposal&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Anyone can try to get resolution.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If voters get consensus, upgrade the Handler contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If expired, self-destruct.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Otherwise, do nothing.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; exception   PreparingUpgraderException  proposal has not been started.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; exception   ExpirationException proposal is expired.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;     status&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; of proposal.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getResolution&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;UpgraderStatus&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Destruct itself.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; exception   PermissionException msg.sender is not the owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; done&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Other voting mechanism related variables and functions &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;caveats&quot;&gt;Caveats&lt;&#x2F;h3&gt;
&lt;p&gt;Since the Upgrader contract in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1504&#x2F;&quot;&gt;ERC-1504&lt;&#x2F;a&gt; has a simple voting mechanism, it is prone to all the limitations that the voting contract is facing:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The administrator can only be the owner of data and Handler contracts. Furthermore, only the administrator has the power to add voters and start a proposal.&lt;&#x2F;li&gt;
&lt;li&gt;It requires voters to be constantly active, informative and attentive to make a upgrader succeed.&lt;&#x2F;li&gt;
&lt;li&gt;The voting will only be valid in a given time period. If in a given time period the contract cannot collect enough “yes” to proceed, the proposal will be marked expired.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;data-contract-and-handler-contract&quot;&gt;Data Contract and Handler Contract&lt;&#x2F;h3&gt;
&lt;p&gt;A smart contract is actually a kind of software, which provides some kind of services. From the perspective of software engineering, a service consists of &lt;strong&gt;resources&lt;&#x2F;strong&gt; that abstract the data and &lt;strong&gt;operations&lt;&#x2F;strong&gt; that abstract the process logic on the data. The requirement of upgrading is mostly on the logic part. Therefore, in order to make a smart contract upgradable, we divide it into two parts:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Data contract keeps the resources;&lt;&#x2F;li&gt;
&lt;li&gt;Handler contract contains operations.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The Handler contract can be upgraded in the future while the Data contract is permanent. Handler contract can manipulate the variables in Data contract through the getter and setter functions provided by Data contract.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;upgrader-contract-and-voting-mechanism&quot;&gt;Upgrader Contract and Voting Mechanism&lt;&#x2F;h3&gt;
&lt;p&gt;In order to prevent centralization and protect the interests of the community and stakeholders, we also design a voting mechanism in the Upgrader contract. Upgrader contract contains addresses of Data contract and two Handler contracts, and collects votes from pre-defined voters to upgrade the Handler contract when the pre-set condition is fulfilled.&lt;&#x2F;p&gt;
&lt;p&gt;For simplicity, the upgradable contract comes with a very minimal version of the voting mechanism. If the contract owner wants to implement a more complex voting mechanism, he&#x2F;she can modify the existing voting mechanism to incorporate upgradability. The expiration mechanism (see modifier notExpried in Upgrader contract and related functions in Data contract) and upgrading check (see function startProposal() in Upgrader contract) to the contract are mandatory.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-and-complexity-regarding-the-enumeration-extension&quot;&gt;Gas and Complexity (regarding the enumeration extension)&lt;&#x2F;h3&gt;
&lt;p&gt;Using an upgrader will cost some gas. If the Handler contract is upgraded by the owner, it just costs gas that a contract call will cost, which is usually significantly lower than creating and deploying a new contract.&lt;&#x2F;p&gt;
&lt;p&gt;Although upgrading contract may take some efforts and gas, it is a much less painful than deprecating the insecure contract&#x2F;creating a new contract or hard fork (e.g. DAO attack). Contract creation requires a significant amount of effort and gas. One of the advantages of upgradable contracts is that the contract owners don’t have to create new contracts; instead, they only need to upgrade parts of contract that cause issues, which is less expensive compared to data loss and blockchain inconsistency. In other words, upgradable contracts make Data contract more scalable and flexible.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;community-consensus&quot;&gt;Community Consensus&lt;&#x2F;h3&gt;
&lt;p&gt;Thank you to those who helped on review and revise the proposal:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;lsankar4033&quot;&gt;@lsankar4033&lt;&#x2F;a&gt; from MIT&lt;&#x2F;li&gt;
&lt;li&gt;more&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The proposal is initiated and developed by the team Renaissance and the Research Group of Blockchain System @ Center for Operating System at Peking University.&lt;&#x2F;p&gt;
&lt;p&gt;We have been very inclusive in this process and invite anyone with questions or contributions into our discussion. However, this standard is written only to support the identified use cases which are listed herein.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementations&quot;&gt;Implementations&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.renaissance.app&quot;&gt;Renaissance&lt;&#x2F;a&gt; - a protocol that connect creators and fans financially&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1504&#x2F;&quot;&gt;ERC-1504&lt;&#x2F;a&gt; - a reference implementation&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Digital Identity Aggregator</title>
        <published>2018-10-12T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Anurag Angara</name><email>anurag.angara@gmail.com</email>
	</author>
	
	<author>
		<name>Andy Chorlian</name><email>andychorlian@gmail.com</email>
	</author>
	
	<author>
		<name>Shane Hampton</name><email>shanehampton1@gmail.com</email>
	</author>
	
	<author>
		<name>Noah Zinsmeister</name><email>noahwz@gmail.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1484/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/1495" />
        

        <id>https://wg-eips.ritovision.com/1484/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:1484"
            label="ERC-1484" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1484/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;A protocol for aggregating digital identity information that&#x27;s broadly interoperable with existing, proposed, and hypothetical future digital identity standards.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes an identity management and aggregation framework on the Ethereum blockchain. It allows entities to claim an &lt;code&gt;Identity&lt;&#x2F;code&gt; via a singular &lt;code&gt;Identity Registry&lt;&#x2F;code&gt; smart contract, associate it with Ethereum addresses in a variety of meaningful ways, and use it to interact with smart contracts. This enables arbitrarily complex identity-related functionality. Notably (among other features) ERC-1484 &lt;code&gt;Identities&lt;&#x2F;code&gt;: are self-sovereign, can natively support &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;725&#x2F;&quot;&gt;ERC-725&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1056&#x2F;&quot;&gt;ERC-1056&lt;&#x2F;a&gt; identities, are &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;NoahZinsmeister&#x2F;ERC-1484&#x2F;blob&#x2F;master&#x2F;best-practices&#x2F;DID-Method.md&quot;&gt;DID compliant&lt;&#x2F;a&gt;, and can be fully powered by &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;NoahZinsmeister&#x2F;ERC-1484&#x2F;tree&#x2F;master&#x2F;contracts&#x2F;examples&#x2F;Providers&#x2F;MetaTransactions&quot;&gt;meta-transactions&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Emerging identity standards and related frameworks proposed by the Ethereum community (including ERCs&#x2F;EIPs &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;725&#x2F;&quot;&gt;725&lt;&#x2F;a&gt;, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;735&quot;&gt;735&lt;&#x2F;a&gt;, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;780&quot;&gt;780&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1056&#x2F;&quot;&gt;1056&lt;&#x2F;a&gt;, etc.) define and instrumentalize digital identity in a variety of ways. As existing approaches mature, new standards emerge, and isolated, non-standard approaches to identity develop, coordinating on identity will become increasingly burdensome for blockchain users and developers, and involve the unnecessary duplication of work.&lt;&#x2F;p&gt;
&lt;p&gt;The proliferation of on-chain identity solutions can be traced back to the fact that each codifies a notion of identity and links it to specific aspects of Ethereum (claims protocols, per-identity smart contracts, signature verification schemes, etc.). This proposal eschews that approach, instead introducing a protocol layer in between the Ethereum network and individual identity applications. This solves identity management and interoperability challenges by enabling any identity-driven application to leverage an un-opinionated identity management protocol.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;Identity Registry&lt;&#x2F;code&gt;: A single smart contract which is the hub for all &lt;code&gt;Identities&lt;&#x2F;code&gt;. The primary responsibility of the &lt;code&gt;Registry&lt;&#x2F;code&gt; is to define and enforce the rules of a global namespace for &lt;code&gt;Identities&lt;&#x2F;code&gt;, which are individually denominated by Ethereum Identification Numbers (EINs).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;Identity&lt;&#x2F;code&gt;: A data structure containing all the core information relevant to an identity, namely: a &lt;code&gt;Recovery Address&lt;&#x2F;code&gt;, an &lt;code&gt;Associated Addresses&lt;&#x2F;code&gt; set, a &lt;code&gt;Providers&lt;&#x2F;code&gt; set, and a &lt;code&gt;Resolvers&lt;&#x2F;code&gt; set. &lt;code&gt;Identities&lt;&#x2F;code&gt; are denominated by EINs (incrementing &lt;code&gt;uint&lt;&#x2F;code&gt; identifiers starting at 1), which are unique but otherwise uninformative. Each &lt;code&gt;Identity&lt;&#x2F;code&gt; is a Solidity struct:&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Identity&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; recoveryAddress&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    AddressSet&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;Set associatedAddresses&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    AddressSet&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;Set providers&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    AddressSet&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;Set resolvers&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;Associated Address&lt;&#x2F;code&gt;: An Ethereum address publicly associated with an &lt;code&gt;Identity&lt;&#x2F;code&gt;. In order for an address to become an &lt;code&gt;Associated Address&lt;&#x2F;code&gt;, an &lt;code&gt;Identity&lt;&#x2F;code&gt; must either transact from or produce an appropriately signed message from the candidate address and an existing &lt;code&gt;Associated Address&lt;&#x2F;code&gt;, indicating intent to associate. An &lt;code&gt;Associated Address&lt;&#x2F;code&gt; can be removed from an &lt;code&gt;Identity&lt;&#x2F;code&gt; by transacting&#x2F;producing a signature indicating intent to disassociate. A given address may only be an &lt;code&gt;Associated Address&lt;&#x2F;code&gt; for one &lt;code&gt;Identity&lt;&#x2F;code&gt; at any given time.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;Provider&lt;&#x2F;code&gt;: An Ethereum address (typically but not by definition a smart contract) authorized to act on behalf of &lt;code&gt;Identities&lt;&#x2F;code&gt; who have authorized them to do so. This includes but is not limited to managing the &lt;code&gt;Associated Address&lt;&#x2F;code&gt;, &lt;code&gt;Provider&lt;&#x2F;code&gt;, and &lt;code&gt;Resolver&lt;&#x2F;code&gt; sets for an &lt;code&gt;Identity&lt;&#x2F;code&gt;. &lt;code&gt;Providers&lt;&#x2F;code&gt; exist to facilitate user adoption by making it easier to manage &lt;code&gt;Identities&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;Resolver&lt;&#x2F;code&gt;: A smart contract containing arbitrary information pertaining to &lt;code&gt;Identities&lt;&#x2F;code&gt;. A resolver may implement an identity standard, such as ERC-725, or may consist of a smart contract leveraging or declaring identifying information about &lt;code&gt;Identities&lt;&#x2F;code&gt;. These could be simple attestation structures or more sophisticated financial dApps, social media dApps, etc. Each &lt;code&gt;Resolver&lt;&#x2F;code&gt; added to an &lt;code&gt;Identity&lt;&#x2F;code&gt; makes the &lt;code&gt;Identity&lt;&#x2F;code&gt; more informative.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;Recovery Address&lt;&#x2F;code&gt;: An Ethereum address (either an account or smart contract) that can be used to recover lost &lt;code&gt;Identities&lt;&#x2F;code&gt; as outlined in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1484&#x2F;#recovery&quot;&gt;Recovery&lt;&#x2F;a&gt; section.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;Destruction&lt;&#x2F;code&gt;: In the event of irrecoverable loss of control of an &lt;code&gt;Identity&lt;&#x2F;code&gt;, &lt;code&gt;Destruction&lt;&#x2F;code&gt; is a contingency measure to permanently disable the &lt;code&gt;Identity&lt;&#x2F;code&gt;. It removes all &lt;code&gt;Associated Addresses&lt;&#x2F;code&gt;, &lt;code&gt;Providers&lt;&#x2F;code&gt;, and optionally &lt;code&gt;Resolvers&lt;&#x2F;code&gt; while preserving the &lt;code&gt;Identity&lt;&#x2F;code&gt;. Evidence of the existence of the &lt;code&gt;Identity&lt;&#x2F;code&gt; persists, while control over the &lt;code&gt;Identity&lt;&#x2F;code&gt; is nullified.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;A digital identity in this proposal can be viewed as an omnibus account, containing more information about an identity than any individual identity application could. This omnibus identity is resolvable to an unlimited number of sub-identities called &lt;code&gt;Resolvers&lt;&#x2F;code&gt;. This allows an atomic entity, the &lt;code&gt;Identity&lt;&#x2F;code&gt;, to be resolvable to abstract data structures, the &lt;code&gt;Resolvers&lt;&#x2F;code&gt;. &lt;code&gt;Resolvers&lt;&#x2F;code&gt; recognize &lt;code&gt;Identities&lt;&#x2F;code&gt; by any of their &lt;code&gt;Associated Addresses&lt;&#x2F;code&gt;, or by their &lt;code&gt;EIN&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The protocol revolves around claiming an &lt;code&gt;Identity&lt;&#x2F;code&gt; and managing &lt;code&gt;Associated Addresses&lt;&#x2F;code&gt;, &lt;code&gt;Providers&lt;&#x2F;code&gt; and &lt;code&gt;Resolvers&lt;&#x2F;code&gt;. Identities can delegate much or all of this responsibility to one or more &lt;code&gt;Providers&lt;&#x2F;code&gt;, or perform it directly from an &lt;code&gt;Associated Address&lt;&#x2F;code&gt;. &lt;code&gt;Associated Addresses&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;Providers&lt;&#x2F;code&gt; may add and remove &lt;code&gt;Resolvers&lt;&#x2F;code&gt; and &lt;code&gt;Providers&lt;&#x2F;code&gt; indiscriminately. &lt;code&gt;Associated Addresses&lt;&#x2F;code&gt; may only be added or removed with the appropriate permission.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;identity-registry&quot;&gt;Identity Registry&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;Identity Registry&lt;&#x2F;code&gt; contains functionality to create new &lt;code&gt;Identities&lt;&#x2F;code&gt; and for existing &lt;code&gt;Identities&lt;&#x2F;code&gt; to manage their &lt;code&gt;Associated Addresses&lt;&#x2F;code&gt;, &lt;code&gt;Providers&lt;&#x2F;code&gt;, and &lt;code&gt;Resolvers&lt;&#x2F;code&gt;. It is important to note that this registry fundamentally requires transactions for every aspect of building out an &lt;code&gt;Identity&lt;&#x2F;code&gt;. However, recognizing the importance of accessibility to dApps and identity applications, we empower &lt;code&gt;Providers&lt;&#x2F;code&gt; to build out &lt;code&gt;Identities&lt;&#x2F;code&gt; on the behalf of users, without requiring users to pay gas costs. An example of this pattern, often referred to as a meta transactions, can be &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;NoahZinsmeister&#x2F;ERC-1484&#x2F;tree&#x2F;master&#x2F;contracts&#x2F;examples&#x2F;Providers&#x2F;MetaTransactions&quot;&gt;seen in the reference implementation&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Due to the fact that multiple addresses can be associated with a given identity (though not the reverse), &lt;code&gt;Identities&lt;&#x2F;code&gt; are denominated by &lt;code&gt;EIN&lt;&#x2F;code&gt;. This &lt;code&gt;uint&lt;&#x2F;code&gt; identifier can be encoded in QR format or mapped to more user-friendly formats, such as a &lt;code&gt;string&lt;&#x2F;code&gt;, in registries at the &lt;code&gt;Provider&lt;&#x2F;code&gt; or &lt;code&gt;Resolver&lt;&#x2F;code&gt; level.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;address-management&quot;&gt;Address Management&lt;&#x2F;h3&gt;
&lt;p&gt;The address management function consists of trustlessly connecting multiple user-owned &lt;code&gt;Associated Addresses&lt;&#x2F;code&gt; to an &lt;code&gt;Identity&lt;&#x2F;code&gt;. It does not give special status to any particular &lt;code&gt;Associated Address&lt;&#x2F;code&gt;, rather leaving this (optional) specification to identity applications built on top of the protocol - for instance, &lt;code&gt;management&lt;&#x2F;code&gt;, &lt;code&gt;action&lt;&#x2F;code&gt;, &lt;code&gt;claim&lt;&#x2F;code&gt; and &lt;code&gt;encryption&lt;&#x2F;code&gt; keys denominated in the ERC-725 standard, or &lt;code&gt;identifiers&lt;&#x2F;code&gt; and &lt;code&gt;delegates&lt;&#x2F;code&gt; as denominated in ERC-1056. This allows a user to access common identity data from multiple wallets while still:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;retaining the ability to interact with contracts outside of their identity&lt;&#x2F;li&gt;
&lt;li&gt;taking advantage of address-specific permissions established at the application layer of a user&#x27;s identity.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Trustlessness in the address management function is achieved through a robust permissioning scheme. To add an &lt;code&gt;Associated Address&lt;&#x2F;code&gt; to an &lt;code&gt;Identity&lt;&#x2F;code&gt;, implicit permission from a transaction sender or explicit permission from a signature is required from 1) an address already within the registry and 2) an address to be claimed. Importantly, the transaction need not come from any particular address, as long as permission is established, which allows not only users but third parties (companies, governments, etc.) to bear the overhead of managing identities. To prevent a compromised &lt;code&gt;Associated Address&lt;&#x2F;code&gt; from unilaterally removing other &lt;code&gt;Associated Addresses&lt;&#x2F;code&gt;, it&#x27;s only possible to remove an &lt;code&gt;Associated Address&lt;&#x2F;code&gt; by transacting or producing a signature from it.&lt;&#x2F;p&gt;
&lt;p&gt;All signatures required in ERC-1484 are designed per the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;191&#x2F;&quot;&gt;ERC-191&lt;&#x2F;a&gt; v0 specification. To avoid replay attacks, all signatures must include a timestamp within a rolling lagged window of the current &lt;code&gt;block.timestamp&lt;&#x2F;code&gt;. For more information, see this &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;NoahZinsmeister&#x2F;ERC-1484&#x2F;blob&#x2F;master&#x2F;best-practices&#x2F;VerifyingSignatures.md&quot;&gt;best practices document&lt;&#x2F;a&gt; in the reference implementation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;provider-management&quot;&gt;Provider Management&lt;&#x2F;h3&gt;
&lt;p&gt;While the protocol allows users to directly call identity management functions, it also aims to be more robust and future-proof by allowing &lt;code&gt;Providers&lt;&#x2F;code&gt;, typically smart contracts, to perform identity management functions on a user&#x27;s behalf. A &lt;code&gt;Provider&lt;&#x2F;code&gt; set by an &lt;code&gt;Identity&lt;&#x2F;code&gt; can perform address management and resolver management functions by passing a user&#x27;s &lt;code&gt;EIN&lt;&#x2F;code&gt; in function calls.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;resolver-management&quot;&gt;Resolver Management&lt;&#x2F;h3&gt;
&lt;p&gt;A &lt;code&gt;Resolver&lt;&#x2F;code&gt; is any smart contract that encodes information which resolves to an &lt;code&gt;Identity&lt;&#x2F;code&gt;. We remain agnostic about the specific information that can be encoded in a resolver and the functionality that this enables. The existence of &lt;code&gt;Resolvers&lt;&#x2F;code&gt; is primarily what makes this ERC an identity &lt;em&gt;protocol&lt;&#x2F;em&gt; rather than an identity &lt;em&gt;application&lt;&#x2F;em&gt;. &lt;code&gt;Resolvers&lt;&#x2F;code&gt; resolve abstract data in smart contracts to an atomic entity, the &lt;code&gt;Identity&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;recovery&quot;&gt;Recovery&lt;&#x2F;h3&gt;
&lt;p&gt;If users lose control over an &lt;code&gt;Associated Address&lt;&#x2F;code&gt;, the &lt;code&gt;Recovery Address&lt;&#x2F;code&gt; provides a fallback mechanism. Upon &lt;code&gt;Identity&lt;&#x2F;code&gt; creation, a &lt;code&gt;Recovery Address&lt;&#x2F;code&gt; is passed as a parameter by the creator. Recovery functionality is triggered in three scenarios:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;1. Changing Recovery Address&lt;&#x2F;strong&gt;: If a recovery key is lost, an &lt;code&gt;Associated Address&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;Provider&lt;&#x2F;code&gt; can &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1484&#x2F;#triggerrecoveryaddresschange&quot;&gt;triggerRecoveryAddressChange&lt;&#x2F;a&gt;&#x2F;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1484&#x2F;#triggerrecoveryaddresschangefor&quot;&gt;triggerRecoveryAddressChangeFor&lt;&#x2F;a&gt;. To prevent malicious behavior from someone who has gained control of an &lt;code&gt;Associated Address&lt;&#x2F;code&gt; or &lt;code&gt;Provider&lt;&#x2F;code&gt; and is changing the &lt;code&gt;Recovery Address&lt;&#x2F;code&gt; to one under their control, this action triggers a 14 day challenge period during which the old &lt;code&gt;Recovery Address&lt;&#x2F;code&gt; may reject the change by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1484&#x2F;#triggerrecovery&quot;&gt;triggering recovery&lt;&#x2F;a&gt;. If the &lt;code&gt;Recovery Address&lt;&#x2F;code&gt; does not reject the change within 14 days, the &lt;code&gt;Recovery Address&lt;&#x2F;code&gt; is changed.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;2. Recovery&lt;&#x2F;strong&gt;: Recovery occurs when a user recognizes that an &lt;code&gt;Associated Address&lt;&#x2F;code&gt; or the &lt;code&gt;Recovery Address&lt;&#x2F;code&gt; belonging to the user is lost or stolen. In this instance the &lt;code&gt;Recovery Address&lt;&#x2F;code&gt; must call &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1484&#x2F;#triggerrecovery&quot;&gt;triggerRecovery&lt;&#x2F;a&gt;. This removes all &lt;code&gt;Associated Addresses&lt;&#x2F;code&gt; and &lt;code&gt;Providers&lt;&#x2F;code&gt; from the corresponding &lt;code&gt;Identity&lt;&#x2F;code&gt; and replaces them with an address passed in the function call. The &lt;code&gt;Identity&lt;&#x2F;code&gt; and associated &lt;code&gt;Resolvers&lt;&#x2F;code&gt; maintain integrity. The user is now responsible for adding the appropriate un-compromised addresses back to their &lt;code&gt;Identity&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Importantly, the &lt;code&gt;Recovery Address&lt;&#x2F;code&gt; can be a user-controlled wallet or another address, such as a multisig wallet or smart contract. This allows for arbitrarily sophisticated recovery logic! This includes the potential for recovery to be fully compliant with standards such as &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;decentralized.id&#x2F;&quot;&gt;DID&lt;&#x2F;a&gt;.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;3. Destruction&lt;&#x2F;strong&gt;
The Recovery scheme offers considerable power to a &lt;code&gt;Recovery Address&lt;&#x2F;code&gt;; accordingly, &lt;code&gt;Destruction&lt;&#x2F;code&gt; is a nuclear option to combat malicious control over an &lt;code&gt;Identity&lt;&#x2F;code&gt; when a &lt;code&gt;Recovery Address&lt;&#x2F;code&gt; is compromised. If a malicious actor compromises a user&#x27;s &lt;code&gt;Recovery Address&lt;&#x2F;code&gt; and triggers recovery, any address removed in the &lt;code&gt;Recovery&lt;&#x2F;code&gt; process can call &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1484&#x2F;#triggerdestruction&quot;&gt;triggerDestruction&lt;&#x2F;a&gt; within 14 days to permanently disable the &lt;code&gt;Identity&lt;&#x2F;code&gt;. The user would then need to create a new &lt;code&gt;Identity&lt;&#x2F;code&gt;, and would be responsible for engaging in recovery schemes for any identity applications built in the &lt;code&gt;Resolver&lt;&#x2F;code&gt; or &lt;code&gt;Provider&lt;&#x2F;code&gt; layers.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;alternative-recovery-considerations&quot;&gt;Alternative Recovery Considerations&lt;&#x2F;h4&gt;
&lt;p&gt;We considered many possible alternatives when devising the Recovery process outlined above. We ultimately selected the scheme that was most un-opinionated, modular, and consistent with the philosophy behind the &lt;code&gt;Associated Address&lt;&#x2F;code&gt;, &lt;code&gt;Provider&lt;&#x2F;code&gt;, and &lt;code&gt;Resolver&lt;&#x2F;code&gt; components. Still, we feel that it is important to highlight some of the other recovery options we considered, to provide a rationale as to how we settled on what we did.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;High Level Concerns&lt;&#x2F;strong&gt;
Fundamentally, a Recovery scheme needs to be resilient to a compromised address taking control of a user&#x27;s &lt;code&gt;Identity&lt;&#x2F;code&gt;. A secondary concern is preventing a compromised address from maliciously destroying a user&#x27;s identity due to off-chain utility, which is not an optimal scenario, but is strictly better than if they&#x27;ve gained control.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Alternative 1: Nuclear Option&lt;&#x2F;strong&gt;
This approach would allow any &lt;code&gt;Associated Address&lt;&#x2F;code&gt; to destroy an &lt;code&gt;Identity&lt;&#x2F;code&gt; whenever another &lt;code&gt;Associated Address&lt;&#x2F;code&gt; is compromised. While this may seem severe, we strongly considered it because this ERC is an identity &lt;em&gt;protocol&lt;&#x2F;em&gt;, not an identity &lt;em&gt;application&lt;&#x2F;em&gt;. This means that though a user&#x27;s compromised &lt;code&gt;Identity&lt;&#x2F;code&gt; is destroyed, they should still have recourse to whatever restoration mechanisms are available in each of their actual identities at the &lt;code&gt;Resolver&lt;&#x2F;code&gt; and&#x2F;or &lt;code&gt;Provider&lt;&#x2F;code&gt; level. We ultimately dismissed this approach for two main reasons:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;It is not robust in cases where a user has only one &lt;code&gt;Associated Address&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;It would increase the frequency of recovery requests to identity applications due to its unforgiving nature.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Alternative 2: Unilateral Address Removal via Providers&lt;&#x2F;strong&gt;
This would allow &lt;code&gt;Associated Addresses&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;Providers&lt;&#x2F;code&gt; to remove &lt;code&gt;Associated Addresses&lt;&#x2F;code&gt; without a signature from said address. This implementation would allow &lt;code&gt;Providers&lt;&#x2F;code&gt; to include arbitrarily sophisticated schemes for removing a rogue address - for instance, multi-sig requirements, centralized off-chain verification, user controlled master addresses, deferral to a jurisdictional contract, and more. To prevent a compromised &lt;code&gt;Associated Address&lt;&#x2F;code&gt; from simply setting a malicious &lt;code&gt;Provider&lt;&#x2F;code&gt; to remove un-compromised addresses, it would have required a waiting period between when a &lt;code&gt;Provider&lt;&#x2F;code&gt; is set and when they would be able to remove an &lt;code&gt;Associated Address&lt;&#x2F;code&gt;. We dismissed this approach because we felt it placed too high of a burden on &lt;code&gt;Providers&lt;&#x2F;code&gt;. If a &lt;code&gt;Provider&lt;&#x2F;code&gt; offered a sophisticated range of functionality to a user, but post-deployment a threat was found in the Recovery logic of the provider, &lt;code&gt;Provider&lt;&#x2F;code&gt;-specific infrastructure would need to be rebuilt. We also considered including a flag that would allow a user to decide whether or not a &lt;code&gt;Provider&lt;&#x2F;code&gt; may remove &lt;code&gt;Associated Addresses&lt;&#x2F;code&gt; unilaterally. Ultimately, we concluded that only allowing removal of &lt;code&gt;Associated Addresses&lt;&#x2F;code&gt; via the &lt;code&gt;Recovery Address&lt;&#x2F;code&gt; enables equally sophisticated recovery logic while separating the functionality from &lt;code&gt;Providers&lt;&#x2F;code&gt;, leaving less room for users to relinquish control to potentially flawed implementations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;We find that at a protocol layer, identities should not rely on specific claim or attestation structures, but should instead be a part of a trustless framework upon which arbitrarily sophisticated claim and attestation structures may be built.&lt;&#x2F;p&gt;
&lt;p&gt;The main criticism of existing identity solutions is that they&#x27;re overly restrictive. We aim to limit requirements, keep identities modular and future-proof, and remain un-opinionated regarding any functionality a particular identity component may have. This proposal gives users the option to interact on the blockchain using an robust &lt;code&gt;Identity&lt;&#x2F;code&gt; rather than just an address.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;The reference implementation for ERC-1484 may be found in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;NoahZinsmeister&#x2F;ERC-1484&quot;&gt;NoahZinsmeister&#x2F;ERC-1484&lt;&#x2F;a&gt;.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;identityexists&quot;&gt;identityExists&lt;&#x2F;h4&gt;
&lt;p&gt;Returns a &lt;code&gt;bool&lt;&#x2F;code&gt; indicating whether or not an &lt;code&gt;Identity&lt;&#x2F;code&gt; denominated by the passed &lt;code&gt;EIN&lt;&#x2F;code&gt; exists.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; identityExists&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ein&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;hasidentity&quot;&gt;hasIdentity&lt;&#x2F;h4&gt;
&lt;p&gt;Returns a &lt;code&gt;bool&lt;&#x2F;code&gt; indicating whether or not the passed &lt;code&gt;_address&lt;&#x2F;code&gt; is associated with an &lt;code&gt;Identity&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; hasIdentity&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;getein&quot;&gt;getEIN&lt;&#x2F;h4&gt;
&lt;p&gt;Returns the &lt;code&gt;EIN&lt;&#x2F;code&gt; associated with the passed &lt;code&gt;_address&lt;&#x2F;code&gt;. Throws if the address is not associated with an &lt;code&gt;EIN&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getEIN&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ein&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;isassociatedaddressfor&quot;&gt;isAssociatedAddressFor&lt;&#x2F;h4&gt;
&lt;p&gt;Returns a &lt;code&gt;bool&lt;&#x2F;code&gt; indicating whether or not the passed &lt;code&gt;_address&lt;&#x2F;code&gt; is associated with the passed &lt;code&gt;EIN&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isAssociatedAddressFor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ein&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;isproviderfor&quot;&gt;isProviderFor&lt;&#x2F;h4&gt;
&lt;p&gt;Returns a &lt;code&gt;bool&lt;&#x2F;code&gt; indicating whether or not the passed &lt;code&gt;provider&lt;&#x2F;code&gt; has been set by the passed &lt;code&gt;EIN&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isProviderFor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ein&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; provider&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;isresolverfor&quot;&gt;isResolverFor&lt;&#x2F;h4&gt;
&lt;p&gt;Returns a &lt;code&gt;bool&lt;&#x2F;code&gt; indicating whether or not the passed &lt;code&gt;resolver&lt;&#x2F;code&gt; has been set by the passed &lt;code&gt;EIN&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isResolverFor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ein&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; resolver&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;getidentity&quot;&gt;getIdentity&lt;&#x2F;h4&gt;
&lt;p&gt;Returns the &lt;code&gt;recoveryAddress&lt;&#x2F;code&gt;, &lt;code&gt;associatedAddresses&lt;&#x2F;code&gt;, &lt;code&gt;providers&lt;&#x2F;code&gt; and &lt;code&gt;resolvers&lt;&#x2F;code&gt; of the passed &lt;code&gt;EIN&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getIdentity&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ein&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recoveryAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; associatedAddresses&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; providers&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; resolvers&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;createidentity&quot;&gt;createIdentity&lt;&#x2F;h4&gt;
&lt;p&gt;Creates an &lt;code&gt;Identity&lt;&#x2F;code&gt;, setting the &lt;code&gt;msg.sender&lt;&#x2F;code&gt; as the sole &lt;code&gt;Associated Address&lt;&#x2F;code&gt;. Returns the &lt;code&gt;EIN&lt;&#x2F;code&gt; of the new &lt;code&gt;Identity&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; createIdentity&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recoveryAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; providers&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; resolvers&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ein&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Triggers event: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1484&#x2F;#identitycreated&quot;&gt;IdentityCreated&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;createidentitydelegated&quot;&gt;createIdentityDelegated&lt;&#x2F;h4&gt;
&lt;p&gt;Performs the same logic as &lt;code&gt;createIdentity&lt;&#x2F;code&gt;, but can be called by any address. This function requires a signature from the &lt;code&gt;associatedAddress&lt;&#x2F;code&gt; to ensure their consent.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; createIdentityDelegated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recoveryAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; associatedAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; providers&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; resolvers&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; v&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; s&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; timestamp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ein&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Triggers event: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1484&#x2F;#identitycreated&quot;&gt;IdentityCreated&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;addassociatedaddress&quot;&gt;addAssociatedAddress&lt;&#x2F;h4&gt;
&lt;p&gt;Adds the &lt;code&gt;addressToAdd&lt;&#x2F;code&gt; to the &lt;code&gt;EIN&lt;&#x2F;code&gt; of the &lt;code&gt;approvingAddress&lt;&#x2F;code&gt;. The &lt;code&gt;msg.sender&lt;&#x2F;code&gt; must be either of the &lt;code&gt;approvingAddress&lt;&#x2F;code&gt; or the &lt;code&gt;addressToAdd&lt;&#x2F;code&gt;, and the signature must be from the other one.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addAssociatedAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approvingAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; addressToAdd&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; v&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; s&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; timestamp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    public&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Triggers event: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1484&#x2F;#associatedaddressadded&quot;&gt;AssociatedAddressAdded&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;addassociatedaddressdelegated&quot;&gt;addAssociatedAddressDelegated&lt;&#x2F;h4&gt;
&lt;p&gt;Adds the &lt;code&gt;addressToAdd&lt;&#x2F;code&gt; to the &lt;code&gt;EIN&lt;&#x2F;code&gt; of the &lt;code&gt;approvingAddress&lt;&#x2F;code&gt;. Requires signatures from both the &lt;code&gt;approvingAddress&lt;&#x2F;code&gt; and the &lt;code&gt;addressToAdd&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addAssociatedAddressDelegated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approvingAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; addressToAdd&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint8&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; v&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; s&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; timestamp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    public&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Triggers event: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1484&#x2F;#associatedaddressadded&quot;&gt;AssociatedAddressAdded&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;removeassociatedaddress&quot;&gt;removeAssociatedAddress&lt;&#x2F;h4&gt;
&lt;p&gt;Removes the &lt;code&gt;msg.sender&lt;&#x2F;code&gt; as an &lt;code&gt;Associated Address&lt;&#x2F;code&gt; from its &lt;code&gt;EIN&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; removeAssociatedAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Triggers event: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1484&#x2F;#associatedaddressremoved&quot;&gt;AssociatedAddressRemoved&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;removeassociatedaddressdelegated&quot;&gt;removeAssociatedAddressDelegated&lt;&#x2F;h4&gt;
&lt;p&gt;Removes the &lt;code&gt;addressToRemove&lt;&#x2F;code&gt; from its associated &lt;code&gt;EIN&lt;&#x2F;code&gt;. Requires a signature from the &lt;code&gt;addressToRemove&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; removeAssociatedAddressDelegated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; addressToRemove&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; v&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; s&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; timestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Triggers event: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1484&#x2F;#associatedaddressremoved&quot;&gt;AssociatedAddressRemoved&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;addproviders&quot;&gt;addProviders&lt;&#x2F;h4&gt;
&lt;p&gt;Adds an array of &lt;code&gt;Providers&lt;&#x2F;code&gt; to the &lt;code&gt;Identity&lt;&#x2F;code&gt; of the &lt;code&gt;msg.sender&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addProviders&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; providers&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Triggers event: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1484&#x2F;#provideradded&quot;&gt;ProviderAdded&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;addprovidersfor&quot;&gt;addProvidersFor&lt;&#x2F;h4&gt;
&lt;p&gt;Performs the same logic as &lt;code&gt;addProviders&lt;&#x2F;code&gt;, but must be called by a &lt;code&gt;Provider&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addProvidersFor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ein&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; providers&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Triggers event: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1484&#x2F;#provideradded&quot;&gt;ProviderAdded&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;removeproviders&quot;&gt;removeProviders&lt;&#x2F;h4&gt;
&lt;p&gt;Removes an array of &lt;code&gt;Providers&lt;&#x2F;code&gt; from the &lt;code&gt;Identity&lt;&#x2F;code&gt; of the &lt;code&gt;msg.sender&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; removeProviders&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; providers&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Triggers event: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1484&#x2F;#providerremoved&quot;&gt;ProviderRemoved&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;removeprovidersfor&quot;&gt;removeProvidersFor&lt;&#x2F;h4&gt;
&lt;p&gt;Performs the same logic as &lt;code&gt;removeProviders&lt;&#x2F;code&gt;, but is called by a &lt;code&gt;Provider&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; removeProvidersFor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ein&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; providers&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Triggers event: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1484&#x2F;#providerremoved&quot;&gt;ProviderRemoved&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;addresolvers&quot;&gt;addResolvers&lt;&#x2F;h4&gt;
&lt;p&gt;Adds an array of &lt;code&gt;Resolvers&lt;&#x2F;code&gt; to the &lt;code&gt;EIN&lt;&#x2F;code&gt; of the &lt;code&gt;msg.sender&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addResolvers&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; resolvers&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Triggers event: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1484&#x2F;#resolveradded&quot;&gt;ResolverAdded&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;addresolversfor&quot;&gt;addResolversFor&lt;&#x2F;h4&gt;
&lt;p&gt;Performs the same logic as &lt;code&gt;addResolvers&lt;&#x2F;code&gt;, but must be called by a &lt;code&gt;Provider&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addResolversFor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ein&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; resolvers&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Triggers event: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1484&#x2F;#resolveradded&quot;&gt;ResolverAdded&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;removeresolvers&quot;&gt;removeResolvers&lt;&#x2F;h4&gt;
&lt;p&gt;Removes an array of &lt;code&gt;Resolvers&lt;&#x2F;code&gt; from the &lt;code&gt;EIN&lt;&#x2F;code&gt; of the &lt;code&gt;msg.sender&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; removeResolvers&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; resolvers&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Triggers event: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1484&#x2F;#resolverremoved&quot;&gt;ResolverRemoved&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;removeresolversfor&quot;&gt;removeResolversFor&lt;&#x2F;h4&gt;
&lt;p&gt;Performs the same logic as &lt;code&gt;removeResolvers&lt;&#x2F;code&gt;, but must be called by a &lt;code&gt;Provider&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; removeResolversFor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ein&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; resolvers&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Triggers event: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1484&#x2F;#resolverremoved&quot;&gt;ResolverRemoved&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;triggerrecoveryaddresschange&quot;&gt;triggerRecoveryAddressChange&lt;&#x2F;h4&gt;
&lt;p&gt;Initiates a change in the current &lt;code&gt;recoveryAddress&lt;&#x2F;code&gt; for the &lt;code&gt;EIN&lt;&#x2F;code&gt; of the &lt;code&gt;msg.sender&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; triggerRecoveryAddressChange&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newRecoveryAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Triggers event: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1484&#x2F;#recoveryaddresschangetriggered&quot;&gt;RecoveryAddressChangeTriggered&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;triggerrecoveryaddresschangefor&quot;&gt;triggerRecoveryAddressChangeFor&lt;&#x2F;h4&gt;
&lt;p&gt;Initiates a change in the current &lt;code&gt;recoveryAddress&lt;&#x2F;code&gt; for a given &lt;code&gt;EIN&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; triggerRecoveryAddressChangeFor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ein&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newRecoveryAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Triggers event: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1484&#x2F;#recoveryaddresschangetriggered&quot;&gt;RecoveryAddressChangeTriggered&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;triggerrecovery&quot;&gt;triggerRecovery&lt;&#x2F;h4&gt;
&lt;p&gt;Triggers &lt;code&gt;EIN&lt;&#x2F;code&gt; recovery from the current &lt;code&gt;recoveryAddress&lt;&#x2F;code&gt;, or the old &lt;code&gt;recoveryAddress&lt;&#x2F;code&gt; if changed within the last 2 weeks.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; triggerRecovery&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ein&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newAssociatedAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; v&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; s&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; timestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Triggers event: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1484&#x2F;#recoverytriggered&quot;&gt;RecoveryTriggered&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;triggerdestruction&quot;&gt;triggerDestruction&lt;&#x2F;h4&gt;
&lt;p&gt;Triggers destruction of an &lt;code&gt;EIN&lt;&#x2F;code&gt;. This renders the &lt;code&gt;Identity&lt;&#x2F;code&gt; permanently unusable.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; triggerDestruction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ein&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; firstChunk&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; lastChunk&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; clearResolvers&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Triggers event: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1484&#x2F;#identitydestroyed&quot;&gt;IdentityDestroyed&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;events&quot;&gt;Events&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;identitycreated&quot;&gt;IdentityCreated&lt;&#x2F;h4&gt;
&lt;p&gt;MUST be triggered when an &lt;code&gt;Identity&lt;&#x2F;code&gt; is created.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IdentityCreated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; initiator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ein&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recoveryAddress&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; associatedAddress&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; providers&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; resolvers&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; delegated&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;associatedaddressadded&quot;&gt;AssociatedAddressAdded&lt;&#x2F;h4&gt;
&lt;p&gt;MUST be triggered when an address is added to an &lt;code&gt;Identity&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AssociatedAddressAdded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; initiator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ein&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approvingAddress&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; addedAddress&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; delegated&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;associatedaddressremoved&quot;&gt;AssociatedAddressRemoved&lt;&#x2F;h4&gt;
&lt;p&gt;MUST be triggered when an address is removed from an &lt;code&gt;Identity&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AssociatedAddressRemoved&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; initiator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ein&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; removedAddress&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; delegated&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;provideradded&quot;&gt;ProviderAdded&lt;&#x2F;h4&gt;
&lt;p&gt;MUST be triggered when a provider is added to an &lt;code&gt;Identity&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ProviderAdded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; initiator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ein&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; provider&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; delegated&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;providerremoved&quot;&gt;ProviderRemoved&lt;&#x2F;h4&gt;
&lt;p&gt;MUST be triggered when a provider is removed.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ProviderRemoved&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; initiator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ein&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; provider&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; delegated&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;resolveradded&quot;&gt;ResolverAdded&lt;&#x2F;h4&gt;
&lt;p&gt;MUST be triggered when a resolver is added.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ResolverAdded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; initiator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ein&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; resolvers&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; delegated&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;resolverremoved&quot;&gt;ResolverRemoved&lt;&#x2F;h4&gt;
&lt;p&gt;MUST be triggered when a resolver is removed.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ResolverRemoved&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; initiator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ein&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; resolvers&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; delegated&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;recoveryaddresschangetriggered&quot;&gt;RecoveryAddressChangeTriggered&lt;&#x2F;h4&gt;
&lt;p&gt;MUST be triggered when a recovery address change is triggered.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RecoveryAddressChangeTriggered&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; initiator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ein&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; oldRecoveryAddress&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newRecoveryAddress&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; delegated&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;recoverytriggered&quot;&gt;RecoveryTriggered&lt;&#x2F;h4&gt;
&lt;p&gt;MUST be triggered when recovery is triggered.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RecoveryTriggered&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; initiator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ein&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; oldAssociatedAddresses&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newAssociatedAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;identitydestroyed&quot;&gt;IdentityDestroyed&lt;&#x2F;h4&gt;
&lt;p&gt;MUST be triggered when an &lt;code&gt;Identity&lt;&#x2F;code&gt; is destroyed.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IdentityDestroyed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; initiator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ein&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recoveryAddress&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; resolversReset&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;solidity-interface&quot;&gt;Solidity Interface&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IdentityRegistryInterface&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isSigned&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; messageHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; v&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; s&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Identity View Functions &#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; identityExists&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ein&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; hasIdentity&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getEIN&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ein&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isAssociatedAddressFor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ein&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isProviderFor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ein&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; provider&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isResolverFor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ein&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; resolver&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getIdentity&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ein&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recoveryAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; associatedAddresses&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; providers&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; resolvers&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Identity Management Functions &#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; createIdentity&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recoveryAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; providers&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; resolvers&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ein&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; createIdentityDelegated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recoveryAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; associatedAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; providers&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; resolvers&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; v&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; s&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; timestamp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ein&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addAssociatedAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approvingAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; addressToAdd&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; v&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; s&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; timestamp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addAssociatedAddressDelegated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approvingAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; addressToAdd&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint8&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; v&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; s&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; timestamp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; removeAssociatedAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; removeAssociatedAddressDelegated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; addressToRemove&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; v&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; s&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; timestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addProviders&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; providers&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addProvidersFor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ein&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; providers&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; removeProviders&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; providers&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; removeProvidersFor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ein&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; providers&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addResolvers&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; resolvers&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addResolversFor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ein&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; resolvers&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; removeResolvers&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; resolvers&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; removeResolversFor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ein&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; resolvers&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Recovery Management Functions &#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; triggerRecoveryAddressChange&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newRecoveryAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; triggerRecoveryAddressChangeFor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ein&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newRecoveryAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; triggerRecovery&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ein&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newAssociatedAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; v&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; s&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; timestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; triggerDestruction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ein&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; firstChunk&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; lastChunk&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; resetResolvers&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Events &#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IdentityCreated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; initiator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ein&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recoveryAddress&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; associatedAddress&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; providers&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; resolvers&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; delegated&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AssociatedAddressAdded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; initiator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ein&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; approvingAddress&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; addedAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AssociatedAddressRemoved&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; initiator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ein&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; removedAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ProviderAdded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; initiator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ein&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; provider&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; delegated&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ProviderRemoved&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; initiator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ein&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; provider&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; delegated&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ResolverAdded&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; initiator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ein&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; resolvers&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ResolverRemoved&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; initiator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ein&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; resolvers&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RecoveryAddressChangeTriggered&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; initiator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ein&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; oldRecoveryAddress&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newRecoveryAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RecoveryTriggered&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; initiator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ein&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; oldAssociatedAddresses&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newAssociatedAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IdentityDestroyed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; initiator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ein&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recoveryAddress&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; resolversReset&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;Identities&lt;&#x2F;code&gt; established under this standard consist of existing Ethereum addresses; accordingly, there are no backwards compatibility issues. Deployed, non-upgradeable smart contracts that wish to become &lt;code&gt;Resolvers&lt;&#x2F;code&gt; for &lt;code&gt;Identities&lt;&#x2F;code&gt; will need to write wrapper contracts that resolve addresses to &lt;code&gt;EIN&lt;&#x2F;code&gt;-denominated &lt;code&gt;Identities&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;additional-references&quot;&gt;Additional References&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;NoahZinsmeister&#x2F;ERC-1484&quot;&gt;ERC-1484 Reference Implementation&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;191&#x2F;&quot;&gt;ERC-191 Signatures&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;725&#x2F;&quot;&gt;ERC-725 Identities&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1056&#x2F;&quot;&gt;ERC-1056 Identities&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Human Cost Accounting Standard (Like Gas but for humans)</title>
        <published>2018-10-12T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Iamnot Chris</name><uri>https://github.com/cohabo</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1491/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/freeworkculture/kazini/issues/11" />
        

        <id>https://wg-eips.ritovision.com/1491/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:1491"
            label="ERC-1491" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1491/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;A standard interface for Human Capital Accounting tokens.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The following standard allows for the implementation of a standard API for HUCAP tokens within smart contracts. This standard provides basic functionality to discover, track and transfer the motivational hierarchy of human resources. While blockchain architecture has succeeded in the financialisation of integrity by way of transparency; correspondingly real world outcomes will be proportional to the degree of individualisation of capital by way of knowledge.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The Ethereum protocol architecture has a deterministic world-view bounded to the random reality of the human domain that supplies the intentions and logic. The yellow paper formally defines the EVM as a state machine with only deterministic parameters and state transition operators. Oracle requests to another on-chain contract, and&#x2F;or off-chain HTTP lookups still make for multiple deterministic transactions.&lt;&#x2F;p&gt;
&lt;p&gt;A standard interface that allows the appraisal of individual capabilities concurrently with output and the overall knowledge-base will reduce market search costs and increase the autonomous insertion of mindful innovation into the blockchain ecosystem. We provide for simple smart contracts to define and track an arbitrarily large number of HUCAP assets. Additional applications are discussed below.&lt;&#x2F;p&gt;
&lt;p&gt;The Belief-Desire-Intention model is a plan-theoretic framework for establishing means-end coherence in agent based modelling system.
The blockchain&#x27;s cryptographic security architecture reliably scales to a blockchain based PKI web-of-trust hierarchies.
ERC-20 token standard allows any tokens on Ethereum to be re-used by other applications: from wallets to decentralized exchanges.
ERC-721 token standard allows wallet&#x2F;broker&#x2F;auction applications to work with any NFT on Ethereum.
ERC-1155 Crypto Item standard allows a smart contract interface where one can represent any number of ERC-20 and ERC-721 assets in a single contract.&lt;&#x2F;p&gt;
&lt;p&gt;This standard is inspired by the belief–desire–intention (BDI) model of human practical reasoning developed by Michael Bratman as a way of explaining future-directed intention. A BDI agent is a particular type of bounded rational software agent, imbued with particular mental attitudes, viz: Beliefs, Desires and Intentions (BDI). The model identifies commitment as the distinguishing factor between desire and intention, and a noteworthy property that leads to (1) temporal persistence in plans and in the sense of explicit reference to time, (2) further plans being made on the basis of those to which it is already committed, (3) hierarchical nature of plans, since the overarching plan remains in effect while subsidiary plans are being executed.&lt;&#x2F;p&gt;
&lt;p&gt;The BDI software model is an attempt to solve a problem of plans and planning choice and the execution thereof. The complement of which tenders a sufficient metric for indicating means-end coherence and ascribing cost baselines to such outcomes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h4 id=&quot;main-interface&quot;&gt;Main Interface&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.4.25&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; experimental&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ABIEncoderV2&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-**** Human Capital Accounting Standard&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See https:&#x2F;&#x2F;github.com&#x2F;freeworkculture&#x2F;kazini&#x2F;issues&#x2F;11&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0xf23a6e61.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC_HUCAP&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Compute the index value of an Agents BDI in the ecosystem.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Set the stance of an agent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; For the purpose of &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        Throws on any error rather than return a false flag to minimize user errors&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; updateIndex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the active&#x2F;inactive and states of an Agent in the ecosystem.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Set the stance of an agent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; For the purpose of &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        Throws on any error rather than return a false flag to minimize user errors&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; iam&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; iam_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; IERC_HUCAP_TYPES&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;IS&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; state_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Fetch the bdi index value of an Agent in the ecosystem.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Set the stance of an agent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; For the purpose of &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        Throws on any error rather than return a false flag to minimize user errors&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; index&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; index_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Count of Public Keys in key ring of an Agent in the ecosystem.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Set the stance of an agent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; For the purpose of &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        Throws on any error rather than return a false flag to minimize user errors&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ringLength&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ringlength_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the PGP Public Key Id of an Agent in the ecosystem.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &amp;quot;&amp;quot; Set the stance of an agent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; For the purpose of &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        Throws on any error rather than return a false flag to minimize user errors&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; keyId&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; KEYID_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the merit data of an Agent in the ecosystem.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &amp;quot;&amp;quot; Set the stance of an agent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; For the purpose of &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        Throws on any error rather than return a false flag to minimize user errors&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;span&gt;   &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; merits&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; experience_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; reputation_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; talent_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; index_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; hash_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the accreditation of an Agent in the ecosystem.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &amp;quot;&amp;quot; Set the stance of an agent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; For the purpose of &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        Throws on any error rather than return a false flag to minimize user errors&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; kbase&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;IERC_HUCAP_TYPES&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;KBase&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; kbase_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the desire of an Agent in the ecosystem.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _desire&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    Pro-attitude&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; For the purpose of &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        Throws on any error rather than return a false flag to minimize user errors&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; desire&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes1&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _desire&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the intention of an Agent in the ecosystem.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _intention&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    Conduct-controlling pro-attitude&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; For the purpose of &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        Throws on any error rather than return a false flag to minimize user errors&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; intention&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _intention&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;  (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Cycle the intention of an Agent in the ecosystem.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _intention&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    Conduct-controlling pro-attitude&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; For the purpose of &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        Throws on any error rather than return a false flag to minimize user errors&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; flipIntention&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;  (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the user data of an Agent in the ecosystem.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &amp;quot;&amp;quot;    Conduct-controlling pro-attitude&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; For the purpose of &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        Throws on any error rather than return a false flag to minimize user errors&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getDoer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;  (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; fPrint&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; iam_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; email&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; fName&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; lName&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; age&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the belief data of an Agent in the ecosystem.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _kbase&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    Source address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; For the purpose of &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        Throws on any error rather than return a false flag to minimize user errors&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getBelief&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;IERC_HUCAP_TYPES&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;KBase&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _kbase&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;  (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; country_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; cAuthority_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; score_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the desire data of an Agent in the ecosystem.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _desire&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    Pro-attitides&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; For the purpose of &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        Throws on any error rather than return a false flag to minimize user errors&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getDesire&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes1&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _desire&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;  (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the intention of an Agent in the ecosystem.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _intention&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    Conduct-controlling pro-attitude&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; For the purpose of &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        Throws on any error rather than return a false flag to minimize user errors&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getIntention&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _intention&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;  (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;IERC_HUCAP_TYPES&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;IS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sign the Public Key of an Agent in the ecosystem.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    Address of key to sign, must belong to an Agent &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; For the purpose of &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        Throws on any error rather than return a false flag to minimize user errors&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; sign&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signed&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sign the Public Key of an Agent in the ecosystem.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &amp;quot;&amp;quot;    internal helper function to add key in keyring&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; For the purpose of &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        Throws on any error rather than return a false flag to minimize user errors&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; sign&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyDoer&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signed&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Revoke the Public Key of an Agent in the ecosystem.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    Address of key to revoke, must belong to an Agent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; For the purpose of &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        Throws on any error rather than return a false flag to minimize user errors&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revoke&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyDoer&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; revoked&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Revoke the Public Key of an Agent in the ecosystem.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &amp;quot;&amp;quot;    internal helper function to remove key from keyring&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; For the purpose of &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        Throws on any error rather than return a false flag to minimize user errors&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revoke&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyDoer&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; revoked&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Set the trust level for a Public Key of an Agent in the ecosystem.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _level&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    Degree of trust&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; For the purpose of &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        Throws on any error rather than return a false flag to minimize user errors&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; trust&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Trust&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _level&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Increment the number of keys in the keyring of an Agent in the ecosystem.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _keyd&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    Target key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; For the purpose of &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        Throws on any error rather than return a false flag to minimize user errors&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; incSigns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _keyd&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ProxyKey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Decrement the number of keys in the keyring of an Agent in the ecosystem.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _keyd&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    Target key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; For the purpose of &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        Throws on any error rather than return a false flag to minimize user errors&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; decSigns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _keyd&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ProxyKey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Set the knowledge credentials of an Agent in the ecosystem.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _kbase&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    Level of accreditation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _country&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      Source country&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _cAuthority&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     Accreditation authority&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _score&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  Accreditation &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _year&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Year of Accreditation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; For the purpose of &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        Throws on any error rather than return a false flag to minimize user errors&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setbdi&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        KBase&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _kbase&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _country&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _cAuthority&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _score&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _year&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ProxyBDI&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; qualification_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Set the SNA metrics of an Agent in the ecosystem&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _refMSD&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    Minimum shortest distance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _refRank&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      Rank of target key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _refSigned&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     No of keys signed I have signed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _refSigs&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  No. of keys that have signed my key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _refTrust&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Degree of tructThrows on any error rather than return a false flag to minimize user errors&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; For the purpose of &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        Throws on any error rather than return a false flag to minimize user errors&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setbdi&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _refMSD&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _refRank&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _refSigned&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _refSigs&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _refTrust&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ProxyBDI&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; reputation_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Set the talents of an Agent in the ecosystem&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _talent&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    Agent&amp;#39;s talent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; For the purpose of &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        Throws on any error rather than return a false flag to minimize user errors&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setbdi&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _talent&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ProxyBDI&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; talent_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Set the desires of an Agent in the ecosystem&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _desire&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    Pro-attitude&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _goal&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      A goal is an instatiated pro-attitude&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; For the purpose of &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        Throws on any error rather than return a false flag to minimize user errors&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setbdi&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes1&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _desire&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; Desire&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _goal&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyDoer&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Set the intention of an Agent in the ecosystem&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _service&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    Conducting-controlling pro-attitude&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; For the purpose of &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        Throws on any error rather than return a false flag to minimize user errors&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setbdi&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Intention&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _service&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyDoer&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Set the targeted intention of an Agent in the ecosystem.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _intention&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    Conduct-controlling pro-attitude&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _state&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      Agent stance       &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; For the purpose of &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        Throws on any error rather than return a false flag to minimize user errors&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; intention&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _intention&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; IERC_HUCAP_TYPES&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;IS&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;  (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;IERC_HUCAP_TYPES&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;IS&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; End of interface IERC_HUCAP &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;user-defined-types-extension-interface&quot;&gt;User Defined Types Extension Interface&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC_HUCAP_TYPES&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Enums&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Weights	   1,		2,		 4,		    8,		   16,	    32,		64,	    128    256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; KBase&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;PRIMARY&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;SECONDARY&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;TERTIARY&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;CERTIFICATION&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;DIPLOMA&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;LICENSE&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;BACHELOR&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;MASTER&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;DOCTORATE&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IS&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt; CLOSED&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt; CREATOR&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt; CURATOR&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt; ACTIVE&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt; INACTIVE&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt; RESERVED&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt; PROVER&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Structus &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Clearance&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; Zero&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; Unknown&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; Generic&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; Poor&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; Casual&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; Partial&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; Complete&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; Ultimate&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; End of interface IERC_HUCAP_TYPES &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;web-of-trust-extension-interface&quot;&gt;Web-of-trust Extension Interface&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.4.25&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; experimental&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ABIEncoderV2&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC_HUCAP_KEYSIGNING_EXTENSION&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; _InterfaceId_ERC165_        &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;CREATOR 0.0118 XOR OF ALL FUNCTIONS IN THE INTERFACE&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Complies to ERC165&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  KEY MASKING TABLE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  bytes32 constant public MASK 			   		    = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  bytes32 constant public KEYID                       = 0xffffffffffffffffffffffffffffffffff90EBAC34FC40EAC30FC9CB464A2E56; &#x2F;&#x2F; EXAMPLE PGP PUBLIC KEY ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  bytes32 constant public KEY_CERTIFICATION 		    = 0x01ffffffffffffff &amp;lt;&amp;lt; 192; &#x2F;&#x2F; “C”	Key Certification&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  bytes32 constant public SIGN_DATA   			    = 0x02ffffffffffffff &amp;lt;&amp;lt; 192; &#x2F;&#x2F; “S”	Sign Data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  bytes32 constant public ENCRYPT_COMMUNICATIONS 	    = 0x04ffffffffffffff &amp;lt;&amp;lt; 192; &#x2F;&#x2F; “E”	Encrypt Communications&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  Clearance constant public Trust                     = 0x03ff &amp;lt;&amp;lt; 192; &#x2F;&#x2F; Trust: Unknown&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;                                                        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; BYTES32 Value with &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;                                                        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Public Key Id, masking&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;                                                        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Key Certification masking&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;                                                        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Split Key masking&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;                                                        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Generic masking&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;                                                        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Ordinary masking&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;                                                        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  Trust.Unknown masking&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;                                                        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  bytes32 constant public DOER = 0x11ff10ff100f03ffff00ffffffffffffffff90EBAC34FC40EAC30FC9CB464A2E56;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; KEY_CERTIFICATION 		    &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x01ffffffffffffff&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 192&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; “C”	Key Certification&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; SIGN_DATA   			    &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x02ffffffffffffff&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 192&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; “S”	Sign Data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; ENCRYPT_COMMUNICATIONS 	    &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x04ffffffffffffff&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 192&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; “E”	Encrypt Communications&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; ENCRYPT_STORAGE  		    &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x08ffffffffffffff&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 192&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; “E”	Encrypt Storage&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; SPLIT_KEY   			    &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x10ffffffffffffff&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 192&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Split key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; AUTHENTICATION   		    &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x20ffffffffffffff&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 192&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; “A”	Authentication&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; MULTI_SIGNATURE			    &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x80ffffffffffffff&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 192&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Held by more than one person&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; TRUST_AMOUNT                &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xffffffffffff00ff&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 192&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; BINARY_DOCUMENT             &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xffff00ffffffffff&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 192&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0x00: Signature of a binary document.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; CANONICAL_DOCUMENT          &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xffff01ffffffffff&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 192&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0x01: Signature of a canonical text document.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; STANDALONE_SIGNATURE        &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xffff02ffffffffff&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 192&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0x02: Standalone signature.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; GENERIC                     &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xffff10ffffffffff&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 192&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0x10: Generic certification of a User ID and Public-Key packet.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; PERSONA                     &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xffff11ffffffffff&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 192&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0x11: Persona certification of a User ID and Public-Key packet.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; CASUAL                      &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xffff12ffffffffff&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 192&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0x12: Casual certification of a User ID and Public-Key packet.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; POSITIVE                    &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xffff13ffffffffff&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 192&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0x13: Positive certification of a User ID and Public-Key packet.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; SUBKEY_BINDING              &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xffff18ffffffffff&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 192&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0x18: Subkey Binding Signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; PRIMARY_KEY_BINDING         &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xffff19ffffffffff&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 192&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0x19: Primary Key Binding Signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; DIRECTLY_ON_KEY             &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xffff1Fffffffffff&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 192&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0x1F: Signature directly on a key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; KEY_REVOCATION              &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xffff20ffffffffff&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 192&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0x20: Key revocation signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; SUBKEY_REVOCATION           &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xffff28ffffffffff&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 192&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0x28: Subkey revocation signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; CERTIFICATION_REVOCATION    &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xffff30ffffffffff&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 192&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0x30: Certification revocation signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; TIMESTAMP                   &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xffff40ffffffffff&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 192&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0x40: Timestamp signature.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; THIRD_PARTY_CONFIRMATION    &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xffff50ffffffffff&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 192&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0x50: Third-Party Confirmation signature.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; ORDINARY   				    &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xffffffff100fffff&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 192&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; INTRODUCER 				    &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xffffffff010fffff&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 192&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; ISSUER	   				    &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xffffffff001fffff&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 192&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  EDGES MASKING TABLE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Clearance &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;internal&lt;&#x2F;span&gt;&lt;span&gt; TRUST &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Clearance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        Zero&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;       0x01ff&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 192&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        Unknown&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;    0x03ff&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 192&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        Generic&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;    0x07ff&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 192&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        Poor&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;       0xF0ff&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 192&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        Casual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;     0xF1ff&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 192&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        Partial&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;    0xF3ff&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 192&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        Complete&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;   0xF7ff&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 192&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        Ultimate&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;   0xFFff&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 192&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F; &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Cycle through state transition of an Agent in the ecosystem.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F; &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; toggle on&#x2F;off a doer agent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;  &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `anybody` can retrieve the talent data in the contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; flipTo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;IS&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F; &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Turn Agent in the ecosystem to on&#x2F;off.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F; &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; toggle on&#x2F;off a doer agent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;  &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `anybody` can retrieve the talent data in the contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; toggle&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F; &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Set the trust level of an Agent in the ecosystem.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F; &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _level&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; toggle on&#x2F;off a doer agent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;  &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `anybody` can retrieve the talent data in the contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; trust&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Trust&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _level&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; Trust&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; LogCall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; origin&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; End of interface IERC_HUCAP_KEYSIGNING_EXTENSION &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;human-capital-accounting-extension-interface&quot;&gt;Human Capital Accounting Extension Interface&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.4.25&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; experimental&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ABIEncoderV2&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC_HUCAP_TRACKUSERS_EXTENSION&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Instantiate an Agent in the ecosystem with default data.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; initialise a doer agent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  @dev `anybody` can retrieve the talent data in the contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; initAgent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Doers&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyControlled&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the data by uuid of an Agent in the ecosystem.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _uuid&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the address of a unique uid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  @dev `anybody` can retrieve the talent data in the contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getAgent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _uuid&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the data of all Talents in the ecosystem.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Query if address belongs to an agent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  @dev `anybody` can retrieve the talent data in the contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; iam&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the data of all Talents in the ecosystem.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Query if address belongs to a doer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  @dev `anybody` can retrieve the talent data in the contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isDoer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;IS&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the number of doers that can be spawned by a Creators.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The query condition of the contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  @dev `anybody` can retrieve the count data in the contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getAgent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; keyid_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; IS&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; state_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; active_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; myDoers_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the data of all Talents in the ecosystem.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _talent&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The talent whose frequency is being queried&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  @dev `anybody` can retrieve the talent data in the contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getTalents&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _talent&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;  (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; talentK_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; talentI_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; talentR_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; talentF_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Increment a kind of talent in the ecosystem.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; talent whose frequency is being queried&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  @dev `anybody` can retrieve the talent data in the contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; incTalent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyDoer&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Decrement a kind of talent in the ecosystem..&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; talent whose frequency is being queried&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  @dev `anybody` can retrieve the talent data in the contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; decTalent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyDoer&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Set the Public-Key Id of an Agent in the ecosystem.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Set the Public-key Id of an agent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  @dev `anybody` can retrieve the talent data in the contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setAgent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _keyId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyControlled&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transition the states of an Agent in the ecosystem.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Set the stance of an agent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  @dev `anybody` can retrieve the talent data in the contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setAgent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; IS&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyControlled&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;IS&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Set the active status of an Agent in the ecosystem.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Toggle the true&#x2F;false status of an agent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  @dev `anybody` can retrieve the talent data in the contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setAgent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _active&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyControlled&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Set the data of all Intentions of Agents in the ecosystem.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _serviceId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Track number of offers available&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  @dev `anybody` can retrieve the talent data in the contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setAllPromises&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _serviceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyControlled&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; End of interface IERC_HUCAP_TRACKUSERS_EXTENSION &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;[WIP]&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;[WIP]&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;[WIP]&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;[WIP]&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Standard for Insurance Policies as ERC-721 Non Fungible Tokens</title>
        <published>2018-10-10T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Christoph Mussenbrock</name><uri>https://github.com/christoph2806</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1523/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/1523" />
        

        <id>https://wg-eips.ritovision.com/1523/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:1523"
            label="ERC-1523" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1523/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;A standard interface for insurance policies, based on ERC 721.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The following standard allows for the implementation of a standard API for insurance policies within smart contracts.
Insurance policies are financial assets which are unique in some aspects, as they are connected to a customer, a specific risk, or have other unique properties like premium, period, carrier, underwriter etc.
Nevertheless, there are many potential applications where insurance policies can be traded, transferred or otherwise treated as an asset.
The ERC 721 standard already provides the standard and technical means to handle policies as a specific class of non fungible tokens.
insurance In this proposal, we define a minimum metadata structure with properties which are common to the greatest possible class of policies.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;For a decentralized insurance protocol, a standard for insurance policies is crucial for interoperability of the involved services and application.
It allows policies to be bundled, securitized, traded in a uniform and flexible way by many independent actors like syndicates, brokers, and insurance companies.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;An ERC-1523 compliant insurance policy is a non-fungible token which &lt;strong&gt;MUST adhere to the ERC-721 token standard&lt;&#x2F;strong&gt; and &lt;strong&gt;MUST implement theERC721Metadata and the ERC721Enumerable interface&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-1523 Insurance Policy Standard&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;  Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0x5a04be32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC1523&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is ERC721, ERC721Metadata, ERC721Enumerable &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The implementor MAY choose values for the &lt;code&gt;name&lt;&#x2F;code&gt; and &lt;code&gt;symbol&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;strong&gt;policy metadata extension&lt;&#x2F;strong&gt; is &lt;strong&gt;RECOMMENDED&lt;&#x2F;strong&gt; for ERC-1523 smart contracts.
This allows your smart contract to be interrogated for policy metadata.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-1523 Insurance Policy Standard, optional policy metadata extension&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;  Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0x5a04be32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC1523PolicyMetadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is ERC1523 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Metadata string for a given property.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Properties are identified via hash of their property path.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; e.g. the property &amp;quot;name&amp;quot; in the ERC721 Metadata JSON Schema has the path &#x2F;properties&#x2F;name&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; and the property path hash is the keccak256() of this property path. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; this allows for efficient addressing of arbitrary properties, as the set of properties is potentially unlimited.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws if `_propertyPathHash` is not a valid property path hash. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; policyMetadata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _propertyPathHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _property&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In analogy to the “ERC721 Metadata JSON Schema”, the tokenURI &lt;strong&gt;MUST&lt;&#x2F;strong&gt; point to a JSON file with the following properties:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Asset Metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Identifies the asset to which this NFT represents&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Describes the asset to which this NFT represents&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;        \&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;d&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;d&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; p&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;m&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;d&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;g&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;h&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;w&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;g&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;b&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;\&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;additional-parameters-for-the-metadata-json-schema&quot;&gt;Additional parameters for the metadata JSON Schema&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Mandatory&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;carrier&lt;&#x2F;td&gt;&lt;td&gt;string&lt;&#x2F;td&gt;&lt;td&gt;yes&lt;&#x2F;td&gt;&lt;td&gt;Describes the carrier which takes the primary risk&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;risk&lt;&#x2F;td&gt;&lt;td&gt;string&lt;&#x2F;td&gt;&lt;td&gt;yes&lt;&#x2F;td&gt;&lt;td&gt;Describes the risk&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;status&lt;&#x2F;td&gt;&lt;td&gt;string&lt;&#x2F;td&gt;&lt;td&gt;yes&lt;&#x2F;td&gt;&lt;td&gt;Describes the status of the policy, e.g. applied for, underwritten, expired&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;parameters&lt;&#x2F;td&gt;&lt;td&gt;string&lt;&#x2F;td&gt;&lt;td&gt;no&lt;&#x2F;td&gt;&lt;td&gt;Describes further parameters characterizing the risk&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;terms&lt;&#x2F;td&gt;&lt;td&gt;string&lt;&#x2F;td&gt;&lt;td&gt;no&lt;&#x2F;td&gt;&lt;td&gt;Describes legal terms &amp;amp; conditions which apply for this policy&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;premium&lt;&#x2F;td&gt;&lt;td&gt;string&lt;&#x2F;td&gt;&lt;td&gt;no&lt;&#x2F;td&gt;&lt;td&gt;A string representation of the premium, &lt;strong&gt;MAY&lt;&#x2F;strong&gt; contain currency denominator&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;sum_insured&lt;&#x2F;td&gt;&lt;td&gt;string&lt;&#x2F;td&gt;&lt;td&gt;no&lt;&#x2F;td&gt;&lt;td&gt;A string representation of the sum insured, &lt;strong&gt;MAY&lt;&#x2F;strong&gt; contain currency denominator&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Parameters which are mandatory &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be included in the metadata JSON. Other parameters &lt;strong&gt;MAY&lt;&#x2F;strong&gt; be included. However, the proposed optional parameters &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; be used for the intended purpose, so e.g. if the premium amount would be included in the metadata, the parameter name &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; be &quot;premium&quot;.
All parameters &lt;strong&gt;MAY&lt;&#x2F;strong&gt; be plain text or &lt;strong&gt;MAY&lt;&#x2F;strong&gt; also be URIs pointing to resources which contain the respective information, and which &lt;strong&gt;MAY&lt;&#x2F;strong&gt; be protected by an authentication mechanism.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Insurance policies form an important class of financial assets, and it is natural to express those assets as a class of non-fungible tokens which adhere to the established ERC-721 standard.
We propose a standard for the accompanying metadata structures which are needed to uniquely define an insurance policy. Standardization is key because we expect decentralized insurance to receive widespread adoption and it is crucial to establish a unified standard to enable composability and the creation of universal toolsets.
We therefore propose a standardized naming scheme for the different parameters describing an insurance policy. We propose three mandatory parameters which need to be included in every NFT and further parameters which &lt;strong&gt;MAY&lt;&#x2F;strong&gt; be used, and for which we only standardize the naming conventions.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;mandatory-parameters&quot;&gt;Mandatory parameters&lt;&#x2F;h3&gt;
&lt;p&gt;While policies can have a multitude of possible properties, it is common that policies are issued by some entity, which is basically the entity responsible for paying out claims.
Second, an insurance policy is typically related to a specific risk. Some risks are unique, but there are cases where many policies share the same risk
(e.g. all flight delay policies for the same flight).
In general, the relation of policies to risks is a many-to-one relation with the special case of a one-to-one relation.
Third, a policy has a lifecycle of different statuses. Therefore the NFT
We believe that those four properties are necessary to describe a policy. For many applications, those properties may be even sufficient.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;optional-parameters&quot;&gt;Optional parameters&lt;&#x2F;h3&gt;
&lt;p&gt;Most policies need more parameters to characterize the risk and other features, like premium, period etc. The naming conventions are listed in the above table.
However, any implementation &lt;strong&gt;MAY&lt;&#x2F;strong&gt; chose to implement more properties.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;on-chain-vs-off-chain-metadata&quot;&gt;On-chain vs. off-chain metadata&lt;&#x2F;h3&gt;
&lt;p&gt;For some applications it will be sufficient to store the metadata in an off-chain repository or database which can be addressed by the tokenURI resource locator.
For more advanced applications, it can be desirable to have metadata available on-chain.
Therefore, we require that the &lt;code&gt;tokenURI&lt;&#x2F;code&gt; &lt;strong&gt;MUST&lt;&#x2F;strong&gt; point to a JSON with the above structure, while the implementation of the &lt;code&gt;policyMetadata&lt;&#x2F;code&gt; function is &lt;strong&gt;OPTIONAL&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Define a maximum block timestamp drift</title>
        <published>2018-10-09T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Maurelian</name><uri>https://github.com/Maurelian</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1482/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/define-a-maximum-block-timestamp-drift/1556" />
        

        <id>https://wg-eips.ritovision.com/1482/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:1482"
            label="EIP-1482" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1482/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Include an explicit definition of the acceptable timestamp drift in the protocol specification.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;On the basis that both Geth and Parity implement the same timestamp validation requirements, this should be written into the reference specification.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;There is a lack of clarity about how accurate timestamps in the block header must be. The yellow paper describes the timestamp as&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;A scalar value equal to the reasonable output of Unix’s time() at this block’s inception&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;This causes &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum.stackexchange.com&#x2F;questions&#x2F;5924&#x2F;how-do-ethereum-mining-nodes-maintain-a-time-consistent-with-the-network&#x2F;5926#5926&quot;&gt;confusion&lt;&#x2F;a&gt; about the safe use of the &lt;code&gt;TIMESTAMP&lt;&#x2F;code&gt; opcode (solidity&#x27;s &lt;code&gt;block.timestamp&lt;&#x2F;code&gt; or &lt;code&gt;now&lt;&#x2F;code&gt;) in smart contract development.&lt;&#x2F;p&gt;
&lt;p&gt;Differing interpretations of &#x27;reasonable&#x27; may create a risk of consenus failures.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The yellow paper should define a timestamp as:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;A scalar value equal to the output of Unix’s time() at this block’s inception. For the purpose of block validation, it must be greater than the previous block&#x27;s timestamp, and no more than 15 seconds greater than system time.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Both &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;go-ethereum&#x2F;blob&#x2F;4e474c74dc2ac1d26b339c32064d0bac98775e77&#x2F;consensus&#x2F;ethash&#x2F;consensus.go#L45&quot;&gt;Geth&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;paritytech&#x2F;parity-ethereum&#x2F;blob&#x2F;73db5dda8c0109bb6bc1392624875078f973be14&#x2F;ethcore&#x2F;src&#x2F;verification&#x2F;verification.rs#L296-L307&quot;&gt;Parity&lt;&#x2F;a&gt; reject blocks with timestamp more than 15 seconds in the future. This establishes a defacto standard, which should be made explicit in the reference specification.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;It may be necessary to relax this requirement for blocks which were mined early in the main chain&#x27;s history, if they would be considered invalid.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;These would be important to have.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;_The implementations must be completed before any EIP is given status &quot;Final&quot;, but it need not be completed before the EIP is accepted. While there is merit to the approach of reaching consensus on the specification and rationale before writing code, the principle of &quot;rough consensus and running code&quot; is still useful when it comes to resolving many discussions of API details.
_&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Remote procedure call specification</title>
        <published>2018-10-02T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Paul Bouchon</name><email>mail@bitpshr.net</email>
	</author>
	
	<author>
		<name>Erik Marks</name><uri>https://github.com/rekmarks</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1474/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-remote-procedure-call-specification/1537" />
        

        <id>https://wg-eips.ritovision.com/1474/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="interface"
                label="Interface" />
            
        

        
        <category
            term="tag:eip:1474"
            label="EIP-1474" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1474/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal defines a standard set of remote procedure call methods that an Ethereum node should implement.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Nodes created by the current generation of Ethereum clients expose inconsistent and incompatible remote procedure call (RPC) methods because no formal Ethereum RPC specification exists. This proposal standardizes such a specification to provide developers with a predictable Ethereum RPC interface regardless of underlying node implementation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;concepts&quot;&gt;Concepts&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;rfc-2119&quot;&gt;RFC-2119&lt;&#x2F;h4&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;,  &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.ietf.org&#x2F;rfc&#x2F;rfc2119.txt&quot;&gt;RFC-2119&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;json-rpc&quot;&gt;JSON-RPC&lt;&#x2F;h4&gt;
&lt;p&gt;Communication with Ethereum nodes is accomplished using &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.jsonrpc.org&#x2F;specification&quot;&gt;JSON-RPC&lt;&#x2F;a&gt;, a stateless, lightweight &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Remote_procedure_call&quot;&gt;remote procedure call&lt;&#x2F;a&gt; protocol that uses &lt;a rel=&quot;external&quot; href=&quot;http:&#x2F;&#x2F;www.json.org&#x2F;&quot;&gt;JSON&lt;&#x2F;a&gt; as its data format. Ethereum RPC methods &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be called using &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.jsonrpc.org&#x2F;specification#request_object&quot;&gt;JSON-RPC request objects&lt;&#x2F;a&gt; and &lt;strong&gt;MUST&lt;&#x2F;strong&gt; respond with &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.jsonrpc.org&#x2F;specification#response_object&quot;&gt;JSON-RPC response objects&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;error-codes&quot;&gt;Error codes&lt;&#x2F;h4&gt;
&lt;p&gt;If an Ethereum RPC method encounters an error, the &lt;code&gt;error&lt;&#x2F;code&gt; member included on the response object &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be an object containing a &lt;code&gt;code&lt;&#x2F;code&gt; member and descriptive &lt;code&gt;message&lt;&#x2F;code&gt; member. The following list contains all possible error codes and associated messages:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Code&lt;&#x2F;th&gt;&lt;th&gt;Message&lt;&#x2F;th&gt;&lt;th&gt;Meaning&lt;&#x2F;th&gt;&lt;th&gt;Category&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;-32700&lt;&#x2F;td&gt;&lt;td&gt;Parse error&lt;&#x2F;td&gt;&lt;td&gt;Invalid JSON&lt;&#x2F;td&gt;&lt;td&gt;standard&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;-32600&lt;&#x2F;td&gt;&lt;td&gt;Invalid request&lt;&#x2F;td&gt;&lt;td&gt;JSON is not a valid request object&lt;&#x2F;td&gt;&lt;td&gt;standard&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;-32601&lt;&#x2F;td&gt;&lt;td&gt;Method not found&lt;&#x2F;td&gt;&lt;td&gt;Method does not exist&lt;&#x2F;td&gt;&lt;td&gt;standard&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;-32602&lt;&#x2F;td&gt;&lt;td&gt;Invalid params&lt;&#x2F;td&gt;&lt;td&gt;Invalid method parameters&lt;&#x2F;td&gt;&lt;td&gt;standard&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;-32603&lt;&#x2F;td&gt;&lt;td&gt;Internal error&lt;&#x2F;td&gt;&lt;td&gt;Internal JSON-RPC error&lt;&#x2F;td&gt;&lt;td&gt;standard&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;-32000&lt;&#x2F;td&gt;&lt;td&gt;Invalid input&lt;&#x2F;td&gt;&lt;td&gt;Missing or invalid parameters&lt;&#x2F;td&gt;&lt;td&gt;non-standard&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;-32001&lt;&#x2F;td&gt;&lt;td&gt;Resource not found&lt;&#x2F;td&gt;&lt;td&gt;Requested resource not found&lt;&#x2F;td&gt;&lt;td&gt;non-standard&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;-32002&lt;&#x2F;td&gt;&lt;td&gt;Resource unavailable&lt;&#x2F;td&gt;&lt;td&gt;Requested resource not available&lt;&#x2F;td&gt;&lt;td&gt;non-standard&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;-32003&lt;&#x2F;td&gt;&lt;td&gt;Transaction rejected&lt;&#x2F;td&gt;&lt;td&gt;Transaction creation failed&lt;&#x2F;td&gt;&lt;td&gt;non-standard&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;-32004&lt;&#x2F;td&gt;&lt;td&gt;Method not supported&lt;&#x2F;td&gt;&lt;td&gt;Method is not implemented&lt;&#x2F;td&gt;&lt;td&gt;non-standard&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;-32005&lt;&#x2F;td&gt;&lt;td&gt;Limit exceeded&lt;&#x2F;td&gt;&lt;td&gt;Request exceeds defined limit&lt;&#x2F;td&gt;&lt;td&gt;non-standard&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;-32006&lt;&#x2F;td&gt;&lt;td&gt;JSON-RPC version not supported&lt;&#x2F;td&gt;&lt;td&gt;Version of JSON-RPC protocol is not supported&lt;&#x2F;td&gt;&lt;td&gt;non-standard&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Example error response:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1337&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;code&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32003,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;message&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Transaction rejected&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;value-encoding&quot;&gt;Value encoding&lt;&#x2F;h4&gt;
&lt;p&gt;Specific types of values passed to and returned from Ethereum RPC methods require special encoding:&lt;&#x2F;p&gt;
&lt;h5 id=&quot;quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;ul&gt;
&lt;li&gt;A &lt;code&gt;Quantity&lt;&#x2F;code&gt; value &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be hex-encoded.&lt;&#x2F;li&gt;
&lt;li&gt;A &lt;code&gt;Quantity&lt;&#x2F;code&gt; value &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be &quot;0x&quot;-prefixed.&lt;&#x2F;li&gt;
&lt;li&gt;A &lt;code&gt;Quantity&lt;&#x2F;code&gt; value &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be expressed using the fewest possible hex digits per byte.&lt;&#x2F;li&gt;
&lt;li&gt;A &lt;code&gt;Quantity&lt;&#x2F;code&gt; value &lt;strong&gt;MUST&lt;&#x2F;strong&gt; express zero as &quot;0x0&quot;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Examples &lt;code&gt;Quantity&lt;&#x2F;code&gt; values:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Valid&lt;&#x2F;th&gt;&lt;th&gt;Reason&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;0x&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;invalid&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;empty not a valid quantity&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x0&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;valid&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;interpreted as a quantity of zero&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x00&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;invalid&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;leading zeroes not allowed&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x41&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;valid&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;interpreted as a quantity of 65&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x400&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;valid&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;interpreted as a quantity of 1024&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x0400&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;invalid&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;leading zeroes not allowed&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;ff&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;invalid&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;values must be prefixed&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h5 id=&quot;block-identifier&quot;&gt;&lt;code&gt;Block Identifier&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;p&gt;The RPC methods below take a default block identifier as a parameter.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;eth_getBalance&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;eth_getStorageAt&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;eth_getTransactionCount&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;eth_getCode&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;eth_call&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;eth_getProof&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Since there is no way to clearly distinguish between a &lt;code&gt;Data&lt;&#x2F;code&gt; parameter and a &lt;code&gt;Quantity&lt;&#x2F;code&gt; parameter, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1898&#x2F;&quot;&gt;EIP-1898&lt;&#x2F;a&gt; provides a format to specify a block either using the block hash or block number. The block identifier is a JSON &lt;code&gt;object&lt;&#x2F;code&gt; with the following fields:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Property&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;[blockNumber]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;}&lt;&#x2F;td&gt;&lt;td&gt;The block in the canonical chain with this number&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;OR &lt;code&gt;[blockHash]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;}&lt;&#x2F;td&gt;&lt;td&gt;The block uniquely identified by this hash. The &lt;code&gt;blockNumber&lt;&#x2F;code&gt; and &lt;code&gt;blockHash&lt;&#x2F;code&gt; properties are mutually exclusive; exactly one of them must be set.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;requireCanonical&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;{&lt;code&gt;boolean&lt;&#x2F;code&gt;}&lt;&#x2F;td&gt;&lt;td&gt;(optional) Whether or not to throw an error if the block is not in the canonical chain as described below. Only allowed in conjunction with the &lt;code&gt;blockHash&lt;&#x2F;code&gt; tag. Defaults to &lt;code&gt;false&lt;&#x2F;code&gt;.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;If the block is not found, the callee SHOULD raise a JSON-RPC error (the recommended error code is &lt;code&gt;-32001: Resource not found&lt;&#x2F;code&gt;. If the tag is &lt;code&gt;blockHash&lt;&#x2F;code&gt; and &lt;code&gt;requireCanonical&lt;&#x2F;code&gt; is &lt;code&gt;true&lt;&#x2F;code&gt;, the callee SHOULD additionally raise a JSON-RPC error if the block is not in the canonical chain (the recommended error code is &lt;code&gt;-32000: Invalid input&lt;&#x2F;code&gt; and in any case should be different than the error code for the block not found case so that the caller can distinguish the cases). The block-not-found check SHOULD take precedence over the block-is-canonical check, so that if the block is not found the callee raises block-not-found rather than block-not-canonical.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;ul&gt;
&lt;li&gt;A &lt;code&gt;Data&lt;&#x2F;code&gt; value &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be hex-encoded.&lt;&#x2F;li&gt;
&lt;li&gt;A &lt;code&gt;Data&lt;&#x2F;code&gt; value &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be &quot;0x&quot;-prefixed.&lt;&#x2F;li&gt;
&lt;li&gt;A &lt;code&gt;Data&lt;&#x2F;code&gt; value &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be expressed using two hex digits per byte.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Examples &lt;code&gt;Data&lt;&#x2F;code&gt; values:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Valid&lt;&#x2F;th&gt;&lt;th&gt;Reason&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;0x&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;valid&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;interpreted as empty data&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x0&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;invalid&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;each byte must be represented using two hex digits&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x00&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;valid&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;interpreted as a single zero byte&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x41&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;true&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;interpreted as a data value of 65&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x004200&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;true&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;interpreted as a data value of 16896&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0xf0f0f&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;false&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;bytes require two hex digits&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;004200&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;false&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;values must be prefixed&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h5 id=&quot;proposing-changes&quot;&gt;Proposing changes&lt;&#x2F;h5&gt;
&lt;p&gt;New Ethereum RPC methods and changes to existing methods &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be proposed via the traditional EIP process. This allows for community consensus around new method implementations and proposed method modifications. RPC method proposals &lt;strong&gt;MUST&lt;&#x2F;strong&gt; reach &quot;draft&quot; status before being added to this proposal and the official Ethereum RPC specification defined herein.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;methods&quot;&gt;Methods&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;web3-clientversion&quot;&gt;web3_clientVersion&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;description&quot;&gt;Description&lt;&#x2F;h5&gt;
&lt;p&gt;Returns the version of the current client&lt;&#x2F;p&gt;
&lt;h5 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h5&gt;
&lt;p&gt;&lt;em&gt;(none)&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h5 id=&quot;returns&quot;&gt;Returns&lt;&#x2F;h5&gt;
&lt;p&gt;{&lt;code&gt;string&lt;&#x2F;code&gt;} - client version&lt;&#x2F;p&gt;
&lt;h5 id=&quot;example&quot;&gt;Example&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;-data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;id&amp;quot;: 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;jsonrpc&amp;quot;: &amp;quot;2.0&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;method&amp;quot;: &amp;quot;web3_clientVersion&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;params&amp;quot;: [],&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ur&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Mist&#x2F;v0.9.3&#x2F;darwin&#x2F;go1.4.1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;hr &#x2F;&gt;
&lt;h4 id=&quot;web3-sha3&quot;&gt;web3_sha3&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;description-1&quot;&gt;Description&lt;&#x2F;h5&gt;
&lt;p&gt;Hashes data using the Keccak-256 algorithm&lt;&#x2F;p&gt;
&lt;h5 id=&quot;parameters-1&quot;&gt;Parameters&lt;&#x2F;h5&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;#&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;}&lt;&#x2F;td&gt;&lt;td&gt;data to hash&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h5 id=&quot;returns-1&quot;&gt;Returns&lt;&#x2F;h5&gt;
&lt;p&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} - Keccak-256 hash of the given data&lt;&#x2F;p&gt;
&lt;h5 id=&quot;example-1&quot;&gt;Example&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;-data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;id&amp;quot;: 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;jsonrpc&amp;quot;: &amp;quot;2.0&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;method&amp;quot;: &amp;quot;web3_sha3&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;params&amp;quot;: [&amp;quot;0x68656c6c6f20776f726c64&amp;quot;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ur&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xc94770007dda54cF92009BFF0dE90c06F603a09f&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;hr &#x2F;&gt;
&lt;h4 id=&quot;net-listening&quot;&gt;net_listening&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;description-2&quot;&gt;Description&lt;&#x2F;h5&gt;
&lt;p&gt;Determines if this client is listening for new network connections&lt;&#x2F;p&gt;
&lt;h5 id=&quot;parameters-2&quot;&gt;Parameters&lt;&#x2F;h5&gt;
&lt;p&gt;&lt;em&gt;(none)&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h5 id=&quot;returns-2&quot;&gt;Returns&lt;&#x2F;h5&gt;
&lt;p&gt;{&lt;code&gt;boolean&lt;&#x2F;code&gt;} - &lt;code&gt;true&lt;&#x2F;code&gt; if listening is active or &lt;code&gt;false&lt;&#x2F;code&gt; if listening is not active&lt;&#x2F;p&gt;
&lt;h5 id=&quot;example-2&quot;&gt;Example&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;-data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;id&amp;quot;: 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;jsonrpc&amp;quot;: &amp;quot;2.0&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;method&amp;quot;: &amp;quot;net_listening&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;params&amp;quot;: []&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ur&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;hr &#x2F;&gt;
&lt;h4 id=&quot;net-peercount&quot;&gt;net_peerCount&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;description-3&quot;&gt;Description&lt;&#x2F;h5&gt;
&lt;p&gt;Returns the number of peers currently connected to this client&lt;&#x2F;p&gt;
&lt;h5 id=&quot;parameters-3&quot;&gt;Parameters&lt;&#x2F;h5&gt;
&lt;p&gt;&lt;em&gt;(none)&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h5 id=&quot;returns-3&quot;&gt;Returns&lt;&#x2F;h5&gt;
&lt;p&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} - number of connected peers&lt;&#x2F;p&gt;
&lt;h5 id=&quot;example-3&quot;&gt;Example&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;-data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;id&amp;quot;: 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;jsonrpc&amp;quot;: &amp;quot;2.0&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;method&amp;quot;: &amp;quot;net_peerCount&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;params&amp;quot;: []&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ur&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x2&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;hr &#x2F;&gt;
&lt;h4 id=&quot;net-version&quot;&gt;net_version&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;description-4&quot;&gt;Description&lt;&#x2F;h5&gt;
&lt;p&gt;Returns the chain ID associated with the current network&lt;&#x2F;p&gt;
&lt;h5 id=&quot;parameters-4&quot;&gt;Parameters&lt;&#x2F;h5&gt;
&lt;p&gt;&lt;em&gt;(none)&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h5 id=&quot;returns-4&quot;&gt;Returns&lt;&#x2F;h5&gt;
&lt;p&gt;{&lt;code&gt;string&lt;&#x2F;code&gt;} - chain ID associated with the current network&lt;&#x2F;p&gt;
&lt;p&gt;Common chain IDs:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;&quot;1&quot;&lt;&#x2F;code&gt; -  Ethereum mainnet&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;&quot;3&quot;&lt;&#x2F;code&gt; - Ropsten testnet&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;&quot;4&quot;&lt;&#x2F;code&gt; - Rinkeby testnet&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;&quot;42&quot;&lt;&#x2F;code&gt; - Kovan testnet&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;&#x2F;strong&gt; See EIP-155 for a &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;#list-of-chain-id-s&quot;&gt;complete list&lt;&#x2F;a&gt; of possible chain IDs.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;example-4&quot;&gt;Example&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;-data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;id&amp;quot;: 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;jsonrpc&amp;quot;: &amp;quot;2.0&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;method&amp;quot;: &amp;quot;net_version&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;params&amp;quot;: []&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ur&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;3&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;hr &#x2F;&gt;
&lt;h4 id=&quot;eth-accounts&quot;&gt;eth_accounts&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;description-5&quot;&gt;Description&lt;&#x2F;h5&gt;
&lt;p&gt;Returns a list of addresses owned by this client&lt;&#x2F;p&gt;
&lt;h5 id=&quot;parameters-5&quot;&gt;Parameters&lt;&#x2F;h5&gt;
&lt;p&gt;&lt;em&gt;(none)&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h5 id=&quot;returns-5&quot;&gt;Returns&lt;&#x2F;h5&gt;
&lt;p&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data[]&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} - array of addresses&lt;&#x2F;p&gt;
&lt;h5 id=&quot;example-5&quot;&gt;Example&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;-data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;id&amp;quot;: 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;jsonrpc&amp;quot;: &amp;quot;2.0&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;method&amp;quot;: &amp;quot;eth_accounts&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;params&amp;quot;: []&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ur&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xc94770007dda54cF92009BFF0dE90c06F603a09f&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;hr &#x2F;&gt;
&lt;h4 id=&quot;eth-blocknumber&quot;&gt;eth_blockNumber&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;description-6&quot;&gt;Description&lt;&#x2F;h5&gt;
&lt;p&gt;Returns the number of the most recent block seen by this client&lt;&#x2F;p&gt;
&lt;h5 id=&quot;parameters-6&quot;&gt;Parameters&lt;&#x2F;h5&gt;
&lt;p&gt;&lt;em&gt;(none)&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h5 id=&quot;returns-6&quot;&gt;Returns&lt;&#x2F;h5&gt;
&lt;p&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} - number of the latest block&lt;&#x2F;p&gt;
&lt;h5 id=&quot;example-6&quot;&gt;Example&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;-data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;id&amp;quot;: 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;jsonrpc&amp;quot;: &amp;quot;2.0&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;method&amp;quot;: &amp;quot;eth_blockNumber&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;params&amp;quot;: []&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ur&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xc94&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;hr &#x2F;&gt;
&lt;h4 id=&quot;eth-call&quot;&gt;eth_call&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;description-7&quot;&gt;Description&lt;&#x2F;h5&gt;
&lt;p&gt;Executes a new message call immediately without submitting a transaction to the network&lt;&#x2F;p&gt;
&lt;h5 id=&quot;parameters-7&quot;&gt;Parameters&lt;&#x2F;h5&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;#&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;{&lt;code&gt;object&lt;&#x2F;code&gt;}&lt;&#x2F;td&gt;&lt;td&gt;@property {&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;[from]&lt;&#x2F;code&gt; - transaction sender&lt;br&#x2F;&gt;@property {&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;to&lt;&#x2F;code&gt; - transaction recipient or &lt;code&gt;null&lt;&#x2F;code&gt; if deploying a contract&lt;br&#x2F;&gt;@property {&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;[gas]&lt;&#x2F;code&gt; - gas provided for transaction execution&lt;br&#x2F;&gt;@property {&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;[gasPrice]&lt;&#x2F;code&gt; - price in wei of each gas used&lt;br&#x2F;&gt;@property {&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;[value]&lt;&#x2F;code&gt; - value in wei sent with this transaction&lt;br&#x2F;&gt;@property {&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;[data]&lt;&#x2F;code&gt; - contract code or a hashed method call with encoded args&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;|&lt;code&gt;string&lt;&#x2F;code&gt;|&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#block-identifier&quot;&gt;&lt;code&gt;Block Identifier&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;}&lt;&#x2F;td&gt;&lt;td&gt;block number, or one of &lt;code&gt;&quot;latest&quot;&lt;&#x2F;code&gt;, &lt;code&gt;&quot;earliest&quot;&lt;&#x2F;code&gt; or &lt;code&gt;&quot;pending&quot;&lt;&#x2F;code&gt;, or a block identifier as described in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#block-identifier&quot;&gt;&lt;code&gt;Block Identifier&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h5 id=&quot;returns-7&quot;&gt;Returns&lt;&#x2F;h5&gt;
&lt;p&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} - return value of executed contract&lt;&#x2F;p&gt;
&lt;h5 id=&quot;example-7&quot;&gt;Example&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;-data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;id&amp;quot;: 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;jsonrpc&amp;quot;: &amp;quot;2.0&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;method&amp;quot;: &amp;quot;eth_call&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;params&amp;quot;: [{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        &amp;quot;data&amp;quot;: &amp;quot;0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        &amp;quot;from&amp;quot;: &amp;quot;0xb60e8dd61c5d32be8058bb8eb970870f07233155&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        &amp;quot;gas&amp;quot;: &amp;quot;0x76c0&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        &amp;quot;gasPrice&amp;quot;: &amp;quot;0x9184e72a000&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        &amp;quot;to&amp;quot;: &amp;quot;0xd46e8dd67c5d32be8058bb8eb970870f07244567&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        &amp;quot;value&amp;quot;: &amp;quot;0x9184e72a&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    }]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ur&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;hr &#x2F;&gt;
&lt;h4 id=&quot;eth-coinbase&quot;&gt;eth_coinbase&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;description-8&quot;&gt;Description&lt;&#x2F;h5&gt;
&lt;p&gt;Returns the coinbase address for this client&lt;&#x2F;p&gt;
&lt;h5 id=&quot;parameters-8&quot;&gt;Parameters&lt;&#x2F;h5&gt;
&lt;p&gt;&lt;em&gt;(none)&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h5 id=&quot;returns-8&quot;&gt;Returns&lt;&#x2F;h5&gt;
&lt;p&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} - coinbase address&lt;&#x2F;p&gt;
&lt;h5 id=&quot;example-8&quot;&gt;Example&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;-data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;id&amp;quot;: 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;jsonrpc&amp;quot;: &amp;quot;2.0&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;method&amp;quot;: &amp;quot;eth_coinbase&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;params&amp;quot;: []&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ur&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xc94770007dda54cF92009BFF0dE90c06F603a09f&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;hr &#x2F;&gt;
&lt;h4 id=&quot;eth-estimategas&quot;&gt;eth_estimateGas&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;description-9&quot;&gt;Description&lt;&#x2F;h5&gt;
&lt;p&gt;Estimates the gas necessary to complete a transaction without submitting it to the network&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;&#x2F;strong&gt; The resulting gas estimation may be significantly more than the amount of gas actually used by the transaction. This is due to a variety of reasons including EVM mechanics and node performance.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;parameters-9&quot;&gt;Parameters&lt;&#x2F;h5&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;#&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;{&lt;code&gt;object&lt;&#x2F;code&gt;}&lt;&#x2F;td&gt;&lt;td&gt;@property {&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;[from]&lt;&#x2F;code&gt; - transaction sender&lt;br&#x2F;&gt;@property {&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;[to]&lt;&#x2F;code&gt; - transaction recipient&lt;br&#x2F;&gt;@property {&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;[gas]&lt;&#x2F;code&gt; - gas provided for transaction execution&lt;br&#x2F;&gt;@property {&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;[gasPrice]&lt;&#x2F;code&gt; - price in wei of each gas used&lt;br&#x2F;&gt;@property {&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;[value]&lt;&#x2F;code&gt; - value in wei sent with this transaction&lt;br&#x2F;&gt;@property {&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;[data]&lt;&#x2F;code&gt; - contract code or a hashed method call with encoded args&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;|&lt;code&gt;string&lt;&#x2F;code&gt;}&lt;&#x2F;td&gt;&lt;td&gt;block number, or one of &lt;code&gt;&quot;latest&quot;&lt;&#x2F;code&gt;, &lt;code&gt;&quot;earliest&quot;&lt;&#x2F;code&gt; or &lt;code&gt;&quot;pending&quot;&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h5 id=&quot;returns-9&quot;&gt;Returns&lt;&#x2F;h5&gt;
&lt;p&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} - amount of gas required by transaction&lt;&#x2F;p&gt;
&lt;h5 id=&quot;example-9&quot;&gt;Example&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;-data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;id&amp;quot;: 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;jsonrpc&amp;quot;: &amp;quot;2.0&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;method&amp;quot;: &amp;quot;eth_estimateGas&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;params&amp;quot;: [{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        &amp;quot;data&amp;quot;: &amp;quot;0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        &amp;quot;from&amp;quot;: &amp;quot;0xb60e8dd61c5d32be8058bb8eb970870f07233155&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        &amp;quot;gas&amp;quot;: &amp;quot;0x76c0&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        &amp;quot;gasPrice&amp;quot;: &amp;quot;0x9184e72a000&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        &amp;quot;to&amp;quot;: &amp;quot;0xd46e8dd67c5d32be8058bb8eb970870f07244567&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        &amp;quot;value&amp;quot;: &amp;quot;0x9184e72a&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    }]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ur&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x5208&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;hr &#x2F;&gt;
&lt;h4 id=&quot;eth-gasprice&quot;&gt;eth_gasPrice&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;description-10&quot;&gt;Description&lt;&#x2F;h5&gt;
&lt;p&gt;Returns the current price of gas expressed in wei&lt;&#x2F;p&gt;
&lt;h5 id=&quot;parameters-10&quot;&gt;Parameters&lt;&#x2F;h5&gt;
&lt;p&gt;&lt;em&gt;(none)&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h5 id=&quot;returns-10&quot;&gt;Returns&lt;&#x2F;h5&gt;
&lt;p&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} - current gas price in wei&lt;&#x2F;p&gt;
&lt;h5 id=&quot;example-10&quot;&gt;Example&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;-data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;id&amp;quot;: 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;jsonrpc&amp;quot;: &amp;quot;2.0&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;method&amp;quot;: &amp;quot;eth_gasPrice&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;params&amp;quot;: []&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ur&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x09184e72a000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;hr &#x2F;&gt;
&lt;h4 id=&quot;eth-getbalance&quot;&gt;eth_getBalance&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;description-11&quot;&gt;Description&lt;&#x2F;h5&gt;
&lt;p&gt;Returns the balance of an address in wei&lt;&#x2F;p&gt;
&lt;h5 id=&quot;parameters-11&quot;&gt;Parameters&lt;&#x2F;h5&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;#&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;}&lt;&#x2F;td&gt;&lt;td&gt;address to query for balance&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;|&lt;code&gt;string&lt;&#x2F;code&gt;|&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#block-identifier&quot;&gt;&lt;code&gt;Block Identifier&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;}&lt;&#x2F;td&gt;&lt;td&gt;block number, or one of &lt;code&gt;&quot;latest&quot;&lt;&#x2F;code&gt;, &lt;code&gt;&quot;earliest&quot;&lt;&#x2F;code&gt; or &lt;code&gt;&quot;pending&quot;&lt;&#x2F;code&gt;, or a block identifier as described in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#block-identifier&quot;&gt;&lt;code&gt;Block Identifier&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h5 id=&quot;returns-11&quot;&gt;Returns&lt;&#x2F;h5&gt;
&lt;p&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} - balance of the provided account in wei&lt;&#x2F;p&gt;
&lt;h5 id=&quot;example-11&quot;&gt;Example&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;-data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;id&amp;quot;: 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;jsonrpc&amp;quot;: &amp;quot;2.0&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;method&amp;quot;: &amp;quot;eth_getBalance&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;params&amp;quot;: [&amp;quot;0xc94770007dda54cF92009BFF0dE90c06F603a09f&amp;quot;, &amp;quot;latest&amp;quot;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ur&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0234c8a3397aab58&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;hr &#x2F;&gt;
&lt;h4 id=&quot;eth-getblockbyhash&quot;&gt;eth_getBlockByHash&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;description-12&quot;&gt;Description&lt;&#x2F;h5&gt;
&lt;p&gt;Returns information about a block specified by hash&lt;&#x2F;p&gt;
&lt;h5 id=&quot;parameters-12&quot;&gt;Parameters&lt;&#x2F;h5&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;#&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;}&lt;&#x2F;td&gt;&lt;td&gt;hash of a block&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;{&lt;code&gt;boolean&lt;&#x2F;code&gt;}&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;true&lt;&#x2F;code&gt; will pull full transaction objects, &lt;code&gt;false&lt;&#x2F;code&gt; will pull transaction hashes&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h5 id=&quot;returns-12&quot;&gt;Returns&lt;&#x2F;h5&gt;
&lt;p&gt;{&lt;code&gt;null|object&lt;&#x2F;code&gt;} - &lt;code&gt;null&lt;&#x2F;code&gt; if no block is found, otherwise a block object with the following members:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;extraData&lt;&#x2F;code&gt; - &quot;extra data&quot; field of this block&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;hash&lt;&#x2F;code&gt; - block hash or &lt;code&gt;null&lt;&#x2F;code&gt; if pending&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;logsBloom&lt;&#x2F;code&gt; - logs bloom filter or &lt;code&gt;null&lt;&#x2F;code&gt; if pending&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;miner&lt;&#x2F;code&gt; - address that received this block&#x27;s mining rewards&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;nonce&lt;&#x2F;code&gt; - proof-of-work hash or &lt;code&gt;null&lt;&#x2F;code&gt; if pending&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;parentHash&lt;&#x2F;code&gt; - parent block hash&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;receiptsRoot&lt;&#x2F;code&gt; -root of this block&#x27;s receipts trie&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;sha3Uncles&lt;&#x2F;code&gt; - SHA3 of the uncles data in this block&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;stateRoot&lt;&#x2F;code&gt; - root of this block&#x27;s final state trie&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;transactionsRoot&lt;&#x2F;code&gt; - root of this block&#x27;s transaction trie&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;difficulty&lt;&#x2F;code&gt; - difficulty for this block&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;gasLimit&lt;&#x2F;code&gt; - maximum gas allowed in this block&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;gasUsed&lt;&#x2F;code&gt; - total used gas by all transactions in this block&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;number&lt;&#x2F;code&gt; - block number or &lt;code&gt;null&lt;&#x2F;code&gt; if pending&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;size&lt;&#x2F;code&gt; - size of this block in bytes&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;timestamp&lt;&#x2F;code&gt; - unix timestamp of when this block was collated&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;totalDifficulty&lt;&#x2F;code&gt; - total difficulty of the chain until this block&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;code&gt;Array&amp;lt;Transaction&amp;gt;&lt;&#x2F;code&gt;} &lt;code&gt;transactions&lt;&#x2F;code&gt; - list of transaction objects or hashes&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;code&gt;Array&amp;lt;Transaction&amp;gt;&lt;&#x2F;code&gt;} &lt;code&gt;uncles&lt;&#x2F;code&gt; - list of uncle hashes&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;example-12&quot;&gt;Example&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;-data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;id&amp;quot;: 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;jsonrpc&amp;quot;: &amp;quot;2.0&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;method&amp;quot;: &amp;quot;eth_getBlockByHash&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;params&amp;quot;:[&amp;quot;0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331&amp;quot;, true]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ur&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;difficulty&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x027f07&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;extraData&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gasLimit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x9f759&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gasUsed&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x9f759&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;logsBloom&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;miner&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x4e65fda2159562a496f9f3522f89122a3088497a&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xe04d296d2460cfb8472af2c5fd05b5a214109c25688d3704aed5484f9a7792f2&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1b4&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;parentHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x9646252be9520f6e71339a8df9c55e4d7619deeb018d2a3f2d21fc165dde5eb5&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;sha3Uncles&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;size&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x027f07&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;stateRoot&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xd5855eb08b3387c0af375e9cdb6acfc05eb8f519e419b874b6ff2ffda7ed1dff&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;timestamp&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x54e34e8e&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;totalDifficulty&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x027f07&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transactions&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transactionsRoot&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;uncles&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1606e5...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xd5145a9...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;hr &#x2F;&gt;
&lt;h4 id=&quot;eth-getblockbynumber&quot;&gt;eth_getBlockByNumber&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;description-13&quot;&gt;Description&lt;&#x2F;h5&gt;
&lt;p&gt;Returns information about a block specified by number&lt;&#x2F;p&gt;
&lt;h5 id=&quot;parameters-13&quot;&gt;Parameters&lt;&#x2F;h5&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;#&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;|&lt;code&gt;string&lt;&#x2F;code&gt;}&lt;&#x2F;td&gt;&lt;td&gt;block number, or one of &lt;code&gt;&quot;latest&quot;&lt;&#x2F;code&gt;, &lt;code&gt;&quot;earliest&quot;&lt;&#x2F;code&gt; or &lt;code&gt;&quot;pending&quot;&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;{&lt;code&gt;boolean&lt;&#x2F;code&gt;}&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;true&lt;&#x2F;code&gt; will pull full transaction objects, &lt;code&gt;false&lt;&#x2F;code&gt; will pull transaction hashes&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h5 id=&quot;returns-13&quot;&gt;Returns&lt;&#x2F;h5&gt;
&lt;p&gt;{&lt;code&gt;null|object&lt;&#x2F;code&gt;} - &lt;code&gt;null&lt;&#x2F;code&gt; if no block is found, otherwise a block object with the following members:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;extraData&lt;&#x2F;code&gt; - &quot;extra data&quot; field of this block&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;hash&lt;&#x2F;code&gt; - block hash or &lt;code&gt;null&lt;&#x2F;code&gt; if pending&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;logsBloom&lt;&#x2F;code&gt; - logs bloom filter or &lt;code&gt;null&lt;&#x2F;code&gt; if pending&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;miner&lt;&#x2F;code&gt; - address that received this block&#x27;s mining rewards&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;nonce&lt;&#x2F;code&gt; - proof-of-work hash or &lt;code&gt;null&lt;&#x2F;code&gt; if pending&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;parentHash&lt;&#x2F;code&gt; - parent block hash&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;receiptsRoot&lt;&#x2F;code&gt; -root of this block&#x27;s receipts trie&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;sha3Uncles&lt;&#x2F;code&gt; - SHA3 of the uncles data in this block&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;stateRoot&lt;&#x2F;code&gt; - root of this block&#x27;s final state trie&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;transactionsRoot&lt;&#x2F;code&gt; - root of this block&#x27;s transaction trie&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;difficulty&lt;&#x2F;code&gt; - difficulty for this block&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;gasLimit&lt;&#x2F;code&gt; - maximum gas allowed in this block&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;gasUsed&lt;&#x2F;code&gt; - total used gas by all transactions in this block&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;number&lt;&#x2F;code&gt; - block number or &lt;code&gt;null&lt;&#x2F;code&gt; if pending&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;size&lt;&#x2F;code&gt; - size of this block in bytes&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;timestamp&lt;&#x2F;code&gt; - unix timestamp of when this block was collated&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;totalDifficulty&lt;&#x2F;code&gt; - total difficulty of the chain until this block&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;code&gt;Array&amp;lt;Transaction&amp;gt;&lt;&#x2F;code&gt;} &lt;code&gt;transactions&lt;&#x2F;code&gt; - list of transaction objects or hashes&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;code&gt;Array&amp;lt;Transaction&amp;gt;&lt;&#x2F;code&gt;} &lt;code&gt;uncles&lt;&#x2F;code&gt; - list of uncle hashes&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;example-13&quot;&gt;Example&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;-data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;id&amp;quot;: 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;jsonrpc&amp;quot;: &amp;quot;2.0&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;method&amp;quot;: &amp;quot;eth_getBlockByNumber&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;params&amp;quot;:[&amp;quot;0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331&amp;quot;, true]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ur&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;difficulty&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x027f07&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;extraData&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gasLimit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x9f759&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gasUsed&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x9f759&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;logsBloom&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;miner&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x4e65fda2159562a496f9f3522f89122a3088497a&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xe04d296d2460cfb8472af2c5fd05b5a214109c25688d3704aed5484f9a7792f2&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1b4&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;parentHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x9646252be9520f6e71339a8df9c55e4d7619deeb018d2a3f2d21fc165dde5eb5&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;sha3Uncles&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;size&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x027f07&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;stateRoot&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xd5855eb08b3387c0af375e9cdb6acfc05eb8f519e419b874b6ff2ffda7ed1dff&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;timestamp&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x54e34e8e&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;totalDifficulty&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x027f07&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transactions&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transactionsRoot&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;uncles&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1606e5...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xd5145a9...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;hr &#x2F;&gt;
&lt;h4 id=&quot;eth-getblocktransactioncountbyhash&quot;&gt;eth_getBlockTransactionCountByHash&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;description-14&quot;&gt;Description&lt;&#x2F;h5&gt;
&lt;p&gt;Returns the number of transactions in a block specified by block hash&lt;&#x2F;p&gt;
&lt;h5 id=&quot;parameters-14&quot;&gt;Parameters&lt;&#x2F;h5&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;#&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;}&lt;&#x2F;td&gt;&lt;td&gt;hash of a block&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h5 id=&quot;returns-14&quot;&gt;Returns&lt;&#x2F;h5&gt;
&lt;p&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} - number of transactions in the specified block&lt;&#x2F;p&gt;
&lt;h5 id=&quot;example-14&quot;&gt;Example&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;-data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;id&amp;quot;: 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;jsonrpc&amp;quot;: &amp;quot;2.0&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;method&amp;quot;: &amp;quot;eth_getBlockTransactionCountByHash&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;params&amp;quot;: [&amp;quot;0xc94770007dda54cF92009BFF0dE90c06F603a09f&amp;quot;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ur&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xc&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;hr &#x2F;&gt;
&lt;h4 id=&quot;eth-getblocktransactioncountbynumber&quot;&gt;eth_getBlockTransactionCountByNumber&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;description-15&quot;&gt;Description&lt;&#x2F;h5&gt;
&lt;p&gt;Returns the number of transactions in a block specified by block number&lt;&#x2F;p&gt;
&lt;h5 id=&quot;parameters-15&quot;&gt;Parameters&lt;&#x2F;h5&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;#&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;|&lt;code&gt;string&lt;&#x2F;code&gt;}&lt;&#x2F;td&gt;&lt;td&gt;block number, or one of &lt;code&gt;&quot;latest&quot;&lt;&#x2F;code&gt;, &lt;code&gt;&quot;earliest&quot;&lt;&#x2F;code&gt; or &lt;code&gt;&quot;pending&quot;&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h5 id=&quot;returns-15&quot;&gt;Returns&lt;&#x2F;h5&gt;
&lt;p&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} - number of transactions in the specified block&lt;&#x2F;p&gt;
&lt;h5 id=&quot;example-15&quot;&gt;Example&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;-data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;id&amp;quot;: 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;jsonrpc&amp;quot;: &amp;quot;2.0&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;method&amp;quot;: &amp;quot;eth_getBlockTransactionCountByNumber&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;params&amp;quot;: [&amp;quot;0xe8&amp;quot;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ur&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xa&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;hr &#x2F;&gt;
&lt;h4 id=&quot;eth-getcode&quot;&gt;eth_getCode&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;description-16&quot;&gt;Description&lt;&#x2F;h5&gt;
&lt;p&gt;Returns the contract code stored at a given address&lt;&#x2F;p&gt;
&lt;h5 id=&quot;parameters-16&quot;&gt;Parameters&lt;&#x2F;h5&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;#&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;}&lt;&#x2F;td&gt;&lt;td&gt;address to query for code&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;|&lt;code&gt;string&lt;&#x2F;code&gt;|&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#block-identifier&quot;&gt;&lt;code&gt;Block Identifier&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;}&lt;&#x2F;td&gt;&lt;td&gt;block number, or one of &lt;code&gt;&quot;latest&quot;&lt;&#x2F;code&gt;, &lt;code&gt;&quot;earliest&quot;&lt;&#x2F;code&gt; or &lt;code&gt;&quot;pending&quot;&lt;&#x2F;code&gt;, or a block identifier as described in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#block-identifier&quot;&gt;&lt;code&gt;Block Identifier&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h5 id=&quot;returns-16&quot;&gt;Returns&lt;&#x2F;h5&gt;
&lt;p&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} - code from the specified address&lt;&#x2F;p&gt;
&lt;h5 id=&quot;example-16&quot;&gt;Example&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;-data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;id&amp;quot;: 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;jsonrpc&amp;quot;: &amp;quot;2.0&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;method&amp;quot;: &amp;quot;eth_getCode&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;params&amp;quot;: [&amp;quot;0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b&amp;quot;, &amp;quot;0x2&amp;quot;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ur&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x600160008035811a818181146012578301005b601b6001356025565b8060005260206000f25b600060078202905091905056&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;hr &#x2F;&gt;
&lt;h4 id=&quot;eth-getfilterchanges&quot;&gt;eth_getFilterChanges&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;description-17&quot;&gt;Description&lt;&#x2F;h5&gt;
&lt;p&gt;Returns a list of all logs based on filter ID since the last log retrieval&lt;&#x2F;p&gt;
&lt;h5 id=&quot;parameters-17&quot;&gt;Parameters&lt;&#x2F;h5&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;#&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;}&lt;&#x2F;td&gt;&lt;td&gt;ID of the filter&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h5 id=&quot;returns-17&quot;&gt;Returns&lt;&#x2F;h5&gt;
&lt;p&gt;{&lt;code&gt;Array&amp;lt;Log&amp;gt;&lt;&#x2F;code&gt;} - array of log objects with the following members:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;address&lt;&#x2F;code&gt; - address from which this log originated&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;blockHash&lt;&#x2F;code&gt; - hash of block containing this log or &lt;code&gt;null&lt;&#x2F;code&gt; if pending&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;data&lt;&#x2F;code&gt; - contains the non-indexed arguments of the log&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;transactionHash&lt;&#x2F;code&gt; - hash of the transaction that created this log or &lt;code&gt;null&lt;&#x2F;code&gt; if pending&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;blockNumber&lt;&#x2F;code&gt; - number of block containing this log or &lt;code&gt;null&lt;&#x2F;code&gt; if pending&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;logIndex&lt;&#x2F;code&gt; - index of this log within its block or &lt;code&gt;null&lt;&#x2F;code&gt; if pending&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;transactionIndex&lt;&#x2F;code&gt; - index of the transaction that created this log or &lt;code&gt;null&lt;&#x2F;code&gt; if pending&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data[]&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;topics&lt;&#x2F;code&gt; - list of order-dependent topics&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;code&gt;boolean&lt;&#x2F;code&gt;} &lt;code&gt;removed&lt;&#x2F;code&gt; - &lt;code&gt;true&lt;&#x2F;code&gt; if this filter has been destroyed and is invalid&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;&#x2F;strong&gt; The return value of &lt;code&gt;eth_getFilterChanges&lt;&#x2F;code&gt; when retrieving logs from &lt;code&gt;eth_newBlockFilter&lt;&#x2F;code&gt; and &lt;code&gt;eth_newPendingTransactionFilter&lt;&#x2F;code&gt; filters will be an array of hashes, not an array of Log objects.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;example-17&quot;&gt;Example&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;-data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;id&amp;quot;: 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;jsonrpc&amp;quot;: &amp;quot;2.0&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;method&amp;quot;: &amp;quot;eth_getFilterChanges&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;params&amp;quot;: [&amp;quot;0x16&amp;quot;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ur&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;   &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;   &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x16c5785ac562ff41e2dcfdf829c5a142f1fccd7d&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;blockHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x8216c5785ac562ff41e2dcfdf5785ac562ff41e2dcfdf829c5a142f1fccd7d&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;blockNumber&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x1b4&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;logIndex&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;topics&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;],&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transactionHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xdf829c5a142f1fccd7d8216c5785ac562ff41e2dcfdf5785ac562ff41e2dcf&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transactionIndex&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   }&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;hr &#x2F;&gt;
&lt;h4 id=&quot;eth-getfilterlogs&quot;&gt;eth_getFilterLogs&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;description-18&quot;&gt;Description&lt;&#x2F;h5&gt;
&lt;p&gt;Returns a list of all logs based on filter ID&lt;&#x2F;p&gt;
&lt;h5 id=&quot;parameters-18&quot;&gt;Parameters&lt;&#x2F;h5&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;#&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;}&lt;&#x2F;td&gt;&lt;td&gt;ID of the filter&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h5 id=&quot;returns-18&quot;&gt;Returns&lt;&#x2F;h5&gt;
&lt;p&gt;{&lt;code&gt;Array&amp;lt;Log&amp;gt;&lt;&#x2F;code&gt;} - array of log objects with the following members:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} address - address from which this log originated&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} blockHash - hash of block containing this log or &lt;code&gt;null&lt;&#x2F;code&gt; if pending&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} data - contains the non-indexed arguments of the log&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} transactionHash - hash of the transaction that created this log or &lt;code&gt;null&lt;&#x2F;code&gt; if pending&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} blockNumber - number of block containing this log or &lt;code&gt;null&lt;&#x2F;code&gt; if pending&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} logIndex - index of this log within its block or &lt;code&gt;null&lt;&#x2F;code&gt; if pending&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} transactionIndex - index of the transaction that created this log or &lt;code&gt;null&lt;&#x2F;code&gt; if pending&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;code&gt;Array&amp;lt;Data&amp;gt;&lt;&#x2F;code&gt;} topics - list of order-dependent topics&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;code&gt;boolean&lt;&#x2F;code&gt;} removed - &lt;code&gt;true&lt;&#x2F;code&gt; if this filter has been destroyed and is invalid&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;&#x2F;strong&gt; The return value of &lt;code&gt;eth_getFilterLogs&lt;&#x2F;code&gt; when retrieving logs from &lt;code&gt;eth_newBlockFilter&lt;&#x2F;code&gt; and &lt;code&gt;eth_newPendingTransactionFilter&lt;&#x2F;code&gt; filters will be an array of hashes, not an array of Log objects.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;example-18&quot;&gt;Example&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;-data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;id&amp;quot;: 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;jsonrpc&amp;quot;: &amp;quot;2.0&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;method&amp;quot;: &amp;quot;eth_getFilterLogs&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;params&amp;quot;: [&amp;quot;0x16&amp;quot;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ur&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;   &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;   &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x16c5785ac562ff41e2dcfdf829c5a142f1fccd7d&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;blockHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x8216c5785ac562ff41e2dcfdf5785ac562ff41e2dcfdf829c5a142f1fccd7d&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;blockNumber&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x1b4&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;logIndex&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;topics&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;],&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transactionHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xdf829c5a142f1fccd7d8216c5785ac562ff41e2dcfdf5785ac562ff41e2dcf&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transactionIndex&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   }&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;hr &#x2F;&gt;
&lt;h4 id=&quot;eth-getlogs&quot;&gt;eth_getLogs&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;description-19&quot;&gt;Description&lt;&#x2F;h5&gt;
&lt;p&gt;Returns a list of all logs based on a filter object&lt;&#x2F;p&gt;
&lt;h5 id=&quot;parameters-19&quot;&gt;Parameters&lt;&#x2F;h5&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;#&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;{&lt;code&gt;object&lt;&#x2F;code&gt;}&lt;&#x2F;td&gt;&lt;td&gt;@property {&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;|&lt;code&gt;string&lt;&#x2F;code&gt;} &lt;code&gt;[fromBlock]&lt;&#x2F;code&gt; - block number, or one of &lt;code&gt;&quot;latest&quot;&lt;&#x2F;code&gt;, &lt;code&gt;&quot;earliest&quot;&lt;&#x2F;code&gt; or &lt;code&gt;&quot;pending&quot;&lt;&#x2F;code&gt;&lt;br&#x2F;&gt;@property {&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;|&lt;code&gt;string&lt;&#x2F;code&gt;} &lt;code&gt;[toBlock]&lt;&#x2F;code&gt; - block number, or one of &lt;code&gt;&quot;latest&quot;&lt;&#x2F;code&gt;, &lt;code&gt;&quot;earliest&quot;&lt;&#x2F;code&gt; or &lt;code&gt;&quot;pending&quot;&lt;&#x2F;code&gt;&lt;br&#x2F;&gt;@property {&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;|&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data[]&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;[address]&lt;&#x2F;code&gt; - contract address or a list of addresses from which logs should originate&lt;br&#x2F;&gt;@property {&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data[]&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;[topics]&lt;&#x2F;code&gt; - list of order-dependent topics&lt;br&#x2F;&gt;@property {&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;[blockhash]&lt;&#x2F;code&gt; - restrict logs to a block by hash&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;&#x2F;strong&gt; If &lt;code&gt;blockhash&lt;&#x2F;code&gt; is passed, neither &lt;code&gt;fromBlock&lt;&#x2F;code&gt; nor &lt;code&gt;toBlock&lt;&#x2F;code&gt; are allowed or respected.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;returns-19&quot;&gt;Returns&lt;&#x2F;h5&gt;
&lt;p&gt;{&lt;code&gt;Array&amp;lt;Log&amp;gt;&lt;&#x2F;code&gt;} - array of log objects with the following members:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;address&lt;&#x2F;code&gt; - address from which this log originated&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;blockHash&lt;&#x2F;code&gt; - hash of block containing this log or &lt;code&gt;null&lt;&#x2F;code&gt; if pending&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;data&lt;&#x2F;code&gt; - contains the non-indexed arguments of the log&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;transactionHash&lt;&#x2F;code&gt; - hash of the transaction that created this log or &lt;code&gt;null&lt;&#x2F;code&gt; if pending&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;blockNumber&lt;&#x2F;code&gt; - number of block containing this log or &lt;code&gt;null&lt;&#x2F;code&gt; if pending&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;logIndex&lt;&#x2F;code&gt; - index of this log within its block or &lt;code&gt;null&lt;&#x2F;code&gt; if pending&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;transactionIndex&lt;&#x2F;code&gt; - index of the transaction that created this log or &lt;code&gt;null&lt;&#x2F;code&gt; if pending&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;topics&lt;&#x2F;code&gt; - list of order-dependent topics&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;code&gt;boolean&lt;&#x2F;code&gt;} &lt;code&gt;removed&lt;&#x2F;code&gt; - &lt;code&gt;true&lt;&#x2F;code&gt; if this filter has been destroyed and is invalid&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;example-19&quot;&gt;Example&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;-data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;id&amp;quot;: 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;jsonrpc&amp;quot;: &amp;quot;2.0&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;method&amp;quot;: &amp;quot;eth_getLogs&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;params&amp;quot;: [{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        &amp;quot;topics&amp;quot;:[&amp;quot;0x000000000000000000000000a94f5374fce5edbc8e2a8697c15331677e6ebf0b&amp;quot;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    }]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ur&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;   &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;   &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x16c5785ac562ff41e2dcfdf829c5a142f1fccd7d&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;blockHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x8216c5785ac562ff41e2dcfdf5785ac562ff41e2dcfdf829c5a142f1fccd7d&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;blockNumber&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x1b4&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;logIndex&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;topics&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;],&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transactionHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xdf829c5a142f1fccd7d8216c5785ac562ff41e2dcfdf5785ac562ff41e2dcf&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transactionIndex&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   }&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;hr &#x2F;&gt;
&lt;h4 id=&quot;eth-getstorageat&quot;&gt;eth_getStorageAt&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;description-20&quot;&gt;Description&lt;&#x2F;h5&gt;
&lt;p&gt;Returns the value from a storage position at an address&lt;&#x2F;p&gt;
&lt;h5 id=&quot;parameters-20&quot;&gt;Parameters&lt;&#x2F;h5&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;#&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;}&lt;&#x2F;td&gt;&lt;td&gt;address of stored data&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;}&lt;&#x2F;td&gt;&lt;td&gt;index into stored data&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;|&lt;code&gt;string&lt;&#x2F;code&gt;|&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#block-identifier&quot;&gt;&lt;code&gt;Block Identifier&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;}&lt;&#x2F;td&gt;&lt;td&gt;block number, or one of &lt;code&gt;&quot;latest&quot;&lt;&#x2F;code&gt;, &lt;code&gt;&quot;earliest&quot;&lt;&#x2F;code&gt; or &lt;code&gt;&quot;pending&quot;&lt;&#x2F;code&gt;, or a block identifier as described in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#block-identifier&quot;&gt;&lt;code&gt;Block Identifier&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h5 id=&quot;returns-20&quot;&gt;Returns&lt;&#x2F;h5&gt;
&lt;p&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} - value stored at the given address and data index&lt;&#x2F;p&gt;
&lt;h5 id=&quot;example-20&quot;&gt;Example&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;-data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;id&amp;quot;: 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;jsonrpc&amp;quot;: &amp;quot;2.0&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;method&amp;quot;: &amp;quot;eth_getStorageAt&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;params&amp;quot;: [&amp;quot;0x295a70b2de5e3953354a6a8344e616ed314d7251&amp;quot;, &amp;quot;0x0&amp;quot;, &amp;quot;latest&amp;quot;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ur&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x00000000000000000000000000000000000000000000000000000000000004d2&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;hr &#x2F;&gt;
&lt;h4 id=&quot;eth-gettransactionbyblockhashandindex&quot;&gt;eth_getTransactionByBlockHashAndIndex&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;description-21&quot;&gt;Description&lt;&#x2F;h5&gt;
&lt;p&gt;Returns information about a transaction specified by block hash and transaction index&lt;&#x2F;p&gt;
&lt;h5 id=&quot;parameters-21&quot;&gt;Parameters&lt;&#x2F;h5&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;#&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;}&lt;&#x2F;td&gt;&lt;td&gt;hash of a block&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;}&lt;&#x2F;td&gt;&lt;td&gt;index of a transaction in the specified block&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h5 id=&quot;returns-21&quot;&gt;Returns&lt;&#x2F;h5&gt;
&lt;p&gt;{&lt;code&gt;null|object&lt;&#x2F;code&gt;} - &lt;code&gt;null&lt;&#x2F;code&gt; if no transaction is found, otherwise a transaction object with the following members:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;r&lt;&#x2F;code&gt; - ECDSA signature r&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;s&lt;&#x2F;code&gt; - ECDSA signature s&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;blockHash&lt;&#x2F;code&gt; - hash of block containing this transaction or &lt;code&gt;null&lt;&#x2F;code&gt; if pending&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;from&lt;&#x2F;code&gt; - transaction sender&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;hash&lt;&#x2F;code&gt; - hash of this transaction&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;input&lt;&#x2F;code&gt; - contract code or a hashed method call&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;to&lt;&#x2F;code&gt; - transaction recipient or &lt;code&gt;null&lt;&#x2F;code&gt; if deploying a contract&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;v&lt;&#x2F;code&gt; - ECDSA recovery ID&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;blockNumber&lt;&#x2F;code&gt; - number of block containing this transaction or &lt;code&gt;null&lt;&#x2F;code&gt; if pending&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;gas&lt;&#x2F;code&gt; - gas provided for transaction execution&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;gasPrice&lt;&#x2F;code&gt; - price in wei of each gas used&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;nonce&lt;&#x2F;code&gt; - unique number identifying this transaction&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;transactionIndex&lt;&#x2F;code&gt; - index of this transaction in the block or &lt;code&gt;null&lt;&#x2F;code&gt; if pending&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;value&lt;&#x2F;code&gt; - value in wei sent with this transaction&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;example-21&quot;&gt;Example&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;-data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;id&amp;quot;: 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;jsonrpc&amp;quot;: &amp;quot;2.0&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;method&amp;quot;: &amp;quot;eth_getTransactionByBlockHashAndIndex&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;params&amp;quot;:[&amp;quot;0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331&amp;quot;, &amp;quot;0x0&amp;quot;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ur&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;blockHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1d59ff54b1eb26b013ce3cb5fc9dab3705b415a67127a003c3e61eb445bb8df2&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;blockNumber&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x5daf3b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;from&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xa7d9ddbe1f17865597fbd27ec712455208b6b76d&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xc350&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gasPrice&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x4a817c800&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x88df016429689c079f3b2f6ad39fa052532c56795b733da78a91ebe6a713944b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;input&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x68656c6c6f21&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x15&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1b5e176d927f8e9ab405058b2d2457392da3e20f328b16ddabcebc33eaac5fea&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x4ba69724e8f69de52f0125ad8b3c5c2cef33019bac3249e2c0a2192766d1721c&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xf02c1c8e6114b1dbe8937a39260b5b0a374432bb&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transactionIndex&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x41&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;v&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x25&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xf3dbb76162000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;hr &#x2F;&gt;
&lt;h4 id=&quot;eth-gettransactionbyblocknumberandindex&quot;&gt;eth_getTransactionByBlockNumberAndIndex&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;description-22&quot;&gt;Description&lt;&#x2F;h5&gt;
&lt;p&gt;Returns information about a transaction specified by block number and transaction index&lt;&#x2F;p&gt;
&lt;h5 id=&quot;parameters-22&quot;&gt;Parameters&lt;&#x2F;h5&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;#&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;|&lt;code&gt;string&lt;&#x2F;code&gt;}&lt;&#x2F;td&gt;&lt;td&gt;block number, or one of &lt;code&gt;&quot;latest&quot;&lt;&#x2F;code&gt;, &lt;code&gt;&quot;earliest&quot;&lt;&#x2F;code&gt; or &lt;code&gt;&quot;pending&quot;&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;}&lt;&#x2F;td&gt;&lt;td&gt;index of a transaction in the specified block&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h5 id=&quot;returns-22&quot;&gt;Returns&lt;&#x2F;h5&gt;
&lt;p&gt;{&lt;code&gt;null|object&lt;&#x2F;code&gt;} - &lt;code&gt;null&lt;&#x2F;code&gt; if no transaction is found, otherwise a transaction object with the following members:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;r&lt;&#x2F;code&gt; - ECDSA signature r&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;s&lt;&#x2F;code&gt; - ECDSA signature s&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;blockHash&lt;&#x2F;code&gt; - hash of block containing this transaction or &lt;code&gt;null&lt;&#x2F;code&gt; if pending&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;from&lt;&#x2F;code&gt; - transaction sender&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;hash&lt;&#x2F;code&gt; - hash of this transaction&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;input&lt;&#x2F;code&gt; - contract code or a hashed method call&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;to&lt;&#x2F;code&gt; - transaction recipient or &lt;code&gt;null&lt;&#x2F;code&gt; if deploying a contract&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;v&lt;&#x2F;code&gt; - ECDSA recovery ID&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;blockNumber&lt;&#x2F;code&gt; - number of block containing this transaction or &lt;code&gt;null&lt;&#x2F;code&gt; if pending&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;gas&lt;&#x2F;code&gt; - gas provided for transaction execution&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;gasPrice&lt;&#x2F;code&gt; - price in wei of each gas used&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;nonce&lt;&#x2F;code&gt; - unique number identifying this transaction&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;transactionIndex&lt;&#x2F;code&gt; - index of this transaction in the block or &lt;code&gt;null&lt;&#x2F;code&gt; if pending&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;value&lt;&#x2F;code&gt; - value in wei sent with this transaction&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;example-22&quot;&gt;Example&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;-data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;id&amp;quot;: 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;jsonrpc&amp;quot;: &amp;quot;2.0&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;method&amp;quot;: &amp;quot;eth_getTransactionByBlockNumberAndIndex&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;params&amp;quot;:[&amp;quot;0x29c&amp;quot;, &amp;quot;0x0&amp;quot;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ur&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;blockHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1d59ff54b1eb26b013ce3cb5fc9dab3705b415a67127a003c3e61eb445bb8df2&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;blockNumber&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x5daf3b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;from&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xa7d9ddbe1f17865597fbd27ec712455208b6b76d&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xc350&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gasPrice&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x4a817c800&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x88df016429689c079f3b2f6ad39fa052532c56795b733da78a91ebe6a713944b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;input&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x68656c6c6f21&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x15&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1b5e176d927f8e9ab405058b2d2457392da3e20f328b16ddabcebc33eaac5fea&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x4ba69724e8f69de52f0125ad8b3c5c2cef33019bac3249e2c0a2192766d1721c&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xf02c1c8e6114b1dbe8937a39260b5b0a374432bb&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transactionIndex&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x41&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;v&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x25&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xf3dbb76162000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;hr &#x2F;&gt;
&lt;h4 id=&quot;eth-gettransactionbyhash&quot;&gt;eth_getTransactionByHash&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;description-23&quot;&gt;Description&lt;&#x2F;h5&gt;
&lt;p&gt;Returns information about a transaction specified by hash&lt;&#x2F;p&gt;
&lt;h5 id=&quot;parameters-23&quot;&gt;Parameters&lt;&#x2F;h5&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;#&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;}&lt;&#x2F;td&gt;&lt;td&gt;hash of a transaction&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h5 id=&quot;returns-23&quot;&gt;Returns&lt;&#x2F;h5&gt;
&lt;p&gt;{&lt;code&gt;null|object&lt;&#x2F;code&gt;} - &lt;code&gt;null&lt;&#x2F;code&gt; if no transaction is found, otherwise a transaction object with the following members:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;r&lt;&#x2F;code&gt; - ECDSA signature r&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;s&lt;&#x2F;code&gt; - ECDSA signature s&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;blockHash&lt;&#x2F;code&gt; - hash of block containing this transaction or &lt;code&gt;null&lt;&#x2F;code&gt; if pending&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;from&lt;&#x2F;code&gt; - transaction sender&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;hash&lt;&#x2F;code&gt; - hash of this transaction&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;input&lt;&#x2F;code&gt; - contract code or a hashed method call&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;to&lt;&#x2F;code&gt; - transaction recipient or &lt;code&gt;null&lt;&#x2F;code&gt; if deploying a contract&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;v&lt;&#x2F;code&gt; - ECDSA recovery ID&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;blockNumber&lt;&#x2F;code&gt; - number of block containing this transaction or &lt;code&gt;null&lt;&#x2F;code&gt; if pending&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;gas&lt;&#x2F;code&gt; - gas provided for transaction execution&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;gasPrice&lt;&#x2F;code&gt; - price in wei of each gas used&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;nonce&lt;&#x2F;code&gt; - unique number identifying this transaction&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;transactionIndex&lt;&#x2F;code&gt; - index of this transaction in the block or &lt;code&gt;null&lt;&#x2F;code&gt; if pending&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;value&lt;&#x2F;code&gt; - value in wei sent with this transaction&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;example-23&quot;&gt;Example&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;-data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;id&amp;quot;: 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;jsonrpc&amp;quot;: &amp;quot;2.0&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;method&amp;quot;: &amp;quot;eth_getTransactionByHash&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;params&amp;quot;: [&amp;quot;0x88df016429689c079f3b2f6ad39fa052532c56795b733da78a91ebe6a713944b&amp;quot;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ur&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;blockHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1d59ff54b1eb26b013ce3cb5fc9dab3705b415a67127a003c3e61eb445bb8df2&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;blockNumber&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x5daf3b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;from&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xa7d9ddbe1f17865597fbd27ec712455208b6b76d&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xc350&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gasPrice&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x4a817c800&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x88df016429689c079f3b2f6ad39fa052532c56795b733da78a91ebe6a713944b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;input&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x68656c6c6f21&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x15&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1b5e176d927f8e9ab405058b2d2457392da3e20f328b16ddabcebc33eaac5fea&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x4ba69724e8f69de52f0125ad8b3c5c2cef33019bac3249e2c0a2192766d1721c&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xf02c1c8e6114b1dbe8937a39260b5b0a374432bb&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transactionIndex&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x41&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;v&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x25&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xf3dbb76162000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;hr &#x2F;&gt;
&lt;h4 id=&quot;eth-gettransactioncount&quot;&gt;eth_getTransactionCount&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;description-24&quot;&gt;Description&lt;&#x2F;h5&gt;
&lt;p&gt;Returns the number of transactions sent from an address&lt;&#x2F;p&gt;
&lt;h5 id=&quot;parameters-24&quot;&gt;Parameters&lt;&#x2F;h5&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;#&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;}&lt;&#x2F;td&gt;&lt;td&gt;address to query for sent transactions&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;|&lt;code&gt;string&lt;&#x2F;code&gt;|&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#block-identifier&quot;&gt;&lt;code&gt;Block Identifier&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;}&lt;&#x2F;td&gt;&lt;td&gt;block number, or one of &lt;code&gt;&quot;latest&quot;&lt;&#x2F;code&gt;, &lt;code&gt;&quot;earliest&quot;&lt;&#x2F;code&gt; or &lt;code&gt;&quot;pending&quot;&lt;&#x2F;code&gt;, or a block identifier as described in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#block-identifier&quot;&gt;&lt;code&gt;Block Identifier&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h5 id=&quot;returns-24&quot;&gt;Returns&lt;&#x2F;h5&gt;
&lt;p&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} - number of transactions sent from the specified address&lt;&#x2F;p&gt;
&lt;h5 id=&quot;example-24&quot;&gt;Example&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;-data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;id&amp;quot;: 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;jsonrpc&amp;quot;: &amp;quot;2.0&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;method&amp;quot;: &amp;quot;eth_getTransactionCount&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;params&amp;quot;: [&amp;quot;0xc94770007dda54cF92009BFF0dE90c06F603a09f&amp;quot;, &amp;quot;latest&amp;quot;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ur&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;hr &#x2F;&gt;
&lt;h4 id=&quot;eth-gettransactionreceipt&quot;&gt;eth_getTransactionReceipt&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;description-25&quot;&gt;Description&lt;&#x2F;h5&gt;
&lt;p&gt;Returns the receipt of a transaction specified by hash&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;&#x2F;strong&gt; Transaction receipts are unavailable for pending transactions.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;parameters-25&quot;&gt;Parameters&lt;&#x2F;h5&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;#&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;}&lt;&#x2F;td&gt;&lt;td&gt;hash of a transaction&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h5 id=&quot;returns-25&quot;&gt;Returns&lt;&#x2F;h5&gt;
&lt;p&gt;{&lt;code&gt;null|object&lt;&#x2F;code&gt;} - &lt;code&gt;null&lt;&#x2F;code&gt; if no transaction is found, otherwise a transaction receipt object with the following members:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;blockHash&lt;&#x2F;code&gt; - hash of block containing this transaction&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;contractAddress&lt;&#x2F;code&gt; - address of new contract or &lt;code&gt;null&lt;&#x2F;code&gt; if no contract was created&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;from&lt;&#x2F;code&gt; - transaction sender&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;logsBloom&lt;&#x2F;code&gt; - logs bloom filter&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;to&lt;&#x2F;code&gt; - transaction recipient or &lt;code&gt;null&lt;&#x2F;code&gt; if deploying a contract&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;transactionHash&lt;&#x2F;code&gt; - hash of this transaction&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;blockNumber&lt;&#x2F;code&gt; - number of block containing this transaction&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;cumulativeGasUsed&lt;&#x2F;code&gt; - gas used by this and all preceding transactions in this block&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;gasUsed&lt;&#x2F;code&gt; - gas used by this transaction&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;status&lt;&#x2F;code&gt; - &lt;code&gt;1&lt;&#x2F;code&gt; if this transaction was successful or &lt;code&gt;0&lt;&#x2F;code&gt; if it failed&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;transactionIndex&lt;&#x2F;code&gt; - index of this transaction in the block&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;code&gt;Array&amp;lt;Log&amp;gt;&lt;&#x2F;code&gt;} &lt;code&gt;logs&lt;&#x2F;code&gt; - list of log objects generated by this transaction&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;example-25&quot;&gt;Example&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;-data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;id&amp;quot;: 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;jsonrpc&amp;quot;: &amp;quot;2.0&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;method&amp;quot;: &amp;quot;eth_getTransactionReceipt&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;params&amp;quot;: [&amp;quot;0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238&amp;quot;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ur&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;blockHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xc6ef2fc5426d6ad6fd9e2a26abeab0aa2411b7ab17f30a99d3cb96aed1d1055b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;blockNumber&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xb&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;contractAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xb60e8dd61c5d32be8058bb8eb970870f07233155&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;cumulativeGasUsed&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x33bc&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gasUsed&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x4dc&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;logs&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;],&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;logsBloom&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x00...0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;status&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transactionHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transactionIndex&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;hr &#x2F;&gt;
&lt;h4 id=&quot;eth-getunclebyblockhashandindex&quot;&gt;eth_getUncleByBlockHashAndIndex&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;description-26&quot;&gt;Description&lt;&#x2F;h5&gt;
&lt;p&gt;Returns information about an uncle specified by block hash and uncle index position&lt;&#x2F;p&gt;
&lt;h5 id=&quot;parameters-26&quot;&gt;Parameters&lt;&#x2F;h5&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;#&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;}&lt;&#x2F;td&gt;&lt;td&gt;hash of a block&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;}&lt;&#x2F;td&gt;&lt;td&gt;index of uncle&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h5 id=&quot;returns-26&quot;&gt;Returns&lt;&#x2F;h5&gt;
&lt;p&gt;{&lt;code&gt;null|object&lt;&#x2F;code&gt;} - &lt;code&gt;null&lt;&#x2F;code&gt; if no block or uncle is found, otherwise an uncle object with the following members:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;extraData&lt;&#x2F;code&gt; - &quot;extra data&quot; field of this block&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;hash&lt;&#x2F;code&gt; - block hash or &lt;code&gt;null&lt;&#x2F;code&gt; if pending&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;logsBloom&lt;&#x2F;code&gt; - logs bloom filter or &lt;code&gt;null&lt;&#x2F;code&gt; if pending&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;miner&lt;&#x2F;code&gt; - address that received this block&#x27;s mining rewards&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;nonce&lt;&#x2F;code&gt; - proof-of-work hash or &lt;code&gt;null&lt;&#x2F;code&gt; if pending&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;parentHash&lt;&#x2F;code&gt; - parent block hash&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;receiptsRoot&lt;&#x2F;code&gt; -root of this block&#x27;s receipts trie&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;sha3Uncles&lt;&#x2F;code&gt; - SHA3 of the uncles data in this block&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;stateRoot&lt;&#x2F;code&gt; - root of this block&#x27;s final state trie&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;transactionsRoot&lt;&#x2F;code&gt; - root of this block&#x27;s transaction trie&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;difficulty&lt;&#x2F;code&gt; - difficulty for this block&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;gasLimit&lt;&#x2F;code&gt; - maximum gas allowed in this block&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;gasUsed&lt;&#x2F;code&gt; - total used gas by all transactions in this block&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;number&lt;&#x2F;code&gt; - block number or &lt;code&gt;null&lt;&#x2F;code&gt; if pending&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;size&lt;&#x2F;code&gt; - size of this block in bytes&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;timestamp&lt;&#x2F;code&gt; - unix timestamp of when this block was collated&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;totalDifficulty&lt;&#x2F;code&gt; - total difficulty of the chain until this block&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;code&gt;Array&amp;lt;Transaction&amp;gt;&lt;&#x2F;code&gt;} &lt;code&gt;uncles&lt;&#x2F;code&gt; - list of uncle hashes&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;example-26&quot;&gt;Example&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;-data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;id&amp;quot;: 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;jsonrpc&amp;quot;: &amp;quot;2.0&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;method&amp;quot;: &amp;quot;eth_getUncleByBlockHashAndIndex&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;params&amp;quot;: [&amp;quot;0xc6ef2fc5426d6ad6fd9e2a26abeab0aa2411b7ab17f30a99d3cb96aed1d1055b&amp;quot;, &amp;quot;0x0&amp;quot;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ur&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;difficulty&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x027f07&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;extraData&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gasLimit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x9f759&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gasUsed&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x9f759&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;logsBloom&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;miner&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x4e65fda2159562a496f9f3522f89122a3088497a&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xe04d296d2460cfb8472af2c5fd05b5a214109c25688d3704aed5484f9a7792f2&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1b4&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;parentHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x9646252be9520f6e71339a8df9c55e4d7619deeb018d2a3f2d21fc165dde5eb5&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;sha3Uncles&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;size&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x027f07&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;stateRoot&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xd5855eb08b3387c0af375e9cdb6acfc05eb8f519e419b874b6ff2ffda7ed1dff&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;timestamp&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x54e34e8e&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;totalDifficulty&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x027f07&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transactionsRoot&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;uncles&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;hr &#x2F;&gt;
&lt;h4 id=&quot;eth-getunclebyblocknumberandindex&quot;&gt;eth_getUncleByBlockNumberAndIndex&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;description-27&quot;&gt;Description&lt;&#x2F;h5&gt;
&lt;p&gt;Returns information about an uncle specified by block number and uncle index position&lt;&#x2F;p&gt;
&lt;h5 id=&quot;parameters-27&quot;&gt;Parameters&lt;&#x2F;h5&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;#&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;|&lt;code&gt;string&lt;&#x2F;code&gt;}&lt;&#x2F;td&gt;&lt;td&gt;block number, or one of &lt;code&gt;&quot;latest&quot;&lt;&#x2F;code&gt;, &lt;code&gt;&quot;earliest&quot;&lt;&#x2F;code&gt; or &lt;code&gt;&quot;pending&quot;&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;}&lt;&#x2F;td&gt;&lt;td&gt;index of uncle&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h5 id=&quot;returns-27&quot;&gt;Returns&lt;&#x2F;h5&gt;
&lt;p&gt;{&lt;code&gt;null|object&lt;&#x2F;code&gt;} - &lt;code&gt;null&lt;&#x2F;code&gt; if no block or uncle is found, otherwise an uncle object with the following members:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;extraData&lt;&#x2F;code&gt; - &quot;extra data&quot; field of this block&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;hash&lt;&#x2F;code&gt; - block hash or &lt;code&gt;null&lt;&#x2F;code&gt; if pending&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;logsBloom&lt;&#x2F;code&gt; - logs bloom filter or &lt;code&gt;null&lt;&#x2F;code&gt; if pending&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;miner&lt;&#x2F;code&gt; - address that received this block&#x27;s mining rewards&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;nonce&lt;&#x2F;code&gt; - proof-of-work hash or &lt;code&gt;null&lt;&#x2F;code&gt; if pending&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;parentHash&lt;&#x2F;code&gt; - parent block hash&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;receiptsRoot&lt;&#x2F;code&gt; -root of this block&#x27;s receipts trie&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;sha3Uncles&lt;&#x2F;code&gt; - SHA3 of the uncles data in this block&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;stateRoot&lt;&#x2F;code&gt; - root of this block&#x27;s final state trie&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;transactionsRoot&lt;&#x2F;code&gt; - root of this block&#x27;s transaction trie&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;difficulty&lt;&#x2F;code&gt; - difficulty for this block&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;gasLimit&lt;&#x2F;code&gt; - maximum gas allowed in this block&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;gasUsed&lt;&#x2F;code&gt; - total used gas by all transactions in this block&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;number&lt;&#x2F;code&gt; - block number or &lt;code&gt;null&lt;&#x2F;code&gt; if pending&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;size&lt;&#x2F;code&gt; - size of this block in bytes&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;timestamp&lt;&#x2F;code&gt; - unix timestamp of when this block was collated&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;totalDifficulty&lt;&#x2F;code&gt; - total difficulty of the chain until this block&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;code&gt;Array&amp;lt;Transaction&amp;gt;&lt;&#x2F;code&gt;} &lt;code&gt;uncles&lt;&#x2F;code&gt; - list of uncle hashes&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;example-27&quot;&gt;Example&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;-data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;id&amp;quot;: 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;jsonrpc&amp;quot;: &amp;quot;2.0&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;method&amp;quot;: &amp;quot;eth_getUncleByBlockNumberAndIndex&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;params&amp;quot;: [&amp;quot;0x29c&amp;quot;, &amp;quot;0x0&amp;quot;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ur&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;difficulty&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x027f07&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;extraData&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gasLimit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x9f759&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gasUsed&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x9f759&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;logsBloom&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;miner&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x4e65fda2159562a496f9f3522f89122a3088497a&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xe04d296d2460cfb8472af2c5fd05b5a214109c25688d3704aed5484f9a7792f2&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1b4&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;parentHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x9646252be9520f6e71339a8df9c55e4d7619deeb018d2a3f2d21fc165dde5eb5&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;sha3Uncles&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;size&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x027f07&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;stateRoot&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xd5855eb08b3387c0af375e9cdb6acfc05eb8f519e419b874b6ff2ffda7ed1dff&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;timestamp&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x54e34e8e&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;totalDifficulty&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x027f07&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transactionsRoot&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;uncles&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;hr &#x2F;&gt;
&lt;h4 id=&quot;eth-getunclecountbyblockhash&quot;&gt;eth_getUncleCountByBlockHash&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;description-28&quot;&gt;Description&lt;&#x2F;h5&gt;
&lt;p&gt;Returns the number of uncles in a block specified by block hash&lt;&#x2F;p&gt;
&lt;h5 id=&quot;parameters-28&quot;&gt;Parameters&lt;&#x2F;h5&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;#&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;}&lt;&#x2F;td&gt;&lt;td&gt;hash of a block&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h5 id=&quot;returns-28&quot;&gt;Returns&lt;&#x2F;h5&gt;
&lt;p&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} - number of uncles in the specified block&lt;&#x2F;p&gt;
&lt;h5 id=&quot;example-28&quot;&gt;Example&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;-data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;id&amp;quot;: 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;jsonrpc&amp;quot;: &amp;quot;2.0&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;method&amp;quot;: &amp;quot;eth_getUncleCountByBlockHash&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;params&amp;quot;: [&amp;quot;0xc94770007dda54cF92009BFF0dE90c06F603a09f&amp;quot;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ur&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xc&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;hr &#x2F;&gt;
&lt;h4 id=&quot;eth-getunclecountbyblocknumber&quot;&gt;eth_getUncleCountByBlockNumber&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;description-29&quot;&gt;Description&lt;&#x2F;h5&gt;
&lt;p&gt;Returns the number of uncles in a block specified by block number&lt;&#x2F;p&gt;
&lt;h5 id=&quot;parameters-29&quot;&gt;Parameters&lt;&#x2F;h5&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;#&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;|&lt;code&gt;string&lt;&#x2F;code&gt;}&lt;&#x2F;td&gt;&lt;td&gt;block number, or one of &lt;code&gt;&quot;latest&quot;&lt;&#x2F;code&gt;, &lt;code&gt;&quot;earliest&quot;&lt;&#x2F;code&gt; or &lt;code&gt;&quot;pending&quot;&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h5 id=&quot;returns-29&quot;&gt;Returns&lt;&#x2F;h5&gt;
&lt;p&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} - number of uncles in the specified block&lt;&#x2F;p&gt;
&lt;h5 id=&quot;example-29&quot;&gt;Example&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;-data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;id&amp;quot;: 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;jsonrpc&amp;quot;: &amp;quot;2.0&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;method&amp;quot;: &amp;quot;eth_getUncleCountByBlockNumber&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;params&amp;quot;: [&amp;quot;0xe8&amp;quot;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ur&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;hr &#x2F;&gt;
&lt;h4 id=&quot;eth-getwork&quot;&gt;eth_getWork&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;description-30&quot;&gt;Description&lt;&#x2F;h5&gt;
&lt;p&gt;Returns a list containing relevant information for proof-of-work&lt;&#x2F;p&gt;
&lt;h5 id=&quot;parameters-30&quot;&gt;Parameters&lt;&#x2F;h5&gt;
&lt;p&gt;&lt;em&gt;none&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h5 id=&quot;returns-30&quot;&gt;Returns&lt;&#x2F;h5&gt;
&lt;p&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data[]&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} - array with the following items:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} - current block header pow-hash&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} - seed hash used for the DAG&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} - boundary condition (&quot;target&quot;), 2^256 &#x2F; difficulty&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h5 id=&quot;example-30&quot;&gt;Example&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;-data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;id&amp;quot;: 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;jsonrpc&amp;quot;: &amp;quot;2.0&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;method&amp;quot;: &amp;quot;eth_getWork&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;params&amp;quot;: []&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ur&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0x5EED00000000000000000000000000005EED0000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;0xd1ff1c01710000000000000000000000d1ff1c01710000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;hr &#x2F;&gt;
&lt;h4 id=&quot;eth-hashrate&quot;&gt;eth_hashrate&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;description-31&quot;&gt;Description&lt;&#x2F;h5&gt;
&lt;p&gt;Returns the number of hashes-per-second this node is mining at&lt;&#x2F;p&gt;
&lt;h5 id=&quot;parameters-31&quot;&gt;Parameters&lt;&#x2F;h5&gt;
&lt;p&gt;&lt;em&gt;(none)&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h5 id=&quot;returns-31&quot;&gt;Returns&lt;&#x2F;h5&gt;
&lt;p&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} - number of hashes-per-second&lt;&#x2F;p&gt;
&lt;h5 id=&quot;example-31&quot;&gt;Example&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;-data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;id&amp;quot;: 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;jsonrpc&amp;quot;: &amp;quot;2.0&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;method&amp;quot;: &amp;quot;eth_hashrate&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;params&amp;quot;: []&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ur&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x38a&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;hr &#x2F;&gt;
&lt;h4 id=&quot;eth-mining&quot;&gt;eth_mining&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;description-32&quot;&gt;Description&lt;&#x2F;h5&gt;
&lt;p&gt;Determines if this client is mining new blocks&lt;&#x2F;p&gt;
&lt;h5 id=&quot;parameters-32&quot;&gt;Parameters&lt;&#x2F;h5&gt;
&lt;p&gt;&lt;em&gt;(none)&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h5 id=&quot;returns-32&quot;&gt;Returns&lt;&#x2F;h5&gt;
&lt;p&gt;{&lt;code&gt;boolean&lt;&#x2F;code&gt;} - &lt;code&gt;true&lt;&#x2F;code&gt; if this client is mining or &lt;code&gt;false&lt;&#x2F;code&gt; if it is not mining&lt;&#x2F;p&gt;
&lt;h5 id=&quot;example-32&quot;&gt;Example&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;-data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;id&amp;quot;: 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;jsonrpc&amp;quot;: &amp;quot;2.0&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;method&amp;quot;: &amp;quot;eth_mining&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;params&amp;quot;: []&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ur&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;hr &#x2F;&gt;
&lt;h4 id=&quot;eth-newblockfilter&quot;&gt;eth_newBlockFilter&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;description-33&quot;&gt;Description&lt;&#x2F;h5&gt;
&lt;p&gt;Creates a filter to listen for new blocks that can be used with &lt;code&gt;eth_getFilterChanges&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h5 id=&quot;parameters-33&quot;&gt;Parameters&lt;&#x2F;h5&gt;
&lt;p&gt;&lt;em&gt;none&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h5 id=&quot;returns-33&quot;&gt;Returns&lt;&#x2F;h5&gt;
&lt;p&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} - ID of the newly-created filter that can be used with &lt;code&gt;eth_getFilterChanges&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h5 id=&quot;example-33&quot;&gt;Example&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;-data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;id&amp;quot;: 1337&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;jsonrpc&amp;quot;: &amp;quot;2.0&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;method&amp;quot;: &amp;quot;eth_newBlockFilter&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;params&amp;quot;: []&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ur&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;hr &#x2F;&gt;
&lt;h4 id=&quot;eth-newfilter&quot;&gt;eth_newFilter&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;description-34&quot;&gt;Description&lt;&#x2F;h5&gt;
&lt;p&gt;Creates a filter to listen for specific state changes that can then be used with &lt;code&gt;eth_getFilterChanges&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h5 id=&quot;parameters-34&quot;&gt;Parameters&lt;&#x2F;h5&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;#&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;{&lt;code&gt;object&lt;&#x2F;code&gt;}&lt;&#x2F;td&gt;&lt;td&gt;@property {&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;|&lt;code&gt;string&lt;&#x2F;code&gt;} &lt;code&gt;[fromBlock]&lt;&#x2F;code&gt; - block number, or one of &lt;code&gt;&quot;latest&quot;&lt;&#x2F;code&gt;, &lt;code&gt;&quot;earliest&quot;&lt;&#x2F;code&gt; or &lt;code&gt;&quot;pending&quot;&lt;&#x2F;code&gt;&lt;br&#x2F;&gt;@property {&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;|&lt;code&gt;string&lt;&#x2F;code&gt;} &lt;code&gt;[toBlock]&lt;&#x2F;code&gt; - block number, or one of &lt;code&gt;&quot;latest&quot;&lt;&#x2F;code&gt;, &lt;code&gt;&quot;earliest&quot;&lt;&#x2F;code&gt; or &lt;code&gt;&quot;pending&quot;&lt;&#x2F;code&gt;&lt;br&#x2F;&gt;@property {&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;|&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data[]&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;[address]&lt;&#x2F;code&gt; - contract address or a list of addresses from which logs should originate&lt;br&#x2F;&gt;@property {&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data[]&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;[topics]&lt;&#x2F;code&gt; - list of order-dependent topics&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;&#x2F;strong&gt; Topics are order-dependent. A transaction with a log with topics &lt;code&gt;[A, B]&lt;&#x2F;code&gt; will be matched by the following topic filters:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;[]&lt;&#x2F;code&gt; - &quot;anything&quot;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;[A]&lt;&#x2F;code&gt; - &quot;A in first position (and anything after)&quot;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;[null, B]&lt;&#x2F;code&gt; - &quot;anything in first position AND B in second position (and anything after)&quot;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;[A, B]&lt;&#x2F;code&gt; - &quot;A in first position AND B in second position (and anything after)&quot;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;[[A, B], [A, B]]&lt;&#x2F;code&gt; - &quot;(A OR B) in first position AND (A OR B) in second position (and anything after)&quot;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;returns-34&quot;&gt;Returns&lt;&#x2F;h5&gt;
&lt;p&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} - ID of the newly-created filter that can be used with &lt;code&gt;eth_getFilterChanges&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h5 id=&quot;example-34&quot;&gt;Example&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;-data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;id&amp;quot;: 1337&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;jsonrpc&amp;quot;: &amp;quot;2.0&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;method&amp;quot;: &amp;quot;eth_newFilter&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;params&amp;quot;: [{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        &amp;quot;topics&amp;quot;: [&amp;quot;0x0000000000000000000000000000000000000000000000000000000012341234&amp;quot;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    }]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ur&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;hr &#x2F;&gt;
&lt;h4 id=&quot;eth-newpendingtransactionfilter&quot;&gt;eth_newPendingTransactionFilter&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;description-35&quot;&gt;Description&lt;&#x2F;h5&gt;
&lt;p&gt;Creates a filter to listen for new pending transactions that can be used with &lt;code&gt;eth_getFilterChanges&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h5 id=&quot;parameters-35&quot;&gt;Parameters&lt;&#x2F;h5&gt;
&lt;p&gt;&lt;em&gt;none&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h5 id=&quot;returns-35&quot;&gt;Returns&lt;&#x2F;h5&gt;
&lt;p&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} - ID of the newly-created filter that can be used with &lt;code&gt;eth_getFilterChanges&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h5 id=&quot;example-35&quot;&gt;Example&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;-data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;id&amp;quot;: 1337&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;jsonrpc&amp;quot;: &amp;quot;2.0&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;method&amp;quot;: &amp;quot;eth_newPendingTransactionFilter&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;params&amp;quot;: []&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ur&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;hr &#x2F;&gt;
&lt;h4 id=&quot;eth-protocolversion&quot;&gt;eth_protocolVersion&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;description-36&quot;&gt;Description&lt;&#x2F;h5&gt;
&lt;p&gt;Returns the current Ethereum protocol version&lt;&#x2F;p&gt;
&lt;h5 id=&quot;parameters-36&quot;&gt;Parameters&lt;&#x2F;h5&gt;
&lt;p&gt;&lt;em&gt;(none)&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h5 id=&quot;returns-36&quot;&gt;Returns&lt;&#x2F;h5&gt;
&lt;p&gt;{&lt;code&gt;string&lt;&#x2F;code&gt;} - current Ethereum protocol version&lt;&#x2F;p&gt;
&lt;h5 id=&quot;example-36&quot;&gt;Example&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;-data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;id&amp;quot;: 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;jsonrpc&amp;quot;: &amp;quot;2.0&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;method&amp;quot;: &amp;quot;eth_protocolVersion&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;params&amp;quot;: []&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ur&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;54&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;hr &#x2F;&gt;
&lt;h4 id=&quot;eth-sendrawtransaction&quot;&gt;eth_sendRawTransaction&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;description-37&quot;&gt;Description&lt;&#x2F;h5&gt;
&lt;p&gt;Sends and already-signed transaction to the network&lt;&#x2F;p&gt;
&lt;h5 id=&quot;parameters-37&quot;&gt;Parameters&lt;&#x2F;h5&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;#&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;}&lt;&#x2F;td&gt;&lt;td&gt;signed transaction data&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h5 id=&quot;returns-37&quot;&gt;Returns&lt;&#x2F;h5&gt;
&lt;p&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} - transaction hash, or the zero hash if the transaction is not yet available&lt;&#x2F;p&gt;
&lt;h5 id=&quot;example-37&quot;&gt;Example&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;-data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;id&amp;quot;: 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;jsonrpc&amp;quot;: &amp;quot;2.0&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;method&amp;quot;: &amp;quot;eth_sendRawTransaction&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;params&amp;quot;: [&amp;quot;0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675&amp;quot;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ur&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;hr &#x2F;&gt;
&lt;h4 id=&quot;eth-sendtransaction&quot;&gt;eth_sendTransaction&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;description-38&quot;&gt;Description&lt;&#x2F;h5&gt;
&lt;p&gt;Creates, signs, and sends a new transaction to the network&lt;&#x2F;p&gt;
&lt;h5 id=&quot;parameters-38&quot;&gt;Parameters&lt;&#x2F;h5&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;#&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;{&lt;code&gt;object&lt;&#x2F;code&gt;}&lt;&#x2F;td&gt;&lt;td&gt;@property {&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;from&lt;&#x2F;code&gt; - transaction sender&lt;br&#x2F;&gt;@property {&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;[to]&lt;&#x2F;code&gt; - transaction recipient&lt;br&#x2F;&gt;@property {&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;[gas=&quot;0x15f90&quot;]&lt;&#x2F;code&gt; - gas provided for transaction execution&lt;br&#x2F;&gt;@property {&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;[gasPrice]&lt;&#x2F;code&gt; - price in wei of each gas used&lt;br&#x2F;&gt;@property {&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;[value]&lt;&#x2F;code&gt; - value in wei sent with this transaction&lt;br&#x2F;&gt;@property {&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;[data]&lt;&#x2F;code&gt; - contract code or a hashed method call with encoded args&lt;br&#x2F;&gt;@property {&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;[nonce]&lt;&#x2F;code&gt; - unique number identifying this transaction&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h5 id=&quot;returns-38&quot;&gt;Returns&lt;&#x2F;h5&gt;
&lt;p&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} - transaction hash, or the zero hash if the transaction is not yet available&lt;&#x2F;p&gt;
&lt;h5 id=&quot;example-38&quot;&gt;Example&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;-data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;id&amp;quot;: 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;jsonrpc&amp;quot;: &amp;quot;2.0&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;method&amp;quot;: &amp;quot;eth_sendTransaction&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;params&amp;quot;: [{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        &amp;quot;data&amp;quot;: &amp;quot;0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        &amp;quot;from&amp;quot;: &amp;quot;0xb60e8dd61c5d32be8058bb8eb970870f07233155&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        &amp;quot;gas&amp;quot;: &amp;quot;0x76c0&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        &amp;quot;gasPrice&amp;quot;: &amp;quot;0x9184e72a000&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        &amp;quot;to&amp;quot;: &amp;quot;0xd46e8dd67c5d32be8058bb8eb970870f07244567&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        &amp;quot;value&amp;quot;: &amp;quot;0x9184e72a&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    }]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ur&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;hr &#x2F;&gt;
&lt;h4 id=&quot;eth-sign&quot;&gt;eth_sign&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;description-39&quot;&gt;Description&lt;&#x2F;h5&gt;
&lt;p&gt;Calculates an Ethereum-specific signature in the form of &lt;code&gt;keccak256(&quot;\x19Ethereum Signed Message:\n&quot; + len(message) + message))&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h5 id=&quot;parameters-39&quot;&gt;Parameters&lt;&#x2F;h5&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;#&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;}&lt;&#x2F;td&gt;&lt;td&gt;address to use for signing&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;}&lt;&#x2F;td&gt;&lt;td&gt;data to sign&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h5 id=&quot;returns-39&quot;&gt;Returns&lt;&#x2F;h5&gt;
&lt;p&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} - signature hash of the provided data&lt;&#x2F;p&gt;
&lt;h5 id=&quot;example-39&quot;&gt;Example&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;-data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;id&amp;quot;: 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;jsonrpc&amp;quot;: &amp;quot;2.0&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;method&amp;quot;: &amp;quot;eth_sign&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;params&amp;quot;: [&amp;quot;0x9b2055d370f73ec7d8a03e965129118dc8f5bf83&amp;quot;, &amp;quot;0xdeadbeaf&amp;quot;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ur&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xa3f20717a250c2b0b729b7e5becbff67fdaef7e0699da4de7ca5895b02a170a12d887fd3b17bfdce3481f10bea41f45ba9f709d39ce8325427b57afcfc994cee1b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;hr &#x2F;&gt;
&lt;h4 id=&quot;eth-signtransaction&quot;&gt;eth_signTransaction&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;description-40&quot;&gt;Description&lt;&#x2F;h5&gt;
&lt;p&gt;Signs a transaction that can be submitted to the network at a later time using with &lt;code&gt;eth_sendRawTransaction&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h5 id=&quot;parameters-40&quot;&gt;Parameters&lt;&#x2F;h5&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;#&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;{&lt;code&gt;object&lt;&#x2F;code&gt;}&lt;&#x2F;td&gt;&lt;td&gt;@property {&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;from&lt;&#x2F;code&gt; - transaction sender&lt;br&#x2F;&gt;@property {&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;[to]&lt;&#x2F;code&gt; - transaction recipient&lt;br&#x2F;&gt;@property {&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;[gas=&quot;0x15f90&quot;]&lt;&#x2F;code&gt; - gas provided for transaction execution&lt;br&#x2F;&gt;@property {&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;[gasPrice]&lt;&#x2F;code&gt; - price in wei of each gas used&lt;br&#x2F;&gt;@property {&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;[value]&lt;&#x2F;code&gt; - value in wei sent with this transaction&lt;br&#x2F;&gt;@property {&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;[data]&lt;&#x2F;code&gt; - contract code or a hashed method call with encoded args&lt;br&#x2F;&gt;@property {&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;[nonce]&lt;&#x2F;code&gt; - unique number identifying this transaction&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h5 id=&quot;returns-40&quot;&gt;Returns&lt;&#x2F;h5&gt;
&lt;p&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} - signature hash of the transaction object&lt;&#x2F;p&gt;
&lt;h5 id=&quot;example-40&quot;&gt;Example&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;-data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;id&amp;quot;: 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;jsonrpc&amp;quot;: &amp;quot;2.0&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;method&amp;quot;: &amp;quot;eth_signTransaction&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;params&amp;quot;: [{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        &amp;quot;data&amp;quot;: &amp;quot;0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        &amp;quot;from&amp;quot;: &amp;quot;0xb60e8dd61c5d32be8058bb8eb970870f07233155&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        &amp;quot;gas&amp;quot;: &amp;quot;0x76c0&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        &amp;quot;gasPrice&amp;quot;: &amp;quot;0x9184e72a000&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        &amp;quot;to&amp;quot;: &amp;quot;0xd46e8dd67c5d32be8058bb8eb970870f07244567&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        &amp;quot;value&amp;quot;: &amp;quot;0x9184e72a&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    }]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ur&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xa3f20717a250c2b0b729b7e5becbff67fdaef7e0699da4de7ca5895b02a170a12d887fd3b17bfdce3481f10bea41f45ba9f709d39ce8325427b57afcfc994cee1b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;hr &#x2F;&gt;
&lt;h4 id=&quot;eth-signtypeddata&quot;&gt;eth_signTypedData&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;description-41&quot;&gt;Description&lt;&#x2F;h5&gt;
&lt;p&gt;Calculates an Ethereum-specific signature in the form of &lt;code&gt;keccak256(&quot;\x19Ethereum Signed Message:\n&quot; + len(message) + message))&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h5 id=&quot;parameters-41&quot;&gt;Parameters&lt;&#x2F;h5&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;#&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;}&lt;&#x2F;td&gt;&lt;td&gt;address to use for signing&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;}&lt;&#x2F;td&gt;&lt;td&gt;message to sign containing type information, a domain separator, and data&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;&#x2F;strong&gt; Client developers should refer to EIP-712 for complete semantics around &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;#specification&quot;&gt;encoding and signing data&lt;&#x2F;a&gt;. Dapp developers should refer to EIP-712 for the expected structure of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;#parameters&quot;&gt;RPC method input parameters&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;returns-41&quot;&gt;Returns&lt;&#x2F;h5&gt;
&lt;p&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} - signature hash of the provided message&lt;&#x2F;p&gt;
&lt;h5 id=&quot;example-41&quot;&gt;Example&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;-data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;	&amp;quot;id&amp;quot;: 1337&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;	&amp;quot;jsonrpc&amp;quot;: &amp;quot;2.0&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;	&amp;quot;method&amp;quot;: &amp;quot;eth_signTypedData&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;	&amp;quot;params&amp;quot;: [&amp;quot;0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826&amp;quot;, {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;		&amp;quot;types&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;			&amp;quot;EIP712Domain&amp;quot;: [{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;				&amp;quot;name&amp;quot;: &amp;quot;name&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;				&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;			}, {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;				&amp;quot;name&amp;quot;: &amp;quot;version&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;				&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;			}, {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;				&amp;quot;name&amp;quot;: &amp;quot;chainId&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;				&amp;quot;type&amp;quot;: &amp;quot;uint256&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;			}, {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;				&amp;quot;name&amp;quot;: &amp;quot;verifyingContract&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;				&amp;quot;type&amp;quot;: &amp;quot;address&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;			}],&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;			&amp;quot;Person&amp;quot;: [{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;				&amp;quot;name&amp;quot;: &amp;quot;name&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;				&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;			}, {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;				&amp;quot;name&amp;quot;: &amp;quot;wallet&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;				&amp;quot;type&amp;quot;: &amp;quot;address&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;			}],&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;			&amp;quot;Mail&amp;quot;: [{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;				&amp;quot;name&amp;quot;: &amp;quot;from&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;				&amp;quot;type&amp;quot;: &amp;quot;Person&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;			}, {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;				&amp;quot;name&amp;quot;: &amp;quot;to&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;				&amp;quot;type&amp;quot;: &amp;quot;Person&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;			}, {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;				&amp;quot;name&amp;quot;: &amp;quot;contents&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;				&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;			}]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;		},&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;		&amp;quot;primaryType&amp;quot;: &amp;quot;Mail&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;		&amp;quot;domain&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;			&amp;quot;name&amp;quot;: &amp;quot;Ether Mail&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;			&amp;quot;version&amp;quot;: &amp;quot;1&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;			&amp;quot;chainId&amp;quot;: 1,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;			&amp;quot;verifyingContract&amp;quot;: &amp;quot;0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;		},&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;		&amp;quot;message&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;			&amp;quot;from&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;				&amp;quot;name&amp;quot;: &amp;quot;Cow&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;				&amp;quot;wallet&amp;quot;: &amp;quot;0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;			},&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;			&amp;quot;to&amp;quot;: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;				&amp;quot;name&amp;quot;: &amp;quot;Bob&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;				&amp;quot;wallet&amp;quot;: &amp;quot;0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;			},&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;			&amp;quot;contents&amp;quot;: &amp;quot;Hello, Bob!&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;		}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;	}]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ur&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x4355c47d63924e8a72e509b65029052eb6c299d53a04e167c5775fd466751c9d07299936d304c153f6443dfa05f40ff007d72911b6f72307f996231605b915621c&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;hr &#x2F;&gt;
&lt;h4 id=&quot;eth-submithashrate&quot;&gt;eth_submitHashrate&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;description-42&quot;&gt;Description&lt;&#x2F;h5&gt;
&lt;p&gt;Submit a mining hashrate&lt;&#x2F;p&gt;
&lt;h5 id=&quot;parameters-42&quot;&gt;Parameters&lt;&#x2F;h5&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;#&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;}&lt;&#x2F;td&gt;&lt;td&gt;hash rate&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;}&lt;&#x2F;td&gt;&lt;td&gt;random ID identifying this node&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h5 id=&quot;returns-42&quot;&gt;Returns&lt;&#x2F;h5&gt;
&lt;p&gt;{&lt;code&gt;boolean&lt;&#x2F;code&gt;} - &lt;code&gt;true&lt;&#x2F;code&gt; if submitting went through successfully, &lt;code&gt;false&lt;&#x2F;code&gt; otherwise&lt;&#x2F;p&gt;
&lt;h5 id=&quot;example-42&quot;&gt;Example&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;-data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;id&amp;quot;: 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;jsonrpc&amp;quot;: &amp;quot;2.0&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;method&amp;quot;: &amp;quot;eth_submitHashrate&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;params&amp;quot;: [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        &amp;quot;0x0000000000000000000000000000000000000000000000000000000000500000&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        &amp;quot;0x59daa26581d0acd1fce254fb7e85952f4c09d0915afd33d3886cd914bc7d283c&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ur&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;hr &#x2F;&gt;
&lt;h4 id=&quot;eth-submitwork&quot;&gt;eth_submitWork&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;description-43&quot;&gt;Description&lt;&#x2F;h5&gt;
&lt;p&gt;Submit a proof-of-work solution&lt;&#x2F;p&gt;
&lt;h5 id=&quot;parameters-43&quot;&gt;Parameters&lt;&#x2F;h5&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;#&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;}&lt;&#x2F;td&gt;&lt;td&gt;nonce found&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;}&lt;&#x2F;td&gt;&lt;td&gt;header&#x27;s pow-hash&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#data&quot;&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;}&lt;&#x2F;td&gt;&lt;td&gt;mix digest&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h5 id=&quot;returns-43&quot;&gt;Returns&lt;&#x2F;h5&gt;
&lt;p&gt;{&lt;code&gt;boolean&lt;&#x2F;code&gt;} - &lt;code&gt;true&lt;&#x2F;code&gt; if the provided solution is valid, &lt;code&gt;false&lt;&#x2F;code&gt; otherwise&lt;&#x2F;p&gt;
&lt;h5 id=&quot;example-43&quot;&gt;Example&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;-data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;id&amp;quot;: 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;jsonrpc&amp;quot;: &amp;quot;2.0&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;method&amp;quot;: &amp;quot;eth_submitWork&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;params&amp;quot;: [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        &amp;quot;0x0000000000000001&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        &amp;quot;0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        &amp;quot;0xD1GE5700000000000000000000000000D1GE5700000000000000000000000000&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ur&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;hr &#x2F;&gt;
&lt;h4 id=&quot;eth-syncing&quot;&gt;eth_syncing&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;description-44&quot;&gt;Description&lt;&#x2F;h5&gt;
&lt;p&gt;Returns information about the status of this client&#x27;s network synchronization&lt;&#x2F;p&gt;
&lt;h5 id=&quot;parameters-44&quot;&gt;Parameters&lt;&#x2F;h5&gt;
&lt;p&gt;&lt;em&gt;(none)&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h5 id=&quot;returns-44&quot;&gt;Returns&lt;&#x2F;h5&gt;
&lt;p&gt;{&lt;code&gt;boolean|object&lt;&#x2F;code&gt;} - &lt;code&gt;false&lt;&#x2F;code&gt; if this client is not syncing with the network, otherwise an object with the following members:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;currentBlock&lt;&#x2F;code&gt; - number of the most-recent block synced&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;highestBlock&lt;&#x2F;code&gt; - number of latest block on the network&lt;&#x2F;li&gt;
&lt;li&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;} &lt;code&gt;startingBlock&lt;&#x2F;code&gt; - block number at which syncing started&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;example-44&quot;&gt;Example&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;-data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;id&amp;quot;: 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;jsonrpc&amp;quot;: &amp;quot;2.0&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;method&amp;quot;: &amp;quot;eth_syncing&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;params&amp;quot;: []&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ur&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;currentBlock&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x386&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;highestBlock&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x454&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;startingBlock&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x384&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;hr &#x2F;&gt;
&lt;h4 id=&quot;eth-uninstallfilter&quot;&gt;eth_uninstallFilter&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;description-45&quot;&gt;Description&lt;&#x2F;h5&gt;
&lt;p&gt;Destroys a filter based on filter ID&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;&#x2F;strong&gt; This should only be called if a filter and its notifications are no longer needed. This will also be called automatically on a filter if its notifications are not retrieved using &lt;code&gt;eth_getFilterChanges&lt;&#x2F;code&gt; for a period of time.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;parameters-45&quot;&gt;Parameters&lt;&#x2F;h5&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;#&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;{&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;#quantity&quot;&gt;&lt;code&gt;Quantity&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;}&lt;&#x2F;td&gt;&lt;td&gt;ID of the filter to destroy&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h5 id=&quot;returns-45&quot;&gt;Returns&lt;&#x2F;h5&gt;
&lt;p&gt;{&lt;code&gt;boolean&lt;&#x2F;code&gt;} - &lt;code&gt;true&lt;&#x2F;code&gt; if the filter is found and successfully destroyed or &lt;code&gt;false&lt;&#x2F;code&gt; if it is not&lt;&#x2F;p&gt;
&lt;h5 id=&quot;example-45&quot;&gt;Example&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;-data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;id&amp;quot;: 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;jsonrpc&amp;quot;: &amp;quot;2.0&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;method&amp;quot;: &amp;quot;eth_uninstallFilter&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;params&amp;quot;: [&amp;quot;0xb&amp;quot;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ur&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; 1337,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;hr &#x2F;&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Much of Ethereum&#x27;s effectiveness as an enterprise-grade application platform depends on its ability to provide a reliable and predictable developer experience. Nodes created by the current generation of Ethereum clients expose RPC endpoints with differing method signatures; this forces applications to work around method inconsistencies to maintain compatibility with various Ethereum RPC implementations.&lt;&#x2F;p&gt;
&lt;p&gt;Both Ethereum client developers and downstream dapp developers lack a formal Ethereum RPC specification. This proposal standardizes such a specification in a way that&#x27;s versionable and modifiable through the traditional EIP process.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal impacts Ethereum client developers by requiring that any exposed RPC interface adheres to this specification. This proposal impacts dapp developers by requiring that any RPC calls currently used in applications are made according to this specification.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The current generation of Ethereum clients includes several implementations that attempt to expose this RPC specification:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Client Name&lt;&#x2F;th&gt;&lt;th&gt;Language&lt;&#x2F;th&gt;&lt;th&gt;Homepage&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Geth&lt;&#x2F;td&gt;&lt;td&gt;Go&lt;&#x2F;td&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;geth.ethereum.org&quot;&gt;geth.ethereum.org&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Parity&lt;&#x2F;td&gt;&lt;td&gt;Rust&lt;&#x2F;td&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;parity.io&#x2F;ethereum&quot;&gt;parity.io&#x2F;ethereum&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Aleth&lt;&#x2F;td&gt;&lt;td&gt;C++&lt;&#x2F;td&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;cpp-ethereum.org&quot;&gt;cpp-ethereum.org&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Base Security Token</title>
        <published>2018-10-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Maxim Kupriianov</name><email>mk@atlant.io</email>
	</author>
	
	<author>
		<name>Julian Svirsky</name><email>js@atlant.io</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1462/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-1462-base-security-token/1501" />
        

        <id>https://wg-eips.ritovision.com/1462/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:1462"
            label="ERC-1462" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1462/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;An extension to ERC-20 standard token that provides compliance with securities regulations and legal enforceability.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP defines a minimal set of additions to the default token standard such as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;, that allows for compliance with domestic and international legal requirements. Such requirements include KYC (Know Your Customer) and AML (Anti Money Laundering) regulations, and the ability to lock tokens for an account, and restrict them from transfer due to a legal dispute. Also the ability to attach additional legal documentation, in order to set up a dual-binding relationship between the token and off-chain legal entities.&lt;&#x2F;p&gt;
&lt;p&gt;The scope of this standard is being kept as narrow as possible to avoid restricting potential use-cases of this base security token. Any additional functionality and limitations not defined in this standard may be enforced on per-project basis.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;There are several security token standards that have been proposed recently. Examples include &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;1411&quot;&gt;ERC-1400&lt;&#x2F;a&gt;, also &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-1450&quot;&gt;ERC-1450&lt;&#x2F;a&gt;. We have concerns about each of them, mostly because the scope of each of these EIPs contains many project-specific or market-specific details. Since many EIPs are coming from the respective backing companies, they capture many niche requirements that are excessive for a general case.&lt;&#x2F;p&gt;
&lt;p&gt;For instance, ERC-1411 uses dependency on &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;eips&#x2F;issues&#x2F;1410&quot;&gt;ERC-1410&lt;&#x2F;a&gt; but it falls out of the &quot;security tokens&quot; scope. Also its dependency on &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;777&#x2F;&quot;&gt;ERC-777&lt;&#x2F;a&gt; will block the adoption for a quite period of time before ERC-777 is finalized, but the integration guidelines for existing ERC-20 workflows are not described in that EIP, yet. Another attempt to make a much simpler base standard &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;1404&quot;&gt;ERC-1404&lt;&#x2F;a&gt; is missing a few important points, specifically it doesn&#x27;t provide enough granularity to distinguish between different ERC-20 transfer functions such as &lt;code&gt;transfer&lt;&#x2F;code&gt; and &lt;code&gt;transferFrom&lt;&#x2F;code&gt;. It also doesn&#x27;t provide a way to bind legal documentation to the issued tokens.&lt;&#x2F;p&gt;
&lt;p&gt;What we propose in this EIP is a simple and very modular solution for creating a base security token for the widest possible scope of applications, so it can be used by other issuers to build upon. The issuers should be able to add more restrictions and policies to the token, using the functions and implementation proposed below, but they must not be limited in any way while using this ERC.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The ERC-20 token provides the following basic features:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC20&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; who&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; allowance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Approval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This will be extended as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BaseSecurityToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is ERC-20 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Checking functions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checkTransferAllowed&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;byte&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checkTransferFromAllowed&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;byte&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checkMintAllowed&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;byte&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checkBurnAllowed&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;byte&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Documentation functions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; attachDocument&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _uri&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _contentHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; lookupDocument&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _name&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;transfer-checking-functions&quot;&gt;Transfer Checking Functions&lt;&#x2F;h3&gt;
&lt;p&gt;We introduce four new functions that should be used to check that the actions are allowed for the provided inputs. The implementation details of each function are left for the token issuer, it is the issuer&#x27;s responsibility to add all necessary checks that will validate an operation in accordance with KYC&#x2F;AML policies and legal requirements set for a specific token asset.&lt;&#x2F;p&gt;
&lt;p&gt;Each function must return a status code from the common set of Ethereum status codes (ESC), according to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1066&#x2F;&quot;&gt;ERC-1066&lt;&#x2F;a&gt;. Localization of these codes is out of the scope of this proposal and may be optionally solved by adopting &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1444&#x2F;&quot;&gt;ERC-1444&lt;&#x2F;a&gt; on the application level. If the operation is allowed by a checking function, the return status code must be &lt;code&gt;0x11&lt;&#x2F;code&gt; (Allowed) or an issuer-specific code with equivalent but more precise meaning. If the operation is not allowed by a checking function, the status must be &lt;code&gt;0x10&lt;&#x2F;code&gt; (Disallowed) or an issuer-specific code with equivalent but more precise meaning. Upon an internal error, the function must return the most relevant code from the general code table or an issuer-specific equivalent, example: &lt;code&gt;0xF0&lt;&#x2F;code&gt; (Off-Chain Failure).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;For &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; based tokens,&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;It is required that transfer function must be overridden with logic that checks the corresponding checkTransferAllowed return status code.&lt;&#x2F;li&gt;
&lt;li&gt;It is required that &lt;code&gt;transferFrom&lt;&#x2F;code&gt; function must be overridden with logic that checks the corresponding &lt;code&gt;checkTransferFromAllowed&lt;&#x2F;code&gt; return status code.&lt;&#x2F;li&gt;
&lt;li&gt;It is required that &lt;code&gt;approve&lt;&#x2F;code&gt; function must be overridden with logic that checks the corresponding &lt;code&gt;checkTransferFromAllowed&lt;&#x2F;code&gt; return status code.&lt;&#x2F;li&gt;
&lt;li&gt;Other functions such as &lt;code&gt;mint&lt;&#x2F;code&gt; and &lt;code&gt;burn&lt;&#x2F;code&gt; must be overridden, if they exist in the token implementation, they should check &lt;code&gt;checkMintAllowed&lt;&#x2F;code&gt; and &lt;code&gt;checkBurnAllowed&lt;&#x2F;code&gt; status codes accordingly.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;For &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;777&#x2F;&quot;&gt;ERC-777&lt;&#x2F;a&gt; based tokens,&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;It is required that &lt;code&gt;send&lt;&#x2F;code&gt; function must be overridden with logic that checks the corresponding return status codes:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;checkTransferAllowed&lt;&#x2F;code&gt; return status code, if transfer happens on behalf of the tokens owner;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;checkTransferFromAllowed&lt;&#x2F;code&gt; return status code, if transfer happens on behalf of an operator (i.e. delegated transfer).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;It is required that &lt;code&gt;burn&lt;&#x2F;code&gt; function must be overridden with logic that checks the corresponding &lt;code&gt;checkBurnAllowed&lt;&#x2F;code&gt; return status code.&lt;&#x2F;li&gt;
&lt;li&gt;Other functions, such as &lt;code&gt;mint&lt;&#x2F;code&gt; must be overridden, if they exist in the token implementation, e.g. if the security token is mintable. &lt;code&gt;mint&lt;&#x2F;code&gt; function must call &lt;code&gt;checkMintAllowed&lt;&#x2F;code&gt; ad check it return status code.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;For both cases,&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;It is required for guaranteed compatibility with ERC-20 and ERC-777 wallets that each checking function returns &lt;code&gt;0x11&lt;&#x2F;code&gt; (Allowed) if not overridden with the issuer&#x27;s custom logic.&lt;&#x2F;li&gt;
&lt;li&gt;It is required that all overridden checking functions must revert if the action is not allowed or an error occurred, according to the returned status code.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Inside checker functions the logic is allowed to use any feature available on-chain: perform calls to registry contracts with whitelists&#x2F;blacklists, use built-in checking logic that is defined on the same contract, or even run off-chain queries through an oracle.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;documentation-functions&quot;&gt;Documentation Functions&lt;&#x2F;h3&gt;
&lt;p&gt;We also introduce two new functions that should be used for document management purposes. Function &lt;code&gt;attachDocument&lt;&#x2F;code&gt; adds a reference pointing to an off-chain document, with specified name, URI and contents hash. The hashing algorithm is not specified within this standard, but the resulting hash must not be longer than 32 bytes. Function &lt;code&gt;lookupDocument&lt;&#x2F;code&gt; gets the referenced document by its name.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;It is not required to use documentation functions, they are optional and provided as a part of a legal framework.&lt;&#x2F;li&gt;
&lt;li&gt;It is required that if &lt;code&gt;attachDocument&lt;&#x2F;code&gt; function has been used, the document reference must have a unique name, overwriting the references under same name is not allowed. All implementations must check if the reference under the given name is already existing.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP targets both ERC-20 and ERC-777 based tokens, although the most emphasis is given to ERC-20 due to its widespread adoption. However, this extension is designed to be compatible with the forthcoming ERC-777 standard, as well.&lt;&#x2F;p&gt;
&lt;p&gt;All checking functions are named with prefixes &lt;code&gt;check&lt;&#x2F;code&gt; since they return check status code, not booleans, because that is important to facilitate the debugging and tracing process. It is responsibility of the issuer to implement the logic that will handle the return codes appropriately. Some handlers will simply throw errors, other handlers would log information for future process mining. More rationale for status codes can be seen in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1066&#x2F;&quot;&gt;ERC-1066&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;We require two different transfer validation functions: &lt;code&gt;checkTransferAllowed&lt;&#x2F;code&gt; and &lt;code&gt;checkTransferFromAllowed&lt;&#x2F;code&gt; since the corresponding &lt;code&gt;transfer&lt;&#x2F;code&gt; and &lt;code&gt;transferFrom&lt;&#x2F;code&gt; are usually called in different contexts. Some token standards such as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1450&#x2F;&quot;&gt;ERC-1450&lt;&#x2F;a&gt; explicitly disallow use of &lt;code&gt;transfer&lt;&#x2F;code&gt;, while allowing only &lt;code&gt;transferFrom&lt;&#x2F;code&gt;. There might be also different complex scenarios, where &lt;code&gt;transfer&lt;&#x2F;code&gt; and &lt;code&gt;transferFrom&lt;&#x2F;code&gt; should be treated differently. ERC-777 is relying on its own &lt;code&gt;send&lt;&#x2F;code&gt; for transferring tokens, so it is reasonable to switch between checker functions based on its call context. We decided to omit the &lt;code&gt;checkApprove&lt;&#x2F;code&gt; function since it would be used in exactly the same context as &lt;code&gt;checkTransferFromAllowed&lt;&#x2F;code&gt;. In many cases it is required not only regulate securities transfers, but also restrict burn and &lt;code&gt;mint&lt;&#x2F;code&gt; operations, and additional checker functions have been added for that.&lt;&#x2F;p&gt;
&lt;p&gt;The documentation functions that we propose here are a must-have tool to create dual-bindings with off-chain legal documents, a great example of this can be seen in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;medium.com&#x2F;@ZoeAdamovicz&#x2F;37376fd0384a&quot;&gt;Neufund&#x27;s Employee Incentive Options Plan&lt;&#x2F;a&gt; legal framework that implements full legal enforceability: the smart contract refers to printed ESOP Terms &amp;amp; Conditions Document, which itself refers back to smart contract. This is becoming a widely adopted practice even in cases where there are no legal requirements to reference the documents within the security token. However they&#x27;re almost always required, and it&#x27;s a good way to attach useful documentation of various types.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is fully backwards compatible as its implementation extends the functionality of ERC-20 and ERC-777 tokens.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;https:&#x2F;&#x2F;github.com&#x2F;AtlantPlatform&#x2F;BaseSecurityToken&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Node Discovery via DNS</title>
        <published>2018-09-26T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Felix Lange</name><uri>https://github.com/fjl</uri>
	</author>
	
	<author>
		<name>Péter Szilágyi</name><uri>https://github.com/karalabe</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1459/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/devp2p/issues/50" />
        

        <id>https://wg-eips.ritovision.com/1459/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="networking"
                label="Networking" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1459"
            label="EIP-1459" />
        

        
        

        
        <summary type="html">Scheme for authenticated updateable Ethereum node lists via DNS.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1459/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This document describes a scheme for authenticated, updateable Ethereum node
lists retrievable via DNS.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Many Ethereum clients contain hard-coded bootstrap node lists. Updating those
lists requires a software update. The current lists are small, giving the client
little choice of initial entry point into the Ethereum network. We would like to
maintain larger node lists containing hundreds of nodes, and update them
regularly.&lt;&#x2F;p&gt;
&lt;p&gt;The scheme described here is a replacement for client bootstrap node lists with
equivalent security and many additional benefits. Large lists populated by
traversing the node discovery DHT can serve as a fallback option for nodes which
can&#x27;t join the DHT due to restrictive network policy. DNS-based node lists may
also be useful to Ethereum peering providers because their customers can
configure the client to use the provider&#x27;s list.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;A &#x27;node list&#x27; is a list of &#x27;node records&#x27; &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;778&#x2F;&quot;&gt;as defined by EIP-778&lt;&#x2F;a&gt;
of arbitrary length. Lists
may refer to other lists using links. The entire list is signed using a
secp256k1 private key. The corresponding public key must be known to the client
in order to verify the list.&lt;&#x2F;p&gt;
&lt;p&gt;To refer to a DNS node list, clients use a URL with &#x27;enrtree&#x27; scheme. The URL
contains the DNS name on which the list can be found as well as the public key
that signed the list. The public key is contained in the username part of the
URL and is the base32 encoding (RFC-4648) of the compressed 32-byte binary public key.&lt;&#x2F;p&gt;
&lt;p&gt;Example:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;enrtree:&#x2F;&#x2F;AM5FCQLWIZX2QFPNJAP7VUERCCRNGRHWZG3YYHIUV7BVDQ5FDPRT2@nodes.example.org&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This URL refers to a node list at the DNS name &#x27;nodes.example.org&#x27; and is signed
by the public key
&lt;code&gt;0x049f88229042fef9200246f49f94d9b77c4e954721442714e85850cb6d9e5daf2d880ea0e53cb3ac1a75f9923c2726a4f941f7d326781baa6380754a360de5c2b6&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;dns-record-structure&quot;&gt;DNS Record Structure&lt;&#x2F;h3&gt;
&lt;p&gt;The nodes in a list are encoded as a merkle tree for distribution via the DNS
protocol. Entries of the merkle tree are contained in DNS TXT records. The root
of the tree is a TXT record with the following content:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;enrtree-root:v1 e=&amp;lt;enr-root&amp;gt; l=&amp;lt;link-root&amp;gt; seq=&amp;lt;sequence-number&amp;gt; sig=&amp;lt;signature&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;enr-root&lt;&#x2F;code&gt; and &lt;code&gt;link-root&lt;&#x2F;code&gt; refer to the root hashes of subtrees containing
nodes and links subtrees.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;sequence-number&lt;&#x2F;code&gt; is the tree&#x27;s update sequence number, a decimal integer.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;signature&lt;&#x2F;code&gt; is a 65-byte secp256k1 EC signature over the keccak256 hash of the
record content, excluding the &lt;code&gt;sig=&lt;&#x2F;code&gt; part, encoded as URL-safe base64 (RFC-4648).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Further TXT records on subdomains map hashes to one of three entry types. The
subdomain name of any entry is the base32 encoding of the (abbreviated)
keccak256 hash of its text content.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;enrtree-branch:&amp;lt;h₁&amp;gt;,&amp;lt;h₂&amp;gt;,...,&amp;lt;hₙ&amp;gt;&lt;&#x2F;code&gt; is an intermediate tree entry containing
hashes of subtree entries.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;enrtree:&#x2F;&#x2F;&amp;lt;key&amp;gt;@&amp;lt;fqdn&amp;gt;&lt;&#x2F;code&gt; is a leaf pointing to a different list located at
another fully qualified domain name. Note that this format matches the URL
encoding. This type of entry may only appear in the subtree pointed to by
&lt;code&gt;link-root&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;enr:&amp;lt;node-record&amp;gt;&lt;&#x2F;code&gt; is a leaf containing a node record. The node record is
encoded as a URL-safe base64 string. Note that this type of entry matches the
canonical ENR text encoding. It may only appear in the &lt;code&gt;enr-root&lt;&#x2F;code&gt; subtree.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;No particular ordering or structure is defined for the tree. Whenever the tree
is updated, its sequence number should increase. The content of any TXT record
should be small enough to fit into the 512 byte limit imposed on UDP DNS
packets. This limits the number of hashes that can be placed into an
&lt;code&gt;enrtree-branch&lt;&#x2F;code&gt; entry.&lt;&#x2F;p&gt;
&lt;p&gt;Example in zone file format:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;; name                        ttl     class type  content&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;@                             60      IN    TXT   enrtree-root:v1 e=JWXYDBPXYWG6FX3GMDIBFA6CJ4 l=C7HRFPF3BLGF3YR4DY5KX3SMBE seq=1 sig=o908WmNp7LibOfPsr4btQwatZJ5URBr2ZAuxvK4UWHlsB9sUOTJQaGAlLPVAhM__XJesCHxLISo94z5Z2a463gA&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;C7HRFPF3BLGF3YR4DY5KX3SMBE    86900   IN    TXT   enrtree:&#x2F;&#x2F;AM5FCQLWIZX2QFPNJAP7VUERCCRNGRHWZG3YYHIUV7BVDQ5FDPRT2@morenodes.example.org&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;JWXYDBPXYWG6FX3GMDIBFA6CJ4    86900   IN    TXT   enrtree-branch:2XS2367YHAXJFGLZHVAWLQD4ZY,H4FHT4B454P6UXFD7JCYQ5PWDY,MHTDO6TMUBRIA2XWG5LUDACK24&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;2XS2367YHAXJFGLZHVAWLQD4ZY    86900   IN    TXT   enr:-HW4QOFzoVLaFJnNhbgMoDXPnOvcdVuj7pDpqRvh6BRDO68aVi5ZcjB3vzQRZH2IcLBGHzo8uUN3snqmgTiE56CH3AMBgmlkgnY0iXNlY3AyNTZrMaECC2_24YYkYHEgdzxlSNKQEnHhuNAbNlMlWJxrJxbAFvA&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;H4FHT4B454P6UXFD7JCYQ5PWDY    86900   IN    TXT   enr:-HW4QAggRauloj2SDLtIHN1XBkvhFZ1vtf1raYQp9TBW2RD5EEawDzbtSmlXUfnaHcvwOizhVYLtr7e6vw7NAf6mTuoCgmlkgnY0iXNlY3AyNTZrMaECjrXI8TLNXU0f8cthpAMxEshUyQlK-AM0PW2wfrnacNI&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;MHTDO6TMUBRIA2XWG5LUDACK24    86900   IN    TXT   enr:-HW4QLAYqmrwllBEnzWWs7I5Ev2IAs7x_dZlbYdRdMUx5EyKHDXp7AV5CkuPGUPdvbv1_Ms1CPfhcGCvSElSosZmyoqAgmlkgnY0iXNlY3AyNTZrMaECriawHKWdDRk2xeZkrOXBQ0dfMFLHY4eENZwdufn1S1o&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;client-protocol&quot;&gt;Client Protocol&lt;&#x2F;h3&gt;
&lt;p&gt;To find nodes at a given DNS name, say &quot;mynodes.org&quot;:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Resolve the TXT record of the name and check whether it contains a valid
&quot;enrtree-root=v1&quot; entry. Let&#x27;s say the &lt;code&gt;enr-root&lt;&#x2F;code&gt; hash contained in the entry
is &quot;CFZUWDU7JNQR4VTCZVOJZ5ROV4&quot;.&lt;&#x2F;li&gt;
&lt;li&gt;Verify the signature on the root against the known public key and check
whether the sequence number is larger than or equal to any previous number
seen for that name.&lt;&#x2F;li&gt;
&lt;li&gt;Resolve the TXT record of the hash subdomain, e.g.
&quot;CFZUWDU7JNQR4VTCZVOJZ5ROV4.mynodes.org&quot; and verify whether the content
matches the hash.&lt;&#x2F;li&gt;
&lt;li&gt;The next step depends on the entry type found:
&lt;ul&gt;
&lt;li&gt;for &lt;code&gt;enrtree-branch&lt;&#x2F;code&gt;: parse the list of hashes and continue resolving them (step 3).&lt;&#x2F;li&gt;
&lt;li&gt;for &lt;code&gt;enr&lt;&#x2F;code&gt;: decode, verify the node record and import it to local node storage.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;During traversal, the client must track hashes and domains which are already
resolved to avoid going into an infinite loop. It&#x27;s in the client&#x27;s best
interest to traverse the tree in random order.&lt;&#x2F;p&gt;
&lt;p&gt;Client implementations should avoid downloading the entire tree at once during
normal operation. It&#x27;s much better to request entries via DNS when-needed, i.e.
at the time when the client is looking for peers.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-dns&quot;&gt;Why DNS?&lt;&#x2F;h3&gt;
&lt;p&gt;We have chosen DNS as the distribution medium because it is always available,
even under restrictive network conditions. The protocol provides low latency and
answers to DNS queries can be cached by intermediate resolvers. No custom server
software is needed. Node lists can be deployed to any DNS provider such as
CloudFlare DNS, dnsimple, Amazon Route 53 using their respective client
libraries.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-is-this-a-merkle-tree&quot;&gt;Why is this a merkle tree?&lt;&#x2F;h3&gt;
&lt;p&gt;Being a merkle tree, any node list can be authenticated by a single signature on
the root. Hash subdomains protect the integrity of the list. At worst
intermediate resolvers can block access to the list or disallow updates to it,
but cannot corrupt its content. The sequence number prevents replacing the root
with an older version.&lt;&#x2F;p&gt;
&lt;p&gt;Synchronizing updates on the client side can be done incrementally, which
matters for large lists. Individual entries of the tree are small enough to fit
into a single UDP packet, ensuring compatibility with environments where only
basic UDP DNS is available. The tree format also works well with caching
resolvers: only the root of the tree needs a short TTL. Intermediate entries and
leaves can be cached for days.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-does-the-link-subtree-exist&quot;&gt;Why does the link subtree exist?&lt;&#x2F;h3&gt;
&lt;p&gt;Links between lists enable federation and web-of-trust functionality. The
operator of a large list can delegate maintenance to other list providers. If
two node lists link to each other, users can use either list and get nodes from
both.&lt;&#x2F;p&gt;
&lt;p&gt;The link subtree is separate from the tree containing ENRs. This is done to
enable client implementations to sync these trees independently. A client
wanting to get as many nodes as possible will sync the link tree first and add
all linked names to the sync horizon.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Discovery via DNS is less secure than via DHT, because it relies on a trusted
party to publish the records regularly. The actor could easily eclipse
bootstrapping nodes by only publishing node records that it controls.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>ERC-1450 A compatible security token for issuing and trading SEC-compliant securities</title>
        <published>2018-09-25T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>John Shiple</name><uri>https://github.com/johnshiple</uri>
	</author>
	
	<author>
		<name>Howard Marks</name><email>howard@startengine.com</email>
	</author>
	
	<author>
		<name>David Zhang</name><email>david@startengine.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1450/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-proposal-ldgrtoken-a-compatible-security-token-for-issuing-and-trading-sec-compliant-securities/1468" />
        

        <id>https://wg-eips.ritovision.com/1450/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:1450"
            label="ERC-1450" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1450/">&lt;h1 id=&quot;erc-1450-a-compatible-security-token-for-issuing-and-trading-sec-compliant-securities&quot;&gt;ERC-1450 - A compatible security token for issuing and trading SEC-compliant securities&lt;&#x2F;h1&gt;
&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;ERC-1450&lt;&#x2F;code&gt; is an &lt;code&gt;ERC-20&lt;&#x2F;code&gt; compatible token that enables issuing tokens representing securities that are required to comply with one or more of the following &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.sec.gov&#x2F;smallbusiness&#x2F;exemptofferings&quot;&gt;Securities Act Regulations: Regulation Crowdfunding, Regulation D, and Regulation A&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;ERC-1450&lt;&#x2F;code&gt; facilitates the recording of ownership and transfer of securities sold in compliance with the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.sec.gov&#x2F;smallbusiness&#x2F;exemptofferings&quot;&gt;Securities Act Regulations CF, D and A&lt;&#x2F;a&gt;. The issuance and trading of securities is subject to the Securities Exchange Commission (SEC) and specific U.S. state blue sky laws and regulations.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;ERC-1450&lt;&#x2F;code&gt; manages securities ownership during issuance and trading. The Issuer is the only role that should create a &lt;code&gt;ERC-1450&lt;&#x2F;code&gt; and assign the RTA. The RTA is the only role that is allowed to execute &lt;code&gt;ERC-1450&lt;&#x2F;code&gt;’s &lt;code&gt;mint&lt;&#x2F;code&gt;, &lt;code&gt;burnFrom&lt;&#x2F;code&gt;, and &lt;code&gt;transferFrom&lt;&#x2F;code&gt; functions. No role is allowed to execute &lt;code&gt;ERC-1450&lt;&#x2F;code&gt;’s &lt;code&gt;transfer&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;With the advent of the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.sec.gov&#x2F;spotlight&#x2F;jobs-act.shtml&quot;&gt;JOBS Act&lt;&#x2F;a&gt; in 2012 and the launch of Regulation Crowdfunding and the amendments to Regulation A and Regulation D in 2016, there has been an expansion in the exemptions available to Issuers and Investors to sell and purchase securities that have not been &quot;registered&quot; with the SEC under the Securities Act of 1933.&lt;&#x2F;p&gt;
&lt;p&gt;There are currently no token standards that expressly facilitate conformity to securities law and related regulations. ERC-20 tokens do not support the regulated roles of Funding Portal, Broker Dealer, RTA, and Investor and do not support the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.occ.treas.gov&#x2F;topics&#x2F;compliance-bsa&#x2F;bsa&#x2F;index-bsa.html&quot;&gt;Bank Secrecy Act&#x2F;USA Patriot Act KYC and AML requirements&lt;&#x2F;a&gt;. Other improvements (notably &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;1404&quot;&gt;EIP-1404 (Simple Restricted Token Standard)&lt;&#x2F;a&gt; have tried to tackle KYC and AML regulatory requirement. This approach is novel because the RTA is solely responsible for performing KYC and AML and should be solely responsible for &lt;code&gt;transferFrom&lt;&#x2F;code&gt;, &lt;code&gt;mint&lt;&#x2F;code&gt;, and &lt;code&gt;burnFrom&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;ERC-1450&lt;&#x2F;code&gt; extends &lt;code&gt;ERC-20&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;erc-1450&quot;&gt;&lt;code&gt;ERC-1450&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;ERC-1450&lt;&#x2F;code&gt; requires that only the Issuer can create a token representing the security that only the RTA manages. Instantiating the &lt;code&gt;ERC-1450&lt;&#x2F;code&gt; requires the &lt;code&gt;Owned&lt;&#x2F;code&gt; and &lt;code&gt;IssuerControlled&lt;&#x2F;code&gt; modifiers, and only the Issuer should execute the &lt;code&gt;ERC-1450&lt;&#x2F;code&gt; constructor for a compliant token. &lt;code&gt;ERC-1450&lt;&#x2F;code&gt; extends the general &lt;code&gt;Ownable&lt;&#x2F;code&gt; modifier to describe a specific subset of owners that automate and decentralize compliance through the contract modifiers &lt;code&gt;Owned&lt;&#x2F;code&gt; and &lt;code&gt;IssuerControlled&lt;&#x2F;code&gt; and the function modifiers &lt;code&gt;onlyOwner&lt;&#x2F;code&gt; and &lt;code&gt;onlyIssuerTransferAgent&lt;&#x2F;code&gt;. The &lt;code&gt;Owned&lt;&#x2F;code&gt; contract modifier instantiates the &lt;code&gt;onlyOwner&lt;&#x2F;code&gt; modifier for functions. The &lt;code&gt;IssuerControlled&lt;&#x2F;code&gt; modifier instantiates the &lt;code&gt;onlyIssuerTransferAgent&lt;&#x2F;code&gt; modifier for functions.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;ERC-1450&lt;&#x2F;code&gt; must prevent anyone from executing the &lt;code&gt;transfer&lt;&#x2F;code&gt;, &lt;code&gt;allowance&lt;&#x2F;code&gt;, and &lt;code&gt;approve&lt;&#x2F;code&gt; functions and&#x2F;or implement these functions to always fail. &lt;code&gt;ERC-1450&lt;&#x2F;code&gt; updates the &lt;code&gt;transferFrom&lt;&#x2F;code&gt;, &lt;code&gt;mint&lt;&#x2F;code&gt;, and &lt;code&gt;burnFrom&lt;&#x2F;code&gt; functions. &lt;code&gt;transferFrom&lt;&#x2F;code&gt;, &lt;code&gt;mint&lt;&#x2F;code&gt;, and &lt;code&gt;burnFrom&lt;&#x2F;code&gt; may only be executed by the RTA and are restricted with the &lt;code&gt;onlyIssuerTransferAgent&lt;&#x2F;code&gt; modifier. Additionally, &lt;code&gt;ERC-1450&lt;&#x2F;code&gt; defines the functions &lt;code&gt;transferOwnership&lt;&#x2F;code&gt;, &lt;code&gt;setTransferAgent&lt;&#x2F;code&gt;, &lt;code&gt;setPhysicalAddressOfOperation&lt;&#x2F;code&gt;, and &lt;code&gt;isTransferAgent&lt;&#x2F;code&gt;.  Only the issuer may call the &lt;code&gt;transferOwnership&lt;&#x2F;code&gt;, &lt;code&gt;setTransferAgent&lt;&#x2F;code&gt;, and &lt;code&gt;setPhysicalAddressOfOperation&lt;&#x2F;code&gt; functions. Anyone may call the &lt;code&gt;isTransferAgent&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;issuers-and-rtas&quot;&gt;Issuers and RTAs&lt;&#x2F;h3&gt;
&lt;p&gt;For compliance reasons, the &lt;code&gt;ERC-1450&lt;&#x2F;code&gt; constructor must specify the issuer (the &lt;code&gt;owner&lt;&#x2F;code&gt;), the RTA (&lt;code&gt;transferAgent&lt;&#x2F;code&gt;), the security’s &lt;code&gt;name&lt;&#x2F;code&gt;, and the security’s &lt;code&gt;symbol&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;issuer-owned&quot;&gt;Issuer Owned&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;ERC-1450&lt;&#x2F;code&gt; must specify the &lt;code&gt;owner&lt;&#x2F;code&gt; in its constructor, apply the &lt;code&gt;Owned&lt;&#x2F;code&gt; modifier, and instantiate the &lt;code&gt;onlyOwner&lt;&#x2F;code&gt; modifier to enable specific functions to permit only the Issuer’s &lt;code&gt;owner&lt;&#x2F;code&gt; address to execute them. &lt;code&gt;ERC-1450&lt;&#x2F;code&gt; also defines the function &lt;code&gt;transferOwnership&lt;&#x2F;code&gt; which transfers ownership of the Issuer to the new &lt;code&gt;owner&lt;&#x2F;code&gt;’s address and can only be called by the &lt;code&gt;owner&lt;&#x2F;code&gt;. &lt;code&gt;transferOwnership&lt;&#x2F;code&gt; triggers the &lt;code&gt;OwnershipTransferred&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;issuer-controlled&quot;&gt;Issuer Controlled&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;IssuerControlled&lt;&#x2F;code&gt; maintains the Issuer’s ownership of their securities by owning the contract and enables the Issuer to set and update the RTA for the Issuer’s securities. &lt;code&gt;ERC-1450&lt;&#x2F;code&gt;‘s constructor must have an &lt;code&gt;IssuerControlled&lt;&#x2F;code&gt; modifier with the issuer specified in its &lt;code&gt;ERC-1450&lt;&#x2F;code&gt; constructor. &lt;code&gt;IssuerControlled&lt;&#x2F;code&gt; instantiates the &lt;code&gt;onlyIssuerTransferAgent&lt;&#x2F;code&gt; modifier for &lt;code&gt;ERC-1450&lt;&#x2F;code&gt; to enable specific functions (&lt;code&gt;setPhysicalAddressOfOperation&lt;&#x2F;code&gt; and &lt;code&gt;setTransferAgent&lt;&#x2F;code&gt;) to permit only the Issuer to execute these functions.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;register-transfer-agent-controlled&quot;&gt;Register Transfer Agent Controlled&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;ERC-1450&lt;&#x2F;code&gt; defines the &lt;code&gt;setTransferAgent&lt;&#x2F;code&gt; function (to change the RTA) and &lt;code&gt;setPhysicalAddressOfOperation&lt;&#x2F;code&gt; function (to change the Issuer’s address) and must restrict execution to the Issuer’s owner with the &lt;code&gt;onlyOwner&lt;&#x2F;code&gt; modifier. &lt;code&gt;setTransferAgent&lt;&#x2F;code&gt; must emit the &lt;code&gt;TransferAgentUpdated&lt;&#x2F;code&gt; event. &lt;code&gt;setPhysicalAddressOfOperation&lt;&#x2F;code&gt; must emit the &lt;code&gt;PhysicalAddressOfOperationUpdated&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;ERC-1450&lt;&#x2F;code&gt; must specify the &lt;code&gt;transferAgent&lt;&#x2F;code&gt; in its constructor and instantiate the &lt;code&gt;onlyIssuerTransferAgent&lt;&#x2F;code&gt; modifier to enable specific functions (&lt;code&gt;transferFrom&lt;&#x2F;code&gt;, &lt;code&gt;mint&lt;&#x2F;code&gt;, and &lt;code&gt;burnFrom&lt;&#x2F;code&gt;) to permit only the Issuer’s &lt;code&gt;transferAgent&lt;&#x2F;code&gt; address to execute them. &lt;code&gt;ERC-1450&lt;&#x2F;code&gt; also defines the public function &lt;code&gt;isTransferAgent&lt;&#x2F;code&gt; to lookup and identify the Issuer’s RTA.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;securities&quot;&gt;Securities&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;ERC-1450&lt;&#x2F;code&gt; updates the &lt;code&gt;transferFrom&lt;&#x2F;code&gt;, &lt;code&gt;mint&lt;&#x2F;code&gt;, and &lt;code&gt;burnFrom&lt;&#x2F;code&gt; functions by applying the &lt;code&gt;onlyIssuerTransferAgent&lt;&#x2F;code&gt; to enable the issuance, re-issuance, and trading of securities.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;erc-20-extension&quot;&gt;ERC-20 Extension&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;ERC-20&lt;&#x2F;code&gt; tokens provide the following functionality:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC20&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; who&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; allowance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Approval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;ERC-20&lt;&#x2F;code&gt; is extended as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * ERC-1450 is an ERC-20 compatible token that facilitates compliance with one or more of Securities Act Regulations CF, D and A. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * Implementations of the ERC-1450 standard must define the following optional ERC-20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *     fields:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * name - The name of the security&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * symbol - The symbol of the security&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * Implementations of the ERC-1450 standard must specify the following constructor&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *   arguments:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * _owner - the address of the owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * _transferAgent - the address of the transfer agent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * _name - the name of the security&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * _symbol - the symbol of the security&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *  Implementations of the ERC-1450 standard must implement the following contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *      modifiers:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * Owned - Only the address of the security’s issuer is permitted to execute the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *     token’s constructor. This modifier also sets up the onlyOwner function modifier.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * IssuerControlled - This modifier sets up the onlyIssuerTransferAgent function modifier.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * Implementations of the ERC-1450 standard must implement the following function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *      modifiers:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * onlyOwner - Only the address of the security’s issuer is permitted to execute the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *     functions transferOwnership, setTransferAgent, and setPhysicalAddressOfOperation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * onlyIssuerTransferAgent - Only the address of the issuer’s Registered Transfer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *     Agent is permitted to execute the functions transferFrom, mint, and burnFrom.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * Implementations of the ERC-1450 standard must implement the following required ERC-20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *     event to always fail:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * Approval - Should never be called as the functions that emit this event must be&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *     implemented to always fail. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * Implementations of the ERC-1450 standard must implement the following required&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *     ERC-20 functions to always fail:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * transfer - Not a legal, regulated call for transferring securities because&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *     the token holder initiates the token transfer. The function must be implemented to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *     always fail.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * allowance - Not a legal, regulated call for transferring securities because&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *     the token holder may not allow third parties to initiate token transfers. The&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *     function must be implemented to always fail.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * approve - Not a legal, regulated call for transferring securities because&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *     the token holder may not allow third parties to initiate token transfers. The&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *     function must be implemented to always fail.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * Implementations of the ERC-1450 standard must implement the following optional&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *     ERC-20 function:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * decimals - Must return &amp;#39;0&amp;#39; because securities are indivisible entities.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * Implementations of the ERC-1450 standard must implement the following functions:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * mint - Only the address of the issuer&amp;#39;s Registered Transfer Agent may create new&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *     securities.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * burnFrom - Only the address of the issuer’s Registered Transfer Agent may burn or &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *     destroy securities.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Contract ERC&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1450&lt;&#x2F;span&gt;&lt;span&gt; is Owned&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; IssuerControlled &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * The constructor must implement a modifier (Owned) that creates the onlyOwner modifier&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * to allow only the address of the issuer (the owner) to execute the transferOwnership,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * setTransferAgent, and setPhysicalAddressOfOperation functions. The construct must also&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * implement a modifier (TransferAgentControlled) that creates the onlyIssuerTransferAgent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * modifier to allow only the address of the issuer’s Registered Transfer Agent to execute&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * the functions transferFrom, mint, and burnFrom).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _transferAgent&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _symbol&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;          Owned&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_issuer) &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;TransferAgentControlled&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_transferAgent) &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * Specify that only the &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;issuer) may execute a function.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * onlyOwner requires the msg.sender to be the owner’s address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    modifier &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;onlyOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * Specify that only the issuer’s transferAgent may execute a function.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * onlyIssuerTransferAgent requires the msg.sender to be the transferAgent’s address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    modifier &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;onlyIssuerTransferAgent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * Transfer ownership of a security from one issuer to another issuer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * transferOwnership must implement the onlyOwner modifier to only allow the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *     address of the issuer’s owner to transfer ownership.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * transferOwnership requires the _newOwner address to be the address of the new&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *     issuer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transferOwnership&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;address _newOwner) &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;public&lt;&#x2F;span&gt;&lt;span&gt; onlyOwner;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * Triggered after transferOwnership is executed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    event &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;OwnershipTransferred&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * Sets the transfer agent for the security.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * setTransferAgent must implement the onlyOwner modifier to only allow the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *     address of the issuer’s specify the security’s transfer agent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * setTransferAgent requires the _newTransferAgent address to be the address of the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *     new transfer agent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;setTransferAgent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;address _newTransferAgent) &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;public&lt;&#x2F;span&gt;&lt;span&gt; onlyOwner;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * Triggered after setTransferAgent is executed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    event &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;TransferAgentUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;address indexed previousTransferAgent, address indexed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        newTransferAgent);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * Sets the issuers physical address of operation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * setPhysicalAddressOfOperation must implement the onlyOwner modifier to only allow&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *     the address of the issuer’s owner to transfer ownership.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * setPhysicalAddressOfOperation requires the _newPhysicalAddressOfOperation address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *     to be the new address of the issuer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;setPhysicalAddressOfOperation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;string _newPhysicalAddressOfOperation) &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;public&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        onlyOwner;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * Triggered after setPhysicalAddressOfOperation is executed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    event &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;PhysicalAddressOfOperationUpdated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;string previousPhysicalAddressOfOperation,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        string newPhysicalAddressOfOperation);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * Look up the security’s transfer agent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * isTransferAgent is a &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;public&lt;&#x2F;span&gt;&lt;span&gt; function.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * isTransferAgent requires the _lookup address to determine if that address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *   is the security’s transfer agent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isTransferAgent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;address _lookup) &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;public&lt;&#x2F;span&gt;&lt;span&gt; view &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;bool);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * transfer is not a legal, regulated call and must be implemented to always fail.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;address to, uint tokens) &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;bool success);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * Approval does not have to be implemented. This event should never be triggered as&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * the functions that emit this even are not legal, regulated calls.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    event &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Approval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;address indexed tokenOwner, address indexed spender, uint tokens);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * allowance is not a legal, regulated call and must be implemented to always fail.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    allowance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;address tokenOwner, address spender) &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;public&lt;&#x2F;span&gt;&lt;span&gt; constant &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;uint remaining);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * approve is not a legal, regulated call and must be implemented to always fail.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;address spender, uint tokens) &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;bool success);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * Transfer securities.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * transferFrom must implement the onlyIssuerTransferAgent modifier to only allow the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *     address of the issuer’s Registered Transfer Agent to transfer `ERC-1450`s.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * transferFrom requires the _from address to have _value tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * transferFrom requires that the _to address must not be 0 because securities must&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *     not destroyed in this manner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;address _from, address _to, uint256 _value) &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;public&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        onlyIssuerTransferAgent &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;bool);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * Create new securities.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * mint must implement the onlyIssuerTransferAgent modifier to only allow the address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *     of the issuer’s Registered Transfer Agent to mint `ERC-1450` tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * mint requires that the _to address must not be 0 because securities must&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *     not destroyed in this manner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * mint must add _value tokens to the _to address and increase the totalSupply by&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *     _value.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * mint must emit the Transfer event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;address _to, uint256 _value) &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;public&lt;&#x2F;span&gt;&lt;span&gt; onlyIssuerTransferAgent returns&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (bool);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * Burn or destroy securities.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * burnFrom must implement the onlyIssuerTransferAgent modifier to only allow the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *     address of the issuer’s Registered Transfer Agent to burn `ERC-1450`s.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * burnFrom requires the _from address to have _value tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * burnFrom must subtract _value tokens from the _from address and decrease the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *     totalSupply by _value.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * burnFrom must emit the Transfer event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;burnFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;address _who, uint256 _value) &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;public&lt;&#x2F;span&gt;&lt;span&gt; onlyIssuerTransferAgent returns&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (bool);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;securities-exchange-commission-requirements&quot;&gt;Securities Exchange Commission Requirements&lt;&#x2F;h3&gt;
&lt;p&gt;The SEC has very strict requirements as to the specific roles that are allowed to perform specific actions. Specifically, only the RTA may &lt;code&gt;mint&lt;&#x2F;code&gt; and &lt;code&gt;transferFrom&lt;&#x2F;code&gt; securities.&lt;&#x2F;p&gt;
&lt;p&gt;Implementers must maintain off-chain services and databases that record and track the Investor’s name, physical address, Ethereum address, and security ownership amount. The implementers and the SEC must be able to access the Investor’s private information on an as needed basis. Issuers and the RTA must be able to produce a current list of all Investors, including the names, addresses, and security ownership levels for every security at any given moment. Issuers and the RTA must be able to re-issue securities to Investors for a variety of regulated reasons.&lt;&#x2F;p&gt;
&lt;p&gt;Private Investor information must never be publicly exposed on a public blockchain.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;managing-investor-information&quot;&gt;Managing Investor Information&lt;&#x2F;h3&gt;
&lt;p&gt;Special care and attention must be taken to ensure that the personally identifiable information of Investors is never exposed or revealed to the public.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;issuers-who-lost-access-to-their-address-or-private-keys&quot;&gt;Issuers who lost access to their address or private keys&lt;&#x2F;h3&gt;
&lt;p&gt;There is no recourse if the Issuer loses access to their address to an existing instance of their securities. Special care and efforts must be made by the Issuer to secure and safely store their address and associated private key. The Issuer can reassign ownership to another Issuer but not in the case where the Issuer loses their private key.&lt;&#x2F;p&gt;
&lt;p&gt;If the Issuer loses access, the Issuer’s securities must be rebuilt using off-chain services. The Issuer must create (and secure) a new address. The RTA can read the existing Issuer securities, and the RTA can &lt;code&gt;mint&lt;&#x2F;code&gt; Investor securities accordingly under a new &lt;code&gt;ERC-1450&lt;&#x2F;code&gt; smart contract.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;registered-transfer-agents-who-lost-access-to-their-address-or-private-keys&quot;&gt;Registered Transfer Agents who lost access to their address or private keys&lt;&#x2F;h3&gt;
&lt;p&gt;If the RTA loses access, the RTA can create a new Ethereum address, and the Issuer can execute the &lt;code&gt;setTransferAgent&lt;&#x2F;code&gt; function to reassign the RTA.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;handling-investors-security-owners-who-lost-access-to-their-addresses-or-private-keys&quot;&gt;Handling Investors (security owners) who lost access to their addresses or private keys&lt;&#x2F;h3&gt;
&lt;p&gt;Investors may “lose” their credentials for a number of reasons: they simply “lost” their credentials, they were hacked or the victim of fraud, they committed securities-related fraud, or a life event (like death) occurred. Because the RTA manages the Issuer’s securities, the RTA may authorize ownership related changes of securities (as long as they are properly notarized and verified).&lt;&#x2F;p&gt;
&lt;p&gt;If an Investor (or, say, the Investor’s heir) loses their credentials, the Investor must go through a notarized process to notify the RTA of the situation and supply a new Investor address. From there, the RTA can &lt;code&gt;mint&lt;&#x2F;code&gt; the “lost” securities to the new Investor address and &lt;code&gt;burnFrom&lt;&#x2F;code&gt; the old Investor address (because the RTA knows all Investors’ addresses).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The are currently no token standards that facilitate compliance with SEC regulations. The closest token is &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;884&#x2F;&quot;&gt;ERC-884 (Delaware General Corporations Law (DGCL) compatible share token)&lt;&#x2F;a&gt; which states that SEC requirements are out of scope. &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;1404&quot;&gt;EIP-1404 (Simple Restricted Token Standard)&lt;&#x2F;a&gt; does not go far enough to address SEC requirements around re-issuing securities to Investors.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;ERC-1450&lt;&#x2F;code&gt; maintains compatibility with ERC-20 tokens with the following stipulations:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;function allowance(address tokenOwner, address spender) public constant returns (uint remaining);&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;Must be implemented to always fail because allowance is not a legal, regulated call for a security.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;function transfer(address to, uint tokens) public returns (bool success);&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;As the token holder initiates the transfer, must be implemented to always fail because transfer is not a legal, regulated call for a security.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;function approve(address spender, uint tokens) public returns (bool success);&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;Must be implemented to always fail because approve is not a legal, regulated call for a security&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;function transferFrom(address from, address to, uint tokens) public returns (bool success);&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;Must be implemented so that only the Issuer’s RTA can perform this action&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;event Approval(address indexed tokenOwner, address indexed spender, uint tokens);&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;Does not have to be implemented. Approval should never be called as the functions that emit this event must be implemented to always fail&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases are available at &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;StartEngine&#x2F;ldgr_smart_contracts&#x2F;tree&#x2F;master&#x2F;test&quot;&gt;https:&#x2F;&#x2F;github.com&#x2F;StartEngine&#x2F;ldgr_smart_contracts&#x2F;tree&#x2F;master&#x2F;test&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementations&quot;&gt;Implementations&lt;&#x2F;h2&gt;
&lt;p&gt;A reference implementation is available at &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;StartEngine&#x2F;ldgr_smart_contracts&quot;&gt;https:&#x2F;&#x2F;github.com&#x2F;StartEngine&#x2F;ldgr_smart_contracts&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright-waiver&quot;&gt;Copyright Waiver&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Localized Messaging with Signal-to-Text</title>
        <published>2018-09-23T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Brooklyn Zelenka</name><uri>https://github.com/expede</uri>
	</author>
	
	<author>
		<name>Jennifer Cooper</name><uri>https://github.com/jenncoop</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1444/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-1444-localized-messaging-with-signal-to-text/" />
        

        <id>https://wg-eips.ritovision.com/1444/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:1444"
            label="ERC-1444" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1444/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;A method of converting machine codes to human-readable text in any language and phrasing.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;An on-chain system for providing user feedback by converting machine-efficient codes into human-readable strings in any language or phrasing. The system does not impose a list of languages, but rather lets users create, share, and use the localizated text of their choice.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;There are many cases where an end user needs feedback or instruction from a smart contract. Directly exposing numeric codes does not make for good UX or DX. If Ethereum is to be a truly global system usable by experts and lay persons alike, systems to provide feedback on what happened during a transaction are needed in as many languages as possible.&lt;&#x2F;p&gt;
&lt;p&gt;Returning a hard-coded string (typically in English) only serves a small segment of the global population. This standard proposes a method to allow users to create, register, share, and use a decentralized collection of translations, enabling richer messaging that is more culturally and linguistically diverse.&lt;&#x2F;p&gt;
&lt;p&gt;There are several machine efficient ways of representing intent, status, state transition, and other semantic signals including booleans, enums and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1066&#x2F;&quot;&gt;ERC-1066 codes&lt;&#x2F;a&gt;. By providing human-readable messages for these signals, the developer experience is enhanced by returning easier to consume information with more context (ex. &lt;code&gt;revert&lt;&#x2F;code&gt;). End user experience is enhanced by providing text that can be propagated up to the UI.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;contract-architecture&quot;&gt;Contract Architecture&lt;&#x2F;h3&gt;
&lt;p&gt;Two types of contract: &lt;code&gt;LocalizationPreferences&lt;&#x2F;code&gt;, and &lt;code&gt;Localization&lt;&#x2F;code&gt;s.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;LocalizationPreferences&lt;&#x2F;code&gt; contract functions as a proxy for &lt;code&gt;tx.origin&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                                                   +--------------+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                                                   |              |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                                          +------&amp;gt; | Localization |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                                          |        |              |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                                          |        +--------------+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                                          |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                                          |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+-----------+          +-------------------------+        |        +--------------+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|           |          |                         | &amp;lt;------+        |              |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;| Requestor | &amp;lt;------&amp;gt; | LocalizationPreferences | &amp;lt;-------------&amp;gt; | Localization |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|           |          |                         | &amp;lt;------+        |              |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+-----------+          +-------------------------+        |        +--------------+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                                          |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                                          |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                                          |        +--------------+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                                          |        |              |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                                          +------&amp;gt; | Localization |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                                                   |              |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                                                   +--------------+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;localization&quot;&gt;&lt;code&gt;Localization&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;A contract that holds a simple mapping of codes to their text representations.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Localization&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; textFor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _text&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;textfor&quot;&gt;&lt;code&gt;textFor&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Fetches the localized text representation.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; textFor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _text&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;localizationpreferences&quot;&gt;&lt;code&gt;LocalizationPreferences&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;A proxy contract that allows users to set their preferred &lt;code&gt;Localization&lt;&#x2F;code&gt;. Text lookup is delegated to the user&#x27;s preferred contract.&lt;&#x2F;p&gt;
&lt;p&gt;A fallback &lt;code&gt;Localization&lt;&#x2F;code&gt; with all keys filled MUST be available. If the user-specified &lt;code&gt;Localization&lt;&#x2F;code&gt; has not explicitly set a loalization (ie. &lt;code&gt;textFor&lt;&#x2F;code&gt; returns &lt;code&gt;&quot;&quot;&lt;&#x2F;code&gt;), the &lt;code&gt;LocalizationPreferences&lt;&#x2F;code&gt; MUST redelegate to the fallback &lt;code&gt;Localization&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; LocalizationPreferences&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; set&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Localization&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _localization&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; textFor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _wasFound&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _text&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;set&quot;&gt;&lt;code&gt;set&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Registers a user&#x27;s preferred &lt;code&gt;Localization&lt;&#x2F;code&gt;. The registering user SHOULD be considered &lt;code&gt;tx.origin&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; set&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Localization&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _localization&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;textfor-1&quot;&gt;&lt;code&gt;textFor&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Retrieve text for a code found at the user&#x27;s preferred &lt;code&gt;Localization&lt;&#x2F;code&gt; contract.&lt;&#x2F;p&gt;
&lt;p&gt;The first return value (&lt;code&gt;bool _wasFound&lt;&#x2F;code&gt;) represents if the text is available from that &lt;code&gt;Localization&lt;&#x2F;code&gt;, or if a fallback was used. If the fallback was used in this context, the &lt;code&gt;textFor&lt;&#x2F;code&gt;&#x27;s first return value MUST be set to &lt;code&gt;false&lt;&#x2F;code&gt;, and is &lt;code&gt;true&lt;&#x2F;code&gt; otherwise.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; textFor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _wasFound&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _text&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;string-format&quot;&gt;String Format&lt;&#x2F;h3&gt;
&lt;p&gt;All strings MUST be encoded as &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.ietf.org&#x2F;rfc&#x2F;rfc3629.txt&quot;&gt;UTF-8&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;Špeĉiäl chârãçtérs are permitted&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;As are non-Latin characters: アルミ缶の上にあるみかん。&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;Emoji are legal: 🙈🙉🙊🎉&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;Feel free to be creative: (ﾉ◕ヮ◕)ﾉ*:･ﾟ✧&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;templates&quot;&gt;Templates&lt;&#x2F;h3&gt;
&lt;p&gt;Template strings are allowed, and MUST follow the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;pubs.opengroup.org&#x2F;onlinepubs&#x2F;009696799&#x2F;utilities&#x2F;printf.html&quot;&gt;ANSI C &lt;code&gt;printf&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; conventions.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;Satoshi&amp;#39;s true identity is %s&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Text with 2 or more arguments SHOULD use the POSIX parameter field extension.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;Knock knock. Who&amp;#39;s there? %1$s. %1$s who? %2$s!&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;bytes32-keys&quot;&gt;&lt;code&gt;bytes32&lt;&#x2F;code&gt; Keys&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;bytes32&lt;&#x2F;code&gt; is very efficient since it is the EVM&#x27;s base word size. Given the enormous number of elements (card(A) &amp;gt; 1.1579 × 10&lt;sup&gt;77&lt;&#x2F;sup&gt;), it can embed nearly any practical signal, enum, or state. In cases where an application&#x27;s key is longer than &lt;code&gt;bytes32&lt;&#x2F;code&gt;, hashing that long key can map that value into the correct width.&lt;&#x2F;p&gt;
&lt;p&gt;Designs that use datatypes with small widths than &lt;code&gt;bytes32&lt;&#x2F;code&gt; (such as &lt;code&gt;bytes1&lt;&#x2F;code&gt; in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1066&#x2F;&quot;&gt;ERC-1066&lt;&#x2F;a&gt;) can be directly embedded into the larger width. This is a trivial one-to-one mapping of the smaller set into the larger one.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;local-vs-globals-and-singletons&quot;&gt;Local vs Globals and Singletons&lt;&#x2F;h3&gt;
&lt;p&gt;This spec has opted to not &lt;em&gt;force&lt;&#x2F;em&gt; a single global registry, and rather allow any contract and use case deploy their own system. This allows for more flexibility, and does not restrict the community for opting to use singleton &lt;code&gt;LocalizationPreference&lt;&#x2F;code&gt; contracts for common use cases, share &lt;code&gt;Localization&lt;&#x2F;code&gt;s between different proxys, delegate translations between &lt;code&gt;Localization&lt;&#x2F;code&gt;s, and so on.&lt;&#x2F;p&gt;
&lt;p&gt;There are many practical uses of agreed upon singletons. For instance, translating codes that aim to be fairly universal and integrated directly into the broader ecosystem (wallets, frameworks, debuggers, and the like) will want to have a single &lt;code&gt;LocalizationPreference&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Rather the dispersing several &lt;code&gt;LocalizationPreference&lt;&#x2F;code&gt;s for different use cases and codes, one could imagine a global &quot;registry of registries&quot;. While this approach allows for a unified lookups of all translations in all use cases, it is antithetical to the spirit of decentralization and freedom. Such a system also increases the lookup complexity, places an onus on getting the code right the first time (or adding the overhead of an upgradable contract), and need to account for use case conflicts with a &quot;unified&quot; or centralized numbering system. Further, lookups should be lightweight (especially in cases like looking up revert text).&lt;&#x2F;p&gt;
&lt;p&gt;For these reasons, this spec chooses the more decentralized, lightweight, free approach, at the cost of on-chain discoverability. A registry could still be compiled, but would be difficult to enforce, and is out of scope of this spec.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;off-chain-storage&quot;&gt;Off Chain Storage&lt;&#x2F;h3&gt;
&lt;p&gt;A very viable alternative is to store text off chain, with a pointer to the translations on-chain, and emit or return a &lt;code&gt;bytes32&lt;&#x2F;code&gt; code for another party to do the lookup. It is difficult to guarantee that off-chain resources will be available, and requires coordination from some other system like a web server to do the code-to-text matching. This is also not compatible with &lt;code&gt;revert&lt;&#x2F;code&gt; messages.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;ascii-vs-utf-8-vs-utf-16&quot;&gt;ASCII vs UTF-8 vs UTF-16&lt;&#x2F;h3&gt;
&lt;p&gt;UTF-8 is the most widely used encoding at time of writing. It contains a direct embedding of ASCII, while providing characters for most natural languages, emoji, and special characters.&lt;&#x2F;p&gt;
&lt;p&gt;Please see the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;utf8everywhere.org&#x2F;&quot;&gt;UTF-8 Everywhere Manifesto&lt;&#x2F;a&gt; for more information.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;when-no-text-is-found&quot;&gt;When No Text is Found&lt;&#x2F;h3&gt;
&lt;p&gt;Returning a blank string to the requestor fully defeats the purpose of a localization system. The two options for handling missing text are:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;A generic &quot;text not found&quot; message in the preferred language&lt;&#x2F;li&gt;
&lt;li&gt;The actual message, in a different language&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h4 id=&quot;generic-option&quot;&gt;Generic Option&lt;&#x2F;h4&gt;
&lt;p&gt;This designed opted to not use generic fallback text. It does not provide any useful information to the user other than to potentially contact the &lt;code&gt;Localization&lt;&#x2F;code&gt; maintainer (if one even exists and updating is even possible).&lt;&#x2F;p&gt;
&lt;h4 id=&quot;fallback-option&quot;&gt;Fallback Option&lt;&#x2F;h4&gt;
&lt;p&gt;The design outlined in this proposal is to providing text in a commonly used language (ex. English or Mandarin). First, this is the language that will be routed to if the user has yet to set a preference. Second, there is a good chance that a user may have &lt;em&gt;some&lt;&#x2F;em&gt; proficiency with the language, or at least be able to use an automated translation service.&lt;&#x2F;p&gt;
&lt;p&gt;Knowing that the text fell back via &lt;code&gt;textFor&lt;&#x2F;code&gt;s first return field boolean is &lt;em&gt;much&lt;&#x2F;em&gt; simpler than attempting language detection after the fact. This information is useful for certain UI cases. for example where there may be a desire to explain why localization fell back.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;decentralized-text-crowdsourcing&quot;&gt;Decentralized Text Crowdsourcing&lt;&#x2F;h3&gt;
&lt;p&gt;In order for Ethereum to gain mass adoption, users must be able to interact with it in the language, phrasing, and level of detail that they are most comfortable with. Rather than imposing a fixed set of translations as in a traditional, centralized application, this EIP provides a way for anyone to create, curate, and use translations. This empowers the crowd to supply culturally and linguistically diverse messaging, leading to broader and more distributed access to information.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;printf-style-format-strings&quot;&gt;&lt;code&gt;printf&lt;&#x2F;code&gt;-style Format Strings&lt;&#x2F;h3&gt;
&lt;p&gt;C-style &lt;code&gt;printf&lt;&#x2F;code&gt; templates have been the de facto standard for some time. They have wide compatibility across most languages (either in standard or third-party libraries). This makes it much easier for the consuming program to interpolate strings with low developer overhead.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;parameter-fields&quot;&gt;Parameter Fields&lt;&#x2F;h4&gt;
&lt;p&gt;The POSIX parameter field extension is important since languages do not share a common word order. Parameter fields enable the reuse and rearrangement of arguments in different localizations.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;%1$s is an element with the atomic number %2$d!&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Mercury&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 80&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; =&amp;gt; &amp;quot;Mercury is an element with the atomic number 80!&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;simplified-localizations&quot;&gt;Simplified Localizations&lt;&#x2F;h4&gt;
&lt;p&gt;Localization text does not require use of all parameters, and may simply ignore values. This can be useful for not exposing more technical information to users that would otherwise find it confusing.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;ruby&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;!&#x2F;usr&#x2F;bin&#x2F;env ruby&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;sprintf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;%1$s é um elemento&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Mercurio&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 80&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; =&amp;gt; &amp;quot;Mercurio é um elemento&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;clojure&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#!&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;usr&#x2F;bin&#x2F;env clojure&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;format&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Element #%2$s&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Mercury&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 80&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;; =&amp;gt; Element #80&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;interpolation-strategy&quot;&gt;Interpolation Strategy&lt;&#x2F;h3&gt;
&lt;p&gt;Please note that it is highly advisable to return the template string &lt;em&gt;as is&lt;&#x2F;em&gt;, with arguments as multiple return values or fields in an &lt;code&gt;event&lt;&#x2F;code&gt;, leaving the actual interpolation to be done off chain.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AtomMessage&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; templateCode&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; atomCode&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; atomicNumber&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#!&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;usr&#x2F;bin&#x2F;env node&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; printf&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;printf&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; returnValues&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; templateCode&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; atomCode&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; atomicNumber&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; eventResponse&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; template&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; AppText&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;textFor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;templateCode&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; =&amp;gt; &amp;quot;%1$s ist ein Element mit der Ordnungszahl %2$d!&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; atomName&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; PeriodicTableText&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;textFor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;atomCode&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; =&amp;gt; &amp;quot;Merkur&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;printf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;template&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; atomName&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 80&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; =&amp;gt; &amp;quot;Merkur ist ein Element mit der Ordnungszahl 80!&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;unspecified-behaviour&quot;&gt;Unspecified Behaviour&lt;&#x2F;h3&gt;
&lt;p&gt;This spec does not specify:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Public or private access to the default &lt;code&gt;Localization&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Who may set text
&lt;ul&gt;
&lt;li&gt;Deployer&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;onlyOwner&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Anyone&lt;&#x2F;li&gt;
&lt;li&gt;Whitelisted users&lt;&#x2F;li&gt;
&lt;li&gt;and so on&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;When text is set
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;constructor&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Any time&lt;&#x2F;li&gt;
&lt;li&gt;Write to empty slots, but not overwrite existing text&lt;&#x2F;li&gt;
&lt;li&gt;and so on&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;These are intentionally left open. There are many cases for each of these, and restricting any is fully beyond the scope of this proposal.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.4.25&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Localization&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; dictionary_&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Currently overwrites anything&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; set&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _code&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _message&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    dictionary_&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_code&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; _message&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; textFor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _message&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; dictionary_&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_code&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; LocalizationPreference&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Localization&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; registry_&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Localization &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;public&lt;&#x2F;span&gt;&lt;span&gt; defaultLocalization&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; empty_ &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Localization&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _defaultLocalization&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    defaultLocalization &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _defaultLocalization&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; set&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Localization&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _localization&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    registry_&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;origin&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; _localization&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_code&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;origin&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Primarily for testing&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _code&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _who&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; text &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getLocalizationFor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_who&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;textFor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;text&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; empty_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; text&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; defaultLocalization&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;textFor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getLocalizationFor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _who&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Localization&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Localization&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;registry_&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_who&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Localization&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Localization&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;defaultLocalization&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Localization&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;registry_&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;origin&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>dApp Components (avatar) &amp; Universal Wallet</title>
        <published>2018-09-21T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Jet Lim</name><uri>https://github.com/Nitro888</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1438/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethresear.ch/t/avatar-system-and-universal-wallet-for-ethereum-address/3473" />
        

        <id>https://wg-eips.ritovision.com/1438/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1438"
            label="ERC-1438" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1438/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Contracts are open source based. And most developers use the public contracts at the start of the project to modify or simply include them. This is project-oriented centralized development and I think it is a waste of resources. Therefore, we propose to make dApp or contracts component-ready for use in other services.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;There have been suggestions for modified tokens based on erc20, but since many tokens have already been built on erc20, it is necessary to increase the utilization of already developed erc20 tokens. Therefore, we propose a universal wallet that can use erc20 tokens universally. We also propose a component dApp that allows you to create and save your avatar (&amp;amp; social badge system), and use it immediately in other services. All of the dApps suggested in this document are based on decentralized development and use that anyone can create and participate in.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;While many projects are under development in an open source way, they are simply adding and deploy with open sources to their projects. This means that you are developing a centralized service that uses your own dApp-generated information on your own. In order to improve the block chain ecosystem, all resources created by dApp and placed in the public block chain must be reusable in another dApp. This means that you can enhance your service by exchanging the generated information with other dApp. Likewise, ERC20 Tokens require Universal Wallet standards to be easy to use for direct transactions.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;seeds-for-improvement-of-the-blockchain-ecosystem&quot;&gt;Seeds for improvement of the blockchain ecosystem.&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Synergy - With other dApps and resources.&lt;&#x2F;li&gt;
&lt;li&gt;Enhanced interface - For ERC20 tokens.&lt;&#x2F;li&gt;
&lt;li&gt;Easy &amp;amp; Decentralized - Everyone should be able to add to their services easily, without censorship.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;the-following-avatar-store-badge-system-and-universal-wallet-are-kind-of-examples-about-component-dapp&quot;&gt;The following avatar store, badge system, and universal wallet are kind of examples about component dApp.&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1438&#x2F;.&#x2F;assets&#x2F;intro.png&quot; alt=&quot;intro&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;1-avatar&quot;&gt;1. Avatar&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;1-1-avatar-shop&quot;&gt;1.1. Avatar Shop&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;The avatar store is created after ERC20 currency is set.&lt;&#x2F;li&gt;
&lt;li&gt;You can customize asset category &amp;amp; viewer script.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;1-2-upload-asset-user-data&quot;&gt;1.2. Upload asset &amp;amp; user data&lt;&#x2F;h4&gt;
&lt;p&gt;The avatar&#x27;s information &amp;amp; assets are stored in the event log part of the block chain.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Assets are SVG format. (compressed with gzip)&lt;&#x2F;li&gt;
&lt;li&gt;avatar information data is json (compressed with msgpack)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1438&#x2F;.&#x2F;assets&#x2F;avatar.png&quot; alt=&quot;avatar&quot; &#x2F;&gt;
** The avatar assets from &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;fangpenlin&#x2F;avataaars&quot;&gt;Avataaars&lt;&#x2F;a&gt; developed by &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;twitter.com&#x2F;fangpenlin&quot;&gt;Fang-Pen Lin&lt;&#x2F;a&gt;, the original avatar is designed by &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;twitter.com&#x2F;pablostanley&quot;&gt;Pablo Stanley&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;2-universal-wallet&quot;&gt;2. Universal Wallet&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1438&#x2F;.&#x2F;assets&#x2F;wallet.png&quot; alt=&quot;wallet&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;2-1-erc20-interface&quot;&gt;2.1. ERC20 interface&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ERC20Interface&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenOwner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; balance&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; allowance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenOwner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; remaining&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokens&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokens&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokens&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokens&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Approval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenOwner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokens&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;2-2-fixed-erc20-contract-for-receive-approval-and-execute-function-in-one-call&quot;&gt;2.2. Fixed ERC20 contract for receive approval and execute function in one call&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approveAndCall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokens&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    allowed&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;spender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokens&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Approval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokens&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    ApproveAndCallFallBack&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;spender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;receiveApproval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokens&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;2-3-and-approveandcallfallback-contract-for-fixed-erc20&quot;&gt;2.3. And ApproveAndCallFallBack contract for Fixed ERC20.&lt;&#x2F;h4&gt;
&lt;p&gt;However, many ERC20 tokens are not prepared.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ApproveAndCallFallBack&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; receiveApproval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokens&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;2-4-universal-wallet&quot;&gt;2.4. Universal Wallet&lt;&#x2F;h4&gt;
&lt;p&gt;We propose a Universal Wallet to solve this problem.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; UniversalWallet&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _Base&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _msgPack&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _Base&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_msgPack&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;-------------------------------------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; erc20 interface&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;-------------------------------------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _erc20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; balance&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_erc20&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;balance&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _ERC20Interface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_erc20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _erc20&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokens&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_erc20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_tokens&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_erc20&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;            _to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_tokens&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        else&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _ERC20Interface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_erc20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_tokens&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _erc20&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokens&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_erc20&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _ERC20Interface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_erc20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_tokens&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;-------------------------------------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; pay interface&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;-------------------------------------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; pay&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _store&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokens&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _options&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; erc20&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;   =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _ApproveAndCallFallBack&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_store&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;erc20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _ApproveAndCallFallBack&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_store&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;spender&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;erc20&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;erc20&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_tokens&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            _ApproveAndCallFallBack&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_store&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;receiveApproval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_options&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            _ERC20Interface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;erc20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_tokens&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            _ApproveAndCallFallBack&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_store&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;receiveApproval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_options&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; pay&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _store&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokens&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _msgPack&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; erc20&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;   =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _ApproveAndCallFallBack&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_store&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;erc20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _ApproveAndCallFallBack&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_store&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;spender&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;erc20&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;erc20&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_tokens&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            _ApproveAndCallFallBack&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_store&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;receiveApproval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_msgPack&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            _ERC20Interface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;erc20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_tokens&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            _ApproveAndCallFallBack&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_store&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;receiveApproval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_msgPack&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;https:&#x2F;&#x2F;www.nitro888.com&lt;&#x2F;li&gt;
&lt;li&gt;https:&#x2F;&#x2F;github.com&#x2F;Nitro888&#x2F;nitro888.github.io&lt;&#x2F;li&gt;
&lt;li&gt;https:&#x2F;&#x2F;github.com&#x2F;Nitro888&#x2F;dApp-Alliance&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Poll Standard</title>
        <published>2018-09-16T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Chaitanya Potti</name><uri>https://github.com/chaitanyapotti</uri>
	</author>
	
	<author>
		<name>Partha Bhattacharya</name><uri>https://github.com/pb25193</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1417/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/1417" />
        

        <id>https://wg-eips.ritovision.com/1417/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:1417"
            label="ERC-1417" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1417/">&lt;h2 id=&quot;note-to-readers&quot;&gt;Note to Readers&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;We have created a couple of implementations of polls for varied use cases.
Please refer to them &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;chaitanyapotti&#x2F;Voting&quot;&gt;here&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;A standard interface for Polls to be used with EIP-1261 (MVT).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The following standard allows for the implementation of a standard API for polls to be used with MVTs (refer &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1261&#x2F;&quot;&gt;EIP-1261&lt;&#x2F;a&gt;). The standard provides basic functionality to vote, unvote, tally votes, get voter turnout, and a lot more. The poll standard attempts to modularize blockchain voting by breaking down a poll into 4 crucial building blocks: voterbase qualification, vote weight calculation, vote consequences, and vote tallying. By creating a common interface for polls that have different kinds of building blocks, the poll standard makes it possible to make interactive front end applications which can seamlessly get data from a poll contract in order to bring transparency into consensus and decision making on the blockchain.&lt;&#x2F;p&gt;
&lt;p&gt;We considered the usage of polls with MVTs because MVTs serve as a permissioning mechanism. The manual permissioning of polls allows for vote weightage functions to take up several shapes and forms. Hence the voterbase function applies several logical checks on the vote sender to confirm that they are member(see EIP 1261) of a certain entity or combination of entities. For the specification of the nature of voting, we define the vote weight function. The vote weight function decides how much of vote share each voter will receive and this can be based on several criteria, some of which are listed below in this article. There are certain kinds of polls that enforce certain consequences on the voter, for example a poll may require a voter to lock in a certain amount of tokens, or require the voter to pay a small fee. These on-chain consequences can be coded into the consequence module of the poll standard. Finally, the last module is where the votes are added. A ballot for each candidate is updated whenever relevant, depending on the vote value, and the corresponding NoV count(number of voters). This module is common for most polls, and is the most straightforward. Polls may be time bound, ie. having a finish time, after which no votes are recorded, or be unbound, such that there is no finish time. The following are some examples of specific polls which leverage the flexibility of the poll standard, and it is possible to come up with several others:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Plurality Voting: The simplest form of voting is when you want all eligible voters to have one vote per person. This is the simplest to code, as the vote weight is 1, and there is no vote consequence. The only relevant module here is the voterbase, which can be categorized by one or more MVT contracts.&lt;&#x2F;li&gt;
&lt;li&gt;Token proportional voting: This kind of a poll is actually possible without the use of a voterbase function, because the vote weight function having token proportionality automatically rules out addresses which don&#x27;t hold the appropriate ERC - 20&#x2F; ERC - 777 token. However the voterbase function may be leveraged to further permission the system and give voting rights only to a fixed subset of token holders.&lt;&#x2F;li&gt;
&lt;li&gt;Capped Token Proportional Voting: This is a modified version of the previous example, where each voter is given proportional vote share only until a certain limit of token ownership. After exceeding that limit, holding more coins does not add more vote share. This format leverages the voterbase module effectively, disallowing people from spreading their coins across multiple addresses by allowing the admin to control which addresses can vote.&lt;&#x2F;li&gt;
&lt;li&gt;Delegated Voting: Certain polls may allow voters to delegate their votes to other voters. This is known as delegated voting or liquid democracy. For such a poll, a complicated vote weight function is needed, and a data structure concerning the voterbase is also required. A consequence of voting here would be that a user cannot delegate, and a consequence of delegating is that a user cannot vote. Sample implementation of polls contains an example of this vote scheme.&lt;&#x2F;li&gt;
&lt;li&gt;Karma Based Voting: A certain form of poll may be based on weightage from digital respect. This digital respect would be like a simple upvote from one member of voterbase to another. A mapping of mappings along with an appropriate vote weight function can serve this purpose. Sample implementation has an example.&lt;&#x2F;li&gt;
&lt;li&gt;Quadratic voting: A system where each vote is associated with a fee, and the fee is proportional to the square of the vote weight that the voter wants. This can be designed by applying a vote weight based on the transaction message, and then charging a fee in the vote consequence module.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The poll standard is intended to be a smart contract standard that makes poll deployment flexible, transparent and accessible.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;A standard interface allows any user or applications to work with any Poll contract on Ethereum. We provide for simple ERC-1417 smart contracts. Additional applications are discussed below.&lt;&#x2F;p&gt;
&lt;p&gt;This standard is inspired by the lack of governance tools in the blockchain space. Whenever there is a consensus collection exercise, someone goes ahead and deploys some kind of poll, and there is no standard software for accessing the data on the poll. For an end user who is not a developer, this is a real problem. The poll, which might be fully transparent, appears to be completely opaque to a common user who does not understand blockchain. In order for developers to build applications for interacting with and accessing poll data, and for poll deployers to have ready application level support, there must be a standardization of poll interfaces.&lt;&#x2F;p&gt;
&lt;p&gt;This realization happened while conducting market research on DAICOs. The first ever DAICO, Abyss, had far from optimal user experience, and abysmal transparency. Since then, we have been working on a poll standard. During the process, we came across EIP 1202, the voting standard, and found that the discussion there had already diverged from our thoughts to an extent that it made sense to publish a separate proposal altogether. Some of the benefits brought by the poll standard - EIP 1417 aims to offer some additional benefits.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Modularization: EIP 1417 modularizes the code present in the poll standard into 4 major building blocks based on functionality. These are: voterbase logic, vote weight calculation, vote consequence processing, and tallying module. This makes it easy for developers to change parts of a poll without disrupting other parts, and also helps people understand better, code written in the same format by other people.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Permissioning: Permissioning is an important aspect of polls, and is missing in most poll proposals so far, on the blockchain. For some reason, most blockchain based polls seem to consider token holding as the only way to permission a poll. However this hampers flexibility, and hence our poll standard is leveraging EIP 1261 in order to clear the permissioning hurdle. Not only does it allow for more creative poll structures in terms of vote weightage, but even improves the flexibility in permissioning by allowing developers to combine several entities and read attributes from entities.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Flexibility: The vote weight module of the poll standard can be used effectively to design various kinds of poll contracts which function differently and are suited to different environments. Some examples are quadratic voting, karma voting, delegated voting, token based voting, and one person one vote systems. These schemes are possible due to the separation of voterbase creation and vote weight calculation.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;NoV Counts: Several weighted polls have struggled to provide proper transparency because they only show the final result without enough granularity. This is because they do not store the number of voters that have voted for each proposal, and only store the total accrued vote for each option. EIP 1417 solves this by additionally recording number of voters(NoV) in each proposal. This NoV count is redundant in the case of one person one vote, but elsewhere, it is helpful in figuring out concentration of power. This ensures that malicious parties can be traced to a larger extent.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Event Logging: The poll standard logs an event during a successful vote, unsuccessful vote, and a successful unvote. This is being done so that in the event of a malicious admin removing real members or adding fake members, communities can build tools in order to perform advanced audits and simulate results in the absence of the malicious attack. Such advanced features are completely absent in most polls, and hence, it is hard to investigate such polls.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Pollscan.io: The Electus foundation is working on a web based application for accessing and interacting with poll data on the blockchain, it will be deployed on the domain name www.pollscan.io in the coming months.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;All that being said, we are very excited to share our proposal with the community and open up to suggestions in this space.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;benefits&quot;&gt;Benefits&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;Building applications (pollscan.io) on top of a standardized voting interface enables transparency and encourage more DAO&#x2F;DAICO&#x27;s to act responsibly in terms of governance&lt;&#x2F;li&gt;
&lt;li&gt;Create Action contracts which take actions programmatically based on the result of a poll&lt;&#x2F;li&gt;
&lt;li&gt;Allow the compatibility with token standard such as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; or (.&#x2F;00777.md)) and membership standard such as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1261&#x2F;&quot;&gt;EIP-1261&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Flexibility allows for various voting schemes including but not limited to modern schemes such as PLCR Voting&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;use-cases&quot;&gt;Use-cases:&lt;&#x2F;h3&gt;
&lt;p&gt;Polls are useful in any context of collective decision making, which include but aren&#x27;t limited to:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Governing public resources, like ponds, playgrounds, streets etc&lt;&#x2F;li&gt;
&lt;li&gt;Maintaining fiscal policy in a transparent consensus driven manner&lt;&#x2F;li&gt;
&lt;li&gt;Governing crowdfunded projects - refer DAICO, Vitalik Buterin&lt;&#x2F;li&gt;
&lt;li&gt;Implementation of Futarchy&lt;&#x2F;li&gt;
&lt;li&gt;Decision making in political parties, and municipal corporations&lt;&#x2F;li&gt;
&lt;li&gt;Governing expenditure of a cryptocurrency community&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Every ERC-1417 compliant contract must implement the &lt;code&gt;ERC1417&lt;&#x2F;code&gt; and &lt;code&gt;ERC165&lt;&#x2F;code&gt; interfaces&lt;&#x2F;strong&gt; (subject to &quot;caveats&quot; below):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-1417 Poll Standard&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;blob&#x2F;master&#x2F;EIPS&#x2F;.&#x2F;01417.md&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;  Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0x4fad898b.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IPoll&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when a person tries to vote without permissions. Useful for auditing purposes.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  E.g.: To prevent an admin to revoke permissions; calculate the result had they not been removed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; User who tried to vote&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the index of the proposal he voted to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voteWeight&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the weight of his vote&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TriedToVote&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; voteWeight&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when a person votes successfully&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; User who successfully voted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the index of the proposal he voted to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voteWeight&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the weight of his vote&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CastVote&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; voteWeight&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when a person revokes his vote&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; User who successfully unvoted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the index of the proposal he unvoted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voteWeight&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the weight of his vote&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RevokedVote&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; voteWeight&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Handles the vote logic&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; updates the appropriate data structures regarding the vote.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  stores the proposalId against the user to allow for unvote&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _proposalId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the index of the proposal in the proposals array&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; vote&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _proposalId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Handles the unvote logic&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; updates the appropriate data structures regarding the unvote&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revokeVote&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; gets the proposal names&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; limit the proposal count to 32 (for practical reasons), loop and generate the proposal list&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; list of names of proposals&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getProposals&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; returns a boolean specifying whether the user can vote&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; implement logic to enable checks to determine whether the user can vote&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  if using eip-1261, use protocol addresses and interface (IERC1261) to enable checking with attributes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the person who can vote&#x2F;not&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; boolean as to whether the user can vote&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; canVote&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; gets the vote weight of the proposalId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; returns the current cumulative vote weight of a proposal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _proposalId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the index of the proposal in the proposals array&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; cumulative vote weight of the specified proposal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getVoteTally&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _proposalId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; gets the no. of voters who voted for the proposal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; use a struct to keep a track of voteWeights and voterCount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _proposalId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the index of the proposal in the proposals array&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; voter count of the people who voted for the specified proposal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getVoterCount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _proposalId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; calculates the vote weight associated with the person `_to`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; use appropriate logic to determine the vote weight of the individual&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  For sample implementations, refer to end of the eip&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the person whose vote weight is being calculated&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; vote weight of the individual&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calculateVoteWeight&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; gets the leading proposal at the current time&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; calculate the leading proposal at the current time&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  For practical reasons, limit proposal count to 32.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; index of the proposal which is leading&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; winningProposal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; gets the name of the poll e.g.: &amp;quot;Admin Election for Autumn 2018&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Set the name in the constructor of the poll&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; name of the poll&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getName&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; gets the type of the Poll e.g.: Token (XYZ) weighted poll&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Set the poll type in the constructor of the poll&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; type of the poll&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getPollType&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; gets the logic to be used in a poll&amp;#39;s `canVote` function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  e.g.: &amp;quot;XYZ Token | US &amp;amp; China(attributes in erc-1261) | Developers(attributes in erc-1261)&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Set the Voterbase logic in the constructor of the poll&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; voterbase logic&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getVoterBaseLogic&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; gets the start time for the poll&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Set the start time in the constructor of the poll as Unix Standard Time&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; start&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; time as Unix Standard Time&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getStartTime&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; gets the end time for the poll&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Set the end time in the constructor of the poll as Unix Time or specify duration in constructor&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; end&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; time as Unix Standard Time&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getEndTime&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; returns the list of entity addresses (eip-1261) used for perimissioning purposes.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; addresses list can be used along with IERC1261 interface to define the logic inside `canVote()` function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; list of addresses of entities&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getProtocolAddresses&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; gets the vote weight against all proposals&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; limit the proposal count to 32 (for practical reasons), loop and generate the vote tally list&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; list of vote weights against all proposals&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getVoteTallies&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; gets the no. of people who voted against all proposals&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; limit the proposal count to 32 (for practical reasons), loop and generate the vote count list&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; list of voter count against all proposals&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getVoterCounts&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; For single proposal polls, returns the total voterbase count.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  For multi proposal polls, returns the total vote weight against all proposals&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  this is used to calculate the percentages for each proposal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; limit the proposal count to 32 (for practical reasons), loop and generate the voter base denominator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; an&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; integer which specifies the above mentioned amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getVoterBaseDenominator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;caveats&quot;&gt;Caveats&lt;&#x2F;h3&gt;
&lt;p&gt;The 0.4.24 Solidity interface grammar is not expressive enough to document the ERC-1417 standard. A contract which complies with ERC-1417 MUST also abide by the following:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Solidity issue #3412: The above interfaces include explicit mutability guarantees for each function. Mutability guarantees are, in order weak to strong: &lt;code&gt;payable&lt;&#x2F;code&gt;, implicit nonpayable, &lt;code&gt;view&lt;&#x2F;code&gt;, and &lt;code&gt;pure&lt;&#x2F;code&gt;. Your implementation MUST meet the mutability guarantee in this interface and you MAY meet a stronger guarantee. For example, a &lt;code&gt;payable&lt;&#x2F;code&gt; function in this interface may be implemented as nonpayble (no state mutability specified) in your contract. We expect a later Solidity release will allow your stricter contract to inherit from this interface, but a workaround for version 0.4.24 is that you can edit this interface to add stricter mutability before inheriting from your contract.&lt;&#x2F;li&gt;
&lt;li&gt;Solidity issue #2330: If a function is shown in this specification as &lt;code&gt;external&lt;&#x2F;code&gt; then a contract will be compliant if it uses &lt;code&gt;public&lt;&#x2F;code&gt; visibility. As a workaround for version 0.4.24, you can edit this interface to switch to &lt;code&gt;public&lt;&#x2F;code&gt; before inheriting from your contract.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;If a newer version of Solidity allows the caveats to be expressed in code, then this EIP MAY be updated and the caveats removed, such will be equivalent to the original specification.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;As the poll standard is built with the intention of creating a system that allows for more transparency and accessibility of governance data, the design choices in the poll standard are driven by this motivator. In this section we go over some of the major design choices, and why these choices were made:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Event logging: The logic behind maintaining event logs in the cases of:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Cast Vote&lt;&#x2F;li&gt;
&lt;li&gt;Unvote&lt;&#x2F;li&gt;
&lt;li&gt;Failed Vote
is to ensure that in the event of a manipulated voterbase, simple off chain checks can be performed to audit the integrity of the poll result.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;No poll finish trigger: There was a consideration of adding functions in the poll which execute after completion of the poll to carry out some pre-decided logic. However this was deemed to be unnecessary - because such an action can be deployed in a separate contract which simply reads the result of a given poll, and against the spirit of modularity, because no actions can be created after the poll has been deployed. Also, such functions would not be able to combine the results of polls, and definitely would not fit into polls that do not have an end time.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Allow for unbound polls: The poll standard, unlike other voting standard proposals, does not force polls to have an end time. This becomes relevant in some cases where the purpose of a poll is to have a live register of ongoing consensus. Some other use cases come into picture when you want to deploy a set of action contracts which read from the poll, and want to be able to execute the action contract whenever a poll reaches a certain threshold, rather than waiting for the end of the poll.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Modularization: There have been opinions in the Ethereum community that there cannot exist a voting standard, because voting contracts can be of various types, and have several shapes and forms. However we disagree, and make the case that modularization is the solution. While different polls may need different logic, they all need consistent end points. All polls need to give out results along with headcounts, all polls should have event logs, all polls should be examinable with frontend tools, and so on. The poll standard is not a statement saying “all polls should be token based” or any such specific system. However the poll standard is a statement saying that all polls should have a common access and modification protocol - this will enable more apps to include governance without having to go through the trouble of making customers start using command line.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Having explained our rationale, we are looking forward to hearing from the community some thoughts on how this can be made more useful or powerful.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Gas and Complexity&lt;&#x2F;strong&gt; (regarding the enumeration for proposal count)&lt;&#x2F;p&gt;
&lt;p&gt;This specification contemplates implementations that contain a sample of 32 proposals (max up to blockgaslimit). If your application is able to grow and needs more than 32 proposals, then avoid using for&#x2F;while loops in your code. These indicate your contract may be unable to scale and gas costs will rise over time without bound&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Privacy&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Personal information: The standard does not put any personal information on to the blockchain, so there is no compromise of privacy in that respect.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Community Consensus&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;We have been very inclusive in this process and invite anyone with questions or contributions into our discussion. However, this standard is written only to support the identified use cases which are listed herein.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Voting Standard includes test cases written using Truffle.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementations&quot;&gt;Implementations&lt;&#x2F;h2&gt;
&lt;p&gt;Voting Standard -- a reference implementation&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;MIT licensed, so you can freely use it for your projects&lt;&#x2F;li&gt;
&lt;li&gt;Includes test cases&lt;&#x2F;li&gt;
&lt;li&gt;Also available as a npm package - npm i electusvoting&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;Standards&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;EIP-20: ERC-20 Token Standard (a.k.a. ERC-20)&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;EIP-165: Standard Interface Detection&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721: Non-Fungible Token Standard(a.k.a. ERC-721)&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1261&#x2F;&quot;&gt;ERC-1261 MV Token Standard&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.ietf.org&#x2F;rfc&#x2F;rfc2119.txt&quot;&gt;RFC 2119 Key words for use in RFCs to Indicate Requirement Levels&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Issues&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The Original ERC-1417 Issue. https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;eips&#x2F;issues&#x2F;1417&lt;&#x2F;li&gt;
&lt;li&gt;Solidity Issue #2330 -- Interface Functions are Axternal. https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;solidity&#x2F;issues&#x2F;2330&lt;&#x2F;li&gt;
&lt;li&gt;Solidity Issue #3412 -- Implement Interface: Allow Stricter Mutability. https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;solidity&#x2F;issues&#x2F;3412&lt;&#x2F;li&gt;
&lt;li&gt;Solidity Issue #3419 -- Interfaces Can&#x27;t Inherit. https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;solidity&#x2F;issues&#x2F;3419&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;strong&gt;Discussions&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;ERC-1417 (announcement of first live discussion). https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;eips&#x2F;issues&#x2F;1417&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;strong&gt;Voting Implementations and Other Projects&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;chaitanyapotti&#x2F;Voting&quot;&gt;Voting Implementations&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Blockchain Storage Rent Payment</title>
        <published>2018-09-16T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>William Entriken</name><uri>https://github.com/fulldecent</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1418/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-1418-storage-rent/10737" />
        

        <id>https://wg-eips.ritovision.com/1418/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1418"
            label="EIP-1418" />
        

        
        

        
        <summary type="html">At each block, deduct value from every account based on the quantity of storage used by that account.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1418/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;At each block, deduct an amount of value (&quot;rent&quot;) from every account based on the quantity of storage used by that account.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Ethereum is a public utility and we are underpricing the long-term costs of storage. Storage cost can be approximately modeled as bytes × time.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;Updated transaction type&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;A new transaction type is introduced. Whereas &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; introduced warm access for contract state, this new type introduces warm access for contract code.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;New state variables (per account)&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;σ[a]_rent&lt;&#x2F;strong&gt; -- an amount of value, in Wei, this is a signed value&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;σ[a]_storageWords&lt;&#x2F;strong&gt; -- number of words in storage&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;New constants&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;RENT_WORD_COST&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; -- The rent cost, in Wei, paid for each word-block&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;RENT_ACCOUNT_COST&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; -- The rent cost, in Wei, paid for each account-block&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;FORK_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; – When implementation starts&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;New opcodes&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;RENTBALANCE(address)&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; -- G_BALANCE -- Similar to &lt;code&gt;BALANCE&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;This returns the logical &lt;code&gt;σ[a]_rent&lt;&#x2F;code&gt; value which is defined to reduce each block. It is possible for the implementation to calculate this value using the recommended implementation variables, rather than storing and updating  &lt;code&gt;σ[a]_rent&lt;&#x2F;code&gt; every block for every account.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;SENDRENT(address, amount)&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; -- G_BASE -- Convert value to rent and send to account
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;σ[account]_rent&lt;&#x2F;code&gt; += amount&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;σ[msg.sender]_balance&lt;&#x2F;code&gt; -= amount&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Updated opcodes&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;A new subroutine, paying for rent, is established as such:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PAYRENT(account)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    blocks_to_pay = NUMBER - σ[account]_rentLastPaid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    cost_per_block = RENT_ACCOUNT_COST + RENT_WORD_COST * (⌈∥σ[account]_code∥ &#x2F; 32⌉ + * σ[a]_storageWords)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    rent_to_pay = blocks_to_pay * cost_per_block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    σ[account]_rent -= rent_to_pay&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if σ[account]_rent &amp;lt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    		σ[account]_value += σ[account]_rent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    		σ[account]_rent = 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    end&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if σ[account]_value &amp;lt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    		σ[account]_rent = σ[account]_value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    		σ[account]_value = 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    end&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    σ[account]_rentLastPaid = NUMBER&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    σ[account]_rentEvictBlock = NUMBER + ⌊σ[account]_rent &#x2F; cost_per_block⌋&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;END PAYRENT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;SSTORE(account, key, value)&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;
&lt;ul&gt;
&lt;li&gt;Perform PAYRENT(account)&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;account&lt;&#x2F;code&gt; is evicted (i.e. &lt;code&gt;NUMBER&lt;&#x2F;code&gt; &amp;gt; &lt;code&gt;σ[account]_rentEvictBlock&lt;&#x2F;code&gt;) then transaction fails unless using the new transaction type and sufficient proofs are included to validate the old storage root and calculate the new root.&lt;&#x2F;li&gt;
&lt;li&gt;Do normal SSTORE operation&lt;&#x2F;li&gt;
&lt;li&gt;If the old value was zero for this [account, key] and the new value is non-zero, then &lt;code&gt;σ[account]_storageWords++&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;If the old value was non-zero for this [account, key] and the new value is zero, then &lt;code&gt;σ[account]_storageWords--&lt;&#x2F;code&gt;, and if the result is negative then set to zero&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;SLOAD(account, key)&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;
&lt;ul&gt;
&lt;li&gt;If &lt;code&gt;account&lt;&#x2F;code&gt; is evicted (i.e. &lt;code&gt;NUMBER&lt;&#x2F;code&gt; &amp;gt; &lt;code&gt;σ[account]_rentEvictBlock&lt;&#x2F;code&gt;) then transaction fails unless using the new transaction type and sufficient proofs are included to validate the existing storage root and the existing storage value.&lt;&#x2F;li&gt;
&lt;li&gt;Do normal SLOAD operation.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;CALL (and derivatives)&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;
&lt;ul&gt;
&lt;li&gt;If the target block is evicted (i.e. &lt;code&gt;NUMBER&lt;&#x2F;code&gt; &amp;gt; &lt;code&gt;σ[account]_rentEvictBlock&lt;&#x2F;code&gt;) then transaction fails unless using the new transaction type and sufficient proof is included to validate the existing code.&lt;&#x2F;li&gt;
&lt;li&gt;Do normal CALL operation&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;CREATE&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;
&lt;ul&gt;
&lt;li&gt;Set σ[account]_rentLastPaid = NUMBER&lt;&#x2F;li&gt;
&lt;li&gt;Do normal CREATE operation&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;σ[account]_storageWord = 0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Note: it is possible there is a pre-existing rent balance here&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;New built-in contract&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;PAYRENT(address, amount)&lt;&#x2F;code&gt; -- Calls &lt;code&gt;PAYRENT&lt;&#x2F;code&gt; opcode
&lt;ul&gt;
&lt;li&gt;This is a convenience for humans to send Ether from their accounts and turn it into rent. Note that simple accounts (CODESIZE == 0) cannot call arbitrary opcodes, they can only call CREATE or CALL.&lt;&#x2F;li&gt;
&lt;li&gt;The gas cost of PAYRENT will be 10,000 or lower if possible.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Calculating &lt;code&gt;σ[account]_storageWord&lt;&#x2F;code&gt; for existing accounts&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;DRAFT...&lt;&#x2F;p&gt;
&lt;p&gt;It is not an acceptable upgrade if on the fork block it is necessary for only archive nodes to participate which know the full storage amount for each account.&lt;&#x2F;p&gt;
&lt;p&gt;An acceptable upgrade will be if the required &lt;code&gt;σ[account]_storageWord&lt;&#x2F;code&gt; can be calculated (or estimated) incrementally based on new transaction activity.&lt;&#x2F;p&gt;
&lt;p&gt;DRAFT: I think it is possible to make such an acceptable upgrade using an unbiased estimator&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;add one bit of storage per &lt;code&gt;SSTORE&lt;&#x2F;code&gt; for legacy accounts on the first access of a given key&lt;&#x2F;li&gt;
&lt;li&gt;add log(n) bits for each trie level&lt;&#x2F;li&gt;
&lt;li&gt;assume that storage keys are a random variable&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;To think more about...&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;No changes to current opcode gas costs.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;No call&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;A contract will not know or react to the receipt of rent. This is okay. Workaround: if a contract really needed to know who provided rent payments then it could create a function in its ABI to attribute these payments. It is already possible to send payments to a contract without attribution by using &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;. Other blockchains like TRON allow to transfer value to a contract without performing a call.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Eviction responsibility &#x2F; lazy evaluation&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The specification gives responsibility for eviction to the consensus clients. This is the most predictable behavior because it happens exactly when it should. Also there need not be any incentive mechanism (refund gas, bounty) for outside participants (off-chain) to monitor accounts and request removal.&lt;&#x2F;p&gt;
&lt;p&gt;It is possible that an arbitrary number of accounts will be evicted in one block. That doesn&#x27;t matter. Client implementations do not need to track which accounts are evicted, consensus is achieved just by agreeing on the conditions under which an account would be evicted.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;No converting rent to value&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Ether converted to rent cannot be converted back. Anybody that works in accounting and knows about gifts cards should tell you this is a good idea. It makes reasoning about the system much easier.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Accounts pay rent&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Yes, they pay rent. It costs resources to account for their balances so we charge them rent.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Why do you need a separate rent account?&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Because anybody&#x2F;everybody can contribute to the rent account. If you depend on a contract, you should contribute to its rent.&lt;&#x2F;p&gt;
&lt;p&gt;But the contract can spend all of its value.&lt;&#x2F;p&gt;
&lt;p&gt;By maintaining a separate rent and value balance, this allows people to contribute to the rent while being confident that this is allowing the contract to stay around.&lt;&#x2F;p&gt;
&lt;p&gt;NOTE: cloning. With this EIP, it may become feasible to allow storage cloning. Yes really. Because the new clone will be paying rent. See other EIP, I think made by Augur team.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;economics-constants&quot;&gt;Economics &amp;amp; constants&lt;&#x2F;h3&gt;
&lt;p&gt;An &lt;code&gt;SSTORE&lt;&#x2F;code&gt; executed in 2015 cost 20,000 gas and has survived about 6 million blocks. The gas price has been around 1 ~ 50 Gwei. So basically 4,000 Wei per block per word so far. Maybe storing an account is 10 times more intensive than storing a word. But actually &lt;code&gt;G_transaction&lt;&#x2F;code&gt; is 21,000 and &lt;code&gt;G_sstore&lt;&#x2F;code&gt; is 20,000 so these are similar and they can both create new accounts &#x2F; words.&lt;&#x2F;p&gt;
&lt;p&gt;How about:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;RENT_WORD_COST&lt;&#x2F;code&gt; -- 4,000 Wei&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RENT_ACCOUNT_COST&lt;&#x2F;code&gt; -- 4,000 Wei&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;FORK_BLOCK&lt;&#x2F;code&gt; – when implementation starts&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The rent is priced in cold, hard Ether. It is not negotiated by clients, it is not dynamic.&lt;&#x2F;p&gt;
&lt;p&gt;A future EIP may change this pricing to be dynamic. For example to notarize a block, notaries may be required to prove they have the current storage dataset (excluding evictions). Additionally, they may also prove they have the dataset plus evictions to earn an additional fee. The relative storage of the evicted accounts, and the other accounts versus the value of the additional fee may be used as a feedback mechanism to set a market price for storage.&lt;&#x2F;p&gt;
&lt;p&gt;FYI, there are about 15B words in the Ethereum Mainnet dataset and about 100M total Ether mined. This means if all Ether was spent on storage at current proposed prices it would be 400 terabyte-years of storage. I&#x27;m not sure if it is helpful to look at it that way.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;EIP-1559 already introduces a mechanism for nodes to participate without recording the full network state and for clients to warm cache with storage data in their type 2 transactions.&lt;&#x2F;p&gt;
&lt;p&gt;Users will need to be educated.&lt;&#x2F;p&gt;
&lt;p&gt;Many smart contracts allow anybody to use an arbitrary amount of storage in them. This can limit the usefulness of deploying this proposal on an existing chain.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Recommended implementation variables (per account)&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;σ[a]_rentLastPaid&lt;&#x2F;strong&gt; -- a block number that is set when:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Value is transferred into an account (&lt;code&gt;CREATE&lt;&#x2F;code&gt;, &lt;code&gt;CALL&lt;&#x2F;code&gt;, &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;Code is set for an account (&lt;code&gt;CREATE&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;An account&#x27;s storage is updated (&lt;code&gt;SSTORE&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;This begins with a logical value of &lt;code&gt;FORK_BLOCK&lt;&#x2F;code&gt; for all accounts&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;σ[a]_rentEvictBlock&lt;&#x2F;strong&gt; -- the block number when this account will be evicted&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Storage note&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;For every account that is evicted, clients may choose to delete that storage from disk. A future EIP may make an incentive to keep this extra data for a fee. A future EIP may create a mechanism for clients to exchange information about these storage states.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Many smart contracts allow anybody to use an arbitrary amount of storage in them.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via CC0.&lt;&#x2F;p&gt;
&lt;!--

 ## TODO

 To discuss:

 - Can&#x2F;should an evicted account be allowed to be un-evicted when paying past due rent?
   --&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>zk-SNARK Verifier Standard</title>
        <published>2018-09-14T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Michael Connor</name><email>michael.connor@uk.ey.com</email>
	</author>
	
	<author>
		<name>Chaitanya Konda</name><email>chaitanya.konda@uk.ey.com</email>
	</author>
	
	<author>
		<name>Duncan Westland</name><email>duncan.westland@uk.ey.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1922/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/1922" />
        

        <id>https://wg-eips.ritovision.com/1922/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:1922"
            label="ERC-1922" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1922/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;A standard interface for &quot;Verifier&quot; contracts which verify zk-SNARKs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The following standard allows for the implementation of a standard contract API for the verification of zk-SNARKs (&quot;Zero-Knowledge Succinct Non-Interactive Arguments of Knowledge&quot;), also known as &quot;proofs&quot;, &quot;arguments&quot;, or &quot;commitments&quot;.&lt;&#x2F;p&gt;
&lt;p&gt;This standard provides basic functionality to load all necessary parameters for the verification of any zk-SNARK into a verifier contract, so that the proof may ultimately return a &lt;code&gt;true&lt;&#x2F;code&gt; or &lt;code&gt;false&lt;&#x2F;code&gt; response; corresponding to whether it has been verified or not verified.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;zk-SNARKs are a promising area of interest for the Ethereum community. Key applications of zk-SNARKs include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Private transactions&lt;&#x2F;li&gt;
&lt;li&gt;Private computations&lt;&#x2F;li&gt;
&lt;li&gt;Improved transaction scaling through proofs of &quot;bundled&quot; transactions&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;A standard interface for verifying all zk-SNARKs will allow applications to more easily implement private transactions, private contracts, and scaling solutions; and to extract and interpret the limited information which gets emitted during zk-SNARK verifications.&lt;&#x2F;p&gt;
&lt;p&gt;This standard was initially proposed by EY, and was inspired in particular by the requirements of businesses wishing to keep their agreements, transactions, and supply chain activities confidential—all whilst still benefiting from the commonly cited strengths of blockchains and smart contracts.&lt;&#x2F;p&gt;
&lt;p&gt;:warning: TODO: Explain the benefits to and perspective of a consumer of information. I.e. the thing that interfaces with the standard verifier.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;Terminology in this specification is used consistently with libsnark, as provided in that project&#x27;s README.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Adhering Contract — A Verifier contract which adheres to this specification.&lt;&#x2F;li&gt;
&lt;li&gt;Arithmetic circuit: An abstraction of logical statements into addition and multiplication gates.&lt;&#x2F;li&gt;
&lt;li&gt;Public Inputs: often denoted as a vector &#x27;x&#x27; in zk-SNARKs literature, and denoted &lt;code&gt;inputs&lt;&#x2F;code&gt; in this interface. An arithmetic circuit can be thought of as taking two parameters; the Public Inputs, &#x27;x&#x27;, and a secret &#x27;witness&#x27;, &#x27;w&#x27;. This interface standardises functions which can load the &lt;code&gt;inputs&lt;&#x2F;code&gt; into an Adhering Contract.&lt;&#x2F;li&gt;
&lt;li&gt;Proof: A &#x27;prover&#x27; who wants to &#x27;prove&#x27; knowledge of some secret witness &#x27;w&#x27; (which satisfies an arithmetic circuit), generates a &lt;code&gt;proof&lt;&#x2F;code&gt; from: the circuit&#x27;s Proving Key; their secret witness &#x27;w&#x27;; and its corresponding Public Inputs &#x27;x&#x27;. Together, a pair &lt;code&gt;(proof, inputs)&lt;&#x2F;code&gt; of satisfying &lt;code&gt;inputs&lt;&#x2F;code&gt; and their corresponding &lt;code&gt;proof&lt;&#x2F;code&gt; forms a zk-SNARK.&lt;&#x2F;li&gt;
&lt;li&gt;Verification Key: A &#x27;trusted setup&#x27; calculation creates both a public &#x27;Proving Key&#x27; and a public &#x27;Verification Key&#x27; from an arithmetic circuit. This interface does not provide a method for loading a Verification Key onto the blockchain. An Adhering Contract SHALL be able to accept arguments of knowledge (&lt;code&gt;(proof, inputs)&lt;&#x2F;code&gt; pairs) for at least one Verification Key. We shall call such Verification Keys &#x27;in-scope&#x27; Verification Keys. An Adhering Contract MUST be able to interpret unambiguously a unique &lt;code&gt;verificationKeyId&lt;&#x2F;code&gt; for each of its &#x27;in-scope&#x27; Verification Keys.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Every ERC-XXXX compliant verifier contract must implement the &lt;code&gt;ERCXXXX&lt;&#x2F;code&gt; and &lt;code&gt;ERC165&lt;&#x2F;code&gt; interfaces&lt;&#x2F;strong&gt; (subject to &quot;caveats&quot; below):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.5.6&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; EIP-XXXX zk-SNARK Verifier Standard&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See https:&#x2F;&#x2F;github.com&#x2F;EYBlockchain&#x2F;zksnark-verifier-standard&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;  Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0xXXXXXXXX.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ⚠️ &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;TODO&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: Calculate interface identifier&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EIPXXXX&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is ERC165 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Checks the arguments of Proof, through elliptic curve&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  pairing functions.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  MUST return `true` if Proof passes all checks (i.e. the Proof is&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  valid).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  MUST return `false` if the Proof does not pass all checks (i.e. if the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  Proof is invalid).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; proof&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A zk-SNARK.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Public inputs which accompany Proof.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; verificationKeyId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A unique identifier (known to this verifier&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  contract) for the Verification Key to which Proof corresponds.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; result&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The result of the verification calculation. True&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  if Proof is valid; false otherwise.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; proof&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; inputs&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; verificationKeyId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;interface&quot;&gt;Interface&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC165&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Query if a contract implements an interface&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; interfaceID&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The interface identifier, as specified in ERC-165&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Interface identification is specified in ERC-165. This function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  uses less than 30,000 gas.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `true` if the contract implements `interfaceID` and&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  `interfaceID` is not 0xffffffff, `false` otherwise&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;taxonomy&quot;&gt;Taxonomy&lt;&#x2F;h3&gt;
&lt;p&gt;⚠️ TODO: Add a specific reference to libsnark here, explaining the choice of variable names.&lt;&#x2F;p&gt;
&lt;p&gt;:warning: TODO: Explain how &lt;em&gt;C&lt;&#x2F;em&gt; may not necessarily be a satisfiable arithmetic circuit of logical statements. As current, this is a limitation to certain kinds of SNARKS. Whereas the source references also mention polynomials, and other applications.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;C&lt;&#x2F;em&gt; — A satisfiable arithmetic circuit abstraction of logical statements.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;lambda​&lt;&#x2F;em&gt; - A random number, generated at the &#x27;setup&#x27; phase - commonly referred to as &#x27;toxic waste&#x27;, because knowledge of &lt;em&gt;lambda​&lt;&#x2F;em&gt; would allow an untrustworthy party to create &#x27;false&#x27; proofs which would verify as &#x27;true&#x27;. &lt;em&gt;lambda​&lt;&#x2F;em&gt; must be destroyed.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;pk​&lt;&#x2F;em&gt; - The proving key for a particular circuit &lt;em&gt;C​&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;vk&lt;&#x2F;em&gt; - The verification key for a particular circuit &lt;em&gt;C&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Both &lt;em&gt;pk​&lt;&#x2F;em&gt; and &lt;em&gt;vk​&lt;&#x2F;em&gt; are generated as a pair by some function &lt;em&gt;G​&lt;&#x2F;em&gt;:
&lt;em&gt;(pk, vk) = G(lambda, C)​&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Note: &lt;em&gt;C&lt;&#x2F;em&gt; can be represented unambiguously by either of &lt;em&gt;pk&lt;&#x2F;em&gt; or &lt;em&gt;vk&lt;&#x2F;em&gt;. In zk-SNARK constructions, &lt;em&gt;vk&lt;&#x2F;em&gt; is much smaller in size than &lt;em&gt;pk&lt;&#x2F;em&gt;, so as to enable succinct verification on-chain. Hence, &lt;em&gt;vk&lt;&#x2F;em&gt; is the representative of &lt;em&gt;C&lt;&#x2F;em&gt; that is &#x27;known&#x27; to the contract. Therefore, we can identify each circuit uniquely through some &lt;code&gt;verificationKeyId&lt;&#x2F;code&gt;, where &lt;code&gt;verificationKeyId&lt;&#x2F;code&gt; serves as a more succinct mapping to &lt;em&gt;vk&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;w&lt;&#x2F;em&gt; - A &#x27;private witness&#x27; string. A private argument to the circuit &lt;em&gt;C&lt;&#x2F;em&gt; known only to the prover, which, when combined with the &lt;code&gt;inputs&lt;&#x2F;code&gt; argument &lt;em&gt;x&lt;&#x2F;em&gt;, comprises an argument of knowledge which satisfies the circuit &lt;em&gt;C&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;x&lt;&#x2F;em&gt; or &lt;code&gt;inputs&lt;&#x2F;code&gt; - A vector of &#x27;Public Inputs&#x27;. A public argument to the circuit &lt;em&gt;C&lt;&#x2F;em&gt; which, when combined with the private witness string &lt;em&gt;w&lt;&#x2F;em&gt;, comprises an argument of knowledge which satisfies the circuit &lt;em&gt;C&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;pi&lt;&#x2F;em&gt; or &lt;code&gt;proof&lt;&#x2F;code&gt; - an encoded vector of values which represents the &#x27;prover&#x27;s&#x27; &#x27;argument of knowledge&#x27; of values &lt;em&gt;w&lt;&#x2F;em&gt; and &lt;em&gt;x&lt;&#x2F;em&gt; which satisfy the circuit &lt;em&gt;C&lt;&#x2F;em&gt;.
&lt;em&gt;pi = P(pk, x, w)&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The ultimate purpose of a Verifier contract, as specified in this EIP, is to verify a proof (of the form &lt;em&gt;pi​&lt;&#x2F;em&gt;) through some verification function &lt;em&gt;V​&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;V(vk, x, pi) = 1&lt;&#x2F;em&gt;, if there exists a &lt;em&gt;w&lt;&#x2F;em&gt; s.t. &lt;em&gt;C(x,w)=1&lt;&#x2F;em&gt;.
&lt;em&gt;V(vk, x, pi) = 0&lt;&#x2F;em&gt;, otherwise.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;verify()&lt;&#x2F;code&gt; function of this specification serves the purpose of &lt;em&gt;V​&lt;&#x2F;em&gt;; returning either &lt;code&gt;true&lt;&#x2F;code&gt; (the proof has been verified to satisfy the arithmetic circuit) or &lt;code&gt;false&lt;&#x2F;code&gt; (the proof has not been verified).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;functions&quot;&gt;Functions&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;verify&quot;&gt;&lt;code&gt;verify&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;verify&lt;&#x2F;code&gt; function forms the crux this standard. The parameters are intended to be as generic as possible, to allow for verification of any zk-SNARK:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;proof&lt;&#x2F;code&gt;
Specified as &lt;code&gt;uint256[]&lt;&#x2F;code&gt;.
&lt;code&gt;uint256&lt;&#x2F;code&gt; is the most appropriate type for elliptic curve operations over a finite field. Indeed, this type is used in the predominant &#x27;Pairing library&#x27; implementation of zk-SNARKs by Christian Reitweissner.
A one-dimensional dynamic array has been chosen for several reasons:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Dynamic: There are several possible methods for producing a zk-SNARK proof, including PGHR13, G16, GM17, and future methods might be developed in future. Although each method may produce differently sized proof objects, a dynamic array allows for these differing sizes.&lt;&#x2F;li&gt;
&lt;li&gt;Array: An array has been chosen over a &#x27;struct&#x27; object, because it is currently easier to pass dynamic arrays between functions in Solidity. Any proof &#x27;struct&#x27; can be &#x27;flattened&#x27; to an array and passed to the &lt;code&gt;verify&lt;&#x2F;code&gt; function. Interpretation of that flattened array is the responsibility of the implemented body of the function. Example implementations demonstrate that this can be achieved.&lt;&#x2F;li&gt;
&lt;li&gt;One-dimensional: A one-dimensional array has been chosen over multi-dimensional array, because it is currently easier to work with one-dimensional arrays in Solidity. Any proof can be &#x27;flattened&#x27; to a one-dimensional array and passed to the &lt;code&gt;verify&lt;&#x2F;code&gt; function. Interpretation of that flattened array is the responsibility of the implemented body of the Adhering Contract. Example implementations demonstrate that this can be achieved.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;inputs&lt;&#x2F;code&gt;
Specified as &lt;code&gt;uint256[]&lt;&#x2F;code&gt;.
&lt;code&gt;uint256&lt;&#x2F;code&gt; is the most appropriate type for elliptic curve operations over a finite field. Indeed, this type is used in the predominant &#x27;Pairing library&#x27; implementation of zk-SNARKs by Christian Reitweissner.
The number of inputs will vary in size, depending on the number of &#x27;public inputs&#x27; of the arithmetic circuit being verified against. In a similar vein to the &lt;code&gt;proof&lt;&#x2F;code&gt; parameter, a one-dimensional dynamic array is general enough to cope with any set of inputs to a zk-SNARK.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;verificationKeyId&lt;&#x2F;code&gt;
A verification key (referencing a particular arithmetic circuit) only needs to be stored on-chain once. Any proof (relating to the underlying arithmetic circuit) can then be verified against that verification key. Given this, it would be unnecessary (from a &#x27;gas cost&#x27; point of view) to pass a duplicate of the full verification key to the &lt;code&gt;verify&lt;&#x2F;code&gt; function every time a new &lt;code&gt;(proof, inputs)&lt;&#x2F;code&gt; pair is passed in. We do however need to tell the Adhering Verifier Contract which verification key corresponds to the &lt;code&gt;(proof, inputs)&lt;&#x2F;code&gt; pair being passed in. A &lt;code&gt;verificationKeyId&lt;&#x2F;code&gt; serves this purpose - it uniquely represents a verification key as a &lt;code&gt;bytes32&lt;&#x2F;code&gt; id. A method for uniquely assigning a &lt;code&gt;verificationKeyId&lt;&#x2F;code&gt; to a verification key is the responsibility of the implemented body of the Adhering Contract.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;At the time this EIP was first proposed, there was one implementation on the Ethereum main net - deployed by &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.ey.com&quot;&gt;EY&lt;&#x2F;a&gt;. This was compiled with Solidity 0.4.24 for compatibility with &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;trufflesuite&#x2F;truffle&quot;&gt;Truffle&lt;&#x2F;a&gt; but otherwise compatible with this standard, which is presented at the latest current version of Solidity.&lt;&#x2F;li&gt;
&lt;li&gt;Dr Christian Reitwiessner&#x27;s excellent &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;gist.github.com&#x2F;chriseth&#x2F;f9be9d9391efc5beb9704255a8e2989d&quot;&gt;example&lt;&#x2F;a&gt; of a Verifier contract and elliptic curve pairing library has been instrumental in the Ethereum community&#x27;s experimentation and development of zk-SNARK protocols. Many of the naming conventions of this EIP have been kept consistent with his example.&lt;&#x2F;li&gt;
&lt;li&gt;Existing zk-SNARK compilers such as &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;Zokrates&#x2F;ZoKrates&quot;&gt;ZoKrates&lt;&#x2F;a&gt;, which produce &#x27;Verifier.sol&#x27; contracts, do not currently produce Verifier contracts which adhere to this EIP specification.
&lt;ul&gt;
&lt;li&gt;:warning: TODO: Provide a converter contract or technique which allows ZoKrates verifier.sol contracts to adhere with this EIP.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Truffle tests of example implementations are included in the test case repository.&lt;&#x2F;p&gt;
&lt;p&gt;⚠️ TODO: Reference specific test cases because there are many currently in the repository.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementations&quot;&gt;Implementations&lt;&#x2F;h2&gt;
&lt;p&gt;Detailed example implementations and Truffle tests of these example implementations are included in this repository.&lt;&#x2F;p&gt;
&lt;p&gt;:warning: TODO: Update referenced verifier implementations so that they are ready-to-deploy or reference deployed versions of those implementations. At current, the referenced code specifically states &quot;DO NOT USE THIS IN PRODUCTION&quot;.&lt;&#x2F;p&gt;
&lt;p&gt;:warning: TODO: Provide reference to an implementation which interrogates a standard verifier contract that implements this standard.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;&#x2F;h2&gt;
&lt;p&gt;:warning: TODO: Update references and confirm that each reference is cited (parenthetical documentation not necessary) in the text.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Standards&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;ERC-20 Token Standard. .&#x2F;00020.md&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;ERC-165 Standard Interface Detection. .&#x2F;00165.md&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;ERC-173 Contract Ownership Standard (DRAFT). .&#x2F;00173.md&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;ERC-196 Precompiled contracts for addition and scalar multiplication on the elliptic curve alt_bn128. .&#x2F;00196.md&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;ERC-197 Precompiled contracts for optimal ate pairing check on the elliptic curve alt_bn128. .&#x2F;00197.md&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Ethereum Name Service (ENS). https:&#x2F;&#x2F;ens.domains&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;RFC 2119 Key words for use in RFCs to Indicate Requirement Levels. https:&#x2F;&#x2F;www.ietf.org&#x2F;rfc&#x2F;rfc2119.txt&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h5 id=&quot;educational-material-zk-snarks&quot;&gt;Educational material:  zk-SNARKs&lt;&#x2F;h5&gt;
&lt;ol&gt;
&lt;li&gt;Zcash. What are zk-SNARKs? https:&#x2F;&#x2F;z.cash&#x2F;technology&#x2F;zksnarks.html&lt;&#x2F;li&gt;
&lt;li&gt;Vitalik Buterin. zk-SNARKs: Under the Hood. https:&#x2F;&#x2F;medium.com&#x2F;@VitalikButerin&#x2F;zk-snarks-under-the-hood-b33151a013f6&lt;&#x2F;li&gt;
&lt;li&gt;Christian Reitweissner. zk-SNARKs in a Nutshell. https:&#x2F;&#x2F;blog.ethereum.org&#x2F;2016&#x2F;12&#x2F;05&#x2F;zksnarks-in-a-nutshell&#x2F;&lt;&#x2F;li&gt;
&lt;li&gt;Ben-Sasson, Chiesa, Tromer, et. al. Succinct Non-Interactive Zero Knowledge for a von Neumann Architecture. https:&#x2F;&#x2F;eprint.iacr.org&#x2F;2013&#x2F;879.pdf&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h5 id=&quot;notable-applications-of-zk-snarks&quot;&gt;Notable applications of zk-SNARKs&lt;&#x2F;h5&gt;
&lt;ol&gt;
&lt;li&gt;EY. Implementation of a business agreement through Token Commitment transactions on the Ethereum mainnet. https:&#x2F;&#x2F;github.com&#x2F;EYBlockchain&#x2F;ZKPChallenge&lt;&#x2F;li&gt;
&lt;li&gt;Zcash. https:&#x2F;&#x2F;z.cash&lt;&#x2F;li&gt;
&lt;li&gt;Zcash. How Transactions Between Shielded Addresses Work. https:&#x2F;&#x2F;blog.z.cash&#x2F;zcash-private-transactions&#x2F;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h5 id=&quot;notable-projects-relating-to-zk-snarks&quot;&gt;Notable projects relating to zk-SNARKs&lt;&#x2F;h5&gt;
&lt;ol&gt;
&lt;li&gt;libsnark: A C++ Library for zk-SNARKs (&quot;project README)&quot;. https:&#x2F;&#x2F;github.com&#x2F;scipr-lab&#x2F;libsnark&lt;&#x2F;li&gt;
&lt;li&gt;ZoKrates: Scalable Privacy-Preserving Off-Chain Computations. https:&#x2F;&#x2F;www.ise.tu-berlin.de&#x2F;fileadmin&#x2F;fg308&#x2F;publications&#x2F;2018&#x2F;2018_eberhardt_ZoKrates.pdf&lt;&#x2F;li&gt;
&lt;li&gt;ZoKrates Project Repository. https:&#x2F;&#x2F;github.com&#x2F;JacobEberhardt&#x2F;ZoKrates&lt;&#x2F;li&gt;
&lt;li&gt;Joseph Stockermans. zkSNARKs: Driver&#x27;s Ed. https:&#x2F;&#x2F;github.com&#x2F;jstoxrocky&#x2F;zksnarks_example&lt;&#x2F;li&gt;
&lt;li&gt;Christian Reitweissner - snarktest.solidity. https:&#x2F;&#x2F;gist.github.com&#x2F;chriseth&#x2F;f9be9d9391efc5beb9704255a8e2989d&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h5 id=&quot;notable-alternatives-to-zk-snarks-areas-of-ongoing-zero-knowledge-proof-research&quot;&gt;Notable &#x27;alternatives&#x27; to zk-SNARKs - areas of ongoing zero-knowledge proof research&lt;&#x2F;h5&gt;
&lt;ol&gt;
&lt;li&gt;Vitalik Buterin. STARKs. https:&#x2F;&#x2F;web.archive.org&#x2F;web&#x2F;20230425101334&#x2F;https:&#x2F;&#x2F;vitalik.ca&#x2F;general&#x2F;2017&#x2F;11&#x2F;09&#x2F;starks_part_1.html&lt;&#x2F;li&gt;
&lt;li&gt;Bu ̈nz, Bootle, Boneh, et. al. Bulletproofs. https:&#x2F;&#x2F;eprint.iacr.org&#x2F;2017&#x2F;1066.pdf&lt;&#x2F;li&gt;
&lt;li&gt;Range Proofs. https:&#x2F;&#x2F;www.cosic.esat.kuleuven.be&#x2F;ecrypt&#x2F;provpriv2012&#x2F;abstracts&#x2F;canard.pdf&lt;&#x2F;li&gt;
&lt;li&gt;Apple. Secure Enclaves. https:&#x2F;&#x2F;developer.apple.com&#x2F;documentation&#x2F;security&#x2F;certificate_key_and_trust_services&#x2F;keys&#x2F;storing_keys_in_the_secure_enclave&lt;&#x2F;li&gt;
&lt;li&gt;Intel Software Guard Extensions. https:&#x2F;&#x2F;software.intel.com&#x2F;en-us&#x2F;sgx&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Attestation management contract</title>
        <published>2018-09-08T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Weiwu Zhang</name><email>a@colourful.land</email>
	</author>
	
	<author>
		<name>James Sangalli</name><email>j.l.sangalli@gmail.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1386/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/1386" />
        

        <id>https://wg-eips.ritovision.com/1386/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:1386"
            label="ERC-1386" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1386/">&lt;h3 id=&quot;introduction&quot;&gt;Introduction&lt;&#x2F;h3&gt;
&lt;p&gt;Very often, we will need to use Attestations like &quot;Alice lives in Australia&quot; on the blockchain; that is issued by a valid issuer off chain for privacy reasons and is revokable inside a smart contract.&lt;&#x2F;p&gt;
&lt;p&gt;An issuer can create a smart contract where he revokes multiple attestations in one go by building a bloom filter of all the hashes of the revoked attestations.&lt;&#x2F;p&gt;
&lt;p&gt;An issuer can also put the validation method in their smart contract that can be called by other smart contracts who need to validate attestations issued by them. This allows each attestor to update their attestation format separately.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;purpose&quot;&gt;Purpose&lt;&#x2F;h3&gt;
&lt;p&gt;This ERC provides an interface for attestation issuers to manage their attestation signing keys and the attestations that are issued off chain for actions such as revocation and validation.&lt;&#x2F;p&gt;
&lt;p&gt;In our draft implementation we include functions to hold cryptographic attestations, change the issuing contracts of attestations, revoke attestations and verify the authenticity of a cryptographic attestation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;example-use-cases&quot;&gt;Example use cases&lt;&#x2F;h3&gt;
&lt;p&gt;Let&#x27;s say that our friend, Alice, wants to buy a bottle of wine to consume with her friends. She wants to do the order online and have it delivered to her home address whilst paying for it with Ether.&lt;&#x2F;p&gt;
&lt;p&gt;Alice has a cryptographic attestation from her local road and maritime services who attests to her age, date of birth, country of residence and ability to drive.&lt;&#x2F;p&gt;
&lt;p&gt;Alice is able to split up this attestation (see merkle tree attestations ERC &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;alpha-wallet&#x2F;blockchain-attestation&#x2F;blob&#x2F;master&#x2F;ethereum&#x2F;lib&#x2F;MerkleTreeAttestation.sol&quot;&gt;here&lt;&#x2F;a&gt;) and provides only the leaf that states she is over the age of 21.&lt;&#x2F;p&gt;
&lt;p&gt;Alice goes to buy the wine through the wine vendors smart contract and feeds in the merkle tree attestation proving that she is above 21 and can thus buy the wine, whilst attaching the appropriate amount of ether to complete the purchase.&lt;&#x2F;p&gt;
&lt;p&gt;The issuer smart contract is able to validate her attestation, check that the issuer contract is valid and capable of performing such an attestation to her age. In this case it would have to be from someone like a driver&#x27;s licence authority, as attestations to age from a school ID are not of a high enough capacity.&lt;&#x2F;p&gt;
&lt;p&gt;The wine vendors smart contract validates the attestation, checks the payment amount is correct and credits Alice with the wine tokens she needs to complete the sale and deliver the wine.&lt;&#x2F;p&gt;
&lt;p&gt;When the wine vendor shows up to her apartment with the wine, there is no need to prove her age again.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;draft-interface&quot;&gt;Draft interface&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; each attestation issuer should provide their own verify() for the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * attestations they issued. There are two reasons for this. First, we&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * need to leave room for new attestation methods other than the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * Merkle Tree format we are recommending. Second, the validity of the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * attestation may depend on the context that only the attestor&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * knows. For example, a ticket as an attestation issued on a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * successful redemption of an American Express credit &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Issuer&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Attestation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; merklePath&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span&gt; valid&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint8&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; r&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; s&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; attestor&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; salt&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; val&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify the authenticity of an attestation &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Attestation&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attestation&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addattestorKey&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newAttestor&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; capacity&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expiry&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; this should call the revoke first &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; replaceKey&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attestorToReplace&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; capacity&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expiry&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newAttestor&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; this revokes a single key &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; removeKey&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attestor&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if the key exists with such capacity and isn&amp;#39;t revoked or expired &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validateKey&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attestor&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; capacity&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; revoke an attestation by replace the bloom filter, this helps preserve privacy &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revokeAttestations&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Bloomfilter&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; b&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Please click &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;alpha-wallet&#x2F;blockchain-attestation&#x2F;blob&#x2F;master&#x2F;ethereum&#x2F;example-james-squire&#x2F;james-squire.sol&quot;&gt;here&lt;&#x2F;a&gt; to see a draft implementation of this interface&lt;&#x2F;p&gt;
&lt;h3 id=&quot;related-erc-s&quot;&gt;Related ERC&#x27;s&lt;&#x2F;h3&gt;
&lt;p&gt;#1388 #1387&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Merkle Tree Attestations with Privacy enabled</title>
        <published>2018-09-08T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Weiwu Zhang</name><email>a@colourful.land</email>
	</author>
	
	<author>
		<name>James Sangalli</name><email>j.l.sangalli@gmail.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1387/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/1387" />
        

        <id>https://wg-eips.ritovision.com/1387/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1387"
            label="ERC-1387" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1387/">&lt;h3 id=&quot;introduction&quot;&gt;Introduction&lt;&#x2F;h3&gt;
&lt;p&gt;It&#x27;s often needed that an Ethereum smart contract must verify a claim (I live in Australia) attested by a valid attester.&lt;&#x2F;p&gt;
&lt;p&gt;For example, an ICO contract might require that the participant, Alice, lives in Australia before she participates. Alice&#x27;s claim of residency could come from a local Justice of the Peace who could attest that &quot;Alice is a resident of Australia in NSW&quot;.&lt;&#x2F;p&gt;
&lt;p&gt;Unlike previous attempts, we assume that the attestation is signed and issued off the blockchain in a Merkle Tree format. Only a part of the Merkle tree is revealed by Alice at each use. Therefore we avoid the privacy problem often associated with issuing attestations on chain. We also assume that Alice has multiple signed Merkle Trees for the same factual claim to avoid her transactions being linkable.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;purpose&quot;&gt;Purpose&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC provides an interface and reference implementation for smart contracts that need users to provide an attestation and validate it.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;draft-implementation&quot;&gt;Draft implementation&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MerkleTreeAttestationInterface&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Attestation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; merklePath&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span&gt; valid&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint8&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; r&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; s&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; attester&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; salt&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; val&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Attestation&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attestation&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;relevant-implementation-examples&quot;&gt;Relevant implementation examples&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;alpha-wallet&#x2F;blockchain-attestation&#x2F;blob&#x2F;master&#x2F;ethereum&#x2F;lib&#x2F;MerkleTreeAttestation.sol&quot;&gt;Here&lt;&#x2F;a&gt; is an example implementation of the MerkleTreeAttestationInterface
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;alpha-wallet&#x2F;blockchain-attestation&#x2F;blob&#x2F;master&#x2F;ethereum&#x2F;example-james-squire&#x2F;james-squire.sol&quot;&gt;Here&lt;&#x2F;a&gt; is an example service which would use such a merkle tree attestation&lt;&#x2F;p&gt;
&lt;h3 id=&quot;related-erc-s&quot;&gt;Related ERC&#x27;s&lt;&#x2F;h3&gt;
&lt;p&gt;#1388 #1386&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Attestation Issuers Management List</title>
        <published>2018-09-08T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Weiwu Zhang</name><email>a@colourful.land</email>
	</author>
	
	<author>
		<name>James Sangalli</name><email>j.l.sangalli@gmail.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1388/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/1388" />
        

        <id>https://wg-eips.ritovision.com/1388/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1388"
            label="ERC-1388" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1388/">&lt;h3 id=&quot;introduction&quot;&gt;Introduction&lt;&#x2F;h3&gt;
&lt;p&gt;In smart contracts, we will need methods to handle cryptographic attestations to a users identifier or abilities. Let&#x27;s say we have a real estate agent, KiwiRealtors, that provides an &quot;expression of interest&quot; function though a smart contract and requires the users to provide an attestation that they are a resident of New Zealand or Australia, as a legal requirement. This has actually happened in the New Zealand property market and it is the perfect example of a need to handle such attestations.&lt;&#x2F;p&gt;
&lt;p&gt;However, it is not practical for a smart contract to explicitly trust an attestation issuer. There are multiple issuers who can provide an attestation to a person&#x27;s residency - a local Justice of the Peace, the land title office, local police, passport authority etc. We envision a model where the effort to manage the list of qualified issuers is practically outsourced to a list.&lt;&#x2F;p&gt;
&lt;p&gt;Anyone can publish a list of issuers. Only the most trusted and carefully maintained lists gets popular use.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;purpose&quot;&gt;Purpose&lt;&#x2F;h3&gt;
&lt;p&gt;This ERC provides a smart contract interface for anyone to manage a list of attestation issuers. A smart contract would explicitly trust a list, and therefore all attestations issued by the issuers on the list.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;draft-implementation&quot;&gt;Draft implementation&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The purpose of this contract is to manage the list of attestation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * issuer contracts and their capacity to fulfill requirements&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ManagedListERC&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;      &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; a manager is the steward of a list. Only he&#x2F;she&#x2F;it can change the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;       * list by removing&#x2F;adding attestation issuers to the list.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;       * An issuer in the list is represented by their contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;       * addresses, not by the attestation signing keys managed by such a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;       * contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;       *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; List&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	      string&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	      string&lt;&#x2F;span&gt;&lt;span&gt; description&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; short description of what the list entails&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	      string&lt;&#x2F;span&gt;&lt;span&gt; capacity&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; serves as a filter for the attestation signing keys&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	  &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if a smart contract specifies a list, only attestation issued&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	   * by issuers on that list is accepted. Furthermore, if that&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	   * list has a non-empty capacity, only attestations signed by a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	   * signing key with that capacity is accepted. &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	    address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; issuerContracts&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; all these addresses are contracts, no signing capacity&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	    uint&lt;&#x2F;span&gt;&lt;span&gt; expiry&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; find which list the sender is managing, then add an issuer to it&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addIssuer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; issuerContractAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;return false if the list identified by the sender doesn&amp;#39;t have this issuer in the list&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; removeIssuer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; issuerContractAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; List&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; listToRemoveIssuerFrom&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;      &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; called by services, e.g. Kiwi Properties or James Squire &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;      &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; loop through all issuer&amp;#39;s contract and execute validateKey() on&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;       * every one of them in the hope of getting a hit, return the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;       * contract address of the first hit. &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; that there is an attack&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;       * method for one issuer to claim to own the key of another which&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;       * is mitigated by later design. &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;       &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;loop through the issuers array, calling validate on the signingKeyOfAttestation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getIssuerCorrespondingToAttestationKey&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; list_id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signingKeyOfAttestation&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;       &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; for simplicity we use sender&amp;#39;s address as the list ID,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * accepting these consequences: a) if one user wish to maintain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * several lists with different capacity, he or she must use a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * different sender address for each. b) if the user replaced the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * sender&amp;#39;s key, either because he or she suspects the key is&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * compromised or that it is lost and reset through special means,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * then the list is still identified by the first sender&amp;#39;s&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;	 * address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;      *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; createList&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;List&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; list&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;      &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; replace list manager&amp;#39;s key with the new key &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; replaceListIndex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;List&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; list&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; manager&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Click &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;alpha-wallet&#x2F;blockchain-attestation&#x2F;blob&#x2F;master&#x2F;ethereum&#x2F;trustlist&#x2F;ManagedList.sol&quot;&gt;here&lt;&#x2F;a&gt; to see an example implementation of this ERC&lt;&#x2F;p&gt;
&lt;h3 id=&quot;related-erc-s&quot;&gt;Related ERC&#x27;s&lt;&#x2F;h3&gt;
&lt;p&gt;#1387 #1386&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Reduced gas cost for call to self</title>
        <published>2018-08-31T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	<author>
		<name>Jacques Wagener</name><uri>https://github.com/jacqueswww</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1380/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-1380-reduced-gas-cost-for-call-to-self/1242" />
        

        <id>https://wg-eips.ritovision.com/1380/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:1380"
            label="EIP-1380" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1380/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Reduce the gas cost for call instructions, when the goal is to run a new instance of the currently loaded contract.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The current gas cost of 700 for all call types (&lt;code&gt;CALL&lt;&#x2F;code&gt;, &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;, &lt;code&gt;CALLCODE&lt;&#x2F;code&gt; and &lt;code&gt;STATICCALL&lt;&#x2F;code&gt;) does not take into account that a call to a contract itself
does not need to perform additional I&#x2F;O operations, because the current contract code has already been loaded into memory.&lt;&#x2F;p&gt;
&lt;p&gt;Reducing the call-to-self gas cost would greatly benefit smart contract languages, such as Solidity and Vyper, who would then be able to utilise &lt;code&gt;CALL&lt;&#x2F;code&gt; instead
of &lt;code&gt;JUMP&lt;&#x2F;code&gt; opcodes for internal function calls. While languages can already utilise &lt;code&gt;CALL&lt;&#x2F;code&gt; for internal function calls, they are discouraged to do so due to the
gas costs associated with it.&lt;&#x2F;p&gt;
&lt;p&gt;Using &lt;code&gt;JUMP&lt;&#x2F;code&gt; comes at a considerable cost in complexity to the implementation of a smart contract language and&#x2F;or compiler. The context (including stack and memory)
must be swapped in and out of the calling functions context. A desired feature is having &lt;em&gt;pure&lt;&#x2F;em&gt; functions, which do not modify the state of memory, and realising
them through &lt;code&gt;JUMP&lt;&#x2F;code&gt; requires a bigger effort from the compiler as opposed to being able to use &lt;code&gt;CALL&lt;&#x2F;code&gt;s.&lt;&#x2F;p&gt;
&lt;p&gt;Using call-to-self provides the guarantee that when making an internal call the function can rely on a clear reset state of memory or context, benefiting both
contract writers and contract consumers against potentially undetected edge cases were memory could poison the context of the internal function.&lt;&#x2F;p&gt;
&lt;p&gt;Because of the &lt;code&gt;JUMP&lt;&#x2F;code&gt; usage for internal functions a smart contract languages are also at risk of reaching the stack depth limit considerably faster, if nested
function calls with many in and&#x2F;or outputs are required.&lt;&#x2F;p&gt;
&lt;p&gt;Reducing the gas cost, and thereby incentivising of using call-to-self instead of &lt;code&gt;JUMP&lt;&#x2F;code&gt;s for the internal function implementation will also benefit static
analyzers and tracers.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= FORK_BLKNUM&lt;&#x2F;code&gt;, then decrease the cost of &lt;code&gt;CALL&lt;&#x2F;code&gt;, &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;, &lt;code&gt;CALLCODE&lt;&#x2F;code&gt; and &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; from 700 to 40,
if and only if, the destination address of the call equals to the address of the caller.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;EIP150 has increased the cost of these instructions from 40 to 700 to more fairly charge for loading new contracts from disk, e.g. to reflect the I&#x2F;O charge more closely.
By assuming that 660 is the cost of loading a contract from disk, one can assume that the original 40 gas is a fair cost of creating a new VM instance of an already loaded contract code.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This should pose no risk to backwards compatibility. Currently existing contracts should not notice the difference, just see cheaper execution.
With EIP150 contract (and language) developers had a lesson that relying on strict gas costs is not feasible as costs may change.
The impact of this EIP is even less that of EIP150 because the costs are changing downwards and not upwards.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBA&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TBA&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Payable Token</title>
        <published>2018-08-30T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Vittorio Minacori</name><uri>https://github.com/vittominacori</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1363/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/eips/issues/1363" />
        

        <id>https://wg-eips.ritovision.com/1363/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:1363"
            label="ERC-1363" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1363/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Defines a token interface for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens that supports executing recipient code after &lt;code&gt;transfer&lt;&#x2F;code&gt; or &lt;code&gt;transferFrom&lt;&#x2F;code&gt;, or spender code after &lt;code&gt;approve&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Standard functions a token contract and contracts working with tokens can implement to make a token Payable.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;transferAndCall&lt;&#x2F;code&gt; and &lt;code&gt;transferFromAndCall&lt;&#x2F;code&gt; will call an &lt;code&gt;onTransferReceived&lt;&#x2F;code&gt; on a &lt;code&gt;ERC1363Receiver&lt;&#x2F;code&gt; contract.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;approveAndCall&lt;&#x2F;code&gt; will call an &lt;code&gt;onApprovalReceived&lt;&#x2F;code&gt; on a &lt;code&gt;ERC1363Spender&lt;&#x2F;code&gt; contract.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;There is no way to execute code after a &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; transfer or approval (i.e. making a payment), so to make an action it is required to send another transaction and pay GAS twice.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal wants to make token payments easier and working without the use of any other listener. It allows to make a callback after a transfer or approval in a single transaction.&lt;&#x2F;p&gt;
&lt;p&gt;There are many proposed uses of Ethereum smart contracts that can accept &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; payments.&lt;&#x2F;p&gt;
&lt;p&gt;Examples could be&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;to create a token payable crowdsale&lt;&#x2F;li&gt;
&lt;li&gt;selling services for tokens&lt;&#x2F;li&gt;
&lt;li&gt;paying invoices&lt;&#x2F;li&gt;
&lt;li&gt;making subscriptions&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;For these reasons it was named as &lt;strong&gt;&quot;Payable Token&quot;&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Anyway you can use it for specific utilities or for any other purposes who require the execution of a callback after a transfer or approval received.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal has been inspired by the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; &lt;code&gt;onERC721Received&lt;&#x2F;code&gt; and &lt;code&gt;ERC721TokenReceiver&lt;&#x2F;code&gt; behaviours.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Implementing contracts &lt;strong&gt;MUST&lt;&#x2F;strong&gt; implement the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1363&#x2F;&quot;&gt;ERC-1363&lt;&#x2F;a&gt; interface as well as the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; interfaces.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC1363&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is ERC20, ERC165 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;*&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0xb0202a11.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * 0xb0202a11 ===&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *   bytes4(keccak256(&amp;#39;transferAndCall(address,uint256)&amp;#39;)) ^&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *   bytes4(keccak256(&amp;#39;transferAndCall(address,uint256,bytes)&amp;#39;)) ^&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *   bytes4(keccak256(&amp;#39;transferFromAndCall(address,address,uint256)&amp;#39;)) ^&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *   bytes4(keccak256(&amp;#39;transferFromAndCall(address,address,uint256,bytes)&amp;#39;)) ^&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *   bytes4(keccak256(&amp;#39;approveAndCall(address,uint256)&amp;#39;)) ^&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *   bytes4(keccak256(&amp;#39;approveAndCall(address,uint256,bytes)&amp;#39;))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfer tokens from `msg.sender` to another address and then call `onTransferReceived` on receiver&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address The address which you want to transfer to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; uint256 The amount of tokens to be transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; true&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; unless throwing&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferAndCall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfer tokens from `msg.sender` to another address and then call `onTransferReceived` on receiver&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address The address which you want to transfer to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; uint256 The amount of tokens to be transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; bytes Additional data with no specified format, sent in call to `to`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; true&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; unless throwing&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferAndCall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfer tokens from one address to another and then call `onTransferReceived` on receiver&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address The address which you want to send tokens from&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address The address which you want to transfer to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; uint256 The amount of tokens to be transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; true&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; unless throwing&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFromAndCall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfer tokens from one address to another and then call `onTransferReceived` on receiver&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address The address which you want to send tokens from&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address The address which you want to transfer to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; uint256 The amount of tokens to be transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; bytes Additional data with no specified format, sent in call to `to`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; true&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; unless throwing&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFromAndCall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Approve the passed address to spend the specified amount of tokens on behalf of msg.sender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * and then call `onApprovalReceived` on spender.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address The address which will spend the funds&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; uint256 The amount of tokens to be spent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; true&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; unless throwing&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approveAndCall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Approve the passed address to spend the specified amount of tokens on behalf of msg.sender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * and then call `onApprovalReceived` on spender.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address The address which will spend the funds&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; uint256 The amount of tokens to be spent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; bytes Additional data with no specified format, sent in call to `spender`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; true&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; unless throwing&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approveAndCall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC20&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; allowance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Approval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC165&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;A contract that wants to accept token payments via &lt;code&gt;transferAndCall&lt;&#x2F;code&gt; or &lt;code&gt;transferFromAndCall&lt;&#x2F;code&gt; &lt;strong&gt;MUST&lt;&#x2F;strong&gt; implement the following interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC1363Receiver interface&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Interface for any contract that wants to support `transferAndCall` or `transferFromAndCall`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *  from ERC1363 token contracts.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC1363Receiver&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;*&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0x88a7ca5c.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * 0x88a7ca5c === bytes4(keccak256(&amp;quot;onTransferReceived(address,address,uint256,bytes)&amp;quot;))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Handle the receipt of ERC1363 tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Any ERC1363 smart contract calls this function on the recipient&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * after a `transfer` or a `transferFrom`. This function MAY throw to revert and reject the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * transfer. Return of other than the magic value MUST result in the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * transaction being reverted.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the token contract address is always the message sender.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address The address which called `transferAndCall` or `transferFromAndCall` function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address The address which are token transferred from&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; uint256 The amount of tokens transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; bytes Additional data with no specified format&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `bytes4(keccak256(&amp;quot;onTransferReceived(address,address,uint256,bytes)&amp;quot;))`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *  unless throwing&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onTransferReceived&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;A contract that wants to accept token payments via &lt;code&gt;approveAndCall&lt;&#x2F;code&gt; &lt;strong&gt;MUST&lt;&#x2F;strong&gt; implement the following interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC1363Spender interface&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Interface for any contract that wants to support `approveAndCall`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *  from ERC1363 token contracts.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC1363Spender&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;*&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0x7b04a2d0.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * 0x7b04a2d0 === bytes4(keccak256(&amp;quot;onApprovalReceived(address,uint256,bytes)&amp;quot;))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Handle the approval of ERC1363 tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Any ERC1363 smart contract calls this function on the recipient&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * after an `approve`. This function MAY throw to revert and reject the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * approval. Return of other than the magic value MUST result in the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * transaction being reverted.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the token contract address is always the message sender.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address The address which called `approveAndCall` function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; uint256 The amount of tokens to be spent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; bytes Additional data with no specified format&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `bytes4(keccak256(&amp;quot;onApprovalReceived(address,uint256,bytes)&amp;quot;))`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *  unless throwing&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onApprovalReceived&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The choice to use &lt;code&gt;transferAndCall&lt;&#x2F;code&gt;, &lt;code&gt;transferFromAndCall&lt;&#x2F;code&gt; and &lt;code&gt;approveAndCall&lt;&#x2F;code&gt; derives from the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; naming. They want to highlight that they have the same behaviours of &lt;code&gt;transfer&lt;&#x2F;code&gt;, &lt;code&gt;transferFrom&lt;&#x2F;code&gt; and &lt;code&gt;approve&lt;&#x2F;code&gt; with the addition of a callback on receiver or spender.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal has been inspired also by &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;223&quot;&gt;ERC-223&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;677&quot;&gt;ERC-677&lt;&#x2F;a&gt; but it uses the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; approach, so it doesn&#x27;t override the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; &lt;code&gt;transfer&lt;&#x2F;code&gt; and &lt;code&gt;transferFrom&lt;&#x2F;code&gt; methods and defines the interfaces IDs to be implemented maintaining the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; backwards compatibility.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;approveAndCall&lt;&#x2F;code&gt; and &lt;code&gt;transferFromAndCall&lt;&#x2F;code&gt; methods can be affected by the same issue of the standard &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; &lt;code&gt;approve&lt;&#x2F;code&gt; and &lt;code&gt;transferFrom&lt;&#x2F;code&gt; method.&lt;&#x2F;p&gt;
&lt;p&gt;Changing an allowance with the &lt;code&gt;approveAndCall&lt;&#x2F;code&gt; methods brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering.&lt;&#x2F;p&gt;
&lt;p&gt;One possible solution to mitigate this race condition is to first reduce the spender&#x27;s allowance to 0 and set the desired value afterwards (&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;20#issuecomment-263524729&quot;&gt;EIP-20#issuecomment-263524729&lt;&#x2F;a&gt;).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Ethash 1a</title>
        <published>2018-08-26T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Paweł Bylica</name><uri>https://github.com/chfast</uri>
	</author>
	
	<author>
		<name>Jean M. Cyr</name><uri>https://github.com/jean-m-cyr</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1355/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-1355-ethash-1a/1167" />
        

        <id>https://wg-eips.ritovision.com/1355/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1355"
            label="EIP-1355" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1355/">&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Provide minimal set of changes to Ethash algorithm to hinder and delay the adoption of ASIC based mining.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Define hash function &lt;code&gt;fnv1a()&lt;&#x2F;code&gt; as&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fnv1a&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;v1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; v2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;v1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ^&lt;&#x2F;span&gt;&lt;span&gt; v2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; FNV1A_PRIME&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where &lt;code&gt;FNV1A_PRIME&lt;&#x2F;code&gt; is 16777499 or 16777639.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Change the hash function that determines the DAG item index in Ethash algorithm from &lt;code&gt;fnv()&lt;&#x2F;code&gt; to new &lt;code&gt;fnv1a()&lt;&#x2F;code&gt;.
In &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;eth-wiki&#x2F;blob&#x2F;master&#x2F;concepts&#x2F;ethash&#x2F;ethash.md#main-loop&quot;&gt;Main Loop&lt;&#x2F;a&gt; change&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;p&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; fnv&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ^&lt;&#x2F;span&gt;&lt;span&gt; s&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; mix&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span&gt; w&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; mixhashes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; mixhashes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;to&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;p&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; fnv1a&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ^&lt;&#x2F;span&gt;&lt;span&gt; s&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; mix&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span&gt; w&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; mixhashes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; mixhashes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The usual argument for decentralization and network security.&lt;&#x2F;p&gt;
&lt;p&gt;Unless programmable, an ASIC is hardwired to perform sequential operations in a given order. fnv1a changes the order in which an exclusive-or and a multiply are applied, effectively disabling the current wave of ASICS. A second objective is minimize ethash changes to be the least disruptive, to facilitate rapid development, and to lower the analysis and test requirements. Minimizing changes to ethash reduces risk associated with updating all affected network components, and also reduces the risk of detuning existing GPUs. It&#x27;s expected that this specific change would have no effect on existing GPU performance.&lt;&#x2F;p&gt;
&lt;p&gt;Changing fnv to fnv1a has no cryptographic implications. It is merely an efficient hash function with good dispersion characteristics used to scramble DAG indexing. We remain focused on risk mitigation by reducing the need for rigorous cryptographic analysis.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;fnv-primes&quot;&gt;FNV Primes&lt;&#x2F;h3&gt;
&lt;p&gt;The 16777639 satisfies all requirements from &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Fowler%E2%80%93Noll%E2%80%93Vo_hash_function#FNV_prime&quot;&gt;Wikipedia&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The 16777499 is preferred by FNV authors but not used in the reference FNV implementation because of historical reasons.
See &lt;a rel=&quot;external&quot; href=&quot;http:&#x2F;&#x2F;www.isthe.com&#x2F;chongo&#x2F;tech&#x2F;comp&#x2F;fnv&#x2F;index.html#fnv-prime&quot;&gt;A few remarks on FNV primes&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;This work is licensed under a &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;creativecommons.org&#x2F;licenses&#x2F;by-nc-sa&#x2F;4.0&#x2F;&quot;&gt;Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>ChainID opcode</title>
        <published>2018-08-22T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Richard Meissner</name><uri>https://github.com/rmeissner</uri>
	</author>
	
	<author>
		<name>Bryant Eisenbach</name><uri>https://github.com/fubuloubu</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1344/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/add-chain-id-opcode-for-replay-protection-when-handling-signed-messages-in-contracts/1131" />
        

        <id>https://wg-eips.ritovision.com/1344/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1344"
            label="EIP-1344" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1344/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP adds an opcode that returns the current chain&#x27;s EIP-155 unique identifier.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt; proposes to use the chain ID to prevent replay attacks between different chains. It would be a great benefit to have the same possibility inside smart contracts when handling signatures, especially for Layer 2 signature schemes using &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Adds a new opcode &lt;code&gt;CHAINID&lt;&#x2F;code&gt; at 0x46, which uses 0 stack arguments. It pushes the current chain ID onto the stack. Chain ID is a 256-bit value. The operation costs &lt;code&gt;G_base&lt;&#x2F;code&gt; to execute.&lt;&#x2F;p&gt;
&lt;p&gt;The value of the current chain ID is obtained from the chain ID configuration, which should match the EIP-155 unique identifier a client will accept from incoming transactions. Please note that per EIP-155, it is not &lt;em&gt;required&lt;&#x2F;em&gt; that a transaction have an EIP-155 unique identifier, but in that scenario this opcode will still return the configured chain ID and not a default.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The current approach proposed by EIP-712 is to specify the chain ID at compile time. Using this approach will result in problems after a hardfork, as well as human error that may lead to loss of funds or replay attacks on signed messages.
By adding the proposed opcode it will be possible to access the current chain ID and validate signatures based on that.&lt;&#x2F;p&gt;
&lt;p&gt;Currently, there is no specification for how chain ID is set for a particular network, relying on choices made manually by the client implementers and the chain community. There is a potential scenario where, during a &quot;contentious split&quot; over a divisive issue, a community using a particular value of chain ID will make a decision to split into two such chains. When this scenario occurs, it will be unsafe to maintain chain ID to the same value on both chains, as chain ID is used for replay protection for in-protocol transactions (per EIP-155), as well as for L2 and &quot;meta-transaction&quot; use cases (per EIP-712 as enabled by this proposal). There are two potential resolutions in this scenario under the current process: 1) one chain decides to modify their value of chain ID (while the other keeps it), or 2) both chains decide to modify their value of chain ID.&lt;&#x2F;p&gt;
&lt;p&gt;In order to mitigate this situation, users of the proposed &lt;code&gt;CHAINID&lt;&#x2F;code&gt; opcode &lt;strong&gt;must&lt;&#x2F;strong&gt; ensure that their application can handle a potential update to the value of chain ID during their usage of their application in case this does occur, if required for the continued use of the application. A Trustless Oracle that logs the timestamp when a change is made to chain ID can be implemented either as an application-level feature inside the application contract system, or referenced as a globally standard contract. Failure to provide a mitigation for this scenario could lead to a sudden loss of legitimacy of previously signed off-chain messages, which could be an issue during settlement periods and other longer-term verification events for these types of messages. Not all applications of this opcode may need mitigations to handle this scenario, but developers should provide reasoning on a case-by-case basis.&lt;&#x2F;p&gt;
&lt;p&gt;One example of a scenario where it would not make sense to leverage a global oracle is with the Plasma L2 paradigm. In the Plasma paradigm, an operator or group of operators submit blocks from the L2 network to the base chain (in this case Ethereum) summarizing transactions that have occurred on that chain. The submission of these blocks may not perfectly align with major events on the mainchain, such as a split causing an update of chain ID, which may cause a significant insecurity in the protocol if chain ID is utilized in signing messages. If the operators are not allowed to control the update of chain ID they will not be able to perfectly synchronize the update with their block submissions, and certain past transactions may be rejected because they do not align with the update. This is one example of the unintended consequences of trying to specify too much of the behavior of chain ID during a contentious split, and why having a simple opcode for access is most optimal, versus a more complicated precompile or contract.&lt;&#x2F;p&gt;
&lt;p&gt;This proposed opcode would be the simplest possible way to implement this functionality, and allows developers the flexibility to implement their own global or local handling of chain ID changes, if required.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is fully backwards compatible with all chains which implement EIP-155 chain ID domain separator for transaction signing.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;&#x2F;h2&gt;
&lt;p&gt;This was previously suggested as part of &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;901&quot;&gt;EIP-901&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test Cases added to &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;tests&#x2F;pull&#x2F;627&quot;&gt;ethereum&#x2F;tests&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;A reference implementation for the Trinity Python client is &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;py-evm&#x2F;pull&#x2F;1803&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;An example implementation of a trustless chain ID oracle was implemented &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;fubuloubu&#x2F;chain-id-oracle&#x2F;blob&#x2F;master&#x2F;ChainIdOracle.vy&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>WalletConnect URI Format</title>
        <published>2018-08-15T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>ligi</name><uri>https://github.com/ligi</uri>
	</author>
	
	<author>
		<name>Pedro Gomes</name><uri>https://github.com/pedrouid</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1328/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/wallet-connect-eip/850" />
        

        <id>https://wg-eips.ritovision.com/1328/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1328"
            label="ERC-1328" />
        

        
        

        
        <summary type="html">Define URI format for initiating connections between applications and wallets</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1328/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard defines how the data to connect some application and a wallet can be encoded with a URI. This URI can then be shown either as a QR code or as a link.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;syntax&quot;&gt;Syntax&lt;&#x2F;h3&gt;
&lt;p&gt;WalletConnect request URI with the following parameters:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;request       = &amp;quot;wc&amp;quot; &amp;quot;:&amp;quot; topic [ &amp;quot;@&amp;quot; version ][ &amp;quot;?&amp;quot; parameters ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;topic         = STRING&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;version       = 1*DIGIT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;parameters    = parameter *( &amp;quot;&amp;amp;&amp;quot; parameter )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;parameter     = key &amp;quot;=&amp;quot; value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;key           = STRING&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;value         = STRING&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;semantics&quot;&gt;Semantics&lt;&#x2F;h3&gt;
&lt;p&gt;Required parameters are dependent on the WalletConnect protocol version:&lt;&#x2F;p&gt;
&lt;p&gt;For WalletConnect v1.0 protocol (&lt;code&gt;version&lt;&#x2F;code&gt;=&lt;code&gt;1&lt;&#x2F;code&gt;) the parameters are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;key&lt;&#x2F;code&gt; - symmetric key used for encryption&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;bridge&lt;&#x2F;code&gt; - url of the bridge server for relaying messages&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;For WalletConnect v2.0 protocol (&lt;code&gt;version&lt;&#x2F;code&gt;=&lt;code&gt;2&lt;&#x2F;code&gt;) the parameters are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;symKey&lt;&#x2F;code&gt; - symmetric key used for encrypting messages over relay&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;methods&lt;&#x2F;code&gt; - jsonrpc methods supported for pairing topic&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;relay-protocol&lt;&#x2F;code&gt; - transport protocol for relaying messages&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;relay-data&lt;&#x2F;code&gt; - (optional) transport data for relaying messages&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;expiryTimestamp&lt;&#x2F;code&gt; - (optional) unix epoch in seconds when pairing expires&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;example&quot;&gt;Example&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# 1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;wc:8a5e5bdc-a0e4-4702-ba63-8f1a5655744f@1?bridge=https%3A%2F%2Fbridge.walletconnect.org&amp;amp;key=41791102999c339c844880b23950704cc43aa840f3739e365323cda4dfa89e7a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# 2.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;wc:7f6e504bfad60b485450578e05678ed3e8e8c4751d3c6160be17160d63ec90f9@2?relay-protocol=irn&amp;amp;symKey=587d5484ce2a2a6ee3ba1962fdd7e8588e06200c46823bd18fbd67def96ad303&amp;amp;methods=[wc_sessionPropose],[wc_authRequest,wc_authBatchRequest]&amp;quot;&amp;amp;expiryTimestamp=1705934757&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal moves away from the JSON format used in the alpha version of the WalletConnect protocol because it suffered from very inefficient parsing of the intent of the QR code, thereby making it easier to create better QR code parsers APIs for wallets to implement. Also by using a URI instead of JSON inside the QR-Code the Android Intent system can be leveraged.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Versioning is required as part of the syntax for this URI specification to allow the WalletConnect protocol to evolve and allow backwards-compatibility whenever a new version is introduced.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;URIs should be shared between user devices or applications and no sensitive data is shared within the URI that could compromise the communication or would allow control of the user&#x27;s private keys.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Smart Contract Package Registry Interface</title>
        <published>2018-08-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>Piper Merriam</name><email>piper@ethereum.org</email>
	</author>
	
	<author>
		<name>Christopher Gewecke</name><email>christophergewecke@gmail.com</email>
	</author>
	
	<author>
		<name>g. nicholas d&#x27;andrea</name><email>nick.dandrea@consensys.net</email>
	</author>
	
	<author>
		<name>Nick Gheorghita</name><uri>https://github.com/njgheorghita</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1319/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/1319" />
        

        <id>https://wg-eips.ritovision.com/1319/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1319"
            label="ERC-1319" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1319/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;A standard interface for smart contract package registries.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP specifies an interface for publishing to and retrieving assets from smart contract package registries. It is a companion EIP to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;&quot;&gt;1123&lt;&#x2F;a&gt; which defines a standard for smart contract package manifests.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The goal is to establish a framework that allows smart contract publishers to design and deploy code registries with arbitrary business logic while exposing a set of common endpoints that tooling can use to retrieve assets for contract consumers.&lt;&#x2F;p&gt;
&lt;p&gt;A clear standard would help the existing EthPM Package Registry evolve from a centralized, single-project community resource into a decentralized multi-registry system whose constituents are bound together by the proposed interface. In turn, these registries could be ENS name-spaced, enabling installation conventions familiar to users of &lt;code&gt;npm&lt;&#x2F;code&gt; and other package managers.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Examples&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; ethpm&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; install&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; packages.zeppelin.eth&#x2F;Ownership&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; SimpleToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; web3&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;packaging&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                              .&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;registry&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;packages.ethpm.eth&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                              .&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getPackage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;simple-token&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                              .&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getVersion&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;^1.1.5&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The specification describes a small read&#x2F;write API whose components are mandatory. It allows registries to manage versioned releases using the conventions of &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;semver.org&#x2F;&quot;&gt;semver&lt;&#x2F;a&gt; without imposing this as a requirement. It assumes registries will share the following structure and conventions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;a &lt;strong&gt;registry&lt;&#x2F;strong&gt; is a deployed contract which manages a collection of &lt;strong&gt;packages&lt;&#x2F;strong&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;a &lt;strong&gt;package&lt;&#x2F;strong&gt; is a collection of &lt;strong&gt;releases&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;li&gt;a &lt;strong&gt;package&lt;&#x2F;strong&gt; is identified by a unique string name and unique bytes32 &lt;strong&gt;packageId&lt;&#x2F;strong&gt; within a given &lt;strong&gt;registry&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;li&gt;a &lt;strong&gt;release&lt;&#x2F;strong&gt; is identified by a &lt;code&gt;bytes32&lt;&#x2F;code&gt; &lt;strong&gt;releaseId&lt;&#x2F;strong&gt; which must be unique for a given package name and release version string pair.&lt;&#x2F;li&gt;
&lt;li&gt;a &lt;strong&gt;releaseId&lt;&#x2F;strong&gt; maps to a set of data that includes a &lt;strong&gt;manifestURI&lt;&#x2F;strong&gt; string which describes the location of an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;&quot;&gt;EIP 1123 package manifest&lt;&#x2F;a&gt;. This manifest contains data about the release including the location of its component code assets.&lt;&#x2F;li&gt;
&lt;li&gt;a &lt;strong&gt;manifestURI&lt;&#x2F;strong&gt; is a URI as defined by &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;tools.ietf.org&#x2F;html&#x2F;rfc3986&quot;&gt;RFC3986&lt;&#x2F;a&gt; which can be used to retrieve the contents of the package manifest. In addition to validation against RFC3986, each &lt;strong&gt;manifestURI&lt;&#x2F;strong&gt; must also contain a hash of the content as specified in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;&quot;&gt;EIP-1123&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;examples&quot;&gt;Examples&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;Package Names &#x2F; Release Versions&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;simple-token&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; package name&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;1.0.1&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; version string&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Release IDs&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Implementations are free to choose any scheme for generating a &lt;strong&gt;releaseId&lt;&#x2F;strong&gt;. A common approach would be to hash the strings together as below:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Hashes package name and a release version string&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; generateReleaseId&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; packageName&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; version&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  public&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; releaseId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;packageName&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; version&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Implementations &lt;strong&gt;must&lt;&#x2F;strong&gt; expose this id generation logic as part of their public &lt;code&gt;read&lt;&#x2F;code&gt; API so
tooling can easily map a string based release query to the registry&#x27;s unique identifier for that release.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Manifest URIs&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Any IPFS or Swarm URI meets the definition of &lt;strong&gt;manifestURI&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Another example is content on GitHub addressed by its SHA-1 hash. The Base64 encoded content at this hash can be obtained by running:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; https:&#x2F;&#x2F;api.github.com&#x2F;repos&#x2F;:owner&#x2F;:repo&#x2F;git&#x2F;blobs&#x2F;:file_sha&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Example&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; https:&#x2F;&#x2F;api.github.com&#x2F;repos&#x2F;rstallman&#x2F;hello&#x2F;git&#x2F;blobs&#x2F;ce013625030ba8dba906f756967f9e9ca394464a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The string &quot;hello&quot; can have its GitHub SHA-1 hash independently verified by comparing it to the output of:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; printf&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;blob 6\000hello\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; sha1sum&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; ce013625030ba8dba906f756967f9e9ca394464a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;write-api-specification&quot;&gt;Write API Specification&lt;&#x2F;h3&gt;
&lt;p&gt;The write API consists of a single method, &lt;code&gt;release&lt;&#x2F;code&gt;. It passes the registry the package name, a
version identifier for the release, and a URI specifying the location of a manifest which
details the contents of the release.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; release&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; packageName&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; version&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; manifestURI&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; releaseId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;events&quot;&gt;Events&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;versionrelease&quot;&gt;VersionRelease&lt;&#x2F;h4&gt;
&lt;p&gt;MUST be triggered when &lt;code&gt;release&lt;&#x2F;code&gt; is successfully called.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; VersionRelease&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; packageName&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; version&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; manifestURI&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;read-api-specification&quot;&gt;Read API Specification&lt;&#x2F;h3&gt;
&lt;p&gt;The read API consists of a set of methods that allows tooling to extract all consumable data from a registry.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieves a slice of the list of all unique package identifiers in a registry.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `offset` and `limit` enable paginated responses &#x2F; retrieval of the complete set.  (See &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; below)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getAllPackageIds&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; offset&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; limit&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; packageIds&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; pointer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieves the unique string `name` associated with a package&amp;#39;s id.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getPackageName&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; packageId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; packageName&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieves the registry&amp;#39;s unique identifier for an existing release of a package.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getReleaseId&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; packageName&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; version&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; releaseId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieves a slice of the list of all release ids for a package.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `offset` and `limit` enable paginated responses &#x2F; retrieval of the complete set. (See &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; below)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getAllReleaseIds&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; packageName&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; offset&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; limit&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; releaseIds&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; pointer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieves package name, release version and URI location data for a release id.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getReleaseData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; releaseId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; packageName&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; version&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; manifestURI&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieves the release id a registry *would* generate for a package name and version pair&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; when executing a release.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; generateReleaseId&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; packageName&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; version&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  public&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; releaseId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the total number of unique packages in a registry.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; numPackageIds&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; totalCount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the total number of unique releases belonging to the given packageName in a registry.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; numReleaseIds&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; packageName&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; totalCount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Pagination&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;getAllPackageIds&lt;&#x2F;code&gt; and &lt;code&gt;getAllReleaseIds&lt;&#x2F;code&gt; support paginated requests because it&#x27;s possible that the return values for these methods could become quite large. The methods should return a &lt;code&gt;pointer&lt;&#x2F;code&gt; that points to the next available item in a list of all items such that a caller can use it to pick up from where the previous request left off.  (See &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;mixmax.com&#x2F;blog&#x2F;api-paging-built-the-right-way&quot;&gt;here&lt;&#x2F;a&gt; for a discussion of the merits and demerits of various pagination strategies.) The &lt;code&gt;limit&lt;&#x2F;code&gt; parameter defines the maximum number of items a registry should return per request.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The proposal hopes to accomplish the following:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Define the smallest set of inputs necessary to allow registries to map package names to a set of
release versions while allowing them to use any versioning schema they choose.&lt;&#x2F;li&gt;
&lt;li&gt;Provide the minimum set of getter methods needed to retrieve package data from a registry so that registry aggregators can read all of their data.&lt;&#x2F;li&gt;
&lt;li&gt;Define a standard query that synthesizes a release identifier from a package name and version pair so that tooling can resolve specific package version requests without needing to query a registry about all of a package&#x27;s releases.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Registries may offer more complex &lt;code&gt;read&lt;&#x2F;code&gt; APIs that manage requests for packages within a semver range or at &lt;code&gt;latest&lt;&#x2F;code&gt; etc. This EIP is agnostic about how tooling or registries might implement these. It recommends that registries implement &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;EIP-165&lt;&#x2F;a&gt; and avail themselves of resources to publish more complex interfaces such as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;926&#x2F;&quot;&gt;EIP-926&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No existing standard exists for package registries. The package registry currently deployed by EthPM would not comply with the standard since it implements only one of the method signatures described in the specification.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;A reference implementation of this proposal is in active development at the EthPM organization on GitHub &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethpm&#x2F;escape-truffle&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>wallet_watchAsset RPC Method</title>
        <published>2018-08-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Dan Finlay</name><uri>https://github.com/danfinlay</uri>
	</author>
	
	<author>
		<name>Esteban Mino</name><uri>https://github.com/estebanmino</uri>
	</author>
	
	<author>
		<name>Gavin John</name><uri>https://github.com/Pandapip1</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/747/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-747-eth-watchtoken/1048" />
        

        <id>https://wg-eips.ritovision.com/747/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="interface"
                label="Interface" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:747"
            label="EIP-747" />
        

        
        

        
        <summary type="html">Adds a new RPC method that allows websites to prompt users to watch an asset</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/747/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP standardizes a new wallet-scoped RPC method, &lt;code&gt;wallet_watchAsset&lt;&#x2F;code&gt;, to allow a client to suggest a token for the user&#x27;s wallet to track.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Today, one of the major uses of Ethereum wallets is to track users&#x27; assets.
Without this EIP, each wallet either needs to pre-load a list of approved assets, or users must manually add assets to their wallet.
In the first case, wallets are burdened with both the security of managing this list, as well as the bandwidth of mass polling for known assets on their wallet.
In the second case, the user experience is terrible.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;A new RPC method, &lt;code&gt;wallet_watchAsset&lt;&#x2F;code&gt; is added. &lt;code&gt;wallet_watchAsset&lt;&#x2F;code&gt; requests that a specified asset be listed to the user&#x27;s wallet. It MUST immediately (i.e. before prompting the user) return &lt;code&gt;true&lt;&#x2F;code&gt; if the request was valid, or error if it was not. The meaning of &quot;listed to the user&#x27;s wallet&quot; is dependent on the wallet implementation. A successful call to &lt;code&gt;wallet_watchAsset&lt;&#x2F;code&gt; MUST indicate that the wallet recognized the request and that it contained no issues, but doesn&#x27;t indicate whether the user was prompted or whether the asset was actually added to the wallet.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;wallet-watchasset-parameters&quot;&gt;&lt;code&gt;wallet_watchAsset&lt;&#x2F;code&gt; Parameters&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;wallet_watchAsset&lt;&#x2F;code&gt; method takes a single parameter, a &lt;code&gt;WatchAssetParameters&lt;&#x2F;code&gt; object, which is defined as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; WatchAssetParameters&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The asset&amp;#39;s interface, e.g. &amp;#39;ERC1046&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  options&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; any&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;type&lt;&#x2F;code&gt; string SHOULD be the commonly accepted name of the interface implemented by the asset&#x27;s contract, e.g. &lt;code&gt;ERC1046&lt;&#x2F;code&gt;. Defining the global identifiers for different asset types is beyond the scope of this EIP.&lt;&#x2F;p&gt;
&lt;p&gt;This interface SHOULD be extended or modified depending on the asset &lt;code&gt;type&lt;&#x2F;code&gt;. These changes MUST be specified in separate EIPs.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;wallet-watchasset-returns&quot;&gt;&lt;code&gt;wallet_watchAsset&lt;&#x2F;code&gt; Returns&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;wallet_watchAsset&lt;&#x2F;code&gt; immediately (i.e. without waiting for user interaction) returns the boolean value &lt;code&gt;true&lt;&#x2F;code&gt; to indicate that the request was recognized (regardless of whether the user was prompted), or errors if the request is invalid. An error might occur in the following circumstances (not comprehensive):&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The asset type is unrecognized&#x2F;unsupported&lt;&#x2F;li&gt;
&lt;li&gt;The asset was blocked due to an allowlist or denylist (this makes the request &#x27;invalid&#x27; since the root cause requires developer action)&lt;&#x2F;li&gt;
&lt;li&gt;Downloading the image failed to load
&lt;ul&gt;
&lt;li&gt;The wallet didn&#x27;t load some of the metadata required to display the asset, in order to protect against a potential SSRF attack&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;erc1046-type&quot;&gt;&lt;code&gt;ERC1046&lt;&#x2F;code&gt; type&lt;&#x2F;h3&gt;
&lt;p&gt;The format of the options field is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC1046WatchAssetOptions&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The hexadecimal address of the token contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; number&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The chain ID of the asset. If empty, defaults to the current chain ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;address&lt;&#x2F;code&gt; is required, and the other fields are optional. &lt;code&gt;address&lt;&#x2F;code&gt; MUST be the &lt;code&gt;0x&lt;&#x2F;code&gt;-prefixed checksummed hexadecimal address of the token contract. &lt;code&gt;chainId&lt;&#x2F;code&gt; MUST be the chain ID to which the asset belongs.&lt;&#x2F;p&gt;
&lt;p&gt;If the checksum fails, the request MUST be considered invalid.&lt;&#x2F;p&gt;
&lt;p&gt;If the wallet does not recognize the &lt;code&gt;chainId&lt;&#x2F;code&gt;, or the &lt;code&gt;chainId&lt;&#x2F;code&gt; is blank and the wallet does not have a concept of &quot;active&quot; chain, the call MUST fail.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;wallet_watchAsset&lt;&#x2F;code&gt; MUST fetch the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1046&#x2F;&quot;&gt;ERC-1046&lt;&#x2F;a&gt; &lt;code&gt;tokenURI&lt;&#x2F;code&gt; and check the &lt;code&gt;interop&lt;&#x2F;code&gt; field to determine the type of the token. If the parsing fails, or the type is unknown, the RPC call MUST error.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;wallet_watchAsset&lt;&#x2F;code&gt; SHOULD check the &lt;code&gt;name&lt;&#x2F;code&gt; and &lt;code&gt;symbol&lt;&#x2F;code&gt; fields, and the contract &lt;code&gt;address&lt;&#x2F;code&gt; and &lt;code&gt;chainId&lt;&#x2F;code&gt; against a list of well-known tokens. If the name and&#x2F;or symbol are similar to ones on the list but the &lt;code&gt;chainId&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;address&lt;&#x2F;code&gt; don&#x27;t match, a warning SHOULD be presented to the user.&lt;&#x2F;p&gt;
&lt;p&gt;The wallet SHOULD whitelist and&#x2F;or blacklist specific ports and schemes to avoid SSRF attacks.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;legacy-erc20-type&quot;&gt;Legacy &lt;code&gt;ERC20&lt;&#x2F;code&gt; type&lt;&#x2F;h3&gt;
&lt;p&gt;The format of the options field is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC20WatchAssetOptions&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The hexadecimal address of the token contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; number&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The chain ID of the asset. If empty, defaults to the current chain ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;address&lt;&#x2F;code&gt; is required, and the other fields are optional. &lt;code&gt;address&lt;&#x2F;code&gt; MUST be the &lt;code&gt;0x&lt;&#x2F;code&gt;-prefixed checksummed hexadecimal address of the token contract. &lt;code&gt;chainId&lt;&#x2F;code&gt; MUST be the chain ID to which the asset belongs.&lt;&#x2F;p&gt;
&lt;p&gt;If the checksum fails, the request MUST be considered invalid.&lt;&#x2F;p&gt;
&lt;p&gt;If the wallet does not recognize the &lt;code&gt;chainId&lt;&#x2F;code&gt;, or the &lt;code&gt;chainId&lt;&#x2F;code&gt; is blank and the wallet does not have a concept of &quot;active&quot; chain, the call MUST fail.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;wallet_watchAsset&lt;&#x2F;code&gt; SHOULD check the &lt;code&gt;name&lt;&#x2F;code&gt; and &lt;code&gt;symbol&lt;&#x2F;code&gt; fields, and the contract &lt;code&gt;address&lt;&#x2F;code&gt; and &lt;code&gt;chainId&lt;&#x2F;code&gt; against a list of well-known tokens. If the name and&#x2F;or symbol are similar to ones on the list but the &lt;code&gt;chainId&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;address&lt;&#x2F;code&gt; don&#x27;t match, a warning SHOULD be presented to the user.&lt;&#x2F;p&gt;
&lt;p&gt;If possible, it is RECOMMENDED to instead use the &lt;code&gt;ERC1046&lt;&#x2F;code&gt; type, which supports images and custom metadata.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Displaying a user&#x27;s assets is a basic feature that every modern DApp user expects. Most wallets currently either manage their own asset lists, which they store client-side, or they query a centralized API for balances, which reduces decentralization and allows correlating account holders with IP addresses. Additionally, refreshing&#x2F;polling an asset list from the network can be costly, especially on bandwidth-constrained devices. Also, maintaining an asset list becomes a political act, provoking harassment and inducing pressure to list obscure assets.&lt;&#x2F;p&gt;
&lt;p&gt;Automatically listing assets makes assets into a sort of spam mail: Users suddenly see new assets that they don&#x27;t care about in their wallet. This can be used to send unsolicited information, or even to conduct phishing scams. This phenomenon is already common with airdropped tokens, a major cause of network congestion, because spamming people with new tokens has, so far, been rewarded with increased user attention.&lt;&#x2F;p&gt;
&lt;p&gt;When a user is manually adding an asset, they had likely previously learned about it from a website. At that moment, there was a natural alignment of interests, where both parties wanted the user to track the token. This is a natural point to introduce an API to easily allow these parties to collaborate.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;server-side-request-forgery&quot;&gt;Server-Side Request Forgery&lt;&#x2F;h3&gt;
&lt;p&gt;Wallets should be careful about making arbitrary requests to URLs. As such, it is recommended for wallets to sanitize the URI by whitelisting specific schemes and ports. A vulnerable wallet could be tricked into, for example, modifying data on a locally-hosted redis database.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;validation&quot;&gt;Validation&lt;&#x2F;h3&gt;
&lt;p&gt;Wallets should warn users if the symbol or name matches or is similar to another token, to avoid phishing scams.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;fingerprinting&quot;&gt;Fingerprinting&lt;&#x2F;h3&gt;
&lt;p&gt;To avoid fingerprinting based on wallet behavior and&#x2F;or listed assets, the RPC call must return as soon as the user is prompted or an error occurs, without waiting for the user to accept or deny the prompt.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Modify Ethereum PoW Incentive Structure and Delay Difficulty Bomb</title>
        <published>2018-08-05T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Brian Venturo</name><uri>https://github.com/atlanticcrypto</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1295/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/atlanticcrypto/Discussion/issues/1" />
        

        <id>https://wg-eips.ritovision.com/1295/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1295"
            label="EIP-1295" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1295/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Network security and overall ecosystem maturity warrants the continued incentivization of Proof of Work participation but may allow for a reduction in ancillary ETH issuance and the delay of the Difficulty Bomb. This EIP proposes a reduction of Uncle and removal of Nephew rewards while delaying the Difficulty Bomb with the Constantinople hard fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Starting with CNSTNTNPL_FORK_BLKNUM the client will calculate the difficulty based on a fake block number suggesting the client that the difficulty bomb is adjusting around 6 million blocks later than previously specified with the Homestead fork.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore, Uncle rewards will be adjusted and Nephew rewards will be removed to eliminate excess ancillary ETH issuance. The current ETH block reward of 3 ETH will remain constant.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Network scalability and security are at the forefront of risks to the Ethereum protocol. With great strides being made towards on and off chain scalability, the existence of an artificial throughput limiting device in the protocol is not warranted. Removing the risk of reducing throughput through the initialization of the Difficulty Bomb is &quot;low-hanging-fruit&quot; to ensure continued operation at a minimum of current throughput through the next major hard fork (scheduled for late 2019).&lt;&#x2F;p&gt;
&lt;p&gt;The security layer of the Ethereum network is and should remain robust. Incentives for continued operation of the security of the growing ecosystem are paramount.&lt;&#x2F;p&gt;
&lt;p&gt;At the same time, the ancillary issuance benefits of the Ethereum protocol can be adjusted to reduce the overall issuance profile. Aggressively adjusting Uncle and removing Nephew rewards will reduce the inflationary aspect of ETH issuance, while keeping the current block reward constant at 3 ETH will ensure top line incentives stay in place.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h4 id=&quot;relax-difficulty-with-fake-block-number&quot;&gt;Relax Difficulty with Fake Block Number&lt;&#x2F;h4&gt;
&lt;p&gt;For the purposes of &lt;code&gt;calc_difficulty&lt;&#x2F;code&gt;, simply replace the use of &lt;code&gt;block.number&lt;&#x2F;code&gt;, as used in the exponential ice age component, with the formula:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;fake_block_number = max(0, block.number - 6_000_000) if block.number &amp;gt;= CNSTNTNPL_FORK_BLKNUM else block.number&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;adjust-uncle-and-nephew-rewards&quot;&gt;Adjust Uncle and Nephew rewards&lt;&#x2F;h4&gt;
&lt;p&gt;If an uncle is included in a block for &lt;code&gt;block.number &amp;gt;= CNSTNTNPL_FORK_BLKNUM&lt;&#x2F;code&gt; such that &lt;code&gt;block.number - uncle.number = k&lt;&#x2F;code&gt;, the uncle reward is&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;new_uncle_reward = (3 - k) * new_block_reward &#x2F; 8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This is the existing pre-Constantinople formula for uncle rewards, adjusted to reward 2 levels of Uncles at a reduced rate.&lt;&#x2F;p&gt;
&lt;p&gt;The nephew reward for &lt;code&gt;block.number &amp;gt;= CNSTNTNPL_FORK_BLKNUM&lt;&#x2F;code&gt; is&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;new_nephew_reward = 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This is a removal of all rewards for Nephew blocks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The security layer of the Ethereum network is and should remain robust. Incentives for continued operation of the growing ecosystem’s security are paramount.&lt;&#x2F;p&gt;
&lt;p&gt;At the same time, the ancillary issuance benefits of the Ethereum protocol can be adjusted to reduce the overall issuance profile. Aggressively adjusting Uncle and removing Nephew rewards will reduce the inflationary aspect of ETH issuance, while keeping the current block reward constant at 3 ETH will ensure top line incentives stay in place.&lt;&#x2F;p&gt;
&lt;p&gt;The Difficulty Bomb was instituted as a type of planned obsolescence to force the implementation of network upgrades with regular frequency. With the focus on scalability for the protocol, delaying a mechanism whereby the throughput of the network can be limited artificially, due to any circumstance, is a logical step to ensure continued minimum network operation at the current throughput level. We believe the existence of the Difficulty Bomb has allowed for the inclusion of protocol upgrades in forced hard-forks, and will continue to do so.&lt;&#x2F;p&gt;
&lt;p&gt;Through August 4th, the 2018 year to date reward issued to Uncle blocks totaled over 635,000 ETH. The average reward per Uncle totals 2.27 ETH. The year to date average Uncle rate is 22.49%. Using the year to date metrics, the ongoing average ETH paid as an Uncle reward per block is 0.51 ETH plus the Uncle inclusion reward of 0.021 ETH (0.09375 ETH * .2249), total Uncle related reward per block being over 0.53 ETH. With total year to date block rewards totaling approximately 3,730,000 ETH, the network has paid an additional 17pct in Uncle rewards. This is issuance that can be reduced while still maintaining the overall integrity and incentivization of network security.&lt;&#x2F;p&gt;
&lt;p&gt;Reducing the issuance of ETH in rewarding Uncle blocks (forked blocks caused by latency in propagation, a multi-faceted problem) should directly incentivize the investment in technologies and efficiencies to reduce block propagation latency which may lead to a reduction in Network wide Uncle rates, reducing ancillary issuance further.&lt;&#x2F;p&gt;
&lt;p&gt;Reducing the Uncle rewards from the current specification to the proposed will yield two levels of ancillary ETH issuance for Uncles:&lt;&#x2F;p&gt;
&lt;p&gt;Level 1 Uncle -&amp;gt; 0.75 ETH&lt;&#x2F;p&gt;
&lt;p&gt;Level 2 Uncle -&amp;gt; 0.375 ETH&lt;&#x2F;p&gt;
&lt;p&gt;These levels are sufficient to continue incentivizing decentralized participation, while also providing an immediate economic incentive for the upgrade of the Ethereum node network and its tangential infrastructure.&lt;&#x2F;p&gt;
&lt;p&gt;We believe that the ETH network has been subsidizing transaction inclusion through the robust Uncle Reward structure since inception. We also believe that a removal of the set subsidy will create a dynamic response mechanism whereby Miners and transaction senders will minimize total costs of transaction inclusion. This dynamic response structure may limit unnecessary layer 1 transaction throughput while providing incentives for layer 2 scaling solutions.&lt;&#x2F;p&gt;
&lt;p&gt;The Nephew reward structure should be entirely eliminated.&lt;&#x2F;p&gt;
&lt;p&gt;Due to current market conditions, and the likelihood of a further USD denominated price decline (50%), we believe that any top line reduction to security incentives will put the Ethereum network at undue risk. Unlike the time of the Byzantium hard fork, current USD denominated economics for securing the Ethereum network threaten the participation of the most decentralized Miner community (at home miners), which we believe make up the largest proportion of the overall network hashrate. We believe eliminating this portion of the community will increase centralization and the probability of an organized network attack.&lt;&#x2F;p&gt;
&lt;p&gt;For a technology so new and with so much potential, we find it extremely irresponsible to increase the likelihood of a network attack by reducing ETH Issuance past this proposal’s level.&lt;&#x2F;p&gt;
&lt;p&gt;With a reduction to the Uncle and removal of the Nephew reward, ancillary ETH issuance should drop (under normal market conditions, i.e. 22.49% uncle rate) by over 75pct and total ETH issuance from the successful sealing and mining of valid blocks should drop over 10pct.&lt;&#x2F;p&gt;
&lt;p&gt;Paired with the diffusal of the Difficulty Bomb, this proposal strikes a balance between ensuring status quo network throughput, reducing overall ETH issuance, and continuing top line incentives for investment in infrastructure and efficiencies to continue operating the Ethereum network’s security layer.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is not forward compatible and introduces backwards incompatibilities in the difficulty calculation, as well as the block, uncle and nephew reward structure. Therefore, it should be included in a scheduled hardfork at a certain block number. It&#x27;s suggested to include this EIP in the second Metropolis hard-fork, Constantinople.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases shall be created once the specification is to be accepted by the developers or implemented by the clients.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Forthcoming.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Net gas metering for SSTORE without dirty maps</title>
        <published>2018-08-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Wei Tang</name><uri>https://github.com/sorpaas</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1283/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/sorpaas/EIPs/issues/1" />
        

        <id>https://wg-eips.ritovision.com/1283/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:1283"
            label="EIP-1283" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1283/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes net gas metering changes for &lt;code&gt;SSTORE&lt;&#x2F;code&gt; opcode, enabling
new usages for contract storage, and reducing excessive gas costs
where it doesn&#x27;t match how most implementations work.&lt;&#x2F;p&gt;
&lt;p&gt;This acts as an alternative for EIP-1087, where it tries to be
friendlier to implementations that use different optimization
strategies for storage change caches.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes a way for gas metering on SSTORE (as an alternative
for EIP-1087 and EIP-1153), using information that is more universally
available to most implementations, and requires as little change in
implementation structures as possible.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Storage slot&#x27;s original value&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;Storage slot&#x27;s current value&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Refund counter.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Usages that benefits from this EIP&#x27;s gas reduction scheme includes:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Subsequent storage write operations within the same call frame. This
includes reentry locks, same-contract multi-send, etc.&lt;&#x2F;li&gt;
&lt;li&gt;Exchange storage information between sub call frame and parent call
frame, where this information does not need to be persistent outside
of a transaction. This includes sub-frame error codes and message
passing, etc.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Definitions of terms are as below:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Storage slot&#x27;s original value&lt;&#x2F;em&gt;: This is the value of the storage if
a reversion happens on the &lt;em&gt;current transaction&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;Storage slot&#x27;s current value&lt;&#x2F;em&gt;: This is the value of the storage
before SSTORE operation happens.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;Storage slot&#x27;s new value&lt;&#x2F;em&gt;: This is the value of the storage after
SSTORE operation happens.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Replace &lt;code&gt;SSTORE&lt;&#x2F;code&gt; opcode gas cost calculation (including refunds) with
the following logic:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If &lt;em&gt;current value&lt;&#x2F;em&gt; equals &lt;em&gt;new value&lt;&#x2F;em&gt; (this is a no-op), 200 gas is
deducted.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;em&gt;current value&lt;&#x2F;em&gt; does not equal &lt;em&gt;new value&lt;&#x2F;em&gt;
&lt;ul&gt;
&lt;li&gt;If &lt;em&gt;original value&lt;&#x2F;em&gt; equals &lt;em&gt;current value&lt;&#x2F;em&gt; (this storage slot has
not been changed by the current execution context)
&lt;ul&gt;
&lt;li&gt;If &lt;em&gt;original value&lt;&#x2F;em&gt; is 0, 20000 gas is deducted.&lt;&#x2F;li&gt;
&lt;li&gt;Otherwise, 5000 gas is deducted. If &lt;em&gt;new value&lt;&#x2F;em&gt; is 0, add 15000
gas to refund counter.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;em&gt;original value&lt;&#x2F;em&gt; does not equal &lt;em&gt;current value&lt;&#x2F;em&gt; (this storage
slot is dirty), 200 gas is deducted. Apply both of the following
clauses.
&lt;ul&gt;
&lt;li&gt;If &lt;em&gt;original value&lt;&#x2F;em&gt; is not 0
&lt;ul&gt;
&lt;li&gt;If &lt;em&gt;current value&lt;&#x2F;em&gt; is 0 (also means that &lt;em&gt;new value&lt;&#x2F;em&gt; is not
0), remove 15000 gas from refund counter. We can prove that
refund counter will never go below 0.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;em&gt;new value&lt;&#x2F;em&gt; is 0 (also means that &lt;em&gt;current value&lt;&#x2F;em&gt; is not
0), add 15000 gas to refund counter.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;em&gt;original value&lt;&#x2F;em&gt; equals &lt;em&gt;new value&lt;&#x2F;em&gt; (this storage slot is
reset)
&lt;ul&gt;
&lt;li&gt;If &lt;em&gt;original value&lt;&#x2F;em&gt; is 0, add 19800 gas to refund counter.&lt;&#x2F;li&gt;
&lt;li&gt;Otherwise, add 4800 gas to refund counter.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Refund counter works as before -- it is limited to half of the gas
consumed. On a transaction level, refund counter will never go below
zero. However, there are some important notes depending on the
implementation details:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If an implementation uses &quot;transaction level&quot; refund counter (refund
is checkpointed at each call frame), then the refund counter
continues to be unsigned.&lt;&#x2F;li&gt;
&lt;li&gt;If an implementation uses &quot;execution-frame level&quot; refund counter
(a new refund counter is created at each call frame, and then merged
back to parent when the call frame finishes), then the refund
counter needs to be changed to signed -- at internal calls, a child
refund can go below zero.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;explanation&quot;&gt;Explanation&lt;&#x2F;h2&gt;
&lt;p&gt;The new gas cost scheme for &lt;code&gt;SSTORE&lt;&#x2F;code&gt; is divided into three different
types:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;No-op&lt;&#x2F;strong&gt;: the virtual machine does not need to do anything. This is
the case if &lt;em&gt;current value&lt;&#x2F;em&gt; equals &lt;em&gt;new value&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Fresh&lt;&#x2F;strong&gt;: this storage slot has not been changed, or has been reset
to its original value. This is the case if &lt;em&gt;current value&lt;&#x2F;em&gt; does not
equal &lt;em&gt;new value&lt;&#x2F;em&gt;, and &lt;em&gt;original value&lt;&#x2F;em&gt; equals &lt;em&gt;current value&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Dirty&lt;&#x2F;strong&gt;: this storage slot has already been changed. This is the
case if &lt;em&gt;current value&lt;&#x2F;em&gt; does not equal &lt;em&gt;new value&lt;&#x2F;em&gt;, and &lt;em&gt;original
value&lt;&#x2F;em&gt; does not equal &lt;em&gt;current value&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;We can see that the above three types cover all possible variations of
&lt;em&gt;original value&lt;&#x2F;em&gt;, &lt;em&gt;current value&lt;&#x2F;em&gt;, and &lt;em&gt;new value&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;No-op&lt;&#x2F;strong&gt; is a trivial operation. Below we only consider cases for
&lt;strong&gt;Fresh&lt;&#x2F;strong&gt; and &lt;strong&gt;Dirty&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;All initial (not-&lt;strong&gt;No-op&lt;&#x2F;strong&gt;) &lt;code&gt;SSTORE&lt;&#x2F;code&gt; on a particular storage slot starts
with &lt;strong&gt;Fresh&lt;&#x2F;strong&gt;. After that, it will become &lt;strong&gt;Dirty&lt;&#x2F;strong&gt; if the value has
been changed. When going from &lt;strong&gt;Fresh&lt;&#x2F;strong&gt; to &lt;strong&gt;Dirty&lt;&#x2F;strong&gt;, we charge the
gas cost the same as current scheme. A &lt;strong&gt;Dirty&lt;&#x2F;strong&gt; storage slot can be
reset back to &lt;strong&gt;Fresh&lt;&#x2F;strong&gt; via a &lt;code&gt;SSTORE&lt;&#x2F;code&gt; opcode. This will trigger a
refund.&lt;&#x2F;p&gt;
&lt;p&gt;When a storage slot remains at &lt;strong&gt;Dirty&lt;&#x2F;strong&gt;, we charge 200 gas. In this
case, we would also need to keep track of &lt;code&gt;R_SCLEAR&lt;&#x2F;code&gt; refunds -- if we
already issued the refund but it no longer applies (&lt;em&gt;current value&lt;&#x2F;em&gt; is
0), then removes this refund from the refund counter. If we didn&#x27;t
issue the refund but it applies now (&lt;em&gt;new value&lt;&#x2F;em&gt; is 0), then adds this
refund to the refund counter. It is not possible where a refund is not
issued but we remove the refund in the above case, because all storage
slot starts with &lt;strong&gt;Fresh&lt;&#x2F;strong&gt; state.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;state-transition&quot;&gt;State Transition&lt;&#x2F;h3&gt;
&lt;p&gt;Below is a graph (&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;pull&#x2F;1283#issuecomment-410229053&quot;&gt;by
@Arachnid&lt;&#x2F;a&gt;)
showing possible state transition of gas costs. We ignore &lt;strong&gt;No-op&lt;&#x2F;strong&gt;
state because that is trivial:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1283&#x2F;.&#x2F;assets&#x2F;state.png&quot; alt=&quot;State Transition&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Below is table version of the above diagram. Vertical shows the &lt;em&gt;new
value&lt;&#x2F;em&gt; being set, and horizontal shows the state of &lt;em&gt;original value&lt;&#x2F;em&gt;
and &lt;em&gt;current value&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;When &lt;em&gt;original value&lt;&#x2F;em&gt; is 0:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;&#x2F;th&gt;&lt;th&gt;A (&lt;code&gt;current=orig=0&lt;&#x2F;code&gt;)&lt;&#x2F;th&gt;&lt;th&gt;B (&lt;code&gt;current!=orig&lt;&#x2F;code&gt;)&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;~0&lt;&#x2F;td&gt;&lt;td&gt;B; 20k gas&lt;&#x2F;td&gt;&lt;td&gt;B; 200 gas&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;A; 200 gas&lt;&#x2F;td&gt;&lt;td&gt;A; 200 gas, 19.8k refund&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;When &lt;em&gt;original value&lt;&#x2F;em&gt; is not 0:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;&#x2F;th&gt;&lt;th&gt;X (&lt;code&gt;current=orig!=0&lt;&#x2F;code&gt;)&lt;&#x2F;th&gt;&lt;th&gt;Y (&lt;code&gt;current!=orig&lt;&#x2F;code&gt;)&lt;&#x2F;th&gt;&lt;th&gt;Z (&lt;code&gt;current=0&lt;&#x2F;code&gt;)&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;orig&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;X; 200 gas&lt;&#x2F;td&gt;&lt;td&gt;X; 200 gas, 4.8k refund&lt;&#x2F;td&gt;&lt;td&gt;X; 200 gas, -10.2k refund&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;~orig, ~0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Y; 5k gas&lt;&#x2F;td&gt;&lt;td&gt;Y; 200 gas&lt;&#x2F;td&gt;&lt;td&gt;Y; 200 gas, -15k refund&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;Z; 5k gas, 15k refund&lt;&#x2F;td&gt;&lt;td&gt;Z; 200 gas, 15k refund&lt;&#x2F;td&gt;&lt;td&gt;Z; 200 gas&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP mostly achieves what a transient storage tries to do
(EIP-1087 and EIP-1153), but without the complexity of introducing the
concept of &quot;dirty maps&quot;, or an extra storage struct.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;We don&#x27;t suffer from the optimization limitation of
EIP-1087. EIP-1087 requires keeping a dirty map for storage changes,
and implicitly makes the assumption that a transaction&#x27;s storage
changes are committed to the storage trie at the end of a
transaction. This works well for some implementations, but not for
others. After EIP-658, an efficient storage cache implementation
would probably use an in-memory trie (without RLP encoding&#x2F;decoding)
or other immutable data structures to keep track of storage changes,
and only commit changes at the end of a block. For them, it is
possible to know a storage&#x27;s original value and current value, but
it is not possible to iterate over all storage changes without
incurring additional memory or processing costs.&lt;&#x2F;li&gt;
&lt;li&gt;It never costs more gas compared with the current scheme.&lt;&#x2F;li&gt;
&lt;li&gt;It covers all usages for a transient storage. Clients that are easy
to implement EIP-1087 will also be easy to implement this
specification. Some other clients might require a little bit extra
refactoring on this. Nonetheless, no extra memory or processing cost
is needed on runtime.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Regarding &lt;code&gt;SSTORE&lt;&#x2F;code&gt; gas cost and refunds, see Appendix for proofs of
properties that this EIP satisfies.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;For &lt;em&gt;absolute gas used&lt;&#x2F;em&gt; (that is, actual &lt;em&gt;gas used&lt;&#x2F;em&gt; minus &lt;em&gt;refund&lt;&#x2F;em&gt;),
this EIP is equivalent to EIP-1087 for all cases.&lt;&#x2F;li&gt;
&lt;li&gt;For one particular case, where a storage slot is changed, reset to
its original value, and then changed again, EIP-1283 would move more
gases to refund counter compared with EIP-1087.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Examine examples provided in EIP-1087&#x27;s Motivation:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If a contract with empty storage sets slot 0 to 1, then back to 0,
it will be charged &lt;code&gt;20000 + 200 - 19800 = 400&lt;&#x2F;code&gt; gas.&lt;&#x2F;li&gt;
&lt;li&gt;A contract with empty storage that increments slot 0 5 times will be
charged &lt;code&gt;20000 + 5 * 200 = 21000&lt;&#x2F;code&gt; gas.&lt;&#x2F;li&gt;
&lt;li&gt;A balance transfer from account A to account B followed by a
transfer from B to C, with all accounts having nonzero starting and
ending balances, it will cost &lt;code&gt;5000 * 3 + 200 - 4800 = 10400&lt;&#x2F;code&gt; gas.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP requires a hard fork to implement. No gas cost increase is
anticipated, and many contracts will see gas reduction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Below we provide 17 test cases. 15 of them covering consecutive two
&lt;code&gt;SSTORE&lt;&#x2F;code&gt; operations are based on work &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;tests&#x2F;issues&#x2F;483&quot;&gt;by
@chfast&lt;&#x2F;a&gt;. Two additional
cases with three &lt;code&gt;SSTORE&lt;&#x2F;code&gt; operations is used to test the case when a
slot is reset and then set again.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Code&lt;&#x2F;th&gt;&lt;th&gt;Used Gas&lt;&#x2F;th&gt;&lt;th&gt;Refund&lt;&#x2F;th&gt;&lt;th&gt;Original&lt;&#x2F;th&gt;&lt;th&gt;1st&lt;&#x2F;th&gt;&lt;th&gt;2nd&lt;&#x2F;th&gt;&lt;th&gt;3rd&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;412&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;20212&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;20212&lt;&#x2F;td&gt;&lt;td&gt;19800&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556002600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;20212&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;20212&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;5212&lt;&#x2F;td&gt;&lt;td&gt;15000&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;5212&lt;&#x2F;td&gt;&lt;td&gt;4800&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556002600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;5212&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60026000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;5212&lt;&#x2F;td&gt;&lt;td&gt;15000&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60026000556003600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;5212&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60026000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;5212&lt;&#x2F;td&gt;&lt;td&gt;4800&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60026000556002600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;5212&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;5212&lt;&#x2F;td&gt;&lt;td&gt;15000&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556002600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;5212&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;412&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x600160005560006000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;40218&lt;&#x2F;td&gt;&lt;td&gt;19800&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x600060005560016000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;10218&lt;&#x2F;td&gt;&lt;td&gt;19800&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;appendix-proof&quot;&gt;Appendix: Proof&lt;&#x2F;h2&gt;
&lt;p&gt;Because the &lt;em&gt;storage slot&#x27;s original value&lt;&#x2F;em&gt; is defined as the value
when a reversion happens on the &lt;em&gt;current transaction&lt;&#x2F;em&gt;, it&#x27;s easy to
see that call frames won&#x27;t interfere SSTORE gas calculation. So
although the below proof is discussed without call frames, it applies
to all situations with call frames. We will discuss the case
separately for &lt;em&gt;original value&lt;&#x2F;em&gt; being zero and not zero, and use
&lt;em&gt;induction&lt;&#x2F;em&gt; to prove some properties of SSTORE gas cost.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Final value&lt;&#x2F;em&gt; is the value of a particular storage slot at the end of
a transaction. &lt;em&gt;Absolute gas used&lt;&#x2F;em&gt; is the absolute value of &lt;em&gt;gas used&lt;&#x2F;em&gt;
minus &lt;em&gt;refund&lt;&#x2F;em&gt;. We use &lt;code&gt;N&lt;&#x2F;code&gt; to represent the total number of SSTORE
operations on a storage slot. For states discussed below, refer to
&lt;em&gt;State Transition&lt;&#x2F;em&gt; in &lt;em&gt;Explanation&lt;&#x2F;em&gt; section.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;original-value-being-zero&quot;&gt;Original Value Being Zero&lt;&#x2F;h3&gt;
&lt;p&gt;When &lt;em&gt;original value&lt;&#x2F;em&gt; is 0, we want to prove that:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Case I&lt;&#x2F;strong&gt;: If the &lt;em&gt;final value&lt;&#x2F;em&gt; ends up still being 0, we want to charge &lt;code&gt;200 * N&lt;&#x2F;code&gt; gases, because no disk write is needed.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Case II&lt;&#x2F;strong&gt;: If the &lt;em&gt;final value&lt;&#x2F;em&gt; ends up being a non-zero value, we want to
charge &lt;code&gt;20000 + 200 * (N-1)&lt;&#x2F;code&gt; gas, because it requires writing this
slot to disk.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;base-case&quot;&gt;Base Case&lt;&#x2F;h4&gt;
&lt;p&gt;We always start at state A. The first SSTORE can:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Go to state A: 200 gas is deducted. We satisfy &lt;em&gt;Case I&lt;&#x2F;em&gt; because
&lt;code&gt;200 * N == 200 * 1&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Go to state B: 20000 gas is deducted. We satisfy &lt;em&gt;Case II&lt;&#x2F;em&gt; because
&lt;code&gt;20000 + 200 * (N-1) == 20000 + 200 * 0&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;inductive-step&quot;&gt;Inductive Step&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;From A to A. The previous gas cost is &lt;code&gt;200 * (N-1)&lt;&#x2F;code&gt;. The current
gas cost is &lt;code&gt;200 + 200 * (N-1)&lt;&#x2F;code&gt;. It satisfy &lt;em&gt;Case I&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;From A to B. The previous gas cost is &lt;code&gt;200 * (N-1)&lt;&#x2F;code&gt;. The current
gas cost is &lt;code&gt;20000 + 200 * (N-1)&lt;&#x2F;code&gt;. It satisfy &lt;em&gt;Case II&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;From B to B. The previous gas cost is &lt;code&gt;20000 + 200 * (N-2)&lt;&#x2F;code&gt;. The
current gas cost is &lt;code&gt;200 + 20000 + 200 * (N-2)&lt;&#x2F;code&gt;. It satisfy
&lt;em&gt;Case II&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;From B to A. The previous gas cost is &lt;code&gt;20000 + 200 * (N-2)&lt;&#x2F;code&gt;. The
current gas cost is &lt;code&gt;200 - 19800 + 20000 + 200 * (N-2)&lt;&#x2F;code&gt;. It satisfy
&lt;em&gt;Case I&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;original-value-not-being-zero&quot;&gt;Original Value Not Being Zero&lt;&#x2F;h3&gt;
&lt;p&gt;When &lt;em&gt;original value&lt;&#x2F;em&gt; is not 0, we want to prove that:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Case I&lt;&#x2F;strong&gt;: If the &lt;em&gt;final value&lt;&#x2F;em&gt; ends up unchanged, we want to
charge &lt;code&gt;200 * N&lt;&#x2F;code&gt; gases, because no disk write is needed.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Case II&lt;&#x2F;strong&gt;: If the &lt;em&gt;final value&lt;&#x2F;em&gt; ends up being zero, we want to
charge &lt;code&gt;5000 - 15000 + 200 * (N-1)&lt;&#x2F;code&gt; gas. Note that &lt;code&gt;15000&lt;&#x2F;code&gt; is the
refund in actual definition.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Case III&lt;&#x2F;strong&gt;: If the &lt;em&gt;final value&lt;&#x2F;em&gt; ends up being a changed non-zero
value, we want to charge &lt;code&gt;5000 + 200 * (N-1)&lt;&#x2F;code&gt; gas.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;base-case-1&quot;&gt;Base Case&lt;&#x2F;h4&gt;
&lt;p&gt;We always start at state X. The first SSTORE can:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Go to state X: 200 gas is deducted. We satisfy &lt;em&gt;Case I&lt;&#x2F;em&gt; because
&lt;code&gt;200 * N == 200 * 1&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Go to state Y: 5000 gas is deducted. We satisfy &lt;em&gt;Case III&lt;&#x2F;em&gt; because
&lt;code&gt;5000 + 200 * (N-1) == 5000 + 200 * 0&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Go to state Z: The absolute gas used is &lt;code&gt;5000 - 15000&lt;&#x2F;code&gt; where 15000
is the refund. We satisfy &lt;em&gt;Case II&lt;&#x2F;em&gt; because &lt;code&gt;5000 - 15000 + 200 * (N-1) == 5000 - 15000 + 200 * 0&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;inductive-step-1&quot;&gt;Inductive Step&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;From X to X. The previous gas cost is &lt;code&gt;200 * (N-1)&lt;&#x2F;code&gt;. The current gas
cost is &lt;code&gt;200 + 200 * (N-1)&lt;&#x2F;code&gt;. It satisfy &lt;em&gt;Case I&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;From X to Y. The previous gas cost is &lt;code&gt;200 * (N-1)&lt;&#x2F;code&gt;. The current gas
cost is &lt;code&gt;5000 + 200 * (N-1)&lt;&#x2F;code&gt;. It satisfy &lt;em&gt;Case III&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;From X to Z. The previous gas cost is &lt;code&gt;200 * (N-1)&lt;&#x2F;code&gt;. The current
absolute gas cost is &lt;code&gt;5000 - 15000 + 200 * (N-1)&lt;&#x2F;code&gt;. It satisfy &lt;em&gt;Case
II&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;From Y to X. The previous gas cost is &lt;code&gt;5000 + 200 * (N-2)&lt;&#x2F;code&gt;. The
absolute current gas cost is &lt;code&gt;200 - 4800 + 5000 + 200 * (N-2)&lt;&#x2F;code&gt;. It
satisfy &lt;em&gt;Case I&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;From Y to Y. The previous gas cost is &lt;code&gt;5000 + 200 * (N-2)&lt;&#x2F;code&gt;. The
current gas cost is &lt;code&gt;200 + 5000 + 200 * (N-2)&lt;&#x2F;code&gt;. It satisfy &lt;em&gt;Case
III&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;From Y to Z. The previous gas cost is &lt;code&gt;5000 + 200 * (N-2)&lt;&#x2F;code&gt;. The
current absolute gas cost is &lt;code&gt;200 - 15000 + 5000 + 200 * (N-2)&lt;&#x2F;code&gt;. It
satisfy &lt;em&gt;Case II&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;From Z to X. The previous gas cost is &lt;code&gt;5000 - 15000 + 200 * (N-2)&lt;&#x2F;code&gt;. The current absolute gas cost is &lt;code&gt;200 + 10200 + 5000 - 15000 + 200 * (N-2)&lt;&#x2F;code&gt;. It satisfy &lt;em&gt;Case I&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;From Z to Y. The previous gas cost is &lt;code&gt;5000 - 15000 + 200 * (N-2)&lt;&#x2F;code&gt;. The current absolute gas cost is &lt;code&gt;200 + 15000 + 5000 - 15000 + 200 * (N-2)&lt;&#x2F;code&gt;. It satisfy &lt;em&gt;Case III&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;From Z to Z. The previous gas cost is &lt;code&gt;5000 - 15000 + 200 * (N-2)&lt;&#x2F;code&gt;. The current absolute gas cost is &lt;code&gt;200 + 5000 - 15000 + 200 * (N-2)&lt;&#x2F;code&gt;. It satisfy &lt;em&gt;Case II&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Increase Gcallstipend gas in the CALL opcode</title>
        <published>2018-08-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Ben Kaufman</name><email>ben@daostack.io</email>
	</author>
	
	<author>
		<name>Adam Levi</name><email>adam@daostack.io</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1285/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-1285-increase-gcallstipend-gas-in-the-call-opcode/941" />
        

        <id>https://wg-eips.ritovision.com/1285/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1285"
            label="EIP-1285" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1285/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Increase the &lt;code&gt;Gcallstipend&lt;&#x2F;code&gt; fee parameter in the &lt;code&gt;CALL&lt;&#x2F;code&gt; opcode from &lt;code&gt;2,300&lt;&#x2F;code&gt; to &lt;code&gt;3,500&lt;&#x2F;code&gt; gas units.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, the &lt;code&gt;CALL&lt;&#x2F;code&gt; opcode forwards a stipend of &lt;code&gt;2,300&lt;&#x2F;code&gt; gas units for a non zero value &lt;code&gt;CALL&lt;&#x2F;code&gt; operations where a contract is called. This stipend is given to the contract to allow execution of its &lt;code&gt;fallback&lt;&#x2F;code&gt; function. The stipend given is intentionally small in order to prevent the called contract from spending the call gas or performing an attack (like re-entrancy).
While the stipend is small it should still give the sufficient gas required for some cheap opcodes like &lt;code&gt;LOG&lt;&#x2F;code&gt;, but it&#x27;s not enough for some more complex and modern logics to be implemented.
This EIP proposes to increase the given stipend from &lt;code&gt;2,300&lt;&#x2F;code&gt; to &lt;code&gt;3,500&lt;&#x2F;code&gt; to increase the usability of  the &lt;code&gt;fallback&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The main motivation behind this EIP is to allow simple fallback functions to be implemented for contracts following the &lt;code&gt;&quot;Proxy&quot;&lt;&#x2F;code&gt; pattern. Simply explained, a &lt;code&gt;&quot;Proxy Contract&quot;&lt;&#x2F;code&gt; is a contract which use &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; in its &lt;code&gt;fallback&lt;&#x2F;code&gt; function to behave according to the logic of another contract and serve as an independent instance for the logic of the contract it points to.
This pattern is very useful for saving gas per deployment (as Proxy contracts are very lean) and it opens the ability to experiment with upgradability of contracts.
On average, the &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; functionality of a proxy contract costs about &lt;code&gt;1,000&lt;&#x2F;code&gt; gas units.
When a contract transfers ETH to a proxy contract, the proxy logic will consume about &lt;code&gt;1,000&lt;&#x2F;code&gt; gas units before the &lt;code&gt;fallback&lt;&#x2F;code&gt; function of the logic contract will be executed. This leaves merely about 1,300 gas units for the execution of the logic. This is a severe limitation as it is not enough for an average &lt;code&gt;LOG&lt;&#x2F;code&gt; operation (it might be enough for a &lt;code&gt;LOG&lt;&#x2F;code&gt; with one parameter).
By slightly increasing the gas units given in the stipend we allow proxy contracts have proper &lt;code&gt;fallback&lt;&#x2F;code&gt; logic without increasing the attack surface of the calling contract.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Increase the &lt;code&gt;Gcallstipend&lt;&#x2F;code&gt; fee parameter in the &lt;code&gt;CALL&lt;&#x2F;code&gt; opcode from &lt;code&gt;2,300&lt;&#x2F;code&gt; to &lt;code&gt;3,500&lt;&#x2F;code&gt; gas unit.
The actual change to the Ethereum clients would be to change the &lt;code&gt;CallStipend&lt;&#x2F;code&gt; they store as a constant.
For an implementation example you can find a Geth client implementation linked &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ben-kaufman&#x2F;go-ethereum&#x2F;tree&#x2F;eip-1285&quot;&gt;here&lt;&#x2F;a&gt;. The actual change to the code can be found &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ben-kaufman&#x2F;go-ethereum&#x2F;blob&#x2F;eip-1285&#x2F;params&#x2F;protocol_params.go#L41&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The rational for increasing the &lt;code&gt;Gcallstipend&lt;&#x2F;code&gt; gas parameter by &lt;code&gt;1,200&lt;&#x2F;code&gt; gas units comes from the cost of performing &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; and &lt;code&gt;SLOAD&lt;&#x2F;code&gt; with a small margin for some small additional operations. All while still keeping the stipend relatively small and insufficient for accessing the storage or changing the state.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP requires a backwards incompatible change for the &lt;code&gt;Gcallstipend&lt;&#x2F;code&gt; gas parameter in the &lt;code&gt;CALL&lt;&#x2F;code&gt; opcode.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Subscriptions on the blockchain</title>
        <published>2018-08-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Kevin Owocki</name><email>kevin@gitcoin.co</email>
	</author>
	
	<author>
		<name>Andrew Redden</name><email>andrew@blockcrushr.com</email>
	</author>
	
	<author>
		<name>Scott Burke</name><email>scott@blockcrushr.com</email>
	</author>
	
	<author>
		<name>Kevin Seagraves</name><email>k.s.seagraves@gmail.com</email>
	</author>
	
	<author>
		<name>Luka Kacil</name><email>luka.kacil@gmail.com</email>
	</author>
	
	<author>
		<name>Štefan Šimec</name><email>stefan.simec@gmail.com</email>
	</author>
	
	<author>
		<name>Piotr Kosiński</name><uri>https://github.com/kosecki123</uri>
	</author>
	
	<author>
		<name>ankit raj</name><email>tradeninja7@gmail.com</email>
	</author>
	
	<author>
		<name>John Griffin</name><email>john@atchai.com</email>
	</author>
	
	<author>
		<name>Nathan Creswell</name><email>nathantr@gmail.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1337/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-1337-subscriptions-on-the-blockchain/4422" />
        

        <id>https://wg-eips.ritovision.com/1337/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:1337"
            label="ERC-1337" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1337/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Monthly subscriptions are a key monetization channel for legacy web, and arguably they are the most healthy monetization channel for businesses on the legacy web (especially when compared to ad&#x2F;surveillance) based models.  They are arguably more healthy than a token based economic system (depending upon the vesting model of the ICO) because&lt;&#x2F;p&gt;
&lt;h5 id=&quot;for-a-user&quot;&gt;For a user:&lt;&#x2F;h5&gt;
&lt;ul&gt;
&lt;li&gt;you don&#x27;t have to read a complex whitepaper to use a dapps utility (as opposed to utility tokens)&lt;&#x2F;li&gt;
&lt;li&gt;you don&#x27;t have to understand the founder&#x27;s vesting schedules&lt;&#x2F;li&gt;
&lt;li&gt;you can cancel anytime&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;for-a-service-provider&quot;&gt;For a Service Provider:&lt;&#x2F;h5&gt;
&lt;ul&gt;
&lt;li&gt;since you know your subscriber numbers, churn numbers, conversion rate, you get consistent cash flow, and accurate projections&lt;&#x2F;li&gt;
&lt;li&gt;you get to focus on making your customers happy&lt;&#x2F;li&gt;
&lt;li&gt;enables you to remove speculators from your ecosystem&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;For these reasons, we think it&#x27;s imperative to create a standard way to do &#x27;subscriptions&#x27; on Ethereum.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;To enable replay-able transactions users sign a concatenated bytes hash that is composed of the input data needed to execute the transaction. This data is stored off chain by the recipient of the payment and is transmitted to the customers smart contract for execution alongside a provided signature.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Recurring payments are the bedrock of SaSS and countless other businesses, a robust specification for defining this interaction will enable a broad spectrum of revenue generation and business models.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h4 id=&quot;enum-contract&quot;&gt;Enum Contract&lt;&#x2F;h4&gt;
&lt;p&gt;EIP-1337 Contracts should be compiled with a contract that references all the enumerations that are required for operation&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Enum - Collection of enums&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Original concept from Richard Meissner - &amp;lt;richard@gnosis.pm&amp;gt; Gnosis safe contracts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Enum&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Operation&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        Call&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        DelegateCall&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        Create&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        ERC20&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        ERC20Approve&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SubscriptionStatus&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        ACTIVE&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        PAUSED&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        CANCELLED&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        EXPIRED&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Period&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        INIT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        DAY&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        WEEK&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;        MONTH&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;eip-165&quot;&gt;EIP-165&lt;&#x2F;h4&gt;
&lt;p&gt;EIP-1337 compliant contracts support EIP-165 announcing what interfaces they support&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC165&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Query if a contract implements an interface&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; interfaceID&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The interface identifier, as specified in ERC-165&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Interface identification is specified in ERC-165. This function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * uses less than 30,000 gas.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `true` if the contract implements `interfaceID` and&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * `interfaceID` is not 0xffffffff, `false` otherwise&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;public-view-functions&quot;&gt;Public View Functions&lt;&#x2F;h4&gt;
&lt;h6 id=&quot;isvalidsubscription&quot;&gt;isValidSubscription&lt;&#x2F;h6&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Checks if the subscription is valid.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; subscriptionHash is the identifier of the customer&amp;#39;s subscription with its relevant details.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; success&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the result of whether the subscription is valid or not.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  *&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isValidSubscription&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; subscriptionHash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        public&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        view&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h6 id=&quot;getsubscriptionstatus&quot;&gt;getSubscriptionStatus&lt;&#x2F;h6&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; returns the value of the subscription&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; subscriptionHash is the identifier of the customer&amp;#39;s subscription with its relevant details.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; status&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the enumerated status of the current subscription, 0 expired, 1 active, 2 paused, 3 cancelled&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  *&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getSubscriptionStatus&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; subscriptionHash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    public&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    view&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; status&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nextWithdraw&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h6 id=&quot;getsubscriptionhash&quot;&gt;getSubscriptionHash&lt;&#x2F;h6&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; returns the hash of cocatenated inputs to the address of the contract holding the logic.,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * the owner would sign this hash and then provide it to the party for execution at a later date,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * this could be viewed like a cheque, with the exception that unless you specifically&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * capture the hash on chain a valid signature will be executable at a later date, capturing the hash lets you modify the status to cancel or expire it.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; recipient the address of the person who is getting the funds.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; value the value of the transaction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; data the data the user is agreeing to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; txGas the cost of executing one of these transactions in gas(probably safe to pad this)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; dataGas the cost of executing the data portion of the transaction(delegate calls etc)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 256 gasPrice the agreed upon gas cost of Execution of this subscription(cost incurment is up to implementation, ie, sender or receiver)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; gasToken address of the token in which gas will be compensated by, address(0) is ETH, only works in the case of an enscrow implementation)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; meta dynamic bytes array with 4 slots, 2 required, 2 optional &#x2F;&#x2F; address refundAddress &#x2F; uint256 period &#x2F; uint256 offChainID &#x2F; uint256 expiration (uinx timestamp)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;, return the hash input arguments concatenated to the address of the contract that holds the logic.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  *&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getSubscriptionHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; recipient&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        Enum&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;Operation&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; txGas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; dataGas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; gasPrice&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; gasToken&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; meta&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    public&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; subscriptionHash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h6 id=&quot;getmodifystatushash&quot;&gt;getModifyStatusHash&lt;&#x2F;h6&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; returns the hash of concatenated inputs that the owners user would sign with their public keys&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; recipient the address of the person who is getting the funds.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; value the value of the transaction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; returns the hash of concatenated inputs with the address of the contract holding the subscription hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  *&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getModifyStatusHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; subscriptionHash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        Enum&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;SubscriptionStatus&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; status&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    public&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; modifyStatusHash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;public-functions&quot;&gt;Public Functions&lt;&#x2F;h4&gt;
&lt;h6 id=&quot;modifystatus&quot;&gt;modifyStatus&lt;&#x2F;h6&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; modifys the current subscription status&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; subscriptionHash is the identifier of the customer&amp;#39;s subscription with its relevant details.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;.SubscriptionStatus status the new status of the subscription&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; signatures of the requested method being called&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; success&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is the result of the subscription being paused&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  *&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; modifyStatus&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; subscriptionHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        Enum&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;SubscriptionStatus&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; status&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signatures&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    public&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h6 id=&quot;executesubscription&quot;&gt;executeSubscription&lt;&#x2F;h6&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; returns the hash of cocatenated inputs to the address of the contract holding the logic.,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * the owner would sign this hash and then provide it to the party for execution at a later date,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * this could be viewed like a cheque, with the exception that unless you specifically&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * capture the hash on chain a valid signature will be executable at a later date, capturing the hash lets you modify the status to cancel or expire it.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; recipient the address of the person who is getting the funds.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; value the value of the transaction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; data the data the user is agreeing to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; txGas the cost of executing one of these transactions in gas(probably safe to pad this)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; dataGas the cost of executing the data portion of the transaction(delegate calls etc)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 256 gasPrice the agreed upon gas cost of Execution of this subscription(cost incurment is up to implementation, ie, sender or receiver)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; gasToken address of the token in which gas will be compensated by, address(0) is ETH, only works in the case of an enscrow implementation)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; meta dynamic bytes array with 4 slots, 2 required, 2 optional &#x2F;&#x2F; address refundAddress &#x2F; uint256 period &#x2F; uint256 offChainID &#x2F; uint256 expiration (uinx timestamp)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; signatures signatures concatenated that have signed the inputs as proof of valid execution&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; success something to &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; that a failed execution will still pay the issuer of the transaction for their gas costs.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  *&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; executeSubscription&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        Enum&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;Operation&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; txGas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; dataGas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; gasPrice&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; gasToken&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; meta&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signatures&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    public&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Merchants who accept credit-cards do so by storing a token that is retrieved from a third party processor(stripe, paypal, etc), this token is used to grant access to pull payment from the cx&#x27;s credit card provider and move funds to the merchant account.
Having users sign input data acts in a similliar fashion and enables that merchant to store the signature of the concatenated bytes hash and input data used to generate the hash and pass them off to the contract holding the subscription logic, thus enabling a workflow that is similliar to what exists in the present day legacy web.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;N&#x2F;A&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Sane limits for certain EVM parameters</title>
        <published>2018-08-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	<author>
		<name>Paweł Bylica</name><uri>https://github.com/chfast</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1985/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-1985-sane-limits-for-certain-evm-parameters/3224" />
        

        <id>https://wg-eips.ritovision.com/1985/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:1985"
            label="EIP-1985" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1985/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce an explicit value range for certain EVM parameters
(such as gas limit, block number, block timestamp, size field when returning&#x2F;copying data within EVM).
Some of these already have an implicit value range due to various (practical) reasons.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Having such an explicit value range can help in creating compatible client implementations,
in certain cases it can also offer minor speed improvements,
and can reduce the effort needed to create consensus critical test cases
by eliminating unrealistic edge cases.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= {FORK_BLOCK}&lt;&#x2F;code&gt;, the following value ranges are introduced.
They restrict the results (i.e. values pushed to the stack) of the instructions listed below.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;gas&lt;&#x2F;em&gt;, &lt;em&gt;gas limit&lt;&#x2F;em&gt;, &lt;em&gt;block gas limit&lt;&#x2F;em&gt;
is a range between &lt;code&gt;0&lt;&#x2F;code&gt; and &lt;code&gt;0x7fffffffffffffff&lt;&#x2F;code&gt; (&lt;code&gt;2**63 - 1&lt;&#x2F;code&gt;, &lt;code&gt;9223372036854775807&lt;&#x2F;code&gt;).
It affects the following instructions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;GASLIMIT&lt;&#x2F;code&gt; (&lt;code&gt;0x45&lt;&#x2F;code&gt;),&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;GAS&lt;&#x2F;code&gt; (&lt;code&gt;0x5a&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;block number&lt;&#x2F;em&gt;, &lt;em&gt;timestamp&lt;&#x2F;em&gt;
is a range between &lt;code&gt;0&lt;&#x2F;code&gt; and &lt;code&gt;0x7fffffffffffffff&lt;&#x2F;code&gt; (&lt;code&gt;2**63 - 1&lt;&#x2F;code&gt;, &lt;code&gt;9223372036854775807&lt;&#x2F;code&gt;).
It affects the following instructions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;TIMESTAMP&lt;&#x2F;code&gt; (&lt;code&gt;0x42&lt;&#x2F;code&gt;),&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;NUMBER&lt;&#x2F;code&gt; (&lt;code&gt;0x43&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;account address&lt;&#x2F;em&gt;
is a range between &lt;code&gt;0&lt;&#x2F;code&gt; and &lt;code&gt;0xffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;code&gt; (&lt;code&gt;2**160 - 1&lt;&#x2F;code&gt;, &lt;code&gt;1461501637330902918203684832716283019655932542975&lt;&#x2F;code&gt;)
i.e. the address occupies the 160 low bits of the 256-bit value and the remaining top 96 bits must be zeros.
It affects the following instructions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ADDRESS&lt;&#x2F;code&gt; (&lt;code&gt;0x30&lt;&#x2F;code&gt;),&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ORIGIN&lt;&#x2F;code&gt; (&lt;code&gt;0x32&lt;&#x2F;code&gt;),&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CALLER&lt;&#x2F;code&gt; (&lt;code&gt;0x33&lt;&#x2F;code&gt;),&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;COINBASE&lt;&#x2F;code&gt; (&lt;code&gt;0x41&lt;&#x2F;code&gt;),&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CREATE&lt;&#x2F;code&gt; (&lt;code&gt;0xf0&lt;&#x2F;code&gt;),&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CREATE2&lt;&#x2F;code&gt; (&lt;code&gt;0xf5&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;buffer size&lt;&#x2F;em&gt;, &lt;em&gt;code size&lt;&#x2F;em&gt;, &lt;em&gt;memory size&lt;&#x2F;em&gt;
is a range between &lt;code&gt;0&lt;&#x2F;code&gt; and &lt;code&gt;0xffffffff&lt;&#x2F;code&gt; (&lt;code&gt;2**32 - 1&lt;&#x2F;code&gt;, &lt;code&gt;4294967295&lt;&#x2F;code&gt;).
It affects the following instructions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;CALLDATASIZE&lt;&#x2F;code&gt; (&lt;code&gt;0x36&lt;&#x2F;code&gt;),&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CODESIZE&lt;&#x2F;code&gt; (&lt;code&gt;0x38&lt;&#x2F;code&gt;),&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; (&lt;code&gt;0x3b&lt;&#x2F;code&gt;),&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RETURNDATASIZE&lt;&#x2F;code&gt; (&lt;code&gt;0x3d&lt;&#x2F;code&gt;),&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;MSIZE&lt;&#x2F;code&gt; (&lt;code&gt;0x59&lt;&#x2F;code&gt;),&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;PC&lt;&#x2F;code&gt; (&lt;code&gt;0x58&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;These limits have been:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;proposed by &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;evmc&quot;&gt;EVMC&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;implemented partially by certain clients, such as &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;aleth&quot;&gt;Aleth&lt;&#x2F;a&gt;, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;go-ethereum&quot;&gt;geth&lt;&#x2F;a&gt;, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;paritytech&#x2F;parity-ethereum&quot;&gt;Parity&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereumjs&quot;&gt;ethereumjs&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;allowed by certain test cases in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;tests&quot;&gt;Ethereum testing suite&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;and implicitly also allowed by certain assumptions, such as due to gas limits some of these values cannot grow past a certain limit&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Most of the limits proposed in this document have been previously explored and tested in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;evmc&quot;&gt;EVMC&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Using the &lt;code&gt;2**63 - 1&lt;&#x2F;code&gt; constant to limit some of the ranges:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;allows using signed 64-bit integer type to represent it,
what helps programming languages not having unsigned types,&lt;&#x2F;li&gt;
&lt;li&gt;makes arithmetic simpler (e.g. checking out-of-gas conditions is simple as &lt;code&gt;gas_counter &amp;lt; 0&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;timestamp&quot;&gt;Timestamp&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;yellowpaper&quot;&gt;Yellow Paper&lt;&#x2F;a&gt; defines the timestamp in block as &quot;A scalar value equal to the reasonable output of Unix’s time() at this block’s inception&quot;.
IEEE Std 1003.1-2001 (POSIX.1) leaves that definition implementation defined.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;addresses&quot;&gt;Addresses&lt;&#x2F;h3&gt;
&lt;p&gt;The size of addresses is specified in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;yellowpaper&quot;&gt;Yellow Paper&lt;&#x2F;a&gt; as 20 bytes.
E.g. the &lt;code&gt;COINBASE&lt;&#x2F;code&gt; instruction is specified to return &lt;em&gt;H&lt;&#x2F;em&gt;&lt;sub&gt;c&lt;&#x2F;sub&gt; ∈ 𝔹&lt;sub&gt;20&lt;&#x2F;sub&gt; which has 20 bytes.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;memory-size&quot;&gt;Memory size&lt;&#x2F;h3&gt;
&lt;p&gt;Memory expansion cost is not linear and is determined by the following formula:
cost = cost_per_word * number_of_words + (number_of_words ^ 2 &#x2F; 512)&lt;&#x2F;p&gt;
&lt;p&gt;Expanding to over &lt;code&gt;2^32 - 1&lt;&#x2F;code&gt; bytes would cost &lt;code&gt;35184774742016&lt;&#x2F;code&gt; gas. This number fits into the gas limit imposed above (&lt;code&gt;2 ^ 63 - 1&lt;&#x2F;code&gt;) and would cost around 35184 Ether in a transaction to exhaust, with a 1 GWei gas cost, which can be attained on mainnet.&lt;&#x2F;p&gt;
&lt;p&gt;However, setting the limit &lt;code&gt;2^32 - 1&lt;&#x2F;code&gt; is beneficial from a VM design perspective and we believe limiting memory should be done via carefully selecting the block gas limit.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;code-size&quot;&gt;Code size&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;170&#x2F;&quot;&gt;EIP-170&lt;&#x2F;a&gt; has implemented a code size limit of 0x6000, however even before that, it was practically impossible to deploy a code blob exceeding &lt;code&gt;2**32 - 1&lt;&#x2F;code&gt; bytes in size.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;comparing-current-implementations&quot;&gt;Comparing current implementations&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Timestamp is implemented as a 64-bit value in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;aleth&quot;&gt;Aleth&lt;&#x2F;a&gt;, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;go-ethereum&quot;&gt;geth&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;paritytech&#x2F;parity-ethereum&quot;&gt;Parity&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Block gas limit is implemented as a 64-bit in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;aleth&quot;&gt;Aleth&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;go-ethereum&quot;&gt;geth&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Memory, buffer and code sizes are implemented as 64-bit values in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;go-ethereum&quot;&gt;geth&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;All of these limits are already enforced mostly through the block gas limit. Since the out of range case results in a transaction failure, there should not be a change in behaviour.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBA&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TBA&lt;&#x2F;p&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;92&quot;&gt;EIP-92&lt;&#x2F;a&gt; proposed the transaction gas limit to be limited at &lt;code&gt;2**63 - 1&lt;&#x2F;code&gt; and had a lengthy discussion about other limits.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;106&quot;&gt;EIP-106&lt;&#x2F;a&gt; proposed the block gas limit to be limited at &lt;code&gt;2**63 - 1&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;todo&quot;&gt;TODO&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;Does the gas limit apply to the gas argument for call instructions?&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Eliminate Difficulty Bomb and Adjust Block Reward on Constantinople Shift</title>
        <published>2018-07-31T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>EOS Classic</name><uri>https://github.com/eosclassicteam</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1276/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-1276-eliminate-difficulty-bomb-and-adjust-block-reward-on-constantinople-shift/908" />
        

        <id>https://wg-eips.ritovision.com/1276/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1276"
            label="EIP-1276" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1276/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;The average block times are increasing due to the factor of difficulty logic well known as difficulty bomb. This EIP proposes to eliminate the difficulty bomb forever and to reduce the block rewards with the Constantinople fork, the second part of the Metropolis fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Starting with &lt;code&gt;CNSTNTNPL_FORK_BLKNUM&lt;&#x2F;code&gt; the client will calculate the difficulty without considering the current block number. Furthermore, block rewards will be adjusted to a base of 2 ETH, uncle and nephew rewards will be adjusted accordingly.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Block time has been played a most important role on blockchain ecosystem, and it is being adjusted by the logic of mining difficulty calculation that is already implemented on the node client as a part of proof-of-work consensus. Last year, average block time rapidly increased due to the wrong design of difficulty logic that is meant to be changed on the part of Casper upgrade, however, implementation of casper has been delayed therefore it was inevitable to delay the difficulty bomb in order to prevent the significant delay of processing transactions on ethereum network.&lt;&#x2F;p&gt;
&lt;p&gt;Despite of the successful hardfork to delay the activation of difficulty bomb, activation of the difficulty bomb is expected to happen again on the upcoming period before implementing casper protocol on ethereum network. Therefore, completely removing the difficulty bomb is the most proper way to response the block time increase instead of delaying it again.&lt;&#x2F;p&gt;
&lt;p&gt;Also decreasing the block mining reward along with difficulty bomb removal is expected to help the growth of the stable ethereum ecosystem, right now ethereum dominates 92% of the total hashrate share of ethash based chains, and this corresponds to a tremendous level of energy consumption. As this energy consumption has a correlated environmental cost the network participants have an ethical obligation to ensure this cost is not higher than necessary. At this time, the most direct way to reduce this cost is to lower the block reward in order to limit the appeal of ETH mining. Unchecked growth in hashrate is also counterproductive from a security standpoint. Reducing the reward also decreases the likelihood of a miner driven chain split as Ethereum approaches proof-of-stake.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h4 id=&quot;remove-exponential-component-of-difficulty-adjustment&quot;&gt;Remove Exponential Component of Difficulty Adjustment&lt;&#x2F;h4&gt;
&lt;p&gt;For the purposes of &lt;code&gt;calc_difficulty&lt;&#x2F;code&gt;, simply remove the exponential difficulty adjustment component, &lt;code&gt;epsilon&lt;&#x2F;code&gt;, i.e. the &lt;code&gt;int(2**((block.number &#x2F;&#x2F; 100000) - 2))&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;adjust-block-uncle-and-nephew-rewards&quot;&gt;Adjust Block, Uncle, and Nephew rewards&lt;&#x2F;h4&gt;
&lt;p&gt;To ensure a constant Ether issuance, adjust the block reward to &lt;code&gt;new_block_reward&lt;&#x2F;code&gt;, where&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;new_block_reward = 2_000_000_000_000_000_000 if block.number &amp;gt;= CNSTNTNPL_FORK_BLKNUM else block.reward&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;(2E18 wei, or 2,000,000,000,000,000,000 wei, or 2 ETH).&lt;&#x2F;p&gt;
&lt;p&gt;Analogue, if an uncle is included in a block for &lt;code&gt;block.number &amp;gt;= CNSTNTNPL_FORK_BLKNUM&lt;&#x2F;code&gt; such that &lt;code&gt;block.number - uncle.number = k&lt;&#x2F;code&gt;, the uncle reward is&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;new_uncle_reward = (8 - k) * new_block_reward &#x2F; 8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This is the existing pre-Constantinople formula for uncle rewards, simply adjusted with &lt;code&gt;new_block_reward&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The nephew reward for &lt;code&gt;block.number &amp;gt;= CNSTNTNPL_FORK_BLKNUM&lt;&#x2F;code&gt; is&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;new_nephew_reward = new_block_reward &#x2F; 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This is the existing pre-Constantinople formula for nephew rewards, simply adjusted with &lt;code&gt;new_block_reward&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This will completely remove the difficulty bomb on difficulty adjustment algorithm without delaying the difficulty bomb again, therefore it is possible to prevent network delay on the beginning of 2019.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP-1276 opposes directly the intent of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1234&#x2F;&quot;&gt;EIP-1234&lt;&#x2F;a&gt; which should be also considered in discussions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is not forward compatible and introduces backwards incompatibilities in the difficulty calculation, as well as the block, uncle and nephew reward structure. Therefore, it should be included in a scheduled hardfork at a certain block number. It&#x27;s suggested to include this EIP in the second Metropolis hard-fork, &lt;em&gt;Constantinople&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases shall be created once the specification is to be accepted by the developers or implemented by the clients.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The implementation shall be created once the specification is to be accepted by the developers or implemented by the clients.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Specify restricted address range for precompiles&#x2F;system contracts</title>
        <published>2018-07-27T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1352/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-1352-specify-restricted-address-range-for-precompiles-system-contracts/1151" />
        

        <id>https://wg-eips.ritovision.com/1352/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:1352"
            label="EIP-1352" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1352/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Specify an Ethereum address range occupied by precompiles and future system contracts. Regular accounts and contracts cannot obtain such an address.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The address range between 0x0000000000000000000000000000000000000000 and 0x000000000000000000000000000000000000ffff is reserved for precompiles and system contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This will simplify certain future features where unless this is implemented, several exceptions must be specified.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The address range between 0x0000000000000000000000000000000000000000 and 0x000000000000000000000000000000000000ffff is reserved for precompiles and system contracts.&lt;&#x2F;p&gt;
&lt;p&gt;Due to the extremely low probability (and lack of adequate testing possibilities) no explicit checks should be added to ensure that external transaction signing or
the invoking of the &lt;code&gt;CREATE&lt;&#x2F;code&gt; instruction can result in a precompile address.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;N&#x2F;A&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No contracts on the main network have been created at the specified addresses. As a result it should pose no backwards compatibility problems.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;N&#x2F;A&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;N&#x2F;A&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Standard Signature Validation Method for Contracts</title>
        <published>2018-07-25T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Francisco Giordano</name><uri>https://github.com/frangio</uri>
	</author>
	
	<author>
		<name>Matt Condon</name><uri>https://github.com/shrugs</uri>
	</author>
	
	<author>
		<name>Philippe Castonguay</name><uri>https://github.com/PhABC</uri>
	</author>
	
	<author>
		<name>Amir Bandeali</name><uri>https://github.com/abandeali1</uri>
	</author>
	
	<author>
		<name>Jorge Izquierdo</name><uri>https://github.com/izqui</uri>
	</author>
	
	<author>
		<name>Bertrand Masius</name><uri>https://github.com/catageek</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1271/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/1271" />
        

        <id>https://wg-eips.ritovision.com/1271/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:1271"
            label="ERC-1271" />
        

        
        

        
        <summary type="html">Standard way to verify a signature when the account is a smart contract</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1271/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Externally Owned Accounts (EOA) can sign messages with their associated private keys, but currently contracts cannot. We propose a standard way for any contracts to verify whether a signature on a behalf of a given contract is valid. This is possible via the implementation of a &lt;code&gt;isValidSignature(hash, signature)&lt;&#x2F;code&gt; function on the signing contract, which can be called to validate a signature.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;There are and will be many contracts that want to utilize signed messages for validation of rights-to-move assets or other purposes. In order for these contracts to be able to support non Externally Owned Accounts (i.e., contract owners), we need a standard mechanism by which a contract can indicate whether a given signature is valid or not on its behalf.&lt;&#x2F;p&gt;
&lt;p&gt;One example of an application that requires signatures to be provided would be decentralized exchanges with off-chain orderbook, where buy&#x2F;sell orders are signed messages. In these applications, EOAs sign orders, signaling their desire to buy&#x2F;sell a given asset and giving explicit permissions to the exchange smart contracts to conclude a trade via a signature. When it comes to contracts however, regular signatures are not possible since contracts do not possess a private key, hence this proposal.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.ietf.org&#x2F;rfc&#x2F;rfc2119.txt&quot;&gt;RFC 2119&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ^&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;5&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; ERC1271&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; bytes4(keccak256(&amp;quot;isValidSignature(bytes32,bytes)&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; MAGICVALUE&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x1626ba7e&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Should return whether the signature provided is valid for the provided hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      Hash of the data to be signed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Signature byte array associated with _hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * MUST return the bytes4 magic value 0x1626ba7e when function passes.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * MUST NOT modify state (using STATICCALL for solc &amp;lt; 0.5, view modifier for solc &amp;gt; 0.5)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * MUST allow external calls&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isValidSignature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    public&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    view&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; magicValue&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;isValidSignature&lt;&#x2F;code&gt; can call arbitrary methods to validate a given signature, which could be context dependent (e.g. time based or state based), EOA dependent (e.g. signers authorization level within smart wallet), signature scheme Dependent (e.g. ECDSA, multisig, BLS), etc.&lt;&#x2F;p&gt;
&lt;p&gt;This function should be implemented by contracts which desire to sign messages (e.g. smart contract wallets, DAOs, multisignature wallets, etc.) Applications wanting to support contract signatures should call this method if the signer is a contract.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;We believe the name of the proposed function to be appropriate considering that an &lt;em&gt;authorized&lt;&#x2F;em&gt; signers providing proper signatures for a given data would see their signature as &quot;valid&quot; by the signing contract. Hence, a signed action message is only valid when the signer is authorized to perform a given action on the behalf of a smart wallet.&lt;&#x2F;p&gt;
&lt;p&gt;Two arguments are provided for simplicity of separating the hash signed from the signature. A bytes32 hash is used instead of the unhashed message for simplicity, since contracts could expect a certain hashing function that is not standard, such as with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;isValidSignature()&lt;&#x2F;code&gt; should not be able to modify states in order to prevent &lt;code&gt;GasToken&lt;&#x2F;code&gt; minting or similar attack vectors. Again, this is to simplify the implementation surface of the function for better standardization and to allow off-chain contract queries.&lt;&#x2F;p&gt;
&lt;p&gt;The specific return value is expected to be returned instead of a boolean in order to have stricter and simpler verification of a signature.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is backward compatible with previous work on signature validation since this method is specific to contract based signatures and not EOA signatures.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Example implementation of a signing contract:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verifies that the signer is the owner of the signing contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isValidSignature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Validate signatures&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;recoverSigner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x1626ba7e&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xffffffff&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Recover the signer of hash, assuming it&amp;#39;s an EOA account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Only for EthSign signatures&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;       Hash of message that was signed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  Signature encoded as (bytes32 r, bytes32 s, uint8 v)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;   *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; recoverSigner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_signature&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 65&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;SignatureValidator#recoverSigner: invalid signature length&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Variables are not scoped in Solidity.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint8&lt;&#x2F;span&gt;&lt;span&gt; v &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint8&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;64&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; r &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _signature&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;readBytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; s &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _signature&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;readBytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; unique. Appendix F in the Ethereum Yellow paper (https:&#x2F;&#x2F;ethereum.github.io&#x2F;yellowpaper&#x2F;paper.pdf), defines&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the valid range for s in (281): 0 &amp;lt; s &amp;lt; secp256k1n ÷ 2 + 1, and for v in (282): v ∈ {27, 28}. Most&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; signatures from current libraries generate a unique signature with an s-value in the lower half order.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; vice versa. If your library also generates signatures with 0&#x2F;1 for v instead 27&#x2F;28, add 27 to v to accept&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; these malleable signatures as well.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Source OpenZeppelin&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; https:&#x2F;&#x2F;github.com&#x2F;OpenZeppelin&#x2F;openzeppelin-contracts&#x2F;blob&#x2F;master&#x2F;contracts&#x2F;cryptography&#x2F;ECDSA.sol&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;s&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      revert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;SignatureValidator#recoverSigner: invalid signature &amp;#39;s&amp;#39; value&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;v &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 27&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; v &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 28&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      revert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;SignatureValidator#recoverSigner: invalid signature &amp;#39;v&amp;#39; value&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Recover ECDSA signer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signer &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; ecrecover&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; s&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Prevent signer from being 0x0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      signer &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;      &amp;quot;SignatureValidator#recoverSigner: INVALID_SIGNER&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; signer&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Example implementation of a contract calling the isValidSignature() function on an external signing contract ;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; callERC1271isValidSignature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _addr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes4&lt;&#x2F;span&gt;&lt;span&gt; result &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC1271Wallet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isValidSignature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;result &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x1626ba7e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;INVALID_SIGNATURE&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Since there are no gas-limit expected for calling the isValidSignature() function, it is possible that some implementation will consume a large amount of gas. It is therefore important to not hardcode an amount of gas sent when calling this method on an external contract as it could prevent the validation of certain signatures.&lt;&#x2F;p&gt;
&lt;p&gt;Note also that each contract implementing this method is responsible to ensure that the signature passed is indeed valid, otherwise catastrophic outcomes are to be expected.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Remove Difficulty Bomb</title>
        <published>2018-07-21T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Micah Zoltu</name><uri>https://github.com/MicahZoltu</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1240/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/difficulty-bomb-removal/832" />
        

        <id>https://wg-eips.ritovision.com/1240/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1240"
            label="EIP-1240" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1240/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;The average block times are increasing due to the difficulty bomb (also known as the &quot;&lt;em&gt;ice age&lt;&#x2F;em&gt;&quot;) slowly accelerating. This EIP proposes to remove the difficulty increase over time and replace it with a fixed difficulty targeting 15 second blocks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Starting with &lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt; the client will calculate the difficulty without considering the current block number.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The difficulty bomb operates under the assumption that miners decide what code economic participants are running, rather than economic participants deciding for themselves.  In reality, miners will mine whatever chain is most profitable and the most profitable chain is the one that economic participants use.  If 99% of miners mine a chain that no economic participants use then that chain will have no value and the miners will cease mining of it in favor of some other chain that does have economic participants.  Another way to put this is that miners will follow economic participants, not the other way around.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h4 id=&quot;remove-difficulty&quot;&gt;Remove Difficulty&lt;&#x2F;h4&gt;
&lt;p&gt;For the purposes of &lt;code&gt;calc_difficulty&lt;&#x2F;code&gt;, if &lt;code&gt;block.number &amp;gt;= FORK_BLOCK_NUMBER&lt;&#x2F;code&gt; then change the epsilon component to &lt;code&gt;0&lt;&#x2F;code&gt; rather than having it be a function of block number.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;With the difficulty bomb removed, when Casper is released it will be up to economic participants to decide whether they want the features that Casper enables or not.  If they do not want Casper, they are free to continue running unpatched clients and participating in the Ethereum network as it exists today.  This freedom of choice is the cornerstone of DLTs and making it hard for people to make that choice (by creating an artificial pressure) does not work towards that goal of freedom of choice.  If the development team is not confident that economic participants will want Casper, then they should re-evaluate their priorities rather than trying to force Casper onto users.&lt;&#x2F;p&gt;
&lt;p&gt;Author Personal Note: I think we will see almost all economic participants in Ethereum switch to PoS&#x2F;Sharding without any extra pressure beyond client defaults.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is not forward compatible and introduces backwards incompatibilities in the difficulty calculation. Therefore, it should be included in a scheduled hardfork at a certain block number.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases shall be created once the specification is to be accepted by the developers or implemented by the clients.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementations&quot;&gt;Implementations&lt;&#x2F;h2&gt;
&lt;p&gt;The yellow paper implements this change in https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;yellowpaper&#x2F;pull&#x2F;710&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Constantinople Difficulty Bomb Delay and Block Reward Adjustment</title>
        <published>2018-07-19T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Afri Schoedon</name><uri>https://github.com/5chdn</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1234/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-1234-constantinople-difficulty-bomb-delay-and-block-reward-adjustment/833" />
        

        <id>https://wg-eips.ritovision.com/1234/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1234"
            label="EIP-1234" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1234/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;The average block times are increasing due to the difficulty bomb (also known as the &quot;&lt;em&gt;ice age&lt;&#x2F;em&gt;&quot;) slowly accelerating. This EIP proposes to delay the difficulty bomb for approximately 12 months and to reduce the block rewards with the Constantinople fork, the second part of the Metropolis fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Starting with &lt;code&gt;CNSTNTNPL_FORK_BLKNUM&lt;&#x2F;code&gt; the client will calculate the difficulty based on a fake block number suggesting the client that the difficulty bomb is adjusting around 5 million blocks later than previously specified with the Homestead fork. Furthermore, block rewards will be adjusted to a base of 2 ETH, uncle and nephew rewards will be adjusted accordingly.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The Casper development and switch to proof-of-stake is delayed, the Ethash proof-of-work should be feasible for miners and allow sealing new blocks every 15 seconds on average for another 12 months. With the delay of the ice age, there is a desire to not suddenly also increase miner rewards. The difficulty bomb has been known about for a long time and now it&#x27;s going to stop from happening. In order to maintain stability of the system, a block reward reduction that offsets the ice age delay would leave the system in the same general state as before. Reducing the reward also decreases the likelihood of a miner driven chain split as Ethereum approaches proof-of-stake.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h4 id=&quot;relax-difficulty-with-fake-block-number&quot;&gt;Relax Difficulty with Fake Block Number&lt;&#x2F;h4&gt;
&lt;p&gt;For the purposes of &lt;code&gt;calc_difficulty&lt;&#x2F;code&gt;, simply replace the use of &lt;code&gt;block.number&lt;&#x2F;code&gt;, as used in the exponential ice age component, with the formula:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;fake_block_number = max(0, block.number - 5_000_000) if block.number &amp;gt;= CNSTNTNPL_FORK_BLKNUM else block.number&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;adjust-block-uncle-and-nephew-rewards&quot;&gt;Adjust Block, Uncle, and Nephew rewards&lt;&#x2F;h4&gt;
&lt;p&gt;To ensure a constant Ether issuance, adjust the block reward to &lt;code&gt;new_block_reward&lt;&#x2F;code&gt;, where&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;new_block_reward = 2_000_000_000_000_000_000 if block.number &amp;gt;= CNSTNTNPL_FORK_BLKNUM else block.reward&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;(2E18 wei, or 2,000,000,000,000,000,000 wei, or 2 ETH).&lt;&#x2F;p&gt;
&lt;p&gt;Analogue, if an uncle is included in a block for &lt;code&gt;block.number &amp;gt;= CNSTNTNPL_FORK_BLKNUM&lt;&#x2F;code&gt; such that &lt;code&gt;block.number - uncle.number = k&lt;&#x2F;code&gt;, the uncle reward is&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;new_uncle_reward = (8 - k) * new_block_reward &#x2F; 8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This is the existing pre-Constantinople formula for uncle rewards, simply adjusted with &lt;code&gt;new_block_reward&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The nephew reward for &lt;code&gt;block.number &amp;gt;= CNSTNTNPL_FORK_BLKNUM&lt;&#x2F;code&gt; is&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;new_nephew_reward = new_block_reward &#x2F; 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This is the existing pre-Constantinople formula for nephew rewards, simply adjusted with &lt;code&gt;new_block_reward&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This will delay the ice age by 29 million seconds (approximately 12 months), so the chain would be back at 30 second block times in winter 2019. An alternate proposal was to add special rules to the difficulty calculation to effectively &lt;em&gt;pause&lt;&#x2F;em&gt; the difficulty between different blocks. This would lead to similar results.&lt;&#x2F;p&gt;
&lt;p&gt;This was previously discussed at All Core Devs Meeting &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;pm&#x2F;blob&#x2F;6dbd82303bfcb697eaf9a76de37f5fa570e6379d&#x2F;AllCoreDevs-EL-Meetings&#x2F;Meeting%2042.md&quot;&gt;#42&lt;&#x2F;a&gt; and subsequent meetings; and accepted in the Constantinople Session &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;pm&#x2F;issues&#x2F;55&quot;&gt;#1&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is not forward compatible and introduces backwards incompatibilities in the difficulty calculation, as well as the block, uncle and nephew reward structure. Therefore, it should be included in a scheduled hardfork at a certain block number. It&#x27;s suggested to include this EIP in the second Metropolis hard-fork, &lt;em&gt;Constantinople&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases shall be created once the specification is to be accepted by the developers or implemented by the clients.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The implementation in it&#x27;s logic does not differ from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;649&#x2F;&quot;&gt;EIP-649&lt;&#x2F;a&gt;; an implementation for Parity-Ethereum is available in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;paritytech&#x2F;parity-ethereum&#x2F;pull&#x2F;9187&quot;&gt;parity-ethereum#9187&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Defuse Difficulty Bomb and Reset Block Reward</title>
        <published>2018-07-18T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>SmeargleUsedFly</name><uri>https://github.com/SmeargleUsedFly</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1227/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/1227" />
        

        <id>https://wg-eips.ritovision.com/1227/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:1227"
            label="EIP-1227" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1227/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes to permanently disable the &quot;difficulty bomb&quot; and reset the block reward to pre-Byzantium levels.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Starting with &lt;code&gt;FORK_BLKNUM&lt;&#x2F;code&gt; the client will calculate the difficulty without the additional exponential component. Furthermore, block rewards will be adjusted to a base of 5 ETH, uncle and nephew rewards will be adjusted accordingly.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Due to the &quot;difficulty bomb&quot; (also known as the &quot;ice age&quot;), introduced in EIP &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2&#x2F;&quot;&gt;#2&lt;&#x2F;a&gt;, an artificial exponential increase in difficulty until chain freeze, users may find it much more challenging to remain on the unforked chain after a hard-fork. This is a desirable effect of the ice age (in fact, its only stated purpose) in the case of a scheduled network upgrade, but is especially problematic when a hard-fork includes a controversial change.&lt;&#x2F;p&gt;
&lt;p&gt;This situation has already been observed: during the Byzantium hard-fork users were given the &quot;choice&quot; of following the upgraded side of the chain or remaining on the original chain, the latter already experiencing block times greater than 30 seconds. In reality one will find that organizing a disperse and decentralized set of individuals to keep the original, soon-to-be-dead chain alive under such conditions impossible. This is exacerbated when a controversial change, such as EIP &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;649&#x2F;&quot;&gt;#649&lt;&#x2F;a&gt;, is merged in so close to the hard-fork date, as users cannot be organized to take an educated stance for or against the change on such short notice.&lt;&#x2F;p&gt;
&lt;p&gt;Ultimately, the difficulty bomb serves but a single purpose: make it more difficult to keep the original chain alive after a hard-fork. This is unacceptable if the only way the community can make their voice heard is running&#x2F;not running client software, and not through the EIP process, since they effectively have no choice and therefore no power. This EIP proposes to completely eliminate the difficulty bomb, returning some measure of power over Ethereum&#x27;s governance process to the users, to the community.&lt;&#x2F;p&gt;
&lt;p&gt;Given the controversy surrounding the directly relevant EIP &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;649&#x2F;&quot;&gt;#649&lt;&#x2F;a&gt;, the issuance should also be reset to pre-Byzantium levels. It may be reduced again at a later time via a new hard-fork, only this time users would actually have a meaningful choice in accepting the change or not. Note: the issuance reduction is not the focus of this proposal, and is optional; the defusing of the difficulty bomb is of primary concern.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h4 id=&quot;remove-exponential-component-of-difficulty-adjustment&quot;&gt;Remove Exponential Component of Difficulty Adjustment&lt;&#x2F;h4&gt;
&lt;p&gt;For the purposes of &lt;code&gt;calc_difficulty&lt;&#x2F;code&gt;, simply remove the exponential difficulty adjustment component, &lt;code&gt;epsilon&lt;&#x2F;code&gt;, i.e. the &lt;code&gt;int(2**((block.number &#x2F;&#x2F; 100000) - 2))&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;reset-block-uncle-and-nephew-rewards&quot;&gt;Reset Block, Uncle, and Nephew rewards&lt;&#x2F;h4&gt;
&lt;p&gt;To ensure a constant Ether issuance, adjust the block reward to &lt;code&gt;new_block_reward&lt;&#x2F;code&gt;, where&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;new_block_reward = 5_000_000_000_000_000_000 if block.number &amp;gt;= FORK_BLKNUM else block.reward&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;(5E18 wei, or 5,000,000,000,000,000,000 wei, or 5 ETH).&lt;&#x2F;p&gt;
&lt;p&gt;Analogue, if an uncle is included in a block for &lt;code&gt;block.number &amp;gt;= FORK_BLKNUM&lt;&#x2F;code&gt; such that &lt;code&gt;block.number - uncle.number = k&lt;&#x2F;code&gt;, the uncle reward is&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;new_uncle_reward = (8 - k) * new_block_reward &#x2F; 8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This is the existing pre-Byzantium formula for uncle rewards, simply adjusted with &lt;code&gt;new_block_reward&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The nephew reward for &lt;code&gt;block.number &amp;gt;= FORK_BLKNUM&lt;&#x2F;code&gt; is&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;new_nephew_reward = new_block_reward &#x2F; 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This is the existing pre-Byzantium formula for nephew rewards, simply adjusted with &lt;code&gt;new_block_reward&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This will permanently, without further changes, disable the &quot;ice age.&quot; It will also reset the block reward to pre-Byzantium levels. Both of these changes are specified similarly to EIP &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;649&#x2F;&quot;&gt;#649&lt;&#x2F;a&gt;, so they should require only minimal changes from client developers.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is not forward compatible and introduces backwards incompatibilities in the difficulty calculation, as well as the block, uncle and nephew reward structure. However, it may be controversial in nature among different sections of the userbase—the very problem this EIP is made to address. Therefore, it should not be included in a scheduled hardfork at a certain block number. It is suggested to implement this EIP in an isolated hard-fork before the second of the two Metropolis hard-forks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Forthcoming.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Forthcoming.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Membership Verification Token (MVT)</title>
        <published>2018-07-14T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Chaitanya Potti</name><uri>https://github.com/chaitanyapotti</uri>
	</author>
	
	<author>
		<name>Partha Bhattacharya</name><uri>https://github.com/pb25193</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1261/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/1261" />
        

        <id>https://wg-eips.ritovision.com/1261/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:1261"
            label="ERC-1261" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1261/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;A standard interface for Membership Verification Token(MVT).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The following standard allows for the implementation of a standard API for Membership Verification Token within smart contracts(called entities). This standard provides basic functionality to track membership of individuals in certain on-chain ‘organizations’. This allows for several use cases like automated compliance, and several forms of governance and membership structures.&lt;&#x2F;p&gt;
&lt;p&gt;We considered use cases of MVTs being assigned to individuals which are non-transferable and revocable by the owner. MVTs can represent proof of recognition, proof of membership, proof of right-to-vote and several such otherwise abstract concepts on the blockchain. The following are some examples of those use cases, and it is possible to come up with several others:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Voting: Voting is inherently supposed to be a permissioned activity. So far, onchain voting systems are only able to carry out voting with coin balance based polls. This can now change and take various shapes and forms.&lt;&#x2F;li&gt;
&lt;li&gt;Passport issuance, social benefit distribution, Travel permit issuance, Drivers licence issuance are all applications which can be abstracted into membership, that is belonging of an individual to a small set, recognized by some authority as having certain entitlements, without needing any individual specific information(right to welfare, freedom of movement, authorization to operate vehicles, immigration)&lt;&#x2F;li&gt;
&lt;li&gt;Investor permissioning: Making regulatory compliance a simple on chain process. Tokenization of securities, that are streamlined to flow only to accredited addresses, tracing and certifying on chain addresses for AML purposes.&lt;&#x2F;li&gt;
&lt;li&gt;Software licencing: Software companies like game developers can use the protocol to authorize certain hardware units(consoles) to download and use specific software(games)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In general, an individual can have different memberships in their day to day life. The protocol allows for the creation of software that puts everything all at one place. Their identity can be verified instantly. Imagine a world where you don&#x27;t need to carry a wallet full of identity cards (Passport, gym membership, SSN, Company ID etc) and organizations can easily keep track of all its members. Organizations can easily identify and disallow fake identities.&lt;&#x2F;p&gt;
&lt;p&gt;Attributes are a huge part of ERC-1261 which help to store identifiable information regarding its members. Polls can make use of attributes to calculate the voterbase.
E.g: Users should belong to USA entity and not belong to Washington state attribute to be a part of a poll.&lt;&#x2F;p&gt;
&lt;p&gt;There will exist a mapping table that maps attribute headers to an array of all possible attributes. This is done in order to subdivide entities into subgroups which are exclusive and exhaustive. For example,
header: blood group alphabet
Array: [ o, a, b, ab ]
header: blood group sign
Array: [ +, - ]&lt;&#x2F;p&gt;
&lt;p&gt;NOT an example of exclusive exhaustive:
Header: video subscription
Array: [ Netflix, HBO, Amazon ]
Because a person is not necessitated to have EXACTLY one of the elements. He or she may have none or more than one.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;A standard interface allows any user, applications to work with any MVT on Ethereum. We provide for simple ERC-1261 smart contracts. Additional applications are discussed below.&lt;&#x2F;p&gt;
&lt;p&gt;This standard is inspired from the fact that voting on the blockchain is done with token balance weights. This has been greatly detrimental to the formation of flexible governance systems on the blockchain, despite the tremendous governance potential that blockchains offer. The idea was to create a permissioning system that allows organizations to vet people once into the organization on the blockchain, and then gain immense flexibility in the kind of governance that can be carried out.&lt;&#x2F;p&gt;
&lt;p&gt;We have also reviewed other Membership EIPs including EIP-725&#x2F;735 Claim Registry. A significant difference between #735 claims and #1261 MVTs is information ownership. In #735 the Claim Holder owns any claims made about themselves. The problem with this is that there is no way for a Claim Issuer to revoke or alter a claim once it has been issued. While #735 does specify a removeClaim method, a malicious implementation could simply ignore that method call, because they own the claim.&lt;&#x2F;p&gt;
&lt;p&gt;Imagine that SafeEmploy™, a background checking company, issues a claim about Timmy. The claim states that Timmy has never been convicted of any felonies. Timmy makes some bad decisions, and now that claim is no longer true. SafeEmploy™ executes removeClaim, but Timmy&#x27;s #735 contract just ignores it, because Timmy wants to stay employed (and is crypto-clever). #1261 MVTs do not have this problem. Ownership of a badge&#x2F;claim is entirely determined by the contract issuing the badges, not the one receiving them. The issuer is free to remove or change those badges as they see fit.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Trade-off between trustlessness and usability:&lt;&#x2F;strong&gt;
To truly understand the value of the protocol, it is important to understand the trade-off we are treading on. The MVT contract allows the creator to revoke the token, and essentially confiscate the membership of the member in question. To some, this might seem like an unacceptable flaw, however this is a design choice, and not a flaw.
The choice may seem to place a great amount of trust in the individuals who are managing the entity contract(entity owners). If the interests of the entity owner conflict with the interests of the members, the owner may resort to addition of fake addresses(to dominate consensus) or evicting members(to censor unfavourable decisions). At first glance this appears to be a major shortcomings, because the blockchain space is used to absolute removal of authority in most cases. Even the official definition of a dapp requires the absence of any party that manages the services provided by the application. However, the trust in entity owners is not misplaced, if it can be ensured that the interests of entity owners are aligned with the interests of members.
Another criticism of such a system would be that the standard edge of blockchain intermediation - “you cannot bribe the system if you don’t know who to bribe” - no longer holds. It is possible to bribe an entity owner into submission, and get them to censor or fake votes. There are several ways to respond to this argument. First of all, all activities, such as addition of members, and removal of members can be tracked on the blockchain and traces of such activity cannot be removed. It is not difficult to build analytics tools to detect malicious activity(adding 100 fake members suddenly who vote in the direction&#x2F;sudden removal of a number of members voting in a certain direction). Secondly, the entity owners’ power is limited to the addition and removal of members. This means that they cannot tamper any votes. They can only alter the counting system to include fake voters or remove real voters. Any sensible auditor can identify the malicious&#x2F;victim addresses and create an open source audit tool to find out the correct results. The biggest loser in this attack will be the entity owner, who has a reputation to lose.
Finally, one must understand why we are taking a step away from trustlessness in this trade-off. The answer is usability. Introducing a permissioning system expands the scope of products and services that can be delivered through the blockchain, while leveraging other aspects of the blockchain(cheap, immutable, no red-tape, secure). Consider the example of the driver licence issuing agency using the ERC-1300 standard. This is a service that simply cannot be deployed in a completely trustless environment. The introduction of permissioned systems expanded the scope of services on the blockchain to cover this particular service. Sure, they have the power to revoke a person’s licence for no reason. But will they? Who stands to lose the most, if the agency acts erratically? The agency itself. Now consider the alternative, the way licences(not necessarily only drivers licence, but say shareholder certificates and so on) are issued, the amount of time consumed, the complete lack of transparency. One could argue that if the legacy systems providing these services really wanted to carry out corruption and nepotism in the execution of these services, the present systems make it much easier to do so. Also, they are not transparent, meaning that there is no way to even detect if they act maliciously.
All that being said, we are very excited to share our proposal with the community and open up to suggestions in this space.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Every ERC-1261 compliant contract must implement the &lt;code&gt;ERC1261&lt;&#x2F;code&gt;, &lt;code&gt;ERC173&lt;&#x2F;code&gt; and &lt;code&gt;ERC165&lt;&#x2F;code&gt; interfaces&lt;&#x2F;strong&gt; (subject to &quot;caveats&quot; below):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-1261 MVT Standard&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;blob&#x2F;master&#x2F;EIPS&#x2F;.&#x2F;01261.md&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  The constructor should define the attribute set for this MVT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;  Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0x1d8362cf.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC1261&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is ERC173, ERC165 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when a token is assigned to a member.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Assigned&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attributeIndexes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when a membership is revoked.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Revoked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when a user forfeits his membership&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Forfeited&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when a membership request is accepted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ApprovedMembership&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attributeIndexes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when a membership is requested by an user&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RequestedMembership&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when data of a member is modified.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  Doesn&amp;#39;t emit when a new membership is created and data is assigned.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ModifiedAttributes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attributeIndex&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; attributeValueIndex&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Adds a new attribute (key, value) pair to the set of pre-existing attributes.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Adds a new attribute at the end of the array of attributes and maps it to `values`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  Contract can set a max number of attributes and throw if limit is reached.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _name&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Name of the attribute which is to be added.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; values&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; List of values of the specified attribute.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addAttributeSet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; values&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Modifies the attribute value of a specific attribute for a given `_to` address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Use appropriate checks for whether a user&#x2F;admin can modify the data.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  Best practice is to use onlyOwner modifier from ERC173.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address whose attribute is being modified.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _attributeIndex&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The index of attribute which is being modified.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _modifiedValueIndex&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The index of the new value which is being assigned to the user attribute.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; modifyAttributeByIndex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _attributeIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _modifiedValueIndex&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Requests membership from any address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws if the `msg.sender` already has the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  The individual `msg.sender` can request for a membership if some existing criteria are satisfied.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  When a membership is requested, this function emits the RequestedMembership event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  dev can store the membership request and use `approveRequest` to assign membership later&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  dev can also oraclize the request to assign membership later&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _attributeIndexes&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the attribute data associated with the member.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  This is an array which contains indexes of attributes.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; requestMembership&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _attributeIndexes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; User can forfeit his membership.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws if the `msg.sender` already doesn&amp;#39;t have the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  The individual `msg.sender` can revoke his&#x2F;her membership.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  When the token is revoked, this function emits the Revoked event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; forfeitMembership&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Owner approves membership from any address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws if the `_user` doesn&amp;#39;t have a pending request.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  Throws if the `msg.sender` is not an owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  Approves the pending request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  Make oraclize callback call this function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  When the token is assigned, this function emits the `ApprovedMembership` and `Assigned` events.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _user&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the user whose membership request will be approved.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approveRequest&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _user&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Owner discards membership from any address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws if the `_user` doesn&amp;#39;t have a pending request.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  Throws if the `msg.sender` is not an owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  Discards the pending request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  Make oraclize callback call this function if criteria are not satisfied&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _user&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the user whose membership request will be discarded.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; discardRequest&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _user&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Assigns membership of an MVT from owner address to another address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws if the member already has the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  Throws if `_to` is the zero address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  Throws if the `msg.sender` is not an owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  The entity assigns the membership to each individual.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  When the token is assigned, this function emits the Assigned event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to which the token is assigned.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _attributeIndexes&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The attribute data associated with the member.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  This is an array which contains indexes of attributes.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; assignTo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _attributeIndexes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Only Owner can revoke the membership.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This removes the membership of the user.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  Throws if the `_from` is not an owner of the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  Throws if the `msg.sender` is not an owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  Throws if `_from` is the zero address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  When transaction is complete, this function emits the Revoked event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The current owner of the MVT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revokeFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Queries whether a member is a current member of the organization.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MVT&amp;#39;s assigned to the zero address are considered invalid, and this&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  function throws for queries about the zero address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An address for whom to query the membership.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Whether&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the member owns the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isCurrentMember&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Gets the value collection of an attribute.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the values of attributes as a bytes32 array.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _name&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Name of the attribute whose values are to be fetched&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; values of attributes.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getAttributeExhaustiveCollection&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _name&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the list of all past and present members.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Use this function along with isCurrentMember to find wasMemberOf() in Js.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  It can be calculated as present in getAllMembers() and !isCurrentMember().&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; List&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; of addresses who have owned the token and currently own the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getAllMembers&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the count of all current members.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Use this function in polls as denominator to get percentage of members voted.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Count&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; of current Members.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getCurrentMemberCount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the list of all attribute names.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the names of attributes as a bytes32 array.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  AttributeNames are stored in a bytes32 Array.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  Possible values for each attributeName are stored in a mapping(attributeName =&amp;gt; attributeValues).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  AttributeName is bytes32 and attributeValues is bytes32[].&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  Attributes of a particular user are stored in bytes32[].&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  Which has a single attributeValue for each attributeName in an array.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  Use web3.toAscii(data[0]).replace(&#x2F;\u0000&#x2F;g, &amp;quot;&amp;quot;) to convert to string in JS.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; names of attributes.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getAttributeNames&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the attributes of `_to` address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws if `_to` is the zero address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  Use web3.toAscii(data[0]).replace(&#x2F;\u0000&#x2F;g, &amp;quot;&amp;quot;) to convert to string in JS.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address whose current attributes are to be returned.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; attributes associated with `_to` address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getAttributes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the `attribute` stored against `_to` address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Finds the index of the `attribute`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  Throws if the attribute is not present in the predefined attributes.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  Returns the attributeValue for the specified `attribute`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address whose attribute is requested.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _attributeIndex&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The attribute Index which is required.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; attribute value at the specified name.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getAttributeByIndex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _attributeIndex&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC173&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is ERC165 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when ownership of a contract changes.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OwnershipTransferred&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; previousOwner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newOwner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the address of the owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address of the owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Set the address of the new owner of the contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _newOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the new owner of the contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferOwnership&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _newOwner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC165&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Query if a contract implements an interface&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; interfaceID&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The interface identifier, as specified in ERC-165&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Interface identification is specified in ERC-165. This function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  uses less than 30,000 gas.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `true` if the contract implements `interfaceID` and&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  `interfaceID` is not 0xffffffff, `false` otherwise&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;strong&gt;metadata extension&lt;&#x2F;strong&gt; is OPTIONAL for ERC-1261 smart contracts (see &quot;caveats&quot;, below). This allows your smart contract to be interrogated for its name and for details about the organization which your MV tokens represent.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-1261 MVT Standard, optional metadata extension&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;blob&#x2F;master&#x2F;EIPS&#x2F;.&#x2F;01261.md&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC1261Metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is ERC1261 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A descriptive name for a collection of MVTs in this contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _name&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An abbreviated name for MVTs in this contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; symbol&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _symbol&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This is the &quot;ERC1261 Metadata JSON Schema&quot; referenced above.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Organization Metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Identifies the organization to which this MVT represents&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Describes the organization to which this MVT represents&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;caveats&quot;&gt;Caveats&lt;&#x2F;h3&gt;
&lt;p&gt;The 0.4.24 Solidity interface grammar is not expressive enough to document the ERC-1261 standard. A contract which complies with ERC-1261 MUST also abide by the following:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Solidity issue #3412: The above interfaces include explicit mutability guarantees for each function. Mutability guarantees are, in order weak to strong: &lt;code&gt;payable&lt;&#x2F;code&gt;, implicit nonpayable, &lt;code&gt;view&lt;&#x2F;code&gt;, and &lt;code&gt;pure&lt;&#x2F;code&gt;. Your implementation MUST meet the mutability guarantee in this interface and you MAY meet a stronger guarantee. For example, a &lt;code&gt;payable&lt;&#x2F;code&gt; function in this interface may be implemented as nonpayble (no state mutability specified) in your contract. We expect a later Solidity release will allow your stricter contract to inherit from this interface, but a workaround for version 0.4.24 is that you can edit this interface to add stricter mutability before inheriting from your contract.&lt;&#x2F;li&gt;
&lt;li&gt;Solidity issue #3419: A contract that implements &lt;code&gt;ERC1261Metadata&lt;&#x2F;code&gt; SHALL also implement &lt;code&gt;ERC1261&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Solidity issue #2330: If a function is shown in this specification as &lt;code&gt;external&lt;&#x2F;code&gt; then a contract will be compliant if it uses &lt;code&gt;public&lt;&#x2F;code&gt; visibility. As a workaround for version 0.4.24, you can edit this interface to switch to &lt;code&gt;public&lt;&#x2F;code&gt; before inheriting from your contract.&lt;&#x2F;li&gt;
&lt;li&gt;Solidity issues #3494, #3544: Use of &lt;code&gt;this.*.selector&lt;&#x2F;code&gt; is marked as a warning by Solidity, a future version of Solidity will not mark this as an error.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;If a newer version of Solidity allows the caveats to be expressed in code, then this EIP MAY be updated and the caveats removed, such will be equivalent to the original specification.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;There are many potential uses of Ethereum smart contracts that depend on tracking membership. Examples of existing or planned MVT systems are Vault, a DAICO platform, and Stream, a security token framework. Future uses include the implementation of direct democracy, in-game memberships and badges, licence and travel document issuance, electronic voting machine trails, software licencing and many more.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;MVT Word Choice:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Since the tokens are non transferable and revocable, they function like membership cards. Hence the word membership verification token.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Transfer Mechanism&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;MVTs can&#x27;t be transferred. This is a design choice, and one of the features that distinguishes this protocol.
Any member can always ask the issuer to revoke the token from an existing address and assign to a new address.
One can think of the set of MVTs as identifying a user, and you cannot split the user into parts and have it be the same user, but you can transfer a user to a new private key.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Assign and Revoke mechanism&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The assign and revoke functions&#x27; documentation only specify conditions when the transaction MUST throw. Your implementation MAY also throw in other situations. This allows implementations to achieve interesting results:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Disallow additional memberships after a condition is met&lt;&#x2F;strong&gt; — Sample contract available on GitHub&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Blacklist certain address from receiving MV tokens&lt;&#x2F;strong&gt; — Sample contract available on GitHub&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Disallow additional memberships after a certain time is reached&lt;&#x2F;strong&gt; — Sample contract available on GitHub&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Charge a fee to user of a transaction&lt;&#x2F;strong&gt; — require payment when calling &lt;code&gt;assign&lt;&#x2F;code&gt; and &lt;code&gt;revoke&lt;&#x2F;code&gt; so that condition checks from external sources can be made&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;ERC-173 Interface&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;We chose Standard Interface for Ownership (ERC-173) to manage the ownership of a ERC-1261 contract.&lt;&#x2F;p&gt;
&lt;p&gt;A future EIP&#x2F; Zeppelin may create a multi-ownable implementation for ownership. We strongly support such an EIP and it would allow your ERC-1261 implementation to implement &lt;code&gt;ERC1261Metadata&lt;&#x2F;code&gt;, or other interfaces by delegating to a separate contract.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;ERC-165 Interface&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;We chose Standard Interface Detection (ERC-165) to expose the interfaces that a ERC-1261 smart contract supports.&lt;&#x2F;p&gt;
&lt;p&gt;A future EIP may create a global registry of interfaces for contracts. We strongly support such an EIP and it would allow your ERC-1261 implementation to implement &lt;code&gt;ERC1261Metadata&lt;&#x2F;code&gt;, or other interfaces by delegating to a separate contract.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Gas and Complexity&lt;&#x2F;strong&gt; (regarding the enumeration extension)&lt;&#x2F;p&gt;
&lt;p&gt;This specification contemplates implementations that manage a few and &lt;em&gt;arbitrarily large&lt;&#x2F;em&gt; numbers of MVTs. If your application is able to grow then avoid using for&#x2F;while loops in your code. These indicate your contract may be unable to scale and gas costs will rise over time without bound&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Privacy&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Personal information: The protocol does not put any personal information on to the blockchain, so there is no compromise of privacy in that respect.
Membership privacy: The protocol by design, makes it public which addresses are&#x2F;aren’t members. Without making that information public, it would not be possible to independently audit governance activity or track admin(entity owner) activity.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Metadata Choices&lt;&#x2F;strong&gt; (metadata extension)&lt;&#x2F;p&gt;
&lt;p&gt;We have required &lt;code&gt;name&lt;&#x2F;code&gt; and &lt;code&gt;symbol&lt;&#x2F;code&gt; functions in the metadata extension. Every token EIP and draft we reviewed (ERC-20, ERC-223, ERC-677, ERC-777, ERC-827) included these functions.&lt;&#x2F;p&gt;
&lt;p&gt;We remind implementation authors that the empty string is a valid response to &lt;code&gt;name&lt;&#x2F;code&gt; and &lt;code&gt;symbol&lt;&#x2F;code&gt; if you protest to the usage of this mechanism. We also remind everyone that any smart contract can use the same name and symbol as &lt;em&gt;your&lt;&#x2F;em&gt; contract. How a client may determine which ERC-1261 smart contracts are well-known (canonical) is outside the scope of this standard.&lt;&#x2F;p&gt;
&lt;p&gt;A mechanism is provided to associate MVTs with URIs. We expect that many implementations will take advantage of this to provide metadata for each MVT system. The URI MAY be mutable (i.e. it changes from time to time). We considered an MVT representing membership of a place, in this case metadata about the organization can naturally change.&lt;&#x2F;p&gt;
&lt;p&gt;Metadata is returned as a string value. Currently this is only usable as calling from &lt;code&gt;web3&lt;&#x2F;code&gt;, not from other contracts. This is acceptable because we have not considered a use case where an on-blockchain application would query such information.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Alternatives considered: put all metadata for each asset on the blockchain (too expensive), use URL templates to query metadata parts (URL templates do not work with all URL schemes, especially P2P URLs), multiaddr network address (not mature enough)&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Community Consensus&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;We have been very inclusive in this process and invite anyone with questions or contributions into our discussion. However, this standard is written only to support the identified use cases which are listed herein.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;We have adopted &lt;code&gt;name&lt;&#x2F;code&gt; and &lt;code&gt;symbol&lt;&#x2F;code&gt; semantics from the ERC-20 specification.&lt;&#x2F;p&gt;
&lt;p&gt;Example MVT implementations as of July 2018:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Membership Verification Token(https:&#x2F;&#x2F;github.com&#x2F;chaitanyapotti&#x2F;MembershipVerificationToken)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Membership Verification Token ERC-1261 Token includes test cases written using Truffle.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementations&quot;&gt;Implementations&lt;&#x2F;h2&gt;
&lt;p&gt;Membership Verification Token ERC1261 -- a reference implementation&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;MIT licensed, so you can freely use it for your projects&lt;&#x2F;li&gt;
&lt;li&gt;Includes test cases&lt;&#x2F;li&gt;
&lt;li&gt;Also available as a npm package - npm i membershipverificationtoken&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;Standards&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;ERC-20 Token Standard. .&#x2F;00020.md&lt;&#x2F;li&gt;
&lt;li&gt;ERC-165 Standard Interface Detection. .&#x2F;00165.md&lt;&#x2F;li&gt;
&lt;li&gt;ERC-725&#x2F;735 Claim Registry .&#x2F;00725.md&lt;&#x2F;li&gt;
&lt;li&gt;ERC-173 Owned Standard. .&#x2F;00173.md&lt;&#x2F;li&gt;
&lt;li&gt;JSON Schema. https:&#x2F;&#x2F;json-schema.org&#x2F;&lt;&#x2F;li&gt;
&lt;li&gt;Multiaddr. https:&#x2F;&#x2F;github.com&#x2F;multiformats&#x2F;multiaddr&lt;&#x2F;li&gt;
&lt;li&gt;RFC 2119 Key words for use in RFCs to Indicate Requirement Levels. https:&#x2F;&#x2F;www.ietf.org&#x2F;rfc&#x2F;rfc2119.txt&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;strong&gt;Issues&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The Original ERC-1261 Issue. https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;eips&#x2F;issues&#x2F;1261&lt;&#x2F;li&gt;
&lt;li&gt;Solidity Issue #2330 -- Interface Functions are Axternal. https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;solidity&#x2F;issues&#x2F;2330&lt;&#x2F;li&gt;
&lt;li&gt;Solidity Issue #3412 -- Implement Interface: Allow Stricter Mutability. https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;solidity&#x2F;issues&#x2F;3412&lt;&#x2F;li&gt;
&lt;li&gt;Solidity Issue #3419 -- Interfaces Can&#x27;t Inherit. https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;solidity&#x2F;issues&#x2F;3419&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;strong&gt;Discussions&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Gitter #EIPs (announcement of first live discussion). https:&#x2F;&#x2F;gitter.im&#x2F;ethereum&#x2F;EIPs?at=5b5a1733d2f0934551d37642&lt;&#x2F;li&gt;
&lt;li&gt;ERC-1261 (announcement of first live discussion). https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;eips&#x2F;issues&#x2F;1261&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;strong&gt;MVT Implementations and Other Projects&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Membership Verification Token ERC-1261 Token. https:&#x2F;&#x2F;github.com&#x2F;chaitanyapotti&#x2F;MembershipVerificationToken&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>DAuth Access Delegation Standard</title>
        <published>2018-07-10T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Xiaoyu Wang</name><uri>https://github.com/wxygeek</uri>
	</author>
	
	<author>
		<name>Bicong Wang</name><uri>https://github.com/Wangbicong</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1207/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/1207" />
        

        <id>https://wg-eips.ritovision.com/1207/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:1207"
            label="ERC-1207" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1207/">&lt;h1 id=&quot;dauth-access-delegation-standard&quot;&gt;DAuth Access Delegation Standard&lt;&#x2F;h1&gt;
&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;DAuth is a standard interface for accessing authorization delegation between smart contracts and users.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The DAuth protocol defines a set of standard API allowing identity delegations between smart contracts without the user&#x27;s private key.  Identity delegations include accessing and operating a user&#x27;s data and assets contained in the delegated contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The inspiration for designing DAuth comes from OAuth protocol that is extensively used in web applications. But unlike the centralized authorization of OAuth, DAuth works in a  distributed manner, thus providing much more reliability and generality.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1207&#x2F;.&#x2F;assets&#x2F;rationale.png&quot; alt=&quot;Rationale&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Resource owner&lt;&#x2F;strong&gt;: the authorizer&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Resource contract&lt;&#x2F;strong&gt;: the contract providing data and operators&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;API&lt;&#x2F;strong&gt;: the resource contract APIs that the grantee contract can invoke&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Client contract&lt;&#x2F;strong&gt;: the grantee contract using authorization to access and operate the data&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Grantee request&lt;&#x2F;strong&gt;: the client contract calls the resource contract with the authorizer authorization&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;AuthInfo&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; AuthInfo&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; funcNames&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; expireAt&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Required - The struct contains user authorization information&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;funcNames&lt;&#x2F;code&gt;: a list of function names callable by the granted contract&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;expireAt&lt;&#x2F;code&gt;: the authorization expire timestamp in seconds&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;userAuth&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; AuthInfo&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; userAuth&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Required - userAuth maps (authorizer address, grantee contract address) pair to the user’s authorization AuthInfo object&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;callableFuncNames&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; callableFuncNames&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Required - All methods that are allowed other contracts to call&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The callable function MUST verify the grantee’s authorization&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;updateCallableFuncNames&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; updateCallableFuncNames&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _invokes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Optional - Update the callable function list for the client contract by the resource contract&#x27;s administrator&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;_invokes&lt;&#x2F;code&gt;: the invoke methods that the client contract can call&lt;&#x2F;li&gt;
&lt;li&gt;return: Whether the callableFuncNames is updated or not&lt;&#x2F;li&gt;
&lt;li&gt;This method MUST return success or throw, no other outcomes can be possible&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;verify&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _authorizer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _invoke&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Required - check the invoke method authority for the client contract&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;_authorizer&lt;&#x2F;code&gt;: the user address that the client contract agents&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;_invoke&lt;&#x2F;code&gt;: the invoke method that the client contract wants to call&lt;&#x2F;li&gt;
&lt;li&gt;return: Whether the grantee request is authorized or not&lt;&#x2F;li&gt;
&lt;li&gt;This method MUST return success or throw, no other outcomes can be possible&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;grant&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; grant&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _grantee&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _invokes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _expireAt&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Required - delegate a client contract to access the user&#x27;s resource&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;_grantee&lt;&#x2F;code&gt;: the client contract address&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;_invokes&lt;&#x2F;code&gt;: the callable methods that the client contract can access. It is a string which contains all function names split by spaces&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;_expireAt&lt;&#x2F;code&gt;: the authorization expire timestamp in seconds&lt;&#x2F;li&gt;
&lt;li&gt;return: Whether the grant is successful or not&lt;&#x2F;li&gt;
&lt;li&gt;This method MUST return success or throw, no other outcomes can be possible&lt;&#x2F;li&gt;
&lt;li&gt;A successful grant MUST fire the Grant event(defined below)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;regrant&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; regrant&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _grantee&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _invokes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _expireAt&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Optional - alter a client contract&#x27;s delegation&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;revoke&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revoke&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _grantee&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Required - delete a client contract&#x27;s delegation&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;_grantee&lt;&#x2F;code&gt;: the client contract address&lt;&#x2F;li&gt;
&lt;li&gt;return: Whether the revoke is successful or not&lt;&#x2F;li&gt;
&lt;li&gt;A successful revoke MUST fire the Revoke event(defined below).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Grant&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Grant&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _authorizer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _grantee&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _invokes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _expireAt&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;This event MUST trigger when the authorizer grant a new authorization when &lt;code&gt;grant&lt;&#x2F;code&gt; or &lt;code&gt;regrant&lt;&#x2F;code&gt; processes successfully&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Revoke&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Revoke&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _authorizer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _grantee&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;This event MUST trigger when the authorizer revoke a specific authorization successfully&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Callable Resource Contract Functions&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;All public or external functions that are allowed the grantee to call MUST use overload to implement two functions: The First one is the standard method that the user invokes directly, the second one is the grantee methods of the same function name with one more authorizer address parameter.&lt;&#x2F;p&gt;
&lt;p&gt;Example:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _authorizer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    verify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_authorizer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;approve&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_authorizer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    allowed&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_spender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Approval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;Current Limitations&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The current design of many smart contracts only considers the user invokes the smart contract functions by themselves using the private key. However, in some case, the user wants to delegate other client smart contracts to access and operate their data or assets in the resource smart contract. There isn’t a common protocol to provide a standard delegation approach.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Rationale&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;On the Ethereum platform, all storage is transparent and the &lt;code&gt;msg.sender&lt;&#x2F;code&gt; is reliable. Therefore, the DAuth don&#x27;t need an &lt;code&gt;access_token&lt;&#x2F;code&gt; like OAuth. DAuth just recodes the users&#x27; authorization for the specific client smart contract&#x27;s address. It is simple and reliable on the Ethereum platform.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces no backward compatibility issues. In the future, the new version protocol has to keep these interfaces.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Following is the DAuth Interface implementation. Furthermore, the example implementations of EIP20 Interface and ERC-DAuth Interface are also provided. Developers can easily implement their own contracts with ERC-DAuth Interface and other EIP.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;ERC-DAuth Interface implementation is available at:&lt;&#x2F;p&gt;
&lt;p&gt;https:&#x2F;&#x2F;github.com&#x2F;DIA-Network&#x2F;ERC-DAuth&#x2F;blob&#x2F;master&#x2F;ERC-DAuth-Interface.sol&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Example implementation with EIP20 Interface and ERC-DAuth Interface is available at:&lt;&#x2F;p&gt;
&lt;p&gt;https:&#x2F;&#x2F;github.com&#x2F;DIA-Network&#x2F;ERC-DAuth&#x2F;blob&#x2F;master&#x2F;eip20-dauth-example&#x2F;EIP20DAuth.sol&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Voting Interface</title>
        <published>2018-07-08T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Zainan Victor Zhou</name><uri>https://github.com/xinbenlv</uri>
	</author>
	
	<author>
		<name>ERC-1202 Working Group</name><email>erc1202@googlegroups.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1202/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-1202-voting-interface/11484" />
        

        <id>https://wg-eips.ritovision.com/1202/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:1202"
            label="ERC-1202" />
        

        
        

        
        <summary type="html">A general interface for voting on-chain</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1202/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is an API for implementing voting with smart contract. This standard provides functionalities to voting as well as to view the vote result and set voting status.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Voting is one of the earliest example of EVM programming, and also a key to DAO&#x2F;organizational governance process. We foresee many DAOs will ultimately need to leverage voting as one of the important part of their governance. By creating a voting standard for smart contract &#x2F; token, we can have the following benefits&lt;&#x2F;p&gt;
&lt;h3 id=&quot;benefits-of-having-a-standard&quot;&gt;Benefits of having a standard&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;Allow general UI and applications to be built on top of a standardized voting to allow more general user to participate, and encourage more DApp and DAO to think about their governance&lt;&#x2F;li&gt;
&lt;li&gt;Allow delegate voting &#x2F; smart contract voting, automatic voting&lt;&#x2F;li&gt;
&lt;li&gt;Allow voting results to be recorded on-chain, in a standard way, and allow DAOs and DApps to honor the voting result programmatically.&lt;&#x2F;li&gt;
&lt;li&gt;Allow the compatibility with token standard such as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; or other new standards(&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;777&#x2F;&quot;&gt;ERC-777&lt;&#x2F;a&gt;) and item standard such as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Create massive potential for interoperability within Ethereum echo systems and other system.&lt;&#x2F;li&gt;
&lt;li&gt;Allow setting voting deadline, allow determine on single or multiple options. Allow requiring voting orders. (trade-off is interface complexity, we might need &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; approach and later a &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;777&#x2F;&quot;&gt;ERC-777&lt;&#x2F;a&gt; for advanced voting)&lt;&#x2F;li&gt;
&lt;li&gt;Recording the voting with weights with token amount.&lt;&#x2F;li&gt;
&lt;li&gt;Possibly allow trust-worthy privacy-safe voting and anonymous voting (with either voter address being un-associated with the vote they cast, given a list of randomized&#x2F;obfuscated voting options).&lt;&#x2F;li&gt;
&lt;li&gt;Possibly allow result in reward by voting participation or voting result.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;non-goal-out-of-scope&quot;&gt;Non-Goal &#x2F; Out of Scope&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Delegation&lt;&#x2F;strong&gt;: We intentionally leave delegation out of scope. A separate EIP could be proposed to address this particular use case.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Eligibility or Weights&lt;&#x2F;strong&gt;: Some of the implementing want to have weights or eligibility to vote to be configurable. Such as OpenZeppelin&#x27;s implementation of GovernorBravo uses snapshot. Aslo weights calculation such as quadratic voting is not within the scope of this EIP. This EIP is intend to be flexible for
any current and new voting weights calculation.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Proposal&lt;&#x2F;strong&gt;: We intentionally leave Proposal out of scope. Proposals are going to be identified by &lt;code&gt;proposalId&lt;&#x2F;code&gt; but what information of the proposal includes,
whether they are on-chain or off-chain and whether they are exeutable, is leaved out from this proposal. A separate EIP could be proposed to address this particular use case. See one of such proposals &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5247&#x2F;&quot;&gt;ERC-5247&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Signature Aggregations &#x2F; Endorsement&lt;&#x2F;strong&gt;: When implementing contracts want to allow user to submit their vote or approval of vote offline and have some other
account to generate the transaction, the signature aggregations or endorsements are not in scope of this EIP. A separate EIP could be proposed to address this particular use case. See one of such proposals here &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5453&#x2F;&quot;&gt;ERC-5453&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;use-cases&quot;&gt;Use-cases&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;Determine on issuing new token, issuing more token or issuing sub-token&lt;&#x2F;li&gt;
&lt;li&gt;Determine on creating new item under &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Determine on election on certain person or smart contract to be delegated leader for project or subproject&lt;&#x2F;li&gt;
&lt;li&gt;Determine on auditing result ownership allowing migration of smart contract proxy address&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;Compliant contracts MUST implement the &lt;code&gt;IERC1202Core&lt;&#x2F;code&gt; below&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC1202Core&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; VoteCast&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; voter&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; proposalId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; support&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; weight&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; reason&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; extraParams&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; castVote&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; proposalId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; support&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; weight&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; reasonUri&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; extraParams&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function castVoteFrom(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address from,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 proposalId,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint8 support,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        uint256 weight,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        string calldata reasonUri,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bytes calldata extraParams&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function execute(uint256 proposalId, bytes memory extraParams&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ol start=&quot;2&quot;&gt;
&lt;li&gt;Compliant contracts MAY implement the &lt;code&gt;IERC1202MultiVote&lt;&#x2F;code&gt; Interface. If the intention is for multi-options to be supported, e.g. for ranked-choices
or variant weights voting, Compliant contracts MUST implement &lt;code&gt;IERC1202MultiVote&lt;&#x2F;code&gt; Interface.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC1202MultiVote&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; MultiVoteCast&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; voter&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; proposalId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint8&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; support&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; weight&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; reason&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; extraParams&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; castMultiVote&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; proposalId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint8&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; support&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; weight&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; reasonUri&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; extraParams&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ol start=&quot;3&quot;&gt;
&lt;li&gt;the compliant contract SHOULD implement &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5269&#x2F;&quot;&gt;ERC-5269&lt;&#x2F;a&gt; interface.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;getting-info-voting-period-eligibility-weight&quot;&gt;Getting Info: Voting Period, Eligibility, Weight&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC1202Info&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; votingPeriodFor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; proposalId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; startPointOfTime&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; endPointOfTime&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; eligibleVotingWeight&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; proposalId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; voter&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;We made the following design decisions and here are the rationales.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;granularity-and-anonymity&quot;&gt;Granularity and Anonymity&lt;&#x2F;h3&gt;
&lt;p&gt;We created a &lt;code&gt;view&lt;&#x2F;code&gt; function &lt;code&gt;ballotOf&lt;&#x2F;code&gt; primarily making it easier for people to check the vote from certain address. This has the following assumptions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;It&#x27;s possible to check someone&#x27;s vote directly given an address. If implementor don&#x27;t want to make it so easily, they can simply reject all calls to this function. We want to make sure that we support both anonymous voting an non-anonymous voting. However since all calls to a smart contract is logged in block history, there is really no secrecy unless done with cryptography tricks. I am not cryptography-savvy enough to comment on the possibility. Please see &quot;Second Feedback Questions 2018&quot; for related topic.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;It&#x27;s assumes for each individual address, they can only vote for one decision. They can distribute their available voting power into more granular level. If implementor wants allow this, they ask the user to create another wallet address and grant the new address certain power. For example, a token based voting where voting weight is determined by the amount of token held by a voter, a voter who wants to distribute its voting power in two different option(option set) can transfer some of the tokens to the new account and cast the votes from both accounts.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;weights&quot;&gt;Weights&lt;&#x2F;h3&gt;
&lt;p&gt;We assume there are &lt;code&gt;weight&lt;&#x2F;code&gt; of votes and can be checked by calling &lt;code&gt;eligibleVotingWeight(proposalId, address voter)&lt;&#x2F;code&gt;, and the weight distribution is either internally determined or determined by constructor.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;The &lt;code&gt;support&lt;&#x2F;code&gt; options are chosen to be &lt;code&gt;uint8&lt;&#x2F;code&gt; for the purpose to be backward compatible for GovernorBravo. It can be increased in the future&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;We expect the voting standard to be used in connection with other contracts such as token distributions, conducting actions in consensus or on behalf of an entity, multi-signature wallets, etc.&lt;&#x2F;p&gt;
&lt;p&gt;The major security consideration is to ensure only using the standard interface for performing downstream actions or receiving upstream input (vote casting). We expect future audit tool to be based on standard interfaces.&lt;&#x2F;p&gt;
&lt;p&gt;It&#x27;s also important to note as discussed in this standard that for the sake of simplicity, this EIP is kept in the very basic form. It can be extended to support many different implementation variations. Such variations might contain different assumptions of the behavior and interpretation of actions. One example would be: What does it mean if someone votes multiple times through &lt;code&gt;vote&lt;&#x2F;code&gt;?&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Would that mean the voter is increasing their weight, or&lt;&#x2F;li&gt;
&lt;li&gt;vote multiple options in the meanwhile, or&lt;&#x2F;li&gt;
&lt;li&gt;Does the latter vote override the previous vote?&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Because of the flexible nature of voting, we expect many subsequent standards need to be created as an extension of this EIP. We suggest any extension or implementations of this standard be thoroughly audited before included in large scale or high asset volume applications.&lt;&#x2F;p&gt;
&lt;p&gt;The third consideration is non-triviality. Some voting applications assume &lt;em&gt;&lt;strong&gt;anonymity&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt;, &lt;em&gt;&lt;strong&gt;randomness&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt;, &lt;em&gt;&lt;strong&gt;time-based deadline&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt;, &lt;em&gt;&lt;strong&gt;ordering&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt;, etc, these requirements in Ethereum are known to be non-trivial to achieve. We suggest any applications or organizations rely on audited and time-proven shared libraries when these requirements need to be enforced in their applications.&lt;&#x2F;p&gt;
&lt;p&gt;The fourth consideration is potential abuse. When voting is standardized and put on contract, it is possible to write another contract that rewards a voter to vote in a certain way. It creates potential issues of bribery and conflict of interest abuse that is previously hard to implement.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Composable Non-Fungible Token</title>
        <published>2018-07-07T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Matt Lockyer</name><email>mattdlockyer@gmail.com</email>
	</author>
	
	<author>
		<name>Nick Mudge</name><email>nick@perfectabstractions.com</email>
	</author>
	
	<author>
		<name>Jordan Schalm</name><email>jordan.schalm@gmail.com</email>
	</author>
	
	<author>
		<name>sebastian echeverry</name><email>sebastian.echeverry@robotouniverse.com</email>
	</author>
	
	<author>
		<name>Zainan Victor Zhou</name><uri>https://github.com/xinbenlv</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/998/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-998-composable-non-fungible-tokens-cnfts/387" />
        

        <id>https://wg-eips.ritovision.com/998/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:998"
            label="ERC-998" />
        

        
        

        
        <summary type="html">Extends a ERC-721 to own other ERC-721 and ERC-20 tokens.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/998/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;An extension of the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721 standard&lt;&#x2F;a&gt; to enable ERC-721 tokens to own other ERC-721 tokens and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens.&lt;&#x2F;p&gt;
&lt;p&gt;An extension of the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; and &lt;code&gt;ERC-223 https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;223&lt;&#x2F;code&gt; standards to enable ERC-20 and &lt;code&gt;ERC-223&lt;&#x2F;code&gt; tokens to be owned by ERC-721 tokens.&lt;&#x2F;p&gt;
&lt;p&gt;This specification covers four different kinds of composable tokens:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;998&#x2F;#erc-721-top-down-composable&quot;&gt;&lt;code&gt;ERC998ERC721&lt;&#x2F;code&gt; top-down composable tokens that receive, hold and transfer ERC-721 tokens&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;998&#x2F;#erc-20-top-down-composable&quot;&gt;&lt;code&gt;ERC998ERC20&lt;&#x2F;code&gt; top-down composable tokens that receive, hold and transfer ERC-20 tokens&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;998&#x2F;#erc-721-bottom-up-composable&quot;&gt;&lt;code&gt;ERC998ERC721&lt;&#x2F;code&gt; bottom-up composable tokens that attach themselves to other ERC-721 tokens.&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;998&#x2F;#erc-20-bottom-up-composable&quot;&gt;&lt;code&gt;ERC998ERC20&lt;&#x2F;code&gt; bottom-up composable tokens that attach themselves to ERC-721 tokens.&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;which map to&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;An &lt;code&gt;ERC998ERC721&lt;&#x2F;code&gt; top-down composable is an ERC-721 token with additional functionality for owning other ERC-721 tokens.&lt;&#x2F;li&gt;
&lt;li&gt;An &lt;code&gt;ERC998ERC20&lt;&#x2F;code&gt; top-down composable is an ERC-721 token with additional functionality for owning ERC-20 tokens.&lt;&#x2F;li&gt;
&lt;li&gt;An &lt;code&gt;ERC998ERC721&lt;&#x2F;code&gt; bottom-up composable is an ERC-721 token with additional functionality for being owned by an ERC-721 token.&lt;&#x2F;li&gt;
&lt;li&gt;An &lt;code&gt;ERC998ERC20&lt;&#x2F;code&gt; bottom-up composable is an ERC-20 token with additional functionality for being owned by an ERC-721 token.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;A top-down composable contract stores and keeps track of child tokens for each of its tokens.&lt;&#x2F;p&gt;
&lt;p&gt;A bottom-up composable contract stores and keeps track of a parent token for each its tokens.&lt;&#x2F;p&gt;
&lt;p&gt;With composable tokens it is possible to compose lists or trees of ERC-721 and ERC-20 tokens connected by ownership. Any such structure will have a single owner address at the root of the structure that is the owner of the entire composition. The entire composition can be transferred with one transaction by changing the root owner.&lt;&#x2F;p&gt;
&lt;p&gt;Different composables, top-down and bottom-up, have their advantages and disadvantages which are explained in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;998&#x2F;#rationale&quot;&gt;Rational section&lt;&#x2F;a&gt;. It is possible for a token to be one or more kinds of composable token.&lt;&#x2F;p&gt;
&lt;p&gt;A non-fungible token is compliant and Composable of this EIP if it implements one or more of the following interfaces:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ERC998ERC721TopDown&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ERC998ERC20TopDown&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ERC998ERC721BottomUp&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ERC998ERC20BottomUp&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;erc-721&quot;&gt;ERC-721&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;ERC998ERC721&lt;&#x2F;code&gt; top-down, &lt;code&gt;ERC998ERC20&lt;&#x2F;code&gt; top-down, and &lt;code&gt;ERC998ERC721&lt;&#x2F;code&gt; bottom-up composable contracts must implement the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721 interface&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;erc-20&quot;&gt;ERC-20&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;ERC998ERC20&lt;&#x2F;code&gt; bottom-up composable contracts must implement the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20 interface&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;erc-165&quot;&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165 standard&lt;&#x2F;a&gt; must be applied to each &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;998&#x2F;&quot;&gt;ERC-998&lt;&#x2F;a&gt; interface that is used.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;authentication&quot;&gt;Authentication&lt;&#x2F;h3&gt;
&lt;p&gt;Authenticating whether a user or contract can execute some action works the same for both &lt;code&gt;ERC998ERC721&lt;&#x2F;code&gt; top-down and &lt;code&gt;ERC998ERC721&lt;&#x2F;code&gt; bottom-up composables.&lt;&#x2F;p&gt;
&lt;p&gt;A &lt;code&gt;rootOwner&lt;&#x2F;code&gt; refers to the owner address at the top of a tree of composables and ERC-721 tokens.&lt;&#x2F;p&gt;
&lt;p&gt;Authentication within any composable is done by finding the rootOwner and comparing it to &lt;code&gt;msg.sender&lt;&#x2F;code&gt;, the return result of &lt;code&gt;getApproved(tokenId)&lt;&#x2F;code&gt; and the return result of &lt;code&gt;isApprovedForAll(rootOwner, msg.sender)&lt;&#x2F;code&gt;. If a match is found then authentication passes, otherwise authentication fails and the contract throws.&lt;&#x2F;p&gt;
&lt;p&gt;Here is an example of authentication code:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; rootOwner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;rootOwnerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;rootOwner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  isApprovedForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;rootOwner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  getApproved&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;approve(address _approved, uint256 _tokenId)&lt;&#x2F;code&gt; and &lt;code&gt;getApproved(uint256 _tokenId)&lt;&#x2F;code&gt; ERC-721 functions are implemented specifically for the rootOwner. This enables a tree of composables to be transferred to a new rootOwner without worrying about which addresses have been approved in child composables, because any prior approves can only be used by the prior rootOwner.&lt;&#x2F;p&gt;
&lt;p&gt;Here are example implementations:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span&gt; rootOwner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;rootOwnerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;rootOwner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isApprovedForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;rootOwner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  rootOwnerAndTokenIdToApprovedAddress&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;rootOwner&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; _approved&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Approval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;rootOwner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _approved&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getApproved&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span&gt; rootOwner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;rootOwnerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  return&lt;&#x2F;span&gt;&lt;span&gt; rootOwnerAndTokenIdToApprovedAddress&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;rootOwner&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_tokenId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;traversal&quot;&gt;Traversal&lt;&#x2F;h3&gt;
&lt;p&gt;The rootOwner of a composable is gotten by calling &lt;code&gt;rootOwnerOf(uint256 _tokenId)&lt;&#x2F;code&gt; or &lt;code&gt;rootOwnerOfChild(address _childContract, uint256 _childTokenId)&lt;&#x2F;code&gt;. These functions are used by top-down and bottom-up composables to traverse up the tree of composables and ERC-721 tokens to find the rootOwner.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;ERC998ERC721&lt;&#x2F;code&gt; top-down and bottom-up composables are interoperable with each other. It is possible for a top-down composable to own a bottom-up composable or for a top-down composable to own an ERC-721 token that owns a bottom-up token. In any configuration calling &lt;code&gt;rootOwnerOf(uint256 _tokenID)&lt;&#x2F;code&gt; on a composable will return the root owner address at the top of the ownership tree.&lt;&#x2F;p&gt;
&lt;p&gt;It is important to get the traversal logic of &lt;code&gt;rootOwnerOf&lt;&#x2F;code&gt; right. The logic for &lt;code&gt;rootOwnerOf&lt;&#x2F;code&gt; is the same whether or not a composable is bottom-up or top-down or both.
Here is the logic:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Logic for rootOwnerOf(uint256 _tokenId)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;If the token is a bottom-up composable and has a parent token then call rootOwnerOf for the parent token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    If the call was successful then the returned address is the rootOwner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Otherwise call rootOwnerOfChild for the parent token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        If the call was successful then the returned address is the rootOwner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        Otherwise get the owner address of the token and that is the rootOwner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Otherwise call rootOwnerOfChild for the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    If the call was successful then the returned address is the rootOwner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Otherwise get the owner address of the token and that is the rootOwner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Calling &lt;code&gt;rootOwnerOfChild&lt;&#x2F;code&gt; for a token means the following logic:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Logic for calling rootOwnerOfChild for a tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; tokenOwner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; childContract &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt; rootOwner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC998ERC721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenOwner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;rootOwnerOfChild&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;childContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;But understand that the real call to &lt;code&gt;rootOwnerOfChild&lt;&#x2F;code&gt; should be made with assembly so that the code can check if the call failed and so that the &lt;code&gt;staticcall&lt;&#x2F;code&gt; opcode is used to ensure that no state is modified.&lt;&#x2F;p&gt;
&lt;p&gt;Tokens&#x2F;contracts that implement the above authentication and traversal functionality are &quot;composable aware&quot;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;composable-transfer-function-parameter-format&quot;&gt;Composable Transfer Function Parameter Format&lt;&#x2F;h3&gt;
&lt;p&gt;Composable functions that make transfers follow the same parameter format: &lt;strong&gt;from:to:what&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;For example the &lt;code&gt;getChild(address _from, uint256 _tokenId, address _childContract, uint256 _childTokenId)&lt;&#x2F;code&gt; composable function transfers an ERC-721 token from an address to a top-down composable. The &lt;code&gt;_from&lt;&#x2F;code&gt; parameter is the &lt;strong&gt;from&lt;&#x2F;strong&gt;, the &lt;code&gt;_tokenId&lt;&#x2F;code&gt; parameter is the &lt;strong&gt;to&lt;&#x2F;strong&gt; and the &lt;code&gt;address _childContract, uint256 _childTokenId&lt;&#x2F;code&gt; parameters are the &lt;strong&gt;what&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Another example is the &lt;code&gt;safeTransferChild(uint256 _fromTokenId, address _to, address _childContract, uint256 _childTokenId)&lt;&#x2F;code&gt; function. The &lt;code&gt;_fromTokenId&lt;&#x2F;code&gt; is the &lt;strong&gt;from&lt;&#x2F;strong&gt;, the &lt;code&gt;_to&lt;&#x2F;code&gt; is the &lt;strong&gt;to&lt;&#x2F;strong&gt; and the &lt;code&gt;address _childContract, address _childTokenId&lt;&#x2F;code&gt; parameters are the &lt;strong&gt;what&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;transferfrom-safetransferfrom-functions-do-not-transfer-tokens-owned-by-tokens&quot;&gt;transferFrom&#x2F;safeTransferFrom Functions Do Not Transfer Tokens Owned By Tokens&lt;&#x2F;h3&gt;
&lt;p&gt;In bottom-up and top-down composable contracts the &lt;code&gt;transferFrom&lt;&#x2F;code&gt; and &lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt; functions must throw if they are called directly to transfer a token that is owned by another token.&lt;&#x2F;p&gt;
&lt;p&gt;The reason for this is that these functions do not explicitly specify which token owns a token to be transferred. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;998&#x2F;#explicit-transfer-parameters&quot;&gt;See the rational section for more information about this.&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;transferFrom&#x2F;safeTransferFrom&lt;&#x2F;code&gt; functions must be used to transfer tokens that are owned by an address.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;erc-721-top-down-composable&quot;&gt;ERC-721 Top-Down Composable&lt;&#x2F;h3&gt;
&lt;p&gt;ERC-721 top-down composables act as containers for ERC-721 tokens.&lt;&#x2F;p&gt;
&lt;p&gt;ERC-721 top-down composables are ERC-721 tokens that can receive, hold and transfer ERC-721 tokens.&lt;&#x2F;p&gt;
&lt;p&gt;There are two ways to transfer a ERC-721 token to a top-down composable:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Use the &lt;code&gt;function safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes data)&lt;&#x2F;code&gt; function. The &lt;code&gt;_to&lt;&#x2F;code&gt; argument is the top-down composable contract address. The &lt;code&gt;bytes data&lt;&#x2F;code&gt; argument holds the integer value of the top-down composable tokenId that the ERC-721 token is transferred to.&lt;&#x2F;li&gt;
&lt;li&gt;Call &lt;code&gt;approve&lt;&#x2F;code&gt; in the ERC-721 token contract for the top-down composable contract. Then call &lt;code&gt;getChild&lt;&#x2F;code&gt; in the composable contract.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The first ways is for ERC-721 contracts that have a &lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt; function. The second way is for contracts that do not have this function such as cryptokitties.&lt;&#x2F;p&gt;
&lt;p&gt;Here is an example of transferring ERC-721 token 3 from an address to top-down composable token 6:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; tokenId &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 6&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; tokenIdBytes &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenIdBytes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;contractAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;safeTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;userAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; composableAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tokenIdBytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Every ERC-721 top-down composable compliant contract must implement the &lt;code&gt;ERC998ERC721TopDown&lt;&#x2F;code&gt; interface.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;ERC998ERC721TopDownEnumerable&lt;&#x2F;code&gt; and &lt;code&gt;ERC998ERC20TopDownEnumerable&lt;&#x2F;code&gt; interfaces are optional.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.4.24&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `ERC998ERC721` Top-Down Composable Non-Fungible Token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;blob&#x2F;master&#x2F;EIPS&#x2F;.&#x2F;00998.md&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;  Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0xcde244d9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC998ERC721TopDown&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when a token receives a child token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The prior owner of the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _toTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token that receives the child token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ReceivedChild&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _toTokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _childContract&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _childTokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when a child token is transferred from a token to an address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _fromTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The parent token that the child token is being transferred from.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The new owner address of the child token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransferChild&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _fromTokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _childContract&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _childTokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the root owner of tokenId.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token to query for a root owner address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; rootOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The root owner at the top of tree of tokens and ERC-998 magic value.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; rootOwnerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; rootOwner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the root owner of a child token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _childContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The contract address of the child token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _childTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The tokenId of the child.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; rootOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The root owner at the top of tree of tokens and ERC-998 magic value.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; rootOwnerOfChild&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _childContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _childTokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    public&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; rootOwner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the parent tokenId of a child token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _childContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The contract address of the child token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _childTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The tokenId of the child.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; parentTokenOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The parent address of the parent token and ERC-998 magic value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; parentTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The parent tokenId of _tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ownerOfChild&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _childContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _childTokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    view&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; parentTokenOwner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; parentTokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A token receives a child token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address that caused the transfer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The owner of the child token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _childTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token that is being transferred to the parent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Up to the first 32 bytes contains an integer which is the receiving parent tokenId.  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onERC721Received&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _childTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfer child token from top-down composable to address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _fromTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The owning token to transfer from.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address that receives the child token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _childContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ERC-721 contract of the child token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _childTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The tokenId of the token that is being transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferChild&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _fromTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _childContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _childTokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfer child token from top-down composable to address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _fromTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The owning token to transfer from.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address that receives the child token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _childContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ERC-721 contract of the child token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _childTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The tokenId of the token that is being transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeTransferChild&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _fromTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _childContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _childTokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfer child token from top-down composable to address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _fromTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The owning token to transfer from.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address that receives the child token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _childContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ERC-721 contract of the child token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _childTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The tokenId of the token that is being transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Additional data with no specified format&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeTransferChild&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _fromTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _childContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _childTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfer bottom-up composable child token from top-down composable to other ERC-721 token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _fromTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The owning token to transfer from.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _toContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ERC-721 contract of the receiving token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _toTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The receiving token  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _childContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The bottom-up composable contract of the child token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _childTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token that is being transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Additional data with no specified format&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferChildToParent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _fromTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _toContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _toTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _childContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _childTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get a child token from an ERC-721 contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address that owns the child token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token that becomes the parent owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _childContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ERC-721 contract of the child token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _childTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The tokenId of the child token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getChild&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _childContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _childTokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;rootownerof-1&quot;&gt;&lt;code&gt;rootOwnerOf&lt;&#x2F;code&gt; 1&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the root owner of tokenId.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token to query for a root owner address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; rootOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The root owner at the top of tree of tokens and ERC-998 magic value.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; rootOwnerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; rootOwner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This function traverses token owners until the root owner address of &lt;code&gt;_tokenId&lt;&#x2F;code&gt; is found.&lt;&#x2F;p&gt;
&lt;p&gt;The first 4 bytes of rootOwner contain the ERC-998 magic value &lt;code&gt;0xcd740db5&lt;&#x2F;code&gt;. The last 20 bytes contain the root owner address.&lt;&#x2F;p&gt;
&lt;p&gt;The magic value is returned because this function may be called on contracts when it is unknown if the contracts have a &lt;code&gt;rootOwnerOf&lt;&#x2F;code&gt; function. The magic value is used in such calls to ensure a valid return value is received.&lt;&#x2F;p&gt;
&lt;p&gt;If it is unknown whether a contract has the &lt;code&gt;rootOwnerOf&lt;&#x2F;code&gt; function then the first four bytes of the &lt;code&gt;rootOwner&lt;&#x2F;code&gt; return value must be compared to &lt;code&gt;0xcd740db5&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;0xcd740db5&lt;&#x2F;code&gt; is equal to:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;rootOwnerOf&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;^&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;rootOwnerOfChild&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;^&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;tokenOwnerOf&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;^&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;ownerOfChild&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Here is an example of a value returned by &lt;code&gt;rootOwnerOf&lt;&#x2F;code&gt;.
&lt;code&gt;0xcd740db50000000000000000e5240103e1ff986a2c8ae6b6728ffe0d9a395c59&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;rootownerofchild&quot;&gt;rootOwnerOfChild&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the root owner of a child token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _childContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The contract address of the child token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _childTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The tokenId of the child.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; rootOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The root owner at the top of tree of tokens and ERC-998 magic value.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; rootOwnerOfChild&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _childContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _childTokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  public&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  view&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; rootOwner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This function traverses token owners until the root owner address of the supplied child token is found.&lt;&#x2F;p&gt;
&lt;p&gt;The first 4 bytes of rootOwner contain the ERC-998 magic value &lt;code&gt;0xcd740db5&lt;&#x2F;code&gt;. The last 20 bytes contain the root owner address.&lt;&#x2F;p&gt;
&lt;p&gt;The magic value is returned because this function may be called on contracts when it is unknown if the contracts have a &lt;code&gt;rootOwnerOf&lt;&#x2F;code&gt; function. The magic value is used in such calls to ensure a valid return value is received.&lt;&#x2F;p&gt;
&lt;p&gt;If it is unknown whether a contract has the &lt;code&gt;rootOwnerOfChild&lt;&#x2F;code&gt; function then the first four bytes of the &lt;code&gt;rootOwner&lt;&#x2F;code&gt; return value must be compared to &lt;code&gt;0xcd740db5&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;ownerofchild&quot;&gt;ownerOfChild&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the parent tokenId of a child token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _childContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The contract address of the child token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _childTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The tokenId of the child.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; parentTokenOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The parent address of the parent token and ERC-998 magic value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; parentTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The parent tokenId of _tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ownerOfChild&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _childContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _childTokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  external&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  view&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; parentTokenOwner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; parentTokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This function is used to get the parent tokenId of a child token and get the owner address of the parent token.&lt;&#x2F;p&gt;
&lt;p&gt;The first 4 bytes of parentTokenOwner contain the ERC-998 magic value &lt;code&gt;0xcd740db5&lt;&#x2F;code&gt;. The last 20 bytes contain the parent token owner address.&lt;&#x2F;p&gt;
&lt;p&gt;The magic value is returned because this function may be called on contracts when it is unknown if the contracts have a &lt;code&gt;ownerOfChild&lt;&#x2F;code&gt; function. The magic value is used in such calls to ensure a valid return value is received.&lt;&#x2F;p&gt;
&lt;p&gt;If it is unknown whether a contract has the &lt;code&gt;ownerOfChild&lt;&#x2F;code&gt; function then the first four bytes of the &lt;code&gt;parentTokenOwner&lt;&#x2F;code&gt; return value must be compared to &lt;code&gt;0xcd740db5&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;onerc721received&quot;&gt;&lt;code&gt;onERC721Received&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A token receives a child token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address that caused the transfer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The prior owner of the child token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _childTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token that is being transferred to the parent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Up to the first 32 bytes contains an integer which is the receiving parent tokenId.  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onERC721Received&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _childTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  external&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This is a function defined in the ERC-721 standard. This function is called in an ERC-721 contract when &lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt; is called. The &lt;code&gt;bytes _data&lt;&#x2F;code&gt; argument contains an integer value from 1 to 32 bytes long that is the parent tokenId that an ERC-721 token is transferred to.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;onERC721Received&lt;&#x2F;code&gt; function is how a top-down composable contract is notified that an ERC-721 token has been transferred to it and what tokenId in the top-down composable is the parent tokenId.&lt;&#x2F;p&gt;
&lt;p&gt;The return value for &lt;code&gt;onERC721Received&lt;&#x2F;code&gt; is the magic value &lt;code&gt;0x150b7a02&lt;&#x2F;code&gt; which is equal to &lt;code&gt;bytes4(keccak256(abi.encodePacked(&quot;onERC721Received(address,address,uint256,bytes)&quot;)))&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;transferchild&quot;&gt;transferChild&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfer child token from top-down composable to address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _fromTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The owning token to transfer from.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address that receives the child token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _childContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ERC-721 contract of the child token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _childTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The tokenId of the token that is being transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferChild&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _fromTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _childContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _childTokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This function authenticates &lt;code&gt;msg.sender&lt;&#x2F;code&gt; and transfers a child token from a top-down composable to a different address.&lt;&#x2F;p&gt;
&lt;p&gt;This function makes this call within it:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_childContract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _childTokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;safetransferchild-1&quot;&gt;safeTransferChild 1&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfer child token from top-down composable to address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _fromTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The owning token to transfer from.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address that receives the child token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _childContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ERC-721 contract of the child token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _childTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The tokenId of the token that is being transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeTransferChild&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _fromTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _childContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _childTokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This function authenticates &lt;code&gt;msg.sender&lt;&#x2F;code&gt; and transfers a child token from a top-down composable to a different address.&lt;&#x2F;p&gt;
&lt;p&gt;This function makes this call within it:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_childContract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;safeTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _childTokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;safetransferchild-2&quot;&gt;safeTransferChild 2&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfer child token from top-down composable to address or other top-down composable.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _fromTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The owning token to transfer from.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address that receives the child token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _childContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ERC721 contract of the child token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _childTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The tokenId of the token that is being transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Additional data with no specified format, can be used to specify tokenId to transfer to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeTransferChild&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _fromTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _childContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _childTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This function authenticates &lt;code&gt;msg.sender&lt;&#x2F;code&gt; and transfers a child token from a top-down composable to a different address or to a different top-down composable.&lt;&#x2F;p&gt;
&lt;p&gt;A child token is transferred to a different top-down composable if the &lt;code&gt;_to&lt;&#x2F;code&gt; address is a top-down composable contract and &lt;code&gt;bytes _data&lt;&#x2F;code&gt; is supplied an integer representing the parent tokenId.&lt;&#x2F;p&gt;
&lt;p&gt;This function makes this call within it:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC721&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_childContract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;safeTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _childTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;transferchildtoparent&quot;&gt;transferChildToParent&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfer bottom-up composable child token from top-down composable to other ERC-721 token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _fromTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The owning token to transfer from.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _toContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ERC-721 contract of the receiving token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _toToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The receiving token  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _childContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The bottom-up composable contract of the child token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _childTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token that is being transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Additional data with no specified format&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferChildToParent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _fromTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _toContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _toTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _childContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _childTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This function authenticates &lt;code&gt;msg.sender&lt;&#x2F;code&gt; and transfers a child bottom-up composable token from a top-down composable to a different ERC-721 token. This function can only be used when the child token is a bottom-up composable token. It is designed to transfer a bottom-up composable token from a top-down composable to an ERC-721 token (bottom-up style) in one transaction.&lt;&#x2F;p&gt;
&lt;p&gt;This function makes this call within it:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC998ERC721BottomUp&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_childContract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transferToParent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  _toContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  _toTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  _childTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  _data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;getchild&quot;&gt;getChild&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get a child token from an ERC-721 contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address that owns the child token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token that becomes the parent owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _childContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ERC-721 contract of the child token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _childTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The tokenId of the child token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getChild&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _childContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _childTokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This function is used to transfer an ERC-721 token when its contract does not have a &lt;code&gt;safeTransferChild(uint256 _fromTokenId, address _to, address _childContract, uint256 _childTokenId, bytes _data)&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;p&gt;A transfer with this function is done in two steps:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The owner of the ERC-721 token calls &lt;code&gt;approve&lt;&#x2F;code&gt; or &lt;code&gt;setApprovalForAll&lt;&#x2F;code&gt; in the ERC-721 contract for the top-down composable contract.&lt;&#x2F;li&gt;
&lt;li&gt;The owner of the ERC-721 token calls &lt;code&gt;getChild&lt;&#x2F;code&gt; in the top-down composable contract for the ERC-721 token.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The &lt;code&gt;getChild&lt;&#x2F;code&gt; function must authenticate that &lt;code&gt;msg.sender&lt;&#x2F;code&gt; is the owner of the ERC-721 token in the ERC-721 contract or is approved or an operator of the ERC-721 token in the ERC-721 contract.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;erc-721-top-down-composable-enumeration&quot;&gt;ERC-721 Top-Down Composable Enumeration&lt;&#x2F;h4&gt;
&lt;p&gt;Optional interface for top-down composable enumeration:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ERC-165 identifier for this interface is 0xa344afe4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC998ERC721TopDownEnumerable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the total number of child contracts with tokens that are owned by tokenId.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The parent token of child tokens in child contracts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The total number of child contracts with tokens owned by tokenId.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalChildContracts&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get child contract by tokenId and index&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The parent token of child tokens in child contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _index&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The index position of the child contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; childContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The contract found at the tokenId and index.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; childContractByIndex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _index&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    view&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; childContract&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the total number of child tokens owned by tokenId that exist in a child contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The parent token of child tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _childContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The child contract containing the child tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The total number of child tokens found in child contract that are owned by tokenId.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalChildTokens&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _childContract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    view&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get child token owned by tokenId, in child contract, at index position&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The parent token of the child token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _childContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The child contract of the child token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _index&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The index position of the child token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; childTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The child tokenId for the parent token, child token and index&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; childTokenByIndex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _childContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _index&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    view&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; childTokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;erc-20-top-down-composable&quot;&gt;ERC-20 Top-Down Composable&lt;&#x2F;h3&gt;
&lt;p&gt;ERC-20 top-down composables act as containers for ERC-20 tokens.&lt;&#x2F;p&gt;
&lt;p&gt;ERC-20 top-down composables are ERC-721 tokens that can receive, hold and transfer ERC-20 tokens.&lt;&#x2F;p&gt;
&lt;p&gt;There are two ways to transfer ERC-20 tokens to an ERC-20 Top-Down Composable:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Use the &lt;code&gt;transfer(address _to, uint256 _value, bytes _data);&lt;&#x2F;code&gt; function from the &lt;code&gt;ERC-223&lt;&#x2F;code&gt; contract. The &lt;code&gt;_to&lt;&#x2F;code&gt; argument is the ERC-20 top-down composable contract address. The &lt;code&gt;_value&lt;&#x2F;code&gt; argument is how many ERC-20 tokens to transfer. The &lt;code&gt;bytes&lt;&#x2F;code&gt; argument holds the integer value of the top-down composable tokenId that receives the ERC-20 tokens.&lt;&#x2F;li&gt;
&lt;li&gt;Call &lt;code&gt;approve&lt;&#x2F;code&gt; in the ERC-20 contract for the ERC-20 top-down composable contract. Then call &lt;code&gt;getERC20(address _from, uint256 _tokenId, address _erc20Contract, uint256 _value)&lt;&#x2F;code&gt; from the ERC-20 top-down composable contract.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The first way is for ERC-20 contracts that support the &lt;code&gt;ERC-223&lt;&#x2F;code&gt; standard. The second way is for contracts that do not.&lt;&#x2F;p&gt;
&lt;p&gt;ERC-20 top-down composables implement the following interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `ERC998ERC20` Top-Down Composable Non-Fungible Token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;blob&#x2F;master&#x2F;EIPS&#x2F;.&#x2F;00998.md&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;  Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0x7294ffed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC998ERC20TopDown&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when a token receives ERC-20 tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The prior owner of the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _toTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token that receives the ERC-20 tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _erc20Contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ERC-20 contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The number of ERC-20 tokens received.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ReceivedERC20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _toTokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _erc20Contract&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when a token transfers ERC-20 tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token that owned the ERC-20 tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address that receives the ERC-20 tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _erc20Contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ERC-20 contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The number of ERC-20 tokens transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransferERC20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _fromTokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _erc20Contract&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A token receives ERC-20 tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The prior owner of the ERC-20 tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The number of ERC-20 tokens received&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Up to the first 32 bytes contains an integer which is the receiving tokenId.  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenFallback&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Look up the balance of ERC-20 tokens for a specific token and ERC-20 contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token that owns the ERC-20 tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _erc20Contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ERC-20 contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; number of ERC-20 tokens owned by a token from an ERC-20 contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOfERC20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _erc20Contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    view&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfer ERC-20 tokens to address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token to transfer from&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to send the ERC-20 tokens to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _erc20Contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ERC-20 contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The number of ERC-20 tokens to transfer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferERC20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _erc20Contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfer ERC-20 tokens to address or ERC-20 top-down composable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token to transfer from&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to send the ERC-20 tokens to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _erc223Contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The `ERC-223` token contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The number of ERC-20 tokens to transfer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Additional data with no specified format, can be used to specify tokenId to transfer to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferERC223&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _erc223Contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get ERC-20 tokens from ERC-20 contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The current owner address of the ERC-20 tokens that are being transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token to transfer the ERC-20 tokens to.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _erc20Contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ERC-20 token contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The number of ERC-20 tokens to transfer  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getERC20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _erc20Contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;tokenfallback&quot;&gt;tokenFallback&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A token receives ERC-20 tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The prior owner of the ERC-20 tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The number of ERC-20 tokens received&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Up to the first 32 bytes contains an integer which is the receiving tokenId.  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenFallback&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This function comes from the &lt;code&gt;ERC-223&lt;&#x2F;code&gt; which is an extension of the ERC-20 standard. This function is called on the receiving contract from the sending contract when ERC-20 tokens are transferred. This function is how the ERC-20 top-down composable contract gets notified that one of its tokens received ERC-20 tokens. Which token received ERC-20 tokens is specified in the &lt;code&gt;_data&lt;&#x2F;code&gt; parameter.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;balanceoferc20&quot;&gt;&lt;code&gt;balanceOfERC20&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Look up the balance of ERC-20 tokens for a specific token and ERC-20 contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token that owns the ERC-20 tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _erc20Contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ERC-20 contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; number of ERC-20 tokens owned by a token from an ERC-20 contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOfERC20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _erc20Contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  external&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  view&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Gets the balance of ERC-20 tokens owned by a token from a specific ERC-20 contract.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;transfererc20&quot;&gt;&lt;code&gt;transferERC20&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfer ERC-20 tokens to address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token to transfer from&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to send the ERC-20 tokens to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _erc20Contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ERC-20 contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The number of ERC-20 tokens to transfer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferERC20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _erc20Contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This is used to transfer ERC-20 tokens from a token to an address. This function calls &lt;code&gt;ERC20(_erc20Contract).transfer(_to, _value)&lt;&#x2F;code&gt;;&lt;&#x2F;p&gt;
&lt;p&gt;This function must authenticate &lt;code&gt;msg.sender&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;transfererc223&quot;&gt;&lt;code&gt;transferERC223&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfer ERC-20 tokens to address or ERC-20 top-down composable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token to transfer from&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to send the ERC-20 tokens to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _erc223Contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The `ERC-223` token contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The number of ERC-20 tokens to transfer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Additional data with no specified format, can be used to specify tokenId to transfer to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferERC223&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _erc223Contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This function is from the &lt;code&gt;ERC-223&lt;&#x2F;code&gt;. It is used to transfer ERC-20 tokens from a token to an address or to another token by putting an integer token value in the &lt;code&gt;_data&lt;&#x2F;code&gt; argument.&lt;&#x2F;p&gt;
&lt;p&gt;This function must authenticate &lt;code&gt;msg.sender&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;geterc20&quot;&gt;&lt;code&gt;getERC20&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get ERC-20 tokens from ERC-20 contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The current owner address of the ERC-20 tokens that are being transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token to transfer the ERC-20 tokens to.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _erc20Contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ERC-20 token contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The number of ERC-20 tokens to transfer  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getERC20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _erc20Contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This function is used to transfer ERC-20 tokens to an ERC-20 top-down composable when an ERC-20 contract does not have a &lt;code&gt;transferERC223(uint256 _tokenId, address _to, address _erc223Contract, uint256 _value, bytes _data)&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;p&gt;Before this function can be used the ERC-20 top-down composable contract address must be approved in the ERC-20 contract to transfer the ERC-20 tokens.&lt;&#x2F;p&gt;
&lt;p&gt;This function must authenticate that &lt;code&gt;msg.sender&lt;&#x2F;code&gt; equals &lt;code&gt;_from&lt;&#x2F;code&gt; or has been approved in the ERC-20 contract.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;erc-20-top-down-composable-enumeration&quot;&gt;ERC-20 Top-Down Composable Enumeration&lt;&#x2F;h4&gt;
&lt;p&gt;Optional interface for top-down composable enumeration:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ERC-165 identifier for this interface is 0xc5fd96cd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC998ERC20TopDownEnumerable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the number of ERC-20 contracts that token owns ERC-20 tokens from&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token that owns ERC-20 tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The number of ERC-20 contracts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalERC20Contracts&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get an ERC-20 contract that token owns ERC-20 tokens from by index&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token that owns ERC-20 tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _index&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The index position of the ERC-20 contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ERC-20 contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; erc20ContractByIndex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _index&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    view&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;erc-721-bottom-up-composable&quot;&gt;ERC-721 Bottom-Up Composable&lt;&#x2F;h3&gt;
&lt;p&gt;ERC-721 bottom-up composables are ERC-721 tokens that attach themselves to other ERC-721 tokens.&lt;&#x2F;p&gt;
&lt;p&gt;ERC-721 bottom-up composable contracts store the owning address of a token and the parent tokenId if any.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `ERC998ERC721` Bottom-Up Composable Non-Fungible Token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;blob&#x2F;master&#x2F;EIPS&#x2F;.&#x2F;00998.md&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;  Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0xa1b23002&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC998ERC721BottomUp&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when a token is transferred to an ERC-721 token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _toContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The contract the token is transferred to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _toTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token the token is transferred to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token that is transferred  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransferToParent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _toContract&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _toTokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when a token is transferred from an ERC-721 token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _fromContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The contract the token is transferred from&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _fromTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token the token is transferred from&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token that is transferred  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransferFromParent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _fromContract&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _fromTokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the root owner of tokenId.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token to query for a root owner address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; rootOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The root owner at the top of tree of tokens and ERC-998 magic value.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; rootOwnerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; rootOwner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the owner address and parent token (if there is one) of a token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The tokenId to query.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The owner address of the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; parentTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The parent owner of the token and ERC-998 magic value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; isParent&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; True if parentTokenId is a valid parent tokenId and false if there is no parent tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenOwnerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenOwner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; parentTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; isParent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfer token from owner address to a token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The owner address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _toContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ERC-721 contract of the receiving token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _toToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The receiving token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Additional data with no specified format&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferToParent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _toContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _toTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfer token from a token to an address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _fromContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the owning contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _fromTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The owning token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address the token is transferred to.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token that is transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Additional data with no specified format&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFromParent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _fromContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _fromTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfer a token from a token to another token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _fromContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the owning contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _fromTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The owning token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _toContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ERC-721 contract of the receiving token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _toToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The receiving token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token that is transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Additional data with no specified format&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferAsChild&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _fromContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _fromTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _toContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _toTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;rootownerof&quot;&gt;&lt;code&gt;rootOwnerOf&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the root owner of tokenId.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token to query for a root owner address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; rootOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The root owner at the top of tree of tokens and ERC-998 magic value.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; rootOwnerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; rootOwner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This function traverses token owners until the root owner address of &lt;code&gt;_tokenId&lt;&#x2F;code&gt; is found.&lt;&#x2F;p&gt;
&lt;p&gt;The first 4 bytes of rootOwner contain the ERC-998 magic value &lt;code&gt;0xcd740db5&lt;&#x2F;code&gt;. The last 20 bytes contain the root owner address.&lt;&#x2F;p&gt;
&lt;p&gt;The magic value is returned because this function may be called on contracts when it is unknown if the contracts have a &lt;code&gt;rootOwnerOf&lt;&#x2F;code&gt; function. The magic value is used in such calls to ensure a valid return value is received.&lt;&#x2F;p&gt;
&lt;p&gt;If it is unknown whether a contract has the &lt;code&gt;rootOwnerOf&lt;&#x2F;code&gt; function then the first four bytes of the &lt;code&gt;rootOwner&lt;&#x2F;code&gt; return value must be compared to &lt;code&gt;0xcd740db5&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;0xcd740db5&lt;&#x2F;code&gt; is equal to:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;rootOwnerOf&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;^&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;rootOwnerOfChild&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;^&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;tokenOwnerOf&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;^&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;ownerOfChild&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Here is an example of a value returned by &lt;code&gt;rootOwnerOf&lt;&#x2F;code&gt;.
&lt;code&gt;0xcd740db50000000000000000e5240103e1ff986a2c8ae6b6728ffe0d9a395c59&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;tokenownerof&quot;&gt;tokenOwnerOf&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the owner address and parent token (if there is one) of a token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The tokenId to query.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The owner address of the token and ERC-998 magic value.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; parentTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The parent owner of the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; isParent&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; True if parentTokenId is a valid parent tokenId and false if there is no parent tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenOwnerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  external&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  view&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenOwner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; parentTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; isParent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This function is used to get the owning address and parent tokenId of a token if there is one stored in the contract.&lt;&#x2F;p&gt;
&lt;p&gt;If &lt;code&gt;isParent&lt;&#x2F;code&gt; is true then &lt;code&gt;tokenOwner&lt;&#x2F;code&gt; is the owning ERC-721 contract address and &lt;code&gt;parentTokenId&lt;&#x2F;code&gt; is a valid parent tokenId. If &lt;code&gt;isParent&lt;&#x2F;code&gt; is false then &lt;code&gt;tokenOwner&lt;&#x2F;code&gt; is a user address and &lt;code&gt;parentTokenId&lt;&#x2F;code&gt; does not contain a valid parent tokenId and must be ignored.&lt;&#x2F;p&gt;
&lt;p&gt;The first 4 bytes of &lt;code&gt;tokenOwner&lt;&#x2F;code&gt; contain the ERC-998 magic value &lt;code&gt;0xcd740db5&lt;&#x2F;code&gt;. The last 20 bytes contain the token owner address.&lt;&#x2F;p&gt;
&lt;p&gt;The magic value is returned because this function may be called on contracts when it is unknown if the contracts have a &lt;code&gt;tokenOwnerOf&lt;&#x2F;code&gt; function. The magic value is used in such calls to ensure a valid return value is received.&lt;&#x2F;p&gt;
&lt;p&gt;If it is unknown whether a contract has the &lt;code&gt;rootOwnerOf&lt;&#x2F;code&gt; function then the first four bytes of the &lt;code&gt;tokenOwner&lt;&#x2F;code&gt; return value must be compared to &lt;code&gt;0xcd740db5&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;transfertoparent&quot;&gt;transferToParent&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfer token from owner address to a token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The owner address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _toContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ERC-721 contract of the receiving token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _toToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The receiving token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Additional data with no specified format&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferToParent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _toContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _toTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This function is used to transfer a token from an address to a token. &lt;code&gt;msg.sender&lt;&#x2F;code&gt; must be authenticated.&lt;&#x2F;p&gt;
&lt;p&gt;This function must check that &lt;code&gt;_toToken&lt;&#x2F;code&gt; exists in &lt;code&gt;_toContract&lt;&#x2F;code&gt; and throw if not.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;transferfromparent&quot;&gt;transferFromParent&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfer token from a token to an address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _fromContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the owning contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _fromTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The owning token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address the token is transferred to.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token that is transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Additional data with no specified format&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFromParent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _fromContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _fromTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This function is used to transfer a token from a token to an address. &lt;code&gt;msg.sender&lt;&#x2F;code&gt; must be authenticated.&lt;&#x2F;p&gt;
&lt;p&gt;This function must check that &lt;code&gt;_fromContract&lt;&#x2F;code&gt; and &lt;code&gt;_fromTokenId&lt;&#x2F;code&gt; own &lt;code&gt;_tokenId&lt;&#x2F;code&gt; and throw not.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;transferaschild&quot;&gt;transferAsChild&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfer a token from a token to another token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _fromContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the owning contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _fromTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The owning token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _toContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ERC-721 contract of the receiving token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _toToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The receiving token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token that is transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Additional data with no specified format&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferAsChild&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _fromContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _fromTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _toContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _toTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This function is used to transfer a token from a token to another token. &lt;code&gt;msg.sender&lt;&#x2F;code&gt; must be authenticated.&lt;&#x2F;p&gt;
&lt;p&gt;This function must check that &lt;code&gt;_toToken&lt;&#x2F;code&gt; exists in &lt;code&gt;_toContract&lt;&#x2F;code&gt; and throw if not.&lt;&#x2F;p&gt;
&lt;p&gt;This function must check that &lt;code&gt;_fromContract&lt;&#x2F;code&gt; and &lt;code&gt;_fromTokenId&lt;&#x2F;code&gt; own &lt;code&gt;_tokenId&lt;&#x2F;code&gt; and throw if not.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;erc-721-bottom-up-composable-enumeration&quot;&gt;ERC-721 Bottom-Up Composable Enumeration&lt;&#x2F;h4&gt;
&lt;p&gt;Optional interface for bottom-up composable enumeration:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ERC-165 identifier for this interface is 0x8318b539&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC998ERC721BottomUpEnumerable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the number of ERC-721 tokens owned by parent token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _parentContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The contract the parent ERC-721 token is from.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _parentTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The parent tokenId that owns tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  @return uint256 The number of ERC-721 tokens owned by parent token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalChildTokens&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _parentContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _parentTokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    view&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get a child token by index&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _parentContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The contract the parent ERC-721 token is from.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _parentTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The parent tokenId that owns the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _index&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The index position of the child token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The child tokenId owned by the parent token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; childTokenByIndex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _parentContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _parentTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _index&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    view&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;erc-20-bottom-up-composable&quot;&gt;ERC-20 Bottom-Up Composable&lt;&#x2F;h3&gt;
&lt;p&gt;ERC-20 bottom-up composables are ERC-20 tokens that attach themselves to ERC-721 tokens, or are owned by a user address like standard ERC-20 tokens.&lt;&#x2F;p&gt;
&lt;p&gt;When owned by an ERC-721 token, ERC-20 bottom-up composable contracts store the owning address of a token and the parent tokenId. ERC-20 bottom-up composables add several methods to the ERC-20 and &lt;code&gt;ERC-223&lt;&#x2F;code&gt; interfaces allowing for querying the balance of parent tokens, and transferring tokens to, from, and between parent tokens.&lt;&#x2F;p&gt;
&lt;p&gt;This functionality can be implemented by adding one additional mapping to track balances of tokens, in addition to the standard mapping for tracking user address balances.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This mapping tracks standard ERC20&#x2F;`ERC-223` ownership, where an address owns&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  a particular amount of tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; userBalances&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This additional mapping tracks ERC-998 ownership, where an ERC-721 token owns&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  a particular amount of tokens. This tracks contractAddres =&amp;gt; tokenId =&amp;gt; balance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; nftBalances&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The complete interface is below.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `ERC998ERC20` Bottom-Up Composable Fungible Token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;blob&#x2F;master&#x2F;EIPS&#x2F;.&#x2F;00998.md&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: The ERC-165 identifier for this interface is 0xffafa991&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC998ERC20BottomUp&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when a token is transferred to an ERC-721 token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _toContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The contract the token is transferred to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _toTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token the token is transferred to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of tokens transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransferToParent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _toContract&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _toTokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when a token is transferred from an ERC-721 token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _fromContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The contract the token is transferred from&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _fromTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token the token is transferred from&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of tokens transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransferFromParent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _fromContract&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _fromTokenId&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the balance of a non-fungible parent token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The contract tracking the parent token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ID of the parent token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The balance of the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOfToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfer tokens from owner address to a token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The owner address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _toContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ERC-721 contract of the receiving token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _toToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The receiving token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of tokens to transfer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferToParent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _toContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _toTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfer token from a token to an address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _fromContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the owning contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _fromTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The owning token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address the token is transferred to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of tokens to transfer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFromParent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _fromContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _fromTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfer token from a token to an address, using `ERC-223` semantics&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _fromContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the owning contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _fromTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The owning token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address the token is transferred to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of tokens to transfer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Additional data with no specified format, can be used to specify the sender tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFromParentERC223&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _fromContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _fromTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfer a token from a token to another token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _fromContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the owning contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _fromTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The owning token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _toContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ERC-721 contract of the receiving token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _toToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The receiving token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount tokens to transfer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferAsChild&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _fromContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _fromTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _toContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _toTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;balanceoftoken&quot;&gt;balanceOfToken&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the balance of a non-fungible parent token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The contract tracking the parent token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ID of the parent token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The balance of the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOfToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  view&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This function returns the balance of a non-fungible token. It mirrors the standard ERC-20 method &lt;code&gt;balanceOf&lt;&#x2F;code&gt;, but accepts the address of the parent token&#x27;s contract, and the parent token&#x27;s ID. This method behaves identically to &lt;code&gt;balanceOf&lt;&#x2F;code&gt;, but checks for ownership by ERC-721 tokens rather than user addresses.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;transfertoparent-1&quot;&gt;&lt;code&gt;transferToParent&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfer tokens from owner address to a token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The owner address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _toContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ERC-721 contract of the receiving token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _toToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The receiving token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of tokens to transfer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferToParent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _toContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _toTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This function transfers an amount of tokens from a user address to an ERC-721 token. This function MUST ensure that the recipient contract implements ERC-721 using the ERC-165 &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; function. This function SHOULD ensure that the recipient token actually exists, by calling &lt;code&gt;ownerOf&lt;&#x2F;code&gt; on the recipient token&#x27;s contract, and ensuring it neither throws nor returns the zero address. This function MUST emit the &lt;code&gt;TransferToParent&lt;&#x2F;code&gt; event upon a successful transfer (in addition to the standard ERC-20 &lt;code&gt;Transfer&lt;&#x2F;code&gt; event!). This function MUST throw if the &lt;code&gt;_from&lt;&#x2F;code&gt; account balance does not have enough tokens to spend.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;transferfromparent-1&quot;&gt;&lt;code&gt;transferFromParent&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfer token from a token to an address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _fromContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the owning contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _fromTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The owning token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address the token is transferred to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of tokens to transfer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFromParent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _fromContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _fromTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This function transfers an amount of tokens from an ERC-721 token to an address. This function MUST emit the &lt;code&gt;TransferFromParent&lt;&#x2F;code&gt; event upon a successful transfer (in addition to the standard ERC-20 &lt;code&gt;Transfer&lt;&#x2F;code&gt; event!). This function MUST throw if the balance of the sender ERC-721 token is less than the &lt;code&gt;_amount&lt;&#x2F;code&gt; specified. This function MUST verify that the &lt;code&gt;msg.sender&lt;&#x2F;code&gt; owns the sender ERC-721 token, and MUST throw otherwise.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;transferfromparenterc223&quot;&gt;&lt;code&gt;transferFromParentERC223&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfer token from a token to an address, using `ERC-223` semantics&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _fromContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the owning contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _fromTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The owning token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address the token is transferred to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount of tokens to transfer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Additional data with no specified format, can be used to specify the sender tokenId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFromParentERC223&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _fromContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _fromTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This function transfers an amount of tokens from an ERC-721 token to an address. This function has identical requirements to &lt;code&gt;transferFromParent&lt;&#x2F;code&gt;, except that it additionally MUST invoke &lt;code&gt;tokenFallback&lt;&#x2F;code&gt; on the recipient address, if the address is a contract, as specified by &lt;code&gt;ERC-223&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;transferaschild-1&quot;&gt;transferAsChild 1&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfer a token from a token to another token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _fromContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the owning contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _fromTokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The owning token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _toContract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ERC-721 contract of the receiving token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _toToken&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The receiving token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The amount tokens to transfer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferAsChild&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _fromContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _fromTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _toContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _toTokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This function transfers an amount of tokens from an ERC-721 token to another ERC-721 token. This function MUST emit BOTH the &lt;code&gt;TransferFromParent&lt;&#x2F;code&gt; and &lt;code&gt;TransferToParent&lt;&#x2F;code&gt; events (in addition to the standard ERC-20 &lt;code&gt;Transfer&lt;&#x2F;code&gt; event!). This function MUST throw if the balance of the sender ERC-721 token is less than the &lt;code&gt;_amount&lt;&#x2F;code&gt; specified. This function MUST verify that the &lt;code&gt;msg.sender&lt;&#x2F;code&gt; owns the sender ERC-721 token, and MUST throw otherwise. This function MUST ensure that the recipient contract implements ERC-721 using the ERC-165 &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; function. This function SHOULD ensure that the recipient token actually exists, by calling &lt;code&gt;ownerOf&lt;&#x2F;code&gt; on the recipient token&#x27;s contract, and ensuring it neither throws nor returns the zero address.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;notes&quot;&gt;Notes&lt;&#x2F;h3&gt;
&lt;p&gt;For backwards-compatibility, implementations MUST emit the standard ERC-20 &lt;code&gt;Transfer&lt;&#x2F;code&gt; event when a transfer occurs, regardless of whether the sender and recipient are addresses or ERC-721 tokens. In the case that either sender or recipient are tokens, the corresponding parameter in the &lt;code&gt;Transfer&lt;&#x2F;code&gt; event SHOULD be the contract address of the token.&lt;&#x2F;p&gt;
&lt;p&gt;Implementations MUST implement all ERC-20 and &lt;code&gt;ERC-223&lt;&#x2F;code&gt; functions in addition to the functions specified in this interface.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Two different kinds of composable (top-down and bottom-up) exist to handle different use cases. A regular ERC-721 token cannot own a top-down composable, but it can own a bottom-up composable. A bottom-up composable cannot own a regular ERC-721 but a top-down composable can own a regular ERC-721 token. Having multiple kinds of composables enable different token ownership possibilities.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;which-kind-of-composable-to-use&quot;&gt;Which Kind of Composable To Use?&lt;&#x2F;h3&gt;
&lt;p&gt;If you want to transfer regular ERC-721 tokens to non-fungible tokens, then use top-down composables.&lt;&#x2F;p&gt;
&lt;p&gt;If you want to transfer non-fungible tokens to regular ERC-721 tokens then use bottom-up composables.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;explicit-transfer-parameters&quot;&gt;Explicit Transfer Parameters&lt;&#x2F;h3&gt;
&lt;p&gt;Every ERC-998 transfer function includes explicit parameters to specify the prior owner and the new owner of a token. Explicitly providing &lt;strong&gt;from&lt;&#x2F;strong&gt; and &lt;strong&gt;to&lt;&#x2F;strong&gt; is done intentionally to avoid situations where tokens are transferred in unintended ways.&lt;&#x2F;p&gt;
&lt;p&gt;Here is an example of what could occur if &lt;strong&gt;from&lt;&#x2F;strong&gt; was not explicitly provided in transfer functions:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;An exchange contract is an approved operator in a specific composable contract for user A, user B and user C.&lt;&#x2F;p&gt;
&lt;p&gt;User A transfers token 1 to user B. At the same time the exchange contract transfers token 1 to user C (with the implicit intention to transfer from user A). User B gets token 1 for a minute before it gets incorrectly transferred to user C. The second transfer should have failed but it didn&#x27;t because no explicit &lt;strong&gt;from&lt;&#x2F;strong&gt; was provided to ensure that token 1 came from user A.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Composables are designed to work with ERC-721, &lt;code&gt;ERC-223&lt;&#x2F;code&gt; and ERC-20 tokens.&lt;&#x2F;p&gt;
&lt;p&gt;Some older ERC-721 contracts do not have a &lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt; function. The &lt;code&gt;getChild&lt;&#x2F;code&gt; function can still be used to transfer a token to an ERC-721 top-down composable.&lt;&#x2F;p&gt;
&lt;p&gt;If an ERC-20 contract does not have the &lt;code&gt;ERC-223&lt;&#x2F;code&gt; function &lt;code&gt;transfer(address _to, uint _value, bytes _data)&lt;&#x2F;code&gt; then the &lt;code&gt;getERC20&lt;&#x2F;code&gt; function can still be used to transfer ERC-20 tokens to an ERC-20 top-down composable.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;An implementation can be found here: &lt;code&gt;https:&#x2F;&#x2F;github.com&#x2F;mattlockyer&#x2F;composables-998&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>ERC-1203 Multi-Class Token Standard (ERC-20 Extension)</title>
        <published>2018-07-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Jeff Huang</name><email>jeffishjeff@gmail.com</email>
	</author>
	
	<author>
		<name>Min Zu</name><email>crawlregister@gmail.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1203/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/1203" />
        

        <id>https://wg-eips.ritovision.com/1203/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1203"
            label="ERC-1203" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1203/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;A standard interface for multi-class tokens (MCTs).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The following standard allows for the implementation of a standard API for MCTs within smart contracts. This standard provides basic functionality to track, transfer, and convert MCTs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is heavily inspired by ERC-20 Token Standard and ERC-721 Non-Fungible Token Standard. However, whereas these standards are chiefly concerned with representation of items&#x2F;value in a single class, fungible or note, this proposed standard focus on that of a more complexed, multi-class system. It is fair to think of MCTs as a hybrid of fungible tokens (FT) and non-fungible tokens (NFTs), that is tokens are fungible within the same class but non-fungible with that from a different class. And conversions between classes may be optionally supported.&lt;&#x2F;p&gt;
&lt;p&gt;MCTs are useful in representing various structures with heterogeneous components, such as:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Abstract Concepts:&lt;&#x2F;strong&gt; A company may have different classes of stocks (e.g. senior preferred, junior preferred, class A common, class B common) that together make up its outstanding equities. A shareholder&#x27;s position of such company composites of zero or more shares in each class.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Virtual Items:&lt;&#x2F;strong&gt; A sandbox computer game may have many types of resources (e.g. rock, wood, berries, cows, meat, knife, etc.) that together make up that virtual world. A player&#x27;s inventory has any combination and quantity of these resources&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Physical Items:&lt;&#x2F;strong&gt; A supermarket may have many SKUs it has available for purchase (e.g. eggs, milk, beef jerky, beer, etc.). Things get added or removed from a shopper&#x27;s cart as it moves down the aisle.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;It&#x27;s sometimes possible, especially with regard to abstract concepts or virtual items, to convert from one class to another, at a specified conversion ratio. When it comes to physical items, such conversion essentially is the implementation of bartering. Though it might generally be easier to introduce a common intermediary class, i.e. money.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC20&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; allowance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Approval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC1203&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC20&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _class&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _class&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _class&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _class&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; allowance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _class&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _class&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fullyDilutedTotalSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fullyDilutedBalanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fullyDilutedAllowance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; convert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _fromClass&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _toClass&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _class&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Approval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _class&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Convert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _fromClass&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _toClass&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;erc-20-methods-and-events-fully-compatible&quot;&gt;ERC-20 Methods and Events (fully compatible)&lt;&#x2F;h3&gt;
&lt;p&gt;Please see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20 Token Standard&lt;&#x2F;a&gt; for detailed specifications. Do note that these methods and events only work on the &quot;default&quot; class of an MCT.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; allowance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Approval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;tracking-and-transferring&quot;&gt;Tracking and Transferring&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;totalSupply&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Returns the total number of tokens in the specified &lt;code&gt;_class&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _class&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;balanceOf&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Returns the number of tokens of a specified &lt;code&gt;_class&lt;&#x2F;code&gt; that the &lt;code&gt;_owner&lt;&#x2F;code&gt; has&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _class&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;transfer&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Transfer &lt;code&gt;_value&lt;&#x2F;code&gt; tokens of &lt;code&gt;_class&lt;&#x2F;code&gt; to address specified by &lt;code&gt;_to&lt;&#x2F;code&gt;, return &lt;code&gt;true&lt;&#x2F;code&gt; if successful&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _class&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;approve&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Grant &lt;code&gt;_spender&lt;&#x2F;code&gt; the right to transfer &lt;code&gt;_value&lt;&#x2F;code&gt; tokens of &lt;code&gt;_class&lt;&#x2F;code&gt;, return &lt;code&gt;true&lt;&#x2F;code&gt; if successful&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _class&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;allowance&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Return the number of tokens of &lt;code&gt;_class&lt;&#x2F;code&gt; that &lt;code&gt;_spender&lt;&#x2F;code&gt; is authorized to transfer on the behalf of &lt;code&gt;_owner&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; allowance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _class&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;transferFrom&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Transfer &lt;code&gt;_value&lt;&#x2F;code&gt; tokens of &lt;code&gt;_class&lt;&#x2F;code&gt; from address specified by &lt;code&gt;_from&lt;&#x2F;code&gt; to address specified by &lt;code&gt;_to&lt;&#x2F;code&gt; as previously approved, return &lt;code&gt;true&lt;&#x2F;code&gt; if successful&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _class&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Transfer&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Triggered when tokens are transferred or created, including zero value transfers&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _class&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Approval&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Triggered on successful &lt;code&gt;approve&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Approval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _class&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;conversion-and-dilution&quot;&gt;Conversion and Dilution&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;fullyDilutedTotalSupply&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Return the total token supply as if all converted to the lowest common denominator class&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fullyDilutedTotalSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;fullyDilutedBalanceOf&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Return the total token owned by &lt;code&gt;_owner&lt;&#x2F;code&gt; as if all converted to the lowest common denominator class&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fullyDilutedBalanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;fullyDilutedAllowance&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Return the total token &lt;code&gt;_spender&lt;&#x2F;code&gt; is authorized to transfer on behalf of &lt;code&gt;_owner&lt;&#x2F;code&gt; as if all converted to the lowest common denominator class&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fullyDilutedAllowance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;convert&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Convert &lt;code&gt;_value&lt;&#x2F;code&gt; of &lt;code&gt;_fromClass&lt;&#x2F;code&gt; to &lt;code&gt;_toClass&lt;&#x2F;code&gt;, return &lt;code&gt;true&lt;&#x2F;code&gt; if successful&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; convert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _fromClass&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _toClass&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Conversion&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Triggered on successful &lt;code&gt;convert&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Conversion&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _fromClass&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _toClass&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This standard purposely extends ERC-20 Token Standard so that new MCTs following or existing ERC-20 tokens extending this standard are fully compatible with current wallets and exchanges. In addition, new methods and events are kept as closely to ERC-20 conventions as possible for ease of adoption.&lt;&#x2F;p&gt;
&lt;p&gt;We have considered alternative implementations to support the multi-class structure, as discussed below, and we found current token standards incapable or inefficient in deal with such structures.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Using multiple ERC-20 tokens&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;It is certainly possible to create an ERC-20 token for each class, and a separate contract to coordinate potential conversions, but the short coming in this approach is clearly evident. The rationale behind this standard is to have a single contract to manage multiple classes of tokens.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Shoehorning ERC-721 token&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Treating each token as unique, the non-fungible token standard offers maximum representational flexibility arguably at the expense of convenience. The main challenge of using ERC-721 to represent multi-class token is that separate logic is required to keep track of which tokens belongs to which class, a hacky and unnecessary endeavor.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Using ERC-1178 token&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;We came across ERC-1178 as we were putting final touches on our own proposal. The two ERCs look very similar on the surface but we believe there&#x27;re a few key advantages this one has over ERC-1178.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;ERC-1178 offers no backward compatibility whereas this proposal is an extension of ERC-20 and therefore fully compatible with all existing wallets and exchanges&lt;&#x2F;li&gt;
&lt;li&gt;By the same token, existing ERC-20 contracts can extend themselves to adopt this standard and support additional classes without affecting their current behaviors&lt;&#x2F;li&gt;
&lt;li&gt;This proposal introduces the concept of cross class conversion and dilution, making each token class integral part of a whole system rather than many silos&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is fully compatible with the mandatory methods of ERC20 Token Standard so long as the implementation includes a &quot;lowest common denominator&quot; class, which may be class B common&#x2F;gold coin&#x2F;money in the abstract&#x2F;virtual&#x2F;physical examples above respectively. Where it is not possible to implement such class, then the implementation should specify a default class for tracking or transferring unless otherwise specified, e.g. US dollar is transferred unless other currency is explicitly specified.&lt;&#x2F;p&gt;
&lt;p&gt;We find it contrived to require the optional methods of ERC20 Token Standard, &lt;code&gt;name()&lt;&#x2F;code&gt;, &lt;code&gt;symbol()&lt;&#x2F;code&gt;, and &lt;code&gt;decimals()&lt;&#x2F;code&gt;, but developers are certainly free to implement these as they wish.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;The repository at &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;jeffishjeff&#x2F;ERC-1203&quot;&gt;jeffishjeff&#x2F;ERC-1203&lt;&#x2F;a&gt; contains the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;jeffishjeff&#x2F;ERC-1203&#x2F;blob&#x2F;master&#x2F;token.test.js&quot;&gt;sample test cases&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The repository at &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;jeffishjeff&#x2F;ERC-1203&quot;&gt;jeffishjeff&#x2F;ERC-1203&lt;&#x2F;a&gt; contains the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;jeffishjeff&#x2F;ERC-1203&#x2F;blob&#x2F;master&#x2F;token.sol&quot;&gt;sample implementation&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;ERC-20 Token Standard. .&#x2F;00020.md&lt;&#x2F;li&gt;
&lt;li&gt;ERC-721 Non-Fungible Token Standard. .&#x2F;00721.md&lt;&#x2F;li&gt;
&lt;li&gt;ERC-1178 Multi-class Token Standard. .&#x2F;01178.md&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Ethereum Provider JavaScript API</title>
        <published>2018-06-30T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Fabian Vogelsteller</name><uri>https://github.com/frozeman</uri>
	</author>
	
	<author>
		<name>Ryan Ghods</name><uri>https://github.com/ryanio</uri>
	</author>
	
	<author>
		<name>Victor Maia</name><uri>https://github.com/MaiaVictor</uri>
	</author>
	
	<author>
		<name>Marc Garreau</name><uri>https://github.com/wolovim</uri>
	</author>
	
	<author>
		<name>Erik Marks</name><uri>https://github.com/rekmarks</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1193/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/2319" />
        

        <id>https://wg-eips.ritovision.com/1193/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="interface"
                label="Interface" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1193"
            label="EIP-1193" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1193/">&lt;h2 id=&quot;summary&quot;&gt;Summary&lt;&#x2F;h2&gt;
&lt;p&gt;A JavaScript Ethereum Provider API for consistency across clients and applications.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;A common convention in the Ethereum web application (&quot;dapp&quot;) ecosystem is for key management software (&quot;wallets&quot;) to expose their API via a JavaScript object in the web page.
This object is called &quot;the Provider&quot;.&lt;&#x2F;p&gt;
&lt;p&gt;Historically, Provider implementations have exhibited conflicting interfaces and behaviors between wallets.
This EIP formalizes an Ethereum Provider API to promote wallet interoperability.
The API is designed to be minimal, event-driven, and agnostic of transport and RPC protocols.
Its functionality is easily extended by defining new RPC methods and &lt;code&gt;message&lt;&#x2F;code&gt; event types.&lt;&#x2F;p&gt;
&lt;p&gt;Historically, Providers have been made available as &lt;code&gt;window.ethereum&lt;&#x2F;code&gt; in web browsers, but this convention is not part of the specification.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.ietf.org&#x2F;rfc&#x2F;rfc2119.txt&quot;&gt;RFC-2119&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Comments like this are non-normative.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;em&gt;This section is non-normative.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Provider
&lt;ul&gt;
&lt;li&gt;A JavaScript object made available to a consumer, that provides access to Ethereum by means of a Client.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Client
&lt;ul&gt;
&lt;li&gt;An endpoint that receives Remote Procedure Call (RPC) requests from the Provider, and returns their results.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Wallet
&lt;ul&gt;
&lt;li&gt;An end-user application that manages private keys, performs signing operations, and acts as a middleware between the Provider and the Client.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Remote Procedure Call (RPC)
&lt;ul&gt;
&lt;li&gt;A Remote Procedure Call (RPC), is any request submitted to a Provider for some procedure that is to be processed by a Provider, its Wallet, or its Client.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;connectivity&quot;&gt;Connectivity&lt;&#x2F;h3&gt;
&lt;p&gt;The Provider is said to be &quot;connected&quot; when it can service RPC requests to at least one chain.&lt;&#x2F;p&gt;
&lt;p&gt;The Provider is said to be &quot;disconnected&quot; when it cannot service RPC requests to any chain at all.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;To service an RPC request, the Provider must successfully submit the request to the remote location, and receive a response.
In other words, if the Provider is unable to communicate with its Client, for example due to network issues, the Provider is disconnected.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h3 id=&quot;api&quot;&gt;API&lt;&#x2F;h3&gt;
&lt;blockquote&gt;
&lt;p&gt;The Provider API is specified using TypeScript.
The authors encourage implementers to declare their own types and interfaces, using the ones in this section as a basis.&lt;&#x2F;p&gt;
&lt;p&gt;For consumer-facing API documentation, see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1193&#x2F;#appendix-i-consumer-facing-api-documentation&quot;&gt;Appendix I&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;The Provider &lt;strong&gt;MUST&lt;&#x2F;strong&gt; implement and expose the API defined in this section.
All API entities &lt;strong&gt;MUST&lt;&#x2F;strong&gt; adhere to the types and interfaces defined in this section.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;request&quot;&gt;request&lt;&#x2F;h4&gt;
&lt;blockquote&gt;
&lt;p&gt;The &lt;code&gt;request&lt;&#x2F;code&gt; method is intended as a transport- and protocol-agnostic wrapper function for Remote Procedure Calls (RPCs).&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RequestArguments&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;  readonly&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; method&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;  readonly&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; params&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; readonly&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; unknown&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; object&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Provider&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;request&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;args&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;RequestArguments&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;Promise&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;unknown&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The Provider &lt;strong&gt;MUST&lt;&#x2F;strong&gt; identify the requested RPC method by the value of &lt;code&gt;RequestArguments.method&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;If the requested RPC method takes any parameters, the Provider &lt;strong&gt;MUST&lt;&#x2F;strong&gt; accept them as the value of &lt;code&gt;RequestArguments.params&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;RPC requests &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be handled such that the returned Promise either resolves with a value per the requested RPC method&#x27;s specification, or rejects with an error.&lt;&#x2F;p&gt;
&lt;p&gt;If resolved, the Promise &lt;strong&gt;MUST&lt;&#x2F;strong&gt; resolve with a result per the RPC method&#x27;s specification. The Promise &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; resolve with any RPC protocol-specific response objects, unless the RPC method&#x27;s return type is so defined.&lt;&#x2F;p&gt;
&lt;p&gt;If the returned Promise rejects, it &lt;strong&gt;MUST&lt;&#x2F;strong&gt; reject with a &lt;code&gt;ProviderRpcError&lt;&#x2F;code&gt; as specified in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1193&#x2F;#rpc-errors&quot;&gt;RPC Errors&lt;&#x2F;a&gt; section below.&lt;&#x2F;p&gt;
&lt;p&gt;The returned Promise &lt;strong&gt;MUST&lt;&#x2F;strong&gt; reject if any of the following conditions are met:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;An error is returned for the RPC request.
&lt;ul&gt;
&lt;li&gt;If the returned error is compatible with the &lt;code&gt;ProviderRpcError&lt;&#x2F;code&gt; interface, the Promise &lt;strong&gt;MAY&lt;&#x2F;strong&gt; reject with that error directly.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The Provider encounters an error or fails to process the request for any reason.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;blockquote&gt;
&lt;p&gt;If the Provider implements any kind of authorization logic, the authors recommend rejecting with a &lt;code&gt;4100&lt;&#x2F;code&gt; error in case of authorization failures.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;The returned Promise &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; reject if any of the following conditions are met:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The Provider is disconnected.
&lt;ul&gt;
&lt;li&gt;If rejecting for this reason, the Promise rejection error &lt;code&gt;code&lt;&#x2F;code&gt; &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be &lt;code&gt;4900&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The RPC request is directed at a specific chain, and the Provider is not connected to that chain, but is connected to at least one other chain.
&lt;ul&gt;
&lt;li&gt;If rejecting for this reason, the Promise rejection error &lt;code&gt;code&lt;&#x2F;code&gt; &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be &lt;code&gt;4901&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;See the section &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1193&#x2F;#connectivity&quot;&gt;Connectivity&lt;&#x2F;a&gt; for the definitions of &quot;connected&quot; and &quot;disconnected&quot;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;supported-rpc-methods&quot;&gt;Supported RPC Methods&lt;&#x2F;h3&gt;
&lt;p&gt;A &quot;supported RPC method&quot; is any RPC method that may be called via the Provider.&lt;&#x2F;p&gt;
&lt;p&gt;All supported RPC methods &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be identified by unique strings.&lt;&#x2F;p&gt;
&lt;p&gt;Providers &lt;strong&gt;MAY&lt;&#x2F;strong&gt; support whatever RPC methods required to fulfill their purpose, standardized or otherwise.&lt;&#x2F;p&gt;
&lt;p&gt;If an RPC method defined in a finalized EIP is not supported, it &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; be rejected with a &lt;code&gt;4200&lt;&#x2F;code&gt; error per the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1193&#x2F;#provider-errors&quot;&gt;Provider Errors&lt;&#x2F;a&gt; section below, or an appropriate error per the RPC method&#x27;s specification.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;rpc-errors&quot;&gt;RPC Errors&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ProviderRpcError&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; extends&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; Error&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  code&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; number&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; unknown&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;message&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;MUST&lt;&#x2F;strong&gt; be a human-readable string&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; adhere to the specifications in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1193&#x2F;#error-standards&quot;&gt;Error Standards&lt;&#x2F;a&gt; section below&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;code&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;MUST&lt;&#x2F;strong&gt; be an integer number&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; adhere to the specifications in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1193&#x2F;#error-standards&quot;&gt;Error Standards&lt;&#x2F;a&gt; section below&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;data&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; contain any other useful information about the error&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;error-standards&quot;&gt;Error Standards&lt;&#x2F;h5&gt;
&lt;p&gt;&lt;code&gt;ProviderRpcError&lt;&#x2F;code&gt; codes and messages &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; follow these conventions, in order of priority:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;The errors in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1193&#x2F;#provider-errors&quot;&gt;Provider Errors&lt;&#x2F;a&gt; section below&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Any errors mandated by the erroring RPC method&#x27;s specification&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;developer.mozilla.org&#x2F;en-US&#x2F;docs&#x2F;Web&#x2F;API&#x2F;CloseEvent#Status_codes&quot;&gt;&lt;code&gt;CloseEvent&lt;&#x2F;code&gt; status codes&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h4 id=&quot;provider-errors&quot;&gt;Provider Errors&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Status code&lt;&#x2F;th&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;4001&lt;&#x2F;td&gt;&lt;td&gt;User Rejected Request&lt;&#x2F;td&gt;&lt;td&gt;The user rejected the request.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;4100&lt;&#x2F;td&gt;&lt;td&gt;Unauthorized&lt;&#x2F;td&gt;&lt;td&gt;The requested method and&#x2F;or account has not been authorized by the user.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;4200&lt;&#x2F;td&gt;&lt;td&gt;Unsupported Method&lt;&#x2F;td&gt;&lt;td&gt;The Provider does not support the requested method.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;4900&lt;&#x2F;td&gt;&lt;td&gt;Disconnected&lt;&#x2F;td&gt;&lt;td&gt;The Provider is disconnected from all chains.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;4901&lt;&#x2F;td&gt;&lt;td&gt;Chain Disconnected&lt;&#x2F;td&gt;&lt;td&gt;The Provider is not connected to the requested chain.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;4900&lt;&#x2F;code&gt; is intended to indicate that the Provider is disconnected from all chains, while &lt;code&gt;4901&lt;&#x2F;code&gt; is intended to indicate that the Provider is disconnected from a specific chain only.
In other words, &lt;code&gt;4901&lt;&#x2F;code&gt; implies that the Provider is connected to other chains, just not the requested one.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h3 id=&quot;events&quot;&gt;Events&lt;&#x2F;h3&gt;
&lt;p&gt;The Provider &lt;strong&gt;MUST&lt;&#x2F;strong&gt; implement the following event handling methods:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;on&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;removeListener&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;These methods &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be implemented per the Node.js &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;nodejs.org&#x2F;api&#x2F;events.html&quot;&gt;&lt;code&gt;EventEmitter&lt;&#x2F;code&gt; API&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;To satisfy these requirements, Provider implementers should consider simply extending the Node.js &lt;code&gt;EventEmitter&lt;&#x2F;code&gt; class and bundling it for the target environment.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h4 id=&quot;message&quot;&gt;message&lt;&#x2F;h4&gt;
&lt;blockquote&gt;
&lt;p&gt;The &lt;code&gt;message&lt;&#x2F;code&gt; event is intended for arbitrary notifications not covered by other events.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;When emitted, the &lt;code&gt;message&lt;&#x2F;code&gt; event &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be emitted with an object argument of the following form:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ProviderMessage&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;  readonly&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;  readonly&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; unknown&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;subscriptions&quot;&gt;Subscriptions&lt;&#x2F;h5&gt;
&lt;p&gt;If the Provider supports Ethereum RPC subscriptions, e.g. &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;geth.ethereum.org&#x2F;docs&#x2F;rpc&#x2F;pubsub&quot;&gt;&lt;code&gt;eth_subscribe&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;, the Provider &lt;strong&gt;MUST&lt;&#x2F;strong&gt; emit the &lt;code&gt;message&lt;&#x2F;code&gt; event when it receives a subscription notification.&lt;&#x2F;p&gt;
&lt;p&gt;If the Provider receives a subscription message from e.g. an &lt;code&gt;eth_subscribe&lt;&#x2F;code&gt; subscription, the Provider &lt;strong&gt;MUST&lt;&#x2F;strong&gt; emit a &lt;code&gt;message&lt;&#x2F;code&gt; event with a &lt;code&gt;ProviderMessage&lt;&#x2F;code&gt; object of the following form:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EthSubscription&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; extends&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; ProviderMessage&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;  readonly&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_subscription&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;  readonly&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;    readonly&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; subscription&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;    readonly&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; result&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; unknown&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;connect&quot;&gt;connect&lt;&#x2F;h4&gt;
&lt;p&gt;See the section &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1193&#x2F;#connectivity&quot;&gt;Connectivity&lt;&#x2F;a&gt; for the definition of &quot;connected&quot;.&lt;&#x2F;p&gt;
&lt;p&gt;If the Provider becomes connected, the Provider &lt;strong&gt;MUST&lt;&#x2F;strong&gt; emit the event named &lt;code&gt;connect&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This includes when:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The Provider first connects to a chain after initialization.&lt;&#x2F;li&gt;
&lt;li&gt;The Provider connects to a chain after the &lt;code&gt;disconnect&lt;&#x2F;code&gt; event was emitted.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This event &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be emitted with an object of the following form:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ProviderConnectInfo&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;  readonly&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;chainId&lt;&#x2F;code&gt; &lt;strong&gt;MUST&lt;&#x2F;strong&gt; specify the integer ID of the connected chain as a hexadecimal string, per the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;695&#x2F;&quot;&gt;&lt;code&gt;eth_chainId&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; Ethereum RPC method.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;disconnect&quot;&gt;disconnect&lt;&#x2F;h4&gt;
&lt;p&gt;See the section &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1193&#x2F;#connectivity&quot;&gt;Connectivity&lt;&#x2F;a&gt; for the definition of &quot;disconnected&quot;.&lt;&#x2F;p&gt;
&lt;p&gt;If the Provider becomes disconnected from all chains, the Provider &lt;strong&gt;MUST&lt;&#x2F;strong&gt; emit the event named &lt;code&gt;disconnect&lt;&#x2F;code&gt; with value &lt;code&gt;error: ProviderRpcError&lt;&#x2F;code&gt;, per the interfaced defined in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1193&#x2F;#rpc-errors&quot;&gt;RPC Errors&lt;&#x2F;a&gt; section. The value of the error&#x27;s &lt;code&gt;code&lt;&#x2F;code&gt; property &lt;strong&gt;MUST&lt;&#x2F;strong&gt; follow the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;developer.mozilla.org&#x2F;en-US&#x2F;docs&#x2F;Web&#x2F;API&#x2F;CloseEvent#Status_codes&quot;&gt;status codes for &lt;code&gt;CloseEvent&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;chainchanged&quot;&gt;chainChanged&lt;&#x2F;h4&gt;
&lt;p&gt;If the chain the Provider is connected to changes, the Provider &lt;strong&gt;MUST&lt;&#x2F;strong&gt; emit the event named &lt;code&gt;chainChanged&lt;&#x2F;code&gt; with value &lt;code&gt;chainId: string&lt;&#x2F;code&gt;, specifying the integer ID of the new chain as a hexadecimal string, per the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;695&#x2F;&quot;&gt;&lt;code&gt;eth_chainId&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; Ethereum RPC method.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;accountschanged&quot;&gt;accountsChanged&lt;&#x2F;h4&gt;
&lt;p&gt;If the accounts available to the Provider change, the Provider &lt;strong&gt;MUST&lt;&#x2F;strong&gt; emit the event named &lt;code&gt;accountsChanged&lt;&#x2F;code&gt; with value &lt;code&gt;accounts: string[]&lt;&#x2F;code&gt;, containing the account addresses per the &lt;code&gt;eth_accounts&lt;&#x2F;code&gt; Ethereum RPC method.&lt;&#x2F;p&gt;
&lt;p&gt;The &quot;accounts available to the Provider&quot; change when the return value of &lt;code&gt;eth_accounts&lt;&#x2F;code&gt; changes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The purpose of a Provider is to &lt;em&gt;provide&lt;&#x2F;em&gt; a consumer with access to Ethereum.
In general, a Provider must enable an Ethereum web application to do two things:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Make Ethereum RPC requests&lt;&#x2F;li&gt;
&lt;li&gt;Respond to state changes in the Provider&#x27;s Ethereum chain, Client, and Wallet&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The Provider API specification consists of a single method and five events.
The &lt;code&gt;request&lt;&#x2F;code&gt; method and the &lt;code&gt;message&lt;&#x2F;code&gt; event alone, are sufficient to implement a complete Provider.
They are designed to make arbitrary RPC requests and communicate arbitrary messages, respectively.&lt;&#x2F;p&gt;
&lt;p&gt;The remaining four events can be separated into two categories:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Changes to the Provider&#x27;s ability to make RPC requests
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;connect&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;disconnect&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Common Client and&#x2F;or Wallet state changes that any non-trivial application must handle
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;chainChanged&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;accountsChanged&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;These events are included due to the widespread production usage of related patterns, at the time of writing.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Many Providers adopted a draft version of this specification before it was finalized.
The current API is designed to be a strict superset of the legacy version, and this specification is in that sense fully backwards compatible.
See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1193&#x2F;#appendix-iii-legacy-provider-api&quot;&gt;Appendix III&lt;&#x2F;a&gt; for the legacy API.&lt;&#x2F;p&gt;
&lt;p&gt;Providers that only implement this specification will not be compatible with Ethereum web applications that target the legacy API.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementations&quot;&gt;Implementations&lt;&#x2F;h2&gt;
&lt;p&gt;At the time of writing, the following projects have working implementations:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;nomiclabs&#x2F;buidler&#x2F;pull&#x2F;608&quot;&gt;buidler.dev&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethers-io&#x2F;ethers.js&#x2F;blob&#x2F;56af4413b1dd1787db68985e0b612b63d86fdf7c&#x2F;packages&#x2F;providers&#x2F;src.ts&#x2F;web3-provider.ts&quot;&gt;ethers.js&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.npmjs.com&#x2F;package&#x2F;eth-provider&quot;&gt;eth-provider&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;MetaMask&#x2F;inpage-provider&quot;&gt;MetaMask&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;WalletConnect&#x2F;walletconnect-monorepo&#x2F;blob&#x2F;d33fd2070d7a67f74de50fd10ca4217f4e2f22f3&#x2F;packages&#x2F;providers&#x2F;web3-provider&#x2F;README.md&quot;&gt;WalletConnect&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;web3js.readthedocs.io&#x2F;&quot;&gt;web3.js&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The Provider is intended to pass messages between an Ethereum Client and an Ethereum application.
It is &lt;em&gt;not&lt;&#x2F;em&gt; responsible for private key or account management; it merely processes RPC messages and emits events.
Consequently, account security and user privacy need to be implemented in middlewares between the Provider and its Ethereum Client.
In practice, we call these middleware applications &quot;Wallets,&quot; and they usually manage the user&#x27;s private keys and accounts.
The Provider can be thought of as an extension of the Wallet, exposed in an untrusted environment, under the control of some third party (e.g. a website).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;handling-adversarial-behavior&quot;&gt;Handling Adversarial Behavior&lt;&#x2F;h3&gt;
&lt;p&gt;Since it is a JavaScript object, consumers can generally perform arbitrary operations on the Provider, and all its properties can be read or overwritten.
Therefore, it is best to treat the Provider object as though it is controlled by an adversary.
It is paramount that the Provider implementer protects the user, Wallet, and Client by ensuring that:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The Provider does not contain any private user data.&lt;&#x2F;li&gt;
&lt;li&gt;The Provider and Wallet programs are isolated from each other.&lt;&#x2F;li&gt;
&lt;li&gt;The Wallet and&#x2F;or Client rate-limit requests from the Provider.&lt;&#x2F;li&gt;
&lt;li&gt;The Wallet and&#x2F;or Client validate all data sent from the Provider.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;chain-changes&quot;&gt;Chain Changes&lt;&#x2F;h3&gt;
&lt;p&gt;Since all Ethereum operations are directed at a particular chain, it&#x27;s important that the Provider accurately reflects the Client&#x27;s configured chain, per the &lt;code&gt;eth_chainId&lt;&#x2F;code&gt; Ethereum RPC method (see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;695&#x2F;&quot;&gt;EIP-695&lt;&#x2F;a&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;This includes ensuring that &lt;code&gt;eth_chainId&lt;&#x2F;code&gt; has the correct return value, and that the &lt;code&gt;chainChanged&lt;&#x2F;code&gt; event is emitted whenever that value changes.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;user-account-exposure-and-account-changes&quot;&gt;User Account Exposure and Account Changes&lt;&#x2F;h3&gt;
&lt;p&gt;Many Ethereum write operations (e.g. &lt;code&gt;eth_sendTransaction&lt;&#x2F;code&gt;) require a user account to be specified.
Provider consumers access these accounts via the &lt;code&gt;eth_accounts&lt;&#x2F;code&gt; RPC method, and by listening for the &lt;code&gt;accountsChanged&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;p&gt;As with &lt;code&gt;eth_chainId&lt;&#x2F;code&gt;, it is critical that &lt;code&gt;eth_accounts&lt;&#x2F;code&gt; has the correct return value, and that the &lt;code&gt;accountsChanged&lt;&#x2F;code&gt; event is emitted whenever that value changes.&lt;&#x2F;p&gt;
&lt;p&gt;The return value of &lt;code&gt;eth_accounts&lt;&#x2F;code&gt; is ultimately controlled by the Wallet or Client.
In order to protect user privacy, the authors recommend not exposing any accounts by default.
Instead, Providers should support RPC methods for explicitly requesting account access, such as &lt;code&gt;eth_requestAccounts&lt;&#x2F;code&gt; (see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1102&#x2F;&quot;&gt;EIP-1102&lt;&#x2F;a&gt;) or &lt;code&gt;wallet_requestPermissions&lt;&#x2F;code&gt; (see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2255&#x2F;&quot;&gt;EIP-2255&lt;&#x2F;a&gt;).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;interfaces&#x2F;issues&#x2F;16&quot;&gt;Initial discussion in &lt;code&gt;ethereum&#x2F;interfaces&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum-magicians.org&#x2F;t&#x2F;eip-1193-ethereum-provider-javascript-api&#x2F;640&quot;&gt;Deprecated Ethereum Magicians thread&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;2319&quot;&gt;Continuing discussion&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Related EIPs
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1102&#x2F;&quot;&gt;EIP-1102: Opt-in Account Exposure&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;&quot;&gt;EIP-1474: Remote Procedure Call Specification&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1767&#x2F;&quot;&gt;EIP-1767: GraphQL Interface to Ethereum Node Data&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2255&#x2F;&quot;&gt;EIP-2255: Wallet Permissions&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;appendix-i-consumer-facing-api-documentation&quot;&gt;Appendix I: Consumer-Facing API Documentation&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;request-1&quot;&gt;request&lt;&#x2F;h3&gt;
&lt;p&gt;Makes an Ethereum RPC method call.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RequestArguments&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;  readonly&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; method&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;  readonly&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; params&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; readonly&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; unknown&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; object&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Provider&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;request&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;args&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;RequestArguments&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;Promise&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;unknown&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The returned Promise resolves with the method&#x27;s result or rejects with a &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1193&#x2F;#errors&quot;&gt;&lt;code&gt;ProviderRpcError&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;. For example:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Provider&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;request&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt; method&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_accounts&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  .&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;then&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;accounts&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; console&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;log&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;accounts&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  .&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;catch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;error&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; console&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;error&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;error&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Consult each Ethereum RPC method&#x27;s documentation for its &lt;code&gt;params&lt;&#x2F;code&gt; and return type.
You can find a list of common methods &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;rpc-protocols&quot;&gt;RPC Protocols&lt;&#x2F;h4&gt;
&lt;p&gt;Multiple RPC protocols may be available. For examples, see:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;&quot;&gt;EIP-1474&lt;&#x2F;a&gt;, the Ethereum JSON-RPC API&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1767&#x2F;&quot;&gt;EIP-1767&lt;&#x2F;a&gt;, the Ethereum GraphQL schema&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;events-1&quot;&gt;Events&lt;&#x2F;h3&gt;
&lt;p&gt;Events follow the conventions of the Node.js &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;nodejs.org&#x2F;api&#x2F;events.html&quot;&gt;&lt;code&gt;EventEmitter&lt;&#x2F;code&gt; API&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;connect-1&quot;&gt;connect&lt;&#x2F;h4&gt;
&lt;p&gt;The Provider emits &lt;code&gt;connect&lt;&#x2F;code&gt; when it:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;first connects to a chain after being initialized.&lt;&#x2F;li&gt;
&lt;li&gt;first connects to a chain, after the &lt;code&gt;disconnect&lt;&#x2F;code&gt; event was emitted.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ProviderConnectInfo&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;  readonly&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Provider&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;on&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;connect&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; listener&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;connectInfo&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ProviderConnectInfo&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; void&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Provider&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The event emits an object with a hexadecimal string &lt;code&gt;chainId&lt;&#x2F;code&gt; per the &lt;code&gt;eth_chainId&lt;&#x2F;code&gt; Ethereum RPC method, and other properties as determined by the Provider.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;disconnect-1&quot;&gt;disconnect&lt;&#x2F;h4&gt;
&lt;p&gt;The Provider emits &lt;code&gt;disconnect&lt;&#x2F;code&gt; when it becomes disconnected from all chains.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Provider&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;on&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;disconnect&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; listener&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ProviderRpcError&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; void&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Provider&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This event emits a &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1193&#x2F;#errors&quot;&gt;&lt;code&gt;ProviderRpcError&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;. The error &lt;code&gt;code&lt;&#x2F;code&gt; follows the table of &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;developer.mozilla.org&#x2F;en-US&#x2F;docs&#x2F;Web&#x2F;API&#x2F;CloseEvent#Status_codes&quot;&gt;&lt;code&gt;CloseEvent&lt;&#x2F;code&gt; status codes&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;chainchanged-1&quot;&gt;chainChanged&lt;&#x2F;h4&gt;
&lt;p&gt;The Provider emits &lt;code&gt;chainChanged&lt;&#x2F;code&gt; when connecting to a new chain.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Provider&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;on&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;chainChanged&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; listener&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; void&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Provider&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The event emits a hexadecimal string &lt;code&gt;chainId&lt;&#x2F;code&gt; per the &lt;code&gt;eth_chainId&lt;&#x2F;code&gt; Ethereum RPC method.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;accountschanged-1&quot;&gt;accountsChanged&lt;&#x2F;h4&gt;
&lt;p&gt;The Provider emits &lt;code&gt;accountsChanged&lt;&#x2F;code&gt; if the accounts returned from the Provider (&lt;code&gt;eth_accounts&lt;&#x2F;code&gt;) change.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Provider&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;on&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;accountsChanged&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; listener&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;accounts&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; void&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Provider&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The event emits with &lt;code&gt;accounts&lt;&#x2F;code&gt;, an array of account addresses, per the &lt;code&gt;eth_accounts&lt;&#x2F;code&gt; Ethereum RPC method.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;message-1&quot;&gt;message&lt;&#x2F;h4&gt;
&lt;p&gt;The Provider emits &lt;code&gt;message&lt;&#x2F;code&gt; to communicate arbitrary messages to the consumer.
Messages may include JSON-RPC notifications, GraphQL subscriptions, and&#x2F;or any other event as defined by the Provider.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ProviderMessage&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;  readonly&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;  readonly&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; unknown&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Provider&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;on&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;message&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; listener&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;message&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ProviderMessage&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; void&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Provider&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;subscriptions-1&quot;&gt;Subscriptions&lt;&#x2F;h5&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;geth.ethereum.org&#x2F;docs&#x2F;rpc&#x2F;pubsub&quot;&gt;&lt;code&gt;eth_&lt;&#x2F;code&gt; subscription methods&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;go-ethereum&#x2F;wiki&#x2F;Whisper-v6-RPC-API#shh_subscribe&quot;&gt;&lt;code&gt;shh_&lt;&#x2F;code&gt; subscription methods&lt;&#x2F;a&gt; rely on this event to emit subscription updates.&lt;&#x2F;p&gt;
&lt;p&gt;For e.g. &lt;code&gt;eth_subscribe&lt;&#x2F;code&gt; subscription updates, &lt;code&gt;ProviderMessage.type&lt;&#x2F;code&gt; will equal the string &lt;code&gt;&#x27;eth_subscription&#x27;&lt;&#x2F;code&gt;, and the subscription data will be the value of &lt;code&gt;ProviderMessage.data&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;errors&quot;&gt;Errors&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ProviderRpcError&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; extends&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; Error&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  message&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  code&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; number&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; unknown&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;appendix-ii-examples&quot;&gt;Appendix II: Examples&lt;&#x2F;h2&gt;
&lt;p&gt;These examples assume a web browser environment.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Most Providers are available as window.ethereum on page load.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This is only a convention, not a standard, and may not be the case in practice.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Please consult the Provider implementation&amp;#39;s documentation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; ethereum&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; window&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;ethereum&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Example 1: Log chainId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;ethereum&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  .&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;request&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt; method&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  .&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;then&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    console&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;log&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;hexadecimal string: &lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    console&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;log&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;decimal number: &lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;parseInt&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;chainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 16&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  .&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;catch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;error&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    console&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;error&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Error fetching chainId: &lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;code&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;message&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Example 2: Log last block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;ethereum&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  .&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;request&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    method&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_getBlockByNumber&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    params&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;latest&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  .&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;then&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    console&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;log&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Block &lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;block&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  .&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;catch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;error&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    console&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;error&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Error fetching last block: &lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;message&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;       Code: &lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;code&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;. Data: &lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Example 3: Log available accounts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;ethereum&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  .&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;request&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt; method&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_accounts&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  .&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;then&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;accounts&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    console&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;log&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Accounts:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;accounts&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;join&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  .&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;catch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;error&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    console&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;error&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Error fetching accounts: &lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;message&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;       Code: &lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;code&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;. Data: &lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Example 4: Log new blocks&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;ethereum&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  .&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;request&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    method&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_subscribe&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    params&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;newHeads&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  .&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;then&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;subscriptionId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    ethereum&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;on&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;message&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;message&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;message&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ===&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_subscription&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        const&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; message&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;subscription&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ===&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; subscriptionId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;          if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; typeof&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ===&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; block&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;result&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;            console&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;log&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;New block &lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;block&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;            console&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;error&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Something went wrong: &lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  .&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;catch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;error&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    console&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;error&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Error making newHeads subscription: &lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;message&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;       Code: &lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;code&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;. Data: &lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Example 5: Log when accounts change&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; logAccounts&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;accounts&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  console&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;log&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Accounts:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;accounts&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;join&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;ethereum&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;on&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;accountsChanged&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; logAccounts&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; to unsubscribe&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;ethereum&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;removeListener&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;accountsChanged&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; logAccounts&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Example 6: Log if connection ends&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;ethereum&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;on&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;disconnect&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;code&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; reason&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  console&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;log&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Ethereum Provider connection closed: &lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;reason&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;. Code: &lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;code&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;appendix-iii-legacy-provider-api&quot;&gt;Appendix III: Legacy Provider API&lt;&#x2F;h2&gt;
&lt;p&gt;This section documents the legacy Provider API, which is extensively used in production at the time of writing.
As it was never fully standardized, significant deviations occur in practice.
The authors recommend against implementing it except to support legacy Ethereum applications.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;sendasync-deprecated&quot;&gt;sendAsync (DEPRECATED)&lt;&#x2F;h3&gt;
&lt;p&gt;This method is superseded by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1193&#x2F;#request&quot;&gt;&lt;code&gt;request&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;sendAsync&lt;&#x2F;code&gt; is like &lt;code&gt;request&lt;&#x2F;code&gt;, but with JSON-RPC objects and a callback.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Provider&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;sendAsync&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;request&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Object&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; callback&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Function&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;void&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Historically, the request and response object interfaces have followed the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1474&#x2F;&quot;&gt;Ethereum JSON-RPC specification&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;send-deprecated&quot;&gt;send (DEPRECATED)&lt;&#x2F;h3&gt;
&lt;p&gt;This method is superseded by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1193&#x2F;#request&quot;&gt;&lt;code&gt;request&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Provider&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;send&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;...&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;args&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;unknown&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;unknown&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;legacy-events&quot;&gt;Legacy Events&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;close-deprecated&quot;&gt;close (DEPRECATED)&lt;&#x2F;h4&gt;
&lt;p&gt;This event is superseded by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1193&#x2F;#disconnect&quot;&gt;&lt;code&gt;disconnect&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;networkchanged-deprecated&quot;&gt;networkChanged (DEPRECATED)&lt;&#x2F;h4&gt;
&lt;p&gt;The event &lt;code&gt;networkChanged&lt;&#x2F;code&gt; is superseded by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1193&#x2F;#chainchanged&quot;&gt;&lt;code&gt;chainChanged&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;For details, see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155: Simple replay attack protection&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;695&#x2F;&quot;&gt;EIP-695: Create eth_chainId method for JSON-RPC&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;notification-deprecated&quot;&gt;notification (DEPRECATED)&lt;&#x2F;h4&gt;
&lt;p&gt;This event is superseded by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1193&#x2F;#message&quot;&gt;&lt;code&gt;message&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Historically, this event has been emitted with e.g. &lt;code&gt;eth_subscribe&lt;&#x2F;code&gt; subscription updates of the form &lt;code&gt;{ subscription: string, result: unknown }&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Storage of DNS Records in ENS</title>
        <published>2018-06-26T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Jim McDonald</name><uri>https://github.com/mcdee</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1185/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip1185-dns-resolver-profile-for-ens/1589" />
        

        <id>https://wg-eips.ritovision.com/1185/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:1185"
            label="ERC-1185" />
        

        
        

        
        <summary type="html">A system to store and retrieve DNS records within the ENS contract.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1185/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP defines a resolver profile for ENS that provides features for storage and lookup of DNS records. This allows ENS to be used as a store of authoritative DNS information.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;ENS is a highly desirable store for DNS information.  It provides the distributed authority of DNS without conflating ownership and authoritative serving of information.  With ENS, the owner of a domain has full control over their own DNS records.  Also, ENS has the ability (through smart contracts) for a domain&#x27;s subdomains to be irrevocably assigned to another entity.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The resolver profile to support DNS on ENS follows the resolver specification as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;137&#x2F;&quot;&gt;ERC-137&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Traditionally, DNS is a zone-based system in that all of the records for a zone are kept together in the same file.  This has the benefit of simplicity and atomicity of zone updates, but when transposed to ENS can result in significant gas costs for simple changes.  As a result, the resolver works on the basis of record sets.  A record set is uniquely defined by the tuple &lt;code&gt;(domain, name, resource record type)&lt;&#x2F;code&gt;, for example the tuple &lt;code&gt;(example.com, www.example.com, A)&lt;&#x2F;code&gt; defines the record set of &lt;code&gt;A&lt;&#x2F;code&gt; records for the name &lt;code&gt;www.example.com&lt;&#x2F;code&gt; in the domain &lt;code&gt;example.com&lt;&#x2F;code&gt;.  A record set can contain 0 or more values, for example if &lt;code&gt;www.example.com&lt;&#x2F;code&gt; has &lt;code&gt;A&lt;&#x2F;code&gt; records &lt;code&gt;1.2.3.4&lt;&#x2F;code&gt; and &lt;code&gt;5.6.7.8&lt;&#x2F;code&gt; then the aforementioned tuple will have two values.&lt;&#x2F;p&gt;
&lt;p&gt;The choice to work at the level of record sets rather than zones means that this specification cannot completely support some features of DNS, such as zone transfers and DNSSEC.  It would be possible to build a different resolver profile that works at the zone level, however it would be very expensive to carry out updates and so is not considered further for this EIP.&lt;&#x2F;p&gt;
&lt;p&gt;The DNS resolver interface consists of two functions to set DNS information and two functions to query DNS information.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;setdnsrecords-bytes32-node-bytes-data&quot;&gt;setDNSRecords(bytes32 node, bytes data)&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;setDNSRecords()&lt;&#x2F;code&gt; sets, updates or clears 1 or more DNS records for a given node.  It has function signature &lt;code&gt;0x0af179d7&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The arguments for the function are as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;node: the namehash of the fully-qualified domain in ENS for which to set the records.  Namehashes are defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;137&#x2F;&quot;&gt;ERC-137&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;data: 1 or more DNS records in DNS wire format.  Any record that is supplied without a value will be cleared.  Note that all records in the same RRset should be contiguous within the data; if not then the later RRsets will overwrite the earlier one(s)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;cleardnszone-bytes32-node&quot;&gt;clearDNSZone(bytes32 node)&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;clearDNSZone()&lt;&#x2F;code&gt; removes all DNS records for the domain.  It has function signature &lt;code&gt;0xad5780af&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Although it is possible to clear records individually with &lt;code&gt;setDNSRecords()&lt;&#x2F;code&gt; as described above this requires the owner to know all of the records that have been set (as the resolver has no methods to iterate over the records for a given domain), and might require multiple transactions.  &lt;code&gt;clearDNSZone()&lt;&#x2F;code&gt; removes all zone information in a single operation.&lt;&#x2F;p&gt;
&lt;p&gt;The arguments for the function is as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;node: the namehash of the fully-qualified domain in ENS for which to clear the records.  Namehashes are defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;137&#x2F;&quot;&gt;ERC-137&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;dnsrecords-bytes32-node-bytes32-name-uint16-resource-view-returns-bytes&quot;&gt;dnsRecords(bytes32 node, bytes32 name, uint16 resource) view returns (bytes)&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;dnsRecords()&lt;&#x2F;code&gt; obtains the DNS records for a given node, name and resource.  It has function signature &lt;code&gt;0x2461e851&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The arguments for the function are as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;node: the namehash of the fully-qualified domain in ENS for which to set the records.  Namehashes are defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;137&#x2F;&quot;&gt;ERC-137&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;name: the &lt;code&gt;keccak256()&lt;&#x2F;code&gt; hash of the name of the record in DNS wire format.&lt;&#x2F;li&gt;
&lt;li&gt;resource: the resource record ID.  Resource record IDs are defined in RFC1035 and subsequent RFCs.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The function returns all matching records in DNS wire format.  If there are no records present the function will return nothing.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;hasdnsrecords-bytes32-node-bytes32-name-view-returns-bool&quot;&gt;hasDNSRecords(bytes32 node, bytes32 name) view returns (bool)&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;hasDNSRecords()&lt;&#x2F;code&gt; reports if there are any records for the provided name in the domain.  It has function signature &lt;code&gt;0x4cbf6ba4&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This function is needed by DNS resolvers when working with wildcard resources as defined in RFC4592.&lt;&#x2F;p&gt;
&lt;p&gt;The arguments for the function are as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;node: the namehash of the fully-qualified domain in ENS for which to set the records.  Namehashes are defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;137&#x2F;&quot;&gt;ERC-137&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;name: the &lt;code&gt;keccak256()&lt;&#x2F;code&gt; hash of the name of the record in DNS wire format.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The function returns &lt;code&gt;true&lt;&#x2F;code&gt; if there are any records for the provided node and name, otherwise &lt;code&gt;false&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;DNS is a federated system of naming, and the higher-level entities control availability of everything beneath them (&lt;em&gt;e.g.&lt;&#x2F;em&gt; &lt;code&gt;.org&lt;&#x2F;code&gt; controls the availability of &lt;code&gt;ethereum.org&lt;&#x2F;code&gt;).  A decentralized version of DNS would not have this constraint, and allow lookups directly for any domain with relevant records within ENS.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Not applicable.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The reference implementation of the DNS resolver is as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.7.4&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;..&#x2F;ResolverBase.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;@ensdomains&#x2F;dnssec-oracle&#x2F;contracts&#x2F;RRUtils.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;abstract&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DNSResolver&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ResolverBase&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    using&lt;&#x2F;span&gt;&lt;span&gt; RRUtils &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    using&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BytesUtils&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; DNS_RECORD_INTERFACE_ID &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xa8fa5682&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; DNS_ZONE_INTERFACE_ID &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x5c47637c&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; DNSRecordChanged is emitted whenever a given node&#x2F;name&#x2F;resource&amp;#39;s RRSET is updated.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DNSRecordChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint16&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; resource&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; record&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; DNSRecordDeleted is emitted whenever a given node&#x2F;name&#x2F;resource&amp;#39;s RRSET is deleted.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DNSRecordDeleted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint16&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; resource&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; DNSZoneCleared is emitted whenever a given node&amp;#39;s zone information is cleared.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DNSZoneCleared&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; DNSZonehashChanged is emitted whenever a given node&amp;#39;s zone hash is updated.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DNSZonehashChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; lastzonehash&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; zonehash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Zone hashes for the domains.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A zone hash is an ERC-1577 content hash in binary format that should point to a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; resource containing a single zonefile.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; node =&amp;gt; contenthash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; zonehashes&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Version the mapping for each zone.  This allows users who have lost&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; track of their entries to effectively delete an entire zone by bumping&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the version number.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; node =&amp;gt; version&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; versions&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The records themselves.  Stored as binary RRSETs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; node =&amp;gt; version =&amp;gt; name =&amp;gt; resource =&amp;gt; data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint16&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; records&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Count of number of entries for a given name.  Required for DNS resolvers&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; when resolving wildcards.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; node =&amp;gt; version =&amp;gt; name =&amp;gt; number of records&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint16&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; nameEntriesCount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Set one or more DNS records.  Records are supplied in wire-format.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Records with the same node&#x2F;name&#x2F;resource must be supplied one after the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * other to ensure the data is updated correctly. For example, if the data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * was supplied:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *     a.example.com IN A 1.2.3.4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *     a.example.com IN A 5.6.7.8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *     www.example.com IN CNAME a.example.com.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * then this would store the two A records for a.example.com correctly as a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * single RRSET, however if the data was supplied:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *     a.example.com IN A 1.2.3.4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *     www.example.com IN CNAME a.example.com.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *     a.example.com IN A 5.6.7.8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * then this would store the first A record, the CNAME, then the second A&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * record which would overwrite the first.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; node&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the namehash of the node for which to set the records&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the DNS wire format records to set&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setDNSRecords&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; authorised&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;node&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint16&lt;&#x2F;span&gt;&lt;span&gt; resource &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; offset &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; nameHash&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Iterate over the data to add the resource records&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;RRUtils&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;RRIterator &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;memory&lt;&#x2F;span&gt;&lt;span&gt; iter &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;iterateRRs&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !&lt;&#x2F;span&gt;&lt;span&gt;iter&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;done&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; iter&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;next&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;resource &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                resource &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; iter&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;dnstype&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                name &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; iter&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;name&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                nameHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;name&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                value &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;iter&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;rdata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; newName &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; iter&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;name&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;resource &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span&gt; iter&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;dnstype &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !&lt;&#x2F;span&gt;&lt;span&gt;name&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;equals&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;newName&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;                    setDNSRRSet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; resource&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; offset&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; iter&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;offset &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt; offset&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    resource &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; iter&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;dnstype&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    offset &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; iter&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;offset&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    name &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; newName&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    nameHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;name&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    value &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;iter&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;rdata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;name&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            setDNSRRSet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; resource&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; offset&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt; offset&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Obtain a DNS record.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; node&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the namehash of the node for which to fetch the record&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; name&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the keccak-256 hash of the fully-qualified name for which to fetch the record&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; resource&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the ID of the resource as per https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;List_of_DNS_record_types&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; DNS record in wire format if present, otherwise empty&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; dnsRecord&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint16&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; resource&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; records&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;versions&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;name&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;resource&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Check if a given node has records.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; node&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the namehash of the node for which to check the records&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; name&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the namehash of the node for which to check the records&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; hasDNSRecords&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;nameEntriesCount&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;versions&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;name&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Clear all information for a DNS zone.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; node&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the namehash of the node for which to clear the zone&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; clearDNSZone&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; authorised&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;node&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        versions&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DNSZoneCleared&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * setZonehash sets the hash for the zone.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * May only be called by the owner of that node in the ENS registry.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; node&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The node to update.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The zonehash to set&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setZonehash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; authorised&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;node&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; oldhash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; zonehashes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        zonehashes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; hash&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DNSZonehashChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; oldhash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; hash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * zonehash obtains the hash for the zone.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; node&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ENS node to query.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; associated contenthash.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; zonehash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; zonehashes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; override&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; interfaceID &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; DNS_RECORD_INTERFACE_ID &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;               interfaceID &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; DNS_ZONE_INTERFACE_ID &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;               super&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;interfaceID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setDNSRRSet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint16&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; resource&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; offset&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; size&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; deleteRecord&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; version &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; versions&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; nameHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;name&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; rrData &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;substring&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;offset&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; size&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;deleteRecord&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;records&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;version&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;nameHash&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;resource&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                nameEntriesCount&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;version&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;nameHash&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            delete&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;records&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;version&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;nameHash&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;resource&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DNSRecordDeleted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; resource&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;records&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;version&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;nameHash&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;resource&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                nameEntriesCount&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;version&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;nameHash&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            records&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;version&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;nameHash&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;resource&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; rrData&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DNSRecordChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; resource&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; rrData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Security of this solution would be dependent on security of the records within the ENS domain.  This degenenrates to the security of the key(s) which have authority over that domain.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>RPC-Method to get Merkle Proofs - eth_getProof</title>
        <published>2018-06-24T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Simon Jentzsch</name><email>simon.jentzsch@slock.it</email>
	</author>
	
	<author>
		<name>Christoph Jentzsch</name><email>christoph.jentzsch@slock.it</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1186/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/1186" />
        

        <id>https://wg-eips.ritovision.com/1186/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="interface"
                label="Interface" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1186"
            label="EIP-1186" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1186/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;One of the great features of Ethereum is the fact, that you can verify all data of the state. But in order to allow verification of accounts outside the client, we need an additional function delivering us the required proof. These proofs are important to secure Layer2-Technologies.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Ethereum uses a &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;eth-wiki&#x2F;blob&#x2F;master&#x2F;fundamentals&#x2F;patricia-tree.md&quot;&gt;Merkle Tree&lt;&#x2F;a&gt; to store the state of accounts and their storage. This allows verification of each value by simply creating a Merkle Proof. But currently, the standard RPC-Interface does not give you access to these proofs. This EIP suggests an additional RPC-Method, which creates Merkle Proofs for Accounts and Storage Values.&lt;&#x2F;p&gt;
&lt;p&gt;Combined with a stateRoot (from the blockheader) it enables offline verification of any account or storage-value. This allows especially IOT-Devices or even mobile apps which are not able to run a light client to verify responses from an untrusted source only given a trusted blockhash.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;In order to create a MerkleProof access to the full state db is required. The current RPC-Methods allow an application to access single values (&lt;code&gt;eth_getBalance&lt;&#x2F;code&gt;,&lt;code&gt;eth_getTransactionCount&lt;&#x2F;code&gt;,&lt;code&gt;eth_getStorageAt&lt;&#x2F;code&gt;,&lt;code&gt;eth_getCode&lt;&#x2F;code&gt;), but it is impossible to read the data needed for a  MerkleProof through the standard RPC-Interface. (There are implementations using leveldb and accessing the data via filesystems, but this can not be used for production systems since it requires the client to be stopped first - See https:&#x2F;&#x2F;github.com&#x2F;zmitton&#x2F;eth-proof)&lt;&#x2F;p&gt;
&lt;p&gt;Today MerkleProofs are already used internally. For example, the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;zsfelfoldi&#x2F;go-ethereum&#x2F;wiki&#x2F;Light-Ethereum-Subprotocol-%28LES%29#on-demand-data-retrieval&quot;&gt;Light Client Protocol&lt;&#x2F;a&gt; supports a function creating MerkleProof, which is used in order to verify the requested account or storage-data.&lt;&#x2F;p&gt;
&lt;p&gt;Offering these already existing function through the RPC-Interface as well would enable Applications to store and send these proofs to devices which are not directly connected to the p2p-network and still are able to verify the data. This could be used to verify data in mobile applications or IOT-devices, which are currently only using a remote client.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;As Part of the eth-Module, an additional Method called &lt;code&gt;eth_getProof&lt;&#x2F;code&gt; should be defined as follows:&lt;&#x2F;p&gt;
&lt;h4 id=&quot;eth-getproof&quot;&gt;eth_getProof&lt;&#x2F;h4&gt;
&lt;p&gt;Returns the account- and storage-values of the specified account including the Merkle-proof.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h5&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;DATA&lt;&#x2F;code&gt;, 20 Bytes - address of the account.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ARRAY&lt;&#x2F;code&gt;, 32 Bytes - array of storage-keys which should be proofed and included. See &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;wiki&#x2F;wiki&#x2F;JSON-RPC#eth_getstorageat&quot;&gt;&lt;code&gt;eth_getStorageAt&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;QUANTITY|TAG&lt;&#x2F;code&gt; - integer block number, or the string &lt;code&gt;&quot;latest&quot;&lt;&#x2F;code&gt; or &lt;code&gt;&quot;earliest&quot;&lt;&#x2F;code&gt;, see the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;wiki&#x2F;wiki&#x2F;JSON-RPC#the-default-block-parameter&quot;&gt;default block parameter&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h5 id=&quot;returns&quot;&gt;Returns&lt;&#x2F;h5&gt;
&lt;p&gt;&lt;code&gt;Object&lt;&#x2F;code&gt; - A account object:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;balance&lt;&#x2F;code&gt;: &lt;code&gt;QUANTITY&lt;&#x2F;code&gt; - the balance of the account. See &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;wiki&#x2F;wiki&#x2F;JSON-RPC#eth_getbalance&quot;&gt;&lt;code&gt;eth_getBalance&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;codeHash&lt;&#x2F;code&gt;: &lt;code&gt;DATA&lt;&#x2F;code&gt;, 32 Bytes - hash of the code of the account. For a simple Account without code it will return &lt;code&gt;&quot;0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470&quot;&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;nonce&lt;&#x2F;code&gt;: &lt;code&gt;QUANTITY&lt;&#x2F;code&gt;, - nonce of the account. See &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;wiki&#x2F;wiki&#x2F;JSON-RPC#eth_gettransactioncount&quot;&gt;&lt;code&gt;eth_getTransactionCount&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;storageHash&lt;&#x2F;code&gt;: &lt;code&gt;DATA&lt;&#x2F;code&gt;, 32 Bytes - SHA3 of the StorageRoot. All storage will deliver a MerkleProof starting with this rootHash.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;accountProof&lt;&#x2F;code&gt;: &lt;code&gt;ARRAY&lt;&#x2F;code&gt; - Array of rlp-serialized MerkleTree-Nodes, starting with the stateRoot-Node, following the path of the SHA3 (address) as key.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;storageProof&lt;&#x2F;code&gt;: &lt;code&gt;ARRAY&lt;&#x2F;code&gt; - Array of storage-entries as requested. Each entry is an object with these properties:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;key&lt;&#x2F;code&gt;: &lt;code&gt;QUANTITY&lt;&#x2F;code&gt; - the requested storage key&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;value&lt;&#x2F;code&gt;: &lt;code&gt;QUANTITY&lt;&#x2F;code&gt; - the storage value&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;proof&lt;&#x2F;code&gt;: &lt;code&gt;ARRAY&lt;&#x2F;code&gt; - Array of rlp-serialized MerkleTree-Nodes, starting with the storageHash-Node, following the path of the SHA3 (key) as path.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;example&quot;&gt;Example&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;method&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_getProof&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x7F0d15C7FAae65896648C8273B6d7E43f58Fa842&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;latest&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The result will look like this:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;accountProof&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xf90211a...0701bc80&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xf90211a...0d832380&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xf90211a...5fb20c80&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xf90211a...0675b80&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xf90151a0...ca08080&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;codeHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;storageHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;storageProof&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;key&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;proof&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xf90211a...0701bc80&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xf90211a...0d832380&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This one Method actually returns 3 different important data points:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The 4 fields of an account-object as specified in the yellow paper &lt;code&gt;[nonce, balance, storageHash, codeHash ]&lt;&#x2F;code&gt;, which allows storing a hash of the account-object in order to keep track of changes.&lt;&#x2F;li&gt;
&lt;li&gt;The MerkleProof for the account starting with a stateRoot from the specified block.&lt;&#x2F;li&gt;
&lt;li&gt;The MerkleProof for each requested storage entry starting with a storageHash from the account.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Combining these in one Method allows the client to work very efficient since the required data are already fetched from the db.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;proofs-for-non-existent-values&quot;&gt;Proofs for non existent values&lt;&#x2F;h3&gt;
&lt;p&gt;In case an address or storage-value does not exist, the proof needs to provide enough data to verify this fact. This means the client needs to follow the path from the root node and deliver until the last matching node. If the last matching node is a branch, the proof value in the node must be an empty one. In case of leaf-type, it must be pointing to a different relative-path in order to proof that the requested path does not exist.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;possible-changes-to-be-discussed&quot;&gt;possible Changes to be discussed:&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;instead of providing the blocknumber maybe the blockhash would be better since it would allow proofs of uncles-states.&lt;&#x2F;li&gt;
&lt;li&gt;in order to reduce data, the account-object may only provide the &lt;code&gt;accountProof&lt;&#x2F;code&gt; and &lt;code&gt;storageProof&lt;&#x2F;code&gt;. The Fields &lt;code&gt;balance&lt;&#x2F;code&gt;, &lt;code&gt;nonce&lt;&#x2F;code&gt;, &lt;code&gt;storageHash&lt;&#x2F;code&gt; and &lt;code&gt;codeHash&lt;&#x2F;code&gt; could be taken from the last Node in the proof by deserializing it.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Since this only adds a new Method there are no issues with Backwards Compatibility.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TODO: Tests still need to be implemented, but the core function creating the proof already exists inside the clients and are well tested.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Minimal Proxy Contract</title>
        <published>2018-06-22T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Peter Murray</name><uri>https://github.com/yarrumretep</uri>
	</author>
	
	<author>
		<name>Nate Welch</name><uri>https://github.com/flygoing</uri>
	</author>
	
	<author>
		<name>Joe Messerman</name><uri>https://github.com/JAMesserman</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1167/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/optionality/clone-factory/issues/10" />
        

        <id>https://wg-eips.ritovision.com/1167/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1167"
            label="ERC-1167" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1167/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;To simply and cheaply clone contract functionality in an immutable way, this standard specifies a minimal bytecode implementation that delegates all calls to a known, fixed address.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;By standardizing on a known minimal bytecode redirect implementation, this standard allows users and third party tools (e.g. Etherscan) to (a) simply discover that a contract will always redirect in a known manner and (b) depend on the behavior of the code at the destination contract as the behavior of the redirecting contract.  Specifically, tooling can interrogate the bytecode at a redirecting address to determine the location of the code that will run - and can depend on representations about that code (verified source, third-party audits, etc).  This implementation forwards all calls and 100% of the gas to the implementation contract and then relays the return value back to the caller.  In the case where the implementation reverts, the revert is passed back along with the payload data (for revert with message).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This standard supports use-cases wherein it is desirable to clone exact contract functionality with a minimum of side effects (e.g. memory slot stomping) and with low gas cost deployment of duplicate proxies.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The exact bytecode of the standard clone contract is this: &lt;code&gt;363d3d373d3d3d363d73bebebebebebebebebebebebebebebebebebebebe5af43d82803e903d91602b57fd5bf3&lt;&#x2F;code&gt; wherein the bytes at indices 10 - 29 (inclusive) are replaced with the 20 byte address of the master functionality contract.&lt;&#x2F;p&gt;
&lt;p&gt;A reference implementation of this can be found at the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;optionality&#x2F;clone-factory&quot;&gt;optionality&#x2F;clone-factory&lt;&#x2F;a&gt; github repo.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The goals of this effort have been the following:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;inexpensive deployment (low gas to deploy clones)&lt;&#x2F;li&gt;
&lt;li&gt;support clone initialization in creation transaction (through factory contract model)&lt;&#x2F;li&gt;
&lt;li&gt;simple clone bytecode to encourage directly bytecode interrogation (see CloneProbe.sol in the clone-factory project)&lt;&#x2F;li&gt;
&lt;li&gt;dependable, locked-down behavior - this is not designed to handle upgradability, nor should it as the representation we are seeking is stronger.&lt;&#x2F;li&gt;
&lt;li&gt;small operational overhead - adds a single call cost to each call&lt;&#x2F;li&gt;
&lt;li&gt;handles error return bubbling for revert messages&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;There are no backwards compatibility issues.  There may be some systems that are using earlier versions of the proxy contract bytecode.  They will not be compliant with this standard.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;invocation with no arguments&lt;&#x2F;li&gt;
&lt;li&gt;invocation with arguments&lt;&#x2F;li&gt;
&lt;li&gt;invocation with fixed length return values&lt;&#x2F;li&gt;
&lt;li&gt;invocation with variable length return values&lt;&#x2F;li&gt;
&lt;li&gt;invocation with revert (confirming reverted payload is transferred)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Tests for these cases are included in the reference implementation project.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Deployment bytecode is not included in this specification.  One approach is defined in the proxy-contract reference implementation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;standard-proxy&quot;&gt;Standard Proxy&lt;&#x2F;h3&gt;
&lt;p&gt;The disassembly of the standard deployed proxy contract code (from r2 and edited to include stack visualization)&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|           0x00000000      36             calldatasize          cds&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|           0x00000001      3d             returndatasize        0 cds&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|           0x00000002      3d             returndatasize        0 0 cds&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|           0x00000003      37             calldatacopy          &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|           0x00000004      3d             returndatasize        0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|           0x00000005      3d             returndatasize        0 0 &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|           0x00000006      3d             returndatasize        0 0 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|           0x00000007      36             calldatasize          cds 0 0 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|           0x00000008      3d             returndatasize        0 cds 0 0 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|           0x00000009      73bebebebebe.  push20 0xbebebebe     0xbebe 0 cds 0 0 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|           0x0000001e      5a             gas                   gas 0xbebe 0 cds 0 0 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|           0x0000001f      f4             delegatecall          suc 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|           0x00000020      3d             returndatasize        rds suc 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|           0x00000021      82             dup3                  0 rds suc 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|           0x00000022      80             dup1                  0 0 rds suc 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|           0x00000023      3e             returndatacopy        suc 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|           0x00000024      90             swap1                 0 suc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|           0x00000025      3d             returndatasize        rds 0 suc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|           0x00000026      91             swap2                 suc 0 rds&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|           0x00000027      602b           push1 0x2b            0x2b suc 0 rds&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|       ,=&amp;lt; 0x00000029      57             jumpi                 0 rds&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|       |   0x0000002a      fd             revert&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|       `-&amp;gt; 0x0000002b      5b             jumpdest              0 rds&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;\           0x0000002c      f3             return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;NOTE: as an effort to reduce gas costs as much as possible, the above bytecode depends on EIP-211 specification that &lt;code&gt;returndatasize&lt;&#x2F;code&gt; returns zero prior to any calls within the call-frame. &lt;code&gt;returndatasize&lt;&#x2F;code&gt; uses 1 less gas than &lt;code&gt;dup*&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;vanity-address-optimization&quot;&gt;Vanity Address Optimization&lt;&#x2F;h3&gt;
&lt;p&gt;Proxy deployment can be further optimized by installing the master contract at a vanity contract deployment address with leading zero-bytes.  By generating a master contract vanity address that includes Z leading 0 bytes in its address, you can shorten the proxy bytecode by replacing the &lt;code&gt;push20&lt;&#x2F;code&gt; opcode with &lt;code&gt;pushN&lt;&#x2F;code&gt; (where N is 20 - Z) followed by the N non-zero address bytes.  The revert jump address is decremented by Z in this case.  Here is an example where Z = 4:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|           0x00000000      36             calldatasize          cds&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|           0x00000001      3d             returndatasize        0 cds&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|           0x00000002      3d             returndatasize        0 0 cds&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|           0x00000003      37             calldatacopy          &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|           0x00000004      3d             returndatasize        0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|           0x00000005      3d             returndatasize        0 0 &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|           0x00000006      3d             returndatasize        0 0 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|           0x00000007      36             calldatasize          cds 0 0 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|           0x00000008      3d             returndatasize        0 cds 0 0 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|           0x00000009      6fbebebebebe.  push16 0xbebebebe     0xbebe 0 cds 0 0 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|           0x0000001a      5a             gas                   gas 0xbebe 0 cds 0 0 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|           0x0000001b      f4             delegatecall          suc 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|           0x0000001c      3d             returndatasize        rds suc 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|           0x0000001d      82             dup3                  0 rds suc 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|           0x0000001e      80             dup1                  0 0 rds suc 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|           0x0000001f      3e             returndatacopy        suc 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|           0x00000020      90             swap1                 0 suc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|           0x00000021      3d             returndatasize        rds 0 suc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|           0x00000022      91             swap2                 suc 0 rds&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|           0x00000023      6027           push1 0x27            0x27 suc 0 rds&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|       ,=&amp;lt; 0x00000025      57             jumpi                 0 rds&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|       |   0x00000026      fd             revert&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|       `-&amp;gt; 0x00000027      5b             jumpdest              0 rds&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;\           0x00000028      f3             return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This saves 4 bytes of proxy contract size (savings on each deployment) and has zero impact on runtime gas costs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Multi-class Token Standard</title>
        <published>2018-06-22T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Albert Chon</name><email>achon@stanford.edu</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1178/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/1179" />
        

        <id>https://wg-eips.ritovision.com/1178/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1178"
            label="ERC-1178" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1178/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;A standard interface for multi-class fungible tokens.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard allows for the implementation of a standard API for multi-class fungible tokens (henceforth referred to as &quot;MCFTs&quot;) within smart contracts. This standard provides basic functionality to track and transfer ownership of MCFTs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, there is no standard to support tokens that have multiple classes. In the real world, there are many situations in which defining distinct classes of the same token would be fitting (e.g. distinguishing between preferred&#x2F;common&#x2F;restricted shares of a company). Yet, such nuance cannot be supported in today&#x27;s token standards. An ERC-20 token contract defines tokens that are all of one class while an ERC-721 token contract creates a class (defined by token_id) for each individual token. The ERC-1178 token standard proposes a new standard for creating multiple classes of tokens within one token contract.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Aside: In theory, while it is possible to implement tokens with classes using the properties of token structs in ERC-721 tokens, gas costs of implementing this in practice are prohibitive for any non-trivial application.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;erc-20-compatibility-partial&quot;&gt;ERC-20 Compatibility (partial)&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;name&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;em&gt;OPTIONAL - It is recommended that this method is implemented for enhanced usability with wallets and exchanges, but interfaces and other contracts MUST NOT depend on the existence of this method.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Returns the name of the aggregate collection of MCFTs managed by this contract. - e.g. &lt;code&gt;&quot;My Company Tokens&quot;&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;class name&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; className&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; classId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;em&gt;OPTIONAL - It is recommended that this method is implemented for enhanced usability with wallets and exchanges, but interfaces and other contracts MUST NOT depend on the existence of this method.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Returns the name of the class of MCFT managed by this contract. - e.g. &lt;code&gt;&quot;My Company Preferred Shares Token&quot;&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;symbol&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; symbol&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; symbol&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;em&gt;OPTIONAL - It is recommend that this method is implemented for enhanced usability with wallets and exchanges, but interfaces and other contracts MUST NOT depend on the existence of this method.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Returns a short string symbol referencing the entire collection of MCFT managed in this contract. e.g. &quot;MUL&quot;. This symbol SHOULD be short (3-8 characters is recommended), with no whitespace characters or new-lines and SHOULD be limited to the uppercase latin alphabet (i.e. the 26 letters used in English).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;totalSupply&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; totalSupply&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Returns the total number of all MCFTs currently tracked by this contract.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;individualSupply&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; individualSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _classId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; individualSupply&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Returns the total number of MCFTs of class &lt;code&gt;_classId&lt;&#x2F;code&gt; currently tracked by this contract.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;balanceOf&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _classId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; balance&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Returns the number of MCFTs of token class &lt;code&gt;_classId&lt;&#x2F;code&gt; assigned to address &lt;code&gt;_owner&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;classesOwned&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; classesOwned&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; classes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Returns an array of &lt;code&gt;_classId&lt;&#x2F;code&gt;&#x27;s of MCFTs that address &lt;code&gt;_owner&lt;&#x2F;code&gt; owns in the contract.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;NOTE: returning an array is supported by &lt;code&gt;pragma experimental ABIEncoderV2&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h2 id=&quot;basic-ownership&quot;&gt;Basic Ownership&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;approve&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _classId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; quantity&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Grants approval for address &lt;code&gt;_to&lt;&#x2F;code&gt; to take possession &lt;code&gt;quantity&lt;&#x2F;code&gt; amount of the MCFT with ID &lt;code&gt;_classId&lt;&#x2F;code&gt;. This method MUST &lt;code&gt;throw&lt;&#x2F;code&gt; if &lt;code&gt;balanceOf(msg.sender, _classId) &amp;lt; quantity&lt;&#x2F;code&gt;, or if &lt;code&gt;_classId&lt;&#x2F;code&gt; does not represent an MCFT class currently tracked by this contract, or if &lt;code&gt;msg.sender == _to&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Only one address can &quot;have approval&quot; at any given time for a given address and &lt;code&gt;_classId&lt;&#x2F;code&gt;. Calling &lt;code&gt;approve&lt;&#x2F;code&gt; with a new address and &lt;code&gt;_classId&lt;&#x2F;code&gt; revokes approval for the previous address and &lt;code&gt;_classId&lt;&#x2F;code&gt;. Calling this method with 0 as the &lt;code&gt;_to&lt;&#x2F;code&gt; argument clears approval for any address and the specified &lt;code&gt;_classId&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Successful completion of this method MUST emit an &lt;code&gt;Approval&lt;&#x2F;code&gt; event (defined below) unless the caller is attempting to clear approval when there is no pending approval. In particular, an Approval event MUST be fired if the &lt;code&gt;_to&lt;&#x2F;code&gt; address is zero and there is some outstanding approval. Additionally, an Approval event MUST be fired if &lt;code&gt;_to&lt;&#x2F;code&gt; is already the currently approved address and this call otherwise has no effect. (i.e. An &lt;code&gt;approve()&lt;&#x2F;code&gt; call that &quot;reaffirms&quot; an existing approval MUST fire an event.)&lt;&#x2F;p&gt;
&lt;!--
ActionPrior State_to addressNew StateEventClear unset approvalClear0ClearNoneSet new approvalClearXSet to XApproval(owner, X, _classId)Change approvalSet to XYSet to YApproval(owner, Y, _classId)Reaffirm approvalSet to XXSet to XApproval(owner, X, _classId)Clear approvalSet to X0ClearApproval(owner, 0, _classId)
Note: ANY change of ownership of an MCFT – whether directly through the `transfer` and `transferFrom` methods defined in this interface, or through any other mechanism defined in the conforming contract – MUST clear any and all approvals for the transferred MCFT. The implicit clearing of approval via ownership transfer MUST also fire the event `Approval(0, _classId)` if there was an outstanding approval. (i.e. All actions that transfer ownership must emit the same Approval event, if any, as would emitted by calling `approve(0, _classId)`.)--&gt;
&lt;p&gt;&lt;strong&gt;transfer&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _classId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; quantity&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Assigns the ownership of &lt;code&gt;quantity&lt;&#x2F;code&gt; MCFT&#x27;s with ID &lt;code&gt;_classId&lt;&#x2F;code&gt; to &lt;code&gt;_to&lt;&#x2F;code&gt; if and only if &lt;code&gt;quantity == balanceOf(msg.sender, _classId)&lt;&#x2F;code&gt;. A successful transfer MUST fire the &lt;code&gt;Transfer&lt;&#x2F;code&gt; event (defined below).&lt;&#x2F;p&gt;
&lt;p&gt;This method MUST transfer ownership to &lt;code&gt;_to&lt;&#x2F;code&gt; or &lt;code&gt;throw&lt;&#x2F;code&gt;, no other outcomes can be possible. Reasons for failure include (but are not limited to):&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;msg.sender&lt;&#x2F;code&gt; is not the owner of &lt;code&gt;quantity&lt;&#x2F;code&gt; amount of tokens of &lt;code&gt;_classId&lt;&#x2F;code&gt;&#x27;s.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;_classId&lt;&#x2F;code&gt; does not represent an MCFT class currently tracked by this contract&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;A conforming contract MUST allow the current owner to &quot;transfer&quot; a token to themselves, as a way of affirming ownership in the event stream. (i.e. it is valid for &lt;code&gt;_to == msg.sender&lt;&#x2F;code&gt; if &lt;code&gt;balanceOf(msg.sender, _classId) &amp;gt;= balance&lt;&#x2F;code&gt;.) This &quot;no-op transfer&quot; MUST be considered a successful transfer, and therefore MUST fire a &lt;code&gt;Transfer&lt;&#x2F;code&gt; event (with the same address for &lt;code&gt;_from&lt;&#x2F;code&gt; and &lt;code&gt;_to&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;advanced-ownership-and-exchange&quot;&gt;Advanced Ownership and Exchange&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approveForToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; classIdHeld&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; quantityHeld&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; classIdWanted&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; quantityWanted&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Allows holder of one token to allow another individual (or the smart contract itself) to approve the exchange of their tokens of one class for tokens of another class at their specified exchange rate (see sample implementation for more details). This is equivalent to posting a bid in a marketplace.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; exchange&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; classIdPosted&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; quantityPosted&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; classIdWanted&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; quantityWanted&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Allows an individual to fill an existing bid (see above function) and complete the exchange of their tokens of one class for another. In the sample implementation, this function call should fail unless the callee has already approved the contract to transfer their tokens. Of course, it is possible to create an implementation where calling this function implicitly assumes approval and the transfer is completed in one step.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt; classId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Allows a third party to initiate a transfer of tokens from &lt;code&gt;from&lt;&#x2F;code&gt; to &lt;code&gt;to&lt;&#x2F;code&gt; assuming the approvals have been granted.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;events&quot;&gt;Events&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;Transfer&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;This event MUST trigger when MCFT ownership is transferred via any mechanism.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, the creation of new MCFTs MUST trigger a Transfer event for each newly created MCFTs, with a &lt;code&gt;_from&lt;&#x2F;code&gt; address of 0 and a &lt;code&gt;_to&lt;&#x2F;code&gt; address matching the owner of the new MCFT (possibly the smart contract itself). The deletion (or burn) of any MCFT MUST trigger a Transfer event with a &lt;code&gt;_to&lt;&#x2F;code&gt; address of 0 and a &lt;code&gt;_from&lt;&#x2F;code&gt; address of the owner of the MCFT (now former owner!).&lt;&#x2F;p&gt;
&lt;p&gt;NOTE: A Transfer event with &lt;code&gt;_from == _to&lt;&#x2F;code&gt; is valid. See the &lt;code&gt;transfer()&lt;&#x2F;code&gt; documentation for details.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _classId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Approval&lt;&#x2F;strong&gt;
This event MUST trigger on any successful call to &lt;code&gt;approve(_to, _classId, quantity)&lt;&#x2F;code&gt; (unless the caller is attempting to clear approval when there is no pending approval).&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Approval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _classId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;current-limitations&quot;&gt;Current Limitations&lt;&#x2F;h3&gt;
&lt;p&gt;The design of this project was motivated when I tried to create different classes of fungible ERC-721 tokens (an oxymoron) but ran into gas limits from having to create each tokens individually and maintain them in an efficient data structure for access. Using the maximum gas amount one can send with a transaction on Metamask (a popular web wallet), I was only able to create around 46 ERC-721 tokens before exhausting all gas. This experience motivated the creation of the multi-class fungible token standard.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Adoption of the MCFT standard proposal would not pose backwards compatibility issues as it defines a new standard for token creation. This standard follows the semantics of ERC-721 as closely as possible, but can&#x27;t be entirely compatible with it due to the fundamental differences between multi-class fungible and non-fungible tokens. For example, the &lt;code&gt;ownerOf&lt;&#x2F;code&gt;, &lt;code&gt;takeOwnership&lt;&#x2F;code&gt;, and &lt;code&gt;tokenOfOwnerByIndex&lt;&#x2F;code&gt; methods in the ERC-721 token standard cannot be implemented in this standard. Furthermore, the function arguments to &lt;code&gt;balanceOf&lt;&#x2F;code&gt;, &lt;code&gt;approve&lt;&#x2F;code&gt;, and &lt;code&gt;transfer&lt;&#x2F;code&gt; differ as well.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;A sample implementation can be found &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;achon22&#x2F;ERC-1178&#x2F;blob&#x2F;master&#x2F;erc1178-sample.sol&quot;&gt;here&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Wallet &amp; shop standard for all tokens (erc20)</title>
        <published>2018-06-21T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Jet Lim</name><uri>https://github.com/Nitro888</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1175/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/1182" />
        

        <id>https://wg-eips.ritovision.com/1175/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1175"
            label="ERC-1175" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1175/">&lt;h1 id=&quot;all-tokens-go-to-heaven&quot;&gt;All tokens go to heaven&lt;&#x2F;h1&gt;
&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Make wallets and shops created from certified contracts make erc20 tokens easy to use for commerce.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1175&#x2F;.&#x2F;assets&#x2F;wallet.png&quot; alt=&quot;wallet&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The mutual trust between the wallet and the shop created by the authenticated contract allows you to pay for and purchase items at a simple process.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;New standards with improvements have been released, but the majority of tokens currently being developed are erc20 tokens. So I felt I needed a proposal to use old tokens in commerce.
To use various erc20 tokens for trading, you need a custom contract. However, a single wallet with a variety of tokens, and a mutually trusted store, can make transactions that are simple and efficient. The erc20 token is traded through two calls, &lt;code&gt;approve (address _spender, uint256 _value)&lt;&#x2F;code&gt; and &lt;code&gt;transferFrom (address _from, address _to, uint256 _value)&lt;&#x2F;code&gt;, but when using the wallet contract, &lt;code&gt;paySafe (address _shop, uint256 _item)&lt;&#x2F;code&gt;will be traded only in one call.
And if you only reuse the store interface, you can also trade using &lt;code&gt;payUnsafe (address _shop, uint256 _item)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1175&#x2F;.&#x2F;assets&#x2F;workflow.png&quot; alt=&quot;workflow&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;walletcenter&quot;&gt;WalletCenter&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;methods&quot;&gt;Methods&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;createwallet&quot;&gt;createWallet&lt;&#x2F;h4&gt;
&lt;p&gt;Create wallet contract and add to list. Returns the address of new wallet.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; createWallet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _wallet&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;iswallet&quot;&gt;isWallet&lt;&#x2F;h4&gt;
&lt;p&gt;Returns true or false value for test this address is a created by createWallet.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isWallet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _wallet&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;createshop&quot;&gt;createShop&lt;&#x2F;h4&gt;
&lt;p&gt;Create Shop contract and add to list. Returns the address of new Shop with erc20 token address.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; createShop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _erc20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _shop&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;isshop&quot;&gt;isShop&lt;&#x2F;h4&gt;
&lt;p&gt;Returns true or false value for test this address is a created by createWallet.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isShop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _shop&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;events&quot;&gt;Events&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;wallet&quot;&gt;Wallet&lt;&#x2F;h4&gt;
&lt;p&gt;Search for my wallet.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Wallet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _wallet&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;shop&quot;&gt;Shop&lt;&#x2F;h4&gt;
&lt;p&gt;Search for my shop.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Shop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _shop&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _erc20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;wallet-1&quot;&gt;Wallet&lt;&#x2F;h2&gt;
&lt;p&gt;Wallet must be created by wallet center.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;methods-1&quot;&gt;Methods&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;balanceof&quot;&gt;balanceOf&lt;&#x2F;h4&gt;
&lt;p&gt;Returns the account balance of Wallet.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _erc20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; balance&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;withdrawal&quot;&gt;withdrawal&lt;&#x2F;h4&gt;
&lt;p&gt;withdrawal &lt;code&gt;_value&lt;&#x2F;code&gt; amount of &lt;code&gt;_erc20&lt;&#x2F;code&gt; token to &lt;code&gt;_owner&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; withdrawal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _erc20&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;paysafe&quot;&gt;paySafe&lt;&#x2F;h4&gt;
&lt;p&gt;Pay for safe shop (created by contract) item with item index &lt;code&gt;_item&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; paySafe&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _shop&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _item&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyShop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;_shop&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;payunsafe&quot;&gt;payUnsafe&lt;&#x2F;h4&gt;
&lt;p&gt;Pay for unsafe shop (did not created by contract) item with item index &lt;code&gt;_item&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; payUnsafe&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _shop&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _item&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;paycancel&quot;&gt;payCancel&lt;&#x2F;h4&gt;
&lt;p&gt;Cancel pay and refund. (only weekly model)&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; payCancel&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _shop&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _item&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;refund&quot;&gt;refund&lt;&#x2F;h4&gt;
&lt;p&gt;Refund from shop with item index &lt;code&gt;_item&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; refund&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _item&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;events-1&quot;&gt;Events&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;pay&quot;&gt;Pay&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Pay&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _shop&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _item&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;refund-1&quot;&gt;Refund&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Refund&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _shop&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _item&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;shop-1&quot;&gt;Shop&lt;&#x2F;h2&gt;
&lt;p&gt;Shop is created by wallet center or not. but Shop that created by wallet center is called safe shop.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;methods-2&quot;&gt;Methods&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;balanceof-1&quot;&gt;balanceOf&lt;&#x2F;h4&gt;
&lt;p&gt;Returns the account balance of Shop.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _erc20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; balance&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;withdrawal-1&quot;&gt;withdrawal&lt;&#x2F;h4&gt;
&lt;p&gt;withdrawal &lt;code&gt;_value&lt;&#x2F;code&gt; amount of &lt;code&gt;_erc20&lt;&#x2F;code&gt; token to &lt;code&gt;_owner&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; withdrawal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _erc20&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;pay-1&quot;&gt;pay&lt;&#x2F;h4&gt;
&lt;p&gt;Pay from buyer with item index &lt;code&gt;_item&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; pay&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _item&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyWallet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;refund-2&quot;&gt;refund&lt;&#x2F;h4&gt;
&lt;p&gt;refund token to &lt;code&gt;_to&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; refund&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _buyer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _item&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyWallet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;_buyer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;resister&quot;&gt;resister&lt;&#x2F;h4&gt;
&lt;p&gt;Listing item for sell.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; resister&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _category&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _price&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _stock&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _itemId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;update&quot;&gt;update&lt;&#x2F;h4&gt;
&lt;p&gt;Update item state for sell. (change item &lt;code&gt;_price&lt;&#x2F;code&gt; or add item &lt;code&gt;_stock&lt;&#x2F;code&gt;)&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; update&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _item&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _price&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _stock&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;price&quot;&gt;price&lt;&#x2F;h4&gt;
&lt;p&gt;Get token address and price from buyer with item index &lt;code&gt;_item&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; price&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _item&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _erc20&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;canbuy&quot;&gt;canBuy&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;_who&lt;&#x2F;code&gt; can Buy &lt;code&gt;_item&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; canBuy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _who&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _item&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _canBuy&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;isbuyer&quot;&gt;isBuyer&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;_who&lt;&#x2F;code&gt; is buyer of &lt;code&gt;_item&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isBuyer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _who&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _item&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _buyer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;info&quot;&gt;info&lt;&#x2F;h4&gt;
&lt;p&gt;Set shop information bytes.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; info&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _msgPack&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;upvote&quot;&gt;upVote&lt;&#x2F;h4&gt;
&lt;p&gt;Up vote for this shop.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; upVote&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;dnvote&quot;&gt;dnVote&lt;&#x2F;h4&gt;
&lt;p&gt;Down vote for this shop.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; dnVote&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;about&quot;&gt;about&lt;&#x2F;h4&gt;
&lt;p&gt;Get shop token, up vote and down vote.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; about&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _erc20&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _up&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _down&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;infoitem&quot;&gt;infoItem&lt;&#x2F;h4&gt;
&lt;p&gt;Set item information bytes.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; infoItem&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _item&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _msgPack&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;upvoteitem&quot;&gt;upVoteItem&lt;&#x2F;h4&gt;
&lt;p&gt;Up vote for this item.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; upVoteItem&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _item&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;dnvoteitem&quot;&gt;dnVoteItem&lt;&#x2F;h4&gt;
&lt;p&gt;Down vote for this item.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; dnVoteItem&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _item&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;aboutitem&quot;&gt;aboutItem&lt;&#x2F;h4&gt;
&lt;p&gt;Get Item price, up vote and down vote.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; aboutItem&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _item&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _price&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _up&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _down&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;events-2&quot;&gt;Events&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;pay-2&quot;&gt;Pay&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Pay&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _buyer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _item&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;refund-3&quot;&gt;Refund&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Refund&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _item&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;item&quot;&gt;Item&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Item&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _item&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _price&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;info-1&quot;&gt;Info&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Info&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _msgPack&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;infoitem-1&quot;&gt;InfoItem&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InfoItem&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _item&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _msgPack&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Sample token contract address is &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ropsten.etherscan.io&#x2F;address&#x2F;0x393dd70ce2ae7b30501aec94727968c517f90d52&quot;&gt;0x393dd70ce2ae7b30501aec94727968c517f90d52&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;WalletCenter contract address is &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ropsten.etherscan.io&#x2F;address&#x2F;0x1fe0862a4a8287d6c23904d61f02507b5044ea31&quot;&gt;0x1fe0862a4a8287d6c23904d61f02507b5044ea31&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;WalletCenter create shop contract address is &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ropsten.etherscan.io&#x2F;address&#x2F;0x59117730D02Ca3796121b7975796d479A5Fe54B0&quot;&gt;0x59117730D02Ca3796121b7975796d479A5Fe54B0&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;WalletCenter create wallet contract address is &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ropsten.etherscan.io&#x2F;address&#x2F;0x39da7111844df424e1d0a0226183533dd07bc5c6&quot;&gt;0x39da7111844df424e1d0a0226183533dd07bc5c6&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;appendix&quot;&gt;Appendix&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ^&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;24&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ERC20Interface&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenOwner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; balance&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; allowance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenOwner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; remaining&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokens&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokens&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokens&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokens&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Approval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokenOwner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tokens&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; SafeMath&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeAdd&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; a&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; b&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; c&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; b&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; a&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeSub&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; a&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; b&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; c&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;b&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; a&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; b&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeMul&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; a&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; b&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; c&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; b&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; b&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeDiv&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; a&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; b&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; c&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;b&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; b&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _Base&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; walletCenter&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    modifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        _&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    modifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyWallet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;WalletCenter&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;walletCenter&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isWallet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        _&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    modifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyShop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;WalletCenter&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;walletCenter&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isShop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        _&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _erc20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; balance&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_erc20&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;balance&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC20Interface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_erc20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _erc20&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_erc20&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC20Interface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_erc20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_erc20&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;            _to&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        else&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            ERC20Interface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_erc20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; withdrawal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _erc20&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Pay&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _who&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _item&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Refund&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _who&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _item&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Prize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _who&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _item&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _Wallet&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _Base&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _who&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;           =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _who&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        walletCenter&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;    =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; pay&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _shop&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _item&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;_Shop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_shop&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;canBuy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _erc20&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_erc20&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _Shop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_shop&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;price&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_shop&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_erc20&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _Shop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_shop&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;pay&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Pay&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_shop&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; paySafe&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _shop&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _item&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyShop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;_shop&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        pay&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_shop&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; payUnsafe&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _shop&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _item&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        pay&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_shop&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; payCancel&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _shop&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _item&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _Shop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_shop&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;payCancel&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; refund&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _erc20&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _item&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_erc20&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC20Interface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_erc20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;allowance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_erc20&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            ERC20Interface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_erc20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Refund&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; prize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _erc20&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _item&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_erc20&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC20Interface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_erc20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;allowance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_erc20&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            ERC20Interface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_erc20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Prize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; withdrawal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _erc20&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_erc20&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC20Interface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_erc20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_erc20&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;            owner&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        else&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            ERC20Interface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_erc20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _Shop&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _Base&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; SafeMath&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; erc20&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _who&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _erc20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;           =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _who&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        walletCenter&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;    =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        erc20&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;           =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _erc20&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; item&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;                       category&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0 = disable, 1 = non Stock, non Expire, 2 = can Expire (after 1 week), 3 = stackable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;                     price&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;                     stockCount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;=&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;   customer&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;                    index&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;=&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;item&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  items&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; pay&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _item&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyWallet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;canBuy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _item&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;erc20&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC20Interface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;erc20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;allowance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;price&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;erc20&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            ERC20Interface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;erc20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;price&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;category&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;category&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; now&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeAdd&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;customer&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; weeks&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;            items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;customer&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;   =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; now&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        else&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;category&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; now&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeAdd&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;customer&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; weeks&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;            items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;customer&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;   =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeAdd&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;customer&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; weeks&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        else&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;category&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;            items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;customer&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;   =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeAdd&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;customer&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;            items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;stockCount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;             =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeSub&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;stockCount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Pay&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;customer&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; payCancel&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _item&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyWallet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;category&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;safeAdd&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;customer&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; weeks&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;now&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;erc20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;price&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;customer&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;  =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeSub&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;customer&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; weeks&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; erc20&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;price&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _Wallet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;refund&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;erc20&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;price&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Refund&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;price&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; refund&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _item&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyWallet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;_to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isBuyer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;category&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;customer&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_to&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;category&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;safeAdd&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;customer&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_to&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; weeks&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;now&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;erc20&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC20Interface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;erc20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;price&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;category&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;            items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;customer&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_to&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;  =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        else&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;category&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;            items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;customer&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_to&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;  =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeSub&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;customer&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_to&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; weeks&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        else&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;            items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;customer&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_to&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;  =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeSub&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;customer&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_to&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; erc20&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;price&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _Wallet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;refund&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;erc20&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;price&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Refund&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;price&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Item&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _item&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _price&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; resister&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _category&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _price&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _stock&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _itemId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_category&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_category&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_price&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;    =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; item&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_category&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_price&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_stock&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeAdd&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;index&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Item&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;index&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_price&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeSub&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;index&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; update&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _item&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _price&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _stock&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;category&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_price&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; temp&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;price&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;price&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;      =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _price&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;stockCount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeAdd&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;stockCount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_stock&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;temp&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;price&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;            emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Item&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;index&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;price&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; price&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _item&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _erc20&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;erc20&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;price&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; canBuy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _who&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _item&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _canBuy&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt;  (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;category&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                !&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;category&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;customer&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_who&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;stockCount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isBuyer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _who&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _item&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _buyer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;category&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;customer&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_who&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;category&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;safeAdd&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;customer&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_who&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; weeks&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;now&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;category&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;items&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_item&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;customer&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_who&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; lastWithdrawal&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; withdrawal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _erc20&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;safeAdd&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;lastWithdrawal&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; weeks&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;now&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_erc20&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ERC20Interface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_erc20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_erc20&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;            owner&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        else&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            ERC20Interface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_erc20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        lastWithdrawal&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; now&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; WalletCenter&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;=&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;     wallet&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Wallet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _wallet&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; createWallet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _wallet&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        _wallet&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _Wallet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        wallet&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_wallet&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Wallet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_wallet&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _wallet&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isWallet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _wallet&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; wallet&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_wallet&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;=&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;     shop&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Shop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _shop&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _erc20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; createShop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _erc20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _shop&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        _shop&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;   =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _Shop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_erc20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        shop&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_shop&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Shop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_shop&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_erc20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _shop&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isShop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _shop&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; shop&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_shop&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Multi Token Standard</title>
        <published>2018-06-17T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Witek Radomski</name><email>witek@enjin.io</email>
	</author>
	
	<author>
		<name>Andrew Cooke</name><email>ac0dem0nk3y@gmail.com</email>
	</author>
	
	<author>
		<name>Philippe Castonguay</name><uri>https://github.com/phabc</uri><email>pc@horizongames.net</email>
	</author>
	
	<author>
		<name>James Therien</name><email>james@turing-complete.com</email>
	</author>
	
	<author>
		<name>Eric Binet</name><email>eric@enjin.io</email>
	</author>
	
	<author>
		<name>Ronan Sandford</name><uri>https://github.com/wighawag</uri><email>wighawag@gmail.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1155/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/1155" />
        

        <id>https://wg-eips.ritovision.com/1155/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:1155"
            label="ERC-1155" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1155/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;A standard interface for contracts that manage multiple token types. A single deployed contract may include any combination of fungible tokens, non-fungible tokens or other configurations (e.g. semi-fungible tokens).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard outlines a smart contract interface that can represent any number of fungible and non-fungible token types. Existing standards such as ERC-20 require deployment of separate contracts per token type. The ERC-721 standard&#x27;s token ID is a single non-fungible index and the group of these non-fungibles is deployed as a single contract with settings for the entire collection. In contrast, the ERC-1155 Multi Token Standard allows for each token ID to represent a new configurable token type, which may have its own metadata, supply and other attributes.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;_id&lt;&#x2F;code&gt; argument contained in each function&#x27;s argument set indicates a specific token or token type in a transaction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Tokens standards like ERC-20 and ERC-721 require a separate contract to be deployed for each token type or collection. This places a lot of redundant bytecode on the Ethereum blockchain and limits certain functionality by the nature of separating each token contract into its own permissioned address. With the rise of blockchain games and platforms like Enjin Coin, game developers may be creating thousands of token types, and a new type of token standard is needed to support them. However, ERC-1155 is not specific to games and many other applications can benefit from this flexibility.&lt;&#x2F;p&gt;
&lt;p&gt;New functionality is possible with this design such as transferring multiple token types at once, saving on transaction costs. Trading (escrow &#x2F; atomic swaps) of multiple tokens can be built on top of this standard and it removes the need to &quot;approve&quot; individual token contracts separately. It is also easy to describe and mix multiple fungible or non-fungible token types in a single contract.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Smart contracts implementing the ERC-1155 standard MUST implement all of the functions in the &lt;code&gt;ERC1155&lt;&#x2F;code&gt; interface.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Smart contracts implementing the ERC-1155 standard MUST implement the ERC-165 &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; function and MUST return the constant value &lt;code&gt;true&lt;&#x2F;code&gt; if &lt;code&gt;0xd9b67a26&lt;&#x2F;code&gt; is passed through the &lt;code&gt;interfaceID&lt;&#x2F;code&gt; argument.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.5.9&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-1155 Multi Token Standard&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-1155&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: The ERC-165 identifier for this interface is 0xd9b67a26.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC1155&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is ERC165 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Either `TransferSingle` or `TransferBatch` MUST emit when tokens are transferred, including zero value transfers as well as minting or burning (see &amp;quot;Safe Transfer Rules&amp;quot; section of the standard).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        The `_operator` argument MUST be the address of an account&#x2F;contract that is approved to make the transfer (SHOULD be msg.sender).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        The `_from` argument MUST be the address of the holder whose balance is decreased.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        The `_to` argument MUST be the address of the recipient whose balance is increased.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        The `_id` argument MUST be the token type being transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        The `_value` argument MUST be the number of tokens the holder balance is decreased by and match what the recipient balance is increased by.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        When minting&#x2F;creating tokens, the `_from` argument MUST be set to `0x0` (i.e. zero address).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        When burning&#x2F;destroying tokens, the `_to` argument MUST be set to `0x0` (i.e. zero address).        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransferSingle&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Either `TransferSingle` or `TransferBatch` MUST emit when tokens are transferred, including zero value transfers as well as minting or burning (see &amp;quot;Safe Transfer Rules&amp;quot; section of the standard).      &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        The `_operator` argument MUST be the address of an account&#x2F;contract that is approved to make the transfer (SHOULD be msg.sender).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        The `_from` argument MUST be the address of the holder whose balance is decreased.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        The `_to` argument MUST be the address of the recipient whose balance is increased.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        The `_ids` argument MUST be the list of tokens being transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        The `_values` argument MUST be the list of number of tokens (matching the list and order of tokens specified in _ids) the holder balance is decreased by and match what the recipient balance is increased by.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        When minting&#x2F;creating tokens, the `_from` argument MUST be set to `0x0` (i.e. zero address).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        When burning&#x2F;destroying tokens, the `_to` argument MUST be set to `0x0` (i.e. zero address).                &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransferBatch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _ids&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _values&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST emit when approval for a second party&#x2F;operator address to manage all tokens for an owner address is enabled or disabled (absence of an event assumes disabled).        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ApprovalForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST emit when the URI is updated for a token ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        URIs are defined in RFC 3986.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        The URI MUST point to a JSON file that conforms to the &amp;quot;ERC-1155 Metadata URI JSON Schema&amp;quot;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; URI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfers `_value` amount of an `_id` from the `_from` address to the `_to` address specified (with safety call).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Caller must be approved to manage the tokens being transferred out of the `_from` account (see &amp;quot;Approval&amp;quot; section of the standard).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        MUST revert if `_to` is the zero address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        MUST revert if balance of holder for token `_id` is lower than the `_value` sent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        MUST revert on any other error.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        MUST emit the `TransferSingle` event to reflect the balance change (see &amp;quot;Safe Transfer Rules&amp;quot; section of the standard).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        After the above conditions are met, this function MUST check if `_to` is a smart contract (e.g. code size &amp;gt; 0). If so, it MUST call `onERC1155Received` on `_to` and act appropriately (see &amp;quot;Safe Transfer Rules&amp;quot; section of the standard).        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    Source address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      Target address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      ID of the token type&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   Transfer amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    Additional data with no specified format, MUST be sent unaltered in call to `onERC1155Received` on `_to`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfers `_values` amount(s) of `_ids` from the `_from` address to the `_to` address specified (with safety call).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Caller must be approved to manage the tokens being transferred out of the `_from` account (see &amp;quot;Approval&amp;quot; section of the standard).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        MUST revert if `_to` is the zero address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        MUST revert if length of `_ids` is not the same as length of `_values`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        MUST revert if any of the balance(s) of the holder(s) for token(s) in `_ids` is lower than the respective amount(s) in `_values` sent to the recipient.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        MUST revert on any other error.        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        MUST emit `TransferSingle` or `TransferBatch` event(s) such that all the balance changes are reflected (see &amp;quot;Safe Transfer Rules&amp;quot; section of the standard).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        Balance changes and events MUST follow the ordering of the arrays (_ids[0]&#x2F;_values[0] before _ids[1]&#x2F;_values[1], etc).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        After the above conditions for the transfer(s) in the batch are met, this function MUST check if `_to` is a smart contract (e.g. code size &amp;gt; 0). If so, it MUST call the relevant `ERC1155TokenReceiver` hook(s) on `_to` and act appropriately (see &amp;quot;Safe Transfer Rules&amp;quot; section of the standard).                      &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    Source address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      Target address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _ids&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     IDs of each token type (order and length must match _values array)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _values&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  Transfer amounts per token type (order and length must match _ids array)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    Additional data with no specified format, MUST be sent unaltered in call to the `ERC1155TokenReceiver` hook(s) on `_to`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeBatchTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _ids&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _values&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the balance of an account&amp;#39;s tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  The address of the token holder&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     ID of the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; _owner&amp;#39;s balance of the token type requested&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the balance of multiple account&#x2F;token pairs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _owners&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The addresses of the token holders&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _ids&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    ID of the tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; _owner&amp;#39;s balance of the token types requested (i.e. balance for each (owner, id) pair)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOfBatch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owners&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _ids&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Enable or disable approval for a third party (&amp;quot;operator&amp;quot;) to manage all of the caller&amp;#39;s tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MUST emit the ApprovalForAll event on success.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  Address to add to the set of authorized operators&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  True if the operator is approved, false to revoke approval&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setApprovalForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Queries the approval status of an operator for a given owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     The owner of the tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  Address of authorized operator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;           True&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if the operator is approved, false if not&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isApprovedForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;erc-1155-token-receiver&quot;&gt;ERC-1155 Token Receiver&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;Smart contracts MUST implement all of the functions in the &lt;code&gt;ERC1155TokenReceiver&lt;&#x2F;code&gt; interface to accept transfers. See &quot;Safe Transfer Rules&quot; for further detail.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Smart contracts MUST implement the ERC-165 &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; function and signify support for the &lt;code&gt;ERC1155TokenReceiver&lt;&#x2F;code&gt; interface to accept transfers. See &quot;ERC1155TokenReceiver ERC-165 rules&quot; for further detail.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.5.9&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: The ERC-165 identifier for this interface is 0x4e2312e0.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC1155TokenReceiver&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Handle the receipt of a single ERC1155 token type.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An ERC1155-compliant smart contract MUST call this function on the token recipient contract, at the end of a `safeTransferFrom` after the balance has been updated.        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        This function MUST return `bytes4(keccak256(&amp;quot;onERC1155Received(address,address,uint256,uint256,bytes)&amp;quot;))` (i.e. 0xf23a6e61) if it accepts the transfer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        This function MUST revert if it rejects the transfer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        Return of any other value than the prescribed keccak256 generated value MUST result in the transaction being reverted by the caller.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  The address which initiated the transfer (i.e. msg.sender)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      The address which previously owned the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;        The ID of the token being transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     The amount of tokens being transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      Additional data with no specified format&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;           `bytes4(keccak256(&amp;quot;onERC1155Received(address,address,uint256,uint256,bytes)&amp;quot;))`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onERC1155Received&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Handle the receipt of multiple ERC1155 token types.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An ERC1155-compliant smart contract MUST call this function on the token recipient contract, at the end of a `safeBatchTransferFrom` after the balances have been updated.        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        This function MUST return `bytes4(keccak256(&amp;quot;onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)&amp;quot;))` (i.e. 0xbc197c81) if it accepts the transfer(s).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        This function MUST revert if it rejects the transfer(s).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        Return of any other value than the prescribed keccak256 generated value MUST result in the transaction being reverted by the caller.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  The address which initiated the batch transfer (i.e. msg.sender)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      The address which previously owned the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _ids&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;       An array containing ids of each token being transferred (order and length must match _values array)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _values&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    An array containing amounts of each token being transferred (order and length must match _ids array)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      Additional data with no specified format&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;           `bytes4(keccak256(&amp;quot;onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)&amp;quot;))`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onERC1155BatchReceived&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _ids&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _values&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;       &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;safe-transfer-rules&quot;&gt;Safe Transfer Rules&lt;&#x2F;h3&gt;
&lt;p&gt;To be more explicit about how the standard &lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt; and &lt;code&gt;safeBatchTransferFrom&lt;&#x2F;code&gt; functions MUST operate with respect to the &lt;code&gt;ERC1155TokenReceiver&lt;&#x2F;code&gt; hook functions, a list of scenarios and rules follows.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;scenarios&quot;&gt;Scenarios&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Scenario#1 :&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt; The recipient is not a contract.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;onERC1155Received&lt;&#x2F;code&gt; and &lt;code&gt;onERC1155BatchReceived&lt;&#x2F;code&gt; MUST NOT be called on an EOA (Externally Owned Account).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Scenario#2 :&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt; The transaction is not a mint&#x2F;transfer of a token.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;onERC1155Received&lt;&#x2F;code&gt; and &lt;code&gt;onERC1155BatchReceived&lt;&#x2F;code&gt; MUST NOT be called outside of a mint or transfer process.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Scenario#3 :&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt; The receiver does not implement the necessary &lt;code&gt;ERC1155TokenReceiver&lt;&#x2F;code&gt; interface function(s).&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The transfer MUST be reverted with the one caveat below.
&lt;ul&gt;
&lt;li&gt;If the token(s) being sent are part of a hybrid implementation of another standard, that particular standard&#x27;s rules on sending to a contract MAY now be followed instead. See &quot;Backwards Compatibility&quot; section.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Scenario#4 :&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt; The receiver implements the necessary &lt;code&gt;ERC1155TokenReceiver&lt;&#x2F;code&gt; interface function(s) but returns an unknown value.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The transfer MUST be reverted.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Scenario#5 :&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt; The receiver implements the necessary &lt;code&gt;ERC1155TokenReceiver&lt;&#x2F;code&gt; interface function(s) but throws an error.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The transfer MUST be reverted.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Scenario#6 :&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt; The receiver implements the &lt;code&gt;ERC1155TokenReceiver&lt;&#x2F;code&gt; interface and is the recipient of one and only one balance change (e.g. &lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt; called).&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The balances for the transfer MUST have been updated before the &lt;code&gt;ERC1155TokenReceiver&lt;&#x2F;code&gt; hook is called on a recipient contract.&lt;&#x2F;li&gt;
&lt;li&gt;The transfer event MUST have been emitted to reflect the balance changes before the &lt;code&gt;ERC1155TokenReceiver&lt;&#x2F;code&gt; hook is called on the recipient contract.&lt;&#x2F;li&gt;
&lt;li&gt;One of &lt;code&gt;onERC1155Received&lt;&#x2F;code&gt; or &lt;code&gt;onERC1155BatchReceived&lt;&#x2F;code&gt; MUST be called on the recipient contract.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;onERC1155Received&lt;&#x2F;code&gt; hook SHOULD be called on the recipient contract and its rules followed.
&lt;ul&gt;
&lt;li&gt;See &quot;onERC1155Received rules&quot; for further rules that MUST be followed.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;onERC1155BatchReceived&lt;&#x2F;code&gt; hook MAY be called on the recipient contract and its rules followed.
&lt;ul&gt;
&lt;li&gt;See &quot;onERC1155BatchReceived rules&quot; for further rules that MUST be followed.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Scenario#7 :&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt; The receiver implements the &lt;code&gt;ERC1155TokenReceiver&lt;&#x2F;code&gt; interface and is the recipient of more than one balance change (e.g. &lt;code&gt;safeBatchTransferFrom&lt;&#x2F;code&gt; called).&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;All balance transfers that are referenced in a call to an &lt;code&gt;ERC1155TokenReceiver&lt;&#x2F;code&gt; hook MUST be updated before the &lt;code&gt;ERC1155TokenReceiver&lt;&#x2F;code&gt; hook is called on the recipient contract.&lt;&#x2F;li&gt;
&lt;li&gt;All transfer events MUST have been emitted to reflect current balance changes before an &lt;code&gt;ERC1155TokenReceiver&lt;&#x2F;code&gt; hook is called on the recipient contract.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;onERC1155Received&lt;&#x2F;code&gt; or &lt;code&gt;onERC1155BatchReceived&lt;&#x2F;code&gt; MUST be called on the recipient as many times as necessary such that every balance change for the recipient in the scenario is accounted for.
&lt;ul&gt;
&lt;li&gt;The return magic value for every hook call MUST be checked and acted upon as per &quot;onERC1155Received rules&quot; and &quot;onERC1155BatchReceived rules&quot;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;onERC1155BatchReceived&lt;&#x2F;code&gt; hook SHOULD be called on the recipient contract and its rules followed.
&lt;ul&gt;
&lt;li&gt;See &quot;onERC1155BatchReceived rules&quot; for further rules that MUST be followed.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;onERC1155Received&lt;&#x2F;code&gt; hook MAY be called on the recipient contract and its rules followed.
&lt;ul&gt;
&lt;li&gt;See &quot;onERC1155Received rules&quot; for further rules that MUST be followed.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Scenario#8 :&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt; You are the creator of a contract that implements the &lt;code&gt;ERC1155TokenReceiver&lt;&#x2F;code&gt; interface and you forward the token(s) onto another address in one or both of &lt;code&gt;onERC1155Received&lt;&#x2F;code&gt; and &lt;code&gt;onERC1155BatchReceived&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Forwarding should be considered acceptance and then initiating a new &lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt; or &lt;code&gt;safeBatchTransferFrom&lt;&#x2F;code&gt; in a new context.
&lt;ul&gt;
&lt;li&gt;The prescribed keccak256 acceptance value magic for the receiver hook being called MUST be returned after forwarding is successful.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;_data&lt;&#x2F;code&gt; argument MAY be re-purposed for the new context.&lt;&#x2F;li&gt;
&lt;li&gt;If forwarding fails the transaction MAY be reverted.
&lt;ul&gt;
&lt;li&gt;If the contract logic wishes to keep the ownership of the token(s) itself in this case it MAY do so.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Scenario#9 :&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt; You are transferring tokens via a non-standard API call i.e. an implementation specific API and NOT &lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt; or &lt;code&gt;safeBatchTransferFrom&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;In this scenario all balance updates and events output rules are the same as if a standard transfer function had been called.
&lt;ul&gt;
&lt;li&gt;i.e. an external viewer MUST still be able to query the balance via a standard function and it MUST be identical to the balance as determined by &lt;code&gt;TransferSingle&lt;&#x2F;code&gt; and &lt;code&gt;TransferBatch&lt;&#x2F;code&gt; events alone.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;If the receiver is a contract the &lt;code&gt;ERC1155TokenReceiver&lt;&#x2F;code&gt; hooks still need to be called on it and the return values respected the same as if a standard transfer function had been called.
&lt;ul&gt;
&lt;li&gt;However while the &lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt; or &lt;code&gt;safeBatchTransferFrom&lt;&#x2F;code&gt; functions MUST revert if a receiving contract does not implement the &lt;code&gt;ERC1155TokenReceiver&lt;&#x2F;code&gt; interface, a non-standard function MAY proceed with the transfer.&lt;&#x2F;li&gt;
&lt;li&gt;See &quot;Implementation specific transfer API rules&quot;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;rules&quot;&gt;Rules&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;safeTransferFrom rules:&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Caller must be approved to manage the tokens being transferred out of the &lt;code&gt;_from&lt;&#x2F;code&gt; account (see &quot;Approval&quot; section).&lt;&#x2F;li&gt;
&lt;li&gt;MUST revert if &lt;code&gt;_to&lt;&#x2F;code&gt; is the zero address.&lt;&#x2F;li&gt;
&lt;li&gt;MUST revert if balance of holder for token &lt;code&gt;_id&lt;&#x2F;code&gt; is lower than the &lt;code&gt;_value&lt;&#x2F;code&gt; sent to the recipient.&lt;&#x2F;li&gt;
&lt;li&gt;MUST revert on any other error.&lt;&#x2F;li&gt;
&lt;li&gt;MUST emit the &lt;code&gt;TransferSingle&lt;&#x2F;code&gt; event to reflect the balance change (see &quot;TransferSingle and TransferBatch event rules&quot; section).&lt;&#x2F;li&gt;
&lt;li&gt;After the above conditions are met, this function MUST check if &lt;code&gt;_to&lt;&#x2F;code&gt; is a smart contract (e.g. code size &amp;gt; 0). If so, it MUST call &lt;code&gt;onERC1155Received&lt;&#x2F;code&gt; on &lt;code&gt;_to&lt;&#x2F;code&gt; and act appropriately (see &quot;onERC1155Received rules&quot; section).
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;_data&lt;&#x2F;code&gt; argument provided by the sender for the transfer MUST be passed with its contents unaltered to the &lt;code&gt;onERC1155Received&lt;&#x2F;code&gt; hook function via its &lt;code&gt;_data&lt;&#x2F;code&gt; argument.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;safeBatchTransferFrom rules:&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Caller must be approved to manage all the tokens being transferred out of the &lt;code&gt;_from&lt;&#x2F;code&gt; account (see &quot;Approval&quot; section).&lt;&#x2F;li&gt;
&lt;li&gt;MUST revert if &lt;code&gt;_to&lt;&#x2F;code&gt; is the zero address.&lt;&#x2F;li&gt;
&lt;li&gt;MUST revert if length of &lt;code&gt;_ids&lt;&#x2F;code&gt; is not the same as length of &lt;code&gt;_values&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;MUST revert if any of the balance(s) of the holder(s) for token(s) in &lt;code&gt;_ids&lt;&#x2F;code&gt; is lower than the respective amount(s) in &lt;code&gt;_values&lt;&#x2F;code&gt; sent to the recipient.&lt;&#x2F;li&gt;
&lt;li&gt;MUST revert on any other error.&lt;&#x2F;li&gt;
&lt;li&gt;MUST emit &lt;code&gt;TransferSingle&lt;&#x2F;code&gt; or &lt;code&gt;TransferBatch&lt;&#x2F;code&gt; event(s) such that all the balance changes are reflected (see &quot;TransferSingle and TransferBatch event rules&quot; section).&lt;&#x2F;li&gt;
&lt;li&gt;The balance changes and events MUST occur in the array order they were submitted (_ids[0]&#x2F;_values[0] before _ids[1]&#x2F;_values[1], etc).&lt;&#x2F;li&gt;
&lt;li&gt;After the above conditions are met, this function MUST check if &lt;code&gt;_to&lt;&#x2F;code&gt; is a smart contract (e.g. code size &amp;gt; 0). If so, it MUST call &lt;code&gt;onERC1155Received&lt;&#x2F;code&gt; or &lt;code&gt;onERC1155BatchReceived&lt;&#x2F;code&gt; on &lt;code&gt;_to&lt;&#x2F;code&gt; and act appropriately (see &quot;onERC1155Received and onERC1155BatchReceived rules&quot; section).
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;_data&lt;&#x2F;code&gt; argument provided by the sender for the transfer MUST be passed with its contents unaltered to the &lt;code&gt;ERC1155TokenReceiver&lt;&#x2F;code&gt; hook function(s) via their &lt;code&gt;_data&lt;&#x2F;code&gt; argument.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;TransferSingle and TransferBatch event rules:&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;TransferSingle&lt;&#x2F;code&gt; SHOULD be used to indicate a single balance transfer has occurred between a &lt;code&gt;_from&lt;&#x2F;code&gt; and &lt;code&gt;_to&lt;&#x2F;code&gt; pair.
&lt;ul&gt;
&lt;li&gt;It MAY be emitted multiple times to indicate multiple balance changes in the transaction, but note that &lt;code&gt;TransferBatch&lt;&#x2F;code&gt; is designed for this to reduce gas consumption.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;_operator&lt;&#x2F;code&gt; argument MUST be the address of an account&#x2F;contract that is approved to make the transfer (SHOULD be msg.sender).&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;_from&lt;&#x2F;code&gt; argument MUST be the address of the holder whose balance is decreased.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;_to&lt;&#x2F;code&gt; argument MUST be the address of the recipient whose balance is increased.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;_id&lt;&#x2F;code&gt; argument MUST be the token type being transferred.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;_value&lt;&#x2F;code&gt; argument MUST be the number of tokens the holder balance is decreased by and match what the recipient balance is increased by.&lt;&#x2F;li&gt;
&lt;li&gt;When minting&#x2F;creating tokens, the &lt;code&gt;_from&lt;&#x2F;code&gt; argument MUST be set to &lt;code&gt;0x0&lt;&#x2F;code&gt; (i.e. zero address). See &quot;Minting&#x2F;creating and burning&#x2F;destroying rules&quot;.&lt;&#x2F;li&gt;
&lt;li&gt;When burning&#x2F;destroying tokens, the &lt;code&gt;_to&lt;&#x2F;code&gt; argument MUST be set to &lt;code&gt;0x0&lt;&#x2F;code&gt; (i.e. zero address). See &quot;Minting&#x2F;creating and burning&#x2F;destroying rules&quot;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TransferBatch&lt;&#x2F;code&gt; SHOULD be used to indicate multiple balance transfers have occurred between a &lt;code&gt;_from&lt;&#x2F;code&gt; and &lt;code&gt;_to&lt;&#x2F;code&gt; pair.
&lt;ul&gt;
&lt;li&gt;It MAY be emitted with a single element in the list to indicate a singular balance change in the transaction, but note that &lt;code&gt;TransferSingle&lt;&#x2F;code&gt; is designed for this to reduce gas consumption.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;_operator&lt;&#x2F;code&gt; argument MUST be the address of an account&#x2F;contract that is approved to make the transfer (SHOULD be msg.sender).&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;_from&lt;&#x2F;code&gt; argument MUST be the address of the holder whose balance is decreased for each entry pair in &lt;code&gt;_ids&lt;&#x2F;code&gt; and &lt;code&gt;_values&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;_to&lt;&#x2F;code&gt; argument MUST be the address of the recipient whose balance is increased for each entry pair in &lt;code&gt;_ids&lt;&#x2F;code&gt; and &lt;code&gt;_values&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;_ids&lt;&#x2F;code&gt; array argument MUST contain the ids of the tokens being transferred.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;_values&lt;&#x2F;code&gt; array argument MUST contain the number of token to be transferred for each corresponding entry in &lt;code&gt;_ids&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;_ids&lt;&#x2F;code&gt; and &lt;code&gt;_values&lt;&#x2F;code&gt; MUST have the same length.&lt;&#x2F;li&gt;
&lt;li&gt;When minting&#x2F;creating tokens, the &lt;code&gt;_from&lt;&#x2F;code&gt; argument MUST be set to &lt;code&gt;0x0&lt;&#x2F;code&gt; (i.e. zero address). See &quot;Minting&#x2F;creating and burning&#x2F;destroying rules&quot;.&lt;&#x2F;li&gt;
&lt;li&gt;When burning&#x2F;destroying tokens, the &lt;code&gt;_to&lt;&#x2F;code&gt; argument MUST be set to &lt;code&gt;0x0&lt;&#x2F;code&gt; (i.e. zero address). See &quot;Minting&#x2F;creating and burning&#x2F;destroying rules&quot;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The total value transferred from address &lt;code&gt;0x0&lt;&#x2F;code&gt; minus the total value transferred to &lt;code&gt;0x0&lt;&#x2F;code&gt; observed via the &lt;code&gt;TransferSingle&lt;&#x2F;code&gt; and &lt;code&gt;TransferBatch&lt;&#x2F;code&gt; events MAY be used by clients and exchanges to determine the &quot;circulating supply&quot; for a given token ID.&lt;&#x2F;li&gt;
&lt;li&gt;To broadcast the existence of a token ID with no initial balance, the contract SHOULD emit the &lt;code&gt;TransferSingle&lt;&#x2F;code&gt; event from &lt;code&gt;0x0&lt;&#x2F;code&gt; to &lt;code&gt;0x0&lt;&#x2F;code&gt;, with the token creator as &lt;code&gt;_operator&lt;&#x2F;code&gt;, and a &lt;code&gt;_value&lt;&#x2F;code&gt; of 0.&lt;&#x2F;li&gt;
&lt;li&gt;All &lt;code&gt;TransferSingle&lt;&#x2F;code&gt; and &lt;code&gt;TransferBatch&lt;&#x2F;code&gt; events MUST be emitted to reflect all the balance changes that have occurred before any call(s) to &lt;code&gt;onERC1155Received&lt;&#x2F;code&gt; or &lt;code&gt;onERC1155BatchReceived&lt;&#x2F;code&gt;.
&lt;ul&gt;
&lt;li&gt;To make sure event order is correct in the case of valid re-entry (e.g. if a receiver contract forwards tokens on receipt) state balance and events balance MUST match before calling an external contract.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;onERC1155Received rules:&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;_operator&lt;&#x2F;code&gt; argument MUST be the address of an account&#x2F;contract that is approved to make the transfer (SHOULD be msg.sender).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;_from&lt;&#x2F;code&gt; argument MUST be the address of the holder whose balance is decreased.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;_from&lt;&#x2F;code&gt; MUST be 0x0 for a mint.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;_id&lt;&#x2F;code&gt; argument MUST be the token type being transferred.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;_value&lt;&#x2F;code&gt; argument MUST be the number of tokens the holder balance is decreased by and match what the recipient balance is increased by.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;_data&lt;&#x2F;code&gt; argument MUST contain the information provided by the sender for the transfer with its contents unaltered.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;i.e. it MUST pass on the unaltered &lt;code&gt;_data&lt;&#x2F;code&gt; argument sent via the &lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt; or &lt;code&gt;safeBatchTransferFrom&lt;&#x2F;code&gt; call for this transfer.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The recipient contract MAY accept an increase of its balance by returning the acceptance magic value &lt;code&gt;bytes4(keccak256(&quot;onERC1155Received(address,address,uint256,uint256,bytes)&quot;))&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If the return value is &lt;code&gt;bytes4(keccak256(&quot;onERC1155Received(address,address,uint256,uint256,bytes)&quot;))&lt;&#x2F;code&gt; the transfer MUST be completed or MUST revert if any other conditions are not met for success.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The recipient contract MAY reject an increase of its balance by calling revert.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If the recipient contract throws&#x2F;reverts the transaction MUST be reverted.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;If the return value is anything other than &lt;code&gt;bytes4(keccak256(&quot;onERC1155Received(address,address,uint256,uint256,bytes)&quot;))&lt;&#x2F;code&gt; the transaction MUST be reverted.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;onERC1155Received&lt;&#x2F;code&gt; (and&#x2F;or &lt;code&gt;onERC1155BatchReceived&lt;&#x2F;code&gt;) MAY be called multiple times in a single transaction and the following requirements must be met:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;All callbacks represent mutually exclusive balance changes.&lt;&#x2F;li&gt;
&lt;li&gt;The set of all calls to &lt;code&gt;onERC1155Received&lt;&#x2F;code&gt; and &lt;code&gt;onERC1155BatchReceived&lt;&#x2F;code&gt; describes all balance changes that occurred during the transaction in the order submitted.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;A contract MAY skip calling the &lt;code&gt;onERC1155Received&lt;&#x2F;code&gt; hook function if the transfer operation is transferring the token to itself.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;onERC1155BatchReceived rules:&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;_operator&lt;&#x2F;code&gt; argument MUST be the address of an account&#x2F;contract that is approved to make the transfer (SHOULD be msg.sender).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;_from&lt;&#x2F;code&gt; argument MUST be the address of the holder whose balance is decreased.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;_from&lt;&#x2F;code&gt; MUST be 0x0 for a mint.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;_ids&lt;&#x2F;code&gt; argument MUST be the list of tokens being transferred.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;_values&lt;&#x2F;code&gt; argument MUST be the list of number of tokens (matching the list and order of tokens specified in &lt;code&gt;_ids&lt;&#x2F;code&gt;) the holder balance is decreased by and match what the recipient balance is increased by.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;_data&lt;&#x2F;code&gt; argument MUST contain the information provided by the sender for the transfer with its contents unaltered.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;i.e. it MUST pass on the unaltered &lt;code&gt;_data&lt;&#x2F;code&gt; argument sent via the &lt;code&gt;safeBatchTransferFrom&lt;&#x2F;code&gt; call for this transfer.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The recipient contract MAY accept an increase of its balance by returning the acceptance magic value &lt;code&gt;bytes4(keccak256(&quot;onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)&quot;))&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If the return value is &lt;code&gt;bytes4(keccak256(&quot;onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)&quot;))&lt;&#x2F;code&gt; the transfer MUST be completed or MUST revert if any other conditions are not met for success.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The recipient contract MAY reject an increase of its balance by calling revert.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If the recipient contract throws&#x2F;reverts the transaction MUST be reverted.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;If the return value is anything other than &lt;code&gt;bytes4(keccak256(&quot;onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)&quot;))&lt;&#x2F;code&gt; the transaction MUST be reverted.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;onERC1155BatchReceived&lt;&#x2F;code&gt; (and&#x2F;or &lt;code&gt;onERC1155Received&lt;&#x2F;code&gt;) MAY be called multiple times in a single transaction and the following requirements must be met:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;All callbacks represent mutually exclusive balance changes.&lt;&#x2F;li&gt;
&lt;li&gt;The set of all calls to &lt;code&gt;onERC1155Received&lt;&#x2F;code&gt; and &lt;code&gt;onERC1155BatchReceived&lt;&#x2F;code&gt; describes all balance changes that occurred during the transaction in the order submitted.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;A contract MAY skip calling the &lt;code&gt;onERC1155BatchReceived&lt;&#x2F;code&gt; hook function if the transfer operation is transferring the token(s) to itself.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;ERC1155TokenReceiver ERC-165 rules:&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The implementation of the ERC-165 &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; function SHOULD be as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt;  interfaceID &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x01ffc9a7&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-165 support (i.e. `bytes4(keccak256(&amp;#39;supportsInterface(bytes4)&amp;#39;))`).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            interfaceID &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x4e2312e0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-1155 `ERC1155TokenReceiver` support (i.e. `bytes4(keccak256(&amp;quot;onERC1155Received(address,address,uint256,uint256,bytes)&amp;quot;)) ^ bytes4(keccak256(&amp;quot;onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)&amp;quot;))`).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The implementation MAY differ from the above but:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;It MUST return the constant value &lt;code&gt;true&lt;&#x2F;code&gt; if &lt;code&gt;0x01ffc9a7&lt;&#x2F;code&gt; is passed through the &lt;code&gt;interfaceID&lt;&#x2F;code&gt; argument. This signifies ERC-165 support.&lt;&#x2F;li&gt;
&lt;li&gt;It MUST return the constant value &lt;code&gt;true&lt;&#x2F;code&gt; if &lt;code&gt;0x4e2312e0&lt;&#x2F;code&gt; is passed through the &lt;code&gt;interfaceID&lt;&#x2F;code&gt; argument. This signifies ERC-1155 &lt;code&gt;ERC1155TokenReceiver&lt;&#x2F;code&gt; support.&lt;&#x2F;li&gt;
&lt;li&gt;It MUST NOT consume more than 10,000 gas.
&lt;ul&gt;
&lt;li&gt;This keeps it below the ERC-165 requirement of 30,000 gas, reduces the gas reserve needs and minimises possible side-effects of gas exhaustion during the call.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Implementation specific transfer API rules:&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If an implementation specific API function is used to transfer ERC-1155 token(s) to a contract, the &lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt; or &lt;code&gt;safeBatchTransferFrom&lt;&#x2F;code&gt; (as appropriate) rules MUST still be followed if the receiver implements the &lt;code&gt;ERC1155TokenReceiver&lt;&#x2F;code&gt; interface. If it does not the non-standard implementation SHOULD revert but MAY proceed.&lt;&#x2F;li&gt;
&lt;li&gt;An example:
&lt;ol&gt;
&lt;li&gt;An approved user calls a function such as &lt;code&gt;function myTransferFrom(address _from, address _to, uint256[] calldata _ids, uint256[] calldata _values);&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;myTransferFrom&lt;&#x2F;code&gt; updates the balances for &lt;code&gt;_from&lt;&#x2F;code&gt; and &lt;code&gt;_to&lt;&#x2F;code&gt; addresses for all &lt;code&gt;_ids&lt;&#x2F;code&gt; and &lt;code&gt;_values&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;myTransferFrom&lt;&#x2F;code&gt; emits &lt;code&gt;TransferBatch&lt;&#x2F;code&gt; with the details of what was transferred from address &lt;code&gt;_from&lt;&#x2F;code&gt; to address &lt;code&gt;_to&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;myTransferFrom&lt;&#x2F;code&gt; checks if &lt;code&gt;_to&lt;&#x2F;code&gt; is a contract address and determines that it is so (if not, then the transfer can be considered successful).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;myTransferFrom&lt;&#x2F;code&gt; calls &lt;code&gt;onERC1155BatchReceived&lt;&#x2F;code&gt; on &lt;code&gt;_to&lt;&#x2F;code&gt; and it reverts or returns an unknown value (if it had returned &lt;code&gt;bytes4(keccak256(&quot;onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)&quot;))&lt;&#x2F;code&gt; the transfer can be considered successful).&lt;&#x2F;li&gt;
&lt;li&gt;At this point &lt;code&gt;myTransferFrom&lt;&#x2F;code&gt; SHOULD revert the transaction immediately as receipt of the token(s) was not explicitly accepted by the &lt;code&gt;onERC1155BatchReceived&lt;&#x2F;code&gt; function.&lt;&#x2F;li&gt;
&lt;li&gt;If however &lt;code&gt;myTransferFrom&lt;&#x2F;code&gt; wishes to continue it MUST call &lt;code&gt;supportsInterface(0x4e2312e0)&lt;&#x2F;code&gt; on &lt;code&gt;_to&lt;&#x2F;code&gt; and if it returns the constant value &lt;code&gt;true&lt;&#x2F;code&gt; the transaction MUST be reverted, as it is now known to be a valid receiver and the previous acceptance step failed.
&lt;ul&gt;
&lt;li&gt;NOTE: You could have called &lt;code&gt;supportsInterface(0x4e2312e0)&lt;&#x2F;code&gt; at a previous step if you wanted to gather and act upon that information earlier, such as in a hybrid standards scenario.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;If the above call to &lt;code&gt;supportsInterface(0x4e2312e0)&lt;&#x2F;code&gt; on &lt;code&gt;_to&lt;&#x2F;code&gt; reverts or returns a value other than the constant value &lt;code&gt;true&lt;&#x2F;code&gt; the &lt;code&gt;myTransferFrom&lt;&#x2F;code&gt; function MAY consider this transfer successful.
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;NOTE&lt;&#x2F;strong&gt;: this MAY result in unrecoverable tokens if sent to an address that does not expect to receive ERC-1155 tokens.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The above example is not exhaustive but illustrates the major points (and shows that most are shared with &lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt; and &lt;code&gt;safeBatchTransferFrom&lt;&#x2F;code&gt;):
&lt;ul&gt;
&lt;li&gt;Balances that are updated MUST have equivalent transfer events emitted.&lt;&#x2F;li&gt;
&lt;li&gt;A receiver address has to be checked if it is a contract and if so relevant &lt;code&gt;ERC1155TokenReceiver&lt;&#x2F;code&gt; hook function(s) have to be called on it.&lt;&#x2F;li&gt;
&lt;li&gt;Balances (and events associated) that are referenced in a call to an &lt;code&gt;ERC1155TokenReceiver&lt;&#x2F;code&gt; hook MUST be updated (and emitted) before the &lt;code&gt;ERC1155TokenReceiver&lt;&#x2F;code&gt; hook is called.&lt;&#x2F;li&gt;
&lt;li&gt;The return values of the &lt;code&gt;ERC1155TokenReceiver&lt;&#x2F;code&gt; hook functions that are called MUST be respected if they are implemented.&lt;&#x2F;li&gt;
&lt;li&gt;Only non-standard transfer functions MAY allow tokens to be sent to a recipient contract that does NOT implement the necessary &lt;code&gt;ERC1155TokenReceiver&lt;&#x2F;code&gt; hook functions. &lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt; and &lt;code&gt;safeBatchTransferFrom&lt;&#x2F;code&gt; MUST revert in that case (unless it is a hybrid standards implementation see &quot;Backwards Compatibility&quot;).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Minting&#x2F;creating and burning&#x2F;destroying rules:&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A mint&#x2F;create operation is essentially a specialized transfer and MUST follow these rules:
&lt;ul&gt;
&lt;li&gt;To broadcast the existence of a token ID with no initial balance, the contract SHOULD emit the &lt;code&gt;TransferSingle&lt;&#x2F;code&gt; event from &lt;code&gt;0x0&lt;&#x2F;code&gt; to &lt;code&gt;0x0&lt;&#x2F;code&gt;, with the token creator as &lt;code&gt;_operator&lt;&#x2F;code&gt;, and a &lt;code&gt;_value&lt;&#x2F;code&gt; of 0.&lt;&#x2F;li&gt;
&lt;li&gt;The &quot;TransferSingle and TransferBatch event rules&quot; MUST be followed as appropriate for the mint(s) (i.e. singles or batches) however the &lt;code&gt;_from&lt;&#x2F;code&gt; argument MUST be set to &lt;code&gt;0x0&lt;&#x2F;code&gt; (i.e. zero address) to flag the transfer as a mint to contract observers.
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;NOTE:&lt;&#x2F;strong&gt; This includes tokens that are given an initial balance in the contract. The balance of the contract MUST also be able to be determined by events alone meaning initial contract balances (for eg. in construction) MUST emit events to reflect those balances too.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;A burn&#x2F;destroy operation is essentially a specialized transfer and MUST follow these rules:
&lt;ul&gt;
&lt;li&gt;The &quot;TransferSingle and TransferBatch event rules&quot; MUST be followed as appropriate for the burn(s) (i.e. singles or batches) however the &lt;code&gt;_to&lt;&#x2F;code&gt; argument MUST be set to &lt;code&gt;0x0&lt;&#x2F;code&gt; (i.e. zero address) to flag the transfer as a burn to contract observers.&lt;&#x2F;li&gt;
&lt;li&gt;When burning&#x2F;destroying you do not have to actually transfer to &lt;code&gt;0x0&lt;&#x2F;code&gt; (that is impl specific), only the &lt;code&gt;_to&lt;&#x2F;code&gt; argument in the event MUST be set to &lt;code&gt;0x0&lt;&#x2F;code&gt; as above.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The total value transferred from address &lt;code&gt;0x0&lt;&#x2F;code&gt; minus the total value transferred to &lt;code&gt;0x0&lt;&#x2F;code&gt; observed via the &lt;code&gt;TransferSingle&lt;&#x2F;code&gt; and &lt;code&gt;TransferBatch&lt;&#x2F;code&gt; events MAY be used by clients and exchanges to determine the &quot;circulating supply&quot; for a given token ID.&lt;&#x2F;li&gt;
&lt;li&gt;As mentioned above mint&#x2F;create and burn&#x2F;destroy operations are specialized transfers and so will likely be accomplished with custom transfer functions rather than &lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt; or &lt;code&gt;safeBatchTransferFrom&lt;&#x2F;code&gt;. If so the &quot;Implementation specific transfer API rules&quot; section would be appropriate.
&lt;ul&gt;
&lt;li&gt;Even in a non-safe API and&#x2F;or hybrid standards case the above event rules MUST still be adhered to when minting&#x2F;creating or burning&#x2F;destroying.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;A contract MAY skip calling the &lt;code&gt;ERC1155TokenReceiver&lt;&#x2F;code&gt; hook function(s) if the mint operation is transferring the token(s) to itself. In all other cases the &lt;code&gt;ERC1155TokenReceiver&lt;&#x2F;code&gt; rules MUST be followed as appropriate for the implementation (i.e. safe, custom and&#x2F;or hybrid).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;a-solidity-example-of-the-keccak256-generated-constants-for-the-various-magic-values-these-may-be-used-by-implementation&quot;&gt;A solidity example of the keccak256 generated constants for the various magic values (these MAY be used by implementation):&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; ERC1155_ERC165 &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xd9b67a26&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-165 identifier for the main token standard.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; ERC1155_ERC165_TOKENRECEIVER &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x4e2312e0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-165 identifier for the `ERC1155TokenReceiver` support (i.e. `bytes4(keccak256(&amp;quot;onERC1155Received(address,address,uint256,uint256,bytes)&amp;quot;)) ^ bytes4(keccak256(&amp;quot;onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)&amp;quot;))`).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; ERC1155_ACCEPTED &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xf23a6e61&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Return value from `onERC1155Received` call if a contract accepts receipt (i.e `bytes4(keccak256(&amp;quot;onERC1155Received(address,address,uint256,uint256,bytes)&amp;quot;))`).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; ERC1155_BATCH_ACCEPTED &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xbc197c81&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Return value from `onERC1155BatchReceived` call if a contract accepts receipt (i.e `bytes4(keccak256(&amp;quot;onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)&amp;quot;))`).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;metadata&quot;&gt;Metadata&lt;&#x2F;h3&gt;
&lt;p&gt;The URI value allows for ID substitution by clients. If the string &lt;code&gt;{id}&lt;&#x2F;code&gt; exists in any URI, clients MUST replace this with the actual token ID in hexadecimal form. This allows for a large number of tokens to use the same on-chain string by defining a URI once, for that large number of tokens.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The string format of the substituted hexadecimal ID MUST be lowercase alphanumeric: &lt;code&gt;[0-9a-f]&lt;&#x2F;code&gt; with no 0x prefix.&lt;&#x2F;li&gt;
&lt;li&gt;The string format of the substituted hexadecimal ID MUST be leading zero padded to 64 hex characters length if necessary.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Example of such a URI: &lt;code&gt;https:&#x2F;&#x2F;token-cdn-domain&#x2F;{id}.json&lt;&#x2F;code&gt; would be replaced with &lt;code&gt;https:&#x2F;&#x2F;token-cdn-domain&#x2F;000000000000000000000000000000000000000000000000000000000004cce0.json&lt;&#x2F;code&gt; if the client is referring to token ID 314592&#x2F;0x4CCE0.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;metadata-extensions&quot;&gt;Metadata Extensions&lt;&#x2F;h4&gt;
&lt;p&gt;The optional &lt;code&gt;ERC1155Metadata_URI&lt;&#x2F;code&gt; extension can be identified with the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165 Standard Interface Detection&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;If the optional &lt;code&gt;ERC1155Metadata_URI&lt;&#x2F;code&gt; extension is included:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The ERC-165 &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; function MUST return the constant value &lt;code&gt;true&lt;&#x2F;code&gt; if &lt;code&gt;0x0e89341c&lt;&#x2F;code&gt; is passed through the &lt;code&gt;interfaceID&lt;&#x2F;code&gt; argument.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;Changes&lt;&#x2F;em&gt; to the URI MUST emit the &lt;code&gt;URI&lt;&#x2F;code&gt; event if the change can be expressed with an event (i.e. it isn&#x27;t dynamic&#x2F;programmatic).
&lt;ul&gt;
&lt;li&gt;An implementation MAY emit the &lt;code&gt;URI&lt;&#x2F;code&gt; event during a mint operation but it is NOT mandatory. An observer MAY fetch the metadata uri at mint time from the &lt;code&gt;uri&lt;&#x2F;code&gt; function if it was not emitted.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;uri&lt;&#x2F;code&gt; function SHOULD be used to retrieve values if no event was emitted.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;uri&lt;&#x2F;code&gt; function MUST return the same value as the latest event for an &lt;code&gt;_id&lt;&#x2F;code&gt; if it was emitted.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;uri&lt;&#x2F;code&gt; function MUST NOT be used to check for the existence of a token as it is possible for an implementation to return a valid string even if the token does not exist.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.5.9&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: The ERC-165 identifier for this interface is 0x0e89341c.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC1155Metadata_URI&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A distinct Uniform Resource Identifier (URI) for a given token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; URIs are defined in RFC 3986.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        The URI MUST point to a JSON file that conforms to the &amp;quot;ERC-1155 Metadata URI JSON Schema&amp;quot;.        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; URI&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; string&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; uri&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;erc-1155-metadata-uri-json-schema&quot;&gt;ERC-1155 Metadata URI JSON Schema&lt;&#x2F;h4&gt;
&lt;p&gt;This JSON schema is loosely based on the &quot;ERC721 Metadata JSON Schema&quot;, but includes optional formatting to allow for ID substitution by clients. If the string &lt;code&gt;{id}&lt;&#x2F;code&gt; exists in any JSON value, it MUST be replaced with the actual token ID, by all client software that follows this standard.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The string format of the substituted hexadecimal ID MUST be lowercase alphanumeric: &lt;code&gt;[0-9a-f]&lt;&#x2F;code&gt; with no 0x prefix.&lt;&#x2F;li&gt;
&lt;li&gt;The string format of the substituted hexadecimal ID MUST be leading zero padded to 64 hex characters length if necessary.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Token Metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Identifies the asset to which this token represents&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;decimals&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;integer&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The number of decimal places that the token amount should display - e.g. 18, means to divide the token amount by 1000000000000000000 to get its user representation.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Describes the asset to which this token represents&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;image&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A URI pointing to a resource with mime type image&#x2F;* representing the asset to which this token represents. Consider making any images at a width between 320 and 1080 pixels and aspect ratio between 1.91:1 and 4:5 inclusive.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Arbitrary properties. Values may be strings, numbers, object or arrays.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;An example of an ERC-1155 Metadata JSON file follows. The properties array proposes some SUGGESTED formatting for token-specific display properties and metadata.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Asset Name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Lorem ipsum...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;image&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;https:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;s3.amazonaws.com&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;your-bucket&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;images&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{id}.png&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;simple_property&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;example value&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;rich_property&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;			&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;			&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;123&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;			&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;display_value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;123 Example Value&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;			&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;emphasis&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;			&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;css&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;				&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;color&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;#ffffff&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;				&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;font-weight&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bold&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;				&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;text-decoration&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;underline&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;array_property&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;			&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;			&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;			&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;emphasis&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;localization&quot;&gt;Localization&lt;&#x2F;h5&gt;
&lt;p&gt;Metadata localization should be standardized to increase presentation uniformity across all languages. As such, a simple overlay method is proposed to enable localization. If the metadata JSON file contains a &lt;code&gt;localization&lt;&#x2F;code&gt; attribute, its content MAY be used to provide localized values for fields that need it. The &lt;code&gt;localization&lt;&#x2F;code&gt; attribute should be a sub-object with three attributes: &lt;code&gt;uri&lt;&#x2F;code&gt;, &lt;code&gt;default&lt;&#x2F;code&gt; and &lt;code&gt;locales&lt;&#x2F;code&gt;. If the string &lt;code&gt;{locale}&lt;&#x2F;code&gt; exists in any URI, it MUST be replaced with the chosen locale by all client software.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;json-schema&quot;&gt;JSON Schema&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Token Metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Identifies the asset to which this token represents&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;decimals&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;integer&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The number of decimal places that the token amount should display - e.g. 18, means to divide the token amount by 1000000000000000000 to get its user representation.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Describes the asset to which this token represents&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;image&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A URI pointing to a resource with mime type image&#x2F;* representing the asset to which this token represents. Consider making any images at a width between 320 and 1080 pixels and aspect ratio between 1.91:1 and 4:5 inclusive.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Arbitrary properties. Values may be strings, numbers, object or arrays.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;localization&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;required&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uri&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;default&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;locales&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uri&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The URI pattern to fetch localized data from. This URI should contain the substring `{locale}` which will be replaced with the appropriate locale value before sending the request.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;default&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The locale of the default data within the base JSON&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;locales&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;array&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The list of locales for which data is available. These locales should conform to those defined in the Unicode Common Locale Data Repository (http:&#x2F;&#x2F;cldr.unicode.org&#x2F;).&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;localized-sample&quot;&gt;Localized Sample&lt;&#x2F;h5&gt;
&lt;p&gt;Base URI:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Advertising Space&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Each token represents a unique Ad space in the city.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;localization&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uri&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ipfs:&#x2F;&#x2F;QmWS1VAdMD353A6SDk9wNyvkT14kyCiZrNDYAad4w1tKqT&#x2F;{locale}.json&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;default&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;en&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;locales&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;en&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;es&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;fr&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;es.json:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Espacio Publicitario&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Cada token representa un espacio publicitario único en la ciudad.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;fr.json:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Espace Publicitaire&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Chaque jeton représente un espace publicitaire unique dans la ville.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;approval&quot;&gt;Approval&lt;&#x2F;h3&gt;
&lt;p&gt;The function &lt;code&gt;setApprovalForAll&lt;&#x2F;code&gt; allows an operator to manage one&#x27;s entire set of tokens on behalf of the approver. To permit approval of a subset of token IDs, an interface such as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1761&#x2F;&quot;&gt;ERC-1761 Scoped Approval Interface&lt;&#x2F;a&gt; is suggested.
The counterpart &lt;code&gt;isApprovedForAll&lt;&#x2F;code&gt; provides introspection into any status set by &lt;code&gt;setApprovalForAll&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;An owner SHOULD be assumed to always be able to operate on their own tokens regardless of approval status, so should SHOULD NOT have to call &lt;code&gt;setApprovalForAll&lt;&#x2F;code&gt; to approve themselves as an operator before they can operate on them.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;metadata-choices&quot;&gt;Metadata Choices&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;symbol&lt;&#x2F;code&gt; function (found in the ERC-20 and ERC-721 standards) was not included as we do not believe this is a globally useful piece of data to identify a generic virtual item &#x2F; asset and are also prone to collisions. Short-hand symbols are used in tickers and currency trading, but they aren&#x27;t as useful outside of that space.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;name&lt;&#x2F;code&gt; function (for human-readable asset names, on-chain) was removed from the standard to allow the Metadata JSON to be the definitive asset name and reduce duplication of data. This also allows localization for names, which would otherwise be prohibitively expensive if each language string was stored on-chain, not to mention bloating the standard interface. While this decision may add a small burden on implementers to host a JSON file containing metadata, we believe any serious implementation of ERC-1155 will already utilize JSON Metadata.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;upgrades&quot;&gt;Upgrades&lt;&#x2F;h3&gt;
&lt;p&gt;The requirement to emit &lt;code&gt;TransferSingle&lt;&#x2F;code&gt; or &lt;code&gt;TransferBatch&lt;&#x2F;code&gt; on balance change implies that a valid implementation of ERC-1155 redeploying to a new contract address MUST emit events from the new contract address to replicate the deprecated contract final state. It is valid to only emit a minimal number of events to reflect only the final balance and omit all the transactions that led to that state. The event emit requirement is to ensure that the current state of the contract can always be traced only through events. To alleviate the need to emit events when changing contract address, consider using the proxy pattern, such as described in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2535&#x2F;&quot;&gt;EIP-2535&lt;&#x2F;a&gt;. This will also have the added benefit of providing a stable contract address for users.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;design-decision-supporting-non-batch&quot;&gt;Design decision: Supporting non-batch&lt;&#x2F;h3&gt;
&lt;p&gt;The standard supports &lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt; and &lt;code&gt;onERC1155Received&lt;&#x2F;code&gt; functions because they are significantly cheaper for single token-type transfers, which is arguably a common use case.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;design-decision-safe-transfers-only&quot;&gt;Design decision: Safe transfers only&lt;&#x2F;h3&gt;
&lt;p&gt;The standard only supports safe-style transfers, making it possible for receiver contracts to depend on &lt;code&gt;onERC1155Received&lt;&#x2F;code&gt; or &lt;code&gt;onERC1155BatchReceived&lt;&#x2F;code&gt; function to be always called at the end of a transfer.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;guaranteed-log-trace&quot;&gt;Guaranteed log trace&lt;&#x2F;h3&gt;
&lt;p&gt;As the Ethereum ecosystem continues to grow, many dapps are relying on traditional databases and explorer API services to retrieve and categorize data. The ERC-1155 standard guarantees that event logs emitted by the smart contract will provide enough data to create an accurate record of all current token balances. A database or explorer may listen to events and be able to provide indexed and categorized searches of every ERC-1155 token in the contract.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;approval-1&quot;&gt;Approval&lt;&#x2F;h3&gt;
&lt;p&gt;The function &lt;code&gt;setApprovalForAll&lt;&#x2F;code&gt; allows an operator to manage one&#x27;s entire set of tokens on behalf of the approver. It enables frictionless interaction with exchange and trade contracts.&lt;&#x2F;p&gt;
&lt;p&gt;Restricting approval to a certain set of token IDs, quantities or other rules MAY be done with an additional interface or an external contract. The rationale is to keep the ERC-1155 standard as generic as possible for all use-cases without imposing a specific approval scheme on implementations that may not need it. Standard token approval interfaces can be used, such as the suggested &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1761&#x2F;&quot;&gt;ERC-1761 Scoped Approval Interface&lt;&#x2F;a&gt; which is compatible with ERC-1155.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;There have been requirements during the design discussions to have this standard be compatible with existing standards when sending to contract addresses, specifically ERC-721 at time of writing.
To cater for this scenario, there is some leeway with the revert logic should a contract not implement the &lt;code&gt;ERC1155TokenReceiver&lt;&#x2F;code&gt; as per &quot;Safe Transfer Rules&quot; section above, specifically &quot;Scenario#3 : The receiver does not implement the necessary &lt;code&gt;ERC1155TokenReceiver&lt;&#x2F;code&gt; interface function(s)&quot;.&lt;&#x2F;p&gt;
&lt;p&gt;Hence in a hybrid ERC-1155 contract implementation an extra call MUST be made on the recipient contract and checked before any hook calls to &lt;code&gt;onERC1155Received&lt;&#x2F;code&gt; or &lt;code&gt;onERC1155BatchReceived&lt;&#x2F;code&gt; are made.
Order of operation MUST therefore be:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The implementation MUST call the function &lt;code&gt;supportsInterface(0x4e2312e0)&lt;&#x2F;code&gt; on the recipient contract, providing at least 10,000 gas.&lt;&#x2F;li&gt;
&lt;li&gt;If the function call succeeds and the return value is the constant value &lt;code&gt;true&lt;&#x2F;code&gt; the implementation proceeds as a regular ERC-1155 implementation, with the call(s) to the &lt;code&gt;onERC1155Received&lt;&#x2F;code&gt; or &lt;code&gt;onERC1155BatchReceived&lt;&#x2F;code&gt; hooks and rules associated.&lt;&#x2F;li&gt;
&lt;li&gt;If the function call fails or the return value is NOT the constant value &lt;code&gt;true&lt;&#x2F;code&gt; the implementation can assume the recipient contract is not an &lt;code&gt;ERC1155TokenReceiver&lt;&#x2F;code&gt; and follow its other standard&#x27;s rules for transfers.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Note that a pure implementation of a single standard is recommended&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt; rather than a hybrid solution, but an example of a hybrid ERC-1155&#x2F;ERC-721 contract is linked in the references section under implementations.&lt;&#x2F;p&gt;
&lt;p&gt;An important consideration is that even if the tokens are sent with another standard&#x27;s rules the &lt;em&gt;&lt;strong&gt;ERC-1155 transfer events MUST still be emitted.&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt; This is so the balances can still be determined via events alone as per ERC-1155 standard rules.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;usage&quot;&gt;Usage&lt;&#x2F;h2&gt;
&lt;p&gt;This standard can be used to represent multiple token types for an entire domain. Both fungible and non-fungible tokens can be stored in the same smart-contract.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;batch-transfers&quot;&gt;Batch Transfers&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;safeBatchTransferFrom&lt;&#x2F;code&gt; function allows for batch transfers of multiple token IDs and values. The design of ERC-1155 makes batch transfers possible without the need for a wrapper contract, as with existing token standards. This reduces gas costs when more than one token type is included in a batch transfer, as compared to single transfers with multiple transactions.&lt;&#x2F;p&gt;
&lt;p&gt;Another advantage of standardized batch transfers is the ability for a smart contract to respond to the batch transfer in a single operation using &lt;code&gt;onERC1155BatchReceived&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;It is RECOMMENDED that clients and wallets sort the token IDs and associated values (in ascending order) when posting a batch transfer, as some ERC-1155 implementations offer significant gas cost savings when IDs are sorted. See &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;horizon-games&#x2F;multi-token-standard&quot;&gt;Horizon Games - Multi-Token Standard&lt;&#x2F;a&gt; &quot;packed balance&quot; implementation for an example of this.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;batch-balance&quot;&gt;Batch Balance&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;balanceOfBatch&lt;&#x2F;code&gt; function allows clients to retrieve balances of multiple owners and token IDs with a single call.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;enumerating-from-events&quot;&gt;Enumerating from events&lt;&#x2F;h3&gt;
&lt;p&gt;In order to keep storage requirements light for contracts implementing ERC-1155, enumeration (discovering the IDs and values of tokens) must be done using event logs. It is RECOMMENDED that clients such as exchanges and blockchain explorers maintain a local database containing the token ID, Supply, and URI at the minimum. This can be built from each TransferSingle, TransferBatch, and URI event, starting from the block the smart contract was deployed until the latest block.&lt;&#x2F;p&gt;
&lt;p&gt;ERC-1155 contracts must therefore carefully emit &lt;code&gt;TransferSingle&lt;&#x2F;code&gt; or &lt;code&gt;TransferBatch&lt;&#x2F;code&gt; events in any instance where tokens are created, minted, transferred or destroyed.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;non-fungible-tokens&quot;&gt;Non-Fungible Tokens&lt;&#x2F;h3&gt;
&lt;p&gt;The following strategies are examples of how you MAY mix fungible and non-fungible tokens together in the same contract. The standard does NOT mandate how an implementation must do this.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;split-id-bits&quot;&gt;Split ID bits&lt;&#x2F;h5&gt;
&lt;p&gt;The top 128 bits of the uint256 &lt;code&gt;_id&lt;&#x2F;code&gt; parameter in any ERC-1155 function MAY represent the base token ID, while the bottom 128 bits MAY represent the index of the non-fungible to make it unique.&lt;&#x2F;p&gt;
&lt;p&gt;Non-fungible tokens can be interacted with using an index based accessor into the contract&#x2F;token data set. Therefore to access a particular token set within a mixed data contract and a particular non-fungible within that set, &lt;code&gt;_id&lt;&#x2F;code&gt; could be passed as &lt;code&gt;&amp;lt;uint128: base token id&amp;gt;&amp;lt;uint128: index of non-fungible&amp;gt;&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;To identify a non-fungible set&#x2F;category as a whole (or a fungible) you COULD just pass in the base id via the &lt;code&gt;_id&lt;&#x2F;code&gt; argument as &lt;code&gt;&amp;lt;uint128: base token id&amp;gt;&amp;lt;uint128: zero&amp;gt;&lt;&#x2F;code&gt;. If your implementation uses this technique this naturally means the index of a non-fungible SHOULD be 1-based.&lt;&#x2F;p&gt;
&lt;p&gt;Inside the contract code the two pieces of data needed to access the individual non-fungible can be extracted with uint128(~0) and the same mask shifted by 128.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; baseTokenNFT &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 12345&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 128&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;uint128&lt;&#x2F;span&gt;&lt;span&gt; indexNFT &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 50&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt; baseTokenFT &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 54321&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 128&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; baseTokenNFT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get balance of the base token for non-fungible set 12345 (this MAY be used to get balance of the user for all of this token set if the implementation wishes as a convenience).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; baseTokenNFT &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt; indexNFT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get balance of the token at index 50 for non-fungible set 12345 (should be 1 if user owns the individual non-fungible token or 0 if they do not).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; baseTokenFT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get balance of the fungible base token 54321.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note that 128 is an arbitrary number, an implementation MAY choose how they would like this split to occur as suitable for their use case. An observer of the contract would simply see events showing balance transfers and mints happening and MAY track the balances using that information alone.
For an observer to be able to determine type (non-fungible or fungible) from an ID alone they would have to know the split ID bits format on a implementation by implementation basis.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;enjin&#x2F;erc-1155&quot;&gt;ERC-1155 Reference Implementation&lt;&#x2F;a&gt; is an example of the split ID bits strategy.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;natural-non-fungible-tokens&quot;&gt;Natural Non-Fungible tokens&lt;&#x2F;h5&gt;
&lt;p&gt;Another simple way to represent non-fungibles is to allow a maximum value of 1 for each non-fungible token. This would naturally mirror the real world, where unique items have a quantity of 1 and fungible items have a quantity greater than 1.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;Standards&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721 Non-Fungible Token Standard&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165 Standard Interface Detection&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1538&#x2F;&quot;&gt;ERC-1538 Transparent Contract Standard&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;json-schema.org&#x2F;&quot;&gt;JSON Schema&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.ietf.org&#x2F;rfc&#x2F;rfc2119.txt&quot;&gt;RFC 2119 Key words for use in RFCs to Indicate Requirement Levels&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Implementations&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;enjin&#x2F;erc-1155&quot;&gt;ERC-1155 Reference Implementation&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;horizon-games&#x2F;multi-token-standard&quot;&gt;Horizon Games - Multi-Token Standard&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;enjincoin.io&quot;&gt;Enjin Coin&lt;&#x2F;a&gt; (&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;enjin&quot;&gt;GitHub&lt;&#x2F;a&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;pixowl&#x2F;thesandbox-contracts&#x2F;tree&#x2F;master&#x2F;src&#x2F;Asset&quot;&gt;The Sandbox - Dual ERC-1155&#x2F;721 Contract&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Articles &amp;amp; Discussions&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;1155&quot;&gt;GitHub - Original Discussion Thread&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;blog.enjincoin.io&#x2F;erc-1155-the-crypto-item-standard-ac9cf1c5a226&quot;&gt;ERC-1155 - The Crypto Item Standard&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;medium.com&#x2F;horizongames&#x2F;going-beyond-erc20-and-erc721-9acebd4ff6ef&quot;&gt;Here Be Dragons - Going Beyond ERC-20 and ERC-721 To Reduce Gas Cost by ~80%&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;blockonomi.com&#x2F;erc1155-gaming-token&#x2F;&quot;&gt;Blockonomi - Ethereum ERC-1155 Token Perfect for Online Games, Possibly More&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;blockgeeks.com&#x2F;erc-1155-token&#x2F;&quot;&gt;Beyond Gaming - Exploring the Utility of ERC-1155 Token Standard!&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;medium.com&#x2F;sandbox-game&#x2F;erc-1155-a-new-standard-for-the-sandbox-c95ee1e45072&quot;&gt;ERC-1155: A new standard for The Sandbox&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Transient storage opcodes</title>
        <published>2018-06-15T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alexey Akhunov</name><uri>https://github.com/AlexeyAkhunov</uri>
	</author>
	
	<author>
		<name>Moody Salem</name><uri>https://github.com/moodysalem</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1153/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-transient-storage-opcodes/553" />
        

        <id>https://wg-eips.ritovision.com/1153/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:1153"
            label="EIP-1153" />
        

        
        

        
        <summary type="html">Add opcodes for manipulating state that behaves almost identically to storage but is discarded after every transaction</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1153/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal introduces transient storage opcodes, which manipulate state that behaves identically to storage, except that transient storage is discarded after every transaction, and &lt;code&gt;TSTORE&lt;&#x2F;code&gt; is not subject to the gas stipend check as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2200&#x2F;&quot;&gt;EIP-2200&lt;&#x2F;a&gt;. In other words, the values of transient storage are never deserialized from storage or serialized to storage. Thus transient storage is cheaper since it never requires disk access. Transient storage is accessible to smart contracts via 2 new opcodes, &lt;code&gt;TLOAD&lt;&#x2F;code&gt; and &lt;code&gt;TSTORE&lt;&#x2F;code&gt;, where “T” stands for &quot;transient:&quot;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;TLOAD  (0x5c)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;TSTORE (0x5d)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Running a transaction in Ethereum can generate multiple nested frames of execution, each created by &lt;code&gt;CALL&lt;&#x2F;code&gt; (or similar) instructions. Contracts can be re-entered during the same transaction, in which case there are more than one frame belonging to one contract. Currently, these frames can communicate in two ways: via inputs&#x2F;outputs passed via &lt;code&gt;CALL&lt;&#x2F;code&gt; instructions, and via storage updates. If there is an intermediate frame belonging to another untrusted contract, communication via inputs&#x2F;outputs is not secure. Notable example is a reentrancy lock which cannot rely on the intermediate frame to pass through the state of the lock. Communication via storage (&lt;code&gt;SSTORE&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;SLOAD&lt;&#x2F;code&gt;) is costly. Transient storage is a dedicated and gas efficient solution to the problem of inter frame communication.&lt;&#x2F;p&gt;
&lt;p&gt;Storage refunds accumulated due to inter frame communication are also limited to 20% of gas spent by a transaction due to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3529&#x2F;&quot;&gt;EIP-3529&lt;&#x2F;a&gt; (introduced in the London hard fork). This greatly reduces the refunds for transiently-set storage slots in otherwise low-cost transactions. For example, in order to receive the full refund of one re-entrancy lock, the transaction must spend ~80k gas on other operations.&lt;&#x2F;p&gt;
&lt;p&gt;Language support could be added in relatively easy way. For example, in Solidity, a qualifier &lt;code&gt;transient&lt;&#x2F;code&gt; can be introduced (similar to the existing qualifiers &lt;code&gt;memory&lt;&#x2F;code&gt; and &lt;code&gt;storage&lt;&#x2F;code&gt;, and Java&#x27;s own &lt;code&gt;transient&lt;&#x2F;code&gt; keyword with a similar meaning). Since the addressing scheme of &lt;code&gt;TSTORE&lt;&#x2F;code&gt; and &lt;code&gt;TLOAD&lt;&#x2F;code&gt; is the same as for &lt;code&gt;SSTORE&lt;&#x2F;code&gt; and &lt;code&gt;SLOAD&lt;&#x2F;code&gt;, code generation routines that exist for storage variables, can be easily generalised to also support transient storage.&lt;&#x2F;p&gt;
&lt;p&gt;Potential use cases enabled or improved by this EIP include:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Reentrancy locks&lt;&#x2F;li&gt;
&lt;li&gt;On-chain computable CREATE2 addresses: constructor arguments are read from the factory contract instead of passed as part of init code hash&lt;&#x2F;li&gt;
&lt;li&gt;Single transaction &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; approvals, e.g. &lt;code&gt;#temporaryApprove(address spender, uint256 amount)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Fee-on-transfer contracts: pay a fee to a token contract to unlock transfers for the duration of a transaction&lt;&#x2F;li&gt;
&lt;li&gt;&quot;Till&quot; pattern: allowing users to perform all actions as part of a callback, and checking the &quot;till&quot; is balanced at the end&lt;&#x2F;li&gt;
&lt;li&gt;Proxy call metadata: pass additional metadata to an implementation contract without using calldata, e.g. values of immutable proxy constructor arguments&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;These opcodes are more efficient to execute than the &lt;code&gt;SSTORE&lt;&#x2F;code&gt; and &lt;code&gt;SLOAD&lt;&#x2F;code&gt; opcodes because the original value never needs to be loaded from storage (i.e. is always 0). The gas accounting rules are also simpler, since no refunds are required.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Two new opcodes are added to EVM, &lt;code&gt;TLOAD&lt;&#x2F;code&gt; (&lt;code&gt;0x5c&lt;&#x2F;code&gt;) and &lt;code&gt;TSTORE&lt;&#x2F;code&gt; (&lt;code&gt;0x5d&lt;&#x2F;code&gt;). (Note that previous drafts of this EIP specified the values &lt;code&gt;0xb3&lt;&#x2F;code&gt; and &lt;code&gt;0xb4&lt;&#x2F;code&gt; for &lt;code&gt;TLOAD&lt;&#x2F;code&gt; and &lt;code&gt;TSTORE&lt;&#x2F;code&gt; respectively to avoid conflict with other EIPs. The conflict has since been removed.)&lt;&#x2F;p&gt;
&lt;p&gt;They use the same arguments on stack as &lt;code&gt;SLOAD&lt;&#x2F;code&gt; (&lt;code&gt;0x54&lt;&#x2F;code&gt;) and &lt;code&gt;SSTORE&lt;&#x2F;code&gt; (&lt;code&gt;0x55&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;TLOAD&lt;&#x2F;code&gt; pops one 32-byte word from the top of the stack, treats this value as the address, fetches 32-byte word from the transient storage at that address, and pushes the value on top of the stack.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;TSTORE&lt;&#x2F;code&gt; pops two 32-byte words from the top of the stack. The word on the top is the address, and the next is the value. &lt;code&gt;TSTORE&lt;&#x2F;code&gt; saves the value at the given address in the transient storage.&lt;&#x2F;p&gt;
&lt;p&gt;Addressing is the same as &lt;code&gt;SLOAD&lt;&#x2F;code&gt; and &lt;code&gt;SSTORE&lt;&#x2F;code&gt;. i.e. each 32-byte address points to a unique 32-byte word.&lt;&#x2F;p&gt;
&lt;p&gt;Gas cost for &lt;code&gt;TSTORE&lt;&#x2F;code&gt; is the same as a warm &lt;code&gt;SSTORE&lt;&#x2F;code&gt; of a dirty slot (i.e. original value is not new value and is not current value, currently 100 gas), and gas cost of &lt;code&gt;TLOAD&lt;&#x2F;code&gt; is the same as a hot &lt;code&gt;SLOAD&lt;&#x2F;code&gt; (value has been read before, currently 100 gas). Gas cost cannot be on par with memory access due to transient storage&#x27;s interactions with reverts.&lt;&#x2F;p&gt;
&lt;p&gt;All values in transient storage are discarded at the end of the transaction.&lt;&#x2F;p&gt;
&lt;p&gt;Transient storage is private to the contract that owns it, in the same way as persistent storage. Only owning contract frames may access their transient storage. And when they do, all the frames access the same transient store, in the same way as persistent storage, but unlike memory.&lt;&#x2F;p&gt;
&lt;p&gt;When transient storage is used in the context of &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; or &lt;code&gt;CALLCODE&lt;&#x2F;code&gt;, then the owning contract of the transient storage is the contract that issued &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; or &lt;code&gt;CALLCODE&lt;&#x2F;code&gt; instruction (the caller) as with persistent storage. When transient storage is used in the context of &lt;code&gt;CALL&lt;&#x2F;code&gt; or &lt;code&gt;STATICCALL&lt;&#x2F;code&gt;, then the owning contract of the transient storage is the contract that is the target of the &lt;code&gt;CALL&lt;&#x2F;code&gt; or &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; instruction (the callee).&lt;&#x2F;p&gt;
&lt;p&gt;If a frame reverts, all writes to transient storage that took place between entry to the frame and the return are reverted, including those that took place in inner calls.  This mimics the behavior of persistent storage.&lt;&#x2F;p&gt;
&lt;p&gt;If the &lt;code&gt;TSTORE&lt;&#x2F;code&gt; opcode is called within the context of a &lt;code&gt;STATICCALL&lt;&#x2F;code&gt;, it will result in an exception instead of performing the modification. &lt;code&gt;TLOAD&lt;&#x2F;code&gt; is allowed within the context of a &lt;code&gt;STATICCALL&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The behavior of the opcodes for transient storage differs from the opcodes for storage in that &lt;code&gt;TSTORE&lt;&#x2F;code&gt; does not require &lt;em&gt;gasleft&lt;&#x2F;em&gt;, as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2200&#x2F;&quot;&gt;EIP-2200&lt;&#x2F;a&gt;, to be less than or equal to the gas stipend (currently 2,300).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Another option to solve the problem of inter-frame communication is repricing the &lt;code&gt;SSTORE&lt;&#x2F;code&gt; and &lt;code&gt;SLOAD&lt;&#x2F;code&gt; opcodes to be cheaper for the transient storage use case. This has already been done as of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2200&#x2F;&quot;&gt;EIP-2200&lt;&#x2F;a&gt;. However, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3529&#x2F;&quot;&gt;EIP-3529&lt;&#x2F;a&gt; reduced the maximum refund to only 20% of the transaction gas cost, which means the use of transient storage is severely limited.&lt;&#x2F;p&gt;
&lt;p&gt;Another approach is to keep the refund counter for transient storage separate from the refund counter for other storage uses, and remove the refund cap for transient storage. However, that approach is more complex to implement and understand. For example, the 20% refund cap must be applied to the gas used &lt;em&gt;after&lt;&#x2F;em&gt; subtracting the uncapped gas refund. Otherwise, the refund amount available subject to the 20% refund cap could be increased by executing transient storage writes. Thus it is preferable to have a separate mechanism that does not interact with the refund counter. Future hard forks can remove the complex refund behavior meant to support the transient storage use case, encouraging migration to contracts that are more efficient for the Ethereum clients to execute.&lt;&#x2F;p&gt;
&lt;p&gt;There is a known objection to the word-addressed storage-like interface of the &lt;code&gt;TSTORE&lt;&#x2F;code&gt; and &lt;code&gt;TLOAD&lt;&#x2F;code&gt; opcodes since transient storage is more akin to memory than storage in lifecycle. A byte-addressed memory-like interface is another option. The storage-like word-addressed interface is preferred due to the usefulness of mappings in combination with the transaction-scoped memory region. Often times, you will need to keep transient state with arbitrary keys, such as in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; temporary approval use case which uses a mapping of &lt;code&gt;(owner, spender)&lt;&#x2F;code&gt; to &lt;code&gt;allowance&lt;&#x2F;code&gt;. Mappings are difficult to implement using linear memory, and linear memory must also have dynamic gas costs. It is also more complicated to handle reverts with a linear memory. It is possible to have a memory-like interface while the underlying implementation uses a map to allow for storage in arbitrary offsets, but this would result in a third memory-storage hybrid interface that would require new code paths in compilers.&lt;&#x2F;p&gt;
&lt;p&gt;Some think that a unique transaction identifier may obviate the need for transient storage as described in this EIP. This is a misconception: a transaction identifier used in combination with regular storage has all the same issues that motivate this EIP. The two features are orthogonal.&lt;&#x2F;p&gt;
&lt;p&gt;Relative cons of this transient storage EIP:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Does not address transient usages of storage in existing contracts&lt;&#x2F;li&gt;
&lt;li&gt;New code in the clients&lt;&#x2F;li&gt;
&lt;li&gt;New concept for the yellow paper (more to update)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Relative pros of this transient storage EIP:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Transient storage opcodes are considered separately in protocol upgrades and not inadvertently broken (e.g. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3529&#x2F;&quot;&gt;EIP-3529&lt;&#x2F;a&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;Clients do not need to load the original value&lt;&#x2F;li&gt;
&lt;li&gt;No upfront gas cost to account for non-transient writes&lt;&#x2F;li&gt;
&lt;li&gt;Does not change the semantics of the existing operations&lt;&#x2F;li&gt;
&lt;li&gt;No need to clear storage slots after usage&lt;&#x2F;li&gt;
&lt;li&gt;Simpler gas accounting rules&lt;&#x2F;li&gt;
&lt;li&gt;Future storage designs (e.g. Verkle tree) do not need to account for transient storage refunds&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP requires a hard fork to implement.&lt;&#x2F;p&gt;
&lt;p&gt;Since this EIP does not change behavior of any existing opcodes, it is backwards compatible with all existing smart contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;A test suite for this EIP can be found &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;execution-spec-tests&#x2F;tree&#x2F;1983444bbe1a471886ef7c0e82253ffe2a4053e1&#x2F;tests&#x2F;cancun&#x2F;eip1153_tstore&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Because the transient storage must behave almost identically to storage within the context of a single transaction with regards to revert behavior, it is necessary to be able to revert to a previous state of transient storage within a transaction. At the same time reverts are exceptional cases and loads, stores and returns should be cheap.&lt;&#x2F;p&gt;
&lt;p&gt;A map of current state plus a journal of all changes and a list of checkpoints is recommended. This has the following time complexities:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;On entry to a call frame, a call marker is added to the list - &lt;code&gt;O(1)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;New values are written to the current state, and the previous value is written to the journal - &lt;code&gt;O(1)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;When a call exits successfully, the marker to the journal index of when that call was entered is discarded - &lt;code&gt;O(1)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;On revert all entries are reverted up to the last checkpoint, in reverse - &lt;code&gt;O(N)&lt;&#x2F;code&gt; where &lt;code&gt;N&lt;&#x2F;code&gt; = number of journal entries since last checkpoint&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; JournalEntry&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    prevValue&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Journal&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; JournalEntry&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Checkpoints&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Journal&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;length&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Current&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; EMPTY_VALUE&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransientStorage&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * The current state of transient storage.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;    private&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; current&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Current&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * All changes are written to the journal. On revert, we apply the changes in reverse to the last checkpoint.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;    private&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; journal&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Journal&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * The length of the journal at the time of each checkpoint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;    private&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; checkpoints&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Checkpoints&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Returns the current value of the given contract address and key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The key of transient storage for the address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;    public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;current&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;?.&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;key&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ??&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; EMPTY_VALUE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Set the current value in the map&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the address of the contract for which the key is being set&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the slot to set for the address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the new value of the slot to set&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;    public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; put&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;journal&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;push&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;            addr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;            key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            prevValue&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;get&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;current&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;current&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ??&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;current&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;key&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Commit all the changes since the last checkpoint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;    public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; commit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; void&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;checkpoints&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ===&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; throw&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Error&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Nothing to commit&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;checkpoints&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;pop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The last checkpoint is discarded.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * To be called whenever entering a new context. If revert is called after checkpoint, all changes made after the latest checkpoint are reverted.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;    public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checkpoint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; void&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;checkpoints&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;push&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;journal&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Revert transient storage to the state from the last call to checkpoint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;    public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; lastCheckpoint&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;checkpoints&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;pop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;typeof&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; lastCheckpoint&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ===&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;undefined&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; throw&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Error&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Nothing to revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;journal&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; lastCheckpoint&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;--&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            const&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; prevValue&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;journal&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; we can assume it exists, since it was written in the journal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;current&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;key&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; prevValue&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;journal&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;splice&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;lastCheckpoint&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;journal&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; lastCheckpoint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The worst case time complexity can be produced by writing the maximum number of keys that can fit in one block, and then reverting. In this case, the client is required to do twice as many writes to apply all the entries in the journal. However, the same case applies to the state journaling implementation of existing clients, and cannot be DOS&#x27;d with the following code.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; =0.8.13&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TryDOS&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; slot&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        slot &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tryDOS&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        while&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;gasleft&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 5000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            unchecked&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                slot &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        revert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;TSTORE&lt;&#x2F;code&gt; presents a new way to allocate memory on a node with linear cost. In other words, each TSTORE allows the developer to store 32 bytes for 100 gas, excluding any other required operations to prepare the stack. Given 30 million gas, the maximum amount of memory that can be allocated using TSTORE is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;30M gas * 1 TSTORE &#x2F; 100 gas * 32 bytes &#x2F; 1 TSTORE * 1MB &#x2F; 2^20 bytes ~= 9.15MB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Given the same amount of gas, the maximum amount of memory that can be allocated in a single context by &lt;code&gt;MSTORE&lt;&#x2F;code&gt; is ~3.75MB:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;30M gas = 3x + x^2 &#x2F; 512 =&amp;gt; x = ~123,169 32-byte words&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;~123,169 words * 32 bytes&#x2F;word * 1MB &#x2F; 2^20 bytes = 3.75MB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;However, if you only spend 1M gas allocating memory in each context, and make calls to reset the memory expansion cost, you can allocate ~700KB per million gas, for a total of ~20MB of memory allocated:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;1M gas = 3x + x^2 &#x2F; 512 =&amp;gt; x = ~21,872 32-byte words&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;30M gas * ~21,872 words &#x2F; 1M gas * 32 bytes&#x2F;word * 1MB &#x2F; 2^20 bytes = ~20MB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Smart contract developers should understand the lifetime of transient storage variables before use. Because transient storage is automatically cleared at the end of the transaction, smart contract developers may be tempted to avoid clearing slots as part of a call in order to save gas. However, this could prevent further interactions with the contract in the same transaction (e.g. in the case of re-entrancy locks) or cause other bugs, so smart contract developers should be careful to &lt;em&gt;only&lt;&#x2F;em&gt; leave transient storage slots with nonzero values when those slots are intended to be used by future calls within the same transaction. Otherwise, these opcodes behave exactly the same as &lt;code&gt;SSTORE&lt;&#x2F;code&gt; and &lt;code&gt;SLOAD&lt;&#x2F;code&gt;, so all the usual security considerations apply especially in regard to reentrancy risk.&lt;&#x2F;p&gt;
&lt;p&gt;Smart contract developers may also be tempted to use transient storage as an alternative to in-memory mappings. They should be aware that transient storage is not discarded when a call returns or reverts, as is memory, and should prefer memory for these use cases so as not to create unexpected behavior on reentrancy in the same transaction. The necessarily high cost of transient storage over memory should already discourage this usage pattern. Most usages of in-memory mappings can be better implemented with key-sorted lists of entries, and in-memory mappings are rarely required in smart contracts (i.e. the author knows of no known use cases in production).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Oracle Interface</title>
        <published>2018-06-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Alan Lu</name><uri>https://github.com/cag</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1154/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/1161" />
        

        <id>https://wg-eips.ritovision.com/1154/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        

        
        <category
            term="tag:eip:1154"
            label="ERC-1154" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1154/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;A standard interface for oracles.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;In order for ethereum smart contracts to interact with off-chain systems, oracles must be used. These oracles report values which are normally off-chain, allowing smart contracts to react to the state of off-chain systems. A distinction and a choice is made between push and pull based oracle systems. Furthermore, a standard interface for oracles is described here, allowing different oracle implementations to be interchangeable.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The Ethereum ecosystem currently has many different oracle implementations available, but they do not provide a unified interface. Smart contract systems would be locked into a single set of oracle implementations, or they would require developers to write adapters&#x2F;ports specific to the oracle system chosen in a given project.&lt;&#x2F;p&gt;
&lt;p&gt;Beyond naming differences, there is also the issue of whether or not an oracle report-resolving transaction &lt;em&gt;pushes&lt;&#x2F;em&gt; state changes by calling affected contracts, or changes the oracle state allowing dependent contracts to &lt;em&gt;pull&lt;&#x2F;em&gt; the updated value from the oracle. These differing system semantics could introduce inefficiencies when adapting between them.&lt;&#x2F;p&gt;
&lt;p&gt;Ultimately, the value in different oracle systems comes from their underlying resolution mechanics, and points where these systems are virtually identical should be standardized.&lt;&#x2F;p&gt;
&lt;p&gt;These oracles may be used for answering questions about &quot;real-world events&quot;, where each ID can be correlated with a specification of a question and its answers (so most likely for prediction markets, basically).&lt;&#x2F;p&gt;
&lt;p&gt;Another use case could be for decision-making processes, where the results given by the oracle represent decisions made by the oracle (e.g. futarchies). DAOs may require their use in decision making processes.&lt;&#x2F;p&gt;
&lt;p&gt;Both the ID and the results are intentionally unstructured so that things like time series data (via splitting the ID) and different sorts of results (like one of a few, any subset of up to 256, or some value in a range with up to 256 bits of granularity) can be represented.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;dl&gt;
  &lt;dt&gt;Oracle&lt;&#x2F;dt&gt;
  &lt;dd&gt;An entity which reports data to the blockchain.&lt;&#x2F;dd&gt;
  &lt;dt&gt;Oracle consumer&lt;&#x2F;dt&gt;
  &lt;dd&gt;A smart contract which receives data from an oracle.&lt;&#x2F;dd&gt;
  &lt;dt&gt;ID&lt;&#x2F;dt&gt;
  &lt;dd&gt;A way of indexing the data which an oracle reports. May be derived from or tied to a question for which the data provides the answer.&lt;&#x2F;dd&gt;
  &lt;dt&gt;Result&lt;&#x2F;dt&gt;
  &lt;dd&gt;Data associated with an id which is reported by an oracle. This data oftentimes will be the answer to a question tied to the id. Other equivalent terms that have been used include: answer, data, outcome.&lt;&#x2F;dd&gt;
  &lt;dt&gt;Report&lt;&#x2F;dt&gt;
  &lt;dd&gt;A pair (ID, result) which an oracle sends to an oracle consumer.&lt;&#x2F;dd&gt;
&lt;&#x2F;dl&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OracleConsumer&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; receiveResult&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;receiveResult&lt;&#x2F;code&gt; MUST revert if the &lt;code&gt;msg.sender&lt;&#x2F;code&gt; is not an oracle authorized to provide the &lt;code&gt;result&lt;&#x2F;code&gt; for that &lt;code&gt;id&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;receiveResult&lt;&#x2F;code&gt; MUST revert if &lt;code&gt;receiveResult&lt;&#x2F;code&gt; has been called with the same &lt;code&gt;id&lt;&#x2F;code&gt; before.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;receiveResult&lt;&#x2F;code&gt; MAY revert if the &lt;code&gt;id&lt;&#x2F;code&gt; or &lt;code&gt;result&lt;&#x2F;code&gt; cannot be handled by the consumer.&lt;&#x2F;p&gt;
&lt;p&gt;Consumers MUST coordinate with oracles to determine how to encode&#x2F;decode results to and from &lt;code&gt;bytes&lt;&#x2F;code&gt;. For example, &lt;code&gt;abi.encode&lt;&#x2F;code&gt; and &lt;code&gt;abi.decode&lt;&#x2F;code&gt; may be used to implement a codec for results in Solidity. &lt;code&gt;receiveResult&lt;&#x2F;code&gt; SHOULD revert if the consumer receives a unexpected result format from the oracle.&lt;&#x2F;p&gt;
&lt;p&gt;The oracle can be any Ethereum account.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The specs are currently very similar to what is implemented by ChainLink (which can use any arbitrarily-named callback) and Oraclize (which uses &lt;code&gt;__callback&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;With this spec, the oracle &lt;em&gt;pushes&lt;&#x2F;em&gt; state to the consumer, which must react accordingly to the updated state. An alternate &lt;em&gt;pull&lt;&#x2F;em&gt;-based interface can be prescribed, as follows:&lt;&#x2F;p&gt;
&lt;h3 id=&quot;alternate-pull-based-interface&quot;&gt;Alternate Pull-based Interface&lt;&#x2F;h3&gt;
&lt;p&gt;Here are alternate specs loosely based on Gnosis prediction market contracts v1. Reality Check also exposes a similar endpoint (&lt;code&gt;getFinalAnswer&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Oracle&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; resultFor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;resultFor&lt;&#x2F;code&gt; MUST revert if the result for an &lt;code&gt;id&lt;&#x2F;code&gt; is not available yet.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;resultFor&lt;&#x2F;code&gt; MUST return the same result for an &lt;code&gt;id&lt;&#x2F;code&gt; after that result is available.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;push-vs-pull&quot;&gt;Push vs Pull&lt;&#x2F;h3&gt;
&lt;p&gt;Note that push-based interfaces may be adapted into pull-based interfaces. Simply deploy an oracle consumer which stores the result received and implements &lt;code&gt;resultFor&lt;&#x2F;code&gt; accordingly.&lt;&#x2F;p&gt;
&lt;p&gt;Similarly, every pull-based system can be adapted into a push-based system: just add a method on the oracle smart contract which takes an oracle consumer address and calls &lt;code&gt;receiveResult&lt;&#x2F;code&gt; on that address.&lt;&#x2F;p&gt;
&lt;p&gt;In both cases, an additional transaction would have to be performed, so the choice to go with push or pull should be based on the dominant use case for these oracles.&lt;&#x2F;p&gt;
&lt;p&gt;In the simple case where a single account has the authority to decide the outcome of an oracle question, there is no need to deploy an oracle contract and store the outcome on that oracle contract. Similarly, in the case where the outcome comes down to a vote, existing multisignature wallets can be used as the authorized oracle.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;multiple-oracle-consumers&quot;&gt;Multiple Oracle Consumers&lt;&#x2F;h4&gt;
&lt;p&gt;In the case that many oracle consumers depend on a single oracle result and all these consumers expect the result to be pushed to them, the push and pull adaptations mentioned before may be combined if the pushing oracle cannot be trusted to send the same result to every consumer (in a sense, this forwards the trust to the oracle adaptor implementation).&lt;&#x2F;p&gt;
&lt;p&gt;In a pull-based system, each of the consumers would have to be called to pull the result from the oracle contract, but in the proposed push-based system, the adapted oracle would have to be called to push the results to each of the consumers.&lt;&#x2F;p&gt;
&lt;p&gt;Transaction-wise, both systems are roughly equivalent in efficiency in this scenario, but in the push-based system, there&#x27;s a need for the oracle consumers to store the results again, whereas in the pull-based system, the consumers may continue to refer to the oracle for the results. Although this may be somewhat less efficient, requiring the consumers to store the results can also provide security guarantees, especially with regards to result immutability.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;result-immutability&quot;&gt;Result Immutability&lt;&#x2F;h4&gt;
&lt;p&gt;In both the proposed specification and the alternate specification, results are immutable once they are determined. This is due to the expectation that typical consumers will require results to be immutable in order to determine a resulting state consistently. With the proposed push-based system, the consumer enforces the result immutability requirement, whereas in the alternate pull-based system, either the oracle would have to be trusted to implement the spec correctly and enforce the immutability requirement, or the consumer would also have to handle result immutability.&lt;&#x2F;p&gt;
&lt;p&gt;For data which mutates over time, the &lt;code&gt;id&lt;&#x2F;code&gt; field may be structured to specify &quot;what&quot; and &quot;when&quot; for the data (using 128 bits to specify &quot;when&quot; is still safe for many millennia).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;levelkdev&#x2F;tidbit&quot;&gt;Tidbit&lt;&#x2F;a&gt; tracks this EIP.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Contract Ownership Standard</title>
        <published>2018-06-07T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Nick Mudge</name><uri>https://github.com/mudgen</uri>
	</author>
	
	<author>
		<name>Dan Finlay</name><email>dan@danfinlay.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/173/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/173" />
        

        <id>https://wg-eips.ritovision.com/173/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:173"
            label="ERC-173" />
        

        
        

        
        <summary type="html">A standard interface for ownership of contracts</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/173/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This specification defines standard functions for owning or controlling a contract.&lt;&#x2F;p&gt;
&lt;p&gt;An implementation allows reading the current owner (&lt;code&gt;owner() returns (address)&lt;&#x2F;code&gt;) and transferring ownership (&lt;code&gt;transferOwnership(address newOwner)&lt;&#x2F;code&gt;) along with a standardized event for when ownership is changed (&lt;code&gt;OwnershipTransferred(address indexed previousOwner, address indexed newOwner)&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Many smart contracts require that they be owned or controlled in some way. For example to withdraw funds or perform administrative actions. It is so common that the contract interface used to handle contract ownership should be standardized to allow compatibility with user interfaces and contracts that manage contracts.&lt;&#x2F;p&gt;
&lt;p&gt;Here are some examples of kinds of contracts and applications that can benefit from this standard:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Exchanges that buy&#x2F;sell&#x2F;auction ethereum contracts. This is only widely possible if there is a standard for getting the owner of a contract and transferring ownership.&lt;&#x2F;li&gt;
&lt;li&gt;Contract wallets that hold the ownership of contracts and that can transfer the ownership of contracts.&lt;&#x2F;li&gt;
&lt;li&gt;Contract registries. It makes sense for some registries to only allow the owners of contracts to add&#x2F;remove their contracts. A standard must exist for these contract registries to verify that a contract is being submitted by the owner of it before accepting it.&lt;&#x2F;li&gt;
&lt;li&gt;User interfaces that show and transfer ownership of contracts.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Every ERC-173 compliant contract must implement the &lt;code&gt;ERC173&lt;&#x2F;code&gt; interface. Contracts should also implement &lt;code&gt;ERC165&lt;&#x2F;code&gt; for the ERC-173 interface.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-173 Contract Ownership Standard&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;  Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0x7f5828d0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC173&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is ERC165 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when ownership of a contract changes.    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OwnershipTransferred&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; previousOwner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newOwner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the address of the owner    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address of the owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Set the address of the new owner of the contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Set _newOwner to address(0) to renounce any ownership.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _newOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the new owner of the contract    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferOwnership&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _newOwner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC165&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Query if a contract implements an interface&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; interfaceID&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The interface identifier, as specified in ERC-165&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Interface identification is specified in ERC-165. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `true` if the contract implements `interfaceID` and&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  `interfaceID` is not 0xffffffff, `false` otherwise&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;owner()&lt;&#x2F;code&gt; function may be implemented as &lt;code&gt;pure&lt;&#x2F;code&gt; or &lt;code&gt;view&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;transferOwnership(address _newOwner)&lt;&#x2F;code&gt; function may be implemented as &lt;code&gt;public&lt;&#x2F;code&gt; or &lt;code&gt;external&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;To renounce any ownership of a contract set &lt;code&gt;_newOwner&lt;&#x2F;code&gt; to the zero address: &lt;code&gt;transferOwnership(address(0))&lt;&#x2F;code&gt;. If this is done then a contract is no longer owned by anybody.&lt;&#x2F;p&gt;
&lt;p&gt;The OwnershipTransferred event should be emitted when a contract is created.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Key factors influencing the standard:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Keeping the number of functions in the interface to a minimum to prevent contract bloat.&lt;&#x2F;li&gt;
&lt;li&gt;Backwards compatibility with existing contracts.&lt;&#x2F;li&gt;
&lt;li&gt;Simplicity&lt;&#x2F;li&gt;
&lt;li&gt;Gas efficient&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Several ownership schemes were considered. The scheme chosen in this standard was chosen because of its simplicity, low gas cost and backwards compatibility with existing contracts.&lt;&#x2F;p&gt;
&lt;p&gt;Here are other schemes that were considered:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Associating an Ethereum Name Service (ENS) domain name with a contract.&lt;&#x2F;strong&gt; A contract&#x27;s &lt;code&gt;owner()&lt;&#x2F;code&gt; function could look up the owner address of a particular ENS name and use that as the owning address of the contract. Using this scheme a contract could be transferred by transferring the ownership of the ENS domain name to a different address. Short comings to this approach are that it is not backwards compatible with existing contracts and requires gas to make external calls to ENS related contracts to get the owner address.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Associating an ERC721-based non-fungible token (NFT) with a contract.&lt;&#x2F;strong&gt; Ownership of a contract could be tied to the ownership of an NFT. The benefit of this approach is that the existing ERC721-based infrastructure could be used to sell&#x2F;buy&#x2F;auction contracts. Short comings to this approach are additional complexity and infrastructure required. A contract could be associated with a particular NFT but the NFT would not track that it had ownership of a contract unless it was programmed to track contracts. In addition handling ownership of contracts this way is not backwards compatible.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;This standard does not exclude the above ownership schemes or other schemes from also being implemented in the same contract. For example a contract could implement this standard and also implement the other schemes so that ownership could be managed and transferred in multiple ways. This standard does provide a simple ownership scheme that is backwards compatible, is light-weight and simple to implement, and can be widely adopted and depended on.&lt;&#x2F;p&gt;
&lt;p&gt;This standard can be (and has been) extended by other standards to add additional ownership functionality.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;If the address returned by &lt;code&gt;owner()&lt;&#x2F;code&gt; is an externally owned account then its private key must not be lost or compromised.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Many existing contracts already implement this standard.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Extending ERC20 with token locking capability</title>
        <published>2018-06-03T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>nitika-goel</name><email>nitika@govblocks.io</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1132/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/1132" />
        

        <id>https://wg-eips.ritovision.com/1132/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:1132"
            label="ERC-1132" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1132/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;An extension to the ERC20 standard with methods for time-locking of tokens within a contract.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal provides basic functionality to time-lock tokens within an ERC20 smart contract for multiple utilities without the need of transferring tokens to an external escrow smart contract.  It also allows fetching balance of locked and transferable tokens.&lt;&#x2F;p&gt;
&lt;p&gt;Time-locking can also be achieved via staking (#900), but that requires transfer of tokens to an escrow contract &#x2F; stake manager, resulting in the following six concerns:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;additional trust on escrow contract &#x2F; stake manager&lt;&#x2F;li&gt;
&lt;li&gt;additional approval process for token transfer&lt;&#x2F;li&gt;
&lt;li&gt;increased ops costs due to gas requirements in transfers&lt;&#x2F;li&gt;
&lt;li&gt;tough user experience as the user needs to claim the amount back from external escrows&lt;&#x2F;li&gt;
&lt;li&gt;inability for the user to track their true token balance &#x2F; token activity&lt;&#x2F;li&gt;
&lt;li&gt;inability for the user to utilize their locked tokens within the token ecosystem.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;dApps often require tokens to be time-locked against transfers for letting members 1) adhere to vesting schedules and 2) show skin in the game to comply with the underlying business process. I realized this need while building Nexus Mutual and GovBlocks.&lt;&#x2F;p&gt;
&lt;p&gt;In &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;nexusmutual.io&quot;&gt;Nexus Mutual&lt;&#x2F;a&gt;, claim assessors are required to lock their tokens before passing a vote for claims assessment. This is important as it ensures assessors’ skin in the game. The need here was that once a claim assessor locks his tokens for ‘n’ days, he should be able to cast multiple votes during that period of ‘n’ days, which is not feasible with staking mechanism.  There are other scenarios like skills&#x2F;identity verification or participation in gamified token curated registries where time-locked tokens are required as well.&lt;&#x2F;p&gt;
&lt;p&gt;In &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;govblocks.io&quot;&gt;GovBlocks&lt;&#x2F;a&gt;, I wanted to allow dApps to lock member tokens for governance, while still allowing members to use those locked tokens for other activities within the dApp business. This is also the case with DGX governance model where they’ve proposed quarterly token locking for participation in governance activities of DGX.&lt;&#x2F;p&gt;
&lt;p&gt;In addition to locking functionality, I have proposed a &lt;code&gt;Lock()&lt;&#x2F;code&gt; and &lt;code&gt;Unlock()&lt;&#x2F;code&gt; event, just like the &lt;code&gt;Transfer()&lt;&#x2F;code&gt; event , to track token lock and unlock status. From token holder’s perspective, it gets tough to manage token holdings if certain tokens are transferred to another account for locking, because whenever &lt;code&gt;balanceOf()&lt;&#x2F;code&gt; queries are triggered on token holder’s account – the result does not include locked tokens. A &lt;code&gt;totalBalanceOf()&lt;&#x2F;code&gt; function intends to solve this problem.&lt;&#x2F;p&gt;
&lt;p&gt;The intention with this proposal is to enhance the ERC20 standard with token-locking capability so that dApps can time-lock tokens of the members without having to transfer tokens to an escrow &#x2F; stake manager and at the same time allow members to use the locked tokens for multiple utilities.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;I’ve extended the ERC20 interface with the following enhancements:&lt;&#x2F;p&gt;
&lt;h3 id=&quot;locking-of-tokens&quot;&gt;Locking of tokens&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Locks a specified amount of tokens against an address,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  *      for a specified reason and time&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _reason&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The reason to lock tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Number of tokens to be locked&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _time&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Lock time in seconds&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; lock&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _reason&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _time&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;fetching-number-of-tokens-locked-under-each-utility&quot;&gt;Fetching number of tokens locked under each utility&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns tokens locked for a specified address for a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  *      specified reason&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _of&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address whose tokens are locked&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _reason&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The reason to query the lock tokens for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;   tokensLocked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; _of&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt; _reason&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;fetching-number-of-tokens-locked-under-each-utility-at-a-future-timestamp&quot;&gt;Fetching number of tokens locked under each utility at a future timestamp&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns tokens locked for a specified address for a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  *      specified reason at a specific time&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _of&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address whose tokens are locked&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _reason&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The reason to query the lock tokens for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _time&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The timestamp to query the lock tokens for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokensLockedAtTime&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _of&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _reason&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _time&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;fetching-number-of-tokens-held-by-an-address&quot;&gt;Fetching number of tokens held by an address&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns total tokens held by an address (locked + transferable)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _of&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to query the total balance of&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalBalanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _of&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;extending-lock-period&quot;&gt;Extending lock period&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Extends lock for a specified reason and time&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _reason&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The reason to lock tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _time&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Lock extension time in seconds&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; extendLock&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _reason&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _time&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;increasing-number-of-tokens-locked&quot;&gt;Increasing number of tokens locked&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Increase number of tokens locked for a specified reason&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _reason&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The reason to lock tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Number of tokens to be increased&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; increaseLockAmount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _reason&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;fetching-number-of-unlockable-tokens-under-each-utility&quot;&gt;Fetching number of unlockable tokens under each utility&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns unlockable tokens for a specified address for a specified reason&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _of&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to query the unlockable token count of&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _reason&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The reason to query the unlockable tokens for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokensUnlockable&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _of&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _reason&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;fetching-number-of-unlockable-tokens&quot;&gt;Fetching number of unlockable tokens&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Gets the unlockable tokens of a specified address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _of&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address to query the unlockable token count of&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getUnlockableTokens&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _of&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; unlockableTokens&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;unlocking-tokens&quot;&gt;Unlocking tokens&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Unlocks the unlockable tokens of a specified address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _of&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of user, claiming back unlockable tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; unlock&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _of&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; unlockableTokens&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;lock-event-recorded-in-the-token-contract&quot;&gt;Lock event recorded in the token contract&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;event Locked(address indexed _of, uint256 indexed _reason, uint256 _amount, uint256 _validity)&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;unlock-event-recorded-in-the-token-contract&quot;&gt;Unlock event recorded in the token contract&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;event Unlocked(address indexed _of, uint256 indexed _reason, uint256 _amount)&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases are available at &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;nitika-goel&#x2F;lockable-token&quot;&gt;https:&#x2F;&#x2F;github.com&#x2F;nitika-goel&#x2F;lockable-token&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Complete implementation available at https:&#x2F;&#x2F;github.com&#x2F;nitika-goel&#x2F;lockable-token&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;govblocks.io&quot;&gt;GovBlocks&lt;&#x2F;a&gt; Project specific implementation available at https:&#x2F;&#x2F;github.com&#x2F;somish&#x2F;govblocks-protocol&#x2F;blob&#x2F;Locking&#x2F;contracts&#x2F;GBTStandardToken.sol&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Revised Ethereum Smart Contract Packaging Standard</title>
        <published>2018-06-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>g. nicholas d’andrea</name><uri>https://github.com/gnidan</uri>
	</author>
	
	<author>
		<name>Piper Merriam</name><uri>https://github.com/pipermerriam</uri>
	</author>
	
	<author>
		<name>Nick Gheorghita</name><uri>https://github.com/njgheorghita</uri>
	</author>
	
	<author>
		<name>Danny Ryan</name><uri>https://github.com/djrtwo</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1123/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/1123" />
        

        <id>https://wg-eips.ritovision.com/1123/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:1123"
            label="ERC-1123" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1123/">&lt;p&gt;This ERC has been abandoned in favor of the EthPM V3 smart contract packaging standard defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2678&#x2F;&quot;&gt;ERC-2678&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h1 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h1&gt;
&lt;p&gt;A data format describing a smart contract software package.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h1&gt;
&lt;p&gt;This EIP defines a data format for &lt;em&gt;package manifest&lt;&#x2F;em&gt; documents,
representing a package of one or more smart contracts, optionally
including source code and any&#x2F;all deployed instances across multiple
networks. Package manifests are minified JSON objects, to be distributed
via content addressable storage networks, such as IPFS.&lt;&#x2F;p&gt;
&lt;p&gt;This document presents a natural language description of a formal
specification for version &lt;strong&gt;2&lt;&#x2F;strong&gt; of this format.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h1&gt;
&lt;p&gt;This standard aims to encourage the Ethereum development ecosystem
towards software best practices around code reuse. By defining an open,
community-driven package data format standard, this effort seeks to
provide support for package management tools development by offering a
general-purpose solution that has been designed with observed common
practices in mind.&lt;&#x2F;p&gt;
&lt;p&gt;As version 2 of this specification, this standard seeks to address a
number of areas of improvement found for the previous version (defined
in
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;190&#x2F;&quot;&gt;EIP-190&lt;&#x2F;a&gt;).
This version:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Generalizes storage URIs to represent any content addressable URI
scheme, not only IPFS.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Renames &lt;em&gt;release lockfile&lt;&#x2F;em&gt; to &lt;em&gt;package manifest&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Adds support for languages other than Solidity by generalizing the
compiler information format.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Redefines link references to be more flexible, to represent
arbitrary gaps in bytecode (besides only addresses), in a more
straightforward way.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Forces format strictness, requiring that package manifests contain
no extraneous whitespace, and sort object keys in alphabetical
order, to prevent hash mismatches.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;div id=&quot;package-specification&quot;&gt;&lt;&#x2F;div&gt;
&lt;h1 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h1&gt;
&lt;p&gt;This document defines the specification for an EthPM package manifest. A
package manifest provides metadata about a &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-package&quot;&gt;Package&lt;&#x2F;a&gt;, and
in most cases should provide sufficient information about the packaged
contracts and its dependencies to do bytecode verification of its
contracts.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;A &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethpm.github.io&#x2F;ethpm-spec&quot;&gt;hosted
version&lt;&#x2F;a&gt; of this
specification is available via GitHub Pages. This EIP and the hosted
HTML document were both autogenerated from the same documentation
source.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h2 id=&quot;guiding-principles&quot;&gt;Guiding Principles&lt;&#x2F;h2&gt;
&lt;p&gt;This specification makes the following assumptions about the document
lifecycle.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Package manifests are intended to be generated programmatically by
package management software as part of the release process.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Package manifests will be consumed by package managers during tasks
like installing package dependencies or building and deploying new
releases.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Package manifests will typically &lt;strong&gt;not&lt;&#x2F;strong&gt; be stored alongside the
source, but rather by package registries &lt;em&gt;or&lt;&#x2F;em&gt; referenced by package
registries and stored in something akin to IPFS.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;conventions&quot;&gt;Conventions&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;rfc2119&quot;&gt;RFC2119&lt;&#x2F;h3&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”,
“SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this
document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.ietf.org&#x2F;rfc&#x2F;rfc2119.txt&quot;&gt;https:&#x2F;&#x2F;www.ietf.org&#x2F;rfc&#x2F;rfc2119.txt&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;prefixed-vs-unprefixed&quot;&gt;Prefixed vs Unprefixed&lt;&#x2F;h3&gt;
&lt;p&gt;A &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-prefixed&quot;&gt;prefixed&lt;&#x2F;a&gt; hexadecimal value begins with &lt;code&gt;0x&lt;&#x2F;code&gt;.
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-unprefixed&quot;&gt;Unprefixed&lt;&#x2F;a&gt; values have no prefix. Unless otherwise
specified, all hexadecimal values &lt;strong&gt;should&lt;&#x2F;strong&gt; be represented with the
&lt;code&gt;0x&lt;&#x2F;code&gt; prefix.&lt;&#x2F;p&gt;
&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;&#x2F;colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Prefixed&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;&lt;code&gt;0xdeadbeef&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Unprefixed&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;&lt;code&gt;deadbeef&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;
&lt;&#x2F;table&gt;
&lt;h2 id=&quot;document-format&quot;&gt;Document Format&lt;&#x2F;h2&gt;
&lt;p&gt;The canonical format is a single JSON object. Packages &lt;strong&gt;must&lt;&#x2F;strong&gt; conform
to the following serialization rules.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The document &lt;strong&gt;must&lt;&#x2F;strong&gt; be tightly packed, meaning no linebreaks or
extra whitespace.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The keys in all objects must be sorted alphabetically.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Duplicate keys in the same object are invalid.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The document &lt;strong&gt;must&lt;&#x2F;strong&gt; use
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;UTF-8&quot;&gt;UTF-8&lt;&#x2F;a&gt;
encoding.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The document &lt;strong&gt;must&lt;&#x2F;strong&gt; not have a trailing newline.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;document-specification&quot;&gt;Document Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The following fields are defined for the package. Custom fields &lt;strong&gt;may&lt;&#x2F;strong&gt;
be included. Custom fields &lt;strong&gt;should&lt;&#x2F;strong&gt; be prefixed with &lt;code&gt;x-&lt;&#x2F;code&gt; to prevent
name collisions with future versions of the specification.&lt;&#x2F;p&gt;
&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;&#x2F;colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;See Also&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;Formalized (&lt;a href=&quot;https:&#x2F;&#x2F;json-schema.org&quot;&gt;JSON-Schema&lt;&#x2F;a&gt;) version of this specification: &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethpm&#x2F;ethpm-spec&#x2F;tree&#x2F;v2.0.0&#x2F;spec&#x2F;package.spec.json&quot;&gt;package.spec.json&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Jump To&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;&lt;a href=&quot;#definitions&quot;&gt;Definitions&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;
&lt;&#x2F;table&gt;
&lt;div id=&quot;manifest-version&quot;&gt;&lt;&#x2F;div&gt;
&lt;h3 id=&quot;ethpm-manifest-version-manifest-version&quot;&gt;EthPM Manifest Version: &lt;code&gt;manifest_version&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;manifest_version&lt;&#x2F;code&gt; field defines the specification version that this
document conforms to. Packages &lt;strong&gt;must&lt;&#x2F;strong&gt; include this field.&lt;&#x2F;p&gt;
&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;&#x2F;colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;Yes&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Key&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;&lt;code&gt;manifest_version&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;String&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Allowed Values&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;&lt;code&gt;2&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;
&lt;&#x2F;table&gt;
&lt;div id=&quot;package-names&quot;&gt;&lt;&#x2F;div&gt;
&lt;h3 id=&quot;package-name-package-name&quot;&gt;Package Name: &lt;code&gt;package_name&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;package_name&lt;&#x2F;code&gt; field defines a human readable name for this package.
Packages &lt;strong&gt;must&lt;&#x2F;strong&gt; include this field. Package names &lt;strong&gt;must&lt;&#x2F;strong&gt; begin with
a lowercase letter and be comprised of only lowercase letters, numeric
characters, and the dash character &lt;code&gt;-&lt;&#x2F;code&gt;. Package names &lt;strong&gt;must&lt;&#x2F;strong&gt; not
exceed 214 characters in length.&lt;&#x2F;p&gt;
&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;&#x2F;colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;Yes&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Key&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;&lt;code&gt;package_name&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;String&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Format&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;&lt;strong&gt;must&lt;&#x2F;strong&gt; match the regular expression &lt;code&gt;^[a-zA-Z][a-zA-Z0-9_]{0,255}$&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;
&lt;&#x2F;table&gt;
&lt;h3 id=&quot;package-meta-meta&quot;&gt;Package Meta: &lt;code&gt;meta&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;meta&lt;&#x2F;code&gt; field defines a location for metadata about the package which
is not integral in nature for package installation, but may be important
or convenient to have on-hand for other reasons. This field &lt;strong&gt;should&lt;&#x2F;strong&gt;
be included in all Packages.&lt;&#x2F;p&gt;
&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;&#x2F;colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;No&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Key&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;&lt;code&gt;meta&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;&lt;a href=&quot;#package-meta-object&quot;&gt;Package Meta Object&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;
&lt;&#x2F;table&gt;
&lt;h3 id=&quot;version-version&quot;&gt;Version: &lt;code&gt;version&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;version&lt;&#x2F;code&gt; field declares the version number of this release. This
value &lt;strong&gt;must&lt;&#x2F;strong&gt; be included in all Packages. This value &lt;strong&gt;should&lt;&#x2F;strong&gt;
conform to the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;semver.org&#x2F;&quot;&gt;semver&lt;&#x2F;a&gt; version
numbering specification.&lt;&#x2F;p&gt;
&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;&#x2F;colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;Yes&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Key&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;&lt;code&gt;version&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;String&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;
&lt;&#x2F;table&gt;
&lt;h3 id=&quot;sources-sources&quot;&gt;Sources: &lt;code&gt;sources&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;sources&lt;&#x2F;code&gt; field defines a source tree that &lt;strong&gt;should&lt;&#x2F;strong&gt; comprise the
full source tree necessary to recompile the contracts contained in this
release. Sources are declared in a key&#x2F;value mapping.&lt;&#x2F;p&gt;
&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;&#x2F;colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Key&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;&lt;code&gt;sources&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;Object (String: String)&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Format&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;See Below.&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;
&lt;&#x2F;table&gt;
&lt;h4 id=&quot;format&quot;&gt;Format&lt;&#x2F;h4&gt;
&lt;p&gt;Keys &lt;strong&gt;must&lt;&#x2F;strong&gt; be relative filesystem paths beginning with a &lt;code&gt;.&#x2F;&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Paths &lt;strong&gt;must&lt;&#x2F;strong&gt; resolve to a path that is within the current working
directory.&lt;&#x2F;p&gt;
&lt;p&gt;Values &lt;strong&gt;must&lt;&#x2F;strong&gt; conform to &lt;em&gt;one of&lt;&#x2F;em&gt; the following formats.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Source string.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-content-addressable-uri&quot;&gt;Content Addressable URI&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;When the value is a source string the key should be interpreted as a
file path.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;If the resulting document is a directory the key should be
interpreted as a directory path.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;If the resulting document is a file the key should be interpreted as
a file path.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;contract-types-contract-types&quot;&gt;Contract Types: &lt;code&gt;contract_types&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;contract_types&lt;&#x2F;code&gt; field holds the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-contract-type&quot;&gt;Contract
Types&lt;&#x2F;a&gt; which have been included in this release.
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-package&quot;&gt;Packages&lt;&#x2F;a&gt; &lt;strong&gt;should&lt;&#x2F;strong&gt; only include contract types that
can be found in the source files for this package. Packages &lt;strong&gt;should
not&lt;&#x2F;strong&gt; include contract types from dependencies. Packages &lt;strong&gt;should not&lt;&#x2F;strong&gt;
include abstract contracts in the contract types section of a release.&lt;&#x2F;p&gt;
&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;&#x2F;colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Key&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;&lt;code&gt;contract_types&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;Object (String: &lt;a href=&quot;#contract-type-object&quot;&gt;Contract Type Object&lt;&#x2F;a&gt;)&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Format&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;Keys &lt;strong&gt;must&lt;&#x2F;strong&gt; be valid &lt;a href=&quot;#term-contract-alias&quot;&gt;Contract Aliases&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Values &lt;strong&gt;must&lt;&#x2F;strong&gt; conform to the &lt;a href=&quot;#contract-type-object&quot;&gt;Contract Type Object&lt;&#x2F;a&gt; definition.&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;
&lt;&#x2F;table&gt;
&lt;h3 id=&quot;deployments-deployments&quot;&gt;Deployments: &lt;code&gt;deployments&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;deployments&lt;&#x2F;code&gt; field holds the information for the chains on which
this release has &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-contract-instance&quot;&gt;Contract Instances&lt;&#x2F;a&gt; as well
as the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-contract-type&quot;&gt;Contract Types&lt;&#x2F;a&gt; and other deployment
details for those deployed contract instances. The set of chains defined
by the &lt;code&gt;*BIP122 URI &amp;lt;#bip122-uris&amp;gt;*&lt;&#x2F;code&gt; keys for this object &lt;strong&gt;must&lt;&#x2F;strong&gt; be
unique.&lt;&#x2F;p&gt;
&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;&#x2F;colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Key&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;&lt;code&gt;deployments&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;Object (String: Object(String: &lt;a href=&quot;#contract-instance-object&quot;&gt;Contract Instance Object&lt;&#x2F;a&gt;))&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Format&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;See Below.&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;
&lt;&#x2F;table&gt;
&lt;h4 id=&quot;format-1&quot;&gt;Format&lt;&#x2F;h4&gt;
&lt;p&gt;Keys &lt;strong&gt;must&lt;&#x2F;strong&gt; be a valid BIP122 URI chain definition.&lt;&#x2F;p&gt;
&lt;p&gt;Values &lt;strong&gt;must&lt;&#x2F;strong&gt; be objects which conform to the following format.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Keys &lt;strong&gt;must&lt;&#x2F;strong&gt; be valid &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-contract-instance-name&quot;&gt;Contract Instance
Names&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Values &lt;strong&gt;must&lt;&#x2F;strong&gt; be a valid &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#contract-instance-object&quot;&gt;Contract Instance
Object&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;build-dependencies-build-dependencies&quot;&gt;Build Dependencies: &lt;code&gt;build_dependencies&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;build_dependencies&lt;&#x2F;code&gt; field defines a key&#x2F;value mapping of Ethereum
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-package&quot;&gt;Packages&lt;&#x2F;a&gt; that this project depends on.&lt;&#x2F;p&gt;
&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;&#x2F;colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;No&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Key&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;&lt;code&gt;build_dependencies&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;Object (String: String)&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Format&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;Keys &lt;strong&gt;must&lt;&#x2F;strong&gt; be valid &lt;a href=&quot;#package-names&quot;&gt;package names&lt;&#x2F;a&gt; matching the regular expression &lt;code&gt;[a-z][-a-z0-9]{0,213}&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Values &lt;strong&gt;must&lt;&#x2F;strong&gt; be valid IPFS URIs which resolve to a valid package.&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;
&lt;&#x2F;table&gt;
&lt;h2 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h2&gt;
&lt;p&gt;Definitions for different objects used within the Package. All objects
allow custom fields to be included. Custom fields &lt;strong&gt;should&lt;&#x2F;strong&gt; be prefixed
with &lt;code&gt;x-&lt;&#x2F;code&gt; to prevent name collisions with future versions of the
specification.&lt;&#x2F;p&gt;
&lt;div id=&quot;link-reference-object&quot;&gt;&lt;&#x2F;div&gt;
&lt;h3 id=&quot;the-link-reference-object&quot;&gt;The &lt;em&gt;Link Reference&lt;&#x2F;em&gt; Object&lt;&#x2F;h3&gt;
&lt;p&gt;A &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-link-reference&quot;&gt;Link Reference&lt;&#x2F;a&gt; object has the following
key&#x2F;value pairs. All link references are assumed to be associated with
some corresponding &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-bytecode&quot;&gt;Bytecode&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;offsets-offsets&quot;&gt;Offsets: &lt;code&gt;offsets&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;offsets&lt;&#x2F;code&gt; field is an array of integers, corresponding to each of
the start positions where the link reference appears in the bytecode.
Locations are 0-indexed from the beginning of the bytes representation
of the corresponding bytecode. This field is invalid if it references a
position that is beyond the end of the bytecode.&lt;&#x2F;p&gt;
&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;&#x2F;colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;Yes&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;Array&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;
&lt;&#x2F;table&gt;
&lt;h4 id=&quot;length-length&quot;&gt;Length: &lt;code&gt;length&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;length&lt;&#x2F;code&gt; field is an integer which defines the length in bytes of
the link reference. This field is invalid if the end of the defined link
reference exceeds the end of the bytecode.&lt;&#x2F;p&gt;
&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;&#x2F;colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;Yes&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;Integer&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;
&lt;&#x2F;table&gt;
&lt;h4 id=&quot;name-name&quot;&gt;Name: &lt;code&gt;name&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;name&lt;&#x2F;code&gt; field is a string which &lt;strong&gt;must&lt;&#x2F;strong&gt; be a valid
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-identifier&quot;&gt;Identifier&lt;&#x2F;a&gt;. Any link references which &lt;strong&gt;should&lt;&#x2F;strong&gt; be
linked with the same link value &lt;strong&gt;should&lt;&#x2F;strong&gt; be given the same name.&lt;&#x2F;p&gt;
&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;&#x2F;colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;No&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;String&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Format&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;&lt;strong&gt;must&lt;&#x2F;strong&gt; conform to the &lt;a href=&quot;#term-identifier&quot;&gt;Identifier&lt;&#x2F;a&gt; format.&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;
&lt;&#x2F;table&gt;
&lt;div id=&quot;link-value-object&quot;&gt;&lt;&#x2F;div&gt;
&lt;h3 id=&quot;the-link-value-object&quot;&gt;The &lt;em&gt;Link Value&lt;&#x2F;em&gt; Object&lt;&#x2F;h3&gt;
&lt;p&gt;Describes a single &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-link-value&quot;&gt;Link Value&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;A &lt;strong&gt;Link Value object&lt;&#x2F;strong&gt; is defined to have the following key&#x2F;value
pairs.&lt;&#x2F;p&gt;
&lt;div id=&quot;offset-offset-1&quot;&gt;&lt;&#x2F;div&gt;
&lt;h4 id=&quot;offsets-offsets-1&quot;&gt;Offsets: &lt;code&gt;offsets&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;offsets&lt;&#x2F;code&gt; field defines the locations within the corresponding
bytecode where the &lt;code&gt;value&lt;&#x2F;code&gt; for this link value was written. These
locations are 0-indexed from the beginning of the bytes representation
of the corresponding bytecode.&lt;&#x2F;p&gt;
&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;&#x2F;colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;Yes&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;Integer&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Format&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;See Below.&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;
&lt;&#x2F;table&gt;
&lt;p&gt;&lt;strong&gt;Format&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Array of integers, where each integer &lt;strong&gt;must&lt;&#x2F;strong&gt; conform to all of the
following.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;greater than or equal to zero&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;strictly less than the length of the unprefixed hexadecimal
representation of the corresponding bytecode.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;type-type&quot;&gt;Type: &lt;code&gt;type&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;type&lt;&#x2F;code&gt; field defines the &lt;code&gt;value&lt;&#x2F;code&gt; type for determining what is
encoded when &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-linking&quot;&gt;linking&lt;&#x2F;a&gt; the corresponding bytecode.&lt;&#x2F;p&gt;
&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;&#x2F;colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;Yes&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;String&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Allowed Values&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;&lt;code&gt;&amp;quot;literal&amp;quot;&lt;&#x2F;code&gt; for bytecode literals&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;&amp;quot;reference&amp;quot;&lt;&#x2F;code&gt; for named references to a particular &lt;a href=&quot;#term-contract-instance&quot;&gt;Contract Instance&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;
&lt;&#x2F;table&gt;
&lt;h4 id=&quot;value-value&quot;&gt;Value: &lt;code&gt;value&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;value&lt;&#x2F;code&gt; field defines the value which should be written when
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-linking&quot;&gt;linking&lt;&#x2F;a&gt; the corresponding bytecode.&lt;&#x2F;p&gt;
&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;&#x2F;colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;Yes&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;String&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Format&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;Determined based on &lt;code&gt;type&lt;&#x2F;code&gt;, see below.&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;
&lt;&#x2F;table&gt;
&lt;p&gt;&lt;strong&gt;Format&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;For static value &lt;em&gt;literals&lt;&#x2F;em&gt; (e.g. address), value &lt;strong&gt;must&lt;&#x2F;strong&gt; be a &lt;em&gt;byte
string&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;To reference the address of a &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-contract-instance&quot;&gt;Contract
Instance&lt;&#x2F;a&gt; from the current package the value
should be the name of that contract instance.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;This value &lt;strong&gt;must&lt;&#x2F;strong&gt; be a valid contract instance name.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The chain definition under which the contract instance that this
link value belongs to must contain this value within its keys.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;This value &lt;strong&gt;may not&lt;&#x2F;strong&gt; reference the same contract instance that
this link value belongs to.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;To reference a contract instance from a &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-package&quot;&gt;Package&lt;&#x2F;a&gt; from
somewhere within the dependency tree the value is constructed as
follows.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Let &lt;code&gt;[p1, p2, .. pn]&lt;&#x2F;code&gt; define a path down the dependency tree.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Each of &lt;code&gt;p1, p2, pn&lt;&#x2F;code&gt; &lt;strong&gt;must&lt;&#x2F;strong&gt; be valid package names.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;p1&lt;&#x2F;code&gt; &lt;strong&gt;must&lt;&#x2F;strong&gt; be present in keys of the &lt;code&gt;build_dependencies&lt;&#x2F;code&gt; for the
current package.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;For every &lt;code&gt;pn&lt;&#x2F;code&gt; where &lt;code&gt;n &amp;gt; 1&lt;&#x2F;code&gt;, &lt;code&gt;pn&lt;&#x2F;code&gt; &lt;strong&gt;must&lt;&#x2F;strong&gt; be present in the keys
of the &lt;code&gt;build_dependencies&lt;&#x2F;code&gt; of the package for &lt;code&gt;pn-1&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The value is represented by the string
&lt;code&gt;&amp;lt;p1&amp;gt;:&amp;lt;p2&amp;gt;:&amp;lt;...&amp;gt;:&amp;lt;pn&amp;gt;:&amp;lt;contract-instance&amp;gt;&lt;&#x2F;code&gt; where all of &lt;code&gt;&amp;lt;p1&amp;gt;&lt;&#x2F;code&gt;,
&lt;code&gt;&amp;lt;p2&amp;gt;&lt;&#x2F;code&gt;, &lt;code&gt;&amp;lt;pn&amp;gt;&lt;&#x2F;code&gt; are valid package names and &lt;code&gt;&amp;lt;contract-instance&amp;gt;&lt;&#x2F;code&gt; is
a valid &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-contract-name&quot;&gt;Contract Name&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;&amp;lt;contract-instance&amp;gt;&lt;&#x2F;code&gt; value &lt;strong&gt;must&lt;&#x2F;strong&gt; be a valid &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-contract-instance-name&quot;&gt;Contract
Instance Name&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Within the package of the dependency defined by &lt;code&gt;&amp;lt;pn&amp;gt;&lt;&#x2F;code&gt;, all of the
following must be satisfiable:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;There &lt;strong&gt;must&lt;&#x2F;strong&gt; be &lt;em&gt;exactly&lt;&#x2F;em&gt; one chain defined under the
&lt;code&gt;deployments&lt;&#x2F;code&gt; key which matches the chain definition that this
link value is nested under.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;&amp;lt;contract-instance&amp;gt;&lt;&#x2F;code&gt; value &lt;strong&gt;must&lt;&#x2F;strong&gt; be present in the keys
of the matching chain.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;the-bytecode-object&quot;&gt;The &lt;em&gt;Bytecode&lt;&#x2F;em&gt; Object&lt;&#x2F;h3&gt;
&lt;p&gt;A bytecode object has the following key&#x2F;value pairs.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;bytecode-bytecode&quot;&gt;Bytecode: &lt;code&gt;bytecode&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;bytecode&lt;&#x2F;code&gt; field is a string containing the &lt;code&gt;0x&lt;&#x2F;code&gt; prefixed
hexadecimal representation of the bytecode.&lt;&#x2F;p&gt;
&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;&#x2F;colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;Yes&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;String&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Format&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;&lt;code&gt;0x&lt;&#x2F;code&gt; prefixed hexadecimal.&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;
&lt;&#x2F;table&gt;
&lt;h4 id=&quot;link-references-link-references&quot;&gt;Link References: &lt;code&gt;link_references&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;link_references&lt;&#x2F;code&gt; field defines the locations in the corresponding
bytecode which require &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-linking&quot;&gt;linking&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;&#x2F;colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;No&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;Array&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Format&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;All values &lt;strong&gt;must&lt;&#x2F;strong&gt; be valid &lt;a href=&quot;#link-reference-object&quot;&gt;Link Reference objects&lt;&#x2F;a&gt;. See also below.&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;
&lt;&#x2F;table&gt;
&lt;p&gt;&lt;strong&gt;Format&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;This field is considered invalid if &lt;em&gt;any&lt;&#x2F;em&gt; of the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-link-reference&quot;&gt;Link
References&lt;&#x2F;a&gt; are invalid when applied to the
corresponding &lt;code&gt;bytecode&lt;&#x2F;code&gt; field, &lt;em&gt;or&lt;&#x2F;em&gt; if any of the link references
intersect.&lt;&#x2F;p&gt;
&lt;p&gt;Intersection is defined as two link references which overlap.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;link-dependencies-link-dependencies&quot;&gt;Link Dependencies: &lt;code&gt;link_dependencies&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;link_dependencies&lt;&#x2F;code&gt; defines the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-link-value&quot;&gt;Link Values&lt;&#x2F;a&gt; that
have been used to link the corresponding bytecode.&lt;&#x2F;p&gt;
&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;&#x2F;colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;No&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;Array&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Format&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;All values &lt;strong&gt;must&lt;&#x2F;strong&gt; be valid &lt;a href=&quot;#link-value-object&quot;&gt;Link Value objects&lt;&#x2F;a&gt;. See also below.&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;
&lt;&#x2F;table&gt;
&lt;p&gt;&lt;strong&gt;Format&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Validation of this field includes the following:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Two link value objects &lt;strong&gt;must not&lt;&#x2F;strong&gt; contain any of the same values
for &lt;code&gt;offsets&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Each &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#link-value-object&quot;&gt;link value object&lt;&#x2F;a&gt; &lt;strong&gt;must&lt;&#x2F;strong&gt; have a
corresponding &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#link-reference-object&quot;&gt;link reference object&lt;&#x2F;a&gt; under
the &lt;code&gt;link_references&lt;&#x2F;code&gt; field.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The length of the resolved &lt;code&gt;value&lt;&#x2F;code&gt; &lt;strong&gt;must&lt;&#x2F;strong&gt; be equal to the &lt;code&gt;length&lt;&#x2F;code&gt;
of the corresponding &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-link-reference&quot;&gt;Link Reference&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;div id=&quot;package-meta-object&quot;&gt;&lt;&#x2F;div&gt;
&lt;h3 id=&quot;the-package-meta-object&quot;&gt;The &lt;em&gt;Package Meta&lt;&#x2F;em&gt; Object&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;em&gt;Package Meta&lt;&#x2F;em&gt; object is defined to have the following key&#x2F;value
pairs.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;authors-authors&quot;&gt;Authors: &lt;code&gt;authors&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;authors&lt;&#x2F;code&gt; field defines a list of human readable names for the
authors of this package. Packages &lt;strong&gt;may&lt;&#x2F;strong&gt; include this field.&lt;&#x2F;p&gt;
&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;&#x2F;colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;No&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Key&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;&lt;code&gt;authors&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;Array (String)&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;
&lt;&#x2F;table&gt;
&lt;h4 id=&quot;license-license&quot;&gt;License: &lt;code&gt;license&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;license&lt;&#x2F;code&gt; field declares the license under which this package is
released. This value &lt;strong&gt;should&lt;&#x2F;strong&gt; conform to the
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Software_Package_Data_Exchange&quot;&gt;SPDX&lt;&#x2F;a&gt;
format. Packages &lt;strong&gt;should&lt;&#x2F;strong&gt; include this field.&lt;&#x2F;p&gt;
&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;&#x2F;colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;No&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Key&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;&lt;code&gt;license&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;String&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;
&lt;&#x2F;table&gt;
&lt;h4 id=&quot;description-description&quot;&gt;Description: &lt;code&gt;description&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;description&lt;&#x2F;code&gt; field provides additional detail that may be relevant
for the package. Packages &lt;strong&gt;may&lt;&#x2F;strong&gt; include this field.&lt;&#x2F;p&gt;
&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;&#x2F;colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;No&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Key&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;&lt;code&gt;description&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;String&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;
&lt;&#x2F;table&gt;
&lt;h4 id=&quot;keywords-keywords&quot;&gt;Keywords: &lt;code&gt;keywords&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;keywords&lt;&#x2F;code&gt; field provides relevant keywords related to this package.&lt;&#x2F;p&gt;
&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;&#x2F;colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;No&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Key&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;&lt;code&gt;keywords&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;List of Strings&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;
&lt;&#x2F;table&gt;
&lt;h4 id=&quot;links-links&quot;&gt;Links: &lt;code&gt;links&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;links&lt;&#x2F;code&gt; field provides URIs to relevant resources associated with
this package. When possible, authors &lt;strong&gt;should&lt;&#x2F;strong&gt; use the following keys
for the following common resources.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;website&lt;&#x2F;code&gt;: Primary website for the package.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;documentation&lt;&#x2F;code&gt;: Package Documentation&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;repository&lt;&#x2F;code&gt;: Location of the project source code.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;&#x2F;colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Key&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;&lt;code&gt;links&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;Object (String: String)&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;
&lt;&#x2F;table&gt;
&lt;div id=&quot;contract-type-object&quot;&gt;&lt;&#x2F;div&gt;
&lt;h3 id=&quot;the-contract-type-object&quot;&gt;The &lt;em&gt;Contract Type&lt;&#x2F;em&gt; Object&lt;&#x2F;h3&gt;
&lt;p&gt;A &lt;em&gt;Contract Type&lt;&#x2F;em&gt; object is defined to have the following key&#x2F;value
pairs.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;contract-name-contract-name&quot;&gt;Contract Name: &lt;code&gt;contract_name&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;contract_name&lt;&#x2F;code&gt; field defines the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-contract-name&quot;&gt;Contract
Name&lt;&#x2F;a&gt; for this &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-contract-type&quot;&gt;Contract
Type&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;&#x2F;colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;If the &lt;a href=&quot;#term-contract-name&quot;&gt;Contract Name&lt;&#x2F;a&gt; and &lt;a href=&quot;#term-contract-alias&quot;&gt;Contract Alias&lt;&#x2F;a&gt; are not the same.&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;String&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Format&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;&lt;strong&gt;must&lt;&#x2F;strong&gt; be a valid &lt;a href=&quot;#term-contract-name&quot;&gt;Contract Name&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;
&lt;&#x2F;table&gt;
&lt;h4 id=&quot;deployment-bytecode-deployment-bytecode&quot;&gt;Deployment Bytecode: &lt;code&gt;deployment_bytecode&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;deployment_bytecode&lt;&#x2F;code&gt; field defines the bytecode for this &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-contract-type&quot;&gt;Contract
Type&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;&#x2F;colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;No&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;Object&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Format&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;&lt;strong&gt;must&lt;&#x2F;strong&gt; conform to &lt;a href=&quot;#the-bytecode-object&quot;&gt;the Bytecode Object&lt;&#x2F;a&gt; format.&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;
&lt;&#x2F;table&gt;
&lt;h4 id=&quot;runtime-bytecode-runtime-bytecode&quot;&gt;Runtime Bytecode: &lt;code&gt;runtime_bytecode&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;runtime_bytecode&lt;&#x2F;code&gt; field defines the unlinked &lt;code&gt;0x&lt;&#x2F;code&gt;-prefixed runtime
portion of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-bytecode&quot;&gt;Bytecode&lt;&#x2F;a&gt; for this &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-contract-type&quot;&gt;Contract
Type&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;&#x2F;colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;No&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;Object&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Format&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;&lt;strong&gt;must&lt;&#x2F;strong&gt; conform to &lt;a href=&quot;#the-bytecode-object&quot;&gt;the Bytecode Object&lt;&#x2F;a&gt; format.&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;
&lt;&#x2F;table&gt;
&lt;h4 id=&quot;abi-abi&quot;&gt;ABI: &lt;code&gt;abi&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;&#x2F;colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;No&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;List&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Format&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;&lt;strong&gt;must&lt;&#x2F;strong&gt; conform to the &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;wiki&#x2F;wiki&#x2F;Ethereum-Contract-ABI#json&quot;&gt;Ethereum Contract ABI JSON format&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;
&lt;&#x2F;table&gt;
&lt;h4 id=&quot;natspec-natspec&quot;&gt;Natspec: &lt;code&gt;natspec&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;&#x2F;colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;No&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;Object&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Format&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;The union of the &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;wiki&#x2F;wiki&#x2F;Ethereum-Natural-Specification-Format#user-documentation&quot;&gt;UserDoc&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;wiki&#x2F;wiki&#x2F;Ethereum-Natural-Specification-Format#developer-documentation&quot;&gt;DevDoc&lt;&#x2F;a&gt; formats.&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;
&lt;&#x2F;table&gt;
&lt;h4 id=&quot;compiler-compiler&quot;&gt;Compiler: &lt;code&gt;compiler&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;&#x2F;colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;No&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;Object&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Format&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;&lt;strong&gt;must&lt;&#x2F;strong&gt; conform to &lt;a href=&quot;#the-compiler-information-object&quot;&gt;the Compiler Information object&lt;&#x2F;a&gt; format.&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;
&lt;&#x2F;table&gt;
&lt;div id=&quot;contract-instance-object&quot;&gt;&lt;&#x2F;div&gt;
&lt;h3 id=&quot;the-contract-instance-object&quot;&gt;The &lt;em&gt;Contract Instance&lt;&#x2F;em&gt; Object&lt;&#x2F;h3&gt;
&lt;p&gt;A &lt;strong&gt;Contract Instance Object&lt;&#x2F;strong&gt; represents a single deployed &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-contract-instance&quot;&gt;Contract
Instance&lt;&#x2F;a&gt; and is defined to have the following
key&#x2F;value pairs.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;contract-type-contract-type&quot;&gt;Contract Type: &lt;code&gt;contract_type&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;contract_type&lt;&#x2F;code&gt; field defines the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-contract-type&quot;&gt;Contract
Type&lt;&#x2F;a&gt; for this &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-contract-instance&quot;&gt;Contract
Instance&lt;&#x2F;a&gt;. This can reference any of the
contract types included in this &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-package&quot;&gt;Package&lt;&#x2F;a&gt; &lt;em&gt;or&lt;&#x2F;em&gt; any of the
contract types found in any of the package dependencies from the
&lt;code&gt;build_dependencies&lt;&#x2F;code&gt; section of the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-package-manifest&quot;&gt;Package
Manifest&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;&#x2F;colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;Yes&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;String&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Format&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;See Below.&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;
&lt;&#x2F;table&gt;
&lt;p&gt;&lt;strong&gt;Format&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Values for this field &lt;strong&gt;must&lt;&#x2F;strong&gt; conform to &lt;em&gt;one of&lt;&#x2F;em&gt; the two formats
herein.&lt;&#x2F;p&gt;
&lt;p&gt;To reference a contract type from this Package, use the format
&lt;code&gt;&amp;lt;contract-alias&amp;gt;&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;&amp;lt;contract-alias&amp;gt;&lt;&#x2F;code&gt; value &lt;strong&gt;must&lt;&#x2F;strong&gt; be a valid &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-contract-alias&quot;&gt;Contract
Alias&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The value &lt;strong&gt;must&lt;&#x2F;strong&gt; be present in the keys of the &lt;code&gt;contract_types&lt;&#x2F;code&gt;
section of this Package.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;To reference a contract type from a dependency, use the format
&lt;code&gt;&amp;lt;package-name&amp;gt;:&amp;lt;contract-alias&amp;gt;&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;&amp;lt;package-name&amp;gt;&lt;&#x2F;code&gt; value &lt;strong&gt;must&lt;&#x2F;strong&gt; be present in the keys of the
&lt;code&gt;build_dependencies&lt;&#x2F;code&gt; of this Package.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;&amp;lt;contract-alias&amp;gt;&lt;&#x2F;code&gt; value &lt;strong&gt;must&lt;&#x2F;strong&gt; be a valid &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-contract-alias&quot;&gt;Contract
Alias&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The resolved package for &lt;code&gt;&amp;lt;package-name&amp;gt;&lt;&#x2F;code&gt; must contain the
&lt;code&gt;&amp;lt;contract-alias&amp;gt;&lt;&#x2F;code&gt; value in the keys of the &lt;code&gt;contract_types&lt;&#x2F;code&gt;
section.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;address-address&quot;&gt;Address: &lt;code&gt;address&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;address&lt;&#x2F;code&gt; field defines the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-address&quot;&gt;Address&lt;&#x2F;a&gt; of the
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-contract-instance&quot;&gt;Contract Instance&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;&#x2F;colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;Yes&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;String&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Format&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;Hex encoded &lt;code&gt;0x&lt;&#x2F;code&gt; prefixed Ethereum address matching the regular expression &lt;code&gt;0x[0-9a-fA-F]{40}&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;
&lt;&#x2F;table&gt;
&lt;h4 id=&quot;transaction-transaction&quot;&gt;Transaction: &lt;code&gt;transaction&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;transaction&lt;&#x2F;code&gt; field defines the transaction hash in which this
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-contract-instance&quot;&gt;Contract Instance&lt;&#x2F;a&gt; was created.&lt;&#x2F;p&gt;
&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;&#x2F;colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;No&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;String&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Format&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;&lt;code&gt;0x&lt;&#x2F;code&gt; prefixed hex encoded transaction hash.&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;
&lt;&#x2F;table&gt;
&lt;h4 id=&quot;block-block&quot;&gt;Block: &lt;code&gt;block&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;block&lt;&#x2F;code&gt; field defines the block hash in which this the transaction
which created this &lt;em&gt;contract instance&lt;&#x2F;em&gt; was mined.&lt;&#x2F;p&gt;
&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;&#x2F;colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;No&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;String&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Format&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;&lt;code&gt;0x&lt;&#x2F;code&gt; prefixed hex encoded block hash.&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;
&lt;&#x2F;table&gt;
&lt;div id=&quot;runtime-bytecode-runtime-bytecode-1&quot;&gt;&lt;&#x2F;div&gt;
&lt;h4 id=&quot;runtime-bytecode-runtime-bytecode-1&quot;&gt;Runtime Bytecode: &lt;code&gt;runtime_bytecode&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;runtime_bytecode&lt;&#x2F;code&gt; field defines the runtime portion of bytecode for
this &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-contract-instance&quot;&gt;Contract Instance&lt;&#x2F;a&gt;. When present, the
value from this field supersedes the &lt;code&gt;runtime_bytecode&lt;&#x2F;code&gt; from the
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-contract-type&quot;&gt;Contract Type&lt;&#x2F;a&gt; for this &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-contract-instance&quot;&gt;Contract
Instance&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;&#x2F;colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;No&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;Object&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Format&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;&lt;strong&gt;must&lt;&#x2F;strong&gt; conform to &lt;a href=&quot;#the-bytecode-object&quot;&gt;the Bytecode Object&lt;&#x2F;a&gt; format.&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;
&lt;&#x2F;table&gt;
&lt;p&gt;Every entry in the &lt;code&gt;link_references&lt;&#x2F;code&gt; for this bytecode &lt;strong&gt;must&lt;&#x2F;strong&gt; have a
corresponding entry in the &lt;code&gt;link_dependencies&lt;&#x2F;code&gt; section.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;compiler-compiler-1&quot;&gt;Compiler: &lt;code&gt;compiler&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;compiler&lt;&#x2F;code&gt; field defines the compiler information that was used
during compilation of this &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-contract-instance&quot;&gt;Contract Instance&lt;&#x2F;a&gt;.
This field &lt;strong&gt;should&lt;&#x2F;strong&gt; be present in all &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-contract-type&quot;&gt;Contract
Types&lt;&#x2F;a&gt; which include &lt;code&gt;bytecode&lt;&#x2F;code&gt; or
&lt;code&gt;runtime_bytecode&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;&#x2F;colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;No&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;Object&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Format&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;&lt;strong&gt;must&lt;&#x2F;strong&gt; conform to the &lt;a href=&quot;#compiler-information-object&quot;&gt;Compiler Information Object&lt;&#x2F;a&gt; format.&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;
&lt;&#x2F;table&gt;
&lt;div id=&quot;compiler-information-object&quot;&gt;&lt;&#x2F;div&gt;
&lt;h3 id=&quot;the-compiler-information-object&quot;&gt;The &lt;em&gt;Compiler Information&lt;&#x2F;em&gt; Object&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;compiler&lt;&#x2F;code&gt; field defines the compiler information that was used
during compilation of this &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-contract-instance&quot;&gt;Contract Instance&lt;&#x2F;a&gt;.
This field &lt;strong&gt;should&lt;&#x2F;strong&gt; be present in all contract instances that locally
declare &lt;code&gt;runtime_bytecode&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;A &lt;em&gt;Compiler Information&lt;&#x2F;em&gt; object is defined to have the following
key&#x2F;value pairs.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;name-name-1&quot;&gt;Name &lt;code&gt;name&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;name&lt;&#x2F;code&gt; field defines which compiler was used in compilation.&lt;&#x2F;p&gt;
&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;&#x2F;colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;Yes&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Key&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;&lt;code&gt;name&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;String&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;
&lt;&#x2F;table&gt;
&lt;h4 id=&quot;version-version-1&quot;&gt;Version: &lt;code&gt;version&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;version&lt;&#x2F;code&gt; field defines the version of the compiler. The field
&lt;strong&gt;should&lt;&#x2F;strong&gt; be OS agnostic (OS not included in the string) and take the
form of either the stable version in
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;semver.org&#x2F;&quot;&gt;semver&lt;&#x2F;a&gt; format or if built on a
nightly should be denoted in the form of &lt;code&gt;&amp;lt;semver&amp;gt;-&amp;lt;commit-hash&amp;gt;&lt;&#x2F;code&gt; ex:
&lt;code&gt;0.4.8-commit.60cc1668&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;&#x2F;colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;Yes&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Key&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;&lt;code&gt;version&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;String&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;
&lt;&#x2F;table&gt;
&lt;h4 id=&quot;settings-settings&quot;&gt;Settings: &lt;code&gt;settings&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;settings&lt;&#x2F;code&gt; field defines any settings or configuration that was used
in compilation. For the &lt;code&gt;&quot;solc&quot;&lt;&#x2F;code&gt; compiler, this &lt;strong&gt;should&lt;&#x2F;strong&gt; conform to
the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;solidity.readthedocs.io&#x2F;en&#x2F;latest&#x2F;using-the-compiler.html#compiler-input-and-output-json-description&quot;&gt;Compiler Input and Output
Description&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;&#x2F;colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;No&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Key&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;&lt;code&gt;settings&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;Object&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;
&lt;&#x2F;table&gt;
&lt;h3 id=&quot;bip122-uris&quot;&gt;BIP122 URIs&lt;&#x2F;h3&gt;
&lt;p&gt;BIP122 URIs are used to define a blockchain via a subset of the
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;bitcoin&#x2F;bips&#x2F;blob&#x2F;master&#x2F;bip-0122.mediawiki&quot;&gt;BIP-122&lt;&#x2F;a&gt;
spec.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;blockchain:&#x2F;&#x2F;&amp;lt;genesis_hash&amp;gt;&#x2F;block&#x2F;&amp;lt;latest confirmed block hash&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;&amp;lt;genesis hash&amp;gt;&lt;&#x2F;code&gt; represents the blockhash of the first block on the
chain, and &lt;code&gt;&amp;lt;latest confirmed block hash&amp;gt;&lt;&#x2F;code&gt; represents the hash of the
latest block that’s been reliably confirmed (package managers should be
free to choose their desired level of confirmations).&lt;&#x2F;p&gt;
&lt;h1 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h1&gt;
&lt;p&gt;The following use cases were considered during the creation of this
specification.&lt;&#x2F;p&gt;
&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;&#x2F;colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;owned&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;A package which contains contracts which are not meant to be used by themselves but rather as base contracts to provide functionality to other contracts through inheritance.&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;transferable&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;A package which has a single dependency.&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;standard-token&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;A package which contains a reusable contract.&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;safe-math-lib&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;A package which contains deployed instance of one of the package contracts.&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;piper-coin&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;A package which contains a deployed instance of a reusable contract from a dependency.&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;escrow&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;A package which contains a deployed instance of a local contract which is linked against a deployed instance of a local library.&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;wallet&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;A package with a deployed instance of a local contract which is linked against a deployed instance of a library from a dependency.&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;wallet-with-send&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;A package with a deployed instance which links against a deep dependency.&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;
&lt;&#x2F;table&gt;
&lt;p&gt;Each use case builds incrementally on the previous one.&lt;&#x2F;p&gt;
&lt;p&gt;A full listing of &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethpm.github.io&#x2F;ethpm-spec&#x2F;use-cases.html&quot;&gt;Use
Cases&lt;&#x2F;a&gt;
can be found on the hosted version of this specification.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;glossary&quot;&gt;Glossary&lt;&#x2F;h1&gt;
&lt;div id=&quot;term-abi&quot;&gt;&lt;&#x2F;div&gt;
&lt;h2 id=&quot;abi&quot;&gt;ABI&lt;&#x2F;h2&gt;
&lt;p&gt;The JSON representation of the application binary interface. See the
official
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;solidity.readthedocs.io&#x2F;en&#x2F;develop&#x2F;abi-spec.html&quot;&gt;specification&lt;&#x2F;a&gt;
for more information.&lt;&#x2F;p&gt;
&lt;div id=&quot;term-address&quot;&gt;&lt;&#x2F;div&gt;
&lt;h2 id=&quot;address&quot;&gt;Address&lt;&#x2F;h2&gt;
&lt;p&gt;A public identifier for an account on a particular chain&lt;&#x2F;p&gt;
&lt;div id=&quot;term-bytecode&quot;&gt;&lt;&#x2F;div&gt;
&lt;h2 id=&quot;bytecode&quot;&gt;Bytecode&lt;&#x2F;h2&gt;
&lt;p&gt;The set of EVM instructions as produced by a compiler. Unless otherwise
specified this should be assumed to be hexadecimal encoded, representing
a whole number of bytes, and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-prefixed&quot;&gt;prefixed&lt;&#x2F;a&gt; with &lt;code&gt;0x&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Bytecode can either be linked or unlinked. (see
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-linking&quot;&gt;Linking&lt;&#x2F;a&gt;)&lt;&#x2F;p&gt;
&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;&#x2F;colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Unlinked Bytecode&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;The hexadecimal representation of a contract’s EVM instructions that contains sections of code that requires &lt;a href=&quot;#term-linking&quot;&gt;linking&lt;&#x2F;a&gt; for the contract to be functional.&lt;&#x2F;p&gt;
&lt;p&gt;The sections of code which are unlinked &lt;strong&gt;must&lt;&#x2F;strong&gt; be filled in with zero bytes.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Example&lt;&#x2F;strong&gt;: &lt;code&gt;0x606060405260e06000730000000000000000000000000000000000000000634d536f&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Linked Bytecode&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;The hexadecimal representation of a contract’s EVM instructions which has had all &lt;a href=&quot;#term-link-reference&quot;&gt;Link References&lt;&#x2F;a&gt; replaced with the desired &lt;a href=&quot;#term-link-value&quot;&gt;Link Values&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Example&lt;&#x2F;strong&gt;: &lt;code&gt;0x606060405260e06000736fe36000604051602001526040518160e060020a634d536f&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;
&lt;&#x2F;table&gt;
&lt;div id=&quot;term-chain-definition&quot;&gt;&lt;&#x2F;div&gt;
&lt;h2 id=&quot;chain-definition&quot;&gt;Chain Definition&lt;&#x2F;h2&gt;
&lt;p&gt;This definition originates from &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;bitcoin&#x2F;bips&#x2F;blob&#x2F;master&#x2F;bip-0122.mediawiki&quot;&gt;BIP122
URI&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;A URI in the format &lt;code&gt;blockchain:&#x2F;&#x2F;&amp;lt;chain_id&amp;gt;&#x2F;block&#x2F;&amp;lt;block_hash&amp;gt;&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;chain_id&lt;&#x2F;code&gt; is the unprefixed hexadecimal representation of the
genesis hash for the chain.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;block_hash&lt;&#x2F;code&gt; is the unprefixed hexadecimal representation of the
hash of a block on the chain.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;A chain is considered to match a chain definition if the genesis
block hash matches the &lt;code&gt;chain_id&lt;&#x2F;code&gt; and the block defined by &lt;code&gt;block_hash&lt;&#x2F;code&gt;
can be found on that chain. It is possible for multiple chains to match
a single URI, in which case all chains are considered valid matches&lt;&#x2F;p&gt;
&lt;div id=&quot;term-content-addressable-uri&quot;&gt;&lt;&#x2F;div&gt;
&lt;h2 id=&quot;content-addressable-uri&quot;&gt;Content Addressable URI&lt;&#x2F;h2&gt;
&lt;p&gt;Any URI which contains a cryptographic hash which can be used to verify
the integrity of the content found at the URI.&lt;&#x2F;p&gt;
&lt;p&gt;The URI format is defined in RFC3986&lt;&#x2F;p&gt;
&lt;p&gt;It is &lt;strong&gt;recommended&lt;&#x2F;strong&gt; that tools support IPFS and Swarm.&lt;&#x2F;p&gt;
&lt;div id=&quot;term-contract-alias&quot;&gt;&lt;&#x2F;div&gt;
&lt;h2 id=&quot;contract-alias&quot;&gt;Contract Alias&lt;&#x2F;h2&gt;
&lt;p&gt;This is a name used to reference a specific &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-contract-type&quot;&gt;Contract
Type&lt;&#x2F;a&gt;. Contract aliases &lt;strong&gt;must&lt;&#x2F;strong&gt; be unique within a
single &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-package&quot;&gt;Package&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The contract alias &lt;strong&gt;must&lt;&#x2F;strong&gt; use &lt;em&gt;one of&lt;&#x2F;em&gt; the following naming schemes:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;&amp;lt;contract-name&amp;gt;&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;&amp;lt;contract-name&amp;gt;[&amp;lt;identifier&amp;gt;]&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;code&gt;&amp;lt;contract-name&amp;gt;&lt;&#x2F;code&gt; portion &lt;strong&gt;must&lt;&#x2F;strong&gt; be the same as the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-contract-name&quot;&gt;Contract
Name&lt;&#x2F;a&gt; for this contract type.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;[&amp;lt;identifier&amp;gt;]&lt;&#x2F;code&gt; portion &lt;strong&gt;must&lt;&#x2F;strong&gt; match the regular expression
&lt;code&gt;\[[-a-zA-Z0-9]{1,256}]&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;div id=&quot;term-contract-instance&quot;&gt;&lt;&#x2F;div&gt;
&lt;h2 id=&quot;contract-instance&quot;&gt;Contract Instance&lt;&#x2F;h2&gt;
&lt;p&gt;A contract instance a specific deployed version of a &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-contract-type&quot;&gt;Contract
Type&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;All contract instances have an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-address&quot;&gt;Address&lt;&#x2F;a&gt; on some specific
chain.&lt;&#x2F;p&gt;
&lt;div id=&quot;term-contract-instance-name&quot;&gt;&lt;&#x2F;div&gt;
&lt;h2 id=&quot;contract-instance-name&quot;&gt;Contract Instance Name&lt;&#x2F;h2&gt;
&lt;p&gt;A name which refers to a specific &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-contract-instance&quot;&gt;Contract
Instance&lt;&#x2F;a&gt; on a specific chain from the
deployments of a single &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-package&quot;&gt;Package&lt;&#x2F;a&gt;. This name &lt;strong&gt;must&lt;&#x2F;strong&gt; be
unique across all other contract instances for the given chain. The name
must conform to the regular expression &lt;code&gt;[a-zA-Z][a-zA-Z0-9_]{0,255}&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;In cases where there is a single deployed instance of a given &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-contract-type&quot;&gt;Contract
Type&lt;&#x2F;a&gt;, package managers &lt;strong&gt;should&lt;&#x2F;strong&gt; use the
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-contract-alias&quot;&gt;Contract Alias&lt;&#x2F;a&gt; for that contract type for this
name.&lt;&#x2F;p&gt;
&lt;p&gt;In cases where there are multiple deployed instances of a given contract
type, package managers &lt;strong&gt;should&lt;&#x2F;strong&gt; use a name which provides some added
semantic information as to help differentiate the two deployed instances
in a meaningful way.&lt;&#x2F;p&gt;
&lt;div id=&quot;term-contract-name&quot;&gt;&lt;&#x2F;div&gt;
&lt;h2 id=&quot;contract-name&quot;&gt;Contract Name&lt;&#x2F;h2&gt;
&lt;p&gt;The name found in the source code that defines a specific &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-contract-type&quot;&gt;Contract
Type&lt;&#x2F;a&gt;. These names &lt;strong&gt;must&lt;&#x2F;strong&gt; conform to the regular
expression &lt;code&gt;[a-zA-Z][-a-zA-Z0-9_]{0,255}&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;There can be multiple contracts with the same contract name in a
projects source files.&lt;&#x2F;p&gt;
&lt;div id=&quot;term-contract-type&quot;&gt;&lt;&#x2F;div&gt;
&lt;h2 id=&quot;contract-type&quot;&gt;Contract Type&lt;&#x2F;h2&gt;
&lt;p&gt;Refers to a specific contract in the package source. This term can be
used to refer to an abstract contract, a normal contract, or a library.
Two contracts are of the same contract type if they have the same
bytecode.&lt;&#x2F;p&gt;
&lt;p&gt;Example:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;contract Wallet {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;A deployed instance of the &lt;code&gt;Wallet&lt;&#x2F;code&gt; contract would be of type
&lt;code&gt;Wallet&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;div id=&quot;term-identifier&quot;&gt;&lt;&#x2F;div&gt;
&lt;h2 id=&quot;identifier&quot;&gt;Identifier&lt;&#x2F;h2&gt;
&lt;p&gt;Refers generally to a named entity in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-package&quot;&gt;Package&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;A string matching the regular expression &lt;code&gt;[a-zA-Z][-_a-zA-Z0-9]{0,255}&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;div id=&quot;term-link-reference&quot;&gt;&lt;&#x2F;div&gt;
&lt;h2 id=&quot;link-reference&quot;&gt;Link Reference&lt;&#x2F;h2&gt;
&lt;p&gt;A location within a contract’s bytecode which needs to be linked. A link
reference has the following properties.&lt;&#x2F;p&gt;
&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;&#x2F;colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;&lt;code&gt;offset&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;Defines the location within the bytecode where the link reference begins.&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;&lt;code&gt;length&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;Defines the length of the reference.&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;&lt;code&gt;name&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;(optional.) A string to identify the reference&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;
&lt;&#x2F;table&gt;
&lt;div id=&quot;term-link-value&quot;&gt;&lt;&#x2F;div&gt;
&lt;h2 id=&quot;link-value&quot;&gt;Link Value&lt;&#x2F;h2&gt;
&lt;p&gt;A link value is the value which can be inserted in place of a &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-link-reference&quot;&gt;Link
Reference&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;div id=&quot;term-linking&quot;&gt;&lt;&#x2F;div&gt;
&lt;h2 id=&quot;linking&quot;&gt;Linking&lt;&#x2F;h2&gt;
&lt;p&gt;The act of replacing &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-link-reference&quot;&gt;Link References&lt;&#x2F;a&gt; with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-link-value&quot;&gt;Link
Values&lt;&#x2F;a&gt; within some &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-bytecode&quot;&gt;Bytecode&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;div id=&quot;term-package&quot;&gt;&lt;&#x2F;div&gt;
&lt;h2 id=&quot;package&quot;&gt;Package&lt;&#x2F;h2&gt;
&lt;p&gt;Distribution of an application’s source or compiled bytecode along with
metadata related to authorship, license, versioning, et al.&lt;&#x2F;p&gt;
&lt;p&gt;For brevity, the term &lt;strong&gt;Package&lt;&#x2F;strong&gt; is often used metonymously to mean
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-package-manifest&quot;&gt;Package Manifest&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;div id=&quot;term-package-manifest&quot;&gt;&lt;&#x2F;div&gt;
&lt;h2 id=&quot;package-manifest&quot;&gt;Package Manifest&lt;&#x2F;h2&gt;
&lt;p&gt;A machine-readable description of a package (See
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#package-specification&quot;&gt;Specification&lt;&#x2F;a&gt; for information about the format
for package manifests.)&lt;&#x2F;p&gt;
&lt;div id=&quot;term-prefixed&quot;&gt;&lt;&#x2F;div&gt;
&lt;h2 id=&quot;prefixed&quot;&gt;Prefixed&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-bytecode&quot;&gt;Bytecode&lt;&#x2F;a&gt; string with leading &lt;code&gt;0x&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;&#x2F;colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Example&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;&lt;code&gt;0xdeadbeef&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;
&lt;&#x2F;table&gt;
&lt;div id=&quot;term-unprefixed&quot;&gt;&lt;&#x2F;div&gt;
&lt;h2 id=&quot;unprefixed&quot;&gt;Unprefixed&lt;&#x2F;h2&gt;
&lt;p&gt;Not &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#term-prefixed&quot;&gt;Prefixed&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;col style=&quot;width: 50%&quot; &#x2F;&gt;
&lt;&#x2F;colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Example&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;td&gt;&lt;p&gt;&lt;code&gt;deadbeef&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;&lt;&#x2F;td&gt;
&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;
&lt;&#x2F;table&gt;
&lt;h1 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h1&gt;
&lt;p&gt;This specification supports backwards compatibility by use of the
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#manifest-version&quot;&gt;manifest_version&lt;&#x2F;a&gt; property. This
specification corresponds to version &lt;code&gt;2&lt;&#x2F;code&gt; as the value for that field.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;implementations&quot;&gt;Implementations&lt;&#x2F;h1&gt;
&lt;p&gt;This submission aims to coincide with development efforts towards
widespread implementation in commonly-used development tools.&lt;&#x2F;p&gt;
&lt;p&gt;The following tools are known to have begun or are nearing completion of
a supporting implementation.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;trufflesuite.com&#x2F;&quot;&gt;Truffle&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;populus.readthedocs.io&#x2F;en&#x2F;latest&#x2F;&quot;&gt;Populus&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;embark.status.im&#x2F;&quot;&gt;Embark&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Full support in implementation &lt;strong&gt;may&lt;&#x2F;strong&gt; require &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1123&#x2F;#further-work&quot;&gt;Further
Work&lt;&#x2F;a&gt;, specified below.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;further-work&quot;&gt;Further Work&lt;&#x2F;h1&gt;
&lt;p&gt;This EIP addresses only the data format for package descriptions.
Excluded from the scope of this specification are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Package registry interface definition&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Tooling integration, or how packages are stored on disk.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;These efforts &lt;strong&gt;should&lt;&#x2F;strong&gt; be considered separate, warranting future
dependent EIP submssions.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;acknowledgements&quot;&gt;Acknowledgements&lt;&#x2F;h1&gt;
&lt;p&gt;The authors of this document would like to thank the original authors of
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;190&#x2F;&quot;&gt;EIP-190&lt;&#x2F;a&gt;,
&lt;a rel=&quot;external&quot; href=&quot;http:&#x2F;&#x2F;ethprize.io&#x2F;&quot;&gt;ETHPrize&lt;&#x2F;a&gt; for their funding
support, all community
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethpm&#x2F;ethpm-spec&#x2F;graphs&#x2F;contributors&quot;&gt;contributors&lt;&#x2F;a&gt;,
and the Ethereum community at large.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h1&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Standardised DAPP announcements</title>
        <published>2018-05-31T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Jan Turk</name><uri>https://github.com/ThunderDeliverer</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1129/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-sda-standardised-dapp-announcements/508?u=thunderdeliverer" />
        

        <id>https://wg-eips.ritovision.com/1129/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1129"
            label="ERC-1129" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1129/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Standardisation of announcements in DAPPs and services on Ethereum network. This ERC provides proposed mechanics to increase the quality of service provided by DAPP developers and service providers, by setting a framework for announcements. Be it transitioning to a new smart contract or just freezing the service for some reason.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The proposed ERC defines format on how to post announcements about the service as well as how to remove them. It also defines mechanics on posting permissions and human friendly interface.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently there are no guidelines on how to notify the users of the service status in the DAPPs. This is especially obvious in ERC20 and it&#x27;s derivates. If the service is impeded by any reason it is good practice to have some sort of guidelines on how to announce that to the user. The standardisation would also provide traceability of the service&#x27;s status.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;structures&quot;&gt;Structures&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;announcer&quot;&gt;Announcer&lt;&#x2F;h4&gt;
&lt;p&gt;Stores information about the announcement maker. The &lt;code&gt;allowedToPost&lt;&#x2F;code&gt; stores posting permissions and is used for modifiers limiting announcement posting only to authorised entities. The &lt;code&gt;name&lt;&#x2F;code&gt; is used for human friendly identifier of the author to be stored.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Announcer&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; allowedToPost&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;announcement&quot;&gt;Announcement&lt;&#x2F;h4&gt;
&lt;p&gt;Stores information about the individual announcement. The human friendly author identifier is stored in &lt;code&gt;author&lt;&#x2F;code&gt;. Ethereum address associated with the author is stored in &lt;code&gt;authorAddress&lt;&#x2F;code&gt;. The announcement itself is stored in &lt;code&gt;post&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Announcement&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; author&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; authorAddress&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; post&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;methods&quot;&gt;Methods&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;the-number-of-announcements&quot;&gt;the number of announcements&lt;&#x2F;h4&gt;
&lt;p&gt;Returns the number of announcements currently active.&lt;&#x2F;p&gt;
&lt;p&gt;OPTIONAL - this method can be used to provide quicker information for the UI, but could also be retrieved from &lt;code&gt;numberOfMessages&lt;&#x2F;code&gt; variable.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; theNumberOfAnnouncements&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _numberOfAnnouncements&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;read-posts&quot;&gt;read posts&lt;&#x2F;h4&gt;
&lt;p&gt;Returns the specified announcement as well as human friendly poster identificator (name or nickname).&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; readPosts&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _postNumber&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _author&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _post&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;give-posting-permission&quot;&gt;give posting permission&lt;&#x2F;h4&gt;
&lt;p&gt;Sets posting permissions of the address &lt;code&gt;_newAnnouncer&lt;&#x2F;code&gt; to &lt;code&gt;_postingPrivileges&lt;&#x2F;code&gt; and can also be used to revoke those permissions. The &lt;code&gt;_posterName&lt;&#x2F;code&gt; is human friendly author identificator used in the announcement data.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; givePostingPermission&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _newAnnouncer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _postingPrivileges&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _posterName&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onlyOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;can-post&quot;&gt;can post&lt;&#x2F;h4&gt;
&lt;p&gt;Checks if the entity that wants to post an announcement has the posting privilieges.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;modifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; canPost&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;posterData&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;allowedToPost&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;post-announcement&quot;&gt;post announcement&lt;&#x2F;h4&gt;
&lt;p&gt;Lets user post announcements, but only if they have their posting privileges set to &lt;code&gt;true&lt;&#x2F;code&gt;. The announcement is sent in &lt;code&gt;_message&lt;&#x2F;code&gt; variable.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; postAnnouncement&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _message&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; canPost&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;remove-announcement&quot;&gt;remove announcement&lt;&#x2F;h4&gt;
&lt;p&gt;Removes an announcement with &lt;code&gt;_messageNumber&lt;&#x2F;code&gt; announcement identifier and rearranges the mapping so there are no empty slots. The &lt;code&gt;_removalReason&lt;&#x2F;code&gt; is used to update users if the issue that caused the announcement is resolved or what are the next steps from the service provider &#x2F; DAPP development team.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; removeAnnouncement&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _messageNumber&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _removalReason&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;events&quot;&gt;Events&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;new-announcement&quot;&gt;New announcement&lt;&#x2F;h4&gt;
&lt;p&gt;MUST trigger when new announcement is created.&lt;&#x2F;p&gt;
&lt;p&gt;Every time there is a new announcement it should be advertised in this event. It holds the information about author &lt;code&gt;author&lt;&#x2F;code&gt; and the announcement istelf &lt;code&gt;message&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NewAnnouncement&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; author&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; message&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;removed-announcement&quot;&gt;Removed announcement&lt;&#x2F;h4&gt;
&lt;p&gt;MUST trigger when an announcement is removed.&lt;&#x2F;p&gt;
&lt;p&gt;Every time an announcement is removed it should be advertised in this event. It holds the information about author &lt;code&gt;author&lt;&#x2F;code&gt;, the announcement itself &lt;code&gt;message&lt;&#x2F;code&gt;, the reason for removal or explanation of the solution &lt;code&gt;reason&lt;&#x2F;code&gt; and the address of the entity that removed the announcement &lt;code&gt;remover&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RemovedAnnouncement&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; author&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; message&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; reason&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; remover&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The proposed solution was designed with UX in mind . It provides mechanics that serve to present the announcements in the user friendly way. It is meant to be deployed as a Solidity smart contract on Ethereum network.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;The proposed version is deployed on Ropsten testnet all of the information can be found &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ropsten.etherscan.io&#x2F;address&#x2F;0xb04f67172b9733837e59ebaf03d277279635c8e6#readContract&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>PRECOMPILEDCALL opcode (Remove CALL costs for precompiled contracts)</title>
        <published>2018-05-22T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Jordi Baylina</name><uri>https://github.com/jbaylina</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1109/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-1109-remove-call-costs-for-precompiled-contracts/447" />
        

        <id>https://wg-eips.ritovision.com/1109/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1109"
            label="EIP-1109" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1109/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP creates a specific opcode named &lt;code&gt;PRECOMPILEDCALL&lt;&#x2F;code&gt; to call Precompiled contracts without the costs of a normal &lt;code&gt;CALL&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP tries to resolve the problem of high gas consumption when calling precompiled contracts with a small gas cost. Using this opcode for calling precompiled contracts allows to define precompiled contracts whose effective cost it is less than 700.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Each precompiled contract has an already defined cost for calling it. It does not make sense to add the implicit extra gas cost of the CALL opcode.&lt;&#x2F;p&gt;
&lt;p&gt;As an example, SHA256 precompiled contract costs 60 and ECADD costs 500 (proposed to costs only 50 in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1108&#x2F;&quot;&gt;EIP-1108&lt;&#x2F;a&gt; . When a precompiled contract is called, 700 gas is consumed just for the CALL opcode besides the costs of the precompiled contract.&lt;&#x2F;p&gt;
&lt;p&gt;This makes no sense, and right now it&#x27;s impossible to define a precompiled contract whose effective cost for using it, is less than 700.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= XXXXX&lt;&#x2F;code&gt;, define a new opcode named &lt;code&gt;PRECOMPILEDCALL&lt;&#x2F;code&gt; with code value &lt;code&gt;0xfb&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The gas cost of the OPCODE is 2 (Gbase) plus the Specific gas cost defined for each specific precompiled smart contract.&lt;&#x2F;p&gt;
&lt;p&gt;The OPCODE takes 5 words from the stack and returns 1 word to the stack.&lt;&#x2F;p&gt;
&lt;p&gt;The input stack values are:&lt;&#x2F;p&gt;
&lt;p&gt;mu_s[0] = The address of the precompiled smart contract that is called.
mu_s[1] = Pointer to memory for the input parameters.
mu_s[2] = Length of the input parameters in bytes.
mu_s[3] = Pointer to memory where the output is stored
mu_s[4] = Length of the output buffer.&lt;&#x2F;p&gt;
&lt;p&gt;The return will be 1 in case of success call and 0 in any of the next cases:&lt;&#x2F;p&gt;
&lt;p&gt;1.- mu_s[0] is an address of an undefined precompiled smart contract.
2.- The precompiled smart contract fails (as defined on each smart contract). Invalid input parameters for example.&lt;&#x2F;p&gt;
&lt;p&gt;Precompiled smart contracts, does not execute opcodes, so there is no need to pass a gas parameter as a normal &lt;code&gt;CALL&lt;&#x2F;code&gt; (&lt;code&gt;0xf1&lt;&#x2F;code&gt;).  If the available gas is less that 2 plus the required gas required for the specific precompiled smart contract, the context just STOPS executing with an &quot;Out of Gas&quot; error.&lt;&#x2F;p&gt;
&lt;p&gt;There is no stack check for this call.&lt;&#x2F;p&gt;
&lt;p&gt;The normal &lt;code&gt;CALL&lt;&#x2F;code&gt;s to the precompiled smart contracts continue to work with the exact same behavior.&lt;&#x2F;p&gt;
&lt;p&gt;A &lt;code&gt;PRECOMPILEDCALL&lt;&#x2F;code&gt; to a regular address or regular smart contract, is considered a call to an &quot;undefined smart contract&quot;, so the VM MUST not execute it and the opcode must return 0x0 .&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;There was a first proposal for removing the gast consts for the &lt;code&gt;CALL&lt;&#x2F;code&gt;, but it looks that it&#x27;s easier to implement and test a new opcode just for that.&lt;&#x2F;p&gt;
&lt;p&gt;The code is just the next opcode available after the &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; opcode.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is backwards compatible.  Smart contracts that call precompiled contracts using this new opcode will cost less from now on.&lt;&#x2F;p&gt;
&lt;p&gt;Old contracts that call precompiled smart contracts with the &lt;code&gt;CALL&lt;&#x2F;code&gt; method, will continue working.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Normal call to a defined precompiled contract.&lt;&#x2F;li&gt;
&lt;li&gt;Call to undefined precompiled contract.&lt;&#x2F;li&gt;
&lt;li&gt;Call to a regular contract&lt;&#x2F;li&gt;
&lt;li&gt;Call to a regular account&lt;&#x2F;li&gt;
&lt;li&gt;Call to 0x0 smart contract (Does not exists).&lt;&#x2F;li&gt;
&lt;li&gt;Call with large values for the offste pointers and lengths&lt;&#x2F;li&gt;
&lt;li&gt;Call with the exact gas remaining needed to call smart contract.&lt;&#x2F;li&gt;
&lt;li&gt;Call with the exact gas remaining minus one needed to call smart contract.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Not implemented yet.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Reduce alt_bn128 precompile gas costs</title>
        <published>2018-05-21T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Antonio Salazar Cardozo</name><uri>https://github.com/shadowfiend</uri>
	</author>
	
	<author>
		<name>Zachary Williamson</name><uri>https://github.com/zac-williamson</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1108/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-1108-reduce-alt-bn128-precompile-gas-costs/3206" />
        

        <id>https://wg-eips.ritovision.com/1108/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1108"
            label="EIP-1108" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1108/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;The elliptic curve arithmetic precompiles are currently overpriced. Re-pricing the precompiles would greatly assist a number of privacy solutions and scaling solutions on Ethereum.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Changes in 2018 to the underlying library used by the official Go reference
implementation led to significant performance gains for the &lt;code&gt;ECADD&lt;&#x2F;code&gt;, &lt;code&gt;ECMUL&lt;&#x2F;code&gt;,
and pairing check precompiled contracts on the &lt;code&gt;alt_bn128&lt;&#x2F;code&gt; elliptic curve.&lt;&#x2F;p&gt;
&lt;p&gt;In the Parity client, field operations used by the precompile algorithms were optimized in 2018,
and recent changes to the pairing algorithm used by the &lt;code&gt;bn&lt;&#x2F;code&gt; crate have brought considerable speedups.&lt;&#x2F;p&gt;
&lt;p&gt;Faster operations on Ethereum clients should be reflected in reduced gas costs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Recently, the underlying library used by the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;go-ethereum&quot;&gt;official Go reference
implementation&lt;&#x2F;a&gt; to implement the
&lt;code&gt;ECADD&lt;&#x2F;code&gt; (at address &lt;code&gt;0x06&lt;&#x2F;code&gt;), &lt;code&gt;ECMUL&lt;&#x2F;code&gt; (at address &lt;code&gt;0x07&lt;&#x2F;code&gt;), and pairing check (at
address &lt;code&gt;0x08&lt;&#x2F;code&gt;) precompiled contracts was shifted to &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;cloudflare&#x2F;bn256&quot;&gt;Cloudflare&#x27;s bn256
library&lt;&#x2F;a&gt;. Based on the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;go-ethereum&#x2F;pull&#x2F;16203&quot;&gt;initial PR that
introduced this change&lt;&#x2F;a&gt;,
and corroborated in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;go-ethereum&#x2F;pull&#x2F;16301#issuecomment-372687543&quot;&gt;a later
note&lt;&#x2F;a&gt;,
the computational cost of &lt;code&gt;ECADD&lt;&#x2F;code&gt;, &lt;code&gt;ECMUL&lt;&#x2F;code&gt;, and pairing checks (excepting the
constant) has dropped roughly an order of magnitude across the board.&lt;&#x2F;p&gt;
&lt;p&gt;Also, optimizations in the bn library &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;paritytech&#x2F;bn&#x2F;pull&#x2F;9&quot;&gt;in 2018&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;paritytech&#x2F;bn&#x2F;pull&#x2F;14&quot;&gt;2019&lt;&#x2F;a&gt;
used by the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;paritytech&#x2F;parity-ethereum&quot;&gt;Parity client&lt;&#x2F;a&gt; led to a
significant performance boost we
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;gist.github.com&#x2F;zac-williamson&#x2F;838410a3da179d47d31b25b586c15e53&quot;&gt;benchmarked&lt;&#x2F;a&gt;
and compared against the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;gist.github.com&#x2F;pdyraga&#x2F;4649b74436940a01e8221d85e80bfeef&quot;&gt;previous
results&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Following is a table with the current gas cost and new gas cost:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Contract&lt;&#x2F;th&gt;&lt;th&gt;Address&lt;&#x2F;th&gt;&lt;th&gt;Current Gas Cost&lt;&#x2F;th&gt;&lt;th&gt;Updated Gas Cost&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ECADD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x06&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;500&lt;sup&gt;[1]&lt;&#x2F;sup&gt;&lt;&#x2F;td&gt;&lt;td&gt;150&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ECMUL&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x07&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;40 000&lt;sup&gt;[1]&lt;&#x2F;sup&gt;&lt;&#x2F;td&gt;&lt;td&gt;6 000&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Pairing check&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x08&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;80 000 * k + 100 000&lt;sup&gt;[2]&lt;&#x2F;sup&gt;&lt;&#x2F;td&gt;&lt;td&gt;34 000 * k + 45 000&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The gas costs for &lt;code&gt;ECADD&lt;&#x2F;code&gt; and &lt;code&gt;ECMUL&lt;&#x2F;code&gt; are updates to the costs listed in
EIP-196, while the gas costs for the pairing check are updates to the cost
listed in EIP-197. Updated gas costs have been adjusted to the less performant
client which is Parity, according to benchmarks&lt;sup&gt;[3]&lt;&#x2F;sup&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;To come up with these updates gas costs, the performance of the &lt;code&gt;ecrecover&lt;&#x2F;code&gt; precompile
was measured at 116 microseconds per &lt;code&gt;ecrecover&lt;&#x2F;code&gt; invocation. Assuming the &lt;code&gt;ecrecover&lt;&#x2F;code&gt;
gas price is fair at 3,000 gas, we get a price of 25.86 gas per microsecond of a precompile
algorithm&#x27;s runtime. With this in mind, the pairing precompile took 3,037 microseconds to
compute 1 pairing, and 14,663 microseconds to compute 10 pairings. From this, the pairing
algorithm has a fixed &#x27;base&#x27; run-time of 1,745 microseconds, plus 1,292 microseconds per
pairing. We can split the run-time into &#x27;fixed cost&#x27; and &#x27;linear cost per pairing&#x27;
components because of the structure of the algorithm.&lt;&#x2F;p&gt;
&lt;p&gt;Thus using a &#x27;fair&#x27; price of 25.86 gas per microsecond, we get a gas formula of
~&lt;code&gt;35,000 * k + 45,000&lt;&#x2F;code&gt; gas, where &lt;code&gt;k&lt;&#x2F;code&gt; is the number of pairings being computed. [4]&lt;&#x2F;p&gt;
&lt;p&gt;[1]- Per &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;196&#x2F;&quot;&gt;EIP-196&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;[2]- Per &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;197&#x2F;&quot;&gt;EIP-197&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;[3]- &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;gist.github.com&#x2F;zac-williamson&#x2F;838410a3da179d47d31b25b586c15e53&quot;&gt;Parity benchmarks.&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;[4]- &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;pull&#x2F;1987#discussion_r280977066&quot;&gt;PR comment clarifying gas cost math&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;existing-protocols-would-benefit-immensely-from-cheaper-elliptic-curve-cryptography&quot;&gt;Existing protocols would benefit immensely from cheaper elliptic curve cryptography&lt;&#x2F;h3&gt;
&lt;p&gt;Fast elliptic curve cryptography is a keystone of a growing number of protocols built on top of Ethereum. To list a few:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;AztecProtocol&#x2F;AZTEC&quot;&gt;The AZTEC protocol&lt;&#x2F;a&gt; utilizes the elliptic curve precompiles to construct private tokens, with zero-knowledge transaction logic, via the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;1723&quot;&gt;ERC-1723&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;1724&quot;&gt;ERC-1724&lt;&#x2F;a&gt; standard.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;matter-labs&#x2F;matter-network&quot;&gt;Matter Labs&lt;&#x2F;a&gt; utilizes the precompiles to implement Ignis, a scaling solution with a throughput of 500txns per second&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;rollup&#x2F;rollup&quot;&gt;Rollup&lt;&#x2F;a&gt; utilizes the precompiles to create L2 scaling solutions, where the correctness of transactions is guaranteed by main-net, without an additional consensus layer&lt;&#x2F;li&gt;
&lt;li&gt;ZEther&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-1-1&quot;&gt;&lt;a href=&quot;#fn-1&quot;&gt;1&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; uses precompiles &lt;code&gt;ECADD&lt;&#x2F;code&gt; and &lt;code&gt;ECMUL&lt;&#x2F;code&gt; to construct confidential transactions&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;To give a concrete example, it currently costs &lt;code&gt;820,000&lt;&#x2F;code&gt; gas to validate the cryptography in a typical AZTEC confidential transaction. If the gas schedule for the precompiles correctly reflected their load on the Ethereum network, this cost would be &lt;code&gt;197,000&lt;&#x2F;code&gt; gas. This significantly increases the potential use cases for private assets on Ethereum. AZTEC is planning to deploy several cryptographic protocols Ethereum, but these are at the limits of what is practical given the current precompile costs:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Confidential weighted voting&lt;&#x2F;li&gt;
&lt;li&gt;Partial-order filling over encrypted orders, for private decentralized exchanges&lt;&#x2F;li&gt;
&lt;li&gt;Anonymous identity sharing proofs (e.g. proving you are on a whitelist, without revealing who you are)&lt;&#x2F;li&gt;
&lt;li&gt;Many-to-one payments and one-to-many confidential payments, as encrypted communication channels between main-net and L2 applications&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;For zk-SNARK based protocols on Ethereum, EIP-1108 will not only reduce the gas costs of verifying zk-SNARKs substantially, but can also aid in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;matter-labs&#x2F;Groth16BatchVerifier&quot;&gt;batching together multiple zk-SNARK proofs&lt;&#x2F;a&gt;. This is also a technique that can be used to split up monolithic zk-SNARK circuits into a batch of zk-SNARKs with smaller individual circuit sizes, which makes zk-SNARKs both easier to construct and deploy.&lt;&#x2F;p&gt;
&lt;p&gt;ZEther transactions currently cost ~&lt;code&gt;6,000,000&lt;&#x2F;code&gt; gas. This EIP would reduce this to ~&lt;code&gt;1,000,000&lt;&#x2F;code&gt; gas, which makes the protocol more practical.&lt;&#x2F;p&gt;
&lt;p&gt;To summarise, there are several protocols that currently exist on main-net, that would benefit immensely from this EIP. Elliptic curve cryptography can provide valuable solutions for Ethereum, such as scaling and privacy, and the scope and scale of these solutions can be increased if the gas costs for the &lt;code&gt;bn128&lt;&#x2F;code&gt; precompiles accurately reflects their computational load on the network.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;cheaper-elliptic-curve-cryptography-can-be-used-to-trade-storage-for-computation&quot;&gt;Cheaper elliptic curve cryptography can be used to trade storage for computation&lt;&#x2F;h3&gt;
&lt;p&gt;Solutions such as Rollup and Ignis can be used to batch groups of individual transactions into a zk-SNARK proof, with the on-chain state being represented by a small Merkle root, instead of multiple account balances.&lt;&#x2F;p&gt;
&lt;p&gt;If zk-SNARK verification costs are decreased, these solutions can be deployed for a wider range of use cases and more Rollup-style transactions can be processed per block.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parity-and-geth-already-have-fast-algorithms-that-justify-reduced-gas-costs&quot;&gt;Parity and Geth already have fast algorithms that justify reduced gas costs&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP does not require Parity or Geth to deploy new cryptographic libraries, as fast bn128 algorithms have already been integrated into these clients. This goal of proposing this EIP for Istanbul, is to supplement &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1829&#x2F;&quot;&gt;EIP-1829&lt;&#x2F;a&gt; (arithmetic over generic elliptic curves), providing an immediate solution to the pressing problem of expensive cryptography, while more advanced solutions are developed, defined and deployed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;As no underlying algorithms are being changed, there are no additional test cases to specify.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Both the Parity and Geth clients have already implemented cryptographic libraries that are fast enough to justify reducing the precompile gas costs. As a reference, here are a list of elliptic curve libraries, in &lt;code&gt;C++&lt;&#x2F;code&gt;, &lt;code&gt;golang&lt;&#x2F;code&gt; and &lt;code&gt;rust&lt;&#x2F;code&gt;, that support the &lt;code&gt;bn128&lt;&#x2F;code&gt; curve, and have run-times that are equal to or faster than the Parity benchmarks.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;paritytech&#x2F;bn&quot;&gt;Parity bn crate (rust)&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;go-ethereum&#x2F;tree&#x2F;master&#x2F;crypto&#x2F;bn256&#x2F;cloudflare&quot;&gt;Geth bn256 library (golang)&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;herumi&#x2F;mcl&quot;&gt;MCL, a portable C++ pairing library&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;scipr-lab&#x2F;libff&quot;&gt;Libff, a C++ pairing library used in many zk-SNARK libraries&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;additional-references&quot;&gt;Additional References&lt;&#x2F;h2&gt;
&lt;p&gt;@vbuterin independently proposed a similar reduction after this EIP was originally created, with similar rationale, as &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;1187&quot;&gt;ethereum&#x2F;EIPs#1187&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;section class=&quot;footnotes&quot;&gt;
&lt;ol class=&quot;footnotes-list&quot;&gt;
&lt;li id=&quot;fn-1&quot;&gt;
&lt;p&gt;Bünz, B., Agrawal, S., Zamani, M., &amp;amp; Boneh, D. (2020). Zether: Towards Privacy in a Smart Contract World. In J. Bonneau &amp;amp; N. Heninger (Eds.), &lt;span style=&quot;font-style: italic;&quot;&gt;Financial Cryptography and Data Security&lt;&#x2F;span&gt;. https:&#x2F;&#x2F;doi.org&#x2F;&lt;a href=&quot;https:&#x2F;&#x2F;doi.org&#x2F;10.1007&#x2F;978-3-030-51280-4_23&quot;&gt;10.1007&#x2F;978-3-030-51280-4_23&lt;&#x2F;a&gt;These are all technologies that have been, or are in the process of being, deployed to main-net. These protocols would all benefit from reducing the gas cost of the precompiles. &lt;a href=&quot;#fr-1-1&quot;&gt;↩&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;section&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Net gas metering for SSTORE operations</title>
        <published>2018-05-17T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Nick Johnson</name><uri>https://github.com/arachnid</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1087/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-net-storage-gas-metering-for-the-evm/383" />
        

        <id>https://wg-eips.ritovision.com/1087/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:1087"
            label="EIP-1087" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1087/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes a change to how gas is charged for EVM &lt;code&gt;SSTORE&lt;&#x2F;code&gt; operations, in order to reduce excessive gas costs in situations where these are unwarranted, and to enable new use-cases for contract storage.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Presently, &lt;code&gt;SSTORE&lt;&#x2F;code&gt; (&lt;code&gt;0x55&lt;&#x2F;code&gt;) operations are charged as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;20,000 gas to set a slot from 0 to non-0&lt;&#x2F;li&gt;
&lt;li&gt;5,000 gas for any other change&lt;&#x2F;li&gt;
&lt;li&gt;A 10,000 gas refund when a slot is set from non-0 to 0. Refunds are applied at the end of the transaction.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In situations where a single update is made to a storage value in a transaction, these gas costs have been determined to fairly reflect the resources consumed by the operation. However, this results in excessive gas costs for sequences of operations that make multiple updates.&lt;&#x2F;p&gt;
&lt;p&gt;Some examples to illustrate the problem:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If a contract with empty storage sets slot 0 to 1, then back to 0, it will be charged &lt;code&gt;20000 + 5000 - 10000 = 15000&lt;&#x2F;code&gt; gas, despite this sequence of operations not requiring any disk writes.&lt;&#x2F;li&gt;
&lt;li&gt;A contract with empty storage that increments slot 0 5 times will be charged &lt;code&gt;20000 + 5 * 5000 = 45000&lt;&#x2F;code&gt; gas, despite this sequence of operations requiring no more disk activity than a single write, charged at 20000 gas.&lt;&#x2F;li&gt;
&lt;li&gt;A balance transfer from account A to account B followed by a transfer from B to C, with all accounts having nonzero starting and ending balances, will cost &lt;code&gt;5000 * 4 = 20000&lt;&#x2F;code&gt; gas.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Addressing this issue would also enable new use-cases that are currently cost-prohibitive, where a sequence of operations results in no net change to storage at the end of the transaction. For instance, mutexes to prevent reentrancy, or context information passed between multiple calls to the same contract. One such example is an &lt;code&gt;approveAndCall&lt;&#x2F;code&gt; operation, which would permit sending to and calling a contract in a single transaction, without that contract having to be updated for a new token standard.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The following changes are made to the EVM:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A &#x27;dirty map&#x27; for each transaction is maintained, tracking all storage slots in all contracts that have been modified in the current transaction. The dirty map is scoped in the same manner as updates to storage, meaning that changes to the dirty map in a call that later reverts are not retained.&lt;&#x2F;li&gt;
&lt;li&gt;When a storage slot is written to with the value it already contains, 200 gas is deducted.&lt;&#x2F;li&gt;
&lt;li&gt;When a storage slot&#x27;s value is changed for the first time, the slot is marked as dirty. If the slot was previously set to 0, 20000 gas is deducted; otherwise, 5000 gas is deducted.&lt;&#x2F;li&gt;
&lt;li&gt;When a storage slot that is already in the dirty map is written to, 200 gas is deducted.&lt;&#x2F;li&gt;
&lt;li&gt;At the end of the transaction, for each slot in the dirty map:
&lt;ul&gt;
&lt;li&gt;If the slot was 0 before the transaction and is 0 now, refund 19800 gas.&lt;&#x2F;li&gt;
&lt;li&gt;If the slot was nonzero before the transaction and its value has not changed, refund 4800 gas.&lt;&#x2F;li&gt;
&lt;li&gt;If the slot was nonzero before the transaction and is 0 now, refund 15000 gas.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;After these changes, transactions that make only a single change to a storage slot will retain their existing costs. However, contracts that make multiple changes will see significantly reduced costs. Repeating the examples from the Motivation section:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If a contract with empty storage sets slot 0 to 1, then back to 0, it will be charged &lt;code&gt;20000 + 200 - 19800 = 400&lt;&#x2F;code&gt; gas, down from 15000.&lt;&#x2F;li&gt;
&lt;li&gt;A contract with empty storage that increments slot 0 5 times will be charged &lt;code&gt;20000 + 5 * 200 = 21000&lt;&#x2F;code&gt; gas, down from 45000.&lt;&#x2F;li&gt;
&lt;li&gt;A balance transfer from account A to account B followed by a transfer from B to C, with all accounts having nonzero starting and ending balances, will cost &lt;code&gt;5000 * 3 + 200 - 4800 = 10400&lt;&#x2F;code&gt; gas, down from 20000.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;We believe the proposed mechanism represents the simplest way to reduce storage gas costs in situations where they do not reflect the actual costs borne by nodes. Several alternative designs were considered and dismissed:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Charging a flat 200 gas for &lt;code&gt;SSTORE&lt;&#x2F;code&gt; operations, and an additional 19800 &#x2F; 4800 at the end of a transaction for new or modified values is simpler, and removes the need for a dirty map, but pushes a significant source of gas consumption out of the EVM stack and applies it at the end of the transaction, which is likely to complicate debugging and reduces contracts&#x27; ability to limit the gas consumption of callees, as well as introducing a new mechanism to the EVM.&lt;&#x2F;li&gt;
&lt;li&gt;Keeping a separate refund counter for storage gas refunds would avoid the issue of refunds being limited to half the gas consumed (not necessary here), but would introduce additional complexity in tracking this value.&lt;&#x2F;li&gt;
&lt;li&gt;Refunding gas each time a storage slot is set back to its initial value would introduce a new mechanism (instant refunds) and complicate gas accounting for contracts calling other contracts; it would also permit the possibility of a contract call with negative execution cost.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP requires a hard fork to implement.&lt;&#x2F;p&gt;
&lt;p&gt;No contract should see an increase in gas cost for this change, and many will see decreased gas consumption, so no contract-layer backwards compatibility issues are anticipated.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Writing x to a storage slot that contains 0, where x != 0 (20k gas, no refund)&lt;&#x2F;li&gt;
&lt;li&gt;Writing y to a storage slot that contained x, where x != y and x != 0 (5k gas, no refund)&lt;&#x2F;li&gt;
&lt;li&gt;Writing 0 to a storage slot that contains x, where x != 0 (5k gas, 10k refund)&lt;&#x2F;li&gt;
&lt;li&gt;Writing 0 to a storage slot that already contains zero (200 gas, no refund)&lt;&#x2F;li&gt;
&lt;li&gt;Writing x to a storage slot that already contains x, where x != 0 (200 gas, no refund)&lt;&#x2F;li&gt;
&lt;li&gt;Writing x, then y to a storage slot that contains 0, where x != y (20200 gas, no refund)&lt;&#x2F;li&gt;
&lt;li&gt;Writing x, then y to a storage slot that contains 0, where x != y != z and x != 0 (5200 gas, no refund)&lt;&#x2F;li&gt;
&lt;li&gt;Writing x, then 0 to a storage slot that contains 0, where x != 0 (20200 gas, 19800 refund)&lt;&#x2F;li&gt;
&lt;li&gt;Writing x, then y to a storage slot that contains y, where x != y != 0 (5200 gas, 4800 refund)&lt;&#x2F;li&gt;
&lt;li&gt;Writing x, then 0 to a storage slot that contains 0, then reverting the stack frame in which the writes occurred (20200 gas, no refund)&lt;&#x2F;li&gt;
&lt;li&gt;Writing x, then y to a storage slot that contains y, then reverting the stack frame in which the writes occurred (5200 gas, no refund)&lt;&#x2F;li&gt;
&lt;li&gt;In a nested frame, writing x to a storage slot that contains 0, then returning, and writing 0 to that slot (20200 gas, 19800 refund)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Standard Bounties</title>
        <published>2018-05-14T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Mark Beylin</name><email>mark.beylin@consensys.net</email>
	</author>
	
	<author>
		<name>Kevin Owocki</name><email>kevin.owocki@consensys.net</email>
	</author>
	
	<author>
		<name>Ricardo Guilherme Schmidt</name><uri>https://github.com/3esmit</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1081/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://gitter.im/bounties-network/Lobby" />
        

        <id>https://wg-eips.ritovision.com/1081/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:1081"
            label="ERC-1081" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1081/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;A standard contract and interface for issuing bounties on Ethereum, usable for any type of task, paying in any ERC20 token or in ETH.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;In order to encourage cross-platform interoperability of bounties on Ethereum, and for easier reputational tracking, StandardBounties can facilitate the administration of funds in exchange for deliverables corresponding to a completed task, in a publicly auditable and immutable fashion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;In the absence of a standard for bounties on Ethereum, it would be difficult for platforms to collaborate and share the bounties which users create (thereby recreating the walled gardens which currently exist on Web2.0 task outsourcing platforms). A standardization of these interactions across task types also makes it far easier to track various reputational metrics (such as how frequently you pay for completed submissions, or how frequently your work gets accepted).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;After studying bounties as they&#x27;ve existed for thousands of years (and after implementing and processing over 300 of them on main-net in beta), we&#x27;ve discovered that there are 3 core steps to every bounty:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;a bounty is &lt;strong&gt;issued&lt;&#x2F;strong&gt;: an &lt;code&gt;issuer&lt;&#x2F;code&gt; specifies the requirements for the task, describing the desired outcome, and how much they would be willing to pay for the completion of that task (denoted in one or several tokens).&lt;&#x2F;li&gt;
&lt;li&gt;a bounty is &lt;strong&gt;fulfilled&lt;&#x2F;strong&gt;: a bounty &lt;code&gt;fulfiller&lt;&#x2F;code&gt; may see the bounty, complete the task, and produce a deliverable which is itself the desired outcome of the task, or simply a record that it was completed. Hashes of these deliverables should be stored immutably on-chain, to serve as proof after the fact.&lt;&#x2F;li&gt;
&lt;li&gt;a fulfillment is &lt;strong&gt;accepted&lt;&#x2F;strong&gt;: a bounty &lt;code&gt;issuer&lt;&#x2F;code&gt; or &lt;code&gt;arbiter&lt;&#x2F;code&gt; may select one or more submissions to be accepted, thereby releasing payment to the bounty fulfiller(s), and transferring ownership over the given deliverable to the &lt;code&gt;issuer&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;To implement these steps, a number of functions are needed:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;initializeBounty(address _issuer, address _arbiter, string _data, uint _deadline)&lt;&#x2F;code&gt;: This is used when deploying a new StandardBounty contract, and is particularly useful when applying the proxy design pattern, whereby bounties cannot be initialized in their constructors. Here, the data string should represent an IPFS hash, corresponding to a JSON object which conforms to the schema (described below).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;fulfillBounty(address[] _fulfillers, uint[] _numerators, uint _denomenator, string _data)&lt;&#x2F;code&gt;: This is called to submit a fulfillment, submitting a string representing an IPFS hash which contains the deliverable for the bounty. Initially fulfillments could only be submitted by one individual at a time, however users consistently told us they desired to be able to collaborate on fulfillments, thereby allowing the credit for submissions to be shared by several parties. The lines along which eventual payouts are split are determined by the fractions of the submission credited to each fulfiller (using the array of numerators and single denominator). Here, a bounty platform may also include themselves as a collaborator to collect a small fee for matching the bounty with fulfillers.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;acceptFulfillment(uint _fulfillmentId, StandardToken[] _payoutTokens, uint[] _tokenAmounts)&lt;&#x2F;code&gt;: This is called by the &lt;code&gt;issuer&lt;&#x2F;code&gt; or the &lt;code&gt;arbiter&lt;&#x2F;code&gt; to pay out a given fulfillment, using an array of tokens, and an array of amounts of each token to be split among the contributors. This allows for the bounty payout amount to move as it needs to be based on incoming contributions (which may be transferred directly to the contract address). It also allows for the easy splitting of a given bounty&#x27;s balance among several fulfillments, if the need should arise.
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;drainBounty(StandardToken[] _payoutTokens)&lt;&#x2F;code&gt;: This may be called by the &lt;code&gt;issuer&lt;&#x2F;code&gt; to drain a bounty of it&#x27;s funds, if the need should arise.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;changeBounty(address _issuer, address _arbiter, string _data, uint _deadline)&lt;&#x2F;code&gt;: This may be called by the &lt;code&gt;issuer&lt;&#x2F;code&gt; to change the &lt;code&gt;issuer&lt;&#x2F;code&gt;, &lt;code&gt;arbiter&lt;&#x2F;code&gt;, &lt;code&gt;data&lt;&#x2F;code&gt;, and &lt;code&gt;deadline&lt;&#x2F;code&gt; fields of their bounty.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;changeIssuer(address _issuer)&lt;&#x2F;code&gt;: This may be called by the &lt;code&gt;issuer&lt;&#x2F;code&gt; to change to a new &lt;code&gt;issuer&lt;&#x2F;code&gt; if need be&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;changeArbiter(address _arbiter)&lt;&#x2F;code&gt;: This may be called by the &lt;code&gt;issuer&lt;&#x2F;code&gt; to change to a new &lt;code&gt;arbiter&lt;&#x2F;code&gt; if need be&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;changeData(string _data)&lt;&#x2F;code&gt;: This may be called by the &lt;code&gt;issuer&lt;&#x2F;code&gt; to change just the &lt;code&gt;data&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;changeDeadline(uint _deadline)&lt;&#x2F;code&gt;: This may be called by the &lt;code&gt;issuer&lt;&#x2F;code&gt; to change just the &lt;code&gt;deadline&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Optional Functions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;acceptAndFulfill(address[] _fulfillers, uint[] _numerators, uint _denomenator, string _data, StandardToken[] _payoutTokens, uint[] _tokenAmounts)&lt;&#x2F;code&gt;: During the course of the development of this standard, we discovered the desire for fulfillers to avoid paying gas fees on their own, entrusting the bounty&#x27;s &lt;code&gt;issuer&lt;&#x2F;code&gt; to make the submission for them, and at the same time accept it. This is useful since it still immutably stores the exchange of tokens for completed work, but avoids the need for new bounty fulfillers to have any ETH to pay for gas costs in advance of their earnings.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;changeMasterCopy(StandardBounty _masterCopy)&lt;&#x2F;code&gt;: For &lt;code&gt;issuer&lt;&#x2F;code&gt;s to be able to change the masterCopy which their proxy contract relies on, if the proxy design pattern is being employed.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;refundableContribute(uint[] _amounts, StandardToken[] _tokens)&lt;&#x2F;code&gt;: While non-refundable contributions may be sent to a bounty simply by transferring those tokens to the address where it resides, one may also desire to contribute to a bounty with the option to refund their contribution, should the bounty never receive a correct submission which is paid out.
&lt;code&gt;refundContribution(uint _contributionId)&lt;&#x2F;code&gt;: If a bounty hasn&#x27;t yet paid out to any correct submissions and is past it&#x27;s deadline, those individuals who employed the &lt;code&gt;refundableContribute&lt;&#x2F;code&gt; function may retrieve their funds from the contract.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Schemas&lt;&#x2F;strong&gt;
Persona Schema:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   name: &#x2F;&#x2F; optional - A string representing the name of the persona&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   email: &#x2F;&#x2F; optional - A string representing the preferred contact email of the persona&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   githubUsername: &#x2F;&#x2F; optional - A string representing the github username of the persona&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   address: &#x2F;&#x2F; required - A string web3 address of the persona&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Bounty issuance &lt;code&gt;data&lt;&#x2F;code&gt; Schema:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  payload: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    title: &#x2F;&#x2F; A string representing the title of the bounty&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    description: &#x2F;&#x2F; A string representing the description of the bounty, including all requirements&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    issuer: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;       &#x2F;&#x2F; persona for the issuer of the bounty&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    funders:[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;       &#x2F;&#x2F; array of personas of those who funded the issue.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ],&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    categories: &#x2F;&#x2F; an array of strings, representing the categories of tasks which are being requested&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    tags: &#x2F;&#x2F; an array of tags, representing various attributes of the bounty&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    created: &#x2F;&#x2F; the timestamp in seconds when the bounty was created&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    tokenSymbol: &#x2F;&#x2F; the symbol for the token which the bounty pays out&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    tokenAddress: &#x2F;&#x2F; the address for the token which the bounty pays out (0x0 if ETH)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; ------- add optional fields here -------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sourceFileName: &#x2F;&#x2F; A string representing the name of the file&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sourceFileHash: &#x2F;&#x2F; The IPFS hash of the file associated with the bounty&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sourceDirectoryHash: &#x2F;&#x2F; The IPFS hash of the directory which can be used to access the file&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    webReferenceURL: &#x2F;&#x2F; The link to a relevant web reference (ie github issue)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  meta: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    platform: &#x2F;&#x2F; a string representing the original posting platform (ie &amp;#39;gitcoin&amp;#39;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    schemaVersion: &#x2F;&#x2F; a string representing the version number (ie &amp;#39;0.1&amp;#39;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    schemaName: &#x2F;&#x2F; a string representing the name of the schema (ie &amp;#39;standardSchema&amp;#39; or &amp;#39;gitcoinSchema&amp;#39;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Bounty &lt;code&gt;fulfillment&lt;&#x2F;code&gt; data Schema:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  payload: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    description: &#x2F;&#x2F; A string representing the description of the fulfillment, and any necessary links to works&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sourceFileName: &#x2F;&#x2F; A string representing the name of the file being submitted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sourceFileHash: &#x2F;&#x2F; A string representing the IPFS hash of the file being submitted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sourceDirectoryHash: &#x2F;&#x2F; A string representing the IPFS hash of the directory which holds the file being submitted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    fulfillers: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &#x2F;&#x2F; personas for the individuals whose work is being submitted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; ------- add optional fields here -------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  meta: {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    platform: &#x2F;&#x2F; a string representing the original posting platform (ie &amp;#39;gitcoin&amp;#39;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    schemaVersion: &#x2F;&#x2F; a string representing the version number (ie &amp;#39;0.1&amp;#39;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    schemaName: &#x2F;&#x2F; a string representing the name of the schema (ie &amp;#39;standardSchema&amp;#39; or &amp;#39;gitcoinSchema&amp;#39;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The development of this standard began a year ago, with the goal of encouraging interoperability among bounty implementations on Ethereum. The initial version had significantly more restrictions: a bounty&#x27;s &lt;code&gt;data&lt;&#x2F;code&gt; could not be changed after issuance (it seemed unfair for bounty &lt;code&gt;issuer&lt;&#x2F;code&gt;s to change the requirements after work is underway), and the bounty payout could not be changed (all funds needed to be deposited in the bounty contract before it could accept submissions).&lt;&#x2F;p&gt;
&lt;p&gt;The initial version was also far less extensible, and only allowed for fixed payments to a given set of fulfillments. This new version makes it possible for funds to be split among several correct submissions, for submissions to be shared among several contributors, and for payouts to not only be in a single token as before, but in as many tokens as the &lt;code&gt;issuer&lt;&#x2F;code&gt; of the bounty desires. These design decisions were made after the 8+ months which Gitcoin, the Bounties Network, and Status Open Bounty have been live and meaningfully facilitating bounties for repositories in the Web3.0 ecosystem.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Tests for our implementation can be found here: https:&#x2F;&#x2F;github.com&#x2F;Bounties-Network&#x2F;StandardBounties&#x2F;tree&#x2F;develop&#x2F;test&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;A reference implementation can be found here: https:&#x2F;&#x2F;github.com&#x2F;Bounties-Network&#x2F;StandardBounties&#x2F;blob&#x2F;develop&#x2F;contracts&#x2F;StandardBounty.sol
&lt;strong&gt;Although this code has been tested, it has not yet been audited or bug-bountied, so we cannot make any assertions about it&#x27;s correctness, nor can we presently encourage it&#x27;s use to hold funds on the Ethereum mainnet.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Status Codes</title>
        <published>2018-05-05T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Brooklyn Zelenka</name><uri>https://github.com/expede</uri>
	</author>
	
	<author>
		<name>Tom Carchrae</name><uri>https://github.com/carchrae</uri>
	</author>
	
	<author>
		<name>Gleb Naumenko</name><uri>https://github.com/naumenkogs</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1066/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-1066-ethereum-status-codes-esc/" />
        

        <id>https://wg-eips.ritovision.com/1066/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:1066"
            label="ERC-1066" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1066/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Broadly applicable status codes for smart contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard outlines a common set of status codes in a similar vein to HTTP statuses. This provides a shared set of signals to allow smart contracts to react to situations autonomously, expose localized error messages to users, and so on.&lt;&#x2F;p&gt;
&lt;p&gt;The current state of the art is to either &lt;code&gt;revert&lt;&#x2F;code&gt; on anything other than a clear success (ie: require human intervention), or return a low-context &lt;code&gt;true&lt;&#x2F;code&gt; or &lt;code&gt;false&lt;&#x2F;code&gt;. Status codes are similar-but-orthogonal to &lt;code&gt;revert&lt;&#x2F;code&gt;ing with a reason, but aimed at automation, debugging, and end-user feedback (including translation). &lt;em&gt;They are fully compatible with both &lt;code&gt;revert&lt;&#x2F;code&gt; and &lt;code&gt;revert&lt;&#x2F;code&gt;-with-reason.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;As is the case with HTTP, having a standard set of known codes has many benefits for developers. They remove friction from needing to develop your own schemes for every contract, makes inter-contract automation easier, and makes it easier to broadly understand which of the finite states your request produced. Importantly, it makes it much easier to distinguish between expected errors states, truly exceptional conditions that require halting execution, normal state transitions, and various success cases.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;semantic-density&quot;&gt;Semantic Density&lt;&#x2F;h3&gt;
&lt;p&gt;HTTP status codes are widely used for this purpose. BEAM languages use atoms and tagged tuples to signify much the same information. Both provide a lot of information both to the programmer (debugging for instance), and to the program that needs to decide what to do next.&lt;&#x2F;p&gt;
&lt;p&gt;Status codes convey a much richer set of information &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;existentialtype.wordpress.com&#x2F;2011&#x2F;03&#x2F;15&#x2F;boolean-blindness&#x2F;&quot;&gt;than Booleans&lt;&#x2F;a&gt;, and are able to be reacted to autonomously unlike arbitrary strings.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;user-experience-ux&quot;&gt;User Experience (UX)&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;em&gt;End users get little to no feedback, and there is no translation layer.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Since ERC1066 status codes are finite and known in advance, we can leverage &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1444&#x2F;&quot;&gt;ERC-1444&lt;&#x2F;a&gt; to provide global, human-readable sets of status messages. These may also be translated into any language, differing levels of technical detail, added as &lt;code&gt;revert&lt;&#x2F;code&gt; messages, natspecs, and so on.&lt;&#x2F;p&gt;
&lt;p&gt;Status codes convey a much richer set of information than Booleans, and are able to be reacted to autonomously unlike arbitrary strings.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;developer-experience-dx&quot;&gt;Developer Experience (DX)&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;em&gt;Developers currently have very little context exposed by their smart contracts.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;At time of writing, other than stepping through EVM execution and inspecting memory dumps directly, it is very difficult to understand what is happening during smart contract execution. By returning more context, developers can write well-decomposed tests and assert certain codes are returned as an expression of where the smart contract got to. This includes status codes as bare values, &lt;code&gt;event&lt;&#x2F;code&gt;s, and &lt;code&gt;revert&lt;&#x2F;code&gt;s.&lt;&#x2F;p&gt;
&lt;p&gt;Having a fixed set of codes also makes it possible to write common helper functions to react in common ways to certain signals. This can live off- or on-chain library, lowering the overhead in building smart contracts, and helping raise code quality with trusted shared components.&lt;&#x2F;p&gt;
&lt;p&gt;We also see a desire for this &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;658&#x2F;&quot;&gt;in transactions&lt;&#x2F;a&gt;, and there&#x27;s no reason that these status codes couldn&#x27;t be used by the EVM itself.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;smart-contract-autonomy&quot;&gt;Smart Contract Autonomy&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;em&gt;Smart contracts don’t know much about the result of a request beyond pass&#x2F;fail; they can be smarter with more context.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Smart contracts are largely intended to be autonomous. While each contract may define a specific interface, having a common set of semantic codes can help developers write code that can react appropriately to various situations.&lt;&#x2F;p&gt;
&lt;p&gt;While clearly related, status codes are complementary to &lt;code&gt;revert&lt;&#x2F;code&gt;-with-reason. Status codes are not limited to rolling back the transaction, and may represent known error states without halting execution. They may also represent off-chain conditions, supply a string to revert, signal time delays, and more.&lt;&#x2F;p&gt;
&lt;p&gt;All of this enables contracts to share a common vocabulary of state transitions, results, and internal changes, without having to deeply understand custom status enums or the internal business logic of collaborator contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;format&quot;&gt;Format&lt;&#x2F;h3&gt;
&lt;p&gt;Codes are returned either on their own, or as the first value of a multiple return.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Status only&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isInt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; num&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; status&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;01&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Status and value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; counter&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeIncrement&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interval&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; status&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newCounter&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint8&lt;&#x2F;span&gt;&lt;span&gt; updated &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; counter &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt; interval&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;updated &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; counter&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        counter &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; updated&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;01&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; updated&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;00&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; counter&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;code-table&quot;&gt;Code Table&lt;&#x2F;h3&gt;
&lt;p&gt;Codes break nicely into a 16x16 matrix, represented as a 2-digit hex number. The high nibble represents the code&#x27;s kind or &quot;category&quot;, and the low nibble contains the state or &quot;reason&quot;. We present them below as separate tables per range for explanatory and layout reasons.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;NB: Unspecified codes are &lt;em&gt;not&lt;&#x2F;em&gt; free for arbitrary use, but rather open for further specification.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;0x0-generic&quot;&gt;&lt;code&gt;0x0*&lt;&#x2F;code&gt; Generic&lt;&#x2F;h4&gt;
&lt;p&gt;General codes. These double as bare &quot;reasons&quot;, since &lt;code&gt;0x01 == 1&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Code&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x00&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Failure&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x01&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Success&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x02&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Awaiting Others&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x03&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Accepted&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x04&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Lower Limit or Insufficient&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x05&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Receiver Action Requested&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x06&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Upper Limit&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x07&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x08&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Duplicate, Unnecessary, or Inapplicable&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x09&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x0A&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x0B&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x0C&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x0D&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x0E&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x0F&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Informational or Metadata&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;0x1-permission-control&quot;&gt;&lt;code&gt;0x1*&lt;&#x2F;code&gt; Permission &amp;amp; Control&lt;&#x2F;h4&gt;
&lt;p&gt;Also used for common state machine actions (ex. &quot;stoplight&quot; actions).&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Code&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x10&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Disallowed or Stop&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x11&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Allowed or Go&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x12&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Awaiting Other&#x27;s Permission&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x13&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Permission Requested&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x14&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Too Open &#x2F; Insecure&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x15&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Needs Your Permission or Request for Continuation&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x16&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Revoked or Banned&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x17&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x18&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Not Applicable to Current State&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x19&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x1A&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x1B&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x1C&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x1D&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x1E&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x1F&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Permission Details or Control Conditions&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;0x2-find-inequalities-range&quot;&gt;&lt;code&gt;0x2*&lt;&#x2F;code&gt; Find, Inequalities &amp;amp; Range&lt;&#x2F;h4&gt;
&lt;p&gt;This range is broadly intended for finding and matching. Data lookups and order matching are two common use cases.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Code&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x20&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Not Found, Unequal, or Out of Range&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x21&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Found, Equal or In Range&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x22&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Awaiting Match&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x23&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Match Request Sent&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x24&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Below Range or Underflow&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x25&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Request for Match&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x26&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Above Range or Overflow&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x27&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x28&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Duplicate, Conflict, or Collision&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x29&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x2A&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x2B&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x2C&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x2D&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x2E&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x2F&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Matching Meta or Info&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;0x3-negotiation-governance&quot;&gt;&lt;code&gt;0x3*&lt;&#x2F;code&gt; Negotiation &amp;amp; Governance&lt;&#x2F;h4&gt;
&lt;p&gt;Negotiation, and very broadly the flow of such transactions. Note that &quot;other party&quot; may be more than one actor (not necessarily the sender).&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Code&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x30&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Sender Disagrees or Nay&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x31&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Sender Agrees or Yea&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x32&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Awaiting Ratification&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x33&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Offer Sent or Voted&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x34&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Quorum Not Reached&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x35&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Receiver&#x27;s Ratification Requested&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x36&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Offer or Vote Limit Reached&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x37&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x38&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Already Voted&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x39&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x3A&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x3B&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x3C&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x3D&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x3E&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x3F&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Negotiation Rules or Participation Info&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;0x4-availability-time&quot;&gt;&lt;code&gt;0x4*&lt;&#x2F;code&gt; Availability &amp;amp; Time&lt;&#x2F;h4&gt;
&lt;p&gt;Service or action availability.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Code&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x40&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Unavailable&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x41&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Available&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x42&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Paused&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x43&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Queued&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x44&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Not Available Yet&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x45&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Awaiting Your Availability&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x46&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Expired&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x47&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x48&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Already Done&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x49&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x4A&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x4B&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x4C&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x4D&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x4E&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x4F&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Availability Rules or Info (ex. time since or until)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;0x5-tokens-funds-finance&quot;&gt;&lt;code&gt;0x5*&lt;&#x2F;code&gt; Tokens, Funds &amp;amp; Finance&lt;&#x2F;h4&gt;
&lt;p&gt;Special token and financial concepts. Many related concepts are included in other ranges.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Code&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x50&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Transfer Failed&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x51&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Transfer Successful&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x52&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Awaiting Payment From Others&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x53&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Hold or Escrow&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x54&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Insufficient Funds&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x55&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Funds Requested&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x56&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Transfer Volume Exceeded&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x57&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x58&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Funds Not Required&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x59&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x5A&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x5B&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x5C&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x5D&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x5E&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x5F&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Token or Financial Information&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;0x6-tbd&quot;&gt;&lt;code&gt;0x6*&lt;&#x2F;code&gt; TBD&lt;&#x2F;h4&gt;
&lt;p&gt;Currently unspecified. (Full range reserved)&lt;&#x2F;p&gt;
&lt;h4 id=&quot;0x7-tbd&quot;&gt;&lt;code&gt;0x7*&lt;&#x2F;code&gt; TBD&lt;&#x2F;h4&gt;
&lt;p&gt;Currently unspecified. (Full range reserved)&lt;&#x2F;p&gt;
&lt;h4 id=&quot;0x8-tbd&quot;&gt;&lt;code&gt;0x8*&lt;&#x2F;code&gt; TBD&lt;&#x2F;h4&gt;
&lt;p&gt;Currently unspecified. (Full range reserved)&lt;&#x2F;p&gt;
&lt;h4 id=&quot;0x9-tbd&quot;&gt;&lt;code&gt;0x9*&lt;&#x2F;code&gt; TBD&lt;&#x2F;h4&gt;
&lt;p&gt;Currently unspecified. (Full range reserved)&lt;&#x2F;p&gt;
&lt;h4 id=&quot;0xa-application-specific-codes&quot;&gt;&lt;code&gt;0xA*&lt;&#x2F;code&gt; Application-Specific Codes&lt;&#x2F;h4&gt;
&lt;p&gt;Contracts may have special states that they need to signal. This proposal only outlines the broadest meanings, but implementers may have very specific meanings for each, as long as they are coherent with the broader definition.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Code&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xA0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;App-Specific Failure&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xA1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;App-Specific Success&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xA2&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;App-Specific Awaiting Others&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xA3&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;App-Specific Acceptance&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xA4&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;App-Specific Below Condition&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xA5&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;App-Specific Receiver Action Requested&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xA6&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;App-Specific Expiry or Limit&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xA7&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xA8&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;App-Specific Inapplicable Condition&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xA9&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xAA&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xAB&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xAC&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xAE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xAF&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;App-Specific Meta or Info&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;0xb-tbd&quot;&gt;&lt;code&gt;0xB*&lt;&#x2F;code&gt; TBD&lt;&#x2F;h4&gt;
&lt;p&gt;Currently unspecified. (Full range reserved)&lt;&#x2F;p&gt;
&lt;h4 id=&quot;0xc-tbd&quot;&gt;&lt;code&gt;0xC*&lt;&#x2F;code&gt; TBD&lt;&#x2F;h4&gt;
&lt;p&gt;Currently unspecified. (Full range reserved)&lt;&#x2F;p&gt;
&lt;h4 id=&quot;0xd-tbd&quot;&gt;&lt;code&gt;0xD*&lt;&#x2F;code&gt; TBD&lt;&#x2F;h4&gt;
&lt;p&gt;Currently unspecified. (Full range reserved)&lt;&#x2F;p&gt;
&lt;h4 id=&quot;0xe-encryption-identity-proofs&quot;&gt;&lt;code&gt;0xE*&lt;&#x2F;code&gt; Encryption, Identity &amp;amp; Proofs&lt;&#x2F;h4&gt;
&lt;p&gt;Actions around signatures, cryptography, signing, and application-level authentication.&lt;&#x2F;p&gt;
&lt;p&gt;The meta code &lt;code&gt;0xEF&lt;&#x2F;code&gt; is often used to signal a payload describing the algorithm or process used.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Code&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xE0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Decrypt Failure&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xE1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Decrypt Success&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xE2&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Awaiting Other Signatures or Keys&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xE3&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Signed&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xE4&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Unsigned or Untrusted&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xE5&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Signature Required&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xE6&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Known to be Compromised&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xE7&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xE8&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Already Signed or Not Encrypted&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xE9&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xEA&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xEB&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xEC&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xED&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xEE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xEF&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Cryptography, ID, or Proof Metadata&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;0xf-off-chain&quot;&gt;&lt;code&gt;0xF*&lt;&#x2F;code&gt; Off-Chain&lt;&#x2F;h4&gt;
&lt;p&gt;For off-chain actions. Much like th &lt;code&gt;0x0*: Generic&lt;&#x2F;code&gt; range, &lt;code&gt;0xF*&lt;&#x2F;code&gt; is very general, and does little to modify the reason.&lt;&#x2F;p&gt;
&lt;p&gt;Among other things, the meta code &lt;code&gt;0xFF&lt;&#x2F;code&gt; may be used to describe what the off-chain process is.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Code&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xF0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Off-Chain Failure&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xF1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Off-Chain Success&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xF2&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Awaiting Off-Chain Process&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xF3&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Off-Chain Process Started&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xF4&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Off-Chain Service Unreachable&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xF5&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Off-Chain Action Required&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xF6&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Off-Chain Expiry or Limit Reached&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xF7&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xF8&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Duplicate Off-Chain Request&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xF9&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xFA&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xFB&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xFC&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xFD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xFE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;[reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xFF&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Off-Chain Info or Meta&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;as-a-grid&quot;&gt;As a Grid&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;code&gt;0x0*&lt;&#x2F;code&gt; General&lt;&#x2F;th&gt;&lt;th&gt;&lt;code&gt;0x1*&lt;&#x2F;code&gt; Permission &amp;amp; Control&lt;&#x2F;th&gt;&lt;th&gt;&lt;code&gt;0x2*&lt;&#x2F;code&gt; Find, Inequalities &amp;amp; Range&lt;&#x2F;th&gt;&lt;th&gt;&lt;code&gt;0x3*&lt;&#x2F;code&gt; Negotiation &amp;amp; Governance&lt;&#x2F;th&gt;&lt;th&gt;&lt;code&gt;0x4*&lt;&#x2F;code&gt; Availability &amp;amp; Time&lt;&#x2F;th&gt;&lt;th&gt;&lt;code&gt;0x5*&lt;&#x2F;code&gt; Tokens, Funds &amp;amp; Finance&lt;&#x2F;th&gt;&lt;th&gt;&lt;code&gt;0x6*&lt;&#x2F;code&gt; TBD&lt;&#x2F;th&gt;&lt;th&gt;&lt;code&gt;0x7*&lt;&#x2F;code&gt; TBD&lt;&#x2F;th&gt;&lt;th&gt;&lt;code&gt;0x8*&lt;&#x2F;code&gt; TBD&lt;&#x2F;th&gt;&lt;th&gt;&lt;code&gt;0x9*&lt;&#x2F;code&gt; TBD&lt;&#x2F;th&gt;&lt;th&gt;&lt;code&gt;0xA*&lt;&#x2F;code&gt; Application-Specific Codes&lt;&#x2F;th&gt;&lt;th&gt;&lt;code&gt;0xB*&lt;&#x2F;code&gt; TBD&lt;&#x2F;th&gt;&lt;th&gt;&lt;code&gt;0xC*&lt;&#x2F;code&gt; TBD&lt;&#x2F;th&gt;&lt;th&gt;&lt;code&gt;0xD*&lt;&#x2F;code&gt; TBD&lt;&#x2F;th&gt;&lt;th&gt;&lt;code&gt;0xE*&lt;&#x2F;code&gt; Encryption, Identity &amp;amp; Proofs&lt;&#x2F;th&gt;&lt;th&gt;&lt;code&gt;0xF*&lt;&#x2F;code&gt; Off-Chain&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x*0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x00&lt;&#x2F;code&gt; Failure&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x10&lt;&#x2F;code&gt; Disallowed or Stop&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x20&lt;&#x2F;code&gt; Not Found, Unequal, or Out of Range&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x30&lt;&#x2F;code&gt; Sender Disagrees or Nay&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x40&lt;&#x2F;code&gt; Unavailable&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x50&lt;&#x2F;code&gt; Transfer Failed&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x60&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x70&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x80&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x90&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xA0&lt;&#x2F;code&gt; App-Specific Failure&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xB0&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xC0&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xD0&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xE0&lt;&#x2F;code&gt; Decrypt Failure&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xF0&lt;&#x2F;code&gt; Off-Chain Failure&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x*1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x01&lt;&#x2F;code&gt; Success&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x11&lt;&#x2F;code&gt; Allowed or Go&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x21&lt;&#x2F;code&gt; Found, Equal or In Range&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x31&lt;&#x2F;code&gt; Sender Agrees or Yea&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x41&lt;&#x2F;code&gt; Available&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x51&lt;&#x2F;code&gt; Transfer Successful&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x61&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x71&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x81&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x91&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xA1&lt;&#x2F;code&gt; App-Specific Success&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xB1&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xC1&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xD1&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xE1&lt;&#x2F;code&gt; Decrypt Success&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xF1&lt;&#x2F;code&gt; Off-Chain Success&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x*2&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x02&lt;&#x2F;code&gt; Awaiting Others&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x12&lt;&#x2F;code&gt; Awaiting Other&#x27;s Permission&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x22&lt;&#x2F;code&gt; Awaiting Match&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x32&lt;&#x2F;code&gt; Awaiting Ratification&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x42&lt;&#x2F;code&gt; Paused&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x52&lt;&#x2F;code&gt; Awaiting Payment From Others&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x62&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x72&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x82&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x92&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xA2&lt;&#x2F;code&gt; App-Specific Awaiting Others&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xB2&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xC2&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xD2&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xE2&lt;&#x2F;code&gt; Awaiting Other Signatures or Keys&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xF2&lt;&#x2F;code&gt; Awaiting Off-Chain Process&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x*3&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x03&lt;&#x2F;code&gt; Accepted&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x13&lt;&#x2F;code&gt; Permission Requested&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x23&lt;&#x2F;code&gt; Match Request Sent&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x33&lt;&#x2F;code&gt; Offer Sent or Voted&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x43&lt;&#x2F;code&gt; Queued&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x53&lt;&#x2F;code&gt; Hold or Escrow&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x63&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x73&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x83&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x93&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xA3&lt;&#x2F;code&gt; App-Specific Acceptance&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xB3&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xC3&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xD3&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xE3&lt;&#x2F;code&gt; Signed&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xF3&lt;&#x2F;code&gt; Off-Chain Process Started&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x*4&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x04&lt;&#x2F;code&gt; Lower Limit or Insufficient&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x14&lt;&#x2F;code&gt; Too Open &#x2F; Insecure&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x24&lt;&#x2F;code&gt; Below Range or Underflow&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x34&lt;&#x2F;code&gt; Quorum Not Reached&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x44&lt;&#x2F;code&gt; Not Available Yet&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x54&lt;&#x2F;code&gt; Insufficient Funds&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x64&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x74&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x84&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x94&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xA4&lt;&#x2F;code&gt; App-Specific Below Condition&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xB4&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xC4&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xD4&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xE4&lt;&#x2F;code&gt; Unsigned or Untrusted&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xF4&lt;&#x2F;code&gt; Off-Chain Service Unreachable&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x*5&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x05&lt;&#x2F;code&gt; Receiver Action Required&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x15&lt;&#x2F;code&gt; Needs Your Permission or Request for Continuation&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x25&lt;&#x2F;code&gt; Request for Match&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x35&lt;&#x2F;code&gt; Receiver&#x27;s Ratification Requested&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x45&lt;&#x2F;code&gt; Awaiting Your Availability&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x55&lt;&#x2F;code&gt; Funds Requested&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x65&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x75&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x85&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x95&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xA5&lt;&#x2F;code&gt; App-Specific Receiver Action Requested&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xB5&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xC5&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xD5&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xE5&lt;&#x2F;code&gt; Signature Required&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xF5&lt;&#x2F;code&gt; Off-Chain Action Required&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x*6&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x06&lt;&#x2F;code&gt; Upper Limit&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x16&lt;&#x2F;code&gt; Revoked or Banned&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x26&lt;&#x2F;code&gt; Above Range or Overflow&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x36&lt;&#x2F;code&gt; Offer or Vote Limit Reached&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x46&lt;&#x2F;code&gt; Expired&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x56&lt;&#x2F;code&gt; Transfer Volume Exceeded&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x66&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x76&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x86&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x96&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xA6&lt;&#x2F;code&gt; App-Specific Expiry or Limit&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xB6&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xC6&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xD6&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xE6&lt;&#x2F;code&gt; Known to be Compromised&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xF6&lt;&#x2F;code&gt; Off-Chain Expiry or Limit Reached&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x*7&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x07&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x17&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x27&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x37&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x47&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x57&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x67&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x77&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x87&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x97&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xA7&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xB7&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xC7&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xD7&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xE7&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xF7&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x*8&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x08&lt;&#x2F;code&gt; Duplicate, Unnecessary, or Inapplicable&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x18&lt;&#x2F;code&gt; Not Applicable to Current State&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x28&lt;&#x2F;code&gt; Duplicate, Conflict, or Collision&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x38&lt;&#x2F;code&gt; Already Voted&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x48&lt;&#x2F;code&gt; Already Done&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x58&lt;&#x2F;code&gt; Funds Not Required&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x68&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x78&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x88&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x98&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xA8&lt;&#x2F;code&gt; App-Specific Inapplicable Condition&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xB8&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xC8&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xD8&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xE8&lt;&#x2F;code&gt; Already Signed or Not Encrypted&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xF8&lt;&#x2F;code&gt; Duplicate Off-Chain Request&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x*9&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x09&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x19&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x29&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x39&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x49&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x59&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x69&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x79&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x89&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x99&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xA9&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xB9&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xC9&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xD9&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xE9&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xF9&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x*A&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x0A&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x1A&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x2A&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x3A&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x4A&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x5A&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x6A&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x7A&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x8A&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x9A&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xAA&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xBA&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xCA&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xDA&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xEA&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xFA&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x*B&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x0B&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x1B&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x2B&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x3B&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x4B&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x5B&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x6B&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x7B&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x8B&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x9B&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xAB&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xBB&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xCB&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xDB&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xEB&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xFB&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x*C&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x0C&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x1C&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x2C&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x3C&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x4C&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x5C&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x6C&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x7C&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x8C&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x9C&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xAC&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xBC&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xCC&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xDC&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xEC&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xFC&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x*D&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x0D&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x1D&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x2D&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x3D&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x4D&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x5D&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x6D&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x7D&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x8D&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x9D&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xAD&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xBD&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xCD&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xDD&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xED&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xFD&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x*E&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x0E&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x1E&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x2E&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x3E&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x4E&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x5E&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x6E&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x7E&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x8E&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x9E&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xAE&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xBE&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xCE&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xDE&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xEE&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xFE&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x*F&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x0F&lt;&#x2F;code&gt; Informational or Metadata&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x1F&lt;&#x2F;code&gt; Permission Details or Control Conditions&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x2F&lt;&#x2F;code&gt; Matching Meta or Info&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x3F&lt;&#x2F;code&gt; Negotiation Rules or Participation Info&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x4F&lt;&#x2F;code&gt; Availability Rules or Info (ex. time since or until)&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x5F&lt;&#x2F;code&gt; Token or Financial Information&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x6F&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x7F&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x8F&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x9F&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xAF&lt;&#x2F;code&gt; App-Specific Meta or Info&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xBF&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xCF&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xDF&lt;&#x2F;code&gt; [reserved]&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xEF&lt;&#x2F;code&gt; Cryptography, ID, or Proof Metadata&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xFF&lt;&#x2F;code&gt; Off-Chain Info or Meta&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;example-function-change&quot;&gt;Example Function Change&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; startTime&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; counters&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Before&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; increase&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _available&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;now&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; startTime &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; counters&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    counters&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; After&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; increase&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _status&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;now&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; start&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span&gt; hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;44&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Not yet available&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;counters&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span&gt; hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;10&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Not authorized&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    counters&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;01&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Success&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;example-sequence-diagrams&quot;&gt;Example Sequence Diagrams&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x03 = Waiting&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x31 = Other Party (ie: not you) Agreed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x41 = Available&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x44 = Not Yet Available&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                          Exchange&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;AwesomeCoin                 DEX                     TraderBot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     +                       +                          +&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     |                       |       buy(AwesomeCoin)   |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     |                       | &amp;lt;------------------------+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     |         buy()         |                          |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     | &amp;lt;---------------------+                          |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     |                       |                          |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     |     Status [0x44]     |                          |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     +---------------------&amp;gt; |       Status [0x44]      |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     |                       +------------------------&amp;gt; |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     |                       |                          |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     |                       |        isDoneYet()       |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     |                       | &amp;lt;------------------------+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     |                       |                          |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     |                       |       Status [0x44]      |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     |                       +------------------------&amp;gt; |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     |                       |                          |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     |                       |                          |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     |     Status [0x41]     |                          |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     +---------------------&amp;gt; |                          |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     |                       |                          |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     |       buy()           |                          |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     | &amp;lt;---------------------+                          |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     |                       |                          |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     |                       |                          |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     |     Status [0x31]     |                          |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     +---------------------&amp;gt; |      Status [0x31]       |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     |                       +------------------------&amp;gt; |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     |                       |                          |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     |                       |                          |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     |                       |                          |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     |                       |                          |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     +                       +                          +&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x01 = Generic Success&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x10 = Disallowed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x11 = Allowed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                              Token Validation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;           Buyer                  RegulatedToken           TokenValidator               IDChecker          SpendLimiter&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             +                          +                         +                         +                   +&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             |        buy()             |                         |                         |                   |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             +------------------------&amp;gt; |          check()        |                         |                   |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             |                          +-----------------------&amp;gt; |          check()        |                   |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             |                          |                         +-----------------------&amp;gt; |                   |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             |                          |                         |                         |                   |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             |                          |                         |         Status [0x10]   |                   |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             |                          |       Status [0x10]     | &amp;lt;-----------------------+                   |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             |        revert()          | &amp;lt;-----------------------+                         |                   |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             | &amp;lt;------------------------+                         |                         |                   |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             |                          |                         |                         |                   |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+---------------------------+           |                         |                         |                   |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|                           |           |                         |                         |                   |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;| Updates ID with provider  |           |                         |                         |                   |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|                           |           |                         |                         |                   |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+---------------------------+           |                         |                         |                   |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             |                          |                         |                         |                   |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             |         buy()            |                         |                         |                   |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             +------------------------&amp;gt; |        check()          |                         |                   |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             |                          +-----------------------&amp;gt; |         check()         |                   |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             |                          |                         +-----------------------&amp;gt; |                   |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             |                          |                         |                         |                   |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             |                          |                         |       Status [0x11]     |                   |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             |                          |                         | &amp;lt;-----------------------+                   |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             |                          |                         |                         |                   |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             |                          |                         |                         |   check()         |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             |                          |                         +-------------------------------------------&amp;gt; |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             |                          |                         |                         |                   |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             |                          |                         |                         |  Status [0x11]    |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             |                          |       Status [0x11]     | &amp;lt;-------------------------------------------+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             |        Status [0x01]     | &amp;lt;-----------------------+                         |                   |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             | &amp;lt;------------------------+                         |                         |                   |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             |                          |                         |                         |                   |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             |                          |                         |                         |                   |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             |                          |                         |                         |                   |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             +                          +                         +                         +                   +&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;encoding&quot;&gt;Encoding&lt;&#x2F;h3&gt;
&lt;p&gt;Status codes are encoded as a &lt;code&gt;byte&lt;&#x2F;code&gt;. Hex values break nicely into high and low nibbles: &lt;code&gt;category&lt;&#x2F;code&gt; and &lt;code&gt;reason&lt;&#x2F;code&gt;. For instance, &lt;code&gt;0x01&lt;&#x2F;code&gt; stands for general success (ie: &lt;code&gt;true&lt;&#x2F;code&gt;) and &lt;code&gt;0x00&lt;&#x2F;code&gt; for general failure (ie: &lt;code&gt;false&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;As a general approach, all even numbers are blocking conditions (where the receiver does not have control), and odd numbers are nonblocking (the receiver is free to continue as they wish). This aligns both a simple bit check with the common encoding of Booleans.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;bytes1&lt;&#x2F;code&gt; is very lightweight, portable, easily interoperable with &lt;code&gt;uint8&lt;&#x2F;code&gt;, cast from &lt;code&gt;enum&lt;&#x2F;code&gt;s, and so on.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;alternatives&quot;&gt;Alternatives&lt;&#x2F;h4&gt;
&lt;p&gt;Alternate schemes include &lt;code&gt;bytes32&lt;&#x2F;code&gt; and &lt;code&gt;uint8&lt;&#x2F;code&gt;. While these work reasonably well, they have drawbacks.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;uint8&lt;&#x2F;code&gt; feels even more similar to HTTP status codes, and enums don&#x27;t require as much casting. However does not break as evenly as a square table (256 doesn&#x27;t look as nice in base 10).&lt;&#x2F;p&gt;
&lt;p&gt;Packing multiple codes into a single &lt;code&gt;bytes32&lt;&#x2F;code&gt; is nice in theory, but poses additional challenges. Unused space may be interpreted as &lt;code&gt;0x00 Failure&lt;&#x2F;code&gt;, you can only efficiently pack four codes at once, and there is a challenge in ensuring that code combinations are sensible. Forcing four codes into a packed representation encourages multiple status codes to be returned, which is often more information than strictly necessarily. This can lead to paradoxical results (ex &lt;code&gt;0x00&lt;&#x2F;code&gt; and &lt;code&gt;0x01&lt;&#x2F;code&gt; together), or greater resources allocated to interpreting 256&lt;sup&gt;4&lt;&#x2F;sup&gt; (4.3 billion) permutations.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;multiple-returns&quot;&gt;Multiple Returns&lt;&#x2F;h3&gt;
&lt;p&gt;While there may be cases where packing a byte array of status codes may make sense, the simplest, most forwards-compatible method of transmission is as the first value of a multiple return.&lt;&#x2F;p&gt;
&lt;p&gt;Familiarity is also a motivating factor. A consistent position and encoding together follow the principle of least surprise. It is both viewable as a &quot;header&quot; in the HTTP analogy, or like the &quot;tag&quot; in BEAM tagged tuples.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;human-readable&quot;&gt;Human Readable&lt;&#x2F;h3&gt;
&lt;p&gt;Developers should not be required to memorize 256 codes. However, they break nicely into a table. Cognitive load is lowered by organizing the table into categories and reasons. &lt;code&gt;0x10&lt;&#x2F;code&gt; and &lt;code&gt;0x11&lt;&#x2F;code&gt; belong to the same category, and &lt;code&gt;0x04&lt;&#x2F;code&gt; shares a reason with &lt;code&gt;0x24&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;While this repository includes helper enums, we have found working directly in the hex values to be quite natural. Status code &lt;code&gt;0x10&lt;&#x2F;code&gt; is just as comfortable as HTTP 401, for example.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;localizations&quot;&gt;Localizations&lt;&#x2F;h4&gt;
&lt;p&gt;One commonly requested application of this spec is human-readable translations of codes. This has been moved to its own proposal: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1444&#x2F;&quot;&gt;ERC-1444&lt;&#x2F;a&gt;, primarily due to a desire to keep both specs focused.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;extensibility&quot;&gt;Extensibility&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;0xA&lt;&#x2F;code&gt; category is reserved for application-specific statuses. In the case that 256 codes become insufficient, &lt;code&gt;bytes1&lt;&#x2F;code&gt; may be embedded in larger byte arrays.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;evm-codes&quot;&gt;EVM Codes&lt;&#x2F;h3&gt;
&lt;p&gt;The EVM also returns a status code in transactions; specifically &lt;code&gt;0x00&lt;&#x2F;code&gt; and &lt;code&gt;0x01&lt;&#x2F;code&gt;. This proposal both matches the meanings of those two codes, and could later be used at the EVM level.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;empty-space&quot;&gt;Empty Space&lt;&#x2F;h3&gt;
&lt;p&gt;Much like how HTTP status codes have large unused ranges, there are totally empty sections in this proposal. The intent is to not impose a complete set of codes up front, and to allow users to suggest uses for these spaces as time progresses.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;beyond-errors&quot;&gt;Beyond Errors&lt;&#x2F;h3&gt;
&lt;p&gt;This spec is intended to be much more than a set of common errors. One design goal is to enable easier contract-to-contract communication, protocols built on top of status codes, and flows that cross off-chain. Many of these cases include either expected kinds of exception state (as opposed to true errors), neutral states, time logic, and various successes.&lt;&#x2F;p&gt;
&lt;p&gt;Just like how HTTP 200 has a different meaning from HTTP 201, ERC-1066 status codes can relay information between contract beyond simply pass or fail. They can be thought of as the edges in a graph that has smart contracts as nodes.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;fully-revertable&quot;&gt;Fully &lt;code&gt;revert&lt;&#x2F;code&gt;able&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;em&gt;This spec is fully compatible with &lt;code&gt;revert&lt;&#x2F;code&gt;-with-reason and does not intend to supplant it in any way.&lt;&#x2F;em&gt; Both by reverting with a common code, the developer can determine what went wrong from a set of known error states.&lt;&#x2F;p&gt;
&lt;p&gt;Further, by leveraging ERC-1066 and a translation table (such as in ERC-1444) in conjunction, developers and end users alike can receive fully automated human-readable error messages in the language and phrasing of their choice.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;nibble-order&quot;&gt;Nibble Order&lt;&#x2F;h3&gt;
&lt;p&gt;Nibble order makes no difference to the machine, and is purely mnemonic. This design was originally in opposite order, but changed it for a few convenience factors. Since it&#x27;s a different scheme from HTTP, it may feel strange initially, but becomes very natural after a couple hours of use.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;short-forms&quot;&gt;Short Forms&lt;&#x2F;h4&gt;
&lt;p&gt;Generic is &lt;code&gt;0x0*&lt;&#x2F;code&gt;, general codes are consistent with their integer representations&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;1&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;01&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; with casting&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;contract-categories&quot;&gt;Contract Categories&lt;&#x2F;h4&gt;
&lt;p&gt;Many applications will always be part of the same category. For instance, validation will generally be in the &lt;code&gt;0x10&lt;&#x2F;code&gt; range.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Whitelist&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; whitelist&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; deadline&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    byte &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; prefix &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;10&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    check&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; _&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt; _user&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _status&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;now&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; deadline&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span&gt; prefix &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 5&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;whitelist&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_user&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span&gt; prefix &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; prefix&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;helpers&quot;&gt;Helpers&lt;&#x2F;h4&gt;
&lt;p&gt;This above also means that working with app-specific enums is slightly easier, and also saves gas (fewer operations required).&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;enum&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Sleep&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;    Awake&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;    Asleep&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;    BedOccupied&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other z-enummember&quot;&gt;    WindingDown&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; From the helper library&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; appCode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Sleep&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; byte&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;160&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; _state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 160 = 0xA0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Versus&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; appCode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Sleep&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; byte&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;16&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; _state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 10 = 0xA&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Reference cases and helper libraries (Solidity and JS) can be found at:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;fission-suite&#x2F;fission-codes&#x2F;&quot;&gt;Source Code&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.npmjs.com&#x2F;package&#x2F;fission-codes&#x2F;&quot;&gt;Package on npm&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Gas relay for contract calls</title>
        <published>2018-05-04T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Alex Van de Sande</name><email>avsa@ethereum.org</email>
	</author>
	
	<author>
		<name>Ricardo Guilherme Schmidt</name><uri>https://github.com/3esmit</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1077/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc1077-and-1078-the-magic-of-executable-signed-messages-to-login-and-do-actions/351" />
        

        <id>https://wg-eips.ritovision.com/1077/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:1077"
            label="ERC-1077" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1077/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;A standard interface for gas abstraction in top of smart contracts.&lt;&#x2F;p&gt;
&lt;p&gt;Allows users to offer &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;EIP-20&lt;&#x2F;a&gt; token for paying the gas used in a call.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;A main barrier for the adoption of DApps is the requirement of multiple tokens for executing in chain actions. Allowing users to sign messages to show intent of execution, but allowing a third party relayer to execute them can circumvent this problem, while ETH will always be required for ethereum transactions, it&#x27;s possible for smart contract to take &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;191&#x2F;&quot;&gt;EIP-191&lt;&#x2F;a&gt; signatures and forward a payment incentive to an untrusted party with ETH for executing the transaction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Standardizing a common format for them, as well as a way in which the user allows the transaction to be paid in tokens, gives app developers a lot of flexibility and can become the main way in which app users interact with the Blockchain.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;methods&quot;&gt;Methods&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;executegasrelay&quot;&gt;executeGasRelay&lt;&#x2F;h4&gt;
&lt;p&gt;Executes &lt;code&gt;_execData&lt;&#x2F;code&gt; with current &lt;code&gt;lastNonce()&lt;&#x2F;code&gt; and pays &lt;code&gt;msg.sender&lt;&#x2F;code&gt; the gas used in specified &lt;code&gt;_gasToken&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; executeGasRelay&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _execData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _gasPrice&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _gasLimit&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _gasToken&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _gasRelayer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;	&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;executegasrelaymsg&quot;&gt;executeGasRelayMsg&lt;&#x2F;h3&gt;
&lt;p&gt;Returns the &lt;code&gt;executeGasRelay&lt;&#x2F;code&gt; message used for signing messages..&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; executeGasRelayMsg&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _execData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _gasPrice&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _gasLimit&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _gasToken&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _gasRelayer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;executegasrelayerc191msg&quot;&gt;executeGasRelayERC191Msg&lt;&#x2F;h4&gt;
&lt;p&gt;Returns the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;191&#x2F;&quot;&gt;EIP-191&lt;&#x2F;a&gt; of &lt;code&gt;executeGasRelayMsg&lt;&#x2F;code&gt; used for signing messages and for verifying the execution.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; executeGasRelayERC191Msg&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _execData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _gasPrice&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _gasLimit&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _gasToken&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _gasRelayer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;lastnonce&quot;&gt;lastNonce&lt;&#x2F;h4&gt;
&lt;p&gt;Returns the current nonce for the gas relayed messages.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; lastNonce&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;signed-message&quot;&gt;Signed Message&lt;&#x2F;h3&gt;
&lt;p&gt;The signed message require the following fields:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Nonce: A nonce &lt;em&gt;or&lt;&#x2F;em&gt; a timestamp;&lt;&#x2F;li&gt;
&lt;li&gt;Execute Data: the bytecode to be executed by the account contract;&lt;&#x2F;li&gt;
&lt;li&gt;Gas Price: The gas price (paid in the selected token);&lt;&#x2F;li&gt;
&lt;li&gt;Gas Limit: The gas reserved to the relayed execution;&lt;&#x2F;li&gt;
&lt;li&gt;Gas Token: A token in which the gas will be paid (leave 0 for ether);&lt;&#x2F;li&gt;
&lt;li&gt;Gas Relayer: the beneficiary of gas refund for this call (leave 0 for &lt;code&gt;block.coinbase&lt;&#x2F;code&gt;) .&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;signing-the-message&quot;&gt;Signing the message&lt;&#x2F;h4&gt;
&lt;p&gt;The message &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be signed as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;191&#x2F;&quot;&gt;EIP-191&lt;&#x2F;a&gt; standard, and the called contract &lt;strong&gt;MUST&lt;&#x2F;strong&gt; also implement &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;EIP-1271&lt;&#x2F;a&gt; which must validate the signed messages.&lt;&#x2F;p&gt;
&lt;p&gt;Messages &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be signed by the owner of the account contract executing. If the owner is a contract, it must implement &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;EIP-1271&lt;&#x2F;a&gt; interface and forward validation to it.&lt;&#x2F;p&gt;
&lt;p&gt;In order to be compliant, the transaction &lt;strong&gt;MUST&lt;&#x2F;strong&gt; request to sign a &quot;messageHash&quot; that is a concatenation of multiple fields.&lt;&#x2F;p&gt;
&lt;p&gt;The fields &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be constructed as this method:&lt;&#x2F;p&gt;
&lt;p&gt;The first and second fields are to make it &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;191&#x2F;&quot;&gt;EIP-191&lt;&#x2F;a&gt; compliant. Starting a transaction with &lt;code&gt;byte(0x19)&lt;&#x2F;code&gt; ensure the signed data from being a &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;wiki&#x2F;wiki&#x2F;RLP&quot;&gt;valid ethereum transaction&lt;&#x2F;a&gt;. The second argument is a version control byte. The third being the validator address (the account contract address) according to version 0 of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;191&#x2F;&quot;&gt;EIP-191&lt;&#x2F;a&gt;. The remaining arguments being the application specific data for the gas relay: chainID as per &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1344&#x2F;&quot;&gt;EIP-1344&lt;&#x2F;a&gt;, execution nonce, execution data, agreed gas Price, gas limit of gas relayed call, gas token to pay back and gas relayer authorized to receive the reward.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;191&#x2F;&quot;&gt;EIP-191&lt;&#x2F;a&gt; message must be constructed as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;	abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        byte&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x19&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;ERC-191 - the initial 0x19 byte&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        byte&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;ERC-191 - the version byte&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;ERC-191 - version data (validator address)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        chainID&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes4&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;executeGasRelay(uint256,bytes,uint256,uint256,address,address)&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _execData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _gasPrice&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _gasLimit&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _gasToken&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _gasRelayer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;User pain points:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;users don&#x27;t want to think about ether&lt;&#x2F;li&gt;
&lt;li&gt;users don&#x27;t want to think about backing up private keys or seed phrases&lt;&#x2F;li&gt;
&lt;li&gt;users want to be able to pay for transactions using what they already have on the system, be apple pay, xbox points or even a credit card&lt;&#x2F;li&gt;
&lt;li&gt;Users don’t want to sign a new transaction at every move&lt;&#x2F;li&gt;
&lt;li&gt;Users don’t want to download apps&#x2F;extensions (at least on the desktop) to connect to their apps&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;App developer pain points:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Many apps use their own token and would prefer to use those as the main accounting&lt;&#x2F;li&gt;
&lt;li&gt;Apps want to be able to have apps in multiple platforms without having to share private keys between devices or have to spend transaction costs moving funds between them&lt;&#x2F;li&gt;
&lt;li&gt;Token developers want to be able for their users to be able to move funds and pay fees in the token&lt;&#x2F;li&gt;
&lt;li&gt;While the system provides fees and incentives for miners, there are no inherent business model for wallet developers (or other apps that initiate many transactions)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Using signed messages, specially combined with an account contract that holds funds, and multiple disposable ether-less keys that can sign on its behalf, solves many of these pain points.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;multiple-signatures&quot;&gt;Multiple signatures&lt;&#x2F;h3&gt;
&lt;p&gt;More than one signed transaction with the same parameter can be executed by this function at the same time, by passing all signatures in the &lt;code&gt;messageSignatures&lt;&#x2F;code&gt; field. That field will split the signature in multiple 72 character individual signatures and evaluate each one. This is used for cases in which one action might require the approval of multiple parties, in a single transaction.&lt;&#x2F;p&gt;
&lt;p&gt;If multiple signatures are required, then all signatures should then be &lt;em&gt;ordered by account&lt;&#x2F;em&gt; and the account contract should implement signatures checks locally (&lt;code&gt;JUMP&lt;&#x2F;code&gt;) on &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;EIP-1271&lt;&#x2F;a&gt; interface which might forward (&lt;code&gt;STATIC_CALL&lt;&#x2F;code&gt;) the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1271&#x2F;&quot;&gt;EIP-1271&lt;&#x2F;a&gt; signature check to owner contract.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;keep-track-of-nonces&quot;&gt;Keep track of nonces:&lt;&#x2F;h3&gt;
&lt;p&gt;Note that &lt;code&gt;executeGasRelay&lt;&#x2F;code&gt; function does not take a &lt;code&gt;_nonce&lt;&#x2F;code&gt; as parameter. The contract knows what is the current nonce, and can only execute the transactions in order, therefore there is no reason&lt;&#x2F;p&gt;
&lt;p&gt;Nonces work similarly to normal ethereum transactions: a transaction can only be executed if it matches the last nonce + 1, and once a transaction has occurred, the &lt;code&gt;lastNonce&lt;&#x2F;code&gt; will be updated to the current one. This prevents transactions to be executed out of order or more than once.&lt;&#x2F;p&gt;
&lt;p&gt;Contracts may accept transactions without nonce (nonce = 0). The contract then must keep the full hash of the transaction to prevent it from being replayed. This would allows contracts to have more flexibilities as you can sign a transaction that can be executed out of order or not at all, but it uses more memory for each transaction. It can be used, for instance, for transactions that the user wants to schedule in the future but cannot know its future nonce, or transactions that are made for state channel contracts that are not guaranteed to be executed or are only executed when there&#x27;s some dispute.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;execute-transaction&quot;&gt;Execute transaction&lt;&#x2F;h3&gt;
&lt;p&gt;After signature validation, the evaluation of &lt;code&gt;_execBytes&lt;&#x2F;code&gt; is up to the account contract implementation, it&#x27;s role of the wallet to properly use the account contract and it&#x27;s gas relay method.
A common pattern is to expose an interface which can be only called by the contract itself. The &lt;code&gt;_execBytes&lt;&#x2F;code&gt; could entirely forward the call in this way, as example: &lt;code&gt;address(this).call.gas(_gasLimit)(_execData);&lt;&#x2F;code&gt;
Where &lt;code&gt;_execData&lt;&#x2F;code&gt; could call any method of the contract itself, for example:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;call(address to, uint256 value, bytes data)&lt;&#x2F;code&gt;:  allow any type of ethereum call be performed;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;create(uint256 value, bytes deployData)&lt;&#x2F;code&gt;: allows create contract&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;create2(uint256 value, bytes32 salt, bytes deployData)&lt;&#x2F;code&gt;: allows create contract with deterministic address&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;approveAndCall(address token, address to, uint256 value, bytes data)&lt;&#x2F;code&gt;: allows safe approve and call of an ERC20 token.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;delegatecall(address codeBase, bytes data)&lt;&#x2F;code&gt;: allows executing code stored on other contract&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;changeOwner(address newOwner)&lt;&#x2F;code&gt;: Some account contracts might allow change of owner&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;foo(bytes bar)&lt;&#x2F;code&gt;: Some account contracts might have custom methods of any format.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The standardization of account contracts is not scope of this ERC, and is presented here only for illustration on possible implementations.
Using a self call to evaluate &lt;code&gt;_execBytes&lt;&#x2F;code&gt; is not mandatory, depending on the account contract logic, the evaluation could be done locally.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-accounting-and-refund&quot;&gt;Gas accounting and refund&lt;&#x2F;h3&gt;
&lt;p&gt;The implementing contract must keep track of the gas spent. One way to do it is to first call &lt;code&gt;gasLeft()&lt;&#x2F;code&gt; at the beginning of the function and then after executing the desired action and compare the difference.&lt;&#x2F;p&gt;
&lt;p&gt;The contract then will make a token transfer (or ether, if &lt;code&gt;tokenAddress&lt;&#x2F;code&gt; is nil) in the value of &lt;code&gt;gasSpent * gasPrice&lt;&#x2F;code&gt; to the &lt;code&gt;_gasRelayer&lt;&#x2F;code&gt;, that is the account that deployed the message.&lt;&#x2F;p&gt;
&lt;p&gt;If &lt;code&gt;_gasRelayer&lt;&#x2F;code&gt; is zero, then the funds &lt;strong&gt;MUST&lt;&#x2F;strong&gt; go to &lt;code&gt;block.coinbase&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;If there are not enough funds, or if the total surpasses &lt;code&gt;gasLimit&lt;&#x2F;code&gt; then the transaction &lt;strong&gt;MUST&lt;&#x2F;strong&gt; revert.&lt;&#x2F;p&gt;
&lt;p&gt;If the executed transaction fails internally, nonces should still be updated and gas needs to be paid.&lt;&#x2F;p&gt;
&lt;p&gt;Contracts are not obligated to support ether or any other token they don’t want and can be implemented to only accept refunds in a few tokens of their choice.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;usage-examples&quot;&gt;Usage examples&lt;&#x2F;h3&gt;
&lt;p&gt;This scheme opens up a great deal of possibilities on interaction as well as different experiments on business models:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Apps can create individual identities contract for their users which holds the actual funds and then create a different private key for each device they log into. Other apps can use the same identity and just ask to add permissioned public keys to manage the device, so that if one individual key is lost, no ether is lost.&lt;&#x2F;li&gt;
&lt;li&gt;An app can create its own token and only charge their users in its internal currency for any ethereum transaction. The currency units can be rounded so it looks more similar to actual amount of transactions: a standard transaction always costs 1 token, a very complex transaction costs exactly 2, etc. Since the app is the issuer of the transactions, they can do their own Sybil verifications and give a free amount of currency units to new users to get them started.&lt;&#x2F;li&gt;
&lt;li&gt;A game company creates games with a traditional monthly subscription, either by credit card or platform-specific microtransactions. Private keys never leave the device and keep no ether and only the public accounts are sent to the company. The game then signs transactions on the device with gas price 0, sends them to the game company which checks who is an active subscriber and batches all transactions and pays the ether themselves. If the company goes bankrupt, the gamers themselves can set up similar subscription systems or just increase the gas price. End result is a &lt;strong&gt;ethereum based game in which gamers can play by spending apple, google or xbox credits&lt;&#x2F;strong&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;A standard token is created that doesn’t require its users to have ether, and instead allows tokens to be transferred by paying in tokens. A wallet is created that signs messages and send them via whisper to the network, where other nodes can compete to download the available transactions, check the current gas price, and select those who are paying enough tokens to cover the cost. &lt;strong&gt;The result is a token that the end users never need to keep any ether and can pay fees in the token itself.&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;li&gt;A DAO is created with a list of accounts of their employees. Employees never need to own ether, instead they sign messages, send them to whisper to a decentralized list of relayers which then deploy the transactions. The DAO contract then checks if the transaction is valid and sends ether to the deployers. Employees have an incentive not to use too many of the companies resources because they’re identifiable.  The result is that the users of the DAO don&#x27;t need to keep ether, and &lt;strong&gt;the contract ends up paying for it&#x27;s own gas usage&lt;&#x2F;strong&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;There is no issues with backwards compatibility, however for future upgrades, as &lt;code&gt;_execData&lt;&#x2F;code&gt; contains arbitrary data evaluated by the account contract, it&#x27;s up to the contract to handle properly this data and therefore contracts can gas relay any behavior with the current interface.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;One initial implementation of such a contract can be found at &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;status-im&#x2F;account-contracts&#x2F;blob&#x2F;develop&#x2F;contracts&#x2F;account&#x2F;AccountGasAbstract.sol&quot;&gt;Status.im account-contracts repository&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Other version is implemented as Gnosis Safe variant in: https:&#x2F;&#x2F;github.com&#x2F;status-im&#x2F;safe-contracts&lt;&#x2F;p&gt;
&lt;h3 id=&quot;similar-implementations&quot;&gt;Similar implementations&lt;&#x2F;h3&gt;
&lt;p&gt;The idea of using signed messages as executable intent has been around for a while and many other projects are taking similar approaches, which makes it a great candidate for a standard that guarantees interoperability:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;pull&#x2F;877&quot;&gt;EIP-877&lt;&#x2F;a&gt; An attempt of doing the same but with a change in the protocol&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;status-im&#x2F;ideas&#x2F;issues&#x2F;73&quot;&gt;Status&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;aragonlabs&#x2F;pay-protocol&quot;&gt;Aragon&lt;&#x2F;a&gt; (this might not be the best link to show their work in this area)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;662&quot;&gt;Token Standard Functions for Preauthorized Actions&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;865&quot;&gt;Token Standard Extension 865&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;iurimatias&#x2F;TransactionRelay&quot;&gt;Iuri Matias: Transaction Relay&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;uport-project&#x2F;uport-identity#send-a-meta-tx&quot;&gt;uPort: Meta transactions&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;uport-project&#x2F;uport-identity&#x2F;blob&#x2F;develop&#x2F;docs&#x2F;txRelay.md&quot;&gt;uPort: safe Identities&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;gnosis&#x2F;safe-contracts&quot;&gt;Gnosis safe contracts&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Swarm city uses a similar proposition for etherless transactions, called &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;swarmcity&#x2F;SCLabs-gasstation-service&quot;&gt;Gas Station Service&lt;&#x2F;a&gt;, but it&#x27;s a different approach. Instead of using signed messages, a traditional ethereum transaction is signed on an etherless account, the transaction is then sent to a service that immediately sends the exact amount of ether required and then publishes the transaction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Deployers of transactions (relayers) should be able to call untrusted contracts, which provides no guarantees that the contract they are interacting with correctly implements the standard and they will be reimbursed for gas. To prevent being fooled by bad implementations, relayers must &lt;strong&gt;estimate the outcome of a transaction&lt;&#x2F;strong&gt;, and only include&#x2F;sign transactions which have a desired outcome.&lt;&#x2F;p&gt;
&lt;p&gt;Is also interest of relayers to maintaining a private reputation of contracts they interact with, as well as keep track of which tokens and for which &lt;code&gt;gasPrice&lt;&#x2F;code&gt; they’re willing to deploy transactions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=qF2lhJzngto&quot;&gt;Universal Logins talk at UX Unconf, Toronto&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Universal login &#x2F; signup using ENS subdomains</title>
        <published>2018-05-04T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Alex Van de Sande</name><email>avsa@ethereum.org</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1078/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc1077-and-1078-the-magic-of-executable-signed-messages-to-login-and-do-actions/351" />
        

        <id>https://wg-eips.ritovision.com/1078/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:1078"
            label="ERC-1078" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1078/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This presents a method to replace the usual signup&#x2F;login design pattern with a minimal ethereum native scheme, that doesn’t require passwords, backing up private keys nor typing seed phrases. From the user&#x27;s point of view it will be very similar to patterns they’re already used to with second factor authentication (without relying in a central server), but for dapp developers it requires a new way to think about ethereum transactions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;The unique identifier of the user is a contract that implements both Identity and the Executable Signed Messages ERCs. The user should not need to provide this address directly, only a ENS name pointing to it. These types of contracts are indirectly controlled by private keys that can sign messages indicating intents, which are then deployed to the contract by a third party (or a decentralized network of deployers).&lt;&#x2F;p&gt;
&lt;p&gt;In this context, therefore, a device &quot;logging into&quot; an app using an identity, means that the device will generate a private key locally and then request an authorization to add that key as one of the signers of that identity, with a given set of permissions. Since that private key is only used for signing messages, it is not required to hold ether, tokens or assets, and if lost, it can be simply be replaced by a new one – the user&#x27;s funds are kept on the identity contract.&lt;&#x2F;p&gt;
&lt;p&gt;In this context, ethereum accounts are used in a manner more similar to auth tokens, rather than unique keys.&lt;&#x2F;p&gt;
&lt;p&gt;The login process is as follows:&lt;&#x2F;p&gt;
&lt;h4 id=&quot;1-request-a-name-from-the-user&quot;&gt;1) Request a name from the user&lt;&#x2F;h4&gt;
&lt;p&gt;The first step of the process is to request from the user the ENS name that points to their identity. If the user doesn’t have a login set up, the app should–if they have an integrated identity manager–provide an option to provide a subdomain or a name they own.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;UX Note:&lt;&#x2F;strong&gt; there are many ways to provide this interface, the app can ask if they want to signup&#x2F;login before hand or simply directly ask them to type the name. Note that since it’s trivial to verify if a username exists, your app should adapt to it gracefully and not require the user to type their name twice. If they ask to signup and provide a name that exists then ask them if they want to login using that name, or similarly if they ask to connect to an existing name but type a non-existent name show them a nice alert and ask them if they want to create that name now. Don’t force them to type the same name twice in two different fields.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;2-a-create-a-new-identity&quot;&gt;2.a) Create a new identity&lt;&#x2F;h4&gt;
&lt;p&gt;If the user doesn’t have an identity, the app should provide the option to create one for them. Each app must have one or more domains they control which they can create immediate subdomains on demand. The app therefore will make these actions on the background:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Generate a private key which it will keep saved locally on the device or browser, the safest way possible.&lt;&#x2F;li&gt;
&lt;li&gt;Create (or set up) an identity contract which supports both ERC720 and ERC1077&lt;&#x2F;li&gt;
&lt;li&gt;Register the private key created on step 1 as the &lt;em&gt;only&lt;&#x2F;em&gt; admin key of the contract (the app must not add any app-controlled key, except as a recovery option - see 5)&lt;&#x2F;li&gt;
&lt;li&gt;Register the requested subdomain and transfer its ownership to the contract (while the app controls the main domain and may keep the option to reassign them at will, the ownership of the subdomain itself should belong to the identity, therefore allowing them to transfer it)&lt;&#x2F;li&gt;
&lt;li&gt;(Optionally) Register a recovery method on the contract, which allows the user to regain access to the contract in case the main key is lost.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;All those steps can be designed to be set up in a single ethereum transaction. Since this step is not free, the app reserves the right to charge for registering users, or require the user to be verified in a sybil resistant manner of the app’s choosing (captcha, device ID registration, proof of work, etc)&lt;&#x2F;p&gt;
&lt;p&gt;The user shouldn’t be forced to wait for transaction confirmation times. Instead, have an indicator somewhere on the app that shows the progress and then allow the user to interact with your app normally. It’s unlikely that they’ll need the identity in the first few minutes and if something goes wrong (username gets registered at the same time), you can then ask the user for an action.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Implementation note:&lt;&#x2F;strong&gt; in order to save gas, some of these steps can be done in advance. The app can automatically deploy a small number of contracts when the gas price is low, and set up all their main variables to be 0xFFFFFF...FFFFF. These should be considered ‘vacant’ and when the user registers one, they will get a gas discount for freeing up space on the chain. This has the added benefit of allowing the user a choice in contract address&#x2F;icon.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;2-b-connect-to-an-existing-identity&quot;&gt;2.b) Connect to an existing identity&lt;&#x2F;h4&gt;
&lt;p&gt;If the user wants to connect with an existing identity, then the first thing the app needs to understand is what level of privilege it’s going to ask for:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Manager&lt;&#x2F;strong&gt; the higher level, allows the key to initiate or sign transactions that change the identity itself, like adding or removing keys. An app should only require this level if it integrates an identity manager. Depending on how the identity is set up, it might require signature from more keys before these transactions can be deployed.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Action&lt;&#x2F;strong&gt; this level allows the key to initiate or sign transactions on address other than itself. It can move funds, ether, assets etc. An app should only require this level of privilege if it’s a general purpose wallet or browser for sending ethereum transactions. Depending on how the identity is set up, it might require signature from more keys before these transactions can be deployed.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Encryption&lt;&#x2F;strong&gt; the lower level has no right to initiate any transactions, but it can be used to represent the user in specific instances or off-chain signed messages. It’s the ideal level of privilege for games, chat or social media apps, as they can be used to sign moves, send messages, etc. If a game requires actual funds (say, to start a game with funds in stake) then it should still use the encryption level, and then require the main wallet&#x2F;browser of the user to sign messages using the ethereum URI standard.&lt;&#x2F;p&gt;
&lt;p&gt;Once the desired level is known, the app must take these steps:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Generate a private key&lt;&#x2F;strong&gt; which it will keep saved locally on the device or browser, the safest way possible.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Query ens&lt;&#x2F;strong&gt; to figure the existing address of the identity&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Generate the bytecode&lt;&#x2F;strong&gt; for a transaction calling the function &lt;code&gt;addKey(PUBLICKEY,LEVEL)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Broadcast a transaction request on a whisper channel&lt;&#x2F;strong&gt; or some other decentralized network of peers. Details on this step require further discussions&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;If web3 is available&lt;&#x2F;strong&gt; then attempt calling web3.eth.sendTransaction. This can be automatic or prompted by user action.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Attempt calling a URI&lt;&#x2F;strong&gt; if the app supports &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;681&#x2F;&quot;&gt;URL format for transaction requests EIP&lt;&#x2F;a&gt; then attempt calling this. This can be automatic or prompted by user action.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Show a QR code&lt;&#x2F;strong&gt;: with an EIP681 formatted URL. That QR code can be clickable to attempt to retry the other options, but it should be done last: if step 1 works, the user should receive a notification on their compatible device and won&#x27;t need to use the QR code.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Here&#x27;s an example of a EIP681 compatible address to add a public key generated locally in the app:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;ethereum:bob.example.eth?function=addKey(address=&#x27;0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef&#x27;,uint=1)&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;If adding the new key requires multiple signatures, or if the app receiving that request exclusiveky deals with executable signed messages and has no ether on itself, then it should follow the steps in the next section on how to request transactions.&lt;&#x2F;p&gt;
&lt;p&gt;As before, the user shouldn’t be forced to wait for transaction confirmation times. Instead, have an indicator somewhere on the app the shows the progress and then allow the user to interact with your app normally.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;3-request-transactions&quot;&gt;3) Request transactions&lt;&#x2F;h4&gt;
&lt;p&gt;After step 2, the end result should be that your app should have the identity address of the user, their main ens name and a private key, whose public account is listed on the identity as one of their keys, with roles being either manager, action or encryption. Now it can start using that information to sign and execute transactions.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Not all transactions need to be on chain&lt;&#x2F;strong&gt;, actually most common uses of signed messages should be off chain. If you have a chat app, for instance, you can use the local key for signing messages and sending it to the other parties, and they can just query the identity contract to see if that key actually comes from the user. If you have a game with funds at stake, only the first transaction moving funds and setting up the initial game needs to be executed by the identity: at each turn the players can sign a hash of the current state of the board and at the end, the last two plays can be used to determine the winner. Notice that keys can be revoked at any time, so your app should take that in consideration, for instance saving all keys at the start of the game. Keys that only need this lower level of privilege, should be set at level 4 (encryption).&lt;&#x2F;p&gt;
&lt;p&gt;Once you decided you actually need an on-chain transaction, follow these steps:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Figure out the TO, FROM, VALUE and DATA&lt;&#x2F;strong&gt;. These are the basics of any ethereum transaction. &lt;code&gt;from&lt;&#x2F;code&gt; is the compatible contract you want the transaction to be deployed from.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Check the privilege level you need:&lt;&#x2F;strong&gt; if the &lt;code&gt;to&lt;&#x2F;code&gt; and &lt;code&gt;from&lt;&#x2F;code&gt; fields are the same contract, ie, if the transaction requires the identity to act upon itself (for instance, when adding or removing a key) then you need level 1 (management), otherwise it&#x27;s 2 (action). Verify if the key your app owns correspond to the required level.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Verify how many keys are required&lt;&#x2F;strong&gt; by calling &lt;code&gt;requiredSignatures(uint level)&lt;&#x2F;code&gt; on the target contract&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Figure out gasLimit&lt;&#x2F;strong&gt;: Estimate the gas cost of the desired transaction, and add a margin (recommended: add 100k gas)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Figure out gasToken and gasPrice&lt;&#x2F;strong&gt;:  Check the current gas price considering network congestions and the market price of the token the user is going to pay with. Leave gasToken as 0 for ether. Leave gasPrice as 0 if you are deploying it yourself and subsidizing the costs elsewhere.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Sign an executable signed transaction&lt;&#x2F;strong&gt; by following that standard.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;After having all the signed executable message, we need to deploy it to the chain. If the transaction only requires a single signature, then the app provider can deploy it themselves. Send the transaction to the &lt;code&gt;from&lt;&#x2F;code&gt; address and attempt to call the function &lt;code&gt;executeSigned&lt;&#x2F;code&gt;, using the parameters and signature you just collected.&lt;&#x2F;p&gt;
&lt;p&gt;If the transaction need to collect more signatures or the app doesn&#x27;t have a deployable server, the app should follow these steps:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Broadcast the transaction on a whisper channel&lt;&#x2F;strong&gt; or some other decentralized network of peers. Details on this step require further discussions&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;If web3 is available&lt;&#x2F;strong&gt; then attempt calling web3.eth.personal_sign. This can be automatic or prompted by user action.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Show a QR code&lt;&#x2F;strong&gt;: with the signed transaction and the new data to be signed. That QR code can be clickable to attempt to retry the other options, but it should be done last: if step 1 works, the user should receive a notification on their compatible device and won&#x27;t need to use the QR code.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The goal is to keep broadcasting signatures via whisper until a node that is willing to deploy them is able to collect all messages.&lt;&#x2F;p&gt;
&lt;p&gt;Once you&#x27;ve followed the above steps, watch the transaction pool to any transaction to that address and then take the user to your app. Once you seen the desired transaction, you can stop showing the  QR code and proceed with the app, while keeping some indication that the transaction is in progress. Subscribe to the event &lt;code&gt;ExecutedSigned&lt;&#x2F;code&gt; of the desired contract: once you see the transaction with the nonce, you can call it a success. If you see a different transaction with the same or higher nonce (or timestamp) then you consider the transaction permanently failed and restart the process.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h3&gt;
&lt;p&gt;No working examples of this implementation exists, but many developers have expressed interest in adopting it. This section will be edited in the future to reflect that.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;conclusion-and-future-improvements&quot;&gt;Conclusion and future improvements&lt;&#x2F;h3&gt;
&lt;p&gt;This scheme would allow much more lighter apps, that don’t require holding ether, and can keep unlocked private keys on the device to be able to send messages and play games without requesting user prompt every time. More work is needed to standardize common decentralized messaging protocols as well as open source tools for deployment nodes, in order to create a decentralized and reliable layer for message deployment.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;references&quot;&gt;References&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=qF2lhJzngto&quot;&gt;Universal Logins talk at UX Unconf, Toronto&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Opt-in account exposure</title>
        <published>2018-05-04T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Paul Bouchon</name><email>mail@bitpshr.net</email>
	</author>
	
	<author>
		<name>Erik Marks</name><uri>https://github.com/rekmarks</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1102/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-1102-opt-in-provider-access/414" />
        

        <id>https://wg-eips.ritovision.com/1102/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="interface"
                label="Interface" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:1102"
            label="EIP-1102" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1102/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple summary&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal describes a communication protocol between dapps and Ethereum-enabled DOM environments that allows the Ethereum-enabled DOM environment to choose what information to supply the dapp with and when.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The previous generation of Ethereum-enabled DOM environments follows a pattern of injecting a provider populated with accounts without user consent. This puts users of such environments at risk because malicious websites can use these accounts to view detailed account information and to arbitrarily initiate unwanted transactions on a user&#x27;s behalf.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal outlines a protocol in which Ethereum-enabled DOM environments can choose to expose no accounts until the user approves account access.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;concepts&quot;&gt;Concepts&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;rfc-2119&quot;&gt;RFC-2119&lt;&#x2F;h4&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;,  &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.ietf.org&#x2F;rfc&#x2F;rfc2119.txt&quot;&gt;RFC-2119&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;eth-requestaccounts&quot;&gt;&lt;code&gt;eth_requestAccounts&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Providers exposed by Ethereum-enabled DOM environments define a new RPC method: &lt;code&gt;eth_requestAccounts&lt;&#x2F;code&gt;. Calling this method may trigger a user interface that allows the user to approve or reject account access for a given dapp. This method returns a &lt;code&gt;Promise&lt;&#x2F;code&gt; that is resolved with an &lt;code&gt;Array&lt;&#x2F;code&gt; of accounts or is rejected with an &lt;code&gt;Error&lt;&#x2F;code&gt; if accounts are not available.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;ethereum&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;send&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_requestAccounts&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;Promise&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Array&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;provider-enable-deprecated&quot;&gt;Provider#enable (DEPRECATED)&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;Note: This method is deprecated in favor of the RPC method &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1102&#x2F;#eth-requestaccounts&quot;&gt;&lt;code&gt;eth_requestAccounts&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Providers exposed by Ethereum-enabled DOM environments define a new RPC method: &lt;code&gt;ethereum.enable()&lt;&#x2F;code&gt;. Calling this method triggers a user interface that allows the user to approve or reject account access for a given dapp. This method returns a &lt;code&gt;Promise&lt;&#x2F;code&gt; that is resolved with an &lt;code&gt;Array&lt;&#x2F;code&gt; of accounts if the user approves access or rejected with an &lt;code&gt;Error&lt;&#x2F;code&gt; if the user rejects access.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;ethereum&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;enable&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;Promise&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;any&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;protocol&quot;&gt;Protocol&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;legacy-dapp-initialization&quot;&gt;Legacy dapp initialization&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;START dapp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;IF web3 is defined&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    CONTINUE dapp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;IF web3 is undefined&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    STOP dapp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;proposed-dapp-initialization&quot;&gt;Proposed dapp initialization&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;START dapp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;IF provider is defined&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    REQUEST[1] account access&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    IF user approves&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        RESOLVE[2] account access&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        CONTINUE dapp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    IF user rejects&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        REJECT[3] account access&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        STOP dapp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;IF provider is undefined&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    STOP dapp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;1-request&quot;&gt;&lt;code&gt;[1] REQUEST&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;p&gt;Dapps &lt;strong&gt;MUST&lt;&#x2F;strong&gt; request accounts by calling the &lt;code&gt;eth_requestAccounts&lt;&#x2F;code&gt; RPC method on the provider exposed at &lt;code&gt;window.ethereum&lt;&#x2F;code&gt;. Calling this method &lt;strong&gt;MAY&lt;&#x2F;strong&gt; trigger a user interface that allows the user to approve or reject account access for a given dapp. This method &lt;strong&gt;MUST&lt;&#x2F;strong&gt; return a &lt;code&gt;Promise&lt;&#x2F;code&gt; that is resolved with an array of one or more user accounts or rejected if no accounts are available (e.g., the user rejected account access).&lt;&#x2F;p&gt;
&lt;h5 id=&quot;2-resolve&quot;&gt;&lt;code&gt;[2] RESOLVE&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;p&gt;The &lt;code&gt;Promise&lt;&#x2F;code&gt; returned when calling the &lt;code&gt;eth_requestAccounts&lt;&#x2F;code&gt; RPC method &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be resolved with an &lt;code&gt;Array&lt;&#x2F;code&gt; of user accounts.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;3-reject&quot;&gt;&lt;code&gt;[3] REJECT&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;p&gt;The &lt;code&gt;Promise&lt;&#x2F;code&gt; returned when calling the &lt;code&gt;eth_requestAccounts&lt;&#x2F;code&gt; RPC method &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be rejected with an informative &lt;code&gt;Error&lt;&#x2F;code&gt; if no accounts are available for any reason.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;example-initialization&quot;&gt;Example initialization&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;try&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Request account access if needed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; accounts&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ethereum&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;send&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_requestAccounts&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Accounts now exposed, use them&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    ethereum&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;send&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_sendTransaction&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt; from&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; accounts&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ... &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; catch&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;error&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; User denied account access&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;constraints&quot;&gt;Constraints&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Browsers &lt;strong&gt;MUST&lt;&#x2F;strong&gt; expose a provider at &lt;code&gt;window.ethereum&lt;&#x2F;code&gt; .&lt;&#x2F;li&gt;
&lt;li&gt;Browsers &lt;strong&gt;MUST&lt;&#x2F;strong&gt; define an &lt;code&gt;eth_requestAccounts&lt;&#x2F;code&gt; RPC method.&lt;&#x2F;li&gt;
&lt;li&gt;Browsers &lt;strong&gt;MAY&lt;&#x2F;strong&gt; wait for a user interaction before resolving&#x2F;rejecting the &lt;code&gt;eth_requestAccounts&lt;&#x2F;code&gt; promise.&lt;&#x2F;li&gt;
&lt;li&gt;Browsers &lt;strong&gt;MUST&lt;&#x2F;strong&gt; include at least one account if the &lt;code&gt;eth_requestAccounts&lt;&#x2F;code&gt; promise is resolved.&lt;&#x2F;li&gt;
&lt;li&gt;Browsers &lt;strong&gt;MUST&lt;&#x2F;strong&gt; reject the promise with an informative error if no accounts are available.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The pattern of automatic account exposure followed by the previous generation of Ethereum-enabled DOM environments fails to protect user privacy and fails to maintain safe user experience: untrusted websites can both view detailed account information and arbitrarily initiate transactions on a user&#x27;s behalf. Even though most users may reject unsolicited transactions on untrusted websites, a protocol for account access should make such unsolicited requests impossible.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal establishes a new pattern wherein dapps must request access to user accounts. This protocol directly strengthens user privacy by allowing the browser to hide user accounts and preventing unsolicited transaction requests on untrusted sites.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;immediate-value-add&quot;&gt;Immediate value-add&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Users can reject account access on untrusted sites to hide accounts.&lt;&#x2F;li&gt;
&lt;li&gt;Users can reject account access on untrusted sites to prevent unsolicited transactions.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;long-term-value-add&quot;&gt;Long-term value-add&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Dapps could request specific account information based on user consent.&lt;&#x2F;li&gt;
&lt;li&gt;Dapps could request specific user information based on user consent (uPort, DIDs).&lt;&#x2F;li&gt;
&lt;li&gt;Dapps could request a specific network based on user consent.&lt;&#x2F;li&gt;
&lt;li&gt;Dapps could request multiple instances of the above based on user consent.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal impacts dapp developers and requires that they request access to user accounts following the protocol outlined above. Similarly, this proposal impacts dapp browser developers and requires that they only expose user accounts following the protocol defined above.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The MetaMask team &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;MetaMask&#x2F;metamask-extension&#x2F;pull&#x2F;4703&quot;&gt;has implemented&lt;&#x2F;a&gt; the strategy described above.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Ethereum Lightweight Identity</title>
        <published>2018-05-03T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Pelle Braendgaard</name><email>pelle.braendgaard@consensys.net</email>
	</author>
	
	<author>
		<name>Joel Torstensson</name><email>oed@consensys.net</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1056/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/1056" />
        

        <id>https://wg-eips.ritovision.com/1056/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1056"
            label="ERC-1056" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1056/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;A registry for key and attribute management of lightweight blockchain identities.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC describes a standard for creating and updating identities with a limited use of blockchain resources. An identity can have an unlimited number of &lt;code&gt;delegates&lt;&#x2F;code&gt; and &lt;code&gt;attributes&lt;&#x2F;code&gt; associated with it. Identity creation is as simple as creating a regular key pair ethereum account, which means that it&#x27;s free (no gas costs) and all ethereum accounts are valid identities. Furthermore this ERC is fully &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;w3c-ccg.github.io&#x2F;did-spec&#x2F;&quot;&gt;DID compliant&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;As we have been developing identity systems for the last couple of years at uPort it has become apparent that the cost of identity creation is a large issue. The previous Identity proposal &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;725&#x2F;&quot;&gt;ERC-725&lt;&#x2F;a&gt; faces this exact issue. Our requirements when creating this ERC is that identity creation should be free, and should be possible to do in an offline environment (e.g. refugee scenario). However it must also be possible to rotate keys without changing the primary identifier of the identity. The identity system should be fit to use off-chain as well as on-chain.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;Identifier&lt;&#x2F;code&gt;: a piece of data that uniquely identifies the identity, an ethereum address&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;delegate&lt;&#x2F;code&gt;: an address that is delegated for a specific time to perform some sort of function on behalf of an identity&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;delegateType&lt;&#x2F;code&gt;: the type of a delegate, is determined by a protocol or application higher up
Examples:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;did-jwt&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;raiden&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;attribute&lt;&#x2F;code&gt;: a piece of data associated with the identity&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC specifies a contract called &lt;code&gt;EthereumDIDRegistry&lt;&#x2F;code&gt; that is deployed once and can then be commonly used by everyone.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;identity-ownership&quot;&gt;Identity ownership&lt;&#x2F;h3&gt;
&lt;p&gt;By default an identity is owned by itself, meaning whoever controls the ethereum account with that address. The owner can be updated to a new key pair account or to a multisig account etc.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;identityowner&quot;&gt;identityOwner&lt;&#x2F;h4&gt;
&lt;p&gt;Returns the owner of the given identity.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; identityOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; identity&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;changeowner&quot;&gt;changeOwner&lt;&#x2F;h4&gt;
&lt;p&gt;Sets the owner of the given identity to another ethereum account.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; changeOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; identity&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newOwner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;changeownersigned&quot;&gt;changeOwnerSigned&lt;&#x2F;h4&gt;
&lt;p&gt;Same as above but with raw signature.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; changeOwnerSigned&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; identity&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sigV&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sigR&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sigS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newOwner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;delegate-management&quot;&gt;Delegate management&lt;&#x2F;h3&gt;
&lt;p&gt;Delegates can be used both on- and off-chain. They all have a &lt;code&gt;delegateType&lt;&#x2F;code&gt; which can be used to specify the purpose of the delegate.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;validdelegate&quot;&gt;validDelegate&lt;&#x2F;h4&gt;
&lt;p&gt;Returns true if the given &lt;code&gt;delegate&lt;&#x2F;code&gt; is a delegate with type &lt;code&gt;delegateType&lt;&#x2F;code&gt; of &lt;code&gt;identity&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validDelegate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; identity&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; delegateType&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; delegate&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;adddelegate&quot;&gt;addDelegate&lt;&#x2F;h4&gt;
&lt;p&gt;Adds a new delegate with the given type. &lt;code&gt;validity&lt;&#x2F;code&gt; indicates the number of seconds that the delegate will be valid for, after which it will no longer be a delegate of &lt;code&gt;identity&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addDelegate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; identity&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; delegateType&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; delegate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; validity&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;adddelegatesigned&quot;&gt;addDelegateSigned&lt;&#x2F;h4&gt;
&lt;p&gt;Same as above but with raw signature.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addDelegateSigned&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; identity&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sigV&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sigR&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sigS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; delegateType&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; delegate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; validity&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;revokedelegate&quot;&gt;revokeDelegate&lt;&#x2F;h4&gt;
&lt;p&gt;Revokes the given &lt;code&gt;delegate&lt;&#x2F;code&gt; for the given &lt;code&gt;identity&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revokeDelegate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; identity&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; delegateType&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; delegate&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;revokedelegatesigned&quot;&gt;revokeDelegateSigned&lt;&#x2F;h4&gt;
&lt;p&gt;Same as above but with raw signature.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revokeDelegateSigned&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; identity&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sigV&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sigR&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sigS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; delegateType&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; delegate&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;attribute-management&quot;&gt;Attribute management&lt;&#x2F;h3&gt;
&lt;p&gt;Attributes contain simple data about the identity. They can be managed only by the owner of the identity.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;setattribute&quot;&gt;setAttribute&lt;&#x2F;h4&gt;
&lt;p&gt;Sets an attribute with the given &lt;code&gt;name&lt;&#x2F;code&gt; and &lt;code&gt;value&lt;&#x2F;code&gt;, valid for &lt;code&gt;validity&lt;&#x2F;code&gt; seconds.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setAttribute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; identity&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; validity&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;setattributesigned&quot;&gt;setAttributeSigned&lt;&#x2F;h4&gt;
&lt;p&gt;Same as above but with raw signature.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setAttributeSigned&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; identity&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sigV&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sigR&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sigS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; validity&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;revokeattribute&quot;&gt;revokeAttribute&lt;&#x2F;h4&gt;
&lt;p&gt;Revokes an attribute.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revokeAttribute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; identity&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;revokeattributesigned&quot;&gt;revokeAttributeSigned&lt;&#x2F;h4&gt;
&lt;p&gt;Same as above but with raw signature.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revokeAttributeSigned&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; identity&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sigV&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sigR&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sigS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;events&quot;&gt;Events&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;didownerchanged&quot;&gt;DIDOwnerChanged&lt;&#x2F;h4&gt;
&lt;p&gt;MUST be triggered when &lt;code&gt;changeOwner&lt;&#x2F;code&gt; or &lt;code&gt;changeOwnerSigned&lt;&#x2F;code&gt; was successfully called.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DIDOwnerChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; identity&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; previousChange&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;diddelegatechanged&quot;&gt;DIDDelegateChanged&lt;&#x2F;h4&gt;
&lt;p&gt;MUST be triggered when a change to a delegate was successfully made.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DIDDelegateChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; identity&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; delegateType&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; delegate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; validTo&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; previousChange&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;didattributechanged&quot;&gt;DIDAttributeChanged&lt;&#x2F;h4&gt;
&lt;p&gt;MUST be triggered when a change to an attribute was successfully made.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DIDAttributeChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; identity&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; validTo&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; previousChange&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;efficient-lookup-of-events-through-linked-identity-events&quot;&gt;Efficient lookup of events through linked identity events&lt;&#x2F;h3&gt;
&lt;p&gt;Contract Events are a useful feature for storing data from smart contracts exclusively for off-chain use.  Unfortunately current ethereum implementations provide a very inefficient lookup mechanism. By using linked events that always link to the previous block with a change for the identity, we can solve this problem with much improved performance. Each identity has its previously changed block stored in the &lt;code&gt;changed&lt;&#x2F;code&gt; mapping.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Lookup &lt;code&gt;previousChange&lt;&#x2F;code&gt; block for identity&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Lookup all events for given identity address using web3, but only for the &lt;code&gt;previousChange&lt;&#x2F;code&gt; block&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Do something with the event&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Find &lt;code&gt;previousChange&lt;&#x2F;code&gt; from the event  and repeat&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Example code:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; history&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;previousChange&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; didReg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;identity&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;while&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;previousChange&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; filter&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; didReg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;allEvents&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;topics&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;identity&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; fromBlock&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; previousChange&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; toBlock&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; previousChange&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; events&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; await&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getLogs&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;filter&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  previousChange&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; undefined&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; event&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; of&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; events&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    history&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;unshift&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;event&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    previousChange&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; event&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;args&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;previousChange&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;     &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;building-a-did-document-for-an-identity&quot;&gt;Building a DID document for an identity&lt;&#x2F;h3&gt;
&lt;p&gt;The primary owner key should be looked up using &lt;code&gt;identityOwner(identity)&lt;&#x2F;code&gt;.  This should be the first of the publicKeys listed. Iterate through the &lt;code&gt;DIDDelegateChanged&lt;&#x2F;code&gt; events to build a list of additional keys and authentication sections as needed. The list of delegateTypes to include is still to be determined. Iterate through &lt;code&gt;DIDAttributeChanged&lt;&#x2F;code&gt; events for service entries, encryption public keys and other public names. The attribute names are still to be determined.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;For on-chain interactions Ethereum has a built in account abstraction that can be used regardless of whether the account is a smart contract or a key pair. Any transaction has a &lt;code&gt;msg.sender&lt;&#x2F;code&gt; as the verified send of the transaction.&lt;&#x2F;p&gt;
&lt;p&gt;Since each Ethereum transaction has to be funded, there is a growing trend of on-chain transactions that are authenticated via an externally created signature and not by the actual transaction originator. This allows 3rd party funding services or receiver pays without any fundamental changes to the underlying Ethereum architecture. These kinds of transactions have to be signed by an actual key pair and thus can not be used to represent smart contract based Ethereum accounts.&lt;&#x2F;p&gt;
&lt;p&gt;We propose a way of a Smart Contract or regular key pair delegating signing for various purposes to externally managed key pairs. This allows a smart contract to be represented both on-chain as well as off-chain or in payment channels through temporary or permanent delegates.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;All ethereum accounts are valid identities (and DID compatible) using this standard. This means that any wallet provider that uses key pair accounts already supports the bare minimum of this standard, and can implement &lt;code&gt;delegate&lt;&#x2F;code&gt; and &lt;code&gt;attribute&lt;&#x2F;code&gt; functionality by simply using the &lt;code&gt;ethr-did&lt;&#x2F;code&gt; referenced below. As the &lt;strong&gt;DID Auth&lt;&#x2F;strong&gt; standard solidifies it also means that all of these wallets will be compatible with the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;decentralized-identity&quot;&gt;DID decentralized login system&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;uport-project&#x2F;ethr-did-registry&#x2F;blob&#x2F;develop&#x2F;contracts&#x2F;EthereumDIDRegistry.sol&quot;&gt;ethr-did-registry&lt;&#x2F;a&gt; (&lt;code&gt;EthereumDIDRegistry&lt;&#x2F;code&gt; contract implementation)&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;uport-project&#x2F;ethr-did-resolver&quot;&gt;ethr-did-resolver&lt;&#x2F;a&gt; (DID compatible resolver)&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;uport-project&#x2F;ethr-did&quot;&gt;ethr-did&lt;&#x2F;a&gt; (javascript library for using the identity)&lt;&#x2F;p&gt;
&lt;h3 id=&quot;deployment&quot;&gt;Deployment&lt;&#x2F;h3&gt;
&lt;p&gt;The address for the &lt;code&gt;EthereumDIDRegistry&lt;&#x2F;code&gt; is &lt;code&gt;0xdca7ef03e98e0dc2b855be647c39abe984fcf21b&lt;&#x2F;code&gt; on Mainnet, Ropsten, Rinkeby and Kovan.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Overflow checking for the EVM</title>
        <published>2018-05-02T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Nick Johnson</name><email>arachnid@notdot.net</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1051/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-arithmetic-overflow-detection-for-the-evm/261" />
        

        <id>https://wg-eips.ritovision.com/1051/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:1051"
            label="EIP-1051" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1051/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP adds overflow checking for EVM arithmetic operations, and two new opcodes that check and clear the overflow flags.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The correct functioning of many contracts today is dependent on detecting and preventing overflow of arithmetic operations. Since the EVM operates on mod 2^256 integers and provides no built-in overflow detection or prevention, this requires manual checks on every arithmetic operation.&lt;&#x2F;p&gt;
&lt;p&gt;In the interests of facilitating efficient and secure contracts, we propose new opcodes that permit efficient detection of overflows, which can be checked periodically rather than after each operation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Two new flags are added to the EVM state: overflow (&lt;code&gt;ovf&lt;&#x2F;code&gt;) and signed overflow (&lt;code&gt;sovf&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;ovf&lt;&#x2F;code&gt; flag is set in the following circumstances:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;When an &lt;code&gt;ADD&lt;&#x2F;code&gt; (&lt;code&gt;0x01&lt;&#x2F;code&gt;) opcode, with both inputs treated as unsigned integers, produces an ideal output in excess of 2^256 - 1.&lt;&#x2F;li&gt;
&lt;li&gt;When a &lt;code&gt;SUB&lt;&#x2F;code&gt; (&lt;code&gt;0x03&lt;&#x2F;code&gt;) opcode, with both inputs treated as unsigned integers, produces an ideal output less than 0.&lt;&#x2F;li&gt;
&lt;li&gt;When a &lt;code&gt;MUL&lt;&#x2F;code&gt; (&lt;code&gt;0x02&lt;&#x2F;code&gt;) opcode, with both inputs treated as unsigned integers, produces an ideal output in excess of 2^256 - 1.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;code&gt;sovf&lt;&#x2F;code&gt; flag is set whenever the &lt;code&gt;ovf&lt;&#x2F;code&gt; flag is set, and additionally in the following circumstances:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;When an &lt;code&gt;ADD&lt;&#x2F;code&gt; opcode with both inputs having the same MSB results in the output having a different MSB (eg, &lt;code&gt;(+a) + (+b) = (-c)&lt;&#x2F;code&gt; or &lt;code&gt;(-a) + (-b) = (+c)&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;When a &lt;code&gt;SUB&lt;&#x2F;code&gt; opcode occurs and the result has the same MSB as the subtracted (second argument) (eg, &lt;code&gt;(+a) - (-b) = (-c)&lt;&#x2F;code&gt; or &lt;code&gt;(-a) - (+b) = (+c)&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;When a &lt;code&gt;MUL&lt;&#x2F;code&gt; opcode with both inputs being positive has a negative output.&lt;&#x2F;li&gt;
&lt;li&gt;When a &lt;code&gt;MUL&lt;&#x2F;code&gt; opcode with both inputs being negative has a negative output.&lt;&#x2F;li&gt;
&lt;li&gt;When a &lt;code&gt;MUL&lt;&#x2F;code&gt; opcode with one negative input and one positive input has a positive output.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;A new opcode, &lt;code&gt;OFV&lt;&#x2F;code&gt; is added, with number &lt;code&gt;0x0c&lt;&#x2F;code&gt;. This opcode takes 0 arguments from the stack. When executed, it pushes &lt;code&gt;1&lt;&#x2F;code&gt; if the &lt;code&gt;ovf&lt;&#x2F;code&gt; flag is set, and &lt;code&gt;0&lt;&#x2F;code&gt; otherwise. It then sets the &lt;code&gt;ovf&lt;&#x2F;code&gt; flag to false.&lt;&#x2F;p&gt;
&lt;p&gt;A new opcode, &lt;code&gt;SOVF&lt;&#x2F;code&gt; is added, with number &lt;code&gt;0x0d&lt;&#x2F;code&gt;. This opcode takes 0 arguments from the stack. When executed, it pushes &lt;code&gt;1&lt;&#x2F;code&gt; if the &lt;code&gt;sovf&lt;&#x2F;code&gt; flag is set, and &lt;code&gt;0&lt;&#x2F;code&gt; otherwise. It then sets the &lt;code&gt;sovf&lt;&#x2F;code&gt; flag to false.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Any change to implement overflow protection needs to preserve behaviour of existing contracts, which precludes many changes to the arithmetic operations themselves. One option would be to provide an opcode that enables overflow protection, causing a throw or revert if an overflow happens. However, this limits the manner in which overflows can be handled.&lt;&#x2F;p&gt;
&lt;p&gt;Instead, we replicate functionality from real world CPUs, which typically implement &#x27;carry&#x27; and &#x27;overflow&#x27; flags.&lt;&#x2F;p&gt;
&lt;p&gt;Separate flags for signed and unsigned overflow are necessary due to the fact that a signed overflow may not result in an unsigned overflow.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces no backwards compatibility issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EXTCODEHASH opcode</title>
        <published>2018-05-02T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Nick Johnson</name><email>arachnid@notdot.net</email>
	</author>
	
	<author>
		<name>Paweł Bylica</name><email>pawel@ethereum.org</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1052/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/extcodehash-opcode/262" />
        

        <id>https://wg-eips.ritovision.com/1052/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1052"
            label="EIP-1052" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1052/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP specifies a new opcode, which returns the keccak256 hash of a contract&#x27;s code.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Many contracts need to perform checks on a contract&#x27;s bytecode, but do not necessarily need the bytecode itself. For instance, a contract may want to check if another contract&#x27;s bytecode is one of a set of permitted implementations, or it may perform analyses on code and whitelist any contract with matching bytecode if the analysis passes.&lt;&#x2F;p&gt;
&lt;p&gt;Contracts can presently do this using the &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt; (&lt;code&gt;0x3c&lt;&#x2F;code&gt;) opcode, but this is expensive, especially for large contracts, in cases where only the hash is required. As a result, we propose a new opcode, &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt;, which returns the keccak256 hash of a contract&#x27;s bytecode.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;A new opcode, &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt;, is introduced, with number &lt;code&gt;0x3f&lt;&#x2F;code&gt;. The &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt;
takes one argument from the stack, zeros the first 96 bits
and pushes to the stack the keccak256 hash of the code of the account
at the address being the remaining 160 bits.&lt;&#x2F;p&gt;
&lt;p&gt;In case the account does not exist or is empty (as defined by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;161&#x2F;&quot;&gt;EIP-161&lt;&#x2F;a&gt;) &lt;code&gt;0&lt;&#x2F;code&gt; is pushed to the stack.&lt;&#x2F;p&gt;
&lt;p&gt;In case the account does not have code the keccak256 hash of empty data
(i.e. &lt;code&gt;c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470&lt;&#x2F;code&gt;)
is pushed to the stack.&lt;&#x2F;p&gt;
&lt;p&gt;The gas cost of the &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; is 400.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;As described in the motivation section, this opcode is widely useful, and saves
on wasted gas in many cases.&lt;&#x2F;p&gt;
&lt;p&gt;The gas cost is the same as the gas cost for the &lt;code&gt;BALANCE&lt;&#x2F;code&gt; opcode because the
execution of the &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; requires the same account lookup as in &lt;code&gt;BALANCE&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Only the 20 last bytes of the argument are significant (the first 12 bytes are
ignored) similarly to the semantics of the &lt;code&gt;BALANCE&lt;&#x2F;code&gt; (&lt;code&gt;0x31&lt;&#x2F;code&gt;), &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; (&lt;code&gt;0x3b&lt;&#x2F;code&gt;) and
&lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt; (&lt;code&gt;0x3c&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; distinguishes accounts without code and non-existing accounts.
This is consistent with the way accounts are represented in the state trie.
This also allows smart contracts to check whether an account exists.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;There are no backwards compatibility concerns.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;The &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; of the account without code is &lt;code&gt;c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470&lt;&#x2F;code&gt;
what is the keccak256 hash of empty data.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; of non-existent account is &lt;code&gt;0&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; of a precompiled contract is either &lt;code&gt;c5d246...&lt;&#x2F;code&gt; or &lt;code&gt;0&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; of &lt;code&gt;A&lt;&#x2F;code&gt; is &lt;code&gt;X&lt;&#x2F;code&gt;, then &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; of &lt;code&gt;A + 2**160&lt;&#x2F;code&gt; is &lt;code&gt;X&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; of an account that selfdestructed in the current transaction.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; of an account that selfdestructed and later the selfdestruct has been reverted.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; of an account created in the current transaction.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; of an account that has been newly created and later the creation has been reverted.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; of an account that firstly does not exist and later is empty.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; of an empty account that is going to be cleared by the state clearing rule.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>ProgPoW, a Programmatic Proof-of-Work</title>
        <published>2018-05-02T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Greg Colvin</name><email>greg@colvin.org</email>
	</author>
	
	<author>
		<name>Andrea Lanfranchi</name><uri>https://github.com/AndreaLanfranchi</uri>
	</author>
	
	<author>
		<name>Michael Carter</name><uri>https://github.com/bitsbetrippin</uri>
	</author>
	
	<author>
		<name>IfDefElse</name><email>ifdefelse@protonmail.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1057/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-progpow-a-programmatic-proof-of-work/272" />
        

        <id>https://wg-eips.ritovision.com/1057/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1057"
            label="EIP-1057" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1057/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;A new Proof-of-Work algorithm to replace Ethash that utilizes almost all parts of commodity GPUs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;ProgPoW is a proof-of-work algorithm designed to close the efficiency gap available to specialized ASICs. It utilizes almost all parts of commodity hardware (GPUs), and comes pre-tuned for the most common hardware utilized in the Ethereum network.&lt;&#x2F;p&gt;
&lt;p&gt;This document presents an overview of the algorithm and examines what it means to be “ASIC-resistant.” Next, we compare existing PoW designs by analyzing how each algorithm executes in hardware. Finally, we present the detailed implementation by walking through the code.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Ever since the first bitcoin mining ASIC was released, many new Proof of Work algorithms have been created with the intention of being “ASIC-resistant”. The goal of “ASIC-resistance” is to resist the centralization of PoW mining power such that these coins couldn’t be so easily manipulated by a few players.&lt;&#x2F;p&gt;
&lt;p&gt;Ethereum&#x27;s approach is to incentivize a geographically-distributed community of miners with a low barrier to entry on commodity hardware.  As stated in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum.github.io&#x2F;yellowpaper&#x2F;paper.pdf&quot;&gt;Yellow Paper&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;11.5. Mining Proof-of-Work. The mining proof-ofwork (PoW) exists as a cryptographically secure nonce that proves beyond reasonable doubt that a particular amount of computation has been expended in the determination of some token value n. It is utilised to enforce the blockchain security by giving meaning and credence to the notion of difficulty (and, by extension, total difficulty). However, since mining new blocks comes with an attached reward, the proof-of-work not only functions as a method of securing confidence that the blockchain will remain canonical into the future, but also as a wealth distribution mechanism.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;For both reasons, there are two important goals of the proof-of-work function; firstly, it should be as accessible as possible to as many people as possible. The requirement of, or reward from, specialised and uncommon hardware should be minimised. This makes the distribution model as open as possible, and, ideally, makes the act of mining a simple swap from electricity to Ether at roughly the same rate for anyone around the world.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;Secondly, it should not be possible to make super-linear profits, and especially not so with a high initial barrier. Such a mechanism allows a well-funded adversary to gain a troublesome amount of the network’s total mining power and as such gives them a super-linear reward (thus skewing distribution in their favour) as well as reducing the network security...&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;... While ASICs exist for a proof-of-work function, both goals are placed in jeopardy.  Because of this, a proof-of-work function that is ASIC-resistant (i.e. difficult or economically inefficient to implement in specialised compute hardware) has been identified as the proverbial silver bullet.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;It is from these premises that Ethash was designed as an ASIC-resistant proof-of-work:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Two directions exist for ASIC resistance; firstly make it sequential memory-hard, i.e. engineer the function such that the determination of the nonce requires a lot of memory and bandwidth such that the memory cannot be used in parallel to discover multiple nonces simultaneously. The second is to make the type of computation it would need to do general-purpose; the meaning of “specialised hardware” for a general-purpose task set is, naturally, general purpose hardware and as such commodity desktop computers are likely to be pretty close to “specialised hardware” for the task. For Ethereum 1.0 we have chosen the first path.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;5 years of experience with the Ethereum blockchain have demonstrated the success of our approach.  This success cannot be taken for granted.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;11 years of experience with PoW Blockchains have shown a centralization in hardware development, resulting in a &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.asicminervalue.com&#x2F;&quot;&gt;few companies&lt;&#x2F;a&gt; controlling the lifecycle of new hardware with limited distribution.&lt;&#x2F;li&gt;
&lt;li&gt;New ASICs for Ethash are providing higher efficiency than GPUs, such as the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;shop.bitmain.com&#x2F;product&#x2F;detail?pid=00020181031134626816gh0zYNKC06A3&quot;&gt;Antminer E3&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;As much as 40% of the Ethereum network may now be secured by ASICs.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;ProgPow restores Ethash&#x27; ASIC-resistance by extending Ethash with a GPU-specific approach to the second path — making the “specialised hardware” for the PoW task commodity hardware.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;progpow-overview&quot;&gt;ProgPoW Overview&lt;&#x2F;h3&gt;
&lt;p&gt;The design goal of ProgPoW is to have the algorithm’s requirements match what is available on commodity GPUs:  If the algorithm were to be implemented on a custom ASIC there should be little opportunity for efficiency gains compared to a commodity GPU.&lt;&#x2F;p&gt;
&lt;p&gt;The main elements of the algorithm are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Changes keccak_f1600 (with 64-bit words) to keccak_f800 (with 32-bit words) to reduce impact on total power&lt;&#x2F;li&gt;
&lt;li&gt;Increases mix state.&lt;&#x2F;li&gt;
&lt;li&gt;Adds a random sequence of math in the main loop.&lt;&#x2F;li&gt;
&lt;li&gt;Adds reads from a small, low-latency cache that supports random addresses.&lt;&#x2F;li&gt;
&lt;li&gt;Increases the DRAM read from 128 bytes to 256 bytes.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The random sequence changes every &lt;code&gt;PROGPOW_PERIOD&lt;&#x2F;code&gt; (about 2 to 12 minutes depending on the configured value).  When mining source code is generated for the random sequence and compiled on the host CPU.  The GPU will execute the compiled code where what math to perform and what mix state to use are already resolved.&lt;&#x2F;p&gt;
&lt;p&gt;While a custom ASIC to implement this algorithm is still possible, the efficiency gains available are minimal.  The majority of a commodity GPU is required to support the above elements. The only optimizations available are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Remove the graphics pipeline (displays, geometry engines, texturing, etc)&lt;&#x2F;li&gt;
&lt;li&gt;Remove floating point math&lt;&#x2F;li&gt;
&lt;li&gt;A few ISA tweaks, like instructions that exactly match the merge() function&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;These would result in minimal, roughly 1.1-1.2x, efficiency gains.  This is much less than the 2x for Ethash or 50x for Cryptonight.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;rationale-for-pow-on-commodity-hardware&quot;&gt;Rationale for PoW on Commodity Hardware&lt;&#x2F;h3&gt;
&lt;p&gt;With the growth of large mining pools, the control of hashing power has been delegated to the top few pools to provide a steadier economic return for small miners. While some have made the argument that large centralized pools defeats the purpose of “ASIC resistance,” it’s important to note that ASIC based coins are even more centralized for several reasons.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;No natural distribution: There isn’t an economic purpose for ultra-specialized hardware outside of mining and thus no reason for most people to have it.&lt;&#x2F;li&gt;
&lt;li&gt;No reserve group: Thus, there’s no reserve pool of hardware or reserve pool of interested parties to jump in when coin price is volatile and attractive for manipulation.&lt;&#x2F;li&gt;
&lt;li&gt;High barrier to entry: Initial miners are those rich enough to invest capital and ecological resources on the unknown experiment a new coin may be. Thus, initial coin distribution through mining will be very limited causing centralized economic bias.&lt;&#x2F;li&gt;
&lt;li&gt;Delegated centralization vs implementation centralization: While pool centralization is delegated, hardware monoculture is not: only the limited buyers of this hardware can participate so there isn’t even the possibility of divesting control on short notice.&lt;&#x2F;li&gt;
&lt;li&gt;No obvious decentralization of control even with decentralized mining: Once large custom ASIC makers get into the game, designing back-doored hardware is trivial. ASIC makers have no incentive to be transparent or fair in market participation.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;While the goal of “ASIC resistance” is valuable, the entire concept of “ASIC resistance” is a bit of a fallacy.  CPUs and GPUs are themselves ASICs.  Any algorithm that can run on a commodity ASIC (a CPU or GPU) by definition can have a customized ASIC created for it with slightly less functionality. Some algorithms are intentionally made to be  “ASIC friendly” - where an ASIC implementation is drastically more efficient than the same algorithm running on general purpose hardware. The protection that this offers when the coin is unknown also makes it an attractive target for a dedicated mining ASIC company as soon as it becomes useful.&lt;&#x2F;p&gt;
&lt;p&gt;Therefore, ASIC resistance is: the efficiency difference of specialized hardware versus hardware that has a wider adoption and applicability.  A smaller efficiency difference between custom vs general hardware mean higher resistance and a better algorithm. This efficiency difference is the proper metric to use when comparing the quality of PoW algorithms.  Efficiency could mean absolute performance, performance per watt, or performance per dollar - they are all highly correlated.  If a single entity creates and controls an ASIC that is drastically more efficient, they can gain 51% of the network hashrate and possibly stage an attack.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;review-of-existing-pow-algorithms&quot;&gt;Review of Existing PoW Algorithms&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;sha256&quot;&gt;SHA256&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Potential ASIC efficiency gain ~ 1000X&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The SHA algorithm is a sequence of simple math operations - additions, logical ops, and rotates.&lt;&#x2F;p&gt;
&lt;p&gt;To process a single op on a CPU or GPU requires fetching and decoding an instruction, reading data from a register file, executing the instruction, and then writing the result back to a register file.  This takes significant time and power.&lt;&#x2F;p&gt;
&lt;p&gt;A single op implemented in an ASIC takes a handful of transistors and wires.  This means every individual op takes negligible power, area, or time.  A hashing core is built by laying out the sequence of required ops.&lt;&#x2F;p&gt;
&lt;p&gt;The hashing core can execute the required sequence of ops in much less time, and using less power or area, than doing the same sequence on a CPU or GPU.  A bitcoin ASIC consists of a number of identical hashing cores and some minimal off-chip communication.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;scrypt-and-neoscrypt&quot;&gt;Scrypt and NeoScrypt&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Potential ASIC efficiency gain ~ 1000X&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Scrypt and NeoScrypt are similar to SHA in the arithmetic and bitwise operations used. Unfortunately, popular coins such as Litecoin only use a scratchpad size between 32kb and 128kb for their PoW mining algorithm. This scratch pad is small enough to trivially fit on an ASIC next to the math core. The implementation of the math core would be very similar to SHA, with similar efficiency gains.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;x11-and-x16r&quot;&gt;X11 and X16R&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Potential ASIC efficiency gain ~ 1000X&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;X11 (and similar X##) require an ASIC that has 11 unique hashing cores pipelined in a fixed sequence.  Each individual hashing core would have similar efficiency to an individual SHA core, so the overall design will have the same efficiency gains.&lt;&#x2F;p&gt;
&lt;p&gt;X16R requires the multiple hashing cores to interact through a simple sequencing state machine. Each individual core will have similar efficiency gains and the sequencing logic will take minimal power, area, or time.&lt;&#x2F;p&gt;
&lt;p&gt;The Baikal BK-X is an existing ASIC with multiple hashing cores and a programmable sequencer.  It has been upgraded to enable new algorithms that sequence the hashes in different orders.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;equihash&quot;&gt;Equihash&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Potential ASIC efficiency gain ~ 100X&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The ~150mb of state is large but possible on an ASIC. The binning, sorting, and comparing of bit strings could be implemented on an ASIC at extremely high speed.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;cuckoo-cycle&quot;&gt;Cuckoo Cycle&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Potential ASIC efficiency gain ~ 100X&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The amount of state required on-chip is not clear as there are Time&#x2F;Memory Tradeoff attacks. A specialized graph traversal core would have similar efficiency gains to a SHA compute core.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;cryptonight&quot;&gt;CryptoNight&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Potential ASIC efficiency gain ~ 50X&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Compared to Scrypt, CryptoNight does much less compute and requires a full 2mb of scratch pad (there is no known Time&#x2F;Memory Tradeoff attack).  The large scratch pad will dominate the ASIC implementation and limit the number of hashing cores, limiting the absolute performance of the ASIC.  An ASIC will consist almost entirely of just on-die SRAM.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;ethash&quot;&gt;Ethash&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Potential ASIC efficiency gain ~ 2X&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Ethash requires external memory due to the large size of the DAG.  However that is all that it requires - there is minimal compute that is done on the result loaded from memory.  As a result a custom ASIC could remove most of the complexity, and power, of a GPU and be just a memory interface connected to a small compute engine.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;ProgPoW can be tuned using the following parameters.  The proposed settings have been tuned for a range of existing, commodity GPUs:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;PROGPOW_PERIOD&lt;&#x2F;code&gt;: Number of blocks before changing the random program&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;PROGPOW_LANES&lt;&#x2F;code&gt;: The number of parallel lanes that coordinate to calculate a single hash instance&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;PROGPOW_REGS&lt;&#x2F;code&gt;: The register file usage size&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;PROGPOW_DAG_LOADS&lt;&#x2F;code&gt;: Number of uint32 loads from the DAG per lane&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;PROGPOW_CACHE_BYTES&lt;&#x2F;code&gt;: The size of the cache&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;PROGPOW_CNT_DAG&lt;&#x2F;code&gt;: The number of DAG accesses, defined as the outer loop of the algorithm (64 is the same as Ethash)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;PROGPOW_CNT_CACHE&lt;&#x2F;code&gt;: The number of cache accesses per loop&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;PROGPOW_CNT_MATH&lt;&#x2F;code&gt;: The number of math operations per loop&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The values of these parameters have been tweaked between the original version and the version proposed here for Ethereum adoption.  See &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;medium.com&#x2F;@ifdefelse&#x2F;progpow-progress-da5bb31a651b&quot;&gt;this medium post&lt;&#x2F;a&gt; for details.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;0.9.2&lt;&#x2F;th&gt;&lt;th&gt;0.9.3&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;PROGPOW_PERIOD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;50&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;10&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;PROGPOW_LANES&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;16&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;16&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;PROGPOW_REGS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;32&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;32&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;PROGPOW_DAG_LOADS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;4&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;4&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;PROGPOW_CACHE_BYTES&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;16x1024&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;16x1024&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;PROGPOW_CNT_DAG&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;64&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;64&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;PROGPOW_CNT_CACHE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;12&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;11&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;PROGPOW_CNT_MATH&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;20&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;18&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;DAG Parameter&lt;&#x2F;th&gt;&lt;th&gt;0.9.2&lt;&#x2F;th&gt;&lt;th&gt;0.9.3&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ETHASH_DATASET_PARENTS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;256&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;256&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The random program changes every &lt;code&gt;PROGPOW_PERIOD&lt;&#x2F;code&gt; blocks (default &lt;code&gt;10&lt;&#x2F;code&gt;, roughly 2 minutes) to ensure the hardware executing the algorithm is fully programmable.  If the program only changed every DAG epoch (roughly 5 days) certain miners could have time to develop hand-optimized versions of the random sequence, giving them an undue advantage.&lt;&#x2F;p&gt;
&lt;p&gt;Sample code is written in C++, this should be kept in mind when evaluating the code in the specification.
All numerics are computed using unsigned 32 bit integers.  Any overflows are trimmed off before proceeding to the next computation.  Languages that use numerics not fixed to bit lengths (such as Python and JavaScript) or that only use signed integers (such as Java) will need to keep their languages&#x27; quirks in mind.  The extensive use of 32 bit data values aligns with modern GPUs internal data architectures.&lt;&#x2F;p&gt;
&lt;p&gt;ProgPoW uses a 32-bit variant of &lt;strong&gt;FNV1a&lt;&#x2F;strong&gt; for merging data. The existing Ethash uses a similar variant of FNV1 for merging, but FNV1a provides better distribution properties.&lt;&#x2F;p&gt;
&lt;p&gt;Test vectors can be found &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1057&#x2F;assets&#x2F;test-vectors&#x2F;#fnv1a&quot;&gt;in the test vectors file&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;cpp&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; uint32_t&lt;&#x2F;span&gt;&lt;span&gt; FNV_PRIME &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1000193&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; uint32_t&lt;&#x2F;span&gt;&lt;span&gt; FNV_OFFSET_BASIS &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;811c9dc5&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;uint32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fnv1a&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;uint32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; h&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; uint32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; d&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;h &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;^&lt;&#x2F;span&gt;&lt;span&gt; d&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; FNV_PRIME&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;ProgPow uses &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;KISS_(algorithm)&quot;&gt;KISS99&lt;&#x2F;a&gt; for random number generation. This is the simplest (fewest instruction) random generator that passes the TestU01 statistical test suite.  A more complex random number generator like Mersenne Twister can be efficiently implemented on a specialized ASIC, providing an opportunity for efficiency gains.&lt;&#x2F;p&gt;
&lt;p&gt;Test vectors can be found &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1057&#x2F;assets&#x2F;test-vectors&#x2F;#kiss99&quot;&gt;in the test vectors file&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;cpp&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;typedef&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; struct&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    uint32_t&lt;&#x2F;span&gt;&lt;span&gt; z&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; w&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; jsr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; jcong&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; kiss99_t&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; KISS99 is simple, fast, and passes the TestU01 suite&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;KISS_(algorithm)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; http:&#x2F;&#x2F;www.cse.yorku.ca&#x2F;~oz&#x2F;marsaglia-rng.html&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;uint32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; kiss99&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;kiss99_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; &amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;st&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    st&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;z&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 36969&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;st&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;z&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 65535&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;st&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;z&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 16&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    st&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;w&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 18000&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;st&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;w&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 65535&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;st&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;w&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 16&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    uint32_t&lt;&#x2F;span&gt;&lt;span&gt; MWC &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;st&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;z&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 16&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; st&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;w&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    st&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;jsr&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ^=&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;st&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;jsr&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 17&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    st&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;jsr&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ^=&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;st&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;jsr&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 13&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    st&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;jsr&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ^=&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;st&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;jsr&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 5&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    st&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;jcong&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 69069&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; st&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;jcong&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1234567&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;MWC&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;^&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;st&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;jcong&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; st&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;jsr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;fill_mix&lt;&#x2F;code&gt; function populates an array of &lt;code&gt;int32&lt;&#x2F;code&gt; values used by each lane in the hash calculations.&lt;&#x2F;p&gt;
&lt;p&gt;Test vectors can be found &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1057&#x2F;assets&#x2F;test-vectors&#x2F;#fill-mix&quot;&gt;in the test vectors file&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;cpp&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;void&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fill_mix&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    uint64_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; seed&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    uint32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; lane_id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    uint32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; mix&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;PROGPOW_REGS&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Use FNV to expand the per-warp seed to per-lane&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Use KISS to expand the per-lane seed to fill mix&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    uint32_t&lt;&#x2F;span&gt;&lt;span&gt; fnv_hash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; FNV_OFFSET_BASIS&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    kiss99_t&lt;&#x2F;span&gt;&lt;span&gt; st&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    st&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;z&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fnv1a&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;fnv_hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; seed&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    st&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;w&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fnv1a&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;fnv_hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; seed &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    st&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;jsr&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fnv1a&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;fnv_hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; lane_id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    st&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;jcong&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fnv1a&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;fnv_hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; lane_id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; PROGPOW_REGS&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        mix&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; kiss99&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;st&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Like Ethash Keccak is used to seed the sequence per-nonce and to produce the final result.  The keccak-f800 variant is used as the 32-bit word size matches the native word size of modern GPUs.  The implementation is a variant of SHAKE with width=800, bitrate=576, capacity=224, output=256, and no padding.  The result of keccak is treated as a 256-bit big-endian number - that is result byte 0 is the MSB of the value.&lt;&#x2F;p&gt;
&lt;p&gt;As with Ethash the input and output of the keccak function are fixed and relatively small.  This means only a single &quot;absorb&quot; and &quot;squeeze&quot; phase are required.  For a pseudo-code implementation of the &lt;code&gt;keccak_f800_round&lt;&#x2F;code&gt; function see the &lt;code&gt;Round[b](A,RC)&lt;&#x2F;code&gt; function in the &quot;Pseudo-code description of the permutations&quot; section of the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;keccak.team&#x2F;keccak_specs_summary.html&quot;&gt;official Keccak specs&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;cpp&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;hash32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; keccak_f800_progpow&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;uint32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; keccak_f800 call for the single absorb pass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt; r &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; r &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 22&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        keccak_f800_round&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;st&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; r&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Squeeze phase for fixed 8 words of output&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    hash32_t&lt;&#x2F;span&gt;&lt;span&gt; ret&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;8&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        ret&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;uint32s&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; st&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; ret&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The inner loop uses FNV and KISS99 to generate a random sequence from the &lt;code&gt;prog_seed&lt;&#x2F;code&gt;.  This random sequence determines which mix state is accessed and what random math is performed.&lt;&#x2F;p&gt;
&lt;p&gt;Since the &lt;code&gt;prog_seed&lt;&#x2F;code&gt; changes only once per &lt;code&gt;PROGPOW_PERIOD&lt;&#x2F;code&gt; (10 blocks or about 2 minutes) it is expected that while mining &lt;code&gt;progPowLoop&lt;&#x2F;code&gt; will be evaluated on the CPU to generate source code for that period&#x27;s sequence.  The source code will be compiled on the CPU before running on the GPU.  You can see an example sequence and generated source code in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ifdefelse&#x2F;ProgPOW&#x2F;blob&#x2F;824cd791634204c4cc7e31f84bb76c0c84895bd3&#x2F;test&#x2F;kernel.cu&quot;&gt;kernel.cu&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Test vectors can be found &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1057&#x2F;assets&#x2F;test-vectors&#x2F;#progpowinit&quot;&gt;in the test vectors file&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;cpp&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;kiss99_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; progPowInit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;uint64_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; prog_seed&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; mix_seq_dst&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;PROGPOW_REGS&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; mix_seq_src&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;PROGPOW_REGS&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    kiss99_t&lt;&#x2F;span&gt;&lt;span&gt; prog_rnd&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    prog_rnd&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;z&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fnv1a&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;FNV_OFFSET_BASIS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; prog_seed&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    prog_rnd&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;w&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fnv1a&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;prog_rnd&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;z&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; prog_seed &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    prog_rnd&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;jsr&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fnv1a&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;prog_rnd&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;w&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; prog_seed&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    prog_rnd&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;jcong&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fnv1a&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;prog_rnd&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;jsr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; prog_seed &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Create a random sequence of mix destinations for merge() and mix sources for cache reads&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; guarantees every destination merged once&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; guarantees no duplicate cache reads, which could be optimized away&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Uses Fisher-Yates shuffle&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; PROGPOW_REGS&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        mix_seq_dst&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        mix_seq_src&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; PROGPOW_REGS &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;--&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        int&lt;&#x2F;span&gt;&lt;span&gt; j&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        j &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; kiss99&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;prog_rnd&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        swap&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;mix_seq_dst&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; mix_seq_dst&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;j&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        j &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; kiss99&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;prog_rnd&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        swap&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;mix_seq_src&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; mix_seq_src&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;j&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; prog_rnd&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The math operations that merges values into the mix data are ones chosen to maintain entropy.&lt;&#x2F;p&gt;
&lt;p&gt;Test vectors can be found &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1057&#x2F;assets&#x2F;test-vectors&#x2F;#math&quot;&gt;in the test vectors file&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;cpp&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Merge new data from b into the value in a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Assuming A has high entropy only do ops that retain entropy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; even if B is low entropy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; (IE don&amp;#39;t do A&amp;amp;B)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;uint32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; merge&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;uint32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; a&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; uint32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; b&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; uint32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; r&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    switch&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;r &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    case&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;a &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 33&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; b&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    case&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;a &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;^&lt;&#x2F;span&gt;&lt;span&gt; b&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 33&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; prevent rotate by 0 which is a NOP&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    case&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ROTL32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;a&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;r &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 16&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 31&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ^&lt;&#x2F;span&gt;&lt;span&gt; b&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    case&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ROTR32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;a&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;r &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 16&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 31&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ^&lt;&#x2F;span&gt;&lt;span&gt; b&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The math operations chosen for the random math are ones that are easy to implement in CUDA and OpenCL, the two main programming languages for commodity GPUs. The &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.khronos.org&#x2F;registry&#x2F;OpenCL&#x2F;sdk&#x2F;1.1&#x2F;docs&#x2F;man&#x2F;xhtml&#x2F;mul_hi.html&quot;&gt;mul_hi&lt;&#x2F;a&gt;, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.khronos.org&#x2F;registry&#x2F;OpenCL&#x2F;sdk&#x2F;2.0&#x2F;docs&#x2F;man&#x2F;xhtml&#x2F;integerMax.html&quot;&gt;min&lt;&#x2F;a&gt;, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.khronos.org&#x2F;registry&#x2F;OpenCL&#x2F;sdk&#x2F;1.1&#x2F;docs&#x2F;man&#x2F;xhtml&#x2F;clz.html&quot;&gt;clz&lt;&#x2F;a&gt;, and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.khronos.org&#x2F;registry&#x2F;OpenCL&#x2F;sdk&#x2F;2.0&#x2F;docs&#x2F;man&#x2F;xhtml&#x2F;popcount.html&quot;&gt;popcount&lt;&#x2F;a&gt; functions match the corresponding OpenCL functions.  ROTL32 matches the OpenCL &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.khronos.org&#x2F;registry&#x2F;OpenCL&#x2F;sdk&#x2F;1.0&#x2F;docs&#x2F;man&#x2F;xhtml&#x2F;rotate.html&quot;&gt;rotate&lt;&#x2F;a&gt; function.  ROTR32 is rotate right, which is equivalent to &lt;code&gt;rotate(i, 32-v)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Test vectors can be found &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1057&#x2F;assets&#x2F;test-vectors&#x2F;#math&quot;&gt;in the test vectors file&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;cpp&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Random math between two input values&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;uint32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; math&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;uint32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; a&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; uint32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; b&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; uint32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; r&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    switch&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;r &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 11&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    case&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span&gt; a &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt; b&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    case&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span&gt; a &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; b&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    case&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mul_hi&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;a&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; b&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    case&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;a&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; b&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    case&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ROTL32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;a&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; b&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    case&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 5&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ROTR32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;a&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; b&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    case&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 6&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span&gt; a &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; b&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    case&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 7&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span&gt; a &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;span&gt; b&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    case&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span&gt; a &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;^&lt;&#x2F;span&gt;&lt;span&gt; b&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    case&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 9&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; clz&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;a&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; clz&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;b&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    case&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; popcount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;a&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; popcount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;b&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The flow of the inner loop is:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Lane &lt;code&gt;(loop % LANES)&lt;&#x2F;code&gt; is chosen as the leader for that loop iteration&lt;&#x2F;li&gt;
&lt;li&gt;The leader&#x27;s &lt;code&gt;mix[0]&lt;&#x2F;code&gt; value modulo the number of 256-byte DAG entries is used to select where to read from the full DAG&lt;&#x2F;li&gt;
&lt;li&gt;Each lane reads &lt;code&gt;DAG_LOADS&lt;&#x2F;code&gt; sequential words, using &lt;code&gt;(lane ^ loop) % LANES&lt;&#x2F;code&gt; as the starting offset within the entry.&lt;&#x2F;li&gt;
&lt;li&gt;The random sequence of math and cache accesses is performed&lt;&#x2F;li&gt;
&lt;li&gt;The DAG data read at the start of the loop is merged at the end of the loop&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;code&gt;prog_seed&lt;&#x2F;code&gt; and &lt;code&gt;loop&lt;&#x2F;code&gt; come from the outer loop, corresponding to the current program seed (which is block_number&#x2F;PROGPOW_PERIOD) and the loop iteration number.  &lt;code&gt;mix&lt;&#x2F;code&gt; is the state array, initially filled by &lt;code&gt;fill_mix&lt;&#x2F;code&gt;. &lt;code&gt;dag&lt;&#x2F;code&gt; is the bytes of the Ethash DAG grouped into 32 bit unsigned ints in little-endian format.  On little-endian architectures this is just a normal int32 pointer to the existing DAG.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;DAG_BYTES&lt;&#x2F;code&gt; is set to the number of bytes in the current DAG, which is generated identically to the existing Ethash algorithm.&lt;&#x2F;p&gt;
&lt;p&gt;Test vectors can be found &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1057&#x2F;assets&#x2F;test-vectors&#x2F;#progpowloop&quot;&gt;in the test vectors file&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;cpp&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;void&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; progPowLoop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; uint64_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; prog_seed&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; uint32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; loop&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    uint32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; mix&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;PROGPOW_LANES&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;PROGPOW_REGS&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; uint32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;dag&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; dag_entry holds the 256 bytes of data loaded from the DAG&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    uint32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; dag_entry&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;PROGPOW_LANES&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;PROGPOW_DAG_LOADS&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; On each loop iteration rotate which lane is the source of the DAG address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The source lane&amp;#39;s mix[0] value is used to ensure the last loop&amp;#39;s DAG data feeds into this loop&amp;#39;s address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; dag_addr_base is which 256-byte entry within the DAG will be accessed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    uint32_t&lt;&#x2F;span&gt;&lt;span&gt; dag_addr_base &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; mix&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;loop&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%&lt;&#x2F;span&gt;&lt;span&gt;PROGPOW_LANES&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span&gt;DAG_BYTES &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;PROGPOW_LANES&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt;PROGPOW_DAG_LOADS&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;sizeof&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;uint32_t&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt; l &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; l &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; PROGPOW_LANES&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Lanes access DAG_LOADS sequential words from the dag entry&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Shuffle which portion of the entry each lane accesses each iteration by XORing lane and loop.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This prevents multi-chip ASICs from each storing just a portion of the DAG&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        size_t&lt;&#x2F;span&gt;&lt;span&gt; dag_addr_lane &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; dag_addr_base &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; PROGPOW_LANES &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;l &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;^&lt;&#x2F;span&gt;&lt;span&gt; loop&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span&gt; PROGPOW_LANES&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; PROGPOW_DAG_LOADS&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;            dag_entry&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; dag&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;dag_addr_lane &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; PROGPOW_DAG_LOADS &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Initialize the program seed and sequences&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; When mining these are evaluated on the CPU and compiled away&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    int&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; mix_seq_dst&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;PROGPOW_REGS&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    int&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; mix_seq_src&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;PROGPOW_REGS&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    int&lt;&#x2F;span&gt;&lt;span&gt; mix_seq_dst_cnt &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    int&lt;&#x2F;span&gt;&lt;span&gt; mix_seq_src_cnt &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    kiss99_t&lt;&#x2F;span&gt;&lt;span&gt; prog_rnd &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; progPowInit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;prog_seed&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; mix_seq_dst&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; mix_seq_src&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    int&lt;&#x2F;span&gt;&lt;span&gt; max_i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;PROGPOW_CNT_CACHE&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; PROGPOW_CNT_MATH&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; max_i&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; PROGPOW_CNT_CACHE&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Cached memory access&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; lanes access random 32-bit locations within the first portion of the DAG&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            int&lt;&#x2F;span&gt;&lt;span&gt; src &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; mix_seq_src&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;mix_seq_src_cnt&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%&lt;&#x2F;span&gt;&lt;span&gt;PROGPOW_REGS&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            int&lt;&#x2F;span&gt;&lt;span&gt; dst &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; mix_seq_dst&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;mix_seq_dst_cnt&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%&lt;&#x2F;span&gt;&lt;span&gt;PROGPOW_REGS&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            int&lt;&#x2F;span&gt;&lt;span&gt; sel &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; kiss99&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;prog_rnd&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt; l &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; l &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; PROGPOW_LANES&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;                uint32_t&lt;&#x2F;span&gt;&lt;span&gt; offset &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; mix&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;src&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;PROGPOW_CACHE_BYTES&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;sizeof&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;uint32_t&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;                mix&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;dst&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; merge&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;mix&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;dst&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; dag&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;offset&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; sel&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; PROGPOW_CNT_MATH&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Random Math&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Generate 2 unique sources&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            int&lt;&#x2F;span&gt;&lt;span&gt; src_rnd &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; kiss99&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;prog_rnd&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;PROGPOW_REGS &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;PROGPOW_REGS&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            int&lt;&#x2F;span&gt;&lt;span&gt; src1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; src_rnd &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%&lt;&#x2F;span&gt;&lt;span&gt; PROGPOW_REGS&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0 &amp;lt;= src1 &amp;lt; PROGPOW_REGS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            int&lt;&#x2F;span&gt;&lt;span&gt; src2 &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; src_rnd &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; PROGPOW_REGS&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0 &amp;lt;= src2 &amp;lt; PROGPOW_REGS - 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;src2 &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;=&lt;&#x2F;span&gt;&lt;span&gt; src1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ++&lt;&#x2F;span&gt;&lt;span&gt;src2&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; src2 is now any reg other than src1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            int&lt;&#x2F;span&gt;&lt;span&gt; sel1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; kiss99&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;prog_rnd&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            int&lt;&#x2F;span&gt;&lt;span&gt; dst  &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; mix_seq_dst&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;mix_seq_dst_cnt&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%&lt;&#x2F;span&gt;&lt;span&gt;PROGPOW_REGS&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            int&lt;&#x2F;span&gt;&lt;span&gt; sel2 &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; kiss99&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;prog_rnd&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt; l &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; l &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; PROGPOW_LANES&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;                uint32_t&lt;&#x2F;span&gt;&lt;span&gt; data &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; math&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;mix&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;src1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; mix&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;src2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; sel1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;                mix&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;dst&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; merge&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;mix&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;dst&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; sel2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Consume the global load data at the very end of the loop to allow full latency hiding&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Always merge into mix[0] to feed the offset calculation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; PROGPOW_DAG_LOADS&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        int&lt;&#x2F;span&gt;&lt;span&gt; dst &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ?&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; :&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; mix_seq_dst&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;mix_seq_dst_cnt&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%&lt;&#x2F;span&gt;&lt;span&gt;PROGPOW_REGS&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        int&lt;&#x2F;span&gt;&lt;span&gt; sel &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; kiss99&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;prog_rnd&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt; l &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; l &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; PROGPOW_LANES&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;            mix&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;dst&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; merge&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;mix&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;dst&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; dag_entry&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; sel&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The flow of the overall algorithm is:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A keccak hash of the header + nonce to create a digest of 256 bits from keccak_f800 (padding is consistent with custom one in ethash)&lt;&#x2F;li&gt;
&lt;li&gt;Use first two words of digest as seed to generate initial mix data&lt;&#x2F;li&gt;
&lt;li&gt;Loop multiple times, each time hashing random loads and random math into the mix data&lt;&#x2F;li&gt;
&lt;li&gt;Hash all the mix data into a single 256-bit value&lt;&#x2F;li&gt;
&lt;li&gt;A final keccak hash using carry-over digest from initial data + mix_data final 256 bit value (padding is consistent with custom one in ethash)&lt;&#x2F;li&gt;
&lt;li&gt;When mining this final value is compared against a &lt;code&gt;hash32_t&lt;&#x2F;code&gt; target&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;cpp&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;hash32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; progPowHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; uint64_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; prog_seed&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; value is (block_number&#x2F;PROGPOW_PERIOD)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; uint64_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; hash32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; header&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; uint32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;dag&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;          &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; gigabyte DAG located in framebuffer - the first portion gets cached&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    hash32_t&lt;&#x2F;span&gt;&lt;span&gt; hash_init&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    hash32_t&lt;&#x2F;span&gt;&lt;span&gt; hash_final&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    uint32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; mix&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;PROGPOW_LANES&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;PROGPOW_REGS&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        ========================================&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        Absorb phase for initial keccak pass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        ========================================&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        uint32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; state&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;25&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 1st fill with header data (8 words)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;            state&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;uint32s&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 2nd fill with nonce (2 words)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        state&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;8&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        state&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;9&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; nonce &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 3rd apply padding&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        state&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;00000001&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        state&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;18&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;80008081&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; keccak(header..nonce)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        hash_init &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; keccak_f800_progpow&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; get the seed to initialize mix&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        seed &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;uint64_t&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;hash_init&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;uint32s&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; hash_init&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;uint32s&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; initialize mix for all lanes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt; l &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; l &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; PROGPOW_LANES&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        fill_mix&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;seed&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; l&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; mix&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; execute the randomly generated inner loop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; PROGPOW_CNT_DAG&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        progPowLoop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;prog_seed&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; mix&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; dag&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Reduce mix data to a per-lane 32-bit digest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    uint32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; digest_lane&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;PROGPOW_LANES&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt; l &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; l &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; PROGPOW_LANES&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        digest_lane&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; FNV_OFFSET_BASIS&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; PROGPOW_REGS&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;            digest_lane&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fnv1a&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;digest_lane&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; mix&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Reduce all lanes to a single 256-bit digest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        digest&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;uint32s&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; FNV_OFFSET_BASIS&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt; l &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; l &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; PROGPOW_LANES&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        digest&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;uint32s&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;8&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fnv1a&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;digest&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;uint32s&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;8&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; digest_lane&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        ========================================&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        Absorb phase for final keccak pass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        ========================================&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        uint32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; state&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;25&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 1st fill with hash_init (8 words)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;            state&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; hash_init&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;uint32s&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 2nd fill with digest from main loop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 16&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;            state&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; digest&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;uint32s&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 3rd apply padding&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        state&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;17&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;00000001&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        state&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;24&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;80008081&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; keccak(header..nonce)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        hash_final &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; keccak_f800_progpow&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Compare hash final to target&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    [&lt;&#x2F;span&gt;&lt;span&gt;...&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal has been software and hardware audited:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;leastauthority.com&#x2F;static&#x2F;publications&#x2F;LeastAuthority-ProgPow-Algorithm-Final-Audit-Report.pdf&quot;&gt;Least Authority — ProgPoW Software Audit PDF&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum-cat-herders&#x2F;progpow-audit&#x2F;raw&#x2F;master&#x2F;Bob%20Rao%20-%20ProgPOW%20Hardware%20Audit%20Report%20Final.pdf&quot;&gt;Bob Rao - ProgPoW Hardware Audit PDF&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Least Authority in their findings suggest a change to DAG generation --  modification of &lt;code&gt;ETHASH_DATASET_PARENTS&lt;&#x2F;code&gt; from a value of 256 to the new value of 512 -- in order to mitigate vulnerability to a &quot;Light Evaluation&quot; attack. Due to this the DAG memory file used by ProgPoW is would no longer compatible with the one used by Ethash (epoch length and size increase ratio remain the same though).&lt;&#x2F;p&gt;
&lt;p&gt;We do not recommend implementing this fix at this time. Ethash will not be exploitable for years, and it&#x27;s not clear ProgPoW will ever be exploitable.  It&#x27;s better to deploy the audited code.&lt;&#x2F;p&gt;
&lt;p&gt;After the completion of the audits a clever finding by &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;kik&#x2F;&quot;&gt;Kik&lt;&#x2F;a&gt; disclosed a vulnerability to &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;kik&#x2F;progpow-exploit&quot;&gt;bypassing ProgPoW memory hardness&lt;&#x2F;a&gt;.  The vulnerability is present in Ethash as well but is near-impossible to exploit.  In progPoW it is not possible to exploit -- it assumes the ability to create variants of the candidate block&#x27;s header hash in a fashion similar to bitcoin, which is actually not possible in Ethereum.  An attacker would need modified block headers, would need customized nodes able to accept the modified block headers, and uses extraNonce&#x2F;extraData as entropy -- which isn’t the standard.  And the required brute-force search would be difficult to accomplish in one blocktime.  And even if supported by a customized node the block propagation of such mined blocks would be immediately blocked by other peers as the header hash is invalid.&lt;&#x2F;p&gt;
&lt;p&gt;The authors have since found another vulnerability similar to Kik&#x27;s, but it adds too much overhead to be ASIC-friendly.  See Lanfranchi&#x27;s full explanation &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ifdefelse&#x2F;ProgPOW&#x2F;issues&#x2F;51#issuecomment-690155355&quot;&gt;here&lt;&#x2F;a&gt;.  To completely prevent such exploits we could change the condition modifying the input state of the last keccak pass from&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;header (256 bits) +&lt;&#x2F;li&gt;
&lt;li&gt;seed for mix initiator (64 bits) +&lt;&#x2F;li&gt;
&lt;li&gt;mix from main loop (256 bits)&lt;&#x2F;li&gt;
&lt;li&gt;no padding&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;to&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;digest from initial keccak (256 bits) +&lt;&#x2F;li&gt;
&lt;li&gt;mix from main loop (256 bits) +&lt;&#x2F;li&gt;
&lt;li&gt;padding&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;thus widening the constraint to target in keccak &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;kik&#x2F;progpow-exploit&quot;&gt;brute force keccak linear searches&lt;&#x2F;a&gt; from 64 to 256 bits.&lt;&#x2F;p&gt;
&lt;p&gt;This fix is available as a PR to the reference implementation.  Again, we do not recommend implementing this fix at this time.  Kik&#x27;s vulnerability and others like it cannot be exploited now and likely never will be.  It&#x27;s better to deploy the audited code.&lt;&#x2F;p&gt;
&lt;p&gt;Note that these vulnerabilities cannot be exploited to deny service, double spend, or otherwise damage the network.  They could at worst give their deployer an efficiency advantage over other miners.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;The random sequence generated for block 30,000 (prog_seed 3,000) can been seen in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ifdefelse&#x2F;ProgPOW&#x2F;blob&#x2F;824cd791634204c4cc7e31f84bb76c0c84895bd3&#x2F;test&#x2F;kernel.cu&quot;&gt;kernel.cu&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The algorithm run on block 30,000 produces the following digest and result:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Header     : 0xffeeddccbbaa9988776655443322110000112233445566778899aabbccddeeff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Nonce      : 0x123456789abcdef0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Hash init  : 0xee304846ddd0a47b98179e96b60ec5ceeae2727834367e593de780e3e6d1892f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Mix seed   : 0x7ba4d0dd464830ee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Mix hash   : 0x493c13e9807440571511b561132834bbd558dddaa3b70c09515080a6a1aff6d0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Hash final : 0x46b72b75f238bea3fcfd227e0027dc173dceaa1fb71744bd3d5e030ed2fed053&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Additional test vectors can be found &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1057&#x2F;assets&#x2F;test-vectors&#x2F;#progpowhash&quot;&gt;in the test vectors file&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Machine-readable test vectors (T.B.D)&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The reference ProgPoW mining implementation is located at &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ifdefelse&#x2F;ProgPOW&quot;&gt;the @ifdefelse ProgPOW repository&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The reference ProgPoW mining implementation located at &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ifdefelse&#x2F;ProgPOW&quot;&gt;ProgPOW&lt;&#x2F;a&gt; is a derivative of ethminer so retains the GPL license.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Formalize IPFS hash into ENS(Ethereum Name Service) resolver</title>
        <published>2018-05-02T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Phyrex Tsai</name><email>phyrex@portal.network</email>
	</author>
	
	<author>
		<name>Portal Network Team</name>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1062/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-1062-formalize-ipfs-hash-into-ens-ethereum-name-service-resolver/281" />
        

        <id>https://wg-eips.ritovision.com/1062/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1062"
            label="ERC-1062" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1062/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;To specify the mapping protocol between resources stored on IPFS and ENS(Ethereum Naming Service).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The following standard details the implementation of how to combine the IPFS cryptographic hash unique fingerprint with ENS public resolver. This standard provides a functionality to get and set IPFS online resources to ENS resolver.&lt;&#x2F;p&gt;
&lt;p&gt;We think that this implementation is not only aim to let more developers and communities to provide more use cases, but also leverage the human-readable features to gain more user adoption accessing decentralized resources. We considered the IPFS ENS resolver mapping standard a cornerstone for building future Web3.0 service.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;To build a fully decentralized web service, it’s necessary to have a decentralized file storage system. Here comes the IPFS, for three following advantages :&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Address large amounts of data, and has unique cryptographic hash for every record.&lt;&#x2F;li&gt;
&lt;li&gt;Since IPFS is also based on peer to peer network, it can be really helpful to deliver large amounts of data to users, in a safer way and lower the millions of cost for the bandwidth.&lt;&#x2F;li&gt;
&lt;li&gt;IPFS stores files in high efficient way via tracking version history for every file, and removing the duplications across the network.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Those features makes perfect match for integrating into ENS, and these make users can easily access content through ENS, and show up in the normal browser.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The condition now is that the IPFS file fingerprint using base58 and in the meantime, the Ethereum uses hex in API to encode the binary data. So that need a way to process the condition requires not only we need to transfer from IPFS to Ethereum, but also need to convert it back.&lt;&#x2F;p&gt;
&lt;p&gt;To solve these requirements, we can use binary buffer bridging that gap.&lt;br &#x2F;&gt;
When mapping the IPFS base58 string to ENS resolver, first we convert the Base58 to binary buffer, turn the buffer to hex encrypted format, and save to the contract. Once we want to get the IPFS resources address represented by the specific ENS, we can first find the mapping information stored as hex format before, extract the hex format to binary buffer, and finally turn that to IPFS Base58 address string.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;To implement the specification, need two methods from ENS public resolver contract, when we want to store IPFS file fingerprint to contract, convert the Base58 string identifier to the hex format and invoke the &lt;code&gt;setMultihash&lt;&#x2F;code&gt; method below :&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setMultihash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; only_owner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;node&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Whenever users need to visit the ENS content, we call the &lt;code&gt;multihash&lt;&#x2F;code&gt; method to get the IPFS hex data, transfer to the Base58 format, and return the IPFS resources to use.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; multihash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;To implement the way to transfer from base58 to hex format and the reverse one, using the ‘multihashes’ library to deal with the problem.&lt;br &#x2F;&gt;
The library link : &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.npmjs.com&#x2F;package&#x2F;multihashes&quot;&gt;https:&#x2F;&#x2F;www.npmjs.com&#x2F;package&#x2F;multihashes&lt;&#x2F;a&gt;&lt;br &#x2F;&gt;
To implement the method transfer from IPFS(Base58) to hex format :&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; multihash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;multihashes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;export&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; const&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; toHex&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;ipfsHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; buf&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; multihash&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;fromB58String&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;ipfsHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  return&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; multihash&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;toHexString&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;buf&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;To implement the method transfer from hex format to IPFS(Base58) :&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; multihash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;multihashes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;export&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; const&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; toBase58&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;contentHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; contentHash&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;substring&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; buf&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; multihash&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;fromHexString&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;hex&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; multihash&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;toB58String&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;buf&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The use case can be implemented as browser extension. Users can easily download the extension, and easily get decentralized resources by just typing the ENS just like we normally type the DNS to browser the website. Solve the current pain for normal people can not easily visit the total decentralized website.&lt;&#x2F;p&gt;
&lt;p&gt;The workable implementation repository : &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;PortalNetwork&#x2F;portal-network-browser-extension&quot;&gt;https:&#x2F;&#x2F;github.com&#x2F;PortalNetwork&#x2F;portal-network-browser-extension&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Recoverable Token</title>
        <published>2018-05-02T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Bradley Leatherwood</name><email>bradleat@inkibra.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1080/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-1080-recoverabletoken-standard/364" />
        

        <id>https://wg-eips.ritovision.com/1080/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1080"
            label="ERC-1080" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1080/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;A standard interface for tokens that support chargebacks, theft prevention, and lost &amp;amp; found resolutions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The following standard allows for the implementation of a standard API for tokens extending ERC-20 or ERC-791. This standard provides basic functionality to recover stolen or lost accounts, as well as provide for the chargeback of tokens.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;To mitigate the effects of reasonably provable token or asset loss or theft and to help resolve other conflicts. Ethereum&#x27;s protocol should not be modified because of loss, theft, or conflicts, but it is possible to solve these problems in the smart contract layer.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;recoverabletoken&quot;&gt;RecoverableToken&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;methods&quot;&gt;Methods&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;claimlost&quot;&gt;claimLost&lt;&#x2F;h4&gt;
&lt;p&gt;Reports the &lt;code&gt;lostAccount&lt;&#x2F;code&gt; address as being lost. MUST trigger the &lt;code&gt;AccountClaimedLost&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;p&gt;After the time configured in &lt;code&gt;getLostAccountRecoveryTimeInMinutes&lt;&#x2F;code&gt; the implementer MUST provide a mechanism for determining the correct owner of the tokens held and moving the tokens to a new account.&lt;&#x2F;p&gt;
&lt;p&gt;Account recoveries must trigger the &lt;code&gt;AccountRecovered&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; claimLost&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; lostAccount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;cancellostclaim&quot;&gt;cancelLostClaim&lt;&#x2F;h4&gt;
&lt;p&gt;Reports the &lt;code&gt;msg.sender&lt;&#x2F;code&gt;&#x27;s account as being not being lost. MUST trigger the &lt;code&gt;AccountClaimedLostCanceled&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;p&gt;MUST fail if an account recovery process has already begun.&lt;&#x2F;p&gt;
&lt;p&gt;Otherwise, this method MUST stop a dispute from being started to recover funds.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; claimLost&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;reportstolen&quot;&gt;reportStolen&lt;&#x2F;h4&gt;
&lt;p&gt;Reports the current address as being stolen. MUST trigger the &lt;code&gt;AccountFrozen&lt;&#x2F;code&gt; event.
Successful calls MUST result in the &lt;code&gt;msg.sender&lt;&#x2F;code&gt;&#x27;s tokens being frozen.&lt;&#x2F;p&gt;
&lt;p&gt;The implementer MUST provide a mechanism for determining the correct owner of the tokens held and moving the tokens to a new account.&lt;&#x2F;p&gt;
&lt;p&gt;Account recoveries must trigger the &lt;code&gt;AccountRecovered&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; reportStolen&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;chargeback&quot;&gt;chargeback&lt;&#x2F;h4&gt;
&lt;p&gt;Requests a reversal of transfer on behalf of &lt;code&gt;msg.sender&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The implementer MUST provide a mechanism for determining the correct owner of the tokens disputed and moving the tokens to the correct account.&lt;&#x2F;p&gt;
&lt;p&gt;MUST comply with sender&#x27;s chargeback window as value configured by &lt;code&gt;setPendingTransferTimeInMinutes&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; chargeback&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; pendingTransferNumber&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;getpendingtransfertimeinminutes&quot;&gt;getPendingTransferTimeInMinutes&lt;&#x2F;h4&gt;
&lt;p&gt;Get the time an account has to chargeback a transfer.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getPendingTransferTime&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; minutes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;setpendingtransfertimeinminutes&quot;&gt;setPendingTransferTimeInMinutes&lt;&#x2F;h4&gt;
&lt;p&gt;Sets the time &lt;code&gt;msg.sender&lt;&#x2F;code&gt;&#x27;s account has to chargeback a transfer.&lt;&#x2F;p&gt;
&lt;p&gt;MUST NOT change the time if the account has any pending transfers.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setPendingTransferTime&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; minutes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;getlostaccountrecoverytimeinminutes&quot;&gt;getLostAccountRecoveryTimeInMinutes&lt;&#x2F;h4&gt;
&lt;p&gt;Get the time account has to wait before a lost account dispute can start.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getLostAccountRecoveryTimeInMinutes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; minutes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;setlostaccountrecoverytimeinminutes&quot;&gt;setLostAccountRecoveryTimeInMinutes&lt;&#x2F;h4&gt;
&lt;p&gt;Sets the time &lt;code&gt;msg.sender&lt;&#x2F;code&gt;&#x27;s account has to sit before a lost account dispute can start.&lt;&#x2F;p&gt;
&lt;p&gt;MUST NOT change the time if the account has open disputes.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setLostAccountRecoveryTimeInMinutes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; minutes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;events&quot;&gt;Events&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;accountrecovered&quot;&gt;AccountRecovered&lt;&#x2F;h4&gt;
&lt;p&gt;The recovery of an account that was lost or stolen.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AccountClaimedLost&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; newAccount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;accountclaimedlostcanceled&quot;&gt;AccountClaimedLostCanceled&lt;&#x2F;h4&gt;
&lt;p&gt;An account claimed as being lost.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AccountClaimedLost&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;accountclaimedlost&quot;&gt;AccountClaimedLost&lt;&#x2F;h4&gt;
&lt;p&gt;An account claimed as being lost.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AccountClaimedLost&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;pendingtransfer&quot;&gt;PendingTransfer&lt;&#x2F;h4&gt;
&lt;p&gt;A record of a transfer pending.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PendingTransfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; pendingTransferNumber&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;chargebackrequested&quot;&gt;ChargebackRequested&lt;&#x2F;h4&gt;
&lt;p&gt;A record of a chargeback being requested.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ChargebackRequested&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; pendingTransferNumber&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;chargeback-1&quot;&gt;Chargeback&lt;&#x2F;h4&gt;
&lt;p&gt;A record of a transfer being reversed.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Chargeback&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; pendingTransferNumber&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;accountfrozen&quot;&gt;AccountFrozen&lt;&#x2F;h4&gt;
&lt;p&gt;A record of an account being frozen. MUST trigger when an account is frozen.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AccountFrozen&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; reported&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;A recoverable token standard can provide configurable safety for users or contracts who desire this safety.&lt;&#x2F;li&gt;
&lt;li&gt;Implementations of this standard will give users the ability to select a dispute resolution process on an opt-in basis and benefit the community by decreasing the necessity of consideration of token recovery actions.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Pending.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Hybrid Casper FFG</title>
        <published>2018-04-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Danny Ryan</name><uri>https://github.com/djrtwo</uri>
	</author>
	
	<author>
		<name>Chih-Cheng Liang</name><uri>https://github.com/ChihChengLiang</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1011/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/djrtwo/EIPs/issues/5" />
        

        <id>https://wg-eips.ritovision.com/1011/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:1011"
            label="EIP-1011" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1011/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Specification of the first step to transition Ethereum main net from Proof of Work (PoW) to Proof of Stake (PoS). The resulting consensus model is a PoW&#x2F;PoS hybrid.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP specifies a hybrid PoW&#x2F;PoS consensus model for Ethereum main net. Existing PoW mechanics are used for new block creation, and a novel PoS mechanism called Casper the Friendly Finality Gadget (FFG) is layered on top using a smart contract.&lt;&#x2F;p&gt;
&lt;p&gt;Through the use of Ether deposits, slashing conditions, and a modified fork choice, FFG allows the underlying PoW blockchain to be finalized.  As network security is greatly shifted from PoW to PoS, PoW block rewards are reduced.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP does not contain safety and liveness proofs or validator implementation details, but these can be found in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;arxiv.org&#x2F;abs&#x2F;1710.09437&quot;&gt;Casper FFG paper&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;casper&#x2F;blob&#x2F;master&#x2F;VALIDATOR_GUIDE.md&quot;&gt;Validator Implementation Guide&lt;&#x2F;a&gt; respectively.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;glossary&quot;&gt;Glossary&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;epoch&lt;&#x2F;strong&gt;: The span of blocks between checkpoints. Epochs are numbered starting at the hybrid casper fork, incrementing by one at the start of each epoch.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;finality&lt;&#x2F;strong&gt;: The point at which a block has been decided upon by a client to &lt;em&gt;never&lt;&#x2F;em&gt; revert. Proof of Work does not have the concept of finality, only of further deep block confirmations.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;checkpoint&lt;&#x2F;strong&gt;: The block&#x2F;hash under consideration for finality for a given epoch. This block is the &lt;em&gt;last&lt;&#x2F;em&gt; block of the previous epoch. Rather than dealing with every block, Casper FFG only considers checkpoints for finalization. When a checkpoint is explicitly finalized, all ancestor blocks of the checkpoint are implicitly finalized.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;validator&lt;&#x2F;strong&gt;: A participant in the Casper FFG consensus that has deposited ether in the casper contract and has the responsibility to vote and finalize checkpoints.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;validator set&lt;&#x2F;strong&gt;: The set of validators in the casper contract at any given time.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;dynasty&lt;&#x2F;strong&gt;: The number of finalized checkpoints in the chain from root to the parent of a block. The dynasty is used to define when a validator starts and ends validating. The current dynasty only increments when a checkpoint is finalized as opposed to epoch numbers that increment regardless of finality.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;slash&lt;&#x2F;strong&gt;: The burning of some amount of a validator&#x27;s deposit along with an immediate logout from the validator set. Slashing occurs when a validator signs two conflicting &lt;code&gt;vote&lt;&#x2F;code&gt; messages that violate a slashing condition. For an in-depth discussion of slashing conditions, see the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;arxiv.org&#x2F;abs&#x2F;1710.09437&quot;&gt;Casper FFG Paper&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Transitioning the Ethereum network from PoW to PoS has been on the roadmap and in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;yellowpaper&quot;&gt;Yellow Paper&lt;&#x2F;a&gt; since the launch of the protocol. Although effective in coming to a decentralized consensus, PoW consumes an incredible amount of energy, has no economic finality, and has no effective strategy in resisting cartels. Excessive energy consumption, issues with equal access to mining hardware, mining pool centralization, and an emerging market of ASICs each provide a distinct motivation to make the transition as soon as possible.&lt;&#x2F;p&gt;
&lt;p&gt;Until recently, the proper way to make this transition was still an open area of research. In October of 2017 &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;arxiv.org&#x2F;abs&#x2F;1710.09437&quot;&gt;Casper the Friendly Finality Gadget&lt;&#x2F;a&gt; was published, solving open questions of economic finality through validator deposits and crypto-economic incentives. For a detailed discussion and proofs of &quot;accountable safety&quot; and &quot;plausible liveness&quot;, see the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;arxiv.org&#x2F;abs&#x2F;1710.09437&quot;&gt;Casper FFG&lt;&#x2F;a&gt; paper.&lt;&#x2F;p&gt;
&lt;p&gt;The Casper FFG contract can be layered on top of any block proposal mechanism, providing finality to the underlying chain. This EIP proposes layering FFG on top of the existing PoW block proposal mechanism as a conservative step-wise approach in the transition to full PoS. The new FFG staking mechanism requires minimal changes to the protocol, allowing the Ethereum network to fully test and evaluate Casper FFG on top of PoW before moving to a validator based block proposal mechanism.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;HYBRID_CASPER_FORK_BLKNUM&lt;&#x2F;code&gt;: TBD&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CASPER_ADDR&lt;&#x2F;code&gt;: TBD&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CASPER_CODE&lt;&#x2F;code&gt;: see below&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CASPER_BALANCE&lt;&#x2F;code&gt;: 1.25e24 wei (1,250,000 ETH)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;MSG_HASHER_ADDR&lt;&#x2F;code&gt;: TBD&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;MSG_HASHER_CODE&lt;&#x2F;code&gt;: see below&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;PURITY_CHECKER_ADDR&lt;&#x2F;code&gt;: TBD&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;PURITY_CHECKER_CODE&lt;&#x2F;code&gt;: see below&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;NULL_SENDER&lt;&#x2F;code&gt;: &lt;code&gt;2**160 - 1&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;NEW_BLOCK_REWARD&lt;&#x2F;code&gt;: 6e17 wei (0.6 ETH)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;REWARD_STEPDOWN_BLOCK_COUNT&lt;&#x2F;code&gt;: 5.5e5 blocks (~3 months)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CASPER_INIT_DATA&lt;&#x2F;code&gt;: TBD&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;VOTE_BYTES&lt;&#x2F;code&gt;: &lt;code&gt;0xe9dc0614&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;INITIALIZE_EPOCH_BYTES&lt;&#x2F;code&gt;: &lt;code&gt;0x5dcffc17&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;NON_REVERT_MIN_DEPOSIT&lt;&#x2F;code&gt;: amount in wei configurable by client&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;casper-contract-parameters&quot;&gt;Casper Contract Parameters&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;EPOCH_LENGTH&lt;&#x2F;code&gt;: 50 blocks&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;WARM_UP_PERIOD&lt;&#x2F;code&gt;: 1.8e5 blocks (~1 month)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;WITHDRAWAL_DELAY&lt;&#x2F;code&gt;: 1.5e4 epochs&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;DYNASTY_LOGOUT_DELAY&lt;&#x2F;code&gt;: 700 dynasties&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;BASE_INTEREST_FACTOR&lt;&#x2F;code&gt;: 7e-3&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;BASE_PENALTY_FACTOR&lt;&#x2F;code&gt;: 2e-7&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;MIN_DEPOSIT_SIZE&lt;&#x2F;code&gt;: 1.5e21 wei (1500 ETH)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h4 id=&quot;deploying-casper-contract&quot;&gt;Deploying Casper Contract&lt;&#x2F;h4&gt;
&lt;p&gt;If &lt;code&gt;block.number == HYBRID_CASPER_FORK_BLKNUM&lt;&#x2F;code&gt;, then when processing the block before processing any transactions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;set the code of &lt;code&gt;MSG_HASHER_ADDR&lt;&#x2F;code&gt; to &lt;code&gt;MSG_HASHER_CODE&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;set the code of &lt;code&gt;PURITY_CHECKER_ADDR&lt;&#x2F;code&gt; to &lt;code&gt;PURITY_CHECKER_CODE&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;set the code of &lt;code&gt;CASPER_ADDR&lt;&#x2F;code&gt; to &lt;code&gt;CASPER_CODE&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;set balance of &lt;code&gt;CASPER_ADDR&lt;&#x2F;code&gt; to &lt;code&gt;CASPER_BALANCE&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Then execute a &lt;code&gt;CALL&lt;&#x2F;code&gt; with the following parameters before executing any normal block transactions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;SENDER&lt;&#x2F;code&gt;: &lt;code&gt;NULL_SENDER&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;GAS&lt;&#x2F;code&gt;: 3141592&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TO&lt;&#x2F;code&gt;: &lt;code&gt;CASPER_ADDR&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;VALUE&lt;&#x2F;code&gt;: 0&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;NONCE&lt;&#x2F;code&gt;: 0&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;GASPRICE&lt;&#x2F;code&gt;: 0&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;DATA&lt;&#x2F;code&gt;: &lt;code&gt;CASPER_INIT_DATA&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This &lt;code&gt;CALL&lt;&#x2F;code&gt; utilizes no gas and does not increment the nonce of &lt;code&gt;NULL_SENDER&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;initialize-epochs&quot;&gt;Initialize Epochs&lt;&#x2F;h4&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= (HYBRID_CASPER_FORK_BLKNUM + WARM_UP_PERIOD)&lt;&#x2F;code&gt; and &lt;code&gt;block.number % EPOCH_LENGTH == 0&lt;&#x2F;code&gt;, execute a &lt;code&gt;CALL&lt;&#x2F;code&gt; with the following parameters before executing any normal block transactions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;SENDER&lt;&#x2F;code&gt;: &lt;code&gt;NULL_SENDER&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;GAS&lt;&#x2F;code&gt;: 3141592&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TO&lt;&#x2F;code&gt;: &lt;code&gt;CASPER_ADDR&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;VALUE&lt;&#x2F;code&gt;: 0&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;NONCE&lt;&#x2F;code&gt;: 0&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;GASPRICE&lt;&#x2F;code&gt;: 0&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;DATA&lt;&#x2F;code&gt;: &lt;code&gt;INITIALIZE_EPOCH_BYTES&lt;&#x2F;code&gt; followed by the 32-byte encoding of &lt;code&gt;floor(block.number &#x2F; EPOCH_LENGTH)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This &lt;code&gt;CALL&lt;&#x2F;code&gt; utilizes no gas and does not increment the nonce of &lt;code&gt;NULL_SENDER&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;casper-votes&quot;&gt;Casper Votes&lt;&#x2F;h4&gt;
&lt;p&gt;A &lt;code&gt;vote&lt;&#x2F;code&gt; transaction is defined as a transaction with the following parameters:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;TO&lt;&#x2F;code&gt;: &lt;code&gt;CASPER_ADDR&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;DATA&lt;&#x2F;code&gt;: Begins with &lt;code&gt;VOTE_BYTES&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= HYBRID_CASPER_FORK_BLKNUM&lt;&#x2F;code&gt;, then:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A valid &lt;code&gt;vote&lt;&#x2F;code&gt; transaction to &lt;code&gt;CASPER_ADDR&lt;&#x2F;code&gt; must satisfy each of the following:
&lt;ul&gt;
&lt;li&gt;Must have the following signature &lt;code&gt;(CHAIN_ID, 0, 0)&lt;&#x2F;code&gt; (ie. &lt;code&gt;r = s = 0, v = CHAIN_ID&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;Must have &lt;code&gt;value == nonce == gasprice == 0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;When producing and validating a block, when handling &lt;code&gt;vote&lt;&#x2F;code&gt; transactions to &lt;code&gt;CASPER_ADDR&lt;&#x2F;code&gt;:
&lt;ul&gt;
&lt;li&gt;Only include &quot;valid&quot; &lt;code&gt;vote&lt;&#x2F;code&gt; transactions as defined above&lt;&#x2F;li&gt;
&lt;li&gt;Place all &lt;code&gt;vote&lt;&#x2F;code&gt; transactions at the end of the block&lt;&#x2F;li&gt;
&lt;li&gt;Track cumulative gas used by votes separately from cumulative gas used by normal transactions via &lt;code&gt;vote_gas_used&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Total &lt;code&gt;vote_gas_used&lt;&#x2F;code&gt; of &lt;code&gt;vote&lt;&#x2F;code&gt; transactions cannot exceed the &lt;code&gt;block_gas_limit&lt;&#x2F;code&gt;, independent of gas used by normal block transactions&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;When applying &lt;code&gt;vote&lt;&#x2F;code&gt; transactions to &lt;code&gt;CASPER_ADDR&lt;&#x2F;code&gt; to vm state:
&lt;ul&gt;
&lt;li&gt;Set sender to &lt;code&gt;NULL_SENDER&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Count gas of &lt;code&gt;vote&lt;&#x2F;code&gt; toward &lt;code&gt;vote_gas_used&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Do not count gas of &lt;code&gt;vote&lt;&#x2F;code&gt; toward the normal &lt;code&gt;gas_used&lt;&#x2F;code&gt;. For all &lt;code&gt;vote&lt;&#x2F;code&gt; transaction receipts, cumulative gas used is equal to last non-&lt;code&gt;vote&lt;&#x2F;code&gt; transaction receipt&lt;&#x2F;li&gt;
&lt;li&gt;Do not increment the nonce of &lt;code&gt;NULL_SENDER&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;All unsuccessful &lt;code&gt;vote&lt;&#x2F;code&gt; transactions to &lt;code&gt;CASPER_ADDR&lt;&#x2F;code&gt; are invalid and must not be included in the block&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;fork-choice-and-finalization&quot;&gt;Fork Choice and Finalization&lt;&#x2F;h4&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= HYBRID_CASPER_FORK_BLKNUM&lt;&#x2F;code&gt;, the fork choice rule is the logic represented by the following pseudocode. Note that options &lt;code&gt;--casper-fork-choice&lt;&#x2F;code&gt; and &lt;code&gt;--exclude&lt;&#x2F;code&gt; are discussed below in &quot;Client Settings&quot;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; handle_block&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;new_block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; is_new_head&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;new_block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    set_head&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;new_block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; --&lt;&#x2F;span&gt;&lt;span&gt;casper&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt;fork&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt;choice&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; is&lt;&#x2F;span&gt;&lt;span&gt; on&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        check_and_finalize_new_checkpoint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;new_block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; is_new_head&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;new_block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; --&lt;&#x2F;span&gt;&lt;span&gt;casper&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt;fork&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt;choice&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; is&lt;&#x2F;span&gt;&lt;span&gt; off&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; old pure PoW chain scoring rule&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; new_block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;total_difficuty&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; current_head&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;total_difficulty&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; new_block&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; --&lt;&#x2F;span&gt;&lt;span&gt;exclude&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; list&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; or&lt;&#x2F;span&gt;&lt;span&gt; one&lt;&#x2F;span&gt;&lt;span&gt; of&lt;&#x2F;span&gt;&lt;span&gt; its&lt;&#x2F;span&gt;&lt;span&gt; descendants&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; don&amp;#39;t revert finalized blocks&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; db&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;last_finalized_block&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; new_block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;ancestors&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; new casper chain scoring rule&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; highest_justified_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;new_block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;40&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; new_block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;total_difficuty&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        highest_justified_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;current_head&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;40&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; current_head&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;total_difficulty&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; highest_justified_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    casper&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;post_state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;casper_contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; casper&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;highest_justified_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;NON_REVERT_MIN_DEPOSITS&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; check_and_finalize_new_checkpoint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;new_block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    casper&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; new_block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;post_state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;casper_contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If no finalized blocks, db.last_finalized_epoch initialized to -1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    finalized_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; casper&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;highest_finalized_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;NON_REVERT_MIN_DEPOSITS&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; finalized_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; db&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;last_finalized_epoch&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        finalized_hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; casper&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;checkpoint_hashes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;finalized_epoch&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ensure not trivially finalized&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; finalized_hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\x00&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        db&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;last_finalized_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; finalized_epoch&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        db&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;last_finalized_block&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; finalized_hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The new chain scoring rule queries the casper contract to find the highest justified epoch that meets the client&#x27;s minimum deposit requirement (&lt;code&gt;NON_REVERT_MIN_DEPOSITS&lt;&#x2F;code&gt;). The &lt;code&gt;10**40&lt;&#x2F;code&gt; multiplier ensures that the justified epoch takes precedence over block mining difficulty. &lt;code&gt;total_difficulty&lt;&#x2F;code&gt; only serves as a tie breaker if the two blocks in question have an equivalent &lt;code&gt;highest_justified_epoch&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Note&lt;&#x2F;em&gt;: If the client has no justified checkpoints, the contract returns &lt;code&gt;highest_justified_epoch&lt;&#x2F;code&gt; as &lt;code&gt;0&lt;&#x2F;code&gt; essentially reverting the fork choice rule to pure PoW.&lt;&#x2F;p&gt;
&lt;p&gt;When assessing a new block as the chain&#x27;s head, clients must &lt;em&gt;never revert finalized blocks&lt;&#x2F;em&gt; as seen by the code commented as &quot;don&#x27;t revert finalized blocks&quot;.&lt;&#x2F;p&gt;
&lt;p&gt;When a new block is added as the chain&#x27;s head, clients then check for a new finalized block. This is handled by the &lt;code&gt;check_and_finalized_new_checkpoint(new_block)&lt;&#x2F;code&gt; method above. If the highest finalized epoch in the casper contract is greater than the previous finalized epoch, then the client finalizes the block with the hash &lt;code&gt;casper.checkpoint_hashes(finalized_epoch)&lt;&#x2F;code&gt;, storing this block and the related epoch number in the client database as finalized.&lt;&#x2F;p&gt;
&lt;p&gt;Clients only consider checkpoints justified or finalized if deposits were greater than &lt;code&gt;NON_REVERT_MIN_DEPOSIT&lt;&#x2F;code&gt; &lt;em&gt;during the epoch in question&lt;&#x2F;em&gt;. This logic is encapsulated in &lt;code&gt;casper.highest_justified_epoch(NON_REVERT_MIN_DEPOSIT)&lt;&#x2F;code&gt; and &lt;code&gt;casper.highest_finalized_epoch(NON_REVERT_MIN_DEPOSIT)&lt;&#x2F;code&gt;, respectively.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;block-reward&quot;&gt;Block Reward&lt;&#x2F;h4&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= HYBRID_CASPER_FORK_BLKNUM&lt;&#x2F;code&gt;, then &lt;code&gt;block_reward&lt;&#x2F;code&gt; is defined by the following logic and utilizes the same formulas for ommer rewards but with the updated &lt;code&gt;block_reward&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; HYBRID_CASPER_FORK_BLKNUM&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; REWARD_STEPDOWN_BLOCK_COUNT&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block_reward&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 5&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; NEW_BLOCK_REWARD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;elif&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; HYBRID_CASPER_FORK_BLKNUM&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;REWARD_STEPDOWN_BLOCK_COUNT&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block_reward&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; NEW_BLOCK_REWARD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;elif&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; HYBRID_CASPER_FORK_BLKNUM&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;REWARD_STEPDOWN_BLOCK_COUNT&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block_reward&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; NEW_BLOCK_REWARD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;elif&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; HYBRID_CASPER_FORK_BLKNUM&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;REWARD_STEPDOWN_BLOCK_COUNT&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block_reward&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; NEW_BLOCK_REWARD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block_reward&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; NEW_BLOCK_REWARD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;validators&quot;&gt;Validators&lt;&#x2F;h4&gt;
&lt;p&gt;The mechanics and responsibilities of validators are not specified in this EIP because they rely upon network transactions to the contract at &lt;code&gt;CASPER_ADDR&lt;&#x2F;code&gt; rather than on protocol level implementation and changes.
See the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;casper&#x2F;blob&#x2F;master&#x2F;VALIDATOR_GUIDE.md&quot;&gt;Validator Implementation Guide&lt;&#x2F;a&gt; for validator details.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;msg-hasher-code&quot;&gt;MSG_HASHER_CODE&lt;&#x2F;h4&gt;
&lt;p&gt;The source code for &lt;code&gt;MSG_HASHER_CODE&lt;&#x2F;code&gt; is located &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;casper&#x2F;blob&#x2F;master&#x2F;casper&#x2F;contracts&#x2F;msg_hash.se.py&quot;&gt;here&lt;&#x2F;a&gt;.
The source is to be migrated to Vyper LLL before the bytecode is finalized for this EIP.&lt;&#x2F;p&gt;
&lt;p&gt;The EVM init code is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;TBD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The EVM bytecode that the contract should be set to is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;TBD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;purity-checker-code&quot;&gt;PURITY_CHECKER_CODE&lt;&#x2F;h4&gt;
&lt;p&gt;The source code for &lt;code&gt;PURITY_CHECKER_CODE&lt;&#x2F;code&gt; is located &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;research&#x2F;blob&#x2F;master&#x2F;impurity&#x2F;check_for_impurity.se&quot;&gt;here&lt;&#x2F;a&gt;.
The source is to be migrated to Vyper LLL before the bytecode is finalized for this EIP.&lt;&#x2F;p&gt;
&lt;p&gt;The EVM init code is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;TBD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The EVM bytecode that the contract should be set to is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;TBD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;casper-code&quot;&gt;CASPER_CODE&lt;&#x2F;h4&gt;
&lt;p&gt;The source code for &lt;code&gt;CASPER_CODE&lt;&#x2F;code&gt; is located at
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;casper&#x2F;blob&#x2F;master&#x2F;casper&#x2F;contracts&#x2F;simple_casper.v.py&quot;&gt;here&lt;&#x2F;a&gt;.
The contract is to be formally verified and further tested before the bytecode is finalized for this EIP.&lt;&#x2F;p&gt;
&lt;p&gt;The EVM init code with the above specified params is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;TBD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The EVM bytecode that the contract should be set to is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;TBD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;client-settings&quot;&gt;Client Settings&lt;&#x2F;h4&gt;
&lt;p&gt;Clients should be implemented with the following configurable settings:&lt;&#x2F;p&gt;
&lt;h5 id=&quot;enable-casper-fork-choice&quot;&gt;Enable Casper Fork Choice&lt;&#x2F;h5&gt;
&lt;p&gt;The ability to enable&#x2F;disable the Casper Fork Choice. A suggested implementation is &lt;code&gt;--casper-fork-choice&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This setting should ship as default disabled in client versions during the initial casper fork. This setting should ship as default enabled in subsequent client versions.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;non-revert-min-deposit&quot;&gt;NON_REVERT_MIN_DEPOSIT&lt;&#x2F;h5&gt;
&lt;p&gt;The minimum size of total deposits that the client must observe in the FFG contract for the state of the contract to affect the client&#x27;s fork choice. A suggested implementation is &lt;code&gt;--non-revert-min-deposit WEI_VALUE&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The suggested default value that clients should ship with is at least 2e23 wei (200K ETH).&lt;&#x2F;p&gt;
&lt;p&gt;See &quot;Fork Choice&quot; more details.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;exclusion&quot;&gt;Exclusion&lt;&#x2F;h5&gt;
&lt;p&gt;The ability to exclude a specified blockhash and all of its descendants from a client&#x27;s fork choice. A suggested implementation is &lt;code&gt;--exclude BLOCKHASHES&lt;&#x2F;code&gt;, where &lt;code&gt;BLOCK_HASHES&lt;&#x2F;code&gt; is a comma delimited list of blockhashes to exclude.&lt;&#x2F;p&gt;
&lt;p&gt;Note: this &lt;em&gt;can&lt;&#x2F;em&gt; by design override a client&#x27;s forkchoice and revert finalized blocks.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;join-fork&quot;&gt;Join Fork&lt;&#x2F;h5&gt;
&lt;p&gt;The ability to manually join a fork specified by a blockhash. A suggested implementation is &lt;code&gt;--join-fork BLOCKHASH&lt;&#x2F;code&gt; where the client automatically sets the head to the block defined by&lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt; and locally finalizes it.&lt;&#x2F;p&gt;
&lt;p&gt;Note: this &lt;em&gt;can&lt;&#x2F;em&gt; by design override a client&#x27;s forkchoice and revert finalized blocks.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;monitor-votes&quot;&gt;Monitor Votes&lt;&#x2F;h5&gt;
&lt;p&gt;The ability to monitor incoming &lt;code&gt;vote&lt;&#x2F;code&gt; transactions for slashing conditions and submit proof to the casper contract for a finder&#x27;s fee if found. A suggested implementation is &lt;code&gt;--monitor-votes&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The setting should default to disabled.&lt;&#x2F;p&gt;
&lt;p&gt;The following pseudocode defines when two &lt;code&gt;vote&lt;&#x2F;code&gt; messages violate a slashing condition. A &lt;code&gt;vote&lt;&#x2F;code&gt; message is the singular argument included in a &lt;code&gt;vote&lt;&#x2F;code&gt; transaction.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; decode_rlp_list&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;vote_msg&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; [validator_index, target_hash, target_epoch, source_epoch, signature]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; RLPList&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;vote_msg&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; same_target_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;vote_msg_1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; vote_msg_2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    decoded_values_1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; decode_rlp_msg&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;vote_msg_1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    target_epoch_1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; decoded_values_1&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    decoded_values_2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; decode_rlp_msg&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;vote_msg_2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    target_epoch_2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; decoded_values_2&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; target_epoch_1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; target_epoch_2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; surrounds&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;vote_msg_1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; vote_msg_2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    decoded_values_1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; decode_rlp_msg&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;vote_msg_1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    target_epoch_1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; decoded_values_1&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    source_epoch_1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; decoded_values_1&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    decoded_values_2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; decode_rlp_msg&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;vote_msg_2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    target_epoch_2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; decoded_values_2&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    source_epoch_1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; decoded_values_1&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    vote_1_surrounds_vote_2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; target_epoch_1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; target_epoch_2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span&gt; source_epoch_1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; source_epoch_2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    vote_2_surrounds_vote_1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; target_epoch_2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; target_epoch_1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span&gt; source_epoch_2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; source_epoch_1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; vote_1_surrounds_vote_2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; or&lt;&#x2F;span&gt;&lt;span&gt; vote_2_surrounds_vote_1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; violates_slashing_condition&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;vote_msg_1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; vote_msg_2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; same_target_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;vote_msg_1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; vote_msg_2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; or&lt;&#x2F;span&gt;&lt;span&gt; surrounds&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;vote_msg_1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; vote_msg_2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The casper contract also provides a helper method &lt;code&gt;slashable(vote_msg_1, vote_msg_2)&lt;&#x2F;code&gt; to check if two votes violate a slashing condition. Clients should use the above pseudocode in combination with &lt;code&gt;casper.slashable()&lt;&#x2F;code&gt; as a final check when deciding whether to submit a &lt;code&gt;slash&lt;&#x2F;code&gt; to the contract.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;--monitor-votes&lt;&#x2F;code&gt; setting is to be used for clients that wish to monitor vote transactions for slashing conditions. If a slashing condition is found, the client creates and sends a transaction to &lt;code&gt;slash&lt;&#x2F;code&gt; on the casper contract. The first transaction to include the slashing condition proof slashes the validator in question and sends a 4% finder&#x27;s fee to the transaction sender.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Naive PoS specifications and implementations have existed since early blockchain days, but most are vulnerable to serious attacks and do not hold up under crypto-economic analysis. Casper FFG solves problems such as &quot;Nothing at Stake&quot; and &quot;Long Range Attacks&quot; through requiring validators to post slashable deposits and through defining economic finality.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;minimize-consensus-changes&quot;&gt;Minimize Consensus Changes&lt;&#x2F;h4&gt;
&lt;p&gt;The finality gadget is designed to minimize changes across clients. For this reason, FFG is implemented within the EVM, so that the contract byte code encapsulates most of the complexity of the fork.&lt;&#x2F;p&gt;
&lt;p&gt;Most other decisions were made to minimize changes across clients. For example, it would be possible to allow &lt;code&gt;CASPER_ADDR&lt;&#x2F;code&gt; to mint Ether each time it paid rewards (as compared to creating the contract with &lt;code&gt;CASPER_BALANCE&lt;&#x2F;code&gt;), but this would be more invasive and error-prone than relying on existing EVM mechanics.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;deploying-casper-contract-1&quot;&gt;Deploying Casper Contract&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;MSG_HASHER_CODE&lt;&#x2F;code&gt; and &lt;code&gt;PURITY_CHECKER_CODE&lt;&#x2F;code&gt; both do not require any initialization so the EVM bytecode can simply be placed at &lt;code&gt;MSG_HASHER_ADDR&lt;&#x2F;code&gt; and &lt;code&gt;PURITY_CHECKER_ADDR&lt;&#x2F;code&gt;. On the other hand, the casper contract &lt;em&gt;does&lt;&#x2F;em&gt; require passing in parameters and initialization of state. This initialization would normally occur by the EVM init code interacting with the CREATE opcode. Due to the nature of this contract being deployed outside of normal block transactions and to a particular address, the EVM init code&#x2F;CREATE method requires client specific &quot;hacks&quot; to make it work. For simplicity of specifying across clients, the EVM bytecode -- &lt;code&gt;CASPER_CODE&lt;&#x2F;code&gt; -- is placed at &lt;code&gt;CASPER_ADDR&lt;&#x2F;code&gt; followed by an explicit &lt;code&gt;CALL&lt;&#x2F;code&gt; to a one-time &lt;code&gt;init&lt;&#x2F;code&gt; method on the casper contract. &lt;code&gt;init&lt;&#x2F;code&gt; handles all of the logic that a constructor normally would, accepting contract parameters as arguments and setting initial variable values, and can only be run &lt;em&gt;once&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;CASPER_INIT_DATA&lt;&#x2F;code&gt; is composed of the byte signature of the &lt;code&gt;init&lt;&#x2F;code&gt; method of the casper contract concatenated with the 32-byte encodings of the following variables in the following order:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;EPOCH_LENGTH&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;WITHDRAWAL_DELAY&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;DYNASTY_LOGOUT_DELAY&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;MSG_HASHER_ADDR&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;PURITY_CHECKER_ADDR&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;BASE_INTEREST_FACTOR&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;BASE_PENALTY_FACTOR&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;MIN_DEPOSIT_SIZE&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The entirety of this data is provided as a bytestring -- &lt;code&gt;CASPER_INIT_DATA&lt;&#x2F;code&gt; -- to reduce the chance of encoding errors across clients, especially regarding fixed decimal types which are new in vyper and not yet supported by all clients.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;casper-contract-params&quot;&gt;Casper Contract Params&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;EPOCH_LENGTH&lt;&#x2F;code&gt; is set to 50 blocks as a balance between time to finality and message overhead.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;WARM_UP_PERIOD&lt;&#x2F;code&gt; is set to 1.8e5 blocks to provide validators with an approximate 1 month period to make initial deposits before full contract functionality and voting begin. This helps prevent degenerate cases such as having very few or even just one validator in the initial dynasty. This 1 month period also gives the network time to observe on the order of how many validators will initially be participating in consensus. If for some reason there is an unexpectedly low turnout, the community might choose to delay validation and consider design alternatives.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;WITHDRAWAL_DELAY&lt;&#x2F;code&gt; is set to 15000 epochs to freeze a validator&#x27;s funds for approximately 4 months after logout. This allows for at least a 4 month window to identify and slash a validator for attempting to finalize two conflicting checkpoints. This also defines the window of time with which a client must log on to sync the network due to weak subjectivity.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;DYNASTY_LOGOUT_DELAY&lt;&#x2F;code&gt; is set to 700 dynasties to prevent immediate logout in the event of an attack from being a viable strategy.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;BASE_INTEREST_FACTOR&lt;&#x2F;code&gt; is set to 7e-3 such that if there are ~10M ETH in total deposits, then validators earn approximately 5% per year in ETH rewards under optimal FFG conditions.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;BASE_PENALTY_FACTOR&lt;&#x2F;code&gt; is set to 2e-7 such that if 50% of deposits go offline, then offline validators lose half of their deposits in approximately 3 weeks, at which the online portion of validators becomes a 2&#x2F;3 majority and can begin finalizing checkpoints again.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;MIN_DEPOSIT_SIZE&lt;&#x2F;code&gt; is set to 1500 ETH to form a natural upper bound on the total number of validators, bounding the overhead due to &lt;code&gt;vote&lt;&#x2F;code&gt; messages. Using formulas found &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;medium.com&#x2F;@VitalikButerin&#x2F;parametrizing-casper-the-decentralization-finality-time-overhead-tradeoff-3f2011672735&quot;&gt;here&lt;&#x2F;a&gt; under &quot;From validator count to minimum staking ETH&quot;, we estimate that with 1500 ETH minimum deposit at an assumed ~10M in total deposits there will be approximately 900 validators at any given time. &lt;code&gt;vote&lt;&#x2F;code&gt;s are only sent after the first quarter of an epoch so 900 votes have to fit into 37 blocks or ~24 &lt;code&gt;vote&lt;&#x2F;code&gt;s per block. We have experimented with more dynamic models for &lt;code&gt;MIN_DEPOSIT_SIZE&lt;&#x2F;code&gt;, but these tend to introduce significant complexities and without data from a live network seem to be premature optimizations.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;initialize-epochs-1&quot;&gt;Initialize Epochs&lt;&#x2F;h4&gt;
&lt;p&gt;The call to the method at &lt;code&gt;INITIALIZE_EPOCH_BYTES&lt;&#x2F;code&gt; at &lt;code&gt;CASPER_ADDR&lt;&#x2F;code&gt; at the start of each epoch is a call to the &lt;code&gt;initialize_epoch&lt;&#x2F;code&gt; method in the casper contract. This method can only be called once per epoch and is guaranteed by the protocol to be called at the start block of each epoch by &lt;code&gt;NULL_SENDER&lt;&#x2F;code&gt;. This method performs a number of bookkeeping tasks around incrementing variables, updating rewards, etc.&lt;&#x2F;p&gt;
&lt;p&gt;Any call to this method fails prior to the end of the &lt;code&gt;WARM_UP_PERIOD&lt;&#x2F;code&gt;. Thus the protocol does not begin executing &lt;code&gt;initialize_epoch&lt;&#x2F;code&gt; calls until &lt;code&gt;block.number &amp;gt;= HYBRID_CASPER_FORK_BLKNUM + WARM_UP_PERIOD&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;issuance&quot;&gt;Issuance&lt;&#x2F;h4&gt;
&lt;p&gt;A fixed amount of 1.25M ETH was chosen as &lt;code&gt;CASPER_BALANCE&lt;&#x2F;code&gt; to fund the casper contract. This gives the contract enough runway to operate for approximately 2 years (assuming ~10M ETH in validator deposits). Acting similarly to the &quot;difficulty bomb&quot;, this &quot;funding crunch&quot; forces the network to hardfork in the relative near future to further fund the contract. This future hardfork is an opportunity to upgrade the contract and transition to full PoS.&lt;&#x2F;p&gt;
&lt;p&gt;The PoW block reward is reduced from 3.0 to 0.6 ETH&#x2F;block over the course of approximately one year because the security of the chain is greatly shifted from PoW difficulty to PoS finality and because rewards are now issued to both validators and miners. Rewards are stepped down by 0.6 ETH&#x2F;block every 3 months (&lt;code&gt;REWARD_STEPDOWN_BLOCK_COUNT&lt;&#x2F;code&gt;) to provide for a conservative transition period from full PoW to hybrid PoS&#x2F;PoW. This gives validators time to become familiar with the new technology and begin logging on and also provides the network with more leeway in case of any unforeseen issues. If any major issues do arise, the Ethereum network will still have substantial PoW security to rely upon while decisions are made and&#x2F;or patches are deployed. See &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;gist.github.com&#x2F;djrtwo&#x2F;bc864c0d0a275170183803814b207b9a&quot;&gt;here&lt;&#x2F;a&gt; for further analysis of the current PoW security and of the effect of PoW block reward reduction in the context of Hybrid Casper FFG.&lt;&#x2F;p&gt;
&lt;p&gt;In addition to block rewards, miners now receive an issuance reward for including successful &lt;code&gt;vote&lt;&#x2F;code&gt; transactions into the block on time. This reward is equal to 1&#x2F;8th that of the reward the validator receives for a successful &lt;code&gt;vote&lt;&#x2F;code&gt; transaction. Under optimal FFG conditions after group validator reward adjustments are made, miners receive approximately 1&#x2F;5th of the total ETH issued by the Casper contract.&lt;&#x2F;p&gt;
&lt;p&gt;Below is a table of deposit sizes with associated annual interest rate and approximate time until funding crunch:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Deposit Size&lt;&#x2F;th&gt;&lt;th&gt;Annual Validator Interest&lt;&#x2F;th&gt;&lt;th&gt;Funding Crunch&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;2.5M ETH&lt;&#x2F;td&gt;&lt;td&gt;10.12%&lt;&#x2F;td&gt;&lt;td&gt;~4 years&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;10M ETH&lt;&#x2F;td&gt;&lt;td&gt;5.00%&lt;&#x2F;td&gt;&lt;td&gt;~2 years&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;20M ETH&lt;&#x2F;td&gt;&lt;td&gt;3.52%&lt;&#x2F;td&gt;&lt;td&gt;~1.4 years&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;40M ETH&lt;&#x2F;td&gt;&lt;td&gt;2.48%&lt;&#x2F;td&gt;&lt;td&gt;~1 year&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;gas-changes&quot;&gt;Gas Changes&lt;&#x2F;h4&gt;
&lt;p&gt;Normal block transactions cannot affect casper &lt;code&gt;vote&lt;&#x2F;code&gt; validation results, but casper &lt;code&gt;vote&lt;&#x2F;code&gt; validation results can affect normal block transaction execution. Due to this asymmetrical relationship, &lt;code&gt;vote&lt;&#x2F;code&gt; transactions can be processed in parallel with normal block transactions if &lt;code&gt;vote&lt;&#x2F;code&gt; transactions are placed after all normal block transactions. Because &lt;code&gt;vote&lt;&#x2F;code&gt; transactions can be processed in parallel to normal block transactions, &lt;code&gt;vote&lt;&#x2F;code&gt; transactions cost 0 gas for validators, ensuring that validators can submit votes even in highly congested or high gas-price periods.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;vote_gas_used&lt;&#x2F;code&gt; is introduced to ensure that &lt;code&gt;vote&lt;&#x2F;code&gt; transactions do not put an undue burden on block processing. The additional overhead from &lt;code&gt;vote&lt;&#x2F;code&gt; transactions is capped at the same limit as normal block transactions so that, when run in parallel, neither sets of transactions exceed the overhead defined by the &lt;code&gt;block_gas_limit&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The call to &lt;code&gt;initialize_epoch&lt;&#x2F;code&gt; at the beginning of each epoch requires 0 gas so that this protocol state transition does not take any gas allowance away from normal transactions.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;null-sender-and-account-abstraction&quot;&gt;NULL_SENDER and Account Abstraction&lt;&#x2F;h4&gt;
&lt;p&gt;This EIP implements a limited version of account abstraction for validators&#x27; &lt;code&gt;vote&lt;&#x2F;code&gt; transactions. The general design was borrowed from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;86&#x2F;&quot;&gt;EIP-86&lt;&#x2F;a&gt;. Rather than relying upon native transaction signatures, each validator specifies a signature contract when sending their &lt;code&gt;deposit&lt;&#x2F;code&gt; to &lt;code&gt;CASPER_ADDR&lt;&#x2F;code&gt;. When casting a &lt;code&gt;vote&lt;&#x2F;code&gt;, the validator bundles and signs the parameters of their &lt;code&gt;vote&lt;&#x2F;code&gt; according to the requirements of their signature contract. The &lt;code&gt;vote&lt;&#x2F;code&gt; method of the casper contract checks the signature of the parameters against the validator&#x27;s signature contract, exiting the transaction as unsuccessful if the signature is not successfully verified.&lt;&#x2F;p&gt;
&lt;p&gt;This allows validators to customize their own signing scheme for votes. Use cases include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;quantum-secure signature schemes&lt;&#x2F;li&gt;
&lt;li&gt;multisig wallets&lt;&#x2F;li&gt;
&lt;li&gt;threshold schemes&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;For more details on validator account abstraction, see the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;casper&#x2F;blob&#x2F;master&#x2F;VALIDATOR_GUIDE.md&quot;&gt;Validator Implementation Guide&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;client-settings-1&quot;&gt;Client Settings&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;enable-casper-fork-choice-1&quot;&gt;Enable Casper Fork Choice&lt;&#x2F;h5&gt;
&lt;p&gt;Releasing client versions with the casper fork choice as initially default disabled allows for a more conservative transition to hybrid Casper FFG. Under normal operating conditions there are no disparities between the PoW fork choice and the hybrid Casper FFG fork choice. The two fork choice rules can only diverge if either 51% of miners or 51% of validators are faulty.&lt;&#x2F;p&gt;
&lt;p&gt;Validators will begin to log on, vote, and finalize the FFG contract before the majority of the network begins explicitly relying upon the new finality mechanism. Once a significant number of validators have logged on and the finality mechanism has been tested on the live network, new client software versions that change the default to enabled will be released.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;non-revert-min-deposit-1&quot;&gt;NON_REVERT_MIN_DEPOSIT&lt;&#x2F;h5&gt;
&lt;p&gt;&lt;code&gt;NON_REVERT_MIN_DEPOSIT&lt;&#x2F;code&gt; is defined and configurable locally by each client. Clients are in charge of deciding upon the minimum deposits (security) at which they will accept the chain as finalized. In the general case, differing values in the choice of this local constant will not create any fork inconsistencies because clients with very strict finalization requirements will revert to follow the longest PoW chain.&lt;&#x2F;p&gt;
&lt;p&gt;Arguments have been made to hardcode a value into clients or the contract, but we cannot reasonably define security required for all clients especially in the context of massive fluctuations in the value of ETH.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;exclusion-1&quot;&gt;Exclusion&lt;&#x2F;h5&gt;
&lt;p&gt;This setting is useful in coordinating minority forks in cases of majority collusion.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;join-fork-1&quot;&gt;Join Fork&lt;&#x2F;h5&gt;
&lt;p&gt;This setting is to be used by new clients that are syncing the network for the first time. Due to weak subjectivity, a blockhash should be supplied to successfully sync the network when initially starting a node.&lt;&#x2F;p&gt;
&lt;p&gt;This setting is also useful for coordinating minority forks in cases of majority collusion.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;monitor-votes-1&quot;&gt;Monitor Votes&lt;&#x2F;h5&gt;
&lt;p&gt;Monitoring the network for slashing conditions is key to Casper FFG&#x27;s &quot;accountable safety&quot; as submitting proof of nefarious activity burns a validator&#x27;s deposit.&lt;&#x2F;p&gt;
&lt;p&gt;This setting is suggested default disabled because the block producer will almost certainly frontrun anyone else submitting a &lt;code&gt;slash&lt;&#x2F;code&gt; transaction. To prevent every client on the network from submitting a &lt;code&gt;slash&lt;&#x2F;code&gt; transaction in the event of a slashing condition, this setting should only be enabled by block producers and those clients who explicitly choose to monitor votes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is not forward compatible and introduces backwards incompatibilities in the state, fork choice rule, block reward, transaction validity, and gas calculations on certain transactions. Therefore, all changes should be included in a scheduled hardfork at &lt;code&gt;HYBRID_CASPER_FORK_BLKNUM&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Skinny CREATE2</title>
        <published>2018-04-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1014/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/1014/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:1014"
            label="EIP-1014" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1014/">&lt;h3 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h3&gt;
&lt;p&gt;Adds a new opcode (&lt;code&gt;CREATE2&lt;&#x2F;code&gt;) at &lt;code&gt;0xf5&lt;&#x2F;code&gt;, which takes 4 stack arguments: endowment, memory_start, memory_length, salt. Behaves identically to &lt;code&gt;CREATE&lt;&#x2F;code&gt; (&lt;code&gt;0xf0&lt;&#x2F;code&gt;), except using &lt;code&gt;keccak256( 0xff ++ address ++ salt ++ keccak256(init_code))[12:]&lt;&#x2F;code&gt; instead of the usual sender-and-nonce-hash as the address where the contract is initialized at.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;CREATE2&lt;&#x2F;code&gt; has the same &lt;code&gt;gas&lt;&#x2F;code&gt; schema as &lt;code&gt;CREATE&lt;&#x2F;code&gt;, but also an extra &lt;code&gt;hashcost&lt;&#x2F;code&gt; of &lt;code&gt;GSHA3WORD * ceil(len(init_code) &#x2F; 32)&lt;&#x2F;code&gt;, to account for the hashing that must be performed. The &lt;code&gt;hashcost&lt;&#x2F;code&gt; is deducted at the same time as memory-expansion gas and &lt;code&gt;CreateGas&lt;&#x2F;code&gt; is deducted: &lt;em&gt;before&lt;&#x2F;em&gt; evaluation of the resulting address and the execution of &lt;code&gt;init_code&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;0xff&lt;&#x2F;code&gt; is a single byte,&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;address&lt;&#x2F;code&gt; is always &lt;code&gt;20&lt;&#x2F;code&gt; bytes,&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;salt&lt;&#x2F;code&gt; is always &lt;code&gt;32&lt;&#x2F;code&gt; bytes (a stack item).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The preimage for the final hashing round is thus always exactly &lt;code&gt;85&lt;&#x2F;code&gt; bytes long.&lt;&#x2F;p&gt;
&lt;p&gt;The coredev-call at 2018-08-10 decided to use the formula above.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h3&gt;
&lt;p&gt;Allows interactions to (actually or counterfactually in channels) be made with addresses that do not exist yet on-chain but can be relied on to only possibly eventually contain code that has been created by a particular piece of init code. Important for state-channel use cases that involve counterfactual interactions with contracts.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;address-formula&quot;&gt;Address formula&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Ensures that addresses created with this scheme cannot collide with addresses created using the traditional &lt;code&gt;keccak256(rlp([sender, nonce]))&lt;&#x2F;code&gt; formula, as &lt;code&gt;0xff&lt;&#x2F;code&gt; can only be a starting byte for RLP for data many petabytes long.&lt;&#x2F;li&gt;
&lt;li&gt;Ensures that the hash preimage has a fixed size,&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;gas-cost&quot;&gt;Gas cost&lt;&#x2F;h4&gt;
&lt;p&gt;Since address calculation depends on hashing the &lt;code&gt;init_code&lt;&#x2F;code&gt;, it would leave clients open to DoS attacks if executions could repeatedly cause hashing of large pieces of &lt;code&gt;init_code&lt;&#x2F;code&gt;, since expansion of memory is paid for only once. This EIP uses the same cost-per-word as the &lt;code&gt;SHA3&lt;&#x2F;code&gt; opcode.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;clarifications&quot;&gt;Clarifications&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;init_code&lt;&#x2F;code&gt; is the code that, when executed, produces the runtime bytecode that will be placed into the state, and which typically is used by high level languages to implement a &#x27;constructor&#x27;.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP makes collisions possible. The behaviour at collisions is specified by &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;684&quot;&gt;EIP-684&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;If a contract creation is attempted, due to either a creation transaction or the &lt;code&gt;CREATE&lt;&#x2F;code&gt; (or future &lt;code&gt;CREATE2&lt;&#x2F;code&gt;) opcode, and the destination address already has either nonzero nonce, or nonempty code, then the creation throws immediately, with exactly the same behavior as would arise if the first byte in the init code were an invalid opcode. This applies retroactively starting from genesis.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;Specifically, if &lt;code&gt;nonce&lt;&#x2F;code&gt; or &lt;code&gt;code&lt;&#x2F;code&gt; is nonzero, then the create-operation fails.&lt;&#x2F;p&gt;
&lt;p&gt;With &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;161&#x2F;&quot;&gt;EIP-161&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Account creation transactions and the &lt;code&gt;CREATE&lt;&#x2F;code&gt; operation SHALL, prior to the execution of the initialisation code, increment the nonce over and above its normal starting value by one&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;This means that if a contract is created in a transaction, the &lt;code&gt;nonce&lt;&#x2F;code&gt; is immediately non-zero, with the side-effect that a collision within the same transaction will always fail -- even if it&#x27;s carried out from the &lt;code&gt;init_code&lt;&#x2F;code&gt; itself.&lt;&#x2F;p&gt;
&lt;p&gt;It should also be noted that &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; (&lt;code&gt;0xff&lt;&#x2F;code&gt;) has no immediate effect on &lt;code&gt;nonce&lt;&#x2F;code&gt; or &lt;code&gt;code&lt;&#x2F;code&gt;, thus a contract cannot be destroyed and recreated within one transaction.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;examples&quot;&gt;Examples&lt;&#x2F;h3&gt;
&lt;p&gt;Example 0&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;address &lt;code&gt;0x0000000000000000000000000000000000000000&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;salt &lt;code&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;init_code &lt;code&gt;0x00&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;gas (assuming no mem expansion): &lt;code&gt;32006&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;result: &lt;code&gt;0x4D1A2e2bB4F88F0250f26Ffff098B0b30B26BF38&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Example 1&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;address &lt;code&gt;0xdeadbeef00000000000000000000000000000000&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;salt &lt;code&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;init_code &lt;code&gt;0x00&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;gas (assuming no mem expansion): &lt;code&gt;32006&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;result: &lt;code&gt;0xB928f69Bb1D91Cd65274e3c79d8986362984fDA3&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Example 2&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;address &lt;code&gt;0xdeadbeef00000000000000000000000000000000&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;salt &lt;code&gt;0x000000000000000000000000feed000000000000000000000000000000000000&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;init_code &lt;code&gt;0x00&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;gas (assuming no mem expansion): &lt;code&gt;32006&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;result: &lt;code&gt;0xD04116cDd17beBE565EB2422F2497E06cC1C9833&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Example 3&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;address &lt;code&gt;0x0000000000000000000000000000000000000000&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;salt &lt;code&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;init_code &lt;code&gt;0xdeadbeef&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;gas (assuming no mem expansion): &lt;code&gt;32006&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;result: &lt;code&gt;0x70f2b2914A2a4b783FaEFb75f459A580616Fcb5e&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Example 4&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;address &lt;code&gt;0x00000000000000000000000000000000deadbeef&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;salt &lt;code&gt;0x00000000000000000000000000000000000000000000000000000000cafebabe&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;init_code &lt;code&gt;0xdeadbeef&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;gas (assuming no mem expansion): &lt;code&gt;32006&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;result: &lt;code&gt;0x60f3f640a8508fC6a86d45DF051962668E1e8AC7&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Example 5&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;address &lt;code&gt;0x00000000000000000000000000000000deadbeef&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;salt &lt;code&gt;0x00000000000000000000000000000000000000000000000000000000cafebabe&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;init_code &lt;code&gt;0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;gas (assuming no mem expansion): &lt;code&gt;32012&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;result: &lt;code&gt;0x1d8bfDC5D46DC4f61D6b6115972536eBE6A8854C&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Example 6&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;address &lt;code&gt;0x0000000000000000000000000000000000000000&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;salt &lt;code&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;init_code &lt;code&gt;0x&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;gas (assuming no mem expansion): &lt;code&gt;32000&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;result: &lt;code&gt;0xE33C0C7F7df4809055C3ebA6c09CFe4BaF1BD9e0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Configurable On Chain Issuance</title>
        <published>2018-04-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Van de Sande</name><email>avsa@ethereum.org</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1015/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-dynamic-block-rewards-with-governance-contract/204" />
        

        <id>https://wg-eips.ritovision.com/1015/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:1015"
            label="EIP-1015" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1015/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP changes the block reward step by instead of setting it to be hard coded on the clients and to be given to the miner&#x2F;validator etherbase, it should instead go to an address decided by an on-chain contract, with hard limits on how it would be issued (six month lock-in; issuance can only decrease or be maintained, but not increase;). A decision method is suggested but not essential to the notion of this EIP. This would &lt;strong&gt;not be a generic governance solution&lt;&#x2F;strong&gt;, which is a much broader and harder topic, would &lt;strong&gt;not&lt;&#x2F;strong&gt; affect technical upgrade decisions or other hard forks, but seen as &lt;em&gt;a forum to attempt to prevent contentious hard forks&lt;&#x2F;em&gt; that can be solved with the issuance.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;summary&quot;&gt;Summary&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;thesis-many-controversial-issues-boil-down-to-resources&quot;&gt;Thesis: many controversial issues boil down to resources&lt;&#x2F;h3&gt;
&lt;p&gt;These are current EIPs that are being developed or debated. They might seem unrelated but they have something in common, that they can be resolved by proper channel of funds.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;casper-and-pos&quot;&gt;Casper and PoS&lt;&#x2F;h4&gt;
&lt;p&gt;Moving to PoS has been on the roadmap since day 0 for ethereum, along with a reduction in issuance to a cost equivalent to the Validator&#x27;s cost of security (considered to be more efficient than PoW). But the exact issuance necessary for PoS has yet to be determined and is currently being researched. Casper validation will be an on chain contract and therefore it will need to be funded. It&#x27;s unlikely that a definitive final answer on how much issuance is needed for validation will be reached in the next years as new research will uncover new arguments, so it would make sense to allow some flexibility on this matter&lt;&#x2F;p&gt;
&lt;h4 id=&quot;issuance-cap-at-120-million&quot;&gt;Issuance Cap at 120 Million&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;960&quot;&gt;EIP-960&lt;&#x2F;a&gt;, Vitalik&#x27;s not so jokey april&#x27;s fool has been taken seriously. It proposes the issuance to be slowly reduced until it reaches 120 million ether. One of the main counterpoints by Vlad can be simplified by &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;medium.com&#x2F;@Vlad_Zamfir&#x2F;against-vitaliks-fixed-supply-eip-eip-960-18e182a7e5bd&quot;&gt;we don&#x27;t know enough to know what that ether can be used for&lt;&#x2F;a&gt; and Vitalik&#x27;s counterpoint is that &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;medium.com&#x2F;@VitalikButerin&#x2F;to-be-clear-im-not-necessarily-wedded-to-a-finite-supply-cap-a7aa48ab880c&quot;&gt;reducing emissions can be a way to reduce future abuse of these funds by finding a schelling point at 0&lt;&#x2F;a&gt;. Issuance has already been reduced once, from 5 ether to the current 3 ether per block. The main point of a hard cap is that a lot of people consider &lt;em&gt;not issuing&lt;&#x2F;em&gt; as having a positive contribution, that can outweigh other actions. Burning ether is also a valid issuance decision.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;asics-and-advantages-of-pow&quot;&gt;Asics and advantages of PoW&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-969&quot;&gt;EIP-960&lt;&#x2F;a&gt; proposes a change in algorithm to avoid mining being dominated by ASICS. Counter arguments by Phil Daian argue among others than &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;pdaian.com&#x2F;blog&#x2F;anti-asic-forks-considered-harmful&#x2F;&quot;&gt;resisting economies of scale is futile and there might be specific security advantages to specialized hardware&lt;&#x2F;a&gt;. One of the main arguments for PoW mining, even when it doesn&#x27;t provide security, it is useful as a fair distribution mechanism, that &lt;strong&gt;PoW allows any person with a computer, internet access and electricity to obtain currency without having to deal with government imposed currency controls&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;recovery-forks&quot;&gt;Recovery Forks&lt;&#x2F;h4&gt;
&lt;p&gt;After the Parity Multisig library self destruction, three different strategies have been attempted to recover the funds: &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;gist.github.com&#x2F;5chdn&#x2F;a9bb8617cc8523a030126a3d1c60baf3&quot;&gt;a general protocol improvement to allow reviving self destructed contracts&lt;&#x2F;a&gt; (which was considered dangerous), a &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;pull&#x2F;867&quot;&gt;general process to recover funds&lt;&#x2F;a&gt; and a &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;999&#x2F;&quot;&gt;specific recovery of the multisig library&lt;&#x2F;a&gt;. The latter two are finding a lot of resistance from the community, but it&#x27;s unlikely that these issues are going away soon. The affected parties have a large incentive (fluctuating at almost half a billion dollars) to keep trying, and it&#x27;s an issue that is likely to occur again in the future. If they get reimbursed, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;156&quot;&gt;there are many other special cases of ether provably burnt or stuck&lt;&#x2F;a&gt; that might deserve the same treatment. If they get shut down, they have an incentive to move forward a fork implementation: even if they are a minority chain, it&#x27;s likely they&#x27;ll recover an amount larger than 0, which is what they would otherwise, and it means the main ethereum community might lose a valuable team of developers.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;other-public-goods&quot;&gt;Other Public Goods&lt;&#x2F;h4&gt;
&lt;p&gt;There are many other types of public goods that could be funded by issuance. By &lt;em&gt;Public Good&lt;&#x2F;em&gt;, I&#x27;m using a strict definition of something that brings value to everyone, both those who funded it and free-loaders, making it hard to fund it exclusively by traditional private incentives. They can be research, whole network security, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;908&#x2F;&quot;&gt;incentivize full clients and networking&lt;&#x2F;a&gt;, fair distribution of tokens etc.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;proposed-solution&quot;&gt;Proposed Solution&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;issuance-contract&quot;&gt;Issuance Contract&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP proposes a future hard fork where block reward is not issued to miners&#x2F;validators etherbase, but instead to a single contract, that then will activate the default function (with a fixed amount of gas) and then it will forward the ether to other contracts which will finally distribute to their final destinations.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;limits-on-the-contract&quot;&gt;Limits on the contract&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;it-can-only-deal-with-issuance&quot;&gt;It can only deal with issuance&lt;&#x2F;h5&gt;
&lt;p&gt;It&#x27;s not meant to be a general governance contract. The contract &lt;strong&gt;should NOT be used&lt;&#x2F;strong&gt; to decide software updates, to freeze funds, change contract balances or anything on the consensus layer other than the strict definition of &lt;em&gt;where block rewards go&lt;&#x2F;em&gt;. It should be seen as a platform to settle disputes to avoid the implementation of contentious hard forks, not as a mean to remove the power of users and developers to execute them.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;it-cannot-only-decrease-issuance-and-once-decreased-it-cannot-be-increased-again&quot;&gt;It cannot only decrease issuance, and once decreased it cannot be increased again&lt;&#x2F;h5&gt;
&lt;p&gt;In order to reduce future abuse and uncertainty, &lt;strong&gt;once issuance is reduced, it cannot be increased&lt;&#x2F;strong&gt;. To prevent a single action reducing it to 0, the reduction is limited up to a percentage per time, so if the &lt;strong&gt;decision assembly&lt;&#x2F;strong&gt; is aggressively to reduce issuance to zero, it would take a known number of years.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;results-are-locked-for-s&quot;&gt;Results are locked for s&lt;&#x2F;h5&gt;
&lt;p&gt;Whenever a new decision on either reducing the issuance or changing the target is made, the effects will have a six-month delay to it. Once a decision is made it is final, it will take place six months after that, but if it&#x27;s shortly reversed, then that change will be short lived. The rationale behind is that it allows time to anyone disagreeing with the decision to:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Sell their coins so that if a bad actor takes over they will have a reduced reward&lt;&#x2F;li&gt;
&lt;li&gt;Attempt to revert the decision as soon as possible, to reduce the duration that the change will take place&lt;&#x2F;li&gt;
&lt;li&gt;Organize to create counter measures against the decision&lt;&#x2F;li&gt;
&lt;li&gt;Implement a hard fork changing the decision contract or to remove the issuance contract altogether, as a last resort measure&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;interface&quot;&gt;Interface&lt;&#x2F;h5&gt;
&lt;p&gt;It would have the following interface:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;function targetContract() returns (address)&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;There&#x27;s a single target contract that should ether issued to. At each new block, that contract would have the default function called so it would forward to the intended addresses.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;function decisionAssembly() returns (address)&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;A contract that would represent the internal governance of decisions. More on this later.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;function reduceIssuance(uint)&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Can only be called by &lt;strong&gt;decision assembly&lt;&#x2F;strong&gt;. The contract is allowed to reduce or maintain the issuance per block. &lt;strong&gt;Change is not executed immediately, effects only happen six months later, but once a decision is committed it is irrevocable&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;function changeTargetContract(address)&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Can only be called by &lt;strong&gt;decision assembly&lt;&#x2F;strong&gt;. It changes the contract that will receive the funds in the future. Only one contract can be appointed, but if the community desires to split issuance or even burn a part of it (in a non-irrevocable manner) it can be done in that contract. Change is not executed immediately, &lt;strong&gt;effects only happen six months later&lt;&#x2F;strong&gt;, but once a decision is committed it is certain, even if it&#x27;s later reverted: if a new target contract is changed after a few hours, then it still means that in six month&#x27;s time, it would issue for that contract for a few hours.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;function executeDecision(uint)&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Can be called by anyone: it executes a change to issuance amount or target that had been scheduled six months prior.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;decision-assembly&quot;&gt;Decision Assembly&lt;&#x2F;h5&gt;
&lt;p&gt;A contract that has the power to decide the changes to issuance, the core of the governance of these decisions. The exact format of this governance is open to debate, but what follows is a suggestion:&lt;&#x2F;p&gt;
&lt;p&gt;The decision would be made by multiple signalling contracts, each one implemented by separate groups and representing one aspect of the community or one sort of measurement. Each signaling process would have a &lt;code&gt;int&lt;&#x2F;code&gt; bound in which they could vote and they would have their own internal process to decide that. As new governance methods are tested and debated, new signalling contracts should be added and removed. Suggested signalling contracts:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Futarchy and prediction markets based on multiple measures&lt;&#x2F;li&gt;
&lt;li&gt;Votes weighted by ether balance (optionally with multipliers if the voters were committed to locking votes)&lt;&#x2F;li&gt;
&lt;li&gt;Token votes, weighted by their own relative ether exchange rate&lt;&#x2F;li&gt;
&lt;li&gt;Votes by individual humans if a good sybil resistance, coercion mechanism is developed&lt;&#x2F;li&gt;
&lt;li&gt;Block-signalling, as a way to measure validators&#x2F;miners choices&lt;&#x2F;li&gt;
&lt;li&gt;Some sort of signalling representing developers, exchanges or other stakeholders&lt;&#x2F;li&gt;
&lt;li&gt;Any other proposed manner&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Since adding and removing signalling contracts, as well as changing their total weight would be controlled by the contract itself, it would be crucial that the first signalling contracts were a diverse set of interests, and that they were open to adding more signals as new governance is experimented as well as removing signals that stop representing the community.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;questions-to-be-debated&quot;&gt;Questions to be debated&lt;&#x2F;h3&gt;
&lt;p&gt;A lot of things are suggested in this EIP, so I would like to propose these questions to be debated:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Do we want to have dynamically changing block rewards, instead of having them be hard coded in the protocol?&lt;&#x2F;li&gt;
&lt;li&gt;If the answer above is yes, then what would be the best governance process to decide it, and what sorts of limits would we want that governance contract to have?&lt;&#x2F;li&gt;
&lt;li&gt;If the answer is a multi-signalling contract, then what sorts of signals would we want, what sort of relative weight should they have and what would be the process to add and remove them?&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Uniformity Between 0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B and 0x15E55EF43efA8348dDaeAa455F16C43B64917e3c</title>
        <published>2018-04-18T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Anderson Wesley</name><uri>https://github.com/andywesley</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1010/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/andywesley/EIPs/issues/1" />
        

        <id>https://wg-eips.ritovision.com/1010/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1010"
            label="EIP-1010" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1010/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;This document proposes to improve the uniformity of ether distribution
between wallet address &lt;code&gt;0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B&lt;&#x2F;code&gt; and
wallet address &lt;code&gt;0x15E55EF43efA8348dDaeAa455F16C43B64917e3c&lt;&#x2F;code&gt; which are
currently experiencing a significant non-uniformity.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;As of the date of this EIP, the difference in balance between
address &lt;code&gt;0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B&lt;&#x2F;code&gt; and address
&lt;code&gt;0x15E55EF43efA8348dDaeAa455F16C43B64917e3c&lt;&#x2F;code&gt; is far from equitable
or uniform, with the former having more than 365,000 ether
more than the latter. The distribution of ether between these two
addresses must be improved in order to protect the Ethereum economy
from centralized control. This will be accomplished by transferring
100,000 ether from the former address to the latter. This is a properly
motivated improvement in keeping with the core Ethereum philosophy of
decentralization.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal is necessary because the Ethereum protocol does not allow
the owner of an address which does not own an equitable amount of ether
to claim their share of ether from an address which owns a dangerously
centralized quantity. Rather than proposing an overly complicated generic
mechanism for any user to claim ether to which they believe they are
equitably entitled, this proposal will take the simple route of a one-time
transfer of 100,000 ether from &lt;code&gt;0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B&lt;&#x2F;code&gt;
to &lt;code&gt;0x15E55EF43efA8348dDaeAa455F16C43B64917e3c&lt;&#x2F;code&gt;. This avoids duplicating
the effort of other proposals and provides a net improvement to the
Ethereum project and community.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The balance of &lt;code&gt;0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B&lt;&#x2F;code&gt; will be decreased
by 100,000 ether. The balance of &lt;code&gt;0x15E55EF43efA8348dDaeAa455F16C43B64917e3c&lt;&#x2F;code&gt;
will be increased by 100,000 ether. No net change in the amount of extant
ether will occur unless at the time of implementation the former address does not
contain sufficient ether for such a deduction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The value 100,000 was chosen after careful technically sound analysis of various economic theories
developed over the past century. In spite of the fact that it is a convenient round
number, it is actually the exact output of a complex statistical process iterated to
determine the optimal distribution of ether between these addresses.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Clients that fail to implement this change will not be aware of the correct balances
for these addresses. This will create a hard fork. The implementation of this change
consistently among all clients as intended by the proposal process will be sufficient
to ensure that backwards compatibility is not a concern.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>tokenURI Interoperability</title>
        <published>2018-04-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Tommy Nicholas</name><uri>https://github.com/tomasienrbc</uri>
	</author>
	
	<author>
		<name>Matt Russo</name><uri>https://github.com/mateosu</uri>
	</author>
	
	<author>
		<name>John Zettler</name><uri>https://github.com/JohnZettler</uri>
	</author>
	
	<author>
		<name>Matt Condon</name><uri>https://github.com/shrugs</uri>
	</author>
	
	<author>
		<name>Gavin John</name><uri>https://github.com/Pandapip1</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1046/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-1046-erc-20-metadata-extension/13036" />
        

        <id>https://wg-eips.ritovision.com/1046/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1046"
            label="ERC-1046" />
        

        
        

        
        <summary type="html">Extends ERC-20 with an ERC-721-like tokenURI, and extends ERC-721 and ERC-1155 with interoperability</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1046/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; introduced a &lt;code&gt;tokenURI&lt;&#x2F;code&gt; function for non-fungible tokens to handle miscellaneous metadata such as:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;thumbnail image&lt;&#x2F;li&gt;
&lt;li&gt;title&lt;&#x2F;li&gt;
&lt;li&gt;description&lt;&#x2F;li&gt;
&lt;li&gt;special asset properties&lt;&#x2F;li&gt;
&lt;li&gt;etc.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This ERC adds a &lt;code&gt;tokenURI&lt;&#x2F;code&gt; function to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;, and extends &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; to enable interoperability between all three types of token URI.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;See the note about the metadata extension in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;#rationale&quot;&gt;ERC-721&lt;&#x2F;a&gt;. The same arguments apply to ERC-20.&lt;&#x2F;p&gt;
&lt;p&gt;Being able to use similar mechanisms to extract metadata for ERC-20, ERC-721, ERC-1155, and future standards is useful for determining:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;What type of token a contract is (if any);&lt;&#x2F;li&gt;
&lt;li&gt;How to display a token to a user, either in an asset listing page or on a dedicated token page; and&lt;&#x2F;li&gt;
&lt;li&gt;Determining the capabilities of the token&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;interoperability-metadata&quot;&gt;Interoperability Metadata&lt;&#x2F;h3&gt;
&lt;p&gt;The following TypeScript interface is used in later sections:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * Interoperability metadata.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * This can be extended by other proposals.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * All fields MUST be optional.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * **Not every field has to be a boolean.** Any optional JSON-serializable object can be used by extensions.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InteroperabilityMetadata&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * This MUST be true if this is ERC-1046 Token Metadata, otherwise, this MUST be omitted.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Setting this to true indicates to wallets that the address should be treated as an ERC-20 token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    erc1046&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; boolean&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; undefined&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * This MUST be true if this is ERC-721 Token Metadata, otherwise, this MUST be omitted.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Setting this to true indicates to wallets that the address should be treated as an ERC-721 token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    erc721&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; boolean&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; undefined&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * This MUST be true if this is ERC-1155 Token Metadata, otherwise, this MUST be omitted.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Setting this to true indicates to wallets that the address should be treated as an ERC-1155 token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    erc1155&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; boolean&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; undefined&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;erc-20-extension&quot;&gt;ERC-20 Extension&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;erc-20-interface-extension&quot;&gt;ERC-20 Interface Extension&lt;&#x2F;h4&gt;
&lt;p&gt;Compliant contracts MUST implement the following Solidity interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  ERC-20 Metadata Extension&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC20TokenMetadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is ERC20 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     Gets an ERC-721-like token URI&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;        The resolved data MUST be in JSON format and support ERC-1046&amp;#39;s ERC-20 Token Metadata Schema&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;erc-20-token-metadata-schema&quot;&gt;ERC-20 Token Metadata Schema&lt;&#x2F;h4&gt;
&lt;p&gt;The resolved JSON of the &lt;code&gt;tokenURI&lt;&#x2F;code&gt; described in the ERC-20 Interface Extension section MUST conform to the following TypeScript interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * Asset Metadata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC20TokenMetadata&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Interoperability, to differentiate between different types of tokens and their corresponding URIs.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    interop&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InteroperabilityMetadata&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * The name of the ERC-20 token. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * If the `name()` function is present in the ERC-20 token and returns a nonempty string, these MUST be the same value.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    name&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * The symbol of the ERC-20 token. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * If the `symbol()` function is present in the ERC-20 token and returns a nonempty string, these MUST be the same value.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    symbol&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * The decimals of the ERC-20 token. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * If the `decimals()` function is present in the ERC-20 token, these MUST be the same value.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Defaults to 18 if neither this parameter nor the ERC-20 `decimals()` function are present.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    decimals&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; number&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Provides a short one-paragraph description of the ERC-20 token, without any markup or newlines.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    description&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * A URI pointing to a resource with mime type `image&#x2F;*` that represents this token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * If the image is a bitmap, it SHOULD have a width between 320 and 1080 pixels&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * The image SHOULD have an aspect ratio between 1.91:1 and 4:5 inclusive.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    image&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * One or more URIs each pointing to a resource with mime type `image&#x2F;*` that represents this token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * If an image is a bitmap, it SHOULD have a width between 320 and 1080 pixels&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Images SHOULD have an aspect ratio between 1.91:1 and 4:5 inclusive.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    images&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * One or more URIs each pointing to a resource with mime type `image&#x2F;*` that represent an icon for this token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * If an image is a bitmap, it SHOULD have a width between 320 and 1080 pixels, and MUST have a height equal to its width&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Images MUST have an aspect ratio of 1:1, and use a transparent background&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    icons&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;erc-721-extension&quot;&gt;ERC-721 Extension&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;extension-to-the-erc-721-metadata-schema&quot;&gt;Extension to the ERC-721 Metadata Schema&lt;&#x2F;h4&gt;
&lt;p&gt;Contracts that implement ERC-721 and use its token metadata URI SHOULD to use the following TypeScript extension to the metadata URI:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721TokenMetadataInterop&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; extends&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; ERC721TokenMetadata&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Interoperability, to avoid confusion between different token URIs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    interop&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InteroperabilityMetadata&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;erc-1155-extension&quot;&gt;ERC-1155 Extension&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;erc-1155-interface-extension&quot;&gt;ERC-1155 Interface Extension&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt;-compliant contracts using the metadata extension SHOULD implement the following Solidity interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  ERC-1155 Metadata URI Interoperability Extension&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC1155TokenMetadataInterop&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is ERC1155 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         Gets an ERC-1046-compliant ERC-1155 token URI&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The token ID to get the URI of&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;            The resolved data MUST be in JSON format and support ERC-1046&amp;#39;s Extension to the ERC-1155 Token Metadata Schema&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                 This MUST be the same URI as the `uri(tokenId)` function, if present.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;extension-to-the-erc-1155-metadata-schema&quot;&gt;Extension to the ERC-1155 Metadata Schema&lt;&#x2F;h4&gt;
&lt;p&gt;Contracts that implement ERC-1155 and use its token metadata URI are RECOMMENDED to use the following extension to the metadata URI. Contracts that implement the interface described in the ERC-1155 Interface Extension section MUST use the following TypeScript extension:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC1155TokenMetadataInterop&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; extends&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; ERC1155TokenMetadata&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Interoperability, to avoid confusion between different token URIs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    interop&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InteroperabilityMetadata&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;miscellaneous-recommendations&quot;&gt;Miscellaneous Recommendations&lt;&#x2F;h3&gt;
&lt;p&gt;To save gas, it is RECOMMENDED for compliant contracts not to implement the &lt;code&gt;name()&lt;&#x2F;code&gt;, &lt;code&gt;symbol()&lt;&#x2F;code&gt;, or &lt;code&gt;decimals()&lt;&#x2F;code&gt; functions, and instead to only include them in the metadata URI. Additionally, for ERC-20 tokens, if the decimals is &lt;code&gt;18&lt;&#x2F;code&gt;, then it is NOT RECOMMENDED to include the &lt;code&gt;decimals&lt;&#x2F;code&gt; field in the metadata.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC makes adding metadata to ERC-20 tokens more straightforward for developers, with minimal to no disruption to the overall ecosystem. Using the same parameter name makes it easier to reuse code.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, the recommendations not to use ERC-20&#x27;s &lt;code&gt;name&lt;&#x2F;code&gt;, &lt;code&gt;symbol&lt;&#x2F;code&gt;, and &lt;code&gt;decimals&lt;&#x2F;code&gt; functions save gas.&lt;&#x2F;p&gt;
&lt;p&gt;Built-in interoperability is useful as otherwise it might not be easy to differentiate the type of the token. Interoperability could be done using &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt;, but static calls are time-inefficient for wallets and websites, and is generally inflexible. Instead, including interoperability data in the token URI increases flexibility while also giving a performance increase.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is fully backwards compatible as its implementation simply extends the functionality of ERC-20 tokens and is optional. Additionally, it makes backward compatible recommendations for ERC-721 and ERC-1155 tokens.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;server-side-request-forgery-ssrf&quot;&gt;Server-Side Request Forgery (SSRF)&lt;&#x2F;h3&gt;
&lt;p&gt;Wallets should be careful about making arbitrary requests to URLs. As such, it is recommended for wallets to sanitize the URI by whitelisting specific schemes and ports. A vulnerable wallet could be tricked into, for example, modifying data on a locally-hosted redis database.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Restore Contract Code at 0x863DF6BFa4469f3ead0bE8f9F2AAE51c91A907b4</title>
        <published>2018-04-04T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Afri Schoedon</name><uri>https://github.com/5chdn</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/999/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-999-restore-contract-code-at-0x863df6bfa4/130" />
        

        <id>https://wg-eips.ritovision.com/999/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:999"
            label="EIP-999" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/999/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;This document proposes to restore the contract code of the &lt;code&gt;WalletLibrary&lt;&#x2F;code&gt;
contract at &lt;code&gt;0x863DF6BFa4469f3ead0bE8f9F2AAE51c91A907b4&lt;&#x2F;code&gt; with a patched version.
The contract was accidentally self-destructed and renders a significant amount
of Ether inaccessible.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;WalletLibrary&lt;&#x2F;code&gt; contract was used by the
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.parity.io&#x2F;&quot;&gt;Parity Wallet&lt;&#x2F;a&gt; to reduce gas costs for users deploying
multi-signature wallets on the Ethereum blockchain. It contained basic
functionality such as confirming or revoking multi-signature transactions for
any wallet deployed that depends on this library. The
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;paritytech&#x2F;parity&#x2F;issues&#x2F;6995&quot;&gt;accidental self-destruction&lt;&#x2F;a&gt;
of the library contract caused significant amounts of Ether and other assets
owned by many different parties to be inaccessible. This proposal suggests
restoring the &lt;code&gt;WalletLibrary&lt;&#x2F;code&gt; by a
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;parity-contracts&#x2F;0x863df6bfa4&quot;&gt;patched&lt;&#x2F;a&gt; version to allow the
owners of the dependent multi-signature wallets regain access to their assets.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal is necessary because the Ethereum protocol does not allow the
restoration of self-destructed contracts and there is no other simple way to
enable the affected users and companies regaining access to their tokens and
Ether. In opposite to previously discussed proposals, this will not change any
EVM semantics and tries to achieve the goal of unfreezing the funds by a single
state transition as specified in the next section.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The self-destructed contract code at
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;etherscan.io&#x2F;address&#x2F;0x863df6bfa4469f3ead0be8f9f2aae51c91a907b4#code&quot;&gt;&lt;code&gt;0x863DF6BFa4469f3ead0bE8f9F2AAE51c91A907b4&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;
shall be replaced with a patched version of the
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;parity-contracts&#x2F;0x863df6bfa4&#x2F;blob&#x2F;master&#x2F;contracts&#x2F;walletLibrary.sol&quot;&gt;&lt;code&gt;walletLibrary.sol&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;
as reviewed, tested, and approved in
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;parity-contracts&#x2F;0x863df6bfa4&quot;&gt;parity-contracts&#x2F;0x863df6bfa4&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;606060405234156200000d57fe5b5b6000808054806001018281620000259190620002d9565b916000526020600020900160005b6000909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506200012081805480602002602001604051908101604052809291908181526020018280548015620000fd57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311620000b2575b505050505060016000620001286401000000000262001d46176401000000009004565b5b5062000330565b600060015411156200013a5760006000fd5b6200015981620001806401000000000262001d71176401000000009004565b620001798383620001c26401000000000262001d9c176401000000009004565b5b5b505050565b60006001541115620001925760006000fd5b80600281905550620001b7620002c16401000000000262001bcf176401000000009004565b6004819055505b5b50565b600060006001541115620001d65760006000fd5b600082111515620001e75760006000fd5b81835110151515620001f95760006000fd5b8251600181905550600090505b8251811015620002b35782818151811015156200021f57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff16600582600101610100811015156200025357fe5b0160005b508190555080600101610105600085848151811015156200027457fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b80600101905062000206565b816000819055505b5b505050565b60006201518042811515620002d257fe5b0490505b90565b815481835581811511620003035781836000526020600020918201910162000302919062000308565b5b505050565b6200032d91905b80821115620003295760008160009055506001016200030f565b5090565b90565b611ebf80620003406000396000f300606060405236156100ef576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063173825d91461016d5780632f54bf6e146101a35780634123cb6b146101f157806352375093146102175780635c52c2f51461023d578063659010e71461024f5780637065cb4814610275578063746c9171146102ab578063797af627146102d1578063b20d30a91461030d578063b61d27f61461032d578063b75c7dc61461039c578063ba51a6df146103c0578063c2cf7326146103e0578063c41a360a1461043b578063f00d4b5d1461049b578063f1736d86146104f0575b61016b5b6000341115610168577fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c3334604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b5b565b005b341561017557fe5b6101a1600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610516565b005b34156101ab57fe5b6101d7600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610659565b604051808215151515815260200191505060405180910390f35b34156101f957fe5b610201610691565b6040518082815260200191505060405180910390f35b341561021f57fe5b610227610697565b6040518082815260200191505060405180910390f35b341561024557fe5b61024d61069d565b005b341561025757fe5b61025f6106d7565b6040518082815260200191505060405180910390f35b341561027d57fe5b6102a9600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506106dd565b005b34156102b357fe5b6102bb610829565b6040518082815260200191505060405180910390f35b34156102d957fe5b6102f360048080356000191690602001909190505061082f565b604051808215151515815260200191505060405180910390f35b341561031557fe5b61032b6004808035906020019091905050610dcc565b005b341561033557fe5b61037e600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919080359060200190820180359060200191909192905050610e06565b60405180826000191660001916815260200191505060405180910390f35b34156103a457fe5b6103be60048080356000191690602001909190505061127d565b005b34156103c857fe5b6103de6004808035906020019091905050611392565b005b34156103e857fe5b61042160048080356000191690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061141a565b604051808215151515815260200191505060405180910390f35b341561044357fe5b610459600480803590602001909190505061149c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156104a357fe5b6104ee600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506114bf565b005b34156104f857fe5b610500611672565b6040518082815260200191505060405180910390f35b600060003660405180838380828437820191505092505050604051809103902061053f81611678565b156106535761010560008473ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549150600082141561057f57610652565b600160015403600054111561059357610652565b6000600583610100811015156105a557fe5b0160005b5081905550600061010560008573ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506105e6611890565b6105ee6119d0565b7f58619076adf5bb0943d100ef88d52d7c3fd691b19d3a9071b555b651fbf418da83604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a15b5b5b505050565b6000600061010560008473ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541190505b919050565b60015481565b60045481565b6000366040518083838082843782019150509250505060405180910390206106c481611678565b156106d35760006003819055505b5b5b50565b60035481565b60003660405180838380828437820191505092505050604051809103902061070481611678565b156108245761071282610659565b1561071c57610823565b610724611890565b60fa600154101515610739576107386119d0565b5b60fa60015410151561074a57610823565b6001600081548092919060010191905055508173ffffffffffffffffffffffffffffffffffffffff1660056001546101008110151561078557fe5b0160005b508190555060015461010560008473ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507f994a936646fe87ffe4f1e469d3d6aa417d6b855598397f323de5b449f765f0c382604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a15b5b5b5050565b60005481565b600060008261083d81611678565b15610dc45760006101086000866000191660001916815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415806108c757506000610108600086600019166000191681526020019081526020016000206001015414155b80610906575060006101086000866000191660001916815260200190815260200160002060020180546001816001161561010002031660029004905014155b15610dc25760006101086000866000191660001916815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610a5057610a496101086000866000191660001916815260200190815260200160002060010154610108600087600019166000191681526020019081526020016000206002018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610a3f5780601f10610a1457610100808354040283529160200191610a3f565b820191906000526020600020905b815481529060010190602001808311610a2257829003601f168201915b5050505050611b37565b9150610b71565b6101086000856000191660001916815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166101086000866000191660001916815260200190815260200160002060010154610108600087600019166000191681526020019081526020016000206002016040518082805460018160011615610100020316600290048015610b4a5780601f10610b1f57610100808354040283529160200191610b4a565b820191906000526020600020905b815481529060010190602001808311610b2d57829003601f168201915b505091505060006040518083038185876185025a03f1925050501515610b705760006000fd5b5b7fe3a3a4111a84df27d76b68dc721e65c7711605ea5eee4afd3a9c58195217365c338561010860008860001916600019168152602001908152602001600020600101546101086000896000191660001916815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1661010860008a6000191660001916815260200190815260200160002060020187604051808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200186600019166000191681526020018581526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001806020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828103825284818154600181600116156101000203166002900481526020019150805460018160011615610100020316600290048015610d475780601f10610d1c57610100808354040283529160200191610d47565b820191906000526020600020905b815481529060010190602001808311610d2a57829003601f168201915b505097505050505050505060405180910390a16101086000856000191660001916815260200190815260200160002060006000820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556001820160009055600282016000610db79190611be6565b505060019250610dc3565b5b5b5b5050919050565b600036604051808383808284378201915050925050506040518091039020610df381611678565b15610e0157816002819055505b5b5b5050565b60006000610e1333610659565b1561127357600084849050148015610e305750610e2f85611b51565b5b80610e3d57506001600054145b15610fed5760008673ffffffffffffffffffffffffffffffffffffffff161415610ea457610e9d8585858080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050611b37565b9050610ef3565b8573ffffffffffffffffffffffffffffffffffffffff168585856040518083838082843782019150509250505060006040518083038185876185025a03f1925050501515610ef25760006000fd5b5b7f9738cd1a8777c86b011f7b01d87d484217dc6ab5154a9d41eda5d14af8caf292338688878786604051808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001806020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281038252858582818152602001925080828437820191505097505050505050505060405180910390a1611271565b6000364360405180848480828437820191505082815260200193505050506040518091039020915060006101086000846000191660001916815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16148015611099575060006101086000846000191660001916815260200190815260200160002060010154145b80156110d85750600061010860008460001916600019168152602001908152602001600020600201805460018160011615610100020316600290049050145b1561118f57856101086000846000191660001916815260200190815260200160002060000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550846101086000846000191660001916815260200190815260200160002060010181905550838361010860008560001916600019168152602001908152602001600020600201919061118d929190611c2e565b505b6111988261082f565b1515611270577f1733cbb53659d713b79580f79f3f9ff215f78a7c7aa45890f3b89fc5cddfbf328233878988886040518087600019166000191681526020018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001806020018281038252848482818152602001925080828437820191505097505050505050505060405180910390a15b5b5b5b5b50949350505050565b60006000600061010560003373ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054925060008314156112be5761138c565b8260020a9150610106600085600019166000191681526020019081526020016000209050600082826001015416111561138b5780600001600081548092919060010191905055508181600101600082825403925050819055507fc7fb647e59b18047309aa15aad418e5d7ca96d173ad704f1031a2c3d7591734b3385604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182600019166000191681526020019250505060405180910390a15b5b50505050565b6000366040518083838082843782019150509250505060405180910390206113b981611678565b15611415576001548211156113cd57611414565b816000819055506113dc611890565b7facbdb084c721332ac59f9b8e392196c9eb0e4932862da8eb9beaf0dad4f550da826040518082815260200191505060405180910390a15b5b5b5050565b600060006000600061010660008760001916600019168152602001908152602001600020925061010560008673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549150600082141561147f5760009350611493565b8160020a9050600081846001015416141593505b50505092915050565b6000600560018301610100811015156114b157fe5b0160005b505490505b919050565b60006000366040518083838082843782019150509250505060405180910390206114e881611678565b1561166b576114f683610659565b156115005761166a565b61010560008573ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549150600082141561153b5761166a565b611543611890565b8273ffffffffffffffffffffffffffffffffffffffff166005836101008110151561156a57fe5b0160005b5081905550600061010560008673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508161010560008573ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c8484604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a15b5b5b50505050565b60025481565b600060006000600061010560003373ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054925060008314156116bb57611888565b6101066000866000191660001916815260200190815260200160002091506000826000015414156117455760005482600001819055506000826001018190555061010780548091906001016117109190611cae565b826002018190555084610107836002015481548110151561172d57fe5b906000526020600020900160005b5081600019169055505b8260020a90506000818360010154161415611887577fe1c52dc63b719ade82e8bea94cc41a0d5d28e4aaf536adb5e9cccc9ff8c1aeda3386604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182600019166000191681526020019250505060405180910390a16001826000015411151561185e57610107610106600087600019166000191681526020019081526020016000206002015481548110151561180a57fe5b906000526020600020900160005b5060009055610106600086600019166000191681526020019081526020016000206000600082016000905560018201600090556002820160009055505060019350611888565b8160000160008154809291906001900391905055508082600101600082825417925050819055505b5b5b505050919050565b60006000610107805490509150600090505b818110156119bc576101086000610107838154811015156118bf57fe5b906000526020600020900160005b50546000191660001916815260200190815260200160002060006000820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905560018201600090556002820160006119269190611be6565b505060006001026101078281548110151561193d57fe5b906000526020600020900160005b5054600019161415156119b05761010660006101078381548110151561196d57fe5b906000526020600020900160005b505460001916600019168152602001908152602001600020600060008201600090556001820160009055600282016000905550505b5b8060010190506118a2565b61010760006119cb9190611cda565b5b5050565b6000600190505b600154811015611b33575b60015481108015611a095750600060058261010081101515611a0057fe5b0160005b505414155b15611a1b5780806001019150506119e2565b5b6001600154118015611a4557506000600560015461010081101515611a3d57fe5b0160005b5054145b15611a625760016000815480929190600190039190505550611a1c565b60015481108015611a8b57506000600560015461010081101515611a8257fe5b0160005b505414155b8015611aac5750600060058261010081101515611aa457fe5b0160005b5054145b15611b2e57600560015461010081101515611ac357fe5b0160005b505460058261010081101515611ad957fe5b0160005b508190555080610105600060058461010081101515611af857fe5b0160005b50548152602001908152602001600020819055506000600560015461010081101515611b2457fe5b0160005b50819055505b6119d7565b5b50565b600081516020830184f09050803b15610000575b92915050565b6000611b5c33610659565b15611bc957600454611b6c611bcf565b1115611b89576000600381905550611b82611bcf565b6004819055505b600354826003540110158015611ba55750600254826003540111155b15611bc3578160036000828254019250508190555060019050611bc8565b600090505b5b5b919050565b60006201518042811515611bdf57fe5b0490505b90565b50805460018160011615610100020316600290046000825580601f10611c0c5750611c2b565b601f016020900490600052602060002090810190611c2a9190611cfc565b5b50565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611c6f57803560ff1916838001178555611c9d565b82800160010185558215611c9d579182015b82811115611c9c578235825591602001919060010190611c81565b5b509050611caa9190611cfc565b5090565b815481835581811511611cd557818360005260206000209182019101611cd49190611d21565b5b505050565b5080546000825590600052602060002090810190611cf89190611d21565b5b50565b611d1e91905b80821115611d1a576000816000905550600101611d02565b5090565b90565b611d4391905b80821115611d3f576000816000905550600101611d27565b5090565b90565b60006001541115611d575760006000fd5b611d6081611d71565b611d6a8383611d9c565b5b5b505050565b60006001541115611d825760006000fd5b80600281905550611d91611bcf565b6004819055505b5b50565b600060006001541115611daf5760006000fd5b600082111515611dbf5760006000fd5b81835110151515611dd05760006000fd5b8251600181905550600090505b8251811015611e85578281815181101515611df457fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1660058260010161010081101515611e2757fe5b0160005b50819055508060010161010560008584815181101515611e4757fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b806001019050611ddd565b816000819055505b5b5050505600a165627a7a7230582016889f0740f073d397f9d00b0d19900fb050b957e3e2942f861085beb9baab180029&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;opcodes&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;PUSH1 0x60 PUSH1 0x40 MSTORE CALLVALUE ISZERO PUSH3 0xD JUMPI INVALID JUMPDEST JUMPDEST PUSH1 0x0 DUP1 DUP1 SLOAD DUP1 PUSH1 0x1 ADD DUP3 DUP2 PUSH3 0x25 SWAP2 SWAP1 PUSH3 0x2D9 JUMP JUMPDEST SWAP2 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 SHA3 SWAP1 ADD PUSH1 0x0 JUMPDEST PUSH1 0x0 SWAP1 SWAP2 SWAP1 SWAP2 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF MUL NOT AND SWAP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND MUL OR SWAP1 SSTORE POP POP PUSH3 0x120 DUP2 DUP1 SLOAD DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP1 SLOAD DUP1 ISZERO PUSH3 0xFD JUMPI PUSH1 0x20 MUL DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 SHA3 SWAP1 JUMPDEST DUP2 PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 PUSH1 0x1 ADD SWAP1 DUP1 DUP4 GT PUSH3 0xB2 JUMPI JUMPDEST POP POP POP POP POP PUSH1 0x1 PUSH1 0x0 PUSH3 0x128 PUSH5 0x100000000 MUL PUSH3 0x1D46 OR PUSH5 0x100000000 SWAP1 DIV JUMP JUMPDEST JUMPDEST POP PUSH3 0x330 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1 SLOAD GT ISZERO PUSH3 0x13A JUMPI PUSH1 0x0 PUSH1 0x0 REVERT JUMPDEST PUSH3 0x159 DUP2 PUSH3 0x180 PUSH5 0x100000000 MUL PUSH3 0x1D71 OR PUSH5 0x100000000 SWAP1 DIV JUMP JUMPDEST PUSH3 0x179 DUP4 DUP4 PUSH3 0x1C2 PUSH5 0x100000000 MUL PUSH3 0x1D9C OR PUSH5 0x100000000 SWAP1 DIV JUMP JUMPDEST JUMPDEST JUMPDEST POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1 SLOAD GT ISZERO PUSH3 0x192 JUMPI PUSH1 0x0 PUSH1 0x0 REVERT JUMPDEST DUP1 PUSH1 0x2 DUP2 SWAP1 SSTORE POP PUSH3 0x1B7 PUSH3 0x2C1 PUSH5 0x100000000 MUL PUSH3 0x1BCF OR PUSH5 0x100000000 SWAP1 DIV JUMP JUMPDEST PUSH1 0x4 DUP2 SWAP1 SSTORE POP JUMPDEST JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x0 PUSH1 0x1 SLOAD GT ISZERO PUSH3 0x1D6 JUMPI PUSH1 0x0 PUSH1 0x0 REVERT JUMPDEST PUSH1 0x0 DUP3 GT ISZERO ISZERO PUSH3 0x1E7 JUMPI PUSH1 0x0 PUSH1 0x0 REVERT JUMPDEST DUP2 DUP4 MLOAD LT ISZERO ISZERO ISZERO PUSH3 0x1F9 JUMPI PUSH1 0x0 PUSH1 0x0 REVERT JUMPDEST DUP3 MLOAD PUSH1 0x1 DUP2 SWAP1 SSTORE POP PUSH1 0x0 SWAP1 POP JUMPDEST DUP3 MLOAD DUP2 LT ISZERO PUSH3 0x2B3 JUMPI DUP3 DUP2 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH3 0x21F JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x5 DUP3 PUSH1 0x1 ADD PUSH2 0x100 DUP2 LT ISZERO ISZERO PUSH3 0x253 JUMPI INVALID JUMPDEST ADD PUSH1 0x0 JUMPDEST POP DUP2 SWAP1 SSTORE POP DUP1 PUSH1 0x1 ADD PUSH2 0x105 PUSH1 0x0 DUP6 DUP5 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH3 0x274 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 DUP2 SWAP1 SSTORE POP JUMPDEST DUP1 PUSH1 0x1 ADD SWAP1 POP PUSH3 0x206 JUMP JUMPDEST DUP2 PUSH1 0x0 DUP2 SWAP1 SSTORE POP JUMPDEST JUMPDEST POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH3 0x15180 TIMESTAMP DUP2 ISZERO ISZERO PUSH3 0x2D2 JUMPI INVALID JUMPDEST DIV SWAP1 POP JUMPDEST SWAP1 JUMP JUMPDEST DUP2 SLOAD DUP2 DUP4 SSTORE DUP2 DUP2 ISZERO GT PUSH3 0x303 JUMPI DUP2 DUP4 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 SHA3 SWAP2 DUP3 ADD SWAP2 ADD PUSH3 0x302 SWAP2 SWAP1 PUSH3 0x308 JUMP JUMPDEST JUMPDEST POP POP POP JUMP JUMPDEST PUSH3 0x32D SWAP2 SWAP1 JUMPDEST DUP1 DUP3 GT ISZERO PUSH3 0x329 JUMPI PUSH1 0x0 DUP2 PUSH1 0x0 SWAP1 SSTORE POP PUSH1 0x1 ADD PUSH3 0x30F JUMP JUMPDEST POP SWAP1 JUMP JUMPDEST SWAP1 JUMP JUMPDEST PUSH2 0x1EBF DUP1 PUSH3 0x340 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN STOP PUSH1 0x60 PUSH1 0x40 MSTORE CALLDATASIZE ISZERO PUSH2 0xEF JUMPI PUSH1 0x0 CALLDATALOAD PUSH29 0x100000000000000000000000000000000000000000000000000000000 SWAP1 DIV PUSH4 0xFFFFFFFF AND DUP1 PUSH4 0x173825D9 EQ PUSH2 0x16D JUMPI DUP1 PUSH4 0x2F54BF6E EQ PUSH2 0x1A3 JUMPI DUP1 PUSH4 0x4123CB6B EQ PUSH2 0x1F1 JUMPI DUP1 PUSH4 0x52375093 EQ PUSH2 0x217 JUMPI DUP1 PUSH4 0x5C52C2F5 EQ PUSH2 0x23D JUMPI DUP1 PUSH4 0x659010E7 EQ PUSH2 0x24F JUMPI DUP1 PUSH4 0x7065CB48 EQ PUSH2 0x275 JUMPI DUP1 PUSH4 0x746C9171 EQ PUSH2 0x2AB JUMPI DUP1 PUSH4 0x797AF627 EQ PUSH2 0x2D1 JUMPI DUP1 PUSH4 0xB20D30A9 EQ PUSH2 0x30D JUMPI DUP1 PUSH4 0xB61D27F6 EQ PUSH2 0x32D JUMPI DUP1 PUSH4 0xB75C7DC6 EQ PUSH2 0x39C JUMPI DUP1 PUSH4 0xBA51A6DF EQ PUSH2 0x3C0 JUMPI DUP1 PUSH4 0xC2CF7326 EQ PUSH2 0x3E0 JUMPI DUP1 PUSH4 0xC41A360A EQ PUSH2 0x43B JUMPI DUP1 PUSH4 0xF00D4B5D EQ PUSH2 0x49B JUMPI DUP1 PUSH4 0xF1736D86 EQ PUSH2 0x4F0 JUMPI JUMPDEST PUSH2 0x16B JUMPDEST PUSH1 0x0 CALLVALUE GT ISZERO PUSH2 0x168 JUMPI PUSH32 0xE1FFFCC4923D04B559F4D29A8BFC6CDA04EB5B0D3C460751C2402C5C5CC9109C CALLER CALLVALUE PUSH1 0x40 MLOAD DUP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP2 MSTORE PUSH1 0x20 ADD SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG1 JUMPDEST JUMPDEST JUMP JUMPDEST STOP JUMPDEST CALLVALUE ISZERO PUSH2 0x175 JUMPI INVALID JUMPDEST PUSH2 0x1A1 PUSH1 0x4 DUP1 DUP1 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 PUSH1 0x20 ADD SWAP1 SWAP2 SWAP1 POP POP PUSH2 0x516 JUMP JUMPDEST STOP JUMPDEST CALLVALUE ISZERO PUSH2 0x1AB JUMPI INVALID JUMPDEST PUSH2 0x1D7 PUSH1 0x4 DUP1 DUP1 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 PUSH1 0x20 ADD SWAP1 SWAP2 SWAP1 POP POP PUSH2 0x659 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 DUP3 ISZERO ISZERO ISZERO ISZERO DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE ISZERO PUSH2 0x1F9 JUMPI INVALID JUMPDEST PUSH2 0x201 PUSH2 0x691 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 DUP3 DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE ISZERO PUSH2 0x21F JUMPI INVALID JUMPDEST PUSH2 0x227 PUSH2 0x697 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 DUP3 DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE ISZERO PUSH2 0x245 JUMPI INVALID JUMPDEST PUSH2 0x24D PUSH2 0x69D JUMP JUMPDEST STOP JUMPDEST CALLVALUE ISZERO PUSH2 0x257 JUMPI INVALID JUMPDEST PUSH2 0x25F PUSH2 0x6D7 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 DUP3 DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE ISZERO PUSH2 0x27D JUMPI INVALID JUMPDEST PUSH2 0x2A9 PUSH1 0x4 DUP1 DUP1 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 PUSH1 0x20 ADD SWAP1 SWAP2 SWAP1 POP POP PUSH2 0x6DD JUMP JUMPDEST STOP JUMPDEST CALLVALUE ISZERO PUSH2 0x2B3 JUMPI INVALID JUMPDEST PUSH2 0x2BB PUSH2 0x829 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 DUP3 DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE ISZERO PUSH2 0x2D9 JUMPI INVALID JUMPDEST PUSH2 0x2F3 PUSH1 0x4 DUP1 DUP1 CALLDATALOAD PUSH1 0x0 NOT AND SWAP1 PUSH1 0x20 ADD SWAP1 SWAP2 SWAP1 POP POP PUSH2 0x82F JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 DUP3 ISZERO ISZERO ISZERO ISZERO DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE ISZERO PUSH2 0x315 JUMPI INVALID JUMPDEST PUSH2 0x32B PUSH1 0x4 DUP1 DUP1 CALLDATALOAD SWAP1 PUSH1 0x20 ADD SWAP1 SWAP2 SWAP1 POP POP PUSH2 0xDCC JUMP JUMPDEST STOP JUMPDEST CALLVALUE ISZERO PUSH2 0x335 JUMPI INVALID JUMPDEST PUSH2 0x37E PUSH1 0x4 DUP1 DUP1 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 PUSH1 0x20 ADD SWAP1 SWAP2 SWAP1 DUP1 CALLDATALOAD SWAP1 PUSH1 0x20 ADD SWAP1 SWAP2 SWAP1 DUP1 CALLDATALOAD SWAP1 PUSH1 0x20 ADD SWAP1 DUP3 ADD DUP1 CALLDATALOAD SWAP1 PUSH1 0x20 ADD SWAP2 SWAP1 SWAP2 SWAP3 SWAP1 POP POP PUSH2 0xE06 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 DUP3 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE ISZERO PUSH2 0x3A4 JUMPI INVALID JUMPDEST PUSH2 0x3BE PUSH1 0x4 DUP1 DUP1 CALLDATALOAD PUSH1 0x0 NOT AND SWAP1 PUSH1 0x20 ADD SWAP1 SWAP2 SWAP1 POP POP PUSH2 0x127D JUMP JUMPDEST STOP JUMPDEST CALLVALUE ISZERO PUSH2 0x3C8 JUMPI INVALID JUMPDEST PUSH2 0x3DE PUSH1 0x4 DUP1 DUP1 CALLDATALOAD SWAP1 PUSH1 0x20 ADD SWAP1 SWAP2 SWAP1 POP POP PUSH2 0x1392 JUMP JUMPDEST STOP JUMPDEST CALLVALUE ISZERO PUSH2 0x3E8 JUMPI INVALID JUMPDEST PUSH2 0x421 PUSH1 0x4 DUP1 DUP1 CALLDATALOAD PUSH1 0x0 NOT AND SWAP1 PUSH1 0x20 ADD SWAP1 SWAP2 SWAP1 DUP1 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 PUSH1 0x20 ADD SWAP1 SWAP2 SWAP1 POP POP PUSH2 0x141A JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 DUP3 ISZERO ISZERO ISZERO ISZERO DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE ISZERO PUSH2 0x443 JUMPI INVALID JUMPDEST PUSH2 0x459 PUSH1 0x4 DUP1 DUP1 CALLDATALOAD SWAP1 PUSH1 0x20 ADD SWAP1 SWAP2 SWAP1 POP POP PUSH2 0x149C JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 DUP3 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE ISZERO PUSH2 0x4A3 JUMPI INVALID JUMPDEST PUSH2 0x4EE PUSH1 0x4 DUP1 DUP1 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 PUSH1 0x20 ADD SWAP1 SWAP2 SWAP1 DUP1 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 PUSH1 0x20 ADD SWAP1 SWAP2 SWAP1 POP POP PUSH2 0x14BF JUMP JUMPDEST STOP JUMPDEST CALLVALUE ISZERO PUSH2 0x4F8 JUMPI INVALID JUMPDEST PUSH2 0x500 PUSH2 0x1672 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 DUP3 DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH1 0x0 PUSH1 0x0 CALLDATASIZE PUSH1 0x40 MLOAD DUP1 DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY DUP3 ADD SWAP2 POP POP SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 SHA3 PUSH2 0x53F DUP2 PUSH2 0x1678 JUMP JUMPDEST ISZERO PUSH2 0x653 JUMPI PUSH2 0x105 PUSH1 0x0 DUP5 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 SLOAD SWAP2 POP PUSH1 0x0 DUP3 EQ ISZERO PUSH2 0x57F JUMPI PUSH2 0x652 JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 SLOAD SUB PUSH1 0x0 SLOAD GT ISZERO PUSH2 0x593 JUMPI PUSH2 0x652 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x5 DUP4 PUSH2 0x100 DUP2 LT ISZERO ISZERO PUSH2 0x5A5 JUMPI INVALID JUMPDEST ADD PUSH1 0x0 JUMPDEST POP DUP2 SWAP1 SSTORE POP PUSH1 0x0 PUSH2 0x105 PUSH1 0x0 DUP6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 DUP2 SWAP1 SSTORE POP PUSH2 0x5E6 PUSH2 0x1890 JUMP JUMPDEST PUSH2 0x5EE PUSH2 0x19D0 JUMP JUMPDEST PUSH32 0x58619076ADF5BB0943D100EF88D52D7C3FD691B19D3A9071B555B651FBF418DA DUP4 PUSH1 0x40 MLOAD DUP1 DUP3 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG1 JUMPDEST JUMPDEST JUMPDEST POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x0 PUSH2 0x105 PUSH1 0x0 DUP5 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 SLOAD GT SWAP1 POP JUMPDEST SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x1 SLOAD DUP2 JUMP JUMPDEST PUSH1 0x4 SLOAD DUP2 JUMP JUMPDEST PUSH1 0x0 CALLDATASIZE PUSH1 0x40 MLOAD DUP1 DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY DUP3 ADD SWAP2 POP POP SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 SHA3 PUSH2 0x6C4 DUP2 PUSH2 0x1678 JUMP JUMPDEST ISZERO PUSH2 0x6D3 JUMPI PUSH1 0x0 PUSH1 0x3 DUP2 SWAP1 SSTORE POP JUMPDEST JUMPDEST JUMPDEST POP JUMP JUMPDEST PUSH1 0x3 SLOAD DUP2 JUMP JUMPDEST PUSH1 0x0 CALLDATASIZE PUSH1 0x40 MLOAD DUP1 DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY DUP3 ADD SWAP2 POP POP SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 SHA3 PUSH2 0x704 DUP2 PUSH2 0x1678 JUMP JUMPDEST ISZERO PUSH2 0x824 JUMPI PUSH2 0x712 DUP3 PUSH2 0x659 JUMP JUMPDEST ISZERO PUSH2 0x71C JUMPI PUSH2 0x823 JUMP JUMPDEST PUSH2 0x724 PUSH2 0x1890 JUMP JUMPDEST PUSH1 0xFA PUSH1 0x1 SLOAD LT ISZERO ISZERO PUSH2 0x739 JUMPI PUSH2 0x738 PUSH2 0x19D0 JUMP JUMPDEST JUMPDEST PUSH1 0xFA PUSH1 0x1 SLOAD LT ISZERO ISZERO PUSH2 0x74A JUMPI PUSH2 0x823 JUMP JUMPDEST PUSH1 0x1 PUSH1 0x0 DUP2 SLOAD DUP1 SWAP3 SWAP2 SWAP1 PUSH1 0x1 ADD SWAP2 SWAP1 POP SSTORE POP DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x5 PUSH1 0x1 SLOAD PUSH2 0x100 DUP2 LT ISZERO ISZERO PUSH2 0x785 JUMPI INVALID JUMPDEST ADD PUSH1 0x0 JUMPDEST POP DUP2 SWAP1 SSTORE POP PUSH1 0x1 SLOAD PUSH2 0x105 PUSH1 0x0 DUP5 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 DUP2 SWAP1 SSTORE POP PUSH32 0x994A936646FE87FFE4F1E469D3D6AA417D6B855598397F323DE5B449F765F0C3 DUP3 PUSH1 0x40 MLOAD DUP1 DUP3 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG1 JUMPDEST JUMPDEST JUMPDEST POP POP JUMP JUMPDEST PUSH1 0x0 SLOAD DUP2 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x0 DUP3 PUSH2 0x83D DUP2 PUSH2 0x1678 JUMP JUMPDEST ISZERO PUSH2 0xDC4 JUMPI PUSH1 0x0 PUSH2 0x108 PUSH1 0x0 DUP7 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 PUSH1 0x0 ADD PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ ISZERO DUP1 PUSH2 0x8C7 JUMPI POP PUSH1 0x0 PUSH2 0x108 PUSH1 0x0 DUP7 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 PUSH1 0x1 ADD SLOAD EQ ISZERO JUMPDEST DUP1 PUSH2 0x906 JUMPI POP PUSH1 0x0 PUSH2 0x108 PUSH1 0x0 DUP7 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 PUSH1 0x2 ADD DUP1 SLOAD PUSH1 0x1 DUP2 PUSH1 0x1 AND ISZERO PUSH2 0x100 MUL SUB AND PUSH1 0x2 SWAP1 DIV SWAP1 POP EQ ISZERO JUMPDEST ISZERO PUSH2 0xDC2 JUMPI PUSH1 0x0 PUSH2 0x108 PUSH1 0x0 DUP7 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 PUSH1 0x0 ADD PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ ISZERO PUSH2 0xA50 JUMPI PUSH2 0xA49 PUSH2 0x108 PUSH1 0x0 DUP7 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 PUSH1 0x1 ADD SLOAD PUSH2 0x108 PUSH1 0x0 DUP8 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 PUSH1 0x2 ADD DUP1 SLOAD PUSH1 0x1 DUP2 PUSH1 0x1 AND ISZERO PUSH2 0x100 MUL SUB AND PUSH1 0x2 SWAP1 DIV DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP1 SLOAD PUSH1 0x1 DUP2 PUSH1 0x1 AND ISZERO PUSH2 0x100 MUL SUB AND PUSH1 0x2 SWAP1 DIV DUP1 ISZERO PUSH2 0xA3F JUMPI DUP1 PUSH1 0x1F LT PUSH2 0xA14 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0xA3F JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 SHA3 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0xA22 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP PUSH2 0x1B37 JUMP JUMPDEST SWAP2 POP PUSH2 0xB71 JUMP JUMPDEST PUSH2 0x108 PUSH1 0x0 DUP6 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 PUSH1 0x0 ADD PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH2 0x108 PUSH1 0x0 DUP7 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 PUSH1 0x1 ADD SLOAD PUSH2 0x108 PUSH1 0x0 DUP8 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 PUSH1 0x2 ADD PUSH1 0x40 MLOAD DUP1 DUP3 DUP1 SLOAD PUSH1 0x1 DUP2 PUSH1 0x1 AND ISZERO PUSH2 0x100 MUL SUB AND PUSH1 0x2 SWAP1 DIV DUP1 ISZERO PUSH2 0xB4A JUMPI DUP1 PUSH1 0x1F LT PUSH2 0xB1F JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0xB4A JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 SHA3 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0xB2D JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP SWAP2 POP POP PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP6 DUP8 PUSH2 0x8502 GAS SUB CALL SWAP3 POP POP POP ISZERO ISZERO PUSH2 0xB70 JUMPI PUSH1 0x0 PUSH1 0x0 REVERT JUMPDEST JUMPDEST PUSH32 0xE3A3A4111A84DF27D76B68DC721E65C7711605EA5EEE4AFD3A9C58195217365C CALLER DUP6 PUSH2 0x108 PUSH1 0x0 DUP9 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 PUSH1 0x1 ADD SLOAD PUSH2 0x108 PUSH1 0x0 DUP10 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 PUSH1 0x0 ADD PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH2 0x108 PUSH1 0x0 DUP11 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 PUSH1 0x2 ADD DUP8 PUSH1 0x40 MLOAD DUP1 DUP8 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD DUP7 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD DUP6 DUP2 MSTORE PUSH1 0x20 ADD DUP5 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD DUP1 PUSH1 0x20 ADD DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP2 SUB DUP3 MSTORE DUP5 DUP2 DUP2 SLOAD PUSH1 0x1 DUP2 PUSH1 0x1 AND ISZERO PUSH2 0x100 MUL SUB AND PUSH1 0x2 SWAP1 DIV DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP DUP1 SLOAD PUSH1 0x1 DUP2 PUSH1 0x1 AND ISZERO PUSH2 0x100 MUL SUB AND PUSH1 0x2 SWAP1 DIV DUP1 ISZERO PUSH2 0xD47 JUMPI DUP1 PUSH1 0x1F LT PUSH2 0xD1C JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0xD47 JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 SHA3 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0xD2A JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP SWAP8 POP POP POP POP POP POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG1 PUSH2 0x108 PUSH1 0x0 DUP6 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 PUSH1 0x0 PUSH1 0x0 DUP3 ADD PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD SWAP1 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF MUL NOT AND SWAP1 SSTORE PUSH1 0x1 DUP3 ADD PUSH1 0x0 SWAP1 SSTORE PUSH1 0x2 DUP3 ADD PUSH1 0x0 PUSH2 0xDB7 SWAP2 SWAP1 PUSH2 0x1BE6 JUMP JUMPDEST POP POP PUSH1 0x1 SWAP3 POP PUSH2 0xDC3 JUMP JUMPDEST JUMPDEST JUMPDEST JUMPDEST POP POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 CALLDATASIZE PUSH1 0x40 MLOAD DUP1 DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY DUP3 ADD SWAP2 POP POP SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 SHA3 PUSH2 0xDF3 DUP2 PUSH2 0x1678 JUMP JUMPDEST ISZERO PUSH2 0xE01 JUMPI DUP2 PUSH1 0x2 DUP2 SWAP1 SSTORE POP JUMPDEST JUMPDEST JUMPDEST POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x0 PUSH2 0xE13 CALLER PUSH2 0x659 JUMP JUMPDEST ISZERO PUSH2 0x1273 JUMPI PUSH1 0x0 DUP5 DUP5 SWAP1 POP EQ DUP1 ISZERO PUSH2 0xE30 JUMPI POP PUSH2 0xE2F DUP6 PUSH2 0x1B51 JUMP JUMPDEST JUMPDEST DUP1 PUSH2 0xE3D JUMPI POP PUSH1 0x1 PUSH1 0x0 SLOAD EQ JUMPDEST ISZERO PUSH2 0xFED JUMPI PUSH1 0x0 DUP7 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ ISZERO PUSH2 0xEA4 JUMPI PUSH2 0xE9D DUP6 DUP6 DUP6 DUP1 DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP4 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY DUP3 ADD SWAP2 POP POP POP POP POP POP PUSH2 0x1B37 JUMP JUMPDEST SWAP1 POP PUSH2 0xEF3 JUMP JUMPDEST DUP6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP6 DUP6 DUP6 PUSH1 0x40 MLOAD DUP1 DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY DUP3 ADD SWAP2 POP POP SWAP3 POP POP POP PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP6 DUP8 PUSH2 0x8502 GAS SUB CALL SWAP3 POP POP POP ISZERO ISZERO PUSH2 0xEF2 JUMPI PUSH1 0x0 PUSH1 0x0 REVERT JUMPDEST JUMPDEST PUSH32 0x9738CD1A8777C86B011F7B01D87D484217DC6AB5154A9D41EDA5D14AF8CAF292 CALLER DUP7 DUP9 DUP8 DUP8 DUP7 PUSH1 0x40 MLOAD DUP1 DUP8 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD DUP7 DUP2 MSTORE PUSH1 0x20 ADD DUP6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD DUP1 PUSH1 0x20 ADD DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP2 SUB DUP3 MSTORE DUP6 DUP6 DUP3 DUP2 DUP2 MSTORE PUSH1 0x20 ADD SWAP3 POP DUP1 DUP3 DUP5 CALLDATACOPY DUP3 ADD SWAP2 POP POP SWAP8 POP POP POP POP POP POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG1 PUSH2 0x1271 JUMP JUMPDEST PUSH1 0x0 CALLDATASIZE NUMBER PUSH1 0x40 MLOAD DUP1 DUP5 DUP5 DUP1 DUP3 DUP5 CALLDATACOPY DUP3 ADD SWAP2 POP POP DUP3 DUP2 MSTORE PUSH1 0x20 ADD SWAP4 POP POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 SHA3 SWAP2 POP PUSH1 0x0 PUSH2 0x108 PUSH1 0x0 DUP5 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 PUSH1 0x0 ADD PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ DUP1 ISZERO PUSH2 0x1099 JUMPI POP PUSH1 0x0 PUSH2 0x108 PUSH1 0x0 DUP5 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 PUSH1 0x1 ADD SLOAD EQ JUMPDEST DUP1 ISZERO PUSH2 0x10D8 JUMPI POP PUSH1 0x0 PUSH2 0x108 PUSH1 0x0 DUP5 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 PUSH1 0x2 ADD DUP1 SLOAD PUSH1 0x1 DUP2 PUSH1 0x1 AND ISZERO PUSH2 0x100 MUL SUB AND PUSH1 0x2 SWAP1 DIV SWAP1 POP EQ JUMPDEST ISZERO PUSH2 0x118F JUMPI DUP6 PUSH2 0x108 PUSH1 0x0 DUP5 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 PUSH1 0x0 ADD PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF MUL NOT AND SWAP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND MUL OR SWAP1 SSTORE POP DUP5 PUSH2 0x108 PUSH1 0x0 DUP5 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 PUSH1 0x1 ADD DUP2 SWAP1 SSTORE POP DUP4 DUP4 PUSH2 0x108 PUSH1 0x0 DUP6 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 PUSH1 0x2 ADD SWAP2 SWAP1 PUSH2 0x118D SWAP3 SWAP2 SWAP1 PUSH2 0x1C2E JUMP JUMPDEST POP JUMPDEST PUSH2 0x1198 DUP3 PUSH2 0x82F JUMP JUMPDEST ISZERO ISZERO PUSH2 0x1270 JUMPI PUSH32 0x1733CBB53659D713B79580F79F3F9FF215F78A7C7AA45890F3B89FC5CDDFBF32 DUP3 CALLER DUP8 DUP10 DUP9 DUP9 PUSH1 0x40 MLOAD DUP1 DUP8 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD DUP7 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD DUP6 DUP2 MSTORE PUSH1 0x20 ADD DUP5 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD DUP1 PUSH1 0x20 ADD DUP3 DUP2 SUB DUP3 MSTORE DUP5 DUP5 DUP3 DUP2 DUP2 MSTORE PUSH1 0x20 ADD SWAP3 POP DUP1 DUP3 DUP5 CALLDATACOPY DUP3 ADD SWAP2 POP POP SWAP8 POP POP POP POP POP POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG1 JUMPDEST JUMPDEST JUMPDEST JUMPDEST JUMPDEST POP SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x0 PUSH1 0x0 PUSH2 0x105 PUSH1 0x0 CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 SLOAD SWAP3 POP PUSH1 0x0 DUP4 EQ ISZERO PUSH2 0x12BE JUMPI PUSH2 0x138C JUMP JUMPDEST DUP3 PUSH1 0x2 EXP SWAP2 POP PUSH2 0x106 PUSH1 0x0 DUP6 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 SWAP1 POP PUSH1 0x0 DUP3 DUP3 PUSH1 0x1 ADD SLOAD AND GT ISZERO PUSH2 0x138B JUMPI DUP1 PUSH1 0x0 ADD PUSH1 0x0 DUP2 SLOAD DUP1 SWAP3 SWAP2 SWAP1 PUSH1 0x1 ADD SWAP2 SWAP1 POP SSTORE POP DUP2 DUP2 PUSH1 0x1 ADD PUSH1 0x0 DUP3 DUP3 SLOAD SUB SWAP3 POP POP DUP2 SWAP1 SSTORE POP PUSH32 0xC7FB647E59B18047309AA15AAD418E5D7CA96D173AD704F1031A2C3D7591734B CALLER DUP6 PUSH1 0x40 MLOAD DUP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD DUP3 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG1 JUMPDEST JUMPDEST POP POP POP POP JUMP JUMPDEST PUSH1 0x0 CALLDATASIZE PUSH1 0x40 MLOAD DUP1 DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY DUP3 ADD SWAP2 POP POP SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 SHA3 PUSH2 0x13B9 DUP2 PUSH2 0x1678 JUMP JUMPDEST ISZERO PUSH2 0x1415 JUMPI PUSH1 0x1 SLOAD DUP3 GT ISZERO PUSH2 0x13CD JUMPI PUSH2 0x1414 JUMP JUMPDEST DUP2 PUSH1 0x0 DUP2 SWAP1 SSTORE POP PUSH2 0x13DC PUSH2 0x1890 JUMP JUMPDEST PUSH32 0xACBDB084C721332AC59F9B8E392196C9EB0E4932862DA8EB9BEAF0DAD4F550DA DUP3 PUSH1 0x40 MLOAD DUP1 DUP3 DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG1 JUMPDEST JUMPDEST JUMPDEST POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x0 PUSH1 0x0 PUSH1 0x0 PUSH2 0x106 PUSH1 0x0 DUP8 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 SWAP3 POP PUSH2 0x105 PUSH1 0x0 DUP7 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 SLOAD SWAP2 POP PUSH1 0x0 DUP3 EQ ISZERO PUSH2 0x147F JUMPI PUSH1 0x0 SWAP4 POP PUSH2 0x1493 JUMP JUMPDEST DUP2 PUSH1 0x2 EXP SWAP1 POP PUSH1 0x0 DUP2 DUP5 PUSH1 0x1 ADD SLOAD AND EQ ISZERO SWAP4 POP JUMPDEST POP POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x5 PUSH1 0x1 DUP4 ADD PUSH2 0x100 DUP2 LT ISZERO ISZERO PUSH2 0x14B1 JUMPI INVALID JUMPDEST ADD PUSH1 0x0 JUMPDEST POP SLOAD SWAP1 POP JUMPDEST SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x0 CALLDATASIZE PUSH1 0x40 MLOAD DUP1 DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY DUP3 ADD SWAP2 POP POP SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 SHA3 PUSH2 0x14E8 DUP2 PUSH2 0x1678 JUMP JUMPDEST ISZERO PUSH2 0x166B JUMPI PUSH2 0x14F6 DUP4 PUSH2 0x659 JUMP JUMPDEST ISZERO PUSH2 0x1500 JUMPI PUSH2 0x166A JUMP JUMPDEST PUSH2 0x105 PUSH1 0x0 DUP6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 SLOAD SWAP2 POP PUSH1 0x0 DUP3 EQ ISZERO PUSH2 0x153B JUMPI PUSH2 0x166A JUMP JUMPDEST PUSH2 0x1543 PUSH2 0x1890 JUMP JUMPDEST DUP3 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x5 DUP4 PUSH2 0x100 DUP2 LT ISZERO ISZERO PUSH2 0x156A JUMPI INVALID JUMPDEST ADD PUSH1 0x0 JUMPDEST POP DUP2 SWAP1 SSTORE POP PUSH1 0x0 PUSH2 0x105 PUSH1 0x0 DUP7 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 DUP2 SWAP1 SSTORE POP DUP2 PUSH2 0x105 PUSH1 0x0 DUP6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 DUP2 SWAP1 SSTORE POP PUSH32 0xB532073B38C83145E3E5135377A08BF9AAB55BC0FD7C1179CD4FB995D2A5159C DUP5 DUP5 PUSH1 0x40 MLOAD DUP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD DUP3 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG1 JUMPDEST JUMPDEST JUMPDEST POP POP POP POP JUMP JUMPDEST PUSH1 0x2 SLOAD DUP2 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x0 PUSH1 0x0 PUSH1 0x0 PUSH2 0x105 PUSH1 0x0 CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 SLOAD SWAP3 POP PUSH1 0x0 DUP4 EQ ISZERO PUSH2 0x16BB JUMPI PUSH2 0x1888 JUMP JUMPDEST PUSH2 0x106 PUSH1 0x0 DUP7 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 SWAP2 POP PUSH1 0x0 DUP3 PUSH1 0x0 ADD SLOAD EQ ISZERO PUSH2 0x1745 JUMPI PUSH1 0x0 SLOAD DUP3 PUSH1 0x0 ADD DUP2 SWAP1 SSTORE POP PUSH1 0x0 DUP3 PUSH1 0x1 ADD DUP2 SWAP1 SSTORE POP PUSH2 0x107 DUP1 SLOAD DUP1 SWAP2 SWAP1 PUSH1 0x1 ADD PUSH2 0x1710 SWAP2 SWAP1 PUSH2 0x1CAE JUMP JUMPDEST DUP3 PUSH1 0x2 ADD DUP2 SWAP1 SSTORE POP DUP5 PUSH2 0x107 DUP4 PUSH1 0x2 ADD SLOAD DUP2 SLOAD DUP2 LT ISZERO ISZERO PUSH2 0x172D JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 SHA3 SWAP1 ADD PUSH1 0x0 JUMPDEST POP DUP2 PUSH1 0x0 NOT AND SWAP1 SSTORE POP JUMPDEST DUP3 PUSH1 0x2 EXP SWAP1 POP PUSH1 0x0 DUP2 DUP4 PUSH1 0x1 ADD SLOAD AND EQ ISZERO PUSH2 0x1887 JUMPI PUSH32 0xE1C52DC63B719ADE82E8BEA94CC41A0D5D28E4AAF536ADB5E9CCCC9FF8C1AEDA CALLER DUP7 PUSH1 0x40 MLOAD DUP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD DUP3 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG1 PUSH1 0x1 DUP3 PUSH1 0x0 ADD SLOAD GT ISZERO ISZERO PUSH2 0x185E JUMPI PUSH2 0x107 PUSH2 0x106 PUSH1 0x0 DUP8 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 PUSH1 0x2 ADD SLOAD DUP2 SLOAD DUP2 LT ISZERO ISZERO PUSH2 0x180A JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 SHA3 SWAP1 ADD PUSH1 0x0 JUMPDEST POP PUSH1 0x0 SWAP1 SSTORE PUSH2 0x106 PUSH1 0x0 DUP7 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 PUSH1 0x0 PUSH1 0x0 DUP3 ADD PUSH1 0x0 SWAP1 SSTORE PUSH1 0x1 DUP3 ADD PUSH1 0x0 SWAP1 SSTORE PUSH1 0x2 DUP3 ADD PUSH1 0x0 SWAP1 SSTORE POP POP PUSH1 0x1 SWAP4 POP PUSH2 0x1888 JUMP JUMPDEST DUP2 PUSH1 0x0 ADD PUSH1 0x0 DUP2 SLOAD DUP1 SWAP3 SWAP2 SWAP1 PUSH1 0x1 SWAP1 SUB SWAP2 SWAP1 POP SSTORE POP DUP1 DUP3 PUSH1 0x1 ADD PUSH1 0x0 DUP3 DUP3 SLOAD OR SWAP3 POP POP DUP2 SWAP1 SSTORE POP JUMPDEST JUMPDEST JUMPDEST POP POP POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x0 PUSH2 0x107 DUP1 SLOAD SWAP1 POP SWAP2 POP PUSH1 0x0 SWAP1 POP JUMPDEST DUP2 DUP2 LT ISZERO PUSH2 0x19BC JUMPI PUSH2 0x108 PUSH1 0x0 PUSH2 0x107 DUP4 DUP2 SLOAD DUP2 LT ISZERO ISZERO PUSH2 0x18BF JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 SHA3 SWAP1 ADD PUSH1 0x0 JUMPDEST POP SLOAD PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 PUSH1 0x0 PUSH1 0x0 DUP3 ADD PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD SWAP1 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF MUL NOT AND SWAP1 SSTORE PUSH1 0x1 DUP3 ADD PUSH1 0x0 SWAP1 SSTORE PUSH1 0x2 DUP3 ADD PUSH1 0x0 PUSH2 0x1926 SWAP2 SWAP1 PUSH2 0x1BE6 JUMP JUMPDEST POP POP PUSH1 0x0 PUSH1 0x1 MUL PUSH2 0x107 DUP3 DUP2 SLOAD DUP2 LT ISZERO ISZERO PUSH2 0x193D JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 SHA3 SWAP1 ADD PUSH1 0x0 JUMPDEST POP SLOAD PUSH1 0x0 NOT AND EQ ISZERO ISZERO PUSH2 0x19B0 JUMPI PUSH2 0x106 PUSH1 0x0 PUSH2 0x107 DUP4 DUP2 SLOAD DUP2 LT ISZERO ISZERO PUSH2 0x196D JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 SHA3 SWAP1 ADD PUSH1 0x0 JUMPDEST POP SLOAD PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 PUSH1 0x0 PUSH1 0x0 DUP3 ADD PUSH1 0x0 SWAP1 SSTORE PUSH1 0x1 DUP3 ADD PUSH1 0x0 SWAP1 SSTORE PUSH1 0x2 DUP3 ADD PUSH1 0x0 SWAP1 SSTORE POP POP JUMPDEST JUMPDEST DUP1 PUSH1 0x1 ADD SWAP1 POP PUSH2 0x18A2 JUMP JUMPDEST PUSH2 0x107 PUSH1 0x0 PUSH2 0x19CB SWAP2 SWAP1 PUSH2 0x1CDA JUMP JUMPDEST JUMPDEST POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1 SWAP1 POP JUMPDEST PUSH1 0x1 SLOAD DUP2 LT ISZERO PUSH2 0x1B33 JUMPI JUMPDEST PUSH1 0x1 SLOAD DUP2 LT DUP1 ISZERO PUSH2 0x1A09 JUMPI POP PUSH1 0x0 PUSH1 0x5 DUP3 PUSH2 0x100 DUP2 LT ISZERO ISZERO PUSH2 0x1A00 JUMPI INVALID JUMPDEST ADD PUSH1 0x0 JUMPDEST POP SLOAD EQ ISZERO JUMPDEST ISZERO PUSH2 0x1A1B JUMPI DUP1 DUP1 PUSH1 0x1 ADD SWAP2 POP POP PUSH2 0x19E2 JUMP JUMPDEST JUMPDEST PUSH1 0x1 PUSH1 0x1 SLOAD GT DUP1 ISZERO PUSH2 0x1A45 JUMPI POP PUSH1 0x0 PUSH1 0x5 PUSH1 0x1 SLOAD PUSH2 0x100 DUP2 LT ISZERO ISZERO PUSH2 0x1A3D JUMPI INVALID JUMPDEST ADD PUSH1 0x0 JUMPDEST POP SLOAD EQ JUMPDEST ISZERO PUSH2 0x1A62 JUMPI PUSH1 0x1 PUSH1 0x0 DUP2 SLOAD DUP1 SWAP3 SWAP2 SWAP1 PUSH1 0x1 SWAP1 SUB SWAP2 SWAP1 POP SSTORE POP PUSH2 0x1A1C JUMP JUMPDEST PUSH1 0x1 SLOAD DUP2 LT DUP1 ISZERO PUSH2 0x1A8B JUMPI POP PUSH1 0x0 PUSH1 0x5 PUSH1 0x1 SLOAD PUSH2 0x100 DUP2 LT ISZERO ISZERO PUSH2 0x1A82 JUMPI INVALID JUMPDEST ADD PUSH1 0x0 JUMPDEST POP SLOAD EQ ISZERO JUMPDEST DUP1 ISZERO PUSH2 0x1AAC JUMPI POP PUSH1 0x0 PUSH1 0x5 DUP3 PUSH2 0x100 DUP2 LT ISZERO ISZERO PUSH2 0x1AA4 JUMPI INVALID JUMPDEST ADD PUSH1 0x0 JUMPDEST POP SLOAD EQ JUMPDEST ISZERO PUSH2 0x1B2E JUMPI PUSH1 0x5 PUSH1 0x1 SLOAD PUSH2 0x100 DUP2 LT ISZERO ISZERO PUSH2 0x1AC3 JUMPI INVALID JUMPDEST ADD PUSH1 0x0 JUMPDEST POP SLOAD PUSH1 0x5 DUP3 PUSH2 0x100 DUP2 LT ISZERO ISZERO PUSH2 0x1AD9 JUMPI INVALID JUMPDEST ADD PUSH1 0x0 JUMPDEST POP DUP2 SWAP1 SSTORE POP DUP1 PUSH2 0x105 PUSH1 0x0 PUSH1 0x5 DUP5 PUSH2 0x100 DUP2 LT ISZERO ISZERO PUSH2 0x1AF8 JUMPI INVALID JUMPDEST ADD PUSH1 0x0 JUMPDEST POP SLOAD DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 DUP2 SWAP1 SSTORE POP PUSH1 0x0 PUSH1 0x5 PUSH1 0x1 SLOAD PUSH2 0x100 DUP2 LT ISZERO ISZERO PUSH2 0x1B24 JUMPI INVALID JUMPDEST ADD PUSH1 0x0 JUMPDEST POP DUP2 SWAP1 SSTORE POP JUMPDEST PUSH2 0x19D7 JUMP JUMPDEST JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 DUP2 MLOAD PUSH1 0x20 DUP4 ADD DUP5 CREATE SWAP1 POP DUP1 EXTCODESIZE ISZERO PUSH2 0x0 JUMPI JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1B5C CALLER PUSH2 0x659 JUMP JUMPDEST ISZERO PUSH2 0x1BC9 JUMPI PUSH1 0x4 SLOAD PUSH2 0x1B6C PUSH2 0x1BCF JUMP JUMPDEST GT ISZERO PUSH2 0x1B89 JUMPI PUSH1 0x0 PUSH1 0x3 DUP2 SWAP1 SSTORE POP PUSH2 0x1B82 PUSH2 0x1BCF JUMP JUMPDEST PUSH1 0x4 DUP2 SWAP1 SSTORE POP JUMPDEST PUSH1 0x3 SLOAD DUP3 PUSH1 0x3 SLOAD ADD LT ISZERO DUP1 ISZERO PUSH2 0x1BA5 JUMPI POP PUSH1 0x2 SLOAD DUP3 PUSH1 0x3 SLOAD ADD GT ISZERO JUMPDEST ISZERO PUSH2 0x1BC3 JUMPI DUP2 PUSH1 0x3 PUSH1 0x0 DUP3 DUP3 SLOAD ADD SWAP3 POP POP DUP2 SWAP1 SSTORE POP PUSH1 0x1 SWAP1 POP PUSH2 0x1BC8 JUMP JUMPDEST PUSH1 0x0 SWAP1 POP JUMPDEST JUMPDEST JUMPDEST SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH3 0x15180 TIMESTAMP DUP2 ISZERO ISZERO PUSH2 0x1BDF JUMPI INVALID JUMPDEST DIV SWAP1 POP JUMPDEST SWAP1 JUMP JUMPDEST POP DUP1 SLOAD PUSH1 0x1 DUP2 PUSH1 0x1 AND ISZERO PUSH2 0x100 MUL SUB AND PUSH1 0x2 SWAP1 DIV PUSH1 0x0 DUP3 SSTORE DUP1 PUSH1 0x1F LT PUSH2 0x1C0C JUMPI POP PUSH2 0x1C2B JUMP JUMPDEST PUSH1 0x1F ADD PUSH1 0x20 SWAP1 DIV SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 SHA3 SWAP1 DUP2 ADD SWAP1 PUSH2 0x1C2A SWAP2 SWAP1 PUSH2 0x1CFC JUMP JUMPDEST JUMPDEST POP JUMP JUMPDEST DUP3 DUP1 SLOAD PUSH1 0x1 DUP2 PUSH1 0x1 AND ISZERO PUSH2 0x100 MUL SUB AND PUSH1 0x2 SWAP1 DIV SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 SHA3 SWAP1 PUSH1 0x1F ADD PUSH1 0x20 SWAP1 DIV DUP2 ADD SWAP3 DUP3 PUSH1 0x1F LT PUSH2 0x1C6F JUMPI DUP1 CALLDATALOAD PUSH1 0xFF NOT AND DUP4 DUP1 ADD OR DUP6 SSTORE PUSH2 0x1C9D JUMP JUMPDEST DUP3 DUP1 ADD PUSH1 0x1 ADD DUP6 SSTORE DUP3 ISZERO PUSH2 0x1C9D JUMPI SWAP2 DUP3 ADD JUMPDEST DUP3 DUP2 GT ISZERO PUSH2 0x1C9C JUMPI DUP3 CALLDATALOAD DUP3 SSTORE SWAP2 PUSH1 0x20 ADD SWAP2 SWAP1 PUSH1 0x1 ADD SWAP1 PUSH2 0x1C81 JUMP JUMPDEST JUMPDEST POP SWAP1 POP PUSH2 0x1CAA SWAP2 SWAP1 PUSH2 0x1CFC JUMP JUMPDEST POP SWAP1 JUMP JUMPDEST DUP2 SLOAD DUP2 DUP4 SSTORE DUP2 DUP2 ISZERO GT PUSH2 0x1CD5 JUMPI DUP2 DUP4 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 SHA3 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0x1CD4 SWAP2 SWAP1 PUSH2 0x1D21 JUMP JUMPDEST JUMPDEST POP POP POP JUMP JUMPDEST POP DUP1 SLOAD PUSH1 0x0 DUP3 SSTORE SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 SHA3 SWAP1 DUP2 ADD SWAP1 PUSH2 0x1CF8 SWAP2 SWAP1 PUSH2 0x1D21 JUMP JUMPDEST JUMPDEST POP JUMP JUMPDEST PUSH2 0x1D1E SWAP2 SWAP1 JUMPDEST DUP1 DUP3 GT ISZERO PUSH2 0x1D1A JUMPI PUSH1 0x0 DUP2 PUSH1 0x0 SWAP1 SSTORE POP PUSH1 0x1 ADD PUSH2 0x1D02 JUMP JUMPDEST POP SWAP1 JUMP JUMPDEST SWAP1 JUMP JUMPDEST PUSH2 0x1D43 SWAP2 SWAP1 JUMPDEST DUP1 DUP3 GT ISZERO PUSH2 0x1D3F JUMPI PUSH1 0x0 DUP2 PUSH1 0x0 SWAP1 SSTORE POP PUSH1 0x1 ADD PUSH2 0x1D27 JUMP JUMPDEST POP SWAP1 JUMP JUMPDEST SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1 SLOAD GT ISZERO PUSH2 0x1D57 JUMPI PUSH1 0x0 PUSH1 0x0 REVERT JUMPDEST PUSH2 0x1D60 DUP2 PUSH2 0x1D71 JUMP JUMPDEST PUSH2 0x1D6A DUP4 DUP4 PUSH2 0x1D9C JUMP JUMPDEST JUMPDEST JUMPDEST POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1 SLOAD GT ISZERO PUSH2 0x1D82 JUMPI PUSH1 0x0 PUSH1 0x0 REVERT JUMPDEST DUP1 PUSH1 0x2 DUP2 SWAP1 SSTORE POP PUSH2 0x1D91 PUSH2 0x1BCF JUMP JUMPDEST PUSH1 0x4 DUP2 SWAP1 SSTORE POP JUMPDEST JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x0 PUSH1 0x1 SLOAD GT ISZERO PUSH2 0x1DAF JUMPI PUSH1 0x0 PUSH1 0x0 REVERT JUMPDEST PUSH1 0x0 DUP3 GT ISZERO ISZERO PUSH2 0x1DBF JUMPI PUSH1 0x0 PUSH1 0x0 REVERT JUMPDEST DUP2 DUP4 MLOAD LT ISZERO ISZERO ISZERO PUSH2 0x1DD0 JUMPI PUSH1 0x0 PUSH1 0x0 REVERT JUMPDEST DUP3 MLOAD PUSH1 0x1 DUP2 SWAP1 SSTORE POP PUSH1 0x0 SWAP1 POP JUMPDEST DUP3 MLOAD DUP2 LT ISZERO PUSH2 0x1E85 JUMPI DUP3 DUP2 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1DF4 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x5 DUP3 PUSH1 0x1 ADD PUSH2 0x100 DUP2 LT ISZERO ISZERO PUSH2 0x1E27 JUMPI INVALID JUMPDEST ADD PUSH1 0x0 JUMPDEST POP DUP2 SWAP1 SSTORE POP DUP1 PUSH1 0x1 ADD PUSH2 0x105 PUSH1 0x0 DUP6 DUP5 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1E47 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 DUP2 SWAP1 SSTORE POP JUMPDEST DUP1 PUSH1 0x1 ADD SWAP1 POP PUSH2 0x1DDD JUMP JUMPDEST DUP2 PUSH1 0x0 DUP2 SWAP1 SSTORE POP JUMPDEST JUMPDEST POP POP POP JUMP STOP LOG1 PUSH6 0x627A7A723058 SHA3 AND DUP9 SWAP16 SMOD BLOCKHASH CREATE PUSH20 0xD397F9D00B0D19900FB050B957E3E2942F861085 0xbe 0xb9 0xba 0xab XOR STOP 0x29 &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;sourceMap&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2715:10853:0:-;;;3523:112;;;;;;;3552:18;3574:8;:27;;;;;;;;;;;:::i;:::-;;;;;;;;;;;3596:3;3574:27;;;;;;;;;;;;;;;;;;;;;;;3605:26;3616:8;3605:26;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3626:1;3629;3605:10;;;;;:26;;;:::i;:::-;3523:112;;2715:10853;;7697:168;7585:1;7571:11;;:15;7567:26;;;7588:5;;;7567:26;7800:23;7813:9;7800:12;;;;;:23;;;:::i;:::-;7827:34;7842:7;7851:9;7827:14;;;;;:34;;;:::i;:::-;7595:1;7697:168;;;;:::o;6966:115::-;7585:1;7571:11;;:15;7567:26;;;7588:5;;;7567:26;7048:6;7033:12;:21;;;;7070:7;:5;;;;;:7;;;:::i;:::-;7058:9;:19;;;;7595:1;6966:115;;:::o;3977:349::-;4171:6;7585:1;7571:11;;:15;7567:26;;;7588:5;;;7567:26;4088:1;4076:9;:13;4068:22;;;;;;;;4120:9;4102:7;:14;:27;;4094:36;;;;;;;;4148:7;:14;4134:11;:28;;;;4180:1;4171:10;;4166:131;4187:7;:14;4183:1;:18;4166:131;;;4238:7;4246:1;4238:10;;;;;;;;;;;;;;;;;;4233:16;;4215:8;4228:1;4224;:5;4215:15;;;;;;;;;;;;:34;;;;;4291:1;4287;:5;4254:12;:30;4272:7;4280:1;4272:10;;;;;;;;;;;;;;;;;;4267:16;;4254:30;;;;;;;;;;;:38;;;;4166:131;4203:3;;;;;4166:131;;;4313:9;4300:10;:22;;;;7595:1;3977:349;;;;:::o;12529:73::-;12572:4;12593:6;12587:3;:12;;;;;;;;12580:19;;12529:73;;:::o;2715:10853::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;linkReferences&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;To verify the byte-code above, a patched version is deployed at
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;etherscan.io&#x2F;address&#x2F;0x21C9E434c669c4d73f55215A6F2130A185E127AC#code&quot;&gt;&lt;code&gt;0x21C9E434c669c4d73f55215A6F2130A185E127AC&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;
to be reviewed. The compiler settings used can be extracted from the following
meta-data:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;compiler&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0.4.10+commit.f0d539ae&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;language&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;output&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;removeOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;outputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;isOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;outputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;m_numOwners&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;outputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;m_lastDay&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;outputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;resetSpentToday&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;outputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;m_spentToday&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;outputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;addOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;outputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;m_required&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;outputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_h&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;confirm&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;outputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;o_success&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_newLimit&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;setDailyLimit&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;outputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_to&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_value&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;execute&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;outputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;o_hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_operation&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;revoke&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;outputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_newRequired&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;changeRequirement&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;outputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_operation&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;hasConfirmed&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;outputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ownerIndex&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;getOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;outputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_from&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_to&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;changeOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;outputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;m_dailyLimit&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;outputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;constructor&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;fallback&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;anonymous&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;operation&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Confirmation&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;anonymous&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;operation&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Revoke&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;anonymous&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;oldOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;newOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;OwnerChanged&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;anonymous&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;newOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;OwnerAdded&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;anonymous&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;oldOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;OwnerRemoved&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;anonymous&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;newRequirement&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;RequirementChanged&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;anonymous&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_from&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Deposit&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;anonymous&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;created&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;SingleTransact&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;anonymous&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;operation&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;created&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;MultiTransact&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;anonymous&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;operation&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;initiator&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ConfirmationNeeded&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;devdoc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;methods&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;userdoc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;methods&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;settings&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;compilationTarget&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;browser&#x2F;WalletLibrary.sol&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;WalletLibrary&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;libraries&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;optimizer&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;enabled&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;runs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;200&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;remappings&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;sources&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;browser&#x2F;WalletLibrary.sol&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xf72fcdc85e15f93172878ca6a61fb81604d1052e9e724bc3896d65b3b4ab1bb0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;urls&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bzzr:&#x2F;&#x2F;009bd59bd78f59804eaffb6111d341caea58888f8e5b5f75aebdf009fc6136c0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The differences to the originally deployed contract code can be reviewed at:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;parity-contracts&#x2F;0x863df6bfa4&#x2F;pull&#x2F;2&quot;&gt;parity-contracts&#x2F;0x863df6bfa4#2&lt;&#x2F;a&gt;:
Remove the &lt;code&gt;selfdestruct()&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;parity-contracts&#x2F;0x863df6bfa4&#x2F;pull&#x2F;3&quot;&gt;parity-contracts&#x2F;0x863df6bfa4#3&lt;&#x2F;a&gt;:
Initialize the library owner to &lt;code&gt;0x0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The following sections propose two equivalent specifications, 999a and 999b,
which technically achieve the same results. To implement this proposal only one
of them has to be applied.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;direct-state-transition-via-bytecode-999a&quot;&gt;Direct State Transition via Bytecode (999a)&lt;&#x2F;h3&gt;
&lt;p&gt;At &lt;code&gt;CNSTNTNPL_FORK_BLKNUM&lt;&#x2F;code&gt;, directly recreate the account
&lt;code&gt;0x863DF6BFa4469f3ead0bE8f9F2AAE51c91A907b4&lt;&#x2F;code&gt; with the following parameters:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Nonce: &lt;code&gt;0x1&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Code:&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x606060405236156100ef576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063173825d91461016d5780632f54bf6e146101a35780634123cb6b146101f157806352375093146102175780635c52c2f51461023d578063659010e71461024f5780637065cb4814610275578063746c9171146102ab578063797af627146102d1578063b20d30a91461030d578063b61d27f61461032d578063b75c7dc61461039c578063ba51a6df146103c0578063c2cf7326146103e0578063c41a360a1461043b578063f00d4b5d1461049b578063f1736d86146104f0575b61016b5b6000341115610168577fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c3334604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b5b565b005b341561017557fe5b6101a1600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610516565b005b34156101ab57fe5b6101d7600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610659565b604051808215151515815260200191505060405180910390f35b34156101f957fe5b610201610691565b6040518082815260200191505060405180910390f35b341561021f57fe5b610227610697565b6040518082815260200191505060405180910390f35b341561024557fe5b61024d61069d565b005b341561025757fe5b61025f6106d7565b6040518082815260200191505060405180910390f35b341561027d57fe5b6102a9600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506106dd565b005b34156102b357fe5b6102bb610829565b6040518082815260200191505060405180910390f35b34156102d957fe5b6102f360048080356000191690602001909190505061082f565b604051808215151515815260200191505060405180910390f35b341561031557fe5b61032b6004808035906020019091905050610dcc565b005b341561033557fe5b61037e600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919080359060200190820180359060200191909192905050610e06565b60405180826000191660001916815260200191505060405180910390f35b34156103a457fe5b6103be60048080356000191690602001909190505061127d565b005b34156103c857fe5b6103de6004808035906020019091905050611392565b005b34156103e857fe5b61042160048080356000191690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061141a565b604051808215151515815260200191505060405180910390f35b341561044357fe5b610459600480803590602001909190505061149c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156104a357fe5b6104ee600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506114bf565b005b34156104f857fe5b610500611672565b6040518082815260200191505060405180910390f35b600060003660405180838380828437820191505092505050604051809103902061053f81611678565b156106535761010560008473ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549150600082141561057f57610652565b600160015403600054111561059357610652565b6000600583610100811015156105a557fe5b0160005b5081905550600061010560008573ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506105e6611890565b6105ee6119d0565b7f58619076adf5bb0943d100ef88d52d7c3fd691b19d3a9071b555b651fbf418da83604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a15b5b5b505050565b6000600061010560008473ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541190505b919050565b60015481565b60045481565b6000366040518083838082843782019150509250505060405180910390206106c481611678565b156106d35760006003819055505b5b5b50565b60035481565b60003660405180838380828437820191505092505050604051809103902061070481611678565b156108245761071282610659565b1561071c57610823565b610724611890565b60fa600154101515610739576107386119d0565b5b60fa60015410151561074a57610823565b6001600081548092919060010191905055508173ffffffffffffffffffffffffffffffffffffffff1660056001546101008110151561078557fe5b0160005b508190555060015461010560008473ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507f994a936646fe87ffe4f1e469d3d6aa417d6b855598397f323de5b449f765f0c382604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a15b5b5b5050565b60005481565b600060008261083d81611678565b15610dc45760006101086000866000191660001916815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415806108c757506000610108600086600019166000191681526020019081526020016000206001015414155b80610906575060006101086000866000191660001916815260200190815260200160002060020180546001816001161561010002031660029004905014155b15610dc25760006101086000866000191660001916815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610a5057610a496101086000866000191660001916815260200190815260200160002060010154610108600087600019166000191681526020019081526020016000206002018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610a3f5780601f10610a1457610100808354040283529160200191610a3f565b820191906000526020600020905b815481529060010190602001808311610a2257829003601f168201915b5050505050611b37565b9150610b71565b6101086000856000191660001916815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166101086000866000191660001916815260200190815260200160002060010154610108600087600019166000191681526020019081526020016000206002016040518082805460018160011615610100020316600290048015610b4a5780601f10610b1f57610100808354040283529160200191610b4a565b820191906000526020600020905b815481529060010190602001808311610b2d57829003601f168201915b505091505060006040518083038185876185025a03f1925050501515610b705760006000fd5b5b7fe3a3a4111a84df27d76b68dc721e65c7711605ea5eee4afd3a9c58195217365c338561010860008860001916600019168152602001908152602001600020600101546101086000896000191660001916815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1661010860008a6000191660001916815260200190815260200160002060020187604051808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200186600019166000191681526020018581526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001806020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828103825284818154600181600116156101000203166002900481526020019150805460018160011615610100020316600290048015610d475780601f10610d1c57610100808354040283529160200191610d47565b820191906000526020600020905b815481529060010190602001808311610d2a57829003601f168201915b505097505050505050505060405180910390a16101086000856000191660001916815260200190815260200160002060006000820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556001820160009055600282016000610db79190611be6565b505060019250610dc3565b5b5b5b5050919050565b600036604051808383808284378201915050925050506040518091039020610df381611678565b15610e0157816002819055505b5b5b5050565b60006000610e1333610659565b1561127357600084849050148015610e305750610e2f85611b51565b5b80610e3d57506001600054145b15610fed5760008673ffffffffffffffffffffffffffffffffffffffff161415610ea457610e9d8585858080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050611b37565b9050610ef3565b8573ffffffffffffffffffffffffffffffffffffffff168585856040518083838082843782019150509250505060006040518083038185876185025a03f1925050501515610ef25760006000fd5b5b7f9738cd1a8777c86b011f7b01d87d484217dc6ab5154a9d41eda5d14af8caf292338688878786604051808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001806020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281038252858582818152602001925080828437820191505097505050505050505060405180910390a1611271565b6000364360405180848480828437820191505082815260200193505050506040518091039020915060006101086000846000191660001916815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16148015611099575060006101086000846000191660001916815260200190815260200160002060010154145b80156110d85750600061010860008460001916600019168152602001908152602001600020600201805460018160011615610100020316600290049050145b1561118f57856101086000846000191660001916815260200190815260200160002060000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550846101086000846000191660001916815260200190815260200160002060010181905550838361010860008560001916600019168152602001908152602001600020600201919061118d929190611c2e565b505b6111988261082f565b1515611270577f1733cbb53659d713b79580f79f3f9ff215f78a7c7aa45890f3b89fc5cddfbf328233878988886040518087600019166000191681526020018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001806020018281038252848482818152602001925080828437820191505097505050505050505060405180910390a15b5b5b5b5b50949350505050565b60006000600061010560003373ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054925060008314156112be5761138c565b8260020a9150610106600085600019166000191681526020019081526020016000209050600082826001015416111561138b5780600001600081548092919060010191905055508181600101600082825403925050819055507fc7fb647e59b18047309aa15aad418e5d7ca96d173ad704f1031a2c3d7591734b3385604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182600019166000191681526020019250505060405180910390a15b5b50505050565b6000366040518083838082843782019150509250505060405180910390206113b981611678565b15611415576001548211156113cd57611414565b816000819055506113dc611890565b7facbdb084c721332ac59f9b8e392196c9eb0e4932862da8eb9beaf0dad4f550da826040518082815260200191505060405180910390a15b5b5b5050565b600060006000600061010660008760001916600019168152602001908152602001600020925061010560008673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549150600082141561147f5760009350611493565b8160020a9050600081846001015416141593505b50505092915050565b6000600560018301610100811015156114b157fe5b0160005b505490505b919050565b60006000366040518083838082843782019150509250505060405180910390206114e881611678565b1561166b576114f683610659565b156115005761166a565b61010560008573ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549150600082141561153b5761166a565b611543611890565b8273ffffffffffffffffffffffffffffffffffffffff166005836101008110151561156a57fe5b0160005b5081905550600061010560008673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508161010560008573ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c8484604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a15b5b5b50505050565b60025481565b600060006000600061010560003373ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054925060008314156116bb57611888565b6101066000866000191660001916815260200190815260200160002091506000826000015414156117455760005482600001819055506000826001018190555061010780548091906001016117109190611cae565b826002018190555084610107836002015481548110151561172d57fe5b906000526020600020900160005b5081600019169055505b8260020a90506000818360010154161415611887577fe1c52dc63b719ade82e8bea94cc41a0d5d28e4aaf536adb5e9cccc9ff8c1aeda3386604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182600019166000191681526020019250505060405180910390a16001826000015411151561185e57610107610106600087600019166000191681526020019081526020016000206002015481548110151561180a57fe5b906000526020600020900160005b5060009055610106600086600019166000191681526020019081526020016000206000600082016000905560018201600090556002820160009055505060019350611888565b8160000160008154809291906001900391905055508082600101600082825417925050819055505b5b5b505050919050565b60006000610107805490509150600090505b818110156119bc576101086000610107838154811015156118bf57fe5b906000526020600020900160005b50546000191660001916815260200190815260200160002060006000820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905560018201600090556002820160006119269190611be6565b505060006001026101078281548110151561193d57fe5b906000526020600020900160005b5054600019161415156119b05761010660006101078381548110151561196d57fe5b906000526020600020900160005b505460001916600019168152602001908152602001600020600060008201600090556001820160009055600282016000905550505b5b8060010190506118a2565b61010760006119cb9190611cda565b5b5050565b6000600190505b600154811015611b33575b60015481108015611a095750600060058261010081101515611a0057fe5b0160005b505414155b15611a1b5780806001019150506119e2565b5b6001600154118015611a4557506000600560015461010081101515611a3d57fe5b0160005b5054145b15611a625760016000815480929190600190039190505550611a1c565b60015481108015611a8b57506000600560015461010081101515611a8257fe5b0160005b505414155b8015611aac5750600060058261010081101515611aa457fe5b0160005b5054145b15611b2e57600560015461010081101515611ac357fe5b0160005b505460058261010081101515611ad957fe5b0160005b508190555080610105600060058461010081101515611af857fe5b0160005b50548152602001908152602001600020819055506000600560015461010081101515611b2457fe5b0160005b50819055505b6119d7565b5b50565b600081516020830184f09050803b15610000575b92915050565b6000611b5c33610659565b15611bc957600454611b6c611bcf565b1115611b89576000600381905550611b82611bcf565b6004819055505b600354826003540110158015611ba55750600254826003540111155b15611bc3578160036000828254019250508190555060019050611bc8565b600090505b5b5b919050565b60006201518042811515611bdf57fe5b0490505b90565b50805460018160011615610100020316600290046000825580601f10611c0c5750611c2b565b601f016020900490600052602060002090810190611c2a9190611cfc565b5b50565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611c6f57803560ff1916838001178555611c9d565b82800160010185558215611c9d579182015b82811115611c9c578235825591602001919060010190611c81565b5b509050611caa9190611cfc565b5090565b815481835581811511611cd557818360005260206000209182019101611cd49190611d21565b5b505050565b5080546000825590600052602060002090810190611cf89190611d21565b5b50565b611d1e91905b80821115611d1a576000816000905550600101611d02565b5090565b90565b611d4391905b80821115611d3f576000816000905550600101611d27565b5090565b90565b60006001541115611d575760006000fd5b611d6081611d71565b611d6a8383611d9c565b5b5b505050565b60006001541115611d825760006000fd5b80600281905550611d91611bcf565b6004819055505b5b50565b600060006001541115611daf5760006000fd5b600082111515611dbf5760006000fd5b81835110151515611dd05760006000fd5b8251600181905550600090505b8251811015611e85578281815181101515611df457fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1660058260010161010081101515611e2757fe5b0160005b50819055508060010161010560008584815181101515611e4757fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b806001019050611ddd565b816000819055505b5b5050505600a165627a7a7230582084feb3505964efa62a6ffa78d913a175fe7bc168dd50067d25b1d5ddb6d10a1e0029&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;Storage:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;code&gt;:
&lt;code&gt;0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;code&gt;:
&lt;code&gt;0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;0x0000000000000000000000000000000000000000000000000000000000000004&lt;&#x2F;code&gt;:
&lt;code&gt;0x00000000000000000000000000000000000000000000000000000000000044e1&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;0xa5baec7d73105a3c7298203bb205bbc41b63fa384ae73a6016b890a7ca29ae2d&lt;&#x2F;code&gt;:
&lt;code&gt;0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The balance of the account shall be left unchanged.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;alternate-specification-via-codehash-999b&quot;&gt;Alternate Specification via Codehash (999b)&lt;&#x2F;h3&gt;
&lt;p&gt;At &lt;code&gt;CNSTNTNPL_FORK_BLKNUM&lt;&#x2F;code&gt;, directly recreate the account
&lt;code&gt;0x863DF6BFa4469f3ead0bE8f9F2AAE51c91A907b4&lt;&#x2F;code&gt; with the following parameters:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Nonce: &lt;code&gt;0x1&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Storage:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;code&gt;:
&lt;code&gt;0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;code&gt;:
&lt;code&gt;0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;0x0000000000000000000000000000000000000000000000000000000000000004&lt;&#x2F;code&gt;:
&lt;code&gt;0x00000000000000000000000000000000000000000000000000000000000044e1&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;0xa5baec7d73105a3c7298203bb205bbc41b63fa384ae73a6016b890a7ca29ae2d&lt;&#x2F;code&gt;:
&lt;code&gt;0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In addition, the codehash at that address shall be replaced by the codehash at
address &lt;code&gt;0x21C9E434c669c4d73f55215A6F2130A185E127AC&lt;&#x2F;code&gt;. The codehash is
&lt;code&gt;0x6209d55547da7b035d54ef8d73275e863d3072b91da6ace1614fa6381f4e2c09&lt;&#x2F;code&gt;. The
balance of the account shall be left unchanged.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The design decision to restore the &lt;code&gt;WalletLibrary&lt;&#x2F;code&gt; contract code in a single
state transition was made after lengthy discussions of
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;gist.github.com&#x2F;5chdn&#x2F;a9bb8617cc8523a030126a3d1c60baf3&quot;&gt;alternate proposals&lt;&#x2F;a&gt;
that explored different ways to improve the Ethereum protocol to allow contract
revivals by adding different built-in contracts. It was eventually concluded
that all of these proposals changing the EVM semantics around self-destructed
contracts were introducing unwanted side-effects and
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;medium.com&#x2F;@weka&#x2F;on-paritys-proposed-changes-to-selfdestruct-behaviour-c3f0e5bc0f49&quot;&gt;potential risks&lt;&#x2F;a&gt;
to the existing smart-contract ecosystem on the Ethereum platform.&lt;&#x2F;p&gt;
&lt;p&gt;The total supply of Ether is neither changed nor does this proposal require the
transfer of any tokens or assets including Ether. It is assumed that this change
is aligned with the interests both of (A) Parity Technologies that intended to
provide a smart-contracts library for multi-signature wallets to last forever
for its users and (B) the users of the multi-signature wallets that meant to
safely store their assets in a contract accessible any time they desire. Lastly,
the client-side implementation cost of this proposal is estimated to be low. A
sample implementation will be attached and linked in the following sections.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal introduces backwards incompatibilities in the state of the
contract at &lt;code&gt;0x863DF6BFa4469f3ead0bE8f9F2AAE51c91A907b4&lt;&#x2F;code&gt;. The Ethereum protocol
does not allow the restoration of self-destructed contracts. To implement this
on the Ethereum blockchain, it is recommended to add the necessary state
transition in a future hard-fork at a well-defined block number, e.g.,
&lt;code&gt;CNSTNTNPL_FORK_BLKNUM&lt;&#x2F;code&gt; for the Constantinople milestone which is supposed to be
the next scheduled hard-fork on the Ethereum road-map.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;A proof-of-concept implementation is available for the Parity client on branch
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;paritytech&#x2F;parity&#x2F;compare&#x2F;a5-eip999-poc&quot;&gt;&lt;code&gt;a5-eip999-poc&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;
(&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;paritytech&#x2F;parity&#x2F;pull&#x2F;8406&quot;&gt;#8406&lt;&#x2F;a&gt;). A sample chain
configuration for Parity can be found at the same branch in
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;paritytech&#x2F;parity&#x2F;blob&#x2F;891e633021eec78dd62104bf5a99af50f66b06c7&#x2F;ethcore&#x2F;res&#x2F;ethereum&#x2F;multisig_test.json#L38-L51&quot;&gt;&lt;code&gt;multisig_test.json&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;
describing the state change as specified above.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Modifications to ethash to invalidate existing dedicated hardware implementations</title>
        <published>2018-04-03T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>David Stanfill</name><email>david@airsquirrels.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/969/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/969/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:969"
            label="EIP-969" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/969/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP modifies ethash in order to break ASIC miners specialized for the current ethash
mining algorithm.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;There are companies who currently have dedicated hardware based ethereum miners in
production, and may be actively mining.  This EIP aims to &quot;poison
the well&quot; by modifying the block mining algorithm in a low risk manner that
may &lt;em&gt;&quot;break&quot;&lt;&#x2F;em&gt; these miners if they are in-fact built as traditional ASICs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;ASIC-based miners will have lower operational costs than GPU-based miners, which
will result in GPU-based mining quickly becoming unprofitable.  Given that
production of ASIC-based miners has a high barrier to entry and few market players,
this will cause a trend towards centralization of mining power.&lt;&#x2F;p&gt;
&lt;p&gt;Risks include market dominance by a single manufacturer that may utilize production
stock to mine themselves, introduce backdoors in their hardware, or facilitate a 51%
attack that would otherwise be infeasible.&lt;&#x2F;p&gt;
&lt;p&gt;This trend towards centralization has a negative effect on network security,
putting significant control of the network in the hands of only a few entities.&lt;&#x2F;p&gt;
&lt;p&gt;Ethash remains ASIC-resistant, however ASIC manufacturer technology is advancing
and ethash may require further changes in order to remain resistant to unforeseen
design techniques. This EIP seeks explicitly to buy time during which newly-developed
ASIC technology will face a barrier while more long-term mechanisms to ensure
continued ASIC resistance can be explored.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= ASIC_MITIGATION_FORK_BLKNUM&lt;&#x2F;code&gt;, require that the ethash solution
sealing the block has been mined using &lt;code&gt;ethashV2&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;ethashv2&quot;&gt;EthashV2&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;ethashV2&lt;&#x2F;code&gt; will be identical in specification to the current &lt;code&gt;ethash&lt;&#x2F;code&gt;(v1) algorithm, with
the exception of the implementation of &lt;code&gt;fnv&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The new algorithm replaces the 5 current uses of &lt;code&gt;fnv&lt;&#x2F;code&gt; inside &lt;code&gt;hashimoto&lt;&#x2F;code&gt; with 5
separate instances defined as &lt;code&gt;fnvA&lt;&#x2F;code&gt;, &lt;code&gt;fnvB&lt;&#x2F;code&gt;, &lt;code&gt;fnvC&lt;&#x2F;code&gt;, &lt;code&gt;fnvD&lt;&#x2F;code&gt;, and &lt;code&gt;fnvE&lt;&#x2F;code&gt;, utilizing&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;c&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;FNV_PRIME_A&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10001a7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;FNV_PRIME_B&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10001ab&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;FNV_PRIME_C&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10001cf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;FNV_PRIME_D&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10001e3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;FNV_PRIME_E&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10001f9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;fnvA&lt;&#x2F;code&gt; replaces &lt;code&gt;fnv&lt;&#x2F;code&gt; in the DAG item selection step;
&lt;code&gt;fnvB&lt;&#x2F;code&gt; replaces &lt;code&gt;fnv&lt;&#x2F;code&gt; in the DAG item mix step;
&lt;code&gt;fnvC(fnvD(fnvE&lt;&#x2F;code&gt; replaces &lt;code&gt;fnv(fnv(fnv(&lt;&#x2F;code&gt; in the compress mix step.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;fnv&lt;&#x2F;code&gt; as utilized in DAG-item creation should remain unchanged.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;agent-changes-optional-variant&quot;&gt;Agent Changes (Optional Variant)&lt;&#x2F;h2&gt;
&lt;p&gt;The JSON-RPC &lt;code&gt;eth_GetWork&lt;&#x2F;code&gt; call may optionally return the proposed blocks algorithm.
While a miner or pool may infer the requirement for &lt;code&gt;ethashV2&lt;&#x2F;code&gt; based on the computed
epoch of the provided seedHash, it is beneficial to explicitly provide this
field so a miner does not require special configuration when mining on a chain
that chooses not to implement the &lt;code&gt;ASIC_Mitigation&lt;&#x2F;code&gt; hardfork.&lt;&#x2F;p&gt;
&lt;p&gt;Due to compatibility concerns with implementations that already add additional
parameters to &lt;code&gt;GetWork&lt;&#x2F;code&gt;, it is desired to add &lt;code&gt;BlockNumber&lt;&#x2F;code&gt; as an explicit 4th parameter
as suggested in https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;go-ethereum&#x2F;issues&#x2F;2333. Algorithm
should then be returned as either &lt;code&gt;&quot;ethash&quot;&lt;&#x2F;code&gt; or &lt;code&gt;&quot;ethashV2&quot;&lt;&#x2F;code&gt; according to the
&lt;code&gt;block.number &amp;gt;= ASIC_MITIGATION_FORK_BLKNUM&lt;&#x2F;code&gt; criteria.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is aimed at breaking existing ASIC-based miners via small changes to the
existing ethash algorithm.  We hope to accomplish the following:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Break existing ASIC-based miners.&lt;&#x2F;li&gt;
&lt;li&gt;Demonstrate a willingness to fork in the event of future ASIC miner production.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Goal #1 is something that we can only do probabilistically without detailed
knowledge of existing ASIC miner design. The known released miner is available for
purchase &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;shop.bitmain.com&#x2F;product&#x2F;detail?pid=00020180403174908564M8dMJKtz06B7&quot;&gt;here&lt;&#x2F;a&gt;,
with delivery slated for mid-summer 2018.&lt;&#x2F;p&gt;
&lt;p&gt;Our approach should balance the inherent security risks involved with changing
the mining algorithm with the risk that the change we make does not break existing
ASIC miners.  This EIP leans towards minimizing the security risks by making minimal
changes to the algorithm, accepting the risk that the change may not break dedicated
hardware miners that utilize partially- or fully-configurable logic.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore, we do not wish to introduce significant algorithm changes that
may alter the power utilization or performance profile of existing GPU hardware.&lt;&#x2F;p&gt;
&lt;p&gt;The change of FNV constant is a minimal change that can be quickly
implemented across the various network node and miner implementations.&lt;&#x2F;p&gt;
&lt;p&gt;It is proposed that &lt;code&gt;ASIC_MITIGATION_FORK_BLKNUM&lt;&#x2F;code&gt; be no more than 5550000 (epoch 185), giving
around 30 days of notice to node and miner developers and a sufficient window
for formal analysis of the changes by experts. We must weigh this window against
the risk introduced by allowing ASICs that may exist to continue to propagate
on the network, as well as the risk of providing too much advanced warning to
ASIC developers.&lt;&#x2F;p&gt;
&lt;p&gt;It is further understood that this change will not prevent redesign of existing
dedicated hardware with new ASIC chips. The intention of this change is only
to disable currently active or mid-production hardware and provide time for
POS development as well as larger algorithm changes to be well analyzed by
experts.&lt;&#x2F;p&gt;
&lt;p&gt;The choice of FNV constants is made based on the formal specification at
https:&#x2F;&#x2F;tools.ietf.org&#x2F;html&#x2F;draft-eastlake-fnv-14#section-2.1&lt;&#x2F;p&gt;
&lt;p&gt;@goobur provided the following python code to output primes matching this criteria:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;candidates&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;24&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;8&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; _&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; _&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; xrange&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;candidates&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;_&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; _&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; candidates&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt; is_prime&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;%x&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span&gt; _&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; _&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; candidates&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt; _&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;40&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;24&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;24&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;8&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The minimal prime constraint was relaxed, as has already been the case in &lt;code&gt;ethashV1&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Typical ASIC synthesis tools would optimize multiplication of a constant
in the FNV algorithm, while reducing the area needed for the multiplier according
to the hamming weight of the constant. To reduce the chance of ASIC adaptation
through minor mask changes, we propose choosing new constants with a larger
hamming weight, however care should be taken not to choose constants with too
large of a weight.&lt;&#x2F;p&gt;
&lt;p&gt;The current FNV prime, &lt;code&gt;0x1000193&lt;&#x2F;code&gt;, has a hamming weight of 6.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;c&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;HammingWeight&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10001a7&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 7&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;HammingWeight&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10001ab&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 7&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;HammingWeight&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10001cf&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;HammingWeight&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10001e3&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 7&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;HammingWeight&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10001ef&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 9&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Not chosen&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;HammingWeight&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10001f9&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;HammingWeight&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10001fb&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 9&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Not chosen&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;An analysis can be done regarding the dispersion of these constants as compared to
&lt;code&gt;0x01000193&lt;&#x2F;code&gt;, using the following snippet.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;c&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-969&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;include&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;stdlib.h&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;include&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;stdio.h&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;include&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string.h&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;int&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; main&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    u_int32_t&lt;&#x2F;span&gt;&lt;span&gt; candidate &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    u_int32_t&lt;&#x2F;span&gt;&lt;span&gt; dups &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    u_int32_t&lt;&#x2F;span&gt;&lt;span&gt; fnv_candidate &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10001a7&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MODIFY!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    u_int8_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt;counts &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; malloc&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;FFFFFFFF&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    memset&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;counts&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;FFFFFFFF&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;candidate &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; candidate &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;FFFFFFFF&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; candidate&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        u_int32_t&lt;&#x2F;span&gt;&lt;span&gt; result &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;u_int32_t&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;candidate &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; fnv_candidate&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        u_int8_t&lt;&#x2F;span&gt;&lt;span&gt; oldCount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; counts&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;result&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        counts&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;result&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; counts&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;result&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;oldCount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            dups&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        &#x2F;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; progress display: remove comment to speed down&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;if ((candidate &amp;amp; 0xFFFFF) == 0xFFFFF) printf(&amp;quot;0x%08x\n&amp;quot;, candidate);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    printf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;FNV candidate 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;%08x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; : &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;%i&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; dups&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; fnv_candidate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; dups&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;It can be empirically confirmed that no more than 1 duplicate occurs in the
32-bit word space with these constants.&lt;&#x2F;p&gt;
&lt;p&gt;It is worth noting that FNV is not a cryptographic hash, and it is not used as
such in ethash. That said, a more invasive hash algorithm change could be considered.&lt;&#x2F;p&gt;
&lt;p&gt;One suggestion has been &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;aappleby&#x2F;smhasher&#x2F;blob&#x2F;master&#x2F;src&#x2F;MurmurHash3.cpp&quot;&gt;MurmurHash3&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;twitter.com&#x2F;el33th4xor&#x2F;status&#x2F;981292363627810818&quot;&gt;Other suggestions have been made&lt;&#x2F;a&gt;:
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;P-H-C&#x2F;phc-winner-argon2&quot;&gt;Argon2&lt;&#x2F;a&gt;,
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;blog.z.cash&#x2F;why-equihash&#x2F;&quot;&gt;Equihash&lt;&#x2F;a&gt; of Zcash fame, and
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;crypto.stanford.edu&#x2F;balloon&#x2F;&quot;&gt;Balloon Hashing&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Another possible candidate is &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;tromp&#x2F;cuckoo&quot;&gt;Cuckoo Cycle&lt;&#x2F;a&gt;,
although there are some concerns regarding unaddressed optimization
vulnerabilities. One review can be found
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;da-data.blogspot.com&#x2F;2014&#x2F;03&#x2F;a-public-review-of-cuckoo-cycle.html&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This may be considered once the exact mechanism of the released ASICs is known and
their effectiveness against its optimisations can be fully evaluated.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change implements a backwards incompatible change to proof of work based
block mining.  All existing miners will be required to update to clients which
implement this new algorithm, and all nodes will require updates to accept
solutions from the new proof of work algorithm.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TODO: will need to generate test cases for &lt;code&gt;ethereum&#x2F;tests&lt;&#x2F;code&gt; repository corresponding to the consensus
changes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TODO&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Support for an Elliptic Curve Cycle</title>
        <published>2018-03-31T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Alexandre Belling</name><email>alexandrebelling8@gmail.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1895/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethresear.ch/t/reducing-the-verification-cost-of-a-snark-through-hierarchical-aggregation/5128" />
        

        <id>https://wg-eips.ritovision.com/1895/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:1895"
            label="EIP-1895" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1895/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;The EVM currently supports elliptic curves operations for curve &lt;em&gt;alt-bn128&lt;&#x2F;em&gt; thanks to precompiles &lt;code&gt;ecadd&lt;&#x2F;code&gt; and &lt;code&gt;ecmul&lt;&#x2F;code&gt; and &lt;code&gt;ecpairing&lt;&#x2F;code&gt;. The classes MNT4 and 6 contain cycles of curves. Those cycles enable doing operations on one curve inside a SNARK on the other curve (and reversely). This EIP suggests adding support for those curves.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Adds supports for the following operations through precompiles:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ecadd&lt;&#x2F;code&gt; on MNT4&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ecmul&lt;&#x2F;code&gt; on MNT4&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ecpairing&lt;&#x2F;code&gt; on MNT4&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Elliptic curve is the basic block of recursive SNARKs (ie: verifying a SNARK inside a SNARK) and this addresses the issue of scalable zero-knowledge. More generally this addresses partly the scalability issue as SNARKs verification are constant time in the size of the circuit being verified.&lt;&#x2F;p&gt;
&lt;p&gt;More concretely, today if the EVM has to deal with 1000s of SNARK verification it would take around 1.5 billion gas and would be impractical for Ethereum. Recursive SNARKs for instance make it possible to aggregate multiple proofs into a single one that can be verified like any other SNARK. It results in a massive cost reduction for the verification.&lt;&#x2F;p&gt;
&lt;p&gt;However, this is impossible using &lt;em&gt;alt-bn128&lt;&#x2F;em&gt; and in my knowledge, the only family of pairing-friendly curves known to produce cycles are MNT4 and MNT6. A complete characterization of the cycles existing between those two families is proposed in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;arxiv.org&#x2F;pdf&#x2F;1803.02067.pdf&quot;&gt;On cycles of pairing-friendly elliptic curves
&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;the-curve&quot;&gt;The curve&lt;&#x2F;h3&gt;
&lt;p&gt;The proposed cycle has been introduced in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;eprint.iacr.org&#x2F;2014&#x2F;595.pdf&quot;&gt;Scalable Zero Knowledge via Cycles of Elliptic Curves&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;mnt4-definition&quot;&gt;MNT4 definition&lt;&#x2F;h3&gt;
&lt;p&gt;The groups &lt;code&gt;G_1&lt;&#x2F;code&gt; and &lt;code&gt;G_2&lt;&#x2F;code&gt; are cyclic groups of prime order :&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;q = 475922286169261325753349249653048451545124878552823515553267735739164647307408490559963137&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;G_1&lt;&#x2F;code&gt; is defined over the field &lt;code&gt;F_p&lt;&#x2F;code&gt; of prime order :&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;p = 475922286169261325753349249653048451545124879242694725395555128576210262817955800483758081&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;with generator P:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;P = (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    60760244141852568949126569781626075788424196370144486719385562369396875346601926534016838,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    363732850702582978263902770815145784459747722357071843971107674179038674942891694705904306&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Both p and q can be written in 298 bits.&lt;&#x2F;p&gt;
&lt;p&gt;The group G_1 is defined on the curve defined by the equation &lt;code&gt;Y² = X³ + aX + b&lt;&#x2F;code&gt; where:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    a = 2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    b = 423894536526684178289416011533888240029318103673896002803341544124054745019340795360841685&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The twisted group G_2 is defined over the field &lt;code&gt;F_p^2 = F_p &#x2F; &amp;lt;&amp;lt;To be completed&amp;gt;&amp;gt;&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The twisted group G_2 is defined on the curve defined by the equation &lt;code&gt;Y² = X² + aX + b&lt;&#x2F;code&gt; where :&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    a = 34 + i * 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    b = 0 + i * 67372828414711144619833451280373307321534573815811166723479321465776723059456513877937430&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;G_2 generator is generated by :&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    P2 = (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        438374926219350099854919100077809681842783509163790991847867546339851681564223481322252708 +&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        i * 37620953615500480110935514360923278605464476459712393277679280819942849043649216370485641,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        37437409008528968268352521034936931842973546441370663118543015118291998305624025037512482 +&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        i * 424621479598893882672393190337420680597584695892317197646113820787463109735345923009077489&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;the-operations-and-gas-cost&quot;&gt;The operations and gas cost&lt;&#x2F;h3&gt;
&lt;p&gt;The following operations and their gas cost would be implemented&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;MNT_X_ADD = &amp;lt;&amp;lt;To be estimated&amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;MNT_X_MUL = &amp;lt;&amp;lt;To be estimated&amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;MNT_X_PAIRING = &amp;lt;&amp;lt;To be estimated&amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Where &lt;code&gt;X&lt;&#x2F;code&gt; is either 4.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;encoding&quot;&gt;Encoding&lt;&#x2F;h3&gt;
&lt;p&gt;The curves points P(X, Y) over F_p are represented in their compressed form C(X, Y):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    C = X | s&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where &lt;code&gt;s&lt;&#x2F;code&gt; represents &lt;code&gt;Y&lt;&#x2F;code&gt; as follow:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    |  `s&amp;#39;`  | `Y`                      |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    |--------|--------------------------|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    | `0x00` | Point at infinity        |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    | `0x02` | Solution with `y` even   |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    | `0x03` | Solution with `y` odd    |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Compression operation from affine coordinate is trivial:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    s = 0x02 | (s &amp;amp; 0x01)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In the EVM the compressed form allows us to represents curve points with 2 uint256 instead of 3.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;edge-cases&quot;&gt;Edge cases&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Several acceptable representations for the point at infinity&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The curve has 80 bits of security (whereas MNT6 has 120 bits) which might not be considered enough for critical security level, (for instance transferring several billions), but enough for others. If it turns out this is not enough security for adoption, there is another option : another cycle is being used by Coda but is defined over a 753 bits sized field which might also be prohibitively low (no reference to this curve from Coda&#x27;s publications found).&lt;&#x2F;p&gt;
&lt;p&gt;Independently of the cycle chosen, the groups and field elements are represented with integers larger than 256 bits (even for the 80 bits of security), therefore it might be necessary to also add support for larger field size operations.&lt;&#x2F;p&gt;
&lt;p&gt;We currently don&#x27;t know more efficient pairing-friendly cycles and don&#x27;t know if there are. It might be possible to circumvent this problem though by relaxing the constraint that all the curves of the cycle must be pairing friendly). If we had a cycle with only one pairing friendly curve we would still be able to compose proofs by alternating between SNARKs and any other general purpose zero-knowledge cryptosystems.&lt;&#x2F;p&gt;
&lt;p&gt;Assuming we find a convenient cycle, we don&#x27;t need to implement support for all the curves it contains, only one. The best choice would be the fastest one as the overall security of the recursive snark do not depends on which curve the verification is made.&lt;&#x2F;p&gt;
&lt;p&gt;Proper benchmarks will be done in order to make this choice and to price the operations in gas.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Eli-Ben-Sasson, Alessandro Chiesa, Eran Tromer, Madars Virza, [BCTV14], April 28, 2015, Scalable Zero Knowledge via Cycles of Elliptic Curves : https:&#x2F;&#x2F;eprint.iacr.org&#x2F;2014&#x2F;595.pdf&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;Alessandro Chiesa, Lynn Chua, Matthew Weidner, [CCW18], November 5, 2018, On cycles of pairing-friendly elliptic curves : https:&#x2F;&#x2F;arxiv.org&#x2F;pdf&#x2F;1803.02067.pdf&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;AlexandreBelling&#x2F;go-boojum&quot;&gt;go-boojum&lt;&#x2F;a&gt; : A PoC demo of an application of recursive SNARKs&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;scipr-lab&#x2F;libff&quot;&gt;libff&lt;&#x2F;a&gt; : a C++ library for finite fields and elliptic curves&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;CodaProtocol&#x2F;coda&quot;&gt;coda&lt;&#x2F;a&gt; : a new cryptocurrency protocol with a lightweight, constant sized blockchain.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Add precompiled contract for Ed25519 signature verification</title>
        <published>2018-03-25T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Tobias Oberstein</name><email>tobias.oberstein@crossbario.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/665/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/665/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:665"
            label="EIP-665" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/665/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Support performant and cheap verification of Ed25519 cryptographic signatures in smart contracts in general by adding a precompiled contract for Ed25519 signature verification to the EVM.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Verification of Ed25519 cryptographic signatures is obviously possible in EVM bytecode. However, the gas cost will be very high, and computationally expensive, as such tight, wide word operations intensive code as required for Ed25519 is not a good fit for the EVM bytecode model.&lt;&#x2F;p&gt;
&lt;p&gt;The addition of a native compiled function, in a precompiled contract, to the EVM solves both cost and performance problems.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Ed25519 and Ed448 (that is, EdDSA using Curve25519 or Curve448) are IETF recommendations (&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;tools.ietf.org&#x2F;html&#x2F;rfc7748&quot;&gt;RFC7748&lt;&#x2F;a&gt;) with some attractive properties:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Ed25519 is intended to operate at around the 128-bit security level and Ed448 at around the 224-bit security level&lt;&#x2F;li&gt;
&lt;li&gt;EdDSA uses small public keys (32 or 57 octets) and signatures (64 or 114 octets) for Ed25519 and Ed448, respectively&lt;&#x2F;li&gt;
&lt;li&gt;Ed25519&#x2F;Ed448 are designed so that fast, constant-time (timing attack resistant) and generally side-channel resistant  implementations are easier to produce&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Despite being around only for some years, post-Snowden, these curves &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ianix.com&#x2F;pub&#x2F;ed25519-deployment.html&quot;&gt;have gained wide use&lt;&#x2F;a&gt; quickly in various protocols and systems:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;TLS &#x2F; ECDH(E) (session keys)&lt;&#x2F;li&gt;
&lt;li&gt;TLS &#x2F; x.509 (client and server certificates)&lt;&#x2F;li&gt;
&lt;li&gt;DNSSEC (zone signing)&lt;&#x2F;li&gt;
&lt;li&gt;OpenSSH (user keys)&lt;&#x2F;li&gt;
&lt;li&gt;GNUPG&#x2F;OpenPGP (user keys)&lt;&#x2F;li&gt;
&lt;li&gt;OpenBSD Signify (software signing)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;One motivation for Ed25519 signature verification in smart contracts is to &lt;strong&gt;associate&lt;&#x2F;strong&gt; existing off-chain systems, records or accounts that use Ed25519 (like above) with blockchain addresses or &lt;strong&gt;delegate&lt;&#x2F;strong&gt; by allowing to sign data with Ed25519 (only), and then submit this Ed25519-signed data anonymously (via any Eth sender address) to the blockchain, having the contract check the Ed25519 signature of the transaction.&lt;&#x2F;p&gt;
&lt;p&gt;Another motivation is the processing of external, Ed25519 proof-of-stake based blockchains within Ethereum smart contracts.&lt;&#x2F;p&gt;
&lt;p&gt;When a transactions contains data that comes with an Ed25519 signature, that proves that the sender of the Ethereum transaction was also in control of the private key (and the data), and this allows the contract to establish an association between the blockchain and the external system or account, and the external system establish the reverse relation.&lt;&#x2F;p&gt;
&lt;p&gt;For example, a contract might check a Ed25519 signed piece of data submitted to the Ethereum transaction like the current block number. That proves to the contract, that the sender is in possession of both the Ethereum private key and the Ed25519 private key, and hence the contract will accept an association between both. This again can be the root anchor for various powerful applications, as now a potentially crypto holding key owner has proven to be in control of some external off-chain system or account, like e.g. a DNS server, a DNS domain, a cluster node and so on.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= CONSTANTINOPLE_FORK_BLKNUM&lt;&#x2F;code&gt;, add a precompiled contract for Ed25519 signature verification (&lt;code&gt;ED25519VFY&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;The proposal adds a new precompiled function &lt;code&gt;ED25519VFY&lt;&#x2F;code&gt; with the following input and output.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;ED25519VFY&lt;&#x2F;code&gt; takes as &lt;strong&gt;input 128 octets&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;message&lt;&#x2F;strong&gt;: the 32-octet message that was signed&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;public key&lt;&#x2F;strong&gt;: the 32-octet Ed25519 public key of the signer&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;signature&lt;&#x2F;strong&gt;: the 64-octet Ed25519 signature&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;code&gt;ED25519VFY&lt;&#x2F;code&gt; returns as &lt;strong&gt;output 4 octets&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;0x00000000&lt;&#x2F;code&gt; if signature is valid&lt;&#x2F;li&gt;
&lt;li&gt;any non-zero value indicates a signature verification failure&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;address&quot;&gt;Address&lt;&#x2F;h3&gt;
&lt;p&gt;The address of &lt;code&gt;ED25519VFY&lt;&#x2F;code&gt; is &lt;strong&gt;&lt;code&gt;0x9&lt;&#x2F;code&gt;.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-costs&quot;&gt;Gas costs&lt;&#x2F;h3&gt;
&lt;p&gt;Gas cost for &lt;code&gt;ED25519VFY&lt;&#x2F;code&gt; is &lt;strong&gt;2000&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The proposed &lt;code&gt;ED25519VFY&lt;&#x2F;code&gt; function takes the signer public key as a call parameter, as with Ed25519, I don&#x27;t believe it is possible to derive the signers public key from the signature and message alone.&lt;&#x2F;p&gt;
&lt;p&gt;The proposed &lt;code&gt;ED25519VFY&lt;&#x2F;code&gt; function uses a zero return value to indicate success, since this allows for different errors to be distinguished by return value, as all non-zero return values signal a verification failure.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;ECRECOVER&lt;&#x2F;code&gt; has a gas cost of 3000. Since Ed25519 is computationally cheaper, the gas price should be less.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;As the proposed precompiled contract is deployed at a reserved (&amp;lt;255) and previously unused address, an implementation of the proposal should not introduce any backward compatibility issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test vectors for Ed25519 can be found in this IETF ID https:&#x2F;&#x2F;tools.ietf.org&#x2F;html&#x2F;draft-josefsson-eddsa-ed25519-03#section-6.&lt;&#x2F;p&gt;
&lt;p&gt;More test vectors can be found in the regression tests of NaCl (see references).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;libsodium&quot;&gt;libsodium&lt;&#x2F;h3&gt;
&lt;p&gt;libsodium is a mature, high-quality C implementation of Ed25519, with bindings for many languages.&lt;&#x2F;p&gt;
&lt;p&gt;Further, libsodium is (to my knowledge, and as of today 2018&#x2F;04) the only Ed25519 implementation that has gone through a &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.privateinternetaccess.com&#x2F;blog&#x2F;2017&#x2F;08&#x2F;libsodium-v1-0-12-and-v1-0-13-security-assessment&#x2F;&quot;&gt;Security Assessment&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;To minimize consensus failure risks, the proposal recommends to use libsodium for adding the precompile in all Ethereum client implementations.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Note: as an alternative to libsodium, I looked into HACL, an implementation of Ed25519 in F* (a ML dialect) that can be transpiled to C, and that was formally verified for functional correctness and memory safety of the resulting C code. However, this is new and compared to libsodium which is a &quot;know thing&quot; seems risky nevertheless.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h3 id=&quot;libsodium-bindings&quot;&gt;libsodium bindings&lt;&#x2F;h3&gt;
&lt;p&gt;Here is an overview of the language bindings to libsodium for four Ethereum clients this proposal recommends:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Client&lt;&#x2F;th&gt;&lt;th&gt;Language&lt;&#x2F;th&gt;&lt;th&gt;libsodium binding&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Geth&lt;&#x2F;td&gt;&lt;td&gt;Go&lt;&#x2F;td&gt;&lt;td&gt;use cgo with C &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;jedisct1&#x2F;libsodium&quot;&gt;libsodium&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Parity&lt;&#x2F;td&gt;&lt;td&gt;Rust&lt;&#x2F;td&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;dnaq&#x2F;sodiumoxide&quot;&gt;sodiumoxide&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;PyEthereum&lt;&#x2F;td&gt;&lt;td&gt;Python&lt;&#x2F;td&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;pyca&#x2F;pynacl&quot;&gt;PyNaCl&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;cpp-ethereum&lt;&#x2F;td&gt;&lt;td&gt;C++&lt;&#x2F;td&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;jedisct1&#x2F;libsodium&quot;&gt;libsodium&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;hr &#x2F;&gt;
&lt;h3 id=&quot;prs&quot;&gt;PRs&lt;&#x2F;h3&gt;
&lt;p&gt;Implementations of this proposal are here:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;go-ethereum&#x2F;pull&#x2F;16453&quot;&gt;go-ethereum PR #16453&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;pyethereum&#x2F;pull&#x2F;862&quot;&gt;pyethereum PR #862&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;paritytech&#x2F;parity&#x2F;pull&#x2F;8330&quot;&gt;parity PR #8330&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;cpp-ethereum&#x2F;pull&#x2F;4945&quot;&gt;cpp-ethereum PR #4945&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;RFC7748 - Elliptic Curves for Security https:&#x2F;&#x2F;tools.ietf.org&#x2F;html&#x2F;rfc7748&lt;&#x2F;li&gt;
&lt;li&gt;Definition of Ed25519: https:&#x2F;&#x2F;ed25519.cr.yp.to&#x2F;ed25519-20110926.pdf&lt;&#x2F;li&gt;
&lt;li&gt;Ed25519 - high-speed high-security signatures: https:&#x2F;&#x2F;ed25519.cr.yp.to&#x2F;&lt;&#x2F;li&gt;
&lt;li&gt;NaCl - Networking and Cryptography library: https:&#x2F;&#x2F;nacl.cr.yp.to&#x2F;sign.html&lt;&#x2F;li&gt;
&lt;li&gt;NaCl Crypto Libraries (which contains Ed25519): https:&#x2F;&#x2F;ianix.com&#x2F;pub&#x2F;ed25519-deployment.html&lt;&#x2F;li&gt;
&lt;li&gt;Test vectors for Ed25519: https:&#x2F;&#x2F;tools.ietf.org&#x2F;html&#x2F;draft-josefsson-eddsa-ed25519-03#section-6&lt;&#x2F;li&gt;
&lt;li&gt;NaCl regression tests: https:&#x2F;&#x2F;ed25519.cr.yp.to&#x2F;python&#x2F;sign.py and https:&#x2F;&#x2F;ed25519.cr.yp.to&#x2F;python&#x2F;sign.input&lt;&#x2F;li&gt;
&lt;li&gt;On the recoverability of public keys from signature+message (alone): https:&#x2F;&#x2F;crypto.stackexchange.com&#x2F;questions&#x2F;9936&#x2F;what-signature-schemes-allow-recovering-the-public-key-from-a-signature&lt;&#x2F;li&gt;
&lt;li&gt;Bernstein, D., &quot;Curve25519: new Diffie-Hellman speed records&quot;, DOI 10.1007&#x2F;11745853_14, February 2006, https:&#x2F;&#x2F;cr.yp.to&#x2F;ecdh.html&lt;&#x2F;li&gt;
&lt;li&gt;Hamburg, M., &quot;Ed448-Goldilocks, a new elliptic curve&quot;, June 2015, https:&#x2F;&#x2F;eprint.iacr.org&#x2F;2015&#x2F;625&amp;gt;&lt;&#x2F;li&gt;
&lt;li&gt;RFC8080: Edwards-Curve Digital Security Algorithm (EdDSA) for DNSSEC (https:&#x2F;&#x2F;datatracker.ietf.org&#x2F;doc&#x2F;html&#x2F;rfc8080)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Add chain id to mixed-case checksum address encoding</title>
        <published>2018-03-18T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Juliano Rizzo</name><uri>https://github.com/juli</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1191/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/1121" />
        

        <id>https://wg-eips.ritovision.com/1191/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="last-call"
                label="Last Call" />
            
        

        
        <category
            term="tag:eip:1191"
            label="ERC-1191" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1191/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP extends &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;55&#x2F;&quot;&gt;EIP-55&lt;&#x2F;a&gt; by optionally adding a chain id defined by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt; to the checksum calculation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;55&#x2F;&quot;&gt;EIP-55&lt;&#x2F;a&gt; was created to prevent users from losing funds by sending them to invalid addresses. This EIP extends &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;55&#x2F;&quot;&gt;EIP-55&lt;&#x2F;a&gt; to protect users from losing funds by sending them to addresses that are valid but that where obtained from a client of another network.For example, if this EIP is implemented, a wallet can alert the user that is trying to send funds to an Ethereum Testnet address from an Ethereum Mainnet wallet.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The motivation of this proposal is to provide a mechanism to allow software to distinguish addresses from different Ethereum based networks. This proposal is necessary because Ethereum addresses are hashes of public keys and do not include any metadata. By extending the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;55&#x2F;&quot;&gt;EIP-55&lt;&#x2F;a&gt; checksum algorithm it is possible to achieve this objective.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Convert the address using the same algorithm defined by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;55&#x2F;&quot;&gt;EIP-55&lt;&#x2F;a&gt; but if a registered chain id is provided, add it to the input of the hash function. If the chain id passed to the function belongs to a network that opted for using this checksum variant, prefix the address with the chain id and the &lt;code&gt;0x&lt;&#x2F;code&gt; separator before calculating the hash. Then convert the address to hexadecimal, but if the ith digit is a letter (ie. it&#x27;s one of &lt;code&gt;abcdef&lt;&#x2F;code&gt;) print it in uppercase if the 4*ith bit of the calculated hash is 1 otherwise print it in lowercase.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Benefits:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;By means of a minimal code change on existing libraries, users are protected from losing funds by mixing addresses of different Ethereum based networks.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;!&#x2F;usr&#x2F;bin&#x2F;python3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt; sha3&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; import&lt;&#x2F;span&gt;&lt;span&gt; keccak_256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; random&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;   addr (str): Hexadecimal address, 40 characters long with 2 characters prefix&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;   chainid (int): chain id from EIP-155 &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; eth_checksum_encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; chainid&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    adopted_eip1191&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;30&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 31&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    hash_input&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; str&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;chainid&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;lower&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt; chainid&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; adopted_eip1191&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;lower&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    hash_output&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; keccak_256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;hash_input&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;utf8&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;hexdigest&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    aggregate&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; zip&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;lower&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;hash_output&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    out&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;join&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;c&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;upper&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;a&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;16&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; c&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; aggregate&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; out&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;eth_mainnet&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x27b1fdb04752bbc536007a920d24acb045561c26&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x3599689E6292b81B2d85451025146515070129Bb&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x42712D45473476b98452f434e72461577D686318&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x52908400098527886E0F7030069857D2E4169EE7&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x6549f4939460DE12611948b3f82b88C3C8975323&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x66f9664f97F2b50F62D13eA064982f936dE76657&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x8617E340B3D01FA5F11F306F4090FD50E238070D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x88021160C5C792225E4E5452585947470010289D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xD1220A0cf47c7B9Be7A2E6BA89F429762e7b9aDb&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xdbF03B407c01E7cD3CBea99509d93f8DDDC8C6FB&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xde709f2102306220921060314715629080e2fb77&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xfB6916095ca1df60bB79Ce92cE3Ea74c37c5d359&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;rsk_mainnet&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x27b1FdB04752BBc536007A920D24ACB045561c26&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x3599689E6292B81B2D85451025146515070129Bb&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x42712D45473476B98452f434E72461577d686318&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x52908400098527886E0F7030069857D2E4169ee7&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x5aaEB6053f3e94c9b9a09f33669435E7ef1bEAeD&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x6549F4939460DE12611948B3F82B88C3C8975323&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x66F9664f97f2B50F62d13EA064982F936de76657&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x8617E340b3D01Fa5f11f306f4090fd50E238070D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x88021160c5C792225E4E5452585947470010289d&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xD1220A0Cf47c7B9BE7a2e6ba89F429762E7B9adB&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xDBF03B407c01E7CD3cBea99509D93F8Dddc8C6FB&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xDe709F2102306220921060314715629080e2FB77&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xFb6916095cA1Df60bb79ce92cE3EA74c37c5d359&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;rsk_testnet&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x27B1FdB04752BbC536007a920D24acB045561C26&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x3599689e6292b81b2D85451025146515070129Bb&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x42712D45473476B98452F434E72461577D686318&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x52908400098527886E0F7030069857D2e4169EE7&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x5aAeb6053F3e94c9b9A09F33669435E7EF1BEaEd&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x6549f4939460dE12611948b3f82b88C3c8975323&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x66f9664F97F2b50f62d13eA064982F936DE76657&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x8617e340b3D01fa5F11f306F4090Fd50e238070d&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x88021160c5C792225E4E5452585947470010289d&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xd1220a0CF47c7B9Be7A2E6Ba89f429762E7b9adB&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xdbF03B407C01E7cd3cbEa99509D93f8dDDc8C6fB&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xDE709F2102306220921060314715629080e2Fb77&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xFb6916095CA1dF60bb79CE92ce3Ea74C37c5D359&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;test_cases&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;30&lt;&#x2F;span&gt;&lt;span&gt; :&lt;&#x2F;span&gt;&lt;span&gt; rsk_mainnet&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 31&lt;&#x2F;span&gt;&lt;span&gt; :&lt;&#x2F;span&gt;&lt;span&gt; rsk_testnet&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt; :&lt;&#x2F;span&gt;&lt;span&gt; eth_mainnet&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt; chainid&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; cases&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; test_cases&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;items&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; cases&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt; addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; eth_checksum_encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;chainid&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;usage&quot;&gt;Usage&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;usage-table&quot;&gt;Usage  Table&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Network&lt;&#x2F;th&gt;&lt;th&gt;Chain id&lt;&#x2F;th&gt;&lt;th&gt;Supports this EIP&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;RSK Mainnet&lt;&#x2F;td&gt;&lt;td&gt;30&lt;&#x2F;td&gt;&lt;td&gt;Yes&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;RSK Testnet&lt;&#x2F;td&gt;&lt;td&gt;31&lt;&#x2F;td&gt;&lt;td&gt;Yes&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;implementation-table&quot;&gt;Implementation Table&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Project&lt;&#x2F;th&gt;&lt;th&gt;EIP Usage&lt;&#x2F;th&gt;&lt;th&gt;Implementation&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;MyCrypto&lt;&#x2F;td&gt;&lt;td&gt;Yes&lt;&#x2F;td&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;MyCryptoHQ&#x2F;MyCrypto&#x2F;blob&#x2F;develop&#x2F;common&#x2F;utils&#x2F;formatters.ts#L126&quot;&gt;JavaScript&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;MyEtherWallet&lt;&#x2F;td&gt;&lt;td&gt;Yes&lt;&#x2F;td&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;MyEtherWallet&#x2F;MyEtherWallet&#x2F;blob&#x2F;73c4a24f8f67c655749ac990c5b62efd92a2b11a&#x2F;src&#x2F;helpers&#x2F;addressUtils.js#L22&quot;&gt;JavaScript&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Ledger&lt;&#x2F;td&gt;&lt;td&gt;Yes&lt;&#x2F;td&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;LedgerHQ&#x2F;ledger-app-eth&#x2F;blob&#x2F;master&#x2F;src_common&#x2F;ethUtils.c#L203&quot;&gt;C&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Trezor&lt;&#x2F;td&gt;&lt;td&gt;Yes&lt;&#x2F;td&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;trezor&#x2F;trezor-core&#x2F;blob&#x2F;270bf732121d004a4cd1ab129adaccf7346ff1db&#x2F;src&#x2F;apps&#x2F;ethereum&#x2F;get_address.py#L32&quot;&gt;Python&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;trezor&#x2F;trezor-crypto&#x2F;blob&#x2F;4153e662b60a0d83c1be15150f18483a37e9092c&#x2F;address.c#L62&quot;&gt;C&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Web3.js&lt;&#x2F;td&gt;&lt;td&gt;Yes&lt;&#x2F;td&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;web3.js&#x2F;blob&#x2F;aaf26c8806bc9fb60cf6dcb6658104963c6c7fc7&#x2F;packages&#x2F;web3-utils&#x2F;src&#x2F;Utils.js#L140&quot;&gt;JavaScript&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;EthereumJS-util&lt;&#x2F;td&gt;&lt;td&gt;Yes&lt;&#x2F;td&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereumjs&#x2F;ethereumjs-util&#x2F;pull&#x2F;204&#x2F;commits&#x2F;cdf0b3c996b05ac5b1f758f17ea9f9ed1847c1eb&quot;&gt;JavaScript&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;ENS address-encoder&lt;&#x2F;td&gt;&lt;td&gt;Yes&lt;&#x2F;td&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ensdomains&#x2F;address-encoder&#x2F;commit&#x2F;5bf53b13fa014646ea28c9e5f937361dc9b40590&quot;&gt;TypeScript&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Address metadata registry</title>
        <published>2018-03-12T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Nick Johnson</name><email>nick@ethereum.org</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/926/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/926/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:926"
            label="ERC-926" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/926/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP specifies a registry for address metadata, permitting both contracts and external accounts to supply metadata about themselves to onchain and offchain callers. This permits use-cases such as generalised authorisations, providing token acceptance settings, and claims registries.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;An increasing set of use cases require storage of metadata associated with an address; see for instance EIP 777 and EIP 780, and the ENS reverse registry in EIP 181. Presently each use-case defines its own specialised registry. To prevent a proliferation of special-purpose registry contracts, we instead propose a single standardised registry using an extendable architecture that allows future standards to implement their own metadata standards.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The metadata registry has the following interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AddressMetadataRegistry&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; provider&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; target&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setProvider&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _provider&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;setProvider&lt;&#x2F;code&gt; specifies the metadata registry to be associated with the caller&#x27;s address, while &lt;code&gt;provider&lt;&#x2F;code&gt; returns the address of the metadata registry for the supplied address.&lt;&#x2F;p&gt;
&lt;p&gt;The metadata registry will be compiled with an agreed-upon version of Solidity and deployed using the trustless deployment mechanism to a fixed address that can be replicated across all chains.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;provider-specification&quot;&gt;Provider specification&lt;&#x2F;h2&gt;
&lt;p&gt;Providers may implement any subset of the metadata record types specified here. Where a record types specification requires a provider to provide multiple functions, the provider MUST implement either all or none of them. Providers MUST throw if called with an unsupported function ID.&lt;&#x2F;p&gt;
&lt;p&gt;Providers have one mandatory function:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; function is documented in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;EIP-165&lt;&#x2F;a&gt;, and returns true if the provider implements the interface specified by the provided 4 byte identifier. An interface identifier consists of the XOR of the function signature hashes of the functions provided by that interface; in the degenerate case of single-function interfaces, it is simply equal to the signature hash of that function. If a provider returns &lt;code&gt;true&lt;&#x2F;code&gt; for &lt;code&gt;supportsInterface()&lt;&#x2F;code&gt;, it must implement the functions specified in that interface.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;supportsInterface&lt;&#x2F;code&gt; must always return true for &lt;code&gt;0x01ffc9a7&lt;&#x2F;code&gt;, which is the interface ID of &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; itself.&lt;&#x2F;p&gt;
&lt;p&gt;The first argument to all provider functions MUST be the address being queried; this facilitates the creation of multi-user provider contracts.&lt;&#x2F;p&gt;
&lt;p&gt;Currently standardised provider interfaces are specified in the table below.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Interface name&lt;&#x2F;th&gt;&lt;th&gt;Interface hash&lt;&#x2F;th&gt;&lt;th&gt;Specification&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;EIPs may define new interfaces to be added to this registry.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;There are two obvious approaches for a generic metadata registry: the indirection approach employed here, or a generalised key&#x2F;value store. While indirection incurs the cost of an additional contract call, and requires providers to change over time, it also provides for significantly enhanced flexibility over a key&#x2F;value store; for that reason we selected this approach.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;There are no backwards compatibility concerns.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The canonical implementation of the metadata registry is as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AddressMetadataRegistry&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; provider&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setProvider&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _provider&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    provider&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; _provider&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Generalised authorisations</title>
        <published>2018-03-12T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Nick Johnson</name><email>nick@ethereum.org</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/927/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/927/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:927"
            label="ERC-927" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/927/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP specifies a generic authorisation mechanism, which can be used to implement a variety of authorisation patterns, replacing approvals in ERC20, operators in ERC777, and bespoke authorisation patterns in a variety of other types of contract.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Smart contracts commonly need to provide an interface that allows a third-party caller to perform actions on behalf of a user. The most common example of this is token authorisations&#x2F;operators, but other similar situations exist throughout the ecosystem, including for instance authorising operations on ENS domains. Typically each standard reinvents this system for themselves, leading to a large number of incompatible implementations of the same basic pattern. Here, we propose a generic method usable by all such contracts.&lt;&#x2F;p&gt;
&lt;p&gt;The pattern implemented here is inspired by &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;dapphub&#x2F;ds-auth&quot;&gt;ds-auth&lt;&#x2F;a&gt; and by OAuth.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The generalised authorisation interface is implemented as a metadata provider, as specified in EIP 926. The following mandatory function is implemented:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; canCall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; caller&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; callee&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; func&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;owner&lt;&#x2F;code&gt; is the owner of the resource. If approved the function call is treated as being made by this address.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;caller&lt;&#x2F;code&gt; is the address making the present call.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;callee&lt;&#x2F;code&gt; is the address of the contract being called.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;func&lt;&#x2F;code&gt; is the 4-byte signature of the function being called.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;For example, suppose Alice authorises Bob to transfer tokens on her behalf. When Bob does so, Alice is the &lt;code&gt;owner&lt;&#x2F;code&gt;, Bob is the &lt;code&gt;caller&lt;&#x2F;code&gt;, the token contract is the &lt;code&gt;callee&lt;&#x2F;code&gt;, and the function signature for the transfer function is &lt;code&gt;func&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;As this standard uses EIP 926, the authorisation flow is as follows:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The callee contract fetches the provider for the &lt;code&gt;owner&lt;&#x2F;code&gt; address from the metadata registry contract, which resides at a well-known address.&lt;&#x2F;li&gt;
&lt;li&gt;The callee contract calls &lt;code&gt;canCall()&lt;&#x2F;code&gt; with the parameters described above. If the function returns false, the callee reverts execution.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Commonly, providers will wish to supply a standardised interface for users to set and unset their own authorisations. They SHOULD implement the following interface:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; authoriseCaller&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; caller&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; callee&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; func&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revokeCaller&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; caller&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; callee&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; func&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Arguments have the same meaning as in &lt;code&gt;canCall&lt;&#x2F;code&gt;. Implementing contracts MUST ensure that &lt;code&gt;msg.sender&lt;&#x2F;code&gt; is authorised to call &lt;code&gt;authoriseCaller&lt;&#x2F;code&gt; or &lt;code&gt;revokeCaller&lt;&#x2F;code&gt; on behalf of &lt;code&gt;owner&lt;&#x2F;code&gt;; this MUST always be true if &lt;code&gt;owner == msg.sender&lt;&#x2F;code&gt;. Implementing contracts SHOULD use the standard specified here to determine if other callers may provide authorisations as well.&lt;&#x2F;p&gt;
&lt;p&gt;Implementing contracts SHOULD treat a &lt;code&gt;func&lt;&#x2F;code&gt; of 0 as authorising calls to all functions on &lt;code&gt;callee&lt;&#x2F;code&gt;. If &lt;code&gt;authorised&lt;&#x2F;code&gt; is &lt;code&gt;false&lt;&#x2F;code&gt; and &lt;code&gt;func&lt;&#x2F;code&gt; is 0, contracts need only clear any blanket authorisation; individual authorisations may remain in effect.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;There are no backwards compatibility concerns.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Example implementation TBD.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Mineable Token Standard</title>
        <published>2018-03-07T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Jay Logelin</name><email>jlogelin@alumni.harvard.edu</email>
	</author>
	
	<author>
		<name>Infernal_toast</name><email>admin@0xbitcoin.org</email>
	</author>
	
	<author>
		<name>Michael Seiler</name><email>mgs33@cornell.edu</email>
	</author>
	
	<author>
		<name>Brandon Grill</name><email>bg2655@columbia.edu</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/918/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/918/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:918"
            label="ERC-918" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/918/">&lt;h3 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h3&gt;
&lt;p&gt;A specification for a standardized Mineable Token that uses a Proof of Work algorithm for distribution.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h3&gt;
&lt;p&gt;This specification describes a method for initially locking tokens within a token contract and slowly dispensing them with a mint() function which acts like a faucet. This mint() function uses a Proof of Work algorithm in order to minimize gas fees and control the distribution rate. Additionally, standardization of mineable tokens will give rise to standardized CPU and GPU token mining software, token mining pools and other external tools in the token mining ecosystem.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h3&gt;
&lt;p&gt;Token distribution via the ICO model and its derivatives is susceptible to illicit behavior by human actors. Furthermore, new token projects are centralized because a single entity must handle and control all of the initial coins and all of the raised ICO money.  By distributing tokens via an &#x27;Initial Mining Offering&#x27; (or IMO), the ownership of the token contract no longer belongs with the deployer at all and the deployer is &#x27;just another user.&#x27; As a result, investor risk exposure utilizing a mined token distribution model is significantly diminished. This standard is intended to be standalone, allowing maximum interoperability with ERC20, ERC721, and others.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;interface&quot;&gt;Interface&lt;&#x2F;h4&gt;
&lt;p&gt;The general behavioral specification includes a primary function that defines the token minting operation, an optional merged minting operation for issuing multiple tokens, getters for challenge number, mining difficulty, mining target and current reward, and finally a Mint event, to be emitted upon successful solution validation and token issuance. At a minimum, contracts must adhere to this interface (save the optional merge operation). It is recommended that contracts interface with the more behaviorally defined Abstract Contract described below, in order to leverage a more defined construct, allowing for easier external implementations via overridden phased functions. (see &#x27;Abstract Contract&#x27; below)&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC918&lt;&#x2F;span&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getAdjustmentInterval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getChallengeNumber&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getMiningDifficulty&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getMiningTarget&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getMiningReward&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; decimals&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; rewardAmount&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; epochCount&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newChallengeNumber&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;abstract-contract-optional&quot;&gt;Abstract Contract (Optional)&lt;&#x2F;h4&gt;
&lt;p&gt;The Abstract Contract adheres to the EIP918 Interface and extends behavioral definition through the introduction of 4 internal phases of token mining and minting: hash, reward, epoch and adjust difficulty, all called during the mint() operation. This construct provides a balance between being too general for use while providing ample room for multiple mined implementation types.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;fields&quot;&gt;Fields&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;adjustmentinterval&quot;&gt;adjustmentInterval&lt;&#x2F;h4&gt;
&lt;p&gt;The amount of time between difficulty adjustments in seconds.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; adjustmentInterval&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;challengenumber&quot;&gt;challengeNumber&lt;&#x2F;h4&gt;
&lt;p&gt;The current challenge number. It is expected that a new challenge number is generated after a new reward is minted.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; challengeNumber&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;difficulty&quot;&gt;difficulty&lt;&#x2F;h4&gt;
&lt;p&gt;The current mining difficulty which should be adjusted via the _adjustDifficulty minting phase&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; difficulty&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;tokensminted&quot;&gt;tokensMinted&lt;&#x2F;h4&gt;
&lt;p&gt;Cumulative counter of the total minted tokens, usually modified during the _reward phase&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; tokensMinted&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;epochcount&quot;&gt;epochCount&lt;&#x2F;h4&gt;
&lt;p&gt;Number of &#x27;blocks&#x27; mined&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; epochCount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;mining-operations&quot;&gt;Mining Operations&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;mint&quot;&gt;mint&lt;&#x2F;h4&gt;
&lt;p&gt;Returns a flag indicating a successful hash digest verification, and reward allocation to msg.sender. In order to prevent MiTM attacks, it is recommended that the digest include a recent Ethereum block hash and msg.sender&#x27;s address. Once verified, the mint function calculates and delivers a mining reward to the sender and performs internal accounting operations on the contract&#x27;s supply.&lt;&#x2F;p&gt;
&lt;p&gt;The mint operation exists as a public function that invokes 4 separate phases, represented as functions hash, _reward, _newEpoch, and _adjustDifficulty. In order to create the most flexible implementation while adhering to a necessary contract protocol, it is recommended that token implementors override the internal methods, allowing the base contract to handle their execution via mint.&lt;&#x2F;p&gt;
&lt;p&gt;This externally facing function is called by miners to validate challenge digests, calculate reward,
populate statistics, mutate epoch variables and adjust the solution difficulty as required. Once complete,
a Mint event is emitted before returning a boolean success flag.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AbstractERC918&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; EIP918Interface&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the amount of time between difficulty adjustments&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; adjustmentInterval&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; generate a new challenge number after a new reward is minted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; challengeNumber&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the current mining target&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; miningTarget&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; cumulative counter of the total minted tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; tokensMinted&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; number of blocks per difficulty readjustment&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; blocksPerReadjustment&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;number of &amp;#39;blocks&amp;#39; mined&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; epochCount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Externally facing mint function that is called by miners to validate challenge digests, calculate reward,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * populate statistics, mutate epoch variables and adjust the solution difficulty as required. Once complete,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * a Mint event is emitted before returning a success indicator.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; perform the hash function validation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;nonce&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; calculate the current reward&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint&lt;&#x2F;span&gt;&lt;span&gt; rewardAmount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _reward&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; increment the minted tokens amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        tokensMinted &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; rewardAmount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        epochCount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;every so often, readjust difficulty. Don&amp;#39;t readjust when deploying&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;epochCount % blocksPerReadjustment &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            _adjustDifficulty&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;       &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; send Mint event indicating a successful implementation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; rewardAmount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; epochCount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; challengeNumber&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;mint-event&quot;&gt;&lt;em&gt;Mint Event&lt;&#x2F;em&gt;&lt;&#x2F;h5&gt;
&lt;p&gt;Upon successful verification and reward the mint method dispatches a Mint Event indicating the reward address, the reward amount, the epoch count and newest challenge number.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; reward_amount&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; epochCount&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newChallengeNumber&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;hash&quot;&gt;hash&lt;&#x2F;h4&gt;
&lt;p&gt;Public interface function hash, meant to be overridden in implementation to define hashing algorithm and validation. Returns the validated digest&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; digest&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;reward&quot;&gt;_reward&lt;&#x2F;h4&gt;
&lt;p&gt;Internal interface function _reward, meant to be overridden in implementation to calculate and allocate the reward amount. The reward amount must be returned by this method.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _reward&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;newepoch&quot;&gt;_newEpoch&lt;&#x2F;h4&gt;
&lt;p&gt;Internal interface function _newEpoch, meant to be overridden in implementation to define a cutpoint for mutating mining variables in preparation for the next phase of mine.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _newEpoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;adjustdifficulty&quot;&gt;_adjustDifficulty&lt;&#x2F;h4&gt;
&lt;p&gt;Internal interface function _adjustDifficulty, meant to be overridden in implementation to adjust the difficulty (via field difficulty) of the mining as required&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _adjustDifficulty&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;getadjustmentinterval&quot;&gt;getAdjustmentInterval&lt;&#x2F;h4&gt;
&lt;p&gt;The amount of time, in seconds, between difficulty adjustment operations.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getAdjustmentInterval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;getchallengenumber&quot;&gt;getChallengeNumber&lt;&#x2F;h4&gt;
&lt;p&gt;Recent ethereum block hash, used to prevent pre-mining future blocks.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getChallengeNumber&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;getminingdifficulty&quot;&gt;getMiningDifficulty&lt;&#x2F;h4&gt;
&lt;p&gt;The number of digits that the digest of the PoW solution requires which typically auto adjusts during reward generation.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getMiningDifficulty&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;getminingreward&quot;&gt;getMiningReward&lt;&#x2F;h4&gt;
&lt;p&gt;Return the current reward amount. Depending on the algorithm, typically rewards are divided every reward era as tokens are mined to provide scarcity.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getMiningReward&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;example-mining-function&quot;&gt;Example mining function&lt;&#x2F;h3&gt;
&lt;p&gt;A general mining function written in python for finding a valid nonce for keccak256 mined token, is as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; generate_nonce&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  myhex&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;%064x&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span&gt; getrandbits&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;8&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  return&lt;&#x2F;span&gt;&lt;span&gt; codecs&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;decode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;myhex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;hex_codec&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mine&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;challenge&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; public_address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; difficulty&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  while&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; True&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; generate_nonce&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    hash1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sha3&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;keccak_256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;challenge&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;public_address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;nonce&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;hexdigest&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 16&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; hash1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; difficulty&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      return&lt;&#x2F;span&gt;&lt;span&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; hash1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Once the nonce and hash1 are found, these are used to call the mint() function of the smart contract to receive a reward of tokens.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;merged-mining-extension-optional&quot;&gt;Merged Mining Extension (Optional)&lt;&#x2F;h3&gt;
&lt;p&gt;In order to provide support for merge mining multiple tokens, an optional merged mining extension can be implemented as part of the ERC918 standard. It is important to note that the following function will only properly work if the base contracts use tx.origin instead of msg.sender when applying rewards. If not the rewarded tokens will be sent to the calling contract and not the end user.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-918 Mineable Token Standard, optional merged mining functionality&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;blob&#x2F;master&#x2F;EIPS&#x2F;.&#x2F;00918.md&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC918Merged&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AbstractERC918&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * @notice Externally facing merge function that is called by miners to validate challenge digests, calculate reward,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * populate statistics, mutate state variables and adjust the solution difficulty as required. Additionally, the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * merge function takes an array of target token addresses to be used in merged rewards. Once complete,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * a Mint event is emitted before returning a success indicator.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * @param _nonce the solution nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; merge&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _mineTokens&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; _mineTokens&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; tokenAddress &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _mineTokens&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        ERC918Interface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tokenAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_nonce&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * @notice Externally facing merge function kept for backwards compatibility with previous definition&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * @param _nonce the solution nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * @param _challenge_digest the keccak256 encoded challenge number + message sender + solution nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;     function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; merge&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _challenge_digest&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _mineTokens&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;       &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;the challenge digest must match the expected&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;       bytes32&lt;&#x2F;span&gt;&lt;span&gt; digest &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;challengeNumber&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _nonce&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;       require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;digest &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; _challenge_digest&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Challenge digest does not match expected digest on token contract [ ERC918Merged.mint() ]&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;       return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; merge&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _mineTokens&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;delegated-minting-extension-optional&quot;&gt;Delegated Minting Extension (Optional)&lt;&#x2F;h3&gt;
&lt;p&gt;In order to facilitate a third party minting submission paradigm, such as the case of miners submitting solutions to a pool operator and&#x2F;or system, a delegated minting extension can be used to allow pool accounts submit solutions on the behalf of a user, so the miner can avoid directly paying Ethereum transaction costs. This is performed by an off chain mining account packaging and signing a standardized mint solution packet and sending it to a pool or 3rd party to be submitted.&lt;&#x2F;p&gt;
&lt;p&gt;The ERC918 Mineable Mint Packet Metadata should be prepared using following schema:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;title&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Mineable Mint Packet Metadata&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;type&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;object&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;properties&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        &amp;quot;nonce&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;type&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;string&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;description&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Identifies the target solution nonce&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        &amp;quot;origin&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;type&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;string&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;description&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Identifies the original user that mined the solution nonce&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        &amp;quot;signature&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;type&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;string&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;description&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;The signed hash of tightly packed variables sha3(&amp;#39;delegatedMintHashing(uint256,address)&amp;#39;)+nonce+origin_account&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The preparation of a mineable mint packet on a JavaScript client would appear as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; prepareDelegatedMintTxn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  var functionSig &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; web3&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;utils&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;sha3&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;delegatedMintHashing(uint256,address)&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;substring&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  var data &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; web3&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;utils&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;soliditySha3&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt; functionSig&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt; )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  var sig &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; web3&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;eth&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;accounts&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;sign&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;web3&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;utils&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;toHex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;privateKey &lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; prepare the mint packet&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  var packet &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  packet&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;nonce &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  packet&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;origin &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  packet&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;signature &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; sig&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; deliver resulting JSON packet to pool or third party&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  var mineableMintPacket &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; JSON&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;stringify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;packet&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; null&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; todo&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: send mineableMintPacket to submitter &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  .&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Once the packet is prepared and formatted it can then be routed to a third party that will submit the transaction to the contract&#x27;s delegatedMint() function, thereby paying for the transaction gas and receiving the resulting tokens. The pool&#x2F;third party must then manually payback the minted tokens minus fees to the original minter.&lt;&#x2F;p&gt;
&lt;p&gt;The following code sample exemplifies third party packet relaying:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;received by minter&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;var mineableMintPacket &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; .&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;var packet &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; JSON&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;parse&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;mineableMintPacket&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;erc918MineableToken&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;delegatedMint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;packet&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; packet&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;origin&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; packet&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The Delegated Mint Extension expands upon ERC918 realized as a sub-contract:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;openzeppelin-solidity&#x2F;contracts&#x2F;contracts&#x2F;cryptography&#x2F;ECDSA.sol&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ERC918DelegatedMint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; AbstractERC918&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; ECDSA&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;   &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Hash (keccak256) of the payload used by delegatedMint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the golden nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _origin&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the original minter&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the original minter&amp;#39;s elliptical curve signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; delegatedMint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _origin&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; hashedTx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; delegatedMintHashing&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _origin&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; minter&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; recover&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;hashedTx&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;minter&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _origin&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Origin minter address does not match recovered signature address [ AbstractERC918.delegatedMint() ]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;minter&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Invalid minter address recovered from signature [ ERC918DelegatedMint.delegatedMint() ]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        success&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mintInternal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; minter&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Hash (keccak256) of the payload used by delegatedMint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the golden nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _origin&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the original minter&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; delegatedMintHashing&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _origin&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &amp;quot;0x7b36737a&amp;quot;: delegatedMintHashing(uint256,address) &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; toEthSignedMessageHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; bytes4&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x7b36737a&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _origin&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;mineable-token-metadata-optional&quot;&gt;Mineable Token Metadata (Optional)&lt;&#x2F;h3&gt;
&lt;p&gt;In order to provide for richer and potentially mutable metadata for a particular Mineable Token, it is more viable to offer an off-chain reference to said data. This requires the implementation of a single interface method &#x27;metadataURI()&#x27; that returns a JSON string encoded with the string fields symbol, name, description, website, image, and type.&lt;&#x2F;p&gt;
&lt;p&gt;Solidity interface for Mineable Token Metadata:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-918 Mineable Token Standard, optional metadata extension&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;blob&#x2F;master&#x2F;EIPS&#x2F;.&#x2F;00918.md&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC918Metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AbstractERC918&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A distinct Uniform Resource Identifier (URI) for a mineable asset.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; metadataURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Mineable Token Metadata JSON schema definition:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;title&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Mineable Token Metadata&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;type&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;object&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &amp;quot;properties&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        &amp;quot;symbol&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;type&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;string&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;description&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Identifies the Mineable Token&amp;#39;s symbol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        &amp;quot;name&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;type&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;string&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;description&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Identifies the Mineable Token&amp;#39;s name&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        &amp;quot;description&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;type&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;string&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;description&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Identifies the Mineable Token&amp;#39;s long description&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        &amp;quot;website&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;type&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;string&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;description&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Identifies the Mineable Token&amp;#39;s homepage URI&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        &amp;quot;image&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;type&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;string&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;description&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Identifies the Mineable Token&amp;#39;s image URI&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        &amp;quot;type&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;type&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;string&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            &amp;quot;description&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Identifies the Mineable Token&amp;#39;s hash algorithm ( ie.keccak256 ) used to encode the solution&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h3&gt;
&lt;p&gt;The solidity keccak256 algorithm does not have to be used, but it is recommended since it is a cost effective one-way algorithm to perform in the EVM and simple to perform in solidity. The nonce is the solution that miners try to find and so it is part of the hashing algorithm. A challengeNumber is also part of the hash so that future blocks cannot be mined since it acts like a random piece of data that is not revealed until a mining round starts. The msg.sender address is part of the hash so that a nonce solution is valid only for a particular Ethereum account and so the solution is not susceptible to man-in-the-middle attacks. This also allows pools to operate without being easily cheated by the miners since pools can force miners to mine using the pool&#x27;s address in the hash algorithm.&lt;&#x2F;p&gt;
&lt;p&gt;The economics of transferring electricity and hardware into mined token assets offers a flourishing community of decentralized miners the option to be involved in the Ethereum token economy directly. By voting with hash power, an economically pegged asset to real-world resources, miners are incentivized to participate in early token trade to revamp initial costs, providing a bootstrapped stimulus mechanism between miners and early investors.&lt;&#x2F;p&gt;
&lt;p&gt;One community concern for mined tokens has been around energy use without a function for securing a network.  Although token mining does not secure a network, it serves the function of securing a community from corruption as it offers an alternative to centralized ICOs. Furthermore, an initial mining offering may last as little as a week, a day, or an hour at which point all of the tokens would have been minted.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h3&gt;
&lt;p&gt;Earlier versions of this standard incorporated a redundant &#x27;challenge_digest&#x27; parameter on the mint() function that hash-encoded the packed variables challengeNumber, msg.sender and nonce. It was decided that this could be removed from the standard to help minimize processing and thereby gas usage during mint operations. However, in the name of interoperability with existing mining programs and pool software the following contract can be added to the inheritance tree:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-918 Mineable Token Standard, optional backwards compatibility function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;blob&#x2F;master&#x2F;EIPS&#x2F;.&#x2F;00918.md&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC918BackwardsCompatible&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AbstractERC918&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * @notice Externally facing mint function kept for backwards compatibility with previous mint() definition&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * @param _nonce the solution nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * @param _challenge_digest the keccak256 encoded challenge number + message sender + solution nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _challenge_digest&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;the challenge digest must match the expected&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span&gt; digest &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;challengeNumber&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _nonce&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;digest &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; _challenge_digest&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Challenge digest does not match expected digest on token contract [ AbstractERC918.mint() ]&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        success &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_nonce&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h3&gt;
&lt;p&gt;(Test cases for an implementation are mandatory for EIPs that are affecting consensus changes. Other EIPs can choose to include links to test cases if applicable.)&lt;&#x2F;p&gt;
&lt;h3 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h3&gt;
&lt;p&gt;Simple Example:
https:&#x2F;&#x2F;github.com&#x2F;0xbitcoin&#x2F;EIP918-Mineable-Token&#x2F;blob&#x2F;master&#x2F;contracts&#x2F;SimpleERC918.sol&lt;&#x2F;p&gt;
&lt;p&gt;Complex Examples:&lt;&#x2F;p&gt;
&lt;p&gt;https:&#x2F;&#x2F;github.com&#x2F;0xbitcoin&#x2F;EIP918-Mineable-Token&#x2F;blob&#x2F;master&#x2F;contracts&#x2F;0xdogeExample.sol
https:&#x2F;&#x2F;github.com&#x2F;0xbitcoin&#x2F;EIP918-Mineable-Token&#x2F;blob&#x2F;master&#x2F;contracts&#x2F;0xdogeExample2.sol
https:&#x2F;&#x2F;github.com&#x2F;0xbitcoin&#x2F;EIP918-Mineable-Token&#x2F;blob&#x2F;master&#x2F;contracts&#x2F;0xBitcoinBase.sol&lt;&#x2F;p&gt;
&lt;p&gt;0xBitcoin Token Contract:
https:&#x2F;&#x2F;etherscan.io&#x2F;address&#x2F;0xb6ed7644c69416d67b522e20bc294a9a9b405b31&lt;&#x2F;p&gt;
&lt;p&gt;MVI OpenCL Token Miner
https:&#x2F;&#x2F;github.com&#x2F;mining-visualizer&#x2F;MVis-tokenminer&#x2F;releases&lt;&#x2F;p&gt;
&lt;p&gt;PoWAdv Token Contract:
https:&#x2F;&#x2F;etherscan.io&#x2F;address&#x2F;0x1a136ae98b49b92841562b6574d1f3f5b0044e4c&lt;&#x2F;p&gt;
&lt;h3 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h3&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Reward clients for a sustainable network</title>
        <published>2018-03-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>James Ray</name><uri>https://github.com/jamesray1</uri>
	</author>
	
	<author>
		<name>Micah Zoltu</name><uri>https://github.com/MicahZoltu</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/908/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-908-reward-full-nodes-and-clients/241" />
        

        <id>https://wg-eips.ritovision.com/908/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:908"
            label="EIP-908" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/908/">&lt;h2 id=&quot;a-reward-for-running-a-full-node-is-deprecated-but-the-proposal-for-a-reward-for-clients-remains&quot;&gt;A reward for running a full node is deprecated, but the proposal for a reward for clients remains&lt;&#x2F;h2&gt;
&lt;p&gt;While Casper validators are incentivized to validate transactions, there are still no incentives for relaying blocks and storing data (which includes state). This paper is more a high-level analysis and discussion rather than attempting to provide a concrete solution. &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.pokt.network&#x2F;&quot;&gt;Pocket Network&lt;&#x2F;a&gt; is a separate blockchain being designed as of Sept 2018 that incentivises relaying transactions, that is intended to be compatible with other blockchains. Note also that &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;rocket-pool&#x2F;rocketpool&quot;&gt;Rocket Pool&lt;&#x2F;a&gt; is under development and is planned to be a pool for Casper, which will help to incentivise running a full node. Another alternative is &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;vipnode&#x2F;vipnode.org&quot;&gt;VIPnode&lt;&#x2F;a&gt; which charges fees to light clients for full nodes that serve them. In light of these solutions being developed, perhaps a more appropriate approach to generally rewarding clients would be to incentivize bandwidth (relaying and downloading), storage and I&#x2F;O (while computation is already incentivized with gas for miners and will be for proposers under sharding and Casper). Note also that notaries will be incentivized to download collations under sharding. Outdated (Casper FFG will be implemented with Ethereum 2.0 with sharding: &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;notes.ethereum.org&#x2F;SCIg8AH5SA-O4C1G1LYZHQ#&quot;&gt;shasper&lt;&#x2F;a&gt;): given that it looks like Casper FFG will be implemented soon, to minimize undue complexity to the protocol, incentivizing validation in the mean time may be considered not worthwhile. For a previous version of the proposal containing a proposal for rewarding a full node, refer to &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;commit&#x2F;97e235d0ba4a88b4ce29834aa2b94107b8d91e12#diff-9a43a8739b5a9e1dec427324cb264921&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;When each transaction is validated, give a reward to clients for developing the client.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The tragedy of the commons is a phenomenon that is well known in many sectors, most notably in regard to sustainability. It involves the over-utilization of shared finite resources, which detriments all participants and stakeholders involved (which in the case of a global public good can be everyone, including future generations). Without proper management of public resources, a tragedy of the commons can occur. Internalizing externalities (where externalities can be broadly defined as effects that are not accounted for in the intrinsic price of a good, service or resource) is one way of incentivizing the proper management of resources, although other methods that actually properly manage them are necessary. This EIP proposes to make a change to the protocol to provide a reward to clients for providing the software that enables Ethereum to function, where the reward can include a proportion of transaction fees (reducing the full proportion that the miner currently receives), and some newly minted ETH. Thus, clients are incentivized to maintain and improve the security and health of the Ethereum protocol and ecosystem. To summarize the mechanism in the proposal, a user agent is attached to a transaction, where this user agent contains a vector with the index of a client address in an access list. The client address could be inserted by the client and verified that it is the same as a read-only constant in the client&#x27;s storage.&lt;&#x2F;p&gt;
&lt;p&gt;Reward mechanisms that are external to being built in to the protocol are beyond the scope of this EIP. Such extra-protocol reward methods include state channel payments for extra services such as light client servers providing faster information such as receipts; state channel payments for buying state reads from full nodes; archival services (which is only applicable to future proposed versions of Ethereum with stateless clients); and tokens for the client and running full nodes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently there is a lack of incentives for anyone to run a full node, while joining a mining pool is not really economical if one has to purchase a mining rig (several GPUs) now, since there is unlikely to be a return on investment by the time that Ethereum transitions to hybrid Proof-of-Work&#x2F;Proof-of-Stake with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1011&#x2F;&quot;&gt;Casper FFG&lt;&#x2F;a&gt;, then full PoS with &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;research&#x2F;blob&#x2F;master&#x2F;papers&#x2F;CasperTFG&#x2F;CasperTFG.pdf&quot;&gt;CBC Casper&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, providing a reward for clients gives a revenue stream that is independent of state channels or other layer 2 mechanisms, which are less secure, although this insecurity can be offset by mechanisms such as insurance, bonded payments and time locks. Rationalising that investors may invest in a client because it is an enabler for the Ethereum ecosystem (and thus opening up investment opportunities) may not scale very well, and it seems that it is more sustainable to monetize the client as part of the service(s) that it provides.&lt;&#x2F;p&gt;
&lt;p&gt;While it may be argued that the funds raised by the Ethereum pre-mine (the pre-ICO and the ICO) can be used to fund client development, that argument is questionable, since Parity is VC-funded, and other clients such as Prysmatic Labs &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;medium.com&#x2F;@XYOracleNetwork?source=search_post&quot;&gt;1&lt;&#x2F;a&gt;, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;twitter.com&#x2F;prylabs&#x2F;status&#x2F;996391036753666050&quot;&gt;2&lt;&#x2F;a&gt;, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;medium.com&#x2F;prysmatic-labs&#x2F;biweekly-development-update-2-d29d0c91e7d0&quot;&gt;3&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;medium.com&#x2F;compound-finance&#x2F;introducing-exthereum-the-newest-ethereum-client-7a5e30d4d6aa&quot;&gt;exthereum&lt;&#x2F;a&gt; have received funding from other parties, whereas perhaps they would not have needed to do so if there was sufficient funding from the Ethereum pre-mine funds. &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;Drops-of-Diamond&#x2F;diamond_drops&quot;&gt;Drops of Diamond&lt;&#x2F;a&gt; is yet to receive any funding.&lt;&#x2F;p&gt;
&lt;p&gt;Incentivizing client development would more directly incentivize resource provision in the protocol, preventing a tragedy of the commons, where there is an extreme lack of supply and excess demand, leading to the protocol being unusable.&lt;&#x2F;p&gt;
&lt;p&gt;See &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;eprint.iacr.org&#x2F;2014&#x2F;452.pdf#subsection.2.1&quot;&gt;here&lt;&#x2F;a&gt; for an analysis in the context of Bitcoin, PoW, and a hybrid PoW&#x2F;PoS protocol. While Ethereum has a gas limit, the section points out that this is not enough as the market cap increases and the incentive to attack the network increases, while the ratio of security costs to transaction fees does not, while PoS will further alleviate the problem. However, the section points out that PoS is not enough, since the costs of propagating, verifying and storing transactions are not incentivised. Note that the &quot;Proof of Activity: Extending Bitcoin’s Proof of Work via Proof of Stake&quot; paper also contains a scheme for incentivizing a target participation level.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;The word “activity” in the phrase Proof of  Activity emphasizes the point that only active stakeholders who maintain a full online node get rewarded, in exchange for the vital services that they provide for the network.  This stands in contrast to earlier Proof  of  Stake schemes in which offline stake can accumulate weight over time, and may ultimately be utilized in double-spending attacks.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;We can also incentivize full nodes to propagate transactions and to store transactions or state, in addition to verifying them. While these first two incentivizations are outside the scope of this EIP, there are proposals &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethresear.ch&#x2F;t&#x2F;incentivizing-a-robust-p2p-network-relay-layer&#x2F;1438&quot;&gt;here&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethresear.ch&#x2F;t&#x2F;incentivizing-full-state-nodes&#x2F;1640&quot;&gt;here&lt;&#x2F;a&gt;, respectively.&lt;&#x2F;p&gt;
&lt;p&gt;Implementing this as a layer 2 solution may not ensure the sustainability of the protocol, since not everyone would use it; if the protocol doesn&#x27;t have any cost for full nodes to validate transactions, then people will take advantage of that and not use the layer 2 solution. It seems that you should at least have the part where the reward is provided in protocol, but then that and the user agent signature doesn&#x27;t really add anything else to the protocol, so doing some part in-protocol and some part e.g. the verification or a verification-game off-protocol could be done, but it&#x27;s already done in protocol. Note also that some computationally expensive tasks are too challenging to feasibly do in protocol, e.g. due to not fitting in the gas limit, could be done with Truebit, where verifiers have an incentive.&lt;&#x2F;p&gt;
&lt;p&gt;Not providing incentives for clients is an issue now as there is less incentive to build a client that aligns with the needs of users, funds need to be raised externally to the protocol to fund client development, which is not as decentralized. If only a smaller subset is able to fund client development, such as VCs, angel investors and institutional investors, that may not align well with the interests of all current and potential stakeholders of Ethereum (which includes future stakeholders). Ostensibly, one of the goals of Ethereum is to decentralize everything, including wealth, or in other words, to improve wealth equality. Not providing incentives for full nodes validating transactions may not seem like as much of an issue now, but not doing so could hinder the growth of the protocol. Of course, incentives aren&#x27;t enough, it also needs to be technically decentralized so that it is ideally possible for a low-end mainstream computer or perhaps even a mobile or embedded IoT device to be a verifying full node, or at least to be able to help with securing the network if it is deemed impractical for them to be a full node.&lt;&#x2F;p&gt;
&lt;p&gt;Note that with a supply cap (as in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;960&quot;&gt;EIP-960&lt;&#x2F;a&gt;, the issuance can be prevented from increasing indefinitely. Alternatively, it could at least be reduced (still potentially but not necessarily to zero, or to the same rate at which Ether is burnt when slashing participants, such as validators under a Casper PoS scheme or notaries under a sharding scheme), e.g. by hard forks, or as per &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1015&#x2F;&quot;&gt;EIP-1015&lt;&#x2F;a&gt;, an on-chain contract governed by a decision assembly that gets signalling from other contracts that represent some set of stakeholders.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Add a new field to each block called &lt;code&gt;PrevBlockVerifications&lt;&#x2F;code&gt;, which is an arbitrary, unlimited size byte array. When a client verifies that a previous block is &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum.github.io&#x2F;yellowpaper&#x2F;paper.pdf#subsubsection.4.3.2&quot;&gt;valid&lt;&#x2F;a&gt;, the client appends a user agent to PrevBlockVerifications via an opcode in a transaction, PREV_BLOCK_VERIF. The user agent is a vector with the  immutable fields: the blockhash of the block that is validated, and the index of a client address in an access list (details are below). A miner validates a transaction before including it in a block, however they are not able to change these fields of the vector because they&#x27;re immutable.&lt;&#x2F;p&gt;
&lt;p&gt;Send 0.15 ETH to the client (see the rationale below), when the block is processed. The amounts could include a proportion of transaction fees (while the miner would then receive less), which would reduce newly issued ETH. These amounts are specified in new &lt;code&gt;ClientReward&lt;&#x2F;code&gt; fields in the block.&lt;&#x2F;p&gt;
&lt;p&gt;In order to only incentivize verifying recent blocks, assert that the block number corresponding to a blockhash is less than 400 blocks ago.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;attacks-and-added-specifications-to-prevent-them&quot;&gt;Attacks and added specifications to prevent them&lt;&#x2F;h3&gt;
&lt;p&gt;A miner could create a client and fill their block with transactions that only contain the PREV_BLOCK_VERIF opcode (or alternatively, arbitrarily complex transactions, still with the opcode), with previous blockhashes that they have validated and the address of their client. To prevent this, state would have to store a list containing lists, with each sublist listing the blockhashes up to 400 blocks ago that correspond to a miner, then a miner (or a proposer under Casper CBC) could have to put down a deposit, and be slashed if the proposer inserts such a transaction (that contains a blockhash which they have already proposed, not just in a block but at any time previously). Updating the state to remove blockhashes more than 400 blocks ago would add additional overhead, although you could add an extra window for older blocks, say 120,000 blocks (roughly every 3 weeks), still ignore blocks that are older than 400 blocks ago, and remove these older 120,000 blocks every 120,000 blocks. An attacker could bribe a miner&#x2F;proposer to include transactions like above that contain an address of a client in the access list which they own. However, the above slashing condition should disincentivize this.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;more-details-on-the-access-list&quot;&gt;More details on the access list&lt;&#x2F;h3&gt;
&lt;p&gt;The access list prevents anyone inserting any address to the first element of the vector, where there may be a way to prevent censorship and centralization of authority of who decides to register new addresses in the list, e.g. on-chain governance with signalling (possibly similar to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1015&#x2F;&quot;&gt;EIP-1015&lt;&#x2F;a&gt;, which also specifies an alternative way of sending funds) or a layer 2 proof of authority network where new addresses can be added via a smart contract. Note that there may be serious drawbacks to implementing either of these listed examples. There is a refutation of &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;medium.com&#x2F;@Vlad_Zamfir&#x2F;against-on-chain-governance-a4ceacd040ca&quot;&gt;on-chain governance&lt;&#x2F;a&gt; as well as of &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;vitalik.ca&#x2F;general&#x2F;2018&#x2F;03&#x2F;28&#x2F;plutocracy.html&quot;&gt;plutocracy&lt;&#x2F;a&gt;. &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Proof-of-authority&quot;&gt;Proof of Authority&lt;&#x2F;a&gt; isn&#x27;t suitable for a public network since it doesn&#x27;t distribute trust well. However, using signalling in layer 2 contracts is more acceptable, but Vlad Zamfir argues that using that to influence outcomes in the protocol can disenfranchise miners from being necessary participants in the governance process. Thus, in light of these counterpoints, having an access list may not be suitable until a decentralized, trustless way of maintaining it is implemented and ideally accepted by the majority of a random sample that represents the population of Ethereum users.&lt;&#x2F;p&gt;
&lt;p&gt;However, another alternative to managing the access list would be to have decentralized verification that the address produced from querying an index in the access list does correspond to that of a &quot;legitimate&quot; client. Part of this verification would involve checking that there is a client that claims that this address is owned by them, that they are happy to receive funds in this manner and agree or arranged to putting the address in the access list, and that the client passes all tests in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;tests&quot;&gt;Ethereum test suite&lt;&#x2F;a&gt;. However, this last proviso would then preclude new clients being funded from the start of development, although such would-be clients would not be able to receive funds in-protocol until they implement the client anyway (as an aside, they could raise funds in various ways—a DAII, pronounced die-yee, is recommended, while a platform for DAIIs is under development by &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;dogezer.com&#x2F;&quot;&gt;Dogezer&lt;&#x2F;a&gt;). All of this could be done off-chain, and if anyone found that some address in the access list was not legitimate, then they could challenge that address with a proof of illegitimacy, and the participant that submitted the address to the access list could be slashed (while they must hold a deposit in order to register and keep an address in the access list).&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, it should help with being only able to read the client&#x27;s address from the client, and the whole transaction could revert if the address is not in the access list. You could provide the index of the address in the access list, and then you could &lt;code&gt;assert&lt;&#x2F;code&gt; that the address found at that index matches that which can be read by the client (where the latter would be a read-only address).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;a-rough-qualitative-analysis-of-fees&quot;&gt;A rough qualitative analysis of fees&lt;&#x2F;h3&gt;
&lt;p&gt;As of May 4 2018, there are &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;web.archive.org&#x2F;web&#x2F;20180504051128&#x2F;https:&#x2F;&#x2F;ethernodes.org&#x2F;network&#x2F;1&quot;&gt;16428 nodes&lt;&#x2F;a&gt;. Assume that an annual cost for an average client developer organisation is $1 million per annum. Projecting forward (and noting that the number of nodes should increase substantially if this EIP was implemented, thus aiding Ethereum&#x27;s goal of decentralizing everything) assume that there are 10 clients. Thus let us assume that the number of nodes doubles to 30000 nodes within 5 years (this assumption is probably conservative, even if it is forward looking). Assume for simplicity that the costs of a client are entirely covered by this block reward.&lt;&#x2F;p&gt;
&lt;p&gt;Average cost per client = number of nodes * Block reward per client &#x2F; number of clients&lt;&#x2F;p&gt;
&lt;p&gt;Block reward per client (worse case for ETH price) = Average revenue per client * number of clients &#x2F; (ETH exchange rate * number of nodes)&lt;&#x2F;p&gt;
&lt;p&gt;= $2,000,000 * 10 &#x2F; (500 * 30,000)&lt;&#x2F;p&gt;
&lt;p&gt;= 1.333333333 ETH&lt;&#x2F;p&gt;
&lt;p&gt;Block reward per client (better case) = $1,000,000 * 10 &#x2F; (2000 * 30,000) = 0.166666667 ETH&lt;&#x2F;p&gt;
&lt;p&gt;Suppose that we use a block reward of 0.15 ETH for clients.&lt;&#x2F;p&gt;
&lt;!--There are more than 5552465 blocks and counting. With a reward of 0.001 ETH for each block, a full state node that verified every block would receive 5552.465 ETH. However, the difficulty of verifying blocks increases over time, so--&gt;
&lt;h3 id=&quot;more-rationale-outdated-by-above&quot;&gt;More rationale (outdated by above)&lt;&#x2F;h3&gt;
&lt;p&gt;The amount of computation to validate a transaction will be the same as a miner, since the transaction will need to be executed. Thus, if there would be transaction fees for validating full nodes and clients, and transactions need to be executed by validators just like miners have to, it makes sense to have them calculated in the same way as gas fees for miners. This would controversially increase the amount of transaction fees a lot, since there can be many validators for a transaction. In other words, it is controversial whether to provide the same amount of transaction fee for a full node validator as for a miner (which in one respect is fair, since the validator has to do the same amount of computation), or prevent transaction fees from rising much higher, and have a transaction fee for a full node as, say, the transaction fee for a miner, divided by the average number of full nodes validating a transaction. The latter option seems even more controversial (but is still better than the status quo), since while there would be more of an incentive to run a full node than there is now with no incentive, validators would be paid less for performing the same amount of computation.&lt;&#x2F;p&gt;
&lt;p&gt;And as for the absolute amounts, this will require data analysis, but clearly a full node should receive much less than a miner for processing a transaction in a block, since there are many transactions in a block, and there are many confirmations of a block. Data analysis could involve calculating the average number of full nodes verifying transactions in a block. Macroeconomic analysis could entail the economic security benefit that full nodes provide to the network.&lt;&#x2F;p&gt;
&lt;p&gt;Now, as to the ratio of rewards to the client vs the full node, as an initial guess I would suggest something like 99:1. Why such a big difference? Well, I would guess that clients spend roughly 99 times more time on developing and maintaining the client than a full node user spends running and maintaining a full node. During a week there might be several full-time people working on the client, but a full node might only spend half an hour (or less) initially setting it up, plus running it, plus electricity and internet costs. Full node operators probably don&#x27;t need to upgrade their computer (and buying a mining rig isn&#x27;t worth it with Casper PoS planning on being implemented soon).&lt;&#x2F;p&gt;
&lt;p&gt;However, on further analysis, clients would also get the benefit of a large volume of rewards from every full node running the client, so to incentivise full node operation further, the ratio could change to say, 4:1, or even 1:1, and of course could be adjusted with even further actual data analysis, rather than speculation.&lt;&#x2F;p&gt;
&lt;p&gt;Providing rewards to full node validators and to clients would increase the issuance. In order to maintain the issuance at current levels, this EIP could also reduce the mining reward (despite being reduced previously with the Byzantium release in October 2017 from 5 ETH to 3 ETH), but that would generate more controversy and discussion.&lt;&#x2F;p&gt;
&lt;p&gt;Another potential point of controversy with rewarding clients and full nodes is that the work previously done by them has not been paid for until now (except of course by the Ethereum Foundation or Parity VCs funding the work), so existing clients may say that this EIP gives an advantage to new entrants. However, this doesn&#x27;t hold up well, because existing clients have the first mover advantage, with much development to create useful and well-used products.&lt;&#x2F;p&gt;
&lt;p&gt;There is a tradeoff. Higher fees means you may cut out poor people and people who just don&#x27;t want to pay fees. But if a laptop can run a full node and get paid for it then that would offset the fees through usage. Full nodes do provide a security benefit, so the total fees given could at least be some fraction of this benefit. Fees that go towards client development incentivise a higher quality client. To me, I think it makes more sense to internalize costs as much as possible: for computation, storage, bandwidth, I&#x2F;O, client development, running full nodes, mining&#x2F;validating, etc. You avoid a tragedy of the commons through externalizing costs. The more you internalize costs, the more sustainable it is, and the less you rely on rich people being generous, etc. (Although, getting philosophical, ultimately you can&#x27;t force rich people to be generous, they have to do so out of the kindness of their hearts.)&lt;&#x2F;p&gt;
&lt;p&gt;Regarding rewards for full nodes, in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethresear.ch&#x2F;t&#x2F;sharding-phase-1-spec&#x2F;1407&quot;&gt;draft phase 1 sharding spec&lt;&#x2F;a&gt; proposers acting as full nodes have rewards for proposing blobs (without execution) or later in phase 3 transactions (with execution) to be included into collations&#x2F;blocks. So that would help. However, full nodes that do not act as proposers and just verify transactions, or &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethresear.ch&#x2F;t&#x2F;incentivizing-full-state-nodes&#x2F;1640&quot;&gt;full state nodes&lt;&#x2F;a&gt;, are still not incentivized.&lt;&#x2F;p&gt;
&lt;p&gt;Note that while further quantitative analysis to specify fees should be done, some level of experimentation after implementing this method on-chain may be necessary.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;security&quot;&gt;Security&lt;&#x2F;h3&gt;
&lt;p&gt;All of the below struck out information should be prevented via using an access list and verifying that the read-only address provided by the client matches with an address in the access list, as well as using a layer 2 solution such as a PoA network for censorship resistance and minimization of centralization in the access list.&lt;&#x2F;p&gt;
&lt;p&gt;Further discussion is at https:&#x2F;&#x2F;ethresear.ch&#x2F;t&#x2F;incentives-for-running-full-ethereum-nodes&#x2F;1239.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Introducing in-protocol fees is a backwards-incompatible change, so would be introduced in a hard-fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TODO&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TODO&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Simple Staking Interface</title>
        <published>2018-02-22T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Dean Eigenmann</name><email>dean@tokenate.io</email>
	</author>
	
	<author>
		<name>Jorge Izquierdo</name><email>jorge@aragon.one</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/900/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/900" />
        

        <id>https://wg-eips.ritovision.com/900/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:900"
            label="ERC-900" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/900/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The following standard describes a common staking interface allowing for easy to use staking systems. The interface is kept simple allowing for various use cases to be implemented. This standard describes the common functionality for staking as well as providing information on stakes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;As we move to more token models, having a common staking interface which is familiar to users can be useful. The common interface can be used by a variety of applications, this common interface could be beneficial especially to things like Token curated registries which have recently gained popularity.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Staking&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Staked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; total&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Unstaked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; total&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; stake&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; stakeFor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; unstake&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalStakedFor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalStaked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; token&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsHistory&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; optional&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; lastStakedFor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalStakedForAt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; blockNumber&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalStakedAt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; blockNumber&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;stake&quot;&gt;stake&lt;&#x2F;h3&gt;
&lt;p&gt;Stakes a certain amount of tokens, this MUST transfer the given amount from the user.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;The data field can be used to add signalling information in more complex staking applications&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;MUST trigger &lt;code&gt;Staked&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;stakefor&quot;&gt;stakeFor&lt;&#x2F;h3&gt;
&lt;p&gt;Stakes a certain amount of tokens, this MUST transfer the given amount from the caller.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;The data field can be used to add signalling information in more complex staking applications&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;MUST trigger &lt;code&gt;Staked&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;unstake&quot;&gt;unstake&lt;&#x2F;h3&gt;
&lt;p&gt;Unstakes a certain amount of tokens, this SHOULD return the given amount of tokens to the user, if unstaking is currently not possible the function MUST revert.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;The data field can be used to remove signalling information in more complex staking applications&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;MUST trigger &lt;code&gt;Unstaked&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;totalstakedfor&quot;&gt;totalStakedFor&lt;&#x2F;h3&gt;
&lt;p&gt;Returns the current total of tokens staked for an address.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;totalstaked&quot;&gt;totalStaked&lt;&#x2F;h3&gt;
&lt;p&gt;Returns the current total of tokens staked.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;token&quot;&gt;token&lt;&#x2F;h3&gt;
&lt;p&gt;Address of the token being used by the staking interface.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;supportshistory&quot;&gt;supportsHistory&lt;&#x2F;h3&gt;
&lt;p&gt;MUST return true if the optional history functions are implemented, otherwise false.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;laststakedfor&quot;&gt;lastStakedFor&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;OPTIONAL:&lt;&#x2F;strong&gt; As not all staking systems require a complete history, this function is optional.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Returns last block address staked at.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;totalstakedforat&quot;&gt;totalStakedForAt&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;OPTIONAL:&lt;&#x2F;strong&gt; As not all staking systems require a complete history, this function is optional.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Returns total amount of tokens staked at block for address.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;totalstakedat&quot;&gt;totalStakedAt&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;OPTIONAL:&lt;&#x2F;strong&gt; As not all staking systems require a complete history, this function is optional.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Returns the total tokens staked at block.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;HarbourProject&#x2F;stakebank&quot;&gt;Stakebank&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;aragon&#x2F;aragon-apps&#x2F;pull&#x2F;101&quot;&gt;Aragon&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;maticnetwork&#x2F;contracts&#x2F;blob&#x2F;master&#x2F;contracts&#x2F;StakeManager.sol&quot;&gt;PoS Staking&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;codex-protocol&#x2F;contract.erc-900&quot;&gt;BasicStakeContract&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>DelegateProxy</title>
        <published>2018-02-21T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Jorge Izquierdo</name><email>jorge@aragon.one</email>
	</author>
	
	<author>
		<name>Manuel Araoz</name><email>manuel@zeppelin.solutions</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/897/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/pull/897" />
        

        <id>https://wg-eips.ritovision.com/897/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:897"
            label="ERC-897" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/897/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Proxy contracts are being increasingly used as both as an upgradeability mechanism
and a way to save gas when deploying many instances of a particular contract. This
standard proposes a set of interfaces for proxies to signal how they work and what
their main implementation is.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Using proxies that delegate their own logic to another contract is becoming an
increasingly popular technique for both smart contract upgradeability and creating
cheap clone contracts.&lt;&#x2F;p&gt;
&lt;p&gt;We don&#x27;t believe there is value in standardizing any particular implementation
of a DelegateProxy, given its simplicity, but we believe there is a lot of value
in agreeing on an interface all proxies use that allows for a standard way to
operate with proxies.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementations&quot;&gt;Implementations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;aragonOS&lt;&#x2F;strong&gt;: &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;aragon&#x2F;aragonOS&#x2F;blob&#x2F;master&#x2F;contracts&#x2F;apps&#x2F;AppProxyUpgradeable.sol&quot;&gt;AppProxyUpgradeable&lt;&#x2F;a&gt;, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;aragon&#x2F;aragonOS&#x2F;blob&#x2F;master&#x2F;contracts&#x2F;apps&#x2F;AppProxyPinned.sol&quot;&gt;AppProxyPinned&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;aragon&#x2F;aragonOS&#x2F;blob&#x2F;master&#x2F;contracts&#x2F;kernel&#x2F;KernelProxy.sol&quot;&gt;KernelProxy&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;zeppelinOS&lt;&#x2F;strong&gt;: &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;zeppelinos&#x2F;labs&#x2F;blob&#x2F;2da9e859db81a61f2449d188e7193788ca721c65&#x2F;upgradeability_ownership&#x2F;contracts&#x2F;Proxy.sol&quot;&gt;Proxy&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;standardized-interface&quot;&gt;Standardized interface&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERCProxy&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; proxyType&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; proxyTypeId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; implementation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; codeAddr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;code-address-implementation&quot;&gt;Code address (&lt;code&gt;implementation()&lt;&#x2F;code&gt;)&lt;&#x2F;h3&gt;
&lt;p&gt;The returned code address is the address the proxy would delegate calls to at that
moment in time, for that message.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;proxy-type-proxytype&quot;&gt;Proxy Type (&lt;code&gt;proxyType()&lt;&#x2F;code&gt;)&lt;&#x2F;h3&gt;
&lt;p&gt;Checking the proxy type is the way to check whether a contract is a proxy at all.
When a contract fails to return to this method or it returns 0, it can be assumed
that the contract is not a proxy.&lt;&#x2F;p&gt;
&lt;p&gt;It also allows for communicating a bit more of information about how the proxy
operates. It is a pure function, therefore making it effectively constant as
it cannot return a different value depending on state changes.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Forwarding proxy&lt;&#x2F;strong&gt; (&lt;code&gt;id = 1&lt;&#x2F;code&gt;): The proxy will always forward to the same code
address. The following invariant should always be true: once the proxy returns
a non-zero code address, that code address should never change.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Upgradeable proxy&lt;&#x2F;strong&gt; (&lt;code&gt;id = 2&lt;&#x2F;code&gt;): The proxy code address can be changed depending
on some arbitrary logic implemented either at the proxy level or in its forwarded
logic.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;benefits&quot;&gt;Benefits&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Source code verification&lt;&#x2F;strong&gt;: right now when checking the code of a proxy in explorers
like Etherscan, it just shows the code in the proxy itself but not the actual
code of the contract. By standardizing this construct, they will be able to show
both the actual ABI and code for the contract.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>DGCL Token</title>
        <published>2018-02-14T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Dave Sag</name><email>davesag@gmail.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/884/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/884/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:884"
            label="ERC-884" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/884/">&lt;h1 id=&quot;delaware-general-corporations-law-dgcl-compatible-share-token&quot;&gt;Delaware General Corporations Law (DGCL) compatible share token&lt;&#x2F;h1&gt;
&lt;p&gt;Ref: &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;forum.ethereum.org&#x2F;discussion&#x2F;17200&#x2F;proposing-an-eip-for-regulation-a-Tokens&quot;&gt;proposing-an-eip-for-DGCL-tokens&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;An &lt;code&gt;ERC-20&lt;&#x2F;code&gt; compatible token that conforms to &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;legis.delaware.gov&#x2F;json&#x2F;BillDetail&#x2F;GenerateHtmlDocument?legislationId=25730&amp;amp;legislationTypeId=1&amp;amp;docTypeId=2&amp;amp;legislationName=SB69&quot;&gt;Delaware State Senate, 149th General Assembly, Senate Bill No. 69: An act to Amend Title 8 of the Delaware Code Relating to the General Corporation Law&lt;&#x2F;a&gt;, henceforth referred to as &#x27;The Act&#x27;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The recently amended &#x27;Title 8 of the Delaware Code Relating to the General Corporation Law&#x27; now explicitly allows for the use of blockchains to maintain corporate share registries. This means it is now possible to create a tradable &lt;code&gt;ERC-20&lt;&#x2F;code&gt; token where each token represents a share issued by a Delaware corporation. Such a token must conform to the following principles over and above the &lt;code&gt;ERC-20&lt;&#x2F;code&gt; standard.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Token owners must have their identity verified.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The token contract must provide the following three functions of a &lt;code&gt;Corporations Stock ledger&lt;&#x2F;code&gt; (Ref: Section 224 of The Act):&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Reporting:&lt;&#x2F;p&gt;
&lt;p&gt;It must enable the corporation to prepare the list of shareholders specified in Sections 219 and 220 of The Act.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;It must record the information specified in Sections 156, 159, 217(a) and 218 of The Act:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Partly paid shares&lt;&#x2F;li&gt;
&lt;li&gt;Total amount paid&lt;&#x2F;li&gt;
&lt;li&gt;Total amount to be paid&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Transfers of shares as per section 159 of The Act:&lt;&#x2F;p&gt;
&lt;p&gt;It must record transfers of shares as governed by Article 8 of subtitle I of Title 6.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Each token MUST correspond to a single share, each of which would be paid for in full, so there is no need to record information concerning partly paid shares, and there are no partial tokens.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;There must be a mechanism to allow a shareholder who has lost their private key, or otherwise lost access to their tokens to have their address &lt;code&gt;cancelled&lt;&#x2F;code&gt; and the tokens re-issued to a new address.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;Delaware General Corporation Law requires that shares issued by a Delaware corporation be recorded in a share registry.&lt;&#x2F;li&gt;
&lt;li&gt;The share registry can be represented by an &lt;code&gt;ERC-20&lt;&#x2F;code&gt; token contract that is compliant with Delaware General Corporation Law.&lt;&#x2F;li&gt;
&lt;li&gt;This standard can cover equity issued by any Delaware corporation, whether private or public.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;By using a &lt;code&gt;DGCL&lt;&#x2F;code&gt; compatible token, a firm may be able to raise funds via IPO, conforming to Delaware Corporations Law, but bypassing the need for involvement of a traditional Stock Exchange.&lt;&#x2F;p&gt;
&lt;p&gt;There are currently no token standards that conform to the &lt;code&gt;DGCL&lt;&#x2F;code&gt; rules. &lt;code&gt;ERC-20&lt;&#x2F;code&gt; tokens do not support KYC&#x2F;AML rules required by the General Corporation Law, and do not provide facilities for the exporting of lists of shareholders.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;what-about-erc-721&quot;&gt;What about ERC-721?&lt;&#x2F;h3&gt;
&lt;p&gt;The proposed standard could easily be used to enhance &lt;code&gt;ERC-721&lt;&#x2F;code&gt;, adding features for associating tokens with assets such as share certificates.&lt;&#x2F;p&gt;
&lt;p&gt;While the &lt;code&gt;ERC-721&lt;&#x2F;code&gt; token proposal allows for some association of metadata with an Ethereum address, its uses are &lt;em&gt;not completely aligned&lt;&#x2F;em&gt; with The Act, and it is not, in its current form, fully &lt;code&gt;ERC-20&lt;&#x2F;code&gt; compatible.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;ERC-20&lt;&#x2F;code&gt; token provides the following basic features:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;contract ERC20 {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  function totalSupply() public view returns (uint256);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  function balanceOf(address who) public view returns (uint256);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  function transfer(address to, uint256 value) public returns (bool);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  function allowance(address owner, address spender) public view returns (uint256);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  function transferFrom(address from, address to, uint256 value) public returns (bool);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  function approve(address spender, uint256 value) public returns (bool);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  event Approval(address indexed owner, address indexed spender, uint256 value);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  event Transfer(address indexed from, address indexed to, uint256 value);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This will be extended as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; *  An `ERC20` compatible token that conforms to Delaware State Senate,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; *  149th General Assembly, Senate Bill No. 69: An act to Amend Title 8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; *  of the Delaware Code Relating to the General Corporation Law.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; *  Implementation Details.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; *  An implementation of this token standard SHOULD provide the following:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; *  `name` - for use by wallets and exchanges.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; *  `symbol` - for use by wallets and exchanges.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; *  The implementation MUST take care not to allow unauthorised access to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; *  share-transfer functions.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; *  In addition to the above the following optional `ERC20` function MUST be defined.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; *  `decimals` — MUST return `0` as each token represents a single share and shares are non-divisible.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; *  @dev Ref https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;pull&#x2F;884&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;contract ERC884 is ERC20 {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  This event is emitted when a verified address and associated identity hash are&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  added to the contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  @param addr The address that was added.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  @param hash The identity hash associated with the address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  @param sender The address that caused the address to be added.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    event VerifiedAddressAdded(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address indexed addr,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bytes32 hash,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address indexed sender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    );&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  This event is emitted when a verified address and associated identity hash are&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  removed from the contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  @param addr The address that was removed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  @param sender The address that caused the address to be removed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    event VerifiedAddressRemoved(address indexed addr, address indexed sender);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  This event is emitted when the identity hash associated with a verified address is updated.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  @param addr The address whose hash was updated.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  @param oldHash The identity hash that was associated with the address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  @param hash The hash now associated with the address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  @param sender The address that caused the hash to be updated.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    event VerifiedAddressUpdated(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address indexed addr,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bytes32 oldHash,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bytes32 hash,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address indexed sender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    );&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  This event is emitted when an address is cancelled and replaced with&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  a new address.  This happens in the case where a shareholder has&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  lost access to their original address and needs to have their share&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  reissued to a new address.  This is the equivalent of issuing replacement&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  share certificates.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  @param original The address being superseded.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  @param replacement The new address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  @param sender The address that caused the address to be superseded.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    event VerifiedAddressSuperseded(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address indexed original,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address indexed replacement,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address indexed sender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    );&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  Add a verified address, along with an associated verification hash to the contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  Upon successful addition of a verified address, the contract must emit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  `VerifiedAddressAdded(addr, hash, msg.sender)`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  It MUST throw if the supplied address or hash are zero, or if the address has already been supplied.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  @param addr The address of the person represented by the supplied hash.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  @param hash A cryptographic hash of the address holder&amp;#39;s verified information.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function addVerified(address addr, bytes32 hash) public;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  Remove a verified address, and the associated verification hash. If the address is&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  unknown to the contract then this does nothing. If the address is successfully removed, this&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  function must emit `VerifiedAddressRemoved(addr, msg.sender)`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  It MUST throw if an attempt is made to remove a verifiedAddress that owns tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  @param addr The verified address to be removed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function removeVerified(address addr) public;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  Update the hash for a verified address known to the contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  Upon successful update of a verified address the contract must emit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  `VerifiedAddressUpdated(addr, oldHash, hash, msg.sender)`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  If the hash is the same as the value already stored then&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  no `VerifiedAddressUpdated` event is to be emitted.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  It MUST throw if the hash is zero, or if the address is unverified.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  @param addr The verified address of the person represented by the supplied hash.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  @param hash A new cryptographic hash of the address holder&amp;#39;s updated verified information.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function updateVerified(address addr, bytes32 hash) public;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  Cancel the original address and reissue the tokens to the replacement address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  Access to this function MUST be strictly controlled.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  The `original` address MUST be removed from the set of verified addresses.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  Throw if the `original` address supplied is not a shareholder.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  Throw if the `replacement` address is not a verified address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  Throw if the `replacement` address already holds tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  This function MUST emit the `VerifiedAddressSuperseded` event.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  @param original The address to be superseded. This address MUST NOT be reused.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function cancelAndReissue(address original, address replacement) public;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  The `transfer` function MUST NOT allow transfers to addresses that&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  have not been verified and added to the contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  If the `to` address is not currently a shareholder then it MUST become one.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  If the transfer will reduce `msg.sender`&amp;#39;s balance to 0 then that address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  MUST be removed from the list of shareholders.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function transfer(address to, uint256 value) public returns (bool);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  The `transferFrom` function MUST NOT allow transfers to addresses that&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  have not been verified and added to the contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  If the `to` address is not currently a shareholder then it MUST become one.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  If the transfer will reduce `from`&amp;#39;s balance to 0 then that address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  MUST be removed from the list of shareholders.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function transferFrom(address from, address to, uint256 value) public returns (bool);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  Tests that the supplied address is known to the contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  @param addr The address to test.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  @return true if the address is known to the contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function isVerified(address addr) public view returns (bool);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  Checks to see if the supplied address is a shareholder.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  @param addr The address to check.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  @return true if the supplied address owns a token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function isHolder(address addr) public view returns (bool);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  Checks that the supplied hash is associated with the given address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  @param addr The address to test.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  @param hash The hash to test.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  @return true if the hash matches the one supplied with the address in `addVerified`, or `updateVerified`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function hasHash(address addr, bytes32 hash) public view returns (bool);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  The number of addresses that hold tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  @return the number of unique addresses that hold tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function holderCount() public view returns (uint);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  By counting the number of token holders using `holderCount`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  you can retrieve the complete list of token holders, one at a time.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  It MUST throw if `index &amp;gt;= holderCount()`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  @param index The zero-based index of the holder.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  @return the address of the token holder with the given index.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function holderAt(uint256 index) public view returns (address);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  Checks to see if the supplied address was superseded.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  @param addr The address to check.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  @return true if the supplied address was superseded by another address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function isSuperseded(address addr) public view returns (bool);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  Gets the most recent address, given a superseded one.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  Addresses may be superseded multiple times, so this function needs to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  follow the chain of addresses until it reaches the final, verified address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  @param addr The superseded address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *  @return the verified address that ultimately holds the share.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function getCurrentFor(address addr) public view returns (address);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;securities-exchange-commission-requirements&quot;&gt;Securities Exchange Commission Requirements&lt;&#x2F;h3&gt;
&lt;p&gt;The Securities Exchange Commission (SEC) has additional requirements as to how a crowdsale ought to be run and what information must be made available to the general public. This information is however out of scope from this standard, though the standard does support the requirements.&lt;&#x2F;p&gt;
&lt;p&gt;For example: The SEC requires a crowdsale&#x27;s website display the amount of money raised in US Dollars. To support this a crowdsale contract minting these tokens must maintain a USD to ETH conversion rate (via Oracle or some other mechanism) and must record the conversion rate used at time of minting.&lt;&#x2F;p&gt;
&lt;p&gt;Also, depending on the type of raise, the SEC (or other statutory body) can apply limits to the number of shareholders allowed. To support this the standard provides the &lt;code&gt;holderCount&lt;&#x2F;code&gt; and &lt;code&gt;isHolder&lt;&#x2F;code&gt; functions which a crowdsale can invoke to check that limits have not been exceeded.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;use-of-the-identity-hash-value&quot;&gt;Use of the Identity &lt;code&gt;hash&lt;&#x2F;code&gt; value&lt;&#x2F;h3&gt;
&lt;p&gt;Implementers of a crowdsale, in order to comply with The Act, must be able to produce an up-to-date list of the names and addresses of all shareholders. It is not desirable to include those details in a public blockchain, both for reasons of privacy, and also for reasons of economy. Storing arbitrary string data on the blockchain is strongly discouraged.&lt;&#x2F;p&gt;
&lt;p&gt;Implementers should maintain an off-chain private database that records the owner&#x27;s name, residential address, and Ethereum address. The implementer must then be able to extract the name and address for any address, and hash the name + address data and compare that hash to the hash recorded in the contract using the &lt;code&gt;hasHash&lt;&#x2F;code&gt; function. The specific details of this system are left to the implementer.&lt;&#x2F;p&gt;
&lt;p&gt;It is also desirable that the implementers offer a REST API endpoint along the lines of&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;GET https:&#x2F;&#x2F;&amp;lt;host&amp;gt;&#x2F;&amp;lt;pathPrefix&amp;gt;&#x2F;:ethereumAddress -&amp;gt; [true|false]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;to enable third party auditors to verify that a given Ethereum address is known to the implementers as a verified address.&lt;&#x2F;p&gt;
&lt;p&gt;How the implementers verify a person&#x27;s identity is up to them and beyond the scope of this standard.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;handling-users-who-have-lost-access-to-their-addresses&quot;&gt;Handling users who have lost access to their addresses&lt;&#x2F;h3&gt;
&lt;p&gt;A traditional share register is typically managed by a Transfer Agent who is authorised to maintain the register accurately, and to handle shareholder enquiries. A common request is for share certificates to be reissued in the case where the shareholder has lost or destroyed their original.&lt;&#x2F;p&gt;
&lt;p&gt;Token implementers can handle that via the &lt;code&gt;cancelAndReissue&lt;&#x2F;code&gt; function, which must perform the various changes to ensure that the old address now points to the new one, and that cancelled addresses are not then reused.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;permissions-management&quot;&gt;Permissions management&lt;&#x2F;h3&gt;
&lt;p&gt;It is not desirable that anyone can add, remove, update, or supersede verified addresses. How access to these functions is controlled is outside of the scope of this standard.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The proposed standard offers as minimal an extension as possible over the existing &lt;code&gt;ERC-20&lt;&#x2F;code&gt; standard in order to conform to the requirements of The Act. Rather than return a &lt;code&gt;bool&lt;&#x2F;code&gt; for successful or unsuccessful completion of state-changing functions such as &lt;code&gt;addVerified&lt;&#x2F;code&gt;, &lt;code&gt;removeVerified&lt;&#x2F;code&gt;, and &lt;code&gt;updateVerified&lt;&#x2F;code&gt;, we have opted to require that implementations &lt;code&gt;throw&lt;&#x2F;code&gt; (preferably by using the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;solidity&#x2F;issues&#x2F;1686#issuecomment-328181514&quot;&gt;forthcoming &lt;code&gt;require(condition, &#x27;fail message&#x27;)&lt;&#x2F;code&gt; syntax&lt;&#x2F;a&gt;).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The proposed standard is designed to maintain compatibility with &lt;code&gt;ERC-20&lt;&#x2F;code&gt; tokens with the following provisos:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The &lt;code&gt;decimals&lt;&#x2F;code&gt; function MUST return &lt;code&gt;0&lt;&#x2F;code&gt; as the tokens MUST NOT be divisible,&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;transfer&lt;&#x2F;code&gt; and &lt;code&gt;transferFrom&lt;&#x2F;code&gt; functions MUST NOT allow transfers to non-verified addresses, and MUST maintain a list of shareholders.&lt;&#x2F;li&gt;
&lt;li&gt;Shareholders who transfer away their remaining tokens must be pruned from the list of shareholders.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Proviso 1 will not break compatibility with modern wallets or exchanges as they all appear to use that information if available.&lt;&#x2F;p&gt;
&lt;p&gt;Proviso 2 will cause transfers to fail if an attempt is made to transfer tokens to a non-verified address. This is implicit in the design and implementers are encouraged to make this abundantly clear to market participants. We appreciate that this will make the standard unpalatable to some exchanges, but it is an SEC requirement that shareholders of a corporation provide verified names and addresses.&lt;&#x2F;p&gt;
&lt;p&gt;Proviso 3 is an implementation detail.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases-and-reference-implementation&quot;&gt;Test Cases and Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases and a reference implementation are available at &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;davesag&#x2F;ERC884-reference-implementation&quot;&gt;github.com&#x2F;davesag&#x2F;ERC884-reference-implementation&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Token Validation</title>
        <published>2018-02-14T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Brooklyn Zelenka</name><uri>https://github.com/expede</uri>
	</author>
	
	<author>
		<name>Tom Carchrae</name><uri>https://github.com/carchrae</uri>
	</author>
	
	<author>
		<name>Gleb Naumenko</name><uri>https://github.com/naumenkogs</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/902/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/update-on-erc902-validated-token/1639" />
        

        <id>https://wg-eips.ritovision.com/902/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:902"
            label="ERC-902" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/902/">&lt;h1 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h1&gt;
&lt;p&gt;A protocol for services providing token ownership and transfer validation.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h1&gt;
&lt;p&gt;This standard provides a registry contract method for authorizing token transfers. By nature, this covers both initially issuing tokens to users (ie: transfer from contract to owner), transferring tokens between users, and token spends.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h1&gt;
&lt;p&gt;The tokenization of assets has wide application, not least of which is financial instruments such as securities and security tokens. Most jurisdictions have placed legal constraints on what may be traded, and who can hold such tokens which are regarded as securities. Broadly this includes KYC and AML validation, but may also include time-based spend limits, total volume of transactions, and so on.&lt;&#x2F;p&gt;
&lt;p&gt;Regulators and sanctioned third-party compliance agencies need some way to link off-chain compliance information such as identity and residency to an on-chain service. The application of this design is broader than legal regulation, encompassing all manner of business logic permissions for the creation, management, and trading of tokens.&lt;&#x2F;p&gt;
&lt;p&gt;Rather than each token maintaining its own whitelist (or other mechanism), it is preferable to share on-chain resources, rules, lists, and so on. There is also a desire to aggregate data and rules spread across multiple validators, or to apply complex behaviours (ex. switching logic, gates, state machines) to apply distributed data to an application.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h1&gt;
&lt;h2 id=&quot;tokenvalidator&quot;&gt;&lt;code&gt;TokenValidator&lt;&#x2F;code&gt;&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TokenValidator&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; check&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _subject&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; statusCode&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; check&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _token&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; statusCode&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;methods&quot;&gt;Methods&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;check-2&quot;&gt;&lt;code&gt;check&lt;&#x2F;code&gt;&#x2F;2&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;function check(address _token, address _subject) public returns (byte _resultCode)&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;parameters&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;_token&lt;&#x2F;code&gt;: the token under review&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;_subject&lt;&#x2F;code&gt;: the user or contract to check&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;returns&lt;&#x2F;em&gt; an ERC1066 status code&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h4 id=&quot;check-4&quot;&gt;&lt;code&gt;check&lt;&#x2F;code&gt;&#x2F;4&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;function check(address token, address from, address to, uint256 amount) public returns (byte resultCode)&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;parameters&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;_token&lt;&#x2F;code&gt;: the token under review&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;_from&lt;&#x2F;code&gt;: in the case of a transfer, who is relinquishing token ownership&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;_to&lt;&#x2F;code&gt;: in the case of a transfer, who is accepting token ownership&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;_amount&lt;&#x2F;code&gt;: The number of tokens being transferred&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;returns&lt;&#x2F;em&gt; an ERC1066 status code&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h2 id=&quot;validatedtoken&quot;&gt;&lt;code&gt;ValidatedToken&lt;&#x2F;code&gt;&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ValidatedToken&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Validation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; subject&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; result&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Validation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; statusCode&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;events&quot;&gt;Events&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;validation-2&quot;&gt;&lt;code&gt;Validation&lt;&#x2F;code&gt;&#x2F;2&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;event Validation(address indexed subject, byte indexed resultCode)&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;This event MUST be fired on return from a call to a &lt;code&gt;TokenValidator.check&#x2F;2&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;parameters&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;subject&lt;&#x2F;code&gt;: the user or contract that was checked&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;statusCode&lt;&#x2F;code&gt;: an ERC1066 status code&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;blockquote&gt;
&lt;h4 id=&quot;validation-4&quot;&gt;&lt;code&gt;Validation&lt;&#x2F;code&gt;&#x2F;4&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Validation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; statusCode&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This event MUST be fired on return from a call to a &lt;code&gt;TokenValidator.check&#x2F;4&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;parameters&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;from&lt;&#x2F;code&gt;: in the case of a transfer, who is relinquishing token ownership&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;to&lt;&#x2F;code&gt;: in the case of a transfer, who is accepting token ownership&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;amount&lt;&#x2F;code&gt;: The number of tokens being transferred&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;statusCode&lt;&#x2F;code&gt;: an ERC1066 status code&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;blockquote&gt;
&lt;h1 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h1&gt;
&lt;p&gt;This proposal includes a financial permissions system on top of any financial token. This design is not a general roles&#x2F;permission system. In any system, the more you know about the context where a function will be called, the more powerful your function can be. By restricting ourselves to token transfers (ex. ERC20 or EIP-777), we can make assumptions about the use cases our validators will need to handle, and can make the API both small, useful, and extensible.&lt;&#x2F;p&gt;
&lt;p&gt;The events are fired by the calling token. Since &lt;code&gt;Validator&lt;&#x2F;code&gt;s may aggregate or delegate to other &lt;code&gt;Validator&lt;&#x2F;code&gt;s, it would generate a lot of useless events were it the
&lt;code&gt;Validator&lt;&#x2F;code&gt;&#x27;s responsibility. This is also the reason why we include the &lt;code&gt;token&lt;&#x2F;code&gt; in the &lt;code&gt;call&#x2F;4&lt;&#x2F;code&gt; arguments: a &lt;code&gt;Validator&lt;&#x2F;code&gt; cannot rely on &lt;code&gt;msg.sender&lt;&#x2F;code&gt; to determine the token that the call is concerning.&lt;&#x2F;p&gt;
&lt;p&gt;We have also seen a similar design from &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;harborhq&#x2F;r-token&quot;&gt;R-Token&lt;&#x2F;a&gt; that uses an additional field: &lt;code&gt;spender&lt;&#x2F;code&gt;. While there are potential use cases for this, it&#x27;s not widely used enough to justify passing a dummy value along with every call. Instead, such a call would look more like this:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;validator&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;check&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; okStatusCode&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        allowed&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;spender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        Approval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;A second &lt;code&gt;check&#x2F;2&lt;&#x2F;code&gt; function is also required, that is more general-purpose, and does not specify a transfer amount or recipient. This is intended for general checks, such as checking roles (admin, owner, &amp;amp;c), or if a user is on a simple whitelist.&lt;&#x2F;p&gt;
&lt;p&gt;We have left the decision to make associated &lt;code&gt;Validator&lt;&#x2F;code&gt; addresses public, private, or hardcoded up to the implementer. The proposed design does not include a centralized registry. It also does not include an interface for a &lt;code&gt;Validated&lt;&#x2F;code&gt; contract. A token may require one or many &lt;code&gt;Validator&lt;&#x2F;code&gt;s for different purposes, requiring different validations for different, or just a single &lt;code&gt;Validator&lt;&#x2F;code&gt;. The potential use cases are too varied to provide a single unified set of methods. We have provided a set of example contracts &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;Finhaven&#x2F;ValidatedToken&#x2F;&quot;&gt;here&lt;&#x2F;a&gt; that may be inherited from for common use cases.&lt;&#x2F;p&gt;
&lt;p&gt;The status codes in the &lt;code&gt;byte&lt;&#x2F;code&gt; returns are unspecified. Any status code scheme may be used, though a general status code proposal is fortcoming.&lt;&#x2F;p&gt;
&lt;p&gt;By only defining the validation check, this standard is widely compatible with ERC-20, EIP-721, EIP-777, future token standards, centralized and decentralized exchanges, and so on.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h1&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;expede&#x2F;validated-token&#x2F;&quot;&gt;Reference implementation&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h1 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h1&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Simpler NFT standard with batching and native atomic swaps</title>
        <published>2018-02-08T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Weiwu Zhang</name><email>a@colourful.land</email>
	</author>
	
	<author>
		<name>James Sangalli</name><email>j.l.sangalli@gmail.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/875/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/875" />
        

        <id>https://wg-eips.ritovision.com/875/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        

        
        <category
            term="tag:eip:875"
            label="ERC-875" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/875/">&lt;h2 id=&quot;summary&quot;&gt;Summary&lt;&#x2F;h2&gt;
&lt;p&gt;A simple non fungible token standard that allows batching tokens into lots and settling p2p atomic transfers in one transaction. You can test out an example implementation on rinkeby here: https:&#x2F;&#x2F;rinkeby.etherscan.io&#x2F;address&#x2F;0xffab5ce7c012bc942f5ca0cd42c3c2e1ae5f0005 and view the repo here: https:&#x2F;&#x2F;github.com&#x2F;alpha-wallet&#x2F;ERC-Example&lt;&#x2F;p&gt;
&lt;h2 id=&quot;purpose&quot;&gt;Purpose&lt;&#x2F;h2&gt;
&lt;p&gt;While other standards allow the user to transfer a non-fungible token, they require one transaction per token, this is heavy on gas and partially responsible for clogging the ethereum network. There are also few definitions for how to do a simple atomic swap.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rinkeby-example&quot;&gt;Rinkeby example&lt;&#x2F;h2&gt;
&lt;p&gt;This standard has been implemented in an example contract on rinkeby: https:&#x2F;&#x2F;rinkeby.etherscan.io&#x2F;address&#x2F;0xffab5ce7c012bc942f5ca0cd42c3c2e1ae5f0005&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;function-name-constant-returns-string-name&quot;&gt;function name() constant returns (string name)&lt;&#x2F;h3&gt;
&lt;p&gt;returns the name of the contract e.g. CarLotContract&lt;&#x2F;p&gt;
&lt;h3 id=&quot;function-symbol-constant-returns-string-symbol&quot;&gt;function symbol() constant returns (string symbol)&lt;&#x2F;h3&gt;
&lt;p&gt;Returns a short string of the symbol of the in-fungible token, this should be short and generic as each token is non-fungible.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;function-balanceof-address-owner-public-view-returns-uint256-balance&quot;&gt;function balanceOf(address _owner) public view returns (uint256[] balance)&lt;&#x2F;h3&gt;
&lt;p&gt;Returns an array of the users balance.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;function-transfer-address-to-uint256-tokens-public&quot;&gt;function transfer(address _to, uint256[] _tokens) public;&lt;&#x2F;h3&gt;
&lt;p&gt;Transfer your unique tokens to an address by adding an array of the token indices. This compares favourable to ERC721 as you can transfer a bulk of tokens in one go rather than one at a time. This has a big gas saving as well as being more convenient.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;function-transferfrom-address-from-address-to-uint256-tokens-public&quot;&gt;function transferFrom(address _from, address _to, uint256[] _tokens) public;&lt;&#x2F;h3&gt;
&lt;p&gt;Transfer a variable amount of tokens from one user to another. This can be done from an authorised party with a specified key e.g. contract owner.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;optional-functions&quot;&gt;Optional functions&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;function-totalsupply-constant-returns-uint256-totalsupply&quot;&gt;function totalSupply() constant returns (uint256 totalSupply);&lt;&#x2F;h3&gt;
&lt;p&gt;Returns the total amount of tokens in the given contract, this should be optional as assets might be allocated and issued on the fly. This means that supply is not always fixed.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;function-ownerof-uint256-tokenid-public-view-returns-address-owner&quot;&gt;function ownerOf(uint256 _tokenId) public view returns (address _owner);&lt;&#x2F;h3&gt;
&lt;p&gt;Returns the owner of a particular token, I think this should be optional as not every token contract will need to track the owner of a unique token and it costs gas to loop and map the token id owners each time the balances change.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;function-trade-uint256-expirytimestamp-uint256-tokenindices-uint8-v-bytes32-r-bytes32-s-public-payable&quot;&gt;function trade(uint256 expiryTimeStamp, uint256[] tokenIndices, uint8 v, bytes32 r, bytes32 s) public payable&lt;&#x2F;h3&gt;
&lt;p&gt;A function which allows a user to sell a batch of non-fungible tokens without paying for the gas fee (only the buyer has to) in a p2p atomic swap. This is achieved by signing an attestation containing the amount of tokens to sell, the contract address, an expiry timestamp, the price and a prefix containing the ERC spec name and chain id. A buyer can then pay for the deal in one transaction by attaching the appropriate ether to satisfy the deal.&lt;&#x2F;p&gt;
&lt;p&gt;This design is also more efficient as it allows orders to be done offline until settlement as opposed to creating orders in a smart contract and updating them. The expiry timestamp protects the seller against people using old orders.&lt;&#x2F;p&gt;
&lt;p&gt;This opens up the gates for a p2p atomic swap but should be optional to this standard as some may not have use for it.&lt;&#x2F;p&gt;
&lt;p&gt;Some protections need to be added to the message such as encoding the chain id, contract address and the ERC spec name to prevent replays and spoofing people into signing message that allow a trade.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;interface&quot;&gt;Interface&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC165&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Query if a contract implements an interface&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; interfaceID&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The interface identifier, as specified in ERC-165&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Interface identification is specified in ERC-165. This function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  uses less than 30,000 gas.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `true` if the contract implements `interfaceID` and&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;            &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  `interfaceID` is not 0xffffffff, `false` otherwise&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC875&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is ERC165 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIndices&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; symbol&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; symbol&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _balances&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokens&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokens&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;If you want the standard functions with atomic swap trading added&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC875WithAtomicSwapTrading&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC875&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; trade&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expiryTimeStamp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; tokenIndices&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; v&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; s&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;example-implementation&quot;&gt;Example implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Please visit this &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;alpha-wallet&#x2F;ERC875&quot;&gt;repo&lt;&#x2F;a&gt; to see an example implementation&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Node Discovery v4 ENR Extension</title>
        <published>2018-02-02T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Felix Lange</name><email>fjl@ethereum.org</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/868/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/devp2p/issues/44" />
        

        <id>https://wg-eips.ritovision.com/868/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="networking"
                label="Networking" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:868"
            label="EIP-868" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/868/">&lt;h1 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h1&gt;
&lt;p&gt;This EIP defines an extension to Node Discovery Protocol v4 to enable authoritative
resolution of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;778&#x2F;&quot;&gt;Ethereum Node Records (ENR)&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h1&gt;
&lt;p&gt;To bridge current and future discovery networks and to aid the implementation of other
relay mechanisms for ENR such as DNS, we need a way to request the most up-to-date version
of a node record. This EIP provides a way to request it using the existing discovery
protocol.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h1&gt;
&lt;p&gt;Implementations of Node Discovery Protocol v4 should support two new packet types, a
request and reply of the node record. The existing ping and pong packets are extended with
a new field containing the sequence number of the ENR.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;ping-packet-0x01&quot;&gt;Ping Packet (0x01)&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;packet-data = [version, from, to, expiration, enr-seq]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;enr-seq&lt;&#x2F;code&gt; is the current sequence number of the sending node&#x27;s record. All other fields
retain their existing meaning.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;pong-packet-0x02&quot;&gt;Pong Packet (0x02)&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;packet-data = [to, ping-hash, expiration, enr-seq]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;enr-seq&lt;&#x2F;code&gt; is the current sequence number of the sending node&#x27;s record. All other fields
retain their existing meaning.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;enrrequest-packet-0x05&quot;&gt;ENRRequest Packet (0x05)&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;packet-data = [ expiration ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;When a packet of this type is received, the node should reply with an ENRResponse packet
containing the current version of its record.&lt;&#x2F;p&gt;
&lt;p&gt;To guard against amplification attacks, the sender of ENRRequest should have replied to a
ping packet recently (just like for FindNode). The &lt;code&gt;expiration&lt;&#x2F;code&gt; field, a UNIX timestamp,
should be handled as for all other existing packets i.e. no reply should be sent if it
refers to a time in the past.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;enrresponse-packet-0x06&quot;&gt;ENRResponse Packet (0x06)&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;packet-data = [ request-hash, ENR ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This packet is the response to ENRRequest.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;request-hash&lt;&#x2F;code&gt; is the hash of the entire ENRRequest packet being replied to.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ENR&lt;&#x2F;code&gt; is the node record.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The recipient of the packet should verify that the node record is signed by node who sent
ENRResponse.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;resolving-records&quot;&gt;Resolving Records&lt;&#x2F;h2&gt;
&lt;p&gt;To resolve the current record of a node public key, perform a recursive Kademlia lookup
using the FindNode, Neighbors packets. When the node is found, send ENRRequest to it and
return the record from the response.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h1&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Reduce block reward and delay difficulty bomb</title>
        <published>2018-01-29T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Carl Larson</name><email>cslarson@gmail.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/858/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/858/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:858"
            label="EIP-858" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/858/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Reduce the block reward to 1 ETH and delay the difficulty bomb.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The current public Ethereum network has a hashrate that corresponds to a tremendous level of energy consumption. As this energy consumption has a correlated environmental cost the network participants have an ethical obligation to ensure this cost is not higher than necessary. At this time, the most direct way to reduce this cost is to lower the block reward in order to limit the appeal of ETH mining. Unchecked growth in hashrate is also counterproductive from a security standpoint.
Recent research developments also now time the switch to POS as sometime in 2019 and as a result there is need to further delay the difficulty bomb so the network doesn&#x27;t grind to a halt.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The current public Ethereum network has a hashrate of 296 TH&#x2F;s. This hashrate corresponds to a power usage of roughly &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;858&#x2F;assets&#x2F;calculations&#x2F;&quot;&gt;1 TW&lt;&#x2F;a&gt; and yearly energy consumption of 8.8 TWh (roughly 0.04% of &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;List_of_countries_by_electricity_consumption&quot;&gt;total&lt;&#x2F;a&gt; global electricity consumption). A future switch to full Proof of Stake will solve this issue entirely. Yet that switch remains enough in the future that action should be taken in the interim to limit excess harmful side affects of the present network.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Delay difficulty bomb by 2,000,000 blocks
Adjust block, uncle, and nephew rewards to reflect a new block reward of 1 ETH.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This will delay the difficulty bomb by roughly a year. The difficulty bomb remains a community supported mechanism to aid a future transition to POS.&lt;&#x2F;p&gt;
&lt;p&gt;The network hashrate provides security by reducing the likelihood that an adversary could mount a 51% attack. A static block reward means that factors (price) may be such that participation in mining grows unchecked. This growth may be counterproductive and work to also grow and potential pool of adversaries. The means we have to arrest this growth is to reduce the appeal of mining and the most direct way to do that is to reduce the block reward.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is consensus incompatible with the current public Ethereum chain and would cause a hard fork when enacted. The resulting fork would allow users to chose between two chains: a chain with a block reward of 1 ETH&#x2F;block and another with a block reward of 3 ETH&#x2F;block. This is a good choice to allow users to make. In addition, the difficulty bomb would be delayed - ensuring the network would not grind to a halt.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Tests have, as yet, not been completed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;No implementation including both block reward and difficulty adjustment is currently available.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Non-Fungible Token Standard</title>
        <published>2018-01-24T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>William Entriken</name><uri>https://github.com/fulldecent</uri>
	</author>
	
	<author>
		<name>Dieter Shirley</name><email>dete@axiomzen.co</email>
	</author>
	
	<author>
		<name>Jacob Evans</name><email>jacob@dekz.net</email>
	</author>
	
	<author>
		<name>Nastassia Sachs</name><email>nastassia.sachs@protonmail.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/721/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/eips/issues/721" />
        

        <id>https://wg-eips.ritovision.com/721/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:721"
            label="ERC-721" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/721/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;A standard interface for non-fungible tokens, also known as deeds.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The following standard allows for the implementation of a standard API for NFTs within smart contracts. This standard provides basic functionality to track and transfer NFTs.&lt;&#x2F;p&gt;
&lt;p&gt;We considered use cases of NFTs being owned and transacted by individuals as well as consignment to third party brokers&#x2F;wallets&#x2F;auctioneers (&quot;operators&quot;). NFTs can represent ownership over digital or physical assets. We considered a diverse universe of assets, and we know you will dream up many more:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Physical property — houses, unique artwork&lt;&#x2F;li&gt;
&lt;li&gt;Virtual collectibles — unique pictures of kittens, collectible cards&lt;&#x2F;li&gt;
&lt;li&gt;&quot;Negative value&quot; assets — loans, burdens and other responsibilities&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In general, all houses are distinct and no two kittens are alike. NFTs are &lt;em&gt;distinguishable&lt;&#x2F;em&gt; and you must track the ownership of each one separately.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;A standard interface allows wallet&#x2F;broker&#x2F;auction applications to work with any NFT on Ethereum. We provide for simple ERC-721 smart contracts as well as contracts that track an &lt;em&gt;arbitrarily large&lt;&#x2F;em&gt; number of NFTs. Additional applications are discussed below.&lt;&#x2F;p&gt;
&lt;p&gt;This standard is inspired by the ERC-20 token standard and builds on two years of experience since EIP-20 was created. EIP-20 is insufficient for tracking NFTs because each asset is distinct (non-fungible) whereas each of a quantity of tokens is identical (fungible).&lt;&#x2F;p&gt;
&lt;p&gt;Differences between this standard and EIP-20 are examined below.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Every ERC-721 compliant contract must implement the &lt;code&gt;ERC721&lt;&#x2F;code&gt; and &lt;code&gt;ERC165&lt;&#x2F;code&gt; interfaces&lt;&#x2F;strong&gt; (subject to &quot;caveats&quot; below):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.4.20&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-721 Non-Fungible Token Standard&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-721&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;  Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0x80ac58cd.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is ERC165 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when ownership of any NFT changes by any mechanism.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  This event emits when NFTs are created (`from` == 0) and destroyed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  (`to` == 0). Exception: during contract creation, any number of NFTs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  may be created and assigned without emitting Transfer. At the time of&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  any transfer, the approved address for that NFT (if any) is reset to none.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when the approved address for an NFT is &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;changed&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; or&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  reaffirmed. The zero address indicates there is no approved address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  When a Transfer event emits, this also indicates that the approved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  address for that NFT (if any) is reset to none.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Approval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This emits when an operator is enabled or disabled for an owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  The operator can manage all NFTs of the owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ApprovalForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Count all NFTs assigned to an owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; NFTs assigned to the zero address are considered invalid, and this&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  function throws for queries about the zero address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An address for whom to query the balance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; number of NFTs owned by `_owner`, possibly zero&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Find the owner of an NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; NFTs assigned to zero address are considered invalid, and queries&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  about them do throw.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The identifier for an NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address of the owner of the NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ownerOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfers the ownership of an NFT from one address to another address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws unless `msg.sender` is the current owner, an authorized&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  operator, or the approved address for this NFT. Throws if `_from` is&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  not the current owner. Throws if `_to` is the zero address. Throws if&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  `_tokenId` is not a valid NFT. When transfer is complete, this function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  checks if `_to` is a smart contract (code size &amp;gt; 0). If so, it calls&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  `onERC721Received` on `_to` and throws if the return value is not&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  `bytes4(keccak256(&amp;quot;onERC721Received(address,address,uint256,bytes)&amp;quot;))`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The current owner of the NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The new owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT to transfer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Additional data with no specified format, sent in call to `_to`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfers the ownership of an NFT from one address to another address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This works identically to the other function with an extra data parameter,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  except this function just sets data to &amp;quot;&amp;quot;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The current owner of the NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The new owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT to transfer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; safeTransferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfer ownership of an NFT -- THE CALLER IS RESPONSIBLE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  TO CONFIRM THAT `_to` IS CAPABLE OF RECEIVING NFTS OR ELSE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  THEY MAY BE PERMANENTLY LOST&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws unless `msg.sender` is the current owner, an authorized&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  operator, or the approved address for this NFT. Throws if `_from` is&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  not the current owner. Throws if `_to` is the zero address. Throws if&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  `_tokenId` is not a valid NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The current owner of the NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The new owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT to transfer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Change or reaffirm the approved address for an NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The zero address indicates there is no approved address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  Throws unless `msg.sender` is the current NFT owner, or an authorized&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  operator of the current owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The new approved NFT controller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT to approve&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Enable or disable approval for a third party (&amp;quot;operator&amp;quot;) to manage&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  all of `msg.sender`&amp;#39;s assets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Emits the ApprovalForAll event. The contract MUST allow&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  multiple operators per owner.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address to add to the set of authorized operators&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; True if the operator is approved, false to revoke approval&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setApprovalForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _approved&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the approved address for a single NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws if `_tokenId` is not a valid NFT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT to find the approved address for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; approved address for this NFT, or the zero address if there is none&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getApproved&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Query if an address is an authorized operator for another address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address that owns the NFTs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address that acts on behalf of the owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; True&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if `_operator` is an approved operator for `_owner`, false otherwise&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isApprovedForAll&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC165&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Query if a contract implements an interface&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; interfaceID&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The interface identifier, as specified in ERC-165&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Interface identification is specified in ERC-165. This function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  uses less than 30,000 gas.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `true` if the contract implements `interfaceID` and&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  `interfaceID` is not 0xffffffff, `false` otherwise&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;A wallet&#x2F;broker&#x2F;auction application MUST implement the &lt;strong&gt;wallet interface&lt;&#x2F;strong&gt; if it will accept safe transfers.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0x150b7a02.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721TokenReceiver&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Handle the receipt of an NFT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ERC721 smart contract calls this function on the recipient&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  after a `transfer`. This function MAY throw to revert and reject the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  transfer. Return of other than the magic value MUST result in the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  transaction being reverted.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;  Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the contract address is always the message sender.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address which called `safeTransferFrom` function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address which previously owned the token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The NFT identifier which is being transferred&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Additional data with no specified format&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `bytes4(keccak256(&amp;quot;onERC721Received(address,address,uint256,bytes)&amp;quot;))`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  unless throwing&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; onERC721Received&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;strong&gt;metadata extension&lt;&#x2F;strong&gt; is OPTIONAL for ERC-721 smart contracts (see &quot;caveats&quot;, below). This allows your smart contract to be interrogated for its name and for details about the assets which your NFTs represent.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-721 Non-Fungible Token Standard, optional metadata extension&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-721&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;  Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0x5b5e139f.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721Metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is ERC721 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A descriptive name for a collection of NFTs in this contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _name&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An abbreviated name for NFTs in this contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; symbol&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _symbol&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A distinct Uniform Resource Identifier (URI) for a given asset.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws if `_tokenId` is not a valid NFT. URIs are defined in RFC&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  3986. The URI may point to a JSON file that conforms to the &amp;quot;ERC721&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  Metadata JSON Schema&amp;quot;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenURI&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _tokenId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This is the &quot;ERC721 Metadata JSON Schema&quot; referenced above.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Asset Metadata&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;properties&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Identifies the asset to which this NFT represents&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Describes the asset to which this NFT represents&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;image&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;description&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A URI pointing to a resource with mime type image&#x2F;* representing the asset to which this NFT represents. Consider making any images at a width between 320 and 1080 pixels and aspect ratio between 1.91:1 and 4:5 inclusive.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;strong&gt;enumeration extension&lt;&#x2F;strong&gt; is OPTIONAL for ERC-721 smart contracts (see &quot;caveats&quot;, below). This allows your contract to publish its full list of NFTs and make them discoverable.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC-721 Non-Fungible Token Standard, optional enumeration extension&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-721&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;  Note&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: the ERC-165 identifier for this interface is 0x780e9d63.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC721Enumerable&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is ERC721 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Count NFTs tracked by this contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; A&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; count of valid NFTs tracked by this contract, where each one of&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  them has an assigned and queryable owner not equal to the zero address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Enumerate valid NFTs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws if `_index` &amp;gt;= `totalSupply()`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _index&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A counter less than `totalSupply()`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; token identifier for the `_index`th NFT,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  (sort order not specified)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenByIndex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Enumerate NFTs assigned to an owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Throws if `_index` &amp;gt;= `balanceOf(_owner)` or if&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  `_owner` is the zero address, representing invalid NFTs.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An address where we are interested in NFTs owned by them&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _index&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A counter less than `balanceOf(_owner)`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; token identifier for the `_index`th NFT assigned to `_owner`,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   (sort order not specified)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenOfOwnerByIndex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;caveats&quot;&gt;Caveats&lt;&#x2F;h3&gt;
&lt;p&gt;The 0.4.20 Solidity interface grammar is not expressive enough to document the ERC-721 standard. A contract which complies with ERC-721 MUST also abide by the following:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Solidity issue #3412: The above interfaces include explicit mutability guarantees for each function. Mutability guarantees are, in order weak to strong: &lt;code&gt;payable&lt;&#x2F;code&gt;, implicit nonpayable, &lt;code&gt;view&lt;&#x2F;code&gt;, and &lt;code&gt;pure&lt;&#x2F;code&gt;. Your implementation MUST meet the mutability guarantee in this interface and you MAY meet a stronger guarantee. For example, a &lt;code&gt;payable&lt;&#x2F;code&gt; function in this interface may be implemented as nonpayable (no state mutability specified) in your contract. We expect a later Solidity release will allow your stricter contract to inherit from this interface, but a workaround for version 0.4.20 is that you can edit this interface to add stricter mutability before inheriting from your contract.&lt;&#x2F;li&gt;
&lt;li&gt;Solidity issue #3419: A contract that implements &lt;code&gt;ERC721Metadata&lt;&#x2F;code&gt; or &lt;code&gt;ERC721Enumerable&lt;&#x2F;code&gt; SHALL also implement &lt;code&gt;ERC721&lt;&#x2F;code&gt;. ERC-721 implements the requirements of interface ERC-165.&lt;&#x2F;li&gt;
&lt;li&gt;Solidity issue #2330: If a function is shown in this specification as &lt;code&gt;external&lt;&#x2F;code&gt; then a contract will be compliant if it uses &lt;code&gt;public&lt;&#x2F;code&gt; visibility. As a workaround for version 0.4.20, you can edit this interface to switch to &lt;code&gt;public&lt;&#x2F;code&gt; before inheriting from your contract.&lt;&#x2F;li&gt;
&lt;li&gt;Solidity issues #3494, #3544: Use of &lt;code&gt;this.*.selector&lt;&#x2F;code&gt; is marked as a warning by Solidity, a future version of Solidity will not mark this as an error.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;If a newer version of Solidity allows the caveats to be expressed in code, then this EIP MAY be updated and the caveats removed, such will be equivalent to the original specification.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;There are many proposed uses of Ethereum smart contracts that depend on tracking distinguishable assets. Examples of existing or planned NFTs are LAND in Decentraland, the eponymous punks in CryptoPunks, and in-game items using systems like DMarket or EnjinCoin. Future uses include tracking real-world assets, like real-estate (as envisioned by companies like Ubitquity or Propy). It is critical in each of these cases that these items are not &quot;lumped together&quot; as numbers in a ledger, but instead each asset must have its ownership individually and atomically tracked. Regardless of the nature of these assets, the ecosystem will be stronger if we have a standardized interface that allows for cross-functional asset management and sales platforms.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&quot;NFT&quot; Word Choice&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&quot;NFT&quot; was satisfactory to nearly everyone surveyed and is widely applicable to a broad universe of distinguishable digital assets. We recognize that &quot;deed&quot; is very descriptive for certain applications of this standard (notably, physical property).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Alternatives considered: distinguishable asset, title, token, asset, equity, ticket&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;NFT Identifiers&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Every NFT is identified by a unique &lt;code&gt;uint256&lt;&#x2F;code&gt; ID inside the ERC-721 smart contract. This identifying number SHALL NOT change for the life of the contract. The pair &lt;code&gt;(contract address, uint256 tokenId)&lt;&#x2F;code&gt; will then be a globally unique and fully-qualified identifier for a specific asset on an Ethereum chain. While some ERC-721 smart contracts may find it convenient to start with ID 0 and simply increment by one for each new NFT, callers SHALL NOT assume that ID numbers have any specific pattern to them, and MUST treat the ID as a &quot;black box&quot;. Also note that NFTs MAY become invalid (be destroyed). Please see the enumeration functions for a supported enumeration interface.&lt;&#x2F;p&gt;
&lt;p&gt;The choice of &lt;code&gt;uint256&lt;&#x2F;code&gt; allows a wide variety of applications because UUIDs and sha3 hashes are directly convertible to &lt;code&gt;uint256&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Transfer Mechanism&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;ERC-721 standardizes a safe transfer function &lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt; (overloaded with and without a &lt;code&gt;bytes&lt;&#x2F;code&gt; parameter) and an unsafe function &lt;code&gt;transferFrom&lt;&#x2F;code&gt;. Transfers may be initiated by:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The owner of an NFT&lt;&#x2F;li&gt;
&lt;li&gt;The approved address of an NFT&lt;&#x2F;li&gt;
&lt;li&gt;An authorized operator of the current owner of an NFT&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Additionally, an authorized operator may set the approved address for an NFT. This provides a powerful set of tools for wallet, broker and auction applications to quickly use a &lt;em&gt;large&lt;&#x2F;em&gt; number of NFTs.&lt;&#x2F;p&gt;
&lt;p&gt;The transfer and accept functions&#x27; documentation only specify conditions when the transaction MUST throw. Your implementation MAY also throw in other situations. This allows implementations to achieve interesting results:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Disallow transfers if the contract is paused&lt;&#x2F;strong&gt; — prior art, CryptoKitties deployed contract, line 611&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Blocklist certain address from receiving NFTs&lt;&#x2F;strong&gt; — prior art, CryptoKitties deployed contract, lines 565, 566&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Disallow unsafe transfers&lt;&#x2F;strong&gt; — &lt;code&gt;transferFrom&lt;&#x2F;code&gt; throws unless &lt;code&gt;_to&lt;&#x2F;code&gt; equals &lt;code&gt;msg.sender&lt;&#x2F;code&gt; or &lt;code&gt;countOf(_to)&lt;&#x2F;code&gt; is non-zero or was non-zero previously (because such cases are safe)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Charge a fee to both parties of a transaction&lt;&#x2F;strong&gt; — require payment when calling &lt;code&gt;approve&lt;&#x2F;code&gt; with a non-zero &lt;code&gt;_approved&lt;&#x2F;code&gt; if it was previously the zero address, refund payment if calling &lt;code&gt;approve&lt;&#x2F;code&gt; with the zero address if it was previously a non-zero address, require payment when calling any transfer function, require transfer parameter &lt;code&gt;_to&lt;&#x2F;code&gt; to equal &lt;code&gt;msg.sender&lt;&#x2F;code&gt;, require transfer parameter &lt;code&gt;_to&lt;&#x2F;code&gt; to be the approved address for the NFT&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Read only NFT registry&lt;&#x2F;strong&gt; — always throw from &lt;code&gt;safeTransferFrom&lt;&#x2F;code&gt;, &lt;code&gt;transferFrom&lt;&#x2F;code&gt;, &lt;code&gt;approve&lt;&#x2F;code&gt; and &lt;code&gt;setApprovalForAll&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Failed transactions will throw, a best practice identified in ERC-223, ERC-677, ERC-827 and OpenZeppelin&#x27;s implementation of SafeERC20.sol. ERC-20 defined an &lt;code&gt;allowance&lt;&#x2F;code&gt; feature, this caused a problem when called and then later modified to a different amount, as on OpenZeppelin issue #438. In ERC-721, there is no allowance because every NFT is unique, the quantity is none or one. Therefore we receive the benefits of ERC-20&#x27;s original design without problems that have been later discovered.&lt;&#x2F;p&gt;
&lt;p&gt;Creation of NFTs (&quot;minting&quot;) and destruction of NFTs (&quot;burning&quot;) is not included in the specification. Your contract may implement these by other means. Please see the &lt;code&gt;event&lt;&#x2F;code&gt; documentation for your responsibilities when creating or destroying NFTs.&lt;&#x2F;p&gt;
&lt;p&gt;We questioned if the &lt;code&gt;operator&lt;&#x2F;code&gt; parameter on &lt;code&gt;onERC721Received&lt;&#x2F;code&gt; was necessary. In all cases we could imagine, if the operator was important then that operator could transfer the token to themself and then send it -- then they would be the &lt;code&gt;from&lt;&#x2F;code&gt; address. This seems contrived because we consider the operator to be a temporary owner of the token (and transferring to themself is redundant). When the operator sends the token, it is the operator acting on their own accord, NOT the operator acting on behalf of the token holder. This is why the operator and the previous token owner are both significant to the token recipient.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Alternatives considered: only allow two-step ERC-20 style transaction, require that transfer functions never throw, require all functions to return a boolean indicating the success of the operation.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;ERC-165 Interface&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;We chose Standard Interface Detection (ERC-165) to expose the interfaces that a ERC-721 smart contract supports.&lt;&#x2F;p&gt;
&lt;p&gt;A future EIP may create a global registry of interfaces for contracts. We strongly support such an EIP and it would allow your ERC-721 implementation to implement &lt;code&gt;ERC721Enumerable&lt;&#x2F;code&gt;, &lt;code&gt;ERC721Metadata&lt;&#x2F;code&gt;, or other interfaces by delegating to a separate contract.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Gas and Complexity&lt;&#x2F;strong&gt; (regarding the enumeration extension)&lt;&#x2F;p&gt;
&lt;p&gt;This specification contemplates implementations that manage a few and &lt;em&gt;arbitrarily large&lt;&#x2F;em&gt; numbers of NFTs. If your application is able to grow then avoid using for&#x2F;while loops in your code (see CryptoKitties bounty issue #4). These indicate your contract may be unable to scale and gas costs will rise over time without bound.&lt;&#x2F;p&gt;
&lt;p&gt;We have deployed a contract, XXXXERC721, to Testnet which instantiates and tracks 340282366920938463463374607431768211456 different deeds (2^128). That&#x27;s enough to assign every IPV6 address to an Ethereum account owner, or to track ownership of nanobots a few micron in size and in aggregate totalling half the size of Earth. You can query it from the blockchain. And every function takes less gas than querying the ENS.&lt;&#x2F;p&gt;
&lt;p&gt;This illustration makes clear: the ERC-721 standard scales.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Alternatives considered: remove the asset enumeration function if it requires a for-loop, return a Solidity array type from enumeration functions.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Privacy&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Wallets&#x2F;brokers&#x2F;auctioneers identified in the motivation section have a strong need to identify which NFTs an owner owns.&lt;&#x2F;p&gt;
&lt;p&gt;It may be interesting to consider a use case where NFTs are not enumerable, such as a private registry of property ownership, or a partially-private registry. However, privacy cannot be attained because an attacker can simply (!) call &lt;code&gt;ownerOf&lt;&#x2F;code&gt; for every possible &lt;code&gt;tokenId&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Metadata Choices&lt;&#x2F;strong&gt; (metadata extension)&lt;&#x2F;p&gt;
&lt;p&gt;We have required &lt;code&gt;name&lt;&#x2F;code&gt; and &lt;code&gt;symbol&lt;&#x2F;code&gt; functions in the metadata extension. Every token EIP and draft we reviewed (ERC-20, ERC-223, ERC-677, ERC-777, ERC-827) included these functions.&lt;&#x2F;p&gt;
&lt;p&gt;We remind implementation authors that the empty string is a valid response to &lt;code&gt;name&lt;&#x2F;code&gt; and &lt;code&gt;symbol&lt;&#x2F;code&gt; if you protest to the usage of this mechanism. We also remind everyone that any smart contract can use the same name and symbol as &lt;em&gt;your&lt;&#x2F;em&gt; contract. How a client may determine which ERC-721 smart contracts are well-known (canonical) is outside the scope of this standard.&lt;&#x2F;p&gt;
&lt;p&gt;A mechanism is provided to associate NFTs with URIs. We expect that many implementations will take advantage of this to provide metadata for each NFT. The image size recommendation is taken from Instagram, they probably know much about image usability. The URI MAY be mutable (i.e. it changes from time to time). We considered an NFT representing ownership of a house, in this case metadata about the house (image, occupants, etc.) can naturally change.&lt;&#x2F;p&gt;
&lt;p&gt;Metadata is returned as a string value. Currently this is only usable as calling from &lt;code&gt;web3&lt;&#x2F;code&gt;, not from other contracts. This is acceptable because we have not considered a use case where an on-blockchain application would query such information.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Alternatives considered: put all metadata for each asset on the blockchain (too expensive), use URL templates to query metadata parts (URL templates do not work with all URL schemes, especially P2P URLs), multiaddr network address (not mature enough)&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Community Consensus&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;A significant amount of discussion occurred on the original ERC-721 issue, additionally we held a first live meeting on Gitter that had good representation and well advertised (on Reddit, in the Gitter #ERC channel, and the original ERC-721 issue). Thank you to the participants:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;imallinnow&quot;&gt;@ImAllInNow&lt;&#x2F;a&gt; Rob from DEC Gaming &#x2F; Presenting Michigan Ethereum Meetup Feb 7&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;arachnid&quot;&gt;@Arachnid&lt;&#x2F;a&gt; Nick Johnson&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;jadhavajay&quot;&gt;@jadhavajay&lt;&#x2F;a&gt; Ajay Jadhav from AyanWorks&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;superphly&quot;&gt;@superphly&lt;&#x2F;a&gt; Cody Marx Bailey - XRAM Capital &#x2F; Sharing at hackathon Jan 20 &#x2F; UN Future of Finance Hackathon.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;fulldecent&quot;&gt;@fulldecent&lt;&#x2F;a&gt; William Entriken&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;A second event was held at ETHDenver 2018 to discuss distinguishable asset standards (notes to be published).&lt;&#x2F;p&gt;
&lt;p&gt;We have been very inclusive in this process and invite anyone with questions or contributions into our discussion. However, this standard is written only to support the identified use cases which are listed herein.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;We have adopted &lt;code&gt;balanceOf&lt;&#x2F;code&gt;, &lt;code&gt;totalSupply&lt;&#x2F;code&gt;, &lt;code&gt;name&lt;&#x2F;code&gt; and &lt;code&gt;symbol&lt;&#x2F;code&gt; semantics from the ERC-20 specification. An implementation may also include a function &lt;code&gt;decimals&lt;&#x2F;code&gt; that returns &lt;code&gt;uint8(0)&lt;&#x2F;code&gt; if its goal is to be more compatible with ERC-20 while supporting this standard. However, we find it contrived to require all ERC-721 implementations to support the &lt;code&gt;decimals&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;p&gt;Example NFT implementations as of February 2018:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;CryptoKitties -- Compatible with an earlier version of this standard.&lt;&#x2F;li&gt;
&lt;li&gt;CryptoPunks -- Partially ERC-20 compatible, but not easily generalizable because it includes auction functionality directly in the contract and uses function names that explicitly refer to the assets as &quot;punks&quot;.&lt;&#x2F;li&gt;
&lt;li&gt;Auctionhouse Asset Interface -- The author needed a generic interface for the Auctionhouse ÐApp (currently ice-boxed). His &quot;Asset&quot; contract is very simple, but is missing ERC-20 compatibility, &lt;code&gt;approve()&lt;&#x2F;code&gt; functionality, and metadata. This effort is referenced in the discussion for EIP-173.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note: &quot;Limited edition, collectible tokens&quot; like Curio Cards and Rare Pepe are &lt;em&gt;not&lt;&#x2F;em&gt; distinguishable assets. They&#x27;re actually a collection of individual fungible tokens, each of which is tracked by its own smart contract with its own total supply (which may be &lt;code&gt;1&lt;&#x2F;code&gt; in extreme cases).&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;onERC721Received&lt;&#x2F;code&gt; function specifically works around old deployed contracts which may inadvertently return 1 (&lt;code&gt;true&lt;&#x2F;code&gt;) in certain circumstances even if they don&#x27;t implement a function (see Solidity DelegateCallReturnValue bug). By returning and checking for a magic value, we are able to distinguish actual affirmative responses versus these vacuous &lt;code&gt;true&lt;&#x2F;code&gt;s.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;0xcert ERC-721 Token includes test cases written using Truffle.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementations&quot;&gt;Implementations&lt;&#x2F;h2&gt;
&lt;p&gt;0xcert ERC721 -- a reference implementation&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;MIT licensed, so you can freely use it for your projects&lt;&#x2F;li&gt;
&lt;li&gt;Includes test cases&lt;&#x2F;li&gt;
&lt;li&gt;Active bug bounty, you will be paid if you find errors&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Su Squares -- an advertising platform where you can rent space and place images&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Complete the Su Squares Bug Bounty Program to seek problems with this standard or its implementation&lt;&#x2F;li&gt;
&lt;li&gt;Implements the complete standard and all optional interfaces&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;ERC721ExampleDeed -- an example implementation&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Implements using the OpenZeppelin project format&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;XXXXERC721, by William Entriken -- a scalable example implementation&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Deployed on testnet with 1 billion assets and supporting all lookups with the metadata extension. This demonstrates that scaling is NOT a problem.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;Standards&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; Token Standard.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; Standard Interface Detection.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;173&#x2F;&quot;&gt;ERC-173&lt;&#x2F;a&gt; Owned Standard.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;223&quot;&gt;ERC-223&lt;&#x2F;a&gt; Token Standard.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;677&quot;&gt;ERC-677&lt;&#x2F;a&gt; &lt;code&gt;transferAndCall&lt;&#x2F;code&gt; Token Standard.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;827&quot;&gt;ERC-827&lt;&#x2F;a&gt; Token Standard.&lt;&#x2F;li&gt;
&lt;li&gt;Ethereum Name Service (ENS). https:&#x2F;&#x2F;ens.domains&lt;&#x2F;li&gt;
&lt;li&gt;Instagram -- What&#x27;s the Image Resolution? https:&#x2F;&#x2F;help.instagram.com&#x2F;1631821640426723&lt;&#x2F;li&gt;
&lt;li&gt;JSON Schema. https:&#x2F;&#x2F;json-schema.org&#x2F;&lt;&#x2F;li&gt;
&lt;li&gt;Multiaddr. https:&#x2F;&#x2F;github.com&#x2F;multiformats&#x2F;multiaddr&lt;&#x2F;li&gt;
&lt;li&gt;RFC 2119 Key words for use in RFCs to Indicate Requirement Levels. https:&#x2F;&#x2F;www.ietf.org&#x2F;rfc&#x2F;rfc2119.txt&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;strong&gt;Issues&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The Original ERC-721 Issue. https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;eips&#x2F;issues&#x2F;721&lt;&#x2F;li&gt;
&lt;li&gt;Solidity Issue #2330 -- Interface Functions are External. https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;solidity&#x2F;issues&#x2F;2330&lt;&#x2F;li&gt;
&lt;li&gt;Solidity Issue #3412 -- Implement Interface: Allow Stricter Mutability. https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;solidity&#x2F;issues&#x2F;3412&lt;&#x2F;li&gt;
&lt;li&gt;Solidity Issue #3419 -- Interfaces Can&#x27;t Inherit. https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;solidity&#x2F;issues&#x2F;3419&lt;&#x2F;li&gt;
&lt;li&gt;Solidity Issue #3494 -- Compiler Incorrectly Reasons About the &lt;code&gt;selector&lt;&#x2F;code&gt; Function. https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;solidity&#x2F;issues&#x2F;3494&lt;&#x2F;li&gt;
&lt;li&gt;Solidity Issue #3544 -- Cannot Calculate Selector of Function Named &lt;code&gt;transfer&lt;&#x2F;code&gt;. https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;solidity&#x2F;issues&#x2F;3544&lt;&#x2F;li&gt;
&lt;li&gt;CryptoKitties Bounty Issue #4 -- Listing all Kitties Owned by a User is &lt;code&gt;O(n^2)&lt;&#x2F;code&gt;. https:&#x2F;&#x2F;github.com&#x2F;axiomzen&#x2F;cryptokitties-bounty&#x2F;issues&#x2F;4&lt;&#x2F;li&gt;
&lt;li&gt;OpenZeppelin Issue #438 -- Implementation of &lt;code&gt;approve&lt;&#x2F;code&gt; method violates ERC20 standard. https:&#x2F;&#x2F;github.com&#x2F;OpenZeppelin&#x2F;zeppelin-solidity&#x2F;issues&#x2F;438&lt;&#x2F;li&gt;
&lt;li&gt;Solidity DelegateCallReturnValue Bug. https:&#x2F;&#x2F;solidity.readthedocs.io&#x2F;en&#x2F;develop&#x2F;bugs.html#DelegateCallReturnValue&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;strong&gt;Discussions&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Reddit (announcement of first live discussion). https:&#x2F;&#x2F;www.reddit.com&#x2F;r&#x2F;ethereum&#x2F;comments&#x2F;7r2ena&#x2F;friday_119_live_discussion_on_erc_nonfungible&#x2F;&lt;&#x2F;li&gt;
&lt;li&gt;Gitter #EIPs (announcement of first live discussion). https:&#x2F;&#x2F;gitter.im&#x2F;ethereum&#x2F;EIPs?at=5a5f823fb48e8c3566f0a5e7&lt;&#x2F;li&gt;
&lt;li&gt;ERC-721 (announcement of first live discussion). https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;eips&#x2F;issues&#x2F;721#issuecomment-358369377&lt;&#x2F;li&gt;
&lt;li&gt;ETHDenver 2018. https:&#x2F;&#x2F;ethdenver.com&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;strong&gt;NFT Implementations and Other Projects&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;CryptoKitties. https:&#x2F;&#x2F;www.cryptokitties.co&lt;&#x2F;li&gt;
&lt;li&gt;0xcert ERC-721 Token. https:&#x2F;&#x2F;github.com&#x2F;0xcert&#x2F;ethereum-erc721&lt;&#x2F;li&gt;
&lt;li&gt;Su Squares. https:&#x2F;&#x2F;tenthousandsu.com&lt;&#x2F;li&gt;
&lt;li&gt;Decentraland. https:&#x2F;&#x2F;decentraland.org&lt;&#x2F;li&gt;
&lt;li&gt;CryptoPunks. https:&#x2F;&#x2F;www.larvalabs.com&#x2F;cryptopunks&lt;&#x2F;li&gt;
&lt;li&gt;DMarket. https:&#x2F;&#x2F;www.dmarket.io&lt;&#x2F;li&gt;
&lt;li&gt;Enjin Coin. https:&#x2F;&#x2F;enjincoin.io&lt;&#x2F;li&gt;
&lt;li&gt;Ubitquity. https:&#x2F;&#x2F;www.ubitquity.io&lt;&#x2F;li&gt;
&lt;li&gt;Propy. https:&#x2F;&#x2F;tokensale.propy.com&lt;&#x2F;li&gt;
&lt;li&gt;CryptoKitties Deployed Contract. https:&#x2F;&#x2F;etherscan.io&#x2F;address&#x2F;0x06012c8cf97bead5deae237070f9587f8e7a266d#code&lt;&#x2F;li&gt;
&lt;li&gt;Su Squares Bug Bounty Program. https:&#x2F;&#x2F;github.com&#x2F;fulldecent&#x2F;su-squares-bounty&lt;&#x2F;li&gt;
&lt;li&gt;XXXXERC721. https:&#x2F;&#x2F;github.com&#x2F;fulldecent&#x2F;erc721-example&lt;&#x2F;li&gt;
&lt;li&gt;ERC721ExampleDeed. https:&#x2F;&#x2F;github.com&#x2F;nastassiasachs&#x2F;ERC721ExampleDeed&lt;&#x2F;li&gt;
&lt;li&gt;Curio Cards. https:&#x2F;&#x2F;mycuriocards.com&lt;&#x2F;li&gt;
&lt;li&gt;Rare Pepe. https:&#x2F;&#x2F;rarepepewallet.com&lt;&#x2F;li&gt;
&lt;li&gt;Auctionhouse Asset Interface. https:&#x2F;&#x2F;github.com&#x2F;dob&#x2F;auctionhouse&#x2F;blob&#x2F;master&#x2F;contracts&#x2F;Asset.sol&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;.&#x2F;assets&#x2F;SafeERC20.sol&quot;&gt;OpenZeppelin &lt;code&gt;SafeERC20.sol&lt;&#x2F;code&gt; Implementation&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Standard Interface Detection</title>
        <published>2018-01-23T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Christian Reitwießner</name><email>chris@ethereum.org</email>
	</author>
	
	<author>
		<name>Nick Johnson</name><email>nick@ethereum.org</email>
	</author>
	
	<author>
		<name>Fabian Vogelsteller</name><email>fabian@lukso.network</email>
	</author>
	
	<author>
		<name>Jordi Baylina</name><email>jordi@baylina.cat</email>
	</author>
	
	<author>
		<name>Konrad Feldmeier</name><email>konrad.feldmeier@brainbot.com</email>
	</author>
	
	<author>
		<name>William Entriken</name><email>github.com@phor.net</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/165/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/165/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:165"
            label="ERC-165" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/165/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Creates a standard method to publish and detect what interfaces a smart contract implements.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Herein, we standardize the following:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;How interfaces are identified&lt;&#x2F;li&gt;
&lt;li&gt;How a contract will publish the interfaces it implements&lt;&#x2F;li&gt;
&lt;li&gt;How to detect if a contract implements ERC-165&lt;&#x2F;li&gt;
&lt;li&gt;How to detect if a contract implements any given interface&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;For some &quot;standard interfaces&quot; like &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;the ERC-20 token interface&lt;&#x2F;a&gt;, it is sometimes useful to query whether a contract supports the interface and if yes, which version of the interface, in order to adapt the way in which the contract is to be interacted with. Specifically for ERC-20, a version identifier has already been proposed. This proposal standardizes the concept of interfaces and standardizes the identification (naming) of interfaces.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;how-interfaces-are-identified&quot;&gt;How Interfaces are Identified&lt;&#x2F;h3&gt;
&lt;p&gt;For this standard, an &lt;em&gt;interface&lt;&#x2F;em&gt; is a set of &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;solidity.readthedocs.io&#x2F;en&#x2F;develop&#x2F;abi-spec.html#function-selector&quot;&gt;function selectors as defined by the Ethereum ABI&lt;&#x2F;a&gt;. This a subset of &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;solidity.readthedocs.io&#x2F;en&#x2F;develop&#x2F;abi-spec.html&quot;&gt;Solidity&#x27;s concept of interfaces&lt;&#x2F;a&gt; and the  &lt;code&gt;interface&lt;&#x2F;code&gt; keyword definition which also defines return types, mutability and events.&lt;&#x2F;p&gt;
&lt;p&gt;We define the interface identifier as the XOR of all function selectors in the interface. This code example shows how to calculate an interface identifier:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.4.20&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Solidity101&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; hello&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; world&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Selector&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calculateSelector&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        Solidity101 i&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;hello&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;^&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;world&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note: interfaces do not permit optional functions, therefore, the interface identity will not include them.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;how-a-contract-will-publish-the-interfaces-it-implements&quot;&gt;How a Contract will Publish the Interfaces it Implements&lt;&#x2F;h3&gt;
&lt;p&gt;A contract that is compliant with ERC-165 shall implement the following interface (referred as &lt;code&gt;ERC165.sol&lt;&#x2F;code&gt;):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.4.20&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC165&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Query if a contract implements an interface&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; interfaceID&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The interface identifier, as specified in ERC-165&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Interface identification is specified in ERC-165. This function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  uses less than 30,000 gas.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `true` if the contract implements `interfaceID` and&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  `interfaceID` is not 0xffffffff, `false` otherwise&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The interface identifier for this interface is &lt;code&gt;0x01ffc9a7&lt;&#x2F;code&gt;. You can calculate this by running &lt;code&gt;bytes4(keccak256(&#x27;supportsInterface(bytes4)&#x27;));&lt;&#x2F;code&gt; or using the &lt;code&gt;Selector&lt;&#x2F;code&gt; contract above.&lt;&#x2F;p&gt;
&lt;p&gt;Therefore the implementing contract will have a &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; function that returns:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;true&lt;&#x2F;code&gt; when &lt;code&gt;interfaceID&lt;&#x2F;code&gt; is &lt;code&gt;0x01ffc9a7&lt;&#x2F;code&gt; (EIP165 interface)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;false&lt;&#x2F;code&gt; when &lt;code&gt;interfaceID&lt;&#x2F;code&gt; is &lt;code&gt;0xffffffff&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;true&lt;&#x2F;code&gt; for any other &lt;code&gt;interfaceID&lt;&#x2F;code&gt; this contract implements&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;false&lt;&#x2F;code&gt; for any other &lt;code&gt;interfaceID&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This function must return a bool and use at most 30,000 gas.&lt;&#x2F;p&gt;
&lt;p&gt;Implementation note, there are several logical ways to implement this function. Please see the example implementations and the discussion on gas usage.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;how-to-detect-if-a-contract-implements-erc-165&quot;&gt;How to Detect if a Contract Implements ERC-165&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;The source contract makes a &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; to the destination address with input data: &lt;code&gt;0x01ffc9a701ffc9a700000000000000000000000000000000000000000000000000000000&lt;&#x2F;code&gt; and gas 30,000. This corresponds to &lt;code&gt;contract.supportsInterface(0x01ffc9a7)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If the call fails or return false, the destination contract does not implement ERC-165.&lt;&#x2F;li&gt;
&lt;li&gt;If the call returns true, a second call is made with input data &lt;code&gt;0x01ffc9a7ffffffff00000000000000000000000000000000000000000000000000000000&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If the second call fails or returns true, the destination contract does not implement ERC-165.&lt;&#x2F;li&gt;
&lt;li&gt;Otherwise it implements ERC-165.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;how-to-detect-if-a-contract-implements-any-given-interface&quot;&gt;How to Detect if a Contract Implements any Given Interface&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;If you are not sure if the contract implements ERC-165, use the above procedure to confirm.&lt;&#x2F;li&gt;
&lt;li&gt;If it does not implement ERC-165, then you will have to see what methods it uses the old-fashioned way.&lt;&#x2F;li&gt;
&lt;li&gt;If it implements ERC-165 then just call &lt;code&gt;supportsInterface(interfaceID)&lt;&#x2F;code&gt; to determine if it implements an interface you can use.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;We tried to keep this specification as simple as possible. This implementation is also compatible with the current Solidity version.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The mechanism described above (with &lt;code&gt;0xffffffff&lt;&#x2F;code&gt;) should work with most of the contracts previous to this standard to determine that they do not implement ERC-165.&lt;&#x2F;p&gt;
&lt;p&gt;Also &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;137&#x2F;&quot;&gt;the ENS&lt;&#x2F;a&gt; already implements this EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Following is a contract that detects which interfaces other contracts implement. From @fulldecent and @jbaylina.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.4.20&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC165Query&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; InvalidID &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xffffffff&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; ERC165ID &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x01ffc9a7&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; doesContractImplementInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; success&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; result&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span&gt;success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; noThrowCall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; ERC165ID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;success&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span&gt;success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; noThrowCall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; InvalidID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;success&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span&gt;success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; noThrowCall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;success&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; noThrowCall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes4&lt;&#x2F;span&gt;&lt;span&gt; erc165ID &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; ERC165ID&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;                let&lt;&#x2F;span&gt;&lt;span&gt; x &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x40&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;               &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Find empty storage location using &amp;quot;free memory pointer&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;                mstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;x&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; erc165ID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Place signature at beginning of empty storage&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;                mstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;x&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x04&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Place first argument directly next to signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                success &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; staticcall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;                                    30000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;         &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 30k gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                    _contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;     &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; To addr&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                    x&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;             &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Inputs are stored at location x&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;                                    0x24&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;          &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Inputs are 36 bytes long&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                    x&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;             &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Store output over input (saves space)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;                                    0x20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;          &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Outputs are 32 bytes long&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                result &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;x&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                 &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Load the result&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;This approach uses a &lt;code&gt;view&lt;&#x2F;code&gt; function implementation of &lt;code&gt;supportsInterface&lt;&#x2F;code&gt;. The execution cost is 586 gas for any input. But contract initialization requires storing each interface (&lt;code&gt;SSTORE&lt;&#x2F;code&gt; is 20,000 gas). The &lt;code&gt;ERC165MappingImplementation&lt;&#x2F;code&gt; contract is generic and reusable.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.4.20&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;ERC165.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC165MappingImplementation&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC165&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; You must not set element 0xffffffff to true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; supportedInterfaces&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC165MappingImplementation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        supportedInterfaces&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; supportedInterfaces&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;interfaceID&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Simpson&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; is2D&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; skinColor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Lisa&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC165MappingImplementation&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Simpson&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Lisa&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        supportedInterfaces&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;is2D&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;^&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;skinColor&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; is2D&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; skinColor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Following is a &lt;code&gt;pure&lt;&#x2F;code&gt; function implementation of &lt;code&gt;supportsInterface&lt;&#x2F;code&gt;. The worst-case execution cost is 236 gas, but increases linearly with a higher number of supported interfaces.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.4.20&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;.&#x2F;ERC165.sol&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Simpson&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; is2D&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; skinColor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Homer&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC165&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Simpson&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          interfaceID &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC165&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          interfaceID &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;is2D&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                         ^&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;skinColor&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Simpson&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; is2D&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; skinColor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;With three or more supported interfaces (including ERC165 itself as a required supported interface), the mapping approach (in every case) costs less gas than the pure approach (at worst case).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;version-history&quot;&gt;Version history&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;PR 1640, finalized 2019-01-23 -- This corrects the noThrowCall test case to use 36 bytes rather than the previous 32 bytes. The previous code was an error that still silently worked in Solidity 0.4.x but which was broken by new behavior introduced in Solidity 0.5.0. This change was discussed at &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;pull&#x2F;1640&quot;&gt;#1640&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;EIP 165, finalized 2018-04-20 -- Original published version.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>URI Format for Ethereum</title>
        <published>2018-01-15T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:26+00:00</updated>
	
	
	<author>
		<name>ligi</name><uri>https://github.com/ligi</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/831/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-831-uri-format-for-ethereum/10105" />
        

        <id>https://wg-eips.ritovision.com/831/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:831"
            label="ERC-831" />
        

        
        

        
        <summary type="html">A way of creating Ethereum URIs for various use-cases.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/831/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;URIs embedded in QR-codes, hyperlinks in web-pages, emails or chat messages provide for robust cross-application signaling between very loosely coupled applications. A standardized URI format allows for instant invocation of the user&#x27;s preferred wallet application.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;syntax&quot;&gt;Syntax&lt;&#x2F;h3&gt;
&lt;p&gt;Ethereum URIs contain &quot;ethereum&quot; or &quot;eth&quot; in their schema (protocol) part and are constructed as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;request                 = &amp;quot;eth&amp;quot; [ &amp;quot;ereum&amp;quot; ] &amp;quot;:&amp;quot; [ prefix &amp;quot;-&amp;quot; ] payload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;prefix                  = STRING&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;payload                 = STRING&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;semantics&quot;&gt;Semantics&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;prefix&lt;&#x2F;code&gt; is optional and defines the use-case for this URI. If no prefix is given: &quot;pay-&quot; is assumed to be concise and ensure backward compatibility to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;67&#x2F;&quot;&gt;EIP-67&lt;&#x2F;a&gt;. When the prefix is omitted, the payload must start with &lt;code&gt;0x&lt;&#x2F;code&gt;. Also prefixes must not start with &lt;code&gt;0x&lt;&#x2F;code&gt;. So starting with &lt;code&gt;0x&lt;&#x2F;code&gt; can be used as a clear signal that there is no prefix.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;payload&lt;&#x2F;code&gt; is mandatory and the content depends on the prefix. Structuring of the content is defined in the ERC for the specific use-case and not in the scope of this document. One example is &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;681&#x2F;&quot;&gt;EIP-681&lt;&#x2F;a&gt; for the pay- prefix.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The need for this ERC emerged when refining EIP-681. We need a container that does not carry the weight of the use-cases. EIP-67 was the first attempt on defining Ethereum-URIs. This ERC tries to keep backward compatibility and not break existing things. This means EIP-67 URIs should still be valid and readable. Only if the prefix feature is used, EIP-67 parsers might break. No way was seen to avoid this and innovate on the same time. This is also the reason this open prefix approach was chosen to being able to adopt to future use-cases and not block the whole &quot;ethereum:&quot; scheme for a limited set of use-cases that existed at the time of writing this.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;There are no known security considerations at this time.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Token Exchange Standard</title>
        <published>2018-01-06T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Kashish Khullar</name><email>kkhullar7@gmail.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/823/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/823/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:823"
            label="ERC-823" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/823/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;A standard for token contracts, providing token exchange services thereby facilitating cross token payments.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The following standard provides functionally to make payments in the form of any other registered tokens, as well as allow token contracts to store any other tokens in an existing token contract. This standard allows ERC20 token holders to exchange their token with another ERC20 token and use the exchanged tokens to make payments. After a successful payment, the former specified ERC20 tokens, will be stored within the ERC20 token contract they are exchanged with. This proposal uses the term target contract which is used to denote the contract to the token with whom we want to exchange our tokens.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Existing token standards do not provide functionality to exchange tokens. Existing token converters reduce the total supply of an existing token, which in the sense destroys the currency. Token converters do not solve this problem and hence discourages creation of new tokens. This solution does not destroy the existing token but in essence preserve them in the token contract that they are exchanged with, which in turn increases the market value of the latter.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;sender-interface&quot;&gt;Sender Interface&lt;&#x2F;h3&gt;
&lt;p&gt;This interface must be inherited by a ERC20 token contract that wants to exchange its tokens with another token.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;storage-variables&quot;&gt;Storage Variables&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;exchnagedwith&quot;&gt;exchnagedWith&lt;&#x2F;h5&gt;
&lt;p&gt;This mapping stores the number of tokens exchanged with another token, along with the latter’s address. Every time more tokens are exchanged the integer value is incremented consequently. This mapping acts as a record to denote which target contract holds our tokens.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;mapping&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span&gt; )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; exchangedWith&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;exchangedby&quot;&gt;exchangedBy&lt;&#x2F;h5&gt;
&lt;p&gt;This mapping stores the address of the person who initiated the exchange and the amount of tokens exchanged.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;mapping&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span&gt; )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; exhangedBy&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;methods&quot;&gt;Methods&lt;&#x2F;h4&gt;
&lt;p&gt;NOTE: Callers MUST handle false from returns (bool success). Callers MUST NOT assume that false is never returned!&lt;&#x2F;p&gt;
&lt;h5 id=&quot;exchangetoken&quot;&gt;exchangeToken&lt;&#x2F;h5&gt;
&lt;p&gt;This function calls the intermediate exchange service contract that handles the exchanges. This function takes the address of the target contract and the amount we want to exchange as parameters and returns boolean &lt;code&gt;success&lt;&#x2F;code&gt; and &lt;code&gt;creditedAmount&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; exchangeToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _targetContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; creditedAmount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;exchangeandspend&quot;&gt;exchangeAndSpend&lt;&#x2F;h5&gt;
&lt;p&gt;This function calls an intermediate exchange service contract that handles exchange and expenditure. This function takes the address of the target contract, the amount we want to spend in terms of target contract tokens and address of the receiver as parameters and returns boolean &lt;code&gt;success&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; exchangeAndSpend&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _targetContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;exchangercallback&quot;&gt;__exchangerCallback&lt;&#x2F;h5&gt;
&lt;p&gt;This function is called by the exchange service contract to our token contract to deduct calculated amount from our balance. It takes the address of the targert contract , the address of the person who exchanged the tokens and amount to be deducted from exchangers account as parameters and returns boolean &lt;code&gt;success&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;NOTE: It is required that only the exchange service contract has the authority to call this function.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; __exchangerCallback&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _targetContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _exchanger&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;events&quot;&gt;Events&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;exchange&quot;&gt;Exchange&lt;&#x2F;h5&gt;
&lt;p&gt;This event logs any new exchanges that have taken place.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Exchange&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; targetContract&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;exchangespent&quot;&gt;ExchangeSpent&lt;&#x2F;h5&gt;
&lt;p&gt;This event logs any new exchange that have taken place and have been spent immediately.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ExchangeSpent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _targetContract&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;receiver-interface&quot;&gt;Receiver Interface&lt;&#x2F;h3&gt;
&lt;p&gt;This interface must be inherited by a ERC20 token contract that wants to receive exchanged tokens.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;storage-variables-1&quot;&gt;Storage Variables&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;exchangesrecieved&quot;&gt;exchangesRecieved&lt;&#x2F;h5&gt;
&lt;p&gt;This mapping stores the number of tokens received in terms of another token, along with its address. Every time more tokens are exchanged the integer value is incremented consequently. This mapping acts as a record to denote which tokens do this contract holds apart from its own.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;mapping&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span&gt; )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; exchnagesReceived&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;methods-1&quot;&gt;Methods&lt;&#x2F;h4&gt;
&lt;p&gt;NOTE: Callers MUST handle false from returns (bool success). Callers MUST NOT assume that false is never returned!&lt;&#x2F;p&gt;
&lt;h5 id=&quot;targetexchangecallback&quot;&gt;__targetExchangeCallback&lt;&#x2F;h5&gt;
&lt;p&gt;This function is called by the intermediate exchange service contract. This function should add &lt;code&gt;_amount&lt;&#x2F;code&gt; tokens of the target contract to the exchangers address for exchange to be completed successfully.&lt;&#x2F;p&gt;
&lt;p&gt;NOTE: It is required that only the exchange service contract has the authority to call this function.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; __targetExchangeCallback&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;targetexchangeandspendcallback&quot;&gt;__targetExchangeAndSpendCallback&lt;&#x2F;h5&gt;
&lt;p&gt;This function is called by the intermediate exchange service contract. This function should add &lt;code&gt;_amount&lt;&#x2F;code&gt; tokens of the target contract to the exchangers address and transfer it to the &lt;code&gt;_to&lt;&#x2F;code&gt; address for the exchange and expenditure to be completed successfully.&lt;&#x2F;p&gt;
&lt;p&gt;NOTE: It is required that only the exchange service contract has the authority to call this function.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; __targetExchangeAndSpendCallback&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;events-1&quot;&gt;Events&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;exchange-1&quot;&gt;Exchange&lt;&#x2F;h5&gt;
&lt;p&gt;This event logs any new exchanges that have taken place.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Exchange&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _with&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;exchangespent-1&quot;&gt;ExchangeSpent&lt;&#x2F;h5&gt;
&lt;p&gt;This event logs any new exchange that have taken place and have been spent immediately.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ExchangeSpent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; targetContract&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;exchange-service-contract&quot;&gt;Exchange Service Contract&lt;&#x2F;h3&gt;
&lt;p&gt;This is an intermediate contract that provides a gateway for exchanges and expenditure. This contract uses oracles to get the authenticated exchange rates.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;storage-variables-2&quot;&gt;Storage Variables&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;registeredtokens&quot;&gt;registeredTokens&lt;&#x2F;h5&gt;
&lt;p&gt;This array stores all the tokens that are registered for exchange. Only register tokens can participate in exchanges.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; registeredTokens&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;methods-2&quot;&gt;Methods&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;registertoken&quot;&gt;registerToken&lt;&#x2F;h5&gt;
&lt;p&gt;This function is called by the owner of the token contract to get it’s tokens registered. It takes the address of the token as the parameter and return boolean &lt;code&gt;success&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;NOTE: Before any exchange it must be ensured that the token is registered.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; registerToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;exchangetoken-1&quot;&gt;exchangeToken&lt;&#x2F;h5&gt;
&lt;p&gt;This function is called by the token holder who wants to exchange his token with the &lt;code&gt;_targetContract&lt;&#x2F;code&gt; tokens. This function queries the exchange rate, calculates the converted amount, calls &lt;code&gt;__exchangerCallback&lt;&#x2F;code&gt; and calls the &lt;code&gt;__targetExchangeCallback&lt;&#x2F;code&gt;. It takes address of the target contract and amount to exchange as parameter and returns boolean &lt;code&gt;success&lt;&#x2F;code&gt; and amount credited.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; exchangeToken&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _targetContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; creditedAmount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;exchangeandspend-1&quot;&gt;exchangeAndSpend&lt;&#x2F;h5&gt;
&lt;p&gt;This function is called by the token holder who wants to exchange his token with the &lt;code&gt;_targetContract&lt;&#x2F;code&gt; tokens. This function queries the exchange rate, calculates the converted amount, calls &lt;code&gt;__exchangerCallback&lt;&#x2F;code&gt; and calls the &lt;code&gt;__targetExchangeAndSpendCallback&lt;&#x2F;code&gt;. It takes address of the target contract and amount to exchange as parameter and returns boolean &lt;code&gt;success&lt;&#x2F;code&gt; and amount credited.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; exchangeAndSpend&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _targetContract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;events-2&quot;&gt;Events&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;exchanges&quot;&gt;Exchanges&lt;&#x2F;h5&gt;
&lt;p&gt;This event logs any new exchanges that have taken place.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Exchange&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _by&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt; ,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _target&lt;&#x2F;span&gt;&lt;span&gt; )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;exchangeandspent&quot;&gt;ExchangeAndSpent&lt;&#x2F;h5&gt;
&lt;p&gt;This event logs any new exchange that have taken place and have been spent immediately.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ExchangeAndSpent&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _by&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt; ,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _target&lt;&#x2F;span&gt;&lt;span&gt; ,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;diagramatic-explanation&quot;&gt;Diagramatic Explanation&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;exchanging-tokens&quot;&gt;Exchanging Tokens&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;823&#x2F;.&#x2F;assets&#x2F;eip-823-token-exchange-standard-visual-representation-1.png&quot; alt=&quot;token-exchange-standard-visual-representation-1&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;NOTE: After the successful exchange the contract on right owns some tokens of the contract on the left.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;exchanging-and-spending-tokens&quot;&gt;Exchanging And Spending Tokens&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;823&#x2F;.&#x2F;assets&#x2F;eip-823-token-exchange-standard-visual-representation-2.png&quot; alt=&quot;token-exchange-standard-visual-representation-2&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;NOTE: After the successful exchange the contract on right owns some tokens of the contract on the left.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Such a design provides a consistent exchange standard
applicable to all ERC20 tokens that follow it.
The primary advantage for of this strategy is that the exchanged tokens will not be lost. They can either be spent or preserved.
Token convert face a major drawback of destroying tokens after conversion. This mechanism treats tokens like conventional currency where tokens are not destroyed but are stored.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backward-compatibility&quot;&gt;Backward Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal is fully backward compatible. Tokens extended by this proposal should also be following ERC20 standard. The functionality of ERC20 standard should not be affected by this proposal but will provide additional functionality to it.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Pseudo-introspection Registry Contract</title>
        <published>2018-01-05T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Jordi Baylina</name><email>jordi@baylina.cat</email>
	</author>
	
	<author>
		<name>Jacques Dafflon</name><email>jacques@dafflon.tech</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/820/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/820" />
        

        <id>https://wg-eips.ritovision.com/820/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:820"
            label="ERC-820" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/820/">&lt;blockquote&gt;
&lt;p&gt;:information_source: &lt;strong&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1820&#x2F;&quot;&gt;ERC-1820&lt;&#x2F;a&gt; has superseded &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;820&#x2F;&quot;&gt;ERC-820&lt;&#x2F;a&gt;.&lt;&#x2F;strong&gt; :information_source:&lt;br &#x2F;&gt;
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1820&#x2F;&quot;&gt;ERC-1820&lt;&#x2F;a&gt; fixes the incompatibility in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; logic which was introduced by the Solidty 0.5 update.&lt;br &#x2F;&gt;
Have a look at the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;820#issuecomment-464109166&quot;&gt;official announcement&lt;&#x2F;a&gt;, and the comments about the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;820#issuecomment-452465748&quot;&gt;bug&lt;&#x2F;a&gt; and the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;820#issuecomment-454021564&quot;&gt;fix&lt;&#x2F;a&gt;.&lt;br &#x2F;&gt;
Apart from this fix, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1820&#x2F;&quot;&gt;ERC-1820&lt;&#x2F;a&gt; is functionally equivalent to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;820&#x2F;&quot;&gt;ERC-820&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;:warning: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1820&#x2F;&quot;&gt;ERC-1820&lt;&#x2F;a&gt; MUST be used in lieu of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;820&#x2F;&quot;&gt;ERC-820&lt;&#x2F;a&gt;. :warning:&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;This standard defines a universal registry smart contract where any address (contract or regular account) can register which interface it supports and which smart contract is responsible for its implementation.&lt;&#x2F;p&gt;
&lt;p&gt;This standard keeps backward compatibility with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard defines a registry where smart contracts and regular accounts can publish which functionalities they implement---either directly or through a proxy contract.&lt;&#x2F;p&gt;
&lt;p&gt;Anyone can query this registry to ask if a specific address implements a given interface and which smart contract handles its implementation.&lt;&#x2F;p&gt;
&lt;p&gt;This registry MAY be deployed on any chain and shares the same address on all chains.&lt;&#x2F;p&gt;
&lt;p&gt;Interfaces with zeroes (&lt;code&gt;0&lt;&#x2F;code&gt;) as the last 28 bytes are considered &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; interfaces, and this registry SHALL forward the call to the contract to see if it implements the interface.&lt;&#x2F;p&gt;
&lt;p&gt;This contract also acts as an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; cache to reduce gas consumption.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;There have been different approaches to define pseudo-introspection in Ethereum. The first is &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; which has the limitation that it cannot be used by regular accounts. The second attempt is &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;672&quot;&gt;ERC-672&lt;&#x2F;a&gt; which uses reverse &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ens.domains&#x2F;&quot;&gt;ENS&lt;&#x2F;a&gt;. Using reverse &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ens.domains&#x2F;&quot;&gt;ENS&lt;&#x2F;a&gt; has two issues. First, it is unnecessarily complicated, and second, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ens.domains&#x2F;&quot;&gt;ENS&lt;&#x2F;a&gt; is still a centralized contract controlled by a multisig. This multisig theoretically would be able to modify the system.&lt;&#x2F;p&gt;
&lt;p&gt;This standard is much simpler than &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;672&quot;&gt;ERC-672&lt;&#x2F;a&gt;, and it is &lt;em&gt;fully&lt;&#x2F;em&gt; decentralized.&lt;&#x2F;p&gt;
&lt;p&gt;This standard also provides a &lt;em&gt;unique&lt;&#x2F;em&gt; address for all chains. Thus solving the problem of resolving the correct registry address for different chains.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;erc-820-registry-smart-contract&quot;&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;820&#x2F;&quot;&gt;ERC-820&lt;&#x2F;a&gt; Registry Smart Contract&lt;&#x2F;h3&gt;
&lt;blockquote&gt;
&lt;p&gt;This is an exact copy of the code of the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;jbaylina&#x2F;ERC820&#x2F;blob&#x2F;master&#x2F;contracts&#x2F;ERC820Registry.sol&quot;&gt;ERC820 registry smart contract&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC820 Pseudo-introspection Registry Contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * This standard defines a universal registry smart contract where any address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * (contract or regular account) can register which interface it supports and&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * which smart contract is responsible for its implementation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * Written in 2018 by Jordi Baylina and Jacques Dafflon&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * To the extent possible under law, the author(s) have dedicated all copyright&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * and related and neighboring rights to this software to the public domain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * worldwide. This software is distributed without any warranty.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * You should have received a copy of the CC0 Public Domain Dedication along&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * with this software. If not, see&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &amp;lt;https:&#x2F;&#x2F;creativecommons.org&#x2F;publicdomain&#x2F;zero&#x2F;1.0&#x2F;&amp;gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *    ███████╗██████╗  ██████╗ █████╗ ██████╗  ██████╗&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *    ██╔════╝██╔══██╗██╔════╝██╔══██╗╚════██╗██╔═████╗&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *    █████╗  ██████╔╝██║     ╚█████╔╝ █████╔╝██║██╔██║&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *    ██╔══╝  ██╔══██╗██║     ██╔══██╗██╔═══╝ ████╔╝██║&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *    ███████╗██║  ██║╚██████╗╚█████╔╝███████╗╚██████╔╝&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *    ╚══════╝╚═╝  ╚═╝ ╚═════╝ ╚════╝ ╚══════╝ ╚═════╝&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *    ██████╗ ███████╗ ██████╗ ██╗███████╗████████╗██████╗ ██╗   ██╗&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *    ██╔══██╗██╔════╝██╔════╝ ██║██╔════╝╚══██╔══╝██╔══██╗╚██╗ ██╔╝&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *    ██████╔╝█████╗  ██║  ███╗██║███████╗   ██║   ██████╔╝ ╚████╔╝&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *    ██╔══██╗██╔══╝  ██║   ██║██║╚════██║   ██║   ██╔══██╗  ╚██╔╝&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *    ██║  ██║███████╗╚██████╔╝██║███████║   ██║   ██║  ██║   ██║&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *    ╚═╝  ╚═╝╚══════╝ ╚═════╝ ╚═╝╚══════╝   ╚═╝   ╚═╝  ╚═╝   ╚═╝&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0.4.24&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; IV is value needed to have a vanity address starting with `0x820`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; IV: 9513&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The interface a contract MUST implement if it is the implementer of&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; some (other) interface for any address other than itself.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC820ImplementerInterface&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Indicates whether the contract implements the interface `interfaceHash` for the address `addr` or not.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; interfaceHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; keccak256 hash of the name of the interface&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address for which the contract will implement the interface&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ERC820_ACCEPT_MAGIC&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; only if the contract implements `interfaceHash` for the address `addr`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; canImplementInterfaceForAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC820 Pseudo-introspection Registry Contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @author&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Jordi Baylina and Jacques Dafflon&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This contract is the official implementation of the ERC820 Registry.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; For more details, see https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-820&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC820Registry&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC165 Invalid ID.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; INVALID_ID &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xffffffff&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Method ID for the ERC165 supportsInterface method (= `bytes4(keccak256(&amp;#39;supportsInterface(bytes4)&amp;#39;))`).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; ERC165ID &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x01ffc9a7&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Magic value which is returned if a contract implements an interface on behalf of some other address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; ERC820_ACCEPT_MAGIC &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;ERC820_ACCEPT_MAGIC&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; interfaces&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; managers&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; erc165Cached&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Indicates a contract is the `implementer` of `interfaceHash` for `addr`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InterfaceImplementerSet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceHash&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; implementer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Indicates `newManager` is the address of the new manager for `addr`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ManagerChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; newManager&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Query if an address implements an interface and through which contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address being queried for the implementer of an interface.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; (If `_addr == 0` then `msg.sender` is assumed.)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _interfaceHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; keccak256 hash of the name of the interface as a string.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; E.g., `web3.utils.keccak256(&amp;#39;ERC777Token&amp;#39;)`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address of the contract which implements the interface `_interfaceHash` for `_addr`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; or `0x0` if `_addr` did not register an implementer for this interface.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getInterfaceImplementer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _addr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _interfaceHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; addr &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _addr &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ?&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; :&lt;&#x2F;span&gt;&lt;span&gt; _addr&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isERC165Interface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_interfaceHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            bytes4&lt;&#x2F;span&gt;&lt;span&gt; erc165InterfaceHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes4&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_interfaceHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; implementsERC165Interface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; erc165InterfaceHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ?&lt;&#x2F;span&gt;&lt;span&gt; addr &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; interfaces&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_interfaceHash&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sets the contract which implements a specific interface for an address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Only the manager defined for that address can set it.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; (Each address is the manager for itself until it sets a new manager.)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address to define the interface for. (If `_addr == 0` then `msg.sender` is assumed.)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _interfaceHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; keccak256 hash of the name of the interface as a string.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; For example, `web3.utils.keccak256(&amp;#39;ERC777TokensRecipient&amp;#39;)` for the `ERC777TokensRecipient` interface.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _implementer&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Contract address implementing _interfaceHash for _addr.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setInterfaceImplementer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _addr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _interfaceHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _implementer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; addr &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _addr &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ?&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; :&lt;&#x2F;span&gt;&lt;span&gt; _addr&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getManager&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Not the manager&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isERC165Interface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_interfaceHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Must not be a ERC165 hash&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;_implementer &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; _implementer &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;                ERC820ImplementerInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_implementer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    .&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;canImplementInterfaceForAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_interfaceHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; ERC820_ACCEPT_MAGIC&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;                &amp;quot;Does not implement the interface&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        interfaces&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_interfaceHash&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; _implementer&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InterfaceImplementerSet&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _interfaceHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _implementer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sets the `_newManager` as manager for the `_addr` address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The new manager will be able to call `setInterfaceImplementer` for `_addr`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address for which to set the new manager.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _newManager&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the new manager for `addr`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setManager&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _addr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _newManager&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getManager&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Not the manager&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        managers&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; _newManager &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; _addr &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; :&lt;&#x2F;span&gt;&lt;span&gt; _newManager&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ManagerChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_addr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _newManager&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the manager of an address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address for which to return the manager.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Address&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; of the manager for a given address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getManager&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; By default the manager of an address is the same address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;managers&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; _addr&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; managers&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Compute the keccak256 hash of an interface given its name.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _interfaceName&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Name of the interface.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; keccak256 hash of an interface name.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; interfaceHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _interfaceName&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_interfaceName&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; --- ERC165 Related Functions --- &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; --- Developed in collaboration with William Entriken. --- &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Updates the cache with whether the contract implements an ERC165 interface or not.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the contract for which to update the cache.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _interfaceId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC165 interface for which to update the cache.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; updateERC165Cache&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        interfaces&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_contract&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_interfaceId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; implementsERC165InterfaceNoCache&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ?&lt;&#x2F;span&gt;&lt;span&gt; _contract &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        erc165Cached&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_contract&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_interfaceId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Checks whether a contract implements an ERC165 interface or not.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The result may be cached, if not a direct lookup is performed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the contract to check.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _interfaceId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC165 interface to check.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `true` if `_contract` implements `_interfaceId`, false otherwise.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; implementsERC165Interface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;erc165Cached&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_contract&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_interfaceId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; implementsERC165InterfaceNoCache&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; interfaces&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_contract&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_interfaceId&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; _contract&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Checks whether a contract implements an ERC165 interface or not without using nor updating the cache.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address of the contract to check.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _interfaceId&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC165 interface to check.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `true` if `_contract` implements `_interfaceId`, false otherwise.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; implementsERC165InterfaceNoCache&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; success&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; result&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span&gt;success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; noThrowCall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; ERC165ID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;success &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span&gt; result &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span&gt;success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; noThrowCall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; INVALID_ID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;success &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span&gt; result &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span&gt;success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; noThrowCall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;success &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; result &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Checks whether the hash is a ERC165 interface (ending with 28 zeroes) or not.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _interfaceHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The hash to check.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `true` if the hash is a ERC165 interface (ending with 28 zeroes), `false` otherwise.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isERC165Interface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _interfaceHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _interfaceHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Make a call on a contract without throwing if the function does not exist.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; noThrowCall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes4&lt;&#x2F;span&gt;&lt;span&gt; erc165ID &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; ERC165ID&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;                let&lt;&#x2F;span&gt;&lt;span&gt; x &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x40&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;               &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Find empty storage location using &amp;quot;free memory pointer&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;                mstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;x&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; erc165ID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Place signature at beginning of empty storage&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;                mstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;x&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x04&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Place first argument directly next to signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                success &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; staticcall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;                    30000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                         &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 30k gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    _contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                     &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; To addr&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    x&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                             &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Inputs are stored at location x&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;                    0x08&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                          &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Inputs are 8 bytes long&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    x&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                             &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Store output over input (saves space)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;                    0x20&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                           &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Outputs are 32 bytes long&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                result &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;x&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;                 &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Load the result&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;deployment-transaction&quot;&gt;Deployment Transaction&lt;&#x2F;h3&gt;
&lt;p&gt;Below is the raw transaction which MUST be used to deploy the smart contract on any chain.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xf90a2a8085174876e800830c35008080b909d7608060405234801561001057600080fd5b506109b7806100206000396000f30060806040526004361061008d5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166329965a1d81146100925780633d584063146100bf5780635df8122f146100fc57806365ba36c114610123578063a41e7d5114610155578063aabbb8ca14610183578063b7056765146101a7578063f712f3e8146101e9575b600080fd5b34801561009e57600080fd5b506100bd600160a060020a036004358116906024359060443516610217565b005b3480156100cb57600080fd5b506100e0600160a060020a0360043516610512565b60408051600160a060020a039092168252519081900360200190f35b34801561010857600080fd5b506100bd600160a060020a036004358116906024351661055e565b34801561012f57600080fd5b506101436004803560248101910135610655565b60408051918252519081900360200190f35b34801561016157600080fd5b506100bd600160a060020a0360043516600160e060020a0319602435166106e3565b34801561018f57600080fd5b506100e0600160a060020a036004351660243561076d565b3480156101b357600080fd5b506101d5600160a060020a0360043516600160e060020a0319602435166107e7565b604080519115158252519081900360200190f35b3480156101f557600080fd5b506101d5600160a060020a0360043516600160e060020a03196024351661089c565b6000600160a060020a0384161561022e5783610230565b335b90503361023c82610512565b600160a060020a03161461029a576040805160e560020a62461bcd02815260206004820152600f60248201527f4e6f7420746865206d616e616765720000000000000000000000000000000000604482015290519081900360640190fd5b6102a38361091c565b156102f8576040805160e560020a62461bcd02815260206004820152601960248201527f4d757374206e6f74206265206120455243313635206861736800000000000000604482015290519081900360640190fd5b600160a060020a038216158015906103195750600160a060020a0382163314155b156104a15760405160200180807f4552433832305f4143434550545f4d414749430000000000000000000000000081525060130190506040516020818303038152906040526040518082805190602001908083835b6020831061038d5780518252601f19909201916020918201910161036e565b51815160209384036101000a6000190180199092169116179052604080519290940182900382207f249cb3fa000000000000000000000000000000000000000000000000000000008352600483018a9052600160a060020a0388811660248501529451909650938816945063249cb3fa936044808401945091929091908290030181600087803b15801561042057600080fd5b505af1158015610434573d6000803e3d6000fd5b505050506040513d602081101561044a57600080fd5b5051146104a1576040805160e560020a62461bcd02815260206004820181905260248201527f446f6573206e6f7420696d706c656d656e742074686520696e74657266616365604482015290519081900360640190fd5b600160a060020a03818116600081815260208181526040808320888452909152808220805473ffffffffffffffffffffffffffffffffffffffff19169487169485179055518692917f93baa6efbd2244243bfee6ce4cfdd1d04fc4c0e9a786abd3a41313bd352db15391a450505050565b600160a060020a03808216600090815260016020526040812054909116151561053c575080610559565b50600160a060020a03808216600090815260016020526040902054165b919050565b3361056883610512565b600160a060020a0316146105c6576040805160e560020a62461bcd02815260206004820152600f60248201527f4e6f7420746865206d616e616765720000000000000000000000000000000000604482015290519081900360640190fd5b81600160a060020a031681600160a060020a0316146105e557806105e8565b60005b600160a060020a03838116600081815260016020526040808220805473ffffffffffffffffffffffffffffffffffffffff19169585169590951790945592519184169290917f605c2dbf762e5f7d60a546d42e7205dcb1b011ebc62a61736a57c9089d3a43509190a35050565b60008282604051602001808383808284378201915050925050506040516020818303038152906040526040518082805190602001908083835b602083106106ad5780518252601f19909201916020918201910161068e565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051809103902090505b92915050565b6106ed82826107e7565b6106f85760006106fa565b815b600160a060020a03928316600081815260208181526040808320600160e060020a031996909616808452958252808320805473ffffffffffffffffffffffffffffffffffffffff19169590971694909417909555908152600284528181209281529190925220805460ff19166001179055565b60008080600160a060020a038516156107865784610788565b335b91506107938461091c565b156107b85750826107a4828261089c565b6107af5760006107b1565b815b92506107df565b600160a060020a038083166000908152602081815260408083208884529091529020541692505b505092915050565b60008080610815857f01ffc9a70000000000000000000000000000000000000000000000000000000061093e565b9092509050811580610825575080155b1561083357600092506107df565b61084585600160e060020a031961093e565b909250905081158061085657508015155b1561086457600092506107df565b61086e858561093e565b90925090506001821480156108835750806001145b1561089157600192506107df565b506000949350505050565b600160a060020a0382166000908152600260209081526040808320600160e060020a03198516845290915281205460ff1615156108e4576108dd83836107e7565b90506106dd565b50600160a060020a03808316600081815260208181526040808320600160e060020a0319871684529091529020549091161492915050565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff161590565b6040517f01ffc9a7000000000000000000000000000000000000000000000000000000008082526004820183905260009182919060208160088189617530fa9051909690955093505050505600a165627a7a723058204fc4461c9d5a247b0eafe0f9c508057bc0ad72bc24668cb2a35ea65850e10d3100291ba08208208208208208208208208208208208208208208208208208208208208200a00820820820820820820820820820820820820820820820820820820820820820&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The strings of &lt;code&gt;820&lt;&#x2F;code&gt;&#x27;s at the end of the transaction are the &lt;code&gt;r&lt;&#x2F;code&gt; and &lt;code&gt;s&lt;&#x2F;code&gt; of the signature. From this deterministic pattern (generated by a human), anyone can deduce that no one knows the private key for the deployment account.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;deployment-method&quot;&gt;Deployment Method&lt;&#x2F;h3&gt;
&lt;p&gt;This contract is going to be deployed using the keyless deployment method---also known as &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;Arachnid&#x2F;&quot;&gt;Nick&lt;&#x2F;a&gt;&#x27;s method---which relies on a single-use address. (See &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;medium.com&#x2F;@weka&#x2F;how-to-send-ether-to-11-440-people-187e332566b7&quot;&gt;Nick&#x27;s article&lt;&#x2F;a&gt; for more details). This method works as follows:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Generate a transaction which deploys the contract from a new random account.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;ul&gt;
&lt;li&gt;This transaction MUST NOT use &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt; in order to work on any chain.&lt;&#x2F;li&gt;
&lt;li&gt;This transaction MUST have a relatively high gas price to be deployed on any chain. In this case, it is going to be 100 Gwei.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;ol start=&quot;2&quot;&gt;
&lt;li&gt;
&lt;p&gt;Set the &lt;code&gt;v&lt;&#x2F;code&gt;, &lt;code&gt;r&lt;&#x2F;code&gt;, &lt;code&gt;s&lt;&#x2F;code&gt; of the transaction signature to the following values:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;v: 27&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;r: 0x8208208208208208208208208208208208208208208208208208208208208200&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;s: 0x0820820820820820820820820820820820820820820820820820820820820820&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Those &lt;code&gt;r&lt;&#x2F;code&gt; and &lt;code&gt;s&lt;&#x2F;code&gt; values---made of a repeating pattern of &lt;code&gt;820&lt;&#x2F;code&gt;&#x27;s---are predictable &quot;random numbers&quot; generated deterministically by a human.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;The values of &lt;code&gt;r&lt;&#x2F;code&gt; and &lt;code&gt;s&lt;&#x2F;code&gt; must be 32 bytes long each---or 64 characters in hexadecimal. Since &lt;code&gt;820&lt;&#x2F;code&gt; is 3 characters long and 3 is not a divisor of 64, but it is a divisor of 63, the &lt;code&gt;r&lt;&#x2F;code&gt; and &lt;code&gt;s&lt;&#x2F;code&gt; values are padded with one extra character.&lt;br &#x2F;&gt;
The &lt;code&gt;s&lt;&#x2F;code&gt; value is prefixed with a single zero (&lt;code&gt;0&lt;&#x2F;code&gt;). The &lt;code&gt;0&lt;&#x2F;code&gt; prefix also guarantees that &lt;code&gt;s &amp;lt; secp256k1n ÷ 2 + 1&lt;&#x2F;code&gt;.&lt;br &#x2F;&gt;
The &lt;code&gt;r&lt;&#x2F;code&gt; value, cannot be prefixed with a zero, as the transaction becomes invalid. Instead it is suffixed with a zero (&lt;code&gt;0&lt;&#x2F;code&gt;) which still respects the condition &lt;code&gt;s &amp;lt; secp256k1n&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;We recover the sender of this transaction, i.e., the single-use deployment account.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Thus we obtain an account that can broadcast that transaction, but we also have the warranty that nobody knows the private key of that account.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Send exactly 0.08 ethers to this single-use deployment account.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Broadcast the deployment transaction.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;This operation can be done on any chain, guaranteeing that the contract address is always the same and nobody can use that address with a different contract.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;single-use-registry-deployment-account&quot;&gt;Single-use Registry Deployment Account&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xE6C244a1C10Aa0085b0cf92f04cdaD947C2988b8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This account is generated by reverse engineering it from its signature for the transaction. This way no one knows the private key, but it is known that it is the valid signer of the deployment transaction.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;To deploy the registry, 0.08 ethers MUST be sent to this account &lt;em&gt;first&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h3 id=&quot;registry-contract-address&quot;&gt;Registry Contract Address&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x820b586C8C28125366C998641B09DCbE7d4cBF06&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The contract has the address above for every chain on which it is deployed.&lt;&#x2F;p&gt;
&lt;details&gt;
&lt;summary&gt;Raw metadata of &lt;code&gt;.&#x2F;contracts&#x2F;ERC820Registry.sol&lt;&#x2F;code&gt;&lt;&#x2F;summary&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;compiler&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0.4.24+commit.e67f0147&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;language&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;output&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_interfaceHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_implementer&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;setInterfaceImplementer&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;outputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;stateMutability&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;nonpayable&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;getManager&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;outputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;stateMutability&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;view&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_newManager&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;setManager&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;outputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;stateMutability&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;nonpayable&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_interfaceName&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;interfaceHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;outputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;stateMutability&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_interfaceId&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;updateERC165Cache&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;outputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;stateMutability&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;nonpayable&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_interfaceHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;getInterfaceImplementer&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;outputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;stateMutability&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;view&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_interfaceId&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;implementsERC165InterfaceNoCache&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;outputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;stateMutability&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;view&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_interfaceId&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;implementsERC165Interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;outputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;stateMutability&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;view&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;anonymous&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;interfaceHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;implementer&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;InterfaceImplementerSet&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;anonymous&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;newManager&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ManagerChanged&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;devdoc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;author&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Jordi Baylina and Jacques Dafflon&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;methods&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;getInterfaceImplementer(address,bytes32)&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;_addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Address being queried for the implementer of an interface. (If `_addr == 0` then `msg.sender` is assumed.)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;_interfaceHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;keccak256 hash of the name of the interface as a string. E.g., `web3.utils.keccak256(&amp;#39;ERC777Token&amp;#39;)`.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The address of the contract which implements the interface `_interfaceHash` for `_addr` or `0x0` if `_addr` did not register an implementer for this interface.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;getManager(address)&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;_addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Address for which to return the manager.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Address of the manager for a given address.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;implementsERC165Interface(address,bytes4)&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;_contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Address of the contract to check.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;_interfaceId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ERC165 interface to check.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;`true` if `_contract` implements `_interfaceId`, false otherwise.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;implementsERC165InterfaceNoCache(address,bytes4)&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;_contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Address of the contract to check.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;_interfaceId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ERC165 interface to check.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;`true` if `_contract` implements `_interfaceId`, false otherwise.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;interfaceHash(string)&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;_interfaceName&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Name of the interface.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The keccak256 hash of an interface name.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;setInterfaceImplementer(address,bytes32,address)&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;_addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Address to define the interface for. (If `_addr == 0` then `msg.sender` is assumed.)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;_implementer&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Contract address implementing _interfaceHash for _addr.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;_interfaceHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;keccak256 hash of the name of the interface as a string. For example, `web3.utils.keccak256(&amp;#39;ERC777TokensRecipient&amp;#39;)` for the `ERC777TokensRecipient` interface.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;setManager(address,address)&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;_addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Address for which to set the new manager.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;_newManager&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Address of the new manager for `addr`.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;updateERC165Cache(address,bytes4)&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;_contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Address of the contract for which to update the cache.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;_interfaceId&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ERC165 interface for which to update the cache.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ERC820 Pseudo-introspection Registry Contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;userdoc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;methods&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;getInterfaceImplementer(address,bytes32)&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Query if an address implements an interface and through which contract.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;getManager(address)&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Get the manager of an address.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;implementsERC165Interface(address,bytes4)&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Checks whether a contract implements an ERC165 interface or not. The result may be cached, if not a direct lookup is performed.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;implementsERC165InterfaceNoCache(address,bytes4)&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Checks whether a contract implements an ERC165 interface or not without using nor updating the cache.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;interfaceHash(string)&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Compute the keccak256 hash of an interface given its name.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;setInterfaceImplementer(address,bytes32,address)&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Sets the contract which implements a specific interface for an address. Only the manager defined for that address can set it. (Each address is the manager for itself until it sets a new manager.)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;setManager(address,address)&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Sets the `_newManager` as manager for the `_addr` address. The new manager will be able to call `setInterfaceImplementer` for `_addr`.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;updateERC165Cache(address,bytes4)&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;          &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Updates the cache with whether the contract implements an ERC165 interface or not.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;settings&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;compilationTarget&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;.&#x2F;contracts&#x2F;ERC820Registry.sol&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ERC820Registry&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;evmVersion&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;byzantium&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;libraries&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;optimizer&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;enabled&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;runs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 200&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;remappings&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;sources&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;.&#x2F;contracts&#x2F;ERC820Registry.sol&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;content&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&#x2F;* ERC820 Pseudo-introspection Registry Contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; * This standard defines a universal registry smart contract where any address&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; * (contract or regular account) can register which interface it supports and&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; * which smart contract is responsible for its implementation.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; * Written in 2018 by Jordi Baylina and Jacques Dafflon&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; * To the extent possible under law, the author(s) have dedicated all copyright&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; * and related and neighboring rights to this software to the public domain&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; * worldwide. This software is distributed without any warranty.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; * You should have received a copy of the CC0 Public Domain Dedication along&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; * with this software. If not, see&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; * &amp;lt;https:&#x2F;&#x2F;creativecommons.org&#x2F;publicdomain&#x2F;zero&#x2F;1.0&#x2F;&amp;gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; *    ███████╗██████╗  ██████╗ █████╗ ██████╗  ██████╗&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; *    ██╔════╝██╔══██╗██╔════╝██╔══██╗╚════██╗██╔═████╗&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; *    █████╗  ██████╔╝██║     ╚█████╔╝ █████╔╝██║██╔██║&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; *    ██╔══╝  ██╔══██╗██║     ██╔══██╗██╔═══╝ ████╔╝██║&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; *    ███████╗██║  ██║╚██████╗╚█████╔╝███████╗╚██████╔╝&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; *    ╚══════╝╚═╝  ╚═╝ ╚═════╝ ╚════╝ ╚══════╝ ╚═════╝&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; *    ██████╗ ███████╗ ██████╗ ██╗███████╗████████╗██████╗ ██╗   ██╗&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; *    ██╔══██╗██╔════╝██╔════╝ ██║██╔════╝╚══██╔══╝██╔══██╗╚██╗ ██╔╝&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; *    ██████╔╝█████╗  ██║  ███╗██║███████╗   ██║   ██████╔╝ ╚████╔╝&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; *    ██╔══██╗██╔══╝  ██║   ██║██║╚════██║   ██║   ██╔══██╗  ╚██╔╝&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; *    ██║  ██║███████╗╚██████╔╝██║███████║   ██║   ██║  ██║   ██║&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; *    ╚═╝  ╚═╝╚══════╝ ╚═════╝ ╚═╝╚══════╝   ╚═╝   ╚═╝  ╚═╝   ╚═╝&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;pragma solidity 0.4.24;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&#x2F;&#x2F; IV is value needed to have a vanity address starting with `0x820`.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&#x2F;&#x2F; IV: 9513&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&#x2F;&#x2F;&#x2F; @dev The interface a contract MUST implement if it is the implementer of&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&#x2F;&#x2F;&#x2F; some (other) interface for any address other than itself.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;interface ERC820ImplementerInterface {&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @notice Indicates whether the contract implements the interface `interfaceHash` for the address `addr` or not.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @param interfaceHash keccak256 hash of the name of the interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @param addr Address for which the contract will implement the interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @return ERC820_ACCEPT_MAGIC only if the contract implements `interfaceHash` for the address `addr`.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    function canImplementInterfaceForAddress(bytes32 interfaceHash, address addr) external view returns(bytes32);&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&#x2F;&#x2F;&#x2F; @title ERC820 Pseudo-introspection Registry Contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&#x2F;&#x2F;&#x2F; @author Jordi Baylina and Jacques Dafflon&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&#x2F;&#x2F;&#x2F; @notice This contract is the official implementation of the ERC820 Registry.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&#x2F;&#x2F;&#x2F; @notice For more details, see https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-820&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;contract ERC820Registry {&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @notice ERC165 Invalid ID.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    bytes4 constant INVALID_ID = 0xffffffff;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @notice Method ID for the ERC165 supportsInterface method (= `bytes4(keccak256(&amp;#39;supportsInterface(bytes4)&amp;#39;))`).&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    bytes4 constant ERC165ID = 0x01ffc9a7;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @notice Magic value which is returned if a contract implements an interface on behalf of some other address.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    bytes32 constant ERC820_ACCEPT_MAGIC = keccak256(abi.encodePacked(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ERC820_ACCEPT_MAGIC&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;));&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    mapping (address =&amp;gt; mapping(bytes32 =&amp;gt; address)) interfaces;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    mapping (address =&amp;gt; address) managers;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    mapping (address =&amp;gt; mapping(bytes4 =&amp;gt; bool)) erc165Cached;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @notice Indicates a contract is the `implementer` of `interfaceHash` for `addr`.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    event InterfaceImplementerSet(address indexed addr, bytes32 indexed interfaceHash, address indexed implementer);&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @notice Indicates `newManager` is the address of the new manager for `addr`.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    event ManagerChanged(address indexed addr, address indexed newManager);&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @notice Query if an address implements an interface and through which contract.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @param _addr Address being queried for the implementer of an interface.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; (If `_addr == 0` then `msg.sender` is assumed.)&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @param _interfaceHash keccak256 hash of the name of the interface as a string.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; E.g., `web3.utils.keccak256(&amp;#39;ERC777Token&amp;#39;)`.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @return The address of the contract which implements the interface `_interfaceHash` for `_addr`&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; or `0x0` if `_addr` did not register an implementer for this interface.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    function getInterfaceImplementer(address _addr, bytes32 _interfaceHash) external view returns (address) {&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        address addr = _addr == 0 ? msg.sender : _addr;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        if (isERC165Interface(_interfaceHash)) {&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;            bytes4 erc165InterfaceHash = bytes4(_interfaceHash);&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;            return implementsERC165Interface(addr, erc165InterfaceHash) ? addr : 0;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        return interfaces[addr][_interfaceHash];&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    }&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @notice Sets the contract which implements a specific interface for an address.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; Only the manager defined for that address can set it.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; (Each address is the manager for itself until it sets a new manager.)&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @param _addr Address to define the interface for. (If `_addr == 0` then `msg.sender` is assumed.)&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @param _interfaceHash keccak256 hash of the name of the interface as a string.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; For example, `web3.utils.keccak256(&amp;#39;ERC777TokensRecipient&amp;#39;)` for the `ERC777TokensRecipient` interface.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @param _implementer Contract address implementing _interfaceHash for _addr.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    function setInterfaceImplementer(address _addr, bytes32 _interfaceHash, address _implementer) external {&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        address addr = _addr == 0 ? msg.sender : _addr;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        require(getManager(addr) == msg.sender, &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Not the manager&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;);&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        require(!isERC165Interface(_interfaceHash), &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Must not be a ERC165 hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;);&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        if (_implementer != 0 &amp;amp;&amp;amp; _implementer != msg.sender) {&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;            require(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;                ERC820ImplementerInterface(_implementer)&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;                    .canImplementInterfaceForAddress(_interfaceHash, addr) == ERC820_ACCEPT_MAGIC,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;                \&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Does not implement the interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;            );&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        interfaces[addr][_interfaceHash] = _implementer;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        emit InterfaceImplementerSet(addr, _interfaceHash, _implementer);&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    }&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @notice Sets the `_newManager` as manager for the `_addr` address.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; The new manager will be able to call `setInterfaceImplementer` for `_addr`.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @param _addr Address for which to set the new manager.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @param _newManager Address of the new manager for `addr`.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    function setManager(address _addr, address _newManager) external {&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        require(getManager(_addr) == msg.sender, &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Not the manager&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;);&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        managers[_addr] = _newManager == _addr ? 0 : _newManager;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        emit ManagerChanged(_addr, _newManager);&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    }&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @notice Get the manager of an address.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @param _addr Address for which to return the manager.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @return Address of the manager for a given address.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    function getManager(address _addr) public view returns(address) {&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        &#x2F;&#x2F; By default the manager of an address is the same address&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        if (managers[_addr] == 0) {&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;            return _addr;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        } else {&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;            return managers[_addr];&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    }&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @notice Compute the keccak256 hash of an interface given its name.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @param _interfaceName Name of the interface.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @return The keccak256 hash of an interface name.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    function interfaceHash(string _interfaceName) external pure returns(bytes32) {&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        return keccak256(abi.encodePacked(_interfaceName));&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    }&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;* --- ERC165 Related Functions --- *&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;* --- Developed in collaboration with William Entriken. --- *&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @notice Updates the cache with whether the contract implements an ERC165 interface or not.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @param _contract Address of the contract for which to update the cache.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @param _interfaceId ERC165 interface for which to update the cache.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    function updateERC165Cache(address _contract, bytes4 _interfaceId) external {&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        interfaces[_contract][_interfaceId] = implementsERC165InterfaceNoCache(_contract, _interfaceId) ? _contract : 0;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        erc165Cached[_contract][_interfaceId] = true;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    }&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @notice Checks whether a contract implements an ERC165 interface or not.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; The result may be cached, if not a direct lookup is performed.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @param _contract Address of the contract to check.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @param _interfaceId ERC165 interface to check.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @return `true` if `_contract` implements `_interfaceId`, false otherwise.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    function implementsERC165Interface(address _contract, bytes4 _interfaceId) public view returns (bool) {&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        if (!erc165Cached[_contract][_interfaceId]) {&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;            return implementsERC165InterfaceNoCache(_contract, _interfaceId);&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        return interfaces[_contract][_interfaceId] == _contract;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    }&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @notice Checks whether a contract implements an ERC165 interface or not without using nor updating the cache.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @param _contract Address of the contract to check.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @param _interfaceId ERC165 interface to check.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @return `true` if `_contract` implements `_interfaceId`, false otherwise.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    function implementsERC165InterfaceNoCache(address _contract, bytes4 _interfaceId) public view returns (bool) {&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        uint256 success;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        uint256 result;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        (success, result) = noThrowCall(_contract, ERC165ID);&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        if (success == 0 || result == 0) {&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;            return false;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        (success, result) = noThrowCall(_contract, INVALID_ID);&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        if (success == 0 || result != 0) {&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;            return false;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        (success, result) = noThrowCall(_contract, _interfaceId);&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        if (success == 1 &amp;amp;&amp;amp; result == 1) {&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;            return true;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        return false;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    }&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @notice Checks whether the hash is a ERC165 interface (ending with 28 zeroes) or not.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @param _interfaceHash The hash to check.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @return `true` if the hash is a ERC165 interface (ending with 28 zeroes), `false` otherwise.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    function isERC165Interface(bytes32 _interfaceHash) internal pure returns (bool) {&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        return _interfaceHash &amp;amp; 0x00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF == 0;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    }&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    &#x2F;&#x2F;&#x2F; @dev Make a call on a contract without throwing if the function does not exist.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    function noThrowCall(address _contract, bytes4 _interfaceId)&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        internal view returns (uint256 success, uint256 result)&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    {&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        bytes4 erc165ID = ERC165ID;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        assembly {&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;                let x := mload(0x40)               &#x2F;&#x2F; Find empty storage location using &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;free memory pointer&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;                mstore(x, erc165ID)                &#x2F;&#x2F; Place signature at beginning of empty storage&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;                mstore(add(x, 0x04), _interfaceId) &#x2F;&#x2F; Place first argument directly next to signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;                success := staticcall(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;                    30000,                         &#x2F;&#x2F; 30k gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;                    _contract,                     &#x2F;&#x2F; To addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;                    x,                             &#x2F;&#x2F; Inputs are stored at location x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;                    0x08,                          &#x2F;&#x2F; Inputs are 8 bytes long&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;                    x,                             &#x2F;&#x2F; Store output over input (saves space)&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;                    0x20                           &#x2F;&#x2F; Outputs are 32 bytes long&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;                )&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;                result := mload(x)                 &#x2F;&#x2F; Load the result&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;    }&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x8eecce3912a15087b3f5845d5a74af7712c93d0a8fcd6f2d40f07ed5032022ab&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;details&gt;
&lt;h3 id=&quot;interface-name&quot;&gt;Interface Name&lt;&#x2F;h3&gt;
&lt;p&gt;Any interface name is hashed using &lt;code&gt;keccak256&lt;&#x2F;code&gt; and sent to &lt;code&gt;getInterfaceImplementer()&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;If the interface is part of a standard, it is best practice to explicitly state the interface name and link to this published &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;820&#x2F;&quot;&gt;ERC-820&lt;&#x2F;a&gt; such that other people don&#x27;t have to come here to look up these rules.&lt;&#x2F;p&gt;
&lt;p&gt;For convenience, the registry provides a function to compute the hash on-chain:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; interfaceHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _interfaceName&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Compute the keccak256 hash of an interface given its name.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;small&gt;&lt;strong&gt;identifier:&lt;&#x2F;strong&gt; &lt;code&gt;65ba36c1&lt;&#x2F;code&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;strong&gt;parameters&lt;&#x2F;strong&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;_interfaceName&lt;&#x2F;code&gt;: Name of the interface.&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;strong&gt;returns:&lt;&#x2F;strong&gt; The &lt;code&gt;keccak256&lt;&#x2F;code&gt; hash of an interface name.&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h4 id=&quot;approved-ercs&quot;&gt;&lt;strong&gt;Approved ERCs&lt;&#x2F;strong&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;If the interface is part of an approved ERC, it MUST be named &lt;code&gt;ERC###XXXXX&lt;&#x2F;code&gt; where &lt;code&gt;###&lt;&#x2F;code&gt; is the number of the ERC and XXXXX should be the name of the interface in CamelCase. The meaning of this interface SHOULD be defined in the specified ERC.&lt;&#x2F;p&gt;
&lt;p&gt;Examples:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;keccak256(&quot;ERC20Token&quot;)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;keccak256(&quot;ERC777Token&quot;)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;keccak256(&quot;ERC777TokensSender&quot;)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;keccak256(&quot;ERC777TokensRecipient&quot;)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;erc-165-compatible-interfaces&quot;&gt;&lt;strong&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; Compatible Interfaces&lt;&#x2F;strong&gt;&lt;&#x2F;h4&gt;
&lt;blockquote&gt;
&lt;p&gt;The compatibility with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt;, including the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;820&#x2F;#erc165-cache&quot;&gt;ERC165 Cache&lt;&#x2F;a&gt;, has been designed and developed with &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;fulldecent&quot;&gt;William Entriken&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;Any interface where the last 28 bytes are zeroes (&lt;code&gt;0&lt;&#x2F;code&gt;) SHALL be considered an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; interface.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; Lookup&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Anyone can explicitly check if a contract implements an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; interface using the registry by calling one of the two functions below:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; implementsERC165Interface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Checks whether a contract implements an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; interface or not.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;NOTE&lt;&#x2F;em&gt;: The result is cached. If the cache is out of date, it MUST be updated by calling &lt;code&gt;updateERC165Cache&lt;&#x2F;code&gt;. (See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;820&#x2F;#erc165-cache&quot;&gt;ERC165 Cache&lt;&#x2F;a&gt; for more details.)&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;small&gt;&lt;strong&gt;identifier:&lt;&#x2F;strong&gt; &lt;code&gt;f712f3e8&lt;&#x2F;code&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;strong&gt;parameters&lt;&#x2F;strong&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;_contract&lt;&#x2F;code&gt;: Address of the contract to check.&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;_interfaceId&lt;&#x2F;code&gt;: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; interface to check.&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;strong&gt;returns:&lt;&#x2F;strong&gt; &lt;code&gt;true&lt;&#x2F;code&gt; if &lt;code&gt;_contract&lt;&#x2F;code&gt; implements &lt;code&gt;_interfaceId&lt;&#x2F;code&gt;, false otherwise.&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; implementsERC165InterfaceNoCache&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Checks whether a contract implements an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; interface or not without using nor updating the cache.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;small&gt;&lt;strong&gt;identifier:&lt;&#x2F;strong&gt; &lt;code&gt;b7056765&lt;&#x2F;code&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;strong&gt;parameters&lt;&#x2F;strong&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;_contract&lt;&#x2F;code&gt;: Address of the contract to check.&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;_interfaceId&lt;&#x2F;code&gt;: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; interface to check.&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;strong&gt;returns:&lt;&#x2F;strong&gt; &lt;code&gt;true&lt;&#x2F;code&gt; if &lt;code&gt;_contract&lt;&#x2F;code&gt; implements &lt;code&gt;_interfaceId&lt;&#x2F;code&gt;, false otherwise.&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; Cache&lt;&#x2F;strong&gt; &lt;a id=&quot;erc165-cache&quot;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Whether a contract implements an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; interface or not can be cached manually to save gas.&lt;&#x2F;p&gt;
&lt;p&gt;If a contract dynamically changes its interface and relies on the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; cache of the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;820&#x2F;&quot;&gt;ERC-820&lt;&#x2F;a&gt; registry, the cache MUST be updated manually---there is no automatic cache invalidation or cache update. Ideally the contract SHOULD automatically update the cache when changing its interface. However anyone MAY update the cache on the contract&#x27;s behalf.&lt;&#x2F;p&gt;
&lt;p&gt;The cache update MUST be done using the &lt;code&gt;updateERC165Cache&lt;&#x2F;code&gt; function:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; updateERC165Cache&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _interfaceId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;small&gt;&lt;strong&gt;identifier:&lt;&#x2F;strong&gt; &lt;code&gt;a41e7d51&lt;&#x2F;code&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;strong&gt;parameters&lt;&#x2F;strong&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;_contract&lt;&#x2F;code&gt;: Address of the contract for which to update the cache.&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;_interfaceId&lt;&#x2F;code&gt;: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; interface for which to update the cache.&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h4 id=&quot;private-user-defined-interfaces&quot;&gt;&lt;strong&gt;Private User-defined Interfaces&lt;&#x2F;strong&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;This scheme is extensible. You MAY make up your own interface name and raise awareness to get other people to implement it and then check for those implementations. Have fun but please, you MUST not conflict with the reserved designations above.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;set-an-interface-for-an-address&quot;&gt;Set An Interface For An Address&lt;&#x2F;h3&gt;
&lt;p&gt;For any address to set a contract as the interface implementation, it must call the following function of the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;820&#x2F;&quot;&gt;ERC-820&lt;&#x2F;a&gt; registry:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setInterfaceImplementer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _addr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _interfaceHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _implementer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Sets the contract which implements a specific interface for an address.&lt;&#x2F;p&gt;
&lt;p&gt;Only the &lt;code&gt;manager&lt;&#x2F;code&gt; defined for that address can set it. (Each address is the manager for itself, see the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;820&#x2F;#manager&quot;&gt;manager&lt;&#x2F;a&gt; section for more details.)&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;NOTE&lt;&#x2F;em&gt;: If  &lt;code&gt;_addr&lt;&#x2F;code&gt; and &lt;code&gt;_implementer&lt;&#x2F;code&gt; are two different addresses, then:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;_implementer&lt;&#x2F;code&gt; MUST implement the &lt;code&gt;ERC820ImplementerInterface&lt;&#x2F;code&gt; (detailed below).&lt;&#x2F;li&gt;
&lt;li&gt;Calling &lt;code&gt;canImplementInterfaceForAddress&lt;&#x2F;code&gt; on &lt;code&gt;_implementer&lt;&#x2F;code&gt; with the given &lt;code&gt;_addr&lt;&#x2F;code&gt; and  &lt;code&gt;_interfaceHash&lt;&#x2F;code&gt; MUST return the &lt;code&gt;ERC820_ACCEPT_MAGIC&lt;&#x2F;code&gt; value.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;NOTE&lt;&#x2F;em&gt;: The &lt;code&gt;_interfaceHash&lt;&#x2F;code&gt; MUST NOT be an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; interface---it MUST NOT end with 28 zeroes (&lt;code&gt;0&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;NOTE&lt;&#x2F;em&gt;: The &lt;code&gt;_addr&lt;&#x2F;code&gt; MAY be &lt;code&gt;0&lt;&#x2F;code&gt;, then &lt;code&gt;msg.sender&lt;&#x2F;code&gt; is assumed. This default value simplifies interactions via multisigs where the data of the transaction to sign is constant regardless of the address of the multisig instance.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;small&gt;&lt;strong&gt;identifier:&lt;&#x2F;strong&gt; &lt;code&gt;29965a1d&lt;&#x2F;code&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;strong&gt;parameters&lt;&#x2F;strong&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;_addr&lt;&#x2F;code&gt;: Address to define the interface for (if &lt;code&gt;_addr == 0&lt;&#x2F;code&gt; them &lt;code&gt;msg.sender&lt;&#x2F;code&gt;: is assumed)&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;_interfaceHash&lt;&#x2F;code&gt;: &lt;code&gt;keccak256&lt;&#x2F;code&gt; hash of the name of the interface as a string, for example &lt;code&gt;web3.utils.keccak256(&#x27;ERC777TokensRecipient&#x27;)&lt;&#x2F;code&gt; for the ERC777TokensRecipient interface.&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;_implementer&lt;&#x2F;code&gt;: Contract implementing &lt;code&gt;_interfaceHash&lt;&#x2F;code&gt; for &lt;code&gt;_addr&lt;&#x2F;code&gt;.&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h3 id=&quot;get-an-implementation-of-an-interface-for-an-address&quot;&gt;Get An Implementation Of An Interface For An Address&lt;&#x2F;h3&gt;
&lt;p&gt;Anyone MAY query the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;820&#x2F;&quot;&gt;ERC-820&lt;&#x2F;a&gt; Registry to obtain the address of a contract implementing an interface on behalf of some address using the &lt;code&gt;getInterfaceImplementer&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getInterfaceImplementer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _addr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _interfaceHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Query if an address implements an interface and through which contract.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;NOTE&lt;&#x2F;em&gt;: If the last 28 bytes of the &lt;code&gt;_interfaceHash&lt;&#x2F;code&gt; are zeroes (&lt;code&gt;0&lt;&#x2F;code&gt;), then the first 4 bytes are considered an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; interface and the registry SHALL forward the call to the contract at &lt;code&gt;_addr&lt;&#x2F;code&gt; to see if it implements the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; interface (the first 4 bytes of &lt;code&gt;_interfaceHash&lt;&#x2F;code&gt;). The registry SHALL also cache &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; queries to reduce gas consumption. Anyone MAY call the &lt;code&gt;erc165UpdateCache&lt;&#x2F;code&gt; function to update whether a contract implements an interface or not.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;NOTE&lt;&#x2F;em&gt;: The &lt;code&gt;_addr&lt;&#x2F;code&gt; MAY be &lt;code&gt;0&lt;&#x2F;code&gt;, then &lt;code&gt;msg.sender&lt;&#x2F;code&gt; is assumed. This default value is consistent with the behavior of the &lt;code&gt;setInterfaceImplementer&lt;&#x2F;code&gt; function and simplifies interactions via multisigs where the data of the transaction to sign is constant regardless of the address of the multisig instance.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;small&gt;&lt;strong&gt;identifier:&lt;&#x2F;strong&gt; &lt;code&gt;aabbb8ca&lt;&#x2F;code&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;strong&gt;parameters&lt;&#x2F;strong&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;_addr&lt;&#x2F;code&gt;: Address being queried for the implementer of an interface. (If &lt;code&gt;_addr == 0&lt;&#x2F;code&gt; them &lt;code&gt;msg.sender&lt;&#x2F;code&gt; is assumed.)&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;_interfaceHash&lt;&#x2F;code&gt;: keccak256 hash of the name of the interface as a string. E.g. &lt;code&gt;web3.utils.keccak256(&#x27;ERC777Token&#x27;)&lt;&#x2F;code&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;strong&gt;returns:&lt;&#x2F;strong&gt; The address of the contract which implements the interface &lt;code&gt;_interfaceHash&lt;&#x2F;code&gt; for &lt;code&gt;_addr&lt;&#x2F;code&gt; or &lt;code&gt;0x0&lt;&#x2F;code&gt; if &lt;code&gt;_addr&lt;&#x2F;code&gt; did not register an implementer for this interface.&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h3 id=&quot;interface-implementation-erc820implementerinterface&quot;&gt;Interface Implementation (&lt;code&gt;ERC820ImplementerInterface&lt;&#x2F;code&gt;)&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC820ImplementerInterface&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Indicates whether the contract implements the interface `interfaceHash` for the address `addr`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Address for which the contract will implement the interface&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; interfaceHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; keccak256 hash of the name of the interface&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ERC820_ACCEPT_MAGIC&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; only if the contract implements `ìnterfaceHash` for the address `addr`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; canImplementInterfaceForAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Any contract being registered as the implementation of an interface for a given address MUST implement said interface. In addition if it implements an interface on behalf of a different address, the contract MUST implement the &lt;code&gt;ERC820ImplementerInterface&lt;&#x2F;code&gt; shown above.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; canImplementInterfaceForAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceHash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Indicates whether a contract implements an interface (&lt;code&gt;interfaceHash&lt;&#x2F;code&gt;) for a given address (&lt;code&gt;addr&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;If a contract implements the interface (&lt;code&gt;interfaceHash&lt;&#x2F;code&gt;) for a given address (&lt;code&gt;addr&lt;&#x2F;code&gt;), it MUST return &lt;code&gt;ERC820_ACCEPT_MAGIC&lt;&#x2F;code&gt; when called with the &lt;code&gt;addr&lt;&#x2F;code&gt; and the &lt;code&gt;interfaceHash&lt;&#x2F;code&gt;. If it does not implement the &lt;code&gt;interfaceHash&lt;&#x2F;code&gt; for a given address (&lt;code&gt;addr&lt;&#x2F;code&gt;), it MUST NOT return &lt;code&gt;ERC820_ACCEPT_MAGIC&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;small&gt;&lt;strong&gt;identifier:&lt;&#x2F;strong&gt; &lt;code&gt;f0083250&lt;&#x2F;code&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;strong&gt;parameters&lt;&#x2F;strong&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;interfaceHash&lt;&#x2F;code&gt;: Hash of the interface which is implemented&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;addr&lt;&#x2F;code&gt;: Address for which the interface is implemented&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;strong&gt;returns:&lt;&#x2F;strong&gt; &lt;code&gt;ERC820_ACCEPT_MAGIC&lt;&#x2F;code&gt; only if the contract implements &lt;code&gt;ìnterfaceHash&lt;&#x2F;code&gt; for the address &lt;code&gt;addr&lt;&#x2F;code&gt;.&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;The special value &lt;code&gt;ERC820_ACCEPT_MAGIC&lt;&#x2F;code&gt; is defined as the &lt;code&gt;keccka256&lt;&#x2F;code&gt; hash of the string &lt;code&gt;&quot;ERC820_ACCEPT_MAGIC&quot;&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; ERC820_ACCEPT_MAGIC &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;ERC820_ACCEPT_MAGIC&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;blockquote&gt;
&lt;p&gt;The reason to return &lt;code&gt;ERC820_ACCEPT_MAGIC&lt;&#x2F;code&gt; instead of a boolean is to prevent cases where a contract fails to implement the &lt;code&gt;canImplementInterfaceForAddress&lt;&#x2F;code&gt; but implements a fallback function which does not throw. In this case, since &lt;code&gt;canImplementInterfaceForAddress&lt;&#x2F;code&gt; does not exist, the fallback function is called instead, executed without throwing and returns &lt;code&gt;1&lt;&#x2F;code&gt;. Thus making it appear as if &lt;code&gt;canImplementInterfaceForAddress&lt;&#x2F;code&gt; returned &lt;code&gt;true&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h3 id=&quot;manager&quot;&gt;Manager&lt;&#x2F;h3&gt;
&lt;p&gt;The manager of an address (regular account or a contract) is the only entity allowed to register implementations of interfaces for the address. By default, any address is its own manager.&lt;&#x2F;p&gt;
&lt;p&gt;The manager can transfer its role to another address by calling &lt;code&gt;setManager&lt;&#x2F;code&gt; on the registry contract with the address for which to transfer the manager and the address of the new manager.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;setManager&lt;&#x2F;code&gt; Function&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setManager&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _addr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _newManager&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Sets the &lt;code&gt;_newManager&lt;&#x2F;code&gt; as manager for the &lt;code&gt;_addr&lt;&#x2F;code&gt; address.&lt;&#x2F;p&gt;
&lt;p&gt;The new manager will be able to call &lt;code&gt;setInterfaceImplementer&lt;&#x2F;code&gt; for &lt;code&gt;_addr&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;If &lt;code&gt;_newManager&lt;&#x2F;code&gt; is &lt;code&gt;0x0&lt;&#x2F;code&gt;, the manager is reset to &lt;code&gt;_addr&lt;&#x2F;code&gt; itself as the manager.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;small&gt;&lt;strong&gt;identifier:&lt;&#x2F;strong&gt; &lt;code&gt;5df8122f&lt;&#x2F;code&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;strong&gt;parameters&lt;&#x2F;strong&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;_addr&lt;&#x2F;code&gt;: Address for which to set the new manager.&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;_newManager&lt;&#x2F;code&gt;: The address of the new manager for &lt;code&gt;_addr&lt;&#x2F;code&gt;. (Pass &lt;code&gt;0x0&lt;&#x2F;code&gt; to reset the manager to &lt;code&gt;_addr&lt;&#x2F;code&gt;.)&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;getManager&lt;&#x2F;code&gt; Function&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getManager&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Get the manager of an address.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;small&gt;&lt;strong&gt;identifier:&lt;&#x2F;strong&gt; &lt;code&gt;3d584063&lt;&#x2F;code&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;strong&gt;parameters&lt;&#x2F;strong&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;_addr&lt;&#x2F;code&gt;: Address for which to return the manager.&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;strong&gt;returns:&lt;&#x2F;strong&gt; Address of the manager for a given address.&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This standards offers a way for any type of address (externally owned and contracts) to implement an interface and potentially delegate the implementation of the interface to a proxy contract. This delegation to a proxy contract is necessary for externally owned accounts and useful to avoid redeploying existing contracts such as multisigs and DAOs.&lt;&#x2F;p&gt;
&lt;p&gt;The registry can also act as a &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; cache in order to save gas when looking up if a contract implements a specific &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; interface. This cache is intentionally kept simple, without automatic cache update or invalidation. Anyone can easily and safely update the cache for any interface and any contract by calling the &lt;code&gt;updateERC165Cache&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;p&gt;The registry is deployed using a keyless deployment method relying on a single-use deployment address to ensure no one controls the registry, thereby ensuring trust.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backward-compatibility&quot;&gt;Backward Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This standard is backward compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt;, as both methods MAY be implemented without conflicting with each other.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Please check the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;jbaylina&#x2F;ERC820&quot;&gt;jbaylina&#x2F;ERC820&lt;&#x2F;a&gt; repository for the full test suite.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The implementation is available in the repo: &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;jbaylina&#x2F;ERC820&quot;&gt;jbaylina&#x2F;ERC820&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Generalized Account Versioning Scheme</title>
        <published>2017-12-30T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Wei Tang</name><uri>https://github.com/sorpaas</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1702/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/sorpaas/EIPs/issues/2" />
        

        <id>https://wg-eips.ritovision.com/1702/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:1702"
            label="EIP-1702" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1702/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce account versioning for smart contracts so upgrading the VM
or introducing new VMs can be easier.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This defines a method of hard forking while maintaining the exact
functionality of existing account by allowing multiple versions of the
virtual machines to execute in the same block. This is also useful to
define future account state structures when we introduce the on-chain
WebAssembly virtual machine.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;By allowing account versioning, we can execute different virtual
machine for contracts created at different times. This allows breaking
features to be implemented while making sure existing contracts work
as expected.&lt;&#x2F;p&gt;
&lt;p&gt;Note that this specification might not apply to all hard forks. We
have emergency hard forks in the past due to network attacks. Whether
they should maintain existing account compatibility should be
evaluated in individual basis. If the attack can only be executed once
against some particular contracts, then the scheme defined here might
still be applicable. Otherwise, having a plain emergency hard fork
might still be a good idea.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;account-state&quot;&gt;Account State&lt;&#x2F;h3&gt;
&lt;p&gt;Re-define account state stored in the world state trie to have 5
items: &lt;code&gt;nonce&lt;&#x2F;code&gt;, &lt;code&gt;balance&lt;&#x2F;code&gt;, &lt;code&gt;storageRoot&lt;&#x2F;code&gt;, &lt;code&gt;codeHash&lt;&#x2F;code&gt;, and
&lt;code&gt;version&lt;&#x2F;code&gt;. The newly added field &lt;code&gt;version&lt;&#x2F;code&gt; is a 256-bit &lt;strong&gt;scalar&lt;&#x2F;strong&gt;. We
use the definition of &quot;scalar&quot; from Yellow Paper. Note that this is
the same type as &lt;code&gt;nonce&lt;&#x2F;code&gt; and &lt;code&gt;balance&lt;&#x2F;code&gt;, and it is equivalent to a RLP
variable-sized byte array with no leading zero, of maximum length 32.&lt;&#x2F;p&gt;
&lt;p&gt;When &lt;code&gt;version&lt;&#x2F;code&gt; is zero, the account is RLP-encoded with the first 4
items. When &lt;code&gt;version&lt;&#x2F;code&gt; is not zero, the account is RLP-encoded with 5
items.&lt;&#x2F;p&gt;
&lt;p&gt;Account versions can also optionally define additional account state
RLP fields, whose meaning are specified through its &lt;code&gt;version&lt;&#x2F;code&gt;
field. In those cases, the parsing strategy is defined in &quot;Additional
Fields in Account State RLP&quot; section.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;contract-execution&quot;&gt;Contract Execution&lt;&#x2F;h3&gt;
&lt;p&gt;When fetching an account code from state, we always fetch the
associated version field together. We refer to this as the &lt;em&gt;code&#x27;s
version&lt;&#x2F;em&gt; below. The code of the account is always executed in the
&lt;em&gt;code&#x27;s version&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;In particular, this means that for &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; and &lt;code&gt;CALLCODE&lt;&#x2F;code&gt;, the
version of the execution call frame is the same as
delegating&#x2F;receiving contract&#x27;s version.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;contract-deployment&quot;&gt;Contract Deployment&lt;&#x2F;h3&gt;
&lt;p&gt;In Ethereum, a contract has a deployment method, either by a contract
creation transaction, or by another contract. If we regard this
deployment method a contract&#x27;s &lt;em&gt;parent&lt;&#x2F;em&gt;, then we find them forming a
family of contracts, with the &lt;em&gt;root&lt;&#x2F;em&gt; being a contract creation
transaction.&lt;&#x2F;p&gt;
&lt;p&gt;We let a family of contracts to always have the same &lt;code&gt;version&lt;&#x2F;code&gt;. That
is, &lt;code&gt;CREATE&lt;&#x2F;code&gt; and &lt;code&gt;CREATE2&lt;&#x2F;code&gt; will always deploy contract that has the
same &lt;code&gt;version&lt;&#x2F;code&gt; as the &lt;em&gt;code&#x27;s version&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;In other words, &lt;code&gt;CREATE&lt;&#x2F;code&gt; and &lt;code&gt;CREATE2&lt;&#x2F;code&gt; will execute the init code
using the current &lt;em&gt;code&#x27;s version&lt;&#x2F;em&gt;, and deploy the contract of the
current &lt;em&gt;code&#x27;s version&lt;&#x2F;em&gt;. This holds even if the to-be-deployed code
is empty.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;validation&quot;&gt;Validation&lt;&#x2F;h3&gt;
&lt;p&gt;A new phrase, &lt;em&gt;validation&lt;&#x2F;em&gt; is added to contract deployment (by
&lt;code&gt;CREATE&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;CREATE2&lt;&#x2F;code&gt; opcodes, or by contract creation
transaction). When &lt;code&gt;version&lt;&#x2F;code&gt; is &lt;code&gt;0&lt;&#x2F;code&gt;, the phrase does nothing and
always succeeds. Future VM versions can define additional validation
that has to be passed.&lt;&#x2F;p&gt;
&lt;p&gt;If the validation phrase fails, deployment does not proceed and return
out-of-gas.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;contract-creation-transaction&quot;&gt;Contract Creation Transaction&lt;&#x2F;h3&gt;
&lt;p&gt;Define &lt;code&gt;LATEST_VERSION&lt;&#x2F;code&gt; in a hard fork to be the latest supported VM
version. A contract creation transaction is always executed in
&lt;code&gt;LATEST_VERSION&lt;&#x2F;code&gt; (which means the &lt;em&gt;code&#x27;s version&lt;&#x2F;em&gt; is
&lt;code&gt;LATEST_VERSION&lt;&#x2F;code&gt;), and deploys contracts of &lt;code&gt;LATEST_VERSION&lt;&#x2F;code&gt;. Before a
contract creation transaction is executed, run &lt;em&gt;validation&lt;&#x2F;em&gt; on the
contract creation code. If it does not pass, return out-of-gas.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;precompiled-contract-and-externally-owned-address&quot;&gt;Precompiled Contract and Externally-owned Address&lt;&#x2F;h3&gt;
&lt;p&gt;Precompiled contracts and externally-owned addresses do not have
&lt;code&gt;version&lt;&#x2F;code&gt;. If a message-call transaction or &lt;code&gt;CALL&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;CALLCODE&lt;&#x2F;code&gt; &#x2F;
&lt;code&gt;STATICCALL&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; touches a new externally-owned address
or a non-existing precompiled contract address, it is always created
with &lt;code&gt;version&lt;&#x2F;code&gt; field being &lt;code&gt;0&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;additional-fields-in-account-state-rlp&quot;&gt;Additional Fields in Account State RLP&lt;&#x2F;h3&gt;
&lt;p&gt;In the future we may need to associate more information into an
account, and we already have some EIPs that define new additional
fields in the account state RLP. In this section, we define the
parsing strategy when additional fields are added.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Check the RLP list length, if it is 4, then set account version to
&lt;code&gt;0&lt;&#x2F;code&gt;, and do not parse any additional fields.&lt;&#x2F;li&gt;
&lt;li&gt;If the RLP list length more than 4, set the account version to the
scalar at position &lt;code&gt;4&lt;&#x2F;code&gt; (counting from &lt;code&gt;0&lt;&#x2F;code&gt;).
&lt;ul&gt;
&lt;li&gt;Check version specification for the number of additional fields
defined &lt;code&gt;N&lt;&#x2F;code&gt;, if the RLP list length is not equal to &lt;code&gt;5 + N&lt;&#x2F;code&gt;,
return parse error.&lt;&#x2F;li&gt;
&lt;li&gt;Parse RLP position &lt;code&gt;5&lt;&#x2F;code&gt; to &lt;code&gt;4 + N&lt;&#x2F;code&gt; as the meaning specified in
additional fields.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;extensions&quot;&gt;Extensions&lt;&#x2F;h2&gt;
&lt;p&gt;In relation to the above &quot;Specification&quot; section, we have defined the
base account versioning layer. The base account versioning layer is
already useful by itself and can handle most EVM improvements. Below
we define two specifications that can be deployed separately, which
improves functionality of base layer account versioning.&lt;&#x2F;p&gt;
&lt;p&gt;Note that this section is provided only for documentation
purpose. When &quot;enabling EIP-1702&quot;, those extensions should not be
enabled unless the extension specification is also included.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;corepaper.org&#x2F;ethereum&#x2F;compatibility&#x2F;versioning&#x2F;#extensions-for-state-based-account-versioning&quot;&gt;44-VERTXN: Account Versioning Extension for Contract Creation
Transaction&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;corepaper.org&#x2F;ethereum&#x2F;compatibility&#x2F;versioning&#x2F;#create-and-create2-extension&quot;&gt;45-VEROP: Account Versioning Extension for CREATE and
CREATE2&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;usage-template&quot;&gt;Usage Template&lt;&#x2F;h2&gt;
&lt;p&gt;This section defines how other EIPs might use this account
versioning specification. Note that currently we only define the usage
template for base layer.&lt;&#x2F;p&gt;
&lt;p&gt;Account versioning is usually applied directly to a hard fork
meta. EIPs in the hard fork are grouped by the virtual machine
type, for example, EVM and eWASM. For each of them, we define:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Version&lt;&#x2F;strong&gt;: a non-zero scalar less than &lt;code&gt;2^256&lt;&#x2F;code&gt; that uniquely
identifies this version. Note that it does not need to be
sequential.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Parent version&lt;&#x2F;strong&gt;: the base that all new features derived
from. With parent version of &lt;code&gt;0&lt;&#x2F;code&gt; we define the base to be legacy
VM. Note that once a version other than &lt;code&gt;0&lt;&#x2F;code&gt; is defined, the legacy
VM&#x27;s feature set must be frozen. When defining an entirely new VM
(such as eWASM), parent version does not apply.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Features&lt;&#x2F;strong&gt;: all additional features that are enabled upon this
version.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;If a meta EIP includes EIPs that provide additional account state RLP
fields, we also define:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Account fields&lt;&#x2F;strong&gt;: all account fields up to the end of this meta
EIP, excluding the basic 5 fields (&lt;code&gt;nonce&lt;&#x2F;code&gt;, &lt;code&gt;balance&lt;&#x2F;code&gt;,
&lt;code&gt;storageRoot&lt;&#x2F;code&gt;, &lt;code&gt;codeHash&lt;&#x2F;code&gt; and &lt;code&gt;version&lt;&#x2F;code&gt;). If EIPs included that are
specific to modifying account fields do not modify VM execution
logic, it is recommended that we specify an additional version whose
execution logic is the same as previous version, but only the
account fields are changed.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This introduces account versioning via a new RLP item in account
state. The design above gets account versioning by making the contract
&lt;em&gt;family&lt;&#x2F;em&gt; always have the same version. In this way, versions are only
needed to be provided by contract creation transaction, and there is
no restrictions on formats of code for any version. If we want to
support multiple newest VMs (for example, EVM and WebAssembly running
together), then this will requires extensions such as 44-VERTXN and
45-VEROP.&lt;&#x2F;p&gt;
&lt;p&gt;Alternatively, account versioning can also be done through:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;corepaper.org&#x2F;ethereum&#x2F;compatibility&#x2F;versioning&#x2F;#prefix-based-account-versioning&quot;&gt;26-VER&lt;&#x2F;a&gt;&lt;&#x2F;strong&gt; and
&lt;strong&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;corepaper.org&#x2F;ethereum&#x2F;compatibility&#x2F;forward&#x2F;&quot;&gt;40-UNUSED&lt;&#x2F;a&gt;&lt;&#x2F;strong&gt;: This makes an
account&#x27;s versioning solely dependent on its code header prefix. If
with only 26-VER, it is not possible to certify any code is valid,
because current VM allows treating code as data. This can be fixed
by 40-UNUSED, but the drawback is that it&#x27;s potentially backward
incompatible.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;EIP-1891&lt;&#x2F;strong&gt;: Instead of writing version field into account RLP
state, we write it in a separate contract. This can accomplish the
same thing as this EIP and potentially reduces code complexity, but
the drawback is that every code execution will require an additional
trie traversal, which impacts performance.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Account versioning is fully backwards compatible, and it does not
change how current contracts are executed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;discussions&quot;&gt;Discussions&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;performance&quot;&gt;Performance&lt;&#x2F;h3&gt;
&lt;p&gt;Currently nearly all full node implementations uses config parameters
to decide which virtual machine version to use. Switching virtual
machine version is simply an operation that changes a pointer using a
different set of config parameters. As a result, this scheme has
nearly zero impact to performance.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;webassembly&quot;&gt;WebAssembly&lt;&#x2F;h3&gt;
&lt;p&gt;This scheme can also be helpful when we deploy on-chain WebAssembly
virtual machine. In that case, WASM contracts and EVM contracts can
co-exist and the execution boundary and interaction model are clearly
defined as above.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases-and-implementations&quot;&gt;Test Cases and Implementations&lt;&#x2F;h2&gt;
&lt;p&gt;To be added.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;&#x2F;h2&gt;
&lt;p&gt;The source of this specification can be found at
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;corepaper.org&#x2F;ethereum&#x2F;compatibility&#x2F;versioning&#x2F;#state-based-account-versioning&quot;&gt;43-VER&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Canary Standard</title>
        <published>2017-12-16T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>ligi</name><email>ligi@ligi.de</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/801/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/801/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:801"
            label="ERC-801" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/801/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;A standard interface for canary contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The following standard allows the implementation of canaries within contracts.
This standard provides basic functionality to check if a canary is alive, keeping the canary alive and optionally manage feeders.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The canary can e.g. be used as a &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Warrant_canary&quot;&gt;warrant canary&lt;&#x2F;a&gt;.
A standard interface allows other applications to easily interface with canaries on Ethereum - e.g. for visualizing the state, automated alarms, applications to feed the canary or contracts (e.g. insurance) that use the state.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;methods&quot;&gt;Methods&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;isalive&quot;&gt;isAlive()&lt;&#x2F;h4&gt;
&lt;p&gt;Returns if the canary was fed properly to signal e.g. that no warrant was received.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isAlive&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; alive&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;getblockofdeath&quot;&gt;getBlockOfDeath()&lt;&#x2F;h4&gt;
&lt;p&gt;Returns the block the canary died.
Throws if the canary is alive.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getBlockOfDeath&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;gettype&quot;&gt;getType()&lt;&#x2F;h4&gt;
&lt;p&gt;Returns the type of the canary:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;1&lt;&#x2F;code&gt; = Simple (just the pure interface as defined in this ERC)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;2&lt;&#x2F;code&gt; = Single feeder (as defined in ERC-TBD)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;3&lt;&#x2F;code&gt; = Single feeder with bad food (as defined in ERC-TBD)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;4&lt;&#x2F;code&gt; = Multiple feeders (as defined in ERC-TBD)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;5&lt;&#x2F;code&gt; = Multiple mandatory feeders (as defined in ERC-TBD)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;6&lt;&#x2F;code&gt; = IOT (as defined in ERC-TBD)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;code&gt;1&lt;&#x2F;code&gt; might also be used for a special purpose contract that does not need a special type but still wants to expose the functions and provide events as defined in this ERC.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getType&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;events&quot;&gt;Events&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;rip&quot;&gt;RIP&lt;&#x2F;h4&gt;
&lt;p&gt;MUST trigger when the contract is called the first time after the canary died.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RIP&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TODO&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Ethereum Node Records (ENR)</title>
        <published>2017-11-23T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Felix Lange</name><email>fjl@ethereum.org</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/778/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/devp2p/issues/43" />
        

        <id>https://wg-eips.ritovision.com/778/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="networking"
                label="Networking" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:778"
            label="EIP-778" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/778/">&lt;h1 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h1&gt;
&lt;p&gt;This EIP defines Ethereum Node Records, an open format for p2p connectivity information.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h1&gt;
&lt;p&gt;Ethereum nodes discover each other through the node discovery protocol. The purpose of
that protocol is relaying node identity public keys (on the secp256k1 curve), their IP
address and two port numbers. No other information can be relayed.&lt;&#x2F;p&gt;
&lt;p&gt;This specification seeks to lift the restrictions of the discovery v4 protocol by defining
a flexible format, the &lt;em&gt;node record&lt;&#x2F;em&gt;, for connectivity-related information. Node records
can be relayed through a future version of the node discovery protocol. They can also be
relayed through arbitrary other mechanisms such as DNS, ENS, a devp2p subprotocol, etc.&lt;&#x2F;p&gt;
&lt;p&gt;Node records improve cryptographic agility and handling of protocol upgrades. A record can
contain information about arbitrary transport protocols and public key material associated
with them.&lt;&#x2F;p&gt;
&lt;p&gt;Another goal of the new format is to provide authoritative updates of connectivity
information. If a node changes its endpoint and publishes a new record, other nodes should
be able to determine which record is newer.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h1&gt;
&lt;p&gt;The components of a node record are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;signature&lt;&#x2F;code&gt;: cryptographic signature of record contents&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;seq&lt;&#x2F;code&gt;: The sequence number, a 64-bit unsigned integer. Nodes should increase the number
whenever the record changes and republish the record.&lt;&#x2F;li&gt;
&lt;li&gt;The remainder of the record consists of arbitrary key&#x2F;value pairs&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;A record&#x27;s signature is made and validated according to an &lt;em&gt;identity scheme&lt;&#x2F;em&gt;. The identity
scheme is also responsible for deriving a node&#x27;s address in the DHT.&lt;&#x2F;p&gt;
&lt;p&gt;The key&#x2F;value pairs must be sorted by key and must be unique, i.e. any key may be present
only once. The keys can technically be any byte sequence, but ASCII text is preferred. Key
names in the table below have pre-defined meaning.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&quot;text-align: left&quot;&gt;Key&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: left&quot;&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;id&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;name of identity scheme, e.g. &quot;v4&quot;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;secp256k1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;compressed secp256k1 public key, 33 bytes&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;ip&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;IPv4 address, 4 bytes&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;tcp&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;TCP port, big endian integer&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;udp&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;UDP port, big endian integer&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;ip6&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;IPv6 address, 16 bytes&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;tcp6&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;IPv6-specific TCP port, big endian integer&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;udp6&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;IPv6-specific UDP port, big endian integer&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;All keys except &lt;code&gt;id&lt;&#x2F;code&gt; are optional, including IP addresses and ports. A record without
endpoint information is still valid as long as its signature is valid. If no &lt;code&gt;tcp6&lt;&#x2F;code&gt; &#x2F;
&lt;code&gt;udp6&lt;&#x2F;code&gt; port is provided, the &lt;code&gt;tcp&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;udp&lt;&#x2F;code&gt; port applies to both IP addresses. Declaring
the same port number in both &lt;code&gt;tcp&lt;&#x2F;code&gt;, &lt;code&gt;tcp6&lt;&#x2F;code&gt; or &lt;code&gt;udp&lt;&#x2F;code&gt;, &lt;code&gt;udp6&lt;&#x2F;code&gt; should be avoided but doesn&#x27;t
render the record invalid.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;rlp-encoding&quot;&gt;RLP Encoding&lt;&#x2F;h3&gt;
&lt;p&gt;The canonical encoding of a node record is an RLP list of &lt;code&gt;[signature, seq, k, v, ...]&lt;&#x2F;code&gt;.
The maximum encoded size of a node record is 300 bytes. Implementations should reject
records larger than this size.&lt;&#x2F;p&gt;
&lt;p&gt;Records are signed and encoded as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;content   = [seq, k, v, ...]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;signature = sign(content)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;record    = [signature, seq, k, v, ...]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;text-encoding&quot;&gt;Text Encoding&lt;&#x2F;h3&gt;
&lt;p&gt;The textual form of a node record is the base64 encoding of its RLP representation,
prefixed by &lt;code&gt;enr:&lt;&#x2F;code&gt;. Implementations should use the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;tools.ietf.org&#x2F;html&#x2F;rfc4648#section-5&quot;&gt;URL-safe base64 alphabet&lt;&#x2F;a&gt;
and omit padding characters.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;v4-identity-scheme&quot;&gt;&quot;v4&quot; Identity Scheme&lt;&#x2F;h3&gt;
&lt;p&gt;This specification defines a single identity scheme to be used as the default until other
schemes are defined by further EIPs. The &quot;v4&quot; scheme is backwards-compatible with the
cryptosystem used by Node Discovery v4.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;To sign record &lt;code&gt;content&lt;&#x2F;code&gt; with this scheme, apply the keccak256 hash function (as used by
the EVM) to &lt;code&gt;content&lt;&#x2F;code&gt;, then create a signature of the hash. The resulting 64-byte
signature is encoded as the concatenation of the &lt;code&gt;r&lt;&#x2F;code&gt; and &lt;code&gt;s&lt;&#x2F;code&gt; signature values (the
recovery ID &lt;code&gt;v&lt;&#x2F;code&gt; is omitted).&lt;&#x2F;li&gt;
&lt;li&gt;To verify a record, check that the signature was made by the public key in the
&quot;secp256k1&quot; key&#x2F;value pair of the record.&lt;&#x2F;li&gt;
&lt;li&gt;To derive a node address, take the keccak256 hash of the uncompressed public key.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h1 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h1&gt;
&lt;p&gt;The format is meant to suit future needs in two ways:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Adding new key&#x2F;value pairs: This is always possible and doesn&#x27;t require implementation
consensus. Existing clients will accept any key&#x2F;value pairs regardless of whether they
can interpret their content.&lt;&#x2F;li&gt;
&lt;li&gt;Adding identity schemes: these need implementation consensus because the network won&#x27;t
accept the signature otherwise. To introduce a new identity scheme, propose an EIP and
get it implemented. The scheme can be used as soon as most clients accept it.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The size of a record is limited because records are relayed frequently and may be included
in size-constrained protocols such as DNS. A record containing a IPv4 address, when signed
using the &quot;v4&quot; scheme occupies roughly 120 bytes, leaving plenty of room for additional
metadata.&lt;&#x2F;p&gt;
&lt;p&gt;You might wonder about the need for so many pre-defined keys related to IP addresses and
ports. This need arises because residential and mobile network setups often put IPv4
behind NAT while IPv6 traffic—if supported—is directly routed to the same host. Declaring
both address types ensures a node is reachable from IPv4-only locations and those
supporting both protocols.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;test-vectors&quot;&gt;Test Vectors&lt;&#x2F;h1&gt;
&lt;p&gt;This is an example record containing the IPv4 address &lt;code&gt;127.0.0.1&lt;&#x2F;code&gt; and UDP port &lt;code&gt;30303&lt;&#x2F;code&gt;.
The node ID is &lt;code&gt;a448f24c6d18e575453db13171562b71999873db5b286df957af199ec94617f7&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;enr:-IS4QHCYrYZbAKWCBRlAy5zzaDZXJBGkcnh4MHcBFZntXNFrdvJjX04jRzjzCBOonrkTfj499SZuOh8R33Ls8RRcy5wBgmlkgnY0gmlwhH8AAAGJc2VjcDI1NmsxoQPKY0yuDUmstAHYpMa2_oxVtw0RW_QAdpzBQA8yWM0xOIN1ZHCCdl8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The record is signed using the &quot;v4&quot; identity scheme using sequence number &lt;code&gt;1&lt;&#x2F;code&gt; and this
private key:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The RLP structure of the record is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  7098ad865b00a582051940cb9cf36836572411a47278783077011599ed5cd16b76f2635f4e234738f30813a89eb9137e3e3df5266e3a1f11df72ecf1145ccb9c,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  01,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &amp;quot;id&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &amp;quot;v4&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &amp;quot;ip&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  7f000001,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &amp;quot;secp256k1&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  03ca634cae0d49acb401d8a4c6b6fe8c55b70d115bf400769cc1400f3258cd3138,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &amp;quot;udp&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  765f,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h1 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h1&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Token Standard</title>
        <published>2017-11-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Jacques Dafflon</name><email>mail@0xjac.com</email>
	</author>
	
	<author>
		<name>Jordi Baylina</name><email>jordi@baylina.cat</email>
	</author>
	
	<author>
		<name>Thomas Shababi</name><email>tom@truelevel.io</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/777/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/777" />
        

        <id>https://wg-eips.ritovision.com/777/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:777"
            label="ERC-777" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/777/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP defines standard interfaces and behaviors for token contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This standard defines a new way to interact with a token contract while remaining backward compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;It defines advanced features to interact with tokens.
Namely, &lt;em&gt;operators&lt;&#x2F;em&gt; to send tokens on behalf of another address—contract or regular account—and
send&#x2F;receive &lt;em&gt;hooks&lt;&#x2F;em&gt; to offer token holders more control over their tokens.&lt;&#x2F;p&gt;
&lt;p&gt;It takes advantage of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1820&#x2F;&quot;&gt;ERC-1820&lt;&#x2F;a&gt; to find out whether and where to notify contracts and regular addresses
when they receive tokens as well as to allow compatibility with already-deployed contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This standard tries to improve upon the widely used &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; token standard.
The main advantages of this standard are:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Uses the same philosophy as Ether in that tokens are sent with &lt;code&gt;send(dest, value, data)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Both contracts and regular addresses can control and reject which token they send
by registering a &lt;code&gt;tokensToSend&lt;&#x2F;code&gt; hook.
(Rejection is done by &lt;code&gt;revert&lt;&#x2F;code&gt;ing in the hook function.)&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Both contracts and regular addresses can control and reject which token they receive
by registering a &lt;code&gt;tokensReceived&lt;&#x2F;code&gt; hook.
(Rejection is done by &lt;code&gt;revert&lt;&#x2F;code&gt;ing in the hook function.)&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;tokensReceived&lt;&#x2F;code&gt; hook allows to send tokens to a contract and notify it in a single transaction,
unlike &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; which requires a double call (&lt;code&gt;approve&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;transferFrom&lt;&#x2F;code&gt;) to achieve this.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The holder can &quot;authorize&quot; and &quot;revoke&quot; operators which can send tokens on their behalf.
These operators are intended to be verified contracts
such as an exchange, a cheque processor or an automatic charging system.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Every token transaction contains &lt;code&gt;data&lt;&#x2F;code&gt; and &lt;code&gt;operatorData&lt;&#x2F;code&gt; bytes fields
to be used freely to pass data from the holder and the operator, respectively.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;It is backward compatible with wallets that do not contain the &lt;code&gt;tokensReceived&lt;&#x2F;code&gt; hook function
by deploying a proxy contract implementing the &lt;code&gt;tokensReceived&lt;&#x2F;code&gt; hook for the wallet.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;erc777token-token-contract&quot;&gt;ERC777Token (Token Contract)&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC777Token&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; symbol&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; holder&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; granularity&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; defaultOperators&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isOperatorFor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; holder&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; authorizeOperator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revokeOperator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; send&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; operatorSend&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operatorData&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; burn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; operatorBurn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operatorData&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Sent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operatorData&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Minted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operatorData&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Burned&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operatorData&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AuthorizedOperator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; holder&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RevokedOperator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; holder&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The token contract MUST implement the above interface.
The implementation MUST follow the specifications described below.&lt;&#x2F;p&gt;
&lt;p&gt;The token contract MUST register the &lt;code&gt;ERC777Token&lt;&#x2F;code&gt; interface with its own address via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1820&#x2F;&quot;&gt;ERC-1820&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;This is done by calling the &lt;code&gt;setInterfaceImplementer&lt;&#x2F;code&gt; function on the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1820&#x2F;&quot;&gt;ERC-1820&lt;&#x2F;a&gt; registry
with the token contract address as both the address and the implementer
and the &lt;code&gt;keccak256&lt;&#x2F;code&gt; hash of &lt;code&gt;ERC777Token&lt;&#x2F;code&gt; (&lt;code&gt;0xac7fbab5f54a3ca8194167523c6753bfeb96a445279294b6125b68cce2177054&lt;&#x2F;code&gt;)
as the interface hash.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;If the contract has a switch to enable or disable ERC-777 functions, every time the switch is triggered,
the token MUST register or unregister the &lt;code&gt;ERC777Token&lt;&#x2F;code&gt; interface for its own address accordingly via ERC1820.
Unregistering implies calling the &lt;code&gt;setInterfaceImplementer&lt;&#x2F;code&gt; with the token contract address as the address,
the &lt;code&gt;keccak256&lt;&#x2F;code&gt; hash of &lt;code&gt;ERC777Token&lt;&#x2F;code&gt; as the interface hash and &lt;code&gt;0x0&lt;&#x2F;code&gt; as the implementer.
(See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1820&#x2F;#set-an-interface-for-an-address&quot;&gt;Set An Interface For An Address&lt;&#x2F;a&gt; in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1820&#x2F;&quot;&gt;ERC-1820&lt;&#x2F;a&gt; for more details.)&lt;&#x2F;p&gt;
&lt;p&gt;When interacting with the token contract, all amounts and balances MUST be unsigned integers.
I.e. internally, all values are stored as a denomination of 1E-18 of a token.
The display denomination—to display any amount to the end user—MUST
be 10&lt;sup&gt;18&lt;&#x2F;sup&gt; of the internal denomination.&lt;&#x2F;p&gt;
&lt;p&gt;In other words, the internal denomination is similar to a wei
and the display denomination is similar to an ether.
It is equivalent to an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;&#x27;s &lt;code&gt;decimals&lt;&#x2F;code&gt; function returning &lt;code&gt;18&lt;&#x2F;code&gt;.
E.g. if a token contract returns a balance of &lt;code&gt;500,000,000,000,000,000&lt;&#x2F;code&gt; (0.5×10&lt;sup&gt;18&lt;&#x2F;sup&gt;) for a user,
the user interface MUST show &lt;code&gt;0.5&lt;&#x2F;code&gt; tokens to the user.
If the user wishes to send &lt;code&gt;0.3&lt;&#x2F;code&gt; tokens,
the contract MUST be called with an amount of &lt;code&gt;300,000,000,000,000,000&lt;&#x2F;code&gt; (0.3×10&lt;sup&gt;18&lt;&#x2F;sup&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;User Interfaces which are generated programmatically from the ABI of the token contract
MAY use and display the internal denomination.
But this MUST be made clear, for example by displaying the &lt;code&gt;uint256&lt;&#x2F;code&gt; type.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;view-functions&quot;&gt;&lt;strong&gt;View Functions&lt;&#x2F;strong&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;view&lt;&#x2F;code&gt; functions detailed below MUST be implemented.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;name&lt;&#x2F;code&gt; function&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Get the name of the token, e.g., &lt;code&gt;&quot;MyToken&quot;&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;small&gt;&lt;strong&gt;identifier:&lt;&#x2F;strong&gt; &lt;code&gt;06fdde03&lt;&#x2F;code&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;strong&gt;returns:&lt;&#x2F;strong&gt; Name of the token.&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;symbol&lt;&#x2F;code&gt; function&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; symbol&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Get the symbol of the token, e.g., &lt;code&gt;&quot;MYT&quot;&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;small&gt;&lt;strong&gt;identifier:&lt;&#x2F;strong&gt; &lt;code&gt;95d89b41&lt;&#x2F;code&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;strong&gt;returns:&lt;&#x2F;strong&gt; Symbol of the token.&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;totalSupply&lt;&#x2F;code&gt; function&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Get the total number of minted tokens.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;NOTE&lt;&#x2F;em&gt;: The total supply MUST be equal to the sum of the balances of all addresses—as
returned by the &lt;code&gt;balanceOf&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;NOTE&lt;&#x2F;em&gt;: The total supply MUST be equal to the sum of all the minted tokens
as defined in all the &lt;code&gt;Minted&lt;&#x2F;code&gt; events minus the sum of all the burned tokens as defined in all the &lt;code&gt;Burned&lt;&#x2F;code&gt; events.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;small&gt;&lt;strong&gt;identifier:&lt;&#x2F;strong&gt; &lt;code&gt;18160ddd&lt;&#x2F;code&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;strong&gt;returns:&lt;&#x2F;strong&gt; Total supply of tokens currently in circulation.&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;balanceOf&lt;&#x2F;code&gt; function&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; holder&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Get the balance of the account with address &lt;code&gt;holder&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The balance MUST be zero (&lt;code&gt;0&lt;&#x2F;code&gt;) or higher.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;small&gt;&lt;strong&gt;identifier:&lt;&#x2F;strong&gt; &lt;code&gt;70a08231&lt;&#x2F;code&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;strong&gt;parameters&lt;&#x2F;strong&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;holder&lt;&#x2F;code&gt;: Address for which the balance is returned.&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;small&gt;&lt;strong&gt;returns:&lt;&#x2F;strong&gt; Amount of tokens held by &lt;code&gt;holder&lt;&#x2F;code&gt; in the token contract.&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;granularity&lt;&#x2F;code&gt; function&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; granularity&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Get the smallest part of the token that&#x27;s not divisible.&lt;&#x2F;p&gt;
&lt;p&gt;In other words, the granularity is the smallest amount of tokens (in the internal denomination)
which MAY be minted, sent or burned at any time.&lt;&#x2F;p&gt;
&lt;p&gt;The following rules MUST be applied regarding the &lt;em&gt;granularity&lt;&#x2F;em&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The &lt;em&gt;granularity&lt;&#x2F;em&gt; value MUST be set at creation time.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;em&gt;granularity&lt;&#x2F;em&gt; value MUST NOT be changed, ever.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;em&gt;granularity&lt;&#x2F;em&gt; value MUST be greater than or equal to &lt;code&gt;1&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;All balances MUST be a multiple of the granularity.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Any amount of tokens (in the internal denomination) minted, sent or burned
MUST be a multiple of the &lt;em&gt;granularity&lt;&#x2F;em&gt; value.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Any operation that would result in a balance that&#x27;s not a multiple of the &lt;em&gt;granularity&lt;&#x2F;em&gt; value
MUST be considered invalid, and the transaction MUST &lt;code&gt;revert&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;NOTE&lt;&#x2F;em&gt;: Most tokens SHOULD be fully partition-able.
I.e., this function SHOULD return &lt;code&gt;1&lt;&#x2F;code&gt; unless there is a good reason for not allowing any fraction of the token.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;small&gt;&lt;strong&gt;identifier:&lt;&#x2F;strong&gt; &lt;code&gt;556f0dc7&lt;&#x2F;code&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;strong&gt;returns:&lt;&#x2F;strong&gt; The smallest non-divisible part of the token.&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;&lt;em&gt;NOTE&lt;&#x2F;em&gt;: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;777&#x2F;#defaultOperators&quot;&gt;&lt;code&gt;defaultOperators&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;777&#x2F;#isOperatorFor&quot;&gt;&lt;code&gt;isOperatorFor&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; are also &lt;code&gt;view&lt;&#x2F;code&gt; functions,
defined under the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;777&#x2F;#operators&quot;&gt;operators&lt;&#x2F;a&gt; for consistency.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; compatibility requirement&lt;&#x2F;em&gt;:&lt;br &#x2F;&gt;
The decimals of the token MUST always be &lt;code&gt;18&lt;&#x2F;code&gt;.
For a &lt;em&gt;pure&lt;&#x2F;em&gt; ERC-777 token the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; &lt;code&gt;decimals&lt;&#x2F;code&gt; function is OPTIONAL,
and its existence SHALL NOT be relied upon when interacting with the token contract.
(The decimal value of &lt;code&gt;18&lt;&#x2F;code&gt; is implied.)
For an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; compatible token, the &lt;code&gt;decimals&lt;&#x2F;code&gt; function is REQUIRED and MUST return &lt;code&gt;18&lt;&#x2F;code&gt;.
(In &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;, the &lt;code&gt;decimals&lt;&#x2F;code&gt; function is OPTIONAL.
If the function is not present, the &lt;code&gt;decimals&lt;&#x2F;code&gt; value is not clearly defined and may be assumed to be &lt;code&gt;0&lt;&#x2F;code&gt;.
Hence for compatibility reasons, &lt;code&gt;decimals&lt;&#x2F;code&gt; MUST be implemented for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; compatible tokens.)&lt;&#x2F;p&gt;
&lt;h4 id=&quot;operators&quot;&gt;&lt;strong&gt;Operators&lt;&#x2F;strong&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;An &lt;code&gt;operator&lt;&#x2F;code&gt; is an address which is allowed to send and burn tokens on behalf of some &lt;em&gt;holder&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;When an address becomes an &lt;em&gt;operator&lt;&#x2F;em&gt; for a &lt;em&gt;holder&lt;&#x2F;em&gt;, an &lt;code&gt;AuthorizedOperator&lt;&#x2F;code&gt; event MUST be emitted.
The &lt;code&gt;AuthorizedOperator&lt;&#x2F;code&gt;&#x27;s &lt;code&gt;operator&lt;&#x2F;code&gt; (topic 1) and &lt;code&gt;holder&lt;&#x2F;code&gt; (topic 2)
MUST be the addresses of the &lt;em&gt;operator&lt;&#x2F;em&gt; and the &lt;em&gt;holder&lt;&#x2F;em&gt; respectively.&lt;&#x2F;p&gt;
&lt;p&gt;When a &lt;em&gt;holder&lt;&#x2F;em&gt; revokes an &lt;em&gt;operator&lt;&#x2F;em&gt;, a &lt;code&gt;RevokedOperator&lt;&#x2F;code&gt; event MUST be emitted.
The &lt;code&gt;RevokedOperator&lt;&#x2F;code&gt;&#x27;s &lt;code&gt;operator&lt;&#x2F;code&gt; (topic 1) and &lt;code&gt;holder&lt;&#x2F;code&gt; (topic 2)
MUST be the addresses of the &lt;em&gt;operator&lt;&#x2F;em&gt; and the &lt;em&gt;holder&lt;&#x2F;em&gt; respectively.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;NOTE&lt;&#x2F;em&gt;: A &lt;em&gt;holder&lt;&#x2F;em&gt; MAY have multiple &lt;em&gt;operators&lt;&#x2F;em&gt; at the same time.&lt;&#x2F;p&gt;
&lt;p&gt;The token MAY define &lt;em&gt;default operators&lt;&#x2F;em&gt;.
A &lt;em&gt;default operator&lt;&#x2F;em&gt; is an implicitly authorized &lt;em&gt;operator&lt;&#x2F;em&gt; for all &lt;em&gt;holders&lt;&#x2F;em&gt;.
&lt;code&gt;AuthorizedOperator&lt;&#x2F;code&gt; events MUST NOT be emitted when defining the &lt;em&gt;default operators&lt;&#x2F;em&gt;.
The rules below apply to &lt;em&gt;default operators&lt;&#x2F;em&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The token contract MUST define &lt;em&gt;default operators&lt;&#x2F;em&gt; at creation time.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;em&gt;default operators&lt;&#x2F;em&gt; MUST be invariants. I.e., the token contract MUST NOT add or remove &lt;em&gt;default operators&lt;&#x2F;em&gt; ever.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;AuthorizedOperator&lt;&#x2F;code&gt; events MUST NOT be emitted when defining &lt;em&gt;default operators&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;A &lt;em&gt;holder&lt;&#x2F;em&gt; MUST be allowed to revoke a &lt;em&gt;default operator&lt;&#x2F;em&gt;
(unless the &lt;em&gt;holder&lt;&#x2F;em&gt; is the &lt;em&gt;default operator&lt;&#x2F;em&gt; in question).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;A &lt;em&gt;holder&lt;&#x2F;em&gt; MUST be allowed to re-authorize a previously revoked &lt;em&gt;default operator&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;When a &lt;em&gt;default operator&lt;&#x2F;em&gt; is explicitly authorized or revoked for a specific &lt;em&gt;holder&lt;&#x2F;em&gt;,
an &lt;code&gt;AuthorizedOperator&lt;&#x2F;code&gt; or &lt;code&gt;RevokedOperator&lt;&#x2F;code&gt; event (respectively) MUST be emitted.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The following rules apply to any &lt;em&gt;operator&lt;&#x2F;em&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;An address MUST always be an &lt;em&gt;operator&lt;&#x2F;em&gt; for itself. Hence an address MUST NOT ever be revoked as its own &lt;em&gt;operator&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;If an address is an &lt;em&gt;operator&lt;&#x2F;em&gt; for a &lt;em&gt;holder&lt;&#x2F;em&gt;, &lt;code&gt;isOperatorFor&lt;&#x2F;code&gt; MUST return &lt;code&gt;true&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;If an address is not an &lt;em&gt;operator&lt;&#x2F;em&gt; for a &lt;em&gt;holder&lt;&#x2F;em&gt;, &lt;code&gt;isOperatorFor&lt;&#x2F;code&gt; MUST return &lt;code&gt;false&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The token contract MUST emit an &lt;code&gt;AuthorizedOperator&lt;&#x2F;code&gt; event with the correct values
when a &lt;em&gt;holder&lt;&#x2F;em&gt; authorizes an address as its &lt;em&gt;operator&lt;&#x2F;em&gt; as defined in the
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;777&#x2F;#authorizedoperator&quot;&gt;&lt;code&gt;AuthorizedOperator&lt;&#x2F;code&gt; Event&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The token contract MUST emit a &lt;code&gt;RevokedOperator&lt;&#x2F;code&gt; event with the correct values
when a &lt;em&gt;holder&lt;&#x2F;em&gt; revokes an address as its &lt;em&gt;operator&lt;&#x2F;em&gt; as defined in the
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;777&#x2F;#revokedoperator&quot;&gt;&lt;code&gt;RevokedOperator&lt;&#x2F;code&gt; Event&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;NOTE&lt;&#x2F;em&gt;: A &lt;em&gt;holder&lt;&#x2F;em&gt; MAY authorize an already authorized &lt;em&gt;operator&lt;&#x2F;em&gt;.
An &lt;code&gt;AuthorizedOperator&lt;&#x2F;code&gt; MUST be emitted each time.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;NOTE&lt;&#x2F;em&gt;: A &lt;em&gt;holder&lt;&#x2F;em&gt; MAY revoke an already revoked &lt;em&gt;operator&lt;&#x2F;em&gt;.
A &lt;code&gt;RevokedOperator&lt;&#x2F;code&gt; MUST be emitted each time.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;AuthorizedOperator&lt;&#x2F;code&gt; event&lt;&#x2F;strong&gt; &lt;a id=&quot;authorizedoperator&quot;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AuthorizedOperator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; holder&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Indicates the authorization of &lt;code&gt;operator&lt;&#x2F;code&gt; as an &lt;em&gt;operator&lt;&#x2F;em&gt; for &lt;code&gt;holder&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;NOTE&lt;&#x2F;em&gt;: This event MUST NOT be emitted outside of an &lt;em&gt;operator&lt;&#x2F;em&gt; authorization process.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;small&gt;&lt;strong&gt;parameters&lt;&#x2F;strong&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;operator&lt;&#x2F;code&gt;: Address which became an &lt;em&gt;operator&lt;&#x2F;em&gt; of &lt;code&gt;holder&lt;&#x2F;code&gt;.&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;holder&lt;&#x2F;code&gt;: Address of a &lt;em&gt;holder&lt;&#x2F;em&gt; which authorized the &lt;code&gt;operator&lt;&#x2F;code&gt; address as an &lt;em&gt;operator&lt;&#x2F;em&gt;.&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;RevokedOperator&lt;&#x2F;code&gt; event&lt;&#x2F;strong&gt; &lt;a id=&quot;revokedoperator&quot;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RevokedOperator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; holder&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Indicates the revocation of &lt;code&gt;operator&lt;&#x2F;code&gt; as an &lt;em&gt;operator&lt;&#x2F;em&gt; for &lt;code&gt;holder&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;NOTE&lt;&#x2F;em&gt;: This event MUST NOT be emitted outside of an &lt;em&gt;operator&lt;&#x2F;em&gt; revocation process.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;small&gt;&lt;strong&gt;parameters&lt;&#x2F;strong&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;operator&lt;&#x2F;code&gt;: Address which was revoked as an &lt;em&gt;operator&lt;&#x2F;em&gt; of &lt;code&gt;holder&lt;&#x2F;code&gt;.&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;holder&lt;&#x2F;code&gt;: Address of a &lt;em&gt;holder&lt;&#x2F;em&gt; which revoked the &lt;code&gt;operator&lt;&#x2F;code&gt; address as an &lt;em&gt;operator&lt;&#x2F;em&gt;.&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;The &lt;code&gt;defaultOperators&lt;&#x2F;code&gt;, &lt;code&gt;authorizeOperator&lt;&#x2F;code&gt;, &lt;code&gt;revokeOperator&lt;&#x2F;code&gt; and &lt;code&gt;isOperatorFor&lt;&#x2F;code&gt; functions described below
MUST be implemented to manage &lt;em&gt;operators&lt;&#x2F;em&gt;.
Token contracts MAY implement other functions to manage &lt;em&gt;operators&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;defaultOperators&lt;&#x2F;code&gt; function&lt;&#x2F;strong&gt; &lt;a id=&quot;defaultOperators&quot;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; defaultOperators&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Get the list of &lt;em&gt;default operators&lt;&#x2F;em&gt; as defined by the token contract.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;NOTE&lt;&#x2F;em&gt;: If the token contract does not have any &lt;em&gt;default operators&lt;&#x2F;em&gt;, this function MUST return an empty list.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;small&gt;&lt;strong&gt;identifier:&lt;&#x2F;strong&gt; &lt;code&gt;06e48538&lt;&#x2F;code&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;strong&gt;returns:&lt;&#x2F;strong&gt; List of addresses of all the &lt;em&gt;default operators&lt;&#x2F;em&gt;.&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;authorizeOperator&lt;&#x2F;code&gt; function&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; authorizeOperator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Set a third party &lt;code&gt;operator&lt;&#x2F;code&gt; address as an &lt;em&gt;operator&lt;&#x2F;em&gt; of &lt;code&gt;msg.sender&lt;&#x2F;code&gt; to send and burn tokens on its behalf.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;NOTE&lt;&#x2F;em&gt;: The &lt;em&gt;holder&lt;&#x2F;em&gt; (&lt;code&gt;msg.sender&lt;&#x2F;code&gt;) is always an &lt;em&gt;operator&lt;&#x2F;em&gt; for itself.
This right SHALL NOT be revoked.
Hence this function MUST &lt;code&gt;revert&lt;&#x2F;code&gt; if it is called to authorize the holder (&lt;code&gt;msg.sender&lt;&#x2F;code&gt;)
as an &lt;em&gt;operator&lt;&#x2F;em&gt; for itself (i.e. if &lt;code&gt;operator&lt;&#x2F;code&gt; is equal to &lt;code&gt;msg.sender&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;small&gt;&lt;strong&gt;identifier:&lt;&#x2F;strong&gt; &lt;code&gt;959b8c3f&lt;&#x2F;code&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;strong&gt;parameters&lt;&#x2F;strong&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;operator&lt;&#x2F;code&gt;: Address to set as an &lt;em&gt;operator&lt;&#x2F;em&gt; for &lt;code&gt;msg.sender&lt;&#x2F;code&gt;.&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;revokeOperator&lt;&#x2F;code&gt; function&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revokeOperator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Remove the right of the &lt;code&gt;operator&lt;&#x2F;code&gt; address to be an &lt;em&gt;operator&lt;&#x2F;em&gt; for &lt;code&gt;msg.sender&lt;&#x2F;code&gt;
and to send and burn tokens on its behalf.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;NOTE&lt;&#x2F;em&gt;: The &lt;em&gt;holder&lt;&#x2F;em&gt; (&lt;code&gt;msg.sender&lt;&#x2F;code&gt;) is always an &lt;em&gt;operator&lt;&#x2F;em&gt; for itself.
This right SHALL NOT be revoked.
Hence this function MUST &lt;code&gt;revert&lt;&#x2F;code&gt; if it is called to revoke the holder (&lt;code&gt;msg.sender&lt;&#x2F;code&gt;)
as an &lt;em&gt;operator&lt;&#x2F;em&gt; for itself (i.e., if &lt;code&gt;operator&lt;&#x2F;code&gt; is equal to &lt;code&gt;msg.sender&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;small&gt;&lt;strong&gt;identifier:&lt;&#x2F;strong&gt; &lt;code&gt;fad8b32a&lt;&#x2F;code&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;strong&gt;parameters&lt;&#x2F;strong&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;operator&lt;&#x2F;code&gt;: Address to rescind as an &lt;em&gt;operator&lt;&#x2F;em&gt; for &lt;code&gt;msg.sender&lt;&#x2F;code&gt;.&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;isOperatorFor&lt;&#x2F;code&gt; function&lt;&#x2F;strong&gt; &lt;a id=&quot;isOperatorFor&quot;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isOperatorFor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; holder&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Indicate whether the &lt;code&gt;operator&lt;&#x2F;code&gt; address is an &lt;em&gt;operator&lt;&#x2F;em&gt; of the &lt;code&gt;holder&lt;&#x2F;code&gt; address.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;small&gt;&lt;strong&gt;identifier:&lt;&#x2F;strong&gt; &lt;code&gt;d95b6371&lt;&#x2F;code&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;strong&gt;parameters&lt;&#x2F;strong&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;operator&lt;&#x2F;code&gt;: Address which may be an &lt;em&gt;operator&lt;&#x2F;em&gt; of &lt;code&gt;holder&lt;&#x2F;code&gt;.&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;holder&lt;&#x2F;code&gt;: Address of a &lt;em&gt;holder&lt;&#x2F;em&gt; which may have the &lt;code&gt;operator&lt;&#x2F;code&gt; address as an &lt;em&gt;operator&lt;&#x2F;em&gt;.&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;small&gt;&lt;strong&gt;returns:&lt;&#x2F;strong&gt; &lt;code&gt;true&lt;&#x2F;code&gt; if &lt;code&gt;operator&lt;&#x2F;code&gt; is an &lt;em&gt;operator&lt;&#x2F;em&gt; of &lt;code&gt;holder&lt;&#x2F;code&gt; and &lt;code&gt;false&lt;&#x2F;code&gt; otherwise.&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;&lt;em&gt;NOTE&lt;&#x2F;em&gt;: To know which addresses are &lt;em&gt;operators&lt;&#x2F;em&gt; for a given &lt;em&gt;holder&lt;&#x2F;em&gt;,
one MUST call &lt;code&gt;isOperatorFor&lt;&#x2F;code&gt; with the &lt;em&gt;holder&lt;&#x2F;em&gt; for each &lt;em&gt;default operator&lt;&#x2F;em&gt;
and parse the &lt;code&gt;AuthorizedOperator&lt;&#x2F;code&gt;, and &lt;code&gt;RevokedOperator&lt;&#x2F;code&gt; events for the &lt;em&gt;holder&lt;&#x2F;em&gt; in question.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;sending-tokens&quot;&gt;&lt;strong&gt;Sending Tokens&lt;&#x2F;strong&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;When an &lt;em&gt;operator&lt;&#x2F;em&gt; sends an &lt;code&gt;amount&lt;&#x2F;code&gt; of tokens from a &lt;em&gt;holder&lt;&#x2F;em&gt; to a &lt;em&gt;recipient&lt;&#x2F;em&gt;
with the associated &lt;code&gt;data&lt;&#x2F;code&gt; and &lt;code&gt;operatorData&lt;&#x2F;code&gt;, the token contract MUST apply the following rules:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Any authorized &lt;em&gt;operator&lt;&#x2F;em&gt; MAY send tokens to any &lt;em&gt;recipient&lt;&#x2F;em&gt; (except to &lt;code&gt;0x0&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The balance of the &lt;em&gt;holder&lt;&#x2F;em&gt; MUST be decreased by the &lt;code&gt;amount&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The balance of the &lt;em&gt;recipient&lt;&#x2F;em&gt; MUST be increased by the &lt;code&gt;amount&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The balance of the &lt;em&gt;holder&lt;&#x2F;em&gt; MUST be greater or equal to the &lt;code&gt;amount&lt;&#x2F;code&gt;—such
that its resulting balance is greater or equal to zero (&lt;code&gt;0&lt;&#x2F;code&gt;) after the send.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The token contract MUST emit a &lt;code&gt;Sent&lt;&#x2F;code&gt; event with the correct values as defined in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;777&#x2F;#sent&quot;&gt;&lt;code&gt;Sent&lt;&#x2F;code&gt; Event&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;em&gt;operator&lt;&#x2F;em&gt; MAY include information in the &lt;code&gt;operatorData&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The token contract MUST call the &lt;code&gt;tokensToSend&lt;&#x2F;code&gt; hook of the &lt;em&gt;holder&lt;&#x2F;em&gt;
if the &lt;em&gt;holder&lt;&#x2F;em&gt; registers an &lt;code&gt;ERC777TokensSender&lt;&#x2F;code&gt; implementation via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1820&#x2F;&quot;&gt;ERC-1820&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The token contract MUST call the &lt;code&gt;tokensReceived&lt;&#x2F;code&gt; hook of the &lt;em&gt;recipient&lt;&#x2F;em&gt;
if the &lt;em&gt;recipient&lt;&#x2F;em&gt; registers an &lt;code&gt;ERC777TokensRecipient&lt;&#x2F;code&gt; implementation via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1820&#x2F;&quot;&gt;ERC-1820&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;data&lt;&#x2F;code&gt; and &lt;code&gt;operatorData&lt;&#x2F;code&gt; MUST be immutable during the entire send process—hence
the same &lt;code&gt;data&lt;&#x2F;code&gt; and &lt;code&gt;operatorData&lt;&#x2F;code&gt; MUST be used to call both hooks and emit the &lt;code&gt;Sent&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The token contract MUST &lt;code&gt;revert&lt;&#x2F;code&gt; when sending in any of the following cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The &lt;em&gt;operator&lt;&#x2F;em&gt; address is not an authorized operator for the &lt;em&gt;holder&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The resulting &lt;em&gt;holder&lt;&#x2F;em&gt; balance or &lt;em&gt;recipient&lt;&#x2F;em&gt; balance after the send
is not a multiple of the &lt;em&gt;granularity&lt;&#x2F;em&gt; defined by the token contract.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;em&gt;recipient&lt;&#x2F;em&gt; is a contract, and it does not implement the &lt;code&gt;ERC777TokensRecipient&lt;&#x2F;code&gt; interface via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1820&#x2F;&quot;&gt;ERC-1820&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The address of the &lt;em&gt;holder&lt;&#x2F;em&gt; or the &lt;em&gt;recipient&lt;&#x2F;em&gt; is &lt;code&gt;0x0&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Any of the resulting balances becomes negative, i.e. becomes less than zero (&lt;code&gt;0&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;tokensToSend&lt;&#x2F;code&gt; hook of the &lt;em&gt;holder&lt;&#x2F;em&gt; &lt;code&gt;revert&lt;&#x2F;code&gt;s.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;tokensReceived&lt;&#x2F;code&gt; hook of the &lt;em&gt;recipient&lt;&#x2F;em&gt; &lt;code&gt;revert&lt;&#x2F;code&gt;s.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The token contract MAY send tokens from many &lt;em&gt;holders&lt;&#x2F;em&gt;, to many &lt;em&gt;recipients&lt;&#x2F;em&gt;, or both. In this case:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The previous send rules MUST apply to all the &lt;em&gt;holders&lt;&#x2F;em&gt; and all the &lt;em&gt;recipients&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The sum of all the balances incremented MUST be equal to the total sent &lt;code&gt;amount&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The sum of all the balances decremented MUST be equal to the total sent &lt;code&gt;amount&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;A &lt;code&gt;Sent&lt;&#x2F;code&gt; event MUST be emitted for every &lt;em&gt;holder&lt;&#x2F;em&gt; and &lt;em&gt;recipient&lt;&#x2F;em&gt; pair with the corresponding amount for each pair.&lt;&#x2F;li&gt;
&lt;li&gt;The sum of all the amounts from the &lt;code&gt;Sent&lt;&#x2F;code&gt; event MUST be equal to the total sent &lt;code&gt;amount&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;NOTE&lt;&#x2F;em&gt;: Mechanisms such as applying a fee on a send is considered as a send to multiple &lt;em&gt;recipients&lt;&#x2F;em&gt;:
the intended &lt;em&gt;recipient&lt;&#x2F;em&gt; and the fee &lt;em&gt;recipient&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;NOTE&lt;&#x2F;em&gt;: Movements of tokens MAY be chained.
For example, if a contract upon receiving tokens sends them further to another address.
In this case, the previous send rules apply to each send, in order.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;NOTE&lt;&#x2F;em&gt;: Sending an amount of zero (&lt;code&gt;0&lt;&#x2F;code&gt;) tokens is valid and MUST be treated as a regular send.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Implementation Requirement&lt;&#x2F;em&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The token contract MUST call the &lt;code&gt;tokensToSend&lt;&#x2F;code&gt; hook &lt;em&gt;before&lt;&#x2F;em&gt; updating the state.&lt;&#x2F;li&gt;
&lt;li&gt;The token contract MUST call the &lt;code&gt;tokensReceived&lt;&#x2F;code&gt; hook &lt;em&gt;after&lt;&#x2F;em&gt; updating the state.&lt;br &#x2F;&gt;
I.e., &lt;code&gt;tokensToSend&lt;&#x2F;code&gt; MUST be called first,
then the balances MUST be updated to reflect the send,
and finally &lt;code&gt;tokensReceived&lt;&#x2F;code&gt; MUST be called &lt;em&gt;afterward&lt;&#x2F;em&gt;.
Thus a &lt;code&gt;balanceOf&lt;&#x2F;code&gt; call within &lt;code&gt;tokensToSend&lt;&#x2F;code&gt; returns the balance of the address &lt;em&gt;before&lt;&#x2F;em&gt; the send
and a &lt;code&gt;balanceOf&lt;&#x2F;code&gt; call within &lt;code&gt;tokensReceived&lt;&#x2F;code&gt; returns the balance of the address &lt;em&gt;after&lt;&#x2F;em&gt; the send.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;NOTE&lt;&#x2F;em&gt;: The &lt;code&gt;data&lt;&#x2F;code&gt; field contains information provided by the &lt;em&gt;holder&lt;&#x2F;em&gt;—similar
to the data field in a regular ether send transaction.
The &lt;code&gt;tokensToSend()&lt;&#x2F;code&gt; hook, the &lt;code&gt;tokensReceived()&lt;&#x2F;code&gt;, or both
MAY use the information to decide if they wish to reject the transaction.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;NOTE&lt;&#x2F;em&gt;: The &lt;code&gt;operatorData&lt;&#x2F;code&gt; field is analogous to the &lt;code&gt;data&lt;&#x2F;code&gt; field except it SHALL be provided by the &lt;em&gt;operator&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;operatorData&lt;&#x2F;code&gt; MUST only be provided by the &lt;em&gt;operator&lt;&#x2F;em&gt;.
It is intended more for logging purposes and particular cases.
(Examples include payment references, cheque numbers, countersignatures and more.)
In most of the cases the recipient would ignore the &lt;code&gt;operatorData&lt;&#x2F;code&gt;, or at most, it would log the &lt;code&gt;operatorData&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;Sent&lt;&#x2F;code&gt; event&lt;&#x2F;strong&gt; &lt;a id=&quot;sent&quot;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Sent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operatorData&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Indicate a send of &lt;code&gt;amount&lt;&#x2F;code&gt; of tokens from the &lt;code&gt;from&lt;&#x2F;code&gt; address to the &lt;code&gt;to&lt;&#x2F;code&gt; address by the &lt;code&gt;operator&lt;&#x2F;code&gt; address.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;NOTE&lt;&#x2F;em&gt;: This event MUST NOT be emitted outside of a send or an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; transfer process.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;small&gt;&lt;strong&gt;parameters&lt;&#x2F;strong&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;operator&lt;&#x2F;code&gt;: Address which triggered the send.&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;from&lt;&#x2F;code&gt;: &lt;em&gt;Holder&lt;&#x2F;em&gt; whose tokens were sent.&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;to&lt;&#x2F;code&gt;: Recipient of the tokens.&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;amount&lt;&#x2F;code&gt;: Number of tokens sent.&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;data&lt;&#x2F;code&gt;: Information provided by the &lt;em&gt;holder&lt;&#x2F;em&gt;.&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;operatorData&lt;&#x2F;code&gt;: Information provided by the &lt;em&gt;operator&lt;&#x2F;em&gt;.&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;The &lt;code&gt;send&lt;&#x2F;code&gt; and &lt;code&gt;operatorSend&lt;&#x2F;code&gt; functions described below MUST be implemented to send tokens.
Token contracts MAY implement other functions to send tokens.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;send&lt;&#x2F;code&gt; function&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; send&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Send the &lt;code&gt;amount&lt;&#x2F;code&gt; of tokens from the address &lt;code&gt;msg.sender&lt;&#x2F;code&gt; to the address &lt;code&gt;to&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;em&gt;operator&lt;&#x2F;em&gt; and the &lt;em&gt;holder&lt;&#x2F;em&gt; MUST both be the &lt;code&gt;msg.sender&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;small&gt;&lt;strong&gt;identifier:&lt;&#x2F;strong&gt; &lt;code&gt;9bd9bbc6&lt;&#x2F;code&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;strong&gt;parameters&lt;&#x2F;strong&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;to&lt;&#x2F;code&gt;: Recipient of the tokens.&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;amount&lt;&#x2F;code&gt;: Number of tokens to send.&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;data&lt;&#x2F;code&gt;: Information provided by the &lt;em&gt;holder&lt;&#x2F;em&gt;.&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;operatorSend&lt;&#x2F;code&gt; function&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; operatorSend&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operatorData&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Send the &lt;code&gt;amount&lt;&#x2F;code&gt; of tokens on behalf of the address &lt;code&gt;from&lt;&#x2F;code&gt; to the address &lt;code&gt;to&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Reminder&lt;&#x2F;em&gt;: If the &lt;em&gt;operator&lt;&#x2F;em&gt; address is not an authorized operator of the &lt;code&gt;from&lt;&#x2F;code&gt; address,
then the send process MUST &lt;code&gt;revert&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;NOTE&lt;&#x2F;em&gt;: &lt;code&gt;from&lt;&#x2F;code&gt; and &lt;code&gt;msg.sender&lt;&#x2F;code&gt; MAY be the same address.
I.e., an address MAY call &lt;code&gt;operatorSend&lt;&#x2F;code&gt; for itself.
This call MUST be equivalent to &lt;code&gt;send&lt;&#x2F;code&gt; with the addition
that the &lt;em&gt;operator&lt;&#x2F;em&gt; MAY specify an explicit value for &lt;code&gt;operatorData&lt;&#x2F;code&gt;
(which cannot be done with the &lt;code&gt;send&lt;&#x2F;code&gt; function).&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;small&gt;&lt;strong&gt;identifier:&lt;&#x2F;strong&gt; &lt;code&gt;62ad1b83&lt;&#x2F;code&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;strong&gt;parameters&lt;&#x2F;strong&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;from&lt;&#x2F;code&gt;: &lt;em&gt;Holder&lt;&#x2F;em&gt; whose tokens are being sent.&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;to&lt;&#x2F;code&gt;: Recipient of the tokens.&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;amount&lt;&#x2F;code&gt;: Number of tokens to send.&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;data&lt;&#x2F;code&gt;: Information provided by the &lt;em&gt;holder&lt;&#x2F;em&gt;.&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;operatorData&lt;&#x2F;code&gt;: Information provided by the &lt;em&gt;operator&lt;&#x2F;em&gt;.&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h4 id=&quot;minting-tokens&quot;&gt;&lt;strong&gt;Minting Tokens&lt;&#x2F;strong&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Minting tokens is the act of producing new tokens.
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;777&#x2F;&quot;&gt;ERC-777&lt;&#x2F;a&gt; intentionally does not define specific functions to mint tokens.
This intent comes from the wish not to limit the use of the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;777&#x2F;&quot;&gt;ERC-777&lt;&#x2F;a&gt; standard
as the minting process is generally specific for every token.&lt;&#x2F;p&gt;
&lt;p&gt;Nonetheless, the rules below MUST be respected when minting for a &lt;em&gt;recipient&lt;&#x2F;em&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Tokens MAY be minted for any &lt;em&gt;recipient&lt;&#x2F;em&gt; address (except &lt;code&gt;0x0&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The total supply MUST be increased by the amount of tokens minted.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The balance of &lt;code&gt;0x0&lt;&#x2F;code&gt; MUST NOT be decreased.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The balance of the &lt;em&gt;recipient&lt;&#x2F;em&gt; MUST be increased by the amount of tokens minted.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The token contract MUST emit a &lt;code&gt;Minted&lt;&#x2F;code&gt; event with the correct values as defined in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;777&#x2F;#minted&quot;&gt;&lt;code&gt;Minted&lt;&#x2F;code&gt; Event&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The token contract MUST call the &lt;code&gt;tokensReceived&lt;&#x2F;code&gt; hook of the &lt;em&gt;recipient&lt;&#x2F;em&gt;
if the &lt;em&gt;recipient&lt;&#x2F;em&gt; registers an &lt;code&gt;ERC777TokensRecipient&lt;&#x2F;code&gt; implementation via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1820&#x2F;&quot;&gt;ERC-1820&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;data&lt;&#x2F;code&gt; and &lt;code&gt;operatorData&lt;&#x2F;code&gt; MUST be immutable during the entire mint process—hence
the same &lt;code&gt;data&lt;&#x2F;code&gt; and &lt;code&gt;operatorData&lt;&#x2F;code&gt; MUST be used to call the &lt;code&gt;tokensReceived&lt;&#x2F;code&gt; hook and emit the &lt;code&gt;Minted&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The token contract MUST &lt;code&gt;revert&lt;&#x2F;code&gt; when minting in any of the following cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The resulting &lt;em&gt;recipient&lt;&#x2F;em&gt; balance after the mint is not a multiple of the &lt;em&gt;granularity&lt;&#x2F;em&gt; defined by the token contract.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;em&gt;recipient&lt;&#x2F;em&gt; is a contract, and it does not implement the &lt;code&gt;ERC777TokensRecipient&lt;&#x2F;code&gt; interface via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1820&#x2F;&quot;&gt;ERC-1820&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The address of the &lt;em&gt;recipient&lt;&#x2F;em&gt; is &lt;code&gt;0x0&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;tokensReceived&lt;&#x2F;code&gt; hook of the &lt;em&gt;recipient&lt;&#x2F;em&gt; &lt;code&gt;revert&lt;&#x2F;code&gt;s.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;NOTE&lt;&#x2F;em&gt;: The initial token supply at the creation of the token contract MUST be considered as minting
for the amount of the initial supply to the address(es) receiving the initial supply.
This means one or more &lt;code&gt;Minted&lt;&#x2F;code&gt; events must be emitted
and the &lt;code&gt;tokensReceived&lt;&#x2F;code&gt; hook of the recipient(s) MUST be called.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; compatibility requirement&lt;&#x2F;em&gt;:&lt;br &#x2F;&gt;
While a &lt;code&gt;Sent&lt;&#x2F;code&gt; event MUST NOT be emitted when minting,
if the token contract is &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; backward compatible,
a &lt;code&gt;Transfer&lt;&#x2F;code&gt; event with the &lt;code&gt;from&lt;&#x2F;code&gt; parameter set to &lt;code&gt;0x0&lt;&#x2F;code&gt; SHOULD be emitted as defined in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; standard.&lt;&#x2F;p&gt;
&lt;p&gt;The token contract MAY mint tokens for multiple &lt;em&gt;recipients&lt;&#x2F;em&gt; at once. In this case:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The previous mint rules MUST apply to all the &lt;em&gt;recipients&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The sum of all the balances incremented MUST be equal to the total minted amount.&lt;&#x2F;li&gt;
&lt;li&gt;A &lt;code&gt;Minted&lt;&#x2F;code&gt; event MUST be emitted for every &lt;em&gt;recipient&lt;&#x2F;em&gt; with the corresponding amount for each &lt;em&gt;recipient&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The sum of all the amounts from the &lt;code&gt;Minted&lt;&#x2F;code&gt; event MUST be equal to the total minted &lt;code&gt;amount&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;NOTE&lt;&#x2F;em&gt;: Minting an amount of zero (&lt;code&gt;0&lt;&#x2F;code&gt;) tokens is valid and MUST be treated as a regular mint.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;NOTE&lt;&#x2F;em&gt;: While during a send or a burn, the data is provided by the &lt;em&gt;holder&lt;&#x2F;em&gt;, it is inapplicable for a mint.
In this case the data MAY be provided by the token contract or the &lt;em&gt;operator&lt;&#x2F;em&gt;,
for example to ensure a successful minting to a &lt;em&gt;holder&lt;&#x2F;em&gt; expecting specific data.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;NOTE&lt;&#x2F;em&gt;: The &lt;code&gt;operatorData&lt;&#x2F;code&gt; field contains information provided by the &lt;em&gt;operator&lt;&#x2F;em&gt;—similar
to the data field in a regular ether send transaction.
The &lt;code&gt;tokensReceived()&lt;&#x2F;code&gt; hooks MAY use the information to decide if it wish to reject the transaction.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;Minted&lt;&#x2F;code&gt; event&lt;&#x2F;strong&gt; &lt;a id=&quot;minted&quot;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Minted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operatorData&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Indicate the minting of &lt;code&gt;amount&lt;&#x2F;code&gt; of tokens to the &lt;code&gt;to&lt;&#x2F;code&gt; address by the &lt;code&gt;operator&lt;&#x2F;code&gt; address.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;NOTE&lt;&#x2F;em&gt;: This event MUST NOT be emitted outside of a mint process.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;small&gt;&lt;strong&gt;parameters&lt;&#x2F;strong&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;operator&lt;&#x2F;code&gt;: Address which triggered the mint.&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;to&lt;&#x2F;code&gt;: Recipient of the tokens.&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;amount&lt;&#x2F;code&gt;: Number of tokens minted.&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;data&lt;&#x2F;code&gt;: Information provided for the &lt;em&gt;recipient&lt;&#x2F;em&gt;.&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;operatorData&lt;&#x2F;code&gt;: Information provided by the &lt;em&gt;operator&lt;&#x2F;em&gt;.&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h4 id=&quot;burning-tokens&quot;&gt;&lt;strong&gt;Burning Tokens&lt;&#x2F;strong&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Burning tokens is the act of destroying existing tokens.
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;777&#x2F;&quot;&gt;ERC-777&lt;&#x2F;a&gt; explicitly defines two functions to burn tokens (&lt;code&gt;burn&lt;&#x2F;code&gt; and &lt;code&gt;operatorBurn&lt;&#x2F;code&gt;).
These functions facilitate the integration of the burning process in wallets and dapps.
However, the token contract MAY prevent some or all &lt;em&gt;holders&lt;&#x2F;em&gt; from burning tokens for any reason.
The token contract MAY also define other functions to burn tokens.&lt;&#x2F;p&gt;
&lt;p&gt;The rules below MUST be respected when burning the tokens of a &lt;em&gt;holder&lt;&#x2F;em&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Tokens MAY be burned from any &lt;em&gt;holder&lt;&#x2F;em&gt; address (except &lt;code&gt;0x0&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The total supply MUST be decreased by the amount of tokens burned.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The balance of &lt;code&gt;0x0&lt;&#x2F;code&gt; MUST NOT be increased.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The balance of the &lt;em&gt;holder&lt;&#x2F;em&gt; MUST be decreased by amount of tokens burned.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The token contract MUST emit a &lt;code&gt;Burned&lt;&#x2F;code&gt; event with the correct values as defined in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;777&#x2F;#burned&quot;&gt;&lt;code&gt;Burned&lt;&#x2F;code&gt; Event&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The token contract MUST call the &lt;code&gt;tokensToSend&lt;&#x2F;code&gt; hook of the &lt;em&gt;holder&lt;&#x2F;em&gt;
if the &lt;em&gt;holder&lt;&#x2F;em&gt; registers an &lt;code&gt;ERC777TokensSender&lt;&#x2F;code&gt; implementation via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1820&#x2F;&quot;&gt;ERC-1820&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;operatorData&lt;&#x2F;code&gt; MUST be immutable during the entire burn process—hence
the same &lt;code&gt;operatorData&lt;&#x2F;code&gt; MUST be used to call the &lt;code&gt;tokensToSend&lt;&#x2F;code&gt; hook and emit the &lt;code&gt;Burned&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The token contract MUST &lt;code&gt;revert&lt;&#x2F;code&gt; when burning in any of the following cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The &lt;em&gt;operator&lt;&#x2F;em&gt; address is not an authorized operator for the &lt;em&gt;holder&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The resulting &lt;em&gt;holder&lt;&#x2F;em&gt; balance after the burn is not a multiple of the &lt;em&gt;granularity&lt;&#x2F;em&gt;
defined by the token contract.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The balance of &lt;em&gt;holder&lt;&#x2F;em&gt; is inferior to the amount of tokens to burn
(i.e., resulting in a negative balance for the &lt;em&gt;holder&lt;&#x2F;em&gt;).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The address of the &lt;em&gt;holder&lt;&#x2F;em&gt; is &lt;code&gt;0x0&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;tokensToSend&lt;&#x2F;code&gt; hook of the &lt;em&gt;holder&lt;&#x2F;em&gt; &lt;code&gt;revert&lt;&#x2F;code&gt;s.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; compatibility requirement&lt;&#x2F;em&gt;:&lt;br &#x2F;&gt;
While a &lt;code&gt;Sent&lt;&#x2F;code&gt; event MUST NOT be emitted when burning;
if the token contract is &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; enabled, a &lt;code&gt;Transfer&lt;&#x2F;code&gt; event with the &lt;code&gt;to&lt;&#x2F;code&gt; parameter set to &lt;code&gt;0x0&lt;&#x2F;code&gt; SHOULD be emitted.
The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; standard does not define the concept of burning tokens, but this is a commonly accepted practice.&lt;&#x2F;p&gt;
&lt;p&gt;The token contract MAY burn tokens for multiple &lt;em&gt;holders&lt;&#x2F;em&gt; at once. In this case:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The previous burn rules MUST apply to each &lt;em&gt;holders&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The sum of all the balances decremented MUST be equal to the total burned amount.&lt;&#x2F;li&gt;
&lt;li&gt;A &lt;code&gt;Burned&lt;&#x2F;code&gt; event MUST be emitted for every &lt;em&gt;holder&lt;&#x2F;em&gt; with the corresponding amount for each &lt;em&gt;holder&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The sum of all the amounts from the &lt;code&gt;Burned&lt;&#x2F;code&gt; event MUST be equal to the total burned &lt;code&gt;amount&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;NOTE&lt;&#x2F;em&gt;: Burning an amount of zero (&lt;code&gt;0&lt;&#x2F;code&gt;) tokens is valid and MUST be treated as a regular burn.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;NOTE&lt;&#x2F;em&gt;: The &lt;code&gt;data&lt;&#x2F;code&gt; field contains information provided by the holder—similar
to the data field in a regular ether send transaction.
The &lt;code&gt;tokensToSend()&lt;&#x2F;code&gt; hook, the &lt;code&gt;tokensReceived()&lt;&#x2F;code&gt;, or both
MAY use the information to decide if they wish to reject the transaction.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;NOTE&lt;&#x2F;em&gt;: The &lt;code&gt;operatorData&lt;&#x2F;code&gt; field is analogous to the &lt;code&gt;data&lt;&#x2F;code&gt; field except it SHALL be provided by the &lt;em&gt;operator&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;Burned&lt;&#x2F;code&gt; event&lt;&#x2F;strong&gt; &lt;a id=&quot;burned&quot;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Burned&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operatorData&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Indicate the burning of &lt;code&gt;amount&lt;&#x2F;code&gt; of tokens from the &lt;code&gt;from&lt;&#x2F;code&gt; address by the &lt;code&gt;operator&lt;&#x2F;code&gt; address.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;NOTE&lt;&#x2F;em&gt;: This event MUST NOT be emitted outside of a burn process.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;small&gt;&lt;strong&gt;parameters&lt;&#x2F;strong&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;operator&lt;&#x2F;code&gt;: Address which triggered the burn.&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;from&lt;&#x2F;code&gt;: &lt;em&gt;Holder&lt;&#x2F;em&gt; whose tokens were burned.&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;amount&lt;&#x2F;code&gt;: Number of tokens burned.&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;data&lt;&#x2F;code&gt;: Information provided by the &lt;em&gt;holder&lt;&#x2F;em&gt;.&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;operatorData&lt;&#x2F;code&gt;: Information provided by the &lt;em&gt;operator&lt;&#x2F;em&gt;.&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;The &lt;code&gt;burn&lt;&#x2F;code&gt; and &lt;code&gt;operatorBurn&lt;&#x2F;code&gt; functions described below MUST be implemented to burn tokens.
Token contracts MAY implement other functions to burn tokens.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;burn&lt;&#x2F;code&gt; function&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; burn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Burn the &lt;code&gt;amount&lt;&#x2F;code&gt; of tokens from the address &lt;code&gt;msg.sender&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;em&gt;operator&lt;&#x2F;em&gt; and the &lt;em&gt;holder&lt;&#x2F;em&gt; MUST both be the &lt;code&gt;msg.sender&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;small&gt;&lt;strong&gt;identifier:&lt;&#x2F;strong&gt; &lt;code&gt;fe9d9303&lt;&#x2F;code&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;strong&gt;parameters&lt;&#x2F;strong&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;amount&lt;&#x2F;code&gt;: Number of tokens to burn.&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;data&lt;&#x2F;code&gt;: Information provided by the &lt;em&gt;holder&lt;&#x2F;em&gt;.&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;operatorBurn&lt;&#x2F;code&gt; function&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; operatorBurn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operatorData&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Burn the &lt;code&gt;amount&lt;&#x2F;code&gt; of tokens on behalf of the address &lt;code&gt;from&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Reminder&lt;&#x2F;em&gt;: If the &lt;em&gt;operator&lt;&#x2F;em&gt; address is not an authorized operator of the &lt;code&gt;from&lt;&#x2F;code&gt; address,
then the burn process MUST &lt;code&gt;revert&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;small&gt;&lt;strong&gt;identifier:&lt;&#x2F;strong&gt; &lt;code&gt;fc673c4f&lt;&#x2F;code&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;strong&gt;parameters&lt;&#x2F;strong&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;from&lt;&#x2F;code&gt;: &lt;em&gt;Holder&lt;&#x2F;em&gt; whose tokens will be burned.&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;amount&lt;&#x2F;code&gt;: Number of tokens to burn.&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;data&lt;&#x2F;code&gt;: Information provided by the &lt;em&gt;holder&lt;&#x2F;em&gt;.&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;operatorData&lt;&#x2F;code&gt;: Information provided by the &lt;em&gt;operator&lt;&#x2F;em&gt;.&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;&lt;em&gt;NOTE&lt;&#x2F;em&gt;: The &lt;em&gt;operator&lt;&#x2F;em&gt; MAY pass any information via &lt;code&gt;operatorData&lt;&#x2F;code&gt;.
The &lt;code&gt;operatorData&lt;&#x2F;code&gt; MUST only be provided by the &lt;em&gt;operator&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;NOTE&lt;&#x2F;em&gt;: &lt;code&gt;from&lt;&#x2F;code&gt; and &lt;code&gt;msg.sender&lt;&#x2F;code&gt; MAY be the same address.
I.e., an address MAY call &lt;code&gt;operatorBurn&lt;&#x2F;code&gt; for itself.
This call MUST be equivalent to &lt;code&gt;burn&lt;&#x2F;code&gt;
with the addition that the &lt;em&gt;operator&lt;&#x2F;em&gt; MAY specify an explicit value for &lt;code&gt;operatorData&lt;&#x2F;code&gt;
(which cannot be done with the &lt;code&gt;burn&lt;&#x2F;code&gt; function).&lt;&#x2F;p&gt;
&lt;h4 id=&quot;erc777tokenssender-and-the-tokenstosend-hook&quot;&gt;&lt;strong&gt;&lt;code&gt;ERC777TokensSender&lt;&#x2F;code&gt; And The &lt;code&gt;tokensToSend&lt;&#x2F;code&gt; Hook&lt;&#x2F;strong&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;tokensToSend&lt;&#x2F;code&gt; hook notifies of any request to decrement the balance (send and burn) for a given &lt;em&gt;holder&lt;&#x2F;em&gt;.
Any address (regular or contract) wishing to be notified of token debits from their address
MAY register the address of a contract implementing the &lt;code&gt;ERC777TokensSender&lt;&#x2F;code&gt; interface described below via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1820&#x2F;&quot;&gt;ERC-1820&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;This is done by calling the &lt;code&gt;setInterfaceImplementer&lt;&#x2F;code&gt; function on the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1820&#x2F;&quot;&gt;ERC-1820&lt;&#x2F;a&gt; registry
with the &lt;em&gt;holder&lt;&#x2F;em&gt; address as the address,
the &lt;code&gt;keccak256&lt;&#x2F;code&gt; hash of &lt;code&gt;ERC777TokensSender&lt;&#x2F;code&gt;
(&lt;code&gt;0x29ddb589b1fb5fc7cf394961c1adf5f8c6454761adf795e67fe149f658abe895&lt;&#x2F;code&gt;) as the interface hash,
and the address of the contract implementing the &lt;code&gt;ERC777TokensSender&lt;&#x2F;code&gt; as the implementer.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC777TokensSender&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokensToSend&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; userData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operatorData&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;em&gt;NOTE&lt;&#x2F;em&gt;: A regular address MAY register a different address—the address of a contract—implementing
the interface on its behalf.
A contract MAY register either its address or the address of another contract
but said address MUST implement the interface on its behalf.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;tokensToSend&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokensToSend&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; userData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operatorData&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Notify a request to send or burn (if &lt;code&gt;to&lt;&#x2F;code&gt; is &lt;code&gt;0x0&lt;&#x2F;code&gt;) an &lt;code&gt;amount&lt;&#x2F;code&gt; tokens from the &lt;code&gt;from&lt;&#x2F;code&gt; address to the &lt;code&gt;to&lt;&#x2F;code&gt; address
by the &lt;code&gt;operator&lt;&#x2F;code&gt; address.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;NOTE&lt;&#x2F;em&gt;: This function MUST NOT be called outside of a burn, send or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; transfer process.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;small&gt;&lt;strong&gt;identifier:&lt;&#x2F;strong&gt; &lt;code&gt;75ab9782&lt;&#x2F;code&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;strong&gt;parameters&lt;&#x2F;strong&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;operator&lt;&#x2F;code&gt;: Address which triggered the balance decrease (through sending or burning).&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;from&lt;&#x2F;code&gt;: &lt;em&gt;Holder&lt;&#x2F;em&gt; whose tokens were sent.&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;to&lt;&#x2F;code&gt;: Recipient of the tokens for a send (or &lt;code&gt;0x0&lt;&#x2F;code&gt; for a burn).&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;amount&lt;&#x2F;code&gt;: Number of tokens the &lt;em&gt;holder&lt;&#x2F;em&gt; balance is decreased by.&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;data&lt;&#x2F;code&gt;: Information provided by the &lt;em&gt;holder&lt;&#x2F;em&gt;.&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;operatorData&lt;&#x2F;code&gt;: Information provided by the &lt;em&gt;operator&lt;&#x2F;em&gt;.&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;The following rules apply when calling the &lt;code&gt;tokensToSend&lt;&#x2F;code&gt; hook:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;tokensToSend&lt;&#x2F;code&gt; hook MUST be called for every send and burn processes.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;tokensToSend&lt;&#x2F;code&gt; hook MUST be called &lt;em&gt;before&lt;&#x2F;em&gt; the state is updated—i.e. &lt;em&gt;before&lt;&#x2F;em&gt; the balance is decremented.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;operator&lt;&#x2F;code&gt; MUST be the address which triggered the send or burn process.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;from&lt;&#x2F;code&gt; MUST be the address of the &lt;em&gt;holder&lt;&#x2F;em&gt; whose tokens are sent or burned.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;to&lt;&#x2F;code&gt; MUST be the address of the &lt;em&gt;recipient&lt;&#x2F;em&gt; which receives the tokens for a send.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;to&lt;&#x2F;code&gt; MUST be &lt;code&gt;0x0&lt;&#x2F;code&gt; for a burn.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;amount&lt;&#x2F;code&gt; MUST be the number of tokens the &lt;em&gt;holder&lt;&#x2F;em&gt; sent or burned.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;data&lt;&#x2F;code&gt; MUST contain the extra information (if any) provided to the send or the burn process.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;operatorData&lt;&#x2F;code&gt; MUST contain the extra information provided by the address
which triggered the decrease of the balance (if any).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;em&gt;holder&lt;&#x2F;em&gt; MAY block a send or burn process by &lt;code&gt;revert&lt;&#x2F;code&gt;ing.
(I.e., reject the withdrawal of tokens from its account.)&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;NOTE&lt;&#x2F;em&gt;: Multiple &lt;em&gt;holders&lt;&#x2F;em&gt; MAY use the same implementation of &lt;code&gt;ERC777TokensSender&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;NOTE&lt;&#x2F;em&gt;: An address can register at most one implementation at any given time for all &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;777&#x2F;&quot;&gt;ERC-777&lt;&#x2F;a&gt; tokens.
Hence the &lt;code&gt;ERC777TokensSender&lt;&#x2F;code&gt; MUST expect to be called by different token contracts.
The &lt;code&gt;msg.sender&lt;&#x2F;code&gt; of the &lt;code&gt;tokensToSend&lt;&#x2F;code&gt; call is expected to be the address of the token contract.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; compatibility requirement&lt;&#x2F;em&gt;:&lt;br &#x2F;&gt;
This hook takes precedence over &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; and MUST be called (if registered)
when calling &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;&#x27;s &lt;code&gt;transfer&lt;&#x2F;code&gt; and &lt;code&gt;transferFrom&lt;&#x2F;code&gt; event.
When called from a &lt;code&gt;transfer&lt;&#x2F;code&gt;, &lt;code&gt;operator&lt;&#x2F;code&gt; MUST be the same value as the &lt;code&gt;from&lt;&#x2F;code&gt;.
When called from a &lt;code&gt;transferFrom&lt;&#x2F;code&gt;, &lt;code&gt;operator&lt;&#x2F;code&gt; MUST be the address which issued the &lt;code&gt;transferFrom&lt;&#x2F;code&gt; call.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;erc777tokensrecipient-and-the-tokensreceived-hook&quot;&gt;&lt;strong&gt;&lt;code&gt;ERC777TokensRecipient&lt;&#x2F;code&gt; And The &lt;code&gt;tokensReceived&lt;&#x2F;code&gt; Hook&lt;&#x2F;strong&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;tokensReceived&lt;&#x2F;code&gt; hook notifies of any increment of the balance (send and mint) for a given &lt;em&gt;recipient&lt;&#x2F;em&gt;.
Any address (regular or contract) wishing to be notified of token credits to their address
MAY register the address of a contract implementing the &lt;code&gt;ERC777TokensRecipient&lt;&#x2F;code&gt; interface described below via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1820&#x2F;&quot;&gt;ERC-1820&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;This is done by calling the &lt;code&gt;setInterfaceImplementer&lt;&#x2F;code&gt; function on the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1820&#x2F;&quot;&gt;ERC-1820&lt;&#x2F;a&gt; registry
with the &lt;em&gt;recipient&lt;&#x2F;em&gt; address as the address,
the &lt;code&gt;keccak256&lt;&#x2F;code&gt; hash of &lt;code&gt;ERC777TokensRecipient&lt;&#x2F;code&gt;
(&lt;code&gt;0xb281fc8c12954d22544db45de3159a39272895b169a852b314f9cc762e44c53b&lt;&#x2F;code&gt;) as the interface hash,
and the address of the contract implementing the &lt;code&gt;ERC777TokensRecipient&lt;&#x2F;code&gt; as the implementer.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC777TokensRecipient&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokensReceived&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operatorData&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;If the &lt;em&gt;recipient&lt;&#x2F;em&gt; is a contract, which has not registered an &lt;code&gt;ERC777TokensRecipient&lt;&#x2F;code&gt; implementation;
then the token contract:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;MUST &lt;code&gt;revert&lt;&#x2F;code&gt; if the &lt;code&gt;tokensReceived&lt;&#x2F;code&gt; hook is called from a mint or send call.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;SHOULD continue processing the transaction
if the &lt;code&gt;tokensReceived&lt;&#x2F;code&gt; hook is called from an ERC-20 &lt;code&gt;transfer&lt;&#x2F;code&gt; or &lt;code&gt;transferFrom&lt;&#x2F;code&gt; call.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;NOTE&lt;&#x2F;em&gt;: A regular address MAY register a different address—the address of a contract—implementing
the interface on its behalf.
A contract MUST register either its address or the address of another contract
but said address MUST implement the interface on its behalf.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;tokensReceived&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokensReceived&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operatorData&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Notify a send or mint (if &lt;code&gt;from&lt;&#x2F;code&gt; is &lt;code&gt;0x0&lt;&#x2F;code&gt;) of &lt;code&gt;amount&lt;&#x2F;code&gt; tokens from the &lt;code&gt;from&lt;&#x2F;code&gt; address to the &lt;code&gt;to&lt;&#x2F;code&gt; address
by the &lt;code&gt;operator&lt;&#x2F;code&gt; address.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;NOTE&lt;&#x2F;em&gt;: This function MUST NOT be called outside of a mint, send or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; transfer process.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;small&gt;&lt;strong&gt;identifier:&lt;&#x2F;strong&gt; &lt;code&gt;0023de29&lt;&#x2F;code&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;strong&gt;parameters&lt;&#x2F;strong&gt;&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;operator&lt;&#x2F;code&gt;: Address which triggered the balance increase (through sending or minting).&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;from&lt;&#x2F;code&gt;: &lt;em&gt;Holder&lt;&#x2F;em&gt; whose tokens were sent (or &lt;code&gt;0x0&lt;&#x2F;code&gt; for a mint).&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;to&lt;&#x2F;code&gt;: Recipient of the tokens.&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;amount&lt;&#x2F;code&gt;: Number of tokens the &lt;em&gt;recipient&lt;&#x2F;em&gt; balance is increased by.&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;data&lt;&#x2F;code&gt;: Information provided by the &lt;em&gt;holder&lt;&#x2F;em&gt;.&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;code&gt;operatorData&lt;&#x2F;code&gt;: Information provided by the &lt;em&gt;operator&lt;&#x2F;em&gt;.&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;The following rules apply when calling the &lt;code&gt;tokensReceived&lt;&#x2F;code&gt; hook:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;tokensReceived&lt;&#x2F;code&gt; hook MUST be called for every send and mint processes.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;tokensReceived&lt;&#x2F;code&gt; hook MUST be called &lt;em&gt;after&lt;&#x2F;em&gt; the state is updated—i.e. &lt;em&gt;after&lt;&#x2F;em&gt; the balance is incremented.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;operator&lt;&#x2F;code&gt; MUST be the address which triggered the send or mint process.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;from&lt;&#x2F;code&gt; MUST be the address of the &lt;em&gt;holder&lt;&#x2F;em&gt; whose tokens are sent for a send.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;from&lt;&#x2F;code&gt; MUST be &lt;code&gt;0x0&lt;&#x2F;code&gt; for a mint.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;to&lt;&#x2F;code&gt; MUST be the address of the &lt;em&gt;recipient&lt;&#x2F;em&gt; which receives the tokens.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;amount&lt;&#x2F;code&gt; MUST be the number of tokens the &lt;em&gt;recipient&lt;&#x2F;em&gt; sent or minted.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;data&lt;&#x2F;code&gt; MUST contain the extra information (if any) provided to the send or the mint process.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;operatorData&lt;&#x2F;code&gt; MUST contain the extra information provided by the address
which triggered the increase of the balance (if any).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;em&gt;holder&lt;&#x2F;em&gt; MAY block a send or mint process by &lt;code&gt;revert&lt;&#x2F;code&gt;ing.
(I.e., reject the reception of tokens.)&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;NOTE&lt;&#x2F;em&gt;: Multiple &lt;em&gt;holders&lt;&#x2F;em&gt; MAY use the same implementation of &lt;code&gt;ERC777TokensRecipient&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;NOTE&lt;&#x2F;em&gt;: An address can register at most one implementation at any given time for all &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;777&#x2F;&quot;&gt;ERC-777&lt;&#x2F;a&gt; tokens.
Hence the &lt;code&gt;ERC777TokensRecipient&lt;&#x2F;code&gt; MUST expect to be called by different token contracts.
The &lt;code&gt;msg.sender&lt;&#x2F;code&gt; of the &lt;code&gt;tokensReceived&lt;&#x2F;code&gt; call is expected to be the address of the token contract.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; compatibility requirement&lt;&#x2F;em&gt;:&lt;br &#x2F;&gt;
This hook takes precedence over &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; and MUST be called (if registered)
when calling &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;&#x27;s &lt;code&gt;transfer&lt;&#x2F;code&gt; and &lt;code&gt;transferFrom&lt;&#x2F;code&gt; event.
When called from a &lt;code&gt;transfer&lt;&#x2F;code&gt;, &lt;code&gt;operator&lt;&#x2F;code&gt; MUST be the same value as the &lt;code&gt;from&lt;&#x2F;code&gt;.
When called from a &lt;code&gt;transferFrom&lt;&#x2F;code&gt;, &lt;code&gt;operator&lt;&#x2F;code&gt; MUST be the address which issued the &lt;code&gt;transferFrom&lt;&#x2F;code&gt; call.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;note-on-gas-consumption&quot;&gt;&lt;strong&gt;Note On Gas Consumption&lt;&#x2F;strong&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Dapps and wallets SHOULD first estimate the gas required when sending, minting, or burning tokens—using
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;wiki&#x2F;wiki&#x2F;JSON-RPC#eth_estimategas&quot;&gt;&lt;code&gt;eth_estimateGas&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;—to avoid running out of gas during the transaction.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;logo&quot;&gt;Logo&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&quot;text-align: right&quot;&gt;&lt;strong&gt;Image&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;777&#x2F;.&#x2F;assets&#x2F;logo&#x2F;png&#x2F;ERC-777-logo-beige-48px.png&quot; alt=&quot;beige logo&quot; &#x2F;&gt;&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;777&#x2F;.&#x2F;assets&#x2F;logo&#x2F;png&#x2F;ERC-777-logo-white-48px.png&quot; alt=&quot;white logo&quot; &#x2F;&gt;&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;777&#x2F;.&#x2F;assets&#x2F;logo&#x2F;png&#x2F;ERC-777-logo-light_grey-48px.png&quot; alt=&quot;light grey logo&quot; &#x2F;&gt;&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;777&#x2F;.&#x2F;assets&#x2F;logo&#x2F;png&#x2F;ERC-777-logo-dark_grey-48px.png&quot; alt=&quot;dark grey logo&quot; &#x2F;&gt;&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;777&#x2F;.&#x2F;assets&#x2F;logo&#x2F;png&#x2F;ERC-777-logo-black-48px.png&quot; alt=&quot;black logo&quot; &#x2F;&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;strong&gt;Color&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;beige&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;white&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;light grey&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;dark grey&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;black&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;strong&gt;Hex&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;#C99D66&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;#FFFFFF&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;#EBEFF0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;#3C3C3D&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;#000000&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The logo MAY be used, modified and adapted to promote valid &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;777&#x2F;&quot;&gt;ERC-777&lt;&#x2F;a&gt; token implementations
and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;777&#x2F;&quot;&gt;ERC-777&lt;&#x2F;a&gt; compliant technologies such as wallets and dapps.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;777&#x2F;&quot;&gt;ERC-777&lt;&#x2F;a&gt; token contract authors MAY create a specific logo for their token based on this logo.&lt;&#x2F;p&gt;
&lt;p&gt;The logo MUST NOT be used to advertise, promote or associate in any way technology—such
as tokens—which is not &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;777&#x2F;&quot;&gt;ERC-777&lt;&#x2F;a&gt; compliant.&lt;&#x2F;p&gt;
&lt;p&gt;The logo for the standard can be found in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;tree&#x2F;master&#x2F;assets&#x2F;eip-777&#x2F;logo&quot;&gt;&lt;code&gt;&#x2F;assets&#x2F;eip-777&#x2F;logo&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; folder in &lt;code&gt;SVG&lt;&#x2F;code&gt; and &lt;code&gt;PNG&lt;&#x2F;code&gt; formats.
The &lt;code&gt;PNG&lt;&#x2F;code&gt; version of the logo offers a few sizes in pixels.
If needed, other sizes MAY be created by converting from &lt;code&gt;SVG&lt;&#x2F;code&gt; into &lt;code&gt;PNG&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The principal intent for this standard is
to solve some of the shortcomings of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; while maintaining backward compatibility with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;,
and avoiding the problems and vulnerabilities of &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;223&quot;&gt;EIP-223&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Below are the rationales for the decisions regarding the main aspects of the standards.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;NOTE&lt;&#x2F;em&gt;: Jacques Dafflon (&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;0xjac&quot;&gt;0xjac&lt;&#x2F;a&gt;), one of the authors of the standard,
conjointly wrote his &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;0xjac&#x2F;master-thesis&quot;&gt;master thesis&lt;&#x2F;a&gt; on the standard,
which goes in more details than could reasonably fit directly within the standard,
and can provide further clarifications regarding certain aspects or decisions.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;lifecycle&quot;&gt;Lifecycle&lt;&#x2F;h3&gt;
&lt;p&gt;More than just sending tokens, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;777&#x2F;&quot;&gt;ERC-777&lt;&#x2F;a&gt; defines the entire lifecycle of a token,
starting with the minting process, followed by the sending process and terminating with the burn process.&lt;&#x2F;p&gt;
&lt;p&gt;Having a lifecycle clearly defined is important for consistency and accuracy,
especially when value is derived from scarcity.
In contrast when looking at some &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens, a discrepancy can be observed
between the value returned by the &lt;code&gt;totalSupply&lt;&#x2F;code&gt; and the actual circulating supply,
as the standard does not clearly define a process to create and destroy tokens.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;data&quot;&gt;Data&lt;&#x2F;h3&gt;
&lt;p&gt;The mint, send and burn processes can all make use of a &lt;code&gt;data&lt;&#x2F;code&gt; and &lt;code&gt;operatorData&lt;&#x2F;code&gt; fields
which are passed to any movement (mint, send or burn).
Those fields may be empty for simple use cases,
or they may contain valuable information related to the movement of tokens,
similar to information attached to a bank transfer by the sender or the bank itself.&lt;&#x2F;p&gt;
&lt;p&gt;The use of a &lt;code&gt;data&lt;&#x2F;code&gt; field is equally present in other standard proposals such as &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;223&quot;&gt;EIP-223&lt;&#x2F;a&gt;,
and was requested by multiple members of the community who reviewed this standard.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;hooks&quot;&gt;Hooks&lt;&#x2F;h3&gt;
&lt;p&gt;In most cases, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; requires two calls to safely transfer tokens to a contract without locking them.
A call from the sender, using the &lt;code&gt;approve&lt;&#x2F;code&gt; function
and a call from the recipient using &lt;code&gt;transferFrom&lt;&#x2F;code&gt;.
Furthermore, this requires extra communication between the parties which is not clearly defined.
Finally, holders can get confused between &lt;code&gt;transfer&lt;&#x2F;code&gt; and &lt;code&gt;approve&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;transferFrom&lt;&#x2F;code&gt;.
Using the former to transfer tokens to a contract will most likely result in locked tokens.&lt;&#x2F;p&gt;
&lt;p&gt;Hooks allow streamlining of the sending process and offer a single way to send tokens to any recipient.
Thanks to the &lt;code&gt;tokensReceived&lt;&#x2F;code&gt; hook, contracts are able to react and prevent locking tokens upon reception.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;greater-control-for-holders&quot;&gt;&lt;strong&gt;Greater Control For Holders&lt;&#x2F;strong&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;tokensReceived&lt;&#x2F;code&gt; hook also allows holders to reject the reception of some tokens.
This gives greater control to holders who can accept or reject incoming tokens based on some parameters,
for example located in the &lt;code&gt;data&lt;&#x2F;code&gt; or &lt;code&gt;operatorData&lt;&#x2F;code&gt; fields.&lt;&#x2F;p&gt;
&lt;p&gt;Following the same intentions and based on suggestions from the community,
the &lt;code&gt;tokensToSend&lt;&#x2F;code&gt; hook was added to give control over and prevent the movement of outgoing tokens.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;erc-1820-registry&quot;&gt;&lt;strong&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1820&#x2F;&quot;&gt;ERC-1820&lt;&#x2F;a&gt; Registry&lt;&#x2F;strong&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1820&#x2F;&quot;&gt;ERC-1820&lt;&#x2F;a&gt; Registry allows holders to register their hooks.
Other alternatives were examined beforehand to link hooks and holders.&lt;&#x2F;p&gt;
&lt;p&gt;The first was for hooks to be defined at the sender&#x27;s or recipient&#x27;s address.
This approach is similar to &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;223&quot;&gt;EIP-223&lt;&#x2F;a&gt; which proposes a &lt;code&gt;tokenFallback&lt;&#x2F;code&gt; function on recipient contracts
to be called when receiving tokens,
but improves on it by relying on &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; for interface detection.
While straightforward to implement, this approach imposes several limitations.
In particular, the sender and recipient must be contracts in order to provide their implementation of the hooks.
Preventing externally owned addresses to benefit from hooks.
Existing contracts have a strong probability not to be compatible,
as they undoubtedly were unaware and do not define the new hooks.
Consequently existing smart contract infrastructure such as multisig wallets
which potentially hold large amounts of ether and tokens would need to be migrated to new updated contracts.&lt;&#x2F;p&gt;
&lt;p&gt;The second approach considered was to use &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;672&quot;&gt;ERC-672&lt;&#x2F;a&gt; which offered pseudo-introspection for addresses using reverse-ENS.
However, this approach relied heavily on ENS, on top of which reverse lookup would need to be implemented.
Analysis of this approach promptly revealed a certain degree of complexity and security concerns
which would transcend the benefits of approach.&lt;&#x2F;p&gt;
&lt;p&gt;The third solution—used in this standard—is to rely on a unique registry
where any address can register the addresses of contracts implementing the hooks on its behalf.
This approach has the advantage that externally owned accounts and contracts can benefit from hooks,
including existing contracts which can rely on hooks deployed on proxy contracts.&lt;&#x2F;p&gt;
&lt;p&gt;The decision was made to keep this registry in a separate EIP,
as to not over complicate this standard.
More importantly, the registry is designed in a flexible fashion,
such that other EIPs and smart contract infrastructures can benefit from it
for their own use cases, outside the realm of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;777&#x2F;&quot;&gt;ERC-777&lt;&#x2F;a&gt; and tokens.
The first proposal for this registry was &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;820&#x2F;&quot;&gt;ERC-820&lt;&#x2F;a&gt;.
Unfortunately, issues emanating from upgrades in the Solidity language to versions 0.5 and above
resulted in a bug in a separated part of the registry, which required changes.
This was discovered right after the last call period.
Attempts made to avoid creating a separate EIP, such as &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;pull&#x2F;1758&quot;&gt;ERC-820a&lt;&#x2F;a&gt;, were rejected.
Hence the standard for the registry used for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;777&#x2F;&quot;&gt;ERC-777&lt;&#x2F;a&gt; became &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1820&#x2F;&quot;&gt;ERC-1820&lt;&#x2F;a&gt;.
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1820&#x2F;&quot;&gt;ERC-1820&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;820&#x2F;&quot;&gt;ERC-820&lt;&#x2F;a&gt; are functionally equivalent. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1820&#x2F;&quot;&gt;ERC-1820&lt;&#x2F;a&gt; simply contains the fix for newer versions of Solidity.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;operators-1&quot;&gt;Operators&lt;&#x2F;h3&gt;
&lt;p&gt;The standard defines the concept of operators as any address which moves tokens.
While intuitively every address moves its own tokens,
separating the concepts of holder and operator allows for greater flexibility.
Primarily, this originates from the fact that the standard defines a mechanism for holders
to let other addresses become their operators.
Moreover, unlike the approve calls in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; where the role of an approved address is not clearly defined,
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;777&#x2F;&quot;&gt;ERC-777&lt;&#x2F;a&gt; details the intent of and interactions with operators,
including an obligation for operators to be approved,
and an irrevocable right for any holder to revoke operators.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;default-operators&quot;&gt;&lt;strong&gt;Default Operators&lt;&#x2F;strong&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Default operators were added based on community demand for pre-approved operators.
That is operators which are approved for all holders by default.
For obvious security reasons, the list of default operators is defined at the token contract creation time,
and cannot be changed.
Any holder still has the right to revoke default operators.
One of the obvious advantages of default operators is to allow ether-less movements of tokens.
Default operators offer other usability advantages,
such as allowing token providers to offer functionality in a modular way,
and to reduce the complexity for holders to use features provided through operators.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backward-compatibility&quot;&gt;Backward Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP does not introduce backward incompatibilities and is backward compatible with the older &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; token standard.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP does not use &lt;code&gt;transfer&lt;&#x2F;code&gt; and &lt;code&gt;transferFrom&lt;&#x2F;code&gt; and uses &lt;code&gt;send&lt;&#x2F;code&gt; and &lt;code&gt;operatorSend&lt;&#x2F;code&gt;
to avoid confusion and mistakes when deciphering which token standard is being used.&lt;&#x2F;p&gt;
&lt;p&gt;This standard allows the implementation of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; functions &lt;code&gt;transfer&lt;&#x2F;code&gt;, &lt;code&gt;transferFrom&lt;&#x2F;code&gt;, &lt;code&gt;approve&lt;&#x2F;code&gt; and &lt;code&gt;allowance&lt;&#x2F;code&gt;
alongside to make a token fully compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The token MAY implement &lt;code&gt;decimals()&lt;&#x2F;code&gt; for backward compatibility with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;.
If implemented, it MUST always return &lt;code&gt;18&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Therefore a token contract MAY implement both &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;777&#x2F;&quot;&gt;ERC-777&lt;&#x2F;a&gt; in parallel.
The specification of the &lt;code&gt;view&lt;&#x2F;code&gt; functions (such as &lt;code&gt;name&lt;&#x2F;code&gt;, &lt;code&gt;symbol&lt;&#x2F;code&gt;, &lt;code&gt;balanceOf&lt;&#x2F;code&gt;, &lt;code&gt;totalSupply&lt;&#x2F;code&gt;) and internal data
(such as the mapping of balances) overlap without problems.
Note however that the following functions are mandatory in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;777&#x2F;&quot;&gt;ERC-777&lt;&#x2F;a&gt; and MUST be implemented:
&lt;code&gt;name&lt;&#x2F;code&gt;, &lt;code&gt;symbol&lt;&#x2F;code&gt; &lt;code&gt;balanceOf&lt;&#x2F;code&gt; and &lt;code&gt;totalSupply&lt;&#x2F;code&gt;
(&lt;code&gt;decimals&lt;&#x2F;code&gt; is not part of the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;777&#x2F;&quot;&gt;ERC-777&lt;&#x2F;a&gt; standard).&lt;&#x2F;p&gt;
&lt;p&gt;The state-modifying functions from both standards are decoupled and can operate independently from each other.
Note that &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; functions SHOULD be limited to only being called from old contracts.&lt;&#x2F;p&gt;
&lt;p&gt;If the token implements &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;,
it MUST register the &lt;code&gt;ERC20Token&lt;&#x2F;code&gt; interface with its own address via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1820&#x2F;&quot;&gt;ERC-1820&lt;&#x2F;a&gt;.
This is done by calling the &lt;code&gt;setInterfaceImplementer&lt;&#x2F;code&gt; function on the ERC-1820 registry
with the token contract address as both the address and the implementer
and the &lt;code&gt;keccak256&lt;&#x2F;code&gt; hash of &lt;code&gt;ERC20Token&lt;&#x2F;code&gt; (&lt;code&gt;0xaea199e31a596269b42cdafd93407f14436db6e4cad65417994c2eb37381e05a&lt;&#x2F;code&gt;)
as the interface hash.&lt;&#x2F;p&gt;
&lt;p&gt;If the contract has a switch to enable or disable ERC-20 functions, every time the switch is triggered,
the token MUST register or unregister the &lt;code&gt;ERC20Token&lt;&#x2F;code&gt; interface for its own address accordingly via ERC1820.
Unregistering implies calling the &lt;code&gt;setInterfaceImplementer&lt;&#x2F;code&gt; with the token contract address as the address,
the &lt;code&gt;keccak256&lt;&#x2F;code&gt; hash of &lt;code&gt;ERC20Token&lt;&#x2F;code&gt; as the interface hash and &lt;code&gt;0x0&lt;&#x2F;code&gt; as the implementer.
(See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1820&#x2F;#set-an-interface-for-an-address&quot;&gt;Set An Interface For An Address&lt;&#x2F;a&gt; in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1820&#x2F;&quot;&gt;ERC-1820&lt;&#x2F;a&gt; for more details.)&lt;&#x2F;p&gt;
&lt;p&gt;The difference for new contracts implementing &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; is that
&lt;code&gt;tokensToSend&lt;&#x2F;code&gt; and &lt;code&gt;tokensReceived&lt;&#x2F;code&gt; hooks take precedence over &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;.
Even with an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; &lt;code&gt;transfer&lt;&#x2F;code&gt; and &lt;code&gt;transferFrom&lt;&#x2F;code&gt; call, the token contract MUST check via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1820&#x2F;&quot;&gt;ERC-1820&lt;&#x2F;a&gt;
if the &lt;code&gt;from&lt;&#x2F;code&gt; and the &lt;code&gt;to&lt;&#x2F;code&gt; address implement &lt;code&gt;tokensToSend&lt;&#x2F;code&gt; and &lt;code&gt;tokensReceived&lt;&#x2F;code&gt; hook respectively.
If any hook is implemented, it MUST be called.
Note that when calling &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; &lt;code&gt;transfer&lt;&#x2F;code&gt; on a contract, if the contract does not implement &lt;code&gt;tokensReceived&lt;&#x2F;code&gt;,
the &lt;code&gt;transfer&lt;&#x2F;code&gt; call SHOULD still be accepted even if this means the tokens will probably be locked.&lt;&#x2F;p&gt;
&lt;p&gt;The table below summarizes the different actions the token contract MUST take
when sending, minting and transferring token via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;777&#x2F;&quot;&gt;ERC-777&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;table&gt;
  &lt;tr&gt;
    &lt;th align=&quot;right&quot;&gt;ERC1820&lt;&#x2F;th&gt;
    &lt;th&gt;&lt;code&gt;to&lt;&#x2F;code&gt; address&lt;&#x2F;th&gt;
    &lt;th align=&quot;center&quot;&gt;ERC777 Sending And Minting&lt;&#x2F;th&gt;
    &lt;th align=&quot;center&quot;&gt;ERC20 &lt;code&gt;transfer&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;transferFrom&lt;&#x2F;code&gt;&lt;&#x2F;th&gt;
  &lt;&#x2F;tr&gt;
  &lt;tr&gt;
    &lt;td rowspan=&quot;2&quot; align=&quot;right&quot;&gt;
      &lt;code&gt;ERC777TokensRecipient&lt;&#x2F;code&gt;&lt;br&#x2F;&gt;registered
    &lt;&#x2F;td&gt;
    &lt;td&gt;regular address&lt;&#x2F;td&gt;
    &lt;td colspan=&quot;2&quot; rowspan=&quot;2&quot; align=&quot;center&quot;&gt;
      MUST call &lt;code&gt;tokensReceived&lt;&#x2F;code&gt;
    &lt;&#x2F;td&gt;
  &lt;&#x2F;tr&gt;
  &lt;tr&gt;
    &lt;td&gt;contract&lt;&#x2F;td&gt;
  &lt;&#x2F;tr&gt;
  &lt;tr&gt;
    &lt;td rowspan=&quot;2&quot; align=&quot;right&quot;&gt;
      &lt;code&gt;ERC777TokensRecipient&lt;&#x2F;code&gt;&lt;br&#x2F;&gt;not registered
    &lt;&#x2F;td&gt;
    &lt;td&gt;regular address&lt;&#x2F;td&gt;
    &lt;td colspan=&quot;2&quot; align=&quot;center&quot;&gt;continue&lt;&#x2F;td&gt;
  &lt;&#x2F;tr&gt;
  &lt;tr&gt;
    &lt;td&gt;contract&lt;&#x2F;td&gt;
    &lt;td align=&quot;center&quot;&gt;MUST &lt;code&gt;revert&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;
    &lt;td align=&quot;center&quot;&gt;SHOULD continue&lt;sup&gt;&lt;a id=&quot;continue-footnote-backlink&quot; href=&quot;#continue-footnote&quot;&gt;1&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;&lt;&#x2F;td&gt;
  &lt;&#x2F;tr&gt;
&lt;&#x2F;table&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;a href=&quot;#continue-footnote-backlink&quot;&gt;&lt;small id=&quot;continue-footnote&quot;&gt;1.&lt;&#x2F;small&gt;&lt;&#x2F;a&gt;
&lt;small&gt;The transaction SHOULD continue for clarity as ERC20 is not aware of hooks.&lt;&#x2F;small&gt;&lt;br &#x2F;&gt;
&lt;small&gt;However, this can result in accidentally locked tokens.&lt;&#x2F;small&gt;
&lt;small&gt;If avoiding accidentally locked tokens is paramount, the transaction MAY &lt;code&gt;revert&lt;&#x2F;code&gt;.&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;There is no particular action to take if &lt;code&gt;tokensToSend&lt;&#x2F;code&gt; is not implemented.
The movement MUST proceed and only be canceled if another condition is not respected
such as lack of funds or a &lt;code&gt;revert&lt;&#x2F;code&gt; in &lt;code&gt;tokensReceived&lt;&#x2F;code&gt; (if present).&lt;&#x2F;p&gt;
&lt;p&gt;During a send, mint and burn, the respective &lt;code&gt;Sent&lt;&#x2F;code&gt;, &lt;code&gt;Minted&lt;&#x2F;code&gt; and &lt;code&gt;Burned&lt;&#x2F;code&gt; events MUST be emitted.
Furthermore, if the token contract declares that it implements &lt;code&gt;ERC20Token&lt;&#x2F;code&gt; via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1820&#x2F;&quot;&gt;ERC-1820&lt;&#x2F;a&gt;,
the token contract SHOULD emit a &lt;code&gt;Transfer&lt;&#x2F;code&gt; event for minting and burning
and MUST emit a &lt;code&gt;Transfer&lt;&#x2F;code&gt; event for sending (as specified in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; standard).
During an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;&#x27;s &lt;code&gt;transfer&lt;&#x2F;code&gt; or &lt;code&gt;transferFrom&lt;&#x2F;code&gt; functions, a valid &lt;code&gt;Sent&lt;&#x2F;code&gt; event MUST be emitted.&lt;&#x2F;p&gt;
&lt;p&gt;Hence for any movement of tokens, two events MAY be emitted:
an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; &lt;code&gt;Transfer&lt;&#x2F;code&gt; and an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;777&#x2F;&quot;&gt;ERC-777&lt;&#x2F;a&gt; &lt;code&gt;Sent&lt;&#x2F;code&gt;, &lt;code&gt;Minted&lt;&#x2F;code&gt; or &lt;code&gt;Burned&lt;&#x2F;code&gt; (depending on the type of movement).
Third-party developers MUST be careful not to consider both events as separate movements.
As a general rule, if an application considers the token as an ERC20 token,
then only the &lt;code&gt;Transfer&lt;&#x2F;code&gt; event MUST be taken into account.
If the application considers the token as an ERC777 token,
then only the &lt;code&gt;Sent&lt;&#x2F;code&gt;, &lt;code&gt;Minted&lt;&#x2F;code&gt; and &lt;code&gt;Burned&lt;&#x2F;code&gt; events MUST be considered.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;0xjac&#x2F;ERC777&quot;&gt;repository with the reference implementation&lt;&#x2F;a&gt; contains all the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;0xjac&#x2F;ERC777&#x2F;blob&#x2F;master&#x2F;test&#x2F;ReferenceToken.test.js&quot;&gt;tests&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The GitHub repository &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;0xjac&#x2F;ERC777&quot;&gt;0xjac&#x2F;ERC777&lt;&#x2F;a&gt; contains the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;0xjac&#x2F;ERC777&#x2F;blob&#x2F;master&#x2F;contracts&#x2F;examples&#x2F;ReferenceToken.sol&quot;&gt;reference implementation&lt;&#x2F;a&gt;.
The reference implementation is also available via &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.npmjs.com&#x2F;package&#x2F;erc777&quot;&gt;npm&lt;&#x2F;a&gt; and can be installed with &lt;code&gt;npm install erc777&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Subscriptions and filters for completed transactions</title>
        <published>2017-11-09T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Jack Peterson</name><email>jack@tinybike.net</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/758/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/758/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="interface"
                label="Interface" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:758"
            label="EIP-758" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/758/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Provide a way for external callers to be notified of completed transactions, and access the return data of functions executed when a transaction is mined.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;When a new transaction is submitted successfully to an Ethereum node, the node responds with the transaction&#x27;s hash.  If the transaction involved the execution of a contract function that returns data, the data is discarded.  If the return data is state-dependent, which is common, there is no straightforward way for the caller to access or compute the return data.  This EIP proposes that callers should be able to subscribe to (or poll for) completed transactions.  The Ethereum node sends the return data to the caller when the transactions are sealed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;External callers presently have no way of accessing return data from Ethereum, if the function was executed via &lt;code&gt;eth_sendTransaction&lt;&#x2F;code&gt; or &lt;code&gt;eth_sendRawTransaction&lt;&#x2F;code&gt; RPC request.  Access to function return data is in many cases a desirable feature.  Making return data available to external callers also addresses the inconsistency between internal callers, which have access to return data within the context of the transaction, and external callers, which do not.  Presently, a common workaround is to log the return data, which is bad for several reasons: it contributes to chain bloat, imposes additional gas costs on the caller, and can result in unused logs being written if the externally called function involves other (internal) function calls that log their return data.  While implementing the original version of this EIP, it was decided to expand this functionality slightly to allow for external callers to be notified of their completed transactions even in the case where there is &lt;em&gt;no&lt;&#x2F;em&gt; return data.  This could be either because the method called doesn&#x27;t return a value, or because the transaction is a simple transfer of value.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;subscription&quot;&gt;Subscription&lt;&#x2F;h3&gt;
&lt;p&gt;A caller who wants to be notified when transactions of theirs complete sends an &lt;code&gt;eth_subscribe&lt;&#x2F;code&gt; RPC request with the first parameter &lt;code&gt;&quot;completedTransaction&quot;&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;method&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_subscribe&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;completedTransaction&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;filter&lt;&#x2F;code&gt; parameter is a dictionary containing 3 optional named arguments:  &lt;code&gt;from&lt;&#x2F;code&gt;, &lt;code&gt;to&lt;&#x2F;code&gt;, and &lt;code&gt;hasReturnData&lt;&#x2F;code&gt;.  &lt;code&gt;from&lt;&#x2F;code&gt; and &lt;code&gt;to&lt;&#x2F;code&gt; can each either be single addresses, or a list of addresses.  They are used to filter out any transactions not sent from an address in the &lt;code&gt;from&lt;&#x2F;code&gt; list and sent to an address in the to list.  &lt;code&gt;hasReturnData&lt;&#x2F;code&gt; is a boolean--if it is specified and &lt;code&gt;true&lt;&#x2F;code&gt;, then notifications will be received only for completed transactions containing returnData.&lt;&#x2F;p&gt;
&lt;p&gt;For example, to restrict results to contract creations originating from either of two addresses (0x3f7d39bDBf1f5cE649c194571aEd3D2BbB2F85ce or 0x7097f41F1C1847D52407C629d0E0ae0fDD24fd58):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;filter = &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;from&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; :&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x3f7d39bDBf1f5cE649c194571aEd3D2BbB2F85ce&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;                      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x7097f41F1C1847D52407C629d0E0ae0fDD24fd58&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;           &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; :&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;To restrict results to method calls on contract address 0xD9Cb531aB97A652c8fC60dcF6D263fcA2F5764e9:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;filter = &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; :&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xD9Cb531aB97A652c8fC60dcF6D263fcA2F5764e9&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;hasReturnData&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; :&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Or to be notified of any transactions submitted by this rpc client when they complete, with no further restrictions:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;filter = &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;After the request is received, the Ethereum node responds with a subscription ID:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x00000000000000000000000000000b0b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Suppose the caller then submits a transaction via &lt;code&gt;eth_sendTransaction&lt;&#x2F;code&gt; or &lt;code&gt;eth_sendRawTransaction&lt;&#x2F;code&gt; RPC request which has the transaction hash &lt;code&gt;&quot;0x00000000000000000000000000000000000000000000000000000000deadbeef&quot;&lt;&#x2F;code&gt;.  When the transaction is sealed (mined), the Ethereum node pushes a notification to the caller.  If the transaction is a method call on a contract, this will include the return value (eg. &lt;code&gt;&quot;0x000000000000000000000000000000000000000000000000000000000000002a&quot;&lt;&#x2F;code&gt;) of the called function:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;method&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_subscription&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;transactionHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x00000000000000000000000000000000000000000000000000000000deadbeef&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;returnData&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x000000000000000000000000000000000000000000000000000000000000002a&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;subscription&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x00000000000000000000000000000b0b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The caller receives notifications about their transactions in two cases: first when a transaction is sealed, and again (with an extra &lt;code&gt;&quot;removed&quot;: true&lt;&#x2F;code&gt; field) if a transaction is affected by a chain reorganization.  Notifications are sent to the client for all transactions submitted from the client that are sealed &lt;em&gt;after&lt;&#x2F;em&gt; subscribing.  If &lt;code&gt;from&lt;&#x2F;code&gt;, &lt;code&gt;to&lt;&#x2F;code&gt;, or &lt;code&gt;hasReturnData&lt;&#x2F;code&gt; is specified, then only those matching the filter criteria will generate notifications.  As with other subscriptions, the caller can send an &lt;code&gt;eth_unsubscribe&lt;&#x2F;code&gt; RPC request to stop receiving push notifications:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;method&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_unsubscribe&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x00000000000000000000000000000b0b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;polling&quot;&gt;Polling&lt;&#x2F;h3&gt;
&lt;p&gt;Push notifications require full duplex connections (i.e., websocket or IPC).  Instead of subscribing, callers using HTTP send an &lt;code&gt;eth_newCompletedTransactionFilter&lt;&#x2F;code&gt; request:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;method&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_newCompletedTransactionFilter&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The Ethereum node responds with a filter ID:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;When a transaction is submitted, the Ethereum node pushes the transaction notification, including return value, into a queue which is emptied when the caller polls using &lt;code&gt;eth_getFilterChanges&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;method&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_getFilterChanges&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;params&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The node responds with an array of transaction hashes and their corresponding return data, in the order they were computed:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;transactionHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x00000000000000000000000000000000000000000000000000000000deadbeef&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;returnData&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x000000000000000000000000000000000000000000000000000000000000002a&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;All transactions that were sealed &lt;em&gt;after&lt;&#x2F;em&gt; the initial &lt;code&gt;eth_newCompletedTransactionFilter&lt;&#x2F;code&gt; request are included in this array.  Again, if the &lt;code&gt;filter&lt;&#x2F;code&gt; param is a non-empty dictionary (contains either &lt;code&gt;from&lt;&#x2F;code&gt;, &lt;code&gt;to&lt;&#x2F;code&gt;, or &lt;code&gt;hasReturnData&lt;&#x2F;code&gt;) then only transactions matching the filter criteria generate notifications.  Note that in the polling case, there is no way for the Ethereum node to be sure that an RPC client which submits a transaction was the same as the one who created the filter, so there is no restriction based on where the transaction was submitted.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;658&#x2F;&quot;&gt;EIP-658&lt;&#x2F;a&gt; originally proposed adding return data to transaction receipts.  However, return data is not charged for (as it is not stored on the blockchain), so adding it to transaction receipts could result in DoS and spam opportunities.  Instead, a simple Boolean &lt;code&gt;status&lt;&#x2F;code&gt; field was added to transaction receipts.  This modified version of EIP 658 was included in the Byzantium hard fork.  While the &lt;code&gt;status&lt;&#x2F;code&gt; field is useful, applications often need the return data as well.&lt;&#x2F;p&gt;
&lt;p&gt;The primary advantage of using the strategy outlined here is efficiency: no extra data needs to be stored on the blockchain, and minimal extra computational load is imposed on nodes.  Although after-the-fact lookups of the return value would not be supported, this is consistent with the conventional use of return data, which are only accessible to the caller when the function returns, and are not stored for later use.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>General data key&#x2F;value store and execution</title>
        <published>2017-10-02T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Fabian Vogelsteller</name><uri>https://github.com/frozeman</uri>
	</author>
	
	<author>
		<name>Tyler Yasaka</name><uri>https://github.com/tyleryasaka</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/725/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/discussion-for-eip725/12158" />
        

        <id>https://wg-eips.ritovision.com/725/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:725"
            label="ERC-725" />
        

        
        

        
        <summary type="html">An interface for a smart contract based account with attachable data key&#x2F;value store</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/725/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The following describes two standards that allow for a generic data storage in a smart contract and a generic execution through a smart contract. These can be used separately or in conjunction and can serve as building blocks for smart contract accounts, upgradable metadata, and other means.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The initial motivation came out of the need to create a smart contract account system that&#x27;s flexible enough to be viable long-term but also defined enough to be standardized. They are a generic set of two standardized building blocks to be used in all forms of smart contracts.&lt;&#x2F;p&gt;
&lt;p&gt;This standard consists of two sub-standards, a generic data key&#x2F;value store (&lt;code&gt;ERC725Y&lt;&#x2F;code&gt;) and a generic execute function (&lt;code&gt;ERC725X&lt;&#x2F;code&gt;). Both of these in combination allow for a very flexible and long-lasting account system. The account version of &lt;code&gt;ERC725&lt;&#x2F;code&gt; is standardized under &lt;code&gt;LSP0-ERC725Account&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;These standards (&lt;code&gt;ERC725&lt;&#x2F;code&gt; X and Y) can also be used separately as &lt;code&gt;ERC725Y&lt;&#x2F;code&gt; can be used to enhance NFTs and Token metadata or other types of smart contracts. &lt;code&gt;ERC725X&lt;&#x2F;code&gt; allows for a generic execution through a smart contract, functioning as an account or actor.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;ownership&quot;&gt;Ownership&lt;&#x2F;h3&gt;
&lt;p&gt;This contract is controlled by a single owner. The owner can be a smart contract or an external account.
This standard requires &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;173&#x2F;&quot;&gt;ERC-173&lt;&#x2F;a&gt; and SHOULD implement the functions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;owner() view&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;transferOwnership(address newOwner)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;And the event:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;OwnershipTransferred(address indexed previousOwner, address indexed newOwner)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;hr &#x2F;&gt;
&lt;h3 id=&quot;erc725x&quot;&gt;&lt;code&gt;ERC725X&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;ERC725X&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; interface id according to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt;: &lt;code&gt;0x7545acac&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Smart contracts implementing the &lt;code&gt;ERC725X&lt;&#x2F;code&gt; standard MUST implement the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; &lt;code&gt;supportsInterface(..)&lt;&#x2F;code&gt; function and MUST support the &lt;code&gt;ERC165&lt;&#x2F;code&gt; and &lt;code&gt;ERC725X&lt;&#x2F;code&gt; interface ids.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;erc725x-methods&quot;&gt;&lt;code&gt;ERC725X&lt;&#x2F;code&gt; Methods&lt;&#x2F;h3&gt;
&lt;p&gt;Smart contracts implementing the &lt;code&gt;ERC725X&lt;&#x2F;code&gt; standard SHOULD implement all of the functions listed below:&lt;&#x2F;p&gt;
&lt;h4 id=&quot;execute&quot;&gt;execute&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; execute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operationType&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; target&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Function Selector: &lt;code&gt;0x44c028fe&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Executes a call on any other smart contracts or address, transfers the blockchains native token, or deploys a new smart contract.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Parameters:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;operationType&lt;&#x2F;code&gt;: the operation type used to execute.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;target&lt;&#x2F;code&gt;: the smart contract or address to call. &lt;code&gt;target&lt;&#x2F;code&gt; will be unused if a contract is created (operation types 1 and 2).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;value&lt;&#x2F;code&gt;: the amount of native tokens to transfer (in Wei).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;data&lt;&#x2F;code&gt;: the call data, or the creation bytecode of the contract to deploy.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;Requirements:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;MUST only be called by the current owner of the contract.&lt;&#x2F;li&gt;
&lt;li&gt;MUST revert when the execution or the contract creation fails.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;target&lt;&#x2F;code&gt; SHOULD be address(0) in case of contract creation with &lt;code&gt;CREATE&lt;&#x2F;code&gt; and &lt;code&gt;CREATE2&lt;&#x2F;code&gt; (operation types 1 and 2).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;value&lt;&#x2F;code&gt; SHOULD be zero in case of &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; or &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; (operation types 3 and 4).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;Returns:&lt;&#x2F;em&gt; &lt;code&gt;bytes&lt;&#x2F;code&gt; , the returned data of the called function, or the address of the contract deployed (operation types 1 and 2).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Triggers Event:&lt;&#x2F;strong&gt; &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;725&#x2F;#contractcreated&quot;&gt;ContractCreated&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;725&#x2F;#executed&quot;&gt;Executed&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The following &lt;code&gt;operationType&lt;&#x2F;code&gt; COULD exist:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;0&lt;&#x2F;code&gt; for &lt;code&gt;CALL&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;1&lt;&#x2F;code&gt; for &lt;code&gt;CREATE&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;2&lt;&#x2F;code&gt; for &lt;code&gt;CREATE2&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;3&lt;&#x2F;code&gt; for &lt;code&gt;STATICCALL&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;4&lt;&#x2F;code&gt; for &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; - &lt;strong&gt;NOTE&lt;&#x2F;strong&gt; This is a potentially dangerous operation type&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Others may be added in the future.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;data-parameter&quot;&gt;data parameter&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;For operationType, &lt;code&gt;CALL&lt;&#x2F;code&gt;, &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; and &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; the data field can be random bytes or an abi-encoded function call.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;For operationType, &lt;code&gt;CREATE&lt;&#x2F;code&gt; the &lt;code&gt;data&lt;&#x2F;code&gt; field is the creation bytecode of the contract to deploy appended with the constructor argument(s) abi-encoded.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;For operationType, &lt;code&gt;CREATE2&lt;&#x2F;code&gt; the &lt;code&gt;data&lt;&#x2F;code&gt; field is the creation bytecode of the contract to deploy appended with:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;the constructor argument(s) abi-encoded&lt;&#x2F;li&gt;
&lt;li&gt;a &lt;code&gt;bytes32&lt;&#x2F;code&gt; salt.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;data = &amp;lt;contract-creation-code&amp;gt; + &amp;lt;abi-encoded-constructor-arguments&amp;gt; + &amp;lt;bytes32-salt&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;blockquote&gt;
&lt;p&gt;See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1014&#x2F;&quot;&gt;EIP-1014: Skinny CREATE2&lt;&#x2F;a&gt; for more information.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h4 id=&quot;executebatch&quot;&gt;executeBatch&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; executeBatch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operationsType&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; targets&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; values&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; datas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Function Selector: &lt;code&gt;0x31858452&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Executes a batch of calls on any other smart contracts, transfers the blockchain native token, or deploys a new smart contract.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Parameters:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;operationsType&lt;&#x2F;code&gt;: the list of operations type used to execute.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;targets&lt;&#x2F;code&gt;: the list of addresses to call. &lt;code&gt;targets&lt;&#x2F;code&gt; will be unused if a contract is created (operation types 1 and 2).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;values&lt;&#x2F;code&gt;: the list of native token amounts to transfer (in Wei).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;datas&lt;&#x2F;code&gt;: the list of call data, or the creation bytecode of the contract to deploy.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;Requirements:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Parameters array MUST have the same length.&lt;&#x2F;li&gt;
&lt;li&gt;MUST only be called by the current owner of the contract.&lt;&#x2F;li&gt;
&lt;li&gt;MUST revert when the execution or the contract creation fails.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;target&lt;&#x2F;code&gt; SHOULD be address(0) in case of contract creation with &lt;code&gt;CREATE&lt;&#x2F;code&gt; and &lt;code&gt;CREATE2&lt;&#x2F;code&gt; (operation types 1 and 2).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;value&lt;&#x2F;code&gt; SHOULD be zero in case of &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; or &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; (operation types 3 and 4).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;Returns:&lt;&#x2F;em&gt; &lt;code&gt;bytes[]&lt;&#x2F;code&gt; , array list of returned data of the called function, or the address(es) of the contract deployed (operation types 1 and 2).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Triggers Event:&lt;&#x2F;strong&gt; &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;725&#x2F;#contractcreated&quot;&gt;ContractCreated&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;725&#x2F;#executed&quot;&gt;Executed&lt;&#x2F;a&gt; on each call iteration&lt;&#x2F;p&gt;
&lt;h3 id=&quot;erc725x-events&quot;&gt;&lt;code&gt;ERC725X&lt;&#x2F;code&gt; Events&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;executed&quot;&gt;Executed&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Executed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operationType&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; target&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;MUST be triggered when &lt;code&gt;execute&lt;&#x2F;code&gt; creates a new call using the &lt;code&gt;operationType&lt;&#x2F;code&gt; &lt;code&gt;0&lt;&#x2F;code&gt;, &lt;code&gt;3&lt;&#x2F;code&gt;, &lt;code&gt;4&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;contractcreated&quot;&gt;ContractCreated&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ContractCreated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operationType&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contractAddress&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; salt&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;MUST be triggered when &lt;code&gt;execute&lt;&#x2F;code&gt; creates a new contract using the &lt;code&gt;operationType&lt;&#x2F;code&gt; &lt;code&gt;1&lt;&#x2F;code&gt;, &lt;code&gt;2&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;hr &#x2F;&gt;
&lt;h3 id=&quot;erc725y&quot;&gt;&lt;code&gt;ERC725Y&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;ERC725Y&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; interface id according to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt;: &lt;code&gt;0x629aa694&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Smart contracts implementing the &lt;code&gt;ERC725Y&lt;&#x2F;code&gt; standard MUST implement the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; &lt;code&gt;supportsInterface(..)&lt;&#x2F;code&gt; function and MUST support the &lt;code&gt;ERC165&lt;&#x2F;code&gt; and &lt;code&gt;ERC725Y&lt;&#x2F;code&gt; interface ids.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;erc725y-methods&quot;&gt;&lt;code&gt;ERC725Y&lt;&#x2F;code&gt; Methods&lt;&#x2F;h3&gt;
&lt;p&gt;Smart contracts implementing the &lt;code&gt;ERC725Y&lt;&#x2F;code&gt; standard MUST implement all of the functions listed below:&lt;&#x2F;p&gt;
&lt;h4 id=&quot;getdata&quot;&gt;getData&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; dataKey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Function Selector: &lt;code&gt;0x54f6127f&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Gets the data set for the given data key.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Parameters:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;dataKey&lt;&#x2F;code&gt;: the data key which value to retrieve.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;Returns:&lt;&#x2F;em&gt; &lt;code&gt;bytes&lt;&#x2F;code&gt; , The data for the requested data key.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;getdatabatch&quot;&gt;getDataBatch&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getDataBatch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; dataKeys&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Function Selector: &lt;code&gt;0xdedff9c6&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Gets array of data at multiple given data keys.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Parameters:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;dataKeys&lt;&#x2F;code&gt;: the data keys which values to retrieve.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;Returns:&lt;&#x2F;em&gt; &lt;code&gt;bytes[]&lt;&#x2F;code&gt; , array of data values for the requested data keys.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;setdata&quot;&gt;setData&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; dataKey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; dataValue&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Function Selector: &lt;code&gt;0x7f23690c&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Sets data as bytes in the storage for a single data key.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Parameters:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;dataKey&lt;&#x2F;code&gt;: the data key which value to set.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;dataValue&lt;&#x2F;code&gt;: the data to store.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;Requirements:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;MUST only be called by the current owner of the contract.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Triggers Event:&lt;&#x2F;strong&gt; &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;725&#x2F;#datachanged&quot;&gt;DataChanged&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;setdatabatch&quot;&gt;setDataBatch&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setDataBatch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; dataKeys&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; dataValues&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Function Selector: &lt;code&gt;0x97902421&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Sets array of data at multiple data keys. MUST only be called by the current owner of the contract.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Parameters:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;dataKeys&lt;&#x2F;code&gt;: the data keys which values to set.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;dataValues&lt;&#x2F;code&gt;: the array of bytes to set.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;Requirements:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Array parameters MUST have the same length.&lt;&#x2F;li&gt;
&lt;li&gt;MUST only be called by the current owner of the contract.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Triggers Event:&lt;&#x2F;strong&gt; &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;725&#x2F;#datachanged&quot;&gt;DataChanged&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;erc725y-events&quot;&gt;&lt;code&gt;ERC725Y&lt;&#x2F;code&gt; Events&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;datachanged&quot;&gt;DataChanged&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DataChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; dataKey&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; dataValue&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;MUST be triggered when a data key was successfully set.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;erc725y-data-keys&quot;&gt;&lt;code&gt;ERC725Y&lt;&#x2F;code&gt; Data keys&lt;&#x2F;h3&gt;
&lt;p&gt;Data keys, are the way to retrieve values via &lt;code&gt;getData()&lt;&#x2F;code&gt;. These &lt;code&gt;bytes32&lt;&#x2F;code&gt; values can be freely chosen, or defined by a standard.
A common way to define data keys is the hash of a word, e.g. &lt;code&gt;keccak256(&#x27;ERCXXXMyNewKeyType&#x27;)&lt;&#x2F;code&gt; which results in: &lt;code&gt;0x6935a24ea384927f250ee0b954ed498cd9203fc5d2bf95c735e52e6ca675e047&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;LSP2-ERC725JSONSchema&lt;&#x2F;code&gt; standard is a more explicit &lt;code&gt;ERC725Y&lt;&#x2F;code&gt; data key standard, that defines key types and value types, and their encoding and decoding.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The generic way of storing data keys with values was chosen to allow upgradability over time. Stored data values can be changed over time. Other smart contract protocols can then interpret this data in new ways and react to interactions from a &lt;code&gt;ERC725&lt;&#x2F;code&gt; smart contract differently.&lt;&#x2F;p&gt;
&lt;p&gt;The data stored in an &lt;code&gt;ERC725Y&lt;&#x2F;code&gt; smart contract is not only readable&#x2F;writable by off-chain applications, but also by other smart contracts. Function overloading was used to allow for the retrievable of single and multiple keys, to keep gas costs minimal for both use cases.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;All contracts since &lt;code&gt;ERC725v2&lt;&#x2F;code&gt; from 2018&#x2F;19 should be compatible with the current version of the standard. Mainly interface ID and Event parameters have changed, while &lt;code&gt;getData(bytes32[])&lt;&#x2F;code&gt; and &lt;code&gt;setData(bytes32[], bytes[])&lt;&#x2F;code&gt; was added as an efficient way to set&#x2F;get multiple keys at once. The same applies to execution, as &lt;code&gt;execute(..[])&lt;&#x2F;code&gt; was added as an efficient way to batch calls.&lt;&#x2F;p&gt;
&lt;p&gt;From 2023 onward, overloading was removed from &lt;code&gt;ERC-725&lt;&#x2F;code&gt; (including &lt;code&gt;ERC725-X&lt;&#x2F;code&gt; and &lt;code&gt;ERC725-Y&lt;&#x2F;code&gt;). This is because, while overloading is accommodated in Solidity, it isn&#x27;t broadly supported across most blockchain languages. In order to make the standard language-independent, it was decided to shift from overloading to simply attach the term &quot;Batch&quot; to the functions that accept an array as parameters.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Reference implementations can be found in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;725&#x2F;.&#x2F;assets&#x2F;ERC725.sol&quot;&gt;&lt;code&gt;ERC725.sol&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This contract allows generic executions, therefore special care needs to be taken to prevent re-entrancy attacks and other forms of call chain attacks.&lt;&#x2F;p&gt;
&lt;p&gt;When using the operation type &lt;code&gt;4&lt;&#x2F;code&gt; for &lt;code&gt;delegatecall&lt;&#x2F;code&gt;, it is important to consider that the called contracts can alter the state of the calling contract and also change owner variables and &lt;code&gt;ERC725Y&lt;&#x2F;code&gt; data storage entries at will. Additionally calls to &lt;code&gt;selfdestruct&lt;&#x2F;code&gt; are possible and other harmful state-changing operations.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;solidity-interfaces&quot;&gt;Solidity Interfaces&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SPDX-License-Identifier: CC0-1.0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; &amp;gt;=0.5.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0.7&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC165 identifier: `0x7545acac`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC725X&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is ERC165, ERC173 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Executed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operationType&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; target&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;  value&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ContractCreated&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operationType&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contractAddress&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; salt&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; execute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operationType&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; target&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; executeBatch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; operationsType&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; targets&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; values&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; datas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ERC165 identifier: `0x629aa694`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC725Y&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is ERC165, ERC173 &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DataChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; dataKey&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; dataValue&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; dataKey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getDataBatch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; dataKeys&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; dataKey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; dataValue&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setDataBatch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; dataKeys&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; dataValues&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC725&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; is IERC725X, IERC725Y &lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Typed structured data hashing and signing</title>
        <published>2017-09-12T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Remco Bloemen</name><uri>https://github.com/Recmo</uri>
	</author>
	
	<author>
		<name>Leonid Logvinov</name><uri>https://github.com/LogvinovLeon</uri>
	</author>
	
	<author>
		<name>Jacob Evans</name><uri>https://github.com/dekz</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/712/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-712-eth-signtypeddata-as-a-standard-for-machine-verifiable-and-human-readable-typed-data-signing/397" />
        

        <id>https://wg-eips.ritovision.com/712/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="interface"
                label="Interface" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:712"
            label="EIP-712" />
        

        
        

        
        <summary type="html">A procedure for hashing and signing of typed structured data as opposed to just bytestrings.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/712/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This is a standard for hashing and signing of typed structured data as opposed to just bytestrings. It includes a&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;theoretical framework for correctness of encoding functions,&lt;&#x2F;li&gt;
&lt;li&gt;specification of structured data similar to and compatible with Solidity structs,&lt;&#x2F;li&gt;
&lt;li&gt;safe hashing algorithm for instances of those structures,&lt;&#x2F;li&gt;
&lt;li&gt;safe inclusion of those instances in the set of signable messages,&lt;&#x2F;li&gt;
&lt;li&gt;an extensible mechanism for domain separation,&lt;&#x2F;li&gt;
&lt;li&gt;new RPC call &lt;code&gt;eth_signTypedData&lt;&#x2F;code&gt;, and&lt;&#x2F;li&gt;
&lt;li&gt;an optimized implementation of the hashing algorithm in EVM.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;It does not include replay protection.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Signing data is a solved problem if all we care about are bytestrings. Unfortunately in the real world we care about complex meaningful messages. Hashing structured data is non-trivial and errors result in loss of the security properties of the system.&lt;&#x2F;p&gt;
&lt;p&gt;As such, the adage &quot;don&#x27;t roll your own crypto&quot; applies. Instead, a peer-reviewed well-tested standard method needs to be used. This EIP aims to be that standard.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP aims to improve the usability of off-chain message signing for use on-chain. We are seeing growing adoption of off-chain message signing as it saves gas and reduces the number of transactions on the blockchain. Currently signed messages are an opaque hex string displayed to the user with little context about the items that make up the message.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;.&#x2F;assets&#x2F;eth_sign.png&quot; alt=&quot;eth_sign screenshot&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Here we outline a scheme to encode data along with its structure which allows it to be displayed to the user for verification when signing. Below is an example of what a user could be shown when signing a message according to the present proposal.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;.&#x2F;assets&#x2F;eth_signTypedData.png&quot; alt=&quot;eth_signTypedData screenshot&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The set of signable messages is extended from transactions and bytestrings &lt;code&gt;𝕋 ∪ 𝔹⁸ⁿ&lt;&#x2F;code&gt; to also include structured data &lt;code&gt;𝕊&lt;&#x2F;code&gt;. The new set of signable messages is thus &lt;code&gt;𝕋 ∪ 𝔹⁸ⁿ ∪ 𝕊&lt;&#x2F;code&gt;. They are encoded to bytestrings suitable for hashing and signing as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;encode(transaction : 𝕋) = RLP_encode(transaction)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;encode(message : 𝔹⁸ⁿ) = &quot;\x19Ethereum Signed Message:\n&quot; ‖ len(message) ‖ message&lt;&#x2F;code&gt; where &lt;code&gt;len(message)&lt;&#x2F;code&gt; is the &lt;em&gt;non-zero-padded&lt;&#x2F;em&gt; ascii-decimal encoding of the number of bytes in &lt;code&gt;message&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;encode(domainSeparator : 𝔹²⁵⁶, message : 𝕊) = &quot;\x19\x01&quot; ‖ domainSeparator ‖ hashStruct(message)&lt;&#x2F;code&gt; where &lt;code&gt;domainSeparator&lt;&#x2F;code&gt; and &lt;code&gt;hashStruct(message)&lt;&#x2F;code&gt; are defined below.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This encoding is deterministic because the individual components are. The encoding is injective because the three cases always differ in first byte. (&lt;code&gt;RLP_encode(transaction)&lt;&#x2F;code&gt; does not start with &lt;code&gt;\x19&lt;&#x2F;code&gt;.)&lt;&#x2F;p&gt;
&lt;p&gt;The encoding is compliant with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;191&#x2F;&quot;&gt;ERC-191&lt;&#x2F;a&gt;. The &#x27;version byte&#x27; is fixed to &lt;code&gt;0x01&lt;&#x2F;code&gt;, the &#x27;version specific data&#x27; is the 32-byte domain separator &lt;code&gt;domainSeparator&lt;&#x2F;code&gt; and the &#x27;data to sign&#x27; is the 32-byte &lt;code&gt;hashStruct(message)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;definition-of-typed-structured-data-s&quot;&gt;Definition of typed structured data &lt;code&gt;𝕊&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;To define the set of all structured data, we start with defining acceptable types. Like ABIv2 these are closely related to Solidity types. It is illustrative to adopt Solidity notation to explain the definitions. The standard is specific to the Ethereum Virtual Machine, but aims to be agnostic to higher level languages. Example:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Mail&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; from&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; to&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span&gt; contents&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Definition&lt;&#x2F;strong&gt;: A &lt;em&gt;struct type&lt;&#x2F;em&gt; has valid identifier as name and contains zero or more member variables. Member variables have a member type and a name.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Definition&lt;&#x2F;strong&gt;: A &lt;em&gt;member type&lt;&#x2F;em&gt; can be either an atomic type, a dynamic type or a reference type.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Definition&lt;&#x2F;strong&gt;: The &lt;em&gt;atomic types&lt;&#x2F;em&gt; are &lt;code&gt;bytes1&lt;&#x2F;code&gt; to &lt;code&gt;bytes32&lt;&#x2F;code&gt;, &lt;code&gt;uint8&lt;&#x2F;code&gt; to &lt;code&gt;uint256&lt;&#x2F;code&gt;, &lt;code&gt;int8&lt;&#x2F;code&gt; to &lt;code&gt;int256&lt;&#x2F;code&gt;, &lt;code&gt;bool&lt;&#x2F;code&gt; and &lt;code&gt;address&lt;&#x2F;code&gt;. These correspond to their definition in Solidity. Note that there are no aliases &lt;code&gt;uint&lt;&#x2F;code&gt; and &lt;code&gt;int&lt;&#x2F;code&gt;. Note that contract addresses are always plain &lt;code&gt;address&lt;&#x2F;code&gt;. Fixed point numbers are not supported by the standard. Future versions of this standard may add new atomic types.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Definition&lt;&#x2F;strong&gt;: The &lt;em&gt;dynamic types&lt;&#x2F;em&gt; are &lt;code&gt;bytes&lt;&#x2F;code&gt; and &lt;code&gt;string&lt;&#x2F;code&gt;. These are like the atomic types for the purpose of type declaration, but their treatment in encoding is different.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Definition&lt;&#x2F;strong&gt;: The &lt;em&gt;reference types&lt;&#x2F;em&gt; are arrays and structs. Arrays are either fixed size or dynamic and denoted by &lt;code&gt;Type[n]&lt;&#x2F;code&gt; or &lt;code&gt;Type[]&lt;&#x2F;code&gt; respectively. Structs are references to other structs by their name. The standard supports recursive struct types.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Definition&lt;&#x2F;strong&gt;: The set of structured typed data &lt;code&gt;𝕊&lt;&#x2F;code&gt; contains all the instances of all the struct types.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;definition-of-hashstruct&quot;&gt;Definition of &lt;code&gt;hashStruct&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;hashStruct&lt;&#x2F;code&gt; function is defined as&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;hashStruct(s : 𝕊) = keccak256(typeHash ‖ encodeData(s))&lt;&#x2F;code&gt; where &lt;code&gt;typeHash = keccak256(encodeType(typeOf(s)))&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;&#x2F;strong&gt;: The &lt;code&gt;typeHash&lt;&#x2F;code&gt; is a constant for a given struct type and does not need to be runtime computed.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;definition-of-encodetype&quot;&gt;Definition of &lt;code&gt;encodeType&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The type of a struct is encoded as &lt;code&gt;name ‖ &quot;(&quot; ‖ member₁ ‖ &quot;,&quot; ‖ member₂ ‖ &quot;,&quot; ‖ … ‖ memberₙ &quot;)&quot;&lt;&#x2F;code&gt; where each member is written as &lt;code&gt;type ‖ &quot; &quot; ‖ name&lt;&#x2F;code&gt;. For example, the above &lt;code&gt;Mail&lt;&#x2F;code&gt; struct is encoded as &lt;code&gt;Mail(address from,address to,string contents)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;If the struct type references other struct types (and these in turn reference even more struct types), then the set of referenced struct types is collected, sorted by name and appended to the encoding. An example encoding is &lt;code&gt;Transaction(Person from,Person to,Asset tx)Asset(address token,uint256 amount)Person(address wallet,string name)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;definition-of-encodedata&quot;&gt;Definition of &lt;code&gt;encodeData&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The encoding of a struct instance is &lt;code&gt;enc(value₁) ‖ enc(value₂) ‖ … ‖ enc(valueₙ)&lt;&#x2F;code&gt;, i.e. the concatenation of the encoded member values in the order that they appear in the type. Each encoded member value is exactly 32-byte long.&lt;&#x2F;p&gt;
&lt;p&gt;The atomic values are encoded as follows: Boolean &lt;code&gt;false&lt;&#x2F;code&gt; and &lt;code&gt;true&lt;&#x2F;code&gt; are encoded as &lt;code&gt;uint256&lt;&#x2F;code&gt; values &lt;code&gt;0&lt;&#x2F;code&gt; and &lt;code&gt;1&lt;&#x2F;code&gt; respectively. Addresses are encoded as &lt;code&gt;uint160&lt;&#x2F;code&gt;. Integer values are sign-extended to 256-bit and encoded in big endian order. &lt;code&gt;bytes1&lt;&#x2F;code&gt; to &lt;code&gt;bytes31&lt;&#x2F;code&gt; are arrays with a beginning (index &lt;code&gt;0&lt;&#x2F;code&gt;) and an end (index &lt;code&gt;length - 1&lt;&#x2F;code&gt;), they are zero-padded at the end to &lt;code&gt;bytes32&lt;&#x2F;code&gt; and encoded in beginning to end order. This corresponds to their encoding in ABI v1 and v2.&lt;&#x2F;p&gt;
&lt;p&gt;The dynamic values &lt;code&gt;bytes&lt;&#x2F;code&gt; and &lt;code&gt;string&lt;&#x2F;code&gt; are encoded as a &lt;code&gt;keccak256&lt;&#x2F;code&gt; hash of their contents.&lt;&#x2F;p&gt;
&lt;p&gt;The array values are encoded as the &lt;code&gt;keccak256&lt;&#x2F;code&gt; hash of the concatenated &lt;code&gt;encodeData&lt;&#x2F;code&gt; of their contents (i.e. the encoding of &lt;code&gt;SomeType[5]&lt;&#x2F;code&gt; is identical to that of a struct containing five members of type &lt;code&gt;SomeType&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;The struct values are encoded recursively as &lt;code&gt;hashStruct(value)&lt;&#x2F;code&gt;. This is undefined for cyclical data.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;definition-of-domainseparator&quot;&gt;Definition of &lt;code&gt;domainSeparator&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;domainSeparator &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; hashStruct&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;eip712Domain&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where the type of &lt;code&gt;eip712Domain&lt;&#x2F;code&gt; is a struct named &lt;code&gt;EIP712Domain&lt;&#x2F;code&gt; with one or more of the below fields. Protocol designers only need to include the fields that make sense for their signing domain. Unused fields are left out of the struct type.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;string name&lt;&#x2F;code&gt; the user readable name of signing domain, i.e. the name of the DApp or the protocol.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;string version&lt;&#x2F;code&gt; the current major version of the signing domain. Signatures from different versions are not compatible.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;uint256 chainId&lt;&#x2F;code&gt; the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt; chain id. The user-agent &lt;em&gt;should&lt;&#x2F;em&gt; refuse signing if it does not match the currently active chain.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;address verifyingContract&lt;&#x2F;code&gt; the address of the contract that will verify the signature. The user-agent &lt;em&gt;may&lt;&#x2F;em&gt; do contract specific phishing prevention.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;bytes32 salt&lt;&#x2F;code&gt; a disambiguating salt for the protocol. This can be used as a domain separator of last resort.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Future extensions to this standard can add new fields with new user-agent behaviour constraints. User-agents are free to use the provided information to inform&#x2F;warn users or refuse signing. Dapp implementers should not add private fields, new fields should be proposed through the EIP process.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;EIP712Domain&lt;&#x2F;code&gt; fields should be the order as above, skipping any absent fields. Future field additions must be in alphabetical order and come after the above fields. User-agents should accept fields in any order as specified by the &lt;code&gt;EIP712Domain&lt;&#x2F;code&gt; type.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;specification-of-the-eth-signtypeddata-json-rpc&quot;&gt;Specification of the &lt;code&gt;eth_signTypedData&lt;&#x2F;code&gt; JSON RPC&lt;&#x2F;h3&gt;
&lt;p&gt;The method &lt;code&gt;eth_signTypedData&lt;&#x2F;code&gt; is added to the Ethereum JSON-RPC. The method parallels &lt;code&gt;eth_sign&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;eth-signtypeddata&quot;&gt;eth_signTypedData&lt;&#x2F;h4&gt;
&lt;p&gt;The sign method calculates an Ethereum specific signature with: &lt;code&gt;sign(keccak256(&quot;\x19\x01&quot; ‖ domainSeparator ‖ hashStruct(message)))&lt;&#x2F;code&gt;, as defined above.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;&#x2F;strong&gt;: the address to sign with must be unlocked.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h5&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;Address&lt;&#x2F;code&gt; - 20 Bytes - Address of the account that will sign the messages.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TypedData&lt;&#x2F;code&gt; - Typed structured data to be signed.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Typed data is a JSON object containing type information, domain separator parameters and the message object. Below is the json-schema definition for &lt;code&gt;TypedData&lt;&#x2F;code&gt; param.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  properties&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    types&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      properties&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        EIP712Domain&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;array&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      additionalProperties&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;array&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        items&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;          type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;          properties&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;          required&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      required&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;EIP712Domain&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    primaryType&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    domain&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    message&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;  required&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;types&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;primaryType&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;domain&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;message&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;returns&quot;&gt;Returns&lt;&#x2F;h5&gt;
&lt;p&gt;&lt;code&gt;DATA&lt;&#x2F;code&gt;: Signature. As in &lt;code&gt;eth_sign&lt;&#x2F;code&gt; it is a hex encoded 65 byte array starting with &lt;code&gt;0x&lt;&#x2F;code&gt;. It encodes the &lt;code&gt;r&lt;&#x2F;code&gt;, &lt;code&gt;s&lt;&#x2F;code&gt; and &lt;code&gt;v&lt;&#x2F;code&gt; parameters from appendix F of the yellow paper in big-endian format. Bytes 0...32 contain the &lt;code&gt;r&lt;&#x2F;code&gt; parameter, bytes 32...64 the &lt;code&gt;s&lt;&#x2F;code&gt; parameter and the last byte the &lt;code&gt;v&lt;&#x2F;code&gt; parameter. Note that the &lt;code&gt;v&lt;&#x2F;code&gt; parameter includes the chain id as specified in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;example&quot;&gt;Example&lt;&#x2F;h5&gt;
&lt;p&gt;Request:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;-data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{&amp;quot;jsonrpc&amp;quot;:&amp;quot;2.0&amp;quot;,&amp;quot;method&amp;quot;:&amp;quot;eth_signTypedData&amp;quot;,&amp;quot;params&amp;quot;:[&amp;quot;0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826&amp;quot;, {&amp;quot;types&amp;quot;:{&amp;quot;EIP712Domain&amp;quot;:[{&amp;quot;name&amp;quot;:&amp;quot;name&amp;quot;,&amp;quot;type&amp;quot;:&amp;quot;string&amp;quot;},{&amp;quot;name&amp;quot;:&amp;quot;version&amp;quot;,&amp;quot;type&amp;quot;:&amp;quot;string&amp;quot;},{&amp;quot;name&amp;quot;:&amp;quot;chainId&amp;quot;,&amp;quot;type&amp;quot;:&amp;quot;uint256&amp;quot;},{&amp;quot;name&amp;quot;:&amp;quot;verifyingContract&amp;quot;,&amp;quot;type&amp;quot;:&amp;quot;address&amp;quot;}],&amp;quot;Person&amp;quot;:[{&amp;quot;name&amp;quot;:&amp;quot;name&amp;quot;,&amp;quot;type&amp;quot;:&amp;quot;string&amp;quot;},{&amp;quot;name&amp;quot;:&amp;quot;wallet&amp;quot;,&amp;quot;type&amp;quot;:&amp;quot;address&amp;quot;}],&amp;quot;Mail&amp;quot;:[{&amp;quot;name&amp;quot;:&amp;quot;from&amp;quot;,&amp;quot;type&amp;quot;:&amp;quot;Person&amp;quot;},{&amp;quot;name&amp;quot;:&amp;quot;to&amp;quot;,&amp;quot;type&amp;quot;:&amp;quot;Person&amp;quot;},{&amp;quot;name&amp;quot;:&amp;quot;contents&amp;quot;,&amp;quot;type&amp;quot;:&amp;quot;string&amp;quot;}]},&amp;quot;primaryType&amp;quot;:&amp;quot;Mail&amp;quot;,&amp;quot;domain&amp;quot;:{&amp;quot;name&amp;quot;:&amp;quot;Ether Mail&amp;quot;,&amp;quot;version&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;chainId&amp;quot;:1,&amp;quot;verifyingContract&amp;quot;:&amp;quot;0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC&amp;quot;},&amp;quot;message&amp;quot;:{&amp;quot;from&amp;quot;:{&amp;quot;name&amp;quot;:&amp;quot;Cow&amp;quot;,&amp;quot;wallet&amp;quot;:&amp;quot;0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826&amp;quot;},&amp;quot;to&amp;quot;:{&amp;quot;name&amp;quot;:&amp;quot;Bob&amp;quot;,&amp;quot;wallet&amp;quot;:&amp;quot;0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB&amp;quot;},&amp;quot;contents&amp;quot;:&amp;quot;Hello, Bob!&amp;quot;}}],&amp;quot;id&amp;quot;:1}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Result:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x4355c47d63924e8a72e509b65029052eb6c299d53a04e167c5775fd466751c9d07299936d304c153f6443dfa05f40ff007d72911b6f72307f996231605b915621c&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;An example how to use Solidity ecrecover to verify the signature calculated with &lt;code&gt;eth_signTypedData&lt;&#x2F;code&gt; can be found in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;.&#x2F;assets&#x2F;Example.js&quot;&gt;Example.js&lt;&#x2F;a&gt;. The contract is deployed on the testnet Ropsten and Rinkeby.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;personal-signtypeddata&quot;&gt;personal_signTypedData&lt;&#x2F;h4&gt;
&lt;p&gt;There also should be a corresponding &lt;code&gt;personal_signTypedData&lt;&#x2F;code&gt; method which accepts the password for an account as the last argument.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;specification-of-the-web3-api&quot;&gt;Specification of the Web3 API&lt;&#x2F;h3&gt;
&lt;p&gt;Two methods are added to Web3.js version 1 that parallel the &lt;code&gt;web3.eth.sign&lt;&#x2F;code&gt; and &lt;code&gt;web3.eth.personal.sign&lt;&#x2F;code&gt; methods.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;web3-eth-signtypeddata&quot;&gt;web3.eth.signTypedData&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;web3&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;eth&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;signTypedData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;typedData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; callback&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Signs typed data using a specific account. This account needs to be unlocked.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;parameters-1&quot;&gt;Parameters&lt;&#x2F;h5&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;Object&lt;&#x2F;code&gt; - Domain separator and typed data to sign. Structured according to the JSON-Schema specified above in the &lt;code&gt;eth_signTypedData&lt;&#x2F;code&gt; JSON RPC call.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;String|Number&lt;&#x2F;code&gt; - Address to sign data with. Or an address or index of a local wallet in :ref:&lt;code&gt;web3.eth.accounts.wallet &amp;lt;eth_accounts_wallet&amp;gt;&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Function&lt;&#x2F;code&gt; - (optional) Optional callback, returns an error object as first parameter and the result as second.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;&#x2F;strong&gt;: The 2. &lt;code&gt;address&lt;&#x2F;code&gt; parameter can also be an address or index from the &lt;code&gt;web3.eth.accounts.wallet &amp;lt;eth_accounts_wallet&amp;gt;&lt;&#x2F;code&gt;. It will then sign locally using the private key of this account.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;returns-1&quot;&gt;Returns&lt;&#x2F;h5&gt;
&lt;p&gt;&lt;code&gt;Promise&lt;&#x2F;code&gt; returns &lt;code&gt;String&lt;&#x2F;code&gt; - The signature as returned by &lt;code&gt;eth_signTypedData&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;example-1&quot;&gt;Example&lt;&#x2F;h5&gt;
&lt;p&gt;See the &lt;code&gt;eth_signTypedData&lt;&#x2F;code&gt; JSON-API example above for the value of &lt;code&gt;typedData&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;web3&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;eth&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;signTypedData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;typedData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;then&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;console&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;log&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x4355c47d63924e8a72e509b65029052eb6c299d53a04e167c5775fd466751c9d07299936d304c153f6443dfa05f40ff007d72911b6f72307f996231605b915621c&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;web3-eth-personal-signtypeddata&quot;&gt;web3.eth.personal.signTypedData&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;web3&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;eth&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;personal&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;signTypedData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;typedData&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; password&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; callback&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Identical to &lt;code&gt;web3.eth.signTypedData&lt;&#x2F;code&gt; except for an additional &lt;code&gt;password&lt;&#x2F;code&gt; parameter analogous to &lt;code&gt;web3.eth.personal.sign&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;encode&lt;&#x2F;code&gt; function is extended with a new case for the new types. The first byte of the encoding distinguishes the cases. For the same reason it is not safe to start immediately with the domain separator or a &lt;code&gt;typeHash&lt;&#x2F;code&gt;. While hard, it may be possible to construct a &lt;code&gt;typeHash&lt;&#x2F;code&gt; that also happens to be a prefix of a valid RLP encoded transaction.&lt;&#x2F;p&gt;
&lt;p&gt;The domain separator prevents collision of otherwise identical structures. It is possible that two DApps come up with an identical structure like &lt;code&gt;Transfer(address from,address to,uint256 amount)&lt;&#x2F;code&gt; that should not be compatible. By introducing a domain separator the DApp developers are guaranteed that there can be no signature collision.&lt;&#x2F;p&gt;
&lt;p&gt;The domain separator also allows for multiple distinct signatures use-cases on the same struct instance within a given DApp. In the previous example, perhaps signatures from both &lt;code&gt;from&lt;&#x2F;code&gt; and &lt;code&gt;to&lt;&#x2F;code&gt; are required. By providing two distinct domain separators these signatures can be distinguished from each other.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Alternative 1&lt;&#x2F;strong&gt;: Use the target contract address as domain separator. This solves the first problem, contracts coming up with identical types, but does not address the second use-case. The standard does suggest implementors to use the target contract address where this is appropriate.&lt;&#x2F;p&gt;
&lt;p&gt;The function &lt;code&gt;hashStruct&lt;&#x2F;code&gt; starts with a &lt;code&gt;typeHash&lt;&#x2F;code&gt; to separate types. By giving different types a different prefix the &lt;code&gt;encodeData&lt;&#x2F;code&gt; function only has to be injective within a given type. It is okay for &lt;code&gt;encodeData(a)&lt;&#x2F;code&gt; to equal &lt;code&gt;encodeData(b)&lt;&#x2F;code&gt; as long as &lt;code&gt;typeOf(a)&lt;&#x2F;code&gt; is not &lt;code&gt;typeOf(b)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;rationale-for-typehash&quot;&gt;Rationale for &lt;code&gt;typeHash&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;typeHash&lt;&#x2F;code&gt; is designed to turn into a compile time constant in Solidity. For example:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; MAIL_TYPEHASH &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;  &amp;quot;Mail(address from,address to,string contents)&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;For the type hash several alternatives were considered and rejected for the reasons:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Alternative 2&lt;&#x2F;strong&gt;: Use ABIv2 function signatures. &lt;code&gt;bytes4&lt;&#x2F;code&gt; is not enough to be collision resistant. Unlike function signatures, there is negligible runtime cost incurred by using longer hashes.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Alternative 3&lt;&#x2F;strong&gt;: ABIv2 function signatures modified to be 256-bit. While this captures type info, it does not capture any of the semantics other than the function. This is already causing a practical collision between &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;&#x27;s and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;&#x27;s &lt;code&gt;transfer(address,uint256)&lt;&#x2F;code&gt;, where in the former the &lt;code&gt;uint256&lt;&#x2F;code&gt; refers to an amount and the latter to a unique id. In general ABIv2 favors compatibility where a hashing standard should prefer incompatibility.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Alternative 4&lt;&#x2F;strong&gt;: 256-bit ABIv2 signatures extended with parameter names and struct names. The &lt;code&gt;Mail&lt;&#x2F;code&gt; example from above would be encoded as &lt;code&gt;Mail(Person(string name,address wallet) from,Person(string name,address wallet) to,string contents)&lt;&#x2F;code&gt;. This is longer than the proposed solution. And indeed, the length of the string can grow exponentially in the length of the input (consider &lt;code&gt;struct A{B a;B b;}; struct B {C a;C b;}; …&lt;&#x2F;code&gt;). It also does not allow a recursive struct type (consider &lt;code&gt;struct List {uint256 value; List next;}&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Alternative 5&lt;&#x2F;strong&gt;: Include natspec documentation. This would include even more semantic information in the schemaHash and further reduces chances of collision. It makes extending and amending documentation a breaking changes, which contradicts common assumptions. It also makes the schemaHash mechanism very verbose.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;rationale-for-encodedata&quot;&gt;Rationale for &lt;code&gt;encodeData&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;encodeData&lt;&#x2F;code&gt; is designed to allow easy implementation of &lt;code&gt;hashStruct&lt;&#x2F;code&gt; in Solidity:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; hashStruct&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Mail&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; mail&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        MAIL_TYPEHASH&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        mail&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        mail&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;mail&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;contents&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;it also allows for an efficient in-place implementation in EVM&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; hashStruct&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;Mail&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; mail&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Compute sub-hashes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; typeHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; MAIL_TYPEHASH&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; contentsHash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;mail&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;contents&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Back up select memory&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        let&lt;&#x2F;span&gt;&lt;span&gt; temp1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;sub&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;mail&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        let&lt;&#x2F;span&gt;&lt;span&gt; temp2 &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;mail&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 128&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Write typeHash and sub-hashes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        mstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;sub&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;mail&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; typeHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        mstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;mail&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 64&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; contentsHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Compute hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        hash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;sub&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;mail&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 128&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Restore memory&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        mstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;sub&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;mail&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; temp1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        mstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;mail&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 64&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; temp2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The in-place implementation makes strong but reasonable assumptions on the memory layout of structs in memory. Specifically it assumes structs are not allocated below address 32, that members are stored in order, that all values are padded to 32-byte boundaries, and that dynamic and reference types are stored as a 32-byte pointers.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Alternative 6&lt;&#x2F;strong&gt;: Tight packing. This is the default behaviour in Solidity when calling &lt;code&gt;keccak256&lt;&#x2F;code&gt; with multiple arguments. It minimizes the number of bytes to be hashed but requires complicated packing instructions in EVM to do so. It does not allow in-place computation.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Alternative 7&lt;&#x2F;strong&gt;: ABIv2 encoding. Especially with the upcoming &lt;code&gt;abi.encode&lt;&#x2F;code&gt; it should be easy to use &lt;code&gt;abi.encode&lt;&#x2F;code&gt; as the &lt;code&gt;encodeData&lt;&#x2F;code&gt; function. The ABIv2 standard by itself fails the determinism security criteria. There are several valid ABIv2 encodings of the same data. ABIv2 does not allow in-place computation.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Alternative 8&lt;&#x2F;strong&gt;: Leave &lt;code&gt;typeHash&lt;&#x2F;code&gt; out of &lt;code&gt;hashStruct&lt;&#x2F;code&gt; and instead combine it with the domain separator. This is more efficient, but then the semantics of the Solidity &lt;code&gt;keccak256&lt;&#x2F;code&gt; hash function are not injective.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Alternative 9&lt;&#x2F;strong&gt;: Support cyclical data structures. The current standard is optimized for tree-like data structures and undefined for cyclical data structures. To support cyclical data a stack containing the path to the current node needs to be maintained and a stack offset substituted when a cycle is detected. This is prohibitively more complex to specify and implement. It also breaks composability where the hashes of the member values are used to construct the hash of the struct (the hash of the member values would depend on the path). It is possible to extend the standard in a compatible way to define hashes of cyclical data.&lt;&#x2F;p&gt;
&lt;p&gt;Similarly, a straightforward implementation is sub-optimal for directed acyclic graphs. A simple recursion through the members can visit the same node twice. Memoization can optimize this.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;rationale-for-domainseparator&quot;&gt;Rationale for &lt;code&gt;domainSeparator&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Since different domains have different needs, an extensible scheme is used where the DApp specifies a &lt;code&gt;EIP712Domain&lt;&#x2F;code&gt; struct type and an instance &lt;code&gt;eip712Domain&lt;&#x2F;code&gt; which it passes to the user-agent. The user-agent can then apply different verification measures depending on the fields that are there.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The RPC calls, web3 methods and &lt;code&gt;SomeStruct.typeHash&lt;&#x2F;code&gt; parameter are currently undefined. Defining them should not affect the behaviour of existing DApps.&lt;&#x2F;p&gt;
&lt;p&gt;The Solidity expression &lt;code&gt;keccak256(someInstance)&lt;&#x2F;code&gt; for an instance &lt;code&gt;someInstance&lt;&#x2F;code&gt; of a struct type &lt;code&gt;SomeStruct&lt;&#x2F;code&gt; is valid syntax. It currently evaluates to the &lt;code&gt;keccak256&lt;&#x2F;code&gt; hash of the memory address of the instance. This behaviour should be considered dangerous. In some scenarios it will appear to work correctly but in others it will fail determinism and&#x2F;or injectiveness. DApps that depend on the current behaviour should be considered dangerously broken.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;An example contract can be found in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;.&#x2F;assets&#x2F;Example.sol&quot;&gt;Example.sol&lt;&#x2F;a&gt; and an example implementation of signing in JavaScript in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;.&#x2F;assets&#x2F;Example.js&quot;&gt;Example.js&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;replay-attacks&quot;&gt;Replay attacks&lt;&#x2F;h3&gt;
&lt;p&gt;This standard is only about signing messages and verifying signatures. In many practical applications, signed messages are used to authorize an action, for example an exchange of tokens. It is &lt;em&gt;very important&lt;&#x2F;em&gt; that implementers make sure the application behaves correctly when it sees the same signed message twice. For example, the repeated message should be rejected or the authorized action should be idempotent. How this is implemented is specific to the application and out of scope for this standard.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;frontrunning-attacks&quot;&gt;Frontrunning attacks&lt;&#x2F;h3&gt;
&lt;p&gt;The mechanism for reliably broadcasting a signature is application-specific and out of scope for this standard. When the signature is broadcast to a blockchain for use in a contract, the application has to be secure against frontrunning attacks. In this kind of attack, an attacker intercepts the signature and submits it to the contract before the original intended use takes place. The application should behave correctly when the signature is submitted first by an attacker, for example by rejecting it or simply producing exactly the same effect as intended by the signer.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>DEVp2p snappy compression</title>
        <published>2017-09-07T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Péter Szilágyi</name><email>peter@ethereum.org</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/706/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/706/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="networking"
                label="Networking" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:706"
            label="EIP-706" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/706/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The base networking protocol (DEVp2p) used by Ethereum currently does not employ any form of compression. This results in a massive amount of bandwidth wasted in the entire network, making both initial sync as well as normal operation slower and laggier.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP proposes a tiny extension to the DEVp2p protocol to enable &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Snappy_(compression)&quot;&gt;Snappy compression&lt;&#x2F;a&gt; on all message payloads after the initial handshake. After extensive benchmarks, results show that data traffic is decreased by 60-80% for initial sync. You can find exact numbers below.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Synchronizing the Ethereum main network (block 4,248,000) in Geth using fast sync currently consumes 1.01GB upload and 33.59GB download bandwidth. On the Rinkeby test network (block 852,000) it&#x27;s 55.89MB upload and 2.51GB download.&lt;&#x2F;p&gt;
&lt;p&gt;However, most of this data (blocks, transactions) are heavily compressible. By enabling compression at the message payload level, we can reduce the previous numbers to 1.01GB upload &#x2F; 13.46GB download on the main network, and 46.21MB upload &#x2F; 463.65MB download on the test network.&lt;&#x2F;p&gt;
&lt;p&gt;The motivation behind doing this at the DEVp2p level (opposed to eth for example) is that it would enable compression for all sub-protocols (eth, les, bzz) seamlessly, reducing any complexity those protocols might incur in trying to individually optimize for data traffic.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Bump the advertised DEVp2p version number from &lt;code&gt;4&lt;&#x2F;code&gt; to &lt;code&gt;5&lt;&#x2F;code&gt;. If during handshake, the remote side advertises support only for version &lt;code&gt;4&lt;&#x2F;code&gt;, run the exact same protocol as until now.&lt;&#x2F;p&gt;
&lt;p&gt;If the remote side advertises a DEVp2p version &lt;code&gt;&amp;gt;= 5&lt;&#x2F;code&gt;, inject a Snappy compression step right before encrypting the DEVp2p message during sending:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A message consists of &lt;code&gt;{Code, Size, Payload}&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Compress the original payload with Snappy and store it in the same field.&lt;&#x2F;li&gt;
&lt;li&gt;Update the message size to the length of the compressed payload.&lt;&#x2F;li&gt;
&lt;li&gt;Encrypt and send the message as before, oblivious to compression.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Similarly to message sending, when receiving a DEVp2p v5 message from a remote node, insert a Snappy decompression step right after decrypting the DEVp2p message:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A message consists of &lt;code&gt;{Code, Size, Payload}&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Decrypt the message payload as before, oblivious to compression.&lt;&#x2F;li&gt;
&lt;li&gt;Decompress the payload with Snappy and store it in the same field.&lt;&#x2F;li&gt;
&lt;li&gt;Update the message size to the length of the decompressed payload.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Important caveats:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The handshake message is &lt;strong&gt;never&lt;&#x2F;strong&gt; compressed, since it is needed to negotiate the common version.&lt;&#x2F;li&gt;
&lt;li&gt;Snappy framing is &lt;strong&gt;not&lt;&#x2F;strong&gt; used, since the DEVp2p protocol already message oriented.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;Note: Snappy supports uncompressed binary literals (up to 4GB) too, leaving room for fine-tuned future optimisations for already compressed or encrypted data that would have no gain of compression (Snappy usually detects this case automatically).&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;avoiding-dos-attacks&quot;&gt;Avoiding DOS attacks&lt;&#x2F;h3&gt;
&lt;p&gt;Currently a DEVp2p message length is limited to 24 bits, amounting to a maximum size of 16MB. With the introduction of Snappy compression, care must be taken not to blindly decompress messages, since they may get significantly larger than 16MB.&lt;&#x2F;p&gt;
&lt;p&gt;However, Snappy is capable of calculating the decompressed size of an input message without inflating it in memory (&lt;em&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;google&#x2F;snappy&#x2F;blob&#x2F;master&#x2F;format_description.txt#L20&quot;&gt;the stream starts with the uncompressed length up to a maximum of &lt;code&gt;2^32 - 1&lt;&#x2F;code&gt; stored as a little-endian varint&lt;&#x2F;a&gt;&lt;&#x2F;em&gt;). This can be used to discard any messages which decompress above some threshold. &lt;strong&gt;The proposal is to use the same limit (16MB) as the threshold for decompressed messages.&lt;&#x2F;strong&gt; This retains the same guarantees that the current DEVp2p protocol does, so there won&#x27;t be surprises in application level protocols.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;alternatives-discarded&quot;&gt;Alternatives (discarded)&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;Alternative solutions to data compression that have been brought up and discarded are:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Extend protocol &lt;code&gt;xyz&lt;&#x2F;code&gt; to support compressed messages versus doing it at DEVp2p level:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Pro&lt;&#x2F;strong&gt;: Can be better optimized when to compress and when not to.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Con&lt;&#x2F;strong&gt;: Mixes in transport layer encoding into application layer logic.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Con&lt;&#x2F;strong&gt;: Makes the individual message specs more convoluted with compression details.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Con&lt;&#x2F;strong&gt;: Requires cross client coordination on every single protocol, making the effort much harder and repeated (eth, les, shh, bzz).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Introduce seamless variations of protocol such as &lt;code&gt;xyz&lt;&#x2F;code&gt; expanded with &lt;code&gt;xyz-compressed&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Pro&lt;&#x2F;strong&gt;: Can be done (hacked in) without cross client coordination.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Con&lt;&#x2F;strong&gt;: Litters the network with client specific protocol announces.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Con&lt;&#x2F;strong&gt;: Needs to be specced in an EIP for cross interoperability anyway.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Other ideas that have been discussed and discarded:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Don&#x27;t explicitly limit the decompressed message size, only the compressed one:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Pro&lt;&#x2F;strong&gt;: Allows larger messages to traverse through DEVp2p.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Con&lt;&#x2F;strong&gt;: Upper layer protocols need to check and discard large messages.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Con&lt;&#x2F;strong&gt;: Needs lazy decompression to allow size limitations without DOS.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal is fully backward compatible. Clients upgrading to the proposed DEVp2p protocol version &lt;code&gt;5&lt;&#x2F;code&gt; should still support skipping the compression step for connections that only advertise version &lt;code&gt;4&lt;&#x2F;code&gt; of the DEVp2p protocol.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;You can find a reference implementation of this EIP in https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;go-ethereum&#x2F;pull&#x2F;15106.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-vectors&quot;&gt;Test vectors&lt;&#x2F;h2&gt;
&lt;p&gt;There is more than one valid encoding of any given input, and there is more than one good internal compression algorithm within Snappy when trading off throughput for output size. As such, different implementations might produce slight variations in the compressed form, but all should be cross compatible between each other.&lt;&#x2F;p&gt;
&lt;p&gt;As an example, take hex encoded RLP of block #272621 from the Rinkeby test network: &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;gist.githubusercontent.com&#x2F;karalabe&#x2F;72a1a6c4c1dbe6d4996879e415697f06&#x2F;raw&#x2F;195bf0c0050ee9805fcd5db4b5b650c58879a55f&#x2F;block.rlp&quot;&gt;block.rlp (~3MB)&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Encoding the raw RLP via &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;golang&#x2F;snappy&quot;&gt;Go&#x27;s Snappy library&lt;&#x2F;a&gt; yields: &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;gist.githubusercontent.com&#x2F;karalabe&#x2F;72a1a6c4c1dbe6d4996879e415697f06&#x2F;raw&#x2F;195bf0c0050ee9805fcd5db4b5b650c58879a55f&#x2F;block.go.snappy&quot;&gt;block.go.snappy (~70KB)&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Encoding the raw RLP via &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;andrix&#x2F;python-snappy&quot;&gt;Python&#x27;s Snappy library&lt;&#x2F;a&gt; yields: &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;gist.githubusercontent.com&#x2F;karalabe&#x2F;72a1a6c4c1dbe6d4996879e415697f06&#x2F;raw&#x2F;195bf0c0050ee9805fcd5db4b5b650c58879a55f&#x2F;block.py.snappy&quot;&gt;block.py.snappy (~70KB)&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;You can verify that an encoded binary can be decoded into the proper plaintext using the following snippets:&lt;&#x2F;p&gt;
&lt;h3 id=&quot;go&quot;&gt;Go&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; go&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; get&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; https:&#x2F;&#x2F;github.com&#x2F;golang&#x2F;snappy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;go&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;package&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; main&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;	&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;	&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encoding&#x2F;hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;	&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;fmt&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;	&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;io&#x2F;ioutil&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;	&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;log&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;	&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;os&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;	&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;github.com&#x2F;golang&#x2F;snappy&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;func&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; main&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Read and decode the decompressed file&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	plainhex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; err&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; :=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ioutil&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ReadFile&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;os&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Args&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;	if&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; err&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; nil&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		log&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Fatalf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Failed to read decompressed file &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;%s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;%v&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; os&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Args&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; err&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	plain&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; err&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; :=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; hex&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;DecodeString&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;plainhex&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;	if&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; err&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; nil&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		log&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Fatalf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Failed to decode decompressed file: &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;%v&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; err&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Read and decode the compressed file&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	comphex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; err&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; :=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ioutil&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ReadFile&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;os&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Args&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;	if&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; err&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; nil&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		log&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Fatalf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Failed to read compressed file &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;%s&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;%v&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; os&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Args&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; err&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	comp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; err&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; :=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; hex&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;DecodeString&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;comphex&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;	if&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; err&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; nil&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		log&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Fatalf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Failed to decode compressed file: &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;%v&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; err&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Make sure they match&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	decomp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; err&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; :=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; snappy&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Decode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;nil&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; comp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;	if&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; err&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; nil&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		log&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Fatalf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Failed to decompress compressed file: &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;%v&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; err&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;	if&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;plain&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; decomp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;		fmt&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Println&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Booo, decompressed file does not match provided plain text!&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	fmt&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Println&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Yay, decompressed data matched provided plain text!&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; go&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; run&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; main.go&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; block.rlp&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; block.go.snappy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Yay,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; decompressed&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; matched&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; provided&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; plain&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; text!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; go&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; run&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; main.go&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; block.rlp&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; block.py.snappy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Yay,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; decompressed&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; matched&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; provided&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; plain&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; text!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;python&quot;&gt;Python&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; pip&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; install&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; python-snappy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; snappy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; sys&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Read and decode the decompressed file&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;with&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; open&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sys&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;argv&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;rb&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; as&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; file&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    plainhex&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; file&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;read&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;plain&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; plainhex&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;decode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Read and decode the compressed file&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;with&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; open&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sys&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;argv&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;rb&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; as&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; file&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    comphex&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; file&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;read&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;comp&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; comphex&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;decode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Make sure they match&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;decomp&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; snappy&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;uncompress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;comp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt; plain&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; decomp&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    print&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Booo, decompressed file does not match provided plain text!&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    print&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Yay, decompressed data matched provided plain text!&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; python&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; main.py&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; block.rlp&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; block.go.snappy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Yay,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; decompressed&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; matched&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; provided&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; plain&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; text!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; python&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; main.py&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; block.rlp&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; block.py.snappy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Yay,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; decompressed&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; matched&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; provided&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; plain&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; text!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;references&quot;&gt;References&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Snappy website: https:&#x2F;&#x2F;google.github.io&#x2F;snappy&#x2F;&lt;&#x2F;li&gt;
&lt;li&gt;Snappy specification: https:&#x2F;&#x2F;github.com&#x2F;google&#x2F;snappy&#x2F;blob&#x2F;master&#x2F;format_description.txt&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>OPCODE 0x46 BLOCKREWARD</title>
        <published>2017-08-28T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Cody Burns</name><email>dontPanic@codywburns.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/698/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/698" />
        

        <id>https://wg-eips.ritovision.com/698/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:698"
            label="EIP-698" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/698/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP adds an additional opcode to the EVM which will return a finalized blocks reward value.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;In the EVM, the 0x40 opcodes are reserved for &lt;code&gt;Block Information&lt;&#x2F;code&gt;. Currently reserved opcodes are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;0X40 BLOCKHASH&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;0X41 COINBASE&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;0X42 TIMESTAMP&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;0X43 NUMBER&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;0X44 DIFFICULTY&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;0X45 GASLIMIT&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This EIP would add an additional opcode, &lt;code&gt;0x46 BLOCKREWARD&lt;&#x2F;code&gt;, which would return the block reward for any finalized block. The finalized block reward would include the base reward, uncle payments, and gas.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Per EIP-649 ( #669 ) periodic block reward reductions&#x2F;variance are now planned in the roadmap, however, this EIP is consensus system agnostic and is most useful in decentralized pool operations and for any contract that benefits from knowing a block reward payout(i.e. Merge mined tokens)&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;After block &lt;code&gt;n&lt;&#x2F;code&gt; all clients should process opcode &lt;code&gt;0x46&lt;&#x2F;code&gt; as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Value: &lt;code&gt;0x46&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Mnemonic: &lt;code&gt;BLOCKREWARD&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;δ:&lt;code&gt; 0&lt;&#x2F;code&gt; nothing removed from stack&lt;&#x2F;li&gt;
&lt;li&gt;α:&lt;code&gt;1&lt;&#x2F;code&gt; block reward added to stack&lt;&#x2F;li&gt;
&lt;li&gt;Description: &lt;code&gt;Get the block&#x27;s reward emission&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;GasCost: &lt;code&gt;G&amp;lt;sub&amp;gt;base&amp;lt;&#x2F;sub&amp;gt;&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Where:&lt;code&gt;µ&#x27;&amp;lt;sub&amp;gt;s&amp;lt;&#x2F;sub&amp;gt;[0] ≡ I&amp;lt;sub&amp;gt;HR&amp;lt;&#x2F;sub&amp;gt;&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;contract-mining-pools&quot;&gt;Contract Mining Pools&lt;&#x2F;h3&gt;
&lt;p&gt;For distributed consensus systems(staking pools and mining pools) ad hoc groups combine resources in order to reduce variance in payouts. Broadly, pool operations function by allowing a collective of  miners &#x2F; stakers  to verify their contribution to solving PoW or staking share by periodically submitting solutions which are representative of the miners probability of finding a true block.&lt;&#x2F;p&gt;
&lt;p&gt;In all these schemes &lt;code&gt;B&lt;&#x2F;code&gt; stands for a block reward minus pool fee and &lt;code&gt;p&lt;&#x2F;code&gt; is a probability of finding a block in a share attempt ( &lt;code&gt;p=1&#x2F;D&lt;&#x2F;code&gt;, where &lt;code&gt;D&lt;&#x2F;code&gt; is current block difficulty).&lt;&#x2F;p&gt;
&lt;p&gt;Some common methods of mining pool payout are pay-per-share, &lt;code&gt;R = B * p&lt;&#x2F;code&gt;, proportional [&lt;code&gt;R = B * (n&#x2F;N)&lt;&#x2F;code&gt; where &lt;code&gt;n&lt;&#x2F;code&gt; is amount of a miners shares, and &lt;code&gt;N&lt;&#x2F;code&gt; is amount of all shares in this round.], and pay-per-last-N-shares [&lt;code&gt;R = B * (n&#x2F;N)&lt;&#x2F;code&gt; where miner&#x27;s reward is calculated on a basis of &lt;code&gt;N&lt;&#x2F;code&gt; last shares, instead of all shares for the last round]. All of these methods are predicated on knowing the block reward paid for a given block. In order to provide a trust minimized solution, &lt;code&gt;0x46&lt;&#x2F;code&gt; can be used to call a blocks reward for computing payouts.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;merge-mined-tokens&quot;&gt;Merge mined tokens&lt;&#x2F;h3&gt;
&lt;p&gt;Contracts could create tokens which could be variably ‘minted’ as a function of block reward by calling &lt;code&gt;0x46&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;currently-deployed-contracts&quot;&gt;Currently deployed contracts&lt;&#x2F;h3&gt;
&lt;p&gt;No impact&lt;&#x2F;p&gt;
&lt;h3 id=&quot;current-clients&quot;&gt;Current clients&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP would be incompatible with currently deployed clients that are not able to handle &lt;code&gt;0x46&lt;&#x2F;code&gt; and would process all transactions and block containing the opcode as invalid.&lt;&#x2F;p&gt;
&lt;p&gt;Implementation should occur as part of a coordinated hardfork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;further-reading&quot;&gt;Further reading&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Mining_pool&quot;&gt;Mining Pools&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The Yellow Paper Appendix H. Virtual Machine Specification section H.2&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Create `eth_chainId` method for JSON-RPC</title>
        <published>2017-08-21T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Isaac Ardis</name><email>isaac.ardis@gmail.com</email>
	</author>
	
	<author>
		<name>Wei Tang</name><uri>https://github.com/sorpaas</uri>
	</author>
	
	<author>
		<name>Fan Torchz</name><uri>https://github.com/tcz001</uri>
	</author>
	
	<author>
		<name>Erik Marks</name><uri>https://github.com/rekmarks</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/695/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-695-create-eth-chainid-method-for-json-rpc/1845" />
        

        <id>https://wg-eips.ritovision.com/695/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="interface"
                label="Interface" />
            
        

        
        <category
            term="tag:eip:695"
            label="EIP-695" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/695/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Include &lt;code&gt;eth_chainId&lt;&#x2F;code&gt; method in &lt;code&gt;eth_&lt;&#x2F;code&gt;-namespaced JSON-RPC methods.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;eth_chainId&lt;&#x2F;code&gt; method should return a single STRING result
for an integer value in hexadecimal format, describing the
currently configured &lt;code&gt;CHAIN_ID&lt;&#x2F;code&gt; value used for signing replay-protected transactions,
introduced by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently although we can use &lt;code&gt;net_version&lt;&#x2F;code&gt; RPC call to get the
current network ID, there&#x27;s no RPC for querying the chain ID. This
makes it impossible to determine the current actual blockchain using
the RPC.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;eth-chainid&quot;&gt;&lt;code&gt;eth_chainId&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Returns the currently configured chain ID, a value used in replay-protected transaction
signing as introduced by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The chain ID returned should always correspond to the information in the current known
head block. This ensures that caller of this RPC method can always use the retrieved
information to sign transactions built on top of the head.&lt;&#x2F;p&gt;
&lt;p&gt;If the current known head block does not specify a chain ID, the client should treat any
calls to &lt;code&gt;eth_chainId&lt;&#x2F;code&gt; as though the method were not supported, and return a suitable
error.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h4&gt;
&lt;p&gt;None.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;returns&quot;&gt;Returns&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;QUANTITY&lt;&#x2F;code&gt; - integer of the current chain ID.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;example&quot;&gt;Example&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;curl&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; --&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;{&amp;quot;jsonrpc&amp;quot;:&amp;quot;2.0&amp;quot;,&amp;quot;method&amp;quot;:&amp;quot;eth_chainId&amp;quot;,&amp;quot;params&amp;quot;:[],&amp;quot;id&amp;quot;:83}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Result&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;83&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;jsonrpc&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x3d&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 61&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;An ETH&#x2F;ETC client can accidentally connect to an ETC&#x2F;ETH RPC
endpoint without knowing it unless it tries to sign a transaction or
it fetches a transaction that is known to have signed with a chain
ID. This has since caused trouble for application developers, such as
MetaMask, to add multi-chain support.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Not relevant.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Consumers should prefer &lt;code&gt;eth_chainId&lt;&#x2F;code&gt; over &lt;code&gt;net_version&lt;&#x2F;code&gt;, so that they can reliably identify chain they are communicating with.&lt;&#x2F;p&gt;
&lt;p&gt;Implementers should take care to implement &lt;code&gt;eth_chainId&lt;&#x2F;code&gt; correctly and promote its use, since the chain ID is critical in replay attack prevention as described in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt;, and consumers will rely on it to identify the chain they are communicating with.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;paritytech&#x2F;parity&#x2F;pull&#x2F;6329&quot;&gt;Parity PR&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;go-ethereum&#x2F;pull&#x2F;17617&quot;&gt;Geth PR&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereumproject&#x2F;go-ethereum&#x2F;pull&#x2F;336&quot;&gt;Geth Classic PR&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;reference&quot;&gt;Reference&lt;&#x2F;h2&gt;
&lt;p&gt;Return value &lt;code&gt;QUANTITY&lt;&#x2F;code&gt; adheres to standard JSON RPC hex value encoding, as documented in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum.org&#x2F;en&#x2F;developers&#x2F;docs&#x2F;apis&#x2F;json-rpc&#x2F;#hex-encoding&quot;&gt;Ethereum.org documentation&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Address Collision of Contract Address Causes Exceptional Halt</title>
        <published>2017-08-15T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Yoichi Hirai</name><email>i@yoichihirai.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/689/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/689/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:689"
            label="EIP-689" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/689/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes to make contract creation fail on an account with nonempty code or non-zero nonce.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Some test cases in the consensus test suite try to deploy a contract at an address already with nonempty code. Although such cases can virtually never happen on the main network before the Constantinople fork block, the test cases detected discrepancies in clients&#x27; behavior.  Currently, the Yellow Paper says that the contract creation starts with the empty code and the initial nonce even in the case of address collisions. To simplify the semantics, this EIP proposes that address collisions cause failures of contract creation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP has no practical relevance to the main net history, but simplifies testing and reasoning.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP has no effects after Constantinople fork because &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;86&#x2F;&quot;&gt;EIP-86&lt;&#x2F;a&gt; contains the changes proposed in this EIP. Even before the Constantinople fork, this EIP has no practical relevance because the change is visible only in case of a hash collision of keccak256.&lt;&#x2F;p&gt;
&lt;p&gt;Regarding testing, this EIP relieves clients from supporting reversion of code overwriting.&lt;&#x2F;p&gt;
&lt;p&gt;Regarding reasoning, this EIP establishes an invariant that non-empty code is never modified.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= 0&lt;&#x2F;code&gt;, when a contract creation is on an account with non-zero nonce or non-empty code, the creation fails as if init code execution resulted in an exceptional halt.  This applies to contract creation triggered by a contract creation transaction and by CREATE instruction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;It seems impractical to implement never-used features just for passing tests.  Client implementations will be simpler with this EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is backwards compatible on the main network.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;At least the BlockchainTest called &lt;code&gt;createJS\_ExampleContract\_d0g0v0\_EIP158&lt;&#x2F;code&gt; will distinguish clients that implement this EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>URL Format for Transaction Requests</title>
        <published>2017-08-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Daniel A. Nagy</name><uri>https://github.com/nagydani</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/681/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-681-representing-various-transactions-as-urls" />
        

        <id>https://wg-eips.ritovision.com/681/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:681"
            label="ERC-681" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/681/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;A standard way of representing various transactions, especially payment requests in ether and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens as URLs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;URLs embedded in QR-codes, hyperlinks in web-pages, emails or chat messages provide for robust cross-application signaling between very loosely coupled applications. A standardized URL format for payment requests allows for instant invocation of the user&#x27;s preferred wallet application (even if it is a webapp or a swarm đapp), with the correct parameterization of the payment transaction only to be confirmed by the (authenticated) user.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The convenience of representing payment requests by standard URLs has been a major factor in the wide adoption of Bitcoin. Bringing a similarly convenient mechanism to Ethereum would speed up its acceptance as a payment platform among end-users. In particular, URLs embedded in broadcast Intents are the preferred way of launching applications on the Android operating system and work across practically all applications. Desktop web browsers have a standardized way of defining protocol handlers for URLs with specific protocol specifications. Other desktop applications typically launch the web browser upon encountering a URL. Thus, payment request URLs could be delivered through a very broad, ever growing selection of channels.&lt;&#x2F;p&gt;
&lt;p&gt;This specification supersedes the defunct ERC-67, which is a URL format for representing arbitrary transactions in a low-level fashion. This ERC focuses specifically on the important special case of payment requests, while allowing for other, ABI-specified transactions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;syntax&quot;&gt;Syntax&lt;&#x2F;h3&gt;
&lt;p&gt;Payment request URLs contain &quot;ethereum&quot; in their schema (protocol) part and are constructed as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;request                 = schema_prefix target_address [ &amp;quot;@&amp;quot; chain_id ] [ &amp;quot;&#x2F;&amp;quot; function_name ] [ &amp;quot;?&amp;quot; parameters ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;schema_prefix           = &amp;quot;ethereum&amp;quot; &amp;quot;:&amp;quot; [ &amp;quot;pay-&amp;quot; ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;target_address          = ethereum_address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;chain_id                = 1*DIGIT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function_name           = STRING&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ethereum_address        = ( &amp;quot;0x&amp;quot; 40*HEXDIG ) &#x2F; ENS_NAME&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;parameters              = parameter *( &amp;quot;&amp;amp;&amp;quot; parameter )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;parameter               = key &amp;quot;=&amp;quot; value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;key                     = &amp;quot;value&amp;quot; &#x2F; &amp;quot;gas&amp;quot; &#x2F; &amp;quot;gasLimit&amp;quot; &#x2F; &amp;quot;gasPrice&amp;quot; &#x2F; TYPE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;value                   = number &#x2F; ethereum_address &#x2F; STRING&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;number                  = [ &amp;quot;-&amp;quot; &#x2F; &amp;quot;+&amp;quot; ] *DIGIT [ &amp;quot;.&amp;quot; 1*DIGIT ] [ ( &amp;quot;e&amp;quot; &#x2F; &amp;quot;E&amp;quot; ) [ 1*DIGIT ] ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Where &lt;code&gt;TYPE&lt;&#x2F;code&gt; is a standard ABI type name, as defined in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;solidity.readthedocs.io&#x2F;en&#x2F;develop&#x2F;abi-spec.html&quot;&gt;Ethereum Contract ABI specification&lt;&#x2F;a&gt;. &lt;code&gt;STRING&lt;&#x2F;code&gt; is a URL-encoded unicode string of arbitrary length, where delimiters and the
percentage symbol (&lt;code&gt;%&lt;&#x2F;code&gt;) are mandatorily hex-encoded with a &lt;code&gt;%&lt;&#x2F;code&gt; prefix.&lt;&#x2F;p&gt;
&lt;p&gt;Note that a &lt;code&gt;number&lt;&#x2F;code&gt; can be expressed in &lt;em&gt;scientific notation&lt;&#x2F;em&gt;, with a multiplier of a power of 10. Only integer numbers are allowed, so the exponent MUST be greater or equal to the number of decimals after the point.&lt;&#x2F;p&gt;
&lt;p&gt;If &lt;em&gt;key&lt;&#x2F;em&gt; in the parameter list is &lt;code&gt;value&lt;&#x2F;code&gt;, &lt;code&gt;gasLimit&lt;&#x2F;code&gt;, &lt;code&gt;gasPrice&lt;&#x2F;code&gt; or &lt;code&gt;gas&lt;&#x2F;code&gt; then &lt;em&gt;value&lt;&#x2F;em&gt; MUST be a &lt;code&gt;number&lt;&#x2F;code&gt;. Otherwise, it must correspond to the &lt;code&gt;TYPE&lt;&#x2F;code&gt; string used as &lt;em&gt;key&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;For the syntax of ENS_NAME, please consult &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;137&#x2F;&quot;&gt;ERC-137&lt;&#x2F;a&gt; defining Ethereum Name Service.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;semantics&quot;&gt;Semantics&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;target_address&lt;&#x2F;code&gt; is mandatory and denotes either the beneficiary of native token payment (see below) or the contract address with which the user is asked to interact.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;chain_id&lt;&#x2F;code&gt; is optional and contains the decimal chain ID, such that transactions on various test- and private networks can be requested. If no &lt;code&gt;chain_id&lt;&#x2F;code&gt; is present, the client&#x27;s current network setting remains effective.&lt;&#x2F;p&gt;
&lt;p&gt;If &lt;code&gt;function_name&lt;&#x2F;code&gt; is missing, then the URL is requesting payment in the native token of the blockchain, which is ether in our case. The amount is specified in &lt;code&gt;value&lt;&#x2F;code&gt; parameter, in the atomic unit (i.e. wei). The use of scientific notation is strongly encouraged. For example, requesting 2.014 ETH to address &lt;code&gt;0xfb6916095ca1df60bb79Ce92ce3ea74c37c5d359&lt;&#x2F;code&gt; would look as follows:
&lt;a href=&quot;ethereum:0xfb6916095ca1df60bb79Ce92ce3ea74c37c5d359?value=2.014e18&quot;&gt;ethereum:0xfb6916095ca1df60bb79Ce92ce3ea74c37c5d359?value=2.014e18&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Requesting payments in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens involves a request to call the &lt;code&gt;transfer&lt;&#x2F;code&gt; function of the token contract with an &lt;code&gt;address&lt;&#x2F;code&gt; and a &lt;code&gt;uint256&lt;&#x2F;code&gt; typed parameter, containing the &lt;em&gt;beneficiary address&lt;&#x2F;em&gt; and the &lt;em&gt;amount in atomic units&lt;&#x2F;em&gt;, respectively. For example,
requesting a Unicorn to address &lt;code&gt;0x8e23ee67d1332ad560396262c48ffbb01f93d052&lt;&#x2F;code&gt; looks as follows:
&lt;a href=&quot;ethereum:0x89205a3a3b2a69de6dbf7f01ed13b2108b2c43e7&#x2F;transfer?address=0x8e23ee67d1332ad560396262c48ffbb01f93d052&amp;amp;uint256=1&quot;&gt;ethereum:0x89205a3a3b2a69de6dbf7f01ed13b2108b2c43e7&#x2F;transfer?address=0x8e23ee67d1332ad560396262c48ffbb01f93d052&amp;amp;uint256=1&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;If using ENS names instead of hexadecimal addresses, the resolution is up to the payer, at any time between receiving the URL and sending the transaction. Hexadecimal addresses always take precedence over ENS names, i. e. even if there exists a matching ENS name consisting of &lt;code&gt;0x&lt;&#x2F;code&gt; followed by 40 hexadecimal digits, it should never be resolved. Instead, the hexadecimal address should be used directly.&lt;&#x2F;p&gt;
&lt;p&gt;Note that the indicated amount is only a suggestion (as are all the supplied arguments) which the user is free to change. With no indicated amount, the user should be prompted to enter the amount to be paid.&lt;&#x2F;p&gt;
&lt;p&gt;Similarly &lt;code&gt;gasLimit&lt;&#x2F;code&gt; and &lt;code&gt;gasPrice&lt;&#x2F;code&gt; are suggested user-editable values for &lt;em&gt;gas limit&lt;&#x2F;em&gt; and &lt;em&gt;gas price&lt;&#x2F;em&gt;, respectively, for the requested transaction. It is acceptable to abbreviate &lt;code&gt;gasLimit&lt;&#x2F;code&gt; as &lt;code&gt;gas&lt;&#x2F;code&gt;, the two are treated synonymously.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The proposed format is chosen to resemble &lt;code&gt;bitcoin:&lt;&#x2F;code&gt; URLs as closely as possible, as both users and application programmers are already familiar with that format. In particular, this motivated the omission of the unit, which is often used in Ethereum ecosystem. Handling different orders of magnitude is facilitated by the exponent so that amount values can be expressed in their nominal units, just like in the case of &lt;code&gt;bitcoin:&lt;&#x2F;code&gt;. The use of scientific notation is strongly encouraged when expressing monetary value in ether or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens. For better human readability, the exponent should be the decimal value of the nominal unit: 18 for ether or the value returned by &lt;code&gt;decimals()&lt;&#x2F;code&gt; of the token contract for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens. Additional parameters may be added, if popular use cases requiring them emerge in practice.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;0x&lt;&#x2F;code&gt; prefix before ethereum addresses specified as hexadecimal numbers is following established practice and also unambiguously distinguishes hexadecimal addresses from ENS names consisting of 40 alphanumeric characters.&lt;&#x2F;p&gt;
&lt;p&gt;Future upgrades that are partially or fully incompatible with this proposal must use a prefix other than &lt;code&gt;pay-&lt;&#x2F;code&gt; that is separated by a dash (&lt;code&gt;-&lt;&#x2F;code&gt;) character from whatever follows it.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;In the fairly common case of only indicating the recipient address in a request for payment in ether, this specification is compatible with the superseded ERC-67.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Since irreversible transactions can be initiated with parameters from such URLs, the integrity and authenticity of these URLs are of great importance.
In particular, changing either the recipient address or the amount transferred can be a profitable attack. Users should only use URLs received from authenticated sources with adequate integrity protection.&lt;&#x2F;p&gt;
&lt;p&gt;To prevent malicious redirection of payments using ENS, hexadecimal interpretation of Ethereum addresses must have precedence over ENS lookups. Client software may alert the user if an ENS address is visually similar to a hexadecimal address or even outright reject such addresses as likely phishing attacks.&lt;&#x2F;p&gt;
&lt;p&gt;In order to make sure that the amount transacted is the same as the amount intended, the amount communicated to the human user should be easily verifiable by inspection, including the order of magnitude. In case of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; token payments, if the payer client has access to the blockchain or some other trusted source of information about the token contract, the interface should display the amount in the units specified in the token contract. Otherwise, it should be displayed as expressed in the URL, possibly alerting the user to the uncertainty of the nominal unit. To facilitate human inspection of the amount, the use of scientific notation with an exponent corresponding to the nominal unit of the transacted token (e.g. 18 in case of ether) is advisable.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Rename opcodes for clarity</title>
        <published>2017-07-28T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1803/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-1803-rename-opcodes-for-clarity/3345" />
        

        <id>https://wg-eips.ritovision.com/1803/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="interface"
                label="Interface" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1803"
            label="EIP-1803" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1803/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Rename the &lt;code&gt;BALANCE&lt;&#x2F;code&gt;, &lt;code&gt;SHA3&lt;&#x2F;code&gt;, &lt;code&gt;NUMBER&lt;&#x2F;code&gt;, &lt;code&gt;GASLIMIT&lt;&#x2F;code&gt;, &lt;code&gt;GAS&lt;&#x2F;code&gt; and &lt;code&gt;INVALID&lt;&#x2F;code&gt; opcodes to reflect their true meaning.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Rename the opcodes as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;BALANCE&lt;&#x2F;code&gt; (&lt;code&gt;0x31&lt;&#x2F;code&gt;) to &lt;code&gt;EXTBALANCE&lt;&#x2F;code&gt; to be in line with &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt;, &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt; and &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SHA3&lt;&#x2F;code&gt; (&lt;code&gt;0x20&lt;&#x2F;code&gt;) to &lt;code&gt;KECCAK256&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;NUMBER&lt;&#x2F;code&gt; (&lt;code&gt;0x43&lt;&#x2F;code&gt;) to &lt;code&gt;BLOCKNUMBER&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;GASLIMIT&lt;&#x2F;code&gt; (&lt;code&gt;0x45&lt;&#x2F;code&gt;) to &lt;code&gt;BLOCKGASLIMIT&lt;&#x2F;code&gt; to avoid confusion with the gas limit of the transaction&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;GAS&lt;&#x2F;code&gt; (&lt;code&gt;0x5a&lt;&#x2F;code&gt;) to &lt;code&gt;GASLEFT&lt;&#x2F;code&gt; to be clear what it refers to&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;INVALID&lt;&#x2F;code&gt; (&lt;code&gt;0xfe&lt;&#x2F;code&gt;) to &lt;code&gt;ABORT&lt;&#x2F;code&gt; to clearly articulate when someone refers this opcode as opposed to &quot;any invalid opcode&quot;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This has no effect on any code. It can influence what mnemonics assemblers will use.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Not applicable.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6&#x2F;&quot;&gt;EIP-6&lt;&#x2F;a&gt; previously renamed &lt;code&gt;SUICIDE&lt;&#x2F;code&gt; (&lt;code&gt;0xff&lt;&#x2F;code&gt;) to &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;.
Renaming &lt;code&gt;SHA3&lt;&#x2F;code&gt; was previously proposed by &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;59&quot;&gt;EIP-59&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>SWAPN, DUPN and EXCHANGE instructions</title>
        <published>2017-07-03T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	<author>
		<name>Charles Cooper</name><uri>https://github.com/charles-cooper</uri>
	</author>
	
	<author>
		<name>Danno Ferrin</name><uri>https://github.com/shemnon</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/663/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-663-unlimited-swap-and-dup-instructions/3346" />
        

        <id>https://wg-eips.ritovision.com/663/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:663"
            label="EIP-663" />
        

        
        

        
        <summary type="html">Introduce additional instructions for manipulating the stack which allow accessing the stack at higher depths</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/663/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, &lt;code&gt;SWAP*&lt;&#x2F;code&gt; and &lt;code&gt;DUP*&lt;&#x2F;code&gt; instructions are limited to a stack depth of 16. Introduce three new instructions, &lt;code&gt;SWAPN&lt;&#x2F;code&gt;, &lt;code&gt;DUPN&lt;&#x2F;code&gt; and &lt;code&gt;EXCHANGE&lt;&#x2F;code&gt; which lift this limitation and allow accessing the stack at higher depths.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;While the stack is 1024 items deep, easy access is only possible for the top 16 items. Supporting more local variables is possible via manually keeping them in memory or through a &quot;stack to memory elevation&quot; in a compiler. This can result in complex and inefficient code.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore, implementing higher level constructs, such as functions, on top of EVM will result in a list of input and output parameters as well as an instruction offset to return to.&lt;&#x2F;p&gt;
&lt;p&gt;The number of these arguments (or stack items) can easily exceed 16 and thus will require extra care from a compiler to lay them out in a way that all of them are still accessible.&lt;&#x2F;p&gt;
&lt;p&gt;Lastly, swapping items besides the 1st and Nth items in the stack is very important for compilers implementing stack scheduling algorithms (the analog of register allocation for stack machines), which try to minimize stack traffic given a set of variables and usage analysis.&lt;&#x2F;p&gt;
&lt;p&gt;Introducing &lt;code&gt;SWAPN&lt;&#x2F;code&gt;, &lt;code&gt;DUPN&lt;&#x2F;code&gt; and &lt;code&gt;EXCHANGE&lt;&#x2F;code&gt; will provide an option to compilers to simplify accessing deep stack items.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;We introduce three new instructions:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;DUPN&lt;&#x2F;code&gt; (&lt;code&gt;0xe6&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SWAPN&lt;&#x2F;code&gt; (&lt;code&gt;0xe7&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;EXCHANGE&lt;&#x2F;code&gt; (&lt;code&gt;0xe8&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;If the code is legacy bytecode, any of these instructions result in an &lt;em&gt;exceptional halt&lt;&#x2F;em&gt;. (&lt;em&gt;Note: This means no change to behaviour.&lt;&#x2F;em&gt;)&lt;&#x2F;p&gt;
&lt;p&gt;If the code is valid EOF1, the following rules apply:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The instructions are followed by an 8-bit immediate value, which we call &lt;code&gt;imm&lt;&#x2F;code&gt;, and can have a value of 0 to 255.
&lt;ol&gt;
&lt;li&gt;In the case of &lt;code&gt;DUPN&lt;&#x2F;code&gt; and &lt;code&gt;SWAPN&lt;&#x2F;code&gt;, we introduce the variable &lt;code&gt;n&lt;&#x2F;code&gt; which equals to &lt;code&gt;imm + 1&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;In the case of &lt;code&gt;EXCHANGE&lt;&#x2F;code&gt;, we introduce the variable &lt;code&gt;n&lt;&#x2F;code&gt; which is equal to &lt;code&gt;(imm &amp;gt;&amp;gt; 4) + 1&lt;&#x2F;code&gt;, and the variable &lt;code&gt;m&lt;&#x2F;code&gt; which is equal to &lt;code&gt;(imm &amp;amp; 0x0F) + 1&lt;&#x2F;code&gt; (i.e., the first and second nibbles of &lt;code&gt;imm&lt;&#x2F;code&gt;, converted to one-indexing).&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Code validation is extended to check that no relative jump instruction (&lt;code&gt;RJUMP&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt;) targets immediate values of &lt;code&gt;DUPN&lt;&#x2F;code&gt;, &lt;code&gt;SWAPN&lt;&#x2F;code&gt; or &lt;code&gt;EXCHANGE&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The stack validation algorithm of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5450&#x2F;&quot;&gt;EIP-5450&lt;&#x2F;a&gt; is extended:
&lt;ol&gt;
&lt;li&gt;Before &lt;code&gt;DUPN&lt;&#x2F;code&gt; if the current stack height is less than &lt;code&gt;n&lt;&#x2F;code&gt;, code is invalid. After &lt;code&gt;DUPN&lt;&#x2F;code&gt;, the stack height is incremented.&lt;&#x2F;li&gt;
&lt;li&gt;Before &lt;code&gt;SWAPN&lt;&#x2F;code&gt; if the current stack height is less than &lt;code&gt;n + 1&lt;&#x2F;code&gt;, code is invalid. After &lt;code&gt;SWAPN&lt;&#x2F;code&gt;, the stack height is unchanged.&lt;&#x2F;li&gt;
&lt;li&gt;Before &lt;code&gt;EXCHANGE&lt;&#x2F;code&gt; if the current stack height is less than &lt;code&gt;n + m + 1&lt;&#x2F;code&gt;, code is invalid. After &lt;code&gt;EXCHANGE&lt;&#x2F;code&gt;, the stack height is unchanged.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Execution rules:
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;DUPN&lt;&#x2F;code&gt;: the &lt;code&gt;n&lt;&#x2F;code&gt;&#x27;th stack item is duplicated at the top of the stack. (&lt;em&gt;Note: We use 1-based indexing here.&lt;&#x2F;em&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SWAPN&lt;&#x2F;code&gt;: the &lt;code&gt;n + 1&lt;&#x2F;code&gt;&#x27;th stack item is swapped with the top of the stack.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;EXCHANGE&lt;&#x2F;code&gt;: the &lt;code&gt;n + 1&lt;&#x2F;code&gt;&#x27;th stack item is swapped with the &lt;code&gt;n + m + 1&lt;&#x2F;code&gt;&#x27;th stack item.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The gas cost for all three instructions is set at 3.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;use-of-an-immediate-argument&quot;&gt;Use of an immediate argument&lt;&#x2F;h3&gt;
&lt;p&gt;Allowing dynamic selection of the arguments to swap, dup, or exchange could be used to prevent static analysis of the contents of the stack. Since static analysis is an important tool for security auditors we want to do what we can to make their jobs easier. Hence, the operands require an immediate argument that is not dynamic in nature.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;eof-only&quot;&gt;EOF-only&lt;&#x2F;h3&gt;
&lt;p&gt;Since this instruction depends on an immediate argument encoding, it can only be enabled within EOF. In legacy bytecode that encoding could contradict jumpdest-analysis.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;size-of-immediate-argument&quot;&gt;Size of immediate argument&lt;&#x2F;h3&gt;
&lt;p&gt;For &lt;code&gt;DUPN&lt;&#x2F;code&gt; and &lt;code&gt;SWAPN&lt;&#x2F;code&gt; a 16-bit size was considered to accommodate the full stack space of 1024 items, however:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;that would require an additional restriction&#x2F;check (&lt;code&gt;n &amp;lt; 1024&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;the 256 depth is a large improvement over the current 16 and the overhead of an extra byte would make it less useful&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Similarly for &lt;code&gt;EXCHANGE&lt;&#x2F;code&gt;, the proposed scheme allows addressing of 32 items.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-cost&quot;&gt;Gas cost&lt;&#x2F;h3&gt;
&lt;p&gt;The gas cost for these operations is the same as for existing &lt;code&gt;DUP*&lt;&#x2F;code&gt; and &lt;code&gt;SWAP*&lt;&#x2F;code&gt; instructions, because they are just implemented as pointer swaps.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;exchange-vs-swapn&quot;&gt;&lt;code&gt;EXCHANGE&lt;&#x2F;code&gt; vs &lt;code&gt;SWAPN&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;As mentioned before, &lt;code&gt;EXCHANGE&lt;&#x2F;code&gt; is important to compilers implementing stack scheduling algorithms. Specifically, in the case that a stack item is scheduled to be consumed deeper in the stack (for instance, the 3rd item in the stack needs to be moved into 2nd position in order to be consumed by the next operation), that currently takes three instructions, &lt;code&gt;SWAP2 SWAP3 SWAP2&lt;&#x2F;code&gt;. However, in the EVM implementation, the implementation is just a pointer swap, so it could be implemented in a single instruction at no extra runtime cost to the client.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This has no effect on backwards compatibility because the opcodes were not previously allocated and the feature is only enabled in EOF.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Given &lt;code&gt;stack[]&lt;&#x2F;code&gt; is a 0-based data structure, and &lt;code&gt;n&lt;&#x2F;code&gt;, &lt;code&gt;m&lt;&#x2F;code&gt; and &lt;code&gt;imm&lt;&#x2F;code&gt; are defined as according to the spec:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;DUPN imm&lt;&#x2F;code&gt; to fail validation if &lt;code&gt;stack_height &amp;lt; n&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SWAPN imm&lt;&#x2F;code&gt; to fail validation if &lt;code&gt;stack_height &amp;lt; n + 1&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;EXCHANGE imm&lt;&#x2F;code&gt; to fail validation if &lt;code&gt;stack_height &amp;lt; n + m + 1&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;DUPN imm&lt;&#x2F;code&gt; to increment maximum stack height of a function. Validation fails if maximum stack height exceeds limit of 1023.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;DUPN imm&lt;&#x2F;code&gt;, &lt;code&gt;SWAPN imm&lt;&#x2F;code&gt;, and &lt;code&gt;EXCHANGE imm&lt;&#x2F;code&gt; to fail at run-time if gas available is less than 3.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;DUPN imm&lt;&#x2F;code&gt; should duplicate the &lt;code&gt;stack[n - 1]&lt;&#x2F;code&gt; item and push it to the stack&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SWAPN imm&lt;&#x2F;code&gt; should swap &lt;code&gt;stack[n]&lt;&#x2F;code&gt; with &lt;code&gt;stack[stack.top()]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;EXCHANGE imm&lt;&#x2F;code&gt; should swap &lt;code&gt;stack[n]&lt;&#x2F;code&gt; with &lt;code&gt;stack[n + m]&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The authors are not aware of any additional risks introduced here. The EVM stack is fixed at 1024 items and most implementations keep that in memory at all times. This change will increase the number of stack items accessible via single instruction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Embedding transaction status code in receipts</title>
        <published>2017-06-30T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Nick Johnson</name><email>nick@ethereum.org</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/658/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/658/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:658"
            label="EIP-658" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/658/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP replaces the intermediate state root field of the receipt with a status code indicating if the top-level call succeeded or failed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;With the introduction of the REVERT opcode in EIP140, it is no longer possible for users to assume that a transaction failed iff it consumed all gas. As a result, there is no clear mechanism for callers to determine whether a transaction succeeded and the state changes contained in it were applied.&lt;&#x2F;p&gt;
&lt;p&gt;Full nodes can provide RPCs to get a transaction return status and value by replaying the transaction, but fast nodes can only do this for nodes after their pivot point, and light nodes cannot do this at all, making a non-consensus solution impractical.&lt;&#x2F;p&gt;
&lt;p&gt;Instead, we propose to replace the intermediate state root, already obsoleted by EIP98, with the return status (1 for success, 0 for failure). This both allows callers to determine success status, and remedies the previous omission of return data from the receipt.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;For blocks where block.number &amp;gt;= BYZANTIUM_FORK_BLKNUM, the intermediate state root is replaced by a status code, 0 indicating failure (due to any operation that can cause the transaction or top-level call to revert) and 1 indicating success.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This constitutes a minimal possible change that permits fetching the success&#x2F;failure state of transactions, preserving existing capabilities with minimum disruption or additional work for Metropolis.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Metropolis Difficulty Bomb Delay and Block Reward Reduction</title>
        <published>2017-06-21T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Afri Schoedon</name><uri>https://github.com/5chdn</uri>
	</author>
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/649/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/649" />
        

        <id>https://wg-eips.ritovision.com/649/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:649"
            label="EIP-649" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/649/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;The average block times are increasing due to the difficulty bomb (also known as the &quot;&lt;em&gt;ice age&lt;&#x2F;em&gt;&quot;) slowly accelerating. This EIP proposes to delay the difficulty bomb for approximately one and a half year and to reduce the block rewards with the Byzantium fork, the first part of the Metropolis fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Starting with &lt;code&gt;BYZANTIUM_FORK_BLKNUM&lt;&#x2F;code&gt; the client will calculate the difficulty based on a fake block number suggesting the client that the difficulty bomb is adjusting around 3 million blocks later than previously specified with the Homestead fork. Furthermore, block rewards will be adjusted to a base of 3 ETH, uncle and nephew rewards will be adjusted accordingly.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The Casper development and switch to proof-of-stake is delayed, the Ethash proof-of-work should be feasible for miners and allow sealing new blocks every 15 seconds on average for another one and a half years. With the delay of the ice age, there is a desire to not suddenly also increase miner rewards. The difficulty bomb has been known about for a long time and now it&#x27;s going to stop from happening. In order to maintain stability of the system, a block reward reduction that offsets the ice age delay would leave the system in the same general state as before. Reducing the reward also decreases the likelihood of a miner driven chain split as Ethereum approaches proof-of-stake.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h4 id=&quot;relax-difficulty-with-fake-block-number&quot;&gt;Relax Difficulty with Fake Block Number&lt;&#x2F;h4&gt;
&lt;p&gt;For the purposes of &lt;code&gt;calc_difficulty&lt;&#x2F;code&gt;, simply replace the use of &lt;code&gt;block.number&lt;&#x2F;code&gt;, as used in the exponential ice age component, with the formula:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;fake_block_number = max(0, block.number - 3_000_000) if block.number &amp;gt;= BYZANTIUM_FORK_BLKNUM else block.number&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;adjust-block-uncle-and-nephew-rewards&quot;&gt;Adjust Block, Uncle, and Nephew rewards&lt;&#x2F;h4&gt;
&lt;p&gt;To ensure a constant Ether issuance, adjust the block reward to &lt;code&gt;new_block_reward&lt;&#x2F;code&gt;, where&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;new_block_reward = 3_000_000_000_000_000_000 if block.number &amp;gt;= BYZANTIUM_FORK_BLKNUM else block.reward&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;(3E18 wei, or 3,000,000,000,000,000,000 wei, or 3 ETH).&lt;&#x2F;p&gt;
&lt;p&gt;Analogue, if an uncle is included in a block for &lt;code&gt;block.number &amp;gt;= BYZANTIUM_FORK_BLKNUM&lt;&#x2F;code&gt; such that &lt;code&gt;block.number - uncle.number = k&lt;&#x2F;code&gt;, the uncle reward is&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;new_uncle_reward = (8 - k) * new_block_reward &#x2F; 8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This is the existing pre-Metropolis formula for uncle rewards, simply adjusted with &lt;code&gt;new_block_reward&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The nephew reward for &lt;code&gt;block.number &amp;gt;= BYZANTIUM_FORK_BLKNUM&lt;&#x2F;code&gt; is&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;new_nephew_reward = new_block_reward &#x2F; 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This is the existing pre-Metropolis formula for nephew rewards, simply adjusted with &lt;code&gt;new_block_reward&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This will delay the ice age by 42 million seconds (approximately 1.4 years), so the chain would be back at 30 second block times at the end of 2018. An alternate proposal was to add special rules to the difficulty calculation to effectively &lt;em&gt;pause&lt;&#x2F;em&gt; the difficulty between different blocks. This would lead to similar results.&lt;&#x2F;p&gt;
&lt;p&gt;This was previously discussed at All Core Devs Meeting &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;pm&#x2F;blob&#x2F;master&#x2F;AllCoreDevs-EL-Meetings&#x2F;Meeting%209.md#metropolis-timing-and-roadmap-discussion&quot;&gt;#09&lt;&#x2F;a&gt;, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;pm&#x2F;blob&#x2F;master&#x2F;AllCoreDevs-EL-Meetings&#x2F;Meeting%2012.md#5-metropolis-update&quot;&gt;#12&lt;&#x2F;a&gt;, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;pm&#x2F;blob&#x2F;master&#x2F;AllCoreDevs-EL-Meetings&#x2F;Meeting%2013.md#3-eip-186-reduce-eth-issuance-before-proof-of-stake-hudson&quot;&gt;#13&lt;&#x2F;a&gt;, and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;pm&#x2F;blob&#x2F;master&#x2F;AllCoreDevs-EL-Meetings&#x2F;Meeting%2014.md#1-eip-186-reduce-eth-issuance-before-proof-of-stake-core-devs&quot;&gt;#14&lt;&#x2F;a&gt;. Consensus on the specification was achieved in All Core Devs Meeting &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;pm&#x2F;blob&#x2F;master&#x2F;AllCoreDevs-EL-Meetings&#x2F;Meeting%2019.md&quot;&gt;#19&lt;&#x2F;a&gt; and specification drafted in EIP issue &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;649&quot;&gt;#649&lt;&#x2F;a&gt;. It was decided to replace EIP &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;186&quot;&gt;#186&lt;&#x2F;a&gt; and include the block reward reduction along with the difficulty bomb delay in All Core Devs Meeting &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;pm&#x2F;blob&#x2F;master&#x2F;AllCoreDevs-EL-Meetings&#x2F;Meeting%2020.md&quot;&gt;#20&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;pm&#x2F;blob&#x2F;master&#x2F;AllCoreDevs-EL-Meetings&#x2F;Meeting%2021.md&quot;&gt;#21&lt;&#x2F;a&gt;; accepted in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;pm&#x2F;blob&#x2F;master&#x2F;AllCoreDevs-EL-Meetings&#x2F;Meeting%2022.md&quot;&gt;#22&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is not forward compatible and introduces backwards incompatibilities in the difficulty calculation, as well as the block, uncle and nephew reward structure. Therefore, it should be included in a scheduled hardfork at a certain block number. It&#x27;s suggested to include this EIP in the first of the two Metropolis hard-forks, the &lt;em&gt;Byzantium&lt;&#x2F;em&gt; fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases exist in ethereum&#x2F;tests &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;tests&#x2F;pull&#x2F;269&quot;&gt;#269&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The following clients implemented EIP-649:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Geth &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;go-ethereum&#x2F;pull&#x2F;15028&quot;&gt;#15028&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Parity &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;paritytech&#x2F;parity&#x2F;pull&#x2F;5855&quot;&gt;#5855&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;EthereumJ &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;ethereumj&#x2F;pull&#x2F;927&quot;&gt;#927&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Cpp-Ethereum &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;cpp-ethereum&#x2F;issues&#x2F;4050&quot;&gt;#4050&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;PyEthereum &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;pyethereum&#x2F;pull&#x2F;383&quot;&gt;#383&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The Yellow Paper implements EIP-649 in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;yellowpaper&#x2F;pull&#x2F;333&quot;&gt;#333&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Other notable implementations:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Eth-Isabelle &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;pirapira&#x2F;eth-isabelle&#x2F;issues&#x2F;459&quot;&gt;#459&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Py-EVM &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;py-evm&#x2F;pull&#x2F;123&quot;&gt;#123&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Storage of text records in ENS</title>
        <published>2017-05-17T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Richard Moore</name><uri>https://github.com/ricmoo</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/634/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/2439" />
        

        <id>https://wg-eips.ritovision.com/634/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:634"
            label="ERC-634" />
        

        
        

        
        <summary type="html">Profiles for ENS resolvers to store arbitrary text key&#x2F;value pairs.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/634/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP defines a resolver profile for ENS that permits the lookup of arbitrary key-value
text data. This allows ENS name holders to associate e-mail addresses, URLs and other
informational data with a ENS name.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;There is often a desire for human-readable metadata to be associated with otherwise
machine-driven data; used for debugging, maintenance, reporting and general information.&lt;&#x2F;p&gt;
&lt;p&gt;In this EIP we define a simple resolver profile for ENS that permits ENS names to
associate arbitrary key-value text.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;resolver-profile&quot;&gt;Resolver Profile&lt;&#x2F;h3&gt;
&lt;p&gt;A new resolver interface is defined, consisting of the following method:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC634&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @notice&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the text data associated with a key for an ENS name&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; node&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A nodehash for an ENS name&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; A key to lookup text data for&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; The&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; text data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; text&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; text&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;EIP-165&lt;&#x2F;a&gt; interface ID of this interface is &lt;code&gt;0x59d1d43c&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;text&lt;&#x2F;code&gt; data may be any arbitrary UTF-8 string. If the key is not present, the empty string
must be returned.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;global-keys&quot;&gt;Global Keys&lt;&#x2F;h3&gt;
&lt;p&gt;Global Keys must be made up of lowercase letters, numbers and
the hyphen (-).&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;avatar&lt;&#x2F;strong&gt; - a URL to an image used as an avatar or logo&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;description&lt;&#x2F;strong&gt; - A description of the name&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;display&lt;&#x2F;strong&gt; - a canonical display name for the ENS name; this MUST match the ENS name when its case is folded, and clients should ignore this value if it does not (e.g. &lt;code&gt;&quot;ricmoo.eth&quot;&lt;&#x2F;code&gt; could set this to &lt;code&gt;&quot;RicMoo.eth&quot;&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;email&lt;&#x2F;strong&gt; - an e-mail address&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;keywords&lt;&#x2F;strong&gt; - A list of comma-separated keywords, ordered by most significant first; clients that interpresent this field may choose a threshold beyond which to ignore&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;mail&lt;&#x2F;strong&gt; - A physical mailing address&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;notice&lt;&#x2F;strong&gt; - A notice regarding this name&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;location&lt;&#x2F;strong&gt; - A generic location (e.g. &lt;code&gt;&quot;Toronto, Canada&quot;&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;phone&lt;&#x2F;strong&gt; - A phone number as an E.164 string&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;url&lt;&#x2F;strong&gt; - a website URL&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;service-keys&quot;&gt;Service Keys&lt;&#x2F;h3&gt;
&lt;p&gt;Service Keys must be made up of a &lt;em&gt;reverse dot notation&lt;&#x2F;em&gt; for
a namespace which the service owns, for example, DNS names
(e.g. &lt;code&gt;.com&lt;&#x2F;code&gt;, &lt;code&gt;.io&lt;&#x2F;code&gt;, etc) or ENS name (i.e. &lt;code&gt;.eth&lt;&#x2F;code&gt;). Service
Keys must contain at least one dot.&lt;&#x2F;p&gt;
&lt;p&gt;This allows new services to start using their own keys without
worrying about colliding with existing services and also means
new services do not need to update this document.&lt;&#x2F;p&gt;
&lt;p&gt;The following services are common, which is why recommendations are
provided here, but ideally a service would declare its own key.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;com.github&lt;&#x2F;strong&gt; - a GitHub username&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;com.peepeth&lt;&#x2F;strong&gt; - a Peepeth username&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;com.linkedin&lt;&#x2F;strong&gt; - a LinkedIn username&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;com.twitter&lt;&#x2F;strong&gt; - a Twitter username&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;io.keybase&lt;&#x2F;strong&gt; - a Keybase username&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;org.telegram&lt;&#x2F;strong&gt; - a Telegram username&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This technique also allows for a service owner to specify a hierarchy
for their keys, such as:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;com.example.users&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;com.example.groups&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;com.example.groups.public&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;com.example.groups.private&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;legacy-keys&quot;&gt;Legacy Keys&lt;&#x2F;h3&gt;
&lt;p&gt;The following keys were specified in earlier versions of this EIP,
which is still in draft.&lt;&#x2F;p&gt;
&lt;p&gt;Their use is not likely very wide, but applications attempting
maximal compatibility may wish to query these keys as a fallback
if the above replacement keys fail.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;vnd.github&lt;&#x2F;strong&gt; - a GitHub username (renamed to &lt;code&gt;com.github&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;vnd.peepeth&lt;&#x2F;strong&gt; - a peepeth username (renamced to &lt;code&gt;com.peepeth&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;vnd.twitter&lt;&#x2F;strong&gt; - a twitter username (renamed to &lt;code&gt;com.twitter&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;application-specific-vs-general-purpose-record-types&quot;&gt;Application-specific vs general-purpose record types&lt;&#x2F;h3&gt;
&lt;p&gt;Rather than define a large number of specific record types (each for generally human-readable
data) such as &lt;code&gt;url&lt;&#x2F;code&gt; and &lt;code&gt;email&lt;&#x2F;code&gt;, we follow an adapted model of DNS&#x27;s &lt;code&gt;TXT&lt;&#x2F;code&gt; records, which allow
for a general keys and values, allowing future extension without adjusting the resolver, while
allowing applications to use custom keys for their own purposes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Not applicable.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;None.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Whisper Specification</title>
        <published>2017-05-05T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vlad Gluhovsky</name><email>gluk256@gmail.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/627/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/627/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="networking"
                label="Networking" />
            
        

        
        <category
            term="tag:eip:627"
            label="EIP-627" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/627/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP describes the format of Whisper messages within the ÐΞVp2p Wire Protocol.
This EIP should substitute the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;wiki&#x2F;wiki&#x2F;Whisper-Wire-Protocol&quot;&gt;existing specification&lt;&#x2F;a&gt;.
More detailed documentation on Whisper could be found &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;go-ethereum&#x2F;wiki&#x2F;Whisper&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;It is necessary to specify the standard for Whisper messages in order to ensure forward compatibility of different Whisper clients.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;All Whisper messages sent as ÐΞVp2p Wire Protocol packets should be RLP-encoded arrays of data containing two objects: integer packet code followed by another object (whose type depends on the packet code).&lt;&#x2F;p&gt;
&lt;p&gt;If Whisper node does not support a particular packet code, it should just ignore the packet without generating any error.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;packet-codes&quot;&gt;Packet Codes&lt;&#x2F;h3&gt;
&lt;p&gt;The message codes reserved for Whisper protocol: 0 - 127.
Messages with unknown codes must be ignored, for forward compatibility of future versions.&lt;&#x2F;p&gt;
&lt;p&gt;The Whisper sub-protocol should support the following packet codes:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;EIP&lt;&#x2F;th&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Int Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;Status&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;Messages&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;PoW Requirement&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;Bloom Filter&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;-------&lt;&#x2F;td&gt;&lt;td&gt;----------------------------&lt;&#x2F;td&gt;&lt;td&gt;-----------&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The following message codes are optional, but they are reserved for specific purpose.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;EIP&lt;&#x2F;th&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Int Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;P2P Request&lt;&#x2F;td&gt;&lt;td&gt;126&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;P2P Message&lt;&#x2F;td&gt;&lt;td&gt;127&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;-------&lt;&#x2F;td&gt;&lt;td&gt;----------------------------&lt;&#x2F;td&gt;&lt;td&gt;-----------&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;packet-format-and-usage&quot;&gt;Packet Format and Usage&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;Status&lt;&#x2F;strong&gt; [&lt;code&gt;0&lt;&#x2F;code&gt;]&lt;&#x2F;p&gt;
&lt;p&gt;This packet contains two objects: integer message code (0x00) followed by a list of values: integer version, float PoW requirement, and bloom filter, in this order. The bloom filter parameter is optional; if it is missing or nil, the node is considered to be full node (i.e. accepts all messages). The format of PoW and bloom filter please see below (message codes 2 and 3).&lt;&#x2F;p&gt;
&lt;p&gt;Status message should be sent after the initial handshake and prior to any other messages.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Messages&lt;&#x2F;strong&gt; [&lt;code&gt;1&lt;&#x2F;code&gt;, &lt;code&gt;whisper_envelopes&lt;&#x2F;code&gt;]&lt;&#x2F;p&gt;
&lt;p&gt;This packet contains two objects: integer message code (0x01) followed by a list (possibly empty) of Whisper Envelopes.&lt;&#x2F;p&gt;
&lt;p&gt;This packet is used for sending the standard Whisper envelopes.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;PoW Requirement&lt;&#x2F;strong&gt; [&lt;code&gt;2&lt;&#x2F;code&gt;, &lt;code&gt;PoW&lt;&#x2F;code&gt;]&lt;&#x2F;p&gt;
&lt;p&gt;This packet contains two objects: integer message code (0x02) followed by a single floating point value of PoW. This value is the IEEE 754 binary representation of 64-bit floating point number. Values of qNAN, sNAN, INF and -INF are not allowed. Negative values are also not allowed.&lt;&#x2F;p&gt;
&lt;p&gt;This packet is used by Whisper nodes for dynamic adjustment of their individual PoW requirements. Recipient of this message should no longer deliver the sender messages with PoW lower than specified in this message.&lt;&#x2F;p&gt;
&lt;p&gt;PoW is defined as average number of iterations, required to find the current BestBit (the number of leading zero bits in the hash), divided by message size and TTL:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PoW = (2**BestBit) &#x2F; (size * TTL)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;PoW calculation:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;fn short_rlp(envelope) = rlp of envelope, excluding env_nonce field.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;fn pow_hash(envelope, env_nonce) = sha3(short_rlp(envelope) ++ env_nonce)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;fn pow(pow_hash, size, ttl) = 2**leading_zeros(pow_hash) &#x2F; (size * ttl)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where size is the size of the full RLP-encoded envelope.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Bloom Filter&lt;&#x2F;strong&gt; [&lt;code&gt;3&lt;&#x2F;code&gt;, &lt;code&gt;bytes&lt;&#x2F;code&gt;]&lt;&#x2F;p&gt;
&lt;p&gt;This packet contains two objects: integer message code (0x03) followed by a byte array of arbitrary size.&lt;&#x2F;p&gt;
&lt;p&gt;This packet is used by Whisper nodes for sharing their interest in messages with specific topics.&lt;&#x2F;p&gt;
&lt;p&gt;The Bloom filter is used to identify a number of topics to a peer without compromising (too much) privacy over precisely what topics are of interest. Precise control over the information content (and thus efficiency of the filter) may be maintained through the addition of bits.&lt;&#x2F;p&gt;
&lt;p&gt;Blooms are formed by the bitwise OR operation on a number of bloomed topics. The bloom function takes the topic and projects them onto a 512-bit slice. At most, three bits are marked for each bloomed topic.&lt;&#x2F;p&gt;
&lt;p&gt;The projection function is defined as a mapping from a 4-byte slice S to a 512-bit slice D; for ease of explanation, S will dereference to bytes, whereas D will dereference to bits.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;LET D[*] = 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;FOREACH i IN { 0, 1, 2 } DO&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;LET n = S[i]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;IF S[3] &amp;amp; (2 ** i) THEN n += 256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;D[n] = 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;END FOR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;OPTIONAL&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;P2P Request&lt;&#x2F;strong&gt; [&lt;code&gt;126&lt;&#x2F;code&gt;, &lt;code&gt;whisper_envelope&lt;&#x2F;code&gt;]&lt;&#x2F;p&gt;
&lt;p&gt;This packet contains two objects: integer message code (0x7E) followed by a single Whisper Envelope.&lt;&#x2F;p&gt;
&lt;p&gt;This packet is used for sending Dapp-level peer-to-peer requests, e.g. Whisper Mail Client requesting old messages from the Whisper Mail Server.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;P2P Message&lt;&#x2F;strong&gt; [&lt;code&gt;127&lt;&#x2F;code&gt;, &lt;code&gt;whisper_envelope&lt;&#x2F;code&gt;]&lt;&#x2F;p&gt;
&lt;p&gt;This packet contains two objects: integer message code (0x7F) followed by a single Whisper Envelope.&lt;&#x2F;p&gt;
&lt;p&gt;This packet is used for sending the peer-to-peer messages, which are not supposed to be forwarded any further. E.g. it might be used by the Whisper Mail Server for delivery of old (expired) messages, which is otherwise not allowed.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;whisper-envelope&quot;&gt;Whisper Envelope&lt;&#x2F;h3&gt;
&lt;p&gt;Envelopes are RLP-encoded structures of the following format:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[ Expiry, TTL, Topic, Data, Nonce ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;Expiry&lt;&#x2F;code&gt;: 4 bytes (UNIX time in seconds).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;TTL&lt;&#x2F;code&gt;: 4 bytes (time-to-live in seconds).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;Topic&lt;&#x2F;code&gt;: 4 bytes of arbitrary data.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;Data&lt;&#x2F;code&gt;: byte array of arbitrary size (contains encrypted message).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;Nonce&lt;&#x2F;code&gt;: 8 bytes of arbitrary data (used for PoW calculation).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;contents-of-data-field-of-the-message-optional&quot;&gt;Contents of Data Field of the Message (Optional)&lt;&#x2F;h3&gt;
&lt;p&gt;This section outlines the optional description of Data Field to set up an example. Later it may be moved to a separate EIP.&lt;&#x2F;p&gt;
&lt;p&gt;It is only relevant if you want to decrypt the incoming message, but if you only want to send a message, any other format would be perfectly valid and must be forwarded to the peers.&lt;&#x2F;p&gt;
&lt;p&gt;Data field contains encrypted message of the Envelope. In case of symmetric encryption, it also contains appended Salt (a.k.a. AES Nonce, 12 bytes). Plaintext (unencrypted) payload consists of the following concatenated fields: flags, auxiliary field, payload, padding and signature (in this sequence).&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;flags: 1 byte; first two bits contain the size of auxiliary field, third bit indicates whether the signature is present.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;auxiliary field: up to 4 bytes; contains the size of payload.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;payload: byte array of arbitrary size (may be zero).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;padding: byte array of arbitrary size (may be zero).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;signature: 65 bytes, if present.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;salt: 12 bytes, if present (in case of symmetric encryption).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Those unable to decrypt the message data are also unable to access the signature. The signature, if provided, is the ECDSA signature of the Keccak-256 hash of the unencrypted data using the secret key of the originator identity. The signature is serialised as the concatenation of the &lt;code&gt;R&lt;&#x2F;code&gt;, &lt;code&gt;S&lt;&#x2F;code&gt; and &lt;code&gt;V&lt;&#x2F;code&gt; parameters of the SECP-256k1 ECDSA signature, in that order. &lt;code&gt;R&lt;&#x2F;code&gt; and &lt;code&gt;S&lt;&#x2F;code&gt; are both big-endian encoded, fixed-width 256-bit unsigned. &lt;code&gt;V&lt;&#x2F;code&gt; is an 8-bit big-endian encoded, non-normalised and should be either 27 or 28.&lt;&#x2F;p&gt;
&lt;p&gt;The padding field was introduced in order to align the message size, since message size alone might reveal important metainformation. Padding can be arbitrary size. However, it is recommended that the size of Data Field (excluding the Salt) before encryption (i.e. plain text) should be factor of 256 bytes.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;payload-encryption&quot;&gt;Payload Encryption&lt;&#x2F;h3&gt;
&lt;p&gt;Asymmetric encryption uses the standard Elliptic Curve Integrated Encryption Scheme with SECP-256k1 public key.&lt;&#x2F;p&gt;
&lt;p&gt;Symmetric encryption uses AES GCM algorithm with random 96-bit nonce.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Packet codes 0x00 and 0x01 are already used in all Whisper versions.&lt;&#x2F;p&gt;
&lt;p&gt;Packet code 0x02 will be necessary for the future development of Whisper. It will provide possibility to adjust the PoW requirement in real time. It is better to allow the network to govern itself, rather than hardcode any specific value for minimal PoW requirement.&lt;&#x2F;p&gt;
&lt;p&gt;Packet code 0x03 will be necessary for scalability of the network. In case of too much traffic, the nodes will be able to request and receive only the messages they are interested in.&lt;&#x2F;p&gt;
&lt;p&gt;Packet codes 0x7E and 0x7F may be used to implement Whisper Mail Server and Client. Without P2P messages it would be impossible to deliver the old messages, since they will be recognized as expired, and the peer will be disconnected for violating the Whisper protocol. They might be useful for other purposes when it is not possible to spend time on PoW, e.g. if a stock exchange will want to provide live feed about the latest trades.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is compatible with Whisper version 6. Any client which does not implement certain packet codes should gracefully ignore the packets with those codes. This will ensure the forward compatibility.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The golang implementation of Whisper (v.6) already uses packet codes 0x00 - 0x03. Parity&#x27;s implementation of v.6 will also use codes 0x00 - 0x03. Codes 0x7E and 0x7F are reserved, but still unused and left for custom implementation of Whisper Mail Server.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Token with transaction handling model</title>
        <published>2017-05-03T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Dexaran</name><uri>https://github.com/Dexaran</uri><email>dexaran@ethereumclassic.org</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/223/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/erc-223-token-standard/12894" />
        

        <id>https://wg-eips.ritovision.com/223/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:223"
            label="ERC-223" />
        

        
        

        
        <summary type="html">Token with transaction handling model designed to behave identical to native currency (ether)</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/223/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The following describes an interface and logic for fungible tokens that supports a &lt;code&gt;tokenReceived&lt;&#x2F;code&gt; callback to notify contract recipients when tokens are received. This makes tokens behave identical to ether.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This token introduces a communication model for contracts that can be utilized to straighten the behavior of contracts that interact with such tokens. Specifically, this proposal:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Informs receiving contracts of incoming token transfers, as opposed to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; where the recipient of a token transfer gets no notification.&lt;&#x2F;li&gt;
&lt;li&gt;Is more gas-efficient when depositing tokens to contracts.&lt;&#x2F;li&gt;
&lt;li&gt;Allows for &lt;code&gt;_data&lt;&#x2F;code&gt; recording for financial transfers.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Contracts intending to receive these tokens MUST implement &lt;code&gt;tokenReceived&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Token transfers to contracts not implementing &lt;code&gt;tokenReceived&lt;&#x2F;code&gt; as described below MUST revert.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;token-contract&quot;&gt;Token contract&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;token-methods&quot;&gt;Token Methods&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;totalsupply&quot;&gt;&lt;code&gt;totalSupply&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Returns the total supply of the token. The functionality of this method is identical to that of ERC-20.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;name&quot;&gt;&lt;code&gt;name&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Returns the name of the token.  The functionality of this method is identical to that of ERC-20.&lt;&#x2F;p&gt;
&lt;p&gt;OPTIONAL - This method can be used to improve usability, but interfaces and other contracts MUST NOT expect these values to be present.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;symbol&quot;&gt;&lt;code&gt;symbol&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; symbol&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Returns the symbol of the token. The functionality of this method is identical to that of ERC-20.&lt;&#x2F;p&gt;
&lt;p&gt;OPTIONAL - This method can be used to improve usability, but interfaces and other contracts MUST NOT expect these values to be present.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;decimals&quot;&gt;&lt;code&gt;decimals&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; decimals&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Returns the number of decimals of the token. The functionality of this method is identical to that of ERC-20.&lt;&#x2F;p&gt;
&lt;p&gt;OPTIONAL - This method can be used to improve usability, but interfaces and other contracts MUST NOT expect these values to be present.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;balanceof&quot;&gt;&lt;code&gt;balanceOf&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Returns the account balance of another account with address &lt;code&gt;_owner&lt;&#x2F;code&gt;. The functionality of this method is identical to that of ERC-20.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;transfer-address-uint&quot;&gt;&lt;code&gt;transfer(address, uint)&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This function must transfer tokens, and if &lt;code&gt;_to&lt;&#x2F;code&gt; is a contract, it must call the &lt;code&gt;tokenReceived(address, uint256, bytes calldata)&lt;&#x2F;code&gt; function of &lt;code&gt;_to&lt;&#x2F;code&gt;. If the &lt;code&gt;tokenReceived&lt;&#x2F;code&gt; function is not implemented in &lt;code&gt;_to&lt;&#x2F;code&gt; (recipient contract), then the transaction must fail and the transfer of tokens must be reverted.
If &lt;code&gt;_to&lt;&#x2F;code&gt; is an externally owned address, then the transaction must be sent without executing &lt;code&gt;tokenReceived&lt;&#x2F;code&gt; in &lt;code&gt;_to&lt;&#x2F;code&gt;.
&lt;code&gt;_data&lt;&#x2F;code&gt; can be attached to this token transaction, but it requires more gas. &lt;code&gt;_data&lt;&#x2F;code&gt; can be empty.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;tokenReceived&lt;&#x2F;code&gt; function of &lt;code&gt;_to&lt;&#x2F;code&gt; MUST be called after all other operations to avoid re-entrancy attacks.&lt;&#x2F;p&gt;
&lt;p&gt;NOTE: If &lt;code&gt;transfer&lt;&#x2F;code&gt; function is &lt;code&gt;payable&lt;&#x2F;code&gt; and ether was deposited then the amount of deposited ether MUST be delivered to &lt;code&gt;_to&lt;&#x2F;code&gt; address alongside tokens. If ether was sent alongside tokens in this way then ether MUST be delivered first, then token balances must be updated, then &lt;code&gt;tokenReceived&lt;&#x2F;code&gt; function MUST be called in &lt;code&gt;_to&lt;&#x2F;code&gt; if it is a contract.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;transfer-address-uint-bytes&quot;&gt;&lt;code&gt;transfer(address, uint, bytes)&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This function must transfer tokens and invoke the function &lt;code&gt;tokenReceived (address, uint256, bytes)&lt;&#x2F;code&gt; in &lt;code&gt;_to&lt;&#x2F;code&gt;, if &lt;code&gt;_to&lt;&#x2F;code&gt; is a contract. If the &lt;code&gt;tokenReceived&lt;&#x2F;code&gt; function is not implemented in &lt;code&gt;_to&lt;&#x2F;code&gt; (recipient contract), then the transaction must fail and the transfer of tokens must not occur.
If &lt;code&gt;_to&lt;&#x2F;code&gt; is an externally owned address (determined by the code size being zero), then the transaction must be sent without executing &lt;code&gt;tokenReceived&lt;&#x2F;code&gt; in &lt;code&gt;_to&lt;&#x2F;code&gt;.
&lt;code&gt;_data&lt;&#x2F;code&gt; can be attached to this token transaction, but it requires more gas. &lt;code&gt;_data&lt;&#x2F;code&gt; can be empty.&lt;&#x2F;p&gt;
&lt;p&gt;NOTE: A possible way to check whether the &lt;code&gt;_to&lt;&#x2F;code&gt; is a contract or an address is to assemble the code of &lt;code&gt;_to&lt;&#x2F;code&gt;. If there is no code in &lt;code&gt;_to&lt;&#x2F;code&gt;, then this is an externally owned address, otherwise it&#x27;s a contract. If &lt;code&gt;transfer&lt;&#x2F;code&gt; function is &lt;code&gt;payable&lt;&#x2F;code&gt; and ether was deposited then the amount of deposited ether MUST be delivered to &lt;code&gt;_to&lt;&#x2F;code&gt; address alongside tokens.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;tokenReceived&lt;&#x2F;code&gt; function of &lt;code&gt;_to&lt;&#x2F;code&gt; MUST be called after all other operations to avoid re-entrancy attacks.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;events&quot;&gt;Events&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;transfer&quot;&gt;&lt;code&gt;Transfer&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Triggered when tokens are transferred. Compatible with and similar to the ERC-20 &lt;code&gt;Transfer&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;erc-223-token-receiver&quot;&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;223&#x2F;&quot;&gt;ERC-223&lt;&#x2F;a&gt; Token Receiver&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;receiver-methods&quot;&gt;Receiver Methods&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenReceived&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;A function for handling token transfers, which is called from the token contract, when a token holder sends tokens. &lt;code&gt;_from&lt;&#x2F;code&gt; is the address of the sender of the token, &lt;code&gt;_value&lt;&#x2F;code&gt; is the amount of incoming tokens, and &lt;code&gt;_data&lt;&#x2F;code&gt; is attached data similar to &lt;code&gt;msg.data&lt;&#x2F;code&gt; of ether transactions. It works by analogy with the fallback function of Ether transactions and returns nothing.&lt;&#x2F;p&gt;
&lt;p&gt;NOTE: &lt;code&gt;msg.sender&lt;&#x2F;code&gt; will be a token-contract inside the &lt;code&gt;tokenReceived&lt;&#x2F;code&gt; function. It may be important to filter which tokens were sent (by token-contract address). The token sender (the person who initiated the token transaction) will be &lt;code&gt;_from&lt;&#x2F;code&gt; inside the &lt;code&gt;tokenReceived&lt;&#x2F;code&gt; function. The &lt;code&gt;tokenReceived&lt;&#x2F;code&gt; function must return &lt;code&gt;0x8943ec02&lt;&#x2F;code&gt; after handling an incoming token transfer. The &lt;code&gt;tokenReceived&lt;&#x2F;code&gt; function call can be handled by the fallback function of the recipient contact (and in this case it may not return the magic value 0x8943ec02).&lt;&#x2F;p&gt;
&lt;p&gt;IMPORTANT: This function must be named &lt;code&gt;tokenReceived&lt;&#x2F;code&gt; and take parameters &lt;code&gt;address&lt;&#x2F;code&gt;, &lt;code&gt;uint256&lt;&#x2F;code&gt;, &lt;code&gt;bytes&lt;&#x2F;code&gt; to match the function signature &lt;code&gt;0x8943ec02&lt;&#x2F;code&gt;. This function can be manually called by a EOA.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This standard introduces a communication model by enforcing the &lt;code&gt;transfer&lt;&#x2F;code&gt; to execute a handler function in the destination address. This is an important security consideration as it is required that the receiver explicitly implements the token handling function. In cases where the receiver does not implements such function the transfer MUST be reverted.&lt;&#x2F;p&gt;
&lt;p&gt;This standard sticks to the push transaction model where the transfer of assets is initiated on the senders side and handled on the receivers side. As the result, ERC-223 transfers are more gas-efficient while dealing with depositing to contracts as ERC-223 tokens can be deposited with just one transaction while ERC-20 tokens require at least two calls (one for &lt;code&gt;approve&lt;&#x2F;code&gt; and the second that will invoke &lt;code&gt;transferFrom&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; deposit: &lt;code&gt;approve&lt;&#x2F;code&gt; ~46 gas, &lt;code&gt;transferFrom&lt;&#x2F;code&gt; ~75K gas&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;ERC-223 deposit: &lt;code&gt;transfer&lt;&#x2F;code&gt; and handling on the receivers side ~54K gas&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This standard introduces the ability to correct user errors by allowing to handle ANY transactions on the recipients side and reject incorrect or improper transfers. This tokens utilize ONE transferring method for both types of interactions with contracts and externally owned addresses which can simplify the user experience and allow to avoid possible user mistakes.&lt;&#x2F;p&gt;
&lt;p&gt;One downside of the commonly used &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; standard that ERC-223 is intended to solve is that &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; implements two methods of token transferring: (1) &lt;code&gt;transfer&lt;&#x2F;code&gt; function and (2) &lt;code&gt;approve + transferFrom&lt;&#x2F;code&gt; pattern. Transfer function of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; standard does not notify the receiver and therefore if any tokens are sent to a contract with the &lt;code&gt;transfer&lt;&#x2F;code&gt; function then the receiver will not recognize this transfer and the tokens can become stuck in the receivers address without any possibility of recovering them. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; standard places the burden of determining the transferring method on the user and if the incorrect method is chosen the user can lose the transferred tokens. ERC-223 automatically determines the transferring method, preventing the user from losing tokens due to choosing wrong method.&lt;&#x2F;p&gt;
&lt;p&gt;ERC-223 is intended to simplify the interaction with contracts that are intended to work with tokens. ERC-223 utilizes a &quot;deposit&quot; pattern, similar to that of plain Ether. An ERC-223 deposit to a contract is a simple call of the &lt;code&gt;transfer&lt;&#x2F;code&gt; function. This is one transaction as opposed to two step process of &lt;code&gt;approve + transferFrom&lt;&#x2F;code&gt; depositing.&lt;&#x2F;p&gt;
&lt;p&gt;This standard allows payloads to be attached to transactions using the &lt;code&gt;bytes calldata _data&lt;&#x2F;code&gt; parameter, which can encode a second function call in the destination address, similar to how &lt;code&gt;msg.data&lt;&#x2F;code&gt; does in an ether transaction, or allow for public logging on chain should it be necessary for financial transactions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The interface of this token is similar to that of ERC-20 and most functions serve the same purpose as their analogues in ERC-20.
&lt;code&gt;transfer(address, uint256, bytes calldata)&lt;&#x2F;code&gt; function is not backwards compatible with ERC-20 interface.&lt;&#x2F;p&gt;
&lt;p&gt;ERC-20 tokens can be delivered to a non-contract address with &lt;code&gt;transfer&lt;&#x2F;code&gt; function. ERC-20 tokens can be deposited to a contract address with &lt;code&gt;approve&lt;&#x2F;code&gt; + &lt;code&gt;transferFrom&lt;&#x2F;code&gt; pattern. Depositing ERC-20 tokens to the contract address with &lt;code&gt;transfer&lt;&#x2F;code&gt; function will always result in token deposit not being recognized by the recipient contract.&lt;&#x2F;p&gt;
&lt;p&gt;Here is an example of the contract code that handles ERC-20 token deposit. The following contract can accepts &lt;code&gt;tokenA&lt;&#x2F;code&gt; deposits. It is impossible to prevent deposits of non-tokenA to this contract. If tokenA is deposited with &lt;code&gt;transfer&lt;&#x2F;code&gt; function then it will result in a loss of tokens for the depositor because the balance of the user will be decreased in the contract of tokenA but the value of &lt;code&gt;deposits&lt;&#x2F;code&gt; variable in the &lt;code&gt;ERC20Receiver&lt;&#x2F;code&gt; will not be increased i.e. the deposit will not be credited. As of 5&#x2F;9&#x2F;2023 &lt;strong&gt;$201M worth of 50 examined ERC-20 tokens are already lost&lt;&#x2F;strong&gt; in this way on Ethereum mainnet.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC20Receiver&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; tokenA&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; deposits&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; deposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_token &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt; tokenA&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        IERC20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_token&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        deposits&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;ERC-223 tokens must be delivered to non-contract address or contract address in the same way with &lt;code&gt;transfer&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;p&gt;Here is an example of the contract code that handles ERC-223 token deposit. The following contract can filter tokens and only accepts &lt;code&gt;tokenA&lt;&#x2F;code&gt;. Other ERC-223 tokens would be rejected.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC223Receiver&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; tokenA&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; deposits&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenReceived&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; tokenA&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        deposits&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_from&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x8943ec02&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This token utilizes the model similar to plain ether behavior. Therefore replay issues must be taken into account.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.19&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;library&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Address&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns true if `account` is a contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * This test is non-exhaustive, and there may be false-negatives: during the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * execution of a contract&amp;#39;s constructor, its address will be reported as&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * not containing a contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &amp;gt; It is unsafe to assume that an address for which this function returns&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * false is an externally-owned account (EOA) and not a contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This method relies in extcodesize, which returns 0 for contracts in&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; construction, since the code is only stored at the end of the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; constructor execution.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; size&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; solhint-disable&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;-next-line no-inline-assembly&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt; size &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; extcodesize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; size &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;abstract&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IERC223Recipient&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Standard ERC-223 receiving function that will handle incoming token transfers.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  Token sender address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Amount of tokens.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  Transaction metadata.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tokenReceived&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; virtual&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@title&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Reference implementation of the ERC223 standard token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ERC223Token&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Event that is fired on successful transfer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  private&lt;&#x2F;span&gt;&lt;span&gt; _name&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  private&lt;&#x2F;span&gt;&lt;span&gt; _symbol&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   private&lt;&#x2F;span&gt;&lt;span&gt; _decimals&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; _totalSupply&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; balances&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; List of user balances.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sets the values for {name} and {symbol}, initializes {decimals} with&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * a default value of 18.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * To select a different value for {decimals}, use {_setupDecimals}.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * All three of these values are immutable: they can only be set once during&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * construction.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; new_name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; new_symbol&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; new_decimals&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _name     &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; new_name&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _symbol   &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; new_symbol&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _decimals &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; new_decimals&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the name of the token.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _name&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the symbol of the token, usually a shorter version of the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * name.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; symbol&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _symbol&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the number of decimals used to get its user representation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * For example, if `decimals` equals `2`, a balance of `505` tokens should&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * be displayed to a user as `5,05` (`505 &#x2F; 10 ** 2`).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Tokens usually opt for a value of 18, imitating the relationship between&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Ether and Wei. This is the value {ERC223} uses, unless {_setupDecimals} is&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * called.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;NOTE&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: This information is only used for _display_ purposes: it in&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * no way affects any of the arithmetic of the contract, including&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * {IERC223-balanceOf} and {IERC223-transfer}.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; decimals&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _decimals&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See {IERC223-totalSupply}.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; _totalSupply&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; See {IERC223-standard}.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; standard&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;223&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns balance of the `_owner`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;   The address whose balance will be returned.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Balance of the `_owner`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_owner&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfer the specified amount of tokens to the specified address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      Invokes the `tokenFallback` function if the recipient is a contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      The token transfer fails if the recipient is a contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      but does not implement the `tokenFallback` function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      or the fallback function to receive funds.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    Receiver address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Amount of tokens that will be transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  Transaction metadata.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Standard function transfer similar to ERC20 transfer with no _data .&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Added due to backwards compatibility reasons .&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_to&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_to&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;Address&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            IERC223Recipient&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;tokenReceived&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transfer the specified amount of tokens to the specified address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      This function works the same with the previous one&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      but doesn&amp;#39;t contain `_data` param.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *      Added due to backwards compatibility reasons.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;    Receiver address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Amount of tokens that will be transferred.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; _empty &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;00000000&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_to&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;_to&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;Address&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;            IERC223Recipient&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;tokenReceived&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _empty&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        emit&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _empty&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>SIMD Operations for the EVM</title>
        <published>2017-04-25T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Greg Colvin</name><email>greg@colvin.org</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/616/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/616/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:616"
            label="EIP-616" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/616/">&lt;h2 id=&quot;abstract&quot;&gt;ABSTRACT&lt;&#x2F;h2&gt;
&lt;p&gt;A proposal to provide Single Instruction Multiple Data types and operations for the Ethereum Virtual Machine, making full use of the 256-bit wide EVM stack items, and offering substantial performance gains for both vector and scalar operations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;MOTIVATION&lt;&#x2F;h2&gt;
&lt;p&gt;Most all modern CPUs include SIMD hardware that operates on wide registers of data, applying a Single Instruction to Multiple Data lanes in parallel, where lanes divide a register into a vector of scalar elements of equal size.  This model is an excellent fit for the wide stack items of the EVM, offering substantial performance boosts for operations that can be expressed as parallel operations on vectors of scalars.  For some examples, a brief literature search finds SIMD speedups of&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;up to 7X for &lt;a rel=&quot;external&quot; href=&quot;http:&#x2F;&#x2F;keccak.noekeon.org&#x2F;sw_performance.html&quot;&gt;SHA-512&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;4X for &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;link.springer.com&#x2F;chapter&#x2F;10.1007&#x2F;3-540-45439-X_16&quot;&gt;elliptic curve scalar multiplication&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;3X to 4X for &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;minio&#x2F;blake2b-simd&quot;&gt;BLAKE2b&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;up to 3X for &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;software.intel.com&#x2F;en-us&#x2F;articles&#x2F;improving-openssl-performance&quot;&gt;OpenSSL&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;2X to 3X for &lt;a rel=&quot;external&quot; href=&quot;http:&#x2F;&#x2F;ieee-hpec.org&#x2F;2013&#x2F;index_htm_files&#x2F;24-Simd-acceleration-Pabbuleti-2886999.pdf&quot;&gt;elliptic curve modular multiplication&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;1.7X to 1.9X for &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;minio&#x2F;sha256-simd&quot;&gt;SHA-256&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;1.3X for &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;citeseerx.ist.psu.edu&#x2F;viewdoc&#x2F;download?doi=10.1.1.738.1218&amp;amp;rep=rep1&amp;amp;type=pdf&quot;&gt;RSA encryption&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;SPECIFICATION&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;encoding&quot;&gt;Encoding&lt;&#x2F;h3&gt;
&lt;p&gt;We propose a simple encoding of SIMD operations as extended two-byte codes.  The first byte is the opcode, and the second byte is the SIMD type: scalar type, lane width, and number of elements.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;N bits&lt;&#x2F;th&gt;&lt;th&gt;Field&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;8&lt;&#x2F;td&gt;&lt;td&gt;opcode&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;scalar type: 0 = unsigned integer, 1 = IEEE float&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;reserved: 0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;lane width: log base 2 of the number of bytes, as an MSB first integer&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;reserved: 0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;element count: log base 2 of the number of lanes, as an MSB first integer&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Thus we can specify SIMD types with unsigned integer lanes from 8 to 64 bits in vectors of 32 to 2 lanes, respectively.  Floating point lanes however support only 32- and 64-bit IEEE floating point.  And a type of &lt;em&gt;0x7F&lt;&#x2F;em&gt; represents a normal 256-bit EVM integer.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Note that when the element count is one the operation is on one scalar, so this specification also provides for native operations on single scalars of native sizes.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Note that floating point operations are &lt;strong&gt;not&lt;&#x2F;strong&gt; proposed for inclusion in the initial release, but we considered it important to reserve code space for possible future expansion.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;semantics&quot;&gt;Semantics&lt;&#x2F;h3&gt;
&lt;p&gt;We define the following extended versions of the EVM&#x27;s arithmetic, logic, and comparison operations.  As with the normal versions, they consume their arguments from the stack and place their results on the stack, except that their arguments are vectors rather than scalars.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;lo\hi&lt;&#x2F;th&gt;&lt;th&gt;B&lt;&#x2F;th&gt;&lt;th&gt;C&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;XLT&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;XADD&lt;&#x2F;td&gt;&lt;td&gt;XGT&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;XMUL&lt;&#x2F;td&gt;&lt;td&gt;XSLT&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;XSUB&lt;&#x2F;td&gt;&lt;td&gt;XSGT&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;4&lt;&#x2F;td&gt;&lt;td&gt;XDIV&lt;&#x2F;td&gt;&lt;td&gt;XEQ&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;td&gt;XSDIV&lt;&#x2F;td&gt;&lt;td&gt;XISZERO&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;6&lt;&#x2F;td&gt;&lt;td&gt;XMOD&lt;&#x2F;td&gt;&lt;td&gt;XAND&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;7&lt;&#x2F;td&gt;&lt;td&gt;XSMOD&lt;&#x2F;td&gt;&lt;td&gt;XOR&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;8&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;XXOR&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;9&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;XNOT&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;A&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;XINDEX&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;B&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;XSHL&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;C&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;XSHR&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;D&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;XSAR&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;E&lt;&#x2F;td&gt;&lt;td&gt;XCAST&lt;&#x2F;td&gt;&lt;td&gt;XROL&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;F&lt;&#x2F;td&gt;&lt;td&gt;XSHUFFLE&lt;&#x2F;td&gt;&lt;td&gt;XROR&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Except for XSHUFFLE, XCAST, and XINDEX all the extended operations on unsigned integer values have the same semantics as the corresponding operations for codes 01 through 1F, except that the modulus varies by scalar type and the operations are applied pair-wise to the elements of the source operands to compute the destination elements.  &lt;em&gt;The source operands must have the same element type and number of elements.&lt;&#x2F;em&gt;  E.g.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH uint8[1, 2, 3]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH uint8[4, 5, 6]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;XADD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;leaves&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;uint8[5, 7, 9]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;on the stack.&lt;&#x2F;p&gt;
&lt;p&gt;XSHUFFLE takes two vectors on the stack: a vector to permute and a permutation mask.  E.g.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH uint64[4, 5, 6, 0]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH uint8[2, 0, 1, 3]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SHUFFLE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;leaves&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;uint64[6, 4, 5 , 0]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;on the stack. The mask must have integral type, and the same number of elements as the source vector.&lt;&#x2F;p&gt;
&lt;p&gt;The second byte of the XCAST opcode is applied to the item on the stack to create a new vector of the specified type.  Elements are converted according to the usual C conventions, missing elements are set to zero, and extra elements are discarded.  If the stack item is not a vector it is converted to a vector by taking its bits least-significant-bit first and copying them into the corresponding bits of each element, least-significant-element first.  Again, excess data is truncated and missing data is 0-filled.  Vectors are converted to 256-bit EVM integers via the reverse process., with elements that are floating point NANs normalized to all bits on.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Note that MLOAD and MSTORE are valid only on 256-bit EVM integers.  For SIMD vectors an XCAST is needed after a load and before a store to convert vectors to and from 256-bit integers.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;XINDEX has the same semantics as BYTE, except that individual elements of the vector are indexed.&lt;&#x2F;p&gt;
&lt;p&gt;Floating point values follow IEEE 754 semantics.  Since those are not defined for shifting and rotating those operations are defined here as having no effect.&lt;&#x2F;p&gt;
&lt;p&gt;Extended operations other than XSHUFFLE and XCAST are only valid on vectors of the same SIMD type.  This can be validated at contract creation time, or else checked at runtime.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;subroutines&quot;&gt;Subroutines&lt;&#x2F;h3&gt;
&lt;p&gt;If &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;pull&#x2F;187&quot;&gt;EIP-187&lt;&#x2F;a&gt; is accepted a type-safe syntax for declaring subroutines taking vector arguments will be needed.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;BEGINSUBX n_args, arg_types... n_results, result_types...&lt;&#x2F;code&gt;
marks the &lt;strong&gt;single&lt;&#x2F;strong&gt; entry to a subroutine.  &lt;code&gt;n_args&lt;&#x2F;code&gt; items are taken off of the stack at entry to, and &lt;code&gt;n_results&lt;&#x2F;code&gt; items are placed on the stack at return from the subroutine. &lt;code&gt;n_args&lt;&#x2F;code&gt; and &lt;code&gt;n_results&lt;&#x2F;code&gt; are given as one immediate byte each.  The &lt;code&gt;arg_types&lt;&#x2F;code&gt; and &lt;code&gt;result_types&lt;&#x2F;code&gt; are given in the same encoding as second byte of the SIMD opcodes, and must match the values on the stack.  The bytecode for a subroutine ends at the next &lt;code&gt;BEGINSUB&lt;&#x2F;code&gt;, &lt;code&gt;BEGINSUBX&lt;&#x2F;code&gt; or &lt;code&gt;BEGINDATA&lt;&#x2F;code&gt; instruction or at the end of the bytecode.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;RATIONALE&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, the lowest common denominator for SIMD hardware (e.g. Intel SSE2 and ARM Neon) is 16-byte registers supporting integer lanes of 1, 2, 4, and 8 bytes, and floating point lanes of 4 and 8 bytes.  More recent SIMD hardware (e.g. Intel AVX) supports 32-byte registers, and EVM stack items are also 32 bytes wide.  The limits above derive from these numbers, assuring that EVM code is within the bounds of available hardware - and the reserved bits provide room for growth.&lt;&#x2F;p&gt;
&lt;p&gt;For most modern languages (including Rust, Python, Go, Java, and C++) compilers can do a good job of generating SIMD code for parallelizable loops, and&#x2F;or there are intrinsics or libraries available for explicit access to SIMD hardware.  So a portable software implementation will likely provide good use of the hardware on most platforms, and intrinsics or libraries can be used as available and needed.  Thus we can expect these operations to take about the same (or for 256-bit vectors on 128-bit hardware up to twice) the time to execute regardless of element size or number of elements.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas&quot;&gt;Gas&lt;&#x2F;h3&gt;
&lt;p&gt;One motivation for these operations, besides taking full advantage of the hardware, is assigning lower gas costs for operations on smaller scalars.&lt;&#x2F;p&gt;
&lt;p&gt;On a machine with 64-bit registers the standard algorithms from Knuth&#x27;s &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;library.aceondo.net&#x2F;ebooks&#x2F;Computer_Science&#x2F;algorithm-the_art_of_computer_programming-knuth.pdf&quot;&gt;Art of Computer Programming&lt;&#x2F;a&gt; require 32-bit digits, using the upper half of a register for overflows, so for 256-bit values N=8 digits are needed, and for 64-bit values N=2 digits are needed.  The cycle counts for these algorithms are:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;operation&lt;&#x2F;th&gt;&lt;th&gt;cycles&lt;&#x2F;th&gt;&lt;th&gt;N = 2&lt;&#x2F;th&gt;&lt;th&gt;N = 4&lt;&#x2F;th&gt;&lt;th&gt;N = 8&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;add&lt;&#x2F;td&gt;&lt;td&gt;10 &lt;em&gt;N&lt;&#x2F;em&gt; + 6&lt;&#x2F;td&gt;&lt;td&gt;26&lt;&#x2F;td&gt;&lt;td&gt;46&lt;&#x2F;td&gt;&lt;td&gt;86&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;subtract&lt;&#x2F;td&gt;&lt;td&gt;12 &lt;em&gt;N&lt;&#x2F;em&gt; + 3&lt;&#x2F;td&gt;&lt;td&gt;27&lt;&#x2F;td&gt;&lt;td&gt;51&lt;&#x2F;td&gt;&lt;td&gt;99&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;multiply&lt;&#x2F;td&gt;&lt;td&gt;28 &lt;em&gt;N&lt;&#x2F;em&gt;**2 + 11 &lt;em&gt;N&lt;&#x2F;em&gt; + 3&lt;&#x2F;td&gt;&lt;td&gt;137&lt;&#x2F;td&gt;&lt;td&gt;495&lt;&#x2F;td&gt;&lt;td&gt;1883&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;divide&lt;&#x2F;td&gt;&lt;td&gt;15 &lt;em&gt;N&lt;&#x2F;em&gt;**2 + 119 &lt;em&gt;N&lt;&#x2F;em&gt; + 111&lt;&#x2F;td&gt;&lt;td&gt;409&lt;&#x2F;td&gt;&lt;td&gt;827&lt;&#x2F;td&gt;&lt;td&gt;2023&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The remaining operations are of about the same complexity as addition and subtraction, or less. Given that JUMPDEST is a no-op, and is assigned a gas price of 1, this can be taken as the overhead of the interpreter.  All of the arithmetic operations are assigned the same gas price of 5, for a remaining runtime of 4.  The interpreter loop itself takes about 6 to 8 C instructions, so ADD and SUB are reasonably priced, but MUL is some 5 to 21 times slower than ADD or SUB, and DIV is some 15 to 23 times slower, so they are clearly mispriced.&lt;&#x2F;p&gt;
&lt;p&gt;By comparison, on most &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;software.intel.com&#x2F;sites&#x2F;landingpage&#x2F;IntrinsicsGuide&quot;&gt;Intel&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;developer.arm.com&#x2F;docs&#x2F;100166&#x2F;latest&#x2F;programmers-model&#x2F;instruction-set-summary&#x2F;table-of-processor-instructions&quot;&gt;ARM&lt;&#x2F;a&gt; SIMD units instructions take approximately the following cycle counts, independent of register width.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;operation&lt;&#x2F;th&gt;&lt;th&gt;Intel cycles&lt;&#x2F;th&gt;&lt;th&gt;ARM cycles&lt;&#x2F;th&gt;&lt;th&gt;gas&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;add&lt;&#x2F;td&gt;&lt;td&gt;.5&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;subtract&lt;&#x2F;td&gt;&lt;td&gt;.5&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;multiply&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;divide&lt;&#x2F;td&gt;&lt;td&gt;10&lt;&#x2F;td&gt;&lt;td&gt;12&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Since all but the divide operation take fewer cycles than the interpreter overhead they are assigned the minimal cost of 1.  Division takes slightly more, and is assigned a cost of 2.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Ethereum purpose allocation for Deterministic Wallets</title>
        <published>2017-04-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Nick Johnson</name><uri>https://github.com/arachnid</uri>
	</author>
	
	<author>
		<name>Micah Zoltu</name><uri>https://github.com/micahzoltu</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/600/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-erc-app-keys-application-specific-wallet-accounts/2742" />
        

        <id>https://wg-eips.ritovision.com/600/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:600"
            label="ERC-600" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/600/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP defines a logical hierarchy for deterministic wallets based on &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;bitcoin&#x2F;bips&#x2F;blob&#x2F;master&#x2F;bip-0032.mediawiki&quot;&gt;BIP32&lt;&#x2F;a&gt;, the purpose scheme defined in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;bitcoin&#x2F;bips&#x2F;blob&#x2F;master&#x2F;bip-0043.mediawiki&quot;&gt;BIP43&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;bitcoin&#x2F;bips&#x2F;pull&#x2F;523&quot;&gt;this proposed change to BIP43&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP is a particular application of BIP43.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Because Ethereum is based on account balances rather than UTXO, the hierarchy defined by BIP44 is poorly suited. As a result, several competing derivation path strategies have sprung up for deterministic wallets, resulting in inter-client incompatibility. This BIP seeks to provide a path to standardise this in a fashion better suited to Ethereum&#x27;s unique requirements.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;We define the following 2 levels in BIP32 path:&lt;&#x2F;p&gt;
&lt;pre&gt;
m &#x2F; purpose&#x27; &#x2F; subpurpose&#x27; &#x2F; EIP&#x27;
&lt;&#x2F;pre&gt;
&lt;p&gt;Apostrophe in the path indicates that BIP32 hardened derivation is used.&lt;&#x2F;p&gt;
&lt;p&gt;Each level has a special meaning, described in the chapters below.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;purpose&quot;&gt;Purpose&lt;&#x2F;h3&gt;
&lt;p&gt;Purpose is set to 43, as documented in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;bitcoin&#x2F;bips&#x2F;pull&#x2F;523&quot;&gt;this proposed change to BIP43&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The purpose field indicates that this path is for a non-bitcoin cryptocurrency.&lt;&#x2F;p&gt;
&lt;p&gt;Hardened derivation is used at this level.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;subpurpose&quot;&gt;Subpurpose&lt;&#x2F;h3&gt;
&lt;p&gt;Subpurpose is set to 60, the SLIP-44 code for Ethereum.&lt;&#x2F;p&gt;
&lt;p&gt;Hardened derivation is used at this level.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;eip&quot;&gt;EIP&lt;&#x2F;h3&gt;
&lt;p&gt;EIP is set to the EIP number specifying the remainder of the BIP32 derivation path. This permits new Ethereum-focused applications of deterministic wallets without needing to interface with the BIP process.&lt;&#x2F;p&gt;
&lt;p&gt;Hardened derivation is used at this level.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The existing convention is to use the &#x27;Ethereum&#x27; coin type, leading to paths starting with &lt;code&gt;m&#x2F;44&#x27;&#x2F;60&#x27;&#x2F;*&lt;&#x2F;code&gt;. Because this still assumes a UTXO-based coin, we contend that this is a poor fit, resulting in standardisation, usability, and security compromises. As a result, we are making the above proposal to define an entirely new hierarchy for Ethereum-based chains.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The introduction of another derivation path requires existing software to add support for this scheme in addition to any existing schemes. Given the already confused nature of wallet derivation paths in Ethereum, we anticipate this will cause relatively little additional disruption, and has the potential to improve matters significantly in the long run.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;None yet.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;84&quot;&gt;This discussion on derivation paths&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Ethereum hierarchy for deterministic wallets</title>
        <published>2017-04-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Nick Johnson</name><uri>https://github.com/arachnid</uri>
	</author>
	
	<author>
		<name>Micah Zoltu</name><uri>https://github.com/micahzoltu</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/601/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-erc-app-keys-application-specific-wallet-accounts/2742" />
        

        <id>https://wg-eips.ritovision.com/601/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:601"
            label="ERC-601" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/601/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP defines a logical hierarchy for deterministic wallets based on &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;bitcoin&#x2F;bips&#x2F;blob&#x2F;master&#x2F;bip-0032.mediawiki&quot;&gt;BIP32&lt;&#x2F;a&gt;, the purpose scheme defined in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;bitcoin&#x2F;bips&#x2F;blob&#x2F;master&#x2F;bip-0043.mediawiki&quot;&gt;BIP43&lt;&#x2F;a&gt; and eip-draft-ethereum-purpose.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP is a particular application of eip-draft-ethereum-purpose.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;At present, different Ethereum clients and wallets use different derivation paths; a summary of them can be found &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;84#issuecomment-292324521&quot;&gt;here&lt;&#x2F;a&gt;. Some of these paths violate BIP44, the standard defining derivation paths starting with &lt;code&gt;m&#x2F;44&#x27;&#x2F;&lt;&#x2F;code&gt;. This creates confusion and incompatibility between wallet implementations, in some cases making funds from one wallet inaccessible on another, and in others requiring prompting users manually for a derivation path, which hinders usability.&lt;&#x2F;p&gt;
&lt;p&gt;Further, BIP44 was designed with UTXO-based blockchains in mind, and is a poor fit for Ethereum, which uses an accounts abstraction instead.&lt;&#x2F;p&gt;
&lt;p&gt;As an alternative, we propose a deterministic wallet hierarchy better tailored to Ethereum&#x27;s unique requirements.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;We define the following 4 levels in BIP32 path:&lt;&#x2F;p&gt;
&lt;pre&gt;
m &#x2F; purpose&#x27; &#x2F; subpurpose&#x27; &#x2F; EIP&#x27; &#x2F; wallet&#x27;
&lt;&#x2F;pre&gt;
&lt;p&gt;Apostrophe in the path indicates that BIP32 hardened derivation is used.&lt;&#x2F;p&gt;
&lt;p&gt;Each level has a special meaning, described in the chapters below.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;purpose&quot;&gt;Purpose&lt;&#x2F;h3&gt;
&lt;p&gt;Purpose is a constant set to 43, indicating the key derivation is for a non-bitcoin cryptocurrency.&lt;&#x2F;p&gt;
&lt;p&gt;Hardened derivation is used at this level.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;subpurpose&quot;&gt;Subpurpose&lt;&#x2F;h3&gt;
&lt;p&gt;Subpurpose is set to 60, the SLIP-44 code for Ethereum.&lt;&#x2F;p&gt;
&lt;p&gt;Hardened derivation is used at this level.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;eip&quot;&gt;EIP&lt;&#x2F;h3&gt;
&lt;p&gt;EIP is set to the EIP number specifying the remainder of the BIP32 derivation path. For paths following this EIP specification, the number assigned to this EIP is used.&lt;&#x2F;p&gt;
&lt;p&gt;Hardened derivation is used at this level.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;wallet&quot;&gt;Wallet&lt;&#x2F;h3&gt;
&lt;p&gt;This component of the path splits the wallet into different user identities, allowing a single wallet to have multiple public identities.&lt;&#x2F;p&gt;
&lt;p&gt;Accounts are numbered from index 0 in sequentially increasing manner. This number is used as child index in BIP32 derivation.&lt;&#x2F;p&gt;
&lt;p&gt;Hardened derivation is used at this level.&lt;&#x2F;p&gt;
&lt;p&gt;Software should prevent a creation of an account if a previous account does not have a transaction history (meaning its address has not been used before).&lt;&#x2F;p&gt;
&lt;p&gt;Software needs to discover all used accounts after importing the seed from an external source.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The existing convention is to use the &#x27;Ethereum&#x27; coin type, leading to paths starting with &lt;code&gt;m&#x2F;44&#x27;&#x2F;60&#x27;&#x2F;*&lt;&#x2F;code&gt;. Because this still assumes a UTXO-based coin, we contend that this is a poor fit, resulting in standardisation, usability, and security compromises. As a result, we are making the above proposal to define an entirely new hierarchy for Ethereum-based chains.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The introduction of another derivation path requires existing software to add support for this scheme in addition to any existing schemes. Given the already confused nature of wallet derivation paths in Ethereum, we anticipate this will cause relatively little additional disruption, and has the potential to improve matters significantly in the long run.&lt;&#x2F;p&gt;
&lt;p&gt;For applications that utilise mnemonics, the authors expect to submit another EIP draft that describes a method for avoiding backwards compatibility concerns when transitioning to this new derivation path.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;None yet.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;84&quot;&gt;This discussion on derivation paths&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Add `blockHash` to JSON-RPC filter options.</title>
        <published>2017-03-24T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Micah Zoltu</name><uri>https://github.com/MicahZoltu</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/234/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/234" />
        

        <id>https://wg-eips.ritovision.com/234/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="interface"
                label="Interface" />
            
        

        
        <category
            term="tag:eip:234"
            label="EIP-234" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/234/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Add an option to JSON-RPC filter options (used by &lt;code&gt;eth_newFilter&lt;&#x2F;code&gt; and &lt;code&gt;eth_getLogs&lt;&#x2F;code&gt;) that allows specifying the block hash that should be included in the results.  This option would be an alternative to &lt;code&gt;fromBlock&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;toBlock&lt;&#x2F;code&gt; options.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This addition would allow clients to fetch logs for specific blocks, whether those blocks were in the current main chain or not.  This resolves some issues that make it difficult&#x2F;expensive to author robust clients due to the nature of chain reorgs, unreliable network connections and the result set not containing enough details in the empty case.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The filter options used by &lt;code&gt;eth_newFilter&lt;&#x2F;code&gt; would have an additional optional parameter named &lt;code&gt;blockHash&lt;&#x2F;code&gt; whose value is a single block hash.  The Ethereum node responding to the request would either send back an error if the block hash was not found or it would return the results matching the filter (per normal operation) constrained to the block provided.  Internally, this would function (presumably) similar to the &lt;code&gt;fromBlock&lt;&#x2F;code&gt; and &lt;code&gt;toBlock&lt;&#x2F;code&gt; filter options.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;A client (dApp) who needs reliable notification of both log additions (on new blocks) and log removals (on chain reorgs) cannot achieve this while relying solely on subscriptions and filters.  This is because a combination of a network or remote node failure during a reorg can result in the client getting out of sync with reality.  An example of where this can happen with Websockets is when the client opens a web socket connection, sets up a log filter subscription, gets notified of some new logs, then loses the web socket connection, then (while disconnected) a re-org occurs, then the client connects back and establishes a new log filter.  In this scenario they will not receive notification of the log removals from the node because they were disconnected when the removals were broadcast and the loss of their connection resulted in the node forgetting about their existence.  A similar scenario can be concocted for HTTP clients where between polls for updates, the node goes down and comes back (resulting in loss of filter state) and a re-org also occurs between the same two polls.&lt;&#x2F;p&gt;
&lt;p&gt;In order to deal with this while still providing a robust mechanism for internal block&#x2F;log additional&#x2F;removal, the client can maintain a blockchain internally (last &lt;code&gt;n&lt;&#x2F;code&gt; blocks) and only subscribe&#x2F;poll for new blocks.  When a new block is received, the client can reconcile their internal model with the new block, potentially back-filling parents or rolling back&#x2F;removing blocks from their internal model to get in sync with the node.  This can account for any type of disconnect&#x2F;reorg&#x2F;outage scenario and also allows the client (as an added benefit) to talk to a cluster of Ethereum nodes (e.g., via round-robin) rather than being tightly coupled to a single node.&lt;&#x2F;p&gt;
&lt;p&gt;Once the user has a reliable stream of blocks, they can then look at the bloom filter for the new block and if the block &lt;em&gt;may&lt;&#x2F;em&gt; have logs of interest they can fetch the filtered logs for that block from the node.  The problem that arises is that a re-org may occur between when the client receives the block and when the client fetches the logs for that block.  Given the current set of filter options, the client can only ask for logs by block number.  In this scenario, the logs they get back will be for a block that &lt;em&gt;isn&#x27;t&lt;&#x2F;em&gt; the block they want the logs for and is instead for a block that was re-orged in (and may not be fully reconciled with the internal client state).  This can be partially worked around by looking at the resulting logs themselves and identifying whether or not they are for the block hash requested.  However, if the result set is an empty array (no logs fetched) then the client is in a situation where they don&#x27;t know what block the results are for.  The results could have been legitimately empty (bloom filter can yield false positives) for the block in question, or they could be receiving empty logs for a block that they don&#x27;t know about.  At this point, there is no decision the client can make that allows them a guarantee of recovery.  They can assume the empty logs were for the correct block, but if they weren&#x27;t then they will never try to fetch again.  This creates a problem if the block was only transiently re-orged out because it may come back before the next block poll so the client will never witness the reorg.  They can assume the empty logs were for the wrong block, and refetch them, but they may continue to get empty results putting them right back into the same situation.&lt;&#x2F;p&gt;
&lt;p&gt;By adding the ability to fetch logs by hash, the client can be guaranteed that if they get a result set, it is for the block in question.  If they get an error, then they can take appropriate action (e.g., rollback that block client-side and re-fetch latest).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The only potential issue here is the &lt;code&gt;fromBlock&lt;&#x2F;code&gt; and &lt;code&gt;toBlock&lt;&#x2F;code&gt; fields.  It wouldn&#x27;t make sense to include both the hash and the number so it seems like &lt;code&gt;fromBlock&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;toBlock&lt;&#x2F;code&gt; should be mutually exclusive with &lt;code&gt;blockHash&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;{ &quot;jsonrpc&quot;: &quot;2.0&quot;, &quot;id&quot;: 1, &quot;method&quot;: &quot;eth_getLogs&quot;, params: [{&quot;blockHash&quot;: &quot;0xbl0cbl0cbl0cbl0cbl0cbl0cbl0cbl0cbl0cbl0cbl0cbl0cbl0cbl0cbl0cbl0c&quot;}] }&lt;&#x2F;code&gt; should return all of the logs for the block with hash &lt;code&gt;0xbl0cbl0cbl0cbl0cbl0cbl0cbl0cbl0cbl0cbl0cbl0cbl0cbl0cbl0cbl0cbl0c&lt;&#x2F;code&gt;.  If a &lt;code&gt;topics&lt;&#x2F;code&gt; field is added to the filter options then a filtered set of logs for that block should be returned.  If no block exists with that hash then an error should be returned with a &lt;code&gt;code&lt;&#x2F;code&gt; of &lt;code&gt;-32000&lt;&#x2F;code&gt;, a &lt;code&gt;message&lt;&#x2F;code&gt; of &lt;code&gt;&quot;Block not found.&quot;&lt;&#x2F;code&gt; and a &lt;code&gt;data&lt;&#x2F;code&gt; of &lt;code&gt;&quot;0xbl0cbl0cbl0cbl0cbl0cbl0cbl0cbl0cbl0cbl0cbl0cbl0cbl0cbl0cbl0cbl0c&quot;&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;input disabled=&quot;&quot; type=&quot;checkbox&quot; checked=&quot;&quot;&#x2F;&gt;
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;go-ethereum&#x2F;pull&#x2F;16734&quot;&gt;Geth&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Clique proof-of-authority consensus protocol</title>
        <published>2017-03-06T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Péter Szilágyi</name><email>peterke@gmail.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/225/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/225" />
        

        <id>https://wg-eips.ritovision.com/225/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:225"
            label="EIP-225" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/225/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Clique is a proof-of-authority consensus protocol. It shadows the design of Ethereum mainnet, so it can be added to any client with minimal effort.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Ethereum&#x27;s first official testnet was Morden. It ran from July 2015 to about November 2016, when due to the accumulated junk and some testnet consensus issues between Geth and Parity, it was finally laid to rest in favor of a testnet reboot.&lt;&#x2F;p&gt;
&lt;p&gt;Ropsten was thus born, clearing out all the junk and starting with a clean slate. This ran well until the end of February 2017, when malicious actors decided to abuse the low PoW and gradually inflate the block gas limits to 9 billion (from the normal 4.7 million), at which point sending in gigantic transactions crippling the entire network. Even before that, attackers attempted multiple extremely long reorgs, causing network splits between different clients, and even different versions.&lt;&#x2F;p&gt;
&lt;p&gt;The root cause of these attacks is that a PoW network is only as secure as the computing capacity placed behind it. Restarting a new testnet from zero wouldn&#x27;t solve anything, since the attacker can mount the same attack over and over again. The Parity team decided to go with an emergency solution of rolling back a significant number of blocks, and enacting a soft-fork rule that disallows gas limits above a certain threshold.&lt;&#x2F;p&gt;
&lt;p&gt;While this solution may work in the short term:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;It&#x27;s not elegant: Ethereum supposed to have dynamic block limits&lt;&#x2F;li&gt;
&lt;li&gt;It&#x27;s not portable: other clients need to implement new fork logic themselves&lt;&#x2F;li&gt;
&lt;li&gt;It&#x27;s not compatible with sync modes: fast and light clients are both out of luck&lt;&#x2F;li&gt;
&lt;li&gt;It&#x27;s just prolonging the attacks: junk can still be steadily pushed in ad infinitum&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Parity&#x27;s solution although not perfect, is nonetheless workable. I&#x27;d like to propose a longer term alternative solution, which is more involved, yet should be simple enough to allow rolling out in a reasonable amount of time.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;standardized-proof-of-authority&quot;&gt;Standardized proof-of-authority&lt;&#x2F;h3&gt;
&lt;p&gt;As reasoned above, proof-of-work cannot work securely in a network with no value. Ethereum has its long term goal of proof-of-stake based on Casper, but that is heavy research so we cannot rely on that any time soon to fix today&#x27;s problems. One solution however is easy enough to implement, yet effective enough to fix the testnet properly, namely a proof-of-authority scheme.&lt;&#x2F;p&gt;
&lt;p&gt;The main design goals of the PoA protocol described here is that it should be very simple to implement and embed into any existing Ethereum client, while at the same time allow using existing sync technologies (fast, light, warp) without needing client developers to add custom logic to critical software.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;design-constraints&quot;&gt;Design constraints&lt;&#x2F;h2&gt;
&lt;p&gt;There are two approaches to syncing a blockchain in general:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The classical approach is to take the genesis block and crunch through all the transactions one by one. This is tried and proven, but in Ethereum complexity networks quickly turns out to be very costly computationally.&lt;&#x2F;li&gt;
&lt;li&gt;The other is to only download the chain of block headers and verify their validity, after which point an arbitrary recent state may be downloaded from the network and checked against recent headers.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;A PoA scheme is based on the idea that blocks may only be minted by trusted signers. As such, every block (or header) that a client sees can be matched against the list of trusted signers. The challenge here is how to maintain a list of authorized signers that can change in time? The obvious answer (store it in an Ethereum contract) is also the wrong answer: fast, light and warp sync don&#x27;t have access to the state during syncing.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;The protocol of maintaining the list of authorized signers must be fully contained in the block headers.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The next obvious idea would be to change the structure of the block headers so it drops the notions of PoW, and introduces new fields to cater for voting mechanisms. This is also the wrong answer: changing such a core data structure in multiple implementations would be a nightmare development, maintenance and security wise.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;The protocol of maintaining the list of authorized signers must fit fully into the current data models.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;So, according to the above, we can&#x27;t use the EVM for voting, rather have to resort to headers. And we can&#x27;t change header fields, rather have to resort to the currently available ones. Not much wiggle room.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;repurposing-header-fields-for-signing-and-voting&quot;&gt;Repurposing header fields for signing and voting&lt;&#x2F;h3&gt;
&lt;p&gt;The most obvious field that currently is used solely as &lt;em&gt;fun metadata&lt;&#x2F;em&gt; is the 32 byte &lt;strong&gt;extra-data&lt;&#x2F;strong&gt; section in block headers. Miners usually place their client and version in there, but some fill it with alternative &quot;messages&quot;. The protocol would extend this field &lt;del&gt;to&lt;&#x2F;del&gt; with 65 bytes with the purpose of a secp256k1 miner signature. This would allow anyone obtaining a block to verify it against a list of authorized signers. It also makes the &lt;strong&gt;miner&lt;&#x2F;strong&gt; section in block headers obsolete (since the address can be derived from the signature).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Note, changing the length of a header field is a non invasive operation as all code (such as RLP encoding, hashing) is agnostic to that, so clients wouldn&#x27;t need custom logic.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The above is enough to validate a chain, but how can we update a dynamic list of signers. The answer is that we can repurpose the newly obsoleted &lt;strong&gt;miner&lt;&#x2F;strong&gt; field and the PoA obsoleted &lt;strong&gt;nonce&lt;&#x2F;strong&gt; field to create a voting protocol:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;During regular blocks, both of these fields would be set to zero.&lt;&#x2F;li&gt;
&lt;li&gt;If a signer wishes to enact a change to the list of authorized signers, it will:
&lt;ul&gt;
&lt;li&gt;Set the &lt;strong&gt;miner&lt;&#x2F;strong&gt; to the signer it wishes to vote about&lt;&#x2F;li&gt;
&lt;li&gt;Set the &lt;strong&gt;nonce&lt;&#x2F;strong&gt; to &lt;code&gt;0&lt;&#x2F;code&gt; or &lt;code&gt;0xff...f&lt;&#x2F;code&gt; to vote in favor of adding or kicking out&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Any clients syncing the chain can &quot;tally&quot; up the votes during block processing, and maintain a dynamically changing list of authorized signers by popular vote.&lt;&#x2F;p&gt;
&lt;p&gt;To avoid having an infinite window to tally up votes in, and also to allow periodically flushing stale proposals, we can reuse the concept of an epoch from ethash, where every epoch transition flushes all pending votes. Furthermore, these epoch transitions can also act as stateless checkpoints containing the list of current authorized signers within the header extra-data. This permits clients to sync up based only on a checkpoint hash without having to replay all the voting that was done on the chain up to that point. It also allows the genesis header to fully define the chain, containing the list of initial signers.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;attack-vector-malicious-signer&quot;&gt;Attack vector: Malicious signer&lt;&#x2F;h3&gt;
&lt;p&gt;It may happen that a malicious user gets added to the list of signers, or that a signer key&#x2F;machine is compromised. In such a scenario the protocol needs to be able to defend itself against reorganizations and spamming. The proposed solution is that given a list of N authorized signers, any signer may only mint 1 block out of every K. This ensures that damage is limited, and the remainder of the miners can vote out the malicious user.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;attack-vector-censoring-signer&quot;&gt;Attack vector: Censoring signer&lt;&#x2F;h3&gt;
&lt;p&gt;Another interesting attack vector is if a signer (or group of signers) attempts to censor out blocks that vote on removing them from the authorization list. To work around this, we restrict the allowed minting frequency of signers to 1 out of N&#x2F;2. This ensures that malicious signers need to control at least 51% of signing accounts, at which case it&#x27;s game over anyway.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;attack-vector-spamming-signer&quot;&gt;Attack vector: Spamming signer&lt;&#x2F;h3&gt;
&lt;p&gt;A final small attack vector is that of malicious signers injecting new vote proposals inside every block they mint. Since nodes need to tally up all votes to create the actual list of authorized signers, they need to track all votes through time. Without placing a limit on the vote window, this could grow slowly, yet unbounded. The solution is to place a &lt;del&gt;moving&lt;&#x2F;del&gt; window of W blocks after which votes are considered stale. &lt;del&gt;A sane window might be 1-2 epochs.&lt;&#x2F;del&gt; We&#x27;ll call this an epoch.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;attack-vector-concurrent-blocks&quot;&gt;Attack vector: Concurrent blocks&lt;&#x2F;h3&gt;
&lt;p&gt;If the number of authorized signers are N, and we allow each signer to mint 1 block out of K, then at any point in time N-K+1 miners are allowed to mint. To avoid these racing for blocks, every signer would add a small random &quot;offset&quot; to the time it releases a new block. This ensures that small forks are rare, but occasionally still happen (as on the main net). If a signer is caught abusing it&#x27;s authority and causing chaos, it can be voted out.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;We define the following constants:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;EPOCH_LENGTH&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: Number of blocks after which to checkpoint and reset the pending votes.
&lt;ul&gt;
&lt;li&gt;Suggested &lt;code&gt;30000&lt;&#x2F;code&gt; for the testnet to remain analogous to the mainnet &lt;code&gt;ethash&lt;&#x2F;code&gt; epoch.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;BLOCK_PERIOD&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: Minimum difference between two consecutive block&#x27;s timestamps.
&lt;ul&gt;
&lt;li&gt;Suggested &lt;code&gt;15s&lt;&#x2F;code&gt; for the testnet to remain analogous to the mainnet &lt;code&gt;ethash&lt;&#x2F;code&gt; target.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;EXTRA_VANITY&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: Fixed number of extra-data prefix bytes reserved for signer &lt;em&gt;vanity&lt;&#x2F;em&gt;.
&lt;ul&gt;
&lt;li&gt;Suggested &lt;code&gt;32 bytes&lt;&#x2F;code&gt; to retain the current extra-data allowance and&#x2F;or use.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;EXTRA_SEAL&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: Fixed number of extra-data suffix bytes reserved for signer seal.
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;65 bytes&lt;&#x2F;code&gt; fixed as signatures are based on the standard &lt;code&gt;secp256k1&lt;&#x2F;code&gt; curve.&lt;&#x2F;li&gt;
&lt;li&gt;Filled with zeros on genesis block.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;NONCE_AUTH&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: Magic nonce number &lt;code&gt;0xffffffffffffffff&lt;&#x2F;code&gt; to vote on adding a new signer.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;NONCE_DROP&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: Magic nonce number &lt;code&gt;0x0000000000000000&lt;&#x2F;code&gt; to vote on removing a signer.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;UNCLE_HASH&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: Always &lt;code&gt;Keccak256(RLP([]))&lt;&#x2F;code&gt; as uncles are meaningless outside of PoW.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;DIFF_NOTURN&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: Block score (difficulty) for blocks containing out-of-turn signatures.
&lt;ul&gt;
&lt;li&gt;Suggested &lt;code&gt;1&lt;&#x2F;code&gt; since it just needs to be an arbitrary baseline constant.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;DIFF_INTURN&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: Block score (difficulty) for blocks containing in-turn signatures.
&lt;ul&gt;
&lt;li&gt;Suggested &lt;code&gt;2&lt;&#x2F;code&gt; to show a slight preference over out-of-turn signatures.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;We also define the following per-block constants:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;BLOCK_NUMBER&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: Block height in the chain, where the height of the genesis is block &lt;code&gt;0&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;SIGNER_COUNT&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: Number of authorized signers valid at a particular instance in the chain.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;SIGNER_INDEX&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: Zero-based index of the block signer in the sorted list of current authorized signers.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;SIGNER_LIMIT&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: Number of consecutive blocks out of which a signer may only sign one.
&lt;ul&gt;
&lt;li&gt;Must be &lt;code&gt;floor(SIGNER_COUNT &#x2F; 2) + 1&lt;&#x2F;code&gt; to enforce majority consensus on a chain.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;We repurpose the &lt;code&gt;ethash&lt;&#x2F;code&gt; header fields as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;beneficiary&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; &#x2F; &lt;strong&gt;&lt;code&gt;miner&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: Address to propose modifying the list of authorized signers with.
&lt;ul&gt;
&lt;li&gt;Should be filled with zeroes normally, modified only while voting.&lt;&#x2F;li&gt;
&lt;li&gt;Arbitrary values are permitted nonetheless (even meaningless ones such as voting out non signers) to avoid extra complexity in implementations around voting mechanics.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Must&lt;&#x2F;strong&gt; be filled with zeroes on checkpoint (i.e. epoch transition) blocks.&lt;&#x2F;li&gt;
&lt;li&gt;Transaction execution &lt;strong&gt;must&lt;&#x2F;strong&gt; use the actual block signer (see &lt;code&gt;extraData&lt;&#x2F;code&gt;) for the &lt;code&gt;COINBASE&lt;&#x2F;code&gt; opcode and transaction fees &lt;strong&gt;must&lt;&#x2F;strong&gt; be attributed to the signer account.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;nonce&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: Signer proposal regarding the account defined by the &lt;code&gt;beneficiary&lt;&#x2F;code&gt; field.
&lt;ul&gt;
&lt;li&gt;Should be &lt;strong&gt;&lt;code&gt;NONCE_DROP&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; to propose deauthorizing &lt;code&gt;beneficiary&lt;&#x2F;code&gt; as an existing signer.&lt;&#x2F;li&gt;
&lt;li&gt;Should be &lt;strong&gt;&lt;code&gt;NONCE_AUTH&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; to propose authorizing &lt;code&gt;beneficiary&lt;&#x2F;code&gt; as a new signer.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Must&lt;&#x2F;strong&gt; be filled with zeroes on checkpoint (i.e. epoch transition) blocks.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Must&lt;&#x2F;strong&gt; not take up any other value apart from the two above (for now).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;extraData&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: Combined field for signer vanity, checkpointing and signer signatures.
&lt;ul&gt;
&lt;li&gt;First &lt;strong&gt;&lt;code&gt;EXTRA_VANITY&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; bytes (fixed) may contain arbitrary signer vanity data.&lt;&#x2F;li&gt;
&lt;li&gt;Last &lt;strong&gt;&lt;code&gt;EXTRA_SEAL&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; bytes (fixed) is the signer&#x27;s signature sealing the header.&lt;&#x2F;li&gt;
&lt;li&gt;Checkpoint blocks &lt;strong&gt;must&lt;&#x2F;strong&gt; contain a list of signers (&lt;code&gt;N*20 bytes&lt;&#x2F;code&gt;) in between, &lt;strong&gt;omitted&lt;&#x2F;strong&gt; otherwise.&lt;&#x2F;li&gt;
&lt;li&gt;The list of signers in checkpoint block extra-data sections &lt;strong&gt;must&lt;&#x2F;strong&gt; be sorted in ascending byte order.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;mixHash&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: Reserved for fork protection logic, similar to the extra-data during the DAO.
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Must&lt;&#x2F;strong&gt; be filled with zeroes during normal operation.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;ommersHash&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: &lt;strong&gt;Must&lt;&#x2F;strong&gt; be &lt;strong&gt;&lt;code&gt;UNCLE_HASH&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; as uncles are meaningless outside of PoW.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;timestamp&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: &lt;strong&gt;Must&lt;&#x2F;strong&gt; be at least the parent timestamp + &lt;strong&gt;&lt;code&gt;BLOCK_PERIOD&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;difficulty&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: Contains the standalone score of the block to derive the quality of a chain.
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Must&lt;&#x2F;strong&gt; be &lt;strong&gt;&lt;code&gt;DIFF_NOTURN&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; if &lt;code&gt;BLOCK_NUMBER % SIGNER_COUNT != SIGNER_INDEX&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Must&lt;&#x2F;strong&gt; be &lt;strong&gt;&lt;code&gt;DIFF_INTURN&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; if &lt;code&gt;BLOCK_NUMBER % SIGNER_COUNT == SIGNER_INDEX&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;authorizing-a-block&quot;&gt;Authorizing a block&lt;&#x2F;h3&gt;
&lt;p&gt;To authorize a block for the network, the signer needs to sign the block&#x27;s sighash containing &lt;strong&gt;everything except the signature itself&lt;&#x2F;strong&gt;. This means that this hash contains every field of the header (&lt;code&gt;nonce&lt;&#x2F;code&gt; and &lt;code&gt;mixDigest&lt;&#x2F;code&gt; included), and also the  &lt;code&gt;extraData&lt;&#x2F;code&gt; with the exception of the 65 byte signature suffix. The fields are hashed in the order of their definition in the yellow paper. Note that this sighash differs from the final block hash which also includes the signature.&lt;&#x2F;p&gt;
&lt;p&gt;The sighash is signed using the standard &lt;code&gt;secp256k1&lt;&#x2F;code&gt; curve, and the resulting 65 byte signature (&lt;code&gt;R&lt;&#x2F;code&gt;, &lt;code&gt;S&lt;&#x2F;code&gt;, &lt;code&gt;V&lt;&#x2F;code&gt;, where &lt;code&gt;V&lt;&#x2F;code&gt; is &lt;code&gt;0&lt;&#x2F;code&gt; or &lt;code&gt;1&lt;&#x2F;code&gt;) is embedded into the &lt;code&gt;extraData&lt;&#x2F;code&gt; as the trailing 65 byte suffix.&lt;&#x2F;p&gt;
&lt;p&gt;To ensure malicious signers (loss of signing key) cannot wreck havoc in the network, each signer is allowed to sign &lt;strong&gt;maximum one&lt;&#x2F;strong&gt; out of &lt;strong&gt;&lt;code&gt;SIGNER_LIMIT&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; consecutive blocks. The order is not fixed, but in-turn signing weighs more (&lt;strong&gt;&lt;code&gt;DIFF_INTURN&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;) than out of turn one (&lt;strong&gt;&lt;code&gt;DIFF_NOTURN&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;).&lt;&#x2F;p&gt;
&lt;h4 id=&quot;authorization-strategies&quot;&gt;Authorization strategies&lt;&#x2F;h4&gt;
&lt;p&gt;As long as signers conform to the above specs, they can authorize and distribute blocks as they see fit. The following suggested strategy will however reduce network traffic and small forks, so it&#x27;s a suggested feature:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If a signer is allowed to sign a block (is on the authorized list and didn&#x27;t sign recently).
&lt;ul&gt;
&lt;li&gt;Calculate the optimal signing time of the next block (parent + &lt;strong&gt;&lt;code&gt;BLOCK_PERIOD&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;If the signer is in-turn, wait for the exact time to arrive, sign and broadcast immediately.&lt;&#x2F;li&gt;
&lt;li&gt;If the signer is out-of-turn, delay signing by &lt;code&gt;rand(SIGNER_COUNT * 500ms)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This small strategy will ensure that the in-turn signer (who&#x27;s block weighs more) has a slight advantage to sign and propagate versus the out-of-turn signers. Also the scheme allows a bit of scale with the increase of the number of signers.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;voting-on-signers&quot;&gt;Voting on signers&lt;&#x2F;h3&gt;
&lt;p&gt;Every epoch transition (genesis block included) acts as a stateless checkpoint, from which capable clients should be able to sync without requiring any previous state. This means epoch headers &lt;strong&gt;must not&lt;&#x2F;strong&gt; contain votes, all non settled votes are discarded, and tallying starts from scratch.&lt;&#x2F;p&gt;
&lt;p&gt;For all non-epoch transition blocks:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Signers may cast one vote per own block to propose a change to the authorization list.&lt;&#x2F;li&gt;
&lt;li&gt;Only the latest proposal per target beneficiary is kept from a single signer.&lt;&#x2F;li&gt;
&lt;li&gt;Votes are tallied live as the chain progresses (concurrent proposals allowed).&lt;&#x2F;li&gt;
&lt;li&gt;Proposals reaching majority consensus &lt;strong&gt;&lt;code&gt;SIGNER_LIMIT&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; come into effect immediately.&lt;&#x2F;li&gt;
&lt;li&gt;Invalid proposals are &lt;strong&gt;not&lt;&#x2F;strong&gt; to be penalized for client implementation simplicity.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;A proposal coming into effect entails discarding all pending votes for that proposal (both for and against) and starting with a clean slate.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;cascading-votes&quot;&gt;Cascading votes&lt;&#x2F;h4&gt;
&lt;p&gt;A complex corner case may arise during signer deauthorization. When a previously authorized signer is dropped, the number of signers required to approve a proposal might decrease by one. This might cause one or more pending proposals to reach majority consensus, the execution of which might further cascade into new proposals passing.&lt;&#x2F;p&gt;
&lt;p&gt;Handling this scenario is non obvious when multiple conflicting proposals pass simultaneously (e.g. add a new signer vs. drop an existing one), where the evaluation order might drastically change the outcome of the final authorization list. Since signers may invert their own votes in every block they mint, it&#x27;s not so obvious which proposal would be &quot;first&quot;.&lt;&#x2F;p&gt;
&lt;p&gt;To avoid the pitfalls cascading executions would entail, the Clique proposal explicitly forbids cascading effects. In other words: &lt;strong&gt;Only the &lt;code&gt;beneficiary&lt;&#x2F;code&gt; of the current header&#x2F;vote may be added to&#x2F;dropped from the authorization list. If that causes other proposals to reach consensus, those will be executed when their respective beneficiaries are &quot;touched&quot; again (given that majority consensus still holds at that point).&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;voting-strategies&quot;&gt;Voting strategies&lt;&#x2F;h4&gt;
&lt;p&gt;Since the blockchain can have small reorgs, a naive voting mechanism of &quot;cast-and-forget&quot; may not be optimal, since a block containing a singleton vote may not end up on the final chain.&lt;&#x2F;p&gt;
&lt;p&gt;A simplistic but working strategy is to allow users to configure &quot;proposals&quot; on the signers (e.g. &quot;add 0x...&quot;, &quot;drop 0x...&quot;). The signing code can then pick a random proposal for every block it signs and inject it. This ensures that multiple concurrent proposals as well as reorgs get eventually noted on the chain.&lt;&#x2F;p&gt;
&lt;p&gt;This list may be expired after a certain number of blocks &#x2F; epochs, but it&#x27;s important to realize that &quot;seeing&quot; a proposal pass doesn&#x27;t mean it won&#x27;t get reorged, so it should not be immediately dropped when the proposal passes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;go&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; block represents a single block signed by a particular account, where&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the account may or may not have cast a Clique vote.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; block&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; struct&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  signer&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;     string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Account that signed this particular block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  voted&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Optional value if the signer voted on adding&#x2F;removing someone&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  auth&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;       bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;     &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Whether the vote was to authorize (or deauthorize)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  checkpoint&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; List of authorized signers if this is an epoch block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Define the various voting scenarios to test&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tests&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; :=&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Number of blocks in an epoch (unset = 30000)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  signers&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Initial list of authorized signers in the genesis&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  blocks&lt;&#x2F;span&gt;&lt;span&gt;  [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;block&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Chain of signed blocks, potentially influencing auths&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  results&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Final list of authorized signers after all blocks&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  failure&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; error&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Failure if some block is invalid according to the rules&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Single signer, no votes cast&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    signers&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;  [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    results&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Single signer, voting to add two others (only accept first, second needs 2 votes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    signers&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;  [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    results&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Two signers, voting to add three others (only accept first two, third needs 3 votes already)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    signers&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;  [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;E&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;E&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    results&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Single signer, dropping itself (weird, but one less cornercase by explicitly allowing this)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    signers&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;  [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    results&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Two signers, actually needing mutual consent to drop either of them (not fulfilled)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    signers&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;  [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    results&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Two signers, actually needing mutual consent to drop either of them (fulfilled)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    signers&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;  [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    results&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Three signers, two of them deciding to drop the third&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    signers&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;  [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    results&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Four signers, consensus of two not being enough to drop anyone&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    signers&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;  [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    results&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Four signers, consensus of three already being enough to drop someone&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    signers&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;  [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    results&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Authorizations are counted once per signer per target&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    signers&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;  [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    results&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Authorizing multiple accounts concurrently is permitted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    signers&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;  [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    results&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Deauthorizations are counted once per signer per target&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    signers&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;  [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    results&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Deauthorizing multiple accounts concurrently is permitted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    signers&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;  [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    results&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Votes from deauthorized signers are discarded immediately (deauth votes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    signers&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;  [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    results&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Votes from deauthorized signers are discarded immediately (auth votes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    signers&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;  [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    results&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Cascading changes are not allowed, only the account being voted on may change&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    signers&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;  [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    results&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Changes reaching consensus out of bounds (via a deauth) execute on touch&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    signers&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;  [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    results&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Changes reaching consensus out of bounds (via a deauth) may go out of consensus on first touch&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    signers&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;  [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    results&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Ensure that pending votes don&amp;#39;t survive authorization status changes. This&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; corner case can only appear if a signer is quickly added, removed and then&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; readded (or the inverse), while one of the original voters dropped. If a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; past vote is left cached in the system somewhere, this will interfere with&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the final signer outcome.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    signers&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;E&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;  [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;F&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Authorize F, 3 votes needed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;F&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;F&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;F&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Deauthorize F, 4 votes needed (leave A&amp;#39;s previous vote &amp;quot;unchanged&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;E&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;F&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;F&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;F&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;F&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Almost authorize F, 2&#x2F;3 votes needed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;E&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;F&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Deauthorize A, 3 votes needed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;F&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Finish authorizing F, 3&#x2F;3 votes needed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    results&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;E&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;F&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Epoch transitions reset all votes to allow chain checkpointing&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    epoch&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;   3&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    signers&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;  [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; checkpoint&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    results&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An unauthorized signer should not be able to sign blocks&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    signers&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;  [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    failure&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; errUnauthorizedSigner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An authorized signer that signed recently should not be able to sign again&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    signers&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    failure&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; errRecentlySigned&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Recent signatures should not reset on checkpoint blocks imported in a batch&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    epoch&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;   3&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    signers&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;  [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; checkpoint&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    failure&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; errRecentlySigned&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;A reference implementation is part of &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;go-ethereum&#x2F;tree&#x2F;master&#x2F;consensus&#x2F;clique&quot;&gt;go-ethereum&lt;&#x2F;a&gt; and has been functioning as the consensus engine behind the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rinkeby.io&quot;&gt;Rinkeby&lt;&#x2F;a&gt; testnet since April, 2017.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Bitwise shifting instructions in EVM</title>
        <published>2017-02-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	<author>
		<name>Paweł Bylica</name><uri>https://github.com/chfast</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/145/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/145/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:145"
            label="EIP-145" />
        

        
        

        
        <summary type="html">To Provide native bitwise shifting with cost on par with other arithmetic operations.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/145/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Native bitwise shifting instructions are introduced, which are more efficient processing wise on the host and are cheaper to use by a contract.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;EVM is lacking bitwise shifting operators, but supports other logical and arithmetic operators. Shift operations can be implemented via arithmetic operators, but that has a higher cost and requires more processing time from the host. Implementing &lt;code&gt;SHL&lt;&#x2F;code&gt; and &lt;code&gt;SHR&lt;&#x2F;code&gt; using arithmetic cost each 35 gas, while the proposed instructions take 3 gas.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The following instructions are introduced:&lt;&#x2F;p&gt;
&lt;h3 id=&quot;0x1b-shl-shift-left&quot;&gt;&lt;code&gt;0x1b&lt;&#x2F;code&gt;: &lt;code&gt;SHL&lt;&#x2F;code&gt; (shift left)&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;SHL&lt;&#x2F;code&gt; instruction (shift left) pops 2 values from the stack, first &lt;code&gt;arg1&lt;&#x2F;code&gt; and then &lt;code&gt;arg2&lt;&#x2F;code&gt;, and pushes on the stack &lt;code&gt;arg2&lt;&#x2F;code&gt; shifted to the left by &lt;code&gt;arg1&lt;&#x2F;code&gt; number of bits. The result is equal to&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(arg2 * 2^arg1) mod 2^256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Notes:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The value (&lt;code&gt;arg2&lt;&#x2F;code&gt;) is interpreted as an unsigned number.&lt;&#x2F;li&gt;
&lt;li&gt;The shift amount (&lt;code&gt;arg1&lt;&#x2F;code&gt;) is interpreted as an unsigned number.&lt;&#x2F;li&gt;
&lt;li&gt;If the shift amount (&lt;code&gt;arg1&lt;&#x2F;code&gt;) is greater or equal 256 the result is 0.&lt;&#x2F;li&gt;
&lt;li&gt;This is equivalent to &lt;code&gt;PUSH1 2 EXP MUL&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;0x1c-shr-logical-shift-right&quot;&gt;&lt;code&gt;0x1c&lt;&#x2F;code&gt;: &lt;code&gt;SHR&lt;&#x2F;code&gt; (logical shift right)&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;SHR&lt;&#x2F;code&gt; instruction (logical shift right) pops 2 values from the stack, first &lt;code&gt;arg1&lt;&#x2F;code&gt; and then &lt;code&gt;arg2&lt;&#x2F;code&gt;, and pushes on the stack &lt;code&gt;arg2&lt;&#x2F;code&gt; shifted to the right by &lt;code&gt;arg1&lt;&#x2F;code&gt; number of bits with zero fill. The result is equal to&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;floor(arg2 &#x2F; 2^arg1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Notes:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The value (&lt;code&gt;arg2&lt;&#x2F;code&gt;) is interpreted as an unsigned number.&lt;&#x2F;li&gt;
&lt;li&gt;The shift amount (&lt;code&gt;arg1&lt;&#x2F;code&gt;) is interpreted as an unsigned number.&lt;&#x2F;li&gt;
&lt;li&gt;If the shift amount (&lt;code&gt;arg1&lt;&#x2F;code&gt;) is greater or equal 256 the result is 0.&lt;&#x2F;li&gt;
&lt;li&gt;This is equivalent to &lt;code&gt;PUSH1 2 EXP DIV&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;0x1d-sar-arithmetic-shift-right&quot;&gt;&lt;code&gt;0x1d&lt;&#x2F;code&gt;: &lt;code&gt;SAR&lt;&#x2F;code&gt; (arithmetic shift right)&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;SAR&lt;&#x2F;code&gt; instruction (arithmetic shift right) pops 2 values from the stack, first &lt;code&gt;arg1&lt;&#x2F;code&gt; and then &lt;code&gt;arg2&lt;&#x2F;code&gt;, and pushes on the stack &lt;code&gt;arg2&lt;&#x2F;code&gt; shifted to the right by &lt;code&gt;arg1&lt;&#x2F;code&gt; number of bits with sign extension. The result is equal to&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;floor(arg2 &#x2F; 2^arg1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Notes:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The value (&lt;code&gt;arg2&lt;&#x2F;code&gt;) is interpreted as a signed number.&lt;&#x2F;li&gt;
&lt;li&gt;The shift amount (&lt;code&gt;arg1&lt;&#x2F;code&gt;) is interpreted as an unsigned number.&lt;&#x2F;li&gt;
&lt;li&gt;If the shift amount (&lt;code&gt;arg1&lt;&#x2F;code&gt;) is greater or equal 256 the result is 0 if &lt;code&gt;arg2&lt;&#x2F;code&gt; is non-negative or -1 if &lt;code&gt;arg2&lt;&#x2F;code&gt; is negative.&lt;&#x2F;li&gt;
&lt;li&gt;This is &lt;strong&gt;not&lt;&#x2F;strong&gt; equivalent to &lt;code&gt;PUSH1 2 EXP SDIV&lt;&#x2F;code&gt;, since it rounds differently. See &lt;code&gt;SDIV(-1, 2) == 0&lt;&#x2F;code&gt;, while &lt;code&gt;SAR(-1, 1) == -1&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The cost of the shift instructions is set at &lt;code&gt;verylow&lt;&#x2F;code&gt; tier (3 gas).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Instruction operands were chosen to fit the more natural use case of shifting a value already on the stack. This means the operand order is swapped compared to most arithmetic instructions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The newly introduced instructions have no effect on bytecode created in the past.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;shl-shift-left&quot;&gt;&lt;code&gt;SHL&lt;&#x2F;code&gt; (shift left)&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x00&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SHL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SHL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0000000000000000000000000000000000000000000000000000000000000002&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0xff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SHL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x8000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x0100&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SHL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x0101&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SHL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x00&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SHL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SHL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0xff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SHL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x8000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x0100&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SHL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SHL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SHL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;shr-logical-shift-right&quot;&gt;&lt;code&gt;SHR&lt;&#x2F;code&gt; (logical shift right)&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x00&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SHR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SHR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x8000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SHR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x4000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x8000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0xff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SHR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x8000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x0100&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SHR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x8000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x0101&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SHR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x00&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SHR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SHR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0xff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SHR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x0100&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SHR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SHR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;sar-arithmetic-shift-right&quot;&gt;&lt;code&gt;SAR&lt;&#x2F;code&gt; (arithmetic shift right)&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x00&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SAR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SAR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x8000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SAR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xc000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x8000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0xff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SAR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x8000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x0100&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SAR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x8000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x0101&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SAR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x00&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SAR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SAR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0xff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SAR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x0100&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SAR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SAR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x4000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0xfe&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SAR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0xf8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SAR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x000000000000000000000000000000000000000000000000000000000000007f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0xfe&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SAR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0xff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SAR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x0100&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SAR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h3&gt;
&lt;p&gt;Client support:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;cpp-ethereum: https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;cpp-ethereum&#x2F;pull&#x2F;4054&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Compiler support:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Solidity&#x2F;LLL: https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;solidity&#x2F;pull&#x2F;2541&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;tests&quot;&gt;Tests&lt;&#x2F;h3&gt;
&lt;p&gt;Sources:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;tests&#x2F;tree&#x2F;develop&#x2F;src&#x2F;GeneralStateTestsFiller&#x2F;stShift&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Filled Tests:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;tests&#x2F;tree&#x2F;develop&#x2F;GeneralStateTests&#x2F;stShift&lt;&#x2F;li&gt;
&lt;li&gt;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;tests&#x2F;tree&#x2F;develop&#x2F;BlockchainTests&#x2F;GeneralStateTests&#x2F;stShift&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>&quot;New opcodes: RETURNDATASIZE and RETURNDATACOPY&quot;</title>
        <published>2017-02-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Christian Reitwiessner</name><email>chris@ethereum.org</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/211/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/211/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:211"
            label="EIP-211" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/211/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;A mechanism to allow returning arbitrary-length data inside the EVM has been requested for quite a while now. Existing proposals always had very intricate problems associated with charging gas. This proposal solves the same problem while at the same time, it has a very simple gas charging mechanism and requires minimal changes to the call opcodes. Its workings are very similar to the way calldata is handled already; after a call, return data is kept inside a virtual buffer from which the caller can copy it (or parts thereof) into memory. At the next call, the buffer is overwritten. This mechanism is 100% backwards compatible.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Please see summary.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;In some situations, it is vital for a function to be able to return data whose length cannot be anticipated before the call. In principle, this can be solved without alterations to the EVM, for example by splitting the call into two calls where the first is used to compute only the size. All of these mechanisms, though, are very expensive in at least some situations. A very useful example of such a worst-case situation is a generic forwarding contract; a contract that takes call data, potentially makes some checks and then forwards it as is to another contract. The return data should of course be transferred in a similar way to the original caller. Since the contract is generic and does not know about the contract it calls, there is no way to determine the size of the output without adapting the called contract accordingly or trying a logarithmic number of calls.&lt;&#x2F;p&gt;
&lt;p&gt;Compiler implementors are advised to reserve a zero-length area for return data if the size of the return data is unknown before the call and then use &lt;code&gt;RETURNDATACOPY&lt;&#x2F;code&gt; in conjunction with &lt;code&gt;RETURNDATASIZE&lt;&#x2F;code&gt; to actually retrieve the data.&lt;&#x2F;p&gt;
&lt;p&gt;Note that this proposal also makes the EIP that proposes to allow to return data in case of an intentional state reversion (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;140&#x2F;&quot;&gt;EIP-140&lt;&#x2F;a&gt;) much more useful. Since the size of the failure data might be larger than the regular return data (or even unknown), it is possible to retrieve the failure data after the CALL opcode has signalled a failure, even if the regular output area is not large enough to hold the data.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= BYZANTIUM_FORK_BLKNUM&lt;&#x2F;code&gt;, add two new opcodes and amend the semantics of any opcode that creates a new call frame (like &lt;code&gt;CALL&lt;&#x2F;code&gt;, &lt;code&gt;CREATE&lt;&#x2F;code&gt;, &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;, ...) called call-like opcodes in the following. It is assumed that the EVM (to be more specific: an EVM call frame) has a new internal buffer of variable size, called the return data buffer. This buffer is created empty for each new call frame. Upon executing any call-like opcode, the buffer is cleared (its size is set to zero). After executing a call-like opcode, the complete return data (or failure data, see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;140&#x2F;&quot;&gt;EIP-140&lt;&#x2F;a&gt;) of the call is stored in the return data buffer (of the caller), and its size changed accordingly. As an exception, &lt;code&gt;CREATE&lt;&#x2F;code&gt; and &lt;code&gt;CREATE2&lt;&#x2F;code&gt; are considered to return the empty buffer in the success case and the failure data in the failure case. If the call-like opcode is executed but does not really instantiate a call frame (for example due to insufficient funds for a value transfer or if the called contract does not exist), the return data buffer is empty.&lt;&#x2F;p&gt;
&lt;p&gt;As an optimization, it is possible to share the return data buffer across call frames because at most one will be non-empty at any time.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;RETURNDATASIZE&lt;&#x2F;code&gt;: &lt;code&gt;0x3d&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Pushes the size of the return data buffer onto the stack.
Gas costs: 2 (same as &lt;code&gt;CALLDATASIZE&lt;&#x2F;code&gt;)&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;RETURNDATACOPY&lt;&#x2F;code&gt;: &lt;code&gt;0x3e&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;This opcode has similar semantics to &lt;code&gt;CALLDATACOPY&lt;&#x2F;code&gt;, but instead of copying data from the call data, it copies data from the return data buffer. Furthermore, accessing the return data buffer beyond its size results in a failure; i.e. if &lt;code&gt;start + length&lt;&#x2F;code&gt; overflows or results in a value larger than &lt;code&gt;RETURNDATASIZE&lt;&#x2F;code&gt;, the current call stops in an out-of-gas condition. In particular, reading 0 bytes from the end of the buffer will read 0 bytes; reading 0 bytes from one-byte out of the buffer causes an exception.&lt;&#x2F;p&gt;
&lt;p&gt;Gas costs: &lt;code&gt;3 + 3 * ceil(amount &#x2F; 32)&lt;&#x2F;code&gt; (same as &lt;code&gt;CALLDATACOPY&lt;&#x2F;code&gt;)&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Other solutions that would allow returning dynamic data were considered, but they all had to deduct the gas from the call opcode and thus were both complicated to implement and specify (&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;8&quot;&gt;5&#x2F;8&lt;&#x2F;a&gt;). Since this proposal is very similar to the way calldata is handled, it fits nicely into the concept. Furthermore, the eWASM architecture already handles return data in exactly the same way.&lt;&#x2F;p&gt;
&lt;p&gt;Note that the EVM implementation needs to keep the return data until the next call or the return from the current call. Since this resource was already paid for as part of the memory of the callee, it should not be a problem. Implementations may either choose to keep the full memory of the callee alive until the next call or copy only the return data to a special memory area.&lt;&#x2F;p&gt;
&lt;p&gt;Keeping the memory of the callee until the next call-like opcode does not increase the peak memory usage in the following sense; any memory allocation in the caller&#x27;s frame that happens after the return from the call can be moved before the call without a change in gas costs, but will add this allocation to the peak allocation.&lt;&#x2F;p&gt;
&lt;p&gt;The number values of the opcodes were allocated in the same nibble block that also contains &lt;code&gt;CALLDATASIZE&lt;&#x2F;code&gt; and &lt;code&gt;CALLDATACOPY&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal introduces two new opcodes and stays fully backwards compatible apart from that.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>New opcode STATICCALL</title>
        <published>2017-02-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><email>vitalik@ethereum.org</email>
	</author>
	
	<author>
		<name>Christian Reitwiessner</name><email>chris@ethereum.org</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/214/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/214/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:214"
            label="EIP-214" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/214/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;To increase smart contract security, this proposal adds a new opcode that can be used to call another contract (or itself) while disallowing any modifications to the state during the call (and its subcalls, if present).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal adds a new opcode that can be used to call another contract (or itself) while disallowing any modifications to the state during the call (and its subcalls, if present). Any opcode that attempts to perform such a modification (see below for details) will result in an exception instead of performing the modification.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, there is no restriction about what a called contract can do, as long as the computation can be performed with the amount of gas provided. This poses certain difficulties about smart contract engineers; after a regular call, unless you know the called contract, you cannot make any assumptions about the state of the contracts. Furthermore, because you cannot know the order of transactions before they are confirmed by miners, not even an outside observer can be sure about that in all cases.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP adds a way to call other contracts and restrict what they can do in the simplest way. It can be safely assumed that the state of all accounts is the same before and after a static call.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce a new &lt;code&gt;STATIC&lt;&#x2F;code&gt; flag to the virtual machine. This flag is set to &lt;code&gt;false&lt;&#x2F;code&gt; initially. Its value is always copied to sub-calls with an exception for the new opcode below.&lt;&#x2F;p&gt;
&lt;p&gt;Opcode: &lt;code&gt;0xfa&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;STATICCALL&lt;&#x2F;code&gt; functions equivalently to a &lt;code&gt;CALL&lt;&#x2F;code&gt;, except it takes only 6 arguments (the &quot;value&quot; argument is not included and taken to be zero), and calls the child with the &lt;code&gt;STATIC&lt;&#x2F;code&gt; flag set to &lt;code&gt;true&lt;&#x2F;code&gt; for the execution of the child. Once this call returns, the flag is reset to its value before the call.&lt;&#x2F;p&gt;
&lt;p&gt;Any attempts to make state-changing operations inside an execution instance with &lt;code&gt;STATIC&lt;&#x2F;code&gt; set to &lt;code&gt;true&lt;&#x2F;code&gt; will instead throw an exception. These operations include &lt;code&gt;CREATE&lt;&#x2F;code&gt;, &lt;code&gt;CREATE2&lt;&#x2F;code&gt;, &lt;code&gt;LOG0&lt;&#x2F;code&gt;, &lt;code&gt;LOG1&lt;&#x2F;code&gt;, &lt;code&gt;LOG2&lt;&#x2F;code&gt;, &lt;code&gt;LOG3&lt;&#x2F;code&gt;, &lt;code&gt;LOG4&lt;&#x2F;code&gt;, &lt;code&gt;SSTORE&lt;&#x2F;code&gt;, and &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;. They also include &lt;code&gt;CALL&lt;&#x2F;code&gt; with a non-zero value. As an exception, &lt;code&gt;CALLCODE&lt;&#x2F;code&gt; is not considered state-changing, even with a non-zero value.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This allows contracts to make calls that are clearly non-state-changing, reassuring developers and reviewers that re-entrancy bugs or other problems cannot possibly arise from that particular call; it is a pure function that returns an output and does nothing else. This may also make purely functional HLLs easier to implement.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal adds a new opcode but does not modify the behaviour of other opcodes and thus is backwards compatible for old contracts that do not use the new opcode and are not called via the new opcode.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;To be written.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Blockhash refactoring</title>
        <published>2017-02-10T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/210/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/210/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:210"
            label="EIP-210" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/210/">&lt;h3 id=&quot;summary&quot;&gt;Summary&lt;&#x2F;h3&gt;
&lt;p&gt;Stores blockhashes in the state, reducing the protocol complexity and the need for client implementation complexity in order to process the BLOCKHASH opcode. Also extends the range of how far back blockhash checking can go, with the side effect of creating direct links between blocks with very distant block numbers, facilitating much more efficient initial light client syncing.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;CONSTANTINOPLE_FORK_BLKNUM&lt;&#x2F;code&gt;: TBD&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SUPER_USER&lt;&#x2F;code&gt;: 2**160 - 2&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;BLOCKHASH_CONTRACT_ADDR&lt;&#x2F;code&gt;: 0xf0 (ie. 240)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;BLOCKHASH_CONTRACT_CODE&lt;&#x2F;code&gt;: see below&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h3&gt;
&lt;p&gt;If &lt;code&gt;block.number == CONSTANTINOPLE_FORK_BLKNUM&lt;&#x2F;code&gt;, then when processing the block, before processing any transactions set the code of BLOCKHASH_CONTRACT_ADDR to BLOCKHASH_CONTRACT_CODE.&lt;&#x2F;p&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= CONSTANTINOPLE_FORK_BLKNUM&lt;&#x2F;code&gt;, then when processing a block, before processing any transactions execute a call with the parameters:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;SENDER&lt;&#x2F;code&gt;: SUPER_USER&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;GAS&lt;&#x2F;code&gt;: 1000000&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TO&lt;&#x2F;code&gt;: BLOCKHASH_CONTRACT_ADDR&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;VALUE&lt;&#x2F;code&gt;: 0&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;DATA&lt;&#x2F;code&gt;: &amp;lt;32 bytes corresponding to the block&#x27;s prevhash&amp;gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= CONSTANTINOPLE_FORK_BLKNUM + 256&lt;&#x2F;code&gt;, then the BLOCKHASH opcode instead returns the result of executing a call (NOT a transaction) with the parameters:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;SENDER&lt;&#x2F;code&gt;: &amp;lt;account from which the opcode was called&amp;gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;GAS&lt;&#x2F;code&gt;: 1000000&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TO&lt;&#x2F;code&gt;: BLOCKHASH_CONTRACT_ADDR&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;VALUE&lt;&#x2F;code&gt;: 0&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;DATA&lt;&#x2F;code&gt;: 32 byte zero-byte-leftpadded integer representing the stack argument with which the opcode was called&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Also, for blocks where &lt;code&gt;block.number &amp;gt;= CONSTANTINOPLE_FORK_BLKNUM&lt;&#x2F;code&gt;, the gas cost is increased from 20 to 800 to reflect the higher costs of processing the algorithm in the contract code.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;blockhash-contract-code&quot;&gt;BLOCKHASH_CONTRACT_CODE&lt;&#x2F;h3&gt;
&lt;p&gt;The Serpent source code is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;with&lt;&#x2F;span&gt;&lt;span&gt; offset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;fffffffffffffffffffffffffffffffffffffffe&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        with&lt;&#x2F;span&gt;&lt;span&gt; bn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            while&lt;&#x2F;span&gt;&lt;span&gt; bn&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                ~&lt;&#x2F;span&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;offset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;mod&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;bn&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                if&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;mod&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;bn&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                    ~&lt;&#x2F;span&gt;&lt;span&gt;stop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                bn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;div&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;bn&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                offset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    elif&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        with&lt;&#x2F;span&gt;&lt;span&gt; tbn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            with&lt;&#x2F;span&gt;&lt;span&gt; dist_minus_one&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; tbn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                while&lt;&#x2F;span&gt;&lt;span&gt; dist_minus_one&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 256&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;mod&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tbn&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    offset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    tbn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;div&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tbn&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    dist_minus_one&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;div&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;dist_minus_one&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                if&lt;&#x2F;span&gt;&lt;span&gt; dist_minus_one&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 256&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                    return&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                return&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;~&lt;&#x2F;span&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;offset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;mod&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tbn&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The EVM init code is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x6100f58061000e60003961010356600073fffffffffffffffffffffffffffffffffffffffe33141561005857600143035b801561005257600035610100820683015561010081061561003f57005b6101008104905061010082019150610022565b506100f3565b600060003512151561006e574360003512610071565b60005b156100e7576000356001814303035b6101008112151561009857600061010083061461009b565b60005b156100ba57610100830192506101008204915061010081049050610080565b610100811215156100d057600060a052602060a0f35b610100820683015460c052602060c0f350506100f2565b600060e052602060e0f35b5b505b6000f3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The EVM bytecode that the contract code should be set to is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x600073fffffffffffffffffffffffffffffffffffffffe33141561005857600143035b801561005257600035610100820683015561010081061561003f57005b6101008104905061010082019150610022565b506100f3565b600060003512151561006e574360003512610071565b60005b156100e7576000356001814303035b6101008112151561009857600061010083061461009b565b60005b156100ba57610100830192506101008204915061010081049050610080565b610100811215156100d057600060a052602060a0f35b610100820683015460c052602060c0f350506100f2565b600060e052602060e0f35b5b50&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h3&gt;
&lt;p&gt;This removes the need for implementations to have an explicit way to look into historical block hashes, simplifying the protocol definition and removing a large component of the &quot;implied state&quot; (information that is technically state but is not part of the state tree) and thereby making the protocol more &quot;pure&quot;. Additionally, it allows blocks to directly point to blocks far behind them, which enables extremely efficient and secure light client protocols.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Abstraction of transaction origin and signature</title>
        <published>2017-02-10T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/86/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/86/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:86"
            label="EIP-86" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/86/">&lt;h1 id=&quot;summary&quot;&gt;Summary&lt;&#x2F;h1&gt;
&lt;p&gt;Implements a set of changes that serve the combined purpose of &quot;abstracting out&quot; signature verification and nonce checking, allowing users to create &quot;account contracts&quot; that perform any desired signature&#x2F;nonce checks instead of using the mechanism that is currently hard-coded into transaction processing.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h1&gt;
&lt;ul&gt;
&lt;li&gt;METROPOLIS_FORK_BLKNUM: TBD&lt;&#x2F;li&gt;
&lt;li&gt;CHAIN_ID: same as used for EIP 155 (ie. 1 for mainnet, 3 for testnet)&lt;&#x2F;li&gt;
&lt;li&gt;NULL_SENDER: 2**160 - 1&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h1 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h1&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= METROPOLIS_FORK_BLKNUM&lt;&#x2F;code&gt;, then:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;If the signature of a transaction is &lt;code&gt;(CHAIN_ID, 0, 0)&lt;&#x2F;code&gt; (ie. &lt;code&gt;r = s = 0&lt;&#x2F;code&gt;, &lt;code&gt;v = CHAIN_ID&lt;&#x2F;code&gt;), then treat it as valid and set the sender address to &lt;code&gt;NULL_SENDER&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Transactions of this form MUST have gasprice = 0, nonce = 0, value = 0, and do NOT increment the nonce of account NULL_SENDER.&lt;&#x2F;li&gt;
&lt;li&gt;Create a new opcode at &lt;code&gt;0xfb&lt;&#x2F;code&gt;, &lt;code&gt;CREATE2&lt;&#x2F;code&gt;, with 4 stack arguments (value, salt, mem_start, mem_size) which sets the creation address to &lt;code&gt;sha3(sender + salt + sha3(init code)) % 2**160&lt;&#x2F;code&gt;, where &lt;code&gt;salt&lt;&#x2F;code&gt; is always represented as a 32-byte value.&lt;&#x2F;li&gt;
&lt;li&gt;Add to &lt;em&gt;all&lt;&#x2F;em&gt; contract creation operations, including transactions and opcodes, the rule that if a contract at that address already exists and has non-empty code OR non-empty nonce, the operation fails and returns 0 as if the init code had run out of gas. If an account has empty code and nonce but nonempty balance, the creation operation may still succeed.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h1 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h1&gt;
&lt;p&gt;The goal of these changes is to set the stage for abstraction of account security. Instead of having an in-protocol mechanism where ECDSA and the default nonce scheme are enshrined as the only &quot;standard&quot; way to secure an account, we take initial steps toward a model where in the long term all accounts are contracts, contracts can pay for gas, and users are free to define their own security model.&lt;&#x2F;p&gt;
&lt;p&gt;Under EIP 86, we can expect users to store their ether in contracts, whose code might look like the following (example in Serpent):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get signature from tx data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sig_v&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sig_r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sig_s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;64&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get tx arguments&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tx_nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;96&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tx_to&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;128&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tx_value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;160&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tx_gasprice&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;192&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tx_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; string&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;~&lt;&#x2F;span&gt;&lt;span&gt;calldatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 224&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;~&lt;&#x2F;span&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx_data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 224&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get signing hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;signing_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; string&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;~&lt;&#x2F;span&gt;&lt;span&gt;calldatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 64&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;~&lt;&#x2F;span&gt;&lt;span&gt;mstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signing_data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;startgas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;~&lt;&#x2F;span&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signing_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 96&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 96&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;signing_hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sha3&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signing_data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;str&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Perform usual checks&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;prev_nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span&gt; tx_nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; prev_nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span&gt; tx_value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; tx_gasprice&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;startgas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;ecrecover&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signing_hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; sig_v&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; sig_r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; sig_s&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt;pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span&gt; here&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Update nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;~&lt;&#x2F;span&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; prev_nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Pay for gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;~&lt;&#x2F;span&gt;&lt;span&gt;send&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;MINER_CONTRACT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tx_gasprice&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;startgas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Make the main call&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;~&lt;&#x2F;span&gt;&lt;span&gt;call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 50000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tx_to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tx_value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tx_data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx_data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get remaining gas payments back&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;~&lt;&#x2F;span&gt;&lt;span&gt;call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;20000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MINER_CONTRACT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This can be thought of as a &quot;forwarding contract&quot;. It accepts data from the &quot;entry point&quot; address 2**160 - 1 (an account that anyone can send transactions from), expecting that data to be in the format &lt;code&gt;[sig, nonce, to, value, gasprice, data]&lt;&#x2F;code&gt;. The forwarding contract verifies the signature, and if the signature is correct it sets up a payment to the miner and then sends a call to the desired address with the provided value and data.&lt;&#x2F;p&gt;
&lt;p&gt;The benefits that this provides lie in the most interesting cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Multisig wallets&lt;&#x2F;strong&gt;: currently, sending from a multisig wallet requires each operation to be ratified by the participants, and each ratification is a transaction. This could be simplified by having one ratification transaction include signatures from the other participants, but even still it introduces complexity because the participants&#x27; accounts all need to be stocked up with ETH. With this EIP, it will be possible to just have the contract store the ETH, send a transaction containing all signatures to the contract directly, and the contract can pay the fees.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Ring signature mixers&lt;&#x2F;strong&gt;: the way that ring signature mixers work is that N individuals send 1 coin into a contract, and then use a linkable ring signature to withdraw 1 coin later on. The linkable ring signature ensures that the withdrawal transaction cannot be linked to the deposit, but if someone attempts to withdraw twice then those two signatures can be linked and the second one prevented. However, currently there is a privacy risk: to withdraw, you need to have coins to pay for gas, and if these coins are not properly mixed then you risk compromising your privacy. With this EIP, you can pay for gas straight our of your withdrawn coins.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Custom cryptography&lt;&#x2F;strong&gt;: users can upgrade to ed25519 signatures, Lamport hash ladder signatures or whatever other scheme they want on their own terms; they do not need to stick with ECDSA.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Non-cryptographic modifications&lt;&#x2F;strong&gt;: users can require transactions to have expiry times (this being standard would allow old empty&#x2F;dust accounts to be flushed from the state securely), use k-parallelizable nonces (a scheme that allows transactions to be confirmed slightly out-of-order, reducing inter-transaction dependence), or make other modifications.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;(2) and (3) introduce a feature similar to bitcoin&#x27;s P2SH, allowing users to send funds to addresses that provably map to only one particular piece of code. Something like this is crucial in the long term because, in a world where all accounts are contracts, we need to preserve the ability to send to an account before that account exists on-chain, as that&#x27;s a basic functionality that exists in all blockchain protocols today.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;miner-and-transaction-replaying-strategy&quot;&gt;Miner and transaction replaying strategy&lt;&#x2F;h1&gt;
&lt;p&gt;Note that miners would need to have a strategy for accepting these transactions. This strategy would need to be very discriminating, because otherwise they run the risk of accepting transactions that do not pay them any fees, and possibly even transactions that have no effect (eg. because the transaction was already included and so the nonce is no longer current).&lt;&#x2F;p&gt;
&lt;p&gt;One simple strategy is to have a set of regexps that the to address of an account would be checked against, each regexp corresponding to a &quot;standard account type&quot; which is known to be &quot;safe&quot; (in the sense that if an account has that code, and a particular check involving the account balances, account storage and transaction data passes, then if the transaction is included in a block the miner will get paid), and mine and relay transactions that pass these checks.&lt;&#x2F;p&gt;
&lt;p&gt;One example would be to check as follows:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Check that the to address has code which is the compiled version of the Serpent code above, with &lt;code&gt;&amp;lt;pubkey hash here&amp;gt;&lt;&#x2F;code&gt; replaced with any public key hash.&lt;&#x2F;li&gt;
&lt;li&gt;Check that the signature in the transaction data verifies with that key hash.&lt;&#x2F;li&gt;
&lt;li&gt;Check that the gasprice in the transaction data is sufficiently high&lt;&#x2F;li&gt;
&lt;li&gt;Check that the nonce in the state matches the nonce in the transaction data&lt;&#x2F;li&gt;
&lt;li&gt;Check that there is enough ether in the account to pay for the fee&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;If all five checks pass, relay and&#x2F;or mine the transaction.&lt;&#x2F;p&gt;
&lt;p&gt;A looser but still effective strategy would be to accept any code that fits the same general format as the above, consuming only a limited amount of gas to perform nonce and signature checks and having a guarantee that transaction fees will be paid to the miner. Another strategy is to, alongside other approaches, try to process any transaction that asks for less than 250,000 gas, and include it only if the miner&#x27;s balance is appropriately higher after executing the transaction than before it.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h1&gt;
&lt;p&gt;Copyright and related rights waived via CC0.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Designated invalid EVM instruction</title>
        <published>2017-02-09T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/141/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/141/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:141"
            label="EIP-141" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/141/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;An instruction is designated to remain as an invalid instruction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The invalid instruction can be used as a distinct reason to abort execution.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The opcode &lt;code&gt;0xfe&lt;&#x2F;code&gt; is the &lt;code&gt;INVALID&lt;&#x2F;code&gt; instruction. It can be used to abort the execution (i.e. duplicates as an &lt;code&gt;ABORT&lt;&#x2F;code&gt; instruction).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This instruction was never used and therefore has no effect on past contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>REVERT instruction</title>
        <published>2017-02-06T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	<author>
		<name>Nikolai Mushegian</name><email>nikolai@nexusdev.us</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/140/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/140/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:140"
            label="EIP-140" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/140/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;REVERT&lt;&#x2F;code&gt; instruction provides a way to stop execution and revert state changes, without consuming all provided gas and with the ability to return a reason.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;REVERT&lt;&#x2F;code&gt; instruction will stop execution, roll back all state changes done so far and provide a pointer to a memory section, which can be interpreted as an error code or message. While doing so, it will not consume all the remaining gas.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently this is not possible. There are two practical ways to revert a transaction from within a contract: running out of gas or executing an invalid instruction. Both of these options will consume all remaining gas. Additionally, reverting an EVM execution means that all changes, including LOGs, are lost and there is no way to convey a reason for aborting an EVM execution.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;On blocks with &lt;code&gt;block.number &amp;gt;= BYZANTIUM_FORK_BLKNUM&lt;&#x2F;code&gt;, the &lt;code&gt;REVERT&lt;&#x2F;code&gt; instruction is introduced at &lt;code&gt;0xfd&lt;&#x2F;code&gt;. It expects two stack items, the top item is the &lt;code&gt;memory_offset&lt;&#x2F;code&gt; followed by &lt;code&gt;memory_length&lt;&#x2F;code&gt;. It does not produce any stack elements because it stops execution.&lt;&#x2F;p&gt;
&lt;p&gt;The semantics of &lt;code&gt;REVERT&lt;&#x2F;code&gt; with respect to memory and memory cost are identical to those of &lt;code&gt;RETURN&lt;&#x2F;code&gt;. The sequence of bytes given by &lt;code&gt;memory_offset&lt;&#x2F;code&gt; and &lt;code&gt;memory_length&lt;&#x2F;code&gt; is called &quot;error message&quot; in the following.&lt;&#x2F;p&gt;
&lt;p&gt;The effect of &lt;code&gt;REVERT&lt;&#x2F;code&gt; is that execution is aborted, considered as failed, and state changes are rolled back. The error message will be available to the caller in the returndata buffer and will also be copied to the output area, i.e. it is handled in the same way as the regular return data is handled.&lt;&#x2F;p&gt;
&lt;p&gt;The cost of the &lt;code&gt;REVERT&lt;&#x2F;code&gt; instruction equals to that of the &lt;code&gt;RETURN&lt;&#x2F;code&gt; instruction, i.e. the rollback itself does not consume all gas, the contract only has to pay for memory.&lt;&#x2F;p&gt;
&lt;p&gt;In case there is not enough gas left to cover the cost of &lt;code&gt;REVERT&lt;&#x2F;code&gt; or there is a stack underflow, the effect of the &lt;code&gt;REVERT&lt;&#x2F;code&gt; instruction will equal to that of a regular out of gas exception, i.e. it will consume all gas.&lt;&#x2F;p&gt;
&lt;p&gt;In the same way as all other failures, the calling opcode returns &lt;code&gt;0&lt;&#x2F;code&gt; on the stack following a &lt;code&gt;REVERT&lt;&#x2F;code&gt; opcode in the callee.&lt;&#x2F;p&gt;
&lt;p&gt;In case &lt;code&gt;REVERT&lt;&#x2F;code&gt; is used in the context of a &lt;code&gt;CREATE&lt;&#x2F;code&gt; or &lt;code&gt;CREATE2&lt;&#x2F;code&gt; call, no code is deployed, &lt;code&gt;0&lt;&#x2F;code&gt; is put on the stack and the error message is available in the returndata buffer.&lt;&#x2F;p&gt;
&lt;p&gt;The content of the optionally provided memory section is not defined by this EIP, but is a candidate for another Informational EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change has no effect on contracts created in the past unless they contain &lt;code&gt;0xfd&lt;&#x2F;code&gt; as an instruction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;6c726576657274656420646174616000557f726576657274206d657373616765000000000000000000000000000000000000600052600e6000fd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;should:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;return &lt;code&gt;0x726576657274206d657373616765&lt;&#x2F;code&gt; as &lt;code&gt;REVERT&lt;&#x2F;code&gt; data,&lt;&#x2F;li&gt;
&lt;li&gt;the storage at key &lt;code&gt;0x0&lt;&#x2F;code&gt; should be left as unset and&lt;&#x2F;li&gt;
&lt;li&gt;use 20024 gas in total.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Precompiled contracts for optimal ate pairing check on the elliptic curve alt_bn128</title>
        <published>2017-02-06T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><email>vitalik@ethereum.org</email>
	</author>
	
	<author>
		<name>Christian Reitwiessner</name><email>chris@ethereum.org</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/197/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/197/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:197"
            label="EIP-197" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/197/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Precompiled contracts for elliptic curve pairing operations are required in order to perform zkSNARK verification within the block gas limit.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP suggests to add precompiled contracts for a pairing function on a specific pairing-friendly elliptic curve. This can in turn be combined with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;196&#x2F;&quot;&gt;EIP-196&lt;&#x2F;a&gt; to verify zkSNARKs in Ethereum smart contracts. The general benefit of zkSNARKs for Ethereum is that it will increase the privacy for users (because of the Zero-Knowledge property) and might also be a scalability solution (because of the succinctness and efficient verifiability property).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Current smart contract executions on Ethereum are fully transparent, which makes them unsuitable for several use-cases that involve private information like the location, identity or history of past transactions. The technology of zkSNARKs could be a solution to this problem. While the Ethereum Virtual Machine can make use of zkSNARKs in theory, they are currently too expensive
to fit the block gas limit. Because of that, this EIP proposes to specify certain parameters for some elementary primitives that enable zkSNARKs so that they can be implemented more efficiently and the gas cost be reduced.&lt;&#x2F;p&gt;
&lt;p&gt;Note that fixing these parameters will in no way limit the use-cases for zkSNARKs, it will even allow for incorporating some advances in zkSNARK research without the need for a further hard fork.&lt;&#x2F;p&gt;
&lt;p&gt;Pairing functions can be used to perform a limited form of multiplicatively homomorphic operations, which are necessary for current zkSNARKs. This precompile can be used to run such computations within the block gas limit. This precompiled contract only specifies a certain check, and not an evaluation of a pairing function. The reason is that the codomain of a pairing function is a rather complex field which could provide encoding problems and all known uses of pairing function in zkSNARKs only require the specified check.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;For blocks where &lt;code&gt;block.number &amp;gt;= BYZANTIUM_FORK_BLKNUM&lt;&#x2F;code&gt;, add a precompiled contracts for a bilinear function on groups on the elliptic curve &quot;alt_bn128&quot;. We will define the precompiled contract in terms of a discrete logarithm. The discrete logarithm is of course assumed to be hard to compute, but we will give an equivalent specification that makes use of elliptic curve pairing functions which can be efficiently computed below.&lt;&#x2F;p&gt;
&lt;p&gt;Address: 0x8&lt;&#x2F;p&gt;
&lt;p&gt;For a cyclic group &lt;code&gt;G&lt;&#x2F;code&gt; (written additively) of prime order &lt;code&gt;q&lt;&#x2F;code&gt; let &lt;code&gt;log_P: G -&amp;gt; F_q&lt;&#x2F;code&gt; be the discrete logarithm on this group with respect to a generator &lt;code&gt;P&lt;&#x2F;code&gt;, i.e. &lt;code&gt;log_P(x)&lt;&#x2F;code&gt; is the smallest non-negative integer &lt;code&gt;n&lt;&#x2F;code&gt; such that &lt;code&gt;n * P = x&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The precompiled contract is defined as follows, where the two groups &lt;code&gt;G_1&lt;&#x2F;code&gt; and &lt;code&gt;G_2&lt;&#x2F;code&gt; are defined by their generators &lt;code&gt;P_1&lt;&#x2F;code&gt; and &lt;code&gt;P_2&lt;&#x2F;code&gt; below. Both generators have the same prime order &lt;code&gt;q&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Input: (a1, b1, a2, b2, ..., ak, bk) from (G_1 x G_2)^k&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Output: If the length of the input is incorrect or any of the inputs are not elements of&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        the respective group or are not encoded correctly, the call fails.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        Otherwise, return one if&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        log_P1(a1) * log_P2(b1) + ... + log_P1(ak) * log_P2(bk) = 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (in F_q) and zero else.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note that &lt;code&gt;k&lt;&#x2F;code&gt; is determined from the length of the input. Following the section on the encoding below,
&lt;code&gt;k&lt;&#x2F;code&gt; is the length of the input divided by &lt;code&gt;192&lt;&#x2F;code&gt;. If the input length is not a multiple of &lt;code&gt;192&lt;&#x2F;code&gt;,
the call fails. Empty input is valid and results in returning one.&lt;&#x2F;p&gt;
&lt;p&gt;In order to check that an input is an element of &lt;code&gt;G_1&lt;&#x2F;code&gt;, verifying the encoding of the coordinates and checking that they satisfy the curve equation (or is the encoding of infinity) is sufficient. For &lt;code&gt;G_2&lt;&#x2F;code&gt;, in addition to that, the order of the element has to be checked to be equal to the group order &lt;code&gt;q = 21888242871839275222246405745257275088548364400416034343698204186575808495617&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;definition-of-the-groups&quot;&gt;Definition of the groups&lt;&#x2F;h3&gt;
&lt;p&gt;The groups &lt;code&gt;G_1&lt;&#x2F;code&gt; and &lt;code&gt;G_2&lt;&#x2F;code&gt; are cyclic groups of prime order &lt;code&gt;q = 21888242871839275222246405745257275088548364400416034343698204186575808495617&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The group &lt;code&gt;G_1&lt;&#x2F;code&gt; is defined on the curve &lt;code&gt;Y^2 = X^3 + 3&lt;&#x2F;code&gt; over the field &lt;code&gt;F_p&lt;&#x2F;code&gt; with &lt;code&gt;p = 21888242871839275222246405745257275088696311157297823662689037894645226208583&lt;&#x2F;code&gt; with generator &lt;code&gt;P1 = (1, 2)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The group &lt;code&gt;G_2&lt;&#x2F;code&gt; is defined on the curve &lt;code&gt;Y^2 = X^3 + 3&#x2F;(i+9)&lt;&#x2F;code&gt; over a different field &lt;code&gt;F_p^2 = F_p[i] &#x2F; (i^2 + 1)&lt;&#x2F;code&gt; (p is the same as above) with generator&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;P2 = (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  11559732032986387107991004021392285783925812861821192530917403151452391805634 * i +&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  10857046999023057135944570762232829481370756359578518086990519993285655852781,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  4082367875863433681332203403145435568316851327593401208105741076214120093531 * i +&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  8495653923123431417604973247489272438418190587263600148770280649306958101930&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note that &lt;code&gt;G_2&lt;&#x2F;code&gt; is the only group of order &lt;code&gt;q&lt;&#x2F;code&gt; of that elliptic curve over the field &lt;code&gt;F_p^2&lt;&#x2F;code&gt;. Any other generator of order &lt;code&gt;q&lt;&#x2F;code&gt; instead of &lt;code&gt;P2&lt;&#x2F;code&gt; would define the same &lt;code&gt;G_2&lt;&#x2F;code&gt;. However, the concrete value of &lt;code&gt;P2&lt;&#x2F;code&gt; is useful for skeptical readers who doubt the existence of a group of order &lt;code&gt;q&lt;&#x2F;code&gt;. They can be instructed to compare the concrete values of &lt;code&gt;q * P2&lt;&#x2F;code&gt; and &lt;code&gt;P2&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;encoding&quot;&gt;Encoding&lt;&#x2F;h3&gt;
&lt;p&gt;Elements of &lt;code&gt;F_p&lt;&#x2F;code&gt; are encoded as 32 byte big-endian numbers. An encoding value of &lt;code&gt;p&lt;&#x2F;code&gt; or larger is invalid.&lt;&#x2F;p&gt;
&lt;p&gt;Elements &lt;code&gt;a * i + b&lt;&#x2F;code&gt; of &lt;code&gt;F_p^2&lt;&#x2F;code&gt; are encoded as two elements of &lt;code&gt;F_p&lt;&#x2F;code&gt;, &lt;code&gt;(a, b)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Elliptic curve points are encoded as a Jacobian pair &lt;code&gt;(X, Y)&lt;&#x2F;code&gt; where the point at infinity is encoded as &lt;code&gt;(0, 0)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Note that the number &lt;code&gt;k&lt;&#x2F;code&gt; is derived from the input length.&lt;&#x2F;p&gt;
&lt;p&gt;The length of the returned data is always exactly 32 bytes and encoded as a 32 byte big-endian number.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-costs&quot;&gt;Gas costs&lt;&#x2F;h3&gt;
&lt;p&gt;The gas costs of the precompiled contract are &lt;code&gt;80 000 * k + 100 000&lt;&#x2F;code&gt;, where &lt;code&gt;k&lt;&#x2F;code&gt; is the number of
points or, equivalently, the length of the input divided by 192.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The specific curve &lt;code&gt;alt_bn128&lt;&#x2F;code&gt; was chosen because it is particularly well-suited for zkSNARKs, or, more specifically their verification building block of pairing functions. Furthermore, by choosing this curve, we can use synergy effects with ZCash and re-use some of their components and artifacts.&lt;&#x2F;p&gt;
&lt;p&gt;The feature of adding curve and field parameters to the inputs was considered but ultimately rejected since it complicates the specification; the gas costs are much harder to determine and it would be possible to call the contracts on something which is not an actual elliptic curve or does not admit an efficient pairing implementation.&lt;&#x2F;p&gt;
&lt;p&gt;A non-compact point encoding was chosen since it still allows to perform some operations in the smart contract itself (inclusion of the full y coordinate) and two encoded points can be compared for equality (no third projective coordinate).&lt;&#x2F;p&gt;
&lt;p&gt;The encoding of field elements in &lt;code&gt;F_p^2&lt;&#x2F;code&gt; was chosen in this order to be in line with the big endian encoding of the elements themselves.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;As with the introduction of any precompiled contract, contracts that already use the given addresses will change their semantics. Because of that, the addresses are taken from the &quot;reserved range&quot; below 256.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;To be written.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The precompiled contract can be implemented using elliptic curve pairing functions, more specifically, an optimal ate pairing on the alt_bn128 curve, which can be implemented efficiently. In order to see that, first note that a pairing function &lt;code&gt;e: G_1 x G_2 -&amp;gt; G_T&lt;&#x2F;code&gt; fulfills the following properties (&lt;code&gt;G_1&lt;&#x2F;code&gt; and &lt;code&gt;G_2&lt;&#x2F;code&gt; are written additively, &lt;code&gt;G_T&lt;&#x2F;code&gt; is written multiplicatively):&lt;&#x2F;p&gt;
&lt;p&gt;(1) &lt;code&gt;e(m * P1, n * P2) = e(P1, P2)^(m * n)&lt;&#x2F;code&gt;
(2) &lt;code&gt;e&lt;&#x2F;code&gt; is non-degenerate&lt;&#x2F;p&gt;
&lt;p&gt;Now observe that&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;log_P1(a1) * log_P2(b1) + ... + log_P1(ak) * log_P2(bk) = 0 (in F_q)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;if and only if&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;e(P1, P2)^(log_P1(a1) * log_P2(b1) + ... + log_P1(ak) * log_P2(bk)) = 1 (in G_T)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Furthermore, the left hand side of this equation is equal to&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;e(log_P1(a1) * P1, log_P2(b1) * P2) * ... * e(log_P1(ak) * P1, log_P2(bk) * P2)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;= e(a1, b1) * ... * e(ak, bk)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;And thus, the precompiled contract can be implemented by verifying that
&lt;code&gt;e(a1, b1) * ... * e(ak, bk) = 1&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Implementations are available here:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;scipr-lab&#x2F;libff&#x2F;blob&#x2F;master&#x2F;libff&#x2F;algebra&#x2F;curves&#x2F;alt_bn128&#x2F;alt_bn128_g1.hpp&quot;&gt;libff&lt;&#x2F;a&gt; (C++)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;zcash&#x2F;bn&#x2F;blob&#x2F;master&#x2F;src&#x2F;groups&#x2F;mod.rs&quot;&gt;bn&lt;&#x2F;a&gt; (Rust)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;py_pairing&#x2F;blob&#x2F;master&#x2F;py_ecc&#x2F;bn128&#x2F;bn128_pairing.py&quot;&gt;Python&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>ENS support for contract ABIs</title>
        <published>2017-02-06T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Nick Johnson</name><email>nick@ethereum.org</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/205/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/205/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:205"
            label="ERC-205" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/205/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes a mechanism for storing ABI definitions in ENS, for easy lookup of contract interfaces by callers.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;ABIs are important metadata required for interacting with most contracts. At present, they are typically supplied out-of-band, which adds an additional burden to interacting with contracts, particularly on a one-off basis or where the ABI may be updated over time. The small size of ABIs permits an alternative solution, storing them in ENS, permitting name lookup and ABI discovery via the same process.&lt;&#x2F;p&gt;
&lt;p&gt;ABIs are typically quite compact; the largest in-use ABI we could find, that for the DAO, is 9450 bytes uncompressed JSON, 6920 bytes uncompressed CBOR, and 1128 bytes when the JSON form is compressed with zlib. Further gains on CBOR encoding are possible using a CBOR extension that permits eliminating repeated strings, which feature extensively in ABIs. Most ABIs, however, are far shorter than this, consisting of only a few hundred bytes of uncompressed JSON.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP defines a resolver profile for retrieving contract ABIs, as well as encoding standards for storing ABIs for different applications, allowing the user to select between different representations based on their need for compactness and other considerations such as onchain access.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;abi-encodings&quot;&gt;ABI encodings&lt;&#x2F;h3&gt;
&lt;p&gt;In order to allow for different tradeoffs between onchain size and accessibility, several ABI encodings are defined. Each ABI encoding is defined by a unique constant with only a single bit set, allowing for the specification of 256 unique encodings in a single uint.&lt;&#x2F;p&gt;
&lt;p&gt;The currently recognised encodings are:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;ID&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;JSON&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;zlib-compressed JSON&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;4&lt;&#x2F;td&gt;&lt;td&gt;CBOR&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;8&lt;&#x2F;td&gt;&lt;td&gt;URI&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;This table may be extended in future through the EIP process.&lt;&#x2F;p&gt;
&lt;p&gt;Encoding type 1 specifies plaintext JSON, uncompressed; this is the standard format in which ABIs are typically encoded, but also the bulkiest, and is not easily parseable onchain.&lt;&#x2F;p&gt;
&lt;p&gt;Encoding type 2 specifies zlib-compressed JSON. This is significantly smaller than uncompressed JSON, and is straightforward to decode offchain. However, it is impracticalfor onchain consumers to use.&lt;&#x2F;p&gt;
&lt;p&gt;Encoding type 4 is &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;cbor.io&#x2F;&quot;&gt;CBOR&lt;&#x2F;a&gt;. CBOR is a binary encoding format that is a superset of JSON, and is both more compact and easier to parse in limited environments such as the EVM. Consumers that support CBOR are strongly encouraged to also support the &lt;a rel=&quot;external&quot; href=&quot;http:&#x2F;&#x2F;cbor.schmorp.de&#x2F;stringref&quot;&gt;stringref extension&lt;&#x2F;a&gt; to CBOR, which provides significant additional reduction in encoded size.&lt;&#x2F;p&gt;
&lt;p&gt;Encoding type 8 indicates that the ABI can be found elsewhere, at the specified URI. This is typically the most compact of the supported forms, but also adds external dependencies for implementers. The specified URI may use any schema, but HTTP, IPFS, and Swarm are expected to be the most common.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;resolver-profile&quot;&gt;Resolver profile&lt;&#x2F;h3&gt;
&lt;p&gt;A new resolver interface is defined, consisting of the following method:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function ABI(bytes32 node, uint256 contentType) constant returns (uint256, bytes);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The interface ID of this interface is 0x2203ab56.&lt;&#x2F;p&gt;
&lt;p&gt;contentType is a bitfield, and is the bitwise OR of all the encoding types the caller will accept. Resolvers that implement this interface must return an ABI encoded using one of the requested formats, or &lt;code&gt;(0, &quot;&quot;)&lt;&#x2F;code&gt; if they do not have an ABI for this function, or do not support any of the requested formats.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;abi&lt;&#x2F;code&gt; resolver profile is valid on both forward and reverse records.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;abi-lookup-process&quot;&gt;ABI lookup process&lt;&#x2F;h3&gt;
&lt;p&gt;When attempting to fetch an ABI based on an ENS name, implementers should first attempt an ABI lookup on the name itself. If that lookup returns no results, they should attempt a reverse lookup on the Ethereum address the name resolves to.&lt;&#x2F;p&gt;
&lt;p&gt;Implementers should support as many of the ABI encoding formats as practical.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Storing ABIs onchain avoids the need to introduce additional dependencies for applications wishing to fetch them, such as swarm or HTTP access. Given the typical compactness of ABIs, we believe this is a worthwhile tradeoff in many cases.&lt;&#x2F;p&gt;
&lt;p&gt;The two-step resolution process permits different names to provide different ABIs for the same contract, such as in the case where it&#x27;s useful to provide a minimal ABI to some callers, as well as specifying ABIs for contracts that did not specify one of their own. The fallback to looking up an ABI on the reverse record permits contracts to specify their own canonical ABI, and prevents the need for duplication when multiple names reference the same contract without the need for different ABIs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Precompiled contracts for addition and scalar multiplication on the elliptic curve alt_bn128</title>
        <published>2017-02-02T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Christian Reitwiessner</name><email>chris@ethereum.org</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/196/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/196/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:196"
            label="EIP-196" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/196/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Precompiled contracts for elliptic curve operations are required in order to perform zkSNARK verification within the block gas limit.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP suggests to add precompiled contracts for addition and scalar multiplication on a specific pairing-friendly elliptic curve. This can in turn be combined with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;197&#x2F;&quot;&gt;EIP-197&lt;&#x2F;a&gt; to verify zkSNARKs in Ethereum smart contracts. The general benefit of zkSNARKs for Ethereum is that it will increase the privacy for users (because of the Zero-Knowledge property) and might also be a scalability solution (because of the succinctness and efficient verifiability property).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Current smart contract executions on Ethereum are fully transparent, which makes them unsuitable for several use-cases that involve private information like the location, identity or history of past transactions. The technology of zkSNARKs could be a solution to this problem. While the Ethereum Virtual Machine can make use of zkSNARKs in theory, they are currently too expensive
to fit the block gas limit. Because of that, this EIP proposes to specify certain parameters for some elementary primitives that enable zkSNARKs so that they can be implemented more efficiently and the gas cost be reduced.&lt;&#x2F;p&gt;
&lt;p&gt;Note that while fixing these parameters might look like limiting the use-cases for zkSNARKs, the primitives are so basic that they can be combined in ways that are flexible enough so that it should even be possible to allow future advances in zkSNARK research without the need for a further hard fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= BYZANTIUM_FORK_BLKNUM&lt;&#x2F;code&gt;, add precompiled contracts for point addition (ADD)  and scalar multiplication (MUL) on the elliptic curve &quot;alt_bn128&quot;.&lt;&#x2F;p&gt;
&lt;p&gt;Address of ADD: 0x6
Address for MUL: 0x7&lt;&#x2F;p&gt;
&lt;p&gt;The curve is defined by:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Y^2 = X^3 + 3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;over the field F_p with&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;p = 21888242871839275222246405745257275088696311157297823662689037894645226208583&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;encoding&quot;&gt;Encoding&lt;&#x2F;h3&gt;
&lt;p&gt;Field elements and scalars are encoded as 32 byte big-endian numbers. Curve points are encoded as two field elements &lt;code&gt;(x, y)&lt;&#x2F;code&gt;, where the point at infinity is encoded as &lt;code&gt;(0, 0)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Tuples of objects are encoded as their concatenation.&lt;&#x2F;p&gt;
&lt;p&gt;For both precompiled contracts, if the input is shorter than expected, it is assumed to be virtually padded with zeros at the end (i.e. compatible with the semantics of the &lt;code&gt;CALLDATALOAD&lt;&#x2F;code&gt; opcode). If the input is longer than expected, surplus bytes at the end are ignored.&lt;&#x2F;p&gt;
&lt;p&gt;The length of the returned data is always as specified (i.e. it is not &quot;unpadded&quot;).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;exact-semantics&quot;&gt;Exact semantics&lt;&#x2F;h3&gt;
&lt;p&gt;Invalid input: For both contracts, if any input point does not lie on the curve or any of the field elements (point coordinates) is equal or larger than the field modulus p, the contract fails. The scalar can be any number between &lt;code&gt;0&lt;&#x2F;code&gt; and &lt;code&gt;2**256-1&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;add&quot;&gt;ADD&lt;&#x2F;h4&gt;
&lt;p&gt;Input: two curve points &lt;code&gt;(x, y)&lt;&#x2F;code&gt;.
Output: curve point &lt;code&gt;x + y&lt;&#x2F;code&gt;, where &lt;code&gt;+&lt;&#x2F;code&gt; is point addition on the elliptic curve &lt;code&gt;alt_bn128&lt;&#x2F;code&gt; specified above.
Fails on invalid input and consumes all gas provided.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;mul&quot;&gt;MUL&lt;&#x2F;h4&gt;
&lt;p&gt;Input: curve point and scalar &lt;code&gt;(x, s)&lt;&#x2F;code&gt;.
Output: curve point &lt;code&gt;s * x&lt;&#x2F;code&gt;, where &lt;code&gt;*&lt;&#x2F;code&gt; is the scalar multiplication on the elliptic curve &lt;code&gt;alt_bn128&lt;&#x2F;code&gt; specified above.
Fails on invalid input and consumes all gas.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-costs&quot;&gt;Gas costs&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Gas cost for &lt;code&gt;ECADD&lt;&#x2F;code&gt;: 500&lt;&#x2F;li&gt;
&lt;li&gt;Gas cost for &lt;code&gt;ECMUL&lt;&#x2F;code&gt;: 40000&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The specific curve &lt;code&gt;alt_bn128&lt;&#x2F;code&gt; was chosen because it is particularly well-suited for zkSNARKs, or, more specifically their verification building block of pairing functions. Furthermore, by choosing this curve, we can use synergy effects with ZCash and re-use some of their components and artifacts.&lt;&#x2F;p&gt;
&lt;p&gt;The feature of adding curve and field parameters to the inputs was considered but ultimately rejected since it complicates the specification: The gas costs are much harder to determine and it would be possible to call the contracts on something which is not an actual elliptic curve.&lt;&#x2F;p&gt;
&lt;p&gt;A non-compact point encoding was chosen since it still allows to perform some operations in the smart contract itself (inclusion of the full y coordinate) and two encoded points can be compared for equality (no third projective coordinate).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;As with the introduction of any precompiled contract, contracts that already use the given addresses will change their semantics. Because of that, the addresses are taken from the &quot;reserved range&quot; below 256.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Inputs to test:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Curve points which would be valid if the numbers were taken mod p (should fail).&lt;&#x2F;li&gt;
&lt;li&gt;Both contracts should succeed on empty input.&lt;&#x2F;li&gt;
&lt;li&gt;Truncated input that results in a valid curve point.&lt;&#x2F;li&gt;
&lt;li&gt;Points not on curve (but valid otherwise).&lt;&#x2F;li&gt;
&lt;li&gt;Multiply point with scalar that lies between the order of the group and the field (should succeed).&lt;&#x2F;li&gt;
&lt;li&gt;Multiply point with scalar that is larger than the field order (should succeed).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Implementation of these primitives are available here:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;scipr-lab&#x2F;libff&#x2F;blob&#x2F;master&#x2F;libff&#x2F;algebra&#x2F;curves&#x2F;alt_bn128&#x2F;alt_bn128_g1.cpp&quot;&gt;libff&lt;&#x2F;a&gt; (C++)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;zcash&#x2F;bn&#x2F;blob&#x2F;master&#x2F;src&#x2F;groups&#x2F;mod.rs&quot;&gt;bn&lt;&#x2F;a&gt; (Rust)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In both codebases, a specific group on the curve alt_bn128 is used and is called G1.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;py_pairing&#x2F;blob&#x2F;master&#x2F;py_ecc&#x2F;bn128&#x2F;bn128_curve.py&quot;&gt;Python&lt;&#x2F;a&gt; - probably most self-contained and best readable.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Big integer modular exponentiation</title>
        <published>2017-01-30T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/198/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/198/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:198"
            label="EIP-198" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/198/">&lt;h1 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h1&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;GQUADDIVISOR: 20&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h1 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h1&gt;
&lt;p&gt;At address 0x00......05, add a precompile that expects input in the following format:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;length_of_BASE&amp;gt; &amp;lt;length_of_EXPONENT&amp;gt; &amp;lt;length_of_MODULUS&amp;gt; &amp;lt;BASE&amp;gt; &amp;lt;EXPONENT&amp;gt; &amp;lt;MODULUS&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Where every length is a 32-byte left-padded integer representing the number of bytes to be taken up by the next value. Call data is assumed to be infinitely right-padded with zero bytes, and excess data is ignored. Consumes &lt;code&gt;floor(mult_complexity(max(length_of_MODULUS, length_of_BASE)) * max(ADJUSTED_EXPONENT_LENGTH, 1) &#x2F; GQUADDIVISOR)&lt;&#x2F;code&gt; gas, and if there is enough gas, returns an output &lt;code&gt;(BASE**EXPONENT) % MODULUS&lt;&#x2F;code&gt; as a byte array with the same length as the modulus.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;ADJUSTED_EXPONENT_LENGTH&lt;&#x2F;code&gt; is defined as follows.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If &lt;code&gt;length_of_EXPONENT &amp;lt;= 32&lt;&#x2F;code&gt;, and all bits in &lt;code&gt;EXPONENT&lt;&#x2F;code&gt; are 0, return 0&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;length_of_EXPONENT &amp;lt;= 32&lt;&#x2F;code&gt;, then return the index of the highest bit in &lt;code&gt;EXPONENT&lt;&#x2F;code&gt; (eg. 1 -&amp;gt; 0, 2 -&amp;gt; 1, 3 -&amp;gt; 1, 255 -&amp;gt; 7, 256 -&amp;gt; 8).&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;length_of_EXPONENT &amp;gt; 32&lt;&#x2F;code&gt;, then return &lt;code&gt;8 * (length_of_EXPONENT - 32)&lt;&#x2F;code&gt; plus the index of the highest bit in the first 32 bytes of &lt;code&gt;EXPONENT&lt;&#x2F;code&gt; (eg. if &lt;code&gt;EXPONENT = \x00\x00\x01\x00.....\x00&lt;&#x2F;code&gt;, with one hundred bytes, then the result is 8 * (100 - 32) + 253 = 797). If all of the first 32 bytes of &lt;code&gt;EXPONENT&lt;&#x2F;code&gt; are zero, return exactly &lt;code&gt;8 * (length_of_EXPONENT - 32)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;code&gt;mult_complexity&lt;&#x2F;code&gt; is a function intended to approximate the difficulty of Karatsuba multiplication (used in all major bigint libraries) and is defined as follows.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def mult_complexity(x):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if x &amp;lt;= 64: return x ** 2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    elif x &amp;lt;= 1024: return x ** 2 &#x2F;&#x2F; 4 + 96 * x - 3072&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    else: return x ** 2 &#x2F;&#x2F; 16 + 480 * x - 199680&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;For example, the input data:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0000000000000000000000000000000000000000000000000000000000000020&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0000000000000000000000000000000000000000000000000000000000000020&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;03&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Represents the exponent &lt;code&gt;3**(2**256 - 2**32 - 978) % (2**256 - 2**32 - 977)&lt;&#x2F;code&gt;. By Fermat&#x27;s little theorem, this equals 1, so the result is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Returned as 32 bytes because the modulus length was 32 bytes. The &lt;code&gt;ADJUSTED_EXPONENT_LENGTH&lt;&#x2F;code&gt; would be 255, and the gas cost would be &lt;code&gt;mult_complexity(32) * 255 &#x2F; 20 = 13056&lt;&#x2F;code&gt; gas (note that this is ~8 times the cost of using the EXP opcode to compute a 32-byte exponent). A 4096-bit RSA exponentiation would cost &lt;code&gt;mult_complexity(512) * 4095 &#x2F; 100 = 22853376&lt;&#x2F;code&gt; gas in the worst case, though RSA verification in practice usually uses an exponent of 3 or 65537, which would reduce the gas consumption to 5580 or 89292, respectively.&lt;&#x2F;p&gt;
&lt;p&gt;This input data:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0000000000000000000000000000000000000000000000000000000000000020&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0000000000000000000000000000000000000000000000000000000000000020&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Would be parsed as a base of 0, exponent of &lt;code&gt;2**256 - 2**32 - 978&lt;&#x2F;code&gt; and modulus of &lt;code&gt;2**256 - 2**32 - 977&lt;&#x2F;code&gt;, and so would return 0. Notice how if the length_of_BASE is 0, then it does not interpret &lt;em&gt;any&lt;&#x2F;em&gt; data as the base, instead immediately interpreting the next 32 bytes as EXPONENT.&lt;&#x2F;p&gt;
&lt;p&gt;This input data:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0000000000000000000000000000000000000000000000000000000000000020&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Would parse a base length of 0, an exponent length of 32, and a modulus length of &lt;code&gt;2**256 - 1&lt;&#x2F;code&gt;, where the base is empty, the exponent is &lt;code&gt;2**256 - 2&lt;&#x2F;code&gt; and the modulus is &lt;code&gt;(2**256 - 3) * 256**(2**256 - 33)&lt;&#x2F;code&gt; (yes, that&#x27;s a really big number). It would then immediately fail, as it&#x27;s not possible to provide enough gas to make that computation.&lt;&#x2F;p&gt;
&lt;p&gt;This input data:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0000000000000000000000000000000000000000000000000000000000000002&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0000000000000000000000000000000000000000000000000000000000000020&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;03&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;8000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;07&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Would parse as a base of 3, an exponent of 65535, and a modulus of &lt;code&gt;2**255&lt;&#x2F;code&gt;, and it would ignore the remaining 0x07 byte.&lt;&#x2F;p&gt;
&lt;p&gt;This input data:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0000000000000000000000000000000000000000000000000000000000000002&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0000000000000000000000000000000000000000000000000000000000000020&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;03&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;80&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Would also parse as a base of 3, an exponent of 65535 and a modulus of &lt;code&gt;2**255&lt;&#x2F;code&gt;, as it attempts to grab 32 bytes for the modulus starting from 0x80 - but there is no further data, so it right-pads it with 31 zero bytes.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h1&gt;
&lt;p&gt;This allows for efficient RSA verification inside of the EVM, as well as other forms of number theory-based cryptography. Note that adding precompiles for addition and subtraction is not required, as the in-EVM algorithm is efficient enough, and multiplication can be done through this precompile via &lt;code&gt;a * b = ((a + b)**2 - (a - b)**2) &#x2F; 4&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The bit-based exponent calculation is done specifically to fairly charge for the often-used exponents of 2 (for multiplication) and 3 and 65537 (for RSA verification).&lt;&#x2F;p&gt;
&lt;h1 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h1&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Ethereum Smart Contract Packaging Standard</title>
        <published>2017-01-10T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Piper Merriam</name><uri>https://github.com/pipermerriam</uri>
	</author>
	
	<author>
		<name>Tim Coulter</name><uri>https://github.com/tcoulter</uri>
	</author>
	
	<author>
		<name>Denis Erfurt</name><uri>https://github.com/mhhf</uri>
	</author>
	
	<author>
		<name>RJ Catalano</name><uri>https://github.com/VoR0220</uri>
	</author>
	
	<author>
		<name>Iuri Matias</name><uri>https://github.com/iurimatias</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/190/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/190/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:190"
            label="ERC-190" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/190/">&lt;h1 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h1&gt;
&lt;p&gt;This ERC proposes a specification for Ethereum smart contract packages.&lt;&#x2F;p&gt;
&lt;p&gt;The specification was collaboratively developed by the following Ethereum development framework maintainers.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Tim Coulter (Truffle)&lt;&#x2F;li&gt;
&lt;li&gt;Denis Erfurt (Dapple)&lt;&#x2F;li&gt;
&lt;li&gt;Piper Merriam (Populus)&lt;&#x2F;li&gt;
&lt;li&gt;RJ Catalano (Eris PM)&lt;&#x2F;li&gt;
&lt;li&gt;Iuri Matias (Embark)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h1 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h1&gt;
&lt;p&gt;Packaging is a core piece of modern software development which is missing from the Ethereum ecosystem.  The lack of packaging limits the ability for developers to reuse code which negatively affects productivity and security.&lt;&#x2F;p&gt;
&lt;p&gt;A key example of this is the ERC20 standard.  There are a few well audited reusable token contracts available but most developers end up writing their own because of the difficulty in finding and reusing existing code.&lt;&#x2F;p&gt;
&lt;p&gt;A packaging standard should have the following positive effects on the ecosystem:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Greater overall productivity caused by the ability to reuse existing code.&lt;&#x2F;li&gt;
&lt;li&gt;Increased security caused by the ability to reuse existing well audited implementations of common patterns (ERC20, crowdfunding, etc).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Smart contract packaging should also have a direct positive effect on the end user.  Wallet software will be able to consume a released package and generate an interface for interacting with any deployed contracts included within that package.  With the advent of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;137&#x2F;&quot;&gt;ENS&lt;&#x2F;a&gt; all of the pieces will be in place for a wallet to take a human readable name and present the user with an interface for interacting with the underlying application.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h1&gt;
&lt;p&gt;The full specification for this standard is maintained separately in the repository &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethpm&#x2F;epm-spec&quot;&gt;epm&#x2F;epm-spec&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP refers to the &lt;code&gt;1.0.0&lt;&#x2F;code&gt; version of the specification: &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethpm&#x2F;epm-spec&#x2F;tree&#x2F;v1.0.0&quot;&gt;https:&#x2F;&#x2F;github.com&#x2F;ethpm&#x2F;epm-spec&#x2F;tree&#x2F;v1.0.0&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The specification contains details for a single document referred to as a &lt;em&gt;&quot;Release Lockfile&quot;&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Release Lockfile Specification: &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethpm&#x2F;epm-spec&#x2F;blob&#x2F;v1.0.0&#x2F;release-lockfile.spec.md&quot;&gt;https:&#x2F;&#x2F;github.com&#x2F;ethpm&#x2F;epm-spec&#x2F;blob&#x2F;v1.0.0&#x2F;release-lockfile.spec.md&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;JSON Schema for Release Lockfile: &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethpm&#x2F;epm-spec&#x2F;blob&#x2F;v1.0.0&#x2F;spec&#x2F;release-lockfile.spec.json&quot;&gt;https:&#x2F;&#x2F;github.com&#x2F;ethpm&#x2F;epm-spec&#x2F;blob&#x2F;v1.0.0&#x2F;spec&#x2F;release-lockfile.spec.json&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;blockquote&gt;
&lt;p&gt;These documents have not been inlined into this ERC to ensure that there is a single source of truth for the specification.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h1 id=&quot;use-cases&quot;&gt;Use Cases&lt;&#x2F;h1&gt;
&lt;p&gt;This specification covers the following types of smart contract packages.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Packages with contracts intended to be used as base contract such as the common &lt;code&gt;owned&lt;&#x2F;code&gt; pattern.&lt;&#x2F;li&gt;
&lt;li&gt;Packages with contracts that are ready to use as-is such as an ERC20 token contract.&lt;&#x2F;li&gt;
&lt;li&gt;Packages with deployed contracts such as libraries or services.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Full explanations and examples of these use cases can be found in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethpm&#x2F;epm-spec&#x2F;blob&#x2F;v1.0.0&#x2F;README.md#use-cases&quot;&gt;&lt;code&gt;README.md&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; from the &lt;code&gt;epm&#x2F;epm-spec&lt;&#x2F;code&gt; repository.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;package-managers&quot;&gt;Package Managers&lt;&#x2F;h1&gt;
&lt;p&gt;The &lt;em&gt;Release Lockfile&lt;&#x2F;em&gt; is intended for consumption by package management software.  Specific care was made to ensure that all of the following functionality can be implemented by package managers.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;deterministic-builds&quot;&gt;Deterministic builds&lt;&#x2F;h2&gt;
&lt;p&gt;Ensures that a package will always resolve to the same set of dependencies and source files.  Both source files and dependencies are content addressed to ensure that the referenced resources cannot change.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;bytecode-verification&quot;&gt;Bytecode verification&lt;&#x2F;h2&gt;
&lt;p&gt;Contains the appropriate information for a package manager to inspect a deployed contract and verify that its bytecode matches the bytecode that results from compilation and linking of the package source code.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;multi-chain-deploys&quot;&gt;Multi-chain deploys&lt;&#x2F;h2&gt;
&lt;p&gt;Supports deployments across multiple chains, allowing a package to define addresses on both the public mainnet and testnet.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;trusted-packages&quot;&gt;Trusted packages&lt;&#x2F;h2&gt;
&lt;p&gt;Allows for packages which exclude source code or other elements which would be needed for verification of the contract bytecode.  This allows for minimalistic packages to be created for special situations where the package manager will not be performing verification.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;framework-support-and-integration&quot;&gt;Framework support and integration&lt;&#x2F;h1&gt;
&lt;p&gt;Support for ERC190 is either implemented or in progress for the following:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;truffleframework.com&#x2F;&quot;&gt;Truffle&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;populus.readthedocs.io&#x2F;en&#x2F;latest&#x2F;&quot;&gt;Populus&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;dapple.readthedocs.io&#x2F;en&#x2F;master&#x2F;&quot;&gt;Dapple&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;eris-ltd&#x2F;eris-cli&quot;&gt;Eris PM&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;iurimatias&#x2F;embark-framework&quot;&gt;Embark&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;remix-ide&#x2F;issues&#x2F;386&quot;&gt;Browser Solidity&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Subroutines and Static Jumps for the EVM</title>
        <published>2016-12-10T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Greg Colvin</name><email>greg@colvin.org</email>
	</author>
	
	<author>
		<name>Brooklyn Zelenka</name><uri>https://github.com/expede</uri>
	</author>
	
	<author>
		<name>Paweł Bylica</name><uri>https://github.com/chfast</uri>
	</author>
	
	<author>
		<name>Christian Reitwiessner</name><uri>https://github.com/chriseth</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/615/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-615-subroutines-and-static-jumps-for-the-evm-last-call/3472" />
        

        <id>https://wg-eips.ritovision.com/615/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:615"
            label="EIP-615" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/615/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;In the 21st century, on a blockchain circulating billions of ETH, formal specification and verification are an essential tool against loss. Yet the design of the EVM makes this unnecessarily difficult. Further, the design of the EVM makes near-linear-time compilation to machine code difficult. We propose to move forward with proposals to resolve these problems by tightening EVM security guarantees and reducing barriers to performance.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;EVM code is currently difficult to statically analyze, hobbling critical tools for preventing the many expensive bugs our blockchain has experienced. Further, none of the current implementations of the Ethereum Virtual Machine—including the compilers—are sufficiently performant to reduce the need for precompiles and otherwise meet the network&#x27;s long-term demands.  This proposal identifies dynamic jumps as a major reason for these issues, and proposes changes to the EVM specification to address the problem, making further efforts towards a safer and more performant the EVM possible.&lt;&#x2F;p&gt;
&lt;p&gt;We also propose to validate—in near-linear time—that EVM contracts correctly use subroutines, avoid misuse of the stack, and meet other safety conditions &lt;em&gt;before&lt;&#x2F;em&gt; placing them on the blockchain.  Validated code precludes most runtime exceptions and the need to test for them.  And well-behaved control flow and use of the stack makes life easier for interpreters, compilers, formal analysis, and other tools.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently the EVM supports only dynamic jumps, where the address to jump to is an argument on the stack.  Worse, the EVM fails to provide ordinary, alternative control flow facilities like subroutines and switches provided by Wasm and most CPUs.  So dynamic jumps cannot be avoided, yet they obscure the structure of the code and thus mostly inhibit control- and data-flow analysis.  This puts the quality and speed of optimized compilation fundamentally at odds.  Further, since many jumps can potentially be to any jump destination in the code, the number of possible paths through the code can go up as the product of the number of jumps by the number of destinations, as does the time complexity of static analysis.  Many of these cases are undecidable at deployment time, further inhibiting static and formal analyses.&lt;&#x2F;p&gt;
&lt;p&gt;However, given Ethereum&#x27;s security requirements, &lt;strong&gt;near-linear&lt;&#x2F;strong&gt; &lt;strong&gt;&lt;code&gt;n log n&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; &lt;strong&gt;time complexity&lt;&#x2F;strong&gt; is essential.  Otherwise, Contracts can be crafted or discovered with quadratic complexity to use as denial of service attack vectors against validations and optimizations.&lt;&#x2F;p&gt;
&lt;p&gt;But absent dynamic jumps code can be statically analyzed in linear time.  That allows for &lt;em&gt;linear time validation&lt;&#x2F;em&gt;.  It also allows for code generation and such optimizations as can be done in &lt;code&gt;log n&lt;&#x2F;code&gt; time to comprise an &lt;em&gt;&lt;code&gt;n log n&lt;&#x2F;code&gt;&lt;&#x2F;em&gt; &lt;em&gt;time compiler&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;And absent dynamic jumps, and with proper subroutines the EVM is a better target for code generation from other languages, including&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Solidity&lt;&#x2F;li&gt;
&lt;li&gt;Vyper&lt;&#x2F;li&gt;
&lt;li&gt;LLVM IR
&lt;ul&gt;
&lt;li&gt;front ends include C, C++, Common Lisp, D, Fortran, Haskell, Java, Javascript, Kotlin, Lua, Objective-C, Pony, Pure, Python, Ruby, Rust, Scala, Scheme, and Swift&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The result is that all of the following validations and optimizations can be done at deployment time with near-linear &lt;code&gt;(n log n)&lt;&#x2F;code&gt; time complexity.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The absence of most exceptional halting states can be validated.&lt;&#x2F;li&gt;
&lt;li&gt;The maximum use of resources can be sometimes be calculated.&lt;&#x2F;li&gt;
&lt;li&gt;Bytecode can be compiled to machine code in near-linear time.&lt;&#x2F;li&gt;
&lt;li&gt;Compilation can more effectively optimize use of smaller registers.&lt;&#x2F;li&gt;
&lt;li&gt;Compilation can more effectively optimize injection of gas metering.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;dependencies&quot;&gt;Dependencies&lt;&#x2F;h3&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1702&#x2F;&quot;&gt;EIP-1702&lt;&#x2F;a&gt;. Generalized Account Versioning Scheme.&lt;&#x2F;strong&gt; This proposal needs a versioning scheme to allow for its bytecode (and eventually eWasm bytecode) to be deployed with existing bytecode on the same blockchain.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h3 id=&quot;proposal&quot;&gt;Proposal&lt;&#x2F;h3&gt;
&lt;p&gt;We propose to deprecate two existing instructions—&lt;code&gt;JUMP&lt;&#x2F;code&gt; and &lt;code&gt;JUMPI&lt;&#x2F;code&gt;—and propose new instructions to support their legitimate uses.  In particular, it must remain possible to compile Solidity and Vyper code to EVM bytecode, with no significant loss of performance or increase in gas price.&lt;&#x2F;p&gt;
&lt;p&gt;Especially important is efficient translation to and from &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ewasm&#x2F;design&quot;&gt;eWasm&lt;&#x2F;a&gt; and to machine code.  To that end we maintain a close correspondence between &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;webassembly.github.io&#x2F;spec&#x2F;core&#x2F;_download&#x2F;WebAssembly.pdf&quot;&gt;Wasm&lt;&#x2F;a&gt;, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.intel.com&#x2F;content&#x2F;dam&#x2F;www&#x2F;public&#x2F;us&#x2F;en&#x2F;documents&#x2F;manuals&#x2F;64-ia-32-architectures-software-developer-instruction-set-reference-manual-325383.pdf&quot;&gt;x86&lt;&#x2F;a&gt;, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;static.docs.arm.com&#x2F;100076&#x2F;0100&#x2F;arm_instruction_set_reference_guide_100076_0100_00_en.pdf&quot;&gt;ARM&lt;&#x2F;a&gt; and proposed EVM instructions.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;EIP-615&lt;&#x2F;th&gt;&lt;th&gt;Wasm&lt;&#x2F;th&gt;&lt;th&gt;x86&lt;&#x2F;th&gt;&lt;th&gt;ARM&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;JUMPTO&lt;&#x2F;td&gt;&lt;td&gt;br&lt;&#x2F;td&gt;&lt;td&gt;JMP&lt;&#x2F;td&gt;&lt;td&gt;B&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;JUMPIF&lt;&#x2F;td&gt;&lt;td&gt;br_if&lt;&#x2F;td&gt;&lt;td&gt;JE&lt;&#x2F;td&gt;&lt;td&gt;BEQ&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;JUMPV&lt;&#x2F;td&gt;&lt;td&gt;br_table&lt;&#x2F;td&gt;&lt;td&gt;JMP&lt;&#x2F;td&gt;&lt;td&gt;TBH&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;JUMPSUB&lt;&#x2F;td&gt;&lt;td&gt;call&lt;&#x2F;td&gt;&lt;td&gt;CALL&lt;&#x2F;td&gt;&lt;td&gt;BL&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;JUMPSUBV&lt;&#x2F;td&gt;&lt;td&gt;call_indirect&lt;&#x2F;td&gt;&lt;td&gt;CALL&lt;&#x2F;td&gt;&lt;td&gt;BL&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;RETURN&lt;&#x2F;td&gt;&lt;td&gt;return&lt;&#x2F;td&gt;&lt;td&gt;RET&lt;&#x2F;td&gt;&lt;td&gt;RET&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;GETLOCAL&lt;&#x2F;td&gt;&lt;td&gt;local.get&lt;&#x2F;td&gt;&lt;td&gt;POP&lt;&#x2F;td&gt;&lt;td&gt;POP&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;PUTLOCAL&lt;&#x2F;td&gt;&lt;td&gt;local.put&lt;&#x2F;td&gt;&lt;td&gt;PUSH&lt;&#x2F;td&gt;&lt;td&gt;PUSH&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;BEGINSUB&lt;&#x2F;td&gt;&lt;td&gt;func&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;BEGINDATA&lt;&#x2F;td&gt;&lt;td&gt;tables&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;preliminaries&quot;&gt;Preliminaries&lt;&#x2F;h4&gt;
&lt;p&gt;These forms&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;&lt;code&gt;INSTRUCTION&lt;&#x2F;code&gt;&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;&lt;code&gt;INSTRUCTION x&lt;&#x2F;code&gt;&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;&lt;code&gt;INSTRUCTION x, y&lt;&#x2F;code&gt;&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;name an &lt;em&gt;&lt;code&gt;INSTRUCTION&lt;&#x2F;code&gt;&lt;&#x2F;em&gt; with no, one and two arguments, respectively. An instruction is represented in the bytecode as a single-byte opcode. Any arguments are laid out as immediate data bytes following the opcode inline, interpreted as fixed length, MSB-first, two&#x27;s-complement, two-byte positive integers. (Negative values are reserved for extensions.)&lt;&#x2F;p&gt;
&lt;h4 id=&quot;branches-and-subroutines&quot;&gt;Branches and Subroutines&lt;&#x2F;h4&gt;
&lt;p&gt;The two most important uses of &lt;code&gt;JUMP&lt;&#x2F;code&gt; and &lt;code&gt;JUMPI&lt;&#x2F;code&gt; are static jumps and return jumps. Conditional and unconditional static jumps are the mainstay of control flow.  Return jumps are implemented as a dynamic jump to a return address pushed on the stack.  With the combination of a static jump and a dynamic return jump you can—and Solidity does—implement subroutines.  The problem is that static analysis cannot tell the one place the return jump is going, so it must analyze every possibility (a heavy analysis).&lt;&#x2F;p&gt;
&lt;p&gt;Static jumps are provided by&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;JUMPTO jump_target&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;JUMPIF jump_target&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;which are the same as &lt;code&gt;JUMP&lt;&#x2F;code&gt; and &lt;code&gt;JUMPI&lt;&#x2F;code&gt; except that they jump to an immediate &lt;code&gt;jump_target&lt;&#x2F;code&gt; rather than an address on the stack.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;To support subroutines, &lt;code&gt;BEGINSUB&lt;&#x2F;code&gt;, &lt;code&gt;JUMPSUB&lt;&#x2F;code&gt;, and &lt;code&gt;RETURNSUB&lt;&#x2F;code&gt; are provided.  Brief descriptions follow, and full semantics are given below.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;BEGINSUB n_args, n_results&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;marks the &lt;strong&gt;single&lt;&#x2F;strong&gt; entry to a subroutine.  &lt;code&gt;n_args&lt;&#x2F;code&gt; items are taken off of the stack at entry to, and &lt;code&gt;n_results&lt;&#x2F;code&gt; items are placed on the stack at return from the subroutine.   The subroutine ends at the next &lt;code&gt;BEGINSUB&lt;&#x2F;code&gt; instruction (or &lt;code&gt;BEGINDATA&lt;&#x2F;code&gt;, below) or at the end of the bytecode.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;JUMPSUB jump_target&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;jumps to an immediate subroutine address.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;RETURNSUB&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;returns from the current subroutine to the instruction following the JUMPSUB that entered it.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h4 id=&quot;switches-callbacks-and-virtual-functions&quot;&gt;Switches, Callbacks, and Virtual Functions&lt;&#x2F;h4&gt;
&lt;p&gt;Dynamic jumps are also used for &lt;code&gt;O(1)&lt;&#x2F;code&gt; indirection: an address to jump to is selected to push on the stack and be jumped to.  So we also propose two more instructions to provide for constrained indirection.  We support these with vectors of &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; or &lt;code&gt;BEGINSUB&lt;&#x2F;code&gt; offsets stored inline, which can be selected with an index on the stack.  That constrains validation to a specified subset of all possible destinations.  The danger of quadratic blow up is avoided because it takes as much space to store the jump vectors as it does to code the worst case exploit.&lt;&#x2F;p&gt;
&lt;p&gt;Dynamic jumps to a &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; are used to implement &lt;code&gt;O(1)&lt;&#x2F;code&gt; jumptables, which are useful for dense switch statements.  Wasm and most CPUs provide similar instructions.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;JUMPV n, jump_targets&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;jumps to one of a vector of &lt;code&gt;n&lt;&#x2F;code&gt; &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; offsets via a zero-based index on the stack.  The vector is stored inline at the &lt;code&gt;jump_targets&lt;&#x2F;code&gt; offset after the BEGINDATA bytecode as MSB-first, two&#x27;s-complement, two-byte positive integers.  If the index is greater than or equal to &lt;code&gt;n - 1&lt;&#x2F;code&gt; the last (default) offset is used.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;Dynamic jumps to a &lt;code&gt;BEGINSUB&lt;&#x2F;code&gt; are used to implement &lt;code&gt;O(1)&lt;&#x2F;code&gt; virtual functions and callbacks, which take at most two pointer dereferences on most CPUs.   Wasm provides a similar instruction.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;JUMPSUBV n, jump_targets&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;jumps to one of a vector of &lt;code&gt;n&lt;&#x2F;code&gt; &lt;code&gt;BEGINSUB&lt;&#x2F;code&gt; offsets via a zero-based index on the stack.  The vector is stored inline at the &lt;code&gt;jump_targets&lt;&#x2F;code&gt; offset after the DATA bytecode, as MSB-first, two&#x27;s-complement, two-byte positive integers.  If the index is greater than or equal to &lt;code&gt;n - 1&lt;&#x2F;code&gt; the last (default) offset is used.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h4 id=&quot;variable-access&quot;&gt;Variable Access&lt;&#x2F;h4&gt;
&lt;p&gt;These operations provide convenient access to subroutine parameters and local variables at fixed stack offsets within a subroutine.  Otherwise only sixteen variables can be directly addressed.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;PUTLOCAL n&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Pops the stack to the local variable &lt;code&gt;n&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;GETLOCAL n&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Pushes the local variable &lt;code&gt;n&lt;&#x2F;code&gt; onto the stack.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;Local variable &lt;code&gt;n&lt;&#x2F;code&gt; is the nth stack item below the frame pointer, &lt;code&gt;FP[-n]&lt;&#x2F;code&gt;, as defined below.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;data&quot;&gt;Data&lt;&#x2F;h4&gt;
&lt;p&gt;There needs to be a way to place unreachable data into the bytecode that will be skipped over and not validated.  Indirect jump vectors will not be valid code.  Initialization code must create runtime code from data that might not be valid code.  And unreachable data might prove useful to programs for other purposes.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;BEGINDATA&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;specifies that all of the following bytes to the end of the bytecode are data, and not reachable code.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h4 id=&quot;structure&quot;&gt;Structure&lt;&#x2F;h4&gt;
&lt;p&gt;Valid EIP-615 EVM bytecode begins with a valid header.  This is the magic number  ‘\0evm’ followed by the semantic versioning number &#x27;\1\5\0&#x27;.  (For Wasm the header is &#x27;\0asm\1&#x27;).&lt;&#x2F;p&gt;
&lt;p&gt;Following the header is the BEGINSUB opcode for the &lt;em&gt;main&lt;&#x2F;em&gt; routine.  It takes no arguments and returns no values.  Other subroutines may follow the &lt;em&gt;main&lt;&#x2F;em&gt; routine, and an optional BEGINDATA opcode may mark the start of a data section.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;semantics&quot;&gt;Semantics&lt;&#x2F;h3&gt;
&lt;p&gt;Jumps to and returns from subroutines are described here in terms of&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The EVM data stack, (as defined in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum.github.io&#x2F;yellowpaper&#x2F;paper.pdf&quot;&gt;Yellow Paper&lt;&#x2F;a&gt;) usually just called “the stack.”&lt;&#x2F;li&gt;
&lt;li&gt;A return stack of &lt;code&gt;JUMPSUB&lt;&#x2F;code&gt; and &lt;code&gt;JUMPSUBV&lt;&#x2F;code&gt; offsets.&lt;&#x2F;li&gt;
&lt;li&gt;A frame stack of frame pointers.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;We will adopt the following conventions to describe the machine state:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;em&gt;program counter&lt;&#x2F;em&gt; &lt;code&gt;PC&lt;&#x2F;code&gt; is (as usual) the byte offset of the currently executing instruction.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;em&gt;stack pointer&lt;&#x2F;em&gt; &lt;code&gt;SP&lt;&#x2F;code&gt; corresponds to the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum.github.io&#x2F;yellowpaper&#x2F;paper.pdf&quot;&gt;Yellow Paper&lt;&#x2F;a&gt;&#x27;s substate &lt;code&gt;s&lt;&#x2F;code&gt; of the machine state.
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;SP[0]&lt;&#x2F;code&gt; is where a new item is can be pushed on the stack.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SP[1]&lt;&#x2F;code&gt; is the first item on the stack, which can be popped off the stack.&lt;&#x2F;li&gt;
&lt;li&gt;The stack grows towards lower addresses.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;em&gt;frame pointer&lt;&#x2F;em&gt; &lt;code&gt;FP&lt;&#x2F;code&gt; is set to &lt;code&gt;SP + n_args&lt;&#x2F;code&gt; at entry to the currently executing subroutine.
&lt;ul&gt;
&lt;li&gt;The &lt;em&gt;stack items&lt;&#x2F;em&gt; between the frame pointer and the current stack pointer are called the &lt;em&gt;frame&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The current number of items in the frame, &lt;code&gt;FP - SP&lt;&#x2F;code&gt;, is the &lt;em&gt;frame size&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;&#x2F;strong&gt;: Defining the frame pointer so as to include the arguments is unconventional, but better fits our stack semantics and simplifies the remainder of the proposal.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;The frame pointer and return stacks are internal to the subroutine mechanism, and not directly accessible to the program.  This is necessary to prevent the program from modifying its own state in ways that could be invalid.&lt;&#x2F;p&gt;
&lt;p&gt;Execution of EVM bytecode begins with the &lt;em&gt;main&lt;&#x2F;em&gt; routine with no arguments, &lt;code&gt;SP&lt;&#x2F;code&gt; and &lt;code&gt;FP&lt;&#x2F;code&gt; set to 0, and with one value on the return stack—&lt;code&gt;code_size - 1&lt;&#x2F;code&gt;. (Executing the virtual byte of 0 after this offset causes an EVM to stop.  Thus executing a &lt;code&gt;RETURNSUB&lt;&#x2F;code&gt; with no prior &lt;code&gt;JUMPSUB&lt;&#x2F;code&gt; or &lt;code&gt;JUMBSUBV&lt;&#x2F;code&gt;—that is, in the &lt;em&gt;main&lt;&#x2F;em&gt; routine—executes a &lt;code&gt;STOP&lt;&#x2F;code&gt;.)&lt;&#x2F;p&gt;
&lt;p&gt;Execution of a subroutine begins with &lt;code&gt;JUMPSUB&lt;&#x2F;code&gt; or &lt;code&gt;JUMPSUBV&lt;&#x2F;code&gt;, which&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;pushes &lt;code&gt;PC&lt;&#x2F;code&gt; on the return stack,&lt;&#x2F;li&gt;
&lt;li&gt;pushes &lt;code&gt;FP&lt;&#x2F;code&gt; on the frame stack
&lt;ul&gt;
&lt;li&gt;thus suspending execution of the current subroutine,&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;sets &lt;code&gt;FP&lt;&#x2F;code&gt; to &lt;code&gt;SP + n_args&lt;&#x2F;code&gt;, and&lt;&#x2F;li&gt;
&lt;li&gt;sets &lt;code&gt;PC&lt;&#x2F;code&gt; to the specified &lt;code&gt;BEGINSUB&lt;&#x2F;code&gt; address
&lt;ul&gt;
&lt;li&gt;thus beginning execution of the new subroutine.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Execution of a subroutine is suspended during and resumed after execution of nested subroutines, and ends upon encountering a &lt;code&gt;RETURNSUB&lt;&#x2F;code&gt;, which&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;sets &lt;code&gt;FP&lt;&#x2F;code&gt; to the top of the virtual frame stack and pops the stack,&lt;&#x2F;li&gt;
&lt;li&gt;sets &lt;code&gt;SP&lt;&#x2F;code&gt; to &lt;code&gt;FP + n_results&lt;&#x2F;code&gt;,&lt;&#x2F;li&gt;
&lt;li&gt;sets &lt;code&gt;PC&lt;&#x2F;code&gt; to top of the return stack and pops the stack, and&lt;&#x2F;li&gt;
&lt;li&gt;advances &lt;code&gt;PC&lt;&#x2F;code&gt; to the next instruction&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;thus resuming execution of the enclosing subroutine or &lt;em&gt;main&lt;&#x2F;em&gt; routine.  A &lt;code&gt;STOP&lt;&#x2F;code&gt; or &lt;code&gt;RETURN&lt;&#x2F;code&gt; also ends the execution of a subroutine.&lt;&#x2F;p&gt;
&lt;p&gt;For example, starting from this stack,&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;_________________&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      | locals      20 &amp;lt;- FP&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;frame |             21&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;______|___________  22&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                       &amp;lt;- SP&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;and after pushing two arguments and branching with &lt;code&gt;JUMPSUB&lt;&#x2F;code&gt; to a &lt;code&gt;BEGINSUB 2, 3&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 10&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 11&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;JUMPSUB beginsub&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;and initializing three local variables&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 99&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 98&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 97&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;the stack looks like this&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    21&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;__________________  22&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      | arguments   10 &amp;lt;- FP&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;frame |___________  11&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      | locals      99&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      |             98&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;______|___________  97&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                       &amp;lt;- SP&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;After some amount of computation the stack could look like this&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    21&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;__________________  22&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      | returns     44 &amp;lt;- FP&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      |             43&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;frame |___________  42&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      | locals      13&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;______|___________  14&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                       &amp;lt;- SP&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;and after &lt;code&gt;RETURNSUB&lt;&#x2F;code&gt; would look like this&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;_________________&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      | locals      20 &amp;lt;- FP&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      |             21&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;frame |___________  22&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      | returns     44&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      |             43&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;______|___________  42&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                       &amp;lt;- SP&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;validity&quot;&gt;Validity&lt;&#x2F;h3&gt;
&lt;p&gt;We would like to consider EVM code valid iff no execution of the program can lead to an exceptional halting state, but we must validate code in linear time. So our validation does not consider the code’s data and computations, only its control flow and stack use.  This means we will reject programs with invalid code paths, even if those paths are not reachable.  Most conditions can be validated, and will not need to be checked at runtime; the exceptions are sufficient gas and sufficient stack.  As such, static analysis may yield false negatives belonging to well-understood classes of code requiring runtime checks.  Aside from those cases, we can validate large classes at validation time and with linear complexity.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Execution&lt;&#x2F;em&gt; is as defined in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum.github.io&#x2F;yellowpaper&#x2F;paper.pdf&quot;&gt;Yellow Paper&lt;&#x2F;a&gt;—a sequence of changes in the EVM state.  The conditions on valid code are preserved by state changes.  At runtime, if execution of an instruction would violate a condition the execution is in an exceptional halting state.  The Yellow Paper defines five such states.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;1&lt;&#x2F;strong&gt;  Insufficient gas&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;2&lt;&#x2F;strong&gt;  More than 1024 stack items&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;3&lt;&#x2F;strong&gt;  Insufficient stack items&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;4&lt;&#x2F;strong&gt;  Invalid jump destination&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;5&lt;&#x2F;strong&gt;  Invalid instruction&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;We propose to expand and extend the Yellow Paper conditions to handle the new instructions we propose.&lt;&#x2F;p&gt;
&lt;p&gt;To handle the return stack we expand the conditions on stack size:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;2a&lt;&#x2F;strong&gt;  The size of the data stack does not exceed 1024.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;2b&lt;&#x2F;strong&gt;  The size of the return stack does not exceed 1024.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;Given our more detailed description of the data stack we restate condition 3—stack underflow—as&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;3&lt;&#x2F;strong&gt;  &lt;code&gt;SP&lt;&#x2F;code&gt; must be less than or equal to &lt;code&gt;FP&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;Since the various &lt;code&gt;DUP&lt;&#x2F;code&gt; and &lt;code&gt;SWAP&lt;&#x2F;code&gt; operations—as well as &lt;code&gt;PUTLOCAL&lt;&#x2F;code&gt; and &lt;code&gt;GETLOCAL&lt;&#x2F;code&gt;—are defined as taking items off the stack and putting them back on, this prevents them from accessing data below the frame pointer, since taking too many items off of the stack would mean that &lt;code&gt;SP&lt;&#x2F;code&gt; is less than &lt;code&gt;FP&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;To handle the new jump instructions and subroutine boundaries, we expand the conditions on jumps and jump destinations.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;4a&lt;&#x2F;strong&gt;  &lt;code&gt;JUMPTO&lt;&#x2F;code&gt;, &lt;code&gt;JUMPIF&lt;&#x2F;code&gt;, and &lt;code&gt;JUMPV&lt;&#x2F;code&gt; address only &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; instructions.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;4b&lt;&#x2F;strong&gt;  &lt;code&gt;JUMPSUB&lt;&#x2F;code&gt; and &lt;code&gt;JUMPSUBV&lt;&#x2F;code&gt; address only &lt;code&gt;BEGINSUB&lt;&#x2F;code&gt; instructions.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;4c&lt;&#x2F;strong&gt;  &lt;code&gt;JUMP&lt;&#x2F;code&gt; instructions do not address instructions outside of the subroutine they occur in.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;We have two new conditions on execution to ensure consistent use of the stack by subroutines:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;6&lt;&#x2F;strong&gt;  For &lt;code&gt;JUMPSUB&lt;&#x2F;code&gt; and &lt;code&gt;JUMPSUBV&lt;&#x2F;code&gt; the frame size is at least the &lt;code&gt;n_args&lt;&#x2F;code&gt; of the &lt;code&gt;BEGINSUB&lt;&#x2F;code&gt;(s) to jump to.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;7&lt;&#x2F;strong&gt;  For &lt;code&gt;RETURNSUB&lt;&#x2F;code&gt; the frame size is equal to the &lt;code&gt;n_results&lt;&#x2F;code&gt; of the enclosing &lt;code&gt;BEGINSUB&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;Finally, we have one condition that prevents pathological uses of the stack:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;8&lt;&#x2F;strong&gt;  For every instruction in the code the frame size is constant.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;In practice, we must test at runtime for conditions 1 and 2—sufficient gas and sufficient stack.  We don’t know how much gas there will be, we don’t know how deep a recursion may go, and analysis of stack depth even for non-recursive programs is nontrivial.&lt;&#x2F;p&gt;
&lt;p&gt;All of the remaining conditions we validate statically.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;costs-codes&quot;&gt;Costs &amp;amp; Codes&lt;&#x2F;h4&gt;
&lt;p&gt;All of the instructions are &lt;code&gt;O(1)&lt;&#x2F;code&gt; with a small constant, requiring just a few machine operations each, whereas a &lt;code&gt;JUMP&lt;&#x2F;code&gt; or &lt;code&gt;JUMPI&lt;&#x2F;code&gt; typically does an &lt;code&gt;O(log n)&lt;&#x2F;code&gt; binary search of an array of &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; offsets before every jump. With the cost of &lt;code&gt;JUMPI&lt;&#x2F;code&gt; being &lt;em&gt;high&lt;&#x2F;em&gt; and the cost of &lt;code&gt;JUMP&lt;&#x2F;code&gt; being &lt;em&gt;mid&lt;&#x2F;em&gt;, we suggest the cost of &lt;code&gt;JUMPV&lt;&#x2F;code&gt; and &lt;code&gt;JUMPSUBV&lt;&#x2F;code&gt; should be &lt;em&gt;mid&lt;&#x2F;em&gt;, &lt;code&gt;JUMPSUB&lt;&#x2F;code&gt; and &lt;code&gt;JUMPIF&lt;&#x2F;code&gt; should be &lt;em&gt;low&lt;&#x2F;em&gt;, and&lt;code&gt;JUMPTO&lt;&#x2F;code&gt; and the rest should be &lt;em&gt;verylow&lt;&#x2F;em&gt;.  Measurement will tell.&lt;&#x2F;p&gt;
&lt;p&gt;We suggest the following opcodes:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xb0 JUMPTO&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xb1 JUMPIF&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xb2 JUMPV&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xb3 JUMPSUB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xb4 JUMPSUBV&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xb5 BEGINSUB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xb6 BEGINDATA&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xb7 RETURNSUB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xb8 PUTLOCAL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xb9 GETLOCAL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;These changes would need to be implemented in phases at decent intervals:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;1.&lt;&#x2F;strong&gt;  If this EIP is accepted, invalid code should be deprecated. Tools should stop generating invalid code, users should stop writing it, and clients should warn about loading it.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;2.&lt;&#x2F;strong&gt;  A later hard fork would require clients to place only valid code on the block chain.  Note that despite the fork old EVM code will still need to be supported indefinitely; older contracts will continue to run, and to create new contracts.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;If desired, the period of deprecation can be extended indefinitely by continuing to accept code not versioned as new—but without validation.  That is, by delaying or canceling phase 2.&lt;&#x2F;p&gt;
&lt;p&gt;Regardless, we will need a versioning scheme like &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1702&#x2F;&quot;&gt;EIP-1702&lt;&#x2F;a&gt; to allow current code and EIP-615 code to coexist on the same blockchain.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This design was highly constrained by the existing EVM semantics, the requirement for eWasm compatibility, and the security demands of the Ethereum environment.  It was also informed by the lead author&#x27;s previous work implementing Java and Scheme interpreters.  As such there was very little room for alternative designs.&lt;&#x2F;p&gt;
&lt;p&gt;As described above, the approach was simply to deprecate the problematic dynamic jumps, then ask what opcodes were necessary to provide for the features they supported.  These needed to include those provided by eWasm, which themselves were modeled after typical hardware.  The only real innovation was to move the frame pointer and the return pointer to their own stacks, so as to prevent any possibility of overwriting them. (Although Forth also uses a return stack.)  This allowed for treating subroutine arguments as local variables, and facilitated the return of multiple values.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Implementation of this proposal need not be difficult.  At the least, interpreters can simply be extended with the new opcodes and run unchanged otherwise.  The new opcodes require only stacks for the frame pointers and return offsets and the few pushes, pops, and assignments described above. The bulk of the effort is the validator, which in most languages can almost be transcribed from the pseudocode above.&lt;&#x2F;p&gt;
&lt;p&gt;A lightly tested C++ reference implementation is available in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;gcolvin&#x2F;aleth&#x2F;tree&#x2F;master&#x2F;libaleth-interpreter&quot;&gt;Greg Colvin&#x27;s Aleth fork.&lt;&#x2F;a&gt;  This version required circa 110 lines of new interpreter code and a well-commented, 178-line validator.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;appendix-a&quot;&gt;Appendix A&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;validation&quot;&gt;Validation&lt;&#x2F;h3&gt;
&lt;p&gt;Validation comprises two tasks:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Check that jump destinations are correct and instructions valid.&lt;&#x2F;li&gt;
&lt;li&gt;Check that subroutines satisfy the conditions on control flow and stack use.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;We sketch out these two validation functions in pseudo-C below.  To simplify the presentation only the five primitives are handled (&lt;code&gt;JUMPV&lt;&#x2F;code&gt; and &lt;code&gt;JUMPSUBV&lt;&#x2F;code&gt; would just add more complexity to loop over their vectors), we assume helper functions for extracting instruction arguments from immediate data and managing the stack pointer and program counter, and some optimizations are forgone.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;validating-jumps&quot;&gt;Validating Jumps&lt;&#x2F;h4&gt;
&lt;p&gt;Validating that jumps are to valid addresses takes two sequential passes over the bytecode—one to build sets of jump destinations and subroutine entry points, another to check that addresses jumped to are in the appropriate sets.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytecode[code_size]   &#x2F;&#x2F; contains EVM bytecode to validate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    is_sub[code_size]     &#x2F;&#x2F; is there a BEGINSUB at PC?&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    is_dest[code_size]    &#x2F;&#x2F; is there a JUMPDEST at PC?&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sub_for_pc[code_size] &#x2F;&#x2F; which BEGINSUB is PC in?&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bool validate_jumps(PC)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        current_sub = PC&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &#x2F;&#x2F; build sets of BEGINSUBs and JUMPDESTs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        for (PC = 0; instruction = bytecode[PC]; PC = advance_pc(PC))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if instruction is invalid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                return false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if instruction is BEGINDATA&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                break;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if instruction is BEGINSUB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                is_sub[PC] = true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                current_sub = PC&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                sub_for_pc[PC] = current_sub&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if instruction is JUMPDEST&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                is_dest[PC] = true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            sub_for_pc[PC] = current_sub&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &#x2F;&#x2F; check that targets are in subroutine&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        for (PC = 0; instruction = bytecode[PC]; PC = advance_pc(PC))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if instruction is BEGINDATA&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                break;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if instruction is BEGINSUB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                current_sub = PC&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if instruction is JUMPSUB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                if is_sub[jump_target(PC)] is false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    return false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if instruction is JUMPTO or JUMPIF&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                if is_dest[jump_target(PC)] is false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    return false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if sub_for_pc[PC] is not current_sub&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                return false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;       }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;       return true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note that code like this is already run by EVMs to check dynamic jumps, including building the jump destination set every time a contract is run, and doing a lookup in the jump destination set before every jump.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;subroutine-validation&quot;&gt;Subroutine Validation&lt;&#x2F;h4&gt;
&lt;p&gt;This function can be seen as a symbolic execution of a subroutine in the EVM code, where only the effect of the instructions on the state being validated is computed.  Thus the structure of this function is very similar to an EVM interpreter.  This function can also be seen as an acyclic traversal of the directed graph formed by taking instructions as vertices and sequential and branching connections as edges, checking conditions along the way.  The traversal is accomplished via recursion, and cycles are broken by returning when a vertex which has already been visited is reached.  The time complexity of this traversal is &lt;code&gt;O(|E|+|V|)&lt;&#x2F;code&gt;: The sum of the number of edges and number of vertices in the graph.&lt;&#x2F;p&gt;
&lt;p&gt;The basic approach is to call &lt;code&gt;validate_subroutine(i, 0, 0)&lt;&#x2F;code&gt;, for &lt;code&gt;i&lt;&#x2F;code&gt; equal to the first instruction in the EVM code through each &lt;code&gt;BEGINDATA&lt;&#x2F;code&gt; offset.  &lt;code&gt;validate_subroutine()&lt;&#x2F;code&gt; traverses instructions sequentially, recursing when &lt;code&gt;JUMP&lt;&#x2F;code&gt; and &lt;code&gt;JUMPI&lt;&#x2F;code&gt; instructions are encountered.  When a destination is reached that has been visited before it returns, thus breaking cycles.  It returns true if the subroutine is valid, false otherwise.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytecode[code_size]     &#x2F;&#x2F; contains EVM bytecode to validate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    frame_size[code_size ]  &#x2F;&#x2F; is filled with -1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; we validate each subroutine individually, as if at top level&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; * PC is the offset in the code to start validating at&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; * return_pc is the top PC on return stack that RETURNSUB returns to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; * at top level FP = SP = 0 is both the frame size and the stack size&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; * as items are pushed SP get more negative, so the stack size is -SP&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    validate_subroutine(PC, return_pc, SP)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &#x2F;&#x2F; traverse code sequentially, recurse for jumps&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        while true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            instruction = bytecode[PC]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &#x2F;&#x2F; if frame size set we have been here before&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if frame_size[PC] &amp;gt;= 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F;&#x2F; check for constant frame size&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                if instruction is JUMPDEST&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    if -SP != frame_size[PC]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        return false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F;&#x2F; return to break cycle&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                return true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            frame_size[PC] = -SP&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &#x2F;&#x2F; effect of instruction on stack&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            n_removed = removed_items(instructions)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            n_added = added_items(instruction)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &#x2F;&#x2F; check for stack underflow&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if -SP &amp;lt; n_removed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                return false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &#x2F;&#x2F; net effect of removing and adding stack items&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            SP += n_removed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            SP -= n_added&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &#x2F;&#x2F; check for stack overflow&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if -SP &amp;gt; 1024&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                return false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if instruction is STOP, RETURN, or SUICIDE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                return true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &#x2F;&#x2F; violates single entry&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if instruction is BEGINSUB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                 return false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &#x2F;&#x2F; return to top or from recursion to JUMPSUB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if instruction is RETURNSUB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                return true;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if instruction is JUMPSUB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F;&#x2F; check for enough arguments&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                sub_pc = jump_target(PC)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                if -SP &amp;lt; n_args(sub_pc)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    return false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                return true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &#x2F;&#x2F; reset PC to destination of jump&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if instruction is JUMPTO&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                PC = jump_target(PC)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                continue&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &#x2F;&#x2F; recurse to jump to code to validate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if instruction is JUMPIF&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                if not validate_subroutine(jump_target(PC), return_pc, SP)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    return false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &#x2F;&#x2F; advance PC according to instruction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            PC = advance_pc(PC)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &#x2F;&#x2F; check for right number of results&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        if (-SP != n_results(return_pc)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            return false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;appendix-b&quot;&gt;Appendix B&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;evm-analysis&quot;&gt;EVM Analysis&lt;&#x2F;h3&gt;
&lt;p&gt;There is a large and growing ecosystem of researchers, authors, teachers, auditors, and analytic tools--providing software and services focused on the correctness and security of EVM code.  A small sample is given here.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;some-tools&quot;&gt;Some Tools&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;contract-library.com&#x2F;&quot;&gt;Contract Library&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;ethereumj&quot;&gt;EthereumJ&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;exthereum&#x2F;blockchain&quot;&gt;Exthereum&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ether-camp&#x2F;ethereum-harmony&quot;&gt;Harmony&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.pnfsoftware.com&#x2F;blog&#x2F;ethereum-smart-contract-decompiler&#x2F;&quot;&gt;JEB&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ConsenSys&#x2F;mythril&quot;&gt;Mythril&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;eth-sri&#x2F;securify&quot;&gt;Securify&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.skalelabs.com&#x2F;&quot;&gt;Skale&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;status.im&#x2F;&quot;&gt;Status&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;some-papers&quot;&gt;Some Papers&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.google.com&#x2F;url?q=http:&#x2F;&#x2F;fsl.cs.illinois.edu&#x2F;FSL&#x2F;papers&#x2F;2018&#x2F;park-zhang-saxena-daian-rosu-2018-fse&#x2F;park-zhang-saxena-daian-rosu-2018-fse-public.pdf&quot;&gt;A Formal Verification Tool for Ethereum VM Bytecode&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;pirapira&#x2F;eth-isabelle&quot;&gt;A Lem formalization of EVM and some Isabelle&#x2F;HOL proofs&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;eprint.iacr.org&#x2F;2016&#x2F;1007.pdf&quot;&gt;A survey of attacks on Ethereum smart contracts&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.google.com&#x2F;url?q=http:&#x2F;&#x2F;fc17.ifca.ai&#x2F;wtsc&#x2F;Defining%2520the%2520Ethereum%2520Virtual%2520Machine%2520for%2520Interactive%2520Theorem%2520Provers.pdf&quot;&gt;Defining the Ethereum Virtual Machine for Interactive Theorem Provers&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;eth2.0-specs&quot;&gt;Ethereum 2.0 Specifications&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.cs.umd.edu&#x2F;~aseem&#x2F;solidetherplas.pdf&quot;&gt;Formal Verification of Smart Contracts&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;jellopaper.org&#x2F;&quot;&gt;JelloPaper: Human Readable Semantics of EVM in K&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.ideals.illinois.edu&#x2F;items&#x2F;102260&quot;&gt;KEVM: A Complete Semantics of the Ethereum Virtual Machine.&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;eprint.iacr.org&#x2F;2016&#x2F;633.pdf&quot;&gt;Making Smart Contracts Smarter&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;arxiv.org&#x2F;pdf&#x2F;1806.01143.pdf&quot;&gt;Securify: Practical Security Analysis of Smart Contracts&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;docs.thundercore.com&#x2F;thunder-whitepaper.pdf&quot;&gt;The Thunder Protocol&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;trustworthy.systems&#x2F;publications&#x2F;full_text&#x2F;Amani_BBS_18.pdf&quot;&gt;Towards Verifying Ethereum Smart Contract Bytecode in Isabelle&#x2F;HOL&lt;&#x2F;a&gt;
*&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;seed&#x2F;eth-isabelle&#x2F;tree&#x2F;evm15&quot;&gt;A Lem formalization of EVM 1.5&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>ENS support for reverse resolution of Ethereum addresses</title>
        <published>2016-12-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Nick Johnson</name><email>arachnid@notdot.net</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/181/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/181/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:181"
            label="ERC-181" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/181/">&lt;h1 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h1&gt;
&lt;p&gt;This EIP specifies a TLD, registrar, and resolver interface for reverse resolution of Ethereum addresses using ENS. This permits associating a human-readable name with any Ethereum blockchain address. Resolvers can be certain that the reverse record was published by the owner of the Ethereum address in question.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h1&gt;
&lt;p&gt;While name services are mostly used for forward resolution - going from human-readable identifiers to machine-readable ones - there are many use-cases in which reverse resolution is useful as well:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Applications that allow users to monitor accounts benefit from showing the name of an account instead of its address, even if it was originally added by address.&lt;&#x2F;li&gt;
&lt;li&gt;Attaching metadata such as descriptive information to an address allows retrieving this information regardless of how the address was originally discovered.&lt;&#x2F;li&gt;
&lt;li&gt;Anyone can configure a name to resolve to an address, regardless of ownership of that address. Reverse records allow the owner of an address to claim a name as authoritative for that address.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h1 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h1&gt;
&lt;p&gt;Reverse ENS records are stored in the ENS hierarchy in the same fashion as regular records, under a reserved domain, &lt;code&gt;addr.reverse&lt;&#x2F;code&gt;. To generate the ENS name for a given account&#x27;s reverse records, convert the account to hexadecimal representation in lower-case, and append &lt;code&gt;addr.reverse&lt;&#x2F;code&gt;. For instance, the ENS registry&#x27;s address at &lt;code&gt;0x112234455c3a32fd11230c42e7bccd4a84e02010&lt;&#x2F;code&gt; has any reverse records stored at &lt;code&gt;112234455c3a32fd11230c42e7bccd4a84e02010.addr.reverse&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Note that this means that contracts wanting to do dynamic reverse resolution of addresses will need to perform hex encoding in the contract.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;registrar&quot;&gt;Registrar&lt;&#x2F;h2&gt;
&lt;p&gt;The owner of the &lt;code&gt;addr.reverse&lt;&#x2F;code&gt; domain will be a registrar that permits the caller to take ownership of
the reverse record for their own address. It provides the following methods:&lt;&#x2F;p&gt;
&lt;h3 id=&quot;function-claim-address-owner-returns-bytes32-node&quot;&gt;function claim(address owner) returns (bytes32 node)&lt;&#x2F;h3&gt;
&lt;p&gt;When called by account &lt;code&gt;x&lt;&#x2F;code&gt;, instructs the ENS registry to transfer ownership of the name &lt;code&gt;hex(x) + &#x27;.addr.reverse&#x27;&lt;&#x2F;code&gt; to the provided address, and return the namehash of the ENS record thus transferred.&lt;&#x2F;p&gt;
&lt;p&gt;Allowing the caller to specify an owner other than themselves for the relevant node facilitates contracts that need accurate reverse ENS entries delegating this to their creators with a minimum of code inside their constructor:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;reverseRegistrar.claim(msg.sender)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;function-claimwithresolver-address-owner-address-resolver-returns-bytes32-node&quot;&gt;function claimWithResolver(address owner, address resolver) returns (bytes32 node)&lt;&#x2F;h3&gt;
&lt;p&gt;When called by account &lt;code&gt;x&lt;&#x2F;code&gt;, instructs the ENS registry to set the resolver of the name &lt;code&gt;hex(x) + &#x27;.addr.reverse&#x27;&lt;&#x2F;code&gt; to the specified resolver, then transfer ownership of the name to the provided address, and return the namehash of the ENS record thus transferred. This method facilitates setting up a custom resolver and owner in fewer transactions than would be required if calling &lt;code&gt;claim&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;function-setname-string-name-returns-bytes32-node&quot;&gt;function setName(string name) returns (bytes32 node)&lt;&#x2F;h3&gt;
&lt;p&gt;When called by account &lt;code&gt;x&lt;&#x2F;code&gt;, sets the resolver for the name &lt;code&gt;hex(x) + &#x27;.addr.reverse&#x27;&lt;&#x2F;code&gt; to a default resolver, and sets the name record on that name to the specified name. This method facilitates setting up simple reverse records for users in a single transaction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;resolver-interface&quot;&gt;Resolver interface&lt;&#x2F;h2&gt;
&lt;p&gt;A new resolver interface is defined, consisting of the following method:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function name(bytes32 node) constant returns (string);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Resolvers that implement this interface must return a valid ENS name for the requested node, or the empty string if no name is defined for the requested node.&lt;&#x2F;p&gt;
&lt;p&gt;The interface ID of this interface is 0x691f3431.&lt;&#x2F;p&gt;
&lt;p&gt;Future EIPs may specify more record types appropriate to reverse ENS records.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;appendix-1-registrar-implementation&quot;&gt;Appendix 1: Registrar implementation&lt;&#x2F;h1&gt;
&lt;p&gt;This registrar, written in Solidity, implements the specifications outlined above.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pragma solidity ^0.4.10;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;import &amp;quot;.&#x2F;AbstractENS.sol&amp;quot;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;contract Resolver {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function setName(bytes32 node, string name) public;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * @dev Provides a default implementation of a resolver for reverse records,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; * which permits only the owner to update it.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;contract DefaultReverseResolver is Resolver {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    AbstractENS public ens;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    mapping(bytes32=&amp;gt;string) public name;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev Constructor&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param ensAddr The address of the ENS registry.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function DefaultReverseResolver(AbstractENS ensAddr) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ens = ensAddr;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev Only permits calls by the reverse registrar.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param node The node permission is required for.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    modifier owner_only(bytes32 node) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        require(msg.sender == ens.owner(node));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        _;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev Sets the name for a node.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param node The node to update.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param _name The name to set.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function setName(bytes32 node, string _name) public owner_only(node) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        name[node] = _name;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;contract ReverseRegistrar {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; namehash(&amp;#39;addr.reverse&amp;#39;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    AbstractENS public ens;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Resolver public defaultResolver;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev Constructor&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param ensAddr The address of the ENS registry.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param resolverAddr The address of the default reverse resolver.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function ReverseRegistrar(AbstractENS ensAddr, Resolver resolverAddr) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ens = ensAddr;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        defaultResolver = resolverAddr;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev Transfers ownership of the reverse ENS record associated with the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *      calling account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param owner The address to set as the owner of the reverse record in ENS.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @return The ENS node hash of the reverse record.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function claim(address owner) returns (bytes32 node) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return claimWithResolver(owner, 0);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev Transfers ownership of the reverse ENS record associated with the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *      calling account.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param owner The address to set as the owner of the reverse record in ENS.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param resolver The address of the resolver to set; 0 to leave unchanged.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @return The ENS node hash of the reverse record.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function claimWithResolver(address owner, address resolver) returns (bytes32 node) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        var label = sha3HexAddress(msg.sender);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        node = sha3(ADDR_REVERSE_NODE, label);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        var currentOwner = ens.owner(node);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &#x2F;&#x2F; Update the resolver if required&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        if(resolver != 0 &amp;amp;&amp;amp; resolver != ens.resolver(node)) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &#x2F;&#x2F; Transfer the name to us first if it&amp;#39;s not already&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if(currentOwner != address(this)) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                ens.setSubnodeOwner(ADDR_REVERSE_NODE, label, this);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                currentOwner = address(this);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            ens.setResolver(node, resolver);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &#x2F;&#x2F; Update the owner if required&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        if(currentOwner != owner) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            ens.setSubnodeOwner(ADDR_REVERSE_NODE, label, owner);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return node;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev Sets the `name()` record for the reverse ENS record associated with&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * the calling account. First updates the resolver to the default reverse&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * resolver if necessary.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param name The name to set for this address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @return The ENS node hash of the reverse record.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function setName(string name) returns (bytes32 node) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        node = claimWithResolver(this, defaultResolver);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        defaultResolver.setName(node, name);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return node;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev Returns the node hash for a given account&amp;#39;s reverse records.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param addr The address to hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @return The ENS node hash.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function node(address addr) constant returns (bytes32 ret) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return sha3(ADDR_REVERSE_NODE, sha3HexAddress(addr));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @dev An optimised function to compute the sha3 of the lower-case&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *      hexadecimal representation of an Ethereum address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @param addr The address to hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     * @return The SHA3 hash of the lower-case hexadecimal encoding of the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *         input address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function sha3HexAddress(address addr) private returns (bytes32 ret) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        addr; ret; &#x2F;&#x2F; Stop warning us about unused variables&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        assembly {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            let lookup := 0x3031323334353637383961626364656600000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            let i := 40&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        loop:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            i := sub(i, 1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            mstore8(i, byte(and(addr, 0xf), lookup))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            addr := div(addr, 0x10)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            i := sub(i, 1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            mstore8(i, byte(and(addr, 0xf), lookup))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            addr := div(addr, 0x10)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            jumpi(loop, i)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            ret := sha3(0, 40)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Contract code size limit</title>
        <published>2016-11-04T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/170/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/170/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:170"
            label="EIP-170" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/170/">&lt;h3 id=&quot;hard-fork&quot;&gt;Hard fork&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;607&#x2F;&quot;&gt;Spurious Dragon&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;MAX_CODE_SIZE&lt;&#x2F;code&gt;: &lt;code&gt;0x6000&lt;&#x2F;code&gt; (&lt;code&gt;2**14 + 2**13&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;FORK_BLKNUM&lt;&#x2F;code&gt;: 2,675,000&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CHAIN_ID&lt;&#x2F;code&gt;: 1 (Mainnet)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h3&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= FORK_BLKNUM&lt;&#x2F;code&gt;, then if contract creation initialization returns data with length of &lt;strong&gt;more than&lt;&#x2F;strong&gt; &lt;code&gt;MAX_CODE_SIZE&lt;&#x2F;code&gt; bytes, contract creation fails with an out of gas error.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h3&gt;
&lt;p&gt;Currently, there remains one slight quadratic vulnerability in Ethereum: when a contract is called, even though the call takes a constant amount of gas, the call can trigger O(n) cost in terms of reading the code from disk, preprocessing the code for VM execution, and also adding O(n) data to the Merkle proof for the block&#x27;s proof-of-validity. At current gas levels, this is acceptable even if suboptimal. At the higher gas levels that could be triggered in the future, possibly very soon due to dynamic gas limit rules, this would become a greater concern—not nearly as serious as recent denial of service attacks, but still inconvenient especially for future light clients verifying proofs of validity or invalidity. The solution is to put a hard cap on the size of an object that can be saved to the blockchain, and do so non-disruptively by setting the cap at a value slightly higher than what is feasible with current gas limits.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;references&quot;&gt;References&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;EIP-170 issue and discussion: https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;170&lt;&#x2F;li&gt;
&lt;li&gt;pyethereum implementation: https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;pyethereum&#x2F;blob&#x2F;5217294871283d8dc4fb3ca9d8a78c7d416490e8&#x2F;ethereum&#x2F;messages.py#L397&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Initial ENS Hash Registrar</title>
        <published>2016-10-25T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Maurelian</name>
	</author>
	
	<author>
		<name>Nick Johnson </name><email>nick@ethereum.org</email>
	</author>
	
	<author>
		<name>Alex Van de Sande</name><email>avsa@ethereum.org</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/162/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/162/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:162"
            label="ERC-162" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/162/">&lt;h2 id=&quot;contents&quot;&gt;Contents&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Abstract&lt;&#x2F;li&gt;
&lt;li&gt;Motivations&lt;&#x2F;li&gt;
&lt;li&gt;Specification
&lt;ul&gt;
&lt;li&gt;Initial restrictions&lt;&#x2F;li&gt;
&lt;li&gt;Name format for hash registration&lt;&#x2F;li&gt;
&lt;li&gt;Auctioning names&lt;&#x2F;li&gt;
&lt;li&gt;Deeds&lt;&#x2F;li&gt;
&lt;li&gt;Deployment and Upgrade process&lt;&#x2F;li&gt;
&lt;li&gt;Registrar Interface&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Rationale
&lt;ul&gt;
&lt;li&gt;Not committing to a permanent registrar at the outset&lt;&#x2F;li&gt;
&lt;li&gt;Valid names &amp;gt;= 7 characters&lt;&#x2F;li&gt;
&lt;li&gt;Restricting TLD to &lt;code&gt;.eth&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Holding ether as collateral&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Prior work&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;!-- &#x2F;MarkdownTOC --&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This ERC describes the implementation, as deployed to the main ethereum network on 2017-05-04, of a registrar contract to govern the allocation of names in the Ethereum Name Service (ENS). The corresponding source code is &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;ens&#x2F;blob&#x2F;mainnet&#x2F;contracts&#x2F;HashRegistrarSimplified.sol&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;For more background, refer to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;137&#x2F;&quot;&gt;EIP-137&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Registrars are responsible for allocating domain names to users of the system, and are the only entities capable of updating the ENS; the owner of a node in the ENS registry is its registrar. Registrars may be contracts or externally owned accounts, though it is expected that the root and top-level registrars, at a minimum, will be implemented as contracts.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;EIP 137&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;A well designed and governed registrar is essential to the success of the ENS described in EIP 137, but is described separately in this document as it is external to the core ENS protocol.&lt;&#x2F;p&gt;
&lt;p&gt;In order to maximize utility and adoption of a new namespace, the registrar should mitigate speculation and &quot;name squatting&quot;, however the best approach for mitigation is unclear. Thus an &quot;initial&quot; registrar is proposed, which implements a simple approach to name allocation. During the initial period, the available namespace will be significantly restricted to the &lt;code&gt;.eth&lt;&#x2F;code&gt; top level domain, and subdomain shorter than 7 characters in length disallowed. This specification largely describes @alexvandesande and @arachnid&#x27;s &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;ens&#x2F;blob&#x2F;mainnet&#x2F;contracts&#x2F;HashRegistrarSimplified.sol&quot;&gt;hash registrar implementation&lt;&#x2F;a&gt; in order to facilitate discussion.&lt;&#x2F;p&gt;
&lt;p&gt;The intent is to replace the Initial Registrar contract with a permanent registrar contract. The Permanent Registrar will increase the available namespace, and incorporate lessons learned from the performance of the Initial Registrar. This upgrade is expected to take place within approximately 2 years of initial deployment.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivations&quot;&gt;Motivations&lt;&#x2F;h2&gt;
&lt;p&gt;The following factors should be considered in order to optimize for adoption of the ENS, and good governance of the Initial Registrar&#x27;s namespace.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Upgradability:&lt;&#x2F;strong&gt; The Initial Registrar should be safely upgradeable, so that knowledge gained during its deployment can be used to replace it with an improved and permanent registrar.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Effective allocation:&lt;&#x2F;strong&gt; Newly released namespaces often create a land grab situation, resulting in many potentially valuable names being purchased but unused, with the hope of re-selling at a profit. This reduces the availability of the most useful names, in turn decreasing the utility of the name service to end users.&lt;&#x2F;p&gt;
&lt;p&gt;Achieving an effective allocation may or may not require human intervention for dispute resolution and other forms of curation. The Initial Registrar should not aim to create to most effective possible allocation, but instead limit the cost of misallocation in the long term.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Security:&lt;&#x2F;strong&gt; The registrar will hold a balance of ether without an explicit limit. It must be designed securely.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Simplicity:&lt;&#x2F;strong&gt; The ENS specification itself emphasizes a separation of concerns, allowing the most essential element, the registry to be as simple as possible. The interim registrar in turn should be as simple as possible while still meeting its other design goals.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Adoption:&lt;&#x2F;strong&gt; Successful standards become more successful due to network effects. The registrar should consider what strategies will encourage the adoption of the ENS in general, and the namespace it controls in particular.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;initial-restrictions&quot;&gt;Initial restrictions&lt;&#x2F;h3&gt;
&lt;p&gt;The Initial Registrar is expected to be in service for approximately two years, prior to upgrading. This should be sufficient time to learn, observe, and design an updated system.&lt;&#x2F;p&gt;
&lt;p&gt;During the initial two year period, the available name space will be restricted to the &lt;code&gt;.eth&lt;&#x2F;code&gt; TLD.&lt;&#x2F;p&gt;
&lt;p&gt;This restriction is enforced by the owner of the ENS root node who should not assign any nodes other than &lt;code&gt;.eth&lt;&#x2F;code&gt; to the Initial Registrar. The ENS&#x27;s root node should be controlled by multiple parties using a multisig contract.&lt;&#x2F;p&gt;
&lt;p&gt;The Initial Registrar will also prohibit registration of names 6 characters or less in length.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;name-format-for-hash-registration&quot;&gt;Name format for hash registration&lt;&#x2F;h3&gt;
&lt;p&gt;Names submitted to the initial registrar must be hashed using Ethereum&#x27;s sha3 function. Note that the hashes submitted to the registrar are the hash of the subdomain label being registered, not the namehash as defined in EIP 137.&lt;&#x2F;p&gt;
&lt;p&gt;For example, in order to register &lt;code&gt;abcdefg.eth&lt;&#x2F;code&gt;, one should submit &lt;code&gt;sha3(&#x27;abcdefg&#x27;)&lt;&#x2F;code&gt;, not &lt;code&gt;sha3(sha3(0, &#x27;eth&#x27;), &#x27;abcdefg&#x27;)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;auctioning-names&quot;&gt;Auctioning names&lt;&#x2F;h3&gt;
&lt;p&gt;The registrar will allocate the available names through a Vickrey auction:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;A Vickrey auction is a type of sealed-bid auction. Bidders submit written bids without knowing the bid of the other people in the auction. The highest bidder wins but the price paid is the second-highest bid. This type of auction... gives bidders an incentive to bid their true value.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Vickrey_auction&quot;&gt;Vickrey Auction, Wikipedia&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;The auction lifecycle of a name has 5 possible states, or Modes.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Not-yet-available:&lt;&#x2F;strong&gt; The majority of names will be initially unavailable for auction, and will become available some time during the 8 weeks after launch.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Open:&lt;&#x2F;strong&gt; The earliest availability for a name is determined by the most significant byte of its sha3 hash. &lt;code&gt;0x00&lt;&#x2F;code&gt; would become available immediately, &lt;code&gt;0xFF&lt;&#x2F;code&gt; would become available after 8 weeks, and the availability of other names is distributed accordingly. Once a name is available, it is possible to start an auction on it.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Auction:&lt;&#x2F;strong&gt; Once the auction for a name has begun, there is a 72 hour bidding period. Bidders must submit a payment of ether, along with sealed bids as a hash of &lt;code&gt;sha3(bytes32 hash, address owner, uint value, bytes32 salt)&lt;&#x2F;code&gt;. The bidder may obfuscate the true bid value by sending a greater amount of ether.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Reveal:&lt;&#x2F;strong&gt; After the bidding period, a 48 hour reveal period commences. During this time, bidders must reveal the true parameters of their sealed bid. As bids are revealed, ether payments are returned according to the schedule of &quot;refund ratios&quot; outlined in the table below. If no bids are revealed, the name will return to the Open state.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Owned:&lt;&#x2F;strong&gt; After the reveal period has finished, the winning bidder must submit a transaction to finalize the auction, which then calls the ENS&#x27;s &lt;code&gt;setSubnodeOwner&lt;&#x2F;code&gt; function, recording the winning bidder&#x27;s address as the owner of the hash of the name.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The following table outlines important parameters which define the Registrar&#x27;s auction mechanism.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;registrar-parameters&quot;&gt;Registrar Parameters&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;totalAuctionLength&lt;&#x2F;td&gt;&lt;td&gt;The full time period from start of auction to end of the reveal period.&lt;&#x2F;td&gt;&lt;td&gt;5 days&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;revealPeriod&lt;&#x2F;td&gt;&lt;td&gt;The length of the time period during which bidding is no longer allowed, and bids must be revealed.&lt;&#x2F;td&gt;&lt;td&gt;48 hours&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;launchLength&lt;&#x2F;td&gt;&lt;td&gt;The time period during which all names will become available for auction.&lt;&#x2F;td&gt;&lt;td&gt;8 weeks&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;minPrice&lt;&#x2F;td&gt;&lt;td&gt;The minimum amount of ether which must be locked up in exchange for ownership of a name.&lt;&#x2F;td&gt;&lt;td&gt;0.01 ether&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;deeds&quot;&gt;Deeds&lt;&#x2F;h3&gt;
&lt;p&gt;The Initial Registrar contract does not hold a balance itself. All ether sent to the Registrar will be held in a separate &lt;code&gt;Deed&lt;&#x2F;code&gt; contracts. A deed contract is first created and funded when a sealed bid is submitted. After an auction is completed and a hash is registered, the deed for the winning bid is held in exchange for ownership of the hash. Non-winning bids are refunded.&lt;&#x2F;p&gt;
&lt;p&gt;A deed for an owned name may be transferred to another account by its owner, thus transferring ownership and control of the name.&lt;&#x2F;p&gt;
&lt;p&gt;After 1 year of registration, the owner of a hash may choose to relinquish ownership and have the value of the deed returned to them.&lt;&#x2F;p&gt;
&lt;p&gt;Deeds for non-winning bids can be closed by various methods, at which time any ether held will either be returned to the bidder, burnt, or sent to someone else as a reward for actions which help the registrar.&lt;&#x2F;p&gt;
&lt;p&gt;The following table outlines what portion of the balance held in a deed contract will be returned upon closure, and to whom. The remaining balance will be burnt.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;refund-schedule&quot;&gt;Refund schedule&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Reason for Deed closure&lt;&#x2F;th&gt;&lt;th&gt;Refund Recipient&lt;&#x2F;th&gt;&lt;th&gt;Refund Percentage&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;A valid non-winning bid is revealed.&lt;&#x2F;td&gt;&lt;td&gt;Bidder&lt;&#x2F;td&gt;&lt;td&gt;99.5%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;A bid submitted after the auction period is revealed.&lt;&#x2F;td&gt;&lt;td&gt;Bidder&lt;&#x2F;td&gt;&lt;td&gt;99.5%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;An otherwise valid bid is revealed on an owned name. &lt;sup&gt;1&lt;&#x2F;sup&gt;&lt;&#x2F;td&gt;&lt;td&gt;Bidder&lt;&#x2F;td&gt;&lt;td&gt;0.5%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;An expired sealed bid is cancelled. &lt;sup&gt;2&lt;&#x2F;sup&gt;&lt;&#x2F;td&gt;&lt;td&gt;Canceler&lt;&#x2F;td&gt;&lt;td&gt;0.5%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;A registered hash is reported as invalid. &lt;sup&gt;3&lt;&#x2F;sup&gt;&lt;&#x2F;td&gt;&lt;td&gt;Reporter&lt;&#x2F;td&gt;&lt;td&gt;50%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;A registered hash is reported as invalid. &lt;sup&gt;3&lt;&#x2F;sup&gt;&lt;&#x2F;td&gt;&lt;td&gt;Owner&lt;&#x2F;td&gt;&lt;td&gt;50%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h5 id=&quot;notes&quot;&gt;Notes:&lt;&#x2F;h5&gt;
&lt;ol&gt;
&lt;li&gt;This incentivizes all bids to be revealed in time. If bids could be revealed late, an extortion attack on the current highest bidder could be made by threatening to reveal a new second highest bid.&lt;&#x2F;li&gt;
&lt;li&gt;A bid which remains sealed after more than 2 weeks and 5 days may be cancelled by anyone to collect a small reward.&lt;&#x2F;li&gt;
&lt;li&gt;Since names are hashed before auctioning and registration, the Initial Registrar is unable to enforce character length restrictions independently. A reward is therefore provided for reporting invalid names.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;deployment-and-upgrade-process&quot;&gt;Deployment and Upgrade process&lt;&#x2F;h3&gt;
&lt;p&gt;The Initial Registrar requires the ENS&#x27;s address as a constructor, and should be deployed after the ENS. The multisig account owning the root node in the ENS should then set the Initial Registrar&#x27;s address as owner of the &lt;code&gt;eth&lt;&#x2F;code&gt; node.&lt;&#x2F;p&gt;
&lt;p&gt;The Initial Registrar is expected to be replaced by a Permanent Registrar approximately 2 years after deployment. The following process should be used for the upgrade:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The Permanent Registrar contract will be deployed.&lt;&#x2F;li&gt;
&lt;li&gt;The multisig account owning the root node in the ENS will assign ownership of the &lt;code&gt;.eth&lt;&#x2F;code&gt; node to the Permanent Registrar.&lt;&#x2F;li&gt;
&lt;li&gt;Owners of hashes in the Initial Registrar will be responsible for registering their deeds to the Permanent Registrar. A couple options are considered here:
&lt;ol&gt;
&lt;li&gt;Require owners to transfer their ownership prior to a cutoff date in order to maintain ownership and&#x2F;or continue name resolution services.&lt;&#x2F;li&gt;
&lt;li&gt;Have the Permanent Registrar query the Initial Registrar for ownership if it is lacking an entry.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;planned-deactivation&quot;&gt;Planned deactivation&lt;&#x2F;h3&gt;
&lt;p&gt;In order to limit dependence on the Initial Registrar, new auctions will stop after 4 years, and all ether held in deeds after 8 years will become unreachable.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;registrar-interface&quot;&gt;Registrar Interface&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;function state(bytes32 _hash) constant returns (Mode)&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Implements a state machine returning the current state of a name&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;code&gt;function entries(bytes32 _hash) constant returns (Mode, address, uint, uint, uint)&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Returns the following information regarding a registered name:
&lt;ul&gt;
&lt;li&gt;state&lt;&#x2F;li&gt;
&lt;li&gt;deed address&lt;&#x2F;li&gt;
&lt;li&gt;registration date&lt;&#x2F;li&gt;
&lt;li&gt;balance of the deed&lt;&#x2F;li&gt;
&lt;li&gt;highest value bid at auction&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;code&gt;function getAllowedTime(bytes32 _hash) constant returns (uint timestamp)&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Returns the time at which the hash will no longer be in the initial &lt;code&gt;not-yet-available&lt;&#x2F;code&gt; state.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;code&gt;function isAllowed(bytes32 _hash, uint _timestamp) constant returns (bool allowed)&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Takes a hash and a time, returns true if and only if it has passed the initial &lt;code&gt;not-yet-available&lt;&#x2F;code&gt; state.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;code&gt;function startAuction(bytes32 _hash);&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Moves the state of a hash from Open to Auction. Throws if state is not Open.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;code&gt;function startAuctions(bytes32[] _hashes);&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Starts multiple auctions on an array of hashes. This enables someone to open up an auction for a number of dummy hashes when they are only really interested in bidding for one. This will increase the cost for an attacker to simply bid blindly on all new auctions. Dummy auctions that are open but not bid on are closed after a week.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;code&gt;function shaBid(bytes32 hash, address owner, uint value, bytes32 salt) constant returns (bytes32 sealedBid);&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Takes the parameters of a bid, and returns the sealedBid hash value required to participate in the bidding for an auction. This obfuscates the parameters in order to mimic the mechanics of placing a bid in an envelope.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;code&gt;function newBid(bytes32 sealedBid);&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Bids are sent by sending a message to the main contract with a sealedBid hash and an amount of ether. The hash contains information about the bid, including the bidded name hash, the bid value, and a random salt. Bids are not tied to any one auction until they are revealed. The value of the bid itself can be masqueraded by sending more than the value of your actual bid. This is followed by a 48h reveal period. Bids revealed after this period will be burned and the ether unrecoverable. Since this is an auction, it is expected that most public hashes, like known domains and common dictionary  words, will have multiple bidders pushing the price up.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;code&gt;function startAuctionsAndBid(bytes32[] hashes, bytes32 sealedBid)&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A utility function allowing a call to &lt;code&gt;startAuctions&lt;&#x2F;code&gt; followed by &lt;code&gt;newBid&lt;&#x2F;code&gt; in a single transaction.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;code&gt;function unsealBid(bytes32 _hash, address _owner, uint _value, bytes32 _salt);&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Once the bidding period is completed, there is a reveal period during with the properties of a bid are submitted to reveal them. The registrar hashes these properties using the &lt;code&gt;shaBid()&lt;&#x2F;code&gt; function above to verify that they match a pre-existing sealed bid. If the unsealedBid is the new best bid, the old best bid is returned to its bidder.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;code&gt;function cancelBid(bytes32 seal);&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Cancels an unrevealed bid according to the rules described in the notes on the refund schedule above.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;code&gt;function finalizeAuction(bytes32 _hash);&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;After the registration date has passed, this function can be called to finalize the auction, which then calls the ENS function &lt;code&gt;setSubnodeOwner()&lt;&#x2F;code&gt;  updating the ENS record to set the winning bidder as owner of the node.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;function transfer(bytes32 _hash, address newOwner);&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Update the owner of the ENS node corresponding to the submitted hash to a new owner. This function must be callable only by the current owner.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;code&gt;function releaseDeed(bytes32 _hash);&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;After some time, the owner can release the property and get their ether back.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;code&gt;function invalidateName(string unhashedName);&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Since registration is done on the hash of a name, the registrar itself cannot validate names. This function can be used to report a name which is 6 characters long or less. If it has been registered, the submitter will earn 10% of the deed value. We are purposefully handicapping the simplified registrar as a way to force it into being restructured in a few years.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;code&gt;function eraseNode(bytes32[] labels)&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Allows anyone to delete the owner and resolver records for a subdomain of a name that is not currently owned in the registrar. For instance, to zero &lt;code&gt;foo.bar.eth&lt;&#x2F;code&gt; on a registrar that owns &lt;code&gt;.eth&lt;&#x2F;code&gt;, pass an array containing &lt;code&gt;[sha3(&#x27;foo&#x27;), sha3(&#x27;bar&#x27;)]&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;code&gt;function transferRegistrars(bytes32 _hash) onlyOwner(_hash);&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Used during the upgrade process to a permanent registrar. If this registrar is no longer the owner of the its root node in the ENS, this function will transfers the deed to the current owner, which should be a new registrar. This function throws if this registrar still owns its root node.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;starting-with-a-temporary-registrar&quot;&gt;Starting with a temporary registrar&lt;&#x2F;h3&gt;
&lt;p&gt;Anticipating and designing for all the potential issues of name allocation names is unlikely to succeed. This approach chooses not to be concerned with getting it perfect, but allows us to observe and learn with training wheels on, and implement improvements before expanding the available namespace to shorter names or another TLD.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;valid-names-7-characters&quot;&gt;Valid names &amp;gt;= 7 characters&lt;&#x2F;h3&gt;
&lt;p&gt;Preserving the shortest, and often most valuable, domain names for the upgraded registrar provides the opportunity to implement processes for dispute resolution (assuming they are found to be necessary).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;delayed-release-of-names&quot;&gt;Delayed release of names&lt;&#x2F;h3&gt;
&lt;p&gt;A slower release allows for extra time to identify, and address any issues which may arise after launch.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;restricting-tld-to-eth&quot;&gt;Restricting TLD to &lt;code&gt;.eth&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Choosing a single TLD helps to maximize network effects by focusing on one namespace.&lt;&#x2F;p&gt;
&lt;p&gt;A three letter TLD is a pattern made familiar by it&#x27;s common usage in internet domain names. This familiarity significantly increases the potential of the ENS to be integrated into pre-existing DNS systems, and reserved as a &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.iana.org&#x2F;assignments&#x2F;special-use-domain-names&#x2F;special-use-domain-names.xhtml#special-use-domain&quot;&gt;special-use domain name&lt;&#x2F;a&gt;.  A recent precedent for this is the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;tools.ietf.org&#x2F;html&#x2F;rfc7686&quot;&gt;reservation of the &lt;code&gt;.onion&lt;&#x2F;code&gt; domain&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;holding-ether-as-collateral&quot;&gt;Holding ether as collateral&lt;&#x2F;h3&gt;
&lt;p&gt;This approach is simpler than the familiar model of requiring owners to make recurring payments to retain ownership of a domain name. It also makes the initial registrar a revenue neutral service.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;prior-work&quot;&gt;Prior work&lt;&#x2F;h2&gt;
&lt;p&gt;This document borrows heavily from several sources:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;137&#x2F;&quot;&gt;EIP-137&lt;&#x2F;a&gt; outlines the initial implementation of the Registry Contract (ENS.sol) and associated Resolver contracts.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;26&quot;&gt;ERC-26&lt;&#x2F;a&gt; was the first ERC to propose a name service at the contract layer&lt;&#x2F;li&gt;
&lt;li&gt;@alexvandesande&#x27;s current implementation of the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;ens&#x2F;blob&#x2F;mainnet&#x2F;contracts&#x2F;HashRegistrarSimplified.sol&quot;&gt;HashRegistrar&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;edits&quot;&gt;Edits:&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;2016-10-26 Added link Alex&#x27;s design in abstract&lt;&#x2F;li&gt;
&lt;li&gt;2016-11-01 change &#x27;Planned deactivation&#x27; to h3&#x27;&lt;&#x2F;li&gt;
&lt;li&gt;2017-03-13 Update timelines for bidding and reveal periods&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>State trie clearing (invariant-preserving alternative)</title>
        <published>2016-10-24T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Gavin Wood</name><uri>https://github.com/gavofyork</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/161/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/161/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:161"
            label="EIP-161" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/161/">&lt;h3 id=&quot;hard-fork&quot;&gt;Hard fork&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;607&#x2F;&quot;&gt;Spurious Dragon&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;FORK_BLKNUM&lt;&#x2F;code&gt;: 2,675,000&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CHAIN_ID&lt;&#x2F;code&gt;: 1 (Mainnet)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h3&gt;
&lt;p&gt;a. Account creation transactions and the &lt;code&gt;CREATE&lt;&#x2F;code&gt; operation SHALL, prior to the execution of the initialisation code, &lt;strong&gt;increment&lt;&#x2F;strong&gt; the &lt;strong&gt;nonce&lt;&#x2F;strong&gt; over and above its normal starting value by &lt;strong&gt;one&lt;&#x2F;strong&gt; (for normal networks, this will be simply 1, however test-nets with non-zero default starting nonces will be different).&lt;&#x2F;p&gt;
&lt;p&gt;b. Whereas &lt;code&gt;CALL&lt;&#x2F;code&gt; and &lt;code&gt;SUICIDE&lt;&#x2F;code&gt; would charge 25,000 gas when the destination is non-existent, now the charge SHALL &lt;strong&gt;only&lt;&#x2F;strong&gt; be levied if the operation transfers &lt;strong&gt;more than zero value&lt;&#x2F;strong&gt; and the destination account is &lt;em&gt;dead&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;c. No account may &lt;em&gt;change state&lt;&#x2F;em&gt; from non-existent to existent-but-&lt;em&gt;empty&lt;&#x2F;em&gt;. If an operation would do this, the account SHALL instead remain non-existent.&lt;&#x2F;p&gt;
&lt;p&gt;d. &lt;em&gt;At the end of the transaction&lt;&#x2F;em&gt;, any account &lt;em&gt;touched&lt;&#x2F;em&gt; by the execution of that transaction which is now &lt;em&gt;empty&lt;&#x2F;em&gt; SHALL instead become non-existent (i.e. &lt;strong&gt;deleted&lt;&#x2F;strong&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;Where:&lt;&#x2F;p&gt;
&lt;p&gt;An account is considered to be &lt;em&gt;touched&lt;&#x2F;em&gt; when it is involved in any potentially &lt;em&gt;state-changing&lt;&#x2F;em&gt; operation. This includes, but is not limited to, being the recipient of a &lt;strong&gt;transfer of zero value&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;An account is considered &lt;em&gt;empty&lt;&#x2F;em&gt; when it has &lt;strong&gt;no code&lt;&#x2F;strong&gt; and &lt;strong&gt;zero nonce&lt;&#x2F;strong&gt; and &lt;strong&gt;zero balance&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;An account is considered &lt;em&gt;dead&lt;&#x2F;em&gt; when either it is non-existent or it is &lt;em&gt;empty&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;At the end of the transaction&lt;&#x2F;em&gt; is immediately following the execution of the suicide list, prior to the determination of the state trie root for receipt population.&lt;&#x2F;p&gt;
&lt;p&gt;An account &lt;em&gt;changes state&lt;&#x2F;em&gt; when:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;it is the target or refund of a &lt;code&gt;SUICIDE&lt;&#x2F;code&gt; operation for &lt;strong&gt;zero or more&lt;&#x2F;strong&gt; value;&lt;&#x2F;li&gt;
&lt;li&gt;it is the source or destination of a &lt;code&gt;CALL&lt;&#x2F;code&gt; operation or message-call transaction transferring &lt;strong&gt;zero or more&lt;&#x2F;strong&gt; value;&lt;&#x2F;li&gt;
&lt;li&gt;it is the source or creation of a &lt;code&gt;CREATE&lt;&#x2F;code&gt; operation or contract-creation transaction endowing &lt;strong&gt;zero or more&lt;&#x2F;strong&gt; value;&lt;&#x2F;li&gt;
&lt;li&gt;as the block author (&quot;miner&quot;) it is the recipient of block-rewards or transaction-fees of &lt;strong&gt;zero or more&lt;&#x2F;strong&gt; value.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;notes&quot;&gt;Notes&lt;&#x2F;h4&gt;
&lt;p&gt;In the present Ethereum protocol, it should be noted that very few state changes can ultimately result in accounts that are empty following the execution of the transaction. In fact there are only four contexts that current implementations need track:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;an empty account has zero value transferred to it through &lt;code&gt;CALL&lt;&#x2F;code&gt;;&lt;&#x2F;li&gt;
&lt;li&gt;an empty account has zero value transferred to it through &lt;code&gt;SUICIDE&lt;&#x2F;code&gt;;&lt;&#x2F;li&gt;
&lt;li&gt;an empty account has zero value transferred to it through a message-call transaction;&lt;&#x2F;li&gt;
&lt;li&gt;an empty account has zero value transferred to it through a zero-gas-price fees transfer.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h3&gt;
&lt;p&gt;Same as #158 except that several edge cases are avoided since we do not break invariants:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;del&gt;that an account can go from having code and storage to not having code or storage mid-way through the execution of a transaction;&lt;&#x2F;del&gt; [corrected]&lt;&#x2F;li&gt;
&lt;li&gt;that a newly created account cannot be deleted prior to being deployed.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;code&gt;CREATE&lt;&#x2F;code&gt; avoids zero in the nonce to avoid any suggestion of the oddity of &lt;code&gt;CREATE&lt;&#x2F;code&gt;d accounts being reaped half-way through their creation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;addendum-2017-08-15&quot;&gt;Addendum (2017-08-15)&lt;&#x2F;h3&gt;
&lt;p&gt;On 2016-11-24, a consensus bug occurred due to two implementations having different behavior in the case of state reverts.[3] The specification was amended to clarify that empty account deletions are reverted when the state is reverted.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;references&quot;&gt;References&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;EIP-158 issue and discussion: https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;158&lt;&#x2F;li&gt;
&lt;li&gt;EIP-161 issue and discussion: https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;161&lt;&#x2F;li&gt;
&lt;li&gt;https:&#x2F;&#x2F;blog.ethereum.org&#x2F;2016&#x2F;11&#x2F;25&#x2F;security-alert-11242016-consensus-bug-geth-v1-4-19-v1-5-2&#x2F;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;blockquote&gt;
&lt;p&gt;Details: Geth was failing to revert empty account deletions when the transaction causing the deletions of empty accounts ended with an out-of-gas exception. An additional issue was found in Parity, where the Parity client incorrectly failed to revert empty account deletions in a more limited set of contexts involving out-of-gas calls to precompiled contracts; the new Geth behavior matches Parity’s, and empty accounts will cease to be a source of concern in general in about one week once the state clearing process finishes.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EXP cost increase</title>
        <published>2016-10-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/160/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/160/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:160"
            label="EIP-160" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/160/">&lt;h3 id=&quot;hard-fork&quot;&gt;Hard fork&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;607&#x2F;&quot;&gt;Spurious Dragon&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;FORK_BLKNUM&lt;&#x2F;code&gt;: 2,675,000&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CHAIN_ID&lt;&#x2F;code&gt;: 1&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h3&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= FORK_BLKNUM&lt;&#x2F;code&gt;, increase the gas cost of EXP from 10 + 10 per byte in the exponent to 10 + 50 per byte in the exponent.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h3&gt;
&lt;p&gt;Benchmarks suggest that EXP is currently underpriced by a factor of about 4–8.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;references&quot;&gt;References&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;EIP-160 issue and discussion: https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;160&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>State clearing</title>
        <published>2016-10-16T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/158/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/158/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:158"
            label="EIP-158" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/158/">&lt;h1 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h1&gt;
&lt;p&gt;For all blocks where &lt;code&gt;block.number &amp;gt;= FORK_BLKNUM&lt;&#x2F;code&gt; (TBA):&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;In all cases where a state change is made to an account, and this state change results in the account state being saved with nonce = 0, balance = 0, code empty, storage empty (hereinafter &quot;empty account&quot;), the account is instead deleted.&lt;&#x2F;li&gt;
&lt;li&gt;If an address is &quot;touched&quot; and that address contains an empty account, then it is deleted. A &quot;touch&quot; is defined as any situation where if the account at the given address were nonexistent it would be created.&lt;&#x2F;li&gt;
&lt;li&gt;Whenever the EVM checks if an account exists, emptiness is treated as equivalent to nonexistence. Particularly, note that this implies that, once this change is enabled, there is no longer a meaningful difference between emptiness and nonexistence from the point of view of EVM execution.&lt;&#x2F;li&gt;
&lt;li&gt;Zero-value calls and zero-value suicides no longer consume the 25000 account creation gas cost in any circumstance&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The cases where a &quot;touch&quot; takes place can be enumerated as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Zero-value-bearing CALLs&lt;&#x2F;li&gt;
&lt;li&gt;CREATEs (if the code that is ultimately saved is empty and there is no ether remaining in the account when it is saved)&lt;&#x2F;li&gt;
&lt;li&gt;Zero-value-bearing SUICIDEs&lt;&#x2F;li&gt;
&lt;li&gt;Transaction recipients&lt;&#x2F;li&gt;
&lt;li&gt;Contracts created in contract creation transactions&lt;&#x2F;li&gt;
&lt;li&gt;Miners receiving transaction fees (note the case where the gasprice is zero, and the account does not yet exist because it only receives the block&#x2F;uncle&#x2F;nephew rewards &lt;em&gt;after&lt;&#x2F;em&gt; processing every transaction)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;specification-1b&quot;&gt;Specification (1b)&lt;&#x2F;h3&gt;
&lt;p&gt;When the EVM checks for emptiness (for the purpose of possibly applying the 25000 gas cost), emptiness is defined by &lt;code&gt;is_empty(acct): return get_balance(acct) == 0 and get_code(acct) == &quot;&quot; and get_nonce(acct) == 0&lt;&#x2F;code&gt;; emptiness of storage does not matter. This simplifies client implementation because there is no need to add extra complexity to make caches enumerable in the correct way and does not significantly affect the intended result, as the cases where balance&#x2F;code&#x2F;nonce are empty but storage is nonempty where this change would lead to an extra 25000 gas being paid are pathological and have no real use value.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;specification-1c&quot;&gt;Specification (1c)&lt;&#x2F;h3&gt;
&lt;p&gt;Do not implement point 2 above (ie. no new empty accounts can be created, but existing ones are not automatically destroyed unless their state is actually &lt;em&gt;changed&lt;&#x2F;em&gt;). Instead, during each block starting from (and including) N and ending when there are no null accounts left, select the 1000 null accounts that are left-most in order of sha3(address), and delete them (ordering by hash is necessary so as to allow the accounts to be easily found by iterating the tree).&lt;&#x2F;p&gt;
&lt;h1 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h1&gt;
&lt;p&gt;This removes a large number of empty accounts that have been put in the state at very low cost due to flaws in earlier versions of the Ethereum protocol, thereby greatly reducing state size and hence both reducing the hard disk load of a full client and reducing the time for a fast sync. Additionally, it simplifies the protocol in the long term, as once all &quot;empty&quot; objects are cleared out there is no longer any meaningful distinction between an account being empty and being nonexistent, and indeed one can simply view nonexistence as a compact representation of emptiness.&lt;&#x2F;p&gt;
&lt;p&gt;Note that this proposal does introduce a &lt;strong&gt;temporary&lt;&#x2F;strong&gt; breaking of existing guarantees, in that by repeatedly zero-value-calling already existing empty accounts one can create a state change at a cost of 700 gas per account instead of the usual 5000 per gas minimum (with SUICIDE refunds this goes down further to 350 gas per account). Allowing such a large number of state writes per block will lead to heightened block processing times and increase uncle rates in the short term while the existing empty accounts are being cleared, and eventually once all empty accounts are cleared this issue will no longer exist.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;references&quot;&gt;References&lt;&#x2F;h1&gt;
&lt;ol&gt;
&lt;li&gt;EIP-158 issue and discussion: https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;158&lt;&#x2F;li&gt;
&lt;li&gt;EIP-161 issue and discussion: https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;161&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Simple replay attack protection</title>
        <published>2016-10-14T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/155/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/155/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:155"
            label="EIP-155" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/155/">&lt;h3 id=&quot;hard-fork&quot;&gt;Hard fork&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;607&#x2F;&quot;&gt;Spurious Dragon&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;FORK_BLKNUM&lt;&#x2F;code&gt;: 2,675,000&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CHAIN_ID&lt;&#x2F;code&gt;: 1 (main net)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h3&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= FORK_BLKNUM&lt;&#x2F;code&gt; and &lt;code&gt;CHAIN_ID&lt;&#x2F;code&gt; is available, then when computing the hash of a transaction for the purposes of signing, instead of hashing only six rlp encoded elements &lt;code&gt;(nonce, gasprice, startgas, to, value, data)&lt;&#x2F;code&gt;, you &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; hash nine rlp encoded elements &lt;code&gt;(nonce, gasprice, startgas, to, value, data, chainid, 0, 0)&lt;&#x2F;code&gt;.  If you do, then the &lt;code&gt;v&lt;&#x2F;code&gt; of the signature &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be set to &lt;code&gt;{0,1} + CHAIN_ID * 2 + 35&lt;&#x2F;code&gt; where &lt;code&gt;{0,1}&lt;&#x2F;code&gt; is the parity of the &lt;code&gt;y&lt;&#x2F;code&gt; value of the curve point for which &lt;code&gt;r&lt;&#x2F;code&gt; is the x-value in the secp256k1 signing process.  If you choose to only hash 6 values, then &lt;code&gt;v&lt;&#x2F;code&gt; continues to be set to &lt;code&gt;{0,1} + 27&lt;&#x2F;code&gt; as previously.&lt;&#x2F;p&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= FORK_BLKNUM&lt;&#x2F;code&gt; and &lt;code&gt;v = CHAIN_ID * 2 + 35&lt;&#x2F;code&gt; or &lt;code&gt;v = CHAIN_ID * 2 + 36&lt;&#x2F;code&gt;, then when computing the hash of a transaction for purposes of recovering, instead of hashing six rlp encoded elements &lt;code&gt;(nonce, gasprice, startgas, to, value, data)&lt;&#x2F;code&gt;, hash nine rlp encoded elements &lt;code&gt;(nonce, gasprice, startgas, to, value, data, chainid, 0, 0)&lt;&#x2F;code&gt;. The currently existing signature scheme using &lt;code&gt;v = 27&lt;&#x2F;code&gt; and &lt;code&gt;v = 28&lt;&#x2F;code&gt; remains valid and continues to operate under the same rules as it did previously.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;example&quot;&gt;Example&lt;&#x2F;h3&gt;
&lt;p&gt;Consider a transaction with &lt;code&gt;nonce = 9&lt;&#x2F;code&gt;, &lt;code&gt;gasprice = 20 * 10**9&lt;&#x2F;code&gt;, &lt;code&gt;startgas = 21000&lt;&#x2F;code&gt;, &lt;code&gt;to = 0x3535353535353535353535353535353535353535&lt;&#x2F;code&gt;, &lt;code&gt;value = 10**18&lt;&#x2F;code&gt;, &lt;code&gt;data=&#x27;&#x27;&lt;&#x2F;code&gt; (empty).&lt;&#x2F;p&gt;
&lt;p&gt;The &quot;signing data&quot; becomes:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xec098504a817c800825208943535353535353535353535353535353535353535880de0b6b3a764000080018080&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &quot;signing hash&quot; becomes:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xdaf5a779ae972f972197303d7b574746c7ef83eadac0f2791ad23db92e4c8e53&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;If the transaction is signed with the private key &lt;code&gt;0x4646464646464646464646464646464646464646464646464646464646464646&lt;&#x2F;code&gt;, then the v,r,s values become:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(37, 18515461264373351373200002665853028612451056578545711640558177340181847433846, 46948507304638947509940763649030358759909902576025900602547168820602576006531)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Notice the use of 37 instead of 27. The signed tx would become:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xf86c098504a817c800825208943535353535353535353535353535353535353535880de0b6b3a76400008025a028ef61340bd939bc2195fe537567866003e1a15d3c71ff63e1590620aa636276a067cbe9d8997f761aecb703304b3800ccf555c9f3dc64214b297fb1966a3b6d83&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h3&gt;
&lt;p&gt;This would provide a way to send transactions that work on Ethereum without working on ETC or the Morden testnet. ETC is encouraged to adopt this EIP but replacing &lt;code&gt;CHAIN_ID&lt;&#x2F;code&gt; with a different value, and all future testnets, consortium chains and alt-etherea are encouraged to adopt this EIP replacing &lt;code&gt;CHAIN_ID&lt;&#x2F;code&gt; with a unique value.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;list-of-chain-id-s&quot;&gt;List of Chain ID&#x27;s:&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;code&gt;CHAIN_ID&lt;&#x2F;code&gt;&lt;&#x2F;th&gt;&lt;th&gt;Chain(s)&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;Ethereum mainnet&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;Morden (disused), Expanse mainnet&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;Ropsten&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;4&lt;&#x2F;td&gt;&lt;td&gt;Rinkeby&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;td&gt;Goerli&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;42&lt;&#x2F;td&gt;&lt;td&gt;Kovan&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;1337&lt;&#x2F;td&gt;&lt;td&gt;Geth private chains (default)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Find more chain ID&#x27;s on &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;chainid.network&quot;&gt;chainid.network&lt;&#x2F;a&gt; and contribute to &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum-lists&#x2F;chains&quot;&gt;ethereum-lists&#x2F;chains&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Add BLAKE2 compression function `F` precompile</title>
        <published>2016-10-04T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Tjaden Hess</name><email>tah83@cornell.edu</email>
	</author>
	
	<author>
		<name>Matt Luongo</name><uri>https://github.com/mhluongo</uri>
	</author>
	
	<author>
		<name>Piotr Dyraga</name><uri>https://github.com/pdyraga</uri>
	</author>
	
	<author>
		<name>James Hancock</name><uri>https://github.com/MadeOfTin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/152/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/152" />
        

        <id>https://wg-eips.ritovision.com/152/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:152"
            label="EIP-152" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/152/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP will enable the BLAKE2b hash function and other higher-round 64-bit BLAKE2 variants to run cheaply on the EVM, allowing easier interoperability between Ethereum and Zcash as well as other Equihash-based PoW coins.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a new precompiled contract which implements the compression function &lt;code&gt;F&lt;&#x2F;code&gt; used in the BLAKE2 cryptographic hashing algorithm, for the purpose of allowing interoperability between the EVM and Zcash, as well as introducing more flexible cryptographic hash primitives to the EVM.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Besides being a useful cryptographic hash function and SHA3 finalist, BLAKE2 allows for efficient verification of the Equihash PoW used in Zcash, making a BTC Relay - style SPV client possible on Ethereum. A single verification of an Equihash PoW verification requires 512 iterations of the hash function, making verification of Zcash block headers prohibitively expensive if a Solidity implementation of BLAKE2 is used.&lt;&#x2F;p&gt;
&lt;p&gt;BLAKE2b, the common 64-bit BLAKE2 variant, is highly optimized and faster than MD5 on modern processors.&lt;&#x2F;p&gt;
&lt;p&gt;Interoperability with Zcash could enable contracts like trustless atomic swaps between the chains, which could provide a much needed aspect of privacy to the very public Ethereum blockchain.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;We propose adding a precompiled contract at address &lt;code&gt;0x09&lt;&#x2F;code&gt; wrapping the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;tools.ietf.org&#x2F;html&#x2F;rfc7693#section-3.2&quot;&gt;BLAKE2 &lt;code&gt;F&lt;&#x2F;code&gt; compression function&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The precompile requires 6 inputs tightly encoded, taking exactly 213 bytes, as explained below. The encoded inputs are corresponding to the ones specified in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;tools.ietf.org&#x2F;html&#x2F;rfc7693#section-3.2&quot;&gt;BLAKE2 RFC Section 3.2&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;rounds&lt;&#x2F;code&gt; - the number of rounds - 32-bit unsigned big-endian word&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;h&lt;&#x2F;code&gt; - the state vector - 8 unsigned 64-bit little-endian words&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;m&lt;&#x2F;code&gt; - the message block vector - 16 unsigned 64-bit little-endian words&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;t_0, t_1&lt;&#x2F;code&gt; - offset counters - 2 unsigned 64-bit little-endian words&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;f&lt;&#x2F;code&gt; - the final block indicator flag - 8-bit word&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[4 bytes for rounds][64 bytes for h][128 bytes for m][8 bytes for t_0][8 bytes for t_1][1 byte for f]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The boolean &lt;code&gt;f&lt;&#x2F;code&gt; parameter is considered as &lt;code&gt;true&lt;&#x2F;code&gt; if set to &lt;code&gt;1&lt;&#x2F;code&gt;.
The boolean &lt;code&gt;f&lt;&#x2F;code&gt; parameter is considered as &lt;code&gt;false&lt;&#x2F;code&gt; if set to &lt;code&gt;0&lt;&#x2F;code&gt;.
All other values yield an invalid encoding of &lt;code&gt;f&lt;&#x2F;code&gt; error.&lt;&#x2F;p&gt;
&lt;p&gt;The precompile should compute the &lt;code&gt;F&lt;&#x2F;code&gt; function as &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;tools.ietf.org&#x2F;html&#x2F;rfc7693#section-3.2&quot;&gt;specified in the RFC&lt;&#x2F;a&gt; and return the updated state vector &lt;code&gt;h&lt;&#x2F;code&gt; with unchanged encoding (little-endian).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;example-usage-in-solidity&quot;&gt;Example Usage in Solidity&lt;&#x2F;h3&gt;
&lt;p&gt;The precompile can be wrapped easily in Solidity to provide a more development-friendly interface to &lt;code&gt;F&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; F&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; rounds&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; h&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; m&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes8&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; t&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; f&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; output&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; args &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;rounds&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; h&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; h&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; m&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; m&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; m&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; m&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; t&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; t&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; f&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; iszero&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;staticcall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;not&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x09&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;args&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xd5&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; output&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x40&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      revert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  return&lt;&#x2F;span&gt;&lt;span&gt; output&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; callF&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint32&lt;&#x2F;span&gt;&lt;span&gt; rounds &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 12&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; h&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  h&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;48c9bdf267e6096a3ba7ca8485ae67bb2bf894fe72f36e3cf1361d5f3af54fa5&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  h&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;d182e6ad7f520e511f6c3e2b8c68059b6bbd41fbabd9831f79217e1319cde05b&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; m&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  m&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;6162630000000000000000000000000000000000000000000000000000000000&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  m&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;0000000000000000000000000000000000000000000000000000000000000000&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  m&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;0000000000000000000000000000000000000000000000000000000000000000&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  m&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;0000000000000000000000000000000000000000000000000000000000000000&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes8&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; t&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  t&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;0300000000000000&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  t&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;0000000000000000&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bool&lt;&#x2F;span&gt;&lt;span&gt; f &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Expected output:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ba80a53f981c4d0d6a2797b69f12f6e94c212f14685ac4b74b12bb6fdbffa2d1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 7d87c5392aab792dc252d5de4533cc9518d38aa8dbf1925ab92386edd4009923&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; F&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;rounds&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; h&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; m&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; t&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; f&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;gas-costs-and-benchmarks&quot;&gt;Gas costs and benchmarks&lt;&#x2F;h3&gt;
&lt;p&gt;Each operation will cost &lt;code&gt;GFROUND * rounds&lt;&#x2F;code&gt; gas, where &lt;code&gt;GFROUND = 1&lt;&#x2F;code&gt;. Detailed benchmarks are presented in the benchmarks appendix section.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;BLAKE2 is an excellent candidate for precompilation. BLAKE2 is heavily optimized for modern 64-bit CPUs, specifically utilizing 24 and 63-bit rotations to allow parallelism through SIMD instructions and little-endian arithmetic. These characteristics provide exceptional speed on native CPUs: 3.08 cycles per byte, or 1 gibibyte per second on an Intel i5.&lt;&#x2F;p&gt;
&lt;p&gt;In contrast, the big-endian 32 byte semantics of the EVM are not conducive to efficient implementation of BLAKE2, and thus the gas cost associated with computing the hash on the EVM is disproportionate to the true cost of computing the function natively.&lt;&#x2F;p&gt;
&lt;p&gt;An obvious implementation would be a direct BLAKE2b hash function precompile. At first glance, a BLAKE2b precompile satisfies most hashing and interoperability requirements on the EVM. Once we started digging in, however, it became clear that any BLAKE2b implementation would need specific features and internal modifications based on different projects&#x27; requirements and libraries.&lt;&#x2F;p&gt;
&lt;p&gt;A &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;152#issuecomment-499240310&quot;&gt;thread with the Zcash team&lt;&#x2F;a&gt; makes the issue clear.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;The minimal thing that is necessary for a working ZEC-ETH relay is an implementation of BLAKE2b Compression F in a precompile.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;A BLAKE2b Compression Function F precompile would also suffice for the Filecoin and Handshake interop goals.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;A full BLAKE2b precompile would suffice for a ZEC-ETH relay, provided that the implementation provided the parts of the BLAKE2 API that we need (personalization, maybe something else—I&#x27;m not sure).&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;I&#x27;m not 100% certain if a full BLAKE2b precompile would also suffice for the Filecoin and Handshake goals. It almost certainly could, provided that it supports all the API that they need.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;BLAKE2s — whether the Compression Function F or the full hash — is only a nice-to-have for the purposes of a ZEC-ETH relay.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;From this and other conversations with teams in the space, we believe we should focus first on the &lt;code&gt;F&lt;&#x2F;code&gt; precompile as a strictly necessary piece for interoperability projects. A BLAKE2b precompile is a nice-to-have, and we support any efforts to add one-- but it&#x27;s unclear whether complete requirements and a flexible API can be found in time for Istanbul.&lt;&#x2F;p&gt;
&lt;p&gt;Implementation of only the core F compression function also allows substantial flexibility and extensibility while keeping changes at the protocol level to a minimum. This will allow functions like tree hashing, incremental hashing, and keyed, salted, and personalized hashing as well as variable length digests, none of which are currently available on the EVM.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;There is very little risk of breaking backwards-compatibility with this EIP, the sole issue being if someone were to build a contract relying on the address at &lt;code&gt;0x09&lt;&#x2F;code&gt; being empty. The likelihood of this is low, and should specific instances arise, the address could be chosen to be any arbitrary value with negligible risk of collision.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h4 id=&quot;test-vector-0&quot;&gt;Test vector 0&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;input: (empty)&lt;&#x2F;li&gt;
&lt;li&gt;output: error &quot;input length for BLAKE2 F precompile should be exactly 213 bytes&quot;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;test-vector-1&quot;&gt;Test vector 1&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;input:
&lt;code&gt;00000c48c9bdf267e6096a3ba7ca8485ae67bb2bf894fe72f36e3cf1361d5f3af54fa5d182e6ad7f520e511f6c3e2b8c68059b6bbd41fbabd9831f79217e1319cde05b61626300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000001&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;output: error &quot;input length for BLAKE2 F precompile should be exactly 213 bytes&quot;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;test-vector-2&quot;&gt;Test vector 2&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;input:
&lt;code&gt;000000000c48c9bdf267e6096a3ba7ca8485ae67bb2bf894fe72f36e3cf1361d5f3af54fa5d182e6ad7f520e511f6c3e2b8c68059b6bbd41fbabd9831f79217e1319cde05b61626300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000001&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;output: error &quot;input length for BLAKE2 F precompile should be exactly 213 bytes&quot;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;test-vector-3&quot;&gt;Test vector 3&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;input:
&lt;code&gt;0000000c48c9bdf267e6096a3ba7ca8485ae67bb2bf894fe72f36e3cf1361d5f3af54fa5d182e6ad7f520e511f6c3e2b8c68059b6bbd41fbabd9831f79217e1319cde05b61626300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000002&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;output: error &quot;incorrect final block indicator flag&quot;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;test-vector-4&quot;&gt;Test vector 4&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;input:
&lt;code&gt;0000000048c9bdf267e6096a3ba7ca8485ae67bb2bf894fe72f36e3cf1361d5f3af54fa5d182e6ad7f520e511f6c3e2b8c68059b6bbd41fbabd9831f79217e1319cde05b61626300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000001&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;output:
&lt;code&gt;08c9bcf367e6096a3ba7ca8485ae67bb2bf894fe72f36e3cf1361d5f3af54fa5d282e6ad7f520e511f6c3e2b8c68059b9442be0454267ce079217e1319cde05b&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;test-vector-5&quot;&gt;Test vector 5&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;input:
&lt;code&gt;0000000c48c9bdf267e6096a3ba7ca8485ae67bb2bf894fe72f36e3cf1361d5f3af54fa5d182e6ad7f520e511f6c3e2b8c68059b6bbd41fbabd9831f79217e1319cde05b61626300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000001&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;output: &lt;code&gt;ba80a53f981c4d0d6a2797b69f12f6e94c212f14685ac4b74b12bb6fdbffa2d17d87c5392aab792dc252d5de4533cc9518d38aa8dbf1925ab92386edd4009923&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;test-vector-6&quot;&gt;Test vector 6&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;input:
&lt;code&gt;0000000c48c9bdf267e6096a3ba7ca8485ae67bb2bf894fe72f36e3cf1361d5f3af54fa5d182e6ad7f520e511f6c3e2b8c68059b6bbd41fbabd9831f79217e1319cde05b61626300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;output:
&lt;code&gt;75ab69d3190a562c51aef8d88f1c2775876944407270c42c9844252c26d2875298743e7f6d5ea2f2d3e8d226039cd31b4e426ac4f2d3d666a610c2116fde4735&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;test-vector-7&quot;&gt;Test vector 7&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;input:
&lt;code&gt;0000000148c9bdf267e6096a3ba7ca8485ae67bb2bf894fe72f36e3cf1361d5f3af54fa5d182e6ad7f520e511f6c3e2b8c68059b6bbd41fbabd9831f79217e1319cde05b61626300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000001&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;output:
&lt;code&gt;b63a380cb2897d521994a85234ee2c181b5f844d2c624c002677e9703449d2fba551b3a8333bcdf5f2f7e08993d53923de3d64fcc68c034e717b9293fed7a421&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;test-vector-8&quot;&gt;Test vector 8&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;input:
&lt;code&gt;ffffffff48c9bdf267e6096a3ba7ca8485ae67bb2bf894fe72f36e3cf1361d5f3af54fa5d182e6ad7f520e511f6c3e2b8c68059b6bbd41fbabd9831f79217e1319cde05b61626300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000001&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;output:
&lt;code&gt;fc59093aafa9ab43daae0e914c57635c5402d8e3d2130eb9b3cc181de7f0ecf9b22bf99a7815ce16419e200e01846e6b5df8cc7703041bbceb571de6631d2615&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;An initial implementation of the &lt;code&gt;F&lt;&#x2F;code&gt; function in Go, adapted from the standard library, can be found in our &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;keep-network&#x2F;blake2-f&quot;&gt;Golang BLAKE2 library fork&lt;&#x2F;a&gt;. There&#x27;s also an implementation of the precompile in our fork of &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;keep-network&#x2F;go-ethereum&#x2F;pull&#x2F;4&quot;&gt;go-ethereum&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;&#x2F;h2&gt;
&lt;p&gt;For reference, further discussion on this EIP also occurred in the following PRs and issues&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;152&quot;&gt;Original Issue&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum-magicians.org&#x2F;t&#x2F;blake2b-f-precompile&#x2F;3157&quot;&gt;Ethereum Magicians&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;pull&#x2F;2129&quot;&gt;PR 2129&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;appendix-benchmarks&quot;&gt;Appendix - benchmarks&lt;&#x2F;h2&gt;
&lt;p&gt;Assuming ecRecover precompile is perfectly priced, we executed a set of benchmarks comparing Blake2b F compression function precompile with ecRecover precompile. For benchmarks, we used 3.1 GHz Intel Core i7 64-bit machine.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; sysctl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; machdep.cpu.brand_string&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Intel(R&lt;&#x2F;span&gt;&lt;span&gt;) Core(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;TM&lt;&#x2F;span&gt;&lt;span&gt;) i7-7920HQ CPU @ 3.10GHz&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;12-rounds&quot;&gt;12 rounds&lt;&#x2F;h3&gt;
&lt;p&gt;An average gas price of F precompile call with 12 rounds compared to ecRecover should have been &lt;code&gt;6.74153&lt;&#x2F;code&gt; and it gives &lt;code&gt;0.5618&lt;&#x2F;code&gt; gas per round.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Name                                         Gascost         Time (ns)     MGas&#x2F;S    Gasprice for 10MGas&#x2F;S    Gasprice for ECDSA eq&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-----------------------------------------  ---------  ----------------  ---------  -----------------------  -----------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledEcrecover&#x2F;                           3000  152636              19.6546                 1526.36               3000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_0               12     338              35.503                     3.38                  6.64326&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_3               12     336              35.7143                    3.36                  6.60395&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_70              12     362              33.1492                    3.62                  7.11497&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_140             12     339              35.3982                    3.39                  6.66291&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_230             12     339              35.3982                    3.39                  6.66291&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_300             12     343              34.9854                    3.43                  6.74153&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_370             12     336              35.7143                    3.36                  6.60395&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_440             12     337              35.6083                    3.37                  6.6236&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_510             12     345              34.7826                    3.45                  6.78084&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_580             12     355              33.8028                    3.55                  6.97738&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Columns&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;MGas&#x2F;S&lt;&#x2F;code&gt; - Shows what MGas per second was measured on that machine at that time&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Gasprice for 10MGas&#x2F;S&lt;&#x2F;code&gt; shows what the gasprice should have been, in order to reach 10 MGas&#x2F;second&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Gasprice for ECDSA eq&lt;&#x2F;code&gt; shows what the gasprice should have been, in order to have the same cost&#x2F;cycle as ecRecover&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;1200-rounds&quot;&gt;1200 rounds&lt;&#x2F;h3&gt;
&lt;p&gt;An average gas price of F precompile call with 1200 rounds compared to ecRecover should have been &lt;code&gt;436.1288&lt;&#x2F;code&gt; and it gives &lt;code&gt;0.3634&lt;&#x2F;code&gt; gas per round.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Name                                         Gascost         Time (ns)     MGas&#x2F;S    Gasprice for 10MGas&#x2F;S    Gasprice for ECDSA eq&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-----------------------------------------  ---------  ----------------  ---------  -----------------------  -----------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledEcrecover&#x2F;                           3000  156152              19.212                  1561.52               3000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_0             1200   22642              52.9989                  226.42                434.999&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_3             1200   22885              52.4361                  228.85                439.668&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_70            1200   22737              52.7774                  227.37                436.824&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_140           1200   22602              53.0926                  226.02                434.231&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_230           1200   22501              53.331                   225.01                432.29&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_300           1200   22435              53.4879                  224.35                431.022&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_370           1200   22901              52.3995                  229.01                439.975&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_440           1200   23134              51.8717                  231.34                444.452&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_510           1200   22608              53.0786                  226.08                434.346&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_580           1200   22563              53.1844                  225.63                433.481&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;1-round&quot;&gt;1 round&lt;&#x2F;h3&gt;
&lt;p&gt;An average gas price of F precompile call with 1 round compared to ecRecover should have been &lt;code&gt;2.431701&lt;&#x2F;code&gt;. However, in this scenario the call cost would totally overshadow the dynamic cost anyway.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Name                                         Gascost         Time (ns)      MGas&#x2F;S    Gasprice for 10MGas&#x2F;S    Gasprice for ECDSA eq&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-----------------------------------------  ---------  ----------------  ----------  -----------------------  -----------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledEcrecover&#x2F;                           3000  157544              19.0423                  1575.44               3000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_0                1     126               7.93651                    1.26                  2.39933&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_3                1     127               7.87402                    1.27                  2.41837&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_70               1     128               7.8125                     1.28                  2.43741&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_140              1     125               8                          1.25                  2.38029&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_230              1     128               7.8125                     1.28                  2.43741&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_300              1     127               7.87402                    1.27                  2.41837&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_370              1     131               7.63359                    1.31                  2.49454&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_440              1     129               7.75194                    1.29                  2.45646&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_510              1     125               8                          1.25                  2.38029&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_580              1     131               7.63359                    1.31                  2.49454&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Gas cost changes for IO-heavy operations</title>
        <published>2016-09-24T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/150/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/150/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:150"
            label="EIP-150" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/150/">&lt;h3 id=&quot;meta-reference&quot;&gt;Meta reference&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;608&#x2F;&quot;&gt;Tangerine Whistle&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;FORK_BLKNUM&lt;&#x2F;th&gt;&lt;th&gt;CHAIN_ID&lt;&#x2F;th&gt;&lt;th&gt;CHAIN_NAME&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;2,463,000&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;Main net&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h3&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= FORK_BLKNUM&lt;&#x2F;code&gt;, then:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Increase the gas cost of EXTCODESIZE to 700 (from 20).&lt;&#x2F;li&gt;
&lt;li&gt;Increase the base gas cost of EXTCODECOPY to 700 (from 20).&lt;&#x2F;li&gt;
&lt;li&gt;Increase the gas cost of BALANCE to 400 (from 20).&lt;&#x2F;li&gt;
&lt;li&gt;Increase the gas cost of SLOAD to 200 (from 50).&lt;&#x2F;li&gt;
&lt;li&gt;Increase the gas cost of CALL, DELEGATECALL, CALLCODE to 700 (from 40).&lt;&#x2F;li&gt;
&lt;li&gt;Increase the gas cost of SELFDESTRUCT to 5000 (from 0).&lt;&#x2F;li&gt;
&lt;li&gt;If SELFDESTRUCT hits a newly created account, it triggers an additional gas cost of 25000 (similar to CALLs).&lt;&#x2F;li&gt;
&lt;li&gt;Increase the recommended gas limit target to 5.5 million.&lt;&#x2F;li&gt;
&lt;li&gt;Define &quot;all but one 64th&quot; of &lt;code&gt;N&lt;&#x2F;code&gt; as &lt;code&gt;N - floor(N &#x2F; 64)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If a call asks for more gas than the maximum allowed amount (i.e. the total amount of gas remaining in the parent after subtracting the gas cost of the call and memory expansion), do not return an OOG error; instead, if a call asks for more gas than all but one 64th of the maximum allowed amount, call with all but one 64th of the maximum allowed amount of gas (this is equivalent to a version of EIP-90&lt;sup&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;90&quot;&gt;1&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; plus EIP-114&lt;sup&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;114&quot;&gt;2&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;). CREATE only provides all but one 64th of the parent gas to the child call.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;That is, substitute:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        extra_gas = (not ext.account_exists(to)) * opcodes.GCALLNEWACCOUNT + \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            (value &amp;gt; 0) * opcodes.GCALLVALUETRANSFER&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        if compustate.gas &amp;lt; gas + extra_gas:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            return vm_exception(&amp;#39;OUT OF GAS&amp;#39;, needed=gas+extra_gas)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        submsg_gas = gas + opcodes.GSTIPEND * (value &amp;gt; 0)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;With:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        def max_call_gas(gas):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          return gas - (gas &#x2F;&#x2F; 64)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        extra_gas = (not ext.account_exists(to)) * opcodes.GCALLNEWACCOUNT + \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            (value &amp;gt; 0) * opcodes.GCALLVALUETRANSFER&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        if compustate.gas &amp;lt; extra_gas:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            return vm_exception(&amp;#39;OUT OF GAS&amp;#39;, needed=extra_gas)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        if compustate.gas &amp;lt; gas + extra_gas:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            gas = min(gas, max_call_gas(compustate.gas - extra_gas))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        submsg_gas = gas + opcodes.GSTIPEND * (value &amp;gt; 0)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h3&gt;
&lt;p&gt;Recent denial-of-service attacks have shown that opcodes that read the state tree are under-priced relative to other opcodes. There are software changes that have been made, are being made and can be made in order to mitigate the situation; however, the fact will remain that such opcodes will be by a substantial margin the easiest known mechanism to degrade network performance via transaction spam. The concern arises because it takes a long time to read from disk, and is additionally a risk to future sharding proposals as the &quot;attack transactions&quot; that have so far been most successful in degrading network performance would also require tens of megabytes to provide Merkle proofs for. This EIP increases the cost of storage reading opcodes to address this concern. The costs have been derived from an updated version of the calculation table used to generate the 1.0 gas costs: https:&#x2F;&#x2F;docs.google.com&#x2F;spreadsheets&#x2F;d&#x2F;15wghZr-Z6sRSMdmRmhls9dVXTOpxKy8Y64oy9MvDZEQ&#x2F;edit#gid=0; the rules attempt to target a limit of 8 MB of data that needs to be read in order to process a block, and include an estimate of 500 bytes for a Merkle proof for SLOAD and 1000 for an account.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP aims to be simple, and adds a flat penalty of 300 gas on top of the costs calculated in this table to account for the cost of loading the code (~17–21 kb in the worst case).&lt;&#x2F;p&gt;
&lt;p&gt;The EIP 90 gas mechanic is introduced because without it, all current contracts that make calls would stop working as they use an expression like &lt;code&gt;msg.gas - 40&lt;&#x2F;code&gt; to determine how much gas to make a call with, relying on the gas cost of calls being 40. Additionally, EIP 114 is introduced because, given that we are making the cost of a call higher and less predictable, we have an opportunity to do it at no extra cost to currently available guarantees, and so we also achieve the benefit of replacing the call stack depth limit with a &quot;softer&quot; gas-based restriction, thereby eliminating call stack depth attacks as a class of attack that contract developers have to worry about and hence increasing contract programming safety. Note that with the given parameters, the de-facto maximum call stack depth is limited to ~340 (down from ~1024), mitigating the harm caused by any further potential quadratic-complexity DoS attacks that rely on calls.&lt;&#x2F;p&gt;
&lt;p&gt;The gas limit increase is recommended so as to preserve the de-facto transactions-per-second processing capability of the system for average contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;EIP-90, https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;90&lt;&#x2F;li&gt;
&lt;li&gt;EIP-114, https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;114&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>safe &quot;eth_sendTransaction&quot; authorization via html popup</title>
        <published>2016-06-05T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Ronan Sandford</name><uri>https://github.com/wighawag</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/107/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/107/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="interface"
                label="Interface" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:107"
            label="EIP-107" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/107/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This draft EIP describes the details of an authorization method that if provided by rpc enabled ethereum nodes would allow regular websites to send transactions (via &lt;code&gt;eth_sendTransaction&lt;&#x2F;code&gt;) without the need to enable CORS. Instead, user would be asked to confirm the transaction via an html popup.&lt;&#x2F;p&gt;
&lt;p&gt;Every read only rpc call the dapp wants to perform is redirected to an invisible iframe from the node&#x27;s domain and for every transaction that the dapp wish to execute, an html popup is presented to the user to allow him&#x2F;her to cancel or confirm the transaction. This allows the dapp to connect to the node&#x27;s rpc api without being  granted any kind of privileges. This allows users to safely interact with dapps running in their everyday web browser while their accounts are unlocked. In case the account is not unlocked, and the node has allowed the &quot;personal&quot; api via rpc,the html page also allow the user to enter their password to unlock the account for the scope of the transaction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, if a user navigates to a dapp running on a website using her&#x2F;his everyday browser, the dapp will by default have no access to the rpc api for security reasons. The user will have to enable CORS for the website&#x27;s domain in order for the dapp to work. Unfortunately if the user does so, the dapp will be able to send transactions from any unlocked account without the need for any user consent. In other words, not only does the user need to change the node&#x27;s default setting, but the user is also forced to trust the dapp in order to use it. This is of course not acceptable and forces existing dapps to rely on the use of workarounds like:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;if the transaction is a plain ether transfer, the user is asked to enter it in a dedicated trusted wallet like &quot;Mist&quot;&lt;&#x2F;li&gt;
&lt;li&gt;For more complex case, the user is asked to enter the transaction manually via the node command line interface.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This proposal aims to provide a safe and user friendly alternative.&lt;&#x2F;p&gt;
&lt;p&gt;Here are some screenshots of the provided implementation of that html popup:&lt;&#x2F;p&gt;
&lt;h3 id=&quot;account-unlocked&quot;&gt;Account unlocked&lt;&#x2F;h3&gt;
&lt;p&gt;When the account is already unlocked, the user is presented with the following popup for every transaction that the dapp attempts to make:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;107&#x2F;.&#x2F;assets&#x2F;authorization.png&quot; alt=&quot;&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;account-locked-and-no-personal-api-exposed-via-rpc&quot;&gt;Account locked and no &quot;personal&quot; api exposed via rpc:&lt;&#x2F;h3&gt;
&lt;p&gt;When the account is locked, and the node does not provide access to account unlocking via its rpc interface, the following popup will be presented. This is not ideal since this requires the user to know how to unlock an account:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;107&#x2F;.&#x2F;assets&#x2F;authorization-locked.png&quot; alt=&quot;&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;account-locked-but-node-exposing-the-personal-api-via-rpc&quot;&gt;Account locked but node exposing the &quot;personal&quot; api via rpc :&lt;&#x2F;h3&gt;
&lt;p&gt;A better option is to ask the user for their password, but this is only possible if the node allows access to the &quot;personal&quot; api via rpc. In such case, the following dialog will be presented to the user so he&#x2F;she can accept the transaction by providing the password required to unlock the account:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;107&#x2F;.&#x2F;assets&#x2F;authorization-password.png&quot; alt=&quot;&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;In order for the mechanism to work, the node needs to serve an html file via http at the url &amp;lt;node url&amp;gt;&#x2F;authorization.html&lt;&#x2F;p&gt;
&lt;p&gt;This file will then be used by the dapp in 2 different modes (invisible iframe and popup window).&lt;&#x2F;p&gt;
&lt;p&gt;The invisible iframe will be embedded in the dapp to allow the dapp to send its read-only rpc call without having to enable CORS for the dapp&#x27;s website domain. This is done by sending message to the iframe (via javascript &lt;code&gt;window.postMessage&lt;&#x2F;code&gt;) which in turn execute the rpc call. This works since the iframe and the node share the same domain&#x2F;port.&lt;&#x2F;p&gt;
&lt;p&gt;In the iframe mode, the html file&#x27;s javascript code will ensure that no call requiring an unlocked key can be made. This is to prevent dapps from embedding the invisible iframe and tricking the user into clicking the confirm button.
If the dapp requires an &lt;code&gt;eth_sendTransaction&lt;&#x2F;code&gt; call, the dapp will instead open a new window using the same url.&lt;&#x2F;p&gt;
&lt;p&gt;In this popup window mode, the html file&#x27;s javascript code will allow &lt;code&gt;eth_sendTransaction&lt;&#x2F;code&gt; (but not  &lt;code&gt;eth_sign&lt;&#x2F;code&gt;, as there is no way to display to the user the meaningful content of the transaction to sign in a safe way) to be called. But instead of sending the call to the node directly, a confirmation dialog will be presented showing the sender and recipient addresses, as well as the amount being transferred along with the potential gas cost. Upon the user approving, the request will be sent and the result returned to the dapp. An error will be returned in case the user cancel the request.&lt;&#x2F;p&gt;
&lt;p&gt;The html page also checks for the availability of the &quot;personal&quot; api and if so, will ask the user to unlock the account if necessary. The unlocking is temporary (3s) so the password will be asked again if a transaction is attempted before the end of this short time.&lt;&#x2F;p&gt;
&lt;p&gt;In both iframe mode and window mode, the communication with the dapp is achieved using &lt;code&gt;window.postMessage&lt;&#x2F;code&gt;.
The first message the iframe&#x2F;window sends is a message containing the string &quot;ready&quot; to let the dapp know that it now accepts messages. Then the dapp can start performing rpc call by sending message using the following object :&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  id:&amp;lt;an id&amp;gt;, &#x2F;&#x2F;so responses can be match as there is no guarantee of the order of the response&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  payload:&amp;lt;json rpc object&amp;gt; &#x2F;&#x2F;this is the exact object that usually send to the node&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;For &lt;code&gt;eth_sendTransaction&lt;&#x2F;code&gt; the &quot;gas&quot;, &quot;gasPrice&quot; and &quot;from&quot; field need to be set in the rpc parameter so that the window can display the correct value. If not all of these are passed in, the window will return an error.&lt;&#x2F;p&gt;
&lt;p&gt;Upon receiving such message, the iframe will perform the actual rpc call to the node but only if such a call is a read only call (not requiring an unlocked key). If it is not it will return a error. The window on the other will only accept &lt;code&gt;eth_sendTransaction&lt;&#x2F;code&gt; calls but will display a dialog so the user can accept or cancel the request.&lt;&#x2F;p&gt;
&lt;p&gt;In all the cases, the iframe&#x2F;window will send a message back to the dapp using the following object:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  id:&amp;lt;id matching the request&amp;gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  result:&amp;lt;rpc result as is&amp;gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  error:&amp;lt;error object&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;the error object cannot be a javascript Error object due to postMessage limitation. Instead it is&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  message:&amp;lt;a string describing the error&amp;gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  type:&amp;lt;a string defining the type of error&amp;gt; &#x2F;&#x2F;type=&amp;quot;cancel&amp;quot; means the user cancel the transaction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The design for that proposal was chosen for its simplicity and security. A previous idea was to use an oauth-like protocol in order for the user to accept or deny a transaction request. It would have required deeper code change in the node and some geth contributors argues that such change did not fit into geth code base as it would have required dapp aware code.
The current design, instead has a very simple implementation (self contained html file that can be shared across node&#x27;s implementation) and its safeness is guaranteed by browsers&#x27; cross domain policies.&lt;&#x2F;p&gt;
&lt;p&gt;The use of iframe&#x2F; window was required to have both security and user friendliness. The invisible iframe allows the dapp to execute read only calls without the need for user input, and the window ensures user approval before making a call. While we could have made it without the window mode by making the iframe confirmation use the native browser &lt;code&gt;window.confirm&lt;&#x2F;code&gt; dialog, this would have prevented the use of a more elegant confirmation popup that the current design allows. It also happens to be that the &lt;code&gt;window.confirm&lt;&#x2F;code&gt; is not safe in some browsers, as it gives focus to the accept option and can be triggered automatically (https:&#x2F;&#x2F;bugs.chromium.org&#x2F;p&#x2F;chromium&#x2F;issues&#x2F;detail?id=260653).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementations&quot;&gt;Implementations&lt;&#x2F;h2&gt;
&lt;p&gt;In order to implement this design, the following html file or an equivalent one needs to be served at the url &amp;lt;node url&amp;gt;&#x2F;authorization.html&lt;&#x2F;p&gt;
&lt;p&gt;That&#x27;s it.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;html&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;DOCTYPE&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; html&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;html&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;head&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;title&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;Ethereum Authorization&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;title&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;head&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;script&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;https:&#x2F;&#x2F;github.com&#x2F;alexvandesande&#x2F;blockies&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    !&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; r&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;5&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;charCodeAt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; t&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;^&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;11&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; l&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;^&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;19&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;^&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;^&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;8&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;31&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; e&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Math&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;floor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;360&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;60&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;40&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;%&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;25&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;%&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;hsl(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; n&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; o&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Math&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ceil&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Math&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;floor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;slice&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;reverse&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;concat&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;v&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;v&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;push&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;v&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; l&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; n&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;document&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;createElement&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;canvas&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Math&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;sqrt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;width&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;height&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getContext&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2d&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;fillStyle&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;fillRect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;width&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;height&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;fillStyle&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; h&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Math&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;floor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;fillStyle&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;fillRect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; a&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; a&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;size&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;8&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;scale&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;seed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Math&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;floor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Math&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;random&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Math&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;pow&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;16&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;toString&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;16&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;color&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;bgcolor&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;spotcolor&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;v&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;v&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; u&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Array&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;window&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;blockies&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;create&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; bignumber.js v2.3.0 https:&#x2F;&#x2F;github.com&#x2F;MikeMcl&#x2F;bignumber.js&#x2F;LICENCE &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    !&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;use strict&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; n&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; E&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; t&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; instanceof&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; E&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; j&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;L&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;26&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;constructor call without new&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; E&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;null&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;H&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;64&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;M&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;base&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; E&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; instanceof&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; E&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;U&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;P&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;k&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;typeof&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RegExp&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;^-?&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;N&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;slice&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;]+&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;(?:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\\&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;)?$&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;37&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;test&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; h&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;slice&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;j&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;replace&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;^&lt;&#x2F;span&gt;&lt;span class=&quot;z-string z-regexp&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-character z-escape&quot;&gt;\.&lt;&#x2F;span&gt;&lt;span class=&quot;z-string z-regexp&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-character z-escape&quot;&gt;\.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;15&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;L&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;M&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;v&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;45&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;===&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;charCodeAt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;slice&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;D&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; instanceof&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; E&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; f&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;slice&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;void&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;M&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;typeof&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;===&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;~&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;~&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; f&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;void&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;M&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;g&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;test&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; h&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;45&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;===&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;charCodeAt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;slice&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;indexOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;replace&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;search&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string z-regexp&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;slice&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;substring&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;48&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;===&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;charCodeAt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;48&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;===&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;charCodeAt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;--&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;slice&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;j&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;15&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;y&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!==&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;d&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;L&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;M&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;v&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;z&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;null&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;G&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;O&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;O&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;push&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;slice&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;O&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;push&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;slice&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;O&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;slice&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;O&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;--&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;push&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; f&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;M&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; D&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; o&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;g&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;p&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;indexOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;d&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;P&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;m&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;k&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;37&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;toLowerCase&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;p&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;J&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;J&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;replace&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;g&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; E&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;g&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;pow&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;p&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;J&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;g&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;g&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;g&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;--&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;pop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;p&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;--&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;C&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;g&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;d&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;m&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;d&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;p&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;null&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;m&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;null&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;p&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;m&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;m&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;p&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;p&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;m&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;6&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;m&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;m&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;8&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;d&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;--&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;--&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;unshift&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;--&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;p&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;p&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;N&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;charAt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;p&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; e&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; F&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; o&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;null&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;H&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;8&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;w&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;k&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;toString&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;null&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;19&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;24&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;U&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; E&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;19&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;24&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;--&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;--&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;--&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; t&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; E&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; E&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;break&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; t&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; x&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;L&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;decimal places&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; out of range&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; not an integer&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; I&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;--&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;pop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;O&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;z&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;null&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;G&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; L&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Error&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;new BigNumber&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;cmp&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;config&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;div&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;divToInt&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eq&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;gt&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;gte&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;lt&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;lte&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;minus&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;mod&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;plus&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;precision&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;random&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;round&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;shift&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;times&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;toDigits&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;toExponential&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;toFixed&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;toFormat&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;toFraction&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;pow&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;toPrecision&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;toString&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;BigNumber&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;() &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;throw&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; r&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;BigNumber Error&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;M&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; U&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;S&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;O&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;p&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;O&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;break&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; e&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;push&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;O&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;O&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;O&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;O&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;null&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;5&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;5&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;6&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;8&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; a&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;O&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;O&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;O&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;--&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;O&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;d&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;b&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;break&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;b&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;break&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;--&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;===&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;--&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;pop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;z&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;null&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;G&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; e&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; C&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;M&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;E&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;prototype&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;q&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; E&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;P&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;20&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;k&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;21&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;G&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1e7&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;z&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1e7&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;j&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;H&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;x&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;V&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;W&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;J&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;100&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;decimalSeparator&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;groupSeparator&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;groupSize&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;secondaryGroupSize&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;fractionGroupSeparator&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;fractionGroupSize&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; E&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;another&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;E&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;ROUND_UP&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;E&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;ROUND_DOWN&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;E&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;ROUND_CEIL&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;E&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;ROUND_FLOOR&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;E&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;ROUND_HALF_UP&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;E&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;ROUND_HALF_DOWN&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;5&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;E&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;ROUND_HALF_EVEN&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;6&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;E&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;ROUND_HALF_CEIL&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;E&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;ROUND_HALF_FLOOR&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;8&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;E&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;EUCLID&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;9&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;E&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;config&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;arguments&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;typeof&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; s&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;hasOwnProperty&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;null&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;void&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; i&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;null&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;void&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; f&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;DECIMAL_PLACES&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;H&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;A&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;P&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;P&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ROUNDING_MODE&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;H&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;8&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;k&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;k&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;EXPONENTIAL_AT&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;H&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;A&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;H&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;A&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;H&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;A&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;A&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;B&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;$&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;RANGE&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;H&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;A&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;H&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;A&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;G&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;z&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;H&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;A&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;A&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;G&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;z&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;j&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;L&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; cannot be zero&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;G&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;z&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ERRORS&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;===&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;===&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;===&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;M&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;H&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;j&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;j&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;L&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;m&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;j&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;CRYPTO&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;===&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;===&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;===&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;V&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;V&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;j&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;L&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;crypto unavailable&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;j&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;L&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;m&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;V&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;MODULO_MODE&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;H&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;9&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;W&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;W&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;POW_PRECISION&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;H&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;A&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;J&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;J&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;FORMAT&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;typeof&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;j&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;L&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; not an object&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;E&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;max&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;arguments&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;lt&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;E&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;min&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;arguments&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;gt&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;E&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;random&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;9007199254740992&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Math&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;random&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2097151&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; d&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Math&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;random&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 8388608&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1073741824&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Math&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;random&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;8388608&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Math&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;random&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; t&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; E&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;q&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;null&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;H&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;A&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;14&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;P&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;p&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;O&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;V&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;getRandomValues&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getRandomValues&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Uint32Array&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;131072&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;11&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;9e15&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getRandomValues&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Uint32Array&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;push&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1e14&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;randomBytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;randomBytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;281474976710656&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;31&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1099511627776&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4294967296&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;16777216&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;16&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;5&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;8&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;6&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;9e15&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;randomBytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;copy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;push&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1e14&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; j&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;L&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;14&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;crypto unavailable&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;9e15&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1e14&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;--&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;O&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;S&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;O&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;d&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;===&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;pop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;--&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;===&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;shift&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;O&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;O&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;O&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; l&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; e&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;R&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;R&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;slice&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;--&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;R&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;R&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;R&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;R&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;R&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;unshift&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; n&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;break&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; o&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; r&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;--&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;shift&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; l&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;g&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;p&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;m&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;w&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;v&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;N&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;y&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;S&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;R&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;A&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;D&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;F&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;I&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;L&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;I&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;I&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;L&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;L&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; E&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;I&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;L&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;I&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;L&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;L&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;I&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;I&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;L&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;NaN&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;w&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; E&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;x&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;v&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;w&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;b&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;O&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;O&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;O&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;L&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;I&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;L&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;I&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;--&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;x&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;push&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;I&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;F&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;L&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;g&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;d&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;L&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;g&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;L&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;L&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;g&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;I&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;I&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;g&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;F&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;L&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;I&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;R&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;F&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;N&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;I&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;slice&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;F&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;y&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;N&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;F&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;y&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;N&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;y&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;L&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;slice&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;unshift&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;L&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;L&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;do&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;g&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;L&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;N&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;F&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;y&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;S&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;N&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;F&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;y&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;S&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;S&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;N&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;g&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;d&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;S&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;D&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;g&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;g&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;g&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;p&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;L&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;g&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;m&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;p&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;y&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;N&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;p&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;N&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;m&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;y&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;g&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;--&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;p&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;m&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;F&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;L&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;m&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;m&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;p&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;g&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;g&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;p&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;L&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;slice&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;m&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;p&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;y&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;m&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;p&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;unshift&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;N&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;p&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;y&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;y&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;N&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;L&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;N&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;F&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;y&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;g&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;N&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;y&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;F&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;_&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;L&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;y&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;y&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;N&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;===&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;g&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;N&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;v&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;g&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;N&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;N&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;y&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;I&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;R&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;N&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;I&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;R&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;y&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;while&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;R&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;null&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;N&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;--&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;null&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;N&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;v&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;shift&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;b&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;v&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;U&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;w&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;w&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;O&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; w&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;w&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; w&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;h&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;^&lt;&#x2F;span&gt;&lt;span class=&quot;z-string z-regexp&quot;&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string z-regexp&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-string z-regexp&quot;&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-string z-regexp&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-string z-regexp&quot;&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;xbo&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-string z-regexp&quot;&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-string z-regexp&quot;&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string z-regexp&quot;&gt;?=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\w&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\w&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-string z-regexp&quot;&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;^&lt;&#x2F;span&gt;&lt;span class=&quot;z-string z-regexp&quot;&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;^&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-string z-regexp&quot;&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-character z-escape&quot;&gt;\.&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;^&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-character z-escape&quot;&gt;\.&lt;&#x2F;span&gt;&lt;span class=&quot;z-string z-regexp&quot;&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;^&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-string z-regexp&quot;&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;^&lt;&#x2F;span&gt;&lt;span class=&quot;z-string z-regexp&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-string z-regexp&quot;&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string z-regexp&quot;&gt;Infinity&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;span class=&quot;z-string z-regexp&quot;&gt;NaN&lt;&#x2F;span&gt;&lt;span class=&quot;z-string z-regexp&quot;&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;^&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-character z-escape&quot;&gt;\+&lt;&#x2F;span&gt;&lt;span class=&quot;z-string z-regexp&quot;&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string z-regexp&quot;&gt;?=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\w&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-string z-regexp&quot;&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;^&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;g&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; l&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;replace&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;test&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isNaN&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;null&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;replace&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;x&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;toLowerCase&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;16&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;8&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;replace&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;$1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;replace&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0.$1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; E&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;j&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;L&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;M&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;not a&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; base &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; number&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;null&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;null&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;M&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;absoluteValue&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;abs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; E&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ceil&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; U&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; E&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;comparedTo&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;cmp&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; M&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; E&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;decimalPlaces&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;dp&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; null&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;O&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;O&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;--&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;dividedBy&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;div&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; M&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;C&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; E&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;P&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;k&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;dividedToIntegerBy&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;divToInt&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; M&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;C&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; E&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;equals&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;eq&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; M&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;5&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;===&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; E&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;floor&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; U&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; E&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;greaterThan&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gt&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; M&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;6&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; E&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;greaterThanOrEqualTo&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gte&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; M&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;===&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; E&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;===&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isFinite&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;isInteger&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isInt&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;O&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isNaN&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;isNegative&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isNeg&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isZero&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;lessThan&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;lt&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; M&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;8&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; E&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;lessThanOrEqualTo&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;lte&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; M&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;9&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;===&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; E&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;===&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;minus&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;sub&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;M&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; E&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; E&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;NaN&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;plus&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;O&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;O&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; a&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; E&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;NaN&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; h&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; E&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;k&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;slice&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;reverse&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;--&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;push&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;reverse&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;break&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;--&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;b&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;--&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;--&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;--&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;b&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;shift&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;--&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; a&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;I&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;k&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;modulo&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;mod&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; t&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; M&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;11&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; E&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; E&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;NaN&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; E&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;9&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;W&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;C&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;C&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;W&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;minus&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;times&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;negated&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;neg&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; E&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;null&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;plus&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;add&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;M&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;12&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; E&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; E&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;NaN&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;minus&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;O&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;O&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; E&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; l&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; E&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;slice&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;reverse&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;--&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;push&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;reverse&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;--&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;b&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;b&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;unshift&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;I&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;precision&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;sd&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; n&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;null&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!==&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;j&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;L&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;13&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;argument&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;m&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;null&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; null&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;O&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;--&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;round&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; E&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;null&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;H&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;A&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;15&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;U&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;~&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;~&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;null&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;H&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;8&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;15&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;w&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;k&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;shift&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; H&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;y&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;y&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;16&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;argument&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;times&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1e&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; E&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;y&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;y&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;squareRoot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;sqrt&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;P&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; E&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0.5&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; E&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;NaN&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Math&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;sqrt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Math&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;sqrt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1e&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;toExponential&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;slice&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;indexOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; E&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; E&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;times&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;plus&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;C&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;slice&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;===&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;slice&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;--&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;slice&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;9999&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;4999&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;slice&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;5&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;charAt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;U&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;P&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;times&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;eq&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;break&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;U&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;P&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;times&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;eq&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;break&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; U&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;P&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;k&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;times&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;mul&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;g&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;p&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;d&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;m&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;w&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;v&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;N&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;y&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;M&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;17&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; E&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;N&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;y&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;N&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;y&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;N&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;N&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;y&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;y&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;y&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;N&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;null&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;N&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;y&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;null&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;O&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;O&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;N&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;y&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;d&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;N&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;N&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;y&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;y&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;d&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;d&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;--&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;d&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;push&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;m&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;b&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;w&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;R&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;--&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;g&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;y&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;w&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;p&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;y&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;w&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;N&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;--&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;w&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;N&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;w&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;p&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;g&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;g&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;w&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;w&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;d&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;m&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;w&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;p&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;d&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;--&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;m&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;d&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;d&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;shift&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;I&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;d&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;toDigits&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; E&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;null&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;H&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;A&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;18&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;precision&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;null&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;null&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;H&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;8&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;18&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;w&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;k&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;U&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;toExponential&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; F&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;null&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;H&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;A&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;19&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;~&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;~&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;null&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;19&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;toFixed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; F&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;null&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;H&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;A&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;~&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;~&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;null&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;20&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;toFormat&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;F&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;null&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;H&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;A&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;21&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;~&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;~&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;null&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;21&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;split&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;groupSize&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;secondaryGroupSize&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;groupSeparator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;slice&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;substr&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;substr&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;slice&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;decimalSeparator&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;fractionGroupSize&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;replace&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RegExp&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\\&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;d{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\\&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;g&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;$&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;X&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;fractionGroupSeparator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; t&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;toFraction&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; n&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;j&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;g&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;p&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; E&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;q&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;d&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; E&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;q&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;m&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; E&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;q&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;null&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;j&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; E&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;j&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isInt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;lt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;q&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;j&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;L&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;22&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;max denominator &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;out of range&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;not an integer&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;U&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gte&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;q&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;null&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;g&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; h&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;toString&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;g&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;p&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;p&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;S&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;O&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;O&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;cmp&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;p&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;p&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;d&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;z&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;z&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; E&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;C&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;p&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;plus&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;times&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;m&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;cmp&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;m&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;m&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;d&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;plus&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;times&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;d&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;p&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;minus&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;times&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;p&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;C&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;minus&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;m&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;plus&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;times&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;d&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;plus&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;times&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;m&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;d&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;C&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;d&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;m&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;k&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;minus&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;abs&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;cmp&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;C&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;k&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;minus&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;abs&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;d&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;toString&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;m&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;toString&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;toString&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;toString&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;z&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;toNumber&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;toPower&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;pow&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; t&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;d&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;null&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;M&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;23&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; E&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;H&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;y&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;y&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;23&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;exponent&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isFinite&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;y&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;parseFloat&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;NaN&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Math&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;pow&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; E&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;q&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isInt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;q&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isInt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;mod&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;null&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;J&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;p&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;J&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;O&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; E&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;q&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;times&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;break&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;mod&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;d&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;break&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;times&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;mod&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;q&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;div&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;mod&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;U&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;J&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;k&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;toPrecision&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; F&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;null&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;H&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;A&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;24&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;precision&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;null&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;24&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;toString&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; n&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; null&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;===&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Infinity&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;NaN&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;null&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;H&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;64&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;25&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;base&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;D&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;truncated&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;trunc&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; U&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; E&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;valueOf&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;T&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;toJSON&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; null&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;===&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;toString&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;f&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;null&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;E&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;config&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;E&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; t&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;===&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; r&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; n&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;O&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;--&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;48&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;===&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;charCodeAt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;--&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; o&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;slice&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; i&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; t&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; null&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; u&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;^&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;^&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; i&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;^&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;^&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; o&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; u&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;[object Array]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;Object&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;prototype&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;toString&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; s&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;--&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;N&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;indexOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;charAt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;u&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;null&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;o&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; o&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;reverse&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; f&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;charAt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;slice&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;e+&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; l&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; t&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;t&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;--&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;r&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;slice&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;slice&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; e&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; c&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;parseFloat&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;p&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;d&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; a&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;h&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;g&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;^&lt;&#x2F;span&gt;&lt;span class=&quot;z-string z-regexp&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-string z-regexp&quot;&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\d&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-string z-regexp&quot;&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-character z-escape&quot;&gt;\.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\d&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-string z-regexp&quot;&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-character z-escape&quot;&gt;\.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\d&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-string z-regexp&quot;&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-string z-regexp&quot;&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-string z-regexp&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;+-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\d&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-string z-regexp&quot;&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;p&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Math&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;ceil&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;d&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Math&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;floor&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;m&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; not a boolean or binary digit&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;w&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;rounding mode&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;v&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;number type has more than 15 significant digits&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;N&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;b&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1e14&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;O&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;14&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;y&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;9007199254740991&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;S&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;100&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1e3&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1e4&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1e5&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1e6&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1e7&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1e8&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1e9&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1e10&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1e11&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1e12&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1e13&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;R&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1e7&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1e9&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;undefined&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;typeof&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; crypto&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;crypto&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;typeof&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; define&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;define&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;amd&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;define&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; n&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;undefined&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;typeof&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; module&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;module&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;exports&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;module&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;exports&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;try&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;crypto&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;catch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;E&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;||&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;undefined&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;typeof&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; self&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;self&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;return this&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;BigNumber&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;script&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;style&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;    body&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      font-family&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;HelveticaNeue-Light&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Helvetica Neue Light&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Helvetica Neue&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Helvetica&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Arial&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Lucida Grande&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-constant&quot;&gt; sans-serif&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      background&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;E2E2E2&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;    *&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;after&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;before&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      box-sizing&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-constant&quot;&gt; border-box&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      margin&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      padding&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;pleasewait&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      position&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-constant&quot;&gt; absolute&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      top&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      left&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      width&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 100&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      height&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 100&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      padding&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      margin&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;infomessage&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      text-align&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-constant&quot;&gt; center&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      font-size&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;rem&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      margin&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;rem&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 4.5&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;rem&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity&quot;&gt;    .&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;wrapper&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      background&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;E2E2E2&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      position&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-constant&quot;&gt; absolute&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      top&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      left&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      width&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 100&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      height&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 100&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      padding&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      margin&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      display&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-constant&quot;&gt;none&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      text-align&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-constant&quot;&gt; center&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity&quot;&gt;    .&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;title&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      text-align&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-constant&quot;&gt; center&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      font-size&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1.2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;rem&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      margin&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;rem&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;rem&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity&quot;&gt;    .&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;message&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      text-align&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-constant&quot;&gt; center&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      font-size&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;rem&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;      &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;margin: 0 2rem 4.5rem;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;passwordField&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      text-align&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-constant&quot;&gt; center&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      font-size&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;rem&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      margin&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;rem&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;rem&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;      &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;margin: 0 2rem 4.5rem;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity&quot;&gt;    .&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;wrapper&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; button&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      background&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-constant&quot;&gt; transparent&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      border&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-constant&quot;&gt; none&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      color&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1678E5&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      height&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;rem&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      font-size&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;rem&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      width&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 50&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      position&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-constant&quot;&gt; absolute&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      bottom&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      cursor&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-constant&quot;&gt; pointer&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;cancel-button&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      border-top&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;px&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-constant&quot;&gt; solid&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;B4B4B4&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      border-right&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;px&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-constant&quot;&gt; solid&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;B4B4B4&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      left&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      border-radius&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;px&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;confirm-button&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      border-top&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;px&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-constant&quot;&gt; solid&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;B4B4B4&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      right&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      border-radius&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;px&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity&quot;&gt;    .&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;wrapper&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; button&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;focus&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity&quot;&gt;    .&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;wrapper&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; button&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;hover&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      font-weight&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-constant&quot;&gt; bold&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      background&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;EFEFEF&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity&quot;&gt;    .&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;wrapper&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; button&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;active&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      background&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;D6D6D6&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity&quot;&gt;    .&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;button&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      margin&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;rem&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;rem&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      display&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-constant&quot;&gt; inline-block&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      padding&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 9&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;px&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 15&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;px&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      background-color&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3898EC&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      color&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-constant&quot;&gt; white&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      border&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      line-height&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-constant&quot;&gt; inherit&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      text-decoration&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-constant&quot;&gt; none&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      cursor&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-constant&quot;&gt; pointer&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      border-radius&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;    input&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;button&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      -webkit-appearance&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; button&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;style&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;body&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;div&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;pleasewait&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;br&lt;&#x2F;span&gt;&lt;span&gt;&#x2F;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;p&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;infomessage&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;Please wait...&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;p&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;div&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;form&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;form&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; class&lt;&#x2F;span&gt;&lt;span&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;wrapper&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;br&lt;&#x2F;span&gt;&lt;span&gt;&#x2F;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;p&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;message&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; class&lt;&#x2F;span&gt;&lt;span&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;message&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;p&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;p&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;passwordField&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;label&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;Password Required:&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;label&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;input&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;password&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;password&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; &#x2F;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;p&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;button&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;cancel-button&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;button&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; autofocus&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;Cancel&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;button&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;button&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;confirm-button&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;button&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;Confirm&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;button&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;form&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;div&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;modal-dialog&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; class&lt;&#x2F;span&gt;&lt;span&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;wrapper&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;h3&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;modal-dialog-title&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; class&lt;&#x2F;span&gt;&lt;span&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;title&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;Title&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;h3&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;p&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;modal-dialog-message&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; class&lt;&#x2F;span&gt;&lt;span&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;message&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;Message&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;p&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;span&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; id&lt;&#x2F;span&gt;&lt;span&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;modal-dialog-button&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; class&lt;&#x2F;span&gt;&lt;span&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;button&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;Ok&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;span&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;div&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;script&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; noMessageReceivedYet&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; closedByCode&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; pleaseWait&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; document&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getElementById&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;pleasewait&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; form&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; document&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getElementById&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;form&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; cancelButton&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; document&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getElementById&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;cancel-button&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; confirmButton&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; document&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getElementById&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;confirm-button&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; message&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; document&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getElementById&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;message&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; infoMessage&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; document&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getElementById&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;infomessage&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; password&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; document&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getElementById&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;password&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; passwordField&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; document&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getElementById&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;passwordField&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; modalDialog&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; document&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getElementById&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;modal-dialog&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; modalDialogButton&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; document&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getElementById&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;modal-dialog-button&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; modalDialogTitle&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; document&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getElementById&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;modal-dialog-title&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; modalDialogMessage&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; document&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;getElementById&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;modal-dialog-message&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; firstUrl&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; null&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; inIframe&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; source&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; null&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;window&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;opener&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      inIframe&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      source&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; window&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;opener&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;window&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;parent&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; window&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      source&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; window&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      console&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;log&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;closing&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      window&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;close&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; closeWindow&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      closedByCode&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      window&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;close&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; showWaiting&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;text&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;text&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        text&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Please wait...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      infoMessage&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;innerHTML&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; text&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      pleaseWait&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;style&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;display&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;block&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      form&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;style&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;display&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;none&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; hideWaiting&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      pleaseWait&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;style&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;display&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;none&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      form&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;style&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;display&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;block&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      window&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;onbeforeunload&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; null&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; showMessage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;title&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; message&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; callback&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; buttonText&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      modalDialog&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;style&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;display&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;block&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      modalDialogTitle&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;innerHTML&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; title&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      modalDialogMessage&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;innerHTML&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;typeof&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; message&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        modalDialogMessage&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;innerHTML&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; message&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        modalDialogMessage&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;appendChild&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;message&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      modalDialogMessage&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;appendChild&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;document&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;createElement&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;br&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;buttonText&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        buttonText&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Ok&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      modalDialogButton&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;innerHTML&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; buttonText&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      modalDialogButton&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;onclick&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        modalDialogButton&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;onclick&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; null&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        modalDialog&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;style&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;display&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;none&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;callback&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;          callback&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; hideMessage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      modalDialog&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;style&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;display&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;none&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      modalDialogButton&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;onclick&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; null&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; sendAsync&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;url&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; callback&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; request&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; XMLHttpRequest&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      request&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;open&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;POST&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; url&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      request&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;setRequestHeader&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Content-Type&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;application&#x2F;json&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      request&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;onreadystatechange&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;request&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;readyState&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ===&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;          var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; result&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; request&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;responseText&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;          var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; error&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; null&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;          try&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;            result&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; JSON&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;parse&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; catch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; message&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;result&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;result&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;error&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;message&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ?&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; result&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;error&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;message&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; :&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Invalid JSON RPC response: &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; JSON&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;stringify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;            error&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt;message&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;message&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;JsonParse&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;          callback&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;error&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      try&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        request&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;send&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;JSON&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;stringify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; catch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        callback&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;message&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;CONNECTION ERROR: Couldn&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;t connect to node &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; url&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;noConnection&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addBlocky&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;message&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; icon&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; blockies&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;create&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        seed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        size&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        scale&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      message&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;appendChild&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;icon&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; askAuthorization&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;transactionInfo&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; requireUnlock&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sourceWindow&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; transactionInfo&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ?&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; transactionInfo&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; :&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; gasProvided&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; transactionInfo&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; gasPriceProvided&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; transactionInfo&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;gasPrice&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; gasPrice&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BigNumber&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;gasPriceProvided&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;16&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BigNumber&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;gasProvided&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;16&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; weiValue&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BigNumber&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;16&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; gasWeiValue&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; gas&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;times&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;gasPrice&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; etherValue&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; weiValue&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;dividedBy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BigNumber&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; gasEtherValue&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; gasWeiValue&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;dividedBy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BigNumber&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      hideWaiting&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      message&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;innerHTML&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      addBlocky&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;message&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;transactionInfo&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; span&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; document&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;createElement&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;span&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      span&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;style&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;font-size:3em;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      span&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;innerHTML&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;amp;#x2192;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      message&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;appendChild&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;span&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      addBlocky&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;message&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;transactionInfo&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      message&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;appendChild&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;document&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;createElement&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;br&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; textSpan&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; document&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;createElement&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;span&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      message&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;appendChild&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;textSpan&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      textSpan&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;innerHTML&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; etherValue&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;toFormat&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; ether &amp;lt;br&#x2F;&amp;gt;  + gas cost (&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; gasEtherValue&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;toFormat&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; ether )&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;requireUnlock&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        passwordField&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;style&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;display&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;block&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        passwordField&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;style&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;display&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;none&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      cancelButton&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;onclick&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        sourceWindow&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;postMessage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;result&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;null&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;error&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;message&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Not Authorized&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;cancel&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;firstUrl&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        closeWindow&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      var&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; submitFunc&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        window&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;onbeforeunload&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;event&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;          if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;closedByCode&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;do not close now as a transaction is progress, this cannot be canceled and we wait for an answer&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;requireUnlock&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;          if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;password&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;            password&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;style&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;border&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2px solid red&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;          password&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;style&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;border&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;none&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;          var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; params&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;transactionInfo&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;password&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;          showWaiting&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Please wait...&amp;lt;br&#x2F;&amp;gt;Do not close the window.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;          sendAsync&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;url&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;999992&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;method&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;personal_unlockAccount&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;params&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;params&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;error&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; result&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;error&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;              showMessage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Error unlocking account&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Please retry.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; hideWaiting&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;              sendAsync&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;url&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;error&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;                sourceWindow&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;postMessage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;result&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;result&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;error&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;error&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;firstUrl&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;                closeWindow&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;          sendAsync&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;url&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;error&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; result&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;error&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;              processMessage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sourceWindow&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;              sourceWindow&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;postMessage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;result&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;result&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;error&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;error&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;firstUrl&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;              closeWindow&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;          showWaiting&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      form&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;onsubmit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; submitFunc&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      confirmButton&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;onclick&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; submitFunc&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; needToAndCanUnlockAccount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;url&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;callback&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      sendAsync&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;url&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;9999990&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;method&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_sign&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;params&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xc6888fa8d57087278718986382264244252f8d57087278718986382264244252f&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;error&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; result&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;error&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;          sendAsync&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;url&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;9999991&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;method&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;personal_listAccounts&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;params&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;error&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;error&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; result&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;error&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;              callback&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;              callback&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;true&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;          callback&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; receiveMessage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;event&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;event&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;source&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; source&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;firstUrl&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;firstUrl&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; event&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;origin&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;          return&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        firstUrl&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; event&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;origin&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      hideMessage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      noMessageReceivedYet&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; event&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      try&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        processMessage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;event&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;source&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;catch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        event&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;source&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;postMessage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;result&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;null&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;error&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;message&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Could not process message data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;notValid&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;firstUrl&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        showMessage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Error&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The application has sent invalid data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;          closeWindow&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; allowedMethods&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;       &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;web3_clientVersion&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;web3_sha3&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;net_version&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;net_peerCount&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;net_listening&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_protocolVersion&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_syncing&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_coinbase&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_mining&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_hashrate&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_gasPrice&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_accounts&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_blockNumber&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_getBalance&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_getStorageAt&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_getTransactionCount&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_getBlockTransactionCountByHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_getBlockTransactionCountByNumber&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_getUncleCountByBlockHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_getUncleCountByBlockNumber&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_getCode&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_sendRawTransaction&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_call&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_estimateGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_getBlockByHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_getBlockByNumber&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_getTransactionByHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_getTransactionByBlockHashAndIndex&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_getTransactionByBlockNumberAndIndex&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_getTransactionReceipt&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_getUncleByBlockHashAndIndex&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_getUncleByBlockNumberAndIndex&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_getCompilers&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_compileLLL&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_compileSolidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_compileSerpent&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_newFilter&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_newBlockFilter&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_newPendingTransactionFilter&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_uninstallFilter&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_getFilterChanges&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_getFilterLogs&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_getLogs&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_getWork&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_submitWork&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_submitHashrate&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ,&amp;quot;shh_post&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ,&amp;quot;shh_version&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ,&amp;quot;shh_newIdentity&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ,&amp;quot;shh_hasIdentity&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ,&amp;quot;shh_newGroup&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ,&amp;quot;shh_addToGroup&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ,&amp;quot;shh_newFilter&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ,&amp;quot;shh_uninstallFilter&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ,&amp;quot;shh_getFilterChanges&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ,&amp;quot;shh_getMessages&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; isMethodAllowed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;method&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; allowedMethods&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;indexOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;method&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; processMessage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; sourceWindow&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;inIframe&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;isMethodAllowed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;method&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;          sendAsync&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;url&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;error&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;            sourceWindow&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;postMessage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;result&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;result&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;error&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;error&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;firstUrl&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;          sourceWindow&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;postMessage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;result&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;null&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;error&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;message&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;method (&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;method&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;) not allowed in iframe&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;notAllowed&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;firstUrl&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;method&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;eth_sendTransaction&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; transactionInfo&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; null&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;params&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;          if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;params&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;params&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;gasPrice&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;params&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;params&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;from&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;            transactionInfo&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;params&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;transactionInfo&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; null&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;          needToAndCanUnlockAccount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;transactionInfo&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;url&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;requireUnlock&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;canUnlock&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;requireUnlock&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; canUnlock&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;              askAuthorization&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;transactionInfo&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sourceWindow&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;requireUnlock&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;              askAuthorization&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;transactionInfo&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sourceWindow&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;requireUnlock&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;canUnlock&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;              var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; messageHtml&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; document&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;createElement&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;span&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;              addBlocky&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;messageHtml&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;transactionInfo&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;              messageHtml&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;appendChild&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;document&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;createElement&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;br&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;              var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; span&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; document&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;createElement&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;span&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;              span&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;innerHTML&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;You need to unlock your account first : &amp;lt;br&#x2F;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; transactionInfo&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;              messageHtml&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;appendChild&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;span&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;              showMessage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Account Locked&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;messageHtml&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;                processMessage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sourceWindow&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Done&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;          sourceWindow&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;postMessage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;result&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;null&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;error&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;message&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Need to specify from , to, gas and gasPrice&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;notValid&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;firstUrl&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;          closeWindow&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        sourceWindow&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;postMessage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;result&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;null&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;error&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;message&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;method (&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;method&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;) not allowed in popup&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;notAllowed&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;firstUrl&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;     &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checkMessageNotReceived&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;noMessageReceivedYet&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        showMessage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Error&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;No transaction received. Please make sure popup are not blocked.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;          closeWindow&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    setTimeout&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;checkMessageNotReceived&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    window&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;addEventListener&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;message&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; receiveMessage&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;source&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      source&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;postMessage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ready&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;script&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;body&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt;html&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Change difficulty adjustment to target mean block time including uncles</title>
        <published>2016-04-28T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/100/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/100/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:100"
            label="EIP-100" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/100/">&lt;h3 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h3&gt;
&lt;p&gt;Currently, the formula to compute the difficulty of a block includes the following logic:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;adj_factor&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;99&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;child_diff&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;difficulty&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;difficulty&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BLOCK_DIFF_FACTOR&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; adj_factor&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;difficulty&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MIN_DIFF&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= BYZANTIUM_FORK_BLKNUM&lt;&#x2F;code&gt;, we change the first line to the following:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;adj_factor&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;uncles&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 9&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;99&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h3&gt;
&lt;p&gt;This new formula ensures that the difficulty adjustment algorithm targets a constant average rate of blocks produced including uncles, and so ensures a highly predictable issuance rate that cannot be manipulated upward by manipulating the uncle rate. A formula that accounts for the exact number of included uncles:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;adj_factor&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;uncles&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 9&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;99&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;can be fairly easily seen to be (to within a tolerance of ~3&#x2F;4194304) mathematically equivalent to assuming that a block with &lt;code&gt;k&lt;&#x2F;code&gt; uncles is equivalent to a sequence of &lt;code&gt;k+1&lt;&#x2F;code&gt; blocks that all appear with the exact same timestamp, and this is likely the simplest possible way to accomplish the desired effect. But since the exact formula depends on the full block and not just the header, we are instead using an approximate formula that accomplishes almost the same effect but has the benefit that it depends only on the block header (as you can check the uncle hash against the blank hash).&lt;&#x2F;p&gt;
&lt;p&gt;Changing the denominator from 10 to 9 ensures that the block time remains roughly the same (in fact, it should decrease by ~3% given the current uncle rate of 7%).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;references&quot;&gt;References&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;EIP 100 issue and discussion: https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;100&lt;&#x2F;li&gt;
&lt;li&gt;https:&#x2F;&#x2F;bitslog.wordpress.com&#x2F;2016&#x2F;04&#x2F;28&#x2F;uncle-mining-an-ethereum-consensus-protocol-flaw&#x2F;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Ethereum Domain Name Service - Specification</title>
        <published>2016-04-04T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Nick Johnson</name><email>arachnid@notdot.net</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/137/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/137/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:137"
            label="ERC-137" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/137/">&lt;h1 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h1&gt;
&lt;p&gt;This draft EIP describes the details of the Ethereum Name Service, a proposed protocol and ABI definition that provides flexible resolution of short, human-readable names to service and resource identifiers. This permits users and developers to refer to human-readable and easy to remember names, and permits those names to be updated as necessary when the underlying resource (contract, content-addressed data, etc) changes.&lt;&#x2F;p&gt;
&lt;p&gt;The goal of domain names is to provide stable, human-readable identifiers that can be used to specify network resources. In this way, users can enter a memorable string, such as &#x27;vitalik.wallet&#x27; or &#x27;www.mysite.swarm&#x27;, and be directed to the appropriate resource. The mapping between names and resources may change over time, so a user may change wallets, a website may change hosts, or a swarm document may be updated to a new version, without the domain name changing. Further, a domain need not specify a single resource; different record types allow the same domain to reference different resources. For instance, a browser may resolve &#x27;mysite.swarm&#x27; to the IP address of its server by fetching its A (address) record, while a mail client may resolve the same address to a mail server by fetching its MX (mail exchanger) record.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h1&gt;
&lt;p&gt;Existing &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;wiki&#x2F;wiki&#x2F;Registrar-ABI&quot;&gt;specifications&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum.gitbooks.io&#x2F;frontier-guide&#x2F;content&#x2F;registrar_services.html&quot;&gt;implementations&lt;&#x2F;a&gt; for name resolution in Ethereum provide basic functionality, but suffer several shortcomings that will significantly limit their long-term usefulness:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A single global namespace for all names with a single &#x27;centralised&#x27; resolver.&lt;&#x2F;li&gt;
&lt;li&gt;Limited or no support for delegation and sub-names&#x2F;sub-domains.&lt;&#x2F;li&gt;
&lt;li&gt;Only one record type, and no support for associating multiple copies of a record with a domain.&lt;&#x2F;li&gt;
&lt;li&gt;Due to a single global implementation, no support for multiple different name allocation systems.&lt;&#x2F;li&gt;
&lt;li&gt;Conflation of responsibilities: Name resolution, registration, and whois information.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Use-cases that these features would permit include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Support for subnames&#x2F;sub-domains - eg, live.mysite.tld and forum.mysite.tld.&lt;&#x2F;li&gt;
&lt;li&gt;Multiple services under a single name, such as a DApp hosted in Swarm, a Whisper address, and a mail server.&lt;&#x2F;li&gt;
&lt;li&gt;Support for DNS record types, allowing blockchain hosting of &#x27;legacy&#x27; names. This would permit an Ethereum client such as Mist to resolve the address of a traditional website, or the mail server for an email address, from a blockchain name.&lt;&#x2F;li&gt;
&lt;li&gt;DNS gateways, exposing ENS domains via the Domain Name Service, providing easier means for legacy clients to resolve and connect to blockchain services.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The first two use-cases, in particular, can be observed everywhere on the present-day internet under DNS, and we believe them to be fundamental features of a name service that will continue to be useful as the Ethereum platform develops and matures.&lt;&#x2F;p&gt;
&lt;p&gt;The normative parts of this document does not specify an implementation of the proposed system; its purpose is to document a protocol that different resolver implementations can adhere to in order to facilitate consistent name resolution. An appendix provides sample implementations of resolver contracts and libraries, which should be treated as illustrative examples only.&lt;&#x2F;p&gt;
&lt;p&gt;Likewise, this document does not attempt to specify how domains should be registered or updated, or how systems can find the owner responsible for a given domain. Registration is the responsibility of registrars, and is a governance matter that will necessarily vary between top-level domains.&lt;&#x2F;p&gt;
&lt;p&gt;Updating of domain records can also be handled separately from resolution. Some systems, such as swarm, may require a well defined interface for updating domains, in which event we anticipate the development of a standard for this.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h1&gt;
&lt;h2 id=&quot;overview&quot;&gt;Overview&lt;&#x2F;h2&gt;
&lt;p&gt;The ENS system comprises three main parts:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The ENS registry&lt;&#x2F;li&gt;
&lt;li&gt;Resolvers&lt;&#x2F;li&gt;
&lt;li&gt;Registrars&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The registry is a single contract that provides a mapping from any registered name to the resolver responsible for it, and permits the owner of a name to set the resolver address, and to create subdomains, potentially with different owners to the parent domain.&lt;&#x2F;p&gt;
&lt;p&gt;Resolvers are responsible for performing resource lookups for a name - for instance, returning a contract address, a content hash, or IP address(es) as appropriate. The resolver specification, defined here and extended in other EIPs, defines what methods a resolver may implement to support resolving different types of records.&lt;&#x2F;p&gt;
&lt;p&gt;Registrars are responsible for allocating domain names to users of the system, and are the only entities capable of updating the ENS; the owner of a node in the ENS registry is its registrar. Registrars may be contracts or externally owned accounts, though it is expected that the root and top-level registrars, at a minimum, will be implemented as contracts.&lt;&#x2F;p&gt;
&lt;p&gt;Resolving a name in ENS is a two-step process. First, the ENS registry is called with the name to resolve, after hashing it using the procedure described below. If the record exists, the registry returns the address of its resolver. Then, the resolver is called, using the method appropriate to the resource being requested. The resolver then returns the desired result.&lt;&#x2F;p&gt;
&lt;p&gt;For example, suppose you wish to find the address of the token contract associated with &#x27;beercoin.eth&#x27;. First, get the resolver:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; node&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; namehash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;beercoin.eth&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; resolver&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ens&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;resolver&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;node&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Then, ask the resolver for the address for the contract:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; resolver&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;node&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Because the &lt;code&gt;namehash&lt;&#x2F;code&gt; procedure depends only on the name itself, this can be precomputed and inserted into a contract, removing the need for string manipulation, and permitting O(1) lookup of ENS records regardless of the number of components in the raw name.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;name-syntax&quot;&gt;Name Syntax&lt;&#x2F;h2&gt;
&lt;p&gt;ENS names must conform to the following syntax:&lt;&#x2F;p&gt;
&lt;pre&gt;&amp;lt;domain&gt; ::= &amp;lt;label&gt; | &amp;lt;domain&gt; &quot;.&quot; &amp;lt;label&gt;
&amp;lt;label&gt; ::= any valid string label per [UTS46](https:&#x2F;&#x2F;unicode.org&#x2F;reports&#x2F;tr46&#x2F;)
&lt;&#x2F;pre&gt;
&lt;p&gt;In short, names consist of a series of dot-separated labels. Each label must be a valid normalised label as described in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;unicode.org&#x2F;reports&#x2F;tr46&#x2F;&quot;&gt;UTS46&lt;&#x2F;a&gt; with the options &lt;code&gt;transitional=false&lt;&#x2F;code&gt; and &lt;code&gt;useSTD3AsciiRules=true&lt;&#x2F;code&gt;. For Javascript implementations, a &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.npmjs.com&#x2F;package&#x2F;idna-uts46&quot;&gt;library&lt;&#x2F;a&gt; is available that normalises and checks names.&lt;&#x2F;p&gt;
&lt;p&gt;Note that while upper and lower case letters are allowed in names, the UTS46 normalisation process case-folds labels before hashing them, so two names with different case but identical spelling will produce the same namehash.&lt;&#x2F;p&gt;
&lt;p&gt;Labels and domains may be of any length, but for compatibility with legacy DNS, it is recommended that labels be restricted to no more than 64 characters each, and complete ENS names to no more than 255 characters. For the same reason, it is recommended that labels do not start or end with hyphens, or start with digits.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;namehash-algorithm&quot;&gt;namehash algorithm&lt;&#x2F;h2&gt;
&lt;p&gt;Before being used in ENS, names are hashed using the &#x27;namehash&#x27; algorithm. This algorithm recursively hashes components of the name, producing a unique, fixed-length string for any valid input domain. The output of namehash is referred to as a &#x27;node&#x27;.&lt;&#x2F;p&gt;
&lt;p&gt;Pseudocode for the namehash algorithm is as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def namehash(name):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  if name == &amp;#39;&amp;#39;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return &amp;#39;\0&amp;#39; * 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  else:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    label, _, remainder = name.partition(&amp;#39;.&amp;#39;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return sha3(namehash(remainder) + sha3(label))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Informally, the name is split into labels, each label is hashed. Then, starting with the last component, the previous output is concatenated with the label hash and hashed again. The first component is concatenated with 32 &#x27;0&#x27; bytes. Thus, &#x27;mysite.swarm&#x27; is processed as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;node = &amp;#39;\0&amp;#39; * 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;node = sha3(node + sha3(&amp;#39;swarm&amp;#39;))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;node = sha3(node + sha3(&amp;#39;mysite&amp;#39;))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Implementations should conform to the following test vectors for namehash:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;namehash(&amp;#39;&amp;#39;) = 0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;namehash(&amp;#39;eth&amp;#39;) = 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;namehash(&amp;#39;foo.eth&amp;#39;) = 0xde9b09fd7c5f901e23a3f19fecc54828e9c848539801e86591bd9801b019f84f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;registry-specification&quot;&gt;Registry specification&lt;&#x2F;h2&gt;
&lt;p&gt;The ENS registry contract exposes the following functions:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Returns the owner (registrar) of the specified node.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; resolver&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Returns the resolver for the specified node.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ttl&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Returns the time-to-live (TTL) of the node; that is, the maximum duration for which a node&#x27;s information may be cached.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Transfers ownership of a node to another registrar. This function may only be called by the current owner of &lt;code&gt;node&lt;&#x2F;code&gt;. A successful call to this function logs the event &lt;code&gt;Transfer(bytes32 indexed, address)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setSubnodeOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; label&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Creates a new node, &lt;code&gt;sha3(node, label)&lt;&#x2F;code&gt; and sets its owner to &lt;code&gt;owner&lt;&#x2F;code&gt;, or updates the node with a new owner if it already exists. This function may only be called by the current owner of &lt;code&gt;node&lt;&#x2F;code&gt;. A successful call to this function logs the event &lt;code&gt;NewOwner(bytes32 indexed, bytes32 indexed, address)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setResolver&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; resolver&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Sets the resolver address for &lt;code&gt;node&lt;&#x2F;code&gt;. This function may only be called by the owner of &lt;code&gt;node&lt;&#x2F;code&gt;. A successful call to this function logs the event &lt;code&gt;NewResolver(bytes32 indexed, address)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setTTL&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ttl&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Sets the TTL for a node. A node&#x27;s TTL applies to the &#x27;owner&#x27; and &#x27;resolver&#x27; records in the registry, as well as to any information returned by the associated resolver.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;resolver-specification&quot;&gt;Resolver specification&lt;&#x2F;h2&gt;
&lt;p&gt;Resolvers may implement any subset of the record types specified here. Where a record types specification requires a resolver to provide multiple functions, the resolver MUST implement either all or none of them. Resolvers MUST specify a fallback function that throws.&lt;&#x2F;p&gt;
&lt;p&gt;Resolvers have one mandatory function:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; function is documented in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;EIP-165&lt;&#x2F;a&gt;, and returns true if the resolver implements the interface specified by the provided 4 byte identifier. An interface identifier consists of the XOR of the function signature hashes of the functions provided by that interface; in the degenerate case of single-function interfaces, it is simply equal to the signature hash of that function. If a resolver returns &lt;code&gt;true&lt;&#x2F;code&gt; for &lt;code&gt;supportsInterface()&lt;&#x2F;code&gt;, it must implement the functions specified in that interface.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;supportsInterface&lt;&#x2F;code&gt; must always return true for &lt;code&gt;0x01ffc9a7&lt;&#x2F;code&gt;, which is the interface ID of &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; itself.&lt;&#x2F;p&gt;
&lt;p&gt;Currently standardised resolver interfaces are specified in the table below.&lt;&#x2F;p&gt;
&lt;p&gt;The following interfaces are defined:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Interface name&lt;&#x2F;th&gt;&lt;th&gt;Interface hash&lt;&#x2F;th&gt;&lt;th&gt;Specification&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;addr&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;0x3b3b57de&lt;&#x2F;td&gt;&lt;td&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;137&#x2F;#addr&quot;&gt;Contract address&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;name&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;0x691f3431&lt;&#x2F;td&gt;&lt;td&gt;#181&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ABI&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;0x2203ab56&lt;&#x2F;td&gt;&lt;td&gt;#205&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;pubkey&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;0xc8690233&lt;&#x2F;td&gt;&lt;td&gt;#619&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;EIPs may define new interfaces to be added to this registry.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;contract-address-interface&quot;&gt;&lt;a name=&quot;addr&quot;&gt;&lt;&#x2F;a&gt;Contract Address Interface&lt;&#x2F;h3&gt;
&lt;p&gt;Resolvers wishing to support contract address resources must provide the following function:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;If the resolver supports &lt;code&gt;addr&lt;&#x2F;code&gt; lookups but the requested node does not have an addr record, the resolver MUST return the zero address.&lt;&#x2F;p&gt;
&lt;p&gt;Clients resolving the &lt;code&gt;addr&lt;&#x2F;code&gt; record MUST check for a zero return value, and treat this in the same manner as a name that does not have a resolver specified - that is, refuse to send funds to or interact with the address. Failure to do this can result in users accidentally sending funds to the 0 address.&lt;&#x2F;p&gt;
&lt;p&gt;Changes to an address MUST trigger the following event:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AddrChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; a&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h1 id=&quot;appendix-a-registry-implementation&quot;&gt;Appendix A: Registry Implementation&lt;&#x2F;h1&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ENS&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Record&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        address&lt;&#x2F;span&gt;&lt;span&gt; resolver&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint64&lt;&#x2F;span&gt;&lt;span&gt; ttl&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;Record&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; records&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NewOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; label&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NewResolver&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; resolver&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    modifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; only_owner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;records&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;owner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; throw&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        _&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ENS&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        records&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;owner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; records&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; resolver&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; records&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;resolver&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ttl&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; records&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;ttl&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; only_owner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;node&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        records&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;owner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setSubnodeOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; label&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; only_owner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;node&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        var subnode &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; sha3&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; label&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        NewOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; label&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        records&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;subnode&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;owner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setResolver&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; resolver&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; only_owner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;node&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        NewResolver&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; resolver&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        records&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;resolver &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; resolver&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setTTL&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ttl&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; only_owner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;node&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        NewTTL&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; ttl&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        records&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;ttl &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; ttl&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h1 id=&quot;appendix-b-sample-resolver-implementations&quot;&gt;Appendix B: Sample Resolver Implementations&lt;&#x2F;h1&gt;
&lt;h3 id=&quot;built-in-resolver&quot;&gt;Built-in resolver&lt;&#x2F;h3&gt;
&lt;p&gt;The simplest possible resolver is a contract that acts as its own name resolver by implementing the contract address resource profile:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; DoSomethingUseful&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Other code&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; interfaceID &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x3b3b57de&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span&gt; interfaceID &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x01ffc9a7&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        throw&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Such a contract can be inserted directly into the ENS registry, eliminating the need for a separate resolver contract in simple use-cases. However, the requirement to &#x27;throw&#x27; on unknown function calls may interfere with normal operation of some types of contract.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;standalone-resolver&quot;&gt;Standalone resolver&lt;&#x2F;h3&gt;
&lt;p&gt;A basic resolver that implements the contract address profile, and allows only its owner to update records:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Resolver&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AddrChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; a&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; addresses&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    modifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; only_owner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;msg.sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; throw&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        _&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Resolver&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        owner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; addresses&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setAddr&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; only_owner&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        addresses&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        AddrChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; interfaceID &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x3b3b57de&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span&gt; interfaceID &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x01ffc9a7&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        throw&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;After deploying this contract, use it by updating the ENS registry to reference this contract for a name, then calling &lt;code&gt;setAddr()&lt;&#x2F;code&gt; with the same node to set the contract address it will resolve to.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;public-resolver&quot;&gt;Public resolver&lt;&#x2F;h3&gt;
&lt;p&gt;Similar to the resolver above, this contract only supports the contract address profile, but uses the ENS registry to determine who should be allowed to update entries:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PublicResolver&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AddrChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; a&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ContentChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;, &lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ENS ens&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    mapping&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; addresses&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    modifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; only_owner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ens&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; throw&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        _&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PublicResolver&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ensAddr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ens &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ENS&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ensAddr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ret&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ret &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; addresses&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setAddr&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; only_owner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;node&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        addresses&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        AddrChanged&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; supportsInterface&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes4&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interfaceID&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; interfaceID &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x3b3b57de&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span&gt; interfaceID &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x01ffc9a7&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        throw&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h1 id=&quot;appendix-c-sample-registrar-implementation&quot;&gt;Appendix C: Sample Registrar Implementation&lt;&#x2F;h1&gt;
&lt;p&gt;This registrar allows users to register names at no cost if they are the first to request them.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FIFSRegistrar&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ENS ens&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; rootNode&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FIFSRegistrar&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; ensAddr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ens &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ENS&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ensAddr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        rootNode &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; node&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; register&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; subnode&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        var node &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; sha3&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;rootNode&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; subnode&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        var currentOwner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; ens&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;currentOwner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; currentOwner &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg.sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            throw&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ens&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;setSubnodeOwner&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;rootNode&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; subnode&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;</content>
    </entry>
    <entry xml:lang="en">
        <title>URI Scheme with Metadata, Value and Bytecode</title>
        <published>2016-02-17T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Alex Van de Sande</name><uri>https://github.com/alexvansande</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/67/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/67" />
        

        <id>https://wg-eips.ritovision.com/67/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:67"
            label="ERC-67" />
        

        
        

        
        <summary type="html">Format for encoding transactions into a URI</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/67/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal (inspired by BIP 21) defines a format for encoding a transaction into a URI, including a recipient, number of ethers (possibly zero), and optional bytecode.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Imagine these scenarios:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;* An exchange or a instant converter like ShapeShift wants to create a single Ethereum address for payments that will be converted into credit in their internal system or output bitcoin to an address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;* A store wants to show a QR code to a client that will pop up a payment for exactly 12.34 ethers, which contains metadata on the product being bought.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;* A betting site wants to provide a link that the user can click on his site and it will open a default Ethereum wallet and execute a specific contract with given parameters.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;* A dapp in Mist wants to simply ask the user to sign a transaction with a specific ABI in a single call.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In all these scenarios, the provider wants to internally set up a transaction, with a recipient, an associated number of ethers (or none) and optional bytecode, all without requiring any fuss from the end user that is expected simply to choose a sender and authorise the transaction.&lt;&#x2F;p&gt;
&lt;p&gt;Currently implementations for this are wonky: ShapeShift creates tons of temporary addresses and uses an internal system to check which one correspond to which metadata, there isn&#x27;t any standard way for stores that want payment in ether to put specific metadata about price on the call and any app implementing contracts will have to use different solutions depending on the client they are targeting.&lt;&#x2F;p&gt;
&lt;p&gt;The proposal goes beyond address, and also includes optional bytecode and value. Of course this would make the link longer, but it should not be something visible to the user. Instead it should be shown as a visual code (QR or otherwise), a link, or some other way to pass the information.&lt;&#x2F;p&gt;
&lt;p&gt;If properly implemented in all wallets, this should make execution of contracts directly from wallets much simpler as the wallet client only needs to put the bytecode obtained by reading the QR code.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;If we follow the bitcoin standard, the result would be:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; ethereum:&amp;lt;address&amp;gt;[?value=&amp;lt;value&amp;gt;][?gas=&amp;lt;suggestedGas&amp;gt;][?data=&amp;lt;bytecode&amp;gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Other data could be added, but ideally the client should take them from elsewhere in the blockchain, so instead of having a &lt;code&gt;label&lt;&#x2F;code&gt; or a &lt;code&gt;message&lt;&#x2F;code&gt; to be displayed to the users, these should be read from an identity system or metadata on the transaction itself.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;example-1&quot;&gt;Example 1&lt;&#x2F;h3&gt;
&lt;p&gt;Clicking this link would open a transaction that would try to send &lt;em&gt;5 unicorns&lt;&#x2F;em&gt; to address &lt;em&gt;deadbeef&lt;&#x2F;em&gt;. The user would then simply approve, based on each wallet UI.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; ethereum:0x89205A3A3b2A69De6Dbf7f01ED13B2108B2c43e7?gas=100000&amp;amp;data=0xa9059cbb00000000000000000000000000000000000000000000000000000000deadbeef0000000000000000000000000000000000000000000000000000000000000005&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;without-bytecode&quot;&gt;Without Bytecode&lt;&#x2F;h4&gt;
&lt;p&gt;Alternatively, the bytecode could be generated by the client and the request would be in plain text:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; ethereum:&amp;lt;address&amp;gt;[?value=&amp;lt;value&amp;gt;][?gas=&amp;lt;suggestedGas&amp;gt;][?function=nameOfFunction(param)]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;example-2&quot;&gt;Example 2&lt;&#x2F;h3&gt;
&lt;p&gt;This is the same function as above, to send 5 unicorns from he sender to &lt;em&gt;deadbeef&lt;&#x2F;em&gt;, but now with a more readable function, which the client converts to bytecode.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; ethereum:0x89205A3A3b2A69De6Dbf7f01ED13B2108B2c43e7?gas=100000&amp;amp;function=transfer(address 0xdeadbeef, uint 5)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;TODO&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;TODO&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Signed Data Standard</title>
        <published>2016-01-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Martin Holst Swende</name><uri>https://github.com/holiman</uri>
	</author>
	
	<author>
		<name>Nick Johnson</name><email>arachnid@notdot.net</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/191/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/191" />
        

        <id>https://wg-eips.ritovision.com/191/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:191"
            label="ERC-191" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/191/">&lt;h1 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h1&gt;
&lt;p&gt;This ERC proposes a specification about how to handle signed data in Ethereum contracts.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h1&gt;
&lt;p&gt;Several multisignature wallet implementations have been created which accepts &lt;code&gt;presigned&lt;&#x2F;code&gt; transactions. A &lt;code&gt;presigned&lt;&#x2F;code&gt; transaction is a chunk of binary &lt;code&gt;signed_data&lt;&#x2F;code&gt;, along with signature (&lt;code&gt;r&lt;&#x2F;code&gt;, &lt;code&gt;s&lt;&#x2F;code&gt; and &lt;code&gt;v&lt;&#x2F;code&gt;). The interpretation of the &lt;code&gt;signed_data&lt;&#x2F;code&gt; has not been specified, leading to several problems:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Standard Ethereum transactions can be submitted as &lt;code&gt;signed_data&lt;&#x2F;code&gt;. An Ethereum transaction can be unpacked, into the following components: &lt;code&gt;RLP&amp;lt;nonce, gasPrice, startGas, to, value, data&amp;gt;&lt;&#x2F;code&gt; (hereby called &lt;code&gt;RLPdata&lt;&#x2F;code&gt;), &lt;code&gt;r&lt;&#x2F;code&gt;, &lt;code&gt;s&lt;&#x2F;code&gt; and &lt;code&gt;v&lt;&#x2F;code&gt;. If there are no syntactical constraints on &lt;code&gt;signed_data&lt;&#x2F;code&gt;, this means that &lt;code&gt;RLPdata&lt;&#x2F;code&gt; can be used as a syntactically valid &lt;code&gt;presigned&lt;&#x2F;code&gt; transaction.&lt;&#x2F;li&gt;
&lt;li&gt;Multisignature wallets have also had the problem that a &lt;code&gt;presigned&lt;&#x2F;code&gt; transaction has not been tied to a particular &lt;code&gt;validator&lt;&#x2F;code&gt;, i.e a specific wallet. Example:
&lt;ol&gt;
&lt;li&gt;Users &lt;code&gt;A&lt;&#x2F;code&gt;, &lt;code&gt;B&lt;&#x2F;code&gt; and &lt;code&gt;C&lt;&#x2F;code&gt; have the &lt;code&gt;2&#x2F;3&lt;&#x2F;code&gt;-wallet &lt;code&gt;X&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Users &lt;code&gt;A&lt;&#x2F;code&gt;, &lt;code&gt;B&lt;&#x2F;code&gt; and &lt;code&gt;D&lt;&#x2F;code&gt; have the &lt;code&gt;2&#x2F;3&lt;&#x2F;code&gt;-wallet &lt;code&gt;Y&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;User &lt;code&gt;A&lt;&#x2F;code&gt; and &lt;code&gt;B&lt;&#x2F;code&gt; submit &lt;code&gt;presigned&lt;&#x2F;code&gt; transactions to &lt;code&gt;X&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Attacker can now reuse their presigned transactions to &lt;code&gt;X&lt;&#x2F;code&gt;, and submit to &lt;code&gt;Y&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;We propose the following format for &lt;code&gt;signed_data&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x19 &amp;lt;1 byte version&amp;gt; &amp;lt;version specific data&amp;gt; &amp;lt;data to sign&amp;gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The initial &lt;code&gt;0x19&lt;&#x2F;code&gt; byte is intended to ensure that the &lt;code&gt;signed_data&lt;&#x2F;code&gt; is not valid RLP.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;For a single byte whose value is in the [0x00, 0x7f] range, that byte is its own RLP encoding.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;That means that any &lt;code&gt;signed_data&lt;&#x2F;code&gt; cannot be one RLP-structure, but a 1-byte &lt;code&gt;RLP&lt;&#x2F;code&gt; payload followed by something else. Thus, any EIP-191 &lt;code&gt;signed_data&lt;&#x2F;code&gt; can never be an Ethereum transaction.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, &lt;code&gt;0x19&lt;&#x2F;code&gt; has been chosen because since ethereum&#x2F;go-ethereum#2940 , the following is prepended before hashing in personal_sign:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;quot;\x19Ethereum Signed Message:\n&amp;quot; + len(message).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Using &lt;code&gt;0x19&lt;&#x2F;code&gt; thus makes it possible to extend the scheme by defining a version &lt;code&gt;0x45&lt;&#x2F;code&gt; (&lt;code&gt;E&lt;&#x2F;code&gt;) to handle these kinds of signatures.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;registry-of-version-bytes&quot;&gt;Registry of version bytes&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Version byte&lt;&#x2F;th&gt;&lt;th&gt;EIP&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x00&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;191&#x2F;&quot;&gt;191&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Data with intended validator&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x01&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;712&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Structured data&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x45&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;191&#x2F;&quot;&gt;191&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;personal_sign&lt;&#x2F;code&gt; messages&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;version-0x00&quot;&gt;Version &lt;code&gt;0x00&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x19 &amp;lt;0x00&amp;gt; &amp;lt;intended validator address&amp;gt; &amp;lt;data to sign&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The version &lt;code&gt;0x00&lt;&#x2F;code&gt; has &lt;code&gt;&amp;lt;intended validator address&amp;gt;&lt;&#x2F;code&gt; for the version specific data. In the case of a Multisig wallet that perform an execution based on a passed signature, the validator address is the address of the Multisig itself. The data to sign could be any arbitrary data.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;version-0x01&quot;&gt;Version &lt;code&gt;0x01&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The version &lt;code&gt;0x01&lt;&#x2F;code&gt; is for structured data as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;version-0x45-e&quot;&gt;Version &lt;code&gt;0x45&lt;&#x2F;code&gt; (E)&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x19 &amp;lt;0x45 (E)&amp;gt; &amp;lt;thereum Signed Message:\n&amp;quot; + len(message)&amp;gt; &amp;lt;data to sign&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The version &lt;code&gt;0x45&lt;&#x2F;code&gt; (E) has &lt;code&gt;&amp;lt;thereum Signed Message:\n&quot; + len(message)&amp;gt;&lt;&#x2F;code&gt; for the version-specific data. The data to sign can be any arbitrary data.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;NB: The &lt;code&gt;E&lt;&#x2F;code&gt; in &lt;code&gt;Ethereum Signed Message&lt;&#x2F;code&gt; refers to the version byte 0x45. The character &lt;code&gt;E&lt;&#x2F;code&gt; is &lt;code&gt;0x45&lt;&#x2F;code&gt; in hexadecimal which makes the remainder, &lt;code&gt;thereum Signed Message:\n + len(message)&lt;&#x2F;code&gt;, the version-specific data.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h3 id=&quot;example&quot;&gt;Example&lt;&#x2F;h3&gt;
&lt;p&gt;The following snippets has been written in Solidity 0.8.0.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;version-0x00-1&quot;&gt;Version &lt;code&gt;0x00&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; signatureBasedExecution&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; target&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; payload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; v&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; s&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; payable&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Arguments when calculating hash to validate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 1: byte(0x19) - the initial 0x19 byte&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 2: byte(0) - the version byte&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 3: address(this) - the validator address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 4-6 : Application specific data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    bytes32&lt;&#x2F;span&gt;&lt;span&gt; hash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;byte&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x19&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; byte&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; payload&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; recovering the signer from the hash and the signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    addressRecovered &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; ecrecover&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; s&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; logic of the wallet&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if (addressRecovered == owner) executeOnTarget(target, payload);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Mixed-case checksum address encoding</title>
        <published>2016-01-14T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><email>vitalik.buterin@ethereum.org</email>
	</author>
	
	<author>
		<name>Alex Van de Sande</name><email>avsa@ethereum.org</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/55/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/eips/issues/55" />
        

        <id>https://wg-eips.ritovision.com/55/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        

        
        <category
            term="tag:eip:55"
            label="ERC-55" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/55/">&lt;h1 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h1&gt;
&lt;p&gt;Code:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; eth_utils&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checksum_encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Takes a 20-byte binary address as input&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    hex_addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;hex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    checksummed_buffer&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Treat the hex address as ascii&#x2F;utf-8 for keccak256 hashing&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    hashed_address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; eth_utils&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;keccak&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;text&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;hex_addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;hex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Iterate over each character in the hex address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; nibble_index&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; character&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; enumerate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;hex_addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; character&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0123456789&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; We can&amp;#39;t upper-case the decimal digits&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            checksummed_buffer&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; character&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        elif&lt;&#x2F;span&gt;&lt;span&gt; character&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;abcdef&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check if the corresponding hex digit (nibble) in the hash is 8 or higher&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            hashed_address_nibble&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;hashed_address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;nibble_index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 16&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; hashed_address_nibble&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 7&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                checksummed_buffer&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; character&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;upper&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                checksummed_buffer&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; character&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            raise&lt;&#x2F;span&gt;&lt;span&gt; eth_utils&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;ValidationError&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;                f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Unrecognized hex character &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;{&lt;&#x2F;span&gt;&lt;span&gt;character&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;!r&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; at position &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;{&lt;&#x2F;span&gt;&lt;span&gt;nibble_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; checksummed_buffer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; test&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;addr_str&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    addr_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; eth_utils&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;to_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;hexstr&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;addr_str&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    checksum_encoded&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; checksum_encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addr_bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; checksum_encoded&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; addr_str&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;{&lt;&#x2F;span&gt;&lt;span&gt;checksum_encoded&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; != expected &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;{&lt;&#x2F;span&gt;&lt;span&gt;addr_str&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;test&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;test&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xfB6916095ca1df60bB79Ce92cE3Ea74c37c5d359&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;test&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xdbF03B407c01E7cD3CBea99509d93f8DDDC8C6FB&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;test&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xD1220A0cf47c7B9Be7A2E6BA89F429762e7b9aDb&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In English, convert the address to hex, but if the &lt;code&gt;i&lt;&#x2F;code&gt;th digit is a letter (ie. it&#x27;s one of &lt;code&gt;abcdef&lt;&#x2F;code&gt;) print it in uppercase if the &lt;code&gt;4*i&lt;&#x2F;code&gt;th bit of the hash of the lowercase hexadecimal address is 1 otherwise print it in lowercase.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h1&gt;
&lt;p&gt;Benefits:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Backwards compatible with many hex parsers that accept mixed case, allowing it to be easily introduced over time&lt;&#x2F;li&gt;
&lt;li&gt;Keeps the length at 40 characters&lt;&#x2F;li&gt;
&lt;li&gt;On average there will be 15 check bits per address, and the net probability that a randomly generated address if mistyped will accidentally pass a check is 0.0247%. This is a ~50x improvement over ICAP, but not as good as a 4-byte check code.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h1 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h1&gt;
&lt;p&gt;In javascript:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; createKeccakHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;keccak&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; toChecksumAddress&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;toLowerCase&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;replace&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; createKeccakHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;update&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;digest&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ret&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;var&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;parseInt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;hash&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 16&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      ret&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;toUpperCase&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;      ret&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ret&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;gt; toChecksumAddress(&amp;#39;0xfb6916095ca1df60bb79ce92ce3ea74c37c5d359&amp;#39;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;#39;0xfB6916095ca1df60bB79Ce92cE3Ea74c37c5d359&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note that the input to the Keccak256 hash is the lowercase hexadecimal string (i.e. the hex address encoded as ASCII):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    var hash = createKeccakHash(&amp;#39;keccak256&amp;#39;).update(Buffer.from(address.toLowerCase(), &amp;#39;ascii&amp;#39;)).digest()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h1 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h1&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# All caps&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x52908400098527886E0F7030069857D2E4169EE7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x8617E340B3D01FA5F11F306F4090FD50E238070D&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# All Lower&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xde709f2102306220921060314715629080e2fb77&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x27b1fdb04752bbc536007a920d24acb045561c26&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Normal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xfB6916095ca1df60bB79Ce92cE3Ea74c37c5d359&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xdbF03B407c01E7cD3CBea99509d93f8DDDC8C6FB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xD1220A0cf47c7B9Be7A2E6BA89F429762e7b9aDb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;</content>
    </entry>
    <entry xml:lang="en">
        <title>devp2p Forward Compatibility Requirements for Homestead</title>
        <published>2015-12-18T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Felix Lange</name><email>felix@ethdev.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/8/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="networking"
                label="Networking" />
            
        

        
        <category
            term="tag:eip:8"
            label="EIP-8" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8/">&lt;h3 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP introduces new forward-compatibility requirements for implementations of the
devp2p Wire Protocol, the RLPx Discovery Protocol and the RLPx TCP Transport Protocol.
Clients which implement EIP-8 behave according to Postel&#x27;s Law:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Be conservative in what you do, be liberal in what you accept from others.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h3 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h3&gt;
&lt;p&gt;Implementations of &lt;strong&gt;the devp2p Wire Protocol&lt;&#x2F;strong&gt; should ignore the version number of hello
packets. When sending the hello packet, the version element should be set to the highest
devp2p version supported. Implementations should also ignore any additional list elements
at the end of the hello packet.&lt;&#x2F;p&gt;
&lt;p&gt;Similarly, implementations of &lt;strong&gt;the RLPx Discovery Protocol&lt;&#x2F;strong&gt; should not validate the
version number of the ping packet, ignore any additional list elements in any packet, and
ignore any data after the first RLP value in any packet. Discovery packets with unknown
packet type should be discarded silently. The maximum size of any discovery packet is
still 1280 bytes.&lt;&#x2F;p&gt;
&lt;p&gt;Finally, implementations of &lt;strong&gt;the RLPx TCP Transport protocol&lt;&#x2F;strong&gt; should accept a new
encoding for the encrypted key establishment handshake packets. If an EIP-8 style RLPx
&lt;code&gt;auth-packet&lt;&#x2F;code&gt; is received, the corresponding &lt;code&gt;ack-packet&lt;&#x2F;code&gt; should be sent using the rules
below.&lt;&#x2F;p&gt;
&lt;p&gt;Decoding the RLP data in &lt;code&gt;auth-body&lt;&#x2F;code&gt; and &lt;code&gt;ack-body&lt;&#x2F;code&gt; should ignore mismatches of &lt;code&gt;auth-vsn&lt;&#x2F;code&gt;
and &lt;code&gt;ack-vsn&lt;&#x2F;code&gt;, any additional list elements and any trailing data after the list. During
the transitioning period (i.e. until the old format has been retired), implementations
should pad &lt;code&gt;auth-body&lt;&#x2F;code&gt; with at least 100 bytes of junk data. Adding a random amount in
range [100, 300] is recommended to vary the size of the packet.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;auth-vsn         = 4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;auth-size        = size of enc-auth-body, encoded as a big-endian 16-bit integer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;auth-body        = rlp.list(sig, initiator-pubk, initiator-nonce, auth-vsn)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;enc-auth-body    = ecies.encrypt(recipient-pubk, auth-body, auth-size)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;auth-packet      = auth-size || enc-auth-body&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ack-vsn          = 4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ack-size         = size of enc-ack-body, encoded as a big-endian 16-bit integer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ack-body         = rlp.list(recipient-ephemeral-pubk, recipient-nonce, ack-vsn)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;enc-ack-body     = ecies.encrypt(initiator-pubk, ack-body, ack-size)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ack-packet       = ack-size || enc-ack-body&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;where&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;X || Y&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    denotes concatenation of X and Y.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;X[:N]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    denotes an N-byte prefix of X.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;rlp.list(X, Y, Z, ...)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    denotes recursive encoding of [X, Y, Z, ...] as an RLP list.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sha3(MESSAGE)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    is the Keccak256 hash function as used by Ethereum.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ecies.encrypt(PUBKEY, MESSAGE, AUTHDATA)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    is the asymmetric authenticated encryption function as used by RLPx.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    AUTHDATA is authenticated data which is not part of the resulting ciphertext,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    but written to HMAC-256 before generating the message tag.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h3&gt;
&lt;p&gt;Changes to the devp2p protocols are hard to deploy because clients running an older
version will refuse communication if the version number or structure of the hello
(discovery ping, RLPx handshake) packet does not match local expectations.&lt;&#x2F;p&gt;
&lt;p&gt;Introducing forward-compatibility requirements as part of the Homestead consensus upgrade
will ensure that all client software in use on the Ethereum network can cope with future
network protocol upgrades (as long as backwards-compatibility is maintained).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h3&gt;
&lt;p&gt;The proposed changes address forward compatibility by applying Postel&#x27;s Law (also known as
the Robustness Principle) throughout the protocol stack. The merit and applicability of
this approach has been studied repeatedly since its original application in RFC 761. For a
recent perspective, see
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;queue.acm.org&#x2F;detail.cfm?id=1999945&quot;&gt;&quot;The Robustness Principle Reconsidered&quot; (Eric Allman, 2011)&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;changes-to-the-devp2p-wire-protocol&quot;&gt;Changes to the devp2p Wire Protocol&lt;&#x2F;h4&gt;
&lt;p&gt;All clients currently contain statements such as the following:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; pydevp2p&#x2F;p2p_protocol.py&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; proto&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;version&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    log&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;debug&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;incompatible network protocols&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; peer&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;proto&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;peer&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        expected&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;proto&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;version&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; received&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; proto&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;send_disconnect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;reason&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;reasons&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;incompatible_p2p_version&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;These checks make it impossible to change the version or structure of the hello packet.
Dropping them enables switching to a newer protocol version: Clients implementing a newer
version simply send a packet with higher version and possibly additional list elements.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If such a packet is received by a node with lower version, it will blindly assume that
the remote end is backwards-compatible and respond with the old handshake.&lt;&#x2F;li&gt;
&lt;li&gt;If the packet is received by a node with equal version, new features of the protocol can
be used.&lt;&#x2F;li&gt;
&lt;li&gt;If the packet is received by a node with higher version, it can enable
backwards-compatibility logic or drop the connection.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;changes-to-the-rlpx-discovery-protocol&quot;&gt;Changes to the RLPx Discovery Protocol&lt;&#x2F;h4&gt;
&lt;p&gt;The relaxation of discovery packet decoding rules largely codifies current practice. Most
existing implementations do not care about the number of list elements (an exception being
go-ethereum) and do not reject nodes with mismatching version. This behaviour is not
guaranteed by the spec, though.&lt;&#x2F;p&gt;
&lt;p&gt;If adopted, the change makes it possible to deploy protocol changes in a similar manner to
the devp2p hello change: simply bump the version and send additional information. Older
clients will ignore the additional elements and can continue to operate even when the
majority of the network has moved on to a newer protocol.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;changes-to-the-rlpx-tcp-handshake&quot;&gt;Changes to the RLPx TCP Handshake&lt;&#x2F;h4&gt;
&lt;p&gt;Discussions of the RLPx v5 changes (chunked packets, change to key derivation) have
faltered in part because the v4 handshake encoding provides only one in-band way to add a
version number: shortening the random portion of the nonce. Even if the RLPx v5 handshake
proposal were accepted, future upgrades are hard because the handshake packet is a fixed
size ECIES ciphertext with known layout.&lt;&#x2F;p&gt;
&lt;p&gt;I propose the following changes to the handshake packets:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Adding the length of the ciphertext as a plaintext header.&lt;&#x2F;li&gt;
&lt;li&gt;Encoding the body of the handshake as RLP.&lt;&#x2F;li&gt;
&lt;li&gt;Adding a version number to both packets in place of the token flag (unused).&lt;&#x2F;li&gt;
&lt;li&gt;Removing the hash of the ephemeral public key (it is redundant).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;These changes make it possible to upgrade the RLPx TCP transport protocol in the same
manner as described for the other protocols, i.e. by adding list elements and bumping the
version. Since this is the first change to the RLPx handshake packet, we can seize the
opportunity to remove all currently unused fields.&lt;&#x2F;p&gt;
&lt;p&gt;Additional data is permitted (and in fact required) after the RLP list because the
handshake packet needs to grow in order to be distinguishable from the old format.
Clients can employ logic such as the following pseudocode to handle both formats
simultaneously.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;go&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;packet&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; read&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;307&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; connection&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; decrypt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;packet&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; process as old format&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    size&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; unpack_16bit_big_endian&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;packet&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    packet&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; read&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;size&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 307&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; connection&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;decrypt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;packet&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; error&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; process as new format&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The plain text size prefix is perhaps the most controversial aspect of this document. It
has been argued that the prefix aids adversaries that seek to filter and identify RLPx
connections on the network level.&lt;&#x2F;p&gt;
&lt;p&gt;This is largely a question of how much effort the adversary is willing to expense. If the
recommendation to randomise the lengths is followed, pure pattern-based packet
recognition is unlikely to succeed.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;For typical firewall operators, blocking all connections whose first two bytes form an
integer in range [300,600] is probably too invasive. Port-based blocking would be
a more effective measure to filter most RLPx traffic.&lt;&#x2F;li&gt;
&lt;li&gt;For an attacker who can afford to correlate many criteria, the size prefix would ease
recognition because it adds to the indicator set. However, such an attacker could also
be expected to read or participate in RLPx Discovery traffic, which would be sufficient
to enable blocking of RLPx TCP connections whatever their format is.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP is backwards-compatible, all valid version 4 packets are still accepted.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;go-ethereum&#x2F;pull&#x2F;2091&quot;&gt;go-ethereum&lt;&#x2F;a&gt;
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;libweb3core&#x2F;pull&#x2F;46&quot;&gt;libweb3core&lt;&#x2F;a&gt;
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;pydevp2p&#x2F;pull&#x2F;32&quot;&gt;pydevp2p&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;test-vectors&quot;&gt;Test Vectors&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;devp2p-base-protocol&quot;&gt;devp2p Base Protocol&lt;&#x2F;h4&gt;
&lt;p&gt;devp2p hello packet advertising version 22 and containing a few additional list elements:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;f87137916b6e6574682f76302e39312f706c616e39cdc5836574683dc6846d6f726b1682270fb840&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;fda1cff674c90c9a197539fe3dfb53086ace64f83ed7c6eabec741f7f381cc803e52ab2cd55d5569&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;bce4347107a310dfd5f88a010cd2ffd1005ca406f1842877c883666f6f836261720304&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;rlpx-discovery-protocol&quot;&gt;RLPx Discovery Protocol&lt;&#x2F;h4&gt;
&lt;p&gt;Implementations should accept the following encoded discovery packets as valid.
The packets are signed using the secp256k1 node key&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;ping packet with version 4, additional list elements:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;e9614ccfd9fc3e74360018522d30e1419a143407ffcce748de3e22116b7e8dc92ff74788c0b6663a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;aa3d67d641936511c8f8d6ad8698b820a7cf9e1be7155e9a241f556658c55428ec0563514365799a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;4be2be5a685a80971ddcfa80cb422cdd0101ec04cb847f000001820cfa8215a8d790000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;000000000000000000018208ae820d058443b9a3550102&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;ping packet with version 555, additional list elements and additional random data:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;577be4349c4dd26768081f58de4c6f375a7a22f3f7adda654d1428637412c3d7fe917cadc56d4e5e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;7ffae1dbe3efffb9849feb71b262de37977e7c7a44e677295680e9e38ab26bee2fcbae207fba3ff3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;d74069a50b902a82c9903ed37cc993c50001f83e82022bd79020010db83c4d001500000000abcdef&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;12820cfa8215a8d79020010db885a308d313198a2e037073488208ae82823a8443b9a355c5010203&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;040531b9019afde696e582a78fa8d95ea13ce3297d4afb8ba6433e4154caa5ac6431af1b80ba7602&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;3fa4090c408f6b4bc3701562c031041d4702971d102c9ab7fa5eed4cd6bab8f7af956f7d565ee191&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;7084a95398b6a21eac920fe3dd1345ec0a7ef39367ee69ddf092cbfe5b93e5e568ebc491983c09c7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;6d922dc3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;pong packet with additional list elements and additional random data:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;09b2428d83348d27cdf7064ad9024f526cebc19e4958f0fdad87c15eb598dd61d08423e0bf66b206&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;9869e1724125f820d851c136684082774f870e614d95a2855d000f05d1648b2d5945470bc187c2d2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;216fbe870f43ed0909009882e176a46b0102f846d79020010db885a308d313198a2e037073488208&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ae82823aa0fbc914b16819237dcd8801d7e53f69e9719adecb3cc0e790c57e91ca4461c9548443b9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;a355c6010203c2040506a0c969a58f6f9095004c0177a6b47f451530cab38966a25cca5cb58f0555&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;42124e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;findnode packet with additional list elements and additional random data:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;c7c44041b9f7c7e41934417ebac9a8e1a4c6298f74553f2fcfdcae6ed6fe53163eb3d2b52e39fe91&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;831b8a927bf4fc222c3902202027e5e9eb812195f95d20061ef5cd31d502e47ecb61183f74a504fe&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;04c51e73df81f25c4d506b26db4517490103f84eb840ca634cae0d49acb401d8a4c6b6fe8c55b70d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;115bf400769cc1400f3258cd31387574077f301b421bc84df7266c44e9e6d569fc56be0081290476&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;7bf5ccd1fc7f8443b9a35582999983999999280dc62cc8255c73471e0a61da0c89acdc0e035e260a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dd7fc0c04ad9ebf3919644c91cb247affc82b69bd2ca235c71eab8e49737c937a2c396&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;neighbours packet with additional list elements and additional random data:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;c679fc8fe0b8b12f06577f2e802d34f6fa257e6137a995f6f4cbfc9ee50ed3710faf6e66f932c4c8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;d81d64343f429651328758b47d3dbc02c4042f0fff6946a50f4a49037a72bb550f3a7872363a83e1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;b9ee6469856c24eb4ef80b7535bcf99c0004f9015bf90150f84d846321163782115c82115db84031&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;55e1427f85f10a5c9a7755877748041af1bcd8d474ec065eb33df57a97babf54bfd2103575fa8291&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;15d224c523596b401065a97f74010610fce76382c0bf32f84984010203040101b840312c55512422&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cf9b8a4097e9a6ad79402e87a15ae909a4bfefa22398f03d20951933beea1e4dfa6f968212385e82&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;9f04c2d314fc2d4e255e0d3bc08792b069dbf8599020010db83c4d001500000000abcdef12820d05&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;820d05b84038643200b172dcfef857492156971f0e6aa2c538d8b74010f8e140811d53b98c765dd2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;d96126051913f44582e8c199ad7c6d6819e9a56483f637feaac9448aacf8599020010db885a308d3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;13198a2e037073488203e78203e8b8408dcab8618c3253b558d459da53bd8fa68935a719aff8b811&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;197101a4b2b47dd2d47295286fc00cc081bb542d760717d1bdd6bec2c37cd72eca367d6dd3b9df73&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;8443b9a355010203b525a138aa34383fec3d2719a0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;rlpx-handshake&quot;&gt;RLPx Handshake&lt;&#x2F;h4&gt;
&lt;p&gt;In these test vectors, node A initiates a connection with node B.
The values contained in all packets are given below:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Static Key A:    49a7b37aa6f6645917e7b807e9d1c00d4fa71f18343b0d4122a4d2df64dd6fee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Static Key B:    b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Ephemeral Key A: 869d6ecf5211f1cc60418a13b9d870b22959d0c16f02bec714c960dd2298a32d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Ephemeral Key B: e238eb8e04fee6511ab04c6dd3c89ce097b11f25d584863ac2b6d5b35b1847e4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Nonce A:         7e968bba13b6c50e2c4cd7f241cc0d64d1ac25c7f5952df231ac6a2bda8ee5d6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Nonce B:         559aead08264d5795d3909718cdd05abd49572e84fe55590eef31a88a08fdffd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;(Auth₁)  RLPx v4 format (sent from A to B):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;048ca79ad18e4b0659fab4853fe5bc58eb83992980f4c9cc147d2aa31532efd29a3d3dc6a3d89eaf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;913150cfc777ce0ce4af2758bf4810235f6e6ceccfee1acc6b22c005e9e3a49d6448610a58e98744&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ba3ac0399e82692d67c1f58849050b3024e21a52c9d3b01d871ff5f210817912773e610443a9ef14&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;2e91cdba0bd77b5fdf0769b05671fc35f83d83e4d3b0b000c6b2a1b1bba89e0fc51bf4e460df3105&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;c444f14be226458940d6061c296350937ffd5e3acaceeaaefd3c6f74be8e23e0f45163cc7ebd7622&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0f0128410fd05250273156d548a414444ae2f7dea4dfca2d43c057adb701a715bf59f6fb66b2d1d2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0f2c703f851cbf5ac47396d9ca65b6260bd141ac4d53e2de585a73d1750780db4c9ee4cd4d225173&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;a4592ee77e2bd94d0be3691f3b406f9bba9b591fc63facc016bfa8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;(Auth₂) EIP-8 format with version 4 and no additional list elements (sent from A to B):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01b304ab7578555167be8154d5cc456f567d5ba302662433674222360f08d5f1534499d3678b513b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0fca474f3a514b18e75683032eb63fccb16c156dc6eb2c0b1593f0d84ac74f6e475f1b8d56116b84&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;9634a8c458705bf83a626ea0384d4d7341aae591fae42ce6bd5c850bfe0b999a694a49bbbaf3ef6c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;da61110601d3b4c02ab6c30437257a6e0117792631a4b47c1d52fc0f8f89caadeb7d02770bf999cc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;147d2df3b62e1ffb2c9d8c125a3984865356266bca11ce7d3a688663a51d82defaa8aad69da39ab6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;d5470e81ec5f2a7a47fb865ff7cca21516f9299a07b1bc63ba56c7a1a892112841ca44b6e0034dee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;70c9adabc15d76a54f443593fafdc3b27af8059703f88928e199cb122362a4b35f62386da7caad09&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;c001edaeb5f8a06d2b26fb6cb93c52a9fca51853b68193916982358fe1e5369e249875bb8d0d0ec3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;6f917bc5e1eafd5896d46bd61ff23f1a863a8a8dcd54c7b109b771c8e61ec9c8908c733c0263440e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;2aa067241aaa433f0bb053c7b31a838504b148f570c0ad62837129e547678c5190341e4f1693956c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;3bf7678318e2d5b5340c9e488eefea198576344afbdf66db5f51204a6961a63ce072c8926c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;(Auth₃) EIP-8 format with version 56 and 3 additional list elements (sent from A to B):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01b8044c6c312173685d1edd268aa95e1d495474c6959bcdd10067ba4c9013df9e40ff45f5bfd6f7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;2471f93a91b493f8e00abc4b80f682973de715d77ba3a005a242eb859f9a211d93a347fa64b597bf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;280a6b88e26299cf263b01b8dfdb712278464fd1c25840b995e84d367d743f66c0e54a586725b7bb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;f12acca27170ae3283c1073adda4b6d79f27656993aefccf16e0d0409fe07db2dc398a1b7e8ee93b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cd181485fd332f381d6a050fba4c7641a5112ac1b0b61168d20f01b479e19adf7fdbfa0905f63352&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;bfc7e23cf3357657455119d879c78d3cf8c8c06375f3f7d4861aa02a122467e069acaf513025ff19&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;6641f6d2810ce493f51bee9c966b15c5043505350392b57645385a18c78f14669cc4d960446c1757&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;1b7c5d725021babbcd786957f3d17089c084907bda22c2b2675b4378b114c601d858802a55345a15&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;116bc61da4193996187ed70d16730e9ae6b3bb8787ebcaea1871d850997ddc08b4f4ea668fbf3740&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;7ac044b55be0908ecb94d4ed172ece66fd31bfdadf2b97a8bc690163ee11f5b575a4b44e36e2bfb2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;f0fce91676fd64c7773bac6a003f481fddd0bae0a1f31aa27504e2a533af4cef3b623f4791b2cca6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;d490&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;(Ack₁) RLPx v4 format (sent from B to A):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;049f8abcfa9c0dc65b982e98af921bc0ba6e4243169348a236abe9df5f93aa69d99cadddaa387662&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;b0ff2c08e9006d5a11a278b1b3331e5aaabf0a32f01281b6f4ede0e09a2d5f585b26513cb794d963&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;5a57563921c04a9090b4f14ee42be1a5461049af4ea7a7f49bf4c97a352d39c8d02ee4acc416388c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;1c66cec761d2bc1c72da6ba143477f049c9d2dde846c252c111b904f630ac98e51609b3b1f58168d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dca6505b7196532e5f85b259a20c45e1979491683fee108e9660edbf38f3add489ae73e3dda2c71b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;d1497113d5c755e942d1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;(Ack₂) EIP-8 format with version 4 and no additional list elements (sent from B to A):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01ea0451958701280a56482929d3b0757da8f7fbe5286784beead59d95089c217c9b917788989470&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;b0e330cc6e4fb383c0340ed85fab836ec9fb8a49672712aeabbdfd1e837c1ff4cace34311cd7f4de&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;05d59279e3524ab26ef753a0095637ac88f2b499b9914b5f64e143eae548a1066e14cd2f4bd7f814&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;c4652f11b254f8a2d0191e2f5546fae6055694aed14d906df79ad3b407d94692694e259191cde171&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ad542fc588fa2b7333313d82a9f887332f1dfc36cea03f831cb9a23fea05b33deb999e85489e645f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;6aab1872475d488d7bd6c7c120caf28dbfc5d6833888155ed69d34dbdc39c1f299be1057810f34fb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;e754d021bfca14dc989753d61c413d261934e1a9c67ee060a25eefb54e81a4d14baff922180c395d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;3f998d70f46f6b58306f969627ae364497e73fc27f6d17ae45a413d322cb8814276be6ddd13b885b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;201b943213656cde498fa0e9ddc8e0b8f8a53824fbd82254f3e2c17e8eaea009c38b4aa0a3f306e8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;797db43c25d68e86f262e564086f59a2fc60511c42abfb3057c247a8a8fe4fb3ccbadde17514b7ac&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;8000cdb6a912778426260c47f38919a91f25f4b5ffb455d6aaaf150f7e5529c100ce62d6d92826a7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;1778d809bdf60232ae21ce8a437eca8223f45ac37f6487452ce626f549b3b5fdee26afd2072e4bc7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;5833c2464c805246155289f4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;(Ack₃) EIP-8 format with version 57 and 3 additional list elements (sent from B to A):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01f004076e58aae772bb101ab1a8e64e01ee96e64857ce82b1113817c6cdd52c09d26f7b90981cd7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ae835aeac72e1573b8a0225dd56d157a010846d888dac7464baf53f2ad4e3d584531fa203658fab0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;3a06c9fd5e35737e417bc28c1cbf5e5dfc666de7090f69c3b29754725f84f75382891c561040ea1d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dc0d8f381ed1b9d0d4ad2a0ec021421d847820d6fa0ba66eaf58175f1b235e851c7e2124069fbc20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;2888ddb3ac4d56bcbd1b9b7eab59e78f2e2d400905050f4a92dec1c4bdf797b3fc9b2f8e84a482f3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;d800386186712dae00d5c386ec9387a5e9c9a1aca5a573ca91082c7d68421f388e79127a5177d4f8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;590237364fd348c9611fa39f78dcdceee3f390f07991b7b47e1daa3ebcb6ccc9607811cb17ce51f1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;c8c2c5098dbdd28fca547b3f58c01a424ac05f869f49c6a34672ea2cbbc558428aa1fe48bbfd6115&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;8b1b735a65d99f21e70dbc020bfdface9f724a0d1fb5895db971cc81aa7608baa0920abb0a565c9c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;436e2fd13323428296c86385f2384e408a31e104670df0791d93e743a3a5194ee6b076fb6323ca59&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;3011b7348c16cf58f66b9633906ba54a2ee803187344b394f75dd2e663a57b956cb830dd7a908d4f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;39a2336a61ef9fda549180d4ccde21514d117b6c6fd07a9102b5efe710a32af4eeacae2cb3b1dec0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;35b9593b48b9d3ca4c13d245d5f04169b0b1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Node B derives the connection secrets for (Auth₂, Ack₂) as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;aes-secret = 80e8632c05fed6fc2a13b0f8d31a3cf645366239170ea067065aba8e28bac487&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mac-secret = 2ea74ec5dae199227dff1af715362700e989d889d7a493cb0639691efb8e5f98&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Running B&#x27;s &lt;code&gt;ingress-mac&lt;&#x2F;code&gt; keccak state on the string &quot;foo&quot; yields the hash&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ingress-mac(&amp;quot;foo&amp;quot;) = 0c7ec6340062cc46f5e9f1e3cf86f8c8c403c5a0964f5df0ebd34a75ddc86db5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h3&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Gas Usage for `RETURN` and `CALL*`</title>
        <published>2015-11-22T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Christian Reitwiessner</name><email>c@ethdev.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/5/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:5"
            label="EIP-5" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5/">&lt;h3 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP makes it possible to call functions that return strings and other dynamically-sized arrays.
Currently, when another contract &#x2F; function is called from inside the Ethereum Virtual Machine,
the size of the output has to be specified in advance. It is of course possible to give a larger
size, but gas also has to be paid for memory that is not written to, which makes returning
dynamically-sized data both costly and inflexible to the extent that it is actually unusable.&lt;&#x2F;p&gt;
&lt;p&gt;The solution proposed in this EIP is to charge gas only for memory that is actually written to at
the time the &lt;code&gt;CALL&lt;&#x2F;code&gt; returns.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h3&gt;
&lt;p&gt;The gas and memory semantics for &lt;code&gt;CALL&lt;&#x2F;code&gt;, &lt;code&gt;CALLCODE&lt;&#x2F;code&gt; and &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; (called later as &lt;code&gt;CALL*&lt;&#x2F;code&gt;)
are changed in the following way (&lt;code&gt;CREATE&lt;&#x2F;code&gt; does not write to memory and is thus unaffected):&lt;&#x2F;p&gt;
&lt;p&gt;Suppose the arguments to &lt;code&gt;CALL*&lt;&#x2F;code&gt; are &lt;code&gt;gas, address, value, input_start, input_size, output_start, output_size&lt;&#x2F;code&gt;,
then, at the beginning of the opcode, gas for growing memory is only charged for &lt;code&gt;input_start + input_size&lt;&#x2F;code&gt;, but not
for &lt;code&gt;output_start + output_size&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;If the called contract returns data of size &lt;code&gt;n&lt;&#x2F;code&gt;, the memory of the calling contract is grown to
&lt;code&gt;output_start + min(output_size, n)&lt;&#x2F;code&gt; (and the calling contract is charged gas for that) and the
output is written to the area &lt;code&gt;[output_start, output_start + min(n, output_size))&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The calling contract can run out of gas both at the beginning of the opcode and at the end
of the opcode.&lt;&#x2F;p&gt;
&lt;p&gt;After the call, the &lt;code&gt;MSIZE&lt;&#x2F;code&gt; opcode should return the size the memory was actually grown to.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h3&gt;
&lt;p&gt;In general, it is good practice to reserve a certain memory area for the output of a call,
because letting a subroutine write to arbitrary areas in memory might be dangerous. On the
other hand, it is often hard to know the output size of a call prior to performing the call:
The data could be in the storage of another contract which is generally inaccessible and
determining its size would require another call to that contract.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore, charging gas for areas of memory that are not actually written to is unnecessary.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal tries to solve both problems: A caller can choose to provide a gigantic area of
memory at the end of their memory area. The callee can &quot;write&quot; to it by returning and the
caller is only charged for the memory area that is actually written.&lt;&#x2F;p&gt;
&lt;p&gt;This makes it possible to return dynamic data like strings and dynamically-sized arrays
in a very flexible way. It is even possible to determine the size of the returned data:
If the caller uses &lt;code&gt;output_start = MSIZE&lt;&#x2F;code&gt; and &lt;code&gt;output_size = 2**256-1&lt;&#x2F;code&gt;, the area of
memory that was actually written to is &lt;code&gt;(output_start, MSIZE)&lt;&#x2F;code&gt; (here, &lt;code&gt;MSIZE&lt;&#x2F;code&gt; as evaluated
after the call). This is important because it allows &quot;proxy&quot; contracts
which call other contracts whose interface they do not know and just return their output,
i.e. they both forward the input and the output. For this, it is important that the caller
(1) does not need to know the size of the output in advance and (2) can determine the
size of the output after the call.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h3&gt;
&lt;p&gt;This way of dealing with the problem requires a minimal change to the Ethereum Virtual Machine.
Other means of achieving a similar goal would have changed the opcodes themselves or
the number of their arguments. Another possibility would have been to only change the
gas mechanics if &lt;code&gt;output_size&lt;&#x2F;code&gt; is equal to &lt;code&gt;2**256-1&lt;&#x2F;code&gt;. Since the main difficulty in the
implementation is that memory has to be enlarged at two points in the code around &lt;code&gt;CALL&lt;&#x2F;code&gt;,
this would not have been a simplification.&lt;&#x2F;p&gt;
&lt;p&gt;At an earlier stage, it was proposed to also add the size of the returned data on the stack,
but the &lt;code&gt;MSIZE&lt;&#x2F;code&gt; mechanism described above should be sufficient and is much better
backwards compatible.&lt;&#x2F;p&gt;
&lt;p&gt;Some comments are available at https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;8&lt;&#x2F;p&gt;
&lt;h3 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h3&gt;
&lt;p&gt;This proposal changes the semantics of contracts because contracts can access the gas counter
and the size of memory.&lt;&#x2F;p&gt;
&lt;p&gt;On the other hand, it is unlikely that existing contracts will suffer from this change due to
the following reasons:&lt;&#x2F;p&gt;
&lt;p&gt;Gas:&lt;&#x2F;p&gt;
&lt;p&gt;The VM will not charge more gas than before. Usually, contracts are written in a way such
that their semantics do not change if they use up less gas. If more gas were used, contracts
might go out-of-gas if they perform a tight estimation for gas needed by sub-calls. Here,
contracts might only return more gas to their callers.&lt;&#x2F;p&gt;
&lt;p&gt;Memory size:&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;MSIZE&lt;&#x2F;code&gt; opcode is typically used to allocate memory at a previously unused spot.
The change in semantics affects existing contracts in two ways:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Overlaps in allocated memory. By using &lt;code&gt;CALL&lt;&#x2F;code&gt;, a contract might have wanted to allocate
a certain slice of memory, even if that is not written to by the called contract.
Subsequent uses of &lt;code&gt;MSIZE&lt;&#x2F;code&gt; to allocate memory might overlap with this slice that is
now smaller than before the change. It is, though, unlikely that such contracts exist.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Memory addresses change. Rather general, if memory is allocated using &lt;code&gt;MSIZE&lt;&#x2F;code&gt;, the
addresses of objects in memory will be different after the change. Contracts should
all be written in a way, though, such that objects in memory are &lt;em&gt;relocatable&lt;&#x2F;em&gt;,
i.e. their absolute position in memory and their relative position to other
objects does not matter. This is of course not the case for arrays, but they
are allocated in a single allocation and not with an intermediate &lt;code&gt;CALL&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h3&gt;
&lt;p&gt;VM implementers should take care not to grow the memory until the end of the call and after a check that sufficient
gas is still available. Typical uses of the EIP include &quot;reserving&quot; &lt;code&gt;2**256-1&lt;&#x2F;code&gt; bytes of memory for the output.&lt;&#x2F;p&gt;
&lt;p&gt;Python implementation:&lt;&#x2F;p&gt;
&lt;p&gt;old: http:&#x2F;&#x2F;vitalik.ca&#x2F;files&#x2F;old.py
new: http:&#x2F;&#x2F;vitalik.ca&#x2F;files&#x2F;new.py&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Renaming SUICIDE opcode</title>
        <published>2015-11-22T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Hudson Jameson</name><email>hudson@hudsonjameson.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/6/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="interface"
                label="Interface" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:6"
            label="EIP-6" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6/">&lt;h3 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h3&gt;
&lt;p&gt;The solution proposed in this EIP is to change the name of the &lt;code&gt;SUICIDE&lt;&#x2F;code&gt; opcode in Ethereum programming languages with &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h3&gt;
&lt;p&gt;Mental health is a very real issue for many people and small notions can make a difference. Those dealing with loss or depression would benefit from not seeing the word suicide in our programming languages. By some estimates, 350 million people worldwide suffer from depression. The semantics of Ethereum&#x27;s programming languages need to be reviewed often if we wish to grow our ecosystem to all types of developers.&lt;&#x2F;p&gt;
&lt;p&gt;An Ethereum security audit commissioned by DEVolution, GmbH and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;LeastAuthority&#x2F;ethereum-analyses&#x2F;blob&#x2F;master&#x2F;README.md&quot;&gt;performed by Least Authority&lt;&#x2F;a&gt; recommended the following:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Replace the instruction name &quot;suicide&quot; with a less connotative word like &quot;self-destruct&quot;, &quot;destroy&quot;, &quot;terminate&quot;, or &quot;close&quot;, especially since that is a term describing the natural conclusion of a contract.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;The primary reason for us to change the term suicide is to show that people matter more than code and Ethereum is a mature enough of a project to recognize the need for a change. Suicide is a heavy subject and we should make every effort possible to not affect those in our development community who suffer from depression or who have recently lost someone to suicide. Ethereum is a young platform and it will cause less headaches if we implement this change early on in its life.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; is added as an alias of &lt;code&gt;SUICIDE&lt;&#x2F;code&gt; opcode (rather than replacing it).
https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;solidity&#x2F;commit&#x2F;a8736b7b271dac117f15164cf4d2dfabcdd2c6fd
https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;serpent&#x2F;commit&#x2F;1106c3bdc8f1bd9ded58a452681788ff2e03ee7c&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Token Standard</title>
        <published>2015-11-19T00:00:00+00:00</published>
        <updated>2026-02-11T14:48:25+00:00</updated>
	
	
	<author>
		<name>Fabian Vogelsteller</name><email>fabian@ethereum.org</email>
	</author>
	
	<author>
		<name>Vitalik Buterin</name><email>vitalik.buterin@ethereum.org</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/20/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/20/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="erc"
                label="ERC" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:20"
            label="ERC-20" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/20/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;A standard interface for tokens.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The following standard allows for the implementation of a standard API for tokens within smart contracts.
This standard provides basic functionality to transfer tokens, as well as allow tokens to be approved so they can be spent by another on-chain third party.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;A standard interface allows any tokens on Ethereum to be re-used by other applications: from wallets to decentralized exchanges.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;token&quot;&gt;Token&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;methods&quot;&gt;Methods&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;NOTES&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The following specifications use syntax from Solidity &lt;code&gt;0.4.17&lt;&#x2F;code&gt; (or above)&lt;&#x2F;li&gt;
&lt;li&gt;Callers MUST handle &lt;code&gt;false&lt;&#x2F;code&gt; from &lt;code&gt;returns (bool success)&lt;&#x2F;code&gt;.  Callers MUST NOT assume that &lt;code&gt;false&lt;&#x2F;code&gt; is never returned!&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;name&quot;&gt;name&lt;&#x2F;h4&gt;
&lt;p&gt;Returns the name of the token - e.g. &lt;code&gt;&quot;MyToken&quot;&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;OPTIONAL - This method can be used to improve usability,
but interfaces and other contracts MUST NOT expect these values to be present.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;symbol&quot;&gt;symbol&lt;&#x2F;h4&gt;
&lt;p&gt;Returns the symbol of the token. E.g. &quot;HIX&quot;.&lt;&#x2F;p&gt;
&lt;p&gt;OPTIONAL - This method can be used to improve usability,
but interfaces and other contracts MUST NOT expect these values to be present.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; symbol&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;decimals&quot;&gt;decimals&lt;&#x2F;h4&gt;
&lt;p&gt;Returns the number of decimals the token uses - e.g. &lt;code&gt;8&lt;&#x2F;code&gt;, means to divide the token amount by &lt;code&gt;100000000&lt;&#x2F;code&gt; to get its user representation.&lt;&#x2F;p&gt;
&lt;p&gt;OPTIONAL - This method can be used to improve usability,
but interfaces and other contracts MUST NOT expect these values to be present.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; decimals&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint8&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;totalsupply&quot;&gt;totalSupply&lt;&#x2F;h4&gt;
&lt;p&gt;Returns the total token supply.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; totalSupply&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;balanceof&quot;&gt;balanceOf&lt;&#x2F;h4&gt;
&lt;p&gt;Returns the account balance of another account with address &lt;code&gt;_owner&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; balanceOf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; balance&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;transfer&quot;&gt;transfer&lt;&#x2F;h4&gt;
&lt;p&gt;Transfers &lt;code&gt;_value&lt;&#x2F;code&gt; amount of tokens to address &lt;code&gt;_to&lt;&#x2F;code&gt;, and MUST fire the &lt;code&gt;Transfer&lt;&#x2F;code&gt; event.
The function SHOULD &lt;code&gt;throw&lt;&#x2F;code&gt; if the message caller&#x27;s account balance does not have enough tokens to spend.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Note&lt;&#x2F;em&gt; Transfers of 0 values MUST be treated as normal transfers and fire the &lt;code&gt;Transfer&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;transferfrom&quot;&gt;transferFrom&lt;&#x2F;h4&gt;
&lt;p&gt;Transfers &lt;code&gt;_value&lt;&#x2F;code&gt; amount of tokens from address &lt;code&gt;_from&lt;&#x2F;code&gt; to address &lt;code&gt;_to&lt;&#x2F;code&gt;, and MUST fire the &lt;code&gt;Transfer&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;transferFrom&lt;&#x2F;code&gt; method is used for a withdraw workflow, allowing contracts to transfer tokens on your behalf.
This can be used for example to allow a contract to transfer tokens on your behalf and&#x2F;or to charge fees in sub-currencies.
The function SHOULD &lt;code&gt;throw&lt;&#x2F;code&gt; unless the &lt;code&gt;_from&lt;&#x2F;code&gt; account has deliberately authorized the sender of the message via some mechanism.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Note&lt;&#x2F;em&gt; Transfers of 0 values MUST be treated as normal transfers and fire the &lt;code&gt;Transfer&lt;&#x2F;code&gt; event.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transferFrom&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;approve&quot;&gt;approve&lt;&#x2F;h4&gt;
&lt;p&gt;Allows &lt;code&gt;_spender&lt;&#x2F;code&gt; to withdraw from your account multiple times, up to the &lt;code&gt;_value&lt;&#x2F;code&gt; amount. If this function is called again it overwrites the current allowance with &lt;code&gt;_value&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;NOTE&lt;&#x2F;strong&gt;: To prevent attack vectors like the one &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;docs.google.com&#x2F;document&#x2F;d&#x2F;1YLPtQxZu1UAvO9cZ1O2RPXBbT0mooh4DYKjA_jp-RLM&#x2F;&quot;&gt;described here&lt;&#x2F;a&gt; and discussed &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;20#issuecomment-263524729&quot;&gt;here&lt;&#x2F;a&gt;,
clients SHOULD make sure to create user interfaces in such a way that they set the allowance first to &lt;code&gt;0&lt;&#x2F;code&gt; before setting it to another value for the same spender.
THOUGH The contract itself shouldn&#x27;t enforce it, to allow backwards compatibility with contracts deployed before&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; approve&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; success&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;allowance&quot;&gt;allowance&lt;&#x2F;h4&gt;
&lt;p&gt;Returns the amount which &lt;code&gt;_spender&lt;&#x2F;code&gt; is still allowed to withdraw from &lt;code&gt;_owner&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; allowance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; remaining&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;events&quot;&gt;Events&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;transfer-1&quot;&gt;Transfer&lt;&#x2F;h4&gt;
&lt;p&gt;MUST trigger when tokens are transferred, including zero value transfers.&lt;&#x2F;p&gt;
&lt;p&gt;A token contract which creates new tokens SHOULD trigger a Transfer event with the &lt;code&gt;_from&lt;&#x2F;code&gt; address set to &lt;code&gt;0x0&lt;&#x2F;code&gt; when tokens are created.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transfer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _from&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;approval&quot;&gt;Approval&lt;&#x2F;h4&gt;
&lt;p&gt;MUST trigger on any successful call to &lt;code&gt;approve(address _spender, uint256 _value)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Approval&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _owner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _spender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; _value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;There are already plenty of ERC20-compliant tokens deployed on the Ethereum network.
Different implementations have been written by various teams that have different trade-offs: from gas saving to improved security.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;example-implementations-are-available-at&quot;&gt;Example implementations are available at&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;.&#x2F;assets&#x2F;OpenZeppelin-ERC20.sol&quot;&gt;OpenZeppelin implementation&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;.&#x2F;assets&#x2F;Consensys-EIP20.sol&quot;&gt;ConsenSys implementation&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;history&quot;&gt;History&lt;&#x2F;h2&gt;
&lt;p&gt;Historical links related to this standard:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Original proposal from Vitalik Buterin: https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;wiki&#x2F;wiki&#x2F;Standardized_Contract_APIs&#x2F;499c882f3ec123537fc2fccd57eaa29e6032fe4a&lt;&#x2F;li&gt;
&lt;li&gt;Reddit discussion: https:&#x2F;&#x2F;www.reddit.com&#x2F;r&#x2F;ethereum&#x2F;comments&#x2F;3n8fkn&#x2F;lets_talk_about_the_coin_standard&#x2F;&lt;&#x2F;li&gt;
&lt;li&gt;Original Issue #20: https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;20&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Addition of CALLDEPTH opcode</title>
        <published>2015-11-19T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Martin Holst Swende</name><email>martin@swende.se</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/3/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:3"
            label="EIP-3" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3/">&lt;h1 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h1&gt;
&lt;p&gt;This is a proposal to add a new opcode, &lt;code&gt;CALLDEPTH&lt;&#x2F;code&gt;. The &lt;code&gt;CALLDEPTH&lt;&#x2F;code&gt; opcode would return the remaining available call stack depth.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h1&gt;
&lt;p&gt;There is a limit specifying how deep contracts can call other contracts; the call stack. The limit is currently &lt;code&gt;256&lt;&#x2F;code&gt;. If a contract invokes another contract (either via &lt;code&gt;CALL&lt;&#x2F;code&gt; or &lt;code&gt;CALLCODE&lt;&#x2F;code&gt;), the operation will fail if the call stack depth limit has been reached.&lt;&#x2F;p&gt;
&lt;p&gt;This behaviour makes it possible to subject a contract to a &quot;call stack attack&quot; [1]. In such an attack, an attacker first creates a suitable depth of the stack, e.g. by recursive calls. After this step, the attacker invokes the targeted contract. If the targeted calls another contract, that call will fail. If the return value is not properly checked to see if the call was successful, the consequences could be damaging.&lt;&#x2F;p&gt;
&lt;p&gt;Example:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Contract &lt;code&gt;A&lt;&#x2F;code&gt; wants to be invoked regularly, and pays Ether to the invoker in every block.&lt;&#x2F;li&gt;
&lt;li&gt;When contract &lt;code&gt;A&lt;&#x2F;code&gt; is invoked, it calls contracts &lt;code&gt;B&lt;&#x2F;code&gt; and &lt;code&gt;C&lt;&#x2F;code&gt;, which consumes a lot of gas. After invocation, contract &lt;code&gt;A&lt;&#x2F;code&gt; pays Ether to the caller.&lt;&#x2F;li&gt;
&lt;li&gt;Malicious user &lt;code&gt;X&lt;&#x2F;code&gt; ensures that the stack depth is shallow before invoking A. Both calls to &lt;code&gt;B&lt;&#x2F;code&gt; and &lt;code&gt;C&lt;&#x2F;code&gt; fail, but &lt;code&gt;X&lt;&#x2F;code&gt; can still collect the reward.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;It is possible to defend against this in two ways:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Check return value after invocation.&lt;&#x2F;li&gt;
&lt;li&gt;Check call stack depth experimentally. A library [2] by Piper Merriam exists for this purpose. This method is quite costly in gas.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;[1] a.k.a &quot;shallow stack attack&quot; and &quot;stack attack&quot;. However, to be precise, the word &#x27;&#x27;stack&#x27;&#x27; has a different meaning within the EVM, and is not to be confused with the &#x27;&#x27;call stack&#x27;&#x27;.&lt;&#x2F;p&gt;
&lt;p&gt;[2] https:&#x2F;&#x2F;github.com&#x2F;pipermerriam&#x2F;ethereum-stack-depth-lib&lt;&#x2F;p&gt;
&lt;h1 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h1&gt;
&lt;p&gt;The opcode &lt;code&gt;CALLDEPTH&lt;&#x2F;code&gt; should return the remaining call stack depth. A value of &lt;code&gt;0&lt;&#x2F;code&gt; means that the call stack is exhausted, and no further calls can be made.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h1&gt;
&lt;p&gt;The actual call stack depth, as well as the call stack depth limit, are present in the EVM during execution, but just not available within the EVM. The implementation should be fairly simple and would provide a cheap and way to protect against call stack attacks.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h1&gt;
&lt;p&gt;Not implemented.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Serenity Currency and Crypto Abstraction</title>
        <published>2015-11-15T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/101/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/101/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:101"
            label="EIP-101" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/101/">&lt;h3 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;Accounts now have only two fields in their RLP encoding: &lt;strong&gt;code&lt;&#x2F;strong&gt; and &lt;strong&gt;storage&lt;&#x2F;strong&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Ether is no longer stored in account objects directly; instead, at address &lt;code&gt;0&lt;&#x2F;code&gt;, we premine a contract which contains all ether holdings. The &lt;code&gt;eth.getBalance&lt;&#x2F;code&gt; command in web3 is remapped appropriately.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;msg.value&lt;&#x2F;code&gt; no longer exists as an opcode.&lt;&#x2F;li&gt;
&lt;li&gt;A transaction now only has four fields: &lt;strong&gt;to&lt;&#x2F;strong&gt;, &lt;strong&gt;startgas&lt;&#x2F;strong&gt;, &lt;strong&gt;data&lt;&#x2F;strong&gt; and &lt;strong&gt;code&lt;&#x2F;strong&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Aside from an RLP validity check, and checking that the &lt;strong&gt;to&lt;&#x2F;strong&gt; field is twenty bytes long, the &lt;strong&gt;startgas&lt;&#x2F;strong&gt; is an integer, and &lt;strong&gt;code&lt;&#x2F;strong&gt; is either empty or hashes to the &lt;strong&gt;to&lt;&#x2F;strong&gt; address, there are no other validity constraints; anything goes. However, the block gas limit remains, so miners are disincentivized from including junk.&lt;&#x2F;li&gt;
&lt;li&gt;Gas is charged for bytes in &lt;strong&gt;code&lt;&#x2F;strong&gt; at the same rate as &lt;strong&gt;data&lt;&#x2F;strong&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;When a transaction is sent, if the receiving account does not yet exist, the account is created, and its code is set to the code provided in the transaction; otherwise the code is ignored.&lt;&#x2F;li&gt;
&lt;li&gt;A &lt;code&gt;tx.gas&lt;&#x2F;code&gt; opcode is added alongside the existing &lt;code&gt;msg.gas&lt;&#x2F;code&gt; at index &lt;code&gt;0x5c&lt;&#x2F;code&gt;; this new opcode allows the transaction to access the original amount of gas allotted for the transaction&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Note that &lt;code&gt;ECRECOVER&lt;&#x2F;code&gt;, sequence number&#x2F;nonce incrementing and ether are now nowhere in the bottom-level spec (NOTE: ether is going to continue to have a privileged role in Casper PoS). To replicate existing functionality under the new model, we do the following.&lt;&#x2F;p&gt;
&lt;p&gt;Simple user accounts can have the following default standardized code:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; We assume that data takes the following schema:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; bytes 0-31: v (ECDSA sig)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; bytes 32-63: r (ECDSA sig)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; bytes 64-95: s (ECDSA sig)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; bytes 96-127: sequence number (formerly called &amp;quot;nonce&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; bytes 128-159: gasprice&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; bytes 172-191: to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; bytes 192+: data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the hash for transaction signing&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;~&lt;&#x2F;span&gt;&lt;span&gt;mstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;~&lt;&#x2F;span&gt;&lt;span&gt;calldatacopy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 96&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 96&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;h&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sha3&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;96&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 96&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Call ECRECOVER contract to get the sender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;~&lt;&#x2F;span&gt;&lt;span&gt;call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;5000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;h&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;64&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 128&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; ref&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check sender correctness&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span&gt; addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;82a978b3f5962a5b0957d9ee9eef472ee55b42f1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check sequence number correctness&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;96&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;storage&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Increment sequence number&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;storage&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Make the sub-call and discard output&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;~&lt;&#x2F;span&gt;&lt;span&gt;call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 50000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;160&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 192&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 192&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Pay for gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;~&lt;&#x2F;span&gt;&lt;span&gt;call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;40000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SEND&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;coinbase&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;128&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 50000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 96&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This essentially implements signature and nonce checking, and if both checks pass then it uses all remaining gas minus 50000 to send the actual desired call, and then finally pays for gas.&lt;&#x2F;p&gt;
&lt;p&gt;Miners can follow the following algorithm upon receiving transactions:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Run the code for a maximum of 50000 gas, stopping if they see an operation or call that threatens to go over this limit&lt;&#x2F;li&gt;
&lt;li&gt;Upon seeing that operation, make sure that it leaves at least 50000 gas to spare (either by checking that the static gas consumption is small enough or by checking that it is a call with &lt;code&gt;msg.gas - 50000&lt;&#x2F;code&gt; as its gas limit parameter)&lt;&#x2F;li&gt;
&lt;li&gt;Pattern-match to make sure that gas payment code at the end is &lt;em&gt;exactly&lt;&#x2F;em&gt; the same as in the code above.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;This process ensures that miners &lt;em&gt;waste&lt;&#x2F;em&gt; at most 50000 gas before knowing whether or not it will be worth their while to include the transaction, and is also highly general so users can experiment with new cryptography (eg. ed25519, Lamport), ring signatures, quasi-native multisig, etc. Theoretically, one can even create an account for which the &lt;em&gt;valid signature&lt;&#x2F;em&gt; type is a valid Merkle branch of a receipt, creating a quasi-native alarm clock.&lt;&#x2F;p&gt;
&lt;p&gt;If someone wants to send a transaction with nonzero value, instead of the current &lt;code&gt;msg.sender&lt;&#x2F;code&gt; approach, we compile into a three step process:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;In the outer scope just before calling, call the ether contract to create a cheque for the desired amount&lt;&#x2F;li&gt;
&lt;li&gt;In the inner scope, if a contract uses the &lt;code&gt;msg.value&lt;&#x2F;code&gt; opcode anywhere in the function that is being called, then we have the contract cash out the cheque at the start of the function call and store the amount cashed out in a standardized address in memory&lt;&#x2F;li&gt;
&lt;li&gt;In the outer scope just after calling, send a message to the ether contract to disable the cheque if it has not yet been cashed&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h3&gt;
&lt;p&gt;This allows for a large increase in generality, particularly in a few
areas:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Cryptographic algorithms used to secure accounts (we could reasonably say that Ethereum is quantum-safe, as one is perfectly free to secure one&#x27;s account with Lamport signatures). The nonce-incrementing approach is now also open to revision on the part of account holders, allowing for experimentation in k-parallelizable nonce techniques, UTXO schemes, etc.&lt;&#x2F;li&gt;
&lt;li&gt;Moving ether up a level of abstraction, with the particular benefit of allowing ether and sub-tokens to be treated similarly by contracts&lt;&#x2F;li&gt;
&lt;li&gt;Reducing the level of indirection required for custom-policy accounts such as multisigs&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;It also substantially simplifies and &lt;em&gt;purifies&lt;&#x2F;em&gt; the underlying Ethereum protocol, reducing the minimal consensus implementation complexity.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h3&gt;
&lt;p&gt;Coming soon.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Homestead Hard-fork Changes</title>
        <published>2015-11-15T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/2/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2"
            label="EIP-2" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2/">&lt;h3 id=&quot;meta-reference&quot;&gt;Meta reference&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;606&#x2F;&quot;&gt;Homestead&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;FORK_BLKNUM&lt;&#x2F;th&gt;&lt;th&gt;CHAIN_NAME&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;1,150,000&lt;&#x2F;td&gt;&lt;td&gt;Main net&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;494,000&lt;&#x2F;td&gt;&lt;td&gt;Morden&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;Future testnets&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h1 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h1&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= HOMESTEAD_FORK_BLKNUM&lt;&#x2F;code&gt;, do the following:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The gas cost &lt;em&gt;for creating contracts via a transaction&lt;&#x2F;em&gt; is increased from 21,000 to 53,000, i.e. if you send a transaction and the to address is the empty string, the initial gas subtracted is 53,000 plus the gas cost of the tx data, rather than 21,000 as is currently the case. Contract creation from a contract using the &lt;code&gt;CREATE&lt;&#x2F;code&gt; opcode is unaffected.&lt;&#x2F;li&gt;
&lt;li&gt;All transaction signatures whose s-value is greater than &lt;code&gt;secp256k1n&#x2F;2&lt;&#x2F;code&gt; are now considered invalid. The ECDSA recover precompiled contract remains unchanged and will keep accepting high s-values; this is useful e.g. if a contract recovers old Bitcoin signatures.&lt;&#x2F;li&gt;
&lt;li&gt;If contract creation does not have enough gas to pay for the final gas fee for adding the contract code to the state, the contract creation fails (i.e. goes out-of-gas) rather than leaving an empty contract.&lt;&#x2F;li&gt;
&lt;li&gt;Change the difficulty adjustment algorithm from the current formula: &lt;code&gt;block_diff = parent_diff + parent_diff &#x2F;&#x2F; 2048 * (1 if block_timestamp - parent_timestamp &amp;lt; 13 else -1) + int(2**((block.number &#x2F;&#x2F; 100000) - 2))&lt;&#x2F;code&gt; (where the &lt;code&gt;int(2**((block.number &#x2F;&#x2F; 100000) - 2))&lt;&#x2F;code&gt; represents the exponential difficulty adjustment component) to &lt;code&gt;block_diff = parent_diff + parent_diff &#x2F;&#x2F; 2048 * max(1 - (block_timestamp - parent_timestamp) &#x2F;&#x2F; 10, -99) + int(2**((block.number &#x2F;&#x2F; 100000) - 2))&lt;&#x2F;code&gt;, where &lt;code&gt;&#x2F;&#x2F;&lt;&#x2F;code&gt; is the integer division operator, eg. &lt;code&gt;6 &#x2F;&#x2F; 2 = 3&lt;&#x2F;code&gt;, &lt;code&gt;7 &#x2F;&#x2F; 2 = 3&lt;&#x2F;code&gt;, &lt;code&gt;8 &#x2F;&#x2F; 2 = 4&lt;&#x2F;code&gt;. The &lt;code&gt;minDifficulty&lt;&#x2F;code&gt; still defines the minimum difficulty allowed and no adjustment may take it below this.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h1 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h1&gt;
&lt;p&gt;Currently, there is an excess incentive to create contracts via transactions, where the cost is 21,000, rather than contracts, where the cost is 32,000. Additionally, with the help of suicide refunds, it is currently possible to make a simple ether value transfer using only 11,664 gas; the code for doing this is as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt; ethereum&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; import&lt;&#x2F;span&gt;&lt;span&gt; tester&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; as&lt;&#x2F;span&gt;&lt;span&gt; t&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt; ethereum&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; import&lt;&#x2F;span&gt;&lt;span&gt; utils&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; t&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; s&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;abi_contract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;def init():&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; suicide(0x47e25df8822538a8596b28c637896b4d143c351e)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; endowment&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;15&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; s&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get_receipts&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;11664&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; s&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get_balance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;utils&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;normalize_address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;47e25df8822538a8596b28c637896b4d143c351e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;1000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This is not a particularly serious problem, but it is nevertheless arguably a bug.&lt;&#x2F;p&gt;
&lt;p&gt;Allowing transactions with any s value with &lt;code&gt;0 &amp;lt; s &amp;lt; secp256k1n&lt;&#x2F;code&gt;, as is currently the case, opens a transaction malleability concern, as one can take any transaction, flip the s value from &lt;code&gt;s&lt;&#x2F;code&gt; to &lt;code&gt;secp256k1n - s&lt;&#x2F;code&gt;, flip the v value (&lt;code&gt;27 -&amp;gt; 28&lt;&#x2F;code&gt;, &lt;code&gt;28 -&amp;gt; 27&lt;&#x2F;code&gt;), and the resulting signature would still be valid. This is not a serious security flaw, especially since Ethereum uses addresses and not transaction hashes as the input to an ether value transfer or other transaction, but it nevertheless creates a UI inconvenience as an attacker can cause the transaction that gets confirmed in a block to have a different hash from the transaction that any user sends, interfering with user interfaces that use transaction hashes as tracking IDs. Preventing high s values removes this problem.&lt;&#x2F;p&gt;
&lt;p&gt;Making contract creation go out-of-gas if there is not enough gas to pay for the final gas fee has the benefits that:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;(i) it creates a more intuitive &quot;success or fail&quot; distinction in the result of a contract creation process, rather than the current &quot;success, fail, or empty contract&quot; trichotomy;&lt;&#x2F;li&gt;
&lt;li&gt;(ii) makes failures more easily detectable, as unless contract creation fully succeeds then no contract account will be created at all; and&lt;&#x2F;li&gt;
&lt;li&gt;(iii) makes contract creation safer in the case where there is an endowment, as there is a guarantee that either the entire initiation process happens or the transaction fails and the endowment is refunded.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The difficulty adjustment change conclusively solves a problem that the Ethereum protocol saw two months ago where an excessive number of miners were mining blocks that contain a timestamp equal to &lt;code&gt;parent_timestamp + 1&lt;&#x2F;code&gt;; this skewed the block time distribution, and so the current block time algorithm, which targets a &lt;em&gt;median&lt;&#x2F;em&gt; of 13 seconds, continued to target the same median but the mean started increasing. If 51% of miners had started mining blocks in this way, the mean would have increased to infinity. The proposed new formula is roughly based on targeting the mean; one can prove that with the formula in use, an average block time longer than 24 seconds is mathematically impossible in the long term.&lt;&#x2F;p&gt;
&lt;p&gt;The use of &lt;code&gt;(block_timestamp - parent_timestamp) &#x2F;&#x2F; 10&lt;&#x2F;code&gt; as the main input variable rather than the time difference directly serves to maintain the coarse-grained nature of the algorithm, preventing an excessive incentive to set the timestamp difference to exactly 1 in order to create a block that has slightly higher difficulty and that will thus be guaranteed to beat out any possible forks. The cap of -99 simply serves to ensure that the difficulty does not fall extremely far if two blocks happen to be very far apart in time due to a client security bug or other black-swan issue.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h1&gt;
&lt;p&gt;This is implemented in Python here:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;pyethereum&#x2F;blob&#x2F;d117c8f3fd93359fc641fd850fa799436f7c43b5&#x2F;ethereum&#x2F;processblock.py#L130&lt;&#x2F;li&gt;
&lt;li&gt;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;pyethereum&#x2F;blob&#x2F;d117c8f3fd93359fc641fd850fa799436f7c43b5&#x2F;ethereum&#x2F;processblock.py#L129&lt;&#x2F;li&gt;
&lt;li&gt;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;pyethereum&#x2F;blob&#x2F;d117c8f3fd93359fc641fd850fa799436f7c43b5&#x2F;ethereum&#x2F;processblock.py#L304&lt;&#x2F;li&gt;
&lt;li&gt;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;pyethereum&#x2F;blob&#x2F;d117c8f3fd93359fc641fd850fa799436f7c43b5&#x2F;ethereum&#x2F;blocks.py#L42&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>DELEGATECALL</title>
        <published>2015-11-15T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/7/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:7"
            label="EIP-7" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7/">&lt;h3 id=&quot;hard-fork&quot;&gt;Hard Fork&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;606&#x2F;&quot;&gt;Homestead&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Activation:
&lt;ul&gt;
&lt;li&gt;Block &amp;gt;= 1,150,000 on Mainnet&lt;&#x2F;li&gt;
&lt;li&gt;Block &amp;gt;= 494,000 on Morden&lt;&#x2F;li&gt;
&lt;li&gt;Block &amp;gt;= 0 on future testnets&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;overview&quot;&gt;Overview&lt;&#x2F;h3&gt;
&lt;p&gt;Add a new opcode, &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; at &lt;code&gt;0xf4&lt;&#x2F;code&gt;, which is similar in idea to &lt;code&gt;CALLCODE&lt;&#x2F;code&gt;, except that it propagates the sender and value from the parent scope to the child scope, i.e. the call created has the same sender and value as the original call.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;: &lt;code&gt;0xf4&lt;&#x2F;code&gt;, takes 6 operands:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;gas&lt;&#x2F;code&gt;: the amount of gas the code may use in order to execute;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;to&lt;&#x2F;code&gt;: the destination address whose code is to be executed;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;in_offset&lt;&#x2F;code&gt;: the offset into memory of the input;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;in_size&lt;&#x2F;code&gt;: the size of the input in bytes;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;out_offset&lt;&#x2F;code&gt;: the offset into memory of the output;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;out_size&lt;&#x2F;code&gt;: the size of the scratch pad for the output.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;notes-on-gas&quot;&gt;Notes on gas&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;The basic stipend is not given; &lt;code&gt;gas&lt;&#x2F;code&gt; is the total amount the callee receives.&lt;&#x2F;li&gt;
&lt;li&gt;Like &lt;code&gt;CALLCODE&lt;&#x2F;code&gt;, account creation never happens, so the upfront gas cost is always &lt;code&gt;schedule.callGas&lt;&#x2F;code&gt; + &lt;code&gt;gas&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Unused gas is refunded as normal.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;notes-on-sender&quot;&gt;Notes on sender&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;CALLER&lt;&#x2F;code&gt; and &lt;code&gt;VALUE&lt;&#x2F;code&gt; behave exactly in the callee&#x27;s environment as they do in the caller&#x27;s environment.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;other-notes&quot;&gt;Other notes&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;The depth limit of 1024 is still preserved as normal.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h3&gt;
&lt;p&gt;Propagating the sender and value from the parent scope to the child scope makes it much easier for a contract to store another address as a mutable source of code and &#x27;&#x27;pass through&#x27;&#x27; calls to it, as the child code would execute in essentially the same environment (except for reduced gas and increased callstack depth) as the parent.&lt;&#x2F;p&gt;
&lt;p&gt;Use case 1: split code to get around 3m gas barrier&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;~&lt;&#x2F;span&gt;&lt;span&gt;calldatacopy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;253&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    ~&lt;&#x2F;span&gt;&lt;span&gt;delegate_call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; $&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;ADDR1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    ~&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;~&lt;&#x2F;span&gt;&lt;span&gt;calldatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;elif&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;253&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    ~&lt;&#x2F;span&gt;&lt;span&gt;delegate_call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; $&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;ADDR2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    ~&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;~&lt;&#x2F;span&gt;&lt;span&gt;calldatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Use case 2: mutable address for storing the code of a contract:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;224&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;12345678&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;    self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;delegate&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    ~&lt;&#x2F;span&gt;&lt;span&gt;delegate_call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;delegate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    ~&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;~&lt;&#x2F;span&gt;&lt;span&gt;calldatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The child functions called by these methods can now freely reference &lt;code&gt;msg.sender&lt;&#x2F;code&gt; and &lt;code&gt;msg.value&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;possible-arguments-against&quot;&gt;Possible arguments against&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;You can replicate this functionality by just sticking the sender into the first twenty bytes of the call data. However, this would mean that code would need to be specially compiled for delegated contracts, and would not be usable in delegated and raw contexts at the same time.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
</content>
    </entry>
</feed>
